From: support Date: Tue, 8 Nov 2022 09:00:56 +0000 (+0000) Subject: Built motion from commit 65c208aa.|2.6.21 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=015cf8030eac1bec5e78347672a494a83f282957;p=motion2.git Built motion from commit 65c208aa.|2.6.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c3855c2..da59be4 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-11-08T08:30:43.726Z", + "time": "2022-11-08T08:51:36.023Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6ad8701..a4e9b52 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-08T08:30:43.726Z", + "time": "2022-11-08T08:51:36.023Z", "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 3e36b55..83c2e3c 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 _0x6361=['exports','VIRTUAL','getDataValue','action','STRING','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]','urlForward[body]','sequelize'];(function(_0x422849,_0x2c5841){var _0x51f61b=function(_0x5b512a){while(--_0x5b512a){_0x422849['push'](_0x422849['shift']());}};_0x51f61b(++_0x2c5841);}(_0x6361,0x76));var _0x1636=function(_0x5ed212,_0x47aeaf){_0x5ed212=_0x5ed212-0x0;var _0x294026=_0x6361[_0x5ed212];return _0x294026;};'use strict';var Sequelize=require(_0x1636('0x0'));module[_0x1636('0x1')]={'name':{'type':Sequelize[_0x1636('0x2')],'get':function(_0x595691){return this[_0x1636('0x3')](_0x1636('0x4'));}},'action':{'type':Sequelize[_0x1636('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar','jscripty',_0x1636('0x6'),_0x1636('0x7'),_0x1636('0x8'),_0x1636('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1636('0xa')},'data1':{'type':Sequelize[_0x1636('0x5')](0x1000),'comment':_0x1636('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x1636('0xc')},'data3':{'type':Sequelize[_0x1636('0x5')](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[_0x1636('0x5')](0x1000),'comments':_0x1636('0xd')},'data5':{'type':Sequelize[_0x1636('0x5')](0x1000),'comments':_0x1636('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x1636('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x1636('0x10')}}; \ No newline at end of file +var _0x2f14=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','contactManager','integration','motionbar','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x2f14,0x1b4));var _0x42f1=function(_0x375fc0,_0x205301){_0x375fc0=_0x375fc0-0x0;var _0x424ca4=_0x2f14[_0x375fc0];return _0x424ca4;};'use strict';var Sequelize=require(_0x42f1('0x0'));module[_0x42f1('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x31fa52){return this[_0x42f1('0x2')](_0x42f1('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x42f1('0x4'),_0x42f1('0x5'),_0x42f1('0x6'),'jscripty','urlForward',_0x42f1('0x7'),'bot',_0x42f1('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x42f1('0x9')},'data1':{'type':Sequelize[_0x42f1('0xa')](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x42f1('0xa')](0x1000),'comment':_0x42f1('0xb')},'data3':{'type':Sequelize[_0x42f1('0xa')](0x1000),'comment':_0x42f1('0xc')},'data4':{'type':Sequelize[_0x42f1('0xa')](0x1000),'comments':_0x42f1('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x42f1('0xe')},'data6':{'type':Sequelize[_0x42f1('0xa')],'comments':_0x42f1('0xf')},'data7':{'type':Sequelize[_0x42f1('0x10')],'comments':_0x42f1('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9f7b541..7ceca22 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 _0x4aff=['count','limit','set','json','apply','reject','save','update','destroy','then','error','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x33c824,_0x9a6363){var _0x177283=function(_0x19a867){while(--_0x19a867){_0x33c824['push'](_0x33c824['shift']());}};_0x177283(++_0x9a6363);}(_0x4aff,0xfd));var _0xf4af=function(_0x1f32cb,_0x10774e){_0x1f32cb=_0x1f32cb-0x0;var _0xff2722=_0x4aff[_0x1f32cb];return _0xff2722;};'use strict';var emlformat=require(_0xf4af('0x0'));var rimraf=require(_0xf4af('0x1'));var zipdir=require(_0xf4af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4af('0x3'));var moment=require(_0xf4af('0x4'));var BPromise=require(_0xf4af('0x5'));var Mustache=require(_0xf4af('0x6'));var util=require(_0xf4af('0x7'));var path=require(_0xf4af('0x8'));var sox=require(_0xf4af('0x9'));var csv=require('to-csv');var ejs=require(_0xf4af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4af('0xb'));var squel=require(_0xf4af('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf4af('0xd'));var toCsv=require(_0xf4af('0xe'));var querystring=require(_0xf4af('0xf'));var Papa=require(_0xf4af('0x10'));var Redis=require(_0xf4af('0x11'));var authService=require(_0xf4af('0x12'));var qs=require(_0xf4af('0x13'));var as=require(_0xf4af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf4af('0x15'));var config=require(_0xf4af('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4af('0x17'))['db'];function respondWithStatusCode(_0x3cec15,_0x57f83e){_0x57f83e=_0x57f83e||0xcc;return function(_0x1f5758){if(_0x1f5758){return _0x3cec15[_0xf4af('0x18')](_0x57f83e);}return _0x3cec15[_0xf4af('0x19')](_0x57f83e)[_0xf4af('0x1a')]();};}function respondWithResult(_0x1c3545,_0x5bdd10){_0x5bdd10=_0x5bdd10||0xc8;return function(_0x3f5a79){if(_0x3f5a79){return _0x1c3545[_0xf4af('0x19')](_0x5bdd10)['json'](_0x3f5a79);}};}function respondWithFilteredResult(_0x2d80e8,_0x414c6a){return function(_0x3f01d5){if(_0x3f01d5){var _0x51c9db=typeof _0x414c6a[_0xf4af('0x1b')]==='undefined'&&typeof _0x414c6a['limit']===_0xf4af('0x1c');var _0x3fc268=_0x3f01d5[_0xf4af('0x1d')];var _0x31feec=_0x51c9db?0x0:_0x414c6a[_0xf4af('0x1b')];var _0x2e1349=_0x51c9db?_0x3f01d5[_0xf4af('0x1d')]:_0x414c6a[_0xf4af('0x1b')]+_0x414c6a[_0xf4af('0x1e')];var _0x2131a3;if(_0x2e1349>=_0x3fc268){_0x2e1349=_0x3fc268;_0x2131a3=0xc8;}else{_0x2131a3=0xce;}_0x2d80e8[_0xf4af('0x19')](_0x2131a3);return _0x2d80e8[_0xf4af('0x1f')]('Content-Range',_0x31feec+'-'+_0x2e1349+'/'+_0x3fc268)[_0xf4af('0x20')](_0x3f01d5);}return null;};}function patchUpdates(_0x39f141){return function(_0x6287a4){try{jsonpatch[_0xf4af('0x21')](_0x6287a4,_0x39f141,!![]);}catch(_0x219828){return BPromise[_0xf4af('0x22')](_0x219828);}return _0x6287a4[_0xf4af('0x23')]();};}function saveUpdates(_0x17b23b,_0x28ac95){return function(_0x89f281){if(_0x89f281){return _0x89f281[_0xf4af('0x24')](_0x17b23b)['then'](function(_0x2c2578){return _0x2c2578;});}return null;};}function removeEntity(_0x2311d3,_0x478ceb){return function(_0x428c4a){if(_0x428c4a){return _0x428c4a[_0xf4af('0x25')]()[_0xf4af('0x26')](function(){_0x2311d3[_0xf4af('0x19')](0xcc)[_0xf4af('0x1a')]();});}};}function handleEntityNotFound(_0x471008,_0x535b64){return function(_0x56ea71){if(!_0x56ea71){_0x471008[_0xf4af('0x18')](0x194);}return _0x56ea71;};}function handleError(_0x5357ed,_0xf6e56c){_0xf6e56c=_0xf6e56c||0x1f4;return function(_0x426f87){logger[_0xf4af('0x27')](_0x426f87['stack']);if(_0x426f87[_0xf4af('0x28')]){delete _0x426f87[_0xf4af('0x28')];}_0x5357ed[_0xf4af('0x19')](_0xf6e56c)[_0xf4af('0x29')](_0x426f87);};}exports['update']=function(_0x43bc86,_0x357c59){if(_0x43bc86[_0xf4af('0x2a')]['id']){delete _0x43bc86[_0xf4af('0x2a')]['id'];}return db[_0xf4af('0x2b')][_0xf4af('0x2c')]({'where':{'id':_0x43bc86[_0xf4af('0x2d')]['id']}})['then'](handleEntityNotFound(_0x357c59,null))[_0xf4af('0x26')](saveUpdates(_0x43bc86[_0xf4af('0x2a')],null))[_0xf4af('0x26')](respondWithResult(_0x357c59,null))['catch'](handleError(_0x357c59,null));};exports[_0xf4af('0x25')]=function(_0x50daed,_0x6cdce8){return db[_0xf4af('0x2b')][_0xf4af('0x2c')]({'where':{'id':_0x50daed['params']['id']}})['then'](handleEntityNotFound(_0x6cdce8,null))[_0xf4af('0x26')](removeEntity(_0x6cdce8,null))[_0xf4af('0x2e')](handleError(_0x6cdce8,null));}; \ No newline at end of file +var _0xc8da=['send','update','body','find','params','catch','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','then','error','name'];(function(_0x5af305,_0xaf3cf8){var _0x4d9831=function(_0x5bc3c7){while(--_0x5bc3c7){_0x5af305['push'](_0x5af305['shift']());}};_0x4d9831(++_0xaf3cf8);}(_0xc8da,0x15f));var _0xac8d=function(_0x5c4cb2,_0x396192){_0x5c4cb2=_0x5c4cb2-0x0;var _0x26f2fb=_0xc8da[_0x5c4cb2];return _0x26f2fb;};'use strict';var emlformat=require(_0xac8d('0x0'));var rimraf=require(_0xac8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac8d('0x2'));var rp=require('request-promise');var moment=require(_0xac8d('0x3'));var BPromise=require(_0xac8d('0x4'));var Mustache=require(_0xac8d('0x5'));var util=require('util');var path=require(_0xac8d('0x6'));var sox=require('sox');var csv=require(_0xac8d('0x7'));var ejs=require(_0xac8d('0x8'));var fs=require('fs');var fs_extra=require(_0xac8d('0x9'));var _=require('lodash');var squel=require(_0xac8d('0xa'));var crypto=require(_0xac8d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xac8d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac8d('0xd'));var Papa=require(_0xac8d('0xe'));var Redis=require(_0xac8d('0xf'));var authService=require(_0xac8d('0x10'));var qs=require(_0xac8d('0x11'));var as=require(_0xac8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac8d('0x13'));var utils=require(_0xac8d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac8d('0x15'))['db'];function respondWithStatusCode(_0x418332,_0x1e91ac){_0x1e91ac=_0x1e91ac||0xcc;return function(_0x152236){if(_0x152236){return _0x418332[_0xac8d('0x16')](_0x1e91ac);}return _0x418332[_0xac8d('0x17')](_0x1e91ac)[_0xac8d('0x18')]();};}function respondWithResult(_0x2c32ab,_0xc50964){_0xc50964=_0xc50964||0xc8;return function(_0x277768){if(_0x277768){return _0x2c32ab[_0xac8d('0x17')](_0xc50964)['json'](_0x277768);}};}function respondWithFilteredResult(_0x439986,_0x2e3100){return function(_0x3e860c){if(_0x3e860c){var _0x363f40=typeof _0x2e3100['offset']===_0xac8d('0x19')&&typeof _0x2e3100[_0xac8d('0x1a')]===_0xac8d('0x19');var _0x563233=_0x3e860c['count'];var _0x3466e4=_0x363f40?0x0:_0x2e3100['offset'];var _0x14f934=_0x363f40?_0x3e860c['count']:_0x2e3100[_0xac8d('0x1b')]+_0x2e3100['limit'];var _0x4283b5;if(_0x14f934>=_0x563233){_0x14f934=_0x563233;_0x4283b5=0xc8;}else{_0x4283b5=0xce;}_0x439986[_0xac8d('0x17')](_0x4283b5);return _0x439986[_0xac8d('0x1c')](_0xac8d('0x1d'),_0x3466e4+'-'+_0x14f934+'/'+_0x563233)[_0xac8d('0x1e')](_0x3e860c);}return null;};}function patchUpdates(_0x5c3912){return function(_0x4ef6ce){try{jsonpatch['apply'](_0x4ef6ce,_0x5c3912,!![]);}catch(_0x2b1c60){return BPromise[_0xac8d('0x1f')](_0x2b1c60);}return _0x4ef6ce[_0xac8d('0x20')]();};}function saveUpdates(_0x3eb004,_0x31129b){return function(_0x2c36a3){if(_0x2c36a3){return _0x2c36a3['update'](_0x3eb004)['then'](function(_0x44d694){return _0x44d694;});}return null;};}function removeEntity(_0x493cf1,_0x299ac5){return function(_0x1b850d){if(_0x1b850d){return _0x1b850d['destroy']()[_0xac8d('0x21')](function(){_0x493cf1[_0xac8d('0x17')](0xcc)[_0xac8d('0x18')]();});}};}function handleEntityNotFound(_0x27be4e,_0x3b2f31){return function(_0x283158){if(!_0x283158){_0x27be4e[_0xac8d('0x16')](0x194);}return _0x283158;};}function handleError(_0x1553c1,_0x477ed0){_0x477ed0=_0x477ed0||0x1f4;return function(_0x58a5e5){logger[_0xac8d('0x22')](_0x58a5e5['stack']);if(_0x58a5e5[_0xac8d('0x23')]){delete _0x58a5e5[_0xac8d('0x23')];}_0x1553c1['status'](_0x477ed0)[_0xac8d('0x24')](_0x58a5e5);};}exports[_0xac8d('0x25')]=function(_0x22ba69,_0x91fea1){if(_0x22ba69[_0xac8d('0x26')]['id']){delete _0x22ba69[_0xac8d('0x26')]['id'];}return db['Action'][_0xac8d('0x27')]({'where':{'id':_0x22ba69[_0xac8d('0x28')]['id']}})[_0xac8d('0x21')](handleEntityNotFound(_0x91fea1,null))[_0xac8d('0x21')](saveUpdates(_0x22ba69[_0xac8d('0x26')],null))[_0xac8d('0x21')](respondWithResult(_0x91fea1,null))[_0xac8d('0x29')](handleError(_0x91fea1,null));};exports[_0xac8d('0x2a')]=function(_0x2d1b78,_0x5a7c39){return db['Action'][_0xac8d('0x27')]({'where':{'id':_0x2d1b78[_0xac8d('0x28')]['id']}})[_0xac8d('0x21')](handleEntityNotFound(_0x5a7c39,null))[_0xac8d('0x21')](removeEntity(_0x5a7c39,null))[_0xac8d('0x29')](handleError(_0x5a7c39,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 63a8196..c85658a 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 _0xdf27=['util','moment','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash'];(function(_0x667081,_0x1d02b8){var _0x1c1e88=function(_0x4231c2){while(--_0x4231c2){_0x667081['push'](_0x667081['shift']());}};_0x1c1e88(++_0x1d02b8);}(_0xdf27,0x104));var _0x7df2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdf27[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x7df2('0x0'));var util=require(_0x7df2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7df2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7df2('0x3'));var config=require(_0x7df2('0x4'));var attributes=require(_0x7df2('0x5'));module[_0x7df2('0x6')]=function(_0x1ae69d,_0x39bbdc){return _0x1ae69d[_0x7df2('0x7')](_0x7df2('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33a5=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xc4f188,_0x4a69b2){var _0x23c132=function(_0x5663b6){while(--_0x5663b6){_0xc4f188['push'](_0xc4f188['shift']());}};_0x23c132(++_0x4a69b2);}(_0x33a5,0x180));var _0x533a=function(_0xc52725,_0x27a0fb){_0xc52725=_0xc52725-0x0;var _0x2aca87=_0x33a5[_0xc52725];return _0x2aca87;};'use strict';var _=require(_0x533a('0x0'));var util=require(_0x533a('0x1'));var logger=require(_0x533a('0x2'))(_0x533a('0x3'));var moment=require(_0x533a('0x4'));var BPromise=require('bluebird');var rp=require(_0x533a('0x5'));var fs=require('fs');var path=require(_0x533a('0x6'));var rimraf=require(_0x533a('0x7'));var config=require(_0x533a('0x8'));var attributes=require(_0x533a('0x9'));module[_0x533a('0xa')]=function(_0x295a39,_0x4bac39){return _0x295a39[_0x533a('0xb')](_0x533a('0xc'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 56f2398..8f5373d 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 _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(_0x5a2163,_0x186792){var _0x53427a=function(_0x2e0ec0){while(--_0x2e0ec0){_0x5a2163['push'](_0x5a2163['shift']());}};_0x53427a(++_0x186792);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x18be08,_0x1329bc){_0x18be08=_0x18be08-0x0;var _0x5cdf81=_0x7fbe[_0x18be08];return _0x5cdf81;};'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 +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x24a0ba,_0x3073fb){var _0x21e169=function(_0x168d34){while(--_0x168d34){_0x24a0ba['push'](_0x24a0ba['shift']());}};_0x21e169(++_0x3073fb);}(_0xe14b,0x93));var _0xbe14=function(_0x52c4d0,_0x4eeb70){_0x52c4d0=_0x52c4d0-0x0;var _0x421f03=_0xe14b[_0x52c4d0];return _0x421f03;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0889856..ad97b05 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 _0x5c1d=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','update','/:id','destroy','exports','multer'];(function(_0x28a86d,_0x17bd5a){var _0x1f71cc=function(_0x225aa8){while(--_0x225aa8){_0x28a86d['push'](_0x28a86d['shift']());}};_0x1f71cc(++_0x17bd5a);}(_0x5c1d,0x113));var _0xd5c1=function(_0x3daa4f,_0x5d10f1){_0x3daa4f=_0x3daa4f-0x0;var _0x1d3c37=_0x5c1d[_0x3daa4f];return _0x1d3c37;};'use strict';var multer=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var path=require('path');var timeout=require(_0xd5c1('0x2'));var express=require('express');var router=express[_0xd5c1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd5c1('0x4'));var interaction=require(_0xd5c1('0x5'));var config=require(_0xd5c1('0x6'));var controller=require('./action.controller');router['put']('/:id',auth[_0xd5c1('0x7')](),controller[_0xd5c1('0x8')]);router['delete'](_0xd5c1('0x9'),auth[_0xd5c1('0x7')](),controller[_0xd5c1('0xa')]);module[_0xd5c1('0xb')]=router; \ No newline at end of file +var _0xe365=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x13c67c,_0x903f2e){var _0x58be74=function(_0x398066){while(--_0x398066){_0x13c67c['push'](_0x13c67c['shift']());}};_0x58be74(++_0x903f2e);}(_0xe365,0x191));var _0x5e36=function(_0x231cd1,_0x3943d1){_0x231cd1=_0x231cd1-0x0;var _0x10d942=_0xe365[_0x231cd1];return _0x10d942;};'use strict';var multer=require('multer');var util=require(_0x5e36('0x0'));var path=require('path');var timeout=require(_0x5e36('0x1'));var express=require(_0x5e36('0x2'));var router=express[_0x5e36('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e36('0x4'));var interaction=require(_0x5e36('0x5'));var config=require(_0x5e36('0x6'));var controller=require(_0x5e36('0x7'));router[_0x5e36('0x8')](_0x5e36('0x9'),auth[_0x5e36('0xa')](),controller[_0x5e36('0xb')]);router[_0x5e36('0xc')](_0x5e36('0x9'),auth[_0x5e36('0xa')](),controller['destroy']);module[_0x5e36('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 8b32ed3..2461809 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c09=['exports','STRING','TEXT'];(function(_0x39a626,_0x3acc19){var _0x50ef67=function(_0xaa386f){while(--_0xaa386f){_0x39a626['push'](_0x39a626['shift']());}};_0x50ef67(++_0x3acc19);}(_0x7c09,0x102));var _0x97c0=function(_0x14ba5a,_0x4d206b){_0x14ba5a=_0x14ba5a-0x0;var _0xac0243=_0x7c09[_0x14ba5a];return _0xac0243;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0xc9f805,_0x80e5d0){var _0x4792e0=function(_0xfffd52){while(--_0xfffd52){_0xc9f805['push'](_0xc9f805['shift']());}};_0x4792e0(++_0x80e5d0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x15a26b,_0x4814df){_0x15a26b=_0x15a26b-0x0;var _0x3c6a97=_0x3eea[_0x15a26b];return _0x3c6a97;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3422443..e20f3d3 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 _0x8cc6=['SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','operator','value','getFields','Sequelize','metric','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','SELECT','run','runReport','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','debug','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','order','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','parse','conditions','clone','Limited\x20Query:','toString','QueryTypes','left_join','cross_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'];(function(_0x1c31f4,_0x8e8aeb){var _0x5a3f66=function(_0x3ff723){while(--_0x3ff723){_0x1c31f4['push'](_0x1c31f4['shift']());}};_0x5a3f66(++_0x8e8aeb);}(_0x8cc6,0x173));var _0x68cc=function(_0x34483a,_0x53e599){_0x34483a=_0x34483a-0x0;var _0x412337=_0x8cc6[_0x34483a];return _0x412337;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68cc('0x0'));var zipdir=require(_0x68cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68cc('0x2'));var moment=require(_0x68cc('0x3'));var BPromise=require(_0x68cc('0x4'));var Mustache=require(_0x68cc('0x5'));var util=require(_0x68cc('0x6'));var path=require(_0x68cc('0x7'));var sox=require('sox');var csv=require(_0x68cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68cc('0x9'));var _=require('lodash');var squel=require(_0x68cc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68cc('0xb'));var Papa=require(_0x68cc('0xc'));var Redis=require(_0x68cc('0xd'));var authService=require(_0x68cc('0xe'));var qs=require(_0x68cc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68cc('0x10'));var logger=require(_0x68cc('0x11'))(_0x68cc('0x12'));var utils=require(_0x68cc('0x13'));var config=require(_0x68cc('0x14'));var licenseUtil=require(_0x68cc('0x15'));var db=require(_0x68cc('0x16'))['db'];var dbH=require(_0x68cc('0x16'))[_0x68cc('0x17')];function respondWithStatusCode(_0x1f49d5,_0x553506){_0x553506=_0x553506||0xcc;return function(_0x43baad){if(_0x43baad){return _0x1f49d5[_0x68cc('0x18')](_0x553506);}return _0x1f49d5[_0x68cc('0x19')](_0x553506)[_0x68cc('0x1a')]();};}function respondWithResult(_0x2599ed,_0x6b971a){_0x6b971a=_0x6b971a||0xc8;return function(_0xa2e93d){if(_0xa2e93d){return _0x2599ed['status'](_0x6b971a)[_0x68cc('0x1b')](_0xa2e93d);}};}function respondWithFilteredResult(_0xcca102,_0x2cbb03){return function(_0x1d1246){if(_0x1d1246){var _0x17253d=typeof _0x2cbb03[_0x68cc('0x1c')]===_0x68cc('0x1d')&&typeof _0x2cbb03[_0x68cc('0x1e')]===_0x68cc('0x1d');var _0x5bf418=_0x1d1246[_0x68cc('0x1f')];var _0x56f688=_0x17253d?0x0:_0x2cbb03[_0x68cc('0x1c')];var _0xa9aaea=_0x17253d?_0x1d1246[_0x68cc('0x1f')]:_0x2cbb03[_0x68cc('0x1c')]+_0x2cbb03[_0x68cc('0x1e')];var _0x3da6e1;if(_0xa9aaea>=_0x5bf418){_0xa9aaea=_0x5bf418;_0x3da6e1=0xc8;}else{_0x3da6e1=0xce;}_0xcca102[_0x68cc('0x19')](_0x3da6e1);return _0xcca102[_0x68cc('0x20')]('Content-Range',_0x56f688+'-'+_0xa9aaea+'/'+_0x5bf418)[_0x68cc('0x1b')](_0x1d1246);}return null;};}function patchUpdates(_0x2746f5){return function(_0x1e36bd){try{jsonpatch[_0x68cc('0x21')](_0x1e36bd,_0x2746f5,!![]);}catch(_0x430df5){return BPromise[_0x68cc('0x22')](_0x430df5);}return _0x1e36bd[_0x68cc('0x23')]();};}function saveUpdates(_0x343edd,_0x45d320){return function(_0x327d2f){if(_0x327d2f){return _0x327d2f[_0x68cc('0x24')](_0x343edd)[_0x68cc('0x25')](function(_0xdb132c){return _0xdb132c;});}return null;};}function removeEntity(_0x54012f,_0x1547d9){return function(_0x3e5dc7){if(_0x3e5dc7){return _0x3e5dc7[_0x68cc('0x26')]()[_0x68cc('0x25')](function(){var _0x2edda4=_0x3e5dc7['get']({'plain':!![]});var _0x5496a7=_0x68cc('0x27');return db[_0x68cc('0x28')][_0x68cc('0x26')]({'where':{'type':_0x5496a7,'resourceId':_0x2edda4['id']}})[_0x68cc('0x25')](function(){return _0x3e5dc7;});})[_0x68cc('0x25')](function(){_0x54012f[_0x68cc('0x19')](0xcc)[_0x68cc('0x1a')]();});}};}function handleEntityNotFound(_0x3e4980,_0x58b060){return function(_0x438498){if(!_0x438498){_0x3e4980[_0x68cc('0x18')](0x194);}return _0x438498;};}function handleError(_0x5302cc,_0x50c572){_0x50c572=_0x50c572||0x1f4;return function(_0x298f57){logger['error'](_0x298f57[_0x68cc('0x29')]);if(_0x298f57[_0x68cc('0x2a')]){delete _0x298f57[_0x68cc('0x2a')];}_0x5302cc[_0x68cc('0x19')](_0x50c572)['send'](_0x298f57);};}exports[_0x68cc('0x2b')]=function(_0x54fcc9,_0x5bd0dd){var _0x3fd478={},_0x24d842={},_0x14295c={'count':0x0,'rows':[]};var _0x516580=_[_0x68cc('0x2c')](db[_0x68cc('0x2d')][_0x68cc('0x2e')],function(_0xe6e608){return{'name':_0xe6e608[_0x68cc('0x2f')],'type':_0xe6e608[_0x68cc('0x30')][_0x68cc('0x31')]};});_0x24d842[_0x68cc('0x32')]=_['map'](_0x516580,_0x68cc('0x2a'));_0x24d842['query']=_[_0x68cc('0x33')](_0x54fcc9['query']);_0x24d842[_0x68cc('0x34')]=_[_0x68cc('0x35')](_0x24d842[_0x68cc('0x32')],_0x24d842['query']);_0x3fd478['attributes']=_[_0x68cc('0x35')](_0x24d842[_0x68cc('0x32')],qs[_0x68cc('0x36')](_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x36')]));_0x3fd478[_0x68cc('0x38')]=_0x3fd478['attributes'][_0x68cc('0x39')]?_0x3fd478['attributes']:_0x24d842[_0x68cc('0x32')];if(!_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x3a')](_0x68cc('0x3b'))){_0x3fd478[_0x68cc('0x1e')]=qs[_0x68cc('0x1e')](_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x1e')]);_0x3fd478[_0x68cc('0x1c')]=qs['offset'](_0x54fcc9['query'][_0x68cc('0x1c')]);}_0x3fd478['order']=qs['sort'](_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x3c')]);_0x3fd478['where']=qs['filters'](_[_0x68cc('0x3d')](_0x54fcc9['query'],_0x24d842[_0x68cc('0x34')]),_0x516580);if(_0x54fcc9['query']['filter']){_0x3fd478[_0x68cc('0x3e')]=_[_0x68cc('0x3f')](_0x3fd478[_0x68cc('0x3e')],{'$or':_['map'](_0x516580,function(_0x41ebbb){if(_0x41ebbb[_0x68cc('0x30')]!==_0x68cc('0x40')){var _0x192517={};_0x192517[_0x41ebbb[_0x68cc('0x2a')]]={'$like':'%'+_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x41')]+'%'};return _0x192517;}})});}_0x3fd478=_['merge']({},_0x3fd478,_0x54fcc9['options']);var _0xe6f102={'where':_0x3fd478[_0x68cc('0x3e')]};return db[_0x68cc('0x2d')][_0x68cc('0x1f')](_0xe6f102)[_0x68cc('0x25')](function(_0x52e04e){_0x14295c['count']=_0x52e04e;if(_0x54fcc9[_0x68cc('0x37')][_0x68cc('0x42')]){_0x3fd478[_0x68cc('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x68cc('0x44')](_0x3fd478);})['then'](function(_0x41aeb5){_0x14295c['rows']=_0x41aeb5;return _0x14295c;})[_0x68cc('0x25')](respondWithFilteredResult(_0x5bd0dd,_0x3fd478))[_0x68cc('0x45')](handleError(_0x5bd0dd,null));};exports[_0x68cc('0x46')]=function(_0x3d8b1a,_0xaf1ddd){var _0x50980b={'raw':![],'where':{'id':_0x3d8b1a[_0x68cc('0x47')]['id']}},_0x3b6e3d={};_0x3b6e3d[_0x68cc('0x32')]=_[_0x68cc('0x33')](db[_0x68cc('0x2d')][_0x68cc('0x2e')]);_0x3b6e3d[_0x68cc('0x37')]=_[_0x68cc('0x33')](_0x3d8b1a[_0x68cc('0x37')]);_0x3b6e3d[_0x68cc('0x34')]=_[_0x68cc('0x35')](_0x3b6e3d[_0x68cc('0x32')],_0x3b6e3d[_0x68cc('0x37')]);_0x50980b['attributes']=_[_0x68cc('0x35')](_0x3b6e3d['model'],qs[_0x68cc('0x36')](_0x3d8b1a[_0x68cc('0x37')]['fields']));_0x50980b['attributes']=_0x50980b['attributes'][_0x68cc('0x39')]?_0x50980b['attributes']:_0x3b6e3d['model'];if(_0x3d8b1a[_0x68cc('0x37')]['includeAll']){_0x50980b['include']=[{'all':!![]}];}_0x50980b=_[_0x68cc('0x3f')]({},_0x50980b,_0x3d8b1a[_0x68cc('0x48')]);return db[_0x68cc('0x2d')][_0x68cc('0x49')](_0x50980b)[_0x68cc('0x25')](handleEntityNotFound(_0xaf1ddd,null))[_0x68cc('0x25')](respondWithResult(_0xaf1ddd,null))['catch'](handleError(_0xaf1ddd,null));};exports[_0x68cc('0x4a')]=function(_0x51c901,_0x3223c0){return db[_0x68cc('0x2d')][_0x68cc('0x4a')](_0x51c901[_0x68cc('0x4b')],{})[_0x68cc('0x25')](function(_0x39514c){var _0x55b79d=_0x51c901['user'][_0x68cc('0x4c')]({'plain':!![]});if(!_0x55b79d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55b79d[_0x68cc('0x4d')]===_0x68cc('0x4e')){var _0x14fb62=_0x39514c[_0x68cc('0x4c')]({'plain':!![]});var _0x42205f='Reports';return db[_0x68cc('0x4f')][_0x68cc('0x49')]({'where':{'name':_0x42205f,'userProfileId':_0x55b79d[_0x68cc('0x50')]},'raw':!![]})[_0x68cc('0x25')](function(_0x39071e){if(_0x39071e&&_0x39071e[_0x68cc('0x51')]===0x0){return db[_0x68cc('0x28')][_0x68cc('0x4a')]({'name':_0x14fb62[_0x68cc('0x2a')],'resourceId':_0x14fb62['id'],'type':'CustomReports','sectionId':_0x39071e['id']},{})[_0x68cc('0x25')](function(){return _0x39514c;});}else{return _0x39514c;}})['catch'](function(_0x55a1eb){logger[_0x68cc('0x52')](_0x68cc('0x53'),_0x55a1eb);throw _0x55a1eb;});}return _0x39514c;})[_0x68cc('0x25')](respondWithResult(_0x3223c0,0xc9))[_0x68cc('0x45')](handleError(_0x3223c0,null));};exports[_0x68cc('0x24')]=function(_0x36f060,_0x2b39ad){if(_0x36f060[_0x68cc('0x4b')]['id']){delete _0x36f060[_0x68cc('0x4b')]['id'];}return db[_0x68cc('0x2d')][_0x68cc('0x49')]({'where':{'id':_0x36f060[_0x68cc('0x47')]['id']}})[_0x68cc('0x25')](handleEntityNotFound(_0x2b39ad,null))['then'](saveUpdates(_0x36f060[_0x68cc('0x4b')],null))[_0x68cc('0x25')](respondWithResult(_0x2b39ad,null))[_0x68cc('0x45')](handleError(_0x2b39ad,null));};exports['destroy']=function(_0x3ae5ff,_0x57f221){return db[_0x68cc('0x2d')][_0x68cc('0x49')]({'where':{'id':_0x3ae5ff[_0x68cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f221,null))[_0x68cc('0x25')](removeEntity(_0x57f221,null))['catch'](handleError(_0x57f221,null));};exports[_0x68cc('0x54')]=function(_0xd53dfb,_0x2064f2){var _0xb27211=0xa;var _0x14df62=[_0x68cc('0x55'),'left_join',_0x68cc('0x56'),'cross_join'];var _0x3e1099={'SUM':_0x68cc('0x57'),'COUNT':_0x68cc('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x68cc('0x59'),'AVG':_0x68cc('0x5a'),'GROUP_CONCAT':_0x68cc('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x998a2f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x68cc('0x5c'),'HOUR':_0x68cc('0x5d'),'ROUND':_0x68cc('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4c3371=function(_0x1685f4){return!_[_0x68cc('0x5f')]([_0x68cc('0x60'),'IS\x20NOT\x20NULL',_0x68cc('0x61'),_0x68cc('0x62')],_0x1685f4);};var _0x4fe6a3=function(_0x95af3f){if(!_0x95af3f||!_0x95af3f[_0x68cc('0x63')][_0x68cc('0x39')]){return'';}for(var _0x425ace='(',_0x3c13c8=0x0;_0x3c13c8<_0x95af3f[_0x68cc('0x63')][_0x68cc('0x39')];_0x3c13c8+=0x1){_0x3c13c8>0x0&&(_0x425ace+='\x20'+_0x95af3f['operator']+'\x20');_0x425ace+=_0x95af3f[_0x68cc('0x63')][_0x3c13c8][_0x68cc('0x64')]?_0x4fe6a3(_0x95af3f['rules'][_0x3c13c8][_0x68cc('0x64')]):_0x95af3f['rules'][_0x3c13c8][_0x68cc('0x65')]+'\x20'+_0x95af3f['rules'][_0x3c13c8][_0x68cc('0x66')]+(_0x4c3371(_0x95af3f[_0x68cc('0x63')][_0x3c13c8]['condition'])?'\x20'+_0x95af3f[_0x68cc('0x63')][_0x3c13c8]['value']:'');}return _0x425ace+')';};var _0x336222={'where':{'id':_0xd53dfb[_0x68cc('0x47')]['id']}},_0x5951b8,_0x5a0a66,_0x1fb280,_0x53ac72,_0x3d426b;_0x336222=_[_0x68cc('0x3f')]({},_0x336222,_0xd53dfb[_0x68cc('0x48')]);return db[_0x68cc('0x2d')][_0x68cc('0x49')](_0x336222)[_0x68cc('0x25')](function(_0x485dfc){if(_0x485dfc){_0x5951b8=_0x485dfc;return _0x485dfc['getFields']();}return null;})[_0x68cc('0x25')](function(_0x4e1f87){if(_0x4e1f87){if(!_0x4e1f87[_0x68cc('0x39')]){throw new db['Sequelize'][(_0x68cc('0x67'))](_0x68cc('0x68'),0x193);}_0x5a0a66=_0x4e1f87;return db[_0x68cc('0x69')][_0x68cc('0x44')]({'raw':!![]});}return null;})[_0x68cc('0x25')](function(_0x38f4fb){if(_0x38f4fb){_0x1fb280=_[_0x68cc('0x6a')](_0x38f4fb,'id');var _0x5ee821;var _0x399524=squel[_0x68cc('0x6b')]();_0x399524[_0x68cc('0x6c')](_0x5951b8['table']);for(var _0x474575=0x0;_0x474575<_0x5a0a66[_0x68cc('0x39')];_0x474575+=0x1){_0x5ee821=_0x5a0a66[_0x474575][_0x68cc('0x6d')]?_0x1fb280[_0x5a0a66[_0x474575][_0x68cc('0x6d')]]['metric']:_0x5a0a66[_0x474575]['field'];_0x5ee821=_0x5a0a66[_0x474575][_0x68cc('0x6e')]?_[_0x68cc('0x6f')](_0x3e1099[_0x5a0a66[_0x474575][_0x68cc('0x6e')]],'%s',_0x5ee821):_0x5ee821;_0x5ee821=_0x5a0a66[_0x474575]['format']?_[_0x68cc('0x6f')](_0x998a2f[_0x5a0a66[_0x474575][_0x68cc('0x70')]],'%s',_0x5ee821):_0x5ee821;if(_0x5a0a66[_0x474575][_0x68cc('0x71')]){_0x399524[_0x68cc('0x64')](_0x5ee821);}_0x5a0a66[_0x474575]['orderBy']&&_0x399524[_0x68cc('0x72')](_0x5ee821,_0x5a0a66[_0x474575]['orderBy']===_0x68cc('0x73')?![]:!![]);_0x399524['field'](_0x5ee821,_0x5a0a66[_0x474575][_0x68cc('0x74')]||_0x5ee821);}if(_0x5951b8[_0x68cc('0x75')]){_0x5951b8['joins']=JSON['parse'](_0x5951b8[_0x68cc('0x75')]);for(var _0x59b55e=0x0;_0x59b55e<_0x5951b8['joins'][_0x68cc('0x39')];_0x59b55e+=0x1){if(_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x30')]&&_[_0x68cc('0x5f')](_0x14df62,_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x30')])&&_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x76')]&&_0x5951b8['joins'][_0x59b55e]['foreignTable']&&_0x5951b8[_0x68cc('0x75')][_0x59b55e]['foreignKey']){_0x399524[_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x30')]](_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x77')],null,util[_0x68cc('0x70')](_0x68cc('0x78'),_0x5951b8[_0x68cc('0x79')],_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x76')],_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x77')],_0x5951b8[_0x68cc('0x75')][_0x59b55e][_0x68cc('0x7a')]));}}}if(_0x5951b8['conditions']){_0x5951b8['conditions']=JSON[_0x68cc('0x7b')](_0x5951b8['conditions']);_0x399524['where'](_0x4fe6a3(_0x5951b8[_0x68cc('0x7c')][_0x68cc('0x64')]));}_0x3d426b=_0x399524[_0x68cc('0x7d')]();_0x399524[_0x68cc('0x1e')](_0xb27211);_0x399524[_0x68cc('0x1c')](0x0);logger['debug'](_0x68cc('0x7e'),_0x399524[_0x68cc('0x7f')]());return dbH['sequelize'][_0x68cc('0x37')](_0x399524[_0x68cc('0x7f')](),{'type':dbH['sequelize'][_0x68cc('0x80')]['SELECT']});}})[_0x68cc('0x25')](respondWithResult(_0x2064f2,null))['catch'](handleError(_0x2064f2,null));};function runReport(_0xce6e73,_0x39c6d7,_0x1cc997){var _0x40ee3b=_0x39c6d7[_0x68cc('0x2a')];var _0x2f85f0=0xa;var _0x2c00da=[_0x68cc('0x55'),_0x68cc('0x81'),_0x68cc('0x56'),_0x68cc('0x82')];var _0x451131={'SUM':'SUM(%s)','COUNT':_0x68cc('0x58'),'COUNT DISTINCT':_0x68cc('0x83'),'MAX':'MAX(%s)','MIN':_0x68cc('0x59'),'AVG':_0x68cc('0x5a'),'GROUP_CONCAT':_0x68cc('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x68cc('0x84')};var _0x2ed273={'SEC_TO_TIME':_0x68cc('0x85'),'DATE':_0x68cc('0x5c'),'HOUR':_0x68cc('0x5d'),'ROUND':_0x68cc('0x5e'),'UNIX_TIMESTAMP':_0x68cc('0x86')};var _0x3e4e21=function(_0x5b41ee){return!_[_0x68cc('0x5f')]([_0x68cc('0x60'),_0x68cc('0x87'),'IS\x20EMPTY',_0x68cc('0x62')],_0x5b41ee);};var _0x552825=function(_0x4156b3){if(!_0x4156b3||!_0x4156b3['rules'][_0x68cc('0x39')]){return'';}for(var _0x2c223d='(',_0x52ad48=0x0;_0x52ad48<_0x4156b3[_0x68cc('0x63')][_0x68cc('0x39')];_0x52ad48+=0x1){_0x52ad48>0x0&&(_0x2c223d+='\x20'+_0x4156b3[_0x68cc('0x88')]+'\x20');_0x2c223d+=_0x4156b3['rules'][_0x52ad48][_0x68cc('0x64')]?_0x552825(_0x4156b3[_0x68cc('0x63')][_0x52ad48]['group']):_0x4156b3[_0x68cc('0x63')][_0x52ad48][_0x68cc('0x65')]+'\x20'+_0x4156b3[_0x68cc('0x63')][_0x52ad48][_0x68cc('0x66')]+(_0x3e4e21(_0x4156b3[_0x68cc('0x63')][_0x52ad48][_0x68cc('0x66')])?'\x20'+_0x4156b3[_0x68cc('0x63')][_0x52ad48][_0x68cc('0x89')]:'');}return _0x2c223d+')';};var _0x39b475={'where':{'id':_0xce6e73['id']}},_0xc9b8e4,_0x5e76fc,_0x6e502b,_0x2e8426,_0x4d2583;_0x39b475=_[_0x68cc('0x3f')]({},_0x39b475,_0x1cc997);return db[_0x68cc('0x2d')][_0x68cc('0x49')](_0x39b475)[_0x68cc('0x25')](function(_0x5d079a){if(_0x5d079a){_0xc9b8e4=_0x5d079a;return _0x5d079a[_0x68cc('0x8a')]();}return null;})[_0x68cc('0x25')](function(_0x4b5245){if(_0x4b5245){if(!_0x4b5245[_0x68cc('0x39')]){throw new db[(_0x68cc('0x8b'))][(_0x68cc('0x67'))](_0x68cc('0x68'),0x193);}_0x5e76fc=_0x4b5245;return db['AnalyticMetric'][_0x68cc('0x44')]({'raw':!![]});}return null;})[_0x68cc('0x25')](function(_0x10ebd9){if(_0x10ebd9){_0x6e502b=_[_0x68cc('0x6a')](_0x10ebd9,'id');var _0x3a03f0;var _0x472eeb=squel[_0x68cc('0x6b')]();_0x472eeb['from'](_0xc9b8e4[_0x68cc('0x79')]);for(var _0x331ecd=0x0;_0x331ecd<_0x5e76fc[_0x68cc('0x39')];_0x331ecd+=0x1){_0x3a03f0=_0x5e76fc[_0x331ecd][_0x68cc('0x6d')]?_0x6e502b[_0x5e76fc[_0x331ecd][_0x68cc('0x6d')]][_0x68cc('0x8c')]:_0x5e76fc[_0x331ecd][_0x68cc('0x65')];_0x3a03f0=_0x5e76fc[_0x331ecd][_0x68cc('0x6e')]?_[_0x68cc('0x6f')](_0x451131[_0x5e76fc[_0x331ecd][_0x68cc('0x6e')]],'%s',_0x3a03f0):_0x3a03f0;_0x3a03f0=_0x5e76fc[_0x331ecd][_0x68cc('0x70')]?_[_0x68cc('0x6f')](_0x2ed273[_0x5e76fc[_0x331ecd][_0x68cc('0x70')]],'%s',_0x3a03f0):_0x3a03f0;if(_0x5e76fc[_0x331ecd][_0x68cc('0x71')]){_0x472eeb['group'](_0x3a03f0);}_0x5e76fc[_0x331ecd][_0x68cc('0x8d')]&&_0x472eeb['order'](_0x3a03f0,_0x5e76fc[_0x331ecd]['orderBy']===_0x68cc('0x73')?![]:!![]);_0x472eeb[_0x68cc('0x65')](_0x3a03f0,_0x5e76fc[_0x331ecd][_0x68cc('0x74')]||_0x3a03f0);}if(_0xc9b8e4[_0x68cc('0x75')]){_0xc9b8e4[_0x68cc('0x75')]=JSON['parse'](_0xc9b8e4[_0x68cc('0x75')]);for(var _0x104683=0x0;_0x104683<_0xc9b8e4[_0x68cc('0x75')][_0x68cc('0x39')];_0x104683+=0x1){if(_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x30')]&&_['includes'](_0x2c00da,_0xc9b8e4['joins'][_0x104683][_0x68cc('0x30')])&&_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x76')]&&_0xc9b8e4['joins'][_0x104683][_0x68cc('0x77')]&&_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x7a')]){_0x472eeb[_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x30')]](_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x77')],null,util[_0x68cc('0x70')](_0x68cc('0x78'),_0xc9b8e4[_0x68cc('0x79')],_0xc9b8e4[_0x68cc('0x75')][_0x104683]['parentKey'],_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x77')],_0xc9b8e4[_0x68cc('0x75')][_0x104683][_0x68cc('0x7a')]));}}}if(_0xc9b8e4[_0x68cc('0x7c')]){_0xc9b8e4[_0x68cc('0x7c')]=JSON['parse'](_0xc9b8e4[_0x68cc('0x7c')]);_0x472eeb[_0x68cc('0x3e')](_0x552825(_0xc9b8e4['conditions'][_0x68cc('0x64')]));}_0x4d2583=_0x472eeb[_0x68cc('0x7d')]();_0x472eeb[_0x68cc('0x1e')](_0x2f85f0);_0x472eeb[_0x68cc('0x1c')](0x0);return;}})[_0x68cc('0x25')](function(){if(_0x39c6d7[_0x68cc('0x8e')]===_0x68cc('0x8f')){return null;}var _0x1b10f7=_[_0x68cc('0x3f')](_0x39c6d7,{'name':_0x39c6d7[_0x68cc('0x90')]||_0x39c6d7[_0x68cc('0x2a')]||_0xc9b8e4[_0x68cc('0x2a')],'basename':_0x40ee3b,'savename':util[_0x68cc('0x70')](_0x68cc('0x91'),_0x39c6d7[_0x68cc('0x2a')]||_0xc9b8e4['name'],require(_0x68cc('0x92'))[_0x68cc('0x93')](0x4),_0x39c6d7[_0x68cc('0x8e')]||_0x68cc('0x94')),'reportId':_0xc9b8e4['id'],'reportType':'custom'});return db['AnalyticExtractedReport']['create'](_0x1b10f7,{'raw':!![]});})[_0x68cc('0x25')](function(_0x43d4cc){if(_0xc9b8e4['table']==='cdr'){_0x4d2583[_0x68cc('0x3e')](_0xc9b8e4[_0x68cc('0x79')]+_0x68cc('0x95'),_0x39c6d7[_0x68cc('0x96')],_0x39c6d7[_0x68cc('0x97')]);}else{_0x4d2583['where'](_0xc9b8e4[_0x68cc('0x79')]+_0x68cc('0x98'),_0x39c6d7[_0x68cc('0x96')],_0x39c6d7[_0x68cc('0x97')]);}if(_0x43d4cc){logger[_0x68cc('0x99')](_0x68cc('0x9a'),_0x4d2583['toString']());require(_0x68cc('0x9b'))['fork'](path['join'](__dirname,_0x68cc('0x9c'),_0x43d4cc[_0x68cc('0x8e')]),[_0x43d4cc['id'],_0x4d2583['toString'](),path[_0x68cc('0x55')](__dirname,_0x68cc('0x9d'),_0x43d4cc[_0x68cc('0x9e')]),_0x40ee3b]);return _0x43d4cc;}else{var _0x5e32d0=squel['select']();_0x5e32d0[_0x68cc('0x6c')]('('+_0x4d2583[_0x68cc('0x7f')]()+')',_0x68cc('0x9f'));_0x5e32d0[_0x68cc('0x65')](_0x68cc('0xa0'),_0x68cc('0x1f'));_0x4d2583[_0x68cc('0x1e')](_0x39c6d7[_0x68cc('0x1e')]||_0x2f85f0);_0x4d2583[_0x68cc('0x1c')](_0x39c6d7['offset']||0x0);return dbH['sequelize'][_0x68cc('0x37')](_0x5e32d0[_0x68cc('0x7f')](),{'type':dbH[_0x68cc('0xa1')]['QueryTypes'][_0x68cc('0xa2')]})[_0x68cc('0x25')](function(_0x14040d){if(!_0x14040d[_0x68cc('0x39')]){_0x2e8426=0x0;}else{_0x2e8426=_0x14040d[0x0][_0x68cc('0x1f')]||0x0;}return dbH[_0x68cc('0xa1')][_0x68cc('0x37')](_0x4d2583[_0x68cc('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x68cc('0xa2')]});})[_0x68cc('0x25')](function(_0x2d9704){return{'rows':_0x2d9704||[],'count':_0x2e8426};});}});}exports[_0x68cc('0xa3')]=function(_0x1a1e77,_0x4c3d21){return runReport(_0x1a1e77[_0x68cc('0x47')],_0x1a1e77[_0x68cc('0x37')],_0x1a1e77['options'])['then'](respondWithResult(_0x4c3d21,null))['catch'](handleError(_0x4c3d21,null));};exports[_0x68cc('0xa4')]=runReport;exports[_0x68cc('0x37')]=function(_0x4f02c9,_0x6621c6){var _0x59e6e4=0xa;var _0x23cc12=['join',_0x68cc('0x81'),_0x68cc('0x56'),'cross_join'];var _0x506292={'SUM':_0x68cc('0x57'),'COUNT':_0x68cc('0x58'),'COUNT DISTINCT':_0x68cc('0x83'),'MAX':_0x68cc('0xa5'),'MIN':_0x68cc('0x59'),'AVG':_0x68cc('0x5a'),'GROUP_CONCAT':_0x68cc('0x5b'),'GROUP_CONCAT ASC':_0x68cc('0xa6'),'GROUP_CONCAT DESC':_0x68cc('0x84')};var _0x20f944={'SEC_TO_TIME':_0x68cc('0x85'),'DATE':'DATE(%s)','HOUR':_0x68cc('0x5d'),'ROUND':_0x68cc('0x5e'),'UNIX_TIMESTAMP':_0x68cc('0x86')};var _0xf8bce7=function(_0xb505f8){return!_[_0x68cc('0x5f')]([_0x68cc('0x60'),'IS\x20NOT\x20NULL',_0x68cc('0x61'),'IS\x20NOT\x20EMPTY'],_0xb505f8);};var _0x285b0a=function(_0x1c16ce){if(!_0x1c16ce||!_0x1c16ce[_0x68cc('0x63')][_0x68cc('0x39')]){return'';}for(var _0x5e732e='(',_0x57353b=0x0;_0x57353b<_0x1c16ce[_0x68cc('0x63')]['length'];_0x57353b+=0x1){_0x57353b>0x0&&(_0x5e732e+='\x20'+_0x1c16ce[_0x68cc('0x88')]+'\x20');_0x5e732e+=_0x1c16ce['rules'][_0x57353b]['group']?_0x285b0a(_0x1c16ce[_0x68cc('0x63')][_0x57353b][_0x68cc('0x64')]):_0x1c16ce[_0x68cc('0x63')][_0x57353b][_0x68cc('0x65')]+'\x20'+_0x1c16ce[_0x68cc('0x63')][_0x57353b][_0x68cc('0x66')]+(_0xf8bce7(_0x1c16ce[_0x68cc('0x63')][_0x57353b]['condition'])?'\x20'+_0x1c16ce[_0x68cc('0x63')][_0x57353b][_0x68cc('0x89')]:'');}return _0x5e732e+')';};var _0x1d1e65={'where':{'id':_0x4f02c9[_0x68cc('0x47')]['id']}},_0x132d9e,_0xff653,_0x35f8cc,_0x3b7026,_0x898561;_0x1d1e65=_[_0x68cc('0x3f')]({},_0x1d1e65,_0x4f02c9[_0x68cc('0x48')]);return db[_0x68cc('0x2d')][_0x68cc('0x49')](_0x1d1e65)[_0x68cc('0x25')](function(_0x430af1){if(_0x430af1){_0x132d9e=_0x430af1;return _0x430af1[_0x68cc('0x8a')]();}return null;})[_0x68cc('0x25')](function(_0x4c2fab){if(_0x4c2fab){if(!_0x4c2fab[_0x68cc('0x39')]){throw new db['Sequelize'][(_0x68cc('0x67'))](_0x68cc('0x68'),0x193);}_0xff653=_0x4c2fab;return db[_0x68cc('0x69')][_0x68cc('0x44')]({'raw':!![]});}return null;})[_0x68cc('0x25')](function(_0x82adff){if(_0x82adff){_0x35f8cc=_[_0x68cc('0x6a')](_0x82adff,'id');var _0x254e73;var _0x237e88=squel[_0x68cc('0x6b')]();_0x237e88['from'](_0x132d9e['table']);for(var _0x52289b=0x0;_0x52289b<_0xff653[_0x68cc('0x39')];_0x52289b+=0x1){_0x254e73=_0xff653[_0x52289b][_0x68cc('0x6d')]?_0x35f8cc[_0xff653[_0x52289b][_0x68cc('0x6d')]]['metric']:_0xff653[_0x52289b][_0x68cc('0x65')];_0x254e73=_0xff653[_0x52289b][_0x68cc('0x6e')]?_['replace'](_0x506292[_0xff653[_0x52289b]['function']],'%s',_0x254e73):_0x254e73;_0x254e73=_0xff653[_0x52289b]['format']?_[_0x68cc('0x6f')](_0x20f944[_0xff653[_0x52289b][_0x68cc('0x70')]],'%s',_0x254e73):_0x254e73;if(_0xff653[_0x52289b]['groupBy']){_0x237e88[_0x68cc('0x64')](_0x254e73);}_0xff653[_0x52289b]['orderBy']&&_0x237e88[_0x68cc('0x72')](_0x254e73,_0xff653[_0x52289b]['orderBy']===_0x68cc('0x73')?![]:!![]);_0x237e88[_0x68cc('0x65')](_0x254e73,_0xff653[_0x52289b][_0x68cc('0x74')]||_0x254e73);}if(_0x132d9e[_0x68cc('0x75')]){_0x132d9e[_0x68cc('0x75')]=JSON['parse'](_0x132d9e[_0x68cc('0x75')]);for(var _0x469c16=0x0;_0x469c16<_0x132d9e[_0x68cc('0x75')][_0x68cc('0x39')];_0x469c16+=0x1){if(_0x132d9e[_0x68cc('0x75')][_0x469c16][_0x68cc('0x30')]&&_['includes'](_0x23cc12,_0x132d9e['joins'][_0x469c16][_0x68cc('0x30')])&&_0x132d9e[_0x68cc('0x75')][_0x469c16][_0x68cc('0x76')]&&_0x132d9e['joins'][_0x469c16][_0x68cc('0x77')]&&_0x132d9e[_0x68cc('0x75')][_0x469c16]['foreignKey']){_0x237e88[_0x132d9e['joins'][_0x469c16][_0x68cc('0x30')]](_0x132d9e[_0x68cc('0x75')][_0x469c16][_0x68cc('0x77')],null,util['format'](_0x68cc('0x78'),_0x132d9e[_0x68cc('0x79')],_0x132d9e['joins'][_0x469c16]['parentKey'],_0x132d9e[_0x68cc('0x75')][_0x469c16][_0x68cc('0x77')],_0x132d9e[_0x68cc('0x75')][_0x469c16][_0x68cc('0x7a')]));}}}if(_0x132d9e[_0x68cc('0x7c')]){_0x132d9e[_0x68cc('0x7c')]=JSON['parse'](_0x132d9e[_0x68cc('0x7c')]);_0x237e88[_0x68cc('0x3e')](_0x285b0a(_0x132d9e[_0x68cc('0x7c')][_0x68cc('0x64')]));}_0x898561=_0x237e88[_0x68cc('0x7d')]();_0x237e88[_0x68cc('0x1e')](_0x59e6e4);_0x237e88[_0x68cc('0x1c')](0x0);logger[_0x68cc('0xa7')](_0x68cc('0x7e'),_0x237e88[_0x68cc('0x7f')]());return dbH[_0x68cc('0xa1')]['query'](_0x237e88[_0x68cc('0x7f')](),{'type':dbH[_0x68cc('0xa1')]['QueryTypes'][_0x68cc('0xa2')]});}})[_0x68cc('0x25')](function(){return{'sql':_0x898561[_0x68cc('0x7f')]()};})['then'](respondWithResult(_0x6621c6,null))[_0x68cc('0x45')](handleError(_0x6621c6,null));}; \ No newline at end of file +var _0x412a=['group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NULL','DESC','output','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','runReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator'];(function(_0x4a0991,_0xfa09e){var _0x4901a7=function(_0x16e825){while(--_0x16e825){_0x4a0991['push'](_0x4a0991['shift']());}};_0x4901a7(++_0xfa09e);}(_0x412a,0x17f));var _0xa412=function(_0x3476bf,_0x282464){_0x3476bf=_0x3476bf-0x0;var _0x57c4b4=_0x412a[_0x3476bf];return _0x57c4b4;};'use strict';var emlformat=require(_0xa412('0x0'));var rimraf=require(_0xa412('0x1'));var zipdir=require(_0xa412('0x2'));var jsonpatch=require(_0xa412('0x3'));var rp=require('request-promise');var moment=require(_0xa412('0x4'));var BPromise=require(_0xa412('0x5'));var Mustache=require(_0xa412('0x6'));var util=require(_0xa412('0x7'));var path=require('path');var sox=require(_0xa412('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa412('0x9'));var crypto=require(_0xa412('0xa'));var jsforce=require(_0xa412('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa412('0xc'));var querystring=require('querystring');var Papa=require(_0xa412('0xd'));var Redis=require(_0xa412('0xe'));var authService=require(_0xa412('0xf'));var qs=require(_0xa412('0x10'));var as=require(_0xa412('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa412('0x12'))(_0xa412('0x13'));var utils=require('../../config/utils');var config=require(_0xa412('0x14'));var licenseUtil=require(_0xa412('0x15'));var db=require(_0xa412('0x16'))['db'];var dbH=require('../../mysqldb')[_0xa412('0x17')];function respondWithStatusCode(_0x57bec6,_0x5e442f){_0x5e442f=_0x5e442f||0xcc;return function(_0x5e84e6){if(_0x5e84e6){return _0x57bec6[_0xa412('0x18')](_0x5e442f);}return _0x57bec6[_0xa412('0x19')](_0x5e442f)[_0xa412('0x1a')]();};}function respondWithResult(_0x30e0cd,_0xa6640d){_0xa6640d=_0xa6640d||0xc8;return function(_0x349f73){if(_0x349f73){return _0x30e0cd['status'](_0xa6640d)[_0xa412('0x1b')](_0x349f73);}};}function respondWithFilteredResult(_0x2b6968,_0x492232){return function(_0x23e870){if(_0x23e870){var _0x5667d1=typeof _0x492232[_0xa412('0x1c')]===_0xa412('0x1d')&&typeof _0x492232[_0xa412('0x1e')]===_0xa412('0x1d');var _0x2915e7=_0x23e870['count'];var _0x487627=_0x5667d1?0x0:_0x492232[_0xa412('0x1c')];var _0x23d93d=_0x5667d1?_0x23e870[_0xa412('0x1f')]:_0x492232[_0xa412('0x1c')]+_0x492232['limit'];var _0x274512;if(_0x23d93d>=_0x2915e7){_0x23d93d=_0x2915e7;_0x274512=0xc8;}else{_0x274512=0xce;}_0x2b6968[_0xa412('0x19')](_0x274512);return _0x2b6968[_0xa412('0x20')]('Content-Range',_0x487627+'-'+_0x23d93d+'/'+_0x2915e7)[_0xa412('0x1b')](_0x23e870);}return null;};}function patchUpdates(_0x225f6c){return function(_0x317933){try{jsonpatch[_0xa412('0x21')](_0x317933,_0x225f6c,!![]);}catch(_0x54fe10){return BPromise[_0xa412('0x22')](_0x54fe10);}return _0x317933[_0xa412('0x23')]();};}function saveUpdates(_0x61f55c,_0x5ac71f){return function(_0xbbdf34){if(_0xbbdf34){return _0xbbdf34['update'](_0x61f55c)[_0xa412('0x24')](function(_0x52bc68){return _0x52bc68;});}return null;};}function removeEntity(_0x5934ae,_0x7431e5){return function(_0x44c23e){if(_0x44c23e){return _0x44c23e[_0xa412('0x25')]()[_0xa412('0x24')](function(){var _0x1ca6db=_0x44c23e['get']({'plain':!![]});var _0x11d9b7='CustomReports';return db['UserProfileResource'][_0xa412('0x25')]({'where':{'type':_0x11d9b7,'resourceId':_0x1ca6db['id']}})['then'](function(){return _0x44c23e;});})['then'](function(){_0x5934ae[_0xa412('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125454,_0x6b5276){return function(_0x3e85ef){if(!_0x3e85ef){_0x125454['sendStatus'](0x194);}return _0x3e85ef;};}function handleError(_0x2645c2,_0xd26e2b){_0xd26e2b=_0xd26e2b||0x1f4;return function(_0x3ac7ac){logger[_0xa412('0x26')](_0x3ac7ac[_0xa412('0x27')]);if(_0x3ac7ac[_0xa412('0x28')]){delete _0x3ac7ac['name'];}_0x2645c2[_0xa412('0x19')](_0xd26e2b)[_0xa412('0x29')](_0x3ac7ac);};}exports['index']=function(_0x586965,_0x11c399){var _0x175b0d={},_0x1eaf3a={},_0x3eb308={'count':0x0,'rows':[]};var _0x365855=_[_0xa412('0x2a')](db[_0xa412('0x2b')][_0xa412('0x2c')],function(_0x5eef7b){return{'name':_0x5eef7b['fieldName'],'type':_0x5eef7b[_0xa412('0x2d')][_0xa412('0x2e')]};});_0x1eaf3a[_0xa412('0x2f')]=_['map'](_0x365855,'name');_0x1eaf3a[_0xa412('0x30')]=_[_0xa412('0x31')](_0x586965[_0xa412('0x30')]);_0x1eaf3a[_0xa412('0x32')]=_[_0xa412('0x33')](_0x1eaf3a['model'],_0x1eaf3a[_0xa412('0x30')]);_0x175b0d['attributes']=_['intersection'](_0x1eaf3a[_0xa412('0x2f')],qs[_0xa412('0x34')](_0x586965[_0xa412('0x30')]['fields']));_0x175b0d[_0xa412('0x35')]=_0x175b0d[_0xa412('0x35')][_0xa412('0x36')]?_0x175b0d['attributes']:_0x1eaf3a[_0xa412('0x2f')];if(!_0x586965['query']['hasOwnProperty'](_0xa412('0x37'))){_0x175b0d['limit']=qs['limit'](_0x586965[_0xa412('0x30')][_0xa412('0x1e')]);_0x175b0d[_0xa412('0x1c')]=qs[_0xa412('0x1c')](_0x586965[_0xa412('0x30')][_0xa412('0x1c')]);}_0x175b0d[_0xa412('0x38')]=qs[_0xa412('0x39')](_0x586965[_0xa412('0x30')][_0xa412('0x39')]);_0x175b0d[_0xa412('0x3a')]=qs[_0xa412('0x32')](_[_0xa412('0x3b')](_0x586965[_0xa412('0x30')],_0x1eaf3a[_0xa412('0x32')]),_0x365855);if(_0x586965[_0xa412('0x30')][_0xa412('0x3c')]){_0x175b0d[_0xa412('0x3a')]=_['merge'](_0x175b0d['where'],{'$or':_[_0xa412('0x2a')](_0x365855,function(_0x36afb4){if(_0x36afb4['type']!==_0xa412('0x3d')){var _0x233667={};_0x233667[_0x36afb4['name']]={'$like':'%'+_0x586965[_0xa412('0x30')][_0xa412('0x3c')]+'%'};return _0x233667;}})});}_0x175b0d=_[_0xa412('0x3e')]({},_0x175b0d,_0x586965[_0xa412('0x3f')]);var _0x2ba9f4={'where':_0x175b0d['where']};return db[_0xa412('0x2b')][_0xa412('0x1f')](_0x2ba9f4)[_0xa412('0x24')](function(_0x4550cd){_0x3eb308[_0xa412('0x1f')]=_0x4550cd;if(_0x586965[_0xa412('0x30')][_0xa412('0x40')]){_0x175b0d[_0xa412('0x41')]=[{'all':!![]}];}return db[_0xa412('0x2b')][_0xa412('0x42')](_0x175b0d);})['then'](function(_0x548d3e){_0x3eb308[_0xa412('0x43')]=_0x548d3e;return _0x3eb308;})[_0xa412('0x24')](respondWithFilteredResult(_0x11c399,_0x175b0d))['catch'](handleError(_0x11c399,null));};exports[_0xa412('0x44')]=function(_0x5125ad,_0x33471c){var _0x33427e={'raw':![],'where':{'id':_0x5125ad[_0xa412('0x45')]['id']}},_0x238435={};_0x238435[_0xa412('0x2f')]=_[_0xa412('0x31')](db['AnalyticCustomReport'][_0xa412('0x2c')]);_0x238435[_0xa412('0x30')]=_[_0xa412('0x31')](_0x5125ad['query']);_0x238435['filters']=_[_0xa412('0x33')](_0x238435[_0xa412('0x2f')],_0x238435[_0xa412('0x30')]);_0x33427e[_0xa412('0x35')]=_[_0xa412('0x33')](_0x238435['model'],qs[_0xa412('0x34')](_0x5125ad['query'][_0xa412('0x34')]));_0x33427e[_0xa412('0x35')]=_0x33427e[_0xa412('0x35')][_0xa412('0x36')]?_0x33427e[_0xa412('0x35')]:_0x238435['model'];if(_0x5125ad[_0xa412('0x30')]['includeAll']){_0x33427e['include']=[{'all':!![]}];}_0x33427e=_[_0xa412('0x3e')]({},_0x33427e,_0x5125ad[_0xa412('0x3f')]);return db[_0xa412('0x2b')][_0xa412('0x46')](_0x33427e)[_0xa412('0x24')](handleEntityNotFound(_0x33471c,null))['then'](respondWithResult(_0x33471c,null))[_0xa412('0x47')](handleError(_0x33471c,null));};exports[_0xa412('0x48')]=function(_0x43860b,_0x214377){return db[_0xa412('0x2b')][_0xa412('0x48')](_0x43860b[_0xa412('0x49')],{})[_0xa412('0x24')](function(_0x2b1320){var _0x327535=_0x43860b[_0xa412('0x4a')][_0xa412('0x4b')]({'plain':!![]});if(!_0x327535)throw new Error(_0xa412('0x4c'));if(_0x327535[_0xa412('0x4d')]===_0xa412('0x4a')){var _0x204329=_0x2b1320[_0xa412('0x4b')]({'plain':!![]});var _0x78f6c1='Reports';return db[_0xa412('0x4e')][_0xa412('0x46')]({'where':{'name':_0x78f6c1,'userProfileId':_0x327535[_0xa412('0x4f')]},'raw':!![]})[_0xa412('0x24')](function(_0xe8916e){if(_0xe8916e&&_0xe8916e[_0xa412('0x50')]===0x0){return db['UserProfileResource'][_0xa412('0x48')]({'name':_0x204329['name'],'resourceId':_0x204329['id'],'type':_0xa412('0x51'),'sectionId':_0xe8916e['id']},{})[_0xa412('0x24')](function(){return _0x2b1320;});}else{return _0x2b1320;}})[_0xa412('0x47')](function(_0x2a49f3){logger['error'](_0xa412('0x52'),_0x2a49f3);throw _0x2a49f3;});}return _0x2b1320;})[_0xa412('0x24')](respondWithResult(_0x214377,0xc9))[_0xa412('0x47')](handleError(_0x214377,null));};exports[_0xa412('0x53')]=function(_0x22ec0c,_0x444b37){if(_0x22ec0c[_0xa412('0x49')]['id']){delete _0x22ec0c[_0xa412('0x49')]['id'];}return db[_0xa412('0x2b')][_0xa412('0x46')]({'where':{'id':_0x22ec0c[_0xa412('0x45')]['id']}})[_0xa412('0x24')](handleEntityNotFound(_0x444b37,null))[_0xa412('0x24')](saveUpdates(_0x22ec0c[_0xa412('0x49')],null))[_0xa412('0x24')](respondWithResult(_0x444b37,null))[_0xa412('0x47')](handleError(_0x444b37,null));};exports[_0xa412('0x25')]=function(_0x498610,_0x4742ea){return db[_0xa412('0x2b')][_0xa412('0x46')]({'where':{'id':_0x498610[_0xa412('0x45')]['id']}})[_0xa412('0x24')](handleEntityNotFound(_0x4742ea,null))[_0xa412('0x24')](removeEntity(_0x4742ea,null))[_0xa412('0x47')](handleError(_0x4742ea,null));};exports[_0xa412('0x54')]=function(_0x4d4322,_0x5ed6e9){var _0x410a4b=0xa;var _0x3e9b46=[_0xa412('0x55'),_0xa412('0x56'),'right_join',_0xa412('0x57')];var _0xdedeb4={'SUM':'SUM(%s)','COUNT':_0xa412('0x58'),'COUNT DISTINCT':_0xa412('0x59'),'MAX':_0xa412('0x5a'),'MIN':_0xa412('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa412('0x5c')};var _0x7a1679={'SEC_TO_TIME':_0xa412('0x5d'),'DATE':_0xa412('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xa412('0x5f'),'UNIX_TIMESTAMP':_0xa412('0x60')};var _0x5c228d=function(_0x4015c6){return!_[_0xa412('0x61')](['IS\x20NULL',_0xa412('0x62'),_0xa412('0x63'),_0xa412('0x64')],_0x4015c6);};var _0x1b0119=function(_0xbc435b){if(!_0xbc435b||!_0xbc435b['rules'][_0xa412('0x36')]){return'';}for(var _0x189247='(',_0x54e3ca=0x0;_0x54e3ca<_0xbc435b[_0xa412('0x65')][_0xa412('0x36')];_0x54e3ca+=0x1){_0x54e3ca>0x0&&(_0x189247+='\x20'+_0xbc435b[_0xa412('0x66')]+'\x20');_0x189247+=_0xbc435b[_0xa412('0x65')][_0x54e3ca]['group']?_0x1b0119(_0xbc435b['rules'][_0x54e3ca][_0xa412('0x67')]):_0xbc435b[_0xa412('0x65')][_0x54e3ca][_0xa412('0x68')]+'\x20'+_0xbc435b[_0xa412('0x65')][_0x54e3ca][_0xa412('0x69')]+(_0x5c228d(_0xbc435b[_0xa412('0x65')][_0x54e3ca]['condition'])?'\x20'+_0xbc435b[_0xa412('0x65')][_0x54e3ca]['value']:'');}return _0x189247+')';};var _0x6fee3={'where':{'id':_0x4d4322['params']['id']}},_0x391695,_0x2da362,_0x529f08,_0xf8cd91,_0x3b535e;_0x6fee3=_[_0xa412('0x3e')]({},_0x6fee3,_0x4d4322[_0xa412('0x3f')]);return db['AnalyticCustomReport'][_0xa412('0x46')](_0x6fee3)[_0xa412('0x24')](function(_0xf274c0){if(_0xf274c0){_0x391695=_0xf274c0;return _0xf274c0[_0xa412('0x6a')]();}return null;})[_0xa412('0x24')](function(_0x4a2a39){if(_0x4a2a39){if(!_0x4a2a39[_0xa412('0x36')]){throw new db[(_0xa412('0x6b'))][(_0xa412('0x6c'))](_0xa412('0x6d'),0x193);}_0x2da362=_0x4a2a39;return db[_0xa412('0x6e')][_0xa412('0x42')]({'raw':!![]});}return null;})['then'](function(_0x135998){if(_0x135998){_0x529f08=_[_0xa412('0x6f')](_0x135998,'id');var _0x4ee5a4;var _0x5831ba=squel[_0xa412('0x70')]();_0x5831ba[_0xa412('0x71')](_0x391695[_0xa412('0x72')]);for(var _0x516a38=0x0;_0x516a38<_0x2da362[_0xa412('0x36')];_0x516a38+=0x1){_0x4ee5a4=_0x2da362[_0x516a38][_0xa412('0x73')]?_0x529f08[_0x2da362[_0x516a38][_0xa412('0x73')]][_0xa412('0x74')]:_0x2da362[_0x516a38][_0xa412('0x68')];_0x4ee5a4=_0x2da362[_0x516a38][_0xa412('0x75')]?_['replace'](_0xdedeb4[_0x2da362[_0x516a38][_0xa412('0x75')]],'%s',_0x4ee5a4):_0x4ee5a4;_0x4ee5a4=_0x2da362[_0x516a38][_0xa412('0x76')]?_[_0xa412('0x77')](_0x7a1679[_0x2da362[_0x516a38][_0xa412('0x76')]],'%s',_0x4ee5a4):_0x4ee5a4;if(_0x2da362[_0x516a38][_0xa412('0x78')]){_0x5831ba[_0xa412('0x67')](_0x4ee5a4);}_0x2da362[_0x516a38][_0xa412('0x79')]&&_0x5831ba['order'](_0x4ee5a4,_0x2da362[_0x516a38][_0xa412('0x79')]==='DESC'?![]:!![]);_0x5831ba[_0xa412('0x68')](_0x4ee5a4,_0x2da362[_0x516a38][_0xa412('0x7a')]||_0x4ee5a4);}if(_0x391695[_0xa412('0x7b')]){_0x391695['joins']=JSON[_0xa412('0x7c')](_0x391695[_0xa412('0x7b')]);for(var _0x3a24cb=0x0;_0x3a24cb<_0x391695[_0xa412('0x7b')]['length'];_0x3a24cb+=0x1){if(_0x391695[_0xa412('0x7b')][_0x3a24cb][_0xa412('0x2d')]&&_[_0xa412('0x61')](_0x3e9b46,_0x391695[_0xa412('0x7b')][_0x3a24cb][_0xa412('0x2d')])&&_0x391695['joins'][_0x3a24cb][_0xa412('0x7d')]&&_0x391695[_0xa412('0x7b')][_0x3a24cb]['foreignTable']&&_0x391695['joins'][_0x3a24cb][_0xa412('0x7e')]){_0x5831ba[_0x391695['joins'][_0x3a24cb][_0xa412('0x2d')]](_0x391695[_0xa412('0x7b')][_0x3a24cb][_0xa412('0x7f')],null,util[_0xa412('0x76')](_0xa412('0x80'),_0x391695['table'],_0x391695[_0xa412('0x7b')][_0x3a24cb][_0xa412('0x7d')],_0x391695[_0xa412('0x7b')][_0x3a24cb]['foreignTable'],_0x391695['joins'][_0x3a24cb][_0xa412('0x7e')]));}}}if(_0x391695['conditions']){_0x391695[_0xa412('0x81')]=JSON[_0xa412('0x7c')](_0x391695[_0xa412('0x81')]);_0x5831ba[_0xa412('0x3a')](_0x1b0119(_0x391695[_0xa412('0x81')][_0xa412('0x67')]));}_0x3b535e=_0x5831ba[_0xa412('0x82')]();_0x5831ba[_0xa412('0x1e')](_0x410a4b);_0x5831ba['offset'](0x0);logger[_0xa412('0x83')](_0xa412('0x84'),_0x5831ba['toString']());return dbH[_0xa412('0x85')][_0xa412('0x30')](_0x5831ba[_0xa412('0x86')](),{'type':dbH[_0xa412('0x85')][_0xa412('0x87')][_0xa412('0x88')]});}})[_0xa412('0x24')](respondWithResult(_0x5ed6e9,null))[_0xa412('0x47')](handleError(_0x5ed6e9,null));};function runReport(_0x2feb8e,_0x47b36f,_0xad779){var _0x215699=_0x47b36f['name'];var _0x59802b=0xa;var _0x3da1a0=[_0xa412('0x55'),_0xa412('0x56'),'right_join',_0xa412('0x57')];var _0x21d97b={'SUM':_0xa412('0x89'),'COUNT':_0xa412('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xa412('0x5b'),'AVG':_0xa412('0x8a'),'GROUP_CONCAT':_0xa412('0x8b'),'GROUP_CONCAT ASC':_0xa412('0x8c'),'GROUP_CONCAT DESC':_0xa412('0x5c')};var _0x421498={'SEC_TO_TIME':_0xa412('0x5d'),'DATE':_0xa412('0x5e'),'HOUR':_0xa412('0x8d'),'ROUND':_0xa412('0x5f'),'UNIX_TIMESTAMP':_0xa412('0x60')};var _0xe47d2f=function(_0x577e06){return!_['includes']([_0xa412('0x8e'),'IS\x20NOT\x20NULL',_0xa412('0x63'),_0xa412('0x64')],_0x577e06);};var _0x4126be=function(_0x5b3d8e){if(!_0x5b3d8e||!_0x5b3d8e[_0xa412('0x65')][_0xa412('0x36')]){return'';}for(var _0x3c7238='(',_0x1210bf=0x0;_0x1210bf<_0x5b3d8e['rules'][_0xa412('0x36')];_0x1210bf+=0x1){_0x1210bf>0x0&&(_0x3c7238+='\x20'+_0x5b3d8e[_0xa412('0x66')]+'\x20');_0x3c7238+=_0x5b3d8e[_0xa412('0x65')][_0x1210bf][_0xa412('0x67')]?_0x4126be(_0x5b3d8e[_0xa412('0x65')][_0x1210bf][_0xa412('0x67')]):_0x5b3d8e['rules'][_0x1210bf][_0xa412('0x68')]+'\x20'+_0x5b3d8e[_0xa412('0x65')][_0x1210bf]['condition']+(_0xe47d2f(_0x5b3d8e['rules'][_0x1210bf][_0xa412('0x69')])?'\x20'+_0x5b3d8e[_0xa412('0x65')][_0x1210bf]['value']:'');}return _0x3c7238+')';};var _0x377bfd={'where':{'id':_0x2feb8e['id']}},_0x53b60e,_0x24d01c,_0x593d53,_0x348b1b,_0x3c0d0d;_0x377bfd=_[_0xa412('0x3e')]({},_0x377bfd,_0xad779);return db[_0xa412('0x2b')][_0xa412('0x46')](_0x377bfd)['then'](function(_0x1f8adf){if(_0x1f8adf){_0x53b60e=_0x1f8adf;return _0x1f8adf['getFields']();}return null;})[_0xa412('0x24')](function(_0x1b42fd){if(_0x1b42fd){if(!_0x1b42fd[_0xa412('0x36')]){throw new db[(_0xa412('0x6b'))][(_0xa412('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x24d01c=_0x1b42fd;return db[_0xa412('0x6e')][_0xa412('0x42')]({'raw':!![]});}return null;})['then'](function(_0x53745c){if(_0x53745c){_0x593d53=_['keyBy'](_0x53745c,'id');var _0x565236;var _0x299bbd=squel[_0xa412('0x70')]();_0x299bbd[_0xa412('0x71')](_0x53b60e[_0xa412('0x72')]);for(var _0x1832af=0x0;_0x1832af<_0x24d01c['length'];_0x1832af+=0x1){_0x565236=_0x24d01c[_0x1832af][_0xa412('0x73')]?_0x593d53[_0x24d01c[_0x1832af]['MetricId']]['metric']:_0x24d01c[_0x1832af]['field'];_0x565236=_0x24d01c[_0x1832af][_0xa412('0x75')]?_[_0xa412('0x77')](_0x21d97b[_0x24d01c[_0x1832af][_0xa412('0x75')]],'%s',_0x565236):_0x565236;_0x565236=_0x24d01c[_0x1832af][_0xa412('0x76')]?_[_0xa412('0x77')](_0x421498[_0x24d01c[_0x1832af][_0xa412('0x76')]],'%s',_0x565236):_0x565236;if(_0x24d01c[_0x1832af][_0xa412('0x78')]){_0x299bbd['group'](_0x565236);}_0x24d01c[_0x1832af]['orderBy']&&_0x299bbd[_0xa412('0x38')](_0x565236,_0x24d01c[_0x1832af][_0xa412('0x79')]===_0xa412('0x8f')?![]:!![]);_0x299bbd[_0xa412('0x68')](_0x565236,_0x24d01c[_0x1832af][_0xa412('0x7a')]||_0x565236);}if(_0x53b60e[_0xa412('0x7b')]){_0x53b60e['joins']=JSON[_0xa412('0x7c')](_0x53b60e[_0xa412('0x7b')]);for(var _0x461481=0x0;_0x461481<_0x53b60e[_0xa412('0x7b')][_0xa412('0x36')];_0x461481+=0x1){if(_0x53b60e['joins'][_0x461481][_0xa412('0x2d')]&&_[_0xa412('0x61')](_0x3da1a0,_0x53b60e['joins'][_0x461481][_0xa412('0x2d')])&&_0x53b60e[_0xa412('0x7b')][_0x461481][_0xa412('0x7d')]&&_0x53b60e[_0xa412('0x7b')][_0x461481][_0xa412('0x7f')]&&_0x53b60e[_0xa412('0x7b')][_0x461481]['foreignKey']){_0x299bbd[_0x53b60e['joins'][_0x461481]['type']](_0x53b60e[_0xa412('0x7b')][_0x461481]['foreignTable'],null,util['format'](_0xa412('0x80'),_0x53b60e[_0xa412('0x72')],_0x53b60e[_0xa412('0x7b')][_0x461481][_0xa412('0x7d')],_0x53b60e[_0xa412('0x7b')][_0x461481][_0xa412('0x7f')],_0x53b60e[_0xa412('0x7b')][_0x461481][_0xa412('0x7e')]));}}}if(_0x53b60e[_0xa412('0x81')]){_0x53b60e['conditions']=JSON[_0xa412('0x7c')](_0x53b60e[_0xa412('0x81')]);_0x299bbd[_0xa412('0x3a')](_0x4126be(_0x53b60e[_0xa412('0x81')]['group']));}_0x3c0d0d=_0x299bbd['clone']();_0x299bbd[_0xa412('0x1e')](_0x59802b);_0x299bbd[_0xa412('0x1c')](0x0);return;}})[_0xa412('0x24')](function(){if(_0x47b36f[_0xa412('0x90')]==='web'){return null;}var _0x5b3887=_[_0xa412('0x3e')](_0x47b36f,{'name':_0x47b36f[_0xa412('0x91')]||_0x47b36f[_0xa412('0x28')]||_0x53b60e['name'],'basename':_0x215699,'savename':util[_0xa412('0x76')](_0xa412('0x92'),_0x47b36f[_0xa412('0x28')]||_0x53b60e['name'],require('randomstring')[_0xa412('0x93')](0x4),_0x47b36f[_0xa412('0x90')]||_0xa412('0x94')),'reportId':_0x53b60e['id'],'reportType':_0xa412('0x95')});return db[_0xa412('0x96')][_0xa412('0x48')](_0x5b3887,{'raw':!![]});})[_0xa412('0x24')](function(_0x244683){if(_0x53b60e[_0xa412('0x72')]==='cdr'){_0x3c0d0d[_0xa412('0x3a')](_0x53b60e[_0xa412('0x72')]+_0xa412('0x97'),_0x47b36f[_0xa412('0x98')],_0x47b36f[_0xa412('0x99')]);}else{_0x3c0d0d[_0xa412('0x3a')](_0x53b60e['table']+_0xa412('0x9a'),_0x47b36f[_0xa412('0x98')],_0x47b36f[_0xa412('0x99')]);}if(_0x244683){logger['info'](_0xa412('0x9b'),_0x3c0d0d[_0xa412('0x86')]());require(_0xa412('0x9c'))[_0xa412('0x9d')](path[_0xa412('0x55')](__dirname,'../../components/export/',_0x244683['output']),[_0x244683['id'],_0x3c0d0d[_0xa412('0x86')](),path[_0xa412('0x55')](__dirname,_0xa412('0x9e'),_0x244683[_0xa412('0x9f')]),_0x215699]);return _0x244683;}else{var _0x162cb3=squel['select']();_0x162cb3['from']('('+_0x3c0d0d[_0xa412('0x86')]()+')',_0xa412('0xa0'));_0x162cb3[_0xa412('0x68')]('COUNT(*)',_0xa412('0x1f'));_0x3c0d0d['limit'](_0x47b36f[_0xa412('0x1e')]||_0x59802b);_0x3c0d0d['offset'](_0x47b36f[_0xa412('0x1c')]||0x0);return dbH[_0xa412('0x85')][_0xa412('0x30')](_0x162cb3[_0xa412('0x86')](),{'type':dbH[_0xa412('0x85')][_0xa412('0x87')][_0xa412('0x88')]})[_0xa412('0x24')](function(_0x228e95){if(!_0x228e95[_0xa412('0x36')]){_0x348b1b=0x0;}else{_0x348b1b=_0x228e95[0x0][_0xa412('0x1f')]||0x0;}return dbH[_0xa412('0x85')][_0xa412('0x30')](_0x3c0d0d['toString'](),{'type':dbH[_0xa412('0x85')]['QueryTypes'][_0xa412('0x88')]});})[_0xa412('0x24')](function(_0x2688d8){return{'rows':_0x2688d8||[],'count':_0x348b1b};});}});}exports['run']=function(_0x2e7e2a,_0x8a80c9){return runReport(_0x2e7e2a[_0xa412('0x45')],_0x2e7e2a['query'],_0x2e7e2a['options'])[_0xa412('0x24')](respondWithResult(_0x8a80c9,null))[_0xa412('0x47')](handleError(_0x8a80c9,null));};exports[_0xa412('0xa1')]=runReport;exports[_0xa412('0x30')]=function(_0x4c7e1c,_0x5602b1){var _0x5945d4=0xa;var _0x885f58=[_0xa412('0x55'),_0xa412('0x56'),'right_join','cross_join'];var _0x415d65={'SUM':_0xa412('0x89'),'COUNT':_0xa412('0x58'),'COUNT DISTINCT':_0xa412('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa412('0x8a'),'GROUP_CONCAT':_0xa412('0x8b'),'GROUP_CONCAT ASC':_0xa412('0x8c'),'GROUP_CONCAT DESC':_0xa412('0x5c')};var _0x3e8b97={'SEC_TO_TIME':_0xa412('0x5d'),'DATE':_0xa412('0x5e'),'HOUR':_0xa412('0x8d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa412('0x60')};var _0x589f3c=function(_0x108b31){return!_[_0xa412('0x61')]([_0xa412('0x8e'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xa412('0x64')],_0x108b31);};var _0x2e0db8=function(_0x27cf47){if(!_0x27cf47||!_0x27cf47[_0xa412('0x65')][_0xa412('0x36')]){return'';}for(var _0x3a5c23='(',_0x3695ea=0x0;_0x3695ea<_0x27cf47[_0xa412('0x65')][_0xa412('0x36')];_0x3695ea+=0x1){_0x3695ea>0x0&&(_0x3a5c23+='\x20'+_0x27cf47[_0xa412('0x66')]+'\x20');_0x3a5c23+=_0x27cf47[_0xa412('0x65')][_0x3695ea][_0xa412('0x67')]?_0x2e0db8(_0x27cf47[_0xa412('0x65')][_0x3695ea]['group']):_0x27cf47['rules'][_0x3695ea][_0xa412('0x68')]+'\x20'+_0x27cf47['rules'][_0x3695ea][_0xa412('0x69')]+(_0x589f3c(_0x27cf47[_0xa412('0x65')][_0x3695ea][_0xa412('0x69')])?'\x20'+_0x27cf47[_0xa412('0x65')][_0x3695ea]['value']:'');}return _0x3a5c23+')';};var _0x1166a8={'where':{'id':_0x4c7e1c[_0xa412('0x45')]['id']}},_0x16c2c9,_0x1e612a,_0x440988,_0x53173f,_0x264dfb;_0x1166a8=_[_0xa412('0x3e')]({},_0x1166a8,_0x4c7e1c[_0xa412('0x3f')]);return db[_0xa412('0x2b')][_0xa412('0x46')](_0x1166a8)[_0xa412('0x24')](function(_0x9792d){if(_0x9792d){_0x16c2c9=_0x9792d;return _0x9792d['getFields']();}return null;})[_0xa412('0x24')](function(_0x2c8cfe){if(_0x2c8cfe){if(!_0x2c8cfe['length']){throw new db[(_0xa412('0x6b'))]['ValidationErrorItem'](_0xa412('0x6d'),0x193);}_0x1e612a=_0x2c8cfe;return db[_0xa412('0x6e')][_0xa412('0x42')]({'raw':!![]});}return null;})['then'](function(_0x618b0d){if(_0x618b0d){_0x440988=_[_0xa412('0x6f')](_0x618b0d,'id');var _0x1db7ca;var _0xe378d3=squel[_0xa412('0x70')]();_0xe378d3[_0xa412('0x71')](_0x16c2c9[_0xa412('0x72')]);for(var _0x43c4b1=0x0;_0x43c4b1<_0x1e612a[_0xa412('0x36')];_0x43c4b1+=0x1){_0x1db7ca=_0x1e612a[_0x43c4b1][_0xa412('0x73')]?_0x440988[_0x1e612a[_0x43c4b1][_0xa412('0x73')]]['metric']:_0x1e612a[_0x43c4b1]['field'];_0x1db7ca=_0x1e612a[_0x43c4b1][_0xa412('0x75')]?_[_0xa412('0x77')](_0x415d65[_0x1e612a[_0x43c4b1][_0xa412('0x75')]],'%s',_0x1db7ca):_0x1db7ca;_0x1db7ca=_0x1e612a[_0x43c4b1]['format']?_[_0xa412('0x77')](_0x3e8b97[_0x1e612a[_0x43c4b1][_0xa412('0x76')]],'%s',_0x1db7ca):_0x1db7ca;if(_0x1e612a[_0x43c4b1][_0xa412('0x78')]){_0xe378d3[_0xa412('0x67')](_0x1db7ca);}_0x1e612a[_0x43c4b1][_0xa412('0x79')]&&_0xe378d3[_0xa412('0x38')](_0x1db7ca,_0x1e612a[_0x43c4b1][_0xa412('0x79')]==='DESC'?![]:!![]);_0xe378d3[_0xa412('0x68')](_0x1db7ca,_0x1e612a[_0x43c4b1][_0xa412('0x7a')]||_0x1db7ca);}if(_0x16c2c9[_0xa412('0x7b')]){_0x16c2c9[_0xa412('0x7b')]=JSON[_0xa412('0x7c')](_0x16c2c9[_0xa412('0x7b')]);for(var _0x359751=0x0;_0x359751<_0x16c2c9['joins'][_0xa412('0x36')];_0x359751+=0x1){if(_0x16c2c9['joins'][_0x359751][_0xa412('0x2d')]&&_[_0xa412('0x61')](_0x885f58,_0x16c2c9[_0xa412('0x7b')][_0x359751][_0xa412('0x2d')])&&_0x16c2c9[_0xa412('0x7b')][_0x359751]['parentKey']&&_0x16c2c9['joins'][_0x359751][_0xa412('0x7f')]&&_0x16c2c9[_0xa412('0x7b')][_0x359751]['foreignKey']){_0xe378d3[_0x16c2c9[_0xa412('0x7b')][_0x359751][_0xa412('0x2d')]](_0x16c2c9['joins'][_0x359751]['foreignTable'],null,util[_0xa412('0x76')](_0xa412('0x80'),_0x16c2c9[_0xa412('0x72')],_0x16c2c9[_0xa412('0x7b')][_0x359751][_0xa412('0x7d')],_0x16c2c9[_0xa412('0x7b')][_0x359751][_0xa412('0x7f')],_0x16c2c9[_0xa412('0x7b')][_0x359751][_0xa412('0x7e')]));}}}if(_0x16c2c9['conditions']){_0x16c2c9['conditions']=JSON['parse'](_0x16c2c9[_0xa412('0x81')]);_0xe378d3[_0xa412('0x3a')](_0x2e0db8(_0x16c2c9[_0xa412('0x81')]['group']));}_0x264dfb=_0xe378d3[_0xa412('0x82')]();_0xe378d3[_0xa412('0x1e')](_0x5945d4);_0xe378d3['offset'](0x0);logger[_0xa412('0x83')](_0xa412('0x84'),_0xe378d3[_0xa412('0x86')]());return dbH[_0xa412('0x85')][_0xa412('0x30')](_0xe378d3[_0xa412('0x86')](),{'type':dbH[_0xa412('0x85')]['QueryTypes'][_0xa412('0x88')]});}})[_0xa412('0x24')](function(){return{'sql':_0x264dfb[_0xa412('0x86')]()};})[_0xa412('0x24')](respondWithResult(_0x5602b1,null))[_0xa412('0x47')](handleError(_0x5602b1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 80f8bda..c2eba46 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 _0x9fa2=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x9fa2,0x163));var _0x29fa=function(_0x3a1b90,_0x3c0158){_0x3a1b90=_0x3a1b90-0x0;var _0xf6de77=_0x9fa2[_0x3a1b90];return _0xf6de77;};'use strict';var _=require(_0x29fa('0x0'));var util=require(_0x29fa('0x1'));var logger=require(_0x29fa('0x2'))('api');var moment=require(_0x29fa('0x3'));var BPromise=require(_0x29fa('0x4'));var rp=require(_0x29fa('0x5'));var fs=require('fs');var path=require(_0x29fa('0x6'));var rimraf=require(_0x29fa('0x7'));var config=require(_0x29fa('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x29fa('0x9')]=function(_0x45de98,_0x35854f){return _0x45de98[_0x29fa('0xa')](_0x29fa('0xb'),attributes,{'tableName':_0x29fa('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a4b=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1a4b,0x137));var _0xb1a4=function(_0x56c8f2,_0xf18824){_0x56c8f2=_0x56c8f2-0x0;var _0x26d01e=_0x1a4b[_0x56c8f2];return _0x26d01e;};'use strict';var _=require('lodash');var util=require(_0xb1a4('0x0'));var logger=require(_0xb1a4('0x1'))('api');var moment=require(_0xb1a4('0x2'));var BPromise=require(_0xb1a4('0x3'));var rp=require(_0xb1a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1a4('0x5'));var config=require(_0xb1a4('0x6'));var attributes=require(_0xb1a4('0x7'));module[_0xb1a4('0x8')]=function(_0x5e8567,_0x2c3313){return _0x5e8567[_0xb1a4('0x9')](_0xb1a4('0xa'),attributes,{'tableName':_0xb1a4('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9a605c5..7b2b3f3 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 _0x5164=['code','message','result','catch','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4b2165,_0x4b480d){var _0xbcacf8=function(_0x364c9e){while(--_0x364c9e){_0x4b2165['push'](_0x4b2165['shift']());}};_0xbcacf8(++_0x4b480d);}(_0x5164,0x1bc));var _0x4516=function(_0x4d72ee,_0x165406){_0x4d72ee=_0x4d72ee-0x0;var _0x1e47c5=_0x5164[_0x4d72ee];return _0x1e47c5;};'use strict';var _=require(_0x4516('0x0'));var util=require(_0x4516('0x1'));var moment=require('moment');var BPromise=require(_0x4516('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4516('0x3'))(_0x4516('0x4'));var config=require(_0x4516('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4516('0x6')][_0x4516('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41bd16,_0x1fb6d0,_0x4fb857){return new BPromise(function(_0x31229e,_0x30cd09){return client['request'](_0x41bd16,_0x4fb857)[_0x4516('0x8')](function(_0x1d17bb){logger[_0x4516('0x9')](_0x4516('0xa'),_0x1fb6d0,_0x4516('0xb'));logger[_0x4516('0xc')](_0x4516('0xd'),_0x1fb6d0,_0x4516('0xb'),JSON[_0x4516('0xe')](_0x1d17bb));if(_0x1d17bb[_0x4516('0xf')]){if(_0x1d17bb[_0x4516('0xf')][_0x4516('0x10')]===0x1f4){logger[_0x4516('0xf')](_0x4516('0xa'),_0x1fb6d0,_0x1d17bb['error']['message']);return _0x30cd09(_0x1d17bb['error']['message']);}logger[_0x4516('0xf')](_0x4516('0xa'),_0x1fb6d0,_0x1d17bb['error'][_0x4516('0x11')]);return _0x31229e(_0x1d17bb['error']['message']);}else{logger[_0x4516('0x9')](_0x4516('0xa'),_0x1fb6d0,_0x4516('0xb'));_0x31229e(_0x1d17bb[_0x4516('0x12')]['message']);}})[_0x4516('0x13')](function(_0x23e043){logger[_0x4516('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fb6d0,_0x23e043);_0x30cd09(_0x23e043);});});} \ No newline at end of file +var _0x823c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x823c,0xe5));var _0xc823=function(_0x5d11eb,_0x368d8e){_0x5d11eb=_0x5d11eb-0x0;var _0x1f884b=_0x823c[_0x5d11eb];return _0x1f884b;};'use strict';var _=require(_0xc823('0x0'));var util=require(_0xc823('0x1'));var moment=require(_0xc823('0x2'));var BPromise=require('bluebird');var rs=require(_0xc823('0x3'));var fs=require('fs');var Redis=require(_0xc823('0x4'));var db=require(_0xc823('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc823('0x6'))(_0xc823('0x7'));var config=require(_0xc823('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc823('0x9')][_0xc823('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c1dc,_0x5a7341,_0x34616e){return new BPromise(function(_0x5d3bc7,_0x39ed6d){return client[_0xc823('0xb')](_0x44c1dc,_0x34616e)[_0xc823('0xc')](function(_0x471e89){logger['info'](_0xc823('0xd'),_0x5a7341,'request\x20sent');logger['debug'](_0xc823('0xe'),_0x5a7341,'request\x20sent',JSON[_0xc823('0xf')](_0x471e89));if(_0x471e89[_0xc823('0x10')]){if(_0x471e89[_0xc823('0x10')][_0xc823('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x5a7341,_0x471e89[_0xc823('0x10')]['message']);return _0x39ed6d(_0x471e89[_0xc823('0x10')][_0xc823('0x12')]);}logger[_0xc823('0x10')](_0xc823('0xd'),_0x5a7341,_0x471e89[_0xc823('0x10')]['message']);return _0x5d3bc7(_0x471e89[_0xc823('0x10')][_0xc823('0x12')]);}else{logger[_0xc823('0x13')](_0xc823('0xd'),_0x5a7341,_0xc823('0x14'));_0x5d3bc7(_0x471e89[_0xc823('0x15')][_0xc823('0x12')]);}})[_0xc823('0x16')](function(_0x54775a){logger[_0xc823('0x10')](_0xc823('0xd'),_0x5a7341,_0x54775a);_0x39ed6d(_0x54775a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d16c3ce..3047bb5 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 _0x37ad=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','/:id/query','post','create'];(function(_0x5b9c27,_0x33093d){var _0x371a7c=function(_0x23c22b){while(--_0x23c22b){_0x5b9c27['push'](_0x5b9c27['shift']());}};_0x371a7c(++_0x33093d);}(_0x37ad,0x1cd));var _0xd37a=function(_0x1eb13f,_0x2e351a){_0x1eb13f=_0x1eb13f-0x0;var _0x521e95=_0x37ad[_0x1eb13f];return _0x521e95;};'use strict';var multer=require(_0xd37a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd37a('0x1'));var express=require(_0xd37a('0x2'));var router=express[_0xd37a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd37a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd37a('0x5'));router[_0xd37a('0x6')]('/',auth[_0xd37a('0x7')](),controller['index']);router[_0xd37a('0x6')](_0xd37a('0x8'),auth['isAuthenticated'](),controller[_0xd37a('0x9')]);router[_0xd37a('0x6')](_0xd37a('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0xd37a('0x6')]('/:id/run',auth[_0xd37a('0x7')](),controller['run']);router[_0xd37a('0x6')](_0xd37a('0xb'),auth[_0xd37a('0x7')](),controller['query']);router[_0xd37a('0xc')]('/',auth[_0xd37a('0x7')](),controller[_0xd37a('0xd')]);router[_0xd37a('0xe')](_0xd37a('0x8'),auth[_0xd37a('0x7')](),controller[_0xd37a('0xf')]);router[_0xd37a('0x10')](_0xd37a('0x8'),auth[_0xd37a('0x7')](),controller[_0xd37a('0x11')]);module[_0xd37a('0x12')]=router; \ No newline at end of file +var _0x1311=['../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','update','destroy','util','path','Router','fs-extra'];(function(_0x515910,_0x476f90){var _0x246f83=function(_0x232a02){while(--_0x232a02){_0x515910['push'](_0x515910['shift']());}};_0x246f83(++_0x476f90);}(_0x1311,0x1f4));var _0x1131=function(_0x18960b,_0x44ea2b){_0x18960b=_0x18960b-0x0;var _0x1d73de=_0x1311[_0x18960b];return _0x1d73de;};'use strict';var multer=require('multer');var util=require(_0x1131('0x0'));var path=require(_0x1131('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1131('0x2')]();var fs_extra=require(_0x1131('0x3'));var auth=require(_0x1131('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1131('0x5'));var controller=require(_0x1131('0x6'));router[_0x1131('0x7')]('/',auth[_0x1131('0x8')](),controller[_0x1131('0x9')]);router['get'](_0x1131('0xa'),auth['isAuthenticated'](),controller[_0x1131('0xb')]);router[_0x1131('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0x1131('0xc')]);router[_0x1131('0x7')](_0x1131('0xd'),auth[_0x1131('0x8')](),controller[_0x1131('0xe')]);router[_0x1131('0x7')](_0x1131('0xf'),auth['isAuthenticated'](),controller[_0x1131('0x10')]);router[_0x1131('0x11')]('/',auth['isAuthenticated'](),controller[_0x1131('0x12')]);router['put'](_0x1131('0xa'),auth['isAuthenticated'](),controller[_0x1131('0x13')]);router['delete'](_0x1131('0xa'),auth[_0x1131('0x8')](),controller[_0x1131('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 4bdd170..c85bf6a 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(_0x3b5f95,_0x1d9508){var _0x55c9dc=function(_0x22b6dd){while(--_0x22b6dd){_0x3b5f95['push'](_0x3b5f95['shift']());}};_0x55c9dc(++_0x1d9508);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'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 _0x8958=['TEXT','exports'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0x8958,0x93));var _0x8895=function(_0x2b2f8e,_0x494521){_0x2b2f8e=_0x2b2f8e-0x0;var _0xd95772=_0x8958[_0x2b2f8e];return _0xd95772;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'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 519ce1c..7d88b3d 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0xb8a206,_0x328cde){var _0x49b515=function(_0x33b7bb){while(--_0x33b7bb){_0xb8a206['push'](_0xb8a206['shift']());}};_0x49b515(++_0x328cde);}(_0xba34,0x119));var _0x4ba3=function(_0x17350f,_0x331b9c){_0x17350f=_0x17350f-0x0;var _0x4ca2c0=_0xba34[_0x17350f];return _0x4ca2c0;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x4b0f0b,_0x8785d1){var _0x13514=function(_0x3a50b5){while(--_0x3a50b5){_0x4b0f0b['push'](_0x4b0f0b['shift']());}};_0x13514(++_0x8785d1);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0f33d57..925a524 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 _0xc349=['../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x451e57,_0x4ee9f7){var _0x3179f4=function(_0x2c6e74){while(--_0x2c6e74){_0x451e57['push'](_0x451e57['shift']());}};_0x3179f4(++_0x4ee9f7);}(_0xc349,0xf4));var _0x9c34=function(_0x29ec75,_0x3afcae){_0x29ec75=_0x29ec75-0x0;var _0x31b41e=_0xc349[_0x29ec75];return _0x31b41e;};'use strict';var _=require(_0x9c34('0x0'));var util=require('util');var logger=require(_0x9c34('0x1'))(_0x9c34('0x2'));var moment=require(_0x9c34('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c34('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c34('0x5'));var config=require(_0x9c34('0x6'));var attributes=require(_0x9c34('0x7'));module[_0x9c34('0x8')]=function(_0x3cb303,_0x2c2be9){return _0x3cb303['define']('AnalyticDefaultReport',attributes,{'tableName':_0x9c34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f71=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','util','api','moment','bluebird','request-promise'];(function(_0x129945,_0x223d70){var _0x155c5d=function(_0x12b9b4){while(--_0x12b9b4){_0x129945['push'](_0x129945['shift']());}};_0x155c5d(++_0x223d70);}(_0x2f71,0x1a8));var _0x12f7=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2f71[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0x12f7('0x0'));var logger=require('../../config/logger')(_0x12f7('0x1'));var moment=require(_0x12f7('0x2'));var BPromise=require(_0x12f7('0x3'));var rp=require(_0x12f7('0x4'));var fs=require('fs');var path=require(_0x12f7('0x5'));var rimraf=require(_0x12f7('0x6'));var config=require(_0x12f7('0x7'));var attributes=require(_0x12f7('0x8'));module[_0x12f7('0x9')]=function(_0x5e28f2,_0x1fa4a7){return _0x5e28f2['define']('AnalyticDefaultReport',attributes,{'tableName':_0x12f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 75b239a..dec43b0 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 _0xe5e6=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xed218d,_0x22d916){var _0x4b8ae1=function(_0x545720){while(--_0x545720){_0xed218d['push'](_0xed218d['shift']());}};_0x4b8ae1(++_0x22d916);}(_0xe5e6,0x19e));var _0x6e5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe5e6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6e5e('0x0'));var util=require(_0x6e5e('0x1'));var moment=require('moment');var BPromise=require(_0x6e5e('0x2'));var rs=require(_0x6e5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e5e('0x4'))['db'];var utils=require(_0x6e5e('0x5'));var logger=require(_0x6e5e('0x6'))('rpc');var config=require(_0x6e5e('0x7'));var jayson=require(_0x6e5e('0x8'));var client=jayson[_0x6e5e('0x9')][_0x6e5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6f0e3,_0x1be2d8,_0x58c0e3){return new BPromise(function(_0x164255,_0x6216c4){return client[_0x6e5e('0xb')](_0xe6f0e3,_0x58c0e3)[_0x6e5e('0xc')](function(_0x36f9ea){logger[_0x6e5e('0xd')](_0x6e5e('0xe'),_0x1be2d8,'request\x20sent');logger[_0x6e5e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1be2d8,_0x6e5e('0x10'),JSON['stringify'](_0x36f9ea));if(_0x36f9ea[_0x6e5e('0x11')]){if(_0x36f9ea[_0x6e5e('0x11')]['code']===0x1f4){logger[_0x6e5e('0x11')](_0x6e5e('0xe'),_0x1be2d8,_0x36f9ea['error']['message']);return _0x6216c4(_0x36f9ea[_0x6e5e('0x11')]['message']);}logger[_0x6e5e('0x11')](_0x6e5e('0xe'),_0x1be2d8,_0x36f9ea[_0x6e5e('0x11')][_0x6e5e('0x12')]);return _0x164255(_0x36f9ea[_0x6e5e('0x11')][_0x6e5e('0x12')]);}else{logger[_0x6e5e('0xd')](_0x6e5e('0xe'),_0x1be2d8,'request\x20sent');_0x164255(_0x36f9ea[_0x6e5e('0x13')][_0x6e5e('0x12')]);}})[_0x6e5e('0x14')](function(_0x562439){logger[_0x6e5e('0x11')](_0x6e5e('0xe'),_0x1be2d8,_0x562439);_0x6216c4(_0x562439);});});} \ No newline at end of file +var _0x8c5d=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c5d,0x9c));var _0xd8c5=function(_0x290cdb,_0x31977b){_0x290cdb=_0x290cdb-0x0;var _0x4c3c23=_0x8c5d[_0x290cdb];return _0x4c3c23;};'use strict';var _=require('lodash');var util=require(_0xd8c5('0x0'));var moment=require(_0xd8c5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8c5('0x2'));var db=require(_0xd8c5('0x3'))['db'];var utils=require(_0xd8c5('0x4'));var logger=require(_0xd8c5('0x5'))(_0xd8c5('0x6'));var config=require(_0xd8c5('0x7'));var jayson=require(_0xd8c5('0x8'));var client=jayson[_0xd8c5('0x9')][_0xd8c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5443c7,_0x323184,_0x13edeb){return new BPromise(function(_0x51d6ad,_0x2f751c){return client['request'](_0x5443c7,_0x13edeb)['then'](function(_0x3a3960){logger[_0xd8c5('0xb')](_0xd8c5('0xc'),_0x323184,_0xd8c5('0xd'));logger[_0xd8c5('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x323184,_0xd8c5('0xd'),JSON[_0xd8c5('0xf')](_0x3a3960));if(_0x3a3960[_0xd8c5('0x10')]){if(_0x3a3960[_0xd8c5('0x10')][_0xd8c5('0x11')]===0x1f4){logger[_0xd8c5('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x323184,_0x3a3960['error'][_0xd8c5('0x12')]);return _0x2f751c(_0x3a3960[_0xd8c5('0x10')][_0xd8c5('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x323184,_0x3a3960[_0xd8c5('0x10')][_0xd8c5('0x12')]);return _0x51d6ad(_0x3a3960['error'][_0xd8c5('0x12')]);}else{logger[_0xd8c5('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x323184,_0xd8c5('0xd'));_0x51d6ad(_0x3a3960[_0xd8c5('0x13')][_0xd8c5('0x12')]);}})[_0xd8c5('0x14')](function(_0x12e16d){logger[_0xd8c5('0x10')](_0xd8c5('0xc'),_0x323184,_0x12e16d);_0x2f751c(_0x12e16d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 83287e0..30d6ee5 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 _0x2fb9=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete'];(function(_0x1ec278,_0x3e5649){var _0x26e1e8=function(_0x3ba66c){while(--_0x3ba66c){_0x1ec278['push'](_0x1ec278['shift']());}};_0x26e1e8(++_0x3e5649);}(_0x2fb9,0x19a));var _0x92fb=function(_0x3347d8,_0x317729){_0x3347d8=_0x3347d8-0x0;var _0x1a01fc=_0x2fb9[_0x3347d8];return _0x1a01fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92fb('0x0'));var timeout=require(_0x92fb('0x1'));var express=require(_0x92fb('0x2'));var router=express[_0x92fb('0x3')]();var fs_extra=require(_0x92fb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92fb('0x5'));var controller=require(_0x92fb('0x6'));router[_0x92fb('0x7')]('/',auth[_0x92fb('0x8')](),controller[_0x92fb('0x9')]);router[_0x92fb('0x7')](_0x92fb('0xa'),auth[_0x92fb('0x8')](),controller[_0x92fb('0xb')]);router[_0x92fb('0x7')](_0x92fb('0xc'),auth[_0x92fb('0x8')](),controller[_0x92fb('0xd')]);router[_0x92fb('0x7')](_0x92fb('0xe'),auth[_0x92fb('0x8')](),controller[_0x92fb('0xf')]);router['get'](_0x92fb('0x10'),auth[_0x92fb('0x8')](),controller[_0x92fb('0x11')]);router[_0x92fb('0x12')]('/',auth[_0x92fb('0x8')](),controller[_0x92fb('0x13')]);router['put'](_0x92fb('0xa'),auth[_0x92fb('0x8')](),controller[_0x92fb('0x14')]);router[_0x92fb('0x15')](_0x92fb('0xa'),auth[_0x92fb('0x8')](),controller[_0x92fb('0x16')]);module[_0x92fb('0x17')]=router; \ No newline at end of file +var _0x8549=['./analyticDefaultReport.controller','get','/:id','show','/:id/preview','isAuthenticated','preview','/:id/run','query','create','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4166f8,_0x4921df){var _0x380d51=function(_0x885606){while(--_0x885606){_0x4166f8['push'](_0x4166f8['shift']());}};_0x380d51(++_0x4921df);}(_0x8549,0x113));var _0x9854=function(_0x1ab13e,_0x44507a){_0x1ab13e=_0x1ab13e-0x0;var _0xa28f8=_0x8549[_0x1ab13e];return _0xa28f8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9854('0x0'));var express=require('express');var router=express[_0x9854('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9854('0x2'));var interaction=require(_0x9854('0x3'));var config=require(_0x9854('0x4'));var controller=require(_0x9854('0x5'));router[_0x9854('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9854('0x6')](_0x9854('0x7'),auth['isAuthenticated'](),controller[_0x9854('0x8')]);router['get'](_0x9854('0x9'),auth[_0x9854('0xa')](),controller[_0x9854('0xb')]);router[_0x9854('0x6')](_0x9854('0xc'),auth[_0x9854('0xa')](),controller['run']);router[_0x9854('0x6')]('/:id/query',auth[_0x9854('0xa')](),controller[_0x9854('0xd')]);router['post']('/',auth[_0x9854('0xa')](),controller[_0x9854('0xe')]);router[_0x9854('0xf')](_0x9854('0x7'),auth[_0x9854('0xa')](),controller[_0x9854('0x10')]);router[_0x9854('0x11')](_0x9854('0x7'),auth['isAuthenticated'](),controller[_0x9854('0x12')]);module[_0x9854('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 5fb7a3f..7532a3a 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 _0xfe21=['scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x3e3e99,_0x2d91cf){var _0x8d5189=function(_0x45e8d9){while(--_0x45e8d9){_0x3e3e99['push'](_0x3e3e99['shift']());}};_0x8d5189(++_0x2d91cf);}(_0xfe21,0x1e4));var _0x1fe2=function(_0x1020a6,_0x258d45){_0x1020a6=_0x1020a6-0x0;var _0x549f49=_0xfe21[_0x1020a6];return _0x549f49;};'use strict';var Sequelize=require(_0x1fe2('0x0'));var moment=require(_0x1fe2('0x1'));module[_0x1fe2('0x2')]={'name':{'type':Sequelize[_0x1fe2('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1fe2('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1fe2('0x4'),_0x1fe2('0x5'),_0x1fe2('0x6')),'allowNull':![],'defaultValue':_0x1fe2('0x4')},'savename':{'type':Sequelize[_0x1fe2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1fe2('0x7')]},'status':{'type':Sequelize[_0x1fe2('0x3')],'defaultValue':_0x1fe2('0x8')},'type':{'type':Sequelize['ENUM'](_0x1fe2('0x9'),_0x1fe2('0xa')),'allowNull':![],'defaultValue':_0x1fe2('0x9')},'reportId':{'type':Sequelize[_0x1fe2('0xb')](0xb)[_0x1fe2('0xc')]},'reportType':{'type':Sequelize[_0x1fe2('0x3')]}}; \ No newline at end of file +var _0x7594=['Loading','scheduled','manual','INTEGER','UNSIGNED','moment','ENUM','csv','pdf','DATE','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7594,0x12e));var _0x4759=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x7594[_0x2b8077];return _0x308091;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4759('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x4759('0x1')](_0x4759('0x2'),_0x4759('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x4759('0x2')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4759('0x4')]},'endDate':{'type':Sequelize[_0x4759('0x4')]},'status':{'type':Sequelize[_0x4759('0x5')],'defaultValue':_0x4759('0x6')},'type':{'type':Sequelize['ENUM']('manual',_0x4759('0x7')),'allowNull':![],'defaultValue':_0x4759('0x8')},'reportId':{'type':Sequelize[_0x4759('0x9')](0xb)[_0x4759('0xa')]},'reportType':{'type':Sequelize[_0x4759('0x5')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2a9e164..52a4b88 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 _0x6167=['filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','root','server/files/reports','format','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','error','name','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick'];(function(_0x550e5b,_0x478f04){var _0x59a793=function(_0x415a57){while(--_0x415a57){_0x550e5b['push'](_0x550e5b['shift']());}};_0x59a793(++_0x478f04);}(_0x6167,0xdd));var _0x7616=function(_0xeba586,_0x836496){_0xeba586=_0xeba586-0x0;var _0x30adbd=_0x6167[_0xeba586];return _0x30adbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7616('0x0'));var zipdir=require(_0x7616('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7616('0x2'));var moment=require(_0x7616('0x3'));var BPromise=require(_0x7616('0x4'));var Mustache=require(_0x7616('0x5'));var util=require(_0x7616('0x6'));var path=require('path');var sox=require(_0x7616('0x7'));var csv=require(_0x7616('0x8'));var ejs=require(_0x7616('0x9'));var fs=require('fs');var fs_extra=require(_0x7616('0xa'));var _=require('lodash');var squel=require(_0x7616('0xb'));var crypto=require(_0x7616('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7616('0x8'));var querystring=require(_0x7616('0xd'));var Papa=require(_0x7616('0xe'));var Redis=require(_0x7616('0xf'));var authService=require(_0x7616('0x10'));var qs=require(_0x7616('0x11'));var as=require(_0x7616('0x12'));var hardwareService=require(_0x7616('0x13'));var logger=require('../../config/logger')(_0x7616('0x14'));var utils=require(_0x7616('0x15'));var config=require(_0x7616('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579053,_0x4f71c3){_0x4f71c3=_0x4f71c3||0xcc;return function(_0x49d51d){if(_0x49d51d){return _0x579053[_0x7616('0x17')](_0x4f71c3);}return _0x579053[_0x7616('0x18')](_0x4f71c3)[_0x7616('0x19')]();};}function respondWithResult(_0x5d0c40,_0x4d204d){_0x4d204d=_0x4d204d||0xc8;return function(_0x357532){if(_0x357532){return _0x5d0c40['status'](_0x4d204d)[_0x7616('0x1a')](_0x357532);}};}function respondWithFilteredResult(_0x28a4e6,_0xe833de){return function(_0x4bc058){if(_0x4bc058){var _0x5b925a=typeof _0xe833de['offset']===_0x7616('0x1b')&&typeof _0xe833de['limit']===_0x7616('0x1b');var _0x4609a3=_0x4bc058[_0x7616('0x1c')];var _0x40c813=_0x5b925a?0x0:_0xe833de[_0x7616('0x1d')];var _0x5920ec=_0x5b925a?_0x4bc058[_0x7616('0x1c')]:_0xe833de['offset']+_0xe833de[_0x7616('0x1e')];var _0x179ba6;if(_0x5920ec>=_0x4609a3){_0x5920ec=_0x4609a3;_0x179ba6=0xc8;}else{_0x179ba6=0xce;}_0x28a4e6[_0x7616('0x18')](_0x179ba6);return _0x28a4e6[_0x7616('0x1f')](_0x7616('0x20'),_0x40c813+'-'+_0x5920ec+'/'+_0x4609a3)['json'](_0x4bc058);}return null;};}function patchUpdates(_0x221e0c){return function(_0x4ddbba){try{jsonpatch[_0x7616('0x21')](_0x4ddbba,_0x221e0c,!![]);}catch(_0x1b600c){return BPromise[_0x7616('0x22')](_0x1b600c);}return _0x4ddbba[_0x7616('0x23')]();};}function saveUpdates(_0x53169b,_0x373a09){return function(_0x5c76bb){if(_0x5c76bb){return _0x5c76bb[_0x7616('0x24')](_0x53169b)[_0x7616('0x25')](function(_0x123fcc){return _0x123fcc;});}return null;};}function removeEntity(_0x969397,_0x296344){return function(_0x38beed){if(_0x38beed){return _0x38beed[_0x7616('0x26')]()[_0x7616('0x25')](function(){var _0x4c6e6c=_0x38beed[_0x7616('0x27')]({'plain':!![]});var _0x3c792d=_0x7616('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c792d,'resourceId':_0x4c6e6c['id']}})['then'](function(){return _0x38beed;});})['then'](function(){_0x969397[_0x7616('0x18')](0xcc)[_0x7616('0x19')]();});}};}function handleEntityNotFound(_0x400f9c,_0x2cd986){return function(_0x3ba986){if(!_0x3ba986){_0x400f9c['sendStatus'](0x194);}return _0x3ba986;};}function handleError(_0x27bf6e,_0x59ec4b){_0x59ec4b=_0x59ec4b||0x1f4;return function(_0x2773c9){logger[_0x7616('0x29')](_0x2773c9['stack']);if(_0x2773c9[_0x7616('0x2a')]){delete _0x2773c9[_0x7616('0x2a')];}_0x27bf6e[_0x7616('0x18')](_0x59ec4b)[_0x7616('0x2b')](_0x2773c9);};}exports[_0x7616('0x2c')]=function(_0x2bb623,_0x6cc515){var _0x3358d1={},_0x541cd7={},_0x4892f8={'count':0x0,'rows':[]};var _0x406801=_[_0x7616('0x2d')](db[_0x7616('0x2e')]['rawAttributes'],function(_0x50855e){return{'name':_0x50855e[_0x7616('0x2f')],'type':_0x50855e[_0x7616('0x30')][_0x7616('0x31')]};});_0x541cd7[_0x7616('0x32')]=_['map'](_0x406801,'name');_0x541cd7[_0x7616('0x33')]=_['keys'](_0x2bb623[_0x7616('0x33')]);_0x541cd7['filters']=_[_0x7616('0x34')](_0x541cd7[_0x7616('0x32')],_0x541cd7['query']);_0x3358d1['attributes']=_['intersection'](_0x541cd7[_0x7616('0x32')],qs[_0x7616('0x35')](_0x2bb623[_0x7616('0x33')][_0x7616('0x35')]));_0x3358d1[_0x7616('0x36')]=_0x3358d1['attributes'][_0x7616('0x37')]?_0x3358d1['attributes']:_0x541cd7[_0x7616('0x32')];if(!_0x2bb623[_0x7616('0x33')][_0x7616('0x38')]('nolimit')){_0x3358d1[_0x7616('0x1e')]=qs[_0x7616('0x1e')](_0x2bb623[_0x7616('0x33')][_0x7616('0x1e')]);_0x3358d1[_0x7616('0x1d')]=qs['offset'](_0x2bb623['query'][_0x7616('0x1d')]);}_0x3358d1[_0x7616('0x39')]=qs['sort'](_0x2bb623[_0x7616('0x33')][_0x7616('0x3a')]);_0x3358d1['where']=qs[_0x7616('0x3b')](_[_0x7616('0x3c')](_0x2bb623['query'],_0x541cd7[_0x7616('0x3b')]),_0x406801);if(_0x2bb623['query'][_0x7616('0x3d')]){_0x3358d1['where']=_[_0x7616('0x3e')](_0x3358d1[_0x7616('0x3f')],{'$or':_[_0x7616('0x2d')](_0x406801,function(_0x27f563){if(_0x27f563[_0x7616('0x30')]!==_0x7616('0x40')){var _0x75f4c2={};_0x75f4c2[_0x27f563[_0x7616('0x2a')]]={'$like':'%'+_0x2bb623[_0x7616('0x33')][_0x7616('0x3d')]+'%'};return _0x75f4c2;}})});}_0x3358d1=_[_0x7616('0x3e')]({},_0x3358d1,_0x2bb623[_0x7616('0x41')]);var _0x1ee86a={'where':_0x3358d1['where']};return db[_0x7616('0x2e')][_0x7616('0x1c')](_0x1ee86a)[_0x7616('0x25')](function(_0x1c0ef3){_0x4892f8['count']=_0x1c0ef3;if(_0x2bb623[_0x7616('0x33')]['includeAll']){_0x3358d1[_0x7616('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7616('0x43')](_0x3358d1);})[_0x7616('0x25')](function(_0x460020){_0x4892f8[_0x7616('0x44')]=_0x460020;return _0x4892f8;})[_0x7616('0x25')](respondWithFilteredResult(_0x6cc515,_0x3358d1))[_0x7616('0x45')](handleError(_0x6cc515,null));};exports['show']=function(_0x298923,_0x3aaa01){var _0x185eed={'raw':!![],'where':{'id':_0x298923[_0x7616('0x46')]['id']}},_0x483c31={};_0x483c31[_0x7616('0x32')]=_[_0x7616('0x47')](db[_0x7616('0x2e')]['rawAttributes']);_0x483c31['query']=_['keys'](_0x298923[_0x7616('0x33')]);_0x483c31['filters']=_[_0x7616('0x34')](_0x483c31['model'],_0x483c31['query']);_0x185eed[_0x7616('0x36')]=_[_0x7616('0x34')](_0x483c31['model'],qs[_0x7616('0x35')](_0x298923[_0x7616('0x33')]['fields']));_0x185eed['attributes']=_0x185eed['attributes']['length']?_0x185eed[_0x7616('0x36')]:_0x483c31[_0x7616('0x32')];if(_0x298923[_0x7616('0x33')]['includeAll']){_0x185eed[_0x7616('0x42')]=[{'all':!![]}];}_0x185eed=_[_0x7616('0x3e')]({},_0x185eed,_0x298923[_0x7616('0x41')]);return db[_0x7616('0x2e')][_0x7616('0x48')](_0x185eed)[_0x7616('0x25')](handleEntityNotFound(_0x3aaa01,null))[_0x7616('0x25')](respondWithResult(_0x3aaa01,null))[_0x7616('0x45')](handleError(_0x3aaa01,null));};exports[_0x7616('0x49')]=function(_0x2c5c07,_0x182290){return db[_0x7616('0x2e')]['create'](_0x2c5c07[_0x7616('0x4a')],{})['then'](function(_0x177763){var _0x2717f1=_0x2c5c07[_0x7616('0x4b')]['get']({'plain':!![]});if(!_0x2717f1)throw new Error(_0x7616('0x4c'));if(_0x2717f1[_0x7616('0x4d')]===_0x7616('0x4b')){var _0x22da77=_0x177763['get']({'plain':!![]});var _0x1fc2f0='ExtractedReports';return db[_0x7616('0x4e')][_0x7616('0x48')]({'where':{'name':_0x1fc2f0,'userProfileId':_0x2717f1['userProfileId']},'raw':!![]})[_0x7616('0x25')](function(_0x34f604){if(_0x34f604&&_0x34f604['autoAssociation']===0x0){return db[_0x7616('0x4f')][_0x7616('0x49')]({'name':_0x22da77[_0x7616('0x2a')],'resourceId':_0x22da77['id'],'type':_0x34f604[_0x7616('0x2a')],'sectionId':_0x34f604['id']},{})['then'](function(){return _0x177763;});}else{return _0x177763;}})[_0x7616('0x45')](function(_0x5a1ce4){logger[_0x7616('0x29')](_0x7616('0x50'),_0x5a1ce4);throw _0x5a1ce4;});}return _0x177763;})['then'](respondWithResult(_0x182290,0xc9))[_0x7616('0x45')](handleError(_0x182290,null));};exports[_0x7616('0x24')]=function(_0x2807c1,_0x2372e5){if(_0x2807c1[_0x7616('0x4a')]['id']){delete _0x2807c1[_0x7616('0x4a')]['id'];}return db[_0x7616('0x2e')][_0x7616('0x48')]({'where':{'id':_0x2807c1['params']['id']}})['then'](handleEntityNotFound(_0x2372e5,null))[_0x7616('0x25')](saveUpdates(_0x2807c1['body'],null))['then'](respondWithResult(_0x2372e5,null))['catch'](handleError(_0x2372e5,null));};exports['destroy']=function(_0x3203de,_0xd8c7cf){return db[_0x7616('0x2e')]['find']({'where':{'id':_0x3203de['params']['id']}})['then'](handleEntityNotFound(_0xd8c7cf,null))['then'](removeEntity(_0xd8c7cf,null))[_0x7616('0x45')](handleError(_0xd8c7cf,null));};exports[_0x7616('0x51')]=function(_0x53db0c,_0x510dd3,_0x1582a0){return db[_0x7616('0x2e')]['find']({'where':{'id':_0x53db0c[_0x7616('0x46')]['id']},'attributes':['name',_0x7616('0x52'),_0x7616('0x53'),_0x7616('0x54')],'raw':!![]})[_0x7616('0x25')](handleEntityNotFound(_0x510dd3,null))[_0x7616('0x25')](function(_0x15f63f){if(_0x15f63f){if(!fs[_0x7616('0x55')](path['join'](config['root'],'server/files/reports',_0x15f63f[_0x7616('0x53')]))){throw new db[(_0x7616('0x56'))][(_0x7616('0x57'))](_0x7616('0x58'));}if(_0x53db0c[_0x7616('0x33')]['exists']){return _0x510dd3[_0x7616('0x17')](0xc8);}return _0x510dd3[_0x7616('0x51')](path[_0x7616('0x59')](config[_0x7616('0x5a')],_0x7616('0x5b'),_0x15f63f[_0x7616('0x53')]),util[_0x7616('0x5c')]('%s.%s',_0x15f63f[_0x7616('0x52')]||_0x15f63f['name'],_0x15f63f['output'][_0x7616('0x5d')]()));}})[_0x7616('0x45')](handleError(_0x510dd3,null));}; \ No newline at end of file +var _0xf42f=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','existsSync','root','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','format','%s.%s','toLowerCase','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','keys','model','attributes','query','fields','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body'];(function(_0x1b7795,_0x327977){var _0x350be2=function(_0x5dcb8b){while(--_0x5dcb8b){_0x1b7795['push'](_0x1b7795['shift']());}};_0x350be2(++_0x327977);}(_0xf42f,0x194));var _0xff42=function(_0x40b4fc,_0x167681){_0x40b4fc=_0x40b4fc-0x0;var _0x505b24=_0xf42f[_0x40b4fc];return _0x505b24;};'use strict';var emlformat=require(_0xff42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff42('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff42('0x2'));var moment=require(_0xff42('0x3'));var BPromise=require(_0xff42('0x4'));var Mustache=require('mustache');var util=require(_0xff42('0x5'));var path=require(_0xff42('0x6'));var sox=require(_0xff42('0x7'));var csv=require(_0xff42('0x8'));var ejs=require(_0xff42('0x9'));var fs=require('fs');var fs_extra=require(_0xff42('0xa'));var _=require(_0xff42('0xb'));var squel=require(_0xff42('0xc'));var crypto=require(_0xff42('0xd'));var jsforce=require(_0xff42('0xe'));var deskjs=require(_0xff42('0xf'));var toCsv=require('to-csv');var querystring=require(_0xff42('0x10'));var Papa=require('papaparse');var Redis=require(_0xff42('0x11'));var authService=require(_0xff42('0x12'));var qs=require(_0xff42('0x13'));var as=require(_0xff42('0x14'));var hardwareService=require(_0xff42('0x15'));var logger=require('../../config/logger')(_0xff42('0x16'));var utils=require(_0xff42('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff42('0x18'));var db=require(_0xff42('0x19'))['db'];function respondWithStatusCode(_0x421127,_0x538a2a){_0x538a2a=_0x538a2a||0xcc;return function(_0x2e7393){if(_0x2e7393){return _0x421127[_0xff42('0x1a')](_0x538a2a);}return _0x421127[_0xff42('0x1b')](_0x538a2a)['end']();};}function respondWithResult(_0x4ecc03,_0x518894){_0x518894=_0x518894||0xc8;return function(_0x397c43){if(_0x397c43){return _0x4ecc03[_0xff42('0x1b')](_0x518894)[_0xff42('0x1c')](_0x397c43);}};}function respondWithFilteredResult(_0x509b44,_0x41d279){return function(_0x50939f){if(_0x50939f){var _0x4c96a9=typeof _0x41d279['offset']===_0xff42('0x1d')&&typeof _0x41d279[_0xff42('0x1e')]==='undefined';var _0x57cfff=_0x50939f[_0xff42('0x1f')];var _0x40ecb5=_0x4c96a9?0x0:_0x41d279[_0xff42('0x20')];var _0x18c715=_0x4c96a9?_0x50939f[_0xff42('0x1f')]:_0x41d279[_0xff42('0x20')]+_0x41d279[_0xff42('0x1e')];var _0x1c529d;if(_0x18c715>=_0x57cfff){_0x18c715=_0x57cfff;_0x1c529d=0xc8;}else{_0x1c529d=0xce;}_0x509b44[_0xff42('0x1b')](_0x1c529d);return _0x509b44['set']('Content-Range',_0x40ecb5+'-'+_0x18c715+'/'+_0x57cfff)[_0xff42('0x1c')](_0x50939f);}return null;};}function patchUpdates(_0x19d96d){return function(_0x397e90){try{jsonpatch[_0xff42('0x21')](_0x397e90,_0x19d96d,!![]);}catch(_0x4b01cd){return BPromise['reject'](_0x4b01cd);}return _0x397e90[_0xff42('0x22')]();};}function saveUpdates(_0x460cd3,_0x2903ea){return function(_0x212b75){if(_0x212b75){return _0x212b75[_0xff42('0x23')](_0x460cd3)[_0xff42('0x24')](function(_0x2f7633){return _0x2f7633;});}return null;};}function removeEntity(_0x4aa483,_0x5acc26){return function(_0x2d539c){if(_0x2d539c){return _0x2d539c[_0xff42('0x25')]()[_0xff42('0x24')](function(){var _0x2db759=_0x2d539c['get']({'plain':!![]});var _0x1b7fb6=_0xff42('0x26');return db[_0xff42('0x27')][_0xff42('0x25')]({'where':{'type':_0x1b7fb6,'resourceId':_0x2db759['id']}})[_0xff42('0x24')](function(){return _0x2d539c;});})['then'](function(){_0x4aa483[_0xff42('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52555e,_0x47b149){return function(_0x13dd32){if(!_0x13dd32){_0x52555e['sendStatus'](0x194);}return _0x13dd32;};}function handleError(_0x341146,_0x333afe){_0x333afe=_0x333afe||0x1f4;return function(_0x5521d0){logger[_0xff42('0x28')](_0x5521d0[_0xff42('0x29')]);if(_0x5521d0[_0xff42('0x2a')]){delete _0x5521d0[_0xff42('0x2a')];}_0x341146[_0xff42('0x1b')](_0x333afe)['send'](_0x5521d0);};}exports[_0xff42('0x2b')]=function(_0x5eac06,_0x216547){var _0xee0fa5={},_0x296326={},_0xfe8efc={'count':0x0,'rows':[]};var _0x5bbe1c=_[_0xff42('0x2c')](db[_0xff42('0x2d')][_0xff42('0x2e')],function(_0x52087c){return{'name':_0x52087c[_0xff42('0x2f')],'type':_0x52087c['type'][_0xff42('0x30')]};});_0x296326['model']=_[_0xff42('0x2c')](_0x5bbe1c,_0xff42('0x2a'));_0x296326['query']=_[_0xff42('0x31')](_0x5eac06['query']);_0x296326['filters']=_['intersection'](_0x296326[_0xff42('0x32')],_0x296326['query']);_0xee0fa5[_0xff42('0x33')]=_['intersection'](_0x296326[_0xff42('0x32')],qs['fields'](_0x5eac06[_0xff42('0x34')][_0xff42('0x35')]));_0xee0fa5[_0xff42('0x33')]=_0xee0fa5[_0xff42('0x33')]['length']?_0xee0fa5[_0xff42('0x33')]:_0x296326['model'];if(!_0x5eac06[_0xff42('0x34')]['hasOwnProperty'](_0xff42('0x36'))){_0xee0fa5['limit']=qs[_0xff42('0x1e')](_0x5eac06['query'][_0xff42('0x1e')]);_0xee0fa5[_0xff42('0x20')]=qs[_0xff42('0x20')](_0x5eac06['query'][_0xff42('0x20')]);}_0xee0fa5[_0xff42('0x37')]=qs[_0xff42('0x38')](_0x5eac06['query'][_0xff42('0x38')]);_0xee0fa5['where']=qs[_0xff42('0x39')](_[_0xff42('0x3a')](_0x5eac06[_0xff42('0x34')],_0x296326[_0xff42('0x39')]),_0x5bbe1c);if(_0x5eac06[_0xff42('0x34')]['filter']){_0xee0fa5[_0xff42('0x3b')]=_['merge'](_0xee0fa5['where'],{'$or':_['map'](_0x5bbe1c,function(_0xb47185){if(_0xb47185[_0xff42('0x3c')]!==_0xff42('0x3d')){var _0x2d12fe={};_0x2d12fe[_0xb47185[_0xff42('0x2a')]]={'$like':'%'+_0x5eac06[_0xff42('0x34')][_0xff42('0x3e')]+'%'};return _0x2d12fe;}})});}_0xee0fa5=_[_0xff42('0x3f')]({},_0xee0fa5,_0x5eac06[_0xff42('0x40')]);var _0x42e42b={'where':_0xee0fa5[_0xff42('0x3b')]};return db[_0xff42('0x2d')]['count'](_0x42e42b)[_0xff42('0x24')](function(_0x9d4d0c){_0xfe8efc['count']=_0x9d4d0c;if(_0x5eac06[_0xff42('0x34')][_0xff42('0x41')]){_0xee0fa5[_0xff42('0x42')]=[{'all':!![]}];}return db[_0xff42('0x2d')][_0xff42('0x43')](_0xee0fa5);})['then'](function(_0x37fea2){_0xfe8efc[_0xff42('0x44')]=_0x37fea2;return _0xfe8efc;})[_0xff42('0x24')](respondWithFilteredResult(_0x216547,_0xee0fa5))[_0xff42('0x45')](handleError(_0x216547,null));};exports[_0xff42('0x46')]=function(_0x4ada74,_0x35688c){var _0x296556={'raw':!![],'where':{'id':_0x4ada74[_0xff42('0x47')]['id']}},_0x18132b={};_0x18132b[_0xff42('0x32')]=_[_0xff42('0x31')](db[_0xff42('0x2d')][_0xff42('0x2e')]);_0x18132b['query']=_[_0xff42('0x31')](_0x4ada74['query']);_0x18132b[_0xff42('0x39')]=_[_0xff42('0x48')](_0x18132b[_0xff42('0x32')],_0x18132b[_0xff42('0x34')]);_0x296556['attributes']=_[_0xff42('0x48')](_0x18132b[_0xff42('0x32')],qs[_0xff42('0x35')](_0x4ada74[_0xff42('0x34')][_0xff42('0x35')]));_0x296556[_0xff42('0x33')]=_0x296556[_0xff42('0x33')]['length']?_0x296556['attributes']:_0x18132b[_0xff42('0x32')];if(_0x4ada74['query']['includeAll']){_0x296556[_0xff42('0x42')]=[{'all':!![]}];}_0x296556=_['merge']({},_0x296556,_0x4ada74[_0xff42('0x40')]);return db[_0xff42('0x2d')][_0xff42('0x49')](_0x296556)['then'](handleEntityNotFound(_0x35688c,null))[_0xff42('0x24')](respondWithResult(_0x35688c,null))[_0xff42('0x45')](handleError(_0x35688c,null));};exports['create']=function(_0x1772e7,_0x143b56){return db[_0xff42('0x2d')][_0xff42('0x4a')](_0x1772e7[_0xff42('0x4b')],{})[_0xff42('0x24')](function(_0x2ab233){var _0x5db449=_0x1772e7[_0xff42('0x4c')][_0xff42('0x4d')]({'plain':!![]});if(!_0x5db449)throw new Error(_0xff42('0x4e'));if(_0x5db449[_0xff42('0x4f')]===_0xff42('0x4c')){var _0x37a3e1=_0x2ab233[_0xff42('0x4d')]({'plain':!![]});var _0x25c7c5=_0xff42('0x26');return db['UserProfileSection'][_0xff42('0x49')]({'where':{'name':_0x25c7c5,'userProfileId':_0x5db449[_0xff42('0x50')]},'raw':!![]})[_0xff42('0x24')](function(_0x3bdbcb){if(_0x3bdbcb&&_0x3bdbcb[_0xff42('0x51')]===0x0){return db[_0xff42('0x27')][_0xff42('0x4a')]({'name':_0x37a3e1[_0xff42('0x2a')],'resourceId':_0x37a3e1['id'],'type':_0x3bdbcb[_0xff42('0x2a')],'sectionId':_0x3bdbcb['id']},{})['then'](function(){return _0x2ab233;});}else{return _0x2ab233;}})[_0xff42('0x45')](function(_0x1edaee){logger[_0xff42('0x28')](_0xff42('0x52'),_0x1edaee);throw _0x1edaee;});}return _0x2ab233;})[_0xff42('0x24')](respondWithResult(_0x143b56,0xc9))[_0xff42('0x45')](handleError(_0x143b56,null));};exports[_0xff42('0x23')]=function(_0x311253,_0x20881f){if(_0x311253[_0xff42('0x4b')]['id']){delete _0x311253[_0xff42('0x4b')]['id'];}return db[_0xff42('0x2d')][_0xff42('0x49')]({'where':{'id':_0x311253[_0xff42('0x47')]['id']}})[_0xff42('0x24')](handleEntityNotFound(_0x20881f,null))[_0xff42('0x24')](saveUpdates(_0x311253[_0xff42('0x4b')],null))[_0xff42('0x24')](respondWithResult(_0x20881f,null))[_0xff42('0x45')](handleError(_0x20881f,null));};exports[_0xff42('0x25')]=function(_0x281e61,_0x55050f){return db['AnalyticExtractedReport'][_0xff42('0x49')]({'where':{'id':_0x281e61[_0xff42('0x47')]['id']}})[_0xff42('0x24')](handleEntityNotFound(_0x55050f,null))[_0xff42('0x24')](removeEntity(_0x55050f,null))[_0xff42('0x45')](handleError(_0x55050f,null));};exports[_0xff42('0x53')]=function(_0x49cb93,_0x40041b,_0x30044a){return db[_0xff42('0x2d')]['find']({'where':{'id':_0x49cb93['params']['id']},'attributes':[_0xff42('0x2a'),_0xff42('0x54'),'savename','output'],'raw':!![]})['then'](handleEntityNotFound(_0x40041b,null))[_0xff42('0x24')](function(_0x275fb2){if(_0x275fb2){if(!fs[_0xff42('0x55')](path['join'](config[_0xff42('0x56')],'server/files/reports',_0x275fb2[_0xff42('0x57')]))){throw new db[(_0xff42('0x58'))][(_0xff42('0x59'))](_0xff42('0x5a'));}if(_0x49cb93['query']['exists']){return _0x40041b[_0xff42('0x1a')](0xc8);}return _0x40041b[_0xff42('0x53')](path[_0xff42('0x5b')](config['root'],_0xff42('0x5c'),_0x275fb2[_0xff42('0x57')]),util[_0xff42('0x5d')](_0xff42('0x5e'),_0x275fb2[_0xff42('0x54')]||_0x275fb2[_0xff42('0x2a')],_0x275fb2['output'][_0xff42('0x5f')]()));}})[_0xff42('0x45')](handleError(_0x40041b,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b8797f2..d243d59 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 _0x1b13=['bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment'];(function(_0x4ab9d2,_0x43a9ed){var _0x16ab31=function(_0x1fe505){while(--_0x1fe505){_0x4ab9d2['push'](_0x4ab9d2['shift']());}};_0x16ab31(++_0x43a9ed);}(_0x1b13,0x1f4));var _0x31b1=function(_0x1d5926,_0x133bc2){_0x1d5926=_0x1d5926-0x0;var _0x34e985=_0x1b13[_0x1d5926];return _0x34e985;};'use strict';var _=require(_0x31b1('0x0'));var util=require(_0x31b1('0x1'));var logger=require(_0x31b1('0x2'))('api');var moment=require(_0x31b1('0x3'));var BPromise=require(_0x31b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31b1('0x5'));var rimraf=require('rimraf');var config=require(_0x31b1('0x6'));var attributes=require(_0x31b1('0x7'));module[_0x31b1('0x8')]=function(_0xe7ce94,_0x1ad35e){return _0xe7ce94[_0x31b1('0x9')](_0x31b1('0xa'),attributes,{'tableName':_0x31b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e6=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','request-promise','path','rimraf'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0xa1e6,0x74));var _0x6a1e=function(_0x29381f,_0x1397f0){_0x29381f=_0x29381f-0x0;var _0x1920bc=_0xa1e6[_0x29381f];return _0x1920bc;};'use strict';var _=require(_0x6a1e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6a1e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6a1e('0x2'));var fs=require('fs');var path=require(_0x6a1e('0x3'));var rimraf=require(_0x6a1e('0x4'));var config=require(_0x6a1e('0x5'));var attributes=require(_0x6a1e('0x6'));module[_0x6a1e('0x7')]=function(_0x3f56f5,_0x423687){return _0x3f56f5[_0x6a1e('0x8')](_0x6a1e('0x9'),attributes,{'tableName':_0x6a1e('0xa'),'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 cfbe98c..310aa9c 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 _0x2ae0=['stringify','error','message','info','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xcdc802,_0x5931cb){var _0x291505=function(_0x5271d5){while(--_0x5271d5){_0xcdc802['push'](_0xcdc802['shift']());}};_0x291505(++_0x5931cb);}(_0x2ae0,0x137));var _0x02ae=function(_0x411a03,_0x1caa81){_0x411a03=_0x411a03-0x0;var _0xb88084=_0x2ae0[_0x411a03];return _0xb88084;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x02ae('0x0'));var BPromise=require(_0x02ae('0x1'));var rs=require(_0x02ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02ae('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x02ae('0x4'));var config=require(_0x02ae('0x5'));var jayson=require(_0x02ae('0x6'));var client=jayson['client'][_0x02ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3dd475,_0x2285ac,_0x288b0e){return new BPromise(function(_0x54f327,_0x54e263){return client[_0x02ae('0x8')](_0x3dd475,_0x288b0e)[_0x02ae('0x9')](function(_0x44516d){logger['info'](_0x02ae('0xa'),_0x2285ac,_0x02ae('0xb'));logger[_0x02ae('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2285ac,'request\x20sent',JSON[_0x02ae('0xd')](_0x44516d));if(_0x44516d['error']){if(_0x44516d[_0x02ae('0xe')]['code']===0x1f4){logger['error'](_0x02ae('0xa'),_0x2285ac,_0x44516d['error'][_0x02ae('0xf')]);return _0x54e263(_0x44516d['error'][_0x02ae('0xf')]);}logger[_0x02ae('0xe')](_0x02ae('0xa'),_0x2285ac,_0x44516d['error'][_0x02ae('0xf')]);return _0x54f327(_0x44516d[_0x02ae('0xe')][_0x02ae('0xf')]);}else{logger[_0x02ae('0x10')](_0x02ae('0xa'),_0x2285ac,_0x02ae('0xb'));_0x54f327(_0x44516d['result']['message']);}})[_0x02ae('0x11')](function(_0x4000cd){logger[_0x02ae('0xe')](_0x02ae('0xa'),_0x2285ac,_0x4000cd);_0x54e263(_0x4000cd);});});} \ No newline at end of file +var _0x2977=['request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xefe04c,_0x1accd1){var _0x59233d=function(_0x252485){while(--_0x252485){_0xefe04c['push'](_0xefe04c['shift']());}};_0x59233d(++_0x1accd1);}(_0x2977,0xf2));var _0x7297=function(_0x25e671,_0x4f2082){_0x25e671=_0x25e671-0x0;var _0x3c3290=_0x2977[_0x25e671];return _0x3c3290;};'use strict';var _=require(_0x7297('0x0'));var util=require(_0x7297('0x1'));var moment=require('moment');var BPromise=require(_0x7297('0x2'));var rs=require(_0x7297('0x3'));var fs=require('fs');var Redis=require(_0x7297('0x4'));var db=require(_0x7297('0x5'))['db'];var utils=require(_0x7297('0x6'));var logger=require('../../config/logger')(_0x7297('0x7'));var config=require(_0x7297('0x8'));var jayson=require(_0x7297('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dfa70,_0x18ae07,_0x3b0aae){return new BPromise(function(_0x4c9112,_0x377baa){return client[_0x7297('0xa')](_0x3dfa70,_0x3b0aae)[_0x7297('0xb')](function(_0x24642a){logger['info'](_0x7297('0xc'),_0x18ae07,'request\x20sent');logger[_0x7297('0xd')](_0x7297('0xe'),_0x18ae07,_0x7297('0xf'),JSON['stringify'](_0x24642a));if(_0x24642a[_0x7297('0x10')]){if(_0x24642a['error'][_0x7297('0x11')]===0x1f4){logger[_0x7297('0x10')](_0x7297('0xc'),_0x18ae07,_0x24642a[_0x7297('0x10')]['message']);return _0x377baa(_0x24642a[_0x7297('0x10')]['message']);}logger[_0x7297('0x10')](_0x7297('0xc'),_0x18ae07,_0x24642a['error'][_0x7297('0x12')]);return _0x4c9112(_0x24642a[_0x7297('0x10')][_0x7297('0x12')]);}else{logger[_0x7297('0x13')](_0x7297('0xc'),_0x18ae07,_0x7297('0xf'));_0x4c9112(_0x24642a['result'][_0x7297('0x12')]);}})[_0x7297('0x14')](function(_0x2fcd56){logger[_0x7297('0x10')](_0x7297('0xc'),_0x18ae07,_0x2fcd56);_0x377baa(_0x2fcd56);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 374995a..948171c 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 _0xc59d=['express','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','post','create','delete','destroy','exports','util','path'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0xc59d,0x15e));var _0xdc59=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc59d[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xdc59('0x0'));var path=require(_0xdc59('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc59('0x2'));var router=express['Router']();var fs_extra=require(_0xdc59('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdc59('0x4'));var config=require('../../config/environment');var controller=require(_0xdc59('0x5'));router[_0xdc59('0x6')]('/',auth[_0xdc59('0x7')](),controller['index']);router[_0xdc59('0x6')](_0xdc59('0x8'),auth[_0xdc59('0x7')](),controller[_0xdc59('0x9')]);router[_0xdc59('0x6')](_0xdc59('0xa'),auth[_0xdc59('0x7')](),controller['download']);router[_0xdc59('0xb')]('/',auth[_0xdc59('0x7')](),controller[_0xdc59('0xc')]);router['put'](_0xdc59('0x8'),auth[_0xdc59('0x7')](),controller['update']);router[_0xdc59('0xd')](_0xdc59('0x8'),auth[_0xdc59('0x7')](),controller[_0xdc59('0xe')]);module[_0xdc59('0xf')]=router; \ No newline at end of file +var _0x5485=['index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x589359,_0x56e521){var _0x58eec7=function(_0x50a721){while(--_0x50a721){_0x589359['push'](_0x589359['shift']());}};_0x58eec7(++_0x56e521);}(_0x5485,0x137));var _0x5548=function(_0x1632f5,_0x54b7f1){_0x1632f5=_0x1632f5-0x0;var _0x2d8324=_0x5485[_0x1632f5];return _0x2d8324;};'use strict';var multer=require(_0x5548('0x0'));var util=require(_0x5548('0x1'));var path=require(_0x5548('0x2'));var timeout=require(_0x5548('0x3'));var express=require(_0x5548('0x4'));var router=express[_0x5548('0x5')]();var fs_extra=require(_0x5548('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5548('0x7'));var config=require(_0x5548('0x8'));var controller=require(_0x5548('0x9'));router[_0x5548('0xa')]('/',auth['isAuthenticated'](),controller[_0x5548('0xb')]);router[_0x5548('0xa')](_0x5548('0xc'),auth[_0x5548('0xd')](),controller[_0x5548('0xe')]);router['get'](_0x5548('0xf'),auth[_0x5548('0xd')](),controller[_0x5548('0x10')]);router[_0x5548('0x11')]('/',auth[_0x5548('0xd')](),controller[_0x5548('0x12')]);router[_0x5548('0x13')](_0x5548('0xc'),auth[_0x5548('0xd')](),controller[_0x5548('0x14')]);router['delete'](_0x5548('0xc'),auth['isAuthenticated'](),controller[_0x5548('0x15')]);module[_0x5548('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c3a4354..6fcf953 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 _0x0bc0=['exports','STRING','BOOLEAN'];(function(_0x5773ef,_0x48eea9){var _0x325907=function(_0x238a17){while(--_0x238a17){_0x5773ef['push'](_0x5773ef['shift']());}};_0x325907(++_0x48eea9);}(_0x0bc0,0x147));var _0x00bc=function(_0xc9b565,_0x14970d){_0xc9b565=_0xc9b565-0x0;var _0x3ce997=_0x0bc0[_0xc9b565];return _0x3ce997;};'use strict';var Sequelize=require('sequelize');module[_0x00bc('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x00bc('0x1')]},'groupBy':{'type':Sequelize[_0x00bc('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x00bc('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0d0c=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3205de,_0x4dd200){var _0x2eede3=function(_0x182463){while(--_0x182463){_0x3205de['push'](_0x3205de['shift']());}};_0x2eede3(++_0x4dd200);}(_0x0d0c,0x1ab));var _0xc0d0=function(_0x528e3a,_0x1594cb){_0x528e3a=_0x528e3a-0x0;var _0x209e2f=_0x0d0c[_0x528e3a];return _0x209e2f;};'use strict';var Sequelize=require(_0xc0d0('0x0'));module[_0xc0d0('0x1')]={'field':{'type':Sequelize[_0xc0d0('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xc0d0('0x3')]},'format':{'type':Sequelize[_0xc0d0('0x3')]},'groupBy':{'type':Sequelize[_0xc0d0('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc0d0('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2945eb8..032488c 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 _0xb0b5=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','bulkCreate','body','destroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','fieldName','type','model','query'];(function(_0x18c350,_0x8739d6){var _0x1977e3=function(_0x157802){while(--_0x157802){_0x18c350['push'](_0x18c350['shift']());}};_0x1977e3(++_0x8739d6);}(_0xb0b5,0x6e));var _0x5b0b=function(_0x4d5dbc,_0x4f99d3){_0x4d5dbc=_0x4d5dbc-0x0;var _0x3aaa90=_0xb0b5[_0x4d5dbc];return _0x3aaa90;};'use strict';var emlformat=require(_0x5b0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b0b('0x1'));var jsonpatch=require(_0x5b0b('0x2'));var rp=require(_0x5b0b('0x3'));var moment=require(_0x5b0b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5b0b('0x5'));var sox=require(_0x5b0b('0x6'));var csv=require(_0x5b0b('0x7'));var ejs=require(_0x5b0b('0x8'));var fs=require('fs');var fs_extra=require(_0x5b0b('0x9'));var _=require(_0x5b0b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b0b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5b0b('0x7'));var querystring=require(_0x5b0b('0xc'));var Papa=require(_0x5b0b('0xd'));var Redis=require('ioredis');var authService=require(_0x5b0b('0xe'));var qs=require(_0x5b0b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5b0b('0x10'));var config=require(_0x5b0b('0x11'));var licenseUtil=require(_0x5b0b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17a8df,_0x30e2dd){_0x30e2dd=_0x30e2dd||0xcc;return function(_0x3c01d2){if(_0x3c01d2){return _0x17a8df[_0x5b0b('0x13')](_0x30e2dd);}return _0x17a8df[_0x5b0b('0x14')](_0x30e2dd)[_0x5b0b('0x15')]();};}function respondWithResult(_0xae29d4,_0x16bc9e){_0x16bc9e=_0x16bc9e||0xc8;return function(_0x5116a9){if(_0x5116a9){return _0xae29d4[_0x5b0b('0x14')](_0x16bc9e)[_0x5b0b('0x16')](_0x5116a9);}};}function respondWithFilteredResult(_0x42b592,_0x186415){return function(_0xbc644d){if(_0xbc644d){var _0x11a74d=typeof _0x186415[_0x5b0b('0x17')]==='undefined'&&typeof _0x186415[_0x5b0b('0x18')]===_0x5b0b('0x19');var _0x569a1d=_0xbc644d[_0x5b0b('0x1a')];var _0x592c52=_0x11a74d?0x0:_0x186415[_0x5b0b('0x17')];var _0x9085a5=_0x11a74d?_0xbc644d['count']:_0x186415[_0x5b0b('0x17')]+_0x186415[_0x5b0b('0x18')];var _0x4295d2;if(_0x9085a5>=_0x569a1d){_0x9085a5=_0x569a1d;_0x4295d2=0xc8;}else{_0x4295d2=0xce;}_0x42b592['status'](_0x4295d2);return _0x42b592[_0x5b0b('0x1b')](_0x5b0b('0x1c'),_0x592c52+'-'+_0x9085a5+'/'+_0x569a1d)[_0x5b0b('0x16')](_0xbc644d);}return null;};}function patchUpdates(_0x16c739){return function(_0x5aa8f7){try{jsonpatch[_0x5b0b('0x1d')](_0x5aa8f7,_0x16c739,!![]);}catch(_0x529ba2){return BPromise[_0x5b0b('0x1e')](_0x529ba2);}return _0x5aa8f7[_0x5b0b('0x1f')]();};}function saveUpdates(_0x4f5234,_0x1c7e66){return function(_0x1af6d0){if(_0x1af6d0){return _0x1af6d0[_0x5b0b('0x20')](_0x4f5234)[_0x5b0b('0x21')](function(_0xe086a9){return _0xe086a9;});}return null;};}function removeEntity(_0x1a94bf,_0x3e13ce){return function(_0x1bf2d2){if(_0x1bf2d2){return _0x1bf2d2['destroy']()[_0x5b0b('0x21')](function(){_0x1a94bf[_0x5b0b('0x14')](0xcc)[_0x5b0b('0x15')]();});}};}function handleEntityNotFound(_0x52cde4,_0x2b8d9b){return function(_0x3c82cf){if(!_0x3c82cf){_0x52cde4[_0x5b0b('0x13')](0x194);}return _0x3c82cf;};}function handleError(_0x3d81d0,_0x551d5f){_0x551d5f=_0x551d5f||0x1f4;return function(_0x3300f8){logger[_0x5b0b('0x22')](_0x3300f8[_0x5b0b('0x23')]);if(_0x3300f8['name']){delete _0x3300f8[_0x5b0b('0x24')];}_0x3d81d0[_0x5b0b('0x14')](_0x551d5f)['send'](_0x3300f8);};}exports['index']=function(_0x390233,_0x3c98d9){var _0x3658e7={},_0x5ed4cd={},_0x131bc1={'count':0x0,'rows':[]};var _0x563429=_[_0x5b0b('0x25')](db['AnalyticFieldReport']['rawAttributes'],function(_0x4649c6){return{'name':_0x4649c6[_0x5b0b('0x26')],'type':_0x4649c6[_0x5b0b('0x27')]['key']};});_0x5ed4cd[_0x5b0b('0x28')]=_[_0x5b0b('0x25')](_0x563429,_0x5b0b('0x24'));_0x5ed4cd[_0x5b0b('0x29')]=_[_0x5b0b('0x2a')](_0x390233[_0x5b0b('0x29')]);_0x5ed4cd[_0x5b0b('0x2b')]=_[_0x5b0b('0x2c')](_0x5ed4cd['model'],_0x5ed4cd['query']);_0x3658e7['attributes']=_[_0x5b0b('0x2c')](_0x5ed4cd[_0x5b0b('0x28')],qs[_0x5b0b('0x2d')](_0x390233[_0x5b0b('0x29')][_0x5b0b('0x2d')]));_0x3658e7[_0x5b0b('0x2e')]=_0x3658e7['attributes'][_0x5b0b('0x2f')]?_0x3658e7[_0x5b0b('0x2e')]:_0x5ed4cd[_0x5b0b('0x28')];if(!_0x390233[_0x5b0b('0x29')][_0x5b0b('0x30')]('nolimit')){_0x3658e7['limit']=qs[_0x5b0b('0x18')](_0x390233['query'][_0x5b0b('0x18')]);_0x3658e7[_0x5b0b('0x17')]=qs[_0x5b0b('0x17')](_0x390233[_0x5b0b('0x29')]['offset']);}_0x3658e7['order']=qs[_0x5b0b('0x31')](_0x390233[_0x5b0b('0x29')][_0x5b0b('0x31')]);_0x3658e7[_0x5b0b('0x32')]=qs[_0x5b0b('0x2b')](_[_0x5b0b('0x33')](_0x390233[_0x5b0b('0x29')],_0x5ed4cd[_0x5b0b('0x2b')]),_0x563429);if(_0x390233[_0x5b0b('0x29')][_0x5b0b('0x34')]){_0x3658e7['where']=_[_0x5b0b('0x35')](_0x3658e7['where'],{'$or':_[_0x5b0b('0x25')](_0x563429,function(_0x3f3bd9){if(_0x3f3bd9[_0x5b0b('0x27')]!==_0x5b0b('0x36')){var _0x547637={};_0x547637[_0x3f3bd9['name']]={'$like':'%'+_0x390233[_0x5b0b('0x29')][_0x5b0b('0x34')]+'%'};return _0x547637;}})});}_0x3658e7=_[_0x5b0b('0x35')]({},_0x3658e7,_0x390233[_0x5b0b('0x37')]);var _0x3c4fa0={'where':_0x3658e7['where']};return db[_0x5b0b('0x38')][_0x5b0b('0x1a')](_0x3c4fa0)[_0x5b0b('0x21')](function(_0x4dd2f3){_0x131bc1[_0x5b0b('0x1a')]=_0x4dd2f3;if(_0x390233['query'][_0x5b0b('0x39')]){_0x3658e7['include']=[{'all':!![]}];}return db[_0x5b0b('0x38')][_0x5b0b('0x3a')](_0x3658e7);})[_0x5b0b('0x21')](function(_0x225e2e){_0x131bc1[_0x5b0b('0x3b')]=_0x225e2e;return _0x131bc1;})['then'](respondWithFilteredResult(_0x3c98d9,_0x3658e7))[_0x5b0b('0x3c')](handleError(_0x3c98d9,null));};exports[_0x5b0b('0x3d')]=function(_0xe50e32,_0x510acc){var _0x41787b={'raw':![],'where':{'id':_0xe50e32[_0x5b0b('0x3e')]['id']}},_0x18f341={};_0x18f341[_0x5b0b('0x28')]=_[_0x5b0b('0x2a')](db[_0x5b0b('0x38')][_0x5b0b('0x3f')]);_0x18f341[_0x5b0b('0x29')]=_['keys'](_0xe50e32[_0x5b0b('0x29')]);_0x18f341['filters']=_['intersection'](_0x18f341[_0x5b0b('0x28')],_0x18f341[_0x5b0b('0x29')]);_0x41787b['attributes']=_['intersection'](_0x18f341[_0x5b0b('0x28')],qs[_0x5b0b('0x2d')](_0xe50e32['query'][_0x5b0b('0x2d')]));_0x41787b[_0x5b0b('0x2e')]=_0x41787b['attributes'][_0x5b0b('0x2f')]?_0x41787b[_0x5b0b('0x2e')]:_0x18f341[_0x5b0b('0x28')];if(_0xe50e32['query'][_0x5b0b('0x39')]){_0x41787b[_0x5b0b('0x40')]=[{'all':!![]}];}_0x41787b=_['merge']({},_0x41787b,_0xe50e32[_0x5b0b('0x37')]);return db[_0x5b0b('0x38')][_0x5b0b('0x41')](_0x41787b)[_0x5b0b('0x21')](handleEntityNotFound(_0x510acc,null))[_0x5b0b('0x21')](respondWithResult(_0x510acc,null))[_0x5b0b('0x3c')](handleError(_0x510acc,null));};exports[_0x5b0b('0x42')]=function(_0x3bd13e,_0x49ff6c){return db[_0x5b0b('0x38')][_0x5b0b('0x42')](_0x3bd13e['body'],{})[_0x5b0b('0x21')](respondWithResult(_0x49ff6c,0xc9))[_0x5b0b('0x3c')](handleError(_0x49ff6c,null));};exports[_0x5b0b('0x43')]=function(_0x289104,_0x1a1103){return db['AnalyticFieldReport']['bulkCreate'](_0x289104[_0x5b0b('0x44')],{'raw':![],'individualHooks':!![]})[_0x5b0b('0x21')](respondWithResult(_0x1a1103,0xc9))[_0x5b0b('0x3c')](handleError(_0x1a1103,null));};exports['update']=function(_0x5a20d3,_0x41c8b9){if(_0x5a20d3[_0x5b0b('0x44')]['id']){delete _0x5a20d3[_0x5b0b('0x44')]['id'];}return db[_0x5b0b('0x38')][_0x5b0b('0x41')]({'where':{'id':_0x5a20d3[_0x5b0b('0x3e')]['id']}})[_0x5b0b('0x21')](handleEntityNotFound(_0x41c8b9,null))['then'](saveUpdates(_0x5a20d3[_0x5b0b('0x44')],null))['then'](respondWithResult(_0x41c8b9,null))[_0x5b0b('0x3c')](handleError(_0x41c8b9,null));};exports[_0x5b0b('0x45')]=function(_0xe6f8e9,_0x3dc914){return db[_0x5b0b('0x38')][_0x5b0b('0x41')]({'where':{'id':_0xe6f8e9[_0x5b0b('0x3e')]['id']}})[_0x5b0b('0x21')](handleEntityNotFound(_0x3dc914,null))[_0x5b0b('0x21')](removeEntity(_0x3dc914,null))[_0x5b0b('0x3c')](handleError(_0x3dc914,null));};exports['bulkDestroy']=function(_0x1e1090,_0x3d0149){return db['AnalyticFieldReport'][_0x5b0b('0x45')]({'where':{'id':_0x1e1090[_0x5b0b('0x29')][_0x5b0b('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x5b0b('0x21')](respondWithResult(_0x3d0149,0xcc))['catch'](handleError(_0x3d0149,null));};exports[_0x5b0b('0x47')]=function(_0x4ea2d3,_0x522169,_0x1d34df){return db[_0x5b0b('0x48')][_0x5b0b('0x49')]({'where':{'id':_0x4ea2d3[_0x5b0b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x522169,null))[_0x5b0b('0x21')](function(_0x28594f){if(_0x28594f){return db['sequelize'][_0x5b0b('0x4a')](function(_0x14dea9){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x4ea2d3[_0x5b0b('0x3e')]['id']},'transaction':_0x14dea9})['then'](function(_0x466182){var _0x488007=_[_0x5b0b('0x25')](_0x4ea2d3[_0x5b0b('0x44')],function(_0x1cdb9e){delete _0x1cdb9e['id'];_0x1cdb9e[_0x5b0b('0x4b')]=_0x4ea2d3[_0x5b0b('0x3e')]['id'];return _0x1cdb9e;});return db[_0x5b0b('0x38')][_0x5b0b('0x43')](_0x488007,{'transaction':_0x14dea9});});})[_0x5b0b('0x21')](function(){return db[_0x5b0b('0x38')]['findAll']({'where':{'CustomReportId':_0x4ea2d3['params']['id']}});});}})[_0x5b0b('0x21')](respondWithResult(_0x522169,null))[_0x5b0b('0x3c')](handleError(_0x522169,null));}; \ No newline at end of file +var _0x2bab=['includeAll','rows','catch','params','include','options','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2bab,0x10f));var _0xb2ba=function(_0x4ce284,_0x400bb7){_0x4ce284=_0x4ce284-0x0;var _0x1f61c5=_0x2bab[_0x4ce284];return _0x1f61c5;};'use strict';var emlformat=require(_0xb2ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2ba('0x2'));var BPromise=require(_0xb2ba('0x3'));var Mustache=require('mustache');var util=require(_0xb2ba('0x4'));var path=require(_0xb2ba('0x5'));var sox=require(_0xb2ba('0x6'));var csv=require(_0xb2ba('0x7'));var ejs=require(_0xb2ba('0x8'));var fs=require('fs');var fs_extra=require(_0xb2ba('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require(_0xb2ba('0xb'));var deskjs=require(_0xb2ba('0xc'));var toCsv=require(_0xb2ba('0x7'));var querystring=require(_0xb2ba('0xd'));var Papa=require(_0xb2ba('0xe'));var Redis=require(_0xb2ba('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb2ba('0x10'));var as=require(_0xb2ba('0x11'));var hardwareService=require(_0xb2ba('0x12'));var logger=require(_0xb2ba('0x13'))(_0xb2ba('0x14'));var utils=require(_0xb2ba('0x15'));var config=require(_0xb2ba('0x16'));var licenseUtil=require(_0xb2ba('0x17'));var db=require(_0xb2ba('0x18'))['db'];function respondWithStatusCode(_0x4cebe1,_0x4b74b3){_0x4b74b3=_0x4b74b3||0xcc;return function(_0x1885a4){if(_0x1885a4){return _0x4cebe1[_0xb2ba('0x19')](_0x4b74b3);}return _0x4cebe1['status'](_0x4b74b3)[_0xb2ba('0x1a')]();};}function respondWithResult(_0x2889a3,_0x22a78a){_0x22a78a=_0x22a78a||0xc8;return function(_0x4c5801){if(_0x4c5801){return _0x2889a3[_0xb2ba('0x1b')](_0x22a78a)[_0xb2ba('0x1c')](_0x4c5801);}};}function respondWithFilteredResult(_0x1d0a99,_0x193aca){return function(_0x5877a3){if(_0x5877a3){var _0x106d40=typeof _0x193aca[_0xb2ba('0x1d')]===_0xb2ba('0x1e')&&typeof _0x193aca[_0xb2ba('0x1f')]===_0xb2ba('0x1e');var _0x2459e6=_0x5877a3[_0xb2ba('0x20')];var _0x2dbd1b=_0x106d40?0x0:_0x193aca['offset'];var _0x37c34e=_0x106d40?_0x5877a3[_0xb2ba('0x20')]:_0x193aca[_0xb2ba('0x1d')]+_0x193aca[_0xb2ba('0x1f')];var _0x2a3fb6;if(_0x37c34e>=_0x2459e6){_0x37c34e=_0x2459e6;_0x2a3fb6=0xc8;}else{_0x2a3fb6=0xce;}_0x1d0a99['status'](_0x2a3fb6);return _0x1d0a99[_0xb2ba('0x21')]('Content-Range',_0x2dbd1b+'-'+_0x37c34e+'/'+_0x2459e6)[_0xb2ba('0x1c')](_0x5877a3);}return null;};}function patchUpdates(_0x4f2a60){return function(_0x36e10f){try{jsonpatch[_0xb2ba('0x22')](_0x36e10f,_0x4f2a60,!![]);}catch(_0x5818ef){return BPromise[_0xb2ba('0x23')](_0x5818ef);}return _0x36e10f[_0xb2ba('0x24')]();};}function saveUpdates(_0x5eeac7,_0x4bfe74){return function(_0x56d37c){if(_0x56d37c){return _0x56d37c['update'](_0x5eeac7)['then'](function(_0x1ef081){return _0x1ef081;});}return null;};}function removeEntity(_0x3c229e,_0x12e10b){return function(_0x22eec9){if(_0x22eec9){return _0x22eec9[_0xb2ba('0x25')]()[_0xb2ba('0x26')](function(){_0x3c229e['status'](0xcc)[_0xb2ba('0x1a')]();});}};}function handleEntityNotFound(_0x188957,_0x30f280){return function(_0x5610b4){if(!_0x5610b4){_0x188957[_0xb2ba('0x19')](0x194);}return _0x5610b4;};}function handleError(_0x509699,_0x1db802){_0x1db802=_0x1db802||0x1f4;return function(_0x6d9bc5){logger[_0xb2ba('0x27')](_0x6d9bc5[_0xb2ba('0x28')]);if(_0x6d9bc5[_0xb2ba('0x29')]){delete _0x6d9bc5[_0xb2ba('0x29')];}_0x509699[_0xb2ba('0x1b')](_0x1db802)[_0xb2ba('0x2a')](_0x6d9bc5);};}exports[_0xb2ba('0x2b')]=function(_0x389528,_0x49f6aa){var _0x138bc0={},_0x1ec5f3={},_0x51a2ae={'count':0x0,'rows':[]};var _0x58645d=_[_0xb2ba('0x2c')](db[_0xb2ba('0x2d')][_0xb2ba('0x2e')],function(_0x554257){return{'name':_0x554257['fieldName'],'type':_0x554257[_0xb2ba('0x2f')][_0xb2ba('0x30')]};});_0x1ec5f3['model']=_['map'](_0x58645d,_0xb2ba('0x29'));_0x1ec5f3['query']=_[_0xb2ba('0x31')](_0x389528[_0xb2ba('0x32')]);_0x1ec5f3['filters']=_[_0xb2ba('0x33')](_0x1ec5f3[_0xb2ba('0x34')],_0x1ec5f3[_0xb2ba('0x32')]);_0x138bc0['attributes']=_[_0xb2ba('0x33')](_0x1ec5f3['model'],qs[_0xb2ba('0x35')](_0x389528[_0xb2ba('0x32')]['fields']));_0x138bc0[_0xb2ba('0x36')]=_0x138bc0['attributes'][_0xb2ba('0x37')]?_0x138bc0[_0xb2ba('0x36')]:_0x1ec5f3['model'];if(!_0x389528['query'][_0xb2ba('0x38')](_0xb2ba('0x39'))){_0x138bc0[_0xb2ba('0x1f')]=qs[_0xb2ba('0x1f')](_0x389528[_0xb2ba('0x32')][_0xb2ba('0x1f')]);_0x138bc0[_0xb2ba('0x1d')]=qs[_0xb2ba('0x1d')](_0x389528[_0xb2ba('0x32')]['offset']);}_0x138bc0['order']=qs['sort'](_0x389528['query'][_0xb2ba('0x3a')]);_0x138bc0[_0xb2ba('0x3b')]=qs[_0xb2ba('0x3c')](_[_0xb2ba('0x3d')](_0x389528[_0xb2ba('0x32')],_0x1ec5f3[_0xb2ba('0x3c')]),_0x58645d);if(_0x389528['query'][_0xb2ba('0x3e')]){_0x138bc0[_0xb2ba('0x3b')]=_[_0xb2ba('0x3f')](_0x138bc0[_0xb2ba('0x3b')],{'$or':_[_0xb2ba('0x2c')](_0x58645d,function(_0x4a36d7){if(_0x4a36d7['type']!==_0xb2ba('0x40')){var _0x426998={};_0x426998[_0x4a36d7['name']]={'$like':'%'+_0x389528[_0xb2ba('0x32')][_0xb2ba('0x3e')]+'%'};return _0x426998;}})});}_0x138bc0=_[_0xb2ba('0x3f')]({},_0x138bc0,_0x389528['options']);var _0x168368={'where':_0x138bc0[_0xb2ba('0x3b')]};return db[_0xb2ba('0x2d')]['count'](_0x168368)[_0xb2ba('0x26')](function(_0x1ef9d9){_0x51a2ae[_0xb2ba('0x20')]=_0x1ef9d9;if(_0x389528['query'][_0xb2ba('0x41')]){_0x138bc0['include']=[{'all':!![]}];}return db[_0xb2ba('0x2d')]['findAll'](_0x138bc0);})[_0xb2ba('0x26')](function(_0x217117){_0x51a2ae[_0xb2ba('0x42')]=_0x217117;return _0x51a2ae;})[_0xb2ba('0x26')](respondWithFilteredResult(_0x49f6aa,_0x138bc0))[_0xb2ba('0x43')](handleError(_0x49f6aa,null));};exports['show']=function(_0xbbad76,_0x4a550c){var _0x4a274f={'raw':![],'where':{'id':_0xbbad76[_0xb2ba('0x44')]['id']}},_0x23d658={};_0x23d658[_0xb2ba('0x34')]=_[_0xb2ba('0x31')](db['AnalyticFieldReport'][_0xb2ba('0x2e')]);_0x23d658[_0xb2ba('0x32')]=_[_0xb2ba('0x31')](_0xbbad76[_0xb2ba('0x32')]);_0x23d658[_0xb2ba('0x3c')]=_['intersection'](_0x23d658[_0xb2ba('0x34')],_0x23d658[_0xb2ba('0x32')]);_0x4a274f[_0xb2ba('0x36')]=_[_0xb2ba('0x33')](_0x23d658[_0xb2ba('0x34')],qs[_0xb2ba('0x35')](_0xbbad76[_0xb2ba('0x32')][_0xb2ba('0x35')]));_0x4a274f[_0xb2ba('0x36')]=_0x4a274f[_0xb2ba('0x36')]['length']?_0x4a274f['attributes']:_0x23d658[_0xb2ba('0x34')];if(_0xbbad76[_0xb2ba('0x32')]['includeAll']){_0x4a274f[_0xb2ba('0x45')]=[{'all':!![]}];}_0x4a274f=_[_0xb2ba('0x3f')]({},_0x4a274f,_0xbbad76[_0xb2ba('0x46')]);return db[_0xb2ba('0x2d')][_0xb2ba('0x47')](_0x4a274f)[_0xb2ba('0x26')](handleEntityNotFound(_0x4a550c,null))['then'](respondWithResult(_0x4a550c,null))[_0xb2ba('0x43')](handleError(_0x4a550c,null));};exports[_0xb2ba('0x48')]=function(_0x1c28fe,_0x23d0ef){return db[_0xb2ba('0x2d')][_0xb2ba('0x48')](_0x1c28fe[_0xb2ba('0x49')],{})['then'](respondWithResult(_0x23d0ef,0xc9))[_0xb2ba('0x43')](handleError(_0x23d0ef,null));};exports['bulkCreate']=function(_0x577b8f,_0x46e331){return db[_0xb2ba('0x2d')][_0xb2ba('0x4a')](_0x577b8f[_0xb2ba('0x49')],{'raw':![],'individualHooks':!![]})[_0xb2ba('0x26')](respondWithResult(_0x46e331,0xc9))[_0xb2ba('0x43')](handleError(_0x46e331,null));};exports[_0xb2ba('0x4b')]=function(_0x1e9945,_0xd26a40){if(_0x1e9945[_0xb2ba('0x49')]['id']){delete _0x1e9945['body']['id'];}return db['AnalyticFieldReport'][_0xb2ba('0x47')]({'where':{'id':_0x1e9945[_0xb2ba('0x44')]['id']}})[_0xb2ba('0x26')](handleEntityNotFound(_0xd26a40,null))[_0xb2ba('0x26')](saveUpdates(_0x1e9945[_0xb2ba('0x49')],null))['then'](respondWithResult(_0xd26a40,null))['catch'](handleError(_0xd26a40,null));};exports['destroy']=function(_0x2d2d44,_0x2df327){return db['AnalyticFieldReport']['find']({'where':{'id':_0x2d2d44[_0xb2ba('0x44')]['id']}})[_0xb2ba('0x26')](handleEntityNotFound(_0x2df327,null))[_0xb2ba('0x26')](removeEntity(_0x2df327,null))['catch'](handleError(_0x2df327,null));};exports[_0xb2ba('0x4c')]=function(_0x524d30,_0x57a44a){return db[_0xb2ba('0x2d')][_0xb2ba('0x25')]({'where':{'id':_0x524d30[_0xb2ba('0x32')][_0xb2ba('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xb2ba('0x26')](respondWithResult(_0x57a44a,0xcc))[_0xb2ba('0x43')](handleError(_0x57a44a,null));};exports[_0xb2ba('0x4e')]=function(_0x259884,_0x56e331,_0x38411f){return db[_0xb2ba('0x4f')][_0xb2ba('0x50')]({'where':{'id':_0x259884[_0xb2ba('0x44')]['id']}})[_0xb2ba('0x26')](handleEntityNotFound(_0x56e331,null))[_0xb2ba('0x26')](function(_0x2a76b9){if(_0x2a76b9){return db[_0xb2ba('0x51')][_0xb2ba('0x52')](function(_0xd2fbb6){return db[_0xb2ba('0x2d')]['destroy']({'where':{'CustomReportId':_0x259884['params']['id']},'transaction':_0xd2fbb6})[_0xb2ba('0x26')](function(_0x4d4951){var _0x530f88=_[_0xb2ba('0x2c')](_0x259884[_0xb2ba('0x49')],function(_0xdc9cb0){delete _0xdc9cb0['id'];_0xdc9cb0[_0xb2ba('0x53')]=_0x259884[_0xb2ba('0x44')]['id'];return _0xdc9cb0;});return db[_0xb2ba('0x2d')][_0xb2ba('0x4a')](_0x530f88,{'transaction':_0xd2fbb6});});})[_0xb2ba('0x26')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x259884[_0xb2ba('0x44')]['id']}});});}})[_0xb2ba('0x26')](respondWithResult(_0x56e331,null))[_0xb2ba('0x43')](handleError(_0x56e331,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0802f8b..6c1ed57 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 _0x89d1=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x512e68,_0x2cb721){var _0x431111=function(_0x2fd097){while(--_0x2fd097){_0x512e68['push'](_0x512e68['shift']());}};_0x431111(++_0x2cb721);}(_0x89d1,0x154));var _0x189d=function(_0x4ba902,_0x3a2f8c){_0x4ba902=_0x4ba902-0x0;var _0x368391=_0x89d1[_0x4ba902];return _0x368391;};'use strict';var _=require(_0x189d('0x0'));var util=require('util');var logger=require(_0x189d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x189d('0x2'));var rp=require(_0x189d('0x3'));var fs=require('fs');var path=require(_0x189d('0x4'));var rimraf=require(_0x189d('0x5'));var config=require(_0x189d('0x6'));var attributes=require(_0x189d('0x7'));module[_0x189d('0x8')]=function(_0x5bd522,_0x357a5c){return _0x5bd522[_0x189d('0x9')](_0x189d('0xa'),attributes,{'tableName':_0x189d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5511=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','define','analytics_report_fields','lodash'];(function(_0x244067,_0x3f81f8){var _0x51bd92=function(_0x14ccc7){while(--_0x14ccc7){_0x244067['push'](_0x244067['shift']());}};_0x51bd92(++_0x3f81f8);}(_0x5511,0x113));var _0x1551=function(_0x3eafd8,_0x4c5743){_0x3eafd8=_0x3eafd8-0x0;var _0x57bbf0=_0x5511[_0x3eafd8];return _0x57bbf0;};'use strict';var _=require(_0x1551('0x0'));var util=require(_0x1551('0x1'));var logger=require(_0x1551('0x2'))(_0x1551('0x3'));var moment=require(_0x1551('0x4'));var BPromise=require(_0x1551('0x5'));var rp=require(_0x1551('0x6'));var fs=require('fs');var path=require(_0x1551('0x7'));var rimraf=require(_0x1551('0x8'));var config=require('../../config/environment');var attributes=require(_0x1551('0x9'));module['exports']=function(_0x5b9c99,_0x230d85){return _0x5b9c99[_0x1551('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x1551('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 161768c..7457736 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 _0xa676=['request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xa676,0xda));var _0x6a67=function(_0x3d577a,_0x1b5b28){_0x3d577a=_0x3d577a-0x0;var _0x16750e=_0xa676[_0x3d577a];return _0x16750e;};'use strict';var _=require(_0x6a67('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a67('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a67('0x2'));var db=require(_0x6a67('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a67('0x4'));var config=require('../../config/environment');var jayson=require(_0x6a67('0x5'));var client=jayson['client'][_0x6a67('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5e272d,_0x1a34e3,_0x3db12e){return new BPromise(function(_0x291e0c,_0x477e5f){return client[_0x6a67('0x7')](_0x5e272d,_0x3db12e)[_0x6a67('0x8')](function(_0x43da00){logger['info'](_0x6a67('0x9'),_0x1a34e3,_0x6a67('0xa'));logger[_0x6a67('0xb')](_0x6a67('0xc'),_0x1a34e3,'request\x20sent',JSON[_0x6a67('0xd')](_0x43da00));if(_0x43da00[_0x6a67('0xe')]){if(_0x43da00[_0x6a67('0xe')][_0x6a67('0xf')]===0x1f4){logger['error'](_0x6a67('0x9'),_0x1a34e3,_0x43da00['error'][_0x6a67('0x10')]);return _0x477e5f(_0x43da00[_0x6a67('0xe')][_0x6a67('0x10')]);}logger[_0x6a67('0xe')](_0x6a67('0x9'),_0x1a34e3,_0x43da00['error']['message']);return _0x291e0c(_0x43da00[_0x6a67('0xe')][_0x6a67('0x10')]);}else{logger[_0x6a67('0x11')](_0x6a67('0x9'),_0x1a34e3,_0x6a67('0xa'));_0x291e0c(_0x43da00['result']['message']);}})[_0x6a67('0x12')](function(_0x15482d){logger[_0x6a67('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a34e3,_0x15482d);_0x477e5f(_0x15482d);});});} \ No newline at end of file +var _0x6518=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','util','moment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6518,0x167));var _0x8651=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x6518[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var util=require(_0x8651('0x0'));var moment=require(_0x8651('0x1'));var BPromise=require('bluebird');var rs=require(_0x8651('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8651('0x3'));var logger=require('../../config/logger')(_0x8651('0x4'));var config=require(_0x8651('0x5'));var jayson=require(_0x8651('0x6'));var client=jayson[_0x8651('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38af99,_0x3cfefc,_0x4f26c7){return new BPromise(function(_0x19735b,_0x2d3cc3){return client[_0x8651('0x8')](_0x38af99,_0x4f26c7)[_0x8651('0x9')](function(_0x547ebf){logger[_0x8651('0xa')](_0x8651('0xb'),_0x3cfefc,'request\x20sent');logger[_0x8651('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3cfefc,'request\x20sent',JSON[_0x8651('0xd')](_0x547ebf));if(_0x547ebf[_0x8651('0xe')]){if(_0x547ebf['error']['code']===0x1f4){logger[_0x8651('0xe')](_0x8651('0xb'),_0x3cfefc,_0x547ebf[_0x8651('0xe')][_0x8651('0xf')]);return _0x2d3cc3(_0x547ebf[_0x8651('0xe')]['message']);}logger[_0x8651('0xe')](_0x8651('0xb'),_0x3cfefc,_0x547ebf[_0x8651('0xe')][_0x8651('0xf')]);return _0x19735b(_0x547ebf[_0x8651('0xe')][_0x8651('0xf')]);}else{logger[_0x8651('0xa')](_0x8651('0xb'),_0x3cfefc,_0x8651('0x10'));_0x19735b(_0x547ebf[_0x8651('0x11')][_0x8651('0xf')]);}})[_0x8651('0x12')](function(_0x4bb633){logger[_0x8651('0xe')](_0x8651('0xb'),_0x3cfefc,_0x4bb633);_0x2d3cc3(_0x4bb633);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b25dc78..e688f85 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(_0x3deb78,_0x5b8496){var _0x4d9808=function(_0x4fa8eb){while(--_0x4fa8eb){_0x3deb78['push'](_0x3deb78['shift']());}};_0x4d9808(++_0x5b8496);}(_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('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(_0x1ee94a,_0x4698a6){var _0x2fe821=function(_0x124a21){while(--_0x124a21){_0x1ee94a['push'](_0x1ee94a['shift']());}};_0x2fe821(++_0x4698a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 51f9196..69bf5ae 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 _0x8aa7=['name','TEXT','exports','STRING'];(function(_0x1aa6ec,_0x86d064){var _0x290cac=function(_0x11a327){while(--_0x11a327){_0x1aa6ec['push'](_0x1aa6ec['shift']());}};_0x290cac(++_0x86d064);}(_0x8aa7,0xb6));var _0x78aa=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x8aa7[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require('sequelize');module[_0x78aa('0x0')]={'name':{'type':Sequelize[_0x78aa('0x1')],'allowNull':![],'unique':_0x78aa('0x2')},'table':{'type':Sequelize[_0x78aa('0x1')]},'metric':{'type':Sequelize[_0x78aa('0x3')]},'description':{'type':Sequelize[_0x78aa('0x1')]}}; \ No newline at end of file +var _0x5106=['STRING','TEXT','sequelize'];(function(_0x58f39d,_0x5cb31b){var _0x14291c=function(_0x228a29){while(--_0x228a29){_0x58f39d['push'](_0x58f39d['shift']());}};_0x14291c(++_0x5cb31b);}(_0x5106,0x116));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'name':{'type':Sequelize[_0x6510('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6510('0x1')]},'metric':{'type':Sequelize[_0x6510('0x2')]},'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 deff8b7..1da904e 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 _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0x84ab,0x12f));var _0xb84a=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x84ab[_0x146484];return _0x4c7aa3;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x4cd5dd,_0x244b1b){var _0x4f0fc2=function(_0x2a9d65){while(--_0x2a9d65){_0x4cd5dd['push'](_0x4cd5dd['shift']());}};_0x4f0fc2(++_0x244b1b);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4fad7f0..3308213 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 _0xbc1c=['path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','util','api','bluebird','request-promise'];(function(_0x1b7ba3,_0x13bee7){var _0x1dd4fc=function(_0x4ea262){while(--_0x4ea262){_0x1b7ba3['push'](_0x1b7ba3['shift']());}};_0x1dd4fc(++_0x13bee7);}(_0xbc1c,0xd8));var _0xcbc1=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xbc1c[_0x43f47b];return _0x4af9a6;};'use strict';var _=require('lodash');var util=require(_0xcbc1('0x0'));var logger=require('../../config/logger')(_0xcbc1('0x1'));var moment=require('moment');var BPromise=require(_0xcbc1('0x2'));var rp=require(_0xcbc1('0x3'));var fs=require('fs');var path=require(_0xcbc1('0x4'));var rimraf=require(_0xcbc1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module[_0xcbc1('0x7')]=function(_0x54c13c,_0x27da8d){return _0x54c13c[_0xcbc1('0x8')](_0xcbc1('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d06=['define','AnalyticMetric','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1a1f18,_0x492c30){var _0xd7430a=function(_0x4bdc3d){while(--_0x4bdc3d){_0x1a1f18['push'](_0x1a1f18['shift']());}};_0xd7430a(++_0x492c30);}(_0x2d06,0x157));var _0x62d0=function(_0x4c7fd5,_0x1e0edc){_0x4c7fd5=_0x4c7fd5-0x0;var _0x33fe1b=_0x2d06[_0x4c7fd5];return _0x33fe1b;};'use strict';var _=require('lodash');var util=require(_0x62d0('0x0'));var logger=require(_0x62d0('0x1'))(_0x62d0('0x2'));var moment=require(_0x62d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x62d0('0x4'));var fs=require('fs');var path=require(_0x62d0('0x5'));var rimraf=require(_0x62d0('0x6'));var config=require(_0x62d0('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x62d0('0x8')]=function(_0x1fbc80,_0x4d4907){return _0x1fbc80[_0x62d0('0x9')](_0x62d0('0xa'),attributes,{'tableName':'analytics_metrics','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 9107e28..4a91740 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 _0x28cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','ioredis'];(function(_0x54db1d,_0x3c580){var _0x20b2be=function(_0x14416d){while(--_0x14416d){_0x54db1d['push'](_0x54db1d['shift']());}};_0x20b2be(++_0x3c580);}(_0x28cc,0x1dd));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc28c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc28c('0x1'));var fs=require('fs');var Redis=require(_0xc28c('0x2'));var db=require(_0xc28c('0x3'))['db'];var utils=require(_0xc28c('0x4'));var logger=require(_0xc28c('0x5'))(_0xc28c('0x6'));var config=require(_0xc28c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc28c('0x8')][_0xc28c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a90a2,_0x1fbb5d,_0x26e72d){return new BPromise(function(_0x238956,_0x1b5c5e){return client[_0xc28c('0xa')](_0x3a90a2,_0x26e72d)[_0xc28c('0xb')](function(_0x29e026){logger[_0xc28c('0xc')](_0xc28c('0xd'),_0x1fbb5d,_0xc28c('0xe'));logger['debug'](_0xc28c('0xf'),_0x1fbb5d,'request\x20sent',JSON[_0xc28c('0x10')](_0x29e026));if(_0x29e026[_0xc28c('0x11')]){if(_0x29e026[_0xc28c('0x11')]['code']===0x1f4){logger[_0xc28c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1fbb5d,_0x29e026[_0xc28c('0x11')][_0xc28c('0x12')]);return _0x1b5c5e(_0x29e026[_0xc28c('0x11')][_0xc28c('0x12')]);}logger[_0xc28c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1fbb5d,_0x29e026[_0xc28c('0x11')][_0xc28c('0x12')]);return _0x238956(_0x29e026[_0xc28c('0x11')][_0xc28c('0x12')]);}else{logger[_0xc28c('0xc')](_0xc28c('0xd'),_0x1fbb5d,'request\x20sent');_0x238956(_0x29e026[_0xc28c('0x13')]['message']);}})['catch'](function(_0x532a05){logger[_0xc28c('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1fbb5d,_0x532a05);_0x1b5c5e(_0x532a05);});});} \ No newline at end of file +var _0xa30a=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x42c24f,_0x56b7b9){var _0x284dcb=function(_0x48f122){while(--_0x48f122){_0x42c24f['push'](_0x42c24f['shift']());}};_0x284dcb(++_0x56b7b9);}(_0xa30a,0x9b));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require('util');var moment=require(_0xaa30('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa30('0x3'))['db'];var utils=require(_0xaa30('0x4'));var logger=require('../../config/logger')(_0xaa30('0x5'));var config=require('../../config/environment');var jayson=require(_0xaa30('0x6'));var client=jayson[_0xaa30('0x7')][_0xaa30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b6fd5,_0xee53e1,_0x55483b){return new BPromise(function(_0x517b32,_0x586a2b){return client[_0xaa30('0x9')](_0x5b6fd5,_0x55483b)[_0xaa30('0xa')](function(_0x33feee){logger['info'](_0xaa30('0xb'),_0xee53e1,_0xaa30('0xc'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xee53e1,'request\x20sent',JSON[_0xaa30('0xd')](_0x33feee));if(_0x33feee[_0xaa30('0xe')]){if(_0x33feee[_0xaa30('0xe')][_0xaa30('0xf')]===0x1f4){logger[_0xaa30('0xe')](_0xaa30('0xb'),_0xee53e1,_0x33feee['error']['message']);return _0x586a2b(_0x33feee[_0xaa30('0xe')]['message']);}logger[_0xaa30('0xe')](_0xaa30('0xb'),_0xee53e1,_0x33feee[_0xaa30('0xe')][_0xaa30('0x10')]);return _0x517b32(_0x33feee[_0xaa30('0xe')][_0xaa30('0x10')]);}else{logger['info'](_0xaa30('0xb'),_0xee53e1,_0xaa30('0xc'));_0x517b32(_0x33feee[_0xaa30('0x11')][_0xaa30('0x10')]);}})[_0xaa30('0x12')](function(_0x2b9850){logger[_0xaa30('0xe')](_0xaa30('0xb'),_0xee53e1,_0x2b9850);_0x586a2b(_0x2b9850);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b804ac0..6ad428c 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 _0xcf12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express','Router'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xcf12,0x140));var _0x2cf1=function(_0x439a53,_0x51e060){_0x439a53=_0x439a53-0x0;var _0x2736e8=_0xcf12[_0x439a53];return _0x2736e8;};'use strict';var multer=require('multer');var util=require(_0x2cf1('0x0'));var path=require('path');var timeout=require(_0x2cf1('0x1'));var express=require(_0x2cf1('0x2'));var router=express[_0x2cf1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2cf1('0x4'));var interaction=require(_0x2cf1('0x5'));var config=require(_0x2cf1('0x6'));var controller=require(_0x2cf1('0x7'));router[_0x2cf1('0x8')]('/',auth[_0x2cf1('0x9')](),controller[_0x2cf1('0xa')]);router[_0x2cf1('0x8')](_0x2cf1('0xb'),auth['isAuthenticated'](),controller[_0x2cf1('0xc')]);router[_0x2cf1('0xd')]('/',auth[_0x2cf1('0x9')](),controller[_0x2cf1('0xe')]);router[_0x2cf1('0xf')](_0x2cf1('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2cf1('0xb'),auth['isAuthenticated'](),controller[_0x2cf1('0x10')]);module[_0x2cf1('0x11')]=router; \ No newline at end of file +var _0xaf1b=['isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x2e7025,_0x187270){var _0x5373ed=function(_0x3405f2){while(--_0x3405f2){_0x2e7025['push'](_0x2e7025['shift']());}};_0x5373ed(++_0x187270);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x59da07,_0x4f98a2){_0x59da07=_0x59da07-0x0;var _0x171850=_0xaf1b[_0x59da07];return _0x171850;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var fs_extra=require(_0xbaf1('0x6'));var auth=require(_0xbaf1('0x7'));var interaction=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var controller=require(_0xbaf1('0xa'));router[_0xbaf1('0xb')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0xd')]);router['get'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0xf')]);router['post']('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x10')]);router[_0xbaf1('0x11')]('/:id',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x12')]);router['delete'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0x13')]);module[_0xbaf1('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2c27934..abfc3d2 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 _0x8e8a=['exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e8a,0xa4));var _0xa8e8=function(_0x26b54f,_0x17accb){_0x26b54f=_0x26b54f-0x0;var _0xf10e59=_0x8e8a[_0x26b54f];return _0xf10e59;};'use strict';var Sequelize=require('sequelize');module[_0xa8e8('0x0')]={'tree':{'type':Sequelize[_0xa8e8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4f68=['exports','TEXT'];(function(_0x53dba6,_0x31ad28){var _0x4f7d58=function(_0xf30dcd){while(--_0xf30dcd){_0x53dba6['push'](_0x53dba6['shift']());}};_0x4f7d58(++_0x31ad28);}(_0x4f68,0x98));var _0x84f6=function(_0x1e4870,_0x715634){_0x1e4870=_0x1e4870-0x0;var _0x3ff840=_0x4f68[_0x1e4870];return _0x3ff840;};'use strict';var Sequelize=require('sequelize');module[_0x84f6('0x0')]={'tree':{'type':Sequelize[_0x84f6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 9f123e5..7ef86f4 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 _0x52dc=['reject','save','update','then','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0xfc381d,_0xe2b7c9){var _0x1ef6d7=function(_0x3ef86f){while(--_0x3ef86f){_0xfc381d['push'](_0xfc381d['shift']());}};_0x1ef6d7(++_0xe2b7c9);}(_0x52dc,0x1a2));var _0xc52d=function(_0x6f6940,_0x383a21){_0x6f6940=_0x6f6940-0x0;var _0xd95222=_0x52dc[_0x6f6940];return _0xd95222;};'use strict';var emlformat=require(_0xc52d('0x0'));var rimraf=require(_0xc52d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc52d('0x2'));var rp=require(_0xc52d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc52d('0x4'));var sox=require(_0xc52d('0x5'));var csv=require(_0xc52d('0x6'));var ejs=require(_0xc52d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc52d('0x8'));var squel=require(_0xc52d('0x9'));var crypto=require(_0xc52d('0xa'));var jsforce=require(_0xc52d('0xb'));var deskjs=require(_0xc52d('0xc'));var toCsv=require(_0xc52d('0x6'));var querystring=require(_0xc52d('0xd'));var Papa=require(_0xc52d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc52d('0xf'));var hardwareService=require(_0xc52d('0x10'));var logger=require(_0xc52d('0x11'))(_0xc52d('0x12'));var utils=require(_0xc52d('0x13'));var config=require(_0xc52d('0x14'));var licenseUtil=require(_0xc52d('0x15'));var db=require(_0xc52d('0x16'))['db'];function respondWithStatusCode(_0x2e5701,_0x185ba2){_0x185ba2=_0x185ba2||0xcc;return function(_0x5ee8c2){if(_0x5ee8c2){return _0x2e5701['sendStatus'](_0x185ba2);}return _0x2e5701[_0xc52d('0x17')](_0x185ba2)['end']();};}function respondWithResult(_0x24ff6c,_0x577168){_0x577168=_0x577168||0xc8;return function(_0x125225){if(_0x125225){return _0x24ff6c[_0xc52d('0x17')](_0x577168)[_0xc52d('0x18')](_0x125225);}};}function respondWithFilteredResult(_0x162178,_0x3f2d9e){return function(_0x4fd836){if(_0x4fd836){var _0x5410f7=typeof _0x3f2d9e[_0xc52d('0x19')]===_0xc52d('0x1a')&&typeof _0x3f2d9e[_0xc52d('0x1b')]===_0xc52d('0x1a');var _0x395eeb=_0x4fd836['count'];var _0x53ea84=_0x5410f7?0x0:_0x3f2d9e[_0xc52d('0x19')];var _0x5498bb=_0x5410f7?_0x4fd836[_0xc52d('0x1c')]:_0x3f2d9e['offset']+_0x3f2d9e['limit'];var _0x2db54f;if(_0x5498bb>=_0x395eeb){_0x5498bb=_0x395eeb;_0x2db54f=0xc8;}else{_0x2db54f=0xce;}_0x162178['status'](_0x2db54f);return _0x162178[_0xc52d('0x1d')](_0xc52d('0x1e'),_0x53ea84+'-'+_0x5498bb+'/'+_0x395eeb)[_0xc52d('0x18')](_0x4fd836);}return null;};}function patchUpdates(_0xd50ae6){return function(_0x2a746a){try{jsonpatch[_0xc52d('0x1f')](_0x2a746a,_0xd50ae6,!![]);}catch(_0x2e6076){return BPromise[_0xc52d('0x20')](_0x2e6076);}return _0x2a746a[_0xc52d('0x21')]();};}function saveUpdates(_0x37e9ef,_0x5f425f){return function(_0x2424f4){if(_0x2424f4){return _0x2424f4[_0xc52d('0x22')](_0x37e9ef)[_0xc52d('0x23')](function(_0x45ac6b){return _0x45ac6b;});}return null;};}function removeEntity(_0xf86013,_0x46c588){return function(_0x4318f9){if(_0x4318f9){return _0x4318f9['destroy']()[_0xc52d('0x23')](function(){_0xf86013[_0xc52d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c57f,_0x3ae33a){return function(_0x4801ab){if(!_0x4801ab){_0x37c57f[_0xc52d('0x24')](0x194);}return _0x4801ab;};}function handleError(_0x37da21,_0x31408f){_0x31408f=_0x31408f||0x1f4;return function(_0x5be278){logger[_0xc52d('0x25')](_0x5be278[_0xc52d('0x26')]);if(_0x5be278[_0xc52d('0x27')]){delete _0x5be278[_0xc52d('0x27')];}_0x37da21[_0xc52d('0x17')](_0x31408f)['send'](_0x5be278);};}exports[_0xc52d('0x28')]=function(_0x8be88d,_0x2b0502){var _0x56f108={},_0x5e9b35={},_0x48f600={'count':0x0,'rows':[]};var _0x2a8f49=_[_0xc52d('0x29')](db[_0xc52d('0x2a')][_0xc52d('0x2b')],function(_0x1dd73b){return{'name':_0x1dd73b[_0xc52d('0x2c')],'type':_0x1dd73b['type'][_0xc52d('0x2d')]};});_0x5e9b35[_0xc52d('0x2e')]=_[_0xc52d('0x29')](_0x2a8f49,_0xc52d('0x27'));_0x5e9b35[_0xc52d('0x2f')]=_[_0xc52d('0x30')](_0x8be88d[_0xc52d('0x2f')]);_0x5e9b35['filters']=_[_0xc52d('0x31')](_0x5e9b35[_0xc52d('0x2e')],_0x5e9b35[_0xc52d('0x2f')]);_0x56f108[_0xc52d('0x32')]=_[_0xc52d('0x31')](_0x5e9b35[_0xc52d('0x2e')],qs['fields'](_0x8be88d[_0xc52d('0x2f')][_0xc52d('0x33')]));_0x56f108[_0xc52d('0x32')]=_0x56f108['attributes'][_0xc52d('0x34')]?_0x56f108[_0xc52d('0x32')]:_0x5e9b35[_0xc52d('0x2e')];if(!_0x8be88d[_0xc52d('0x2f')][_0xc52d('0x35')](_0xc52d('0x36'))){_0x56f108[_0xc52d('0x1b')]=qs['limit'](_0x8be88d[_0xc52d('0x2f')][_0xc52d('0x1b')]);_0x56f108['offset']=qs[_0xc52d('0x19')](_0x8be88d[_0xc52d('0x2f')]['offset']);}_0x56f108[_0xc52d('0x37')]=qs['sort'](_0x8be88d[_0xc52d('0x2f')]['sort']);_0x56f108[_0xc52d('0x38')]=qs[_0xc52d('0x39')](_[_0xc52d('0x3a')](_0x8be88d[_0xc52d('0x2f')],_0x5e9b35[_0xc52d('0x39')]),_0x2a8f49);if(_0x8be88d[_0xc52d('0x2f')][_0xc52d('0x3b')]){_0x56f108[_0xc52d('0x38')]=_['merge'](_0x56f108[_0xc52d('0x38')],{'$or':_[_0xc52d('0x29')](_0x2a8f49,function(_0x31ad2e){if(_0x31ad2e[_0xc52d('0x3c')]!==_0xc52d('0x3d')){var _0x4daa00={};_0x4daa00[_0x31ad2e[_0xc52d('0x27')]]={'$like':'%'+_0x8be88d[_0xc52d('0x2f')][_0xc52d('0x3b')]+'%'};return _0x4daa00;}})});}_0x56f108=_[_0xc52d('0x3e')]({},_0x56f108,_0x8be88d[_0xc52d('0x3f')]);var _0x3dcc69={'where':_0x56f108[_0xc52d('0x38')]};return db[_0xc52d('0x2a')][_0xc52d('0x1c')](_0x3dcc69)[_0xc52d('0x23')](function(_0x4e5e31){_0x48f600[_0xc52d('0x1c')]=_0x4e5e31;if(_0x8be88d['query'][_0xc52d('0x40')]){_0x56f108[_0xc52d('0x41')]=[{'all':!![]}];}return db[_0xc52d('0x2a')][_0xc52d('0x42')](_0x56f108);})['then'](function(_0x1feff2){_0x48f600[_0xc52d('0x43')]=_0x1feff2;return _0x48f600;})[_0xc52d('0x23')](respondWithFilteredResult(_0x2b0502,_0x56f108))[_0xc52d('0x44')](handleError(_0x2b0502,null));};exports[_0xc52d('0x45')]=function(_0x15c992,_0x394ae7){var _0x4167b2={'raw':!![],'where':{'id':_0x15c992['params']['id']}},_0xffa91d={};_0xffa91d[_0xc52d('0x2e')]=_[_0xc52d('0x30')](db[_0xc52d('0x2a')][_0xc52d('0x2b')]);_0xffa91d[_0xc52d('0x2f')]=_[_0xc52d('0x30')](_0x15c992[_0xc52d('0x2f')]);_0xffa91d[_0xc52d('0x39')]=_[_0xc52d('0x31')](_0xffa91d[_0xc52d('0x2e')],_0xffa91d[_0xc52d('0x2f')]);_0x4167b2[_0xc52d('0x32')]=_[_0xc52d('0x31')](_0xffa91d[_0xc52d('0x2e')],qs[_0xc52d('0x33')](_0x15c992[_0xc52d('0x2f')][_0xc52d('0x33')]));_0x4167b2[_0xc52d('0x32')]=_0x4167b2[_0xc52d('0x32')][_0xc52d('0x34')]?_0x4167b2[_0xc52d('0x32')]:_0xffa91d['model'];if(_0x15c992[_0xc52d('0x2f')][_0xc52d('0x40')]){_0x4167b2['include']=[{'all':!![]}];}_0x4167b2=_[_0xc52d('0x3e')]({},_0x4167b2,_0x15c992[_0xc52d('0x3f')]);return db['AnalyticTreeReport'][_0xc52d('0x46')](_0x4167b2)[_0xc52d('0x23')](handleEntityNotFound(_0x394ae7,null))['then'](respondWithResult(_0x394ae7,null))[_0xc52d('0x44')](handleError(_0x394ae7,null));};exports['create']=function(_0x3afe95,_0x547bcb){return db['AnalyticTreeReport'][_0xc52d('0x47')](_0x3afe95[_0xc52d('0x48')],{})[_0xc52d('0x23')](respondWithResult(_0x547bcb,0xc9))[_0xc52d('0x44')](handleError(_0x547bcb,null));};exports[_0xc52d('0x22')]=function(_0x589ce3,_0x5b14d4){if(_0x589ce3[_0xc52d('0x48')]['id']){delete _0x589ce3['body']['id'];}return db['AnalyticTreeReport'][_0xc52d('0x46')]({'where':{'id':_0x589ce3[_0xc52d('0x49')]['id']}})[_0xc52d('0x23')](handleEntityNotFound(_0x5b14d4,null))[_0xc52d('0x23')](saveUpdates(_0x589ce3[_0xc52d('0x48')],null))[_0xc52d('0x23')](respondWithResult(_0x5b14d4,null))['catch'](handleError(_0x5b14d4,null));};exports[_0xc52d('0x4a')]=function(_0x267811,_0x54071f){return db[_0xc52d('0x2a')][_0xc52d('0x46')]({'where':{'id':_0x267811['params']['id']}})[_0xc52d('0x23')](handleEntityNotFound(_0x54071f,null))['then'](removeEntity(_0x54071f,null))[_0xc52d('0x44')](handleError(_0x54071f,null));}; \ No newline at end of file +var _0x5022=['../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','set','reject','update','then','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4fcfc7,_0x2c6f6a){var _0x5105e0=function(_0x212fab){while(--_0x212fab){_0x4fcfc7['push'](_0x4fcfc7['shift']());}};_0x5105e0(++_0x2c6f6a);}(_0x5022,0x1e3));var _0x2502=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5022[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2502('0x0'));var rimraf=require(_0x2502('0x1'));var zipdir=require(_0x2502('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2502('0x3'));var moment=require(_0x2502('0x4'));var BPromise=require(_0x2502('0x5'));var Mustache=require(_0x2502('0x6'));var util=require(_0x2502('0x7'));var path=require(_0x2502('0x8'));var sox=require(_0x2502('0x9'));var csv=require(_0x2502('0xa'));var ejs=require(_0x2502('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2502('0xc'));var squel=require(_0x2502('0xd'));var crypto=require(_0x2502('0xe'));var jsforce=require(_0x2502('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2502('0xa'));var querystring=require('querystring');var Papa=require(_0x2502('0x10'));var Redis=require(_0x2502('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2502('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2502('0x13'))(_0x2502('0x14'));var utils=require(_0x2502('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2502('0x16'))['db'];function respondWithStatusCode(_0x3c7354,_0x9a3238){_0x9a3238=_0x9a3238||0xcc;return function(_0x5d439e){if(_0x5d439e){return _0x3c7354['sendStatus'](_0x9a3238);}return _0x3c7354[_0x2502('0x17')](_0x9a3238)['end']();};}function respondWithResult(_0x1e821d,_0x2986bb){_0x2986bb=_0x2986bb||0xc8;return function(_0x1faa93){if(_0x1faa93){return _0x1e821d['status'](_0x2986bb)[_0x2502('0x18')](_0x1faa93);}};}function respondWithFilteredResult(_0x142f58,_0x40b62b){return function(_0x450d79){if(_0x450d79){var _0x229a55=typeof _0x40b62b['offset']===_0x2502('0x19')&&typeof _0x40b62b[_0x2502('0x1a')]==='undefined';var _0x23e205=_0x450d79[_0x2502('0x1b')];var _0x1307d8=_0x229a55?0x0:_0x40b62b[_0x2502('0x1c')];var _0x44bc2f=_0x229a55?_0x450d79[_0x2502('0x1b')]:_0x40b62b[_0x2502('0x1c')]+_0x40b62b['limit'];var _0x45eb6f;if(_0x44bc2f>=_0x23e205){_0x44bc2f=_0x23e205;_0x45eb6f=0xc8;}else{_0x45eb6f=0xce;}_0x142f58[_0x2502('0x17')](_0x45eb6f);return _0x142f58[_0x2502('0x1d')]('Content-Range',_0x1307d8+'-'+_0x44bc2f+'/'+_0x23e205)[_0x2502('0x18')](_0x450d79);}return null;};}function patchUpdates(_0x2f4a6e){return function(_0x48ec64){try{jsonpatch['apply'](_0x48ec64,_0x2f4a6e,!![]);}catch(_0x42bd11){return BPromise[_0x2502('0x1e')](_0x42bd11);}return _0x48ec64['save']();};}function saveUpdates(_0x59c40d,_0x215aa5){return function(_0x14bc65){if(_0x14bc65){return _0x14bc65[_0x2502('0x1f')](_0x59c40d)[_0x2502('0x20')](function(_0x4e0ec1){return _0x4e0ec1;});}return null;};}function removeEntity(_0x591e19,_0x55115a){return function(_0x1aec49){if(_0x1aec49){return _0x1aec49[_0x2502('0x21')]()['then'](function(){_0x591e19[_0x2502('0x17')](0xcc)[_0x2502('0x22')]();});}};}function handleEntityNotFound(_0x1fe8e4,_0x4c3148){return function(_0x4abd9a){if(!_0x4abd9a){_0x1fe8e4['sendStatus'](0x194);}return _0x4abd9a;};}function handleError(_0x4acd07,_0x149fcf){_0x149fcf=_0x149fcf||0x1f4;return function(_0x2c03be){logger[_0x2502('0x23')](_0x2c03be[_0x2502('0x24')]);if(_0x2c03be[_0x2502('0x25')]){delete _0x2c03be['name'];}_0x4acd07[_0x2502('0x17')](_0x149fcf)[_0x2502('0x26')](_0x2c03be);};}exports[_0x2502('0x27')]=function(_0x35939d,_0x34151d){var _0x2dd5b4={},_0x51376d={},_0x3d2766={'count':0x0,'rows':[]};var _0x14407e=_[_0x2502('0x28')](db[_0x2502('0x29')]['rawAttributes'],function(_0x2beb7d){return{'name':_0x2beb7d[_0x2502('0x2a')],'type':_0x2beb7d[_0x2502('0x2b')]['key']};});_0x51376d['model']=_[_0x2502('0x28')](_0x14407e,_0x2502('0x25'));_0x51376d[_0x2502('0x2c')]=_[_0x2502('0x2d')](_0x35939d[_0x2502('0x2c')]);_0x51376d[_0x2502('0x2e')]=_[_0x2502('0x2f')](_0x51376d[_0x2502('0x30')],_0x51376d[_0x2502('0x2c')]);_0x2dd5b4['attributes']=_['intersection'](_0x51376d['model'],qs[_0x2502('0x31')](_0x35939d[_0x2502('0x2c')]['fields']));_0x2dd5b4[_0x2502('0x32')]=_0x2dd5b4[_0x2502('0x32')]['length']?_0x2dd5b4['attributes']:_0x51376d['model'];if(!_0x35939d[_0x2502('0x2c')][_0x2502('0x33')](_0x2502('0x34'))){_0x2dd5b4['limit']=qs[_0x2502('0x1a')](_0x35939d[_0x2502('0x2c')]['limit']);_0x2dd5b4[_0x2502('0x1c')]=qs[_0x2502('0x1c')](_0x35939d['query'][_0x2502('0x1c')]);}_0x2dd5b4[_0x2502('0x35')]=qs[_0x2502('0x36')](_0x35939d[_0x2502('0x2c')]['sort']);_0x2dd5b4[_0x2502('0x37')]=qs[_0x2502('0x2e')](_[_0x2502('0x38')](_0x35939d[_0x2502('0x2c')],_0x51376d[_0x2502('0x2e')]),_0x14407e);if(_0x35939d['query'][_0x2502('0x39')]){_0x2dd5b4['where']=_[_0x2502('0x3a')](_0x2dd5b4[_0x2502('0x37')],{'$or':_[_0x2502('0x28')](_0x14407e,function(_0x223647){if(_0x223647[_0x2502('0x2b')]!==_0x2502('0x3b')){var _0x125e07={};_0x125e07[_0x223647[_0x2502('0x25')]]={'$like':'%'+_0x35939d[_0x2502('0x2c')][_0x2502('0x39')]+'%'};return _0x125e07;}})});}_0x2dd5b4=_[_0x2502('0x3a')]({},_0x2dd5b4,_0x35939d['options']);var _0x8e1bd5={'where':_0x2dd5b4[_0x2502('0x37')]};return db['AnalyticTreeReport'][_0x2502('0x1b')](_0x8e1bd5)[_0x2502('0x20')](function(_0x320579){_0x3d2766[_0x2502('0x1b')]=_0x320579;if(_0x35939d[_0x2502('0x2c')]['includeAll']){_0x2dd5b4[_0x2502('0x3c')]=[{'all':!![]}];}return db[_0x2502('0x29')][_0x2502('0x3d')](_0x2dd5b4);})[_0x2502('0x20')](function(_0xce6d52){_0x3d2766['rows']=_0xce6d52;return _0x3d2766;})[_0x2502('0x20')](respondWithFilteredResult(_0x34151d,_0x2dd5b4))[_0x2502('0x3e')](handleError(_0x34151d,null));};exports[_0x2502('0x3f')]=function(_0x2f5e78,_0x5c6273){var _0x2cf7ae={'raw':!![],'where':{'id':_0x2f5e78[_0x2502('0x40')]['id']}},_0x5584de={};_0x5584de['model']=_[_0x2502('0x2d')](db['AnalyticTreeReport'][_0x2502('0x41')]);_0x5584de[_0x2502('0x2c')]=_[_0x2502('0x2d')](_0x2f5e78['query']);_0x5584de['filters']=_[_0x2502('0x2f')](_0x5584de[_0x2502('0x30')],_0x5584de[_0x2502('0x2c')]);_0x2cf7ae[_0x2502('0x32')]=_[_0x2502('0x2f')](_0x5584de['model'],qs[_0x2502('0x31')](_0x2f5e78[_0x2502('0x2c')][_0x2502('0x31')]));_0x2cf7ae[_0x2502('0x32')]=_0x2cf7ae[_0x2502('0x32')][_0x2502('0x42')]?_0x2cf7ae[_0x2502('0x32')]:_0x5584de['model'];if(_0x2f5e78['query'][_0x2502('0x43')]){_0x2cf7ae['include']=[{'all':!![]}];}_0x2cf7ae=_[_0x2502('0x3a')]({},_0x2cf7ae,_0x2f5e78[_0x2502('0x44')]);return db['AnalyticTreeReport'][_0x2502('0x45')](_0x2cf7ae)[_0x2502('0x20')](handleEntityNotFound(_0x5c6273,null))['then'](respondWithResult(_0x5c6273,null))[_0x2502('0x3e')](handleError(_0x5c6273,null));};exports[_0x2502('0x46')]=function(_0x127af1,_0x5bdcd8){return db[_0x2502('0x29')][_0x2502('0x46')](_0x127af1[_0x2502('0x47')],{})[_0x2502('0x20')](respondWithResult(_0x5bdcd8,0xc9))['catch'](handleError(_0x5bdcd8,null));};exports[_0x2502('0x1f')]=function(_0x36afb1,_0xbb280b){if(_0x36afb1[_0x2502('0x47')]['id']){delete _0x36afb1[_0x2502('0x47')]['id'];}return db['AnalyticTreeReport'][_0x2502('0x45')]({'where':{'id':_0x36afb1[_0x2502('0x40')]['id']}})[_0x2502('0x20')](handleEntityNotFound(_0xbb280b,null))['then'](saveUpdates(_0x36afb1[_0x2502('0x47')],null))['then'](respondWithResult(_0xbb280b,null))[_0x2502('0x3e')](handleError(_0xbb280b,null));};exports[_0x2502('0x21')]=function(_0x157c96,_0x875ce8){return db['AnalyticTreeReport'][_0x2502('0x45')]({'where':{'id':_0x157c96[_0x2502('0x40')]['id']}})[_0x2502('0x20')](handleEntityNotFound(_0x875ce8,null))['then'](removeEntity(_0x875ce8,null))[_0x2502('0x3e')](handleError(_0x875ce8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f63be7c..2a1f894 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 _0x4220=['rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3379ff,_0x3ac3ed){var _0x3f03c1=function(_0x3ddcb4){while(--_0x3ddcb4){_0x3379ff['push'](_0x3379ff['shift']());}};_0x3f03c1(++_0x3ac3ed);}(_0x4220,0xe1));var _0x0422=function(_0x112a78,_0x405e61){_0x112a78=_0x112a78-0x0;var _0x47e2c1=_0x4220[_0x112a78];return _0x47e2c1;};'use strict';var _=require(_0x0422('0x0'));var util=require(_0x0422('0x1'));var logger=require(_0x0422('0x2'))(_0x0422('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0422('0x4'));var fs=require('fs');var path=require(_0x0422('0x5'));var rimraf=require(_0x0422('0x6'));var config=require('../../config/environment');var attributes=require(_0x0422('0x7'));module[_0x0422('0x8')]=function(_0x102aac,_0x5c5a95){return _0x102aac[_0x0422('0x9')](_0x0422('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbf6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xcbf6,0x14d));var _0x6cbf=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0xcbf6[_0x1de641];return _0xccacbc;};'use strict';var _=require(_0x6cbf('0x0'));var util=require(_0x6cbf('0x1'));var logger=require(_0x6cbf('0x2'))(_0x6cbf('0x3'));var moment=require(_0x6cbf('0x4'));var BPromise=require(_0x6cbf('0x5'));var rp=require(_0x6cbf('0x6'));var fs=require('fs');var path=require(_0x6cbf('0x7'));var rimraf=require(_0x6cbf('0x8'));var config=require(_0x6cbf('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0x6cbf('0xa')]=function(_0x47fbdb,_0x47ff59){return _0x47fbdb['define'](_0x6cbf('0xb'),attributes,{'tableName':_0x6cbf('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 27dfb44..7b1cae7 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x14c1fc,_0x3ca8ae){var _0x46813a=function(_0x1e2ff6){while(--_0x1e2ff6){_0x14c1fc['push'](_0x14c1fc['shift']());}};_0x46813a(++_0x3ca8ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x622d7d,_0x55d16c){_0x622d7d=_0x622d7d-0x0;var _0x393802=_0x5f2f[_0x622d7d];return _0x393802;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x523a0e,_0x12c395){var _0x333a3d=function(_0x92f627){while(--_0x92f627){_0x523a0e['push'](_0x523a0e['shift']());}};_0x333a3d(++_0x12c395);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c7d41,_0x86fba1){_0x3c7d41=_0x3c7d41-0x0;var _0x58833f=_0x5f2f[_0x3c7d41];return _0x58833f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 321d6e2..961fb83 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 _0x8545=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x49f946,_0x3f14c3){var _0x478515=function(_0x66caa7){while(--_0x66caa7){_0x49f946['push'](_0x49f946['shift']());}};_0x478515(++_0x3f14c3);}(_0x8545,0x16c));var _0x5854=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8545[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x5854('0x0'));var util=require(_0x5854('0x1'));var path=require(_0x5854('0x2'));var timeout=require(_0x5854('0x3'));var express=require(_0x5854('0x4'));var router=express['Router']();var fs_extra=require(_0x5854('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5854('0x6'));var config=require(_0x5854('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x5854('0x8')]('/',auth[_0x5854('0x9')](),controller['index']);router[_0x5854('0x8')](_0x5854('0xa'),auth[_0x5854('0x9')](),controller[_0x5854('0xb')]);router[_0x5854('0xc')]('/',auth[_0x5854('0x9')](),controller[_0x5854('0xd')]);router[_0x5854('0xe')](_0x5854('0xa'),auth['isAuthenticated'](),controller[_0x5854('0xf')]);router[_0x5854('0x10')]('/:id',auth[_0x5854('0x9')](),controller['destroy']);module[_0x5854('0x11')]=router; \ No newline at end of file +var _0x8f88=['delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f88,0x145));var _0x88f8=function(_0x549629,_0x20da71){_0x549629=_0x549629-0x0;var _0x138ae9=_0x8f88[_0x549629];return _0x138ae9;};'use strict';var multer=require(_0x88f8('0x0'));var util=require(_0x88f8('0x1'));var path=require(_0x88f8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x88f8('0x3')]();var fs_extra=require(_0x88f8('0x4'));var auth=require(_0x88f8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x88f8('0x6'));router[_0x88f8('0x7')]('/',auth[_0x88f8('0x8')](),controller[_0x88f8('0x9')]);router[_0x88f8('0x7')](_0x88f8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x88f8('0xb')]('/',auth[_0x88f8('0x8')](),controller[_0x88f8('0xc')]);router[_0x88f8('0xd')]('/:id',auth[_0x88f8('0x8')](),controller[_0x88f8('0xe')]);router[_0x88f8('0xf')](_0x88f8('0xa'),auth[_0x88f8('0x8')](),controller[_0x88f8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b4b5fb3..8260396 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 _0xdb4b=['STRING','exports'];(function(_0x1dc78e,_0x3eb207){var _0x26b975=function(_0x381558){while(--_0x381558){_0x1dc78e['push'](_0x1dc78e['shift']());}};_0x26b975(++_0x3eb207);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x39eb48,_0x5da47c){_0x39eb48=_0x39eb48-0x0;var _0x10f0b9=_0xdb4b[_0x39eb48];return _0x10f0b9;};'use strict';var Sequelize=require('sequelize');module[_0xbdb4('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xbdb4('0x1')]},'type':{'type':Sequelize[_0xbdb4('0x1')]}}; \ No newline at end of file +var _0x34f8=['exports','STRING','sequelize'];(function(_0x33c07a,_0x52b507){var _0x3e558e=function(_0x565468){while(--_0x565468){_0x33c07a['push'](_0x33c07a['shift']());}};_0x3e558e(++_0x52b507);}(_0x34f8,0x80));var _0x834f=function(_0x3aa257,_0x3cf615){_0x3aa257=_0x3aa257-0x0;var _0x5c1349=_0x34f8[_0x3aa257];return _0x5c1349;};'use strict';var Sequelize=require(_0x834f('0x0'));module[_0x834f('0x1')]={'name':{'type':Sequelize[_0x834f('0x2')]},'basename':{'type':Sequelize[_0x834f('0x2')]},'type':{'type':Sequelize[_0x834f('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 06fd552..e1a86ee 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 _0xbd7e=['../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','send','index','map','Attachment','fieldName','type','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','find','catch','clone','include','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','server/files/attachments/','join','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x7880d2,_0x32e7d6){var _0x35ebbe=function(_0x5c27fa){while(--_0x5c27fa){_0x7880d2['push'](_0x7880d2['shift']());}};_0x35ebbe(++_0x32e7d6);}(_0xbd7e,0x9c));var _0xebd7=function(_0x274e0e,_0x2e7080){_0x274e0e=_0x274e0e-0x0;var _0x4c370f=_0xbd7e[_0x274e0e];return _0x4c370f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xebd7('0x0'));var rp=require(_0xebd7('0x1'));var moment=require('moment');var BPromise=require(_0xebd7('0x2'));var Mustache=require(_0xebd7('0x3'));var util=require(_0xebd7('0x4'));var path=require(_0xebd7('0x5'));var sox=require(_0xebd7('0x6'));var csv=require('to-csv');var ejs=require(_0xebd7('0x7'));var fs=require('fs');var fs_extra=require(_0xebd7('0x8'));var _=require(_0xebd7('0x9'));var squel=require(_0xebd7('0xa'));var crypto=require(_0xebd7('0xb'));var jsforce=require(_0xebd7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xebd7('0xd'));var querystring=require(_0xebd7('0xe'));var Papa=require(_0xebd7('0xf'));var Redis=require('ioredis');var authService=require(_0xebd7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xebd7('0x11'));var hardwareService=require(_0xebd7('0x12'));var logger=require(_0xebd7('0x13'))(_0xebd7('0x14'));var utils=require(_0xebd7('0x15'));var config=require(_0xebd7('0x16'));var licenseUtil=require(_0xebd7('0x17'));var db=require(_0xebd7('0x18'))['db'];function respondWithStatusCode(_0x97f30e,_0x23db51){_0x23db51=_0x23db51||0xcc;return function(_0x3a6535){if(_0x3a6535){return _0x97f30e[_0xebd7('0x19')](_0x23db51);}return _0x97f30e['status'](_0x23db51)[_0xebd7('0x1a')]();};}function respondWithResult(_0x77cd1c,_0x543ff8){_0x543ff8=_0x543ff8||0xc8;return function(_0x442bcc){if(_0x442bcc){return _0x77cd1c[_0xebd7('0x1b')](_0x543ff8)[_0xebd7('0x1c')](_0x442bcc);}};}function respondWithFilteredResult(_0x10da90,_0x15164e){return function(_0x1f6dc9){if(_0x1f6dc9){var _0x16338a=typeof _0x15164e[_0xebd7('0x1d')]===_0xebd7('0x1e')&&typeof _0x15164e[_0xebd7('0x1f')]===_0xebd7('0x1e');var _0x3bd3f0=_0x1f6dc9[_0xebd7('0x20')];var _0x378cf9=_0x16338a?0x0:_0x15164e[_0xebd7('0x1d')];var _0x5d2e2f=_0x16338a?_0x1f6dc9[_0xebd7('0x20')]:_0x15164e[_0xebd7('0x1d')]+_0x15164e['limit'];var _0x4a2c79;if(_0x5d2e2f>=_0x3bd3f0){_0x5d2e2f=_0x3bd3f0;_0x4a2c79=0xc8;}else{_0x4a2c79=0xce;}_0x10da90['status'](_0x4a2c79);return _0x10da90[_0xebd7('0x21')]('Content-Range',_0x378cf9+'-'+_0x5d2e2f+'/'+_0x3bd3f0)['json'](_0x1f6dc9);}return null;};}function patchUpdates(_0x1b4352){return function(_0x227de0){try{jsonpatch[_0xebd7('0x22')](_0x227de0,_0x1b4352,!![]);}catch(_0x146f60){return BPromise['reject'](_0x146f60);}return _0x227de0[_0xebd7('0x23')]();};}function saveUpdates(_0x1bde93,_0x279c67){return function(_0x16f44c){if(_0x16f44c){return _0x16f44c[_0xebd7('0x24')](_0x1bde93)[_0xebd7('0x25')](function(_0x201538){return _0x201538;});}return null;};}function removeEntity(_0x4a29e8,_0x6053fa){return function(_0x3fccd8){if(_0x3fccd8){return _0x3fccd8[_0xebd7('0x26')]()[_0xebd7('0x25')](function(){_0x4a29e8[_0xebd7('0x1b')](0xcc)[_0xebd7('0x1a')]();});}};}function handleEntityNotFound(_0x153413,_0x3121b5){return function(_0x46a41c){if(!_0x46a41c){_0x153413[_0xebd7('0x19')](0x194);}return _0x46a41c;};}function handleError(_0x68d6f,_0x16d79c){_0x16d79c=_0x16d79c||0x1f4;return function(_0x302b47){logger['error'](_0x302b47[_0xebd7('0x27')]);if(_0x302b47['name']){delete _0x302b47['name'];}_0x68d6f[_0xebd7('0x1b')](_0x16d79c)[_0xebd7('0x28')](_0x302b47);};}exports[_0xebd7('0x29')]=function(_0x27f3e8,_0x23a089){var _0x2df508={},_0x1b95a1={},_0xa20584={'count':0x0,'rows':[]};var _0x35868f=_[_0xebd7('0x2a')](db[_0xebd7('0x2b')]['rawAttributes'],function(_0x32393c){return{'name':_0x32393c[_0xebd7('0x2c')],'type':_0x32393c[_0xebd7('0x2d')][_0xebd7('0x2e')]};});_0x1b95a1[_0xebd7('0x2f')]=_[_0xebd7('0x2a')](_0x35868f,_0xebd7('0x30'));_0x1b95a1[_0xebd7('0x31')]=_[_0xebd7('0x32')](_0x27f3e8[_0xebd7('0x31')]);_0x1b95a1['filters']=_['intersection'](_0x1b95a1[_0xebd7('0x2f')],_0x1b95a1[_0xebd7('0x31')]);_0x2df508[_0xebd7('0x33')]=_['intersection'](_0x1b95a1[_0xebd7('0x2f')],qs[_0xebd7('0x34')](_0x27f3e8['query'][_0xebd7('0x34')]));_0x2df508[_0xebd7('0x33')]=_0x2df508['attributes'][_0xebd7('0x35')]?_0x2df508['attributes']:_0x1b95a1[_0xebd7('0x2f')];if(!_0x27f3e8[_0xebd7('0x31')][_0xebd7('0x36')](_0xebd7('0x37'))){_0x2df508['limit']=qs[_0xebd7('0x1f')](_0x27f3e8[_0xebd7('0x31')][_0xebd7('0x1f')]);_0x2df508[_0xebd7('0x1d')]=qs['offset'](_0x27f3e8[_0xebd7('0x31')]['offset']);}_0x2df508[_0xebd7('0x38')]=qs['sort'](_0x27f3e8['query'][_0xebd7('0x39')]);_0x2df508[_0xebd7('0x3a')]=qs[_0xebd7('0x3b')](_[_0xebd7('0x3c')](_0x27f3e8[_0xebd7('0x31')],_0x1b95a1[_0xebd7('0x3b')]),_0x35868f);if(_0x27f3e8[_0xebd7('0x31')][_0xebd7('0x3d')]){_0x2df508[_0xebd7('0x3a')]=_[_0xebd7('0x3e')](_0x2df508[_0xebd7('0x3a')],{'$or':_[_0xebd7('0x2a')](_0x35868f,function(_0x244e52){if(_0x244e52['type']!==_0xebd7('0x3f')){var _0x27a65b={};_0x27a65b[_0x244e52[_0xebd7('0x30')]]={'$like':'%'+_0x27f3e8[_0xebd7('0x31')][_0xebd7('0x3d')]+'%'};return _0x27a65b;}})});}_0x2df508=_[_0xebd7('0x3e')]({},_0x2df508,_0x27f3e8[_0xebd7('0x40')]);var _0x228cc9={'where':_0x2df508['where']};return db[_0xebd7('0x2b')][_0xebd7('0x20')](_0x228cc9)[_0xebd7('0x25')](function(_0x315439){_0xa20584[_0xebd7('0x20')]=_0x315439;if(_0x27f3e8[_0xebd7('0x31')][_0xebd7('0x41')]){_0x2df508['include']=[{'all':!![]}];}return db[_0xebd7('0x2b')][_0xebd7('0x42')](_0x2df508);})['then'](function(_0xd7a5bd){_0xa20584[_0xebd7('0x43')]=_0xd7a5bd;return _0xa20584;})['then'](respondWithFilteredResult(_0x23a089,_0x2df508))['catch'](handleError(_0x23a089,null));};exports[_0xebd7('0x44')]=function(_0x5297b1,_0x1cb26b){var _0x28bf70={'raw':!![],'where':{'id':_0x5297b1[_0xebd7('0x45')]['id']}},_0x41f08a={};_0x41f08a['model']=_[_0xebd7('0x32')](db[_0xebd7('0x2b')][_0xebd7('0x46')]);_0x41f08a[_0xebd7('0x31')]=_['keys'](_0x5297b1['query']);_0x41f08a[_0xebd7('0x3b')]=_['intersection'](_0x41f08a[_0xebd7('0x2f')],_0x41f08a[_0xebd7('0x31')]);_0x28bf70[_0xebd7('0x33')]=_[_0xebd7('0x47')](_0x41f08a[_0xebd7('0x2f')],qs[_0xebd7('0x34')](_0x5297b1[_0xebd7('0x31')][_0xebd7('0x34')]));_0x28bf70['attributes']=_0x28bf70[_0xebd7('0x33')][_0xebd7('0x35')]?_0x28bf70[_0xebd7('0x33')]:_0x41f08a['model'];if(_0x5297b1['query'][_0xebd7('0x41')]){_0x28bf70['include']=[{'all':!![]}];}_0x28bf70=_[_0xebd7('0x3e')]({},_0x28bf70,_0x5297b1[_0xebd7('0x40')]);return db['Attachment'][_0xebd7('0x48')](_0x28bf70)[_0xebd7('0x25')](handleEntityNotFound(_0x1cb26b,null))['then'](respondWithResult(_0x1cb26b,null))[_0xebd7('0x49')](handleError(_0x1cb26b,null));};exports[_0xebd7('0x4a')]=function(_0x26a8f6,_0x30e572){var _0x44feec={'where':{'id':_0x26a8f6[_0xebd7('0x45')]['id']}},_0x554a4c={};_0x554a4c[_0xebd7('0x2f')]=_[_0xebd7('0x32')](db[_0xebd7('0x2b')][_0xebd7('0x46')]);_0x44feec[_0xebd7('0x33')]=_[_0xebd7('0x47')](_0x554a4c[_0xebd7('0x2f')],qs[_0xebd7('0x34')](_0x26a8f6['query'][_0xebd7('0x34')]));_0x44feec['attributes']=_0x44feec[_0xebd7('0x33')][_0xebd7('0x35')]?_0x44feec[_0xebd7('0x33')]:_0x554a4c[_0xebd7('0x2f')];if(_0x26a8f6[_0xebd7('0x31')]['includeAll']){_0x44feec[_0xebd7('0x4b')]=[{'all':!![]}];}_0x44feec=_[_0xebd7('0x3e')]({},_0x44feec,_0x26a8f6[_0xebd7('0x40')]);return db[_0xebd7('0x2b')][_0xebd7('0x48')](_0x44feec)[_0xebd7('0x25')](handleEntityNotFound(_0x30e572,null))['then'](function(_0x8da138){if(_0x8da138){var _0x74a1c2=_0x8da138['get']({'plain':!![]});_0x74a1c2=qs[_0xebd7('0x4c')](_0x74a1c2,['id',_0xebd7('0x4d'),_0xebd7('0x4e')]);_0x26a8f6[_0xebd7('0x4f')]=_['omit'](_0x26a8f6[_0xebd7('0x4f')],['id',_0xebd7('0x4d'),_0xebd7('0x4e')]);return db['Attachment'][_0xebd7('0x50')](_[_0xebd7('0x3e')](_0x74a1c2,_0x26a8f6[_0xebd7('0x4f')]),{'include':_0x26a8f6[_0xebd7('0x31')][_0xebd7('0x41')]?[{'all':!![]}]:undefined});}})[_0xebd7('0x25')](respondWithResult(_0x30e572,0xc9))['catch'](handleError(_0x30e572,null));};exports[_0xebd7('0x24')]=function(_0x716da5,_0x492a30){if(_0x716da5[_0xebd7('0x4f')]['id']){delete _0x716da5[_0xebd7('0x4f')]['id'];}return db[_0xebd7('0x2b')][_0xebd7('0x48')]({'where':{'id':_0x716da5[_0xebd7('0x45')]['id']}})['then'](handleEntityNotFound(_0x492a30,null))[_0xebd7('0x25')](saveUpdates(_0x716da5[_0xebd7('0x4f')],null))[_0xebd7('0x25')](respondWithResult(_0x492a30,null))[_0xebd7('0x49')](handleError(_0x492a30,null));};exports[_0xebd7('0x26')]=function(_0x58e0ef,_0x2448e9){return db['Attachment']['find']({'where':{'id':_0x58e0ef[_0xebd7('0x45')]['id']}})[_0xebd7('0x25')](handleEntityNotFound(_0x2448e9,null))['then'](removeEntity(_0x2448e9,null))[_0xebd7('0x49')](handleError(_0x2448e9,null));};exports[_0xebd7('0x50')]=function(_0x2dbca9,_0x5b9fd0,_0x2fb254){_0x2dbca9['body'][_0xebd7('0x30')]=_0x2dbca9[_0xebd7('0x51')][_0xebd7('0x52')];_0x2dbca9[_0xebd7('0x4f')][_0xebd7('0x53')]=_0x2dbca9['file'][_0xebd7('0x54')];_0x2dbca9[_0xebd7('0x4f')]['type']=_0x2dbca9[_0xebd7('0x51')][_0xebd7('0x55')];return db[_0xebd7('0x2b')][_0xebd7('0x50')](_0x2dbca9[_0xebd7('0x4f')])[_0xebd7('0x25')](respondWithResult(_0x5b9fd0,0xc9))['catch'](handleError(_0x5b9fd0,null));};exports[_0xebd7('0x56')]=function(_0xd84d17,_0x14c24f,_0x40822b){return db['Attachment']['findOne']({'where':{'id':_0xd84d17[_0xebd7('0x45')]['id']},'raw':!![]})[_0xebd7('0x25')](handleEntityNotFound(_0x14c24f,null))['then'](function(_0x84079a){if(_0x84079a){var _0x3cc947=_0x84079a[_0xebd7('0x57')]!==null;var _0x5ea7b3=path['join'](config['root'],_0xebd7('0x58'));if(_0x3cc947){_0x5ea7b3=path[_0xebd7('0x59')](_0x5ea7b3,'offline-chat/');}var _0x555274=path['join'](_0x5ea7b3,_0x84079a[_0xebd7('0x53')]);return _0x14c24f['download'](_0x555274);}})[_0xebd7('0x49')](handleError(_0x14c24f,null));}; \ No newline at end of file +var _0xd2ab=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','catch','clone','get','updatedAt','body','omit','createdAt','create','originalname','basename','file','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x7c823b,_0x52e363){var _0x1bba04=function(_0x22d3e4){while(--_0x22d3e4){_0x7c823b['push'](_0x7c823b['shift']());}};_0x1bba04(++_0x52e363);}(_0xd2ab,0xf4));var _0xbd2a=function(_0x3273ca,_0x187f07){_0x3273ca=_0x3273ca-0x0;var _0x1b33f2=_0xd2ab[_0x3273ca];return _0x1b33f2;};'use strict';var emlformat=require(_0xbd2a('0x0'));var rimraf=require(_0xbd2a('0x1'));var zipdir=require(_0xbd2a('0x2'));var jsonpatch=require(_0xbd2a('0x3'));var rp=require(_0xbd2a('0x4'));var moment=require(_0xbd2a('0x5'));var BPromise=require(_0xbd2a('0x6'));var Mustache=require('mustache');var util=require(_0xbd2a('0x7'));var path=require(_0xbd2a('0x8'));var sox=require('sox');var csv=require(_0xbd2a('0x9'));var ejs=require(_0xbd2a('0xa'));var fs=require('fs');var fs_extra=require(_0xbd2a('0xb'));var _=require('lodash');var squel=require(_0xbd2a('0xc'));var crypto=require(_0xbd2a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd2a('0x9'));var querystring=require('querystring');var Papa=require(_0xbd2a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd2a('0xf'));var as=require(_0xbd2a('0x10'));var hardwareService=require(_0xbd2a('0x11'));var logger=require('../../config/logger')(_0xbd2a('0x12'));var utils=require(_0xbd2a('0x13'));var config=require(_0xbd2a('0x14'));var licenseUtil=require(_0xbd2a('0x15'));var db=require(_0xbd2a('0x16'))['db'];function respondWithStatusCode(_0x319398,_0x25be76){_0x25be76=_0x25be76||0xcc;return function(_0x57f09d){if(_0x57f09d){return _0x319398[_0xbd2a('0x17')](_0x25be76);}return _0x319398[_0xbd2a('0x18')](_0x25be76)[_0xbd2a('0x19')]();};}function respondWithResult(_0x50b393,_0x132d26){_0x132d26=_0x132d26||0xc8;return function(_0x12fc2e){if(_0x12fc2e){return _0x50b393['status'](_0x132d26)[_0xbd2a('0x1a')](_0x12fc2e);}};}function respondWithFilteredResult(_0x436891,_0x388abf){return function(_0x2d22d6){if(_0x2d22d6){var _0x223e49=typeof _0x388abf['offset']===_0xbd2a('0x1b')&&typeof _0x388abf[_0xbd2a('0x1c')]==='undefined';var _0x39c3f2=_0x2d22d6[_0xbd2a('0x1d')];var _0x5ba394=_0x223e49?0x0:_0x388abf[_0xbd2a('0x1e')];var _0x4552fc=_0x223e49?_0x2d22d6[_0xbd2a('0x1d')]:_0x388abf[_0xbd2a('0x1e')]+_0x388abf[_0xbd2a('0x1c')];var _0x4aeedf;if(_0x4552fc>=_0x39c3f2){_0x4552fc=_0x39c3f2;_0x4aeedf=0xc8;}else{_0x4aeedf=0xce;}_0x436891[_0xbd2a('0x18')](_0x4aeedf);return _0x436891[_0xbd2a('0x1f')](_0xbd2a('0x20'),_0x5ba394+'-'+_0x4552fc+'/'+_0x39c3f2)[_0xbd2a('0x1a')](_0x2d22d6);}return null;};}function patchUpdates(_0x4973a3){return function(_0x5b7e45){try{jsonpatch[_0xbd2a('0x21')](_0x5b7e45,_0x4973a3,!![]);}catch(_0x1cd0c8){return BPromise[_0xbd2a('0x22')](_0x1cd0c8);}return _0x5b7e45[_0xbd2a('0x23')]();};}function saveUpdates(_0x18440d,_0x44f9ba){return function(_0x1a7948){if(_0x1a7948){return _0x1a7948[_0xbd2a('0x24')](_0x18440d)[_0xbd2a('0x25')](function(_0x43be28){return _0x43be28;});}return null;};}function removeEntity(_0x58f99f,_0x5b2e6f){return function(_0x6bb56a){if(_0x6bb56a){return _0x6bb56a[_0xbd2a('0x26')]()[_0xbd2a('0x25')](function(){_0x58f99f[_0xbd2a('0x18')](0xcc)[_0xbd2a('0x19')]();});}};}function handleEntityNotFound(_0x411264,_0x32c790){return function(_0x37ca40){if(!_0x37ca40){_0x411264['sendStatus'](0x194);}return _0x37ca40;};}function handleError(_0x37f039,_0x13e67d){_0x13e67d=_0x13e67d||0x1f4;return function(_0xeb9236){logger[_0xbd2a('0x27')](_0xeb9236[_0xbd2a('0x28')]);if(_0xeb9236[_0xbd2a('0x29')]){delete _0xeb9236[_0xbd2a('0x29')];}_0x37f039[_0xbd2a('0x18')](_0x13e67d)['send'](_0xeb9236);};}exports[_0xbd2a('0x2a')]=function(_0x3ddf2b,_0x1da92d){var _0x4a96de={},_0x1e0a8e={},_0x4b1f77={'count':0x0,'rows':[]};var _0x29ca28=_[_0xbd2a('0x2b')](db[_0xbd2a('0x2c')][_0xbd2a('0x2d')],function(_0x4cd25b){return{'name':_0x4cd25b[_0xbd2a('0x2e')],'type':_0x4cd25b[_0xbd2a('0x2f')]['key']};});_0x1e0a8e[_0xbd2a('0x30')]=_[_0xbd2a('0x2b')](_0x29ca28,_0xbd2a('0x29'));_0x1e0a8e['query']=_[_0xbd2a('0x31')](_0x3ddf2b['query']);_0x1e0a8e[_0xbd2a('0x32')]=_[_0xbd2a('0x33')](_0x1e0a8e[_0xbd2a('0x30')],_0x1e0a8e[_0xbd2a('0x34')]);_0x4a96de[_0xbd2a('0x35')]=_[_0xbd2a('0x33')](_0x1e0a8e[_0xbd2a('0x30')],qs[_0xbd2a('0x36')](_0x3ddf2b['query']['fields']));_0x4a96de[_0xbd2a('0x35')]=_0x4a96de['attributes'][_0xbd2a('0x37')]?_0x4a96de[_0xbd2a('0x35')]:_0x1e0a8e[_0xbd2a('0x30')];if(!_0x3ddf2b[_0xbd2a('0x34')]['hasOwnProperty']('nolimit')){_0x4a96de['limit']=qs[_0xbd2a('0x1c')](_0x3ddf2b['query'][_0xbd2a('0x1c')]);_0x4a96de[_0xbd2a('0x1e')]=qs[_0xbd2a('0x1e')](_0x3ddf2b[_0xbd2a('0x34')][_0xbd2a('0x1e')]);}_0x4a96de['order']=qs['sort'](_0x3ddf2b['query']['sort']);_0x4a96de[_0xbd2a('0x38')]=qs[_0xbd2a('0x32')](_[_0xbd2a('0x39')](_0x3ddf2b[_0xbd2a('0x34')],_0x1e0a8e[_0xbd2a('0x32')]),_0x29ca28);if(_0x3ddf2b[_0xbd2a('0x34')]['filter']){_0x4a96de[_0xbd2a('0x38')]=_[_0xbd2a('0x3a')](_0x4a96de['where'],{'$or':_[_0xbd2a('0x2b')](_0x29ca28,function(_0x572294){if(_0x572294[_0xbd2a('0x2f')]!==_0xbd2a('0x3b')){var _0xed4e9={};_0xed4e9[_0x572294[_0xbd2a('0x29')]]={'$like':'%'+_0x3ddf2b[_0xbd2a('0x34')][_0xbd2a('0x3c')]+'%'};return _0xed4e9;}})});}_0x4a96de=_[_0xbd2a('0x3a')]({},_0x4a96de,_0x3ddf2b['options']);var _0x25d79d={'where':_0x4a96de[_0xbd2a('0x38')]};return db[_0xbd2a('0x2c')]['count'](_0x25d79d)[_0xbd2a('0x25')](function(_0x285ac6){_0x4b1f77[_0xbd2a('0x1d')]=_0x285ac6;if(_0x3ddf2b[_0xbd2a('0x34')][_0xbd2a('0x3d')]){_0x4a96de[_0xbd2a('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0xbd2a('0x3f')](_0x4a96de);})[_0xbd2a('0x25')](function(_0x111289){_0x4b1f77['rows']=_0x111289;return _0x4b1f77;})[_0xbd2a('0x25')](respondWithFilteredResult(_0x1da92d,_0x4a96de))['catch'](handleError(_0x1da92d,null));};exports[_0xbd2a('0x40')]=function(_0x3764e0,_0x559a73){var _0x2221ec={'raw':!![],'where':{'id':_0x3764e0[_0xbd2a('0x41')]['id']}},_0x5ae443={};_0x5ae443[_0xbd2a('0x30')]=_[_0xbd2a('0x31')](db[_0xbd2a('0x2c')][_0xbd2a('0x2d')]);_0x5ae443[_0xbd2a('0x34')]=_[_0xbd2a('0x31')](_0x3764e0[_0xbd2a('0x34')]);_0x5ae443[_0xbd2a('0x32')]=_[_0xbd2a('0x33')](_0x5ae443[_0xbd2a('0x30')],_0x5ae443[_0xbd2a('0x34')]);_0x2221ec[_0xbd2a('0x35')]=_[_0xbd2a('0x33')](_0x5ae443[_0xbd2a('0x30')],qs[_0xbd2a('0x36')](_0x3764e0[_0xbd2a('0x34')]['fields']));_0x2221ec[_0xbd2a('0x35')]=_0x2221ec[_0xbd2a('0x35')]['length']?_0x2221ec[_0xbd2a('0x35')]:_0x5ae443[_0xbd2a('0x30')];if(_0x3764e0[_0xbd2a('0x34')][_0xbd2a('0x3d')]){_0x2221ec[_0xbd2a('0x3e')]=[{'all':!![]}];}_0x2221ec=_[_0xbd2a('0x3a')]({},_0x2221ec,_0x3764e0[_0xbd2a('0x42')]);return db[_0xbd2a('0x2c')][_0xbd2a('0x43')](_0x2221ec)[_0xbd2a('0x25')](handleEntityNotFound(_0x559a73,null))['then'](respondWithResult(_0x559a73,null))[_0xbd2a('0x44')](handleError(_0x559a73,null));};exports[_0xbd2a('0x45')]=function(_0xac5d7b,_0x394e73){var _0x53a645={'where':{'id':_0xac5d7b[_0xbd2a('0x41')]['id']}},_0x2094ba={};_0x2094ba[_0xbd2a('0x30')]=_[_0xbd2a('0x31')](db['Attachment'][_0xbd2a('0x2d')]);_0x53a645['attributes']=_['intersection'](_0x2094ba[_0xbd2a('0x30')],qs[_0xbd2a('0x36')](_0xac5d7b['query'][_0xbd2a('0x36')]));_0x53a645[_0xbd2a('0x35')]=_0x53a645[_0xbd2a('0x35')][_0xbd2a('0x37')]?_0x53a645['attributes']:_0x2094ba[_0xbd2a('0x30')];if(_0xac5d7b[_0xbd2a('0x34')][_0xbd2a('0x3d')]){_0x53a645['include']=[{'all':!![]}];}_0x53a645=_[_0xbd2a('0x3a')]({},_0x53a645,_0xac5d7b[_0xbd2a('0x42')]);return db[_0xbd2a('0x2c')][_0xbd2a('0x43')](_0x53a645)[_0xbd2a('0x25')](handleEntityNotFound(_0x394e73,null))['then'](function(_0xa6acfa){if(_0xa6acfa){var _0x561cbc=_0xa6acfa[_0xbd2a('0x46')]({'plain':!![]});_0x561cbc=qs['omit'](_0x561cbc,['id','createdAt',_0xbd2a('0x47')]);_0xac5d7b[_0xbd2a('0x48')]=_[_0xbd2a('0x49')](_0xac5d7b[_0xbd2a('0x48')],['id',_0xbd2a('0x4a'),_0xbd2a('0x47')]);return db[_0xbd2a('0x2c')][_0xbd2a('0x4b')](_[_0xbd2a('0x3a')](_0x561cbc,_0xac5d7b[_0xbd2a('0x48')]),{'include':_0xac5d7b['query'][_0xbd2a('0x3d')]?[{'all':!![]}]:undefined});}})[_0xbd2a('0x25')](respondWithResult(_0x394e73,0xc9))['catch'](handleError(_0x394e73,null));};exports[_0xbd2a('0x24')]=function(_0xfa025a,_0x1547a1){if(_0xfa025a[_0xbd2a('0x48')]['id']){delete _0xfa025a[_0xbd2a('0x48')]['id'];}return db['Attachment'][_0xbd2a('0x43')]({'where':{'id':_0xfa025a[_0xbd2a('0x41')]['id']}})[_0xbd2a('0x25')](handleEntityNotFound(_0x1547a1,null))[_0xbd2a('0x25')](saveUpdates(_0xfa025a[_0xbd2a('0x48')],null))[_0xbd2a('0x25')](respondWithResult(_0x1547a1,null))[_0xbd2a('0x44')](handleError(_0x1547a1,null));};exports[_0xbd2a('0x26')]=function(_0x3ac5d0,_0x5577e9){return db[_0xbd2a('0x2c')][_0xbd2a('0x43')]({'where':{'id':_0x3ac5d0['params']['id']}})['then'](handleEntityNotFound(_0x5577e9,null))['then'](removeEntity(_0x5577e9,null))[_0xbd2a('0x44')](handleError(_0x5577e9,null));};exports['create']=function(_0x301d8f,_0x58bb25,_0x47c368){_0x301d8f[_0xbd2a('0x48')]['name']=_0x301d8f['file'][_0xbd2a('0x4c')];_0x301d8f[_0xbd2a('0x48')][_0xbd2a('0x4d')]=_0x301d8f[_0xbd2a('0x4e')][_0xbd2a('0x4f')];_0x301d8f[_0xbd2a('0x48')][_0xbd2a('0x2f')]=_0x301d8f[_0xbd2a('0x4e')]['mimetype'];return db['Attachment']['create'](_0x301d8f[_0xbd2a('0x48')])['then'](respondWithResult(_0x58bb25,0xc9))[_0xbd2a('0x44')](handleError(_0x58bb25,null));};exports['download']=function(_0x3c6941,_0x226638,_0x576a77){return db[_0xbd2a('0x2c')][_0xbd2a('0x50')]({'where':{'id':_0x3c6941['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x226638,null))[_0xbd2a('0x25')](function(_0x219cba){if(_0x219cba){var _0x5d20e8=_0x219cba[_0xbd2a('0x51')]!==null;var _0x158a31=path[_0xbd2a('0x52')](config[_0xbd2a('0x53')],_0xbd2a('0x54'));if(_0x5d20e8){_0x158a31=path[_0xbd2a('0x52')](_0x158a31,_0xbd2a('0x55'));}var _0x32f8d6=path[_0xbd2a('0x52')](_0x158a31,_0x219cba[_0xbd2a('0x4d')]);return _0x226638['download'](_0x32f8d6);}})[_0xbd2a('0x44')](handleError(_0x226638,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7b261f3..54ccc07 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 _0xba51=['path','rimraf','../../config/environment','exports','define','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c7b84,_0x5597d5){var _0x38d19f=function(_0x26164b){while(--_0x26164b){_0x4c7b84['push'](_0x4c7b84['shift']());}};_0x38d19f(++_0x5597d5);}(_0xba51,0x7b));var _0x1ba5=function(_0x2ddc1c,_0x2d3c4c){_0x2ddc1c=_0x2ddc1c-0x0;var _0x454edc=_0xba51[_0x2ddc1c];return _0x454edc;};'use strict';var _=require(_0x1ba5('0x0'));var util=require(_0x1ba5('0x1'));var logger=require(_0x1ba5('0x2'))(_0x1ba5('0x3'));var moment=require(_0x1ba5('0x4'));var BPromise=require(_0x1ba5('0x5'));var rp=require(_0x1ba5('0x6'));var fs=require('fs');var path=require(_0x1ba5('0x7'));var rimraf=require(_0x1ba5('0x8'));var config=require(_0x1ba5('0x9'));var attributes=require('./attachment.attributes');module[_0x1ba5('0xa')]=function(_0x4daead,_0x537f58){return _0x4daead[_0x1ba5('0xb')]('Attachment',attributes,{'tableName':_0x1ba5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c8=['./attachment.attributes','exports','define','Attachment','attachments','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3b195b,_0x4dc681){var _0x432804=function(_0x5e42c8){while(--_0x5e42c8){_0x3b195b['push'](_0x3b195b['shift']());}};_0x432804(++_0x4dc681);}(_0xc1c8,0x1e5));var _0x8c1c=function(_0x500db8,_0x9bfca6){_0x500db8=_0x500db8-0x0;var _0x59f161=_0xc1c8[_0x500db8];return _0x59f161;};'use strict';var _=require(_0x8c1c('0x0'));var util=require(_0x8c1c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8c1c('0x2'));var BPromise=require(_0x8c1c('0x3'));var rp=require(_0x8c1c('0x4'));var fs=require('fs');var path=require(_0x8c1c('0x5'));var rimraf=require('rimraf');var config=require(_0x8c1c('0x6'));var attributes=require(_0x8c1c('0x7'));module[_0x8c1c('0x8')]=function(_0x373809,_0x982a44){return _0x373809[_0x8c1c('0x9')](_0x8c1c('0xa'),attributes,{'tableName':_0x8c1c('0xb'),'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 15b5aa6..79eac1a 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 _0x05b0=['stringify','error','code','message','info','result','Attachment','create','body','options','raw','CreateAttachment','debug','catch','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x05b0,0x188));var _0x005b=function(_0x18d386,_0x245e5b){_0x18d386=_0x18d386-0x0;var _0x114bf7=_0x05b0[_0x18d386];return _0x114bf7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x98e71c,_0x224c8d,_0x35998d){return new BPromise(function(_0x263bc9,_0x5cff7f){return client[_0x005b('0x9')](_0x98e71c,_0x35998d)[_0x005b('0xa')](function(_0x4c5552){logger['info'](_0x005b('0xb'),_0x224c8d,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x224c8d,_0x005b('0xc'),JSON[_0x005b('0xd')](_0x4c5552));if(_0x4c5552['error']){if(_0x4c5552[_0x005b('0xe')][_0x005b('0xf')]===0x1f4){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0x4c5552[_0x005b('0xe')][_0x005b('0x10')]);return _0x5cff7f(_0x4c5552[_0x005b('0xe')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x224c8d,_0x4c5552[_0x005b('0xe')]['message']);return _0x263bc9(_0x4c5552[_0x005b('0xe')]['message']);}else{logger[_0x005b('0x11')](_0x005b('0xb'),_0x224c8d,_0x005b('0xc'));_0x263bc9(_0x4c5552[_0x005b('0x12')][_0x005b('0x10')]);}})['catch'](function(_0xa3c3fb){logger[_0x005b('0xe')](_0x005b('0xb'),_0x224c8d,_0xa3c3fb);_0x5cff7f(_0xa3c3fb);});});}exports['CreateAttachment']=function(_0x206c0a){var _0x5114ad=this;return new Promise(function(_0x50a6eb,_0x2d62b6){return db[_0x005b('0x13')][_0x005b('0x14')](_0x206c0a[_0x005b('0x15')],{'raw':_0x206c0a[_0x005b('0x16')]?_0x206c0a['options'][_0x005b('0x17')]===undefined?!![]:![]:!![]})[_0x005b('0xa')](function(_0x4ae164){logger[_0x005b('0x11')](_0x005b('0x18'),_0x206c0a);logger[_0x005b('0x19')]('CreateAttachment',_0x206c0a,JSON[_0x005b('0xd')](_0x4ae164));_0x50a6eb(_0x4ae164);})[_0x005b('0x1a')](function(_0x319981){logger[_0x005b('0xe')](_0x005b('0x18'),_0x319981[_0x005b('0x10')],_0x206c0a);_0x2d62b6(_0x5114ad['error'](0x1f4,_0x319981[_0x005b('0x10')]));});});}; \ No newline at end of file +var _0x1752=['error','message','result','catch','CreateAttachment','Attachment','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0xc30909,_0x5596a7){var _0x4b7a3f=function(_0x4b7914){while(--_0x4b7914){_0xc30909['push'](_0xc30909['shift']());}};_0x4b7a3f(++_0x5596a7);}(_0x1752,0xa5));var _0x2175=function(_0x5e7884,_0x105fe4){_0x5e7884=_0x5e7884-0x0;var _0x3b4fc3=_0x1752[_0x5e7884];return _0x3b4fc3;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ca87,_0x1bd937,_0x339e4d){return new BPromise(function(_0x672ff1,_0x516ccc){return client[_0x2175('0xc')](_0x19ca87,_0x339e4d)[_0x2175('0xd')](function(_0x407a71){logger[_0x2175('0xe')](_0x2175('0xf'),_0x1bd937,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x1bd937,_0x2175('0x10'),JSON['stringify'](_0x407a71));if(_0x407a71['error']){if(_0x407a71['error']['code']===0x1f4){logger[_0x2175('0x11')]('Attachment,\x20%s,\x20%s',_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x516ccc(_0x407a71['error'][_0x2175('0x12')]);}logger[_0x2175('0x11')](_0x2175('0xf'),_0x1bd937,_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);return _0x672ff1(_0x407a71[_0x2175('0x11')][_0x2175('0x12')]);}else{logger[_0x2175('0xe')]('Attachment,\x20%s,\x20%s',_0x1bd937,'request\x20sent');_0x672ff1(_0x407a71[_0x2175('0x13')][_0x2175('0x12')]);}})[_0x2175('0x14')](function(_0x4e7cf1){logger['error']('Attachment,\x20%s,\x20%s',_0x1bd937,_0x4e7cf1);_0x516ccc(_0x4e7cf1);});});}exports[_0x2175('0x15')]=function(_0x377586){var _0x4cb089=this;return new Promise(function(_0x53576c,_0x405fb1){return db[_0x2175('0x16')][_0x2175('0x17')](_0x377586['body'],{'raw':_0x377586[_0x2175('0x18')]?_0x377586['options'][_0x2175('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x37818a){logger['info']('CreateAttachment',_0x377586);logger['debug'](_0x2175('0x15'),_0x377586,JSON['stringify'](_0x37818a));_0x53576c(_0x37818a);})[_0x2175('0x14')](function(_0x46ea57){logger[_0x2175('0x11')](_0x2175('0x15'),_0x46ea57[_0x2175('0x12')],_0x377586);_0x405fb1(_0x4cb089[_0x2175('0x11')](0x1f4,_0x46ea57['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6e693fb..0107f75 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd413a4,_0x3120fe){_0xd413a4=_0xd413a4-0x0;var _0x9170f4=_0x0b0e[_0xd413a4];return _0x9170f4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0091a8f..852dbf4 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 _0xef96=['Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','disabled','blocked','online','admin','user','agent','then','blockDuration','blockedAt','add','getLicense','status','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','ad-login','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../components/auth/service','../../config/logger','api','activedirectory','baseDN','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef96,0x162));var _0x6ef9=function(_0x513807,_0x452ef7){_0x513807=_0x513807-0x0;var _0x3c0f1c=_0xef96[_0x513807];return _0x3c0f1c;};'use strict';var passport=require(_0x6ef9('0x0'));var LocalStrategy=require(_0x6ef9('0x1'))[_0x6ef9('0x2')];var moment=require(_0x6ef9('0x3'));var ActiveDirectory=require(_0x6ef9('0x4'));var BPromise=require(_0x6ef9('0x5'));var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0x6ef9('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x6ef9('0x7'))(_0x6ef9('0x8'));function isActiveDirectoryConfigured(_0x34ba12){var _0x4954aa=![];if(typeof _0x34ba12[_0x6ef9('0x9')]!=='undefined'){_0x4954aa=_0x34ba12[_0x6ef9('0x9')][_0x6ef9('0xa')]&&_0x34ba12[_0x6ef9('0x9')]['url']&&_0x34ba12[_0x6ef9('0x9')]['domain'];}return _0x4954aa;}function adAuthenticate(_0xb9346c,_0x418b1d,_0x46734b){return new BPromise(function(_0x5aee3b,_0x3f6a97){try{var _0xc14475=new ActiveDirectory(_0xb9346c);_0xc14475[_0x6ef9('0xb')](_0x418b1d,_0x46734b,function(_0x35c728,_0x4f68f2){if(_0x35c728){logger[_0x6ef9('0xc')](_0x6ef9('0xd'),_0x418b1d,util[_0x6ef9('0xe')](_0x35c728,{'showHidden':![],'depth':null}));_0x3f6a97(_0x6ef9('0xf'));}else if(!_0x4f68f2){logger[_0x6ef9('0xc')](_0x6ef9('0x10'),_0x418b1d);_0x3f6a97(_0x6ef9('0xf'));}else{_0x5aee3b(_0x4f68f2);}});}catch(_0x5e2fc1){_0x3f6a97(_0x5e2fc1);}});}function ActiveDirectoryAuthenticate(_0x24681e,_0x2942bc,_0x1f3793,_0x3f50e0){var _0xce5672,_0x297af7;if(!isActiveDirectoryConfigured(config)){logger[_0x6ef9('0xc')](_0x6ef9('0x11'),_0x2942bc);return _0x3f50e0(null,![],{'message':_0x6ef9('0xf')});}return db['Setting'][_0x6ef9('0x12')]({'where':{'id':0x1},'attributes':[_0x6ef9('0x13'),'blockDuration'],'raw':!![]})['then'](function(_0x1cb130){_0xce5672=_0x1cb130;if(!_0xce5672['adSsoEnabled']){logger[_0x6ef9('0xc')](_0x6ef9('0x14'),_0x2942bc);throw new Error(_0x6ef9('0xf'));}return _0x24681e[_0x6ef9('0x12')]({'attributes':['id',_0x6ef9('0x15'),_0x6ef9('0x16'),'salt','role',_0x6ef9('0x17'),_0x6ef9('0x18'),'blockedAt',_0x6ef9('0x19')],'where':{'name':_0x2942bc,'role':{'$or':[_0x6ef9('0x1a'),_0x6ef9('0x1b'),_0x6ef9('0x1c')]},'adSsoEnabled':!![]}});})[_0x6ef9('0x1d')](function(_0x1ef6ee){if(!_0x1ef6ee||_0x1ef6ee&&_0x1ef6ee[_0x6ef9('0x15')]!==_0x2942bc){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x297af7=_0x1ef6ee;var _0x56b5cd=_0x297af7[_0x6ef9('0x15')]+'@'+config[_0x6ef9('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x56b5cd,_0x1f3793);})[_0x6ef9('0x1d')](function(_0x4f8520){if(_0x297af7[_0x6ef9('0x17')]){throw new Error(_0x6ef9('0xf'));}if(_0xce5672[_0x6ef9('0x1e')]>0x0){if(_0x297af7[_0x6ef9('0x18')]){if(moment(_0x297af7[_0x6ef9('0x1f')])[_0x6ef9('0x20')](_0xce5672[_0x6ef9('0x1e')],'minutes')>moment()){throw new Error(_0x6ef9('0xf'));}return utils['clearBlockUser'](_0x297af7,0x0,![],null)[_0x6ef9('0x1d')](function(){return utils[_0x6ef9('0x21')](_0x297af7);})[_0x6ef9('0x1d')](function(){return _0x3f50e0(null,_0x297af7);});}else{return utils[_0x6ef9('0x21')](_0x297af7)[_0x6ef9('0x1d')](function(){return _0x3f50e0(null,_0x297af7);});}}else{return utils[_0x6ef9('0x21')](_0x297af7)[_0x6ef9('0x1d')](function(){return _0x3f50e0(null,_0x297af7);});}})['catch'](function(_0x57f6f9){return _0x3f50e0(null,![],_0x57f6f9);});}function handleError(_0x569649,_0x50750d,_0x5e0a13){return _0x569649[_0x6ef9('0x22')](_0x50750d||0x1f4)['send']({'message':_0x5e0a13?_0x5e0a13[_0x6ef9('0x23')]||_0x5e0a13:''});}exports['login']=function(_0xe7b717,_0x2958e0,_0x444d80){passport[_0x6ef9('0xb')]('ad-login',function(_0x545bad,_0x40004f,_0x2033cc){var _0x51a108=_0x545bad||_0x2033cc;if(_0x51a108){return handleError(_0x2958e0,0x191,_0x51a108);}if(!_0x40004f){return handleError(_0x2958e0,0x194,{'message':_0x6ef9('0x24')});}else{var _0x530f92={'payload':{'id':_0x40004f['id'],'role':_0x40004f[_0x6ef9('0x25')]},'options':{'expiresIn':0x15180}};return authService[_0x6ef9('0x26')](_0x530f92)[_0x6ef9('0x1d')](function(_0x4881b4){_0x2958e0[_0x6ef9('0x27')]({'id':_0x40004f['id'],'token':_0x4881b4,'statusCall':'','isAlreadyLogged':_0x40004f[_0x6ef9('0x19')]});});}})(_0xe7b717,_0x2958e0,_0x444d80);};passport['use'](_0x6ef9('0x28'),new LocalStrategy({'usernameField':_0x6ef9('0x15'),'passwordField':_0x6ef9('0x16')},function(_0x3a9b17,_0x3b36fb,_0x22fba8){return ActiveDirectoryAuthenticate(db['User'],_0x3a9b17,_0x3b36fb,_0x22fba8);})); \ No newline at end of file +var _0x3f72=['json','use','User','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked','user','agent','name','domain','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x3f72,0x1a1));var _0x23f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f72[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x23f7('0x0'))[_0x23f7('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x23f7('0x2'));var BPromise=require(_0x23f7('0x3'));var util=require(_0x23f7('0x4'));var db=require(_0x23f7('0x5'))['db'];var authService=require(_0x23f7('0x6'));var utils=require(_0x23f7('0x7'));var config=require(_0x23f7('0x8'));var logger=require(_0x23f7('0x9'))(_0x23f7('0xa'));function isActiveDirectoryConfigured(_0x1e0cbe){var _0x957a74=![];if(typeof _0x1e0cbe[_0x23f7('0xb')]!==_0x23f7('0xc')){_0x957a74=_0x1e0cbe[_0x23f7('0xb')]['baseDN']&&_0x1e0cbe[_0x23f7('0xb')]['url']&&_0x1e0cbe[_0x23f7('0xb')]['domain'];}return _0x957a74;}function adAuthenticate(_0x2066df,_0x53c322,_0x315741){return new BPromise(function(_0x33ca97,_0x1fa202){try{var _0x33d257=new ActiveDirectory(_0x2066df);_0x33d257[_0x23f7('0xd')](_0x53c322,_0x315741,function(_0x52da60,_0x13af7f){if(_0x52da60){logger[_0x23f7('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x53c322,util[_0x23f7('0xf')](_0x52da60,{'showHidden':![],'depth':null}));_0x1fa202(_0x23f7('0x10'));}else if(!_0x13af7f){logger[_0x23f7('0xe')](_0x23f7('0x11'),_0x53c322);_0x1fa202(_0x23f7('0x10'));}else{_0x33ca97(_0x13af7f);}});}catch(_0x4d638b){_0x1fa202(_0x4d638b);}});}function ActiveDirectoryAuthenticate(_0x460c50,_0x4cddef,_0x29c06f,_0x5e7cc6){var _0x1da277,_0x56ee67;if(!isActiveDirectoryConfigured(config)){logger[_0x23f7('0xe')](_0x23f7('0x12'),_0x4cddef);return _0x5e7cc6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x23f7('0x13'),'blockDuration'],'raw':!![]})[_0x23f7('0x14')](function(_0x2097c5){_0x1da277=_0x2097c5;if(!_0x1da277['adSsoEnabled']){logger[_0x23f7('0xe')](_0x23f7('0x15'),_0x4cddef);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x460c50['findOne']({'attributes':['id','name','password',_0x23f7('0x16'),_0x23f7('0x17'),_0x23f7('0x18'),_0x23f7('0x19'),'blockedAt','online'],'where':{'name':_0x4cddef,'role':{'$or':['admin',_0x23f7('0x1a'),_0x23f7('0x1b')]},'adSsoEnabled':!![]}});})[_0x23f7('0x14')](function(_0x200b09){if(!_0x200b09||_0x200b09&&_0x200b09[_0x23f7('0x1c')]!==_0x4cddef){throw new Error(_0x23f7('0x10'));}_0x56ee67=_0x200b09;var _0x33e4cb=_0x56ee67[_0x23f7('0x1c')]+'@'+config[_0x23f7('0xb')][_0x23f7('0x1d')];return adAuthenticate(config[_0x23f7('0xb')],_0x33e4cb,_0x29c06f);})[_0x23f7('0x14')](function(_0x1861d7){if(_0x56ee67[_0x23f7('0x18')]){throw new Error(_0x23f7('0x10'));}if(_0x1da277[_0x23f7('0x1e')]>0x0){if(_0x56ee67[_0x23f7('0x19')]){if(moment(_0x56ee67[_0x23f7('0x1f')])[_0x23f7('0x20')](_0x1da277[_0x23f7('0x1e')],_0x23f7('0x21'))>moment()){throw new Error(_0x23f7('0x10'));}return utils[_0x23f7('0x22')](_0x56ee67,0x0,![],null)[_0x23f7('0x14')](function(){return utils[_0x23f7('0x23')](_0x56ee67);})[_0x23f7('0x14')](function(){return _0x5e7cc6(null,_0x56ee67);});}else{return utils[_0x23f7('0x23')](_0x56ee67)[_0x23f7('0x14')](function(){return _0x5e7cc6(null,_0x56ee67);});}}else{return utils[_0x23f7('0x23')](_0x56ee67)['then'](function(){return _0x5e7cc6(null,_0x56ee67);});}})[_0x23f7('0x24')](function(_0x13e4aa){return _0x5e7cc6(null,![],_0x13e4aa);});}function handleError(_0x1acfe8,_0x3a7752,_0x508601){return _0x1acfe8[_0x23f7('0x25')](_0x3a7752||0x1f4)[_0x23f7('0x26')]({'message':_0x508601?_0x508601[_0x23f7('0x27')]||_0x508601:''});}exports['login']=function(_0x5a80ac,_0x51b4d9,_0x4877e6){passport[_0x23f7('0xd')](_0x23f7('0x28'),function(_0x53d09d,_0x5df22b,_0xf22312){var _0x1f6175=_0x53d09d||_0xf22312;if(_0x1f6175){return handleError(_0x51b4d9,0x191,_0x1f6175);}if(!_0x5df22b){return handleError(_0x51b4d9,0x194,{'message':_0x23f7('0x29')});}else{var _0x664855={'payload':{'id':_0x5df22b['id'],'role':_0x5df22b[_0x23f7('0x17')]},'options':{'expiresIn':0x15180}};return authService[_0x23f7('0x2a')](_0x664855)[_0x23f7('0x14')](function(_0x12390a){_0x51b4d9[_0x23f7('0x2b')]({'id':_0x5df22b['id'],'token':_0x12390a,'statusCall':'','isAlreadyLogged':_0x5df22b['online']});});}})(_0x5a80ac,_0x51b4d9,_0x4877e6);};passport[_0x23f7('0x2c')](_0x23f7('0x28'),new LocalStrategy({'usernameField':_0x23f7('0x1c'),'passwordField':'password'},function(_0x351271,_0x5ab055,_0x146906){return ActiveDirectoryAuthenticate(db[_0x23f7('0x2d')],_0x351271,_0x5ab055,_0x146906);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 01473b0..93bd7bf 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 _0x444f=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x1ccf4f,_0x18ce33){var _0x3f747c=function(_0x166f08){while(--_0x166f08){_0x1ccf4f['push'](_0x1ccf4f['shift']());}};_0x3f747c(++_0x18ce33);}(_0x444f,0x12d));var _0xf444=function(_0x5a6b45,_0x48fea6){_0x5a6b45=_0x5a6b45-0x0;var _0x2ad452=_0x444f[_0x5a6b45];return _0x2ad452;};'use strict';var express=require(_0xf444('0x0'));var router=express[_0xf444('0x1')]();var controller=require(_0xf444('0x2'));router[_0xf444('0x3')]('/',controller['login']);module[_0xf444('0x4')]=router; \ No newline at end of file +var _0xbdf0=['exports','express','./authActiveDirectory.controller','post'];(function(_0x5c2cd5,_0x1c2fbb){var _0x5180e9=function(_0x12ceed){while(--_0x12ceed){_0x5c2cd5['push'](_0x5c2cd5['shift']());}};_0x5180e9(++_0x1c2fbb);}(_0xbdf0,0x1e5));var _0x0bdf=function(_0x61a429,_0x522e43){_0x61a429=_0x61a429-0x0;var _0x534b5c=_0xbdf0[_0x61a429];return _0x534b5c;};'use strict';var express=require(_0x0bdf('0x0'));var router=express['Router']();var controller=require(_0x0bdf('0x1'));router[_0x0bdf('0x2')]('/',controller['login']);module[_0x0bdf('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index f21bc28..7eea46c 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 _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x289755,_0xa2a591){var _0x3b8130=function(_0x6f6016){while(--_0x6f6016){_0x289755['push'](_0x289755['shift']());}};_0x3b8130(++_0xa2a591);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x426bc5,_0x45c990){var _0x113458=function(_0x582a10){while(--_0x582a10){_0x426bc5['push'](_0x426bc5['shift']());}};_0x113458(++_0x45c990);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1ceea34..1df4a3d 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 _0xaa73=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa73,0xda));var _0x3aa7=function(_0x4af26f,_0x4d65aa){_0x4af26f=_0x4af26f-0x0;var _0x39ccd4=_0xaa73[_0x4af26f];return _0x39ccd4;};'use strict';var express=require(_0x3aa7('0x0'));var passport=require(_0x3aa7('0x1'));var router=express[_0x3aa7('0x2')]();var controller=require(_0x3aa7('0x3'));var userController=require(_0x3aa7('0x4'));var authService=require(_0x3aa7('0x5'));router[_0x3aa7('0x6')]('/',controller[_0x3aa7('0x7')]);router[_0x3aa7('0x6')](_0x3aa7('0x8'),controller[_0x3aa7('0x9')],authService[_0x3aa7('0xa')],userController['login'],authService[_0x3aa7('0xb')]);module[_0x3aa7('0xc')]=router; \ No newline at end of file +var _0xe497=['passport','Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x272387,_0x57b745){var _0x3211d5=function(_0x40c23d){while(--_0x40c23d){_0x272387['push'](_0x272387['shift']());}};_0x3211d5(++_0x57b745);}(_0xe497,0xb3));var _0x7e49=function(_0x3c0856,_0x47a623){_0x3c0856=_0x3c0856-0x0;var _0x5cfd8f=_0xe497[_0x3c0856];return _0x5cfd8f;};'use strict';var express=require(_0x7e49('0x0'));var passport=require(_0x7e49('0x1'));var router=express[_0x7e49('0x2')]();var controller=require(_0x7e49('0x3'));var userController=require(_0x7e49('0x4'));var authService=require('../../components/auth/service');router[_0x7e49('0x5')]('/',controller[_0x7e49('0x6')]);router[_0x7e49('0x5')](_0x7e49('0x7'),controller[_0x7e49('0x8')],authService[_0x7e49('0x9')],userController[_0x7e49('0x6')],authService[_0x7e49('0xa')]);module[_0x7e49('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c62a951..1c17983 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 _0x4dbc=['User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blockedAt','user','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','blocked','add','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','Smtp','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x4dbc,0xb2));var _0xc4db=function(_0x3e4a08,_0x4d0c70){_0x3e4a08=_0x3e4a08-0x0;var _0xeb0558=_0x4dbc[_0x3e4a08];return _0xeb0558;};'use strict';var util=require('util');var passport=require(_0xc4db('0x0'));var LocalStrategy=require(_0xc4db('0x1'))['Strategy'];var jayson=require(_0xc4db('0x2'));var _=require('lodash');var rs=require(_0xc4db('0x3'));var moment=require(_0xc4db('0x4'));var db=require(_0xc4db('0x5'))['db'];var authService=require(_0xc4db('0x6'));var utils=require('../../config/utils');var client=jayson[_0xc4db('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x341173,_0x3875b1,_0x21da3c,_0x491c76){var _0x819915,_0x51eda5;return db[_0xc4db('0x8')][_0xc4db('0x9')]({'where':{'id':0x1},'attributes':[_0xc4db('0xa'),_0xc4db('0xb')],'raw':!![]})[_0xc4db('0xc')](function(_0x1089d3){_0x819915=_0x1089d3;return _0x341173['findOne']({'attributes':['id',_0xc4db('0xd'),_0xc4db('0xe'),_0xc4db('0xf'),_0xc4db('0x10'),_0xc4db('0x11'),'blocked',_0xc4db('0x12'),'loginAttempts'],'where':{'name':_0x3875b1,'role':{'$or':['admin',_0xc4db('0x13'),'agent']}}});})[_0xc4db('0xc')](function(_0x1e3216){if(!_0x1e3216||_0x1e3216&&_0x1e3216[_0xc4db('0xd')]!==_0x3875b1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x51eda5=_0x1e3216;return _0x51eda5;}})[_0xc4db('0xc')](function(){_0x51eda5[_0xc4db('0x14')](_0x21da3c,function(_0x36e21b,_0x32b76b){var _0x2ec069=_0x51eda5[_0xc4db('0x15')]+0x1;if(_0x36e21b){return _0x491c76(_0x36e21b);}else if(!_0x32b76b){if(_0x51eda5[_0xc4db('0x11')]){return _0x491c76(null,![],{'message':_0xc4db('0x16')});}else if(_0x819915['allowedLoginAttempts']>0x0){if(_0x51eda5['blocked']){if(_0x819915[_0xc4db('0xb')]>0x0){if(moment(_0x51eda5[_0xc4db('0x12')])['add'](_0x819915[_0xc4db('0xb')],_0xc4db('0x17'))>moment()){return _0x491c76(null,![],{'message':_0xc4db('0x16')});}else{return utils[_0xc4db('0x18')](_0x51eda5,_0x2ec069,![],null)[_0xc4db('0xc')](function(){return _0x491c76(null,![],{'message':_0xc4db('0x16')});});}}else{return _0x491c76(null,![],{'message':_0xc4db('0x16')});}}else{if(_0x2ec069>=_0x819915[_0xc4db('0xa')]){return utils[_0xc4db('0x18')](_0x51eda5,0x0,!![],moment())[_0xc4db('0xc')](function(){return _0x491c76(null,![],{'message':_0xc4db('0x16')});});}else{return utils[_0xc4db('0x18')](_0x51eda5,_0x2ec069,![],null)['then'](function(){return _0x491c76(null,![],{'message':_0xc4db('0x16')});});}}}else{return _0x491c76(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x51eda5[_0xc4db('0x11')]){return _0x491c76(null,![],{'message':_0xc4db('0x16')});}else if(_0x819915[_0xc4db('0xa')]>0x0){if(_0x51eda5[_0xc4db('0x19')]){if(_0x819915[_0xc4db('0xb')]>0x0){if(moment(_0x51eda5[_0xc4db('0x12')])[_0xc4db('0x1a')](_0x819915[_0xc4db('0xb')],'minutes')>moment()){return _0x491c76(null,![],{'message':_0xc4db('0x16')});}else{return utils[_0xc4db('0x18')](_0x51eda5,0x0,![],null)[_0xc4db('0xc')](function(){return utils['getLicense'](_0x51eda5);})[_0xc4db('0xc')](function(){return _0x491c76(null,_0x51eda5);});}}else{return _0x491c76(null,![],{'message':_0xc4db('0x16')});}}else{return utils[_0xc4db('0x18')](_0x51eda5,0x0,![],null)[_0xc4db('0xc')](function(){return utils[_0xc4db('0x1b')](_0x51eda5);})[_0xc4db('0xc')](function(){return _0x491c76(null,_0x51eda5);})[_0xc4db('0x1c')](function(_0x58b897){return _0x491c76(null,![],_0x58b897);});}}else{if(_0x51eda5[_0xc4db('0x19')]){return _0x491c76(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc4db('0x1b')](_0x51eda5)[_0xc4db('0xc')](function(){return _0x491c76(null,_0x51eda5);});}}}});})['catch'](function(_0x5dcf70){return _0x491c76(null,![],_0x5dcf70);});}function sendServiceMail(_0x32b237){return db[_0xc4db('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0xc4db('0xd'),_0xc4db('0x1e')],'include':[{'model':db[_0xc4db('0x1f')],'as':'Smtp','include':[{'model':db[_0xc4db('0x20')],'as':_0xc4db('0x20')}]}]})['then'](function(_0x4e2af5){if(!_0x4e2af5){throw new Error(_0xc4db('0x21'));}var _0x1e1047=_0x4e2af5['getSmtpOptions']();var _0x2bee06={'account':_0x1e1047,'message':_[_0xc4db('0x22')]({'from':util[_0xc4db('0x23')](_0xc4db('0x24'),_0x4e2af5[_0xc4db('0xd')],_0x4e2af5['email']||_0x4e2af5[_0xc4db('0x25')]['user'])},_0x32b237)};return client['request'](_0xc4db('0x26'),_0x2bee06);})[_0xc4db('0xc')](function(_0x27b872){if(_0x27b872['error']){throw new Error(util['format'](_0xc4db('0x27'),_0x27b872['error'][_0xc4db('0x28')]||JSON['stringify'](_0x27b872[_0xc4db('0x29')])));}return!![];});}function handleError(_0x2168d6,_0x44f4b1,_0x1eb0da){return _0x2168d6[_0xc4db('0x2a')](_0x44f4b1||0x1f4)[_0xc4db('0x2b')]({'message':_0x1eb0da?_0x1eb0da[_0xc4db('0x28')]||_0x1eb0da:''});}exports['login']=function(_0x11784d,_0x2ae4b4,_0x4af994){passport['authenticate'](_0xc4db('0x2c'),function(_0x595952,_0x153e3f,_0x525bf1){var _0x25ade7=_0x595952||_0x525bf1;if(_0x25ade7){return handleError(_0x2ae4b4,0x191,_0x25ade7);}if(!_0x153e3f){return handleError(_0x2ae4b4,0x194,{'message':_0xc4db('0x2d')});}else{var _0x49ec26={'payload':{'id':_0x153e3f['id'],'role':_0x153e3f[_0xc4db('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xc4db('0x2e')](_0x49ec26)[_0xc4db('0xc')](function(_0x1bdb29){_0x2ae4b4[_0xc4db('0x2f')]({'id':_0x153e3f['id'],'token':_0x1bdb29,'statusCall':'','isAlreadyLogged':_0x153e3f[_0xc4db('0x30')]});});}})(_0x11784d,_0x2ae4b4,_0x4af994);};exports[_0xc4db('0x31')]=function(_0x262d13,_0x40b0f1){if(!_0x262d13[_0xc4db('0x32')][_0xc4db('0x1e')]){return handleError(_0x40b0f1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x21fe6c=rs[_0xc4db('0x33')]();_0x262d13[_0xc4db('0x32')][_0xc4db('0x1e')]=_0x262d13[_0xc4db('0x32')]['email'][_0xc4db('0x34')]()['toLowerCase']();var _0x8b4808;return db['Setting'][_0xc4db('0x9')]({'where':{'id':0x1},'attributes':[_0xc4db('0xa'),_0xc4db('0xb')],'raw':!![]})[_0xc4db('0xc')](function(_0x551b36){_0x8b4808=_0x551b36;return db[_0xc4db('0x35')]['find']({'where':{'email':_0x262d13[_0xc4db('0x32')][_0xc4db('0x1e')]}});})[_0xc4db('0xc')](function(_0xfd30a9){if(!_0xfd30a9){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xfd30a9['disabled']){throw new Error(_0xc4db('0x36'));}if(_0xfd30a9[_0xc4db('0x19')]){if(moment(_0xfd30a9[_0xc4db('0x12')])['add'](_0x8b4808[_0xc4db('0xb')],_0xc4db('0x17'))>moment()){throw new Error(_0xc4db('0x37'));}else{_0xfd30a9[_0xc4db('0x19')]=![];_0xfd30a9['blockedAt']=null;}}_0xfd30a9[_0xc4db('0x38')]=_0x21fe6c;_0xfd30a9[_0xc4db('0x39')]=Date[_0xc4db('0x3a')]()+0x36ee80;return _0xfd30a9[_0xc4db('0x3b')]();})[_0xc4db('0xc')](function(){return sendServiceMail({'to':_0x262d13[_0xc4db('0x32')][_0xc4db('0x1e')],'subject':_0xc4db('0x3c'),'text':_0xc4db('0x3d')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x262d13[_0xc4db('0x3e')][_0xc4db('0x3f')]+_0xc4db('0x40')+_0x21fe6c+'\x0a\x0a'+_0xc4db('0x41')});})[_0xc4db('0xc')](function(){_0x40b0f1['status'](0xc8)[_0xc4db('0x2b')]({'message':_0xc4db('0x42')});})['catch'](function(_0x594799){return handleError(_0x40b0f1,0x1f4,_0x594799);});};exports['reset']=function(_0x5a11f6,_0x31abeb){return db[_0xc4db('0x35')]['find']({'where':{'resetPasswordToken':_0x5a11f6[_0xc4db('0x43')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc4db('0x3a')]()}}})['then'](function(_0x368a86){if(!_0x368a86){throw new Error(_0xc4db('0x44'));}return db[_0xc4db('0x8')]['findOne']({'attributes':['id',_0xc4db('0x45'),_0xc4db('0x46'),_0xc4db('0x47')]})['then'](function(_0x151ede){if(_0x151ede['securePassword'])authService[_0xc4db('0x48')](_0x5a11f6[_0xc4db('0x32')][_0xc4db('0xe')]);if(!_0x151ede[_0xc4db('0x46')]||!_0x368a86[_0xc4db('0x49')])return _0x368a86;authService[_0xc4db('0x4a')](_0x5a11f6[_0xc4db('0x32')][_0xc4db('0xe')],_0x368a86[_0xc4db('0x49')],_0x151ede[_0xc4db('0x47')]);return _0x368a86;})['then'](function(){_0x368a86[_0xc4db('0xe')]=_0x5a11f6['body'][_0xc4db('0xe')];_0x368a86[_0xc4db('0x38')]=null;_0x368a86[_0xc4db('0x39')]=null;return _0x368a86[_0xc4db('0x3b')]();});})[_0xc4db('0xc')](function(){_0x31abeb['status'](0xc8)['send']({'message':_0xc4db('0x4b')});})[_0xc4db('0x1c')](function(_0x38c0fc){return handleError(_0x31abeb,0x1f4,_0x38c0fc);});};passport[_0xc4db('0x4c')]('local-login',new LocalStrategy({'usernameField':_0xc4db('0xd'),'passwordField':_0xc4db('0xe')},function(_0x8a34af,_0xd50789,_0x3170ca){return localAuthenticate(db[_0xc4db('0x35')],_0x8a34af,_0xd50789,_0x3170ca);})); \ No newline at end of file +var _0x83a6=['generate','trim','toLowerCase','findOne','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Setting','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','use','passport-local','jayson/promise','lodash','../../components/auth/service','../../config/utils','http','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blockedAt','add','minutes','clearBlockUser','catch','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','Smtp','user','request','SendMail','error','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0xd56cf6,_0x561b40){var _0x3bdf89=function(_0x3b8a75){while(--_0x3b8a75){_0xd56cf6['push'](_0xd56cf6['shift']());}};_0x3bdf89(++_0x561b40);}(_0x83a6,0x1eb));var _0x683a=function(_0x5cd513,_0x392e7a){_0x5cd513=_0x5cd513-0x0;var _0x19d2f5=_0x83a6[_0x5cd513];return _0x19d2f5;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x683a('0x0'))['Strategy'];var jayson=require(_0x683a('0x1'));var _=require(_0x683a('0x2'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x683a('0x3'));var utils=require(_0x683a('0x4'));var client=jayson['client'][_0x683a('0x5')]({'port':0x232b});function localAuthenticate(_0x1acbd9,_0x55a1de,_0x1ce801,_0x4c14e6){var _0x4beea1,_0x109a28;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x683a('0x6'),_0x683a('0x7')],'raw':!![]})[_0x683a('0x8')](function(_0x3fd39b){_0x4beea1=_0x3fd39b;return _0x1acbd9['findOne']({'attributes':['id','name',_0x683a('0x9'),_0x683a('0xa'),_0x683a('0xb'),_0x683a('0xc'),_0x683a('0xd'),'blockedAt','loginAttempts'],'where':{'name':_0x55a1de,'role':{'$or':[_0x683a('0xe'),'user',_0x683a('0xf')]}}});})[_0x683a('0x8')](function(_0x2b6510){if(!_0x2b6510||_0x2b6510&&_0x2b6510[_0x683a('0x10')]!==_0x55a1de){throw new Error(_0x683a('0x11'));}else{_0x109a28=_0x2b6510;return _0x109a28;}})[_0x683a('0x8')](function(){_0x109a28['authenticate'](_0x1ce801,function(_0x168bb8,_0x40517c){var _0x1c1619=_0x109a28[_0x683a('0x12')]+0x1;if(_0x168bb8){return _0x4c14e6(_0x168bb8);}else if(!_0x40517c){if(_0x109a28[_0x683a('0xc')]){return _0x4c14e6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4beea1[_0x683a('0x6')]>0x0){if(_0x109a28[_0x683a('0xd')]){if(_0x4beea1[_0x683a('0x7')]>0x0){if(moment(_0x109a28[_0x683a('0x13')])[_0x683a('0x14')](_0x4beea1[_0x683a('0x7')],_0x683a('0x15'))>moment()){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});}else{return utils[_0x683a('0x16')](_0x109a28,_0x1c1619,![],null)['then'](function(){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});});}}else{return _0x4c14e6(null,![],{'message':_0x683a('0x11')});}}else{if(_0x1c1619>=_0x4beea1[_0x683a('0x6')]){return utils[_0x683a('0x16')](_0x109a28,0x0,!![],moment())[_0x683a('0x8')](function(){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});});}else{return utils[_0x683a('0x16')](_0x109a28,_0x1c1619,![],null)[_0x683a('0x8')](function(){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});});}}}else{return _0x4c14e6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x109a28[_0x683a('0xc')]){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});}else if(_0x4beea1[_0x683a('0x6')]>0x0){if(_0x109a28[_0x683a('0xd')]){if(_0x4beea1[_0x683a('0x7')]>0x0){if(moment(_0x109a28[_0x683a('0x13')])['add'](_0x4beea1['blockDuration'],_0x683a('0x15'))>moment()){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});}else{return utils['clearBlockUser'](_0x109a28,0x0,![],null)[_0x683a('0x8')](function(){return utils['getLicense'](_0x109a28);})[_0x683a('0x8')](function(){return _0x4c14e6(null,_0x109a28);});}}else{return _0x4c14e6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x683a('0x16')](_0x109a28,0x0,![],null)[_0x683a('0x8')](function(){return utils['getLicense'](_0x109a28);})[_0x683a('0x8')](function(){return _0x4c14e6(null,_0x109a28);})[_0x683a('0x17')](function(_0x42663a){return _0x4c14e6(null,![],_0x42663a);});}}else{if(_0x109a28['blocked']){return _0x4c14e6(null,![],{'message':_0x683a('0x11')});}else{return utils['getLicense'](_0x109a28)[_0x683a('0x8')](function(){return _0x4c14e6(null,_0x109a28);});}}}});})['catch'](function(_0x236dc9){return _0x4c14e6(null,![],_0x236dc9);});}function sendServiceMail(_0x239dba){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x683a('0x10'),_0x683a('0x18')],'include':[{'model':db[_0x683a('0x19')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0x683a('0x8')](function(_0x58356f){if(!_0x58356f){throw new Error(_0x683a('0x1a'));}var _0x452316=_0x58356f[_0x683a('0x1b')]();var _0x29ba13={'account':_0x452316,'message':_[_0x683a('0x1c')]({'from':util[_0x683a('0x1d')]('\x22%s\x22\x20<%s>',_0x58356f[_0x683a('0x10')],_0x58356f[_0x683a('0x18')]||_0x58356f[_0x683a('0x1e')][_0x683a('0x1f')])},_0x239dba)};return client[_0x683a('0x20')](_0x683a('0x21'),_0x29ba13);})['then'](function(_0x56e7c0){if(_0x56e7c0[_0x683a('0x22')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x56e7c0['error'][_0x683a('0x23')]||JSON[_0x683a('0x24')](_0x56e7c0[_0x683a('0x22')])));}return!![];});}function handleError(_0x2495c0,_0x589213,_0x3336cd){return _0x2495c0[_0x683a('0x25')](_0x589213||0x1f4)[_0x683a('0x26')]({'message':_0x3336cd?_0x3336cd['message']||_0x3336cd:''});}exports[_0x683a('0x27')]=function(_0x1d1275,_0x5bc3ea,_0x53e3c8){passport[_0x683a('0x28')](_0x683a('0x29'),function(_0x2d0e50,_0x2a5073,_0x20f6c4){var _0x20f8f4=_0x2d0e50||_0x20f6c4;if(_0x20f8f4){return handleError(_0x5bc3ea,0x191,_0x20f8f4);}if(!_0x2a5073){return handleError(_0x5bc3ea,0x194,{'message':_0x683a('0x2a')});}else{var _0x256c58={'payload':{'id':_0x2a5073['id'],'role':_0x2a5073[_0x683a('0xb')]},'options':{'expiresIn':0x15180}};return authService[_0x683a('0x2b')](_0x256c58)[_0x683a('0x8')](function(_0xc44215){_0x5bc3ea[_0x683a('0x2c')]({'id':_0x2a5073['id'],'token':_0xc44215,'statusCall':'','isAlreadyLogged':_0x2a5073['online']});});}})(_0x1d1275,_0x5bc3ea,_0x53e3c8);};exports[_0x683a('0x2d')]=function(_0x5f28cd,_0x2bd1c8){if(!_0x5f28cd[_0x683a('0x2e')][_0x683a('0x18')]){return handleError(_0x2bd1c8,0x1f4,{'message':_0x683a('0x2f')});}var _0x2e40e5=rs[_0x683a('0x30')]();_0x5f28cd[_0x683a('0x2e')]['email']=_0x5f28cd[_0x683a('0x2e')][_0x683a('0x18')][_0x683a('0x31')]()[_0x683a('0x32')]();var _0x2e3495;return db['Setting'][_0x683a('0x33')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x683a('0x7')],'raw':!![]})['then'](function(_0x3c32fb){_0x2e3495=_0x3c32fb;return db[_0x683a('0x34')][_0x683a('0x35')]({'where':{'email':_0x5f28cd[_0x683a('0x2e')]['email']}});})[_0x683a('0x8')](function(_0xa98297){if(!_0xa98297){throw new Error(_0x683a('0x36'));}if(_0xa98297[_0x683a('0xc')]){throw new Error(_0x683a('0x37'));}if(_0xa98297[_0x683a('0xd')]){if(moment(_0xa98297['blockedAt'])[_0x683a('0x14')](_0x2e3495[_0x683a('0x7')],'minutes')>moment()){throw new Error(_0x683a('0x38'));}else{_0xa98297[_0x683a('0xd')]=![];_0xa98297[_0x683a('0x13')]=null;}}_0xa98297['resetPasswordToken']=_0x2e40e5;_0xa98297[_0x683a('0x39')]=Date[_0x683a('0x3a')]()+0x36ee80;return _0xa98297[_0x683a('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x5f28cd[_0x683a('0x2e')][_0x683a('0x18')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x683a('0x3c')+_0x683a('0x3d')+_0x5f28cd['headers'][_0x683a('0x3e')]+_0x683a('0x3f')+_0x2e40e5+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x683a('0x8')](function(){_0x2bd1c8[_0x683a('0x25')](0xc8)[_0x683a('0x26')]({'message':_0x683a('0x40')});})[_0x683a('0x17')](function(_0x47a72d){return handleError(_0x2bd1c8,0x1f4,_0x47a72d);});};exports[_0x683a('0x41')]=function(_0x26024d,_0x5484dd){return db[_0x683a('0x34')][_0x683a('0x35')]({'where':{'resetPasswordToken':_0x26024d[_0x683a('0x42')][_0x683a('0x43')],'resetPasswordExpires':{'$gt':Date[_0x683a('0x3a')]()}}})[_0x683a('0x8')](function(_0x1ddcb0){if(!_0x1ddcb0){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x683a('0x44')][_0x683a('0x33')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x683a('0x45')]})[_0x683a('0x8')](function(_0x33191e){if(_0x33191e[_0x683a('0x46')])authService[_0x683a('0x47')](_0x26024d[_0x683a('0x2e')][_0x683a('0x9')]);if(!_0x33191e[_0x683a('0x48')]||!_0x1ddcb0['previousPasswords'])return _0x1ddcb0;authService['validatePasswordHistory'](_0x26024d[_0x683a('0x2e')][_0x683a('0x9')],_0x1ddcb0[_0x683a('0x49')],_0x33191e[_0x683a('0x45')]);return _0x1ddcb0;})['then'](function(){_0x1ddcb0[_0x683a('0x9')]=_0x26024d['body']['password'];_0x1ddcb0[_0x683a('0x4a')]=null;_0x1ddcb0[_0x683a('0x39')]=null;return _0x1ddcb0[_0x683a('0x3b')]();});})[_0x683a('0x8')](function(){_0x5484dd[_0x683a('0x25')](0xc8)['send']({'message':_0x683a('0x4b')});})[_0x683a('0x17')](function(_0x560a17){return handleError(_0x5484dd,0x1f4,_0x560a17);});};passport[_0x683a('0x4c')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x683a('0x9')},function(_0x1abdd4,_0x5bcd80,_0x44b815){return localAuthenticate(db[_0x683a('0x34')],_0x1abdd4,_0x5bcd80,_0x44b815);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 91eb570..0f2fc27 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 _0xaf12=['forgot','post','/reset/:token','exports','Router','./authLocal.controller','login'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf12,0xd6));var _0x2af1=function(_0x5ed0ba,_0x1f3c0b){_0x5ed0ba=_0x5ed0ba-0x0;var _0x5a31b9=_0xaf12[_0x5ed0ba];return _0x5a31b9;};'use strict';var express=require('express');var router=express[_0x2af1('0x0')]();var controller=require(_0x2af1('0x1'));router['post']('/',controller[_0x2af1('0x2')]);router['post']('/forgot',controller[_0x2af1('0x3')]);router[_0x2af1('0x4')](_0x2af1('0x5'),controller['reset']);module[_0x2af1('0x6')]=router; \ No newline at end of file +var _0x1fe4=['login','post','/forgot','forgot','reset','Router','./authLocal.controller'];(function(_0x36a064,_0x2495a4){var _0x36eefe=function(_0x4c33d7){while(--_0x4c33d7){_0x36a064['push'](_0x36a064['shift']());}};_0x36eefe(++_0x2495a4);}(_0x1fe4,0x10f));var _0x41fe=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x1fe4[_0x2cde0a];return _0x260610;};'use strict';var express=require('express');var router=express[_0x41fe('0x0')]();var controller=require(_0x41fe('0x1'));router['post']('/',controller[_0x41fe('0x2')]);router[_0x41fe('0x3')](_0x41fe('0x4'),controller[_0x41fe('0x5')]);router[_0x41fe('0x3')]('/reset/:token',controller[_0x41fe('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3a33469..c518b05 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 _0x4de3=['BOOLEAN','sequelize','exports','STRING'];(function(_0x275983,_0x2e8bb0){var _0x234332=function(_0x12e214){while(--_0x12e214){_0x275983['push'](_0x275983['shift']());}};_0x234332(++_0x2e8bb0);}(_0x4de3,0x125));var _0x34de=function(_0x53d33e,_0x4af6d9){_0x53d33e=_0x53d33e-0x0;var _0x3db2bd=_0x4de3[_0x53d33e];return _0x3db2bd;};'use strict';var Sequelize=require(_0x34de('0x0'));module[_0x34de('0x1')]={'name':{'type':Sequelize[_0x34de('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x34de('0x2')]},'description':{'type':Sequelize[_0x34de('0x2')]},'status':{'type':Sequelize[_0x34de('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x79ac=['exports','STRING','BOOLEAN'];(function(_0x191d25,_0x4b04b6){var _0xc8f999=function(_0x4a660d){while(--_0x4a660d){_0x191d25['push'](_0x191d25['shift']());}};_0xc8f999(++_0x4b04b6);}(_0x79ac,0x16e));var _0xc79a=function(_0x5a8795,_0x33d6a7){_0x5a8795=_0x5a8795-0x0;var _0xc61553=_0x79ac[_0x5a8795];return _0xc61553;};'use strict';var Sequelize=require('sequelize');module[_0xc79a('0x0')]={'name':{'type':Sequelize[_0xc79a('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xc79a('0x1')]},'description':{'type':Sequelize[_0xc79a('0x1')]},'status':{'type':Sequelize[_0xc79a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 6ce6c1b..4a752a3 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 _0x32fa=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','Automation','catch','show','params','include','options','create','body','find','addConditions','ids','omit','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0x32fa,0x9f));var _0xa32f=function(_0x4095b3,_0x307e47){_0x4095b3=_0x4095b3-0x0;var _0x47e81a=_0x32fa[_0x4095b3];return _0x47e81a;};'use strict';var emlformat=require(_0xa32f('0x0'));var rimraf=require(_0xa32f('0x1'));var zipdir=require(_0xa32f('0x2'));var jsonpatch=require(_0xa32f('0x3'));var rp=require(_0xa32f('0x4'));var moment=require(_0xa32f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa32f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa32f('0x7'));var csv=require(_0xa32f('0x8'));var ejs=require(_0xa32f('0x9'));var fs=require('fs');var fs_extra=require(_0xa32f('0xa'));var _=require(_0xa32f('0xb'));var squel=require(_0xa32f('0xc'));var crypto=require(_0xa32f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa32f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa32f('0xf'));var Papa=require(_0xa32f('0x10'));var Redis=require(_0xa32f('0x11'));var authService=require(_0xa32f('0x12'));var qs=require(_0xa32f('0x13'));var as=require(_0xa32f('0x14'));var hardwareService=require(_0xa32f('0x15'));var logger=require(_0xa32f('0x16'))(_0xa32f('0x17'));var utils=require(_0xa32f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa32f('0x19'))['db'];function respondWithStatusCode(_0x24cb02,_0x4c3f72){_0x4c3f72=_0x4c3f72||0xcc;return function(_0x585e04){if(_0x585e04){return _0x24cb02[_0xa32f('0x1a')](_0x4c3f72);}return _0x24cb02[_0xa32f('0x1b')](_0x4c3f72)[_0xa32f('0x1c')]();};}function respondWithResult(_0x14e7d5,_0x505521){_0x505521=_0x505521||0xc8;return function(_0x446712){if(_0x446712){return _0x14e7d5['status'](_0x505521)[_0xa32f('0x1d')](_0x446712);}};}function respondWithFilteredResult(_0x4e1f62,_0x434f36){return function(_0x4994ca){if(_0x4994ca){var _0x509890=typeof _0x434f36[_0xa32f('0x1e')]===_0xa32f('0x1f')&&typeof _0x434f36[_0xa32f('0x20')]==='undefined';var _0x546951=_0x4994ca[_0xa32f('0x21')];var _0x1686d2=_0x509890?0x0:_0x434f36[_0xa32f('0x1e')];var _0x17fe88=_0x509890?_0x4994ca[_0xa32f('0x21')]:_0x434f36[_0xa32f('0x1e')]+_0x434f36[_0xa32f('0x20')];var _0x20ad90;if(_0x17fe88>=_0x546951){_0x17fe88=_0x546951;_0x20ad90=0xc8;}else{_0x20ad90=0xce;}_0x4e1f62['status'](_0x20ad90);return _0x4e1f62[_0xa32f('0x22')]('Content-Range',_0x1686d2+'-'+_0x17fe88+'/'+_0x546951)[_0xa32f('0x1d')](_0x4994ca);}return null;};}function patchUpdates(_0x508b89){return function(_0x61056a){try{jsonpatch[_0xa32f('0x23')](_0x61056a,_0x508b89,!![]);}catch(_0xd916fe){return BPromise[_0xa32f('0x24')](_0xd916fe);}return _0x61056a[_0xa32f('0x25')]();};}function saveUpdates(_0x1be681,_0x4a7013){return function(_0x10d4f0){if(_0x10d4f0){return _0x10d4f0[_0xa32f('0x26')](_0x1be681)[_0xa32f('0x27')](function(_0x4a8650){return _0x4a8650;});}return null;};}function removeEntity(_0x3ee73c,_0x4c9004){return function(_0x5dfc9d){if(_0x5dfc9d){return _0x5dfc9d[_0xa32f('0x28')]()[_0xa32f('0x27')](function(){_0x3ee73c[_0xa32f('0x1b')](0xcc)[_0xa32f('0x1c')]();});}};}function handleEntityNotFound(_0x506c5a,_0xa9c519){return function(_0x378101){if(!_0x378101){_0x506c5a[_0xa32f('0x1a')](0x194);}return _0x378101;};}function handleError(_0xfff6c9,_0x5140cd){_0x5140cd=_0x5140cd||0x1f4;return function(_0x2c84ae){logger['error'](_0x2c84ae[_0xa32f('0x29')]);if(_0x2c84ae[_0xa32f('0x2a')]){delete _0x2c84ae[_0xa32f('0x2a')];}_0xfff6c9[_0xa32f('0x1b')](_0x5140cd)[_0xa32f('0x2b')](_0x2c84ae);};}exports[_0xa32f('0x2c')]=function(_0x18fe95,_0x21d9e6){var _0x1c3387={},_0xcf20d6={},_0x2794e8={'count':0x0,'rows':[]};var _0x5ae444=_[_0xa32f('0x2d')](db['Automation'][_0xa32f('0x2e')],function(_0x92e86c){return{'name':_0x92e86c['fieldName'],'type':_0x92e86c[_0xa32f('0x2f')][_0xa32f('0x30')]};});_0xcf20d6[_0xa32f('0x31')]=_[_0xa32f('0x2d')](_0x5ae444,'name');_0xcf20d6[_0xa32f('0x32')]=_[_0xa32f('0x33')](_0x18fe95['query']);_0xcf20d6[_0xa32f('0x34')]=_[_0xa32f('0x35')](_0xcf20d6['model'],_0xcf20d6[_0xa32f('0x32')]);_0x1c3387[_0xa32f('0x36')]=_[_0xa32f('0x35')](_0xcf20d6['model'],qs[_0xa32f('0x37')](_0x18fe95[_0xa32f('0x32')]['fields']));_0x1c3387[_0xa32f('0x36')]=_0x1c3387['attributes'][_0xa32f('0x38')]?_0x1c3387[_0xa32f('0x36')]:_0xcf20d6[_0xa32f('0x31')];if(!_0x18fe95[_0xa32f('0x32')][_0xa32f('0x39')](_0xa32f('0x3a'))){_0x1c3387['limit']=qs['limit'](_0x18fe95['query'][_0xa32f('0x20')]);_0x1c3387['offset']=qs[_0xa32f('0x1e')](_0x18fe95[_0xa32f('0x32')]['offset']);}_0x1c3387[_0xa32f('0x3b')]=qs[_0xa32f('0x3c')](_0x18fe95[_0xa32f('0x32')]['sort']);_0x1c3387[_0xa32f('0x3d')]=qs[_0xa32f('0x34')](_[_0xa32f('0x3e')](_0x18fe95[_0xa32f('0x32')],_0xcf20d6['filters']),_0x5ae444);if(_0x18fe95['query'][_0xa32f('0x3f')]){_0x1c3387[_0xa32f('0x3d')]=_['merge'](_0x1c3387[_0xa32f('0x3d')],{'$or':_[_0xa32f('0x2d')](_0x5ae444,function(_0x3ff744){if(_0x3ff744['type']!==_0xa32f('0x40')){var _0x145d93={};_0x145d93[_0x3ff744[_0xa32f('0x2a')]]={'$like':'%'+_0x18fe95[_0xa32f('0x32')][_0xa32f('0x3f')]+'%'};return _0x145d93;}})});}_0x1c3387=_[_0xa32f('0x41')]({},_0x1c3387,_0x18fe95['options']);var _0x2ca9b4={'where':_0x1c3387[_0xa32f('0x3d')]};return db['Automation'][_0xa32f('0x21')](_0x2ca9b4)['then'](function(_0x2c1674){_0x2794e8[_0xa32f('0x21')]=_0x2c1674;if(_0x18fe95[_0xa32f('0x32')][_0xa32f('0x42')]){_0x1c3387['include']=[{'all':!![]}];}return db[_0xa32f('0x43')]['findAll'](_0x1c3387);})[_0xa32f('0x27')](function(_0x5923d8){_0x2794e8['rows']=_0x5923d8;return _0x2794e8;})[_0xa32f('0x27')](respondWithFilteredResult(_0x21d9e6,_0x1c3387))[_0xa32f('0x44')](handleError(_0x21d9e6,null));};exports[_0xa32f('0x45')]=function(_0x2c2247,_0x1be17a){var _0x5cb3d0={'raw':![],'where':{'id':_0x2c2247[_0xa32f('0x46')]['id']}},_0x965d0a={};_0x965d0a['model']=_[_0xa32f('0x33')](db['Automation'][_0xa32f('0x2e')]);_0x965d0a[_0xa32f('0x32')]=_[_0xa32f('0x33')](_0x2c2247[_0xa32f('0x32')]);_0x965d0a['filters']=_[_0xa32f('0x35')](_0x965d0a[_0xa32f('0x31')],_0x965d0a['query']);_0x5cb3d0[_0xa32f('0x36')]=_[_0xa32f('0x35')](_0x965d0a[_0xa32f('0x31')],qs[_0xa32f('0x37')](_0x2c2247[_0xa32f('0x32')][_0xa32f('0x37')]));_0x5cb3d0[_0xa32f('0x36')]=_0x5cb3d0[_0xa32f('0x36')]['length']?_0x5cb3d0['attributes']:_0x965d0a[_0xa32f('0x31')];if(_0x2c2247[_0xa32f('0x32')][_0xa32f('0x42')]){_0x5cb3d0[_0xa32f('0x47')]=[{'all':!![]}];}_0x5cb3d0=_[_0xa32f('0x41')]({},_0x5cb3d0,_0x2c2247[_0xa32f('0x48')]);return db[_0xa32f('0x43')]['find'](_0x5cb3d0)[_0xa32f('0x27')](handleEntityNotFound(_0x1be17a,null))[_0xa32f('0x27')](respondWithResult(_0x1be17a,null))[_0xa32f('0x44')](handleError(_0x1be17a,null));};exports[_0xa32f('0x49')]=function(_0x46f423,_0x24c154){return db[_0xa32f('0x43')][_0xa32f('0x49')](_0x46f423['body'],{})[_0xa32f('0x27')](respondWithResult(_0x24c154,0xc9))[_0xa32f('0x44')](handleError(_0x24c154,null));};exports['update']=function(_0x53ec62,_0xe55959){if(_0x53ec62[_0xa32f('0x4a')]['id']){delete _0x53ec62[_0xa32f('0x4a')]['id'];}return db['Automation'][_0xa32f('0x4b')]({'where':{'id':_0x53ec62['params']['id']}})['then'](handleEntityNotFound(_0xe55959,null))['then'](saveUpdates(_0x53ec62[_0xa32f('0x4a')],null))[_0xa32f('0x27')](respondWithResult(_0xe55959,null))['catch'](handleError(_0xe55959,null));};exports[_0xa32f('0x28')]=function(_0x415488,_0x598946){return db[_0xa32f('0x43')][_0xa32f('0x4b')]({'where':{'id':_0x415488['params']['id']}})[_0xa32f('0x27')](handleEntityNotFound(_0x598946,null))[_0xa32f('0x27')](removeEntity(_0x598946,null))[_0xa32f('0x44')](handleError(_0x598946,null));};exports[_0xa32f('0x4c')]=function(_0x183e73,_0x5a5119,_0x3818e0){return db['Condition'][_0xa32f('0x4b')]({'where':{'id':_0x183e73[_0xa32f('0x46')]['id']}})[_0xa32f('0x27')](handleEntityNotFound(_0x5a5119,null))['then'](function(_0x25c4e0){if(_0x25c4e0){return _0x25c4e0[_0xa32f('0x4c')](_0x183e73[_0xa32f('0x4a')][_0xa32f('0x4d')],_[_0xa32f('0x4e')](_0x183e73['body'],[_0xa32f('0x4d'),'id'])||{});}})[_0xa32f('0x27')](respondWithResult(_0x5a5119,null))['catch'](handleError(_0x5a5119,null));};exports[_0xa32f('0x4f')]=function(_0x3220a1,_0x56f4b8,_0x4917bf){var _0x45c913={};var _0x2e5dde={};var _0x3d9db0;var _0xd19f56;return db[_0xa32f('0x43')][_0xa32f('0x50')]({'where':{'id':_0x3220a1['params']['id']}})[_0xa32f('0x27')](handleEntityNotFound(_0x56f4b8,null))[_0xa32f('0x27')](function(_0x13e202){if(_0x13e202){_0x3d9db0=_0x13e202;_0x2e5dde[_0xa32f('0x31')]=_['keys'](db['Condition'][_0xa32f('0x2e')]);_0x2e5dde[_0xa32f('0x32')]=_[_0xa32f('0x33')](_0x3220a1[_0xa32f('0x32')]);_0x2e5dde[_0xa32f('0x34')]=_[_0xa32f('0x35')](_0x2e5dde['model'],_0x2e5dde[_0xa32f('0x32')]);_0x45c913[_0xa32f('0x36')]=_[_0xa32f('0x35')](_0x2e5dde['model'],qs['fields'](_0x3220a1['query'][_0xa32f('0x37')]));_0x45c913[_0xa32f('0x36')]=_0x45c913[_0xa32f('0x36')]['length']?_0x45c913['attributes']:_0x2e5dde[_0xa32f('0x31')];_0x45c913['order']=qs[_0xa32f('0x3c')](_0x3220a1['query']['sort']);_0x45c913[_0xa32f('0x3d')]=qs[_0xa32f('0x34')](_[_0xa32f('0x3e')](_0x3220a1['query'],_0x2e5dde[_0xa32f('0x34')]));if(_0x3220a1[_0xa32f('0x32')]['filter']){_0x45c913['where']=_[_0xa32f('0x41')](_0x45c913[_0xa32f('0x3d')],{'$or':_['map'](_0x45c913[_0xa32f('0x36')],function(_0x10a9f2){var _0x4f39b2={};_0x4f39b2[_0x10a9f2]={'$like':'%'+_0x3220a1[_0xa32f('0x32')][_0xa32f('0x3f')]+'%'};return _0x4f39b2;})});}_0x45c913=_[_0xa32f('0x41')]({},_0x45c913,_0x3220a1['options']);return _0x3d9db0[_0xa32f('0x4f')](_0x45c913);}})[_0xa32f('0x27')](function(_0x589206){if(_0x589206){_0xd19f56=_0x589206[_0xa32f('0x38')];if(!_0x3220a1['query']['hasOwnProperty'](_0xa32f('0x3a'))){_0x45c913[_0xa32f('0x20')]=qs[_0xa32f('0x20')](_0x3220a1[_0xa32f('0x32')][_0xa32f('0x20')]);_0x45c913[_0xa32f('0x1e')]=qs[_0xa32f('0x1e')](_0x3220a1['query'][_0xa32f('0x1e')]);}return _0x3d9db0['getConditions'](_0x45c913);}})[_0xa32f('0x27')](function(_0x13a4ff){if(_0x13a4ff){return _0x13a4ff?{'count':_0xd19f56,'rows':_0x13a4ff}:null;}})[_0xa32f('0x27')](respondWithResult(_0x56f4b8,null))[_0xa32f('0x44')](handleError(_0x56f4b8,null));};exports[_0xa32f('0x51')]=function(_0x5e227e,_0x570b3c,_0x1db2b8){return db[_0xa32f('0x52')][_0xa32f('0x4b')]({'where':{'id':_0x5e227e['params']['id']}})[_0xa32f('0x27')](handleEntityNotFound(_0x570b3c,null))[_0xa32f('0x27')](function(_0x3fd582){if(_0x3fd582){return _0x3fd582[_0xa32f('0x51')](_0x5e227e['body']['ids'],_[_0xa32f('0x4e')](_0x5e227e[_0xa32f('0x4a')],[_0xa32f('0x4d'),'id'])||{});}})[_0xa32f('0x27')](respondWithResult(_0x570b3c,null))[_0xa32f('0x44')](handleError(_0x570b3c,null));};exports[_0xa32f('0x53')]=function(_0x144285,_0xad25ff,_0x36d8dd){var _0x2861ba={};var _0x2a0555={};var _0x290786;var _0x3ffd4b;return db[_0xa32f('0x43')][_0xa32f('0x50')]({'where':{'id':_0x144285[_0xa32f('0x46')]['id']}})[_0xa32f('0x27')](handleEntityNotFound(_0xad25ff,null))[_0xa32f('0x27')](function(_0x22742b){if(_0x22742b){_0x290786=_0x22742b;_0x2a0555[_0xa32f('0x31')]=_[_0xa32f('0x33')](db['Action'][_0xa32f('0x2e')]);_0x2a0555[_0xa32f('0x32')]=_[_0xa32f('0x33')](_0x144285[_0xa32f('0x32')]);_0x2a0555['filters']=_[_0xa32f('0x35')](_0x2a0555[_0xa32f('0x31')],_0x2a0555['query']);_0x2861ba['attributes']=_[_0xa32f('0x35')](_0x2a0555['model'],qs[_0xa32f('0x37')](_0x144285[_0xa32f('0x32')]['fields']));_0x2861ba['attributes']=_0x2861ba['attributes'][_0xa32f('0x38')]?_0x2861ba[_0xa32f('0x36')]:_0x2a0555['model'];_0x2861ba[_0xa32f('0x3b')]=qs[_0xa32f('0x3c')](_0x144285['query']['sort']);_0x2861ba[_0xa32f('0x3d')]=qs['filters'](_['pick'](_0x144285[_0xa32f('0x32')],_0x2a0555[_0xa32f('0x34')]));if(_0x144285['query'][_0xa32f('0x3f')]){_0x2861ba[_0xa32f('0x3d')]=_[_0xa32f('0x41')](_0x2861ba[_0xa32f('0x3d')],{'$or':_[_0xa32f('0x2d')](_0x2861ba['attributes'],function(_0x5d562b){var _0x49003c={};_0x49003c[_0x5d562b]={'$like':'%'+_0x144285['query'][_0xa32f('0x3f')]+'%'};return _0x49003c;})});}_0x2861ba=_['merge']({},_0x2861ba,_0x144285[_0xa32f('0x48')]);return _0x290786[_0xa32f('0x53')](_0x2861ba);}})[_0xa32f('0x27')](function(_0x5cef41){if(_0x5cef41){_0x3ffd4b=_0x5cef41[_0xa32f('0x38')];if(!_0x144285[_0xa32f('0x32')][_0xa32f('0x39')](_0xa32f('0x3a'))){_0x2861ba[_0xa32f('0x20')]=qs[_0xa32f('0x20')](_0x144285[_0xa32f('0x32')][_0xa32f('0x20')]);_0x2861ba[_0xa32f('0x1e')]=qs[_0xa32f('0x1e')](_0x144285[_0xa32f('0x32')]['offset']);}return _0x290786['getActions'](_0x2861ba);}})[_0xa32f('0x27')](function(_0x410270){if(_0x410270){return _0x410270?{'count':_0x3ffd4b,'rows':_0x410270}:null;}})['then'](respondWithResult(_0xad25ff,null))[_0xa32f('0x44')](handleError(_0xad25ff,null));}; \ No newline at end of file +var _0x8429=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','Automation','rows','show','params','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','findOne','length','order','addActions','getActions','Action','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8429,0x9e));var _0x9842=function(_0x190038,_0x201755){_0x190038=_0x190038-0x0;var _0xfcd94f=_0x8429[_0x190038];return _0xfcd94f;};'use strict';var emlformat=require(_0x9842('0x0'));var rimraf=require(_0x9842('0x1'));var zipdir=require(_0x9842('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9842('0x3'));var moment=require('moment');var BPromise=require(_0x9842('0x4'));var Mustache=require(_0x9842('0x5'));var util=require(_0x9842('0x6'));var path=require(_0x9842('0x7'));var sox=require(_0x9842('0x8'));var csv=require(_0x9842('0x9'));var ejs=require(_0x9842('0xa'));var fs=require('fs');var fs_extra=require(_0x9842('0xb'));var _=require(_0x9842('0xc'));var squel=require(_0x9842('0xd'));var crypto=require(_0x9842('0xe'));var jsforce=require(_0x9842('0xf'));var deskjs=require(_0x9842('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9842('0x11'));var Papa=require(_0x9842('0x12'));var Redis=require(_0x9842('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9842('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9842('0x15'));var logger=require('../../config/logger')(_0x9842('0x16'));var utils=require('../../config/utils');var config=require(_0x9842('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26c65f,_0x35e56f){_0x35e56f=_0x35e56f||0xcc;return function(_0x552cb1){if(_0x552cb1){return _0x26c65f['sendStatus'](_0x35e56f);}return _0x26c65f[_0x9842('0x18')](_0x35e56f)['end']();};}function respondWithResult(_0xfbab50,_0x34f370){_0x34f370=_0x34f370||0xc8;return function(_0x23faab){if(_0x23faab){return _0xfbab50['status'](_0x34f370)[_0x9842('0x19')](_0x23faab);}};}function respondWithFilteredResult(_0x5ba607,_0x5d3e6a){return function(_0x2b0bfc){if(_0x2b0bfc){var _0x4b9065=typeof _0x5d3e6a[_0x9842('0x1a')]===_0x9842('0x1b')&&typeof _0x5d3e6a[_0x9842('0x1c')]===_0x9842('0x1b');var _0x445624=_0x2b0bfc[_0x9842('0x1d')];var _0x197d03=_0x4b9065?0x0:_0x5d3e6a[_0x9842('0x1a')];var _0x536682=_0x4b9065?_0x2b0bfc[_0x9842('0x1d')]:_0x5d3e6a[_0x9842('0x1a')]+_0x5d3e6a['limit'];var _0x172bdc;if(_0x536682>=_0x445624){_0x536682=_0x445624;_0x172bdc=0xc8;}else{_0x172bdc=0xce;}_0x5ba607['status'](_0x172bdc);return _0x5ba607[_0x9842('0x1e')](_0x9842('0x1f'),_0x197d03+'-'+_0x536682+'/'+_0x445624)[_0x9842('0x19')](_0x2b0bfc);}return null;};}function patchUpdates(_0xc6d0e1){return function(_0x2bdf0f){try{jsonpatch[_0x9842('0x20')](_0x2bdf0f,_0xc6d0e1,!![]);}catch(_0x519fab){return BPromise[_0x9842('0x21')](_0x519fab);}return _0x2bdf0f['save']();};}function saveUpdates(_0x3d4992,_0x5b56f6){return function(_0x3b89d1){if(_0x3b89d1){return _0x3b89d1['update'](_0x3d4992)[_0x9842('0x22')](function(_0x46f0d7){return _0x46f0d7;});}return null;};}function removeEntity(_0x1179b4,_0x4a585d){return function(_0x3fba25){if(_0x3fba25){return _0x3fba25[_0x9842('0x23')]()[_0x9842('0x22')](function(){_0x1179b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2dfc,_0x49cbe3){return function(_0x2af236){if(!_0x2af236){_0x5c2dfc[_0x9842('0x24')](0x194);}return _0x2af236;};}function handleError(_0x32273b,_0x3ee347){_0x3ee347=_0x3ee347||0x1f4;return function(_0x2115cc){logger[_0x9842('0x25')](_0x2115cc[_0x9842('0x26')]);if(_0x2115cc[_0x9842('0x27')]){delete _0x2115cc[_0x9842('0x27')];}_0x32273b[_0x9842('0x18')](_0x3ee347)[_0x9842('0x28')](_0x2115cc);};}exports[_0x9842('0x29')]=function(_0x249c1b,_0x5b7b04){var _0x2bbfbe={},_0x3c94f4={},_0x2ee150={'count':0x0,'rows':[]};var _0x420550=_[_0x9842('0x2a')](db['Automation'][_0x9842('0x2b')],function(_0x554160){return{'name':_0x554160[_0x9842('0x2c')],'type':_0x554160[_0x9842('0x2d')]['key']};});_0x3c94f4[_0x9842('0x2e')]=_['map'](_0x420550,_0x9842('0x27'));_0x3c94f4['query']=_[_0x9842('0x2f')](_0x249c1b[_0x9842('0x30')]);_0x3c94f4[_0x9842('0x31')]=_[_0x9842('0x32')](_0x3c94f4[_0x9842('0x2e')],_0x3c94f4['query']);_0x2bbfbe[_0x9842('0x33')]=_[_0x9842('0x32')](_0x3c94f4['model'],qs[_0x9842('0x34')](_0x249c1b[_0x9842('0x30')][_0x9842('0x34')]));_0x2bbfbe[_0x9842('0x33')]=_0x2bbfbe[_0x9842('0x33')]['length']?_0x2bbfbe[_0x9842('0x33')]:_0x3c94f4['model'];if(!_0x249c1b[_0x9842('0x30')][_0x9842('0x35')](_0x9842('0x36'))){_0x2bbfbe[_0x9842('0x1c')]=qs[_0x9842('0x1c')](_0x249c1b['query'][_0x9842('0x1c')]);_0x2bbfbe[_0x9842('0x1a')]=qs[_0x9842('0x1a')](_0x249c1b[_0x9842('0x30')][_0x9842('0x1a')]);}_0x2bbfbe['order']=qs[_0x9842('0x37')](_0x249c1b[_0x9842('0x30')][_0x9842('0x37')]);_0x2bbfbe['where']=qs[_0x9842('0x31')](_[_0x9842('0x38')](_0x249c1b[_0x9842('0x30')],_0x3c94f4[_0x9842('0x31')]),_0x420550);if(_0x249c1b[_0x9842('0x30')][_0x9842('0x39')]){_0x2bbfbe[_0x9842('0x3a')]=_[_0x9842('0x3b')](_0x2bbfbe['where'],{'$or':_['map'](_0x420550,function(_0x4e7c24){if(_0x4e7c24[_0x9842('0x2d')]!==_0x9842('0x3c')){var _0x25fde8={};_0x25fde8[_0x4e7c24[_0x9842('0x27')]]={'$like':'%'+_0x249c1b[_0x9842('0x30')][_0x9842('0x39')]+'%'};return _0x25fde8;}})});}_0x2bbfbe=_['merge']({},_0x2bbfbe,_0x249c1b[_0x9842('0x3d')]);var _0x2fd2cc={'where':_0x2bbfbe['where']};return db['Automation'][_0x9842('0x1d')](_0x2fd2cc)[_0x9842('0x22')](function(_0x13d422){_0x2ee150['count']=_0x13d422;if(_0x249c1b[_0x9842('0x30')][_0x9842('0x3e')]){_0x2bbfbe[_0x9842('0x3f')]=[{'all':!![]}];}return db[_0x9842('0x40')]['findAll'](_0x2bbfbe);})[_0x9842('0x22')](function(_0x142f7b){_0x2ee150[_0x9842('0x41')]=_0x142f7b;return _0x2ee150;})[_0x9842('0x22')](respondWithFilteredResult(_0x5b7b04,_0x2bbfbe))['catch'](handleError(_0x5b7b04,null));};exports[_0x9842('0x42')]=function(_0x1779e4,_0x3a9bcf){var _0x384569={'raw':![],'where':{'id':_0x1779e4[_0x9842('0x43')]['id']}},_0x230ee0={};_0x230ee0[_0x9842('0x2e')]=_['keys'](db['Automation'][_0x9842('0x2b')]);_0x230ee0[_0x9842('0x30')]=_[_0x9842('0x2f')](_0x1779e4[_0x9842('0x30')]);_0x230ee0[_0x9842('0x31')]=_['intersection'](_0x230ee0[_0x9842('0x2e')],_0x230ee0[_0x9842('0x30')]);_0x384569['attributes']=_[_0x9842('0x32')](_0x230ee0['model'],qs['fields'](_0x1779e4[_0x9842('0x30')][_0x9842('0x34')]));_0x384569[_0x9842('0x33')]=_0x384569[_0x9842('0x33')]['length']?_0x384569[_0x9842('0x33')]:_0x230ee0[_0x9842('0x2e')];if(_0x1779e4[_0x9842('0x30')]['includeAll']){_0x384569[_0x9842('0x3f')]=[{'all':!![]}];}_0x384569=_[_0x9842('0x3b')]({},_0x384569,_0x1779e4[_0x9842('0x3d')]);return db[_0x9842('0x40')][_0x9842('0x44')](_0x384569)[_0x9842('0x22')](handleEntityNotFound(_0x3a9bcf,null))[_0x9842('0x22')](respondWithResult(_0x3a9bcf,null))[_0x9842('0x45')](handleError(_0x3a9bcf,null));};exports[_0x9842('0x46')]=function(_0x6c9db6,_0x4d28f9){return db['Automation'][_0x9842('0x46')](_0x6c9db6[_0x9842('0x47')],{})[_0x9842('0x22')](respondWithResult(_0x4d28f9,0xc9))[_0x9842('0x45')](handleError(_0x4d28f9,null));};exports['update']=function(_0x54d7b7,_0x2f2ed2){if(_0x54d7b7[_0x9842('0x47')]['id']){delete _0x54d7b7[_0x9842('0x47')]['id'];}return db['Automation'][_0x9842('0x44')]({'where':{'id':_0x54d7b7[_0x9842('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f2ed2,null))[_0x9842('0x22')](saveUpdates(_0x54d7b7[_0x9842('0x47')],null))[_0x9842('0x22')](respondWithResult(_0x2f2ed2,null))[_0x9842('0x45')](handleError(_0x2f2ed2,null));};exports[_0x9842('0x23')]=function(_0xab2cad,_0x5a5b24){return db[_0x9842('0x40')][_0x9842('0x44')]({'where':{'id':_0xab2cad[_0x9842('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a5b24,null))[_0x9842('0x22')](removeEntity(_0x5a5b24,null))[_0x9842('0x45')](handleError(_0x5a5b24,null));};exports[_0x9842('0x48')]=function(_0x235786,_0x469fa6,_0x233fc4){return db[_0x9842('0x49')][_0x9842('0x44')]({'where':{'id':_0x235786['params']['id']}})[_0x9842('0x22')](handleEntityNotFound(_0x469fa6,null))[_0x9842('0x22')](function(_0x100a01){if(_0x100a01){return _0x100a01[_0x9842('0x48')](_0x235786[_0x9842('0x47')][_0x9842('0x4a')],_[_0x9842('0x4b')](_0x235786[_0x9842('0x47')],['ids','id'])||{});}})[_0x9842('0x22')](respondWithResult(_0x469fa6,null))[_0x9842('0x45')](handleError(_0x469fa6,null));};exports[_0x9842('0x4c')]=function(_0x202e43,_0x11dd6f,_0x399f33){var _0xed9ec2={};var _0x5246c1={};var _0x476663;var _0x39553f;return db[_0x9842('0x40')][_0x9842('0x4d')]({'where':{'id':_0x202e43[_0x9842('0x43')]['id']}})[_0x9842('0x22')](handleEntityNotFound(_0x11dd6f,null))[_0x9842('0x22')](function(_0x163320){if(_0x163320){_0x476663=_0x163320;_0x5246c1[_0x9842('0x2e')]=_[_0x9842('0x2f')](db['Condition'][_0x9842('0x2b')]);_0x5246c1[_0x9842('0x30')]=_[_0x9842('0x2f')](_0x202e43['query']);_0x5246c1['filters']=_[_0x9842('0x32')](_0x5246c1['model'],_0x5246c1[_0x9842('0x30')]);_0xed9ec2[_0x9842('0x33')]=_['intersection'](_0x5246c1[_0x9842('0x2e')],qs[_0x9842('0x34')](_0x202e43[_0x9842('0x30')]['fields']));_0xed9ec2[_0x9842('0x33')]=_0xed9ec2[_0x9842('0x33')][_0x9842('0x4e')]?_0xed9ec2[_0x9842('0x33')]:_0x5246c1['model'];_0xed9ec2[_0x9842('0x4f')]=qs[_0x9842('0x37')](_0x202e43[_0x9842('0x30')][_0x9842('0x37')]);_0xed9ec2[_0x9842('0x3a')]=qs[_0x9842('0x31')](_[_0x9842('0x38')](_0x202e43['query'],_0x5246c1[_0x9842('0x31')]));if(_0x202e43[_0x9842('0x30')][_0x9842('0x39')]){_0xed9ec2[_0x9842('0x3a')]=_[_0x9842('0x3b')](_0xed9ec2['where'],{'$or':_[_0x9842('0x2a')](_0xed9ec2[_0x9842('0x33')],function(_0x528487){var _0xe494e2={};_0xe494e2[_0x528487]={'$like':'%'+_0x202e43[_0x9842('0x30')]['filter']+'%'};return _0xe494e2;})});}_0xed9ec2=_['merge']({},_0xed9ec2,_0x202e43[_0x9842('0x3d')]);return _0x476663[_0x9842('0x4c')](_0xed9ec2);}})['then'](function(_0x3f8dc6){if(_0x3f8dc6){_0x39553f=_0x3f8dc6[_0x9842('0x4e')];if(!_0x202e43['query'][_0x9842('0x35')](_0x9842('0x36'))){_0xed9ec2['limit']=qs[_0x9842('0x1c')](_0x202e43['query']['limit']);_0xed9ec2['offset']=qs[_0x9842('0x1a')](_0x202e43[_0x9842('0x30')]['offset']);}return _0x476663[_0x9842('0x4c')](_0xed9ec2);}})[_0x9842('0x22')](function(_0x58d2f7){if(_0x58d2f7){return _0x58d2f7?{'count':_0x39553f,'rows':_0x58d2f7}:null;}})[_0x9842('0x22')](respondWithResult(_0x11dd6f,null))[_0x9842('0x45')](handleError(_0x11dd6f,null));};exports[_0x9842('0x50')]=function(_0x1f97e4,_0x3871be,_0x1ee9b3){return db['Action'][_0x9842('0x44')]({'where':{'id':_0x1f97e4[_0x9842('0x43')]['id']}})[_0x9842('0x22')](handleEntityNotFound(_0x3871be,null))['then'](function(_0x352331){if(_0x352331){return _0x352331['addActions'](_0x1f97e4[_0x9842('0x47')][_0x9842('0x4a')],_[_0x9842('0x4b')](_0x1f97e4[_0x9842('0x47')],[_0x9842('0x4a'),'id'])||{});}})[_0x9842('0x22')](respondWithResult(_0x3871be,null))[_0x9842('0x45')](handleError(_0x3871be,null));};exports[_0x9842('0x51')]=function(_0x135585,_0x576ea2,_0x1a5f25){var _0x45b493={};var _0x1bb27b={};var _0x3f64d0;var _0x5094a2;return db['Automation'][_0x9842('0x4d')]({'where':{'id':_0x135585[_0x9842('0x43')]['id']}})[_0x9842('0x22')](handleEntityNotFound(_0x576ea2,null))[_0x9842('0x22')](function(_0xd2002f){if(_0xd2002f){_0x3f64d0=_0xd2002f;_0x1bb27b[_0x9842('0x2e')]=_[_0x9842('0x2f')](db[_0x9842('0x52')][_0x9842('0x2b')]);_0x1bb27b[_0x9842('0x30')]=_[_0x9842('0x2f')](_0x135585[_0x9842('0x30')]);_0x1bb27b[_0x9842('0x31')]=_[_0x9842('0x32')](_0x1bb27b[_0x9842('0x2e')],_0x1bb27b[_0x9842('0x30')]);_0x45b493['attributes']=_[_0x9842('0x32')](_0x1bb27b[_0x9842('0x2e')],qs[_0x9842('0x34')](_0x135585['query'][_0x9842('0x34')]));_0x45b493[_0x9842('0x33')]=_0x45b493[_0x9842('0x33')][_0x9842('0x4e')]?_0x45b493['attributes']:_0x1bb27b['model'];_0x45b493['order']=qs[_0x9842('0x37')](_0x135585[_0x9842('0x30')][_0x9842('0x37')]);_0x45b493[_0x9842('0x3a')]=qs[_0x9842('0x31')](_[_0x9842('0x38')](_0x135585[_0x9842('0x30')],_0x1bb27b[_0x9842('0x31')]));if(_0x135585[_0x9842('0x30')][_0x9842('0x39')]){_0x45b493['where']=_[_0x9842('0x3b')](_0x45b493[_0x9842('0x3a')],{'$or':_[_0x9842('0x2a')](_0x45b493[_0x9842('0x33')],function(_0x4f6fb8){var _0x2d233b={};_0x2d233b[_0x4f6fb8]={'$like':'%'+_0x135585[_0x9842('0x30')][_0x9842('0x39')]+'%'};return _0x2d233b;})});}_0x45b493=_[_0x9842('0x3b')]({},_0x45b493,_0x135585[_0x9842('0x3d')]);return _0x3f64d0[_0x9842('0x51')](_0x45b493);}})[_0x9842('0x22')](function(_0x157947){if(_0x157947){_0x5094a2=_0x157947[_0x9842('0x4e')];if(!_0x135585[_0x9842('0x30')]['hasOwnProperty'](_0x9842('0x36'))){_0x45b493[_0x9842('0x1c')]=qs['limit'](_0x135585[_0x9842('0x30')][_0x9842('0x1c')]);_0x45b493['offset']=qs['offset'](_0x135585[_0x9842('0x30')][_0x9842('0x1a')]);}return _0x3f64d0[_0x9842('0x51')](_0x45b493);}})['then'](function(_0x412685){if(_0x412685){return _0x412685?{'count':_0x5094a2,'rows':_0x412685}:null;}})['then'](respondWithResult(_0x576ea2,null))[_0x9842('0x45')](handleError(_0x576ea2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1aee633..2e0d6e9 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 _0x4fb1=['exports','define','Automation','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0x4fb1,0x1a5));var _0x14fb=function(_0x29a8ab,_0x308441){_0x29a8ab=_0x29a8ab-0x0;var _0x340a32=_0x4fb1[_0x29a8ab];return _0x340a32;};'use strict';var _=require(_0x14fb('0x0'));var util=require(_0x14fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x14fb('0x2'));var BPromise=require(_0x14fb('0x3'));var rp=require(_0x14fb('0x4'));var fs=require('fs');var path=require(_0x14fb('0x5'));var rimraf=require('rimraf');var config=require(_0x14fb('0x6'));var attributes=require(_0x14fb('0x7'));module[_0x14fb('0x8')]=function(_0x3bc51e,_0x5657f2){return _0x3bc51e[_0x14fb('0x9')](_0x14fb('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x755c=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash'];(function(_0x5ccc32,_0x170e07){var _0x320e8f=function(_0x1c3a2a){while(--_0x1c3a2a){_0x5ccc32['push'](_0x5ccc32['shift']());}};_0x320e8f(++_0x170e07);}(_0x755c,0x167));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require(_0xc755('0x1'));var logger=require(_0xc755('0x2'))('api');var moment=require(_0xc755('0x3'));var BPromise=require(_0xc755('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc755('0x5'));var rimraf=require(_0xc755('0x6'));var config=require(_0xc755('0x7'));var attributes=require(_0xc755('0x8'));module['exports']=function(_0x3820b5,_0xa496e6){return _0x3820b5[_0xc755('0x9')](_0xc755('0xa'),attributes,{'tableName':_0xc755('0xb'),'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 27dc430..80c244a 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 _0x9ab9=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5bf80e,_0x3120e2){var _0xd5da57=function(_0x40d795){while(--_0x40d795){_0x5bf80e['push'](_0x5bf80e['shift']());}};_0xd5da57(++_0x3120e2);}(_0x9ab9,0x19d));var _0x99ab=function(_0x462bd7,_0x40429b){_0x462bd7=_0x462bd7-0x0;var _0x3281c7=_0x9ab9[_0x462bd7];return _0x3281c7;};'use strict';var _=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var moment=require(_0x99ab('0x2'));var BPromise=require(_0x99ab('0x3'));var rs=require(_0x99ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99ab('0x5'))['db'];var utils=require(_0x99ab('0x6'));var logger=require('../../config/logger')(_0x99ab('0x7'));var config=require('../../config/environment');var jayson=require(_0x99ab('0x8'));var client=jayson[_0x99ab('0x9')][_0x99ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x249c1f,_0x1d2cb7,_0x513653){return new BPromise(function(_0x5762c1,_0x3f5a2c){return client[_0x99ab('0xb')](_0x249c1f,_0x513653)['then'](function(_0x14d083){logger[_0x99ab('0xc')](_0x99ab('0xd'),_0x1d2cb7,_0x99ab('0xe'));logger[_0x99ab('0xf')](_0x99ab('0x10'),_0x1d2cb7,'request\x20sent',JSON[_0x99ab('0x11')](_0x14d083));if(_0x14d083[_0x99ab('0x12')]){if(_0x14d083[_0x99ab('0x12')]['code']===0x1f4){logger['error'](_0x99ab('0xd'),_0x1d2cb7,_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);return _0x3f5a2c(_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);}logger[_0x99ab('0x12')]('Automation,\x20%s,\x20%s',_0x1d2cb7,_0x14d083[_0x99ab('0x12')][_0x99ab('0x13')]);return _0x5762c1(_0x14d083['error'][_0x99ab('0x13')]);}else{logger[_0x99ab('0xc')](_0x99ab('0xd'),_0x1d2cb7,'request\x20sent');_0x5762c1(_0x14d083[_0x99ab('0x14')][_0x99ab('0x13')]);}})[_0x99ab('0x15')](function(_0x31b340){logger[_0x99ab('0x12')](_0x99ab('0xd'),_0x1d2cb7,_0x31b340);_0x3f5a2c(_0x31b340);});});} \ No newline at end of file +var _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x3e9ee3,_0x1d71b2){var _0x157918=function(_0x4381c5){while(--_0x4381c5){_0x3e9ee3['push'](_0x3e9ee3['shift']());}};_0x157918(++_0x1d71b2);}(_0x19e1,0x163));var _0x119e=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0x19e1[_0x16bb0e];return _0x102b8b;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('Automation,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5acdef9..31c495a 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 _0x9009=['addActions','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','/:id','show','/:id/conditions','isAuthenticated','/:id/actions','getActions','post'];(function(_0x511483,_0x1adcf5){var _0x22b022=function(_0x4bb7d0){while(--_0x4bb7d0){_0x511483['push'](_0x511483['shift']());}};_0x22b022(++_0x1adcf5);}(_0x9009,0x1d4));var _0x9900=function(_0x443cec,_0x18850e){_0x443cec=_0x443cec-0x0;var _0x27327e=_0x9009[_0x443cec];return _0x27327e;};'use strict';var multer=require(_0x9900('0x0'));var util=require('util');var path=require(_0x9900('0x1'));var timeout=require(_0x9900('0x2'));var express=require('express');var router=express[_0x9900('0x3')]();var fs_extra=require(_0x9900('0x4'));var auth=require(_0x9900('0x5'));var interaction=require(_0x9900('0x6'));var config=require('../../config/environment');var controller=require(_0x9900('0x7'));router[_0x9900('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9900('0x8')](_0x9900('0x9'),auth['isAuthenticated'](),controller[_0x9900('0xa')]);router[_0x9900('0x8')](_0x9900('0xb'),auth[_0x9900('0xc')](),controller['getConditions']);router[_0x9900('0x8')](_0x9900('0xd'),auth[_0x9900('0xc')](),controller[_0x9900('0xe')]);router[_0x9900('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9900('0xf')](_0x9900('0xb'),auth['isAuthenticated'](),controller['addConditions']);router[_0x9900('0xf')]('/:id/actions',auth[_0x9900('0xc')](),controller[_0x9900('0x10')]);router[_0x9900('0x11')](_0x9900('0x9'),auth[_0x9900('0xc')](),controller[_0x9900('0x12')]);router[_0x9900('0x13')](_0x9900('0x9'),auth[_0x9900('0xc')](),controller[_0x9900('0x14')]);module[_0x9900('0x15')]=router; \ No newline at end of file +var _0x891b=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index','show','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions','post','create','addConditions','put','/:id','delete','destroy','path'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x891b,0xc5));var _0xb891=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x891b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var fs_extra=require(_0xb891('0x3'));var auth=require(_0xb891('0x4'));var interaction=require(_0xb891('0x5'));var config=require('../../config/environment');var controller=require(_0xb891('0x6'));router[_0xb891('0x7')]('/',auth['isAuthenticated'](),controller[_0xb891('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb891('0x9')]);router[_0xb891('0x7')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0xc')]);router[_0xb891('0x7')](_0xb891('0xd'),auth['isAuthenticated'](),controller[_0xb891('0xe')]);router[_0xb891('0xf')]('/',auth[_0xb891('0xb')](),controller[_0xb891('0x10')]);router[_0xb891('0xf')](_0xb891('0xa'),auth[_0xb891('0xb')](),controller[_0xb891('0x11')]);router[_0xb891('0xf')](_0xb891('0xd'),auth[_0xb891('0xb')](),controller['addActions']);router[_0xb891('0x12')](_0xb891('0x13'),auth[_0xb891('0xb')](),controller['update']);router[_0xb891('0x14')](_0xb891('0x13'),auth['isAuthenticated'](),controller[_0xb891('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 97c2140..a7aa3a4 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 _0x5b4e=['#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,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4c5069,_0x41354d){var _0x6a9c45=function(_0x294110){while(--_0x294110){_0x4c5069['push'](_0x4c5069['shift']());}};_0x6a9c45(++_0x41354d);}(_0x5b4e,0x10a));var _0xe5b4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5b4e[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xe5b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5b4('0x1')],'unique':_0xe5b4('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe5b4('0x3')](_0xe5b4('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xe5b4('0x1')]},'active':{'type':Sequelize[_0xe5b4('0x5')],'defaultValue':0x0,'comment':_0xe5b4('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe5b4('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe5b4('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe5b4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b4('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b4('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b4('0xc')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b4('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'comment':_0xe5b4('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b4('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe5b4('0x10')},'dialTimezone':{'type':Sequelize[_0xe5b4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe5b4('0x1')],'defaultValue':_0xe5b4('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xe5b4('0x12'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe5b4('0x5')],'defaultValue':0x0,'comment':_0xe5b4('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xe5b4('0x9')](0x9)[_0xe5b4('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe5b4('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xe5b4('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe5b4('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe5b4('0x9')](0x9)[_0xe5b4('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe5b4('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe5b4('0x9')](0x9)[_0xe5b4('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe5b4('0x9')](0x9)[_0xe5b4('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe5b4('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe5b4('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe5b4('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe5b4('0x9')](0x9)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe5b4('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe5b4('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe5b4('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe5b4('0x3')](_0xe5b4('0x1b'),_0xe5b4('0x1c')),'defaultValue':_0xe5b4('0x1b')},'dialPrefix':{'type':Sequelize[_0xe5b4('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe5b4('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe5b4('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe5b4('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5b4('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)[_0xe5b4('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xe5b4('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b4('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe5b4('0x9')](0x3)[_0xe5b4('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5b4('0x22')}}; \ No newline at end of file +var _0xf056=['sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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)'];(function(_0x374fb0,_0x6f2868){var _0x4cfbd2=function(_0x5db0c8){while(--_0x5db0c8){_0x374fb0['push'](_0x374fb0['shift']());}};_0x4cfbd2(++_0x6f2868);}(_0xf056,0x186));var _0x6f05=function(_0x2aa296,_0x31bfda){_0x2aa296=_0x2aa296-0x0;var _0xe9b5eb=_0xf056[_0x2aa296];return _0xe9b5eb;};'use strict';var Sequelize=require(_0x6f05('0x0'));module[_0x6f05('0x1')]={'name':{'type':Sequelize[_0x6f05('0x2')],'unique':_0x6f05('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6f05('0x4')](_0x6f05('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x6f05('0x2')]},'active':{'type':Sequelize[_0x6f05('0x6')],'defaultValue':0x0,'comment':_0x6f05('0x7')},'limitCalls':{'type':Sequelize[_0x6f05('0x8')](0x4)[_0x6f05('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6f05('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6f05('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x6f05('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x6f05('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6f05('0xf')},'dialTimezone':{'type':Sequelize[_0x6f05('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x6f05('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6f05('0x10'),'never',_0x6f05('0x11')),'defaultValue':_0x6f05('0x10')},'dialAMDActive':{'type':Sequelize[_0x6f05('0x6')],'defaultValue':0x0,'comment':_0x6f05('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x6f05('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6f05('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x6f05('0x8')](0x9)[_0x6f05('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6f05('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6f05('0x8')](0x9)[_0x6f05('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6f05('0x8')](0x9)[_0x6f05('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6f05('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6f05('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6f05('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6f05('0x8')](0x9)[_0x6f05('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6f05('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6f05('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6f05('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6f05('0x8')](0x9)[_0x6f05('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6f05('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6f05('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6f05('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6f05('0x1b')},'dialCutDigit':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6f05('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)[_0x6f05('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)[_0x6f05('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6f05('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6f05('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6f05('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6f05('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e2f55a6..c46d7e3 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 _0x4787=['dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','select','field','ContactId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','CmListId','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','NOW()','ci.item','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','undefined','limit','count','offset','json','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','status','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','params','create','body','get','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread'];(function(_0x5aed69,_0x259b5e){var _0x48b0f9=function(_0x31e169){while(--_0x31e169){_0x5aed69['push'](_0x5aed69['shift']());}};_0x48b0f9(++_0x259b5e);}(_0x4787,0x148));var _0x7478=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4787[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7478('0x0'));var zipdir=require(_0x7478('0x1'));var jsonpatch=require(_0x7478('0x2'));var rp=require('request-promise');var moment=require(_0x7478('0x3'));var BPromise=require(_0x7478('0x4'));var Mustache=require('mustache');var util=require(_0x7478('0x5'));var path=require(_0x7478('0x6'));var sox=require(_0x7478('0x7'));var csv=require(_0x7478('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7478('0x9'));var squel=require(_0x7478('0xa'));var crypto=require(_0x7478('0xb'));var jsforce=require(_0x7478('0xc'));var deskjs=require(_0x7478('0xd'));var toCsv=require(_0x7478('0x8'));var querystring=require(_0x7478('0xe'));var Papa=require(_0x7478('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7478('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7478('0x11'));var logger=require('../../config/logger')(_0x7478('0x12'));var utils=require('../../config/utils');var config=require(_0x7478('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7478('0x14'))['db'];function respondWithStatusCode(_0x10229d,_0x5d8c4b){_0x5d8c4b=_0x5d8c4b||0xcc;return function(_0x4842cc){if(_0x4842cc){return _0x10229d['sendStatus'](_0x5d8c4b);}return _0x10229d['status'](_0x5d8c4b)[_0x7478('0x15')]();};}function respondWithResult(_0x1c30fa,_0xd1fbce){_0xd1fbce=_0xd1fbce||0xc8;return function(_0x2b3d18){if(_0x2b3d18){return _0x1c30fa['status'](_0xd1fbce)['json'](_0x2b3d18);}};}function respondWithFilteredResult(_0x42056f,_0x5802ea){return function(_0x119a79){if(_0x119a79){var _0xc6e796=typeof _0x5802ea['offset']===_0x7478('0x16')&&typeof _0x5802ea[_0x7478('0x17')]===_0x7478('0x16');var _0xfe2418=_0x119a79[_0x7478('0x18')];var _0x285a45=_0xc6e796?0x0:_0x5802ea['offset'];var _0x4a745b=_0xc6e796?_0x119a79[_0x7478('0x18')]:_0x5802ea[_0x7478('0x19')]+_0x5802ea['limit'];var _0x2ad042;if(_0x4a745b>=_0xfe2418){_0x4a745b=_0xfe2418;_0x2ad042=0xc8;}else{_0x2ad042=0xce;}_0x42056f['status'](_0x2ad042);return _0x42056f['set']('Content-Range',_0x285a45+'-'+_0x4a745b+'/'+_0xfe2418)[_0x7478('0x1a')](_0x119a79);}return null;};}function patchUpdates(_0x56f1aa){return function(_0x188f72){try{jsonpatch['apply'](_0x188f72,_0x56f1aa,!![]);}catch(_0x58b205){return BPromise[_0x7478('0x1b')](_0x58b205);}return _0x188f72[_0x7478('0x1c')]();};}function saveUpdates(_0x2e34dc,_0x1efa48){return function(_0x44312c){if(_0x44312c){return _0x44312c[_0x7478('0x1d')](_0x2e34dc)[_0x7478('0x1e')](function(_0x71aade){return _0x71aade;});}return null;};}function removeEntity(_0x134a6b,_0x4a1001){return function(_0x2fa727){if(_0x2fa727){return _0x2fa727['destroy']()['then'](function(){var _0x43b3d2=_0x2fa727['get']({'plain':!![]});var _0x367edc=_0x7478('0x1f');return db[_0x7478('0x20')][_0x7478('0x21')]({'where':{'type':_0x367edc,'resourceId':_0x43b3d2['id']}})['then'](function(){return _0x2fa727;});})[_0x7478('0x1e')](function(){_0x134a6b[_0x7478('0x22')](0xcc)[_0x7478('0x15')]();});}};}function handleEntityNotFound(_0x57b712,_0x39d1a2){return function(_0x3751c1){if(!_0x3751c1){_0x57b712[_0x7478('0x23')](0x194);}return _0x3751c1;};}function handleError(_0x463cec,_0x29de48){_0x29de48=_0x29de48||0x1f4;return function(_0x235630){logger[_0x7478('0x24')](_0x235630[_0x7478('0x25')]);if(_0x235630[_0x7478('0x26')]){delete _0x235630['name'];}_0x463cec[_0x7478('0x22')](_0x29de48)[_0x7478('0x27')](_0x235630);};}exports[_0x7478('0x28')]=function(_0x4e4d43,_0x11aa4d){var _0xab5870={},_0x1f316f={},_0x45b653={'count':0x0,'rows':[]};var _0xf5dcca=_[_0x7478('0x29')](db[_0x7478('0x2a')][_0x7478('0x2b')],function(_0x600039){return{'name':_0x600039[_0x7478('0x2c')],'type':_0x600039['type']['key']};});_0x1f316f[_0x7478('0x2d')]=_[_0x7478('0x29')](_0xf5dcca,_0x7478('0x26'));_0x1f316f[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0x4e4d43[_0x7478('0x2e')]);_0x1f316f[_0x7478('0x30')]=_[_0x7478('0x31')](_0x1f316f[_0x7478('0x2d')],_0x1f316f[_0x7478('0x2e')]);_0xab5870[_0x7478('0x32')]=_[_0x7478('0x31')](_0x1f316f[_0x7478('0x2d')],qs[_0x7478('0x33')](_0x4e4d43[_0x7478('0x2e')][_0x7478('0x33')]));_0xab5870['attributes']=_0xab5870[_0x7478('0x32')][_0x7478('0x34')]?_0xab5870[_0x7478('0x32')]:_0x1f316f[_0x7478('0x2d')];if(!_0x4e4d43['query'][_0x7478('0x35')](_0x7478('0x36'))){_0xab5870[_0x7478('0x17')]=qs[_0x7478('0x17')](_0x4e4d43['query'][_0x7478('0x17')]);_0xab5870[_0x7478('0x19')]=qs[_0x7478('0x19')](_0x4e4d43[_0x7478('0x2e')]['offset']);}_0xab5870[_0x7478('0x37')]=qs[_0x7478('0x38')](_0x4e4d43[_0x7478('0x2e')][_0x7478('0x38')]);_0xab5870[_0x7478('0x39')]=qs['filters'](_[_0x7478('0x3a')](_0x4e4d43[_0x7478('0x2e')],_0x1f316f['filters']),_0xf5dcca);if(_0x4e4d43[_0x7478('0x2e')][_0x7478('0x3b')]){_0xab5870['where']=_['merge'](_0xab5870[_0x7478('0x39')],{'$or':_[_0x7478('0x29')](_0xf5dcca,function(_0x43df9f){if(_0x43df9f[_0x7478('0x3c')]!==_0x7478('0x3d')){var _0x5d1862={};_0x5d1862[_0x43df9f[_0x7478('0x26')]]={'$like':'%'+_0x4e4d43['query']['filter']+'%'};return _0x5d1862;}})});}_0xab5870=_[_0x7478('0x3e')]({},_0xab5870,_0x4e4d43[_0x7478('0x3f')]);var _0x1e59f5={'where':_0xab5870[_0x7478('0x39')]};return db[_0x7478('0x2a')][_0x7478('0x18')](_0x1e59f5)['then'](function(_0x4745c9){_0x45b653[_0x7478('0x18')]=_0x4745c9;if(_0x4e4d43[_0x7478('0x2e')][_0x7478('0x40')]){_0xab5870['include']=[{'all':!![]}];}return db[_0x7478('0x2a')]['findAll'](_0xab5870);})[_0x7478('0x1e')](function(_0x283c74){_0x45b653[_0x7478('0x41')]=_0x283c74;return _0x45b653;})[_0x7478('0x1e')](respondWithFilteredResult(_0x11aa4d,_0xab5870))[_0x7478('0x42')](handleError(_0x11aa4d,null));};exports[_0x7478('0x43')]=function(_0x109a44,_0x2bd18a){var _0x3b412e={'raw':![],'where':{'id':_0x109a44[_0x7478('0x44')]['id']}},_0x3fae0={};_0x3fae0[_0x7478('0x2d')]=_['keys'](db[_0x7478('0x2a')]['rawAttributes']);_0x3fae0['query']=_[_0x7478('0x2f')](_0x109a44['query']);_0x3fae0[_0x7478('0x30')]=_['intersection'](_0x3fae0[_0x7478('0x2d')],_0x3fae0[_0x7478('0x2e')]);_0x3b412e[_0x7478('0x32')]=_[_0x7478('0x31')](_0x3fae0[_0x7478('0x2d')],qs[_0x7478('0x33')](_0x109a44[_0x7478('0x2e')][_0x7478('0x33')]));_0x3b412e[_0x7478('0x32')]=_0x3b412e[_0x7478('0x32')]['length']?_0x3b412e[_0x7478('0x32')]:_0x3fae0[_0x7478('0x2d')];if(_0x109a44[_0x7478('0x2e')][_0x7478('0x40')]){_0x3b412e['include']=[{'all':!![]}];}_0x3b412e=_[_0x7478('0x3e')]({},_0x3b412e,_0x109a44['options']);return db['Campaign']['find'](_0x3b412e)[_0x7478('0x1e')](handleEntityNotFound(_0x2bd18a,null))[_0x7478('0x1e')](respondWithResult(_0x2bd18a,null))['catch'](handleError(_0x2bd18a,null));};exports['create']=function(_0x47c67a,_0x56a060){return db[_0x7478('0x2a')][_0x7478('0x45')](_0x47c67a[_0x7478('0x46')],{})['then'](function(_0x2a4616){var _0x5a35a7=_0x47c67a['user'][_0x7478('0x47')]({'plain':!![]});if(!_0x5a35a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a35a7['role']===_0x7478('0x48')){var _0x12119b=_0x2a4616[_0x7478('0x47')]({'plain':!![]});var _0x2aa98d=_0x7478('0x1f');return db[_0x7478('0x49')][_0x7478('0x4a')]({'where':{'name':_0x2aa98d,'userProfileId':_0x5a35a7[_0x7478('0x4b')]},'raw':!![]})[_0x7478('0x1e')](function(_0x566258){if(_0x566258&&_0x566258[_0x7478('0x4c')]===0x0){return db[_0x7478('0x20')][_0x7478('0x45')]({'name':_0x12119b['name'],'resourceId':_0x12119b['id'],'type':_0x566258[_0x7478('0x26')],'sectionId':_0x566258['id']},{})['then'](function(){return _0x2a4616;});}else{return _0x2a4616;}})[_0x7478('0x42')](function(_0x5352ba){logger[_0x7478('0x24')](_0x7478('0x4d'),_0x5352ba);throw _0x5352ba;});}return _0x2a4616;})[_0x7478('0x1e')](respondWithResult(_0x56a060,0xc9))[_0x7478('0x42')](handleError(_0x56a060,null));};exports[_0x7478('0x4e')]=function(_0x59e509,_0x33c4c8){var _0x50f0eb={'where':{'id':_0x59e509[_0x7478('0x44')]['id']}},_0x7804e2={};_0x7804e2[_0x7478('0x2d')]=_[_0x7478('0x2f')](db[_0x7478('0x2a')][_0x7478('0x2b')]);_0x50f0eb[_0x7478('0x32')]=_[_0x7478('0x31')](_0x7804e2[_0x7478('0x2d')],qs[_0x7478('0x33')](_0x59e509[_0x7478('0x2e')][_0x7478('0x33')]));_0x50f0eb[_0x7478('0x32')]=_0x50f0eb[_0x7478('0x32')]['length']?_0x50f0eb['attributes']:_0x7804e2[_0x7478('0x2d')];if(_0x59e509['query']['includeAll']){_0x50f0eb[_0x7478('0x4f')]=[{'all':!![]}];}_0x50f0eb=_[_0x7478('0x3e')]({},_0x50f0eb,_0x59e509['options']);return db[_0x7478('0x2a')]['find'](_0x50f0eb)[_0x7478('0x1e')](handleEntityNotFound(_0x33c4c8,null))['then'](function(_0x447757){if(_0x447757){var _0x4d0c39=_0x447757[_0x7478('0x47')]({'plain':!![]});_0x4d0c39=qs[_0x7478('0x50')](_0x4d0c39,['id','createdAt',_0x7478('0x51')]);_0x59e509['body']=_[_0x7478('0x50')](_0x59e509['body'],['id','createdAt',_0x7478('0x51')]);return db[_0x7478('0x2a')][_0x7478('0x45')](_['merge'](_0x4d0c39,_0x59e509[_0x7478('0x46')]),{'include':_0x59e509['query'][_0x7478('0x40')]?[{'all':!![]}]:undefined})[_0x7478('0x1e')](function(_0x4eb20b){var _0x252a5b=_0x59e509[_0x7478('0x48')][_0x7478('0x47')]({'plain':!![]});if(!_0x252a5b)throw new Error(_0x7478('0x52'));if(_0x252a5b[_0x7478('0x53')]===_0x7478('0x48')){var _0x37065f=_0x4eb20b[_0x7478('0x47')]({'plain':!![]});var _0x49b1f3=_0x7478('0x1f');return db['UserProfileSection']['find']({'where':{'name':_0x49b1f3,'userProfileId':_0x252a5b['userProfileId']},'raw':!![]})[_0x7478('0x1e')](function(_0x53b94b){if(_0x53b94b&&_0x53b94b[_0x7478('0x4c')]===0x0){return db[_0x7478('0x20')][_0x7478('0x45')]({'name':_0x37065f[_0x7478('0x26')],'resourceId':_0x37065f['id'],'type':_0x53b94b[_0x7478('0x26')],'sectionId':_0x53b94b['id']},{})['then'](function(){return _0x4eb20b;});}else{return _0x4eb20b;}})[_0x7478('0x42')](function(_0x7094ab){logger['error'](_0x7478('0x4d'),_0x7094ab);throw _0x7094ab;});}return _0x4eb20b;});}})[_0x7478('0x1e')](respondWithResult(_0x33c4c8,0xc9))[_0x7478('0x42')](handleError(_0x33c4c8,null));};exports[_0x7478('0x1d')]=function(_0x272d88,_0x1a96ec){if(_0x272d88['body']['id']){delete _0x272d88[_0x7478('0x46')]['id'];}return db[_0x7478('0x2a')][_0x7478('0x4a')]({'where':{'id':_0x272d88[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x1a96ec,null))[_0x7478('0x1e')](saveUpdates(_0x272d88[_0x7478('0x46')],null))[_0x7478('0x1e')](respondWithResult(_0x1a96ec,null))['catch'](handleError(_0x1a96ec,null));};exports[_0x7478('0x21')]=function(_0x2864a2,_0x18c6d8){return db[_0x7478('0x2a')][_0x7478('0x4a')]({'where':{'id':_0x2864a2[_0x7478('0x44')]['id']}})['then'](handleEntityNotFound(_0x18c6d8,null))[_0x7478('0x1e')](removeEntity(_0x18c6d8,null))[_0x7478('0x42')](handleError(_0x18c6d8,null));};exports[_0x7478('0x54')]=function(_0x2ce284,_0x43b868,_0xc2dd8e){var _0x1b864b={'raw':!![],'where':{}};var _0x4ad05a={};var _0x278d84={'count':0x0,'rows':[]};return db['Campaign'][_0x7478('0x55')]({'where':{'id':_0x2ce284[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x43b868,null))[_0x7478('0x1e')](function(_0x535da7){if(_0x535da7){_0x4ad05a[_0x7478('0x2d')]=_[_0x7478('0x2f')](db[_0x7478('0x56')][_0x7478('0x2b')]);_0x4ad05a[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0x2ce284[_0x7478('0x2e')]);_0x4ad05a[_0x7478('0x30')]=_[_0x7478('0x31')](_0x4ad05a['model'],_0x4ad05a[_0x7478('0x2e')]);_0x1b864b['attributes']=_['intersection'](_0x4ad05a[_0x7478('0x2d')],qs[_0x7478('0x33')](_0x2ce284[_0x7478('0x2e')]['fields']));_0x1b864b[_0x7478('0x32')]=_0x1b864b[_0x7478('0x32')][_0x7478('0x34')]?_0x1b864b['attributes']:_0x4ad05a[_0x7478('0x2d')];if(!_0x2ce284[_0x7478('0x2e')][_0x7478('0x35')](_0x7478('0x36'))){_0x1b864b[_0x7478('0x17')]=qs[_0x7478('0x17')](_0x2ce284[_0x7478('0x2e')][_0x7478('0x17')]);_0x1b864b[_0x7478('0x19')]=qs[_0x7478('0x19')](_0x2ce284[_0x7478('0x2e')][_0x7478('0x19')]);}_0x1b864b[_0x7478('0x37')]=qs[_0x7478('0x38')](_0x2ce284[_0x7478('0x2e')][_0x7478('0x38')]);_0x1b864b[_0x7478('0x39')]=qs[_0x7478('0x30')](_[_0x7478('0x3a')](_0x2ce284[_0x7478('0x2e')],_0x4ad05a[_0x7478('0x30')]));_0x1b864b[_0x7478('0x39')][_0x7478('0x57')]=_0x535da7['id'];if(_0x2ce284[_0x7478('0x2e')][_0x7478('0x3b')]){_0x1b864b[_0x7478('0x39')]=_[_0x7478('0x3e')](_0x1b864b[_0x7478('0x39')],{'$or':_['map'](_0x1b864b[_0x7478('0x32')],function(_0x515aa5){var _0x18d381={};_0x18d381[_0x515aa5]={'$like':'%'+_0x2ce284['query'][_0x7478('0x3b')]+'%'};return _0x18d381;})});}_0x1b864b=_[_0x7478('0x3e')]({},_0x1b864b,_0x2ce284[_0x7478('0x3f')]);return db[_0x7478('0x56')][_0x7478('0x18')]({'where':_0x1b864b[_0x7478('0x39')]})[_0x7478('0x1e')](function(_0x1706db){_0x278d84[_0x7478('0x18')]=_0x1706db;if(_0x2ce284[_0x7478('0x2e')]['includeAll']){_0x1b864b[_0x7478('0x4f')]=[{'all':!![]}];}return db[_0x7478('0x56')][_0x7478('0x58')](_0x1b864b);})[_0x7478('0x1e')](function(_0x51858b){_0x278d84[_0x7478('0x41')]=_0x51858b;return _0x278d84;});}})[_0x7478('0x1e')](respondWithFilteredResult(_0x43b868,_0x1b864b))[_0x7478('0x42')](handleError(_0x43b868,null));};exports[_0x7478('0x59')]=function(_0x11719f,_0x452247,_0x11d818){var _0x495abd={'raw':!![],'where':{}};var _0x304641={};var _0x332520={'count':0x0,'rows':[]};return db['Campaign'][_0x7478('0x55')]({'where':{'id':_0x11719f[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x452247,null))[_0x7478('0x1e')](function(_0x37ae8e){if(_0x37ae8e){_0x304641[_0x7478('0x2d')]=_[_0x7478('0x2f')](db[_0x7478('0x5a')][_0x7478('0x2b')]);_0x304641[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0x11719f[_0x7478('0x2e')]);_0x304641[_0x7478('0x30')]=_['intersection'](_0x304641[_0x7478('0x2d')],_0x304641[_0x7478('0x2e')]);_0x495abd[_0x7478('0x32')]=_['intersection'](_0x304641[_0x7478('0x2d')],qs[_0x7478('0x33')](_0x11719f[_0x7478('0x2e')]['fields']));_0x495abd[_0x7478('0x32')]=_0x495abd[_0x7478('0x32')]['length']?_0x495abd[_0x7478('0x32')]:_0x304641[_0x7478('0x2d')];if(!_0x11719f[_0x7478('0x2e')][_0x7478('0x35')](_0x7478('0x36'))){_0x495abd['limit']=qs[_0x7478('0x17')](_0x11719f[_0x7478('0x2e')][_0x7478('0x17')]);_0x495abd[_0x7478('0x19')]=qs[_0x7478('0x19')](_0x11719f[_0x7478('0x2e')][_0x7478('0x19')]);}_0x495abd[_0x7478('0x37')]=qs[_0x7478('0x38')](_0x11719f[_0x7478('0x2e')][_0x7478('0x38')]);_0x495abd['where']=qs[_0x7478('0x30')](_[_0x7478('0x3a')](_0x11719f[_0x7478('0x2e')],_0x304641[_0x7478('0x30')]));_0x495abd[_0x7478('0x39')][_0x7478('0x57')]=_0x37ae8e['id'];if(_0x11719f[_0x7478('0x2e')][_0x7478('0x3b')]){_0x495abd[_0x7478('0x39')]=_[_0x7478('0x3e')](_0x495abd['where'],{'$or':_[_0x7478('0x29')](_0x495abd['attributes'],function(_0x335afc){var _0x2a7781={};_0x2a7781[_0x335afc]={'$like':'%'+_0x11719f[_0x7478('0x2e')][_0x7478('0x3b')]+'%'};return _0x2a7781;})});}_0x495abd=_[_0x7478('0x3e')]({},_0x495abd,_0x11719f['options']);return db[_0x7478('0x5a')][_0x7478('0x18')]({'where':_0x495abd[_0x7478('0x39')]})[_0x7478('0x1e')](function(_0x189123){_0x332520['count']=_0x189123;if(_0x11719f[_0x7478('0x2e')][_0x7478('0x40')]){_0x495abd[_0x7478('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7478('0x58')](_0x495abd);})[_0x7478('0x1e')](function(_0x327e06){_0x332520[_0x7478('0x41')]=_0x327e06;return _0x332520;});}})['then'](respondWithFilteredResult(_0x452247,_0x495abd))['catch'](handleError(_0x452247,null));};exports[_0x7478('0x5b')]=function(_0xa293d1,_0x1e03ae,_0x3d1ac0){var _0x33049f={'raw':!![],'where':{}};var _0x3d9e98={};var _0xdbab05={'count':0x0,'rows':[]};return db[_0x7478('0x2a')][_0x7478('0x55')]({'where':{'id':_0xa293d1['params']['id']}})['then'](handleEntityNotFound(_0x1e03ae,null))[_0x7478('0x1e')](function(_0x2da6ef){if(_0x2da6ef){_0x3d9e98[_0x7478('0x2d')]=_[_0x7478('0x2f')](db['CmHopperFinal'][_0x7478('0x2b')]);_0x3d9e98[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0xa293d1[_0x7478('0x2e')]);_0x3d9e98[_0x7478('0x30')]=_[_0x7478('0x31')](_0x3d9e98[_0x7478('0x2d')],_0x3d9e98['query']);_0x33049f[_0x7478('0x32')]=_[_0x7478('0x31')](_0x3d9e98[_0x7478('0x2d')],qs['fields'](_0xa293d1[_0x7478('0x2e')][_0x7478('0x33')]));_0x33049f[_0x7478('0x32')]=_0x33049f[_0x7478('0x32')]['length']?_0x33049f[_0x7478('0x32')]:_0x3d9e98[_0x7478('0x2d')];if(!_0xa293d1[_0x7478('0x2e')]['hasOwnProperty'](_0x7478('0x36'))){_0x33049f['limit']=qs[_0x7478('0x17')](_0xa293d1[_0x7478('0x2e')][_0x7478('0x17')]);_0x33049f['offset']=qs[_0x7478('0x19')](_0xa293d1[_0x7478('0x2e')][_0x7478('0x19')]);}_0x33049f[_0x7478('0x37')]=qs[_0x7478('0x38')](_0xa293d1[_0x7478('0x2e')][_0x7478('0x38')]);_0x33049f[_0x7478('0x39')]=qs[_0x7478('0x30')](_[_0x7478('0x3a')](_0xa293d1[_0x7478('0x2e')],_0x3d9e98[_0x7478('0x30')]));_0x33049f['where'][_0x7478('0x57')]=_0x2da6ef['id'];if(_0xa293d1[_0x7478('0x2e')][_0x7478('0x3b')]){_0x33049f[_0x7478('0x39')]=_[_0x7478('0x3e')](_0x33049f[_0x7478('0x39')],{'$or':_[_0x7478('0x29')](_0x33049f[_0x7478('0x32')],function(_0x50d8f8){var _0x352dea={};_0x352dea[_0x50d8f8]={'$like':'%'+_0xa293d1[_0x7478('0x2e')]['filter']+'%'};return _0x352dea;})});}_0x33049f=_['merge']({},_0x33049f,_0xa293d1[_0x7478('0x3f')]);return db[_0x7478('0x5c')][_0x7478('0x18')]({'where':_0x33049f[_0x7478('0x39')]})[_0x7478('0x1e')](function(_0xe55c30){_0xdbab05[_0x7478('0x18')]=_0xe55c30;if(_0xa293d1[_0x7478('0x2e')][_0x7478('0x40')]){_0x33049f[_0x7478('0x4f')]=[{'all':!![]}];}return db[_0x7478('0x5c')][_0x7478('0x58')](_0x33049f);})['then'](function(_0x4fabcc){_0xdbab05['rows']=_0x4fabcc;return _0xdbab05;});}})['then'](respondWithFilteredResult(_0x1e03ae,_0x33049f))[_0x7478('0x42')](handleError(_0x1e03ae,null));};exports[_0x7478('0x5d')]=function(_0x5a54a4,_0x1f5818,_0x4a786f){var _0x298ea7={'raw':!![],'where':{}};var _0x41ed38={};var _0x3b045a={'count':0x0,'rows':[]};return db[_0x7478('0x2a')]['findOne']({'where':{'id':_0x5a54a4[_0x7478('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5818,null))[_0x7478('0x1e')](function(_0x5b885a){if(_0x5b885a){_0x41ed38[_0x7478('0x2d')]=_['keys'](db[_0x7478('0x5e')]['rawAttributes']);_0x41ed38[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0x5a54a4[_0x7478('0x2e')]);_0x41ed38['filters']=_[_0x7478('0x31')](_0x41ed38[_0x7478('0x2d')],_0x41ed38[_0x7478('0x2e')]);_0x298ea7['attributes']=_['intersection'](_0x41ed38['model'],qs[_0x7478('0x33')](_0x5a54a4['query']['fields']));_0x298ea7[_0x7478('0x32')]=_0x298ea7[_0x7478('0x32')][_0x7478('0x34')]?_0x298ea7[_0x7478('0x32')]:_0x41ed38['model'];if(!_0x5a54a4[_0x7478('0x2e')][_0x7478('0x35')](_0x7478('0x36'))){_0x298ea7[_0x7478('0x17')]=qs[_0x7478('0x17')](_0x5a54a4[_0x7478('0x2e')]['limit']);_0x298ea7[_0x7478('0x19')]=qs[_0x7478('0x19')](_0x5a54a4[_0x7478('0x2e')][_0x7478('0x19')]);}_0x298ea7[_0x7478('0x37')]=qs[_0x7478('0x38')](_0x5a54a4['query'][_0x7478('0x38')]);_0x298ea7[_0x7478('0x39')]=qs[_0x7478('0x30')](_[_0x7478('0x3a')](_0x5a54a4['query'],_0x41ed38[_0x7478('0x30')]));_0x298ea7[_0x7478('0x39')][_0x7478('0x57')]=_0x5b885a['id'];if(_0x5a54a4[_0x7478('0x2e')][_0x7478('0x3b')]){_0x298ea7['where']=_[_0x7478('0x3e')](_0x298ea7[_0x7478('0x39')],{'$or':_['map'](_0x298ea7[_0x7478('0x32')],function(_0x17bbcd){var _0x33c946={};_0x33c946[_0x17bbcd]={'$like':'%'+_0x5a54a4[_0x7478('0x2e')][_0x7478('0x3b')]+'%'};return _0x33c946;})});}_0x298ea7=_[_0x7478('0x3e')]({},_0x298ea7,_0x5a54a4['options']);return db[_0x7478('0x5e')]['count']({'where':_0x298ea7[_0x7478('0x39')]})[_0x7478('0x1e')](function(_0x17ffb2){_0x3b045a[_0x7478('0x18')]=_0x17ffb2;if(_0x5a54a4[_0x7478('0x2e')][_0x7478('0x40')]){_0x298ea7[_0x7478('0x4f')]=[{'all':!![]}];}return db[_0x7478('0x5e')]['findAll'](_0x298ea7);})[_0x7478('0x1e')](function(_0x2362d3){_0x3b045a['rows']=_0x2362d3;return _0x3b045a;});}})[_0x7478('0x1e')](respondWithFilteredResult(_0x1f5818,_0x298ea7))[_0x7478('0x42')](handleError(_0x1f5818,null));};exports[_0x7478('0x5f')]=function(_0xbe15ea,_0x588253,_0x243163){var _0x368917={};var _0x37f566={};var _0x5a7efb;var _0x454421;return db[_0x7478('0x2a')][_0x7478('0x55')]({'where':{'id':_0xbe15ea[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x588253,null))[_0x7478('0x1e')](function(_0x21aaa1){if(_0x21aaa1){_0x5a7efb=_0x21aaa1;_0x37f566[_0x7478('0x2d')]=_[_0x7478('0x2f')](db[_0x7478('0x60')]['rawAttributes']);_0x37f566[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0xbe15ea['query']);_0x37f566['filters']=_[_0x7478('0x31')](_0x37f566['model'],_0x37f566[_0x7478('0x2e')]);_0x368917['attributes']=_[_0x7478('0x31')](_0x37f566[_0x7478('0x2d')],qs[_0x7478('0x33')](_0xbe15ea[_0x7478('0x2e')][_0x7478('0x33')]));_0x368917[_0x7478('0x32')]=_0x368917[_0x7478('0x32')]['length']?_0x368917['attributes']:_0x37f566[_0x7478('0x2d')];_0x368917[_0x7478('0x37')]=qs[_0x7478('0x38')](_0xbe15ea[_0x7478('0x2e')][_0x7478('0x38')]);_0x368917['where']=qs[_0x7478('0x30')](_[_0x7478('0x3a')](_0xbe15ea[_0x7478('0x2e')],_0x37f566[_0x7478('0x30')]));if(_0xbe15ea[_0x7478('0x2e')][_0x7478('0x3b')]){_0x368917[_0x7478('0x39')]=_[_0x7478('0x3e')](_0x368917[_0x7478('0x39')],{'$or':_[_0x7478('0x29')](_0x368917[_0x7478('0x32')],function(_0x1a1558){var _0x2c5290={};_0x2c5290[_0x1a1558]={'$like':'%'+_0xbe15ea[_0x7478('0x2e')]['filter']+'%'};return _0x2c5290;})});}_0x368917=_[_0x7478('0x3e')]({},_0x368917,_0xbe15ea[_0x7478('0x3f')]);return _0x5a7efb[_0x7478('0x5f')](_0x368917);}})[_0x7478('0x1e')](function(_0x584dfa){if(_0x584dfa){_0x454421=_0x584dfa[_0x7478('0x34')];if(!_0xbe15ea[_0x7478('0x2e')][_0x7478('0x35')](_0x7478('0x36'))){_0x368917[_0x7478('0x17')]=qs[_0x7478('0x17')](_0xbe15ea['query']['limit']);_0x368917[_0x7478('0x19')]=qs[_0x7478('0x19')](_0xbe15ea[_0x7478('0x2e')]['offset']);}return _0x5a7efb[_0x7478('0x5f')](_0x368917);}})[_0x7478('0x1e')](function(_0x11ff4c){if(_0x11ff4c){return _0x11ff4c?{'count':_0x454421,'rows':_0x11ff4c}:null;}})[_0x7478('0x1e')](respondWithResult(_0x588253,null))[_0x7478('0x42')](handleError(_0x588253,null));};exports[_0x7478('0x61')]=function(_0x4c5211,_0x21a87b,_0x3a9511){var _0x2de53f,_0x1a037a;var _0x5de467=[];var _0x57203a=moment()['format'](_0x7478('0x62'));return db['Campaign'][_0x7478('0x4a')]({'where':{'id':_0x4c5211['params']['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x21a87b,null))[_0x7478('0x1e')](function(_0x34c0a){if(_0x34c0a){_0x1a037a=_0x34c0a;return _0x34c0a[_0x7478('0x61')](_0x4c5211['body'][_0x7478('0x63')],_[_0x7478('0x50')](_0x4c5211[_0x7478('0x46')],['ids','id'])||{});}return null;})[_0x7478('0x64')](function(_0xb0317f){var _0xfd12cd;var _0x1bbd76;_0x2de53f=_0xb0317f||[];var _0x3ab07f=[];if(_0xb0317f){for(var _0x31150a=0x0;_0x31150a<_0xb0317f['length'];_0x31150a+=0x1){var _0x1ce1fa=_0xb0317f[_0x31150a][_0x7478('0x47')]({'plain':!![]});_0x1a037a[_0x7478('0x65')]=_0x4c5211['body'][_0x7478('0x65')]?_0x4c5211[_0x7478('0x46')][_0x7478('0x65')]:_0x1a037a[_0x7478('0x65')];switch(_0x1a037a[_0x7478('0x65')]){case _0x7478('0x66'):_0xfd12cd=squel['insert']()[_0x7478('0x67')](_0x7478('0x68'))[_0x7478('0x69')]([_0x7478('0x6a'),_0x7478('0x6b'),'ContactId',_0x7478('0x6c'),'CampaignId',_0x7478('0x6d'),_0x7478('0x51')],squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x6a'),'phone')[_0x7478('0x6f')]('NOW()',_0x7478('0x6b'))[_0x7478('0x6f')]('id',_0x7478('0x70'))['field'](_0x1ce1fa['CmListId'][_0x7478('0x71')](),_0x7478('0x6c'))['field'](_0x4c5211[_0x7478('0x44')]['id'][_0x7478('0x71')](),'CampaignId')[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27',_0x7478('0x6d'))[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27',_0x7478('0x51'))[_0x7478('0x72')](_0x7478('0x73'))[_0x7478('0x39')]('deletedAt\x20IS\x20NULL')[_0x7478('0x39')](_0x7478('0x74'),_0x1ce1fa['CmListId']['toString']())[_0x7478('0x39')](_0x7478('0x75'))[_0x7478('0x39')](_0x7478('0x76'),squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x77'))[_0x7478('0x72')]('cm_hopper_final')[_0x7478('0x39')](_0x7478('0x78'),_0x4c5211['params']['id'][_0x7478('0x71')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7478('0x6e')]()['field'](_0x7478('0x79'))[_0x7478('0x72')]('cm_hopper')[_0x7478('0x39')](_0x7478('0x78'),_0x4c5211['params']['id'][_0x7478('0x71')]())))[_0x7478('0x71')]();break;case _0x7478('0x7a'):_0xfd12cd=squel[_0x7478('0x7b')]()['into'](_0x7478('0x68'))['fromQuery'](['phone',_0x7478('0x6b'),_0x7478('0x70'),_0x7478('0x6c'),_0x7478('0x57'),_0x7478('0x6d'),_0x7478('0x51')],squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x6a'),'phone')[_0x7478('0x6f')]('NOW()',_0x7478('0x6b'))[_0x7478('0x6f')]('id',_0x7478('0x70'))[_0x7478('0x6f')](_0x1ce1fa[_0x7478('0x7c')][_0x7478('0x71')](),_0x7478('0x6c'))[_0x7478('0x6f')](_0x4c5211['params']['id']['toString'](),_0x7478('0x57'))[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27','createdAt')['field']('\x27'+_0x57203a+'\x27','updatedAt')['from'](_0x7478('0x73'))['where'](_0x7478('0x7d'))['where']('ListId\x20=\x20?',_0x1ce1fa['CmListId'][_0x7478('0x71')]())[_0x7478('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x7478('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x79'))[_0x7478('0x72')](_0x7478('0x68'))[_0x7478('0x39')](_0x7478('0x78'),_0x4c5211[_0x7478('0x44')]['id']['toString']())))['toString']();break;default:_0xfd12cd=squel[_0x7478('0x7b')]()['into'](_0x7478('0x68'))[_0x7478('0x69')](['phone',_0x7478('0x6b'),_0x7478('0x70'),_0x7478('0x6c'),'CampaignId',_0x7478('0x6d'),_0x7478('0x51')],squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x6a'),'phone')[_0x7478('0x6f')]('NOW()',_0x7478('0x6b'))[_0x7478('0x6f')]('id',_0x7478('0x70'))['field'](_0x1ce1fa[_0x7478('0x7c')][_0x7478('0x71')](),_0x7478('0x6c'))['field'](_0x4c5211['params']['id'][_0x7478('0x71')](),_0x7478('0x57'))[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27','createdAt')[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27',_0x7478('0x51'))[_0x7478('0x72')]('cm_contacts')[_0x7478('0x39')](_0x7478('0x7d'))['where'](_0x7478('0x74'),_0x1ce1fa[_0x7478('0x7c')]['toString']())['where'](_0x7478('0x75')))['toString']();}_0x1bbd76=squel[_0x7478('0x7b')]()[_0x7478('0x67')](_0x7478('0x7e'))['fromQuery'](['cmHopperId','scheduledAt',_0x7478('0x6a'),_0x7478('0x7f'),_0x7478('0x6d'),'updatedAt'],squel[_0x7478('0x6e')]()[_0x7478('0x6f')](_0x7478('0x80'),'id')[_0x7478('0x6f')](_0x7478('0x81'),_0x7478('0x6b'))[_0x7478('0x6f')](_0x7478('0x82'),_0x7478('0x6a'))[_0x7478('0x6f')]('ci.OrderBY','OrderBy')[_0x7478('0x6f')]('\x27'+_0x57203a+'\x27',_0x7478('0x6d'))['field']('\x27'+_0x57203a+'\x27',_0x7478('0x51'))['from']('cm_contact_has_items','ci')['join']('cm_hopper','h',_0x7478('0x83'))[_0x7478('0x39')](_0x7478('0x84'),_0x1ce1fa[_0x7478('0x7c')][_0x7478('0x71')]())['where'](_0x7478('0x85'),_0x4c5211[_0x7478('0x44')]['id'][_0x7478('0x71')]())['where'](_0x7478('0x86'),_0x57203a))['toString']();_0x3ab07f['push'](db[_0x7478('0x87')][_0x7478('0x2e')](_0xfd12cd));_0x5de467[_0x7478('0x88')](db['sequelize'][_0x7478('0x2e')](_0x1bbd76));}return BPromise['all'](_0x3ab07f);}})[_0x7478('0x1e')](function(){return BPromise[_0x7478('0x89')](_0x5de467);})[_0x7478('0x1e')](function(){return _0x2de53f;})['then'](respondWithResult(_0x21a87b,null))[_0x7478('0x42')](handleError(_0x21a87b,null));};exports['removeLists']=function(_0x27b8ae,_0x4ca70c,_0x1dddba){return db[_0x7478('0x2a')][_0x7478('0x4a')]({'where':{'id':_0x27b8ae[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x4ca70c,null))[_0x7478('0x1e')](function(_0x18cd06){if(_0x18cd06){return _0x18cd06[_0x7478('0x8a')](_0x27b8ae[_0x7478('0x2e')][_0x7478('0x63')]);}})[_0x7478('0x1e')](function(_0x7a3f64){if(_0x7a3f64){return db[_0x7478('0x56')]['destroy']({'where':{'ListId':_0x27b8ae['query'][_0x7478('0x63')],'CampaignId':_0x27b8ae[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](function(){return _0x7a3f64;});}})[_0x7478('0x1e')](respondWithStatusCode(_0x4ca70c,null))[_0x7478('0x42')](handleError(_0x4ca70c,null));};exports[_0x7478('0x8b')]=function(_0x581fb5,_0x2f2458,_0x45d099){var _0x1845f8={};var _0x81ccb8={};var _0x39b0c5;var _0x262213;return db[_0x7478('0x2a')][_0x7478('0x55')]({'where':{'id':_0x581fb5[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x2f2458,null))[_0x7478('0x1e')](function(_0x21a8aa){if(_0x21a8aa){_0x39b0c5=_0x21a8aa;_0x81ccb8[_0x7478('0x2d')]=_['keys'](db[_0x7478('0x60')]['rawAttributes']);_0x81ccb8[_0x7478('0x2e')]=_[_0x7478('0x2f')](_0x581fb5[_0x7478('0x2e')]);_0x81ccb8[_0x7478('0x30')]=_['intersection'](_0x81ccb8['model'],_0x81ccb8[_0x7478('0x2e')]);_0x1845f8[_0x7478('0x32')]=_[_0x7478('0x31')](_0x81ccb8['model'],qs[_0x7478('0x33')](_0x581fb5[_0x7478('0x2e')][_0x7478('0x33')]));_0x1845f8[_0x7478('0x32')]=_0x1845f8[_0x7478('0x32')][_0x7478('0x34')]?_0x1845f8[_0x7478('0x32')]:_0x81ccb8[_0x7478('0x2d')];_0x1845f8[_0x7478('0x37')]=qs['sort'](_0x581fb5['query'][_0x7478('0x38')]);_0x1845f8[_0x7478('0x39')]=qs['filters'](_[_0x7478('0x3a')](_0x581fb5['query'],_0x81ccb8[_0x7478('0x30')]));if(_0x581fb5[_0x7478('0x2e')][_0x7478('0x3b')]){_0x1845f8[_0x7478('0x39')]=_[_0x7478('0x3e')](_0x1845f8[_0x7478('0x39')],{'$or':_[_0x7478('0x29')](_0x1845f8[_0x7478('0x32')],function(_0x15622b){var _0x12bc27={};_0x12bc27[_0x15622b]={'$like':'%'+_0x581fb5['query'][_0x7478('0x3b')]+'%'};return _0x12bc27;})});}_0x1845f8=_[_0x7478('0x3e')]({},_0x1845f8,_0x581fb5[_0x7478('0x3f')]);return _0x39b0c5[_0x7478('0x8b')](_0x1845f8);}})[_0x7478('0x1e')](function(_0x2ac3f4){if(_0x2ac3f4){_0x262213=_0x2ac3f4['length'];if(!_0x581fb5['query'][_0x7478('0x35')](_0x7478('0x36'))){_0x1845f8[_0x7478('0x17')]=qs[_0x7478('0x17')](_0x581fb5[_0x7478('0x2e')][_0x7478('0x17')]);_0x1845f8[_0x7478('0x19')]=qs[_0x7478('0x19')](_0x581fb5[_0x7478('0x2e')][_0x7478('0x19')]);}return _0x39b0c5[_0x7478('0x8b')](_0x1845f8);}})[_0x7478('0x1e')](function(_0x52ebb4){if(_0x52ebb4){return _0x52ebb4?{'count':_0x262213,'rows':_0x52ebb4}:null;}})['then'](respondWithResult(_0x2f2458,null))[_0x7478('0x42')](handleError(_0x2f2458,null));};exports[_0x7478('0x8c')]=function(_0x23b899,_0x327f68,_0x906de8){var _0x2461b7,_0x277945;var _0x274326=[];var _0x15c667=moment()[_0x7478('0x8d')](_0x7478('0x62'));return db[_0x7478('0x2a')][_0x7478('0x4a')]({'where':{'id':_0x23b899[_0x7478('0x44')]['id']}})['then'](handleEntityNotFound(_0x327f68,null))['then'](function(_0x1a3c2a){if(_0x1a3c2a){_0x277945=_0x1a3c2a;return _0x1a3c2a['addBlackLists'](_0x23b899[_0x7478('0x46')][_0x7478('0x63')],_['omit'](_0x23b899['body'],['ids','id'])||{});}return null;})[_0x7478('0x64')](function(_0x5ecab2){var _0x594fd5;var _0x1254e1;_0x2461b7=_0x5ecab2||[];var _0x248de6=[];if(_0x5ecab2){for(var _0x91b775=0x0;_0x91b775<_0x5ecab2[_0x7478('0x34')];_0x91b775+=0x1){var _0x49bba7=_0x5ecab2[_0x91b775][_0x7478('0x47')]({'plain':!![]});_0x594fd5=squel[_0x7478('0x7b')]()[_0x7478('0x67')]('cm_hopper_black')['fromQuery'](['phone',_0x7478('0x70'),_0x7478('0x6c'),_0x7478('0x57'),_0x7478('0x6d'),_0x7478('0x51')],squel['select']()['field'](_0x7478('0x6a'),'phone')[_0x7478('0x6f')]('id',_0x7478('0x70'))[_0x7478('0x6f')](_0x49bba7[_0x7478('0x7c')][_0x7478('0x71')](),_0x7478('0x6c'))['field'](_0x23b899['params']['id'][_0x7478('0x71')](),'CampaignId')[_0x7478('0x6f')]('NOW()',_0x7478('0x6d'))[_0x7478('0x6f')](_0x7478('0x81'),'updatedAt')[_0x7478('0x72')](_0x7478('0x73'))['where'](_0x7478('0x7d'))['where']('ListId\x20=\x20?',_0x49bba7[_0x7478('0x7c')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x7478('0x71')]();_0x248de6[_0x7478('0x88')](db[_0x7478('0x87')][_0x7478('0x2e')](_0x594fd5));}return BPromise['all'](_0x248de6);}})[_0x7478('0x1e')](function(){return _0x2461b7;})[_0x7478('0x1e')](respondWithResult(_0x327f68,null))['catch'](handleError(_0x327f68,null));};exports[_0x7478('0x8e')]=function(_0x2e5d0c,_0x3ae208,_0x3f3a3d){return db[_0x7478('0x2a')][_0x7478('0x4a')]({'where':{'id':_0x2e5d0c[_0x7478('0x44')]['id']}})[_0x7478('0x1e')](handleEntityNotFound(_0x3ae208,null))[_0x7478('0x1e')](function(_0x7857dc){if(_0x7857dc){return _0x7857dc[_0x7478('0x8e')](_0x2e5d0c['query']['ids']);}})[_0x7478('0x1e')](function(_0xd7ecf6){if(_0xd7ecf6){return db[_0x7478('0x5e')]['destroy']({'where':{'ListId':_0x2e5d0c[_0x7478('0x2e')]['ids'],'CampaignId':_0x2e5d0c['params']['id']}})[_0x7478('0x1e')](function(){return _0xd7ecf6;});}})['then'](respondWithStatusCode(_0x3ae208,null))[_0x7478('0x42')](handleError(_0x3ae208,null));}; \ No newline at end of file +var _0xf2a6=['cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId','from','insert','cmHopperId','OrderBy','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','phone\x20IS\x20NOT\x20NULL','removeBlackLists','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','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','length','get','omit','createdAt','updatedAt','update','getHoppers','CmHopper','rawAttributes','pick','CampaignId','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)'];(function(_0x10bdb4,_0x14c9cc){var _0x54068a=function(_0x2b7211){while(--_0x2b7211){_0x10bdb4['push'](_0x10bdb4['shift']());}};_0x54068a(++_0x14c9cc);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x4e914d,_0x224eab){_0x4e914d=_0x4e914d-0x0;var _0x54f7af=_0xf2a6[_0x4e914d];return _0x54f7af;};'use strict';var emlformat=require(_0x6f2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f2a('0x1'));var moment=require('moment');var BPromise=require(_0x6f2a('0x2'));var Mustache=require(_0x6f2a('0x3'));var util=require(_0x6f2a('0x4'));var path=require(_0x6f2a('0x5'));var sox=require(_0x6f2a('0x6'));var csv=require(_0x6f2a('0x7'));var ejs=require(_0x6f2a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f2a('0x9'));var _=require(_0x6f2a('0xa'));var squel=require(_0x6f2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f2a('0xc'));var deskjs=require(_0x6f2a('0xd'));var toCsv=require(_0x6f2a('0x7'));var querystring=require(_0x6f2a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f2a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6f2a('0x10'));var as=require(_0x6f2a('0x11'));var hardwareService=require(_0x6f2a('0x12'));var logger=require('../../config/logger')(_0x6f2a('0x13'));var utils=require('../../config/utils');var config=require(_0x6f2a('0x14'));var licenseUtil=require(_0x6f2a('0x15'));var db=require(_0x6f2a('0x16'))['db'];function respondWithStatusCode(_0x59df4e,_0x46a54f){_0x46a54f=_0x46a54f||0xcc;return function(_0x4f1b32){if(_0x4f1b32){return _0x59df4e[_0x6f2a('0x17')](_0x46a54f);}return _0x59df4e[_0x6f2a('0x18')](_0x46a54f)[_0x6f2a('0x19')]();};}function respondWithResult(_0x421e15,_0xe24075){_0xe24075=_0xe24075||0xc8;return function(_0x5224e6){if(_0x5224e6){return _0x421e15[_0x6f2a('0x18')](_0xe24075)[_0x6f2a('0x1a')](_0x5224e6);}};}function respondWithFilteredResult(_0x27ca04,_0x44b317){return function(_0x1057f2){if(_0x1057f2){var _0x3dfc44=typeof _0x44b317[_0x6f2a('0x1b')]===_0x6f2a('0x1c')&&typeof _0x44b317[_0x6f2a('0x1d')]===_0x6f2a('0x1c');var _0x2aaed5=_0x1057f2[_0x6f2a('0x1e')];var _0x5c408b=_0x3dfc44?0x0:_0x44b317[_0x6f2a('0x1b')];var _0x3171b9=_0x3dfc44?_0x1057f2[_0x6f2a('0x1e')]:_0x44b317[_0x6f2a('0x1b')]+_0x44b317[_0x6f2a('0x1d')];var _0x43602b;if(_0x3171b9>=_0x2aaed5){_0x3171b9=_0x2aaed5;_0x43602b=0xc8;}else{_0x43602b=0xce;}_0x27ca04[_0x6f2a('0x18')](_0x43602b);return _0x27ca04[_0x6f2a('0x1f')](_0x6f2a('0x20'),_0x5c408b+'-'+_0x3171b9+'/'+_0x2aaed5)[_0x6f2a('0x1a')](_0x1057f2);}return null;};}function patchUpdates(_0x33554f){return function(_0x4eca00){try{jsonpatch[_0x6f2a('0x21')](_0x4eca00,_0x33554f,!![]);}catch(_0x20e7ff){return BPromise[_0x6f2a('0x22')](_0x20e7ff);}return _0x4eca00[_0x6f2a('0x23')]();};}function saveUpdates(_0x1da29f,_0x108b8b){return function(_0x28a8c2){if(_0x28a8c2){return _0x28a8c2['update'](_0x1da29f)[_0x6f2a('0x24')](function(_0x590c40){return _0x590c40;});}return null;};}function removeEntity(_0xb7de5a,_0x301aa9){return function(_0x148240){if(_0x148240){return _0x148240['destroy']()[_0x6f2a('0x24')](function(){var _0xb7cd00=_0x148240['get']({'plain':!![]});var _0x55c1bc=_0x6f2a('0x25');return db[_0x6f2a('0x26')][_0x6f2a('0x27')]({'where':{'type':_0x55c1bc,'resourceId':_0xb7cd00['id']}})[_0x6f2a('0x24')](function(){return _0x148240;});})[_0x6f2a('0x24')](function(){_0xb7de5a['status'](0xcc)[_0x6f2a('0x19')]();});}};}function handleEntityNotFound(_0x549dd7,_0x3ac571){return function(_0xd64d6){if(!_0xd64d6){_0x549dd7['sendStatus'](0x194);}return _0xd64d6;};}function handleError(_0x3973e8,_0x409ea4){_0x409ea4=_0x409ea4||0x1f4;return function(_0x498d7e){logger[_0x6f2a('0x28')](_0x498d7e[_0x6f2a('0x29')]);if(_0x498d7e[_0x6f2a('0x2a')]){delete _0x498d7e[_0x6f2a('0x2a')];}_0x3973e8[_0x6f2a('0x18')](_0x409ea4)[_0x6f2a('0x2b')](_0x498d7e);};}exports[_0x6f2a('0x2c')]=function(_0x4da5dc,_0xb0f466){var _0x5a0a3c={},_0x34acb0={},_0x4e188f={'count':0x0,'rows':[]};var _0x34b78e=_[_0x6f2a('0x2d')](db[_0x6f2a('0x2e')]['rawAttributes'],function(_0xedbbba){return{'name':_0xedbbba['fieldName'],'type':_0xedbbba[_0x6f2a('0x2f')][_0x6f2a('0x30')]};});_0x34acb0['model']=_[_0x6f2a('0x2d')](_0x34b78e,_0x6f2a('0x2a'));_0x34acb0[_0x6f2a('0x31')]=_['keys'](_0x4da5dc['query']);_0x34acb0['filters']=_[_0x6f2a('0x32')](_0x34acb0['model'],_0x34acb0[_0x6f2a('0x31')]);_0x5a0a3c[_0x6f2a('0x33')]=_['intersection'](_0x34acb0[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x5a0a3c['attributes']=_0x5a0a3c[_0x6f2a('0x33')]['length']?_0x5a0a3c[_0x6f2a('0x33')]:_0x34acb0[_0x6f2a('0x34')];if(!_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x5a0a3c[_0x6f2a('0x1d')]=qs[_0x6f2a('0x1d')](_0x4da5dc['query'][_0x6f2a('0x1d')]);_0x5a0a3c[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}_0x5a0a3c[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x5a0a3c[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_['pick'](_0x4da5dc[_0x6f2a('0x31')],_0x34acb0[_0x6f2a('0x3b')]),_0x34b78e);if(_0x4da5dc[_0x6f2a('0x31')]['filter']){_0x5a0a3c[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x5a0a3c[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x34b78e,function(_0x2dfd7d){if(_0x2dfd7d[_0x6f2a('0x2f')]!==_0x6f2a('0x3d')){var _0x44c61d={};_0x44c61d[_0x2dfd7d[_0x6f2a('0x2a')]]={'$like':'%'+_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x3e')]+'%'};return _0x44c61d;}})});}_0x5a0a3c=_['merge']({},_0x5a0a3c,_0x4da5dc[_0x6f2a('0x3f')]);var _0xccc1c={'where':_0x5a0a3c[_0x6f2a('0x3a')]};return db['Campaign'][_0x6f2a('0x1e')](_0xccc1c)[_0x6f2a('0x24')](function(_0x14f869){_0x4e188f[_0x6f2a('0x1e')]=_0x14f869;if(_0x4da5dc[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x5a0a3c[_0x6f2a('0x41')]=[{'all':!![]}];}return db[_0x6f2a('0x2e')]['findAll'](_0x5a0a3c);})[_0x6f2a('0x24')](function(_0x5be543){_0x4e188f['rows']=_0x5be543;return _0x4e188f;})[_0x6f2a('0x24')](respondWithFilteredResult(_0xb0f466,_0x5a0a3c))[_0x6f2a('0x42')](handleError(_0xb0f466,null));};exports[_0x6f2a('0x43')]=function(_0xfe3724,_0x4b5782){var _0x3e43cd={'raw':![],'where':{'id':_0xfe3724[_0x6f2a('0x44')]['id']}},_0x10bf26={};_0x10bf26[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x2e')]['rawAttributes']);_0x10bf26[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0xfe3724[_0x6f2a('0x31')]);_0x10bf26[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x10bf26[_0x6f2a('0x34')],_0x10bf26['query']);_0x3e43cd['attributes']=_[_0x6f2a('0x32')](_0x10bf26['model'],qs[_0x6f2a('0x35')](_0xfe3724['query'][_0x6f2a('0x35')]));_0x3e43cd[_0x6f2a('0x33')]=_0x3e43cd['attributes']['length']?_0x3e43cd['attributes']:_0x10bf26[_0x6f2a('0x34')];if(_0xfe3724['query']['includeAll']){_0x3e43cd[_0x6f2a('0x41')]=[{'all':!![]}];}_0x3e43cd=_[_0x6f2a('0x3c')]({},_0x3e43cd,_0xfe3724[_0x6f2a('0x3f')]);return db[_0x6f2a('0x2e')]['find'](_0x3e43cd)[_0x6f2a('0x24')](handleEntityNotFound(_0x4b5782,null))[_0x6f2a('0x24')](respondWithResult(_0x4b5782,null))[_0x6f2a('0x42')](handleError(_0x4b5782,null));};exports[_0x6f2a('0x46')]=function(_0x3d8f60,_0xb59bd1){return db['Campaign'][_0x6f2a('0x46')](_0x3d8f60[_0x6f2a('0x47')],{})[_0x6f2a('0x24')](function(_0xfd6940){var _0x1f6a48=_0x3d8f60[_0x6f2a('0x48')]['get']({'plain':!![]});if(!_0x1f6a48)throw new Error(_0x6f2a('0x49'));if(_0x1f6a48[_0x6f2a('0x4a')]===_0x6f2a('0x48')){var _0x5e72fe=_0xfd6940['get']({'plain':!![]});var _0x435fec=_0x6f2a('0x25');return db[_0x6f2a('0x4b')][_0x6f2a('0x4c')]({'where':{'name':_0x435fec,'userProfileId':_0x1f6a48[_0x6f2a('0x4d')]},'raw':!![]})[_0x6f2a('0x24')](function(_0x450160){if(_0x450160&&_0x450160[_0x6f2a('0x4e')]===0x0){return db[_0x6f2a('0x26')][_0x6f2a('0x46')]({'name':_0x5e72fe[_0x6f2a('0x2a')],'resourceId':_0x5e72fe['id'],'type':_0x450160[_0x6f2a('0x2a')],'sectionId':_0x450160['id']},{})[_0x6f2a('0x24')](function(){return _0xfd6940;});}else{return _0xfd6940;}})['catch'](function(_0x2c26fc){logger['error'](_0x6f2a('0x4f'),_0x2c26fc);throw _0x2c26fc;});}return _0xfd6940;})['then'](respondWithResult(_0xb59bd1,0xc9))[_0x6f2a('0x42')](handleError(_0xb59bd1,null));};exports['clone']=function(_0x13d759,_0x1c1ad9){var _0x1f4b1={'where':{'id':_0x13d759[_0x6f2a('0x44')]['id']}},_0x4a89a3={};_0x4a89a3['model']=_[_0x6f2a('0x45')](db['Campaign']['rawAttributes']);_0x1f4b1[_0x6f2a('0x33')]=_[_0x6f2a('0x32')](_0x4a89a3[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x13d759[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x1f4b1[_0x6f2a('0x33')]=_0x1f4b1['attributes'][_0x6f2a('0x50')]?_0x1f4b1[_0x6f2a('0x33')]:_0x4a89a3[_0x6f2a('0x34')];if(_0x13d759[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x1f4b1[_0x6f2a('0x41')]=[{'all':!![]}];}_0x1f4b1=_[_0x6f2a('0x3c')]({},_0x1f4b1,_0x13d759[_0x6f2a('0x3f')]);return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')](_0x1f4b1)[_0x6f2a('0x24')](handleEntityNotFound(_0x1c1ad9,null))[_0x6f2a('0x24')](function(_0x7c2c52){if(_0x7c2c52){var _0x58a304=_0x7c2c52[_0x6f2a('0x51')]({'plain':!![]});_0x58a304=qs[_0x6f2a('0x52')](_0x58a304,['id',_0x6f2a('0x53'),_0x6f2a('0x54')]);_0x13d759[_0x6f2a('0x47')]=_[_0x6f2a('0x52')](_0x13d759[_0x6f2a('0x47')],['id',_0x6f2a('0x53'),_0x6f2a('0x54')]);return db['Campaign'][_0x6f2a('0x46')](_[_0x6f2a('0x3c')](_0x58a304,_0x13d759[_0x6f2a('0x47')]),{'include':_0x13d759[_0x6f2a('0x31')][_0x6f2a('0x40')]?[{'all':!![]}]:undefined})[_0x6f2a('0x24')](function(_0xe21552){var _0x24b03d=_0x13d759[_0x6f2a('0x48')][_0x6f2a('0x51')]({'plain':!![]});if(!_0x24b03d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24b03d[_0x6f2a('0x4a')]===_0x6f2a('0x48')){var _0x4a8ddf=_0xe21552[_0x6f2a('0x51')]({'plain':!![]});var _0xada41=_0x6f2a('0x25');return db[_0x6f2a('0x4b')]['find']({'where':{'name':_0xada41,'userProfileId':_0x24b03d['userProfileId']},'raw':!![]})[_0x6f2a('0x24')](function(_0x174cc){if(_0x174cc&&_0x174cc['autoAssociation']===0x0){return db[_0x6f2a('0x26')][_0x6f2a('0x46')]({'name':_0x4a8ddf[_0x6f2a('0x2a')],'resourceId':_0x4a8ddf['id'],'type':_0x174cc[_0x6f2a('0x2a')],'sectionId':_0x174cc['id']},{})['then'](function(){return _0xe21552;});}else{return _0xe21552;}})[_0x6f2a('0x42')](function(_0x243aa1){logger[_0x6f2a('0x28')](_0x6f2a('0x4f'),_0x243aa1);throw _0x243aa1;});}return _0xe21552;});}})[_0x6f2a('0x24')](respondWithResult(_0x1c1ad9,0xc9))[_0x6f2a('0x42')](handleError(_0x1c1ad9,null));};exports[_0x6f2a('0x55')]=function(_0x1e8063,_0x1b83a1){if(_0x1e8063['body']['id']){delete _0x1e8063[_0x6f2a('0x47')]['id'];}return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')]({'where':{'id':_0x1e8063[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x1b83a1,null))[_0x6f2a('0x24')](saveUpdates(_0x1e8063[_0x6f2a('0x47')],null))[_0x6f2a('0x24')](respondWithResult(_0x1b83a1,null))[_0x6f2a('0x42')](handleError(_0x1b83a1,null));};exports[_0x6f2a('0x27')]=function(_0x8f8d32,_0x34eb85){return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')]({'where':{'id':_0x8f8d32[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x34eb85,null))[_0x6f2a('0x24')](removeEntity(_0x34eb85,null))[_0x6f2a('0x42')](handleError(_0x34eb85,null));};exports[_0x6f2a('0x56')]=function(_0x1f50db,_0x2ce010,_0x4fe9c4){var _0x3faade={'raw':!![],'where':{}};var _0x58c1a4={};var _0x1208ce={'count':0x0,'rows':[]};return db[_0x6f2a('0x2e')]['findOne']({'where':{'id':_0x1f50db[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x2ce010,null))[_0x6f2a('0x24')](function(_0x21c890){if(_0x21c890){_0x58c1a4[_0x6f2a('0x34')]=_['keys'](db[_0x6f2a('0x57')][_0x6f2a('0x58')]);_0x58c1a4['query']=_[_0x6f2a('0x45')](_0x1f50db['query']);_0x58c1a4[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x58c1a4['model'],_0x58c1a4[_0x6f2a('0x31')]);_0x3faade[_0x6f2a('0x33')]=_['intersection'](_0x58c1a4['model'],qs['fields'](_0x1f50db['query']['fields']));_0x3faade[_0x6f2a('0x33')]=_0x3faade['attributes'][_0x6f2a('0x50')]?_0x3faade[_0x6f2a('0x33')]:_0x58c1a4['model'];if(!_0x1f50db[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x3faade[_0x6f2a('0x1d')]=qs['limit'](_0x1f50db[_0x6f2a('0x31')][_0x6f2a('0x1d')]);_0x3faade[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x1f50db[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}_0x3faade['order']=qs[_0x6f2a('0x39')](_0x1f50db[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x3faade['where']=qs['filters'](_[_0x6f2a('0x59')](_0x1f50db[_0x6f2a('0x31')],_0x58c1a4[_0x6f2a('0x3b')]));_0x3faade[_0x6f2a('0x3a')][_0x6f2a('0x5a')]=_0x21c890['id'];if(_0x1f50db['query'][_0x6f2a('0x3e')]){_0x3faade['where']=_[_0x6f2a('0x3c')](_0x3faade[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x3faade['attributes'],function(_0x4acc32){var _0x5bf1e3={};_0x5bf1e3[_0x4acc32]={'$like':'%'+_0x1f50db[_0x6f2a('0x31')]['filter']+'%'};return _0x5bf1e3;})});}_0x3faade=_[_0x6f2a('0x3c')]({},_0x3faade,_0x1f50db[_0x6f2a('0x3f')]);return db[_0x6f2a('0x57')][_0x6f2a('0x1e')]({'where':_0x3faade[_0x6f2a('0x3a')]})[_0x6f2a('0x24')](function(_0x30392e){_0x1208ce[_0x6f2a('0x1e')]=_0x30392e;if(_0x1f50db['query'][_0x6f2a('0x40')]){_0x3faade[_0x6f2a('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x6f2a('0x5b')](_0x3faade);})['then'](function(_0x228557){_0x1208ce[_0x6f2a('0x5c')]=_0x228557;return _0x1208ce;});}})[_0x6f2a('0x24')](respondWithFilteredResult(_0x2ce010,_0x3faade))[_0x6f2a('0x42')](handleError(_0x2ce010,null));};exports[_0x6f2a('0x5d')]=function(_0x5cbbe3,_0x5964f4,_0xd6e9ff){var _0x135b75={'raw':!![],'where':{}};var _0x360063={};var _0x427daa={'count':0x0,'rows':[]};return db[_0x6f2a('0x2e')]['findOne']({'where':{'id':_0x5cbbe3['params']['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x5964f4,null))[_0x6f2a('0x24')](function(_0x1efdbd){if(_0x1efdbd){_0x360063[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x5e')][_0x6f2a('0x58')]);_0x360063[_0x6f2a('0x31')]=_['keys'](_0x5cbbe3[_0x6f2a('0x31')]);_0x360063[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x360063[_0x6f2a('0x34')],_0x360063[_0x6f2a('0x31')]);_0x135b75[_0x6f2a('0x33')]=_[_0x6f2a('0x32')](_0x360063[_0x6f2a('0x34')],qs['fields'](_0x5cbbe3['query'][_0x6f2a('0x35')]));_0x135b75[_0x6f2a('0x33')]=_0x135b75[_0x6f2a('0x33')][_0x6f2a('0x50')]?_0x135b75[_0x6f2a('0x33')]:_0x360063[_0x6f2a('0x34')];if(!_0x5cbbe3['query'][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x135b75['limit']=qs[_0x6f2a('0x1d')](_0x5cbbe3[_0x6f2a('0x31')][_0x6f2a('0x1d')]);_0x135b75['offset']=qs[_0x6f2a('0x1b')](_0x5cbbe3[_0x6f2a('0x31')]['offset']);}_0x135b75[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x5cbbe3[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x135b75[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_[_0x6f2a('0x59')](_0x5cbbe3[_0x6f2a('0x31')],_0x360063[_0x6f2a('0x3b')]));_0x135b75['where'][_0x6f2a('0x5a')]=_0x1efdbd['id'];if(_0x5cbbe3[_0x6f2a('0x31')][_0x6f2a('0x3e')]){_0x135b75[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x135b75['where'],{'$or':_['map'](_0x135b75[_0x6f2a('0x33')],function(_0x14a63e){var _0x469168={};_0x469168[_0x14a63e]={'$like':'%'+_0x5cbbe3['query']['filter']+'%'};return _0x469168;})});}_0x135b75=_[_0x6f2a('0x3c')]({},_0x135b75,_0x5cbbe3[_0x6f2a('0x3f')]);return db[_0x6f2a('0x5e')][_0x6f2a('0x1e')]({'where':_0x135b75[_0x6f2a('0x3a')]})[_0x6f2a('0x24')](function(_0x5c9c70){_0x427daa[_0x6f2a('0x1e')]=_0x5c9c70;if(_0x5cbbe3[_0x6f2a('0x31')]['includeAll']){_0x135b75['include']=[{'all':!![]}];}return db[_0x6f2a('0x5e')][_0x6f2a('0x5b')](_0x135b75);})[_0x6f2a('0x24')](function(_0x337fbd){_0x427daa['rows']=_0x337fbd;return _0x427daa;});}})[_0x6f2a('0x24')](respondWithFilteredResult(_0x5964f4,_0x135b75))['catch'](handleError(_0x5964f4,null));};exports[_0x6f2a('0x5f')]=function(_0x311bc1,_0x2f4abc,_0x5af95d){var _0x176a92={'raw':!![],'where':{}};var _0x755c7d={};var _0x5aa38a={'count':0x0,'rows':[]};return db[_0x6f2a('0x2e')][_0x6f2a('0x60')]({'where':{'id':_0x311bc1[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x2f4abc,null))[_0x6f2a('0x24')](function(_0x500fcf){if(_0x500fcf){_0x755c7d['model']=_[_0x6f2a('0x45')](db[_0x6f2a('0x61')][_0x6f2a('0x58')]);_0x755c7d[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0x311bc1[_0x6f2a('0x31')]);_0x755c7d[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x755c7d[_0x6f2a('0x34')],_0x755c7d[_0x6f2a('0x31')]);_0x176a92['attributes']=_[_0x6f2a('0x32')](_0x755c7d[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x311bc1[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x176a92[_0x6f2a('0x33')]=_0x176a92['attributes'][_0x6f2a('0x50')]?_0x176a92['attributes']:_0x755c7d[_0x6f2a('0x34')];if(!_0x311bc1[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x176a92['limit']=qs[_0x6f2a('0x1d')](_0x311bc1[_0x6f2a('0x31')]['limit']);_0x176a92[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x311bc1[_0x6f2a('0x31')]['offset']);}_0x176a92[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x311bc1[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x176a92[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_[_0x6f2a('0x59')](_0x311bc1[_0x6f2a('0x31')],_0x755c7d['filters']));_0x176a92[_0x6f2a('0x3a')][_0x6f2a('0x5a')]=_0x500fcf['id'];if(_0x311bc1[_0x6f2a('0x31')][_0x6f2a('0x3e')]){_0x176a92[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x176a92[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x176a92[_0x6f2a('0x33')],function(_0x7ddac2){var _0x4cb4de={};_0x4cb4de[_0x7ddac2]={'$like':'%'+_0x311bc1[_0x6f2a('0x31')]['filter']+'%'};return _0x4cb4de;})});}_0x176a92=_[_0x6f2a('0x3c')]({},_0x176a92,_0x311bc1[_0x6f2a('0x3f')]);return db['CmHopperFinal'][_0x6f2a('0x1e')]({'where':_0x176a92['where']})[_0x6f2a('0x24')](function(_0x2166d2){_0x5aa38a[_0x6f2a('0x1e')]=_0x2166d2;if(_0x311bc1[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x176a92[_0x6f2a('0x41')]=[{'all':!![]}];}return db[_0x6f2a('0x61')]['findAll'](_0x176a92);})[_0x6f2a('0x24')](function(_0x2ab9c1){_0x5aa38a[_0x6f2a('0x5c')]=_0x2ab9c1;return _0x5aa38a;});}})[_0x6f2a('0x24')](respondWithFilteredResult(_0x2f4abc,_0x176a92))['catch'](handleError(_0x2f4abc,null));};exports[_0x6f2a('0x62')]=function(_0x3f6313,_0x297a74,_0x2e4cc0){var _0x1ba69a={'raw':!![],'where':{}};var _0x5eeca6={};var _0x57c2da={'count':0x0,'rows':[]};return db['Campaign'][_0x6f2a('0x60')]({'where':{'id':_0x3f6313[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x297a74,null))['then'](function(_0x25b8f8){if(_0x25b8f8){_0x5eeca6['model']=_[_0x6f2a('0x45')](db[_0x6f2a('0x63')][_0x6f2a('0x58')]);_0x5eeca6['query']=_[_0x6f2a('0x45')](_0x3f6313[_0x6f2a('0x31')]);_0x5eeca6[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x5eeca6[_0x6f2a('0x34')],_0x5eeca6[_0x6f2a('0x31')]);_0x1ba69a['attributes']=_[_0x6f2a('0x32')](_0x5eeca6[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x3f6313['query'][_0x6f2a('0x35')]));_0x1ba69a[_0x6f2a('0x33')]=_0x1ba69a['attributes'][_0x6f2a('0x50')]?_0x1ba69a[_0x6f2a('0x33')]:_0x5eeca6[_0x6f2a('0x34')];if(!_0x3f6313[_0x6f2a('0x31')][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x1ba69a[_0x6f2a('0x1d')]=qs['limit'](_0x3f6313[_0x6f2a('0x31')]['limit']);_0x1ba69a['offset']=qs['offset'](_0x3f6313['query'][_0x6f2a('0x1b')]);}_0x1ba69a[_0x6f2a('0x38')]=qs['sort'](_0x3f6313['query'][_0x6f2a('0x39')]);_0x1ba69a[_0x6f2a('0x3a')]=qs[_0x6f2a('0x3b')](_[_0x6f2a('0x59')](_0x3f6313[_0x6f2a('0x31')],_0x5eeca6[_0x6f2a('0x3b')]));_0x1ba69a[_0x6f2a('0x3a')][_0x6f2a('0x5a')]=_0x25b8f8['id'];if(_0x3f6313['query'][_0x6f2a('0x3e')]){_0x1ba69a[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x1ba69a[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x1ba69a[_0x6f2a('0x33')],function(_0x3d5567){var _0x29f85e={};_0x29f85e[_0x3d5567]={'$like':'%'+_0x3f6313[_0x6f2a('0x31')][_0x6f2a('0x3e')]+'%'};return _0x29f85e;})});}_0x1ba69a=_[_0x6f2a('0x3c')]({},_0x1ba69a,_0x3f6313[_0x6f2a('0x3f')]);return db[_0x6f2a('0x63')][_0x6f2a('0x1e')]({'where':_0x1ba69a['where']})[_0x6f2a('0x24')](function(_0xc9558b){_0x57c2da['count']=_0xc9558b;if(_0x3f6313[_0x6f2a('0x31')][_0x6f2a('0x40')]){_0x1ba69a['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1ba69a);})['then'](function(_0x410407){_0x57c2da[_0x6f2a('0x5c')]=_0x410407;return _0x57c2da;});}})[_0x6f2a('0x24')](respondWithFilteredResult(_0x297a74,_0x1ba69a))[_0x6f2a('0x42')](handleError(_0x297a74,null));};exports[_0x6f2a('0x64')]=function(_0x45765a,_0x364cb0,_0x14e5a1){var _0x1edd99={};var _0x2ce0da={};var _0x4e0a48;var _0x4dbfb0;return db[_0x6f2a('0x2e')][_0x6f2a('0x60')]({'where':{'id':_0x45765a['params']['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x364cb0,null))['then'](function(_0x1edd4f){if(_0x1edd4f){_0x4e0a48=_0x1edd4f;_0x2ce0da[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x65')]['rawAttributes']);_0x2ce0da[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0x45765a[_0x6f2a('0x31')]);_0x2ce0da[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x2ce0da[_0x6f2a('0x34')],_0x2ce0da[_0x6f2a('0x31')]);_0x1edd99[_0x6f2a('0x33')]=_[_0x6f2a('0x32')](_0x2ce0da['model'],qs[_0x6f2a('0x35')](_0x45765a['query'][_0x6f2a('0x35')]));_0x1edd99['attributes']=_0x1edd99[_0x6f2a('0x33')]['length']?_0x1edd99[_0x6f2a('0x33')]:_0x2ce0da['model'];_0x1edd99['order']=qs[_0x6f2a('0x39')](_0x45765a[_0x6f2a('0x31')][_0x6f2a('0x39')]);_0x1edd99['where']=qs['filters'](_['pick'](_0x45765a[_0x6f2a('0x31')],_0x2ce0da['filters']));if(_0x45765a['query'][_0x6f2a('0x3e')]){_0x1edd99[_0x6f2a('0x3a')]=_[_0x6f2a('0x3c')](_0x1edd99[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x1edd99[_0x6f2a('0x33')],function(_0x2fd521){var _0x116b28={};_0x116b28[_0x2fd521]={'$like':'%'+_0x45765a['query'][_0x6f2a('0x3e')]+'%'};return _0x116b28;})});}_0x1edd99=_[_0x6f2a('0x3c')]({},_0x1edd99,_0x45765a[_0x6f2a('0x3f')]);return _0x4e0a48[_0x6f2a('0x64')](_0x1edd99);}})[_0x6f2a('0x24')](function(_0x23535e){if(_0x23535e){_0x4dbfb0=_0x23535e['length'];if(!_0x45765a['query'][_0x6f2a('0x36')](_0x6f2a('0x37'))){_0x1edd99[_0x6f2a('0x1d')]=qs[_0x6f2a('0x1d')](_0x45765a['query']['limit']);_0x1edd99[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x45765a[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}return _0x4e0a48[_0x6f2a('0x64')](_0x1edd99);}})[_0x6f2a('0x24')](function(_0x4f1f90){if(_0x4f1f90){return _0x4f1f90?{'count':_0x4dbfb0,'rows':_0x4f1f90}:null;}})[_0x6f2a('0x24')](respondWithResult(_0x364cb0,null))[_0x6f2a('0x42')](handleError(_0x364cb0,null));};exports[_0x6f2a('0x66')]=function(_0x286b3b,_0x2aaa2d,_0x1c2e54){var _0x28e698,_0x39c40a;var _0x189d2b=[];var _0x3773f5=moment()[_0x6f2a('0x67')](_0x6f2a('0x68'));return db['Campaign'][_0x6f2a('0x4c')]({'where':{'id':_0x286b3b[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x2aaa2d,null))['then'](function(_0x5a1365){if(_0x5a1365){_0x39c40a=_0x5a1365;return _0x5a1365[_0x6f2a('0x66')](_0x286b3b['body'][_0x6f2a('0x69')],_['omit'](_0x286b3b[_0x6f2a('0x47')],[_0x6f2a('0x69'),'id'])||{});}return null;})[_0x6f2a('0x6a')](function(_0x4f0c43){var _0x1c4328;var _0x4dde41;_0x28e698=_0x4f0c43||[];var _0x22a8e6=[];if(_0x4f0c43){for(var _0x284eeb=0x0;_0x284eeb<_0x4f0c43['length'];_0x284eeb+=0x1){var _0x3cefd1=_0x4f0c43[_0x284eeb][_0x6f2a('0x51')]({'plain':!![]});_0x39c40a[_0x6f2a('0x6b')]=_0x286b3b['body'][_0x6f2a('0x6b')]?_0x286b3b[_0x6f2a('0x47')][_0x6f2a('0x6b')]:_0x39c40a['dialCheckDuplicateType'];switch(_0x39c40a[_0x6f2a('0x6b')]){case _0x6f2a('0x6c'):_0x1c4328=squel['insert']()[_0x6f2a('0x6d')](_0x6f2a('0x6e'))['fromQuery']([_0x6f2a('0x6f'),_0x6f2a('0x70'),_0x6f2a('0x71'),'ListId',_0x6f2a('0x5a'),_0x6f2a('0x53'),_0x6f2a('0x54')],squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')](_0x6f2a('0x6f'),_0x6f2a('0x6f'))[_0x6f2a('0x73')](_0x6f2a('0x74'),_0x6f2a('0x70'))[_0x6f2a('0x73')]('id','ContactId')['field'](_0x3cefd1[_0x6f2a('0x75')]['toString'](),'ListId')[_0x6f2a('0x73')](_0x286b3b[_0x6f2a('0x44')]['id']['toString'](),_0x6f2a('0x5a'))['field']('\x27'+_0x3773f5+'\x27',_0x6f2a('0x53'))[_0x6f2a('0x73')]('\x27'+_0x3773f5+'\x27',_0x6f2a('0x54'))['from'](_0x6f2a('0x76'))[_0x6f2a('0x3a')](_0x6f2a('0x77'))[_0x6f2a('0x3a')](_0x6f2a('0x78'),_0x3cefd1[_0x6f2a('0x75')][_0x6f2a('0x79')]())[_0x6f2a('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0x6f2a('0x3a')](_0x6f2a('0x7a'),squel[_0x6f2a('0x72')]()['field'](_0x6f2a('0x7b'))['from'](_0x6f2a('0x7c'))[_0x6f2a('0x3a')](_0x6f2a('0x7d'),_0x286b3b['params']['id'][_0x6f2a('0x79')]()))[_0x6f2a('0x3a')](_0x6f2a('0x7a'),squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')](_0x6f2a('0x7e'))['from'](_0x6f2a('0x6e'))[_0x6f2a('0x3a')](_0x6f2a('0x7d'),_0x286b3b[_0x6f2a('0x44')]['id'][_0x6f2a('0x79')]())))[_0x6f2a('0x79')]();break;case _0x6f2a('0x7f'):_0x1c4328=squel['insert']()[_0x6f2a('0x6d')]('cm_hopper')[_0x6f2a('0x80')](['phone','scheduledAt',_0x6f2a('0x71'),_0x6f2a('0x81'),_0x6f2a('0x5a'),_0x6f2a('0x53'),'updatedAt'],squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')](_0x6f2a('0x6f'),_0x6f2a('0x6f'))[_0x6f2a('0x73')]('NOW()',_0x6f2a('0x70'))['field']('id',_0x6f2a('0x71'))[_0x6f2a('0x73')](_0x3cefd1['CmListId'][_0x6f2a('0x79')](),_0x6f2a('0x81'))[_0x6f2a('0x73')](_0x286b3b['params']['id']['toString'](),_0x6f2a('0x5a'))[_0x6f2a('0x73')]('\x27'+_0x3773f5+'\x27','createdAt')[_0x6f2a('0x73')]('\x27'+_0x3773f5+'\x27',_0x6f2a('0x54'))[_0x6f2a('0x82')](_0x6f2a('0x76'))['where'](_0x6f2a('0x77'))[_0x6f2a('0x3a')](_0x6f2a('0x78'),_0x3cefd1[_0x6f2a('0x75')][_0x6f2a('0x79')]())[_0x6f2a('0x3a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6f2a('0x7a'),squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')](_0x6f2a('0x7e'))[_0x6f2a('0x82')](_0x6f2a('0x6e'))[_0x6f2a('0x3a')](_0x6f2a('0x7d'),_0x286b3b[_0x6f2a('0x44')]['id'][_0x6f2a('0x79')]())))[_0x6f2a('0x79')]();break;default:_0x1c4328=squel[_0x6f2a('0x83')]()['into'](_0x6f2a('0x6e'))[_0x6f2a('0x80')]([_0x6f2a('0x6f'),'scheduledAt',_0x6f2a('0x71'),'ListId','CampaignId','createdAt',_0x6f2a('0x54')],squel[_0x6f2a('0x72')]()['field'](_0x6f2a('0x6f'),_0x6f2a('0x6f'))[_0x6f2a('0x73')]('NOW()',_0x6f2a('0x70'))['field']('id',_0x6f2a('0x71'))[_0x6f2a('0x73')](_0x3cefd1['CmListId'][_0x6f2a('0x79')](),'ListId')[_0x6f2a('0x73')](_0x286b3b[_0x6f2a('0x44')]['id'][_0x6f2a('0x79')](),_0x6f2a('0x5a'))['field']('\x27'+_0x3773f5+'\x27',_0x6f2a('0x53'))['field']('\x27'+_0x3773f5+'\x27',_0x6f2a('0x54'))[_0x6f2a('0x82')](_0x6f2a('0x76'))[_0x6f2a('0x3a')](_0x6f2a('0x77'))[_0x6f2a('0x3a')](_0x6f2a('0x78'),_0x3cefd1[_0x6f2a('0x75')][_0x6f2a('0x79')]())[_0x6f2a('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x6f2a('0x79')]();}_0x4dde41=squel[_0x6f2a('0x83')]()[_0x6f2a('0x6d')]('cm_hopper_additional_phones')[_0x6f2a('0x80')]([_0x6f2a('0x84'),_0x6f2a('0x70'),_0x6f2a('0x6f'),_0x6f2a('0x85'),_0x6f2a('0x53'),_0x6f2a('0x54')],squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')]('h.id','id')[_0x6f2a('0x73')](_0x6f2a('0x74'),_0x6f2a('0x70'))[_0x6f2a('0x73')](_0x6f2a('0x86'),_0x6f2a('0x6f'))['field']('ci.OrderBY',_0x6f2a('0x85'))[_0x6f2a('0x73')]('\x27'+_0x3773f5+'\x27',_0x6f2a('0x53'))[_0x6f2a('0x73')]('\x27'+_0x3773f5+'\x27',_0x6f2a('0x54'))[_0x6f2a('0x82')](_0x6f2a('0x87'),'ci')[_0x6f2a('0x88')](_0x6f2a('0x6e'),'h',_0x6f2a('0x89'))['where']('h.ListId\x20=\x20?',_0x3cefd1[_0x6f2a('0x75')]['toString']())['where']('h.CampaignId=?',_0x286b3b[_0x6f2a('0x44')]['id'][_0x6f2a('0x79')]())['where']('h.createdAt\x20=\x20?',_0x3773f5))[_0x6f2a('0x79')]();_0x22a8e6[_0x6f2a('0x8a')](db[_0x6f2a('0x8b')][_0x6f2a('0x31')](_0x1c4328));_0x189d2b[_0x6f2a('0x8a')](db[_0x6f2a('0x8b')][_0x6f2a('0x31')](_0x4dde41));}return BPromise[_0x6f2a('0x8c')](_0x22a8e6);}})[_0x6f2a('0x24')](function(){return BPromise[_0x6f2a('0x8c')](_0x189d2b);})[_0x6f2a('0x24')](function(){return _0x28e698;})['then'](respondWithResult(_0x2aaa2d,null))['catch'](handleError(_0x2aaa2d,null));};exports[_0x6f2a('0x8d')]=function(_0x43b9cd,_0x40207a,_0x106f23){return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')]({'where':{'id':_0x43b9cd['params']['id']}})['then'](handleEntityNotFound(_0x40207a,null))[_0x6f2a('0x24')](function(_0x434db4){if(_0x434db4){return _0x434db4[_0x6f2a('0x8d')](_0x43b9cd[_0x6f2a('0x31')][_0x6f2a('0x69')]);}})['then'](function(_0x32d1ca){if(_0x32d1ca){return db[_0x6f2a('0x57')][_0x6f2a('0x27')]({'where':{'ListId':_0x43b9cd[_0x6f2a('0x31')][_0x6f2a('0x69')],'CampaignId':_0x43b9cd[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](function(){return _0x32d1ca;});}})['then'](respondWithStatusCode(_0x40207a,null))[_0x6f2a('0x42')](handleError(_0x40207a,null));};exports[_0x6f2a('0x8e')]=function(_0x358231,_0x387563,_0x67c8a1){var _0x5d54e2={};var _0x2e4528={};var _0x1fdd1b;var _0x180e51;return db[_0x6f2a('0x2e')]['findOne']({'where':{'id':_0x358231[_0x6f2a('0x44')]['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x387563,null))[_0x6f2a('0x24')](function(_0x21844e){if(_0x21844e){_0x1fdd1b=_0x21844e;_0x2e4528[_0x6f2a('0x34')]=_[_0x6f2a('0x45')](db[_0x6f2a('0x65')][_0x6f2a('0x58')]);_0x2e4528[_0x6f2a('0x31')]=_[_0x6f2a('0x45')](_0x358231[_0x6f2a('0x31')]);_0x2e4528[_0x6f2a('0x3b')]=_[_0x6f2a('0x32')](_0x2e4528['model'],_0x2e4528[_0x6f2a('0x31')]);_0x5d54e2['attributes']=_[_0x6f2a('0x32')](_0x2e4528[_0x6f2a('0x34')],qs[_0x6f2a('0x35')](_0x358231[_0x6f2a('0x31')][_0x6f2a('0x35')]));_0x5d54e2['attributes']=_0x5d54e2[_0x6f2a('0x33')][_0x6f2a('0x50')]?_0x5d54e2['attributes']:_0x2e4528[_0x6f2a('0x34')];_0x5d54e2[_0x6f2a('0x38')]=qs[_0x6f2a('0x39')](_0x358231[_0x6f2a('0x31')]['sort']);_0x5d54e2['where']=qs['filters'](_[_0x6f2a('0x59')](_0x358231[_0x6f2a('0x31')],_0x2e4528[_0x6f2a('0x3b')]));if(_0x358231[_0x6f2a('0x31')]['filter']){_0x5d54e2[_0x6f2a('0x3a')]=_['merge'](_0x5d54e2[_0x6f2a('0x3a')],{'$or':_[_0x6f2a('0x2d')](_0x5d54e2['attributes'],function(_0xb471be){var _0x1ffe5d={};_0x1ffe5d[_0xb471be]={'$like':'%'+_0x358231['query'][_0x6f2a('0x3e')]+'%'};return _0x1ffe5d;})});}_0x5d54e2=_[_0x6f2a('0x3c')]({},_0x5d54e2,_0x358231[_0x6f2a('0x3f')]);return _0x1fdd1b[_0x6f2a('0x8e')](_0x5d54e2);}})[_0x6f2a('0x24')](function(_0x22f91a){if(_0x22f91a){_0x180e51=_0x22f91a[_0x6f2a('0x50')];if(!_0x358231[_0x6f2a('0x31')]['hasOwnProperty'](_0x6f2a('0x37'))){_0x5d54e2[_0x6f2a('0x1d')]=qs[_0x6f2a('0x1d')](_0x358231['query'][_0x6f2a('0x1d')]);_0x5d54e2[_0x6f2a('0x1b')]=qs[_0x6f2a('0x1b')](_0x358231[_0x6f2a('0x31')][_0x6f2a('0x1b')]);}return _0x1fdd1b[_0x6f2a('0x8e')](_0x5d54e2);}})[_0x6f2a('0x24')](function(_0x265720){if(_0x265720){return _0x265720?{'count':_0x180e51,'rows':_0x265720}:null;}})[_0x6f2a('0x24')](respondWithResult(_0x387563,null))[_0x6f2a('0x42')](handleError(_0x387563,null));};exports['addBlackLists']=function(_0x219dcc,_0x48d771,_0xfb639e){var _0x2b553d,_0x4b0228;var _0x2317fa=[];var _0x152db4=moment()[_0x6f2a('0x67')](_0x6f2a('0x68'));return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')]({'where':{'id':_0x219dcc[_0x6f2a('0x44')]['id']}})['then'](handleEntityNotFound(_0x48d771,null))[_0x6f2a('0x24')](function(_0x5e5059){if(_0x5e5059){_0x4b0228=_0x5e5059;return _0x5e5059[_0x6f2a('0x8f')](_0x219dcc[_0x6f2a('0x47')][_0x6f2a('0x69')],_[_0x6f2a('0x52')](_0x219dcc[_0x6f2a('0x47')],[_0x6f2a('0x69'),'id'])||{});}return null;})[_0x6f2a('0x6a')](function(_0x2e51c2){var _0x26f596;var _0x5b53aa;_0x2b553d=_0x2e51c2||[];var _0x5abd75=[];if(_0x2e51c2){for(var _0x5b07da=0x0;_0x5b07da<_0x2e51c2[_0x6f2a('0x50')];_0x5b07da+=0x1){var _0x277153=_0x2e51c2[_0x5b07da][_0x6f2a('0x51')]({'plain':!![]});_0x26f596=squel[_0x6f2a('0x83')]()[_0x6f2a('0x6d')](_0x6f2a('0x90'))[_0x6f2a('0x80')]([_0x6f2a('0x6f'),'ContactId',_0x6f2a('0x81'),'CampaignId','createdAt',_0x6f2a('0x54')],squel[_0x6f2a('0x72')]()[_0x6f2a('0x73')](_0x6f2a('0x6f'),_0x6f2a('0x6f'))[_0x6f2a('0x73')]('id',_0x6f2a('0x71'))[_0x6f2a('0x73')](_0x277153[_0x6f2a('0x75')]['toString'](),_0x6f2a('0x81'))['field'](_0x219dcc[_0x6f2a('0x44')]['id'][_0x6f2a('0x79')](),_0x6f2a('0x5a'))[_0x6f2a('0x73')]('NOW()',_0x6f2a('0x53'))[_0x6f2a('0x73')]('NOW()',_0x6f2a('0x54'))[_0x6f2a('0x82')]('cm_contacts')[_0x6f2a('0x3a')](_0x6f2a('0x77'))[_0x6f2a('0x3a')]('ListId\x20=\x20?',_0x277153['CmListId'][_0x6f2a('0x79')]())[_0x6f2a('0x3a')](_0x6f2a('0x91')))[_0x6f2a('0x79')]();_0x5abd75['push'](db['sequelize']['query'](_0x26f596));}return BPromise[_0x6f2a('0x8c')](_0x5abd75);}})[_0x6f2a('0x24')](function(){return _0x2b553d;})[_0x6f2a('0x24')](respondWithResult(_0x48d771,null))['catch'](handleError(_0x48d771,null));};exports[_0x6f2a('0x92')]=function(_0x31d939,_0x4e2dab,_0x468325){return db[_0x6f2a('0x2e')][_0x6f2a('0x4c')]({'where':{'id':_0x31d939['params']['id']}})[_0x6f2a('0x24')](handleEntityNotFound(_0x4e2dab,null))['then'](function(_0x552a59){if(_0x552a59){return _0x552a59[_0x6f2a('0x92')](_0x31d939[_0x6f2a('0x31')][_0x6f2a('0x69')]);}})['then'](function(_0x4de926){if(_0x4de926){return db[_0x6f2a('0x63')][_0x6f2a('0x27')]({'where':{'ListId':_0x31d939[_0x6f2a('0x31')]['ids'],'CampaignId':_0x31d939['params']['id']}})[_0x6f2a('0x24')](function(){return _0x4de926;});}})['then'](respondWithStatusCode(_0x4e2dab,null))['catch'](handleError(_0x4e2dab,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 38929be..e67a143 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x7a54,0x106));var _0x47a5=function(_0x669215,_0x365a2f){_0x669215=_0x669215-0x0;var _0x2f9637=_0x7a54[_0x669215];return _0x2f9637;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3bc31e4..cfc7e27 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 _0x0fc2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash'];(function(_0x18e3b7,_0x1b44e2){var _0x2f0143=function(_0x16264f){while(--_0x16264f){_0x18e3b7['push'](_0x18e3b7['shift']());}};_0x2f0143(++_0x1b44e2);}(_0x0fc2,0x6e));var _0x20fc=function(_0x588dad,_0xa22fd1){_0x588dad=_0x588dad-0x0;var _0x5171f7=_0x0fc2[_0x588dad];return _0x5171f7;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var moment=require(_0x20fc('0x2'));var BPromise=require(_0x20fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20fc('0x4'));var db=require(_0x20fc('0x5'))['db'];var utils=require(_0x20fc('0x6'));var logger=require(_0x20fc('0x7'))(_0x20fc('0x8'));var config=require(_0x20fc('0x9'));var jayson=require(_0x20fc('0xa'));var client=jayson[_0x20fc('0xb')][_0x20fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc556e8,_0x157c28,_0x470d1a){return new BPromise(function(_0x24b617,_0x17415e){return client[_0x20fc('0xd')](_0xc556e8,_0x470d1a)[_0x20fc('0xe')](function(_0x5cb749){logger[_0x20fc('0xf')](_0x20fc('0x10'),_0x157c28,_0x20fc('0x11'));logger['debug'](_0x20fc('0x12'),_0x157c28,_0x20fc('0x11'),JSON[_0x20fc('0x13')](_0x5cb749));if(_0x5cb749[_0x20fc('0x14')]){if(_0x5cb749[_0x20fc('0x14')][_0x20fc('0x15')]===0x1f4){logger[_0x20fc('0x14')](_0x20fc('0x10'),_0x157c28,_0x5cb749['error'][_0x20fc('0x16')]);return _0x17415e(_0x5cb749['error'][_0x20fc('0x16')]);}logger['error'](_0x20fc('0x10'),_0x157c28,_0x5cb749['error'][_0x20fc('0x16')]);return _0x24b617(_0x5cb749[_0x20fc('0x14')][_0x20fc('0x16')]);}else{logger[_0x20fc('0xf')](_0x20fc('0x10'),_0x157c28,_0x20fc('0x11'));_0x24b617(_0x5cb749[_0x20fc('0x17')][_0x20fc('0x16')]);}})['catch'](function(_0x56eaf4){logger[_0x20fc('0x14')](_0x20fc('0x10'),_0x157c28,_0x56eaf4);_0x17415e(_0x56eaf4);});});}exports[_0x20fc('0x18')]=function(_0x421ff8){var _0x4d5e00=this;return new Promise(function(_0x3f4190,_0x322e2c){return db[_0x20fc('0x19')][_0x20fc('0x1a')]({'raw':_0x421ff8[_0x20fc('0x1b')]?_0x421ff8[_0x20fc('0x1b')][_0x20fc('0x1c')]===undefined?!![]:![]:!![],'where':_0x421ff8[_0x20fc('0x1b')]?_0x421ff8[_0x20fc('0x1b')][_0x20fc('0x1d')]||null:null,'attributes':_0x421ff8['options']?_0x421ff8[_0x20fc('0x1b')][_0x20fc('0x1e')]||null:null,'limit':_0x421ff8['options']?_0x421ff8[_0x20fc('0x1b')][_0x20fc('0x1f')]||null:null,'include':_0x421ff8[_0x20fc('0x1b')]?_0x421ff8[_0x20fc('0x1b')][_0x20fc('0x20')]?_[_0x20fc('0x21')](_0x421ff8[_0x20fc('0x1b')]['include'],function(_0x37d3ad){return{'model':db[_0x37d3ad[_0x20fc('0x22')]],'as':_0x37d3ad['as'],'attributes':_0x37d3ad['attributes'],'include':_0x37d3ad[_0x20fc('0x20')]?_[_0x20fc('0x21')](_0x37d3ad[_0x20fc('0x20')],function(_0x2ed63f){return{'model':db[_0x2ed63f['model']],'as':_0x2ed63f['as'],'attributes':_0x2ed63f[_0x20fc('0x1e')],'include':_0x2ed63f['include']?_['map'](_0x2ed63f[_0x20fc('0x20')],function(_0x554092){return{'model':db[_0x554092[_0x20fc('0x22')]],'as':_0x554092['as'],'attributes':_0x554092[_0x20fc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x20fc('0xe')](function(_0x5eae37){logger['info']('GetCampaign',_0x421ff8);logger[_0x20fc('0x23')](_0x20fc('0x18'),_0x421ff8,JSON[_0x20fc('0x13')](_0x5eae37));_0x3f4190(_0x5eae37);})[_0x20fc('0x24')](function(_0x5d705f){logger['error'](_0x20fc('0x18'),_0x5d705f[_0x20fc('0x16')],_0x421ff8);_0x322e2c(_0x4d5e00['error'](0x1f4,_0x5d705f['message']));});});}; \ No newline at end of file +var _0x87ae=['GetCampaign','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','Campaign','options','raw','where','attributes','include','map','model'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x87ae,0xf5));var _0xe87a=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x87ae[_0x412e27];return _0x53da42;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('Campaign,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});}exports['GetCampaign']=function(_0x4160e2){var _0x5c9acf=this;return new Promise(function(_0x182e6f,_0xac5b46){return db[_0xe87a('0x11')]['findAll']({'raw':_0x4160e2[_0xe87a('0x12')]?_0x4160e2['options'][_0xe87a('0x13')]===undefined?!![]:![]:!![],'where':_0x4160e2[_0xe87a('0x12')]?_0x4160e2[_0xe87a('0x12')][_0xe87a('0x14')]||null:null,'attributes':_0x4160e2[_0xe87a('0x12')]?_0x4160e2[_0xe87a('0x12')][_0xe87a('0x15')]||null:null,'limit':_0x4160e2[_0xe87a('0x12')]?_0x4160e2['options']['limit']||null:null,'include':_0x4160e2[_0xe87a('0x12')]?_0x4160e2[_0xe87a('0x12')][_0xe87a('0x16')]?_[_0xe87a('0x17')](_0x4160e2[_0xe87a('0x12')][_0xe87a('0x16')],function(_0x56eba0){return{'model':db[_0x56eba0['model']],'as':_0x56eba0['as'],'attributes':_0x56eba0['attributes'],'include':_0x56eba0['include']?_[_0xe87a('0x17')](_0x56eba0['include'],function(_0x1108d0){return{'model':db[_0x1108d0['model']],'as':_0x1108d0['as'],'attributes':_0x1108d0[_0xe87a('0x15')],'include':_0x1108d0[_0xe87a('0x16')]?_[_0xe87a('0x17')](_0x1108d0[_0xe87a('0x16')],function(_0x294d8b){return{'model':db[_0x294d8b[_0xe87a('0x18')]],'as':_0x294d8b['as'],'attributes':_0x294d8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe87a('0x7')](function(_0x5b984f){logger['info'](_0xe87a('0x19'),_0x4160e2);logger['debug']('GetCampaign',_0x4160e2,JSON['stringify'](_0x5b984f));_0x182e6f(_0x5b984f);})[_0xe87a('0x1a')](function(_0x6feaf6){logger[_0xe87a('0xe')]('GetCampaign',_0x6feaf6['message'],_0x4160e2);_0xac5b46(_0x5c9acf[_0xe87a('0xe')](0x1f4,_0x6feaf6['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 427660f..b79360c 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 _0x8d97=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x8d97,0x82));var _0x78d9=function(_0x179094,_0x435a70){_0x179094=_0x179094-0x0;var _0x4db5d1=_0x8d97[_0x179094];return _0x4db5d1;};'use strict';var multer=require('multer');var util=require(_0x78d9('0x0'));var path=require(_0x78d9('0x1'));var timeout=require('connect-timeout');var express=require(_0x78d9('0x2'));var router=express[_0x78d9('0x3')]();var fs_extra=require(_0x78d9('0x4'));var auth=require(_0x78d9('0x5'));var interaction=require(_0x78d9('0x6'));var config=require('../../config/environment');var controller=require(_0x78d9('0x7'));router[_0x78d9('0x8')]('/',auth[_0x78d9('0x9')](),controller['index']);router['get']('/:id',auth[_0x78d9('0x9')](),controller[_0x78d9('0xa')]);router[_0x78d9('0x8')](_0x78d9('0xb'),auth[_0x78d9('0x9')](),controller[_0x78d9('0xc')]);router['get'](_0x78d9('0xd'),auth[_0x78d9('0x9')](),controller[_0x78d9('0xe')]);router['get']('/:id/hopper_finals',auth[_0x78d9('0x9')](),controller[_0x78d9('0xf')]);router[_0x78d9('0x8')](_0x78d9('0x10'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x11')]);router['get'](_0x78d9('0x12'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x13')]);router[_0x78d9('0x8')](_0x78d9('0x14'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x15')]);router[_0x78d9('0x16')]('/',auth[_0x78d9('0x9')](),controller[_0x78d9('0x17')]);router[_0x78d9('0x16')](_0x78d9('0x18'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x19')]);router[_0x78d9('0x16')](_0x78d9('0x12'),auth[_0x78d9('0x9')](),controller['addLists']);router[_0x78d9('0x16')](_0x78d9('0x14'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x1a')]);router[_0x78d9('0x1b')](_0x78d9('0x1c'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x1d')]);router[_0x78d9('0x1e')](_0x78d9('0x1c'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x1f')]);router[_0x78d9('0x1e')](_0x78d9('0x12'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x20')]);router['delete'](_0x78d9('0x14'),auth[_0x78d9('0x9')](),controller[_0x78d9('0x21')]);module[_0x78d9('0x22')]=router; \ No newline at end of file +var _0xd84c=['getBlackLists','post','create','clone','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_finals','getHopperBlacks','/:id/lists','/:id/blacklists'];(function(_0xf47702,_0x58005c){var _0x6b8d4a=function(_0x429080){while(--_0x429080){_0xf47702['push'](_0xf47702['shift']());}};_0x6b8d4a(++_0x58005c);}(_0xd84c,0x12d));var _0xcd84=function(_0x64fad0,_0x349356){_0x64fad0=_0x64fad0-0x0;var _0x1f59d9=_0xd84c[_0x64fad0];return _0x1f59d9;};'use strict';var multer=require('multer');var util=require(_0xcd84('0x0'));var path=require(_0xcd84('0x1'));var timeout=require('connect-timeout');var express=require(_0xcd84('0x2'));var router=express[_0xcd84('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcd84('0x4'));var interaction=require(_0xcd84('0x5'));var config=require(_0xcd84('0x6'));var controller=require(_0xcd84('0x7'));router[_0xcd84('0x8')]('/',auth[_0xcd84('0x9')](),controller[_0xcd84('0xa')]);router[_0xcd84('0x8')](_0xcd84('0xb'),auth[_0xcd84('0x9')](),controller[_0xcd84('0xc')]);router['get'](_0xcd84('0xd'),auth[_0xcd84('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xcd84('0x8')](_0xcd84('0xe'),auth[_0xcd84('0x9')](),controller['getHopperFinals']);router[_0xcd84('0x8')]('/:id/hopper_black',auth[_0xcd84('0x9')](),controller[_0xcd84('0xf')]);router[_0xcd84('0x8')](_0xcd84('0x10'),auth['isAuthenticated'](),controller['getLists']);router[_0xcd84('0x8')](_0xcd84('0x11'),auth[_0xcd84('0x9')](),controller[_0xcd84('0x12')]);router[_0xcd84('0x13')]('/',auth[_0xcd84('0x9')](),controller[_0xcd84('0x14')]);router[_0xcd84('0x13')]('/:id/clone',auth[_0xcd84('0x9')](),controller[_0xcd84('0x15')]);router[_0xcd84('0x13')](_0xcd84('0x10'),auth[_0xcd84('0x9')](),controller['addLists']);router[_0xcd84('0x13')](_0xcd84('0x11'),auth[_0xcd84('0x9')](),controller['addBlackLists']);router[_0xcd84('0x16')](_0xcd84('0xb'),auth[_0xcd84('0x9')](),controller[_0xcd84('0x17')]);router[_0xcd84('0x18')](_0xcd84('0xb'),auth[_0xcd84('0x9')](),controller[_0xcd84('0x19')]);router[_0xcd84('0x18')](_0xcd84('0x10'),auth['isAuthenticated'](),controller[_0xcd84('0x1a')]);router[_0xcd84('0x18')](_0xcd84('0x11'),auth['isAuthenticated'](),controller[_0xcd84('0x1b')]);module[_0xcd84('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1f82a94..55483e6 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 _0x0393=['STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x4dcba9,_0x591a90){var _0x2b1148=function(_0x3a1061){while(--_0x3a1061){_0x4dcba9['push'](_0x4dcba9['shift']());}};_0x2b1148(++_0x591a90);}(_0x0393,0x130));var _0x3039=function(_0xae23aa,_0x4c0b3a){_0xae23aa=_0xae23aa-0x0;var _0xf6310a=_0x0393[_0xae23aa];return _0xf6310a;};'use strict';var Sequelize=require(_0x3039('0x0'));module[_0x3039('0x1')]={'key':{'type':Sequelize[_0x3039('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x3039('0x2')]},'name':{'type':Sequelize[_0x3039('0x3')],'get':function(){return this[_0x3039('0x4')](_0x3039('0x5'));}}}; \ No newline at end of file +var _0x8f97=['TEXT','medium','getDataValue','key','sequelize','STRING'];(function(_0x12fd67,_0x58c77d){var _0x1b7913=function(_0x28458b){while(--_0x28458b){_0x12fd67['push'](_0x12fd67['shift']());}};_0x1b7913(++_0x58c77d);}(_0x8f97,0xac));var _0x78f9=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0x8f97[_0x469ae2];return _0x5e33e4;};'use strict';var Sequelize=require(_0x78f9('0x0'));module['exports']={'key':{'type':Sequelize[_0x78f9('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x78f9('0x2')],'length':_0x78f9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x78f9('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x78f9('0x4')](_0x78f9('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2601f34..f82ca06 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 _0x96c8=['includeAll','include','rows','catch','params','rawAttributes','length','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','options'];(function(_0x2c93ec,_0x42c0a7){var _0x4fc1d8=function(_0x4c71b4){while(--_0x4c71b4){_0x2c93ec['push'](_0x2c93ec['shift']());}};_0x4fc1d8(++_0x42c0a7);}(_0x96c8,0x16a));var _0x896c=function(_0x458ced,_0x52cfea){_0x458ced=_0x458ced-0x0;var _0x596246=_0x96c8[_0x458ced];return _0x596246;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x896c('0x0'));var zipdir=require(_0x896c('0x1'));var jsonpatch=require(_0x896c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x896c('0x3'));var Mustache=require('mustache');var util=require(_0x896c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x896c('0x5'));var ejs=require(_0x896c('0x6'));var fs=require('fs');var fs_extra=require(_0x896c('0x7'));var _=require(_0x896c('0x8'));var squel=require(_0x896c('0x9'));var crypto=require('crypto');var jsforce=require(_0x896c('0xa'));var deskjs=require(_0x896c('0xb'));var toCsv=require(_0x896c('0x5'));var querystring=require(_0x896c('0xc'));var Papa=require(_0x896c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x896c('0xe'));var as=require(_0x896c('0xf'));var hardwareService=require(_0x896c('0x10'));var logger=require(_0x896c('0x11'))(_0x896c('0x12'));var utils=require(_0x896c('0x13'));var config=require(_0x896c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x896c('0x15'))['db'];function respondWithStatusCode(_0x26d768,_0x1fb459){_0x1fb459=_0x1fb459||0xcc;return function(_0x32b968){if(_0x32b968){return _0x26d768[_0x896c('0x16')](_0x1fb459);}return _0x26d768['status'](_0x1fb459)[_0x896c('0x17')]();};}function respondWithResult(_0x3e4fd5,_0xbaefe2){_0xbaefe2=_0xbaefe2||0xc8;return function(_0x12f2e0){if(_0x12f2e0){return _0x3e4fd5[_0x896c('0x18')](_0xbaefe2)[_0x896c('0x19')](_0x12f2e0);}};}function respondWithFilteredResult(_0x27bbda,_0x1088af){return function(_0xe42b3){if(_0xe42b3){var _0x4a9b0d=typeof _0x1088af['offset']==='undefined'&&typeof _0x1088af['limit']===_0x896c('0x1a');var _0x222006=_0xe42b3['count'];var _0x2bd670=_0x4a9b0d?0x0:_0x1088af[_0x896c('0x1b')];var _0x2e76e8=_0x4a9b0d?_0xe42b3[_0x896c('0x1c')]:_0x1088af[_0x896c('0x1b')]+_0x1088af[_0x896c('0x1d')];var _0x4d89bb;if(_0x2e76e8>=_0x222006){_0x2e76e8=_0x222006;_0x4d89bb=0xc8;}else{_0x4d89bb=0xce;}_0x27bbda['status'](_0x4d89bb);return _0x27bbda[_0x896c('0x1e')](_0x896c('0x1f'),_0x2bd670+'-'+_0x2e76e8+'/'+_0x222006)['json'](_0xe42b3);}return null;};}function patchUpdates(_0xe6708d){return function(_0x56f3d3){try{jsonpatch[_0x896c('0x20')](_0x56f3d3,_0xe6708d,!![]);}catch(_0x181010){return BPromise[_0x896c('0x21')](_0x181010);}return _0x56f3d3['save']();};}function saveUpdates(_0x4ea8da,_0xd09d23){return function(_0xc4373){if(_0xc4373){return _0xc4373[_0x896c('0x22')](_0x4ea8da)[_0x896c('0x23')](function(_0x575599){return _0x575599;});}return null;};}function removeEntity(_0x188978,_0x54f9ac){return function(_0x42cc4a){if(_0x42cc4a){return _0x42cc4a[_0x896c('0x24')]()[_0x896c('0x23')](function(){var _0x35d4ee=_0x42cc4a[_0x896c('0x25')]({'plain':!![]});var _0x46e642=_0x896c('0x26');return db[_0x896c('0x27')][_0x896c('0x24')]({'where':{'type':_0x46e642,'resourceId':_0x35d4ee['id']}})['then'](function(){return _0x42cc4a;});})[_0x896c('0x23')](function(){_0x188978['status'](0xcc)[_0x896c('0x17')]();});}};}function handleEntityNotFound(_0x38d7b3,_0x1921ca){return function(_0x4db604){if(!_0x4db604){_0x38d7b3[_0x896c('0x16')](0x194);}return _0x4db604;};}function handleError(_0x5e8fa4,_0x410c85){_0x410c85=_0x410c85||0x1f4;return function(_0x2055cf){logger[_0x896c('0x28')](_0x2055cf[_0x896c('0x29')]);if(_0x2055cf[_0x896c('0x2a')]){delete _0x2055cf['name'];}_0x5e8fa4[_0x896c('0x18')](_0x410c85)[_0x896c('0x2b')](_0x2055cf);};}exports[_0x896c('0x2c')]=function(_0xe03391,_0x10f7f2){var _0x1131fc={},_0x50d56b={},_0x5af6ed={'count':0x0,'rows':[]};var _0x4af40e=_[_0x896c('0x2d')](db[_0x896c('0x2e')]['rawAttributes'],function(_0x37ddac){return{'name':_0x37ddac[_0x896c('0x2f')],'type':_0x37ddac['type'][_0x896c('0x30')]};});_0x50d56b[_0x896c('0x31')]=_[_0x896c('0x2d')](_0x4af40e,_0x896c('0x2a'));_0x50d56b[_0x896c('0x32')]=_[_0x896c('0x33')](_0xe03391[_0x896c('0x32')]);_0x50d56b[_0x896c('0x34')]=_[_0x896c('0x35')](_0x50d56b[_0x896c('0x31')],_0x50d56b[_0x896c('0x32')]);_0x1131fc['attributes']=_[_0x896c('0x35')](_0x50d56b['model'],qs[_0x896c('0x36')](_0xe03391[_0x896c('0x32')]['fields']));_0x1131fc[_0x896c('0x37')]=_0x1131fc[_0x896c('0x37')]['length']?_0x1131fc[_0x896c('0x37')]:_0x50d56b[_0x896c('0x31')];if(!_0xe03391[_0x896c('0x32')][_0x896c('0x38')](_0x896c('0x39'))){_0x1131fc[_0x896c('0x1d')]=qs[_0x896c('0x1d')](_0xe03391[_0x896c('0x32')][_0x896c('0x1d')]);_0x1131fc['offset']=qs[_0x896c('0x1b')](_0xe03391[_0x896c('0x32')]['offset']);}_0x1131fc[_0x896c('0x3a')]=qs[_0x896c('0x3b')](_0xe03391[_0x896c('0x32')]['sort']);_0x1131fc['where']=qs[_0x896c('0x34')](_['pick'](_0xe03391[_0x896c('0x32')],_0x50d56b[_0x896c('0x34')]),_0x4af40e);if(_0xe03391[_0x896c('0x32')][_0x896c('0x3c')]){_0x1131fc[_0x896c('0x3d')]=_['merge'](_0x1131fc[_0x896c('0x3d')],{'$or':[{'key':{'$like':'%'+_0xe03391[_0x896c('0x32')][_0x896c('0x3c')]+'%'}},{'value':{'$like':'%'+_0xe03391[_0x896c('0x32')][_0x896c('0x3c')]+'%'}}]});}_0x1131fc=_['merge']({},_0x1131fc,_0xe03391[_0x896c('0x3e')]);var _0x510f4f={'where':_0x1131fc[_0x896c('0x3d')]};return db[_0x896c('0x2e')][_0x896c('0x1c')](_0x510f4f)[_0x896c('0x23')](function(_0x4904ed){_0x5af6ed[_0x896c('0x1c')]=_0x4904ed;if(_0xe03391[_0x896c('0x32')][_0x896c('0x3f')]){_0x1131fc[_0x896c('0x40')]=[{'all':!![]}];}return db[_0x896c('0x2e')]['findAll'](_0x1131fc);})[_0x896c('0x23')](function(_0xa5a905){_0x5af6ed[_0x896c('0x41')]=_0xa5a905;return _0x5af6ed;})[_0x896c('0x23')](respondWithFilteredResult(_0x10f7f2,_0x1131fc))[_0x896c('0x42')](handleError(_0x10f7f2,null));};exports['show']=function(_0x32cb6f,_0x38b91c){var _0x406491={'raw':!![],'where':{'id':_0x32cb6f[_0x896c('0x43')]['id']}},_0x3e6eb9={};_0x3e6eb9['model']=_['keys'](db[_0x896c('0x2e')][_0x896c('0x44')]);_0x3e6eb9[_0x896c('0x32')]=_[_0x896c('0x33')](_0x32cb6f[_0x896c('0x32')]);_0x3e6eb9[_0x896c('0x34')]=_[_0x896c('0x35')](_0x3e6eb9['model'],_0x3e6eb9[_0x896c('0x32')]);_0x406491[_0x896c('0x37')]=_[_0x896c('0x35')](_0x3e6eb9[_0x896c('0x31')],qs[_0x896c('0x36')](_0x32cb6f['query']['fields']));_0x406491[_0x896c('0x37')]=_0x406491['attributes'][_0x896c('0x45')]?_0x406491[_0x896c('0x37')]:_0x3e6eb9[_0x896c('0x31')];if(_0x32cb6f['query']['includeAll']){_0x406491['include']=[{'all':!![]}];}_0x406491=_['merge']({},_0x406491,_0x32cb6f[_0x896c('0x3e')]);return db['CannedAnswer'][_0x896c('0x46')](_0x406491)[_0x896c('0x23')](handleEntityNotFound(_0x38b91c,null))['then'](respondWithResult(_0x38b91c,null))['catch'](handleError(_0x38b91c,null));};exports[_0x896c('0x22')]=function(_0x33da1e,_0x4787e7){if(_0x33da1e[_0x896c('0x47')]['id']){delete _0x33da1e[_0x896c('0x47')]['id'];}return db[_0x896c('0x2e')][_0x896c('0x46')]({'where':{'id':_0x33da1e[_0x896c('0x43')]['id']}})[_0x896c('0x23')](handleEntityNotFound(_0x4787e7,null))['then'](saveUpdates(_0x33da1e[_0x896c('0x47')],null))['then'](respondWithResult(_0x4787e7,null))['catch'](handleError(_0x4787e7,null));};exports[_0x896c('0x24')]=function(_0x41abe5,_0x6f5cc5){return db[_0x896c('0x2e')][_0x896c('0x46')]({'where':{'id':_0x41abe5['params']['id']}})[_0x896c('0x23')](handleEntityNotFound(_0x6f5cc5,null))[_0x896c('0x23')](removeEntity(_0x6f5cc5,null))[_0x896c('0x42')](handleError(_0x6f5cc5,null));};exports['create']=function(_0x420efa,_0x344db2){var _0x931c06={'key':_0x420efa['body'][_0x896c('0x30')]};if(_0x420efa[_0x896c('0x47')][_0x896c('0x48')]){_0x931c06[_0x896c('0x48')]=_0x420efa[_0x896c('0x47')][_0x896c('0x48')];}else if(_0x420efa[_0x896c('0x47')][_0x896c('0x49')]){_0x931c06[_0x896c('0x49')]=_0x420efa[_0x896c('0x47')]['SmsAccountId'];}else if(_0x420efa[_0x896c('0x47')][_0x896c('0x4a')]){_0x931c06[_0x896c('0x4a')]=_0x420efa[_0x896c('0x47')][_0x896c('0x4a')];}else if(_0x420efa[_0x896c('0x47')][_0x896c('0x4b')]){_0x931c06[_0x896c('0x4b')]=_0x420efa[_0x896c('0x47')][_0x896c('0x4b')];}return db[_0x896c('0x2e')]['find']({'where':_0x931c06})['then'](function(_0x29a413){if(_0x29a413){throw new db[(_0x896c('0x4c'))]['ValidationError'](_0x896c('0x4d'));}return db['CannedAnswer'][_0x896c('0x4e')](_0x420efa[_0x896c('0x47')]);})[_0x896c('0x23')](function(_0x5ac6fb){var _0x427739=_0x420efa[_0x896c('0x4f')][_0x896c('0x25')]({'plain':!![]});if(!_0x427739)throw new Error(_0x896c('0x50'));if(_0x427739['role']===_0x896c('0x4f')){var _0x399e79=_0x5ac6fb[_0x896c('0x25')]({'plain':!![]});return db[_0x896c('0x51')][_0x896c('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x427739[_0x896c('0x52')]},'raw':!![]})[_0x896c('0x23')](function(_0x32bb79){if(_0x32bb79&&_0x32bb79[_0x896c('0x53')]===0x0){return db[_0x896c('0x27')][_0x896c('0x4e')]({'name':_0x399e79['name'],'resourceId':_0x399e79['id'],'type':_0x32bb79[_0x896c('0x2a')],'sectionId':_0x32bb79['id']},{})[_0x896c('0x23')](function(){return _0x5ac6fb;});}else{return _0x5ac6fb;}})[_0x896c('0x42')](function(_0x4e2579){logger[_0x896c('0x28')](_0x896c('0x54'),_0x4e2579);throw _0x4e2579;});}return _0x5ac6fb;})[_0x896c('0x23')](respondWithResult(_0x344db2,0xc9))['catch'](handleError(_0x344db2,null));}; \ No newline at end of file +var _0xfdb9=['includeAll','include','findAll','rows','catch','show','intersection','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','keys','filters','model','query','fields','attributes','length','nolimit','order','pick','where','merge','options'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xfdb9,0x132));var _0x9fdb=function(_0x4c6cd4,_0x37a049){_0x4c6cd4=_0x4c6cd4-0x0;var _0x3a5976=_0xfdb9[_0x4c6cd4];return _0x3a5976;};'use strict';var emlformat=require(_0x9fdb('0x0'));var rimraf=require(_0x9fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fdb('0x2'));var rp=require(_0x9fdb('0x3'));var moment=require(_0x9fdb('0x4'));var BPromise=require(_0x9fdb('0x5'));var Mustache=require(_0x9fdb('0x6'));var util=require(_0x9fdb('0x7'));var path=require(_0x9fdb('0x8'));var sox=require('sox');var csv=require(_0x9fdb('0x9'));var ejs=require(_0x9fdb('0xa'));var fs=require('fs');var fs_extra=require(_0x9fdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fdb('0xc'));var jsforce=require(_0x9fdb('0xd'));var deskjs=require(_0x9fdb('0xe'));var toCsv=require(_0x9fdb('0x9'));var querystring=require(_0x9fdb('0xf'));var Papa=require(_0x9fdb('0x10'));var Redis=require('ioredis');var authService=require(_0x9fdb('0x11'));var qs=require(_0x9fdb('0x12'));var as=require(_0x9fdb('0x13'));var hardwareService=require(_0x9fdb('0x14'));var logger=require(_0x9fdb('0x15'))(_0x9fdb('0x16'));var utils=require(_0x9fdb('0x17'));var config=require(_0x9fdb('0x18'));var licenseUtil=require(_0x9fdb('0x19'));var db=require(_0x9fdb('0x1a'))['db'];function respondWithStatusCode(_0x22127c,_0x21be36){_0x21be36=_0x21be36||0xcc;return function(_0x59d4ce){if(_0x59d4ce){return _0x22127c[_0x9fdb('0x1b')](_0x21be36);}return _0x22127c[_0x9fdb('0x1c')](_0x21be36)['end']();};}function respondWithResult(_0x51539c,_0x2d68a2){_0x2d68a2=_0x2d68a2||0xc8;return function(_0x3a4c3f){if(_0x3a4c3f){return _0x51539c['status'](_0x2d68a2)['json'](_0x3a4c3f);}};}function respondWithFilteredResult(_0x49ed54,_0x339eb1){return function(_0x3a36ad){if(_0x3a36ad){var _0x5304cf=typeof _0x339eb1['offset']===_0x9fdb('0x1d')&&typeof _0x339eb1['limit']==='undefined';var _0x54c763=_0x3a36ad[_0x9fdb('0x1e')];var _0x2a6a17=_0x5304cf?0x0:_0x339eb1[_0x9fdb('0x1f')];var _0x55ecae=_0x5304cf?_0x3a36ad[_0x9fdb('0x1e')]:_0x339eb1[_0x9fdb('0x1f')]+_0x339eb1[_0x9fdb('0x20')];var _0x588cac;if(_0x55ecae>=_0x54c763){_0x55ecae=_0x54c763;_0x588cac=0xc8;}else{_0x588cac=0xce;}_0x49ed54['status'](_0x588cac);return _0x49ed54[_0x9fdb('0x21')]('Content-Range',_0x2a6a17+'-'+_0x55ecae+'/'+_0x54c763)[_0x9fdb('0x22')](_0x3a36ad);}return null;};}function patchUpdates(_0x37f604){return function(_0x10bd62){try{jsonpatch[_0x9fdb('0x23')](_0x10bd62,_0x37f604,!![]);}catch(_0x2441d8){return BPromise[_0x9fdb('0x24')](_0x2441d8);}return _0x10bd62[_0x9fdb('0x25')]();};}function saveUpdates(_0x5b4c5,_0x3ab4b6){return function(_0x3f2e72){if(_0x3f2e72){return _0x3f2e72[_0x9fdb('0x26')](_0x5b4c5)['then'](function(_0x8566d1){return _0x8566d1;});}return null;};}function removeEntity(_0x5d725e,_0xdccf15){return function(_0x58a051){if(_0x58a051){return _0x58a051[_0x9fdb('0x27')]()[_0x9fdb('0x28')](function(){var _0x5ac440=_0x58a051[_0x9fdb('0x29')]({'plain':!![]});var _0x46e26b='CannedAnswers';return db[_0x9fdb('0x2a')]['destroy']({'where':{'type':_0x46e26b,'resourceId':_0x5ac440['id']}})[_0x9fdb('0x28')](function(){return _0x58a051;});})['then'](function(){_0x5d725e['status'](0xcc)[_0x9fdb('0x2b')]();});}};}function handleEntityNotFound(_0x352d4e,_0x321a2d){return function(_0x531b43){if(!_0x531b43){_0x352d4e[_0x9fdb('0x1b')](0x194);}return _0x531b43;};}function handleError(_0x30b673,_0x413b56){_0x413b56=_0x413b56||0x1f4;return function(_0x26b13){logger[_0x9fdb('0x2c')](_0x26b13[_0x9fdb('0x2d')]);if(_0x26b13[_0x9fdb('0x2e')]){delete _0x26b13[_0x9fdb('0x2e')];}_0x30b673[_0x9fdb('0x1c')](_0x413b56)[_0x9fdb('0x2f')](_0x26b13);};}exports[_0x9fdb('0x30')]=function(_0x6df2f4,_0x2bb031){var _0x1d67cd={},_0x1d9ce5={},_0x192e16={'count':0x0,'rows':[]};var _0x44bb75=_[_0x9fdb('0x31')](db[_0x9fdb('0x32')][_0x9fdb('0x33')],function(_0x4e7080){return{'name':_0x4e7080[_0x9fdb('0x34')],'type':_0x4e7080['type']['key']};});_0x1d9ce5['model']=_['map'](_0x44bb75,_0x9fdb('0x2e'));_0x1d9ce5['query']=_[_0x9fdb('0x35')](_0x6df2f4['query']);_0x1d9ce5[_0x9fdb('0x36')]=_['intersection'](_0x1d9ce5[_0x9fdb('0x37')],_0x1d9ce5[_0x9fdb('0x38')]);_0x1d67cd['attributes']=_['intersection'](_0x1d9ce5['model'],qs['fields'](_0x6df2f4[_0x9fdb('0x38')][_0x9fdb('0x39')]));_0x1d67cd['attributes']=_0x1d67cd[_0x9fdb('0x3a')][_0x9fdb('0x3b')]?_0x1d67cd[_0x9fdb('0x3a')]:_0x1d9ce5[_0x9fdb('0x37')];if(!_0x6df2f4['query']['hasOwnProperty'](_0x9fdb('0x3c'))){_0x1d67cd['limit']=qs['limit'](_0x6df2f4['query'][_0x9fdb('0x20')]);_0x1d67cd['offset']=qs['offset'](_0x6df2f4['query']['offset']);}_0x1d67cd[_0x9fdb('0x3d')]=qs['sort'](_0x6df2f4[_0x9fdb('0x38')]['sort']);_0x1d67cd['where']=qs['filters'](_[_0x9fdb('0x3e')](_0x6df2f4['query'],_0x1d9ce5['filters']),_0x44bb75);if(_0x6df2f4[_0x9fdb('0x38')]['filter']){_0x1d67cd[_0x9fdb('0x3f')]=_[_0x9fdb('0x40')](_0x1d67cd[_0x9fdb('0x3f')],{'$or':[{'key':{'$like':'%'+_0x6df2f4[_0x9fdb('0x38')]['filter']+'%'}},{'value':{'$like':'%'+_0x6df2f4[_0x9fdb('0x38')]['filter']+'%'}}]});}_0x1d67cd=_[_0x9fdb('0x40')]({},_0x1d67cd,_0x6df2f4[_0x9fdb('0x41')]);var _0x452537={'where':_0x1d67cd['where']};return db[_0x9fdb('0x32')][_0x9fdb('0x1e')](_0x452537)['then'](function(_0x11a955){_0x192e16[_0x9fdb('0x1e')]=_0x11a955;if(_0x6df2f4[_0x9fdb('0x38')][_0x9fdb('0x42')]){_0x1d67cd[_0x9fdb('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9fdb('0x44')](_0x1d67cd);})[_0x9fdb('0x28')](function(_0xee02da){_0x192e16[_0x9fdb('0x45')]=_0xee02da;return _0x192e16;})['then'](respondWithFilteredResult(_0x2bb031,_0x1d67cd))[_0x9fdb('0x46')](handleError(_0x2bb031,null));};exports[_0x9fdb('0x47')]=function(_0x570638,_0x52aea5){var _0x3ecdc3={'raw':!![],'where':{'id':_0x570638['params']['id']}},_0x5d99d5={};_0x5d99d5['model']=_[_0x9fdb('0x35')](db[_0x9fdb('0x32')]['rawAttributes']);_0x5d99d5[_0x9fdb('0x38')]=_[_0x9fdb('0x35')](_0x570638[_0x9fdb('0x38')]);_0x5d99d5[_0x9fdb('0x36')]=_[_0x9fdb('0x48')](_0x5d99d5[_0x9fdb('0x37')],_0x5d99d5[_0x9fdb('0x38')]);_0x3ecdc3[_0x9fdb('0x3a')]=_[_0x9fdb('0x48')](_0x5d99d5[_0x9fdb('0x37')],qs['fields'](_0x570638[_0x9fdb('0x38')][_0x9fdb('0x39')]));_0x3ecdc3['attributes']=_0x3ecdc3[_0x9fdb('0x3a')][_0x9fdb('0x3b')]?_0x3ecdc3[_0x9fdb('0x3a')]:_0x5d99d5[_0x9fdb('0x37')];if(_0x570638['query'][_0x9fdb('0x42')]){_0x3ecdc3[_0x9fdb('0x43')]=[{'all':!![]}];}_0x3ecdc3=_[_0x9fdb('0x40')]({},_0x3ecdc3,_0x570638[_0x9fdb('0x41')]);return db['CannedAnswer'][_0x9fdb('0x49')](_0x3ecdc3)['then'](handleEntityNotFound(_0x52aea5,null))[_0x9fdb('0x28')](respondWithResult(_0x52aea5,null))[_0x9fdb('0x46')](handleError(_0x52aea5,null));};exports[_0x9fdb('0x26')]=function(_0x1d4e8e,_0xe02db0){if(_0x1d4e8e[_0x9fdb('0x4a')]['id']){delete _0x1d4e8e['body']['id'];}return db[_0x9fdb('0x32')][_0x9fdb('0x49')]({'where':{'id':_0x1d4e8e[_0x9fdb('0x4b')]['id']}})[_0x9fdb('0x28')](handleEntityNotFound(_0xe02db0,null))[_0x9fdb('0x28')](saveUpdates(_0x1d4e8e[_0x9fdb('0x4a')],null))[_0x9fdb('0x28')](respondWithResult(_0xe02db0,null))[_0x9fdb('0x46')](handleError(_0xe02db0,null));};exports[_0x9fdb('0x27')]=function(_0x138d42,_0x3fbfff){return db[_0x9fdb('0x32')][_0x9fdb('0x49')]({'where':{'id':_0x138d42['params']['id']}})['then'](handleEntityNotFound(_0x3fbfff,null))[_0x9fdb('0x28')](removeEntity(_0x3fbfff,null))[_0x9fdb('0x46')](handleError(_0x3fbfff,null));};exports[_0x9fdb('0x4c')]=function(_0x1080e0,_0xe252d2){var _0x52089a={'key':_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x4d')]};if(_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x4e')]){_0x52089a[_0x9fdb('0x4e')]=_0x1080e0[_0x9fdb('0x4a')]['MailAccountId'];}else if(_0x1080e0['body'][_0x9fdb('0x4f')]){_0x52089a[_0x9fdb('0x4f')]=_0x1080e0['body'][_0x9fdb('0x4f')];}else if(_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x50')]){_0x52089a['OpenchannelAccountId']=_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x50')];}else if(_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x51')]){_0x52089a['ChatWebsiteId']=_0x1080e0[_0x9fdb('0x4a')][_0x9fdb('0x51')];}return db[_0x9fdb('0x32')][_0x9fdb('0x49')]({'where':_0x52089a})[_0x9fdb('0x28')](function(_0x2e8006){if(_0x2e8006){throw new db[(_0x9fdb('0x52'))][(_0x9fdb('0x53'))](_0x9fdb('0x54'));}return db[_0x9fdb('0x32')][_0x9fdb('0x4c')](_0x1080e0['body']);})[_0x9fdb('0x28')](function(_0x2a3e5a){var _0x439a1f=_0x1080e0['user'][_0x9fdb('0x29')]({'plain':!![]});if(!_0x439a1f)throw new Error(_0x9fdb('0x55'));if(_0x439a1f[_0x9fdb('0x56')]===_0x9fdb('0x57')){var _0x2c27=_0x2a3e5a[_0x9fdb('0x29')]({'plain':!![]});return db[_0x9fdb('0x58')][_0x9fdb('0x49')]({'where':{'name':_0x9fdb('0x59'),'userProfileId':_0x439a1f[_0x9fdb('0x5a')]},'raw':!![]})[_0x9fdb('0x28')](function(_0x35fbfd){if(_0x35fbfd&&_0x35fbfd[_0x9fdb('0x5b')]===0x0){return db[_0x9fdb('0x2a')][_0x9fdb('0x4c')]({'name':_0x2c27[_0x9fdb('0x2e')],'resourceId':_0x2c27['id'],'type':_0x35fbfd['name'],'sectionId':_0x35fbfd['id']},{})[_0x9fdb('0x28')](function(){return _0x2a3e5a;});}else{return _0x2a3e5a;}})[_0x9fdb('0x46')](function(_0x5a3713){logger[_0x9fdb('0x2c')](_0x9fdb('0x5c'),_0x5a3713);throw _0x5a3713;});}return _0x2a3e5a;})[_0x9fdb('0x28')](respondWithResult(_0xe252d2,0xc9))[_0x9fdb('0x46')](handleError(_0xe252d2,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5a07388..349368f 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 _0x1f9c=['api','moment','bluebird','request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x1f9c,0xfc));var _0xc1f9=function(_0x2a5e4f,_0x1d06aa){_0x2a5e4f=_0x2a5e4f-0x0;var _0x262ad9=_0x1f9c[_0x2a5e4f];return _0x262ad9;};'use strict';var _=require(_0xc1f9('0x0'));var util=require(_0xc1f9('0x1'));var logger=require(_0xc1f9('0x2'))(_0xc1f9('0x3'));var moment=require(_0xc1f9('0x4'));var BPromise=require(_0xc1f9('0x5'));var rp=require(_0xc1f9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1f9('0x7'));var config=require('../../config/environment');var attributes=require(_0xc1f9('0x8'));module[_0xc1f9('0x9')]=function(_0x3f1d1e,_0x7765e9){return _0x3f1d1e[_0xc1f9('0xa')](_0xc1f9('0xb'),attributes,{'tableName':_0xc1f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1f9('0xd'),'collate':_0xc1f9('0xe')});}; \ No newline at end of file +var _0x1b63=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x7c90b5,_0x5e6a33){var _0x1e235c=function(_0x41f0c3){while(--_0x41f0c3){_0x7c90b5['push'](_0x7c90b5['shift']());}};_0x1e235c(++_0x5e6a33);}(_0x1b63,0x1e3));var _0x31b6=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x1b63[_0x7538c5];return _0x8b56be;};'use strict';var _=require(_0x31b6('0x0'));var util=require(_0x31b6('0x1'));var logger=require('../../config/logger')(_0x31b6('0x2'));var moment=require(_0x31b6('0x3'));var BPromise=require(_0x31b6('0x4'));var rp=require(_0x31b6('0x5'));var fs=require('fs');var path=require(_0x31b6('0x6'));var rimraf=require(_0x31b6('0x7'));var config=require(_0x31b6('0x8'));var attributes=require(_0x31b6('0x9'));module[_0x31b6('0xa')]=function(_0x5921c0,_0x40a338){return _0x5921c0['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31b6('0xb'),'collate':_0x31b6('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5043c3b..ba41c2a 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(_0x353070,_0x57136b){var _0x3c5825=function(_0x3600a8){while(--_0x3600a8){_0x353070['push'](_0x353070['shift']());}};_0x3c5825(++_0x57136b);}(_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);});});} \ 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(_0x1e3dff,_0x4cc605){var _0x5d0836=function(_0x469bda){while(--_0x469bda){_0x1e3dff['push'](_0x1e3dff['shift']());}};_0x5d0836(++_0x4cc605);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 a7312a5..5e84cfa 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 _0x4e45=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','update','delete'];(function(_0x4f4bf8,_0x4f0d12){var _0x2f9835=function(_0x343e85){while(--_0x343e85){_0x4f4bf8['push'](_0x4f4bf8['shift']());}};_0x2f9835(++_0x4f0d12);}(_0x4e45,0x11f));var _0x54e4=function(_0x4871f4,_0x2c1f0){_0x4871f4=_0x4871f4-0x0;var _0x565f30=_0x4e45[_0x4871f4];return _0x565f30;};'use strict';var multer=require(_0x54e4('0x0'));var util=require(_0x54e4('0x1'));var path=require(_0x54e4('0x2'));var timeout=require(_0x54e4('0x3'));var express=require(_0x54e4('0x4'));var router=express[_0x54e4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x54e4('0x6'));var interaction=require(_0x54e4('0x7'));var config=require(_0x54e4('0x8'));var controller=require(_0x54e4('0x9'));router[_0x54e4('0xa')]('/',auth[_0x54e4('0xb')](),controller['index']);router[_0x54e4('0xa')](_0x54e4('0xc'),auth[_0x54e4('0xb')](),controller[_0x54e4('0xd')]);router[_0x54e4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x54e4('0xc'),auth['isAuthenticated'](),controller[_0x54e4('0xf')]);router[_0x54e4('0x10')](_0x54e4('0xc'),auth[_0x54e4('0xb')](),controller[_0x54e4('0x11')]);module[_0x54e4('0x12')]=router; \ No newline at end of file +var _0xff91=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','put'];(function(_0x59566d,_0x3640b7){var _0x139267=function(_0x3e1572){while(--_0x3e1572){_0x59566d['push'](_0x59566d['shift']());}};_0x139267(++_0x3640b7);}(_0xff91,0x1c6));var _0x1ff9=function(_0x59c14b,_0x190042){_0x59c14b=_0x59c14b-0x0;var _0x412480=_0xff91[_0x59c14b];return _0x412480;};'use strict';var multer=require(_0x1ff9('0x0'));var util=require(_0x1ff9('0x1'));var path=require(_0x1ff9('0x2'));var timeout=require(_0x1ff9('0x3'));var express=require(_0x1ff9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ff9('0x5'));var interaction=require(_0x1ff9('0x6'));var config=require(_0x1ff9('0x7'));var controller=require(_0x1ff9('0x8'));router[_0x1ff9('0x9')]('/',auth[_0x1ff9('0xa')](),controller[_0x1ff9('0xb')]);router['get']('/:id',auth[_0x1ff9('0xa')](),controller[_0x1ff9('0xc')]);router['post']('/',auth[_0x1ff9('0xa')](),controller['create']);router[_0x1ff9('0xd')](_0x1ff9('0xe'),auth[_0x1ff9('0xa')](),controller[_0x1ff9('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ff9('0x10')]);module[_0x1ff9('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8b0f643..00040e6 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 _0x30fe=['INTEGER','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30fe,0x149));var _0xe30f=function(_0x3f06eb,_0xf1d9b5){_0x3f06eb=_0x3f06eb-0x0;var _0x147ae5=_0x30fe[_0x3f06eb];return _0x147ae5;};'use strict';var Sequelize=require('sequelize');module[_0xe30f('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xe30f('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xe30f('0x2')]},'dst':{'type':Sequelize[_0xe30f('0x2')]},'dcontext':{'type':Sequelize[_0xe30f('0x2')]},'channel':{'type':Sequelize[_0xe30f('0x2')]},'dstchannel':{'type':Sequelize[_0xe30f('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xe30f('0x2')]},'duration':{'type':Sequelize[_0xe30f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xe30f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe30f('0x2')]},'amaflags':{'type':Sequelize[_0xe30f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe30f('0x2')]},'userfield':{'type':Sequelize[_0xe30f('0x2')]},'uniqueid':{'type':Sequelize[_0xe30f('0x2')]},'linkedid':{'type':Sequelize[_0xe30f('0x2')]},'sequence':{'type':Sequelize[_0xe30f('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe30f('0x2')]},'tag':{'type':Sequelize[_0xe30f('0x2')]}}; \ No newline at end of file +var _0xe3bd=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x513dee,_0x4bd5a9){var _0x41157f=function(_0x1aba1e){while(--_0x1aba1e){_0x513dee['push'](_0x513dee['shift']());}};_0x41157f(++_0x4bd5a9);}(_0xe3bd,0x126));var _0xde3b=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe3bd[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0xde3b('0x0')]={'calldate':{'type':Sequelize[_0xde3b('0x1')],'allowNull':![],'defaultValue':_0xde3b('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xde3b('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xde3b('0x3')]},'channel':{'type':Sequelize[_0xde3b('0x3')]},'dstchannel':{'type':Sequelize[_0xde3b('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xde3b('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xde3b('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xde3b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xde3b('0x3')]},'userfield':{'type':Sequelize[_0xde3b('0x3')]},'uniqueid':{'type':Sequelize[_0xde3b('0x3')]},'linkedid':{'type':Sequelize[_0xde3b('0x3')]},'sequence':{'type':Sequelize[_0xde3b('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xde3b('0x3')]},'tag':{'type':Sequelize[_0xde3b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 14768ae..14c75db 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 _0xd6d2=['../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','Cdr','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x53c6ba,_0x46796a){var _0x5534bb=function(_0x3e60f9){while(--_0x3e60f9){_0x53c6ba['push'](_0x53c6ba['shift']());}};_0x5534bb(++_0x46796a);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x3a8b80,_0x17859c){_0x3a8b80=_0x3a8b80-0x0;var _0x595e44=_0xd6d2[_0x3a8b80];return _0x595e44;};'use strict';var emlformat=require(_0x2d6d('0x0'));var rimraf=require(_0x2d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6d('0x2'));var rp=require(_0x2d6d('0x3'));var moment=require('moment');var BPromise=require(_0x2d6d('0x4'));var Mustache=require('mustache');var util=require(_0x2d6d('0x5'));var path=require(_0x2d6d('0x6'));var sox=require(_0x2d6d('0x7'));var csv=require('to-csv');var ejs=require(_0x2d6d('0x8'));var fs=require('fs');var fs_extra=require(_0x2d6d('0x9'));var _=require(_0x2d6d('0xa'));var squel=require(_0x2d6d('0xb'));var crypto=require(_0x2d6d('0xc'));var jsforce=require(_0x2d6d('0xd'));var deskjs=require(_0x2d6d('0xe'));var toCsv=require(_0x2d6d('0xf'));var querystring=require(_0x2d6d('0x10'));var Papa=require(_0x2d6d('0x11'));var Redis=require(_0x2d6d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2d6d('0x13'));var as=require(_0x2d6d('0x14'));var hardwareService=require(_0x2d6d('0x15'));var logger=require(_0x2d6d('0x16'))(_0x2d6d('0x17'));var utils=require('../../config/utils');var config=require(_0x2d6d('0x18'));var licenseUtil=require(_0x2d6d('0x19'));var db=require(_0x2d6d('0x1a'))['db'];function respondWithStatusCode(_0x2ad9fc,_0x5c4bf6){_0x5c4bf6=_0x5c4bf6||0xcc;return function(_0x5ef174){if(_0x5ef174){return _0x2ad9fc[_0x2d6d('0x1b')](_0x5c4bf6);}return _0x2ad9fc[_0x2d6d('0x1c')](_0x5c4bf6)[_0x2d6d('0x1d')]();};}function respondWithResult(_0x3528de,_0x58bd29){_0x58bd29=_0x58bd29||0xc8;return function(_0x1ec6aa){if(_0x1ec6aa){return _0x3528de[_0x2d6d('0x1c')](_0x58bd29)['json'](_0x1ec6aa);}};}function respondWithFilteredResult(_0x586085,_0x370096){return function(_0x17340f){if(_0x17340f){var _0x109b49=typeof _0x370096['offset']===_0x2d6d('0x1e')&&typeof _0x370096['limit']==='undefined';var _0x4c3092=_0x17340f[_0x2d6d('0x1f')];var _0x4179f2=_0x109b49?0x0:_0x370096[_0x2d6d('0x20')];var _0x3c527e=_0x109b49?_0x17340f[_0x2d6d('0x1f')]:_0x370096[_0x2d6d('0x20')]+_0x370096[_0x2d6d('0x21')];var _0xa2c4a7;if(_0x3c527e>=_0x4c3092){_0x3c527e=_0x4c3092;_0xa2c4a7=0xc8;}else{_0xa2c4a7=0xce;}_0x586085[_0x2d6d('0x1c')](_0xa2c4a7);return _0x586085['set'](_0x2d6d('0x22'),_0x4179f2+'-'+_0x3c527e+'/'+_0x4c3092)[_0x2d6d('0x23')](_0x17340f);}return null;};}function patchUpdates(_0x5b0c61){return function(_0x227e44){try{jsonpatch[_0x2d6d('0x24')](_0x227e44,_0x5b0c61,!![]);}catch(_0x15cb80){return BPromise[_0x2d6d('0x25')](_0x15cb80);}return _0x227e44[_0x2d6d('0x26')]();};}function saveUpdates(_0x59234a,_0x4aaa62){return function(_0x42c2f2){if(_0x42c2f2){return _0x42c2f2[_0x2d6d('0x27')](_0x59234a)[_0x2d6d('0x28')](function(_0x585b54){return _0x585b54;});}return null;};}function removeEntity(_0x47eb0e,_0x3ae8ad){return function(_0x4e7ec8){if(_0x4e7ec8){return _0x4e7ec8['destroy']()['then'](function(){_0x47eb0e[_0x2d6d('0x1c')](0xcc)[_0x2d6d('0x1d')]();});}};}function handleEntityNotFound(_0x3da83d,_0x3f89dd){return function(_0x3e5a92){if(!_0x3e5a92){_0x3da83d['sendStatus'](0x194);}return _0x3e5a92;};}function handleError(_0x16634d,_0x1b4964){_0x1b4964=_0x1b4964||0x1f4;return function(_0x455e71){logger[_0x2d6d('0x29')](_0x455e71[_0x2d6d('0x2a')]);if(_0x455e71[_0x2d6d('0x2b')]){delete _0x455e71[_0x2d6d('0x2b')];}_0x16634d[_0x2d6d('0x1c')](_0x1b4964)[_0x2d6d('0x2c')](_0x455e71);};}exports['index']=function(_0x1016e1,_0x26d299){var _0x2e7b32={},_0x34d485={},_0x486963={'count':0x0,'rows':[]};var _0x317bde=_['map'](db[_0x2d6d('0x2d')]['rawAttributes'],function(_0x58bfc7){return{'name':_0x58bfc7[_0x2d6d('0x2e')],'type':_0x58bfc7['type'][_0x2d6d('0x2f')]};});_0x34d485[_0x2d6d('0x30')]=_['map'](_0x317bde,_0x2d6d('0x2b'));_0x34d485['query']=_[_0x2d6d('0x31')](_0x1016e1[_0x2d6d('0x32')]);_0x34d485[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x34d485[_0x2d6d('0x30')],_0x34d485[_0x2d6d('0x32')]);_0x2e7b32[_0x2d6d('0x35')]=_[_0x2d6d('0x34')](_0x34d485['model'],qs[_0x2d6d('0x36')](_0x1016e1[_0x2d6d('0x32')]['fields']));_0x2e7b32[_0x2d6d('0x35')]=_0x2e7b32[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x2e7b32[_0x2d6d('0x35')]:_0x34d485[_0x2d6d('0x30')];if(!_0x1016e1['query']['hasOwnProperty']('nolimit')){_0x2e7b32[_0x2d6d('0x21')]=qs[_0x2d6d('0x21')](_0x1016e1[_0x2d6d('0x32')]['limit']);_0x2e7b32[_0x2d6d('0x20')]=qs[_0x2d6d('0x20')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x20')]);}_0x2e7b32['order']=qs[_0x2d6d('0x38')](_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x38')]);_0x2e7b32[_0x2d6d('0x39')]=qs[_0x2d6d('0x33')](_[_0x2d6d('0x3a')](_0x1016e1[_0x2d6d('0x32')],_0x34d485['filters']),_0x317bde);if(_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]){_0x2e7b32[_0x2d6d('0x39')]=_[_0x2d6d('0x3c')](_0x2e7b32[_0x2d6d('0x39')],{'$or':_['map'](_0x317bde,function(_0x1cad57){if(_0x1cad57[_0x2d6d('0x3d')]!==_0x2d6d('0x3e')){var _0x4616df={};_0x4616df[_0x1cad57[_0x2d6d('0x2b')]]={'$like':'%'+_0x1016e1[_0x2d6d('0x32')][_0x2d6d('0x3b')]+'%'};return _0x4616df;}})});}_0x2e7b32=_[_0x2d6d('0x3c')]({},_0x2e7b32,_0x1016e1[_0x2d6d('0x3f')]);var _0x38cce8={'where':_0x2e7b32[_0x2d6d('0x39')]};return db[_0x2d6d('0x2d')][_0x2d6d('0x1f')](_0x38cce8)[_0x2d6d('0x28')](function(_0x34fc23){_0x486963[_0x2d6d('0x1f')]=_0x34fc23;if(_0x1016e1[_0x2d6d('0x32')]['includeAll']){_0x2e7b32[_0x2d6d('0x40')]=[{'all':!![]}];}return db[_0x2d6d('0x2d')][_0x2d6d('0x41')](_0x2e7b32);})[_0x2d6d('0x28')](function(_0x246d6e){_0x486963['rows']=_0x246d6e;return _0x486963;})[_0x2d6d('0x28')](respondWithFilteredResult(_0x26d299,_0x2e7b32))[_0x2d6d('0x42')](handleError(_0x26d299,null));};exports[_0x2d6d('0x43')]=function(_0x41ab2e,_0x543b4b){var _0x3b62b1={'raw':!![],'where':{'id':_0x41ab2e[_0x2d6d('0x44')]['id']}},_0x7f76ad={};_0x7f76ad[_0x2d6d('0x30')]=_[_0x2d6d('0x31')](db['Cdr'][_0x2d6d('0x45')]);_0x7f76ad[_0x2d6d('0x32')]=_['keys'](_0x41ab2e[_0x2d6d('0x32')]);_0x7f76ad[_0x2d6d('0x33')]=_[_0x2d6d('0x34')](_0x7f76ad['model'],_0x7f76ad[_0x2d6d('0x32')]);_0x3b62b1[_0x2d6d('0x35')]=_['intersection'](_0x7f76ad['model'],qs['fields'](_0x41ab2e[_0x2d6d('0x32')][_0x2d6d('0x36')]));_0x3b62b1['attributes']=_0x3b62b1[_0x2d6d('0x35')][_0x2d6d('0x37')]?_0x3b62b1[_0x2d6d('0x35')]:_0x7f76ad[_0x2d6d('0x30')];if(_0x41ab2e['query'][_0x2d6d('0x46')]){_0x3b62b1[_0x2d6d('0x40')]=[{'all':!![]}];}_0x3b62b1=_['merge']({},_0x3b62b1,_0x41ab2e[_0x2d6d('0x3f')]);return db[_0x2d6d('0x2d')][_0x2d6d('0x47')](_0x3b62b1)[_0x2d6d('0x28')](handleEntityNotFound(_0x543b4b,null))[_0x2d6d('0x28')](respondWithResult(_0x543b4b,null))[_0x2d6d('0x42')](handleError(_0x543b4b,null));};exports[_0x2d6d('0x48')]=function(_0x5ac5e9,_0xe6b038){return db[_0x2d6d('0x2d')][_0x2d6d('0x48')](_0x5ac5e9['body'],{})['then'](respondWithResult(_0xe6b038,0xc9))[_0x2d6d('0x42')](handleError(_0xe6b038,null));};exports[_0x2d6d('0x27')]=function(_0x422198,_0x4e5203){if(_0x422198[_0x2d6d('0x49')]['id']){delete _0x422198[_0x2d6d('0x49')]['id'];}return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x422198[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x4e5203,null))[_0x2d6d('0x28')](saveUpdates(_0x422198[_0x2d6d('0x49')],null))[_0x2d6d('0x28')](respondWithResult(_0x4e5203,null))[_0x2d6d('0x42')](handleError(_0x4e5203,null));};exports[_0x2d6d('0x4a')]=function(_0x42c125,_0x1ca9a2){return db['Cdr'][_0x2d6d('0x47')]({'where':{'id':_0x42c125[_0x2d6d('0x44')]['id']}})[_0x2d6d('0x28')](handleEntityNotFound(_0x1ca9a2,null))['then'](removeEntity(_0x1ca9a2,null))[_0x2d6d('0x42')](handleError(_0x1ca9a2,null));};exports[_0x2d6d('0x4b')]=function(_0x3738b3,_0x2dbcdc){return db[_0x2d6d('0x2d')][_0x2d6d('0x4b')]()[_0x2d6d('0x28')](respondWithResult(_0x2dbcdc,null))['catch'](handleError(_0x2dbcdc,null));}; \ No newline at end of file +var _0xa1f6=['error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa1f6[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require(_0x6a1f('0x2'));var jsonpatch=require(_0x6a1f('0x3'));var rp=require(_0x6a1f('0x4'));var moment=require(_0x6a1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a1f('0x6'));var ejs=require(_0x6a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x8'));var _=require(_0x6a1f('0x9'));var squel=require(_0x6a1f('0xa'));var crypto=require(_0x6a1f('0xb'));var jsforce=require(_0x6a1f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a1f('0x6'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a1f('0x11'));var hardwareService=require(_0x6a1f('0x12'));var logger=require(_0x6a1f('0x13'))(_0x6a1f('0x14'));var utils=require('../../config/utils');var config=require(_0x6a1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1f('0x16'))['db'];function respondWithStatusCode(_0x17edb6,_0x2a4e94){_0x2a4e94=_0x2a4e94||0xcc;return function(_0x442576){if(_0x442576){return _0x17edb6[_0x6a1f('0x17')](_0x2a4e94);}return _0x17edb6[_0x6a1f('0x18')](_0x2a4e94)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8c3a36,_0x1918c6){_0x1918c6=_0x1918c6||0xc8;return function(_0x27d8f8){if(_0x27d8f8){return _0x8c3a36[_0x6a1f('0x18')](_0x1918c6)[_0x6a1f('0x1a')](_0x27d8f8);}};}function respondWithFilteredResult(_0x253305,_0x2677c1){return function(_0x14ecec){if(_0x14ecec){var _0x11ee0e=typeof _0x2677c1[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x2677c1[_0x6a1f('0x1d')]==='undefined';var _0x392ccb=_0x14ecec[_0x6a1f('0x1e')];var _0x1ccbed=_0x11ee0e?0x0:_0x2677c1[_0x6a1f('0x1b')];var _0x21d268=_0x11ee0e?_0x14ecec[_0x6a1f('0x1e')]:_0x2677c1[_0x6a1f('0x1b')]+_0x2677c1[_0x6a1f('0x1d')];var _0x5cb044;if(_0x21d268>=_0x392ccb){_0x21d268=_0x392ccb;_0x5cb044=0xc8;}else{_0x5cb044=0xce;}_0x253305[_0x6a1f('0x18')](_0x5cb044);return _0x253305['set'](_0x6a1f('0x1f'),_0x1ccbed+'-'+_0x21d268+'/'+_0x392ccb)[_0x6a1f('0x1a')](_0x14ecec);}return null;};}function patchUpdates(_0x3c7ed0){return function(_0x1b5856){try{jsonpatch[_0x6a1f('0x20')](_0x1b5856,_0x3c7ed0,!![]);}catch(_0x4eae7f){return BPromise[_0x6a1f('0x21')](_0x4eae7f);}return _0x1b5856[_0x6a1f('0x22')]();};}function saveUpdates(_0xa43cd5,_0x1be0c3){return function(_0x312e75){if(_0x312e75){return _0x312e75[_0x6a1f('0x23')](_0xa43cd5)[_0x6a1f('0x24')](function(_0x2736ab){return _0x2736ab;});}return null;};}function removeEntity(_0x53229b,_0x1eb146){return function(_0x3d953d){if(_0x3d953d){return _0x3d953d['destroy']()['then'](function(){_0x53229b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea158,_0x5e6013){return function(_0x5abe40){if(!_0x5abe40){_0x3ea158[_0x6a1f('0x17')](0x194);}return _0x5abe40;};}function handleError(_0x286d1d,_0x2b53ca){_0x2b53ca=_0x2b53ca||0x1f4;return function(_0x1e8db8){logger[_0x6a1f('0x25')](_0x1e8db8[_0x6a1f('0x26')]);if(_0x1e8db8[_0x6a1f('0x27')]){delete _0x1e8db8[_0x6a1f('0x27')];}_0x286d1d['status'](_0x2b53ca)[_0x6a1f('0x28')](_0x1e8db8);};}exports[_0x6a1f('0x29')]=function(_0x3f0730,_0x574d80){var _0x1e951c={},_0x155c58={},_0x257cee={'count':0x0,'rows':[]};var _0x113422=_[_0x6a1f('0x2a')](db[_0x6a1f('0x2b')][_0x6a1f('0x2c')],function(_0x58d879){return{'name':_0x58d879['fieldName'],'type':_0x58d879[_0x6a1f('0x2d')][_0x6a1f('0x2e')]};});_0x155c58[_0x6a1f('0x2f')]=_[_0x6a1f('0x2a')](_0x113422,_0x6a1f('0x27'));_0x155c58[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x3f0730['query']);_0x155c58[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x155c58['model'],_0x155c58[_0x6a1f('0x30')]);_0x1e951c[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x155c58['model'],qs['fields'](_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x35')]));_0x1e951c[_0x6a1f('0x34')]=_0x1e951c['attributes']['length']?_0x1e951c[_0x6a1f('0x34')]:_0x155c58[_0x6a1f('0x2f')];if(!_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x36')](_0x6a1f('0x37'))){_0x1e951c[_0x6a1f('0x1d')]=qs[_0x6a1f('0x1d')](_0x3f0730['query'][_0x6a1f('0x1d')]);_0x1e951c['offset']=qs[_0x6a1f('0x1b')](_0x3f0730[_0x6a1f('0x30')]['offset']);}_0x1e951c[_0x6a1f('0x38')]=qs[_0x6a1f('0x39')](_0x3f0730['query'][_0x6a1f('0x39')]);_0x1e951c['where']=qs[_0x6a1f('0x32')](_['pick'](_0x3f0730[_0x6a1f('0x30')],_0x155c58['filters']),_0x113422);if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]){_0x1e951c['where']=_[_0x6a1f('0x3b')](_0x1e951c[_0x6a1f('0x3c')],{'$or':_['map'](_0x113422,function(_0x5beb28){if(_0x5beb28[_0x6a1f('0x2d')]!==_0x6a1f('0x3d')){var _0x314fef={};_0x314fef[_0x5beb28[_0x6a1f('0x27')]]={'$like':'%'+_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]+'%'};return _0x314fef;}})});}_0x1e951c=_['merge']({},_0x1e951c,_0x3f0730[_0x6a1f('0x3e')]);var _0x2da23a={'where':_0x1e951c[_0x6a1f('0x3c')]};return db[_0x6a1f('0x2b')][_0x6a1f('0x1e')](_0x2da23a)[_0x6a1f('0x24')](function(_0x27be0a){_0x257cee[_0x6a1f('0x1e')]=_0x27be0a;if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3f')]){_0x1e951c[_0x6a1f('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x6a1f('0x41')](_0x1e951c);})[_0x6a1f('0x24')](function(_0x334fc4){_0x257cee[_0x6a1f('0x42')]=_0x334fc4;return _0x257cee;})[_0x6a1f('0x24')](respondWithFilteredResult(_0x574d80,_0x1e951c))[_0x6a1f('0x43')](handleError(_0x574d80,null));};exports['show']=function(_0x211009,_0x482c3a){var _0x3a6f80={'raw':!![],'where':{'id':_0x211009[_0x6a1f('0x44')]['id']}},_0x33208d={};_0x33208d[_0x6a1f('0x2f')]=_[_0x6a1f('0x31')](db[_0x6a1f('0x2b')]['rawAttributes']);_0x33208d[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x211009[_0x6a1f('0x30')]);_0x33208d[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],_0x33208d[_0x6a1f('0x30')]);_0x3a6f80[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],qs['fields'](_0x211009['query']['fields']));_0x3a6f80[_0x6a1f('0x34')]=_0x3a6f80[_0x6a1f('0x34')][_0x6a1f('0x45')]?_0x3a6f80[_0x6a1f('0x34')]:_0x33208d[_0x6a1f('0x2f')];if(_0x211009[_0x6a1f('0x30')]['includeAll']){_0x3a6f80[_0x6a1f('0x40')]=[{'all':!![]}];}_0x3a6f80=_['merge']({},_0x3a6f80,_0x211009[_0x6a1f('0x3e')]);return db[_0x6a1f('0x2b')]['find'](_0x3a6f80)[_0x6a1f('0x24')](handleEntityNotFound(_0x482c3a,null))['then'](respondWithResult(_0x482c3a,null))[_0x6a1f('0x43')](handleError(_0x482c3a,null));};exports[_0x6a1f('0x46')]=function(_0xa864f3,_0x4318fd){return db[_0x6a1f('0x2b')][_0x6a1f('0x46')](_0xa864f3['body'],{})[_0x6a1f('0x24')](respondWithResult(_0x4318fd,0xc9))[_0x6a1f('0x43')](handleError(_0x4318fd,null));};exports[_0x6a1f('0x23')]=function(_0x2bea1a,_0x34fa17){if(_0x2bea1a[_0x6a1f('0x47')]['id']){delete _0x2bea1a[_0x6a1f('0x47')]['id'];}return db[_0x6a1f('0x2b')]['find']({'where':{'id':_0x2bea1a[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x34fa17,null))[_0x6a1f('0x24')](saveUpdates(_0x2bea1a['body'],null))[_0x6a1f('0x24')](respondWithResult(_0x34fa17,null))['catch'](handleError(_0x34fa17,null));};exports[_0x6a1f('0x48')]=function(_0x52c262,_0x366a60){return db['Cdr'][_0x6a1f('0x49')]({'where':{'id':_0x52c262[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x366a60,null))['then'](removeEntity(_0x366a60,null))[_0x6a1f('0x43')](handleError(_0x366a60,null));};exports['describe']=function(_0x143873,_0x55d114){return db['Cdr'][_0x6a1f('0x4a')]()[_0x6a1f('0x24')](respondWithResult(_0x55d114,null))['catch'](handleError(_0x55d114,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index aa976b5..4ec2d4b 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(_0x53e143,_0x1c554a){var _0x2f5466=function(_0x3e4382){while(--_0x3e4382){_0x53e143['push'](_0x53e143['shift']());}};_0x2f5466(++_0x1c554a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x6ae667,_0x3f818d){var _0x3007d1=function(_0x593739){while(--_0x593739){_0x6ae667['push'](_0x6ae667['shift']());}};_0x3007d1(++_0x3f818d);}(_0x7a54,0x106));var _0x47a5=function(_0x2344a9,_0x2414b9){_0x2344a9=_0x2344a9-0x0;var _0x2ea9e8=_0x7a54[_0x2344a9];return _0x2ea9e8;};'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 7d261ca..ab667d5 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 _0x34da=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x124080,_0x57314e){var _0x43c903=function(_0x2129e2){while(--_0x2129e2){_0x124080['push'](_0x124080['shift']());}};_0x43c903(++_0x57314e);}(_0x34da,0x159));var _0xa34d=function(_0x41a60c,_0x3fd5f5){_0x41a60c=_0x41a60c-0x0;var _0x184c6a=_0x34da[_0x41a60c];return _0x184c6a;};'use strict';var _=require(_0xa34d('0x0'));var util=require(_0xa34d('0x1'));var moment=require(_0xa34d('0x2'));var BPromise=require(_0xa34d('0x3'));var rs=require(_0xa34d('0x4'));var fs=require('fs');var Redis=require(_0xa34d('0x5'));var db=require(_0xa34d('0x6'))['db'];var utils=require(_0xa34d('0x7'));var logger=require(_0xa34d('0x8'))(_0xa34d('0x9'));var config=require(_0xa34d('0xa'));var jayson=require(_0xa34d('0xb'));var client=jayson[_0xa34d('0xc')][_0xa34d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5912f1,_0x11d23b,_0x7cbe47){return new BPromise(function(_0x546c5d,_0x2eccf7){return client['request'](_0x5912f1,_0x7cbe47)['then'](function(_0x42f1aa){logger[_0xa34d('0xe')](_0xa34d('0xf'),_0x11d23b,_0xa34d('0x10'));logger[_0xa34d('0x11')](_0xa34d('0x12'),_0x11d23b,'request\x20sent',JSON[_0xa34d('0x13')](_0x42f1aa));if(_0x42f1aa[_0xa34d('0x14')]){if(_0x42f1aa[_0xa34d('0x14')]['code']===0x1f4){logger['error'](_0xa34d('0xf'),_0x11d23b,_0x42f1aa[_0xa34d('0x14')][_0xa34d('0x15')]);return _0x2eccf7(_0x42f1aa[_0xa34d('0x14')]['message']);}logger['error'](_0xa34d('0xf'),_0x11d23b,_0x42f1aa[_0xa34d('0x14')]['message']);return _0x546c5d(_0x42f1aa[_0xa34d('0x14')][_0xa34d('0x15')]);}else{logger[_0xa34d('0xe')](_0xa34d('0xf'),_0x11d23b,'request\x20sent');_0x546c5d(_0x42f1aa[_0xa34d('0x16')][_0xa34d('0x15')]);}})[_0xa34d('0x17')](function(_0x4662a1){logger[_0xa34d('0x14')](_0xa34d('0xf'),_0x11d23b,_0x4662a1);_0x2eccf7(_0x4662a1);});});} \ No newline at end of file +var _0xe0bb=['code','Cdr,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0bb,0x191));var _0xbe0b=function(_0x386306,_0x1363c9){_0x386306=_0x386306-0x0;var _0xcb23d=_0xe0bb[_0x386306];return _0xcb23d;};'use strict';var _=require(_0xbe0b('0x0'));var util=require(_0xbe0b('0x1'));var moment=require('moment');var BPromise=require(_0xbe0b('0x2'));var rs=require(_0xbe0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe0b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe0b('0x5'));var config=require(_0xbe0b('0x6'));var jayson=require(_0xbe0b('0x7'));var client=jayson[_0xbe0b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a01c4,_0x1812ee,_0x2e4f67){return new BPromise(function(_0x25440d,_0x137616){return client['request'](_0x3a01c4,_0x2e4f67)[_0xbe0b('0x9')](function(_0x4cdec5){logger[_0xbe0b('0xa')]('Cdr,\x20%s,\x20%s',_0x1812ee,_0xbe0b('0xb'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x1812ee,_0xbe0b('0xb'),JSON[_0xbe0b('0xc')](_0x4cdec5));if(_0x4cdec5['error']){if(_0x4cdec5['error'][_0xbe0b('0xd')]===0x1f4){logger['error'](_0xbe0b('0xe'),_0x1812ee,_0x4cdec5[_0xbe0b('0xf')][_0xbe0b('0x10')]);return _0x137616(_0x4cdec5[_0xbe0b('0xf')][_0xbe0b('0x10')]);}logger[_0xbe0b('0xf')](_0xbe0b('0xe'),_0x1812ee,_0x4cdec5[_0xbe0b('0xf')][_0xbe0b('0x10')]);return _0x25440d(_0x4cdec5['error']['message']);}else{logger[_0xbe0b('0xa')](_0xbe0b('0xe'),_0x1812ee,_0xbe0b('0xb'));_0x25440d(_0x4cdec5[_0xbe0b('0x11')][_0xbe0b('0x10')]);}})['catch'](function(_0x1d0bd9){logger[_0xbe0b('0xf')](_0xbe0b('0xe'),_0x1812ee,_0x1d0bd9);_0x137616(_0x1d0bd9);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e61a945..4343da9 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5cf063,_0x1b9a96){var _0xfa3092=function(_0x2c0ace){while(--_0x2c0ace){_0x5cf063['push'](_0x5cf063['shift']());}};_0xfa3092(++_0x1b9a96);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6ddf071..6882b9b 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 _0x8b39=['sequelize','INTEGER','STRING','TEXT'];(function(_0x331c72,_0x5a6428){var _0x2fe82b=function(_0x297095){while(--_0x297095){_0x331c72['push'](_0x331c72['shift']());}};_0x2fe82b(++_0x5a6428);}(_0x8b39,0x158));var _0x98b3=function(_0x163ed3,_0x1409c9){_0x163ed3=_0x163ed3-0x0;var _0x5bfefb=_0x8b39[_0x163ed3];return _0x5bfefb;};'use strict';var Sequelize=require(_0x98b3('0x0'));module['exports']={'priority':{'type':Sequelize[_0x98b3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x98b3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x98b3('0x3')]()},'description':{'type':Sequelize[_0x98b3('0x2')]},'interval':{'type':Sequelize[_0x98b3('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x02ee=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x02ee,0x1ea));var _0xe02e=function(_0x34e988,_0x15c19d){_0x34e988=_0x34e988-0x0;var _0x2220ae=_0x02ee[_0x34e988];return _0x2220ae;};'use strict';var Sequelize=require(_0xe02e('0x0'));module[_0xe02e('0x1')]={'priority':{'type':Sequelize[_0xe02e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe02e('0x3')],'allowNull':![],'defaultValue':_0xe02e('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe02e('0x3')]},'interval':{'type':Sequelize[_0xe02e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 51a8c3d..7067bd5 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 _0x1ba2=['include','merge','options','find','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','save','destroy','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','includeAll'];(function(_0x19a206,_0x1d7556){var _0x7514ac=function(_0xaddeaa){while(--_0xaddeaa){_0x19a206['push'](_0x19a206['shift']());}};_0x7514ac(++_0x1d7556);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x21ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21ba('0x2'));var moment=require(_0x21ba('0x3'));var BPromise=require(_0x21ba('0x4'));var Mustache=require(_0x21ba('0x5'));var util=require(_0x21ba('0x6'));var path=require('path');var sox=require(_0x21ba('0x7'));var csv=require(_0x21ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21ba('0x9'));var _=require('lodash');var squel=require(_0x21ba('0xa'));var crypto=require(_0x21ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x21ba('0xd'));var Papa=require(_0x21ba('0xe'));var Redis=require('ioredis');var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var licenseUtil=require(_0x21ba('0x17'));var db=require(_0x21ba('0x18'))['db'];function respondWithStatusCode(_0x10fae1,_0x2bc413){_0x2bc413=_0x2bc413||0xcc;return function(_0x48f552){if(_0x48f552){return _0x10fae1['sendStatus'](_0x2bc413);}return _0x10fae1[_0x21ba('0x19')](_0x2bc413)[_0x21ba('0x1a')]();};}function respondWithResult(_0x214f8e,_0x4f43e2){_0x4f43e2=_0x4f43e2||0xc8;return function(_0x4b9fd2){if(_0x4b9fd2){return _0x214f8e[_0x21ba('0x19')](_0x4f43e2)['json'](_0x4b9fd2);}};}function respondWithFilteredResult(_0x3591cd,_0x494588){return function(_0x179063){if(_0x179063){var _0x2e7b03=typeof _0x494588[_0x21ba('0x1b')]===_0x21ba('0x1c')&&typeof _0x494588[_0x21ba('0x1d')]==='undefined';var _0x1ab5ed=_0x179063['count'];var _0xc995ee=_0x2e7b03?0x0:_0x494588[_0x21ba('0x1b')];var _0x1f2f48=_0x2e7b03?_0x179063[_0x21ba('0x1e')]:_0x494588[_0x21ba('0x1b')]+_0x494588[_0x21ba('0x1d')];var _0x1eb6ed;if(_0x1f2f48>=_0x1ab5ed){_0x1f2f48=_0x1ab5ed;_0x1eb6ed=0xc8;}else{_0x1eb6ed=0xce;}_0x3591cd[_0x21ba('0x19')](_0x1eb6ed);return _0x3591cd['set'](_0x21ba('0x1f'),_0xc995ee+'-'+_0x1f2f48+'/'+_0x1ab5ed)[_0x21ba('0x20')](_0x179063);}return null;};}function patchUpdates(_0x58ba99){return function(_0x213a83){try{jsonpatch['apply'](_0x213a83,_0x58ba99,!![]);}catch(_0x3f9bc8){return BPromise['reject'](_0x3f9bc8);}return _0x213a83[_0x21ba('0x21')]();};}function saveUpdates(_0x43383f,_0x30ac7a){return function(_0x7abe9d){if(_0x7abe9d){return _0x7abe9d['update'](_0x43383f)['then'](function(_0x5a47da){return _0x5a47da;});}return null;};}function removeEntity(_0x4b63fb,_0x2e4b49){return function(_0x1529ec){if(_0x1529ec){return _0x1529ec[_0x21ba('0x22')]()[_0x21ba('0x23')](function(){_0x4b63fb[_0x21ba('0x19')](0xcc)[_0x21ba('0x1a')]();});}};}function handleEntityNotFound(_0x2f4d96,_0x3ab7d3){return function(_0x97ed7d){if(!_0x97ed7d){_0x2f4d96[_0x21ba('0x24')](0x194);}return _0x97ed7d;};}function handleError(_0x240e3f,_0xb9b6d8){_0xb9b6d8=_0xb9b6d8||0x1f4;return function(_0x2f7414){logger[_0x21ba('0x25')](_0x2f7414[_0x21ba('0x26')]);if(_0x2f7414[_0x21ba('0x27')]){delete _0x2f7414[_0x21ba('0x27')];}_0x240e3f[_0x21ba('0x19')](_0xb9b6d8)[_0x21ba('0x28')](_0x2f7414);};}exports[_0x21ba('0x29')]=function(_0x3d8dff,_0x9535d8){var _0x3e19cf={'raw':!![],'where':{'id':_0x3d8dff[_0x21ba('0x2a')]['id']}},_0x1b4ebe={};_0x1b4ebe[_0x21ba('0x2b')]=_[_0x21ba('0x2c')](db[_0x21ba('0x2d')][_0x21ba('0x2e')]);_0x1b4ebe[_0x21ba('0x2f')]=_[_0x21ba('0x2c')](_0x3d8dff[_0x21ba('0x2f')]);_0x1b4ebe['filters']=_[_0x21ba('0x30')](_0x1b4ebe[_0x21ba('0x2b')],_0x1b4ebe[_0x21ba('0x2f')]);_0x3e19cf[_0x21ba('0x31')]=_['intersection'](_0x1b4ebe['model'],qs[_0x21ba('0x32')](_0x3d8dff[_0x21ba('0x2f')][_0x21ba('0x32')]));_0x3e19cf[_0x21ba('0x31')]=_0x3e19cf[_0x21ba('0x31')]['length']?_0x3e19cf[_0x21ba('0x31')]:_0x1b4ebe['model'];if(_0x3d8dff[_0x21ba('0x2f')][_0x21ba('0x33')]){_0x3e19cf[_0x21ba('0x34')]=[{'all':!![]}];}_0x3e19cf=_[_0x21ba('0x35')]({},_0x3e19cf,_0x3d8dff[_0x21ba('0x36')]);return db[_0x21ba('0x2d')][_0x21ba('0x37')](_0x3e19cf)[_0x21ba('0x23')](handleEntityNotFound(_0x9535d8,null))[_0x21ba('0x23')](respondWithResult(_0x9535d8,null))['catch'](handleError(_0x9535d8,null));};exports['update']=function(_0x70b734,_0x18023d){if(_0x70b734[_0x21ba('0x38')]['id']){delete _0x70b734[_0x21ba('0x38')]['id'];}return db['ChatApplication'][_0x21ba('0x37')]({'where':{'id':_0x70b734[_0x21ba('0x2a')]['id']}})['then'](handleEntityNotFound(_0x18023d,null))[_0x21ba('0x23')](saveUpdates(_0x70b734[_0x21ba('0x38')],null))[_0x21ba('0x23')](respondWithResult(_0x18023d,null))[_0x21ba('0x39')](handleError(_0x18023d,null));};exports[_0x21ba('0x22')]=function(_0xd7f47,_0x37dfd2){return db['ChatApplication'][_0x21ba('0x37')]({'where':{'id':_0xd7f47['params']['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x37dfd2,null))['then'](removeEntity(_0x37dfd2,null))[_0x21ba('0x39')](handleError(_0x37dfd2,null));}; \ No newline at end of file +var _0x26f9=['length','includeAll','include','options','find','catch','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','params','model','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x3f246d,_0x5474d2){var _0x51512b=function(_0x68624){while(--_0x68624){_0x3f246d['push'](_0x3f246d['shift']());}};_0x51512b(++_0x5474d2);}(_0x26f9,0x16f));var _0x926f=function(_0x18e80c,_0x4077f7){_0x18e80c=_0x18e80c-0x0;var _0x183ba9=_0x26f9[_0x18e80c];return _0x183ba9;};'use strict';var emlformat=require(_0x926f('0x0'));var rimraf=require(_0x926f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x926f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x926f('0x3'));var Mustache=require(_0x926f('0x4'));var util=require('util');var path=require(_0x926f('0x5'));var sox=require(_0x926f('0x6'));var csv=require(_0x926f('0x7'));var ejs=require(_0x926f('0x8'));var fs=require('fs');var fs_extra=require(_0x926f('0x9'));var _=require(_0x926f('0xa'));var squel=require(_0x926f('0xb'));var crypto=require(_0x926f('0xc'));var jsforce=require(_0x926f('0xd'));var deskjs=require(_0x926f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x926f('0xf'));var Papa=require('papaparse');var Redis=require(_0x926f('0x10'));var authService=require(_0x926f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x926f('0x12'));var hardwareService=require(_0x926f('0x13'));var logger=require(_0x926f('0x14'))(_0x926f('0x15'));var utils=require(_0x926f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x926f('0x17'));var db=require(_0x926f('0x18'))['db'];function respondWithStatusCode(_0x14f316,_0x1ac8ab){_0x1ac8ab=_0x1ac8ab||0xcc;return function(_0x44f5da){if(_0x44f5da){return _0x14f316[_0x926f('0x19')](_0x1ac8ab);}return _0x14f316[_0x926f('0x1a')](_0x1ac8ab)['end']();};}function respondWithResult(_0x48ee07,_0x5e6fb1){_0x5e6fb1=_0x5e6fb1||0xc8;return function(_0x11197b){if(_0x11197b){return _0x48ee07[_0x926f('0x1a')](_0x5e6fb1)[_0x926f('0x1b')](_0x11197b);}};}function respondWithFilteredResult(_0x280759,_0x57c87f){return function(_0x37035c){if(_0x37035c){var _0x385fad=typeof _0x57c87f['offset']===_0x926f('0x1c')&&typeof _0x57c87f['limit']===_0x926f('0x1c');var _0x5ad99f=_0x37035c['count'];var _0x36ead3=_0x385fad?0x0:_0x57c87f[_0x926f('0x1d')];var _0x4f25e3=_0x385fad?_0x37035c[_0x926f('0x1e')]:_0x57c87f[_0x926f('0x1d')]+_0x57c87f[_0x926f('0x1f')];var _0x50b2d4;if(_0x4f25e3>=_0x5ad99f){_0x4f25e3=_0x5ad99f;_0x50b2d4=0xc8;}else{_0x50b2d4=0xce;}_0x280759[_0x926f('0x1a')](_0x50b2d4);return _0x280759[_0x926f('0x20')]('Content-Range',_0x36ead3+'-'+_0x4f25e3+'/'+_0x5ad99f)[_0x926f('0x1b')](_0x37035c);}return null;};}function patchUpdates(_0x4241ac){return function(_0x56fef1){try{jsonpatch[_0x926f('0x21')](_0x56fef1,_0x4241ac,!![]);}catch(_0xa942ae){return BPromise[_0x926f('0x22')](_0xa942ae);}return _0x56fef1[_0x926f('0x23')]();};}function saveUpdates(_0x150430,_0x3b7179){return function(_0x412260){if(_0x412260){return _0x412260[_0x926f('0x24')](_0x150430)[_0x926f('0x25')](function(_0x61738a){return _0x61738a;});}return null;};}function removeEntity(_0x2be66b,_0x4a93a4){return function(_0x2d76eb){if(_0x2d76eb){return _0x2d76eb[_0x926f('0x26')]()['then'](function(){_0x2be66b[_0x926f('0x1a')](0xcc)[_0x926f('0x27')]();});}};}function handleEntityNotFound(_0x36a17e,_0x26391d){return function(_0x799889){if(!_0x799889){_0x36a17e[_0x926f('0x19')](0x194);}return _0x799889;};}function handleError(_0x4b8964,_0x110e59){_0x110e59=_0x110e59||0x1f4;return function(_0x5065dd){logger[_0x926f('0x28')](_0x5065dd[_0x926f('0x29')]);if(_0x5065dd[_0x926f('0x2a')]){delete _0x5065dd[_0x926f('0x2a')];}_0x4b8964['status'](_0x110e59)[_0x926f('0x2b')](_0x5065dd);};}exports['show']=function(_0xc88ea4,_0x2556ce){var _0x518a47={'raw':!![],'where':{'id':_0xc88ea4[_0x926f('0x2c')]['id']}},_0x5f35fe={};_0x5f35fe[_0x926f('0x2d')]=_['keys'](db[_0x926f('0x2e')][_0x926f('0x2f')]);_0x5f35fe['query']=_['keys'](_0xc88ea4[_0x926f('0x30')]);_0x5f35fe[_0x926f('0x31')]=_[_0x926f('0x32')](_0x5f35fe['model'],_0x5f35fe[_0x926f('0x30')]);_0x518a47[_0x926f('0x33')]=_[_0x926f('0x32')](_0x5f35fe['model'],qs[_0x926f('0x34')](_0xc88ea4[_0x926f('0x30')][_0x926f('0x34')]));_0x518a47[_0x926f('0x33')]=_0x518a47[_0x926f('0x33')][_0x926f('0x35')]?_0x518a47['attributes']:_0x5f35fe[_0x926f('0x2d')];if(_0xc88ea4[_0x926f('0x30')][_0x926f('0x36')]){_0x518a47[_0x926f('0x37')]=[{'all':!![]}];}_0x518a47=_['merge']({},_0x518a47,_0xc88ea4[_0x926f('0x38')]);return db[_0x926f('0x2e')][_0x926f('0x39')](_0x518a47)[_0x926f('0x25')](handleEntityNotFound(_0x2556ce,null))[_0x926f('0x25')](respondWithResult(_0x2556ce,null))[_0x926f('0x3a')](handleError(_0x2556ce,null));};exports[_0x926f('0x24')]=function(_0xaad45d,_0x2184c1){if(_0xaad45d[_0x926f('0x3b')]['id']){delete _0xaad45d[_0x926f('0x3b')]['id'];}return db['ChatApplication'][_0x926f('0x39')]({'where':{'id':_0xaad45d[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2184c1,null))[_0x926f('0x25')](saveUpdates(_0xaad45d[_0x926f('0x3b')],null))[_0x926f('0x25')](respondWithResult(_0x2184c1,null))[_0x926f('0x3a')](handleError(_0x2184c1,null));};exports[_0x926f('0x26')]=function(_0x3a21ca,_0x9ff853){return db[_0x926f('0x2e')]['find']({'where':{'id':_0x3a21ca[_0x926f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x9ff853,null))[_0x926f('0x25')](removeEntity(_0x9ff853,null))[_0x926f('0x3a')](handleError(_0x9ff853,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 63df22c..6f07ef6 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 _0xe430=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xe430,0x1da));var _0x0e43=function(_0xce0826,_0x2764e3){_0xce0826=_0xce0826-0x0;var _0x2c8606=_0xe430[_0xce0826];return _0x2c8606;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0e43('0x0'));var moment=require(_0x0e43('0x1'));var BPromise=require(_0x0e43('0x2'));var rp=require(_0x0e43('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e43('0x4'));var config=require(_0x0e43('0x5'));var attributes=require(_0x0e43('0x6'));module[_0x0e43('0x7')]=function(_0x42ff21,_0x156fb9){return _0x42ff21[_0x0e43('0x8')](_0x0e43('0x9'),attributes,{'tableName':_0x0e43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e43('0xb')});}; \ No newline at end of file +var _0x39e0=['bluebird','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment'];(function(_0x5dd41b,_0x29022b){var _0x213ed1=function(_0x39552b){while(--_0x39552b){_0x5dd41b['push'](_0x5dd41b['shift']());}};_0x213ed1(++_0x29022b);}(_0x39e0,0x1c5));var _0x039e=function(_0x1191ac,_0x1bee2c){_0x1191ac=_0x1191ac-0x0;var _0x5044ac=_0x39e0[_0x1191ac];return _0x5044ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x039e('0x0'))('api');var moment=require(_0x039e('0x1'));var BPromise=require(_0x039e('0x2'));var rp=require(_0x039e('0x3'));var fs=require('fs');var path=require(_0x039e('0x4'));var rimraf=require('rimraf');var config=require(_0x039e('0x5'));var attributes=require(_0x039e('0x6'));module[_0x039e('0x7')]=function(_0x4a0a75,_0x2be3e2){return _0x4a0a75[_0x039e('0x8')](_0x039e('0x9'),attributes,{'tableName':_0x039e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x039e('0xb'),'collate':_0x039e('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ab0dd7e..1691b35 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 _0x5b92=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','util','moment'];(function(_0x5422dc,_0x31bd0c){var _0x33dfd9=function(_0x4053c9){while(--_0x4053c9){_0x5422dc['push'](_0x5422dc['shift']());}};_0x33dfd9(++_0x31bd0c);}(_0x5b92,0xd5));var _0x25b9=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x5b92[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x25b9('0x0'));var util=require(_0x25b9('0x1'));var moment=require(_0x25b9('0x2'));var BPromise=require(_0x25b9('0x3'));var rs=require(_0x25b9('0x4'));var fs=require('fs');var Redis=require(_0x25b9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x25b9('0x6'));var logger=require(_0x25b9('0x7'))('rpc');var config=require(_0x25b9('0x8'));var jayson=require(_0x25b9('0x9'));var client=jayson[_0x25b9('0xa')][_0x25b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4d39,_0x53429d,_0x3f14e4){return new BPromise(function(_0x3dbd2d,_0x47c06e){return client[_0x25b9('0xc')](_0x2e4d39,_0x3f14e4)[_0x25b9('0xd')](function(_0x5a855b){logger['info'](_0x25b9('0xe'),_0x53429d,'request\x20sent');logger[_0x25b9('0xf')](_0x25b9('0x10'),_0x53429d,'request\x20sent',JSON['stringify'](_0x5a855b));if(_0x5a855b[_0x25b9('0x11')]){if(_0x5a855b[_0x25b9('0x11')][_0x25b9('0x12')]===0x1f4){logger['error'](_0x25b9('0xe'),_0x53429d,_0x5a855b[_0x25b9('0x11')]['message']);return _0x47c06e(_0x5a855b['error']['message']);}logger[_0x25b9('0x11')](_0x25b9('0xe'),_0x53429d,_0x5a855b[_0x25b9('0x11')][_0x25b9('0x13')]);return _0x3dbd2d(_0x5a855b[_0x25b9('0x11')][_0x25b9('0x13')]);}else{logger[_0x25b9('0x14')](_0x25b9('0xe'),_0x53429d,_0x25b9('0x15'));_0x3dbd2d(_0x5a855b[_0x25b9('0x16')][_0x25b9('0x13')]);}})[_0x25b9('0x17')](function(_0x1d5f07){logger['error'](_0x25b9('0xe'),_0x53429d,_0x1d5f07);_0x47c06e(_0x1d5f07);});});} \ No newline at end of file +var _0x5da7=['http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client'];(function(_0x4cc765,_0x136732){var _0x5e4a03=function(_0x4042e5){while(--_0x4042e5){_0x4cc765['push'](_0x4cc765['shift']());}};_0x5e4a03(++_0x136732);}(_0x5da7,0x17d));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75da('0x0'));var util=require(_0x75da('0x1'));var moment=require(_0x75da('0x2'));var BPromise=require(_0x75da('0x3'));var rs=require(_0x75da('0x4'));var fs=require('fs');var Redis=require(_0x75da('0x5'));var db=require(_0x75da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x75da('0x7'))(_0x75da('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x75da('0x9')][_0x75da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522b82,_0x56fad0,_0x2def1d){return new BPromise(function(_0x490e80,_0x39bcd1){return client[_0x75da('0xb')](_0x522b82,_0x2def1d)[_0x75da('0xc')](function(_0x4274a7){logger['info'](_0x75da('0xd'),_0x56fad0,_0x75da('0xe'));logger[_0x75da('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x56fad0,'request\x20sent',JSON[_0x75da('0x10')](_0x4274a7));if(_0x4274a7[_0x75da('0x11')]){if(_0x4274a7['error'][_0x75da('0x12')]===0x1f4){logger['error'](_0x75da('0xd'),_0x56fad0,_0x4274a7['error'][_0x75da('0x13')]);return _0x39bcd1(_0x4274a7['error'][_0x75da('0x13')]);}logger[_0x75da('0x11')](_0x75da('0xd'),_0x56fad0,_0x4274a7[_0x75da('0x11')][_0x75da('0x13')]);return _0x490e80(_0x4274a7[_0x75da('0x11')]['message']);}else{logger[_0x75da('0x14')]('ChatApplication,\x20%s,\x20%s',_0x56fad0,_0x75da('0xe'));_0x490e80(_0x4274a7[_0x75da('0x15')][_0x75da('0x13')]);}})[_0x75da('0x16')](function(_0x279a4c){logger[_0x75da('0x11')]('ChatApplication,\x20%s,\x20%s',_0x56fad0,_0x279a4c);_0x39bcd1(_0x279a4c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d0f8142..fa78a4a 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 _0xceef=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatApplication.controller','isAuthenticated','show','put','/:id','update','delete'];(function(_0x5d44e9,_0x4bc46b){var _0x38d196=function(_0x33a769){while(--_0x33a769){_0x5d44e9['push'](_0x5d44e9['shift']());}};_0x38d196(++_0x4bc46b);}(_0xceef,0x182));var _0xfcee=function(_0x505a7d,_0x25e11f){_0x505a7d=_0x505a7d-0x0;var _0x17d880=_0xceef[_0x505a7d];return _0x17d880;};'use strict';var multer=require(_0xfcee('0x0'));var util=require(_0xfcee('0x1'));var path=require(_0xfcee('0x2'));var timeout=require(_0xfcee('0x3'));var express=require(_0xfcee('0x4'));var router=express[_0xfcee('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfcee('0x6'));var controller=require(_0xfcee('0x7'));router['get']('/:id',auth[_0xfcee('0x8')](),controller[_0xfcee('0x9')]);router[_0xfcee('0xa')](_0xfcee('0xb'),auth[_0xfcee('0x8')](),controller[_0xfcee('0xc')]);router[_0xfcee('0xd')](_0xfcee('0xb'),auth['isAuthenticated'](),controller[_0xfcee('0xe')]);module[_0xfcee('0xf')]=router; \ No newline at end of file +var _0x13b0=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','destroy','multer','path','connect-timeout','express'];(function(_0x2f0971,_0x14a986){var _0x3cb533=function(_0x443024){while(--_0x443024){_0x2f0971['push'](_0x2f0971['shift']());}};_0x3cb533(++_0x14a986);}(_0x13b0,0x146));var _0x013b=function(_0x2eadcb,_0xf6cdee){_0x2eadcb=_0x2eadcb-0x0;var _0x15f68a=_0x13b0[_0x2eadcb];return _0x15f68a;};'use strict';var multer=require(_0x013b('0x0'));var util=require('util');var path=require(_0x013b('0x1'));var timeout=require(_0x013b('0x2'));var express=require(_0x013b('0x3'));var router=express[_0x013b('0x4')]();var fs_extra=require(_0x013b('0x5'));var auth=require(_0x013b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x013b('0x7'));var controller=require(_0x013b('0x8'));router['get'](_0x013b('0x9'),auth[_0x013b('0xa')](),controller[_0x013b('0xb')]);router[_0x013b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x013b('0xd')]);router['delete'](_0x013b('0x9'),auth['isAuthenticated'](),controller[_0x013b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index bf5a1dc..8c24da7 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 _0x363e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x363e,0x179));var _0xe363=function(_0x3a2ba4,_0x1dccd9){_0x3a2ba4=_0x3a2ba4-0x0;var _0x222223=_0x363e[_0x3a2ba4];return _0x222223;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe363('0x2')]},'write':{'type':Sequelize[_0xe363('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5d59=['exports','STRING','BOOLEAN'];(function(_0x391ed5,_0x45443b){var _0x13bdad=function(_0x48a3f9){while(--_0x48a3f9){_0x391ed5['push'](_0x391ed5['shift']());}};_0x13bdad(++_0x45443b);}(_0x5d59,0x15f));var _0x95d5=function(_0x40bad6,_0x1a5dc8){_0x40bad6=_0x40bad6-0x0;var _0xdfd3f2=_0x5d59[_0x40bad6];return _0xdfd3f2;};'use strict';var Sequelize=require('sequelize');module[_0x95d5('0x0')]={'name':{'type':Sequelize[_0x95d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x95d5('0x1')]},'write':{'type':Sequelize[_0x95d5('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1a79a15..bcbf033 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 _0x9a6b=['eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','ChatGroup','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','catch','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','filter','hasOwnProperty','removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit'];(function(_0xdf56aa,_0x4d9c15){var _0x82768=function(_0x56a69f){while(--_0x56a69f){_0xdf56aa['push'](_0xdf56aa['shift']());}};_0x82768(++_0x4d9c15);}(_0x9a6b,0xc0));var _0xb9a6=function(_0x20d7f0,_0x4c1ed8){_0x20d7f0=_0x20d7f0-0x0;var _0x57da99=_0x9a6b[_0x20d7f0];return _0x57da99;};'use strict';var emlformat=require(_0xb9a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb9a6('0x1'));var rp=require(_0xb9a6('0x2'));var moment=require('moment');var BPromise=require(_0xb9a6('0x3'));var Mustache=require('mustache');var util=require(_0xb9a6('0x4'));var path=require(_0xb9a6('0x5'));var sox=require(_0xb9a6('0x6'));var csv=require(_0xb9a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9a6('0x8'));var squel=require(_0xb9a6('0x9'));var crypto=require(_0xb9a6('0xa'));var jsforce=require(_0xb9a6('0xb'));var deskjs=require(_0xb9a6('0xc'));var toCsv=require(_0xb9a6('0x7'));var querystring=require(_0xb9a6('0xd'));var Papa=require(_0xb9a6('0xe'));var Redis=require(_0xb9a6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb9a6('0x10'));var as=require(_0xb9a6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9a6('0x12'))(_0xb9a6('0x13'));var utils=require(_0xb9a6('0x14'));var config=require(_0xb9a6('0x15'));var licenseUtil=require(_0xb9a6('0x16'));var db=require(_0xb9a6('0x17'))['db'];config[_0xb9a6('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9a6('0x19'))(new Redis(config['redis']));require(_0xb9a6('0x1a'))[_0xb9a6('0x1b')](socket);function respondWithStatusCode(_0x26df6b,_0x1931b8){_0x1931b8=_0x1931b8||0xcc;return function(_0xef1842){if(_0xef1842){return _0x26df6b[_0xb9a6('0x1c')](_0x1931b8);}return _0x26df6b[_0xb9a6('0x1d')](_0x1931b8)['end']();};}function respondWithResult(_0x24d576,_0x2dd9ca){_0x2dd9ca=_0x2dd9ca||0xc8;return function(_0x14de33){if(_0x14de33){return _0x24d576['status'](_0x2dd9ca)[_0xb9a6('0x1e')](_0x14de33);}};}function respondWithFilteredResult(_0x5524c9,_0x545f94){return function(_0x1dda90){if(_0x1dda90){var _0x128599=typeof _0x545f94[_0xb9a6('0x1f')]==='undefined'&&typeof _0x545f94['limit']==='undefined';var _0x933f34=_0x1dda90[_0xb9a6('0x20')];var _0x1d2f8b=_0x128599?0x0:_0x545f94['offset'];var _0x498589=_0x128599?_0x1dda90[_0xb9a6('0x20')]:_0x545f94[_0xb9a6('0x1f')]+_0x545f94[_0xb9a6('0x21')];var _0x322b5c;if(_0x498589>=_0x933f34){_0x498589=_0x933f34;_0x322b5c=0xc8;}else{_0x322b5c=0xce;}_0x5524c9[_0xb9a6('0x1d')](_0x322b5c);return _0x5524c9[_0xb9a6('0x22')](_0xb9a6('0x23'),_0x1d2f8b+'-'+_0x498589+'/'+_0x933f34)[_0xb9a6('0x1e')](_0x1dda90);}return null;};}function patchUpdates(_0x2cdf47){return function(_0x112932){try{jsonpatch[_0xb9a6('0x24')](_0x112932,_0x2cdf47,!![]);}catch(_0x1efbab){return BPromise['reject'](_0x1efbab);}return _0x112932[_0xb9a6('0x25')]();};}function saveUpdates(_0x3c8a10,_0x2504d8){return function(_0x463c3f){if(_0x463c3f){return _0x463c3f[_0xb9a6('0x26')](_0x3c8a10)[_0xb9a6('0x27')](function(_0x1b9f33){return _0x1b9f33;});}return null;};}function removeEntity(_0x446398,_0x14bfe0){return function(_0x397999){if(_0x397999){return _0x397999[_0xb9a6('0x28')]()['then'](function(){_0x446398[_0xb9a6('0x1d')](0xcc)[_0xb9a6('0x29')]();});}};}function handleEntityNotFound(_0x4e934c,_0x280943){return function(_0xd6a7e6){if(!_0xd6a7e6){_0x4e934c['sendStatus'](0x194);}return _0xd6a7e6;};}function handleError(_0x48b807,_0x10291a){_0x10291a=_0x10291a||0x1f4;return function(_0x520724){logger[_0xb9a6('0x2a')](_0x520724[_0xb9a6('0x2b')]);if(_0x520724['name']){delete _0x520724[_0xb9a6('0x2c')];}_0x48b807[_0xb9a6('0x1d')](_0x10291a)[_0xb9a6('0x2d')](_0x520724);};}exports[_0xb9a6('0x2e')]=function(_0x182f86,_0x9ac594){var _0x27c8b5={},_0x158b50={},_0xf1205e={'count':0x0,'rows':[]};var _0x471262=_[_0xb9a6('0x2f')](db[_0xb9a6('0x30')]['rawAttributes'],function(_0x2d4808){return{'name':_0x2d4808['fieldName'],'type':_0x2d4808[_0xb9a6('0x31')][_0xb9a6('0x32')]};});_0x158b50[_0xb9a6('0x33')]=_[_0xb9a6('0x2f')](_0x471262,'name');_0x158b50[_0xb9a6('0x34')]=_[_0xb9a6('0x35')](_0x182f86[_0xb9a6('0x34')]);_0x158b50['filters']=_[_0xb9a6('0x36')](_0x158b50[_0xb9a6('0x33')],_0x158b50[_0xb9a6('0x34')]);_0x27c8b5[_0xb9a6('0x37')]=_[_0xb9a6('0x36')](_0x158b50[_0xb9a6('0x33')],qs[_0xb9a6('0x38')](_0x182f86[_0xb9a6('0x34')]['fields']));_0x27c8b5[_0xb9a6('0x37')]=_0x27c8b5[_0xb9a6('0x37')][_0xb9a6('0x39')]?_0x27c8b5[_0xb9a6('0x37')]:_0x158b50[_0xb9a6('0x33')];if(!_0x182f86[_0xb9a6('0x34')]['hasOwnProperty']('nolimit')){_0x27c8b5['limit']=qs[_0xb9a6('0x21')](_0x182f86[_0xb9a6('0x34')][_0xb9a6('0x21')]);_0x27c8b5['offset']=qs['offset'](_0x182f86[_0xb9a6('0x34')][_0xb9a6('0x1f')]);}_0x27c8b5[_0xb9a6('0x3a')]=qs[_0xb9a6('0x3b')](_0x182f86['query'][_0xb9a6('0x3b')]);_0x27c8b5[_0xb9a6('0x3c')]=qs[_0xb9a6('0x3d')](_[_0xb9a6('0x3e')](_0x182f86['query'],_0x158b50[_0xb9a6('0x3d')]),_0x471262);if(_0x182f86['query']['filter']){_0x27c8b5['where']=_[_0xb9a6('0x3f')](_0x27c8b5['where'],{'$or':_[_0xb9a6('0x2f')](_0x471262,function(_0xebd9d9){if(_0xebd9d9[_0xb9a6('0x31')]!==_0xb9a6('0x40')){var _0x1afcf1={};_0x1afcf1[_0xebd9d9[_0xb9a6('0x2c')]]={'$like':'%'+_0x182f86[_0xb9a6('0x34')]['filter']+'%'};return _0x1afcf1;}})});}_0x27c8b5=_[_0xb9a6('0x3f')]({},_0x27c8b5,_0x182f86[_0xb9a6('0x41')]);var _0x5c48c1={'where':_0x27c8b5[_0xb9a6('0x3c')]};return db[_0xb9a6('0x30')][_0xb9a6('0x20')](_0x5c48c1)[_0xb9a6('0x27')](function(_0x4012c9){_0xf1205e['count']=_0x4012c9;if(_0x182f86[_0xb9a6('0x34')][_0xb9a6('0x42')]){_0x27c8b5[_0xb9a6('0x43')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x27c8b5);})[_0xb9a6('0x27')](function(_0x218b7f){_0xf1205e[_0xb9a6('0x44')]=_0x218b7f;return _0xf1205e;})[_0xb9a6('0x27')](respondWithFilteredResult(_0x9ac594,_0x27c8b5))['catch'](handleError(_0x9ac594,null));};exports['show']=function(_0x137a7e,_0x1d7392){var _0x2ba0a2={'raw':!![],'where':{'id':_0x137a7e[_0xb9a6('0x45')]['id']}},_0x4ba3a5={};_0x4ba3a5[_0xb9a6('0x33')]=_['keys'](db['ChatGroup'][_0xb9a6('0x46')]);_0x4ba3a5[_0xb9a6('0x34')]=_[_0xb9a6('0x35')](_0x137a7e['query']);_0x4ba3a5[_0xb9a6('0x3d')]=_[_0xb9a6('0x36')](_0x4ba3a5[_0xb9a6('0x33')],_0x4ba3a5[_0xb9a6('0x34')]);_0x2ba0a2[_0xb9a6('0x37')]=_[_0xb9a6('0x36')](_0x4ba3a5[_0xb9a6('0x33')],qs[_0xb9a6('0x38')](_0x137a7e['query'][_0xb9a6('0x38')]));_0x2ba0a2['attributes']=_0x2ba0a2[_0xb9a6('0x37')]['length']?_0x2ba0a2[_0xb9a6('0x37')]:_0x4ba3a5[_0xb9a6('0x33')];if(_0x137a7e['query'][_0xb9a6('0x42')]){_0x2ba0a2[_0xb9a6('0x43')]=[{'all':!![]}];}_0x2ba0a2=_[_0xb9a6('0x3f')]({},_0x2ba0a2,_0x137a7e['options']);return db[_0xb9a6('0x30')]['find'](_0x2ba0a2)[_0xb9a6('0x27')](handleEntityNotFound(_0x1d7392,null))[_0xb9a6('0x27')](respondWithResult(_0x1d7392,null))[_0xb9a6('0x47')](handleError(_0x1d7392,null));};exports[_0xb9a6('0x48')]=function(_0x5dbd71,_0x4e6e87){return db[_0xb9a6('0x30')][_0xb9a6('0x48')](_0x5dbd71['body'],{})[_0xb9a6('0x27')](respondWithResult(_0x4e6e87,0xc9))[_0xb9a6('0x47')](handleError(_0x4e6e87,null));};exports[_0xb9a6('0x26')]=function(_0x1734d8,_0x4f7d32){if(_0x1734d8[_0xb9a6('0x49')]['id']){delete _0x1734d8[_0xb9a6('0x49')]['id'];}return db[_0xb9a6('0x30')][_0xb9a6('0x4a')]({'where':{'id':_0x1734d8['params']['id']}})['then'](handleEntityNotFound(_0x4f7d32,null))['then'](saveUpdates(_0x1734d8[_0xb9a6('0x49')],null))[_0xb9a6('0x27')](respondWithResult(_0x4f7d32,null))['catch'](handleError(_0x4f7d32,null));};exports[_0xb9a6('0x28')]=function(_0x351dca,_0x5c77e2){return db[_0xb9a6('0x30')]['find']({'where':{'id':_0x351dca[_0xb9a6('0x45')]['id']}})[_0xb9a6('0x27')](handleEntityNotFound(_0x5c77e2,null))[_0xb9a6('0x27')](removeEntity(_0x5c77e2,null))[_0xb9a6('0x47')](handleError(_0x5c77e2,null));};exports[_0xb9a6('0x4b')]=function(_0x44f2af,_0x1ba7e0){return db[_0xb9a6('0x30')]['describe']()['then'](respondWithResult(_0x1ba7e0,null))['catch'](handleError(_0x1ba7e0,null));};exports[_0xb9a6('0x4c')]=function(_0x35a036,_0x6b2cbf,_0x1f8943){return db[_0xb9a6('0x4d')][_0xb9a6('0x20')]({'where':{'ChatGroupId':_0x35a036['params']['id'],'ToId':_0x35a036[_0xb9a6('0x4e')]['id'],'read':![]}})[_0xb9a6('0x27')](function(_0x565371){return{'id':_[_0xb9a6('0x4f')](_0x35a036[_0xb9a6('0x45')]['id']),'count':_0x565371};})[_0xb9a6('0x27')](respondWithResult(_0x6b2cbf,null))[_0xb9a6('0x47')](handleError(_0x6b2cbf,null));};exports[_0xb9a6('0x50')]=function(_0x5010c8,_0x440b74,_0x3cda57){return db[_0xb9a6('0x30')]['find']({'where':{'id':_0x5010c8[_0xb9a6('0x45')]['id']}})[_0xb9a6('0x27')](handleEntityNotFound(_0x440b74,null))[_0xb9a6('0x27')](function(_0x1a23fe){if(_0x1a23fe){return _0x1a23fe[_0xb9a6('0x50')](_0x5010c8[_0xb9a6('0x49')]['ids'],_[_0xb9a6('0x51')](_0x5010c8[_0xb9a6('0x49')],[_0xb9a6('0x52'),'id'])||{});}})[_0xb9a6('0x27')](respondWithResult(_0x440b74,null))[_0xb9a6('0x47')](handleError(_0x440b74,null));};exports[_0xb9a6('0x53')]=function(_0x1b854d,_0x2e7f85,_0x37b8b6){var _0x29148e={};var _0x4a5c58={};var _0x8e9fb9;var _0x393f2c;return db[_0xb9a6('0x30')][_0xb9a6('0x54')]({'where':{'id':_0x1b854d[_0xb9a6('0x45')]['id']}})[_0xb9a6('0x27')](handleEntityNotFound(_0x2e7f85,null))[_0xb9a6('0x27')](function(_0x55fdfe){if(_0x55fdfe){_0x8e9fb9=_0x55fdfe;_0x4a5c58[_0xb9a6('0x33')]=_[_0xb9a6('0x35')](db[_0xb9a6('0x55')][_0xb9a6('0x46')]);_0x4a5c58['query']=_[_0xb9a6('0x35')](_0x1b854d[_0xb9a6('0x34')]);_0x4a5c58[_0xb9a6('0x3d')]=_['intersection'](_0x4a5c58[_0xb9a6('0x33')],_0x4a5c58['query']);_0x29148e[_0xb9a6('0x37')]=_[_0xb9a6('0x36')](_0x4a5c58[_0xb9a6('0x33')],qs[_0xb9a6('0x38')](_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x38')]));_0x29148e[_0xb9a6('0x37')]=_0x29148e[_0xb9a6('0x37')][_0xb9a6('0x39')]?_0x29148e['attributes']:_0x4a5c58[_0xb9a6('0x33')];_0x29148e[_0xb9a6('0x3a')]=qs[_0xb9a6('0x3b')](_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x3b')]);_0x29148e[_0xb9a6('0x3c')]=qs[_0xb9a6('0x3d')](_[_0xb9a6('0x3e')](_0x1b854d[_0xb9a6('0x34')],_0x4a5c58['filters']));if(_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x56')]){_0x29148e[_0xb9a6('0x3c')]=_[_0xb9a6('0x3f')](_0x29148e[_0xb9a6('0x3c')],{'$or':_['map'](_0x29148e[_0xb9a6('0x37')],function(_0x2ca257){var _0x26233f={};_0x26233f[_0x2ca257]={'$like':'%'+_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x56')]+'%'};return _0x26233f;})});}_0x29148e=_['merge']({},_0x29148e,_0x1b854d[_0xb9a6('0x41')]);return _0x8e9fb9[_0xb9a6('0x53')](_0x29148e);}})[_0xb9a6('0x27')](function(_0x58f5b1){if(_0x58f5b1){_0x393f2c=_0x58f5b1[_0xb9a6('0x39')];if(!_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x57')]('nolimit')){_0x29148e[_0xb9a6('0x21')]=qs[_0xb9a6('0x21')](_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x21')]);_0x29148e[_0xb9a6('0x1f')]=qs['offset'](_0x1b854d[_0xb9a6('0x34')][_0xb9a6('0x1f')]);}return _0x8e9fb9[_0xb9a6('0x53')](_0x29148e);}})[_0xb9a6('0x27')](function(_0xc8dc96){if(_0xc8dc96){return _0xc8dc96?{'count':_0x393f2c,'rows':_0xc8dc96}:null;}})[_0xb9a6('0x27')](respondWithResult(_0x2e7f85,null))['catch'](handleError(_0x2e7f85,null));};exports['removeMembers']=function(_0x292327,_0x2b3463,_0x597ccd){return db['ChatGroup'][_0xb9a6('0x4a')]({'where':{'id':_0x292327[_0xb9a6('0x45')]['id']}})[_0xb9a6('0x27')](handleEntityNotFound(_0x2b3463,null))['then'](function(_0x8ba142){if(_0x8ba142){return _0x8ba142[_0xb9a6('0x58')](_0x292327['query']['ids']);}})[_0xb9a6('0x27')](respondWithStatusCode(_0x2b3463,null))['catch'](handleError(_0x2b3463,null));};exports[_0xb9a6('0x59')]=function(_0x3731c9,_0x159b77,_0x5d94cb){if(_0x3731c9[_0xb9a6('0x49')]['id']){delete _0x3731c9['body']['id'];}return db[_0xb9a6('0x30')]['find']({'where':{'id':_0x3731c9['params']['id']}})['then'](handleEntityNotFound(_0x159b77,null))[_0xb9a6('0x27')](function(_0x4ca287){if(_0x4ca287){_0x3731c9[_0xb9a6('0x49')]['ChatGroupId']=_0x4ca287['id'];return db[_0xb9a6('0x4d')]['create'](_0x3731c9['body']);}})[_0xb9a6('0x27')](respondWithResult(_0x159b77,null))['catch'](handleError(_0x159b77,null));};exports[_0xb9a6('0x5a')]=function(_0x4d800a,_0x2fd118,_0x11c1ae){var _0x277c04={};var _0x5478b5={};var _0x626b6f;var _0x2655d1;return db[_0xb9a6('0x30')]['findOne']({'where':{'id':_0x4d800a[_0xb9a6('0x45')]['id']}})[_0xb9a6('0x27')](handleEntityNotFound(_0x2fd118,null))[_0xb9a6('0x27')](function(_0x530d78){if(_0x530d78){_0x626b6f=_0x530d78;_0x5478b5[_0xb9a6('0x33')]=_[_0xb9a6('0x35')](db[_0xb9a6('0x4d')][_0xb9a6('0x46')]);_0x5478b5[_0xb9a6('0x34')]=_['keys'](_0x4d800a[_0xb9a6('0x34')]);_0x5478b5['filters']=_[_0xb9a6('0x36')](_0x5478b5['model'],_0x5478b5[_0xb9a6('0x34')]);_0x277c04[_0xb9a6('0x37')]=_[_0xb9a6('0x36')](_0x5478b5['model'],qs[_0xb9a6('0x38')](_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x38')]));_0x277c04[_0xb9a6('0x37')]=_0x277c04[_0xb9a6('0x37')][_0xb9a6('0x39')]?_0x277c04[_0xb9a6('0x37')]:_0x5478b5[_0xb9a6('0x33')];_0x277c04['order']=qs['sort'](_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x3b')]);_0x277c04[_0xb9a6('0x3c')]=qs[_0xb9a6('0x3d')](_[_0xb9a6('0x3e')](_0x4d800a[_0xb9a6('0x34')],_0x5478b5[_0xb9a6('0x3d')]));if(_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x56')]){_0x277c04['where']=_[_0xb9a6('0x3f')](_0x277c04[_0xb9a6('0x3c')],{'$or':_[_0xb9a6('0x2f')](_0x277c04[_0xb9a6('0x37')],function(_0x53c7e0){var _0x4e574f={};_0x4e574f[_0x53c7e0]={'$like':'%'+_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x56')]+'%'};return _0x4e574f;})});}if(_0x4d800a['query']['$gte']){var _0x5afb45=_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x5b')][_0xb9a6('0x5c')](',');var _0x5f060e={};_0x5f060e[_0x5afb45[0x0]]={'$gte':moment(_0x5afb45[0x1])[_0xb9a6('0x5d')](_0xb9a6('0x5e'))};_0x277c04['where']=_[_0xb9a6('0x3f')](_0x277c04[_0xb9a6('0x3c')],_0x5f060e);}_0x277c04=_[_0xb9a6('0x3f')]({},_0x277c04,_0x4d800a[_0xb9a6('0x41')]);return _0x626b6f[_0xb9a6('0x5a')](_0x277c04);}})[_0xb9a6('0x27')](function(_0x44fa30){if(_0x44fa30){_0x2655d1=_0x44fa30[_0xb9a6('0x39')];if(!_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x57')](_0xb9a6('0x5f'))){_0x277c04[_0xb9a6('0x21')]=qs['limit'](_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x21')]);_0x277c04[_0xb9a6('0x1f')]=qs[_0xb9a6('0x1f')](_0x4d800a[_0xb9a6('0x34')][_0xb9a6('0x1f')]);}return _0x626b6f[_0xb9a6('0x5a')](_0x277c04);}})['then'](function(_0x256550){if(_0x256550){return _0x256550?{'count':_0x2655d1,'rows':_0x256550}:null;}})[_0xb9a6('0x27')](respondWithResult(_0x2fd118,null))[_0xb9a6('0x47')](handleError(_0x2fd118,null));}; \ No newline at end of file +var _0xb258=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatGroup','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','getUnread','user','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','getMessages','findOne','ChatInternalMessage','$gte','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','status','end','error','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xb258,0x8f));var _0x8b25=function(_0x1e0028,_0x5ebb70){_0x1e0028=_0x1e0028-0x0;var _0x5d3550=_0xb258[_0x1e0028];return _0x5d3550;};'use strict';var emlformat=require(_0x8b25('0x0'));var rimraf=require(_0x8b25('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b25('0x2'));var rp=require(_0x8b25('0x3'));var moment=require(_0x8b25('0x4'));var BPromise=require(_0x8b25('0x5'));var Mustache=require(_0x8b25('0x6'));var util=require(_0x8b25('0x7'));var path=require(_0x8b25('0x8'));var sox=require(_0x8b25('0x9'));var csv=require(_0x8b25('0xa'));var ejs=require(_0x8b25('0xb'));var fs=require('fs');var fs_extra=require(_0x8b25('0xc'));var _=require(_0x8b25('0xd'));var squel=require(_0x8b25('0xe'));var crypto=require(_0x8b25('0xf'));var jsforce=require(_0x8b25('0x10'));var deskjs=require(_0x8b25('0x11'));var toCsv=require(_0x8b25('0xa'));var querystring=require(_0x8b25('0x12'));var Papa=require(_0x8b25('0x13'));var Redis=require(_0x8b25('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8b25('0x15'));var as=require(_0x8b25('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b25('0x17'))('api');var utils=require(_0x8b25('0x18'));var config=require(_0x8b25('0x19'));var licenseUtil=require(_0x8b25('0x1a'));var db=require(_0x8b25('0x1b'))['db'];config[_0x8b25('0x1c')]=_[_0x8b25('0x1d')](config['redis'],{'host':_0x8b25('0x1e'),'port':0x18eb});var socket=require(_0x8b25('0x1f'))(new Redis(config['redis']));require(_0x8b25('0x20'))[_0x8b25('0x21')](socket);function respondWithStatusCode(_0x536bfc,_0x50b4c6){_0x50b4c6=_0x50b4c6||0xcc;return function(_0x118e5b){if(_0x118e5b){return _0x536bfc[_0x8b25('0x22')](_0x50b4c6);}return _0x536bfc['status'](_0x50b4c6)['end']();};}function respondWithResult(_0x181aad,_0x1c74bc){_0x1c74bc=_0x1c74bc||0xc8;return function(_0x25dc52){if(_0x25dc52){return _0x181aad['status'](_0x1c74bc)[_0x8b25('0x23')](_0x25dc52);}};}function respondWithFilteredResult(_0x228749,_0x2afb16){return function(_0x160454){if(_0x160454){var _0x33b731=typeof _0x2afb16[_0x8b25('0x24')]==='undefined'&&typeof _0x2afb16[_0x8b25('0x25')]===_0x8b25('0x26');var _0x45a2f8=_0x160454[_0x8b25('0x27')];var _0x54ae03=_0x33b731?0x0:_0x2afb16[_0x8b25('0x24')];var _0x5220e8=_0x33b731?_0x160454[_0x8b25('0x27')]:_0x2afb16[_0x8b25('0x24')]+_0x2afb16[_0x8b25('0x25')];var _0x324280;if(_0x5220e8>=_0x45a2f8){_0x5220e8=_0x45a2f8;_0x324280=0xc8;}else{_0x324280=0xce;}_0x228749['status'](_0x324280);return _0x228749[_0x8b25('0x28')](_0x8b25('0x29'),_0x54ae03+'-'+_0x5220e8+'/'+_0x45a2f8)[_0x8b25('0x23')](_0x160454);}return null;};}function patchUpdates(_0x33a38b){return function(_0x3931ab){try{jsonpatch['apply'](_0x3931ab,_0x33a38b,!![]);}catch(_0x19188e){return BPromise[_0x8b25('0x2a')](_0x19188e);}return _0x3931ab[_0x8b25('0x2b')]();};}function saveUpdates(_0x558f49,_0x3acb0c){return function(_0x1ce578){if(_0x1ce578){return _0x1ce578['update'](_0x558f49)[_0x8b25('0x2c')](function(_0x1e2ef9){return _0x1e2ef9;});}return null;};}function removeEntity(_0x926a72,_0x3673aa){return function(_0x257394){if(_0x257394){return _0x257394['destroy']()[_0x8b25('0x2c')](function(){_0x926a72[_0x8b25('0x2d')](0xcc)[_0x8b25('0x2e')]();});}};}function handleEntityNotFound(_0x30b88b,_0x2fa1f8){return function(_0x4aff86){if(!_0x4aff86){_0x30b88b[_0x8b25('0x22')](0x194);}return _0x4aff86;};}function handleError(_0x262ad9,_0x236fb1){_0x236fb1=_0x236fb1||0x1f4;return function(_0x47843c){logger[_0x8b25('0x2f')](_0x47843c[_0x8b25('0x30')]);if(_0x47843c[_0x8b25('0x31')]){delete _0x47843c[_0x8b25('0x31')];}_0x262ad9[_0x8b25('0x2d')](_0x236fb1)['send'](_0x47843c);};}exports[_0x8b25('0x32')]=function(_0x43fbdf,_0x3eb107){var _0x160a4f={},_0x22b5be={},_0x5e1d4b={'count':0x0,'rows':[]};var _0x28edfc=_[_0x8b25('0x33')](db['ChatGroup'][_0x8b25('0x34')],function(_0x4ea6fa){return{'name':_0x4ea6fa[_0x8b25('0x35')],'type':_0x4ea6fa[_0x8b25('0x36')][_0x8b25('0x37')]};});_0x22b5be[_0x8b25('0x38')]=_['map'](_0x28edfc,_0x8b25('0x31'));_0x22b5be['query']=_[_0x8b25('0x39')](_0x43fbdf[_0x8b25('0x3a')]);_0x22b5be[_0x8b25('0x3b')]=_[_0x8b25('0x3c')](_0x22b5be['model'],_0x22b5be[_0x8b25('0x3a')]);_0x160a4f[_0x8b25('0x3d')]=_['intersection'](_0x22b5be[_0x8b25('0x38')],qs[_0x8b25('0x3e')](_0x43fbdf['query'][_0x8b25('0x3e')]));_0x160a4f[_0x8b25('0x3d')]=_0x160a4f[_0x8b25('0x3d')][_0x8b25('0x3f')]?_0x160a4f[_0x8b25('0x3d')]:_0x22b5be['model'];if(!_0x43fbdf['query'][_0x8b25('0x40')](_0x8b25('0x41'))){_0x160a4f[_0x8b25('0x25')]=qs[_0x8b25('0x25')](_0x43fbdf['query'][_0x8b25('0x25')]);_0x160a4f[_0x8b25('0x24')]=qs['offset'](_0x43fbdf[_0x8b25('0x3a')][_0x8b25('0x24')]);}_0x160a4f[_0x8b25('0x42')]=qs[_0x8b25('0x43')](_0x43fbdf['query'][_0x8b25('0x43')]);_0x160a4f[_0x8b25('0x44')]=qs[_0x8b25('0x3b')](_[_0x8b25('0x45')](_0x43fbdf[_0x8b25('0x3a')],_0x22b5be[_0x8b25('0x3b')]),_0x28edfc);if(_0x43fbdf[_0x8b25('0x3a')][_0x8b25('0x46')]){_0x160a4f['where']=_[_0x8b25('0x47')](_0x160a4f[_0x8b25('0x44')],{'$or':_[_0x8b25('0x33')](_0x28edfc,function(_0x17846d){if(_0x17846d['type']!=='VIRTUAL'){var _0xc53e00={};_0xc53e00[_0x17846d[_0x8b25('0x31')]]={'$like':'%'+_0x43fbdf['query']['filter']+'%'};return _0xc53e00;}})});}_0x160a4f=_['merge']({},_0x160a4f,_0x43fbdf[_0x8b25('0x48')]);var _0xe26a57={'where':_0x160a4f['where']};return db[_0x8b25('0x49')]['count'](_0xe26a57)[_0x8b25('0x2c')](function(_0x538f05){_0x5e1d4b[_0x8b25('0x27')]=_0x538f05;if(_0x43fbdf[_0x8b25('0x3a')]['includeAll']){_0x160a4f['include']=[{'all':!![]}];}return db[_0x8b25('0x49')][_0x8b25('0x4a')](_0x160a4f);})[_0x8b25('0x2c')](function(_0x4d7d13){_0x5e1d4b[_0x8b25('0x4b')]=_0x4d7d13;return _0x5e1d4b;})['then'](respondWithFilteredResult(_0x3eb107,_0x160a4f))[_0x8b25('0x4c')](handleError(_0x3eb107,null));};exports[_0x8b25('0x4d')]=function(_0x41cb6b,_0x32f705){var _0x1a94d3={'raw':!![],'where':{'id':_0x41cb6b[_0x8b25('0x4e')]['id']}},_0x4e7ec6={};_0x4e7ec6[_0x8b25('0x38')]=_[_0x8b25('0x39')](db[_0x8b25('0x49')][_0x8b25('0x34')]);_0x4e7ec6[_0x8b25('0x3a')]=_[_0x8b25('0x39')](_0x41cb6b[_0x8b25('0x3a')]);_0x4e7ec6['filters']=_[_0x8b25('0x3c')](_0x4e7ec6[_0x8b25('0x38')],_0x4e7ec6[_0x8b25('0x3a')]);_0x1a94d3[_0x8b25('0x3d')]=_[_0x8b25('0x3c')](_0x4e7ec6['model'],qs[_0x8b25('0x3e')](_0x41cb6b[_0x8b25('0x3a')][_0x8b25('0x3e')]));_0x1a94d3[_0x8b25('0x3d')]=_0x1a94d3[_0x8b25('0x3d')][_0x8b25('0x3f')]?_0x1a94d3[_0x8b25('0x3d')]:_0x4e7ec6[_0x8b25('0x38')];if(_0x41cb6b[_0x8b25('0x3a')]['includeAll']){_0x1a94d3[_0x8b25('0x4f')]=[{'all':!![]}];}_0x1a94d3=_[_0x8b25('0x47')]({},_0x1a94d3,_0x41cb6b['options']);return db[_0x8b25('0x49')][_0x8b25('0x50')](_0x1a94d3)[_0x8b25('0x2c')](handleEntityNotFound(_0x32f705,null))[_0x8b25('0x2c')](respondWithResult(_0x32f705,null))[_0x8b25('0x4c')](handleError(_0x32f705,null));};exports[_0x8b25('0x51')]=function(_0x4955db,_0x190168){return db[_0x8b25('0x49')][_0x8b25('0x51')](_0x4955db[_0x8b25('0x52')],{})['then'](respondWithResult(_0x190168,0xc9))[_0x8b25('0x4c')](handleError(_0x190168,null));};exports['update']=function(_0x359228,_0xa411ae){if(_0x359228[_0x8b25('0x52')]['id']){delete _0x359228['body']['id'];}return db[_0x8b25('0x49')]['find']({'where':{'id':_0x359228['params']['id']}})['then'](handleEntityNotFound(_0xa411ae,null))[_0x8b25('0x2c')](saveUpdates(_0x359228[_0x8b25('0x52')],null))[_0x8b25('0x2c')](respondWithResult(_0xa411ae,null))[_0x8b25('0x4c')](handleError(_0xa411ae,null));};exports[_0x8b25('0x53')]=function(_0xc94208,_0x44ce01){return db[_0x8b25('0x49')][_0x8b25('0x50')]({'where':{'id':_0xc94208[_0x8b25('0x4e')]['id']}})[_0x8b25('0x2c')](handleEntityNotFound(_0x44ce01,null))['then'](removeEntity(_0x44ce01,null))['catch'](handleError(_0x44ce01,null));};exports[_0x8b25('0x54')]=function(_0x387e53,_0x92120){return db[_0x8b25('0x49')][_0x8b25('0x54')]()[_0x8b25('0x2c')](respondWithResult(_0x92120,null))['catch'](handleError(_0x92120,null));};exports[_0x8b25('0x55')]=function(_0x14e55d,_0x145faa,_0x19d1dc){return db['ChatInternalMessage'][_0x8b25('0x27')]({'where':{'ChatGroupId':_0x14e55d[_0x8b25('0x4e')]['id'],'ToId':_0x14e55d[_0x8b25('0x56')]['id'],'read':![]}})[_0x8b25('0x2c')](function(_0x18f8d0){return{'id':_['toInteger'](_0x14e55d[_0x8b25('0x4e')]['id']),'count':_0x18f8d0};})['then'](respondWithResult(_0x145faa,null))[_0x8b25('0x4c')](handleError(_0x145faa,null));};exports[_0x8b25('0x57')]=function(_0x2ddea5,_0x3e8b22,_0x58b167){return db['ChatGroup'][_0x8b25('0x50')]({'where':{'id':_0x2ddea5[_0x8b25('0x4e')]['id']}})[_0x8b25('0x2c')](handleEntityNotFound(_0x3e8b22,null))[_0x8b25('0x2c')](function(_0x1bc34b){if(_0x1bc34b){return _0x1bc34b[_0x8b25('0x57')](_0x2ddea5[_0x8b25('0x52')][_0x8b25('0x58')],_[_0x8b25('0x59')](_0x2ddea5['body'],[_0x8b25('0x58'),'id'])||{});}})[_0x8b25('0x2c')](respondWithResult(_0x3e8b22,null))['catch'](handleError(_0x3e8b22,null));};exports[_0x8b25('0x5a')]=function(_0x3c1934,_0x5e6db4,_0x4ccd57){var _0x258fe4={};var _0x163449={};var _0xd1a6dc;var _0x1aca25;return db[_0x8b25('0x49')]['findOne']({'where':{'id':_0x3c1934[_0x8b25('0x4e')]['id']}})[_0x8b25('0x2c')](handleEntityNotFound(_0x5e6db4,null))[_0x8b25('0x2c')](function(_0x4583fe){if(_0x4583fe){_0xd1a6dc=_0x4583fe;_0x163449['model']=_[_0x8b25('0x39')](db[_0x8b25('0x5b')][_0x8b25('0x34')]);_0x163449['query']=_[_0x8b25('0x39')](_0x3c1934[_0x8b25('0x3a')]);_0x163449[_0x8b25('0x3b')]=_['intersection'](_0x163449[_0x8b25('0x38')],_0x163449['query']);_0x258fe4['attributes']=_[_0x8b25('0x3c')](_0x163449[_0x8b25('0x38')],qs['fields'](_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x3e')]));_0x258fe4['attributes']=_0x258fe4[_0x8b25('0x3d')][_0x8b25('0x3f')]?_0x258fe4['attributes']:_0x163449[_0x8b25('0x38')];_0x258fe4[_0x8b25('0x42')]=qs[_0x8b25('0x43')](_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x43')]);_0x258fe4['where']=qs['filters'](_[_0x8b25('0x45')](_0x3c1934[_0x8b25('0x3a')],_0x163449[_0x8b25('0x3b')]));if(_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x46')]){_0x258fe4[_0x8b25('0x44')]=_[_0x8b25('0x47')](_0x258fe4['where'],{'$or':_['map'](_0x258fe4[_0x8b25('0x3d')],function(_0x296ef0){var _0x53ea6e={};_0x53ea6e[_0x296ef0]={'$like':'%'+_0x3c1934['query'][_0x8b25('0x46')]+'%'};return _0x53ea6e;})});}_0x258fe4=_['merge']({},_0x258fe4,_0x3c1934[_0x8b25('0x48')]);return _0xd1a6dc[_0x8b25('0x5a')](_0x258fe4);}})[_0x8b25('0x2c')](function(_0x36108d){if(_0x36108d){_0x1aca25=_0x36108d[_0x8b25('0x3f')];if(!_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x40')](_0x8b25('0x41'))){_0x258fe4[_0x8b25('0x25')]=qs['limit'](_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x25')]);_0x258fe4[_0x8b25('0x24')]=qs[_0x8b25('0x24')](_0x3c1934[_0x8b25('0x3a')][_0x8b25('0x24')]);}return _0xd1a6dc[_0x8b25('0x5a')](_0x258fe4);}})[_0x8b25('0x2c')](function(_0x14d73a){if(_0x14d73a){return _0x14d73a?{'count':_0x1aca25,'rows':_0x14d73a}:null;}})[_0x8b25('0x2c')](respondWithResult(_0x5e6db4,null))['catch'](handleError(_0x5e6db4,null));};exports[_0x8b25('0x5c')]=function(_0x8ba99c,_0x36ce42,_0x354079){return db[_0x8b25('0x49')]['find']({'where':{'id':_0x8ba99c[_0x8b25('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36ce42,null))['then'](function(_0x48bc61){if(_0x48bc61){return _0x48bc61[_0x8b25('0x5c')](_0x8ba99c[_0x8b25('0x3a')][_0x8b25('0x58')]);}})[_0x8b25('0x2c')](respondWithStatusCode(_0x36ce42,null))[_0x8b25('0x4c')](handleError(_0x36ce42,null));};exports[_0x8b25('0x5d')]=function(_0x5f31a6,_0x1fa500,_0xa3b3e5){if(_0x5f31a6[_0x8b25('0x52')]['id']){delete _0x5f31a6['body']['id'];}return db[_0x8b25('0x49')][_0x8b25('0x50')]({'where':{'id':_0x5f31a6[_0x8b25('0x4e')]['id']}})[_0x8b25('0x2c')](handleEntityNotFound(_0x1fa500,null))[_0x8b25('0x2c')](function(_0x5e4a68){if(_0x5e4a68){_0x5f31a6[_0x8b25('0x52')]['ChatGroupId']=_0x5e4a68['id'];return db['ChatInternalMessage'][_0x8b25('0x51')](_0x5f31a6[_0x8b25('0x52')]);}})['then'](respondWithResult(_0x1fa500,null))['catch'](handleError(_0x1fa500,null));};exports[_0x8b25('0x5e')]=function(_0xd6fa36,_0x1e8034,_0x2058e0){var _0x1fc82={};var _0x53c4d7={};var _0x1d4d74;var _0x24d0dd;return db['ChatGroup'][_0x8b25('0x5f')]({'where':{'id':_0xd6fa36[_0x8b25('0x4e')]['id']}})[_0x8b25('0x2c')](handleEntityNotFound(_0x1e8034,null))[_0x8b25('0x2c')](function(_0x5f5a2a){if(_0x5f5a2a){_0x1d4d74=_0x5f5a2a;_0x53c4d7[_0x8b25('0x38')]=_[_0x8b25('0x39')](db[_0x8b25('0x60')][_0x8b25('0x34')]);_0x53c4d7[_0x8b25('0x3a')]=_['keys'](_0xd6fa36[_0x8b25('0x3a')]);_0x53c4d7['filters']=_[_0x8b25('0x3c')](_0x53c4d7[_0x8b25('0x38')],_0x53c4d7[_0x8b25('0x3a')]);_0x1fc82[_0x8b25('0x3d')]=_[_0x8b25('0x3c')](_0x53c4d7['model'],qs[_0x8b25('0x3e')](_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x3e')]));_0x1fc82[_0x8b25('0x3d')]=_0x1fc82['attributes'][_0x8b25('0x3f')]?_0x1fc82[_0x8b25('0x3d')]:_0x53c4d7[_0x8b25('0x38')];_0x1fc82[_0x8b25('0x42')]=qs['sort'](_0xd6fa36['query'][_0x8b25('0x43')]);_0x1fc82[_0x8b25('0x44')]=qs[_0x8b25('0x3b')](_[_0x8b25('0x45')](_0xd6fa36['query'],_0x53c4d7['filters']));if(_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x46')]){_0x1fc82[_0x8b25('0x44')]=_['merge'](_0x1fc82['where'],{'$or':_[_0x8b25('0x33')](_0x1fc82[_0x8b25('0x3d')],function(_0xe39789){var _0x6099cb={};_0x6099cb[_0xe39789]={'$like':'%'+_0xd6fa36[_0x8b25('0x3a')]['filter']+'%'};return _0x6099cb;})});}if(_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x61')]){var _0x173f89=_0xd6fa36['query'][_0x8b25('0x61')]['split'](',');var _0x1dff52={};_0x1dff52[_0x173f89[0x0]]={'$gte':moment(_0x173f89[0x1])[_0x8b25('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1fc82[_0x8b25('0x44')]=_['merge'](_0x1fc82['where'],_0x1dff52);}_0x1fc82=_[_0x8b25('0x47')]({},_0x1fc82,_0xd6fa36['options']);return _0x1d4d74['getMessages'](_0x1fc82);}})[_0x8b25('0x2c')](function(_0xec41){if(_0xec41){_0x24d0dd=_0xec41[_0x8b25('0x3f')];if(!_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x40')](_0x8b25('0x41'))){_0x1fc82[_0x8b25('0x25')]=qs[_0x8b25('0x25')](_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x25')]);_0x1fc82[_0x8b25('0x24')]=qs[_0x8b25('0x24')](_0xd6fa36[_0x8b25('0x3a')][_0x8b25('0x24')]);}return _0x1d4d74[_0x8b25('0x5e')](_0x1fc82);}})[_0x8b25('0x2c')](function(_0x2e1175){if(_0x2e1175){return _0x2e1175?{'count':_0x24d0dd,'rows':_0x2e1175}:null;}})['then'](respondWithResult(_0x1e8034,null))[_0x8b25('0x4c')](handleError(_0x1e8034,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index df30df9..0d00b47 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 _0x4a6d=['hook','exports','../../mysqldb','save','update','remove','hasOwnProperty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4a6d,0x121));var _0xd4a6=function(_0x544b49,_0x2b9936){_0x544b49=_0x544b49-0x0;var _0x1acfbe=_0x4a6d[_0x544b49];return _0x1acfbe;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xd4a6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4a6('0x1'),'afterUpdate':_0xd4a6('0x2'),'afterDestroy':_0xd4a6('0x3')};function emitEvent(_0x9cfdf){return function(_0x49994a,_0x13fd34,_0x4ec60f){ChatGroupEvents['emit'](_0x9cfdf+':'+_0x49994a['id'],_0x49994a);ChatGroupEvents['emit'](_0x9cfdf,_0x49994a);_0x4ec60f(null);};}for(var e in events){if(events[_0xd4a6('0x4')](e)){var event=events[e];ChatGroup[_0xd4a6('0x5')](e,emitEvent(event));}}module[_0xd4a6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x377e=['save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x512c4c,_0x4bd397){var _0x58c0f1=function(_0x405fad){while(--_0x405fad){_0x512c4c['push'](_0x512c4c['shift']());}};_0x58c0f1(++_0x4bd397);}(_0x377e,0x1e9));var _0xe377=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x377e[_0x513119];return _0x587511;};'use strict';var EventEmitter=require(_0xe377('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe377('0x1'),'afterUpdate':_0xe377('0x2'),'afterDestroy':_0xe377('0x3')};function emitEvent(_0x59fce9){return function(_0x206b97,_0x314609,_0x33b8dc){ChatGroupEvents[_0xe377('0x4')](_0x59fce9+':'+_0x206b97['id'],_0x206b97);ChatGroupEvents[_0xe377('0x4')](_0x59fce9,_0x206b97);_0x33b8dc(null);};}for(var e in events){if(events[_0xe377('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xe377('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 501c13b..c32921e 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 _0x717b=['bluebird','request-promise','path','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','api','moment'];(function(_0x345f5e,_0x1d08fd){var _0x3365e8=function(_0x2bae93){while(--_0x2bae93){_0x345f5e['push'](_0x345f5e['shift']());}};_0x3365e8(++_0x1d08fd);}(_0x717b,0x10f));var _0xb717=function(_0x32ab5a,_0xbee58d){_0x32ab5a=_0x32ab5a-0x0;var _0x72521e=_0x717b[_0x32ab5a];return _0x72521e;};'use strict';var _=require('lodash');var util=require(_0xb717('0x0'));var logger=require(_0xb717('0x1'))(_0xb717('0x2'));var moment=require(_0xb717('0x3'));var BPromise=require(_0xb717('0x4'));var rp=require(_0xb717('0x5'));var fs=require('fs');var path=require(_0xb717('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb717('0x7'));module['exports']=function(_0x195efa,_0x281bf9){return _0x195efa[_0xb717('0x8')](_0xb717('0x9'),attributes,{'tableName':_0xb717('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x605f=['exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatGroup.attributes'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x605f,0x15f));var _0xf605=function(_0x140b7b,_0x239249){_0x140b7b=_0x140b7b-0x0;var _0x44745b=_0x605f[_0x140b7b];return _0x44745b;};'use strict';var _=require(_0xf605('0x0'));var util=require(_0xf605('0x1'));var logger=require(_0xf605('0x2'))(_0xf605('0x3'));var moment=require(_0xf605('0x4'));var BPromise=require(_0xf605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf605('0x6'));var rimraf=require('rimraf');var config=require(_0xf605('0x7'));var attributes=require(_0xf605('0x8'));module[_0xf605('0x9')]=function(_0x106096,_0x228730){return _0x106096[_0xf605('0xa')]('ChatGroup',attributes,{'tableName':_0xf605('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 62ff6bb..e2d7e9e 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 _0xd9d9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','util'];(function(_0x256d6a,_0x135ba7){var _0x595e03=function(_0x23cc3d){while(--_0x23cc3d){_0x256d6a['push'](_0x256d6a['shift']());}};_0x595e03(++_0x135ba7);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x2262f5,_0x5a409f){_0x2262f5=_0x2262f5-0x0;var _0x25fc8c=_0xd9d9[_0x2262f5];return _0x25fc8c;};'use strict';var _=require('lodash');var util=require(_0x9d9d('0x0'));var moment=require(_0x9d9d('0x1'));var BPromise=require(_0x9d9d('0x2'));var rs=require(_0x9d9d('0x3'));var fs=require('fs');var Redis=require(_0x9d9d('0x4'));var db=require(_0x9d9d('0x5'))['db'];var utils=require(_0x9d9d('0x6'));var logger=require(_0x9d9d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d9d('0x8'));var client=jayson['client'][_0x9d9d('0x9')]({'port':0x232a});config['redis']=_[_0x9d9d('0xa')](config[_0x9d9d('0xb')],{'host':_0x9d9d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d9d('0xb')]));require(_0x9d9d('0xd'))[_0x9d9d('0xe')](socket);function respondWithRpcPromise(_0x51b244,_0x53b543,_0x39c9e1){return new BPromise(function(_0x72ed8b,_0xc3674c){return client['request'](_0x51b244,_0x39c9e1)[_0x9d9d('0xf')](function(_0x57d6e7){logger[_0x9d9d('0x10')](_0x9d9d('0x11'),_0x53b543,'request\x20sent');logger[_0x9d9d('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x53b543,'request\x20sent',JSON[_0x9d9d('0x13')](_0x57d6e7));if(_0x57d6e7[_0x9d9d('0x14')]){if(_0x57d6e7['error'][_0x9d9d('0x15')]===0x1f4){logger[_0x9d9d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x53b543,_0x57d6e7['error'][_0x9d9d('0x16')]);return _0xc3674c(_0x57d6e7['error']['message']);}logger['error'](_0x9d9d('0x11'),_0x53b543,_0x57d6e7['error'][_0x9d9d('0x16')]);return _0x72ed8b(_0x57d6e7[_0x9d9d('0x14')][_0x9d9d('0x16')]);}else{logger[_0x9d9d('0x10')]('ChatGroup,\x20%s,\x20%s',_0x53b543,_0x9d9d('0x17'));_0x72ed8b(_0x57d6e7[_0x9d9d('0x18')][_0x9d9d('0x16')]);}})[_0x9d9d('0x19')](function(_0x472e14){logger['error'](_0x9d9d('0x11'),_0x53b543,_0x472e14);_0xc3674c(_0x472e14);});});} \ No newline at end of file +var _0x303a=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x40dc52,_0x3e5bfe){var _0x4069de=function(_0x2390e6){while(--_0x2390e6){_0x40dc52['push'](_0x40dc52['shift']());}};_0x4069de(++_0x3e5bfe);}(_0x303a,0x1a0));var _0xa303=function(_0x3d6bd3,_0x1ea55d){_0x3d6bd3=_0x3d6bd3-0x0;var _0x106abe=_0x303a[_0x3d6bd3];return _0x106abe;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var moment=require(_0xa303('0x1'));var BPromise=require(_0xa303('0x2'));var rs=require(_0xa303('0x3'));var fs=require('fs');var Redis=require(_0xa303('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa303('0x5'));var logger=require(_0xa303('0x6'))(_0xa303('0x7'));var config=require(_0xa303('0x8'));var jayson=require(_0xa303('0x9'));var client=jayson[_0xa303('0xa')][_0xa303('0xb')]({'port':0x232a});config[_0xa303('0xc')]=_[_0xa303('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa303('0xc')]));require(_0xa303('0xe'))['register'](socket);function respondWithRpcPromise(_0x3313d0,_0x51acca,_0x1e7281){return new BPromise(function(_0x59f18a,_0x29cd60){return client[_0xa303('0xf')](_0x3313d0,_0x1e7281)[_0xa303('0x10')](function(_0x3a8467){logger['info'](_0xa303('0x11'),_0x51acca,'request\x20sent');logger[_0xa303('0x12')](_0xa303('0x13'),_0x51acca,_0xa303('0x14'),JSON['stringify'](_0x3a8467));if(_0x3a8467[_0xa303('0x15')]){if(_0x3a8467[_0xa303('0x15')][_0xa303('0x16')]===0x1f4){logger[_0xa303('0x15')](_0xa303('0x11'),_0x51acca,_0x3a8467[_0xa303('0x15')][_0xa303('0x17')]);return _0x29cd60(_0x3a8467[_0xa303('0x15')]['message']);}logger[_0xa303('0x15')](_0xa303('0x11'),_0x51acca,_0x3a8467[_0xa303('0x15')][_0xa303('0x17')]);return _0x59f18a(_0x3a8467[_0xa303('0x15')][_0xa303('0x17')]);}else{logger['info'](_0xa303('0x11'),_0x51acca,'request\x20sent');_0x59f18a(_0x3a8467[_0xa303('0x18')]['message']);}})[_0xa303('0x19')](function(_0x5ac3ec){logger[_0xa303('0x15')](_0xa303('0x11'),_0x51acca,_0x5ac3ec);_0x29cd60(_0x5ac3ec);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d0e7532..1a4e851 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 _0xf8a2=['save','remove','update','emit','removeListener','register','length','chatGroup:','./chatGroup.events'];(function(_0x5a11be,_0x45c909){var _0x1a591b=function(_0x24dc45){while(--_0x24dc45){_0x5a11be['push'](_0x5a11be['shift']());}};_0x1a591b(++_0x45c909);}(_0xf8a2,0x194));var _0x2f8a=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0xf8a2[_0x285800];return _0x4b809e;};'use strict';var ChatGroupEvents=require(_0x2f8a('0x0'));var events=[_0x2f8a('0x1'),_0x2f8a('0x2'),_0x2f8a('0x3')];function createListener(_0xbddbb5,_0x2aedc9){return function(_0xf97fa1){_0x2aedc9[_0x2f8a('0x4')](_0xbddbb5,_0xf97fa1);};}function removeListener(_0x5c7777,_0x1a06f9){return function(){ChatGroupEvents[_0x2f8a('0x5')](_0x5c7777,_0x1a06f9);};}exports[_0x2f8a('0x6')]=function(_0x80511){for(var _0x46f497=0x0,_0x12a431=events[_0x2f8a('0x7')];_0x46f497<_0x12a431;_0x46f497++){var _0x2207cf=events[_0x46f497];var _0xc31f05=createListener(_0x2f8a('0x8')+_0x2207cf,_0x80511);ChatGroupEvents['on'](_0x2207cf,_0xc31f05);}}; \ No newline at end of file +var _0x4bc0=['update','emit','removeListener','register','length','chatGroup:','save'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x4bc0,0x12c));var _0x04bc=function(_0x4098f1,_0x1625d2){_0x4098f1=_0x4098f1-0x0;var _0x2daf62=_0x4bc0[_0x4098f1];return _0x2daf62;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x04bc('0x0'),'remove',_0x04bc('0x1')];function createListener(_0x1feeb,_0x3adb4d){return function(_0x1c235f){_0x3adb4d[_0x04bc('0x2')](_0x1feeb,_0x1c235f);};}function removeListener(_0x310e3e,_0x3d505a){return function(){ChatGroupEvents[_0x04bc('0x3')](_0x310e3e,_0x3d505a);};}exports[_0x04bc('0x4')]=function(_0x3a850f){for(var _0x4c748e=0x0,_0x2ceaeb=events[_0x04bc('0x5')];_0x4c748e<_0x2ceaeb;_0x4c748e++){var _0x4a60b7=events[_0x4c748e];var _0x30bd1b=createListener(_0x04bc('0x6')+_0x4a60b7,_0x3a850f);ChatGroupEvents['on'](_0x4a60b7,_0x30bd1b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e026fa2..55b8964 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 _0x3bcb=['/:id/messages','post','create','addMessage','put','delete','destroy','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/unread','getUnread','/:id/members'];(function(_0x1b39e,_0x69e3c7){var _0x325420=function(_0x496de5){while(--_0x496de5){_0x1b39e['push'](_0x1b39e['shift']());}};_0x325420(++_0x69e3c7);}(_0x3bcb,0x75));var _0xb3bc=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0x3bcb[_0x2e68db];return _0x12df4c;};'use strict';var multer=require(_0xb3bc('0x0'));var util=require(_0xb3bc('0x1'));var path=require(_0xb3bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3bc('0x3'));var router=express[_0xb3bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3bc('0x5'));var interaction=require(_0xb3bc('0x6'));var config=require(_0xb3bc('0x7'));var controller=require('./chatGroup.controller');router[_0xb3bc('0x8')]('/',auth['isAuthenticated'](),controller[_0xb3bc('0x9')]);router[_0xb3bc('0x8')](_0xb3bc('0xa'),auth['isAuthenticated'](),controller[_0xb3bc('0xb')]);router[_0xb3bc('0x8')](_0xb3bc('0xc'),auth[_0xb3bc('0xd')](),controller[_0xb3bc('0xe')]);router['get'](_0xb3bc('0xf'),auth['isAuthenticated'](),controller[_0xb3bc('0x10')]);router['get'](_0xb3bc('0x11'),auth[_0xb3bc('0xd')](),controller['getMembers']);router[_0xb3bc('0x8')](_0xb3bc('0x12'),auth[_0xb3bc('0xd')](),controller['getMessages']);router[_0xb3bc('0x13')]('/',auth[_0xb3bc('0xd')](),controller[_0xb3bc('0x14')]);router[_0xb3bc('0x13')](_0xb3bc('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0xb3bc('0x13')](_0xb3bc('0x12'),auth[_0xb3bc('0xd')](),controller[_0xb3bc('0x15')]);router[_0xb3bc('0x16')](_0xb3bc('0xc'),auth[_0xb3bc('0xd')](),controller['update']);router[_0xb3bc('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xb3bc('0x18')]);router['delete'](_0xb3bc('0x11'),auth[_0xb3bc('0xd')](),controller[_0xb3bc('0x19')]);module[_0xb3bc('0x1a')]=router; \ No newline at end of file +var _0x7744=['destroy','removeMembers','exports','multer','path','express','../../components/auth/service','../../config/environment','./chatGroup.controller','get','index','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7744,0x1df));var _0x4774=function(_0x56fbaa,_0x3bc5a6){_0x56fbaa=_0x56fbaa-0x0;var _0x49fbc1=_0x7744[_0x56fbaa];return _0x49fbc1;};'use strict';var multer=require(_0x4774('0x0'));var util=require('util');var path=require(_0x4774('0x1'));var timeout=require('connect-timeout');var express=require(_0x4774('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4774('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4774('0x4'));var controller=require(_0x4774('0x5'));router[_0x4774('0x6')]('/',auth['isAuthenticated'](),controller[_0x4774('0x7')]);router[_0x4774('0x6')]('/describe',auth[_0x4774('0x8')](),controller[_0x4774('0x9')]);router[_0x4774('0x6')](_0x4774('0xa'),auth[_0x4774('0x8')](),controller[_0x4774('0xb')]);router[_0x4774('0x6')](_0x4774('0xc'),auth['isAuthenticated'](),controller[_0x4774('0xd')]);router[_0x4774('0x6')](_0x4774('0xe'),auth[_0x4774('0x8')](),controller[_0x4774('0xf')]);router['get'](_0x4774('0x10'),auth['isAuthenticated'](),controller[_0x4774('0x11')]);router[_0x4774('0x12')]('/',auth[_0x4774('0x8')](),controller[_0x4774('0x13')]);router[_0x4774('0x12')](_0x4774('0xe'),auth[_0x4774('0x8')](),controller[_0x4774('0x14')]);router['post'](_0x4774('0x10'),auth[_0x4774('0x8')](),controller[_0x4774('0x15')]);router[_0x4774('0x16')](_0x4774('0xa'),auth[_0x4774('0x8')](),controller[_0x4774('0x17')]);router[_0x4774('0x18')](_0x4774('0xa'),auth[_0x4774('0x8')](),controller[_0x4774('0x19')]);router[_0x4774('0x18')](_0x4774('0xe'),auth[_0x4774('0x8')](),controller[_0x4774('0x1a')]);module[_0x4774('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 18f2b80..4a182e5 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 _0x9d59=['INTEGER','ENUM','star','TEXT','DATE','STRING','long','out','sequelize','exports','BOOLEAN'];(function(_0x4c6dec,_0x17b82c){var _0x1a0c58=function(_0x15b10b){while(--_0x15b10b){_0x4c6dec['push'](_0x4c6dec['shift']());}};_0x1a0c58(++_0x17b82c);}(_0x9d59,0x152));var _0x99d5=function(_0x26abb4,_0x2c71cb){_0x26abb4=_0x26abb4-0x0;var _0x33ea8c=_0x9d59[_0x26abb4];return _0x33ea8c;};'use strict';var Sequelize=require(_0x99d5('0x0'));module[_0x99d5('0x1')]={'closed':{'type':Sequelize[_0x99d5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x99d5('0x3')]},'ratingType':{'type':Sequelize[_0x99d5('0x4')](_0x99d5('0x5'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x99d5('0x6')]},'pathTranscript':{'type':Sequelize[_0x99d5('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x99d5('0x7')]},'disposition':{'type':Sequelize[_0x99d5('0x8')]},'secondDisposition':{'type':Sequelize[_0x99d5('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x99d5('0x8')]},'browserName':{'type':Sequelize[_0x99d5('0x8')]},'browserVersion':{'type':Sequelize[_0x99d5('0x8')]},'osName':{'type':Sequelize[_0x99d5('0x8')]},'osVersion':{'type':Sequelize[_0x99d5('0x8')]},'deviceModel':{'type':Sequelize[_0x99d5('0x8')]},'deviceVendor':{'type':Sequelize[_0x99d5('0x8')]},'deviceType':{'type':Sequelize[_0x99d5('0x8')]},'referer':{'type':Sequelize[_0x99d5('0x6')]},'customerIp':{'type':Sequelize[_0x99d5('0x8')]},'formData':{'type':Sequelize['TEXT'](_0x99d5('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x99d5('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x99d5('0x4')]('in',_0x99d5('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x99d5('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x99d5('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x99d5('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6028=['thumb','TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star'];(function(_0x2eca99,_0x4d574d){var _0x535a09=function(_0x2548c0){while(--_0x2548c0){_0x2eca99['push'](_0x2eca99['shift']());}};_0x535a09(++_0x4d574d);}(_0x6028,0xa2));var _0x8602=function(_0x48a57f,_0x1db6d7){_0x48a57f=_0x48a57f-0x0;var _0x548db2=_0x6028[_0x48a57f];return _0x548db2;};'use strict';var Sequelize=require(_0x8602('0x0'));module[_0x8602('0x1')]={'closed':{'type':Sequelize[_0x8602('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8602('0x3')]},'ratingType':{'type':Sequelize[_0x8602('0x4')](_0x8602('0x5'),_0x8602('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8602('0x7')]},'pathTranscript':{'type':Sequelize[_0x8602('0x7')]},'mailTranscript':{'type':Sequelize[_0x8602('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8602('0x8')]},'secondDisposition':{'type':Sequelize[_0x8602('0x8')]},'thirdDisposition':{'type':Sequelize[_0x8602('0x8')]},'note':{'type':Sequelize[_0x8602('0x8')]},'browserName':{'type':Sequelize[_0x8602('0x8')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8602('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8602('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8602('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x8602('0x8')]},'formData':{'type':Sequelize[_0x8602('0x7')](_0x8602('0x9'))},'read1stAt':{'type':Sequelize[_0x8602('0xa')]},'lastMsgAt':{'type':Sequelize[_0x8602('0xa')]},'lastMsgDirection':{'type':Sequelize[_0x8602('0x4')]('in',_0x8602('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8602('0x8')]},'customerPort':{'type':Sequelize[_0x8602('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x8602('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 26307d2..b415892 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 _0x235d=['customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','transcript-','Chat','createPdfFromHTML','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','body','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','findAll','user','params','model','query','keys','filters','fields','attributes','includeAll','include','options','create','update','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooApiKey','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','basename','Attachment','attachmentDownload','json','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','User','ContactId','Messages','length','%s%d','agentAlias','System','agentIdentifier','website_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','includeAgent','push','addTags','setTags','spread','Tag','color','emit','removeTags','download','toString','server','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','mkdirSync','Owner','N.A.','closedAt','browserName','osName','referer','customerIp'];(function(_0x16d7a5,_0x5ac143){var _0x331be5=function(_0x44a341){while(--_0x44a341){_0x16d7a5['push'](_0x16d7a5['shift']());}};_0x331be5(++_0x5ac143);}(_0x235d,0xdb));var _0xd235=function(_0x354fc5,_0x533fd4){_0x354fc5=_0x354fc5-0x0;var _0x2c24aa=_0x235d[_0x354fc5];return _0x2c24aa;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd235('0x0'));var rp=require(_0xd235('0x1'));var moment=require(_0xd235('0x2'));var BPromise=require(_0xd235('0x3'));var Mustache=require(_0xd235('0x4'));var util=require(_0xd235('0x5'));var path=require(_0xd235('0x6'));var ejs=require(_0xd235('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xd235('0x8'));var qs=require(_0xd235('0x9'));var pdf=require(_0xd235('0xa'));var logger=require(_0xd235('0xb'))(_0xd235('0xc'));var config=require(_0xd235('0xd'));var db=require(_0xd235('0xe'))['db'];config['redis']=_['defaults'](config[_0xd235('0xf')],{'host':_0xd235('0x10'),'port':0x18eb});var socket=require(_0xd235('0x11'))(new Redis(config['redis']));require(_0xd235('0x12'))['register'](socket);var jayson=require(_0xd235('0x13'));var client=jayson[_0xd235('0x14')][_0xd235('0x15')]({'port':0x232b});var client9004=jayson[_0xd235('0x14')][_0xd235('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x148acc,_0x2ffe2b,_0x344dea,_0x398eb7){return new BPromise(function(_0x4d3b59,_0x18c7d3){var _0x35c81e=_0x398eb7||client;return _0x35c81e['request'](_0x148acc,_0x344dea)[_0xd235('0x16')](function(_0x3083da){logger['info'](_0xd235('0x17'),_0x2ffe2b,_0xd235('0x18'));logger[_0xd235('0x19')](_0xd235('0x1a'),_0x2ffe2b,_0xd235('0x18'),JSON[_0xd235('0x1b')](_0x3083da));if(_0x3083da['error']){if(_0x3083da[_0xd235('0x1c')]['code']===0x1f4){logger[_0xd235('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x2ffe2b,_0x3083da[_0xd235('0x1c')][_0xd235('0x1d')]);return _0x18c7d3(_0x3083da[_0xd235('0x1c')][_0xd235('0x1d')]);}logger[_0xd235('0x1c')](_0xd235('0x17'),_0x2ffe2b,_0x3083da[_0xd235('0x1c')][_0xd235('0x1d')]);return _0x4d3b59(_0x3083da[_0xd235('0x1c')]['message']);}else{logger[_0xd235('0x1e')](_0xd235('0x17'),_0x2ffe2b,_0xd235('0x18'));_0x4d3b59(_0x3083da[_0xd235('0x1f')]['message']);}})[_0xd235('0x20')](function(_0x2c9ab0){logger[_0xd235('0x1c')](_0xd235('0x17'),_0x2ffe2b,_0x2c9ab0);_0x18c7d3(_0x2c9ab0);});});}function respondWithStatusCode(_0x59ad94,_0x20dbd8){_0x20dbd8=_0x20dbd8||0xcc;return function(_0x481b19){if(_0x481b19){return _0x59ad94[_0xd235('0x21')](_0x20dbd8);}return _0x59ad94['status'](_0x20dbd8)[_0xd235('0x22')]();};}function respondWithResult(_0x16e80e,_0x509a60){_0x509a60=_0x509a60||0xc8;return function(_0x4e14ad){if(_0x4e14ad){return _0x16e80e[_0xd235('0x23')](_0x509a60)['json'](_0x4e14ad);}};}function respondWithFilteredResult(_0x5a1d0c,_0x5d8dbf){return function(_0x1c39e3){if(_0x1c39e3){var _0x20b68f=typeof _0x5d8dbf[_0xd235('0x24')]===_0xd235('0x25')&&typeof _0x5d8dbf[_0xd235('0x26')]===_0xd235('0x25');var _0x2692d0=_0x1c39e3['count'];var _0x18ad4c=_0x20b68f?0x0:_0x5d8dbf['offset'];var _0x2a2d26=_0x20b68f?_0x1c39e3[_0xd235('0x27')]:_0x5d8dbf[_0xd235('0x24')]+_0x5d8dbf[_0xd235('0x26')];var _0x1bd6d9;if(_0x2a2d26>=_0x2692d0){_0x2a2d26=_0x2692d0;_0x1bd6d9=0xc8;}else{_0x1bd6d9=0xce;}_0x5a1d0c['status'](_0x1bd6d9);return _0x5a1d0c[_0xd235('0x28')](_0xd235('0x29'),_0x18ad4c+'-'+_0x2a2d26+'/'+_0x2692d0)['json'](_0x1c39e3);}return null;};}function saveUpdates(_0xdc847b){return function(_0x4de69f){if(_0x4de69f){return _0x4de69f['update'](_0xdc847b)['then'](function(_0x3956ac){return _0x3956ac;});}return null;};}function removeEntity(_0x2a2d82){return function(_0x1864c5){if(_0x1864c5){return _0x1864c5[_0xd235('0x2a')]()['then'](function(){_0x2a2d82[_0xd235('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xebb26d){return function(_0x3e77fc){if(!_0x3e77fc){_0xebb26d[_0xd235('0x21')](0x194);}return _0x3e77fc;};}function handleError(_0x21ba4d,_0x46c3e7){_0x46c3e7=_0x46c3e7||0x1f4;return function(_0x4c21ae){logger[_0xd235('0x1c')](_0x4c21ae[_0xd235('0x2b')]);if(_0x4c21ae[_0xd235('0x2c')]){delete _0x4c21ae[_0xd235('0x2c')];}_0x21ba4d[_0xd235('0x23')](_0x46c3e7)[_0xd235('0x2d')](_0x4c21ae);};}function getMustacheRender(_0x5ab2ee,_0x3e7c86){return Mustache[_0xd235('0x2e')](_0x5ab2ee,_[_0xd235('0x2f')](_0x3e7c86[_0xd235('0x30')],{'contact':_0x3e7c86['contact'],'message':_0x3e7c86[_0xd235('0x1d')],'agent':_0x3e7c86['agent'],'interaction':_0x3e7c86[_0xd235('0x31')],'account':_0x3e7c86[_0xd235('0x32')]}))||'';}exports[_0xd235('0x33')]=function(_0x3510c8,_0x12b655){var _0x4aebc1={};var _0x3b855e=_[_0xd235('0x34')](db[_0xd235('0x35')][_0xd235('0x36')],function(_0x139dce){return{'name':_0x139dce['fieldName'],'type':_0x139dce[_0xd235('0x37')][_0xd235('0x38')]};});_0x4aebc1=qs[_0xd235('0x39')](_0x3b855e,_0x3510c8);return interaction[_0xd235('0x3a')]('chat',_0x3510c8['query'],_0x3510c8[_0xd235('0x3b')],_0x4aebc1,_0x3b855e)[_0xd235('0x16')](respondWithFilteredResult(_0x12b655,_0x4aebc1))[_0xd235('0x20')](handleError(_0x12b655,null));};exports['show']=function(_0x5b1b07,_0x297280){var _0x22456e={'raw':![],'where':{'id':_0x5b1b07[_0xd235('0x3c')]['id']}},_0x381a58={};_0x381a58[_0xd235('0x3d')]=_['keys'](db['ChatInteraction'][_0xd235('0x36')]);_0x381a58[_0xd235('0x3e')]=_[_0xd235('0x3f')](_0x5b1b07[_0xd235('0x3e')]);_0x381a58[_0xd235('0x40')]=_['intersection'](_0x381a58['model'],_0x381a58[_0xd235('0x3e')]);_0x22456e['attributes']=_['intersection'](_0x381a58[_0xd235('0x3d')],qs[_0xd235('0x41')](_0x5b1b07[_0xd235('0x3e')][_0xd235('0x41')]));_0x22456e['attributes']=_0x22456e[_0xd235('0x42')]['length']?_0x22456e[_0xd235('0x42')]:_0x381a58[_0xd235('0x3d')];if(_0x5b1b07['query'][_0xd235('0x43')]){_0x22456e[_0xd235('0x44')]=[{'all':!![]}];}_0x22456e=_['merge']({},_0x22456e,_0x5b1b07[_0xd235('0x45')]);return db[_0xd235('0x35')]['find'](_0x22456e)['then'](handleEntityNotFound(_0x297280,null))[_0xd235('0x16')](respondWithResult(_0x297280,null))[_0xd235('0x20')](handleError(_0x297280,null));};exports[_0xd235('0x46')]=function(_0x3873de,_0x40883f){return db[_0xd235('0x35')][_0xd235('0x46')](_0x3873de[_0xd235('0x30')],{})[_0xd235('0x16')](respondWithResult(_0x40883f,0xc9))[_0xd235('0x20')](handleError(_0x40883f,null));};exports[_0xd235('0x47')]=function(_0x3a917f,_0x468e2d){if(_0x3a917f['body']['id']){delete _0x3a917f[_0xd235('0x30')]['id'];}return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x3a917f[_0xd235('0x3c')]['id']}})['then'](handleEntityNotFound(_0x468e2d,null))[_0xd235('0x16')](saveUpdates(_0x3a917f['body'],null))['then'](respondWithResult(_0x468e2d,null))[_0xd235('0x20')](handleError(_0x468e2d,null));};exports['destroy']=function(_0x31c006,_0x4cae9d){return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x31c006['params']['id']}})[_0xd235('0x16')](handleEntityNotFound(_0x4cae9d,null))[_0xd235('0x16')](removeEntity(_0x4cae9d,null))[_0xd235('0x20')](handleError(_0x4cae9d,null));};exports[_0xd235('0x49')]=function(_0xa72ade,_0x280cf4){return db[_0xd235('0x35')][_0xd235('0x49')]()[_0xd235('0x16')](respondWithResult(_0x280cf4,null))[_0xd235('0x20')](handleError(_0x280cf4,null));};exports[_0xd235('0x4a')]=function(_0x56b10f,_0x4c3595){var _0x450dd=_0x56b10f[_0xd235('0x3c')]['id'];var _0x2d58cd;var _0x2d438e;var _0x304623;return db[_0xd235('0x35')][_0xd235('0x4b')]({'where':{'id':_0x450dd}})['then'](function(_0x33c65e){_0x2d58cd=_0x33c65e;return db['ChatWebsite'][_0xd235('0x4b')]({'where':{'id':_0x33c65e[_0xd235('0x4c')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xd235('0x4d'),_0xd235('0x4e'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x420538){if(_0x420538&&_0x420538[_0xd235('0x4f')]&&_0x420538['vidaooEscalation']){_0x2d438e=_0x420538;var _0x8bf8db={'interaction':{'id':_0x450dd},'agent':{'id':_0x56b10f[_0xd235('0x3b')]['id'],'name':_0x56b10f[_0xd235('0x3b')]['name'],'fullname':_0x56b10f[_0xd235('0x3b')][_0xd235('0x50')],'email':_0x56b10f[_0xd235('0x3b')][_0xd235('0x51')]},'contact':_0x56b10f[_0xd235('0x30')][_0xd235('0x52')],'account':_0x56b10f[_0xd235('0x30')]['account']};var _0x33d724={'rejectUnauthorized':![],'method':_0xd235('0x53'),'url':_0xd235('0x54'),'headers':{'X-APIKEY':_0x420538['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x56b10f[_0xd235('0x3b')]['email']],'buttons':null,'topic':_0x2d438e[_0xd235('0x4d')],'note':_[_0xd235('0x55')](_0x2d438e[_0xd235('0x4e')])?null:getMustacheRender(_0x2d438e['vidaooNote'],_0x8bf8db),'metadata':null},'redirect':_0xd235('0x56'),'json':!![]};try{if(!_[_0xd235('0x55')](_0x2d438e[_0xd235('0x57')])){var _0x4b8b46=getMustacheRender(_0x2d438e[_0xd235('0x57')],_0x8bf8db);var _0x2cd793=JSON[_0xd235('0x58')](_0x4b8b46);_0x33d724[_0xd235('0x30')][_0xd235('0x59')]=_0x2cd793;}}catch(_0x585990){throw new db['Sequelize'][(_0xd235('0x5a'))](_0xd235('0x5b'));}return rp(_0x33d724);}else{throw new db[(_0xd235('0x5c'))][(_0xd235('0x5a'))](_0xd235('0x5d'));}})[_0xd235('0x16')](function(_0x21368d){_0x304623=_0x21368d;if(_0x304623['id']){var _0x48a5c8={'body':_0x304623[_0xd235('0x5e')],'ChatWebsiteId':_0x2d438e['id'],'ChatInteractionId':_0x2d58cd['id'],'direction':_0xd235('0x5f'),'UserId':_0x56b10f[_0xd235('0x3b')]['id']};return db[_0xd235('0x60')][_0xd235('0x46')](_0x48a5c8,{});}else{throw new db['Sequelize']['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd235('0x16')](function(){return _0x2d58cd['updateAttributes']({'vidaooSessionId':_0x304623['id']});})[_0xd235('0x16')](respondWithResult(_0x4c3595,null))[_0xd235('0x20')](handleError(_0x4c3595,null));};exports[_0xd235('0x61')]=function(_0x31b5b0,_0x3b7380){if(_0x31b5b0[_0xd235('0x30')]['id']){delete _0x31b5b0[_0xd235('0x30')]['id'];}return db[_0xd235('0x35')]['find']({'where':{'id':_0x31b5b0['params']['id']},'include':[{'model':db[_0xd235('0x62')],'as':_0xd235('0x63')}]})[_0xd235('0x16')](handleEntityNotFound(_0x3b7380,null))[_0xd235('0x16')](saveUpdates(_0x31b5b0['body'],null))['then'](respondWithResult(_0x3b7380,null))[_0xd235('0x20')](handleError(_0x3b7380,null));};exports['abandon']=function(_0x1f3f23,_0x57a9a1){if(_0x1f3f23[_0xd235('0x30')]['id']){delete _0x1f3f23[_0xd235('0x30')]['id'];}return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x1f3f23[_0xd235('0x3c')]['id']}})[_0xd235('0x16')](function(_0x508147){if(!_0x508147){logger[_0xd235('0x1c')](_0xd235('0x64'),_0xd235('0x65'),0x194,'entity\x20not\x20found');_0x57a9a1['sendStatus'](0x194);}else{if(_0x508147[_0xd235('0x66')]){throw new db[(_0xd235('0x5c'))][(_0xd235('0x5a'))](_0xd235('0x67'));}}return _0x508147;})[_0xd235('0x16')](function(_0x51535f){if(_0x51535f){return _0x51535f[_0xd235('0x47')]({'closed':_0x1f3f23[_0xd235('0x30')][_0xd235('0x68')],'disposition':_0x1f3f23[_0xd235('0x30')][_0xd235('0x69')]})[_0xd235('0x16')](function(_0x373957){return _0x373957;});}})[_0xd235('0x16')](function(){return respondWithRpcPromise(_0xd235('0x6a'),_0xd235('0x65'),_0x1f3f23[_0xd235('0x30')],client9004);})[_0xd235('0x16')](respondWithResult(_0x57a9a1,null))[_0xd235('0x20')](handleError(_0x57a9a1,null));};exports[_0xd235('0x6b')]=function(_0x5ced74,_0x3a97e6){_0x5ced74['body'][_0xd235('0x2c')]=_0x5ced74[_0xd235('0x6c')]['originalname'];_0x5ced74[_0xd235('0x30')][_0xd235('0x6d')]=_0x5ced74[_0xd235('0x6c')]['filename'];_0x5ced74[_0xd235('0x30')][_0xd235('0x37')]=_0x5ced74[_0xd235('0x6c')]['mimetype'];return db[_0xd235('0x6e')][_0xd235('0x46')](_0x5ced74[_0xd235('0x30')])[_0xd235('0x16')](respondWithResult(_0x3a97e6,0xc9))[_0xd235('0x20')](handleError(_0x3a97e6,null));};exports[_0xd235('0x6f')]=function(_0x4df9d3,_0x55bf5c){return db[_0xd235('0x35')]['findOne']({'where':{'id':_0x4df9d3[_0xd235('0x3c')]['id']},'raw':!![]})[_0xd235('0x16')](handleEntityNotFound(_0x55bf5c,null))[_0xd235('0x16')](function(_0x31b34c){if(_0x31b34c){if(_0x31b34c[_0xd235('0x68')]){return _0x55bf5c['status'](0x193)[_0xd235('0x70')]({'status':0x193,'message':_0xd235('0x71')});}return db[_0xd235('0x6e')][_0xd235('0x4b')]({'where':{'id':_0x4df9d3[_0xd235('0x3e')][_0xd235('0x72')]},'raw':!![]})[_0xd235('0x16')](handleEntityNotFound(_0x55bf5c,null));}})[_0xd235('0x16')](function(_0x2a3a2f){if(_0x2a3a2f){var _0x2a4dbb=_0x2a3a2f[_0xd235('0x73')]!==null;var _0x49d409=path[_0xd235('0x74')](config['root'],_0xd235('0x75'));if(_0x2a4dbb){_0x49d409=path[_0xd235('0x74')](_0x49d409,_0xd235('0x76'));}var _0x177abd=path[_0xd235('0x74')](_0x49d409,_0x2a3a2f[_0xd235('0x6d')]);return _0x55bf5c['download'](_0x177abd);}})[_0xd235('0x20')](handleError(_0x55bf5c,null));};exports[_0xd235('0x77')]=function(_0x26f8c1,_0x2c996a){var _0x389953=null;var _0x20a1dc=null;var _0x44622f=null;if(_0x26f8c1['body']['id']){delete _0x26f8c1['body']['id'];}if(_0x26f8c1[_0xd235('0x30')][_0xd235('0x78')]){_0x44622f=path[_0xd235('0x74')](config[_0xd235('0x79')],_0xd235('0x7a'),util[_0xd235('0x7b')](_0xd235('0x7c'),Date['now']()));_0x26f8c1[_0xd235('0x30')][_0xd235('0x7d')]=_0x44622f;}return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x26f8c1['params']['id']},'include':[{'model':db[_0xd235('0x60')],'as':'Messages','include':[{'model':db['User'],'as':_0xd235('0x7e')}]}]})[_0xd235('0x16')](handleEntityNotFound(_0x2c996a,null))[_0xd235('0x16')](saveUpdates(_0x26f8c1[_0xd235('0x30')],null))['then'](function(_0x2c782c){if(_0x2c782c){_0x389953=_0x2c782c;return db['ChatWebsite'][_0xd235('0x48')]({'where':{'id':_0x389953[_0xd235('0x4c')]}});}})['then'](function(_0x4191de){if(_0x4191de){_0x20a1dc=_0x4191de;return db[_0xd235('0x62')][_0xd235('0x48')]({'where':{'id':_0x389953[_0xd235('0x7f')]}});}})[_0xd235('0x16')](function(_0x3771b8){if(_0x3771b8){if(_0x44622f){var _0x2f73c6=null;for(var _0x277fdd=0x1;_0x277fdd<_0x389953[_0xd235('0x80')][_0xd235('0x81')];++_0x277fdd){_0x2f73c6=_0x389953[_0xd235('0x80')][_0x277fdd];var _0x33046c=_0x2f73c6[_0xd235('0x66')]?util[_0xd235('0x7b')](_0xd235('0x82'),_0x20a1dc[_0xd235('0x83')],_0x2f73c6['UserId']):_0xd235('0x84');var _0x33185f=_0x26f8c1['body']['customer']||util[_0xd235('0x7b')](_0xd235('0x82'),'Visitor',_0x2f73c6[_0xd235('0x7f')]);switch(_0x20a1dc[_0xd235('0x85')]){case _0xd235('0x86'):_0x33046c=_0x2f73c6[_0xd235('0x66')]?util[_0xd235('0x7b')](_0xd235('0x82'),_0x20a1dc['agentAlias'],_0x2f73c6[_0xd235('0x66')]):_0xd235('0x84');break;case'agent_alias':_0x33046c=_0x2f73c6[_0xd235('0x66')]?_0x2f73c6[_0xd235('0x7e')][_0xd235('0x87')]||_0x2f73c6[_0xd235('0x7e')][_0xd235('0x50')]:'System';break;case _0xd235('0x88'):_0x33046c=_0x2f73c6[_0xd235('0x66')]?_0x2f73c6['User'][_0xd235('0x50')]:_0xd235('0x84');break;default:_0x33046c=_0x2f73c6[_0xd235('0x66')]?util['format'](_0xd235('0x82'),_0x20a1dc[_0xd235('0x83')],_0x2f73c6[_0xd235('0x66')]):'System';}var _0x3db606=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x2f73c6[_0xd235('0x89')])[_0xd235('0x7b')](_0xd235('0x8a')),_0x2f73c6[_0xd235('0x8b')]==='in'?_0x33185f:_0x33046c,_0x2f73c6[_0xd235('0x30')]);if(!_0x2f73c6[_0xd235('0x8c')]){fs['appendFileSync'](_0x44622f,_0x3db606);}}return db[_0xd235('0x8d')][_0xd235('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0xd235('0x8e')],'as':_0xd235('0x8f'),'raw':!![],'include':[{'model':db[_0xd235('0x90')],'as':_0xd235('0x90'),'raw':!![]}]}]});}}})[_0xd235('0x16')](function(_0x1da331){if(!_0x1da331||!_0x1da331[_0xd235('0x8f')]||!_0x26f8c1[_0xd235('0x30')])return _0x389953;var _0x126dd4=_0x1da331[_0xd235('0x91')]();return respondWithRpcPromise(_0xd235('0x92'),_0xd235('0x93'),{'account':_0x126dd4,'message':{'from':util[_0xd235('0x7b')](_0xd235('0x94'),_0x1da331['name'],_0x1da331[_0xd235('0x51')]||_0x1da331['Smtp'][_0xd235('0x3b')]),'to':_0x26f8c1[_0xd235('0x30')][_0xd235('0x78')],'subject':_0xd235('0x95'),'text':util[_0xd235('0x7b')](_0xd235('0x96'),_0x26f8c1[_0xd235('0x30')][_0xd235('0x78')]),'attachments':[{'path':_0x44622f}]}})[_0xd235('0x16')](function(){return _0x389953;})['catch'](function(_0x1960bc){logger[_0xd235('0x1c')](_0x1960bc);});})[_0xd235('0x16')](respondWithStatusCode(_0x2c996a,0xc8))['catch'](handleError(_0x2c996a,null));};exports[_0xd235('0x97')]=function(_0x5c5f63,_0x4ee3c4){return db[_0xd235('0x60')]['find']({'where':{'id':_0x5c5f63[_0xd235('0x3c')]['id']}})[_0xd235('0x16')](handleEntityNotFound(_0x4ee3c4,null))['then'](function(_0x308cfc){if(_0x308cfc){return _0x308cfc[_0xd235('0x97')](_0x5c5f63[_0xd235('0x30')][_0xd235('0x98')],_[_0xd235('0x99')](_0x5c5f63[_0xd235('0x30')],[_0xd235('0x98'),'id'])||{});}})[_0xd235('0x16')](respondWithResult(_0x4ee3c4,null))[_0xd235('0x20')](handleError(_0x4ee3c4,null));};exports[_0xd235('0x9a')]=function(_0x1e6c3a,_0x4b1bcd){var _0x1665f9={'raw':![],'where':{}};var _0x386041={};var _0x420e9b={'count':0x0,'rows':[]};return db[_0xd235('0x35')][_0xd235('0x4b')]({'where':{'id':_0x1e6c3a[_0xd235('0x3c')]['id']}})[_0xd235('0x16')](handleEntityNotFound(_0x4b1bcd,null))[_0xd235('0x16')](function(_0x24f795){if(_0x24f795){_0x386041['model']=_[_0xd235('0x3f')](db[_0xd235('0x60')][_0xd235('0x36')]);_0x386041[_0xd235('0x3e')]=_[_0xd235('0x3f')](_0x1e6c3a[_0xd235('0x3e')]);_0x386041['filters']=_[_0xd235('0x9b')](_0x386041[_0xd235('0x3d')],_0x386041[_0xd235('0x3e')]);_0x1665f9['attributes']=_[_0xd235('0x9b')](_0x386041[_0xd235('0x3d')],qs[_0xd235('0x41')](_0x1e6c3a['query'][_0xd235('0x41')]));_0x1665f9[_0xd235('0x42')]=_0x1665f9['attributes']['length']?_0x1665f9[_0xd235('0x42')]:_0x386041[_0xd235('0x3d')];if(!_0x1e6c3a['query'][_0xd235('0x9c')](_0xd235('0x9d'))){_0x1665f9[_0xd235('0x26')]=qs[_0xd235('0x26')](_0x1e6c3a['query'][_0xd235('0x26')]);_0x1665f9[_0xd235('0x24')]=qs[_0xd235('0x24')](_0x1e6c3a[_0xd235('0x3e')][_0xd235('0x24')]);}_0x1665f9[_0xd235('0x9e')]=qs[_0xd235('0x9f')](_0x1e6c3a[_0xd235('0x3e')][_0xd235('0x9f')]);_0x1665f9[_0xd235('0xa0')]=qs['filters'](_[_0xd235('0xa1')](_0x1e6c3a['query'],_0x386041[_0xd235('0x40')]));_0x1665f9[_0xd235('0xa0')][_0xd235('0xa2')]=_0x24f795['id'];if(_0x1e6c3a[_0xd235('0x3e')][_0xd235('0xa3')]){_0x1665f9[_0xd235('0xa0')]=_['merge'](_0x1665f9[_0xd235('0xa0')],{'$or':_['map'](_0x1665f9[_0xd235('0x42')],function(_0x45cd7b){var _0x165d30={};_0x165d30[_0x45cd7b]={'$like':'%'+_0x1e6c3a[_0xd235('0x3e')][_0xd235('0xa3')]+'%'};return _0x165d30;})});}if(_0x1e6c3a[_0xd235('0x3e')]['$gte']){var _0x1122af=_0x1e6c3a[_0xd235('0x3e')][_0xd235('0xa4')][_0xd235('0xa5')](',');var _0x3ae49e={};_0x3ae49e[_0x1122af[0x0]]={'$gte':moment(_0x1122af[0x1])[_0xd235('0x7b')](_0xd235('0xa6'))};_0x1665f9['where']=_[_0xd235('0x2f')](_0x1665f9[_0xd235('0xa0')],_0x3ae49e);}_0x1665f9=_['merge']({},_0x1665f9,_0x1e6c3a[_0xd235('0x45')]);return db[_0xd235('0x60')]['count']({'where':_0x1665f9[_0xd235('0xa0')]})[_0xd235('0x16')](function(_0x48fd5c){_0x420e9b[_0xd235('0x27')]=_0x48fd5c;if(_0x1e6c3a['query'][_0xd235('0x43')]){_0x1665f9[_0xd235('0x44')]=[{'all':!![]}];}return db[_0xd235('0x60')][_0xd235('0x3a')](_0x1665f9);})['then'](function(_0x580320){_0x420e9b[_0xd235('0xa7')]=_0x580320;return _0x420e9b;});}})[_0xd235('0x16')](respondWithFilteredResult(_0x4b1bcd,_0x1665f9))[_0xd235('0x20')](handleError(_0x4b1bcd,null));};exports[_0xd235('0xa8')]=function(_0x119166,_0x44dda2){var _0x1fd14f={'where':{}},_0x571a26={},_0x393529={'count':0x0,'rows':[]};return db[_0xd235('0x35')]['findOne']({'where':{'id':_0x119166[_0xd235('0x3c')]['id']}})[_0xd235('0x16')](handleEntityNotFound(_0x44dda2,null))[_0xd235('0x16')](function(_0x104ddb){if(_0x104ddb){_0x571a26[_0xd235('0x3d')]=_[_0xd235('0x3f')](db[_0xd235('0x60')][_0xd235('0x36')]);_0x571a26[_0xd235('0x3e')]=_[_0xd235('0x3f')](_0x119166[_0xd235('0x3e')]);_0x571a26[_0xd235('0x40')]=_['intersection'](_0x571a26[_0xd235('0x3d')],_0x571a26['query']);_0x1fd14f['attributes']=_['intersection'](_0x571a26[_0xd235('0x3d')],qs[_0xd235('0x41')](_0x119166[_0xd235('0x3e')][_0xd235('0x41')]));_0x1fd14f['attributes']=_0x1fd14f[_0xd235('0x42')][_0xd235('0x81')]?_0x1fd14f[_0xd235('0x42')]:_0x571a26[_0xd235('0x3d')];if(!_0x119166[_0xd235('0x3e')][_0xd235('0x9c')](_0xd235('0x9d'))){_0x1fd14f['limit']=qs[_0xd235('0x26')](_0x119166[_0xd235('0x3e')]['limit']);_0x1fd14f[_0xd235('0x24')]=qs['offset'](_0x119166[_0xd235('0x3e')]['offset']);}_0x1fd14f[_0xd235('0x9e')]=qs['sort'](_0x119166[_0xd235('0x3e')]['sort']);_0x1fd14f['where']=qs[_0xd235('0x40')](_[_0xd235('0xa1')](_0x119166[_0xd235('0x3e')],_0x571a26['filters']));_0x1fd14f[_0xd235('0xa0')][_0xd235('0xa2')]=_0x104ddb['id'];if(_0x119166['query'][_0xd235('0xa3')]){_0x1fd14f[_0xd235('0xa0')]=_[_0xd235('0x2f')](_0x1fd14f[_0xd235('0xa0')],{'$or':_[_0xd235('0x34')](_0x1fd14f['attributes'],function(_0x7fd64){var _0x31dd6e={};_0x31dd6e[_0x7fd64]={'$like':'%'+_0x119166['query'][_0xd235('0xa3')]+'%'};return _0x31dd6e;})});}_0x1fd14f[_0xd235('0xa0')][_0xd235('0x8c')]=![];if(_0x119166[_0xd235('0x3e')]['id']){_0x1fd14f[_0xd235('0xa0')]['id']={'$gt':_0x119166['query']['id']};}_0x1fd14f=_['merge']({},_0x1fd14f,_0x119166['options']);return db[_0xd235('0x60')]['count']({'where':_0x1fd14f[_0xd235('0xa0')]})[_0xd235('0x16')](function(_0x5e39b0){_0x393529[_0xd235('0x27')]=_0x5e39b0;_0x1fd14f[_0xd235('0x44')]=[];if(_0x119166[_0xd235('0x3e')][_0xd235('0xa9')]){_0x1fd14f[_0xd235('0x44')][_0xd235('0xaa')]({'model':db['User'],'as':_0xd235('0x7e'),'attributes':['id',_0xd235('0x50'),'alias']});}if(_0x119166[_0xd235('0x3e')][_0xd235('0x43')]){_0x1fd14f[_0xd235('0x44')]=[{'all':!![]}];}return db[_0xd235('0x60')][_0xd235('0x3a')](_0x1fd14f);})[_0xd235('0x16')](function(_0x412c0f){_0x393529[_0xd235('0xa7')]=_0x412c0f;return _0x393529;});}})['then'](respondWithFilteredResult(_0x44dda2,_0x1fd14f))['catch'](handleError(_0x44dda2,null));};exports[_0xd235('0xab')]=function(_0x45a47e,_0x25ea48){return db[_0xd235('0x35')]['find']({'where':{'id':_0x45a47e[_0xd235('0x3c')]['id']}})['then'](handleEntityNotFound(_0x25ea48,null))[_0xd235('0x16')](function(_0x364fe1){if(_0x364fe1){return _0x364fe1[_0xd235('0xac')](_0x45a47e['body']['ids'],_[_0xd235('0x99')](_0x45a47e[_0xd235('0x30')],[_0xd235('0x98'),'id'])||{})[_0xd235('0xad')](function(){return db[_0xd235('0xae')][_0xd235('0x3a')]({'attributes':['id',_0xd235('0x2c'),_0xd235('0xaf')],'where':{'id':_0x45a47e[_0xd235('0x30')]['ids']}});})[_0xd235('0x16')](function(_0x3364eb){socket[_0xd235('0xb0')]('chatInteractionTags:save',{'id':Number(_0x45a47e['params']['id']),'tags':_0x3364eb||[]});return{'id':Number(_0x45a47e[_0xd235('0x3c')]['id']),'tags':_0x3364eb||[]};});}})[_0xd235('0x16')](respondWithResult(_0x25ea48,null))[_0xd235('0x20')](handleError(_0x25ea48,null));};exports[_0xd235('0xb1')]=function(_0x86c59f,_0x2e7e2d){return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x86c59f['params']['id']}})[_0xd235('0x16')](handleEntityNotFound(_0x2e7e2d,null))['then'](function(_0x5740d7){if(_0x5740d7){return _0x5740d7[_0xd235('0xb1')](_0x86c59f[_0xd235('0x3e')][_0xd235('0x98')]);}})[_0xd235('0x16')](respondWithStatusCode(_0x2e7e2d,null))['catch'](handleError(_0x2e7e2d,null));};exports[_0xd235('0xb2')]=function(_0x9db65a,_0x4e7f68){var _0x38214e=moment()['unix']()[_0xd235('0xb3')]();var _0x45e901=path[_0xd235('0x74')](config[_0xd235('0x79')],_0xd235('0xb4'),'files','tmp');var _0x467ae0=path[_0xd235('0x74')](config[_0xd235('0x79')],'server','files',_0xd235('0xb5'));var _0x1a3429=path[_0xd235('0x74')](_0x45e901,_0x38214e);var _0x354764=util['format'](_0xd235('0xb6'),_0x9db65a['params']['id'],_0x38214e);var _0x28d9c7=path[_0xd235('0x74')](_0x45e901,_0x354764);var _0x4c9435=[];_0x4c9435['push']({'model':db['User'],'as':_0xd235('0x7e'),'attributes':['id','fullname'],'raw':!![]});_0x4c9435[_0xd235('0xaa')]({'model':db['CmContact'],'as':_0xd235('0x63'),'attributes':['id',_0xd235('0xb7'),_0xd235('0xb8')],'raw':!![]});if(_0x9db65a[_0xd235('0x3e')][_0xd235('0xb5')]){_0x4c9435[_0xd235('0xaa')]({'model':db[_0xd235('0x6e')],'as':_0xd235('0x6e'),'raw':!![]});}var _0x56679a=[{'model':db[_0xd235('0x60')],'as':_0xd235('0x80'),'attributes':['id',_0xd235('0x30'),_0xd235('0x89'),_0xd235('0x8b'),_0xd235('0x8c'),_0xd235('0xb9')],'include':_0x4c9435}];_0x56679a['push']({'model':db['ChatWebsite'],'as':_0xd235('0xba'),'attributes':['id','name']});_0x56679a['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xd235('0x50')]});return db[_0xd235('0x35')][_0xd235('0x48')]({'where':{'id':_0x9db65a[_0xd235('0x3c')]['id']},'include':_0x56679a})[_0xd235('0x16')](handleEntityNotFound(_0x4e7f68,null))['then'](function(_0x5b62f9){if(_0x5b62f9){var _0x2aed63=_0x5b62f9['get']({'plain':!![]});fs[_0xd235('0xbb')](_0x1a3429);var _0x56b449={'channel':'Chat','account':_0x2aed63[_0xd235('0xba')]['name'],'agent':_0x2aed63[_0xd235('0xbc')]?_0x2aed63[_0xd235('0xbc')]['fullname']:_0xd235('0xbd'),'createdAt':moment(_0x2aed63[_0xd235('0x89')])[_0xd235('0x7b')](_0xd235('0xa6'))[_0xd235('0xb3')](),'closedAt':_0x2aed63[_0xd235('0x68')]?moment(_0x2aed63[_0xd235('0xbe')])['format'](_0xd235('0xa6'))[_0xd235('0xb3')]():'','disposition':_0x2aed63[_0xd235('0x69')],'chatInfo':{'browser':_0x2aed63[_0xd235('0xbf')],'os':_0x2aed63[_0xd235('0xc0')],'referer':_0x2aed63[_0xd235('0xc1')],'customerIp':_0x2aed63[_0xd235('0xc2')],'customerPort':_0x2aed63[_0xd235('0xc3')]?_0x2aed63[_0xd235('0xc3')]:'N.A.'},'messages':_(_0x2aed63[_0xd235('0x80')])[_0xd235('0xc4')]()[_0xd235('0xa3')]({'secret':![]})[_0xd235('0x34')](function(_0x14cd9c){if(_0x14cd9c[_0xd235('0x6e')]){var _0xcc9c10=path[_0xd235('0x74')](_0x467ae0,_0x14cd9c[_0xd235('0x6e')][_0xd235('0x6d')]);if(fs[_0xd235('0xc5')](_0xcc9c10)){fs[_0xd235('0xc6')](_0xcc9c10)[_0xd235('0xc7')](fs[_0xd235('0xc8')](path[_0xd235('0x74')](_0x1a3429,_0x14cd9c[_0xd235('0x6e')][_0xd235('0x6d')])));}}return{'date':moment(_0x14cd9c[_0xd235('0x89')])[_0xd235('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x14cd9c[_0xd235('0x8b')]==='out'?_0x14cd9c[_0xd235('0x7e')]?_0x14cd9c[_0xd235('0x7e')][_0xd235('0x50')]:_0xd235('0x84'):_0x14cd9c[_0xd235('0x63')][_0xd235('0xb7')]+(_0x14cd9c['Contact']['lastName']?'\x20'+_0x14cd9c[_0xd235('0x63')]['lastName']:''),'body':_0x14cd9c[_0xd235('0x6e')]?_0x14cd9c['Attachment']['basename']:_0x14cd9c['body'],'direction':_0x14cd9c['direction']==='out'?'A':'C','secret':_0x14cd9c['secret'],'read':_0x14cd9c[_0xd235('0xb9')],'attachment':_0x14cd9c['Attachment']};})['value']()};return ejs[_0xd235('0xc9')](path['join'](config['root'],_0xd235('0xb4'),_0xd235('0xca'),'downloadInteraction.ejs'),{'interaction':_0x56b449})[_0xd235('0x16')](function(_0x5d490b){var _0x5637c0=path[_0xd235('0x74')](_0x1a3429,_0xd235('0xcb')+_0x2aed63['id']+'-'+_0x38214e+'.pdf');var _0x458798={'path':_0x5637c0,'channel':_0xd235('0xcc'),'interactionId':_0x2aed63['id']};return pdf[_0xd235('0xcd')](_0x5d490b,_0x458798);})[_0xd235('0x16')](function(){return new Promise(function(_0x41943b,_0x234042){zipdir(_0x1a3429,{'saveTo':_0x28d9c7},function(_0x23bb48,_0x42d990){if(_0x23bb48)return _0x234042(_0x23bb48);return _0x41943b(_0x42d990);});})[_0xd235('0x16')](function(){return new BPromise(function(_0x26012e,_0xd556dd){rimraf(_0x1a3429,function(_0x5929a1){if(_0x5929a1)_0xd556dd(_0x5929a1);return _0x26012e();});});})['then'](function(){return _0x4e7f68[_0xd235('0xb2')](_0x28d9c7,_0x354764,function(_0x3fedc8){if(_0x3fedc8){logger[_0xd235('0x1c')]('err',_0x3fedc8);}else{fs[_0xd235('0xce')](_0x28d9c7);}});});});}else{return _0x4e7f68[_0xd235('0x21')](0xc8);}})[_0xd235('0x20')](handleError(_0x4e7f68,null));}; \ No newline at end of file +var _0xb101=['join','root','server/files/attachments/','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','System','customer','agentIdentifier','website_alias','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','where','filter','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','sort','ChatInteractionId','secret','push','addTags','setTags','spread','Tag','emit','removeTags','download','toString','server','files','tmp','attachments','firstName','lastName','Owner','Chat','Account','closedAt','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','undefined','limit','count','offset','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','merge','body','interaction','index','map','rawAttributes','getOptions','findAll','chat','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','options','ChatInteraction','find','create','catch','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooTopic','vidaooMetadata','vidaooEscalation','user','fullname','email','contact','account','POST','vidaooNote','follow','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId'];(function(_0x1721d4,_0xbbd401){var _0x584420=function(_0x2f086f){while(--_0x2f086f){_0x1721d4['push'](_0x1721d4['shift']());}};_0x584420(++_0xbbd401);}(_0xb101,0x115));var _0x1b10=function(_0x484285,_0x54cab2){_0x484285=_0x484285-0x0;var _0x10c393=_0xb101[_0x484285];return _0x10c393;};'use strict';var rimraf=require(_0x1b10('0x0'));var zipdir=require(_0x1b10('0x1'));var rp=require(_0x1b10('0x2'));var moment=require(_0x1b10('0x3'));var BPromise=require(_0x1b10('0x4'));var Mustache=require(_0x1b10('0x5'));var util=require(_0x1b10('0x6'));var path=require(_0x1b10('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b10('0x8'));var Redis=require('ioredis');var interaction=require(_0x1b10('0x9'));var qs=require(_0x1b10('0xa'));var pdf=require(_0x1b10('0xb'));var logger=require(_0x1b10('0xc'))('api');var config=require(_0x1b10('0xd'));var db=require('../../mysqldb')['db'];config[_0x1b10('0xe')]=_[_0x1b10('0xf')](config[_0x1b10('0xe')],{'host':_0x1b10('0x10'),'port':0x18eb});var socket=require(_0x1b10('0x11'))(new Redis(config[_0x1b10('0xe')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1b10('0x12')]({'port':0x232b});var client9004=jayson['client'][_0x1b10('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x301399,_0x46c257,_0x799b2c,_0x1b861d){return new BPromise(function(_0xbb2974,_0x4daaa0){var _0x3323b0=_0x1b861d||client;return _0x3323b0['request'](_0x301399,_0x799b2c)[_0x1b10('0x13')](function(_0x1547ce){logger['info'](_0x1b10('0x14'),_0x46c257,_0x1b10('0x15'));logger[_0x1b10('0x16')](_0x1b10('0x17'),_0x46c257,_0x1b10('0x15'),JSON[_0x1b10('0x18')](_0x1547ce));if(_0x1547ce[_0x1b10('0x19')]){if(_0x1547ce[_0x1b10('0x19')]['code']===0x1f4){logger[_0x1b10('0x19')](_0x1b10('0x14'),_0x46c257,_0x1547ce[_0x1b10('0x19')][_0x1b10('0x1a')]);return _0x4daaa0(_0x1547ce[_0x1b10('0x19')][_0x1b10('0x1a')]);}logger[_0x1b10('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x46c257,_0x1547ce[_0x1b10('0x19')][_0x1b10('0x1a')]);return _0xbb2974(_0x1547ce['error'][_0x1b10('0x1a')]);}else{logger[_0x1b10('0x1b')](_0x1b10('0x14'),_0x46c257,_0x1b10('0x15'));_0xbb2974(_0x1547ce[_0x1b10('0x1c')][_0x1b10('0x1a')]);}})['catch'](function(_0xf588c4){logger[_0x1b10('0x19')](_0x1b10('0x14'),_0x46c257,_0xf588c4);_0x4daaa0(_0xf588c4);});});}function respondWithStatusCode(_0x5a647d,_0x38265c){_0x38265c=_0x38265c||0xcc;return function(_0x25ef46){if(_0x25ef46){return _0x5a647d['sendStatus'](_0x38265c);}return _0x5a647d[_0x1b10('0x1d')](_0x38265c)['end']();};}function respondWithResult(_0x3a60a0,_0x425902){_0x425902=_0x425902||0xc8;return function(_0x4ea8ae){if(_0x4ea8ae){return _0x3a60a0[_0x1b10('0x1d')](_0x425902)['json'](_0x4ea8ae);}};}function respondWithFilteredResult(_0x543772,_0x1ef1f5){return function(_0x2acc4a){if(_0x2acc4a){var _0x5a3403=typeof _0x1ef1f5['offset']===_0x1b10('0x1e')&&typeof _0x1ef1f5[_0x1b10('0x1f')]===_0x1b10('0x1e');var _0x23db25=_0x2acc4a[_0x1b10('0x20')];var _0x16db94=_0x5a3403?0x0:_0x1ef1f5[_0x1b10('0x21')];var _0x30cc3a=_0x5a3403?_0x2acc4a[_0x1b10('0x20')]:_0x1ef1f5[_0x1b10('0x21')]+_0x1ef1f5[_0x1b10('0x1f')];var _0x16503d;if(_0x30cc3a>=_0x23db25){_0x30cc3a=_0x23db25;_0x16503d=0xc8;}else{_0x16503d=0xce;}_0x543772['status'](_0x16503d);return _0x543772[_0x1b10('0x22')](_0x1b10('0x23'),_0x16db94+'-'+_0x30cc3a+'/'+_0x23db25)[_0x1b10('0x24')](_0x2acc4a);}return null;};}function saveUpdates(_0xf971c1){return function(_0x558c10){if(_0x558c10){return _0x558c10[_0x1b10('0x25')](_0xf971c1)[_0x1b10('0x13')](function(_0x361035){return _0x361035;});}return null;};}function removeEntity(_0x3de1a9){return function(_0x37b457){if(_0x37b457){return _0x37b457[_0x1b10('0x26')]()[_0x1b10('0x13')](function(){_0x3de1a9['status'](0xcc)[_0x1b10('0x27')]();});}};}function handleEntityNotFound(_0x8943c3){return function(_0x3cf011){if(!_0x3cf011){_0x8943c3[_0x1b10('0x28')](0x194);}return _0x3cf011;};}function handleError(_0x59d7a2,_0x3f3b16){_0x3f3b16=_0x3f3b16||0x1f4;return function(_0x17fea6){logger[_0x1b10('0x19')](_0x17fea6[_0x1b10('0x29')]);if(_0x17fea6[_0x1b10('0x2a')]){delete _0x17fea6[_0x1b10('0x2a')];}_0x59d7a2['status'](_0x3f3b16)[_0x1b10('0x2b')](_0x17fea6);};}function getMustacheRender(_0x34fb33,_0x4921fd){return Mustache['render'](_0x34fb33,_[_0x1b10('0x2c')](_0x4921fd[_0x1b10('0x2d')],{'contact':_0x4921fd['contact'],'message':_0x4921fd['message'],'agent':_0x4921fd['agent'],'interaction':_0x4921fd[_0x1b10('0x2e')],'account':_0x4921fd['account']}))||'';}exports[_0x1b10('0x2f')]=function(_0x3197d7,_0x4ef675){var _0x51cd85={};var _0x351cf1=_[_0x1b10('0x30')](db['ChatInteraction'][_0x1b10('0x31')],function(_0x5eef21){return{'name':_0x5eef21['fieldName'],'type':_0x5eef21['type']['key']};});_0x51cd85=qs[_0x1b10('0x32')](_0x351cf1,_0x3197d7);return interaction[_0x1b10('0x33')](_0x1b10('0x34'),_0x3197d7['query'],_0x3197d7['user'],_0x51cd85,_0x351cf1)['then'](respondWithFilteredResult(_0x4ef675,_0x51cd85))['catch'](handleError(_0x4ef675,null));};exports[_0x1b10('0x35')]=function(_0x33991e,_0x2091d2){var _0x4a8470={'raw':![],'where':{'id':_0x33991e[_0x1b10('0x36')]['id']}},_0x4add88={};_0x4add88[_0x1b10('0x37')]=_[_0x1b10('0x38')](db['ChatInteraction'][_0x1b10('0x31')]);_0x4add88[_0x1b10('0x39')]=_[_0x1b10('0x38')](_0x33991e[_0x1b10('0x39')]);_0x4add88[_0x1b10('0x3a')]=_[_0x1b10('0x3b')](_0x4add88[_0x1b10('0x37')],_0x4add88[_0x1b10('0x39')]);_0x4a8470[_0x1b10('0x3c')]=_[_0x1b10('0x3b')](_0x4add88[_0x1b10('0x37')],qs[_0x1b10('0x3d')](_0x33991e[_0x1b10('0x39')][_0x1b10('0x3d')]));_0x4a8470[_0x1b10('0x3c')]=_0x4a8470['attributes'][_0x1b10('0x3e')]?_0x4a8470[_0x1b10('0x3c')]:_0x4add88[_0x1b10('0x37')];if(_0x33991e[_0x1b10('0x39')][_0x1b10('0x3f')]){_0x4a8470[_0x1b10('0x40')]=[{'all':!![]}];}_0x4a8470=_['merge']({},_0x4a8470,_0x33991e[_0x1b10('0x41')]);return db[_0x1b10('0x42')][_0x1b10('0x43')](_0x4a8470)['then'](handleEntityNotFound(_0x2091d2,null))[_0x1b10('0x13')](respondWithResult(_0x2091d2,null))['catch'](handleError(_0x2091d2,null));};exports['create']=function(_0x26febf,_0x5283e3){return db[_0x1b10('0x42')][_0x1b10('0x44')](_0x26febf['body'],{})[_0x1b10('0x13')](respondWithResult(_0x5283e3,0xc9))[_0x1b10('0x45')](handleError(_0x5283e3,null));};exports[_0x1b10('0x25')]=function(_0x564b14,_0x5031f9){if(_0x564b14[_0x1b10('0x2d')]['id']){delete _0x564b14[_0x1b10('0x2d')]['id'];}return db[_0x1b10('0x42')][_0x1b10('0x43')]({'where':{'id':_0x564b14['params']['id']}})['then'](handleEntityNotFound(_0x5031f9,null))[_0x1b10('0x13')](saveUpdates(_0x564b14[_0x1b10('0x2d')],null))[_0x1b10('0x13')](respondWithResult(_0x5031f9,null))['catch'](handleError(_0x5031f9,null));};exports['destroy']=function(_0x3067cf,_0x5a94c7){return db['ChatInteraction'][_0x1b10('0x43')]({'where':{'id':_0x3067cf[_0x1b10('0x36')]['id']}})[_0x1b10('0x13')](handleEntityNotFound(_0x5a94c7,null))[_0x1b10('0x13')](removeEntity(_0x5a94c7,null))[_0x1b10('0x45')](handleError(_0x5a94c7,null));};exports['describe']=function(_0x3a9f31,_0x32840e){return db['ChatInteraction'][_0x1b10('0x46')]()[_0x1b10('0x13')](respondWithResult(_0x32840e,null))['catch'](handleError(_0x32840e,null));};exports[_0x1b10('0x47')]=function(_0x1a4754,_0x200c38){var _0x1a461f=_0x1a4754[_0x1b10('0x36')]['id'];var _0x3691c4;var _0x4d0900;var _0x433731;return db[_0x1b10('0x42')][_0x1b10('0x48')]({'where':{'id':_0x1a461f}})[_0x1b10('0x13')](function(_0x497e3b){_0x3691c4=_0x497e3b;return db[_0x1b10('0x49')][_0x1b10('0x48')]({'where':{'id':_0x497e3b[_0x1b10('0x4a')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0x1b10('0x4b'),'vidaooNote',_0x1b10('0x4c')],'raw':!![]});})[_0x1b10('0x13')](function(_0x40afa1){if(_0x40afa1&&_0x40afa1['vidaooApiKey']&&_0x40afa1[_0x1b10('0x4d')]){_0x4d0900=_0x40afa1;var _0x2c4fc9={'interaction':{'id':_0x1a461f},'agent':{'id':_0x1a4754['user']['id'],'name':_0x1a4754['user']['name'],'fullname':_0x1a4754[_0x1b10('0x4e')][_0x1b10('0x4f')],'email':_0x1a4754[_0x1b10('0x4e')][_0x1b10('0x50')]},'contact':_0x1a4754[_0x1b10('0x2d')][_0x1b10('0x51')],'account':_0x1a4754[_0x1b10('0x2d')][_0x1b10('0x52')]};var _0x14fd9f={'rejectUnauthorized':![],'method':_0x1b10('0x53'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x40afa1['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1a4754[_0x1b10('0x4e')]['email']],'buttons':null,'topic':_0x4d0900[_0x1b10('0x4b')],'note':_['isNull'](_0x4d0900[_0x1b10('0x54')])?null:getMustacheRender(_0x4d0900['vidaooNote'],_0x2c4fc9),'metadata':null},'redirect':_0x1b10('0x55'),'json':!![]};try{if(!_['isNull'](_0x4d0900[_0x1b10('0x4c')])){var _0x1f5bfe=getMustacheRender(_0x4d0900['vidaooMetadata'],_0x2c4fc9);var _0x45fe30=JSON[_0x1b10('0x56')](_0x1f5bfe);_0x14fd9f[_0x1b10('0x2d')]['metadata']=_0x45fe30;}}catch(_0x18cfc4){throw new db[(_0x1b10('0x57'))][(_0x1b10('0x58'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x14fd9f);}else{throw new db['Sequelize'][(_0x1b10('0x58'))](_0x1b10('0x59'));}})[_0x1b10('0x13')](function(_0x1779b3){_0x433731=_0x1779b3;if(_0x433731['id']){var _0x1fd4a0={'body':_0x433731[_0x1b10('0x5a')],'ChatWebsiteId':_0x4d0900['id'],'ChatInteractionId':_0x3691c4['id'],'direction':_0x1b10('0x5b'),'UserId':_0x1a4754[_0x1b10('0x4e')]['id']};return db[_0x1b10('0x5c')][_0x1b10('0x44')](_0x1fd4a0,{});}else{throw new db['Sequelize']['ValidationError'](_0x1b10('0x5d'));}})[_0x1b10('0x13')](function(){return _0x3691c4[_0x1b10('0x5e')]({'vidaooSessionId':_0x433731['id']});})[_0x1b10('0x13')](respondWithResult(_0x200c38,null))[_0x1b10('0x45')](handleError(_0x200c38,null));};exports[_0x1b10('0x5f')]=function(_0xa935f8,_0x11d333){if(_0xa935f8[_0x1b10('0x2d')]['id']){delete _0xa935f8['body']['id'];}return db[_0x1b10('0x42')][_0x1b10('0x43')]({'where':{'id':_0xa935f8['params']['id']},'include':[{'model':db[_0x1b10('0x60')],'as':_0x1b10('0x61')}]})[_0x1b10('0x13')](handleEntityNotFound(_0x11d333,null))[_0x1b10('0x13')](saveUpdates(_0xa935f8[_0x1b10('0x2d')],null))[_0x1b10('0x13')](respondWithResult(_0x11d333,null))['catch'](handleError(_0x11d333,null));};exports[_0x1b10('0x62')]=function(_0x417225,_0x5eeae6){if(_0x417225[_0x1b10('0x2d')]['id']){delete _0x417225['body']['id'];}return db[_0x1b10('0x42')][_0x1b10('0x43')]({'where':{'id':_0x417225['params']['id']}})[_0x1b10('0x13')](function(_0x1e8ce4){if(!_0x1e8ce4){logger[_0x1b10('0x19')](_0x1b10('0x63'),_0x1b10('0x62'),0x194,_0x1b10('0x64'));_0x5eeae6[_0x1b10('0x28')](0x194);}else{if(_0x1e8ce4[_0x1b10('0x65')]){throw new db['Sequelize'][(_0x1b10('0x58'))](_0x1b10('0x66'));}}return _0x1e8ce4;})[_0x1b10('0x13')](function(_0x43f4ae){if(_0x43f4ae){return _0x43f4ae[_0x1b10('0x25')]({'closed':_0x417225['body'][_0x1b10('0x67')],'disposition':_0x417225[_0x1b10('0x2d')][_0x1b10('0x68')]})[_0x1b10('0x13')](function(_0x279845){return _0x279845;});}})[_0x1b10('0x13')](function(){return respondWithRpcPromise(_0x1b10('0x69'),'abandon',_0x417225['body'],client9004);})['then'](respondWithResult(_0x5eeae6,null))['catch'](handleError(_0x5eeae6,null));};exports['attachmentUpload']=function(_0x4e4379,_0x15f674){_0x4e4379[_0x1b10('0x2d')]['name']=_0x4e4379[_0x1b10('0x6a')]['originalname'];_0x4e4379[_0x1b10('0x2d')][_0x1b10('0x6b')]=_0x4e4379[_0x1b10('0x6a')]['filename'];_0x4e4379[_0x1b10('0x2d')][_0x1b10('0x6c')]=_0x4e4379['file'][_0x1b10('0x6d')];return db[_0x1b10('0x6e')][_0x1b10('0x44')](_0x4e4379[_0x1b10('0x2d')])['then'](respondWithResult(_0x15f674,0xc9))[_0x1b10('0x45')](handleError(_0x15f674,null));};exports[_0x1b10('0x6f')]=function(_0x3f1b8e,_0x3059f8){return db[_0x1b10('0x42')][_0x1b10('0x48')]({'where':{'id':_0x3f1b8e[_0x1b10('0x36')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3059f8,null))[_0x1b10('0x13')](function(_0x41d5f4){if(_0x41d5f4){if(_0x41d5f4[_0x1b10('0x67')]){return _0x3059f8['status'](0x193)[_0x1b10('0x24')]({'status':0x193,'message':_0x1b10('0x70')});}return db[_0x1b10('0x6e')][_0x1b10('0x48')]({'where':{'id':_0x3f1b8e['query'][_0x1b10('0x71')]},'raw':!![]})[_0x1b10('0x13')](handleEntityNotFound(_0x3059f8,null));}})[_0x1b10('0x13')](function(_0x13cd30){if(_0x13cd30){var _0x48d1f9=_0x13cd30[_0x1b10('0x72')]!==null;var _0x2c8744=path[_0x1b10('0x73')](config[_0x1b10('0x74')],_0x1b10('0x75'));if(_0x48d1f9){_0x2c8744=path['join'](_0x2c8744,'offline-chat/');}var _0x52ffe5=path[_0x1b10('0x73')](_0x2c8744,_0x13cd30[_0x1b10('0x6b')]);return _0x3059f8['download'](_0x52ffe5);}})['catch'](handleError(_0x3059f8,null));};exports['close']=function(_0x5137b4,_0x2cbab1){var _0x3bc245=null;var _0x3b0c9e=null;var _0x4db1e4=null;if(_0x5137b4[_0x1b10('0x2d')]['id']){delete _0x5137b4[_0x1b10('0x2d')]['id'];}if(_0x5137b4[_0x1b10('0x2d')][_0x1b10('0x76')]){_0x4db1e4=path[_0x1b10('0x73')](config['root'],'server/files/chat/upload/',util[_0x1b10('0x77')](_0x1b10('0x78'),Date[_0x1b10('0x79')]()));_0x5137b4[_0x1b10('0x2d')][_0x1b10('0x7a')]=_0x4db1e4;}return db['ChatInteraction'][_0x1b10('0x43')]({'where':{'id':_0x5137b4[_0x1b10('0x36')]['id']},'include':[{'model':db[_0x1b10('0x5c')],'as':_0x1b10('0x7b'),'include':[{'model':db[_0x1b10('0x7c')],'as':_0x1b10('0x7c')}]}]})['then'](handleEntityNotFound(_0x2cbab1,null))[_0x1b10('0x13')](saveUpdates(_0x5137b4[_0x1b10('0x2d')],null))['then'](function(_0x4470cd){if(_0x4470cd){_0x3bc245=_0x4470cd;return db[_0x1b10('0x49')][_0x1b10('0x43')]({'where':{'id':_0x3bc245[_0x1b10('0x4a')]}});}})[_0x1b10('0x13')](function(_0x2c7c54){if(_0x2c7c54){_0x3b0c9e=_0x2c7c54;return db[_0x1b10('0x60')][_0x1b10('0x43')]({'where':{'id':_0x3bc245[_0x1b10('0x7d')]}});}})[_0x1b10('0x13')](function(_0x35e594){if(_0x35e594){if(_0x4db1e4){var _0x23fb2b=null;for(var _0x4c93c7=0x1;_0x4c93c7<_0x3bc245[_0x1b10('0x7b')][_0x1b10('0x3e')];++_0x4c93c7){_0x23fb2b=_0x3bc245[_0x1b10('0x7b')][_0x4c93c7];var _0x4da00f=_0x23fb2b[_0x1b10('0x65')]?util['format'](_0x1b10('0x7e'),_0x3b0c9e['agentAlias'],_0x23fb2b[_0x1b10('0x65')]):_0x1b10('0x7f');var _0x105d25=_0x5137b4['body'][_0x1b10('0x80')]||util[_0x1b10('0x77')](_0x1b10('0x7e'),'Visitor',_0x23fb2b['ContactId']);switch(_0x3b0c9e[_0x1b10('0x81')]){case _0x1b10('0x82'):_0x4da00f=_0x23fb2b[_0x1b10('0x65')]?util[_0x1b10('0x77')](_0x1b10('0x7e'),_0x3b0c9e[_0x1b10('0x83')],_0x23fb2b['UserId']):_0x1b10('0x7f');break;case _0x1b10('0x84'):_0x4da00f=_0x23fb2b['UserId']?_0x23fb2b['User'][_0x1b10('0x85')]||_0x23fb2b[_0x1b10('0x7c')][_0x1b10('0x4f')]:_0x1b10('0x7f');break;case'agent_fullname':_0x4da00f=_0x23fb2b[_0x1b10('0x65')]?_0x23fb2b[_0x1b10('0x7c')][_0x1b10('0x4f')]:_0x1b10('0x7f');break;default:_0x4da00f=_0x23fb2b[_0x1b10('0x65')]?util[_0x1b10('0x77')](_0x1b10('0x7e'),_0x3b0c9e[_0x1b10('0x83')],_0x23fb2b[_0x1b10('0x65')]):_0x1b10('0x7f');}var _0x468bd8=util['format'](_0x1b10('0x86'),moment(_0x23fb2b[_0x1b10('0x87')])[_0x1b10('0x77')]('MM/DD/YYYY\x20HH:mm:ss'),_0x23fb2b[_0x1b10('0x88')]==='in'?_0x105d25:_0x4da00f,_0x23fb2b[_0x1b10('0x2d')]);if(!_0x23fb2b['secret']){fs[_0x1b10('0x89')](_0x4db1e4,_0x468bd8);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1b10('0x8a')],'as':_0x1b10('0x8b'),'raw':!![],'include':[{'model':db[_0x1b10('0x8c')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x1b10('0x13')](function(_0x5c0217){if(!_0x5c0217||!_0x5c0217[_0x1b10('0x8b')]||!_0x5137b4['body'])return _0x3bc245;var _0x47bd76=_0x5c0217[_0x1b10('0x8d')]();return respondWithRpcPromise(_0x1b10('0x8e'),'sendMail',{'account':_0x47bd76,'message':{'from':util[_0x1b10('0x77')](_0x1b10('0x8f'),_0x5c0217[_0x1b10('0x2a')],_0x5c0217[_0x1b10('0x50')]||_0x5c0217[_0x1b10('0x8b')][_0x1b10('0x4e')]),'to':_0x5137b4[_0x1b10('0x2d')][_0x1b10('0x76')],'subject':_0x1b10('0x90'),'text':util[_0x1b10('0x77')](_0x1b10('0x91'),_0x5137b4['body'][_0x1b10('0x76')]),'attachments':[{'path':_0x4db1e4}]}})['then'](function(){return _0x3bc245;})[_0x1b10('0x45')](function(_0x5ebeb1){logger['error'](_0x5ebeb1);});})[_0x1b10('0x13')](respondWithStatusCode(_0x2cbab1,0xc8))['catch'](handleError(_0x2cbab1,null));};exports[_0x1b10('0x92')]=function(_0x2adced,_0x3e3208){return db[_0x1b10('0x5c')]['find']({'where':{'id':_0x2adced[_0x1b10('0x36')]['id']}})[_0x1b10('0x13')](handleEntityNotFound(_0x3e3208,null))[_0x1b10('0x13')](function(_0x213e3d){if(_0x213e3d){return _0x213e3d[_0x1b10('0x92')](_0x2adced[_0x1b10('0x2d')][_0x1b10('0x93')],_[_0x1b10('0x94')](_0x2adced[_0x1b10('0x2d')],[_0x1b10('0x93'),'id'])||{});}})[_0x1b10('0x13')](respondWithResult(_0x3e3208,null))[_0x1b10('0x45')](handleError(_0x3e3208,null));};exports[_0x1b10('0x95')]=function(_0x5b6abb,_0x246830){var _0x3b9bb2={'raw':![],'where':{}};var _0x2ca446={};var _0xd69fa1={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x1b10('0x48')]({'where':{'id':_0x5b6abb['params']['id']}})[_0x1b10('0x13')](handleEntityNotFound(_0x246830,null))['then'](function(_0x4a8d9c){if(_0x4a8d9c){_0x2ca446[_0x1b10('0x37')]=_['keys'](db[_0x1b10('0x5c')][_0x1b10('0x31')]);_0x2ca446[_0x1b10('0x39')]=_['keys'](_0x5b6abb[_0x1b10('0x39')]);_0x2ca446['filters']=_[_0x1b10('0x3b')](_0x2ca446[_0x1b10('0x37')],_0x2ca446['query']);_0x3b9bb2['attributes']=_[_0x1b10('0x3b')](_0x2ca446[_0x1b10('0x37')],qs[_0x1b10('0x3d')](_0x5b6abb[_0x1b10('0x39')]['fields']));_0x3b9bb2[_0x1b10('0x3c')]=_0x3b9bb2[_0x1b10('0x3c')][_0x1b10('0x3e')]?_0x3b9bb2[_0x1b10('0x3c')]:_0x2ca446[_0x1b10('0x37')];if(!_0x5b6abb[_0x1b10('0x39')][_0x1b10('0x96')](_0x1b10('0x97'))){_0x3b9bb2[_0x1b10('0x1f')]=qs[_0x1b10('0x1f')](_0x5b6abb['query'][_0x1b10('0x1f')]);_0x3b9bb2['offset']=qs[_0x1b10('0x21')](_0x5b6abb[_0x1b10('0x39')]['offset']);}_0x3b9bb2[_0x1b10('0x98')]=qs['sort'](_0x5b6abb[_0x1b10('0x39')]['sort']);_0x3b9bb2[_0x1b10('0x99')]=qs['filters'](_['pick'](_0x5b6abb[_0x1b10('0x39')],_0x2ca446['filters']));_0x3b9bb2[_0x1b10('0x99')]['ChatInteractionId']=_0x4a8d9c['id'];if(_0x5b6abb[_0x1b10('0x39')][_0x1b10('0x9a')]){_0x3b9bb2[_0x1b10('0x99')]=_[_0x1b10('0x2c')](_0x3b9bb2[_0x1b10('0x99')],{'$or':_[_0x1b10('0x30')](_0x3b9bb2[_0x1b10('0x3c')],function(_0x31c222){var _0x31f816={};_0x31f816[_0x31c222]={'$like':'%'+_0x5b6abb[_0x1b10('0x39')]['filter']+'%'};return _0x31f816;})});}if(_0x5b6abb[_0x1b10('0x39')]['$gte']){var _0x2b747c=_0x5b6abb[_0x1b10('0x39')]['$gte'][_0x1b10('0x9b')](',');var _0x4d14dd={};_0x4d14dd[_0x2b747c[0x0]]={'$gte':moment(_0x2b747c[0x1])[_0x1b10('0x77')](_0x1b10('0x9c'))};_0x3b9bb2[_0x1b10('0x99')]=_[_0x1b10('0x2c')](_0x3b9bb2[_0x1b10('0x99')],_0x4d14dd);}_0x3b9bb2=_[_0x1b10('0x2c')]({},_0x3b9bb2,_0x5b6abb['options']);return db[_0x1b10('0x5c')][_0x1b10('0x20')]({'where':_0x3b9bb2[_0x1b10('0x99')]})[_0x1b10('0x13')](function(_0x2f660b){_0xd69fa1['count']=_0x2f660b;if(_0x5b6abb[_0x1b10('0x39')][_0x1b10('0x3f')]){_0x3b9bb2['include']=[{'all':!![]}];}return db[_0x1b10('0x5c')]['findAll'](_0x3b9bb2);})['then'](function(_0x170110){_0xd69fa1[_0x1b10('0x9d')]=_0x170110;return _0xd69fa1;});}})['then'](respondWithFilteredResult(_0x246830,_0x3b9bb2))[_0x1b10('0x45')](handleError(_0x246830,null));};exports[_0x1b10('0x9e')]=function(_0x23daad,_0x3b2fef){var _0x38af3f={'where':{}},_0x4d6d89={},_0x4d1a44={'count':0x0,'rows':[]};return db[_0x1b10('0x42')][_0x1b10('0x48')]({'where':{'id':_0x23daad[_0x1b10('0x36')]['id']}})[_0x1b10('0x13')](handleEntityNotFound(_0x3b2fef,null))[_0x1b10('0x13')](function(_0x1f1e79){if(_0x1f1e79){_0x4d6d89[_0x1b10('0x37')]=_[_0x1b10('0x38')](db[_0x1b10('0x5c')][_0x1b10('0x31')]);_0x4d6d89[_0x1b10('0x39')]=_[_0x1b10('0x38')](_0x23daad[_0x1b10('0x39')]);_0x4d6d89[_0x1b10('0x3a')]=_[_0x1b10('0x3b')](_0x4d6d89[_0x1b10('0x37')],_0x4d6d89['query']);_0x38af3f['attributes']=_['intersection'](_0x4d6d89[_0x1b10('0x37')],qs[_0x1b10('0x3d')](_0x23daad[_0x1b10('0x39')]['fields']));_0x38af3f[_0x1b10('0x3c')]=_0x38af3f['attributes'][_0x1b10('0x3e')]?_0x38af3f[_0x1b10('0x3c')]:_0x4d6d89[_0x1b10('0x37')];if(!_0x23daad[_0x1b10('0x39')]['hasOwnProperty'](_0x1b10('0x97'))){_0x38af3f['limit']=qs[_0x1b10('0x1f')](_0x23daad[_0x1b10('0x39')]['limit']);_0x38af3f[_0x1b10('0x21')]=qs[_0x1b10('0x21')](_0x23daad[_0x1b10('0x39')][_0x1b10('0x21')]);}_0x38af3f['order']=qs[_0x1b10('0x9f')](_0x23daad[_0x1b10('0x39')][_0x1b10('0x9f')]);_0x38af3f[_0x1b10('0x99')]=qs[_0x1b10('0x3a')](_['pick'](_0x23daad[_0x1b10('0x39')],_0x4d6d89['filters']));_0x38af3f[_0x1b10('0x99')][_0x1b10('0xa0')]=_0x1f1e79['id'];if(_0x23daad[_0x1b10('0x39')][_0x1b10('0x9a')]){_0x38af3f['where']=_[_0x1b10('0x2c')](_0x38af3f[_0x1b10('0x99')],{'$or':_[_0x1b10('0x30')](_0x38af3f['attributes'],function(_0xc0b522){var _0x3d2484={};_0x3d2484[_0xc0b522]={'$like':'%'+_0x23daad['query'][_0x1b10('0x9a')]+'%'};return _0x3d2484;})});}_0x38af3f[_0x1b10('0x99')][_0x1b10('0xa1')]=![];if(_0x23daad[_0x1b10('0x39')]['id']){_0x38af3f[_0x1b10('0x99')]['id']={'$gt':_0x23daad['query']['id']};}_0x38af3f=_[_0x1b10('0x2c')]({},_0x38af3f,_0x23daad['options']);return db[_0x1b10('0x5c')][_0x1b10('0x20')]({'where':_0x38af3f[_0x1b10('0x99')]})[_0x1b10('0x13')](function(_0x4aa70f){_0x4d1a44[_0x1b10('0x20')]=_0x4aa70f;_0x38af3f['include']=[];if(_0x23daad[_0x1b10('0x39')]['includeAgent']){_0x38af3f[_0x1b10('0x40')][_0x1b10('0xa2')]({'model':db[_0x1b10('0x7c')],'as':'User','attributes':['id',_0x1b10('0x4f'),'alias']});}if(_0x23daad[_0x1b10('0x39')][_0x1b10('0x3f')]){_0x38af3f[_0x1b10('0x40')]=[{'all':!![]}];}return db[_0x1b10('0x5c')][_0x1b10('0x33')](_0x38af3f);})['then'](function(_0x16071){_0x4d1a44[_0x1b10('0x9d')]=_0x16071;return _0x4d1a44;});}})[_0x1b10('0x13')](respondWithFilteredResult(_0x3b2fef,_0x38af3f))[_0x1b10('0x45')](handleError(_0x3b2fef,null));};exports[_0x1b10('0xa3')]=function(_0x56b833,_0x6fca53){return db[_0x1b10('0x42')]['find']({'where':{'id':_0x56b833[_0x1b10('0x36')]['id']}})['then'](handleEntityNotFound(_0x6fca53,null))[_0x1b10('0x13')](function(_0x32a9d0){if(_0x32a9d0){return _0x32a9d0[_0x1b10('0xa4')](_0x56b833['body'][_0x1b10('0x93')],_[_0x1b10('0x94')](_0x56b833[_0x1b10('0x2d')],[_0x1b10('0x93'),'id'])||{})[_0x1b10('0xa5')](function(){return db[_0x1b10('0xa6')][_0x1b10('0x33')]({'attributes':['id',_0x1b10('0x2a'),'color'],'where':{'id':_0x56b833[_0x1b10('0x2d')][_0x1b10('0x93')]}});})[_0x1b10('0x13')](function(_0x489cb1){socket[_0x1b10('0xa7')]('chatInteractionTags:save',{'id':Number(_0x56b833[_0x1b10('0x36')]['id']),'tags':_0x489cb1||[]});return{'id':Number(_0x56b833['params']['id']),'tags':_0x489cb1||[]};});}})[_0x1b10('0x13')](respondWithResult(_0x6fca53,null))[_0x1b10('0x45')](handleError(_0x6fca53,null));};exports[_0x1b10('0xa8')]=function(_0x3ee788,_0x7b9a3b){return db['ChatInteraction'][_0x1b10('0x43')]({'where':{'id':_0x3ee788[_0x1b10('0x36')]['id']}})[_0x1b10('0x13')](handleEntityNotFound(_0x7b9a3b,null))['then'](function(_0x48fd96){if(_0x48fd96){return _0x48fd96['removeTags'](_0x3ee788['query'][_0x1b10('0x93')]);}})[_0x1b10('0x13')](respondWithStatusCode(_0x7b9a3b,null))[_0x1b10('0x45')](handleError(_0x7b9a3b,null));};exports[_0x1b10('0xa9')]=function(_0x4e2ac4,_0x45aa39){var _0x272224=moment()['unix']()[_0x1b10('0xaa')]();var _0x1c98ec=path[_0x1b10('0x73')](config[_0x1b10('0x74')],_0x1b10('0xab'),_0x1b10('0xac'),_0x1b10('0xad'));var _0x4f1b48=path[_0x1b10('0x73')](config[_0x1b10('0x74')],_0x1b10('0xab'),_0x1b10('0xac'),_0x1b10('0xae'));var _0x171ad7=path[_0x1b10('0x73')](_0x1c98ec,_0x272224);var _0x348520=util['format']('transcript-%d-%s.zip',_0x4e2ac4[_0x1b10('0x36')]['id'],_0x272224);var _0x38300c=path[_0x1b10('0x73')](_0x1c98ec,_0x348520);var _0x22772d=[];_0x22772d['push']({'model':db[_0x1b10('0x7c')],'as':'User','attributes':['id',_0x1b10('0x4f')],'raw':!![]});_0x22772d[_0x1b10('0xa2')]({'model':db['CmContact'],'as':_0x1b10('0x61'),'attributes':['id',_0x1b10('0xaf'),_0x1b10('0xb0')],'raw':!![]});if(_0x4e2ac4[_0x1b10('0x39')][_0x1b10('0xae')]){_0x22772d['push']({'model':db[_0x1b10('0x6e')],'as':'Attachment','raw':!![]});}var _0x48d2ec=[{'model':db[_0x1b10('0x5c')],'as':_0x1b10('0x7b'),'attributes':['id',_0x1b10('0x2d'),_0x1b10('0x87'),'direction','secret','read'],'include':_0x22772d}];_0x48d2ec[_0x1b10('0xa2')]({'model':db[_0x1b10('0x49')],'as':'Account','attributes':['id',_0x1b10('0x2a')]});_0x48d2ec[_0x1b10('0xa2')]({'model':db[_0x1b10('0x7c')],'as':_0x1b10('0xb1'),'attributes':['id',_0x1b10('0x4f')]});return db[_0x1b10('0x42')][_0x1b10('0x43')]({'where':{'id':_0x4e2ac4['params']['id']},'include':_0x48d2ec})[_0x1b10('0x13')](handleEntityNotFound(_0x45aa39,null))[_0x1b10('0x13')](function(_0x39a981){if(_0x39a981){var _0x591697=_0x39a981['get']({'plain':!![]});fs['mkdirSync'](_0x171ad7);var _0x144567={'channel':_0x1b10('0xb2'),'account':_0x591697[_0x1b10('0xb3')][_0x1b10('0x2a')],'agent':_0x591697[_0x1b10('0xb1')]?_0x591697[_0x1b10('0xb1')][_0x1b10('0x4f')]:'N.A.','createdAt':moment(_0x591697[_0x1b10('0x87')])[_0x1b10('0x77')](_0x1b10('0x9c'))[_0x1b10('0xaa')](),'closedAt':_0x591697[_0x1b10('0x67')]?moment(_0x591697[_0x1b10('0xb4')])[_0x1b10('0x77')](_0x1b10('0x9c'))[_0x1b10('0xaa')]():'','disposition':_0x591697['disposition'],'chatInfo':{'browser':_0x591697[_0x1b10('0xb5')],'os':_0x591697['osName'],'referer':_0x591697['referer'],'customerIp':_0x591697[_0x1b10('0xb6')],'customerPort':_0x591697['customerPort']?_0x591697[_0x1b10('0xb7')]:'N.A.'},'messages':_(_0x591697['Messages'])[_0x1b10('0xb8')]()['filter']({'secret':![]})[_0x1b10('0x30')](function(_0x33dfcf){if(_0x33dfcf[_0x1b10('0x6e')]){var _0x136596=path[_0x1b10('0x73')](_0x4f1b48,_0x33dfcf[_0x1b10('0x6e')][_0x1b10('0x6b')]);if(fs[_0x1b10('0xb9')](_0x136596)){fs[_0x1b10('0xba')](_0x136596)[_0x1b10('0xbb')](fs[_0x1b10('0xbc')](path[_0x1b10('0x73')](_0x171ad7,_0x33dfcf[_0x1b10('0x6e')]['basename'])));}}return{'date':moment(_0x33dfcf[_0x1b10('0x87')])[_0x1b10('0x77')](_0x1b10('0x9c'))[_0x1b10('0xaa')](),'sender':_0x33dfcf[_0x1b10('0x88')]===_0x1b10('0x5b')?_0x33dfcf[_0x1b10('0x7c')]?_0x33dfcf[_0x1b10('0x7c')][_0x1b10('0x4f')]:_0x1b10('0x7f'):_0x33dfcf['Contact'][_0x1b10('0xaf')]+(_0x33dfcf[_0x1b10('0x61')][_0x1b10('0xb0')]?'\x20'+_0x33dfcf[_0x1b10('0x61')][_0x1b10('0xb0')]:''),'body':_0x33dfcf[_0x1b10('0x6e')]?_0x33dfcf[_0x1b10('0x6e')][_0x1b10('0x6b')]:_0x33dfcf[_0x1b10('0x2d')],'direction':_0x33dfcf['direction']===_0x1b10('0x5b')?'A':'C','secret':_0x33dfcf[_0x1b10('0xa1')],'read':_0x33dfcf['read'],'attachment':_0x33dfcf[_0x1b10('0x6e')]};})[_0x1b10('0xbd')]()};return ejs[_0x1b10('0xbe')](path[_0x1b10('0x73')](config[_0x1b10('0x74')],_0x1b10('0xab'),_0x1b10('0xbf'),'downloadInteraction.ejs'),{'interaction':_0x144567})['then'](function(_0x844919){var _0x5a4952=path[_0x1b10('0x73')](_0x171ad7,_0x1b10('0xc0')+_0x591697['id']+'-'+_0x272224+_0x1b10('0xc1'));var _0x4f35e2={'path':_0x5a4952,'channel':_0x1b10('0xb2'),'interactionId':_0x591697['id']};return pdf[_0x1b10('0xc2')](_0x844919,_0x4f35e2);})[_0x1b10('0x13')](function(){return new Promise(function(_0x33ab61,_0x34e8b4){zipdir(_0x171ad7,{'saveTo':_0x38300c},function(_0x48b2c9,_0x49d174){if(_0x48b2c9)return _0x34e8b4(_0x48b2c9);return _0x33ab61(_0x49d174);});})[_0x1b10('0x13')](function(){return new BPromise(function(_0x4ea349,_0x5244eb){rimraf(_0x171ad7,function(_0x5addb0){if(_0x5addb0)_0x5244eb(_0x5addb0);return _0x4ea349();});});})[_0x1b10('0x13')](function(){return _0x45aa39[_0x1b10('0xa9')](_0x38300c,_0x348520,function(_0x60e660){if(_0x60e660){logger[_0x1b10('0x19')]('err',_0x60e660);}else{fs[_0x1b10('0xc3')](_0x38300c);}});});});}else{return _0x45aa39[_0x1b10('0x28')](0xc8);}})[_0x1b10('0x45')](handleError(_0x45aa39,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e1de71f..579fb4c 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 _0x9245=['setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x6d070a,_0x47e825){var _0x2c065d=function(_0xd0565c){while(--_0xd0565c){_0x6d070a['push'](_0x6d070a['shift']());}};_0x2c065d(++_0x47e825);}(_0x9245,0x7a));var _0x5924=function(_0x413e70,_0x41b477){_0x413e70=_0x413e70-0x0;var _0x4279c4=_0x9245[_0x413e70];return _0x4279c4;};'use strict';var EventEmitter=require(_0x5924('0x0'));var ChatInteraction=require(_0x5924('0x1'))['db'][_0x5924('0x2')];var ChatMessage=require(_0x5924('0x1'))['db'][_0x5924('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5924('0x4')](0x0);var events={'afterCreate':_0x5924('0x5'),'afterUpdate':'update','afterDestroy':_0x5924('0x6')};function emitEvent(_0xd85eeb){return function(_0x8b8d34,_0x2e1a00,_0x20addd){_0x8b8d34['getUsers']({'attributes':['id'],'raw':!![]})[_0x5924('0x7')](function(_0x5587e7){_0x8b8d34[_0x5924('0x8')](_0x5924('0x9'),_0x5587e7[_0x5924('0xa')](function(_0x40c486){return{'id':_0x40c486['id']};}));return ChatMessage[_0x5924('0xb')]({'where':{'ChatInteractionId':_0x8b8d34['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5924('0x7')](function(_0x35dac0){_0x8b8d34['setDataValue'](_0x5924('0xc'),_0x35dac0['length']);ChatInteractionEvents['emit'](_0xd85eeb+':'+_0x8b8d34['id'],_0x8b8d34);ChatInteractionEvents[_0x5924('0xd')](_0xd85eeb,_0x8b8d34);_0x20addd(null);})[_0x5924('0xe')](_0x20addd(null));};}for(var e in events){if(events[_0x5924('0xf')](e)){var event=events[e];ChatInteraction[_0x5924('0x10')](e,emitEvent(event));}}module[_0x5924('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x0436=['setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x21274e,_0x2cb032){var _0x1a8304=function(_0x55875a){while(--_0x55875a){_0x21274e['push'](_0x21274e['shift']());}};_0x1a8304(++_0x2cb032);}(_0x0436,0x165));var _0x6043=function(_0x55d603,_0x45634f){_0x55d603=_0x55d603-0x0;var _0x10bed4=_0x0436[_0x55d603];return _0x10bed4;};'use strict';var EventEmitter=require(_0x6043('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x6043('0x1')];var ChatMessage=require(_0x6043('0x2'))['db'][_0x6043('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6043('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6043('0x5'),'afterDestroy':_0x6043('0x6')};function emitEvent(_0x411bdd){return function(_0x4cea3c,_0x841389,_0x4e7e05){_0x4cea3c['getUsers']({'attributes':['id'],'raw':!![]})[_0x6043('0x7')](function(_0x4251bf){_0x4cea3c[_0x6043('0x8')](_0x6043('0x9'),_0x4251bf[_0x6043('0xa')](function(_0x5ab2ad){return{'id':_0x5ab2ad['id']};}));return ChatMessage[_0x6043('0xb')]({'where':{'ChatInteractionId':_0x4cea3c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6043('0x7')](function(_0xcd1ec1){_0x4cea3c['setDataValue'](_0x6043('0xc'),_0xcd1ec1[_0x6043('0xd')]);ChatInteractionEvents['emit'](_0x411bdd+':'+_0x4cea3c['id'],_0x4cea3c);ChatInteractionEvents[_0x6043('0xe')](_0x411bdd,_0x4cea3c);_0x4e7e05(null);})[_0x6043('0xf')](_0x4e7e05(null));};}for(var e in events){if(events[_0x6043('0x10')](e)){var event=events[e];ChatInteraction[_0x6043('0x11')](e,emitEvent(event));}}module[_0x6043('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c8bf27a..f483793 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 _0xe659=['format','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x56fc25,_0x47b52e){var _0x4f902f=function(_0x470d49){while(--_0x470d49){_0x56fc25['push'](_0x56fc25['shift']());}};_0x4f902f(++_0x47b52e);}(_0xe659,0xed));var _0x9e65=function(_0x202cca,_0x55984b){_0x202cca=_0x202cca-0x0;var _0x526ef9=_0xe659[_0x202cca];return _0x526ef9;};'use strict';var _=require(_0x9e65('0x0'));var util=require(_0x9e65('0x1'));var logger=require('../../config/logger')(_0x9e65('0x2'));var moment=require(_0x9e65('0x3'));var BPromise=require(_0x9e65('0x4'));var rp=require(_0x9e65('0x5'));var fs=require('fs');var path=require(_0x9e65('0x6'));var rimraf=require(_0x9e65('0x7'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x9e65('0x8')]=function(_0x53a2ac,_0x2d49bf){return _0x53a2ac[_0x9e65('0x9')](_0x9e65('0xa'),attributes,{'tableName':_0x9e65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49e9ae,_0x120c36,_0x358764){if(_0x49e9ae[_0x9e65('0xc')](_0x9e65('0xd'))){_0x49e9ae[_0x9e65('0xe')]=moment()[_0x9e65('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x358764(null,_0x49e9ae);}},'charset':_0x9e65('0x10'),'collate':_0x9e65('0x11')});}; \ No newline at end of file +var _0xd7e4=['closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatInteraction','changed'];(function(_0x42c61f,_0x462600){var _0x22f519=function(_0xce21b6){while(--_0xce21b6){_0x42c61f['push'](_0x42c61f['shift']());}};_0x22f519(++_0x462600);}(_0xd7e4,0x145));var _0x4d7e=function(_0x1cda4b,_0x20aa2d){_0x1cda4b=_0x1cda4b-0x0;var _0x25019c=_0xd7e4[_0x1cda4b];return _0x25019c;};'use strict';var _=require(_0x4d7e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d7e('0x1'));var moment=require(_0x4d7e('0x2'));var BPromise=require(_0x4d7e('0x3'));var rp=require(_0x4d7e('0x4'));var fs=require('fs');var path=require(_0x4d7e('0x5'));var rimraf=require(_0x4d7e('0x6'));var config=require(_0x4d7e('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x193d84,_0x39b0a4){return _0x193d84[_0x4d7e('0x8')](_0x4d7e('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xeddfdf,_0x2f0d0a,_0x5ed5e2){if(_0xeddfdf[_0x4d7e('0xa')](_0x4d7e('0xb'))){_0xeddfdf[_0x4d7e('0xc')]=moment()[_0x4d7e('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ed5e2(null,_0xeddfdf);}},'charset':_0x4d7e('0xe'),'collate':_0x4d7e('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 664cdc9..14d471c 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 _0xc602=['socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateChatInteraction','body','options','raw','where','attributes','info','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x15c318,_0xe4f819){var _0x27ec84=function(_0x1591c9){while(--_0x1591c9){_0x15c318['push'](_0x15c318['shift']());}};_0x27ec84(++_0xe4f819);}(_0xc602,0x13b));var _0x2c60=function(_0x4efed8,_0x67c8d2){_0x4efed8=_0x4efed8-0x0;var _0x2e0fc8=_0xc602[_0x4efed8];return _0x2e0fc8;};'use strict';var _=require(_0x2c60('0x0'));var util=require(_0x2c60('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c60('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c60('0x3'))['db'];var utils=require(_0x2c60('0x4'));var logger=require('../../config/logger')(_0x2c60('0x5'));var config=require(_0x2c60('0x6'));var jayson=require(_0x2c60('0x7'));var client=jayson[_0x2c60('0x8')][_0x2c60('0x9')]({'port':0x232a});config[_0x2c60('0xa')]=_[_0x2c60('0xb')](config['redis'],{'host':_0x2c60('0xc'),'port':0x18eb});var socket=require(_0x2c60('0xd'))(new Redis(config['redis']));require(_0x2c60('0xe'))[_0x2c60('0xf')](socket);function respondWithRpcPromise(_0x2c6cb3,_0x2bec0d,_0x8bfc20){return new BPromise(function(_0x1c971b,_0x5c7967){return client[_0x2c60('0x10')](_0x2c6cb3,_0x8bfc20)[_0x2c60('0x11')](function(_0x51b835){logger['info'](_0x2c60('0x12'),_0x2bec0d,_0x2c60('0x13'));logger[_0x2c60('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2bec0d,_0x2c60('0x13'),JSON[_0x2c60('0x15')](_0x51b835));if(_0x51b835[_0x2c60('0x16')]){if(_0x51b835[_0x2c60('0x16')][_0x2c60('0x17')]===0x1f4){logger['error'](_0x2c60('0x12'),_0x2bec0d,_0x51b835[_0x2c60('0x16')][_0x2c60('0x18')]);return _0x5c7967(_0x51b835[_0x2c60('0x16')][_0x2c60('0x18')]);}logger[_0x2c60('0x16')](_0x2c60('0x12'),_0x2bec0d,_0x51b835[_0x2c60('0x16')][_0x2c60('0x18')]);return _0x1c971b(_0x51b835[_0x2c60('0x16')]['message']);}else{logger['info'](_0x2c60('0x12'),_0x2bec0d,_0x2c60('0x13'));_0x1c971b(_0x51b835[_0x2c60('0x19')][_0x2c60('0x18')]);}})['catch'](function(_0x19363c){logger[_0x2c60('0x16')](_0x2c60('0x12'),_0x2bec0d,_0x19363c);_0x5c7967(_0x19363c);});});}exports[_0x2c60('0x1a')]=function(_0x54fd5c){var _0x294b68=this;return new Promise(function(_0x37d7f3,_0x3237e6){return db['ChatInteraction']['update'](_0x54fd5c[_0x2c60('0x1b')],{'raw':_0x54fd5c[_0x2c60('0x1c')]?_0x54fd5c[_0x2c60('0x1c')][_0x2c60('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54fd5c['options']?_0x54fd5c['options'][_0x2c60('0x1e')]||null:null,'attributes':_0x54fd5c['options']?_0x54fd5c[_0x2c60('0x1c')][_0x2c60('0x1f')]||null:null,'limit':_0x54fd5c['options']?_0x54fd5c['options']['limit']||null:null})[_0x2c60('0x11')](function(_0x3d29c1){logger[_0x2c60('0x20')]('UpdateChatInteraction',_0x54fd5c);logger[_0x2c60('0x14')](_0x2c60('0x1a'),_0x54fd5c,JSON['stringify'](_0x3d29c1));_0x37d7f3(_0x3d29c1);})['catch'](function(_0x364646){logger[_0x2c60('0x16')](_0x2c60('0x1a'),_0x364646[_0x2c60('0x18')],_0x54fd5c);_0x3237e6(_0x294b68[_0x2c60('0x16')](0x1f4,_0x364646[_0x2c60('0x18')]));});});};exports[_0x2c60('0x21')]=function(_0x2742fe){return new Promise(function(_0x3fd823,_0xba913a){return db['ChatInteraction'][_0x2c60('0x22')]({'where':_0x2742fe[_0x2c60('0x1c')]?_0x2742fe[_0x2c60('0x1c')][_0x2c60('0x1e')]||null:null})[_0x2c60('0x11')](function(_0x4bb205){if(_0x4bb205){return _0x4bb205[_0x2c60('0x23')](_0x2742fe['body'][_0x2c60('0x24')],_[_0x2c60('0x25')](_0x2742fe[_0x2c60('0x1b')],[_0x2c60('0x24'),'id'])||{});}})[_0x2c60('0x26')](function(_0x25b758){logger[_0x2c60('0x20')](_0x2c60('0x27'),_0x2742fe);logger['debug'](_0x2c60('0x27'),_0x2742fe,JSON[_0x2c60('0x15')](_0x25b758));_0x3fd823(_0x25b758);})[_0x2c60('0x28')](function(_0x26af1d){logger[_0x2c60('0x16')](_0x2c60('0x27'),_0x26af1d['message'],_0x2742fe);_0xba913a(_this[_0x2c60('0x16')](0x1f4,_0x26af1d[_0x2c60('0x18')]));});});}; \ No newline at end of file +var _0x411c=['error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','stringify','catch','AddTagsToChatInteraction','find','where','addTags','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5be52f,_0x24a872){var _0x529c08=function(_0x3d2370){while(--_0x3d2370){_0x5be52f['push'](_0x5be52f['shift']());}};_0x529c08(++_0x24a872);}(_0x411c,0x1aa));var _0xc411=function(_0x3c605f,_0x373d4f){_0x3c605f=_0x3c605f-0x0;var _0x41b53e=_0x411c[_0x3c605f];return _0x41b53e;};'use strict';var _=require(_0xc411('0x0'));var util=require(_0xc411('0x1'));var moment=require(_0xc411('0x2'));var BPromise=require(_0xc411('0x3'));var rs=require(_0xc411('0x4'));var fs=require('fs');var Redis=require(_0xc411('0x5'));var db=require(_0xc411('0x6'))['db'];var utils=require(_0xc411('0x7'));var logger=require(_0xc411('0x8'))('rpc');var config=require(_0xc411('0x9'));var jayson=require(_0xc411('0xa'));var client=jayson[_0xc411('0xb')][_0xc411('0xc')]({'port':0x232a});config[_0xc411('0xd')]=_[_0xc411('0xe')](config[_0xc411('0xd')],{'host':_0xc411('0xf'),'port':0x18eb});var socket=require(_0xc411('0x10'))(new Redis(config['redis']));require(_0xc411('0x11'))[_0xc411('0x12')](socket);function respondWithRpcPromise(_0x1eeb46,_0x51910d,_0x91e11a){return new BPromise(function(_0x5b520f,_0x5db147){return client['request'](_0x1eeb46,_0x91e11a)[_0xc411('0x13')](function(_0x24dbc1){logger[_0xc411('0x14')](_0xc411('0x15'),_0x51910d,_0xc411('0x16'));logger['debug'](_0xc411('0x17'),_0x51910d,_0xc411('0x16'),JSON['stringify'](_0x24dbc1));if(_0x24dbc1[_0xc411('0x18')]){if(_0x24dbc1[_0xc411('0x18')][_0xc411('0x19')]===0x1f4){logger[_0xc411('0x18')](_0xc411('0x15'),_0x51910d,_0x24dbc1[_0xc411('0x18')]['message']);return _0x5db147(_0x24dbc1[_0xc411('0x18')][_0xc411('0x1a')]);}logger[_0xc411('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x51910d,_0x24dbc1['error'][_0xc411('0x1a')]);return _0x5b520f(_0x24dbc1[_0xc411('0x18')][_0xc411('0x1a')]);}else{logger[_0xc411('0x14')](_0xc411('0x15'),_0x51910d,_0xc411('0x16'));_0x5b520f(_0x24dbc1[_0xc411('0x1b')][_0xc411('0x1a')]);}})['catch'](function(_0x1f96f9){logger[_0xc411('0x18')](_0xc411('0x15'),_0x51910d,_0x1f96f9);_0x5db147(_0x1f96f9);});});}exports[_0xc411('0x1c')]=function(_0x2dc86f){var _0x4dc629=this;return new Promise(function(_0x2c2638,_0x385999){return db[_0xc411('0x1d')][_0xc411('0x1e')](_0x2dc86f[_0xc411('0x1f')],{'raw':_0x2dc86f['options']?_0x2dc86f[_0xc411('0x20')][_0xc411('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc86f['options']?_0x2dc86f[_0xc411('0x20')]['where']||null:null,'attributes':_0x2dc86f[_0xc411('0x20')]?_0x2dc86f['options'][_0xc411('0x22')]||null:null,'limit':_0x2dc86f[_0xc411('0x20')]?_0x2dc86f[_0xc411('0x20')]['limit']||null:null})[_0xc411('0x13')](function(_0x4e5157){logger[_0xc411('0x14')](_0xc411('0x1c'),_0x2dc86f);logger['debug'](_0xc411('0x1c'),_0x2dc86f,JSON[_0xc411('0x23')](_0x4e5157));_0x2c2638(_0x4e5157);})[_0xc411('0x24')](function(_0x34f051){logger[_0xc411('0x18')](_0xc411('0x1c'),_0x34f051[_0xc411('0x1a')],_0x2dc86f);_0x385999(_0x4dc629[_0xc411('0x18')](0x1f4,_0x34f051[_0xc411('0x1a')]));});});};exports[_0xc411('0x25')]=function(_0x516db4){return new Promise(function(_0x36d73d,_0x1711fb){return db[_0xc411('0x1d')][_0xc411('0x26')]({'where':_0x516db4[_0xc411('0x20')]?_0x516db4[_0xc411('0x20')][_0xc411('0x27')]||null:null})[_0xc411('0x13')](function(_0x594f1d){if(_0x594f1d){return _0x594f1d[_0xc411('0x28')](_0x516db4[_0xc411('0x1f')][_0xc411('0x29')],_['omit'](_0x516db4[_0xc411('0x1f')],['ids','id'])||{});}})[_0xc411('0x2a')](function(_0x252295){logger[_0xc411('0x14')](_0xc411('0x2b'),_0x516db4);logger[_0xc411('0x2c')](_0xc411('0x2b'),_0x516db4,JSON['stringify'](_0x252295));_0x36d73d(_0x252295);})[_0xc411('0x24')](function(_0xab75bf){logger[_0xc411('0x18')](_0xc411('0x2b'),_0xab75bf[_0xc411('0x1a')],_0x516db4);_0x1711fb(_this[_0xc411('0x18')](0x1f4,_0xab75bf['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7ff7aa5..6f61707 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 _0xae99=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x2d195c,_0x149dfe){var _0x421536=function(_0x37bb0b){while(--_0x37bb0b){_0x2d195c['push'](_0x2d195c['shift']());}};_0x421536(++_0x149dfe);}(_0xae99,0x65));var _0x9ae9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xae99[_0x2d7f0e];return _0x110b07;};'use strict';var ChatInteractionEvents=require(_0x9ae9('0x0'));var events=[_0x9ae9('0x1'),_0x9ae9('0x2'),_0x9ae9('0x3')];function createListener(_0x575386,_0x226df3){return function(_0x2df105){_0x226df3[_0x9ae9('0x4')](_0x575386,_0x2df105);};}function removeListener(_0x20a381,_0x1f7194){return function(){ChatInteractionEvents[_0x9ae9('0x5')](_0x20a381,_0x1f7194);};}exports[_0x9ae9('0x6')]=function(_0x2134f){for(var _0x326b68=0x0,_0x3cd0e5=events[_0x9ae9('0x7')];_0x326b68<_0x3cd0e5;_0x326b68++){var _0x2b46ca=events[_0x326b68];var _0xf07958=createListener(_0x9ae9('0x8')+_0x2b46ca,_0x2134f);ChatInteractionEvents['on'](_0x2b46ca,_0xf07958);}}; \ No newline at end of file +var _0x0cad=['emit','removeListener','register','length','./chatInteraction.events','save','remove','update'];(function(_0x364cf8,_0x146b9b){var _0x6a59ee=function(_0x3d81eb){while(--_0x3d81eb){_0x364cf8['push'](_0x364cf8['shift']());}};_0x6a59ee(++_0x146b9b);}(_0x0cad,0x8c));var _0xd0ca=function(_0x508a3a,_0x2eff16){_0x508a3a=_0x508a3a-0x0;var _0x4cc5e2=_0x0cad[_0x508a3a];return _0x4cc5e2;};'use strict';var ChatInteractionEvents=require(_0xd0ca('0x0'));var events=[_0xd0ca('0x1'),_0xd0ca('0x2'),_0xd0ca('0x3')];function createListener(_0x5596cd,_0x3d1fec){return function(_0x473c52){_0x3d1fec[_0xd0ca('0x4')](_0x5596cd,_0x473c52);};}function removeListener(_0x507f74,_0x152914){return function(){ChatInteractionEvents[_0xd0ca('0x5')](_0x507f74,_0x152914);};}exports[_0xd0ca('0x6')]=function(_0x969cd1){for(var _0x2108e8=0x0,_0x1ddc7e=events[_0xd0ca('0x7')];_0x2108e8<_0x1ddc7e;_0x2108e8++){var _0x6ab9e8=events[_0x2108e8];var _0x20fa7d=createListener('chatInteraction:'+_0x6ab9e8,_0x969cd1);ChatInteractionEvents['on'](_0x6ab9e8,_0x20fa7d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e6f0427..886b51d 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 _0x2d4e=['tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','/:id/tags'];(function(_0x524aa3,_0x27fd37){var _0x58d52e=function(_0x2372ef){while(--_0x2372ef){_0x524aa3['push'](_0x524aa3['shift']());}};_0x58d52e(++_0x27fd37);}(_0x2d4e,0x7e));var _0xe2d4=function(_0x1b9ab0,_0x109212){_0x1b9ab0=_0x1b9ab0-0x0;var _0x476655=_0x2d4e[_0x1b9ab0];return _0x476655;};'use strict';var multer=require('multer');var util=require(_0xe2d4('0x0'));var path=require(_0xe2d4('0x1'));var timeout=require(_0xe2d4('0x2'));var express=require(_0xe2d4('0x3'));var router=express[_0xe2d4('0x4')]();var fs_extra=require(_0xe2d4('0x5'));var auth=require(_0xe2d4('0x6'));var interaction=require(_0xe2d4('0x7'));var config=require(_0xe2d4('0x8'));var controller=require('./chatInteraction.controller');router[_0xe2d4('0x9')]('/',auth[_0xe2d4('0xa')](),controller[_0xe2d4('0xb')]);router[_0xe2d4('0x9')](_0xe2d4('0xc'),auth[_0xe2d4('0xa')](),controller['describe']);router[_0xe2d4('0x9')]('/:id',auth[_0xe2d4('0xd')](),controller[_0xe2d4('0xe')]);router[_0xe2d4('0x9')](_0xe2d4('0xf'),auth[_0xe2d4('0xd')](),controller[_0xe2d4('0x10')]);router[_0xe2d4('0x9')]('/:id/messages',auth[_0xe2d4('0xa')](),controller[_0xe2d4('0x11')]);router['get'](_0xe2d4('0x12'),auth[_0xe2d4('0xd')](),controller['getMyMessages']);router[_0xe2d4('0x9')](_0xe2d4('0x13'),auth[_0xe2d4('0xa')](),controller[_0xe2d4('0x14')]);router[_0xe2d4('0x15')]('/',auth[_0xe2d4('0xa')](),controller['create']);router[_0xe2d4('0x15')](_0xe2d4('0x16'),auth[_0xe2d4('0xa')](),controller[_0xe2d4('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xe35ecd,_0x5b9d39,_0xd42aa7){_0xd42aa7(null,path[_0xe2d4('0x18')](config[_0xe2d4('0x19')],'server/files/attachments/'));},'filename':function(_0xc9f697,_0x4679d4,_0x259f90){_0x259f90(null,util[_0xe2d4('0x1a')](_0xe2d4('0x1b'),Date[_0xe2d4('0x1c')](),_0x4679d4[_0xe2d4('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe2d4('0x15')](_0xe2d4('0x1e'),upload[_0xe2d4('0x1f')](_0xe2d4('0x20')),controller[_0xe2d4('0x21')]);router[_0xe2d4('0x15')](_0xe2d4('0x22'),auth[_0xe2d4('0xd')](),controller['addMessage']);router[_0xe2d4('0x15')](_0xe2d4('0x23'),auth[_0xe2d4('0xa')](),interaction[_0xe2d4('0x24')](_0xe2d4('0x25'),_0xe2d4('0x26')),controller[_0xe2d4('0x27')]);router[_0xe2d4('0x28')](_0xe2d4('0x29'),auth[_0xe2d4('0xa')](),interaction[_0xe2d4('0x24')](_0xe2d4('0x25'),_0xe2d4('0x2a')),controller[_0xe2d4('0x2b')]);router[_0xe2d4('0x28')](_0xe2d4('0x2c'),controller[_0xe2d4('0x2d')]);router['put'](_0xe2d4('0x2e'),auth[_0xe2d4('0xd')](),controller[_0xe2d4('0x2f')]);router[_0xe2d4('0x28')](_0xe2d4('0x30'),controller[_0xe2d4('0x31')]);router[_0xe2d4('0x32')](_0xe2d4('0x29'),auth[_0xe2d4('0xa')](),interaction[_0xe2d4('0x24')](_0xe2d4('0x25'),'chatinteraction:destroy'),controller[_0xe2d4('0x33')]);router[_0xe2d4('0x32')](_0xe2d4('0x23'),auth[_0xe2d4('0xa')](),controller[_0xe2d4('0x34')]);module[_0xe2d4('0x35')]=router; \ No newline at end of file +var _0x4409=['../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','/:id','chat','chatinteraction:update','customUpdate','/:id/abandon','abandon','close','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e2447,_0x5fea89){var _0x306f03=function(_0x11ac2c){while(--_0x11ac2c){_0x1e2447['push'](_0x1e2447['shift']());}};_0x306f03(++_0x5fea89);}(_0x4409,0xfc));var _0x9440=function(_0x110885,_0xb4df07){_0x110885=_0x110885-0x0;var _0x57554e=_0x4409[_0x110885];return _0x57554e;};'use strict';var multer=require(_0x9440('0x0'));var util=require(_0x9440('0x1'));var path=require(_0x9440('0x2'));var timeout=require(_0x9440('0x3'));var express=require(_0x9440('0x4'));var router=express[_0x9440('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9440('0x6'));var interaction=require(_0x9440('0x7'));var config=require(_0x9440('0x8'));var controller=require(_0x9440('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9440('0xa')]);router[_0x9440('0xb')](_0x9440('0xc'),auth[_0x9440('0xd')](),controller[_0x9440('0xe')]);router[_0x9440('0xb')]('/:id',auth[_0x9440('0xf')](),controller[_0x9440('0x10')]);router[_0x9440('0xb')]('/:id/attachment_download',auth[_0x9440('0xf')](),controller['attachmentDownload']);router[_0x9440('0xb')](_0x9440('0x11'),auth[_0x9440('0xd')](),controller[_0x9440('0x12')]);router[_0x9440('0xb')]('/:id/my_messages',auth[_0x9440('0xf')](),controller[_0x9440('0x13')]);router[_0x9440('0xb')](_0x9440('0x14'),auth[_0x9440('0xd')](),controller[_0x9440('0x15')]);router[_0x9440('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9440('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x9440('0x17')]);var upload=multer({'storage':multer[_0x9440('0x18')]({'destination':function(_0x5b57ae,_0x4a41c5,_0xc5d2f4){_0xc5d2f4(null,path[_0x9440('0x19')](config[_0x9440('0x1a')],'server/files/attachments/'));},'filename':function(_0x5ee915,_0x1ff582,_0x5db085){_0x5db085(null,util[_0x9440('0x1b')](_0x9440('0x1c'),Date[_0x9440('0x1d')](),_0x1ff582[_0x9440('0x1e')][_0x9440('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9440('0x16')](_0x9440('0x20'),upload[_0x9440('0x21')]('file'),controller[_0x9440('0x22')]);router[_0x9440('0x16')](_0x9440('0x11'),auth[_0x9440('0xf')](),controller[_0x9440('0x23')]);router['post'](_0x9440('0x24'),auth[_0x9440('0xd')](),interaction[_0x9440('0x25')]('chat',_0x9440('0x26')),controller[_0x9440('0x27')]);router[_0x9440('0x28')](_0x9440('0x29'),auth[_0x9440('0xd')](),interaction['tracked'](_0x9440('0x2a'),_0x9440('0x2b')),controller['update']);router[_0x9440('0x28')]('/:id/custom_update',controller[_0x9440('0x2c')]);router[_0x9440('0x28')](_0x9440('0x2d'),auth[_0x9440('0xf')](),controller[_0x9440('0x2e')]);router[_0x9440('0x28')]('/:id/close',controller[_0x9440('0x2f')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x9440('0x25')](_0x9440('0x2a'),'chatinteraction:destroy'),controller[_0x9440('0x30')]);router[_0x9440('0x31')](_0x9440('0x24'),auth[_0x9440('0xd')](),controller[_0x9440('0x32')]);module[_0x9440('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 827d77c..c1c6afa 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 _0x57f0=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x2356e3,_0x3c1521){var _0x12e9f7=function(_0x47acc9){while(--_0x47acc9){_0x2356e3['push'](_0x2356e3['shift']());}};_0x12e9f7(++_0x3c1521);}(_0x57f0,0x1cf));var _0x057f=function(_0x5377a1,_0x22e1e4){_0x5377a1=_0x5377a1-0x0;var _0x45ff6f=_0x57f0[_0x5377a1];return _0x45ff6f;};'use strict';var Sequelize=require(_0x057f('0x0'));module['exports']={'body':{'type':Sequelize[_0x057f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x057f('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x057f('0x3')]}}; \ No newline at end of file +var _0xad71=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x906003,_0x338f10){var _0x2c6b80=function(_0x62db4a){while(--_0x62db4a){_0x906003['push'](_0x906003['shift']());}};_0x2c6b80(++_0x338f10);}(_0xad71,0x15d));var _0x1ad7=function(_0x1b3e9c,_0x137521){_0x1b3e9c=_0x1b3e9c-0x0;var _0x462959=_0xad71[_0x1b3e9c];return _0x462959;};'use strict';var Sequelize=require(_0x1ad7('0x0'));module[_0x1ad7('0x1')]={'body':{'type':Sequelize[_0x1ad7('0x2')](_0x1ad7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1ad7('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1ad7('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index dcd7dae..8029f2d 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 _0x85bc=['show','params','keys','catch','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','role','userpic','internal','online','showWebBar','-online','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','resourceId','push','FromId','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','options','count','includeAll','include','ChatInternalMessage','findAll','rows'];(function(_0x24e2df,_0x4c3296){var _0x10ed64=function(_0x3d425b){while(--_0x3d425b){_0x24e2df['push'](_0x24e2df['shift']());}};_0x10ed64(++_0x4c3296);}(_0x85bc,0x1d3));var _0xc85b=function(_0x80bb28,_0x42e117){_0x80bb28=_0x80bb28-0x0;var _0x3d1647=_0x85bc[_0x80bb28];return _0x3d1647;};'use strict';var emlformat=require(_0xc85b('0x0'));var rimraf=require(_0xc85b('0x1'));var zipdir=require(_0xc85b('0x2'));var jsonpatch=require(_0xc85b('0x3'));var rp=require(_0xc85b('0x4'));var moment=require(_0xc85b('0x5'));var BPromise=require(_0xc85b('0x6'));var Mustache=require('mustache');var util=require(_0xc85b('0x7'));var path=require(_0xc85b('0x8'));var sox=require(_0xc85b('0x9'));var csv=require(_0xc85b('0xa'));var ejs=require(_0xc85b('0xb'));var fs=require('fs');var fs_extra=require(_0xc85b('0xc'));var _=require('lodash');var squel=require(_0xc85b('0xd'));var crypto=require('crypto');var jsforce=require(_0xc85b('0xe'));var deskjs=require(_0xc85b('0xf'));var toCsv=require(_0xc85b('0xa'));var querystring=require(_0xc85b('0x10'));var Papa=require(_0xc85b('0x11'));var Redis=require(_0xc85b('0x12'));var authService=require(_0xc85b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc85b('0x14'));var hardwareService=require(_0xc85b('0x15'));var logger=require(_0xc85b('0x16'))(_0xc85b('0x17'));var utils=require(_0xc85b('0x18'));var config=require(_0xc85b('0x19'));var licenseUtil=require(_0xc85b('0x1a'));var db=require(_0xc85b('0x1b'))['db'];config[_0xc85b('0x1c')]=_[_0xc85b('0x1d')](config[_0xc85b('0x1c')],{'host':_0xc85b('0x1e'),'port':0x18eb});var socket=require(_0xc85b('0x1f'))(new Redis(config['redis']));require(_0xc85b('0x20'))[_0xc85b('0x21')](socket);function respondWithStatusCode(_0x14ec5,_0x2c6ecb){_0x2c6ecb=_0x2c6ecb||0xcc;return function(_0x7f3e0d){if(_0x7f3e0d){return _0x14ec5[_0xc85b('0x22')](_0x2c6ecb);}return _0x14ec5[_0xc85b('0x23')](_0x2c6ecb)['end']();};}function respondWithResult(_0x12f1f8,_0x22c2bf){_0x22c2bf=_0x22c2bf||0xc8;return function(_0x305353){if(_0x305353){return _0x12f1f8[_0xc85b('0x23')](_0x22c2bf)[_0xc85b('0x24')](_0x305353);}};}function respondWithFilteredResult(_0x4e4c44,_0x424eaf){return function(_0xaca2e5){if(_0xaca2e5){var _0x59c37a=typeof _0x424eaf[_0xc85b('0x25')]===_0xc85b('0x26')&&typeof _0x424eaf['limit']===_0xc85b('0x26');var _0x2130af=_0xaca2e5['count'];var _0x41fd1a=_0x59c37a?0x0:_0x424eaf[_0xc85b('0x25')];var _0x1c0510=_0x59c37a?_0xaca2e5['count']:_0x424eaf[_0xc85b('0x25')]+_0x424eaf[_0xc85b('0x27')];var _0x36f708;if(_0x1c0510>=_0x2130af){_0x1c0510=_0x2130af;_0x36f708=0xc8;}else{_0x36f708=0xce;}_0x4e4c44['status'](_0x36f708);return _0x4e4c44[_0xc85b('0x28')]('Content-Range',_0x41fd1a+'-'+_0x1c0510+'/'+_0x2130af)[_0xc85b('0x24')](_0xaca2e5);}return null;};}function patchUpdates(_0x305c5){return function(_0x380868){try{jsonpatch[_0xc85b('0x29')](_0x380868,_0x305c5,!![]);}catch(_0x12759f){return BPromise[_0xc85b('0x2a')](_0x12759f);}return _0x380868[_0xc85b('0x2b')]();};}function saveUpdates(_0x835fc4,_0x4b5c88){return function(_0x1f12be){if(_0x1f12be){return _0x1f12be[_0xc85b('0x2c')](_0x835fc4)[_0xc85b('0x2d')](function(_0x30ed12){return _0x30ed12;});}return null;};}function removeEntity(_0x17a3a5,_0x2ac2e4){return function(_0x319772){if(_0x319772){return _0x319772[_0xc85b('0x2e')]()[_0xc85b('0x2d')](function(){_0x17a3a5[_0xc85b('0x23')](0xcc)[_0xc85b('0x2f')]();});}};}function handleEntityNotFound(_0x348c9d,_0x4e8ef6){return function(_0x2926dc){if(!_0x2926dc){_0x348c9d[_0xc85b('0x22')](0x194);}return _0x2926dc;};}function handleError(_0x3f47a0,_0x2f71cf){_0x2f71cf=_0x2f71cf||0x1f4;return function(_0x4ec311){logger[_0xc85b('0x30')](_0x4ec311[_0xc85b('0x31')]);if(_0x4ec311[_0xc85b('0x32')]){delete _0x4ec311['name'];}_0x3f47a0[_0xc85b('0x23')](_0x2f71cf)[_0xc85b('0x33')](_0x4ec311);};}exports[_0xc85b('0x34')]=function(_0x44df5d,_0x558d42){var _0x30d21e={},_0x44733d={},_0x30d76d={'count':0x0,'rows':[]};var _0x3d70e9=_[_0xc85b('0x35')](db['ChatInternalMessage'][_0xc85b('0x36')],function(_0x18211b){return{'name':_0x18211b[_0xc85b('0x37')],'type':_0x18211b['type'][_0xc85b('0x38')]};});_0x44733d['model']=_[_0xc85b('0x35')](_0x3d70e9,_0xc85b('0x32'));_0x44733d[_0xc85b('0x39')]=_['keys'](_0x44df5d['query']);_0x44733d[_0xc85b('0x3a')]=_['intersection'](_0x44733d[_0xc85b('0x3b')],_0x44733d['query']);_0x30d21e[_0xc85b('0x3c')]=_[_0xc85b('0x3d')](_0x44733d[_0xc85b('0x3b')],qs[_0xc85b('0x3e')](_0x44df5d[_0xc85b('0x39')][_0xc85b('0x3e')]));_0x30d21e[_0xc85b('0x3c')]=_0x30d21e['attributes'][_0xc85b('0x3f')]?_0x30d21e[_0xc85b('0x3c')]:_0x44733d['model'];if(!_0x44df5d[_0xc85b('0x39')][_0xc85b('0x40')]('nolimit')){_0x30d21e[_0xc85b('0x27')]=qs[_0xc85b('0x27')](_0x44df5d['query']['limit']);_0x30d21e['offset']=qs[_0xc85b('0x25')](_0x44df5d[_0xc85b('0x39')][_0xc85b('0x25')]);}_0x30d21e[_0xc85b('0x41')]=qs[_0xc85b('0x42')](_0x44df5d[_0xc85b('0x39')][_0xc85b('0x42')]);_0x30d21e['where']=qs[_0xc85b('0x3a')](_['pick'](_0x44df5d['query'],_0x44733d[_0xc85b('0x3a')]),_0x3d70e9);if(_0x44df5d[_0xc85b('0x39')][_0xc85b('0x43')]){_0x30d21e[_0xc85b('0x44')]=_[_0xc85b('0x45')](_0x30d21e[_0xc85b('0x44')],{'$or':_[_0xc85b('0x35')](_0x3d70e9,function(_0x58a6b0){if(_0x58a6b0[_0xc85b('0x46')]!=='VIRTUAL'){var _0x3121d4={};_0x3121d4[_0x58a6b0[_0xc85b('0x32')]]={'$like':'%'+_0x44df5d['query'][_0xc85b('0x43')]+'%'};return _0x3121d4;}})});}_0x30d21e=_[_0xc85b('0x45')]({},_0x30d21e,_0x44df5d[_0xc85b('0x47')]);var _0x4a01e2={'where':_0x30d21e['where']};return db['ChatInternalMessage'][_0xc85b('0x48')](_0x4a01e2)['then'](function(_0x4e5fcc){_0x30d76d[_0xc85b('0x48')]=_0x4e5fcc;if(_0x44df5d[_0xc85b('0x39')][_0xc85b('0x49')]){_0x30d21e[_0xc85b('0x4a')]=[{'all':!![]}];}return db[_0xc85b('0x4b')][_0xc85b('0x4c')](_0x30d21e);})['then'](function(_0x130a31){_0x30d76d[_0xc85b('0x4d')]=_0x130a31;return _0x30d76d;})[_0xc85b('0x2d')](respondWithFilteredResult(_0x558d42,_0x30d21e))['catch'](handleError(_0x558d42,null));};exports[_0xc85b('0x4e')]=function(_0x34e834,_0x4f84ac){var _0x30315f={'raw':!![],'where':{'id':_0x34e834[_0xc85b('0x4f')]['id']}},_0x281b7d={};_0x281b7d[_0xc85b('0x3b')]=_[_0xc85b('0x50')](db[_0xc85b('0x4b')]['rawAttributes']);_0x281b7d['query']=_[_0xc85b('0x50')](_0x34e834[_0xc85b('0x39')]);_0x281b7d['filters']=_[_0xc85b('0x3d')](_0x281b7d[_0xc85b('0x3b')],_0x281b7d[_0xc85b('0x39')]);_0x30315f[_0xc85b('0x3c')]=_[_0xc85b('0x3d')](_0x281b7d[_0xc85b('0x3b')],qs['fields'](_0x34e834[_0xc85b('0x39')][_0xc85b('0x3e')]));_0x30315f[_0xc85b('0x3c')]=_0x30315f[_0xc85b('0x3c')][_0xc85b('0x3f')]?_0x30315f[_0xc85b('0x3c')]:_0x281b7d[_0xc85b('0x3b')];if(_0x34e834[_0xc85b('0x39')][_0xc85b('0x49')]){_0x30315f[_0xc85b('0x4a')]=[{'all':!![]}];}_0x30315f=_['merge']({},_0x30315f,_0x34e834[_0xc85b('0x47')]);return db[_0xc85b('0x4b')]['find'](_0x30315f)['then'](handleEntityNotFound(_0x4f84ac,null))[_0xc85b('0x2d')](respondWithResult(_0x4f84ac,null))[_0xc85b('0x51')](handleError(_0x4f84ac,null));};exports['create']=function(_0x93d803,_0x503ee8){return db[_0xc85b('0x4b')][_0xc85b('0x52')](_0x93d803['body'],{})[_0xc85b('0x2d')](respondWithResult(_0x503ee8,0xc9))['catch'](handleError(_0x503ee8,null));};exports[_0xc85b('0x2c')]=function(_0x1f1cb3,_0x2f429e){if(_0x1f1cb3[_0xc85b('0x53')]['id']){delete _0x1f1cb3['body']['id'];}return db[_0xc85b('0x4b')][_0xc85b('0x54')]({'where':{'id':_0x1f1cb3[_0xc85b('0x4f')]['id']}})[_0xc85b('0x2d')](handleEntityNotFound(_0x2f429e,null))[_0xc85b('0x2d')](saveUpdates(_0x1f1cb3[_0xc85b('0x53')],null))[_0xc85b('0x2d')](respondWithResult(_0x2f429e,null))['catch'](handleError(_0x2f429e,null));};exports[_0xc85b('0x2e')]=function(_0x503d25,_0x54ed72){return db[_0xc85b('0x4b')][_0xc85b('0x54')]({'where':{'id':_0x503d25[_0xc85b('0x4f')]['id']}})[_0xc85b('0x2d')](handleEntityNotFound(_0x54ed72,null))[_0xc85b('0x2d')](removeEntity(_0x54ed72,null))[_0xc85b('0x51')](handleError(_0x54ed72,null));};exports['describe']=function(_0x28b99b,_0xdd571e){return db[_0xc85b('0x4b')][_0xc85b('0x55')]()[_0xc85b('0x2d')](respondWithResult(_0xdd571e,null))[_0xc85b('0x51')](handleError(_0xdd571e,null));};function wrapUser(_0x3af645){return function(_0x44290e){var _0x205ac5=_0x3af645[_0xc85b('0x56')]({'plain':!![]});_0x205ac5[_0xc85b('0x57')]=[];if(_0x44290e){_0x205ac5[_0xc85b('0x58')]=_0x44290e[_0xc85b('0x59')];_0x205ac5[_0xc85b('0x5a')]=_0x44290e;}else{_0x205ac5[_0xc85b('0x58')]=moment(0x0)[_0xc85b('0x5b')](_0xc85b('0x5c'));_0x205ac5[_0xc85b('0x5a')]={};}return _0x205ac5;};}exports['getUsers']=function(_0x4c87d5,_0x3a9f74,_0x26228f){var _0x4f9473=[];return db['User'][_0xc85b('0x4c')]({'where':{'role':[_0xc85b('0x5d'),_0xc85b('0x5e'),'user']},'attributes':['id','fullname',_0xc85b('0x32'),_0xc85b('0x5f'),_0xc85b('0x60'),_0xc85b('0x61'),_0xc85b('0x62'),'lastLoginAt','allowmessenger',_0xc85b('0x63')],'order':qs[_0xc85b('0x42')](_0xc85b('0x64')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xc85b('0x32'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x5030c6){if(_0x5030c6){var _0x24b742=_0x4c87d5[_0xc85b('0x65')][_0xc85b('0x56')]({'plain':!![]});if(!_0x24b742)throw new Error(_0xc85b('0x66'));if(_0x24b742[_0xc85b('0x5f')]===_0xc85b('0x65')){return db['UserProfileSection']['find']({'where':{'name':_0xc85b('0x67'),'userProfileId':_0x24b742[_0xc85b('0x68')]},'raw':!![]})[_0xc85b('0x2d')](function(_0x206ef0){if(_0x206ef0){if(_0x206ef0['autoAssociation']===0x0){return db['UserProfileResource'][_0xc85b('0x4c')]({'where':{'sectionId':_0x206ef0['id']},'raw':!![]})[_0xc85b('0x2d')](function(_0x2687ae){var _0x100cfe=[];if(_['isEmpty'](_0x2687ae)){_0x100cfe=_[_0xc85b('0x43')](_0x5030c6,function(_0x406395){if(_0x406395[_0xc85b('0x5f')]!==_0xc85b('0x5d')){return _0x406395;}});return _0x100cfe;}else{for(var _0x86ff70=0x0;_0x86ff70<_0x5030c6[_0xc85b('0x3f')];_0x86ff70++){var _0x191b4e=_0x5030c6[_0x86ff70];if(_0x191b4e[_0xc85b('0x5f')]==='agent'){var _0x5a906b=_[_0xc85b('0x54')](_0x2687ae,function(_0x49f810){return _0x49f810[_0xc85b('0x69')]===_0x191b4e['id'];});if(_0x5a906b)_0x100cfe[_0xc85b('0x6a')](_0x191b4e);}else{_0x100cfe[_0xc85b('0x6a')](_0x191b4e);}}return _0x100cfe;}});}else{return _0x5030c6;}}else{var _0x510042=_[_0xc85b('0x43')](_0x5030c6,function(_0x4649a1){if(_0x4649a1[_0xc85b('0x5f')]!==_0xc85b('0x5d')){return _0x4649a1;}});return _0x510042;}});}else{return _0x5030c6;}}})[_0xc85b('0x2d')](function(_0x571e24){var _0x52a4c6=[];if(_0x571e24){_0x4f9473=_0x571e24;for(var _0x305611=0x0;_0x305611<_0x571e24[_0xc85b('0x3f')];_0x305611+=0x1){_0x4f9473[_0x305611][_0xc85b('0x57')]=[];_0x52a4c6['push'](db[_0xc85b('0x4b')][_0xc85b('0x54')]({'where':{'FromId':[_0x4c87d5[_0xc85b('0x65')]['id'],_0x571e24[_0x305611]['id']],'ToId':[_0x4c87d5[_0xc85b('0x65')]['id'],_0x571e24[_0x305611]['id']],'ChatGroupId':null},'attributes':['id',_0xc85b('0x59'),_0xc85b('0x6b'),'ToId','read',_0xc85b('0x53')],'order':qs[_0xc85b('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc85b('0x2d')](wrapUser(_0x571e24[_0x305611])));}return BPromise[_0xc85b('0x6c')](_0x52a4c6);}return[];})['then'](function(_0x1874f5){return{'rows':_0x1874f5,'count':_0x1874f5[_0xc85b('0x3f')]};})[_0xc85b('0x2d')](respondWithResult(_0x3a9f74,null))[_0xc85b('0x51')](handleError(_0x3a9f74,null));}; \ No newline at end of file +var _0xe9f4=['online','allowmessenger','showWebBar','-online','VoiceQueues','get','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','messages','createdAt','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','admin','user','fullname','role','userpic','internal'];(function(_0x4b0ee7,_0x1e07ac){var _0x3d8671=function(_0x50fe89){while(--_0x50fe89){_0x4b0ee7['push'](_0x4b0ee7['shift']());}};_0x3d8671(++_0x1e07ac);}(_0xe9f4,0x7e));var _0x4e9f=function(_0x292e05,_0x4593a9){_0x292e05=_0x292e05-0x0;var _0x44f63b=_0xe9f4[_0x292e05];return _0x44f63b;};'use strict';var emlformat=require(_0x4e9f('0x0'));var rimraf=require(_0x4e9f('0x1'));var zipdir=require(_0x4e9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e9f('0x3'));var moment=require(_0x4e9f('0x4'));var BPromise=require(_0x4e9f('0x5'));var Mustache=require(_0x4e9f('0x6'));var util=require('util');var path=require(_0x4e9f('0x7'));var sox=require(_0x4e9f('0x8'));var csv=require(_0x4e9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e9f('0xa'));var squel=require(_0x4e9f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4e9f('0xc'));var toCsv=require(_0x4e9f('0x9'));var querystring=require(_0x4e9f('0xd'));var Papa=require(_0x4e9f('0xe'));var Redis=require('ioredis');var authService=require(_0x4e9f('0xf'));var qs=require(_0x4e9f('0x10'));var as=require(_0x4e9f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4e9f('0x12'));var utils=require(_0x4e9f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x4e9f('0x14')],{'host':_0x4e9f('0x15'),'port':0x18eb});var socket=require(_0x4e9f('0x16'))(new Redis(config['redis']));require(_0x4e9f('0x17'))['register'](socket);function respondWithStatusCode(_0x179299,_0x4d6eef){_0x4d6eef=_0x4d6eef||0xcc;return function(_0x3e7515){if(_0x3e7515){return _0x179299[_0x4e9f('0x18')](_0x4d6eef);}return _0x179299[_0x4e9f('0x19')](_0x4d6eef)[_0x4e9f('0x1a')]();};}function respondWithResult(_0x121e08,_0x341428){_0x341428=_0x341428||0xc8;return function(_0x4572ec){if(_0x4572ec){return _0x121e08['status'](_0x341428)['json'](_0x4572ec);}};}function respondWithFilteredResult(_0x3a7571,_0x1ad9d7){return function(_0x5b987a){if(_0x5b987a){var _0x2d1c5d=typeof _0x1ad9d7['offset']==='undefined'&&typeof _0x1ad9d7[_0x4e9f('0x1b')]==='undefined';var _0x2f1ff2=_0x5b987a['count'];var _0x2dc579=_0x2d1c5d?0x0:_0x1ad9d7[_0x4e9f('0x1c')];var _0x2ae02b=_0x2d1c5d?_0x5b987a[_0x4e9f('0x1d')]:_0x1ad9d7['offset']+_0x1ad9d7[_0x4e9f('0x1b')];var _0xdf38fa;if(_0x2ae02b>=_0x2f1ff2){_0x2ae02b=_0x2f1ff2;_0xdf38fa=0xc8;}else{_0xdf38fa=0xce;}_0x3a7571[_0x4e9f('0x19')](_0xdf38fa);return _0x3a7571[_0x4e9f('0x1e')](_0x4e9f('0x1f'),_0x2dc579+'-'+_0x2ae02b+'/'+_0x2f1ff2)[_0x4e9f('0x20')](_0x5b987a);}return null;};}function patchUpdates(_0x596d44){return function(_0x31ac4b){try{jsonpatch['apply'](_0x31ac4b,_0x596d44,!![]);}catch(_0xece6db){return BPromise[_0x4e9f('0x21')](_0xece6db);}return _0x31ac4b[_0x4e9f('0x22')]();};}function saveUpdates(_0x59547c,_0x1b77de){return function(_0x2d4bd0){if(_0x2d4bd0){return _0x2d4bd0[_0x4e9f('0x23')](_0x59547c)[_0x4e9f('0x24')](function(_0x175aed){return _0x175aed;});}return null;};}function removeEntity(_0x1df6b9,_0x215326){return function(_0xd1d079){if(_0xd1d079){return _0xd1d079[_0x4e9f('0x25')]()[_0x4e9f('0x24')](function(){_0x1df6b9[_0x4e9f('0x19')](0xcc)[_0x4e9f('0x1a')]();});}};}function handleEntityNotFound(_0x1acb31,_0x4dd921){return function(_0x431754){if(!_0x431754){_0x1acb31[_0x4e9f('0x18')](0x194);}return _0x431754;};}function handleError(_0x226fb6,_0x3eddc6){_0x3eddc6=_0x3eddc6||0x1f4;return function(_0x158be1){logger[_0x4e9f('0x26')](_0x158be1[_0x4e9f('0x27')]);if(_0x158be1[_0x4e9f('0x28')]){delete _0x158be1[_0x4e9f('0x28')];}_0x226fb6[_0x4e9f('0x19')](_0x3eddc6)[_0x4e9f('0x29')](_0x158be1);};}exports[_0x4e9f('0x2a')]=function(_0x342c2c,_0x4688da){var _0x2e72df={},_0x36b73f={},_0x1dce7a={'count':0x0,'rows':[]};var _0x4a488c=_[_0x4e9f('0x2b')](db['ChatInternalMessage'][_0x4e9f('0x2c')],function(_0x6876b5){return{'name':_0x6876b5[_0x4e9f('0x2d')],'type':_0x6876b5[_0x4e9f('0x2e')]['key']};});_0x36b73f[_0x4e9f('0x2f')]=_['map'](_0x4a488c,_0x4e9f('0x28'));_0x36b73f[_0x4e9f('0x30')]=_['keys'](_0x342c2c[_0x4e9f('0x30')]);_0x36b73f[_0x4e9f('0x31')]=_[_0x4e9f('0x32')](_0x36b73f[_0x4e9f('0x2f')],_0x36b73f[_0x4e9f('0x30')]);_0x2e72df['attributes']=_['intersection'](_0x36b73f[_0x4e9f('0x2f')],qs[_0x4e9f('0x33')](_0x342c2c[_0x4e9f('0x30')]['fields']));_0x2e72df[_0x4e9f('0x34')]=_0x2e72df[_0x4e9f('0x34')][_0x4e9f('0x35')]?_0x2e72df[_0x4e9f('0x34')]:_0x36b73f[_0x4e9f('0x2f')];if(!_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x36')](_0x4e9f('0x37'))){_0x2e72df[_0x4e9f('0x1b')]=qs[_0x4e9f('0x1b')](_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x1b')]);_0x2e72df[_0x4e9f('0x1c')]=qs[_0x4e9f('0x1c')](_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x1c')]);}_0x2e72df[_0x4e9f('0x38')]=qs[_0x4e9f('0x39')](_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x39')]);_0x2e72df['where']=qs[_0x4e9f('0x31')](_[_0x4e9f('0x3a')](_0x342c2c['query'],_0x36b73f['filters']),_0x4a488c);if(_0x342c2c[_0x4e9f('0x30')]['filter']){_0x2e72df[_0x4e9f('0x3b')]=_[_0x4e9f('0x3c')](_0x2e72df['where'],{'$or':_[_0x4e9f('0x2b')](_0x4a488c,function(_0x320b9e){if(_0x320b9e['type']!=='VIRTUAL'){var _0x46ee49={};_0x46ee49[_0x320b9e['name']]={'$like':'%'+_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x3d')]+'%'};return _0x46ee49;}})});}_0x2e72df=_[_0x4e9f('0x3c')]({},_0x2e72df,_0x342c2c[_0x4e9f('0x3e')]);var _0x5ced54={'where':_0x2e72df[_0x4e9f('0x3b')]};return db[_0x4e9f('0x3f')][_0x4e9f('0x1d')](_0x5ced54)[_0x4e9f('0x24')](function(_0x438c61){_0x1dce7a[_0x4e9f('0x1d')]=_0x438c61;if(_0x342c2c[_0x4e9f('0x30')][_0x4e9f('0x40')]){_0x2e72df[_0x4e9f('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x4e9f('0x42')](_0x2e72df);})[_0x4e9f('0x24')](function(_0x2db321){_0x1dce7a[_0x4e9f('0x43')]=_0x2db321;return _0x1dce7a;})['then'](respondWithFilteredResult(_0x4688da,_0x2e72df))[_0x4e9f('0x44')](handleError(_0x4688da,null));};exports[_0x4e9f('0x45')]=function(_0x25e538,_0x260e79){var _0x40a825={'raw':!![],'where':{'id':_0x25e538[_0x4e9f('0x46')]['id']}},_0xe01289={};_0xe01289['model']=_[_0x4e9f('0x47')](db[_0x4e9f('0x3f')]['rawAttributes']);_0xe01289[_0x4e9f('0x30')]=_[_0x4e9f('0x47')](_0x25e538[_0x4e9f('0x30')]);_0xe01289[_0x4e9f('0x31')]=_['intersection'](_0xe01289[_0x4e9f('0x2f')],_0xe01289[_0x4e9f('0x30')]);_0x40a825['attributes']=_['intersection'](_0xe01289['model'],qs[_0x4e9f('0x33')](_0x25e538[_0x4e9f('0x30')][_0x4e9f('0x33')]));_0x40a825[_0x4e9f('0x34')]=_0x40a825[_0x4e9f('0x34')][_0x4e9f('0x35')]?_0x40a825[_0x4e9f('0x34')]:_0xe01289[_0x4e9f('0x2f')];if(_0x25e538[_0x4e9f('0x30')]['includeAll']){_0x40a825['include']=[{'all':!![]}];}_0x40a825=_[_0x4e9f('0x3c')]({},_0x40a825,_0x25e538[_0x4e9f('0x3e')]);return db[_0x4e9f('0x3f')][_0x4e9f('0x48')](_0x40a825)[_0x4e9f('0x24')](handleEntityNotFound(_0x260e79,null))[_0x4e9f('0x24')](respondWithResult(_0x260e79,null))['catch'](handleError(_0x260e79,null));};exports[_0x4e9f('0x49')]=function(_0xd2516b,_0x334155){return db[_0x4e9f('0x3f')][_0x4e9f('0x49')](_0xd2516b[_0x4e9f('0x4a')],{})[_0x4e9f('0x24')](respondWithResult(_0x334155,0xc9))[_0x4e9f('0x44')](handleError(_0x334155,null));};exports[_0x4e9f('0x23')]=function(_0x219939,_0xb127f4){if(_0x219939[_0x4e9f('0x4a')]['id']){delete _0x219939['body']['id'];}return db[_0x4e9f('0x3f')][_0x4e9f('0x48')]({'where':{'id':_0x219939['params']['id']}})[_0x4e9f('0x24')](handleEntityNotFound(_0xb127f4,null))[_0x4e9f('0x24')](saveUpdates(_0x219939[_0x4e9f('0x4a')],null))[_0x4e9f('0x24')](respondWithResult(_0xb127f4,null))['catch'](handleError(_0xb127f4,null));};exports['destroy']=function(_0x24b8d7,_0x380928){return db['ChatInternalMessage'][_0x4e9f('0x48')]({'where':{'id':_0x24b8d7['params']['id']}})['then'](handleEntityNotFound(_0x380928,null))[_0x4e9f('0x24')](removeEntity(_0x380928,null))[_0x4e9f('0x44')](handleError(_0x380928,null));};exports[_0x4e9f('0x4b')]=function(_0x1aa964,_0x338686){return db[_0x4e9f('0x3f')]['describe']()['then'](respondWithResult(_0x338686,null))[_0x4e9f('0x44')](handleError(_0x338686,null));};function wrapUser(_0x26254c){return function(_0xe5f1b7){var _0x38f7e3=_0x26254c['get']({'plain':!![]});_0x38f7e3['messages']=[];if(_0xe5f1b7){_0x38f7e3[_0x4e9f('0x4c')]=_0xe5f1b7['createdAt'];_0x38f7e3['lastMessage']=_0xe5f1b7;}else{_0x38f7e3[_0x4e9f('0x4c')]=moment(0x0)['format'](_0x4e9f('0x4d'));_0x38f7e3[_0x4e9f('0x4e')]={};}return _0x38f7e3;};}exports[_0x4e9f('0x4f')]=function(_0x18e3d5,_0x478c6e,_0x114345){var _0x3597f7=[];return db['User'][_0x4e9f('0x42')]({'where':{'role':['agent',_0x4e9f('0x50'),_0x4e9f('0x51')]},'attributes':['id',_0x4e9f('0x52'),'name',_0x4e9f('0x53'),_0x4e9f('0x54'),_0x4e9f('0x55'),_0x4e9f('0x56'),'lastLoginAt',_0x4e9f('0x57'),_0x4e9f('0x58')],'order':qs[_0x4e9f('0x39')](_0x4e9f('0x59')),'include':[{'model':db['VoiceQueue'],'as':_0x4e9f('0x5a'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x4e9f('0x24')](function(_0x556054){if(_0x556054){var _0x10736f=_0x18e3d5[_0x4e9f('0x51')][_0x4e9f('0x5b')]({'plain':!![]});if(!_0x10736f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10736f[_0x4e9f('0x53')]===_0x4e9f('0x51')){return db[_0x4e9f('0x5c')][_0x4e9f('0x48')]({'where':{'name':_0x4e9f('0x5d'),'userProfileId':_0x10736f[_0x4e9f('0x5e')]},'raw':!![]})[_0x4e9f('0x24')](function(_0x8b05a1){if(_0x8b05a1){if(_0x8b05a1[_0x4e9f('0x5f')]===0x0){return db[_0x4e9f('0x60')][_0x4e9f('0x42')]({'where':{'sectionId':_0x8b05a1['id']},'raw':!![]})[_0x4e9f('0x24')](function(_0x2fb0ef){var _0x57eebf=[];if(_[_0x4e9f('0x61')](_0x2fb0ef)){_0x57eebf=_['filter'](_0x556054,function(_0x5d8d58){if(_0x5d8d58[_0x4e9f('0x53')]!==_0x4e9f('0x62')){return _0x5d8d58;}});return _0x57eebf;}else{for(var _0x586615=0x0;_0x586615<_0x556054[_0x4e9f('0x35')];_0x586615++){var _0x32bd7f=_0x556054[_0x586615];if(_0x32bd7f[_0x4e9f('0x53')]===_0x4e9f('0x62')){var _0x8b00a9=_[_0x4e9f('0x48')](_0x2fb0ef,function(_0x1e2dc1){return _0x1e2dc1[_0x4e9f('0x63')]===_0x32bd7f['id'];});if(_0x8b00a9)_0x57eebf[_0x4e9f('0x64')](_0x32bd7f);}else{_0x57eebf[_0x4e9f('0x64')](_0x32bd7f);}}return _0x57eebf;}});}else{return _0x556054;}}else{var _0xc114c5=_[_0x4e9f('0x3d')](_0x556054,function(_0x312c35){if(_0x312c35[_0x4e9f('0x53')]!=='agent'){return _0x312c35;}});return _0xc114c5;}});}else{return _0x556054;}}})['then'](function(_0x3a654e){var _0x352848=[];if(_0x3a654e){_0x3597f7=_0x3a654e;for(var _0x5b2599=0x0;_0x5b2599<_0x3a654e[_0x4e9f('0x35')];_0x5b2599+=0x1){_0x3597f7[_0x5b2599][_0x4e9f('0x65')]=[];_0x352848[_0x4e9f('0x64')](db[_0x4e9f('0x3f')][_0x4e9f('0x48')]({'where':{'FromId':[_0x18e3d5[_0x4e9f('0x51')]['id'],_0x3a654e[_0x5b2599]['id']],'ToId':[_0x18e3d5[_0x4e9f('0x51')]['id'],_0x3a654e[_0x5b2599]['id']],'ChatGroupId':null},'attributes':['id',_0x4e9f('0x66'),'FromId','ToId',_0x4e9f('0x67'),'body'],'order':qs[_0x4e9f('0x39')](_0x4e9f('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4e9f('0x24')](wrapUser(_0x3a654e[_0x5b2599])));}return BPromise[_0x4e9f('0x69')](_0x352848);}return[];})[_0x4e9f('0x24')](function(_0x2b8a7e){return{'rows':_0x2b8a7e,'count':_0x2b8a7e[_0x4e9f('0x35')]};})[_0x4e9f('0x24')](respondWithResult(_0x478c6e,null))[_0x4e9f('0x44')](handleError(_0x478c6e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d72b3f1..4f4ccee 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 _0x8138=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage'];(function(_0xa74c4f,_0x200ef9){var _0x41e912=function(_0x481bdc){while(--_0x481bdc){_0xa74c4f['push'](_0xa74c4f['shift']());}};_0x41e912(++_0x200ef9);}(_0x8138,0x155));var _0x8813=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x8138[_0xcf5436];return _0xc4f5c8;};'use strict';var EventEmitter=require(_0x8813('0x0'));var ChatInternalMessage=require(_0x8813('0x1'))['db'][_0x8813('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8813('0x3'),'afterUpdate':_0x8813('0x4'),'afterDestroy':_0x8813('0x5')};function emitEvent(_0x6411ad){return function(_0xfad3f8,_0x503c53,_0x4e1e0a){ChatInternalMessageEvents[_0x8813('0x6')](_0x6411ad+':'+_0xfad3f8['id'],_0xfad3f8);ChatInternalMessageEvents[_0x8813('0x6')](_0x6411ad,_0xfad3f8);_0x4e1e0a(null);};}for(var e in events){if(events[_0x8813('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xa435=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xcab4be,_0x192811){var _0xc8afb3=function(_0x479540){while(--_0x479540){_0xcab4be['push'](_0xcab4be['shift']());}};_0xc8afb3(++_0x192811);}(_0xa435,0x65));var _0x5a43=function(_0x1982d4,_0x1443d2){_0x1982d4=_0x1982d4-0x0;var _0x19ac82=_0xa435[_0x1982d4];return _0x19ac82;};'use strict';var EventEmitter=require(_0x5a43('0x0'));var ChatInternalMessage=require(_0x5a43('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5a43('0x2')](0x0);var events={'afterCreate':_0x5a43('0x3'),'afterUpdate':_0x5a43('0x4'),'afterDestroy':_0x5a43('0x5')};function emitEvent(_0x27850d){return function(_0x4722c8,_0x1c860e,_0x4e0a82){ChatInternalMessageEvents[_0x5a43('0x6')](_0x27850d+':'+_0x4722c8['id'],_0x4722c8);ChatInternalMessageEvents[_0x5a43('0x6')](_0x27850d,_0x4722c8);_0x4e0a82(null);};}for(var e in events){if(events[_0x5a43('0x7')](e)){var event=events[e];ChatInternalMessage[_0x5a43('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 04a90b4..39d4e08 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 _0x66cb=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x66cb,0x16a));var _0xb66c=function(_0x2b988d,_0xdcdab6){_0x2b988d=_0x2b988d-0x0;var _0x10da37=_0x66cb[_0x2b988d];return _0x10da37;};'use strict';var _=require(_0xb66c('0x0'));var util=require(_0xb66c('0x1'));var logger=require(_0xb66c('0x2'))('api');var moment=require(_0xb66c('0x3'));var BPromise=require(_0xb66c('0x4'));var rp=require(_0xb66c('0x5'));var fs=require('fs');var path=require(_0xb66c('0x6'));var rimraf=require(_0xb66c('0x7'));var config=require(_0xb66c('0x8'));var attributes=require(_0xb66c('0x9'));module['exports']=function(_0x4314ca,_0x587536){return _0x4314ca[_0xb66c('0xa')](_0xb66c('0xb'),attributes,{'tableName':_0xb66c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae99=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci'];(function(_0x8ad45d,_0x2c14cd){var _0x1c31b0=function(_0x278393){while(--_0x278393){_0x8ad45d['push'](_0x8ad45d['shift']());}};_0x1c31b0(++_0x2c14cd);}(_0xae99,0x1ce));var _0x9ae9=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xae99[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ae9('0x0'))(_0x9ae9('0x1'));var moment=require(_0x9ae9('0x2'));var BPromise=require(_0x9ae9('0x3'));var rp=require(_0x9ae9('0x4'));var fs=require('fs');var path=require(_0x9ae9('0x5'));var rimraf=require(_0x9ae9('0x6'));var config=require(_0x9ae9('0x7'));var attributes=require(_0x9ae9('0x8'));module[_0x9ae9('0x9')]=function(_0x23da04,_0x2045b9){return _0x23da04[_0x9ae9('0xa')](_0x9ae9('0xb'),attributes,{'tableName':_0x9ae9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9ae9('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9b3e39f..39fb3e6 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 _0x95d3=['lodash','util','ioredis','../../mysqldb','rpc','jayson/promise','client','defaults','redis','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x95d3,0x138));var _0x395d=function(_0x91cfac,_0x10b899){_0x91cfac=_0x91cfac-0x0;var _0x2b0664=_0x95d3[_0x91cfac];return _0x2b0664;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x395d('0x2'));var db=require(_0x395d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x395d('0x4'));var config=require('../../config/environment');var jayson=require(_0x395d('0x5'));var client=jayson[_0x395d('0x6')]['http']({'port':0x232a});config['redis']=_[_0x395d('0x7')](config[_0x395d('0x8')],{'host':_0x395d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x395d('0x8')]));require(_0x395d('0xa'))[_0x395d('0xb')](socket);function respondWithRpcPromise(_0x671bf,_0x45935b,_0x8a85ee){return new BPromise(function(_0xb203d6,_0x52c3ab){return client['request'](_0x671bf,_0x8a85ee)[_0x395d('0xc')](function(_0x13ee2a){logger[_0x395d('0xd')](_0x395d('0xe'),_0x45935b,_0x395d('0xf'));logger[_0x395d('0x10')](_0x395d('0x11'),_0x45935b,_0x395d('0xf'),JSON[_0x395d('0x12')](_0x13ee2a));if(_0x13ee2a[_0x395d('0x13')]){if(_0x13ee2a[_0x395d('0x13')][_0x395d('0x14')]===0x1f4){logger[_0x395d('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x45935b,_0x13ee2a['error'][_0x395d('0x15')]);return _0x52c3ab(_0x13ee2a[_0x395d('0x13')][_0x395d('0x15')]);}logger[_0x395d('0x13')](_0x395d('0xe'),_0x45935b,_0x13ee2a[_0x395d('0x13')]['message']);return _0xb203d6(_0x13ee2a[_0x395d('0x13')][_0x395d('0x15')]);}else{logger['info'](_0x395d('0xe'),_0x45935b,_0x395d('0xf'));_0xb203d6(_0x13ee2a[_0x395d('0x16')][_0x395d('0x15')]);}})[_0x395d('0x17')](function(_0xf09aca){logger[_0x395d('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x45935b,_0xf09aca);_0x52c3ab(_0xf09aca);});});} \ No newline at end of file +var _0xf0db=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0xf0db,0x12b));var _0xbf0d=function(_0x3ea931,_0x39c535){_0x3ea931=_0x3ea931-0x0;var _0x2089f0=_0xf0db[_0x3ea931];return _0x2089f0;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var moment=require('moment');var BPromise=require(_0xbf0d('0x2'));var rs=require(_0xbf0d('0x3'));var fs=require('fs');var Redis=require(_0xbf0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf0d('0x5'));var logger=require(_0xbf0d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbf0d('0x7'));var client=jayson[_0xbf0d('0x8')][_0xbf0d('0x9')]({'port':0x232a});config[_0xbf0d('0xa')]=_['defaults'](config[_0xbf0d('0xa')],{'host':_0xbf0d('0xb'),'port':0x18eb});var socket=require(_0xbf0d('0xc'))(new Redis(config[_0xbf0d('0xa')]));require(_0xbf0d('0xd'))[_0xbf0d('0xe')](socket);function respondWithRpcPromise(_0x154401,_0xb7715f,_0x55cb8f){return new BPromise(function(_0x5a28a3,_0x170113){return client[_0xbf0d('0xf')](_0x154401,_0x55cb8f)[_0xbf0d('0x10')](function(_0x290a56){logger[_0xbf0d('0x11')](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));logger[_0xbf0d('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xb7715f,_0xbf0d('0x13'),JSON[_0xbf0d('0x15')](_0x290a56));if(_0x290a56['error']){if(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x17')]===0x1f4){logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x170113(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}logger[_0xbf0d('0x16')](_0xbf0d('0x12'),_0xb7715f,_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);return _0x5a28a3(_0x290a56[_0xbf0d('0x16')][_0xbf0d('0x18')]);}else{logger['info'](_0xbf0d('0x12'),_0xb7715f,_0xbf0d('0x13'));_0x5a28a3(_0x290a56[_0xbf0d('0x19')][_0xbf0d('0x18')]);}})[_0xbf0d('0x1a')](function(_0x35166e){logger[_0xbf0d('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0xb7715f,_0x35166e);_0x170113(_0x35166e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d317115..0c88748 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 _0x0a10=['update','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0xcec18a,_0x663b4f){var _0x52d111=function(_0x23a999){while(--_0x23a999){_0xcec18a['push'](_0xcec18a['shift']());}};_0x52d111(++_0x663b4f);}(_0x0a10,0xc4));var _0x00a1=function(_0x15c0d0,_0x34a6ab){_0x15c0d0=_0x15c0d0-0x0;var _0xbd8ae=_0x0a10[_0x15c0d0];return _0xbd8ae;};'use strict';var ChatInternalMessageEvents=require(_0x00a1('0x0'));var events=[_0x00a1('0x1'),'remove',_0x00a1('0x2')];function createListener(_0x4ad207,_0x121bc7){return function(_0x1d723c){_0x121bc7['emit'](_0x4ad207,_0x1d723c);};}function removeListener(_0x17c7fc,_0x4a8205){return function(){ChatInternalMessageEvents['removeListener'](_0x17c7fc,_0x4a8205);};}exports[_0x00a1('0x3')]=function(_0x1922b9){for(var _0x47cb08=0x0,_0x53a405=events[_0x00a1('0x4')];_0x47cb08<_0x53a405;_0x47cb08++){var _0x4673fc=events[_0x47cb08];var _0x45987e=createListener(_0x00a1('0x5')+_0x4673fc,_0x1922b9);ChatInternalMessageEvents['on'](_0x4673fc,_0x45987e);}}; \ No newline at end of file +var _0xb185=['remove','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x159899,_0xc27e56){var _0x584903=function(_0x3ec78e){while(--_0x3ec78e){_0x159899['push'](_0x159899['shift']());}};_0x584903(++_0xc27e56);}(_0xb185,0x6f));var _0x5b18=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb185[_0x3ab51d];return _0x29a04e;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x5b18('0x0'),_0x5b18('0x1'),'update'];function createListener(_0x153ff1,_0x508c57){return function(_0x3dac4e){_0x508c57[_0x5b18('0x2')](_0x153ff1,_0x3dac4e);};}function removeListener(_0x526e99,_0xc7d6a6){return function(){ChatInternalMessageEvents[_0x5b18('0x3')](_0x526e99,_0xc7d6a6);};}exports[_0x5b18('0x4')]=function(_0x2c9f90){for(var _0x484ece=0x0,_0x198eec=events[_0x5b18('0x5')];_0x484ece<_0x198eec;_0x484ece++){var _0x10cf5a=events[_0x484ece];var _0x5da6c1=createListener(_0x5b18('0x6')+_0x10cf5a,_0x2c9f90);ChatInternalMessageEvents['on'](_0x10cf5a,_0x5da6c1);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2473abf..ed88fc8 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 _0xd412=['show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers'];(function(_0x46bec2,_0x36cde0){var _0x39b857=function(_0xf29a34){while(--_0xf29a34){_0x46bec2['push'](_0x46bec2['shift']());}};_0x39b857(++_0x36cde0);}(_0xd412,0x132));var _0x2d41=function(_0x331ce0,_0xe335b9){_0x331ce0=_0x331ce0-0x0;var _0x31c3c7=_0xd412[_0x331ce0];return _0x31c3c7;};'use strict';var multer=require(_0x2d41('0x0'));var util=require(_0x2d41('0x1'));var path=require(_0x2d41('0x2'));var timeout=require(_0x2d41('0x3'));var express=require(_0x2d41('0x4'));var router=express['Router']();var fs_extra=require(_0x2d41('0x5'));var auth=require(_0x2d41('0x6'));var interaction=require(_0x2d41('0x7'));var config=require(_0x2d41('0x8'));var controller=require(_0x2d41('0x9'));router[_0x2d41('0xa')]('/',auth[_0x2d41('0xb')](),controller[_0x2d41('0xc')]);router[_0x2d41('0xa')](_0x2d41('0xd'),auth[_0x2d41('0xb')](),controller['describe']);router[_0x2d41('0xa')](_0x2d41('0xe'),auth[_0x2d41('0xb')](),controller[_0x2d41('0xf')]);router[_0x2d41('0xa')]('/:id',auth[_0x2d41('0xb')](),controller[_0x2d41('0x10')]);router[_0x2d41('0x11')]('/',auth[_0x2d41('0xb')](),controller[_0x2d41('0x12')]);router[_0x2d41('0x13')](_0x2d41('0x14'),controller['update']);router['delete']('/:id',auth[_0x2d41('0xb')](),controller[_0x2d41('0x15')]);module[_0x2d41('0x16')]=router; \ No newline at end of file +var _0xb894=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','create','update','destroy','exports'];(function(_0x225605,_0x53603b){var _0x408d2a=function(_0x455828){while(--_0x455828){_0x225605['push'](_0x225605['shift']());}};_0x408d2a(++_0x53603b);}(_0xb894,0xf0));var _0x4b89=function(_0x4c55c2,_0x5dde7e){_0x4c55c2=_0x4c55c2-0x0;var _0x469bab=_0xb894[_0x4c55c2];return _0x469bab;};'use strict';var multer=require(_0x4b89('0x0'));var util=require('util');var path=require(_0x4b89('0x1'));var timeout=require(_0x4b89('0x2'));var express=require(_0x4b89('0x3'));var router=express[_0x4b89('0x4')]();var fs_extra=require(_0x4b89('0x5'));var auth=require(_0x4b89('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b89('0x7'));router[_0x4b89('0x8')]('/',auth[_0x4b89('0x9')](),controller[_0x4b89('0xa')]);router[_0x4b89('0x8')](_0x4b89('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4b89('0x8')](_0x4b89('0xc'),auth[_0x4b89('0x9')](),controller[_0x4b89('0xd')]);router['get'](_0x4b89('0xe'),auth['isAuthenticated'](),controller[_0x4b89('0xf')]);router['post']('/',auth[_0x4b89('0x9')](),controller[_0x4b89('0x10')]);router['put'](_0x4b89('0xe'),controller[_0x4b89('0x11')]);router['delete'](_0x4b89('0xe'),auth[_0x4b89('0x9')](),controller[_0x4b89('0x12')]);module[_0x4b89('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index d37905b..34e0b84 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 _0x93e9=['BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x2f88ca,_0x2af291){var _0x3dab90=function(_0x2402d1){while(--_0x2402d1){_0x2f88ca['push'](_0x2f88ca['shift']());}};_0x3dab90(++_0x2af291);}(_0x93e9,0xcc));var _0x993e=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0x93e9[_0x31cb77];return _0x710374;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'body':{'type':Sequelize[_0x993e('0x2')](_0x993e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993e('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x993e('0x6')]},'providerName':{'type':Sequelize[_0x993e('0x7')]},'providerResponse':{'type':Sequelize[_0x993e('0x2')]}}; \ No newline at end of file +var _0x9a2d=['out','DATE','STRING','TEXT','BOOLEAN','ENUM'];(function(_0x54c0e2,_0x13a3de){var _0xece132=function(_0x371c5f){while(--_0x371c5f){_0x54c0e2['push'](_0x54c0e2['shift']());}};_0xece132(++_0x13a3de);}(_0x9a2d,0x123));var _0xd9a2=function(_0x86ea4f,_0x9ee78){_0x86ea4f=_0x86ea4f-0x0;var _0x2b2cc7=_0x9a2d[_0x86ea4f];return _0x2b2cc7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd9a2('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd9a2('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9a2('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9a2('0x2')]('in',_0xd9a2('0x3')),'defaultValue':_0xd9a2('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9a2('0x4')]},'providerName':{'type':Sequelize[_0xd9a2('0x5')]},'providerResponse':{'type':Sequelize[_0xd9a2('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4ae862e..dae24ad 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 _0xa901=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','end','stack','name','index','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','update','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','QueryTypes','internal','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status'];(function(_0x439a81,_0x4338d3){var _0x17bebe=function(_0xe7eef9){while(--_0xe7eef9){_0x439a81['push'](_0x439a81['shift']());}};_0x17bebe(++_0x4338d3);}(_0xa901,0x1ed));var _0x1a90=function(_0x567326,_0x7c32a2){_0x567326=_0x567326-0x0;var _0xcf0ba2=_0xa901[_0x567326];return _0xcf0ba2;};'use strict';var emlformat=require(_0x1a90('0x0'));var rimraf=require(_0x1a90('0x1'));var zipdir=require(_0x1a90('0x2'));var jsonpatch=require(_0x1a90('0x3'));var rp=require(_0x1a90('0x4'));var moment=require('moment');var BPromise=require(_0x1a90('0x5'));var Mustache=require(_0x1a90('0x6'));var util=require('util');var path=require(_0x1a90('0x7'));var sox=require(_0x1a90('0x8'));var csv=require(_0x1a90('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a90('0xa'));var _=require(_0x1a90('0xb'));var squel=require(_0x1a90('0xc'));var crypto=require(_0x1a90('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1a90('0xe'));var Papa=require(_0x1a90('0xf'));var Redis=require(_0x1a90('0x10'));var authService=require(_0x1a90('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1a90('0x12'));var hardwareService=require(_0x1a90('0x13'));var logger=require(_0x1a90('0x14'))(_0x1a90('0x15'));var utils=require(_0x1a90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1a90('0x17'));var db=require('../../mysqldb')['db'];config[_0x1a90('0x18')]=_[_0x1a90('0x19')](config[_0x1a90('0x18')],{'host':_0x1a90('0x1a'),'port':0x18eb});var socket=require(_0x1a90('0x1b'))(new Redis(config['redis']));require(_0x1a90('0x1c'))[_0x1a90('0x1d')](socket);var jayson=require(_0x1a90('0x1e'));var client=jayson[_0x1a90('0x1f')][_0x1a90('0x20')]({'port':0x232c});var client9002=jayson[_0x1a90('0x1f')][_0x1a90('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x6c7cb5,_0x21d486,_0x2a0add,_0x53eaf9){return new BPromise(function(_0x143837,_0x1be7e5){var _0x5381cc=_0x53eaf9||client;return _0x5381cc[_0x1a90('0x21')](_0x6c7cb5,_0x2a0add)[_0x1a90('0x22')](function(_0x2d9504){logger[_0x1a90('0x23')]('ChatMessage,\x20%s,\x20%s',_0x21d486,_0x1a90('0x24'));logger[_0x1a90('0x25')](_0x1a90('0x26'),_0x21d486,_0x1a90('0x24'),JSON['stringify'](_0x2d9504));if(_0x2d9504[_0x1a90('0x27')]){if(_0x2d9504[_0x1a90('0x27')][_0x1a90('0x28')]===0x1f4){logger[_0x1a90('0x27')](_0x1a90('0x29'),_0x21d486,_0x2d9504['error'][_0x1a90('0x2a')]);return _0x1be7e5(_0x2d9504[_0x1a90('0x27')]['message']);}logger[_0x1a90('0x27')](_0x1a90('0x29'),_0x21d486,_0x2d9504['error'][_0x1a90('0x2a')]);return _0x143837(_0x2d9504['error'][_0x1a90('0x2a')]);}else{logger[_0x1a90('0x23')](_0x1a90('0x29'),_0x21d486,_0x1a90('0x24'));_0x143837(_0x2d9504[_0x1a90('0x2b')][_0x1a90('0x2a')]);}})[_0x1a90('0x2c')](function(_0xa98d15){logger[_0x1a90('0x27')](_0x1a90('0x29'),_0x21d486,_0xa98d15);_0x1be7e5(_0xa98d15);});});}function respondWithStatusCode(_0x2421a6,_0x3988a4){_0x3988a4=_0x3988a4||0xcc;return function(_0x43a634){if(_0x43a634){return _0x2421a6[_0x1a90('0x2d')](_0x3988a4);}return _0x2421a6[_0x1a90('0x2e')](_0x3988a4)['end']();};}function respondWithResult(_0x1618f3,_0x28862a){_0x28862a=_0x28862a||0xc8;return function(_0x1759a6){if(_0x1759a6){return _0x1618f3[_0x1a90('0x2e')](_0x28862a)['json'](_0x1759a6);}};}function respondWithFilteredResult(_0x517800,_0x30e49f){return function(_0x521692){if(_0x521692){var _0xf555d9=typeof _0x30e49f[_0x1a90('0x2f')]===_0x1a90('0x30')&&typeof _0x30e49f[_0x1a90('0x31')]===_0x1a90('0x30');var _0x131228=_0x521692['count'];var _0x485ac6=_0xf555d9?0x0:_0x30e49f[_0x1a90('0x2f')];var _0xb73ddd=_0xf555d9?_0x521692[_0x1a90('0x32')]:_0x30e49f[_0x1a90('0x2f')]+_0x30e49f['limit'];var _0x17125c;if(_0xb73ddd>=_0x131228){_0xb73ddd=_0x131228;_0x17125c=0xc8;}else{_0x17125c=0xce;}_0x517800['status'](_0x17125c);return _0x517800[_0x1a90('0x33')](_0x1a90('0x34'),_0x485ac6+'-'+_0xb73ddd+'/'+_0x131228)[_0x1a90('0x35')](_0x521692);}return null;};}function patchUpdates(_0x3f8f0a){return function(_0x428cca){try{jsonpatch[_0x1a90('0x36')](_0x428cca,_0x3f8f0a,!![]);}catch(_0x3bed02){return BPromise[_0x1a90('0x37')](_0x3bed02);}return _0x428cca[_0x1a90('0x38')]();};}function saveUpdates(_0x25b220,_0x5a8152){return function(_0xbe89fc){if(_0xbe89fc){return _0xbe89fc['update'](_0x25b220)[_0x1a90('0x22')](function(_0x3a3387){return _0x3a3387;});}return null;};}function removeEntity(_0x412d67,_0x2c2c8a){return function(_0x389e63){if(_0x389e63){return _0x389e63[_0x1a90('0x39')]()[_0x1a90('0x22')](function(){_0x412d67[_0x1a90('0x2e')](0xcc)[_0x1a90('0x3a')]();});}};}function handleEntityNotFound(_0x48ce56,_0x5be22e){return function(_0x10b4a0){if(!_0x10b4a0){_0x48ce56[_0x1a90('0x2d')](0x194);}return _0x10b4a0;};}function handleError(_0xd79849,_0x5bdd7c){_0x5bdd7c=_0x5bdd7c||0x1f4;return function(_0xb4233f){logger[_0x1a90('0x27')](_0xb4233f[_0x1a90('0x3b')]);if(_0xb4233f[_0x1a90('0x3c')]){delete _0xb4233f[_0x1a90('0x3c')];}_0xd79849[_0x1a90('0x2e')](_0x5bdd7c)['send'](_0xb4233f);};}exports[_0x1a90('0x3d')]=function(_0x4fdafd,_0x555509){var _0x449ca3={},_0x50a7cd={},_0xd60f73={'count':0x0,'rows':[]};var _0x4fe20e=_['map'](db[_0x1a90('0x3e')][_0x1a90('0x3f')],function(_0x593d04){return{'name':_0x593d04[_0x1a90('0x40')],'type':_0x593d04[_0x1a90('0x41')][_0x1a90('0x42')]};});_0x50a7cd[_0x1a90('0x43')]=_['map'](_0x4fe20e,_0x1a90('0x3c'));_0x50a7cd[_0x1a90('0x44')]=_[_0x1a90('0x45')](_0x4fdafd[_0x1a90('0x44')]);_0x50a7cd[_0x1a90('0x46')]=_[_0x1a90('0x47')](_0x50a7cd[_0x1a90('0x43')],_0x50a7cd[_0x1a90('0x44')]);_0x449ca3[_0x1a90('0x48')]=_[_0x1a90('0x47')](_0x50a7cd[_0x1a90('0x43')],qs[_0x1a90('0x49')](_0x4fdafd['query'][_0x1a90('0x49')]));_0x449ca3[_0x1a90('0x48')]=_0x449ca3['attributes']['length']?_0x449ca3[_0x1a90('0x48')]:_0x50a7cd[_0x1a90('0x43')];if(!_0x4fdafd[_0x1a90('0x44')][_0x1a90('0x4a')]('nolimit')){_0x449ca3[_0x1a90('0x31')]=qs[_0x1a90('0x31')](_0x4fdafd[_0x1a90('0x44')][_0x1a90('0x31')]);_0x449ca3[_0x1a90('0x2f')]=qs[_0x1a90('0x2f')](_0x4fdafd['query'][_0x1a90('0x2f')]);}_0x449ca3['order']=qs['sort'](_0x4fdafd[_0x1a90('0x44')][_0x1a90('0x4b')]);_0x449ca3[_0x1a90('0x4c')]=qs['filters'](_[_0x1a90('0x4d')](_0x4fdafd[_0x1a90('0x44')],_0x50a7cd[_0x1a90('0x46')]),_0x4fe20e);if(_0x4fdafd['query'][_0x1a90('0x4e')]){_0x449ca3['where']=_[_0x1a90('0x4f')](_0x449ca3[_0x1a90('0x4c')],{'$or':_[_0x1a90('0x50')](_0x4fe20e,function(_0x14dbd6){if(_0x14dbd6[_0x1a90('0x41')]!==_0x1a90('0x51')){var _0x53d2b0={};_0x53d2b0[_0x14dbd6[_0x1a90('0x3c')]]={'$like':'%'+_0x4fdafd[_0x1a90('0x44')][_0x1a90('0x4e')]+'%'};return _0x53d2b0;}})});}_0x449ca3=_[_0x1a90('0x4f')]({},_0x449ca3,_0x4fdafd[_0x1a90('0x52')]);var _0x52ab8f={'where':_0x449ca3['where']};return db[_0x1a90('0x3e')][_0x1a90('0x32')](_0x52ab8f)[_0x1a90('0x22')](function(_0x393d64){_0xd60f73[_0x1a90('0x32')]=_0x393d64;if(_0x4fdafd['query'][_0x1a90('0x53')]){_0x449ca3['include']=[{'all':!![]}];}return db[_0x1a90('0x3e')][_0x1a90('0x54')](_0x449ca3);})[_0x1a90('0x22')](function(_0x345d6f){_0xd60f73[_0x1a90('0x55')]=_0x345d6f;return _0xd60f73;})[_0x1a90('0x22')](respondWithFilteredResult(_0x555509,_0x449ca3))[_0x1a90('0x2c')](handleError(_0x555509,null));};exports[_0x1a90('0x56')]=function(_0x10c1c0,_0x7b6e24){var _0x28c6c5={'raw':!![],'where':{'id':_0x10c1c0[_0x1a90('0x57')]['id']}},_0x5a049d={};_0x5a049d[_0x1a90('0x43')]=_['keys'](db[_0x1a90('0x3e')][_0x1a90('0x3f')]);_0x5a049d[_0x1a90('0x44')]=_[_0x1a90('0x45')](_0x10c1c0['query']);_0x5a049d[_0x1a90('0x46')]=_[_0x1a90('0x47')](_0x5a049d['model'],_0x5a049d[_0x1a90('0x44')]);_0x28c6c5[_0x1a90('0x48')]=_[_0x1a90('0x47')](_0x5a049d['model'],qs['fields'](_0x10c1c0[_0x1a90('0x44')]['fields']));_0x28c6c5[_0x1a90('0x48')]=_0x28c6c5['attributes']['length']?_0x28c6c5[_0x1a90('0x48')]:_0x5a049d[_0x1a90('0x43')];if(_0x10c1c0[_0x1a90('0x44')][_0x1a90('0x53')]){_0x28c6c5['include']=[{'all':!![]}];}_0x28c6c5=_[_0x1a90('0x4f')]({},_0x28c6c5,_0x10c1c0[_0x1a90('0x52')]);return db[_0x1a90('0x3e')][_0x1a90('0x58')](_0x28c6c5)[_0x1a90('0x22')](handleEntityNotFound(_0x7b6e24,null))[_0x1a90('0x22')](respondWithResult(_0x7b6e24,null))[_0x1a90('0x2c')](handleError(_0x7b6e24,null));};exports[_0x1a90('0x59')]=function(_0x28de8d,_0xdd06ef){return db[_0x1a90('0x3e')][_0x1a90('0x59')](_0x28de8d['body'],{})[_0x1a90('0x22')](respondWithResult(_0xdd06ef,0xc9))['catch'](handleError(_0xdd06ef,null));};exports[_0x1a90('0x5a')]=function(_0x1d198e,_0x30ec73){if(_0x1d198e['body']['id']){delete _0x1d198e[_0x1a90('0x5b')]['id'];}return db[_0x1a90('0x3e')][_0x1a90('0x58')]({'where':{'id':_0x1d198e[_0x1a90('0x57')]['id']}})[_0x1a90('0x22')](handleEntityNotFound(_0x30ec73,null))[_0x1a90('0x22')](saveUpdates(_0x1d198e['body'],null))[_0x1a90('0x22')](respondWithResult(_0x30ec73,null))[_0x1a90('0x2c')](handleError(_0x30ec73,null));};exports[_0x1a90('0x39')]=function(_0x15eca7,_0x33e064){return db[_0x1a90('0x3e')]['find']({'where':{'id':_0x15eca7[_0x1a90('0x57')]['id']}})[_0x1a90('0x22')](handleEntityNotFound(_0x33e064,null))[_0x1a90('0x22')](removeEntity(_0x33e064,null))[_0x1a90('0x2c')](handleError(_0x33e064,null));};exports[_0x1a90('0x5c')]=function(_0x4c1e68,_0x4f3162){return db[_0x1a90('0x3e')][_0x1a90('0x5c')]()[_0x1a90('0x22')](respondWithResult(_0x4f3162,null))[_0x1a90('0x2c')](handleError(_0x4f3162,null));};var interaction_log=require(_0x1a90('0x14'))(_0x1a90('0x5d'));exports['accept']=function(_0x522b19,_0x6459fe,_0x4051f9){var _0x5f1540={'agent':{},'channel':_0x1a90('0x5e')};if(_0x522b19[_0x1a90('0x5b')]['id']){delete _0x522b19['body']['id'];}_0x522b19[_0x1a90('0x5b')][_0x1a90('0x5f')]=!![];_0x522b19[_0x1a90('0x5b')][_0x1a90('0x60')]=moment()[_0x1a90('0x61')](_0x1a90('0x62'));_0x522b19[_0x1a90('0x5b')]['UserId']=_0x522b19[_0x1a90('0x5b')]['UserId']||_0x522b19[_0x1a90('0x63')]['id'];_0x5f1540[_0x1a90('0x64')]['id']=_0x522b19[_0x1a90('0x5b')][_0x1a90('0x65')];return db[_0x1a90('0x3e')][_0x1a90('0x58')]({'where':{'id':_0x522b19[_0x1a90('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x6459fe,null))[_0x1a90('0x22')](saveUpdates(_0x522b19[_0x1a90('0x5b')],null))['then'](function(_0x5d4aac){if(_0x5d4aac){_0x5f1540[_0x1a90('0x2a')]=_0x5d4aac[_0x1a90('0x66')]({'plain':!![]});return db[_0x1a90('0x67')]['find']({'where':{'id':_0x5d4aac[_0x1a90('0x68')]}});}return null;})[_0x1a90('0x22')](handleEntityNotFound(_0x6459fe,null))[_0x1a90('0x22')](function(_0x3bb7dc){if(_0x3bb7dc){return _0x3bb7dc[_0x1a90('0x5a')]({'UserId':_0x522b19['body'][_0x1a90('0x65')],'read1stAt':_['isNil'](_0x3bb7dc[_0x1a90('0x69')])?moment()[_0x1a90('0x61')](_0x1a90('0x62')):undefined});}return null;})[_0x1a90('0x22')](function(_0x14ce6f){if(_0x14ce6f){_0x5f1540[_0x1a90('0x6a')]=_0x14ce6f[_0x1a90('0x66')]({'plain':!![]});interaction_log[_0x1a90('0x23')](_0x1a90('0x6b'),_0x522b19[_0x1a90('0x63')]['id'],_0x522b19[_0x1a90('0x63')][_0x1a90('0x3c')],_0x522b19[_0x1a90('0x63')][_0x1a90('0x6c')],_0x5f1540['interaction']['id'],_0x522b19[_0x1a90('0x5b')]?JSON[_0x1a90('0x6d')](_0x522b19[_0x1a90('0x5b')]):'null');return respondWithRpcPromise(_0x1a90('0x6e'),'acceptMessage',_0x5f1540);}return null;})['then'](function(_0x21c863){var _0x56c115=_0x1a90('0x6f')+_0x21c863[_0x1a90('0x2a')]['ContactId'];return db[_0x1a90('0x70')][_0x1a90('0x44')](_0x56c115,{'type':db[_0x1a90('0x71')]['QueryTypes'][_0x1a90('0x72')],'raw':!![]})['then'](function(_0x29a37c){return _0x29a37c;});})[_0x1a90('0x22')](function(_0x46d8de){if(_0x46d8de){_0x5f1540['message'][_0x1a90('0x73')]=_0x46d8de[0x0];if(!_0x522b19['body'][_0x1a90('0x65')])return;return db[_0x1a90('0x74')][_0x1a90('0x58')]({'where':{'id':_0x522b19[_0x1a90('0x5b')][_0x1a90('0x65')],'role':_0x1a90('0x64')},'attributes':['id',_0x1a90('0x3c'),_0x1a90('0x75'),_0x1a90('0x76'),'internal'],'raw':!![]});}return null;})[_0x1a90('0x22')](function(_0x546493){if(!_0x546493)return null;_0x5f1540[_0x1a90('0x2a')]['agent']=_0x546493;return _0x5f1540;})['then'](function(_0x4136b2){if(_0x4136b2){if(_0x522b19[_0x1a90('0x5b')][_0x1a90('0x77')]){_0x5f1540[_0x1a90('0x2a')][_0x1a90('0x78')]=util[_0x1a90('0x61')](_0x1a90('0x79'),_0x522b19[_0x1a90('0x63')]['name']);_0x5f1540['message'][_0x1a90('0x7a')]=_0x5f1540[_0x1a90('0x7a')];_0x5f1540['message']['motionChannel']=_0x5f1540[_0x1a90('0x7a')];_0x5f1540['message']['event']=_0x1a90('0x7b');return respondWithRpcPromise(_0x1a90('0x7c'),_0x1a90('0x7c'),{'event':_0x1a90('0x7d'),'message':_[_0x1a90('0x4f')](_0x5f1540[_0x1a90('0x2a')],JSON[_0x1a90('0x7e')](_0x5f1540[_0x1a90('0x6a')][_0x1a90('0x7f')]))},client9002)[_0x1a90('0x22')](function(){return _0x5f1540;});}return _0x5f1540;}return null;})[_0x1a90('0x22')](respondWithResult(_0x6459fe,null))[_0x1a90('0x2c')](handleError(_0x6459fe,null));};var interaction_log=require(_0x1a90('0x14'))(_0x1a90('0x5d'));exports['reject']=function(_0x455423,_0x4f5f91,_0x263c8e){var _0x1a8ebc={'agent':{},'channel':_0x1a90('0x5e')};if(_0x455423[_0x1a90('0x5b')]['id']){delete _0x455423[_0x1a90('0x5b')]['id'];}_0x455423[_0x1a90('0x5b')][_0x1a90('0x65')]=_0x455423['body'][_0x1a90('0x65')]||_0x455423['user']['id'];_0x1a8ebc['agent']['id']=_0x455423[_0x1a90('0x5b')]['UserId'];return db[_0x1a90('0x3e')][_0x1a90('0x58')]({'where':{'id':_0x455423[_0x1a90('0x57')]['id'],'UserId':null}})[_0x1a90('0x22')](handleEntityNotFound(_0x4f5f91,null))[_0x1a90('0x22')](function(_0x4330d0){if(_0x4330d0){_0x1a8ebc[_0x1a90('0x2a')]=_0x4330d0[_0x1a90('0x66')]({'plain':!![]});return db[_0x1a90('0x67')][_0x1a90('0x58')]({'where':{'id':_0x4330d0[_0x1a90('0x68')]}});}return null;})[_0x1a90('0x22')](handleEntityNotFound(_0x4f5f91,null))[_0x1a90('0x22')](function(_0x268bef){if(_0x268bef){_0x1a8ebc['interaction']=_0x268bef[_0x1a90('0x66')]({'plain':!![]});interaction_log['info'](_0x1a90('0x80'),_0x455423[_0x1a90('0x63')]['id'],_0x455423['user']['name'],_0x455423[_0x1a90('0x63')][_0x1a90('0x6c')],_0x1a8ebc[_0x1a90('0x6a')]['id'],_0x455423['body']?JSON[_0x1a90('0x6d')](_0x455423['body']):_0x1a90('0x81'));return respondWithRpcPromise(_0x1a90('0x82'),'rejectMessage',_0x1a8ebc);}return null;})[_0x1a90('0x22')](function(_0x218f86){var _0x3004b4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x218f86[_0x1a90('0x2a')]['ContactId'];return db[_0x1a90('0x70')][_0x1a90('0x44')](_0x3004b4,{'type':db[_0x1a90('0x71')][_0x1a90('0x83')][_0x1a90('0x72')],'raw':!![]})[_0x1a90('0x22')](function(_0x4b6491){return _0x4b6491;});})[_0x1a90('0x22')](function(_0x14c216){if(_0x14c216){_0x1a8ebc[_0x1a90('0x2a')]['contact']=_0x14c216[0x0];if(!_0x455423[_0x1a90('0x5b')]['UserId'])return;return db[_0x1a90('0x74')][_0x1a90('0x58')]({'where':{'id':_0x455423['body'][_0x1a90('0x65')],'role':_0x1a90('0x64')},'attributes':['id',_0x1a90('0x3c'),_0x1a90('0x75'),_0x1a90('0x76'),_0x1a90('0x84')],'raw':!![]});}return null;})['then'](function(_0xa372e3){if(!_0xa372e3)return null;_0x1a8ebc[_0x1a90('0x2a')]['agent']=_0xa372e3;return _0x1a8ebc;})['then'](function(_0x9eaaa0){if(_0x9eaaa0){_0x9eaaa0[_0x1a90('0x2a')][_0x1a90('0x78')]=util[_0x1a90('0x61')](_0x1a90('0x79'),_0x455423[_0x1a90('0x63')][_0x1a90('0x3c')]);_0x9eaaa0[_0x1a90('0x2a')][_0x1a90('0x7a')]=_0x1a8ebc[_0x1a90('0x7a')];_0x9eaaa0[_0x1a90('0x2a')]['motionChannel']=_0x1a8ebc[_0x1a90('0x7a')];_0x9eaaa0['message'][_0x1a90('0x85')]=_0x1a90('0x37');respondWithRpcPromise(_0x1a90('0x7c'),_0x1a90('0x7c'),{'event':_0x1a90('0x86'),'message':_['merge'](_0x1a8ebc['message'],JSON[_0x1a90('0x7e')](_0x1a8ebc[_0x1a90('0x6a')][_0x1a90('0x7f')]))},client9002);return _0x1a8ebc;}return null;})['then'](respondWithResult(_0x4f5f91,null))[_0x1a90('0x2c')](handleError(_0x4f5f91,null));}; \ No newline at end of file +var _0x906e=['./chatMessage.socket','jayson/promise','http','client','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','catch','body','find','describe','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','agent','internal','format','SIP/%s','channel','event','EventManager','formData','chat-interactions','null','RejectMessage','rejectMessage','sequelize','QueryTypes','User','email','motionChannel','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x748360,_0x5df15c){var _0x4b0ef0=function(_0x296237){while(--_0x296237){_0x748360['push'](_0x748360['shift']());}};_0x4b0ef0(++_0x5df15c);}(_0x906e,0x66));var _0xe906=function(_0x87eee5,_0x581852){_0x87eee5=_0x87eee5-0x0;var _0x17e2dc=_0x906e[_0x87eee5];return _0x17e2dc;};'use strict';var emlformat=require(_0xe906('0x0'));var rimraf=require(_0xe906('0x1'));var zipdir=require(_0xe906('0x2'));var jsonpatch=require(_0xe906('0x3'));var rp=require('request-promise');var moment=require(_0xe906('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe906('0x5'));var path=require(_0xe906('0x6'));var sox=require(_0xe906('0x7'));var csv=require('to-csv');var ejs=require(_0xe906('0x8'));var fs=require('fs');var fs_extra=require(_0xe906('0x9'));var _=require(_0xe906('0xa'));var squel=require(_0xe906('0xb'));var crypto=require(_0xe906('0xc'));var jsforce=require(_0xe906('0xd'));var deskjs=require(_0xe906('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe906('0xf'));var Papa=require(_0xe906('0x10'));var Redis=require('ioredis');var authService=require(_0xe906('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe906('0x12'));var hardwareService=require(_0xe906('0x13'));var logger=require('../../config/logger')(_0xe906('0x14'));var utils=require(_0xe906('0x15'));var config=require(_0xe906('0x16'));var licenseUtil=require(_0xe906('0x17'));var db=require(_0xe906('0x18'))['db'];config[_0xe906('0x19')]=_[_0xe906('0x1a')](config[_0xe906('0x19')],{'host':_0xe906('0x1b'),'port':0x18eb});var socket=require(_0xe906('0x1c'))(new Redis(config[_0xe906('0x19')]));require(_0xe906('0x1d'))['register'](socket);var jayson=require(_0xe906('0x1e'));var client=jayson['client'][_0xe906('0x1f')]({'port':0x232c});var client9002=jayson[_0xe906('0x20')][_0xe906('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2f26a6,_0x172e2d,_0x477877,_0x21eaf9){return new BPromise(function(_0x2b3fba,_0x4acc50){var _0x5f358c=_0x21eaf9||client;return _0x5f358c['request'](_0x2f26a6,_0x477877)['then'](function(_0x29b28d){logger['info'](_0xe906('0x21'),_0x172e2d,'request\x20sent');logger[_0xe906('0x22')](_0xe906('0x23'),_0x172e2d,_0xe906('0x24'),JSON[_0xe906('0x25')](_0x29b28d));if(_0x29b28d[_0xe906('0x26')]){if(_0x29b28d[_0xe906('0x26')][_0xe906('0x27')]===0x1f4){logger[_0xe906('0x26')](_0xe906('0x21'),_0x172e2d,_0x29b28d['error']['message']);return _0x4acc50(_0x29b28d[_0xe906('0x26')]['message']);}logger[_0xe906('0x26')]('ChatMessage,\x20%s,\x20%s',_0x172e2d,_0x29b28d[_0xe906('0x26')][_0xe906('0x28')]);return _0x2b3fba(_0x29b28d[_0xe906('0x26')]['message']);}else{logger[_0xe906('0x29')]('ChatMessage,\x20%s,\x20%s',_0x172e2d,_0xe906('0x24'));_0x2b3fba(_0x29b28d[_0xe906('0x2a')][_0xe906('0x28')]);}})['catch'](function(_0x1bc522){logger[_0xe906('0x26')](_0xe906('0x21'),_0x172e2d,_0x1bc522);_0x4acc50(_0x1bc522);});});}function respondWithStatusCode(_0x4f30ae,_0x5b0dc0){_0x5b0dc0=_0x5b0dc0||0xcc;return function(_0x1f0621){if(_0x1f0621){return _0x4f30ae[_0xe906('0x2b')](_0x5b0dc0);}return _0x4f30ae[_0xe906('0x2c')](_0x5b0dc0)[_0xe906('0x2d')]();};}function respondWithResult(_0x21eb5c,_0x28ba60){_0x28ba60=_0x28ba60||0xc8;return function(_0x4c89f7){if(_0x4c89f7){return _0x21eb5c[_0xe906('0x2c')](_0x28ba60)['json'](_0x4c89f7);}};}function respondWithFilteredResult(_0x39017d,_0x40af24){return function(_0x242bd2){if(_0x242bd2){var _0xcd656c=typeof _0x40af24[_0xe906('0x2e')]==='undefined'&&typeof _0x40af24['limit']===_0xe906('0x2f');var _0x610f1f=_0x242bd2[_0xe906('0x30')];var _0x4c49f8=_0xcd656c?0x0:_0x40af24[_0xe906('0x2e')];var _0x3d3238=_0xcd656c?_0x242bd2[_0xe906('0x30')]:_0x40af24['offset']+_0x40af24[_0xe906('0x31')];var _0x19654c;if(_0x3d3238>=_0x610f1f){_0x3d3238=_0x610f1f;_0x19654c=0xc8;}else{_0x19654c=0xce;}_0x39017d[_0xe906('0x2c')](_0x19654c);return _0x39017d['set']('Content-Range',_0x4c49f8+'-'+_0x3d3238+'/'+_0x610f1f)[_0xe906('0x32')](_0x242bd2);}return null;};}function patchUpdates(_0xe6b4c9){return function(_0x3deaf8){try{jsonpatch[_0xe906('0x33')](_0x3deaf8,_0xe6b4c9,!![]);}catch(_0x3838d7){return BPromise[_0xe906('0x34')](_0x3838d7);}return _0x3deaf8[_0xe906('0x35')]();};}function saveUpdates(_0x31bf0b,_0x31aa13){return function(_0x374ea6){if(_0x374ea6){return _0x374ea6[_0xe906('0x36')](_0x31bf0b)[_0xe906('0x37')](function(_0x4d298e){return _0x4d298e;});}return null;};}function removeEntity(_0x5056d6,_0x37c5b6){return function(_0x571b1e){if(_0x571b1e){return _0x571b1e[_0xe906('0x38')]()[_0xe906('0x37')](function(){_0x5056d6[_0xe906('0x2c')](0xcc)[_0xe906('0x2d')]();});}};}function handleEntityNotFound(_0x50b53f,_0x131732){return function(_0x30b24b){if(!_0x30b24b){_0x50b53f[_0xe906('0x2b')](0x194);}return _0x30b24b;};}function handleError(_0x55c919,_0x105ec2){_0x105ec2=_0x105ec2||0x1f4;return function(_0xa422b1){logger[_0xe906('0x26')](_0xa422b1[_0xe906('0x39')]);if(_0xa422b1['name']){delete _0xa422b1[_0xe906('0x3a')];}_0x55c919[_0xe906('0x2c')](_0x105ec2)[_0xe906('0x3b')](_0xa422b1);};}exports[_0xe906('0x3c')]=function(_0x235e1e,_0x2d632f){var _0xbe2ed8={},_0x3be142={},_0x4b6fff={'count':0x0,'rows':[]};var _0x2dd802=_[_0xe906('0x3d')](db[_0xe906('0x3e')]['rawAttributes'],function(_0x2e9509){return{'name':_0x2e9509[_0xe906('0x3f')],'type':_0x2e9509[_0xe906('0x40')][_0xe906('0x41')]};});_0x3be142[_0xe906('0x42')]=_['map'](_0x2dd802,_0xe906('0x3a'));_0x3be142[_0xe906('0x43')]=_[_0xe906('0x44')](_0x235e1e[_0xe906('0x43')]);_0x3be142[_0xe906('0x45')]=_[_0xe906('0x46')](_0x3be142['model'],_0x3be142[_0xe906('0x43')]);_0xbe2ed8[_0xe906('0x47')]=_[_0xe906('0x46')](_0x3be142[_0xe906('0x42')],qs[_0xe906('0x48')](_0x235e1e['query'][_0xe906('0x48')]));_0xbe2ed8[_0xe906('0x47')]=_0xbe2ed8['attributes'][_0xe906('0x49')]?_0xbe2ed8[_0xe906('0x47')]:_0x3be142[_0xe906('0x42')];if(!_0x235e1e[_0xe906('0x43')][_0xe906('0x4a')](_0xe906('0x4b'))){_0xbe2ed8['limit']=qs[_0xe906('0x31')](_0x235e1e[_0xe906('0x43')][_0xe906('0x31')]);_0xbe2ed8[_0xe906('0x2e')]=qs[_0xe906('0x2e')](_0x235e1e[_0xe906('0x43')][_0xe906('0x2e')]);}_0xbe2ed8['order']=qs[_0xe906('0x4c')](_0x235e1e[_0xe906('0x43')][_0xe906('0x4c')]);_0xbe2ed8[_0xe906('0x4d')]=qs['filters'](_['pick'](_0x235e1e[_0xe906('0x43')],_0x3be142[_0xe906('0x45')]),_0x2dd802);if(_0x235e1e['query'][_0xe906('0x4e')]){_0xbe2ed8[_0xe906('0x4d')]=_[_0xe906('0x4f')](_0xbe2ed8[_0xe906('0x4d')],{'$or':_[_0xe906('0x3d')](_0x2dd802,function(_0x175a44){if(_0x175a44['type']!==_0xe906('0x50')){var _0x47cd25={};_0x47cd25[_0x175a44[_0xe906('0x3a')]]={'$like':'%'+_0x235e1e[_0xe906('0x43')][_0xe906('0x4e')]+'%'};return _0x47cd25;}})});}_0xbe2ed8=_[_0xe906('0x4f')]({},_0xbe2ed8,_0x235e1e[_0xe906('0x51')]);var _0x5bbd93={'where':_0xbe2ed8[_0xe906('0x4d')]};return db['ChatMessage'][_0xe906('0x30')](_0x5bbd93)['then'](function(_0x452cc5){_0x4b6fff[_0xe906('0x30')]=_0x452cc5;if(_0x235e1e['query']['includeAll']){_0xbe2ed8[_0xe906('0x52')]=[{'all':!![]}];}return db[_0xe906('0x3e')][_0xe906('0x53')](_0xbe2ed8);})[_0xe906('0x37')](function(_0x186523){_0x4b6fff[_0xe906('0x54')]=_0x186523;return _0x4b6fff;})[_0xe906('0x37')](respondWithFilteredResult(_0x2d632f,_0xbe2ed8))['catch'](handleError(_0x2d632f,null));};exports['show']=function(_0x2e1a26,_0x59b4b7){var _0x263e3c={'raw':!![],'where':{'id':_0x2e1a26[_0xe906('0x55')]['id']}},_0x2390fc={};_0x2390fc[_0xe906('0x42')]=_[_0xe906('0x44')](db[_0xe906('0x3e')][_0xe906('0x56')]);_0x2390fc[_0xe906('0x43')]=_['keys'](_0x2e1a26[_0xe906('0x43')]);_0x2390fc[_0xe906('0x45')]=_[_0xe906('0x46')](_0x2390fc[_0xe906('0x42')],_0x2390fc[_0xe906('0x43')]);_0x263e3c[_0xe906('0x47')]=_[_0xe906('0x46')](_0x2390fc[_0xe906('0x42')],qs['fields'](_0x2e1a26['query']['fields']));_0x263e3c[_0xe906('0x47')]=_0x263e3c[_0xe906('0x47')]['length']?_0x263e3c[_0xe906('0x47')]:_0x2390fc[_0xe906('0x42')];if(_0x2e1a26[_0xe906('0x43')][_0xe906('0x57')]){_0x263e3c[_0xe906('0x52')]=[{'all':!![]}];}_0x263e3c=_[_0xe906('0x4f')]({},_0x263e3c,_0x2e1a26[_0xe906('0x51')]);return db[_0xe906('0x3e')]['find'](_0x263e3c)['then'](handleEntityNotFound(_0x59b4b7,null))[_0xe906('0x37')](respondWithResult(_0x59b4b7,null))[_0xe906('0x58')](handleError(_0x59b4b7,null));};exports['create']=function(_0x5dd45a,_0x3268f9){return db[_0xe906('0x3e')]['create'](_0x5dd45a[_0xe906('0x59')],{})[_0xe906('0x37')](respondWithResult(_0x3268f9,0xc9))['catch'](handleError(_0x3268f9,null));};exports[_0xe906('0x36')]=function(_0x43d1f0,_0x24c50f){if(_0x43d1f0[_0xe906('0x59')]['id']){delete _0x43d1f0[_0xe906('0x59')]['id'];}return db['ChatMessage'][_0xe906('0x5a')]({'where':{'id':_0x43d1f0['params']['id']}})[_0xe906('0x37')](handleEntityNotFound(_0x24c50f,null))[_0xe906('0x37')](saveUpdates(_0x43d1f0[_0xe906('0x59')],null))[_0xe906('0x37')](respondWithResult(_0x24c50f,null))[_0xe906('0x58')](handleError(_0x24c50f,null));};exports['destroy']=function(_0xaa693a,_0x5e9a0f){return db[_0xe906('0x3e')]['find']({'where':{'id':_0xaa693a[_0xe906('0x55')]['id']}})[_0xe906('0x37')](handleEntityNotFound(_0x5e9a0f,null))[_0xe906('0x37')](removeEntity(_0x5e9a0f,null))['catch'](handleError(_0x5e9a0f,null));};exports[_0xe906('0x5b')]=function(_0x7fcd25,_0x3b7ca9){return db[_0xe906('0x3e')][_0xe906('0x5b')]()[_0xe906('0x37')](respondWithResult(_0x3b7ca9,null))[_0xe906('0x58')](handleError(_0x3b7ca9,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xe906('0x5c')]=function(_0x5c837f,_0x32da07,_0x49fffe){var _0x3fcfa1={'agent':{},'channel':_0xe906('0x5d')};if(_0x5c837f[_0xe906('0x59')]['id']){delete _0x5c837f['body']['id'];}_0x5c837f[_0xe906('0x59')][_0xe906('0x5e')]=!![];_0x5c837f[_0xe906('0x59')][_0xe906('0x5f')]=moment()['format'](_0xe906('0x60'));_0x5c837f[_0xe906('0x59')][_0xe906('0x61')]=_0x5c837f['body'][_0xe906('0x61')]||_0x5c837f['user']['id'];_0x3fcfa1['agent']['id']=_0x5c837f[_0xe906('0x59')][_0xe906('0x61')];return db[_0xe906('0x3e')]['find']({'where':{'id':_0x5c837f[_0xe906('0x55')]['id'],'UserId':null}})[_0xe906('0x37')](handleEntityNotFound(_0x32da07,null))[_0xe906('0x37')](saveUpdates(_0x5c837f[_0xe906('0x59')],null))[_0xe906('0x37')](function(_0x5ea99d){if(_0x5ea99d){_0x3fcfa1['message']=_0x5ea99d[_0xe906('0x62')]({'plain':!![]});return db[_0xe906('0x63')][_0xe906('0x5a')]({'where':{'id':_0x5ea99d[_0xe906('0x64')]}});}return null;})[_0xe906('0x37')](handleEntityNotFound(_0x32da07,null))['then'](function(_0x5d9077){if(_0x5d9077){return _0x5d9077[_0xe906('0x36')]({'UserId':_0x5c837f[_0xe906('0x59')][_0xe906('0x61')],'read1stAt':_[_0xe906('0x65')](_0x5d9077[_0xe906('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe906('0x37')](function(_0x1626bc){if(_0x1626bc){_0x3fcfa1[_0xe906('0x67')]=_0x1626bc[_0xe906('0x62')]({'plain':!![]});interaction_log['info'](_0xe906('0x68'),_0x5c837f['user']['id'],_0x5c837f[_0xe906('0x69')][_0xe906('0x3a')],_0x5c837f[_0xe906('0x69')][_0xe906('0x6a')],_0x3fcfa1[_0xe906('0x67')]['id'],_0x5c837f[_0xe906('0x59')]?JSON['stringify'](_0x5c837f['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xe906('0x6b'),_0x3fcfa1);}return null;})[_0xe906('0x37')](function(_0x4f83be){var _0x32c7aa=_0xe906('0x6c')+_0x4f83be[_0xe906('0x28')][_0xe906('0x6d')];return db['sequelize'][_0xe906('0x43')](_0x32c7aa,{'type':db[_0xe906('0x6e')]['QueryTypes'][_0xe906('0x6f')],'raw':!![]})[_0xe906('0x37')](function(_0x661b1e){return _0x661b1e;});})[_0xe906('0x37')](function(_0x18efbb){if(_0x18efbb){_0x3fcfa1[_0xe906('0x28')]['contact']=_0x18efbb[0x0];if(!_0x5c837f[_0xe906('0x59')]['UserId'])return;return db['User'][_0xe906('0x5a')]({'where':{'id':_0x5c837f[_0xe906('0x59')]['UserId'],'role':_0xe906('0x70')},'attributes':['id',_0xe906('0x3a'),'fullname','email',_0xe906('0x71')],'raw':!![]});}return null;})[_0xe906('0x37')](function(_0x249e6f){if(!_0x249e6f)return null;_0x3fcfa1[_0xe906('0x28')][_0xe906('0x70')]=_0x249e6f;return _0x3fcfa1;})[_0xe906('0x37')](function(_0x530a7c){if(_0x530a7c){if(_0x5c837f[_0xe906('0x59')]['manual']){_0x3fcfa1['message']['interface']=util[_0xe906('0x72')](_0xe906('0x73'),_0x5c837f[_0xe906('0x69')][_0xe906('0x3a')]);_0x3fcfa1[_0xe906('0x28')]['channel']=_0x3fcfa1[_0xe906('0x74')];_0x3fcfa1[_0xe906('0x28')]['motionChannel']=_0x3fcfa1[_0xe906('0x74')];_0x3fcfa1[_0xe906('0x28')][_0xe906('0x75')]=_0xe906('0x5c');return respondWithRpcPromise('EventManager',_0xe906('0x76'),{'event':'acceptmessage','message':_['merge'](_0x3fcfa1[_0xe906('0x28')],JSON['parse'](_0x3fcfa1[_0xe906('0x67')][_0xe906('0x77')]))},client9002)[_0xe906('0x37')](function(){return _0x3fcfa1;});}return _0x3fcfa1;}return null;})[_0xe906('0x37')](respondWithResult(_0x32da07,null))[_0xe906('0x58')](handleError(_0x32da07,null));};var interaction_log=require('../../config/logger')(_0xe906('0x78'));exports[_0xe906('0x34')]=function(_0x497664,_0x203a66,_0x572f63){var _0x184d8b={'agent':{},'channel':_0xe906('0x5d')};if(_0x497664[_0xe906('0x59')]['id']){delete _0x497664['body']['id'];}_0x497664['body']['UserId']=_0x497664[_0xe906('0x59')][_0xe906('0x61')]||_0x497664[_0xe906('0x69')]['id'];_0x184d8b[_0xe906('0x70')]['id']=_0x497664[_0xe906('0x59')][_0xe906('0x61')];return db[_0xe906('0x3e')][_0xe906('0x5a')]({'where':{'id':_0x497664[_0xe906('0x55')]['id'],'UserId':null}})[_0xe906('0x37')](handleEntityNotFound(_0x203a66,null))[_0xe906('0x37')](function(_0x5e88fd){if(_0x5e88fd){_0x184d8b[_0xe906('0x28')]=_0x5e88fd[_0xe906('0x62')]({'plain':!![]});return db[_0xe906('0x63')][_0xe906('0x5a')]({'where':{'id':_0x5e88fd['ChatInteractionId']}});}return null;})[_0xe906('0x37')](handleEntityNotFound(_0x203a66,null))[_0xe906('0x37')](function(_0x15c105){if(_0x15c105){_0x184d8b['interaction']=_0x15c105['get']({'plain':!![]});interaction_log[_0xe906('0x29')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x497664[_0xe906('0x69')]['id'],_0x497664[_0xe906('0x69')][_0xe906('0x3a')],_0x497664[_0xe906('0x69')][_0xe906('0x6a')],_0x184d8b[_0xe906('0x67')]['id'],_0x497664['body']?JSON[_0xe906('0x25')](_0x497664[_0xe906('0x59')]):_0xe906('0x79'));return respondWithRpcPromise(_0xe906('0x7a'),_0xe906('0x7b'),_0x184d8b);}return null;})[_0xe906('0x37')](function(_0x410178){var _0x55d9fe=_0xe906('0x6c')+_0x410178[_0xe906('0x28')][_0xe906('0x6d')];return db[_0xe906('0x7c')][_0xe906('0x43')](_0x55d9fe,{'type':db[_0xe906('0x6e')][_0xe906('0x7d')][_0xe906('0x6f')],'raw':!![]})[_0xe906('0x37')](function(_0xac496c){return _0xac496c;});})[_0xe906('0x37')](function(_0xbae82f){if(_0xbae82f){_0x184d8b[_0xe906('0x28')]['contact']=_0xbae82f[0x0];if(!_0x497664[_0xe906('0x59')][_0xe906('0x61')])return;return db[_0xe906('0x7e')][_0xe906('0x5a')]({'where':{'id':_0x497664[_0xe906('0x59')]['UserId'],'role':_0xe906('0x70')},'attributes':['id','name','fullname',_0xe906('0x7f'),_0xe906('0x71')],'raw':!![]});}return null;})['then'](function(_0x30ba7d){if(!_0x30ba7d)return null;_0x184d8b['message'][_0xe906('0x70')]=_0x30ba7d;return _0x184d8b;})[_0xe906('0x37')](function(_0x4a4e09){if(_0x4a4e09){_0x4a4e09['message']['interface']=util[_0xe906('0x72')](_0xe906('0x73'),_0x497664[_0xe906('0x69')][_0xe906('0x3a')]);_0x4a4e09[_0xe906('0x28')]['channel']=_0x184d8b[_0xe906('0x74')];_0x4a4e09[_0xe906('0x28')][_0xe906('0x80')]=_0x184d8b['channel'];_0x4a4e09[_0xe906('0x28')][_0xe906('0x75')]=_0xe906('0x34');respondWithRpcPromise(_0xe906('0x76'),'EventManager',{'event':_0xe906('0x81'),'message':_[_0xe906('0x4f')](_0x184d8b[_0xe906('0x28')],JSON[_0xe906('0x82')](_0x184d8b[_0xe906('0x67')][_0xe906('0x77')]))},client9002);return _0x184d8b;}return null;})[_0xe906('0x37')](respondWithResult(_0x203a66,null))[_0xe906('0x58')](handleError(_0x203a66,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 217a8ec..a76ac66 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 _0xdcdc=['hasOwnProperty','hook','events','ChatMessage','setMaxListeners','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdcdc,0x121));var _0xcdcd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcdc[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xcdcd('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xcdcd('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcdcd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcdcd('0x3')};function emitEvent(_0x182947){return function(_0x1d6c4d,_0x298c04,_0x3ab5f1){ChatMessageEvents['emit'](_0x182947+':'+_0x1d6c4d['id'],_0x1d6c4d);ChatMessageEvents[_0xcdcd('0x4')](_0x182947,_0x1d6c4d);_0x3ab5f1(null);};}for(var e in events){if(events[_0xcdcd('0x5')](e)){var event=events[e];ChatMessage[_0xcdcd('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x620c=['hook','exports','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x35cc9a,_0xa4f89b){var _0xef3440=function(_0x50ffc9){while(--_0x50ffc9){_0x35cc9a['push'](_0x35cc9a['shift']());}};_0xef3440(++_0xa4f89b);}(_0x620c,0x92));var _0xc620=function(_0x41cff7,_0x56b0dc){_0x41cff7=_0x41cff7-0x0;var _0x47019c=_0x620c[_0x41cff7];return _0x47019c;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc620('0x0'))['db'][_0xc620('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc620('0x2'),'afterUpdate':_0xc620('0x3'),'afterDestroy':_0xc620('0x4')};function emitEvent(_0xa08118){return function(_0x2d39eb,_0x294934,_0x4d3ffe){ChatMessageEvents[_0xc620('0x5')](_0xa08118+':'+_0x2d39eb['id'],_0x2d39eb);ChatMessageEvents[_0xc620('0x5')](_0xa08118,_0x2d39eb);_0x4d3ffe(null);};}for(var e in events){if(events[_0xc620('0x6')](e)){var event=events[e];ChatMessage[_0xc620('0x7')](e,emitEvent(event));}}module[_0xc620('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 4b18028..c0f861e 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 _0xba4e=['util','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','utf8mb4_unicode_ci','lodash'];(function(_0x3f20a7,_0x3df485){var _0x55fa8a=function(_0x168186){while(--_0x168186){_0x3f20a7['push'](_0x3f20a7['shift']());}};_0x55fa8a(++_0x3df485);}(_0xba4e,0x67));var _0xeba4=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xba4e[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xeba4('0x0'));var util=require(_0xeba4('0x1'));var logger=require('../../config/logger')(_0xeba4('0x2'));var moment=require(_0xeba4('0x3'));var BPromise=require(_0xeba4('0x4'));var rp=require(_0xeba4('0x5'));var fs=require('fs');var path=require(_0xeba4('0x6'));var rimraf=require('rimraf');var config=require(_0xeba4('0x7'));var attributes=require(_0xeba4('0x8'));module[_0xeba4('0x9')]=function(_0x5f51fb,_0x24d2d5){return _0x5f51fb['define'](_0xeba4('0xa'),attributes,{'tableName':_0xeba4('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xeba4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553bb4,_0x236c0c,_0x3ec9c6){var _0x4be11f=_0x5f51fb[_0xeba4('0xd')];var _0x4db6d4=_0x553bb4[_0xeba4('0xe')]({'plain':!![]});if(_0x4db6d4[_0xeba4('0xf')][_0xeba4('0x10')]()==='in'||_0x4db6d4['direction'][_0xeba4('0x10')]()==='out'&&!_0x4db6d4[_0xeba4('0x11')]&&!_[_0xeba4('0x12')](_0x4db6d4[_0xeba4('0x13')])){_0x4be11f[_0xeba4('0x14')][_0xeba4('0x15')]({'where':{'id':_0x4db6d4['ChatInteractionId']}})[_0xeba4('0x16')](function(_0x3db4a6){if(_0x3db4a6){_0x3db4a6[_0xeba4('0x17')]({'lastMsgAt':_0x4db6d4[_0xeba4('0x18')],'lastMsgDirection':_0x4db6d4['direction'][_0xeba4('0x10')]()});}})['catch'](function(_0x2710b7){console['error'](_0x2710b7);});}_0x3ec9c6();}},'charset':'utf8mb4','collate':_0xeba4('0x19')});}; \ No newline at end of file +var _0x94d9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x1114aa,_0x3bee7b){var _0x350fa4=function(_0xa721c){while(--_0xa721c){_0x1114aa['push'](_0x1114aa['shift']());}};_0x350fa4(++_0x3bee7b);}(_0x94d9,0x1cd));var _0x994d=function(_0x208c79,_0x3bb675){_0x208c79=_0x208c79-0x0;var _0x58c508=_0x94d9[_0x208c79];return _0x58c508;};'use strict';var _=require('lodash');var util=require(_0x994d('0x0'));var logger=require(_0x994d('0x1'))(_0x994d('0x2'));var moment=require(_0x994d('0x3'));var BPromise=require(_0x994d('0x4'));var rp=require(_0x994d('0x5'));var fs=require('fs');var path=require(_0x994d('0x6'));var rimraf=require(_0x994d('0x7'));var config=require(_0x994d('0x8'));var attributes=require(_0x994d('0x9'));module[_0x994d('0xa')]=function(_0x10d780,_0x1e8435){return _0x10d780[_0x994d('0xb')](_0x994d('0xc'),attributes,{'tableName':_0x994d('0xd'),'paranoid':![],'indexes':[{'name':_0x994d('0xe'),'fields':[_0x994d('0xf')],'type':_0x994d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34d9d9,_0x4ef7c3,_0x29dac3){var _0x4fef9e=_0x10d780['models'];var _0x34c1c7=_0x34d9d9['get']({'plain':!![]});if(_0x34c1c7[_0x994d('0x11')][_0x994d('0x12')]()==='in'||_0x34c1c7[_0x994d('0x11')][_0x994d('0x12')]()===_0x994d('0x13')&&!_0x34c1c7[_0x994d('0x14')]&&!_[_0x994d('0x15')](_0x34c1c7['UserId'])){_0x4fef9e[_0x994d('0x16')][_0x994d('0x17')]({'where':{'id':_0x34c1c7['ChatInteractionId']}})[_0x994d('0x18')](function(_0x4f5a0d){if(_0x4f5a0d){_0x4f5a0d['update']({'lastMsgAt':_0x34c1c7[_0x994d('0x19')],'lastMsgDirection':_0x34c1c7[_0x994d('0x11')][_0x994d('0x12')]()});}})[_0x994d('0x1a')](function(_0x388c1c){console[_0x994d('0x1b')](_0x388c1c);});}_0x29dac3();}},'charset':'utf8mb4','collate':_0x994d('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index aed9c94..f386df4 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 _0x8a7f=['http','redis','defaults','localhost','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x232bb4,_0x9ae12e){var _0x4b48b2=function(_0x2c0fd1){while(--_0x2c0fd1){_0x232bb4['push'](_0x232bb4['shift']());}};_0x4b48b2(++_0x9ae12e);}(_0x8a7f,0x1b8));var _0xf8a7=function(_0x9c5be9,_0xec23ea){_0x9c5be9=_0x9c5be9-0x0;var _0x494f11=_0x8a7f[_0x9c5be9];return _0x494f11;};'use strict';var _=require(_0xf8a7('0x0'));var util=require('util');var moment=require(_0xf8a7('0x1'));var BPromise=require(_0xf8a7('0x2'));var rs=require(_0xf8a7('0x3'));var fs=require('fs');var Redis=require(_0xf8a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8a7('0x5'));var config=require(_0xf8a7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf8a7('0x7')][_0xf8a7('0x8')]({'port':0x232a});config[_0xf8a7('0x9')]=_[_0xf8a7('0xa')](config['redis'],{'host':_0xf8a7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8a7('0x9')]));require(_0xf8a7('0xc'))['register'](socket);function respondWithRpcPromise(_0x27d0de,_0x4db046,_0x5cadfe){return new BPromise(function(_0x5cd6de,_0x4186d9){return client[_0xf8a7('0xd')](_0x27d0de,_0x5cadfe)[_0xf8a7('0xe')](function(_0x2f218a){logger[_0xf8a7('0xf')](_0xf8a7('0x10'),_0x4db046,_0xf8a7('0x11'));logger[_0xf8a7('0x12')](_0xf8a7('0x13'),_0x4db046,_0xf8a7('0x11'),JSON[_0xf8a7('0x14')](_0x2f218a));if(_0x2f218a[_0xf8a7('0x15')]){if(_0x2f218a[_0xf8a7('0x15')][_0xf8a7('0x16')]===0x1f4){logger[_0xf8a7('0x15')](_0xf8a7('0x10'),_0x4db046,_0x2f218a[_0xf8a7('0x15')][_0xf8a7('0x17')]);return _0x4186d9(_0x2f218a['error'][_0xf8a7('0x17')]);}logger[_0xf8a7('0x15')]('ChatMessage,\x20%s,\x20%s',_0x4db046,_0x2f218a['error'][_0xf8a7('0x17')]);return _0x5cd6de(_0x2f218a[_0xf8a7('0x15')][_0xf8a7('0x17')]);}else{logger['info'](_0xf8a7('0x10'),_0x4db046,_0xf8a7('0x11'));_0x5cd6de(_0x2f218a[_0xf8a7('0x18')]['message']);}})[_0xf8a7('0x19')](function(_0x5129e9){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4db046,_0x5129e9);_0x4186d9(_0x5129e9);});});}exports[_0xf8a7('0x1a')]=function(_0x2e4f1e){var _0x1e12cb=this;return new Promise(function(_0x14e72d,_0x3c38b9){return db[_0xf8a7('0x1b')][_0xf8a7('0x1c')](_0x2e4f1e[_0xf8a7('0x1d')],{'raw':_0x2e4f1e[_0xf8a7('0x1e')]?_0x2e4f1e[_0xf8a7('0x1e')][_0xf8a7('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x45f3fd){logger['info']('CreateChatMessage',_0x2e4f1e);logger['debug'](_0xf8a7('0x1a'),_0x2e4f1e,JSON['stringify'](_0x45f3fd));_0x14e72d(_0x45f3fd);})[_0xf8a7('0x19')](function(_0x46f793){logger[_0xf8a7('0x15')](_0xf8a7('0x1a'),_0x46f793[_0xf8a7('0x17')],_0x2e4f1e);_0x3c38b9(_0x1e12cb[_0xf8a7('0x15')](0x1f4,_0x46f793[_0xf8a7('0x17')]));});});}; \ No newline at end of file +var _0x4a6d=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreateChatMessage','create','body','options','raw','stringify','util'];(function(_0x378a2d,_0x425d2f){var _0x50d61d=function(_0x382e45){while(--_0x382e45){_0x378a2d['push'](_0x378a2d['shift']());}};_0x50d61d(++_0x425d2f);}(_0x4a6d,0x121));var _0xd4a6=function(_0x11e73f,_0x5ebe61){_0x11e73f=_0x11e73f-0x0;var _0x4f8d55=_0x4a6d[_0x11e73f];return _0x4f8d55;};'use strict';var _=require('lodash');var util=require(_0xd4a6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4a6('0x1'));var fs=require('fs');var Redis=require(_0xd4a6('0x2'));var db=require(_0xd4a6('0x3'))['db'];var utils=require(_0xd4a6('0x4'));var logger=require('../../config/logger')(_0xd4a6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4a6('0x6')]({'port':0x232a});config[_0xd4a6('0x7')]=_[_0xd4a6('0x8')](config[_0xd4a6('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4a6('0x7')]));require(_0xd4a6('0x9'))[_0xd4a6('0xa')](socket);function respondWithRpcPromise(_0x23398c,_0x4a3936,_0x2dff38){return new BPromise(function(_0x311731,_0x39e596){return client[_0xd4a6('0xb')](_0x23398c,_0x2dff38)[_0xd4a6('0xc')](function(_0x4f64bf){logger[_0xd4a6('0xd')](_0xd4a6('0xe'),_0x4a3936,'request\x20sent');logger[_0xd4a6('0xf')](_0xd4a6('0x10'),_0x4a3936,_0xd4a6('0x11'),JSON['stringify'](_0x4f64bf));if(_0x4f64bf['error']){if(_0x4f64bf['error'][_0xd4a6('0x12')]===0x1f4){logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x4f64bf[_0xd4a6('0x13')][_0xd4a6('0x14')]);return _0x39e596(_0x4f64bf['error'][_0xd4a6('0x14')]);}logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x4f64bf[_0xd4a6('0x13')][_0xd4a6('0x14')]);return _0x311731(_0x4f64bf['error'][_0xd4a6('0x14')]);}else{logger['info'](_0xd4a6('0xe'),_0x4a3936,_0xd4a6('0x11'));_0x311731(_0x4f64bf[_0xd4a6('0x15')][_0xd4a6('0x14')]);}})[_0xd4a6('0x16')](function(_0x2d486d){logger[_0xd4a6('0x13')](_0xd4a6('0xe'),_0x4a3936,_0x2d486d);_0x39e596(_0x2d486d);});});}exports[_0xd4a6('0x17')]=function(_0x3e21d0){var _0x386db0=this;return new Promise(function(_0x1cf715,_0x26625f){return db['ChatMessage'][_0xd4a6('0x18')](_0x3e21d0[_0xd4a6('0x19')],{'raw':_0x3e21d0[_0xd4a6('0x1a')]?_0x3e21d0[_0xd4a6('0x1a')][_0xd4a6('0x1b')]===undefined?!![]:![]:!![]})[_0xd4a6('0xc')](function(_0x3c3e84){logger['info'](_0xd4a6('0x17'),_0x3e21d0);logger[_0xd4a6('0xf')](_0xd4a6('0x17'),_0x3e21d0,JSON[_0xd4a6('0x1c')](_0x3c3e84));_0x1cf715(_0x3c3e84);})[_0xd4a6('0x16')](function(_0x509142){logger[_0xd4a6('0x13')](_0xd4a6('0x17'),_0x509142[_0xd4a6('0x14')],_0x3e21d0);_0x26625f(_0x386db0[_0xd4a6('0x13')](0x1f4,_0x509142['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index dd8a6d5..4c824ce 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 _0x1d25=['register','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x1d25,0xba));var _0x51d2=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x1d25[_0xbb14db];return _0x36bed7;};'use strict';var ChatMessageEvents=require(_0x51d2('0x0'));var events=[_0x51d2('0x1'),_0x51d2('0x2'),_0x51d2('0x3')];function createListener(_0x17f896,_0x5aac21){return function(_0x1b276e){_0x5aac21[_0x51d2('0x4')](_0x17f896,_0x1b276e);};}function removeListener(_0x4c93f2,_0x1f9fc8){return function(){ChatMessageEvents[_0x51d2('0x5')](_0x4c93f2,_0x1f9fc8);};}exports[_0x51d2('0x6')]=function(_0x407091){for(var _0x449fec=0x0,_0x2e6956=events['length'];_0x449fec<_0x2e6956;_0x449fec++){var _0x18e8a9=events[_0x449fec];var _0x5a6b5f=createListener(_0x51d2('0x7')+_0x18e8a9,_0x407091);ChatMessageEvents['on'](_0x18e8a9,_0x5a6b5f);}}; \ No newline at end of file +var _0xab86=['remove','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x12baed,_0x45a719){var _0x630772=function(_0x449242){while(--_0x449242){_0x12baed['push'](_0x12baed['shift']());}};_0x630772(++_0x45a719);}(_0xab86,0x13e));var _0x6ab8=function(_0x282e4f,_0x394d76){_0x282e4f=_0x282e4f-0x0;var _0x3c7c19=_0xab86[_0x282e4f];return _0x3c7c19;};'use strict';var ChatMessageEvents=require(_0x6ab8('0x0'));var events=[_0x6ab8('0x1'),_0x6ab8('0x2'),'update'];function createListener(_0x548007,_0xfa522f){return function(_0x4bcc45){_0xfa522f[_0x6ab8('0x3')](_0x548007,_0x4bcc45);};}function removeListener(_0x48cb6a,_0xf27ba7){return function(){ChatMessageEvents[_0x6ab8('0x4')](_0x48cb6a,_0xf27ba7);};}exports[_0x6ab8('0x5')]=function(_0x154d17){for(var _0x6f41f=0x0,_0x265771=events[_0x6ab8('0x6')];_0x6f41f<_0x265771;_0x6f41f++){var _0x2a452=events[_0x6f41f];var _0x363c5e=createListener(_0x6ab8('0x7')+_0x2a452,_0x154d17);ChatMessageEvents['on'](_0x2a452,_0x363c5e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 144032f..3eb23f1 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 _0x7e8e=['reject','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','chat','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x2ea9b6,_0x3dbbee){var _0x2687fd=function(_0x43a54e){while(--_0x43a54e){_0x2ea9b6['push'](_0x2ea9b6['shift']());}};_0x2687fd(++_0x3dbbee);}(_0x7e8e,0xc3));var _0xe7e8=function(_0x4ec119,_0x5e20f7){_0x4ec119=_0x4ec119-0x0;var _0x1f45a9=_0x7e8e[_0x4ec119];return _0x1f45a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7e8('0x0'));var timeout=require(_0xe7e8('0x1'));var express=require(_0xe7e8('0x2'));var router=express[_0xe7e8('0x3')]();var fs_extra=require(_0xe7e8('0x4'));var auth=require(_0xe7e8('0x5'));var interaction=require(_0xe7e8('0x6'));var config=require(_0xe7e8('0x7'));var controller=require('./chatMessage.controller');router[_0xe7e8('0x8')]('/',auth[_0xe7e8('0x9')](),controller['index']);router[_0xe7e8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe7e8('0xa')]);router[_0xe7e8('0x8')](_0xe7e8('0xb'),auth[_0xe7e8('0x9')](),controller[_0xe7e8('0xc')]);router[_0xe7e8('0xd')]('/',auth[_0xe7e8('0x9')](),interaction['tracked'](_0xe7e8('0xe'),'chatmessage:create'),controller[_0xe7e8('0xf')]);router[_0xe7e8('0x10')](_0xe7e8('0xb'),controller[_0xe7e8('0x11')]);router['put'](_0xe7e8('0x12'),auth['isAuthenticated'](),controller[_0xe7e8('0x13')]);router[_0xe7e8('0x10')](_0xe7e8('0x14'),auth[_0xe7e8('0x9')](),controller[_0xe7e8('0x15')]);router['delete'](_0xe7e8('0xb'),auth[_0xe7e8('0x9')](),controller[_0xe7e8('0x16')]);module[_0xe7e8('0x17')]=router; \ No newline at end of file +var _0xbfff=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','post','chat','chatmessage:create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x90d08e,_0x2282dd){var _0x2f1a8b=function(_0x5c99a4){while(--_0x5c99a4){_0x90d08e['push'](_0x90d08e['shift']());}};_0x2f1a8b(++_0x2282dd);}(_0xbfff,0x163));var _0xfbff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbfff[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfbff('0x0'));var util=require(_0xfbff('0x1'));var path=require(_0xfbff('0x2'));var timeout=require(_0xfbff('0x3'));var express=require(_0xfbff('0x4'));var router=express[_0xfbff('0x5')]();var fs_extra=require(_0xfbff('0x6'));var auth=require(_0xfbff('0x7'));var interaction=require(_0xfbff('0x8'));var config=require('../../config/environment');var controller=require(_0xfbff('0x9'));router[_0xfbff('0xa')]('/',auth[_0xfbff('0xb')](),controller['index']);router[_0xfbff('0xa')](_0xfbff('0xc'),auth[_0xfbff('0xb')](),controller[_0xfbff('0xd')]);router[_0xfbff('0xa')](_0xfbff('0xe'),auth[_0xfbff('0xb')](),controller['show']);router[_0xfbff('0xf')]('/',auth[_0xfbff('0xb')](),interaction['tracked'](_0xfbff('0x10'),_0xfbff('0x11')),controller['create']);router[_0xfbff('0x12')](_0xfbff('0xe'),controller['update']);router[_0xfbff('0x12')]('/:id/accept',auth[_0xfbff('0xb')](),controller[_0xfbff('0x13')]);router['put'](_0xfbff('0x14'),auth[_0xfbff('0xb')](),controller[_0xfbff('0x15')]);router['delete'](_0xfbff('0xe'),auth[_0xfbff('0xb')](),controller[_0xfbff('0x16')]);module[_0xfbff('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 43d335a..f527c93 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x362488,_0xc73de7){var _0xa1b26d=function(_0x909f61){while(--_0x909f61){_0x362488['push'](_0x362488['shift']());}};_0xa1b26d(++_0xc73de7);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f62e4,_0x24435f){_0x1f62e4=_0x1f62e4-0x0;var _0x50014b=_0xb10b[_0x1f62e4];return _0x50014b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x1362a6,_0x8bb652){var _0x514177=function(_0x59ef79){while(--_0x59ef79){_0x1362a6['push'](_0x1362a6['shift']());}};_0x514177(++_0x8bb652);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 451506e..d6c0553 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(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x465017,_0x17cc53){_0x465017=_0x465017-0x0;var _0x53f64e=_0x7a54[_0x465017];return _0x53f64e;};'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(_0x3745b5,_0x2c2dd3){var _0xbf7085=function(_0x441a34){while(--_0x441a34){_0x3745b5['push'](_0x3745b5['shift']());}};_0xbf7085(++_0x2c2dd3);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 b307c8a..daa6486 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 _0x9e3e=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e3e,0x1c6));var _0xe9e3=function(_0x479341,_0x91784){_0x479341=_0x479341-0x0;var _0x42e88d=_0x9e3e[_0x479341];return _0x42e88d;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xe9e3('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xe9e3('0x1')](0x0);var events={'afterCreate':_0xe9e3('0x2'),'afterUpdate':_0xe9e3('0x3'),'afterDestroy':_0xe9e3('0x4')};function emitEvent(_0x353da1){return function(_0x30d28b,_0x352a3c,_0x2692bf){ChatOfflineMessageEvents['emit'](_0x353da1+':'+_0x30d28b['id'],_0x30d28b);ChatOfflineMessageEvents[_0xe9e3('0x5')](_0x353da1,_0x30d28b);_0x2692bf(null);};}for(var e in events){if(events[_0xe9e3('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xe9e3('0x7')](e,emitEvent(event));}}module[_0xe9e3('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x0763=['events','ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0763,0x87));var _0x3076=function(_0x2ddb6d,_0x25d45b){_0x2ddb6d=_0x2ddb6d-0x0;var _0x56c103=_0x0763[_0x2ddb6d];return _0x56c103;};'use strict';var EventEmitter=require(_0x3076('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x3076('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3076('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3076('0x3'),'afterDestroy':_0x3076('0x4')};function emitEvent(_0x3ae0c9){return function(_0xecc289,_0x55bd44,_0x3eba05){ChatOfflineMessageEvents[_0x3076('0x5')](_0x3ae0c9+':'+_0xecc289['id'],_0xecc289);ChatOfflineMessageEvents[_0x3076('0x5')](_0x3ae0c9,_0xecc289);_0x3eba05(null);};}for(var e in events){if(events[_0x3076('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x3076('0x7')](e,emitEvent(event));}}module[_0x3076('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 922222e..46a4d0d 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 _0x888b=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','chat_offline_messages','utf8mb4'];(function(_0x1e9541,_0x4407e6){var _0x2e4dc5=function(_0x562300){while(--_0x562300){_0x1e9541['push'](_0x1e9541['shift']());}};_0x2e4dc5(++_0x4407e6);}(_0x888b,0xb0));var _0xb888=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x888b[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xb888('0x0'));module[_0xb888('0x1')]=function(_0x3985db){return _0x3985db['define']('ChatOfflineMessage',attributes,{'tableName':_0xb888('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb888('0x3'),'collate':_0xb888('0x4')});}; \ No newline at end of file +var _0x2acb=['ChatOfflineMessage','chat_offline_messages','utf8mb4','exports','define'];(function(_0x51c6d6,_0xd22728){var _0x392292=function(_0x44b255){while(--_0x44b255){_0x51c6d6['push'](_0x51c6d6['shift']());}};_0x392292(++_0xd22728);}(_0x2acb,0x1e3));var _0xb2ac=function(_0x332454,_0x15e724){_0x332454=_0x332454-0x0;var _0x58ece6=_0x2acb[_0x332454];return _0x58ece6;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xb2ac('0x0')]=function(_0x1845f6){return _0x1845f6[_0xb2ac('0x1')](_0xb2ac('0x2'),attributes,{'tableName':_0xb2ac('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb2ac('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index fa965b7..30dc818 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 _0xe041=['error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x45f17,_0x4e2d92){var _0x31aae0=function(_0x782c5a){while(--_0x782c5a){_0x45f17['push'](_0x45f17['shift']());}};_0x31aae0(++_0x4e2d92);}(_0xe041,0x17b));var _0x1e04=function(_0x3d7bc8,_0x1388a9){_0x3d7bc8=_0x3d7bc8-0x0;var _0x328746=_0xe041[_0x3d7bc8];return _0x328746;};'use strict';var _=require(_0x1e04('0x0'));var util=require(_0x1e04('0x1'));var moment=require('moment');var BPromise=require(_0x1e04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e04('0x3'));var db=require(_0x1e04('0x4'))['db'];var utils=require(_0x1e04('0x5'));var logger=require('../../config/logger')(_0x1e04('0x6'));var config=require(_0x1e04('0x7'));var jayson=require(_0x1e04('0x8'));var client=jayson[_0x1e04('0x9')][_0x1e04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fe4f8,_0x32ff4,_0x4c3007){return new BPromise(function(_0x5422d4,_0x58e607){return client[_0x1e04('0xb')](_0x2fe4f8,_0x4c3007)['then'](function(_0xba07f0){logger[_0x1e04('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x32ff4,_0x1e04('0xd'));logger[_0x1e04('0xe')](_0x1e04('0xf'),_0x32ff4,'request\x20sent',JSON[_0x1e04('0x10')](_0xba07f0));if(_0xba07f0[_0x1e04('0x11')]){if(_0xba07f0[_0x1e04('0x11')][_0x1e04('0x12')]===0x1f4){logger[_0x1e04('0x11')](_0x1e04('0x13'),_0x32ff4,_0xba07f0[_0x1e04('0x11')]['message']);return _0x58e607(_0xba07f0[_0x1e04('0x11')][_0x1e04('0x14')]);}logger['error'](_0x1e04('0x13'),_0x32ff4,_0xba07f0[_0x1e04('0x11')][_0x1e04('0x14')]);return _0x5422d4(_0xba07f0['error'][_0x1e04('0x14')]);}else{logger[_0x1e04('0xc')](_0x1e04('0x13'),_0x32ff4,_0x1e04('0xd'));_0x5422d4(_0xba07f0['result']['message']);}})[_0x1e04('0x15')](function(_0x46b963){logger[_0x1e04('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x32ff4,_0x46b963);_0x58e607(_0x46b963);});});} \ No newline at end of file +var _0x13c4=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f6c1a,_0x40d0fa){var _0x124c11=function(_0xbf9d0e){while(--_0xbf9d0e){_0x1f6c1a['push'](_0x1f6c1a['shift']());}};_0x124c11(++_0x40d0fa);}(_0x13c4,0xf9));var _0x413c=function(_0x52b1e5,_0x2989ac){_0x52b1e5=_0x52b1e5-0x0;var _0x47d819=_0x13c4[_0x52b1e5];return _0x47d819;};'use strict';var _=require(_0x413c('0x0'));var util=require(_0x413c('0x1'));var moment=require(_0x413c('0x2'));var BPromise=require(_0x413c('0x3'));var rs=require(_0x413c('0x4'));var fs=require('fs');var Redis=require(_0x413c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x413c('0x6'));var config=require(_0x413c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x413c('0x8')][_0x413c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f057e,_0x1d1b80,_0x11bc3d){return new BPromise(function(_0xbe3daf,_0x2ec3f5){return client[_0x413c('0xa')](_0x1f057e,_0x11bc3d)[_0x413c('0xb')](function(_0x5191dc){logger['info'](_0x413c('0xc'),_0x1d1b80,_0x413c('0xd'));logger[_0x413c('0xe')](_0x413c('0xf'),_0x1d1b80,_0x413c('0xd'),JSON[_0x413c('0x10')](_0x5191dc));if(_0x5191dc[_0x413c('0x11')]){if(_0x5191dc[_0x413c('0x11')][_0x413c('0x12')]===0x1f4){logger['error'](_0x413c('0xc'),_0x1d1b80,_0x5191dc[_0x413c('0x11')][_0x413c('0x13')]);return _0x2ec3f5(_0x5191dc[_0x413c('0x11')][_0x413c('0x13')]);}logger['error'](_0x413c('0xc'),_0x1d1b80,_0x5191dc[_0x413c('0x11')][_0x413c('0x13')]);return _0xbe3daf(_0x5191dc['error'][_0x413c('0x13')]);}else{logger[_0x413c('0x14')](_0x413c('0xc'),_0x1d1b80,_0x413c('0xd'));_0xbe3daf(_0x5191dc[_0x413c('0x15')]['message']);}})['catch'](function(_0x414ae9){logger[_0x413c('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1d1b80,_0x414ae9);_0x2ec3f5(_0x414ae9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f833df1..d4be554 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 _0xb7bd=['update','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put'];(function(_0x4e279f,_0x54b208){var _0x21cc83=function(_0x480283){while(--_0x480283){_0x4e279f['push'](_0x4e279f['shift']());}};_0x21cc83(++_0x54b208);}(_0xb7bd,0x1dd));var _0xdb7b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb7bd[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xdb7b('0x0'));var util=require(_0xdb7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdb7b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdb7b('0x3'));var interaction=require(_0xdb7b('0x4'));var config=require(_0xdb7b('0x5'));var controller=require(_0xdb7b('0x6'));router[_0xdb7b('0x7')]('/',auth[_0xdb7b('0x8')](),controller[_0xdb7b('0x9')]);router[_0xdb7b('0x7')](_0xdb7b('0xa'),auth[_0xdb7b('0x8')](),controller['describe']);router[_0xdb7b('0x7')](_0xdb7b('0xb'),auth[_0xdb7b('0x8')](),controller[_0xdb7b('0xc')]);router[_0xdb7b('0xd')]('/',auth[_0xdb7b('0x8')](),controller[_0xdb7b('0xe')]);router[_0xdb7b('0xf')](_0xdb7b('0xb'),auth[_0xdb7b('0x8')](),controller[_0xdb7b('0x10')]);router['delete'](_0xdb7b('0xb'),auth[_0xdb7b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9dca=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','exports'];(function(_0x3bb767,_0x2edc99){var _0x1af40b=function(_0x47c3cd){while(--_0x47c3cd){_0x3bb767['push'](_0x3bb767['shift']());}};_0x1af40b(++_0x2edc99);}(_0x9dca,0xee));var _0xa9dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9dca[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xa9dc('0x0'));var path=require(_0xa9dc('0x1'));var timeout=require(_0xa9dc('0x2'));var express=require(_0xa9dc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa9dc('0x4'));var interaction=require(_0xa9dc('0x5'));var config=require(_0xa9dc('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0xa9dc('0x7')]('/',auth[_0xa9dc('0x8')](),controller['index']);router[_0xa9dc('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa9dc('0x9')]);router[_0xa9dc('0x7')](_0xa9dc('0xa'),auth[_0xa9dc('0x8')](),controller[_0xa9dc('0xb')]);router[_0xa9dc('0xc')]('/',auth[_0xa9dc('0x8')](),controller[_0xa9dc('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa9dc('0xe')]);router[_0xa9dc('0xf')]('/:id',auth[_0xa9dc('0x8')](),controller['destroy']);module[_0xa9dc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 109564d..6206c18 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 _0xecf4=['mouseOver','timeout','sequelize','exports','ENUM'];(function(_0x2498b5,_0x3b0a69){var _0x4edf95=function(_0x22642d){while(--_0x22642d){_0x2498b5['push'](_0x2498b5['shift']());}};_0x4edf95(++_0x3b0a69);}(_0xecf4,0x98));var _0x4ecf=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xecf4[_0x2338fa];return _0x42df9b;};'use strict';var Sequelize=require(_0x4ecf('0x0'));module[_0x4ecf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4ecf('0x2')](_0x4ecf('0x3'),_0x4ecf('0x4')),'defaultValue':_0x4ecf('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6b43=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6b43,0x1ca));var _0x36b4=function(_0x27e076,_0x5149f2){_0x27e076=_0x27e076-0x0;var _0x2ce67b=_0x6b43[_0x27e076];return _0x2ce67b;};'use strict';var Sequelize=require(_0x36b4('0x0'));module[_0x36b4('0x1')]={'name':{'type':Sequelize[_0x36b4('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x36b4('0x3'),_0x36b4('0x4')),'defaultValue':_0x36b4('0x3')},'selector':{'type':Sequelize[_0x36b4('0x2')]},'timeout':{'type':Sequelize[_0x36b4('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 15eb2e7..6739512 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 _0xb66c=['options','find','catch','ChatProactiveAction','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','show','params','rawAttributes','keys','query','filters','model','attributes','intersection','fields','includeAll','include','merge'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb66c,0x175));var _0xcb66=function(_0x174adf,_0x3e769a){_0x174adf=_0x174adf-0x0;var _0x16f626=_0xb66c[_0x174adf];return _0x16f626;};'use strict';var emlformat=require(_0xcb66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb66('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb66('0x2'));var moment=require(_0xcb66('0x3'));var BPromise=require(_0xcb66('0x4'));var Mustache=require('mustache');var util=require(_0xcb66('0x5'));var path=require(_0xcb66('0x6'));var sox=require(_0xcb66('0x7'));var csv=require(_0xcb66('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb66('0x9'));var squel=require(_0xcb66('0xa'));var crypto=require(_0xcb66('0xb'));var jsforce=require(_0xcb66('0xc'));var deskjs=require(_0xcb66('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcb66('0xe'));var Papa=require(_0xcb66('0xf'));var Redis=require(_0xcb66('0x10'));var authService=require(_0xcb66('0x11'));var qs=require(_0xcb66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb66('0x13'));var logger=require(_0xcb66('0x14'))(_0xcb66('0x15'));var utils=require(_0xcb66('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcb66('0x17'));var db=require(_0xcb66('0x18'))['db'];function respondWithStatusCode(_0x4105d2,_0x2339bb){_0x2339bb=_0x2339bb||0xcc;return function(_0x582523){if(_0x582523){return _0x4105d2[_0xcb66('0x19')](_0x2339bb);}return _0x4105d2[_0xcb66('0x1a')](_0x2339bb)[_0xcb66('0x1b')]();};}function respondWithResult(_0x401bc9,_0x58fb9e){_0x58fb9e=_0x58fb9e||0xc8;return function(_0x19072b){if(_0x19072b){return _0x401bc9['status'](_0x58fb9e)[_0xcb66('0x1c')](_0x19072b);}};}function respondWithFilteredResult(_0x52b058,_0x27442d){return function(_0x573dc7){if(_0x573dc7){var _0x4bef09=typeof _0x27442d[_0xcb66('0x1d')]===_0xcb66('0x1e')&&typeof _0x27442d[_0xcb66('0x1f')]===_0xcb66('0x1e');var _0x4d99c0=_0x573dc7[_0xcb66('0x20')];var _0x42ad03=_0x4bef09?0x0:_0x27442d[_0xcb66('0x1d')];var _0x58bca0=_0x4bef09?_0x573dc7[_0xcb66('0x20')]:_0x27442d['offset']+_0x27442d[_0xcb66('0x1f')];var _0x41edae;if(_0x58bca0>=_0x4d99c0){_0x58bca0=_0x4d99c0;_0x41edae=0xc8;}else{_0x41edae=0xce;}_0x52b058[_0xcb66('0x1a')](_0x41edae);return _0x52b058[_0xcb66('0x21')]('Content-Range',_0x42ad03+'-'+_0x58bca0+'/'+_0x4d99c0)['json'](_0x573dc7);}return null;};}function patchUpdates(_0x4d9690){return function(_0xb39b87){try{jsonpatch['apply'](_0xb39b87,_0x4d9690,!![]);}catch(_0x5e07e8){return BPromise[_0xcb66('0x22')](_0x5e07e8);}return _0xb39b87['save']();};}function saveUpdates(_0x1c1219,_0x12e2bc){return function(_0x602b44){if(_0x602b44){return _0x602b44[_0xcb66('0x23')](_0x1c1219)[_0xcb66('0x24')](function(_0x204f15){return _0x204f15;});}return null;};}function removeEntity(_0x3391a0,_0x5977e1){return function(_0x36faba){if(_0x36faba){return _0x36faba['destroy']()['then'](function(){_0x3391a0[_0xcb66('0x1a')](0xcc)[_0xcb66('0x1b')]();});}};}function handleEntityNotFound(_0x19da3b,_0x5f389f){return function(_0x341554){if(!_0x341554){_0x19da3b[_0xcb66('0x19')](0x194);}return _0x341554;};}function handleError(_0x43cd8f,_0x40e3de){_0x40e3de=_0x40e3de||0x1f4;return function(_0x5affdb){logger[_0xcb66('0x25')](_0x5affdb[_0xcb66('0x26')]);if(_0x5affdb[_0xcb66('0x27')]){delete _0x5affdb[_0xcb66('0x27')];}_0x43cd8f[_0xcb66('0x1a')](_0x40e3de)[_0xcb66('0x28')](_0x5affdb);};}exports[_0xcb66('0x29')]=function(_0x967710,_0x28fc0b){var _0x178a06={'raw':!![],'where':{'id':_0x967710[_0xcb66('0x2a')]['id']}},_0x516194={};_0x516194['model']=_['keys'](db['ChatProactiveAction'][_0xcb66('0x2b')]);_0x516194['query']=_[_0xcb66('0x2c')](_0x967710[_0xcb66('0x2d')]);_0x516194[_0xcb66('0x2e')]=_['intersection'](_0x516194[_0xcb66('0x2f')],_0x516194[_0xcb66('0x2d')]);_0x178a06[_0xcb66('0x30')]=_[_0xcb66('0x31')](_0x516194[_0xcb66('0x2f')],qs[_0xcb66('0x32')](_0x967710[_0xcb66('0x2d')][_0xcb66('0x32')]));_0x178a06[_0xcb66('0x30')]=_0x178a06[_0xcb66('0x30')]['length']?_0x178a06[_0xcb66('0x30')]:_0x516194[_0xcb66('0x2f')];if(_0x967710[_0xcb66('0x2d')][_0xcb66('0x33')]){_0x178a06[_0xcb66('0x34')]=[{'all':!![]}];}_0x178a06=_[_0xcb66('0x35')]({},_0x178a06,_0x967710[_0xcb66('0x36')]);return db['ChatProactiveAction'][_0xcb66('0x37')](_0x178a06)[_0xcb66('0x24')](handleEntityNotFound(_0x28fc0b,null))[_0xcb66('0x24')](respondWithResult(_0x28fc0b,null))[_0xcb66('0x38')](handleError(_0x28fc0b,null));};exports['create']=function(_0x1a9545,_0x17a21a){return db[_0xcb66('0x39')][_0xcb66('0x3a')](_0x1a9545[_0xcb66('0x3b')],{})[_0xcb66('0x24')](respondWithResult(_0x17a21a,0xc9))[_0xcb66('0x38')](handleError(_0x17a21a,null));};exports[_0xcb66('0x23')]=function(_0x3ae1cc,_0x299156){if(_0x3ae1cc[_0xcb66('0x3b')]['id']){delete _0x3ae1cc[_0xcb66('0x3b')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x3ae1cc['params']['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0x299156,null))[_0xcb66('0x24')](saveUpdates(_0x3ae1cc[_0xcb66('0x3b')],null))[_0xcb66('0x24')](respondWithResult(_0x299156,null))[_0xcb66('0x38')](handleError(_0x299156,null));};exports[_0xcb66('0x3c')]=function(_0x4c53b8,_0x13865f){return db['ChatProactiveAction']['find']({'where':{'id':_0x4c53b8['params']['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0x13865f,null))[_0xcb66('0x24')](removeEntity(_0x13865f,null))[_0xcb66('0x38')](handleError(_0x13865f,null));}; \ No newline at end of file +var _0xe4b8=['sox','to-csv','fs-extra','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','apply','reject','update','then','destroy','end','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xe4b8,0x179));var _0x8e4b=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe4b8[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x8e4b('0x0'));var rimraf=require(_0x8e4b('0x1'));var zipdir=require(_0x8e4b('0x2'));var jsonpatch=require(_0x8e4b('0x3'));var rp=require(_0x8e4b('0x4'));var moment=require(_0x8e4b('0x5'));var BPromise=require(_0x8e4b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e4b('0x7'));var sox=require(_0x8e4b('0x8'));var csv=require(_0x8e4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e4b('0xa'));var _=require('lodash');var squel=require(_0x8e4b('0xb'));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(_0x8e4b('0xc'));var Redis=require('ioredis');var authService=require(_0x8e4b('0xd'));var qs=require(_0x8e4b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e4b('0xf'));var logger=require(_0x8e4b('0x10'))(_0x8e4b('0x11'));var utils=require('../../config/utils');var config=require(_0x8e4b('0x12'));var licenseUtil=require(_0x8e4b('0x13'));var db=require(_0x8e4b('0x14'))['db'];function respondWithStatusCode(_0x13f8a6,_0x30b1c8){_0x30b1c8=_0x30b1c8||0xcc;return function(_0x30d9d1){if(_0x30d9d1){return _0x13f8a6[_0x8e4b('0x15')](_0x30b1c8);}return _0x13f8a6[_0x8e4b('0x16')](_0x30b1c8)['end']();};}function respondWithResult(_0x5f56fb,_0x2e8e71){_0x2e8e71=_0x2e8e71||0xc8;return function(_0x261e76){if(_0x261e76){return _0x5f56fb[_0x8e4b('0x16')](_0x2e8e71)[_0x8e4b('0x17')](_0x261e76);}};}function respondWithFilteredResult(_0x276d96,_0x4d10fd){return function(_0x4b0197){if(_0x4b0197){var _0xfff6b=typeof _0x4d10fd['offset']==='undefined'&&typeof _0x4d10fd[_0x8e4b('0x18')]==='undefined';var _0x38cbf5=_0x4b0197['count'];var _0x444c19=_0xfff6b?0x0:_0x4d10fd[_0x8e4b('0x19')];var _0x4b2458=_0xfff6b?_0x4b0197['count']:_0x4d10fd[_0x8e4b('0x19')]+_0x4d10fd[_0x8e4b('0x18')];var _0x38d4a7;if(_0x4b2458>=_0x38cbf5){_0x4b2458=_0x38cbf5;_0x38d4a7=0xc8;}else{_0x38d4a7=0xce;}_0x276d96[_0x8e4b('0x16')](_0x38d4a7);return _0x276d96[_0x8e4b('0x1a')](_0x8e4b('0x1b'),_0x444c19+'-'+_0x4b2458+'/'+_0x38cbf5)[_0x8e4b('0x17')](_0x4b0197);}return null;};}function patchUpdates(_0x27f816){return function(_0x9eeb68){try{jsonpatch[_0x8e4b('0x1c')](_0x9eeb68,_0x27f816,!![]);}catch(_0x123017){return BPromise[_0x8e4b('0x1d')](_0x123017);}return _0x9eeb68['save']();};}function saveUpdates(_0xa4c5ad,_0x16ff18){return function(_0x5f3043){if(_0x5f3043){return _0x5f3043[_0x8e4b('0x1e')](_0xa4c5ad)[_0x8e4b('0x1f')](function(_0x54b17e){return _0x54b17e;});}return null;};}function removeEntity(_0x2bd4e7,_0x719300){return function(_0x5e8915){if(_0x5e8915){return _0x5e8915[_0x8e4b('0x20')]()[_0x8e4b('0x1f')](function(){_0x2bd4e7['status'](0xcc)[_0x8e4b('0x21')]();});}};}function handleEntityNotFound(_0x2b29a4,_0xbd7008){return function(_0x376202){if(!_0x376202){_0x2b29a4[_0x8e4b('0x15')](0x194);}return _0x376202;};}function handleError(_0x43a92d,_0x535f71){_0x535f71=_0x535f71||0x1f4;return function(_0x395927){logger['error'](_0x395927['stack']);if(_0x395927[_0x8e4b('0x22')]){delete _0x395927[_0x8e4b('0x22')];}_0x43a92d['status'](_0x535f71)[_0x8e4b('0x23')](_0x395927);};}exports['show']=function(_0x6d7fbd,_0x5c5c34){var _0x2fd8da={'raw':!![],'where':{'id':_0x6d7fbd[_0x8e4b('0x24')]['id']}},_0xe991c2={};_0xe991c2[_0x8e4b('0x25')]=_[_0x8e4b('0x26')](db[_0x8e4b('0x27')][_0x8e4b('0x28')]);_0xe991c2[_0x8e4b('0x29')]=_['keys'](_0x6d7fbd['query']);_0xe991c2[_0x8e4b('0x2a')]=_[_0x8e4b('0x2b')](_0xe991c2[_0x8e4b('0x25')],_0xe991c2[_0x8e4b('0x29')]);_0x2fd8da[_0x8e4b('0x2c')]=_[_0x8e4b('0x2b')](_0xe991c2[_0x8e4b('0x25')],qs[_0x8e4b('0x2d')](_0x6d7fbd['query'][_0x8e4b('0x2d')]));_0x2fd8da[_0x8e4b('0x2c')]=_0x2fd8da[_0x8e4b('0x2c')][_0x8e4b('0x2e')]?_0x2fd8da[_0x8e4b('0x2c')]:_0xe991c2['model'];if(_0x6d7fbd[_0x8e4b('0x29')][_0x8e4b('0x2f')]){_0x2fd8da[_0x8e4b('0x30')]=[{'all':!![]}];}_0x2fd8da=_[_0x8e4b('0x31')]({},_0x2fd8da,_0x6d7fbd[_0x8e4b('0x32')]);return db[_0x8e4b('0x27')][_0x8e4b('0x33')](_0x2fd8da)[_0x8e4b('0x1f')](handleEntityNotFound(_0x5c5c34,null))['then'](respondWithResult(_0x5c5c34,null))[_0x8e4b('0x34')](handleError(_0x5c5c34,null));};exports[_0x8e4b('0x35')]=function(_0x1451ed,_0xe5eecf){return db[_0x8e4b('0x27')][_0x8e4b('0x35')](_0x1451ed[_0x8e4b('0x36')],{})[_0x8e4b('0x1f')](respondWithResult(_0xe5eecf,0xc9))[_0x8e4b('0x34')](handleError(_0xe5eecf,null));};exports[_0x8e4b('0x1e')]=function(_0x29c967,_0xe9e112){if(_0x29c967[_0x8e4b('0x36')]['id']){delete _0x29c967['body']['id'];}return db[_0x8e4b('0x27')]['find']({'where':{'id':_0x29c967[_0x8e4b('0x24')]['id']}})[_0x8e4b('0x1f')](handleEntityNotFound(_0xe9e112,null))['then'](saveUpdates(_0x29c967[_0x8e4b('0x36')],null))['then'](respondWithResult(_0xe9e112,null))[_0x8e4b('0x34')](handleError(_0xe9e112,null));};exports[_0x8e4b('0x20')]=function(_0xd466d,_0x15a82f){return db[_0x8e4b('0x27')]['find']({'where':{'id':_0xd466d['params']['id']}})[_0x8e4b('0x1f')](handleEntityNotFound(_0x15a82f,null))[_0x8e4b('0x1f')](removeEntity(_0x15a82f,null))[_0x8e4b('0x34')](handleError(_0x15a82f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2f7430a..6bbffea 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 _0x45e0=['../../config/logger','api','moment','request-promise','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util'];(function(_0xf22dce,_0x46f799){var _0x55c4ba=function(_0xc09efa){while(--_0xc09efa){_0xf22dce['push'](_0xf22dce['shift']());}};_0x55c4ba(++_0x46f799);}(_0x45e0,0x117));var _0x045e=function(_0x5b5490,_0x687b7c){_0x5b5490=_0x5b5490-0x0;var _0x2cdc70=_0x45e0[_0x5b5490];return _0x2cdc70;};'use strict';var _=require('lodash');var util=require(_0x045e('0x0'));var logger=require(_0x045e('0x1'))(_0x045e('0x2'));var moment=require(_0x045e('0x3'));var BPromise=require('bluebird');var rp=require(_0x045e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x045e('0x5'));var attributes=require(_0x045e('0x6'));module[_0x045e('0x7')]=function(_0x337f1c,_0xe1291){return _0x337f1c[_0x045e('0x8')](_0x045e('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4a0=['exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','request-promise','../../config/environment','./chatProactiveAction.attributes'];(function(_0x21e3c5,_0x5b882f){var _0x2f52c1=function(_0x2bda37){while(--_0x2bda37){_0x21e3c5['push'](_0x21e3c5['shift']());}};_0x2f52c1(++_0x5b882f);}(_0xb4a0,0x1dd));var _0x0b4a=function(_0x322eb7,_0x42c39e){_0x322eb7=_0x322eb7-0x0;var _0x272472=_0xb4a0[_0x322eb7];return _0x272472;};'use strict';var _=require(_0x0b4a('0x0'));var util=require(_0x0b4a('0x1'));var logger=require('../../config/logger')(_0x0b4a('0x2'));var moment=require(_0x0b4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b4a('0x5'));var attributes=require(_0x0b4a('0x6'));module[_0x0b4a('0x7')]=function(_0x589c96,_0x2bee4a){return _0x589c96[_0x0b4a('0x8')](_0x0b4a('0x9'),attributes,{'tableName':_0x0b4a('0xa'),'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 03740b8..1c8add2 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 _0x5ccc=['../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x5ccc,0x127));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc5cc('0x0'));var moment=require(_0xc5cc('0x1'));var BPromise=require(_0xc5cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc5cc('0x3'));var logger=require(_0xc5cc('0x4'))('rpc');var config=require(_0xc5cc('0x5'));var jayson=require(_0xc5cc('0x6'));var client=jayson['client'][_0xc5cc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x126d90,_0x4a1241,_0x335d05){return new BPromise(function(_0x116fe1,_0x44cea4){return client[_0xc5cc('0x8')](_0x126d90,_0x335d05)[_0xc5cc('0x9')](function(_0x1028f6){logger[_0xc5cc('0xa')](_0xc5cc('0xb'),_0x4a1241,_0xc5cc('0xc'));logger['debug'](_0xc5cc('0xd'),_0x4a1241,_0xc5cc('0xc'),JSON[_0xc5cc('0xe')](_0x1028f6));if(_0x1028f6[_0xc5cc('0xf')]){if(_0x1028f6['error'][_0xc5cc('0x10')]===0x1f4){logger[_0xc5cc('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a1241,_0x1028f6[_0xc5cc('0xf')][_0xc5cc('0x11')]);return _0x44cea4(_0x1028f6['error'][_0xc5cc('0x11')]);}logger['error'](_0xc5cc('0xb'),_0x4a1241,_0x1028f6[_0xc5cc('0xf')]['message']);return _0x116fe1(_0x1028f6['error']['message']);}else{logger[_0xc5cc('0xa')](_0xc5cc('0xb'),_0x4a1241,_0xc5cc('0xc'));_0x116fe1(_0x1028f6[_0xc5cc('0x12')][_0xc5cc('0x11')]);}})[_0xc5cc('0x13')](function(_0x88f77a){logger[_0xc5cc('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4a1241,_0x88f77a);_0x44cea4(_0x88f77a);});});} \ No newline at end of file +var _0x51c4=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x296a27,_0x2ce981){var _0x52a684=function(_0x5d06fa){while(--_0x5d06fa){_0x296a27['push'](_0x296a27['shift']());}};_0x52a684(++_0x2ce981);}(_0x51c4,0x1a3));var _0x451c=function(_0xb1f97f,_0x3c7559){_0xb1f97f=_0xb1f97f-0x0;var _0x1f2cea=_0x51c4[_0xb1f97f];return _0x1f2cea;};'use strict';var _=require(_0x451c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x451c('0x1'));var rs=require(_0x451c('0x2'));var fs=require('fs');var Redis=require(_0x451c('0x3'));var db=require(_0x451c('0x4'))['db'];var utils=require(_0x451c('0x5'));var logger=require(_0x451c('0x6'))(_0x451c('0x7'));var config=require(_0x451c('0x8'));var jayson=require(_0x451c('0x9'));var client=jayson[_0x451c('0xa')][_0x451c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ed034,_0x22ab0a,_0x4558f1){return new BPromise(function(_0x1872b9,_0x5b0f44){return client[_0x451c('0xc')](_0x5ed034,_0x4558f1)[_0x451c('0xd')](function(_0x43db87){logger[_0x451c('0xe')](_0x451c('0xf'),_0x22ab0a,_0x451c('0x10'));logger[_0x451c('0x11')](_0x451c('0x12'),_0x22ab0a,_0x451c('0x10'),JSON[_0x451c('0x13')](_0x43db87));if(_0x43db87[_0x451c('0x14')]){if(_0x43db87['error'][_0x451c('0x15')]===0x1f4){logger[_0x451c('0x14')](_0x451c('0xf'),_0x22ab0a,_0x43db87['error'][_0x451c('0x16')]);return _0x5b0f44(_0x43db87[_0x451c('0x14')]['message']);}logger[_0x451c('0x14')](_0x451c('0xf'),_0x22ab0a,_0x43db87[_0x451c('0x14')][_0x451c('0x16')]);return _0x1872b9(_0x43db87['error'][_0x451c('0x16')]);}else{logger[_0x451c('0xe')](_0x451c('0xf'),_0x22ab0a,'request\x20sent');_0x1872b9(_0x43db87['result']['message']);}})[_0x451c('0x17')](function(_0x1f439b){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x22ab0a,_0x1f439b);_0x5b0f44(_0x1f439b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index adccab4..0ace52d 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4787e4,_0x2a4ad7){var _0x531437=function(_0x726776){while(--_0x726776){_0x4787e4['push'](_0x4787e4['shift']());}};_0x531437(++_0x2a4ad7);}(_0xeda8,0x104));var _0x8eda=function(_0x2b37b5,_0x3a30a6){_0x2b37b5=_0x2b37b5-0x0;var _0x1b5022=_0xeda8[_0x2b37b5];return _0x1b5022;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0xa6a92b,_0x343370){var _0x43370f=function(_0x13ca35){while(--_0x13ca35){_0xa6a92b['push'](_0xa6a92b['shift']());}};_0x43370f(++_0x343370);}(_0xd8fb,0x99));var _0xbd8f=function(_0x66b2af,_0x500851){_0x66b2af=_0x66b2af-0x0;var _0xdc1479=_0xd8fb[_0x66b2af];return _0xdc1479;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 1c1ed68..0453c83 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 _0xf8fa=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0xf8fa,0x71));var _0xaf8f=function(_0x13132f,_0x3fdceb){_0x13132f=_0x13132f-0x0;var _0x8fe386=_0xf8fa[_0x13132f];return _0x8fe386;};'use strict';var Sequelize=require(_0xaf8f('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf8f('0x1')],'unique':_0xaf8f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaf8f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaf8f('0x4')](_0xaf8f('0x5'),_0xaf8f('0x6'),_0xaf8f('0x7'))}}; \ No newline at end of file +var _0x6c64=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5ac074,_0x10e8c2){var _0x593257=function(_0x3786e2){while(--_0x3786e2){_0x5ac074['push'](_0x5ac074['shift']());}};_0x593257(++_0x10e8c2);}(_0x6c64,0x1d2));var _0x46c6=function(_0x54f189,_0x38ccea){_0x54f189=_0x54f189-0x0;var _0xd6271f=_0x6c64[_0x54f189];return _0xd6271f;};'use strict';var Sequelize=require(_0x46c6('0x0'));module['exports']={'name':{'type':Sequelize[_0x46c6('0x1')],'unique':_0x46c6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x46c6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46c6('0x4')](_0x46c6('0x5'),_0x46c6('0x6'),_0x46c6('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a8525e8..c9af56b 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 _0x6dd1=['clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','status','end','offset','limit','undefined','set','Content-Range','json','update','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','index','rawAttributes','type','key','getOptions','where','count','include','query','ChatQueue','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','merge','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','hasOwnProperty','order','sort','ChatQueueId','filter','map','User','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','chatPause','getTeams','findOne','Team','pick','nolimit','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6dd1,0x90));var _0x16dd=function(_0x2a39e0,_0x3231da){_0x2a39e0=_0x2a39e0-0x0;var _0x377c37=_0x6dd1[_0x2a39e0];return _0x377c37;};'use strict';var BPromise=require(_0x16dd('0x0'));var util=require(_0x16dd('0x1'));var _=require(_0x16dd('0x2'));var squel=require(_0x16dd('0x3'));var Redis=require(_0x16dd('0x4'));var qs=require(_0x16dd('0x5'));var logger=require(_0x16dd('0x6'))(_0x16dd('0x7'));var config=require(_0x16dd('0x8'));var db=require(_0x16dd('0x9'))['db'];config[_0x16dd('0xa')]=_['defaults'](config[_0x16dd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x16dd('0xb'))(new Redis(config[_0x16dd('0xa')]));require(_0x16dd('0xc'))[_0x16dd('0xd')](socket);function respondWithStatusCode(_0x210610,_0x49fef7){_0x49fef7=_0x49fef7||0xcc;return function(_0x32ba17){if(_0x32ba17){return _0x210610['sendStatus'](_0x49fef7);}return _0x210610[_0x16dd('0xe')](_0x49fef7)[_0x16dd('0xf')]();};}function respondWithResult(_0x461d1f,_0x57db98){_0x57db98=_0x57db98||0xc8;return function(_0x4ee94b){if(_0x4ee94b){return _0x461d1f['status'](_0x57db98)['json'](_0x4ee94b);}};}function respondWithFilteredResult(_0x598590,_0x4af0b8){return function(_0x45ec9a){if(_0x45ec9a){var _0x565d59=typeof _0x4af0b8[_0x16dd('0x10')]==='undefined'&&typeof _0x4af0b8[_0x16dd('0x11')]===_0x16dd('0x12');var _0x2314db=_0x45ec9a['count'];var _0x1ef12f=_0x565d59?0x0:_0x4af0b8['offset'];var _0x419b8b=_0x565d59?_0x45ec9a['count']:_0x4af0b8[_0x16dd('0x10')]+_0x4af0b8[_0x16dd('0x11')];var _0x44d3a9;if(_0x419b8b>=_0x2314db){_0x419b8b=_0x2314db;_0x44d3a9=0xc8;}else{_0x44d3a9=0xce;}_0x598590[_0x16dd('0xe')](_0x44d3a9);return _0x598590[_0x16dd('0x13')](_0x16dd('0x14'),_0x1ef12f+'-'+_0x419b8b+'/'+_0x2314db)[_0x16dd('0x15')](_0x45ec9a);}return null;};}function saveUpdates(_0x4b37dc){return function(_0xcc101b){if(_0xcc101b){return _0xcc101b[_0x16dd('0x16')](_0x4b37dc)[_0x16dd('0x17')](function(_0x477617){return _0x477617;});}return null;};}function removeEntity(_0x25ea45){return function(_0x68eb00){if(_0x68eb00){return _0x68eb00[_0x16dd('0x18')]()['then'](function(){var _0x2d0281=_0x68eb00[_0x16dd('0x19')]({'plain':!![]});var _0x234c4f=_0x16dd('0x1a');return db[_0x16dd('0x1b')][_0x16dd('0x18')]({'where':{'type':_0x234c4f,'resourceId':_0x2d0281['id']}})[_0x16dd('0x17')](function(){return _0x68eb00;});})[_0x16dd('0x17')](function(){_0x25ea45[_0x16dd('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58bc93){return function(_0x527ec){if(!_0x527ec){_0x58bc93[_0x16dd('0x1c')](0x194);}return _0x527ec;};}function handleError(_0x4e7374,_0x1bd278){_0x1bd278=_0x1bd278||0x1f4;return function(_0x25523f){logger['error'](_0x25523f[_0x16dd('0x1d')]);if(_0x25523f[_0x16dd('0x1e')]){delete _0x25523f[_0x16dd('0x1e')];}_0x4e7374[_0x16dd('0xe')](_0x1bd278)['send'](_0x25523f);};}exports[_0x16dd('0x1f')]=function(_0x4bcd3e,_0x1a35c5){var _0x15aa4b={};var _0x15f720={'count':0x0,'rows':[]};var _0x127229=_['map'](db['ChatQueue'][_0x16dd('0x20')],function(_0x293dd4){return{'name':_0x293dd4['fieldName'],'type':_0x293dd4[_0x16dd('0x21')][_0x16dd('0x22')]};});_0x15aa4b=qs[_0x16dd('0x23')](_0x127229,_0x4bcd3e);var _0x5e8e14={'where':_0x15aa4b[_0x16dd('0x24')]};return db['ChatQueue']['count'](_0x5e8e14)['then'](function(_0x4f5d2f){_0x15f720[_0x16dd('0x25')]=_0x4f5d2f;_0x15aa4b[_0x16dd('0x26')]=qs[_0x16dd('0x26')](_0x4bcd3e[_0x16dd('0x27')]);return db[_0x16dd('0x28')][_0x16dd('0x29')](_0x15aa4b);})['then'](function(_0x154223){_0x15f720['rows']=_0x154223;return _0x15f720;})[_0x16dd('0x17')](respondWithFilteredResult(_0x1a35c5,_0x15aa4b))[_0x16dd('0x2a')](handleError(_0x1a35c5,null));};exports[_0x16dd('0x2b')]=function(_0x591dc8,_0x141856){var _0x585372={'raw':!![],'where':{'id':_0x591dc8[_0x16dd('0x2c')]['id']}},_0xedd650={};_0xedd650[_0x16dd('0x2d')]=_[_0x16dd('0x2e')](db[_0x16dd('0x28')]['rawAttributes']);_0xedd650[_0x16dd('0x27')]=_['keys'](_0x591dc8[_0x16dd('0x27')]);_0xedd650[_0x16dd('0x2f')]=_[_0x16dd('0x30')](_0xedd650[_0x16dd('0x2d')],_0xedd650[_0x16dd('0x27')]);_0x585372[_0x16dd('0x31')]=_[_0x16dd('0x30')](_0xedd650[_0x16dd('0x2d')],qs['fields'](_0x591dc8[_0x16dd('0x27')][_0x16dd('0x32')]));_0x585372['attributes']=_0x585372[_0x16dd('0x31')][_0x16dd('0x33')]?_0x585372['attributes']:_0xedd650['model'];if(_0x591dc8['query']['includeAll']){_0x585372[_0x16dd('0x26')]=[{'all':!![]}];}_0x585372=_[_0x16dd('0x34')]({},_0x585372,_0x591dc8[_0x16dd('0x35')]);return db['ChatQueue'][_0x16dd('0x36')](_0x585372)[_0x16dd('0x17')](handleEntityNotFound(_0x141856,null))['then'](respondWithResult(_0x141856,null))[_0x16dd('0x2a')](handleError(_0x141856,null));};exports['create']=function(_0x328143,_0x605f7c){return db['ChatQueue']['create'](_0x328143['body'],{})['then'](function(_0x5dd112){var _0x2aab8b=_0x328143[_0x16dd('0x37')][_0x16dd('0x19')]({'plain':!![]});if(!_0x2aab8b)throw new Error(_0x16dd('0x38'));if(_0x2aab8b[_0x16dd('0x39')]===_0x16dd('0x37')){var _0x50b3e7=_0x5dd112[_0x16dd('0x19')]({'plain':!![]});var _0x30cfcc=_0x16dd('0x1a');return db[_0x16dd('0x3a')]['find']({'where':{'name':_0x30cfcc,'userProfileId':_0x2aab8b['userProfileId']},'raw':!![]})[_0x16dd('0x17')](function(_0x5eabca){if(_0x5eabca&&_0x5eabca[_0x16dd('0x3b')]===0x0){return db['UserProfileResource'][_0x16dd('0x3c')]({'name':_0x50b3e7[_0x16dd('0x1e')],'resourceId':_0x50b3e7['id'],'type':_0x5eabca[_0x16dd('0x1e')],'sectionId':_0x5eabca['id']},{})['then'](function(){return _0x5dd112;});}else{return _0x5dd112;}})[_0x16dd('0x2a')](function(_0x33e607){logger[_0x16dd('0x3d')](_0x16dd('0x3e'),_0x33e607);throw _0x33e607;});}return _0x5dd112;})['then'](respondWithResult(_0x605f7c,0xc9))[_0x16dd('0x2a')](handleError(_0x605f7c,null));};exports[_0x16dd('0x16')]=function(_0x119a4c,_0x2c18ea){if(_0x119a4c[_0x16dd('0x3f')]['id']){delete _0x119a4c['body']['id'];}return db['ChatQueue'][_0x16dd('0x36')]({'where':{'id':_0x119a4c['params']['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x2c18ea,null))[_0x16dd('0x17')](saveUpdates(_0x119a4c[_0x16dd('0x3f')],null))[_0x16dd('0x17')](respondWithResult(_0x2c18ea,null))[_0x16dd('0x2a')](handleError(_0x2c18ea,null));};exports[_0x16dd('0x18')]=function(_0x1821a6,_0x43cfb8){return db[_0x16dd('0x28')]['find']({'where':{'id':_0x1821a6[_0x16dd('0x2c')]['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x43cfb8,null))[_0x16dd('0x17')](removeEntity(_0x43cfb8,null))[_0x16dd('0x2a')](handleError(_0x43cfb8,null));};exports[_0x16dd('0x40')]=function(_0x3fbde0,_0x88947e){return db['ChatQueue'][_0x16dd('0x40')]()[_0x16dd('0x17')](respondWithResult(_0x88947e,null))[_0x16dd('0x2a')](handleError(_0x88947e,null));};exports[_0x16dd('0x41')]=function(_0x44bdfb,_0xd2536c){var _0x3c531b={'raw':!![],'where':{}},_0x21b234={},_0x14c753;return db[_0x16dd('0x28')]['findOne']({'where':{'id':_0x44bdfb[_0x16dd('0x2c')]['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0xd2536c,null))[_0x16dd('0x17')](function(_0x5c8f7e){if(_0x5c8f7e){_0x14c753=_0x5c8f7e[_0x16dd('0x19')]({'plain':!![]});_0x21b234[_0x16dd('0x2d')]=_[_0x16dd('0x2e')](db[_0x16dd('0x42')][_0x16dd('0x20')]);_0x21b234[_0x16dd('0x27')]=_[_0x16dd('0x2e')](_0x44bdfb[_0x16dd('0x27')]);_0x21b234[_0x16dd('0x2f')]=_[_0x16dd('0x30')](_0x21b234[_0x16dd('0x2d')],_0x21b234[_0x16dd('0x27')]);_0x3c531b[_0x16dd('0x31')]=_[_0x16dd('0x30')](_0x21b234[_0x16dd('0x2d')],qs[_0x16dd('0x32')](_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x32')]));_0x3c531b[_0x16dd('0x31')]=_0x3c531b[_0x16dd('0x31')][_0x16dd('0x33')]?_0x3c531b[_0x16dd('0x31')]:_0x21b234[_0x16dd('0x2d')];if(!_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x43')]('nolimit')){_0x3c531b['limit']=qs['limit'](_0x44bdfb[_0x16dd('0x27')]['limit']);_0x3c531b['offset']=qs[_0x16dd('0x10')](_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x10')]);}_0x3c531b[_0x16dd('0x44')]=qs['sort'](_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x45')]);_0x3c531b[_0x16dd('0x24')]=qs['filters'](_['pick'](_0x44bdfb[_0x16dd('0x27')],_0x21b234[_0x16dd('0x2f')]));_0x3c531b['where'][_0x16dd('0x46')]=_0x5c8f7e['id'];if(_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x47')]){_0x3c531b[_0x16dd('0x24')]=_[_0x16dd('0x34')](_0x3c531b[_0x16dd('0x24')],{'$or':_[_0x16dd('0x48')](_0x3c531b[_0x16dd('0x31')],function(_0x4dc47e){var _0x28122d={};_0x28122d[_0x4dc47e]={'$like':'%'+_0x44bdfb[_0x16dd('0x27')][_0x16dd('0x47')]+'%'};return _0x28122d;})});}_0x3c531b=_['merge']({},_0x3c531b,_0x44bdfb[_0x16dd('0x35')]);return db['UserChatQueue']['findAll'](_0x3c531b);}})['then'](function(_0x55d7e1){if(_0x55d7e1){return db[_0x16dd('0x49')]['findAndCountAll']({'where':{'id':_[_0x16dd('0x48')](_0x55d7e1,_0x16dd('0x4a')),'role':_0x16dd('0x4b')},'attributes':['id','name','chatPause',_0x16dd('0x4c'),_0x16dd('0x4d')]});}})[_0x16dd('0x17')](function(_0x235ac0){if(_0x235ac0){return{'count':_0x235ac0[_0x16dd('0x25')],'rows':_[_0x16dd('0x48')](_0x235ac0[_0x16dd('0x4e')],function(_0xa9871c){return{'membername':_0xa9871c['name'],'UserId':_0xa9871c['id'],'queue_name':_0x14c753[_0x16dd('0x1e')],'ChatQueueId':_0x14c753['id'],'interface':util[_0x16dd('0x4f')](_0x16dd('0x50'),_0x16dd('0x51'),_0xa9871c[_0x16dd('0x1e')]),'penalty':0x0,'paused':_0xa9871c[_0x16dd('0x52')],'createdAt':_0xa9871c[_0x16dd('0x4d')],'updatedAt':_0xa9871c[_0x16dd('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x16dd('0x17')](respondWithFilteredResult(_0xd2536c,_0x3c531b))[_0x16dd('0x2a')](handleError(_0xd2536c,null));};exports[_0x16dd('0x53')]=function(_0x5bfc82,_0x3e84cd){var _0x160a23={};var _0x486ec6={};var _0x259760;var _0x3bd371;return db[_0x16dd('0x28')][_0x16dd('0x54')]({'where':{'id':_0x5bfc82[_0x16dd('0x2c')]['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x3e84cd,null))[_0x16dd('0x17')](function(_0x25128a){if(_0x25128a){_0x259760=_0x25128a;_0x486ec6[_0x16dd('0x2d')]=_[_0x16dd('0x2e')](db[_0x16dd('0x55')]['rawAttributes']);_0x486ec6['query']=_[_0x16dd('0x2e')](_0x5bfc82[_0x16dd('0x27')]);_0x486ec6['filters']=_[_0x16dd('0x30')](_0x486ec6[_0x16dd('0x2d')],_0x486ec6[_0x16dd('0x27')]);_0x160a23[_0x16dd('0x31')]=_[_0x16dd('0x30')](_0x486ec6['model'],qs['fields'](_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x32')]));_0x160a23[_0x16dd('0x31')]=_0x160a23['attributes']['length']?_0x160a23[_0x16dd('0x31')]:_0x486ec6[_0x16dd('0x2d')];_0x160a23['order']=qs[_0x16dd('0x45')](_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x45')]);_0x160a23['where']=qs[_0x16dd('0x2f')](_[_0x16dd('0x56')](_0x5bfc82[_0x16dd('0x27')],_0x486ec6[_0x16dd('0x2f')]));if(_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x47')]){_0x160a23[_0x16dd('0x24')]=_[_0x16dd('0x34')](_0x160a23[_0x16dd('0x24')],{'$or':_[_0x16dd('0x48')](_0x160a23[_0x16dd('0x31')],function(_0x406134){var _0x311896={};_0x311896[_0x406134]={'$like':'%'+_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x47')]+'%'};return _0x311896;})});}_0x160a23=_[_0x16dd('0x34')]({},_0x160a23,_0x5bfc82['options']);return _0x259760[_0x16dd('0x53')](_0x160a23);}})['then'](function(_0x55a1ce){if(_0x55a1ce){_0x3bd371=_0x55a1ce[_0x16dd('0x33')];if(!_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x43')](_0x16dd('0x57'))){_0x160a23[_0x16dd('0x11')]=qs[_0x16dd('0x11')](_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x11')]);_0x160a23[_0x16dd('0x10')]=qs[_0x16dd('0x10')](_0x5bfc82[_0x16dd('0x27')][_0x16dd('0x10')]);}return _0x259760[_0x16dd('0x53')](_0x160a23);}})[_0x16dd('0x17')](function(_0x4e5610){if(_0x4e5610){return _0x4e5610?{'count':_0x3bd371,'rows':_0x4e5610}:null;}})['then'](respondWithResult(_0x3e84cd,null))[_0x16dd('0x2a')](handleError(_0x3e84cd,null));};exports['addTeams']=function(_0x3b5332,_0x345c0a){var _0x5f566f=_0x3b5332[_0x16dd('0x3f')][_0x16dd('0x58')];return db['Team'][_0x16dd('0x29')]({'where':{'id':_0x5f566f},'attributes':['id'],'include':[{'model':db[_0x16dd('0x49')],'as':_0x16dd('0x59'),'attributes':['id',_0x16dd('0x1e'),'online',_0x16dd('0x5a'),_0x16dd('0x5b')],'raw':!![]}]})['then'](function(_0x5eeb30){if(_0x5eeb30){var _0x4e51bb=_[_0x16dd('0x5c')](_0x5eeb30,function(_0x3b976d){var _0x510daf=_0x3b976d['get']({'plain':!![]});return _0x510daf[_0x16dd('0x59')];});return db[_0x16dd('0x28')][_0x16dd('0x36')]({'where':{'id':_0x3b5332['params']['id']}})[_0x16dd('0x17')](function(_0xa48677){return db[_0x16dd('0x5d')]['transaction'](function(_0x3907fb){return _0xa48677[_0x16dd('0x5e')](_0x5f566f,{'transaction':_0x3907fb})['then'](function(){return BPromise[_0x16dd('0x5f')](_0x4e51bb,function(_0x5af5d3){return db['UserChatQueue'][_0x16dd('0x60')]({'where':{'UserId':_0x5af5d3['id'],'ChatQueueId':_0x3b5332[_0x16dd('0x2c')]['id']},'transaction':_0x3907fb});});})[_0x16dd('0x17')](function(){_0x4e51bb[_0x16dd('0x61')](function(_0x8c8032){socket[_0x16dd('0x62')](_0x16dd('0x63'),{'UserId':_0x8c8032['id'],'ChatQueueId':_0xa48677['id']});});});});});}})[_0x16dd('0x17')](respondWithStatusCode(_0x345c0a,null))[_0x16dd('0x2a')](handleError(_0x345c0a,null));};exports['removeTeams']=function(_0x216c38,_0x735d61){return db[_0x16dd('0x55')][_0x16dd('0x29')]({'where':{'id':_0x216c38['query'][_0x16dd('0x58')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x16dd('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x735d61,null))['then'](function(_0x246805){var _0x39f6f8=_[_0x16dd('0x48')](_0x246805,'id');var _0x4bddfc=[];var _0x4ae620=[];var _0x245f67=squel[_0x16dd('0x64')]();_0x245f67[_0x16dd('0x65')](_0x16dd('0x66'))[_0x16dd('0x67')](_0x16dd('0x68'),'tq')[_0x16dd('0x69')]('user_has_teams','ut',_0x16dd('0x6a'))[_0x16dd('0x24')](_0x16dd('0x6b'),_0x216c38[_0x16dd('0x2c')]['id']);for(var _0x3c3a57=0x0;_0x3c3a57<_0x246805[_0x16dd('0x33')];_0x3c3a57+=0x1){let _0x9b8f52=_0x246805[_0x3c3a57];for(var _0x3adc78=0x0;_0x3adc78<_0x9b8f52[_0x16dd('0x59')]['length'];_0x3adc78+=0x1){let _0x4846c3=_0x9b8f52[_0x16dd('0x59')][_0x3adc78];var _0x3ae785=_0x245f67[_0x16dd('0x6c')]();_0x3ae785[_0x16dd('0x24')](_0x16dd('0x6d'),_0x4846c3['id']);_0x4ae620[_0x16dd('0x6e')](db[_0x16dd('0x5d')][_0x16dd('0x27')](_0x3ae785[_0x16dd('0x6f')](),{'type':db[_0x16dd('0x5d')][_0x16dd('0x70')]['SELECT']})['then'](function(_0x1886ca){if(_0x1886ca[_0x16dd('0x33')]===0x1){return _0x4846c3['id'];}else{var _0x16d600=_['every'](_[_0x16dd('0x48')](_0x1886ca,'TeamId'),function(_0x465cb2){return _[_0x16dd('0x71')](_0x39f6f8,_0x465cb2);});if(_0x16d600){return _0x4846c3['id'];}}}));}}return BPromise['all'](_0x4ae620)['then'](function(_0x1e6f27){_0x4bddfc=_(_0x4bddfc)[_0x16dd('0x72')](_0x1e6f27)[_0x16dd('0x73')]()[_0x16dd('0x74')]();return db['ChatQueue'][_0x16dd('0x36')]({'where':{'id':_0x216c38[_0x16dd('0x2c')]['id']}})['then'](function(_0x463f63){return db['sequelize']['transaction'](function(_0x50155b){return _0x463f63[_0x16dd('0x75')](_0x216c38[_0x16dd('0x27')]['ids'],{'transaction':_0x50155b})['then'](function(){if(!_[_0x16dd('0x76')](_0x4bddfc)){return _0x463f63[_0x16dd('0x77')](_0x4bddfc,{'transaction':_0x50155b});}})['then'](function(){_0x4bddfc[_0x16dd('0x61')](function(_0x2e2c17){socket[_0x16dd('0x62')]('userChatQueue:remove',{'UserId':_0x2e2c17,'ChatQueueId':_0x463f63['id']});});});});});});})[_0x16dd('0x17')](respondWithStatusCode(_0x735d61,null))[_0x16dd('0x2a')](handleError(_0x735d61,null));};exports['addAgents']=function(_0xb77293,_0x23902d){return db[_0x16dd('0x28')]['find']({'where':{'id':_0xb77293['params']['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x23902d,null))[_0x16dd('0x17')](function(_0x391676){if(_0x391676){return _0x391676[_0x16dd('0x78')](_0xb77293['body'][_0x16dd('0x58')],_[_0x16dd('0x79')](_0xb77293[_0x16dd('0x3f')],[_0x16dd('0x58'),'id'])||{})[_0x16dd('0x7a')](function(_0x5e9a45){for(var _0x310f7a=0x0;_0x310f7a<_0xb77293[_0x16dd('0x3f')][_0x16dd('0x58')]['length'];_0x310f7a+=0x1){socket[_0x16dd('0x62')](_0x16dd('0x63'),{'UserId':Number(_0xb77293[_0x16dd('0x3f')][_0x16dd('0x58')][_0x310f7a]),'ChatQueueId':Number(_0xb77293[_0x16dd('0x2c')]['id'])});}return _0x5e9a45;});}})[_0x16dd('0x17')](respondWithResult(_0x23902d,null))[_0x16dd('0x2a')](handleError(_0x23902d,null));};exports[_0x16dd('0x77')]=function(_0x36cc3d,_0x1c5db9){return db[_0x16dd('0x28')][_0x16dd('0x36')]({'where':{'id':_0x36cc3d[_0x16dd('0x2c')]['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x1c5db9,null))[_0x16dd('0x17')](function(_0x4fbe2d){if(_0x4fbe2d){return _0x4fbe2d[_0x16dd('0x77')](_0x36cc3d['query'][_0x16dd('0x58')])[_0x16dd('0x17')](function(){if(_[_0x16dd('0x7b')](_0x36cc3d[_0x16dd('0x27')][_0x16dd('0x58')])){for(var _0x506280=0x0;_0x506280<_0x36cc3d['query'][_0x16dd('0x58')][_0x16dd('0x33')];_0x506280+=0x1){socket[_0x16dd('0x62')](_0x16dd('0x7c'),{'UserId':Number(_0x36cc3d['query'][_0x16dd('0x58')][_0x506280]),'ChatQueueId':Number(_0x36cc3d[_0x16dd('0x2c')]['id'])});}}else{socket[_0x16dd('0x62')](_0x16dd('0x7c'),{'UserId':Number(_0x36cc3d[_0x16dd('0x27')][_0x16dd('0x58')]),'ChatQueueId':Number(_0x36cc3d[_0x16dd('0x2c')]['id'])});}});}})[_0x16dd('0x17')](respondWithStatusCode(_0x1c5db9,null))[_0x16dd('0x2a')](handleError(_0x1c5db9,null));};exports[_0x16dd('0x7d')]=function(_0x3a6c47,_0x351090){var _0x59cdc7={};var _0x3a33be={};var _0x5c3f27;var _0x3f7671;return db[_0x16dd('0x28')][_0x16dd('0x54')]({'where':{'id':_0x3a6c47[_0x16dd('0x2c')]['id']}})[_0x16dd('0x17')](handleEntityNotFound(_0x351090,null))[_0x16dd('0x17')](function(_0x27090c){if(_0x27090c){_0x5c3f27=_0x27090c;_0x3a33be['model']=_[_0x16dd('0x2e')](db[_0x16dd('0x49')][_0x16dd('0x20')]);_0x3a33be['query']=_['keys'](_0x3a6c47[_0x16dd('0x27')]);_0x3a33be[_0x16dd('0x2f')]=_[_0x16dd('0x30')](_0x3a33be[_0x16dd('0x2d')],_0x3a33be[_0x16dd('0x27')]);_0x59cdc7[_0x16dd('0x31')]=_[_0x16dd('0x30')](_0x3a33be[_0x16dd('0x2d')],qs[_0x16dd('0x32')](_0x3a6c47[_0x16dd('0x27')][_0x16dd('0x32')]));_0x59cdc7['attributes']=_0x59cdc7['attributes']['length']?_0x59cdc7[_0x16dd('0x31')]:_0x3a33be['model'];_0x59cdc7[_0x16dd('0x44')]=qs[_0x16dd('0x45')](_0x3a6c47[_0x16dd('0x27')][_0x16dd('0x45')]);_0x59cdc7[_0x16dd('0x24')]=qs[_0x16dd('0x2f')](_[_0x16dd('0x56')](_0x3a6c47[_0x16dd('0x27')],_0x3a33be['filters']));if(_0x3a6c47[_0x16dd('0x27')][_0x16dd('0x47')]){_0x59cdc7[_0x16dd('0x24')]=_['merge'](_0x59cdc7[_0x16dd('0x24')],{'$or':_[_0x16dd('0x48')](_0x59cdc7[_0x16dd('0x31')],function(_0x589f49){var _0x48cc12={};_0x48cc12[_0x589f49]={'$like':'%'+_0x3a6c47[_0x16dd('0x27')][_0x16dd('0x47')]+'%'};return _0x48cc12;})});}_0x59cdc7=_[_0x16dd('0x34')]({},_0x59cdc7,_0x3a6c47['options']);return _0x5c3f27['getAgents'](_0x59cdc7);}})[_0x16dd('0x17')](function(_0x4644a0){if(_0x4644a0){_0x3f7671=_0x4644a0['length'];if(!_0x3a6c47['query'][_0x16dd('0x43')](_0x16dd('0x57'))){_0x59cdc7[_0x16dd('0x11')]=qs[_0x16dd('0x11')](_0x3a6c47['query'][_0x16dd('0x11')]);_0x59cdc7[_0x16dd('0x10')]=qs[_0x16dd('0x10')](_0x3a6c47[_0x16dd('0x27')][_0x16dd('0x10')]);}return _0x5c3f27[_0x16dd('0x7d')](_0x59cdc7);}})[_0x16dd('0x17')](function(_0x5bea92){if(_0x5bea92){return _0x5bea92?{'count':_0x3f7671,'rows':_0x5bea92}:null;}})[_0x16dd('0x17')](respondWithResult(_0x351090,null))[_0x16dd('0x2a')](handleError(_0x351090,null));}; \ No newline at end of file +var _0x7287=['value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','pick','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','destroy','then','ChatQueues','name','send','index','map','rawAttributes','type','key','where','ChatQueue','include','query','findAll','rows','catch','show','filters','intersection','model','attributes','fields','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','keys','UserChatQueue','length','hasOwnProperty','order','sort','filter','options','User','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','findOne','merge','nolimit','ids','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact'];(function(_0x340bf1,_0x28154e){var _0x5d6835=function(_0x2b688e){while(--_0x2b688e){_0x340bf1['push'](_0x340bf1['shift']());}};_0x5d6835(++_0x28154e);}(_0x7287,0xf2));var _0x7728=function(_0x916310,_0x3102f4){_0x916310=_0x916310-0x0;var _0x4eea74=_0x7287[_0x916310];return _0x4eea74;};'use strict';var BPromise=require(_0x7728('0x0'));var util=require(_0x7728('0x1'));var _=require('lodash');var squel=require(_0x7728('0x2'));var Redis=require(_0x7728('0x3'));var qs=require(_0x7728('0x4'));var logger=require('../../config/logger')(_0x7728('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7728('0x6')]=_[_0x7728('0x7')](config[_0x7728('0x6')],{'host':_0x7728('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7728('0x6')]));require(_0x7728('0x9'))[_0x7728('0xa')](socket);function respondWithStatusCode(_0x174fee,_0x3d33a9){_0x3d33a9=_0x3d33a9||0xcc;return function(_0x44b82e){if(_0x44b82e){return _0x174fee[_0x7728('0xb')](_0x3d33a9);}return _0x174fee[_0x7728('0xc')](_0x3d33a9)[_0x7728('0xd')]();};}function respondWithResult(_0x378722,_0x5df8e1){_0x5df8e1=_0x5df8e1||0xc8;return function(_0x371290){if(_0x371290){return _0x378722[_0x7728('0xc')](_0x5df8e1)[_0x7728('0xe')](_0x371290);}};}function respondWithFilteredResult(_0x44ae6b,_0x452c1a){return function(_0x3773e8){if(_0x3773e8){var _0x41a031=typeof _0x452c1a['offset']===_0x7728('0xf')&&typeof _0x452c1a['limit']===_0x7728('0xf');var _0x1741d7=_0x3773e8[_0x7728('0x10')];var _0x46c0f6=_0x41a031?0x0:_0x452c1a['offset'];var _0x1d29c4=_0x41a031?_0x3773e8['count']:_0x452c1a[_0x7728('0x11')]+_0x452c1a[_0x7728('0x12')];var _0x300b5c;if(_0x1d29c4>=_0x1741d7){_0x1d29c4=_0x1741d7;_0x300b5c=0xc8;}else{_0x300b5c=0xce;}_0x44ae6b['status'](_0x300b5c);return _0x44ae6b[_0x7728('0x13')](_0x7728('0x14'),_0x46c0f6+'-'+_0x1d29c4+'/'+_0x1741d7)[_0x7728('0xe')](_0x3773e8);}return null;};}function saveUpdates(_0x547f56){return function(_0x3c0cd9){if(_0x3c0cd9){return _0x3c0cd9[_0x7728('0x15')](_0x547f56)['then'](function(_0x160107){return _0x160107;});}return null;};}function removeEntity(_0x18eaae){return function(_0x2c7b84){if(_0x2c7b84){return _0x2c7b84[_0x7728('0x16')]()[_0x7728('0x17')](function(){var _0x23892f=_0x2c7b84['get']({'plain':!![]});var _0x4c7f6d=_0x7728('0x18');return db['UserProfileResource'][_0x7728('0x16')]({'where':{'type':_0x4c7f6d,'resourceId':_0x23892f['id']}})['then'](function(){return _0x2c7b84;});})['then'](function(){_0x18eaae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c22b6){return function(_0x47a8df){if(!_0x47a8df){_0x4c22b6[_0x7728('0xb')](0x194);}return _0x47a8df;};}function handleError(_0x56e7da,_0x21b11e){_0x21b11e=_0x21b11e||0x1f4;return function(_0x3fae47){logger['error'](_0x3fae47['stack']);if(_0x3fae47[_0x7728('0x19')]){delete _0x3fae47['name'];}_0x56e7da['status'](_0x21b11e)[_0x7728('0x1a')](_0x3fae47);};}exports[_0x7728('0x1b')]=function(_0x24f1d5,_0x15efc1){var _0x29af6d={};var _0x5d0bed={'count':0x0,'rows':[]};var _0x47a0f4=_[_0x7728('0x1c')](db['ChatQueue'][_0x7728('0x1d')],function(_0x4858af){return{'name':_0x4858af['fieldName'],'type':_0x4858af[_0x7728('0x1e')][_0x7728('0x1f')]};});_0x29af6d=qs['getOptions'](_0x47a0f4,_0x24f1d5);var _0x185ca8={'where':_0x29af6d[_0x7728('0x20')]};return db[_0x7728('0x21')][_0x7728('0x10')](_0x185ca8)[_0x7728('0x17')](function(_0x366e56){_0x5d0bed[_0x7728('0x10')]=_0x366e56;_0x29af6d[_0x7728('0x22')]=qs[_0x7728('0x22')](_0x24f1d5[_0x7728('0x23')]);return db[_0x7728('0x21')][_0x7728('0x24')](_0x29af6d);})[_0x7728('0x17')](function(_0x23ae2a){_0x5d0bed[_0x7728('0x25')]=_0x23ae2a;return _0x5d0bed;})[_0x7728('0x17')](respondWithFilteredResult(_0x15efc1,_0x29af6d))[_0x7728('0x26')](handleError(_0x15efc1,null));};exports[_0x7728('0x27')]=function(_0xd5e4b8,_0x5b9c7a){var _0x471e3b={'raw':!![],'where':{'id':_0xd5e4b8['params']['id']}},_0x4861af={};_0x4861af['model']=_['keys'](db[_0x7728('0x21')][_0x7728('0x1d')]);_0x4861af[_0x7728('0x23')]=_['keys'](_0xd5e4b8['query']);_0x4861af[_0x7728('0x28')]=_[_0x7728('0x29')](_0x4861af[_0x7728('0x2a')],_0x4861af[_0x7728('0x23')]);_0x471e3b[_0x7728('0x2b')]=_[_0x7728('0x29')](_0x4861af['model'],qs[_0x7728('0x2c')](_0xd5e4b8['query'][_0x7728('0x2c')]));_0x471e3b[_0x7728('0x2b')]=_0x471e3b[_0x7728('0x2b')]['length']?_0x471e3b[_0x7728('0x2b')]:_0x4861af[_0x7728('0x2a')];if(_0xd5e4b8[_0x7728('0x23')]['includeAll']){_0x471e3b[_0x7728('0x22')]=[{'all':!![]}];}_0x471e3b=_['merge']({},_0x471e3b,_0xd5e4b8['options']);return db[_0x7728('0x21')]['find'](_0x471e3b)[_0x7728('0x17')](handleEntityNotFound(_0x5b9c7a,null))['then'](respondWithResult(_0x5b9c7a,null))[_0x7728('0x26')](handleError(_0x5b9c7a,null));};exports['create']=function(_0x297ed1,_0x48bad9){return db['ChatQueue'][_0x7728('0x2d')](_0x297ed1['body'],{})[_0x7728('0x17')](function(_0x122fd0){var _0x25b8d8=_0x297ed1[_0x7728('0x2e')][_0x7728('0x2f')]({'plain':!![]});if(!_0x25b8d8)throw new Error(_0x7728('0x30'));if(_0x25b8d8['role']===_0x7728('0x2e')){var _0x2f94ec=_0x122fd0['get']({'plain':!![]});var _0x320a9b=_0x7728('0x18');return db[_0x7728('0x31')][_0x7728('0x32')]({'where':{'name':_0x320a9b,'userProfileId':_0x25b8d8['userProfileId']},'raw':!![]})[_0x7728('0x17')](function(_0x372eba){if(_0x372eba&&_0x372eba[_0x7728('0x33')]===0x0){return db[_0x7728('0x34')]['create']({'name':_0x2f94ec[_0x7728('0x19')],'resourceId':_0x2f94ec['id'],'type':_0x372eba[_0x7728('0x19')],'sectionId':_0x372eba['id']},{})[_0x7728('0x17')](function(){return _0x122fd0;});}else{return _0x122fd0;}})[_0x7728('0x26')](function(_0x3f472e){logger[_0x7728('0x35')](_0x7728('0x36'),_0x3f472e);throw _0x3f472e;});}return _0x122fd0;})[_0x7728('0x17')](respondWithResult(_0x48bad9,0xc9))['catch'](handleError(_0x48bad9,null));};exports[_0x7728('0x15')]=function(_0x1fcdc7,_0x1a47cc){if(_0x1fcdc7[_0x7728('0x37')]['id']){delete _0x1fcdc7[_0x7728('0x37')]['id'];}return db[_0x7728('0x21')][_0x7728('0x32')]({'where':{'id':_0x1fcdc7[_0x7728('0x38')]['id']}})[_0x7728('0x17')](handleEntityNotFound(_0x1a47cc,null))[_0x7728('0x17')](saveUpdates(_0x1fcdc7[_0x7728('0x37')],null))[_0x7728('0x17')](respondWithResult(_0x1a47cc,null))[_0x7728('0x26')](handleError(_0x1a47cc,null));};exports[_0x7728('0x16')]=function(_0x215f26,_0x40552c){return db[_0x7728('0x21')]['find']({'where':{'id':_0x215f26['params']['id']}})['then'](handleEntityNotFound(_0x40552c,null))['then'](removeEntity(_0x40552c,null))[_0x7728('0x26')](handleError(_0x40552c,null));};exports[_0x7728('0x39')]=function(_0x5713df,_0x4c0d0e){return db[_0x7728('0x21')][_0x7728('0x39')]()['then'](respondWithResult(_0x4c0d0e,null))[_0x7728('0x26')](handleError(_0x4c0d0e,null));};exports['getMembers']=function(_0x3c8ab9,_0x5a71e8){var _0x153ced={'raw':!![],'where':{}},_0x3f8f8c={},_0x544225;return db[_0x7728('0x21')]['findOne']({'where':{'id':_0x3c8ab9[_0x7728('0x38')]['id']}})['then'](handleEntityNotFound(_0x5a71e8,null))[_0x7728('0x17')](function(_0x120c3c){if(_0x120c3c){_0x544225=_0x120c3c[_0x7728('0x2f')]({'plain':!![]});_0x3f8f8c[_0x7728('0x2a')]=_[_0x7728('0x3a')](db[_0x7728('0x3b')][_0x7728('0x1d')]);_0x3f8f8c['query']=_[_0x7728('0x3a')](_0x3c8ab9['query']);_0x3f8f8c['filters']=_[_0x7728('0x29')](_0x3f8f8c[_0x7728('0x2a')],_0x3f8f8c[_0x7728('0x23')]);_0x153ced['attributes']=_[_0x7728('0x29')](_0x3f8f8c['model'],qs[_0x7728('0x2c')](_0x3c8ab9[_0x7728('0x23')][_0x7728('0x2c')]));_0x153ced[_0x7728('0x2b')]=_0x153ced['attributes'][_0x7728('0x3c')]?_0x153ced[_0x7728('0x2b')]:_0x3f8f8c[_0x7728('0x2a')];if(!_0x3c8ab9[_0x7728('0x23')][_0x7728('0x3d')]('nolimit')){_0x153ced[_0x7728('0x12')]=qs['limit'](_0x3c8ab9['query'][_0x7728('0x12')]);_0x153ced[_0x7728('0x11')]=qs[_0x7728('0x11')](_0x3c8ab9[_0x7728('0x23')][_0x7728('0x11')]);}_0x153ced[_0x7728('0x3e')]=qs[_0x7728('0x3f')](_0x3c8ab9[_0x7728('0x23')][_0x7728('0x3f')]);_0x153ced['where']=qs[_0x7728('0x28')](_['pick'](_0x3c8ab9[_0x7728('0x23')],_0x3f8f8c[_0x7728('0x28')]));_0x153ced[_0x7728('0x20')]['ChatQueueId']=_0x120c3c['id'];if(_0x3c8ab9['query'][_0x7728('0x40')]){_0x153ced[_0x7728('0x20')]=_['merge'](_0x153ced[_0x7728('0x20')],{'$or':_[_0x7728('0x1c')](_0x153ced[_0x7728('0x2b')],function(_0x52a4f3){var _0x1cc773={};_0x1cc773[_0x52a4f3]={'$like':'%'+_0x3c8ab9[_0x7728('0x23')][_0x7728('0x40')]+'%'};return _0x1cc773;})});}_0x153ced=_['merge']({},_0x153ced,_0x3c8ab9[_0x7728('0x41')]);return db[_0x7728('0x3b')][_0x7728('0x24')](_0x153ced);}})[_0x7728('0x17')](function(_0x5fd73e){if(_0x5fd73e){return db[_0x7728('0x42')]['findAndCountAll']({'where':{'id':_['map'](_0x5fd73e,_0x7728('0x43')),'role':_0x7728('0x44')},'attributes':['id',_0x7728('0x19'),_0x7728('0x45'),_0x7728('0x46'),_0x7728('0x47')]});}})[_0x7728('0x17')](function(_0x487aaa){if(_0x487aaa){return{'count':_0x487aaa[_0x7728('0x10')],'rows':_[_0x7728('0x1c')](_0x487aaa[_0x7728('0x25')],function(_0x4cb679){return{'membername':_0x4cb679[_0x7728('0x19')],'UserId':_0x4cb679['id'],'queue_name':_0x544225[_0x7728('0x19')],'ChatQueueId':_0x544225['id'],'interface':util[_0x7728('0x48')]('%s/%s',_0x7728('0x49'),_0x4cb679[_0x7728('0x19')]),'penalty':0x0,'paused':_0x4cb679[_0x7728('0x45')],'createdAt':_0x4cb679['createdAt'],'updatedAt':_0x4cb679[_0x7728('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7728('0x17')](respondWithFilteredResult(_0x5a71e8,_0x153ced))[_0x7728('0x26')](handleError(_0x5a71e8,null));};exports[_0x7728('0x4a')]=function(_0x28cd6d,_0x389ed4){var _0x53e2c2={};var _0x46003b={};var _0x1d3f7a;var _0xd8c3b5;return db['ChatQueue'][_0x7728('0x4b')]({'where':{'id':_0x28cd6d[_0x7728('0x38')]['id']}})['then'](handleEntityNotFound(_0x389ed4,null))[_0x7728('0x17')](function(_0x24d9a2){if(_0x24d9a2){_0x1d3f7a=_0x24d9a2;_0x46003b[_0x7728('0x2a')]=_[_0x7728('0x3a')](db['Team'][_0x7728('0x1d')]);_0x46003b[_0x7728('0x23')]=_[_0x7728('0x3a')](_0x28cd6d[_0x7728('0x23')]);_0x46003b[_0x7728('0x28')]=_[_0x7728('0x29')](_0x46003b[_0x7728('0x2a')],_0x46003b[_0x7728('0x23')]);_0x53e2c2[_0x7728('0x2b')]=_[_0x7728('0x29')](_0x46003b[_0x7728('0x2a')],qs[_0x7728('0x2c')](_0x28cd6d['query'][_0x7728('0x2c')]));_0x53e2c2[_0x7728('0x2b')]=_0x53e2c2[_0x7728('0x2b')]['length']?_0x53e2c2['attributes']:_0x46003b[_0x7728('0x2a')];_0x53e2c2[_0x7728('0x3e')]=qs[_0x7728('0x3f')](_0x28cd6d[_0x7728('0x23')]['sort']);_0x53e2c2[_0x7728('0x20')]=qs[_0x7728('0x28')](_['pick'](_0x28cd6d[_0x7728('0x23')],_0x46003b[_0x7728('0x28')]));if(_0x28cd6d['query']['filter']){_0x53e2c2[_0x7728('0x20')]=_[_0x7728('0x4c')](_0x53e2c2[_0x7728('0x20')],{'$or':_[_0x7728('0x1c')](_0x53e2c2['attributes'],function(_0x2c68f5){var _0x40a773={};_0x40a773[_0x2c68f5]={'$like':'%'+_0x28cd6d[_0x7728('0x23')]['filter']+'%'};return _0x40a773;})});}_0x53e2c2=_['merge']({},_0x53e2c2,_0x28cd6d['options']);return _0x1d3f7a[_0x7728('0x4a')](_0x53e2c2);}})[_0x7728('0x17')](function(_0x5e6305){if(_0x5e6305){_0xd8c3b5=_0x5e6305[_0x7728('0x3c')];if(!_0x28cd6d['query'][_0x7728('0x3d')](_0x7728('0x4d'))){_0x53e2c2['limit']=qs[_0x7728('0x12')](_0x28cd6d['query'][_0x7728('0x12')]);_0x53e2c2['offset']=qs['offset'](_0x28cd6d[_0x7728('0x23')][_0x7728('0x11')]);}return _0x1d3f7a[_0x7728('0x4a')](_0x53e2c2);}})[_0x7728('0x17')](function(_0x596579){if(_0x596579){return _0x596579?{'count':_0xd8c3b5,'rows':_0x596579}:null;}})[_0x7728('0x17')](respondWithResult(_0x389ed4,null))[_0x7728('0x26')](handleError(_0x389ed4,null));};exports['addTeams']=function(_0x1c4329,_0x1c1e0e){var _0x449625=_0x1c4329['body'][_0x7728('0x4e')];return db['Team'][_0x7728('0x24')]({'where':{'id':_0x449625},'attributes':['id'],'include':[{'model':db[_0x7728('0x42')],'as':_0x7728('0x4f'),'attributes':['id','name','online','voicePause',_0x7728('0x50')],'raw':!![]}]})[_0x7728('0x17')](function(_0xfe4dbc){if(_0xfe4dbc){var _0x4c8546=_[_0x7728('0x51')](_0xfe4dbc,function(_0x458ea4){var _0x5bba10=_0x458ea4[_0x7728('0x2f')]({'plain':!![]});return _0x5bba10[_0x7728('0x4f')];});return db['ChatQueue']['find']({'where':{'id':_0x1c4329[_0x7728('0x38')]['id']}})[_0x7728('0x17')](function(_0x791e00){return db[_0x7728('0x52')][_0x7728('0x53')](function(_0x136101){return _0x791e00[_0x7728('0x54')](_0x449625,{'transaction':_0x136101})[_0x7728('0x17')](function(){return BPromise[_0x7728('0x55')](_0x4c8546,function(_0x27b34e){return db[_0x7728('0x3b')][_0x7728('0x56')]({'where':{'UserId':_0x27b34e['id'],'ChatQueueId':_0x1c4329[_0x7728('0x38')]['id']},'transaction':_0x136101});});})[_0x7728('0x17')](function(){_0x4c8546[_0x7728('0x57')](function(_0x28cd15){socket[_0x7728('0x58')]('userChatQueue:save',{'UserId':_0x28cd15['id'],'ChatQueueId':_0x791e00['id']});});});});});}})[_0x7728('0x17')](respondWithStatusCode(_0x1c1e0e,null))[_0x7728('0x26')](handleError(_0x1c1e0e,null));};exports[_0x7728('0x59')]=function(_0x11cb2a,_0x32b79d){return db['Team'][_0x7728('0x24')]({'where':{'id':_0x11cb2a[_0x7728('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7728('0x42')],'as':_0x7728('0x4f'),'attributes':['id'],'raw':!![]}]})[_0x7728('0x17')](handleEntityNotFound(_0x32b79d,null))['then'](function(_0x11e8c5){var _0x1ad46e=_[_0x7728('0x1c')](_0x11e8c5,'id');var _0x403e95=[];var _0x46f837=[];var _0x37aa78=squel[_0x7728('0x5a')]();_0x37aa78[_0x7728('0x5b')](_0x7728('0x5c'))[_0x7728('0x5d')]('team_has_chat_queues','tq')[_0x7728('0x5e')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7728('0x20')](_0x7728('0x5f'),_0x11cb2a[_0x7728('0x38')]['id']);for(var _0x2731db=0x0;_0x2731db<_0x11e8c5[_0x7728('0x3c')];_0x2731db+=0x1){let _0x3ac41e=_0x11e8c5[_0x2731db];for(var _0x3631e2=0x0;_0x3631e2<_0x3ac41e['Agents'][_0x7728('0x3c')];_0x3631e2+=0x1){let _0x5e5871=_0x3ac41e[_0x7728('0x4f')][_0x3631e2];var _0x5e9b98=_0x37aa78[_0x7728('0x60')]();_0x5e9b98['where'](_0x7728('0x61'),_0x5e5871['id']);_0x46f837[_0x7728('0x62')](db[_0x7728('0x52')][_0x7728('0x23')](_0x5e9b98[_0x7728('0x63')](),{'type':db[_0x7728('0x52')][_0x7728('0x64')][_0x7728('0x65')]})[_0x7728('0x17')](function(_0x7f59f6){if(_0x7f59f6[_0x7728('0x3c')]===0x1){return _0x5e5871['id'];}else{var _0x18d326=_[_0x7728('0x66')](_['map'](_0x7f59f6,'TeamId'),function(_0x598a9f){return _[_0x7728('0x67')](_0x1ad46e,_0x598a9f);});if(_0x18d326){return _0x5e5871['id'];}}}));}}return BPromise['all'](_0x46f837)['then'](function(_0x56efdb){_0x403e95=_(_0x403e95)[_0x7728('0x68')](_0x56efdb)[_0x7728('0x69')]()[_0x7728('0x6a')]();return db[_0x7728('0x21')][_0x7728('0x32')]({'where':{'id':_0x11cb2a[_0x7728('0x38')]['id']}})[_0x7728('0x17')](function(_0x428186){return db['sequelize'][_0x7728('0x53')](function(_0x47899c){return _0x428186[_0x7728('0x59')](_0x11cb2a[_0x7728('0x23')][_0x7728('0x4e')],{'transaction':_0x47899c})['then'](function(){if(!_[_0x7728('0x6b')](_0x403e95)){return _0x428186[_0x7728('0x6c')](_0x403e95,{'transaction':_0x47899c});}})['then'](function(){_0x403e95['forEach'](function(_0x1cbdee){socket[_0x7728('0x58')](_0x7728('0x6d'),{'UserId':_0x1cbdee,'ChatQueueId':_0x428186['id']});});});});});});})[_0x7728('0x17')](respondWithStatusCode(_0x32b79d,null))[_0x7728('0x26')](handleError(_0x32b79d,null));};exports['addAgents']=function(_0xf4b1ff,_0xbfa197){return db[_0x7728('0x21')][_0x7728('0x32')]({'where':{'id':_0xf4b1ff[_0x7728('0x38')]['id']}})['then'](handleEntityNotFound(_0xbfa197,null))[_0x7728('0x17')](function(_0x5001f6){if(_0x5001f6){return _0x5001f6[_0x7728('0x6e')](_0xf4b1ff['body'][_0x7728('0x4e')],_[_0x7728('0x6f')](_0xf4b1ff[_0x7728('0x37')],['ids','id'])||{})[_0x7728('0x70')](function(_0x14d3bd){for(var _0x488834=0x0;_0x488834<_0xf4b1ff[_0x7728('0x37')][_0x7728('0x4e')]['length'];_0x488834+=0x1){socket[_0x7728('0x58')](_0x7728('0x71'),{'UserId':Number(_0xf4b1ff[_0x7728('0x37')][_0x7728('0x4e')][_0x488834]),'ChatQueueId':Number(_0xf4b1ff[_0x7728('0x38')]['id'])});}return _0x14d3bd;});}})['then'](respondWithResult(_0xbfa197,null))[_0x7728('0x26')](handleError(_0xbfa197,null));};exports[_0x7728('0x6c')]=function(_0x364155,_0x3fa707){return db['ChatQueue'][_0x7728('0x32')]({'where':{'id':_0x364155[_0x7728('0x38')]['id']}})[_0x7728('0x17')](handleEntityNotFound(_0x3fa707,null))['then'](function(_0x5b1c43){if(_0x5b1c43){return _0x5b1c43[_0x7728('0x6c')](_0x364155[_0x7728('0x23')][_0x7728('0x4e')])[_0x7728('0x17')](function(){if(_['isArray'](_0x364155['query']['ids'])){for(var _0x148580=0x0;_0x148580<_0x364155[_0x7728('0x23')][_0x7728('0x4e')][_0x7728('0x3c')];_0x148580+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x364155[_0x7728('0x23')][_0x7728('0x4e')][_0x148580]),'ChatQueueId':Number(_0x364155['params']['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x364155[_0x7728('0x23')][_0x7728('0x4e')]),'ChatQueueId':Number(_0x364155[_0x7728('0x38')]['id'])});}});}})[_0x7728('0x17')](respondWithStatusCode(_0x3fa707,null))[_0x7728('0x26')](handleError(_0x3fa707,null));};exports['getAgents']=function(_0x1d5f06,_0x5a7f75){var _0x22c55a={};var _0x423c90={};var _0x4aae52;var _0xbd408b;return db[_0x7728('0x21')][_0x7728('0x4b')]({'where':{'id':_0x1d5f06['params']['id']}})['then'](handleEntityNotFound(_0x5a7f75,null))[_0x7728('0x17')](function(_0x335f1f){if(_0x335f1f){_0x4aae52=_0x335f1f;_0x423c90[_0x7728('0x2a')]=_[_0x7728('0x3a')](db[_0x7728('0x42')][_0x7728('0x1d')]);_0x423c90[_0x7728('0x23')]=_[_0x7728('0x3a')](_0x1d5f06['query']);_0x423c90[_0x7728('0x28')]=_[_0x7728('0x29')](_0x423c90[_0x7728('0x2a')],_0x423c90[_0x7728('0x23')]);_0x22c55a['attributes']=_[_0x7728('0x29')](_0x423c90['model'],qs[_0x7728('0x2c')](_0x1d5f06['query'][_0x7728('0x2c')]));_0x22c55a[_0x7728('0x2b')]=_0x22c55a[_0x7728('0x2b')][_0x7728('0x3c')]?_0x22c55a[_0x7728('0x2b')]:_0x423c90['model'];_0x22c55a[_0x7728('0x3e')]=qs['sort'](_0x1d5f06[_0x7728('0x23')][_0x7728('0x3f')]);_0x22c55a[_0x7728('0x20')]=qs[_0x7728('0x28')](_[_0x7728('0x72')](_0x1d5f06[_0x7728('0x23')],_0x423c90[_0x7728('0x28')]));if(_0x1d5f06[_0x7728('0x23')][_0x7728('0x40')]){_0x22c55a[_0x7728('0x20')]=_[_0x7728('0x4c')](_0x22c55a[_0x7728('0x20')],{'$or':_[_0x7728('0x1c')](_0x22c55a[_0x7728('0x2b')],function(_0x3c5652){var _0x568d2c={};_0x568d2c[_0x3c5652]={'$like':'%'+_0x1d5f06['query']['filter']+'%'};return _0x568d2c;})});}_0x22c55a=_['merge']({},_0x22c55a,_0x1d5f06[_0x7728('0x41')]);return _0x4aae52[_0x7728('0x73')](_0x22c55a);}})[_0x7728('0x17')](function(_0x5be90e){if(_0x5be90e){_0xbd408b=_0x5be90e[_0x7728('0x3c')];if(!_0x1d5f06[_0x7728('0x23')][_0x7728('0x3d')](_0x7728('0x4d'))){_0x22c55a['limit']=qs[_0x7728('0x12')](_0x1d5f06['query']['limit']);_0x22c55a['offset']=qs['offset'](_0x1d5f06['query'][_0x7728('0x11')]);}return _0x4aae52['getAgents'](_0x22c55a);}})[_0x7728('0x17')](function(_0x2a690b){if(_0x2a690b){return _0x2a690b?{'count':_0xbd408b,'rows':_0x2a690b}:null;}})[_0x7728('0x17')](respondWithResult(_0x5a7f75,null))['catch'](handleError(_0x5a7f75,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b8cce4c..5aa07e1 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 _0x37cf=['emit','exports','events','ChatQueue','setMaxListeners','update'];(function(_0x4964c4,_0x49252b){var _0x281bd7=function(_0xb521b1){while(--_0xb521b1){_0x4964c4['push'](_0x4964c4['shift']());}};_0x281bd7(++_0x49252b);}(_0x37cf,0xa4));var _0xf37c=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x37cf[_0x2ecb67];return _0x168079;};'use strict';var EventEmitter=require(_0xf37c('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xf37c('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf37c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf37c('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc37db){return function(_0x8c57dc,_0x73165f,_0x4a32af){ChatQueueEvents[_0xf37c('0x4')](_0xc37db+':'+_0x8c57dc['id'],_0x8c57dc);ChatQueueEvents[_0xf37c('0x4')](_0xc37db,_0x8c57dc);_0x4a32af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xf37c('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0xecd5=['../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x35f7b6,_0x3f84aa){var _0x28e53b=function(_0x3dedb6){while(--_0x3dedb6){_0x35f7b6['push'](_0x35f7b6['shift']());}};_0x28e53b(++_0x3f84aa);}(_0xecd5,0x110));var _0x5ecd=function(_0x5b4c38,_0x58f4e3){_0x5b4c38=_0x5b4c38-0x0;var _0x381f09=_0xecd5[_0x5b4c38];return _0x381f09;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5ecd('0x0'))['db'][_0x5ecd('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5ecd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ecd('0x3'),'afterDestroy':_0x5ecd('0x4')};function emitEvent(_0x469fd0){return function(_0x458bb3,_0x516d8e,_0x3995e5){ChatQueueEvents['emit'](_0x469fd0+':'+_0x458bb3['id'],_0x458bb3);ChatQueueEvents[_0x5ecd('0x5')](_0x469fd0,_0x458bb3);_0x3995e5(null);};}for(var e in events){if(events[_0x5ecd('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x5ecd('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6bb6314..858facb 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 _0xf2ed=['path','rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0xee209,_0x4858f4){var _0x48cd8c=function(_0x5e3eda){while(--_0x5e3eda){_0xee209['push'](_0xee209['shift']());}};_0x48cd8c(++_0x4858f4);}(_0xf2ed,0xa2));var _0xdf2e=function(_0x5623cb,_0x20b099){_0x5623cb=_0x5623cb-0x0;var _0x368ce6=_0xf2ed[_0x5623cb];return _0x368ce6;};'use strict';var _=require(_0xdf2e('0x0'));var util=require(_0xdf2e('0x1'));var logger=require('../../config/logger')(_0xdf2e('0x2'));var moment=require(_0xdf2e('0x3'));var BPromise=require(_0xdf2e('0x4'));var rp=require(_0xdf2e('0x5'));var fs=require('fs');var path=require(_0xdf2e('0x6'));var rimraf=require(_0xdf2e('0x7'));var config=require(_0xdf2e('0x8'));var attributes=require('./chatQueue.attributes');module[_0xdf2e('0x9')]=function(_0x462310,_0x97791){return _0x462310['define'](_0xdf2e('0xa'),attributes,{'tableName':_0xdf2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bc5=['chat_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue'];(function(_0x39d193,_0x3816a5){var _0x47b988=function(_0x38b8c5){while(--_0x38b8c5){_0x39d193['push'](_0x39d193['shift']());}};_0x47b988(++_0x3816a5);}(_0x1bc5,0x64));var _0x51bc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x1bc5[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x51bc('0x0'));var util=require(_0x51bc('0x1'));var logger=require('../../config/logger')(_0x51bc('0x2'));var moment=require('moment');var BPromise=require(_0x51bc('0x3'));var rp=require(_0x51bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51bc('0x5'));var config=require(_0x51bc('0x6'));var attributes=require(_0x51bc('0x7'));module['exports']=function(_0x3086b4,_0x3f2b1e){return _0x3086b4[_0x51bc('0x8')](_0x51bc('0x9'),attributes,{'tableName':_0x51bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 6715aa8..bd5de3e 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 _0x6002=['catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','model','attributes','map','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result'];(function(_0x330b5a,_0x1cc7ac){var _0x44ebc2=function(_0x24be96){while(--_0x24be96){_0x330b5a['push'](_0x330b5a['shift']());}};_0x44ebc2(++_0x1cc7ac);}(_0x6002,0xfe));var _0x2600=function(_0x4dfd5f,_0x3dcaf7){_0x4dfd5f=_0x4dfd5f-0x0;var _0x3e8927=_0x6002[_0x4dfd5f];return _0x3e8927;};'use strict';var _=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var moment=require(_0x2600('0x2'));var BPromise=require(_0x2600('0x3'));var rs=require(_0x2600('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2600('0x5'));var logger=require(_0x2600('0x6'))(_0x2600('0x7'));var config=require(_0x2600('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2600('0x9')]({'port':0x232a});config[_0x2600('0xa')]=_[_0x2600('0xb')](config[_0x2600('0xa')],{'host':_0x2600('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x2600('0xd')](socket);function respondWithRpcPromise(_0x2ab4ad,_0x6569d2,_0x1ed153){return new BPromise(function(_0xf25b93,_0x3ffeda){return client[_0x2600('0xe')](_0x2ab4ad,_0x1ed153)[_0x2600('0xf')](function(_0x2a5cd5){logger[_0x2600('0x10')]('ChatQueue,\x20%s,\x20%s',_0x6569d2,_0x2600('0x11'));logger[_0x2600('0x12')](_0x2600('0x13'),_0x6569d2,_0x2600('0x11'),JSON[_0x2600('0x14')](_0x2a5cd5));if(_0x2a5cd5['error']){if(_0x2a5cd5[_0x2600('0x15')][_0x2600('0x16')]===0x1f4){logger[_0x2600('0x15')](_0x2600('0x17'),_0x6569d2,_0x2a5cd5['error']['message']);return _0x3ffeda(_0x2a5cd5[_0x2600('0x15')][_0x2600('0x18')]);}logger[_0x2600('0x15')]('ChatQueue,\x20%s,\x20%s',_0x6569d2,_0x2a5cd5[_0x2600('0x15')][_0x2600('0x18')]);return _0xf25b93(_0x2a5cd5[_0x2600('0x15')][_0x2600('0x18')]);}else{logger[_0x2600('0x10')]('ChatQueue,\x20%s,\x20%s',_0x6569d2,_0x2600('0x11'));_0xf25b93(_0x2a5cd5[_0x2600('0x19')]['message']);}})[_0x2600('0x1a')](function(_0x2e3c0f){logger['error'](_0x2600('0x17'),_0x6569d2,_0x2e3c0f);_0x3ffeda(_0x2e3c0f);});});}exports[_0x2600('0x1b')]=function(_0xed44bb){var _0x5efd1e=this;return new Promise(function(_0x48735d,_0xe07271){return db[_0x2600('0x1c')][_0x2600('0x1d')]({'raw':_0xed44bb['options']?_0xed44bb[_0x2600('0x1e')][_0x2600('0x1f')]===undefined?!![]:![]:!![],'where':_0xed44bb[_0x2600('0x1e')]?_0xed44bb['options'][_0x2600('0x20')]||null:null,'attributes':_0xed44bb['options']?_0xed44bb[_0x2600('0x1e')]['attributes']||null:null,'limit':_0xed44bb[_0x2600('0x1e')]?_0xed44bb[_0x2600('0x1e')][_0x2600('0x21')]||null:null,'include':_0xed44bb[_0x2600('0x1e')]?_0xed44bb['options']['include']?_['map'](_0xed44bb[_0x2600('0x1e')][_0x2600('0x22')],function(_0x37047e){return{'model':db[_0x37047e[_0x2600('0x23')]],'as':_0x37047e['as'],'attributes':_0x37047e[_0x2600('0x24')],'include':_0x37047e[_0x2600('0x22')]?_[_0x2600('0x25')](_0x37047e[_0x2600('0x22')],function(_0x1f1fe7){return{'model':db[_0x1f1fe7[_0x2600('0x23')]],'as':_0x1f1fe7['as'],'attributes':_0x1f1fe7[_0x2600('0x24')],'include':_0x1f1fe7[_0x2600('0x22')]?_[_0x2600('0x25')](_0x1f1fe7[_0x2600('0x22')],function(_0x2e4466){return{'model':db[_0x2e4466[_0x2600('0x23')]],'as':_0x2e4466['as'],'attributes':_0x2e4466[_0x2600('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2600('0xf')](function(_0x4077a0){logger[_0x2600('0x10')](_0x2600('0x1b'),_0xed44bb);logger['debug']('GetChatQueue',_0xed44bb,JSON[_0x2600('0x14')](_0x4077a0));_0x48735d(_0x4077a0);})['catch'](function(_0x5f3dd5){logger[_0x2600('0x15')](_0x2600('0x1b'),_0x5f3dd5[_0x2600('0x18')],_0xed44bb);_0xe07271(_0x5efd1e[_0x2600('0x15')](0x1f4,_0x5f3dd5[_0x2600('0x18')]));});});};exports[_0x2600('0x26')]=function(_0x15b66c){var _0x20621d=this;return new Promise(function(_0x500961,_0x38f4d3){return db[_0x2600('0x1c')][_0x2600('0x27')]({'raw':_0x15b66c[_0x2600('0x1e')]?_0x15b66c[_0x2600('0x1e')][_0x2600('0x1f')]===undefined?!![]:![]:!![],'where':_0x15b66c[_0x2600('0x1e')]?_0x15b66c[_0x2600('0x1e')][_0x2600('0x20')]||null:null,'attributes':_0x15b66c['options']?_0x15b66c['options'][_0x2600('0x24')]||null:null,'include':_0x15b66c[_0x2600('0x1e')]?_0x15b66c[_0x2600('0x1e')][_0x2600('0x22')]?_['map'](_0x15b66c['options'][_0x2600('0x22')],function(_0x28042c){return{'model':db[_0x28042c[_0x2600('0x23')]],'as':_0x28042c['as'],'attributes':_0x28042c[_0x2600('0x24')],'include':_0x28042c['include']?_[_0x2600('0x25')](_0x28042c[_0x2600('0x22')],function(_0x36ff01){return{'model':db[_0x36ff01[_0x2600('0x23')]],'as':_0x36ff01['as'],'attributes':_0x36ff01[_0x2600('0x24')],'include':_0x36ff01['include']?_['map'](_0x36ff01[_0x2600('0x22')],function(_0x293998){return{'model':db[_0x293998[_0x2600('0x23')]],'as':_0x293998['as'],'attributes':_0x293998[_0x2600('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29888b){logger[_0x2600('0x10')](_0x2600('0x26'),_0x15b66c);logger[_0x2600('0x12')]('ShowChatQueue',_0x15b66c,JSON[_0x2600('0x14')](_0x29888b));_0x500961(_0x29888b);})[_0x2600('0x1a')](function(_0x27b4d9){logger['error'](_0x2600('0x26'),_0x27b4d9[_0x2600('0x18')],_0x15b66c);_0x38f4d3(_0x20621d[_0x2600('0x15')](0x1f4,_0x27b4d9['message']));});});}; \ No newline at end of file +var _0x5713=['./chatQueue.socket','register','request','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','GetChatQueue','ChatQueue','raw','options','where','attributes','limit','include','map','model','then','info','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x35d4cf,_0x563102){var _0x5c1091=function(_0x3f89a3){while(--_0x3f89a3){_0x35d4cf['push'](_0x35d4cf['shift']());}};_0x5c1091(++_0x563102);}(_0x5713,0x1c7));var _0x3571=function(_0x2f8c68,_0x186eca){_0x2f8c68=_0x2f8c68-0x0;var _0x57dba9=_0x5713[_0x2f8c68];return _0x57dba9;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});config[_0x3571('0xa')]=_[_0x3571('0xb')](config[_0x3571('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3571('0xc'))(new Redis(config[_0x3571('0xa')]));require(_0x3571('0xd'))[_0x3571('0xe')](socket);function respondWithRpcPromise(_0x23db5b,_0x4d5de0,_0x4b2977){return new BPromise(function(_0x4177c5,_0x33cb1b){return client[_0x3571('0xf')](_0x23db5b,_0x4b2977)['then'](function(_0x57573f){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d5de0,_0x3571('0x10'));logger[_0x3571('0x11')](_0x3571('0x12'),_0x4d5de0,_0x3571('0x10'),JSON[_0x3571('0x13')](_0x57573f));if(_0x57573f[_0x3571('0x14')]){if(_0x57573f[_0x3571('0x14')][_0x3571('0x15')]===0x1f4){logger[_0x3571('0x14')](_0x3571('0x16'),_0x4d5de0,_0x57573f[_0x3571('0x14')][_0x3571('0x17')]);return _0x33cb1b(_0x57573f[_0x3571('0x14')][_0x3571('0x17')]);}logger[_0x3571('0x14')](_0x3571('0x16'),_0x4d5de0,_0x57573f['error']['message']);return _0x4177c5(_0x57573f['error'][_0x3571('0x17')]);}else{logger['info'](_0x3571('0x16'),_0x4d5de0,_0x3571('0x10'));_0x4177c5(_0x57573f['result'][_0x3571('0x17')]);}})[_0x3571('0x18')](function(_0x264c89){logger[_0x3571('0x14')](_0x3571('0x16'),_0x4d5de0,_0x264c89);_0x33cb1b(_0x264c89);});});}exports[_0x3571('0x19')]=function(_0x53f3f9){var _0x3d4248=this;return new Promise(function(_0x5b811f,_0x1cdda8){return db[_0x3571('0x1a')]['findAll']({'raw':_0x53f3f9['options']?_0x53f3f9['options'][_0x3571('0x1b')]===undefined?!![]:![]:!![],'where':_0x53f3f9[_0x3571('0x1c')]?_0x53f3f9[_0x3571('0x1c')][_0x3571('0x1d')]||null:null,'attributes':_0x53f3f9[_0x3571('0x1c')]?_0x53f3f9['options'][_0x3571('0x1e')]||null:null,'limit':_0x53f3f9[_0x3571('0x1c')]?_0x53f3f9[_0x3571('0x1c')][_0x3571('0x1f')]||null:null,'include':_0x53f3f9[_0x3571('0x1c')]?_0x53f3f9['options'][_0x3571('0x20')]?_[_0x3571('0x21')](_0x53f3f9['options'][_0x3571('0x20')],function(_0x48a47b){return{'model':db[_0x48a47b[_0x3571('0x22')]],'as':_0x48a47b['as'],'attributes':_0x48a47b[_0x3571('0x1e')],'include':_0x48a47b[_0x3571('0x20')]?_[_0x3571('0x21')](_0x48a47b[_0x3571('0x20')],function(_0x285d9c){return{'model':db[_0x285d9c[_0x3571('0x22')]],'as':_0x285d9c['as'],'attributes':_0x285d9c['attributes'],'include':_0x285d9c[_0x3571('0x20')]?_[_0x3571('0x21')](_0x285d9c[_0x3571('0x20')],function(_0x4fbe35){return{'model':db[_0x4fbe35['model']],'as':_0x4fbe35['as'],'attributes':_0x4fbe35['attributes']};}):[]};}):[]};}):[]:[]})[_0x3571('0x23')](function(_0x4b1c2f){logger[_0x3571('0x24')](_0x3571('0x19'),_0x53f3f9);logger[_0x3571('0x11')]('GetChatQueue',_0x53f3f9,JSON['stringify'](_0x4b1c2f));_0x5b811f(_0x4b1c2f);})[_0x3571('0x18')](function(_0x40eea0){logger['error'](_0x3571('0x19'),_0x40eea0['message'],_0x53f3f9);_0x1cdda8(_0x3d4248[_0x3571('0x14')](0x1f4,_0x40eea0[_0x3571('0x17')]));});});};exports[_0x3571('0x25')]=function(_0x2d8a00){var _0x3864cc=this;return new Promise(function(_0x2ce9c7,_0x1f48ff){return db['ChatQueue'][_0x3571('0x26')]({'raw':_0x2d8a00[_0x3571('0x1c')]?_0x2d8a00[_0x3571('0x1c')][_0x3571('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d8a00['options']?_0x2d8a00[_0x3571('0x1c')]['where']||null:null,'attributes':_0x2d8a00[_0x3571('0x1c')]?_0x2d8a00[_0x3571('0x1c')][_0x3571('0x1e')]||null:null,'include':_0x2d8a00[_0x3571('0x1c')]?_0x2d8a00[_0x3571('0x1c')]['include']?_['map'](_0x2d8a00['options']['include'],function(_0x13339b){return{'model':db[_0x13339b['model']],'as':_0x13339b['as'],'attributes':_0x13339b[_0x3571('0x1e')],'include':_0x13339b[_0x3571('0x20')]?_[_0x3571('0x21')](_0x13339b[_0x3571('0x20')],function(_0x10fa1e){return{'model':db[_0x10fa1e[_0x3571('0x22')]],'as':_0x10fa1e['as'],'attributes':_0x10fa1e[_0x3571('0x1e')],'include':_0x10fa1e['include']?_[_0x3571('0x21')](_0x10fa1e[_0x3571('0x20')],function(_0x28068e){return{'model':db[_0x28068e[_0x3571('0x22')]],'as':_0x28068e['as'],'attributes':_0x28068e[_0x3571('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da9cc){logger[_0x3571('0x24')](_0x3571('0x25'),_0x2d8a00);logger[_0x3571('0x11')](_0x3571('0x25'),_0x2d8a00,JSON['stringify'](_0x1da9cc));_0x2ce9c7(_0x1da9cc);})['catch'](function(_0x5c2d17){logger[_0x3571('0x14')]('ShowChatQueue',_0x5c2d17[_0x3571('0x17')],_0x2d8a00);_0x1f48ff(_0x3864cc[_0x3571('0x14')](0x1f4,_0x5c2d17[_0x3571('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 504a304..b11257a 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0xada87a,_0x16223c){var _0x7ad44c=function(_0x341535){while(--_0x341535){_0xada87a['push'](_0xada87a['shift']());}};_0x7ad44c(++_0x16223c);}(_0x0faf,0x132));var _0xf0fa=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x0faf[_0x1db481];return _0x3db95b;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8e5f9f6..9d87a3f 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5e6e5b,_0x5d4156){var _0x1bed53=function(_0x5f39d0){while(--_0x5f39d0){_0x5e6e5b['push'](_0x5e6e5b['shift']());}};_0x1bed53(++_0x5d4156);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _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(_0xf659f2,_0x5f27fa){var _0x2cd604=function(_0x23d3ca){while(--_0x23d3ca){_0xf659f2['push'](_0xf659f2['shift']());}};_0x2cd604(++_0x5f27fa);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 f99148a..4944530 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 _0xec19=['exports','STRING','DATE','moment'];(function(_0x2b68fc,_0x10362e){var _0x2e3490=function(_0x13052e){while(--_0x13052e){_0x2b68fc['push'](_0x2b68fc['shift']());}};_0x2e3490(++_0x10362e);}(_0xec19,0x7f));var _0x9ec1=function(_0x3a05a1,_0x5c0ca7){_0x3a05a1=_0x3a05a1-0x0;var _0x5d2c23=_0xec19[_0x3a05a1];return _0x5d2c23;};'use strict';var moment=require(_0x9ec1('0x0'));var Sequelize=require('sequelize');module[_0x9ec1('0x1')]={'uniqueid':{'type':Sequelize[_0x9ec1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9ec1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9ec1('0x3')]},'acceptAt':{'type':Sequelize[_0x9ec1('0x3')]},'exitAt':{'type':Sequelize[_0x9ec1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4b6=['DATE','sequelize','exports','STRING'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xf4b6,0x85));var _0x6f4b=function(_0x23e9fd,_0x5b6638){_0x23e9fd=_0x23e9fd-0x0;var _0x4ceca7=_0xf4b6[_0x23e9fd];return _0x4ceca7;};'use strict';var moment=require('moment');var Sequelize=require(_0x6f4b('0x0'));module[_0x6f4b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6f4b('0x2')]},'joinAt':{'type':Sequelize[_0x6f4b('0x3')]},'leaveAt':{'type':Sequelize[_0x6f4b('0x3')]},'acceptAt':{'type':Sequelize[_0x6f4b('0x3')]},'exitAt':{'type':Sequelize[_0x6f4b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8a8129b..b52282c 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 _0x5430=['update','then','destroy','stack','name','send','index','ChatQueueReport','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(_0x3b9fde,_0x363ffc){var _0x55e818=function(_0x123eec){while(--_0x123eec){_0x3b9fde['push'](_0x3b9fde['shift']());}};_0x55e818(++_0x363ffc);}(_0x5430,0x10c));var _0x0543=function(_0x19a0be,_0x283a78){_0x19a0be=_0x19a0be-0x0;var _0x467299=_0x5430[_0x19a0be];return _0x467299;};'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['ChatQueueReport']['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 +var _0x5d0a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','update','then','error','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x5d0a,0x175));var _0xa5d0=function(_0x11996b,_0x239c06){_0x11996b=_0x11996b-0x0;var _0x58bf85=_0x5d0a[_0x11996b];return _0x58bf85;};'use strict';var emlformat=require(_0xa5d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d0('0x2'));var moment=require(_0xa5d0('0x3'));var BPromise=require(_0xa5d0('0x4'));var Mustache=require(_0xa5d0('0x5'));var util=require('util');var path=require(_0xa5d0('0x6'));var sox=require(_0xa5d0('0x7'));var csv=require(_0xa5d0('0x8'));var ejs=require(_0xa5d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa5d0('0xa'));var _=require(_0xa5d0('0xb'));var squel=require(_0xa5d0('0xc'));var crypto=require(_0xa5d0('0xd'));var jsforce=require(_0xa5d0('0xe'));var deskjs=require(_0xa5d0('0xf'));var toCsv=require(_0xa5d0('0x8'));var querystring=require('querystring');var Papa=require(_0xa5d0('0x10'));var Redis=require(_0xa5d0('0x11'));var authService=require(_0xa5d0('0x12'));var qs=require(_0xa5d0('0x13'));var as=require(_0xa5d0('0x14'));var hardwareService=require(_0xa5d0('0x15'));var logger=require(_0xa5d0('0x16'))(_0xa5d0('0x17'));var utils=require(_0xa5d0('0x18'));var config=require(_0xa5d0('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5d0('0x1a'))['db'];function respondWithStatusCode(_0x4bdb6b,_0x566b17){_0x566b17=_0x566b17||0xcc;return function(_0x3ab8b9){if(_0x3ab8b9){return _0x4bdb6b[_0xa5d0('0x1b')](_0x566b17);}return _0x4bdb6b[_0xa5d0('0x1c')](_0x566b17)[_0xa5d0('0x1d')]();};}function respondWithResult(_0x4cb722,_0x56ee85){_0x56ee85=_0x56ee85||0xc8;return function(_0xf06747){if(_0xf06747){return _0x4cb722[_0xa5d0('0x1c')](_0x56ee85)[_0xa5d0('0x1e')](_0xf06747);}};}function respondWithFilteredResult(_0x22afa2,_0x3847bb){return function(_0x146722){if(_0x146722){var _0x1461d5=typeof _0x3847bb['offset']===_0xa5d0('0x1f')&&typeof _0x3847bb['limit']===_0xa5d0('0x1f');var _0x3c00fd=_0x146722['count'];var _0x5bc068=_0x1461d5?0x0:_0x3847bb[_0xa5d0('0x20')];var _0x234254=_0x1461d5?_0x146722['count']:_0x3847bb[_0xa5d0('0x20')]+_0x3847bb[_0xa5d0('0x21')];var _0x9fab4;if(_0x234254>=_0x3c00fd){_0x234254=_0x3c00fd;_0x9fab4=0xc8;}else{_0x9fab4=0xce;}_0x22afa2[_0xa5d0('0x1c')](_0x9fab4);return _0x22afa2[_0xa5d0('0x22')](_0xa5d0('0x23'),_0x5bc068+'-'+_0x234254+'/'+_0x3c00fd)['json'](_0x146722);}return null;};}function patchUpdates(_0x4cf8db){return function(_0x2a56ff){try{jsonpatch[_0xa5d0('0x24')](_0x2a56ff,_0x4cf8db,!![]);}catch(_0x4cc587){return BPromise['reject'](_0x4cc587);}return _0x2a56ff[_0xa5d0('0x25')]();};}function saveUpdates(_0x42a745,_0x27a4cb){return function(_0xde8c41){if(_0xde8c41){return _0xde8c41[_0xa5d0('0x26')](_0x42a745)[_0xa5d0('0x27')](function(_0x518a60){return _0x518a60;});}return null;};}function removeEntity(_0x2de295,_0x307377){return function(_0xefd903){if(_0xefd903){return _0xefd903['destroy']()[_0xa5d0('0x27')](function(){_0x2de295[_0xa5d0('0x1c')](0xcc)[_0xa5d0('0x1d')]();});}};}function handleEntityNotFound(_0x4d5e7a,_0x4916f6){return function(_0x758789){if(!_0x758789){_0x4d5e7a['sendStatus'](0x194);}return _0x758789;};}function handleError(_0x49ca76,_0x55cd15){_0x55cd15=_0x55cd15||0x1f4;return function(_0x2b29a5){logger[_0xa5d0('0x28')](_0x2b29a5['stack']);if(_0x2b29a5[_0xa5d0('0x29')]){delete _0x2b29a5['name'];}_0x49ca76[_0xa5d0('0x1c')](_0x55cd15)['send'](_0x2b29a5);};}exports[_0xa5d0('0x2a')]=function(_0xc3336f,_0x431fea){var _0x48dbd2={},_0x5495cb={},_0x5bcfe1={'count':0x0,'rows':[]};var _0x3d7818=_[_0xa5d0('0x2b')](db[_0xa5d0('0x2c')][_0xa5d0('0x2d')],function(_0x5e876c){return{'name':_0x5e876c[_0xa5d0('0x2e')],'type':_0x5e876c[_0xa5d0('0x2f')]['key']};});_0x5495cb[_0xa5d0('0x30')]=_[_0xa5d0('0x2b')](_0x3d7818,_0xa5d0('0x29'));_0x5495cb[_0xa5d0('0x31')]=_[_0xa5d0('0x32')](_0xc3336f[_0xa5d0('0x31')]);_0x5495cb[_0xa5d0('0x33')]=_[_0xa5d0('0x34')](_0x5495cb[_0xa5d0('0x30')],_0x5495cb[_0xa5d0('0x31')]);_0x48dbd2[_0xa5d0('0x35')]=_['intersection'](_0x5495cb[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x48dbd2['attributes']=_0x48dbd2[_0xa5d0('0x35')][_0xa5d0('0x37')]?_0x48dbd2['attributes']:_0x5495cb[_0xa5d0('0x30')];if(!_0xc3336f['query'][_0xa5d0('0x38')](_0xa5d0('0x39'))){_0x48dbd2['limit']=qs['limit'](_0xc3336f['query'][_0xa5d0('0x21')]);_0x48dbd2['offset']=qs[_0xa5d0('0x20')](_0xc3336f[_0xa5d0('0x31')]['offset']);}_0x48dbd2[_0xa5d0('0x3a')]=qs[_0xa5d0('0x3b')](_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3b')]);_0x48dbd2[_0xa5d0('0x3c')]=qs[_0xa5d0('0x33')](_[_0xa5d0('0x3d')](_0xc3336f[_0xa5d0('0x31')],_0x5495cb[_0xa5d0('0x33')]),_0x3d7818);if(_0xc3336f[_0xa5d0('0x31')][_0xa5d0('0x3e')]){_0x48dbd2[_0xa5d0('0x3c')]=_['merge'](_0x48dbd2[_0xa5d0('0x3c')],{'$or':_['map'](_0x3d7818,function(_0x393daf){if(_0x393daf[_0xa5d0('0x2f')]!==_0xa5d0('0x3f')){var _0x40c179={};_0x40c179[_0x393daf[_0xa5d0('0x29')]]={'$like':'%'+_0xc3336f[_0xa5d0('0x31')]['filter']+'%'};return _0x40c179;}})});}_0x48dbd2=_[_0xa5d0('0x40')]({},_0x48dbd2,_0xc3336f['options']);var _0x16fe00={'where':_0x48dbd2['where']};return db['ChatQueueReport'][_0xa5d0('0x41')](_0x16fe00)[_0xa5d0('0x27')](function(_0x249b28){_0x5bcfe1[_0xa5d0('0x41')]=_0x249b28;if(_0xc3336f['query'][_0xa5d0('0x42')]){_0x48dbd2[_0xa5d0('0x43')]=[{'all':!![]}];}return db[_0xa5d0('0x2c')][_0xa5d0('0x44')](_0x48dbd2);})[_0xa5d0('0x27')](function(_0x26d37f){_0x5bcfe1[_0xa5d0('0x45')]=_0x26d37f;return _0x5bcfe1;})['then'](respondWithFilteredResult(_0x431fea,_0x48dbd2))[_0xa5d0('0x46')](handleError(_0x431fea,null));};exports[_0xa5d0('0x47')]=function(_0x20ae65,_0x343376){var _0x1090b6={'raw':!![],'where':{'id':_0x20ae65[_0xa5d0('0x48')]['id']}},_0x358b23={};_0x358b23[_0xa5d0('0x30')]=_['keys'](db[_0xa5d0('0x2c')]['rawAttributes']);_0x358b23[_0xa5d0('0x31')]=_['keys'](_0x20ae65[_0xa5d0('0x31')]);_0x358b23['filters']=_[_0xa5d0('0x34')](_0x358b23['model'],_0x358b23[_0xa5d0('0x31')]);_0x1090b6[_0xa5d0('0x35')]=_['intersection'](_0x358b23[_0xa5d0('0x30')],qs[_0xa5d0('0x36')](_0x20ae65[_0xa5d0('0x31')][_0xa5d0('0x36')]));_0x1090b6['attributes']=_0x1090b6['attributes'][_0xa5d0('0x37')]?_0x1090b6[_0xa5d0('0x35')]:_0x358b23[_0xa5d0('0x30')];if(_0x20ae65[_0xa5d0('0x31')]['includeAll']){_0x1090b6['include']=[{'all':!![]}];}_0x1090b6=_[_0xa5d0('0x40')]({},_0x1090b6,_0x20ae65[_0xa5d0('0x49')]);return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')](_0x1090b6)[_0xa5d0('0x27')](handleEntityNotFound(_0x343376,null))['then'](respondWithResult(_0x343376,null))['catch'](handleError(_0x343376,null));};exports[_0xa5d0('0x4b')]=function(_0x9a4c50,_0x2d8551){return db[_0xa5d0('0x2c')][_0xa5d0('0x4b')](_0x9a4c50[_0xa5d0('0x4c')],{})[_0xa5d0('0x27')](respondWithResult(_0x2d8551,0xc9))[_0xa5d0('0x46')](handleError(_0x2d8551,null));};exports[_0xa5d0('0x26')]=function(_0xbb7c45,_0x555ec8){if(_0xbb7c45[_0xa5d0('0x4c')]['id']){delete _0xbb7c45['body']['id'];}return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0xbb7c45['params']['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x555ec8,null))[_0xa5d0('0x27')](saveUpdates(_0xbb7c45[_0xa5d0('0x4c')],null))[_0xa5d0('0x27')](respondWithResult(_0x555ec8,null))[_0xa5d0('0x46')](handleError(_0x555ec8,null));};exports['destroy']=function(_0x30d13c,_0x54bd94){return db[_0xa5d0('0x2c')][_0xa5d0('0x4a')]({'where':{'id':_0x30d13c[_0xa5d0('0x48')]['id']}})[_0xa5d0('0x27')](handleEntityNotFound(_0x54bd94,null))['then'](removeEntity(_0x54bd94,null))['catch'](handleError(_0x54bd94,null));};exports['describe']=function(_0x38cb14,_0x5d621d){return db[_0xa5d0('0x2c')][_0xa5d0('0x4d')]()[_0xa5d0('0x27')](respondWithResult(_0x5d621d,null))['catch'](handleError(_0x5d621d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7f63a9c..bea2397 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a7dd3,_0x26b7cf){_0x5a7dd3=_0x5a7dd3-0x0;var _0x2f4d07=_0xb10b[_0x5a7dd3];return _0x2f4d07;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x4577a3,_0x339297){var _0xee54dd=function(_0x5d639d){while(--_0x5d639d){_0x4577a3['push'](_0x4577a3['shift']());}};_0xee54dd(++_0x339297);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b18dda2..cf260b8 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 _0xa61c=['request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatQueueReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa61c,0x1ab));var _0xca61=function(_0x19caa4,_0x15c152){_0x19caa4=_0x19caa4-0x0;var _0x5dcf93=_0xa61c[_0x19caa4];return _0x5dcf93;};'use strict';var _=require('lodash');var util=require(_0xca61('0x0'));var moment=require(_0xca61('0x1'));var BPromise=require(_0xca61('0x2'));var rs=require(_0xca61('0x3'));var fs=require('fs');var Redis=require(_0xca61('0x4'));var db=require(_0xca61('0x5'))['db'];var utils=require(_0xca61('0x6'));var logger=require(_0xca61('0x7'))(_0xca61('0x8'));var config=require(_0xca61('0x9'));var jayson=require(_0xca61('0xa'));var client=jayson[_0xca61('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a85a0,_0x2f52a0,_0x111c2e){return new BPromise(function(_0x5cd5a9,_0x2c49bf){return client['request'](_0x1a85a0,_0x111c2e)[_0xca61('0xc')](function(_0x20021c){logger[_0xca61('0xd')](_0xca61('0xe'),_0x2f52a0,_0xca61('0xf'));logger[_0xca61('0x10')](_0xca61('0x11'),_0x2f52a0,_0xca61('0xf'),JSON[_0xca61('0x12')](_0x20021c));if(_0x20021c[_0xca61('0x13')]){if(_0x20021c['error'][_0xca61('0x14')]===0x1f4){logger['error'](_0xca61('0xe'),_0x2f52a0,_0x20021c[_0xca61('0x13')][_0xca61('0x15')]);return _0x2c49bf(_0x20021c['error']['message']);}logger[_0xca61('0x13')](_0xca61('0xe'),_0x2f52a0,_0x20021c[_0xca61('0x13')][_0xca61('0x15')]);return _0x5cd5a9(_0x20021c[_0xca61('0x13')]['message']);}else{logger[_0xca61('0xd')](_0xca61('0xe'),_0x2f52a0,_0xca61('0xf'));_0x5cd5a9(_0x20021c[_0xca61('0x16')][_0xca61('0x15')]);}})[_0xca61('0x17')](function(_0x35675d){logger[_0xca61('0x13')](_0xca61('0xe'),_0x2f52a0,_0x35675d);_0x2c49bf(_0x35675d);});});}exports['CreateChatQueueReport']=function(_0x59d466){var _0x3537b0=this;return new Promise(function(_0x345c4e,_0x5951f1){return db[_0xca61('0x18')]['create'](_0x59d466[_0xca61('0x19')],{'raw':_0x59d466[_0xca61('0x1a')]?_0x59d466[_0xca61('0x1a')][_0xca61('0x1b')]===undefined?!![]:![]:!![]})[_0xca61('0xc')](function(_0x5df71a){logger[_0xca61('0xd')](_0xca61('0x1c'),_0x59d466);logger[_0xca61('0x10')](_0xca61('0x1c'),_0x59d466,JSON['stringify'](_0x5df71a));_0x345c4e(_0x5df71a);})[_0xca61('0x17')](function(_0x2f065f){logger[_0xca61('0x13')]('CreateChatQueueReport',_0x2f065f['message'],_0x59d466);_0x5951f1(_0x3537b0[_0xca61('0x13')](0x1f4,_0x2f065f[_0xca61('0x15')]));});});};exports[_0xca61('0x1d')]=function(_0x53ac1b){var _0x5d24ec=this;return new Promise(function(_0x22d5ba,_0x3374f1){return db[_0xca61('0x18')][_0xca61('0x1e')](_0x53ac1b[_0xca61('0x19')],{'raw':_0x53ac1b[_0xca61('0x1a')]?_0x53ac1b[_0xca61('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53ac1b[_0xca61('0x1a')]?_0x53ac1b[_0xca61('0x1a')][_0xca61('0x1f')]||null:null,'attributes':_0x53ac1b[_0xca61('0x1a')]?_0x53ac1b[_0xca61('0x1a')][_0xca61('0x20')]||null:null,'limit':_0x53ac1b[_0xca61('0x1a')]?_0x53ac1b['options'][_0xca61('0x21')]||null:null})[_0xca61('0xc')](function(_0x56d506){logger[_0xca61('0xd')]('UpdateChatQueueReport',_0x53ac1b);logger['debug'](_0xca61('0x1d'),_0x53ac1b,JSON['stringify'](_0x56d506));_0x22d5ba(_0x56d506);})[_0xca61('0x17')](function(_0x530a52){logger[_0xca61('0x13')]('UpdateChatQueueReport',_0x530a52['message'],_0x53ac1b);_0x3374f1(_0x5d24ec[_0xca61('0x13')](0x1f4,_0x530a52[_0xca61('0x15')]));});});}; \ No newline at end of file +var _0xdf48=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','create','body','options','raw','ChatQueueReport','update','where','attributes','limit','UpdateChatQueueReport','util','bluebird'];(function(_0x1d0517,_0x316e6a){var _0x3bbac3=function(_0x50180e){while(--_0x50180e){_0x1d0517['push'](_0x1d0517['shift']());}};_0x3bbac3(++_0x316e6a);}(_0xdf48,0x106));var _0x8df4=function(_0xdaf802,_0x18d92b){_0xdaf802=_0xdaf802-0x0;var _0x2e7205=_0xdf48[_0xdaf802];return _0x2e7205;};'use strict';var _=require('lodash');var util=require(_0x8df4('0x0'));var moment=require('moment');var BPromise=require(_0x8df4('0x1'));var rs=require(_0x8df4('0x2'));var fs=require('fs');var Redis=require(_0x8df4('0x3'));var db=require(_0x8df4('0x4'))['db'];var utils=require(_0x8df4('0x5'));var logger=require(_0x8df4('0x6'))('rpc');var config=require(_0x8df4('0x7'));var jayson=require(_0x8df4('0x8'));var client=jayson[_0x8df4('0x9')][_0x8df4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285df3,_0x851253,_0x4ca520){return new BPromise(function(_0x5818ab,_0x41ea6e){return client[_0x8df4('0xb')](_0x285df3,_0x4ca520)[_0x8df4('0xc')](function(_0x230062){logger[_0x8df4('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x851253,'request\x20sent');logger[_0x8df4('0xe')](_0x8df4('0xf'),_0x851253,_0x8df4('0x10'),JSON[_0x8df4('0x11')](_0x230062));if(_0x230062['error']){if(_0x230062[_0x8df4('0x12')]['code']===0x1f4){logger['error'](_0x8df4('0x13'),_0x851253,_0x230062[_0x8df4('0x12')][_0x8df4('0x14')]);return _0x41ea6e(_0x230062[_0x8df4('0x12')][_0x8df4('0x14')]);}logger['error'](_0x8df4('0x13'),_0x851253,_0x230062['error'][_0x8df4('0x14')]);return _0x5818ab(_0x230062[_0x8df4('0x12')][_0x8df4('0x14')]);}else{logger[_0x8df4('0xd')](_0x8df4('0x13'),_0x851253,_0x8df4('0x10'));_0x5818ab(_0x230062['result'][_0x8df4('0x14')]);}})[_0x8df4('0x15')](function(_0x274610){logger[_0x8df4('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x851253,_0x274610);_0x41ea6e(_0x274610);});});}exports[_0x8df4('0x16')]=function(_0x5755e8){var _0x1f7dd8=this;return new Promise(function(_0x318d1f,_0x1ff215){return db['ChatQueueReport'][_0x8df4('0x17')](_0x5755e8[_0x8df4('0x18')],{'raw':_0x5755e8[_0x8df4('0x19')]?_0x5755e8[_0x8df4('0x19')][_0x8df4('0x1a')]===undefined?!![]:![]:!![]})[_0x8df4('0xc')](function(_0x37718c){logger[_0x8df4('0xd')]('CreateChatQueueReport',_0x5755e8);logger[_0x8df4('0xe')](_0x8df4('0x16'),_0x5755e8,JSON[_0x8df4('0x11')](_0x37718c));_0x318d1f(_0x37718c);})[_0x8df4('0x15')](function(_0x12c748){logger['error'](_0x8df4('0x16'),_0x12c748['message'],_0x5755e8);_0x1ff215(_0x1f7dd8[_0x8df4('0x12')](0x1f4,_0x12c748['message']));});});};exports['UpdateChatQueueReport']=function(_0x28db63){var _0x5531b6=this;return new Promise(function(_0x527b6a,_0x3506a3){return db[_0x8df4('0x1b')][_0x8df4('0x1c')](_0x28db63[_0x8df4('0x18')],{'raw':_0x28db63[_0x8df4('0x19')]?_0x28db63[_0x8df4('0x19')][_0x8df4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28db63[_0x8df4('0x19')]?_0x28db63[_0x8df4('0x19')][_0x8df4('0x1d')]||null:null,'attributes':_0x28db63[_0x8df4('0x19')]?_0x28db63['options'][_0x8df4('0x1e')]||null:null,'limit':_0x28db63['options']?_0x28db63[_0x8df4('0x19')][_0x8df4('0x1f')]||null:null})[_0x8df4('0xc')](function(_0x195dee){logger[_0x8df4('0xd')]('UpdateChatQueueReport',_0x28db63);logger[_0x8df4('0xe')](_0x8df4('0x20'),_0x28db63,JSON[_0x8df4('0x11')](_0x195dee));_0x527b6a(_0x195dee);})[_0x8df4('0x15')](function(_0x2fb170){logger[_0x8df4('0x12')](_0x8df4('0x20'),_0x2fb170[_0x8df4('0x14')],_0x28db63);_0x3506a3(_0x5531b6[_0x8df4('0x12')](0x1f4,_0x2fb170[_0x8df4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 67afb58..3db36f3 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 _0x61f4=['post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x61f4,0x12b));var _0x461f=function(_0x3fa5eb,_0x23a5fe){_0x3fa5eb=_0x3fa5eb-0x0;var _0x5b7c28=_0x61f4[_0x3fa5eb];return _0x5b7c28;};'use strict';var multer=require(_0x461f('0x0'));var util=require(_0x461f('0x1'));var path=require(_0x461f('0x2'));var timeout=require(_0x461f('0x3'));var express=require(_0x461f('0x4'));var router=express[_0x461f('0x5')]();var fs_extra=require(_0x461f('0x6'));var auth=require(_0x461f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x461f('0x8'));var controller=require(_0x461f('0x9'));router[_0x461f('0xa')]('/',auth['isAuthenticated'](),controller[_0x461f('0xb')]);router[_0x461f('0xa')](_0x461f('0xc'),auth['isAuthenticated'](),controller[_0x461f('0xd')]);router[_0x461f('0xa')](_0x461f('0xe'),auth[_0x461f('0xf')](),controller['show']);router[_0x461f('0x10')]('/',auth[_0x461f('0xf')](),controller[_0x461f('0x11')]);router['put'](_0x461f('0xe'),auth[_0x461f('0xf')](),controller[_0x461f('0x12')]);router[_0x461f('0x13')](_0x461f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x461f('0x14')]=router; \ No newline at end of file +var _0x4c0d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports'];(function(_0x3b2f93,_0x5c56c3){var _0x27cbb3=function(_0x144668){while(--_0x144668){_0x3b2f93['push'](_0x3b2f93['shift']());}};_0x27cbb3(++_0x5c56c3);}(_0x4c0d,0x156));var _0xd4c0=function(_0x5c423d,_0xbc93f8){_0x5c423d=_0x5c423d-0x0;var _0x404821=_0x4c0d[_0x5c423d];return _0x404821;};'use strict';var multer=require(_0xd4c0('0x0'));var util=require(_0xd4c0('0x1'));var path=require('path');var timeout=require(_0xd4c0('0x2'));var express=require(_0xd4c0('0x3'));var router=express[_0xd4c0('0x4')]();var fs_extra=require(_0xd4c0('0x5'));var auth=require(_0xd4c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd4c0('0x7'));var controller=require('./chatQueueReport.controller');router[_0xd4c0('0x8')]('/',auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xa')]);router['get'](_0xd4c0('0xb'),auth[_0xd4c0('0x9')](),controller['describe']);router[_0xd4c0('0x8')](_0xd4c0('0xc'),auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xd')]);router['post']('/',auth[_0xd4c0('0x9')](),controller['create']);router['put'](_0xd4c0('0xc'),auth[_0xd4c0('0x9')](),controller[_0xd4c0('0xe')]);router[_0xd4c0('0xf')](_0xd4c0('0xc'),auth['isAuthenticated'](),controller[_0xd4c0('0x10')]);module[_0xd4c0('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 a54a2d7..c46f048 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x427067,_0x579fcd){var _0x2500c0=function(_0x2e492b){while(--_0x2e492b){_0x427067['push'](_0x427067['shift']());}};_0x2500c0(++_0x579fcd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xcb91[_0x3e25c1];return _0x52e7f2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x203c54,_0x36ad3a){var _0x22181e=function(_0x19c82d){while(--_0x19c82d){_0x203c54['push'](_0x203c54['shift']());}};_0x22181e(++_0x36ad3a);}(_0xf4eb,0xec));var _0xbf4e=function(_0x12433f,_0x22c9cb){_0x12433f=_0x12433f-0x0;var _0x4bebd9=_0xf4eb[_0x12433f];return _0x4bebd9;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a6909e4..815c49d 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 _0x0b7b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','index','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','ChatTransferReport','include','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b7b,0x1a4));var _0xb0b7=function(_0x34ee98,_0x361400){_0x34ee98=_0x34ee98-0x0;var _0x2defde=_0x0b7b[_0x34ee98];return _0x2defde;};'use strict';var emlformat=require(_0xb0b7('0x0'));var rimraf=require(_0xb0b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb0b7('0x2'));var moment=require(_0xb0b7('0x3'));var BPromise=require(_0xb0b7('0x4'));var Mustache=require(_0xb0b7('0x5'));var util=require(_0xb0b7('0x6'));var path=require(_0xb0b7('0x7'));var sox=require(_0xb0b7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0b7('0x9'));var _=require('lodash');var squel=require(_0xb0b7('0xa'));var crypto=require(_0xb0b7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb0b7('0xc'));var toCsv=require(_0xb0b7('0xd'));var querystring=require('querystring');var Papa=require(_0xb0b7('0xe'));var Redis=require(_0xb0b7('0xf'));var authService=require(_0xb0b7('0x10'));var qs=require(_0xb0b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0b7('0x12'));var logger=require(_0xb0b7('0x13'))(_0xb0b7('0x14'));var utils=require(_0xb0b7('0x15'));var config=require(_0xb0b7('0x16'));var licenseUtil=require(_0xb0b7('0x17'));var db=require(_0xb0b7('0x18'))['db'];function respondWithStatusCode(_0x57f64e,_0x179877){_0x179877=_0x179877||0xcc;return function(_0x5c03a1){if(_0x5c03a1){return _0x57f64e[_0xb0b7('0x19')](_0x179877);}return _0x57f64e[_0xb0b7('0x1a')](_0x179877)[_0xb0b7('0x1b')]();};}function respondWithResult(_0x17e082,_0x541713){_0x541713=_0x541713||0xc8;return function(_0x55d4c2){if(_0x55d4c2){return _0x17e082[_0xb0b7('0x1a')](_0x541713)['json'](_0x55d4c2);}};}function respondWithFilteredResult(_0x546e88,_0x2e7c57){return function(_0x241fdb){if(_0x241fdb){var _0xd4ce9c=typeof _0x2e7c57[_0xb0b7('0x1c')]===_0xb0b7('0x1d')&&typeof _0x2e7c57['limit']===_0xb0b7('0x1d');var _0x1b0548=_0x241fdb[_0xb0b7('0x1e')];var _0x3bfade=_0xd4ce9c?0x0:_0x2e7c57[_0xb0b7('0x1c')];var _0x302626=_0xd4ce9c?_0x241fdb['count']:_0x2e7c57['offset']+_0x2e7c57[_0xb0b7('0x1f')];var _0xae06a9;if(_0x302626>=_0x1b0548){_0x302626=_0x1b0548;_0xae06a9=0xc8;}else{_0xae06a9=0xce;}_0x546e88[_0xb0b7('0x1a')](_0xae06a9);return _0x546e88[_0xb0b7('0x20')](_0xb0b7('0x21'),_0x3bfade+'-'+_0x302626+'/'+_0x1b0548)[_0xb0b7('0x22')](_0x241fdb);}return null;};}function patchUpdates(_0x28be0b){return function(_0x1365d3){try{jsonpatch[_0xb0b7('0x23')](_0x1365d3,_0x28be0b,!![]);}catch(_0x23d059){return BPromise[_0xb0b7('0x24')](_0x23d059);}return _0x1365d3['save']();};}function saveUpdates(_0x2aba34,_0xb18c6e){return function(_0x360759){if(_0x360759){return _0x360759[_0xb0b7('0x25')](_0x2aba34)['then'](function(_0x3a71ba){return _0x3a71ba;});}return null;};}function removeEntity(_0x3f61dd,_0x13707c){return function(_0x427f22){if(_0x427f22){return _0x427f22['destroy']()[_0xb0b7('0x26')](function(){_0x3f61dd[_0xb0b7('0x1a')](0xcc)[_0xb0b7('0x1b')]();});}};}function handleEntityNotFound(_0x595360,_0x2d0884){return function(_0x2c0f2f){if(!_0x2c0f2f){_0x595360[_0xb0b7('0x19')](0x194);}return _0x2c0f2f;};}function handleError(_0x23cc97,_0x56c5f1){_0x56c5f1=_0x56c5f1||0x1f4;return function(_0x59a9ef){logger[_0xb0b7('0x27')](_0x59a9ef[_0xb0b7('0x28')]);if(_0x59a9ef[_0xb0b7('0x29')]){delete _0x59a9ef[_0xb0b7('0x29')];}_0x23cc97[_0xb0b7('0x1a')](_0x56c5f1)['send'](_0x59a9ef);};}exports[_0xb0b7('0x2a')]=function(_0x5b90d4,_0x2abd7f){var _0x3f6228={},_0x31431d={},_0x39a790={'count':0x0,'rows':[]};var _0x36f444=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x2cfb59){return{'name':_0x2cfb59['fieldName'],'type':_0x2cfb59[_0xb0b7('0x2b')][_0xb0b7('0x2c')]};});_0x31431d[_0xb0b7('0x2d')]=_[_0xb0b7('0x2e')](_0x36f444,_0xb0b7('0x29'));_0x31431d[_0xb0b7('0x2f')]=_['keys'](_0x5b90d4[_0xb0b7('0x2f')]);_0x31431d[_0xb0b7('0x30')]=_[_0xb0b7('0x31')](_0x31431d[_0xb0b7('0x2d')],_0x31431d[_0xb0b7('0x2f')]);_0x3f6228[_0xb0b7('0x32')]=_[_0xb0b7('0x31')](_0x31431d[_0xb0b7('0x2d')],qs['fields'](_0x5b90d4[_0xb0b7('0x2f')][_0xb0b7('0x33')]));_0x3f6228['attributes']=_0x3f6228['attributes'][_0xb0b7('0x34')]?_0x3f6228['attributes']:_0x31431d['model'];if(!_0x5b90d4[_0xb0b7('0x2f')][_0xb0b7('0x35')](_0xb0b7('0x36'))){_0x3f6228[_0xb0b7('0x1f')]=qs[_0xb0b7('0x1f')](_0x5b90d4[_0xb0b7('0x2f')]['limit']);_0x3f6228['offset']=qs[_0xb0b7('0x1c')](_0x5b90d4[_0xb0b7('0x2f')][_0xb0b7('0x1c')]);}_0x3f6228[_0xb0b7('0x37')]=qs[_0xb0b7('0x38')](_0x5b90d4[_0xb0b7('0x2f')][_0xb0b7('0x38')]);_0x3f6228[_0xb0b7('0x39')]=qs[_0xb0b7('0x30')](_[_0xb0b7('0x3a')](_0x5b90d4['query'],_0x31431d[_0xb0b7('0x30')]),_0x36f444);if(_0x5b90d4[_0xb0b7('0x2f')]['filter']){_0x3f6228['where']=_[_0xb0b7('0x3b')](_0x3f6228[_0xb0b7('0x39')],{'$or':_[_0xb0b7('0x2e')](_0x36f444,function(_0x136e2e){if(_0x136e2e[_0xb0b7('0x2b')]!==_0xb0b7('0x3c')){var _0x325efa={};_0x325efa[_0x136e2e[_0xb0b7('0x29')]]={'$like':'%'+_0x5b90d4[_0xb0b7('0x2f')]['filter']+'%'};return _0x325efa;}})});}_0x3f6228=_[_0xb0b7('0x3b')]({},_0x3f6228,_0x5b90d4[_0xb0b7('0x3d')]);var _0xf6b440={'where':_0x3f6228[_0xb0b7('0x39')]};return db[_0xb0b7('0x3e')][_0xb0b7('0x1e')](_0xf6b440)['then'](function(_0xd0b322){_0x39a790[_0xb0b7('0x1e')]=_0xd0b322;if(_0x5b90d4[_0xb0b7('0x2f')]['includeAll']){_0x3f6228[_0xb0b7('0x3f')]=[{'all':!![]}];}return db[_0xb0b7('0x3e')]['findAll'](_0x3f6228);})['then'](function(_0x2a18d4){_0x39a790[_0xb0b7('0x40')]=_0x2a18d4;return _0x39a790;})[_0xb0b7('0x26')](respondWithFilteredResult(_0x2abd7f,_0x3f6228))[_0xb0b7('0x41')](handleError(_0x2abd7f,null));};exports['show']=function(_0x4577ab,_0x32a741){var _0x4f353d={'raw':!![],'where':{'id':_0x4577ab[_0xb0b7('0x42')]['id']}},_0x37374f={};_0x37374f[_0xb0b7('0x2d')]=_[_0xb0b7('0x43')](db[_0xb0b7('0x3e')]['rawAttributes']);_0x37374f[_0xb0b7('0x2f')]=_[_0xb0b7('0x43')](_0x4577ab[_0xb0b7('0x2f')]);_0x37374f[_0xb0b7('0x30')]=_['intersection'](_0x37374f[_0xb0b7('0x2d')],_0x37374f[_0xb0b7('0x2f')]);_0x4f353d[_0xb0b7('0x32')]=_['intersection'](_0x37374f[_0xb0b7('0x2d')],qs[_0xb0b7('0x33')](_0x4577ab[_0xb0b7('0x2f')]['fields']));_0x4f353d[_0xb0b7('0x32')]=_0x4f353d[_0xb0b7('0x32')][_0xb0b7('0x34')]?_0x4f353d[_0xb0b7('0x32')]:_0x37374f[_0xb0b7('0x2d')];if(_0x4577ab[_0xb0b7('0x2f')][_0xb0b7('0x44')]){_0x4f353d[_0xb0b7('0x3f')]=[{'all':!![]}];}_0x4f353d=_['merge']({},_0x4f353d,_0x4577ab[_0xb0b7('0x3d')]);return db[_0xb0b7('0x3e')][_0xb0b7('0x45')](_0x4f353d)[_0xb0b7('0x26')](handleEntityNotFound(_0x32a741,null))[_0xb0b7('0x26')](respondWithResult(_0x32a741,null))[_0xb0b7('0x41')](handleError(_0x32a741,null));};exports[_0xb0b7('0x46')]=function(_0x1f8cdd,_0x41d4cb){return db[_0xb0b7('0x3e')][_0xb0b7('0x46')](_0x1f8cdd['body'],{})[_0xb0b7('0x26')](respondWithResult(_0x41d4cb,0xc9))[_0xb0b7('0x41')](handleError(_0x41d4cb,null));};exports[_0xb0b7('0x25')]=function(_0x215b07,_0x1e38af){if(_0x215b07[_0xb0b7('0x47')]['id']){delete _0x215b07[_0xb0b7('0x47')]['id'];}return db[_0xb0b7('0x3e')][_0xb0b7('0x45')]({'where':{'id':_0x215b07['params']['id']}})[_0xb0b7('0x26')](handleEntityNotFound(_0x1e38af,null))[_0xb0b7('0x26')](saveUpdates(_0x215b07[_0xb0b7('0x47')],null))['then'](respondWithResult(_0x1e38af,null))[_0xb0b7('0x41')](handleError(_0x1e38af,null));};exports['destroy']=function(_0x4fb4ea,_0x16c049){return db['ChatTransferReport'][_0xb0b7('0x45')]({'where':{'id':_0x4fb4ea['params']['id']}})['then'](handleEntityNotFound(_0x16c049,null))[_0xb0b7('0x26')](removeEntity(_0x16c049,null))['catch'](handleError(_0x16c049,null));};exports[_0xb0b7('0x48')]=function(_0x5c4938,_0x48c0a5){return db[_0xb0b7('0x3e')][_0xb0b7('0x48')]()['then'](respondWithResult(_0x48c0a5,null))['catch'](handleError(_0x48c0a5,null));}; \ No newline at end of file +var _0x8b9a=['catch','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','stack','name','send','map','ChatTransferReport','rawAttributes','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','length','find'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x8b9a,0x9d));var _0xa8b9=function(_0x1e6737,_0x3a00b9){_0x1e6737=_0x1e6737-0x0;var _0x13209b=_0x8b9a[_0x1e6737];return _0x13209b;};'use strict';var emlformat=require(_0xa8b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa8b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8b9('0x2'));var moment=require(_0xa8b9('0x3'));var BPromise=require(_0xa8b9('0x4'));var Mustache=require('mustache');var util=require(_0xa8b9('0x5'));var path=require(_0xa8b9('0x6'));var sox=require(_0xa8b9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8b9('0x8'));var _=require(_0xa8b9('0x9'));var squel=require(_0xa8b9('0xa'));var crypto=require(_0xa8b9('0xb'));var jsforce=require(_0xa8b9('0xc'));var deskjs=require(_0xa8b9('0xd'));var toCsv=require(_0xa8b9('0xe'));var querystring=require(_0xa8b9('0xf'));var Papa=require(_0xa8b9('0x10'));var Redis=require(_0xa8b9('0x11'));var authService=require(_0xa8b9('0x12'));var qs=require(_0xa8b9('0x13'));var as=require(_0xa8b9('0x14'));var hardwareService=require(_0xa8b9('0x15'));var logger=require(_0xa8b9('0x16'))(_0xa8b9('0x17'));var utils=require(_0xa8b9('0x18'));var config=require(_0xa8b9('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8b9('0x1a'))['db'];function respondWithStatusCode(_0x3b3b5e,_0x41689c){_0x41689c=_0x41689c||0xcc;return function(_0x254754){if(_0x254754){return _0x3b3b5e[_0xa8b9('0x1b')](_0x41689c);}return _0x3b3b5e['status'](_0x41689c)[_0xa8b9('0x1c')]();};}function respondWithResult(_0x3806c7,_0x5d6a7f){_0x5d6a7f=_0x5d6a7f||0xc8;return function(_0x30e106){if(_0x30e106){return _0x3806c7[_0xa8b9('0x1d')](_0x5d6a7f)[_0xa8b9('0x1e')](_0x30e106);}};}function respondWithFilteredResult(_0x1b7be9,_0x17e84a){return function(_0x2e6464){if(_0x2e6464){var _0x3a2fb0=typeof _0x17e84a[_0xa8b9('0x1f')]===_0xa8b9('0x20')&&typeof _0x17e84a[_0xa8b9('0x21')]===_0xa8b9('0x20');var _0x194d8a=_0x2e6464[_0xa8b9('0x22')];var _0x13f872=_0x3a2fb0?0x0:_0x17e84a[_0xa8b9('0x1f')];var _0x25a102=_0x3a2fb0?_0x2e6464['count']:_0x17e84a[_0xa8b9('0x1f')]+_0x17e84a['limit'];var _0x370196;if(_0x25a102>=_0x194d8a){_0x25a102=_0x194d8a;_0x370196=0xc8;}else{_0x370196=0xce;}_0x1b7be9[_0xa8b9('0x1d')](_0x370196);return _0x1b7be9['set'](_0xa8b9('0x23'),_0x13f872+'-'+_0x25a102+'/'+_0x194d8a)['json'](_0x2e6464);}return null;};}function patchUpdates(_0xf98181){return function(_0x5c5d19){try{jsonpatch[_0xa8b9('0x24')](_0x5c5d19,_0xf98181,!![]);}catch(_0x54b773){return BPromise[_0xa8b9('0x25')](_0x54b773);}return _0x5c5d19['save']();};}function saveUpdates(_0x286b83,_0x13e089){return function(_0x5d6ee9){if(_0x5d6ee9){return _0x5d6ee9['update'](_0x286b83)[_0xa8b9('0x26')](function(_0x3870a5){return _0x3870a5;});}return null;};}function removeEntity(_0x168cd3,_0x3501f0){return function(_0x2a47e8){if(_0x2a47e8){return _0x2a47e8[_0xa8b9('0x27')]()[_0xa8b9('0x26')](function(){_0x168cd3[_0xa8b9('0x1d')](0xcc)[_0xa8b9('0x1c')]();});}};}function handleEntityNotFound(_0x4732f5,_0x536a69){return function(_0x1d2541){if(!_0x1d2541){_0x4732f5[_0xa8b9('0x1b')](0x194);}return _0x1d2541;};}function handleError(_0x3c49a1,_0x2e16fd){_0x2e16fd=_0x2e16fd||0x1f4;return function(_0x5c12f5){logger['error'](_0x5c12f5[_0xa8b9('0x28')]);if(_0x5c12f5[_0xa8b9('0x29')]){delete _0x5c12f5['name'];}_0x3c49a1['status'](_0x2e16fd)[_0xa8b9('0x2a')](_0x5c12f5);};}exports['index']=function(_0x550252,_0x12ecda){var _0x16f872={},_0x4164bd={},_0xbf65a8={'count':0x0,'rows':[]};var _0x4ec0e7=_[_0xa8b9('0x2b')](db[_0xa8b9('0x2c')][_0xa8b9('0x2d')],function(_0x168e27){return{'name':_0x168e27['fieldName'],'type':_0x168e27['type'][_0xa8b9('0x2e')]};});_0x4164bd[_0xa8b9('0x2f')]=_[_0xa8b9('0x2b')](_0x4ec0e7,_0xa8b9('0x29'));_0x4164bd[_0xa8b9('0x30')]=_[_0xa8b9('0x31')](_0x550252[_0xa8b9('0x30')]);_0x4164bd[_0xa8b9('0x32')]=_['intersection'](_0x4164bd['model'],_0x4164bd[_0xa8b9('0x30')]);_0x16f872[_0xa8b9('0x33')]=_['intersection'](_0x4164bd['model'],qs['fields'](_0x550252[_0xa8b9('0x30')][_0xa8b9('0x34')]));_0x16f872[_0xa8b9('0x33')]=_0x16f872[_0xa8b9('0x33')]['length']?_0x16f872[_0xa8b9('0x33')]:_0x4164bd['model'];if(!_0x550252[_0xa8b9('0x30')]['hasOwnProperty'](_0xa8b9('0x35'))){_0x16f872['limit']=qs[_0xa8b9('0x21')](_0x550252[_0xa8b9('0x30')]['limit']);_0x16f872[_0xa8b9('0x1f')]=qs[_0xa8b9('0x1f')](_0x550252[_0xa8b9('0x30')]['offset']);}_0x16f872[_0xa8b9('0x36')]=qs[_0xa8b9('0x37')](_0x550252[_0xa8b9('0x30')][_0xa8b9('0x37')]);_0x16f872[_0xa8b9('0x38')]=qs['filters'](_[_0xa8b9('0x39')](_0x550252['query'],_0x4164bd[_0xa8b9('0x32')]),_0x4ec0e7);if(_0x550252[_0xa8b9('0x30')][_0xa8b9('0x3a')]){_0x16f872[_0xa8b9('0x38')]=_[_0xa8b9('0x3b')](_0x16f872['where'],{'$or':_[_0xa8b9('0x2b')](_0x4ec0e7,function(_0x327031){if(_0x327031[_0xa8b9('0x3c')]!==_0xa8b9('0x3d')){var _0x29ac4a={};_0x29ac4a[_0x327031[_0xa8b9('0x29')]]={'$like':'%'+_0x550252[_0xa8b9('0x30')]['filter']+'%'};return _0x29ac4a;}})});}_0x16f872=_[_0xa8b9('0x3b')]({},_0x16f872,_0x550252[_0xa8b9('0x3e')]);var _0x4eb152={'where':_0x16f872['where']};return db[_0xa8b9('0x2c')]['count'](_0x4eb152)['then'](function(_0x136526){_0xbf65a8[_0xa8b9('0x22')]=_0x136526;if(_0x550252[_0xa8b9('0x30')][_0xa8b9('0x3f')]){_0x16f872[_0xa8b9('0x40')]=[{'all':!![]}];}return db[_0xa8b9('0x2c')][_0xa8b9('0x41')](_0x16f872);})['then'](function(_0x1f35ae){_0xbf65a8['rows']=_0x1f35ae;return _0xbf65a8;})[_0xa8b9('0x26')](respondWithFilteredResult(_0x12ecda,_0x16f872))['catch'](handleError(_0x12ecda,null));};exports[_0xa8b9('0x42')]=function(_0x20a78b,_0x518bc6){var _0x4ffb80={'raw':!![],'where':{'id':_0x20a78b[_0xa8b9('0x43')]['id']}},_0x3bc7d4={};_0x3bc7d4[_0xa8b9('0x2f')]=_[_0xa8b9('0x31')](db[_0xa8b9('0x2c')][_0xa8b9('0x2d')]);_0x3bc7d4[_0xa8b9('0x30')]=_['keys'](_0x20a78b['query']);_0x3bc7d4[_0xa8b9('0x32')]=_[_0xa8b9('0x44')](_0x3bc7d4[_0xa8b9('0x2f')],_0x3bc7d4['query']);_0x4ffb80[_0xa8b9('0x33')]=_[_0xa8b9('0x44')](_0x3bc7d4[_0xa8b9('0x2f')],qs['fields'](_0x20a78b['query'][_0xa8b9('0x34')]));_0x4ffb80['attributes']=_0x4ffb80[_0xa8b9('0x33')][_0xa8b9('0x45')]?_0x4ffb80['attributes']:_0x3bc7d4['model'];if(_0x20a78b['query'][_0xa8b9('0x3f')]){_0x4ffb80[_0xa8b9('0x40')]=[{'all':!![]}];}_0x4ffb80=_[_0xa8b9('0x3b')]({},_0x4ffb80,_0x20a78b['options']);return db[_0xa8b9('0x2c')][_0xa8b9('0x46')](_0x4ffb80)[_0xa8b9('0x26')](handleEntityNotFound(_0x518bc6,null))[_0xa8b9('0x26')](respondWithResult(_0x518bc6,null))[_0xa8b9('0x47')](handleError(_0x518bc6,null));};exports['create']=function(_0x3024bd,_0x211c8d){return db[_0xa8b9('0x2c')][_0xa8b9('0x48')](_0x3024bd[_0xa8b9('0x49')],{})[_0xa8b9('0x26')](respondWithResult(_0x211c8d,0xc9))[_0xa8b9('0x47')](handleError(_0x211c8d,null));};exports[_0xa8b9('0x4a')]=function(_0xb3203b,_0x529a53){if(_0xb3203b['body']['id']){delete _0xb3203b[_0xa8b9('0x49')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0xb3203b['params']['id']}})[_0xa8b9('0x26')](handleEntityNotFound(_0x529a53,null))[_0xa8b9('0x26')](saveUpdates(_0xb3203b[_0xa8b9('0x49')],null))[_0xa8b9('0x26')](respondWithResult(_0x529a53,null))[_0xa8b9('0x47')](handleError(_0x529a53,null));};exports['destroy']=function(_0x53a4dd,_0xb9c8b1){return db[_0xa8b9('0x2c')][_0xa8b9('0x46')]({'where':{'id':_0x53a4dd['params']['id']}})[_0xa8b9('0x26')](handleEntityNotFound(_0xb9c8b1,null))[_0xa8b9('0x26')](removeEntity(_0xb9c8b1,null))['catch'](handleError(_0xb9c8b1,null));};exports['describe']=function(_0x2861d1,_0x6e3371){return db['ChatTransferReport'][_0xa8b9('0x4b')]()['then'](respondWithResult(_0x6e3371,null))[_0xa8b9('0x47')](handleError(_0x6e3371,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e40d9e2..50a759a 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 _0x2a0e=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x17aa7a,_0x2be8e4){var _0x2321f8=function(_0x2324fc){while(--_0x2324fc){_0x17aa7a['push'](_0x17aa7a['shift']());}};_0x2321f8(++_0x2be8e4);}(_0x2a0e,0xa7));var _0xe2a0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a0e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe2a0('0x0'));var util=require(_0xe2a0('0x1'));var logger=require(_0xe2a0('0x2'))(_0xe2a0('0x3'));var moment=require(_0xe2a0('0x4'));var BPromise=require(_0xe2a0('0x5'));var rp=require(_0xe2a0('0x6'));var fs=require('fs');var path=require(_0xe2a0('0x7'));var rimraf=require(_0xe2a0('0x8'));var config=require(_0xe2a0('0x9'));var attributes=require(_0xe2a0('0xa'));module['exports']=function(_0x33291d,_0x8cf019){return _0x33291d[_0xe2a0('0xb')](_0xe2a0('0xc'),attributes,{'tableName':_0xe2a0('0xd'),'paranoid':![],'indexes':[{'name':_0xe2a0('0xe'),'fields':[_0xe2a0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ba=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0xc1ba,0x85));var _0xac1b=function(_0x32b28a,_0x21b9b8){_0x32b28a=_0x32b28a-0x0;var _0x159313=_0xc1ba[_0x32b28a];return _0x159313;};'use strict';var _=require(_0xac1b('0x0'));var util=require(_0xac1b('0x1'));var logger=require(_0xac1b('0x2'))(_0xac1b('0x3'));var moment=require('moment');var BPromise=require(_0xac1b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac1b('0x5'));var rimraf=require(_0xac1b('0x6'));var config=require(_0xac1b('0x7'));var attributes=require(_0xac1b('0x8'));module[_0xac1b('0x9')]=function(_0x16cdbd,_0x3692f4){return _0x16cdbd[_0xac1b('0xa')](_0xac1b('0xb'),attributes,{'tableName':_0xac1b('0xc'),'paranoid':![],'indexes':[{'name':_0xac1b('0xd'),'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 4cda00f..199f5f2 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 _0x7bff=['ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x35d07d,_0x20800a){var _0x2d0687=function(_0x5a494a){while(--_0x5a494a){_0x35d07d['push'](_0x35d07d['shift']());}};_0x2d0687(++_0x20800a);}(_0x7bff,0xca));var _0xf7bf=function(_0x2e4061,_0x3a9745){_0x2e4061=_0x2e4061-0x0;var _0x30dc33=_0x7bff[_0x2e4061];return _0x30dc33;};'use strict';var _=require(_0xf7bf('0x0'));var util=require(_0xf7bf('0x1'));var moment=require(_0xf7bf('0x2'));var BPromise=require(_0xf7bf('0x3'));var rs=require(_0xf7bf('0x4'));var fs=require('fs');var Redis=require(_0xf7bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7bf('0x6'));var logger=require('../../config/logger')(_0xf7bf('0x7'));var config=require(_0xf7bf('0x8'));var jayson=require(_0xf7bf('0x9'));var client=jayson['client'][_0xf7bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44d10b,_0x2320a5,_0x4be896){return new BPromise(function(_0x44f4af,_0x100148){return client[_0xf7bf('0xb')](_0x44d10b,_0x4be896)[_0xf7bf('0xc')](function(_0x504004){logger[_0xf7bf('0xd')](_0xf7bf('0xe'),_0x2320a5,'request\x20sent');logger[_0xf7bf('0xf')](_0xf7bf('0x10'),_0x2320a5,_0xf7bf('0x11'),JSON[_0xf7bf('0x12')](_0x504004));if(_0x504004['error']){if(_0x504004[_0xf7bf('0x13')][_0xf7bf('0x14')]===0x1f4){logger[_0xf7bf('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2320a5,_0x504004[_0xf7bf('0x13')][_0xf7bf('0x15')]);return _0x100148(_0x504004[_0xf7bf('0x13')][_0xf7bf('0x15')]);}logger[_0xf7bf('0x13')](_0xf7bf('0xe'),_0x2320a5,_0x504004['error']['message']);return _0x44f4af(_0x504004['error'][_0xf7bf('0x15')]);}else{logger['info'](_0xf7bf('0xe'),_0x2320a5,_0xf7bf('0x11'));_0x44f4af(_0x504004[_0xf7bf('0x16')]['message']);}})[_0xf7bf('0x17')](function(_0x1cf208){logger[_0xf7bf('0x13')](_0xf7bf('0xe'),_0x2320a5,_0x1cf208);_0x100148(_0x1cf208);});});} \ No newline at end of file +var _0x4458=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x4458,0x97));var _0x8445=function(_0x516593,_0x3ec504){_0x516593=_0x516593-0x0;var _0x4b5fbf=_0x4458[_0x516593];return _0x4b5fbf;};'use strict';var _=require(_0x8445('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8445('0x1'));var rs=require(_0x8445('0x2'));var fs=require('fs');var Redis=require(_0x8445('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8445('0x4'))(_0x8445('0x5'));var config=require(_0x8445('0x6'));var jayson=require(_0x8445('0x7'));var client=jayson[_0x8445('0x8')][_0x8445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35039d,_0x50a852,_0x399b30){return new BPromise(function(_0x430a1d,_0x95ab44){return client[_0x8445('0xa')](_0x35039d,_0x399b30)[_0x8445('0xb')](function(_0x5095b0){logger[_0x8445('0xc')](_0x8445('0xd'),_0x50a852,_0x8445('0xe'));logger[_0x8445('0xf')](_0x8445('0x10'),_0x50a852,_0x8445('0xe'),JSON[_0x8445('0x11')](_0x5095b0));if(_0x5095b0[_0x8445('0x12')]){if(_0x5095b0[_0x8445('0x12')][_0x8445('0x13')]===0x1f4){logger[_0x8445('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x50a852,_0x5095b0['error']['message']);return _0x95ab44(_0x5095b0[_0x8445('0x12')][_0x8445('0x14')]);}logger[_0x8445('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x50a852,_0x5095b0['error'][_0x8445('0x14')]);return _0x430a1d(_0x5095b0[_0x8445('0x12')][_0x8445('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x50a852,_0x8445('0xe'));_0x430a1d(_0x5095b0[_0x8445('0x15')]['message']);}})[_0x8445('0x16')](function(_0x439068){logger['error'](_0x8445('0xd'),_0x50a852,_0x439068);_0x95ab44(_0x439068);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 44fde11..91a3efb 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 _0xb956=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','delete','exports','util','path','express','Router'];(function(_0x57665a,_0x1a29cf){var _0x2fab9c=function(_0x52bea6){while(--_0x52bea6){_0x57665a['push'](_0x57665a['shift']());}};_0x2fab9c(++_0x1a29cf);}(_0xb956,0xea));var _0x6b95=function(_0x591979,_0x662ad){_0x591979=_0x591979-0x0;var _0x3bce64=_0xb956[_0x591979];return _0x3bce64;};'use strict';var multer=require('multer');var util=require(_0x6b95('0x0'));var path=require(_0x6b95('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b95('0x2'));var router=express[_0x6b95('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6b95('0x4'));var config=require(_0x6b95('0x5'));var controller=require(_0x6b95('0x6'));router[_0x6b95('0x7')]('/',auth[_0x6b95('0x8')](),controller['index']);router[_0x6b95('0x7')]('/describe',auth[_0x6b95('0x8')](),controller[_0x6b95('0x9')]);router[_0x6b95('0x7')](_0x6b95('0xa'),auth[_0x6b95('0x8')](),controller[_0x6b95('0xb')]);router[_0x6b95('0xc')]('/',auth[_0x6b95('0x8')](),controller[_0x6b95('0xd')]);router[_0x6b95('0xe')]('/:id',auth[_0x6b95('0x8')](),controller['update']);router[_0x6b95('0xf')]('/:id',auth[_0x6b95('0x8')](),controller['destroy']);module[_0x6b95('0x10')]=router; \ No newline at end of file +var _0x6145=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','exports'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x6145,0x19e));var _0x5614=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x6145[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x5614('0x0'));var util=require(_0x5614('0x1'));var path=require(_0x5614('0x2'));var timeout=require(_0x5614('0x3'));var express=require(_0x5614('0x4'));var router=express[_0x5614('0x5')]();var fs_extra=require(_0x5614('0x6'));var auth=require(_0x5614('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5614('0x8'));router['get']('/',auth[_0x5614('0x9')](),controller['index']);router[_0x5614('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5614('0xb')]);router[_0x5614('0xa')](_0x5614('0xc'),auth['isAuthenticated'](),controller[_0x5614('0xd')]);router[_0x5614('0xe')]('/',auth[_0x5614('0x9')](),controller['create']);router[_0x5614('0xf')](_0x5614('0xc'),auth[_0x5614('0x9')](),controller[_0x5614('0x10')]);router['delete']('/:id',auth[_0x5614('0x9')](),controller['destroy']);module[_0x5614('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 935a320..3a4f905 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 _0x1bfb=['#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','address','email','#011F6A','#ffffff','ENUM','rounded','Chat','Send','Contact\x20us','BOOLEAN','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate'];(function(_0x299ecf,_0x5e642b){var _0x4813c9=function(_0x4726e7){while(--_0x4726e7){_0x299ecf['push'](_0x299ecf['shift']());}};_0x4813c9(++_0x5e642b);}(_0x1bfb,0x70));var _0xb1bf=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x1bfb[_0x4bb145];return _0x4db596;};'use strict';var Sequelize=require(_0xb1bf('0x0'));var rs=require('randomstring');module[_0xb1bf('0x1')]={'name':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![],'unique':_0xb1bf('0x3')},'description':{'type':Sequelize[_0xb1bf('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x4')},'key':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![],'defaultValue':_0xb1bf('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![],'defaultValue':_0xb1bf('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb1bf('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb1bf('0x7')](_0xb1bf('0x8'),'squared'),'defaultValue':_0xb1bf('0x8')},'header_online':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x9')},'offline_chat_button':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0xa')},'header_offline':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0xb')},'download_transcript':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb1bf('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb1bf('0xe')]},'closingQuestion':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x11')},'placeholderMessage':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x13')},'closingMessageButton':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x15')},'ratingType':{'type':Sequelize[_0xb1bf('0x7')](_0xb1bf('0x16'),_0xb1bf('0x17')),'defaultValue':_0xb1bf('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':function(){return JSON[_0xb1bf('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xb1bf('0x19'),'type':_0xb1bf('0x1a'),'required':!![]},'props':{'title':_0xb1bf('0x19'),'helpText':''}},{'type':_0xb1bf('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xb1bf('0x4'),'type':_0xb1bf('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb1bf('0x1c')](_0xb1bf('0x1d'))?JSON[_0xb1bf('0x1e')](this[_0xb1bf('0x1c')]('onlineForm')):{};},'set':function(_0x151ef1){return this['setDataValue'](_0xb1bf('0x1d'),JSON[_0xb1bf('0x18')](_0x151ef1));}},'offlineForm':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb1bf('0x1b'),'props':{'title':_0xb1bf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb1bf('0x4'),'type':_0xb1bf('0x4')},'variable':null},{'type':_0xb1bf('0x1f'),'config':{'placeholder':_0xb1bf('0x20')},'props':{'title':_0xb1bf('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb1bf('0x1c')](_0xb1bf('0x21'))?JSON['parse'](this[_0xb1bf('0x1c')]('offlineForm')):{};},'set':function(_0x1eb277){return this['setDataValue'](_0xb1bf('0x21'),JSON['stringify'](_0x1eb277));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb1bf('0x22')]();}},'autoclose':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb1bf('0x2')]},'forwardOffline':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb1bf('0x2')]},'waitingTitle':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x23')},'waitingMessage':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x14')},'sendUnmanaged':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb1bf('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':function(){return _0xb1bf('0x27');}},'notificationSound':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb1bf('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb1bf('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb1bf('0x2')],'defaultValue':_0xb1bf('0x29')},'verticalAlignment':{'type':Sequelize[_0xb1bf('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x2a')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x2b')},'defaultTitle':{'type':Sequelize[_0xb1bf('0x2')]},'customerAvatar':{'type':Sequelize[_0xb1bf('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb1bf('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb1bf('0x2')],'allowNull':![],'defaultValue':_0xb1bf('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb1bf('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb1bf('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb1bf('0x2d')},'systemAvatar':{'type':Sequelize[_0xb1bf('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb1bf('0xd')],'comment':_0xb1bf('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![],'comment':_0xb1bf('0x2f'),'set':function(_0x3d0c58){if(!_0x3d0c58)this[_0xb1bf('0x30')](_0xb1bf('0x31'),null);this[_0xb1bf('0x30')](_0xb1bf('0x32'),_0x3d0c58);}},'vidaooEscalation':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb1bf('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb1bf('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xb1bf('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb1bf('0xc')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xaf66=['Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','squared','Send','Contact\x20us'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0xaf66,0x11f));var _0x6af6=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0xaf66[_0x193ddf];return _0x5bc6df;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6af6('0x0'));module[_0x6af6('0x1')]={'name':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x6af6('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x3')},'key':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0x4')},'customerAlias':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![],'defaultValue':_0x6af6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6af6('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6af6('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6af6('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6af6('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6af6('0x8')](_0x6af6('0x9'),_0x6af6('0xa')),'defaultValue':_0x6af6('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6af6('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6af6('0xf')]},'closingQuestion':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x11')},'noteTitle':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x12')},'closingMessage':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0xb')},'skipMessageButton':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0x14')},'ratingType':{'type':Sequelize[_0x6af6('0x8')]('star','thumb'),'defaultValue':_0x6af6('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6af6('0xf')],'defaultValue':function(){return JSON[_0x6af6('0x16')]({'items':[{'type':_0x6af6('0x17'),'variable':null,'config':{'placeholder':_0x6af6('0x18'),'type':_0x6af6('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6af6('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6af6('0x1a')](_0x6af6('0x1b'))?JSON[_0x6af6('0x1c')](this[_0x6af6('0x1a')](_0x6af6('0x1b'))):{};},'set':function(_0x25de8b){return this['setDataValue'](_0x6af6('0x1b'),JSON[_0x6af6('0x16')](_0x25de8b));}},'offlineForm':{'type':Sequelize[_0x6af6('0xf')],'defaultValue':function(){return JSON[_0x6af6('0x16')]({'items':[{'type':_0x6af6('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6af6('0x3')},'variable':null},{'type':_0x6af6('0x1d'),'config':{'placeholder':_0x6af6('0x1e')},'props':{'title':_0x6af6('0x1e'),'helpText':_0x6af6('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x6af6('0x1a')](_0x6af6('0x20'))?JSON['parse'](this[_0x6af6('0x1a')](_0x6af6('0x20'))):{};},'set':function(_0x4d1591){return this[_0x6af6('0x21')](_0x6af6('0x20'),JSON[_0x6af6('0x16')](_0x4d1591));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6af6('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6af6('0x2')]},'waitingTitle':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x26')},'skipUnmanaged':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x27')},'sendUnmanaged':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6af6('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6af6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6af6('0xf')],'defaultValue':function(){return _0x6af6('0x28');}},'notificationSound':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6af6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x2b')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6af6('0x2c')},'defaultTitle':{'type':Sequelize[_0x6af6('0x2')]},'customerAvatar':{'type':Sequelize[_0x6af6('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6af6('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6af6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6af6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6af6('0x2')],'defaultValue':_0x6af6('0x2d')},'systemAvatar':{'type':Sequelize[_0x6af6('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6af6('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![],'comment':_0x6af6('0x2f'),'set':function(_0x19ce0c){if(!_0x19ce0c)this['setDataValue'](_0x6af6('0x30'),null);this[_0x6af6('0x21')]('mandatoryDisposition',_0x19ce0c);}},'vidaooEscalation':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6af6('0x2')]},'vidaooTopic':{'type':Sequelize[_0x6af6('0x2')],'allowNull':![],'defaultValue':_0x6af6('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x6af6('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6af6('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6af6('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7b22b79..54dec13 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 _0x50fd=['name','send','Command','getSnippet','timezone','format','iftime\x20%s,%s','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','map','get','all','some','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','Pause','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','orderBy','priority','asc','Applications','ListId','contact','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','update','created','autoclose','applications','push','close','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','queue','startRouting','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','Smtp','getSmtpOptions','SendMail','sendMail','email','MailAccountId','subjectOffline','mapValues','firstName','offlineMessageSubject','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tag','Tags','tag','getLicense','License','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','headers','x-real-ip','connection','remoteAddress','virtual','replace','render','alignment','color','labelText','textButtonColor','backgroundColor','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','../../config/environment','APIOutOfIntervalError','../../errors/api','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','ChatWebsites','UserProfileResource','sendStatus','stack'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x50fd,0xfc));var _0xd50f=function(_0x4fb434,_0x33dd0f){_0x4fb434=_0x4fb434-0x0;var _0x465321=_0x50fd[_0x4fb434];return _0x465321;};'use strict';var Mustache=require(_0xd50f('0x0'));var util=require(_0xd50f('0x1'));var path=require(_0xd50f('0x2'));var ejs=require(_0xd50f('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd50f('0x4'));var querystring=require('querystring');var htmlToText=require(_0xd50f('0x5'));var Redis=require(_0xd50f('0x6'));var jayson=require(_0xd50f('0x7'));var url=require(_0xd50f('0x8'));var qs=require(_0xd50f('0x9'));var logger=require(_0xd50f('0xa'))('api');var config=require(_0xd50f('0xb'));var APIOutOfIntervalError=require('../../errors/api')[_0xd50f('0xc')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0xd50f('0xd'))[_0xd50f('0xe')];var db=require(_0xd50f('0xf'))['db'];config[_0xd50f('0x10')]=_[_0xd50f('0x11')](config[_0xd50f('0x10')],{'host':_0xd50f('0x12'),'port':0x18eb});var socket=require(_0xd50f('0x13'))(new Redis(config['redis']));require(_0xd50f('0x14'))['register'](socket);var client=jayson[_0xd50f('0x15')][_0xd50f('0x16')]({'port':0x232c});var client9002=jayson[_0xd50f('0x15')][_0xd50f('0x16')]({'port':0x232a});var client9003=jayson['client'][_0xd50f('0x16')]({'port':0x232b});var client9001=jayson[_0xd50f('0x15')][_0xd50f('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x245437,_0x14065b,_0x493167,_0x2f4e63){return new Promise(function(_0x4de798,_0x3f8e1b){var _0x18eb79=_0x2f4e63||client;return _0x18eb79[_0xd50f('0x17')](_0x245437,_0x493167)['then'](function(_0x2ef09d){logger[_0xd50f('0x18')](_0xd50f('0x19'),_0x14065b,_0xd50f('0x1a'));logger['debug'](_0xd50f('0x1b'),_0x14065b,_0xd50f('0x1a'),JSON[_0xd50f('0x1c')](_0x2ef09d));if(_0x2ef09d['error']){if(_0x2ef09d['error']['code']===0x1f4){logger[_0xd50f('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x14065b,_0x2ef09d[_0xd50f('0x1d')][_0xd50f('0x1e')]);return _0x3f8e1b(_0x2ef09d['error'][_0xd50f('0x1e')]);}logger[_0xd50f('0x1d')](_0xd50f('0x19'),_0x14065b,_0x2ef09d[_0xd50f('0x1d')][_0xd50f('0x1e')]);return _0x4de798(_0x2ef09d['error'][_0xd50f('0x1e')]);}else{logger['info'](_0xd50f('0x19'),_0x14065b,'request\x20sent');_0x4de798(_0x2ef09d['result'][_0xd50f('0x1e')]);}})[_0xd50f('0x1f')](function(_0x6f2615){logger[_0xd50f('0x1d')](_0xd50f('0x19'),_0x14065b,_0x6f2615);_0x3f8e1b(_0x6f2615);});});}function respondWithStatusCode(_0x163840,_0x3c921f){_0x3c921f=_0x3c921f||0xcc;return function(_0x51dd3a){if(_0x51dd3a){return _0x163840['sendStatus'](_0x3c921f);}return _0x163840['status'](_0x3c921f)[_0xd50f('0x20')]();};}function respondWithResult(_0x42e5bd,_0x3ebc94){_0x3ebc94=_0x3ebc94||0xc8;return function(_0x34eef1){if(_0x34eef1){return _0x42e5bd[_0xd50f('0x21')](_0x3ebc94)[_0xd50f('0x22')](_0x34eef1);}};}function respondWithFilteredResult(_0x4d41b6,_0x39ac0d){return function(_0x409828){if(_0x409828){var _0x2805a3=typeof _0x39ac0d[_0xd50f('0x23')]===_0xd50f('0x24')&&typeof _0x39ac0d[_0xd50f('0x25')]===_0xd50f('0x24');var _0x513829=_0x409828[_0xd50f('0x26')];var _0x3a08b1=_0x2805a3?0x0:_0x39ac0d[_0xd50f('0x23')];var _0x51a60c=_0x2805a3?_0x409828[_0xd50f('0x26')]:_0x39ac0d[_0xd50f('0x23')]+_0x39ac0d[_0xd50f('0x25')];var _0x514689;if(_0x51a60c>=_0x513829){_0x51a60c=_0x513829;_0x514689=0xc8;}else{_0x514689=0xce;}_0x4d41b6[_0xd50f('0x21')](_0x514689);return _0x4d41b6[_0xd50f('0x27')](_0xd50f('0x28'),_0x3a08b1+'-'+_0x51a60c+'/'+_0x513829)[_0xd50f('0x22')](_0x409828);}return null;};}function saveUpdates(_0x478149){return function(_0x36505e){if(_0x36505e){return _0x36505e['update'](_0x478149)[_0xd50f('0x29')](function(_0x1c0c07){return _0x1c0c07;});}return null;};}function removeEntity(_0x4f86d5){return function(_0x5df9ee){if(_0x5df9ee){return _0x5df9ee[_0xd50f('0x2a')]()[_0xd50f('0x29')](function(){var _0xad7e94=_0x5df9ee['get']({'plain':!![]});var _0x18b59f=_0xd50f('0x2b');return db[_0xd50f('0x2c')][_0xd50f('0x2a')]({'where':{'type':_0x18b59f,'resourceId':_0xad7e94['id']}})[_0xd50f('0x29')](function(){return _0x5df9ee;});})['then'](function(){_0x4f86d5[_0xd50f('0x21')](0xcc)[_0xd50f('0x20')]();});}};}function handleEntityNotFound(_0x4ca01e){return function(_0x54ffc4){if(!_0x54ffc4){_0x4ca01e[_0xd50f('0x2d')](0x194);}return _0x54ffc4;};}function handleError(_0x149cde,_0x57d9e8){_0x57d9e8=_0x57d9e8||0x1f4;return function(_0xcafa98){logger[_0xd50f('0x1d')](_0xcafa98[_0xd50f('0x2e')]);if(_0xcafa98[_0xd50f('0x2f')]){delete _0xcafa98[_0xd50f('0x2f')];}_0x149cde[_0xd50f('0x21')](_0x57d9e8)[_0xd50f('0x30')](_0xcafa98);};}function iftimePromise(_0x5e8b9d,_0x21d3e2){return respondWithRpcPromise(_0xd50f('0x31'),_0xd50f('0x32'),{'command':_0x21d3e2[_0xd50f('0x33')]?util[_0xd50f('0x34')](_0xd50f('0x35'),_0x5e8b9d['interval'],_0x21d3e2[_0xd50f('0x33')]):util[_0xd50f('0x34')](_0xd50f('0x36'),_0x5e8b9d['interval'])},client9002)['then'](function(_0x732524){var _0x49a3f0=_0x732524&&_0x732524[_0xd50f('0x37')]('true')>=0x0?!![]:![];logger[_0xd50f('0x18')](_0xd50f('0x38'),_0x21d3e2['id'],_0x5e8b9d['id'],_0x5e8b9d[_0xd50f('0x39')],_0x49a3f0?_0xd50f('0x3a'):_0xd50f('0x3b'),_0x21d3e2[_0xd50f('0x33')]?_0x21d3e2[_0xd50f('0x33')]:'No\x20timezone');return _0x49a3f0;})[_0xd50f('0x1f')](function(_0x2ec576){logger['error'](_0xd50f('0x38'),_0x21d3e2['id'],_0x5e8b9d['id'],_0x5e8b9d['interval'],util['inspect'](_0x2ec576,{'showHidden':![],'depth':null}),_0x21d3e2['timezone']?_0x21d3e2['timezone']:_0xd50f('0x3c'));return![];});}function checkWebsiteIntervals(_0x541228){var _0x117af0=_[_0xd50f('0x3d')](_0x541228['Interval']['Intervals'],function(_0x57bc92){var _0x38375d=_0x57bc92[_0xd50f('0x3e')]({'plain':!![]});return iftimePromise(_0x38375d,_0x541228);});return Promise[_0xd50f('0x3f')](_0x117af0)[_0xd50f('0x29')](function(_0x2b4a23){return _[_0xd50f('0x40')](_0x2b4a23);});}function createInteractionObject(_0x2b38b2,_0x49eb08,_0x160de0,_0x1cbb27){var _0x66e1e8=require(_0xd50f('0x41'));var _0x4d61a2=new _0x66e1e8();var _0x26ff94=_0x4d61a2[_0xd50f('0x42')](_0x160de0[_0xd50f('0x43')])['getResult']();var _0x21ada1=_0x49eb08[_0xd50f('0x44')];if(_0x160de0[_0xd50f('0x45')]){_0x21ada1=_0x160de0['cf-connecting-ip'];}else if(_0x160de0[_0xd50f('0x46')]){_0x21ada1=_['first'](_0x160de0[_0xd50f('0x46')][_0xd50f('0x47')](','));}return{'ContactId':_0x1cbb27['id'],'ChatWebsiteId':_0x2b38b2,'from':(_0x1cbb27['firstName']||'')+'\x20'+(_0x1cbb27[_0xd50f('0x48')]||''),'customerIp':_0x21ada1,'customerPort':_0x160de0[_0xd50f('0x49')]?_0x160de0[_0xd50f('0x49')]:null,'referer':_0x49eb08[_0xd50f('0x4a')],'browserName':_0x26ff94[_0xd50f('0x4b')]['name']&&_0x26ff94[_0xd50f('0x4b')][_0xd50f('0x4c')]?util['format'](_0xd50f('0x4d'),_0x26ff94[_0xd50f('0x4b')][_0xd50f('0x2f')],_0x26ff94[_0xd50f('0x4b')][_0xd50f('0x4c')]):'unknown','browserVersion':_0x26ff94[_0xd50f('0x4b')][_0xd50f('0x4c')]||_0xd50f('0x4e'),'osName':util[_0xd50f('0x34')](_0xd50f('0x4d'),_0x26ff94['os'][_0xd50f('0x2f')],_0x26ff94['os'][_0xd50f('0x4c')]),'osVersion':_0x26ff94['os'][_0xd50f('0x4c')],'deviceModel':_0x26ff94[_0xd50f('0x4f')][_0xd50f('0x50')]&&_0x26ff94['device'][_0xd50f('0x51')]?util[_0xd50f('0x34')](_0xd50f('0x52'),_0x26ff94[_0xd50f('0x4f')]['model'],_0x26ff94['device'][_0xd50f('0x51')],_0x26ff94[_0xd50f('0x4f')][_0xd50f('0x53')]):null,'deviceVendor':_0x26ff94[_0xd50f('0x4f')][_0xd50f('0x51')],'deviceType':_0x26ff94[_0xd50f('0x4f')][_0xd50f('0x53')],'formData':JSON[_0xd50f('0x1c')](_0x49eb08)};}exports[_0xd50f('0x54')]=function(_0x3c9461,_0x2e19b7){var _0x4b5739={'include':[{'model':db['Pause'],'as':_0xd50f('0x55')}]},_0x2a291f={},_0x330250={'count':0x0,'rows':[]};var _0x369c18=_[_0xd50f('0x3d')](db[_0xd50f('0x56')][_0xd50f('0x57')],function(_0x2c5c86){return{'name':_0x2c5c86[_0xd50f('0x58')],'type':_0x2c5c86['type'][_0xd50f('0x59')]};});_0x2a291f[_0xd50f('0x50')]=_[_0xd50f('0x3d')](_0x369c18,'name');_0x2a291f[_0xd50f('0x5a')]=_['keys'](_0x3c9461['query']);_0x2a291f[_0xd50f('0x5b')]=_[_0xd50f('0x5c')](_0x2a291f[_0xd50f('0x50')],_0x2a291f[_0xd50f('0x5a')]);_0x4b5739[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0x2a291f[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x3c9461[_0xd50f('0x5a')][_0xd50f('0x5e')]));_0x4b5739[_0xd50f('0x5d')]=_0x4b5739['attributes'][_0xd50f('0x5f')]?_0x4b5739[_0xd50f('0x5d')]:_0x2a291f[_0xd50f('0x50')];if(!_0x3c9461['query']['hasOwnProperty'](_0xd50f('0x60'))){_0x4b5739[_0xd50f('0x25')]=qs[_0xd50f('0x25')](_0x3c9461[_0xd50f('0x5a')]['limit']);_0x4b5739['offset']=qs['offset'](_0x3c9461['query'][_0xd50f('0x23')]);}_0x4b5739['order']=qs['sort'](_0x3c9461['query'][_0xd50f('0x61')]);_0x4b5739[_0xd50f('0x62')]=qs['filters'](_['pick'](_0x3c9461['query'],_0x2a291f[_0xd50f('0x5b')]),_0x369c18);if(_0x3c9461[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x4b5739[_0xd50f('0x62')]=_[_0xd50f('0x64')](_0x4b5739[_0xd50f('0x62')],{'$or':_['map'](_0x369c18,function(_0x21beb3){if(_0x21beb3[_0xd50f('0x53')]!==_0xd50f('0x65')){var _0x14f597={};_0x14f597[_0x21beb3['name']]={'$like':'%'+_0x3c9461[_0xd50f('0x5a')]['filter']+'%'};return _0x14f597;}})});}_0x4b5739=_['merge']({},_0x4b5739,_0x3c9461[_0xd50f('0x66')]);var _0x29f9b9={'where':_0x4b5739[_0xd50f('0x62')]};return db['ChatWebsite'][_0xd50f('0x26')](_0x29f9b9)[_0xd50f('0x29')](function(_0x9e3fb4){_0x330250[_0xd50f('0x26')]=_0x9e3fb4;if(_0x3c9461[_0xd50f('0x5a')][_0xd50f('0x67')]){_0x4b5739[_0xd50f('0x68')]=[{'all':!![]}];}return db[_0xd50f('0x56')][_0xd50f('0x69')](_0x4b5739);})[_0xd50f('0x29')](function(_0x137bcd){_0x330250['rows']=_0x137bcd;return _0x330250;})[_0xd50f('0x29')](respondWithFilteredResult(_0x2e19b7,_0x4b5739))[_0xd50f('0x1f')](handleError(_0x2e19b7,null));};exports['show']=function(_0x4e680d,_0x23633f){var _0x45621e={'raw':![],'where':{'id':_0x4e680d[_0xd50f('0x6a')]['id']},'include':[{'model':db[_0xd50f('0x6b')],'as':_0xd50f('0x55')}]},_0x411b13={};_0x411b13[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0x56')][_0xd50f('0x57')]);_0x411b13[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x4e680d[_0xd50f('0x5a')]);_0x411b13[_0xd50f('0x5b')]=_[_0xd50f('0x5c')](_0x411b13[_0xd50f('0x50')],_0x411b13[_0xd50f('0x5a')]);_0x45621e['attributes']=_[_0xd50f('0x5c')](_0x411b13[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x4e680d[_0xd50f('0x5a')][_0xd50f('0x5e')]));_0x45621e[_0xd50f('0x5d')]=_0x45621e[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x45621e[_0xd50f('0x5d')]:_0x411b13[_0xd50f('0x50')];if(_0x4e680d[_0xd50f('0x5a')]['includeAll']){_0x45621e['include']=[{'all':!![]}];}_0x45621e=_[_0xd50f('0x64')]({},_0x45621e,_0x4e680d[_0xd50f('0x66')]);return db[_0xd50f('0x56')][_0xd50f('0x6d')](_0x45621e)[_0xd50f('0x29')](handleEntityNotFound(_0x23633f,null))[_0xd50f('0x29')](respondWithResult(_0x23633f,null))[_0xd50f('0x1f')](handleError(_0x23633f,null));};exports[_0xd50f('0x6e')]=function(_0x46f606,_0x4e3a83){return db[_0xd50f('0x56')][_0xd50f('0x6e')](_0x46f606[_0xd50f('0x6f')],{})[_0xd50f('0x29')](function(_0xec829){var _0x3cccc8=_0x46f606[_0xd50f('0x70')][_0xd50f('0x3e')]({'plain':!![]});if(!_0x3cccc8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cccc8[_0xd50f('0x71')]===_0xd50f('0x70')){var _0x540937=_0xec829[_0xd50f('0x3e')]({'plain':!![]});var _0x38d525='ChatWebsites';return db[_0xd50f('0x72')][_0xd50f('0x6d')]({'where':{'name':_0x38d525,'userProfileId':_0x3cccc8[_0xd50f('0x73')]},'raw':!![]})[_0xd50f('0x29')](function(_0x4d7995){if(_0x4d7995&&_0x4d7995[_0xd50f('0x74')]===0x0){return db[_0xd50f('0x2c')][_0xd50f('0x6e')]({'name':_0x540937[_0xd50f('0x2f')],'resourceId':_0x540937['id'],'type':_0x4d7995[_0xd50f('0x2f')],'sectionId':_0x4d7995['id']},{})[_0xd50f('0x29')](function(){return _0xec829;});}else{return _0xec829;}})[_0xd50f('0x1f')](function(_0x43ddfb){logger[_0xd50f('0x1d')](_0xd50f('0x75'),_0x43ddfb);throw _0x43ddfb;});}return _0xec829;})['then'](respondWithResult(_0x4e3a83,0xc9))[_0xd50f('0x1f')](handleError(_0x4e3a83,null));};exports['update']=function(_0x16a477,_0x4950f4){if(_0x16a477[_0xd50f('0x6f')]['id']){delete _0x16a477[_0xd50f('0x6f')]['id'];}return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x16a477['params']['id']},'include':[{'model':db[_0xd50f('0x6b')],'as':_0xd50f('0x55')}]})[_0xd50f('0x29')](handleEntityNotFound(_0x4950f4,null))['then'](saveUpdates(_0x16a477[_0xd50f('0x6f')],null))[_0xd50f('0x29')](respondWithResult(_0x4950f4,null))['catch'](handleError(_0x4950f4,null));};exports[_0xd50f('0x2a')]=function(_0x3e7297,_0x226315){return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x3e7297['params']['id']}})['then'](handleEntityNotFound(_0x226315,null))[_0xd50f('0x29')](removeEntity(_0x226315,null))['catch'](handleError(_0x226315,null));};exports['describe']=function(_0x328193,_0x1574d4){return db['ChatWebsite'][_0xd50f('0x76')]()[_0xd50f('0x29')](respondWithResult(_0x1574d4,null))[_0xd50f('0x1f')](handleError(_0x1574d4,null));};exports[_0xd50f('0x77')]=function(_0x2752a4,_0x3ddcb2){if(_0x2752a4[_0xd50f('0x6f')]['id']){delete _0x2752a4['body']['id'];}return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x2752a4[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3ddcb2,null))[_0xd50f('0x29')](function(_0x94afb0){if(_0x94afb0){_0x2752a4['body'][_0xd50f('0x78')]=_0x94afb0['id'];return db[_0xd50f('0x79')][_0xd50f('0x6e')](_0x2752a4[_0xd50f('0x6f')]);}})['then'](respondWithResult(_0x3ddcb2,null))[_0xd50f('0x1f')](handleError(_0x3ddcb2,null));};exports[_0xd50f('0x7a')]=function(_0x2384f6,_0x2b2920){var _0x434124={'raw':![],'where':{}};var _0xf305bc={};var _0x73adc2={'count':0x0,'rows':[]};return db[_0xd50f('0x56')]['findOne']({'where':{'id':_0x2384f6[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2b2920,null))[_0xd50f('0x29')](function(_0x2f48cc){if(_0x2f48cc){_0xf305bc[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0x79')][_0xd50f('0x57')]);_0xf305bc[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x2384f6['query']);_0xf305bc[_0xd50f('0x5b')]=_[_0xd50f('0x5c')](_0xf305bc[_0xd50f('0x50')],_0xf305bc[_0xd50f('0x5a')]);_0x434124[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0xf305bc['model'],qs[_0xd50f('0x5e')](_0x2384f6['query']['fields']));_0x434124['attributes']=_0x434124[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x434124[_0xd50f('0x5d')]:_0xf305bc[_0xd50f('0x50')];if(!_0x2384f6['query'][_0xd50f('0x7b')]('nolimit')){_0x434124[_0xd50f('0x25')]=qs[_0xd50f('0x25')](_0x2384f6['query'][_0xd50f('0x25')]);_0x434124[_0xd50f('0x23')]=qs[_0xd50f('0x23')](_0x2384f6[_0xd50f('0x5a')][_0xd50f('0x23')]);}_0x434124[_0xd50f('0x7c')]=qs[_0xd50f('0x61')](_0x2384f6[_0xd50f('0x5a')]['sort']);_0x434124[_0xd50f('0x62')]=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x2384f6['query'],_0xf305bc[_0xd50f('0x5b')]));_0x434124[_0xd50f('0x62')]['ChatWebsiteId']=_0x2f48cc['id'];if(_0x2384f6[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x434124['where']=_[_0xd50f('0x64')](_0x434124[_0xd50f('0x62')],{'$or':_[_0xd50f('0x3d')](_0x434124[_0xd50f('0x5d')],function(_0x40a82d){var _0x2dce06={};_0x2dce06[_0x40a82d]={'$like':'%'+_0x2384f6[_0xd50f('0x5a')][_0xd50f('0x63')]+'%'};return _0x2dce06;})});}_0x434124=_[_0xd50f('0x64')]({},_0x434124,_0x2384f6[_0xd50f('0x66')]);return db['Disposition'][_0xd50f('0x26')]({'where':_0x434124[_0xd50f('0x62')]})[_0xd50f('0x29')](function(_0x24ec7e){_0x73adc2['count']=_0x24ec7e;if(_0x2384f6[_0xd50f('0x5a')]['includeAll']){_0x434124[_0xd50f('0x68')]=[{'all':!![]}];}return db['Disposition'][_0xd50f('0x69')](_0x434124);})[_0xd50f('0x29')](function(_0x40ebe7){_0x73adc2[_0xd50f('0x7e')]=_0x40ebe7;return _0x73adc2;});}})[_0xd50f('0x29')](respondWithFilteredResult(_0x2b2920,_0x434124))[_0xd50f('0x1f')](handleError(_0x2b2920,null));};exports['removeDispositions']=function(_0x14eddf,_0x216f9d){return db[_0xd50f('0x56')]['find']({'where':{'id':_0x14eddf[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x216f9d,null))[_0xd50f('0x29')](function(_0x369fb0){if(_0x369fb0){return _0x369fb0[_0xd50f('0x7f')](_0x14eddf[_0xd50f('0x5a')][_0xd50f('0x80')]);}})[_0xd50f('0x29')](respondWithStatusCode(_0x216f9d,null))['catch'](handleError(_0x216f9d,null));};exports[_0xd50f('0x81')]=function(_0x15ae54,_0xb0bbbd){if(_0x15ae54['body']['id']){delete _0x15ae54[_0xd50f('0x6f')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x15ae54[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0xb0bbbd,null))[_0xd50f('0x29')](function(_0x34bbac){if(_0x34bbac){_0x15ae54[_0xd50f('0x6f')]['ChatWebsiteId']=_0x34bbac['id'];return db[_0xd50f('0x82')]['create'](_0x15ae54[_0xd50f('0x6f')]);}})[_0xd50f('0x29')](respondWithResult(_0xb0bbbd,null))[_0xd50f('0x1f')](handleError(_0xb0bbbd,null));};exports[_0xd50f('0x83')]=function(_0x224e75,_0x5bed3b){var _0x342171={'raw':![],'where':{}};var _0xebd684={};var _0x156787={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd50f('0x84')]({'where':{'id':_0x224e75[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x5bed3b,null))[_0xd50f('0x29')](function(_0x261617){if(_0x261617){_0xebd684[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0x82')][_0xd50f('0x57')]);_0xebd684[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x224e75[_0xd50f('0x5a')]);_0xebd684[_0xd50f('0x5b')]=_['intersection'](_0xebd684[_0xd50f('0x50')],_0xebd684[_0xd50f('0x5a')]);_0x342171[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0xebd684[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x224e75['query']['fields']));_0x342171[_0xd50f('0x5d')]=_0x342171[_0xd50f('0x5d')]['length']?_0x342171[_0xd50f('0x5d')]:_0xebd684['model'];if(!_0x224e75[_0xd50f('0x5a')]['hasOwnProperty']('nolimit')){_0x342171[_0xd50f('0x25')]=qs[_0xd50f('0x25')](_0x224e75[_0xd50f('0x5a')][_0xd50f('0x25')]);_0x342171[_0xd50f('0x23')]=qs[_0xd50f('0x23')](_0x224e75[_0xd50f('0x5a')][_0xd50f('0x23')]);}_0x342171[_0xd50f('0x7c')]=qs[_0xd50f('0x61')](_0x224e75[_0xd50f('0x5a')]['sort']);_0x342171['where']=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x224e75[_0xd50f('0x5a')],_0xebd684[_0xd50f('0x5b')]));_0x342171[_0xd50f('0x62')]['ChatWebsiteId']=_0x261617['id'];if(_0x224e75[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x342171[_0xd50f('0x62')]=_[_0xd50f('0x64')](_0x342171[_0xd50f('0x62')],{'$or':_[_0xd50f('0x3d')](_0x342171[_0xd50f('0x5d')],function(_0x35a07a){var _0xd782e8={};_0xd782e8[_0x35a07a]={'$like':'%'+_0x224e75[_0xd50f('0x5a')]['filter']+'%'};return _0xd782e8;})});}_0x342171=_[_0xd50f('0x64')]({},_0x342171,_0x224e75[_0xd50f('0x66')]);return db['CannedAnswer'][_0xd50f('0x26')]({'where':_0x342171[_0xd50f('0x62')]})[_0xd50f('0x29')](function(_0x177569){_0x156787['count']=_0x177569;if(_0x224e75[_0xd50f('0x5a')][_0xd50f('0x67')]){_0x342171[_0xd50f('0x68')]=[{'all':!![]}];}return db[_0xd50f('0x82')][_0xd50f('0x69')](_0x342171);})[_0xd50f('0x29')](function(_0x41aac9){_0x156787[_0xd50f('0x7e')]=_0x41aac9;return _0x156787;});}})['then'](respondWithFilteredResult(_0x5bed3b,_0x342171))[_0xd50f('0x1f')](handleError(_0x5bed3b,null));};exports[_0xd50f('0x85')]=function(_0x3e87bf,_0x30bdc1){return db[_0xd50f('0x56')]['find']({'where':{'id':_0x3e87bf[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x30bdc1,null))[_0xd50f('0x29')](function(_0x37f847){if(_0x37f847){return _0x37f847[_0xd50f('0x85')](_0x3e87bf['query'][_0xd50f('0x80')]);}})[_0xd50f('0x29')](respondWithStatusCode(_0x30bdc1,null))['catch'](handleError(_0x30bdc1,null));};exports[_0xd50f('0x86')]=function(_0x4f4f92,_0x296887){_0x4f4f92[_0xd50f('0x6f')][_0xd50f('0x87')]=_0x4f4f92['file'][_0xd50f('0x88')];return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x4f4f92[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x296887,null))[_0xd50f('0x29')](saveUpdates(_0x4f4f92[_0xd50f('0x6f')],null))[_0xd50f('0x29')](respondWithResult(_0x296887,null))[_0xd50f('0x1f')](handleError(_0x296887,null));};exports[_0xd50f('0x89')]=function(_0x3d24eb,_0xe08215){_0x3d24eb[_0xd50f('0x6f')][_0xd50f('0x8a')]=_0x3d24eb[_0xd50f('0x8b')]['filename'];return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x3d24eb[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0xe08215,null))[_0xd50f('0x29')](saveUpdates(_0x3d24eb[_0xd50f('0x6f')],null))[_0xd50f('0x29')](respondWithResult(_0xe08215,null))[_0xd50f('0x1f')](handleError(_0xe08215,null));};exports['addCustomerAvatar']=function(_0x33c017,_0x2e1890){_0x33c017[_0xd50f('0x6f')][_0xd50f('0x8c')]=_0x33c017[_0xd50f('0x8b')]['filename'];return db[_0xd50f('0x56')]['find']({'where':{'id':_0x33c017['params']['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x2e1890,null))[_0xd50f('0x29')](saveUpdates(_0x33c017['body'],null))[_0xd50f('0x29')](respondWithResult(_0x2e1890,null))[_0xd50f('0x1f')](handleError(_0x2e1890,null));};exports[_0xd50f('0x8d')]=function(_0x173020,_0x4c504d){_0x173020[_0xd50f('0x6f')][_0xd50f('0x8e')]=_0x173020[_0xd50f('0x8b')][_0xd50f('0x88')];return db[_0xd50f('0x56')]['find']({'where':{'id':_0x173020[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4c504d,null))[_0xd50f('0x29')](saveUpdates(_0x173020[_0xd50f('0x6f')],null))[_0xd50f('0x29')](respondWithResult(_0x4c504d,null))[_0xd50f('0x1f')](handleError(_0x4c504d,null));};exports[_0xd50f('0x8f')]=function(_0x4383a2,_0x16301c){var _0x1a7319=path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x92'));var _0x26f1da={'where':{'id':_0x4383a2[_0xd50f('0x6a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4f9d8d=![];return require(_0xd50f('0x93'))['getLicense']()[_0xd50f('0x29')](function(_0x1bf0c9){if(_0x1bf0c9){_0x4f9d8d=_0x1bf0c9[_0xd50f('0x94')];}})['then'](function(){return db[_0xd50f('0x56')]['find'](_0x26f1da);})['then'](handleEntityNotFound(_0x16301c,null))[_0xd50f('0x29')](function(_0x5853ed){if(_0x5853ed){if(!_[_0xd50f('0x95')](_0x5853ed[_0xd50f('0x87')])){if(fs[_0xd50f('0x96')](path['join'](config['root'],_0xd50f('0x97'),_0x5853ed[_0xd50f('0x87')]))&&_0x4f9d8d){_0x1a7319=path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x97'),_0x5853ed[_0xd50f('0x87')]);}}return _0x16301c[_0xd50f('0x98')](_0x1a7319);}})[_0xd50f('0x1f')](handleError(_0x16301c,null));};exports[_0xd50f('0x99')]=function(_0x314857,_0x53146b){var _0x58d892=path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x9a'));var _0x2aeada={'where':{'id':_0x314857[_0xd50f('0x6a')]['id']},'attributes':['id',_0xd50f('0x8a')],'raw':!![]};return db[_0xd50f('0x56')][_0xd50f('0x6d')](_0x2aeada)['then'](handleEntityNotFound(_0x53146b,null))['then'](function(_0x58a15a){if(_0x58a15a){if(!_[_0xd50f('0x95')](_0x58a15a[_0xd50f('0x8a')])){if(fs[_0xd50f('0x96')](path['join'](config['root'],_0xd50f('0x9b'),_0x58a15a['agentAvatar']))){_0x58d892=path['join'](config[_0xd50f('0x91')],_0xd50f('0x9b'),_0x58a15a[_0xd50f('0x8a')]);}}return _0x53146b[_0xd50f('0x98')](_0x58d892);}})[_0xd50f('0x1f')](handleError(_0x53146b,null));};exports[_0xd50f('0x9c')]=function(_0x2eb12d,_0x55cca8){var _0x37a419=path[_0xd50f('0x90')](config['root'],_0xd50f('0x9d'));var _0x426489={'where':{'id':_0x2eb12d[_0xd50f('0x6a')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xd50f('0x56')][_0xd50f('0x6d')](_0x426489)[_0xd50f('0x29')](handleEntityNotFound(_0x55cca8,null))[_0xd50f('0x29')](function(_0x3d0762){if(_0x3d0762){if(!_['isNil'](_0x3d0762[_0xd50f('0x8c')])){if(fs[_0xd50f('0x96')](path[_0xd50f('0x90')](config[_0xd50f('0x91')],'server/files/images/avatars/',_0x3d0762['customerAvatar']))&&_0x3d0762['showCustomerAvatar']){_0x37a419=path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x9b'),_0x3d0762[_0xd50f('0x8c')]);}}return _0x55cca8['download'](_0x37a419);}})[_0xd50f('0x1f')](handleError(_0x55cca8,null));};exports[_0xd50f('0x9e')]=function(_0x29e5ce,_0xe7602d){var _0x1a12f6=path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x9f'));var _0x27ac1b={'where':{'id':_0x29e5ce['params']['id']},'attributes':['id',_0xd50f('0x8e')],'raw':!![]};return db[_0xd50f('0x56')][_0xd50f('0x6d')](_0x27ac1b)[_0xd50f('0x29')](handleEntityNotFound(_0xe7602d,null))[_0xd50f('0x29')](function(_0x192a4a){if(_0x192a4a){if(!_[_0xd50f('0x95')](_0x192a4a[_0xd50f('0x8e')])){if(fs[_0xd50f('0x96')](path[_0xd50f('0x90')](config[_0xd50f('0x91')],_0xd50f('0x9b'),_0x192a4a['systemAvatar']))){_0x1a12f6=path[_0xd50f('0x90')](config[_0xd50f('0x91')],'server/files/images/avatars/',_0x192a4a[_0xd50f('0x8e')]);}}return _0xe7602d[_0xd50f('0x98')](_0x1a12f6);}})[_0xd50f('0x1f')](handleError(_0xe7602d,null));};exports[_0xd50f('0xa0')]=function(_0x4bf9ad,_0x2a74f5){var _0x35061e={'body':_0x4bf9ad['body'],'channel':'chat'};var _0x303cba=[];var _0x179da8=[];var _0x32b407={};var _0x23ca34=![];return db[_0xd50f('0xa1')][_0xd50f('0x76')]()['then'](function(_0x5d1214){if(!_0x5d1214){throw new db[(_0xd50f('0xa2'))]['ValidationError'](_0xd50f('0xa3'));}_0x303cba=_[_0xd50f('0xa4')](_['keys'](_0x5d1214),[_0xd50f('0xa5'),'updatedAt']);_0x179da8=_[_0xd50f('0xa4')](_['keys'](_0x5d1214),[_0xd50f('0xa5'),_0xd50f('0xa6'),_0xd50f('0xa7'),'ListId']);if(_0x4bf9ad[_0xd50f('0x6f')]['id']){delete _0x4bf9ad[_0xd50f('0x6f')]['id'];}if(_[_0xd50f('0x95')](_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xa8')])){throw new db['Sequelize'][(_0xd50f('0xa9'))](_0xd50f('0xaa'));}if(_[_0xd50f('0x95')](_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0x6f')])||_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0x6f')]===''){throw new db[(_0xd50f('0xa2'))]['ValidationError'](_0xd50f('0xab'));}if(_[_0xd50f('0x95')](_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xac')])){throw new db[(_0xd50f('0xa2'))][(_0xd50f('0xa9'))](_0xd50f('0xad')+_0x179da8);}if(!_['includes'](_0x179da8,_0x4bf9ad['body'][_0xd50f('0xac')])){throw new db[(_0xd50f('0xa2'))][(_0xd50f('0xa9'))](_0xd50f('0xae')+_0x179da8);}_0x32b407[_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xac')]]=_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xa8')];})[_0xd50f('0x29')](function(){return db[_0xd50f('0x56')]['find']({'where':{'id':_0x4bf9ad['params']['id']},'include':[{'model':db[_0xd50f('0xaf')],'as':_0xd50f('0xb0'),'include':[{'model':db[_0xd50f('0xa1')],'as':_0xd50f('0xb1'),'where':_0x32b407,'limit':0x1,'order':[[_0xd50f('0xa6'),'DESC']]}]},{'model':db[_0xd50f('0xb2')],'as':'Applications'},{'model':db['Interval'],'as':_0xd50f('0xb3'),'include':[{'model':db['Interval'],'as':_0xd50f('0xb4'),'attributes':['id',_0xd50f('0x39')],'raw':!![]}]}]});})['then'](function(_0x52164b){if(!_0x52164b)throw new APINotFoundError(util['format'](_0xd50f('0xb5'),_0x4bf9ad['params']['id']));if(!_0x52164b['Interval']||!_0x52164b[_0xd50f('0xb3')]['Intervals'])return[_0x52164b,!![]];return[_0x52164b,checkWebsiteIntervals(_0x52164b)];})[_0xd50f('0xb6')](function(_0x3a4cbc,_0x3dedc3){if(!_0x3dedc3)throw new APIOutOfIntervalError();if(!_0x3a4cbc[_0xd50f('0xb0')])return;_0x35061e[_0xd50f('0xb7')]=_0x3a4cbc;_0x35061e['list']=_0x3a4cbc[_0xd50f('0xb0')];_0x35061e['applications']=_[_0xd50f('0xb8')](_0x3a4cbc['Applications'],[_0xd50f('0xb9')],[_0xd50f('0xba')]);if(_0x35061e['account'][_0xd50f('0xbb')]){delete _0x35061e[_0xd50f('0xb7')][_0xd50f('0xbb')];}if(_0x35061e['account']['List']&&_0x35061e[_0xd50f('0xb7')]['List'][_0xd50f('0xb1')][_0xd50f('0x5f')]){return _0x35061e[_0xd50f('0xb7')]['List']['Contacts'][0x0];}var _0x327edc=_['defaults'](_0x4bf9ad[_0xd50f('0x6f')],{'firstName':_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xa8')],'ListId':_0x3a4cbc[_0xd50f('0xbc')]});_0x327edc[_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xac')]]=_0x4bf9ad['body']['from'];return db['CmContact'][_0xd50f('0x6e')](_0x327edc,{'fields':_0x303cba,'raw':!![]});})[_0xd50f('0x29')](function(_0x25e333){_0x35061e[_0xd50f('0xbd')]=_0x25e333;var _0x4e598d=createInteractionObject(_0x4bf9ad[_0xd50f('0x6a')]['id'],_0x4bf9ad['body'],_0x4bf9ad['headers'],_0x25e333);var _0x5b09b8={'ChatWebsiteId':_0x4bf9ad[_0xd50f('0x6a')]['id'],'closed':![]};if(_0x4bf9ad[_0xd50f('0x6f')]['threadId']){_0x5b09b8[_0xd50f('0xbe')]=_0x4bf9ad['body']['threadId'];return db[_0xd50f('0xbf')]['find']({'where':_0x5b09b8})[_0xd50f('0x29')](function(_0x352601){if(_0x352601){_0x23ca34=!![];return _0x352601;}_0x4e598d[_0xd50f('0xbe')]=_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xbe')];_0x4e598d[_0xd50f('0xc0')]=_0x4bf9ad[_0xd50f('0x6f')]['externalUrl'];return db[_0xd50f('0xbf')][_0xd50f('0x6e')](_0x4e598d);});}_0x5b09b8[_0xd50f('0xc1')]=_0x25e333['id'];if(_0x4bf9ad[_0xd50f('0x6f')]['interaction']&&_0x4bf9ad['body']['interaction']['id']){_0x5b09b8['id']=_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xc2')]['id'];return db[_0xd50f('0xbf')]['find']({'where':_0x5b09b8})[_0xd50f('0x29')](function(_0x5e210d){if(_0x5e210d){_0x23ca34=!![];return _0x5e210d;}return db[_0xd50f('0xbf')][_0xd50f('0x6e')](_0x4e598d);});}return db[_0xd50f('0xbf')][_0xd50f('0x6e')](_0x4e598d);})[_0xd50f('0x29')](function(_0x227802){if(!_0x23ca34)return _0x227802;var _0x58a280={'from':(_0x35061e[_0xd50f('0xbd')]['firstName']||'')+'\x20'+(_0x35061e[_0xd50f('0xbd')]['lastName']||'')};if(_0x4bf9ad['body'][_0xd50f('0xbe')]&&_0x4bf9ad[_0xd50f('0x6f')]['messageId']&&_0x4bf9ad['body'][_0xd50f('0xbe')]!=_0x4bf9ad['body'][_0xd50f('0xc3')]){_0x58a280[_0xd50f('0xbe')]=_0x4bf9ad[_0xd50f('0x6f')]['messageId'];}return _0x227802[_0xd50f('0xc4')](_0x58a280);})[_0xd50f('0x29')](function(_0x23808d){_0x35061e[_0xd50f('0xc2')]=_0x23808d[_0xd50f('0x3e')]({'plain':!![]});_0x35061e[_0xd50f('0xc2')]['created']=!_0x23ca34;if(_0x35061e['interaction'][_0xd50f('0xc5')]){if(_0x35061e[_0xd50f('0xb7')][_0xd50f('0xc6')]){_0x35061e[_0xd50f('0xc7')][_0xd50f('0xc8')]({'id':0x0,'priority':_0x35061e[_0xd50f('0xc7')][_0xd50f('0x5f')]+0x1,'app':_0xd50f('0xc9'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xd50f('0x6e')]({'body':_0x4bf9ad[_0xd50f('0x6f')]['body'],'ChatWebsiteId':_0x4bf9ad['params']['id'],'ChatInteractionId':_0x23808d['id'],'direction':'in','ContactId':_0x35061e['contact']['id'],'AttachmentId':_0x4bf9ad[_0xd50f('0x6f')][_0xd50f('0xca')]});})[_0xd50f('0x29')](function(_0x453911){_0x35061e[_0xd50f('0x1e')]=_0x453911;if(!_0x35061e[_0xd50f('0xc2')][_0xd50f('0xcb')]){return;}return db[_0xd50f('0xcc')][_0xd50f('0x6d')]({'attributes':['id','name'],'where':{'id':_0x35061e[_0xd50f('0xc2')]['UserId']}});})[_0xd50f('0x29')](function(_0x1da9f3){if(_0x1da9f3){_0x35061e['applications'][_0xd50f('0xcd')]({'id':0x0,'priority':0x0,'app':_0xd50f('0xce'),'appdata':_0x1da9f3['name']+','+(_0x35061e[_0xd50f('0xb7')][_0xd50f('0xcf')]||0xa),'interval':_0xd50f('0xd0')});_0x35061e[_0xd50f('0xd1')]=!![];}if(!_0x35061e['interaction'][_0xd50f('0xd2')]){return;}return db['ChatQueue'][_0xd50f('0x6d')]({'attributes':['id','name'],'where':{'id':_0x35061e[_0xd50f('0xc2')][_0xd50f('0xd2')]}});})[_0xd50f('0x29')](function(_0x67b840){if(_0x67b840){_0x35061e[_0xd50f('0xc7')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd50f('0xd3'),'appdata':_0x67b840[_0xd50f('0x2f')]+','+(_0x35061e[_0xd50f('0xb7')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd50f('0xd4'),_0x35061e);})[_0xd50f('0x29')](function(_0x919714){respondWithRpcPromise(_0xd50f('0xd5'),_0xd50f('0xd5'),{'event':_0xd50f('0xa0'),'message':_0x919714},client9002);return _0x919714;})[_0xd50f('0x29')](respondWithResult(_0x2a74f5,null))['catch'](APIHandleError(_0x2a74f5));};exports['offline']=function(_0x1a4f03,_0x57be74){var _0x1dc79f,_0x31169e,_0x29155a;var _0x530605=[];var _0xfe3636={};var _0x40fb65=_0x1a4f03[_0xd50f('0xd6')]||[];var _0xc1c45f=[];var _0x112208;return db[_0xd50f('0xa1')][_0xd50f('0x76')]()[_0xd50f('0x29')](function(_0x9885ea){if(!_0x9885ea){throw new db[(_0xd50f('0xa2'))]['ValidationError'](_0xd50f('0xa3'));}_0x530605=_[_0xd50f('0xa4')](_[_0xd50f('0x6c')](_0x9885ea),[_0xd50f('0xa5'),_0xd50f('0xa6'),_0xd50f('0xa7'),'ListId']);if(_0x1a4f03['body']['id']){delete _0x1a4f03[_0xd50f('0x6f')]['id'];}if(_['isNil'](_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0xa8')])){throw _0x57be74[_0xd50f('0x21')](0x1f4)['send'](new db[(_0xd50f('0xa2'))][(_0xd50f('0xa9'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0x6f')])||_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0x6f')]===''){throw _0x57be74['status'](0x1f4)['send'](new db[(_0xd50f('0xa2'))][(_0xd50f('0xa9'))](_0xd50f('0xab')));}if(_['isNil'](_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0xd7')])){throw _0x57be74['status'](0x1f4)['send'](new db[(_0xd50f('0xa2'))][(_0xd50f('0xa9'))](_0xd50f('0xd8')+_0x530605));}if(!_[_0xd50f('0xd9')](_0x530605,_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0xd7')])){throw _0x57be74[_0xd50f('0x21')](0x1f4)[_0xd50f('0x30')](new db['Sequelize'][(_0xd50f('0xa9'))](_0xd50f('0xda')+_0x530605));}_0xfe3636[_0x1a4f03[_0xd50f('0x6f')]['mapKeyOffline']]=_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0xa8')];})[_0xd50f('0x29')](function(){return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x1a4f03[_0xd50f('0x6a')]['id']},'include':[{'model':db[_0xd50f('0xaf')],'as':_0xd50f('0xb0')},{'model':db[_0xd50f('0xdb')],'as':'MailAccount'}]});})[_0xd50f('0x29')](handleEntityNotFound(_0x57be74,null))[_0xd50f('0x29')](function(_0x2cd09e){if(_0x2cd09e&&_0x2cd09e[_0xd50f('0xb0')]){_0x31169e=_0x2cd09e;var _0x338544=_[_0xd50f('0x11')](_0x1a4f03[_0xd50f('0x6f')],{'firstName':_0x1a4f03['body'][_0xd50f('0xa8')],'phone':_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0xa8')],'ListId':_0x2cd09e[_0xd50f('0xbc')]});_0x338544[_0x1a4f03[_0xd50f('0x6f')]['mapKeyOffline']]=_0x1a4f03[_0xd50f('0x6f')]['from'];return db[_0xd50f('0xa1')][_0xd50f('0xdc')]({'where':_0xfe3636,'defaults':_0x338544});}})[_0xd50f('0xb6')](function(_0x3f808d){if(_0x3f808d){_0x29155a=_0x3f808d;var _0x1f4648=fs[_0xd50f('0xdd')](path[_0xd50f('0x90')](config[_0xd50f('0x91')],'server/files/templates/chatOfflineMessage.ejs'),_0xd50f('0xde'));var _0x29f192=ejs['render'](_0x1f4648,{'body':_[_0xd50f('0xdf')](_0x1a4f03[_0xd50f('0x6f')][_0xd50f('0x6f')]),'bodyTitle':_0x31169e['offlineMessageBody']});return db[_0xd50f('0xe0')]['create']({'body':_0x29f192,'plainBody':htmlToText[_0xd50f('0xe1')](_0x29f192),'ContactId':_0x3f808d['id'],'ChatWebsiteId':_0x31169e['id']});}})['then'](function(_0x5334e1){_0x112208=_0x5334e1;if(_0x40fb65['length']){var _0x492742=_0x40fb65[_0xd50f('0x3d')](function(_0x277d02){return{'name':_0x277d02[_0xd50f('0xe2')],'basename':_0x277d02['filename'],'type':_0x277d02[_0xd50f('0xe3')],'ChatOfflineMessageId':_0x5334e1['id']};});_0xc1c45f=_0x492742[_0xd50f('0x3d')](_0x1083af=>{var _0x5199b3={'filename':_0x1083af['name'],'path':path['join'](config[_0xd50f('0x91')],_0xd50f('0xe4'),_0xd50f('0xd6'),_0xd50f('0xe5'),_0xd50f('0xe6'),_0x1083af[_0xd50f('0xe7')])};return _0x5199b3;});if(!_0x31169e['openNewInteraction']){return db[_0xd50f('0xe8')]['transaction'](function(_0x4fa7f0){return db[_0xd50f('0xe9')][_0xd50f('0xea')](_0x492742,{'transaction':_0x4fa7f0});});}}})[_0xd50f('0x29')](function(){if(_0x112208){_0x1dc79f=_0x112208;return db[_0xd50f('0xdb')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd50f('0xeb'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xd50f('0x29')](function(_0x37bbe7){if(_0x37bbe7&&_0x37bbe7[_0xd50f('0xeb')]&&_0x31169e['forwardOffline']&&_0x31169e['forwardOfflineAddress']){var _0x5640b2=_0x37bbe7[_0xd50f('0xec')]();return respondWithRpcPromise(_0xd50f('0xed'),_0xd50f('0xee'),{'account':_0x5640b2,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x37bbe7[_0xd50f('0x2f')],_0x37bbe7[_0xd50f('0xef')]||_0x37bbe7[_0xd50f('0xeb')][_0xd50f('0x70')]),'to':_0x31169e['forwardOfflineAddress'],'subject':_0x31169e['offlineMessageSubject'],'html':_0x1dc79f[_0xd50f('0x6f')],'attachments':_0xc1c45f}},client9003)[_0xd50f('0x29')](function(){return _0x1dc79f;})[_0xd50f('0x1f')](function(_0x360068){logger[_0xd50f('0x1d')](_0x360068);});}})[_0xd50f('0x29')](function(){if(_0x31169e&&_0x31169e['openNewInteraction']&&_0x31169e[_0xd50f('0xf0')]){var _0x29ac5d=[];if(_0x40fb65[_0xd50f('0x5f')]){_0x29ac5d=_0x40fb65[_0xd50f('0x3d')](function(_0xb8f26c){return{'name':_0xb8f26c['originalname'],'basename':_0xb8f26c[_0xd50f('0x88')],'type':_0xb8f26c[_0xd50f('0xe3')],'ChatOfflineMessageId':_0x112208['id']};});}var _0x52e936;if(!_['isNil'](_0x31169e[_0xd50f('0xf1')])){var _0x36a1f6=_['map'](_0x1a4f03[_0xd50f('0x6f')],function(_0x171556){return _0x171556;});var _0x1d52d1=_['toPairsIn'](_0x36a1f6)[0x0];var _0x4a5119=_[_0xd50f('0xf2')](_0x1d52d1,function(_0x2e0412){return _0x2e0412;});_0x52e936=_0x4a5119[0x1][_0x31169e[_0xd50f('0xf1')]];}var _0x3abb94={'from':_0x29155a['email'],'firstName':_0x29155a[_0xd50f('0xf3')],'lastName':_0x29155a['lastName'],'mapKey':_0xd50f('0xef'),'message':{'from':_0x29155a[_0xd50f('0xef')],'to':_0x31169e[_0xd50f('0xdb')][_0xd50f('0xef')],'cc':'','subject':_[_0xd50f('0x95')](_0x52e936)?_0x31169e[_0xd50f('0xf4')]:_0x52e936,'messageId':'','sentAt':new Date(),'attach':_0x29ac5d['length'],'attachments':_0x29ac5d,'originChannel':_0xd50f('0xf5'),'ChatWebsiteId':_0x31169e['id'],'ChatOfflineMessageId':_0x1dc79f['id'],'originTo':_0x31169e[_0xd50f('0xdb')][_0xd50f('0xef')]},'body':_0x1dc79f['body']};var _0x410d81={'account':{'id':_0x31169e[_0xd50f('0xf0')]},'body':_0x3abb94,'log':_0xd50f('0xf6')};return respondWithRpcPromise(_0xd50f('0xf6'),'notifyMail',_0x410d81,client9001)[_0xd50f('0x29')](function(){return _0x1dc79f;})[_0xd50f('0x1f')](function(_0x2a06da){logger[_0xd50f('0x1d')](_0x2a06da);});}return;})[_0xd50f('0x29')](function(){if(_0x1dc79f){return _0x1dc79f;}})[_0xd50f('0x29')](respondWithResult(_0x57be74,null))[_0xd50f('0x1f')](function(){for(var _0x5bf60d of _0x40fb65){var _0x1725c6=path['join'](config[_0xd50f('0x91')],_0xd50f('0xe4'),'files',_0xd50f('0xe5'),_0xd50f('0xe6'),_0x5bf60d['filename']);fs_extra['remove'](_0x1725c6)['catch'](function(_0x267eb8){logger[_0xd50f('0x1d')](_0xd50f('0xf7'),_0x1725c6,_0x267eb8);});}});};exports[_0xd50f('0xf8')]=function(_0x2f07f2,_0x54f7f7){return db[_0xd50f('0xbf')][_0xd50f('0x6d')]({'where':{'id':_0x2f07f2[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x54f7f7,null))[_0xd50f('0x29')](function(_0x37595c){if(_0x37595c){return _0x37595c[_0xd50f('0xf8')](_0x2f07f2[_0xd50f('0x6f')][_0xd50f('0x80')],_[_0xd50f('0xf9')](_0x2f07f2[_0xd50f('0x6f')],[_0xd50f('0x80'),'id'])||{});}})[_0xd50f('0x29')](respondWithResult(_0x54f7f7,null))['catch'](handleError(_0x54f7f7,null));};exports['getInteractions']=function(_0x12468b,_0x37a8ac){var _0x26bafd={'raw':![],'where':{}};var _0x4cfafe={};var _0x41252c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd50f('0x84')]({'where':{'id':_0x12468b[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x37a8ac,null))['then'](function(_0x45da52){if(_0x45da52){_0x4cfafe[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0xbf')]['rawAttributes']);_0x4cfafe[_0xd50f('0x5a')]=_['keys'](_0x12468b['query']);_0x4cfafe['filters']=_[_0xd50f('0x5c')](_0x4cfafe[_0xd50f('0x50')],_0x4cfafe['query']);_0x26bafd[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0x4cfafe[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x12468b['query'][_0xd50f('0x5e')]));_0x26bafd[_0xd50f('0x5d')]=_0x26bafd[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x26bafd[_0xd50f('0x5d')]:_0x4cfafe[_0xd50f('0x50')];if(!_0x12468b['query']['hasOwnProperty'](_0xd50f('0x60'))){_0x26bafd[_0xd50f('0x25')]=qs['limit'](_0x12468b[_0xd50f('0x5a')]['limit']);_0x26bafd[_0xd50f('0x23')]=qs['offset'](_0x12468b[_0xd50f('0x5a')]['offset']);}_0x26bafd[_0xd50f('0x7c')]=qs['sort'](_0x12468b[_0xd50f('0x5a')][_0xd50f('0x61')]);_0x26bafd[_0xd50f('0x62')]=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x12468b[_0xd50f('0x5a')],_0x4cfafe['filters']));_0x26bafd[_0xd50f('0x62')]['ChatWebsiteId']=_0x45da52['id'];if(_0x12468b[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x26bafd[_0xd50f('0x62')]=_['merge'](_0x26bafd['where'],{'$or':_[_0xd50f('0x3d')](_0x26bafd[_0xd50f('0x5d')],function(_0x5c6da6){var _0x48153e={};_0x48153e[_0x5c6da6]={'$like':'%'+_0x12468b[_0xd50f('0x5a')][_0xd50f('0x63')]+'%'};return _0x48153e;})});}_0x26bafd=_['merge']({},_0x26bafd,_0x12468b[_0xd50f('0x66')]);return db[_0xd50f('0xbf')]['count']({'where':_0x26bafd['where']})[_0xd50f('0x29')](function(_0x41f911){_0x41252c[_0xd50f('0x26')]=_0x41f911;if(_0x12468b[_0xd50f('0x5a')][_0xd50f('0x67')]){_0x26bafd['include']=[{'model':db[_0xd50f('0xa1')],'as':_0xd50f('0xfa'),'required':![]},{'model':db[_0xd50f('0xcc')],'as':'Owner','attributes':[_0xd50f('0x2f'),_0xd50f('0xfb'),_0xd50f('0xfc')],'required':![]},{'model':db[_0xd50f('0xfd')],'as':_0xd50f('0xfe'),'attributes':['id',_0xd50f('0x2f'),'color'],'where':_0x12468b[_0xd50f('0x5a')]['tag']?{'id':_0x12468b[_0xd50f('0x5a')][_0xd50f('0xff')]}:undefined,'required':_0x12468b[_0xd50f('0x5a')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xd50f('0x69')](_0x26bafd);})[_0xd50f('0x29')](function(_0x49d83){_0x41252c['rows']=_0x49d83;return _0x41252c;});}})[_0xd50f('0x29')](respondWithFilteredResult(_0x37a8ac,_0x26bafd))[_0xd50f('0x1f')](handleError(_0x37a8ac,null));};exports['getSnippet']=function(_0x5dc500,_0x24d4f8){var _0x1690b1=0x0;var _0x557cb7=0x0;var _0x5f1256=![];var _0xc789ea;var _0x1425a4;return db[_0xd50f('0x56')]['find']({'where':{'id':_0x5dc500[_0xd50f('0x6a')]['id']},'include':[{'model':db[_0xd50f('0xb3')],'as':_0xd50f('0xb3'),'include':[{'model':db[_0xd50f('0xb3')],'as':_0xd50f('0xb4'),'attributes':['id',_0xd50f('0x39')]}]}]})[_0xd50f('0x29')](handleEntityNotFound(_0x24d4f8,null))['then'](function(_0x5c4b7b){if(_0x5c4b7b){_0xc789ea=_0x5c4b7b;return _0x5c4b7b['getProactiveActions']({'raw':!![]});}})[_0xd50f('0x29')](function(_0x4dd1a5){if(_0xc789ea){if(_0x4dd1a5){_0x1425a4=_0x4dd1a5;}}return require(_0xd50f('0x93'))[_0xd50f('0x100')]();})['then'](function(_0x2d91d8){if(_0x2d91d8){_0x557cb7=_0x2d91d8['virtual'];_0x5f1256=_0x2d91d8[_0xd50f('0x94')];}})[_0xd50f('0x29')](function(){return db[_0xd50f('0xbf')][_0xd50f('0x26')]({'where':{'closed':![]}});})[_0xd50f('0x29')](function(_0x302b11){_0x1690b1=_0x302b11;if(_0x557cb7&&_0x302b11>_0x557cb7){return db[_0xd50f('0x101')][_0xd50f('0x84')]({'where':{'id':0x1}})[_0xd50f('0x29')](function(_0x5965fa){if(_0x5965fa){_0x5965fa['increment'](_0xd50f('0x102'));}});}})[_0xd50f('0x29')](function(){if(!_0xc789ea[_0xd50f('0xb3')]||!_0xc789ea[_0xd50f('0xb3')]['Intervals'])return!![];return checkWebsiteIntervals(_0xc789ea);})[_0xd50f('0x29')](function(_0x581682){var _0x4a2c5e=fs[_0xd50f('0xdd')](path[_0xd50f('0x90')](config['root'],_0xd50f('0x103')),_0xd50f('0xde'));var _0x31e63a=new url[(_0xd50f('0x104'))](_0xc789ea[_0xd50f('0x105')])[_0xd50f('0x106')];var _0xcaa27a=_0xd50f('0x107');var _0x54f857=![];var _0x3b87d6={'chatVersion':_0xcaa27a,'chatWebsiteAddressOrigin':_0x31e63a,'remote':_0xc789ea[_0xd50f('0x108')],'query':querystring[_0xd50f('0x1c')](_[_0xd50f('0x64')](_0xc789ea[_0xd50f('0x3e')]({'plain':!![]}),{'customerIp':_0x5dc500['headers'][_0xd50f('0x46')]||_0x5dc500[_0xd50f('0x109')][_0xd50f('0x10a')]||_0x5dc500[_0xd50f('0x10b')][_0xd50f('0x10c')]||_0x5dc500['ip'],'referer':_0x5dc500[_0xd50f('0x109')]['referer'],'openedInteractions':_0x1690b1,'maxInteractions':_0x557cb7,'virtual':_0x5f1256[_0xd50f('0x10d')],'online':_0x581682,'custom':_0x5f1256}))[_0xd50f('0x10e')](/'/g,'\x5c\x27')};_0x24d4f8['send'](ejs[_0xd50f('0x10f')](Mustache['render'](_0x4a2c5e,_0x3b87d6),{'proactiveActions':_0x1425a4,'alignment':_0xc789ea[_0xd50f('0x110')],'verticalAlignment':_0xc789ea['verticalAlignment'],'div_color':_0xc789ea[_0xd50f('0x111')],'labelText':_0xc789ea[_0xd50f('0x112')],'text_color':_0xc789ea['textColor'],'text_button_color':_0xc789ea[_0xd50f('0x113')],'button_color':_0xc789ea['color_button'],'background_color':_0xc789ea[_0xd50f('0x114')],'hideWhenOffline':_0xc789ea['hideWhenOffline'],'intervalId':_0xc789ea['IntervalId'],'isDevelopment':_0x54f857,'chatVersion':_0xcaa27a}));})[_0xd50f('0x1f')](handleError(_0x24d4f8,null));};exports['addApplications']=function(_0x47bcb5,_0x5f4f15){var _0x16f612=_0x47bcb5[_0xd50f('0x6a')]['id'];var _0x4a4c83=_0x47bcb5[_0xd50f('0x6f')];var _0x2bd375=0xc8;var _0x789ea5=null;return db[_0xd50f('0xe8')][_0xd50f('0x115')]({'isolationLevel':db[_0xd50f('0xe8')][_0xd50f('0x116')]['ISOLATION_LEVELS'][_0xd50f('0x117')]},function(_0x51eafc){return db[_0xd50f('0x56')]['findOne']({'where':{'id':_0x16f612},'transaction':_0x51eafc})[_0xd50f('0x29')](function(_0x52c7f5){if(_0x52c7f5){return db[_0xd50f('0xb2')][_0xd50f('0x2a')]({'where':{'ChatWebsiteId':_0x16f612},'transaction':_0x51eafc})[_0xd50f('0x29')](function(){var _0x3f1481=_[_0xd50f('0x3d')](_0x4a4c83,function(_0x4b61e5){_0x4b61e5[_0xd50f('0x78')]=_0x16f612;return _0x4b61e5;});return db[_0xd50f('0xb2')][_0xd50f('0xea')](_0x3f1481,{'transaction':_0x51eafc});});}else{_0x2bd375=0x194;_0x789ea5=[];}});})[_0xd50f('0x29')](function(){if(_0x2bd375!==0x194){return db['ChatApplication'][_0xd50f('0x118')]({'where':{'ChatWebsiteId':_0x16f612},'order':_0xd50f('0xb9')})[_0xd50f('0x29')](function(_0xa2a16c){_0x789ea5=_0xa2a16c;});}})[_0xd50f('0x1f')](function(_0x324b14){_0x2bd375=0x1f4;logger[_0xd50f('0x1d')](_0x324b14[_0xd50f('0x2e')]);if(_0x324b14[_0xd50f('0x2f')]){delete _0x324b14['name'];}_0x789ea5=_0x324b14;})[_0xd50f('0x119')](function(){if(_0x789ea5===null){_0x5f4f15[_0xd50f('0x2d')](_0x2bd375);}else{if(_0x2bd375===0x1f4){_0x5f4f15[_0xd50f('0x21')](_0x2bd375)['send'](_0x789ea5);}else{_0x5f4f15['status'](_0x2bd375)['json'](_0x789ea5);}}});};exports[_0xd50f('0x11a')]=function(_0x835c10,_0x4a96eb){var _0xa2d0bd={};var _0x43e8ab={};var _0x21807e;var _0x268195;return db[_0xd50f('0x56')]['findOne']({'where':{'id':_0x835c10[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x4a96eb,null))[_0xd50f('0x29')](function(_0x1affe7){if(_0x1affe7){_0x21807e=_0x1affe7;_0x43e8ab[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0xb2')][_0xd50f('0x57')]);_0x43e8ab[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x835c10[_0xd50f('0x5a')]);_0x43e8ab[_0xd50f('0x5b')]=_[_0xd50f('0x5c')](_0x43e8ab['model'],_0x43e8ab['query']);_0xa2d0bd[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0x43e8ab[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x835c10[_0xd50f('0x5a')]['fields']));_0xa2d0bd['attributes']=_0xa2d0bd['attributes'][_0xd50f('0x5f')]?_0xa2d0bd[_0xd50f('0x5d')]:_0x43e8ab[_0xd50f('0x50')];_0xa2d0bd[_0xd50f('0x7c')]=qs[_0xd50f('0x61')](_0x835c10[_0xd50f('0x5a')][_0xd50f('0x61')]);_0xa2d0bd[_0xd50f('0x62')]=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x835c10[_0xd50f('0x5a')],_0x43e8ab[_0xd50f('0x5b')]));if(_0x835c10[_0xd50f('0x5a')][_0xd50f('0x63')]){_0xa2d0bd[_0xd50f('0x62')]=_[_0xd50f('0x64')](_0xa2d0bd[_0xd50f('0x62')],{'$or':_['map'](_0xa2d0bd['attributes'],function(_0x1d1901){var _0x520598={};_0x520598[_0x1d1901]={'$like':'%'+_0x835c10['query'][_0xd50f('0x63')]+'%'};return _0x520598;})});}_0xa2d0bd=_[_0xd50f('0x64')]({},_0xa2d0bd,_0x835c10[_0xd50f('0x66')]);return _0x21807e[_0xd50f('0x11a')](_0xa2d0bd);}})[_0xd50f('0x29')](function(_0xf2d870){if(_0xf2d870){_0x268195=_0xf2d870[_0xd50f('0x5f')];if(!_0x835c10[_0xd50f('0x5a')][_0xd50f('0x7b')](_0xd50f('0x60'))){_0xa2d0bd[_0xd50f('0x25')]=qs['limit'](_0x835c10['query'][_0xd50f('0x25')]);_0xa2d0bd[_0xd50f('0x23')]=qs[_0xd50f('0x23')](_0x835c10[_0xd50f('0x5a')][_0xd50f('0x23')]);}return _0x21807e[_0xd50f('0x11a')](_0xa2d0bd);}})[_0xd50f('0x29')](function(_0x23770c){if(_0x23770c){return _0x23770c?{'count':_0x268195,'rows':_0x23770c}:null;}})['then'](respondWithResult(_0x4a96eb,null))[_0xd50f('0x1f')](handleError(_0x4a96eb,null));};exports[_0xd50f('0x11b')]=function(_0x12ee27,_0x3baffb){return db[_0xd50f('0x11c')][_0xd50f('0x6d')]({'where':{'id':_0x12ee27[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x3baffb,null))['then'](function(_0x1e5674){if(_0x1e5674){return _0x1e5674['addProactiveActions'](_0x12ee27[_0xd50f('0x6f')]['ids'],_[_0xd50f('0xf9')](_0x12ee27[_0xd50f('0x6f')],[_0xd50f('0x80'),'id'])||{});}})[_0xd50f('0x29')](respondWithResult(_0x3baffb,null))[_0xd50f('0x1f')](handleError(_0x3baffb,null));};exports[_0xd50f('0x11d')]=function(_0x1eea34,_0x2793a3){var _0x21bff9={};var _0x3489f9={};var _0x191285;var _0x39e249;return db[_0xd50f('0x56')][_0xd50f('0x84')]({'where':{'id':_0x1eea34['params']['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x2793a3,null))[_0xd50f('0x29')](function(_0x17c49c){if(_0x17c49c){_0x191285=_0x17c49c;_0x3489f9['model']=_['keys'](db[_0xd50f('0x11e')][_0xd50f('0x57')]);_0x3489f9[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x1eea34[_0xd50f('0x5a')]);_0x3489f9[_0xd50f('0x5b')]=_[_0xd50f('0x5c')](_0x3489f9['model'],_0x3489f9[_0xd50f('0x5a')]);_0x21bff9[_0xd50f('0x5d')]=_[_0xd50f('0x5c')](_0x3489f9['model'],qs[_0xd50f('0x5e')](_0x1eea34[_0xd50f('0x5a')][_0xd50f('0x5e')]));_0x21bff9['attributes']=_0x21bff9[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x21bff9['attributes']:_0x3489f9[_0xd50f('0x50')];_0x21bff9[_0xd50f('0x7c')]=qs['sort'](_0x1eea34[_0xd50f('0x5a')][_0xd50f('0x61')]);_0x21bff9[_0xd50f('0x62')]=qs['filters'](_[_0xd50f('0x7d')](_0x1eea34[_0xd50f('0x5a')],_0x3489f9[_0xd50f('0x5b')]));if(_0x1eea34[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x21bff9[_0xd50f('0x62')]=_[_0xd50f('0x64')](_0x21bff9['where'],{'$or':_[_0xd50f('0x3d')](_0x21bff9[_0xd50f('0x5d')],function(_0x34e3cd){var _0x3bdc87={};_0x3bdc87[_0x34e3cd]={'$like':'%'+_0x1eea34[_0xd50f('0x5a')]['filter']+'%'};return _0x3bdc87;})});}_0x21bff9=_[_0xd50f('0x64')]({},_0x21bff9,_0x1eea34['options']);return _0x191285[_0xd50f('0x11d')](_0x21bff9);}})[_0xd50f('0x29')](function(_0x206317){if(_0x206317){_0x39e249=_0x206317[_0xd50f('0x5f')];if(!_0x1eea34[_0xd50f('0x5a')]['hasOwnProperty'](_0xd50f('0x60'))){_0x21bff9['limit']=qs[_0xd50f('0x25')](_0x1eea34[_0xd50f('0x5a')][_0xd50f('0x25')]);_0x21bff9['offset']=qs['offset'](_0x1eea34[_0xd50f('0x5a')][_0xd50f('0x23')]);}return _0x191285['getProactiveActions'](_0x21bff9);}})['then'](function(_0x11b50d){if(_0x11b50d){return _0x11b50d?{'count':_0x39e249,'rows':_0x11b50d}:null;}})[_0xd50f('0x29')](respondWithResult(_0x2793a3,null))[_0xd50f('0x1f')](handleError(_0x2793a3,null));};exports[_0xd50f('0x11f')]=function(_0x572c18,_0x5340b0){var _0x3bd1ec=_0x572c18['query']['online']==='false'?_0xd50f('0x120'):_0xd50f('0x121');return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'attributes':['id',_0x3bd1ec],'where':{'id':_0x572c18[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x5340b0,null))[_0xd50f('0x29')](function(_0x487e2a){if(_0x487e2a){var _0x5e414f=_0x487e2a[_0x3bd1ec];var _0x1187b2=_0x5e414f&&_0x5e414f[_0xd50f('0x122')]?_0x5e414f[_0xd50f('0x122')]:[];_0x5340b0['send']({'fromKey':_['isNil'](_0x5e414f[_0xd50f('0x123')])?undefined:_0x5e414f['fromKey'],'count':_0x1187b2['length'],'rows':_0x1187b2});}})['catch'](handleError(_0x5340b0,null));};exports['getOfflineMessages']=function(_0x485ba9,_0xb5e700){var _0x455142={'raw':![],'where':{}};var _0x7d92fe={};var _0x29e77c={'count':0x0,'rows':[]};return db[_0xd50f('0x56')]['findOne']({'where':{'id':_0x485ba9[_0xd50f('0x6a')]['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0xb5e700,null))[_0xd50f('0x29')](function(_0x1df951){if(_0x1df951){_0x7d92fe[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0xe0')][_0xd50f('0x57')]);_0x7d92fe[_0xd50f('0x5a')]=_[_0xd50f('0x6c')](_0x485ba9[_0xd50f('0x5a')]);_0x7d92fe['filters']=_['intersection'](_0x7d92fe[_0xd50f('0x50')],_0x7d92fe['query']);_0x455142['attributes']=_[_0xd50f('0x5c')](_0x7d92fe[_0xd50f('0x50')],qs['fields'](_0x485ba9[_0xd50f('0x5a')][_0xd50f('0x5e')]));_0x455142[_0xd50f('0x5d')]=_0x455142[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x455142[_0xd50f('0x5d')]:_0x7d92fe[_0xd50f('0x50')];if(!_0x485ba9[_0xd50f('0x5a')]['hasOwnProperty'](_0xd50f('0x60'))){_0x455142['limit']=qs[_0xd50f('0x25')](_0x485ba9[_0xd50f('0x5a')][_0xd50f('0x25')]);_0x455142[_0xd50f('0x23')]=qs[_0xd50f('0x23')](_0x485ba9['query']['offset']);}_0x455142[_0xd50f('0x7c')]=qs[_0xd50f('0x61')](_0x485ba9[_0xd50f('0x5a')][_0xd50f('0x61')]);_0x455142[_0xd50f('0x62')]=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x485ba9[_0xd50f('0x5a')],_0x7d92fe[_0xd50f('0x5b')]));_0x455142[_0xd50f('0x62')][_0xd50f('0x78')]=_0x1df951['id'];if(_0x485ba9[_0xd50f('0x5a')][_0xd50f('0x63')]){_0x455142['where']=_[_0xd50f('0x64')](_0x455142[_0xd50f('0x62')],{'$or':_[_0xd50f('0x3d')](_0x455142[_0xd50f('0x5d')],function(_0x471a95){var _0x3a04ca={};_0x3a04ca[_0x471a95]={'$like':'%'+_0x485ba9[_0xd50f('0x5a')]['filter']+'%'};return _0x3a04ca;})});}_0x455142=_[_0xd50f('0x64')]({},_0x455142,_0x485ba9[_0xd50f('0x66')]);return db[_0xd50f('0xe0')]['count']({'where':_0x455142[_0xd50f('0x62')]})[_0xd50f('0x29')](function(_0x1651bf){_0x29e77c[_0xd50f('0x26')]=_0x1651bf;if(_0x485ba9[_0xd50f('0x5a')][_0xd50f('0x67')]){_0x455142[_0xd50f('0x68')]=[{'all':!![]}];}else{_0x455142[_0xd50f('0x68')]=[{'model':db[_0xd50f('0xa1')],'as':'Contact','required':![]},{'model':db[_0xd50f('0xe9')],'as':_0xd50f('0x124'),'required':![]}];}return db[_0xd50f('0xe0')][_0xd50f('0x69')](_0x455142);})['then'](function(_0x4980f4){_0x29e77c['rows']=_0x4980f4;return _0x29e77c;});}})['then'](respondWithFilteredResult(_0xb5e700,_0x455142))[_0xd50f('0x1f')](handleError(_0xb5e700,null));};exports[_0xd50f('0x125')]=function(_0x4ef552,_0x398e69){return db[_0xd50f('0x56')][_0xd50f('0x6d')]({'where':{'id':_0x4ef552['params']['id']}})['then'](handleEntityNotFound(_0x398e69,null))[_0xd50f('0x29')](function(_0x5e33c4){if(_0x5e33c4){return _0x5e33c4[_0xd50f('0x125')](_0x4ef552['body']['ids'],_[_0xd50f('0xf9')](_0x4ef552['body'],[_0xd50f('0x80'),'id'])||{})['spread'](function(_0x92421b){for(var _0x2fdf5e=0x0;_0x2fdf5e<_0x4ef552[_0xd50f('0x6f')]['ids']['length'];_0x2fdf5e+=0x1){socket[_0xd50f('0x126')](_0xd50f('0x127'),{'UserId':Number(_0x4ef552[_0xd50f('0x6f')]['ids'][_0x2fdf5e]),'ChatWebsiteId':Number(_0x4ef552[_0xd50f('0x6a')]['id'])});}return _0x92421b;});}})[_0xd50f('0x29')](respondWithResult(_0x398e69,null))[_0xd50f('0x1f')](handleError(_0x398e69,null));};exports[_0xd50f('0x128')]=function(_0x474491,_0x3dff8f){return db[_0xd50f('0x56')]['find']({'where':{'id':_0x474491['params']['id']}})[_0xd50f('0x29')](handleEntityNotFound(_0x3dff8f,null))[_0xd50f('0x29')](function(_0x472987){if(_0x472987){return _0x472987[_0xd50f('0x128')](_0x474491['query'][_0xd50f('0x80')])['then'](function(){if(_['isArray'](_0x474491[_0xd50f('0x5a')][_0xd50f('0x80')])){for(var _0x35c474=0x0;_0x35c474<_0x474491[_0xd50f('0x5a')][_0xd50f('0x80')]['length'];_0x35c474+=0x1){socket[_0xd50f('0x126')](_0xd50f('0x129'),{'UserId':Number(_0x474491[_0xd50f('0x5a')][_0xd50f('0x80')][_0x35c474]),'ChatWebsiteId':Number(_0x474491[_0xd50f('0x6a')]['id'])});}}else{socket[_0xd50f('0x126')](_0xd50f('0x129'),{'UserId':Number(_0x474491[_0xd50f('0x5a')][_0xd50f('0x80')]),'ChatWebsiteId':Number(_0x474491[_0xd50f('0x6a')]['id'])});}});}})[_0xd50f('0x29')](respondWithStatusCode(_0x3dff8f,null))[_0xd50f('0x1f')](handleError(_0x3dff8f,null));};exports['getAgents']=function(_0x4ea762,_0x2c04ed){var _0x3b37c9={};var _0x1a00b5={};var _0x27cd5b;var _0x42ef15;return db[_0xd50f('0x56')][_0xd50f('0x84')]({'where':{'id':_0x4ea762[_0xd50f('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2c04ed,null))[_0xd50f('0x29')](function(_0x1bb8ec){if(_0x1bb8ec){_0x27cd5b=_0x1bb8ec;_0x1a00b5[_0xd50f('0x50')]=_[_0xd50f('0x6c')](db[_0xd50f('0xcc')][_0xd50f('0x57')]);_0x1a00b5['query']=_[_0xd50f('0x6c')](_0x4ea762[_0xd50f('0x5a')]);_0x1a00b5['filters']=_['intersection'](_0x1a00b5[_0xd50f('0x50')],_0x1a00b5['query']);_0x3b37c9['attributes']=_[_0xd50f('0x5c')](_0x1a00b5[_0xd50f('0x50')],qs[_0xd50f('0x5e')](_0x4ea762['query']['fields']));_0x3b37c9[_0xd50f('0x5d')]=_0x3b37c9[_0xd50f('0x5d')][_0xd50f('0x5f')]?_0x3b37c9[_0xd50f('0x5d')]:_0x1a00b5[_0xd50f('0x50')];_0x3b37c9[_0xd50f('0x7c')]=qs[_0xd50f('0x61')](_0x4ea762['query'][_0xd50f('0x61')]);_0x3b37c9[_0xd50f('0x62')]=qs[_0xd50f('0x5b')](_[_0xd50f('0x7d')](_0x4ea762[_0xd50f('0x5a')],_0x1a00b5[_0xd50f('0x5b')]));if(_0x4ea762['query'][_0xd50f('0x63')]){_0x3b37c9[_0xd50f('0x62')]=_['merge'](_0x3b37c9[_0xd50f('0x62')],{'$or':_[_0xd50f('0x3d')](_0x3b37c9[_0xd50f('0x5d')],function(_0x490f07){var _0x59cef4={};_0x59cef4[_0x490f07]={'$like':'%'+_0x4ea762[_0xd50f('0x5a')]['filter']+'%'};return _0x59cef4;})});}_0x3b37c9=_['merge']({},_0x3b37c9,_0x4ea762[_0xd50f('0x66')]);return _0x27cd5b[_0xd50f('0x12a')](_0x3b37c9);}})[_0xd50f('0x29')](function(_0x3fa646){if(_0x3fa646){_0x42ef15=_0x3fa646[_0xd50f('0x5f')];if(!_0x4ea762['query'][_0xd50f('0x7b')](_0xd50f('0x60'))){_0x3b37c9[_0xd50f('0x25')]=qs['limit'](_0x4ea762['query'][_0xd50f('0x25')]);_0x3b37c9[_0xd50f('0x23')]=qs[_0xd50f('0x23')](_0x4ea762[_0xd50f('0x5a')][_0xd50f('0x23')]);}return _0x27cd5b['getAgents'](_0x3b37c9);}})[_0xd50f('0x29')](function(_0x398362){if(_0x398362){return _0x398362?{'count':_0x42ef15,'rows':_0x398362}:null;}})['then'](respondWithResult(_0x2c04ed,null))[_0xd50f('0x1f')](handleError(_0x2c04ed,null));}; \ No newline at end of file +var _0xfa8f=['queueId','waitForTheAssignedQueue','startRouting','EventManager','offline','files','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','findAll','getProactiveActions','virtual','custom','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','origin','3.5.0','remote','stringify','headers','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APINotFoundError','handleError','../../mysqldb','redis','defaults','client','http','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','get','ChatWebsites','UserProfileResource','stack','name','Command','getSnippet','format','iftime\x20%s,%s','interval','timezone','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','all','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','version','unknown','%s\x20%s','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','params','intersection','length','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','file','addAvatar','addCustomerAvatar','customerAvatar','systemAvatar','filename','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','priority','asc','mapKey','threadId','externalUrl','ContactId','interaction','ChatInteraction','contact','firstName','messageId','created','autoclose','push','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xfa8f,0x68));var _0xffa8=function(_0x384b42,_0xb38d0e){_0x384b42=_0x384b42-0x0;var _0x30247b=_0xfa8f[_0x384b42];return _0x30247b;};'use strict';var Mustache=require('mustache');var util=require(_0xffa8('0x0'));var path=require(_0xffa8('0x1'));var ejs=require(_0xffa8('0x2'));var fs=require('fs');var fs_extra=require(_0xffa8('0x3'));var _=require(_0xffa8('0x4'));var querystring=require(_0xffa8('0x5'));var htmlToText=require(_0xffa8('0x6'));var Redis=require(_0xffa8('0x7'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xffa8('0x8'));var logger=require(_0xffa8('0x9'))(_0xffa8('0xa'));var config=require(_0xffa8('0xb'));var APIOutOfIntervalError=require(_0xffa8('0xc'))['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')[_0xffa8('0xd')];var APIHandleError=require('../../errors/api')[_0xffa8('0xe')];var db=require(_0xffa8('0xf'))['db'];config[_0xffa8('0x10')]=_[_0xffa8('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0xffa8('0x12')][_0xffa8('0x13')]({'port':0x232c});var client9002=jayson[_0xffa8('0x12')][_0xffa8('0x13')]({'port':0x232a});var client9003=jayson['client'][_0xffa8('0x13')]({'port':0x232b});var client9001=jayson[_0xffa8('0x12')][_0xffa8('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x4de1e5,_0x10d842,_0x6a9c41,_0x16dbaf){return new Promise(function(_0x168acc,_0x317a4b){var _0xe31b14=_0x16dbaf||client;return _0xe31b14['request'](_0x4de1e5,_0x6a9c41)[_0xffa8('0x14')](function(_0x440948){logger[_0xffa8('0x15')](_0xffa8('0x16'),_0x10d842,'request\x20sent');logger['debug'](_0xffa8('0x17'),_0x10d842,_0xffa8('0x18'),JSON['stringify'](_0x440948));if(_0x440948[_0xffa8('0x19')]){if(_0x440948[_0xffa8('0x19')][_0xffa8('0x1a')]===0x1f4){logger[_0xffa8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x10d842,_0x440948[_0xffa8('0x19')][_0xffa8('0x1b')]);return _0x317a4b(_0x440948['error'][_0xffa8('0x1b')]);}logger[_0xffa8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x10d842,_0x440948[_0xffa8('0x19')][_0xffa8('0x1b')]);return _0x168acc(_0x440948['error'][_0xffa8('0x1b')]);}else{logger[_0xffa8('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x10d842,_0xffa8('0x18'));_0x168acc(_0x440948[_0xffa8('0x1c')][_0xffa8('0x1b')]);}})[_0xffa8('0x1d')](function(_0x51100a){logger[_0xffa8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x10d842,_0x51100a);_0x317a4b(_0x51100a);});});}function respondWithStatusCode(_0x4cbf72,_0x52c07e){_0x52c07e=_0x52c07e||0xcc;return function(_0x1bb2da){if(_0x1bb2da){return _0x4cbf72[_0xffa8('0x1e')](_0x52c07e);}return _0x4cbf72[_0xffa8('0x1f')](_0x52c07e)[_0xffa8('0x20')]();};}function respondWithResult(_0x56e262,_0x33c321){_0x33c321=_0x33c321||0xc8;return function(_0x4c5c2d){if(_0x4c5c2d){return _0x56e262[_0xffa8('0x1f')](_0x33c321)[_0xffa8('0x21')](_0x4c5c2d);}};}function respondWithFilteredResult(_0x1259f5,_0x81a76){return function(_0x3c3483){if(_0x3c3483){var _0xa5879f=typeof _0x81a76[_0xffa8('0x22')]===_0xffa8('0x23')&&typeof _0x81a76[_0xffa8('0x24')]==='undefined';var _0x5dcd02=_0x3c3483[_0xffa8('0x25')];var _0x1d4cb8=_0xa5879f?0x0:_0x81a76[_0xffa8('0x22')];var _0xace915=_0xa5879f?_0x3c3483[_0xffa8('0x25')]:_0x81a76[_0xffa8('0x22')]+_0x81a76[_0xffa8('0x24')];var _0x5ad27b;if(_0xace915>=_0x5dcd02){_0xace915=_0x5dcd02;_0x5ad27b=0xc8;}else{_0x5ad27b=0xce;}_0x1259f5[_0xffa8('0x1f')](_0x5ad27b);return _0x1259f5[_0xffa8('0x26')](_0xffa8('0x27'),_0x1d4cb8+'-'+_0xace915+'/'+_0x5dcd02)[_0xffa8('0x21')](_0x3c3483);}return null;};}function saveUpdates(_0x50447e){return function(_0x5bfead){if(_0x5bfead){return _0x5bfead['update'](_0x50447e)[_0xffa8('0x14')](function(_0x3e96cc){return _0x3e96cc;});}return null;};}function removeEntity(_0x624bbd){return function(_0x5c0844){if(_0x5c0844){return _0x5c0844['destroy']()[_0xffa8('0x14')](function(){var _0x592cc2=_0x5c0844[_0xffa8('0x28')]({'plain':!![]});var _0x169bc5=_0xffa8('0x29');return db[_0xffa8('0x2a')]['destroy']({'where':{'type':_0x169bc5,'resourceId':_0x592cc2['id']}})['then'](function(){return _0x5c0844;});})[_0xffa8('0x14')](function(){_0x624bbd[_0xffa8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0047){return function(_0x135121){if(!_0x135121){_0x3f0047[_0xffa8('0x1e')](0x194);}return _0x135121;};}function handleError(_0x1f1bf4,_0x3a40b3){_0x3a40b3=_0x3a40b3||0x1f4;return function(_0x528652){logger[_0xffa8('0x19')](_0x528652[_0xffa8('0x2b')]);if(_0x528652[_0xffa8('0x2c')]){delete _0x528652[_0xffa8('0x2c')];}_0x1f1bf4[_0xffa8('0x1f')](_0x3a40b3)['send'](_0x528652);};}function iftimePromise(_0x13106c,_0x55f5fa){return respondWithRpcPromise(_0xffa8('0x2d'),_0xffa8('0x2e'),{'command':_0x55f5fa['timezone']?util[_0xffa8('0x2f')](_0xffa8('0x30'),_0x13106c[_0xffa8('0x31')],_0x55f5fa[_0xffa8('0x32')]):util['format']('iftime\x20%s',_0x13106c[_0xffa8('0x31')])},client9002)[_0xffa8('0x14')](function(_0x59b8bc){var _0x421bc2=_0x59b8bc&&_0x59b8bc[_0xffa8('0x33')]('true')>=0x0?!![]:![];logger[_0xffa8('0x15')](_0xffa8('0x34'),_0x55f5fa['id'],_0x13106c['id'],_0x13106c[_0xffa8('0x31')],_0x421bc2?_0xffa8('0x35'):_0xffa8('0x36'),_0x55f5fa[_0xffa8('0x32')]?_0x55f5fa[_0xffa8('0x32')]:_0xffa8('0x37'));return _0x421bc2;})['catch'](function(_0x3b980c){logger[_0xffa8('0x19')](_0xffa8('0x34'),_0x55f5fa['id'],_0x13106c['id'],_0x13106c[_0xffa8('0x31')],util['inspect'](_0x3b980c,{'showHidden':![],'depth':null}),_0x55f5fa[_0xffa8('0x32')]?_0x55f5fa['timezone']:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x29cc68){var _0xe380e7=_[_0xffa8('0x38')](_0x29cc68[_0xffa8('0x39')]['Intervals'],function(_0x1fbe3b){var _0x1bbcb4=_0x1fbe3b['get']({'plain':!![]});return iftimePromise(_0x1bbcb4,_0x29cc68);});return Promise[_0xffa8('0x3a')](_0xe380e7)['then'](function(_0x3a6c79){return _['some'](_0x3a6c79);});}function createInteractionObject(_0x27d8cd,_0x1791f0,_0x499401,_0x178153){var _0x54d873=require(_0xffa8('0x3b'));var _0x2fa004=new _0x54d873();var _0x4e9a14=_0x2fa004[_0xffa8('0x3c')](_0x499401['user-agent'])[_0xffa8('0x3d')]();var _0x46028a=_0x1791f0['customerIp'];if(_0x499401[_0xffa8('0x3e')]){_0x46028a=_0x499401[_0xffa8('0x3e')];}else if(_0x499401[_0xffa8('0x3f')]){_0x46028a=_['first'](_0x499401[_0xffa8('0x3f')][_0xffa8('0x40')](','));}return{'ContactId':_0x178153['id'],'ChatWebsiteId':_0x27d8cd,'from':(_0x178153['firstName']||'')+'\x20'+(_0x178153[_0xffa8('0x41')]||''),'customerIp':_0x46028a,'customerPort':_0x499401['x-real-port']?_0x499401[_0xffa8('0x42')]:null,'referer':_0x1791f0['referer'],'browserName':_0x4e9a14[_0xffa8('0x43')][_0xffa8('0x2c')]&&_0x4e9a14['browser']['version']?util[_0xffa8('0x2f')]('%s\x20%s',_0x4e9a14[_0xffa8('0x43')][_0xffa8('0x2c')],_0x4e9a14[_0xffa8('0x43')][_0xffa8('0x44')]):_0xffa8('0x45'),'browserVersion':_0x4e9a14[_0xffa8('0x43')][_0xffa8('0x44')]||_0xffa8('0x45'),'osName':util[_0xffa8('0x2f')](_0xffa8('0x46'),_0x4e9a14['os'][_0xffa8('0x2c')],_0x4e9a14['os']['version']),'osVersion':_0x4e9a14['os']['version'],'deviceModel':_0x4e9a14[_0xffa8('0x47')][_0xffa8('0x48')]&&_0x4e9a14[_0xffa8('0x47')][_0xffa8('0x49')]?util[_0xffa8('0x2f')](_0xffa8('0x4a'),_0x4e9a14['device'][_0xffa8('0x48')],_0x4e9a14[_0xffa8('0x47')][_0xffa8('0x49')],_0x4e9a14[_0xffa8('0x47')][_0xffa8('0x4b')]):null,'deviceVendor':_0x4e9a14['device'][_0xffa8('0x49')],'deviceType':_0x4e9a14['device'][_0xffa8('0x4b')],'formData':JSON['stringify'](_0x1791f0)};}exports[_0xffa8('0x4c')]=function(_0x3a354b,_0x4f065d){var _0x15825b={'include':[{'model':db[_0xffa8('0x4d')],'as':_0xffa8('0x4e')}]},_0xd872a9={},_0x27987f={'count':0x0,'rows':[]};var _0x4241f6=_[_0xffa8('0x38')](db[_0xffa8('0x4f')][_0xffa8('0x50')],function(_0x5b80bf){return{'name':_0x5b80bf[_0xffa8('0x51')],'type':_0x5b80bf[_0xffa8('0x4b')][_0xffa8('0x52')]};});_0xd872a9['model']=_[_0xffa8('0x38')](_0x4241f6,_0xffa8('0x2c'));_0xd872a9[_0xffa8('0x53')]=_[_0xffa8('0x54')](_0x3a354b[_0xffa8('0x53')]);_0xd872a9['filters']=_['intersection'](_0xd872a9['model'],_0xd872a9[_0xffa8('0x53')]);_0x15825b[_0xffa8('0x55')]=_['intersection'](_0xd872a9['model'],qs[_0xffa8('0x56')](_0x3a354b[_0xffa8('0x53')][_0xffa8('0x56')]));_0x15825b['attributes']=_0x15825b[_0xffa8('0x55')]['length']?_0x15825b[_0xffa8('0x55')]:_0xd872a9[_0xffa8('0x48')];if(!_0x3a354b['query'][_0xffa8('0x57')](_0xffa8('0x58'))){_0x15825b[_0xffa8('0x24')]=qs[_0xffa8('0x24')](_0x3a354b[_0xffa8('0x53')][_0xffa8('0x24')]);_0x15825b[_0xffa8('0x22')]=qs[_0xffa8('0x22')](_0x3a354b[_0xffa8('0x53')][_0xffa8('0x22')]);}_0x15825b[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x3a354b[_0xffa8('0x53')]['sort']);_0x15825b[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x3a354b[_0xffa8('0x53')],_0xd872a9['filters']),_0x4241f6);if(_0x3a354b[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x15825b['where']=_[_0xffa8('0x5f')](_0x15825b['where'],{'$or':_['map'](_0x4241f6,function(_0x5f2b69){if(_0x5f2b69[_0xffa8('0x4b')]!=='VIRTUAL'){var _0x1f2dae={};_0x1f2dae[_0x5f2b69[_0xffa8('0x2c')]]={'$like':'%'+_0x3a354b['query'][_0xffa8('0x5e')]+'%'};return _0x1f2dae;}})});}_0x15825b=_['merge']({},_0x15825b,_0x3a354b['options']);var _0x1ad0a5={'where':_0x15825b[_0xffa8('0x5b')]};return db[_0xffa8('0x4f')]['count'](_0x1ad0a5)[_0xffa8('0x14')](function(_0x30c2a4){_0x27987f['count']=_0x30c2a4;if(_0x3a354b[_0xffa8('0x53')][_0xffa8('0x60')]){_0x15825b[_0xffa8('0x61')]=[{'all':!![]}];}return db[_0xffa8('0x4f')]['findAll'](_0x15825b);})[_0xffa8('0x14')](function(_0x332e81){_0x27987f[_0xffa8('0x62')]=_0x332e81;return _0x27987f;})['then'](respondWithFilteredResult(_0x4f065d,_0x15825b))['catch'](handleError(_0x4f065d,null));};exports['show']=function(_0x2112f8,_0x5f451f){var _0x101f92={'raw':![],'where':{'id':_0x2112f8[_0xffa8('0x63')]['id']},'include':[{'model':db[_0xffa8('0x4d')],'as':'mandatoryDispositionPause'}]},_0x41fa32={};_0x41fa32[_0xffa8('0x48')]=_['keys'](db['ChatWebsite'][_0xffa8('0x50')]);_0x41fa32['query']=_['keys'](_0x2112f8['query']);_0x41fa32[_0xffa8('0x5c')]=_[_0xffa8('0x64')](_0x41fa32['model'],_0x41fa32[_0xffa8('0x53')]);_0x101f92[_0xffa8('0x55')]=_['intersection'](_0x41fa32[_0xffa8('0x48')],qs[_0xffa8('0x56')](_0x2112f8[_0xffa8('0x53')]['fields']));_0x101f92[_0xffa8('0x55')]=_0x101f92[_0xffa8('0x55')][_0xffa8('0x65')]?_0x101f92[_0xffa8('0x55')]:_0x41fa32['model'];if(_0x2112f8[_0xffa8('0x53')][_0xffa8('0x60')]){_0x101f92[_0xffa8('0x61')]=[{'all':!![]}];}_0x101f92=_[_0xffa8('0x5f')]({},_0x101f92,_0x2112f8[_0xffa8('0x66')]);return db[_0xffa8('0x4f')][_0xffa8('0x67')](_0x101f92)[_0xffa8('0x14')](handleEntityNotFound(_0x5f451f,null))['then'](respondWithResult(_0x5f451f,null))[_0xffa8('0x1d')](handleError(_0x5f451f,null));};exports[_0xffa8('0x68')]=function(_0x39938f,_0x32cb74){return db[_0xffa8('0x4f')][_0xffa8('0x68')](_0x39938f[_0xffa8('0x69')],{})['then'](function(_0x1df7c6){var _0xf3d0ae=_0x39938f[_0xffa8('0x6a')][_0xffa8('0x28')]({'plain':!![]});if(!_0xf3d0ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf3d0ae[_0xffa8('0x6b')]===_0xffa8('0x6a')){var _0x4a2aae=_0x1df7c6['get']({'plain':!![]});var _0x26eab6=_0xffa8('0x29');return db['UserProfileSection'][_0xffa8('0x67')]({'where':{'name':_0x26eab6,'userProfileId':_0xf3d0ae[_0xffa8('0x6c')]},'raw':!![]})[_0xffa8('0x14')](function(_0x1d2814){if(_0x1d2814&&_0x1d2814[_0xffa8('0x6d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a2aae[_0xffa8('0x2c')],'resourceId':_0x4a2aae['id'],'type':_0x1d2814[_0xffa8('0x2c')],'sectionId':_0x1d2814['id']},{})[_0xffa8('0x14')](function(){return _0x1df7c6;});}else{return _0x1df7c6;}})[_0xffa8('0x1d')](function(_0x56bf66){logger[_0xffa8('0x19')](_0xffa8('0x6e'),_0x56bf66);throw _0x56bf66;});}return _0x1df7c6;})[_0xffa8('0x14')](respondWithResult(_0x32cb74,0xc9))[_0xffa8('0x1d')](handleError(_0x32cb74,null));};exports[_0xffa8('0x6f')]=function(_0xff793b,_0xc60254){if(_0xff793b[_0xffa8('0x69')]['id']){delete _0xff793b[_0xffa8('0x69')]['id'];}return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0xff793b[_0xffa8('0x63')]['id']},'include':[{'model':db[_0xffa8('0x4d')],'as':_0xffa8('0x4e')}]})['then'](handleEntityNotFound(_0xc60254,null))['then'](saveUpdates(_0xff793b[_0xffa8('0x69')],null))[_0xffa8('0x14')](respondWithResult(_0xc60254,null))['catch'](handleError(_0xc60254,null));};exports[_0xffa8('0x70')]=function(_0x812177,_0x422684){return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x812177[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x422684,null))[_0xffa8('0x14')](removeEntity(_0x422684,null))['catch'](handleError(_0x422684,null));};exports['describe']=function(_0x4ce344,_0x251dbb){return db['ChatWebsite'][_0xffa8('0x71')]()[_0xffa8('0x14')](respondWithResult(_0x251dbb,null))[_0xffa8('0x1d')](handleError(_0x251dbb,null));};exports['addDisposition']=function(_0x4933c7,_0x525cb2){if(_0x4933c7['body']['id']){delete _0x4933c7['body']['id'];}return db[_0xffa8('0x4f')]['find']({'where':{'id':_0x4933c7['params']['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x525cb2,null))[_0xffa8('0x14')](function(_0x36ac05){if(_0x36ac05){_0x4933c7['body'][_0xffa8('0x72')]=_0x36ac05['id'];return db[_0xffa8('0x73')][_0xffa8('0x68')](_0x4933c7[_0xffa8('0x69')]);}})[_0xffa8('0x14')](respondWithResult(_0x525cb2,null))['catch'](handleError(_0x525cb2,null));};exports[_0xffa8('0x74')]=function(_0x2e937c,_0x38f40c){var _0x572deb={'raw':![],'where':{}};var _0x14a61={};var _0x23903f={'count':0x0,'rows':[]};return db[_0xffa8('0x4f')][_0xffa8('0x75')]({'where':{'id':_0x2e937c[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x38f40c,null))[_0xffa8('0x14')](function(_0x37be87){if(_0x37be87){_0x14a61[_0xffa8('0x48')]=_['keys'](db[_0xffa8('0x73')]['rawAttributes']);_0x14a61[_0xffa8('0x53')]=_[_0xffa8('0x54')](_0x2e937c[_0xffa8('0x53')]);_0x14a61[_0xffa8('0x5c')]=_[_0xffa8('0x64')](_0x14a61[_0xffa8('0x48')],_0x14a61['query']);_0x572deb[_0xffa8('0x55')]=_['intersection'](_0x14a61[_0xffa8('0x48')],qs['fields'](_0x2e937c[_0xffa8('0x53')][_0xffa8('0x56')]));_0x572deb[_0xffa8('0x55')]=_0x572deb['attributes'][_0xffa8('0x65')]?_0x572deb['attributes']:_0x14a61[_0xffa8('0x48')];if(!_0x2e937c[_0xffa8('0x53')][_0xffa8('0x57')]('nolimit')){_0x572deb['limit']=qs['limit'](_0x2e937c[_0xffa8('0x53')][_0xffa8('0x24')]);_0x572deb[_0xffa8('0x22')]=qs['offset'](_0x2e937c[_0xffa8('0x53')][_0xffa8('0x22')]);}_0x572deb[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x2e937c[_0xffa8('0x53')][_0xffa8('0x5a')]);_0x572deb[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x2e937c[_0xffa8('0x53')],_0x14a61[_0xffa8('0x5c')]));_0x572deb[_0xffa8('0x5b')][_0xffa8('0x72')]=_0x37be87['id'];if(_0x2e937c[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x572deb[_0xffa8('0x5b')]=_[_0xffa8('0x5f')](_0x572deb[_0xffa8('0x5b')],{'$or':_[_0xffa8('0x38')](_0x572deb[_0xffa8('0x55')],function(_0x19d5e9){var _0x28a965={};_0x28a965[_0x19d5e9]={'$like':'%'+_0x2e937c[_0xffa8('0x53')]['filter']+'%'};return _0x28a965;})});}_0x572deb=_[_0xffa8('0x5f')]({},_0x572deb,_0x2e937c['options']);return db[_0xffa8('0x73')][_0xffa8('0x25')]({'where':_0x572deb[_0xffa8('0x5b')]})[_0xffa8('0x14')](function(_0x51e507){_0x23903f['count']=_0x51e507;if(_0x2e937c[_0xffa8('0x53')][_0xffa8('0x60')]){_0x572deb['include']=[{'all':!![]}];}return db[_0xffa8('0x73')]['findAll'](_0x572deb);})['then'](function(_0x779114){_0x23903f[_0xffa8('0x62')]=_0x779114;return _0x23903f;});}})['then'](respondWithFilteredResult(_0x38f40c,_0x572deb))[_0xffa8('0x1d')](handleError(_0x38f40c,null));};exports[_0xffa8('0x76')]=function(_0x334f3e,_0x2e4baf){return db[_0xffa8('0x4f')]['find']({'where':{'id':_0x334f3e['params']['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x2e4baf,null))['then'](function(_0x38213f){if(_0x38213f){return _0x38213f['removeDispositions'](_0x334f3e[_0xffa8('0x53')][_0xffa8('0x77')]);}})[_0xffa8('0x14')](respondWithStatusCode(_0x2e4baf,null))[_0xffa8('0x1d')](handleError(_0x2e4baf,null));};exports['addAnswer']=function(_0x3270db,_0x1920f1){if(_0x3270db[_0xffa8('0x69')]['id']){delete _0x3270db[_0xffa8('0x69')]['id'];}return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x3270db[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x1920f1,null))[_0xffa8('0x14')](function(_0x5caf57){if(_0x5caf57){_0x3270db[_0xffa8('0x69')][_0xffa8('0x72')]=_0x5caf57['id'];return db[_0xffa8('0x78')][_0xffa8('0x68')](_0x3270db[_0xffa8('0x69')]);}})[_0xffa8('0x14')](respondWithResult(_0x1920f1,null))[_0xffa8('0x1d')](handleError(_0x1920f1,null));};exports[_0xffa8('0x79')]=function(_0x16e5a7,_0x58ddde){var _0x232497={'raw':![],'where':{}};var _0x236e3a={};var _0x1e5ea1={'count':0x0,'rows':[]};return db[_0xffa8('0x4f')][_0xffa8('0x75')]({'where':{'id':_0x16e5a7[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x58ddde,null))['then'](function(_0x4b0124){if(_0x4b0124){_0x236e3a[_0xffa8('0x48')]=_[_0xffa8('0x54')](db[_0xffa8('0x78')][_0xffa8('0x50')]);_0x236e3a['query']=_[_0xffa8('0x54')](_0x16e5a7['query']);_0x236e3a[_0xffa8('0x5c')]=_['intersection'](_0x236e3a[_0xffa8('0x48')],_0x236e3a[_0xffa8('0x53')]);_0x232497[_0xffa8('0x55')]=_[_0xffa8('0x64')](_0x236e3a['model'],qs['fields'](_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x56')]));_0x232497[_0xffa8('0x55')]=_0x232497[_0xffa8('0x55')][_0xffa8('0x65')]?_0x232497[_0xffa8('0x55')]:_0x236e3a[_0xffa8('0x48')];if(!_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x57')]('nolimit')){_0x232497[_0xffa8('0x24')]=qs[_0xffa8('0x24')](_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x24')]);_0x232497['offset']=qs['offset'](_0x16e5a7['query'][_0xffa8('0x22')]);}_0x232497[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x5a')]);_0x232497[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x16e5a7[_0xffa8('0x53')],_0x236e3a[_0xffa8('0x5c')]));_0x232497[_0xffa8('0x5b')][_0xffa8('0x72')]=_0x4b0124['id'];if(_0x16e5a7['query']['filter']){_0x232497[_0xffa8('0x5b')]=_[_0xffa8('0x5f')](_0x232497[_0xffa8('0x5b')],{'$or':_[_0xffa8('0x38')](_0x232497[_0xffa8('0x55')],function(_0x129945){var _0x50b3ed={};_0x50b3ed[_0x129945]={'$like':'%'+_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x5e')]+'%'};return _0x50b3ed;})});}_0x232497=_[_0xffa8('0x5f')]({},_0x232497,_0x16e5a7[_0xffa8('0x66')]);return db[_0xffa8('0x78')][_0xffa8('0x25')]({'where':_0x232497[_0xffa8('0x5b')]})[_0xffa8('0x14')](function(_0x356cd9){_0x1e5ea1['count']=_0x356cd9;if(_0x16e5a7[_0xffa8('0x53')][_0xffa8('0x60')]){_0x232497['include']=[{'all':!![]}];}return db[_0xffa8('0x78')]['findAll'](_0x232497);})['then'](function(_0x255448){_0x1e5ea1[_0xffa8('0x62')]=_0x255448;return _0x1e5ea1;});}})[_0xffa8('0x14')](respondWithFilteredResult(_0x58ddde,_0x232497))[_0xffa8('0x1d')](handleError(_0x58ddde,null));};exports[_0xffa8('0x7a')]=function(_0x214fb7,_0xca277e){return db['ChatWebsite'][_0xffa8('0x67')]({'where':{'id':_0x214fb7[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0xca277e,null))[_0xffa8('0x14')](function(_0x23161f){if(_0x23161f){return _0x23161f[_0xffa8('0x7a')](_0x214fb7[_0xffa8('0x53')][_0xffa8('0x77')]);}})[_0xffa8('0x14')](respondWithStatusCode(_0xca277e,null))[_0xffa8('0x1d')](handleError(_0xca277e,null));};exports['addLogo']=function(_0x121309,_0x55f0a6){_0x121309[_0xffa8('0x69')]['sitepic']=_0x121309[_0xffa8('0x7b')]['filename'];return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x121309[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x55f0a6,null))[_0xffa8('0x14')](saveUpdates(_0x121309[_0xffa8('0x69')],null))[_0xffa8('0x14')](respondWithResult(_0x55f0a6,null))[_0xffa8('0x1d')](handleError(_0x55f0a6,null));};exports[_0xffa8('0x7c')]=function(_0x239263,_0x1af22d){_0x239263['body']['agentAvatar']=_0x239263['file']['filename'];return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x239263[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x1af22d,null))[_0xffa8('0x14')](saveUpdates(_0x239263[_0xffa8('0x69')],null))['then'](respondWithResult(_0x1af22d,null))[_0xffa8('0x1d')](handleError(_0x1af22d,null));};exports[_0xffa8('0x7d')]=function(_0x1b33bd,_0xbb74ac){_0x1b33bd['body'][_0xffa8('0x7e')]=_0x1b33bd['file']['filename'];return db[_0xffa8('0x4f')]['find']({'where':{'id':_0x1b33bd[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0xbb74ac,null))[_0xffa8('0x14')](saveUpdates(_0x1b33bd[_0xffa8('0x69')],null))[_0xffa8('0x14')](respondWithResult(_0xbb74ac,null))[_0xffa8('0x1d')](handleError(_0xbb74ac,null));};exports['addSystemAvatar']=function(_0x1f6e46,_0x44b62a){_0x1f6e46[_0xffa8('0x69')][_0xffa8('0x7f')]=_0x1f6e46[_0xffa8('0x7b')][_0xffa8('0x80')];return db[_0xffa8('0x4f')]['find']({'where':{'id':_0x1f6e46[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x44b62a,null))[_0xffa8('0x14')](saveUpdates(_0x1f6e46[_0xffa8('0x69')],null))['then'](respondWithResult(_0x44b62a,null))[_0xffa8('0x1d')](handleError(_0x44b62a,null));};exports['getLogo']=function(_0x1e6c38,_0x4d1219){var _0x4d4f27=path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x83'));var _0xd9eeaa={'where':{'id':_0x1e6c38[_0xffa8('0x63')]['id']},'attributes':['id',_0xffa8('0x84')],'raw':!![]};var _0xf7b3ec=![];return require(_0xffa8('0x85'))[_0xffa8('0x86')]()[_0xffa8('0x14')](function(_0x3f7b73){if(_0x3f7b73){_0xf7b3ec=_0x3f7b73['custom'];}})[_0xffa8('0x14')](function(){return db[_0xffa8('0x4f')][_0xffa8('0x67')](_0xd9eeaa);})[_0xffa8('0x14')](handleEntityNotFound(_0x4d1219,null))['then'](function(_0x785bec){if(_0x785bec){if(!_[_0xffa8('0x87')](_0x785bec[_0xffa8('0x84')])){if(fs[_0xffa8('0x88')](path['join'](config[_0xffa8('0x82')],_0xffa8('0x89'),_0x785bec[_0xffa8('0x84')]))&&_0xf7b3ec){_0x4d4f27=path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x89'),_0x785bec[_0xffa8('0x84')]);}}return _0x4d1219[_0xffa8('0x8a')](_0x4d4f27);}})[_0xffa8('0x1d')](handleError(_0x4d1219,null));};exports['getAvatar']=function(_0x523449,_0xcd81ad){var _0x29e67d=path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x8b'));var _0x72a58a={'where':{'id':_0x523449['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xffa8('0x4f')][_0xffa8('0x67')](_0x72a58a)['then'](handleEntityNotFound(_0xcd81ad,null))['then'](function(_0x393b30){if(_0x393b30){if(!_[_0xffa8('0x87')](_0x393b30[_0xffa8('0x8c')])){if(fs[_0xffa8('0x88')](path['join'](config[_0xffa8('0x82')],_0xffa8('0x8d'),_0x393b30[_0xffa8('0x8c')]))){_0x29e67d=path[_0xffa8('0x81')](config['root'],_0xffa8('0x8d'),_0x393b30['agentAvatar']);}}return _0xcd81ad['download'](_0x29e67d);}})[_0xffa8('0x1d')](handleError(_0xcd81ad,null));};exports['getCustomerAvatar']=function(_0x50a66a,_0x5102fb){var _0x33ee8b=path[_0xffa8('0x81')](config['root'],_0xffa8('0x8e'));var _0xe3d4fb={'where':{'id':_0x50a66a['params']['id']},'attributes':['id',_0xffa8('0x7e'),_0xffa8('0x8f')],'raw':!![]};return db[_0xffa8('0x4f')][_0xffa8('0x67')](_0xe3d4fb)[_0xffa8('0x14')](handleEntityNotFound(_0x5102fb,null))['then'](function(_0x148ad2){if(_0x148ad2){if(!_[_0xffa8('0x87')](_0x148ad2[_0xffa8('0x7e')])){if(fs[_0xffa8('0x88')](path['join'](config['root'],_0xffa8('0x8d'),_0x148ad2[_0xffa8('0x7e')]))&&_0x148ad2[_0xffa8('0x8f')]){_0x33ee8b=path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x8d'),_0x148ad2[_0xffa8('0x7e')]);}}return _0x5102fb[_0xffa8('0x8a')](_0x33ee8b);}})[_0xffa8('0x1d')](handleError(_0x5102fb,null));};exports[_0xffa8('0x90')]=function(_0x29d1c0,_0x1c722e){var _0x17eb1a=path['join'](config[_0xffa8('0x82')],_0xffa8('0x91'));var _0x992ad9={'where':{'id':_0x29d1c0['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xffa8('0x4f')][_0xffa8('0x67')](_0x992ad9)[_0xffa8('0x14')](handleEntityNotFound(_0x1c722e,null))[_0xffa8('0x14')](function(_0x120b01){if(_0x120b01){if(!_[_0xffa8('0x87')](_0x120b01[_0xffa8('0x7f')])){if(fs['existsSync'](path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x8d'),_0x120b01[_0xffa8('0x7f')]))){_0x17eb1a=path['join'](config[_0xffa8('0x82')],_0xffa8('0x8d'),_0x120b01['systemAvatar']);}}return _0x1c722e['download'](_0x17eb1a);}})['catch'](handleError(_0x1c722e,null));};exports[_0xffa8('0x92')]=function(_0x166a95,_0x2426e2){var _0x4ee8aa={'body':_0x166a95[_0xffa8('0x69')],'channel':_0xffa8('0x93')};var _0x1cb4f9=[];var _0x3631af=[];var _0xf86c0e={};var _0x27ca1a=![];return db[_0xffa8('0x94')][_0xffa8('0x71')]()[_0xffa8('0x14')](function(_0x1ce7f8){if(!_0x1ce7f8){throw new db['Sequelize'][(_0xffa8('0x95'))](_0xffa8('0x96'));}_0x1cb4f9=_['difference'](_['keys'](_0x1ce7f8),[_0xffa8('0x97'),'updatedAt']);_0x3631af=_[_0xffa8('0x98')](_[_0xffa8('0x54')](_0x1ce7f8),[_0xffa8('0x97'),_0xffa8('0x99'),_0xffa8('0x9a'),_0xffa8('0x9b')]);if(_0x166a95[_0xffa8('0x69')]['id']){delete _0x166a95['body']['id'];}if(_[_0xffa8('0x87')](_0x166a95[_0xffa8('0x69')]['from'])){throw new db[(_0xffa8('0x9c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xffa8('0x87')](_0x166a95[_0xffa8('0x69')][_0xffa8('0x69')])||_0x166a95['body'][_0xffa8('0x69')]===''){throw new db[(_0xffa8('0x9c'))]['ValidationError'](_0xffa8('0x9d'));}if(_['isNil'](_0x166a95[_0xffa8('0x69')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xffa8('0x9e')+_0x3631af);}if(!_[_0xffa8('0x9f')](_0x3631af,_0x166a95[_0xffa8('0x69')]['mapKey'])){throw new db[(_0xffa8('0x9c'))][(_0xffa8('0x95'))](_0xffa8('0xa0')+_0x3631af);}_0xf86c0e[_0x166a95[_0xffa8('0x69')]['mapKey']]=_0x166a95[_0xffa8('0x69')][_0xffa8('0xa1')];})[_0xffa8('0x14')](function(){return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x166a95[_0xffa8('0x63')]['id']},'include':[{'model':db[_0xffa8('0xa2')],'as':_0xffa8('0xa3'),'include':[{'model':db['CmContact'],'as':_0xffa8('0xa4'),'where':_0xf86c0e,'limit':0x1,'order':[[_0xffa8('0x99'),_0xffa8('0xa5')]]}]},{'model':db[_0xffa8('0xa6')],'as':_0xffa8('0xa7')},{'model':db[_0xffa8('0x39')],'as':_0xffa8('0x39'),'include':[{'model':db['Interval'],'as':_0xffa8('0xa8'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xffa8('0x14')](function(_0x3f0f82){if(!_0x3f0f82)throw new APINotFoundError(util[_0xffa8('0x2f')](_0xffa8('0xa9'),_0x166a95[_0xffa8('0x63')]['id']));if(!_0x3f0f82[_0xffa8('0x39')]||!_0x3f0f82[_0xffa8('0x39')][_0xffa8('0xa8')])return[_0x3f0f82,!![]];return[_0x3f0f82,checkWebsiteIntervals(_0x3f0f82)];})[_0xffa8('0xaa')](function(_0x5ac9e9,_0x2b1290){if(!_0x2b1290)throw new APIOutOfIntervalError();if(!_0x5ac9e9[_0xffa8('0xa3')])return;_0x4ee8aa[_0xffa8('0xab')]=_0x5ac9e9;_0x4ee8aa[_0xffa8('0xac')]=_0x5ac9e9['List'];_0x4ee8aa[_0xffa8('0xad')]=_[_0xffa8('0xae')](_0x5ac9e9[_0xffa8('0xa7')],[_0xffa8('0xaf')],[_0xffa8('0xb0')]);if(_0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xa7')]){delete _0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xa7')];}if(_0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xa3')]&&_0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xa3')]['Contacts']['length']){return _0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xa3')][_0xffa8('0xa4')][0x0];}var _0x201493=_['defaults'](_0x166a95['body'],{'firstName':_0x166a95[_0xffa8('0x69')]['from'],'ListId':_0x5ac9e9[_0xffa8('0x9b')]});_0x201493[_0x166a95['body'][_0xffa8('0xb1')]]=_0x166a95['body']['from'];return db[_0xffa8('0x94')][_0xffa8('0x68')](_0x201493,{'fields':_0x1cb4f9,'raw':!![]});})[_0xffa8('0x14')](function(_0x54cb31){_0x4ee8aa['contact']=_0x54cb31;var _0x312171=createInteractionObject(_0x166a95[_0xffa8('0x63')]['id'],_0x166a95[_0xffa8('0x69')],_0x166a95['headers'],_0x54cb31);var _0x409d09={'ChatWebsiteId':_0x166a95[_0xffa8('0x63')]['id'],'closed':![]};if(_0x166a95['body']['threadId']){_0x409d09['threadId']=_0x166a95[_0xffa8('0x69')][_0xffa8('0xb2')];return db['ChatInteraction']['find']({'where':_0x409d09})[_0xffa8('0x14')](function(_0x505f45){if(_0x505f45){_0x27ca1a=!![];return _0x505f45;}_0x312171[_0xffa8('0xb2')]=_0x166a95['body'][_0xffa8('0xb2')];_0x312171[_0xffa8('0xb3')]=_0x166a95['body'][_0xffa8('0xb3')];return db['ChatInteraction'][_0xffa8('0x68')](_0x312171);});}_0x409d09[_0xffa8('0xb4')]=_0x54cb31['id'];if(_0x166a95[_0xffa8('0x69')][_0xffa8('0xb5')]&&_0x166a95['body'][_0xffa8('0xb5')]['id']){_0x409d09['id']=_0x166a95['body'][_0xffa8('0xb5')]['id'];return db[_0xffa8('0xb6')][_0xffa8('0x67')]({'where':_0x409d09})['then'](function(_0x581289){if(_0x581289){_0x27ca1a=!![];return _0x581289;}return db[_0xffa8('0xb6')]['create'](_0x312171);});}return db['ChatInteraction'][_0xffa8('0x68')](_0x312171);})[_0xffa8('0x14')](function(_0x14b36e){if(!_0x27ca1a)return _0x14b36e;var _0x4f0f96={'from':(_0x4ee8aa[_0xffa8('0xb7')][_0xffa8('0xb8')]||'')+'\x20'+(_0x4ee8aa[_0xffa8('0xb7')][_0xffa8('0x41')]||'')};if(_0x166a95['body'][_0xffa8('0xb2')]&&_0x166a95[_0xffa8('0x69')][_0xffa8('0xb9')]&&_0x166a95['body'][_0xffa8('0xb2')]!=_0x166a95[_0xffa8('0x69')][_0xffa8('0xb9')]){_0x4f0f96['threadId']=_0x166a95['body'][_0xffa8('0xb9')];}return _0x14b36e['update'](_0x4f0f96);})[_0xffa8('0x14')](function(_0x32f304){_0x4ee8aa[_0xffa8('0xb5')]=_0x32f304[_0xffa8('0x28')]({'plain':!![]});_0x4ee8aa['interaction'][_0xffa8('0xba')]=!_0x27ca1a;if(_0x4ee8aa['interaction'][_0xffa8('0xba')]){if(_0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xbb')]){_0x4ee8aa[_0xffa8('0xad')][_0xffa8('0xbc')]({'id':0x0,'priority':_0x4ee8aa[_0xffa8('0xad')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xffa8('0xbd')});}}return db[_0xffa8('0xbe')][_0xffa8('0x68')]({'body':_0x166a95['body']['body'],'ChatWebsiteId':_0x166a95['params']['id'],'ChatInteractionId':_0x32f304['id'],'direction':'in','ContactId':_0x4ee8aa[_0xffa8('0xb7')]['id'],'AttachmentId':_0x166a95[_0xffa8('0x69')]['AttachmentId']});})['then'](function(_0x58d5b7){_0x4ee8aa['message']=_0x58d5b7;if(!_0x4ee8aa[_0xffa8('0xb5')][_0xffa8('0xbf')]){return;}return db[_0xffa8('0xc0')]['find']({'attributes':['id',_0xffa8('0x2c')],'where':{'id':_0x4ee8aa['interaction'][_0xffa8('0xbf')]}});})[_0xffa8('0x14')](function(_0x3f1b4f){if(_0x3f1b4f){_0x4ee8aa[_0xffa8('0xad')][_0xffa8('0xc1')]({'id':0x0,'priority':0x0,'app':_0xffa8('0xc2'),'appdata':_0x3f1b4f[_0xffa8('0x2c')]+','+(_0x4ee8aa['account'][_0xffa8('0xc3')]||0xa),'interval':_0xffa8('0xbd')});_0x4ee8aa[_0xffa8('0xc4')]=!![];}if(!_0x4ee8aa[_0xffa8('0xb5')][_0xffa8('0xc5')]){return;}return db['ChatQueue']['find']({'attributes':['id',_0xffa8('0x2c')],'where':{'id':_0x4ee8aa['interaction'][_0xffa8('0xc5')]}});})[_0xffa8('0x14')](function(_0x19bd5d){if(_0x19bd5d){_0x4ee8aa[_0xffa8('0xad')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x19bd5d[_0xffa8('0x2c')]+','+(_0x4ee8aa[_0xffa8('0xab')][_0xffa8('0xc6')]||0x12c),'interval':_0xffa8('0xbd')});}return respondWithRpcPromise('Start',_0xffa8('0xc7'),_0x4ee8aa);})[_0xffa8('0x14')](function(_0x23bb6c){respondWithRpcPromise(_0xffa8('0xc8'),'EventManager',{'event':_0xffa8('0x92'),'message':_0x23bb6c},client9002);return _0x23bb6c;})[_0xffa8('0x14')](respondWithResult(_0x2426e2,null))['catch'](APIHandleError(_0x2426e2));};exports[_0xffa8('0xc9')]=function(_0x2f478c,_0x35e0c5){var _0x56818d,_0x165a43,_0x3d6067;var _0x31745c=[];var _0x7c695f={};var _0x453515=_0x2f478c[_0xffa8('0xca')]||[];var _0x3d1067=[];var _0xe975d4;return db[_0xffa8('0x94')][_0xffa8('0x71')]()[_0xffa8('0x14')](function(_0x5672b8){if(!_0x5672b8){throw new db['Sequelize']['ValidationError'](_0xffa8('0x96'));}_0x31745c=_[_0xffa8('0x98')](_[_0xffa8('0x54')](_0x5672b8),[_0xffa8('0x97'),'updatedAt',_0xffa8('0x9a'),_0xffa8('0x9b')]);if(_0x2f478c[_0xffa8('0x69')]['id']){delete _0x2f478c[_0xffa8('0x69')]['id'];}if(_[_0xffa8('0x87')](_0x2f478c['body'][_0xffa8('0xa1')])){throw _0x35e0c5[_0xffa8('0x1f')](0x1f4)[_0xffa8('0xcb')](new db[(_0xffa8('0x9c'))][(_0xffa8('0x95'))](_0xffa8('0xcc')));}if(_['isNil'](_0x2f478c['body'][_0xffa8('0x69')])||_0x2f478c[_0xffa8('0x69')][_0xffa8('0x69')]===''){throw _0x35e0c5[_0xffa8('0x1f')](0x1f4)[_0xffa8('0xcb')](new db[(_0xffa8('0x9c'))][(_0xffa8('0x95'))](_0xffa8('0x9d')));}if(_[_0xffa8('0x87')](_0x2f478c['body']['mapKeyOffline'])){throw _0x35e0c5[_0xffa8('0x1f')](0x1f4)[_0xffa8('0xcb')](new db[(_0xffa8('0x9c'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31745c));}if(!_[_0xffa8('0x9f')](_0x31745c,_0x2f478c['body'][_0xffa8('0xcd')])){throw _0x35e0c5[_0xffa8('0x1f')](0x1f4)[_0xffa8('0xcb')](new db[(_0xffa8('0x9c'))]['ValidationError'](_0xffa8('0xce')+_0x31745c));}_0x7c695f[_0x2f478c[_0xffa8('0x69')][_0xffa8('0xcd')]]=_0x2f478c[_0xffa8('0x69')][_0xffa8('0xa1')];})[_0xffa8('0x14')](function(){return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x2f478c['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xffa8('0xcf')],'as':_0xffa8('0xcf')}]});})[_0xffa8('0x14')](handleEntityNotFound(_0x35e0c5,null))[_0xffa8('0x14')](function(_0x4c158b){if(_0x4c158b&&_0x4c158b[_0xffa8('0xa3')]){_0x165a43=_0x4c158b;var _0x47fcb5=_[_0xffa8('0x11')](_0x2f478c[_0xffa8('0x69')],{'firstName':_0x2f478c[_0xffa8('0x69')][_0xffa8('0xa1')],'phone':_0x2f478c[_0xffa8('0x69')][_0xffa8('0xa1')],'ListId':_0x4c158b['ListId']});_0x47fcb5[_0x2f478c[_0xffa8('0x69')][_0xffa8('0xcd')]]=_0x2f478c['body'][_0xffa8('0xa1')];return db[_0xffa8('0x94')][_0xffa8('0xd0')]({'where':_0x7c695f,'defaults':_0x47fcb5});}})[_0xffa8('0xaa')](function(_0x2754d9){if(_0x2754d9){_0x3d6067=_0x2754d9;var _0x21b5f3=fs[_0xffa8('0xd1')](path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0xd2')),_0xffa8('0xd3'));var _0x7d6d85=ejs['render'](_0x21b5f3,{'body':_['toPairs'](_0x2f478c[_0xffa8('0x69')][_0xffa8('0x69')]),'bodyTitle':_0x165a43['offlineMessageBody']});return db[_0xffa8('0xd4')][_0xffa8('0x68')]({'body':_0x7d6d85,'plainBody':htmlToText[_0xffa8('0xd5')](_0x7d6d85),'ContactId':_0x2754d9['id'],'ChatWebsiteId':_0x165a43['id']});}})[_0xffa8('0x14')](function(_0x321a3f){_0xe975d4=_0x321a3f;if(_0x453515[_0xffa8('0x65')]){var _0x1fdf59=_0x453515[_0xffa8('0x38')](function(_0x44780d){return{'name':_0x44780d[_0xffa8('0xd6')],'basename':_0x44780d[_0xffa8('0x80')],'type':_0x44780d[_0xffa8('0xd7')],'ChatOfflineMessageId':_0x321a3f['id']};});_0x3d1067=_0x1fdf59[_0xffa8('0x38')](_0x46b811=>{var _0x45432f={'filename':_0x46b811[_0xffa8('0x2c')],'path':path['join'](config[_0xffa8('0x82')],'server',_0xffa8('0xca'),_0xffa8('0xd8'),_0xffa8('0xd9'),_0x46b811[_0xffa8('0xda')])};return _0x45432f;});if(!_0x165a43[_0xffa8('0xdb')]){return db['sequelize']['transaction'](function(_0x3f50c6){return db[_0xffa8('0xdc')][_0xffa8('0xdd')](_0x1fdf59,{'transaction':_0x3f50c6});});}}})[_0xffa8('0x14')](function(){if(_0xe975d4){_0x56818d=_0xe975d4;return db[_0xffa8('0xcf')][_0xffa8('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0xffa8('0xde')],'as':_0xffa8('0xdf'),'raw':!![],'include':[{'model':db[_0xffa8('0xe0')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xffa8('0x14')](function(_0x1f978c){if(_0x1f978c&&_0x1f978c[_0xffa8('0xdf')]&&_0x165a43['forwardOffline']&&_0x165a43[_0xffa8('0xe1')]){var _0x2e7e4b=_0x1f978c[_0xffa8('0xe2')]();return respondWithRpcPromise('SendMail',_0xffa8('0xe3'),{'account':_0x2e7e4b,'message':{'from':util[_0xffa8('0x2f')](_0xffa8('0xe4'),_0x1f978c[_0xffa8('0x2c')],_0x1f978c[_0xffa8('0xe5')]||_0x1f978c[_0xffa8('0xdf')][_0xffa8('0x6a')]),'to':_0x165a43[_0xffa8('0xe1')],'subject':_0x165a43[_0xffa8('0xe6')],'html':_0x56818d['body'],'attachments':_0x3d1067}},client9003)[_0xffa8('0x14')](function(){return _0x56818d;})['catch'](function(_0x5449bb){logger['error'](_0x5449bb);});}})['then'](function(){if(_0x165a43&&_0x165a43['openNewInteraction']&&_0x165a43[_0xffa8('0xe7')]){var _0x9cea74=[];if(_0x453515[_0xffa8('0x65')]){_0x9cea74=_0x453515[_0xffa8('0x38')](function(_0x540b4a){return{'name':_0x540b4a[_0xffa8('0xd6')],'basename':_0x540b4a['filename'],'type':_0x540b4a['mimetype'],'ChatOfflineMessageId':_0xe975d4['id']};});}var _0x29d13a;if(!_['isNil'](_0x165a43[_0xffa8('0xe8')])){var _0x55d67b=_[_0xffa8('0x38')](_0x2f478c[_0xffa8('0x69')],function(_0x115f00){return _0x115f00;});var _0x1f26fc=_[_0xffa8('0xe9')](_0x55d67b)[0x0];var _0xed244c=_[_0xffa8('0xea')](_0x1f26fc,function(_0x652a43){return _0x652a43;});_0x29d13a=_0xed244c[0x1][_0x165a43['subjectOffline']];}var _0xe38100={'from':_0x3d6067[_0xffa8('0xe5')],'firstName':_0x3d6067[_0xffa8('0xb8')],'lastName':_0x3d6067['lastName'],'mapKey':'email','message':{'from':_0x3d6067[_0xffa8('0xe5')],'to':_0x165a43[_0xffa8('0xcf')]['email'],'cc':'','subject':_[_0xffa8('0x87')](_0x29d13a)?_0x165a43['offlineMessageSubject']:_0x29d13a,'messageId':'','sentAt':new Date(),'attach':_0x9cea74['length'],'attachments':_0x9cea74,'originChannel':_0xffa8('0xeb'),'ChatWebsiteId':_0x165a43['id'],'ChatOfflineMessageId':_0x56818d['id'],'originTo':_0x165a43[_0xffa8('0xcf')]['email']},'body':_0x56818d[_0xffa8('0x69')]};var _0x563b84={'account':{'id':_0x165a43['MailAccountId']},'body':_0xe38100,'log':_0xffa8('0xec')};return respondWithRpcPromise('NotifyMailAccount',_0xffa8('0xed'),_0x563b84,client9001)['then'](function(){return _0x56818d;})[_0xffa8('0x1d')](function(_0x31be88){logger[_0xffa8('0x19')](_0x31be88);});}return;})['then'](function(){if(_0x56818d){return _0x56818d;}})['then'](respondWithResult(_0x35e0c5,null))['catch'](function(){for(var _0x1377e8 of _0x453515){var _0x462c02=path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0xee'),_0xffa8('0xca'),'attachments',_0xffa8('0xd9'),_0x1377e8[_0xffa8('0x80')]);fs_extra['remove'](_0x462c02)[_0xffa8('0x1d')](function(_0x55a7dc){logger[_0xffa8('0x19')](_0xffa8('0xef'),_0x462c02,_0x55a7dc);});}});};exports[_0xffa8('0xf0')]=function(_0x1bca1e,_0x3e25f7){return db[_0xffa8('0xb6')]['find']({'where':{'id':_0x1bca1e[_0xffa8('0x63')]['id']}})['then'](handleEntityNotFound(_0x3e25f7,null))[_0xffa8('0x14')](function(_0x5e6b26){if(_0x5e6b26){return _0x5e6b26[_0xffa8('0xf0')](_0x1bca1e[_0xffa8('0x69')]['ids'],_[_0xffa8('0xf1')](_0x1bca1e[_0xffa8('0x69')],[_0xffa8('0x77'),'id'])||{});}})[_0xffa8('0x14')](respondWithResult(_0x3e25f7,null))[_0xffa8('0x1d')](handleError(_0x3e25f7,null));};exports[_0xffa8('0xf2')]=function(_0x4509bf,_0x10ebbb){var _0x13ad34={'raw':![],'where':{}};var _0x1c3b7e={};var _0xfcb05d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xffa8('0x75')]({'where':{'id':_0x4509bf['params']['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x10ebbb,null))[_0xffa8('0x14')](function(_0x5c5e5a){if(_0x5c5e5a){_0x1c3b7e['model']=_['keys'](db[_0xffa8('0xb6')][_0xffa8('0x50')]);_0x1c3b7e[_0xffa8('0x53')]=_[_0xffa8('0x54')](_0x4509bf[_0xffa8('0x53')]);_0x1c3b7e[_0xffa8('0x5c')]=_['intersection'](_0x1c3b7e['model'],_0x1c3b7e[_0xffa8('0x53')]);_0x13ad34[_0xffa8('0x55')]=_[_0xffa8('0x64')](_0x1c3b7e['model'],qs[_0xffa8('0x56')](_0x4509bf[_0xffa8('0x53')][_0xffa8('0x56')]));_0x13ad34[_0xffa8('0x55')]=_0x13ad34[_0xffa8('0x55')][_0xffa8('0x65')]?_0x13ad34[_0xffa8('0x55')]:_0x1c3b7e[_0xffa8('0x48')];if(!_0x4509bf[_0xffa8('0x53')][_0xffa8('0x57')]('nolimit')){_0x13ad34[_0xffa8('0x24')]=qs['limit'](_0x4509bf[_0xffa8('0x53')]['limit']);_0x13ad34[_0xffa8('0x22')]=qs['offset'](_0x4509bf[_0xffa8('0x53')][_0xffa8('0x22')]);}_0x13ad34[_0xffa8('0x59')]=qs['sort'](_0x4509bf[_0xffa8('0x53')][_0xffa8('0x5a')]);_0x13ad34[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x4509bf[_0xffa8('0x53')],_0x1c3b7e['filters']));_0x13ad34[_0xffa8('0x5b')][_0xffa8('0x72')]=_0x5c5e5a['id'];if(_0x4509bf[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x13ad34[_0xffa8('0x5b')]=_[_0xffa8('0x5f')](_0x13ad34['where'],{'$or':_[_0xffa8('0x38')](_0x13ad34[_0xffa8('0x55')],function(_0x4cb30a){var _0xf5b452={};_0xf5b452[_0x4cb30a]={'$like':'%'+_0x4509bf[_0xffa8('0x53')][_0xffa8('0x5e')]+'%'};return _0xf5b452;})});}_0x13ad34=_['merge']({},_0x13ad34,_0x4509bf[_0xffa8('0x66')]);return db[_0xffa8('0xb6')]['count']({'where':_0x13ad34[_0xffa8('0x5b')]})['then'](function(_0x1d7fbd){_0xfcb05d[_0xffa8('0x25')]=_0x1d7fbd;if(_0x4509bf[_0xffa8('0x53')]['includeAll']){_0x13ad34['include']=[{'model':db['CmContact'],'as':_0xffa8('0xf3'),'required':![]},{'model':db[_0xffa8('0xc0')],'as':_0xffa8('0xf4'),'attributes':['name',_0xffa8('0xf5'),_0xffa8('0xf6')],'required':![]},{'model':db[_0xffa8('0xf7')],'as':_0xffa8('0xf8'),'attributes':['id',_0xffa8('0x2c'),_0xffa8('0xf9')],'where':_0x4509bf['query'][_0xffa8('0xfa')]?{'id':_0x4509bf[_0xffa8('0x53')]['tag']}:undefined,'required':_0x4509bf[_0xffa8('0x53')][_0xffa8('0xfa')]?!![]:![]}];}return db['ChatInteraction'][_0xffa8('0xfb')](_0x13ad34);})['then'](function(_0x20c02c){_0xfcb05d[_0xffa8('0x62')]=_0x20c02c;return _0xfcb05d;});}})[_0xffa8('0x14')](respondWithFilteredResult(_0x10ebbb,_0x13ad34))[_0xffa8('0x1d')](handleError(_0x10ebbb,null));};exports['getSnippet']=function(_0x6d7a7e,_0x3bd7c7){var _0x221f6b=0x0;var _0x168f90=0x0;var _0x598256=![];var _0x1be718;var _0x5895ca;return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x6d7a7e[_0xffa8('0x63')]['id']},'include':[{'model':db[_0xffa8('0x39')],'as':'Interval','include':[{'model':db[_0xffa8('0x39')],'as':'Intervals','attributes':['id',_0xffa8('0x31')]}]}]})[_0xffa8('0x14')](handleEntityNotFound(_0x3bd7c7,null))[_0xffa8('0x14')](function(_0x58545a){if(_0x58545a){_0x1be718=_0x58545a;return _0x58545a[_0xffa8('0xfc')]({'raw':!![]});}})[_0xffa8('0x14')](function(_0x19cd9d){if(_0x1be718){if(_0x19cd9d){_0x5895ca=_0x19cd9d;}}return require(_0xffa8('0x85'))[_0xffa8('0x86')]();})['then'](function(_0x25b994){if(_0x25b994){_0x168f90=_0x25b994[_0xffa8('0xfd')];_0x598256=_0x25b994[_0xffa8('0xfe')];}})[_0xffa8('0x14')](function(){return db[_0xffa8('0xb6')][_0xffa8('0x25')]({'where':{'closed':![]}});})['then'](function(_0x51e84a){_0x221f6b=_0x51e84a;if(_0x168f90&&_0x51e84a>_0x168f90){return db['License'][_0xffa8('0x75')]({'where':{'id':0x1}})[_0xffa8('0x14')](function(_0x5bb040){if(_0x5bb040){_0x5bb040['increment'](_0xffa8('0xff'));}});}})['then'](function(){if(!_0x1be718[_0xffa8('0x39')]||!_0x1be718[_0xffa8('0x39')][_0xffa8('0xa8')])return!![];return checkWebsiteIntervals(_0x1be718);})[_0xffa8('0x14')](function(_0x1d2a8d){var _0x54b7ed=fs[_0xffa8('0xd1')](path[_0xffa8('0x81')](config[_0xffa8('0x82')],_0xffa8('0x100')),_0xffa8('0xd3'));var _0x334d76=new url[(_0xffa8('0x101'))](_0x1be718['address'])[_0xffa8('0x102')];var _0xdba454=_0xffa8('0x103');var _0x1c38f6=![];var _0x31bc52={'chatVersion':_0xdba454,'chatWebsiteAddressOrigin':_0x334d76,'remote':_0x1be718[_0xffa8('0x104')],'query':querystring[_0xffa8('0x105')](_[_0xffa8('0x5f')](_0x1be718[_0xffa8('0x28')]({'plain':!![]}),{'customerIp':_0x6d7a7e['headers']['x-forwarded-for']||_0x6d7a7e[_0xffa8('0x106')][_0xffa8('0x107')]||_0x6d7a7e[_0xffa8('0x108')][_0xffa8('0x109')]||_0x6d7a7e['ip'],'referer':_0x6d7a7e['headers'][_0xffa8('0x10a')],'openedInteractions':_0x221f6b,'maxInteractions':_0x168f90,'virtual':_0x598256['virtual'],'online':_0x1d2a8d,'custom':_0x598256}))[_0xffa8('0x10b')](/'/g,'\x5c\x27')};_0x3bd7c7[_0xffa8('0xcb')](ejs[_0xffa8('0x10c')](Mustache[_0xffa8('0x10c')](_0x54b7ed,_0x31bc52),{'proactiveActions':_0x5895ca,'alignment':_0x1be718[_0xffa8('0x10d')],'verticalAlignment':_0x1be718[_0xffa8('0x10e')],'div_color':_0x1be718[_0xffa8('0xf9')],'labelText':_0x1be718['labelText'],'text_color':_0x1be718[_0xffa8('0x10f')],'text_button_color':_0x1be718['textButtonColor'],'button_color':_0x1be718[_0xffa8('0x110')],'background_color':_0x1be718[_0xffa8('0x111')],'hideWhenOffline':_0x1be718[_0xffa8('0x112')],'intervalId':_0x1be718[_0xffa8('0x113')],'isDevelopment':_0x1c38f6,'chatVersion':_0xdba454}));})['catch'](handleError(_0x3bd7c7,null));};exports[_0xffa8('0x114')]=function(_0x357972,_0x31d118){var _0x358ee1=_0x357972[_0xffa8('0x63')]['id'];var _0x1e0bea=_0x357972[_0xffa8('0x69')];var _0x463cce=0xc8;var _0x1fc2cf=null;return db['sequelize'][_0xffa8('0x115')]({'isolationLevel':db[_0xffa8('0x116')][_0xffa8('0x117')][_0xffa8('0x118')]['READ_COMMITTED']},function(_0x1f121e){return db[_0xffa8('0x4f')]['findOne']({'where':{'id':_0x358ee1},'transaction':_0x1f121e})[_0xffa8('0x14')](function(_0xd473f3){if(_0xd473f3){return db[_0xffa8('0xa6')][_0xffa8('0x70')]({'where':{'ChatWebsiteId':_0x358ee1},'transaction':_0x1f121e})[_0xffa8('0x14')](function(){var _0x3e229f=_['map'](_0x1e0bea,function(_0x55e133){_0x55e133[_0xffa8('0x72')]=_0x358ee1;return _0x55e133;});return db['ChatApplication']['bulkCreate'](_0x3e229f,{'transaction':_0x1f121e});});}else{_0x463cce=0x194;_0x1fc2cf=[];}});})[_0xffa8('0x14')](function(){if(_0x463cce!==0x194){return db[_0xffa8('0xa6')][_0xffa8('0x119')]({'where':{'ChatWebsiteId':_0x358ee1},'order':'priority'})[_0xffa8('0x14')](function(_0x2c68cf){_0x1fc2cf=_0x2c68cf;});}})[_0xffa8('0x1d')](function(_0x46f6ec){_0x463cce=0x1f4;logger[_0xffa8('0x19')](_0x46f6ec[_0xffa8('0x2b')]);if(_0x46f6ec[_0xffa8('0x2c')]){delete _0x46f6ec[_0xffa8('0x2c')];}_0x1fc2cf=_0x46f6ec;})[_0xffa8('0x11a')](function(){if(_0x1fc2cf===null){_0x31d118[_0xffa8('0x1e')](_0x463cce);}else{if(_0x463cce===0x1f4){_0x31d118['status'](_0x463cce)[_0xffa8('0xcb')](_0x1fc2cf);}else{_0x31d118[_0xffa8('0x1f')](_0x463cce)['json'](_0x1fc2cf);}}});};exports[_0xffa8('0x11b')]=function(_0x5bc310,_0x4b9739){var _0x4682ea={};var _0x5501e5={};var _0x363e1d;var _0xc06542;return db['ChatWebsite']['findOne']({'where':{'id':_0x5bc310[_0xffa8('0x63')]['id']}})['then'](handleEntityNotFound(_0x4b9739,null))[_0xffa8('0x14')](function(_0x50c58d){if(_0x50c58d){_0x363e1d=_0x50c58d;_0x5501e5['model']=_[_0xffa8('0x54')](db[_0xffa8('0xa6')]['rawAttributes']);_0x5501e5[_0xffa8('0x53')]=_['keys'](_0x5bc310[_0xffa8('0x53')]);_0x5501e5[_0xffa8('0x5c')]=_[_0xffa8('0x64')](_0x5501e5[_0xffa8('0x48')],_0x5501e5['query']);_0x4682ea['attributes']=_[_0xffa8('0x64')](_0x5501e5['model'],qs[_0xffa8('0x56')](_0x5bc310[_0xffa8('0x53')][_0xffa8('0x56')]));_0x4682ea[_0xffa8('0x55')]=_0x4682ea['attributes'][_0xffa8('0x65')]?_0x4682ea[_0xffa8('0x55')]:_0x5501e5[_0xffa8('0x48')];_0x4682ea['order']=qs['sort'](_0x5bc310[_0xffa8('0x53')][_0xffa8('0x5a')]);_0x4682ea[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x5bc310[_0xffa8('0x53')],_0x5501e5[_0xffa8('0x5c')]));if(_0x5bc310[_0xffa8('0x53')]['filter']){_0x4682ea['where']=_[_0xffa8('0x5f')](_0x4682ea[_0xffa8('0x5b')],{'$or':_[_0xffa8('0x38')](_0x4682ea[_0xffa8('0x55')],function(_0xe437f4){var _0x1838d7={};_0x1838d7[_0xe437f4]={'$like':'%'+_0x5bc310[_0xffa8('0x53')][_0xffa8('0x5e')]+'%'};return _0x1838d7;})});}_0x4682ea=_[_0xffa8('0x5f')]({},_0x4682ea,_0x5bc310[_0xffa8('0x66')]);return _0x363e1d[_0xffa8('0x11b')](_0x4682ea);}})[_0xffa8('0x14')](function(_0x2aa254){if(_0x2aa254){_0xc06542=_0x2aa254['length'];if(!_0x5bc310['query'][_0xffa8('0x57')](_0xffa8('0x58'))){_0x4682ea[_0xffa8('0x24')]=qs[_0xffa8('0x24')](_0x5bc310['query']['limit']);_0x4682ea[_0xffa8('0x22')]=qs[_0xffa8('0x22')](_0x5bc310[_0xffa8('0x53')][_0xffa8('0x22')]);}return _0x363e1d[_0xffa8('0x11b')](_0x4682ea);}})[_0xffa8('0x14')](function(_0x9e0b4a){if(_0x9e0b4a){return _0x9e0b4a?{'count':_0xc06542,'rows':_0x9e0b4a}:null;}})[_0xffa8('0x14')](respondWithResult(_0x4b9739,null))[_0xffa8('0x1d')](handleError(_0x4b9739,null));};exports['addProactiveActions']=function(_0x3c59cf,_0x5b8270){return db[_0xffa8('0x11c')]['find']({'where':{'id':_0x3c59cf[_0xffa8('0x63')]['id']}})['then'](handleEntityNotFound(_0x5b8270,null))[_0xffa8('0x14')](function(_0x36c826){if(_0x36c826){return _0x36c826[_0xffa8('0x11d')](_0x3c59cf[_0xffa8('0x69')][_0xffa8('0x77')],_[_0xffa8('0xf1')](_0x3c59cf[_0xffa8('0x69')],[_0xffa8('0x77'),'id'])||{});}})[_0xffa8('0x14')](respondWithResult(_0x5b8270,null))[_0xffa8('0x1d')](handleError(_0x5b8270,null));};exports[_0xffa8('0xfc')]=function(_0x17f7ef,_0xdeaa57){var _0x5d3cdf={};var _0x4dc5e0={};var _0x4b2e87;var _0x38711f;return db[_0xffa8('0x4f')][_0xffa8('0x75')]({'where':{'id':_0x17f7ef[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0xdeaa57,null))[_0xffa8('0x14')](function(_0x11e3a8){if(_0x11e3a8){_0x4b2e87=_0x11e3a8;_0x4dc5e0[_0xffa8('0x48')]=_[_0xffa8('0x54')](db[_0xffa8('0x11e')]['rawAttributes']);_0x4dc5e0[_0xffa8('0x53')]=_['keys'](_0x17f7ef[_0xffa8('0x53')]);_0x4dc5e0[_0xffa8('0x5c')]=_['intersection'](_0x4dc5e0[_0xffa8('0x48')],_0x4dc5e0[_0xffa8('0x53')]);_0x5d3cdf['attributes']=_[_0xffa8('0x64')](_0x4dc5e0['model'],qs['fields'](_0x17f7ef[_0xffa8('0x53')][_0xffa8('0x56')]));_0x5d3cdf[_0xffa8('0x55')]=_0x5d3cdf[_0xffa8('0x55')][_0xffa8('0x65')]?_0x5d3cdf[_0xffa8('0x55')]:_0x4dc5e0['model'];_0x5d3cdf[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x17f7ef['query'][_0xffa8('0x5a')]);_0x5d3cdf[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x17f7ef[_0xffa8('0x53')],_0x4dc5e0[_0xffa8('0x5c')]));if(_0x17f7ef[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x5d3cdf['where']=_['merge'](_0x5d3cdf[_0xffa8('0x5b')],{'$or':_[_0xffa8('0x38')](_0x5d3cdf[_0xffa8('0x55')],function(_0x5ec1cb){var _0x19fb16={};_0x19fb16[_0x5ec1cb]={'$like':'%'+_0x17f7ef[_0xffa8('0x53')][_0xffa8('0x5e')]+'%'};return _0x19fb16;})});}_0x5d3cdf=_[_0xffa8('0x5f')]({},_0x5d3cdf,_0x17f7ef[_0xffa8('0x66')]);return _0x4b2e87[_0xffa8('0xfc')](_0x5d3cdf);}})[_0xffa8('0x14')](function(_0x138214){if(_0x138214){_0x38711f=_0x138214[_0xffa8('0x65')];if(!_0x17f7ef['query'][_0xffa8('0x57')]('nolimit')){_0x5d3cdf[_0xffa8('0x24')]=qs['limit'](_0x17f7ef[_0xffa8('0x53')][_0xffa8('0x24')]);_0x5d3cdf[_0xffa8('0x22')]=qs['offset'](_0x17f7ef['query'][_0xffa8('0x22')]);}return _0x4b2e87[_0xffa8('0xfc')](_0x5d3cdf);}})[_0xffa8('0x14')](function(_0x4fa1b3){if(_0x4fa1b3){return _0x4fa1b3?{'count':_0x38711f,'rows':_0x4fa1b3}:null;}})[_0xffa8('0x14')](respondWithResult(_0xdeaa57,null))['catch'](handleError(_0xdeaa57,null));};exports[_0xffa8('0x11f')]=function(_0x59b8f4,_0xbca52f){var _0x2ab8a1=_0x59b8f4[_0xffa8('0x53')][_0xffa8('0x120')]==='false'?_0xffa8('0x121'):_0xffa8('0x122');return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'attributes':['id',_0x2ab8a1],'where':{'id':_0x59b8f4['params']['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0xbca52f,null))['then'](function(_0x5419a8){if(_0x5419a8){var _0x168691=_0x5419a8[_0x2ab8a1];var _0x59e263=_0x168691&&_0x168691['items']?_0x168691[_0xffa8('0x123')]:[];_0xbca52f['send']({'fromKey':_[_0xffa8('0x87')](_0x168691[_0xffa8('0x124')])?undefined:_0x168691[_0xffa8('0x124')],'count':_0x59e263[_0xffa8('0x65')],'rows':_0x59e263});}})['catch'](handleError(_0xbca52f,null));};exports[_0xffa8('0x125')]=function(_0x95eeae,_0x5719d6){var _0x10a46f={'raw':![],'where':{}};var _0x5e1c8d={};var _0x53931c={'count':0x0,'rows':[]};return db[_0xffa8('0x4f')][_0xffa8('0x75')]({'where':{'id':_0x95eeae[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x5719d6,null))[_0xffa8('0x14')](function(_0x33028c){if(_0x33028c){_0x5e1c8d[_0xffa8('0x48')]=_[_0xffa8('0x54')](db[_0xffa8('0xd4')][_0xffa8('0x50')]);_0x5e1c8d[_0xffa8('0x53')]=_[_0xffa8('0x54')](_0x95eeae[_0xffa8('0x53')]);_0x5e1c8d[_0xffa8('0x5c')]=_[_0xffa8('0x64')](_0x5e1c8d[_0xffa8('0x48')],_0x5e1c8d[_0xffa8('0x53')]);_0x10a46f['attributes']=_['intersection'](_0x5e1c8d[_0xffa8('0x48')],qs[_0xffa8('0x56')](_0x95eeae[_0xffa8('0x53')]['fields']));_0x10a46f['attributes']=_0x10a46f[_0xffa8('0x55')][_0xffa8('0x65')]?_0x10a46f[_0xffa8('0x55')]:_0x5e1c8d[_0xffa8('0x48')];if(!_0x95eeae['query']['hasOwnProperty'](_0xffa8('0x58'))){_0x10a46f[_0xffa8('0x24')]=qs[_0xffa8('0x24')](_0x95eeae[_0xffa8('0x53')][_0xffa8('0x24')]);_0x10a46f[_0xffa8('0x22')]=qs['offset'](_0x95eeae[_0xffa8('0x53')][_0xffa8('0x22')]);}_0x10a46f[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x95eeae[_0xffa8('0x53')][_0xffa8('0x5a')]);_0x10a46f[_0xffa8('0x5b')]=qs['filters'](_[_0xffa8('0x5d')](_0x95eeae['query'],_0x5e1c8d[_0xffa8('0x5c')]));_0x10a46f[_0xffa8('0x5b')]['ChatWebsiteId']=_0x33028c['id'];if(_0x95eeae[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x10a46f[_0xffa8('0x5b')]=_[_0xffa8('0x5f')](_0x10a46f[_0xffa8('0x5b')],{'$or':_['map'](_0x10a46f[_0xffa8('0x55')],function(_0x2269d1){var _0x336dd6={};_0x336dd6[_0x2269d1]={'$like':'%'+_0x95eeae['query']['filter']+'%'};return _0x336dd6;})});}_0x10a46f=_['merge']({},_0x10a46f,_0x95eeae[_0xffa8('0x66')]);return db[_0xffa8('0xd4')][_0xffa8('0x25')]({'where':_0x10a46f[_0xffa8('0x5b')]})[_0xffa8('0x14')](function(_0x452cf4){_0x53931c['count']=_0x452cf4;if(_0x95eeae[_0xffa8('0x53')]['includeAll']){_0x10a46f[_0xffa8('0x61')]=[{'all':!![]}];}else{_0x10a46f['include']=[{'model':db[_0xffa8('0x94')],'as':_0xffa8('0xf3'),'required':![]},{'model':db[_0xffa8('0xdc')],'as':'Attachments','required':![]}];}return db[_0xffa8('0xd4')]['findAll'](_0x10a46f);})[_0xffa8('0x14')](function(_0x533633){_0x53931c[_0xffa8('0x62')]=_0x533633;return _0x53931c;});}})[_0xffa8('0x14')](respondWithFilteredResult(_0x5719d6,_0x10a46f))[_0xffa8('0x1d')](handleError(_0x5719d6,null));};exports['addAgents']=function(_0x173add,_0x4fc562){return db[_0xffa8('0x4f')][_0xffa8('0x67')]({'where':{'id':_0x173add[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x4fc562,null))['then'](function(_0x4921b5){if(_0x4921b5){return _0x4921b5[_0xffa8('0x126')](_0x173add[_0xffa8('0x69')][_0xffa8('0x77')],_[_0xffa8('0xf1')](_0x173add[_0xffa8('0x69')],[_0xffa8('0x77'),'id'])||{})[_0xffa8('0xaa')](function(_0x43caef){for(var _0x2c20f1=0x0;_0x2c20f1<_0x173add[_0xffa8('0x69')]['ids'][_0xffa8('0x65')];_0x2c20f1+=0x1){socket[_0xffa8('0x127')](_0xffa8('0x128'),{'UserId':Number(_0x173add['body'][_0xffa8('0x77')][_0x2c20f1]),'ChatWebsiteId':Number(_0x173add['params']['id'])});}return _0x43caef;});}})[_0xffa8('0x14')](respondWithResult(_0x4fc562,null))['catch'](handleError(_0x4fc562,null));};exports[_0xffa8('0x129')]=function(_0x38e113,_0x1b8a34){return db['ChatWebsite'][_0xffa8('0x67')]({'where':{'id':_0x38e113[_0xffa8('0x63')]['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x1b8a34,null))[_0xffa8('0x14')](function(_0x3dbaad){if(_0x3dbaad){return _0x3dbaad[_0xffa8('0x129')](_0x38e113[_0xffa8('0x53')][_0xffa8('0x77')])['then'](function(){if(_[_0xffa8('0x12a')](_0x38e113[_0xffa8('0x53')]['ids'])){for(var _0xb98156=0x0;_0xb98156<_0x38e113[_0xffa8('0x53')][_0xffa8('0x77')][_0xffa8('0x65')];_0xb98156+=0x1){socket[_0xffa8('0x127')](_0xffa8('0x12b'),{'UserId':Number(_0x38e113[_0xffa8('0x53')][_0xffa8('0x77')][_0xb98156]),'ChatWebsiteId':Number(_0x38e113[_0xffa8('0x63')]['id'])});}}else{socket[_0xffa8('0x127')](_0xffa8('0x12b'),{'UserId':Number(_0x38e113[_0xffa8('0x53')][_0xffa8('0x77')]),'ChatWebsiteId':Number(_0x38e113[_0xffa8('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b8a34,null))[_0xffa8('0x1d')](handleError(_0x1b8a34,null));};exports['getAgents']=function(_0x5614cc,_0x31a863){var _0x2bf456={};var _0x5c1c19={};var _0x4844ea;var _0x17b8b4;return db[_0xffa8('0x4f')][_0xffa8('0x75')]({'where':{'id':_0x5614cc['params']['id']}})[_0xffa8('0x14')](handleEntityNotFound(_0x31a863,null))[_0xffa8('0x14')](function(_0x110594){if(_0x110594){_0x4844ea=_0x110594;_0x5c1c19['model']=_[_0xffa8('0x54')](db[_0xffa8('0xc0')][_0xffa8('0x50')]);_0x5c1c19[_0xffa8('0x53')]=_[_0xffa8('0x54')](_0x5614cc[_0xffa8('0x53')]);_0x5c1c19[_0xffa8('0x5c')]=_[_0xffa8('0x64')](_0x5c1c19['model'],_0x5c1c19[_0xffa8('0x53')]);_0x2bf456[_0xffa8('0x55')]=_[_0xffa8('0x64')](_0x5c1c19[_0xffa8('0x48')],qs[_0xffa8('0x56')](_0x5614cc[_0xffa8('0x53')][_0xffa8('0x56')]));_0x2bf456[_0xffa8('0x55')]=_0x2bf456['attributes'][_0xffa8('0x65')]?_0x2bf456['attributes']:_0x5c1c19[_0xffa8('0x48')];_0x2bf456[_0xffa8('0x59')]=qs[_0xffa8('0x5a')](_0x5614cc['query'][_0xffa8('0x5a')]);_0x2bf456[_0xffa8('0x5b')]=qs[_0xffa8('0x5c')](_[_0xffa8('0x5d')](_0x5614cc[_0xffa8('0x53')],_0x5c1c19[_0xffa8('0x5c')]));if(_0x5614cc[_0xffa8('0x53')][_0xffa8('0x5e')]){_0x2bf456[_0xffa8('0x5b')]=_[_0xffa8('0x5f')](_0x2bf456['where'],{'$or':_['map'](_0x2bf456['attributes'],function(_0x2becb6){var _0x5b457b={};_0x5b457b[_0x2becb6]={'$like':'%'+_0x5614cc[_0xffa8('0x53')][_0xffa8('0x5e')]+'%'};return _0x5b457b;})});}_0x2bf456=_['merge']({},_0x2bf456,_0x5614cc['options']);return _0x4844ea[_0xffa8('0x12c')](_0x2bf456);}})[_0xffa8('0x14')](function(_0x1259d8){if(_0x1259d8){_0x17b8b4=_0x1259d8[_0xffa8('0x65')];if(!_0x5614cc['query'][_0xffa8('0x57')](_0xffa8('0x58'))){_0x2bf456[_0xffa8('0x24')]=qs[_0xffa8('0x24')](_0x5614cc['query'][_0xffa8('0x24')]);_0x2bf456[_0xffa8('0x22')]=qs[_0xffa8('0x22')](_0x5614cc[_0xffa8('0x53')][_0xffa8('0x22')]);}return _0x4844ea['getAgents'](_0x2bf456);}})[_0xffa8('0x14')](function(_0x112807){if(_0x112807){return _0x112807?{'count':_0x17b8b4,'rows':_0x112807}:null;}})[_0xffa8('0x14')](respondWithResult(_0x31a863,null))[_0xffa8('0x1d')](handleError(_0x31a863,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b919df6..36990d1 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 _0xf569=['exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5eacb8,_0x58e717){var _0x201b44=function(_0x3b2212){while(--_0x3b2212){_0x5eacb8['push'](_0x5eacb8['shift']());}};_0x201b44(++_0x58e717);}(_0xf569,0xd0));var _0x9f56=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xf569[_0x231e16];return _0x570a7c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9f56('0x0'))['db'][_0x9f56('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9f56('0x2')](0x0);var events={'afterCreate':_0x9f56('0x3'),'afterUpdate':_0x9f56('0x4'),'afterDestroy':_0x9f56('0x5')};function emitEvent(_0x4506a1){return function(_0x6d506b,_0x5bc3e8,_0x314ee2){ChatWebsiteEvents['emit'](_0x4506a1+':'+_0x6d506b['id'],_0x6d506b);ChatWebsiteEvents[_0x9f56('0x6')](_0x4506a1,_0x6d506b);_0x314ee2(null);};}for(var e in events){if(events[_0x9f56('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9f56('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x25b0=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x44f29f,_0x47e939){var _0x491a1=function(_0x139f71){while(--_0x139f71){_0x44f29f['push'](_0x44f29f['shift']());}};_0x491a1(++_0x47e939);}(_0x25b0,0x140));var _0x025b=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0x25b0[_0x39cc8f];return _0x15e616;};'use strict';var EventEmitter=require(_0x025b('0x0'));var ChatWebsite=require(_0x025b('0x1'))['db'][_0x025b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x025b('0x3')](0x0);var events={'afterCreate':_0x025b('0x4'),'afterUpdate':_0x025b('0x5'),'afterDestroy':_0x025b('0x6')};function emitEvent(_0x1c2c48){return function(_0x86752b,_0x286601,_0x516a8d){ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48+':'+_0x86752b['id'],_0x86752b);ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48,_0x86752b);_0x516a8d(null);};}for(var e in events){if(events[_0x025b('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x025b('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d2d672e..db0c682 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 _0x27c8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x27432b,_0x1a5f6f){var _0x47dd4a=function(_0x2aad73){while(--_0x2aad73){_0x27432b['push'](_0x27432b['shift']());}};_0x47dd4a(++_0x1a5f6f);}(_0x27c8,0x67));var _0x827c=function(_0x3d9b9e,_0x3b322f){_0x3d9b9e=_0x3d9b9e-0x0;var _0x15c9ce=_0x27c8[_0x3d9b9e];return _0x15c9ce;};'use strict';var _=require(_0x827c('0x0'));var util=require(_0x827c('0x1'));var logger=require(_0x827c('0x2'))(_0x827c('0x3'));var moment=require(_0x827c('0x4'));var BPromise=require(_0x827c('0x5'));var rp=require(_0x827c('0x6'));var fs=require('fs');var path=require(_0x827c('0x7'));var rimraf=require(_0x827c('0x8'));var config=require(_0x827c('0x9'));var attributes=require(_0x827c('0xa'));module[_0x827c('0xb')]=function(_0x42b19d,_0xcd26a4){return _0x42b19d[_0x827c('0xc')](_0x827c('0xd'),attributes,{'tableName':_0x827c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8a=['exports','define','chat_websites','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x36e006,_0x326712){var _0x19b83c=function(_0x3187ad){while(--_0x3187ad){_0x36e006['push'](_0x36e006['shift']());}};_0x19b83c(++_0x326712);}(_0xdd8a,0x100));var _0xadd8=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0xdd8a[_0xd93b26];return _0x25f668;};'use strict';var _=require(_0xadd8('0x0'));var util=require(_0xadd8('0x1'));var logger=require('../../config/logger')(_0xadd8('0x2'));var moment=require(_0xadd8('0x3'));var BPromise=require('bluebird');var rp=require(_0xadd8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadd8('0x5'));var config=require(_0xadd8('0x6'));var attributes=require(_0xadd8('0x7'));module[_0xadd8('0x8')]=function(_0xf4a9b1,_0x46ea20){return _0xf4a9b1[_0xadd8('0x9')]('ChatWebsite',attributes,{'tableName':_0xadd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0e596f0..8570b35 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 _0x5657=['ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5657,0x1a8));var _0x7565=function(_0x27d535,_0x48a21a){_0x27d535=_0x27d535-0x0;var _0x51ca87=_0x5657[_0x27d535];return _0x51ca87;};'use strict';var _=require(_0x7565('0x0'));var util=require(_0x7565('0x1'));var moment=require(_0x7565('0x2'));var BPromise=require('bluebird');var rs=require(_0x7565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7565('0x4'))['db'];var utils=require(_0x7565('0x5'));var logger=require(_0x7565('0x6'))('rpc');var config=require(_0x7565('0x7'));var jayson=require(_0x7565('0x8'));var client=jayson['client'][_0x7565('0x9')]({'port':0x232a});config[_0x7565('0xa')]=_[_0x7565('0xb')](config[_0x7565('0xa')],{'host':_0x7565('0xc'),'port':0x18eb});var socket=require(_0x7565('0xd'))(new Redis(config[_0x7565('0xa')]));require(_0x7565('0xe'))[_0x7565('0xf')](socket);function respondWithRpcPromise(_0x1af8fb,_0x24f141,_0x29df72){return new BPromise(function(_0x1c4357,_0x18c185){return client[_0x7565('0x10')](_0x1af8fb,_0x29df72)[_0x7565('0x11')](function(_0x1de624){logger['info'](_0x7565('0x12'),_0x24f141,'request\x20sent');logger[_0x7565('0x13')](_0x7565('0x14'),_0x24f141,'request\x20sent',JSON[_0x7565('0x15')](_0x1de624));if(_0x1de624[_0x7565('0x16')]){if(_0x1de624[_0x7565('0x16')][_0x7565('0x17')]===0x1f4){logger[_0x7565('0x16')](_0x7565('0x12'),_0x24f141,_0x1de624[_0x7565('0x16')][_0x7565('0x18')]);return _0x18c185(_0x1de624[_0x7565('0x16')][_0x7565('0x18')]);}logger[_0x7565('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x24f141,_0x1de624[_0x7565('0x16')]['message']);return _0x1c4357(_0x1de624['error']['message']);}else{logger['info'](_0x7565('0x12'),_0x24f141,'request\x20sent');_0x1c4357(_0x1de624[_0x7565('0x19')][_0x7565('0x18')]);}})['catch'](function(_0x15898f){logger[_0x7565('0x16')](_0x7565('0x12'),_0x24f141,_0x15898f);_0x18c185(_0x15898f);});});} \ No newline at end of file +var _0xf41d=['socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf41d,0x80));var _0xdf41=function(_0x247902,_0x26d9ca){_0x247902=_0x247902-0x0;var _0x4f8697=_0xf41d[_0x247902];return _0x4f8697;};'use strict';var _=require(_0xdf41('0x0'));var util=require(_0xdf41('0x1'));var moment=require(_0xdf41('0x2'));var BPromise=require(_0xdf41('0x3'));var rs=require(_0xdf41('0x4'));var fs=require('fs');var Redis=require(_0xdf41('0x5'));var db=require(_0xdf41('0x6'))['db'];var utils=require(_0xdf41('0x7'));var logger=require(_0xdf41('0x8'))(_0xdf41('0x9'));var config=require(_0xdf41('0xa'));var jayson=require(_0xdf41('0xb'));var client=jayson[_0xdf41('0xc')][_0xdf41('0xd')]({'port':0x232a});config['redis']=_[_0xdf41('0xe')](config[_0xdf41('0xf')],{'host':_0xdf41('0x10'),'port':0x18eb});var socket=require(_0xdf41('0x11'))(new Redis(config[_0xdf41('0xf')]));require('./chatWebsite.socket')[_0xdf41('0x12')](socket);function respondWithRpcPromise(_0x4fe4fd,_0x230972,_0x14359b){return new BPromise(function(_0x3ae56a,_0x385b1a){return client['request'](_0x4fe4fd,_0x14359b)[_0xdf41('0x13')](function(_0x8745f0){logger[_0xdf41('0x14')](_0xdf41('0x15'),_0x230972,'request\x20sent');logger[_0xdf41('0x16')](_0xdf41('0x17'),_0x230972,'request\x20sent',JSON[_0xdf41('0x18')](_0x8745f0));if(_0x8745f0[_0xdf41('0x19')]){if(_0x8745f0[_0xdf41('0x19')][_0xdf41('0x1a')]===0x1f4){logger[_0xdf41('0x19')](_0xdf41('0x15'),_0x230972,_0x8745f0[_0xdf41('0x19')]['message']);return _0x385b1a(_0x8745f0[_0xdf41('0x19')]['message']);}logger['error'](_0xdf41('0x15'),_0x230972,_0x8745f0[_0xdf41('0x19')][_0xdf41('0x1b')]);return _0x3ae56a(_0x8745f0[_0xdf41('0x19')][_0xdf41('0x1b')]);}else{logger[_0xdf41('0x14')](_0xdf41('0x15'),_0x230972,'request\x20sent');_0x3ae56a(_0x8745f0['result'][_0xdf41('0x1b')]);}})[_0xdf41('0x1c')](function(_0x1a400d){logger[_0xdf41('0x19')](_0xdf41('0x15'),_0x230972,_0x1a400d);_0x385b1a(_0x1a400d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1ecbcd8..7b2f2aa 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 _0x961f=['remove','update','emit','removeListener','register','length','chatWebsite:','save'];(function(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0x961f,0x187));var _0xf961=function(_0x5954d2,_0x15db93){_0x5954d2=_0x5954d2-0x0;var _0x316928=_0x961f[_0x5954d2];return _0x316928;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xf961('0x0'),_0xf961('0x1'),_0xf961('0x2')];function createListener(_0x3bcb01,_0x2af4d7){return function(_0x3b0054){_0x2af4d7[_0xf961('0x3')](_0x3bcb01,_0x3b0054);};}function removeListener(_0x595827,_0x196eab){return function(){ChatWebsiteEvents[_0xf961('0x4')](_0x595827,_0x196eab);};}exports[_0xf961('0x5')]=function(_0x5675ec){for(var _0x3fb44b=0x0,_0x4b1b15=events[_0xf961('0x6')];_0x3fb44b<_0x4b1b15;_0x3fb44b++){var _0x313d50=events[_0x3fb44b];var _0x84d275=createListener(_0xf961('0x7')+_0x313d50,_0x5675ec);ChatWebsiteEvents['on'](_0x313d50,_0x84d275);}}; \ No newline at end of file +var _0xce9c=['length','remove','emit'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0xce9c,0x1bd));var _0xcce9=function(_0x696c65,_0x16e4ae){_0x696c65=_0x696c65-0x0;var _0x1d7254=_0xce9c[_0x696c65];return _0x1d7254;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xcce9('0x0'),'update'];function createListener(_0x5417a8,_0x2b70ba){return function(_0x3436b9){_0x2b70ba[_0xcce9('0x1')](_0x5417a8,_0x3436b9);};}function removeListener(_0x463cd8,_0x273160){return function(){ChatWebsiteEvents['removeListener'](_0x463cd8,_0x273160);};}exports['register']=function(_0x3655fc){for(var _0x2c5d4=0x0,_0x551bee=events[_0xcce9('0x2')];_0x2c5d4<_0x551bee;_0x2c5d4++){var _0x4e2a46=events[_0x2c5d4];var _0x30a232=createListener('chatWebsite:'+_0x4e2a46,_0x3655fc);ChatWebsiteEvents['on'](_0x4e2a46,_0x30a232);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9ce1b34..ed95999 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 _0x4c3f=['get','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','/:id/canned_answers','addAnswer','diskStorage','root','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','single','addAvatar','format','join','addSystemAvatar','notify','server/files','offline-chat','extname','replace','/:id/offline','offline','addInteraction','/:id/applications','addApplications','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0x4d8f08,_0x21a825){var _0x1ff07b=function(_0x4a8b06){while(--_0x4a8b06){_0x4d8f08['push'](_0x4d8f08['shift']());}};_0x1ff07b(++_0x21a825);}(_0x4c3f,0x78));var _0xf4c3=function(_0x229f52,_0x4aa208){_0x229f52=_0x229f52-0x0;var _0x55780f=_0x4c3f[_0x229f52];return _0x55780f;};'use strict';var multer=require(_0xf4c3('0x0'));var util=require(_0xf4c3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4c3('0x2'));var router=express['Router']();var fs_extra=require(_0xf4c3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf4c3('0x4'));var config=require(_0xf4c3('0x5'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x7')]);router['get'](_0xf4c3('0x8'),auth['isAuthenticated'](),controller[_0xf4c3('0x9')]);router[_0xf4c3('0xa')](_0xf4c3('0xb'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0xc')]);router[_0xf4c3('0xa')](_0xf4c3('0xd'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0xe')]);router[_0xf4c3('0xa')]('/:id/canned_answers',auth[_0xf4c3('0x6')](),controller[_0xf4c3('0xf')]);router[_0xf4c3('0xa')](_0xf4c3('0x10'),controller[_0xf4c3('0x11')]);router[_0xf4c3('0xa')](_0xf4c3('0x12'),controller[_0xf4c3('0x13')]);router[_0xf4c3('0xa')](_0xf4c3('0x14'),controller['getCustomerAvatar']);router['get'](_0xf4c3('0x15'),controller[_0xf4c3('0x16')]);router[_0xf4c3('0xa')](_0xf4c3('0x17'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x18')]);router[_0xf4c3('0xa')](_0xf4c3('0x19'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xf4c3('0x6')](),controller['getApplications']);router[_0xf4c3('0xa')](_0xf4c3('0x1a'),auth[_0xf4c3('0x6')](),controller['getProactiveActions']);router[_0xf4c3('0xa')]('/:id/fields',controller[_0xf4c3('0x1b')]);router[_0xf4c3('0xa')](_0xf4c3('0x1c'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xf4c3('0xa')](_0xf4c3('0x1d'),auth['isAuthenticated'](),controller[_0xf4c3('0x1e')]);router['post']('/',auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x1f')]);router[_0xf4c3('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xf4c3('0x21'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x22')]);var upload=multer({'storage':multer[_0xf4c3('0x23')]({'destination':function(_0x224b6d,_0x2d4ec7,_0x3054ae){_0x3054ae(null,path['join'](config[_0xf4c3('0x24')],'server/files/images/logos/'));},'filename':function(_0x5938bf,_0x30ea1a,_0x4f5ad8){_0x4f5ad8(null,util['format'](_0xf4c3('0x25'),Date[_0xf4c3('0x26')](),_0x30ea1a[_0xf4c3('0x27')]));}})});router[_0xf4c3('0x20')](_0xf4c3('0x10'),upload['single'](_0xf4c3('0x28')),controller[_0xf4c3('0x29')]);var upload=multer({'storage':multer[_0xf4c3('0x23')]({'destination':function(_0x314cba,_0x4f8ee6,_0x22f980){_0x22f980(null,path['join'](config['root'],_0xf4c3('0x2a')));},'filename':function(_0x6b92de,_0x43d759,_0xb305c9){_0xb305c9(null,util['format']('%s-%s',Date[_0xf4c3('0x26')](),_0x43d759[_0xf4c3('0x27')]));}})});router[_0xf4c3('0x20')](_0xf4c3('0x12'),upload[_0xf4c3('0x2b')](_0xf4c3('0x28')),controller[_0xf4c3('0x2c')]);var upload=multer({'storage':multer[_0xf4c3('0x23')]({'destination':function(_0x265fee,_0x3c2fc4,_0x197aa0){_0x197aa0(null,path['join'](config[_0xf4c3('0x24')],_0xf4c3('0x2a')));},'filename':function(_0x4bfc4a,_0x3a003e,_0x471fc5){_0x471fc5(null,util[_0xf4c3('0x2d')](_0xf4c3('0x25'),Date[_0xf4c3('0x26')](),_0x3a003e[_0xf4c3('0x27')]));}})});router[_0xf4c3('0x20')](_0xf4c3('0x14'),upload[_0xf4c3('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf4c3('0x23')]({'destination':function(_0x583c3e,_0x20e19b,_0x5f4676){_0x5f4676(null,path[_0xf4c3('0x2e')](config[_0xf4c3('0x24')],_0xf4c3('0x2a')));},'filename':function(_0x475c81,_0x46df37,_0x506b41){_0x506b41(null,util[_0xf4c3('0x2d')](_0xf4c3('0x25'),Date[_0xf4c3('0x26')](),_0x46df37[_0xf4c3('0x27')]));}})});router[_0xf4c3('0x20')]('/:id/system_avatar',upload['single'](_0xf4c3('0x28')),controller[_0xf4c3('0x2f')]);router['post']('/:id/notify',controller[_0xf4c3('0x30')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2549bb,_0x149784,_0x388592){const _0x3c3c00=path['join'](config[_0xf4c3('0x24')],_0xf4c3('0x31'),'attachments',_0xf4c3('0x32'));fs_extra['ensureDir'](_0x3c3c00,function(){_0x388592(null,_0x3c3c00);});},'filename':function(_0x38c744,_0x323152,_0x20a55c){const _0x2bd4c7=_0x323152['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2c8bee=path[_0xf4c3('0x33')](_0x2bd4c7);const _0xe16fb5=Date[_0xf4c3('0x26')]()+'-'+_0x2bd4c7[_0xf4c3('0x34')](_0x2c8bee,'')+_0x2c8bee;_0x20a55c(null,_0xe16fb5);}})});router[_0xf4c3('0x20')](_0xf4c3('0x35'),offlineUploadMulter['any'](),controller[_0xf4c3('0x36')]);router['post'](_0xf4c3('0x17'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x37')]);router[_0xf4c3('0x20')](_0xf4c3('0x38'),auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x39')]);router['post'](_0xf4c3('0x1a'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xf4c3('0x20')](_0xf4c3('0x1d'),auth[_0xf4c3('0x6')](),controller['addAgents']);router[_0xf4c3('0x3a')](_0xf4c3('0xb'),auth['isAuthenticated'](),controller[_0xf4c3('0x3b')]);router[_0xf4c3('0x3c')]('/:id',auth[_0xf4c3('0x6')](),controller['destroy']);router[_0xf4c3('0x3c')](_0xf4c3('0xd'),auth['isAuthenticated'](),controller[_0xf4c3('0x3d')]);router[_0xf4c3('0x3c')]('/:id/canned_answers',auth[_0xf4c3('0x6')](),controller[_0xf4c3('0x3e')]);router['delete'](_0xf4c3('0x1d'),auth['isAuthenticated'](),controller[_0xf4c3('0x3f')]);module[_0xf4c3('0x40')]=router; \ No newline at end of file +var _0x6029=['../../config/environment','get','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers','getAnswers','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','diskStorage','root','server/files/images/logos/','%s-%s','now','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','format','originalname','/:id/avatar','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','addApplications','addAgents','put','delete','destroy','removeDispositions','removeAgents','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ed491,_0x3db850){var _0x1099af=function(_0x27c717){while(--_0x27c717){_0x3ed491['push'](_0x3ed491['shift']());}};_0x1099af(++_0x3db850);}(_0x6029,0xcc));var _0x9602=function(_0x754831,_0x5f5e0a){_0x754831=_0x754831-0x0;var _0x25b836=_0x6029[_0x754831];return _0x25b836;};'use strict';var multer=require('multer');var util=require(_0x9602('0x0'));var path=require('path');var timeout=require(_0x9602('0x1'));var express=require(_0x9602('0x2'));var router=express['Router']();var fs_extra=require(_0x9602('0x3'));var auth=require(_0x9602('0x4'));var interaction=require(_0x9602('0x5'));var config=require(_0x9602('0x6'));var controller=require('./chatWebsite.controller');router[_0x9602('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9602('0x7')](_0x9602('0x8'),auth[_0x9602('0x9')](),controller[_0x9602('0xa')]);router[_0x9602('0x7')]('/:id/dispositions',auth[_0x9602('0x9')](),controller[_0x9602('0xb')]);router[_0x9602('0x7')](_0x9602('0xc'),auth[_0x9602('0x9')](),controller[_0x9602('0xd')]);router[_0x9602('0x7')]('/:id/logo',controller['getLogo']);router[_0x9602('0x7')]('/:id/avatar',controller[_0x9602('0xe')]);router[_0x9602('0x7')](_0x9602('0xf'),controller[_0x9602('0x10')]);router[_0x9602('0x7')]('/:id/system_avatar',controller[_0x9602('0x11')]);router[_0x9602('0x7')](_0x9602('0x12'),auth[_0x9602('0x9')](),controller['getInteractions']);router['get'](_0x9602('0x13'),controller[_0x9602('0x14')]);router[_0x9602('0x7')](_0x9602('0x15'),auth[_0x9602('0x9')](),controller[_0x9602('0x16')]);router[_0x9602('0x7')](_0x9602('0x17'),auth[_0x9602('0x9')](),controller[_0x9602('0x18')]);router[_0x9602('0x7')](_0x9602('0x19'),controller['getFields']);router[_0x9602('0x7')](_0x9602('0x1a'),auth['isAuthenticated'](),controller[_0x9602('0x1b')]);router['get'](_0x9602('0x1c'),auth['isAuthenticated'](),controller[_0x9602('0x1d')]);router['post']('/',auth[_0x9602('0x9')](),controller[_0x9602('0x1e')]);router[_0x9602('0x1f')](_0x9602('0x20'),auth[_0x9602('0x9')](),controller[_0x9602('0x21')]);router[_0x9602('0x1f')](_0x9602('0xc'),auth[_0x9602('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x9602('0x22')]({'destination':function(_0x47f3ff,_0x94b349,_0x589696){_0x589696(null,path['join'](config[_0x9602('0x23')],_0x9602('0x24')));},'filename':function(_0x61c1b1,_0x21d3a9,_0x11722c){_0x11722c(null,util['format'](_0x9602('0x25'),Date[_0x9602('0x26')](),_0x21d3a9['originalname']));}})});router[_0x9602('0x1f')](_0x9602('0x27'),upload[_0x9602('0x28')](_0x9602('0x29')),controller[_0x9602('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ac919,_0x4d010e,_0x1df1b2){_0x1df1b2(null,path[_0x9602('0x2b')](config[_0x9602('0x23')],_0x9602('0x2c')));},'filename':function(_0x320547,_0x5eb38b,_0x85cb8c){_0x85cb8c(null,util[_0x9602('0x2d')](_0x9602('0x25'),Date[_0x9602('0x26')](),_0x5eb38b[_0x9602('0x2e')]));}})});router['post'](_0x9602('0x2f'),upload[_0x9602('0x28')](_0x9602('0x29')),controller[_0x9602('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b0100,_0x33809e,_0x19540c){_0x19540c(null,path[_0x9602('0x2b')](config[_0x9602('0x23')],'server/files/images/avatars/'));},'filename':function(_0x16b164,_0x6e3597,_0xd7da2f){_0xd7da2f(null,util[_0x9602('0x2d')](_0x9602('0x25'),Date[_0x9602('0x26')](),_0x6e3597[_0x9602('0x2e')]));}})});router['post'](_0x9602('0xf'),upload['single']('file'),controller[_0x9602('0x31')]);var upload=multer({'storage':multer[_0x9602('0x22')]({'destination':function(_0x20c8a0,_0x481232,_0x48252d){_0x48252d(null,path[_0x9602('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x40f651,_0x2d745d,_0x25c4d5){_0x25c4d5(null,util[_0x9602('0x2d')]('%s-%s',Date['now'](),_0x2d745d['originalname']));}})});router['post'](_0x9602('0x32'),upload[_0x9602('0x28')]('file'),controller[_0x9602('0x33')]);router[_0x9602('0x1f')]('/:id/notify',controller[_0x9602('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x9602('0x22')]({'destination':function(_0x2faecb,_0x2e7a98,_0x490ef2){const _0x418f58=path['join'](config[_0x9602('0x23')],_0x9602('0x35'),_0x9602('0x36'),_0x9602('0x37'));fs_extra[_0x9602('0x38')](_0x418f58,function(){_0x490ef2(null,_0x418f58);});},'filename':function(_0x32a998,_0x2a3584,_0xfcd6b){const _0xe3e765=_0x2a3584[_0x9602('0x2e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x556c06=path[_0x9602('0x39')](_0xe3e765);const _0x54d10b=Date['now']()+'-'+_0xe3e765[_0x9602('0x3a')](_0x556c06,'')+_0x556c06;_0xfcd6b(null,_0x54d10b);}})});router[_0x9602('0x1f')](_0x9602('0x3b'),offlineUploadMulter[_0x9602('0x3c')](),controller[_0x9602('0x3d')]);router[_0x9602('0x1f')](_0x9602('0x12'),auth[_0x9602('0x9')](),controller[_0x9602('0x3e')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x9602('0x3f')]);router[_0x9602('0x1f')]('/:id/proactive_actions',auth[_0x9602('0x9')](),controller['addProactiveActions']);router[_0x9602('0x1f')](_0x9602('0x1c'),auth[_0x9602('0x9')](),controller[_0x9602('0x40')]);router[_0x9602('0x41')](_0x9602('0x8'),auth[_0x9602('0x9')](),controller['update']);router[_0x9602('0x42')]('/:id',auth[_0x9602('0x9')](),controller[_0x9602('0x43')]);router[_0x9602('0x42')](_0x9602('0x20'),auth[_0x9602('0x9')](),controller[_0x9602('0x44')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x9602('0x42')]('/:id/users',auth[_0x9602('0x9')](),controller[_0x9602('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1f3ccf9..3aecd0d 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 _0xa800=['exports','beaver-logger/server','../components/auth/service','../config/environment','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use'];(function(_0x3d0528,_0x21a0b7){var _0x4ebb2d=function(_0x536ec8){while(--_0x536ec8){_0x3d0528['push'](_0x3d0528['shift']());}};_0x4ebb2d(++_0x21a0b7);}(_0xa800,0xe8));var _0x0a80=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xa800[_0x41c381];return _0x427981;};var beaverLogger=require(_0x0a80('0x0'));var express=require('express');var auth=require(_0x0a80('0x1'));var config=require(_0x0a80('0x2'));var router=express['Router']();var isProduction=config[_0x0a80('0x3')]===_0x0a80('0x4')||![];function clientSideLogs(_0x4d772f,_0x237066,_0x1caee2){var _0x5d7c8c=_0x4d772f['app'][_0x0a80('0x5')](_0x0a80('0x6'));if(!_0x5d7c8c){throw new Error(_0x0a80('0x7'));}return beaverLogger[_0x0a80('0x8')]({'uri':'/client-logs','logger':_0x5d7c8c,'enableCors':!isProduction})(_0x4d772f,_0x237066,_0x1caee2);}router[_0x0a80('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x0a80('0xa')]=router; \ No newline at end of file +var _0x34b6=['isAuthenticated','exports','beaver-logger/server','../components/auth/service','env','app','get','client-side-logger','expressEndpoint','/client-logs','use'];(function(_0x4d6fcc,_0x4a268e){var _0x258a12=function(_0x225e41){while(--_0x225e41){_0x4d6fcc['push'](_0x4d6fcc['shift']());}};_0x258a12(++_0x4a268e);}(_0x34b6,0x9c));var _0x634b=function(_0x238b5b,_0xba6fda){_0x238b5b=_0x238b5b-0x0;var _0x83a4f6=_0x34b6[_0x238b5b];return _0x83a4f6;};var beaverLogger=require(_0x634b('0x0'));var express=require('express');var auth=require(_0x634b('0x1'));var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x634b('0x2')]==='production'||![];function clientSideLogs(_0x248d1,_0x1321a7,_0x2fb0c6){var _0x4aa8ff=_0x248d1[_0x634b('0x3')][_0x634b('0x4')](_0x634b('0x5'));if(!_0x4aa8ff){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x634b('0x6')]({'uri':_0x634b('0x7'),'logger':_0x4aa8ff,'enableCors':!isProduction})(_0x248d1,_0x1321a7,_0x2fb0c6);}router[_0x634b('0x8')](auth[_0x634b('0x9')](),clientSideLogs);module[_0x634b('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 8fc66a4..40b887f 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 _0x859a=['Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x3842d5,_0x2e0785){var _0x1de345=function(_0x4b5fff){while(--_0x4b5fff){_0x3842d5['push'](_0x3842d5['shift']());}};_0x1de345(++_0x2e0785);}(_0x859a,0x1ad));var _0xa859=function(_0x1492dc,_0xd8fc5e){_0x1492dc=_0x1492dc-0x0;var _0x323019=_0x859a[_0x1492dc];return _0x323019;};'use strict';var Sequelize=require('sequelize');module[_0xa859('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa859('0x1')](_0xa859('0x2'),_0xa859('0x3'),_0xa859('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa859('0x1')](_0xa859('0x5'),_0xa859('0x6'))},'data1':{'type':Sequelize[_0xa859('0x7')],'comment':_0xa859('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0xa859('0x9')},'data3':{'type':Sequelize[_0xa859('0x7')],'comment':_0xa859('0xa')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xa859('0xb')],'comment':_0xa859('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa859('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0xa859('0xe')}}; \ No newline at end of file +var _0x27f5=['MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS'];(function(_0x3e3647,_0x13932f){var _0x23b83f=function(_0x52d08d){while(--_0x52d08d){_0x3e3647['push'](_0x3e3647['shift']());}};_0x23b83f(++_0x13932f);}(_0x27f5,0xe6));var _0x527f=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0x27f5[_0x45aa72];return _0x75adaa;};'use strict';var Sequelize=require(_0x527f('0x0'));module['exports']={'name':{'type':Sequelize[_0x527f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x527f('0x2')](_0x527f('0x3'),'Google',_0x527f('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x527f('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x527f('0x1')],'comment':_0x527f('0x6')},'data2':{'type':Sequelize[_0x527f('0x1')],'comment':_0x527f('0x7')},'data3':{'type':Sequelize[_0x527f('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x527f('0x8')},'data5':{'type':Sequelize[_0x527f('0x9')],'comment':_0x527f('0xa')},'data6':{'type':Sequelize[_0x527f('0x9')],'comment':_0x527f('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x527f('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c9ce571..22fd8ac 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 _0x1888=['../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','MicrosoftAzure','data3','catch','params','find','service','decryptString','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','base64','toString','ascii','parse','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','data6','emit','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger'];(function(_0xf25a1a,_0x5f1a4f){var _0x203ce7=function(_0x5b1b92){while(--_0x5b1b92){_0xf25a1a['push'](_0xf25a1a['shift']());}};_0x203ce7(++_0x5f1a4f);}(_0x1888,0x10c));var _0x8188=function(_0x1ce042,_0x38be56){_0x1ce042=_0x1ce042-0x0;var _0x304102=_0x1888[_0x1ce042];return _0x304102;};'use strict';var _=require(_0x8188('0x0'));var Redis=require(_0x8188('0x1'));var qs=require(_0x8188('0x2'));var encryptor=require(_0x8188('0x3'));var config=require('../../config/environment');var logger=require(_0x8188('0x4'))('api');var db=require(_0x8188('0x5'))['db'];var oauth=require(_0x8188('0x6'));config[_0x8188('0x7')]=_[_0x8188('0x8')](config[_0x8188('0x7')],{'host':_0x8188('0x9'),'port':0x18eb});var socket=require(_0x8188('0xa'))(new Redis(config[_0x8188('0x7')]));var redis=new Redis(config[_0x8188('0x7')]);function respondWithStatusCode(_0x3b9605,_0x28dc1a){_0x28dc1a=_0x28dc1a||0xcc;return function(_0x555c66){if(_0x555c66){return _0x3b9605[_0x8188('0xb')](_0x28dc1a);}return _0x3b9605[_0x8188('0xc')](_0x28dc1a)[_0x8188('0xd')]();};}function respondWithResult(_0x527ae8,_0x5f3608){_0x5f3608=_0x5f3608||0xc8;return function(_0x3b88b3){if(_0x3b88b3){return _0x527ae8[_0x8188('0xc')](_0x5f3608)[_0x8188('0xe')](_0x3b88b3);}};}function respondWithFilteredResult(_0x136f3d,_0x3f58ce){return function(_0x4fc2f7){if(_0x4fc2f7){var _0x2ed5fa=typeof _0x3f58ce[_0x8188('0xf')]==='undefined'&&typeof _0x3f58ce[_0x8188('0x10')]===_0x8188('0x11');var _0x1f5d12=_0x4fc2f7[_0x8188('0x12')];var _0x11fad5=_0x2ed5fa?0x0:_0x3f58ce['offset'];var _0x45034b=_0x2ed5fa?_0x4fc2f7[_0x8188('0x12')]:_0x3f58ce[_0x8188('0xf')]+_0x3f58ce['limit'];var _0x414d15;if(_0x45034b>=_0x1f5d12){_0x45034b=_0x1f5d12;_0x414d15=0xc8;}else{_0x414d15=0xce;}_0x136f3d[_0x8188('0xc')](_0x414d15);return _0x136f3d['set'](_0x8188('0x13'),_0x11fad5+'-'+_0x45034b+'/'+_0x1f5d12)[_0x8188('0xe')](_0x4fc2f7);}return null;};}function saveUpdates(_0x47b4e0){return function(_0x5c5962){if(_0x5c5962){return _0x5c5962[_0x8188('0x14')](_0x47b4e0)[_0x8188('0x15')](function(_0x2a3bb5){return _0x2a3bb5;});}return null;};}function removeEntity(_0x52d033){return function(_0x3d3c4c){if(_0x3d3c4c){return _0x3d3c4c[_0x8188('0x16')]()[_0x8188('0x15')](function(){_0x52d033[_0x8188('0xc')](0xcc)[_0x8188('0xd')]();});}};}function handleEntityNotFound(_0xdb9839){return function(_0x3adad3){if(!_0x3adad3){_0xdb9839[_0x8188('0xb')](0x194);}return _0x3adad3;};}function handleError(_0x3ab1b8,_0xd97179){_0xd97179=_0xd97179||0x1f4;return function(_0x5e1c00){logger[_0x8188('0x17')](_0x5e1c00[_0x8188('0x18')]);if(_0x5e1c00[_0x8188('0x19')]){delete _0x5e1c00[_0x8188('0x19')];}_0x3ab1b8['status'](_0xd97179)[_0x8188('0x1a')](_0x5e1c00);};}function maskClientSecret(_0x20e552){return _[_0x8188('0x1b')](_0x20e552[_0x8188('0x1c')](0x0,0x3),0x14,'*');}exports[_0x8188('0x1d')]=function(_0x4b6da5,_0x401200){var _0x5b923a={},_0x58520a={},_0x4f6bb2={'count':0x0,'rows':[]};var _0x57a906=_[_0x8188('0x1e')](db[_0x8188('0x1f')][_0x8188('0x20')],function(_0x30664b){return{'name':_0x30664b[_0x8188('0x21')],'type':_0x30664b[_0x8188('0x22')][_0x8188('0x23')]};});_0x58520a[_0x8188('0x24')]=_[_0x8188('0x1e')](_0x57a906,_0x8188('0x19'));_0x58520a[_0x8188('0x25')]=_[_0x8188('0x26')](_0x4b6da5[_0x8188('0x25')]);_0x58520a[_0x8188('0x27')]=_[_0x8188('0x28')](_0x58520a['model'],_0x58520a[_0x8188('0x25')]);_0x5b923a[_0x8188('0x29')]=_[_0x8188('0x28')](_0x58520a[_0x8188('0x24')],qs[_0x8188('0x2a')](_0x4b6da5[_0x8188('0x25')]['fields']));_0x5b923a[_0x8188('0x29')]=_0x5b923a['attributes'][_0x8188('0x2b')]?_0x5b923a[_0x8188('0x29')]:_0x58520a[_0x8188('0x24')];if(!_0x4b6da5[_0x8188('0x25')]['hasOwnProperty'](_0x8188('0x2c'))){_0x5b923a[_0x8188('0x10')]=qs['limit'](_0x4b6da5['query'][_0x8188('0x10')]);_0x5b923a[_0x8188('0xf')]=qs[_0x8188('0xf')](_0x4b6da5[_0x8188('0x25')][_0x8188('0xf')]);}_0x5b923a['order']=qs['sort'](_0x4b6da5[_0x8188('0x25')][_0x8188('0x2d')]);_0x5b923a['where']=qs['filters'](_[_0x8188('0x2e')](_0x4b6da5[_0x8188('0x25')],_0x58520a['filters']),_0x57a906);if(_0x4b6da5[_0x8188('0x25')][_0x8188('0x2f')]){_0x5b923a[_0x8188('0x30')]=_[_0x8188('0x31')](_0x5b923a[_0x8188('0x30')],{'$or':_[_0x8188('0x1e')](_0x57a906,function(_0x38ffc4){if(_0x38ffc4[_0x8188('0x22')]!==_0x8188('0x32')){var _0xd97e7a={};_0xd97e7a[_0x38ffc4[_0x8188('0x19')]]={'$like':'%'+_0x4b6da5[_0x8188('0x25')][_0x8188('0x2f')]+'%'};return _0xd97e7a;}})});}_0x5b923a=_[_0x8188('0x31')]({},_0x5b923a,_0x4b6da5[_0x8188('0x33')]);var _0x1cd2f7={'where':_0x5b923a['where']};return db[_0x8188('0x1f')][_0x8188('0x12')](_0x1cd2f7)['then'](function(_0x27ce){_0x4f6bb2[_0x8188('0x12')]=_0x27ce;if(_0x4b6da5[_0x8188('0x25')][_0x8188('0x34')]){_0x5b923a[_0x8188('0x35')]=[{'all':!![]}];}return db[_0x8188('0x1f')][_0x8188('0x36')](_0x5b923a);})['then'](function(_0x3ac3ae){_0x4f6bb2[_0x8188('0x37')]=_['map'](_0x3ac3ae,function(_0x1a1115){if(_0x1a1115['service']===_0x8188('0x38')){var _0x15ae03=encryptor['decryptString'](_0x1a1115[_0x8188('0x39')]);_0x1a1115['data3']=maskClientSecret(_0x15ae03);}return _0x1a1115;});return _0x4f6bb2;})[_0x8188('0x15')](respondWithFilteredResult(_0x401200,_0x5b923a))[_0x8188('0x3a')](handleError(_0x401200,null));};exports['show']=function(_0x3f2374,_0x1a5603){var _0x57a91d={'raw':!![],'where':{'id':_0x3f2374[_0x8188('0x3b')]['id']}},_0x234a01={};_0x234a01[_0x8188('0x24')]=_['keys'](db[_0x8188('0x1f')][_0x8188('0x20')]);_0x234a01[_0x8188('0x25')]=_[_0x8188('0x26')](_0x3f2374[_0x8188('0x25')]);_0x234a01['filters']=_[_0x8188('0x28')](_0x234a01[_0x8188('0x24')],_0x234a01[_0x8188('0x25')]);_0x57a91d[_0x8188('0x29')]=_[_0x8188('0x28')](_0x234a01[_0x8188('0x24')],qs[_0x8188('0x2a')](_0x3f2374['query'][_0x8188('0x2a')]));_0x57a91d[_0x8188('0x29')]=_0x57a91d[_0x8188('0x29')][_0x8188('0x2b')]?_0x57a91d[_0x8188('0x29')]:_0x234a01[_0x8188('0x24')];if(_0x3f2374[_0x8188('0x25')][_0x8188('0x34')]){_0x57a91d[_0x8188('0x35')]=[{'all':!![]}];}_0x57a91d=_['merge']({},_0x57a91d,_0x3f2374['options']);return db[_0x8188('0x1f')][_0x8188('0x3c')](_0x57a91d)[_0x8188('0x15')](handleEntityNotFound(_0x1a5603,null))['then'](function(_0x3e2b06){if(_0x3e2b06[_0x8188('0x3d')]==='MicrosoftAzure'){var _0x327cfc=encryptor[_0x8188('0x3e')](_0x3e2b06[_0x8188('0x39')]);_0x3e2b06['data3']=maskClientSecret(_0x327cfc);}return _0x3e2b06;})['then'](respondWithResult(_0x1a5603,null))[_0x8188('0x3a')](handleError(_0x1a5603,null));};exports[_0x8188('0x3f')]=function(_0x21c36b,_0x326442){if(!_0x21c36b['body'][_0x8188('0x19')])throw new Error(_0x8188('0x40'));if(!_0x21c36b[_0x8188('0x41')][_0x8188('0x3d')])throw new Error(_0x8188('0x42'));var _0x250806=db[_0x8188('0x1f')][_0x8188('0x20')]['service'][_0x8188('0x43')];if(!_0x250806['includes'](_0x21c36b[_0x8188('0x41')][_0x8188('0x3d')]))throw new Error(_0x8188('0x44')+_0x250806['join'](',\x20'));if(_0x21c36b[_0x8188('0x41')][_0x8188('0x3d')]===_0x8188('0x38')&&_0x21c36b[_0x8188('0x41')][_0x8188('0x39')]){_0x21c36b['body']['data3']=encryptor[_0x8188('0x45')](_0x21c36b[_0x8188('0x41')]['data3']);}return db[_0x8188('0x1f')][_0x8188('0x3f')](_0x21c36b[_0x8188('0x41')],{})[_0x8188('0x15')](respondWithResult(_0x326442,0xc9))[_0x8188('0x3a')](handleError(_0x326442,null));};exports['update']=function(_0x5d60d3,_0xad1018){if(_0x5d60d3['body']['id']){delete _0x5d60d3[_0x8188('0x41')]['id'];}return db['CloudProvider'][_0x8188('0x3c')]({'where':{'id':_0x5d60d3['params']['id']}})[_0x8188('0x15')](handleEntityNotFound(_0xad1018,null))[_0x8188('0x15')](function(_0xeeab68){if(_0xeeab68['service']==='MicrosoftAzure'&&_0x5d60d3[_0x8188('0x41')][_0x8188('0x39')]){_0x5d60d3[_0x8188('0x41')]['data3']=encryptor['encryptString'](_0x5d60d3[_0x8188('0x41')][_0x8188('0x39')]);}return _0xeeab68;})['then'](saveUpdates(_0x5d60d3[_0x8188('0x41')],null))[_0x8188('0x15')](respondWithResult(_0xad1018,null))[_0x8188('0x3a')](handleError(_0xad1018,null));};exports[_0x8188('0x16')]=function(_0x33904d,_0x52b721){return db[_0x8188('0x1f')][_0x8188('0x3c')]({'where':{'id':_0x33904d[_0x8188('0x3b')]['id']}})['then'](handleEntityNotFound(_0x52b721,null))[_0x8188('0x15')](removeEntity(_0x52b721,null))[_0x8188('0x3a')](handleError(_0x52b721,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2fc3b3,_0x472d07){return db[_0x8188('0x1f')][_0x8188('0x46')]({'where':{'id':_0x2fc3b3[_0x8188('0x3b')]['id']},'raw':!![]})[_0x8188('0x15')](function(_0x2cccf6){if(!_0x2cccf6)return _0x472d07[_0x8188('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x2cccf6,_0x2fc3b3[_0x8188('0x47')]['id'])};})[_0x8188('0x15')](respondWithResult(_0x472d07,null))[_0x8188('0x3a')](handleError(_0x472d07,null));};exports[_0x8188('0x48')]=function(_0x1af1fd,_0x4d25e4){var _0x3eaaa0=_0x1af1fd[_0x8188('0x41')];var _0x696cd8;var _0x37a80f;if(_0x3eaaa0[_0x8188('0x17')])throw _0x3eaaa0;redis[_0x8188('0x49')](_0x3eaaa0[_0x8188('0x4a')])[_0x8188('0x15')](function(_0x2a87d3){if(!_0x2a87d3)throw new Error(_0x8188('0x4b'));_0x696cd8=JSON['parse'](_0x2a87d3);var _0x315ef9=Buffer['from'](_0x3eaaa0[_0x8188('0x4a')],_0x8188('0x4c'))[_0x8188('0x4d')](_0x8188('0x4e'));_0x37a80f=JSON[_0x8188('0x4f')](_0x315ef9);if(!oauth['isValidIdToken'](_0x3eaaa0[_0x8188('0x50')],_0x696cd8[_0x8188('0x51')]))throw new Error(_0x8188('0x52'));redis[_0x8188('0x53')](_0x3eaaa0[_0x8188('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3eaaa0[_0x8188('0x54')],_0x696cd8);})[_0x8188('0x15')](function(_0xeb3fb1){_0x696cd8[_0x8188('0x55')]=_0xeb3fb1['access_token'];_0x696cd8[_0x8188('0x56')]=_0xeb3fb1['refresh_token'];return db['CloudProvider']['update']({'data5':_0x696cd8[_0x8188('0x55')],'data6':_0x696cd8[_0x8188('0x56')]},{'where':{'id':_0x696cd8['id']}});})[_0x8188('0x15')](function(){oauth['startRefreshInterval'](_0x696cd8);socket[_0x8188('0x57')]('microsoftAuthorization:success',{'id':_0x37a80f['id']});return;})[_0x8188('0x15')](respondWithStatusCode(_0x4d25e4,null))[_0x8188('0x3a')](function(_0x285566){if(_0x37a80f){socket[_0x8188('0x57')]('microsoftAuthorization:error',{'id':_0x37a80f['id']});}if(!_0x696cd8){logger[_0x8188('0x17')](_0x8188('0x58'),_0x285566);return _0x4d25e4[_0x8188('0xc')](0x1f4)[_0x8188('0x1a')](_0x285566['message']);}logger[_0x8188('0x17')](_0x8188('0x59'),_0x696cd8['id'],JSON[_0x8188('0x5a')](_0x285566));});}; \ No newline at end of file +var _0xcf4a=['Service\x20parameter\x20not\x20specified','service','values','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','data5','access_token','refresh_token','data6','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','MicrosoftAzure','data3','catch','show','params','find','decryptString','create','body','Name\x20parameter\x20not\x20specified'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xcf4a,0x1ca));var _0xacf4=function(_0x7d6407,_0x2f8ef6){_0x7d6407=_0x7d6407-0x0;var _0x66dc62=_0xcf4a[_0x7d6407];return _0x66dc62;};'use strict';var _=require(_0xacf4('0x0'));var Redis=require(_0xacf4('0x1'));var qs=require(_0xacf4('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xacf4('0x3'));var logger=require('../../config/logger')('api');var db=require(_0xacf4('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xacf4('0x5')]=_['defaults'](config[_0xacf4('0x5')],{'host':_0xacf4('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x479219,_0xc39474){_0xc39474=_0xc39474||0xcc;return function(_0x201bcd){if(_0x201bcd){return _0x479219[_0xacf4('0x7')](_0xc39474);}return _0x479219[_0xacf4('0x8')](_0xc39474)[_0xacf4('0x9')]();};}function respondWithResult(_0x3c231a,_0x11f9aa){_0x11f9aa=_0x11f9aa||0xc8;return function(_0x576d15){if(_0x576d15){return _0x3c231a['status'](_0x11f9aa)[_0xacf4('0xa')](_0x576d15);}};}function respondWithFilteredResult(_0x460b1f,_0x2c14c4){return function(_0x38477e){if(_0x38477e){var _0x5c68d1=typeof _0x2c14c4[_0xacf4('0xb')]==='undefined'&&typeof _0x2c14c4[_0xacf4('0xc')]==='undefined';var _0x2d4b9b=_0x38477e[_0xacf4('0xd')];var _0x1f841a=_0x5c68d1?0x0:_0x2c14c4['offset'];var _0x47f788=_0x5c68d1?_0x38477e['count']:_0x2c14c4['offset']+_0x2c14c4['limit'];var _0xbd6a7b;if(_0x47f788>=_0x2d4b9b){_0x47f788=_0x2d4b9b;_0xbd6a7b=0xc8;}else{_0xbd6a7b=0xce;}_0x460b1f['status'](_0xbd6a7b);return _0x460b1f[_0xacf4('0xe')](_0xacf4('0xf'),_0x1f841a+'-'+_0x47f788+'/'+_0x2d4b9b)['json'](_0x38477e);}return null;};}function saveUpdates(_0x3fdc1f){return function(_0x30bc0a){if(_0x30bc0a){return _0x30bc0a[_0xacf4('0x10')](_0x3fdc1f)[_0xacf4('0x11')](function(_0x3016e2){return _0x3016e2;});}return null;};}function removeEntity(_0x13a88b){return function(_0x5f4190){if(_0x5f4190){return _0x5f4190['destroy']()[_0xacf4('0x11')](function(){_0x13a88b['status'](0xcc)[_0xacf4('0x9')]();});}};}function handleEntityNotFound(_0x1e772a){return function(_0x25026e){if(!_0x25026e){_0x1e772a[_0xacf4('0x7')](0x194);}return _0x25026e;};}function handleError(_0x16a55e,_0x25a11a){_0x25a11a=_0x25a11a||0x1f4;return function(_0x26ba59){logger[_0xacf4('0x12')](_0x26ba59[_0xacf4('0x13')]);if(_0x26ba59[_0xacf4('0x14')]){delete _0x26ba59[_0xacf4('0x14')];}_0x16a55e[_0xacf4('0x8')](_0x25a11a)[_0xacf4('0x15')](_0x26ba59);};}function maskClientSecret(_0x1a6955){return _[_0xacf4('0x16')](_0x1a6955[_0xacf4('0x17')](0x0,0x3),0x14,'*');}exports[_0xacf4('0x18')]=function(_0x3a8fe5,_0xd87838){var _0xd8b315={},_0x1a8756={},_0x492be8={'count':0x0,'rows':[]};var _0x225c8c=_[_0xacf4('0x19')](db[_0xacf4('0x1a')][_0xacf4('0x1b')],function(_0x23dd4f){return{'name':_0x23dd4f['fieldName'],'type':_0x23dd4f[_0xacf4('0x1c')]['key']};});_0x1a8756['model']=_[_0xacf4('0x19')](_0x225c8c,_0xacf4('0x14'));_0x1a8756[_0xacf4('0x1d')]=_[_0xacf4('0x1e')](_0x3a8fe5[_0xacf4('0x1d')]);_0x1a8756[_0xacf4('0x1f')]=_['intersection'](_0x1a8756[_0xacf4('0x20')],_0x1a8756[_0xacf4('0x1d')]);_0xd8b315[_0xacf4('0x21')]=_[_0xacf4('0x22')](_0x1a8756[_0xacf4('0x20')],qs[_0xacf4('0x23')](_0x3a8fe5[_0xacf4('0x1d')][_0xacf4('0x23')]));_0xd8b315[_0xacf4('0x21')]=_0xd8b315[_0xacf4('0x21')][_0xacf4('0x24')]?_0xd8b315[_0xacf4('0x21')]:_0x1a8756[_0xacf4('0x20')];if(!_0x3a8fe5[_0xacf4('0x1d')][_0xacf4('0x25')]('nolimit')){_0xd8b315['limit']=qs['limit'](_0x3a8fe5[_0xacf4('0x1d')][_0xacf4('0xc')]);_0xd8b315['offset']=qs['offset'](_0x3a8fe5['query'][_0xacf4('0xb')]);}_0xd8b315['order']=qs[_0xacf4('0x26')](_0x3a8fe5[_0xacf4('0x1d')][_0xacf4('0x26')]);_0xd8b315[_0xacf4('0x27')]=qs[_0xacf4('0x1f')](_[_0xacf4('0x28')](_0x3a8fe5['query'],_0x1a8756[_0xacf4('0x1f')]),_0x225c8c);if(_0x3a8fe5['query']['filter']){_0xd8b315[_0xacf4('0x27')]=_[_0xacf4('0x29')](_0xd8b315[_0xacf4('0x27')],{'$or':_[_0xacf4('0x19')](_0x225c8c,function(_0x50eff4){if(_0x50eff4[_0xacf4('0x1c')]!=='VIRTUAL'){var _0x4452d3={};_0x4452d3[_0x50eff4[_0xacf4('0x14')]]={'$like':'%'+_0x3a8fe5[_0xacf4('0x1d')][_0xacf4('0x2a')]+'%'};return _0x4452d3;}})});}_0xd8b315=_[_0xacf4('0x29')]({},_0xd8b315,_0x3a8fe5[_0xacf4('0x2b')]);var _0x1b02d0={'where':_0xd8b315[_0xacf4('0x27')]};return db[_0xacf4('0x1a')]['count'](_0x1b02d0)['then'](function(_0x281d0d){_0x492be8[_0xacf4('0xd')]=_0x281d0d;if(_0x3a8fe5['query'][_0xacf4('0x2c')]){_0xd8b315[_0xacf4('0x2d')]=[{'all':!![]}];}return db['CloudProvider'][_0xacf4('0x2e')](_0xd8b315);})[_0xacf4('0x11')](function(_0x465772){_0x492be8[_0xacf4('0x2f')]=_[_0xacf4('0x19')](_0x465772,function(_0x517e75){if(_0x517e75['service']===_0xacf4('0x30')){var _0x1750f7=encryptor['decryptString'](_0x517e75[_0xacf4('0x31')]);_0x517e75[_0xacf4('0x31')]=maskClientSecret(_0x1750f7);}return _0x517e75;});return _0x492be8;})['then'](respondWithFilteredResult(_0xd87838,_0xd8b315))[_0xacf4('0x32')](handleError(_0xd87838,null));};exports[_0xacf4('0x33')]=function(_0x4431ac,_0x500036){var _0x52ffe8={'raw':!![],'where':{'id':_0x4431ac[_0xacf4('0x34')]['id']}},_0x5c1ed1={};_0x5c1ed1['model']=_[_0xacf4('0x1e')](db['CloudProvider']['rawAttributes']);_0x5c1ed1[_0xacf4('0x1d')]=_['keys'](_0x4431ac[_0xacf4('0x1d')]);_0x5c1ed1[_0xacf4('0x1f')]=_[_0xacf4('0x22')](_0x5c1ed1[_0xacf4('0x20')],_0x5c1ed1[_0xacf4('0x1d')]);_0x52ffe8[_0xacf4('0x21')]=_[_0xacf4('0x22')](_0x5c1ed1['model'],qs[_0xacf4('0x23')](_0x4431ac[_0xacf4('0x1d')][_0xacf4('0x23')]));_0x52ffe8['attributes']=_0x52ffe8[_0xacf4('0x21')]['length']?_0x52ffe8['attributes']:_0x5c1ed1[_0xacf4('0x20')];if(_0x4431ac[_0xacf4('0x1d')][_0xacf4('0x2c')]){_0x52ffe8['include']=[{'all':!![]}];}_0x52ffe8=_[_0xacf4('0x29')]({},_0x52ffe8,_0x4431ac[_0xacf4('0x2b')]);return db['CloudProvider'][_0xacf4('0x35')](_0x52ffe8)[_0xacf4('0x11')](handleEntityNotFound(_0x500036,null))['then'](function(_0x51cd20){if(_0x51cd20['service']===_0xacf4('0x30')){var _0x3a878f=encryptor[_0xacf4('0x36')](_0x51cd20[_0xacf4('0x31')]);_0x51cd20[_0xacf4('0x31')]=maskClientSecret(_0x3a878f);}return _0x51cd20;})[_0xacf4('0x11')](respondWithResult(_0x500036,null))[_0xacf4('0x32')](handleError(_0x500036,null));};exports[_0xacf4('0x37')]=function(_0xc5d6fc,_0x121fc6){if(!_0xc5d6fc[_0xacf4('0x38')][_0xacf4('0x14')])throw new Error(_0xacf4('0x39'));if(!_0xc5d6fc[_0xacf4('0x38')]['service'])throw new Error(_0xacf4('0x3a'));var _0x86deca=db[_0xacf4('0x1a')]['rawAttributes'][_0xacf4('0x3b')][_0xacf4('0x3c')];if(!_0x86deca['includes'](_0xc5d6fc['body'][_0xacf4('0x3b')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x86deca[_0xacf4('0x3d')](',\x20'));if(_0xc5d6fc[_0xacf4('0x38')][_0xacf4('0x3b')]===_0xacf4('0x30')&&_0xc5d6fc['body'][_0xacf4('0x31')]){_0xc5d6fc[_0xacf4('0x38')][_0xacf4('0x31')]=encryptor[_0xacf4('0x3e')](_0xc5d6fc[_0xacf4('0x38')][_0xacf4('0x31')]);}return db['CloudProvider']['create'](_0xc5d6fc[_0xacf4('0x38')],{})[_0xacf4('0x11')](respondWithResult(_0x121fc6,0xc9))['catch'](handleError(_0x121fc6,null));};exports[_0xacf4('0x10')]=function(_0x1dbbdc,_0x34f2b1){if(_0x1dbbdc[_0xacf4('0x38')]['id']){delete _0x1dbbdc[_0xacf4('0x38')]['id'];}return db['CloudProvider'][_0xacf4('0x35')]({'where':{'id':_0x1dbbdc['params']['id']}})[_0xacf4('0x11')](handleEntityNotFound(_0x34f2b1,null))[_0xacf4('0x11')](function(_0x292c39){if(_0x292c39[_0xacf4('0x3b')]===_0xacf4('0x30')&&_0x1dbbdc['body'][_0xacf4('0x31')]){_0x1dbbdc[_0xacf4('0x38')][_0xacf4('0x31')]=encryptor['encryptString'](_0x1dbbdc['body'][_0xacf4('0x31')]);}return _0x292c39;})[_0xacf4('0x11')](saveUpdates(_0x1dbbdc[_0xacf4('0x38')],null))['then'](respondWithResult(_0x34f2b1,null))[_0xacf4('0x32')](handleError(_0x34f2b1,null));};exports['destroy']=function(_0x4e12a3,_0x11fb88){return db['CloudProvider']['find']({'where':{'id':_0x4e12a3[_0xacf4('0x34')]['id']}})[_0xacf4('0x11')](handleEntityNotFound(_0x11fb88,null))[_0xacf4('0x11')](removeEntity(_0x11fb88,null))[_0xacf4('0x32')](handleError(_0x11fb88,null));};exports[_0xacf4('0x3f')]=function(_0x283e6a,_0x7de92a){return db['CloudProvider'][_0xacf4('0x40')]({'where':{'id':_0x283e6a['params']['id']},'raw':!![]})[_0xacf4('0x11')](function(_0x30388f){if(!_0x30388f)return _0x7de92a[_0xacf4('0x7')](0x194);return{'url':oauth[_0xacf4('0x41')](_0x30388f,_0x283e6a[_0xacf4('0x42')]['id'])};})[_0xacf4('0x11')](respondWithResult(_0x7de92a,null))[_0xacf4('0x32')](handleError(_0x7de92a,null));};exports['oauth2MicrosoftCallback']=function(_0x4b81f8,_0x5cdd59){var _0x2bff50=_0x4b81f8[_0xacf4('0x38')];var _0x484e85;var _0x435628;if(_0x2bff50[_0xacf4('0x12')])throw _0x2bff50;redis['get'](_0x2bff50[_0xacf4('0x43')])['then'](function(_0x4d1212){if(!_0x4d1212)throw new Error(_0xacf4('0x44'));_0x484e85=JSON[_0xacf4('0x45')](_0x4d1212);var _0x1c5d66=Buffer[_0xacf4('0x46')](_0x2bff50[_0xacf4('0x43')],_0xacf4('0x47'))['toString'](_0xacf4('0x48'));_0x435628=JSON[_0xacf4('0x45')](_0x1c5d66);if(!oauth[_0xacf4('0x49')](_0x2bff50['id_token'],_0x484e85[_0xacf4('0x4a')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xacf4('0x4b')](_0x2bff50[_0xacf4('0x43')]);return oauth[_0xacf4('0x4c')](_0x2bff50['code'],_0x484e85);})[_0xacf4('0x11')](function(_0x32bc4a){_0x484e85[_0xacf4('0x4d')]=_0x32bc4a[_0xacf4('0x4e')];_0x484e85['data6']=_0x32bc4a[_0xacf4('0x4f')];return db['CloudProvider'][_0xacf4('0x10')]({'data5':_0x484e85[_0xacf4('0x4d')],'data6':_0x484e85[_0xacf4('0x50')]},{'where':{'id':_0x484e85['id']}});})[_0xacf4('0x11')](function(){oauth['startRefreshInterval'](_0x484e85);socket[_0xacf4('0x51')](_0xacf4('0x52'),{'id':_0x435628['id']});return;})['then'](respondWithStatusCode(_0x5cdd59,null))['catch'](function(_0x12b714){if(_0x435628){socket[_0xacf4('0x51')]('microsoftAuthorization:error',{'id':_0x435628['id']});}if(!_0x484e85){logger[_0xacf4('0x12')]('Invalid\x20authentication\x20state\x20parameter',_0x12b714);return _0x5cdd59[_0xacf4('0x8')](0x1f4)[_0xacf4('0x15')](_0x12b714[_0xacf4('0x53')]);}logger['error'](_0xacf4('0x54'),_0x484e85['id'],JSON[_0xacf4('0x55')](_0x12b714));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b43e655..8b37133 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 _0x2968=['CloudProvider','cloud_providers','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x44213c,_0x1e17d7){var _0x4c04bb=function(_0x3df8e4){while(--_0x3df8e4){_0x44213c['push'](_0x44213c['shift']());}};_0x4c04bb(++_0x1e17d7);}(_0x2968,0x178));var _0x8296=function(_0x37d959,_0x8e3446){_0x37d959=_0x37d959-0x0;var _0x3e5a73=_0x2968[_0x37d959];return _0x3e5a73;};'use strict';var _=require(_0x8296('0x0'));var util=require(_0x8296('0x1'));var logger=require(_0x8296('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8296('0x3'));var rp=require(_0x8296('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8296('0x5'));var config=require('../../config/environment');var attributes=require(_0x8296('0x6'));module[_0x8296('0x7')]=function(_0x30a21a,_0x4a244f){return _0x30a21a[_0x8296('0x8')](_0x8296('0x9'),attributes,{'tableName':_0x8296('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ce=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x317bf0,_0x277c03){var _0x225932=function(_0x2c280e){while(--_0x2c280e){_0x317bf0['push'](_0x317bf0['shift']());}};_0x225932(++_0x277c03);}(_0x53ce,0xfa));var _0xe53c=function(_0x10ded1,_0xabc809){_0x10ded1=_0x10ded1-0x0;var _0x2a22a0=_0x53ce[_0x10ded1];return _0x2a22a0;};'use strict';var _=require(_0xe53c('0x0'));var util=require(_0xe53c('0x1'));var logger=require(_0xe53c('0x2'))(_0xe53c('0x3'));var moment=require('moment');var BPromise=require(_0xe53c('0x4'));var rp=require(_0xe53c('0x5'));var fs=require('fs');var path=require(_0xe53c('0x6'));var rimraf=require('rimraf');var config=require(_0xe53c('0x7'));var attributes=require(_0xe53c('0x8'));module['exports']=function(_0x555f24,_0x3bb10b){return _0x555f24[_0xe53c('0x9')](_0xe53c('0xa'),attributes,{'tableName':_0xe53c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 5d6b5d3..b69a4d5 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 _0x4e93=['key','value','oauth2/','set','iss','issuer','audience','unix','exp','resolve','data3','findOne','then','refresh_token','data1','decryptString','POST','data2','data5','access_token','data6','CloudProvider','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','inspect','error','exports','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','code','from','stringify','toString','base64','hex','data4','response_mode','nonce','prompt'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x4e93,0xaf));var _0x34e9=function(_0x296e52,_0x428515){_0x296e52=_0x296e52-0x0;var _0x286070=_0x4e93[_0x296e52];return _0x286070;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x34e9('0x0'));var moment=require(_0x34e9('0x1'));var Redis=require(_0x34e9('0x2'));var rp=require('request-promise');var util=require(_0x34e9('0x3'));var encryptor=require(_0x34e9('0x4'));var config=require(_0x34e9('0x5'));var logger=require(_0x34e9('0x6'))(_0x34e9('0x7'));var schedule=require(_0x34e9('0x8'));var db=require(_0x34e9('0x9'))['db'];config[_0x34e9('0xa')]=_[_0x34e9('0xb')](config[_0x34e9('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x34e9('0xa')]);var MICROSOFT_AUTH_URL=_0x34e9('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x34e9('0xd'),_0x34e9('0xe'),_0x34e9('0xf'),_0x34e9('0x10'),_0x34e9('0x11'),_0x34e9('0x12'),_0x34e9('0x13')],'Dynamics365':[_0x34e9('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x34e9('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x34e9('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3455cf){var _0x24a11b=_[_0x34e9('0x16')](AZURE_AUTH_SCOPES[_0x3455cf['type']]);if(_0x3455cf[_0x34e9('0x17')]==='Dynamics365')_0x24a11b['push'](_0x3455cf[_0x34e9('0x18')]+_0x34e9('0x19'));return _0x24a11b[_0x34e9('0x1a')]('\x20');}function getAccessTokenScope(_0x29aa69){if(_0x29aa69[_0x34e9('0x17')]===_0x34e9('0x1b'))return _0x34e9('0x11');if(_0x29aa69[_0x34e9('0x17')]===_0x34e9('0x1c'))return _0x29aa69[_0x34e9('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x590ca2,_0x49d903){var _0xe03796=MICROSOFT_AUTH_URL[_0x34e9('0x1d')](_0x34e9('0x1e'),_0x590ca2['data2']);var _0x29c013=[_0x34e9('0x1f'),'id_token'];var _0x77751=Buffer[_0x34e9('0x20')](JSON[_0x34e9('0x21')]({'id':_0x49d903}))[_0x34e9('0x22')](_0x34e9('0x23'));var _0xc41635=crypto['randomBytes'](0x10)[_0x34e9('0x22')](_0x34e9('0x24'));var _0x2bd94b=getAuthorizationScopes(_0x590ca2);var _0x1b41d1=[{'key':'client_id','value':_0x590ca2['data1']},{'key':'response_type','value':encodeURIComponent(_0x29c013['join']('\x20'))},{'key':'redirect_uri','value':_0x590ca2[_0x34e9('0x25')]},{'key':_0x34e9('0x26'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x2bd94b)},{'key':'state','value':_0x77751},{'key':_0x34e9('0x27'),'value':_0xc41635},{'key':_0x34e9('0x28'),'value':'login'}];var _0x3827c3=_0xe03796+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x34e9('0x16')](_0x1b41d1,function(_0x3d54f6){return _0x3d54f6[_0x34e9('0x29')]+'='+_0x3d54f6[_0x34e9('0x2a')];})[_0x34e9('0x1a')]('&');_0x590ca2['oauth2Claims']={'issuer':_0xe03796[_0x34e9('0x1d')](_0x34e9('0x2b'),''),'audience':_0x590ca2['data1'],'state':_0x77751,'nonce':_0xc41635};redis[_0x34e9('0x2c')](_0x77751,JSON[_0x34e9('0x21')](_0x590ca2));return _0x3827c3;}function isValidIdToken(_0x530036,_0x1925d8){try{var _0x414bfb=jwt['decode'](_0x530036,{'complete':!![]});var _0x39637d=_0x414bfb['payload'];if(_0x39637d[_0x34e9('0x2d')]!==_0x1925d8[_0x34e9('0x2e')])return![];if(_0x39637d['aud']!==_0x1925d8[_0x34e9('0x2f')])return![];if(_0x39637d['nonce']!==_0x1925d8[_0x34e9('0x27')])return![];if(moment()['isAfter'](moment[_0x34e9('0x30')](_0x39637d[_0x34e9('0x31')])))return![];return!![];}catch(_0x5322ea){throw _0x5322ea;}}function refreshOauth2MicrosoftAccessToken(_0x2a96d4){return Promise[_0x34e9('0x32')]()['then'](function(){if(_0x2a96d4[_0x34e9('0x33')])return _0x2a96d4;return db['CloudProvider'][_0x34e9('0x34')]({'where':{'id':_0x2a96d4['id']},'raw':!![]});})[_0x34e9('0x35')](function(_0x879698){var _0x34f83f={'grant_type':_0x34e9('0x36'),'refresh_token':_0x879698['data6'],'scope':getAccessTokenScope(_0x879698),'redirect_uri':_0x879698[_0x34e9('0x25')],'client_id':_0x879698[_0x34e9('0x37')],'client_secret':encryptor[_0x34e9('0x38')](_0x879698[_0x34e9('0x33')])};var _0xb7c5bc={'method':_0x34e9('0x39'),'uri':MICROSOFT_AUTH_URL[_0x34e9('0x1d')](_0x34e9('0x1e'),_0x879698[_0x34e9('0x3a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x34f83f,'json':!![]};return rp(_0xb7c5bc);})[_0x34e9('0x35')](function(_0x32d75a){_0x2a96d4[_0x34e9('0x3b')]=_0x32d75a[_0x34e9('0x3c')];_0x2a96d4[_0x34e9('0x3d')]=_0x32d75a[_0x34e9('0x36')];return db[_0x34e9('0x3e')][_0x34e9('0x3f')]({'data5':_0x2a96d4['data5'],'data6':_0x2a96d4['data6']},{'where':{'id':_0x2a96d4['id']}});})[_0x34e9('0x35')](function(){return _0x2a96d4;})['catch'](function(_0x6fd345){logger['error'](_0x34e9('0x40'),_0x2a96d4['id'],_0x6fd345);});}function getOauth2MicrosoftAccessToken(_0x372790,_0x4c9083){var _0x420861={'grant_type':_0x34e9('0x41'),'code':_0x372790,'scope':getAccessTokenScope(_0x4c9083),'redirect_uri':_0x4c9083[_0x34e9('0x25')],'client_id':_0x4c9083['data1'],'client_secret':encryptor['decryptString'](_0x4c9083[_0x34e9('0x33')])};var _0x44d20a={'method':_0x34e9('0x39'),'uri':MICROSOFT_AUTH_URL[_0x34e9('0x1d')]('{TENANT_ID}',_0x4c9083[_0x34e9('0x3a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x420861,'json':!![]};return rp(_0x44d20a);}function startRefreshInterval(_0x362adf){var _0x3bb24c=schedule[_0x34e9('0x42')];if(_0x3bb24c[_0x362adf['id']])clearInterval(_0x3bb24c[_0x362adf['id']]);_0x3bb24c[_0x362adf['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x34e9('0x43')](this,{'id':_0x362adf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x34e9('0x42')]=_0x3bb24c;}function startAllRefreshIntervals(){return db[_0x34e9('0x3e')][_0x34e9('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x34e9('0x35')](function(_0x54ff71){var _0x38f7d7=_0x54ff71['map'](function(_0x4bf4f0){return refreshOauth2MicrosoftAccessToken(_0x4bf4f0)[_0x34e9('0x35')](function(_0xd204c9){startRefreshInterval(_0xd204c9);});});return Promise['all'](_0x38f7d7);})['catch'](function(_0x387fde){var _0x3cc856=_0x387fde?util[_0x34e9('0x45')](_0x387fde,{'showHidden':![],'depth':null}):'';logger[_0x34e9('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3cc856);});}module[_0x34e9('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x644e=['from','toString','randomBytes','hex','client_id','data1','join','data4','response_mode','form_post','scope','state','nonce','login','value','oauth2Claims','replace','oauth2/','stringify','decode','payload','iss','aud','audience','isAfter','unix','exp','resolve','then','data3','findOne','data6','POST','data5','access_token','refresh_token','CloudProvider','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','map','type','push','/.default','Outlook365','data7','{TENANT_ID}','data2','code','id_token'];(function(_0x521547,_0x40a738){var _0x458b83=function(_0x297db8){while(--_0x297db8){_0x521547['push'](_0x521547['shift']());}};_0x458b83(++_0x40a738);}(_0x644e,0xc6));var _0xe644=function(_0xa54d2b,_0x1d3ae6){_0xa54d2b=_0xa54d2b-0x0;var _0x342d50=_0x644e[_0xa54d2b];return _0x342d50;};'use strict';var _=require(_0xe644('0x0'));var crypto=require(_0xe644('0x1'));var jwt=require(_0xe644('0x2'));var moment=require(_0xe644('0x3'));var Redis=require(_0xe644('0x4'));var rp=require(_0xe644('0x5'));var util=require(_0xe644('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0xe644('0x7'));var logger=require(_0xe644('0x8'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xe644('0x9'))['db'];config[_0xe644('0xa')]=_[_0xe644('0xb')](config[_0xe644('0xa')],{'host':_0xe644('0xc'),'port':0x18eb});var redis=new Redis(config[_0xe644('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xe644('0xd'),_0xe644('0xe'),_0xe644('0xf'),_0xe644('0x10'),_0xe644('0x11'),_0xe644('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0xe644('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xe644('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x2117a6){var _0x58bd62=_[_0xe644('0x14')](AZURE_AUTH_SCOPES[_0x2117a6[_0xe644('0x15')]]);if(_0x2117a6[_0xe644('0x15')]==='Dynamics365')_0x58bd62[_0xe644('0x16')](_0x2117a6['data7']+_0xe644('0x17'));return _0x58bd62['join']('\x20');}function getAccessTokenScope(_0x414ee8){if(_0x414ee8[_0xe644('0x15')]===_0xe644('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x414ee8['type']==='Dynamics365')return _0x414ee8[_0xe644('0x19')]+_0xe644('0x17');}function generateMicrosoftAuthorizationUrl(_0x24f905,_0x328766){var _0x56da8a=MICROSOFT_AUTH_URL['replace'](_0xe644('0x1a'),_0x24f905[_0xe644('0x1b')]);var _0x587815=[_0xe644('0x1c'),_0xe644('0x1d')];var _0x430881=Buffer[_0xe644('0x1e')](JSON['stringify']({'id':_0x328766}))[_0xe644('0x1f')]('base64');var _0x25b543=crypto[_0xe644('0x20')](0x10)['toString'](_0xe644('0x21'));var _0x3efec6=getAuthorizationScopes(_0x24f905);var _0xdf9ecd=[{'key':_0xe644('0x22'),'value':_0x24f905[_0xe644('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x587815[_0xe644('0x24')]('\x20'))},{'key':'redirect_uri','value':_0x24f905[_0xe644('0x25')]},{'key':_0xe644('0x26'),'value':_0xe644('0x27')},{'key':_0xe644('0x28'),'value':encodeURIComponent(_0x3efec6)},{'key':_0xe644('0x29'),'value':_0x430881},{'key':_0xe644('0x2a'),'value':_0x25b543},{'key':'prompt','value':_0xe644('0x2b')}];var _0x5ea003=_0x56da8a+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xe644('0x14')](_0xdf9ecd,function(_0x1b4d8c){return _0x1b4d8c['key']+'='+_0x1b4d8c[_0xe644('0x2c')];})[_0xe644('0x24')]('&');_0x24f905[_0xe644('0x2d')]={'issuer':_0x56da8a[_0xe644('0x2e')](_0xe644('0x2f'),''),'audience':_0x24f905[_0xe644('0x23')],'state':_0x430881,'nonce':_0x25b543};redis['set'](_0x430881,JSON[_0xe644('0x30')](_0x24f905));return _0x5ea003;}function isValidIdToken(_0x4ee30f,_0x49cd80){try{var _0xab3ba3=jwt[_0xe644('0x31')](_0x4ee30f,{'complete':!![]});var _0x422624=_0xab3ba3[_0xe644('0x32')];if(_0x422624[_0xe644('0x33')]!==_0x49cd80['issuer'])return![];if(_0x422624[_0xe644('0x34')]!==_0x49cd80[_0xe644('0x35')])return![];if(_0x422624[_0xe644('0x2a')]!==_0x49cd80['nonce'])return![];if(moment()[_0xe644('0x36')](moment[_0xe644('0x37')](_0x422624[_0xe644('0x38')])))return![];return!![];}catch(_0x4d28fa){throw _0x4d28fa;}}function refreshOauth2MicrosoftAccessToken(_0x210de2){return Promise[_0xe644('0x39')]()[_0xe644('0x3a')](function(){if(_0x210de2[_0xe644('0x3b')])return _0x210de2;return db['CloudProvider'][_0xe644('0x3c')]({'where':{'id':_0x210de2['id']},'raw':!![]});})['then'](function(_0x14afd6){var _0x254107={'grant_type':'refresh_token','refresh_token':_0x14afd6[_0xe644('0x3d')],'scope':getAccessTokenScope(_0x14afd6),'redirect_uri':_0x14afd6[_0xe644('0x25')],'client_id':_0x14afd6[_0xe644('0x23')],'client_secret':encryptor['decryptString'](_0x14afd6[_0xe644('0x3b')])};var _0x7fd38={'method':_0xe644('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xe644('0x2e')](_0xe644('0x1a'),_0x14afd6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x254107,'json':!![]};return rp(_0x7fd38);})['then'](function(_0x1801e6){_0x210de2[_0xe644('0x3f')]=_0x1801e6[_0xe644('0x40')];_0x210de2[_0xe644('0x3d')]=_0x1801e6[_0xe644('0x41')];return db[_0xe644('0x42')]['update']({'data5':_0x210de2[_0xe644('0x3f')],'data6':_0x210de2['data6']},{'where':{'id':_0x210de2['id']}});})[_0xe644('0x3a')](function(){return _0x210de2;})[_0xe644('0x43')](function(_0x565f31){logger[_0xe644('0x44')](_0xe644('0x45'),_0x210de2['id'],_0x565f31);});}function getOauth2MicrosoftAccessToken(_0x59d7ee,_0x1dece5){var _0xb35d18={'grant_type':'authorization_code','code':_0x59d7ee,'scope':getAccessTokenScope(_0x1dece5),'redirect_uri':_0x1dece5[_0xe644('0x25')],'client_id':_0x1dece5[_0xe644('0x23')],'client_secret':encryptor[_0xe644('0x46')](_0x1dece5[_0xe644('0x3b')])};var _0x51f417={'method':_0xe644('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xe644('0x2e')]('{TENANT_ID}',_0x1dece5[_0xe644('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xb35d18,'json':!![]};return rp(_0x51f417);}function startRefreshInterval(_0x121f66){var _0x506360=schedule[_0xe644('0x47')];if(_0x506360[_0x121f66['id']])clearInterval(_0x506360[_0x121f66['id']]);_0x506360[_0x121f66['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x121f66['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe644('0x47')]=_0x506360;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xe644('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x340779){var _0x1937b8=_0x340779[_0xe644('0x14')](function(_0x333b6a){return refreshOauth2MicrosoftAccessToken(_0x333b6a)['then'](function(_0x26d38f){startRefreshInterval(_0x26d38f);});});return Promise[_0xe644('0x49')](_0x1937b8);})[_0xe644('0x43')](function(_0xd1765a){var _0x16d0a0=_0xd1765a?util['inspect'](_0xd1765a,{'showHidden':![],'depth':null}):'';logger[_0xe644('0x44')](_0xe644('0x4a'),_0x16d0a0);});}module[_0xe644('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index e92ff77..54e72d9 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 _0x30d6=['client','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x39eb48,_0x5da47c){var _0x10f0b9=function(_0x2c1631){while(--_0x2c1631){_0x39eb48['push'](_0x39eb48['shift']());}};_0x10f0b9(++_0x5da47c);}(_0x30d6,0x1b0));var _0x630d=function(_0x5ea710,_0x40a4f8){_0x5ea710=_0x5ea710-0x0;var _0x5397e2=_0x30d6[_0x5ea710];return _0x5397e2;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var moment=require('moment');var BPromise=require(_0x630d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x630d('0x3'));var db=require(_0x630d('0x4'))['db'];var utils=require(_0x630d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x630d('0x6'));var jayson=require(_0x630d('0x7'));var client=jayson[_0x630d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8950bb,_0x3aa6f4,_0x2c1b77){return new BPromise(function(_0x4b60c1,_0x533e4f){return client[_0x630d('0x9')](_0x8950bb,_0x2c1b77)[_0x630d('0xa')](function(_0x24d260){logger[_0x630d('0xb')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x630d('0xc'));logger[_0x630d('0xd')](_0x630d('0xe'),_0x3aa6f4,_0x630d('0xc'),JSON[_0x630d('0xf')](_0x24d260));if(_0x24d260[_0x630d('0x10')]){if(_0x24d260[_0x630d('0x10')][_0x630d('0x11')]===0x1f4){logger[_0x630d('0x10')](_0x630d('0x12'),_0x3aa6f4,_0x24d260['error'][_0x630d('0x13')]);return _0x533e4f(_0x24d260['error'][_0x630d('0x13')]);}logger[_0x630d('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);return _0x4b60c1(_0x24d260[_0x630d('0x10')][_0x630d('0x13')]);}else{logger[_0x630d('0xb')](_0x630d('0x12'),_0x3aa6f4,_0x630d('0xc'));_0x4b60c1(_0x24d260[_0x630d('0x14')]['message']);}})[_0x630d('0x15')](function(_0x4db79d){logger[_0x630d('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3aa6f4,_0x4db79d);_0x533e4f(_0x4db79d);});});} \ No newline at end of file +var _0x6343=['message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x6b3795,_0x320773){var _0x590497=function(_0x29524d){while(--_0x29524d){_0x6b3795['push'](_0x6b3795['shift']());}};_0x590497(++_0x320773);}(_0x6343,0x168));var _0x3634=function(_0x2b6844,_0x18e67f){_0x2b6844=_0x2b6844-0x0;var _0x45ee12=_0x6343[_0x2b6844];return _0x45ee12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('CloudProvider,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 989ab21..9a7e152 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x30286f,_0x225784){var _0x56abfc=function(_0x474e71){while(--_0x474e71){_0x30286f['push'](_0x30286f['shift']());}};_0x56abfc(++_0x225784);}(_0xdb28,0x106));var _0x8db2=function(_0x5c44b0,_0x57678f){_0x5c44b0=_0x5c44b0-0x0;var _0x51126a=_0xdb28[_0x5c44b0];return _0x51126a;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x650ac5,_0x562e47){_0x650ac5=_0x650ac5-0x0;var _0x16315f=_0x7a54[_0x650ac5];return _0x16315f;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e96ec64..5ef3cab 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 _0x228c=['STRING','exports'];(function(_0x20db70,_0x2e78ac){var _0x29f2ed=function(_0x683d23){while(--_0x683d23){_0x20db70['push'](_0x20db70['shift']());}};_0x29f2ed(++_0x2e78ac);}(_0x228c,0x157));var _0xc228=function(_0x55049c,_0x54e15a){_0x55049c=_0x55049c-0x0;var _0x520c63=_0x228c[_0x55049c];return _0x520c63;};'use strict';var Sequelize=require('sequelize');module[_0xc228('0x0')]={'name':{'type':Sequelize[_0xc228('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc228('0x1')]},'companyId':{'type':Sequelize[_0xc228('0x1')]},'website':{'type':Sequelize[_0xc228('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc228('0x1')]},'type':{'type':Sequelize[_0xc228('0x1')]},'street':{'type':Sequelize[_0xc228('0x1')]},'postalCode':{'type':Sequelize[_0xc228('0x1')]},'city':{'type':Sequelize[_0xc228('0x1')]},'country':{'type':Sequelize[_0xc228('0x1')]},'email':{'type':Sequelize[_0xc228('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc228('0x1')]},'sStreet':{'type':Sequelize[_0xc228('0x1')]},'sPostalCode':{'type':Sequelize[_0xc228('0x1')]},'sCity':{'type':Sequelize[_0xc228('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc228('0x1')]}}; \ No newline at end of file +var _0x0d54=['sequelize','name','STRING'];(function(_0x138cd7,_0x542731){var _0x142815=function(_0x48ed4c){while(--_0x48ed4c){_0x138cd7['push'](_0x138cd7['shift']());}};_0x142815(++_0x542731);}(_0x0d54,0x1c2));var _0x40d5=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x0d54[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x40d5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x40d5('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x40d5('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x40d5('0x2')]},'phone':{'type':Sequelize[_0x40d5('0x2')]},'fax':{'type':Sequelize[_0x40d5('0x2')]},'type':{'type':Sequelize[_0x40d5('0x2')]},'street':{'type':Sequelize[_0x40d5('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x40d5('0x2')]},'email':{'type':Sequelize[_0x40d5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x40d5('0x2')]},'sCountry':{'type':Sequelize[_0x40d5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f8268db..b12748b 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 _0x9891=['filter','merge','map','options','includeAll','include','findAll','rows','catch','show','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','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/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x452c43,_0x31328b){var _0x2a07d7=function(_0x4b22eb){while(--_0x4b22eb){_0x452c43['push'](_0x452c43['shift']());}};_0x2a07d7(++_0x31328b);}(_0x9891,0x178));var _0x1989=function(_0x1fd3e2,_0x1a6772){_0x1fd3e2=_0x1fd3e2-0x0;var _0x5a9210=_0x9891[_0x1fd3e2];return _0x5a9210;};'use strict';var emlformat=require(_0x1989('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1989('0x1'));var jsonpatch=require(_0x1989('0x2'));var rp=require('request-promise');var moment=require(_0x1989('0x3'));var BPromise=require(_0x1989('0x4'));var Mustache=require('mustache');var util=require(_0x1989('0x5'));var path=require(_0x1989('0x6'));var sox=require('sox');var csv=require(_0x1989('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1989('0x8'));var _=require(_0x1989('0x9'));var squel=require(_0x1989('0xa'));var crypto=require('crypto');var jsforce=require(_0x1989('0xb'));var deskjs=require(_0x1989('0xc'));var toCsv=require(_0x1989('0x7'));var querystring=require(_0x1989('0xd'));var Papa=require(_0x1989('0xe'));var Redis=require(_0x1989('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1989('0x10'));var as=require(_0x1989('0x11'));var hardwareService=require(_0x1989('0x12'));var logger=require(_0x1989('0x13'))(_0x1989('0x14'));var utils=require(_0x1989('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1989('0x16'));var db=require(_0x1989('0x17'))['db'];function respondWithStatusCode(_0x365996,_0x1db6e1){_0x1db6e1=_0x1db6e1||0xcc;return function(_0x497144){if(_0x497144){return _0x365996[_0x1989('0x18')](_0x1db6e1);}return _0x365996['status'](_0x1db6e1)[_0x1989('0x19')]();};}function respondWithResult(_0x40d876,_0x32f1a1){_0x32f1a1=_0x32f1a1||0xc8;return function(_0x369243){if(_0x369243){return _0x40d876[_0x1989('0x1a')](_0x32f1a1)[_0x1989('0x1b')](_0x369243);}};}function respondWithFilteredResult(_0x4c408e,_0x4e1681){return function(_0x359549){if(_0x359549){var _0x14154c=typeof _0x4e1681[_0x1989('0x1c')]==='undefined'&&typeof _0x4e1681[_0x1989('0x1d')]===_0x1989('0x1e');var _0x173e24=_0x359549[_0x1989('0x1f')];var _0x249d50=_0x14154c?0x0:_0x4e1681[_0x1989('0x1c')];var _0x210c78=_0x14154c?_0x359549['count']:_0x4e1681[_0x1989('0x1c')]+_0x4e1681['limit'];var _0x6da98e;if(_0x210c78>=_0x173e24){_0x210c78=_0x173e24;_0x6da98e=0xc8;}else{_0x6da98e=0xce;}_0x4c408e[_0x1989('0x1a')](_0x6da98e);return _0x4c408e[_0x1989('0x20')](_0x1989('0x21'),_0x249d50+'-'+_0x210c78+'/'+_0x173e24)[_0x1989('0x1b')](_0x359549);}return null;};}function patchUpdates(_0x5c7614){return function(_0x7eba53){try{jsonpatch[_0x1989('0x22')](_0x7eba53,_0x5c7614,!![]);}catch(_0x4b7840){return BPromise['reject'](_0x4b7840);}return _0x7eba53[_0x1989('0x23')]();};}function saveUpdates(_0x5b5d2a,_0x4fc834){return function(_0x362e85){if(_0x362e85){return _0x362e85['update'](_0x5b5d2a)[_0x1989('0x24')](function(_0x2e0dda){return _0x2e0dda;});}return null;};}function removeEntity(_0x130b9a,_0x2046b9){return function(_0x59a4db){if(_0x59a4db){return _0x59a4db[_0x1989('0x25')]()['then'](function(){var _0x4be962=_0x59a4db[_0x1989('0x26')]({'plain':!![]});var _0x58d7d3=_0x1989('0x27');return db[_0x1989('0x28')][_0x1989('0x25')]({'where':{'type':_0x58d7d3,'resourceId':_0x4be962['id']}})[_0x1989('0x24')](function(){return _0x59a4db;});})[_0x1989('0x24')](function(){_0x130b9a[_0x1989('0x1a')](0xcc)[_0x1989('0x19')]();});}};}function handleEntityNotFound(_0x5686d6,_0x386ec6){return function(_0x568c16){if(!_0x568c16){_0x5686d6[_0x1989('0x18')](0x194);}return _0x568c16;};}function handleError(_0x1326b5,_0x5db6f0){_0x5db6f0=_0x5db6f0||0x1f4;return function(_0x53a3af){logger[_0x1989('0x29')](_0x53a3af[_0x1989('0x2a')]);if(_0x53a3af[_0x1989('0x2b')]){delete _0x53a3af[_0x1989('0x2b')];}_0x1326b5[_0x1989('0x1a')](_0x5db6f0)['send'](_0x53a3af);};}exports[_0x1989('0x2c')]=function(_0x108d61,_0xf340f4){var _0xe2c72b={},_0x56a5ea={},_0x1e93ad={'count':0x0,'rows':[]};return db[_0x1989('0x2d')][_0x1989('0x2e')]()['then'](function(_0x2e337a){_0x56a5ea[_0x1989('0x2f')]=_[_0x1989('0x30')](_0x2e337a);_0x56a5ea[_0x1989('0x31')]=_[_0x1989('0x30')](_0x108d61[_0x1989('0x31')]);_0x56a5ea[_0x1989('0x32')]=_['intersection'](_0x56a5ea[_0x1989('0x2f')],_0x56a5ea[_0x1989('0x31')]);_0xe2c72b[_0x1989('0x33')]=_[_0x1989('0x34')](_0x56a5ea[_0x1989('0x2f')],qs[_0x1989('0x35')](_0x108d61[_0x1989('0x31')][_0x1989('0x35')]));_0xe2c72b['attributes']=_0xe2c72b[_0x1989('0x33')]['length']?_0xe2c72b[_0x1989('0x33')]:_0x56a5ea[_0x1989('0x2f')];if(!_0x108d61[_0x1989('0x31')][_0x1989('0x36')]('nolimit')){_0xe2c72b[_0x1989('0x1d')]=qs[_0x1989('0x1d')](_0x108d61[_0x1989('0x31')][_0x1989('0x1d')]);_0xe2c72b[_0x1989('0x1c')]=qs['offset'](_0x108d61['query'][_0x1989('0x1c')]);}_0xe2c72b[_0x1989('0x37')]=qs[_0x1989('0x38')](_0x108d61[_0x1989('0x31')][_0x1989('0x38')]);_0xe2c72b[_0x1989('0x39')]=qs[_0x1989('0x32')](_[_0x1989('0x3a')](_0x108d61[_0x1989('0x31')],_0x56a5ea[_0x1989('0x32')]),_0x2e337a);if(_0x108d61['query'][_0x1989('0x3b')]){_0xe2c72b['where']=_[_0x1989('0x3c')](_0xe2c72b[_0x1989('0x39')],{'$or':_[_0x1989('0x3d')](_0xe2c72b[_0x1989('0x33')],function(_0x48a262){var _0x17605f={};_0x17605f[_0x48a262]={'$like':'%'+_0x108d61['query'][_0x1989('0x3b')]+'%'};return _0x17605f;})});}_0xe2c72b=_[_0x1989('0x3c')]({},_0xe2c72b,_0x108d61[_0x1989('0x3e')]);var _0x1f1658={'where':_0xe2c72b[_0x1989('0x39')]};return db[_0x1989('0x2d')][_0x1989('0x1f')](_0x1f1658)[_0x1989('0x24')](function(_0x295be2){_0x1e93ad[_0x1989('0x1f')]=_0x295be2;if(_0x108d61[_0x1989('0x31')][_0x1989('0x3f')]){_0xe2c72b[_0x1989('0x40')]=[{'all':!![]}];}return db[_0x1989('0x2d')][_0x1989('0x41')](_0xe2c72b);})[_0x1989('0x24')](function(_0x14e796){_0x1e93ad[_0x1989('0x42')]=_0x14e796;return _0x1e93ad;})[_0x1989('0x24')](respondWithFilteredResult(_0xf340f4,_0xe2c72b))[_0x1989('0x43')](handleError(_0xf340f4,null));})[_0x1989('0x43')](handleError(_0xf340f4,null));};exports[_0x1989('0x44')]=function(_0x2b4664,_0xae63e6){var _0x1716e9={'raw':![],'where':{'id':_0x2b4664['params']['id']}},_0x470edb={};_0x470edb[_0x1989('0x2f')]=_[_0x1989('0x30')](db[_0x1989('0x2d')]['rawAttributes']);_0x470edb[_0x1989('0x31')]=_['keys'](_0x2b4664['query']);_0x470edb[_0x1989('0x32')]=_['intersection'](_0x470edb['model'],_0x470edb[_0x1989('0x31')]);_0x1716e9[_0x1989('0x33')]=_['intersection'](_0x470edb[_0x1989('0x2f')],qs[_0x1989('0x35')](_0x2b4664[_0x1989('0x31')]['fields']));_0x1716e9[_0x1989('0x33')]=_0x1716e9['attributes'][_0x1989('0x45')]?_0x1716e9['attributes']:_0x470edb[_0x1989('0x2f')];if(_0x2b4664['query']['includeAll']){_0x1716e9[_0x1989('0x40')]=[{'all':!![]}];}_0x1716e9=_[_0x1989('0x3c')]({},_0x1716e9,_0x2b4664[_0x1989('0x3e')]);return db[_0x1989('0x2d')][_0x1989('0x46')](_0x1716e9)['then'](handleEntityNotFound(_0xae63e6,null))['then'](respondWithResult(_0xae63e6,null))[_0x1989('0x43')](handleError(_0xae63e6,null));};exports[_0x1989('0x47')]=function(_0x5c6131,_0x2bfd04){return db[_0x1989('0x2d')]['create'](_0x5c6131['body'],{})[_0x1989('0x24')](function(_0x4606d9){var _0x11bb4a=_0x5c6131[_0x1989('0x48')]['get']({'plain':!![]});if(!_0x11bb4a)throw new Error(_0x1989('0x49'));if(_0x11bb4a['role']===_0x1989('0x48')){var _0x9db091=_0x4606d9[_0x1989('0x26')]({'plain':!![]});var _0x436683=_0x1989('0x27');return db['UserProfileSection'][_0x1989('0x46')]({'where':{'name':_0x436683,'userProfileId':_0x11bb4a[_0x1989('0x4a')]},'raw':!![]})[_0x1989('0x24')](function(_0x2d315f){if(_0x2d315f&&_0x2d315f[_0x1989('0x4b')]===0x0){return db[_0x1989('0x28')][_0x1989('0x47')]({'name':_0x9db091[_0x1989('0x2b')],'resourceId':_0x9db091['id'],'type':_0x2d315f[_0x1989('0x2b')],'sectionId':_0x2d315f['id']},{})[_0x1989('0x24')](function(){return _0x4606d9;});}else{return _0x4606d9;}})['catch'](function(_0x57de03){logger['error'](_0x1989('0x4c'),_0x57de03);throw _0x57de03;});}return _0x4606d9;})[_0x1989('0x24')](respondWithResult(_0x2bfd04,0xc9))[_0x1989('0x43')](handleError(_0x2bfd04,null));};exports[_0x1989('0x4d')]=function(_0x3a6e5c,_0x4850ab){if(_0x3a6e5c[_0x1989('0x4e')]['id']){delete _0x3a6e5c[_0x1989('0x4e')]['id'];}return db[_0x1989('0x2d')][_0x1989('0x46')]({'where':{'id':_0x3a6e5c[_0x1989('0x4f')]['id']}})[_0x1989('0x24')](handleEntityNotFound(_0x4850ab,null))[_0x1989('0x24')](saveUpdates(_0x3a6e5c[_0x1989('0x4e')],null))[_0x1989('0x24')](respondWithResult(_0x4850ab,null))[_0x1989('0x43')](handleError(_0x4850ab,null));};exports[_0x1989('0x25')]=function(_0x2f06e1,_0x31af47){return db[_0x1989('0x2d')][_0x1989('0x46')]({'where':{'id':_0x2f06e1[_0x1989('0x4f')]['id']}})[_0x1989('0x24')](handleEntityNotFound(_0x31af47,null))['then'](removeEntity(_0x31af47,null))[_0x1989('0x43')](handleError(_0x31af47,null));};exports[_0x1989('0x2e')]=function(_0x5c639e,_0x1a4a26){return db['CmCompany']['describe']()[_0x1989('0x24')](respondWithResult(_0x1a4a26,null))[_0x1989('0x43')](handleError(_0x1a4a26,null));};exports[_0x1989('0x50')]=function(_0x2924d7,_0x486dfe,_0x52a5f7){return db['CmContact'][_0x1989('0x46')]({'where':{'id':_0x2924d7[_0x1989('0x4f')]['id']}})[_0x1989('0x24')](handleEntityNotFound(_0x486dfe,null))[_0x1989('0x24')](function(_0x369ef7){if(_0x369ef7){return _0x369ef7[_0x1989('0x50')](_0x2924d7['body'][_0x1989('0x51')],_[_0x1989('0x52')](_0x2924d7[_0x1989('0x4e')],[_0x1989('0x51'),'id'])||{});}})['then'](respondWithResult(_0x486dfe,null))[_0x1989('0x43')](handleError(_0x486dfe,null));};exports[_0x1989('0x53')]=function(_0x1a459d,_0x5624bf,_0x8b6db3){var _0x161a9b={};var _0x46345c={};var _0x3b5701;var _0x1a7fa0;return db['CmCompany'][_0x1989('0x54')]({'where':{'id':_0x1a459d[_0x1989('0x4f')]['id']}})[_0x1989('0x24')](handleEntityNotFound(_0x5624bf,null))[_0x1989('0x24')](function(_0x363da7){if(_0x363da7){_0x3b5701=_0x363da7;_0x46345c[_0x1989('0x2f')]=_[_0x1989('0x30')](db[_0x1989('0x55')][_0x1989('0x56')]);_0x46345c[_0x1989('0x31')]=_[_0x1989('0x30')](_0x1a459d['query']);_0x46345c[_0x1989('0x32')]=_[_0x1989('0x34')](_0x46345c[_0x1989('0x2f')],_0x46345c[_0x1989('0x31')]);_0x161a9b['attributes']=_[_0x1989('0x34')](_0x46345c[_0x1989('0x2f')],qs[_0x1989('0x35')](_0x1a459d['query'][_0x1989('0x35')]));_0x161a9b[_0x1989('0x33')]=_0x161a9b[_0x1989('0x33')][_0x1989('0x45')]?_0x161a9b[_0x1989('0x33')]:_0x46345c[_0x1989('0x2f')];_0x161a9b[_0x1989('0x37')]=qs[_0x1989('0x38')](_0x1a459d[_0x1989('0x31')]['sort']);_0x161a9b[_0x1989('0x39')]=qs['filters'](_[_0x1989('0x3a')](_0x1a459d[_0x1989('0x31')],_0x46345c[_0x1989('0x32')]));if(_0x1a459d[_0x1989('0x31')][_0x1989('0x3b')]){_0x161a9b[_0x1989('0x39')]=_['merge'](_0x161a9b[_0x1989('0x39')],{'$or':_[_0x1989('0x3d')](_0x161a9b['attributes'],function(_0x58edca){var _0x5cb785={};_0x5cb785[_0x58edca]={'$like':'%'+_0x1a459d['query'][_0x1989('0x3b')]+'%'};return _0x5cb785;})});}_0x161a9b=_['merge']({},_0x161a9b,_0x1a459d['options']);return _0x3b5701[_0x1989('0x53')](_0x161a9b);}})[_0x1989('0x24')](function(_0x3e8277){if(_0x3e8277){_0x1a7fa0=_0x3e8277['length'];if(!_0x1a459d[_0x1989('0x31')][_0x1989('0x36')]('nolimit')){_0x161a9b[_0x1989('0x1d')]=qs[_0x1989('0x1d')](_0x1a459d[_0x1989('0x31')]['limit']);_0x161a9b['offset']=qs[_0x1989('0x1c')](_0x1a459d[_0x1989('0x31')][_0x1989('0x1c')]);}return _0x3b5701[_0x1989('0x53')](_0x161a9b);}})[_0x1989('0x24')](function(_0x45f46a){if(_0x45f46a){return _0x45f46a?{'count':_0x1a7fa0,'rows':_0x45f46a}:null;}})[_0x1989('0x24')](respondWithResult(_0x5624bf,null))[_0x1989('0x43')](handleError(_0x5624bf,null));}; \ No newline at end of file +var _0x6660=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','end','error','name','send','CmCompany','describe','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','map','options','includeAll','include','rows','catch','params','find','create','body','user','role','UserProfileSection','autoAssociation','update','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','order','sort','rimraf'];(function(_0x1981f0,_0x5e8757){var _0x3c4ce3=function(_0xb08d32){while(--_0xb08d32){_0x1981f0['push'](_0x1981f0['shift']());}};_0x3c4ce3(++_0x5e8757);}(_0x6660,0x104));var _0x0666=function(_0x105044,_0x16050e){_0x105044=_0x105044-0x0;var _0x27e36f=_0x6660[_0x105044];return _0x27e36f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0666('0x0'));var zipdir=require(_0x0666('0x1'));var jsonpatch=require(_0x0666('0x2'));var rp=require(_0x0666('0x3'));var moment=require(_0x0666('0x4'));var BPromise=require(_0x0666('0x5'));var Mustache=require(_0x0666('0x6'));var util=require(_0x0666('0x7'));var path=require(_0x0666('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0666('0x9'));var fs=require('fs');var fs_extra=require(_0x0666('0xa'));var _=require(_0x0666('0xb'));var squel=require(_0x0666('0xc'));var crypto=require('crypto');var jsforce=require(_0x0666('0xd'));var deskjs=require(_0x0666('0xe'));var toCsv=require(_0x0666('0xf'));var querystring=require(_0x0666('0x10'));var Papa=require(_0x0666('0x11'));var Redis=require(_0x0666('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0666('0x13'));var as=require(_0x0666('0x14'));var hardwareService=require(_0x0666('0x15'));var logger=require('../../config/logger')(_0x0666('0x16'));var utils=require('../../config/utils');var config=require(_0x0666('0x17'));var licenseUtil=require(_0x0666('0x18'));var db=require(_0x0666('0x19'))['db'];function respondWithStatusCode(_0x206837,_0x5794d9){_0x5794d9=_0x5794d9||0xcc;return function(_0x5c6a29){if(_0x5c6a29){return _0x206837[_0x0666('0x1a')](_0x5794d9);}return _0x206837[_0x0666('0x1b')](_0x5794d9)['end']();};}function respondWithResult(_0x186ff7,_0xa23dae){_0xa23dae=_0xa23dae||0xc8;return function(_0x1f0159){if(_0x1f0159){return _0x186ff7[_0x0666('0x1b')](_0xa23dae)[_0x0666('0x1c')](_0x1f0159);}};}function respondWithFilteredResult(_0x11b738,_0x1dc509){return function(_0x3b99fd){if(_0x3b99fd){var _0x90f617=typeof _0x1dc509['offset']===_0x0666('0x1d')&&typeof _0x1dc509['limit']===_0x0666('0x1d');var _0x298055=_0x3b99fd[_0x0666('0x1e')];var _0x9d95c0=_0x90f617?0x0:_0x1dc509[_0x0666('0x1f')];var _0x3adff5=_0x90f617?_0x3b99fd[_0x0666('0x1e')]:_0x1dc509['offset']+_0x1dc509[_0x0666('0x20')];var _0x10dbe8;if(_0x3adff5>=_0x298055){_0x3adff5=_0x298055;_0x10dbe8=0xc8;}else{_0x10dbe8=0xce;}_0x11b738[_0x0666('0x1b')](_0x10dbe8);return _0x11b738[_0x0666('0x21')](_0x0666('0x22'),_0x9d95c0+'-'+_0x3adff5+'/'+_0x298055)[_0x0666('0x1c')](_0x3b99fd);}return null;};}function patchUpdates(_0x28d036){return function(_0xe873e){try{jsonpatch[_0x0666('0x23')](_0xe873e,_0x28d036,!![]);}catch(_0x409266){return BPromise[_0x0666('0x24')](_0x409266);}return _0xe873e[_0x0666('0x25')]();};}function saveUpdates(_0x1094ad,_0x371157){return function(_0x305450){if(_0x305450){return _0x305450['update'](_0x1094ad)[_0x0666('0x26')](function(_0x3294c9){return _0x3294c9;});}return null;};}function removeEntity(_0x382dfd,_0x49e273){return function(_0x3dd915){if(_0x3dd915){return _0x3dd915[_0x0666('0x27')]()[_0x0666('0x26')](function(){var _0x2200b9=_0x3dd915[_0x0666('0x28')]({'plain':!![]});var _0x593f5a=_0x0666('0x29');return db[_0x0666('0x2a')][_0x0666('0x27')]({'where':{'type':_0x593f5a,'resourceId':_0x2200b9['id']}})[_0x0666('0x26')](function(){return _0x3dd915;});})[_0x0666('0x26')](function(){_0x382dfd[_0x0666('0x1b')](0xcc)[_0x0666('0x2b')]();});}};}function handleEntityNotFound(_0x30dcc9,_0x3713dd){return function(_0xcbbf7b){if(!_0xcbbf7b){_0x30dcc9['sendStatus'](0x194);}return _0xcbbf7b;};}function handleError(_0x57eed9,_0x103e12){_0x103e12=_0x103e12||0x1f4;return function(_0x54808d){logger[_0x0666('0x2c')](_0x54808d['stack']);if(_0x54808d[_0x0666('0x2d')]){delete _0x54808d[_0x0666('0x2d')];}_0x57eed9['status'](_0x103e12)[_0x0666('0x2e')](_0x54808d);};}exports['index']=function(_0x5d070c,_0x550b1e){var _0x3ed4ed={},_0x1dacb7={},_0x2cb292={'count':0x0,'rows':[]};return db[_0x0666('0x2f')][_0x0666('0x30')]()[_0x0666('0x26')](function(_0x2c4001){_0x1dacb7[_0x0666('0x31')]=_['keys'](_0x2c4001);_0x1dacb7[_0x0666('0x32')]=_[_0x0666('0x33')](_0x5d070c[_0x0666('0x32')]);_0x1dacb7[_0x0666('0x34')]=_[_0x0666('0x35')](_0x1dacb7[_0x0666('0x31')],_0x1dacb7[_0x0666('0x32')]);_0x3ed4ed[_0x0666('0x36')]=_[_0x0666('0x35')](_0x1dacb7[_0x0666('0x31')],qs[_0x0666('0x37')](_0x5d070c[_0x0666('0x32')][_0x0666('0x37')]));_0x3ed4ed[_0x0666('0x36')]=_0x3ed4ed[_0x0666('0x36')][_0x0666('0x38')]?_0x3ed4ed[_0x0666('0x36')]:_0x1dacb7['model'];if(!_0x5d070c[_0x0666('0x32')][_0x0666('0x39')](_0x0666('0x3a'))){_0x3ed4ed[_0x0666('0x20')]=qs[_0x0666('0x20')](_0x5d070c[_0x0666('0x32')][_0x0666('0x20')]);_0x3ed4ed['offset']=qs[_0x0666('0x1f')](_0x5d070c[_0x0666('0x32')][_0x0666('0x1f')]);}_0x3ed4ed['order']=qs['sort'](_0x5d070c['query']['sort']);_0x3ed4ed['where']=qs['filters'](_[_0x0666('0x3b')](_0x5d070c[_0x0666('0x32')],_0x1dacb7[_0x0666('0x34')]),_0x2c4001);if(_0x5d070c[_0x0666('0x32')][_0x0666('0x3c')]){_0x3ed4ed[_0x0666('0x3d')]=_[_0x0666('0x3e')](_0x3ed4ed['where'],{'$or':_[_0x0666('0x3f')](_0x3ed4ed['attributes'],function(_0x4ba4d4){var _0x384d6c={};_0x384d6c[_0x4ba4d4]={'$like':'%'+_0x5d070c[_0x0666('0x32')][_0x0666('0x3c')]+'%'};return _0x384d6c;})});}_0x3ed4ed=_['merge']({},_0x3ed4ed,_0x5d070c[_0x0666('0x40')]);var _0x13dc9b={'where':_0x3ed4ed[_0x0666('0x3d')]};return db[_0x0666('0x2f')][_0x0666('0x1e')](_0x13dc9b)[_0x0666('0x26')](function(_0x4e6eea){_0x2cb292[_0x0666('0x1e')]=_0x4e6eea;if(_0x5d070c['query'][_0x0666('0x41')]){_0x3ed4ed[_0x0666('0x42')]=[{'all':!![]}];}return db[_0x0666('0x2f')]['findAll'](_0x3ed4ed);})[_0x0666('0x26')](function(_0x1c02c0){_0x2cb292[_0x0666('0x43')]=_0x1c02c0;return _0x2cb292;})[_0x0666('0x26')](respondWithFilteredResult(_0x550b1e,_0x3ed4ed))[_0x0666('0x44')](handleError(_0x550b1e,null));})[_0x0666('0x44')](handleError(_0x550b1e,null));};exports['show']=function(_0x3b0dc3,_0x1ea296){var _0x296c44={'raw':![],'where':{'id':_0x3b0dc3[_0x0666('0x45')]['id']}},_0x216c29={};_0x216c29[_0x0666('0x31')]=_['keys'](db[_0x0666('0x2f')]['rawAttributes']);_0x216c29[_0x0666('0x32')]=_[_0x0666('0x33')](_0x3b0dc3[_0x0666('0x32')]);_0x216c29['filters']=_[_0x0666('0x35')](_0x216c29[_0x0666('0x31')],_0x216c29[_0x0666('0x32')]);_0x296c44[_0x0666('0x36')]=_[_0x0666('0x35')](_0x216c29['model'],qs[_0x0666('0x37')](_0x3b0dc3[_0x0666('0x32')][_0x0666('0x37')]));_0x296c44[_0x0666('0x36')]=_0x296c44[_0x0666('0x36')][_0x0666('0x38')]?_0x296c44[_0x0666('0x36')]:_0x216c29[_0x0666('0x31')];if(_0x3b0dc3[_0x0666('0x32')]['includeAll']){_0x296c44[_0x0666('0x42')]=[{'all':!![]}];}_0x296c44=_[_0x0666('0x3e')]({},_0x296c44,_0x3b0dc3[_0x0666('0x40')]);return db[_0x0666('0x2f')][_0x0666('0x46')](_0x296c44)[_0x0666('0x26')](handleEntityNotFound(_0x1ea296,null))[_0x0666('0x26')](respondWithResult(_0x1ea296,null))[_0x0666('0x44')](handleError(_0x1ea296,null));};exports[_0x0666('0x47')]=function(_0xcbc810,_0x4c3e5d){return db[_0x0666('0x2f')][_0x0666('0x47')](_0xcbc810[_0x0666('0x48')],{})[_0x0666('0x26')](function(_0x465712){var _0x2a94fc=_0xcbc810[_0x0666('0x49')]['get']({'plain':!![]});if(!_0x2a94fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a94fc[_0x0666('0x4a')]===_0x0666('0x49')){var _0x40d1e3=_0x465712[_0x0666('0x28')]({'plain':!![]});var _0x39970=_0x0666('0x29');return db[_0x0666('0x4b')]['find']({'where':{'name':_0x39970,'userProfileId':_0x2a94fc['userProfileId']},'raw':!![]})[_0x0666('0x26')](function(_0x57e5fb){if(_0x57e5fb&&_0x57e5fb[_0x0666('0x4c')]===0x0){return db[_0x0666('0x2a')][_0x0666('0x47')]({'name':_0x40d1e3[_0x0666('0x2d')],'resourceId':_0x40d1e3['id'],'type':_0x57e5fb['name'],'sectionId':_0x57e5fb['id']},{})[_0x0666('0x26')](function(){return _0x465712;});}else{return _0x465712;}})[_0x0666('0x44')](function(_0x2cd2be){logger[_0x0666('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cd2be);throw _0x2cd2be;});}return _0x465712;})[_0x0666('0x26')](respondWithResult(_0x4c3e5d,0xc9))[_0x0666('0x44')](handleError(_0x4c3e5d,null));};exports[_0x0666('0x4d')]=function(_0x14aacb,_0x4a421c){if(_0x14aacb['body']['id']){delete _0x14aacb[_0x0666('0x48')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x14aacb['params']['id']}})['then'](handleEntityNotFound(_0x4a421c,null))[_0x0666('0x26')](saveUpdates(_0x14aacb[_0x0666('0x48')],null))[_0x0666('0x26')](respondWithResult(_0x4a421c,null))[_0x0666('0x44')](handleError(_0x4a421c,null));};exports[_0x0666('0x27')]=function(_0x388243,_0x556eca){return db[_0x0666('0x2f')]['find']({'where':{'id':_0x388243[_0x0666('0x45')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x556eca,null))[_0x0666('0x26')](removeEntity(_0x556eca,null))[_0x0666('0x44')](handleError(_0x556eca,null));};exports['describe']=function(_0xa9d0a0,_0x519e7a){return db[_0x0666('0x2f')][_0x0666('0x30')]()[_0x0666('0x26')](respondWithResult(_0x519e7a,null))[_0x0666('0x44')](handleError(_0x519e7a,null));};exports[_0x0666('0x4e')]=function(_0x9c6ab3,_0x13d2b9,_0x154352){return db[_0x0666('0x4f')][_0x0666('0x46')]({'where':{'id':_0x9c6ab3[_0x0666('0x45')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x13d2b9,null))[_0x0666('0x26')](function(_0x38ebd3){if(_0x38ebd3){return _0x38ebd3[_0x0666('0x4e')](_0x9c6ab3['body'][_0x0666('0x50')],_[_0x0666('0x51')](_0x9c6ab3[_0x0666('0x48')],[_0x0666('0x50'),'id'])||{});}})[_0x0666('0x26')](respondWithResult(_0x13d2b9,null))[_0x0666('0x44')](handleError(_0x13d2b9,null));};exports[_0x0666('0x52')]=function(_0x523f1e,_0x3693a8,_0x1f7729){var _0x57fb45={};var _0x5aeaac={};var _0x59a6e2;var _0x2853ee;return db[_0x0666('0x2f')][_0x0666('0x53')]({'where':{'id':_0x523f1e[_0x0666('0x45')]['id']}})[_0x0666('0x26')](handleEntityNotFound(_0x3693a8,null))[_0x0666('0x26')](function(_0x5bccb2){if(_0x5bccb2){_0x59a6e2=_0x5bccb2;_0x5aeaac[_0x0666('0x31')]=_['keys'](db[_0x0666('0x4f')][_0x0666('0x54')]);_0x5aeaac[_0x0666('0x32')]=_[_0x0666('0x33')](_0x523f1e[_0x0666('0x32')]);_0x5aeaac[_0x0666('0x34')]=_['intersection'](_0x5aeaac[_0x0666('0x31')],_0x5aeaac[_0x0666('0x32')]);_0x57fb45[_0x0666('0x36')]=_[_0x0666('0x35')](_0x5aeaac['model'],qs[_0x0666('0x37')](_0x523f1e[_0x0666('0x32')][_0x0666('0x37')]));_0x57fb45[_0x0666('0x36')]=_0x57fb45['attributes'][_0x0666('0x38')]?_0x57fb45['attributes']:_0x5aeaac[_0x0666('0x31')];_0x57fb45[_0x0666('0x55')]=qs['sort'](_0x523f1e[_0x0666('0x32')][_0x0666('0x56')]);_0x57fb45[_0x0666('0x3d')]=qs[_0x0666('0x34')](_['pick'](_0x523f1e[_0x0666('0x32')],_0x5aeaac[_0x0666('0x34')]));if(_0x523f1e[_0x0666('0x32')][_0x0666('0x3c')]){_0x57fb45[_0x0666('0x3d')]=_[_0x0666('0x3e')](_0x57fb45[_0x0666('0x3d')],{'$or':_[_0x0666('0x3f')](_0x57fb45[_0x0666('0x36')],function(_0x35f2ae){var _0x4fdc52={};_0x4fdc52[_0x35f2ae]={'$like':'%'+_0x523f1e[_0x0666('0x32')][_0x0666('0x3c')]+'%'};return _0x4fdc52;})});}_0x57fb45=_[_0x0666('0x3e')]({},_0x57fb45,_0x523f1e[_0x0666('0x40')]);return _0x59a6e2[_0x0666('0x52')](_0x57fb45);}})[_0x0666('0x26')](function(_0x350cc5){if(_0x350cc5){_0x2853ee=_0x350cc5[_0x0666('0x38')];if(!_0x523f1e[_0x0666('0x32')][_0x0666('0x39')](_0x0666('0x3a'))){_0x57fb45[_0x0666('0x20')]=qs[_0x0666('0x20')](_0x523f1e[_0x0666('0x32')]['limit']);_0x57fb45['offset']=qs['offset'](_0x523f1e[_0x0666('0x32')]['offset']);}return _0x59a6e2[_0x0666('0x52')](_0x57fb45);}})[_0x0666('0x26')](function(_0x4135e8){if(_0x4135e8){return _0x4135e8?{'count':_0x2853ee,'rows':_0x4135e8}:null;}})[_0x0666('0x26')](respondWithResult(_0x3693a8,null))[_0x0666('0x44')](handleError(_0x3693a8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 183fcb4..91f1edb 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 _0x0715=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x113059,_0x27cb9c){var _0x420db0=function(_0x400483){while(--_0x400483){_0x113059['push'](_0x113059['shift']());}};_0x420db0(++_0x27cb9c);}(_0x0715,0xcc));var _0x5071=function(_0x507d65,_0x4d096a){_0x507d65=_0x507d65-0x0;var _0xd425b=_0x0715[_0x507d65];return _0xd425b;};'use strict';var _=require(_0x5071('0x0'));var util=require(_0x5071('0x1'));var logger=require(_0x5071('0x2'))(_0x5071('0x3'));var moment=require('moment');var BPromise=require(_0x5071('0x4'));var rp=require(_0x5071('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5071('0x6'));var config=require(_0x5071('0x7'));var attributes=require(_0x5071('0x8'));module[_0x5071('0x9')]=function(_0xa89da0,_0x3205ae){return _0xa89da0[_0x5071('0xa')]('CmCompany',attributes,{'tableName':_0x5071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b25=['moment','request-promise','path','rimraf','../../config/environment','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x420e30,_0x362f95){var _0x335e44=function(_0x14fea5){while(--_0x14fea5){_0x420e30['push'](_0x420e30['shift']());}};_0x335e44(++_0x362f95);}(_0x3b25,0x11a));var _0x53b2=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x3b25[_0x53ba51];return _0x2e776e;};'use strict';var _=require(_0x53b2('0x0'));var util=require(_0x53b2('0x1'));var logger=require(_0x53b2('0x2'))(_0x53b2('0x3'));var moment=require(_0x53b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x53b2('0x5'));var fs=require('fs');var path=require(_0x53b2('0x6'));var rimraf=require(_0x53b2('0x7'));var config=require(_0x53b2('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x2fbcbc,_0x442ace){return _0x2fbcbc['define'](_0x53b2('0x9'),attributes,{'tableName':_0x53b2('0xa'),'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 9e6f79f..1693930 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 _0x5386=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x78335b,_0xb7a172){var _0x863f42=function(_0x4d9624){while(--_0x4d9624){_0x78335b['push'](_0x78335b['shift']());}};_0x863f42(++_0xb7a172);}(_0x5386,0x146));var _0x6538=function(_0x5bab8e,_0x5a9ed6){_0x5bab8e=_0x5bab8e-0x0;var _0x3e14ea=_0x5386[_0x5bab8e];return _0x3e14ea;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var moment=require(_0x6538('0x2'));var BPromise=require(_0x6538('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6538('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6538('0x5'));var logger=require('../../config/logger')(_0x6538('0x6'));var config=require('../../config/environment');var jayson=require(_0x6538('0x7'));var client=jayson[_0x6538('0x8')][_0x6538('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d625d,_0x3adc33,_0x3e280b){return new BPromise(function(_0x15b679,_0x1aa623){return client[_0x6538('0xa')](_0x1d625d,_0x3e280b)[_0x6538('0xb')](function(_0x58b7d5){logger['info'](_0x6538('0xc'),_0x3adc33,_0x6538('0xd'));logger['debug'](_0x6538('0xe'),_0x3adc33,'request\x20sent',JSON[_0x6538('0xf')](_0x58b7d5));if(_0x58b7d5[_0x6538('0x10')]){if(_0x58b7d5[_0x6538('0x10')][_0x6538('0x11')]===0x1f4){logger[_0x6538('0x10')]('CmCompany,\x20%s,\x20%s',_0x3adc33,_0x58b7d5[_0x6538('0x10')][_0x6538('0x12')]);return _0x1aa623(_0x58b7d5['error'][_0x6538('0x12')]);}logger[_0x6538('0x10')](_0x6538('0xc'),_0x3adc33,_0x58b7d5[_0x6538('0x10')]['message']);return _0x15b679(_0x58b7d5[_0x6538('0x10')][_0x6538('0x12')]);}else{logger[_0x6538('0x13')](_0x6538('0xc'),_0x3adc33,_0x6538('0xd'));_0x15b679(_0x58b7d5[_0x6538('0x14')][_0x6538('0x12')]);}})[_0x6538('0x15')](function(_0x504f56){logger[_0x6538('0x10')](_0x6538('0xc'),_0x3adc33,_0x504f56);_0x1aa623(_0x504f56);});});} \ No newline at end of file +var _0xced9=['code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xced9,0x147));var _0x9ced=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xced9[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x9ced('0x0'));var util=require('util');var moment=require(_0x9ced('0x1'));var BPromise=require(_0x9ced('0x2'));var rs=require(_0x9ced('0x3'));var fs=require('fs');var Redis=require(_0x9ced('0x4'));var db=require(_0x9ced('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ced('0x6'))(_0x9ced('0x7'));var config=require(_0x9ced('0x8'));var jayson=require(_0x9ced('0x9'));var client=jayson[_0x9ced('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54b089,_0x25ad67,_0x2c803f){return new BPromise(function(_0x33a924,_0x5e8286){return client[_0x9ced('0xb')](_0x54b089,_0x2c803f)[_0x9ced('0xc')](function(_0x18dbda){logger[_0x9ced('0xd')]('CmCompany,\x20%s,\x20%s',_0x25ad67,_0x9ced('0xe'));logger[_0x9ced('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x25ad67,_0x9ced('0xe'),JSON[_0x9ced('0x10')](_0x18dbda));if(_0x18dbda['error']){if(_0x18dbda[_0x9ced('0x11')][_0x9ced('0x12')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x25ad67,_0x18dbda['error'][_0x9ced('0x13')]);return _0x5e8286(_0x18dbda[_0x9ced('0x11')]['message']);}logger[_0x9ced('0x11')]('CmCompany,\x20%s,\x20%s',_0x25ad67,_0x18dbda[_0x9ced('0x11')][_0x9ced('0x13')]);return _0x33a924(_0x18dbda['error'][_0x9ced('0x13')]);}else{logger['info'](_0x9ced('0x14'),_0x25ad67,_0x9ced('0xe'));_0x33a924(_0x18dbda[_0x9ced('0x15')][_0x9ced('0x13')]);}})[_0x9ced('0x16')](function(_0x2de422){logger[_0x9ced('0x11')](_0x9ced('0x14'),_0x25ad67,_0x2de422);_0x5e8286(_0x2de422);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5b04853..19c7cb5 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 _0x38dc=['../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id/contacts','getContacts','post','addContacts','put','update','delete','multer','path','express'];(function(_0x11262c,_0x4f6aff){var _0x2e488f=function(_0xf971ae){while(--_0xf971ae){_0x11262c['push'](_0x11262c['shift']());}};_0x2e488f(++_0x4f6aff);}(_0x38dc,0xfc));var _0xc38d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38dc[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xc38d('0x0'));var util=require('util');var path=require(_0xc38d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc38d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc38d('0x3'));var config=require(_0xc38d('0x4'));var controller=require(_0xc38d('0x5'));router[_0xc38d('0x6')]('/',auth[_0xc38d('0x7')](),controller[_0xc38d('0x8')]);router[_0xc38d('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xc38d('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xc38d('0xa'),auth[_0xc38d('0x7')](),controller[_0xc38d('0xb')]);router[_0xc38d('0xc')]('/',auth[_0xc38d('0x7')](),controller['create']);router[_0xc38d('0xc')](_0xc38d('0xa'),auth[_0xc38d('0x7')](),controller[_0xc38d('0xd')]);router[_0xc38d('0xe')]('/:id',auth[_0xc38d('0x7')](),controller[_0xc38d('0xf')]);router[_0xc38d('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x35ba=['express','Router','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x35ba,0x19a));var _0xa35b=function(_0x11b2ca,_0x5257ab){_0x11b2ca=_0x11b2ca-0x0;var _0x4fbdb9=_0x35ba[_0x11b2ca];return _0x4fbdb9;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require(_0xa35b('0x2'));var timeout=require(_0xa35b('0x3'));var express=require(_0xa35b('0x4'));var router=express[_0xa35b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa35b('0x6'));var config=require('../../config/environment');var controller=require(_0xa35b('0x7'));router[_0xa35b('0x8')]('/',auth[_0xa35b('0x9')](),controller[_0xa35b('0xa')]);router[_0xa35b('0x8')](_0xa35b('0xb'),auth[_0xa35b('0x9')](),controller[_0xa35b('0xc')]);router[_0xa35b('0x8')](_0xa35b('0xd'),auth[_0xa35b('0x9')](),controller[_0xa35b('0xe')]);router[_0xa35b('0x8')]('/:id/contacts',auth[_0xa35b('0x9')](),controller[_0xa35b('0xf')]);router[_0xa35b('0x10')]('/',auth['isAuthenticated'](),controller[_0xa35b('0x11')]);router[_0xa35b('0x10')](_0xa35b('0x12'),auth['isAuthenticated'](),controller[_0xa35b('0x13')]);router[_0xa35b('0x14')](_0xa35b('0xd'),auth[_0xa35b('0x9')](),controller[_0xa35b('0x15')]);router['delete'](_0xa35b('0xd'),auth[_0xa35b('0x9')](),controller[_0xa35b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index af7edc4..b178baf 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 _0x4bf6=['TEXT','INTEGER','UNSIGNED','lodash','sequelize','STRING'];(function(_0x12245e,_0x44ec76){var _0x2e50b2=function(_0x3d5fa4){while(--_0x3d5fa4){_0x12245e['push'](_0x12245e['shift']());}};_0x2e50b2(++_0x44ec76);}(_0x4bf6,0x1dd));var _0x64bf=function(_0x4ac0bc,_0x56fe51){_0x4ac0bc=_0x4ac0bc-0x0;var _0x469d72=_0x4bf6[_0x4ac0bc];return _0x469d72;};'use strict';var _=require(_0x64bf('0x0'));var Sequelize=require(_0x64bf('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x64bf('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x64bf('0x2')]},'postalCode':{'type':Sequelize[_0x64bf('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x64bf('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x64bf('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x64bf('0x2')]},'url':{'type':Sequelize[_0x64bf('0x2')]},'facebook':{'type':Sequelize[_0x64bf('0x2')]},'fb_data':{'type':Sequelize[_0x64bf('0x2')]},'twitter':{'type':Sequelize[_0x64bf('0x2')]},'skype':{'type':Sequelize[_0x64bf('0x2')]},'teams':{'type':Sequelize[_0x64bf('0x2')]},'viber':{'type':Sequelize[_0x64bf('0x2')]},'line':{'type':Sequelize[_0x64bf('0x2')]},'wechat':{'type':Sequelize[_0x64bf('0x2')]},'telegram':{'type':Sequelize[_0x64bf('0x2')]},'UserId':{'type':Sequelize[_0x64bf('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x64bf('0x2')]},'priority':{'type':Sequelize[_0x64bf('0x4')](0x2)[_0x64bf('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x64bf('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1013=['INTEGER','UNSIGNED','lodash','sequelize','exports','STRING','TEXT'];(function(_0x36be38,_0x50b484){var _0x10a629=function(_0x23b8d2){while(--_0x23b8d2){_0x36be38['push'](_0x36be38['shift']());}};_0x10a629(++_0x50b484);}(_0x1013,0x12f));var _0x3101=function(_0x4ffe67,_0x4a7297){_0x4ffe67=_0x4ffe67-0x0;var _0x5774c1=_0x1013[_0x4ffe67];return _0x5774c1;};'use strict';var _=require(_0x3101('0x0'));var Sequelize=require(_0x3101('0x1'));module[_0x3101('0x2')]={'firstName':{'type':Sequelize[_0x3101('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3101('0x3')]},'postalCode':{'type':Sequelize[_0x3101('0x3')]},'city':{'type':Sequelize[_0x3101('0x3')]},'country':{'type':Sequelize[_0x3101('0x3')]},'dateOfBirth':{'type':Sequelize[_0x3101('0x3')]},'description':{'type':Sequelize[_0x3101('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3101('0x3')]},'fax':{'type':Sequelize[_0x3101('0x3')]},'email':{'type':Sequelize[_0x3101('0x3')]},'url':{'type':Sequelize[_0x3101('0x3')]},'facebook':{'type':Sequelize[_0x3101('0x3')]},'fb_data':{'type':Sequelize[_0x3101('0x3')]},'twitter':{'type':Sequelize[_0x3101('0x3')]},'skype':{'type':Sequelize[_0x3101('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3101('0x3')]},'line':{'type':Sequelize[_0x3101('0x3')]},'wechat':{'type':Sequelize[_0x3101('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x3101('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x3101('0x3')]},'priority':{'type':Sequelize[_0x3101('0x5')](0x2)[_0x3101('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x3101('0x3')]},'utcOffset':{'type':Sequelize[_0x3101('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3d24587..1d0634f 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 _0xe41a=['duplicateAdditionalPhones','fromContactId','toContactId','hopperId','getHoppers','rawAttributes','ContactId','options','include','getHopperHistories','rows','getHopperFinals','CmHopperFinal','getJscriptySessions','includeAll','uploadCsv','binding_keys','socket_timestamp','binding_values','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','import','User','agent','No\x20ListId\x20specified','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','channel','startCase','Website','Account','closed','closedAt','disposition','thirdDisposition','key','Owner','color','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','findAndCountAll','flatten','sortBy','value','slice','moment','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','user','catch','CmContact','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','query','analytics','CmCustomField','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','isArray','join','CmHopper','CmHopperBlack','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','dialTimezone','isNil','utcOffset','additionalPhones','each','duplicates','$or','push','ListId','findOrCreate','hasOwnProperty','contact','all','show','Tag','Tags','ContactItemType','ItemType','sequelize','literal','$and','map','format','timezones','omit','pickBy','isEmpty','cm_contacts','setFields','id\x20=\x20?','text','phone','getTags','findOne','model','filters','intersection','attributes','fields','order','sort','where','pick','filter','nolimit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate'];(function(_0xbc2974,_0xec3342){var _0x3a5b4f=function(_0x5ec5b5){while(--_0x5ec5b5){_0xbc2974['push'](_0xbc2974['shift']());}};_0x3a5b4f(++_0xec3342);}(_0xe41a,0x168));var _0xae41=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xe41a[_0x4c7fb5];return _0x2e10ac;};'use strict';var moment=require(_0xae41('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xae41('0x1'));var fs=require('fs');var _=require(_0xae41('0x2'));var squel=require(_0xae41('0x3'));var Papa=require('papaparse');var Redis=require(_0xae41('0x4'));var contacts=require(_0xae41('0x5'));var qs=require(_0xae41('0x6'));var logger=require(_0xae41('0x7'))('api');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0xae41('0x8'))['db'];config[_0xae41('0x9')]=_[_0xae41('0xa')](config['redis'],{'host':_0xae41('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae41('0x9')]));require(_0xae41('0xc'))[_0xae41('0xd')](socket);function respondWithResult(_0x353dcd,_0x210e25){_0x210e25=_0x210e25||0xc8;return function(_0x850b1){if(_0x850b1){return _0x353dcd[_0xae41('0xe')](_0x210e25)['json'](_0x850b1);}};}function respondWithFilteredResult(_0x238c10,_0x4ff0b1){return function(_0x5aba90){if(_0x5aba90){var _0x46a6ee=typeof _0x4ff0b1[_0xae41('0xf')]===_0xae41('0x10')&&typeof _0x4ff0b1['limit']===_0xae41('0x10');var _0x352ffd=_0x5aba90[_0xae41('0x11')];var _0x5e032c=_0x46a6ee?0x0:_0x4ff0b1[_0xae41('0xf')];var _0x357f0d=_0x46a6ee?_0x5aba90[_0xae41('0x11')]:_0x4ff0b1['offset']+_0x4ff0b1[_0xae41('0x12')];var _0x22645f;if(_0x357f0d>=_0x352ffd){_0x357f0d=_0x352ffd;_0x22645f=0xc8;}else{_0x22645f=0xce;}_0x238c10[_0xae41('0xe')](_0x22645f);return _0x238c10[_0xae41('0x13')](_0xae41('0x14'),_0x5e032c+'-'+_0x357f0d+'/'+_0x352ffd)[_0xae41('0x15')](_0x5aba90);}return null;};}function saveUpdates(_0x4e1336){return function(_0x2f47c1){if(_0x2f47c1){return _0x2f47c1[_0xae41('0x16')](_0x4e1336)[_0xae41('0x17')](function(_0x447db0){return _0x447db0;});}return null;};}function removeEntity(_0x3649df){return function(_0x5ad296){if(_0x5ad296){return _0x5ad296[_0xae41('0x18')]()[_0xae41('0x17')](function(){_0x3649df[_0xae41('0xe')](0xcc)[_0xae41('0x19')]();});}};}function handleEntityNotFound(_0x339f36){return function(_0x17211a){if(!_0x17211a){_0x339f36[_0xae41('0x1a')](0x194);}return _0x17211a;};}function handleError(_0x473c24,_0x363710){_0x363710=_0x363710||0x1f4;return function(_0xc1ef9){logger['error'](_0xc1ef9[_0xae41('0x1b')]);if(_0xc1ef9[_0xae41('0x1c')]){delete _0xc1ef9[_0xae41('0x1c')];}_0x473c24['status'](_0x363710)[_0xae41('0x1d')](_0xc1ef9);};}exports[_0xae41('0x1e')]=function(_0x49e0e3,_0x4b29dc){var _0x43bf21={};return contacts[_0xae41('0x1f')]()[_0xae41('0x17')](function(_0x30da03){_0x43bf21=qs[_0xae41('0x20')](_0x30da03,_0x49e0e3);return contacts[_0xae41('0x21')](_0x49e0e3['query'],_0x49e0e3[_0xae41('0x22')],_0x43bf21,_0x30da03);})[_0xae41('0x17')](respondWithFilteredResult(_0x4b29dc,_0x43bf21))[_0xae41('0x23')](handleError(_0x4b29dc,null));};exports[_0xae41('0x18')]=function(_0x569fd2,_0x2c7e3f){return db[_0xae41('0x24')][_0xae41('0x25')]({'where':{'id':_0x569fd2[_0xae41('0x26')]['id']}})['then'](handleEntityNotFound(_0x2c7e3f,null))['then'](removeEntity(_0x2c7e3f,null))[_0xae41('0x23')](handleError(_0x2c7e3f,null));};exports[_0xae41('0x1f')]=function(_0x4a1b95,_0xd50770){return db[_0xae41('0x24')][_0xae41('0x1f')]()[_0xae41('0x17')](function(_0x221867){delete _0x221867[_0xae41('0x27')];for(var _0x3f90f1=0x0;_0x3f90f10x0){return new Promise(function(_0x1e42e6){var _0x44ca30=[];for(var _0x30df8b=0x0;_0x30df8b<_0x153cb5['length'];_0x30df8b++){_0x44ca30['push'](insertAdditionalPhones(_0x153cb5[_0x30df8b][_0xae41('0x5f')],_0x153cb5[_0x30df8b][_0xae41('0x57')]));}Promise[_0xae41('0x60')](_0x44ca30)[_0xae41('0x17')](function(){_0x1e42e6(0x1);});})[_0xae41('0x17')](function(){return{'success':_0x4c6646,'failure':_0x4a77e3,'duplicates':_0x25a3f1};});}else{return{'success':_0x4c6646,'failure':_0x4a77e3,'duplicates':_0x25a3f1};}}})[_0xae41('0x17')](respondWithResult(_0x3e6239,0xc9))[_0xae41('0x23')](handleError(_0x3e6239,null));};exports[_0xae41('0x61')]=function(_0x1f59de,_0x2c0e81){var _0x579e36;return db[_0xae41('0x24')]['describe']()[_0xae41('0x17')](function(_0x383737){return db[_0xae41('0x24')][_0xae41('0x25')]({'where':{'id':_0x1f59de[_0xae41('0x26')]['id']},'include':[{'model':db[_0xae41('0x62')],'as':_0xae41('0x63'),'attributes':['id',_0xae41('0x1c'),'color'],'required':_0x1f59de[_0xae41('0x2e')]['tag']?!![]:![]},{'model':db[_0xae41('0x49')],'as':'Phones','where':{'CmContactId':_0x1f59de[_0xae41('0x26')]['id']},'required':![],'include':[{'model':db[_0xae41('0x64')],'as':_0xae41('0x65')}]}],'order':[db[_0xae41('0x66')][_0xae41('0x67')]('Phones.OrderBy')],'attributes':_[_0xae41('0x28')](_0x383737)});})[_0xae41('0x17')](function(_0x7134d0){if(!_[_0xae41('0x55')](_0x7134d0)){_0x579e36=_0x7134d0[_0xae41('0x3a')]({'plain':!![]});var _0x3b4d8d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x7134d0&&_0x7134d0[_0xae41('0x5c')]){if(_0x7134d0['ListId']){_0x3b4d8d['where'][_0xae41('0x68')][_0xae41('0x5b')]({'ListId':{'$ne':_0x7134d0[_0xae41('0x5c')]}});}}return db[_0xae41('0x30')][_0xae41('0x21')](_0x3b4d8d);}})[_0xae41('0x17')](function(_0x25f7a0){if(!_[_0xae41('0x55')](_0x25f7a0)){return _['omit'](_0x579e36,_[_0xae41('0x69')](_0x25f7a0,function(_0x890c55){return util[_0xae41('0x6a')]('cf_%d',_0x890c55['id']);}));}})[_0xae41('0x17')](handleEntityNotFound(_0x2c0e81,null))['then'](respondWithResult(_0x2c0e81,null))[_0xae41('0x23')](handleError(_0x2c0e81,null));};exports[_0xae41('0x16')]=function(_0x267789,_0x2159f8){var _0x16ba72;if(_0x267789[_0xae41('0x38')]['id']){delete _0x267789[_0xae41('0x38')]['id'];}if(!_[_0xae41('0x55')](_0x267789[_0xae41('0x38')]['dialTimezone'])){var _0x1d9195=_0x267789[_0xae41('0x38')][_0xae41('0x54')];if(!_[_0xae41('0x55')](shared[_0xae41('0x6b')][_0x1d9195]))_0x267789[_0xae41('0x38')][_0xae41('0x56')]=shared[_0xae41('0x6b')][_0x1d9195]['utcOffset'];}return db[_0xae41('0x24')][_0xae41('0x25')]({'where':{'id':_0x267789[_0xae41('0x26')]['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x2159f8,null))[_0xae41('0x17')](saveUpdates(_0x267789['body'],null))[_0xae41('0x17')](function(_0x1c34cd){_0x16ba72=_0x1c34cd;var _0x49f0b7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1c34cd&&_0x1c34cd[_0xae41('0x5c')]){if(_0x1c34cd['ListId']){_0x49f0b7['where']['$and']['push']({'ListId':{'$ne':_0x1c34cd[_0xae41('0x5c')]}});}}return db[_0xae41('0x30')][_0xae41('0x21')](_0x49f0b7);})[_0xae41('0x17')](function(_0x535a19){if(_0x535a19){return _[_0xae41('0x6c')](_[_0xae41('0x6d')](_0x267789[_0xae41('0x38')],function(_0x48dab2,_0x4d0b47){return _['startsWith'](_0x4d0b47,_0xae41('0x2b'));}),_[_0xae41('0x69')](_0x535a19,function(_0x4c5671){return util[_0xae41('0x6a')]('cf_%d',_0x4c5671['id']);}));}})[_0xae41('0x17')](function(_0x293954){if(_0x293954&&!_[_0xae41('0x6e')](_0x293954)){var _0x213a0e=squel[_0xae41('0x16')]()['table'](_0xae41('0x6f'))[_0xae41('0x70')](_0x293954)['where'](_0xae41('0x71'),_0x267789[_0xae41('0x26')]['id'])['toParam']();return db['sequelize'][_0xae41('0x2e')](_0x213a0e[_0xae41('0x72')],{'replacements':_0x213a0e['values']});}})[_0xae41('0x17')](function(){if(_0x267789[_0xae41('0x38')][_0xae41('0x73')]&&_0x16ba72){return db[_0xae41('0x3d')]['update']({'phone':_0x267789[_0xae41('0x38')][_0xae41('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x16ba72['id']}});}})[_0xae41('0x17')](function(){return _0x16ba72;})[_0xae41('0x17')](respondWithResult(_0x2159f8,null))[_0xae41('0x23')](handleError(_0x2159f8,null));};exports[_0xae41('0x74')]=function(_0x24c8d3,_0x15cffd){var _0xef0220={};var _0x18e640={};var _0x114cd0;var _0x56a506;return db['CmContact'][_0xae41('0x75')]({'where':{'id':_0x24c8d3['params']['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x15cffd,null))[_0xae41('0x17')](function(_0x140325){if(_0x140325){_0x114cd0=_0x140325;_0x18e640[_0xae41('0x76')]=_[_0xae41('0x28')](db[_0xae41('0x62')]['rawAttributes']);_0x18e640['query']=_[_0xae41('0x28')](_0x24c8d3[_0xae41('0x2e')]);_0x18e640[_0xae41('0x77')]=_[_0xae41('0x78')](_0x18e640['model'],_0x18e640['query']);_0xef0220[_0xae41('0x79')]=_[_0xae41('0x78')](_0x18e640[_0xae41('0x76')],qs[_0xae41('0x7a')](_0x24c8d3[_0xae41('0x2e')][_0xae41('0x7a')]));_0xef0220['attributes']=_0xef0220[_0xae41('0x79')][_0xae41('0x29')]?_0xef0220[_0xae41('0x79')]:_0x18e640[_0xae41('0x76')];_0xef0220[_0xae41('0x7b')]=qs[_0xae41('0x7c')](_0x24c8d3[_0xae41('0x2e')][_0xae41('0x7c')]);_0xef0220[_0xae41('0x7d')]=qs[_0xae41('0x77')](_[_0xae41('0x7e')](_0x24c8d3[_0xae41('0x2e')],_0x18e640[_0xae41('0x77')]));if(_0x24c8d3['query'][_0xae41('0x7f')]){_0xef0220['where']=_['merge'](_0xef0220[_0xae41('0x7d')],{'$or':_[_0xae41('0x69')](_0xef0220[_0xae41('0x79')],function(_0x31b127){var _0x751c9c={};_0x751c9c[_0x31b127]={'$like':'%'+_0x24c8d3[_0xae41('0x2e')][_0xae41('0x7f')]+'%'};return _0x751c9c;})});}_0xef0220=_[_0xae41('0x37')]({},_0xef0220,_0x24c8d3['options']);return _0x114cd0['getTags'](_0xef0220);}})[_0xae41('0x17')](function(_0x4ad8c2){if(_0x4ad8c2){_0x56a506=_0x4ad8c2[_0xae41('0x29')];if(!_0x24c8d3[_0xae41('0x2e')][_0xae41('0x5e')](_0xae41('0x80'))){_0xef0220['limit']=qs[_0xae41('0x12')](_0x24c8d3[_0xae41('0x2e')][_0xae41('0x12')]);_0xef0220[_0xae41('0xf')]=qs[_0xae41('0xf')](_0x24c8d3[_0xae41('0x2e')][_0xae41('0xf')]);}return _0x114cd0['getTags'](_0xef0220);}})['then'](function(_0x5ce982){if(_0x5ce982){return _0x5ce982?{'count':_0x56a506,'rows':_0x5ce982}:null;}})[_0xae41('0x17')](respondWithResult(_0x15cffd,null))[_0xae41('0x23')](handleError(_0x15cffd,null));};exports[_0xae41('0x81')]=function(_0x290e3f,_0x10923f){if(_0x290e3f[_0xae41('0x38')]['id']){delete _0x290e3f['body']['id'];}return db[_0xae41('0x24')][_0xae41('0x75')]({'where':{'id':_0x290e3f['params']['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x10923f,null))['then'](function(_0x13f71f){if(_0x13f71f){return _0x13f71f[_0xae41('0x81')](_0x290e3f[_0xae41('0x38')]['ids']||[]);}return null;})[_0xae41('0x17')](respondWithResult(_0x10923f,null))[_0xae41('0x23')](handleError(_0x10923f,null));};exports[_0xae41('0x82')]=function(_0x9b6fc8,_0x2d674a){var _0x20be67=[];_0x20be67[_0xae41('0x5b')](addAdditionalPhones(_0x9b6fc8[_0xae41('0x38')]));Promise['all'](_0x20be67)[_0xae41('0x17')](function(){_0x20be67=[];_0x20be67['push'](deleteCmHopperPhones(_0x9b6fc8[_0xae41('0x38')]['id']));_0x20be67['push'](addCmHopperPhones(_0x9b6fc8[_0xae41('0x38')]['id']));Promise[_0xae41('0x60')](_0x20be67)[_0xae41('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x2d674a,null));});};function addAdditionalPhones(_0x341399){var _0x5086a4;return new Promise(function(_0x4596ea){return db['CmContactHasItem'][_0xae41('0x18')]({'where':{'CmContactId':_0x341399['id']}})[_0xae41('0x17')](function(){db[_0xae41('0x64')]['findAll']({'raw':!![],'attributes':['id',_0xae41('0x83')]})[_0xae41('0x17')](function(_0x3eeb86){var _0xf7b506=[];for(var _0x5b52f8=0x0;_0x5b52f8<_0x341399[_0xae41('0x84')][_0xae41('0x29')];_0x5b52f8++){var _0x34bfec=_0x341399['item_types']?_[_0xae41('0x55')](_0x341399[_0xae41('0x85')][_0x5b52f8])?'':_0x341399[_0xae41('0x85')][_0x5b52f8]:_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x86')]?_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x86')]:'';var _0x3d82e3=_['isNil'](_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x87')])?'':_0x341399['items'][_0x5b52f8][_0xae41('0x87')];var _0x3e61e3=_0x34bfec+':'+_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x73')]+'§'+_0x3d82e3;if(_[_0xae41('0x55')](_0x5086a4))_0x5086a4=_0x3e61e3;else _0x5086a4+=';'+_0x3e61e3;var _0x141c67=null;var _0x56e231=null;if(_0x341399['item_types']){if(!_[_0xae41('0x55')](_0x341399[_0xae41('0x85')][_0x5b52f8])){_0x56e231=_[_0xae41('0x25')](_0x3eeb86,function(_0x5a9bfc){return _0x5a9bfc['id']===_0x341399[_0xae41('0x85')][_0x5b52f8];});if(!_[_0xae41('0x55')](_0x56e231)){_0x141c67=_0x56e231[_0xae41('0x83')];}}}else{if(!_[_0xae41('0x55')](_0x341399[_0xae41('0x84')][_0x5b52f8])){_0x56e231=_[_0xae41('0x25')](_0x3eeb86,function(_0x906884){return _0x906884['id']===_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x86')];});if(!_['isNil'](_0x56e231)){_0x141c67=_0x5b52f8;}}}if(_[_0xae41('0x55')](_0x141c67)){_0x141c67=0x64;}_0xf7b506['push'](addAdditionalPhone(_0x341399['id'],_0x341399[_0xae41('0x84')][_0x5b52f8]['phone'],_0x341399[_0xae41('0x85')]?_['isNil'](_0x341399[_0xae41('0x85')][_0x5b52f8])?null:_0x341399[_0xae41('0x85')][_0x5b52f8]:_0x341399[_0xae41('0x84')][_0x5b52f8][_0xae41('0x86')]?_0x341399[_0xae41('0x84')][_0x5b52f8]['ItemTypeId']:null,_0x141c67,_0x3d82e3));}Promise['all'](_0xf7b506)[_0xae41('0x17')](function(){db[_0xae41('0x24')][_0xae41('0x16')]({'AdditionalPhones':_0x5086a4},{'where':{'id':_0x341399['id']}})[_0xae41('0x17')](function(){_0x4596ea(0x1);});});});});});}function addAdditionalPhone(_0x1674d4,_0x11706c,_0x4fe7ab,_0x44267f,_0x435db9){return db[_0xae41('0x49')][_0xae41('0x25')]({'where':{'CmContactId':_0x1674d4,'item':_0x11706c}})[_0xae41('0x17')](function(_0x67ed15){if(_0x67ed15)logger[_0xae41('0x34')](_0xae41('0x88'),_0x67ed15);else{db[_0xae41('0x49')][_0xae41('0x3f')]({'CmContactId':_0x1674d4,'item':_0x11706c,'ItemTypeId':_0x4fe7ab,'OrderBy':_0x44267f,'ItemClass':'PHONE','description':_0x435db9});}});}function deleteCmHopperPhones(_0x1fa974){return new Promise(function(_0x20a6fc){return db['CmHopper'][_0xae41('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1fa974}})[_0xae41('0x17')](function(_0x1f57bd){db[_0xae41('0x89')][_0xae41('0x18')]({'where':{'CmHopperId':{'$in':_[_0xae41('0x69')](_0x1f57bd,'id')}}});})['then'](function(){_0x20a6fc(0x1);});});}function addCmHopperPhones(_0x5b91bf){return new Promise(function(_0x2082c9){return db[_0xae41('0x3d')][_0xae41('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b91bf}})[_0xae41('0x17')](function(_0x5aaed6){var _0x30157c=[];_[_0xae41('0x69')](_0x5aaed6,function(_0x4c1f6c){_0x30157c[_0xae41('0x5b')](createCmHopperPhone(_0x5b91bf,_0x4c1f6c['id']));});Promise['all'](_0x30157c)[_0xae41('0x17')](function(){_0x2082c9(0x1);});});});}function createCmHopperPhone(_0x33bd69,_0xdc7327){return new Promise(function(_0x4a7181){db[_0xae41('0x49')][_0xae41('0x21')]({'raw':!![],'attributes':[_0xae41('0x8a'),_0xae41('0x83')],'where':{'CmContactId':_0x33bd69,'ItemClass':_0xae41('0x8b')},'include':[{'model':db['ContactItemType'],'attributes':[_0xae41('0x83')],'as':_0xae41('0x65')}],'order':[_0xae41('0x83'),db[_0xae41('0x66')][_0xae41('0x67')](_0xae41('0x8c'))]})['then'](function(_0x2d8d42){var _0x3e3dee=0x1;var _0x4df1d2=_['map'](_0x2d8d42,function(_0x2db6b5){_0x2db6b5[_0xae41('0x8d')]=_0xdc7327;_0x2db6b5[_0xae41('0x73')]=_0x2db6b5[_0xae41('0x8a')];_0x2db6b5['OrderBy']=_0x3e3dee;delete _0x2db6b5[_0xae41('0x8e')];_0x3e3dee=_0x3e3dee+0x1;return _0x2db6b5;});return db['CmHopperAdditionalPhone'][_0xae41('0x8f')](_0x4df1d2,{});})[_0xae41('0x17')](function(){_0x4a7181(0x1);});});}function insertAdditionalPhones(_0x66f7d0,_0x50ac75){return new Promise(function(_0x30c4d7){var _0x3a7ba2=[];for(var _0x5ac28b=0x0;_0x5ac28b<_0x50ac75[_0xae41('0x29')];_0x5ac28b++){var _0x1359a3=_0x50ac75[_0x5ac28b];_0x3a7ba2[_0xae41('0x5b')](parseContactItemType(_0x1359a3));}Promise[_0xae41('0x60')](_0x3a7ba2)[_0xae41('0x17')](function(){var _0x2fbac4={'id':_0x66f7d0['id'],'items':_0x50ac75};return addAdditionalPhones(_0x2fbac4)[_0xae41('0x17')](function(){return addCmHopperPhones(_0x66f7d0['id']);});})['then'](function(){_0x30c4d7(_0x66f7d0);});});}function parseContactItemType(_0x3b5a7e){return new Promise(function(_0x5e99b3){if(_0x3b5a7e['hasOwnProperty'](_0xae41('0x86'))){_0x5e99b3(_0x3b5a7e);}else{return db['ContactItemType'][_0xae41('0x25')]({'where':{'name':_0x3b5a7e[_0xae41('0x65')]}})['then'](function(_0x1c3473){if(_[_0xae41('0x55')](_0x1c3473))_0x3b5a7e[_0xae41('0x86')]=null;else _0x3b5a7e[_0xae41('0x86')]=_0x1c3473['id'];_0x5e99b3(_0x3b5a7e);});}});}exports['getAdditionalPhones']=function(_0x410a7e,_0x182d23){return db[_0xae41('0x49')][_0xae41('0x21')]({'raw':!![],'where':{'CmContactId':_0x410a7e[_0xae41('0x26')]['id'],'ItemClass':_0xae41('0x8b')},'include':[{'model':db[_0xae41('0x64')],'as':_0xae41('0x65')}],'order':[[_0xae41('0x83')],[db[_0xae41('0x66')][_0xae41('0x67')](_0xae41('0x8c'))]]})[_0xae41('0x17')](function(_0x3d68c3){return _0x3d68c3;})[_0xae41('0x17')](respondWithResult(_0x182d23,null))[_0xae41('0x23')](handleError(_0x182d23,null));};exports[_0xae41('0x90')]=function(_0x247d85,_0x1bab64){return db['CmContactHasItem'][_0xae41('0x21')]({'raw':!![],'where':{'CmContactId':_0x247d85[_0xae41('0x38')][_0xae41('0x91')]}})['then'](function(_0x3a9c5a){var _0x5a8e22=_[_0xae41('0x69')](_0x3a9c5a,function(_0x5a8e88){_0x5a8e88['CmContactId']=_0x247d85[_0xae41('0x38')][_0xae41('0x92')];return _0x5a8e88;});return db[_0xae41('0x49')][_0xae41('0x8f')](_0x5a8e22,{});})[_0xae41('0x17')](function(){return addCmHopperPhones(_0x247d85[_0xae41('0x38')][_0xae41('0x92')]);})[_0xae41('0x17')](function(){return['ok'];})[_0xae41('0x17')](respondWithResult(_0x1bab64,null))[_0xae41('0x23')](handleError(_0x1bab64,null));};exports['rescheduleAdditionalPhones']=function(_0x2e55be,_0x47ee70){var _0x2a4c78=[];_0x2a4c78[_0xae41('0x5b')](createCmHopperPhone(_0x2e55be[_0xae41('0x38')]['id'],_0x2e55be['body'][_0xae41('0x93')]));Promise[_0xae41('0x60')](_0x2a4c78)['then'](function(){return[0x1];})['then'](respondWithResult(_0x47ee70,null));};exports[_0xae41('0x94')]=function(_0x4d54b4,_0x485468){var _0x5f3153={'raw':![],'where':{}};var _0x19b8e9={};var _0x212aec={'count':0x0,'rows':[]};return db[_0xae41('0x24')][_0xae41('0x75')]({'where':{'id':_0x4d54b4['params']['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x485468,null))[_0xae41('0x17')](function(_0xb4e27a){if(_0xb4e27a){_0x19b8e9['model']=_[_0xae41('0x28')](db['CmHopper'][_0xae41('0x95')]);_0x19b8e9['query']=_['keys'](_0x4d54b4[_0xae41('0x2e')]);_0x19b8e9[_0xae41('0x77')]=_[_0xae41('0x78')](_0x19b8e9['model'],_0x19b8e9[_0xae41('0x2e')]);_0x5f3153[_0xae41('0x79')]=_[_0xae41('0x78')](_0x19b8e9[_0xae41('0x76')],qs[_0xae41('0x7a')](_0x4d54b4[_0xae41('0x2e')][_0xae41('0x7a')]));_0x5f3153[_0xae41('0x79')]=_0x5f3153[_0xae41('0x79')][_0xae41('0x29')]?_0x5f3153['attributes']:_0x19b8e9[_0xae41('0x76')];if(!_0x4d54b4[_0xae41('0x2e')]['hasOwnProperty']('nolimit')){_0x5f3153[_0xae41('0x12')]=qs[_0xae41('0x12')](_0x4d54b4[_0xae41('0x2e')][_0xae41('0x12')]);_0x5f3153[_0xae41('0xf')]=qs['offset'](_0x4d54b4[_0xae41('0x2e')][_0xae41('0xf')]);}_0x5f3153['order']=qs['sort'](_0x4d54b4[_0xae41('0x2e')][_0xae41('0x7c')]);_0x5f3153[_0xae41('0x7d')]=qs[_0xae41('0x77')](_[_0xae41('0x7e')](_0x4d54b4['query'],_0x19b8e9[_0xae41('0x77')]));_0x5f3153['where'][_0xae41('0x96')]=_0xb4e27a['id'];if(_0x4d54b4[_0xae41('0x2e')]['filter']){_0x5f3153['where']=_[_0xae41('0x37')](_0x5f3153['where'],{'$or':_[_0xae41('0x69')](_0x5f3153['attributes'],function(_0x1ac61c){var _0x2ea1be={};_0x2ea1be[_0x1ac61c]={'$like':'%'+_0x4d54b4[_0xae41('0x2e')][_0xae41('0x7f')]+'%'};return _0x2ea1be;})});}_0x5f3153=_['merge']({},_0x5f3153,_0x4d54b4[_0xae41('0x97')]);return db[_0xae41('0x3d')][_0xae41('0x11')]({'where':_0x5f3153[_0xae41('0x7d')]})[_0xae41('0x17')](function(_0x341547){_0x212aec['count']=_0x341547;if(_0x4d54b4['query']['includeAll']){_0x5f3153[_0xae41('0x98')]=[{'all':!![]}];}return db[_0xae41('0x3d')]['findAll'](_0x5f3153);})[_0xae41('0x17')](function(_0xc43e75){_0x212aec['rows']=_0xc43e75;return _0x212aec;});}})[_0xae41('0x17')](respondWithFilteredResult(_0x485468,_0x5f3153))['catch'](handleError(_0x485468,null));};exports[_0xae41('0x99')]=function(_0x5c7aae,_0x50ca5f){var _0x156c13={'raw':!![],'where':{}};var _0x2f22e4={};var _0x1ebd62={'count':0x0,'rows':[]};return db['CmContact'][_0xae41('0x75')]({'where':{'id':_0x5c7aae['params']['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x50ca5f,null))[_0xae41('0x17')](function(_0x25052d){if(_0x25052d){_0x2f22e4[_0xae41('0x76')]=_['keys'](db[_0xae41('0x4a')][_0xae41('0x95')]);_0x2f22e4[_0xae41('0x2e')]=_['keys'](_0x5c7aae[_0xae41('0x2e')]);_0x2f22e4[_0xae41('0x77')]=_[_0xae41('0x78')](_0x2f22e4[_0xae41('0x76')],_0x2f22e4[_0xae41('0x2e')]);_0x156c13[_0xae41('0x79')]=_[_0xae41('0x78')](_0x2f22e4[_0xae41('0x76')],qs['fields'](_0x5c7aae[_0xae41('0x2e')][_0xae41('0x7a')]));_0x156c13['attributes']=_0x156c13['attributes'][_0xae41('0x29')]?_0x156c13[_0xae41('0x79')]:_0x2f22e4[_0xae41('0x76')];if(!_0x5c7aae[_0xae41('0x2e')]['hasOwnProperty'](_0xae41('0x80'))){_0x156c13[_0xae41('0x12')]=qs['limit'](_0x5c7aae[_0xae41('0x2e')]['limit']);_0x156c13[_0xae41('0xf')]=qs[_0xae41('0xf')](_0x5c7aae[_0xae41('0x2e')]['offset']);}_0x156c13[_0xae41('0x7b')]=qs[_0xae41('0x7c')](_0x5c7aae['query'][_0xae41('0x7c')]);_0x156c13[_0xae41('0x7d')]=qs[_0xae41('0x77')](_[_0xae41('0x7e')](_0x5c7aae[_0xae41('0x2e')],_0x2f22e4[_0xae41('0x77')]));_0x156c13['where'][_0xae41('0x96')]=_0x25052d['id'];if(_0x5c7aae[_0xae41('0x2e')]['filter']){_0x156c13[_0xae41('0x7d')]=_[_0xae41('0x37')](_0x156c13[_0xae41('0x7d')],{'$or':_[_0xae41('0x69')](_0x156c13['attributes'],function(_0xd7aabd){var _0x165c8f={};_0x165c8f[_0xd7aabd]={'$like':'%'+_0x5c7aae[_0xae41('0x2e')]['filter']+'%'};return _0x165c8f;})});}_0x156c13=_[_0xae41('0x37')]({},_0x156c13,_0x5c7aae[_0xae41('0x97')]);return db[_0xae41('0x4a')][_0xae41('0x11')]({'where':_0x156c13[_0xae41('0x7d')]})[_0xae41('0x17')](function(_0x29cd9d){_0x1ebd62[_0xae41('0x11')]=_0x29cd9d;if(_0x5c7aae[_0xae41('0x2e')]['includeAll']){_0x156c13[_0xae41('0x98')]=[{'all':!![]}];}return db[_0xae41('0x4a')][_0xae41('0x21')](_0x156c13);})[_0xae41('0x17')](function(_0x46256a){_0x1ebd62[_0xae41('0x9a')]=_0x46256a;return _0x1ebd62;});}})[_0xae41('0x17')](respondWithFilteredResult(_0x50ca5f,_0x156c13))[_0xae41('0x23')](handleError(_0x50ca5f,null));};exports[_0xae41('0x9b')]=function(_0x1ccd25,_0x4287f9){var _0x5e8474={'raw':!![],'where':{}};var _0x4d6a83={};var _0x472909={'count':0x0,'rows':[]};return db[_0xae41('0x24')]['findOne']({'where':{'id':_0x1ccd25['params']['id']}})[_0xae41('0x17')](handleEntityNotFound(_0x4287f9,null))['then'](function(_0x105751){if(_0x105751){_0x4d6a83[_0xae41('0x76')]=_['keys'](db[_0xae41('0x9c')][_0xae41('0x95')]);_0x4d6a83[_0xae41('0x2e')]=_[_0xae41('0x28')](_0x1ccd25[_0xae41('0x2e')]);_0x4d6a83[_0xae41('0x77')]=_['intersection'](_0x4d6a83[_0xae41('0x76')],_0x4d6a83['query']);_0x5e8474[_0xae41('0x79')]=_[_0xae41('0x78')](_0x4d6a83[_0xae41('0x76')],qs[_0xae41('0x7a')](_0x1ccd25['query'][_0xae41('0x7a')]));_0x5e8474[_0xae41('0x79')]=_0x5e8474[_0xae41('0x79')]['length']?_0x5e8474[_0xae41('0x79')]:_0x4d6a83[_0xae41('0x76')];if(!_0x1ccd25[_0xae41('0x2e')][_0xae41('0x5e')]('nolimit')){_0x5e8474['limit']=qs[_0xae41('0x12')](_0x1ccd25[_0xae41('0x2e')][_0xae41('0x12')]);_0x5e8474[_0xae41('0xf')]=qs[_0xae41('0xf')](_0x1ccd25[_0xae41('0x2e')][_0xae41('0xf')]);}_0x5e8474[_0xae41('0x7b')]=qs[_0xae41('0x7c')](_0x1ccd25['query'][_0xae41('0x7c')]);_0x5e8474['where']=qs[_0xae41('0x77')](_['pick'](_0x1ccd25[_0xae41('0x2e')],_0x4d6a83[_0xae41('0x77')]));_0x5e8474['where'][_0xae41('0x96')]=_0x105751['id'];if(_0x1ccd25[_0xae41('0x2e')][_0xae41('0x7f')]){_0x5e8474[_0xae41('0x7d')]=_['merge'](_0x5e8474[_0xae41('0x7d')],{'$or':_['map'](_0x5e8474['attributes'],function(_0x547534){var _0x51383b={};_0x51383b[_0x547534]={'$like':'%'+_0x1ccd25[_0xae41('0x2e')][_0xae41('0x7f')]+'%'};return _0x51383b;})});}_0x5e8474=_[_0xae41('0x37')]({},_0x5e8474,_0x1ccd25['options']);return db[_0xae41('0x9c')][_0xae41('0x11')]({'where':_0x5e8474['where']})[_0xae41('0x17')](function(_0x1b449a){_0x472909[_0xae41('0x11')]=_0x1b449a;if(_0x1ccd25[_0xae41('0x2e')]['includeAll']){_0x5e8474[_0xae41('0x98')]=[{'all':!![]}];}return db[_0xae41('0x9c')][_0xae41('0x21')](_0x5e8474);})[_0xae41('0x17')](function(_0x2ccd50){_0x472909[_0xae41('0x9a')]=_0x2ccd50;return _0x472909;});}})[_0xae41('0x17')](respondWithFilteredResult(_0x4287f9,_0x5e8474))[_0xae41('0x23')](handleError(_0x4287f9,null));};exports[_0xae41('0x9d')]=function(_0x2c046e,_0x27d179){var _0x588d24={'raw':!![],'where':{}};var _0x330200={};var _0x1cd7ac={'count':0x0,'rows':[]};return db['CmContact'][_0xae41('0x75')]({'where':{'id':_0x2c046e[_0xae41('0x26')]['id']}})['then'](handleEntityNotFound(_0x27d179,null))[_0xae41('0x17')](function(_0xb2cf42){if(_0xb2cf42){_0x330200[_0xae41('0x76')]=_['keys'](db[_0xae41('0x52')]['rawAttributes']);_0x330200[_0xae41('0x2e')]=_[_0xae41('0x28')](_0x2c046e[_0xae41('0x2e')]);_0x330200['filters']=_[_0xae41('0x78')](_0x330200[_0xae41('0x76')],_0x330200[_0xae41('0x2e')]);_0x588d24[_0xae41('0x79')]=_[_0xae41('0x78')](_0x330200[_0xae41('0x76')],qs['fields'](_0x2c046e[_0xae41('0x2e')][_0xae41('0x7a')]));_0x588d24[_0xae41('0x79')]=_0x588d24[_0xae41('0x79')][_0xae41('0x29')]?_0x588d24[_0xae41('0x79')]:_0x330200[_0xae41('0x76')];if(!_0x2c046e['query']['hasOwnProperty'](_0xae41('0x80'))){_0x588d24[_0xae41('0x12')]=qs[_0xae41('0x12')](_0x2c046e[_0xae41('0x2e')][_0xae41('0x12')]);_0x588d24['offset']=qs['offset'](_0x2c046e[_0xae41('0x2e')][_0xae41('0xf')]);}_0x588d24[_0xae41('0x7b')]=qs[_0xae41('0x7c')](_0x2c046e['query'][_0xae41('0x7c')]);_0x588d24[_0xae41('0x7d')]=qs[_0xae41('0x77')](_[_0xae41('0x7e')](_0x2c046e['query'],_0x330200[_0xae41('0x77')]));_0x588d24[_0xae41('0x7d')][_0xae41('0x96')]=_0xb2cf42['id'];if(_0x2c046e[_0xae41('0x2e')][_0xae41('0x7f')]){_0x588d24[_0xae41('0x7d')]=_['merge'](_0x588d24['where'],{'$or':_[_0xae41('0x69')](_0x588d24[_0xae41('0x79')],function(_0x576fe8){var _0x12a0f5={};_0x12a0f5[_0x576fe8]={'$like':'%'+_0x2c046e['query'][_0xae41('0x7f')]+'%'};return _0x12a0f5;})});}_0x588d24=_['merge']({},_0x588d24,_0x2c046e[_0xae41('0x97')]);return db[_0xae41('0x52')][_0xae41('0x11')]({'where':_0x588d24[_0xae41('0x7d')]})[_0xae41('0x17')](function(_0xe6d1b1){_0x1cd7ac[_0xae41('0x11')]=_0xe6d1b1;if(_0x2c046e[_0xae41('0x2e')][_0xae41('0x9e')]){_0x588d24[_0xae41('0x98')]=[{'all':!![]}];}return db[_0xae41('0x52')][_0xae41('0x21')](_0x588d24);})[_0xae41('0x17')](function(_0x2e1f57){_0x1cd7ac[_0xae41('0x9a')]=_0x2e1f57;return _0x1cd7ac;});}})[_0xae41('0x17')](respondWithFilteredResult(_0x27d179,_0x588d24))['catch'](handleError(_0x27d179,null));};exports[_0xae41('0x9f')]=function(_0x1f2a70,_0x5248f7){try{if(!_0x1f2a70[_0xae41('0x38')][_0xae41('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1f2a70[_0xae41('0x38')][_0xae41('0xa0')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1f2a70[_0xae41('0x38')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x1f2a70[_0xae41('0x38')][_0xae41('0xa1')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x19364b=_0x1f2a70[_0xae41('0x38')][_0xae41('0xa0')]['split'](',');var _0x5d039b=_0x1f2a70['body'][_0xae41('0xa2')][_0xae41('0xa3')](',');if(!_0x19364b[_0xae41('0x29')]||!_0x5d039b[_0xae41('0x29')]||_0x19364b['length']!==_0x5d039b['length']){throw new Error(_0xae41('0xa4'));}_0x1f2a70[_0xae41('0x38')][_0xae41('0x7a')]=_[_0xae41('0xa5')](_0x19364b,_0x5d039b);if(!_0x1f2a70[_0xae41('0x38')][_0xae41('0x7a')][_0xae41('0x73')]){throw new Error(_0xae41('0xa6'));}if(!_0x1f2a70[_0xae41('0x38')][_0xae41('0x7a')][_0xae41('0xa7')]){throw new Error(_0xae41('0xa8'));}var _0x1ba2ef=path[_0xae41('0x3c')](config['root'],_0xae41('0xa9'),_0x1f2a70[_0xae41('0xaa')][_0xae41('0xab')]);fs[_0xae41('0xac')](_0x1ba2ef,parseInt(_0xae41('0xad'),0x8));var _0x39dd33=require(_0xae41('0xae'))[_0xae41('0xaf')](path[_0xae41('0x3c')](__dirname,_0xae41('0xb0')),[_0x1ba2ef,_0x1f2a70[_0xae41('0x38')][_0xae41('0xa0')],_0x1f2a70['body'][_0xae41('0xa2')],_0x1f2a70[_0xae41('0x38')][_0xae41('0x5c')],_0x1f2a70[_0xae41('0x38')][_0xae41('0xb1')],_0x1f2a70['body'][_0xae41('0x59')],_0x1f2a70['body'][_0xae41('0xa1')]]);return _0x5248f7[_0xae41('0xe')](0xc8)[_0xae41('0x15')]({'message':_0xae41('0xb2'),'pid':_0x39dd33[_0xae41('0xb3')]});}catch(_0x4c1014){return _0x5248f7[_0xae41('0xe')](0x1f4)[_0xae41('0x1d')](_0x4c1014);}};exports[_0xae41('0xb4')]=function(_0x34e58e,_0x365507){var _0x1682a6=fs[_0xae41('0xb5')](_0x34e58e['file'][_0xae41('0x1')]);Papa['parse'](_0x1682a6,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x222816){return _0x365507[_0xae41('0xe')](0xc8)[_0xae41('0x15')]({'file':_0x34e58e[_0xae41('0xaa')],'fields':_0x222816['meta'][_0xae41('0x7a')]});}});};exports[_0xae41('0xb6')]=function(_0x3ea10,_0x2cc5f4){return db[_0xae41('0xb7')][_0xae41('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xae41('0xb8')}})[_0xae41('0x17')](function(_0x10f636){var _0x2ca01c=![];if(!_0x3ea10[_0xae41('0x38')]['ListId']){throw new Error(_0xae41('0xb9'));}if(!_0x3ea10[_0xae41('0x38')][_0xae41('0xba')][_0xae41('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x3ea10[_0xae41('0x38')][_0xae41('0xba')][_0xae41('0xa7')]){throw new Error(_0xae41('0xa8'));}if(!_0x3ea10[_0xae41('0x38')][_0xae41('0xa1')]){throw new Error(_0xae41('0xbb'));}var _0x43ad62=require(_0xae41('0xae'))['fork'](path[_0xae41('0x3c')](__dirname,_0xae41('0xbc')),[_0x3ea10[_0xae41('0x26')]['id'],JSON[_0xae41('0xbd')](_0x3ea10[_0xae41('0x38')]),JSON[_0xae41('0xbd')](_0x10f636)]);_0x43ad62['on'](_0xae41('0xbe'),function(){_0x2ca01c=!![];return _0x2cc5f4[_0xae41('0xe')](0xc8)[_0xae41('0x15')]({'message':_0xae41('0xbf'),'pid':_0x43ad62[_0xae41('0xb3')]});});_0x43ad62['on']('exit',function(_0x10a45d){if(_0x10a45d&&!_0x2ca01c){return _0x2cc5f4[_0xae41('0xe')](0x1f4)['json']({'message':_0xae41('0xc0'),'pid':_0x43ad62[_0xae41('0xb3')]});}});})[_0xae41('0x23')](handleError(_0x2cc5f4,null));};exports[_0xae41('0xc1')]=function(_0x2f7217,_0x5ab4df){return db[_0xae41('0xb7')][_0xae41('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xae41('0xb8')}})[_0xae41('0x17')](function(_0x255f9c){var _0x340617=![];if(!_0x2f7217[_0xae41('0x38')][_0xae41('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2f7217[_0xae41('0x38')]['binding'][_0xae41('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2f7217[_0xae41('0x38')][_0xae41('0xba')][_0xae41('0xa7')]){throw new Error(_0xae41('0xa8'));}if(!_0x2f7217[_0xae41('0x38')][_0xae41('0xa1')]){throw new Error(_0xae41('0xbb'));}var _0x1340ec=require('child_process')[_0xae41('0xaf')](path[_0xae41('0x3c')](__dirname,'../../components/import/cm/csvUpdates'),[_0x2f7217[_0xae41('0x26')]['id'],JSON[_0xae41('0xbd')](_0x2f7217[_0xae41('0x38')]),JSON[_0xae41('0xbd')](_0x255f9c)]);_0x1340ec['on']('message',function(){_0x340617=!![];return _0x5ab4df[_0xae41('0xe')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x1340ec[_0xae41('0xb3')]});});_0x1340ec['on'](_0xae41('0xc2'),function(_0x5df77e){if(_0x5df77e&&!_0x340617){return _0x5ab4df[_0xae41('0xe')](0x1f4)[_0xae41('0x15')]({'message':'error\x20child\x20process','pid':_0x1340ec['pid']});}});})[_0xae41('0x23')](handleError(_0x5ab4df,null));};exports[_0xae41('0xc3')]=function(_0x1d471d,_0x17222b){var _0x493a7a=[_0xae41('0xc4'),_0xae41('0xc5'),_0xae41('0xc6'),_0xae41('0xc7'),_0xae41('0xc8'),_0xae41('0xc9'),_0xae41('0xca')];var _0x80e9b5={'offset':0x0,'order':qs[_0xae41('0x7c')](_0xae41('0xcb'))},_0x8e73a6={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x1d471d[_0xae41('0x2e')]['channel']){if(!_['includes'](_0x493a7a,_0x1d471d[_0xae41('0x2e')]['channel'][_0xae41('0xcc')]())){throw new Error(_0xae41('0xcd'));}_0x493a7a=[_0x1d471d[_0xae41('0x2e')]['channel']['toLowerCase']()];}if(_0x1d471d[_0xae41('0x2e')][_0xae41('0xce')]){try{var _0x4a9fec=JSON[_0xae41('0xcf')](_0x1d471d[_0xae41('0x2e')][_0xae41('0xce')]);if(!moment(_0x4a9fec[_0xae41('0x39')])[_0xae41('0xd0')]()){throw new Error(_0xae41('0xd1'));}if(!moment(_0x4a9fec['to'])['isValid']()){throw new Error(_0xae41('0xd2'));}}catch(_0x1db5b4){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x1d471d['query'][_0xae41('0x5e')](_0xae41('0x80'))){_0x80e9b5[_0xae41('0x12')]=qs['limit'](_0x1d471d[_0xae41('0x2e')][_0xae41('0x12')]||0xa);_0x80e9b5[_0xae41('0xf')]=qs[_0xae41('0xf')](_0x1d471d[_0xae41('0x2e')][_0xae41('0xf')]);}var _0x533b42=_0x493a7a[_0xae41('0x69')](function(_0x34b71c){if(_0x34b71c===_0xae41('0xca')){var _0x416a3b={'attributes':['id',_0xae41('0xd3'),_0xae41('0x32'),_0xae41('0xd4'),_0xae41('0xd5'),_0xae41('0xd6'),_0xae41('0xd7'),_0xae41('0xd8'),_0xae41('0xd9'),_0xae41('0xda'),_0xae41('0xdb'),_0xae41('0xdc'),'userSecondDisposition',_0xae41('0xdd'),_0xae41('0xde')],'where':{'ContactId':_0x1d471d[_0xae41('0x26')]['id']},'include':[{'model':db['User'],'as':_0xae41('0xb7'),'attributes':['id',_0xae41('0x1c'),_0xae41('0xdf'),'alias']}],'order':[[_0xae41('0xdb'),_0xae41('0xe0')]]};if(_0x1d471d['query'][_0xae41('0xce')]){_0x416a3b['where'][_0xae41('0xdb')]={'$gte':_0x4a9fec[_0xae41('0x39')],'$lte':_0x4a9fec['to']};}return db[_0xae41('0x4c')]['findAndCountAll'](_0x416a3b)['then'](function(_0x4d0302){_0x8e73a6[_0xae41('0x11')]+=_0x4d0302[_0xae41('0x11')];return _[_0xae41('0x69')](_0x4d0302['rows'],function(_0x4d3427){var _0x35f18f=_0x4d3427[_0xae41('0x3a')]({'plain':!![]});_0x35f18f[_0xae41('0xe1')]=_0x34b71c;if(_0x35f18f[_0xae41('0xb7')]){_0x35f18f[_0xae41('0xb7')]={'id':_0x35f18f[_0xae41('0xb7')]['id'],'name':_0x35f18f[_0xae41('0xb7')]['name'],'fullname':_0x35f18f[_0xae41('0xb7')]['fullname'],'alias':_0x35f18f[_0xae41('0xb7')]['alias']};}return _0x35f18f;});});}else{var _0x5e8f5f=_[_0xae41('0xe2')](_0x34b71c)+(_0x34b71c===_0xae41('0xc5')?_0xae41('0xe3'):_0xae41('0xe4'));var _0x23ca9a={'attributes':['id',_0xae41('0xe5'),_0xae41('0xe6'),_0xae41('0xdb'),'note',_0xae41('0xe7'),'secondDisposition',_0xae41('0xe8'),_0xae41('0xde'),_0x5e8f5f+'Id'],'where':{'ContactId':_0x1d471d[_0xae41('0x26')]['id']},'include':[{'model':db[_0x5e8f5f],'as':_0xae41('0xe4'),'attributes':['id','name',_0xae41('0xe9')]},{'model':db['User'],'as':_0xae41('0xea'),'attributes':['id',_0xae41('0x1c'),_0xae41('0xdf')]},{'model':db[_0xae41('0x62')],'as':_0xae41('0x63'),'attributes':['id',_0xae41('0x1c'),_0xae41('0xeb')],'through':{'attributes':[]}}],'order':[[_0xae41('0xdb'),'DESC']]};if(_0x1d471d['query'][_0xae41('0xce')]){_0x23ca9a['where']['createdAt']={'$gte':_0x4a9fec[_0xae41('0x39')],'$lte':_0x4a9fec['to']};}switch(_0x34b71c){case _0xae41('0xc5'):_0x23ca9a['attributes'][_0xae41('0x5b')](_0xae41('0xec'),_0xae41('0xed'),_0xae41('0xee'),_0xae41('0xef'),'osName',_0xae41('0xf0'),'ratingType',_0xae41('0xf1'),_0xae41('0xf2'));break;case _0xae41('0xc4'):_0x23ca9a[_0xae41('0x79')][_0xae41('0x5b')](_0xae41('0xf3'),_0xae41('0xf4'));break;case _0xae41('0xc7'):_0x23ca9a[_0xae41('0x79')]['push'](_0xae41('0xf5'),_0xae41('0xf6'));break;}return db[_[_0xae41('0xe2')](_0x34b71c)+'Interaction'][_0xae41('0xf7')](_0x23ca9a)['then'](function(_0x48eb3e){_0x8e73a6[_0xae41('0x11')]+=_0x48eb3e['count'];return _[_0xae41('0x69')](_0x48eb3e[_0xae41('0x9a')],function(_0x2a902b){var _0x4e081c=_0x2a902b['get']({'plain':!![]});_0x4e081c[_0xae41('0xe1')]=_0x34b71c;if(_0x4e081c['Owner']){_0x4e081c['Owner']={'id':_0x4e081c[_0xae41('0xea')]['id'],'name':_0x4e081c[_0xae41('0xea')][_0xae41('0x1c')],'fullname':_0x4e081c[_0xae41('0xea')][_0xae41('0xdf')]};}return _0x4e081c;});});}});return Promise[_0xae41('0x60')](_0x533b42);})['then'](function(_0x7f99b8){return _(_0x7f99b8)[_0xae41('0xf8')]()[_0xae41('0xf9')](_0xae41('0xdb'))['reverse']()[_0xae41('0xfa')]();})[_0xae41('0x17')](function(_0x5737b5){_0x8e73a6[_0xae41('0x9a')]=_0x80e9b5['limit']?_0x5737b5[_0xae41('0xfb')](_0x80e9b5[_0xae41('0xf')],_0x80e9b5[_0xae41('0xf')]+_0x80e9b5[_0xae41('0x12')]):_0x5737b5;return _0x8e73a6;})[_0xae41('0x17')](respondWithFilteredResult(_0x17222b,_0x80e9b5))[_0xae41('0x23')](handleError(_0x17222b,null));}; \ No newline at end of file +var _0x998c=['analytics','CmCustomField','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','from','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappQueueReport','catch','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','hasOwnProperty','all','show','find','params','Tags','color','tag','CmContactHasItem','Phones','ContactItemType','sequelize','literal','get','$and','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','toParam','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','filter','options','nolimit','offset','setTags','findOne','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','pick','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','path','parse','meta','agent','binding','firstName','No\x20firstName\x20column\x20specified','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','chat','sms','openchannel','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','endtime','duration','note','userSecondDisposition','userThirdDisposition','UserId','createdAt','findAndCountAll','startCase','Account','disposition','secondDisposition','thirdDisposition','key','fullname','Tag','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','value','slice','util','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','undefined','count','limit','set','json','update','then','error','stack','name','index','describe','getOptions','findAll','query','user','destroy','CmContact','tags','keys','length','cf_','columnName'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x998c,0x1ca));var _0xc998=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x998c[_0x3d4876];return _0x58ca9d;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc998('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc998('0x1'));var squel=require('squel');var Papa=require(_0xc998('0x2'));var Redis=require(_0xc998('0x3'));var contacts=require(_0xc998('0x4'));var qs=require(_0xc998('0x5'));var logger=require(_0xc998('0x6'))(_0xc998('0x7'));var config=require(_0xc998('0x8'));var shared=require(_0xc998('0x9'));var db=require(_0xc998('0xa'))['db'];config[_0xc998('0xb')]=_['defaults'](config[_0xc998('0xb')],{'host':_0xc998('0xc'),'port':0x18eb});var socket=require(_0xc998('0xd'))(new Redis(config[_0xc998('0xb')]));require(_0xc998('0xe'))[_0xc998('0xf')](socket);function respondWithResult(_0x1c691e,_0x16b391){_0x16b391=_0x16b391||0xc8;return function(_0x4f6c80){if(_0x4f6c80){return _0x1c691e[_0xc998('0x10')](_0x16b391)['json'](_0x4f6c80);}};}function respondWithFilteredResult(_0x10b9d9,_0x580a1e){return function(_0x4070f9){if(_0x4070f9){var _0xff3bf9=typeof _0x580a1e['offset']===_0xc998('0x11')&&typeof _0x580a1e['limit']===_0xc998('0x11');var _0x4cec3a=_0x4070f9[_0xc998('0x12')];var _0x3bcf=_0xff3bf9?0x0:_0x580a1e['offset'];var _0x40702d=_0xff3bf9?_0x4070f9[_0xc998('0x12')]:_0x580a1e['offset']+_0x580a1e[_0xc998('0x13')];var _0x499f0a;if(_0x40702d>=_0x4cec3a){_0x40702d=_0x4cec3a;_0x499f0a=0xc8;}else{_0x499f0a=0xce;}_0x10b9d9[_0xc998('0x10')](_0x499f0a);return _0x10b9d9[_0xc998('0x14')]('Content-Range',_0x3bcf+'-'+_0x40702d+'/'+_0x4cec3a)[_0xc998('0x15')](_0x4070f9);}return null;};}function saveUpdates(_0x3100da){return function(_0xc0b4b6){if(_0xc0b4b6){return _0xc0b4b6[_0xc998('0x16')](_0x3100da)[_0xc998('0x17')](function(_0x155109){return _0x155109;});}return null;};}function removeEntity(_0x3d1345){return function(_0x345af0){if(_0x345af0){return _0x345af0['destroy']()[_0xc998('0x17')](function(){_0x3d1345[_0xc998('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305ad9){return function(_0x11ae9f){if(!_0x11ae9f){_0x305ad9['sendStatus'](0x194);}return _0x11ae9f;};}function handleError(_0x68d43e,_0x3d5c86){_0x3d5c86=_0x3d5c86||0x1f4;return function(_0x1e175c){logger[_0xc998('0x18')](_0x1e175c[_0xc998('0x19')]);if(_0x1e175c[_0xc998('0x1a')]){delete _0x1e175c[_0xc998('0x1a')];}_0x68d43e['status'](_0x3d5c86)['send'](_0x1e175c);};}exports[_0xc998('0x1b')]=function(_0x28d9db,_0x267def){var _0x3a949e={};return contacts[_0xc998('0x1c')]()[_0xc998('0x17')](function(_0x25feba){_0x3a949e=qs[_0xc998('0x1d')](_0x25feba,_0x28d9db);return contacts[_0xc998('0x1e')](_0x28d9db[_0xc998('0x1f')],_0x28d9db[_0xc998('0x20')],_0x3a949e,_0x25feba);})[_0xc998('0x17')](respondWithFilteredResult(_0x267def,_0x3a949e))['catch'](handleError(_0x267def,null));};exports[_0xc998('0x21')]=function(_0x20b1a8,_0x5b8dc4){return db[_0xc998('0x22')]['find']({'where':{'id':_0x20b1a8['params']['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x5b8dc4,null))[_0xc998('0x17')](removeEntity(_0x5b8dc4,null))['catch'](handleError(_0x5b8dc4,null));};exports[_0xc998('0x1c')]=function(_0x4ca44f,_0x2fa32c){return db['CmContact']['describe']()['then'](function(_0x2b5f88){delete _0x2b5f88[_0xc998('0x23')];for(var _0x446cfe=0x0;_0x446cfe0x0){return new Promise(function(_0x1b2c84){var _0x32abfb=[];for(var _0x4e4497=0x0;_0x4e4497<_0x1fbb49[_0xc998('0x25')];_0x4e4497++){_0x32abfb[_0xc998('0x55')](insertAdditionalPhones(_0x1fbb49[_0x4e4497]['contact'],_0x1fbb49[_0x4e4497][_0xc998('0x4f')]));}Promise[_0xc998('0x59')](_0x32abfb)[_0xc998('0x17')](function(){_0x1b2c84(0x1);});})[_0xc998('0x17')](function(){return{'success':_0x30f63a,'failure':_0xc21a27,'duplicates':_0x10a8c4};});}else{return{'success':_0x30f63a,'failure':_0xc21a27,'duplicates':_0x10a8c4};}}})[_0xc998('0x17')](respondWithResult(_0x30fcc7,0xc9))['catch'](handleError(_0x30fcc7,null));};exports[_0xc998('0x5a')]=function(_0x1ff04a,_0x5e41d9){var _0x4de2ee;return db['CmContact']['describe']()[_0xc998('0x17')](function(_0x10f787){return db['CmContact'][_0xc998('0x5b')]({'where':{'id':_0x1ff04a[_0xc998('0x5c')]['id']},'include':[{'model':db['Tag'],'as':_0xc998('0x5d'),'attributes':['id','name',_0xc998('0x5e')],'required':_0x1ff04a[_0xc998('0x1f')][_0xc998('0x5f')]?!![]:![]},{'model':db[_0xc998('0x60')],'as':_0xc998('0x61'),'where':{'CmContactId':_0x1ff04a[_0xc998('0x5c')]['id']},'required':![],'include':[{'model':db[_0xc998('0x62')],'as':'ItemType'}]}],'order':[db[_0xc998('0x63')][_0xc998('0x64')]('Phones.OrderBy')],'attributes':_[_0xc998('0x24')](_0x10f787)});})[_0xc998('0x17')](function(_0x29504e){if(!_['isNil'](_0x29504e)){_0x4de2ee=_0x29504e[_0xc998('0x65')]({'plain':!![]});var _0x1d26e3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x29504e&&_0x29504e[_0xc998('0x56')]){if(_0x29504e['ListId']){_0x1d26e3[_0xc998('0x53')][_0xc998('0x66')][_0xc998('0x55')]({'ListId':{'$ne':_0x29504e[_0xc998('0x56')]}});}}return db[_0xc998('0x29')]['findAll'](_0x1d26e3);}})[_0xc998('0x17')](function(_0x2c7c17){if(!_['isNil'](_0x2c7c17)){return _[_0xc998('0x67')](_0x4de2ee,_[_0xc998('0x68')](_0x2c7c17,function(_0x3f7f09){return util[_0xc998('0x69')](_0xc998('0x6a'),_0x3f7f09['id']);}));}})[_0xc998('0x17')](handleEntityNotFound(_0x5e41d9,null))[_0xc998('0x17')](respondWithResult(_0x5e41d9,null))[_0xc998('0x4a')](handleError(_0x5e41d9,null));};exports[_0xc998('0x16')]=function(_0x451261,_0x577bad){var _0x33bd04;if(_0x451261['body']['id']){delete _0x451261[_0xc998('0x30')]['id'];}if(!_[_0xc998('0x4b')](_0x451261[_0xc998('0x30')][_0xc998('0x4c')])){var _0x5442ae=_0x451261[_0xc998('0x30')][_0xc998('0x4c')];if(!_[_0xc998('0x4b')](shared[_0xc998('0x4d')][_0x5442ae]))_0x451261['body']['utcOffset']=shared['timezones'][_0x5442ae][_0xc998('0x4e')];}return db['CmContact'][_0xc998('0x5b')]({'where':{'id':_0x451261[_0xc998('0x5c')]['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x577bad,null))['then'](saveUpdates(_0x451261[_0xc998('0x30')],null))['then'](function(_0x48974a){_0x33bd04=_0x48974a;var _0xe64741={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x48974a&&_0x48974a[_0xc998('0x56')]){if(_0x48974a[_0xc998('0x56')]){_0xe64741[_0xc998('0x53')]['$and'][_0xc998('0x55')]({'ListId':{'$ne':_0x48974a[_0xc998('0x56')]}});}}return db['CmCustomField'][_0xc998('0x1e')](_0xe64741);})[_0xc998('0x17')](function(_0x4060cf){if(_0x4060cf){return _['omit'](_[_0xc998('0x6b')](_0x451261[_0xc998('0x30')],function(_0x3dbbcc,_0x1fc2e0){return _[_0xc998('0x6c')](_0x1fc2e0,_0xc998('0x26'));}),_[_0xc998('0x68')](_0x4060cf,function(_0x3941ab){return util[_0xc998('0x69')](_0xc998('0x6a'),_0x3941ab['id']);}));}})[_0xc998('0x17')](function(_0x4781df){if(_0x4781df&&!_[_0xc998('0x6d')](_0x4781df)){var _0x353361=squel['update']()[_0xc998('0x6e')](_0xc998('0x6f'))[_0xc998('0x70')](_0x4781df)[_0xc998('0x53')]('id\x20=\x20?',_0x451261[_0xc998('0x5c')]['id'])[_0xc998('0x71')]();return db[_0xc998('0x63')][_0xc998('0x1f')](_0x353361['text'],{'replacements':_0x353361[_0xc998('0x2d')]});}})['then'](function(){if(_0x451261[_0xc998('0x30')][_0xc998('0x72')]&&_0x33bd04){return db[_0xc998('0x36')]['update']({'phone':_0x451261[_0xc998('0x30')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x33bd04['id']}});}})[_0xc998('0x17')](function(){return _0x33bd04;})['then'](respondWithResult(_0x577bad,null))[_0xc998('0x4a')](handleError(_0x577bad,null));};exports[_0xc998('0x73')]=function(_0x9952eb,_0x48f9fb){var _0x1492bd={};var _0xde8228={};var _0x23f723;var _0x66ff70;return db['CmContact']['findOne']({'where':{'id':_0x9952eb[_0xc998('0x5c')]['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x48f9fb,null))[_0xc998('0x17')](function(_0x114667){if(_0x114667){_0x23f723=_0x114667;_0xde8228[_0xc998('0x74')]=_[_0xc998('0x24')](db['Tag'][_0xc998('0x75')]);_0xde8228[_0xc998('0x1f')]=_[_0xc998('0x24')](_0x9952eb[_0xc998('0x1f')]);_0xde8228[_0xc998('0x76')]=_[_0xc998('0x77')](_0xde8228['model'],_0xde8228[_0xc998('0x1f')]);_0x1492bd[_0xc998('0x78')]=_[_0xc998('0x77')](_0xde8228['model'],qs[_0xc998('0x79')](_0x9952eb[_0xc998('0x1f')]['fields']));_0x1492bd[_0xc998('0x78')]=_0x1492bd['attributes'][_0xc998('0x25')]?_0x1492bd[_0xc998('0x78')]:_0xde8228[_0xc998('0x74')];_0x1492bd[_0xc998('0x7a')]=qs['sort'](_0x9952eb['query'][_0xc998('0x7b')]);_0x1492bd[_0xc998('0x53')]=qs[_0xc998('0x76')](_['pick'](_0x9952eb[_0xc998('0x1f')],_0xde8228['filters']));if(_0x9952eb[_0xc998('0x1f')][_0xc998('0x7c')]){_0x1492bd[_0xc998('0x53')]=_['merge'](_0x1492bd[_0xc998('0x53')],{'$or':_['map'](_0x1492bd[_0xc998('0x78')],function(_0x1d63e8){var _0x1f5d93={};_0x1f5d93[_0x1d63e8]={'$like':'%'+_0x9952eb[_0xc998('0x1f')][_0xc998('0x7c')]+'%'};return _0x1f5d93;})});}_0x1492bd=_['merge']({},_0x1492bd,_0x9952eb[_0xc998('0x7d')]);return _0x23f723[_0xc998('0x73')](_0x1492bd);}})['then'](function(_0x34f43a){if(_0x34f43a){_0x66ff70=_0x34f43a['length'];if(!_0x9952eb[_0xc998('0x1f')][_0xc998('0x58')](_0xc998('0x7e'))){_0x1492bd[_0xc998('0x13')]=qs[_0xc998('0x13')](_0x9952eb[_0xc998('0x1f')][_0xc998('0x13')]);_0x1492bd[_0xc998('0x7f')]=qs[_0xc998('0x7f')](_0x9952eb[_0xc998('0x1f')][_0xc998('0x7f')]);}return _0x23f723[_0xc998('0x73')](_0x1492bd);}})[_0xc998('0x17')](function(_0x17fe2c){if(_0x17fe2c){return _0x17fe2c?{'count':_0x66ff70,'rows':_0x17fe2c}:null;}})[_0xc998('0x17')](respondWithResult(_0x48f9fb,null))[_0xc998('0x4a')](handleError(_0x48f9fb,null));};exports[_0xc998('0x80')]=function(_0x53ec05,_0x2e8203){if(_0x53ec05['body']['id']){delete _0x53ec05['body']['id'];}return db['CmContact'][_0xc998('0x81')]({'where':{'id':_0x53ec05[_0xc998('0x5c')]['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x2e8203,null))[_0xc998('0x17')](function(_0x381655){if(_0x381655){return _0x381655[_0xc998('0x80')](_0x53ec05['body']['ids']||[]);}return null;})[_0xc998('0x17')](respondWithResult(_0x2e8203,null))[_0xc998('0x4a')](handleError(_0x2e8203,null));};exports['setAdditionalPhones']=function(_0x387227,_0x4d2955){var _0x24c17a=[];_0x24c17a[_0xc998('0x55')](addAdditionalPhones(_0x387227[_0xc998('0x30')]));Promise[_0xc998('0x59')](_0x24c17a)[_0xc998('0x17')](function(){_0x24c17a=[];_0x24c17a[_0xc998('0x55')](deleteCmHopperPhones(_0x387227[_0xc998('0x30')]['id']));_0x24c17a['push'](addCmHopperPhones(_0x387227[_0xc998('0x30')]['id']));Promise[_0xc998('0x59')](_0x24c17a)['then'](function(){return[0x1];})[_0xc998('0x17')](respondWithResult(_0x4d2955,null));});};function addAdditionalPhones(_0x4cc82a){var _0x48e444;return new Promise(function(_0x555a84){return db[_0xc998('0x60')][_0xc998('0x21')]({'where':{'CmContactId':_0x4cc82a['id']}})[_0xc998('0x17')](function(){db[_0xc998('0x62')][_0xc998('0x1e')]({'raw':!![],'attributes':['id','OrderBy']})[_0xc998('0x17')](function(_0x5baed3){var _0x571889=[];for(var _0x33b2df=0x0;_0x33b2df<_0x4cc82a[_0xc998('0x82')]['length'];_0x33b2df++){var _0x47b09b=_0x4cc82a[_0xc998('0x83')]?_[_0xc998('0x4b')](_0x4cc82a['item_types'][_0x33b2df])?'':_0x4cc82a[_0xc998('0x83')][_0x33b2df]:_0x4cc82a['items'][_0x33b2df]['ItemTypeId']?_0x4cc82a[_0xc998('0x82')][_0x33b2df][_0xc998('0x84')]:'';var _0x5c7653=_['isNil'](_0x4cc82a['items'][_0x33b2df][_0xc998('0x85')])?'':_0x4cc82a[_0xc998('0x82')][_0x33b2df]['description'];var _0x72f628=_0x47b09b+':'+_0x4cc82a[_0xc998('0x82')][_0x33b2df]['phone']+'§'+_0x5c7653;if(_[_0xc998('0x4b')](_0x48e444))_0x48e444=_0x72f628;else _0x48e444+=';'+_0x72f628;var _0x5a9351=null;var _0x3c8133=null;if(_0x4cc82a[_0xc998('0x83')]){if(!_['isNil'](_0x4cc82a['item_types'][_0x33b2df])){_0x3c8133=_['find'](_0x5baed3,function(_0x40ea65){return _0x40ea65['id']===_0x4cc82a['item_types'][_0x33b2df];});if(!_['isNil'](_0x3c8133)){_0x5a9351=_0x3c8133[_0xc998('0x86')];}}}else{if(!_[_0xc998('0x4b')](_0x4cc82a[_0xc998('0x82')][_0x33b2df])){_0x3c8133=_[_0xc998('0x5b')](_0x5baed3,function(_0x50d282){return _0x50d282['id']===_0x4cc82a[_0xc998('0x82')][_0x33b2df]['ItemTypeId'];});if(!_[_0xc998('0x4b')](_0x3c8133)){_0x5a9351=_0x33b2df;}}}if(_['isNil'](_0x5a9351)){_0x5a9351=0x64;}_0x571889[_0xc998('0x55')](addAdditionalPhone(_0x4cc82a['id'],_0x4cc82a['items'][_0x33b2df][_0xc998('0x72')],_0x4cc82a[_0xc998('0x83')]?_[_0xc998('0x4b')](_0x4cc82a[_0xc998('0x83')][_0x33b2df])?null:_0x4cc82a[_0xc998('0x83')][_0x33b2df]:_0x4cc82a['items'][_0x33b2df]['ItemTypeId']?_0x4cc82a['items'][_0x33b2df][_0xc998('0x84')]:null,_0x5a9351,_0x5c7653));}Promise['all'](_0x571889)[_0xc998('0x17')](function(){db[_0xc998('0x22')][_0xc998('0x16')]({'AdditionalPhones':_0x48e444},{'where':{'id':_0x4cc82a['id']}})[_0xc998('0x17')](function(){_0x555a84(0x1);});});});});});}function addAdditionalPhone(_0x2fe8d8,_0x4d8951,_0x32975d,_0x503997,_0x418ce1){return db[_0xc998('0x60')][_0xc998('0x5b')]({'where':{'CmContactId':_0x2fe8d8,'item':_0x4d8951}})[_0xc998('0x17')](function(_0x36dd4b){if(_0x36dd4b)logger[_0xc998('0x39')](_0xc998('0x87'),_0x36dd4b);else{db[_0xc998('0x60')][_0xc998('0x3a')]({'CmContactId':_0x2fe8d8,'item':_0x4d8951,'ItemTypeId':_0x32975d,'OrderBy':_0x503997,'ItemClass':_0xc998('0x88'),'description':_0x418ce1});}});}function deleteCmHopperPhones(_0x23dd99){return new Promise(function(_0x430e95){return db[_0xc998('0x36')][_0xc998('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x23dd99}})['then'](function(_0x108ae6){db[_0xc998('0x89')][_0xc998('0x21')]({'where':{'CmHopperId':{'$in':_[_0xc998('0x68')](_0x108ae6,'id')}}});})[_0xc998('0x17')](function(){_0x430e95(0x1);});});}function addCmHopperPhones(_0x1d65c9){return new Promise(function(_0x97d9ea){return db['CmHopper'][_0xc998('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d65c9}})['then'](function(_0x3d5e92){var _0x3bde07=[];_[_0xc998('0x68')](_0x3d5e92,function(_0x254ae2){_0x3bde07[_0xc998('0x55')](createCmHopperPhone(_0x1d65c9,_0x254ae2['id']));});Promise['all'](_0x3bde07)['then'](function(){_0x97d9ea(0x1);});});});}function createCmHopperPhone(_0x558317,_0x22da1f){return new Promise(function(_0x2eafac){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':[_0xc998('0x8a'),_0xc998('0x86')],'where':{'CmContactId':_0x558317,'ItemClass':_0xc998('0x88')},'include':[{'model':db['ContactItemType'],'attributes':[_0xc998('0x86')],'as':_0xc998('0x8b')}],'order':[_0xc998('0x86'),db['sequelize'][_0xc998('0x64')]('`ItemType`.OrderBy')]})['then'](function(_0x282cd1){var _0xafd508=0x1;var _0x3d1506=_[_0xc998('0x68')](_0x282cd1,function(_0x124315){_0x124315[_0xc998('0x8c')]=_0x22da1f;_0x124315['phone']=_0x124315['item'];_0x124315[_0xc998('0x86')]=_0xafd508;delete _0x124315[_0xc998('0x8d')];_0xafd508=_0xafd508+0x1;return _0x124315;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x3d1506,{});})[_0xc998('0x17')](function(){_0x2eafac(0x1);});});}function insertAdditionalPhones(_0x113e4f,_0x2125b0){return new Promise(function(_0x3fb937){var _0x2db8c5=[];for(var _0x5bc9d8=0x0;_0x5bc9d8<_0x2125b0[_0xc998('0x25')];_0x5bc9d8++){var _0x14c48a=_0x2125b0[_0x5bc9d8];_0x2db8c5[_0xc998('0x55')](parseContactItemType(_0x14c48a));}Promise[_0xc998('0x59')](_0x2db8c5)[_0xc998('0x17')](function(){var _0x336d4f={'id':_0x113e4f['id'],'items':_0x2125b0};return addAdditionalPhones(_0x336d4f)[_0xc998('0x17')](function(){return addCmHopperPhones(_0x113e4f['id']);});})[_0xc998('0x17')](function(){_0x3fb937(_0x113e4f);});});}function parseContactItemType(_0x576dd8){return new Promise(function(_0x4eb749){if(_0x576dd8['hasOwnProperty'](_0xc998('0x84'))){_0x4eb749(_0x576dd8);}else{return db[_0xc998('0x62')]['find']({'where':{'name':_0x576dd8[_0xc998('0x8b')]}})[_0xc998('0x17')](function(_0x3a46ec){if(_['isNil'](_0x3a46ec))_0x576dd8[_0xc998('0x84')]=null;else _0x576dd8[_0xc998('0x84')]=_0x3a46ec['id'];_0x4eb749(_0x576dd8);});}});}exports[_0xc998('0x8e')]=function(_0x49de4d,_0x466522){return db[_0xc998('0x60')][_0xc998('0x1e')]({'raw':!![],'where':{'CmContactId':_0x49de4d['params']['id'],'ItemClass':_0xc998('0x88')},'include':[{'model':db[_0xc998('0x62')],'as':_0xc998('0x8b')}],'order':[[_0xc998('0x86')],[db[_0xc998('0x63')][_0xc998('0x64')](_0xc998('0x8f'))]]})[_0xc998('0x17')](function(_0x22c6f8){return _0x22c6f8;})['then'](respondWithResult(_0x466522,null))[_0xc998('0x4a')](handleError(_0x466522,null));};exports[_0xc998('0x90')]=function(_0x1ecc2c,_0x3d4bdf){return db[_0xc998('0x60')][_0xc998('0x1e')]({'raw':!![],'where':{'CmContactId':_0x1ecc2c[_0xc998('0x30')]['fromContactId']}})[_0xc998('0x17')](function(_0x5ac4c9){var _0x21d84b=_[_0xc998('0x68')](_0x5ac4c9,function(_0x4c9e23){_0x4c9e23[_0xc998('0x91')]=_0x1ecc2c[_0xc998('0x30')][_0xc998('0x92')];return _0x4c9e23;});return db[_0xc998('0x60')]['bulkCreate'](_0x21d84b,{});})[_0xc998('0x17')](function(){return addCmHopperPhones(_0x1ecc2c[_0xc998('0x30')]['toContactId']);})[_0xc998('0x17')](function(){return['ok'];})[_0xc998('0x17')](respondWithResult(_0x3d4bdf,null))[_0xc998('0x4a')](handleError(_0x3d4bdf,null));};exports[_0xc998('0x93')]=function(_0x1267a8,_0x595b13){var _0x5b668e=[];_0x5b668e[_0xc998('0x55')](createCmHopperPhone(_0x1267a8[_0xc998('0x30')]['id'],_0x1267a8[_0xc998('0x30')]['hopperId']));Promise[_0xc998('0x59')](_0x5b668e)[_0xc998('0x17')](function(){return[0x1];})[_0xc998('0x17')](respondWithResult(_0x595b13,null));};exports[_0xc998('0x94')]=function(_0x3d011a,_0x126ae1){var _0x4a54cc={'raw':![],'where':{}};var _0x3f28b4={};var _0x1ecea6={'count':0x0,'rows':[]};return db[_0xc998('0x22')][_0xc998('0x81')]({'where':{'id':_0x3d011a['params']['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x126ae1,null))[_0xc998('0x17')](function(_0x39e1af){if(_0x39e1af){_0x3f28b4[_0xc998('0x74')]=_['keys'](db[_0xc998('0x36')]['rawAttributes']);_0x3f28b4[_0xc998('0x1f')]=_['keys'](_0x3d011a['query']);_0x3f28b4['filters']=_[_0xc998('0x77')](_0x3f28b4['model'],_0x3f28b4['query']);_0x4a54cc['attributes']=_[_0xc998('0x77')](_0x3f28b4['model'],qs[_0xc998('0x79')](_0x3d011a[_0xc998('0x1f')][_0xc998('0x79')]));_0x4a54cc['attributes']=_0x4a54cc[_0xc998('0x78')][_0xc998('0x25')]?_0x4a54cc['attributes']:_0x3f28b4[_0xc998('0x74')];if(!_0x3d011a[_0xc998('0x1f')][_0xc998('0x58')](_0xc998('0x7e'))){_0x4a54cc[_0xc998('0x13')]=qs[_0xc998('0x13')](_0x3d011a[_0xc998('0x1f')]['limit']);_0x4a54cc[_0xc998('0x7f')]=qs[_0xc998('0x7f')](_0x3d011a[_0xc998('0x1f')][_0xc998('0x7f')]);}_0x4a54cc[_0xc998('0x7a')]=qs[_0xc998('0x7b')](_0x3d011a['query'][_0xc998('0x7b')]);_0x4a54cc[_0xc998('0x53')]=qs[_0xc998('0x76')](_[_0xc998('0x95')](_0x3d011a['query'],_0x3f28b4[_0xc998('0x76')]));_0x4a54cc[_0xc998('0x53')][_0xc998('0x96')]=_0x39e1af['id'];if(_0x3d011a[_0xc998('0x1f')]['filter']){_0x4a54cc[_0xc998('0x53')]=_[_0xc998('0x2f')](_0x4a54cc[_0xc998('0x53')],{'$or':_[_0xc998('0x68')](_0x4a54cc['attributes'],function(_0xe54d2c){var _0x2b22ee={};_0x2b22ee[_0xe54d2c]={'$like':'%'+_0x3d011a[_0xc998('0x1f')][_0xc998('0x7c')]+'%'};return _0x2b22ee;})});}_0x4a54cc=_['merge']({},_0x4a54cc,_0x3d011a[_0xc998('0x7d')]);return db[_0xc998('0x36')][_0xc998('0x12')]({'where':_0x4a54cc[_0xc998('0x53')]})[_0xc998('0x17')](function(_0x7dbd5c){_0x1ecea6[_0xc998('0x12')]=_0x7dbd5c;if(_0x3d011a[_0xc998('0x1f')][_0xc998('0x97')]){_0x4a54cc[_0xc998('0x98')]=[{'all':!![]}];}return db['CmHopper'][_0xc998('0x1e')](_0x4a54cc);})[_0xc998('0x17')](function(_0xa9d637){_0x1ecea6[_0xc998('0x99')]=_0xa9d637;return _0x1ecea6;});}})[_0xc998('0x17')](respondWithFilteredResult(_0x126ae1,_0x4a54cc))[_0xc998('0x4a')](handleError(_0x126ae1,null));};exports['getHopperHistories']=function(_0x34fd88,_0x4ee4d3){var _0x57a79a={'raw':!![],'where':{}};var _0x149b4b={};var _0x2a52a0={'count':0x0,'rows':[]};return db[_0xc998('0x22')][_0xc998('0x81')]({'where':{'id':_0x34fd88['params']['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x4ee4d3,null))[_0xc998('0x17')](function(_0x526726){if(_0x526726){_0x149b4b['model']=_[_0xc998('0x24')](db[_0xc998('0x44')][_0xc998('0x75')]);_0x149b4b[_0xc998('0x1f')]=_[_0xc998('0x24')](_0x34fd88['query']);_0x149b4b[_0xc998('0x76')]=_[_0xc998('0x77')](_0x149b4b[_0xc998('0x74')],_0x149b4b[_0xc998('0x1f')]);_0x57a79a[_0xc998('0x78')]=_[_0xc998('0x77')](_0x149b4b[_0xc998('0x74')],qs[_0xc998('0x79')](_0x34fd88[_0xc998('0x1f')]['fields']));_0x57a79a[_0xc998('0x78')]=_0x57a79a[_0xc998('0x78')][_0xc998('0x25')]?_0x57a79a['attributes']:_0x149b4b[_0xc998('0x74')];if(!_0x34fd88[_0xc998('0x1f')][_0xc998('0x58')](_0xc998('0x7e'))){_0x57a79a[_0xc998('0x13')]=qs['limit'](_0x34fd88[_0xc998('0x1f')][_0xc998('0x13')]);_0x57a79a[_0xc998('0x7f')]=qs[_0xc998('0x7f')](_0x34fd88[_0xc998('0x1f')]['offset']);}_0x57a79a['order']=qs[_0xc998('0x7b')](_0x34fd88[_0xc998('0x1f')][_0xc998('0x7b')]);_0x57a79a[_0xc998('0x53')]=qs[_0xc998('0x76')](_[_0xc998('0x95')](_0x34fd88[_0xc998('0x1f')],_0x149b4b[_0xc998('0x76')]));_0x57a79a[_0xc998('0x53')][_0xc998('0x96')]=_0x526726['id'];if(_0x34fd88['query']['filter']){_0x57a79a[_0xc998('0x53')]=_[_0xc998('0x2f')](_0x57a79a[_0xc998('0x53')],{'$or':_[_0xc998('0x68')](_0x57a79a[_0xc998('0x78')],function(_0x2d5da5){var _0x474f46={};_0x474f46[_0x2d5da5]={'$like':'%'+_0x34fd88[_0xc998('0x1f')][_0xc998('0x7c')]+'%'};return _0x474f46;})});}_0x57a79a=_[_0xc998('0x2f')]({},_0x57a79a,_0x34fd88[_0xc998('0x7d')]);return db[_0xc998('0x44')][_0xc998('0x12')]({'where':_0x57a79a[_0xc998('0x53')]})[_0xc998('0x17')](function(_0x22b6f4){_0x2a52a0[_0xc998('0x12')]=_0x22b6f4;if(_0x34fd88[_0xc998('0x1f')][_0xc998('0x97')]){_0x57a79a[_0xc998('0x98')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc998('0x1e')](_0x57a79a);})[_0xc998('0x17')](function(_0x215a00){_0x2a52a0[_0xc998('0x99')]=_0x215a00;return _0x2a52a0;});}})[_0xc998('0x17')](respondWithFilteredResult(_0x4ee4d3,_0x57a79a))['catch'](handleError(_0x4ee4d3,null));};exports[_0xc998('0x9a')]=function(_0x26675e,_0x3bd89e){var _0xb893fd={'raw':!![],'where':{}};var _0x43f2c6={};var _0x2eaf37={'count':0x0,'rows':[]};return db['CmContact'][_0xc998('0x81')]({'where':{'id':_0x26675e[_0xc998('0x5c')]['id']}})[_0xc998('0x17')](handleEntityNotFound(_0x3bd89e,null))[_0xc998('0x17')](function(_0x277895){if(_0x277895){_0x43f2c6['model']=_[_0xc998('0x24')](db[_0xc998('0x43')][_0xc998('0x75')]);_0x43f2c6[_0xc998('0x1f')]=_['keys'](_0x26675e[_0xc998('0x1f')]);_0x43f2c6['filters']=_[_0xc998('0x77')](_0x43f2c6[_0xc998('0x74')],_0x43f2c6[_0xc998('0x1f')]);_0xb893fd[_0xc998('0x78')]=_[_0xc998('0x77')](_0x43f2c6[_0xc998('0x74')],qs['fields'](_0x26675e[_0xc998('0x1f')][_0xc998('0x79')]));_0xb893fd[_0xc998('0x78')]=_0xb893fd[_0xc998('0x78')]['length']?_0xb893fd[_0xc998('0x78')]:_0x43f2c6[_0xc998('0x74')];if(!_0x26675e[_0xc998('0x1f')][_0xc998('0x58')](_0xc998('0x7e'))){_0xb893fd['limit']=qs[_0xc998('0x13')](_0x26675e[_0xc998('0x1f')]['limit']);_0xb893fd[_0xc998('0x7f')]=qs['offset'](_0x26675e[_0xc998('0x1f')][_0xc998('0x7f')]);}_0xb893fd[_0xc998('0x7a')]=qs[_0xc998('0x7b')](_0x26675e[_0xc998('0x1f')][_0xc998('0x7b')]);_0xb893fd[_0xc998('0x53')]=qs[_0xc998('0x76')](_['pick'](_0x26675e[_0xc998('0x1f')],_0x43f2c6[_0xc998('0x76')]));_0xb893fd['where'][_0xc998('0x96')]=_0x277895['id'];if(_0x26675e[_0xc998('0x1f')][_0xc998('0x7c')]){_0xb893fd['where']=_[_0xc998('0x2f')](_0xb893fd[_0xc998('0x53')],{'$or':_[_0xc998('0x68')](_0xb893fd[_0xc998('0x78')],function(_0x4d7efb){var _0x12c07a={};_0x12c07a[_0x4d7efb]={'$like':'%'+_0x26675e[_0xc998('0x1f')][_0xc998('0x7c')]+'%'};return _0x12c07a;})});}_0xb893fd=_[_0xc998('0x2f')]({},_0xb893fd,_0x26675e[_0xc998('0x7d')]);return db['CmHopperFinal'][_0xc998('0x12')]({'where':_0xb893fd[_0xc998('0x53')]})['then'](function(_0x4d18e2){_0x2eaf37[_0xc998('0x12')]=_0x4d18e2;if(_0x26675e[_0xc998('0x1f')][_0xc998('0x97')]){_0xb893fd[_0xc998('0x98')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc998('0x1e')](_0xb893fd);})['then'](function(_0x1f6fe9){_0x2eaf37[_0xc998('0x99')]=_0x1f6fe9;return _0x2eaf37;});}})[_0xc998('0x17')](respondWithFilteredResult(_0x3bd89e,_0xb893fd))[_0xc998('0x4a')](handleError(_0x3bd89e,null));};exports[_0xc998('0x9b')]=function(_0xab4a6,_0x118957){var _0xf5af0e={'raw':!![],'where':{}};var _0x36edd4={};var _0x556a2d={'count':0x0,'rows':[]};return db['CmContact'][_0xc998('0x81')]({'where':{'id':_0xab4a6[_0xc998('0x5c')]['id']}})['then'](handleEntityNotFound(_0x118957,null))[_0xc998('0x17')](function(_0x4ac1de){if(_0x4ac1de){_0x36edd4[_0xc998('0x74')]=_['keys'](db[_0xc998('0x9c')][_0xc998('0x75')]);_0x36edd4[_0xc998('0x1f')]=_['keys'](_0xab4a6[_0xc998('0x1f')]);_0x36edd4[_0xc998('0x76')]=_['intersection'](_0x36edd4['model'],_0x36edd4[_0xc998('0x1f')]);_0xf5af0e[_0xc998('0x78')]=_[_0xc998('0x77')](_0x36edd4[_0xc998('0x74')],qs['fields'](_0xab4a6[_0xc998('0x1f')][_0xc998('0x79')]));_0xf5af0e['attributes']=_0xf5af0e['attributes'][_0xc998('0x25')]?_0xf5af0e[_0xc998('0x78')]:_0x36edd4[_0xc998('0x74')];if(!_0xab4a6[_0xc998('0x1f')][_0xc998('0x58')]('nolimit')){_0xf5af0e[_0xc998('0x13')]=qs['limit'](_0xab4a6[_0xc998('0x1f')][_0xc998('0x13')]);_0xf5af0e['offset']=qs['offset'](_0xab4a6['query']['offset']);}_0xf5af0e['order']=qs[_0xc998('0x7b')](_0xab4a6[_0xc998('0x1f')][_0xc998('0x7b')]);_0xf5af0e[_0xc998('0x53')]=qs[_0xc998('0x76')](_[_0xc998('0x95')](_0xab4a6['query'],_0x36edd4[_0xc998('0x76')]));_0xf5af0e[_0xc998('0x53')]['ContactId']=_0x4ac1de['id'];if(_0xab4a6[_0xc998('0x1f')][_0xc998('0x7c')]){_0xf5af0e['where']=_[_0xc998('0x2f')](_0xf5af0e['where'],{'$or':_[_0xc998('0x68')](_0xf5af0e[_0xc998('0x78')],function(_0x5db712){var _0x3b57f5={};_0x3b57f5[_0x5db712]={'$like':'%'+_0xab4a6[_0xc998('0x1f')]['filter']+'%'};return _0x3b57f5;})});}_0xf5af0e=_['merge']({},_0xf5af0e,_0xab4a6[_0xc998('0x7d')]);return db[_0xc998('0x9c')][_0xc998('0x12')]({'where':_0xf5af0e[_0xc998('0x53')]})[_0xc998('0x17')](function(_0x234508){_0x556a2d[_0xc998('0x12')]=_0x234508;if(_0xab4a6[_0xc998('0x1f')][_0xc998('0x97')]){_0xf5af0e[_0xc998('0x98')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc998('0x1e')](_0xf5af0e);})[_0xc998('0x17')](function(_0x534d44){_0x556a2d[_0xc998('0x99')]=_0x534d44;return _0x556a2d;});}})[_0xc998('0x17')](respondWithFilteredResult(_0x118957,_0xf5af0e))['catch'](handleError(_0x118957,null));};exports[_0xc998('0x9d')]=function(_0x202c2e,_0x11c979){try{if(!_0x202c2e[_0xc998('0x30')]['ListId']){throw new Error(_0xc998('0x9e'));}if(!_0x202c2e[_0xc998('0x30')][_0xc998('0x9f')]){throw new Error(_0xc998('0xa0'));}if(!_0x202c2e['body'][_0xc998('0xa1')]){throw new Error(_0xc998('0xa2'));}if(!_0x202c2e[_0xc998('0x30')][_0xc998('0xa3')]){throw new Error(_0xc998('0xa4'));}var _0xa45103=_0x202c2e[_0xc998('0x30')][_0xc998('0x9f')][_0xc998('0xa5')](',');var _0x35b24f=_0x202c2e[_0xc998('0x30')][_0xc998('0xa1')]['split'](',');if(!_0xa45103[_0xc998('0x25')]||!_0x35b24f[_0xc998('0x25')]||_0xa45103[_0xc998('0x25')]!==_0x35b24f['length']){throw new Error(_0xc998('0xa6'));}_0x202c2e[_0xc998('0x30')][_0xc998('0x79')]=_[_0xc998('0xa7')](_0xa45103,_0x35b24f);if(!_0x202c2e[_0xc998('0x30')][_0xc998('0x79')][_0xc998('0x72')]){throw new Error(_0xc998('0xa8'));}if(!_0x202c2e['body'][_0xc998('0x79')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x191c46=path[_0xc998('0x34')](config[_0xc998('0xa9')],'server/files/tmp',_0x202c2e[_0xc998('0xaa')][_0xc998('0xab')]);fs[_0xc998('0xac')](_0x191c46,parseInt('0777',0x8));var _0x45b0d1=require('child_process')['fork'](path[_0xc998('0x34')](__dirname,_0xc998('0xad')),[_0x191c46,_0x202c2e[_0xc998('0x30')]['binding_keys'],_0x202c2e[_0xc998('0x30')][_0xc998('0xa1')],_0x202c2e[_0xc998('0x30')][_0xc998('0x56')],_0x202c2e[_0xc998('0x30')][_0xc998('0xae')],_0x202c2e[_0xc998('0x30')][_0xc998('0x52')],_0x202c2e[_0xc998('0x30')]['socket_timestamp']]);return _0x11c979[_0xc998('0x10')](0xc8)[_0xc998('0x15')]({'message':_0xc998('0xaf'),'pid':_0x45b0d1[_0xc998('0xb0')]});}catch(_0xbbbafc){return _0x11c979[_0xc998('0x10')](0x1f4)[_0xc998('0xb1')](_0xbbbafc);}};exports[_0xc998('0xb2')]=function(_0x3c5c89,_0x4a5ac2){var _0x14b648=fs[_0xc998('0xb3')](_0x3c5c89[_0xc998('0xaa')][_0xc998('0xb4')]);Papa[_0xc998('0xb5')](_0x14b648,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x583bbb){return _0x4a5ac2[_0xc998('0x10')](0xc8)['json']({'file':_0x3c5c89[_0xc998('0xaa')],'fields':_0x583bbb[_0xc998('0xb6')]['fields']});}});};exports['import']=function(_0x3fdd81,_0x2ec3b6){return db['User'][_0xc998('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc998('0xb7')}})[_0xc998('0x17')](function(_0x49eb93){var _0x2a0df5=![];if(!_0x3fdd81[_0xc998('0x30')]['ListId']){throw new Error(_0xc998('0x9e'));}if(!_0x3fdd81[_0xc998('0x30')][_0xc998('0xb8')][_0xc998('0x72')]){throw new Error(_0xc998('0xa8'));}if(!_0x3fdd81[_0xc998('0x30')][_0xc998('0xb8')][_0xc998('0xb9')]){throw new Error(_0xc998('0xba'));}if(!_0x3fdd81[_0xc998('0x30')][_0xc998('0xa3')]){throw new Error(_0xc998('0xa4'));}var _0x33a918=require(_0xc998('0xbb'))[_0xc998('0xbc')](path[_0xc998('0x34')](__dirname,_0xc998('0xbd')),[_0x3fdd81[_0xc998('0x5c')]['id'],JSON[_0xc998('0xbe')](_0x3fdd81[_0xc998('0x30')]),JSON['stringify'](_0x49eb93)]);_0x33a918['on'](_0xc998('0xbf'),function(){_0x2a0df5=!![];return _0x2ec3b6['status'](0xc8)[_0xc998('0x15')]({'message':_0xc998('0xc0'),'pid':_0x33a918[_0xc998('0xb0')]});});_0x33a918['on']('exit',function(_0x402ecd){if(_0x402ecd&&!_0x2a0df5){return _0x2ec3b6['status'](0x1f4)[_0xc998('0x15')]({'message':_0xc998('0xc1'),'pid':_0x33a918[_0xc998('0xb0')]});}});})['catch'](handleError(_0x2ec3b6,null));};exports[_0xc998('0xc2')]=function(_0x4444a6,_0x5e0d44){return db[_0xc998('0xc3')][_0xc998('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc998('0xb7')}})[_0xc998('0x17')](function(_0x486e35){var _0x51d569=![];if(!_0x4444a6[_0xc998('0x30')][_0xc998('0x56')]){throw new Error(_0xc998('0x9e'));}if(!_0x4444a6[_0xc998('0x30')][_0xc998('0xb8')]['phone']){throw new Error(_0xc998('0xa8'));}if(!_0x4444a6[_0xc998('0x30')][_0xc998('0xb8')]['firstName']){throw new Error(_0xc998('0xba'));}if(!_0x4444a6['body'][_0xc998('0xa3')]){throw new Error(_0xc998('0xa4'));}var _0x2ba938=require(_0xc998('0xbb'))[_0xc998('0xbc')](path[_0xc998('0x34')](__dirname,_0xc998('0xc4')),[_0x4444a6['params']['id'],JSON[_0xc998('0xbe')](_0x4444a6['body']),JSON[_0xc998('0xbe')](_0x486e35)]);_0x2ba938['on'](_0xc998('0xbf'),function(){_0x51d569=!![];return _0x5e0d44[_0xc998('0x10')](0xc8)[_0xc998('0x15')]({'message':_0xc998('0xc0'),'pid':_0x2ba938[_0xc998('0xb0')]});});_0x2ba938['on'](_0xc998('0xc5'),function(_0x1f5b8c){if(_0x1f5b8c&&!_0x51d569){return _0x5e0d44['status'](0x1f4)[_0xc998('0x15')]({'message':_0xc998('0xc1'),'pid':_0x2ba938[_0xc998('0xb0')]});}});})['catch'](handleError(_0x5e0d44,null));};exports['getJourney']=function(_0x1c9f32,_0x4a825a){var _0x2b6256=['mail',_0xc998('0xc6'),_0xc998('0xc7'),_0xc998('0xc8'),'fax','whatsapp',_0xc998('0xc9')];var _0x1bc0aa={'offset':0x0,'order':qs[_0xc998('0x7b')](_0xc998('0xca'))},_0x35987f={'count':0x0,'rows':[]};Promise['resolve']()[_0xc998('0x17')](function(){if(_0x1c9f32['query'][_0xc998('0xcb')]){if(!_[_0xc998('0xcc')](_0x2b6256,_0x1c9f32[_0xc998('0x1f')][_0xc998('0xcb')][_0xc998('0xcd')]())){throw new Error(_0xc998('0xce'));}_0x2b6256=[_0x1c9f32[_0xc998('0x1f')][_0xc998('0xcb')][_0xc998('0xcd')]()];}if(_0x1c9f32['query'][_0xc998('0xcf')]){try{var _0x10b136=JSON[_0xc998('0xb5')](_0x1c9f32[_0xc998('0x1f')]['range']);if(!moment(_0x10b136[_0xc998('0x31')])['isValid']()){throw new Error(_0xc998('0xd0'));}if(!moment(_0x10b136['to'])[_0xc998('0xd1')]()){throw new Error(_0xc998('0xd2'));}}catch(_0x2998c8){throw new Error(_0xc998('0xd3'));}}if(!_0x1c9f32[_0xc998('0x1f')]['hasOwnProperty'](_0xc998('0x7e'))){_0x1bc0aa[_0xc998('0x13')]=qs['limit'](_0x1c9f32['query'][_0xc998('0x13')]||0xa);_0x1bc0aa[_0xc998('0x7f')]=qs[_0xc998('0x7f')](_0x1c9f32['query'][_0xc998('0x7f')]);}var _0x21a14f=_0x2b6256[_0xc998('0x68')](function(_0x446c88){if(_0x446c88===_0xc998('0xc9')){var _0x4d3200={'attributes':['id','uniqueid','type','source',_0xc998('0xd4'),_0xc998('0xd5'),'starttime',_0xc998('0xd6'),_0xc998('0xd7'),_0xc998('0xd8'),'createdAt','userDisposition',_0xc998('0xd9'),_0xc998('0xda'),_0xc998('0xdb')],'where':{'ContactId':_0x1c9f32[_0xc998('0x5c')]['id']},'include':[{'model':db['User'],'as':_0xc998('0xc3'),'attributes':['id',_0xc998('0x1a'),'fullname',_0xc998('0x2a')]}],'order':[[_0xc998('0xdc'),'DESC']]};if(_0x1c9f32[_0xc998('0x1f')][_0xc998('0xcf')]){_0x4d3200[_0xc998('0x53')][_0xc998('0xdc')]={'$gte':_0x10b136['from'],'$lte':_0x10b136['to']};}return db[_0xc998('0x45')][_0xc998('0xdd')](_0x4d3200)[_0xc998('0x17')](function(_0x3c3bf7){_0x35987f['count']+=_0x3c3bf7[_0xc998('0x12')];return _[_0xc998('0x68')](_0x3c3bf7[_0xc998('0x99')],function(_0x5428fe){var _0x190ea3=_0x5428fe[_0xc998('0x65')]({'plain':!![]});_0x190ea3[_0xc998('0xcb')]=_0x446c88;if(_0x190ea3[_0xc998('0xc3')]){_0x190ea3['User']={'id':_0x190ea3[_0xc998('0xc3')]['id'],'name':_0x190ea3[_0xc998('0xc3')][_0xc998('0x1a')],'fullname':_0x190ea3[_0xc998('0xc3')]['fullname'],'alias':_0x190ea3['User'][_0xc998('0x2a')]};}return _0x190ea3;});});}else{var _0x4a89b0=_[_0xc998('0xde')](_0x446c88)+(_0x446c88===_0xc998('0xc6')?'Website':_0xc998('0xdf'));var _0x3f65c4={'attributes':['id','closed','closedAt','createdAt',_0xc998('0xd8'),_0xc998('0xe0'),_0xc998('0xe1'),_0xc998('0xe2'),_0xc998('0xdb'),_0x4a89b0+'Id'],'where':{'ContactId':_0x1c9f32['params']['id']},'include':[{'model':db[_0x4a89b0],'as':_0xc998('0xdf'),'attributes':['id',_0xc998('0x1a'),_0xc998('0xe3')]},{'model':db[_0xc998('0xc3')],'as':'Owner','attributes':['id',_0xc998('0x1a'),_0xc998('0xe4')]},{'model':db[_0xc998('0xe5')],'as':_0xc998('0x5d'),'attributes':['id',_0xc998('0x1a'),_0xc998('0x5e')],'through':{'attributes':[]}}],'order':[[_0xc998('0xdc'),'DESC']]};if(_0x1c9f32[_0xc998('0x1f')][_0xc998('0xcf')]){_0x3f65c4[_0xc998('0x53')][_0xc998('0xdc')]={'$gte':_0x10b136[_0xc998('0x31')],'$lte':_0x10b136['to']};}switch(_0x446c88){case _0xc998('0xc6'):_0x3f65c4[_0xc998('0x78')][_0xc998('0x55')](_0xc998('0xe6'),_0xc998('0xe7'),_0xc998('0xe8'),'deviceModel',_0xc998('0xe9'),_0xc998('0xea'),_0xc998('0xeb'),_0xc998('0xec'),_0xc998('0xed'));break;case'mail':_0x3f65c4[_0xc998('0x78')]['push'](_0xc998('0xee'),_0xc998('0xef'));break;case _0xc998('0xc8'):_0x3f65c4['attributes'][_0xc998('0x55')](_0xc998('0xf0'),_0xc998('0xf1'));break;}return db[_['startCase'](_0x446c88)+_0xc998('0xf2')][_0xc998('0xdd')](_0x3f65c4)['then'](function(_0x9fba46){_0x35987f[_0xc998('0x12')]+=_0x9fba46['count'];return _[_0xc998('0x68')](_0x9fba46[_0xc998('0x99')],function(_0x26ea35){var _0x40bbd5=_0x26ea35[_0xc998('0x65')]({'plain':!![]});_0x40bbd5[_0xc998('0xcb')]=_0x446c88;if(_0x40bbd5[_0xc998('0xf3')]){_0x40bbd5['Owner']={'id':_0x40bbd5['Owner']['id'],'name':_0x40bbd5[_0xc998('0xf3')][_0xc998('0x1a')],'fullname':_0x40bbd5['Owner'][_0xc998('0xe4')]};}return _0x40bbd5;});});}});return Promise['all'](_0x21a14f);})['then'](function(_0x58116d){return _(_0x58116d)[_0xc998('0xf4')]()[_0xc998('0xf5')](_0xc998('0xdc'))[_0xc998('0xf6')]()[_0xc998('0xf7')]();})[_0xc998('0x17')](function(_0x40dabd){_0x35987f['rows']=_0x1bc0aa[_0xc998('0x13')]?_0x40dabd[_0xc998('0xf8')](_0x1bc0aa['offset'],_0x1bc0aa[_0xc998('0x7f')]+_0x1bc0aa['limit']):_0x40dabd;return _0x35987f;})[_0xc998('0x17')](respondWithFilteredResult(_0x4a825a,_0x1bc0aa))[_0xc998('0x4a')](handleError(_0x4a825a,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 54eb477..c2d6d7c 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 _0x8fb2=['events','../../mysqldb','CmContact','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5a882b,_0x395e4e){var _0x1f748d=function(_0x312e25){while(--_0x312e25){_0x5a882b['push'](_0x5a882b['shift']());}};_0x1f748d(++_0x395e4e);}(_0x8fb2,0xea));var _0x28fb=function(_0x39f7d9,_0x1f0e74){_0x39f7d9=_0x39f7d9-0x0;var _0x4a5a93=_0x8fb2[_0x39f7d9];return _0x4a5a93;};'use strict';var EventEmitter=require(_0x28fb('0x0'));var CmContact=require(_0x28fb('0x1'))['db'][_0x28fb('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x28fb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x28fb('0x4')};function emitEvent(_0x58aacf){return function(_0x2f9a82,_0xc27625,_0x2ea64e){CmContactEvents['emit'](_0x58aacf+':'+_0x2f9a82['id'],_0x2f9a82);CmContactEvents[_0x28fb('0x5')](_0x58aacf,_0x2f9a82);_0x2ea64e(null);};}for(var e in events){if(events[_0x28fb('0x6')](e)){var event=events[e];CmContact[_0x28fb('0x7')](e,emitEvent(event));}}module[_0x28fb('0x8')]=CmContactEvents; \ No newline at end of file +var _0x6de2=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','CmContact'];(function(_0x5944fa,_0x188876){var _0x1dd48c=function(_0x34b165){while(--_0x34b165){_0x5944fa['push'](_0x5944fa['shift']());}};_0x1dd48c(++_0x188876);}(_0x6de2,0x17e));var _0x26de=function(_0x5d2e06,_0x368096){_0x5d2e06=_0x5d2e06-0x0;var _0x45c7a3=_0x6de2[_0x5d2e06];return _0x45c7a3;};'use strict';var EventEmitter=require(_0x26de('0x0'));var CmContact=require('../../mysqldb')['db'][_0x26de('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x26de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26de('0x3'),'afterDestroy':_0x26de('0x4')};function emitEvent(_0xe7d6f8){return function(_0xdc4a49,_0x1f848f,_0x46e1be){CmContactEvents['emit'](_0xe7d6f8+':'+_0xdc4a49['id'],_0xdc4a49);CmContactEvents[_0x26de('0x5')](_0xe7d6f8,_0xdc4a49);_0x46e1be(null);};}for(var e in events){if(events[_0x26de('0x6')](e)){var event=events[e];CmContact[_0x26de('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index bbfb17c..144f70e 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 _0xa04f=['Campaign','CmHopperBlack','List\x20not\x20found','destroy','VoiceQueueId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','ListId','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','cmContact,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa04f,0x9d));var _0xfa04=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xa04f[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0xfa04('0x0'));var util=require('util');var logger=require(_0xfa04('0x1'))(_0xfa04('0x2'));var moment=require(_0xfa04('0x3'));var BPromise=require(_0xfa04('0x4'));var rp=require(_0xfa04('0x5'));var fs=require('fs');var path=require(_0xfa04('0x6'));var rimraf=require('rimraf');var config=require(_0xfa04('0x7'));var shared=require(_0xfa04('0x8'));var attributes=require(_0xfa04('0x9'));module[_0xfa04('0xa')]=function(_0x33d517,_0x5d80e4){return _0x33d517[_0xfa04('0xb')]('CmContact',attributes,{'tableName':_0xfa04('0xc'),'paranoid':!![],'indexes':[{'name':_0xfa04('0xd'),'fields':[_0xfa04('0xd')]},{'name':_0xfa04('0xe'),'fields':[_0xfa04('0xf'),_0xfa04('0x10'),_0xfa04('0xd'),_0xfa04('0x11'),_0xfa04('0x12'),'email'],'type':_0xfa04('0x13')}],'timestamps':!![],'charset':_0xfa04('0x14'),'collate':_0xfa04('0x15'),'hooks':{'afterCreate':function(_0x254a70,_0x54f28f,_0x24a0f5){var _0x47fcc8=_0x33d517[_0xfa04('0x16')];var _0xeca78d=_0x254a70[_0xfa04('0x17')]({'plain':!![]});function _0x4e8513(){return function(_0x4f8d99){logger[_0xfa04('0x18')](_0xfa04('0x19'),_0xfa04('0x1a'),util['inspect'](_0x4f8d99,{'showHidden':![],'depth':null}));};}function _0xededea(_0x3d173c,_0x47c145){var _0x3ee5f0=_0x47c145[_0xfa04('0x1b')]?_0x47c145['scheduledat']:moment()[_0xfa04('0x1c')](_0xfa04('0x1d'));return new BPromise(function(_0x3d4c6d,_0xfe516b){if(_[_0xfa04('0x1e')](_0x47c145[_0xfa04('0x1f')])){_0x3d4c6d({'ret':_0x3ee5f0});}else{_0x47fcc8[_0xfa04('0x20')][_0xfa04('0x21')]({'where':{'id':_0x3d173c['id']}})[_0xfa04('0x22')](function(_0xe2b93a){if(!_[_0xfa04('0x1e')](_0xe2b93a)){var _0xf94293=_0xe2b93a[_0xfa04('0x1f')];if(!_[_0xfa04('0x1e')](_0xf94293)){var _0x5112c9=shared[_0xfa04('0x23')];var _0x282f63=_0x5112c9[_0xf94293];var _0x14ce06=_0x5112c9[_0x47c145[_0xfa04('0x1f')]];if(!_[_0xfa04('0x1e')](_0x282f63)&&!_['isNil'](_0x14ce06)){var _0x40869d=_0x282f63['utcOffset']-_0x14ce06[_0xfa04('0x24')];_0x3ee5f0=_0x47c145['scheduledat']?_0x47c145[_0xfa04('0x1b')]:moment();var _0x3e4d80=moment(_0x3ee5f0)[_0xfa04('0x25')](_0x40869d,_0xfa04('0x26'));_0x3d4c6d({'ret':_0x3e4d80['format'](_0xfa04('0x1d'))});}else _0x3d4c6d({'ret':_0x3ee5f0});}else _0x3d4c6d({'ret':_0x3ee5f0});}else{_0x3d4c6d({'ret':_0x3ee5f0});}});}});return 0xa;}var _0x48d02a=function(_0x53c2ff){return new BPromise(function(_0x49487a,_0xdb7bdc){_0xededea(_0x53c2ff,_0xeca78d)[_0xfa04('0x22')](function(_0x581ce2){_0xeca78d[_0xfa04('0x1b')]=_0x581ce2[_0xfa04('0x27')];_0x47fcc8[_0xfa04('0x28')][_0xfa04('0x21')]({'where':{'phone':_0xeca78d[_0xfa04('0xd')],'VoiceQueueId':_0x53c2ff['id']}})[_0xfa04('0x22')](function(_0x1e5139){if(!_[_0xfa04('0x1e')](_0x1e5139)){throw new Error(_0xfa04('0x29')+_0xeca78d[_0xfa04('0xd')]+_0xfa04('0x2a')+_0x53c2ff['id']);}return _0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d[_0xfa04('0xd')],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d['ListId'],'priority':_0xeca78d[_0xfa04('0x2c')]?_0xeca78d[_0xfa04('0x2c')]:0x2,'scheduledat':_0xeca78d[_0xfa04('0x1b')]?_0xeca78d[_0xfa04('0x1b')]:moment()[_0xfa04('0x1c')](_0xfa04('0x1d')),'callback':_0xeca78d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xeca78d[_0xfa04('0x2d')]?_0xeca78d[_0xfa04('0x2d')]:undefined,'callbackat':_0xeca78d[_0xfa04('0x2d')]?moment()[_0xfa04('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x53c2ff['id']});})[_0xfa04('0x2e')](function(_0x2333ff){_0xdb7bdc(_0x2333ff);});});});};var _0x4ce4e5=function(_0x12bcd3){return new BPromise(function(_0x2a8dc7,_0x319bfd){_0xededea(_0x12bcd3,_0xeca78d)[_0xfa04('0x22')](function(_0x465997){_0xeca78d[_0xfa04('0x1b')]=_0x465997['ret'];_0x47fcc8[_0xfa04('0x28')][_0xfa04('0x21')]({'where':{'phone':_0xeca78d[_0xfa04('0xd')],'VoiceQueueId':_0x12bcd3['id']}})[_0xfa04('0x22')](function(_0x25dfa7){if(!_[_0xfa04('0x1e')](_0x25dfa7)){throw new Error(_0xfa04('0x29')+_0xeca78d[_0xfa04('0xd')]+_0xfa04('0x2f')+_0x12bcd3['id']);}return _0x47fcc8[_0xfa04('0x30')][_0xfa04('0x21')]({'where':{'calleridnum':_0xeca78d[_0xfa04('0xd')],'VoiceQueueId':_0x12bcd3['id']}});})['then'](function(_0x58b7cc){if(!_['isNil'](_0x58b7cc)){throw new Error(_0xfa04('0x31')+_0xeca78d[_0xfa04('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x12bcd3['id']);}return _0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d[_0xfa04('0xd')],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d[_0xfa04('0x32')],'priority':_0xeca78d[_0xfa04('0x2c')]?_0xeca78d[_0xfa04('0x2c')]:0x2,'scheduledat':_0xeca78d[_0xfa04('0x1b')]?_0xeca78d['scheduledat']:moment()[_0xfa04('0x1c')](_0xfa04('0x1d')),'callback':_0xeca78d[_0xfa04('0x2d')]?!![]:![],'callbackuniqueid':_0xeca78d[_0xfa04('0x2d')]?_0xeca78d[_0xfa04('0x2d')]:undefined,'callbackat':_0xeca78d[_0xfa04('0x2d')]?moment()[_0xfa04('0x1c')](_0xfa04('0x1d')):undefined,'VoiceQueueId':_0x12bcd3['id']});})[_0xfa04('0x2e')](function(_0x155658){_0x319bfd(_0x155658);});});});};function _0x351594(){return function(_0x1a6582){logger[_0xfa04('0x18')](_0xfa04('0x19'),_0xfa04('0x1a'),util[_0xfa04('0x33')](_0x1a6582,{'showHidden':![],'depth':null}));};}function _0x2e3d3f(_0x54833a,_0x3ef2e6){var _0x16d9d9=_0x3ef2e6[_0xfa04('0x1b')]?_0x3ef2e6[_0xfa04('0x1b')]:moment()[_0xfa04('0x1c')](_0xfa04('0x1d'));return new BPromise(function(_0x44161a,_0x5aa676){if(_['isNil'](_0x3ef2e6[_0xfa04('0x1f')])){_0x44161a({'ret':_0x16d9d9});}else{_0x47fcc8['Campaign'][_0xfa04('0x21')]({'where':{'id':_0x54833a['id']}})[_0xfa04('0x22')](function(_0x43987b){if(!_['isNil'](_0x43987b)){var _0x4e6400=_0x43987b[_0xfa04('0x1f')];if(!_[_0xfa04('0x1e')](_0x4e6400)){var _0x315cd7=shared[_0xfa04('0x23')];var _0x1881be=_0x315cd7[_0x4e6400];var _0x41cba7=_0x315cd7[_0x3ef2e6[_0xfa04('0x1f')]];if(!_[_0xfa04('0x1e')](_0x1881be)&&!_[_0xfa04('0x1e')](_0x41cba7)){var _0x79c3ee=_0x1881be['utcOffset']-_0x41cba7['utcOffset'];_0x16d9d9=_0x3ef2e6['scheduledat']?_0x3ef2e6[_0xfa04('0x1b')]:moment();var _0x37ec46=moment(_0x16d9d9)[_0xfa04('0x25')](_0x79c3ee,_0xfa04('0x26'));_0x44161a({'ret':_0x37ec46[_0xfa04('0x1c')](_0xfa04('0x1d'))});}else _0x44161a({'ret':_0x16d9d9});}else _0x44161a({'ret':_0x16d9d9});}else{_0x44161a({'ret':_0x16d9d9});}});}});return 0xa;}var _0x6a4a20=function(_0x4eadeb){return new BPromise(function(_0x3de3fa,_0x3ad59d){_0x2e3d3f(_0x4eadeb,_0xeca78d)[_0xfa04('0x22')](function(_0x41dd2c){_0xeca78d[_0xfa04('0x1b')]=_0x41dd2c[_0xfa04('0x27')];_0x47fcc8['CmHopper'][_0xfa04('0x21')]({'where':{'phone':_0xeca78d[_0xfa04('0xd')],'CampaignId':_0x4eadeb['id']}})[_0xfa04('0x22')](function(_0x2df7dc){if(!_[_0xfa04('0x1e')](_0x2df7dc)){throw new Error(_0xfa04('0x29')+_0xeca78d['phone']+_0xfa04('0x34')+_0x4eadeb['id']);}return _0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d[_0xfa04('0xd')],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d['ListId'],'priority':_0xeca78d['priority']?_0xeca78d['priority']:0x2,'scheduledat':_0xeca78d[_0xfa04('0x1b')]?_0xeca78d[_0xfa04('0x1b')]:moment()[_0xfa04('0x1c')](_0xfa04('0x1d')),'callback':_0xeca78d[_0xfa04('0x2d')]?!![]:![],'callbackuniqueid':_0xeca78d['callbackUniqueid']?_0xeca78d[_0xfa04('0x2d')]:undefined,'callbackat':_0xeca78d[_0xfa04('0x2d')]?moment()[_0xfa04('0x1c')](_0xfa04('0x1d')):undefined,'CampaignId':_0x4eadeb['id']});})['catch'](function(_0x3c5f5c){_0x3ad59d(_0x3c5f5c);});});});};var _0x3894d5=function(_0x3f0349){return new BPromise(function(_0x3f3cdd,_0xf48563){_0x2e3d3f(_0x3f0349,_0xeca78d)['then'](function(_0x43b976){_0xeca78d[_0xfa04('0x1b')]=_0x43b976['ret'];_0x47fcc8[_0xfa04('0x28')][_0xfa04('0x21')]({'where':{'phone':_0xeca78d['phone'],'CampaignId':_0x3f0349['id']}})[_0xfa04('0x22')](function(_0x19cffa){if(!_[_0xfa04('0x1e')](_0x19cffa)){throw new Error(_0xfa04('0x29')+_0xeca78d[_0xfa04('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3f0349['id']);}return _0x47fcc8[_0xfa04('0x30')][_0xfa04('0x21')]({'where':{'calleridnum':_0xeca78d[_0xfa04('0xd')],'CampaignId':_0x3f0349['id']}});})[_0xfa04('0x22')](function(_0xaf8ca9){if(!_[_0xfa04('0x1e')](_0xaf8ca9)){throw new Error(_0xfa04('0x31')+_0xeca78d[_0xfa04('0xd')]+_0xfa04('0x35')+_0x3f0349['id']);}return _0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d[_0xfa04('0xd')],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d[_0xfa04('0x32')],'priority':_0xeca78d[_0xfa04('0x2c')]?_0xeca78d['priority']:0x2,'scheduledat':_0xeca78d['scheduledat']?_0xeca78d[_0xfa04('0x1b')]:moment()['format'](_0xfa04('0x1d')),'callback':_0xeca78d[_0xfa04('0x2d')]?!![]:![],'callbackuniqueid':_0xeca78d[_0xfa04('0x2d')]?_0xeca78d[_0xfa04('0x2d')]:undefined,'callbackat':_0xeca78d['callbackUniqueid']?moment()[_0xfa04('0x1c')](_0xfa04('0x1d')):undefined,'CampaignId':_0x3f0349['id']});})[_0xfa04('0x2e')](function(_0x440f94){_0xf48563(_0x440f94);});});});};if(_0xeca78d[_0xfa04('0x32')]){_0x47fcc8[_0xfa04('0x20')]['findAll']({'where':{'type':_0xfa04('0x36')},'attributes':['id',_0xfa04('0x37'),_0xfa04('0x1f')],'include':[{'model':_0x47fcc8[_0xfa04('0x38')],'as':_0xfa04('0x39'),'where':{'id':_0xeca78d['ListId']}}]})[_0xfa04('0x22')](function(_0xea6913){if(_0xea6913){var _0x5b35e8=[];for(var _0x36c2fa=0x0,_0x213d74;_0x36c2fa<_0xea6913[_0xfa04('0x3a')];_0x36c2fa+=0x1){_0x213d74=_0xea6913[_0x36c2fa]['get']({'plain':!![]});switch(_0x213d74[_0xfa04('0x37')]){case _0xfa04('0x3b'):_0x4ce4e5(_0x213d74)[_0xfa04('0x2e')](_0x4e8513());break;case _0xfa04('0x3c'):_0x48d02a(_0x213d74)['catch'](_0x4e8513());break;default:_0x2e3d3f(_0x213d74,_0xeca78d)[_0xfa04('0x22')](function(_0x2b1443){_0xeca78d['scheduledat']=_0x2b1443[_0xfa04('0x27')];_0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d['phone'],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d[_0xfa04('0x32')],'scheduledat':_0xeca78d[_0xfa04('0x1b')]?_0xeca78d['scheduledat']:moment()['format'](_0xfa04('0x1d')),'priority':_0xeca78d[_0xfa04('0x2c')]?_0xeca78d[_0xfa04('0x2c')]:0x2,'callback':_0xeca78d[_0xfa04('0x2d')]?!![]:![],'callbackuniqueid':_0xeca78d[_0xfa04('0x2d')]?_0xeca78d['callbackUniqueid']:undefined,'callbackat':_0xeca78d[_0xfa04('0x2d')]?moment()['format'](_0xfa04('0x1d')):undefined,'VoiceQueueId':_0x213d74['id']})[_0xfa04('0x2e')](_0x4e8513());});}}}})[_0xfa04('0x22')](function(){return _0x47fcc8[_0xfa04('0x20')][_0xfa04('0x3d')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x47fcc8['CmList'],'as':_0xfa04('0x3e'),'where':{'id':_0xeca78d[_0xfa04('0x32')]}}]})[_0xfa04('0x22')](function(_0x1aeaf6){if(_0x1aeaf6){var _0x267dcc=[];for(var _0x4c1f1b=0x0,_0x54e300;_0x4c1f1b<_0x1aeaf6[_0xfa04('0x3a')];_0x4c1f1b+=0x1){_0x54e300=_0x1aeaf6[_0x4c1f1b][_0xfa04('0x17')]({'plain':!![]});_0x47fcc8['CmHopperBlack'][_0xfa04('0x2b')]({'phone':_0xeca78d['phone'],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d['ListId'],'VoiceQueueId':_0x54e300['id']})[_0xfa04('0x2e')](function(_0x5b4f17){logger['error'](_0xfa04('0x3f'),_0xfa04('0x1a'),_0x5b4f17[_0xfa04('0x40')]);});}}});})[_0xfa04('0x22')](function(){return _0x47fcc8[_0xfa04('0x41')][_0xfa04('0x3d')]({'attributes':['id',_0xfa04('0x37'),_0xfa04('0x1f')],'include':[{'model':_0x47fcc8['CmList'],'as':_0xfa04('0x39'),'where':{'id':_0xeca78d[_0xfa04('0x32')]}}]})[_0xfa04('0x22')](function(_0x55c104){if(_0x55c104){var _0x4e3975=[];for(var _0x5a74d1=0x0,_0x400e9c;_0x5a74d1<_0x55c104[_0xfa04('0x3a')];_0x5a74d1+=0x1){_0x400e9c=_0x55c104[_0x5a74d1][_0xfa04('0x17')]({'plain':!![]});switch(_0x400e9c['dialCheckDuplicateType']){case _0xfa04('0x3b'):_0x3894d5(_0x400e9c)['catch'](_0x351594());break;case _0xfa04('0x3c'):_0x6a4a20(_0x400e9c)[_0xfa04('0x2e')](_0x351594());break;default:_0x47fcc8[_0xfa04('0x28')][_0xfa04('0x2b')]({'phone':_0xeca78d['phone'],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d['ListId'],'scheduledat':_0xeca78d[_0xfa04('0x1b')]?_0xeca78d[_0xfa04('0x1b')]:moment()[_0xfa04('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xeca78d[_0xfa04('0x2c')]?_0xeca78d['priority']:0x2,'callback':_0xeca78d[_0xfa04('0x2d')]?!![]:![],'callbackuniqueid':_0xeca78d[_0xfa04('0x2d')]?_0xeca78d[_0xfa04('0x2d')]:undefined,'callbackat':_0xeca78d['callbackUniqueid']?moment()[_0xfa04('0x1c')](_0xfa04('0x1d')):undefined,'CampaignId':_0x400e9c['id']})[_0xfa04('0x2e')](_0x351594());}}}});})['then'](function(){return _0x47fcc8['Campaign'][_0xfa04('0x3d')]({'attributes':['id'],'include':[{'model':_0x47fcc8[_0xfa04('0x38')],'as':_0xfa04('0x3e'),'where':{'id':_0xeca78d['ListId']}}]})[_0xfa04('0x22')](function(_0x44d15f){if(_0x44d15f){var _0x1fae61=[];for(var _0x135a96=0x0,_0x2956b5;_0x135a96<_0x44d15f[_0xfa04('0x3a')];_0x135a96+=0x1){_0x2956b5=_0x44d15f[_0x135a96][_0xfa04('0x17')]({'plain':!![]});_0x47fcc8[_0xfa04('0x42')][_0xfa04('0x2b')]({'phone':_0xeca78d[_0xfa04('0xd')],'ContactId':_0xeca78d['id'],'ListId':_0xeca78d[_0xfa04('0x32')],'CampaignId':_0x2956b5['id']})[_0xfa04('0x2e')](function(_0x26d752){logger['error'](_0xfa04('0x3f'),'afterCreate',_0x26d752[_0xfa04('0x40')]);});}}});})[_0xfa04('0x22')](function(){_0x24a0f5();})[_0xfa04('0x2e')](function(_0x4f642b){logger[_0xfa04('0x18')]('cmContact,\x20%s,\x20%s','afterCreate',_0x4f642b[_0xfa04('0x40')]);_0x24a0f5(_0x4f642b);});}else{_0x24a0f5(new Error(_0xfa04('0x43')));}},'afterDestroy':function(_0x4524fd,_0x53022f,_0x196293){var _0x12c48b=_0x33d517['models'];var _0xa28723=_0x4524fd[_0xfa04('0x17')]({'plain':!![]});return _0x12c48b[_0xfa04('0x28')][_0xfa04('0x3d')]({'raw':!![],'where':{'ListId':_0xa28723[_0xfa04('0x32')],'ContactId':_0xa28723['id']}})[_0xfa04('0x22')](function(_0x5e2cf1){if(!_['isEmpty'](_0x5e2cf1)){var _0x361875=[];for(var _0x8d9cc2=0x0;_0x8d9cc2<_0x5e2cf1[_0xfa04('0x3a')];_0x8d9cc2+=0x1){var _0x5c7d3b=_0x12c48b[_0xfa04('0x28')][_0xfa04('0x44')]({'where':{'ListId':_0x5e2cf1[_0x8d9cc2][_0xfa04('0x32')],'ContactId':_0x5e2cf1[_0x8d9cc2]['ContactId'],'VoiceQueueId':_0x5e2cf1[_0x8d9cc2][_0xfa04('0x45')],'CampaignId':_0x5e2cf1[_0x8d9cc2]['CampaignId']}});_0x361875[_0xfa04('0x46')](_0x5c7d3b);}return BPromise['all'](_0x361875);}})[_0xfa04('0x22')](function(_0x29391b){logger[_0xfa04('0x47')](_0xfa04('0x48'),util[_0xfa04('0x33')](_0x29391b,{'showHidden':![],'depth':null}));_0x196293();})[_0xfa04('0x2e')](function(_0x49db44){logger['error'](_0xfa04('0x49'),util[_0xfa04('0x33')](_0x49db44,{'showHidden':![],'depth':null}));_0x196293(_0x49db44);});}}});}; \ No newline at end of file +var _0x51e5=['CmList','BlackLists','CmHopperBlack','message','always','onlyIfOpen','cmContact,\x20%s,\x20%s','List\x20not\x20found','models','destroy','ContactId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','../../config/logger','api','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\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','Lists','length','get','dialCheckDuplicateType'];(function(_0x10a196,_0x4952ea){var _0x1b8074=function(_0x115774){while(--_0x115774){_0x10a196['push'](_0x10a196['shift']());}};_0x1b8074(++_0x4952ea);}(_0x51e5,0x9e));var _0x551e=function(_0x5d0d9b,_0x9301b4){_0x5d0d9b=_0x5d0d9b-0x0;var _0x3badf2=_0x51e5[_0x5d0d9b];return _0x3badf2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x551e('0x0'))(_0x551e('0x1'));var moment=require('moment');var BPromise=require(_0x551e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x551e('0x3'));var rimraf=require(_0x551e('0x4'));var config=require(_0x551e('0x5'));var shared=require(_0x551e('0x6'));var attributes=require(_0x551e('0x7'));module[_0x551e('0x8')]=function(_0x4334a0,_0x5e1de2){return _0x4334a0['define'](_0x551e('0x9'),attributes,{'tableName':_0x551e('0xa'),'paranoid':!![],'indexes':[{'name':_0x551e('0xb'),'fields':[_0x551e('0xb')]},{'name':_0x551e('0xc'),'fields':[_0x551e('0xd'),'lastName','phone',_0x551e('0xe'),_0x551e('0xf'),_0x551e('0x10')],'type':_0x551e('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x2d44de,_0x3424b0,_0x416a22){var _0x223add=_0x4334a0['models'];var _0x105ee1=_0x2d44de['get']({'plain':!![]});function _0x4f6dc3(){return function(_0xdd4fb8){logger[_0x551e('0x12')](_0x551e('0x13'),_0x551e('0x14'),util[_0x551e('0x15')](_0xdd4fb8,{'showHidden':![],'depth':null}));};}function _0x3fd599(_0x482193,_0x4617a0){var _0x465a9c=_0x4617a0['scheduledat']?_0x4617a0[_0x551e('0x16')]:moment()[_0x551e('0x17')](_0x551e('0x18'));return new BPromise(function(_0x47af84,_0x42ad11){if(_[_0x551e('0x19')](_0x4617a0[_0x551e('0x1a')])){_0x47af84({'ret':_0x465a9c});}else{_0x223add[_0x551e('0x1b')][_0x551e('0x1c')]({'where':{'id':_0x482193['id']}})[_0x551e('0x1d')](function(_0x5c2bff){if(!_[_0x551e('0x19')](_0x5c2bff)){var _0x1b39dd=_0x5c2bff[_0x551e('0x1a')];if(!_[_0x551e('0x19')](_0x1b39dd)){var _0x51cb02=shared[_0x551e('0x1e')];var _0x1bc69c=_0x51cb02[_0x1b39dd];var _0x41c740=_0x51cb02[_0x4617a0['dialTimezone']];if(!_[_0x551e('0x19')](_0x1bc69c)&&!_[_0x551e('0x19')](_0x41c740)){var _0x5262c0=_0x1bc69c[_0x551e('0x1f')]-_0x41c740[_0x551e('0x1f')];_0x465a9c=_0x4617a0[_0x551e('0x16')]?_0x4617a0['scheduledat']:moment();var _0x1f255f=moment(_0x465a9c)[_0x551e('0x20')](_0x5262c0,_0x551e('0x21'));_0x47af84({'ret':_0x1f255f[_0x551e('0x17')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x47af84({'ret':_0x465a9c});}else _0x47af84({'ret':_0x465a9c});}else{_0x47af84({'ret':_0x465a9c});}});}});return 0xa;}var _0x23d49a=function(_0x5ac62a){return new BPromise(function(_0x5a320a,_0x52cf69){_0x3fd599(_0x5ac62a,_0x105ee1)[_0x551e('0x1d')](function(_0x56bcc5){_0x105ee1[_0x551e('0x16')]=_0x56bcc5[_0x551e('0x22')];_0x223add[_0x551e('0x23')][_0x551e('0x1c')]({'where':{'phone':_0x105ee1['phone'],'VoiceQueueId':_0x5ac62a['id']}})[_0x551e('0x1d')](function(_0x3faed1){if(!_['isNil'](_0x3faed1)){throw new Error(_0x551e('0x24')+_0x105ee1[_0x551e('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5ac62a['id']);}return _0x223add[_0x551e('0x23')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1[_0x551e('0x26')],'priority':_0x105ee1[_0x551e('0x27')]?_0x105ee1[_0x551e('0x27')]:0x2,'scheduledat':_0x105ee1[_0x551e('0x16')]?_0x105ee1['scheduledat']:moment()['format'](_0x551e('0x18')),'callback':_0x105ee1[_0x551e('0x28')]?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1['callbackUniqueid']?moment()[_0x551e('0x17')](_0x551e('0x18')):undefined,'VoiceQueueId':_0x5ac62a['id']});})[_0x551e('0x29')](function(_0x32e1f1){_0x52cf69(_0x32e1f1);});});});};var _0x411788=function(_0x271c1a){return new BPromise(function(_0x57ea21,_0x2bbd87){_0x3fd599(_0x271c1a,_0x105ee1)[_0x551e('0x1d')](function(_0x51f020){_0x105ee1[_0x551e('0x16')]=_0x51f020[_0x551e('0x22')];_0x223add['CmHopper'][_0x551e('0x1c')]({'where':{'phone':_0x105ee1[_0x551e('0xb')],'VoiceQueueId':_0x271c1a['id']}})[_0x551e('0x1d')](function(_0x36d080){if(!_['isNil'](_0x36d080)){throw new Error('cmContact,\x20afterCreate\x20'+_0x105ee1['phone']+_0x551e('0x2a')+_0x271c1a['id']);}return _0x223add[_0x551e('0x2b')][_0x551e('0x1c')]({'where':{'calleridnum':_0x105ee1[_0x551e('0xb')],'VoiceQueueId':_0x271c1a['id']}});})[_0x551e('0x1d')](function(_0x36016b){if(!_[_0x551e('0x19')](_0x36016b)){throw new Error(_0x551e('0x2c')+_0x105ee1[_0x551e('0xb')]+_0x551e('0x2d')+_0x271c1a['id']);}return _0x223add[_0x551e('0x23')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1['ListId'],'priority':_0x105ee1[_0x551e('0x27')]?_0x105ee1[_0x551e('0x27')]:0x2,'scheduledat':_0x105ee1['scheduledat']?_0x105ee1[_0x551e('0x16')]:moment()['format'](_0x551e('0x18')),'callback':_0x105ee1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1[_0x551e('0x28')]?moment()[_0x551e('0x17')](_0x551e('0x18')):undefined,'VoiceQueueId':_0x271c1a['id']});})['catch'](function(_0x5630a1){_0x2bbd87(_0x5630a1);});});});};function _0x27c76f(){return function(_0x2319b7){logger[_0x551e('0x12')](_0x551e('0x13'),_0x551e('0x14'),util[_0x551e('0x15')](_0x2319b7,{'showHidden':![],'depth':null}));};}function _0x1c5d52(_0x5cf4e6,_0x3f534d){var _0x2e74ea=_0x3f534d[_0x551e('0x16')]?_0x3f534d['scheduledat']:moment()[_0x551e('0x17')](_0x551e('0x18'));return new BPromise(function(_0x2131f0,_0x519180){if(_['isNil'](_0x3f534d['dialTimezone'])){_0x2131f0({'ret':_0x2e74ea});}else{_0x223add[_0x551e('0x2e')][_0x551e('0x1c')]({'where':{'id':_0x5cf4e6['id']}})[_0x551e('0x1d')](function(_0x51b455){if(!_[_0x551e('0x19')](_0x51b455)){var _0x44dea7=_0x51b455[_0x551e('0x1a')];if(!_[_0x551e('0x19')](_0x44dea7)){var _0x206ae6=shared[_0x551e('0x1e')];var _0x46db9a=_0x206ae6[_0x44dea7];var _0x380d5d=_0x206ae6[_0x3f534d[_0x551e('0x1a')]];if(!_['isNil'](_0x46db9a)&&!_[_0x551e('0x19')](_0x380d5d)){var _0x147d98=_0x46db9a[_0x551e('0x1f')]-_0x380d5d['utcOffset'];_0x2e74ea=_0x3f534d[_0x551e('0x16')]?_0x3f534d[_0x551e('0x16')]:moment();var _0x53b8a2=moment(_0x2e74ea)[_0x551e('0x20')](_0x147d98,_0x551e('0x21'));_0x2131f0({'ret':_0x53b8a2[_0x551e('0x17')](_0x551e('0x18'))});}else _0x2131f0({'ret':_0x2e74ea});}else _0x2131f0({'ret':_0x2e74ea});}else{_0x2131f0({'ret':_0x2e74ea});}});}});return 0xa;}var _0x1f02fa=function(_0x3154fa){return new BPromise(function(_0x3bf5cf,_0x97a7f3){_0x1c5d52(_0x3154fa,_0x105ee1)['then'](function(_0x49ab72){_0x105ee1[_0x551e('0x16')]=_0x49ab72[_0x551e('0x22')];_0x223add[_0x551e('0x23')]['findOne']({'where':{'phone':_0x105ee1['phone'],'CampaignId':_0x3154fa['id']}})['then'](function(_0x3d70b0){if(!_[_0x551e('0x19')](_0x3d70b0)){throw new Error('cmContact,\x20afterCreate\x20'+_0x105ee1[_0x551e('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3154fa['id']);}return _0x223add['CmHopper'][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1['ListId'],'priority':_0x105ee1['priority']?_0x105ee1['priority']:0x2,'scheduledat':_0x105ee1[_0x551e('0x16')]?_0x105ee1[_0x551e('0x16')]:moment()[_0x551e('0x17')](_0x551e('0x18')),'callback':_0x105ee1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1['callbackUniqueid']?moment()[_0x551e('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3154fa['id']});})['catch'](function(_0x41f628){_0x97a7f3(_0x41f628);});});});};var _0x4a8443=function(_0xe0a7a3){return new BPromise(function(_0x3b88c7,_0x2f4d45){_0x1c5d52(_0xe0a7a3,_0x105ee1)[_0x551e('0x1d')](function(_0x5e0a2d){_0x105ee1[_0x551e('0x16')]=_0x5e0a2d[_0x551e('0x22')];_0x223add['CmHopper'][_0x551e('0x1c')]({'where':{'phone':_0x105ee1[_0x551e('0xb')],'CampaignId':_0xe0a7a3['id']}})[_0x551e('0x1d')](function(_0x2957b5){if(!_[_0x551e('0x19')](_0x2957b5)){throw new Error('cmContact,\x20afterCreate\x20'+_0x105ee1[_0x551e('0xb')]+_0x551e('0x2f')+_0xe0a7a3['id']);}return _0x223add[_0x551e('0x2b')][_0x551e('0x1c')]({'where':{'calleridnum':_0x105ee1[_0x551e('0xb')],'CampaignId':_0xe0a7a3['id']}});})[_0x551e('0x1d')](function(_0x1108d3){if(!_[_0x551e('0x19')](_0x1108d3)){throw new Error(_0x551e('0x2c')+_0x105ee1['phone']+_0x551e('0x30')+_0xe0a7a3['id']);}return _0x223add[_0x551e('0x23')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1[_0x551e('0x26')],'priority':_0x105ee1['priority']?_0x105ee1[_0x551e('0x27')]:0x2,'scheduledat':_0x105ee1[_0x551e('0x16')]?_0x105ee1[_0x551e('0x16')]:moment()[_0x551e('0x17')](_0x551e('0x18')),'callback':_0x105ee1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1['callbackUniqueid']?moment()[_0x551e('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xe0a7a3['id']});})[_0x551e('0x29')](function(_0x5e6e0f){_0x2f4d45(_0x5e6e0f);});});});};if(_0x105ee1['ListId']){_0x223add[_0x551e('0x1b')][_0x551e('0x31')]({'where':{'type':_0x551e('0x32')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x223add['CmList'],'as':_0x551e('0x33'),'where':{'id':_0x105ee1[_0x551e('0x26')]}}]})[_0x551e('0x1d')](function(_0x262733){if(_0x262733){var _0x50394c=[];for(var _0x294622=0x0,_0x3a0bac;_0x294622<_0x262733[_0x551e('0x34')];_0x294622+=0x1){_0x3a0bac=_0x262733[_0x294622][_0x551e('0x35')]({'plain':!![]});switch(_0x3a0bac[_0x551e('0x36')]){case'always':_0x411788(_0x3a0bac)['catch'](_0x4f6dc3());break;case'onlyIfOpen':_0x23d49a(_0x3a0bac)[_0x551e('0x29')](_0x4f6dc3());break;default:_0x1c5d52(_0x3a0bac,_0x105ee1)['then'](function(_0x187da3){_0x105ee1[_0x551e('0x16')]=_0x187da3['ret'];_0x223add['CmHopper'][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1[_0x551e('0x26')],'scheduledat':_0x105ee1[_0x551e('0x16')]?_0x105ee1['scheduledat']:moment()['format'](_0x551e('0x18')),'priority':_0x105ee1[_0x551e('0x27')]?_0x105ee1[_0x551e('0x27')]:0x2,'callback':_0x105ee1['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1['callbackUniqueid']?moment()[_0x551e('0x17')](_0x551e('0x18')):undefined,'VoiceQueueId':_0x3a0bac['id']})['catch'](_0x4f6dc3());});}}}})[_0x551e('0x1d')](function(){return _0x223add[_0x551e('0x1b')][_0x551e('0x31')]({'where':{'type':_0x551e('0x32')},'attributes':['id'],'include':[{'model':_0x223add[_0x551e('0x37')],'as':_0x551e('0x38'),'where':{'id':_0x105ee1[_0x551e('0x26')]}}]})['then'](function(_0x5c3214){if(_0x5c3214){var _0x2e0f0f=[];for(var _0x555012=0x0,_0x2da4e2;_0x555012<_0x5c3214[_0x551e('0x34')];_0x555012+=0x1){_0x2da4e2=_0x5c3214[_0x555012][_0x551e('0x35')]({'plain':!![]});_0x223add[_0x551e('0x39')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1[_0x551e('0x26')],'VoiceQueueId':_0x2da4e2['id']})[_0x551e('0x29')](function(_0x293e40){logger[_0x551e('0x12')]('cmContact,\x20%s,\x20%s',_0x551e('0x14'),_0x293e40[_0x551e('0x3a')]);});}}});})[_0x551e('0x1d')](function(){return _0x223add[_0x551e('0x2e')][_0x551e('0x31')]({'attributes':['id',_0x551e('0x36'),_0x551e('0x1a')],'include':[{'model':_0x223add[_0x551e('0x37')],'as':_0x551e('0x33'),'where':{'id':_0x105ee1[_0x551e('0x26')]}}]})[_0x551e('0x1d')](function(_0x3f7883){if(_0x3f7883){var _0x9961ff=[];for(var _0xb98a1b=0x0,_0x8b2ae6;_0xb98a1b<_0x3f7883[_0x551e('0x34')];_0xb98a1b+=0x1){_0x8b2ae6=_0x3f7883[_0xb98a1b][_0x551e('0x35')]({'plain':!![]});switch(_0x8b2ae6[_0x551e('0x36')]){case _0x551e('0x3b'):_0x4a8443(_0x8b2ae6)[_0x551e('0x29')](_0x27c76f());break;case _0x551e('0x3c'):_0x1f02fa(_0x8b2ae6)['catch'](_0x27c76f());break;default:_0x223add[_0x551e('0x23')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1[_0x551e('0x26')],'scheduledat':_0x105ee1[_0x551e('0x16')]?_0x105ee1[_0x551e('0x16')]:moment()['format'](_0x551e('0x18')),'priority':_0x105ee1[_0x551e('0x27')]?_0x105ee1[_0x551e('0x27')]:0x2,'callback':_0x105ee1[_0x551e('0x28')]?!![]:![],'callbackuniqueid':_0x105ee1[_0x551e('0x28')]?_0x105ee1[_0x551e('0x28')]:undefined,'callbackat':_0x105ee1[_0x551e('0x28')]?moment()['format'](_0x551e('0x18')):undefined,'CampaignId':_0x8b2ae6['id']})[_0x551e('0x29')](_0x27c76f());}}}});})[_0x551e('0x1d')](function(){return _0x223add[_0x551e('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x223add[_0x551e('0x37')],'as':_0x551e('0x38'),'where':{'id':_0x105ee1[_0x551e('0x26')]}}]})[_0x551e('0x1d')](function(_0x2db986){if(_0x2db986){var _0x54fa75=[];for(var _0x14c826=0x0,_0x2e2c3a;_0x14c826<_0x2db986['length'];_0x14c826+=0x1){_0x2e2c3a=_0x2db986[_0x14c826][_0x551e('0x35')]({'plain':!![]});_0x223add[_0x551e('0x39')][_0x551e('0x25')]({'phone':_0x105ee1[_0x551e('0xb')],'ContactId':_0x105ee1['id'],'ListId':_0x105ee1['ListId'],'CampaignId':_0x2e2c3a['id']})[_0x551e('0x29')](function(_0x4a6a64){logger[_0x551e('0x12')]('cmContact,\x20%s,\x20%s',_0x551e('0x14'),_0x4a6a64[_0x551e('0x3a')]);});}}});})[_0x551e('0x1d')](function(){_0x416a22();})['catch'](function(_0x1bd92b){logger[_0x551e('0x12')](_0x551e('0x3d'),'afterCreate',_0x1bd92b[_0x551e('0x3a')]);_0x416a22(_0x1bd92b);});}else{_0x416a22(new Error(_0x551e('0x3e')));}},'afterDestroy':function(_0x5ce224,_0x51df3e,_0x53d7d5){var _0x59cbf0=_0x4334a0[_0x551e('0x3f')];var _0x2989c4=_0x5ce224[_0x551e('0x35')]({'plain':!![]});return _0x59cbf0[_0x551e('0x23')][_0x551e('0x31')]({'raw':!![],'where':{'ListId':_0x2989c4[_0x551e('0x26')],'ContactId':_0x2989c4['id']}})[_0x551e('0x1d')](function(_0x58a325){if(!_['isEmpty'](_0x58a325)){var _0x4e97e0=[];for(var _0xb8263f=0x0;_0xb8263f<_0x58a325['length'];_0xb8263f+=0x1){var _0x404e48=_0x59cbf0['CmHopper'][_0x551e('0x40')]({'where':{'ListId':_0x58a325[_0xb8263f][_0x551e('0x26')],'ContactId':_0x58a325[_0xb8263f][_0x551e('0x41')],'VoiceQueueId':_0x58a325[_0xb8263f]['VoiceQueueId'],'CampaignId':_0x58a325[_0xb8263f][_0x551e('0x42')]}});_0x4e97e0[_0x551e('0x43')](_0x404e48);}return BPromise['all'](_0x4e97e0);}})['then'](function(_0x869488){logger[_0x551e('0x44')](_0x551e('0x45'),util['inspect'](_0x869488,{'showHidden':![],'depth':null}));_0x53d7d5();})['catch'](function(_0xd71d89){logger[_0x551e('0x12')](_0x551e('0x46'),util[_0x551e('0x15')](_0xd71d89,{'showHidden':![],'depth':null}));_0x53d7d5(_0xd71d89);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f4795bd..f5b6b33 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x492175,_0x34daeb){var _0x33a982=function(_0x2ac8f2){while(--_0x2ac8f2){_0x492175['push'](_0x492175['shift']());}};_0x33a982(++_0x34daeb);}(_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/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 418dd4c..e6d8f88 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 _0x0a9a=['STRING','INTEGER','PHONE','exports'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x0a9a,0x183));var _0xa0a9=function(_0x14ba56,_0x348f41){_0x14ba56=_0x14ba56-0x0;var _0x283a10=_0x0a9a[_0x14ba56];return _0x283a10;};'use strict';var Sequelize=require('sequelize');module[_0xa0a9('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa0a9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':_0xa0a9('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xc9c3=['exports','INTEGER','STRING','PHONE'];(function(_0x545fe3,_0x3b191f){var _0x480702=function(_0x21c970){while(--_0x21c970){_0x545fe3['push'](_0x545fe3['shift']());}};_0x480702(++_0x3b191f);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x1b7738,_0x8fc77){_0x1b7738=_0x1b7738-0x0;var _0x18664e=_0xc9c3[_0x1b7738];return _0x18664e;};'use strict';var Sequelize=require('sequelize');module[_0x3c9c('0x0')]={'CmContactId':{'type':Sequelize[_0x3c9c('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3c9c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x3c9c('0x3')},'OrderBy':{'type':Sequelize[_0x3c9c('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index cd25d84..877b300 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 _0x91f9=['fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','Content-Range','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem'];(function(_0x498088,_0x1dcd5f){var _0x4ec247=function(_0x14ff55){while(--_0x14ff55){_0x498088['push'](_0x498088['shift']());}};_0x4ec247(++_0x1dcd5f);}(_0x91f9,0x1d2));var _0x991f=function(_0x5a494d,_0x44100b){_0x5a494d=_0x5a494d-0x0;var _0x3c8a70=_0x91f9[_0x5a494d];return _0x3c8a70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x991f('0x0'));var zipdir=require(_0x991f('0x1'));var jsonpatch=require(_0x991f('0x2'));var rp=require(_0x991f('0x3'));var moment=require(_0x991f('0x4'));var BPromise=require(_0x991f('0x5'));var Mustache=require(_0x991f('0x6'));var util=require(_0x991f('0x7'));var path=require(_0x991f('0x8'));var sox=require(_0x991f('0x9'));var csv=require(_0x991f('0xa'));var ejs=require(_0x991f('0xb'));var fs=require('fs');var fs_extra=require(_0x991f('0xc'));var _=require('lodash');var squel=require(_0x991f('0xd'));var crypto=require('crypto');var jsforce=require(_0x991f('0xe'));var deskjs=require(_0x991f('0xf'));var toCsv=require(_0x991f('0xa'));var querystring=require(_0x991f('0x10'));var Papa=require(_0x991f('0x11'));var Redis=require(_0x991f('0x12'));var authService=require(_0x991f('0x13'));var qs=require(_0x991f('0x14'));var as=require(_0x991f('0x15'));var hardwareService=require(_0x991f('0x16'));var logger=require(_0x991f('0x17'))(_0x991f('0x18'));var utils=require(_0x991f('0x19'));var config=require(_0x991f('0x1a'));var licenseUtil=require(_0x991f('0x1b'));var db=require(_0x991f('0x1c'))['db'];function respondWithStatusCode(_0x3a852e,_0x212298){_0x212298=_0x212298||0xcc;return function(_0xc3765b){if(_0xc3765b){return _0x3a852e[_0x991f('0x1d')](_0x212298);}return _0x3a852e['status'](_0x212298)[_0x991f('0x1e')]();};}function respondWithResult(_0xf02138,_0x23589c){_0x23589c=_0x23589c||0xc8;return function(_0x37b42e){if(_0x37b42e){return _0xf02138['status'](_0x23589c)[_0x991f('0x1f')](_0x37b42e);}};}function respondWithFilteredResult(_0x3769b1,_0x1e85b8){return function(_0x31d794){if(_0x31d794){var _0x2a2e09=typeof _0x1e85b8[_0x991f('0x20')]==='undefined'&&typeof _0x1e85b8['limit']===_0x991f('0x21');var _0xb23a22=_0x31d794[_0x991f('0x22')];var _0x8595be=_0x2a2e09?0x0:_0x1e85b8['offset'];var _0x1eb73c=_0x2a2e09?_0x31d794['count']:_0x1e85b8[_0x991f('0x20')]+_0x1e85b8['limit'];var _0x1ab975;if(_0x1eb73c>=_0xb23a22){_0x1eb73c=_0xb23a22;_0x1ab975=0xc8;}else{_0x1ab975=0xce;}_0x3769b1[_0x991f('0x23')](_0x1ab975);return _0x3769b1['set'](_0x991f('0x24'),_0x8595be+'-'+_0x1eb73c+'/'+_0xb23a22)[_0x991f('0x1f')](_0x31d794);}return null;};}function patchUpdates(_0x548f1a){return function(_0xd7deee){try{jsonpatch['apply'](_0xd7deee,_0x548f1a,!![]);}catch(_0x413c95){return BPromise[_0x991f('0x25')](_0x413c95);}return _0xd7deee[_0x991f('0x26')]();};}function saveUpdates(_0x22564d,_0x421a55){return function(_0x3207f9){if(_0x3207f9){return _0x3207f9[_0x991f('0x27')](_0x22564d)[_0x991f('0x28')](function(_0x570b28){return _0x570b28;});}return null;};}function removeEntity(_0x51b5ea,_0x31343b){return function(_0x3a91f5){if(_0x3a91f5){return _0x3a91f5[_0x991f('0x29')]()['then'](function(){var _0x43633b=_0x3a91f5['get']({'plain':!![]});var _0x496c6b=_0x991f('0x2a');return db[_0x991f('0x2b')][_0x991f('0x29')]({'where':{'type':_0x496c6b,'resourceId':_0x43633b['id']}})['then'](function(){return _0x3a91f5;});})['then'](function(){_0x51b5ea[_0x991f('0x23')](0xcc)[_0x991f('0x1e')]();});}};}function handleEntityNotFound(_0x4f973b,_0x5d0ee4){return function(_0x2f133d){if(!_0x2f133d){_0x4f973b[_0x991f('0x1d')](0x194);}return _0x2f133d;};}function handleError(_0x25c19a,_0x458698){_0x458698=_0x458698||0x1f4;return function(_0x104638){logger[_0x991f('0x2c')](_0x104638[_0x991f('0x2d')]);if(_0x104638[_0x991f('0x2e')]){delete _0x104638['name'];}_0x25c19a[_0x991f('0x23')](_0x458698)['send'](_0x104638);};}exports[_0x991f('0x2f')]=function(_0x524c28,_0x485645){var _0x19f3c9={},_0x4a7202={},_0x8748d5={'count':0x0,'rows':[]};var _0x29569b=_[_0x991f('0x30')](db[_0x991f('0x31')]['rawAttributes'],function(_0x1c5b5d){return{'name':_0x1c5b5d[_0x991f('0x32')],'type':_0x1c5b5d['type'][_0x991f('0x33')]};});_0x4a7202[_0x991f('0x34')]=_[_0x991f('0x30')](_0x29569b,'name');_0x4a7202[_0x991f('0x35')]=_[_0x991f('0x36')](_0x524c28[_0x991f('0x35')]);_0x4a7202['filters']=_['intersection'](_0x4a7202['model'],_0x4a7202[_0x991f('0x35')]);_0x19f3c9[_0x991f('0x37')]=_['intersection'](_0x4a7202[_0x991f('0x34')],qs[_0x991f('0x38')](_0x524c28['query'][_0x991f('0x38')]));_0x19f3c9[_0x991f('0x37')]=_0x19f3c9[_0x991f('0x37')]['length']?_0x19f3c9[_0x991f('0x37')]:_0x4a7202[_0x991f('0x34')];if(!_0x524c28[_0x991f('0x35')][_0x991f('0x39')]('nolimit')){_0x19f3c9[_0x991f('0x3a')]=qs[_0x991f('0x3a')](_0x524c28['query']['limit']);_0x19f3c9[_0x991f('0x20')]=qs[_0x991f('0x20')](_0x524c28[_0x991f('0x35')][_0x991f('0x20')]);}_0x19f3c9['order']=qs[_0x991f('0x3b')](_0x524c28[_0x991f('0x35')][_0x991f('0x3b')]);_0x19f3c9[_0x991f('0x3c')]=qs[_0x991f('0x3d')](_[_0x991f('0x3e')](_0x524c28['query'],_0x4a7202[_0x991f('0x3d')]),_0x29569b);if(_0x524c28[_0x991f('0x35')][_0x991f('0x3f')]){_0x19f3c9[_0x991f('0x3c')]=_['merge'](_0x19f3c9[_0x991f('0x3c')],{'$or':_[_0x991f('0x30')](_0x29569b,function(_0x557a8d){if(_0x557a8d[_0x991f('0x40')]!==_0x991f('0x41')){var _0x312405={};_0x312405[_0x557a8d['name']]={'$like':'%'+_0x524c28[_0x991f('0x35')][_0x991f('0x3f')]+'%'};return _0x312405;}})});}_0x19f3c9=_[_0x991f('0x42')]({},_0x19f3c9,_0x524c28['options']);var _0x24ce13={'where':_0x19f3c9[_0x991f('0x3c')]};return db[_0x991f('0x31')][_0x991f('0x22')](_0x24ce13)[_0x991f('0x28')](function(_0x4f250c){_0x8748d5['count']=_0x4f250c;if(_0x524c28[_0x991f('0x35')][_0x991f('0x43')]){_0x19f3c9['include']=[{'all':!![]}];}return db[_0x991f('0x31')][_0x991f('0x44')](_0x19f3c9);})['then'](function(_0x2416fc){_0x8748d5[_0x991f('0x45')]=_0x2416fc;return _0x8748d5;})[_0x991f('0x28')](respondWithFilteredResult(_0x485645,_0x19f3c9))[_0x991f('0x46')](handleError(_0x485645,null));};exports[_0x991f('0x47')]=function(_0x585c73,_0x32bc4a){var _0xc76942={'raw':!![],'where':{'id':_0x585c73[_0x991f('0x48')]['id']}},_0x1688f4={};_0x1688f4[_0x991f('0x34')]=_[_0x991f('0x36')](db[_0x991f('0x31')][_0x991f('0x49')]);_0x1688f4[_0x991f('0x35')]=_['keys'](_0x585c73['query']);_0x1688f4[_0x991f('0x3d')]=_[_0x991f('0x4a')](_0x1688f4[_0x991f('0x34')],_0x1688f4[_0x991f('0x35')]);_0xc76942['attributes']=_[_0x991f('0x4a')](_0x1688f4[_0x991f('0x34')],qs['fields'](_0x585c73[_0x991f('0x35')]['fields']));_0xc76942['attributes']=_0xc76942['attributes'][_0x991f('0x4b')]?_0xc76942[_0x991f('0x37')]:_0x1688f4[_0x991f('0x34')];if(_0x585c73[_0x991f('0x35')]['includeAll']){_0xc76942['include']=[{'all':!![]}];}_0xc76942=_[_0x991f('0x42')]({},_0xc76942,_0x585c73['options']);return db['CmContactHasItem'][_0x991f('0x4c')](_0xc76942)['then'](handleEntityNotFound(_0x32bc4a,null))[_0x991f('0x28')](respondWithResult(_0x32bc4a,null))[_0x991f('0x46')](handleError(_0x32bc4a,null));};exports[_0x991f('0x4d')]=function(_0x592421,_0xdb5c63){return db[_0x991f('0x31')]['create'](_0x592421['body'],{})[_0x991f('0x28')](function(_0x1ded4b){var _0x16dff8=_0x592421[_0x991f('0x4e')][_0x991f('0x4f')]({'plain':!![]});if(!_0x16dff8)throw new Error(_0x991f('0x50'));if(_0x16dff8[_0x991f('0x51')]==='user'){var _0x1d940d=_0x1ded4b[_0x991f('0x4f')]({'plain':!![]});var _0x2bddd4=_0x991f('0x2a');return db[_0x991f('0x52')][_0x991f('0x4c')]({'where':{'name':_0x2bddd4,'userProfileId':_0x16dff8['userProfileId']},'raw':!![]})[_0x991f('0x28')](function(_0x5aae0b){if(_0x5aae0b&&_0x5aae0b[_0x991f('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d940d['name'],'resourceId':_0x1d940d['id'],'type':_0x5aae0b[_0x991f('0x2e')],'sectionId':_0x5aae0b['id']},{})[_0x991f('0x28')](function(){return _0x1ded4b;});}else{return _0x1ded4b;}})[_0x991f('0x46')](function(_0x22f23d){logger[_0x991f('0x2c')](_0x991f('0x54'),_0x22f23d);throw _0x22f23d;});}return _0x1ded4b;})['then'](respondWithResult(_0xdb5c63,0xc9))[_0x991f('0x46')](handleError(_0xdb5c63,null));};exports[_0x991f('0x27')]=function(_0x3bffe2,_0x52b225){if(_0x3bffe2['body']['id']){delete _0x3bffe2[_0x991f('0x55')]['id'];}return db[_0x991f('0x31')][_0x991f('0x4c')]({'where':{'id':_0x3bffe2[_0x991f('0x48')]['id']}})[_0x991f('0x28')](handleEntityNotFound(_0x52b225,null))['then'](saveUpdates(_0x3bffe2[_0x991f('0x55')],null))[_0x991f('0x28')](respondWithResult(_0x52b225,null))[_0x991f('0x46')](handleError(_0x52b225,null));};exports[_0x991f('0x29')]=function(_0x53e1bc,_0x4bd95f){return db['CmContactHasItem'][_0x991f('0x4c')]({'where':{'id':_0x53e1bc[_0x991f('0x48')]['id']}})[_0x991f('0x28')](handleEntityNotFound(_0x4bd95f,null))[_0x991f('0x28')](removeEntity(_0x4bd95f,null))['catch'](handleError(_0x4bd95f,null));}; \ No newline at end of file +var _0x82c5=['destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','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','offset','undefined','limit','count','Content-Range','apply','save','update'];(function(_0x15a996,_0x2fda19){var _0xccb501=function(_0x49471e){while(--_0x49471e){_0x15a996['push'](_0x15a996['shift']());}};_0xccb501(++_0x2fda19);}(_0x82c5,0x1e3));var _0x582c=function(_0x10764e,_0x41c460){_0x10764e=_0x10764e-0x0;var _0x3948cf=_0x82c5[_0x10764e];return _0x3948cf;};'use strict';var emlformat=require(_0x582c('0x0'));var rimraf=require(_0x582c('0x1'));var zipdir=require(_0x582c('0x2'));var jsonpatch=require(_0x582c('0x3'));var rp=require(_0x582c('0x4'));var moment=require(_0x582c('0x5'));var BPromise=require(_0x582c('0x6'));var Mustache=require(_0x582c('0x7'));var util=require(_0x582c('0x8'));var path=require(_0x582c('0x9'));var sox=require(_0x582c('0xa'));var csv=require('to-csv');var ejs=require(_0x582c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x582c('0xc'));var squel=require('squel');var crypto=require(_0x582c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x582c('0xe'));var toCsv=require(_0x582c('0xf'));var querystring=require('querystring');var Papa=require(_0x582c('0x10'));var Redis=require(_0x582c('0x11'));var authService=require(_0x582c('0x12'));var qs=require(_0x582c('0x13'));var as=require(_0x582c('0x14'));var hardwareService=require(_0x582c('0x15'));var logger=require('../../config/logger')(_0x582c('0x16'));var utils=require(_0x582c('0x17'));var config=require(_0x582c('0x18'));var licenseUtil=require(_0x582c('0x19'));var db=require(_0x582c('0x1a'))['db'];function respondWithStatusCode(_0x5de442,_0x205539){_0x205539=_0x205539||0xcc;return function(_0x1ef275){if(_0x1ef275){return _0x5de442[_0x582c('0x1b')](_0x205539);}return _0x5de442[_0x582c('0x1c')](_0x205539)[_0x582c('0x1d')]();};}function respondWithResult(_0x5797db,_0x304781){_0x304781=_0x304781||0xc8;return function(_0x1fde1d){if(_0x1fde1d){return _0x5797db['status'](_0x304781)[_0x582c('0x1e')](_0x1fde1d);}};}function respondWithFilteredResult(_0x56470d,_0x2a9e24){return function(_0xb1c67f){if(_0xb1c67f){var _0x51e096=typeof _0x2a9e24[_0x582c('0x1f')]===_0x582c('0x20')&&typeof _0x2a9e24[_0x582c('0x21')]==='undefined';var _0x58f5eb=_0xb1c67f[_0x582c('0x22')];var _0x298ace=_0x51e096?0x0:_0x2a9e24[_0x582c('0x1f')];var _0x1c1002=_0x51e096?_0xb1c67f[_0x582c('0x22')]:_0x2a9e24[_0x582c('0x1f')]+_0x2a9e24[_0x582c('0x21')];var _0x13904e;if(_0x1c1002>=_0x58f5eb){_0x1c1002=_0x58f5eb;_0x13904e=0xc8;}else{_0x13904e=0xce;}_0x56470d['status'](_0x13904e);return _0x56470d['set'](_0x582c('0x23'),_0x298ace+'-'+_0x1c1002+'/'+_0x58f5eb)['json'](_0xb1c67f);}return null;};}function patchUpdates(_0x2b2ff8){return function(_0x239b1d){try{jsonpatch[_0x582c('0x24')](_0x239b1d,_0x2b2ff8,!![]);}catch(_0x3b1187){return BPromise['reject'](_0x3b1187);}return _0x239b1d[_0x582c('0x25')]();};}function saveUpdates(_0x329693,_0x4f4c9b){return function(_0x12a020){if(_0x12a020){return _0x12a020[_0x582c('0x26')](_0x329693)['then'](function(_0x17f5ea){return _0x17f5ea;});}return null;};}function removeEntity(_0x6864aa,_0x95088d){return function(_0x15ab99){if(_0x15ab99){return _0x15ab99[_0x582c('0x27')]()[_0x582c('0x28')](function(){var _0x33687a=_0x15ab99[_0x582c('0x29')]({'plain':!![]});var _0x4db0dd=_0x582c('0x2a');return db[_0x582c('0x2b')]['destroy']({'where':{'type':_0x4db0dd,'resourceId':_0x33687a['id']}})[_0x582c('0x28')](function(){return _0x15ab99;});})[_0x582c('0x28')](function(){_0x6864aa[_0x582c('0x1c')](0xcc)[_0x582c('0x1d')]();});}};}function handleEntityNotFound(_0x56674a,_0x27f26b){return function(_0x5dc4a0){if(!_0x5dc4a0){_0x56674a[_0x582c('0x1b')](0x194);}return _0x5dc4a0;};}function handleError(_0x329a0a,_0x4b44d6){_0x4b44d6=_0x4b44d6||0x1f4;return function(_0x4f90c7){logger[_0x582c('0x2c')](_0x4f90c7[_0x582c('0x2d')]);if(_0x4f90c7[_0x582c('0x2e')]){delete _0x4f90c7[_0x582c('0x2e')];}_0x329a0a['status'](_0x4b44d6)['send'](_0x4f90c7);};}exports[_0x582c('0x2f')]=function(_0xc560c4,_0x4cd9df){var _0x2ef1c0={},_0x4039f1={},_0xa94a21={'count':0x0,'rows':[]};var _0x131243=_[_0x582c('0x30')](db[_0x582c('0x31')][_0x582c('0x32')],function(_0x14217a){return{'name':_0x14217a[_0x582c('0x33')],'type':_0x14217a['type'][_0x582c('0x34')]};});_0x4039f1[_0x582c('0x35')]=_[_0x582c('0x30')](_0x131243,_0x582c('0x2e'));_0x4039f1['query']=_[_0x582c('0x36')](_0xc560c4[_0x582c('0x37')]);_0x4039f1[_0x582c('0x38')]=_[_0x582c('0x39')](_0x4039f1[_0x582c('0x35')],_0x4039f1[_0x582c('0x37')]);_0x2ef1c0[_0x582c('0x3a')]=_[_0x582c('0x39')](_0x4039f1[_0x582c('0x35')],qs[_0x582c('0x3b')](_0xc560c4[_0x582c('0x37')][_0x582c('0x3b')]));_0x2ef1c0[_0x582c('0x3a')]=_0x2ef1c0[_0x582c('0x3a')][_0x582c('0x3c')]?_0x2ef1c0[_0x582c('0x3a')]:_0x4039f1[_0x582c('0x35')];if(!_0xc560c4[_0x582c('0x37')][_0x582c('0x3d')](_0x582c('0x3e'))){_0x2ef1c0[_0x582c('0x21')]=qs['limit'](_0xc560c4['query'][_0x582c('0x21')]);_0x2ef1c0['offset']=qs[_0x582c('0x1f')](_0xc560c4[_0x582c('0x37')][_0x582c('0x1f')]);}_0x2ef1c0[_0x582c('0x3f')]=qs['sort'](_0xc560c4[_0x582c('0x37')][_0x582c('0x40')]);_0x2ef1c0['where']=qs[_0x582c('0x38')](_[_0x582c('0x41')](_0xc560c4['query'],_0x4039f1[_0x582c('0x38')]),_0x131243);if(_0xc560c4[_0x582c('0x37')][_0x582c('0x42')]){_0x2ef1c0[_0x582c('0x43')]=_['merge'](_0x2ef1c0[_0x582c('0x43')],{'$or':_['map'](_0x131243,function(_0xeba56c){if(_0xeba56c[_0x582c('0x44')]!==_0x582c('0x45')){var _0x236f7e={};_0x236f7e[_0xeba56c[_0x582c('0x2e')]]={'$like':'%'+_0xc560c4[_0x582c('0x37')][_0x582c('0x42')]+'%'};return _0x236f7e;}})});}_0x2ef1c0=_[_0x582c('0x46')]({},_0x2ef1c0,_0xc560c4[_0x582c('0x47')]);var _0x3d8faa={'where':_0x2ef1c0[_0x582c('0x43')]};return db[_0x582c('0x31')][_0x582c('0x22')](_0x3d8faa)[_0x582c('0x28')](function(_0x25fdf0){_0xa94a21[_0x582c('0x22')]=_0x25fdf0;if(_0xc560c4['query'][_0x582c('0x48')]){_0x2ef1c0['include']=[{'all':!![]}];}return db[_0x582c('0x31')][_0x582c('0x49')](_0x2ef1c0);})[_0x582c('0x28')](function(_0x1f58c5){_0xa94a21[_0x582c('0x4a')]=_0x1f58c5;return _0xa94a21;})[_0x582c('0x28')](respondWithFilteredResult(_0x4cd9df,_0x2ef1c0))[_0x582c('0x4b')](handleError(_0x4cd9df,null));};exports['show']=function(_0x216f34,_0x159380){var _0x2e43b7={'raw':!![],'where':{'id':_0x216f34[_0x582c('0x4c')]['id']}},_0x48f7bc={};_0x48f7bc[_0x582c('0x35')]=_[_0x582c('0x36')](db[_0x582c('0x31')][_0x582c('0x32')]);_0x48f7bc['query']=_[_0x582c('0x36')](_0x216f34[_0x582c('0x37')]);_0x48f7bc['filters']=_[_0x582c('0x39')](_0x48f7bc['model'],_0x48f7bc['query']);_0x2e43b7[_0x582c('0x3a')]=_[_0x582c('0x39')](_0x48f7bc[_0x582c('0x35')],qs[_0x582c('0x3b')](_0x216f34[_0x582c('0x37')][_0x582c('0x3b')]));_0x2e43b7[_0x582c('0x3a')]=_0x2e43b7[_0x582c('0x3a')]['length']?_0x2e43b7[_0x582c('0x3a')]:_0x48f7bc[_0x582c('0x35')];if(_0x216f34[_0x582c('0x37')][_0x582c('0x48')]){_0x2e43b7[_0x582c('0x4d')]=[{'all':!![]}];}_0x2e43b7=_[_0x582c('0x46')]({},_0x2e43b7,_0x216f34['options']);return db[_0x582c('0x31')][_0x582c('0x4e')](_0x2e43b7)[_0x582c('0x28')](handleEntityNotFound(_0x159380,null))[_0x582c('0x28')](respondWithResult(_0x159380,null))[_0x582c('0x4b')](handleError(_0x159380,null));};exports['create']=function(_0x57d981,_0x17bd2b){return db[_0x582c('0x31')][_0x582c('0x4f')](_0x57d981[_0x582c('0x50')],{})['then'](function(_0x494d6a){var _0x27afb3=_0x57d981[_0x582c('0x51')][_0x582c('0x29')]({'plain':!![]});if(!_0x27afb3)throw new Error(_0x582c('0x52'));if(_0x27afb3[_0x582c('0x53')]===_0x582c('0x51')){var _0x591332=_0x494d6a['get']({'plain':!![]});var _0x5aa933=_0x582c('0x2a');return db[_0x582c('0x54')][_0x582c('0x4e')]({'where':{'name':_0x5aa933,'userProfileId':_0x27afb3[_0x582c('0x55')]},'raw':!![]})[_0x582c('0x28')](function(_0x69917f){if(_0x69917f&&_0x69917f['autoAssociation']===0x0){return db[_0x582c('0x2b')][_0x582c('0x4f')]({'name':_0x591332[_0x582c('0x2e')],'resourceId':_0x591332['id'],'type':_0x69917f[_0x582c('0x2e')],'sectionId':_0x69917f['id']},{})[_0x582c('0x28')](function(){return _0x494d6a;});}else{return _0x494d6a;}})[_0x582c('0x4b')](function(_0x2daf3f){logger[_0x582c('0x2c')](_0x582c('0x56'),_0x2daf3f);throw _0x2daf3f;});}return _0x494d6a;})[_0x582c('0x28')](respondWithResult(_0x17bd2b,0xc9))[_0x582c('0x4b')](handleError(_0x17bd2b,null));};exports[_0x582c('0x26')]=function(_0x523867,_0x12e5da){if(_0x523867['body']['id']){delete _0x523867['body']['id'];}return db[_0x582c('0x31')][_0x582c('0x4e')]({'where':{'id':_0x523867['params']['id']}})[_0x582c('0x28')](handleEntityNotFound(_0x12e5da,null))[_0x582c('0x28')](saveUpdates(_0x523867[_0x582c('0x50')],null))[_0x582c('0x28')](respondWithResult(_0x12e5da,null))[_0x582c('0x4b')](handleError(_0x12e5da,null));};exports[_0x582c('0x27')]=function(_0x35d643,_0x10dcdf){return db[_0x582c('0x31')][_0x582c('0x4e')]({'where':{'id':_0x35d643['params']['id']}})['then'](handleEntityNotFound(_0x10dcdf,null))['then'](removeEntity(_0x10dcdf,null))[_0x582c('0x4b')](handleError(_0x10dcdf,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index ff0f9f3..e945878 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 _0x902b=['api','moment','bluebird','request-promise','path','../../config/environment','exports','lodash','../../config/logger'];(function(_0x3f17b2,_0x458743){var _0x39814b=function(_0xae86e0){while(--_0xae86e0){_0x3f17b2['push'](_0x3f17b2['shift']());}};_0x39814b(++_0x458743);}(_0x902b,0x6a));var _0xb902=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x902b[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var logger=require(_0xb902('0x1'))(_0xb902('0x2'));var moment=require(_0xb902('0x3'));var BPromise=require(_0xb902('0x4'));var rp=require(_0xb902('0x5'));var fs=require('fs');var path=require(_0xb902('0x6'));var rimraf=require('rimraf');var config=require(_0xb902('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0xb902('0x8')]=function(_0x5d38bb,_0x157e14){return _0x5d38bb['define']('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6ae=['request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','util','moment','bluebird'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xf6ae,0x189));var _0xef6a=function(_0x1edca8,_0x38e013){_0x1edca8=_0x1edca8-0x0;var _0x185a47=_0xf6ae[_0x1edca8];return _0x185a47;};'use strict';var _=require('lodash');var util=require(_0xef6a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xef6a('0x1'));var BPromise=require(_0xef6a('0x2'));var rp=require(_0xef6a('0x3'));var fs=require('fs');var path=require(_0xef6a('0x4'));var rimraf=require(_0xef6a('0x5'));var config=require(_0xef6a('0x6'));var attributes=require(_0xef6a('0x7'));module[_0xef6a('0x8')]=function(_0x3a26ab,_0x4648d0){return _0x3a26ab[_0xef6a('0x9')](_0xef6a('0xa'),attributes,{'tableName':_0xef6a('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 03ab304..4fe1e91 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 _0x1594=['jayson/promise','client','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','message','error','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2b719f,_0x532745){var _0x37c8e8=function(_0x9527fa){while(--_0x9527fa){_0x2b719f['push'](_0x2b719f['shift']());}};_0x37c8e8(++_0x532745);}(_0x1594,0x1d8));var _0x4159=function(_0x48b46a,_0x51a6ab){_0x48b46a=_0x48b46a-0x0;var _0x1d9b6c=_0x1594[_0x48b46a];return _0x1d9b6c;};'use strict';var _=require(_0x4159('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4159('0x1'));var rs=require(_0x4159('0x2'));var fs=require('fs');var Redis=require(_0x4159('0x3'));var db=require(_0x4159('0x4'))['db'];var utils=require(_0x4159('0x5'));var logger=require(_0x4159('0x6'))('rpc');var config=require(_0x4159('0x7'));var jayson=require(_0x4159('0x8'));var client=jayson[_0x4159('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e42ef,_0x200e40,_0x6505a2){return new BPromise(function(_0x3ac0e1,_0xa6de72){return client['request'](_0x2e42ef,_0x6505a2)[_0x4159('0xa')](function(_0x4b7407){logger[_0x4159('0xb')](_0x4159('0xc'),_0x200e40,_0x4159('0xd'));logger[_0x4159('0xe')](_0x4159('0xf'),_0x200e40,'request\x20sent',JSON[_0x4159('0x10')](_0x4b7407));if(_0x4b7407['error']){if(_0x4b7407['error']['code']===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x200e40,_0x4b7407['error'][_0x4159('0x11')]);return _0xa6de72(_0x4b7407['error'][_0x4159('0x11')]);}logger[_0x4159('0x12')](_0x4159('0xc'),_0x200e40,_0x4b7407[_0x4159('0x12')][_0x4159('0x11')]);return _0x3ac0e1(_0x4b7407[_0x4159('0x12')][_0x4159('0x11')]);}else{logger[_0x4159('0xb')](_0x4159('0xc'),_0x200e40,'request\x20sent');_0x3ac0e1(_0x4b7407[_0x4159('0x13')][_0x4159('0x11')]);}})['catch'](function(_0x4effad){logger[_0x4159('0x12')](_0x4159('0xc'),_0x200e40,_0x4effad);_0xa6de72(_0x4effad);});});} \ No newline at end of file +var _0xb1a0=['debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb1a0,0xc4));var _0x0b1a=function(_0x407dd1,_0x4bf249){_0x407dd1=_0x407dd1-0x0;var _0x337429=_0xb1a0[_0x407dd1];return _0x337429;};'use strict';var _=require(_0x0b1a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b1a('0x1'));var rs=require(_0x0b1a('0x2'));var fs=require('fs');var Redis=require(_0x0b1a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b1a('0x4'));var logger=require(_0x0b1a('0x5'))(_0x0b1a('0x6'));var config=require(_0x0b1a('0x7'));var jayson=require(_0x0b1a('0x8'));var client=jayson[_0x0b1a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb175,_0x8cd768,_0xbb1ec7){return new BPromise(function(_0xf0a58b,_0x44d2c3){return client[_0x0b1a('0xa')](_0x2cb175,_0xbb1ec7)['then'](function(_0x5f0a2b){logger[_0x0b1a('0xb')](_0x0b1a('0xc'),_0x8cd768,_0x0b1a('0xd'));logger[_0x0b1a('0xe')](_0x0b1a('0xf'),_0x8cd768,_0x0b1a('0xd'),JSON['stringify'](_0x5f0a2b));if(_0x5f0a2b[_0x0b1a('0x10')]){if(_0x5f0a2b[_0x0b1a('0x10')][_0x0b1a('0x11')]===0x1f4){logger[_0x0b1a('0x10')](_0x0b1a('0xc'),_0x8cd768,_0x5f0a2b[_0x0b1a('0x10')][_0x0b1a('0x12')]);return _0x44d2c3(_0x5f0a2b['error'][_0x0b1a('0x12')]);}logger[_0x0b1a('0x10')](_0x0b1a('0xc'),_0x8cd768,_0x5f0a2b[_0x0b1a('0x10')][_0x0b1a('0x12')]);return _0xf0a58b(_0x5f0a2b[_0x0b1a('0x10')][_0x0b1a('0x12')]);}else{logger[_0x0b1a('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x8cd768,_0x0b1a('0xd'));_0xf0a58b(_0x5f0a2b[_0x0b1a('0x13')]['message']);}})[_0x0b1a('0x14')](function(_0x4fe083){logger[_0x0b1a('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x8cd768,_0x4fe083);_0x44d2c3(_0x4fe083);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 899a46a..d483a13 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 _0x1fed=['show','post','create','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x49c934,_0x2784e2){var _0x3350d4=function(_0x30712d){while(--_0x30712d){_0x49c934['push'](_0x49c934['shift']());}};_0x3350d4(++_0x2784e2);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0x1fed[_0x7efe31];return _0x59ea5a;};'use strict';var multer=require(_0xd1fe('0x0'));var util=require('util');var path=require(_0xd1fe('0x1'));var timeout=require(_0xd1fe('0x2'));var express=require(_0xd1fe('0x3'));var router=express[_0xd1fe('0x4')]();var fs_extra=require(_0xd1fe('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1fe('0x6'));var controller=require('./cmContactHasItem.controller');router[_0xd1fe('0x7')]('/',auth[_0xd1fe('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd1fe('0x9')]);router[_0xd1fe('0xa')]('/',auth[_0xd1fe('0x8')](),controller[_0xd1fe('0xb')]);router[_0xd1fe('0xc')]('/:id',auth[_0xd1fe('0x8')](),controller[_0xd1fe('0xd')]);router[_0xd1fe('0xe')](_0xd1fe('0xf'),auth[_0xd1fe('0x8')](),controller['destroy']);module[_0xd1fe('0x10')]=router; \ No newline at end of file +var _0xfb96=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x53c6c1,_0x1f029a){var _0x168732=function(_0x5126da){while(--_0x5126da){_0x53c6c1['push'](_0x53c6c1['shift']());}};_0x168732(++_0x1f029a);}(_0xfb96,0x151));var _0x6fb9=function(_0xeceb63,_0x1bcc83){_0xeceb63=_0xeceb63-0x0;var _0x590f71=_0xfb96[_0xeceb63];return _0x590f71;};'use strict';var multer=require(_0x6fb9('0x0'));var util=require(_0x6fb9('0x1'));var path=require(_0x6fb9('0x2'));var timeout=require(_0x6fb9('0x3'));var express=require(_0x6fb9('0x4'));var router=express[_0x6fb9('0x5')]();var fs_extra=require(_0x6fb9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6fb9('0x7'));var config=require(_0x6fb9('0x8'));var controller=require(_0x6fb9('0x9'));router[_0x6fb9('0xa')]('/',auth[_0x6fb9('0xb')](),controller[_0x6fb9('0xc')]);router['get'](_0x6fb9('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6fb9('0xb')](),controller[_0x6fb9('0xe')]);router['put'](_0x6fb9('0xd'),auth[_0x6fb9('0xb')](),controller[_0x6fb9('0xf')]);router[_0x6fb9('0x10')](_0x6fb9('0xd'),auth['isAuthenticated'](),controller[_0x6fb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b8aa739..ada3cc6 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 _0x8d7a=['stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x8d7a,0xad));var _0xa8d7=function(_0x5a4b42,_0x4f5f4c){_0x5a4b42=_0x5a4b42-0x0;var _0x3c93a3=_0x8d7a[_0x5a4b42];return _0x3c93a3;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa8d7('0x0'));module[_0xa8d7('0x1')]={'name':{'type':Sequelize[_0xa8d7('0x2')],'get':function(_0x25faa3){return this[_0xa8d7('0x3')](_0xa8d7('0x4'));}},'alias':{'type':Sequelize[_0xa8d7('0x5')],'allowNull':![],'set':function(_0x4e249f){this[_0xa8d7('0x6')](_0xa8d7('0x4'),_0x4e249f?_0x4e249f:this[_0xa8d7('0x3')](_0xa8d7('0x7')));}},'type':{'type':Sequelize[_0xa8d7('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xa8d7('0x8')](_0xa8d7('0x9')),'get':function(){if(this[_0xa8d7('0x3')]('type')===_0xa8d7('0xa')){return JSON[_0xa8d7('0xb')](this[_0xa8d7('0x3')](_0xa8d7('0xc')));}else{return this[_0xa8d7('0x3')](_0xa8d7('0xc'));}},'set':function(_0x21eec3){if(Array[_0xa8d7('0xd')](_0x21eec3)){this[_0xa8d7('0x6')](_0xa8d7('0xc'),JSON[_0xa8d7('0xe')](_0x21eec3));}else{this['setDataValue'](_0xa8d7('0xc'),_0x21eec3);}}},'required':{'type':Sequelize[_0xa8d7('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa8d7('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa8d7('0x10')]('voice')}}; \ No newline at end of file +var _0xe36a=['sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','TEXT','long','getDataValue','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x5c1911,_0x5063d9){var _0x360290=function(_0x5081a7){while(--_0x5081a7){_0x5c1911['push'](_0x5c1911['shift']());}};_0x360290(++_0x5063d9);}(_0xe36a,0x80));var _0xae36=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0xe36a[_0x475191];return _0x189e96;};'use strict';var Sequelize=require(_0xae36('0x0'));var _=require(_0xae36('0x1'));module[_0xae36('0x2')]={'name':{'type':Sequelize[_0xae36('0x3')],'get':function(_0x475df7){return this['getDataValue'](_0xae36('0x4'));}},'alias':{'type':Sequelize[_0xae36('0x5')],'allowNull':![],'set':function(_0x54b3ae){this[_0xae36('0x6')](_0xae36('0x4'),_0x54b3ae?_0x54b3ae:this['getDataValue']('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xae36('0x7')](_0xae36('0x8')),'get':function(){if(this[_0xae36('0x9')]('type')==='select'){return JSON[_0xae36('0xa')](this[_0xae36('0x9')](_0xae36('0xb')));}else{return this[_0xae36('0x9')](_0xae36('0xb'));}},'set':function(_0x3636cc){if(Array[_0xae36('0xc')](_0x3636cc)){this[_0xae36('0x6')](_0xae36('0xb'),JSON[_0xae36('0xd')](_0x3636cc));}else{this[_0xae36('0x6')](_0xae36('0xb'),_0x3636cc);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xae36('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xae36('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 268c3aa..215c990 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 _0x02b9=['query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x02b9,0xdc));var _0x902b=function(_0x466be1,_0xcccee){_0x466be1=_0x466be1-0x0;var _0x240ce2=_0x02b9[_0x466be1];return _0x240ce2;};'use strict';var emlformat=require(_0x902b('0x0'));var rimraf=require(_0x902b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x902b('0x2'));var rp=require(_0x902b('0x3'));var moment=require(_0x902b('0x4'));var BPromise=require(_0x902b('0x5'));var Mustache=require(_0x902b('0x6'));var util=require('util');var path=require(_0x902b('0x7'));var sox=require('sox');var csv=require(_0x902b('0x8'));var ejs=require(_0x902b('0x9'));var fs=require('fs');var fs_extra=require(_0x902b('0xa'));var _=require(_0x902b('0xb'));var squel=require(_0x902b('0xc'));var crypto=require(_0x902b('0xd'));var jsforce=require(_0x902b('0xe'));var deskjs=require(_0x902b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x902b('0x10'));var Redis=require('ioredis');var authService=require(_0x902b('0x11'));var qs=require(_0x902b('0x12'));var as=require(_0x902b('0x13'));var hardwareService=require(_0x902b('0x14'));var logger=require(_0x902b('0x15'))(_0x902b('0x16'));var utils=require(_0x902b('0x17'));var config=require(_0x902b('0x18'));var licenseUtil=require(_0x902b('0x19'));var db=require(_0x902b('0x1a'))['db'];function respondWithStatusCode(_0x146435,_0x4233bc){_0x4233bc=_0x4233bc||0xcc;return function(_0x589042){if(_0x589042){return _0x146435[_0x902b('0x1b')](_0x4233bc);}return _0x146435[_0x902b('0x1c')](_0x4233bc)['end']();};}function respondWithResult(_0x26874a,_0x25c124){_0x25c124=_0x25c124||0xc8;return function(_0xcee44c){if(_0xcee44c){return _0x26874a[_0x902b('0x1c')](_0x25c124)[_0x902b('0x1d')](_0xcee44c);}};}function respondWithFilteredResult(_0x54e1ba,_0x4d7da5){return function(_0x455863){if(_0x455863){var _0x11ef65=typeof _0x4d7da5[_0x902b('0x1e')]===_0x902b('0x1f')&&typeof _0x4d7da5[_0x902b('0x20')]===_0x902b('0x1f');var _0x5d1d1d=_0x455863['count'];var _0x2c8a12=_0x11ef65?0x0:_0x4d7da5[_0x902b('0x1e')];var _0x2c1967=_0x11ef65?_0x455863[_0x902b('0x21')]:_0x4d7da5[_0x902b('0x1e')]+_0x4d7da5[_0x902b('0x20')];var _0x2471a2;if(_0x2c1967>=_0x5d1d1d){_0x2c1967=_0x5d1d1d;_0x2471a2=0xc8;}else{_0x2471a2=0xce;}_0x54e1ba[_0x902b('0x1c')](_0x2471a2);return _0x54e1ba[_0x902b('0x22')](_0x902b('0x23'),_0x2c8a12+'-'+_0x2c1967+'/'+_0x5d1d1d)[_0x902b('0x1d')](_0x455863);}return null;};}function patchUpdates(_0x4678e1){return function(_0x173ed0){try{jsonpatch[_0x902b('0x24')](_0x173ed0,_0x4678e1,!![]);}catch(_0x3f1543){return BPromise['reject'](_0x3f1543);}return _0x173ed0[_0x902b('0x25')]();};}function saveUpdates(_0x4f7937,_0x101458){return function(_0x191adb){if(_0x191adb){return _0x191adb[_0x902b('0x26')](_0x4f7937)[_0x902b('0x27')](function(_0xa92664){return _0xa92664;});}return null;};}function removeEntity(_0x2c6342,_0x1e639c){return function(_0x58bb29){if(_0x58bb29){return _0x58bb29[_0x902b('0x28')]()[_0x902b('0x27')](function(){_0x2c6342[_0x902b('0x1c')](0xcc)[_0x902b('0x29')]();});}};}function handleEntityNotFound(_0x2f5d37,_0x600735){return function(_0x3c2c32){if(!_0x3c2c32){_0x2f5d37[_0x902b('0x1b')](0x194);}return _0x3c2c32;};}function handleError(_0x3b7043,_0x5c1dda){_0x5c1dda=_0x5c1dda||0x1f4;return function(_0xa03387){logger[_0x902b('0x2a')](_0xa03387[_0x902b('0x2b')]);if(_0xa03387[_0x902b('0x2c')]){delete _0xa03387['name'];}_0x3b7043[_0x902b('0x1c')](_0x5c1dda)[_0x902b('0x2d')](_0xa03387);};}exports[_0x902b('0x2e')]=function(_0x2942a9,_0x550fad){var _0xb595eb={},_0x199d45={},_0x42b146={'count':0x0,'rows':[]};var _0x547881=_[_0x902b('0x2f')](db[_0x902b('0x30')][_0x902b('0x31')],function(_0x10201d){return{'name':_0x10201d[_0x902b('0x32')],'type':_0x10201d[_0x902b('0x33')]['key']};});_0x199d45[_0x902b('0x34')]=_['differenceBy'](_[_0x902b('0x2f')](_0x547881,_0x902b('0x2c')),[_0x902b('0x2c')]);_0x199d45[_0x902b('0x35')]=_[_0x902b('0x36')](_0x2942a9['query']);_0x199d45[_0x902b('0x37')]=_[_0x902b('0x38')](_0x199d45['model'],_0x199d45[_0x902b('0x35')]);_0xb595eb['attributes']=_[_0x902b('0x38')](_0x199d45[_0x902b('0x34')],qs[_0x902b('0x39')](_0x2942a9[_0x902b('0x35')][_0x902b('0x39')]));_0xb595eb['attributes']=_0xb595eb[_0x902b('0x3a')]['length']?_0xb595eb[_0x902b('0x3a')]:_0x199d45['model'];if(!_0x2942a9['query'][_0x902b('0x3b')](_0x902b('0x3c'))){_0xb595eb[_0x902b('0x20')]=qs['limit'](_0x2942a9['query'][_0x902b('0x20')]);_0xb595eb[_0x902b('0x1e')]=qs[_0x902b('0x1e')](_0x2942a9[_0x902b('0x35')][_0x902b('0x1e')]);}_0xb595eb[_0x902b('0x3d')]=qs[_0x902b('0x3e')](_0x2942a9[_0x902b('0x35')][_0x902b('0x3e')]);_0xb595eb['where']=qs['filters'](_['pick'](_0x2942a9[_0x902b('0x35')],_0x199d45[_0x902b('0x37')]),_0x547881);if(_0x2942a9['query'][_0x902b('0x3f')]){_0xb595eb['where']=_[_0x902b('0x40')](_0xb595eb[_0x902b('0x41')],{'$or':_['map'](_0x547881,function(_0x5729ea){if(_0x5729ea[_0x902b('0x33')]!==_0x902b('0x42')){var _0x3dd17e={};_0x3dd17e[_0x5729ea[_0x902b('0x2c')]]={'$like':'%'+_0x2942a9[_0x902b('0x35')][_0x902b('0x3f')]+'%'};return _0x3dd17e;}})});}_0xb595eb=_[_0x902b('0x40')]({},_0xb595eb,_0x2942a9['options']);var _0x374651={'where':_0xb595eb[_0x902b('0x41')]};return db[_0x902b('0x30')][_0x902b('0x21')](_0x374651)[_0x902b('0x27')](function(_0xb8cb2b){_0x42b146[_0x902b('0x21')]=_0xb8cb2b;if(_0x2942a9[_0x902b('0x35')][_0x902b('0x43')]){_0xb595eb[_0x902b('0x44')]=[{'all':!![]}];}return db[_0x902b('0x30')][_0x902b('0x45')](_0xb595eb);})[_0x902b('0x27')](function(_0x49b517){_0x42b146[_0x902b('0x46')]=_0x49b517;return _0x42b146;})[_0x902b('0x27')](respondWithFilteredResult(_0x550fad,_0xb595eb))[_0x902b('0x47')](handleError(_0x550fad,null));};exports[_0x902b('0x48')]=function(_0x3d89c9,_0xdc5654){var _0x5cc38f={'raw':!![],'where':{'id':_0x3d89c9[_0x902b('0x49')]['id']}},_0x58daa2={};_0x58daa2['model']=_[_0x902b('0x36')](db['CmCustomField'][_0x902b('0x31')]);_0x58daa2[_0x902b('0x35')]=_[_0x902b('0x36')](_0x3d89c9[_0x902b('0x35')]);_0x58daa2[_0x902b('0x37')]=_['intersection'](_0x58daa2[_0x902b('0x34')],_0x58daa2[_0x902b('0x35')]);_0x5cc38f['attributes']=_[_0x902b('0x38')](_0x58daa2['model'],qs[_0x902b('0x39')](_0x3d89c9[_0x902b('0x35')][_0x902b('0x39')]));_0x5cc38f[_0x902b('0x3a')]=_0x5cc38f[_0x902b('0x3a')]['length']?_0x5cc38f[_0x902b('0x3a')]:_0x58daa2[_0x902b('0x34')];if(_0x3d89c9['query'][_0x902b('0x43')]){_0x5cc38f[_0x902b('0x44')]=[{'all':!![]}];}_0x5cc38f=_[_0x902b('0x40')]({},_0x5cc38f,_0x3d89c9[_0x902b('0x4a')]);return db['CmCustomField'][_0x902b('0x4b')](_0x5cc38f)['then'](handleEntityNotFound(_0xdc5654,null))[_0x902b('0x27')](respondWithResult(_0xdc5654,null))['catch'](handleError(_0xdc5654,null));};exports[_0x902b('0x26')]=function(_0x4f888d,_0x11e97f){if(_0x4f888d[_0x902b('0x4c')]['id']){delete _0x4f888d[_0x902b('0x4c')]['id'];}return db[_0x902b('0x30')][_0x902b('0x4b')]({'where':{'id':_0x4f888d['params']['id']}})[_0x902b('0x27')](handleEntityNotFound(_0x11e97f,null))[_0x902b('0x27')](saveUpdates(_0x4f888d['body'],null))['then'](respondWithResult(_0x11e97f,null))['catch'](handleError(_0x11e97f,null));};exports['destroy']=function(_0x2d67dc,_0xc4b3ec){return db[_0x902b('0x30')][_0x902b('0x4b')]({'where':{'id':_0x2d67dc[_0x902b('0x49')]['id']}})['then'](handleEntityNotFound(_0xc4b3ec,null))[_0x902b('0x27')](removeEntity(_0xc4b3ec,null))['catch'](handleError(_0xc4b3ec,null));};exports[_0x902b('0x4d')]=function(_0x3ed925,_0x104ef9){var _0x3380c3;return db[_0x902b('0x4e')][_0x902b('0x4f')](function(_0x14eef5){return db[_0x902b('0x30')][_0x902b('0x4d')](_0x3ed925[_0x902b('0x4c')],{'transaction':_0x14eef5})[_0x902b('0x27')](function(_0x4acaf4){_0x3380c3=_0x4acaf4;var _0xb3f8f={'type':db[_0x902b('0x50')][_0x902b('0x51')],'transaction':_0x14eef5};switch(_0x3ed925[_0x902b('0x4c')]['type']){case _0x902b('0x52'):_0xb3f8f[_0x902b('0x33')]=db[_0x902b('0x50')][_0x902b('0x51')];break;case _0x902b('0x53'):_0xb3f8f[_0x902b('0x33')]=db[_0x902b('0x50')][_0x902b('0x54')];break;case'switch':_0xb3f8f['type']=db['Sequelize'][_0x902b('0x55')];_0xb3f8f['defaultValue']=![];break;default:}return db[_0x902b('0x4e')][_0x902b('0x56')][_0x902b('0x57')](_0x902b('0x58'),util[_0x902b('0x59')](_0x902b('0x5a'),_0x3380c3['id']),_0xb3f8f);})[_0x902b('0x27')](function(){return _0x3380c3;});})[_0x902b('0x27')](respondWithResult(_0x104ef9,0xc9))[_0x902b('0x47')](handleError(_0x104ef9,null));}; \ No newline at end of file +var _0xcb5a=['../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','stack','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','name','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','update','body','destroy','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xcb5a,0x9e));var _0xacb5=function(_0x329dbb,_0x10bb42){_0x329dbb=_0x329dbb-0x0;var _0x3f0ac0=_0xcb5a[_0x329dbb];return _0x3f0ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xacb5('0x0'));var zipdir=require(_0xacb5('0x1'));var jsonpatch=require(_0xacb5('0x2'));var rp=require('request-promise');var moment=require(_0xacb5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xacb5('0x4'));var util=require(_0xacb5('0x5'));var path=require(_0xacb5('0x6'));var sox=require(_0xacb5('0x7'));var csv=require(_0xacb5('0x8'));var ejs=require(_0xacb5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacb5('0xa'));var squel=require(_0xacb5('0xb'));var crypto=require('crypto');var jsforce=require(_0xacb5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xacb5('0x8'));var querystring=require(_0xacb5('0xd'));var Papa=require(_0xacb5('0xe'));var Redis=require('ioredis');var authService=require(_0xacb5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xacb5('0x10'))(_0xacb5('0x11'));var utils=require(_0xacb5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xacb5('0x13'))['db'];function respondWithStatusCode(_0x144e6e,_0x3e11a5){_0x3e11a5=_0x3e11a5||0xcc;return function(_0x145a58){if(_0x145a58){return _0x144e6e['sendStatus'](_0x3e11a5);}return _0x144e6e['status'](_0x3e11a5)[_0xacb5('0x14')]();};}function respondWithResult(_0x18f3c5,_0x2cb4fb){_0x2cb4fb=_0x2cb4fb||0xc8;return function(_0x5f4175){if(_0x5f4175){return _0x18f3c5[_0xacb5('0x15')](_0x2cb4fb)['json'](_0x5f4175);}};}function respondWithFilteredResult(_0x272576,_0x4585e9){return function(_0x1a0c65){if(_0x1a0c65){var _0x5749fe=typeof _0x4585e9[_0xacb5('0x16')]===_0xacb5('0x17')&&typeof _0x4585e9[_0xacb5('0x18')]===_0xacb5('0x17');var _0x2c73c4=_0x1a0c65[_0xacb5('0x19')];var _0x292208=_0x5749fe?0x0:_0x4585e9[_0xacb5('0x16')];var _0x3c7a07=_0x5749fe?_0x1a0c65['count']:_0x4585e9[_0xacb5('0x16')]+_0x4585e9[_0xacb5('0x18')];var _0x16928d;if(_0x3c7a07>=_0x2c73c4){_0x3c7a07=_0x2c73c4;_0x16928d=0xc8;}else{_0x16928d=0xce;}_0x272576[_0xacb5('0x15')](_0x16928d);return _0x272576[_0xacb5('0x1a')](_0xacb5('0x1b'),_0x292208+'-'+_0x3c7a07+'/'+_0x2c73c4)[_0xacb5('0x1c')](_0x1a0c65);}return null;};}function patchUpdates(_0x302981){return function(_0x23835e){try{jsonpatch[_0xacb5('0x1d')](_0x23835e,_0x302981,!![]);}catch(_0x103e39){return BPromise[_0xacb5('0x1e')](_0x103e39);}return _0x23835e[_0xacb5('0x1f')]();};}function saveUpdates(_0x5443ee,_0x234ba1){return function(_0x2deddc){if(_0x2deddc){return _0x2deddc['update'](_0x5443ee)['then'](function(_0x4dbc8b){return _0x4dbc8b;});}return null;};}function removeEntity(_0x1ebdf6,_0x30ce64){return function(_0x4a1426){if(_0x4a1426){return _0x4a1426['destroy']()[_0xacb5('0x20')](function(){_0x1ebdf6[_0xacb5('0x15')](0xcc)[_0xacb5('0x14')]();});}};}function handleEntityNotFound(_0xa3de03,_0x1e9663){return function(_0x247f99){if(!_0x247f99){_0xa3de03[_0xacb5('0x21')](0x194);}return _0x247f99;};}function handleError(_0x9c08f7,_0x83bfe2){_0x83bfe2=_0x83bfe2||0x1f4;return function(_0x5cb14f){logger['error'](_0x5cb14f[_0xacb5('0x22')]);if(_0x5cb14f['name']){delete _0x5cb14f['name'];}_0x9c08f7[_0xacb5('0x15')](_0x83bfe2)[_0xacb5('0x23')](_0x5cb14f);};}exports[_0xacb5('0x24')]=function(_0x15f789,_0x381f2c){var _0x33d043={},_0x3246ea={},_0x33f07b={'count':0x0,'rows':[]};var _0x403524=_[_0xacb5('0x25')](db[_0xacb5('0x26')][_0xacb5('0x27')],function(_0x1d34f6){return{'name':_0x1d34f6[_0xacb5('0x28')],'type':_0x1d34f6[_0xacb5('0x29')][_0xacb5('0x2a')]};});_0x3246ea['model']=_[_0xacb5('0x2b')](_[_0xacb5('0x25')](_0x403524,_0xacb5('0x2c')),[_0xacb5('0x2c')]);_0x3246ea['query']=_['keys'](_0x15f789[_0xacb5('0x2d')]);_0x3246ea['filters']=_[_0xacb5('0x2e')](_0x3246ea['model'],_0x3246ea[_0xacb5('0x2d')]);_0x33d043[_0xacb5('0x2f')]=_[_0xacb5('0x2e')](_0x3246ea[_0xacb5('0x30')],qs[_0xacb5('0x31')](_0x15f789[_0xacb5('0x2d')][_0xacb5('0x31')]));_0x33d043[_0xacb5('0x2f')]=_0x33d043[_0xacb5('0x2f')][_0xacb5('0x32')]?_0x33d043[_0xacb5('0x2f')]:_0x3246ea[_0xacb5('0x30')];if(!_0x15f789['query']['hasOwnProperty'](_0xacb5('0x33'))){_0x33d043['limit']=qs[_0xacb5('0x18')](_0x15f789[_0xacb5('0x2d')]['limit']);_0x33d043[_0xacb5('0x16')]=qs[_0xacb5('0x16')](_0x15f789[_0xacb5('0x2d')]['offset']);}_0x33d043[_0xacb5('0x34')]=qs[_0xacb5('0x35')](_0x15f789[_0xacb5('0x2d')][_0xacb5('0x35')]);_0x33d043[_0xacb5('0x36')]=qs[_0xacb5('0x37')](_[_0xacb5('0x38')](_0x15f789['query'],_0x3246ea['filters']),_0x403524);if(_0x15f789[_0xacb5('0x2d')][_0xacb5('0x39')]){_0x33d043[_0xacb5('0x36')]=_[_0xacb5('0x3a')](_0x33d043['where'],{'$or':_[_0xacb5('0x25')](_0x403524,function(_0x1ddf3d){if(_0x1ddf3d[_0xacb5('0x29')]!==_0xacb5('0x3b')){var _0x27c570={};_0x27c570[_0x1ddf3d['name']]={'$like':'%'+_0x15f789[_0xacb5('0x2d')][_0xacb5('0x39')]+'%'};return _0x27c570;}})});}_0x33d043=_[_0xacb5('0x3a')]({},_0x33d043,_0x15f789[_0xacb5('0x3c')]);var _0x37ef85={'where':_0x33d043[_0xacb5('0x36')]};return db[_0xacb5('0x26')][_0xacb5('0x19')](_0x37ef85)[_0xacb5('0x20')](function(_0xf76465){_0x33f07b[_0xacb5('0x19')]=_0xf76465;if(_0x15f789[_0xacb5('0x2d')][_0xacb5('0x3d')]){_0x33d043['include']=[{'all':!![]}];}return db[_0xacb5('0x26')][_0xacb5('0x3e')](_0x33d043);})[_0xacb5('0x20')](function(_0xa22840){_0x33f07b[_0xacb5('0x3f')]=_0xa22840;return _0x33f07b;})[_0xacb5('0x20')](respondWithFilteredResult(_0x381f2c,_0x33d043))[_0xacb5('0x40')](handleError(_0x381f2c,null));};exports['show']=function(_0x3ca240,_0x26e4af){var _0xc63c19={'raw':!![],'where':{'id':_0x3ca240[_0xacb5('0x41')]['id']}},_0x2cdcdb={};_0x2cdcdb[_0xacb5('0x30')]=_[_0xacb5('0x42')](db[_0xacb5('0x26')][_0xacb5('0x27')]);_0x2cdcdb[_0xacb5('0x2d')]=_[_0xacb5('0x42')](_0x3ca240[_0xacb5('0x2d')]);_0x2cdcdb[_0xacb5('0x37')]=_[_0xacb5('0x2e')](_0x2cdcdb[_0xacb5('0x30')],_0x2cdcdb['query']);_0xc63c19['attributes']=_[_0xacb5('0x2e')](_0x2cdcdb['model'],qs['fields'](_0x3ca240[_0xacb5('0x2d')][_0xacb5('0x31')]));_0xc63c19['attributes']=_0xc63c19[_0xacb5('0x2f')]['length']?_0xc63c19[_0xacb5('0x2f')]:_0x2cdcdb[_0xacb5('0x30')];if(_0x3ca240[_0xacb5('0x2d')]['includeAll']){_0xc63c19[_0xacb5('0x43')]=[{'all':!![]}];}_0xc63c19=_[_0xacb5('0x3a')]({},_0xc63c19,_0x3ca240['options']);return db[_0xacb5('0x26')][_0xacb5('0x44')](_0xc63c19)[_0xacb5('0x20')](handleEntityNotFound(_0x26e4af,null))[_0xacb5('0x20')](respondWithResult(_0x26e4af,null))[_0xacb5('0x40')](handleError(_0x26e4af,null));};exports[_0xacb5('0x45')]=function(_0x45c917,_0x149d8a){if(_0x45c917[_0xacb5('0x46')]['id']){delete _0x45c917[_0xacb5('0x46')]['id'];}return db[_0xacb5('0x26')][_0xacb5('0x44')]({'where':{'id':_0x45c917[_0xacb5('0x41')]['id']}})[_0xacb5('0x20')](handleEntityNotFound(_0x149d8a,null))[_0xacb5('0x20')](saveUpdates(_0x45c917[_0xacb5('0x46')],null))[_0xacb5('0x20')](respondWithResult(_0x149d8a,null))[_0xacb5('0x40')](handleError(_0x149d8a,null));};exports[_0xacb5('0x47')]=function(_0x3446d0,_0x5ba834){return db[_0xacb5('0x26')][_0xacb5('0x44')]({'where':{'id':_0x3446d0[_0xacb5('0x41')]['id']}})[_0xacb5('0x20')](handleEntityNotFound(_0x5ba834,null))[_0xacb5('0x20')](removeEntity(_0x5ba834,null))['catch'](handleError(_0x5ba834,null));};exports['create']=function(_0x2cc92d,_0x58ae8c){var _0x39415c;return db[_0xacb5('0x48')][_0xacb5('0x49')](function(_0x4366de){return db[_0xacb5('0x26')][_0xacb5('0x4a')](_0x2cc92d[_0xacb5('0x46')],{'transaction':_0x4366de})[_0xacb5('0x20')](function(_0x55bbc0){_0x39415c=_0x55bbc0;var _0x409ddb={'type':db[_0xacb5('0x4b')][_0xacb5('0x4c')],'transaction':_0x4366de};switch(_0x2cc92d['body'][_0xacb5('0x29')]){case _0xacb5('0x4d'):_0x409ddb['type']=db[_0xacb5('0x4b')][_0xacb5('0x4c')];break;case _0xacb5('0x4e'):_0x409ddb[_0xacb5('0x29')]=db[_0xacb5('0x4b')][_0xacb5('0x4f')];break;case _0xacb5('0x50'):_0x409ddb[_0xacb5('0x29')]=db['Sequelize'][_0xacb5('0x51')];_0x409ddb[_0xacb5('0x52')]=![];break;default:}return db[_0xacb5('0x48')]['queryInterface'][_0xacb5('0x53')](_0xacb5('0x54'),util[_0xacb5('0x55')](_0xacb5('0x56'),_0x39415c['id']),_0x409ddb);})[_0xacb5('0x20')](function(){return _0x39415c;});})[_0xacb5('0x20')](respondWithResult(_0x58ae8c,0xc9))[_0xacb5('0x40')](handleError(_0x58ae8c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index ebfec68..7a6a291 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 _0x35c5=['exports','define','CmCustomField','lodash','util','api','path','../../config/environment','./cmCustomField.attributes'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x35c5,0x11a));var _0x535c=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x35c5[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x535c('0x0'));var util=require(_0x535c('0x1'));var logger=require('../../config/logger')(_0x535c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x535c('0x3'));var rimraf=require('rimraf');var config=require(_0x535c('0x4'));var attributes=require(_0x535c('0x5'));module[_0x535c('0x6')]=function(_0x35aa69,_0x2afa29){return _0x35aa69[_0x535c('0x7')](_0x535c('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b09=['moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash'];(function(_0x19a7a7,_0x48511e){var _0x401e43=function(_0x52a0b9){while(--_0x52a0b9){_0x19a7a7['push'](_0x19a7a7['shift']());}};_0x401e43(++_0x48511e);}(_0x5b09,0x117));var _0x95b0=function(_0x21e725,_0x2d38c2){_0x21e725=_0x21e725-0x0;var _0x49ecaf=_0x5b09[_0x21e725];return _0x49ecaf;};'use strict';var _=require(_0x95b0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x95b0('0x1'));var BPromise=require('bluebird');var rp=require(_0x95b0('0x2'));var fs=require('fs');var path=require(_0x95b0('0x3'));var rimraf=require(_0x95b0('0x4'));var config=require(_0x95b0('0x5'));var attributes=require(_0x95b0('0x6'));module[_0x95b0('0x7')]=function(_0x40fd37,_0xa8d3c0){return _0x40fd37['define'](_0x95b0('0x8'),attributes,{'tableName':_0x95b0('0x9'),'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 51f409a..9878e60 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 _0xd267=['rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xd267,0x12c));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require('util');var moment=require(_0x7d26('0x1'));var BPromise=require(_0x7d26('0x2'));var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require(_0x7d26('0x4'));var db=require(_0x7d26('0x5'))['db'];var utils=require(_0x7d26('0x6'));var logger=require(_0x7d26('0x7'))(_0x7d26('0x8'));var config=require(_0x7d26('0x9'));var jayson=require(_0x7d26('0xa'));var client=jayson[_0x7d26('0xb')][_0x7d26('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2740,_0x4ff078,_0x12d5e4){return new BPromise(function(_0x44a039,_0x5e6842){return client[_0x7d26('0xd')](_0x1e2740,_0x12d5e4)['then'](function(_0x1200b0){logger[_0x7d26('0xe')](_0x7d26('0xf'),_0x4ff078,_0x7d26('0x10'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4ff078,'request\x20sent',JSON[_0x7d26('0x11')](_0x1200b0));if(_0x1200b0[_0x7d26('0x12')]){if(_0x1200b0['error']['code']===0x1f4){logger[_0x7d26('0x12')](_0x7d26('0xf'),_0x4ff078,_0x1200b0[_0x7d26('0x12')][_0x7d26('0x13')]);return _0x5e6842(_0x1200b0[_0x7d26('0x12')][_0x7d26('0x13')]);}logger[_0x7d26('0x12')](_0x7d26('0xf'),_0x4ff078,_0x1200b0['error'][_0x7d26('0x13')]);return _0x44a039(_0x1200b0[_0x7d26('0x12')][_0x7d26('0x13')]);}else{logger[_0x7d26('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4ff078,_0x7d26('0x10'));_0x44a039(_0x1200b0[_0x7d26('0x14')][_0x7d26('0x13')]);}})[_0x7d26('0x15')](function(_0x432a6e){logger[_0x7d26('0x12')](_0x7d26('0xf'),_0x4ff078,_0x432a6e);_0x5e6842(_0x432a6e);});});} \ No newline at end of file +var _0xa5e1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3e99ec,_0x37ac0d){var _0x4d951c=function(_0x24d80e){while(--_0x24d80e){_0x3e99ec['push'](_0x3e99ec['shift']());}};_0x4d951c(++_0x37ac0d);}(_0xa5e1,0x17a));var _0x1a5e=function(_0x56cfbc,_0x322ab5){_0x56cfbc=_0x56cfbc-0x0;var _0x1580e1=_0xa5e1[_0x56cfbc];return _0x1580e1;};'use strict';var _=require('lodash');var util=require(_0x1a5e('0x0'));var moment=require(_0x1a5e('0x1'));var BPromise=require(_0x1a5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5e('0x3'));var db=require(_0x1a5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a5e('0x5'))(_0x1a5e('0x6'));var config=require(_0x1a5e('0x7'));var jayson=require(_0x1a5e('0x8'));var client=jayson['client'][_0x1a5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d091,_0x1ccd0e,_0x102fbc){return new BPromise(function(_0x49c5db,_0x5b0c34){return client['request'](_0x18d091,_0x102fbc)[_0x1a5e('0xa')](function(_0x4b4618){logger[_0x1a5e('0xb')](_0x1a5e('0xc'),_0x1ccd0e,_0x1a5e('0xd'));logger[_0x1a5e('0xe')](_0x1a5e('0xf'),_0x1ccd0e,_0x1a5e('0xd'),JSON[_0x1a5e('0x10')](_0x4b4618));if(_0x4b4618[_0x1a5e('0x11')]){if(_0x4b4618[_0x1a5e('0x11')][_0x1a5e('0x12')]===0x1f4){logger[_0x1a5e('0x11')](_0x1a5e('0xc'),_0x1ccd0e,_0x4b4618[_0x1a5e('0x11')][_0x1a5e('0x13')]);return _0x5b0c34(_0x4b4618[_0x1a5e('0x11')]['message']);}logger[_0x1a5e('0x11')](_0x1a5e('0xc'),_0x1ccd0e,_0x4b4618[_0x1a5e('0x11')]['message']);return _0x49c5db(_0x4b4618[_0x1a5e('0x11')]['message']);}else{logger[_0x1a5e('0xb')](_0x1a5e('0xc'),_0x1ccd0e,_0x1a5e('0xd'));_0x49c5db(_0x4b4618[_0x1a5e('0x14')][_0x1a5e('0x13')]);}})['catch'](function(_0x493c0c){logger[_0x1a5e('0x11')](_0x1a5e('0xc'),_0x1ccd0e,_0x493c0c);_0x5b0c34(_0x493c0c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3a34013..dcdfbeb 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 _0xea44=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x269d15,_0x2b3e71){var _0xe8d2e=function(_0x411a40){while(--_0x411a40){_0x269d15['push'](_0x269d15['shift']());}};_0xe8d2e(++_0x2b3e71);}(_0xea44,0x1a5));var _0x4ea4=function(_0x2fe743,_0x2306c9){_0x2fe743=_0x2fe743-0x0;var _0x89a929=_0xea44[_0x2fe743];return _0x89a929;};'use strict';var multer=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var path=require(_0x4ea4('0x2'));var timeout=require(_0x4ea4('0x3'));var express=require('express');var router=express[_0x4ea4('0x4')]();var fs_extra=require(_0x4ea4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ea4('0x6'));var config=require(_0x4ea4('0x7'));var controller=require(_0x4ea4('0x8'));router[_0x4ea4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ea4('0xa')]);router[_0x4ea4('0x9')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xd')]);router[_0x4ea4('0xe')]('/',auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xf')]);router[_0x4ea4('0x10')]('/:id',auth[_0x4ea4('0xc')](),controller['update']);router['delete'](_0x4ea4('0xb'),auth['isAuthenticated'](),controller[_0x4ea4('0x11')]);module[_0x4ea4('0x12')]=router; \ No newline at end of file +var _0x0b04=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0b04,0x164));var _0x40b0=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0b04[_0x39e84d];return _0x1991bc;};'use strict';var multer=require(_0x40b0('0x0'));var util=require(_0x40b0('0x1'));var path=require(_0x40b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x40b0('0x3'));var router=express[_0x40b0('0x4')]();var fs_extra=require(_0x40b0('0x5'));var auth=require(_0x40b0('0x6'));var interaction=require(_0x40b0('0x7'));var config=require('../../config/environment');var controller=require(_0x40b0('0x8'));router['get']('/',auth[_0x40b0('0x9')](),controller[_0x40b0('0xa')]);router[_0x40b0('0xb')](_0x40b0('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x40b0('0xd')]('/',auth[_0x40b0('0x9')](),controller[_0x40b0('0xe')]);router[_0x40b0('0xf')](_0x40b0('0xc'),auth[_0x40b0('0x9')](),controller[_0x40b0('0x10')]);router[_0x40b0('0x11')](_0x40b0('0xc'),auth[_0x40b0('0x9')](),controller[_0x40b0('0x12')]);module[_0x40b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 318b828..ea72d63 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 _0xef0c=['STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x4a2365,_0x733b1f){var _0x188dc2=function(_0x2526b2){while(--_0x2526b2){_0x4a2365['push'](_0x4a2365['shift']());}};_0x188dc2(++_0x733b1f);}(_0xef0c,0x97));var _0xcef0=function(_0x2a1c2c,_0x1dd712){_0x2a1c2c=_0x2a1c2c-0x0;var _0x1cbee8=_0xef0c[_0x2a1c2c];return _0x1cbee8;};'use strict';var moment=require(_0xcef0('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xcef0('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xcef0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xcef0('0x3')](_0xcef0('0x4'))},'countbusyretry':{'type':Sequelize[_0xcef0('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcef0('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcef0('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcef0('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcef0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xcef0('0x5')](0x2)[_0xcef0('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcef0('0x5')],'unique':_0xcef0('0x7')},'ListId':{'type':Sequelize[_0xcef0('0x5')],'unique':_0xcef0('0x7')},'UserId':{'type':Sequelize[_0xcef0('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xcef0('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xcef0('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcef0('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcef0('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcef0('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa524=['exports','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x29869e,_0x21d13b){var _0x54272f=function(_0x4c2965){while(--_0x4c2965){_0x29869e['push'](_0x29869e['shift']());}};_0x54272f(++_0x21d13b);}(_0xa524,0xb3));var _0x4a52=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa524[_0x2be8c2];return _0x97f531;};'use strict';var moment=require(_0x4a52('0x0'));var Sequelize=require('sequelize');module[_0x4a52('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4a52('0x2')](_0x4a52('0x3'))},'countbusyretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4a52('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4a52('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4a52('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4a52('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x4a52('0x8')},'ListId':{'type':Sequelize[_0x4a52('0x4')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4a52('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x4a52('0x4')],'unique':_0x4a52('0x8')},'CampaignId':{'type':Sequelize[_0x4a52('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4a52('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4a52('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4a52('0x6')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 6432e01..925d09d 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 _0x04de=['getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','filters','concat','$and','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopper','includeAll','findAll','rows','show','params','keys','include','find','create','body','catch','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','deleted','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','literal','findOne','scheduledat','recallme','LOCK','UPDATE','CmContact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset'];(function(_0x2e3109,_0x4605cf){var _0x50a27f=function(_0xf79e0a){while(--_0xf79e0a){_0x2e3109['push'](_0x2e3109['shift']());}};_0x50a27f(++_0x4605cf);}(_0x04de,0x107));var _0xe04d=function(_0x1ce5be,_0xff443a){_0x1ce5be=_0x1ce5be-0x0;var _0x58cc77=_0x04de[_0x1ce5be];return _0x58cc77;};'use strict';var moment=require(_0xe04d('0x0'));var _=require(_0xe04d('0x1'));var qs=require(_0xe04d('0x2'));var logger=require(_0xe04d('0x3'))(_0xe04d('0x4'));var shared=require(_0xe04d('0x5'));var db=require(_0xe04d('0x6'))['db'];function respondWithResult(_0x43c4b1,_0x2593a4){_0x2593a4=_0x2593a4||0xc8;return function(_0x70ead0){if(_0x70ead0){return _0x43c4b1[_0xe04d('0x7')](_0x2593a4)['json'](_0x70ead0);}};}function respondWithFilteredResult(_0x4bb925,_0x4f7637){return function(_0x531688){if(_0x531688){var _0x55efb5=typeof _0x4f7637[_0xe04d('0x8')]===_0xe04d('0x9')&&typeof _0x4f7637[_0xe04d('0xa')]===_0xe04d('0x9');var _0x2a1f43=_0x531688[_0xe04d('0xb')];var _0x433350=_0x55efb5?0x0:_0x4f7637['offset'];var _0x160d4f=_0x55efb5?_0x531688[_0xe04d('0xb')]:_0x4f7637[_0xe04d('0x8')]+_0x4f7637[_0xe04d('0xa')];var _0xad5c34;if(_0x160d4f>=_0x2a1f43){_0x160d4f=_0x2a1f43;_0xad5c34=0xc8;}else{_0xad5c34=0xce;}_0x4bb925[_0xe04d('0x7')](_0xad5c34);return _0x4bb925[_0xe04d('0xc')](_0xe04d('0xd'),_0x433350+'-'+_0x160d4f+'/'+_0x2a1f43)[_0xe04d('0xe')](_0x531688);}return null;};}function saveUpdates(_0x53f59a,_0x8bf2d2){return function(_0x1d3f03){if(_0x1d3f03){return _0x1d3f03[_0xe04d('0xf')](_0x53f59a)[_0xe04d('0x10')](function(_0x2f7f51){return _0x2f7f51;});}return null;};}function handleEntityNotFound(_0xa2521,_0xf205f5){return function(_0x143019){if(!_0x143019){_0xa2521[_0xe04d('0x11')](0x194);}return _0x143019;};}function handleError(_0x16b305,_0xbc5cc7){_0xbc5cc7=_0xbc5cc7||0x1f4;return function(_0x1aa69b){logger['error'](_0x1aa69b[_0xe04d('0x12')]);if(_0x1aa69b['name']){delete _0x1aa69b[_0xe04d('0x13')];}_0x16b305['status'](_0xbc5cc7)[_0xe04d('0x14')](_0x1aa69b);};}exports[_0xe04d('0x15')]=function(_0x4221aa,_0x93b107){var _0x4090e0={},_0x35a2b4={},_0x251772={'count':0x0,'rows':[]};var _0x399aa0=_[_0xe04d('0x16')](db['CmHopper'][_0xe04d('0x17')],function(_0x3e0fa9){return{'name':_0x3e0fa9[_0xe04d('0x18')],'type':_0x3e0fa9[_0xe04d('0x19')][_0xe04d('0x1a')]};});_0x35a2b4[_0xe04d('0x1b')]=_['map'](_0x399aa0,_0xe04d('0x13'));_0x35a2b4[_0xe04d('0x1c')]=_['keys'](_0x4221aa['query']);_0x35a2b4['filters']=_[_0xe04d('0x1d')](_0x35a2b4['model'],_0x35a2b4['query']);_0x35a2b4[_0xe04d('0x1e')]=_[_0xe04d('0x1f')](_0x35a2b4['filters'],[_0xe04d('0x20'),'$or',_0xe04d('0x21'),'$gte',_0xe04d('0x22'),_0xe04d('0x23'),_0xe04d('0x24'),_0xe04d('0x25'),_0xe04d('0x26'),'$between',_0xe04d('0x27'),_0xe04d('0x28'),_0xe04d('0x29'),_0xe04d('0x2a'),'$notLike',_0xe04d('0x2b'),_0xe04d('0x2c'),_0xe04d('0x2a'),'$overlap',_0xe04d('0x2d'),'$contained','$any']);_0x4090e0['attributes']=_[_0xe04d('0x1d')](_0x35a2b4[_0xe04d('0x1b')],qs['fields'](_0x4221aa['query'][_0xe04d('0x2e')]));_0x4090e0[_0xe04d('0x2f')]=_0x4090e0[_0xe04d('0x2f')]['length']?_0x4090e0[_0xe04d('0x2f')]:_0x35a2b4[_0xe04d('0x1b')];if(!_0x4221aa['query'][_0xe04d('0x30')]('nolimit')){_0x4090e0[_0xe04d('0xa')]=qs[_0xe04d('0xa')](_0x4221aa['query'][_0xe04d('0xa')]);_0x4090e0['offset']=qs[_0xe04d('0x8')](_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x8')]);}_0x4090e0[_0xe04d('0x31')]=qs[_0xe04d('0x32')](_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x32')]);_0x4090e0['where']=qs[_0xe04d('0x1e')](_[_0xe04d('0x33')](_0x4221aa[_0xe04d('0x1c')],_0x35a2b4[_0xe04d('0x1e')]),_0x399aa0);if(_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x34')]){_0x4090e0[_0xe04d('0x35')]=_[_0xe04d('0x36')](_0x4090e0[_0xe04d('0x35')],{'$or':_['map'](_0x399aa0,function(_0x151057){if(_0x151057['type']!==_0xe04d('0x37')){var _0x547f56={};_0x547f56[_0x151057['name']]={'$like':'%'+_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x34')]+'%'};return _0x547f56;}})});}_0x4090e0=_[_0xe04d('0x36')]({},_0x4090e0,_0x4221aa[_0xe04d('0x38')]);var _0x56e74d={'where':_0x4090e0[_0xe04d('0x35')]};return db[_0xe04d('0x39')][_0xe04d('0xb')](_0x56e74d)[_0xe04d('0x10')](function(_0x322228){_0x251772['count']=_0x322228;if(_0x4221aa['query'][_0xe04d('0x3a')]){_0x4090e0['include']=[{'all':!![]}];}return db['CmHopper'][_0xe04d('0x3b')](_0x4090e0);})[_0xe04d('0x10')](function(_0x3a7320){_0x251772[_0xe04d('0x3c')]=_0x3a7320;return _0x251772;})['then'](respondWithFilteredResult(_0x93b107,_0x4090e0))['catch'](handleError(_0x93b107,null));};exports[_0xe04d('0x3d')]=function(_0x164b3f,_0x8bb80a){var _0x148a1b={'raw':!![],'where':{'id':_0x164b3f[_0xe04d('0x3e')]['id']}},_0x3f215d={};_0x3f215d['model']=_[_0xe04d('0x3f')](db['CmHopper'][_0xe04d('0x17')]);_0x3f215d[_0xe04d('0x1c')]=_[_0xe04d('0x3f')](_0x164b3f[_0xe04d('0x1c')]);_0x3f215d[_0xe04d('0x1e')]=_[_0xe04d('0x1d')](_0x3f215d[_0xe04d('0x1b')],_0x3f215d[_0xe04d('0x1c')]);_0x148a1b['attributes']=_[_0xe04d('0x1d')](_0x3f215d[_0xe04d('0x1b')],qs['fields'](_0x164b3f[_0xe04d('0x1c')]['fields']));_0x148a1b[_0xe04d('0x2f')]=_0x148a1b[_0xe04d('0x2f')]['length']?_0x148a1b[_0xe04d('0x2f')]:_0x3f215d[_0xe04d('0x1b')];if(_0x164b3f[_0xe04d('0x1c')][_0xe04d('0x3a')]){_0x148a1b[_0xe04d('0x40')]=[{'all':!![]}];}_0x148a1b=_[_0xe04d('0x36')]({},_0x148a1b,_0x164b3f[_0xe04d('0x38')]);return db[_0xe04d('0x39')][_0xe04d('0x41')](_0x148a1b)['then'](handleEntityNotFound(_0x8bb80a,null))['then'](respondWithResult(_0x8bb80a,null))['catch'](handleError(_0x8bb80a,null));};exports[_0xe04d('0x42')]=function(_0x4bf286,_0x1868bb){return db[_0xe04d('0x39')][_0xe04d('0x42')](_0x4bf286[_0xe04d('0x43')],{})[_0xe04d('0x10')](respondWithResult(_0x1868bb,0xc9))[_0xe04d('0x44')](handleError(_0x1868bb,null));};exports['update']=function(_0x24d976,_0x3d20ac){if(_0x24d976['body']['id']){delete _0x24d976['body']['id'];}return db[_0xe04d('0x39')][_0xe04d('0x41')]({'where':{'id':_0x24d976['params']['id']}})[_0xe04d('0x10')](handleEntityNotFound(_0x3d20ac,null))['then'](saveUpdates(_0x24d976[_0xe04d('0x43')],null))[_0xe04d('0x10')](respondWithResult(_0x3d20ac,null))[_0xe04d('0x44')](handleError(_0x3d20ac,null));};exports[_0xe04d('0x45')]=function(_0xa9d536,_0x3ed027){return db[_0xe04d('0x39')][_0xe04d('0x45')]()[_0xe04d('0x10')](respondWithResult(_0x3ed027,null))[_0xe04d('0x44')](handleError(_0x3ed027,null));};exports['destroy']=function(_0x52f4c5,_0x35e4cb){var _0x4b8822;var _0x5c4e24=_0x52f4c5['params']['id'];return db[_0xe04d('0x39')][_0xe04d('0x41')]({'where':{'id':_0x52f4c5[_0xe04d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x35e4cb,null))['then'](function(_0x1b239a){if(_0x1b239a){return _0x1b239a[_0xe04d('0x46')]()['then'](function(_0x5a57d2){return _0x5a57d2;});}})[_0xe04d('0x10')](function(_0x5c6dda){_0x4b8822=_0x5c6dda;if(_0x5c6dda){if(_0x5c6dda[_0xe04d('0x47')]||_0x5c6dda[_0xe04d('0x48')]){return db[_0x5c6dda[_0xe04d('0x47')]?_0xe04d('0x49'):_0xe04d('0x4a')][_0xe04d('0x41')]({'where':{'id':_0x5c6dda[_0xe04d('0x47')]?_0x5c6dda[_0xe04d('0x47')]:_0x5c6dda['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xe04d('0x10')](function(_0x3fee58){var _0x3dd446={};if(_0x3fee58){_[_0xe04d('0x36')](_0x3dd446,_[_0xe04d('0x4b')](_0x4b8822['dataValues'],['createdAt',_0xe04d('0x4c'),'id']));_0x3dd446['state']=0x15;_0x3dd446['statedesc']=_0xe04d('0x4d');_0x3dd446['campaign']=_0x3fee58[_0xe04d('0x13')];_0x3dd446['membername']=_0x52f4c5[_0xe04d('0x4e')]['name'];_0x3dd446['UserId']=_0x52f4c5[_0xe04d('0x4e')]['id'];_0x3dd446[_0xe04d('0x4d')]=!![];_0x3dd446[_0xe04d('0x4f')]=moment()[_0xe04d('0x50')](_0xe04d('0x51'));_0x3dd446[_0xe04d('0x52')]=_0x4b8822[_0xe04d('0x53')];_0x3dd446[_0xe04d('0x54')]=_0x4b8822[_0xe04d('0x47')]?_0xe04d('0x55'):_0xe04d('0x56');return db['CmContact'][_0xe04d('0x41')]({'where':{'id':_0x3dd446[_0xe04d('0x57')]},'attributes':[_0xe04d('0x58'),'lastName']})[_0xe04d('0x10')](function(_0x48a753){if(!_[_0xe04d('0x59')](_0x35e4cb)&&!_[_0xe04d('0x59')](_0x48a753['firstName'])){_0x3dd446[_0xe04d('0x5a')]=_0x48a753[_0xe04d('0x58')];if(!_[_0xe04d('0x59')](_0x48a753['lastName'])){_0x3dd446[_0xe04d('0x5a')]+='\x20'+_0x48a753['lastName'];}}})[_0xe04d('0x5b')](function(){return db[_0xe04d('0x5c')][_0xe04d('0x42')](_0x3dd446);});}})[_0xe04d('0x10')](function(_0x5e6228){return db[_0xe04d('0x5d')]['destroy']({'where':{'CmHopperId':_0x5c4e24}});})[_0xe04d('0x10')](function(){return _0x35e4cb['status'](0xcc)[_0xe04d('0x5e')]();})[_0xe04d('0x44')](handleError(_0x35e4cb,null));};exports[_0xe04d('0x5f')]=function(_0x174143,_0x504fab){var _0x143909=[];return db['CmContact']['describe']()[_0xe04d('0x10')](function(_0x4195a1){_0x143909=_[_0xe04d('0x3f')](_0x4195a1);return _0x174143[_0xe04d('0x4e')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0xe04d('0x60')],'raw':!![]});})[_0xe04d('0x10')](function(_0x4972d4){if(_0x4972d4&&_0x4972d4[_0xe04d('0x61')]){return db[_0xe04d('0x62')][_0xe04d('0x63')](function(_0x129397){var _0x45eda3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe04d('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x4972d4,'id')},'$or':[{'UserId':null},{'UserId':_0x174143[_0xe04d('0x4e')]['id']}]};var _0x5870e3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4972d4)[_0xe04d('0x34')]([_0xe04d('0x60'),0x0])[_0xe04d('0x16')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x174143[_0xe04d('0x4e')]['id']}]};var _0x2434b4={'$or':[_0x45eda3,_0x5870e3]};var _0x143940=[];if(_0x174143[_0xe04d('0x43')][_0xe04d('0x64')]&&_0x174143[_0xe04d('0x43')][_0xe04d('0x64')]==='prev'){if(!_['isEmpty'](_0x174143[_0xe04d('0x43')][_0xe04d('0x65')])){_0x2434b4['id']={'$in':_0x174143[_0xe04d('0x43')][_0xe04d('0x65')]};}_0x143940=[['priority',_0xe04d('0x66')],[_0xe04d('0x67'),_0x4972d4[0x0][_0xe04d('0x68')]===_0xe04d('0x66')?'DESC':_0xe04d('0x66')],db[_0xe04d('0x62')]['literal'](_0xe04d('0x69')),['id',_0xe04d('0x6a')]];}else{if(!_[_0xe04d('0x6b')](_0x174143['body'][_0xe04d('0x65')])){_0x2434b4['id']={'$notIn':_0x174143[_0xe04d('0x43')][_0xe04d('0x65')]};}_0x143940=[[_0xe04d('0x6c'),_0xe04d('0x6a')],[_0xe04d('0x67'),_0x4972d4[0x0][_0xe04d('0x68')]],db[_0xe04d('0x62')][_0xe04d('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xe04d('0x66')]];}return db[_0xe04d('0x39')][_0xe04d('0x6e')]({'attributes':['id',_0xe04d('0x6f'),_0xe04d('0x53'),_0xe04d('0x70')],'where':_0x2434b4,'order':_0x143940,'transaction':_0x129397,'lock':_0x129397[_0xe04d('0x71')][_0xe04d('0x72')],'include':[{'model':db[_0xe04d('0x73')],'as':'Contact','attributes':_0x143909,'include':[{'model':db[_0xe04d('0x74')],'as':_0xe04d('0x75'),'attributes':['id','name']}]},{'model':db[_0xe04d('0x76')],'as':'List','attributes':['id','name']},{'model':db[_0xe04d('0x49')],'as':_0xe04d('0x77'),'attributes':['id',_0xe04d('0x13'),_0xe04d('0x78')]}]})[_0xe04d('0x10')](function(_0x5416f7){if(_0x5416f7){return _0x5416f7[_0xe04d('0xf')]({'UserId':_0x174143[_0xe04d('0x4e')]['id']},{'transaction':_0x129397});}});});}})['then'](handleEntityNotFound(_0x504fab,null))[_0xe04d('0x10')](respondWithResult(_0x504fab,null))['catch'](handleError(_0x504fab,null));};exports['getPreviewRecall']=function(_0x5f222e,_0x3370bf,_0x5a6d0d){var _0x18c3dc=[];var _0x58199f=_0x5f222e[_0xe04d('0x3e')]['id'];var _0x1d075e=_0x5f222e['user']['id'];return db[_0xe04d('0x73')]['describe']()[_0xe04d('0x10')](function(_0x5e2199){_0x18c3dc=_[_0xe04d('0x3f')](_0x5e2199);return db[_0xe04d('0x62')][_0xe04d('0x63')](function(_0x2a22c3){const _0xf49816={'id':_0x58199f};return db[_0xe04d('0x39')][_0xe04d('0x6e')]({'attributes':['id','scheduledat',_0xe04d('0x70')],'where':_0xf49816,'transaction':_0x2a22c3,'lock':_0x2a22c3['LOCK'][_0xe04d('0x72')],'include':[{'model':db[_0xe04d('0x73')],'as':'Contact','attributes':_0x18c3dc,'include':[{'model':db[_0xe04d('0x74')],'as':_0xe04d('0x75'),'attributes':['id',_0xe04d('0x13')]}]},{'model':db[_0xe04d('0x76')],'as':'List','attributes':['id',_0xe04d('0x13')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xe04d('0x13'),_0xe04d('0x78')]}]})[_0xe04d('0x10')](function(_0x2b68ad){if(_0x2b68ad){return _0x2b68ad[_0xe04d('0xf')]({'UserId':_0x1d075e},{'transaction':_0x2a22c3});}});});})[_0xe04d('0x10')](handleEntityNotFound(_0x3370bf,null))[_0xe04d('0x10')](respondWithResult(_0x3370bf,null))['catch'](handleError(_0x3370bf,null));};exports[_0xe04d('0x79')]=function(_0xc6d30e,_0x3727fe){return _0xc6d30e[_0xe04d('0x4e')][_0xe04d('0x7a')]({'where':{'type':_0xe04d('0x7b'),'dialActive':!![],'dialMethod':_0xe04d('0x7c')},'attributes':['id'],'raw':!![]})[_0xe04d('0x10')](function(_0x20cf56){if(_0x20cf56&&_0x20cf56[_0xe04d('0x61')]){return db[_0xe04d('0x39')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe04d('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe04d('0x16')](_0x20cf56,'id')},'$or':[{'UserId':null},{'UserId':_0xc6d30e[_0xe04d('0x4e')]['id']}]}});}return 0x0;})[_0xe04d('0x10')](function(_0x40e0a9){if(!_[_0xe04d('0x59')](_0x40e0a9)&&_['isNumber'](_0x40e0a9)){return _0x3727fe['status'](0xc8)['json']({'contacts':_0x40e0a9});}else{logger['error'](_0xe04d('0x7d'),'getOpenContacts',0x194,_0xe04d('0x7e'));_0x3727fe['sendStatus'](0x194);}})[_0xe04d('0x44')](handleError(_0x3727fe,null));};exports[_0xe04d('0x7f')]=function(_0x5c5a07,_0x1afeeb){var _0xbc81af=shared['timezones'];var _0x5cec62=[];_['map'](_0xbc81af,function(_0x4ea198){_0x5cec62[_0xe04d('0x80')]({'id':_0x4ea198[_0xe04d('0x13')],'name':_0x4ea198['name'],'utcOffset':_0x4ea198[_0xe04d('0x81')]});});return _0x1afeeb[_0xe04d('0x7')](0xc8)[_0xe04d('0xe')]({'tz':_0x5cec62});};exports[_0xe04d('0x82')]=function(_0x36d086,_0x4676d7){var _0x1140ec=shared['timezones'];var _0x770284={};if(!_['isNil'](_0x1140ec[_0x36d086['body']['id']]))_0x770284=_0x1140ec[_0x36d086[_0xe04d('0x43')]['id']];return _0x4676d7[_0xe04d('0x7')](0xc8)[_0xe04d('0xe')](_0x770284);}; \ No newline at end of file +var _0x79a8=['user','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ContactId','lastName','isNil','firstName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','VoiceQueue','Queue','dialActive','getPreviewRecall','transaction','recallme','List','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','offset','limit','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','key','model','query','intersection','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','count','rows','params','keys','includeAll','catch','create','body','find','describe','CampaignId','VoiceQueueId','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername'];(function(_0x1bd627,_0x5f45b0){var _0x37bac2=function(_0x101dca){while(--_0x101dca){_0x1bd627['push'](_0x1bd627['shift']());}};_0x37bac2(++_0x5f45b0);}(_0x79a8,0x1d0));var _0x879a=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0x79a8[_0x2ce9d];return _0x578428;};'use strict';var moment=require(_0x879a('0x0'));var _=require('lodash');var qs=require(_0x879a('0x1'));var logger=require(_0x879a('0x2'))(_0x879a('0x3'));var shared=require('../../config/environment');var db=require(_0x879a('0x4'))['db'];function respondWithResult(_0x49b7c0,_0x46ee67){_0x46ee67=_0x46ee67||0xc8;return function(_0x1fe9b2){if(_0x1fe9b2){return _0x49b7c0[_0x879a('0x5')](_0x46ee67)[_0x879a('0x6')](_0x1fe9b2);}};}function respondWithFilteredResult(_0x1808f1,_0x3cb89c){return function(_0x1d353e){if(_0x1d353e){var _0x2427bf=typeof _0x3cb89c['offset']===_0x879a('0x7')&&typeof _0x3cb89c['limit']===_0x879a('0x7');var _0x2182a3=_0x1d353e['count'];var _0x32f78d=_0x2427bf?0x0:_0x3cb89c[_0x879a('0x8')];var _0x832c07=_0x2427bf?_0x1d353e['count']:_0x3cb89c[_0x879a('0x8')]+_0x3cb89c[_0x879a('0x9')];var _0x4ce306;if(_0x832c07>=_0x2182a3){_0x832c07=_0x2182a3;_0x4ce306=0xc8;}else{_0x4ce306=0xce;}_0x1808f1['status'](_0x4ce306);return _0x1808f1[_0x879a('0xa')](_0x879a('0xb'),_0x32f78d+'-'+_0x832c07+'/'+_0x2182a3)[_0x879a('0x6')](_0x1d353e);}return null;};}function saveUpdates(_0x320115,_0x54a9b6){return function(_0x4738b4){if(_0x4738b4){return _0x4738b4[_0x879a('0xc')](_0x320115)[_0x879a('0xd')](function(_0x1ea66e){return _0x1ea66e;});}return null;};}function handleEntityNotFound(_0x1a20c5,_0x1c2853){return function(_0x461f1e){if(!_0x461f1e){_0x1a20c5[_0x879a('0xe')](0x194);}return _0x461f1e;};}function handleError(_0x1746b6,_0x16b649){_0x16b649=_0x16b649||0x1f4;return function(_0x5b4dbe){logger['error'](_0x5b4dbe[_0x879a('0xf')]);if(_0x5b4dbe[_0x879a('0x10')]){delete _0x5b4dbe['name'];}_0x1746b6[_0x879a('0x5')](_0x16b649)[_0x879a('0x11')](_0x5b4dbe);};}exports[_0x879a('0x12')]=function(_0x3d4462,_0x32d9f5){var _0x61427a={},_0x4160bd={},_0x849ec5={'count':0x0,'rows':[]};var _0x1ed368=_[_0x879a('0x13')](db[_0x879a('0x14')][_0x879a('0x15')],function(_0x18b3d2){return{'name':_0x18b3d2[_0x879a('0x16')],'type':_0x18b3d2['type'][_0x879a('0x17')]};});_0x4160bd[_0x879a('0x18')]=_['map'](_0x1ed368,_0x879a('0x10'));_0x4160bd[_0x879a('0x19')]=_['keys'](_0x3d4462['query']);_0x4160bd['filters']=_[_0x879a('0x1a')](_0x4160bd[_0x879a('0x18')],_0x4160bd[_0x879a('0x19')]);_0x4160bd[_0x879a('0x1b')]=_['concat'](_0x4160bd['filters'],[_0x879a('0x1c'),_0x879a('0x1d'),_0x879a('0x1e'),_0x879a('0x1f'),_0x879a('0x20'),_0x879a('0x21'),_0x879a('0x22'),_0x879a('0x23'),_0x879a('0x24'),_0x879a('0x25'),_0x879a('0x26'),_0x879a('0x27'),_0x879a('0x28'),'$like',_0x879a('0x29'),_0x879a('0x2a'),_0x879a('0x2b'),_0x879a('0x2c'),_0x879a('0x2d'),_0x879a('0x2e'),_0x879a('0x2f'),_0x879a('0x30')]);_0x61427a[_0x879a('0x31')]=_[_0x879a('0x1a')](_0x4160bd[_0x879a('0x18')],qs[_0x879a('0x32')](_0x3d4462[_0x879a('0x19')][_0x879a('0x32')]));_0x61427a[_0x879a('0x31')]=_0x61427a[_0x879a('0x31')][_0x879a('0x33')]?_0x61427a[_0x879a('0x31')]:_0x4160bd['model'];if(!_0x3d4462[_0x879a('0x19')]['hasOwnProperty'](_0x879a('0x34'))){_0x61427a[_0x879a('0x9')]=qs[_0x879a('0x9')](_0x3d4462['query'][_0x879a('0x9')]);_0x61427a['offset']=qs['offset'](_0x3d4462['query']['offset']);}_0x61427a[_0x879a('0x35')]=qs[_0x879a('0x36')](_0x3d4462['query'][_0x879a('0x36')]);_0x61427a[_0x879a('0x37')]=qs[_0x879a('0x1b')](_['pick'](_0x3d4462[_0x879a('0x19')],_0x4160bd[_0x879a('0x1b')]),_0x1ed368);if(_0x3d4462[_0x879a('0x19')][_0x879a('0x38')]){_0x61427a['where']=_[_0x879a('0x39')](_0x61427a[_0x879a('0x37')],{'$or':_[_0x879a('0x13')](_0x1ed368,function(_0x2f5cb8){if(_0x2f5cb8['type']!==_0x879a('0x3a')){var _0x4bbddc={};_0x4bbddc[_0x2f5cb8[_0x879a('0x10')]]={'$like':'%'+_0x3d4462['query'][_0x879a('0x38')]+'%'};return _0x4bbddc;}})});}_0x61427a=_[_0x879a('0x39')]({},_0x61427a,_0x3d4462['options']);var _0x2b80ee={'where':_0x61427a[_0x879a('0x37')]};return db[_0x879a('0x14')][_0x879a('0x3b')](_0x2b80ee)['then'](function(_0x26d0ee){_0x849ec5[_0x879a('0x3b')]=_0x26d0ee;if(_0x3d4462[_0x879a('0x19')]['includeAll']){_0x61427a['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x61427a);})['then'](function(_0x452558){_0x849ec5[_0x879a('0x3c')]=_0x452558;return _0x849ec5;})[_0x879a('0xd')](respondWithFilteredResult(_0x32d9f5,_0x61427a))['catch'](handleError(_0x32d9f5,null));};exports['show']=function(_0x4a047b,_0x44cff6){var _0x5597f9={'raw':!![],'where':{'id':_0x4a047b[_0x879a('0x3d')]['id']}},_0x3ecbe0={};_0x3ecbe0[_0x879a('0x18')]=_['keys'](db['CmHopper'][_0x879a('0x15')]);_0x3ecbe0['query']=_[_0x879a('0x3e')](_0x4a047b[_0x879a('0x19')]);_0x3ecbe0['filters']=_[_0x879a('0x1a')](_0x3ecbe0[_0x879a('0x18')],_0x3ecbe0[_0x879a('0x19')]);_0x5597f9['attributes']=_[_0x879a('0x1a')](_0x3ecbe0[_0x879a('0x18')],qs['fields'](_0x4a047b[_0x879a('0x19')][_0x879a('0x32')]));_0x5597f9['attributes']=_0x5597f9[_0x879a('0x31')][_0x879a('0x33')]?_0x5597f9[_0x879a('0x31')]:_0x3ecbe0[_0x879a('0x18')];if(_0x4a047b['query'][_0x879a('0x3f')]){_0x5597f9['include']=[{'all':!![]}];}_0x5597f9=_[_0x879a('0x39')]({},_0x5597f9,_0x4a047b['options']);return db[_0x879a('0x14')]['find'](_0x5597f9)[_0x879a('0xd')](handleEntityNotFound(_0x44cff6,null))[_0x879a('0xd')](respondWithResult(_0x44cff6,null))[_0x879a('0x40')](handleError(_0x44cff6,null));};exports[_0x879a('0x41')]=function(_0x1059ac,_0x3686b3){return db['CmHopper'][_0x879a('0x41')](_0x1059ac[_0x879a('0x42')],{})[_0x879a('0xd')](respondWithResult(_0x3686b3,0xc9))['catch'](handleError(_0x3686b3,null));};exports[_0x879a('0xc')]=function(_0x445d1f,_0x7f2d83){if(_0x445d1f['body']['id']){delete _0x445d1f[_0x879a('0x42')]['id'];}return db[_0x879a('0x14')][_0x879a('0x43')]({'where':{'id':_0x445d1f[_0x879a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x7f2d83,null))['then'](saveUpdates(_0x445d1f[_0x879a('0x42')],null))[_0x879a('0xd')](respondWithResult(_0x7f2d83,null))['catch'](handleError(_0x7f2d83,null));};exports[_0x879a('0x44')]=function(_0x4420ac,_0x48f92a){return db[_0x879a('0x14')][_0x879a('0x44')]()[_0x879a('0xd')](respondWithResult(_0x48f92a,null))[_0x879a('0x40')](handleError(_0x48f92a,null));};exports['destroy']=function(_0x3ffbe6,_0x32933f){var _0x2b1e44;var _0x51dc92=_0x3ffbe6['params']['id'];return db[_0x879a('0x14')][_0x879a('0x43')]({'where':{'id':_0x3ffbe6['params']['id']}})[_0x879a('0xd')](handleEntityNotFound(_0x32933f,null))[_0x879a('0xd')](function(_0x196d84){if(_0x196d84){return _0x196d84['destroy']()[_0x879a('0xd')](function(_0x677418){return _0x677418;});}})[_0x879a('0xd')](function(_0x2f7691){_0x2b1e44=_0x2f7691;if(_0x2f7691){if(_0x2f7691['VoiceQueueId']||_0x2f7691[_0x879a('0x45')]){return db[_0x2f7691[_0x879a('0x46')]?'VoiceQueue':_0x879a('0x47')][_0x879a('0x43')]({'where':{'id':_0x2f7691['VoiceQueueId']?_0x2f7691['VoiceQueueId']:_0x2f7691[_0x879a('0x45')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x1fe260){var _0x397e90={};if(_0x1fe260){_['merge'](_0x397e90,_[_0x879a('0x48')](_0x2b1e44[_0x879a('0x49')],[_0x879a('0x4a'),'updatedAt','id']));_0x397e90[_0x879a('0x4b')]=0x15;_0x397e90[_0x879a('0x4c')]=_0x879a('0x4d');_0x397e90[_0x879a('0x4e')]=_0x1fe260[_0x879a('0x10')];_0x397e90[_0x879a('0x4f')]=_0x3ffbe6[_0x879a('0x50')][_0x879a('0x10')];_0x397e90['UserId']=_0x3ffbe6[_0x879a('0x50')]['id'];_0x397e90[_0x879a('0x4d')]=!![];_0x397e90['deletedat']=moment()['format'](_0x879a('0x51'));_0x397e90['calleridnum']=_0x2b1e44[_0x879a('0x52')];_0x397e90[_0x879a('0x53')]=_0x2b1e44[_0x879a('0x46')]?_0x879a('0x54'):'ivr';return db['CmContact'][_0x879a('0x43')]({'where':{'id':_0x397e90[_0x879a('0x55')]},'attributes':['firstName',_0x879a('0x56')]})[_0x879a('0xd')](function(_0x1d7ab7){if(!_[_0x879a('0x57')](_0x32933f)&&!_['isNil'](_0x1d7ab7['firstName'])){_0x397e90['calleridname']=_0x1d7ab7[_0x879a('0x58')];if(!_[_0x879a('0x57')](_0x1d7ab7['lastName'])){_0x397e90['calleridname']+='\x20'+_0x1d7ab7[_0x879a('0x56')];}}})[_0x879a('0x59')](function(){return db[_0x879a('0x5a')][_0x879a('0x41')](_0x397e90);});}})['then'](function(_0x3cb80f){return db[_0x879a('0x5b')]['destroy']({'where':{'CmHopperId':_0x51dc92}});})['then'](function(){return _0x32933f[_0x879a('0x5')](0xcc)[_0x879a('0x5c')]();})['catch'](handleError(_0x32933f,null));};exports[_0x879a('0x5d')]=function(_0x1ee969,_0x47f7a1){var _0x3d05a8=[];return db[_0x879a('0x5e')][_0x879a('0x44')]()['then'](function(_0x37e79a){_0x3d05a8=_[_0x879a('0x3e')](_0x37e79a);return _0x1ee969[_0x879a('0x50')][_0x879a('0x5f')]({'where':{'type':_0x879a('0x60'),'dialActive':!![],'dialMethod':_0x879a('0x61')},'attributes':['id',_0x879a('0x62'),_0x879a('0x63')],'raw':!![]});})['then'](function(_0x14b751){if(_0x14b751&&_0x14b751[_0x879a('0x33')]){return db[_0x879a('0x64')]['transaction'](function(_0x4aeca5){var _0x197035={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x879a('0x65')](_0x879a('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x14b751,'id')},'$or':[{'UserId':null},{'UserId':_0x1ee969[_0x879a('0x50')]['id']}]};var _0x2885ae={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x14b751)[_0x879a('0x38')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x879a('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x1ee969['user']['id']}]};var _0x5bd8a7={'$or':[_0x197035,_0x2885ae]};var _0x46a2ac=[];if(_0x1ee969[_0x879a('0x42')][_0x879a('0x67')]&&_0x1ee969[_0x879a('0x42')]['direction']===_0x879a('0x68')){if(!_[_0x879a('0x69')](_0x1ee969[_0x879a('0x42')]['hopperIds'])){_0x5bd8a7['id']={'$in':_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')]};}_0x46a2ac=[['priority','ASC'],[_0x879a('0x6b'),_0x14b751[0x0][_0x879a('0x62')]===_0x879a('0x6c')?_0x879a('0x6d'):'ASC'],db[_0x879a('0x64')][_0x879a('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x879a('0x6d')]];}else{if(!_[_0x879a('0x69')](_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')])){_0x5bd8a7['id']={'$notIn':_0x1ee969[_0x879a('0x42')][_0x879a('0x6a')]};}_0x46a2ac=[[_0x879a('0x6f'),'DESC'],[_0x879a('0x6b'),_0x14b751[0x0]['dialOrderByScheduledAt']],db[_0x879a('0x64')][_0x879a('0x6e')](_0x879a('0x70')),['id',_0x879a('0x6c')]];}return db[_0x879a('0x14')][_0x879a('0x71')]({'attributes':['id',_0x879a('0x72'),_0x879a('0x52'),'recallme'],'where':_0x5bd8a7,'order':_0x46a2ac,'transaction':_0x4aeca5,'lock':_0x4aeca5[_0x879a('0x73')][_0x879a('0x74')],'include':[{'model':db[_0x879a('0x5e')],'as':_0x879a('0x75'),'attributes':_0x3d05a8,'include':[{'model':db[_0x879a('0x76')],'as':_0x879a('0x77'),'attributes':['id',_0x879a('0x10')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x879a('0x10')]},{'model':db[_0x879a('0x78')],'as':_0x879a('0x79'),'attributes':['id',_0x879a('0x10'),_0x879a('0x7a')]}]})['then'](function(_0x3ae266){if(_0x3ae266){return _0x3ae266[_0x879a('0xc')]({'UserId':_0x1ee969['user']['id']},{'transaction':_0x4aeca5});}});});}})[_0x879a('0xd')](handleEntityNotFound(_0x47f7a1,null))[_0x879a('0xd')](respondWithResult(_0x47f7a1,null))['catch'](handleError(_0x47f7a1,null));};exports[_0x879a('0x7b')]=function(_0x58db87,_0x307be0,_0x258ce2){var _0x528baf=[];var _0x4703d8=_0x58db87[_0x879a('0x3d')]['id'];var _0x33644f=_0x58db87['user']['id'];return db[_0x879a('0x5e')][_0x879a('0x44')]()[_0x879a('0xd')](function(_0x1ab184){_0x528baf=_[_0x879a('0x3e')](_0x1ab184);return db[_0x879a('0x64')][_0x879a('0x7c')](function(_0x59b327){const _0x4a10b1={'id':_0x4703d8};return db[_0x879a('0x14')][_0x879a('0x71')]({'attributes':['id',_0x879a('0x72'),_0x879a('0x7d')],'where':_0x4a10b1,'transaction':_0x59b327,'lock':_0x59b327[_0x879a('0x73')]['UPDATE'],'include':[{'model':db[_0x879a('0x5e')],'as':_0x879a('0x75'),'attributes':_0x528baf,'include':[{'model':db[_0x879a('0x76')],'as':_0x879a('0x77'),'attributes':['id',_0x879a('0x10')]}]},{'model':db['CmList'],'as':_0x879a('0x7e'),'attributes':['id',_0x879a('0x10')]},{'model':db[_0x879a('0x78')],'as':_0x879a('0x79'),'attributes':['id',_0x879a('0x10'),'dialActive']}]})['then'](function(_0x25d9b5){if(_0x25d9b5){return _0x25d9b5[_0x879a('0xc')]({'UserId':_0x33644f},{'transaction':_0x59b327});}});});})[_0x879a('0xd')](handleEntityNotFound(_0x307be0,null))[_0x879a('0xd')](respondWithResult(_0x307be0,null))[_0x879a('0x40')](handleError(_0x307be0,null));};exports[_0x879a('0x7f')]=function(_0xa497cb,_0x19b43a){return _0xa497cb[_0x879a('0x50')][_0x879a('0x5f')]({'where':{'type':_0x879a('0x60'),'dialActive':!![],'dialMethod':_0x879a('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x3bbe14){if(_0x3bbe14&&_0x3bbe14[_0x879a('0x33')]){return db[_0x879a('0x14')][_0x879a('0x3b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x879a('0x65')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x879a('0x13')](_0x3bbe14,'id')},'$or':[{'UserId':null},{'UserId':_0xa497cb['user']['id']}]}});}return 0x0;})[_0x879a('0xd')](function(_0x5d0f15){if(!_[_0x879a('0x57')](_0x5d0f15)&&_[_0x879a('0x80')](_0x5d0f15)){return _0x19b43a[_0x879a('0x5')](0xc8)['json']({'contacts':_0x5d0f15});}else{logger[_0x879a('0x81')](_0x879a('0x82'),_0x879a('0x7f'),0x194,'entity\x20not\x20found');_0x19b43a[_0x879a('0xe')](0x194);}})[_0x879a('0x40')](handleError(_0x19b43a,null));};exports[_0x879a('0x83')]=function(_0x289784,_0x4b5da3){var _0x607595=shared[_0x879a('0x84')];var _0x155a40=[];_[_0x879a('0x13')](_0x607595,function(_0x257d24){_0x155a40[_0x879a('0x85')]({'id':_0x257d24[_0x879a('0x10')],'name':_0x257d24[_0x879a('0x10')],'utcOffset':_0x257d24[_0x879a('0x86')]});});return _0x4b5da3[_0x879a('0x5')](0xc8)[_0x879a('0x6')]({'tz':_0x155a40});};exports[_0x879a('0x87')]=function(_0x377d42,_0x5a4163){var _0x3963e9=shared[_0x879a('0x84')];var _0x3301f4={};if(!_['isNil'](_0x3963e9[_0x377d42['body']['id']]))_0x3301f4=_0x3963e9[_0x377d42[_0x879a('0x42')]['id']];return _0x5a4163[_0x879a('0x5')](0xc8)['json'](_0x3301f4);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e72f24b..b352d13 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 _0x1883=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x27ce2f,_0x41b451){var _0x1ef90e=function(_0x4357d1){while(--_0x4357d1){_0x27ce2f['push'](_0x27ce2f['shift']());}};_0x1ef90e(++_0x41b451);}(_0x1883,0xab));var _0x3188=function(_0x20e51b,_0x3e9eb6){_0x20e51b=_0x20e51b-0x0;var _0x4e12a8=_0x1883[_0x20e51b];return _0x4e12a8;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['phone']},{'name':_0x3188('0x11'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['define','CmHopper','cm_hopper','scheduledat','priority','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xda19,0xd5));var _0x9da1=function(_0x22e271,_0x3bb5e1){_0x22e271=_0x22e271-0x0;var _0x14b267=_0xda19[_0x22e271];return _0x14b267;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0x9da1('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b681c6f..aa92670 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 _0xb051=['CmHopperFinal','create','CountReScheduled','literal','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','User','name','CmList','List','NOW()','lodash','util','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','info','debug','stringify','catch','error','message','find','then','ShowCmHopper','CreateCmHopper','UpdateCmHopper','update','body','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','UPDATE','Contact','keys','Agent','voicePause','length','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize'];(function(_0x4cc749,_0x18f22b){var _0x1ea7dc=function(_0x15a067){while(--_0x15a067){_0x4cc749['push'](_0x4cc749['shift']());}};_0x1ea7dc(++_0x18f22b);}(_0xb051,0x1ee));var _0x1b05=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0xb051[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0x1b05('0x0'));var util=require(_0x1b05('0x1'));var moment=require('moment');var BPromise=require(_0x1b05('0x2'));var db=require(_0x1b05('0x3'))['db'];var logger=require(_0x1b05('0x4'))('rpc');exports[_0x1b05('0x5')]=function(_0x1b7636){var _0x26aeec=this;return new Promise(function(_0x12538a,_0x143162){return db[_0x1b05('0x6')][_0x1b05('0x7')]({'raw':_0x1b7636[_0x1b05('0x8')]?_0x1b7636[_0x1b05('0x8')][_0x1b05('0x9')]===undefined?!![]:![]:!![],'where':_0x1b7636['options']?_0x1b7636[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'attributes':_0x1b7636[_0x1b05('0x8')]?_0x1b7636[_0x1b05('0x8')][_0x1b05('0xb')]||null:null,'limit':_0x1b7636[_0x1b05('0x8')]?_0x1b7636['options']['limit']||null:null,'include':_0x1b7636['options']?_0x1b7636[_0x1b05('0x8')]['include']?_['map'](_0x1b7636[_0x1b05('0x8')][_0x1b05('0xc')],function(_0x46d418){return{'model':db[_0x46d418[_0x1b05('0xd')]],'as':_0x46d418['as'],'attributes':_0x46d418[_0x1b05('0xb')],'include':_0x46d418[_0x1b05('0xc')]?_['map'](_0x46d418['include'],function(_0x3c696a){return{'model':db[_0x3c696a[_0x1b05('0xd')]],'as':_0x3c696a['as'],'attributes':_0x3c696a[_0x1b05('0xb')],'include':_0x3c696a[_0x1b05('0xc')]?_[_0x1b05('0xe')](_0x3c696a[_0x1b05('0xc')],function(_0x2b5a1f){return{'model':db[_0x2b5a1f[_0x1b05('0xd')]],'as':_0x2b5a1f['as'],'attributes':_0x2b5a1f[_0x1b05('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21dc0e){logger[_0x1b05('0xf')]('GetCmHopper',_0x1b7636);logger[_0x1b05('0x10')](_0x1b05('0x5'),_0x1b7636,JSON[_0x1b05('0x11')](_0x21dc0e));_0x12538a(_0x21dc0e);})[_0x1b05('0x12')](function(_0x44e778){logger[_0x1b05('0x13')](_0x1b05('0x5'),_0x44e778[_0x1b05('0x14')],_0x1b7636);_0x143162(_0x26aeec[_0x1b05('0x13')](0x1f4,_0x44e778[_0x1b05('0x14')]));});});};exports['ShowCmHopper']=function(_0xcc4328){var _0x1fdb57=this;return new Promise(function(_0x2a4d8b,_0x5012c6){return db[_0x1b05('0x6')][_0x1b05('0x15')]({'raw':_0xcc4328[_0x1b05('0x8')]?_0xcc4328[_0x1b05('0x8')][_0x1b05('0x9')]===undefined?!![]:![]:!![],'where':_0xcc4328[_0x1b05('0x8')]?_0xcc4328[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'attributes':_0xcc4328[_0x1b05('0x8')]?_0xcc4328[_0x1b05('0x8')][_0x1b05('0xb')]||null:null,'include':_0xcc4328[_0x1b05('0x8')]?_0xcc4328[_0x1b05('0x8')][_0x1b05('0xc')]?_[_0x1b05('0xe')](_0xcc4328[_0x1b05('0x8')][_0x1b05('0xc')],function(_0xe8b8c7){return{'model':db[_0xe8b8c7[_0x1b05('0xd')]],'as':_0xe8b8c7['as'],'attributes':_0xe8b8c7['attributes'],'include':_0xe8b8c7[_0x1b05('0xc')]?_[_0x1b05('0xe')](_0xe8b8c7[_0x1b05('0xc')],function(_0x3a80b8){return{'model':db[_0x3a80b8[_0x1b05('0xd')]],'as':_0x3a80b8['as'],'attributes':_0x3a80b8[_0x1b05('0xb')],'include':_0x3a80b8[_0x1b05('0xc')]?_['map'](_0x3a80b8[_0x1b05('0xc')],function(_0x2d3b97){return{'model':db[_0x2d3b97[_0x1b05('0xd')]],'as':_0x2d3b97['as'],'attributes':_0x2d3b97['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b05('0x16')](function(_0x180449){logger[_0x1b05('0xf')](_0x1b05('0x17'),_0xcc4328);logger[_0x1b05('0x10')]('ShowCmHopper',_0xcc4328,JSON['stringify'](_0x180449));_0x2a4d8b(_0x180449);})[_0x1b05('0x12')](function(_0x362096){logger[_0x1b05('0x13')]('ShowCmHopper',_0x362096[_0x1b05('0x14')],_0xcc4328);_0x5012c6(_0x1fdb57[_0x1b05('0x13')](0x1f4,_0x362096[_0x1b05('0x14')]));});});};exports[_0x1b05('0x18')]=function(_0x27626b){var _0x27b240=this;return new Promise(function(_0x4e434e,_0x592c68){return db['CmHopper']['create'](_0x27626b['body'],{'raw':_0x27626b[_0x1b05('0x8')]?_0x27626b[_0x1b05('0x8')]['raw']===undefined?!![]:![]:!![]})[_0x1b05('0x16')](function(_0x5171e5){logger[_0x1b05('0xf')](_0x1b05('0x18'),_0x27626b);logger[_0x1b05('0x10')](_0x1b05('0x18'),_0x27626b,JSON[_0x1b05('0x11')](_0x5171e5));_0x4e434e(_0x5171e5);})[_0x1b05('0x12')](function(_0x12f7b6){logger[_0x1b05('0x13')](_0x1b05('0x18'),_0x12f7b6['message'],_0x27626b);_0x592c68(_0x27b240[_0x1b05('0x13')](0x1f4,_0x12f7b6[_0x1b05('0x14')]));});});};exports[_0x1b05('0x19')]=function(_0x19d4cd){var _0x2d7e08=this;return new Promise(function(_0x18385b,_0x4285e7){return db[_0x1b05('0x6')][_0x1b05('0x1a')](_0x19d4cd[_0x1b05('0x1b')],{'raw':_0x19d4cd[_0x1b05('0x8')]?_0x19d4cd[_0x1b05('0x8')][_0x1b05('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d4cd[_0x1b05('0x8')]?_0x19d4cd[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'attributes':_0x19d4cd[_0x1b05('0x8')]?_0x19d4cd[_0x1b05('0x8')][_0x1b05('0xb')]||null:null,'limit':_0x19d4cd['options']?_0x19d4cd[_0x1b05('0x8')][_0x1b05('0x1c')]||null:null})['then'](function(_0x3512b9){logger[_0x1b05('0xf')]('UpdateCmHopper',_0x19d4cd);logger[_0x1b05('0xf')](_0x1b05('0x1d'),JSON['stringify'](_0x19d4cd[_0x1b05('0x8')][_0x1b05('0xa')]),_0x19d4cd[_0x1b05('0x1b')]['active']);logger[_0x1b05('0x10')](_0x1b05('0x19'),_0x19d4cd,JSON[_0x1b05('0x11')](_0x3512b9));_0x18385b(_0x3512b9);})[_0x1b05('0x12')](function(_0x11bbaf){logger[_0x1b05('0x13')](_0x1b05('0x19'),_0x11bbaf['message'],_0x19d4cd);_0x4285e7(_0x2d7e08['error'](0x1f4,_0x11bbaf[_0x1b05('0x14')]));});});};exports['DestroyCmHopper']=function(_0x28233e){var _0xdac232=this;return new Promise(function(_0xe17a0f,_0x498c6f){return db['CmHopper'][_0x1b05('0x1e')]({'where':_0x28233e['options']?_0x28233e['options'][_0x1b05('0xa')]||null:null})['then'](function(_0x14548f){logger[_0x1b05('0xf')]('DestroyCmHopper',_0x28233e);logger['debug'](_0x1b05('0x1f'),_0x28233e,JSON[_0x1b05('0x11')](_0x14548f));_0xe17a0f(_0x14548f);})[_0x1b05('0x12')](function(_0x396734){logger[_0x1b05('0x13')](_0x1b05('0x1f'),_0x396734['message'],_0x28233e);_0x498c6f(_0xdac232[_0x1b05('0x13')](0x1f4,_0x396734['message']));});});};exports[_0x1b05('0x20')]=function(_0x30cee2){var _0x32cbe8=this;return new Promise(function(_0x37dfb0,_0x627831){return db[_0x1b05('0x21')][_0x1b05('0x22')]()['then'](function(_0x9ab2bf){return db['sequelize'][_0x1b05('0x23')](function(_0x40152d){return db['CmHopper'][_0x1b05('0x7')]({'where':_0x30cee2[_0x1b05('0x8')]?_0x30cee2['options']['where']||null:null,'attributes':_0x30cee2[_0x1b05('0x8')]?_0x30cee2['options'][_0x1b05('0xb')]||null:null,'limit':_0x30cee2[_0x1b05('0x8')]?_0x30cee2[_0x1b05('0x8')][_0x1b05('0x1c')]||null:null,'order':_0x30cee2[_0x1b05('0x8')]?_0x30cee2[_0x1b05('0x8')][_0x1b05('0x24')]||null:null,'transaction':_0x40152d,'lock':_0x40152d['LOCK'][_0x1b05('0x25')],'include':[{'model':db['CmContact'],'as':_0x1b05('0x26'),'attributes':_[_0x1b05('0x27')](_0x9ab2bf)},{'model':db['User'],'as':_0x1b05('0x28'),'attributes':['id','name',_0x1b05('0x29')]}]})[_0x1b05('0x16')](function(_0xf3aa96){var _0x68c50f=[];var _0x2da52b=[];for(var _0x2fbc16=0x0;_0x2fbc16<_0xf3aa96[_0x1b05('0x2a')];_0x2fbc16+=0x1){var _0x2155a9=_0xf3aa96[_0x2fbc16]['UserId'];if(_0x2155a9===null){_0x68c50f['push'](_0xf3aa96[_0x2fbc16]['update'](_0x30cee2[_0x1b05('0x1b')],{'transaction':_0x40152d}));}else if(!_0x2da52b[_0x1b05('0x2b')](_0x2155a9)){_0x2da52b['push'](_0x2155a9);_0x68c50f[_0x1b05('0x2c')](_0xf3aa96[_0x2fbc16][_0x1b05('0x1a')](_0x30cee2[_0x1b05('0x1b')],{'transaction':_0x40152d}));}}return BPromise[_0x1b05('0x2d')](_0x68c50f);});})['then'](function(_0x83e9b8){logger['info'](_0x1b05('0x20'),_0x30cee2);if(_0x83e9b8[_0x1b05('0x2a')]>0x0){logger['info'](_0x1b05('0x2e'),_0x83e9b8[0x0][_0x1b05('0x2f')]['id'],_0x83e9b8[0x0][_0x1b05('0x2f')][_0x1b05('0x30')],_0x83e9b8[0x0][_0x1b05('0x2f')][_0x1b05('0x31')]);}logger[_0x1b05('0x10')](_0x1b05('0x20'),_0x30cee2,JSON[_0x1b05('0x11')](_0x83e9b8));_0x37dfb0(_0x83e9b8);})['catch'](function(_0x5db7a1){logger['error']('GetContactDialer',_0x5db7a1[_0x1b05('0x14')],_0x30cee2);_0x627831(_0x32cbe8[_0x1b05('0x13')](0x1f4,_0x5db7a1[_0x1b05('0x14')]));});});});};exports[_0x1b05('0x32')]=function(_0x5f23c2){var _0xac0225=this;return new Promise(function(_0xd2cd5d,_0x1d331d){return db[_0x1b05('0x33')][_0x1b05('0x23')](function(_0xada071){return db[_0x1b05('0x34')][_0x1b05('0x35')](_0x5f23c2[_0x1b05('0x1b')],{'raw':_0x5f23c2[_0x1b05('0x8')]?_0x5f23c2[_0x1b05('0x8')][_0x1b05('0x9')]===undefined?!![]:![]:!![],'transaction':_0xada071})[_0x1b05('0x16')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5f23c2[_0x1b05('0x8')][_0x1b05('0xa')]),_0x5f23c2[_0x1b05('0x8')]['where'][_0x1b05('0x31')]);return db[_0x1b05('0x6')][_0x1b05('0x1e')]({'where':_0x5f23c2[_0x1b05('0x8')]?_0x5f23c2[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'transaction':_0xada071});});})[_0x1b05('0x16')](function(_0x200bae){logger['info'](_0x1b05('0x32'),_0x5f23c2);logger[_0x1b05('0x10')](_0x1b05('0x32'),_0x5f23c2,JSON[_0x1b05('0x11')](_0x200bae));_0xd2cd5d(_0x200bae);})[_0x1b05('0x12')](function(_0x11665b){logger[_0x1b05('0x13')](_0x1b05('0x32'),_0x11665b[_0x1b05('0x14')],_0x5f23c2);_0x1d331d(_0xac0225[_0x1b05('0x13')](0x1f4,_0x11665b[_0x1b05('0x14')]));});});};exports[_0x1b05('0x36')]=function(_0x20717b){var _0x19566a=this;return new Promise(function(_0x1cc1f3,_0x1abbd9){return db[_0x1b05('0x6')][_0x1b05('0x7')]({'raw':_0x20717b[_0x1b05('0x8')]?_0x20717b['options'][_0x1b05('0x9')]===undefined?!![]:![]:!![],'where':_0x20717b[_0x1b05('0x8')]?_0x20717b[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'attributes':[[db[_0x1b05('0x33')]['fn']('COUNT',db[_0x1b05('0x33')]['fn']('IF',db['sequelize'][_0x1b05('0x37')]('`scheduledat`\x20>=\x20'+util[_0x1b05('0x38')](_0x1b05('0x39'),moment()[_0x1b05('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x1b05('0x3a')))),_0x1b05('0x3b')]]})[_0x1b05('0x16')](function(_0x41a285){logger[_0x1b05('0xf')](_0x1b05('0x36'),_0x20717b);logger['debug']('CountReScheduled',_0x20717b,JSON[_0x1b05('0x11')](_0x41a285));_0x1cc1f3(_0x41a285);})[_0x1b05('0x12')](function(_0x205374){logger['error'](_0x1b05('0x36'),_0x205374[_0x1b05('0x14')],_0x20717b);_0x1abbd9(_0x19566a[_0x1b05('0x13')](0x1f4,_0x205374[_0x1b05('0x14')]));});});};exports[_0x1b05('0x3c')]=function(_0x165407){var _0x3aac4d=this;return new Promise(function(_0x49ac7e,_0x5e645e){return db[_0x1b05('0x21')]['describe']()['then'](function(){return db[_0x1b05('0x33')]['transaction'](function(_0xf0568a){return db['CmHopper'][_0x1b05('0x7')]({'where':_0x165407[_0x1b05('0x8')]?_0x165407[_0x1b05('0x8')]['where']||null:null,'attributes':_0x165407[_0x1b05('0x8')]?_0x165407[_0x1b05('0x8')][_0x1b05('0xb')]||null:null,'limit':0x1,'order':_0x165407[_0x1b05('0x8')]?_0x165407[_0x1b05('0x8')]['order']||null:null,'group':db[_0x1b05('0x6')][_0x1b05('0x3d')],'transaction':_0xf0568a,'lock':_0xf0568a[_0x1b05('0x3e')]['UPDATE'],'include':_0x165407[_0x1b05('0x8')]?_0x165407['options'][_0x1b05('0xc')]?_['map'](_0x165407[_0x1b05('0x8')]['include'],function(_0x2674b7){return{'model':db[_0x2674b7['model']],'as':_0x2674b7['as'],'attributes':_0x2674b7['attributes'],'include':_0x2674b7[_0x1b05('0xc')]?_['map'](_0x2674b7[_0x1b05('0xc')],function(_0x438668){return{'model':db[_0x438668['model']],'as':_0x438668['as'],'attributes':_0x438668[_0x1b05('0xb')],'include':_0x438668[_0x1b05('0xc')]?_[_0x1b05('0xe')](_0x438668['include'],function(_0x2ad7b0){return{'model':db[_0x2ad7b0[_0x1b05('0xd')]],'as':_0x2ad7b0['as'],'attributes':_0x2ad7b0[_0x1b05('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40b024){var _0x10825b=[];for(var _0x573e0b=0x0;_0x573e0b<_0x40b024[_0x1b05('0x2a')];_0x573e0b+=0x1){_0x10825b[_0x1b05('0x2c')](_0x40b024[_0x573e0b][_0x1b05('0x1a')](_0x165407['body'],{'transaction':_0xf0568a}));}return BPromise[_0x1b05('0x2d')](_0x10825b);});})[_0x1b05('0x16')](function(_0x2248a3){logger[_0x1b05('0xf')](_0x1b05('0x3c'),_0x165407);logger[_0x1b05('0x10')](_0x1b05('0x3c'),_0x165407,JSON[_0x1b05('0x11')](_0x2248a3));_0x49ac7e(_0x2248a3);})[_0x1b05('0x12')](function(_0x4cfb76){logger['error'](_0x1b05('0x3c'),_0x4cfb76[_0x1b05('0x14')],_0x165407);_0x5e645e(_0x3aac4d[_0x1b05('0x13')](0x1f4,_0x4cfb76[_0x1b05('0x14')]));});});});};exports[_0x1b05('0x3f')]=function(_0x4185fd){var _0x5cb7cb=this;return new Promise(function(_0x2f07cb,_0x1d5f4b){db[_0x1b05('0x21')][_0x1b05('0x22')]()[_0x1b05('0x16')](function(_0x1bb6ab){return db[_0x1b05('0x6')][_0x1b05('0x7')]({'raw':_0x4185fd[_0x1b05('0x8')]?_0x4185fd['options'][_0x1b05('0x9')]===undefined?!![]:![]:!![],'where':_0x4185fd[_0x1b05('0x8')]?_0x4185fd[_0x1b05('0x8')][_0x1b05('0xa')]||null:null,'attributes':_0x4185fd['options']?_0x4185fd[_0x1b05('0x8')][_0x1b05('0xb')]||null:null,'limit':_0x4185fd[_0x1b05('0x8')]?_0x4185fd[_0x1b05('0x8')][_0x1b05('0x1c')]||null:null,'include':_0x4185fd[_0x1b05('0x8')]?_0x4185fd['options'][_0x1b05('0xc')]?_[_0x1b05('0xe')](_0x4185fd[_0x1b05('0x8')][_0x1b05('0xc')],function(_0x59ad60){return{'model':db[_0x59ad60['model']],'as':_0x59ad60['as'],'attributes':_0x59ad60['as']===_0x1b05('0x26')?_[_0x1b05('0x27')](_0x1bb6ab):_0x59ad60[_0x1b05('0xb')],'include':_0x59ad60[_0x1b05('0xc')]?_[_0x1b05('0xe')](_0x59ad60['include'],function(_0x1664df){return{'model':db[_0x1664df[_0x1b05('0xd')]],'as':_0x1664df['as'],'attributes':_0x1664df[_0x1b05('0xb')],'include':_0x1664df[_0x1b05('0xc')]?_[_0x1b05('0xe')](_0x1664df['include'],function(_0x4a6a09){return{'model':db[_0x4a6a09['model']],'as':_0x4a6a09['as'],'attributes':_0x4a6a09[_0x1b05('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1b05('0x16')](function(_0x1babff){logger[_0x1b05('0xf')](_0x1b05('0x5'),_0x4185fd);logger[_0x1b05('0x10')](_0x1b05('0x5'),_0x4185fd,JSON[_0x1b05('0x11')](_0x1babff));_0x2f07cb(_0x1babff);})[_0x1b05('0x12')](function(_0x1e8c6c){logger[_0x1b05('0x13')](_0x1b05('0x5'),_0x1e8c6c[_0x1b05('0x14')],_0x4185fd);_0x1d5f4b(_0x5cb7cb['error'](0x1f4,_0x1e8c6c[_0x1b05('0x14')]));});});});};exports[_0x1b05('0x40')]=function(_0x2278e7){var _0x671063=this;return new Promise(function(_0x199520,_0x122053){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x2278e7[_0x1b05('0x8')]['where'][_0x1b05('0x41')]},'attributes':['id',_0x1b05('0x42')],'order':[['id',_0x1b05('0x43')]]})[_0x1b05('0x16')](function(_0x2637d4){logger['info'](_0x1b05('0x44'),_0x2278e7);logger[_0x1b05('0x10')](_0x1b05('0x44'),_0x2278e7,JSON[_0x1b05('0x11')](_0x2637d4));_0x199520(_0x2637d4);})['catch'](function(_0x32f183){logger['error'](_0x1b05('0x44'),_0x32f183[_0x1b05('0x14')],_0x2278e7);_0x122053(_0x671063['error'](0x1f4,_0x32f183[_0x1b05('0x14')]));});});};exports['ResetActiveCalls']=function(_0xea2fde){var _0x59b72b=this;return new Promise(function(_0x3e8ae1,_0x1085ac){return db[_0x1b05('0x33')][_0x1b05('0x23')](function(_0x5bf83b){var _0x1bc03f=_0xea2fde[_0x1b05('0x8')]&&_0xea2fde[_0x1b05('0x8')][_0x1b05('0xa')]?_0xea2fde[_0x1b05('0x8')][_0x1b05('0xa')]:{};return db[_0x1b05('0x6')][_0x1b05('0x1a')](_0xea2fde[_0x1b05('0x1b')],{'where':_0x1bc03f,'transaction':_0x5bf83b})[_0x1b05('0x16')](function(_0x142bda){logger['info']('ResetActiveCalls',_0xea2fde);logger['debug'](_0x1b05('0x45'),_0xea2fde,JSON[_0x1b05('0x11')](_0x142bda));_0x3e8ae1(_0x142bda);})[_0x1b05('0x12')](function(_0x1ea151){logger[_0x1b05('0x13')]('ResetActiveCalls',_0x1ea151[_0x1b05('0x14')],_0xea2fde);_0x1085ac(_0x59b72b[_0x1b05('0x13')](0x1f4,_0x1ea151[_0x1b05('0x14')]));});});});};exports[_0x1b05('0x46')]=function(_0x238376){var _0x283044=this;var _0x28e820=_0x238376[_0x1b05('0x1b')][_0x1b05('0xa')][_0x1b05('0x47')];var _0x519bab=_0x238376[_0x1b05('0x1b')][_0x1b05('0xa')]['interval'];var _0x2a7cbb=_0x238376['body']['where'][_0x1b05('0x48')];return new Promise(function(_0x3c4d90,_0x532f55){return db[_0x1b05('0x6')][_0x1b05('0x7')]({'where':{'voiceQueueId':{'$in':_0x28e820},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1b05('0x33')][_0x1b05('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x519bab+'\x20MINUTE'),'$gt':db[_0x1b05('0x33')]['literal']('NOW()')}},'UserId':{'$in':_0x2a7cbb}},'include':[{'model':db[_0x1b05('0x21')],'as':_0x1b05('0x26')},{'model':db[_0x1b05('0x49')],'as':_0x1b05('0x28'),'attributes':['id',_0x1b05('0x4a'),'voicePause']},{'model':db[_0x1b05('0x4b')],'as':_0x1b05('0x4c')}]})[_0x1b05('0x16')](function(_0x441b63){if(_0x441b63['length']>0x0){return db[_0x1b05('0x33')][_0x1b05('0x23')](function(_0x336ac7){return db['CmHopper'][_0x1b05('0x1a')]({'recallmeNotifiedDate':db[_0x1b05('0x33')][_0x1b05('0x37')](_0x1b05('0x4d'))},{'where':{'id':{'$in':_[_0x1b05('0xe')](_0x441b63,'id')}},'transaction':_0x336ac7})[_0x1b05('0x16')](function(){_0x3c4d90(_0x441b63);})['catch'](function(_0x54bd4e){logger[_0x1b05('0x13')](_0x1b05('0x46'),_0x54bd4e[_0x1b05('0x14')],_0x238376);_0x532f55(_0x283044[_0x1b05('0x13')](0x1f4,_0x54bd4e[_0x1b05('0x14')]));});})[_0x1b05('0x12')](function(_0x133d88){logger[_0x1b05('0x13')](_0x1b05('0x46'),_0x133d88[_0x1b05('0x14')],_0x238376);_0x532f55(_0x283044[_0x1b05('0x13')](0x1f4,_0x133d88[_0x1b05('0x14')]));});}else{_0x3c4d90(_0x441b63);}});});}; \ No newline at end of file +var _0x1f6e=['map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','CreateCmHopper','UpdateCmHopper','update','body','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','Contact','keys','Agent','name','voicePause','length','UserId','push','includes','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','CmList','List','NOW()','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','findAll','options','raw','where','attributes','limit','include'];(function(_0x4af883,_0x3f26dc){var _0x5288b7=function(_0x5e0adb){while(--_0x5e0adb){_0x4af883['push'](_0x4af883['shift']());}};_0x5288b7(++_0x3f26dc);}(_0x1f6e,0xd8));var _0xe1f6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f6e[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1f6('0x0'));var BPromise=require(_0xe1f6('0x1'));var db=require(_0xe1f6('0x2'))['db'];var logger=require(_0xe1f6('0x3'))('rpc');exports[_0xe1f6('0x4')]=function(_0x52010d){var _0x55f04c=this;return new Promise(function(_0x204fde,_0xc101c0){return db['CmHopper'][_0xe1f6('0x5')]({'raw':_0x52010d['options']?_0x52010d[_0xe1f6('0x6')][_0xe1f6('0x7')]===undefined?!![]:![]:!![],'where':_0x52010d[_0xe1f6('0x6')]?_0x52010d[_0xe1f6('0x6')][_0xe1f6('0x8')]||null:null,'attributes':_0x52010d[_0xe1f6('0x6')]?_0x52010d[_0xe1f6('0x6')][_0xe1f6('0x9')]||null:null,'limit':_0x52010d['options']?_0x52010d[_0xe1f6('0x6')][_0xe1f6('0xa')]||null:null,'include':_0x52010d[_0xe1f6('0x6')]?_0x52010d[_0xe1f6('0x6')][_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x52010d[_0xe1f6('0x6')]['include'],function(_0x1ebc80){return{'model':db[_0x1ebc80[_0xe1f6('0xd')]],'as':_0x1ebc80['as'],'attributes':_0x1ebc80[_0xe1f6('0x9')],'include':_0x1ebc80[_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x1ebc80[_0xe1f6('0xb')],function(_0x2085bf){return{'model':db[_0x2085bf['model']],'as':_0x2085bf['as'],'attributes':_0x2085bf[_0xe1f6('0x9')],'include':_0x2085bf[_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x2085bf[_0xe1f6('0xb')],function(_0x6122cb){return{'model':db[_0x6122cb[_0xe1f6('0xd')]],'as':_0x6122cb['as'],'attributes':_0x6122cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1f6('0xe')](function(_0x9183cc){logger[_0xe1f6('0xf')](_0xe1f6('0x4'),_0x52010d);logger[_0xe1f6('0x10')](_0xe1f6('0x4'),_0x52010d,JSON[_0xe1f6('0x11')](_0x9183cc));_0x204fde(_0x9183cc);})[_0xe1f6('0x12')](function(_0x1fa32f){logger[_0xe1f6('0x13')](_0xe1f6('0x4'),_0x1fa32f[_0xe1f6('0x14')],_0x52010d);_0xc101c0(_0x55f04c[_0xe1f6('0x13')](0x1f4,_0x1fa32f[_0xe1f6('0x14')]));});});};exports[_0xe1f6('0x15')]=function(_0xc09166){var _0x614ced=this;return new Promise(function(_0xdede0c,_0x21b93e){return db[_0xe1f6('0x16')][_0xe1f6('0x17')]({'raw':_0xc09166[_0xe1f6('0x6')]?_0xc09166[_0xe1f6('0x6')][_0xe1f6('0x7')]===undefined?!![]:![]:!![],'where':_0xc09166['options']?_0xc09166[_0xe1f6('0x6')][_0xe1f6('0x8')]||null:null,'attributes':_0xc09166['options']?_0xc09166[_0xe1f6('0x6')]['attributes']||null:null,'include':_0xc09166['options']?_0xc09166[_0xe1f6('0x6')]['include']?_['map'](_0xc09166['options'][_0xe1f6('0xb')],function(_0x482114){return{'model':db[_0x482114[_0xe1f6('0xd')]],'as':_0x482114['as'],'attributes':_0x482114[_0xe1f6('0x9')],'include':_0x482114[_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x482114[_0xe1f6('0xb')],function(_0x5c15c2){return{'model':db[_0x5c15c2[_0xe1f6('0xd')]],'as':_0x5c15c2['as'],'attributes':_0x5c15c2[_0xe1f6('0x9')],'include':_0x5c15c2[_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x5c15c2['include'],function(_0x37049d){return{'model':db[_0x37049d[_0xe1f6('0xd')]],'as':_0x37049d['as'],'attributes':_0x37049d[_0xe1f6('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x507198){logger[_0xe1f6('0xf')](_0xe1f6('0x15'),_0xc09166);logger[_0xe1f6('0x10')](_0xe1f6('0x15'),_0xc09166,JSON['stringify'](_0x507198));_0xdede0c(_0x507198);})['catch'](function(_0x15ff76){logger[_0xe1f6('0x13')](_0xe1f6('0x15'),_0x15ff76['message'],_0xc09166);_0x21b93e(_0x614ced[_0xe1f6('0x13')](0x1f4,_0x15ff76['message']));});});};exports[_0xe1f6('0x18')]=function(_0xd6a1b6){var _0x5b122b=this;return new Promise(function(_0x4acaa9,_0x31bc24){return db[_0xe1f6('0x16')]['create'](_0xd6a1b6['body'],{'raw':_0xd6a1b6[_0xe1f6('0x6')]?_0xd6a1b6[_0xe1f6('0x6')][_0xe1f6('0x7')]===undefined?!![]:![]:!![]})['then'](function(_0x52c6e0){logger[_0xe1f6('0xf')](_0xe1f6('0x18'),_0xd6a1b6);logger[_0xe1f6('0x10')]('CreateCmHopper',_0xd6a1b6,JSON[_0xe1f6('0x11')](_0x52c6e0));_0x4acaa9(_0x52c6e0);})[_0xe1f6('0x12')](function(_0x407338){logger[_0xe1f6('0x13')](_0xe1f6('0x18'),_0x407338[_0xe1f6('0x14')],_0xd6a1b6);_0x31bc24(_0x5b122b[_0xe1f6('0x13')](0x1f4,_0x407338[_0xe1f6('0x14')]));});});};exports[_0xe1f6('0x19')]=function(_0x34b63d){var _0x5d860b=this;return new Promise(function(_0x3f6e06,_0x3de1bd){return db[_0xe1f6('0x16')][_0xe1f6('0x1a')](_0x34b63d[_0xe1f6('0x1b')],{'raw':_0x34b63d['options']?_0x34b63d[_0xe1f6('0x6')][_0xe1f6('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b63d['options']?_0x34b63d[_0xe1f6('0x6')]['where']||null:null,'attributes':_0x34b63d[_0xe1f6('0x6')]?_0x34b63d['options'][_0xe1f6('0x9')]||null:null,'limit':_0x34b63d[_0xe1f6('0x6')]?_0x34b63d[_0xe1f6('0x6')][_0xe1f6('0xa')]||null:null})[_0xe1f6('0xe')](function(_0x2a60f4){logger[_0xe1f6('0xf')](_0xe1f6('0x19'),_0x34b63d);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xe1f6('0x11')](_0x34b63d[_0xe1f6('0x6')]['where']),_0x34b63d[_0xe1f6('0x1b')][_0xe1f6('0x1c')]);logger[_0xe1f6('0x10')](_0xe1f6('0x19'),_0x34b63d,JSON[_0xe1f6('0x11')](_0x2a60f4));_0x3f6e06(_0x2a60f4);})[_0xe1f6('0x12')](function(_0x49f2cd){logger[_0xe1f6('0x13')](_0xe1f6('0x19'),_0x49f2cd[_0xe1f6('0x14')],_0x34b63d);_0x3de1bd(_0x5d860b[_0xe1f6('0x13')](0x1f4,_0x49f2cd[_0xe1f6('0x14')]));});});};exports['DestroyCmHopper']=function(_0x2bd01b){var _0x4a2c96=this;return new Promise(function(_0x17211f,_0x4cafd3){return db['CmHopper']['destroy']({'where':_0x2bd01b[_0xe1f6('0x6')]?_0x2bd01b[_0xe1f6('0x6')]['where']||null:null})[_0xe1f6('0xe')](function(_0x34db82){logger[_0xe1f6('0xf')](_0xe1f6('0x1d'),_0x2bd01b);logger[_0xe1f6('0x10')](_0xe1f6('0x1d'),_0x2bd01b,JSON[_0xe1f6('0x11')](_0x34db82));_0x17211f(_0x34db82);})[_0xe1f6('0x12')](function(_0x513d8b){logger[_0xe1f6('0x13')](_0xe1f6('0x1d'),_0x513d8b['message'],_0x2bd01b);_0x4cafd3(_0x4a2c96[_0xe1f6('0x13')](0x1f4,_0x513d8b['message']));});});};exports[_0xe1f6('0x1e')]=function(_0x565491){var _0x40a712=this;return new Promise(function(_0x2c00bb,_0x471162){return db[_0xe1f6('0x1f')][_0xe1f6('0x20')]()[_0xe1f6('0xe')](function(_0x3fa613){return db[_0xe1f6('0x21')][_0xe1f6('0x22')](function(_0x237e0a){return db[_0xe1f6('0x16')][_0xe1f6('0x5')]({'where':_0x565491[_0xe1f6('0x6')]?_0x565491['options']['where']||null:null,'attributes':_0x565491[_0xe1f6('0x6')]?_0x565491[_0xe1f6('0x6')][_0xe1f6('0x9')]||null:null,'limit':_0x565491[_0xe1f6('0x6')]?_0x565491[_0xe1f6('0x6')][_0xe1f6('0xa')]||null:null,'order':_0x565491[_0xe1f6('0x6')]?_0x565491[_0xe1f6('0x6')]['order']||null:null,'transaction':_0x237e0a,'lock':_0x237e0a[_0xe1f6('0x23')]['UPDATE'],'include':[{'model':db[_0xe1f6('0x1f')],'as':_0xe1f6('0x24'),'attributes':_[_0xe1f6('0x25')](_0x3fa613)},{'model':db['User'],'as':_0xe1f6('0x26'),'attributes':['id',_0xe1f6('0x27'),_0xe1f6('0x28')]}]})[_0xe1f6('0xe')](function(_0x2622fd){var _0x48bf04=[];var _0x598300=[];for(var _0x8402aa=0x0;_0x8402aa<_0x2622fd[_0xe1f6('0x29')];_0x8402aa+=0x1){var _0x218d58=_0x2622fd[_0x8402aa][_0xe1f6('0x2a')];if(_0x218d58===null){_0x48bf04[_0xe1f6('0x2b')](_0x2622fd[_0x8402aa][_0xe1f6('0x1a')](_0x565491[_0xe1f6('0x1b')],{'transaction':_0x237e0a}));}else if(!_0x598300[_0xe1f6('0x2c')](_0x218d58)){_0x598300[_0xe1f6('0x2b')](_0x218d58);_0x48bf04[_0xe1f6('0x2b')](_0x2622fd[_0x8402aa][_0xe1f6('0x1a')](_0x565491[_0xe1f6('0x1b')],{'transaction':_0x237e0a}));}}return BPromise[_0xe1f6('0x2d')](_0x48bf04);});})['then'](function(_0x54299a){logger[_0xe1f6('0xf')](_0xe1f6('0x1e'),_0x565491);if(_0x54299a[_0xe1f6('0x29')]>0x0){logger[_0xe1f6('0xf')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x54299a[0x0][_0xe1f6('0x2e')]['id'],_0x54299a[0x0][_0xe1f6('0x2e')][_0xe1f6('0x2f')],_0x54299a[0x0][_0xe1f6('0x2e')][_0xe1f6('0x1c')]);}logger[_0xe1f6('0x10')](_0xe1f6('0x1e'),_0x565491,JSON[_0xe1f6('0x11')](_0x54299a));_0x2c00bb(_0x54299a);})[_0xe1f6('0x12')](function(_0x1646b6){logger[_0xe1f6('0x13')]('GetContactDialer',_0x1646b6[_0xe1f6('0x14')],_0x565491);_0x471162(_0x40a712[_0xe1f6('0x13')](0x1f4,_0x1646b6[_0xe1f6('0x14')]));});});});};exports[_0xe1f6('0x30')]=function(_0x5a391f){var _0x1cfb13=this;return new Promise(function(_0x51ac92,_0x28adb3){return db['sequelize'][_0xe1f6('0x22')](function(_0x2b9d19){return db[_0xe1f6('0x31')]['create'](_0x5a391f[_0xe1f6('0x1b')],{'raw':_0x5a391f[_0xe1f6('0x6')]?_0x5a391f['options'][_0xe1f6('0x7')]===undefined?!![]:![]:!![],'transaction':_0x2b9d19})[_0xe1f6('0xe')](function(){logger[_0xe1f6('0xf')](_0xe1f6('0x32'),JSON['stringify'](_0x5a391f[_0xe1f6('0x6')][_0xe1f6('0x8')]),_0x5a391f[_0xe1f6('0x6')][_0xe1f6('0x8')][_0xe1f6('0x1c')]);return db[_0xe1f6('0x16')][_0xe1f6('0x33')]({'where':_0x5a391f[_0xe1f6('0x6')]?_0x5a391f['options'][_0xe1f6('0x8')]||null:null,'transaction':_0x2b9d19});});})[_0xe1f6('0xe')](function(_0x2cb3ea){logger[_0xe1f6('0xf')]('MoveContactManagedDialer',_0x5a391f);logger[_0xe1f6('0x10')](_0xe1f6('0x30'),_0x5a391f,JSON['stringify'](_0x2cb3ea));_0x51ac92(_0x2cb3ea);})['catch'](function(_0x37f5db){logger[_0xe1f6('0x13')](_0xe1f6('0x30'),_0x37f5db[_0xe1f6('0x14')],_0x5a391f);_0x28adb3(_0x1cfb13['error'](0x1f4,_0x37f5db[_0xe1f6('0x14')]));});});};exports[_0xe1f6('0x34')]=function(_0x870ee2){var _0x29883a=this;return new Promise(function(_0x377885,_0x4b9966){return db['CmHopper']['findAll']({'raw':_0x870ee2[_0xe1f6('0x6')]?_0x870ee2[_0xe1f6('0x6')][_0xe1f6('0x7')]===undefined?!![]:![]:!![],'where':_0x870ee2[_0xe1f6('0x6')]?_0x870ee2[_0xe1f6('0x6')][_0xe1f6('0x8')]||null:null,'attributes':[[db[_0xe1f6('0x21')]['fn'](_0xe1f6('0x35'),db[_0xe1f6('0x21')]['fn']('IF',db[_0xe1f6('0x21')][_0xe1f6('0x36')]('`scheduledat`\x20>=\x20'+util[_0xe1f6('0x37')](_0xe1f6('0x38'),moment()[_0xe1f6('0x37')](_0xe1f6('0x39')))+_0xe1f6('0x3a')))),_0xe1f6('0x3b')]]})[_0xe1f6('0xe')](function(_0xe3c9db){logger[_0xe1f6('0xf')](_0xe1f6('0x34'),_0x870ee2);logger[_0xe1f6('0x10')]('CountReScheduled',_0x870ee2,JSON['stringify'](_0xe3c9db));_0x377885(_0xe3c9db);})[_0xe1f6('0x12')](function(_0x565a70){logger[_0xe1f6('0x13')](_0xe1f6('0x34'),_0x565a70[_0xe1f6('0x14')],_0x870ee2);_0x4b9966(_0x29883a[_0xe1f6('0x13')](0x1f4,_0x565a70[_0xe1f6('0x14')]));});});};exports[_0xe1f6('0x3c')]=function(_0x451e6b){var _0x3434fd=this;return new Promise(function(_0x14ef3d,_0x3e5f05){return db[_0xe1f6('0x1f')][_0xe1f6('0x20')]()[_0xe1f6('0xe')](function(){return db[_0xe1f6('0x21')]['transaction'](function(_0x249775){return db['CmHopper'][_0xe1f6('0x5')]({'where':_0x451e6b[_0xe1f6('0x6')]?_0x451e6b[_0xe1f6('0x6')][_0xe1f6('0x8')]||null:null,'attributes':_0x451e6b[_0xe1f6('0x6')]?_0x451e6b[_0xe1f6('0x6')][_0xe1f6('0x9')]||null:null,'limit':0x1,'order':_0x451e6b['options']?_0x451e6b[_0xe1f6('0x6')][_0xe1f6('0x3d')]||null:null,'group':db[_0xe1f6('0x16')][_0xe1f6('0x2a')],'transaction':_0x249775,'lock':_0x249775[_0xe1f6('0x23')]['UPDATE'],'include':_0x451e6b[_0xe1f6('0x6')]?_0x451e6b[_0xe1f6('0x6')][_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x451e6b[_0xe1f6('0x6')][_0xe1f6('0xb')],function(_0x286280){return{'model':db[_0x286280[_0xe1f6('0xd')]],'as':_0x286280['as'],'attributes':_0x286280[_0xe1f6('0x9')],'include':_0x286280[_0xe1f6('0xb')]?_['map'](_0x286280[_0xe1f6('0xb')],function(_0x96ce1c){return{'model':db[_0x96ce1c[_0xe1f6('0xd')]],'as':_0x96ce1c['as'],'attributes':_0x96ce1c['attributes'],'include':_0x96ce1c['include']?_[_0xe1f6('0xc')](_0x96ce1c[_0xe1f6('0xb')],function(_0x47fe74){return{'model':db[_0x47fe74[_0xe1f6('0xd')]],'as':_0x47fe74['as'],'attributes':_0x47fe74['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1f6('0xe')](function(_0x2d4cac){var _0x104ff2=[];for(var _0x6ab78a=0x0;_0x6ab78a<_0x2d4cac[_0xe1f6('0x29')];_0x6ab78a+=0x1){_0x104ff2[_0xe1f6('0x2b')](_0x2d4cac[_0x6ab78a][_0xe1f6('0x1a')](_0x451e6b[_0xe1f6('0x1b')],{'transaction':_0x249775}));}return BPromise['all'](_0x104ff2);});})[_0xe1f6('0xe')](function(_0x591f88){logger[_0xe1f6('0xf')](_0xe1f6('0x3c'),_0x451e6b);logger[_0xe1f6('0x10')](_0xe1f6('0x3c'),_0x451e6b,JSON[_0xe1f6('0x11')](_0x591f88));_0x14ef3d(_0x591f88);})[_0xe1f6('0x12')](function(_0x38f409){logger['error']('GetContactRecallMe',_0x38f409[_0xe1f6('0x14')],_0x451e6b);_0x3e5f05(_0x3434fd[_0xe1f6('0x13')](0x1f4,_0x38f409[_0xe1f6('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x38f31e){var _0x57b9e2=this;return new Promise(function(_0x16acaf,_0x5ecfa6){db[_0xe1f6('0x1f')][_0xe1f6('0x20')]()['then'](function(_0x1ae57c){return db[_0xe1f6('0x16')][_0xe1f6('0x5')]({'raw':_0x38f31e[_0xe1f6('0x6')]?_0x38f31e[_0xe1f6('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x38f31e[_0xe1f6('0x6')]?_0x38f31e[_0xe1f6('0x6')]['where']||null:null,'attributes':_0x38f31e['options']?_0x38f31e[_0xe1f6('0x6')]['attributes']||null:null,'limit':_0x38f31e[_0xe1f6('0x6')]?_0x38f31e[_0xe1f6('0x6')][_0xe1f6('0xa')]||null:null,'include':_0x38f31e[_0xe1f6('0x6')]?_0x38f31e[_0xe1f6('0x6')][_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x38f31e['options']['include'],function(_0x4dc5ae){return{'model':db[_0x4dc5ae[_0xe1f6('0xd')]],'as':_0x4dc5ae['as'],'attributes':_0x4dc5ae['as']===_0xe1f6('0x24')?_[_0xe1f6('0x25')](_0x1ae57c):_0x4dc5ae['attributes'],'include':_0x4dc5ae['include']?_[_0xe1f6('0xc')](_0x4dc5ae[_0xe1f6('0xb')],function(_0x179717){return{'model':db[_0x179717[_0xe1f6('0xd')]],'as':_0x179717['as'],'attributes':_0x179717['attributes'],'include':_0x179717[_0xe1f6('0xb')]?_[_0xe1f6('0xc')](_0x179717[_0xe1f6('0xb')],function(_0x224a92){return{'model':db[_0x224a92[_0xe1f6('0xd')]],'as':_0x224a92['as'],'attributes':_0x224a92[_0xe1f6('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x485ed4){logger[_0xe1f6('0xf')](_0xe1f6('0x4'),_0x38f31e);logger[_0xe1f6('0x10')](_0xe1f6('0x4'),_0x38f31e,JSON['stringify'](_0x485ed4));_0x16acaf(_0x485ed4);})[_0xe1f6('0x12')](function(_0x8925e0){logger['error'](_0xe1f6('0x4'),_0x8925e0['message'],_0x38f31e);_0x5ecfa6(_0x57b9e2[_0xe1f6('0x13')](0x1f4,_0x8925e0['message']));});});});};exports['GetContactByPhone']=function(_0x34d36d){var _0x23e7d1=this;return new Promise(function(_0x1195d3,_0x13f763){return db['CmContact'][_0xe1f6('0x3e')]({'raw':!![],'where':{'phone':_0x34d36d[_0xe1f6('0x6')][_0xe1f6('0x8')][_0xe1f6('0x3f')]},'attributes':['id',_0xe1f6('0x40')],'order':[['id','DESC']]})[_0xe1f6('0xe')](function(_0x492a4d){logger[_0xe1f6('0xf')](_0xe1f6('0x41'),_0x34d36d);logger[_0xe1f6('0x10')](_0xe1f6('0x41'),_0x34d36d,JSON[_0xe1f6('0x11')](_0x492a4d));_0x1195d3(_0x492a4d);})[_0xe1f6('0x12')](function(_0x38d6d6){logger['error'](_0xe1f6('0x41'),_0x38d6d6['message'],_0x34d36d);_0x13f763(_0x23e7d1[_0xe1f6('0x13')](0x1f4,_0x38d6d6[_0xe1f6('0x14')]));});});};exports[_0xe1f6('0x42')]=function(_0x4fccf9){var _0x1aabab=this;return new Promise(function(_0x1edff4,_0x44634e){return db[_0xe1f6('0x21')]['transaction'](function(_0x43a096){var _0x40c97a=_0x4fccf9[_0xe1f6('0x6')]&&_0x4fccf9['options'][_0xe1f6('0x8')]?_0x4fccf9[_0xe1f6('0x6')]['where']:{};return db['CmHopper'][_0xe1f6('0x1a')](_0x4fccf9['body'],{'where':_0x40c97a,'transaction':_0x43a096})[_0xe1f6('0xe')](function(_0x57cadc){logger[_0xe1f6('0xf')]('ResetActiveCalls',_0x4fccf9);logger['debug'](_0xe1f6('0x42'),_0x4fccf9,JSON['stringify'](_0x57cadc));_0x1edff4(_0x57cadc);})[_0xe1f6('0x12')](function(_0x4cb597){logger[_0xe1f6('0x13')](_0xe1f6('0x42'),_0x4cb597['message'],_0x4fccf9);_0x44634e(_0x1aabab[_0xe1f6('0x13')](0x1f4,_0x4cb597['message']));});});});};exports[_0xe1f6('0x43')]=function(_0x4fa3ea){var _0x12be59=this;var _0x23c08f=_0x4fa3ea[_0xe1f6('0x1b')][_0xe1f6('0x8')]['voiceQueueIds'];var _0x12049c=_0x4fa3ea['body'][_0xe1f6('0x8')][_0xe1f6('0x44')];var _0x285898=_0x4fa3ea[_0xe1f6('0x1b')][_0xe1f6('0x8')][_0xe1f6('0x45')];return new Promise(function(_0x46b349,_0xaace60){return db[_0xe1f6('0x16')][_0xe1f6('0x5')]({'where':{'voiceQueueId':{'$in':_0x23c08f},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe1f6('0x21')]['literal'](_0xe1f6('0x46')+_0x12049c+_0xe1f6('0x47')),'$gt':db[_0xe1f6('0x21')][_0xe1f6('0x36')]('NOW()')}},'UserId':{'$in':_0x285898}},'include':[{'model':db[_0xe1f6('0x1f')],'as':_0xe1f6('0x24')},{'model':db[_0xe1f6('0x48')],'as':_0xe1f6('0x26'),'attributes':['id',_0xe1f6('0x27'),_0xe1f6('0x28')]},{'model':db[_0xe1f6('0x49')],'as':_0xe1f6('0x4a')}]})['then'](function(_0x30438e){if(_0x30438e['length']>0x0){return db[_0xe1f6('0x21')][_0xe1f6('0x22')](function(_0x37a5bc){return db[_0xe1f6('0x16')]['update']({'recallmeNotifiedDate':db[_0xe1f6('0x21')][_0xe1f6('0x36')](_0xe1f6('0x4b'))},{'where':{'id':{'$in':_[_0xe1f6('0xc')](_0x30438e,'id')}},'transaction':_0x37a5bc})['then'](function(){_0x46b349(_0x30438e);})[_0xe1f6('0x12')](function(_0x1b4d3c){logger['error'](_0xe1f6('0x43'),_0x1b4d3c[_0xe1f6('0x14')],_0x4fa3ea);_0xaace60(_0x12be59['error'](0x1f4,_0x1b4d3c[_0xe1f6('0x14')]));});})[_0xe1f6('0x12')](function(_0x46581a){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x46581a[_0xe1f6('0x14')],_0x4fa3ea);_0xaace60(_0x12be59[_0xe1f6('0x13')](0x1f4,_0x46581a['message']));});}else{_0x46b349(_0x30438e);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 09ffdbd..9e059a9 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 _0xff36=['get','/describe','/opencontacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','./cmHopper.controller','isAuthenticated'];(function(_0x182412,_0x690df7){var _0x4d47a4=function(_0x25471a){while(--_0x25471a){_0x182412['push'](_0x182412['shift']());}};_0x4d47a4(++_0x690df7);}(_0xff36,0x19e));var _0x6ff3=function(_0x5e5fb3,_0x5e6ebb){_0x5e5fb3=_0x5e5fb3-0x0;var _0xecb9d8=_0xff36[_0x5e5fb3];return _0xecb9d8;};'use strict';var express=require(_0x6ff3('0x0'));var router=express[_0x6ff3('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6ff3('0x2'));router['get']('/',auth[_0x6ff3('0x3')](),controller['index']);router[_0x6ff3('0x4')](_0x6ff3('0x5'),auth['isAuthenticated'](),controller['describe']);router[_0x6ff3('0x4')](_0x6ff3('0x6'),auth[_0x6ff3('0x3')](),controller['getOpenContacts']);router[_0x6ff3('0x4')](_0x6ff3('0x7'),auth[_0x6ff3('0x3')](),controller['getTimezones']);router[_0x6ff3('0x4')](_0x6ff3('0x8'),auth[_0x6ff3('0x3')](),controller[_0x6ff3('0x9')]);router[_0x6ff3('0x4')](_0x6ff3('0xa'),auth['isAuthenticated'](),controller[_0x6ff3('0xb')]);router[_0x6ff3('0xc')]('/',auth[_0x6ff3('0x3')](),controller[_0x6ff3('0xd')]);router[_0x6ff3('0xc')](_0x6ff3('0xe'),auth['isAuthenticated'](),controller[_0x6ff3('0xf')]);router[_0x6ff3('0xc')]('/timezone',auth[_0x6ff3('0x3')](),controller[_0x6ff3('0x10')]);router[_0x6ff3('0x11')]('/:id',auth[_0x6ff3('0x3')](),controller[_0x6ff3('0x12')]);router[_0x6ff3('0x13')](_0x6ff3('0x8'),auth[_0x6ff3('0x3')](),controller[_0x6ff3('0x14')]);module[_0x6ff3('0x15')]=router; \ No newline at end of file +var _0x91ab=['getPreviewRecall','create','post','getPreview','getTimezone','put','/:id','update','delete','destroy','exports','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall'];(function(_0x321de5,_0x3672d5){var _0x536a29=function(_0x4966fd){while(--_0x4966fd){_0x321de5['push'](_0x321de5['shift']());}};_0x536a29(++_0x3672d5);}(_0x91ab,0xac));var _0xb91a=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x91ab[_0x42f009];return _0x22a1e0;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xb91a('0x0'));var controller=require(_0xb91a('0x1'));router[_0xb91a('0x2')]('/',auth[_0xb91a('0x3')](),controller[_0xb91a('0x4')]);router['get'](_0xb91a('0x5'),auth['isAuthenticated'](),controller[_0xb91a('0x6')]);router[_0xb91a('0x2')]('/opencontacts',auth[_0xb91a('0x3')](),controller[_0xb91a('0x7')]);router['get'](_0xb91a('0x8'),auth['isAuthenticated'](),controller[_0xb91a('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb91a('0xa')]);router['get'](_0xb91a('0xb'),auth[_0xb91a('0x3')](),controller[_0xb91a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb91a('0xd')]);router[_0xb91a('0xe')]('/preview',auth[_0xb91a('0x3')](),controller[_0xb91a('0xf')]);router[_0xb91a('0xe')]('/timezone',auth[_0xb91a('0x3')](),controller[_0xb91a('0x10')]);router[_0xb91a('0x11')](_0xb91a('0x12'),auth[_0xb91a('0x3')](),controller[_0xb91a('0x13')]);router[_0xb91a('0x14')](_0xb91a('0x12'),auth['isAuthenticated'](),controller[_0xb91a('0x15')]);module[_0xb91a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index cd7cea4..92759c7 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 _0x12c1=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x1ba868,_0x2c3dac){var _0x454122=function(_0x312e28){while(--_0x312e28){_0x1ba868['push'](_0x1ba868['shift']());}};_0x454122(++_0x2c3dac);}(_0x12c1,0x15d));var _0x112c=function(_0x1d99a6,_0xd3210a){_0x1d99a6=_0x1d99a6-0x0;var _0x444caa=_0x12c1[_0x1d99a6];return _0x444caa;};'use strict';var moment=require(_0x112c('0x0'));var Sequelize=require(_0x112c('0x1'));module[_0x112c('0x2')]={'CmHopperId':{'type':Sequelize[_0x112c('0x3')]},'phone':{'type':Sequelize[_0x112c('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x112c('0x5')],'defaultValue':moment()[_0x112c('0x6')](_0x112c('0x7'))},'countbusyretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x112c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca30=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','STRING'];(function(_0x14eef,_0x508270){var _0x92d5da=function(_0x4575f8){while(--_0x4575f8){_0x14eef['push'](_0x14eef['shift']());}};_0x92d5da(++_0x508270);}(_0xca30,0x7a));var _0x0ca3=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xca30[_0x456fb1];return _0x4083d6;};'use strict';var moment=require(_0x0ca3('0x0'));var Sequelize=require('sequelize');module[_0x0ca3('0x1')]={'CmHopperId':{'type':Sequelize[_0x0ca3('0x2')]},'phone':{'type':Sequelize[_0x0ca3('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0ca3('0x4')],'defaultValue':moment()[_0x0ca3('0x5')](_0x0ca3('0x6'))},'countbusyretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0ca3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 827e21d..402fe4b 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 _0x1a04=['offset','limit','count','set','json','apply','reject','update','destroy','then','get','CmHopperAdditionalPhones','status','stack','name','send','map','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','CmHopperAdditionalPhone','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1a04,0x89));var _0x41a0=function(_0x8be71c,_0x813855){_0x8be71c=_0x8be71c-0x0;var _0x312032=_0x1a04[_0x8be71c];return _0x312032;};'use strict';var emlformat=require(_0x41a0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41a0('0x1'));var rp=require(_0x41a0('0x2'));var moment=require(_0x41a0('0x3'));var BPromise=require(_0x41a0('0x4'));var Mustache=require(_0x41a0('0x5'));var util=require(_0x41a0('0x6'));var path=require(_0x41a0('0x7'));var sox=require(_0x41a0('0x8'));var csv=require(_0x41a0('0x9'));var ejs=require(_0x41a0('0xa'));var fs=require('fs');var fs_extra=require(_0x41a0('0xb'));var _=require('lodash');var squel=require(_0x41a0('0xc'));var crypto=require(_0x41a0('0xd'));var jsforce=require(_0x41a0('0xe'));var deskjs=require(_0x41a0('0xf'));var toCsv=require(_0x41a0('0x9'));var querystring=require(_0x41a0('0x10'));var Papa=require('papaparse');var Redis=require(_0x41a0('0x11'));var authService=require(_0x41a0('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41a0('0x13'));var logger=require(_0x41a0('0x14'))(_0x41a0('0x15'));var utils=require(_0x41a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x41a0('0x17'));var db=require(_0x41a0('0x18'))['db'];function respondWithStatusCode(_0x12de2b,_0x3e4760){_0x3e4760=_0x3e4760||0xcc;return function(_0x521950){if(_0x521950){return _0x12de2b[_0x41a0('0x19')](_0x3e4760);}return _0x12de2b['status'](_0x3e4760)[_0x41a0('0x1a')]();};}function respondWithResult(_0x16777e,_0x5c6b55){_0x5c6b55=_0x5c6b55||0xc8;return function(_0x1c0214){if(_0x1c0214){return _0x16777e['status'](_0x5c6b55)['json'](_0x1c0214);}};}function respondWithFilteredResult(_0x5127c5,_0x8f1a64){return function(_0x209844){if(_0x209844){var _0x1746cb=typeof _0x8f1a64[_0x41a0('0x1b')]==='undefined'&&typeof _0x8f1a64[_0x41a0('0x1c')]==='undefined';var _0x51fb67=_0x209844['count'];var _0x55aa9a=_0x1746cb?0x0:_0x8f1a64[_0x41a0('0x1b')];var _0x45e294=_0x1746cb?_0x209844[_0x41a0('0x1d')]:_0x8f1a64[_0x41a0('0x1b')]+_0x8f1a64['limit'];var _0x43f556;if(_0x45e294>=_0x51fb67){_0x45e294=_0x51fb67;_0x43f556=0xc8;}else{_0x43f556=0xce;}_0x5127c5['status'](_0x43f556);return _0x5127c5[_0x41a0('0x1e')]('Content-Range',_0x55aa9a+'-'+_0x45e294+'/'+_0x51fb67)[_0x41a0('0x1f')](_0x209844);}return null;};}function patchUpdates(_0xdf20ac){return function(_0x4c06dd){try{jsonpatch[_0x41a0('0x20')](_0x4c06dd,_0xdf20ac,!![]);}catch(_0x56cea7){return BPromise[_0x41a0('0x21')](_0x56cea7);}return _0x4c06dd['save']();};}function saveUpdates(_0x4eac63,_0x840c9f){return function(_0x5d387b){if(_0x5d387b){return _0x5d387b[_0x41a0('0x22')](_0x4eac63)['then'](function(_0x3f0ff0){return _0x3f0ff0;});}return null;};}function removeEntity(_0x2faba2,_0x25d02a){return function(_0x16d2e5){if(_0x16d2e5){return _0x16d2e5[_0x41a0('0x23')]()[_0x41a0('0x24')](function(){var _0x46936d=_0x16d2e5[_0x41a0('0x25')]({'plain':!![]});var _0x3942a7=_0x41a0('0x26');return db['UserProfileResource'][_0x41a0('0x23')]({'where':{'type':_0x3942a7,'resourceId':_0x46936d['id']}})[_0x41a0('0x24')](function(){return _0x16d2e5;});})[_0x41a0('0x24')](function(){_0x2faba2[_0x41a0('0x27')](0xcc)[_0x41a0('0x1a')]();});}};}function handleEntityNotFound(_0x2091f3,_0x33ecd9){return function(_0x427a9f){if(!_0x427a9f){_0x2091f3[_0x41a0('0x19')](0x194);}return _0x427a9f;};}function handleError(_0x206068,_0x2aa33b){_0x2aa33b=_0x2aa33b||0x1f4;return function(_0x16007e){logger['error'](_0x16007e[_0x41a0('0x28')]);if(_0x16007e[_0x41a0('0x29')]){delete _0x16007e[_0x41a0('0x29')];}_0x206068[_0x41a0('0x27')](_0x2aa33b)[_0x41a0('0x2a')](_0x16007e);};}exports['index']=function(_0x5bfce1,_0x22807b){var _0x26c55b={},_0x3db0c7={},_0x4188dc={'count':0x0,'rows':[]};var _0x30875b=_[_0x41a0('0x2b')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x569e64){return{'name':_0x569e64['fieldName'],'type':_0x569e64['type'][_0x41a0('0x2c')]};});_0x3db0c7[_0x41a0('0x2d')]=_[_0x41a0('0x2b')](_0x30875b,_0x41a0('0x29'));_0x3db0c7['query']=_[_0x41a0('0x2e')](_0x5bfce1[_0x41a0('0x2f')]);_0x3db0c7[_0x41a0('0x30')]=_[_0x41a0('0x31')](_0x3db0c7['model'],_0x3db0c7[_0x41a0('0x2f')]);_0x26c55b[_0x41a0('0x32')]=_[_0x41a0('0x31')](_0x3db0c7[_0x41a0('0x2d')],qs[_0x41a0('0x33')](_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x33')]));_0x26c55b[_0x41a0('0x32')]=_0x26c55b[_0x41a0('0x32')]['length']?_0x26c55b[_0x41a0('0x32')]:_0x3db0c7['model'];if(!_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x34')](_0x41a0('0x35'))){_0x26c55b['limit']=qs[_0x41a0('0x1c')](_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x1c')]);_0x26c55b[_0x41a0('0x1b')]=qs[_0x41a0('0x1b')](_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x1b')]);}_0x26c55b[_0x41a0('0x36')]=qs[_0x41a0('0x37')](_0x5bfce1['query'][_0x41a0('0x37')]);_0x26c55b[_0x41a0('0x38')]=qs[_0x41a0('0x30')](_[_0x41a0('0x39')](_0x5bfce1[_0x41a0('0x2f')],_0x3db0c7[_0x41a0('0x30')]),_0x30875b);if(_0x5bfce1[_0x41a0('0x2f')]['filter']){_0x26c55b[_0x41a0('0x38')]=_[_0x41a0('0x3a')](_0x26c55b['where'],{'$or':_[_0x41a0('0x2b')](_0x30875b,function(_0x1fd139){if(_0x1fd139[_0x41a0('0x3b')]!==_0x41a0('0x3c')){var _0xf5b269={};_0xf5b269[_0x1fd139[_0x41a0('0x29')]]={'$like':'%'+_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x3d')]+'%'};return _0xf5b269;}})});}_0x26c55b=_['merge']({},_0x26c55b,_0x5bfce1[_0x41a0('0x3e')]);var _0x2c0bf9={'where':_0x26c55b['where']};return db['CmHopperAdditionalPhone'][_0x41a0('0x1d')](_0x2c0bf9)[_0x41a0('0x24')](function(_0x678830){_0x4188dc[_0x41a0('0x1d')]=_0x678830;if(_0x5bfce1[_0x41a0('0x2f')][_0x41a0('0x3f')]){_0x26c55b[_0x41a0('0x40')]=[{'all':!![]}];}return db[_0x41a0('0x41')][_0x41a0('0x42')](_0x26c55b);})['then'](function(_0x559899){_0x4188dc[_0x41a0('0x43')]=_0x559899;return _0x4188dc;})[_0x41a0('0x24')](respondWithFilteredResult(_0x22807b,_0x26c55b))[_0x41a0('0x44')](handleError(_0x22807b,null));};exports[_0x41a0('0x45')]=function(_0x997b28,_0x1132b1){var _0x5274cc={'raw':!![],'where':{'id':_0x997b28[_0x41a0('0x46')]['id']}},_0x12731a={};_0x12731a['model']=_[_0x41a0('0x2e')](db['CmHopperAdditionalPhone'][_0x41a0('0x47')]);_0x12731a['query']=_['keys'](_0x997b28['query']);_0x12731a[_0x41a0('0x30')]=_[_0x41a0('0x31')](_0x12731a[_0x41a0('0x2d')],_0x12731a[_0x41a0('0x2f')]);_0x5274cc[_0x41a0('0x32')]=_[_0x41a0('0x31')](_0x12731a['model'],qs[_0x41a0('0x33')](_0x997b28[_0x41a0('0x2f')]['fields']));_0x5274cc[_0x41a0('0x32')]=_0x5274cc[_0x41a0('0x32')][_0x41a0('0x48')]?_0x5274cc['attributes']:_0x12731a[_0x41a0('0x2d')];if(_0x997b28['query']['includeAll']){_0x5274cc['include']=[{'all':!![]}];}_0x5274cc=_[_0x41a0('0x3a')]({},_0x5274cc,_0x997b28[_0x41a0('0x3e')]);return db[_0x41a0('0x41')]['find'](_0x5274cc)[_0x41a0('0x24')](handleEntityNotFound(_0x1132b1,null))[_0x41a0('0x24')](respondWithResult(_0x1132b1,null))['catch'](handleError(_0x1132b1,null));};exports[_0x41a0('0x49')]=function(_0xbe0d2e,_0x173a71){return db[_0x41a0('0x41')][_0x41a0('0x49')](_0xbe0d2e[_0x41a0('0x4a')],{})[_0x41a0('0x24')](function(_0x41e9ef){var _0x49adca=_0xbe0d2e[_0x41a0('0x4b')]['get']({'plain':!![]});if(!_0x49adca)throw new Error(_0x41a0('0x4c'));if(_0x49adca['role']==='user'){var _0x1de412=_0x41e9ef[_0x41a0('0x25')]({'plain':!![]});var _0xb08a5a='CmHopperAdditionalPhones';return db['UserProfileSection']['find']({'where':{'name':_0xb08a5a,'userProfileId':_0x49adca['userProfileId']},'raw':!![]})['then'](function(_0x53326a){if(_0x53326a&&_0x53326a[_0x41a0('0x4d')]===0x0){return db[_0x41a0('0x4e')]['create']({'name':_0x1de412['name'],'resourceId':_0x1de412['id'],'type':_0x53326a[_0x41a0('0x29')],'sectionId':_0x53326a['id']},{})[_0x41a0('0x24')](function(){return _0x41e9ef;});}else{return _0x41e9ef;}})[_0x41a0('0x44')](function(_0x30d2a2){logger[_0x41a0('0x4f')](_0x41a0('0x50'),_0x30d2a2);throw _0x30d2a2;});}return _0x41e9ef;})[_0x41a0('0x24')](respondWithResult(_0x173a71,0xc9))[_0x41a0('0x44')](handleError(_0x173a71,null));};exports[_0x41a0('0x22')]=function(_0x3f9ff9,_0x4506a5){if(_0x3f9ff9['body']['id']){delete _0x3f9ff9[_0x41a0('0x4a')]['id'];}return db[_0x41a0('0x41')][_0x41a0('0x51')]({'where':{'id':_0x3f9ff9[_0x41a0('0x46')]['id']}})[_0x41a0('0x24')](handleEntityNotFound(_0x4506a5,null))[_0x41a0('0x24')](saveUpdates(_0x3f9ff9[_0x41a0('0x4a')],null))[_0x41a0('0x24')](respondWithResult(_0x4506a5,null))[_0x41a0('0x44')](handleError(_0x4506a5,null));};exports[_0x41a0('0x23')]=function(_0x34d549,_0x2fe312){return db[_0x41a0('0x41')][_0x41a0('0x51')]({'where':{'id':_0x34d549['params']['id']}})['then'](handleEntityNotFound(_0x2fe312,null))[_0x41a0('0x24')](removeEntity(_0x2fe312,null))[_0x41a0('0x44')](handleError(_0x2fe312,null));}; \ No newline at end of file +var _0x05f6=['offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','keys','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x3aa742,_0x390303){var _0x33e4cf=function(_0x284f63){while(--_0x284f63){_0x3aa742['push'](_0x3aa742['shift']());}};_0x33e4cf(++_0x390303);}(_0x05f6,0x86));var _0x605f=function(_0x1e9005,_0x3679f4){_0x1e9005=_0x1e9005-0x0;var _0x10f36c=_0x05f6[_0x1e9005];return _0x10f36c;};'use strict';var emlformat=require(_0x605f('0x0'));var rimraf=require(_0x605f('0x1'));var zipdir=require(_0x605f('0x2'));var jsonpatch=require(_0x605f('0x3'));var rp=require('request-promise');var moment=require(_0x605f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x605f('0x5'));var util=require(_0x605f('0x6'));var path=require(_0x605f('0x7'));var sox=require(_0x605f('0x8'));var csv=require(_0x605f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x605f('0xa'));var _=require(_0x605f('0xb'));var squel=require(_0x605f('0xc'));var crypto=require(_0x605f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x605f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x605f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x605f('0x10'));var hardwareService=require(_0x605f('0x11'));var logger=require('../../config/logger')(_0x605f('0x12'));var utils=require(_0x605f('0x13'));var config=require(_0x605f('0x14'));var licenseUtil=require(_0x605f('0x15'));var db=require(_0x605f('0x16'))['db'];function respondWithStatusCode(_0x250c26,_0x321c20){_0x321c20=_0x321c20||0xcc;return function(_0xb1f626){if(_0xb1f626){return _0x250c26[_0x605f('0x17')](_0x321c20);}return _0x250c26[_0x605f('0x18')](_0x321c20)['end']();};}function respondWithResult(_0x46d133,_0x511ec9){_0x511ec9=_0x511ec9||0xc8;return function(_0x5a1953){if(_0x5a1953){return _0x46d133[_0x605f('0x18')](_0x511ec9)[_0x605f('0x19')](_0x5a1953);}};}function respondWithFilteredResult(_0x4134d5,_0x104a39){return function(_0xcb4028){if(_0xcb4028){var _0x1f01c1=typeof _0x104a39[_0x605f('0x1a')]===_0x605f('0x1b')&&typeof _0x104a39[_0x605f('0x1c')]===_0x605f('0x1b');var _0x4d14cd=_0xcb4028[_0x605f('0x1d')];var _0x5999b7=_0x1f01c1?0x0:_0x104a39[_0x605f('0x1a')];var _0x571425=_0x1f01c1?_0xcb4028['count']:_0x104a39[_0x605f('0x1a')]+_0x104a39['limit'];var _0x1bfd7d;if(_0x571425>=_0x4d14cd){_0x571425=_0x4d14cd;_0x1bfd7d=0xc8;}else{_0x1bfd7d=0xce;}_0x4134d5[_0x605f('0x18')](_0x1bfd7d);return _0x4134d5['set']('Content-Range',_0x5999b7+'-'+_0x571425+'/'+_0x4d14cd)['json'](_0xcb4028);}return null;};}function patchUpdates(_0x25c54d){return function(_0x42c826){try{jsonpatch[_0x605f('0x1e')](_0x42c826,_0x25c54d,!![]);}catch(_0x3e7c3b){return BPromise[_0x605f('0x1f')](_0x3e7c3b);}return _0x42c826[_0x605f('0x20')]();};}function saveUpdates(_0x2502bf,_0xf97e40){return function(_0x2301c1){if(_0x2301c1){return _0x2301c1[_0x605f('0x21')](_0x2502bf)[_0x605f('0x22')](function(_0x31485d){return _0x31485d;});}return null;};}function removeEntity(_0x2eeb3d,_0x4c22bc){return function(_0x53c99b){if(_0x53c99b){return _0x53c99b[_0x605f('0x23')]()[_0x605f('0x22')](function(){var _0x24001b=_0x53c99b[_0x605f('0x24')]({'plain':!![]});var _0x4defaa=_0x605f('0x25');return db['UserProfileResource'][_0x605f('0x23')]({'where':{'type':_0x4defaa,'resourceId':_0x24001b['id']}})[_0x605f('0x22')](function(){return _0x53c99b;});})[_0x605f('0x22')](function(){_0x2eeb3d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x144921,_0x1d3e15){return function(_0x4d5d30){if(!_0x4d5d30){_0x144921[_0x605f('0x17')](0x194);}return _0x4d5d30;};}function handleError(_0x2f6adb,_0x626a86){_0x626a86=_0x626a86||0x1f4;return function(_0x1d4e58){logger['error'](_0x1d4e58[_0x605f('0x26')]);if(_0x1d4e58[_0x605f('0x27')]){delete _0x1d4e58[_0x605f('0x27')];}_0x2f6adb[_0x605f('0x18')](_0x626a86)[_0x605f('0x28')](_0x1d4e58);};}exports[_0x605f('0x29')]=function(_0x16b890,_0x355d89){var _0x487f47={},_0x8daed6={},_0xad673e={'count':0x0,'rows':[]};var _0x3eab59=_[_0x605f('0x2a')](db[_0x605f('0x2b')][_0x605f('0x2c')],function(_0x493aa0){return{'name':_0x493aa0[_0x605f('0x2d')],'type':_0x493aa0['type'][_0x605f('0x2e')]};});_0x8daed6[_0x605f('0x2f')]=_[_0x605f('0x2a')](_0x3eab59,_0x605f('0x27'));_0x8daed6[_0x605f('0x30')]=_['keys'](_0x16b890[_0x605f('0x30')]);_0x8daed6[_0x605f('0x31')]=_[_0x605f('0x32')](_0x8daed6[_0x605f('0x2f')],_0x8daed6[_0x605f('0x30')]);_0x487f47[_0x605f('0x33')]=_[_0x605f('0x32')](_0x8daed6[_0x605f('0x2f')],qs['fields'](_0x16b890['query']['fields']));_0x487f47[_0x605f('0x33')]=_0x487f47[_0x605f('0x33')]['length']?_0x487f47[_0x605f('0x33')]:_0x8daed6[_0x605f('0x2f')];if(!_0x16b890['query']['hasOwnProperty'](_0x605f('0x34'))){_0x487f47['limit']=qs[_0x605f('0x1c')](_0x16b890['query'][_0x605f('0x1c')]);_0x487f47['offset']=qs[_0x605f('0x1a')](_0x16b890[_0x605f('0x30')][_0x605f('0x1a')]);}_0x487f47[_0x605f('0x35')]=qs['sort'](_0x16b890[_0x605f('0x30')][_0x605f('0x36')]);_0x487f47[_0x605f('0x37')]=qs[_0x605f('0x31')](_[_0x605f('0x38')](_0x16b890[_0x605f('0x30')],_0x8daed6['filters']),_0x3eab59);if(_0x16b890[_0x605f('0x30')][_0x605f('0x39')]){_0x487f47['where']=_[_0x605f('0x3a')](_0x487f47[_0x605f('0x37')],{'$or':_[_0x605f('0x2a')](_0x3eab59,function(_0x272d98){if(_0x272d98[_0x605f('0x3b')]!==_0x605f('0x3c')){var _0x42031d={};_0x42031d[_0x272d98['name']]={'$like':'%'+_0x16b890['query']['filter']+'%'};return _0x42031d;}})});}_0x487f47=_[_0x605f('0x3a')]({},_0x487f47,_0x16b890['options']);var _0xb73c13={'where':_0x487f47[_0x605f('0x37')]};return db[_0x605f('0x2b')][_0x605f('0x1d')](_0xb73c13)[_0x605f('0x22')](function(_0x42b44b){_0xad673e[_0x605f('0x1d')]=_0x42b44b;if(_0x16b890['query'][_0x605f('0x3d')]){_0x487f47['include']=[{'all':!![]}];}return db[_0x605f('0x2b')][_0x605f('0x3e')](_0x487f47);})['then'](function(_0x5a8cdb){_0xad673e['rows']=_0x5a8cdb;return _0xad673e;})[_0x605f('0x22')](respondWithFilteredResult(_0x355d89,_0x487f47))['catch'](handleError(_0x355d89,null));};exports[_0x605f('0x3f')]=function(_0x5038e1,_0x311580){var _0x12bc5a={'raw':!![],'where':{'id':_0x5038e1[_0x605f('0x40')]['id']}},_0x417a56={};_0x417a56['model']=_[_0x605f('0x41')](db[_0x605f('0x2b')][_0x605f('0x2c')]);_0x417a56['query']=_[_0x605f('0x41')](_0x5038e1[_0x605f('0x30')]);_0x417a56[_0x605f('0x31')]=_[_0x605f('0x32')](_0x417a56['model'],_0x417a56['query']);_0x12bc5a[_0x605f('0x33')]=_[_0x605f('0x32')](_0x417a56[_0x605f('0x2f')],qs[_0x605f('0x42')](_0x5038e1[_0x605f('0x30')]['fields']));_0x12bc5a[_0x605f('0x33')]=_0x12bc5a['attributes'][_0x605f('0x43')]?_0x12bc5a[_0x605f('0x33')]:_0x417a56[_0x605f('0x2f')];if(_0x5038e1[_0x605f('0x30')]['includeAll']){_0x12bc5a['include']=[{'all':!![]}];}_0x12bc5a=_[_0x605f('0x3a')]({},_0x12bc5a,_0x5038e1[_0x605f('0x44')]);return db['CmHopperAdditionalPhone'][_0x605f('0x45')](_0x12bc5a)[_0x605f('0x22')](handleEntityNotFound(_0x311580,null))[_0x605f('0x22')](respondWithResult(_0x311580,null))['catch'](handleError(_0x311580,null));};exports['create']=function(_0x2a6a2d,_0x107f62){return db[_0x605f('0x2b')][_0x605f('0x46')](_0x2a6a2d[_0x605f('0x47')],{})[_0x605f('0x22')](function(_0x1c8965){var _0x38553c=_0x2a6a2d[_0x605f('0x48')]['get']({'plain':!![]});if(!_0x38553c)throw new Error(_0x605f('0x49'));if(_0x38553c[_0x605f('0x4a')]===_0x605f('0x48')){var _0x1f083d=_0x1c8965[_0x605f('0x24')]({'plain':!![]});var _0x36f51b=_0x605f('0x25');return db['UserProfileSection'][_0x605f('0x45')]({'where':{'name':_0x36f51b,'userProfileId':_0x38553c[_0x605f('0x4b')]},'raw':!![]})[_0x605f('0x22')](function(_0x3a809f){if(_0x3a809f&&_0x3a809f[_0x605f('0x4c')]===0x0){return db['UserProfileResource'][_0x605f('0x46')]({'name':_0x1f083d[_0x605f('0x27')],'resourceId':_0x1f083d['id'],'type':_0x3a809f['name'],'sectionId':_0x3a809f['id']},{})[_0x605f('0x22')](function(){return _0x1c8965;});}else{return _0x1c8965;}})[_0x605f('0x4d')](function(_0x51bae1){logger[_0x605f('0x4e')](_0x605f('0x4f'),_0x51bae1);throw _0x51bae1;});}return _0x1c8965;})[_0x605f('0x22')](respondWithResult(_0x107f62,0xc9))[_0x605f('0x4d')](handleError(_0x107f62,null));};exports['update']=function(_0x302679,_0x49c271){if(_0x302679[_0x605f('0x47')]['id']){delete _0x302679[_0x605f('0x47')]['id'];}return db[_0x605f('0x2b')][_0x605f('0x45')]({'where':{'id':_0x302679[_0x605f('0x40')]['id']}})['then'](handleEntityNotFound(_0x49c271,null))[_0x605f('0x22')](saveUpdates(_0x302679[_0x605f('0x47')],null))[_0x605f('0x22')](respondWithResult(_0x49c271,null))[_0x605f('0x4d')](handleError(_0x49c271,null));};exports['destroy']=function(_0x44cd79,_0x3d3e9e){return db[_0x605f('0x2b')][_0x605f('0x45')]({'where':{'id':_0x44cd79['params']['id']}})[_0x605f('0x22')](handleEntityNotFound(_0x3d3e9e,null))[_0x605f('0x22')](removeEntity(_0x3d3e9e,null))[_0x605f('0x4d')](handleError(_0x3d3e9e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7df4a60..9e05d72 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 _0xc0b3=['bluebird','request-promise','path','rimraf','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment'];(function(_0x5676de,_0x39952b){var _0x4891fd=function(_0x3c4db6){while(--_0x3c4db6){_0x5676de['push'](_0x5676de['shift']());}};_0x4891fd(++_0x39952b);}(_0xc0b3,0x1a8));var _0x3c0b=function(_0x1089fb,_0xfa7fda){_0x1089fb=_0x1089fb-0x0;var _0x1d9362=_0xc0b3[_0x1089fb];return _0x1d9362;};'use strict';var _=require(_0x3c0b('0x0'));var util=require(_0x3c0b('0x1'));var logger=require(_0x3c0b('0x2'))(_0x3c0b('0x3'));var moment=require(_0x3c0b('0x4'));var BPromise=require(_0x3c0b('0x5'));var rp=require(_0x3c0b('0x6'));var fs=require('fs');var path=require(_0x3c0b('0x7'));var rimraf=require(_0x3c0b('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3c0b('0x9')]=function(_0x41f671,_0x312d35){return _0x41f671[_0x3c0b('0xa')](_0x3c0b('0xb'),attributes,{'tableName':_0x3c0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9b9=['path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x343b0a,_0x586263){var _0x3d8ff8=function(_0x53c629){while(--_0x53c629){_0x343b0a['push'](_0x343b0a['shift']());}};_0x3d8ff8(++_0x586263);}(_0xd9b9,0x118));var _0x9d9b=function(_0x83944b,_0x44326d){_0x83944b=_0x83944b-0x0;var _0x14fe08=_0xd9b9[_0x83944b];return _0x14fe08;};'use strict';var _=require(_0x9d9b('0x0'));var util=require('util');var logger=require(_0x9d9b('0x1'))(_0x9d9b('0x2'));var moment=require(_0x9d9b('0x3'));var BPromise=require(_0x9d9b('0x4'));var rp=require(_0x9d9b('0x5'));var fs=require('fs');var path=require(_0x9d9b('0x6'));var rimraf=require('rimraf');var config=require(_0x9d9b('0x7'));var attributes=require(_0x9d9b('0x8'));module['exports']=function(_0x47f886,_0x20ee26){return _0x47f886[_0x9d9b('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x9d9b('0xa'),'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 ac7ab40..1add979 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 _0x6ced=['update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','VoiceQueueId','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction'];(function(_0x38b2ed,_0x3b6bbe){var _0x5e3e1d=function(_0xe6a9e4){while(--_0xe6a9e4){_0x38b2ed['push'](_0x38b2ed['shift']());}};_0x5e3e1d(++_0x3b6bbe);}(_0x6ced,0x6d));var _0xd6ce=function(_0x46bf94,_0x4a749e){_0x46bf94=_0x46bf94-0x0;var _0x4e1865=_0x6ced[_0x46bf94];return _0x4e1865;};'use strict';var _=require(_0xd6ce('0x0'));var util=require(_0xd6ce('0x1'));var moment=require('moment');var BPromise=require(_0xd6ce('0x2'));var rs=require(_0xd6ce('0x3'));var fs=require('fs');var Redis=require(_0xd6ce('0x4'));var db=require(_0xd6ce('0x5'))['db'];var utils=require(_0xd6ce('0x6'));var logger=require(_0xd6ce('0x7'))(_0xd6ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6ce('0x9')][_0xd6ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee65c5,_0x4a9f87,_0x22acab){return new BPromise(function(_0x3866ff,_0x95e4ff){return client['request'](_0xee65c5,_0x22acab)[_0xd6ce('0xb')](function(_0x1307d7){logger[_0xd6ce('0xc')](_0xd6ce('0xd'),_0x4a9f87,_0xd6ce('0xe'));logger['debug'](_0xd6ce('0xf'),_0x4a9f87,_0xd6ce('0xe'),JSON[_0xd6ce('0x10')](_0x1307d7));if(_0x1307d7[_0xd6ce('0x11')]){if(_0x1307d7['error']['code']===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4a9f87,_0x1307d7[_0xd6ce('0x11')][_0xd6ce('0x12')]);return _0x95e4ff(_0x1307d7[_0xd6ce('0x11')][_0xd6ce('0x12')]);}logger[_0xd6ce('0x11')](_0xd6ce('0xd'),_0x4a9f87,_0x1307d7[_0xd6ce('0x11')][_0xd6ce('0x12')]);return _0x3866ff(_0x1307d7['error']['message']);}else{logger['info'](_0xd6ce('0xd'),_0x4a9f87,'request\x20sent');_0x3866ff(_0x1307d7[_0xd6ce('0x13')][_0xd6ce('0x12')]);}})['catch'](function(_0x4d0a04){logger['error'](_0xd6ce('0xd'),_0x4a9f87,_0x4d0a04);_0x95e4ff(_0x4d0a04);});});}exports[_0xd6ce('0x14')]=function(_0x3db6fb){var _0x214a9c=this;return new Promise(function(_0x3e36a7,_0x42fa07){return db[_0xd6ce('0x15')][_0xd6ce('0x16')]({'raw':!![],'where':{'ContactId':_0x3db6fb[_0xd6ce('0x17')][_0xd6ce('0x18')],'ListId':_0x3db6fb['body']['ListId'],'VoiceQueueId':_0x3db6fb[_0xd6ce('0x17')]['VoiceQueueId']===undefined?null:_0x3db6fb['body']['VoiceQueueId'],'CampaignId':_0x3db6fb[_0xd6ce('0x17')][_0xd6ce('0x19')]===undefined?null:_0x3db6fb['body']['CampaignId']}})[_0xd6ce('0xb')](function(_0x29a0d5){if(_0x29a0d5!=null){return db[_0xd6ce('0x1a')][_0xd6ce('0x16')]({'raw':!![],'where':{'CmHopperId':_0x29a0d5['id'],'OrderBy':{'$gt':_0x29a0d5['OrderBy']}},'order':[[_0xd6ce('0x1b'),_0xd6ce('0x1c')]]})[_0xd6ce('0xb')](function(_0x5a34d3){var _0x3ec77e=0x0;if(_0x5a34d3){if(_0x5a34d3[_0xd6ce('0x1d')]+_0x5a34d3[_0xd6ce('0x1e')]+_0x5a34d3[_0xd6ce('0x1f')]+_0x5a34d3[_0xd6ce('0x20')]+_0x5a34d3[_0xd6ce('0x21')]+_0x5a34d3[_0xd6ce('0x22')]+_0x5a34d3[_0xd6ce('0x23')]+_0x5a34d3[_0xd6ce('0x24')]<_0x3db6fb[_0xd6ce('0x25')][_0xd6ce('0x26')])_0x3ec77e=0x1;_0x3e36a7({'additional':_0x3ec77e});}else{return db['CmHopperAdditionalPhone'][_0xd6ce('0x16')]({'raw':!![],'where':{'CmHopperId':_0x29a0d5['id']},'order':[[_0xd6ce('0x1b'),_0xd6ce('0x1c')]]})[_0xd6ce('0xb')](function(_0x17375a){var _0xedc5e7=0x0;if(_0x17375a){if(_0x17375a[_0xd6ce('0x1d')]+_0x17375a[_0xd6ce('0x1e')]+_0x17375a[_0xd6ce('0x1f')]+_0x17375a['countnosuchnumberretry']+_0x17375a[_0xd6ce('0x21')]+_0x17375a[_0xd6ce('0x22')]+_0x17375a[_0xd6ce('0x23')]+_0x17375a[_0xd6ce('0x24')]<_0x3db6fb[_0xd6ce('0x25')][_0xd6ce('0x26')])_0xedc5e7=0x1;_0x3e36a7({'additional':_0xedc5e7});}else{_0x3e36a7({'additional':0x0});}})[_0xd6ce('0x27')](function(_0x9a7b4f){logger[_0xd6ce('0x11')](_0xd6ce('0x14'),_0x9a7b4f[_0xd6ce('0x12')]);_0x42fa07(_0x214a9c[_0xd6ce('0x11')](0x1f4,_0x9a7b4f[_0xd6ce('0x12')]));});}})[_0xd6ce('0x27')](function(_0x2442bb){logger[_0xd6ce('0x11')](_0xd6ce('0x14'),_0x2442bb['message']);_0x42fa07(_0x214a9c[_0xd6ce('0x11')](0x1f4,_0x2442bb[_0xd6ce('0x12')]));});}else _0x3e36a7({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x87be1){var _0x545b57=this;return new Promise(function(_0x2ba740,_0x238911){return db[_0xd6ce('0x15')][_0xd6ce('0x16')]({'raw':!![],'where':{'ContactId':_0x87be1['body'][_0xd6ce('0x18')],'ListId':_0x87be1[_0xd6ce('0x17')]['ListId'],'VoiceQueueId':_0x87be1['body'][_0xd6ce('0x28')]===undefined?null:_0x87be1['body'][_0xd6ce('0x28')],'CampaignId':_0x87be1[_0xd6ce('0x17')][_0xd6ce('0x19')]===undefined?null:_0x87be1['body'][_0xd6ce('0x19')]}})['then'](function(_0x28e09c){if(_0x28e09c!=null){return db[_0xd6ce('0x1a')][_0xd6ce('0x16')]({'raw':!![],'where':{'CmHopperId':_0x28e09c['id'],'OrderBy':{'$gte':_0x28e09c['OrderBy']}},'order':[[_0xd6ce('0x1b'),'ASC']]})[_0xd6ce('0xb')](function(_0x5cb0a4){if(_0x5cb0a4)return activateAdditionalPhone(_0x28e09c,_0x87be1[_0xd6ce('0x17')],_0x5cb0a4,_0x87be1['duration'],_0x87be1[_0xd6ce('0x29')])['then'](function(_0x1c4afb){_0x2ba740(_0x1c4afb);});else{return db[_0xd6ce('0x1a')][_0xd6ce('0x16')]({'raw':!![],'where':{'CmHopperId':_0x28e09c['id']},'order':[[_0xd6ce('0x1b'),_0xd6ce('0x1c')]]})['then'](function(_0x123770){if(_0x123770)return activateAdditionalPhone(_0x28e09c,_0x87be1[_0xd6ce('0x17')],_0x123770,_0x87be1['duration'],_0x87be1[_0xd6ce('0x29')])['then'](function(_0x1ef6a1){_0x2ba740(_0x1ef6a1);});else{_0x2ba740({'id':_0x28e09c['id'],'phone':''});}})[_0xd6ce('0x27')](function(_0xa58af8){logger[_0xd6ce('0x11')](_0xd6ce('0x14'),_0xa58af8[_0xd6ce('0x12')]);_0x238911(_0x545b57[_0xd6ce('0x11')](0x1f4,_0xa58af8[_0xd6ce('0x12')]));});}})[_0xd6ce('0x27')](function(_0x48d64b){logger[_0xd6ce('0x11')](_0xd6ce('0x14'),_0x48d64b[_0xd6ce('0x12')]);_0x238911(_0x545b57[_0xd6ce('0x11')](0x1f4,_0x48d64b[_0xd6ce('0x12')]));});}else _0x2ba740(0x1);});});};function activateAdditionalPhone(_0x5298af,_0x14f589,_0x131a6c,_0x346740,_0x872351){return new Promise(function(_0x299d6f,_0x476946){var _0x1302e5;if(_[_0xd6ce('0x2a')](_0x131a6c[_0xd6ce('0x2b')])){_0x131a6c[_0xd6ce('0x2b')]=moment();}if(moment()>moment(_0x131a6c[_0xd6ce('0x2b')])){_0x1302e5=moment()[_0xd6ce('0x2c')](_0x872351||0x3,_0xd6ce('0x2d'));}else{if(_0x131a6c[_0xd6ce('0x1b')]==0x0){_0x1302e5=moment(_0x131a6c[_0xd6ce('0x2b')]);}else{_0x1302e5=moment()[_0xd6ce('0x2c')](_0x872351||0x3,_0xd6ce('0x2d'));}}if(_[_0xd6ce('0x2a')](_0x1302e5)){_0x1302e5=moment()[_0xd6ce('0x2c')](_0x872351||0x3,_0xd6ce('0x2d'));}var _0x436ce8={'phone':_0x5298af[_0xd6ce('0x2e')],'active':0x0,'OrderBy':_[_0xd6ce('0x2a')](_0x5298af['OrderBy'])?0x0:_0x5298af[_0xd6ce('0x1b')],'scheduledat':moment()['add'](_0x346740||0x1,_0xd6ce('0x2d')),'countbusyretry':_0x14f589[_0xd6ce('0x1d')],'countcongestionretry':_0x14f589[_0xd6ce('0x1e')],'countnoanswerretry':_0x14f589[_0xd6ce('0x1f')],'countnosuchnumberretry':_0x14f589[_0xd6ce('0x20')],'countdropretry':_0x14f589['countdropretry'],'countabandonedretry':_0x14f589['countabandonedretry'],'countmachineretry':_0x14f589['countmachineretry'],'countagentrejectretry':_0x14f589['countagentrejectretry'],'createdAt':_0x14f589[_0xd6ce('0x2f')],'updatedAt':_0x14f589[_0xd6ce('0x30')]};var _0x3b5764={'CmHopperId':_0x5298af['id'],'phone':_0x131a6c[_0xd6ce('0x2e')],'active':0x0,'OrderBy':_[_0xd6ce('0x2a')](_0x131a6c[_0xd6ce('0x1b')])?0x0:_0x131a6c[_0xd6ce('0x1b')],'scheduledat':_0x1302e5,'countbusyretry':_0x131a6c[_0xd6ce('0x1d')],'countcongestionretry':_0x131a6c[_0xd6ce('0x1e')],'countnoanswerretry':_0x131a6c[_0xd6ce('0x1f')],'countnosuchnumberretry':_0x131a6c[_0xd6ce('0x20')],'countdropretry':_0x131a6c['countdropretry'],'countabandonedretry':_0x131a6c[_0xd6ce('0x22')],'countmachineretry':_0x131a6c[_0xd6ce('0x23')],'countagentrejectretry':_0x131a6c[_0xd6ce('0x24')],'createdAt':_0x131a6c[_0xd6ce('0x2f')],'updatedAt':_0x131a6c['updatedAt']};return db['sequelize'][_0xd6ce('0x31')](function(_0x1f83a2){return db['CmHopperAdditionalPhone']['update'](_0x436ce8,{'where':{'id':_0x131a6c['id']}},{'transaction':_0x1f83a2})[_0xd6ce('0xb')](function(){return db[_0xd6ce('0x15')][_0xd6ce('0x32')](_0x3b5764,{'where':{'id':_0x5298af['id']}},{'transaction':_0x1f83a2});});})[_0xd6ce('0xb')](function(_0x2ca14a){_0x299d6f({'id':_0x5298af['id'],'phone':_0x131a6c[_0xd6ce('0x2e')]});})[_0xd6ce('0x27')](function(_0x253ce4){logger[_0xd6ce('0x11')]('activateAdditionalPhone',_0x253ce4['message']);_0x476946({'error':_0x253ce4[_0xd6ce('0x12')]});});});}exports[_0xd6ce('0x33')]=function(_0x475633){var _0x3fbf9e=this;return new Promise(function(_0x34f3d3,_0x5e302c){return db[_0xd6ce('0x15')][_0xd6ce('0x32')](_0x475633[_0xd6ce('0x17')][_0xd6ce('0x34')],{'where':{'id':_0x475633[_0xd6ce('0x17')]['id']}})['then'](function(_0x341eae){_0x34f3d3(_0x341eae);})['catch'](function(_0x571a5b){logger[_0xd6ce('0x11')](_0xd6ce('0x33'),_0x571a5b[_0xd6ce('0x12')]);_0x5e302c(_0x3fbf9e[_0xd6ce('0x11')](0x1f4,_0x571a5b['message']));});});}; \ No newline at end of file +var _0x4d11=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','then','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','ASC','countagentrejectretry','entity','catch','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','countcongestionretry','createdAt','updatedAt','phone','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x20d91c,_0x489916){var _0x356505=function(_0x424e57){while(--_0x424e57){_0x20d91c['push'](_0x20d91c['shift']());}};_0x356505(++_0x489916);}(_0x4d11,0x190));var _0x14d1=function(_0x554292,_0x82948a){_0x554292=_0x554292-0x0;var _0x3dd555=_0x4d11[_0x554292];return _0x3dd555;};'use strict';var _=require(_0x14d1('0x0'));var util=require('util');var moment=require(_0x14d1('0x1'));var BPromise=require(_0x14d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14d1('0x3'));var db=require(_0x14d1('0x4'))['db'];var utils=require(_0x14d1('0x5'));var logger=require(_0x14d1('0x6'))(_0x14d1('0x7'));var config=require(_0x14d1('0x8'));var jayson=require(_0x14d1('0x9'));var client=jayson[_0x14d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179162,_0x3b761e,_0x3fe983){return new BPromise(function(_0x43b078,_0x3de8cb){return client[_0x14d1('0xb')](_0x179162,_0x3fe983)['then'](function(_0x842c33){logger[_0x14d1('0xc')](_0x14d1('0xd'),_0x3b761e,_0x14d1('0xe'));logger['debug'](_0x14d1('0xf'),_0x3b761e,'request\x20sent',JSON[_0x14d1('0x10')](_0x842c33));if(_0x842c33[_0x14d1('0x11')]){if(_0x842c33[_0x14d1('0x11')][_0x14d1('0x12')]===0x1f4){logger[_0x14d1('0x11')](_0x14d1('0xd'),_0x3b761e,_0x842c33['error'][_0x14d1('0x13')]);return _0x3de8cb(_0x842c33[_0x14d1('0x11')][_0x14d1('0x13')]);}logger[_0x14d1('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3b761e,_0x842c33[_0x14d1('0x11')][_0x14d1('0x13')]);return _0x43b078(_0x842c33['error'][_0x14d1('0x13')]);}else{logger[_0x14d1('0xc')](_0x14d1('0xd'),_0x3b761e,_0x14d1('0xe'));_0x43b078(_0x842c33[_0x14d1('0x14')][_0x14d1('0x13')]);}})['catch'](function(_0x58bdc0){logger[_0x14d1('0x11')](_0x14d1('0xd'),_0x3b761e,_0x58bdc0);_0x3de8cb(_0x58bdc0);});});}exports[_0x14d1('0x15')]=function(_0x7f7c48){var _0x2fa502=this;return new Promise(function(_0x82c7c9,_0x57422c){return db[_0x14d1('0x16')][_0x14d1('0x17')]({'raw':!![],'where':{'ContactId':_0x7f7c48[_0x14d1('0x18')]['ContactId'],'ListId':_0x7f7c48[_0x14d1('0x18')][_0x14d1('0x19')],'VoiceQueueId':_0x7f7c48[_0x14d1('0x18')][_0x14d1('0x1a')]===undefined?null:_0x7f7c48[_0x14d1('0x18')][_0x14d1('0x1a')],'CampaignId':_0x7f7c48['body'][_0x14d1('0x1b')]===undefined?null:_0x7f7c48[_0x14d1('0x18')][_0x14d1('0x1b')]}})['then'](function(_0x1f9e8e){if(_0x1f9e8e!=null){return db['CmHopperAdditionalPhone'][_0x14d1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1f9e8e['id'],'OrderBy':{'$gt':_0x1f9e8e['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x14d1('0x1c')](function(_0x43e7c0){var _0x2a1d4b=0x0;if(_0x43e7c0){if(_0x43e7c0[_0x14d1('0x1d')]+_0x43e7c0['countcongestionretry']+_0x43e7c0[_0x14d1('0x1e')]+_0x43e7c0[_0x14d1('0x1f')]+_0x43e7c0[_0x14d1('0x20')]+_0x43e7c0[_0x14d1('0x21')]+_0x43e7c0[_0x14d1('0x22')]+_0x43e7c0['countagentrejectretry']<_0x7f7c48['entity'][_0x14d1('0x23')])_0x2a1d4b=0x1;_0x82c7c9({'additional':_0x2a1d4b});}else{return db[_0x14d1('0x24')][_0x14d1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1f9e8e['id']},'order':[[_0x14d1('0x25'),_0x14d1('0x26')]]})[_0x14d1('0x1c')](function(_0x10be93){var _0x3fc2ac=0x0;if(_0x10be93){if(_0x10be93[_0x14d1('0x1d')]+_0x10be93['countcongestionretry']+_0x10be93[_0x14d1('0x1e')]+_0x10be93['countnosuchnumberretry']+_0x10be93[_0x14d1('0x20')]+_0x10be93[_0x14d1('0x21')]+_0x10be93[_0x14d1('0x22')]+_0x10be93[_0x14d1('0x27')]<_0x7f7c48[_0x14d1('0x28')][_0x14d1('0x23')])_0x3fc2ac=0x1;_0x82c7c9({'additional':_0x3fc2ac});}else{_0x82c7c9({'additional':0x0});}})[_0x14d1('0x29')](function(_0x53f43b){logger[_0x14d1('0x11')](_0x14d1('0x15'),_0x53f43b[_0x14d1('0x13')]);_0x57422c(_0x2fa502[_0x14d1('0x11')](0x1f4,_0x53f43b[_0x14d1('0x13')]));});}})[_0x14d1('0x29')](function(_0x3d162a){logger[_0x14d1('0x11')](_0x14d1('0x15'),_0x3d162a[_0x14d1('0x13')]);_0x57422c(_0x2fa502['error'](0x1f4,_0x3d162a[_0x14d1('0x13')]));});}else _0x82c7c9({'additional':0x0});});});};exports[_0x14d1('0x2a')]=function(_0x4006bb){var _0x2e6887=this;return new Promise(function(_0x5f1648,_0x2cbe05){return db[_0x14d1('0x16')][_0x14d1('0x17')]({'raw':!![],'where':{'ContactId':_0x4006bb[_0x14d1('0x18')][_0x14d1('0x2b')],'ListId':_0x4006bb[_0x14d1('0x18')][_0x14d1('0x19')],'VoiceQueueId':_0x4006bb['body']['VoiceQueueId']===undefined?null:_0x4006bb[_0x14d1('0x18')][_0x14d1('0x1a')],'CampaignId':_0x4006bb['body'][_0x14d1('0x1b')]===undefined?null:_0x4006bb[_0x14d1('0x18')][_0x14d1('0x1b')]}})[_0x14d1('0x1c')](function(_0x4910a1){if(_0x4910a1!=null){return db['CmHopperAdditionalPhone'][_0x14d1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4910a1['id'],'OrderBy':{'$gte':_0x4910a1[_0x14d1('0x25')]}},'order':[[_0x14d1('0x25'),_0x14d1('0x26')]]})[_0x14d1('0x1c')](function(_0xd1d7b0){if(_0xd1d7b0)return activateAdditionalPhone(_0x4910a1,_0x4006bb[_0x14d1('0x18')],_0xd1d7b0,_0x4006bb[_0x14d1('0x2c')],_0x4006bb[_0x14d1('0x2d')])[_0x14d1('0x1c')](function(_0x343613){_0x5f1648(_0x343613);});else{return db[_0x14d1('0x24')][_0x14d1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4910a1['id']},'order':[[_0x14d1('0x25'),_0x14d1('0x26')]]})['then'](function(_0x4e2c3d){if(_0x4e2c3d)return activateAdditionalPhone(_0x4910a1,_0x4006bb['body'],_0x4e2c3d,_0x4006bb['duration'],_0x4006bb[_0x14d1('0x2d')])[_0x14d1('0x1c')](function(_0x314a97){_0x5f1648(_0x314a97);});else{_0x5f1648({'id':_0x4910a1['id'],'phone':''});}})[_0x14d1('0x29')](function(_0x8f0e95){logger[_0x14d1('0x11')](_0x14d1('0x15'),_0x8f0e95[_0x14d1('0x13')]);_0x2cbe05(_0x2e6887[_0x14d1('0x11')](0x1f4,_0x8f0e95[_0x14d1('0x13')]));});}})['catch'](function(_0x2ffa33){logger[_0x14d1('0x11')](_0x14d1('0x15'),_0x2ffa33[_0x14d1('0x13')]);_0x2cbe05(_0x2e6887['error'](0x1f4,_0x2ffa33[_0x14d1('0x13')]));});}else _0x5f1648(0x1);});});};function activateAdditionalPhone(_0x8966ab,_0x45948c,_0x108960,_0x2393ba,_0x25da7e){return new Promise(function(_0x3248a6,_0x3f023d){var _0x57dc89;if(_[_0x14d1('0x2e')](_0x108960[_0x14d1('0x2f')])){_0x108960[_0x14d1('0x2f')]=moment();}if(moment()>moment(_0x108960[_0x14d1('0x2f')])){_0x57dc89=moment()[_0x14d1('0x30')](_0x25da7e||0x3,_0x14d1('0x31'));}else{if(_0x108960[_0x14d1('0x25')]==0x0){_0x57dc89=moment(_0x108960[_0x14d1('0x2f')]);}else{_0x57dc89=moment()[_0x14d1('0x30')](_0x25da7e||0x3,'minutes');}}if(_[_0x14d1('0x2e')](_0x57dc89)){_0x57dc89=moment()['add'](_0x25da7e||0x3,_0x14d1('0x31'));}var _0x15214c={'phone':_0x8966ab['phone'],'active':0x0,'OrderBy':_['isNil'](_0x8966ab[_0x14d1('0x25')])?0x0:_0x8966ab[_0x14d1('0x25')],'scheduledat':moment()[_0x14d1('0x30')](_0x2393ba||0x1,_0x14d1('0x31')),'countbusyretry':_0x45948c[_0x14d1('0x1d')],'countcongestionretry':_0x45948c[_0x14d1('0x32')],'countnoanswerretry':_0x45948c['countnoanswerretry'],'countnosuchnumberretry':_0x45948c[_0x14d1('0x1f')],'countdropretry':_0x45948c['countdropretry'],'countabandonedretry':_0x45948c['countabandonedretry'],'countmachineretry':_0x45948c[_0x14d1('0x22')],'countagentrejectretry':_0x45948c['countagentrejectretry'],'createdAt':_0x45948c[_0x14d1('0x33')],'updatedAt':_0x45948c[_0x14d1('0x34')]};var _0x405998={'CmHopperId':_0x8966ab['id'],'phone':_0x108960[_0x14d1('0x35')],'active':0x0,'OrderBy':_['isNil'](_0x108960[_0x14d1('0x25')])?0x0:_0x108960['OrderBy'],'scheduledat':_0x57dc89,'countbusyretry':_0x108960['countbusyretry'],'countcongestionretry':_0x108960[_0x14d1('0x32')],'countnoanswerretry':_0x108960['countnoanswerretry'],'countnosuchnumberretry':_0x108960[_0x14d1('0x1f')],'countdropretry':_0x108960[_0x14d1('0x20')],'countabandonedretry':_0x108960[_0x14d1('0x21')],'countmachineretry':_0x108960[_0x14d1('0x22')],'countagentrejectretry':_0x108960[_0x14d1('0x27')],'createdAt':_0x108960[_0x14d1('0x33')],'updatedAt':_0x108960['updatedAt']};return db[_0x14d1('0x36')]['transaction'](function(_0x2326e9){return db[_0x14d1('0x24')]['update'](_0x15214c,{'where':{'id':_0x108960['id']}},{'transaction':_0x2326e9})[_0x14d1('0x1c')](function(){return db[_0x14d1('0x16')][_0x14d1('0x37')](_0x405998,{'where':{'id':_0x8966ab['id']}},{'transaction':_0x2326e9});});})[_0x14d1('0x1c')](function(_0x596909){_0x3248a6({'id':_0x8966ab['id'],'phone':_0x108960['phone']});})[_0x14d1('0x29')](function(_0x4e9db4){logger[_0x14d1('0x11')](_0x14d1('0x38'),_0x4e9db4[_0x14d1('0x13')]);_0x3f023d({'error':_0x4e9db4[_0x14d1('0x13')]});});});}exports[_0x14d1('0x39')]=function(_0x4010ca){var _0x409428=this;return new Promise(function(_0x32df3b,_0xb68b4f){return db['CmHopper'][_0x14d1('0x37')](_0x4010ca['body'][_0x14d1('0x3a')],{'where':{'id':_0x4010ca[_0x14d1('0x18')]['id']}})[_0x14d1('0x1c')](function(_0x3aa983){_0x32df3b(_0x3aa983);})[_0x14d1('0x29')](function(_0x470b21){logger['error'](_0x14d1('0x39'),_0x470b21['message']);_0xb68b4f(_0x409428[_0x14d1('0x11')](0x1f4,_0x470b21['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d6edf80..040d7dc 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 _0x66d3=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x57f451,_0xc68923){var _0x4f1e17=function(_0xa6d69f){while(--_0xa6d69f){_0x57f451['push'](_0x57f451['shift']());}};_0x4f1e17(++_0xc68923);}(_0x66d3,0x10f));var _0x366d=function(_0x1e0071,_0x4e4914){_0x1e0071=_0x1e0071-0x0;var _0x214d62=_0x66d3[_0x1e0071];return _0x214d62;};'use strict';var multer=require(_0x366d('0x0'));var util=require('util');var path=require(_0x366d('0x1'));var timeout=require('connect-timeout');var express=require(_0x366d('0x2'));var router=express[_0x366d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x366d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x366d('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x366d('0x6')]('/',auth[_0x366d('0x7')](),controller[_0x366d('0x8')]);router[_0x366d('0x6')](_0x366d('0x9'),auth[_0x366d('0x7')](),controller[_0x366d('0xa')]);router[_0x366d('0xb')]('/',auth[_0x366d('0x7')](),controller[_0x366d('0xc')]);router[_0x366d('0xd')]('/:id',auth[_0x366d('0x7')](),controller[_0x366d('0xe')]);router[_0x366d('0xf')](_0x366d('0x9'),auth[_0x366d('0x7')](),controller[_0x366d('0x10')]);module[_0x366d('0x11')]=router; \ No newline at end of file +var _0xc568=['post','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x17a371,_0x438983){var _0x53dbc8=function(_0xd31eb4){while(--_0xd31eb4){_0x17a371['push'](_0x17a371['shift']());}};_0x53dbc8(++_0x438983);}(_0xc568,0x1d4));var _0x8c56=function(_0x1e9246,_0x2e7bc6){_0x1e9246=_0x1e9246-0x0;var _0x27a796=_0xc568[_0x1e9246];return _0x27a796;};'use strict';var multer=require('multer');var util=require(_0x8c56('0x0'));var path=require(_0x8c56('0x1'));var timeout=require(_0x8c56('0x2'));var express=require(_0x8c56('0x3'));var router=express[_0x8c56('0x4')]();var fs_extra=require(_0x8c56('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c56('0x6'));var config=require(_0x8c56('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x8c56('0x8')]('/',auth[_0x8c56('0x9')](),controller['index']);router[_0x8c56('0x8')](_0x8c56('0xa'),auth[_0x8c56('0x9')](),controller[_0x8c56('0xb')]);router[_0x8c56('0xc')]('/',auth[_0x8c56('0x9')](),controller['create']);router['put'](_0x8c56('0xa'),auth[_0x8c56('0x9')](),controller[_0x8c56('0xd')]);router[_0x8c56('0xe')](_0x8c56('0xa'),auth[_0x8c56('0x9')](),controller['destroy']);module[_0x8c56('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index fb536bd..8641ed7 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 _0x5d87=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x4347f7,_0x312ff8){var _0x43349a=function(_0x13a1ee){while(--_0x13a1ee){_0x4347f7['push'](_0x4347f7['shift']());}};_0x43349a(++_0x312ff8);}(_0x5d87,0x16b));var _0x75d8=function(_0x41fca8,_0x298744){_0x41fca8=_0x41fca8-0x0;var _0x115c22=_0x5d87[_0x41fca8];return _0x115c22;};'use strict';var moment=require(_0x75d8('0x0'));var Sequelize=require(_0x75d8('0x1'));module[_0x75d8('0x2')]={'phone':{'type':Sequelize[_0x75d8('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x75d8('0x4')],'unique':_0x75d8('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x75d8('0x5')},'VoiceQueueId':{'type':Sequelize[_0x75d8('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x1115=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1115,0x1b6));var _0x5111=function(_0x15433a,_0x1346f0){_0x15433a=_0x15433a-0x0;var _0x56f966=_0x1115[_0x15433a];return _0x56f966;};'use strict';var moment=require('moment');var Sequelize=require(_0x5111('0x0'));module[_0x5111('0x1')]={'phone':{'type':Sequelize[_0x5111('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5111('0x3')],'unique':_0x5111('0x4')},'ListId':{'type':Sequelize[_0x5111('0x3')],'unique':_0x5111('0x4')},'VoiceQueueId':{'type':Sequelize[_0x5111('0x3')],'unique':_0x5111('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 15fe76e..ee0be3d 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 _0x1d7e=['rawAttributes','includeAll','find','catch','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','include','rows','show'];(function(_0x37f34e,_0xad7732){var _0x9814bc=function(_0x5c476b){while(--_0x5c476b){_0x37f34e['push'](_0x37f34e['shift']());}};_0x9814bc(++_0xad7732);}(_0x1d7e,0xa2));var _0xe1d7=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x1d7e[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0xe1d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe1d7('0x1'));var jsonpatch=require(_0xe1d7('0x2'));var rp=require(_0xe1d7('0x3'));var moment=require(_0xe1d7('0x4'));var BPromise=require(_0xe1d7('0x5'));var Mustache=require(_0xe1d7('0x6'));var util=require(_0xe1d7('0x7'));var path=require(_0xe1d7('0x8'));var sox=require(_0xe1d7('0x9'));var csv=require(_0xe1d7('0xa'));var ejs=require(_0xe1d7('0xb'));var fs=require('fs');var fs_extra=require(_0xe1d7('0xc'));var _=require(_0xe1d7('0xd'));var squel=require(_0xe1d7('0xe'));var crypto=require('crypto');var jsforce=require(_0xe1d7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe1d7('0x10'));var Papa=require(_0xe1d7('0x11'));var Redis=require(_0xe1d7('0x12'));var authService=require(_0xe1d7('0x13'));var qs=require(_0xe1d7('0x14'));var as=require(_0xe1d7('0x15'));var hardwareService=require(_0xe1d7('0x16'));var logger=require('../../config/logger')(_0xe1d7('0x17'));var utils=require(_0xe1d7('0x18'));var config=require(_0xe1d7('0x19'));var licenseUtil=require(_0xe1d7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b4e47,_0x1bd46a){_0x1bd46a=_0x1bd46a||0xcc;return function(_0x2d717a){if(_0x2d717a){return _0x2b4e47[_0xe1d7('0x1b')](_0x1bd46a);}return _0x2b4e47[_0xe1d7('0x1c')](_0x1bd46a)[_0xe1d7('0x1d')]();};}function respondWithResult(_0x1b8273,_0x3280b5){_0x3280b5=_0x3280b5||0xc8;return function(_0x5833f4){if(_0x5833f4){return _0x1b8273['status'](_0x3280b5)[_0xe1d7('0x1e')](_0x5833f4);}};}function respondWithFilteredResult(_0x45480b,_0x4f1332){return function(_0x20770e){if(_0x20770e){var _0x4c2567=typeof _0x4f1332[_0xe1d7('0x1f')]==='undefined'&&typeof _0x4f1332[_0xe1d7('0x20')]===_0xe1d7('0x21');var _0x34e97c=_0x20770e[_0xe1d7('0x22')];var _0x5f3cd6=_0x4c2567?0x0:_0x4f1332[_0xe1d7('0x1f')];var _0x150c74=_0x4c2567?_0x20770e[_0xe1d7('0x22')]:_0x4f1332[_0xe1d7('0x1f')]+_0x4f1332[_0xe1d7('0x20')];var _0xe4027b;if(_0x150c74>=_0x34e97c){_0x150c74=_0x34e97c;_0xe4027b=0xc8;}else{_0xe4027b=0xce;}_0x45480b['status'](_0xe4027b);return _0x45480b['set'](_0xe1d7('0x23'),_0x5f3cd6+'-'+_0x150c74+'/'+_0x34e97c)[_0xe1d7('0x1e')](_0x20770e);}return null;};}function patchUpdates(_0x5bf331){return function(_0xae39be){try{jsonpatch['apply'](_0xae39be,_0x5bf331,!![]);}catch(_0x4860eb){return BPromise[_0xe1d7('0x24')](_0x4860eb);}return _0xae39be[_0xe1d7('0x25')]();};}function saveUpdates(_0x343212,_0x39ff8b){return function(_0x22dbfc){if(_0x22dbfc){return _0x22dbfc[_0xe1d7('0x26')](_0x343212)[_0xe1d7('0x27')](function(_0x185ae4){return _0x185ae4;});}return null;};}function removeEntity(_0x193174,_0x37a2a9){return function(_0x5ea552){if(_0x5ea552){return _0x5ea552['destroy']()[_0xe1d7('0x27')](function(){_0x193174['status'](0xcc)[_0xe1d7('0x1d')]();});}};}function handleEntityNotFound(_0x30abf1,_0x7444d4){return function(_0x10a0a0){if(!_0x10a0a0){_0x30abf1[_0xe1d7('0x1b')](0x194);}return _0x10a0a0;};}function handleError(_0x5ba844,_0xcf7494){_0xcf7494=_0xcf7494||0x1f4;return function(_0x3ea1ad){logger['error'](_0x3ea1ad['stack']);if(_0x3ea1ad[_0xe1d7('0x28')]){delete _0x3ea1ad[_0xe1d7('0x28')];}_0x5ba844[_0xe1d7('0x1c')](_0xcf7494)[_0xe1d7('0x29')](_0x3ea1ad);};}exports[_0xe1d7('0x2a')]=function(_0x45bcb1,_0x1fbebc){var _0x350cb3={},_0x101671={},_0x4b0779={'count':0x0,'rows':[]};var _0x2666a7=_[_0xe1d7('0x2b')](db['CmHopperBlack']['rawAttributes'],function(_0x285ac9){return{'name':_0x285ac9[_0xe1d7('0x2c')],'type':_0x285ac9['type'][_0xe1d7('0x2d')]};});_0x101671[_0xe1d7('0x2e')]=_[_0xe1d7('0x2b')](_0x2666a7,_0xe1d7('0x28'));_0x101671[_0xe1d7('0x2f')]=_[_0xe1d7('0x30')](_0x45bcb1[_0xe1d7('0x2f')]);_0x101671[_0xe1d7('0x31')]=_['intersection'](_0x101671[_0xe1d7('0x2e')],_0x101671[_0xe1d7('0x2f')]);_0x350cb3['attributes']=_[_0xe1d7('0x32')](_0x101671[_0xe1d7('0x2e')],qs[_0xe1d7('0x33')](_0x45bcb1[_0xe1d7('0x2f')]['fields']));_0x350cb3[_0xe1d7('0x34')]=_0x350cb3[_0xe1d7('0x34')][_0xe1d7('0x35')]?_0x350cb3[_0xe1d7('0x34')]:_0x101671['model'];if(!_0x45bcb1[_0xe1d7('0x2f')][_0xe1d7('0x36')](_0xe1d7('0x37'))){_0x350cb3[_0xe1d7('0x20')]=qs[_0xe1d7('0x20')](_0x45bcb1['query'][_0xe1d7('0x20')]);_0x350cb3[_0xe1d7('0x1f')]=qs['offset'](_0x45bcb1[_0xe1d7('0x2f')][_0xe1d7('0x1f')]);}_0x350cb3[_0xe1d7('0x38')]=qs[_0xe1d7('0x39')](_0x45bcb1[_0xe1d7('0x2f')][_0xe1d7('0x39')]);_0x350cb3[_0xe1d7('0x3a')]=qs[_0xe1d7('0x31')](_[_0xe1d7('0x3b')](_0x45bcb1['query'],_0x101671['filters']),_0x2666a7);if(_0x45bcb1[_0xe1d7('0x2f')][_0xe1d7('0x3c')]){_0x350cb3[_0xe1d7('0x3a')]=_[_0xe1d7('0x3d')](_0x350cb3['where'],{'$or':_[_0xe1d7('0x2b')](_0x2666a7,function(_0x46b7a4){if(_0x46b7a4[_0xe1d7('0x3e')]!==_0xe1d7('0x3f')){var _0x32936c={};_0x32936c[_0x46b7a4['name']]={'$like':'%'+_0x45bcb1['query'][_0xe1d7('0x3c')]+'%'};return _0x32936c;}})});}_0x350cb3=_['merge']({},_0x350cb3,_0x45bcb1[_0xe1d7('0x40')]);var _0x445fb6={'where':_0x350cb3['where']};return db[_0xe1d7('0x41')][_0xe1d7('0x22')](_0x445fb6)[_0xe1d7('0x27')](function(_0xc0c88){_0x4b0779[_0xe1d7('0x22')]=_0xc0c88;if(_0x45bcb1['query']['includeAll']){_0x350cb3[_0xe1d7('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x350cb3);})[_0xe1d7('0x27')](function(_0xa03581){_0x4b0779[_0xe1d7('0x43')]=_0xa03581;return _0x4b0779;})['then'](respondWithFilteredResult(_0x1fbebc,_0x350cb3))['catch'](handleError(_0x1fbebc,null));};exports[_0xe1d7('0x44')]=function(_0x5b9c15,_0x4283db){var _0xdf1217={'raw':!![],'where':{'id':_0x5b9c15['params']['id']}},_0x140ad9={};_0x140ad9['model']=_[_0xe1d7('0x30')](db[_0xe1d7('0x41')][_0xe1d7('0x45')]);_0x140ad9['query']=_[_0xe1d7('0x30')](_0x5b9c15[_0xe1d7('0x2f')]);_0x140ad9[_0xe1d7('0x31')]=_[_0xe1d7('0x32')](_0x140ad9[_0xe1d7('0x2e')],_0x140ad9[_0xe1d7('0x2f')]);_0xdf1217[_0xe1d7('0x34')]=_[_0xe1d7('0x32')](_0x140ad9[_0xe1d7('0x2e')],qs[_0xe1d7('0x33')](_0x5b9c15[_0xe1d7('0x2f')][_0xe1d7('0x33')]));_0xdf1217[_0xe1d7('0x34')]=_0xdf1217[_0xe1d7('0x34')]['length']?_0xdf1217[_0xe1d7('0x34')]:_0x140ad9['model'];if(_0x5b9c15[_0xe1d7('0x2f')][_0xe1d7('0x46')]){_0xdf1217[_0xe1d7('0x42')]=[{'all':!![]}];}_0xdf1217=_[_0xe1d7('0x3d')]({},_0xdf1217,_0x5b9c15[_0xe1d7('0x40')]);return db[_0xe1d7('0x41')][_0xe1d7('0x47')](_0xdf1217)[_0xe1d7('0x27')](handleEntityNotFound(_0x4283db,null))[_0xe1d7('0x27')](respondWithResult(_0x4283db,null))[_0xe1d7('0x48')](handleError(_0x4283db,null));};exports['update']=function(_0xd9a698,_0x265297){if(_0xd9a698[_0xe1d7('0x49')]['id']){delete _0xd9a698[_0xe1d7('0x49')]['id'];}return db['CmHopperBlack'][_0xe1d7('0x47')]({'where':{'id':_0xd9a698[_0xe1d7('0x4a')]['id']}})[_0xe1d7('0x27')](handleEntityNotFound(_0x265297,null))[_0xe1d7('0x27')](saveUpdates(_0xd9a698[_0xe1d7('0x49')],null))[_0xe1d7('0x27')](respondWithResult(_0x265297,null))[_0xe1d7('0x48')](handleError(_0x265297,null));};exports[_0xe1d7('0x4b')]=function(_0x18795a,_0xc23fc8){return db[_0xe1d7('0x41')][_0xe1d7('0x47')]({'where':{'id':_0x18795a['params']['id']}})[_0xe1d7('0x27')](handleEntityNotFound(_0xc23fc8,null))['then'](removeEntity(_0xc23fc8,null))[_0xe1d7('0x48')](handleError(_0xc23fc8,null));};exports['describe']=function(_0x104e57,_0x488267){return db[_0xe1d7('0x41')][_0xe1d7('0x4c')]()[_0xe1d7('0x27')](respondWithResult(_0x488267,null))[_0xe1d7('0x48')](handleError(_0x488267,null));}; \ No newline at end of file +var _0x90ec=['map','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','body','describe','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','CmHopperBlack','fieldName','type','key'];(function(_0x24e0a2,_0x26e278){var _0x17b4c0=function(_0x4e1663){while(--_0x4e1663){_0x24e0a2['push'](_0x24e0a2['shift']());}};_0x17b4c0(++_0x26e278);}(_0x90ec,0x159));var _0xc90e=function(_0x9731b4,_0x26aac3){_0x9731b4=_0x9731b4-0x0;var _0x3d7a66=_0x90ec[_0x9731b4];return _0x3d7a66;};'use strict';var emlformat=require(_0xc90e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc90e('0x1'));var rp=require(_0xc90e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc90e('0x3'));var util=require(_0xc90e('0x4'));var path=require(_0xc90e('0x5'));var sox=require(_0xc90e('0x6'));var csv=require(_0xc90e('0x7'));var ejs=require(_0xc90e('0x8'));var fs=require('fs');var fs_extra=require(_0xc90e('0x9'));var _=require(_0xc90e('0xa'));var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc90e('0xe'));var Papa=require(_0xc90e('0xf'));var Redis=require(_0xc90e('0x10'));var authService=require(_0xc90e('0x11'));var qs=require(_0xc90e('0x12'));var as=require(_0xc90e('0x13'));var hardwareService=require(_0xc90e('0x14'));var logger=require(_0xc90e('0x15'))(_0xc90e('0x16'));var utils=require(_0xc90e('0x17'));var config=require(_0xc90e('0x18'));var licenseUtil=require(_0xc90e('0x19'));var db=require(_0xc90e('0x1a'))['db'];function respondWithStatusCode(_0x1d33de,_0x1f3819){_0x1f3819=_0x1f3819||0xcc;return function(_0x560282){if(_0x560282){return _0x1d33de[_0xc90e('0x1b')](_0x1f3819);}return _0x1d33de[_0xc90e('0x1c')](_0x1f3819)['end']();};}function respondWithResult(_0x99ad50,_0x3fb5dd){_0x3fb5dd=_0x3fb5dd||0xc8;return function(_0x318028){if(_0x318028){return _0x99ad50[_0xc90e('0x1c')](_0x3fb5dd)[_0xc90e('0x1d')](_0x318028);}};}function respondWithFilteredResult(_0x119259,_0x1ad736){return function(_0x3625c2){if(_0x3625c2){var _0x122518=typeof _0x1ad736[_0xc90e('0x1e')]===_0xc90e('0x1f')&&typeof _0x1ad736['limit']===_0xc90e('0x1f');var _0x1310b2=_0x3625c2[_0xc90e('0x20')];var _0x2104f9=_0x122518?0x0:_0x1ad736['offset'];var _0x267ec4=_0x122518?_0x3625c2[_0xc90e('0x20')]:_0x1ad736[_0xc90e('0x1e')]+_0x1ad736[_0xc90e('0x21')];var _0x32b737;if(_0x267ec4>=_0x1310b2){_0x267ec4=_0x1310b2;_0x32b737=0xc8;}else{_0x32b737=0xce;}_0x119259[_0xc90e('0x1c')](_0x32b737);return _0x119259['set'](_0xc90e('0x22'),_0x2104f9+'-'+_0x267ec4+'/'+_0x1310b2)['json'](_0x3625c2);}return null;};}function patchUpdates(_0x370d9c){return function(_0x1fe80f){try{jsonpatch[_0xc90e('0x23')](_0x1fe80f,_0x370d9c,!![]);}catch(_0x5ac0d3){return BPromise[_0xc90e('0x24')](_0x5ac0d3);}return _0x1fe80f[_0xc90e('0x25')]();};}function saveUpdates(_0x43712f,_0x4452b7){return function(_0x156270){if(_0x156270){return _0x156270[_0xc90e('0x26')](_0x43712f)[_0xc90e('0x27')](function(_0x475147){return _0x475147;});}return null;};}function removeEntity(_0x401caf,_0x569da6){return function(_0x2af416){if(_0x2af416){return _0x2af416[_0xc90e('0x28')]()[_0xc90e('0x27')](function(){_0x401caf[_0xc90e('0x1c')](0xcc)[_0xc90e('0x29')]();});}};}function handleEntityNotFound(_0x1a53c6,_0x283245){return function(_0x27d4ed){if(!_0x27d4ed){_0x1a53c6[_0xc90e('0x1b')](0x194);}return _0x27d4ed;};}function handleError(_0x4ac00b,_0x279103){_0x279103=_0x279103||0x1f4;return function(_0x12362e){logger[_0xc90e('0x2a')](_0x12362e[_0xc90e('0x2b')]);if(_0x12362e[_0xc90e('0x2c')]){delete _0x12362e[_0xc90e('0x2c')];}_0x4ac00b['status'](_0x279103)[_0xc90e('0x2d')](_0x12362e);};}exports['index']=function(_0x17cb7c,_0x2de438){var _0x323ce3={},_0x300eec={},_0x7cf531={'count':0x0,'rows':[]};var _0x3444b2=_['map'](db[_0xc90e('0x2e')]['rawAttributes'],function(_0x54a76e){return{'name':_0x54a76e[_0xc90e('0x2f')],'type':_0x54a76e[_0xc90e('0x30')][_0xc90e('0x31')]};});_0x300eec['model']=_[_0xc90e('0x32')](_0x3444b2,_0xc90e('0x2c'));_0x300eec['query']=_['keys'](_0x17cb7c['query']);_0x300eec[_0xc90e('0x33')]=_[_0xc90e('0x34')](_0x300eec[_0xc90e('0x35')],_0x300eec[_0xc90e('0x36')]);_0x323ce3[_0xc90e('0x37')]=_['intersection'](_0x300eec['model'],qs[_0xc90e('0x38')](_0x17cb7c['query'][_0xc90e('0x38')]));_0x323ce3[_0xc90e('0x37')]=_0x323ce3['attributes'][_0xc90e('0x39')]?_0x323ce3[_0xc90e('0x37')]:_0x300eec[_0xc90e('0x35')];if(!_0x17cb7c[_0xc90e('0x36')][_0xc90e('0x3a')]('nolimit')){_0x323ce3[_0xc90e('0x21')]=qs[_0xc90e('0x21')](_0x17cb7c[_0xc90e('0x36')]['limit']);_0x323ce3['offset']=qs[_0xc90e('0x1e')](_0x17cb7c[_0xc90e('0x36')][_0xc90e('0x1e')]);}_0x323ce3[_0xc90e('0x3b')]=qs[_0xc90e('0x3c')](_0x17cb7c[_0xc90e('0x36')]['sort']);_0x323ce3[_0xc90e('0x3d')]=qs[_0xc90e('0x33')](_[_0xc90e('0x3e')](_0x17cb7c['query'],_0x300eec['filters']),_0x3444b2);if(_0x17cb7c[_0xc90e('0x36')][_0xc90e('0x3f')]){_0x323ce3[_0xc90e('0x3d')]=_[_0xc90e('0x40')](_0x323ce3[_0xc90e('0x3d')],{'$or':_['map'](_0x3444b2,function(_0x4da722){if(_0x4da722[_0xc90e('0x30')]!==_0xc90e('0x41')){var _0x26763d={};_0x26763d[_0x4da722[_0xc90e('0x2c')]]={'$like':'%'+_0x17cb7c['query']['filter']+'%'};return _0x26763d;}})});}_0x323ce3=_['merge']({},_0x323ce3,_0x17cb7c[_0xc90e('0x42')]);var _0x2b069e={'where':_0x323ce3['where']};return db[_0xc90e('0x2e')][_0xc90e('0x20')](_0x2b069e)[_0xc90e('0x27')](function(_0xb8e375){_0x7cf531[_0xc90e('0x20')]=_0xb8e375;if(_0x17cb7c[_0xc90e('0x36')][_0xc90e('0x43')]){_0x323ce3[_0xc90e('0x44')]=[{'all':!![]}];}return db[_0xc90e('0x2e')][_0xc90e('0x45')](_0x323ce3);})['then'](function(_0x387c58){_0x7cf531[_0xc90e('0x46')]=_0x387c58;return _0x7cf531;})[_0xc90e('0x27')](respondWithFilteredResult(_0x2de438,_0x323ce3))[_0xc90e('0x47')](handleError(_0x2de438,null));};exports[_0xc90e('0x48')]=function(_0x3f0e0a,_0x496a18){var _0x3eb921={'raw':!![],'where':{'id':_0x3f0e0a[_0xc90e('0x49')]['id']}},_0x22b460={};_0x22b460[_0xc90e('0x35')]=_['keys'](db[_0xc90e('0x2e')][_0xc90e('0x4a')]);_0x22b460[_0xc90e('0x36')]=_[_0xc90e('0x4b')](_0x3f0e0a[_0xc90e('0x36')]);_0x22b460['filters']=_[_0xc90e('0x34')](_0x22b460[_0xc90e('0x35')],_0x22b460[_0xc90e('0x36')]);_0x3eb921['attributes']=_[_0xc90e('0x34')](_0x22b460[_0xc90e('0x35')],qs['fields'](_0x3f0e0a['query'][_0xc90e('0x38')]));_0x3eb921[_0xc90e('0x37')]=_0x3eb921['attributes'][_0xc90e('0x39')]?_0x3eb921[_0xc90e('0x37')]:_0x22b460[_0xc90e('0x35')];if(_0x3f0e0a[_0xc90e('0x36')][_0xc90e('0x43')]){_0x3eb921['include']=[{'all':!![]}];}_0x3eb921=_[_0xc90e('0x40')]({},_0x3eb921,_0x3f0e0a[_0xc90e('0x42')]);return db[_0xc90e('0x2e')][_0xc90e('0x4c')](_0x3eb921)['then'](handleEntityNotFound(_0x496a18,null))[_0xc90e('0x27')](respondWithResult(_0x496a18,null))[_0xc90e('0x47')](handleError(_0x496a18,null));};exports[_0xc90e('0x26')]=function(_0x1d5110,_0x2d2d3c){if(_0x1d5110[_0xc90e('0x4d')]['id']){delete _0x1d5110[_0xc90e('0x4d')]['id'];}return db['CmHopperBlack'][_0xc90e('0x4c')]({'where':{'id':_0x1d5110[_0xc90e('0x49')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x2d2d3c,null))[_0xc90e('0x27')](saveUpdates(_0x1d5110[_0xc90e('0x4d')],null))[_0xc90e('0x27')](respondWithResult(_0x2d2d3c,null))[_0xc90e('0x47')](handleError(_0x2d2d3c,null));};exports[_0xc90e('0x28')]=function(_0x17099f,_0x3392f4){return db[_0xc90e('0x2e')][_0xc90e('0x4c')]({'where':{'id':_0x17099f['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x3392f4,null))['then'](removeEntity(_0x3392f4,null))[_0xc90e('0x47')](handleError(_0x3392f4,null));};exports[_0xc90e('0x4e')]=function(_0x44ba87,_0x39ad02){return db[_0xc90e('0x2e')][_0xc90e('0x4e')]()['then'](respondWithResult(_0x39ad02,null))[_0xc90e('0x47')](handleError(_0x39ad02,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5edff88..19b710b 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 _0x66e2=['rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0x66e2,0x177));var _0x266e=function(_0x16e73a,_0x146629){_0x16e73a=_0x16e73a-0x0;var _0x187aa1=_0x66e2[_0x16e73a];return _0x187aa1;};'use strict';var _=require(_0x266e('0x0'));var util=require(_0x266e('0x1'));var logger=require(_0x266e('0x2'))('api');var moment=require(_0x266e('0x3'));var BPromise=require(_0x266e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x266e('0x5'));var config=require(_0x266e('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x266e('0x7')]=function(_0x4fc6ec,_0x54fe78){return _0x4fc6ec['define'](_0x266e('0x8'),attributes,{'tableName':_0x266e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cef=['moment','bluebird','path','exports','define','CmHopperBlack','util','api'];(function(_0x464255,_0x49c426){var _0x97ce7d=function(_0x79214b){while(--_0x79214b){_0x464255['push'](_0x464255['shift']());}};_0x97ce7d(++_0x49c426);}(_0x3cef,0x76));var _0xf3ce=function(_0x899ec1,_0x98b19f){_0x899ec1=_0x899ec1-0x0;var _0x45c434=_0x3cef[_0x899ec1];return _0x45c434;};'use strict';var _=require('lodash');var util=require(_0xf3ce('0x0'));var logger=require('../../config/logger')(_0xf3ce('0x1'));var moment=require(_0xf3ce('0x2'));var BPromise=require(_0xf3ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ce('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xf3ce('0x5')]=function(_0x4dcffb,_0x153891){return _0x4dcffb[_0xf3ce('0x6')](_0xf3ce('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index b9e4772..a4a2114 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 _0x9f0c=['http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopperBlack','debug','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4f1f8d,_0x1f8bb8){var _0x3756e6=function(_0x312ba1){while(--_0x312ba1){_0x4f1f8d['push'](_0x4f1f8d['shift']());}};_0x3756e6(++_0x1f8bb8);}(_0x9f0c,0x184));var _0xc9f0=function(_0x502388,_0x2f109a){_0x502388=_0x502388-0x0;var _0x42a766=_0x9f0c[_0x502388];return _0x42a766;};'use strict';var _=require(_0xc9f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc9f0('0x1'));var rs=require(_0xc9f0('0x2'));var fs=require('fs');var Redis=require(_0xc9f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc9f0('0x4'))(_0xc9f0('0x5'));var config=require(_0xc9f0('0x6'));var jayson=require(_0xc9f0('0x7'));var client=jayson['client'][_0xc9f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x455060,_0x3ccfdb,_0x439754){return new BPromise(function(_0x2e3162,_0x29fd24){return client['request'](_0x455060,_0x439754)['then'](function(_0x5cb5bb){logger[_0xc9f0('0x9')](_0xc9f0('0xa'),_0x3ccfdb,_0xc9f0('0xb'));logger['debug'](_0xc9f0('0xc'),_0x3ccfdb,_0xc9f0('0xb'),JSON[_0xc9f0('0xd')](_0x5cb5bb));if(_0x5cb5bb[_0xc9f0('0xe')]){if(_0x5cb5bb[_0xc9f0('0xe')][_0xc9f0('0xf')]===0x1f4){logger['error'](_0xc9f0('0xa'),_0x3ccfdb,_0x5cb5bb[_0xc9f0('0xe')]['message']);return _0x29fd24(_0x5cb5bb[_0xc9f0('0xe')][_0xc9f0('0x10')]);}logger[_0xc9f0('0xe')](_0xc9f0('0xa'),_0x3ccfdb,_0x5cb5bb[_0xc9f0('0xe')][_0xc9f0('0x10')]);return _0x2e3162(_0x5cb5bb[_0xc9f0('0xe')]['message']);}else{logger[_0xc9f0('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x3ccfdb,_0xc9f0('0xb'));_0x2e3162(_0x5cb5bb[_0xc9f0('0x11')][_0xc9f0('0x10')]);}})['catch'](function(_0x91e56b){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3ccfdb,_0x91e56b);_0x29fd24(_0x91e56b);});});}exports['GetCmHopperBlack']=function(_0xca6db0){var _0x2d0dc5=this;return new Promise(function(_0x260559,_0x4f839f){return db[_0xc9f0('0x12')][_0xc9f0('0x13')]({'raw':_0xca6db0['options']?_0xca6db0[_0xc9f0('0x14')][_0xc9f0('0x15')]===undefined?!![]:![]:!![],'where':_0xca6db0[_0xc9f0('0x14')]?_0xca6db0[_0xc9f0('0x14')][_0xc9f0('0x16')]||null:null,'attributes':_0xca6db0[_0xc9f0('0x14')]?_0xca6db0[_0xc9f0('0x14')][_0xc9f0('0x17')]||null:null,'limit':_0xca6db0['options']?_0xca6db0[_0xc9f0('0x14')][_0xc9f0('0x18')]||null:null,'include':_0xca6db0[_0xc9f0('0x14')]?_0xca6db0[_0xc9f0('0x14')][_0xc9f0('0x19')]?_[_0xc9f0('0x1a')](_0xca6db0[_0xc9f0('0x14')]['include'],function(_0x721f40){return{'model':db[_0x721f40[_0xc9f0('0x1b')]],'as':_0x721f40['as'],'attributes':_0x721f40[_0xc9f0('0x17')],'include':_0x721f40[_0xc9f0('0x19')]?_[_0xc9f0('0x1a')](_0x721f40[_0xc9f0('0x19')],function(_0x266602){return{'model':db[_0x266602[_0xc9f0('0x1b')]],'as':_0x266602['as'],'attributes':_0x266602[_0xc9f0('0x17')],'include':_0x266602[_0xc9f0('0x19')]?_[_0xc9f0('0x1a')](_0x266602[_0xc9f0('0x19')],function(_0x4e878b){return{'model':db[_0x4e878b[_0xc9f0('0x1b')]],'as':_0x4e878b['as'],'attributes':_0x4e878b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9f0('0x1c')](function(_0x172f1b){logger[_0xc9f0('0x9')](_0xc9f0('0x1d'),_0xca6db0);logger[_0xc9f0('0x1e')](_0xc9f0('0x1d'),_0xca6db0,JSON['stringify'](_0x172f1b));_0x260559(_0x172f1b);})[_0xc9f0('0x1f')](function(_0x3e9568){logger['error'](_0xc9f0('0x1d'),_0x3e9568[_0xc9f0('0x10')],_0xca6db0);_0x4f839f(_0x2d0dc5[_0xc9f0('0xe')](0x1f4,_0x3e9568[_0xc9f0('0x10')]));});});};exports[_0xc9f0('0x20')]=function(_0x5664e2){var _0x5a96fd=this;return new Promise(function(_0x28d09b,_0x57a8a1){return db['CmHopperBlack'][_0xc9f0('0x21')](_0x5664e2[_0xc9f0('0x22')],{'raw':_0x5664e2['options']?_0x5664e2[_0xc9f0('0x14')][_0xc9f0('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5664e2[_0xc9f0('0x14')]?_0x5664e2[_0xc9f0('0x14')]['where']||null:null,'attributes':_0x5664e2['options']?_0x5664e2['options'][_0xc9f0('0x17')]||null:null,'limit':_0x5664e2[_0xc9f0('0x14')]?_0x5664e2[_0xc9f0('0x14')][_0xc9f0('0x18')]||null:null})[_0xc9f0('0x1c')](function(_0x288f8){logger['info'](_0xc9f0('0x20'),_0x5664e2);logger['debug'](_0xc9f0('0x20'),_0x5664e2,JSON[_0xc9f0('0xd')](_0x288f8));_0x28d09b(_0x288f8);})[_0xc9f0('0x1f')](function(_0x3a1746){logger[_0xc9f0('0xe')](_0xc9f0('0x20'),_0x3a1746[_0xc9f0('0x10')],_0x5664e2);_0x57a8a1(_0x5a96fd[_0xc9f0('0xe')](0x1f4,_0x3a1746[_0xc9f0('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x514eb0){var _0x3c2bdc=this;return new Promise(function(_0x46196f,_0x4f7a6b){return db['CmHopperBlack']['destroy']({'where':_0x514eb0[_0xc9f0('0x14')]?_0x514eb0[_0xc9f0('0x14')][_0xc9f0('0x16')]||null:null})[_0xc9f0('0x1c')](function(_0x35e719){logger[_0xc9f0('0x9')](_0xc9f0('0x23'),_0x514eb0);logger[_0xc9f0('0x1e')](_0xc9f0('0x23'),_0x514eb0,JSON[_0xc9f0('0xd')](_0x35e719));_0x46196f(_0x35e719);})[_0xc9f0('0x1f')](function(_0x27f4f9){logger['error'](_0xc9f0('0x23'),_0x27f4f9[_0xc9f0('0x10')],_0x514eb0);_0x4f7a6b(_0x3c2bdc['error'](0x1f4,_0x27f4f9['message']));});});}; \ No newline at end of file +var _0xedac=['info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedac,0xf7));var _0xceda=function(_0x28abdd,_0x827f49){_0x28abdd=_0x28abdd-0x0;var _0x19a4c1=_0xedac[_0x28abdd];return _0x19a4c1;};'use strict';var _=require(_0xceda('0x0'));var util=require(_0xceda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xceda('0x2'));var fs=require('fs');var Redis=require(_0xceda('0x3'));var db=require(_0xceda('0x4'))['db'];var utils=require(_0xceda('0x5'));var logger=require(_0xceda('0x6'))(_0xceda('0x7'));var config=require(_0xceda('0x8'));var jayson=require(_0xceda('0x9'));var client=jayson[_0xceda('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x196ada,_0x3ed9a1,_0x231609){return new BPromise(function(_0x43e1e4,_0x99f05){return client['request'](_0x196ada,_0x231609)[_0xceda('0xb')](function(_0x401149){logger[_0xceda('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x3ed9a1,'request\x20sent');logger[_0xceda('0xd')](_0xceda('0xe'),_0x3ed9a1,_0xceda('0xf'),JSON[_0xceda('0x10')](_0x401149));if(_0x401149['error']){if(_0x401149[_0xceda('0x11')]['code']===0x1f4){logger[_0xceda('0x11')](_0xceda('0x12'),_0x3ed9a1,_0x401149['error'][_0xceda('0x13')]);return _0x99f05(_0x401149[_0xceda('0x11')][_0xceda('0x13')]);}logger['error'](_0xceda('0x12'),_0x3ed9a1,_0x401149['error'][_0xceda('0x13')]);return _0x43e1e4(_0x401149[_0xceda('0x11')][_0xceda('0x13')]);}else{logger[_0xceda('0xc')](_0xceda('0x12'),_0x3ed9a1,_0xceda('0xf'));_0x43e1e4(_0x401149[_0xceda('0x14')][_0xceda('0x13')]);}})[_0xceda('0x15')](function(_0x4fbfa8){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3ed9a1,_0x4fbfa8);_0x99f05(_0x4fbfa8);});});}exports['GetCmHopperBlack']=function(_0x59f0ee){var _0x165d38=this;return new Promise(function(_0x4fadd7,_0x3e101b){return db[_0xceda('0x16')][_0xceda('0x17')]({'raw':_0x59f0ee[_0xceda('0x18')]?_0x59f0ee[_0xceda('0x18')][_0xceda('0x19')]===undefined?!![]:![]:!![],'where':_0x59f0ee[_0xceda('0x18')]?_0x59f0ee[_0xceda('0x18')][_0xceda('0x1a')]||null:null,'attributes':_0x59f0ee[_0xceda('0x18')]?_0x59f0ee[_0xceda('0x18')][_0xceda('0x1b')]||null:null,'limit':_0x59f0ee[_0xceda('0x18')]?_0x59f0ee[_0xceda('0x18')][_0xceda('0x1c')]||null:null,'include':_0x59f0ee[_0xceda('0x18')]?_0x59f0ee['options'][_0xceda('0x1d')]?_[_0xceda('0x1e')](_0x59f0ee[_0xceda('0x18')][_0xceda('0x1d')],function(_0x2025a0){return{'model':db[_0x2025a0[_0xceda('0x1f')]],'as':_0x2025a0['as'],'attributes':_0x2025a0[_0xceda('0x1b')],'include':_0x2025a0[_0xceda('0x1d')]?_[_0xceda('0x1e')](_0x2025a0[_0xceda('0x1d')],function(_0x4cdb1f){return{'model':db[_0x4cdb1f['model']],'as':_0x4cdb1f['as'],'attributes':_0x4cdb1f[_0xceda('0x1b')],'include':_0x4cdb1f[_0xceda('0x1d')]?_[_0xceda('0x1e')](_0x4cdb1f[_0xceda('0x1d')],function(_0x14bf9c){return{'model':db[_0x14bf9c['model']],'as':_0x14bf9c['as'],'attributes':_0x14bf9c[_0xceda('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xceda('0xb')](function(_0x5a088d){logger['info'](_0xceda('0x20'),_0x59f0ee);logger[_0xceda('0xd')](_0xceda('0x20'),_0x59f0ee,JSON['stringify'](_0x5a088d));_0x4fadd7(_0x5a088d);})[_0xceda('0x15')](function(_0x176e1c){logger[_0xceda('0x11')]('GetCmHopperBlack',_0x176e1c[_0xceda('0x13')],_0x59f0ee);_0x3e101b(_0x165d38[_0xceda('0x11')](0x1f4,_0x176e1c['message']));});});};exports[_0xceda('0x21')]=function(_0x55373d){var _0x30f54b=this;return new Promise(function(_0x19f300,_0x4d4c8f){return db[_0xceda('0x16')][_0xceda('0x22')](_0x55373d[_0xceda('0x23')],{'raw':_0x55373d[_0xceda('0x18')]?_0x55373d[_0xceda('0x18')][_0xceda('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55373d[_0xceda('0x18')]?_0x55373d[_0xceda('0x18')][_0xceda('0x1a')]||null:null,'attributes':_0x55373d[_0xceda('0x18')]?_0x55373d[_0xceda('0x18')][_0xceda('0x1b')]||null:null,'limit':_0x55373d[_0xceda('0x18')]?_0x55373d[_0xceda('0x18')][_0xceda('0x1c')]||null:null})[_0xceda('0xb')](function(_0x481e78){logger[_0xceda('0xc')](_0xceda('0x21'),_0x55373d);logger[_0xceda('0xd')](_0xceda('0x21'),_0x55373d,JSON['stringify'](_0x481e78));_0x19f300(_0x481e78);})[_0xceda('0x15')](function(_0x3019e1){logger[_0xceda('0x11')](_0xceda('0x21'),_0x3019e1[_0xceda('0x13')],_0x55373d);_0x4d4c8f(_0x30f54b['error'](0x1f4,_0x3019e1['message']));});});};exports['DestroyCmHopperBlack']=function(_0x26a228){var _0x31c3ba=this;return new Promise(function(_0x4f310f,_0x4de37a){return db['CmHopperBlack']['destroy']({'where':_0x26a228[_0xceda('0x18')]?_0x26a228[_0xceda('0x18')][_0xceda('0x1a')]||null:null})['then'](function(_0x43875f){logger[_0xceda('0xc')](_0xceda('0x24'),_0x26a228);logger[_0xceda('0xd')](_0xceda('0x24'),_0x26a228,JSON[_0xceda('0x10')](_0x43875f));_0x4f310f(_0x43875f);})[_0xceda('0x15')](function(_0x174d59){logger[_0xceda('0x11')](_0xceda('0x24'),_0x174d59[_0xceda('0x13')],_0x26a228);_0x4de37a(_0x31c3ba[_0xceda('0x11')](0x1f4,_0x174d59[_0xceda('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index dc60cd1..06ffc81 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 _0xafc4=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy'];(function(_0xaa89a1,_0x2b0f55){var _0x35d995=function(_0x113ed2){while(--_0x113ed2){_0xaa89a1['push'](_0xaa89a1['shift']());}};_0x35d995(++_0x2b0f55);}(_0xafc4,0x69));var _0x4afc=function(_0x29b75d,_0x24f4be){_0x29b75d=_0x29b75d-0x0;var _0x3f4677=_0xafc4[_0x29b75d];return _0x3f4677;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4afc('0xd')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd046=['isAuthenticated','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopperBlack.controller','index','get','describe','show','/:id'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd046,0x129));var _0x6d04=function(_0x38f7af,_0x4e8d21){_0x38f7af=_0x38f7af-0x0;var _0x36e88b=_0xd046[_0x38f7af];return _0x36e88b;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['put'](_0x6d04('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6d04('0xa'),auth[_0x6d04('0xb')](),controller[_0x6d04('0xc')]);module[_0x6d04('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ec82837..9db38a9 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 _0xa024=['getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0xa024,0x74));var _0x4a02=function(_0x42bfa5,_0x255fb3){_0x42bfa5=_0x42bfa5-0x0;var _0x1b3956=_0xa024[_0x42bfa5];return _0x1b3956;};'use strict';var Sequelize=require(_0x4a02('0x0'));var moment=require('moment');module[_0x4a02('0x1')]={'state':{'type':Sequelize[_0x4a02('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4a02('0x3')]},'scheduledat':{'type':Sequelize[_0x4a02('0x4')]},'countbusyretry':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4a02('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4a02('0x3')]},'calleridname':{'type':Sequelize[_0x4a02('0x3')]},'starttime':{'type':Sequelize[_0x4a02('0x4')]},'responsetime':{'type':Sequelize[_0x4a02('0x4')]},'answertime':{'type':Sequelize[_0x4a02('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4a02('0x4')]},'ringtime':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4a02('0x3')]},'campaign':{'type':Sequelize[_0x4a02('0x3')]},'campaigntype':{'type':Sequelize[_0x4a02('0x3')]},'membername':{'type':Sequelize[_0x4a02('0x3')]},'reason':{'type':Sequelize[_0x4a02('0x3')]},'disposition':{'type':Sequelize[_0x4a02('0x3')]},'secondDisposition':{'type':Sequelize[_0x4a02('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4a02('0x3')]},'dispositionat':{'type':Sequelize[_0x4a02('0x4')],'set':function(_0x24cf97){var _0x1b83b1=this[_0x4a02('0x5')]('endtime');if(_0x1b83b1&&_0x24cf97){this[_0x4a02('0x6')](_0x4a02('0x7'),moment(_0x24cf97)[_0x4a02('0x8')](moment(_0x1b83b1),_0x4a02('0x9')));}}},'amd':{'type':Sequelize[_0x4a02('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4a02('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4a02('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4a02('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4a02('0x4')]},'callback':{'type':Sequelize[_0x4a02('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4a02('0x4')]},'deleted':{'type':Sequelize[_0x4a02('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x4a02('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4a02('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8683=['endtime','followuptime','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue'];(function(_0x2450f3,_0x3418cb){var _0x1d7ddb=function(_0x13cd17){while(--_0x13cd17){_0x2450f3['push'](_0x2450f3['shift']());}};_0x1d7ddb(++_0x3418cb);}(_0x8683,0x16c));var _0x3868=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8683[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x3868('0x0'));var moment=require(_0x3868('0x1'));module['exports']={'state':{'type':Sequelize[_0x3868('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3868('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3868('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3868('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3868('0x3')]},'calleridnum':{'type':Sequelize[_0x3868('0x3')]},'calleridname':{'type':Sequelize[_0x3868('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3868('0x4')]},'answertime':{'type':Sequelize[_0x3868('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3868('0x4')]},'ringtime':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3868('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3868('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3868('0x3')]},'disposition':{'type':Sequelize[_0x3868('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3868('0x3')]},'dispositionat':{'type':Sequelize[_0x3868('0x4')],'set':function(_0x51943c){var _0x45bcc0=this[_0x3868('0x5')](_0x3868('0x6'));if(_0x45bcc0&&_0x51943c){this['setDataValue'](_0x3868('0x7'),moment(_0x51943c)['diff'](moment(_0x45bcc0),_0x3868('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3868('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3868('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3868('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3868('0x4')]},'recallme':{'type':Sequelize[_0x3868('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3868('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3868('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c8551cf..d725e66 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 _0xda19=['map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopperFinal','includeAll','findAll','catch','show','uniqueid','body','find','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','VoiceQueueId\x20=\x20?','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','ListId','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send'];(function(_0x18070d,_0x374ba8){var _0x309c19=function(_0x252e0f){while(--_0x252e0f){_0x18070d['push'](_0x18070d['shift']());}};_0x309c19(++_0x374ba8);}(_0xda19,0xd5));var _0x9da1=function(_0x1d6ebb,_0x34afb0){_0x1d6ebb=_0x1d6ebb-0x0;var _0x4406b3=_0xda19[_0x1d6ebb];return _0x4406b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=typeof _0x43c093[_0x9da1('0x19')]==='undefined'&&typeof _0x43c093[_0x9da1('0x1a')]===_0x9da1('0x1b');var _0xf83bf8=_0x37653d[_0x9da1('0x1c')];var _0xfb278d=_0x1a1a6b?0x0:_0x43c093[_0x9da1('0x19')];var _0x497676=_0x1a1a6b?_0x37653d['count']:_0x43c093[_0x9da1('0x19')]+_0x43c093[_0x9da1('0x1a')];var _0x1b0e7f;if(_0x497676>=_0xf83bf8){_0x497676=_0xf83bf8;_0x1b0e7f=0xc8;}else{_0x1b0e7f=0xce;}_0x433ff4[_0x9da1('0x18')](_0x1b0e7f);return _0x433ff4[_0x9da1('0x1d')](_0x9da1('0x1e'),_0xfb278d+'-'+_0x497676+'/'+_0xf83bf8)[_0x9da1('0x1f')](_0x37653d);}return null;};}function patchUpdates(_0x47e5cf){return function(_0x1a459c){try{jsonpatch[_0x9da1('0x20')](_0x1a459c,_0x47e5cf,!![]);}catch(_0x9c3b37){return BPromise[_0x9da1('0x21')](_0x9c3b37);}return _0x1a459c[_0x9da1('0x22')]();};}function saveUpdates(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x23')](_0x4e9d7d)[_0x9da1('0x24')](function(_0x330219){return _0x330219;});}return null;};}function removeEntity(_0x32eb55,_0x165b73){return function(_0x4c60aa){if(_0x4c60aa){return _0x4c60aa[_0x9da1('0x25')]()[_0x9da1('0x24')](function(){_0x32eb55['status'](0xcc)[_0x9da1('0x26')]();});}};}function handleEntityNotFound(_0x3f5680,_0x534210){return function(_0x2fd49c){if(!_0x2fd49c){_0x3f5680[_0x9da1('0x17')](0x194);}return _0x2fd49c;};}function handleError(_0x4b1152,_0x36b87a){_0x36b87a=_0x36b87a||0x1f4;return function(_0x1d6af5){logger['error'](_0x1d6af5['stack']);if(_0x1d6af5[_0x9da1('0x27')]){delete _0x1d6af5[_0x9da1('0x27')];}_0x4b1152['status'](_0x36b87a)[_0x9da1('0x28')](_0x1d6af5);};}exports['index']=function(_0x5a6f2d,_0x5a59c2){var _0x31b826={},_0x404b86={},_0x24c6d5={'count':0x0,'rows':[]};var _0x26dd58=_[_0x9da1('0x29')](db['CmHopperFinal'][_0x9da1('0x2a')],function(_0x4e6083){return{'name':_0x4e6083[_0x9da1('0x2b')],'type':_0x4e6083[_0x9da1('0x2c')]['key']};});_0x404b86[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x26dd58,'name');_0x404b86[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5a6f2d[_0x9da1('0x2e')]);_0x404b86[_0x9da1('0x30')]=_['intersection'](_0x404b86['model'],_0x404b86[_0x9da1('0x2e')]);_0x31b826[_0x9da1('0x31')]=_[_0x9da1('0x32')](_0x404b86[_0x9da1('0x2d')],qs[_0x9da1('0x33')](_0x5a6f2d['query'][_0x9da1('0x33')]));_0x31b826[_0x9da1('0x31')]=_0x31b826[_0x9da1('0x31')][_0x9da1('0x34')]?_0x31b826[_0x9da1('0x31')]:_0x404b86[_0x9da1('0x2d')];if(!_0x5a6f2d['query'][_0x9da1('0x35')]('nolimit')){_0x31b826['limit']=qs[_0x9da1('0x1a')](_0x5a6f2d['query'][_0x9da1('0x1a')]);_0x31b826[_0x9da1('0x19')]=qs[_0x9da1('0x19')](_0x5a6f2d[_0x9da1('0x2e')][_0x9da1('0x19')]);}_0x31b826[_0x9da1('0x36')]=qs[_0x9da1('0x37')](_0x5a6f2d[_0x9da1('0x2e')]['sort']);_0x31b826[_0x9da1('0x38')]=qs['filters'](_[_0x9da1('0x39')](_0x5a6f2d['query'],_0x404b86['filters']),_0x26dd58);if(_0x5a6f2d[_0x9da1('0x2e')]['filter']){_0x31b826[_0x9da1('0x38')]=_[_0x9da1('0x3a')](_0x31b826['where'],{'$or':_[_0x9da1('0x29')](_0x26dd58,function(_0x1b750f){if(_0x1b750f[_0x9da1('0x2c')]!==_0x9da1('0x3b')){var _0x56bd49={};_0x56bd49[_0x1b750f[_0x9da1('0x27')]]={'$like':'%'+_0x5a6f2d['query'][_0x9da1('0x3c')]+'%'};return _0x56bd49;}})});}_0x31b826=_['merge']({},_0x31b826,_0x5a6f2d[_0x9da1('0x3d')]);var _0x46c176={'where':_0x31b826['where']};return db[_0x9da1('0x3e')][_0x9da1('0x1c')](_0x46c176)[_0x9da1('0x24')](function(_0x4e9af3){_0x24c6d5['count']=_0x4e9af3;if(_0x5a6f2d['query'][_0x9da1('0x3f')]){_0x31b826['include']=[{'all':!![]}];}return db[_0x9da1('0x3e')][_0x9da1('0x40')](_0x31b826);})[_0x9da1('0x24')](function(_0x43c064){_0x24c6d5['rows']=_0x43c064;return _0x24c6d5;})[_0x9da1('0x24')](respondWithFilteredResult(_0x5a59c2,_0x31b826))[_0x9da1('0x41')](handleError(_0x5a59c2,null));};exports[_0x9da1('0x42')]=function(_0x173dc6,_0x28fc88){var _0x26c225={'raw':!![],'where':{'id':_0x173dc6['params']['id']}},_0x28e0b2={};_0x28e0b2[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x3e')]['rawAttributes']);_0x28e0b2[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x173dc6['query']);_0x28e0b2[_0x9da1('0x30')]=_[_0x9da1('0x32')](_0x28e0b2['model'],_0x28e0b2[_0x9da1('0x2e')]);_0x26c225['attributes']=_[_0x9da1('0x32')](_0x28e0b2[_0x9da1('0x2d')],qs['fields'](_0x173dc6['query'][_0x9da1('0x33')]));_0x26c225[_0x9da1('0x31')]=_0x26c225[_0x9da1('0x31')][_0x9da1('0x34')]?_0x26c225[_0x9da1('0x31')]:_0x28e0b2[_0x9da1('0x2d')];if(_0x173dc6[_0x9da1('0x2e')][_0x9da1('0x3f')]){_0x26c225['include']=[{'all':!![]}];}_0x26c225=_[_0x9da1('0x3a')]({},_0x26c225,_0x173dc6[_0x9da1('0x3d')]);return db[_0x9da1('0x3e')]['find'](_0x26c225)[_0x9da1('0x24')](handleEntityNotFound(_0x28fc88,null))[_0x9da1('0x24')](respondWithResult(_0x28fc88,null))[_0x9da1('0x41')](handleError(_0x28fc88,null));};exports['describe']=function(_0x336fc3,_0x351d4d){return db[_0x9da1('0x3e')]['describe']()[_0x9da1('0x24')](respondWithResult(_0x351d4d,null))['catch'](handleError(_0x351d4d,null));};exports['update']=function(_0xfbdde9,_0x43c47d){if(_0xfbdde9['body'][_0x9da1('0x43')]){delete _0xfbdde9[_0x9da1('0x44')]['uniqueid'];}return db[_0x9da1('0x3e')][_0x9da1('0x45')]({'where':{'uniqueid':_0xfbdde9[_0x9da1('0x46')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x43c47d,null))[_0x9da1('0x24')](saveUpdates(_0xfbdde9[_0x9da1('0x44')],null))[_0x9da1('0x24')](respondWithResult(_0x43c47d,null))[_0x9da1('0x41')](handleError(_0x43c47d,null));};exports[_0x9da1('0x47')]=function(_0x5c9b46,_0x147c65,_0xe6c667){return db[_0x9da1('0x3e')][_0x9da1('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x5c9b46['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x4b')))),_0x9da1('0x4c')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x4d')))),_0x9da1('0x4e')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')]['literal'](_0x9da1('0x4f')))),'busyContacts'],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x50')))),_0x9da1('0x51')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x9da1('0x52')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x53')))),_0x9da1('0x54')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db['sequelize']['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9da1('0x55')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x56')))),'answeringMachine']]})[_0x9da1('0x24')](handleEntityNotFound(_0x147c65,null))[_0x9da1('0x24')](respondWithResult(_0x147c65,null))[_0x9da1('0x41')](handleError(_0x147c65,null));};exports[_0x9da1('0x57')]=function(_0x562e05,_0x1a9df0,_0x5c236e){return db[_0x9da1('0x3e')][_0x9da1('0x40')]({'raw':![],'where':{'CampaignId':_0x562e05[_0x9da1('0x46')]['id']},'attributes':[[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9da1('0x4b')))),'noSuchContacts'],[db['sequelize']['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db['sequelize'][_0x9da1('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x9da1('0x4e')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')]['literal'](_0x9da1('0x4f')))),_0x9da1('0x58')],[db['sequelize']['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x50')))),_0x9da1('0x51')],[db[_0x9da1('0x49')]['fn']('COUNT',db[_0x9da1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x9da1('0x59')))),_0x9da1('0x52')],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x53')))),_0x9da1('0x54')],[db['sequelize']['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x5a')))),'reCallContacts'],[db[_0x9da1('0x49')]['fn'](_0x9da1('0x48'),db[_0x9da1('0x49')]['fn']('IF',db[_0x9da1('0x49')][_0x9da1('0x4a')](_0x9da1('0x56')))),'answeringMachine']]})[_0x9da1('0x24')](handleEntityNotFound(_0x1a9df0,null))['then'](respondWithResult(_0x1a9df0,null))[_0x9da1('0x41')](handleError(_0x1a9df0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x7cfa7e,_0xdd3997,_0x44b6c0){return db[_0x9da1('0x5b')]['find']({'where':{'id':_0x7cfa7e['params']['id']}})['then'](handleEntityNotFound(_0xdd3997,null))[_0x9da1('0x24')](function(_0x2b1a71){var _0x266533;if(_0x2b1a71){_0x266533=squel[_0x9da1('0x5c')]()['into']('cm_hopper')[_0x9da1('0x5d')]([_0x9da1('0x5e'),_0x9da1('0x5f'),'ContactId','ListId',_0x9da1('0x60'),_0x9da1('0x61'),_0x9da1('0x62')],squel['select']()['field'](_0x9da1('0x63'),_0x9da1('0x5e'))[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x5f'))['field'](_0x9da1('0x66'),_0x9da1('0x67'))[_0x9da1('0x64')](_0x9da1('0x68'),'ListId')[_0x9da1('0x64')](_0x9da1('0x69'),_0x9da1('0x60'))['field'](_0x9da1('0x65'),_0x9da1('0x61'))[_0x9da1('0x64')]('NOW()',_0x9da1('0x62'))[_0x9da1('0x6a')]('cm_hopper_final')[_0x9da1('0x38')]('VoiceQueueId\x20=\x20?',_0x7cfa7e[_0x9da1('0x46')]['id']['toString']())[_0x9da1('0x38')](_0x9da1('0x6b'),_0x7cfa7e[_0x9da1('0x44')][_0x9da1('0x6c')][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x6e'))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()[_0x9da1('0x64')](_0x9da1('0x5e'))[_0x9da1('0x6a')]('cm_hopper')[_0x9da1('0x38')](_0x9da1('0x71'),_0x7cfa7e[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]()))[_0x9da1('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9da1('0x70')]()[_0x9da1('0x64')]('calleridnum')['from'](_0x9da1('0x72'))[_0x9da1('0x38')](_0x9da1('0x71'),_0x7cfa7e[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x73')))[_0x9da1('0x74')](_0x9da1('0x67')))[_0x9da1('0x6d')]();return db[_0x9da1('0x49')][_0x9da1('0x2e')](_0x266533);}return[];})[_0x9da1('0x24')](respondWithResult(_0xdd3997,null))['catch'](handleError(_0xdd3997,null));};exports[_0x9da1('0x75')]=function(_0x3a0a84,_0x3f9782,_0x30b6fc){return db[_0x9da1('0x76')]['find']({'where':{'id':_0x3a0a84[_0x9da1('0x46')]['id']}})[_0x9da1('0x24')](handleEntityNotFound(_0x3f9782,null))['then'](function(_0x33b625){var _0x5a0533;if(_0x33b625){_0x5a0533=squel[_0x9da1('0x5c')]()['into'](_0x9da1('0x77'))[_0x9da1('0x5d')]([_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x67'),_0x9da1('0x78'),_0x9da1('0x79'),_0x9da1('0x61'),_0x9da1('0x62')],squel[_0x9da1('0x70')]()[_0x9da1('0x64')](_0x9da1('0x63'),'phone')[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x5f'))[_0x9da1('0x64')](_0x9da1('0x66'),_0x9da1('0x67'))['field']('ANY_VALUE(ListId)',_0x9da1('0x78'))[_0x9da1('0x64')](_0x9da1('0x7a'),'CampaignId')[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x61'))[_0x9da1('0x64')](_0x9da1('0x65'),_0x9da1('0x62'))[_0x9da1('0x6a')]('cm_hopper_final')[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84['params']['id']['toString']())[_0x9da1('0x38')]('state\x20=\x20?',_0x3a0a84['body'][_0x9da1('0x6c')][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x6e'))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()[_0x9da1('0x64')]('phone')['from'](_0x9da1('0x77'))[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]()))[_0x9da1('0x38')](_0x9da1('0x6f'),squel[_0x9da1('0x70')]()['field'](_0x9da1('0x7c'))['from'](_0x9da1('0x72'))[_0x9da1('0x38')](_0x9da1('0x7b'),_0x3a0a84[_0x9da1('0x46')]['id'][_0x9da1('0x6d')]())[_0x9da1('0x38')](_0x9da1('0x73')))['group'](_0x9da1('0x67')))['toString']();return db[_0x9da1('0x49')][_0x9da1('0x2e')](_0x5a0533);}return[];})[_0x9da1('0x24')](respondWithResult(_0x3f9782,null))[_0x9da1('0x41')](handleError(_0x3f9782,null));};exports['checkContactHopper']=function(_0x3310af,_0x1f93bf,_0x2afe1e){return db[_0x9da1('0x7d')][_0x9da1('0x7e')]({'where':{'VoiceQueueId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x60')],'CampaignId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x79')],'ContactId':_0x3310af[_0x9da1('0x44')][_0x9da1('0x67')]}})[_0x9da1('0x24')](handleEntityNotFound(_0x1f93bf,null))[_0x9da1('0x24')](function(_0x32ff53){if(_0x32ff53){return _0x32ff53;}return null;})['then'](respondWithResult(_0x1f93bf,null))[_0x9da1('0x41')](handleError(_0x1f93bf,null));}; \ No newline at end of file +var _0x53ec=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\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','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x203,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)'];(function(_0xfc2790,_0x3b4ff6){var _0x1118ac=function(_0x107518){while(--_0x107518){_0xfc2790['push'](_0xfc2790['shift']());}};_0x1118ac(++_0x3b4ff6);}(_0x53ec,0x192));var _0xc53e=function(_0xf1dbd8,_0x1cb2e1){_0xf1dbd8=_0xf1dbd8-0x0;var _0x5ee4be=_0x53ec[_0xf1dbd8];return _0x5ee4be;};'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'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')]()['then'](respondWithResult(_0x15e744,null))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x39feea,_0x5a6e41){if(_0x39feea[_0xc53e('0x46')][_0xc53e('0x47')]){delete _0x39feea[_0xc53e('0x46')][_0xc53e('0x47')];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'uniqueid':_0x39feea[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x5a6e41,null))[_0xc53e('0x24')](saveUpdates(_0x39feea[_0xc53e('0x46')],null))['then'](respondWithResult(_0x5a6e41,null))[_0xc53e('0x43')](handleError(_0x5a6e41,null));};exports[_0xc53e('0x48')]=function(_0x38520c,_0x3d74ac,_0x136544){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x38520c[_0xc53e('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),'noSuchContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x4e')))),_0xc53e('0x4f')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x52')))),'dropContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xc53e('0x55')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xc53e('0x56')]]})[_0xc53e('0x24')](handleEntityNotFound(_0x3d74ac,null))[_0xc53e('0x24')](respondWithResult(_0x3d74ac,null))[_0xc53e('0x43')](handleError(_0x3d74ac,null));};exports[_0xc53e('0x57')]=function(_0x4caf5f,_0x55e068,_0x4655b7){return db[_0xc53e('0x29')][_0xc53e('0x58')]({'raw':![],'where':{'CampaignId':_0x4caf5f[_0xc53e('0x40')]['id']},'attributes':[[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),_0xc53e('0x59')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x5a')))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4e')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc53e('0x52')))),_0xc53e('0x5b')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x55')))),_0xc53e('0x5c')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x5d')))),'answeringMachine']]})[_0xc53e('0x24')](handleEntityNotFound(_0x55e068,null))[_0xc53e('0x24')](respondWithResult(_0x55e068,null))[_0xc53e('0x43')](handleError(_0x55e068,null));};exports[_0xc53e('0x5e')]=function(_0x32f954,_0x2d9803,_0x51638a){return db[_0xc53e('0x5f')][_0xc53e('0x42')]({'where':{'id':_0x32f954[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x2d9803,null))['then'](function(_0x5e1f4a){var _0x57edb;if(_0x5e1f4a){_0x57edb=squel[_0xc53e('0x60')]()[_0xc53e('0x61')](_0xc53e('0x62'))['fromQuery']([_0xc53e('0x63'),'scheduledAt',_0xc53e('0x64'),'ListId',_0xc53e('0x65'),'createdAt',_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))['field']('NOW()',_0xc53e('0x69'))[_0xc53e('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))['field'](_0xc53e('0x6c'),_0xc53e('0x65'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x66'))[_0xc53e('0x6f')](_0xc53e('0x70'))['where'](_0xc53e('0x71'),_0x32f954['params']['id'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x73'),_0x32f954[_0xc53e('0x46')][_0xc53e('0x74')][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))[_0xc53e('0x39')](_0xc53e('0x76'),squel['select']()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('VoiceQueueId\x20=\x20?',_0x32f954[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field'](_0xc53e('0x77'))[_0xc53e('0x6f')]('cm_hopper_final')[_0xc53e('0x39')](_0xc53e('0x71'),_0x32f954[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')](_0xc53e('0x78')))['group'](_0xc53e('0x64')))[_0xc53e('0x72')]();return db['sequelize']['query'](_0x57edb);}return[];})[_0xc53e('0x24')](respondWithResult(_0x2d9803,null))['catch'](handleError(_0x2d9803,null));};exports[_0xc53e('0x79')]=function(_0x3d2636,_0x263d97,_0x58684c){return db[_0xc53e('0x7a')][_0xc53e('0x42')]({'where':{'id':_0x3d2636[_0xc53e('0x40')]['id']}})['then'](handleEntityNotFound(_0x263d97,null))[_0xc53e('0x24')](function(_0x2e048a){var _0x1c24e6;if(_0x2e048a){_0x1c24e6=squel[_0xc53e('0x60')]()[_0xc53e('0x61')]('cm_hopper')[_0xc53e('0x7b')]([_0xc53e('0x63'),_0xc53e('0x69'),_0xc53e('0x64'),_0xc53e('0x6b'),_0xc53e('0x7c'),_0xc53e('0x6e'),_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x69'))[_0xc53e('0x6a')](_0xc53e('0x7d'),_0xc53e('0x64'))[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))[_0xc53e('0x6a')](_0xc53e('0x7e'),_0xc53e('0x7c'))['field'](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),'updatedAt')[_0xc53e('0x6f')](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]())[_0xc53e('0x39')]('state\x20=\x20?',_0x3d2636[_0xc53e('0x46')]['state'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))['where'](_0xc53e('0x76'),squel[_0xc53e('0x67')]()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('CampaignId\x20=\x20?',_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field']('calleridnum')['from'](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')]('state\x20=\x204'))[_0xc53e('0x80')](_0xc53e('0x64')))[_0xc53e('0x72')]();return db[_0xc53e('0x4a')]['query'](_0x1c24e6);}return[];})[_0xc53e('0x24')](respondWithResult(_0x263d97,null))[_0xc53e('0x43')](handleError(_0x263d97,null));};exports[_0xc53e('0x81')]=function(_0x352bc6,_0x67be18,_0x306343){return db[_0xc53e('0x82')][_0xc53e('0x83')]({'where':{'VoiceQueueId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x65')],'CampaignId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x7c')],'ContactId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x64')]}})[_0xc53e('0x24')](handleEntityNotFound(_0x67be18,null))[_0xc53e('0x24')](function(_0x3dc1be){if(_0x3dc1be){return _0x3dc1be;}return null;})[_0xc53e('0x24')](respondWithResult(_0x67be18,null))[_0xc53e('0x43')](handleError(_0x67be18,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 5cac366..cd16ce6 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 _0x0577=['define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes'];(function(_0x49e66,_0x43f4b9){var _0x545549=function(_0x18b28f){while(--_0x18b28f){_0x49e66['push'](_0x49e66['shift']());}};_0x545549(++_0x43f4b9);}(_0x0577,0x1dd));var _0x7057=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0577[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x7057('0x0'));var util=require('util');var logger=require(_0x7057('0x1'))('api');var moment=require(_0x7057('0x2'));var BPromise=require(_0x7057('0x3'));var rp=require(_0x7057('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7057('0x5'));var config=require('../../config/environment');var attributes=require(_0x7057('0x6'));module['exports']=function(_0x4ba884,_0xbf3fba){return _0x4ba884[_0x7057('0x7')]('CmHopperFinal',attributes,{'tableName':_0x7057('0x8'),'paranoid':![],'indexes':[{'name':_0x7057('0x9'),'fields':[_0x7057('0x9')]},{'name':_0x7057('0xa'),'fields':[_0x7057('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6536=['calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final'];(function(_0xe5b97c,_0x2d9731){var _0x2d82f2=function(_0x2bc28a){while(--_0x2bc28a){_0xe5b97c['push'](_0xe5b97c['shift']());}};_0x2d82f2(++_0x2d9731);}(_0x6536,0x1ec));var _0x6653=function(_0x2b1b0b,_0x19c4b6){_0x2b1b0b=_0x2b1b0b-0x0;var _0x8586f3=_0x6536[_0x2b1b0b];return _0x8586f3;};'use strict';var _=require(_0x6653('0x0'));var util=require(_0x6653('0x1'));var logger=require(_0x6653('0x2'))(_0x6653('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6653('0x4'));var fs=require('fs');var path=require(_0x6653('0x5'));var rimraf=require(_0x6653('0x6'));var config=require(_0x6653('0x7'));var attributes=require(_0x6653('0x8'));module['exports']=function(_0x291357,_0x4545ef){return _0x291357[_0x6653('0x9')](_0x6653('0xa'),attributes,{'tableName':_0x6653('0xb'),'paranoid':![],'indexes':[{'name':_0x6653('0xc'),'fields':[_0x6653('0xc')]},{'name':_0x6653('0xd'),'fields':[_0x6653('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index cd037d2..d353b6d 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(_0xefd4b,_0x1f57d3){var _0x1ff82d=function(_0x25ea04){while(--_0x25ea04){_0xefd4b['push'](_0xefd4b['shift']());}};_0x1ff82d(++_0x1f57d3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f51f9,_0x5d5613){_0x4f51f9=_0x4f51f9-0x0;var _0x533984=_0xb10b[_0x4f51f9];return _0x533984;};'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(_0x1e3f26,_0x258857){var _0x2c4e3d=function(_0x566641){while(--_0x566641){_0x1e3f26['push'](_0x1e3f26['shift']());}};_0x2c4e3d(++_0x258857);}(_0x7a54,0x106));var _0x47a5=function(_0x11184c,_0xdafc09){_0x11184c=_0x11184c-0x0;var _0x2848a8=_0x7a54[_0x11184c];return _0x2848a8;};'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 4cbf0f1..a2baeda 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 _0x5a13=['/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put'];(function(_0x180720,_0x32c191){var _0x1c4419=function(_0x304376){while(--_0x304376){_0x180720['push'](_0x180720['shift']());}};_0x1c4419(++_0x32c191);}(_0x5a13,0x92));var _0x35a1=function(_0x140f1c,_0x290d07){_0x140f1c=_0x140f1c-0x0;var _0x10a2ef=_0x5a13[_0x140f1c];return _0x10a2ef;};'use strict';var multer=require('multer');var util=require(_0x35a1('0x0'));var path=require(_0x35a1('0x1'));var timeout=require(_0x35a1('0x2'));var express=require(_0x35a1('0x3'));var router=express[_0x35a1('0x4')]();var fs_extra=require(_0x35a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x35a1('0x6'));var config=require('../../config/environment');var controller=require(_0x35a1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x35a1('0x8')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xb')]);router[_0x35a1('0x8')]('/:id',auth[_0x35a1('0xa')](),controller[_0x35a1('0xc')]);router[_0x35a1('0x8')](_0x35a1('0xd'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xe')]);router[_0x35a1('0x8')](_0x35a1('0xf'),auth[_0x35a1('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x35a1('0x10')](_0x35a1('0x11'),auth[_0x35a1('0xa')](),controller[_0x35a1('0x12')]);router[_0x35a1('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x35a1('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x35a1('0x10')](_0x35a1('0x13'),auth['isAuthenticated'](),controller[_0x35a1('0x14')]);router[_0x35a1('0x15')](_0x35a1('0x16'),auth[_0x35a1('0xa')](),controller['update']);module[_0x35a1('0x17')]=router; \ No newline at end of file +var _0x3249=['/:id','show','get','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','multer','util','path','express','Router','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','describe'];(function(_0x33a69d,_0x5baa9c){var _0x3a41bb=function(_0x232c27){while(--_0x232c27){_0x33a69d['push'](_0x33a69d['shift']());}};_0x3a41bb(++_0x5baa9c);}(_0x3249,0xd2));var _0x9324=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3249[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0x9324('0x0'));var util=require(_0x9324('0x1'));var path=require(_0x9324('0x2'));var timeout=require('connect-timeout');var express=require(_0x9324('0x3'));var router=express[_0x9324('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9324('0x5'));var controller=require(_0x9324('0x6'));router['get']('/',auth[_0x9324('0x7')](),controller[_0x9324('0x8')]);router['get']('/describe',auth[_0x9324('0x7')](),controller[_0x9324('0x9')]);router['get'](_0x9324('0xa'),auth[_0x9324('0x7')](),controller[_0x9324('0xb')]);router[_0x9324('0xc')]('/voice/queue/countAttributes/:id',auth[_0x9324('0x7')](),controller[_0x9324('0xd')]);router[_0x9324('0xc')]('/campaign/countAttributes/:id',auth[_0x9324('0x7')](),controller[_0x9324('0xe')]);router[_0x9324('0xf')](_0x9324('0x10'),auth[_0x9324('0x7')](),controller[_0x9324('0x11')]);router['post'](_0x9324('0x12'),auth[_0x9324('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x9324('0xf')](_0x9324('0x13'),auth['isAuthenticated'](),controller[_0x9324('0x14')]);router[_0x9324('0x15')](_0x9324('0xa'),auth[_0x9324('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index b30a094..b4dc629 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 _0x58eb=['exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x58eb,0x15e));var _0xb58e=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x58eb[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require('sequelize');module[_0xb58e('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb58e('0x1')]},'scheduledat':{'type':Sequelize[_0xb58e('0x2')]},'countbusyretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb58e('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xb58e('0x1')]},'originatecalleridname':{'type':Sequelize[_0xb58e('0x1')]},'calleridnum':{'type':Sequelize[_0xb58e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb58e('0x2')]},'responsetime':{'type':Sequelize[_0xb58e('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb58e('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb58e('0x1')]},'campaign':{'type':Sequelize[_0xb58e('0x1')]},'campaigntype':{'type':Sequelize[_0xb58e('0x1')]},'membername':{'type':Sequelize[_0xb58e('0x1')]},'reason':{'type':Sequelize[_0xb58e('0x1')]},'amd':{'type':Sequelize[_0xb58e('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb58e('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb58e('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb58e('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb58e('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb58e('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb58e('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb58e('0x1')]}}; \ No newline at end of file +var _0x1fa1=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x5077d9,_0x17a1f8){var _0x1c1dad=function(_0xcd9031){while(--_0xcd9031){_0x5077d9['push'](_0x5077d9['shift']());}};_0x1c1dad(++_0x17a1f8);}(_0x1fa1,0x18b));var _0x11fa=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x1fa1[_0x101134];return _0xc47acc;};'use strict';var Sequelize=require(_0x11fa('0x0'));module['exports']={'state':{'type':Sequelize[_0x11fa('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x11fa('0x2')]},'scheduledat':{'type':Sequelize[_0x11fa('0x3')]},'countbusyretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x11fa('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x11fa('0x2')]},'calleridname':{'type':Sequelize[_0x11fa('0x2')]},'starttime':{'type':Sequelize[_0x11fa('0x3')]},'responsetime':{'type':Sequelize[_0x11fa('0x3')]},'answertime':{'type':Sequelize[_0x11fa('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11fa('0x3')]},'ringtime':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11fa('0x2')]},'campaign':{'type':Sequelize[_0x11fa('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x11fa('0x2')]},'amd':{'type':Sequelize[_0x11fa('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11fa('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x11fa('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11fa('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x11fa('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11fa('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index dc5bedb..5e6fc6d 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 _0xc483=['desk.js','querystring','papaparse','../../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','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','CmHopperHistory','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3e1071,_0x4e64e6){var _0x44286f=function(_0x38e000){while(--_0x38e000){_0x3e1071['push'](_0x3e1071['shift']());}};_0x44286f(++_0x4e64e6);}(_0xc483,0x1c4));var _0x3c48=function(_0x54cd6e,_0x4e8a2a){_0x54cd6e=_0x54cd6e-0x0;var _0x457d4f=_0xc483[_0x54cd6e];return _0x457d4f;};'use strict';var emlformat=require(_0x3c48('0x0'));var rimraf=require(_0x3c48('0x1'));var zipdir=require(_0x3c48('0x2'));var jsonpatch=require(_0x3c48('0x3'));var rp=require(_0x3c48('0x4'));var moment=require(_0x3c48('0x5'));var BPromise=require(_0x3c48('0x6'));var Mustache=require(_0x3c48('0x7'));var util=require(_0x3c48('0x8'));var path=require(_0x3c48('0x9'));var sox=require(_0x3c48('0xa'));var csv=require(_0x3c48('0xb'));var ejs=require(_0x3c48('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c48('0xd'));var squel=require(_0x3c48('0xe'));var crypto=require(_0x3c48('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3c48('0x10'));var toCsv=require(_0x3c48('0xb'));var querystring=require(_0x3c48('0x11'));var Papa=require(_0x3c48('0x12'));var Redis=require('ioredis');var authService=require(_0x3c48('0x13'));var qs=require(_0x3c48('0x14'));var as=require(_0x3c48('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c48('0x16'))(_0x3c48('0x17'));var utils=require(_0x3c48('0x18'));var config=require(_0x3c48('0x19'));var licenseUtil=require(_0x3c48('0x1a'));var db=require(_0x3c48('0x1b'))['db'];function respondWithStatusCode(_0x44526a,_0x4a2807){_0x4a2807=_0x4a2807||0xcc;return function(_0x118863){if(_0x118863){return _0x44526a[_0x3c48('0x1c')](_0x4a2807);}return _0x44526a['status'](_0x4a2807)[_0x3c48('0x1d')]();};}function respondWithResult(_0x4e1feb,_0x1d9212){_0x1d9212=_0x1d9212||0xc8;return function(_0x2c2c76){if(_0x2c2c76){return _0x4e1feb[_0x3c48('0x1e')](_0x1d9212)[_0x3c48('0x1f')](_0x2c2c76);}};}function respondWithFilteredResult(_0xf03e96,_0x4900f5){return function(_0x4dbac7){if(_0x4dbac7){var _0x303479=typeof _0x4900f5[_0x3c48('0x20')]===_0x3c48('0x21')&&typeof _0x4900f5[_0x3c48('0x22')]===_0x3c48('0x21');var _0x484d6c=_0x4dbac7[_0x3c48('0x23')];var _0x2d204c=_0x303479?0x0:_0x4900f5[_0x3c48('0x20')];var _0x530645=_0x303479?_0x4dbac7['count']:_0x4900f5[_0x3c48('0x20')]+_0x4900f5[_0x3c48('0x22')];var _0x3564b7;if(_0x530645>=_0x484d6c){_0x530645=_0x484d6c;_0x3564b7=0xc8;}else{_0x3564b7=0xce;}_0xf03e96[_0x3c48('0x1e')](_0x3564b7);return _0xf03e96[_0x3c48('0x24')](_0x3c48('0x25'),_0x2d204c+'-'+_0x530645+'/'+_0x484d6c)[_0x3c48('0x1f')](_0x4dbac7);}return null;};}function patchUpdates(_0x394da7){return function(_0x317889){try{jsonpatch[_0x3c48('0x26')](_0x317889,_0x394da7,!![]);}catch(_0x5a213f){return BPromise[_0x3c48('0x27')](_0x5a213f);}return _0x317889[_0x3c48('0x28')]();};}function saveUpdates(_0x8e88d2,_0x2e24a3){return function(_0x7d7c9){if(_0x7d7c9){return _0x7d7c9['update'](_0x8e88d2)[_0x3c48('0x29')](function(_0x252125){return _0x252125;});}return null;};}function removeEntity(_0x381d3f,_0x360f53){return function(_0x4ee4f9){if(_0x4ee4f9){return _0x4ee4f9[_0x3c48('0x2a')]()[_0x3c48('0x29')](function(){_0x381d3f[_0x3c48('0x1e')](0xcc)[_0x3c48('0x1d')]();});}};}function handleEntityNotFound(_0x14bd85,_0x1bdeb2){return function(_0x3550be){if(!_0x3550be){_0x14bd85[_0x3c48('0x1c')](0x194);}return _0x3550be;};}function handleError(_0x451992,_0x331360){_0x331360=_0x331360||0x1f4;return function(_0x2653ef){logger[_0x3c48('0x2b')](_0x2653ef[_0x3c48('0x2c')]);if(_0x2653ef[_0x3c48('0x2d')]){delete _0x2653ef[_0x3c48('0x2d')];}_0x451992[_0x3c48('0x1e')](_0x331360)[_0x3c48('0x2e')](_0x2653ef);};}exports['index']=function(_0x9a4b3d,_0x3a94ac){var _0x2a3eb2={},_0x1dc167={},_0x325497={'count':0x0,'rows':[]};var _0x331950=_[_0x3c48('0x2f')](db[_0x3c48('0x30')][_0x3c48('0x31')],function(_0x3000aa){return{'name':_0x3000aa['fieldName'],'type':_0x3000aa['type']['key']};});_0x1dc167[_0x3c48('0x32')]=_['map'](_0x331950,_0x3c48('0x2d'));_0x1dc167[_0x3c48('0x33')]=_['keys'](_0x9a4b3d['query']);_0x1dc167['filters']=_[_0x3c48('0x34')](_0x1dc167[_0x3c48('0x32')],_0x1dc167[_0x3c48('0x33')]);_0x2a3eb2[_0x3c48('0x35')]=_[_0x3c48('0x34')](_0x1dc167[_0x3c48('0x32')],qs[_0x3c48('0x36')](_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x36')]));_0x2a3eb2[_0x3c48('0x35')]=_0x2a3eb2[_0x3c48('0x35')][_0x3c48('0x37')]?_0x2a3eb2[_0x3c48('0x35')]:_0x1dc167[_0x3c48('0x32')];if(!_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x38')]('nolimit')){_0x2a3eb2[_0x3c48('0x22')]=qs[_0x3c48('0x22')](_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x22')]);_0x2a3eb2['offset']=qs[_0x3c48('0x20')](_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x20')]);}_0x2a3eb2['order']=qs[_0x3c48('0x39')](_0x9a4b3d['query'][_0x3c48('0x39')]);_0x2a3eb2['where']=qs[_0x3c48('0x3a')](_['pick'](_0x9a4b3d[_0x3c48('0x33')],_0x1dc167[_0x3c48('0x3a')]),_0x331950);if(_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x3b')]){_0x2a3eb2[_0x3c48('0x3c')]=_[_0x3c48('0x3d')](_0x2a3eb2[_0x3c48('0x3c')],{'$or':_[_0x3c48('0x2f')](_0x331950,function(_0x4f399b){if(_0x4f399b['type']!==_0x3c48('0x3e')){var _0x534f8a={};_0x534f8a[_0x4f399b['name']]={'$like':'%'+_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x3b')]+'%'};return _0x534f8a;}})});}_0x2a3eb2=_[_0x3c48('0x3d')]({},_0x2a3eb2,_0x9a4b3d['options']);var _0x157e81={'where':_0x2a3eb2[_0x3c48('0x3c')]};return db[_0x3c48('0x30')][_0x3c48('0x23')](_0x157e81)[_0x3c48('0x29')](function(_0x147cd3){_0x325497['count']=_0x147cd3;if(_0x9a4b3d[_0x3c48('0x33')][_0x3c48('0x3f')]){_0x2a3eb2[_0x3c48('0x40')]=[{'all':!![]}];}return db[_0x3c48('0x30')][_0x3c48('0x41')](_0x2a3eb2);})['then'](function(_0x2680a2){_0x325497[_0x3c48('0x42')]=_0x2680a2;return _0x325497;})[_0x3c48('0x29')](respondWithFilteredResult(_0x3a94ac,_0x2a3eb2))[_0x3c48('0x43')](handleError(_0x3a94ac,null));};exports[_0x3c48('0x44')]=function(_0x51bcc9,_0x30560b){var _0x47052e={'raw':!![],'where':{'id':_0x51bcc9[_0x3c48('0x45')]['id']}},_0x33e1fc={};_0x33e1fc[_0x3c48('0x32')]=_[_0x3c48('0x46')](db[_0x3c48('0x30')][_0x3c48('0x31')]);_0x33e1fc['query']=_[_0x3c48('0x46')](_0x51bcc9[_0x3c48('0x33')]);_0x33e1fc[_0x3c48('0x3a')]=_[_0x3c48('0x34')](_0x33e1fc['model'],_0x33e1fc['query']);_0x47052e['attributes']=_[_0x3c48('0x34')](_0x33e1fc[_0x3c48('0x32')],qs['fields'](_0x51bcc9[_0x3c48('0x33')][_0x3c48('0x36')]));_0x47052e[_0x3c48('0x35')]=_0x47052e['attributes'][_0x3c48('0x37')]?_0x47052e['attributes']:_0x33e1fc[_0x3c48('0x32')];if(_0x51bcc9['query'][_0x3c48('0x3f')]){_0x47052e[_0x3c48('0x40')]=[{'all':!![]}];}_0x47052e=_[_0x3c48('0x3d')]({},_0x47052e,_0x51bcc9[_0x3c48('0x47')]);return db[_0x3c48('0x30')][_0x3c48('0x48')](_0x47052e)[_0x3c48('0x29')](handleEntityNotFound(_0x30560b,null))[_0x3c48('0x29')](respondWithResult(_0x30560b,null))['catch'](handleError(_0x30560b,null));};exports[_0x3c48('0x49')]=function(_0xe75728,_0x8ab5ce){return db[_0x3c48('0x30')][_0x3c48('0x49')](_0xe75728[_0x3c48('0x4a')],{})[_0x3c48('0x29')](respondWithResult(_0x8ab5ce,0xc9))[_0x3c48('0x43')](handleError(_0x8ab5ce,null));};exports[_0x3c48('0x4b')]=function(_0x5ea30a,_0x3ecaca){return db[_0x3c48('0x30')]['describe']()[_0x3c48('0x29')](respondWithResult(_0x3ecaca,null))[_0x3c48('0x43')](handleError(_0x3ecaca,null));};exports[_0x3c48('0x4c')]=function(_0x3bf112,_0x861563){if(_0x3bf112[_0x3c48('0x4a')][_0x3c48('0x4d')]){delete _0x3bf112[_0x3c48('0x4a')][_0x3c48('0x4d')];}return db[_0x3c48('0x30')][_0x3c48('0x48')]({'where':{'uniqueid':_0x3bf112[_0x3c48('0x45')]['id']}})[_0x3c48('0x29')](handleEntityNotFound(_0x861563,null))[_0x3c48('0x29')](saveUpdates(_0x3bf112[_0x3c48('0x4a')],null))[_0x3c48('0x29')](respondWithResult(_0x861563,null))[_0x3c48('0x43')](handleError(_0x861563,null));}; \ No newline at end of file +var _0xa44f=['filter','merge','VIRTUAL','options','include','rows','catch','keys','includeAll','create','body','describe','uniqueid','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../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','CmHopperHistory','rawAttributes','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1621b9,_0x57e0d4){var _0x2d462e=function(_0xf25568){while(--_0xf25568){_0x1621b9['push'](_0x1621b9['shift']());}};_0x2d462e(++_0x57e0d4);}(_0xa44f,0xf9));var _0xfa44=function(_0x54b581,_0x57be56){_0x54b581=_0x54b581-0x0;var _0x4a60b6=_0xa44f[_0x54b581];return _0x4a60b6;};'use strict';var emlformat=require(_0xfa44('0x0'));var rimraf=require(_0xfa44('0x1'));var zipdir=require(_0xfa44('0x2'));var jsonpatch=require(_0xfa44('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa44('0x4'));var Mustache=require('mustache');var util=require(_0xfa44('0x5'));var path=require('path');var sox=require(_0xfa44('0x6'));var csv=require('to-csv');var ejs=require(_0xfa44('0x7'));var fs=require('fs');var fs_extra=require(_0xfa44('0x8'));var _=require(_0xfa44('0x9'));var squel=require(_0xfa44('0xa'));var crypto=require(_0xfa44('0xb'));var jsforce=require(_0xfa44('0xc'));var deskjs=require(_0xfa44('0xd'));var toCsv=require(_0xfa44('0xe'));var querystring=require(_0xfa44('0xf'));var Papa=require(_0xfa44('0x10'));var Redis=require(_0xfa44('0x11'));var authService=require(_0xfa44('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfa44('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa44('0x14'))(_0xfa44('0x15'));var utils=require(_0xfa44('0x16'));var config=require(_0xfa44('0x17'));var licenseUtil=require(_0xfa44('0x18'));var db=require(_0xfa44('0x19'))['db'];function respondWithStatusCode(_0x46cb97,_0x156b11){_0x156b11=_0x156b11||0xcc;return function(_0x288906){if(_0x288906){return _0x46cb97[_0xfa44('0x1a')](_0x156b11);}return _0x46cb97[_0xfa44('0x1b')](_0x156b11)['end']();};}function respondWithResult(_0x125240,_0x26b022){_0x26b022=_0x26b022||0xc8;return function(_0x2b70e4){if(_0x2b70e4){return _0x125240['status'](_0x26b022)[_0xfa44('0x1c')](_0x2b70e4);}};}function respondWithFilteredResult(_0x1312db,_0x611328){return function(_0x119f1a){if(_0x119f1a){var _0x155804=typeof _0x611328[_0xfa44('0x1d')]===_0xfa44('0x1e')&&typeof _0x611328[_0xfa44('0x1f')]===_0xfa44('0x1e');var _0x49e0ba=_0x119f1a['count'];var _0x16549c=_0x155804?0x0:_0x611328[_0xfa44('0x1d')];var _0xd25791=_0x155804?_0x119f1a[_0xfa44('0x20')]:_0x611328['offset']+_0x611328['limit'];var _0x48017a;if(_0xd25791>=_0x49e0ba){_0xd25791=_0x49e0ba;_0x48017a=0xc8;}else{_0x48017a=0xce;}_0x1312db['status'](_0x48017a);return _0x1312db[_0xfa44('0x21')](_0xfa44('0x22'),_0x16549c+'-'+_0xd25791+'/'+_0x49e0ba)[_0xfa44('0x1c')](_0x119f1a);}return null;};}function patchUpdates(_0x167460){return function(_0xea8f09){try{jsonpatch[_0xfa44('0x23')](_0xea8f09,_0x167460,!![]);}catch(_0x52c680){return BPromise[_0xfa44('0x24')](_0x52c680);}return _0xea8f09[_0xfa44('0x25')]();};}function saveUpdates(_0x1ba6e7,_0x309495){return function(_0x32ed57){if(_0x32ed57){return _0x32ed57[_0xfa44('0x26')](_0x1ba6e7)[_0xfa44('0x27')](function(_0x5cb228){return _0x5cb228;});}return null;};}function removeEntity(_0x5b57ef,_0x83e1d3){return function(_0x3f3b7b){if(_0x3f3b7b){return _0x3f3b7b[_0xfa44('0x28')]()[_0xfa44('0x27')](function(){_0x5b57ef[_0xfa44('0x1b')](0xcc)[_0xfa44('0x29')]();});}};}function handleEntityNotFound(_0x23538c,_0x125826){return function(_0x27b27e){if(!_0x27b27e){_0x23538c[_0xfa44('0x1a')](0x194);}return _0x27b27e;};}function handleError(_0x109d21,_0xdb7dcd){_0xdb7dcd=_0xdb7dcd||0x1f4;return function(_0xdb6de4){logger['error'](_0xdb6de4[_0xfa44('0x2a')]);if(_0xdb6de4[_0xfa44('0x2b')]){delete _0xdb6de4['name'];}_0x109d21[_0xfa44('0x1b')](_0xdb7dcd)[_0xfa44('0x2c')](_0xdb6de4);};}exports[_0xfa44('0x2d')]=function(_0x2f513d,_0x5a46e1){var _0x880cd4={},_0x315e0e={},_0x38362e={'count':0x0,'rows':[]};var _0x41f0dc=_[_0xfa44('0x2e')](db[_0xfa44('0x2f')][_0xfa44('0x30')],function(_0x3fe5cf){return{'name':_0x3fe5cf['fieldName'],'type':_0x3fe5cf[_0xfa44('0x31')]['key']};});_0x315e0e['model']=_[_0xfa44('0x2e')](_0x41f0dc,_0xfa44('0x2b'));_0x315e0e[_0xfa44('0x32')]=_['keys'](_0x2f513d[_0xfa44('0x32')]);_0x315e0e[_0xfa44('0x33')]=_[_0xfa44('0x34')](_0x315e0e['model'],_0x315e0e[_0xfa44('0x32')]);_0x880cd4[_0xfa44('0x35')]=_[_0xfa44('0x34')](_0x315e0e[_0xfa44('0x36')],qs[_0xfa44('0x37')](_0x2f513d['query']['fields']));_0x880cd4['attributes']=_0x880cd4['attributes'][_0xfa44('0x38')]?_0x880cd4['attributes']:_0x315e0e[_0xfa44('0x36')];if(!_0x2f513d[_0xfa44('0x32')][_0xfa44('0x39')](_0xfa44('0x3a'))){_0x880cd4[_0xfa44('0x1f')]=qs[_0xfa44('0x1f')](_0x2f513d[_0xfa44('0x32')][_0xfa44('0x1f')]);_0x880cd4[_0xfa44('0x1d')]=qs[_0xfa44('0x1d')](_0x2f513d['query'][_0xfa44('0x1d')]);}_0x880cd4[_0xfa44('0x3b')]=qs[_0xfa44('0x3c')](_0x2f513d[_0xfa44('0x32')]['sort']);_0x880cd4[_0xfa44('0x3d')]=qs[_0xfa44('0x33')](_[_0xfa44('0x3e')](_0x2f513d[_0xfa44('0x32')],_0x315e0e[_0xfa44('0x33')]),_0x41f0dc);if(_0x2f513d[_0xfa44('0x32')][_0xfa44('0x3f')]){_0x880cd4['where']=_[_0xfa44('0x40')](_0x880cd4[_0xfa44('0x3d')],{'$or':_[_0xfa44('0x2e')](_0x41f0dc,function(_0x17a8ac){if(_0x17a8ac[_0xfa44('0x31')]!==_0xfa44('0x41')){var _0x3a1af7={};_0x3a1af7[_0x17a8ac['name']]={'$like':'%'+_0x2f513d[_0xfa44('0x32')][_0xfa44('0x3f')]+'%'};return _0x3a1af7;}})});}_0x880cd4=_['merge']({},_0x880cd4,_0x2f513d[_0xfa44('0x42')]);var _0x24f1f7={'where':_0x880cd4['where']};return db[_0xfa44('0x2f')][_0xfa44('0x20')](_0x24f1f7)[_0xfa44('0x27')](function(_0x22af7c){_0x38362e[_0xfa44('0x20')]=_0x22af7c;if(_0x2f513d[_0xfa44('0x32')]['includeAll']){_0x880cd4[_0xfa44('0x43')]=[{'all':!![]}];}return db[_0xfa44('0x2f')]['findAll'](_0x880cd4);})[_0xfa44('0x27')](function(_0x40d1a7){_0x38362e[_0xfa44('0x44')]=_0x40d1a7;return _0x38362e;})[_0xfa44('0x27')](respondWithFilteredResult(_0x5a46e1,_0x880cd4))[_0xfa44('0x45')](handleError(_0x5a46e1,null));};exports['show']=function(_0x86ce27,_0x1f041f){var _0x3499c7={'raw':!![],'where':{'id':_0x86ce27['params']['id']}},_0x15f09a={};_0x15f09a[_0xfa44('0x36')]=_[_0xfa44('0x46')](db[_0xfa44('0x2f')]['rawAttributes']);_0x15f09a[_0xfa44('0x32')]=_[_0xfa44('0x46')](_0x86ce27[_0xfa44('0x32')]);_0x15f09a['filters']=_[_0xfa44('0x34')](_0x15f09a[_0xfa44('0x36')],_0x15f09a[_0xfa44('0x32')]);_0x3499c7['attributes']=_[_0xfa44('0x34')](_0x15f09a['model'],qs['fields'](_0x86ce27['query'][_0xfa44('0x37')]));_0x3499c7[_0xfa44('0x35')]=_0x3499c7[_0xfa44('0x35')][_0xfa44('0x38')]?_0x3499c7[_0xfa44('0x35')]:_0x15f09a['model'];if(_0x86ce27[_0xfa44('0x32')][_0xfa44('0x47')]){_0x3499c7['include']=[{'all':!![]}];}_0x3499c7=_[_0xfa44('0x40')]({},_0x3499c7,_0x86ce27[_0xfa44('0x42')]);return db['CmHopperHistory']['find'](_0x3499c7)[_0xfa44('0x27')](handleEntityNotFound(_0x1f041f,null))[_0xfa44('0x27')](respondWithResult(_0x1f041f,null))[_0xfa44('0x45')](handleError(_0x1f041f,null));};exports[_0xfa44('0x48')]=function(_0x509bf2,_0x5bc6bf){return db[_0xfa44('0x2f')][_0xfa44('0x48')](_0x509bf2[_0xfa44('0x49')],{})[_0xfa44('0x27')](respondWithResult(_0x5bc6bf,0xc9))[_0xfa44('0x45')](handleError(_0x5bc6bf,null));};exports[_0xfa44('0x4a')]=function(_0xe3d96a,_0x11ae16){return db[_0xfa44('0x2f')][_0xfa44('0x4a')]()[_0xfa44('0x27')](respondWithResult(_0x11ae16,null))[_0xfa44('0x45')](handleError(_0x11ae16,null));};exports[_0xfa44('0x26')]=function(_0x479f94,_0x46e138){if(_0x479f94[_0xfa44('0x49')][_0xfa44('0x4b')]){delete _0x479f94[_0xfa44('0x49')][_0xfa44('0x4b')];}return db[_0xfa44('0x2f')][_0xfa44('0x4c')]({'where':{'uniqueid':_0x479f94[_0xfa44('0x4d')]['id']}})[_0xfa44('0x27')](handleEntityNotFound(_0x46e138,null))[_0xfa44('0x27')](saveUpdates(_0x479f94[_0xfa44('0x49')],null))[_0xfa44('0x27')](respondWithResult(_0x46e138,null))[_0xfa44('0x45')](handleError(_0x46e138,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3a6b617..a32fa55 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 _0x25a9=['rimraf','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0xf89181,_0x2b1f87){var _0x4803f3=function(_0x59ac01){while(--_0x59ac01){_0xf89181['push'](_0xf89181['shift']());}};_0x4803f3(++_0x2b1f87);}(_0x25a9,0xf1));var _0x925a=function(_0x17ebe2,_0x1072c9){_0x17ebe2=_0x17ebe2-0x0;var _0x2694d7=_0x25a9[_0x17ebe2];return _0x2694d7;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var logger=require(_0x925a('0x1'))(_0x925a('0x2'));var moment=require(_0x925a('0x3'));var BPromise=require(_0x925a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x925a('0x5'));var rimraf=require(_0x925a('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x925a('0x7')]=function(_0x5271bc,_0x436db7){return _0x5271bc[_0x925a('0x8')](_0x925a('0x9'),attributes,{'tableName':_0x925a('0xa'),'paranoid':![],'indexes':[{'name':_0x925a('0xb'),'fields':[_0x925a('0xb')]},{'name':_0x925a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d21=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x3a7f8b,_0x7fe06c){var _0x34f066=function(_0x38f2a7){while(--_0x38f2a7){_0x3a7f8b['push'](_0x3a7f8b['shift']());}};_0x34f066(++_0x7fe06c);}(_0x1d21,0x158));var _0x11d2=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x1d21[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x11d2('0xd')]},{'name':_0x11d2('0xe'),'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 4031795..1f5474d 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 _0x6953=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','info','debug','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x12df9a,_0x44d9ad){var _0x212752=function(_0x187005){while(--_0x187005){_0x12df9a['push'](_0x12df9a['shift']());}};_0x212752(++_0x44d9ad);}(_0x6953,0x91));var _0x3695=function(_0x291374,_0x1f67b3){_0x291374=_0x291374-0x0;var _0x5c62a9=_0x6953[_0x291374];return _0x5c62a9;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});}exports[_0x3695('0x12')]=function(_0x5edf8d){var _0x1082db=this;return new Promise(function(_0xcc93bb,_0x1553ea){return db[_0x3695('0x13')][_0x3695('0x14')](_0x5edf8d['body'],{'raw':_0x5edf8d[_0x3695('0x15')]?_0x5edf8d[_0x3695('0x15')][_0x3695('0x16')]===undefined?!![]:![]:!![]})[_0x3695('0x17')](function(_0xc076a9){logger[_0x3695('0x18')](_0x3695('0x12'),_0x5edf8d);logger[_0x3695('0x19')](_0x3695('0x12'),_0x5edf8d,JSON[_0x3695('0xb')](_0xc076a9));_0xcc93bb(_0xc076a9);})[_0x3695('0x11')](function(_0xf2c747){logger[_0x3695('0xc')](_0x3695('0x12'),_0xf2c747['message'],_0x5edf8d);_0x1553ea(_0x1082db[_0x3695('0xc')](0x1f4,_0xf2c747[_0x3695('0xf')]));});});};exports['AvgHandleTime']=function(_0x4940e9){var _0x3ac6aa=this;return new Promise(function(_0x26d9fc,_0x951370){return db[_0x3695('0x13')]['findAll']({'raw':_0x4940e9[_0x3695('0x15')]?_0x4940e9['options'][_0x3695('0x16')]===undefined?!![]:![]:!![],'where':_0x4940e9['options']?_0x4940e9[_0x3695('0x15')]['where']||null:null,'attributes':[[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')][_0x3695('0x1c')]('id')),_0x3695('0x1d')],[db[_0x3695('0x1a')]['fn']('COUNT',db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')]['literal'](_0x3695('0x1e')))),'predictiveIntervalAnsweredCalls'],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x20')))),_0x3695('0x21')],[db[_0x3695('0x1a')]['fn']('COUNT',db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x3695('0x1a')]['fn']('AVG',db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')]['literal'](_0x3695('0x22')))),'predictiveIntervalAvgHoldtime'],[db[_0x3695('0x1a')]['fn'](_0x3695('0x23'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x24')))),'predictiveIntervalAvgTalktime']]})[_0x3695('0x17')](function(_0x33043e){logger['info'](_0x3695('0x25'),_0x4940e9);logger[_0x3695('0x19')]('AvgHandleTime',_0x4940e9,JSON['stringify'](_0x33043e));_0x26d9fc(_0x33043e);})['catch'](function(_0x4d3b2c){logger[_0x3695('0xc')](_0x3695('0x25'),_0x4d3b2c['message'],_0x4940e9);_0x951370(_0x3ac6aa[_0x3695('0xc')](0x1f4,_0x4d3b2c[_0x3695('0xf')]));});});};exports[_0x3695('0x26')]=function(_0x33d5c6){var _0x4b7fdf=this;return new Promise(function(_0x5170a5,_0x456c04){return db[_0x3695('0x13')]['findAll']({'raw':_0x33d5c6[_0x3695('0x15')]?_0x33d5c6[_0x3695('0x15')][_0x3695('0x16')]===undefined?!![]:![]:!![],'where':_0x33d5c6[_0x3695('0x15')]?_0x33d5c6[_0x3695('0x15')][_0x3695('0x27')]||null:null,'attributes':[[_0x3695('0x28'),_0x3695('0x29')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x2a')))),_0x3695('0x2b')],[db[_0x3695('0x1a')]['fn']('COUNT',db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x2c')))),_0x3695('0x2d')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db['sequelize']['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x1e')))),'outboundAnswerCallsDay'],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x2e')))),_0x3695('0x2f')],[db['sequelize']['fn'](_0x3695('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0x3695('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x3695('0x30')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db['sequelize'][_0x3695('0x1f')](_0x3695('0x31')))),_0x3695('0x32')],[db['sequelize']['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')](_0x3695('0x33')))),_0x3695('0x34')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3695('0x35')))),_0x3695('0x36')],[db[_0x3695('0x1a')]['fn']('COUNT',db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')]('`state`\x20=\x2013,\x201,\x20null'))),_0x3695('0x37')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')]['literal'](_0x3695('0x38')))),_0x3695('0x39')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db['sequelize']['fn']('IF',db[_0x3695('0x1a')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x3695('0x3a')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x3695('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3695('0x3b')))),_0x3695('0x3a')],[db['sequelize']['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3695('0x3c')))),_0x3695('0x3d')]],'group':[_0x3695('0x28')]})['then'](function(_0x114423){logger[_0x3695('0x18')](_0x3695('0x26'),_0x33d5c6);logger[_0x3695('0x19')](_0x3695('0x26'),_0x33d5c6,JSON[_0x3695('0xb')](_0x114423));_0x5170a5(_0x114423);})[_0x3695('0x11')](function(_0x18b5b3){logger[_0x3695('0xc')](_0x3695('0x26'),_0x18b5b3[_0x3695('0xf')],_0x33d5c6);_0x456c04(_0x4b7fdf[_0x3695('0xc')](0x1f4,_0x18b5b3[_0x3695('0xf')]));});});};exports[_0x3695('0x3e')]=function(_0x178c76){var _0x63771a=this;return new Promise(function(_0x441997,_0x38cfec){return db[_0x3695('0x13')][_0x3695('0x3f')]({'raw':_0x178c76[_0x3695('0x15')]?_0x178c76[_0x3695('0x15')][_0x3695('0x16')]===undefined?!![]:![]:!![],'where':_0x178c76['options']?_0x178c76['options'][_0x3695('0x27')]||null:null,'attributes':[[_0x3695('0x28'),'name'],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')][_0x3695('0x1c')]('id')),_0x3695('0x40')],[db[_0x3695('0x1a')]['fn'](_0x3695('0x1b'),db[_0x3695('0x1a')]['fn']('IF',db[_0x3695('0x1a')][_0x3695('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x3695('0x41')]],'group':[_0x3695('0x28')]})[_0x3695('0x17')](function(_0x37ae94){logger[_0x3695('0x18')]('GetCampaignHopperHistory',_0x178c76);logger[_0x3695('0x19')](_0x3695('0x3e'),_0x178c76,JSON[_0x3695('0xb')](_0x37ae94));_0x441997(_0x37ae94);})['catch'](function(_0x39ce88){logger[_0x3695('0xc')]('GetCampaignHopperHistory',_0x39ce88['message'],_0x178c76);_0x38cfec(_0x63771a[_0x3695('0xc')](0x1f4,_0x39ce88['message']));});});}; \ No newline at end of file +var _0xb720=['COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','CmHopperHistory','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','error','CmHopperHistory,\x20%s,\x20%s','message','result','create','body','options','raw','CreateCmHopperHistory','stringify','catch','findAll','where','sequelize','col'];(function(_0x283531,_0x5e25b1){var _0x3ceaed=function(_0x29f8dd){while(--_0x29f8dd){_0x283531['push'](_0x283531['shift']());}};_0x3ceaed(++_0x5e25b1);}(_0xb720,0x191));var _0x0b72=function(_0x25949d,_0x49889d){_0x25949d=_0x25949d-0x0;var _0x321fac=_0xb720[_0x25949d];return _0x321fac;};'use strict';var _=require(_0x0b72('0x0'));var util=require('util');var moment=require(_0x0b72('0x1'));var BPromise=require(_0x0b72('0x2'));var rs=require(_0x0b72('0x3'));var fs=require('fs');var Redis=require(_0x0b72('0x4'));var db=require(_0x0b72('0x5'))['db'];var utils=require(_0x0b72('0x6'));var logger=require(_0x0b72('0x7'))(_0x0b72('0x8'));var config=require(_0x0b72('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0b72('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a365d,_0x39a86b,_0x473736){return new BPromise(function(_0x303d11,_0x3ddb81){return client[_0x0b72('0xb')](_0x2a365d,_0x473736)[_0x0b72('0xc')](function(_0x191100){logger[_0x0b72('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x39a86b,_0x0b72('0xe'));logger[_0x0b72('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x39a86b,'request\x20sent',JSON['stringify'](_0x191100));if(_0x191100[_0x0b72('0x10')]){if(_0x191100['error']['code']===0x1f4){logger['error'](_0x0b72('0x11'),_0x39a86b,_0x191100[_0x0b72('0x10')][_0x0b72('0x12')]);return _0x3ddb81(_0x191100[_0x0b72('0x10')][_0x0b72('0x12')]);}logger[_0x0b72('0x10')](_0x0b72('0x11'),_0x39a86b,_0x191100['error'][_0x0b72('0x12')]);return _0x303d11(_0x191100['error'][_0x0b72('0x12')]);}else{logger[_0x0b72('0xd')](_0x0b72('0x11'),_0x39a86b,_0x0b72('0xe'));_0x303d11(_0x191100[_0x0b72('0x13')][_0x0b72('0x12')]);}})['catch'](function(_0x24a031){logger[_0x0b72('0x10')](_0x0b72('0x11'),_0x39a86b,_0x24a031);_0x3ddb81(_0x24a031);});});}exports['CreateCmHopperHistory']=function(_0x3713aa){var _0x575385=this;return new Promise(function(_0xfe7a75,_0x33791e){return db['CmHopperHistory'][_0x0b72('0x14')](_0x3713aa[_0x0b72('0x15')],{'raw':_0x3713aa[_0x0b72('0x16')]?_0x3713aa[_0x0b72('0x16')][_0x0b72('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1e793d){logger[_0x0b72('0xd')](_0x0b72('0x18'),_0x3713aa);logger['debug']('CreateCmHopperHistory',_0x3713aa,JSON[_0x0b72('0x19')](_0x1e793d));_0xfe7a75(_0x1e793d);})[_0x0b72('0x1a')](function(_0x73bc5f){logger['error'](_0x0b72('0x18'),_0x73bc5f[_0x0b72('0x12')],_0x3713aa);_0x33791e(_0x575385[_0x0b72('0x10')](0x1f4,_0x73bc5f[_0x0b72('0x12')]));});});};exports['AvgHandleTime']=function(_0x2cca65){var _0x3ed32a=this;return new Promise(function(_0xdc43e7,_0xa3283d){return db['CmHopperHistory'][_0x0b72('0x1b')]({'raw':_0x2cca65[_0x0b72('0x16')]?_0x2cca65[_0x0b72('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2cca65['options']?_0x2cca65['options'][_0x0b72('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x0b72('0x1d')][_0x0b72('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db['sequelize']['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x0b72('0x21')],[db['sequelize']['fn'](_0x0b72('0x1f'),db['sequelize']['fn']('IF',db[_0x0b72('0x1d')]['literal'](_0x0b72('0x22')))),_0x0b72('0x23')],[db[_0x0b72('0x1d')]['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db['sequelize'][_0x0b72('0x20')](_0x0b72('0x24')))),_0x0b72('0x25')],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x26'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x27')))),_0x0b72('0x28')],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x26'),db['sequelize']['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x0b72('0x29')]]})['then'](function(_0x3c8367){logger[_0x0b72('0xd')](_0x0b72('0x2a'),_0x2cca65);logger[_0x0b72('0xf')]('AvgHandleTime',_0x2cca65,JSON[_0x0b72('0x19')](_0x3c8367));_0xdc43e7(_0x3c8367);})[_0x0b72('0x1a')](function(_0x52bd5c){logger[_0x0b72('0x10')]('AvgHandleTime',_0x52bd5c[_0x0b72('0x12')],_0x2cca65);_0xa3283d(_0x3ed32a['error'](0x1f4,_0x52bd5c[_0x0b72('0x12')]));});});};exports[_0x0b72('0x2b')]=function(_0x1e3e52){var _0xe79134=this;return new Promise(function(_0xfb6a98,_0x441c06){return db['CmHopperHistory'][_0x0b72('0x1b')]({'raw':_0x1e3e52['options']?_0x1e3e52[_0x0b72('0x16')][_0x0b72('0x17')]===undefined?!![]:![]:!![],'where':_0x1e3e52[_0x0b72('0x16')]?_0x1e3e52[_0x0b72('0x16')]['where']||null:null,'attributes':[['campaign',_0x0b72('0x2c')],[db['sequelize']['fn'](_0x0b72('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0b72('0x20')](_0x0b72('0x2d')))),_0x0b72('0x2e')],[db[_0x0b72('0x1d')]['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x2f')))),_0x0b72('0x30')],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')]['literal'](_0x0b72('0x31')))),_0x0b72('0x32')],[db[_0x0b72('0x1d')]['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x33')))),_0x0b72('0x34')],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x35')))),_0x0b72('0x36')],[db['sequelize']['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x37')))),'outboundDropCallsDayTimeout'],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db['sequelize']['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x38')))),_0x0b72('0x39')],[db['sequelize']['fn'](_0x0b72('0x1f'),db['sequelize']['fn']('IF',db[_0x0b72('0x1d')]['literal'](_0x0b72('0x3a')))),'outboundUnknownCallsDay'],[db[_0x0b72('0x1d')]['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x3b')))),_0x0b72('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x3d')))),'outboundOriginateFailureCallsDay'],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')]['literal'](_0x0b72('0x3e')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0b72('0x3f')],[db[_0x0b72('0x1d')]['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x40')))),_0x0b72('0x41')],[db['sequelize']['fn']('COUNT',db[_0x0b72('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x0b72('0x42')))),_0x0b72('0x43')]],'group':[_0x0b72('0x44')]})[_0x0b72('0xc')](function(_0x308d92){logger[_0x0b72('0xd')](_0x0b72('0x2b'),_0x1e3e52);logger[_0x0b72('0xf')](_0x0b72('0x2b'),_0x1e3e52,JSON[_0x0b72('0x19')](_0x308d92));_0xfb6a98(_0x308d92);})[_0x0b72('0x1a')](function(_0x6792c2){logger[_0x0b72('0x10')](_0x0b72('0x2b'),_0x6792c2[_0x0b72('0x12')],_0x1e3e52);_0x441c06(_0xe79134[_0x0b72('0x10')](0x1f4,_0x6792c2['message']));});});};exports[_0x0b72('0x45')]=function(_0x274687){var _0x54873f=this;return new Promise(function(_0x799a33,_0x412885){return db[_0x0b72('0x46')]['findAll']({'raw':_0x274687['options']?_0x274687['options'][_0x0b72('0x17')]===undefined?!![]:![]:!![],'where':_0x274687[_0x0b72('0x16')]?_0x274687[_0x0b72('0x16')]['where']||null:null,'attributes':[[_0x0b72('0x44'),_0x0b72('0x2c')],[db['sequelize']['fn']('COUNT',db[_0x0b72('0x1d')][_0x0b72('0x1e')]('id')),_0x0b72('0x47')],[db[_0x0b72('0x1d')]['fn'](_0x0b72('0x1f'),db[_0x0b72('0x1d')]['fn']('IF',db[_0x0b72('0x1d')][_0x0b72('0x20')](_0x0b72('0x31')))),'ivrAnswerCallsDay']],'group':[_0x0b72('0x44')]})[_0x0b72('0xc')](function(_0x529fd0){logger[_0x0b72('0xd')](_0x0b72('0x45'),_0x274687);logger[_0x0b72('0xf')]('GetCampaignHopperHistory',_0x274687,JSON[_0x0b72('0x19')](_0x529fd0));_0x799a33(_0x529fd0);})[_0x0b72('0x1a')](function(_0x1089f8){logger[_0x0b72('0x10')](_0x0b72('0x45'),_0x1089f8['message'],_0x274687);_0x412885(_0x54873f[_0x0b72('0x10')](0x1f4,_0x1089f8[_0x0b72('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 639f843..1e3b4b4 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 _0x9d84=['put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9d84,0x163));var _0x49d8=function(_0x2c5982,_0x3e9828){_0x2c5982=_0x2c5982-0x0;var _0xe0bb93=_0x9d84[_0x2c5982];return _0xe0bb93;};'use strict';var multer=require(_0x49d8('0x0'));var util=require(_0x49d8('0x1'));var path=require(_0x49d8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49d8('0x3')]();var fs_extra=require(_0x49d8('0x4'));var auth=require(_0x49d8('0x5'));var interaction=require(_0x49d8('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x49d8('0x7')](),controller[_0x49d8('0x8')]);router[_0x49d8('0x9')](_0x49d8('0xa'),auth['isAuthenticated'](),controller[_0x49d8('0xb')]);router[_0x49d8('0x9')](_0x49d8('0xc'),auth[_0x49d8('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x49d8('0xd')](_0x49d8('0xc'),auth['isAuthenticated'](),controller[_0x49d8('0xe')]);module[_0x49d8('0xf')]=router; \ No newline at end of file +var _0x8cba=['isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x1d0f10,_0x4de9fb){var _0xa1dcaf=function(_0x278463){while(--_0x278463){_0x1d0f10['push'](_0x1d0f10['shift']());}};_0xa1dcaf(++_0x4de9fb);}(_0x8cba,0x82));var _0xa8cb=function(_0x4b8fc7,_0x5022fc){_0x4b8fc7=_0x4b8fc7-0x0;var _0x249f4a=_0x8cba[_0x4b8fc7];return _0x249f4a;};'use strict';var multer=require(_0xa8cb('0x0'));var util=require('util');var path=require(_0xa8cb('0x1'));var timeout=require(_0xa8cb('0x2'));var express=require(_0xa8cb('0x3'));var router=express[_0xa8cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa8cb('0x5'));var interaction=require(_0xa8cb('0x6'));var config=require(_0xa8cb('0x7'));var controller=require(_0xa8cb('0x8'));router[_0xa8cb('0x9')]('/',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xb')]);router[_0xa8cb('0x9')](_0xa8cb('0xc'),auth[_0xa8cb('0xa')](),controller['describe']);router[_0xa8cb('0x9')](_0xa8cb('0xd'),auth[_0xa8cb('0xa')](),controller[_0xa8cb('0xe')]);router[_0xa8cb('0xf')]('/',auth[_0xa8cb('0xa')](),controller[_0xa8cb('0x10')]);router[_0xa8cb('0x11')](_0xa8cb('0xd'),auth[_0xa8cb('0xa')](),controller[_0xa8cb('0x12')]);module[_0xa8cb('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 e95894d..56fc990 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 _0x0c02=['exports','STRING'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x20c0('0x0')]={'name':{'type':Sequelize[_0x20c0('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x20c0('0x1')]},'dialPrefix':{'type':Sequelize[_0x20c0('0x1')]}}; \ No newline at end of file +var _0x25fa=['name','sequelize','STRING'];(function(_0x252e70,_0x1b6bd2){var _0xdfe15b=function(_0xed06c8){while(--_0xed06c8){_0x252e70['push'](_0x252e70['shift']());}};_0xdfe15b(++_0x1b6bd2);}(_0x25fa,0x109));var _0xa25f=function(_0xdcd1a4,_0x171f5d){_0xdcd1a4=_0xdcd1a4-0x0;var _0x2000c8=_0x25fa[_0xdcd1a4];return _0x2000c8;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'name':{'type':Sequelize[_0xa25f('0x1')],'unique':_0xa25f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xa25f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 01157d0..b6a90ce 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 _0x7f16=['offset','undefined','limit','set','json','apply','reject','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','CmList','count','findAll','rows','show','params','fields','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','success','push','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end'];(function(_0x40937d,_0xee78bc){var _0x297f23=function(_0x3a878a){while(--_0x3a878a){_0x40937d['push'](_0x40937d['shift']());}};_0x297f23(++_0xee78bc);}(_0x7f16,0x8b));var _0x67f1=function(_0x3ce6f5,_0x29c4ae){_0x3ce6f5=_0x3ce6f5-0x0;var _0x2844a6=_0x7f16[_0x3ce6f5];return _0x2844a6;};'use strict';var emlformat=require(_0x67f1('0x0'));var rimraf=require(_0x67f1('0x1'));var zipdir=require(_0x67f1('0x2'));var jsonpatch=require(_0x67f1('0x3'));var rp=require('request-promise');var moment=require(_0x67f1('0x4'));var BPromise=require(_0x67f1('0x5'));var Mustache=require(_0x67f1('0x6'));var util=require(_0x67f1('0x7'));var path=require(_0x67f1('0x8'));var sox=require(_0x67f1('0x9'));var csv=require(_0x67f1('0xa'));var ejs=require(_0x67f1('0xb'));var fs=require('fs');var fs_extra=require(_0x67f1('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x67f1('0xd'));var jsforce=require(_0x67f1('0xe'));var deskjs=require(_0x67f1('0xf'));var toCsv=require(_0x67f1('0xa'));var querystring=require(_0x67f1('0x10'));var Papa=require(_0x67f1('0x11'));var Redis=require('ioredis');var authService=require(_0x67f1('0x12'));var qs=require(_0x67f1('0x13'));var as=require(_0x67f1('0x14'));var hardwareService=require(_0x67f1('0x15'));var logger=require(_0x67f1('0x16'))(_0x67f1('0x17'));var utils=require(_0x67f1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x67f1('0x19'));var db=require(_0x67f1('0x1a'))['db'];var csv_results;config[_0x67f1('0x1b')]=_['defaults'](config[_0x67f1('0x1b')],{'host':_0x67f1('0x1c'),'port':0x18eb});var socket=require(_0x67f1('0x1d'))(new Redis(config[_0x67f1('0x1b')]));require(_0x67f1('0x1e'))['register'](socket);function respondWithStatusCode(_0x2866ff,_0x558af0){_0x558af0=_0x558af0||0xcc;return function(_0x403554){if(_0x403554){return _0x2866ff[_0x67f1('0x1f')](_0x558af0);}return _0x2866ff[_0x67f1('0x20')](_0x558af0)[_0x67f1('0x21')]();};}function respondWithResult(_0x23cfba,_0x4bcf23){_0x4bcf23=_0x4bcf23||0xc8;return function(_0x29a239){if(_0x29a239){return _0x23cfba[_0x67f1('0x20')](_0x4bcf23)['json'](_0x29a239);}};}function respondWithFilteredResult(_0x10dd56,_0x3c6472){return function(_0x17e08d){if(_0x17e08d){var _0x32fe6e=typeof _0x3c6472[_0x67f1('0x22')]===_0x67f1('0x23')&&typeof _0x3c6472[_0x67f1('0x24')]===_0x67f1('0x23');var _0x22fca0=_0x17e08d['count'];var _0x267cca=_0x32fe6e?0x0:_0x3c6472['offset'];var _0x41d5c0=_0x32fe6e?_0x17e08d['count']:_0x3c6472[_0x67f1('0x22')]+_0x3c6472[_0x67f1('0x24')];var _0x149667;if(_0x41d5c0>=_0x22fca0){_0x41d5c0=_0x22fca0;_0x149667=0xc8;}else{_0x149667=0xce;}_0x10dd56[_0x67f1('0x20')](_0x149667);return _0x10dd56[_0x67f1('0x25')]('Content-Range',_0x267cca+'-'+_0x41d5c0+'/'+_0x22fca0)[_0x67f1('0x26')](_0x17e08d);}return null;};}function patchUpdates(_0x932e09){return function(_0xbd068a){try{jsonpatch[_0x67f1('0x27')](_0xbd068a,_0x932e09,!![]);}catch(_0x9c8d07){return BPromise[_0x67f1('0x28')](_0x9c8d07);}return _0xbd068a['save']();};}function saveUpdates(_0x1fb860,_0x504cf5){return function(_0x7c97ab){if(_0x7c97ab){return _0x7c97ab[_0x67f1('0x29')](_0x1fb860)['then'](function(_0xd22f04){return _0xd22f04;});}return null;};}function removeEntity(_0x334215,_0x193966){return function(_0x1c60d9){if(_0x1c60d9){return _0x1c60d9[_0x67f1('0x2a')]()[_0x67f1('0x2b')](function(){var _0x1cbeb0=_0x1c60d9[_0x67f1('0x2c')]({'plain':!![]});var _0x27b6c7=_0x67f1('0x2d');return db[_0x67f1('0x2e')][_0x67f1('0x2a')]({'where':{'type':_0x27b6c7,'resourceId':_0x1cbeb0['id']}})[_0x67f1('0x2b')](function(){return _0x1c60d9;});})[_0x67f1('0x2b')](function(){_0x334215[_0x67f1('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba906,_0x5aeb6c){return function(_0x3b6fd9){if(!_0x3b6fd9){_0x4ba906[_0x67f1('0x1f')](0x194);}return _0x3b6fd9;};}function handleError(_0x426d18,_0x3c06b7){_0x3c06b7=_0x3c06b7||0x1f4;return function(_0x48045b){logger[_0x67f1('0x2f')](_0x48045b[_0x67f1('0x30')]);if(_0x48045b[_0x67f1('0x31')]){delete _0x48045b[_0x67f1('0x31')];}_0x426d18['status'](_0x3c06b7)[_0x67f1('0x32')](_0x48045b);};}exports[_0x67f1('0x33')]=function(_0x4f590c,_0x14764b){var _0x20fb24={},_0x17f63={},_0x1246a0={'count':0x0,'rows':[]};var _0xb06800=_[_0x67f1('0x34')](db['CmList'][_0x67f1('0x35')],function(_0x4b2201){return{'name':_0x4b2201[_0x67f1('0x36')],'type':_0x4b2201['type'][_0x67f1('0x37')]};});_0x17f63[_0x67f1('0x38')]=_[_0x67f1('0x34')](_0xb06800,_0x67f1('0x31'));_0x17f63['query']=_[_0x67f1('0x39')](_0x4f590c[_0x67f1('0x3a')]);_0x17f63[_0x67f1('0x3b')]=_['intersection'](_0x17f63[_0x67f1('0x38')],_0x17f63[_0x67f1('0x3a')]);_0x20fb24[_0x67f1('0x3c')]=_[_0x67f1('0x3d')](_0x17f63[_0x67f1('0x38')],qs['fields'](_0x4f590c['query']['fields']));_0x20fb24[_0x67f1('0x3c')]=_0x20fb24[_0x67f1('0x3c')][_0x67f1('0x3e')]?_0x20fb24['attributes']:_0x17f63[_0x67f1('0x38')];if(!_0x4f590c[_0x67f1('0x3a')][_0x67f1('0x3f')]('nolimit')){_0x20fb24[_0x67f1('0x24')]=qs[_0x67f1('0x24')](_0x4f590c[_0x67f1('0x3a')][_0x67f1('0x24')]);_0x20fb24[_0x67f1('0x22')]=qs[_0x67f1('0x22')](_0x4f590c['query'][_0x67f1('0x22')]);}_0x20fb24[_0x67f1('0x40')]=qs[_0x67f1('0x41')](_0x4f590c[_0x67f1('0x3a')][_0x67f1('0x41')]);_0x20fb24[_0x67f1('0x42')]=qs['filters'](_['pick'](_0x4f590c[_0x67f1('0x3a')],_0x17f63[_0x67f1('0x3b')]),_0xb06800);if(_0x4f590c[_0x67f1('0x3a')][_0x67f1('0x43')]){_0x20fb24[_0x67f1('0x42')]=_[_0x67f1('0x44')](_0x20fb24[_0x67f1('0x42')],{'$or':_['map'](_0xb06800,function(_0x40181f){if(_0x40181f[_0x67f1('0x45')]!==_0x67f1('0x46')){var _0x46d41f={};_0x46d41f[_0x40181f[_0x67f1('0x31')]]={'$like':'%'+_0x4f590c['query']['filter']+'%'};return _0x46d41f;}})});}_0x20fb24=_[_0x67f1('0x44')]({},_0x20fb24,_0x4f590c[_0x67f1('0x47')]);var _0x2552c6={'where':_0x20fb24[_0x67f1('0x42')]};return db[_0x67f1('0x48')][_0x67f1('0x49')](_0x2552c6)[_0x67f1('0x2b')](function(_0x15e24c){_0x1246a0['count']=_0x15e24c;if(_0x4f590c['query']['includeAll']){_0x20fb24['include']=[{'all':!![]}];}return db['CmList'][_0x67f1('0x4a')](_0x20fb24);})[_0x67f1('0x2b')](function(_0x127555){_0x1246a0[_0x67f1('0x4b')]=_0x127555;return _0x1246a0;})[_0x67f1('0x2b')](respondWithFilteredResult(_0x14764b,_0x20fb24))['catch'](handleError(_0x14764b,null));};exports[_0x67f1('0x4c')]=function(_0x577801,_0x5b79d4){var _0x30a9e4={'raw':![],'where':{'id':_0x577801[_0x67f1('0x4d')]['id']}},_0x25db9c={};_0x25db9c['model']=_[_0x67f1('0x39')](db[_0x67f1('0x48')][_0x67f1('0x35')]);_0x25db9c[_0x67f1('0x3a')]=_[_0x67f1('0x39')](_0x577801[_0x67f1('0x3a')]);_0x25db9c[_0x67f1('0x3b')]=_[_0x67f1('0x3d')](_0x25db9c['model'],_0x25db9c[_0x67f1('0x3a')]);_0x30a9e4[_0x67f1('0x3c')]=_[_0x67f1('0x3d')](_0x25db9c['model'],qs['fields'](_0x577801[_0x67f1('0x3a')][_0x67f1('0x4e')]));_0x30a9e4['attributes']=_0x30a9e4[_0x67f1('0x3c')][_0x67f1('0x3e')]?_0x30a9e4[_0x67f1('0x3c')]:_0x25db9c['model'];if(_0x577801[_0x67f1('0x3a')][_0x67f1('0x4f')]){_0x30a9e4[_0x67f1('0x50')]=[{'all':!![]}];}_0x30a9e4=_[_0x67f1('0x44')]({},_0x30a9e4,_0x577801[_0x67f1('0x47')]);return db[_0x67f1('0x48')][_0x67f1('0x51')](_0x30a9e4)[_0x67f1('0x2b')](handleEntityNotFound(_0x5b79d4,null))['then'](respondWithResult(_0x5b79d4,null))['catch'](handleError(_0x5b79d4,null));};exports[_0x67f1('0x52')]=function(_0xdda7ff,_0x38958f){return db[_0x67f1('0x48')][_0x67f1('0x52')](_0xdda7ff[_0x67f1('0x53')],{})['then'](function(_0x6a3947){var _0xd2de39=_0xdda7ff[_0x67f1('0x54')][_0x67f1('0x2c')]({'plain':!![]});if(!_0xd2de39)throw new Error(_0x67f1('0x55'));if(_0xd2de39[_0x67f1('0x56')]===_0x67f1('0x54')){var _0x13a402=_0x6a3947[_0x67f1('0x2c')]({'plain':!![]});var _0x1a81be=_0x67f1('0x2d');return db[_0x67f1('0x57')][_0x67f1('0x51')]({'where':{'name':_0x1a81be,'userProfileId':_0xd2de39['userProfileId']},'raw':!![]})['then'](function(_0xe5f8ae){if(_0xe5f8ae&&_0xe5f8ae[_0x67f1('0x58')]===0x0){return db['UserProfileResource'][_0x67f1('0x52')]({'name':_0x13a402[_0x67f1('0x31')],'resourceId':_0x13a402['id'],'type':_0xe5f8ae['name'],'sectionId':_0xe5f8ae['id']},{})[_0x67f1('0x2b')](function(){return _0x6a3947;});}else{return _0x6a3947;}})['catch'](function(_0x2ff43a){logger[_0x67f1('0x2f')](_0x67f1('0x59'),_0x2ff43a);throw _0x2ff43a;});}return _0x6a3947;})[_0x67f1('0x2b')](respondWithResult(_0x38958f,0xc9))[_0x67f1('0x5a')](handleError(_0x38958f,null));};exports[_0x67f1('0x29')]=function(_0x7bb212,_0x4ab9a8){if(_0x7bb212[_0x67f1('0x53')]['id']){delete _0x7bb212['body']['id'];}return db[_0x67f1('0x48')][_0x67f1('0x51')]({'where':{'id':_0x7bb212[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x4ab9a8,null))[_0x67f1('0x2b')](saveUpdates(_0x7bb212['body'],null))[_0x67f1('0x2b')](respondWithResult(_0x4ab9a8,null))['catch'](handleError(_0x4ab9a8,null));};exports['destroy']=function(_0x1eaed8,_0x57d31d){return db[_0x67f1('0x48')][_0x67f1('0x51')]({'where':{'id':_0x1eaed8[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x57d31d,null))[_0x67f1('0x2b')](removeEntity(_0x57d31d,null))[_0x67f1('0x5a')](handleError(_0x57d31d,null));};exports[_0x67f1('0x5b')]=function(_0x350c33,_0x52f3bf){return db[_0x67f1('0x48')][_0x67f1('0x5b')]()[_0x67f1('0x2b')](respondWithResult(_0x52f3bf,null))[_0x67f1('0x5a')](handleError(_0x52f3bf,null));};exports[_0x67f1('0x5c')]=function(_0x573c9e,_0x9f87df,_0x1eb286){if(_0x573c9e[_0x67f1('0x53')]['id']){delete _0x573c9e[_0x67f1('0x53')]['id'];}return db[_0x67f1('0x48')][_0x67f1('0x51')]({'where':{'id':_0x573c9e[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x9f87df,null))['then'](function(_0x44ce66){if(_0x44ce66){_0x573c9e[_0x67f1('0x53')][_0x67f1('0x5d')]=_0x44ce66['id'];return db[_0x67f1('0x5e')][_0x67f1('0x52')](_0x573c9e[_0x67f1('0x53')]);}})[_0x67f1('0x2b')](respondWithResult(_0x9f87df,null))[_0x67f1('0x5a')](handleError(_0x9f87df,null));};exports[_0x67f1('0x5f')]=function(_0x331aef,_0x436d5e,_0x1bbd39){var _0x541f3a={'raw':![],'where':{}};var _0x1af563={};var _0x2b0aa6={'count':0x0,'rows':[]};return db['CmList'][_0x67f1('0x60')]({'where':{'id':_0x331aef[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x436d5e,null))['then'](function(_0x5307aa){if(_0x5307aa){_0x1af563['model']=_[_0x67f1('0x39')](db[_0x67f1('0x5e')][_0x67f1('0x35')]);_0x1af563['query']=_['keys'](_0x331aef[_0x67f1('0x3a')]);_0x1af563[_0x67f1('0x3b')]=_[_0x67f1('0x3d')](_0x1af563[_0x67f1('0x38')],_0x1af563[_0x67f1('0x3a')]);_0x541f3a[_0x67f1('0x3c')]=_[_0x67f1('0x3d')](_0x1af563[_0x67f1('0x38')],qs['fields'](_0x331aef['query']['fields']));_0x541f3a[_0x67f1('0x3c')]=_0x541f3a['attributes'][_0x67f1('0x3e')]?_0x541f3a['attributes']:_0x1af563[_0x67f1('0x38')];if(!_0x331aef['query'][_0x67f1('0x3f')](_0x67f1('0x61'))){_0x541f3a[_0x67f1('0x24')]=qs[_0x67f1('0x24')](_0x331aef[_0x67f1('0x3a')]['limit']);_0x541f3a[_0x67f1('0x22')]=qs[_0x67f1('0x22')](_0x331aef[_0x67f1('0x3a')][_0x67f1('0x22')]);}_0x541f3a[_0x67f1('0x40')]=qs['sort'](_0x331aef[_0x67f1('0x3a')][_0x67f1('0x41')]);_0x541f3a[_0x67f1('0x42')]=qs[_0x67f1('0x3b')](_[_0x67f1('0x62')](_0x331aef[_0x67f1('0x3a')],_0x1af563[_0x67f1('0x3b')]));_0x541f3a[_0x67f1('0x42')]['ListId']=_0x5307aa['id'];if(_0x331aef[_0x67f1('0x3a')][_0x67f1('0x43')]){_0x541f3a[_0x67f1('0x42')]=_['merge'](_0x541f3a[_0x67f1('0x42')],{'$or':_[_0x67f1('0x34')](_0x541f3a[_0x67f1('0x3c')],function(_0x50b65b){var _0xdd745b={};_0xdd745b[_0x50b65b]={'$like':'%'+_0x331aef['query']['filter']+'%'};return _0xdd745b;})});}_0x541f3a=_['merge']({},_0x541f3a,_0x331aef[_0x67f1('0x47')]);return db[_0x67f1('0x5e')][_0x67f1('0x49')]({'where':_0x541f3a[_0x67f1('0x42')]})[_0x67f1('0x2b')](function(_0x16f478){_0x2b0aa6[_0x67f1('0x49')]=_0x16f478;if(_0x331aef[_0x67f1('0x3a')][_0x67f1('0x4f')]){_0x541f3a[_0x67f1('0x50')]=[{'all':!![]}];}return db[_0x67f1('0x5e')][_0x67f1('0x4a')](_0x541f3a);})[_0x67f1('0x2b')](function(_0x530caa){_0x2b0aa6[_0x67f1('0x4b')]=_0x530caa;return _0x2b0aa6;});}})[_0x67f1('0x2b')](respondWithFilteredResult(_0x436d5e,_0x541f3a))[_0x67f1('0x5a')](handleError(_0x436d5e,null));};exports['removeDispositions']=function(_0x324927,_0x76e3d9,_0x1707cc){return db[_0x67f1('0x48')]['find']({'where':{'id':_0x324927[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x76e3d9,null))[_0x67f1('0x2b')](function(_0x57c71f){if(_0x57c71f){return _0x57c71f[_0x67f1('0x63')](_0x324927[_0x67f1('0x3a')][_0x67f1('0x64')]);}})[_0x67f1('0x2b')](respondWithStatusCode(_0x76e3d9,null))[_0x67f1('0x5a')](handleError(_0x76e3d9,null));};exports[_0x67f1('0x65')]=function(_0xe658f,_0x234f99,_0x299c75){return db[_0x67f1('0x48')][_0x67f1('0x51')]({'where':{'id':_0xe658f['params']['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x234f99,null))[_0x67f1('0x2b')](function(_0x107d17){if(_0x107d17){var _0x464954=[];var _0x5455be={'success':[],'errors':[]};return db[_0x67f1('0x66')][_0x67f1('0x5b')]()[_0x67f1('0x2b')](function(_0x247720){if(_0xe658f['body'][_0x67f1('0x67')]&&_[_0x67f1('0x68')](_0xe658f[_0x67f1('0x53')]['tags'])){if(_0xe658f[_0x67f1('0x53')][_0x67f1('0x67')][_0x67f1('0x3e')]){_0xe658f['body'][_0x67f1('0x67')]=_0xe658f[_0x67f1('0x53')]['tags'][_0x67f1('0x69')](';')+';';}else{_0xe658f['body'][_0x67f1('0x67')]=null;}}else{_0xe658f[_0x67f1('0x53')][_0x67f1('0x67')]=null;}if(_0xe658f[_0x67f1('0x53')]&&_['isArray'](_0xe658f[_0x67f1('0x53')])){for(var _0x399693=0x0;_0x399693<_0xe658f['body']['length'];_0x399693+=0x1){_0xe658f[_0x67f1('0x53')][_0x399693]['ListId']=_0xe658f[_0x67f1('0x4d')]['id'];_0x464954['push'](_0xe658f['body'][_0x399693]);}return BPromise['each'](_0x464954,function(_0x42814c){return db['CmContact']['create'](_['omit'](_0x42814c,[_0x67f1('0x64'),'id'])||{},{'fields':_[_0x67f1('0x39')](_0x247720),'raw':!![]})['then'](function(_0x3fb960){_0x5455be[_0x67f1('0x6a')][_0x67f1('0x6b')](_0x3fb960[_0x67f1('0x6c')]);})[_0x67f1('0x5a')](function(_0x5cd2eb){_0x5455be[_0x67f1('0x6d')][_0x67f1('0x6b')]({'data':_0x42814c,'error':_0x5cd2eb['message']});});})['then'](function(_0x60ab3e){return _0x5455be;})['catch'](function(_0x2d934c){return _0x2d934c;});}else{_0x234f99[_0x67f1('0x20')](0x190)['json']({'message':_0x67f1('0x6e')});}});}})[_0x67f1('0x2b')](respondWithResult(_0x234f99,null))[_0x67f1('0x5a')](handleError(_0x234f99,null));};exports['getContacts']=function(_0x55c283,_0x39c605,_0x4cef5a){var _0x5efd5f;return db[_0x67f1('0x48')][_0x67f1('0x51')]({'where':{'id':_0x55c283['params']['id']},'include':[{'model':db[_0x67f1('0x6f')],'as':_0x67f1('0x70')}]})['then'](handleEntityNotFound(_0x39c605,null))[_0x67f1('0x2b')](function(_0x5f282b){if(_0x5f282b){_0x5efd5f=_0x5f282b;return db['CmContact']['rawAttributes'];}})[_0x67f1('0x2b')](function(_0x3c6a5f){if(_0x3c6a5f){var _0xb29af4={};var _0x56ee2b={};_0x56ee2b[_0x67f1('0x38')]=_[_0x67f1('0x71')](_[_0x67f1('0x39')](_0x3c6a5f),_[_0x67f1('0x34')](_0x5efd5f[_0x67f1('0x70')],function(_0x2fe1ea){return util['format'](_0x67f1('0x72'),_0x2fe1ea['id']);}));_0x56ee2b[_0x67f1('0x3a')]=_[_0x67f1('0x39')](_0x55c283[_0x67f1('0x3a')]);_0x56ee2b[_0x67f1('0x3b')]=_['intersection'](_0x56ee2b[_0x67f1('0x38')],_0x56ee2b[_0x67f1('0x3a')]);_0xb29af4[_0x67f1('0x3c')]=_[_0x67f1('0x3d')](_0x56ee2b[_0x67f1('0x38')],qs[_0x67f1('0x4e')](_0x55c283[_0x67f1('0x3a')][_0x67f1('0x4e')]));_0xb29af4[_0x67f1('0x3c')]=_0xb29af4[_0x67f1('0x3c')]['length']?_0xb29af4['attributes']:_0x56ee2b['model'];if(!_0x55c283[_0x67f1('0x3a')][_0x67f1('0x3f')]('nolimit')){_0xb29af4['limit']=qs['limit'](_0x55c283[_0x67f1('0x3a')][_0x67f1('0x24')]);_0xb29af4[_0x67f1('0x22')]=qs[_0x67f1('0x22')](_0x55c283[_0x67f1('0x3a')][_0x67f1('0x22')]);}_0xb29af4[_0x67f1('0x40')]=qs[_0x67f1('0x41')](_0x55c283['query'][_0x67f1('0x41')]);_0xb29af4[_0x67f1('0x42')]=qs[_0x67f1('0x3b')](_[_0x67f1('0x62')](_0x55c283[_0x67f1('0x3a')],_0x56ee2b[_0x67f1('0x3b')]));_0xb29af4[_0x67f1('0x73')]=!![];if(_0x55c283[_0x67f1('0x3a')][_0x67f1('0x43')]){_0xb29af4[_0x67f1('0x42')]=_['merge'](_0xb29af4[_0x67f1('0x42')],{'$or':_[_0x67f1('0x34')](_0xb29af4[_0x67f1('0x3c')],function(_0x168d38){var _0x6ed1b3={};_0x6ed1b3[_0x168d38]={'$like':'%'+_0x55c283['query']['filter']+'%'};return _0x6ed1b3;})});}_0xb29af4=_[_0x67f1('0x44')]({},_0xb29af4,_0x55c283[_0x67f1('0x47')]);return _0x5efd5f[_0x67f1('0x74')](_0xb29af4);}})[_0x67f1('0x2b')](respondWithResult(_0x39c605,null))['catch'](handleError(_0x39c605,null));};exports[_0x67f1('0x75')]=function(_0x4db1a3,_0x50fe83,_0x37cb0b){var _0x32c4b7;var _0xff1984;var _0x4ecd2c;var _0x2d9d2a=_0x4db1a3['params']['id'];csv_results=[];return db[_0x67f1('0x76')][_0x67f1('0x4a')]({'attributes':['id','name'],'raw':!![],'order':[_0x67f1('0x77')]})[_0x67f1('0x2b')](function(_0x35835b){_0x32c4b7=_0x35835b;var _0x3831ca=_[_0x67f1('0x39')](db['CmContact'][_0x67f1('0x35')]);return db[_0x67f1('0x6f')][_0x67f1('0x4a')]({'raw':!![],'attributes':['id',_0x67f1('0x78')]})[_0x67f1('0x2b')](function(_0x729810){_0xff1984=_0x729810;var _0x34fd76=squel[_0x67f1('0x79')]()[_0x67f1('0x4e')](_0x3831ca)[_0x67f1('0x7a')](_0x67f1('0x7b'),'c')[_0x67f1('0x42')](_0x67f1('0x7c'),_0x2d9d2a)[_0x67f1('0x42')]('c.deletedAt\x20is\x20null')[_0x67f1('0x7d')]();for(var _0x5de555=0x0;_0x5de555<_0xff1984[_0x67f1('0x3e')];_0x5de555++){_0x34fd76[_0x67f1('0x7e')](_0x67f1('0x7f')+_0xff1984[_0x5de555]['id'],_0x67f1('0x80')+_0xff1984[_0x5de555][_0x67f1('0x78')]);}for(var _0x5de555=0x0;_0x5de555<_0x32c4b7[_0x67f1('0x3e')];_0x5de555++){_0x34fd76[_0x67f1('0x7e')](squel[_0x67f1('0x79')]()[_0x67f1('0x7e')](_0x67f1('0x81'))[_0x67f1('0x7a')](_0x67f1('0x82'))['where'](_0x67f1('0x83'),_0x32c4b7[_0x5de555]['id'])['where'](_0x67f1('0x84')),_0x67f1('0x85')+_0x32c4b7[_0x5de555][_0x67f1('0x31')]);_0x34fd76[_0x67f1('0x7e')](squel[_0x67f1('0x79')]()[_0x67f1('0x7e')](_0x67f1('0x86'))[_0x67f1('0x7a')]('cm_contact_has_items')[_0x67f1('0x42')](_0x67f1('0x83'),_0x32c4b7[_0x5de555]['id'])[_0x67f1('0x42')](_0x67f1('0x84')),_0x67f1('0x87')+_0x32c4b7[_0x5de555][_0x67f1('0x31')]);}var _0x5bab84=[];_0x5bab84[_0x67f1('0x6b')](_0x34fd76[_0x67f1('0x88')]());BPromise[_0x67f1('0x89')](_0x5bab84,handleQuery)['then'](function(_0x7e42c6){handleQuery(_0x34fd76[_0x67f1('0x88')]());var _0x2db256=csv_results[0x0];if(!_[_0x67f1('0x8a')](_0x2db256)){var _0x510146=toCsv(_0x2db256);var _0x205c0f=Date['now']();fs[_0x67f1('0x8b')](util[_0x67f1('0x8c')](_0x67f1('0x8d'),_0x2d9d2a,_0x205c0f),_0x510146);_0x50fe83[_0x67f1('0x8e')]('Content-disposition',_0x67f1('0x8f')+util[_0x67f1('0x8c')](_0x67f1('0x90'),_0x2d9d2a,_0x205c0f));_0x50fe83[_0x67f1('0x8e')](_0x67f1('0x91'),_0x67f1('0x92'));return _0x50fe83['download'](util[_0x67f1('0x8c')](_0x67f1('0x8d'),_0x2d9d2a,_0x205c0f));}else{return _0x50fe83[_0x67f1('0x1f')](0xcc);}});});});};exports[_0x67f1('0x93')]=function(_0x4a1c67,_0x53b04d,_0x591343){var _0x35ac5e;delete _0x4a1c67[_0x67f1('0x53')]['id'];return db[_0x67f1('0x48')][_0x67f1('0x60')]({'where':{'id':_0x4a1c67['params']['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x53b04d,null))[_0x67f1('0x2b')](function(_0x598ed7){if(_0x598ed7){return db['sequelize'][_0x67f1('0x94')](function(_0x1368b8){return db[_0x67f1('0x6f')][_0x67f1('0x52')](_0x4a1c67[_0x67f1('0x53')],{'transaction':_0x1368b8})[_0x67f1('0x2b')](function(_0x15f273){_0x35ac5e=_0x15f273;return _0x598ed7[_0x67f1('0x95')](_0x15f273,{'transaction':_0x1368b8});})[_0x67f1('0x2b')](function(){var _0x2550ff={'type':db[_0x67f1('0x96')][_0x67f1('0x97')],'transaction':_0x1368b8};switch(_0x4a1c67['body']['type']){case _0x67f1('0x98'):_0x2550ff[_0x67f1('0x45')]=db[_0x67f1('0x96')][_0x67f1('0x97')];break;case'number':_0x2550ff[_0x67f1('0x45')]=db[_0x67f1('0x96')][_0x67f1('0x99')];break;case _0x67f1('0x9a'):_0x2550ff[_0x67f1('0x45')]=db[_0x67f1('0x96')][_0x67f1('0x9b')];_0x2550ff[_0x67f1('0x9c')]=![];break;default:}return db['sequelize'][_0x67f1('0x9d')][_0x67f1('0x9e')](_0x67f1('0x7b'),util[_0x67f1('0x8c')](_0x67f1('0x9f'),_0x35ac5e['id']),_0x2550ff);})[_0x67f1('0x2b')](function(){return _0x35ac5e;});});}})['then'](respondWithResult(_0x53b04d,null))[_0x67f1('0x5a')](handleError(_0x53b04d,null));};exports[_0x67f1('0xa0')]=function(_0xd3eb97,_0x7b29d1,_0x6b8bdd){var _0x65ddcf={};var _0x11d647={};var _0x81094b;var _0x432de4;return db[_0x67f1('0x48')][_0x67f1('0x60')]({'where':{'id':_0xd3eb97[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x7b29d1,null))['then'](function(_0x200b80){if(_0x200b80){_0x81094b=_0x200b80;_0x11d647[_0x67f1('0x38')]=_[_0x67f1('0x39')](db[_0x67f1('0x6f')]['rawAttributes']);_0x11d647[_0x67f1('0x3a')]=_[_0x67f1('0x39')](_0xd3eb97['query']);_0x11d647[_0x67f1('0x3b')]=_['intersection'](_0x11d647['model'],_0x11d647['query']);_0x65ddcf[_0x67f1('0x3c')]=_[_0x67f1('0x3d')](_0x11d647[_0x67f1('0x38')],qs[_0x67f1('0x4e')](_0xd3eb97['query'][_0x67f1('0x4e')]));_0x65ddcf['attributes']=_0x65ddcf[_0x67f1('0x3c')][_0x67f1('0x3e')]?_0x65ddcf[_0x67f1('0x3c')]:_0x11d647[_0x67f1('0x38')];_0x65ddcf['order']=qs[_0x67f1('0x41')](_0xd3eb97[_0x67f1('0x3a')][_0x67f1('0x41')]);_0x65ddcf['where']=qs[_0x67f1('0x3b')](_[_0x67f1('0x62')](_0xd3eb97[_0x67f1('0x3a')],_0x11d647[_0x67f1('0x3b')]));_0x65ddcf[_0x67f1('0x42')]=_[_0x67f1('0x44')](_0x65ddcf[_0x67f1('0x42')],{'$or':[{'ListId':_0x200b80['id']},{'ListId':null}]});if(_0xd3eb97[_0x67f1('0x3a')][_0x67f1('0x43')]){_0x65ddcf[_0x67f1('0x42')]=_['merge'](_0x65ddcf[_0x67f1('0x42')],{'$or':_[_0x67f1('0x34')](_0x65ddcf[_0x67f1('0x3c')],function(_0x2cd79a){var _0x151d28={};_0x151d28[_0x2cd79a]={'$like':'%'+_0xd3eb97[_0x67f1('0x3a')][_0x67f1('0x43')]+'%'};return _0x151d28;})});}_0x65ddcf=_[_0x67f1('0x44')]({},_0x65ddcf,_0xd3eb97[_0x67f1('0x47')]);return db[_0x67f1('0x6f')]['findAndCountAll'](_0x65ddcf);}})[_0x67f1('0x2b')](respondWithResult(_0x7b29d1,null))['catch'](handleError(_0x7b29d1,null));};exports[_0x67f1('0xa1')]=function(_0x2bf35a,_0x51e9dd){return db[_0x67f1('0x6f')][_0x67f1('0xa2')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x51e9dd,null))[_0x67f1('0x2b')](function(_0x39df12){return _0x39df12;})[_0x67f1('0x2b')](respondWithResult(_0x51e9dd,null))['catch'](handleError(_0x51e9dd,null));};exports['addAgents']=function(_0x1dc40c,_0x4b55b3,_0x495008){return db['CmList'][_0x67f1('0x51')]({'where':{'id':_0x1dc40c[_0x67f1('0x4d')]['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x4b55b3,null))[_0x67f1('0x2b')](function(_0x20fff9){if(_0x20fff9){return _0x20fff9[_0x67f1('0xa3')](_0x1dc40c[_0x67f1('0x53')][_0x67f1('0x64')],_[_0x67f1('0xa4')](_0x1dc40c[_0x67f1('0x53')],[_0x67f1('0x64'),'id'])||{})[_0x67f1('0xa5')](function(_0x49e447){for(var _0x2c9e5c=0x0;_0x2c9e5c<_0x1dc40c[_0x67f1('0x53')][_0x67f1('0x64')][_0x67f1('0x3e')];_0x2c9e5c+=0x1){socket[_0x67f1('0xa6')]('userCmList:save',{'UserId':Number(_0x1dc40c['body'][_0x67f1('0x64')][_0x2c9e5c]),'CmListId':Number(_0x1dc40c[_0x67f1('0x4d')]['id'])});}return _0x49e447;});}})[_0x67f1('0x2b')](respondWithResult(_0x4b55b3,null))[_0x67f1('0x5a')](handleError(_0x4b55b3,null));};exports['removeAgents']=function(_0xa5e501,_0x2d29d6,_0x3634c0){return db['CmList'][_0x67f1('0x51')]({'where':{'id':_0xa5e501['params']['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x2d29d6,null))[_0x67f1('0x2b')](function(_0x3b07f1){if(_0x3b07f1){return _0x3b07f1[_0x67f1('0xa7')](_0xa5e501[_0x67f1('0x3a')][_0x67f1('0x64')])['then'](function(){if(_[_0x67f1('0x68')](_0xa5e501[_0x67f1('0x3a')][_0x67f1('0x64')])){for(var _0x476a50=0x0;_0x476a50<_0xa5e501[_0x67f1('0x3a')][_0x67f1('0x64')]['length'];_0x476a50+=0x1){socket[_0x67f1('0xa6')]('userCmList:remove',{'UserId':Number(_0xa5e501[_0x67f1('0x3a')]['ids'][_0x476a50]),'CmListId':Number(_0xa5e501[_0x67f1('0x4d')]['id'])});}}else{socket['emit'](_0x67f1('0xa8'),{'UserId':Number(_0xa5e501[_0x67f1('0x3a')][_0x67f1('0x64')]),'CmListId':Number(_0xa5e501[_0x67f1('0x4d')]['id'])});}});}})[_0x67f1('0x2b')](respondWithStatusCode(_0x2d29d6,null))[_0x67f1('0x5a')](handleError(_0x2d29d6,null));};exports[_0x67f1('0xa9')]=function(_0x45e044,_0x54cd1a,_0x2756c8){var _0x41a302={};var _0x56f06d={};var _0x53998f;var _0x2766e8;return db[_0x67f1('0x48')]['findOne']({'where':{'id':_0x45e044['params']['id']}})[_0x67f1('0x2b')](handleEntityNotFound(_0x54cd1a,null))[_0x67f1('0x2b')](function(_0x3f7561){if(_0x3f7561){_0x53998f=_0x3f7561;_0x56f06d[_0x67f1('0x38')]=_[_0x67f1('0x39')](db['User']['rawAttributes']);_0x56f06d[_0x67f1('0x3a')]=_[_0x67f1('0x39')](_0x45e044[_0x67f1('0x3a')]);_0x56f06d['filters']=_[_0x67f1('0x3d')](_0x56f06d['model'],_0x56f06d['query']);_0x41a302['attributes']=_[_0x67f1('0x3d')](_0x56f06d[_0x67f1('0x38')],qs[_0x67f1('0x4e')](_0x45e044['query']['fields']));_0x41a302[_0x67f1('0x3c')]=_0x41a302[_0x67f1('0x3c')][_0x67f1('0x3e')]?_0x41a302[_0x67f1('0x3c')]:_0x56f06d[_0x67f1('0x38')];_0x41a302[_0x67f1('0x40')]=qs[_0x67f1('0x41')](_0x45e044[_0x67f1('0x3a')]['sort']);_0x41a302[_0x67f1('0x42')]=qs[_0x67f1('0x3b')](_[_0x67f1('0x62')](_0x45e044[_0x67f1('0x3a')],_0x56f06d['filters']));if(_0x45e044['query'][_0x67f1('0x43')]){_0x41a302[_0x67f1('0x42')]=_['merge'](_0x41a302['where'],{'$or':_['map'](_0x41a302[_0x67f1('0x3c')],function(_0x3d4386){var _0x50d969={};_0x50d969[_0x3d4386]={'$like':'%'+_0x45e044[_0x67f1('0x3a')][_0x67f1('0x43')]+'%'};return _0x50d969;})});}_0x41a302=_[_0x67f1('0x44')]({},_0x41a302,_0x45e044[_0x67f1('0x47')]);return _0x53998f[_0x67f1('0xa9')](_0x41a302);}})['then'](function(_0x3688cd){if(_0x3688cd){_0x2766e8=_0x3688cd['length'];if(!_0x45e044[_0x67f1('0x3a')]['hasOwnProperty'](_0x67f1('0x61'))){_0x41a302[_0x67f1('0x24')]=qs[_0x67f1('0x24')](_0x45e044[_0x67f1('0x3a')]['limit']);_0x41a302[_0x67f1('0x22')]=qs['offset'](_0x45e044[_0x67f1('0x3a')]['offset']);}return _0x53998f[_0x67f1('0xa9')](_0x41a302);}})['then'](function(_0xf4e2ac){if(_0xf4e2ac){return _0xf4e2ac?{'count':_0x2766e8,'rows':_0xf4e2ac}:null;}})[_0x67f1('0x2b')](respondWithResult(_0x54cd1a,null))[_0x67f1('0x5a')](handleError(_0x54cd1a,null));};function handleQuery(_0x2151fa){logger[_0x67f1('0xaa')](_0x2151fa);return db[_0x67f1('0xab')][_0x67f1('0x3a')](_0x2151fa)['spread'](function(_0x2addd0){csv_results['push'](_0x2addd0);})[_0x67f1('0x5a')](function(_0x15d6b8){logger[_0x67f1('0x2f')](_0x15d6b8[_0x67f1('0xac')]);});} \ No newline at end of file +var _0x9cd7=['each','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','transaction','Sequelize','TEXT','text','INTEGER','switch','defaultValue','sequelize','addColumn','cf_%s','getCustomFields','order','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','findOne','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','pick','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x9cd7,0x168));var _0x79cd=function(_0x5b8262,_0x93ab76){_0x5b8262=_0x5b8262-0x0;var _0x21f734=_0x9cd7[_0x5b8262];return _0x21f734;};'use strict';var emlformat=require(_0x79cd('0x0'));var rimraf=require(_0x79cd('0x1'));var zipdir=require(_0x79cd('0x2'));var jsonpatch=require(_0x79cd('0x3'));var rp=require(_0x79cd('0x4'));var moment=require(_0x79cd('0x5'));var BPromise=require(_0x79cd('0x6'));var Mustache=require(_0x79cd('0x7'));var util=require(_0x79cd('0x8'));var path=require(_0x79cd('0x9'));var sox=require(_0x79cd('0xa'));var csv=require(_0x79cd('0xb'));var ejs=require(_0x79cd('0xc'));var fs=require('fs');var fs_extra=require(_0x79cd('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x79cd('0xe'));var jsforce=require(_0x79cd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x79cd('0xb'));var querystring=require(_0x79cd('0x10'));var Papa=require(_0x79cd('0x11'));var Redis=require(_0x79cd('0x12'));var authService=require(_0x79cd('0x13'));var qs=require(_0x79cd('0x14'));var as=require(_0x79cd('0x15'));var hardwareService=require(_0x79cd('0x16'));var logger=require(_0x79cd('0x17'))(_0x79cd('0x18'));var utils=require('../../config/utils');var config=require(_0x79cd('0x19'));var licenseUtil=require(_0x79cd('0x1a'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_['defaults'](config[_0x79cd('0x1b')],{'host':_0x79cd('0x1c'),'port':0x18eb});var socket=require(_0x79cd('0x1d'))(new Redis(config[_0x79cd('0x1b')]));require(_0x79cd('0x1e'))['register'](socket);function respondWithStatusCode(_0x167b80,_0x1abf51){_0x1abf51=_0x1abf51||0xcc;return function(_0xc1e14c){if(_0xc1e14c){return _0x167b80[_0x79cd('0x1f')](_0x1abf51);}return _0x167b80[_0x79cd('0x20')](_0x1abf51)[_0x79cd('0x21')]();};}function respondWithResult(_0x448d88,_0x3fb816){_0x3fb816=_0x3fb816||0xc8;return function(_0x3232a8){if(_0x3232a8){return _0x448d88[_0x79cd('0x20')](_0x3fb816)['json'](_0x3232a8);}};}function respondWithFilteredResult(_0x2d15ec,_0x5e3819){return function(_0x570ebb){if(_0x570ebb){var _0x4769d9=typeof _0x5e3819['offset']===_0x79cd('0x22')&&typeof _0x5e3819[_0x79cd('0x23')]===_0x79cd('0x22');var _0x3107b8=_0x570ebb[_0x79cd('0x24')];var _0x4d2c3a=_0x4769d9?0x0:_0x5e3819[_0x79cd('0x25')];var _0x2b6a1d=_0x4769d9?_0x570ebb['count']:_0x5e3819['offset']+_0x5e3819['limit'];var _0x462e3c;if(_0x2b6a1d>=_0x3107b8){_0x2b6a1d=_0x3107b8;_0x462e3c=0xc8;}else{_0x462e3c=0xce;}_0x2d15ec['status'](_0x462e3c);return _0x2d15ec[_0x79cd('0x26')]('Content-Range',_0x4d2c3a+'-'+_0x2b6a1d+'/'+_0x3107b8)[_0x79cd('0x27')](_0x570ebb);}return null;};}function patchUpdates(_0x31e9e0){return function(_0x26f99c){try{jsonpatch[_0x79cd('0x28')](_0x26f99c,_0x31e9e0,!![]);}catch(_0x39de6e){return BPromise[_0x79cd('0x29')](_0x39de6e);}return _0x26f99c[_0x79cd('0x2a')]();};}function saveUpdates(_0x279bac,_0xcc33bd){return function(_0x167bc8){if(_0x167bc8){return _0x167bc8[_0x79cd('0x2b')](_0x279bac)[_0x79cd('0x2c')](function(_0x52b1dc){return _0x52b1dc;});}return null;};}function removeEntity(_0xb637c,_0x2ce4ab){return function(_0x3f5521){if(_0x3f5521){return _0x3f5521[_0x79cd('0x2d')]()[_0x79cd('0x2c')](function(){var _0xe3c134=_0x3f5521[_0x79cd('0x2e')]({'plain':!![]});var _0xea9251=_0x79cd('0x2f');return db[_0x79cd('0x30')]['destroy']({'where':{'type':_0xea9251,'resourceId':_0xe3c134['id']}})[_0x79cd('0x2c')](function(){return _0x3f5521;});})['then'](function(){_0xb637c['status'](0xcc)[_0x79cd('0x21')]();});}};}function handleEntityNotFound(_0x198cff,_0x524870){return function(_0x3bb79c){if(!_0x3bb79c){_0x198cff[_0x79cd('0x1f')](0x194);}return _0x3bb79c;};}function handleError(_0xb83073,_0x1e23df){_0x1e23df=_0x1e23df||0x1f4;return function(_0x38259b){logger[_0x79cd('0x31')](_0x38259b[_0x79cd('0x32')]);if(_0x38259b[_0x79cd('0x33')]){delete _0x38259b[_0x79cd('0x33')];}_0xb83073[_0x79cd('0x20')](_0x1e23df)[_0x79cd('0x34')](_0x38259b);};}exports[_0x79cd('0x35')]=function(_0x250951,_0x522afa){var _0x4bc66f={},_0x4e765f={},_0x7664bf={'count':0x0,'rows':[]};var _0x3bd021=_[_0x79cd('0x36')](db['CmList'][_0x79cd('0x37')],function(_0x2d7b52){return{'name':_0x2d7b52[_0x79cd('0x38')],'type':_0x2d7b52[_0x79cd('0x39')][_0x79cd('0x3a')]};});_0x4e765f['model']=_[_0x79cd('0x36')](_0x3bd021,'name');_0x4e765f[_0x79cd('0x3b')]=_[_0x79cd('0x3c')](_0x250951[_0x79cd('0x3b')]);_0x4e765f[_0x79cd('0x3d')]=_[_0x79cd('0x3e')](_0x4e765f['model'],_0x4e765f['query']);_0x4bc66f[_0x79cd('0x3f')]=_['intersection'](_0x4e765f[_0x79cd('0x40')],qs[_0x79cd('0x41')](_0x250951[_0x79cd('0x3b')]['fields']));_0x4bc66f['attributes']=_0x4bc66f['attributes']['length']?_0x4bc66f[_0x79cd('0x3f')]:_0x4e765f['model'];if(!_0x250951[_0x79cd('0x3b')][_0x79cd('0x42')](_0x79cd('0x43'))){_0x4bc66f[_0x79cd('0x23')]=qs[_0x79cd('0x23')](_0x250951[_0x79cd('0x3b')][_0x79cd('0x23')]);_0x4bc66f[_0x79cd('0x25')]=qs[_0x79cd('0x25')](_0x250951[_0x79cd('0x3b')]['offset']);}_0x4bc66f['order']=qs[_0x79cd('0x44')](_0x250951[_0x79cd('0x3b')][_0x79cd('0x44')]);_0x4bc66f[_0x79cd('0x45')]=qs['filters'](_['pick'](_0x250951[_0x79cd('0x3b')],_0x4e765f[_0x79cd('0x3d')]),_0x3bd021);if(_0x250951[_0x79cd('0x3b')][_0x79cd('0x46')]){_0x4bc66f[_0x79cd('0x45')]=_[_0x79cd('0x47')](_0x4bc66f[_0x79cd('0x45')],{'$or':_[_0x79cd('0x36')](_0x3bd021,function(_0x9d0d9){if(_0x9d0d9['type']!==_0x79cd('0x48')){var _0x2fc92f={};_0x2fc92f[_0x9d0d9[_0x79cd('0x33')]]={'$like':'%'+_0x250951[_0x79cd('0x3b')][_0x79cd('0x46')]+'%'};return _0x2fc92f;}})});}_0x4bc66f=_[_0x79cd('0x47')]({},_0x4bc66f,_0x250951[_0x79cd('0x49')]);var _0x260d10={'where':_0x4bc66f[_0x79cd('0x45')]};return db[_0x79cd('0x4a')][_0x79cd('0x24')](_0x260d10)[_0x79cd('0x2c')](function(_0x5b862d){_0x7664bf[_0x79cd('0x24')]=_0x5b862d;if(_0x250951[_0x79cd('0x3b')][_0x79cd('0x4b')]){_0x4bc66f[_0x79cd('0x4c')]=[{'all':!![]}];}return db[_0x79cd('0x4a')][_0x79cd('0x4d')](_0x4bc66f);})['then'](function(_0x2f975e){_0x7664bf[_0x79cd('0x4e')]=_0x2f975e;return _0x7664bf;})['then'](respondWithFilteredResult(_0x522afa,_0x4bc66f))[_0x79cd('0x4f')](handleError(_0x522afa,null));};exports[_0x79cd('0x50')]=function(_0xee5618,_0x3f8f33){var _0x4f89e9={'raw':![],'where':{'id':_0xee5618[_0x79cd('0x51')]['id']}},_0x327635={};_0x327635[_0x79cd('0x40')]=_[_0x79cd('0x3c')](db[_0x79cd('0x4a')]['rawAttributes']);_0x327635[_0x79cd('0x3b')]=_[_0x79cd('0x3c')](_0xee5618[_0x79cd('0x3b')]);_0x327635[_0x79cd('0x3d')]=_[_0x79cd('0x3e')](_0x327635[_0x79cd('0x40')],_0x327635[_0x79cd('0x3b')]);_0x4f89e9[_0x79cd('0x3f')]=_[_0x79cd('0x3e')](_0x327635[_0x79cd('0x40')],qs[_0x79cd('0x41')](_0xee5618[_0x79cd('0x3b')]['fields']));_0x4f89e9['attributes']=_0x4f89e9['attributes'][_0x79cd('0x52')]?_0x4f89e9[_0x79cd('0x3f')]:_0x327635['model'];if(_0xee5618[_0x79cd('0x3b')][_0x79cd('0x4b')]){_0x4f89e9[_0x79cd('0x4c')]=[{'all':!![]}];}_0x4f89e9=_[_0x79cd('0x47')]({},_0x4f89e9,_0xee5618['options']);return db[_0x79cd('0x4a')][_0x79cd('0x53')](_0x4f89e9)[_0x79cd('0x2c')](handleEntityNotFound(_0x3f8f33,null))[_0x79cd('0x2c')](respondWithResult(_0x3f8f33,null))[_0x79cd('0x4f')](handleError(_0x3f8f33,null));};exports['create']=function(_0x2e1b63,_0x5098e1){return db[_0x79cd('0x4a')][_0x79cd('0x54')](_0x2e1b63['body'],{})[_0x79cd('0x2c')](function(_0x5a77f4){var _0x2b1acc=_0x2e1b63[_0x79cd('0x55')][_0x79cd('0x2e')]({'plain':!![]});if(!_0x2b1acc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b1acc[_0x79cd('0x56')]===_0x79cd('0x55')){var _0x48c2a=_0x5a77f4['get']({'plain':!![]});var _0x37bc23=_0x79cd('0x2f');return db[_0x79cd('0x57')]['find']({'where':{'name':_0x37bc23,'userProfileId':_0x2b1acc[_0x79cd('0x58')]},'raw':!![]})[_0x79cd('0x2c')](function(_0x25b2fc){if(_0x25b2fc&&_0x25b2fc[_0x79cd('0x59')]===0x0){return db[_0x79cd('0x30')][_0x79cd('0x54')]({'name':_0x48c2a[_0x79cd('0x33')],'resourceId':_0x48c2a['id'],'type':_0x25b2fc[_0x79cd('0x33')],'sectionId':_0x25b2fc['id']},{})['then'](function(){return _0x5a77f4;});}else{return _0x5a77f4;}})[_0x79cd('0x4f')](function(_0x2188cf){logger[_0x79cd('0x31')](_0x79cd('0x5a'),_0x2188cf);throw _0x2188cf;});}return _0x5a77f4;})[_0x79cd('0x2c')](respondWithResult(_0x5098e1,0xc9))['catch'](handleError(_0x5098e1,null));};exports[_0x79cd('0x2b')]=function(_0x4fd4bd,_0x2ebc23){if(_0x4fd4bd[_0x79cd('0x5b')]['id']){delete _0x4fd4bd[_0x79cd('0x5b')]['id'];}return db['CmList'][_0x79cd('0x53')]({'where':{'id':_0x4fd4bd['params']['id']}})['then'](handleEntityNotFound(_0x2ebc23,null))[_0x79cd('0x2c')](saveUpdates(_0x4fd4bd[_0x79cd('0x5b')],null))[_0x79cd('0x2c')](respondWithResult(_0x2ebc23,null))[_0x79cd('0x4f')](handleError(_0x2ebc23,null));};exports[_0x79cd('0x2d')]=function(_0x172490,_0x248f74){return db[_0x79cd('0x4a')][_0x79cd('0x53')]({'where':{'id':_0x172490[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x248f74,null))[_0x79cd('0x2c')](removeEntity(_0x248f74,null))['catch'](handleError(_0x248f74,null));};exports[_0x79cd('0x5c')]=function(_0x30b028,_0x46c46b){return db[_0x79cd('0x4a')][_0x79cd('0x5c')]()[_0x79cd('0x2c')](respondWithResult(_0x46c46b,null))['catch'](handleError(_0x46c46b,null));};exports[_0x79cd('0x5d')]=function(_0x7e9d4c,_0x14bec9,_0x2acc6f){if(_0x7e9d4c[_0x79cd('0x5b')]['id']){delete _0x7e9d4c[_0x79cd('0x5b')]['id'];}return db['CmList']['find']({'where':{'id':_0x7e9d4c[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x14bec9,null))['then'](function(_0x4e087f){if(_0x4e087f){_0x7e9d4c['body']['ListId']=_0x4e087f['id'];return db[_0x79cd('0x5e')][_0x79cd('0x54')](_0x7e9d4c['body']);}})['then'](respondWithResult(_0x14bec9,null))['catch'](handleError(_0x14bec9,null));};exports['getDispositions']=function(_0xc58b85,_0x437d2f,_0x55925d){var _0x21f834={'raw':![],'where':{}};var _0x4abb4c={};var _0x130a68={'count':0x0,'rows':[]};return db[_0x79cd('0x4a')][_0x79cd('0x5f')]({'where':{'id':_0xc58b85[_0x79cd('0x51')]['id']}})['then'](handleEntityNotFound(_0x437d2f,null))[_0x79cd('0x2c')](function(_0x47c0c4){if(_0x47c0c4){_0x4abb4c['model']=_[_0x79cd('0x3c')](db[_0x79cd('0x5e')][_0x79cd('0x37')]);_0x4abb4c['query']=_[_0x79cd('0x3c')](_0xc58b85['query']);_0x4abb4c[_0x79cd('0x3d')]=_[_0x79cd('0x3e')](_0x4abb4c['model'],_0x4abb4c[_0x79cd('0x3b')]);_0x21f834[_0x79cd('0x3f')]=_[_0x79cd('0x3e')](_0x4abb4c[_0x79cd('0x40')],qs[_0x79cd('0x41')](_0xc58b85[_0x79cd('0x3b')][_0x79cd('0x41')]));_0x21f834[_0x79cd('0x3f')]=_0x21f834[_0x79cd('0x3f')][_0x79cd('0x52')]?_0x21f834[_0x79cd('0x3f')]:_0x4abb4c['model'];if(!_0xc58b85['query'][_0x79cd('0x42')]('nolimit')){_0x21f834['limit']=qs[_0x79cd('0x23')](_0xc58b85[_0x79cd('0x3b')][_0x79cd('0x23')]);_0x21f834[_0x79cd('0x25')]=qs['offset'](_0xc58b85['query'][_0x79cd('0x25')]);}_0x21f834['order']=qs[_0x79cd('0x44')](_0xc58b85[_0x79cd('0x3b')][_0x79cd('0x44')]);_0x21f834[_0x79cd('0x45')]=qs[_0x79cd('0x3d')](_['pick'](_0xc58b85[_0x79cd('0x3b')],_0x4abb4c[_0x79cd('0x3d')]));_0x21f834[_0x79cd('0x45')][_0x79cd('0x60')]=_0x47c0c4['id'];if(_0xc58b85['query']['filter']){_0x21f834[_0x79cd('0x45')]=_['merge'](_0x21f834[_0x79cd('0x45')],{'$or':_['map'](_0x21f834[_0x79cd('0x3f')],function(_0x335263){var _0x446890={};_0x446890[_0x335263]={'$like':'%'+_0xc58b85[_0x79cd('0x3b')][_0x79cd('0x46')]+'%'};return _0x446890;})});}_0x21f834=_[_0x79cd('0x47')]({},_0x21f834,_0xc58b85[_0x79cd('0x49')]);return db['Disposition']['count']({'where':_0x21f834[_0x79cd('0x45')]})[_0x79cd('0x2c')](function(_0x2ff951){_0x130a68['count']=_0x2ff951;if(_0xc58b85[_0x79cd('0x3b')][_0x79cd('0x4b')]){_0x21f834[_0x79cd('0x4c')]=[{'all':!![]}];}return db['Disposition'][_0x79cd('0x4d')](_0x21f834);})['then'](function(_0x578633){_0x130a68[_0x79cd('0x4e')]=_0x578633;return _0x130a68;});}})[_0x79cd('0x2c')](respondWithFilteredResult(_0x437d2f,_0x21f834))[_0x79cd('0x4f')](handleError(_0x437d2f,null));};exports[_0x79cd('0x61')]=function(_0x1d2822,_0x58f42f,_0x3e984f){return db[_0x79cd('0x4a')]['find']({'where':{'id':_0x1d2822['params']['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x58f42f,null))[_0x79cd('0x2c')](function(_0x320dd5){if(_0x320dd5){return _0x320dd5[_0x79cd('0x61')](_0x1d2822['query'][_0x79cd('0x62')]);}})['then'](respondWithStatusCode(_0x58f42f,null))[_0x79cd('0x4f')](handleError(_0x58f42f,null));};exports[_0x79cd('0x63')]=function(_0x4c81af,_0x4f9ea6,_0x5058d3){return db[_0x79cd('0x4a')][_0x79cd('0x53')]({'where':{'id':_0x4c81af[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x4f9ea6,null))['then'](function(_0x12dc09){if(_0x12dc09){var _0x463605=[];var _0x2c8bb8={'success':[],'errors':[]};return db[_0x79cd('0x64')]['describe']()['then'](function(_0x378c5c){if(_0x4c81af[_0x79cd('0x5b')][_0x79cd('0x65')]&&_[_0x79cd('0x66')](_0x4c81af[_0x79cd('0x5b')][_0x79cd('0x65')])){if(_0x4c81af[_0x79cd('0x5b')][_0x79cd('0x65')][_0x79cd('0x52')]){_0x4c81af[_0x79cd('0x5b')][_0x79cd('0x65')]=_0x4c81af[_0x79cd('0x5b')]['tags'][_0x79cd('0x67')](';')+';';}else{_0x4c81af[_0x79cd('0x5b')]['tags']=null;}}else{_0x4c81af[_0x79cd('0x5b')]['tags']=null;}if(_0x4c81af[_0x79cd('0x5b')]&&_['isArray'](_0x4c81af[_0x79cd('0x5b')])){for(var _0x3a6f71=0x0;_0x3a6f71<_0x4c81af['body'][_0x79cd('0x52')];_0x3a6f71+=0x1){_0x4c81af[_0x79cd('0x5b')][_0x3a6f71][_0x79cd('0x60')]=_0x4c81af[_0x79cd('0x51')]['id'];_0x463605[_0x79cd('0x68')](_0x4c81af[_0x79cd('0x5b')][_0x3a6f71]);}return BPromise['each'](_0x463605,function(_0x182e29){return db['CmContact'][_0x79cd('0x54')](_[_0x79cd('0x69')](_0x182e29,['ids','id'])||{},{'fields':_[_0x79cd('0x3c')](_0x378c5c),'raw':!![]})[_0x79cd('0x2c')](function(_0x31a90f){_0x2c8bb8[_0x79cd('0x6a')][_0x79cd('0x68')](_0x31a90f['dataValues']);})[_0x79cd('0x4f')](function(_0x10e955){_0x2c8bb8['errors'][_0x79cd('0x68')]({'data':_0x182e29,'error':_0x10e955[_0x79cd('0x6b')]});});})['then'](function(_0x5a56c6){return _0x2c8bb8;})['catch'](function(_0x11a38f){return _0x11a38f;});}else{_0x4f9ea6[_0x79cd('0x20')](0x190)[_0x79cd('0x27')]({'message':_0x79cd('0x6c')});}});}})[_0x79cd('0x2c')](respondWithResult(_0x4f9ea6,null))[_0x79cd('0x4f')](handleError(_0x4f9ea6,null));};exports[_0x79cd('0x6d')]=function(_0x3a094e,_0x5c21ff,_0x198554){var _0x55592e;return db[_0x79cd('0x4a')][_0x79cd('0x53')]({'where':{'id':_0x3a094e[_0x79cd('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x79cd('0x6e')}]})[_0x79cd('0x2c')](handleEntityNotFound(_0x5c21ff,null))[_0x79cd('0x2c')](function(_0x55a34b){if(_0x55a34b){_0x55592e=_0x55a34b;return db['CmContact']['rawAttributes'];}})[_0x79cd('0x2c')](function(_0x127708){if(_0x127708){var _0x78576={};var _0x20ad7c={};_0x20ad7c[_0x79cd('0x40')]=_['concat'](_[_0x79cd('0x3c')](_0x127708),_['map'](_0x55592e['CustomFields'],function(_0x231b5f){return util[_0x79cd('0x6f')](_0x79cd('0x70'),_0x231b5f['id']);}));_0x20ad7c['query']=_[_0x79cd('0x3c')](_0x3a094e[_0x79cd('0x3b')]);_0x20ad7c['filters']=_['intersection'](_0x20ad7c[_0x79cd('0x40')],_0x20ad7c[_0x79cd('0x3b')]);_0x78576[_0x79cd('0x3f')]=_[_0x79cd('0x3e')](_0x20ad7c[_0x79cd('0x40')],qs['fields'](_0x3a094e[_0x79cd('0x3b')][_0x79cd('0x41')]));_0x78576[_0x79cd('0x3f')]=_0x78576[_0x79cd('0x3f')][_0x79cd('0x52')]?_0x78576[_0x79cd('0x3f')]:_0x20ad7c[_0x79cd('0x40')];if(!_0x3a094e[_0x79cd('0x3b')][_0x79cd('0x42')](_0x79cd('0x43'))){_0x78576[_0x79cd('0x23')]=qs[_0x79cd('0x23')](_0x3a094e[_0x79cd('0x3b')][_0x79cd('0x23')]);_0x78576['offset']=qs[_0x79cd('0x25')](_0x3a094e[_0x79cd('0x3b')]['offset']);}_0x78576['order']=qs[_0x79cd('0x44')](_0x3a094e[_0x79cd('0x3b')][_0x79cd('0x44')]);_0x78576[_0x79cd('0x45')]=qs[_0x79cd('0x3d')](_[_0x79cd('0x71')](_0x3a094e[_0x79cd('0x3b')],_0x20ad7c[_0x79cd('0x3d')]));_0x78576['raw']=!![];if(_0x3a094e[_0x79cd('0x3b')]['filter']){_0x78576['where']=_['merge'](_0x78576[_0x79cd('0x45')],{'$or':_['map'](_0x78576[_0x79cd('0x3f')],function(_0x443fbd){var _0x1d3917={};_0x1d3917[_0x443fbd]={'$like':'%'+_0x3a094e[_0x79cd('0x3b')][_0x79cd('0x46')]+'%'};return _0x1d3917;})});}_0x78576=_[_0x79cd('0x47')]({},_0x78576,_0x3a094e[_0x79cd('0x49')]);return _0x55592e[_0x79cd('0x6d')](_0x78576);}})['then'](respondWithResult(_0x5c21ff,null))[_0x79cd('0x4f')](handleError(_0x5c21ff,null));};exports['getContactsCsv']=function(_0x182cef,_0x522cbf,_0x1ed001){var _0x33a087;var _0x35fb6b;var _0x5207dd;var _0x5e404c=_0x182cef[_0x79cd('0x51')]['id'];csv_results=[];return db[_0x79cd('0x72')][_0x79cd('0x4d')]({'attributes':['id',_0x79cd('0x33')],'raw':!![],'order':[_0x79cd('0x73')]})[_0x79cd('0x2c')](function(_0x45cde3){_0x33a087=_0x45cde3;var _0x42b3ad=_['keys'](db['CmContact'][_0x79cd('0x37')]);return db[_0x79cd('0x74')]['findAll']({'raw':!![],'attributes':['id',_0x79cd('0x75')]})[_0x79cd('0x2c')](function(_0x4c2160){_0x35fb6b=_0x4c2160;var _0x1255d9=squel[_0x79cd('0x76')]()[_0x79cd('0x41')](_0x42b3ad)[_0x79cd('0x77')](_0x79cd('0x78'),'c')['where'](_0x79cd('0x79'),_0x5e404c)[_0x79cd('0x45')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x46368e=0x0;_0x46368e<_0x35fb6b[_0x79cd('0x52')];_0x46368e++){_0x1255d9[_0x79cd('0x7a')](_0x79cd('0x7b')+_0x35fb6b[_0x46368e]['id'],_0x79cd('0x7c')+_0x35fb6b[_0x46368e][_0x79cd('0x75')]);}for(var _0x46368e=0x0;_0x46368e<_0x33a087[_0x79cd('0x52')];_0x46368e++){_0x1255d9[_0x79cd('0x7a')](squel[_0x79cd('0x76')]()['field'](_0x79cd('0x7d'))['from'](_0x79cd('0x7e'))[_0x79cd('0x45')](_0x79cd('0x7f'),_0x33a087[_0x46368e]['id'])[_0x79cd('0x45')]('CmContactId\x20=\x20c.id'),_0x79cd('0x80')+_0x33a087[_0x46368e][_0x79cd('0x33')]);_0x1255d9[_0x79cd('0x7a')](squel[_0x79cd('0x76')]()[_0x79cd('0x7a')](_0x79cd('0x81'))[_0x79cd('0x77')](_0x79cd('0x7e'))['where']('ItemTypeId\x20=\x20?',_0x33a087[_0x46368e]['id'])[_0x79cd('0x45')](_0x79cd('0x82')),_0x79cd('0x83')+_0x33a087[_0x46368e][_0x79cd('0x33')]);}var _0x36a83a=[];_0x36a83a[_0x79cd('0x68')](_0x1255d9['toString']());BPromise[_0x79cd('0x84')](_0x36a83a,handleQuery)[_0x79cd('0x2c')](function(_0x3af07a){handleQuery(_0x1255d9[_0x79cd('0x85')]());var _0x41685d=csv_results[0x0];if(!_['isEmpty'](_0x41685d)){var _0x236fb3=toCsv(_0x41685d);var _0x1e8892=Date[_0x79cd('0x86')]();fs[_0x79cd('0x87')](util[_0x79cd('0x6f')](_0x79cd('0x88'),_0x5e404c,_0x1e8892),_0x236fb3);_0x522cbf[_0x79cd('0x89')](_0x79cd('0x8a'),_0x79cd('0x8b')+util[_0x79cd('0x6f')](_0x79cd('0x8c'),_0x5e404c,_0x1e8892));_0x522cbf[_0x79cd('0x89')](_0x79cd('0x8d'),_0x79cd('0x8e'));return _0x522cbf['download'](util[_0x79cd('0x6f')]('/tmp/list_%d_%s.csv',_0x5e404c,_0x1e8892));}else{return _0x522cbf[_0x79cd('0x1f')](0xcc);}});});});};exports[_0x79cd('0x8f')]=function(_0x2fc420,_0xfbf138,_0xdb5092){var _0x1d8a07;delete _0x2fc420[_0x79cd('0x5b')]['id'];return db['CmList'][_0x79cd('0x5f')]({'where':{'id':_0x2fc420[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0xfbf138,null))[_0x79cd('0x2c')](function(_0x41df02){if(_0x41df02){return db['sequelize'][_0x79cd('0x90')](function(_0xc8fa42){return db[_0x79cd('0x74')]['create'](_0x2fc420[_0x79cd('0x5b')],{'transaction':_0xc8fa42})[_0x79cd('0x2c')](function(_0x465785){_0x1d8a07=_0x465785;return _0x41df02['addCustomFields'](_0x465785,{'transaction':_0xc8fa42});})[_0x79cd('0x2c')](function(){var _0x2aeb81={'type':db[_0x79cd('0x91')][_0x79cd('0x92')],'transaction':_0xc8fa42};switch(_0x2fc420[_0x79cd('0x5b')][_0x79cd('0x39')]){case _0x79cd('0x93'):_0x2aeb81['type']=db['Sequelize'][_0x79cd('0x92')];break;case'number':_0x2aeb81[_0x79cd('0x39')]=db[_0x79cd('0x91')][_0x79cd('0x94')];break;case _0x79cd('0x95'):_0x2aeb81['type']=db[_0x79cd('0x91')]['BOOLEAN'];_0x2aeb81[_0x79cd('0x96')]=![];break;default:}return db[_0x79cd('0x97')]['queryInterface'][_0x79cd('0x98')](_0x79cd('0x78'),util['format'](_0x79cd('0x99'),_0x1d8a07['id']),_0x2aeb81);})[_0x79cd('0x2c')](function(){return _0x1d8a07;});});}})[_0x79cd('0x2c')](respondWithResult(_0xfbf138,null))[_0x79cd('0x4f')](handleError(_0xfbf138,null));};exports[_0x79cd('0x9a')]=function(_0x4e4fdf,_0x185a61,_0x5574a6){var _0x528567={};var _0x542fe0={};var _0xd1021a;var _0x3d8e6a;return db[_0x79cd('0x4a')]['findOne']({'where':{'id':_0x4e4fdf[_0x79cd('0x51')]['id']}})['then'](handleEntityNotFound(_0x185a61,null))[_0x79cd('0x2c')](function(_0x1f56c2){if(_0x1f56c2){_0xd1021a=_0x1f56c2;_0x542fe0[_0x79cd('0x40')]=_['keys'](db[_0x79cd('0x74')][_0x79cd('0x37')]);_0x542fe0['query']=_['keys'](_0x4e4fdf['query']);_0x542fe0[_0x79cd('0x3d')]=_[_0x79cd('0x3e')](_0x542fe0['model'],_0x542fe0[_0x79cd('0x3b')]);_0x528567[_0x79cd('0x3f')]=_[_0x79cd('0x3e')](_0x542fe0[_0x79cd('0x40')],qs['fields'](_0x4e4fdf['query'][_0x79cd('0x41')]));_0x528567['attributes']=_0x528567[_0x79cd('0x3f')]['length']?_0x528567[_0x79cd('0x3f')]:_0x542fe0[_0x79cd('0x40')];_0x528567[_0x79cd('0x9b')]=qs[_0x79cd('0x44')](_0x4e4fdf[_0x79cd('0x3b')][_0x79cd('0x44')]);_0x528567[_0x79cd('0x45')]=qs[_0x79cd('0x3d')](_[_0x79cd('0x71')](_0x4e4fdf[_0x79cd('0x3b')],_0x542fe0[_0x79cd('0x3d')]));_0x528567[_0x79cd('0x45')]=_[_0x79cd('0x47')](_0x528567[_0x79cd('0x45')],{'$or':[{'ListId':_0x1f56c2['id']},{'ListId':null}]});if(_0x4e4fdf[_0x79cd('0x3b')]['filter']){_0x528567[_0x79cd('0x45')]=_[_0x79cd('0x47')](_0x528567['where'],{'$or':_[_0x79cd('0x36')](_0x528567[_0x79cd('0x3f')],function(_0x228843){var _0xf7f25e={};_0xf7f25e[_0x228843]={'$like':'%'+_0x4e4fdf['query'][_0x79cd('0x46')]+'%'};return _0xf7f25e;})});}_0x528567=_[_0x79cd('0x47')]({},_0x528567,_0x4e4fdf['options']);return db[_0x79cd('0x74')][_0x79cd('0x9c')](_0x528567);}})[_0x79cd('0x2c')](respondWithResult(_0x185a61,null))[_0x79cd('0x4f')](handleError(_0x185a61,null));};exports[_0x79cd('0x9d')]=function(_0x4de269,_0x21c2d9){return db[_0x79cd('0x74')]['findAndCountAll']({'where':{'ListId':null}})[_0x79cd('0x2c')](handleEntityNotFound(_0x21c2d9,null))['then'](function(_0x24933e){return _0x24933e;})[_0x79cd('0x2c')](respondWithResult(_0x21c2d9,null))[_0x79cd('0x4f')](handleError(_0x21c2d9,null));};exports[_0x79cd('0x9e')]=function(_0x16af92,_0x1a041f,_0x541cd0){return db[_0x79cd('0x4a')][_0x79cd('0x53')]({'where':{'id':_0x16af92[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x1a041f,null))['then'](function(_0x54f344){if(_0x54f344){return _0x54f344[_0x79cd('0x9e')](_0x16af92['body']['ids'],_[_0x79cd('0x69')](_0x16af92[_0x79cd('0x5b')],[_0x79cd('0x62'),'id'])||{})[_0x79cd('0x9f')](function(_0x39da08){for(var _0x3c73cb=0x0;_0x3c73cb<_0x16af92['body'][_0x79cd('0x62')][_0x79cd('0x52')];_0x3c73cb+=0x1){socket[_0x79cd('0xa0')](_0x79cd('0xa1'),{'UserId':Number(_0x16af92[_0x79cd('0x5b')][_0x79cd('0x62')][_0x3c73cb]),'CmListId':Number(_0x16af92[_0x79cd('0x51')]['id'])});}return _0x39da08;});}})[_0x79cd('0x2c')](respondWithResult(_0x1a041f,null))[_0x79cd('0x4f')](handleError(_0x1a041f,null));};exports['removeAgents']=function(_0x993637,_0x39af35,_0x13c83d){return db[_0x79cd('0x4a')][_0x79cd('0x53')]({'where':{'id':_0x993637[_0x79cd('0x51')]['id']}})['then'](handleEntityNotFound(_0x39af35,null))[_0x79cd('0x2c')](function(_0x4f64bc){if(_0x4f64bc){return _0x4f64bc['removeAgents'](_0x993637[_0x79cd('0x3b')]['ids'])[_0x79cd('0x2c')](function(){if(_[_0x79cd('0x66')](_0x993637[_0x79cd('0x3b')][_0x79cd('0x62')])){for(var _0x136e89=0x0;_0x136e89<_0x993637[_0x79cd('0x3b')]['ids'][_0x79cd('0x52')];_0x136e89+=0x1){socket[_0x79cd('0xa0')]('userCmList:remove',{'UserId':Number(_0x993637['query']['ids'][_0x136e89]),'CmListId':Number(_0x993637[_0x79cd('0x51')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x993637[_0x79cd('0x3b')]['ids']),'CmListId':Number(_0x993637[_0x79cd('0x51')]['id'])});}});}})[_0x79cd('0x2c')](respondWithStatusCode(_0x39af35,null))[_0x79cd('0x4f')](handleError(_0x39af35,null));};exports['getAgents']=function(_0x56d2ac,_0x54bf60,_0x44aec3){var _0x569a64={};var _0x3fa62f={};var _0x44bf00;var _0x3ff87a;return db[_0x79cd('0x4a')][_0x79cd('0x5f')]({'where':{'id':_0x56d2ac[_0x79cd('0x51')]['id']}})[_0x79cd('0x2c')](handleEntityNotFound(_0x54bf60,null))[_0x79cd('0x2c')](function(_0x2c93ca){if(_0x2c93ca){_0x44bf00=_0x2c93ca;_0x3fa62f[_0x79cd('0x40')]=_[_0x79cd('0x3c')](db[_0x79cd('0xa2')][_0x79cd('0x37')]);_0x3fa62f[_0x79cd('0x3b')]=_[_0x79cd('0x3c')](_0x56d2ac[_0x79cd('0x3b')]);_0x3fa62f[_0x79cd('0x3d')]=_[_0x79cd('0x3e')](_0x3fa62f[_0x79cd('0x40')],_0x3fa62f['query']);_0x569a64[_0x79cd('0x3f')]=_[_0x79cd('0x3e')](_0x3fa62f[_0x79cd('0x40')],qs[_0x79cd('0x41')](_0x56d2ac['query'][_0x79cd('0x41')]));_0x569a64[_0x79cd('0x3f')]=_0x569a64[_0x79cd('0x3f')][_0x79cd('0x52')]?_0x569a64[_0x79cd('0x3f')]:_0x3fa62f[_0x79cd('0x40')];_0x569a64['order']=qs[_0x79cd('0x44')](_0x56d2ac['query'][_0x79cd('0x44')]);_0x569a64[_0x79cd('0x45')]=qs['filters'](_['pick'](_0x56d2ac['query'],_0x3fa62f[_0x79cd('0x3d')]));if(_0x56d2ac['query'][_0x79cd('0x46')]){_0x569a64[_0x79cd('0x45')]=_['merge'](_0x569a64[_0x79cd('0x45')],{'$or':_['map'](_0x569a64[_0x79cd('0x3f')],function(_0x5e8ac6){var _0x495c15={};_0x495c15[_0x5e8ac6]={'$like':'%'+_0x56d2ac[_0x79cd('0x3b')]['filter']+'%'};return _0x495c15;})});}_0x569a64=_[_0x79cd('0x47')]({},_0x569a64,_0x56d2ac[_0x79cd('0x49')]);return _0x44bf00[_0x79cd('0xa3')](_0x569a64);}})['then'](function(_0x1a7a1f){if(_0x1a7a1f){_0x3ff87a=_0x1a7a1f[_0x79cd('0x52')];if(!_0x56d2ac[_0x79cd('0x3b')][_0x79cd('0x42')]('nolimit')){_0x569a64[_0x79cd('0x23')]=qs[_0x79cd('0x23')](_0x56d2ac[_0x79cd('0x3b')][_0x79cd('0x23')]);_0x569a64['offset']=qs[_0x79cd('0x25')](_0x56d2ac[_0x79cd('0x3b')][_0x79cd('0x25')]);}return _0x44bf00['getAgents'](_0x569a64);}})[_0x79cd('0x2c')](function(_0x22d3e){if(_0x22d3e){return _0x22d3e?{'count':_0x3ff87a,'rows':_0x22d3e}:null;}})[_0x79cd('0x2c')](respondWithResult(_0x54bf60,null))[_0x79cd('0x4f')](handleError(_0x54bf60,null));};function handleQuery(_0x3d6f19){logger['info'](_0x3d6f19);return db[_0x79cd('0x97')][_0x79cd('0x3b')](_0x3d6f19)[_0x79cd('0x9f')](function(_0xc8c4b2){csv_results[_0x79cd('0x68')](_0xc8c4b2);})[_0x79cd('0x4f')](function(_0x5f5417){logger[_0x79cd('0x31')](_0x5f5417[_0x79cd('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 9aec7e1..57ba06f 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x3e8a6c,_0x459ab2){_0x3e8a6c=_0x3e8a6c-0x0;var _0x4fc379=_0xe14b[_0x3e8a6c];return _0x4fc379;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0x814b,0x1a2));var _0xb814=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x814b[_0x525c7b];return _0x27b33e;};'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 808981e..c25fe0e 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 _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x13c8c7,_0x5115e3){var _0x427c70=function(_0x3d0db7){while(--_0x3d0db7){_0x13c8c7['push'](_0x13c8c7['shift']());}};_0x427c70(++_0x5115e3);}(_0xbec5,0xe5));var _0x5bec=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xbec5[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x4688e8,_0x2460c3){var _0x5e392f=function(_0x4cf620){while(--_0x4cf620){_0x4688e8['push'](_0x4688e8['shift']());}};_0x5e392f(++_0x2460c3);}(_0x5ff3,0x17d));var _0x35ff=function(_0x2689ef,_0x5975fd){_0x2689ef=_0x2689ef-0x0;var _0x5b4ad4=_0x5ff3[_0x2689ef];return _0x5b4ad4;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'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 812b3e3..4c63f28 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 _0x6f3c=['client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x239eba,_0x277b90){var _0x2df6ac=function(_0x385d4c){while(--_0x385d4c){_0x239eba['push'](_0x239eba['shift']());}};_0x2df6ac(++_0x277b90);}(_0x6f3c,0x99));var _0xc6f3=function(_0x15aded,_0x544d36){_0x15aded=_0x15aded-0x0;var _0x1f2d2e=_0x6f3c[_0x15aded];return _0x1f2d2e;};'use strict';var _=require(_0xc6f3('0x0'));var util=require(_0xc6f3('0x1'));var moment=require(_0xc6f3('0x2'));var BPromise=require(_0xc6f3('0x3'));var rs=require(_0xc6f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6f3('0x5'));var logger=require('../../config/logger')(_0xc6f3('0x6'));var config=require(_0xc6f3('0x7'));var jayson=require(_0xc6f3('0x8'));var client=jayson[_0xc6f3('0x9')][_0xc6f3('0xa')]({'port':0x232a});config[_0xc6f3('0xb')]=_[_0xc6f3('0xc')](config[_0xc6f3('0xb')],{'host':_0xc6f3('0xd'),'port':0x18eb});var socket=require(_0xc6f3('0xe'))(new Redis(config[_0xc6f3('0xb')]));require(_0xc6f3('0xf'))[_0xc6f3('0x10')](socket);function respondWithRpcPromise(_0x215cc8,_0x5e1b38,_0x2d168e){return new BPromise(function(_0x552ba6,_0x23f780){return client[_0xc6f3('0x11')](_0x215cc8,_0x2d168e)['then'](function(_0x31e5bc){logger[_0xc6f3('0x12')](_0xc6f3('0x13'),_0x5e1b38,'request\x20sent');logger[_0xc6f3('0x14')](_0xc6f3('0x15'),_0x5e1b38,_0xc6f3('0x16'),JSON[_0xc6f3('0x17')](_0x31e5bc));if(_0x31e5bc[_0xc6f3('0x18')]){if(_0x31e5bc[_0xc6f3('0x18')]['code']===0x1f4){logger[_0xc6f3('0x18')](_0xc6f3('0x13'),_0x5e1b38,_0x31e5bc['error'][_0xc6f3('0x19')]);return _0x23f780(_0x31e5bc[_0xc6f3('0x18')]['message']);}logger[_0xc6f3('0x18')](_0xc6f3('0x13'),_0x5e1b38,_0x31e5bc[_0xc6f3('0x18')]['message']);return _0x552ba6(_0x31e5bc[_0xc6f3('0x18')][_0xc6f3('0x19')]);}else{logger[_0xc6f3('0x12')](_0xc6f3('0x13'),_0x5e1b38,'request\x20sent');_0x552ba6(_0x31e5bc[_0xc6f3('0x1a')][_0xc6f3('0x19')]);}})['catch'](function(_0x3d03b4){logger['error'](_0xc6f3('0x13'),_0x5e1b38,_0x3d03b4);_0x23f780(_0x3d03b4);});});} \ No newline at end of file +var _0xada8=['localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4b0aa3,_0x198647){var _0x126ad5=function(_0x3c0c98){while(--_0x3c0c98){_0x4b0aa3['push'](_0x4b0aa3['shift']());}};_0x126ad5(++_0x198647);}(_0xada8,0xf7));var _0x8ada=function(_0x3092b0,_0x3e0ed2){_0x3092b0=_0x3092b0-0x0;var _0x256409=_0xada8[_0x3092b0];return _0x256409;};'use strict';var _=require(_0x8ada('0x0'));var util=require(_0x8ada('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ada('0x2'));var fs=require('fs');var Redis=require(_0x8ada('0x3'));var db=require(_0x8ada('0x4'))['db'];var utils=require(_0x8ada('0x5'));var logger=require(_0x8ada('0x6'))(_0x8ada('0x7'));var config=require(_0x8ada('0x8'));var jayson=require(_0x8ada('0x9'));var client=jayson[_0x8ada('0xa')][_0x8ada('0xb')]({'port':0x232a});config['redis']=_[_0x8ada('0xc')](config[_0x8ada('0xd')],{'host':_0x8ada('0xe'),'port':0x18eb});var socket=require(_0x8ada('0xf'))(new Redis(config[_0x8ada('0xd')]));require('./cmList.socket')[_0x8ada('0x10')](socket);function respondWithRpcPromise(_0x2645df,_0x35bb4a,_0x534823){return new BPromise(function(_0x56e060,_0x12ba99){return client[_0x8ada('0x11')](_0x2645df,_0x534823)[_0x8ada('0x12')](function(_0x50b59a){logger[_0x8ada('0x13')](_0x8ada('0x14'),_0x35bb4a,_0x8ada('0x15'));logger['debug'](_0x8ada('0x16'),_0x35bb4a,_0x8ada('0x15'),JSON[_0x8ada('0x17')](_0x50b59a));if(_0x50b59a[_0x8ada('0x18')]){if(_0x50b59a['error'][_0x8ada('0x19')]===0x1f4){logger[_0x8ada('0x18')](_0x8ada('0x14'),_0x35bb4a,_0x50b59a[_0x8ada('0x18')]['message']);return _0x12ba99(_0x50b59a[_0x8ada('0x18')][_0x8ada('0x1a')]);}logger['error'](_0x8ada('0x14'),_0x35bb4a,_0x50b59a['error']['message']);return _0x56e060(_0x50b59a['error'][_0x8ada('0x1a')]);}else{logger[_0x8ada('0x13')](_0x8ada('0x14'),_0x35bb4a,_0x8ada('0x15'));_0x56e060(_0x50b59a[_0x8ada('0x1b')][_0x8ada('0x1a')]);}})[_0x8ada('0x1c')](function(_0x476801){logger[_0x8ada('0x18')](_0x8ada('0x14'),_0x35bb4a,_0x476801);_0x12ba99(_0x476801);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2e360a9..d3863aa 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 _0xaa5d=['update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xaa5d,0x15e));var _0xdaa5=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xaa5d[_0x8a969d];return _0x1d8dc7;};'use strict';var CmListEvents=require(_0xdaa5('0x0'));var events=[_0xdaa5('0x1'),'remove',_0xdaa5('0x2')];function createListener(_0x23ecb5,_0x3ca99c){return function(_0x18f0e2){_0x3ca99c[_0xdaa5('0x3')](_0x23ecb5,_0x18f0e2);};}function removeListener(_0x59fe5f,_0x4f8043){return function(){CmListEvents[_0xdaa5('0x4')](_0x59fe5f,_0x4f8043);};}exports[_0xdaa5('0x5')]=function(_0x481610){for(var _0x2b79dc=0x0,_0x199a12=events[_0xdaa5('0x6')];_0x2b79dc<_0x199a12;_0x2b79dc++){var _0x59a172=events[_0x2b79dc];var _0x493928=createListener(_0xdaa5('0x7')+_0x59a172,_0x481610);CmListEvents['on'](_0x59a172,_0x493928);}}; \ No newline at end of file +var _0x186e=['emit','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_0x186e,0xbc));var _0xe186=function(_0x4fc78c,_0x3981ab){_0x4fc78c=_0x4fc78c-0x0;var _0x30203b=_0x186e[_0x4fc78c];return _0x30203b;};'use strict';var CmListEvents=require(_0xe186('0x0'));var events=[_0xe186('0x1'),_0xe186('0x2'),_0xe186('0x3')];function createListener(_0x26fa79,_0x5eadbd){return function(_0x373b5e){_0x5eadbd[_0xe186('0x4')](_0x26fa79,_0x373b5e);};}function removeListener(_0x205fbe,_0x4814d5){return function(){CmListEvents['removeListener'](_0x205fbe,_0x4814d5);};}exports[_0xe186('0x5')]=function(_0x4ea0fc){for(var _0x58eed3=0x0,_0xb019ee=events[_0xe186('0x6')];_0x58eed3<_0xb019ee;_0x58eed3++){var _0x41e9b2=events[_0x58eed3];var _0x12bca6=createListener(_0xe186('0x7')+_0x41e9b2,_0x4ea0fc);CmListEvents['on'](_0x41e9b2,_0x12bca6);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 52ca7b4..54f7298 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 _0xa3db=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','/describe','/global_fields','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv'];(function(_0x3a6c22,_0x25539e){var _0x61930a=function(_0x69ae65){while(--_0x69ae65){_0x3a6c22['push'](_0x3a6c22['shift']());}};_0x61930a(++_0x25539e);}(_0xa3db,0x14f));var _0xba3d=function(_0xded9f1,_0x213d00){_0xded9f1=_0xded9f1-0x0;var _0x1822e3=_0xa3db[_0xded9f1];return _0x1822e3;};'use strict';var multer=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var path=require('path');var timeout=require(_0xba3d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba3d('0x3'));var auth=require(_0xba3d('0x4'));var interaction=require(_0xba3d('0x5'));var config=require('../../config/environment');var controller=require(_0xba3d('0x6'));router[_0xba3d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba3d('0x7')](_0xba3d('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xba3d('0x9'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0xba3d('0xa'),auth[_0xba3d('0xb')](),controller[_0xba3d('0xc')]);router['get'](_0xba3d('0xd'),auth[_0xba3d('0xb')](),controller[_0xba3d('0xe')]);router[_0xba3d('0x7')](_0xba3d('0xf'),auth[_0xba3d('0xb')](),controller['getContacts']);router[_0xba3d('0x7')](_0xba3d('0x10'),auth[_0xba3d('0xb')](),controller[_0xba3d('0x11')]);router['get'](_0xba3d('0x12'),auth[_0xba3d('0xb')](),controller[_0xba3d('0x13')]);router['get'](_0xba3d('0x14'),auth[_0xba3d('0xb')](),controller['getAgents']);router[_0xba3d('0x15')]('/',auth[_0xba3d('0xb')](),controller[_0xba3d('0x16')]);router['post'](_0xba3d('0xd'),auth[_0xba3d('0xb')](),controller[_0xba3d('0x17')]);router[_0xba3d('0x15')](_0xba3d('0xf'),auth[_0xba3d('0xb')](),controller[_0xba3d('0x18')]);router[_0xba3d('0x15')](_0xba3d('0x12'),auth['isAuthenticated'](),controller[_0xba3d('0x19')]);router[_0xba3d('0x15')]('/:id/users',auth[_0xba3d('0xb')](),controller[_0xba3d('0x1a')]);router[_0xba3d('0x1b')](_0xba3d('0xa'),auth[_0xba3d('0xb')](),controller['update']);router[_0xba3d('0x1c')](_0xba3d('0xa'),auth['isAuthenticated'](),controller['destroy']);router[_0xba3d('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xba3d('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xba3d('0x1e')]);module[_0xba3d('0x1f')]=router; \ No newline at end of file +var _0x59b7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','describe','/global_fields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x59b7,0x1ae));var _0x759b=function(_0x304ff7,_0x118cb1){_0x304ff7=_0x304ff7-0x0;var _0x14b369=_0x59b7[_0x304ff7];return _0x14b369;};'use strict';var multer=require(_0x759b('0x0'));var util=require(_0x759b('0x1'));var path=require(_0x759b('0x2'));var timeout=require(_0x759b('0x3'));var express=require(_0x759b('0x4'));var router=express[_0x759b('0x5')]();var fs_extra=require(_0x759b('0x6'));var auth=require(_0x759b('0x7'));var interaction=require(_0x759b('0x8'));var config=require(_0x759b('0x9'));var controller=require(_0x759b('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x759b('0xb')](_0x759b('0xc'),auth[_0x759b('0xd')](),controller[_0x759b('0xe')]);router[_0x759b('0xb')](_0x759b('0xf'),auth[_0x759b('0xd')](),controller['getGlobalCustomFields']);router[_0x759b('0xb')](_0x759b('0x10'),auth[_0x759b('0xd')](),controller[_0x759b('0x11')]);router[_0x759b('0xb')]('/:id/dispositions',auth[_0x759b('0xd')](),controller['getDispositions']);router[_0x759b('0xb')](_0x759b('0x12'),auth[_0x759b('0xd')](),controller[_0x759b('0x13')]);router[_0x759b('0xb')](_0x759b('0x14'),auth[_0x759b('0xd')](),controller[_0x759b('0x15')]);router[_0x759b('0xb')]('/:id/fields',auth[_0x759b('0xd')](),controller['getCustomFields']);router[_0x759b('0xb')](_0x759b('0x16'),auth[_0x759b('0xd')](),controller[_0x759b('0x17')]);router['post']('/',auth[_0x759b('0xd')](),controller[_0x759b('0x18')]);router[_0x759b('0x19')](_0x759b('0x1a'),auth[_0x759b('0xd')](),controller[_0x759b('0x1b')]);router[_0x759b('0x19')](_0x759b('0x12'),auth[_0x759b('0xd')](),controller['addContacts']);router[_0x759b('0x19')]('/:id/fields',auth['isAuthenticated'](),controller[_0x759b('0x1c')]);router[_0x759b('0x19')](_0x759b('0x16'),auth[_0x759b('0xd')](),controller[_0x759b('0x1d')]);router[_0x759b('0x1e')]('/:id',auth[_0x759b('0xd')](),controller[_0x759b('0x1f')]);router[_0x759b('0x20')](_0x759b('0x10'),auth[_0x759b('0xd')](),controller[_0x759b('0x21')]);router['delete'](_0x759b('0x1a'),auth[_0x759b('0xd')](),controller['removeDispositions']);router['delete']('/:id/users',auth[_0x759b('0xd')](),controller[_0x759b('0x22')]);module[_0x759b('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f131612..b597d0a 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 _0x2880=['STRING','sequelize','VIRTUAL','getDataValue','field'];(function(_0x504888,_0x563325){var _0x3e60b6=function(_0x454c62){while(--_0x454c62){_0x504888['push'](_0x504888['shift']());}};_0x3e60b6(++_0x563325);}(_0x2880,0xec));var _0x0288=function(_0x24a2b0,_0x264053){_0x24a2b0=_0x24a2b0-0x0;var _0x477d85=_0x2880[_0x24a2b0];return _0x477d85;};'use strict';var Sequelize=require(_0x0288('0x0'));module['exports']={'name':{'type':Sequelize[_0x0288('0x1')],'get':function(_0x1175bb){return this[_0x0288('0x2')](_0x0288('0x3'));}},'field':{'type':Sequelize[_0x0288('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x0288('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9a70=['exports','getDataValue','field','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a70,0x17c));var _0x09a7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9a70[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x09a7('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x6f26fd){return this[_0x09a7('0x1')](_0x09a7('0x2'));}},'field':{'type':Sequelize[_0x09a7('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x09a7('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index cd8d668..cf0404f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1484fa,_0x2d4c4c){var _0x315bda=function(_0x44bfcc){while(--_0x44bfcc){_0x1484fa['push'](_0x1484fa['shift']());}};_0x315bda(++_0x2d4c4c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x40ca14,_0x11ff02){var _0x4edd9e=function(_0x43f7f0){while(--_0x43f7f0){_0x40ca14['push'](_0x40ca14['shift']());}};_0x4edd9e(++_0x11ff02);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c4b36dd..fcb0d4e 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 _0x2329=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util'];(function(_0x388273,_0x460b70){var _0x42677b=function(_0x43ecb5){while(--_0x43ecb5){_0x388273['push'](_0x388273['shift']());}};_0x42677b(++_0x460b70);}(_0x2329,0xa7));var _0x9232=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2329[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x9232('0x0'));var logger=require(_0x9232('0x1'))(_0x9232('0x2'));var moment=require(_0x9232('0x3'));var BPromise=require(_0x9232('0x4'));var rp=require(_0x9232('0x5'));var fs=require('fs');var path=require(_0x9232('0x6'));var rimraf=require(_0x9232('0x7'));var config=require(_0x9232('0x8'));var attributes=require(_0x9232('0x9'));module[_0x9232('0xa')]=function(_0x59f169,_0x539519){return _0x59f169[_0x9232('0xb')](_0x9232('0xc'),attributes,{'tableName':_0x9232('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x443a=['moment','rimraf','../../config/environment','./condition.attributes','exports','Condition','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x443a,0x88));var _0xa443=function(_0x50f9d3,_0x284d0d){_0x50f9d3=_0x50f9d3-0x0;var _0x10cd7f=_0x443a[_0x50f9d3];return _0x10cd7f;};'use strict';var _=require(_0xa443('0x0'));var util=require(_0xa443('0x1'));var logger=require(_0xa443('0x2'))(_0xa443('0x3'));var moment=require(_0xa443('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa443('0x5'));var config=require(_0xa443('0x6'));var attributes=require(_0xa443('0x7'));module[_0xa443('0x8')]=function(_0x239097,_0x34f37c){return _0x239097['define'](_0xa443('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a11d16a..cec4bae 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 _0xa352=['Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa352,0xa0));var _0x2a35=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xa352[_0x37756b];return _0x46efec;};'use strict';var _=require(_0x2a35('0x0'));var util=require('util');var moment=require(_0x2a35('0x1'));var BPromise=require(_0x2a35('0x2'));var rs=require(_0x2a35('0x3'));var fs=require('fs');var Redis=require(_0x2a35('0x4'));var db=require(_0x2a35('0x5'))['db'];var utils=require(_0x2a35('0x6'));var logger=require(_0x2a35('0x7'))(_0x2a35('0x8'));var config=require(_0x2a35('0x9'));var jayson=require(_0x2a35('0xa'));var client=jayson[_0x2a35('0xb')][_0x2a35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ae533,_0x2297dc,_0x5f2df4){return new BPromise(function(_0x381640,_0x3c88c0){return client[_0x2a35('0xd')](_0x2ae533,_0x5f2df4)[_0x2a35('0xe')](function(_0x22eb1c){logger['info'](_0x2a35('0xf'),_0x2297dc,'request\x20sent');logger[_0x2a35('0x10')](_0x2a35('0x11'),_0x2297dc,_0x2a35('0x12'),JSON[_0x2a35('0x13')](_0x22eb1c));if(_0x22eb1c[_0x2a35('0x14')]){if(_0x22eb1c[_0x2a35('0x14')][_0x2a35('0x15')]===0x1f4){logger['error'](_0x2a35('0xf'),_0x2297dc,_0x22eb1c[_0x2a35('0x14')][_0x2a35('0x16')]);return _0x3c88c0(_0x22eb1c['error']['message']);}logger[_0x2a35('0x14')](_0x2a35('0xf'),_0x2297dc,_0x22eb1c[_0x2a35('0x14')][_0x2a35('0x16')]);return _0x381640(_0x22eb1c[_0x2a35('0x14')]['message']);}else{logger[_0x2a35('0x17')](_0x2a35('0xf'),_0x2297dc,_0x2a35('0x12'));_0x381640(_0x22eb1c[_0x2a35('0x18')][_0x2a35('0x16')]);}})['catch'](function(_0x4be8d0){logger[_0x2a35('0x14')](_0x2a35('0xf'),_0x2297dc,_0x4be8d0);_0x3c88c0(_0x4be8d0);});});} \ No newline at end of file +var _0x547b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x303f7e,_0x2d4065){var _0x35a2b1=function(_0x45b8db){while(--_0x45b8db){_0x303f7e['push'](_0x303f7e['shift']());}};_0x35a2b1(++_0x2d4065);}(_0x547b,0x177));var _0xb547=function(_0x1ea6fc,_0xef44fe){_0x1ea6fc=_0x1ea6fc-0x0;var _0x55ec27=_0x547b[_0x1ea6fc];return _0x55ec27;};'use strict';var _=require(_0xb547('0x0'));var util=require(_0xb547('0x1'));var moment=require(_0xb547('0x2'));var BPromise=require(_0xb547('0x3'));var rs=require(_0xb547('0x4'));var fs=require('fs');var Redis=require(_0xb547('0x5'));var db=require(_0xb547('0x6'))['db'];var utils=require(_0xb547('0x7'));var logger=require('../../config/logger')(_0xb547('0x8'));var config=require('../../config/environment');var jayson=require(_0xb547('0x9'));var client=jayson['client'][_0xb547('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fba11,_0x580507,_0x1866ca){return new BPromise(function(_0x2e55a9,_0x3c8517){return client['request'](_0x1fba11,_0x1866ca)['then'](function(_0x2d30cf){logger[_0xb547('0xb')](_0xb547('0xc'),_0x580507,_0xb547('0xd'));logger[_0xb547('0xe')](_0xb547('0xf'),_0x580507,_0xb547('0xd'),JSON[_0xb547('0x10')](_0x2d30cf));if(_0x2d30cf[_0xb547('0x11')]){if(_0x2d30cf['error'][_0xb547('0x12')]===0x1f4){logger[_0xb547('0x11')](_0xb547('0xc'),_0x580507,_0x2d30cf['error'][_0xb547('0x13')]);return _0x3c8517(_0x2d30cf[_0xb547('0x11')][_0xb547('0x13')]);}logger[_0xb547('0x11')](_0xb547('0xc'),_0x580507,_0x2d30cf[_0xb547('0x11')][_0xb547('0x13')]);return _0x2e55a9(_0x2d30cf[_0xb547('0x11')][_0xb547('0x13')]);}else{logger['info'](_0xb547('0xc'),_0x580507,_0xb547('0xd'));_0x2e55a9(_0x2d30cf[_0xb547('0x14')][_0xb547('0x13')]);}})[_0xb547('0x15')](function(_0x5388b9){logger['error'](_0xb547('0xc'),_0x580507,_0x5388b9);_0x3c8517(_0x5388b9);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5edd65d..3be174c 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 _0xf719=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy'];(function(_0x2a9664,_0x10b53d){var _0x2855df=function(_0x424b68){while(--_0x424b68){_0x2a9664['push'](_0x2a9664['shift']());}};_0x2855df(++_0x10b53d);}(_0xf719,0x1a5));var _0x9f71=function(_0xeb67cb,_0x3facda){_0xeb67cb=_0xeb67cb-0x0;var _0xc8fe96=_0xf719[_0xeb67cb];return _0xc8fe96;};'use strict';var multer=require(_0x9f71('0x0'));var util=require(_0x9f71('0x1'));var path=require(_0x9f71('0x2'));var timeout=require(_0x9f71('0x3'));var express=require(_0x9f71('0x4'));var router=express[_0x9f71('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f71('0x6'));var config=require(_0x9f71('0x7'));var controller=require(_0x9f71('0x8'));router[_0x9f71('0x9')](_0x9f71('0xa'),auth[_0x9f71('0xb')](),controller['update']);router[_0x9f71('0xc')](_0x9f71('0xa'),auth[_0x9f71('0xb')](),controller[_0x9f71('0xd')]);module[_0x9f71('0xe')]=router; \ No newline at end of file +var _0xbeff=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','delete','/:id','isAuthenticated','destroy','multer','util','path'];(function(_0x2b16a6,_0x41e8cc){var _0x17f4a6=function(_0x62d82a){while(--_0x62d82a){_0x2b16a6['push'](_0x2b16a6['shift']());}};_0x17f4a6(++_0x41e8cc);}(_0xbeff,0x89));var _0xfbef=function(_0x1d29b9,_0x31747f){_0x1d29b9=_0x1d29b9-0x0;var _0x4edf93=_0xbeff[_0x1d29b9];return _0x4edf93;};'use strict';var multer=require(_0xfbef('0x0'));var util=require(_0xfbef('0x1'));var path=require(_0xfbef('0x2'));var timeout=require(_0xfbef('0x3'));var express=require(_0xfbef('0x4'));var router=express[_0xfbef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfbef('0x6'));var interaction=require(_0xfbef('0x7'));var config=require(_0xfbef('0x8'));var controller=require(_0xfbef('0x9'));router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfbef('0xa')](_0xfbef('0xb'),auth[_0xfbef('0xc')](),controller[_0xfbef('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 8fede1a..9920ecf 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 _0x9e49=['STRING','name','INTEGER','sequelize','exports'];(function(_0x885eff,_0x555809){var _0x17819f=function(_0x3a69f0){while(--_0x3a69f0){_0x885eff['push'](_0x885eff['shift']());}};_0x17819f(++_0x555809);}(_0x9e49,0x8a));var _0x99e4=function(_0x19db04,_0x1699fa){_0x19db04=_0x19db04-0x0;var _0x12abcd=_0x9e49[_0x19db04];return _0x12abcd;};'use strict';var Sequelize=require(_0x99e4('0x0'));module[_0x99e4('0x1')]={'name':{'type':Sequelize[_0x99e4('0x2')],'allowNull':![],'unique':_0x99e4('0x3')},'OrderBy':{'type':Sequelize[_0x99e4('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x99e4('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x40ca=['STRING','sequelize','name','INTEGER'];(function(_0x3df1ca,_0x49fb2a){var _0x5e7db8=function(_0x5aad74){while(--_0x5aad74){_0x3df1ca['push'](_0x3df1ca['shift']());}};_0x5e7db8(++_0x49fb2a);}(_0x40ca,0x1a1));var _0xa40c=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x40ca[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa40c('0x1')},'OrderBy':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa40c('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1c237e0..19a1562 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 _0x0b0e=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','update','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce'];(function(_0x1a2a09,_0x268737){var _0x1149ac=function(_0x2af208){while(--_0x2af208){_0x1a2a09['push'](_0x1a2a09['shift']());}};_0x1149ac(++_0x268737);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x0b0e[_0x2df724];return _0x1b2504;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){var _0x28586d=_0x503883['get']({'plain':!![]});var _0x3e5c88='ContactItemTypes';return db[_0xe0b0('0x25')]['destroy']({'where':{'type':_0x3e5c88,'resourceId':_0x28586d['id']}})[_0xe0b0('0x23')](function(){return _0x503883;});})['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)[_0xe0b0('0x19')]();});}};}function handleEntityNotFound(_0x1f1ebd,_0x1d91ad){return function(_0x3ec2){if(!_0x3ec2){_0x1f1ebd[_0xe0b0('0x18')](0x194);}return _0x3ec2;};}function handleError(_0x5200a6,_0x1444b9){_0x1444b9=_0x1444b9||0x1f4;return function(_0x1b8aa8){logger['error'](_0x1b8aa8[_0xe0b0('0x26')]);if(_0x1b8aa8[_0xe0b0('0x27')]){delete _0x1b8aa8[_0xe0b0('0x27')];}_0x5200a6[_0xe0b0('0x1a')](_0x1444b9)[_0xe0b0('0x28')](_0x1b8aa8);};}exports[_0xe0b0('0x29')]=function(_0x136bd4,_0x4fb3b7){var _0x1854b8={},_0x3c0109={},_0x48a9b5={'count':0x0,'rows':[]};var _0x4fe400=_[_0xe0b0('0x2a')](db[_0xe0b0('0x2b')][_0xe0b0('0x2c')],function(_0x3f81d5){return{'name':_0x3f81d5[_0xe0b0('0x2d')],'type':_0x3f81d5['type'][_0xe0b0('0x2e')]};});_0x3c0109[_0xe0b0('0x2f')]=_[_0xe0b0('0x2a')](_0x4fe400,_0xe0b0('0x27'));_0x3c0109[_0xe0b0('0x30')]=_['keys'](_0x136bd4[_0xe0b0('0x30')]);_0x3c0109[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],_0x3c0109[_0xe0b0('0x30')]);_0x1854b8[_0xe0b0('0x33')]=_[_0xe0b0('0x32')](_0x3c0109[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x1854b8[_0xe0b0('0x33')]=_0x1854b8[_0xe0b0('0x33')][_0xe0b0('0x35')]?_0x1854b8[_0xe0b0('0x33')]:_0x3c0109['model'];if(!_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x36')](_0xe0b0('0x37'))){_0x1854b8[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x1d')]);_0x1854b8['offset']=qs['offset'](_0x136bd4['query']['offset']);}_0x1854b8[_0xe0b0('0x38')]=qs[_0xe0b0('0x39')](_0x136bd4[_0xe0b0('0x30')]['sort']);_0x1854b8[_0xe0b0('0x3a')]=qs[_0xe0b0('0x31')](_[_0xe0b0('0x3b')](_0x136bd4[_0xe0b0('0x30')],_0x3c0109['filters']),_0x4fe400);if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x3c')]){_0x1854b8[_0xe0b0('0x3a')]=_[_0xe0b0('0x3d')](_0x1854b8[_0xe0b0('0x3a')],{'$or':_[_0xe0b0('0x2a')](_0x4fe400,function(_0x8b745){if(_0x8b745[_0xe0b0('0x3e')]!==_0xe0b0('0x3f')){var _0x54f251={};_0x54f251[_0x8b745[_0xe0b0('0x27')]]={'$like':'%'+_0x136bd4['query'][_0xe0b0('0x3c')]+'%'};return _0x54f251;}})});}_0x1854b8=_[_0xe0b0('0x3d')]({},_0x1854b8,_0x136bd4[_0xe0b0('0x40')]);var _0x74f3fa={'where':_0x1854b8['where']};return db[_0xe0b0('0x2b')][_0xe0b0('0x41')](_0x74f3fa)[_0xe0b0('0x23')](function(_0x402a0e){_0x48a9b5[_0xe0b0('0x41')]=_0x402a0e;if(_0x136bd4[_0xe0b0('0x30')][_0xe0b0('0x42')]){_0x1854b8[_0xe0b0('0x43')]=[{'all':!![]}];}return db['ContactItemType'][_0xe0b0('0x44')](_0x1854b8);})[_0xe0b0('0x23')](function(_0x528818){_0x48a9b5['rows']=_0x528818;return _0x48a9b5;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x4fb3b7,_0x1854b8))[_0xe0b0('0x45')](handleError(_0x4fb3b7,null));};exports['show']=function(_0x18a59d,_0x285d61){var _0x6bca5c={'raw':!![],'where':{'id':_0x18a59d[_0xe0b0('0x46')]['id']}},_0x1c869d={};_0x1c869d['model']=_['keys'](db['ContactItemType'][_0xe0b0('0x2c')]);_0x1c869d[_0xe0b0('0x30')]=_['keys'](_0x18a59d[_0xe0b0('0x30')]);_0x1c869d[_0xe0b0('0x31')]=_[_0xe0b0('0x32')](_0x1c869d[_0xe0b0('0x2f')],_0x1c869d[_0xe0b0('0x30')]);_0x6bca5c['attributes']=_['intersection'](_0x1c869d[_0xe0b0('0x2f')],qs[_0xe0b0('0x34')](_0x18a59d[_0xe0b0('0x30')][_0xe0b0('0x34')]));_0x6bca5c[_0xe0b0('0x33')]=_0x6bca5c['attributes'][_0xe0b0('0x35')]?_0x6bca5c[_0xe0b0('0x33')]:_0x1c869d['model'];if(_0x18a59d['query']['includeAll']){_0x6bca5c[_0xe0b0('0x43')]=[{'all':!![]}];}_0x6bca5c=_[_0xe0b0('0x3d')]({},_0x6bca5c,_0x18a59d[_0xe0b0('0x40')]);return db[_0xe0b0('0x2b')]['find'](_0x6bca5c)[_0xe0b0('0x23')](handleEntityNotFound(_0x285d61,null))[_0xe0b0('0x23')](respondWithResult(_0x285d61,null))['catch'](handleError(_0x285d61,null));};exports['create']=function(_0x2365be,_0x1bc6e0){return db['ContactItemType'][_0xe0b0('0x47')](_0x2365be[_0xe0b0('0x48')],{})['then'](function(_0x5cb2b6){var _0x123ad2=_0x2365be['user'][_0xe0b0('0x49')]({'plain':!![]});if(!_0x123ad2)throw new Error(_0xe0b0('0x4a'));if(_0x123ad2[_0xe0b0('0x4b')]===_0xe0b0('0x4c')){var _0x19ee71=_0x5cb2b6[_0xe0b0('0x49')]({'plain':!![]});var _0x5f5486='ContactItemTypes';return db[_0xe0b0('0x4d')]['find']({'where':{'name':_0x5f5486,'userProfileId':_0x123ad2['userProfileId']},'raw':!![]})[_0xe0b0('0x23')](function(_0x222174){if(_0x222174&&_0x222174['autoAssociation']===0x0){return db['UserProfileResource'][_0xe0b0('0x47')]({'name':_0x19ee71[_0xe0b0('0x27')],'resourceId':_0x19ee71['id'],'type':_0x222174[_0xe0b0('0x27')],'sectionId':_0x222174['id']},{})[_0xe0b0('0x23')](function(){return _0x5cb2b6;});}else{return _0x5cb2b6;}})[_0xe0b0('0x45')](function(_0x24115f){logger[_0xe0b0('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24115f);throw _0x24115f;});}return _0x5cb2b6;})[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,0xc9))['catch'](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x4f')]=function(_0x54106c,_0x5b2055){if(_0x54106c[_0xe0b0('0x48')]['id']){delete _0x54106c[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x54106c[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5b2055,null))[_0xe0b0('0x23')](saveUpdates(_0x54106c[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x5b2055,null))['catch'](handleError(_0x5b2055,null));};exports[_0xe0b0('0x24')]=function(_0x57ccc9,_0x2b5553){return db[_0xe0b0('0x2b')][_0xe0b0('0x50')]({'where':{'id':_0x57ccc9[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x2b5553,null))[_0xe0b0('0x23')](db['CmContactHasItem'][_0xe0b0('0x4f')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x57ccc9[_0xe0b0('0x46')]['id']}}))[_0xe0b0('0x23')](removeEntity(_0x2b5553,null))[_0xe0b0('0x45')](handleError(_0x2b5553,null));}; \ No newline at end of file +var _0x4325=['path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','name','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','util'];(function(_0x29614c,_0x338ce3){var _0x4b3e03=function(_0x1d848f){while(--_0x1d848f){_0x29614c['push'](_0x29614c['shift']());}};_0x4b3e03(++_0x338ce3);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){var _0x19e6b2=_0x3e0b66[_0x5432('0x26')]({'plain':!![]});var _0x637582='ContactItemTypes';return db[_0x5432('0x27')][_0x5432('0x25')]({'where':{'type':_0x637582,'resourceId':_0x19e6b2['id']}})[_0x5432('0x24')](function(){return _0x3e0b66;});})['then'](function(){_0x4af9f6['status'](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x2114b8,_0x589f79){return function(_0x1abe73){if(!_0x1abe73){_0x2114b8[_0x5432('0x17')](0x194);}return _0x1abe73;};}function handleError(_0x1f2e8f,_0x4add5b){_0x4add5b=_0x4add5b||0x1f4;return function(_0x29dc15){logger['error'](_0x29dc15['stack']);if(_0x29dc15[_0x5432('0x28')]){delete _0x29dc15['name'];}_0x1f2e8f[_0x5432('0x18')](_0x4add5b)['send'](_0x29dc15);};}exports['index']=function(_0x465a09,_0x21735e){var _0x345b51={},_0x4e92d5={},_0x31490c={'count':0x0,'rows':[]};var _0x1d436c=_[_0x5432('0x29')](db[_0x5432('0x2a')][_0x5432('0x2b')],function(_0x308b4c){return{'name':_0x308b4c[_0x5432('0x2c')],'type':_0x308b4c[_0x5432('0x2d')][_0x5432('0x2e')]};});_0x4e92d5['model']=_['map'](_0x1d436c,_0x5432('0x28'));_0x4e92d5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x465a09[_0x5432('0x2f')]);_0x4e92d5[_0x5432('0x31')]=_['intersection'](_0x4e92d5[_0x5432('0x32')],_0x4e92d5['query']);_0x345b51[_0x5432('0x33')]=_[_0x5432('0x34')](_0x4e92d5[_0x5432('0x32')],qs[_0x5432('0x35')](_0x465a09[_0x5432('0x2f')][_0x5432('0x35')]));_0x345b51['attributes']=_0x345b51[_0x5432('0x33')][_0x5432('0x36')]?_0x345b51[_0x5432('0x33')]:_0x4e92d5[_0x5432('0x32')];if(!_0x465a09['query'][_0x5432('0x37')](_0x5432('0x38'))){_0x345b51[_0x5432('0x1e')]=qs[_0x5432('0x1e')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1e')]);_0x345b51[_0x5432('0x1d')]=qs[_0x5432('0x1d')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x345b51[_0x5432('0x39')]=qs[_0x5432('0x3a')](_0x465a09[_0x5432('0x2f')][_0x5432('0x3a')]);_0x345b51['where']=qs[_0x5432('0x31')](_['pick'](_0x465a09[_0x5432('0x2f')],_0x4e92d5[_0x5432('0x31')]),_0x1d436c);if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]){_0x345b51['where']=_['merge'](_0x345b51['where'],{'$or':_[_0x5432('0x29')](_0x1d436c,function(_0x2053ed){if(_0x2053ed[_0x5432('0x2d')]!==_0x5432('0x3c')){var _0x52b296={};_0x52b296[_0x2053ed[_0x5432('0x28')]]={'$like':'%'+_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]+'%'};return _0x52b296;}})});}_0x345b51=_['merge']({},_0x345b51,_0x465a09[_0x5432('0x3d')]);var _0x38c951={'where':_0x345b51['where']};return db[_0x5432('0x2a')][_0x5432('0x1c')](_0x38c951)['then'](function(_0x23f8f4){_0x31490c['count']=_0x23f8f4;if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3e')]){_0x345b51[_0x5432('0x3f')]=[{'all':!![]}];}return db[_0x5432('0x2a')]['findAll'](_0x345b51);})[_0x5432('0x24')](function(_0x4b93b4){_0x31490c[_0x5432('0x40')]=_0x4b93b4;return _0x31490c;})[_0x5432('0x24')](respondWithFilteredResult(_0x21735e,_0x345b51))[_0x5432('0x41')](handleError(_0x21735e,null));};exports[_0x5432('0x42')]=function(_0xc656ca,_0x23119a){var _0x2234da={'raw':!![],'where':{'id':_0xc656ca[_0x5432('0x43')]['id']}},_0x4ab024={};_0x4ab024[_0x5432('0x32')]=_[_0x5432('0x30')](db[_0x5432('0x2a')][_0x5432('0x2b')]);_0x4ab024[_0x5432('0x2f')]=_[_0x5432('0x30')](_0xc656ca['query']);_0x4ab024[_0x5432('0x31')]=_[_0x5432('0x34')](_0x4ab024[_0x5432('0x32')],_0x4ab024[_0x5432('0x2f')]);_0x2234da[_0x5432('0x33')]=_['intersection'](_0x4ab024[_0x5432('0x32')],qs['fields'](_0xc656ca[_0x5432('0x2f')][_0x5432('0x35')]));_0x2234da['attributes']=_0x2234da[_0x5432('0x33')]['length']?_0x2234da[_0x5432('0x33')]:_0x4ab024[_0x5432('0x32')];if(_0xc656ca['query']['includeAll']){_0x2234da[_0x5432('0x3f')]=[{'all':!![]}];}_0x2234da=_[_0x5432('0x44')]({},_0x2234da,_0xc656ca[_0x5432('0x3d')]);return db[_0x5432('0x2a')][_0x5432('0x45')](_0x2234da)[_0x5432('0x24')](handleEntityNotFound(_0x23119a,null))[_0x5432('0x24')](respondWithResult(_0x23119a,null))['catch'](handleError(_0x23119a,null));};exports[_0x5432('0x46')]=function(_0x14763c,_0x429da8){return db['ContactItemType']['create'](_0x14763c['body'],{})['then'](function(_0x26d6ae){var _0x42212f=_0x14763c[_0x5432('0x47')][_0x5432('0x26')]({'plain':!![]});if(!_0x42212f)throw new Error(_0x5432('0x48'));if(_0x42212f['role']===_0x5432('0x47')){var _0xce691b=_0x26d6ae[_0x5432('0x26')]({'plain':!![]});var _0x536229=_0x5432('0x49');return db[_0x5432('0x4a')][_0x5432('0x45')]({'where':{'name':_0x536229,'userProfileId':_0x42212f[_0x5432('0x4b')]},'raw':!![]})[_0x5432('0x24')](function(_0x50cd7c){if(_0x50cd7c&&_0x50cd7c[_0x5432('0x4c')]===0x0){return db['UserProfileResource'][_0x5432('0x46')]({'name':_0xce691b['name'],'resourceId':_0xce691b['id'],'type':_0x50cd7c[_0x5432('0x28')],'sectionId':_0x50cd7c['id']},{})[_0x5432('0x24')](function(){return _0x26d6ae;});}else{return _0x26d6ae;}})['catch'](function(_0x7129e2){logger['error'](_0x5432('0x4d'),_0x7129e2);throw _0x7129e2;});}return _0x26d6ae;})[_0x5432('0x24')](respondWithResult(_0x429da8,0xc9))[_0x5432('0x41')](handleError(_0x429da8,null));};exports[_0x5432('0x23')]=function(_0x5f08eb,_0x3757b1){if(_0x5f08eb['body']['id']){delete _0x5f08eb[_0x5432('0x4e')]['id'];}return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x5f08eb[_0x5432('0x43')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x3757b1,null))[_0x5432('0x24')](saveUpdates(_0x5f08eb[_0x5432('0x4e')],null))[_0x5432('0x24')](respondWithResult(_0x3757b1,null))[_0x5432('0x41')](handleError(_0x3757b1,null));};exports[_0x5432('0x25')]=function(_0x3e0259,_0x20d9f5){return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x3e0259[_0x5432('0x43')]['id']}})['then'](handleEntityNotFound(_0x20d9f5,null))[_0x5432('0x24')](db[_0x5432('0x4f')][_0x5432('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3e0259[_0x5432('0x43')]['id']}}))[_0x5432('0x24')](removeEntity(_0x20d9f5,null))['catch'](handleError(_0x20d9f5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f62830b..65b7e35 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 _0x67a8=['moment','bluebird','request-promise','path','../../config/environment','exports','define','ContactItemType','lodash','util','../../config/logger','api'];(function(_0x22a3de,_0x5e9711){var _0x11a7b2=function(_0x3ef4c1){while(--_0x3ef4c1){_0x22a3de['push'](_0x22a3de['shift']());}};_0x11a7b2(++_0x5e9711);}(_0x67a8,0xc8));var _0x867a=function(_0x31d6b2,_0x218941){_0x31d6b2=_0x31d6b2-0x0;var _0x22c9b2=_0x67a8[_0x31d6b2];return _0x22c9b2;};'use strict';var _=require(_0x867a('0x0'));var util=require(_0x867a('0x1'));var logger=require(_0x867a('0x2'))(_0x867a('0x3'));var moment=require(_0x867a('0x4'));var BPromise=require(_0x867a('0x5'));var rp=require(_0x867a('0x6'));var fs=require('fs');var path=require(_0x867a('0x7'));var rimraf=require('rimraf');var config=require(_0x867a('0x8'));var attributes=require('./contactItemType.attributes');module[_0x867a('0x9')]=function(_0x3e8c23,_0x46831d){return _0x3e8c23[_0x867a('0xa')](_0x867a('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf292=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0xf292,0x110));var _0x2f29=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xf292[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0x2f29('0x0'));var util=require(_0x2f29('0x1'));var logger=require(_0x2f29('0x2'))(_0x2f29('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f29('0x4'));var fs=require('fs');var path=require(_0x2f29('0x5'));var rimraf=require(_0x2f29('0x6'));var config=require(_0x2f29('0x7'));var attributes=require(_0x2f29('0x8'));module[_0x2f29('0x9')]=function(_0x3b5761,_0x3738ea){return _0x3b5761[_0x2f29('0xa')](_0x2f29('0xb'),attributes,{'tableName':_0x2f29('0xc'),'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 6556d0f..87b8629 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 _0x2b70=['message','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2b70,0xc0));var _0x02b7=function(_0x128607,_0x242e5f){_0x128607=_0x128607-0x0;var _0x4ba37b=_0x2b70[_0x128607];return _0x4ba37b;};'use strict';var _=require('lodash');var util=require(_0x02b7('0x0'));var moment=require('moment');var BPromise=require(_0x02b7('0x1'));var rs=require(_0x02b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x02b7('0x4'))('rpc');var config=require(_0x02b7('0x5'));var jayson=require(_0x02b7('0x6'));var client=jayson[_0x02b7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fafc4,_0x2545d4,_0x36e345){return new BPromise(function(_0x4de7d1,_0x478e3d){return client[_0x02b7('0x8')](_0x2fafc4,_0x36e345)[_0x02b7('0x9')](function(_0x3f6236){logger[_0x02b7('0xa')](_0x02b7('0xb'),_0x2545d4,_0x02b7('0xc'));logger[_0x02b7('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2545d4,_0x02b7('0xc'),JSON[_0x02b7('0xe')](_0x3f6236));if(_0x3f6236['error']){if(_0x3f6236[_0x02b7('0xf')][_0x02b7('0x10')]===0x1f4){logger['error'](_0x02b7('0xb'),_0x2545d4,_0x3f6236[_0x02b7('0xf')][_0x02b7('0x11')]);return _0x478e3d(_0x3f6236[_0x02b7('0xf')]['message']);}logger[_0x02b7('0xf')]('ContactItemType,\x20%s,\x20%s',_0x2545d4,_0x3f6236[_0x02b7('0xf')]['message']);return _0x4de7d1(_0x3f6236['error']['message']);}else{logger[_0x02b7('0xa')](_0x02b7('0xb'),_0x2545d4,'request\x20sent');_0x4de7d1(_0x3f6236['result'][_0x02b7('0x11')]);}})[_0x02b7('0x12')](function(_0xd29aa9){logger[_0x02b7('0xf')](_0x02b7('0xb'),_0x2545d4,_0xd29aa9);_0x478e3d(_0xd29aa9);});});} \ No newline at end of file +var _0x81a4=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x81a4,0x1a6));var _0x481a=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x81a4[_0x525b28];return _0x180178;};'use strict';var _=require(_0x481a('0x0'));var util=require(_0x481a('0x1'));var moment=require(_0x481a('0x2'));var BPromise=require(_0x481a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x481a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x481a('0x5'));var logger=require(_0x481a('0x6'))(_0x481a('0x7'));var config=require('../../config/environment');var jayson=require(_0x481a('0x8'));var client=jayson[_0x481a('0x9')][_0x481a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b819,_0x4a5a92,_0x13ed10){return new BPromise(function(_0x13b771,_0x9b7dd5){return client[_0x481a('0xb')](_0x14b819,_0x13ed10)[_0x481a('0xc')](function(_0x59580e){logger['info'](_0x481a('0xd'),_0x4a5a92,_0x481a('0xe'));logger[_0x481a('0xf')](_0x481a('0x10'),_0x4a5a92,_0x481a('0xe'),JSON[_0x481a('0x11')](_0x59580e));if(_0x59580e[_0x481a('0x12')]){if(_0x59580e[_0x481a('0x12')][_0x481a('0x13')]===0x1f4){logger[_0x481a('0x12')]('ContactItemType,\x20%s,\x20%s',_0x4a5a92,_0x59580e['error'][_0x481a('0x14')]);return _0x9b7dd5(_0x59580e[_0x481a('0x12')][_0x481a('0x14')]);}logger[_0x481a('0x12')](_0x481a('0xd'),_0x4a5a92,_0x59580e[_0x481a('0x12')]['message']);return _0x13b771(_0x59580e[_0x481a('0x12')]['message']);}else{logger[_0x481a('0x15')](_0x481a('0xd'),_0x4a5a92,_0x481a('0xe'));_0x13b771(_0x59580e['result']['message']);}})[_0x481a('0x16')](function(_0xa5746f){logger[_0x481a('0x12')](_0x481a('0xd'),_0x4a5a92,_0xa5746f);_0x9b7dd5(_0xa5746f);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 63471ac..7eb4c46 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 _0xc368=['create','put','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1c808c,_0x416a95){var _0x2d6fc2=function(_0x557d2f){while(--_0x557d2f){_0x1c808c['push'](_0x1c808c['shift']());}};_0x2d6fc2(++_0x416a95);}(_0xc368,0x143));var _0x8c36=function(_0x13d64b,_0x195d1f){_0x13d64b=_0x13d64b-0x0;var _0xad4714=_0xc368[_0x13d64b];return _0xad4714;};'use strict';var multer=require(_0x8c36('0x0'));var util=require('util');var path=require(_0x8c36('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c36('0x2'));var router=express['Router']();var fs_extra=require(_0x8c36('0x3'));var auth=require(_0x8c36('0x4'));var interaction=require(_0x8c36('0x5'));var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller[_0x8c36('0xa')]);router[_0x8c36('0x8')](_0x8c36('0xb'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xc')]);router['post']('/',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router[_0x8c36('0xe')](_0x8c36('0xb'),auth[_0x8c36('0x9')](),controller['update']);router['delete'](_0x8c36('0xb'),auth['isAuthenticated'](),controller[_0x8c36('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1295=['update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3f761d,_0x5d907d){var _0x49d6e3=function(_0x39ab43){while(--_0x39ab43){_0x3f761d['push'](_0x3f761d['shift']());}};_0x49d6e3(++_0x5d907d);}(_0x1295,0x123));var _0x5129=function(_0x7b0ca2,_0x21e34a){_0x7b0ca2=_0x7b0ca2-0x0;var _0x6aa31e=_0x1295[_0x7b0ca2];return _0x6aa31e;};'use strict';var multer=require(_0x5129('0x0'));var util=require('util');var path=require(_0x5129('0x1'));var timeout=require(_0x5129('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5129('0x3'));var interaction=require(_0x5129('0x4'));var config=require('../../config/environment');var controller=require(_0x5129('0x5'));router[_0x5129('0x6')]('/',auth[_0x5129('0x7')](),controller[_0x5129('0x8')]);router[_0x5129('0x6')](_0x5129('0x9'),auth[_0x5129('0x7')](),controller['show']);router[_0x5129('0xa')]('/',auth[_0x5129('0x7')](),controller[_0x5129('0xb')]);router[_0x5129('0xc')](_0x5129('0x9'),auth[_0x5129('0x7')](),controller[_0x5129('0xd')]);router['delete'](_0x5129('0x9'),auth[_0x5129('0x7')](),controller[_0x5129('0xe')]);module[_0x5129('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f5e8b33..5a675ad 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 _0x0713=['STRING','name'];(function(_0x469e63,_0x128418){var _0x4601e6=function(_0x449436){while(--_0x449436){_0x469e63['push'](_0x469e63['shift']());}};_0x4601e6(++_0x128418);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x208c6b,_0x47b4b8){var _0x479ce9=function(_0x1eb6d1){while(--_0x1eb6d1){_0x208c6b['push'](_0x208c6b['shift']());}};_0x479ce9(++_0x47b4b8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 970c170..bc23004 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 _0x528d=['attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','findOne','order','nolimit','getItems','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Dashboard','rows','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','catch','clone','omit','createdAt','updatedAt','userProfileId','attrUrl'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x528d,0xa4));var _0xd528=function(_0x44ba6b,_0x1464d3){_0x44ba6b=_0x44ba6b-0x0;var _0xaec0d0=_0x528d[_0x44ba6b];return _0xaec0d0;};'use strict';var emlformat=require(_0xd528('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd528('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd528('0x2'));var moment=require(_0xd528('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd528('0x4'));var util=require(_0xd528('0x5'));var path=require(_0xd528('0x6'));var sox=require(_0xd528('0x7'));var csv=require(_0xd528('0x8'));var ejs=require(_0xd528('0x9'));var fs=require('fs');var fs_extra=require(_0xd528('0xa'));var _=require(_0xd528('0xb'));var squel=require(_0xd528('0xc'));var crypto=require(_0xd528('0xd'));var jsforce=require(_0xd528('0xe'));var deskjs=require(_0xd528('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd528('0x10'));var Papa=require(_0xd528('0x11'));var Redis=require(_0xd528('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd528('0x13'));var as=require(_0xd528('0x14'));var hardwareService=require(_0xd528('0x15'));var logger=require(_0xd528('0x16'))(_0xd528('0x17'));var utils=require(_0xd528('0x18'));var config=require(_0xd528('0x19'));var licenseUtil=require(_0xd528('0x1a'));var db=require(_0xd528('0x1b'))['db'];config['redis']=_[_0xd528('0x1c')](config['redis'],{'host':_0xd528('0x1d'),'port':0x18eb});var socket=require(_0xd528('0x1e'))(new Redis(config[_0xd528('0x1f')]));require(_0xd528('0x20'))['register'](socket);function respondWithStatusCode(_0x44afa8,_0x2429d8){_0x2429d8=_0x2429d8||0xcc;return function(_0x27b596){if(_0x27b596){return _0x44afa8[_0xd528('0x21')](_0x2429d8);}return _0x44afa8['status'](_0x2429d8)[_0xd528('0x22')]();};}function respondWithResult(_0x142b08,_0x4a7a0a){_0x4a7a0a=_0x4a7a0a||0xc8;return function(_0xcd4fbe){if(_0xcd4fbe){return _0x142b08['status'](_0x4a7a0a)[_0xd528('0x23')](_0xcd4fbe);}};}function respondWithFilteredResult(_0x25a939,_0x3ace1b){return function(_0x3964bb){if(_0x3964bb){var _0x2361c9=typeof _0x3ace1b[_0xd528('0x24')]===_0xd528('0x25')&&typeof _0x3ace1b[_0xd528('0x26')]===_0xd528('0x25');var _0x6f464d=_0x3964bb[_0xd528('0x27')];var _0x480c22=_0x2361c9?0x0:_0x3ace1b['offset'];var _0x5cb8d4=_0x2361c9?_0x3964bb[_0xd528('0x27')]:_0x3ace1b[_0xd528('0x24')]+_0x3ace1b[_0xd528('0x26')];var _0x305626;if(_0x5cb8d4>=_0x6f464d){_0x5cb8d4=_0x6f464d;_0x305626=0xc8;}else{_0x305626=0xce;}_0x25a939[_0xd528('0x28')](_0x305626);return _0x25a939[_0xd528('0x29')](_0xd528('0x2a'),_0x480c22+'-'+_0x5cb8d4+'/'+_0x6f464d)['json'](_0x3964bb);}return null;};}function patchUpdates(_0x357181){return function(_0x5d4fb8){try{jsonpatch[_0xd528('0x2b')](_0x5d4fb8,_0x357181,!![]);}catch(_0x213695){return BPromise[_0xd528('0x2c')](_0x213695);}return _0x5d4fb8[_0xd528('0x2d')]();};}function saveUpdates(_0x6d8700,_0x16e654){return function(_0x3b4a90){if(_0x3b4a90){return _0x3b4a90[_0xd528('0x2e')](_0x6d8700)['then'](function(_0x4d87ad){return _0x4d87ad;});}return null;};}function removeEntity(_0x40561e,_0x5323f7){return function(_0x1832b9){if(_0x1832b9){return _0x1832b9['destroy']()[_0xd528('0x2f')](function(){var _0xfe4b7c=_0x1832b9[_0xd528('0x30')]({'plain':!![]});var _0x15456b=_0xd528('0x31');return db[_0xd528('0x32')][_0xd528('0x33')]({'where':{'type':_0x15456b,'resourceId':_0xfe4b7c['id']}})['then'](function(){return _0x1832b9;});})[_0xd528('0x2f')](function(){_0x40561e[_0xd528('0x28')](0xcc)[_0xd528('0x22')]();});}};}function handleEntityNotFound(_0x109fe0,_0x2c520e){return function(_0x3278d3){if(!_0x3278d3){_0x109fe0[_0xd528('0x21')](0x194);}return _0x3278d3;};}function handleError(_0x336027,_0x418873){_0x418873=_0x418873||0x1f4;return function(_0x2e10cc){logger[_0xd528('0x34')](_0x2e10cc[_0xd528('0x35')]);if(_0x2e10cc['name']){delete _0x2e10cc['name'];}_0x336027[_0xd528('0x28')](_0x418873)[_0xd528('0x36')](_0x2e10cc);};}exports[_0xd528('0x37')]=function(_0x5b9584,_0x4074f8){var _0x3e0cca={},_0x1a2e42={},_0x2de738={'count':0x0,'rows':[]};var _0x3feaec=_[_0xd528('0x38')](db['Dashboard'][_0xd528('0x39')],function(_0x54a240){return{'name':_0x54a240[_0xd528('0x3a')],'type':_0x54a240[_0xd528('0x3b')][_0xd528('0x3c')]};});_0x1a2e42[_0xd528('0x3d')]=_[_0xd528('0x38')](_0x3feaec,_0xd528('0x3e'));_0x1a2e42[_0xd528('0x3f')]=_['keys'](_0x5b9584[_0xd528('0x3f')]);_0x1a2e42[_0xd528('0x40')]=_[_0xd528('0x41')](_0x1a2e42[_0xd528('0x3d')],_0x1a2e42[_0xd528('0x3f')]);_0x3e0cca['attributes']=_[_0xd528('0x41')](_0x1a2e42[_0xd528('0x3d')],qs[_0xd528('0x42')](_0x5b9584[_0xd528('0x3f')][_0xd528('0x42')]));_0x3e0cca[_0xd528('0x43')]=_0x3e0cca[_0xd528('0x43')][_0xd528('0x44')]?_0x3e0cca[_0xd528('0x43')]:_0x1a2e42['model'];if(!_0x5b9584['query'][_0xd528('0x45')]('nolimit')){_0x3e0cca['limit']=qs[_0xd528('0x26')](_0x5b9584['query'][_0xd528('0x26')]);_0x3e0cca[_0xd528('0x24')]=qs[_0xd528('0x24')](_0x5b9584['query']['offset']);}_0x3e0cca['order']=qs[_0xd528('0x46')](_0x5b9584[_0xd528('0x3f')][_0xd528('0x46')]);_0x3e0cca[_0xd528('0x47')]=qs['filters'](_[_0xd528('0x48')](_0x5b9584[_0xd528('0x3f')],_0x1a2e42[_0xd528('0x40')]),_0x3feaec);if(_0x5b9584[_0xd528('0x3f')][_0xd528('0x49')]){_0x3e0cca[_0xd528('0x47')]=_[_0xd528('0x4a')](_0x3e0cca[_0xd528('0x47')],{'$or':_['map'](_0x3feaec,function(_0x1f78d8){if(_0x1f78d8['type']!==_0xd528('0x4b')){var _0x3feb80={};_0x3feb80[_0x1f78d8[_0xd528('0x3e')]]={'$like':'%'+_0x5b9584[_0xd528('0x3f')][_0xd528('0x49')]+'%'};return _0x3feb80;}})});}_0x3e0cca=_[_0xd528('0x4a')]({},_0x3e0cca,_0x5b9584[_0xd528('0x4c')]);var _0x1fdef5={'where':_0x3e0cca[_0xd528('0x47')]};return db['Dashboard'][_0xd528('0x27')](_0x1fdef5)['then'](function(_0x34f2fc){_0x2de738[_0xd528('0x27')]=_0x34f2fc;if(_0x5b9584['query'][_0xd528('0x4d')]){_0x3e0cca[_0xd528('0x4e')]=[{'all':!![]}];}return db[_0xd528('0x4f')]['findAll'](_0x3e0cca);})['then'](function(_0x422c66){_0x2de738[_0xd528('0x50')]=_0x422c66;return _0x2de738;})[_0xd528('0x2f')](respondWithFilteredResult(_0x4074f8,_0x3e0cca))['catch'](handleError(_0x4074f8,null));};exports['show']=function(_0x1a1594,_0x32e758){var _0x3e996e={'raw':![],'where':{'id':_0x1a1594[_0xd528('0x51')]['id']}},_0x435c60={};_0x435c60['model']=_[_0xd528('0x52')](db[_0xd528('0x4f')][_0xd528('0x39')]);_0x435c60[_0xd528('0x3f')]=_['keys'](_0x1a1594[_0xd528('0x3f')]);_0x435c60[_0xd528('0x40')]=_[_0xd528('0x41')](_0x435c60[_0xd528('0x3d')],_0x435c60['query']);_0x3e996e[_0xd528('0x43')]=_[_0xd528('0x41')](_0x435c60[_0xd528('0x3d')],qs[_0xd528('0x42')](_0x1a1594[_0xd528('0x3f')][_0xd528('0x42')]));_0x3e996e[_0xd528('0x43')]=_0x3e996e['attributes'][_0xd528('0x44')]?_0x3e996e[_0xd528('0x43')]:_0x435c60[_0xd528('0x3d')];if(_0x1a1594[_0xd528('0x3f')][_0xd528('0x4d')]){_0x3e996e[_0xd528('0x4e')]=[{'all':!![]}];}_0x3e996e=_[_0xd528('0x4a')]({},_0x3e996e,_0x1a1594[_0xd528('0x4c')]);return db[_0xd528('0x4f')][_0xd528('0x53')](_0x3e996e)[_0xd528('0x2f')](handleEntityNotFound(_0x32e758,null))['then'](respondWithResult(_0x32e758,null))['catch'](handleError(_0x32e758,null));};exports['create']=function(_0x4e2588,_0x186777){return db['Dashboard'][_0xd528('0x54')](_0x4e2588[_0xd528('0x55')],{})[_0xd528('0x2f')](function(_0x4c6069){var _0x44d159=_0x4e2588['user']['get']({'plain':!![]});if(!_0x44d159)throw new Error(_0xd528('0x56'));if(_0x44d159[_0xd528('0x57')]===_0xd528('0x58')){var _0x19fe86=_0x4c6069[_0xd528('0x30')]({'plain':!![]});var _0x333591=_0xd528('0x31');return db[_0xd528('0x59')][_0xd528('0x53')]({'where':{'name':_0x333591,'userProfileId':_0x44d159['userProfileId']},'raw':!![]})[_0xd528('0x2f')](function(_0x53ba71){if(_0x53ba71&&_0x53ba71[_0xd528('0x5a')]===0x0){return db[_0xd528('0x32')][_0xd528('0x54')]({'name':_0x19fe86[_0xd528('0x3e')],'resourceId':_0x19fe86['id'],'type':_0x53ba71[_0xd528('0x3e')],'sectionId':_0x53ba71['id']},{})[_0xd528('0x2f')](function(){return _0x4c6069;});}else{return _0x4c6069;}})['catch'](function(_0x4f416b){logger[_0xd528('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f416b);throw _0x4f416b;});}return _0x4c6069;})[_0xd528('0x2f')](respondWithResult(_0x186777,0xc9))[_0xd528('0x5b')](handleError(_0x186777,null));};exports[_0xd528('0x5c')]=function(_0x240e05,_0x48af11){var _0x587675={'where':{'id':_0x240e05[_0xd528('0x51')]['id']}},_0x3f7715={};_0x3f7715[_0xd528('0x3d')]=_['keys'](db['Dashboard'][_0xd528('0x39')]);_0x587675[_0xd528('0x43')]=_[_0xd528('0x41')](_0x3f7715[_0xd528('0x3d')],qs['fields'](_0x240e05[_0xd528('0x3f')][_0xd528('0x42')]));_0x587675['attributes']=_0x587675['attributes'][_0xd528('0x44')]?_0x587675[_0xd528('0x43')]:_0x3f7715[_0xd528('0x3d')];if(_0x240e05[_0xd528('0x3f')][_0xd528('0x4d')]){_0x587675[_0xd528('0x4e')]=[{'all':!![]}];}_0x587675=_[_0xd528('0x4a')]({},_0x587675,_0x240e05[_0xd528('0x4c')]);return db[_0xd528('0x4f')][_0xd528('0x53')](_0x587675)[_0xd528('0x2f')](handleEntityNotFound(_0x48af11,null))[_0xd528('0x2f')](function(_0x465385){if(_0x465385){var _0x8649ae=_0x465385[_0xd528('0x30')]({'plain':!![]});_0x8649ae=qs[_0xd528('0x5d')](_0x8649ae,['id',_0xd528('0x5e'),_0xd528('0x5f')]);_0x240e05[_0xd528('0x55')]=_[_0xd528('0x5d')](_0x240e05['body'],['id',_0xd528('0x5e'),_0xd528('0x5f')]);return db[_0xd528('0x4f')][_0xd528('0x54')](_['merge'](_0x8649ae,_0x240e05[_0xd528('0x55')]),{'include':_0x240e05['query'][_0xd528('0x4d')]?[{'all':!![]}]:undefined})[_0xd528('0x2f')](function(_0x2ce964){var _0x3ff039=_0x240e05[_0xd528('0x58')]['get']({'plain':!![]});if(!_0x3ff039)throw new Error(_0xd528('0x56'));if(_0x3ff039[_0xd528('0x57')]===_0xd528('0x58')){var _0x250cff=_0x2ce964[_0xd528('0x30')]({'plain':!![]});var _0x21ed4a=_0xd528('0x31');return db['UserProfileSection'][_0xd528('0x53')]({'where':{'name':_0x21ed4a,'userProfileId':_0x3ff039[_0xd528('0x60')]},'raw':!![]})['then'](function(_0x3f0e3d){if(_0x3f0e3d&&_0x3f0e3d[_0xd528('0x5a')]===0x0){return db[_0xd528('0x32')][_0xd528('0x54')]({'name':_0x250cff['name'],'resourceId':_0x250cff['id'],'type':_0x3f0e3d['name'],'sectionId':_0x3f0e3d['id']},{})[_0xd528('0x2f')](function(){return _0x2ce964;});}else{return _0x2ce964;}})[_0xd528('0x5b')](function(_0x133054){logger[_0xd528('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x133054);throw _0x133054;});}return _0x2ce964;});}})[_0xd528('0x2f')](respondWithResult(_0x48af11,0xc9))[_0xd528('0x5b')](handleError(_0x48af11,null));};exports['update']=function(_0x89c9e5,_0x1b1708){if(_0x89c9e5[_0xd528('0x55')]['id']){delete _0x89c9e5['body']['id'];}return db[_0xd528('0x4f')][_0xd528('0x53')]({'where':{'id':_0x89c9e5['params']['id']}})[_0xd528('0x2f')](handleEntityNotFound(_0x1b1708,null))[_0xd528('0x2f')](saveUpdates(_0x89c9e5[_0xd528('0x55')],null))[_0xd528('0x2f')](respondWithResult(_0x1b1708,null))[_0xd528('0x5b')](handleError(_0x1b1708,null));};exports[_0xd528('0x33')]=function(_0x494149,_0x5b6bcf){return db['Dashboard'][_0xd528('0x53')]({'where':{'id':_0x494149[_0xd528('0x51')]['id']}})[_0xd528('0x2f')](handleEntityNotFound(_0x5b6bcf,null))[_0xd528('0x2f')](removeEntity(_0x5b6bcf,null))[_0xd528('0x5b')](handleError(_0x5b6bcf,null));};function widgetAttributes(_0x10af22){try{switch(_0x10af22[_0xd528('0x3b')]){case'iframe':return[{'name':_0xd528('0x61'),'value':_0x10af22[_0xd528('0x61')]||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22[_0xd528('0x62')][0x0][_0xd528('0x63')]:undefined)||_0xd528('0x64')}];case _0xd528('0x65'):return[{'name':'attrPath','value':_0x10af22['attrPath']||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22['attrs'][0x0]['value']:undefined)||''}];case _0xd528('0x66'):return[{'name':_0xd528('0x67'),'value':_0x10af22[_0xd528('0x67')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22[_0xd528('0x62')][0x0][_0xd528('0x63')]:undefined)||_0xd528('0x68')},{'name':'attrTimezone','value':_0x10af22['attrTimezone']||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x1]?_0x10af22[_0xd528('0x62')][0x1][_0xd528('0x63')]:undefined)||_0xd528('0x69')},{'name':_0xd528('0x6a'),'value':_0x10af22[_0xd528('0x6a')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x2]?_0x10af22[_0xd528('0x62')][0x2][_0xd528('0x63')]:undefined)||0xc}];case _0xd528('0x6b'):return[{'name':'attrMetric','value':_0x10af22['attrMetric']||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22[_0xd528('0x62')][0x0][_0xd528('0x63')]:undefined)||_0xd528('0x6c')},{'name':_0xd528('0x6d'),'value':_0x10af22['attrVoiceQueues']||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x1]?_0x10af22['attrs'][0x1][_0xd528('0x63')]:undefined)||[]},{'name':'attrFontSize','value':_0x10af22[_0xd528('0x6a')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22['attrs'][0x2]?_0x10af22[_0xd528('0x62')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x10af22[_0xd528('0x6e')]||(_0x10af22['attrs']&&_0x10af22['attrs'][0x3]?_0x10af22['attrs'][0x3][_0xd528('0x63')]:undefined)||'voice'},{'name':_0xd528('0x6f'),'value':_0x10af22[_0xd528('0x6f')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x4]?_0x10af22['attrs'][0x4]['value']:undefined)||''},{'name':_0xd528('0x70'),'value':_0x10af22['attrFaxAccounts']||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x5]?_0x10af22[_0xd528('0x62')][0x5][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x71'),'value':_0x10af22[_0xd528('0x71')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x6]?_0x10af22[_0xd528('0x62')][0x6][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x72'),'value':_0x10af22[_0xd528('0x72')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x7]?_0x10af22['attrs'][0x7][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x73'),'value':_0x10af22['attrWhatsappAccounts']||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x8]?_0x10af22[_0xd528('0x62')][0x8][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x74'),'value':_0x10af22[_0xd528('0x74')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22['attrs'][0x9]?_0x10af22[_0xd528('0x62')][0x9]['value']:undefined)||''}];case _0xd528('0x75'):case'pie-chart':return[{'name':_0xd528('0x76'),'value':_0x10af22[_0xd528('0x76')]||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22[_0xd528('0x62')][0x0][_0xd528('0x63')]:undefined)||_0xd528('0x6c')},{'name':'attrSerie2','value':_0x10af22[_0xd528('0x77')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x1]?_0x10af22[_0xd528('0x62')][0x1][_0xd528('0x63')]:undefined)||null},{'name':_0xd528('0x78'),'value':_0x10af22[_0xd528('0x78')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x2]?_0x10af22[_0xd528('0x62')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x10af22['attrVoiceQueues']||(_0x10af22[_0xd528('0x62')]&&_0x10af22['attrs'][0x3]?_0x10af22[_0xd528('0x62')][0x3][_0xd528('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0x10af22['attrChannel']||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x4]?_0x10af22[_0xd528('0x62')][0x4][_0xd528('0x63')]:undefined)||_0xd528('0x79')},{'name':'attrEmailAccounts','value':_0x10af22[_0xd528('0x6f')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x5]?_0x10af22[_0xd528('0x62')][0x5][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x70'),'value':_0x10af22[_0xd528('0x70')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x6]?_0x10af22[_0xd528('0x62')][0x6][_0xd528('0x63')]:undefined)||''},{'name':_0xd528('0x71'),'value':_0x10af22['attrSmsAccounts']||(_0x10af22[_0xd528('0x62')]&&_0x10af22['attrs'][0x7]?_0x10af22[_0xd528('0x62')][0x7]['value']:undefined)||''},{'name':_0xd528('0x72'),'value':_0x10af22[_0xd528('0x72')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x8]?_0x10af22[_0xd528('0x62')][0x8]['value']:undefined)||''},{'name':_0xd528('0x73'),'value':_0x10af22[_0xd528('0x73')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x9]?_0x10af22[_0xd528('0x62')][0x9][_0xd528('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x10af22[_0xd528('0x74')]||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0xa]?_0x10af22[_0xd528('0x62')][0xa]['value']:undefined)||''}];case _0xd528('0x7a'):return[{'name':_0xd528('0x7b'),'type':_0x10af22['reportType']||(_0x10af22[_0xd528('0x62')]&&_0x10af22['attrs'][0x0]?_0x10af22[_0xd528('0x62')][0x0][_0xd528('0x3b')]:undefined)||null,'value':_0x10af22[_0xd528('0x7b')]||(_0x10af22['attrs']&&_0x10af22[_0xd528('0x62')][0x0]?_0x10af22['attrs'][0x0][_0xd528('0x63')]:undefined)||null},{'name':_0xd528('0x7c'),'value':_0x10af22['attrRefresh']||(_0x10af22[_0xd528('0x62')]&&_0x10af22[_0xd528('0x62')][0x1]?_0x10af22[_0xd528('0x62')][0x1][_0xd528('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x220679){logger['error'](_0xd528('0x7d'),JSON['stringify'](_0x220679));return[];}}exports['addItem']=function(_0x13e91e,_0x483e06,_0xc4a842){if(_0x13e91e[_0xd528('0x55')]['id']){delete _0x13e91e[_0xd528('0x55')]['id'];}return db[_0xd528('0x4f')][_0xd528('0x53')]({'where':{'id':_0x13e91e['params']['id']}})['then'](handleEntityNotFound(_0x483e06,null))[_0xd528('0x2f')](function(_0x2403cb){if(_0x2403cb){_0x13e91e[_0xd528('0x55')][_0xd528('0x7e')]=_0x2403cb['id'];_0x13e91e['body'][_0xd528('0x62')]=widgetAttributes(_0x13e91e['body']);return db['DashboardItem'][_0xd528('0x54')](_0x13e91e[_0xd528('0x55')]);}})[_0xd528('0x2f')](respondWithResult(_0x483e06,null))['catch'](handleError(_0x483e06,null));};exports['getItems']=function(_0x5eed2b,_0x344b45,_0x44936f){var _0x459833={};var _0x5bbefd={};var _0x52ec32;var _0x6f81e8;return db[_0xd528('0x4f')][_0xd528('0x7f')]({'where':{'id':_0x5eed2b[_0xd528('0x51')]['id']}})[_0xd528('0x2f')](handleEntityNotFound(_0x344b45,null))[_0xd528('0x2f')](function(_0x53a044){if(_0x53a044){_0x52ec32=_0x53a044;_0x5bbefd[_0xd528('0x3d')]=_[_0xd528('0x52')](db['DashboardItem'][_0xd528('0x39')]);_0x5bbefd['query']=_[_0xd528('0x52')](_0x5eed2b[_0xd528('0x3f')]);_0x5bbefd[_0xd528('0x40')]=_[_0xd528('0x41')](_0x5bbefd[_0xd528('0x3d')],_0x5bbefd[_0xd528('0x3f')]);_0x459833['attributes']=_[_0xd528('0x41')](_0x5bbefd[_0xd528('0x3d')],qs[_0xd528('0x42')](_0x5eed2b['query']['fields']));_0x459833[_0xd528('0x43')]=_0x459833[_0xd528('0x43')]['length']?_0x459833['attributes']:_0x5bbefd[_0xd528('0x3d')];_0x459833[_0xd528('0x80')]=qs[_0xd528('0x46')](_0x5eed2b[_0xd528('0x3f')]['sort']);_0x459833[_0xd528('0x47')]=qs[_0xd528('0x40')](_['pick'](_0x5eed2b[_0xd528('0x3f')],_0x5bbefd[_0xd528('0x40')]));if(_0x5eed2b[_0xd528('0x3f')][_0xd528('0x49')]){_0x459833[_0xd528('0x47')]=_[_0xd528('0x4a')](_0x459833[_0xd528('0x47')],{'$or':_[_0xd528('0x38')](_0x459833['attributes'],function(_0x3b46c2){var _0x49fa60={};_0x49fa60[_0x3b46c2]={'$like':'%'+_0x5eed2b[_0xd528('0x3f')][_0xd528('0x49')]+'%'};return _0x49fa60;})});}_0x459833=_[_0xd528('0x4a')]({},_0x459833,_0x5eed2b[_0xd528('0x4c')]);return _0x52ec32['getItems'](_0x459833);}})[_0xd528('0x2f')](function(_0x5a2d14){if(_0x5a2d14){_0x6f81e8=_0x5a2d14[_0xd528('0x44')];if(!_0x5eed2b[_0xd528('0x3f')][_0xd528('0x45')](_0xd528('0x81'))){_0x459833[_0xd528('0x26')]=qs[_0xd528('0x26')](_0x5eed2b[_0xd528('0x3f')][_0xd528('0x26')]);_0x459833[_0xd528('0x24')]=qs['offset'](_0x5eed2b[_0xd528('0x3f')]['offset']);}return _0x52ec32[_0xd528('0x82')](_0x459833);}})[_0xd528('0x2f')](function(_0x52fe1b){if(_0x52fe1b){return _0x52fe1b?{'count':_0x6f81e8,'rows':_0x52fe1b}:null;}})[_0xd528('0x2f')](respondWithResult(_0x344b45,null))[_0xd528('0x5b')](handleError(_0x344b45,null));}; \ No newline at end of file +var _0x7a48=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a48,0xf2));var _0x87a4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7a48[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87a4('0x0'));var zipdir=require(_0x87a4('0x1'));var jsonpatch=require(_0x87a4('0x2'));var rp=require(_0x87a4('0x3'));var moment=require('moment');var BPromise=require(_0x87a4('0x4'));var Mustache=require('mustache');var util=require(_0x87a4('0x5'));var path=require('path');var sox=require(_0x87a4('0x6'));var csv=require(_0x87a4('0x7'));var ejs=require(_0x87a4('0x8'));var fs=require('fs');var fs_extra=require(_0x87a4('0x9'));var _=require(_0x87a4('0xa'));var squel=require(_0x87a4('0xb'));var crypto=require(_0x87a4('0xc'));var jsforce=require(_0x87a4('0xd'));var deskjs=require(_0x87a4('0xe'));var toCsv=require(_0x87a4('0x7'));var querystring=require(_0x87a4('0xf'));var Papa=require(_0x87a4('0x10'));var Redis=require(_0x87a4('0x11'));var authService=require(_0x87a4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87a4('0x13'));var logger=require(_0x87a4('0x14'))(_0x87a4('0x15'));var utils=require(_0x87a4('0x16'));var config=require(_0x87a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x87a4('0x18'))['db'];config[_0x87a4('0x19')]=_[_0x87a4('0x1a')](config[_0x87a4('0x19')],{'host':_0x87a4('0x1b'),'port':0x18eb});var socket=require(_0x87a4('0x1c'))(new Redis(config['redis']));require(_0x87a4('0x1d'))[_0x87a4('0x1e')](socket);function respondWithStatusCode(_0x116964,_0x808bb1){_0x808bb1=_0x808bb1||0xcc;return function(_0x3293d9){if(_0x3293d9){return _0x116964[_0x87a4('0x1f')](_0x808bb1);}return _0x116964['status'](_0x808bb1)[_0x87a4('0x20')]();};}function respondWithResult(_0x2fbaf2,_0x3b3172){_0x3b3172=_0x3b3172||0xc8;return function(_0x392759){if(_0x392759){return _0x2fbaf2[_0x87a4('0x21')](_0x3b3172)[_0x87a4('0x22')](_0x392759);}};}function respondWithFilteredResult(_0xafd8fc,_0x3f2319){return function(_0x53dabb){if(_0x53dabb){var _0x5c0817=typeof _0x3f2319[_0x87a4('0x23')]===_0x87a4('0x24')&&typeof _0x3f2319[_0x87a4('0x25')]===_0x87a4('0x24');var _0x32af5c=_0x53dabb['count'];var _0x203a9d=_0x5c0817?0x0:_0x3f2319[_0x87a4('0x23')];var _0x4a897c=_0x5c0817?_0x53dabb[_0x87a4('0x26')]:_0x3f2319['offset']+_0x3f2319[_0x87a4('0x25')];var _0x4beb61;if(_0x4a897c>=_0x32af5c){_0x4a897c=_0x32af5c;_0x4beb61=0xc8;}else{_0x4beb61=0xce;}_0xafd8fc[_0x87a4('0x21')](_0x4beb61);return _0xafd8fc[_0x87a4('0x27')](_0x87a4('0x28'),_0x203a9d+'-'+_0x4a897c+'/'+_0x32af5c)[_0x87a4('0x22')](_0x53dabb);}return null;};}function patchUpdates(_0x243f8f){return function(_0x3f49f8){try{jsonpatch[_0x87a4('0x29')](_0x3f49f8,_0x243f8f,!![]);}catch(_0x1bd705){return BPromise['reject'](_0x1bd705);}return _0x3f49f8[_0x87a4('0x2a')]();};}function saveUpdates(_0x2011a2,_0x259558){return function(_0x4f74b5){if(_0x4f74b5){return _0x4f74b5[_0x87a4('0x2b')](_0x2011a2)[_0x87a4('0x2c')](function(_0x4af50f){return _0x4af50f;});}return null;};}function removeEntity(_0x2c12a0,_0x357fb6){return function(_0x4c5870){if(_0x4c5870){return _0x4c5870[_0x87a4('0x2d')]()['then'](function(){var _0x5496a8=_0x4c5870[_0x87a4('0x2e')]({'plain':!![]});var _0x5d9fe2=_0x87a4('0x2f');return db[_0x87a4('0x30')][_0x87a4('0x2d')]({'where':{'type':_0x5d9fe2,'resourceId':_0x5496a8['id']}})[_0x87a4('0x2c')](function(){return _0x4c5870;});})[_0x87a4('0x2c')](function(){_0x2c12a0[_0x87a4('0x21')](0xcc)[_0x87a4('0x20')]();});}};}function handleEntityNotFound(_0x2fb183,_0x58984){return function(_0x14a3d3){if(!_0x14a3d3){_0x2fb183[_0x87a4('0x1f')](0x194);}return _0x14a3d3;};}function handleError(_0x38f520,_0x538fb7){_0x538fb7=_0x538fb7||0x1f4;return function(_0x4d0adc){logger[_0x87a4('0x31')](_0x4d0adc[_0x87a4('0x32')]);if(_0x4d0adc[_0x87a4('0x33')]){delete _0x4d0adc[_0x87a4('0x33')];}_0x38f520['status'](_0x538fb7)[_0x87a4('0x34')](_0x4d0adc);};}exports[_0x87a4('0x35')]=function(_0x13626e,_0x26d770){var _0x4c87bb={},_0x45fed9={},_0x4a6801={'count':0x0,'rows':[]};var _0x2aaba0=_[_0x87a4('0x36')](db[_0x87a4('0x37')][_0x87a4('0x38')],function(_0x4d347a){return{'name':_0x4d347a[_0x87a4('0x39')],'type':_0x4d347a['type']['key']};});_0x45fed9[_0x87a4('0x3a')]=_[_0x87a4('0x36')](_0x2aaba0,_0x87a4('0x33'));_0x45fed9[_0x87a4('0x3b')]=_[_0x87a4('0x3c')](_0x13626e[_0x87a4('0x3b')]);_0x45fed9[_0x87a4('0x3d')]=_[_0x87a4('0x3e')](_0x45fed9[_0x87a4('0x3a')],_0x45fed9[_0x87a4('0x3b')]);_0x4c87bb[_0x87a4('0x3f')]=_[_0x87a4('0x3e')](_0x45fed9['model'],qs[_0x87a4('0x40')](_0x13626e[_0x87a4('0x3b')]['fields']));_0x4c87bb[_0x87a4('0x3f')]=_0x4c87bb['attributes'][_0x87a4('0x41')]?_0x4c87bb[_0x87a4('0x3f')]:_0x45fed9['model'];if(!_0x13626e[_0x87a4('0x3b')][_0x87a4('0x42')](_0x87a4('0x43'))){_0x4c87bb[_0x87a4('0x25')]=qs[_0x87a4('0x25')](_0x13626e[_0x87a4('0x3b')][_0x87a4('0x25')]);_0x4c87bb[_0x87a4('0x23')]=qs['offset'](_0x13626e['query'][_0x87a4('0x23')]);}_0x4c87bb[_0x87a4('0x44')]=qs[_0x87a4('0x45')](_0x13626e['query']['sort']);_0x4c87bb['where']=qs[_0x87a4('0x3d')](_['pick'](_0x13626e[_0x87a4('0x3b')],_0x45fed9[_0x87a4('0x3d')]),_0x2aaba0);if(_0x13626e[_0x87a4('0x3b')][_0x87a4('0x46')]){_0x4c87bb[_0x87a4('0x47')]=_[_0x87a4('0x48')](_0x4c87bb['where'],{'$or':_['map'](_0x2aaba0,function(_0x2dd694){if(_0x2dd694[_0x87a4('0x49')]!==_0x87a4('0x4a')){var _0x54ffd3={};_0x54ffd3[_0x2dd694[_0x87a4('0x33')]]={'$like':'%'+_0x13626e[_0x87a4('0x3b')][_0x87a4('0x46')]+'%'};return _0x54ffd3;}})});}_0x4c87bb=_[_0x87a4('0x48')]({},_0x4c87bb,_0x13626e[_0x87a4('0x4b')]);var _0x4875ae={'where':_0x4c87bb[_0x87a4('0x47')]};return db[_0x87a4('0x37')]['count'](_0x4875ae)[_0x87a4('0x2c')](function(_0x4d698a){_0x4a6801[_0x87a4('0x26')]=_0x4d698a;if(_0x13626e[_0x87a4('0x3b')][_0x87a4('0x4c')]){_0x4c87bb['include']=[{'all':!![]}];}return db[_0x87a4('0x37')][_0x87a4('0x4d')](_0x4c87bb);})['then'](function(_0x384db2){_0x4a6801[_0x87a4('0x4e')]=_0x384db2;return _0x4a6801;})[_0x87a4('0x2c')](respondWithFilteredResult(_0x26d770,_0x4c87bb))['catch'](handleError(_0x26d770,null));};exports[_0x87a4('0x4f')]=function(_0x16e02b,_0x156ba5){var _0x42e536={'raw':![],'where':{'id':_0x16e02b[_0x87a4('0x50')]['id']}},_0x37662c={};_0x37662c['model']=_[_0x87a4('0x3c')](db[_0x87a4('0x37')]['rawAttributes']);_0x37662c['query']=_[_0x87a4('0x3c')](_0x16e02b[_0x87a4('0x3b')]);_0x37662c['filters']=_[_0x87a4('0x3e')](_0x37662c[_0x87a4('0x3a')],_0x37662c[_0x87a4('0x3b')]);_0x42e536[_0x87a4('0x3f')]=_[_0x87a4('0x3e')](_0x37662c[_0x87a4('0x3a')],qs[_0x87a4('0x40')](_0x16e02b[_0x87a4('0x3b')][_0x87a4('0x40')]));_0x42e536['attributes']=_0x42e536[_0x87a4('0x3f')][_0x87a4('0x41')]?_0x42e536[_0x87a4('0x3f')]:_0x37662c[_0x87a4('0x3a')];if(_0x16e02b[_0x87a4('0x3b')][_0x87a4('0x4c')]){_0x42e536[_0x87a4('0x51')]=[{'all':!![]}];}_0x42e536=_[_0x87a4('0x48')]({},_0x42e536,_0x16e02b[_0x87a4('0x4b')]);return db['Dashboard'][_0x87a4('0x52')](_0x42e536)[_0x87a4('0x2c')](handleEntityNotFound(_0x156ba5,null))['then'](respondWithResult(_0x156ba5,null))[_0x87a4('0x53')](handleError(_0x156ba5,null));};exports[_0x87a4('0x54')]=function(_0x30d416,_0x57ecaf){return db[_0x87a4('0x37')]['create'](_0x30d416[_0x87a4('0x55')],{})[_0x87a4('0x2c')](function(_0x2ab832){var _0x403ac2=_0x30d416[_0x87a4('0x56')][_0x87a4('0x2e')]({'plain':!![]});if(!_0x403ac2)throw new Error(_0x87a4('0x57'));if(_0x403ac2['role']==='user'){var _0x3b1dbd=_0x2ab832[_0x87a4('0x2e')]({'plain':!![]});var _0x39a273='CustomDashboards';return db[_0x87a4('0x58')][_0x87a4('0x52')]({'where':{'name':_0x39a273,'userProfileId':_0x403ac2[_0x87a4('0x59')]},'raw':!![]})['then'](function(_0x4f8af6){if(_0x4f8af6&&_0x4f8af6[_0x87a4('0x5a')]===0x0){return db[_0x87a4('0x30')][_0x87a4('0x54')]({'name':_0x3b1dbd['name'],'resourceId':_0x3b1dbd['id'],'type':_0x4f8af6['name'],'sectionId':_0x4f8af6['id']},{})['then'](function(){return _0x2ab832;});}else{return _0x2ab832;}})[_0x87a4('0x53')](function(_0x544c0d){logger[_0x87a4('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x544c0d);throw _0x544c0d;});}return _0x2ab832;})[_0x87a4('0x2c')](respondWithResult(_0x57ecaf,0xc9))['catch'](handleError(_0x57ecaf,null));};exports[_0x87a4('0x5b')]=function(_0x397eef,_0x1502e1){var _0x5f33df={'where':{'id':_0x397eef[_0x87a4('0x50')]['id']}},_0x16ed21={};_0x16ed21[_0x87a4('0x3a')]=_[_0x87a4('0x3c')](db[_0x87a4('0x37')][_0x87a4('0x38')]);_0x5f33df[_0x87a4('0x3f')]=_[_0x87a4('0x3e')](_0x16ed21[_0x87a4('0x3a')],qs[_0x87a4('0x40')](_0x397eef[_0x87a4('0x3b')][_0x87a4('0x40')]));_0x5f33df[_0x87a4('0x3f')]=_0x5f33df[_0x87a4('0x3f')][_0x87a4('0x41')]?_0x5f33df[_0x87a4('0x3f')]:_0x16ed21['model'];if(_0x397eef[_0x87a4('0x3b')][_0x87a4('0x4c')]){_0x5f33df['include']=[{'all':!![]}];}_0x5f33df=_[_0x87a4('0x48')]({},_0x5f33df,_0x397eef['options']);return db[_0x87a4('0x37')]['find'](_0x5f33df)[_0x87a4('0x2c')](handleEntityNotFound(_0x1502e1,null))[_0x87a4('0x2c')](function(_0x10c6ca){if(_0x10c6ca){var _0x26963b=_0x10c6ca[_0x87a4('0x2e')]({'plain':!![]});_0x26963b=qs['omit'](_0x26963b,['id',_0x87a4('0x5c'),_0x87a4('0x5d')]);_0x397eef[_0x87a4('0x55')]=_[_0x87a4('0x5e')](_0x397eef['body'],['id',_0x87a4('0x5c'),_0x87a4('0x5d')]);return db[_0x87a4('0x37')][_0x87a4('0x54')](_[_0x87a4('0x48')](_0x26963b,_0x397eef[_0x87a4('0x55')]),{'include':_0x397eef[_0x87a4('0x3b')][_0x87a4('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x2cd978){var _0x4f4862=_0x397eef['user']['get']({'plain':!![]});if(!_0x4f4862)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f4862[_0x87a4('0x5f')]==='user'){var _0x11e045=_0x2cd978[_0x87a4('0x2e')]({'plain':!![]});var _0x20512b=_0x87a4('0x2f');return db[_0x87a4('0x58')][_0x87a4('0x52')]({'where':{'name':_0x20512b,'userProfileId':_0x4f4862['userProfileId']},'raw':!![]})['then'](function(_0x60f261){if(_0x60f261&&_0x60f261['autoAssociation']===0x0){return db[_0x87a4('0x30')][_0x87a4('0x54')]({'name':_0x11e045['name'],'resourceId':_0x11e045['id'],'type':_0x60f261[_0x87a4('0x33')],'sectionId':_0x60f261['id']},{})[_0x87a4('0x2c')](function(){return _0x2cd978;});}else{return _0x2cd978;}})[_0x87a4('0x53')](function(_0x2750ec){logger[_0x87a4('0x31')](_0x87a4('0x60'),_0x2750ec);throw _0x2750ec;});}return _0x2cd978;});}})[_0x87a4('0x2c')](respondWithResult(_0x1502e1,0xc9))[_0x87a4('0x53')](handleError(_0x1502e1,null));};exports['update']=function(_0x552740,_0x220538){if(_0x552740[_0x87a4('0x55')]['id']){delete _0x552740[_0x87a4('0x55')]['id'];}return db[_0x87a4('0x37')][_0x87a4('0x52')]({'where':{'id':_0x552740[_0x87a4('0x50')]['id']}})[_0x87a4('0x2c')](handleEntityNotFound(_0x220538,null))[_0x87a4('0x2c')](saveUpdates(_0x552740[_0x87a4('0x55')],null))[_0x87a4('0x2c')](respondWithResult(_0x220538,null))['catch'](handleError(_0x220538,null));};exports['destroy']=function(_0x4ce158,_0x1d75db){return db[_0x87a4('0x37')][_0x87a4('0x52')]({'where':{'id':_0x4ce158['params']['id']}})[_0x87a4('0x2c')](handleEntityNotFound(_0x1d75db,null))[_0x87a4('0x2c')](removeEntity(_0x1d75db,null))[_0x87a4('0x53')](handleError(_0x1d75db,null));};function widgetAttributes(_0x27a234){try{switch(_0x27a234[_0x87a4('0x49')]){case _0x87a4('0x61'):return[{'name':_0x87a4('0x62'),'value':_0x27a234[_0x87a4('0x62')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x64')]:undefined)||'https://'}];case _0x87a4('0x65'):return[{'name':_0x87a4('0x66'),'value':_0x27a234[_0x87a4('0x66')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x64')]:undefined)||''}];case _0x87a4('0x67'):return[{'name':_0x87a4('0x68'),'value':_0x27a234['attrHourFormat']||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x64')]:undefined)||_0x87a4('0x69')},{'name':_0x87a4('0x6a'),'value':_0x27a234['attrTimezone']||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x1]?_0x27a234[_0x87a4('0x63')][0x1][_0x87a4('0x64')]:undefined)||_0x87a4('0x6b')},{'name':_0x87a4('0x6c'),'value':_0x27a234[_0x87a4('0x6c')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x2]?_0x27a234[_0x87a4('0x63')][0x2][_0x87a4('0x64')]:undefined)||0xc}];case'counter':return[{'name':_0x87a4('0x6d'),'value':_0x27a234[_0x87a4('0x6d')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x64')]:undefined)||'total'},{'name':_0x87a4('0x6e'),'value':_0x27a234[_0x87a4('0x6e')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x1]?_0x27a234[_0x87a4('0x63')][0x1][_0x87a4('0x64')]:undefined)||[]},{'name':_0x87a4('0x6c'),'value':_0x27a234[_0x87a4('0x6c')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x2]?_0x27a234['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x87a4('0x6f'),'value':_0x27a234[_0x87a4('0x6f')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234['attrs'][0x3]?_0x27a234[_0x87a4('0x63')][0x3][_0x87a4('0x64')]:undefined)||'voice'},{'name':_0x87a4('0x70'),'value':_0x27a234[_0x87a4('0x70')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x4]?_0x27a234[_0x87a4('0x63')][0x4][_0x87a4('0x64')]:undefined)||''},{'name':_0x87a4('0x71'),'value':_0x27a234[_0x87a4('0x71')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x5]?_0x27a234[_0x87a4('0x63')][0x5][_0x87a4('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x27a234['attrSmsAccounts']||(_0x27a234['attrs']&&_0x27a234['attrs'][0x6]?_0x27a234[_0x87a4('0x63')][0x6]['value']:undefined)||''},{'name':_0x87a4('0x72'),'value':_0x27a234['attrOpenchannelAccounts']||(_0x27a234['attrs']&&_0x27a234['attrs'][0x7]?_0x27a234[_0x87a4('0x63')][0x7][_0x87a4('0x64')]:undefined)||''},{'name':_0x87a4('0x73'),'value':_0x27a234[_0x87a4('0x73')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234['attrs'][0x8]?_0x27a234[_0x87a4('0x63')][0x8]['value']:undefined)||''},{'name':_0x87a4('0x74'),'value':_0x27a234[_0x87a4('0x74')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234['attrs'][0x9]?_0x27a234[_0x87a4('0x63')][0x9][_0x87a4('0x64')]:undefined)||''}];case'multibar-chart':case _0x87a4('0x75'):return[{'name':_0x87a4('0x76'),'value':_0x27a234['attrSerie1']||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x64')]:undefined)||'total'},{'name':_0x87a4('0x77'),'value':_0x27a234[_0x87a4('0x77')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x1]?_0x27a234[_0x87a4('0x63')][0x1][_0x87a4('0x64')]:undefined)||null},{'name':'attrSerie3','value':_0x27a234[_0x87a4('0x78')]||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x2]?_0x27a234[_0x87a4('0x63')][0x2]['value']:undefined)||null},{'name':_0x87a4('0x6e'),'value':_0x27a234[_0x87a4('0x6e')]||(_0x27a234['attrs']&&_0x27a234['attrs'][0x3]?_0x27a234[_0x87a4('0x63')][0x3][_0x87a4('0x64')]:undefined)||[]},{'name':'attrChannel','value':_0x27a234['attrChannel']||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x4]?_0x27a234['attrs'][0x4][_0x87a4('0x64')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x27a234[_0x87a4('0x70')]||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x5]?_0x27a234[_0x87a4('0x63')][0x5][_0x87a4('0x64')]:undefined)||''},{'name':_0x87a4('0x71'),'value':_0x27a234[_0x87a4('0x71')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x6]?_0x27a234['attrs'][0x6]['value']:undefined)||''},{'name':_0x87a4('0x79'),'value':_0x27a234[_0x87a4('0x79')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234['attrs'][0x7]?_0x27a234[_0x87a4('0x63')][0x7][_0x87a4('0x64')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x27a234[_0x87a4('0x72')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x8]?_0x27a234['attrs'][0x8][_0x87a4('0x64')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x27a234['attrWhatsappAccounts']||(_0x27a234['attrs']&&_0x27a234['attrs'][0x9]?_0x27a234[_0x87a4('0x63')][0x9][_0x87a4('0x64')]:undefined)||''},{'name':_0x87a4('0x74'),'value':_0x27a234[_0x87a4('0x74')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0xa]?_0x27a234[_0x87a4('0x63')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x87a4('0x7a'),'type':_0x27a234['reportType']||(_0x27a234[_0x87a4('0x63')]&&_0x27a234['attrs'][0x0]?_0x27a234[_0x87a4('0x63')][0x0][_0x87a4('0x49')]:undefined)||null,'value':_0x27a234[_0x87a4('0x7a')]||(_0x27a234[_0x87a4('0x63')]&&_0x27a234[_0x87a4('0x63')][0x0]?_0x27a234['attrs'][0x0]['value']:undefined)||null},{'name':_0x87a4('0x7b'),'value':_0x27a234[_0x87a4('0x7b')]||(_0x27a234['attrs']&&_0x27a234[_0x87a4('0x63')][0x1]?_0x27a234[_0x87a4('0x63')][0x1][_0x87a4('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3940e1){logger[_0x87a4('0x31')](_0x87a4('0x7c'),JSON[_0x87a4('0x7d')](_0x3940e1));return[];}}exports[_0x87a4('0x7e')]=function(_0x6cf337,_0x34d546,_0x33880){if(_0x6cf337[_0x87a4('0x55')]['id']){delete _0x6cf337[_0x87a4('0x55')]['id'];}return db[_0x87a4('0x37')][_0x87a4('0x52')]({'where':{'id':_0x6cf337['params']['id']}})[_0x87a4('0x2c')](handleEntityNotFound(_0x34d546,null))[_0x87a4('0x2c')](function(_0x2ca940){if(_0x2ca940){_0x6cf337[_0x87a4('0x55')]['DashboardId']=_0x2ca940['id'];_0x6cf337['body']['attrs']=widgetAttributes(_0x6cf337['body']);return db[_0x87a4('0x7f')][_0x87a4('0x54')](_0x6cf337['body']);}})[_0x87a4('0x2c')](respondWithResult(_0x34d546,null))['catch'](handleError(_0x34d546,null));};exports[_0x87a4('0x80')]=function(_0x3f67e8,_0x41a60e,_0x33bdea){var _0x5a8738={};var _0x1eb930={};var _0x186a0c;var _0x38c407;return db[_0x87a4('0x37')][_0x87a4('0x81')]({'where':{'id':_0x3f67e8[_0x87a4('0x50')]['id']}})['then'](handleEntityNotFound(_0x41a60e,null))['then'](function(_0x16782b){if(_0x16782b){_0x186a0c=_0x16782b;_0x1eb930[_0x87a4('0x3a')]=_[_0x87a4('0x3c')](db[_0x87a4('0x7f')][_0x87a4('0x38')]);_0x1eb930[_0x87a4('0x3b')]=_['keys'](_0x3f67e8[_0x87a4('0x3b')]);_0x1eb930[_0x87a4('0x3d')]=_[_0x87a4('0x3e')](_0x1eb930[_0x87a4('0x3a')],_0x1eb930[_0x87a4('0x3b')]);_0x5a8738['attributes']=_['intersection'](_0x1eb930['model'],qs['fields'](_0x3f67e8[_0x87a4('0x3b')][_0x87a4('0x40')]));_0x5a8738[_0x87a4('0x3f')]=_0x5a8738[_0x87a4('0x3f')][_0x87a4('0x41')]?_0x5a8738[_0x87a4('0x3f')]:_0x1eb930[_0x87a4('0x3a')];_0x5a8738[_0x87a4('0x44')]=qs[_0x87a4('0x45')](_0x3f67e8['query'][_0x87a4('0x45')]);_0x5a8738[_0x87a4('0x47')]=qs[_0x87a4('0x3d')](_['pick'](_0x3f67e8[_0x87a4('0x3b')],_0x1eb930[_0x87a4('0x3d')]));if(_0x3f67e8[_0x87a4('0x3b')][_0x87a4('0x46')]){_0x5a8738['where']=_[_0x87a4('0x48')](_0x5a8738['where'],{'$or':_[_0x87a4('0x36')](_0x5a8738['attributes'],function(_0x12698e){var _0x1d9bb5={};_0x1d9bb5[_0x12698e]={'$like':'%'+_0x3f67e8['query'][_0x87a4('0x46')]+'%'};return _0x1d9bb5;})});}_0x5a8738=_['merge']({},_0x5a8738,_0x3f67e8[_0x87a4('0x4b')]);return _0x186a0c[_0x87a4('0x80')](_0x5a8738);}})[_0x87a4('0x2c')](function(_0x587d87){if(_0x587d87){_0x38c407=_0x587d87[_0x87a4('0x41')];if(!_0x3f67e8[_0x87a4('0x3b')][_0x87a4('0x42')](_0x87a4('0x43'))){_0x5a8738['limit']=qs['limit'](_0x3f67e8['query'][_0x87a4('0x25')]);_0x5a8738['offset']=qs[_0x87a4('0x23')](_0x3f67e8[_0x87a4('0x3b')][_0x87a4('0x23')]);}return _0x186a0c['getItems'](_0x5a8738);}})[_0x87a4('0x2c')](function(_0x46823a){if(_0x46823a){return _0x46823a?{'count':_0x38c407,'rows':_0x46823a}:null;}})[_0x87a4('0x2c')](respondWithResult(_0x41a60e,null))[_0x87a4('0x53')](handleError(_0x41a60e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 374f5d9..44713f7 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 _0xb515=['events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb515,0x1c2));var _0x5b51=function(_0x3be0c4,_0x5b7eff){_0x3be0c4=_0x3be0c4-0x0;var _0x11af9f=_0xb515[_0x3be0c4];return _0x11af9f;};'use strict';var EventEmitter=require(_0x5b51('0x0'));var Dashboard=require(_0x5b51('0x1'))['db'][_0x5b51('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5b51('0x3')](0x0);var events={'afterCreate':_0x5b51('0x4'),'afterUpdate':'update','afterDestroy':_0x5b51('0x5')};function emitEvent(_0x4ac5e7){return function(_0x4c9cd0,_0x4965aa,_0x51e4be){DashboardEvents[_0x5b51('0x6')](_0x4ac5e7+':'+_0x4c9cd0['id'],_0x4c9cd0);DashboardEvents[_0x5b51('0x6')](_0x4ac5e7,_0x4c9cd0);_0x51e4be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x5b51('0x7')](e,emitEvent(event));}}module[_0x5b51('0x8')]=DashboardEvents; \ No newline at end of file +var _0x64e4=['remove','emit','hook','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x64e4,0x135));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x464e('0x0'));var Dashboard=require(_0x464e('0x1'))['db'][_0x464e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x464e('0x3')](0x0);var events={'afterCreate':_0x464e('0x4'),'afterUpdate':_0x464e('0x5'),'afterDestroy':_0x464e('0x6')};function emitEvent(_0x2de21f){return function(_0x360556,_0x69acc0,_0x53993c){DashboardEvents[_0x464e('0x7')](_0x2de21f+':'+_0x360556['id'],_0x360556);DashboardEvents['emit'](_0x2de21f,_0x360556);_0x53993c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x464e('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2e4b1a4..dc642f5 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 _0xc205=['./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1c76ad,_0x1ed941){var _0xb4af57=function(_0x490752){while(--_0x490752){_0x1c76ad['push'](_0x1c76ad['shift']());}};_0xb4af57(++_0x1ed941);}(_0xc205,0x19c));var _0x5c20=function(_0x31d181,_0x4ea766){_0x31d181=_0x31d181-0x0;var _0x1d52d9=_0xc205[_0x31d181];return _0x1d52d9;};'use strict';var _=require(_0x5c20('0x0'));var util=require(_0x5c20('0x1'));var logger=require(_0x5c20('0x2'))(_0x5c20('0x3'));var moment=require('moment');var BPromise=require(_0x5c20('0x4'));var rp=require(_0x5c20('0x5'));var fs=require('fs');var path=require(_0x5c20('0x6'));var rimraf=require(_0x5c20('0x7'));var config=require('../../config/environment');var attributes=require(_0x5c20('0x8'));module[_0x5c20('0x9')]=function(_0x30193c,_0x2485c3){return _0x30193c[_0x5c20('0xa')]('Dashboard',attributes,{'tableName':_0x5c20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1943=['rimraf','./dashboard.attributes','define','Dashboard','lodash','util','api','bluebird','path'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1943,0x148));var _0x3194=function(_0x3b166b,_0x2c8ba1){_0x3b166b=_0x3b166b-0x0;var _0x579602=_0x1943[_0x3b166b];return _0x579602;};'use strict';var _=require(_0x3194('0x0'));var util=require(_0x3194('0x1'));var logger=require('../../config/logger')(_0x3194('0x2'));var moment=require('moment');var BPromise=require(_0x3194('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3194('0x4'));var rimraf=require(_0x3194('0x5'));var config=require('../../config/environment');var attributes=require(_0x3194('0x6'));module['exports']=function(_0x1785a6,_0x54dc60){return _0x1785a6[_0x3194('0x7')](_0x3194('0x8'),attributes,{'tableName':'dashboards','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 f7f0cc8..3c3f4c0 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 _0xa26a=['./dashboard.socket','request','then','info','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x58eb1d,_0x35f3e){var _0x29b806=function(_0x2b8b9d){while(--_0x2b8b9d){_0x58eb1d['push'](_0x58eb1d['shift']());}};_0x29b806(++_0x35f3e);}(_0xa26a,0x151));var _0xaa26=function(_0x485518,_0x2bbd51){_0x485518=_0x485518-0x0;var _0x2cd9b7=_0xa26a[_0x485518];return _0x2cd9b7;};'use strict';var _=require(_0xaa26('0x0'));var util=require(_0xaa26('0x1'));var moment=require(_0xaa26('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa26('0x3'));var fs=require('fs');var Redis=require(_0xaa26('0x4'));var db=require(_0xaa26('0x5'))['db'];var utils=require(_0xaa26('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa26('0x7'));var jayson=require(_0xaa26('0x8'));var client=jayson['client'][_0xaa26('0x9')]({'port':0x232a});config[_0xaa26('0xa')]=_[_0xaa26('0xb')](config[_0xaa26('0xa')],{'host':_0xaa26('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa26('0xd'))['register'](socket);function respondWithRpcPromise(_0x4429f0,_0x945d41,_0x3c4512){return new BPromise(function(_0x41843b,_0x31f3d6){return client[_0xaa26('0xe')](_0x4429f0,_0x3c4512)[_0xaa26('0xf')](function(_0x4a29ee){logger[_0xaa26('0x10')]('Dashboard,\x20%s,\x20%s',_0x945d41,_0xaa26('0x11'));logger[_0xaa26('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x945d41,_0xaa26('0x11'),JSON[_0xaa26('0x13')](_0x4a29ee));if(_0x4a29ee[_0xaa26('0x14')]){if(_0x4a29ee['error'][_0xaa26('0x15')]===0x1f4){logger[_0xaa26('0x14')](_0xaa26('0x16'),_0x945d41,_0x4a29ee['error'][_0xaa26('0x17')]);return _0x31f3d6(_0x4a29ee[_0xaa26('0x14')]['message']);}logger[_0xaa26('0x14')](_0xaa26('0x16'),_0x945d41,_0x4a29ee[_0xaa26('0x14')][_0xaa26('0x17')]);return _0x41843b(_0x4a29ee['error']['message']);}else{logger[_0xaa26('0x10')]('Dashboard,\x20%s,\x20%s',_0x945d41,_0xaa26('0x11'));_0x41843b(_0x4a29ee[_0xaa26('0x18')][_0xaa26('0x17')]);}})['catch'](function(_0x527b23){logger[_0xaa26('0x14')](_0xaa26('0x16'),_0x945d41,_0x527b23);_0x31f3d6(_0x527b23);});});} \ No newline at end of file +var _0xd0ae=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xd0ae,0x160));var _0xed0a=function(_0x53caf1,_0x138c7b){_0x53caf1=_0x53caf1-0x0;var _0x1c6c9d=_0xd0ae[_0x53caf1];return _0x1c6c9d;};'use strict';var _=require(_0xed0a('0x0'));var util=require(_0xed0a('0x1'));var moment=require('moment');var BPromise=require(_0xed0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed0a('0x3'));var db=require(_0xed0a('0x4'))['db'];var utils=require(_0xed0a('0x5'));var logger=require(_0xed0a('0x6'))(_0xed0a('0x7'));var config=require('../../config/environment');var jayson=require(_0xed0a('0x8'));var client=jayson[_0xed0a('0x9')][_0xed0a('0xa')]({'port':0x232a});config[_0xed0a('0xb')]=_[_0xed0a('0xc')](config[_0xed0a('0xb')],{'host':_0xed0a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed0a('0xb')]));require(_0xed0a('0xe'))[_0xed0a('0xf')](socket);function respondWithRpcPromise(_0x1cc372,_0x15de2e,_0x586667){return new BPromise(function(_0x1f34f1,_0x2852aa){return client[_0xed0a('0x10')](_0x1cc372,_0x586667)['then'](function(_0x4aca1f){logger[_0xed0a('0x11')](_0xed0a('0x12'),_0x15de2e,_0xed0a('0x13'));logger[_0xed0a('0x14')](_0xed0a('0x15'),_0x15de2e,_0xed0a('0x13'),JSON[_0xed0a('0x16')](_0x4aca1f));if(_0x4aca1f[_0xed0a('0x17')]){if(_0x4aca1f[_0xed0a('0x17')][_0xed0a('0x18')]===0x1f4){logger[_0xed0a('0x17')](_0xed0a('0x12'),_0x15de2e,_0x4aca1f['error'][_0xed0a('0x19')]);return _0x2852aa(_0x4aca1f['error'][_0xed0a('0x19')]);}logger[_0xed0a('0x17')](_0xed0a('0x12'),_0x15de2e,_0x4aca1f[_0xed0a('0x17')]['message']);return _0x1f34f1(_0x4aca1f[_0xed0a('0x17')][_0xed0a('0x19')]);}else{logger[_0xed0a('0x11')]('Dashboard,\x20%s,\x20%s',_0x15de2e,_0xed0a('0x13'));_0x1f34f1(_0x4aca1f[_0xed0a('0x1a')]['message']);}})['catch'](function(_0x6f23cd){logger[_0xed0a('0x17')](_0xed0a('0x12'),_0x15de2e,_0x6f23cd);_0x2852aa(_0x6f23cd);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3f59410..a596f2a 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 _0xc39b=['length','dashboard:','./dashboard.events','save','update','emit','register'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0xc39b,0xc6));var _0xbc39=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc39b[_0x82129b];return _0x2ae5dc;};'use strict';var DashboardEvents=require(_0xbc39('0x0'));var events=[_0xbc39('0x1'),'remove',_0xbc39('0x2')];function createListener(_0x14f160,_0x5c4434){return function(_0x5e2b8b){_0x5c4434[_0xbc39('0x3')](_0x14f160,_0x5e2b8b);};}function removeListener(_0x5bf14b,_0x23c36f){return function(){DashboardEvents['removeListener'](_0x5bf14b,_0x23c36f);};}exports[_0xbc39('0x4')]=function(_0x2fc6ae){for(var _0x1f5984=0x0,_0x67ecc5=events[_0xbc39('0x5')];_0x1f5984<_0x67ecc5;_0x1f5984++){var _0x137019=events[_0x1f5984];var _0x25dd9d=createListener(_0xbc39('0x6')+_0x137019,_0x2fc6ae);DashboardEvents['on'](_0x137019,_0x25dd9d);}}; \ No newline at end of file +var _0xa8b3=['update','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0xc1e22,_0x53a0ca){var _0x272280=function(_0x1ae709){while(--_0x1ae709){_0xc1e22['push'](_0xc1e22['shift']());}};_0x272280(++_0x53a0ca);}(_0xa8b3,0xd5));var _0x3a8b=function(_0x25f9dc,_0x36c8e1){_0x25f9dc=_0x25f9dc-0x0;var _0x4213ec=_0xa8b3[_0x25f9dc];return _0x4213ec;};'use strict';var DashboardEvents=require(_0x3a8b('0x0'));var events=[_0x3a8b('0x1'),_0x3a8b('0x2'),_0x3a8b('0x3')];function createListener(_0x1dd14d,_0x50a26b){return function(_0x51f2b1){_0x50a26b['emit'](_0x1dd14d,_0x51f2b1);};}function removeListener(_0x4a1f1e,_0xd24e0d){return function(){DashboardEvents[_0x3a8b('0x4')](_0x4a1f1e,_0xd24e0d);};}exports[_0x3a8b('0x5')]=function(_0x2a5530){for(var _0x53a57e=0x0,_0xa4be98=events[_0x3a8b('0x6')];_0x53a57e<_0xa4be98;_0x53a57e++){var _0x48498e=events[_0x53a57e];var _0x5f4c7a=createListener(_0x3a8b('0x7')+_0x48498e,_0x2a5530);DashboardEvents['on'](_0x48498e,_0x5f4c7a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6aecf1d..d66bd95 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 _0x45cb=['create','clone','addItem','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','getItems','post'];(function(_0x7fcd17,_0x9f66f8){var _0x2db383=function(_0x4e7fac){while(--_0x4e7fac){_0x7fcd17['push'](_0x7fcd17['shift']());}};_0x2db383(++_0x9f66f8);}(_0x45cb,0xb8));var _0xb45c=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x45cb[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0xb45c('0x0'));var util=require(_0xb45c('0x1'));var path=require(_0xb45c('0x2'));var timeout=require(_0xb45c('0x3'));var express=require(_0xb45c('0x4'));var router=express[_0xb45c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb45c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb45c('0x7'));var controller=require(_0xb45c('0x8'));router[_0xb45c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb45c('0x9')]('/:id',auth[_0xb45c('0xa')](),controller[_0xb45c('0xb')]);router[_0xb45c('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0xb45c('0xc')]);router[_0xb45c('0xd')]('/',auth[_0xb45c('0xa')](),controller[_0xb45c('0xe')]);router[_0xb45c('0xd')]('/:id/clone',auth[_0xb45c('0xa')](),controller[_0xb45c('0xf')]);router[_0xb45c('0xd')]('/:id/items',auth[_0xb45c('0xa')](),controller[_0xb45c('0x10')]);router[_0xb45c('0x11')]('/:id',auth[_0xb45c('0xa')](),controller[_0xb45c('0x12')]);router[_0xb45c('0x13')](_0xb45c('0x14'),auth[_0xb45c('0xa')](),controller['destroy']);module[_0xb45c('0x15')]=router; \ No newline at end of file +var _0x7d8a=['isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x23b677,_0x16cbff){var _0x3936c0=function(_0x5034d3){while(--_0x5034d3){_0x23b677['push'](_0x23b677['shift']());}};_0x3936c0(++_0x16cbff);}(_0x7d8a,0xbf));var _0xa7d8=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7d8a[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var path=require(_0xa7d8('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7d8('0x3'));var router=express['Router']();var fs_extra=require(_0xa7d8('0x4'));var auth=require(_0xa7d8('0x5'));var interaction=require(_0xa7d8('0x6'));var config=require(_0xa7d8('0x7'));var controller=require(_0xa7d8('0x8'));router['get']('/',auth[_0xa7d8('0x9')](),controller[_0xa7d8('0xa')]);router[_0xa7d8('0xb')](_0xa7d8('0xc'),auth['isAuthenticated'](),controller[_0xa7d8('0xd')]);router[_0xa7d8('0xb')](_0xa7d8('0xe'),auth['isAuthenticated'](),controller[_0xa7d8('0xf')]);router[_0xa7d8('0x10')]('/',auth[_0xa7d8('0x9')](),controller['create']);router[_0xa7d8('0x10')](_0xa7d8('0x11'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x12')]);router[_0xa7d8('0x10')]('/:id/items',auth['isAuthenticated'](),controller[_0xa7d8('0x13')]);router[_0xa7d8('0x14')](_0xa7d8('0xc'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x15')]);router[_0xa7d8('0x16')](_0xa7d8('0xc'),auth[_0xa7d8('0x9')](),controller[_0xa7d8('0x17')]);module[_0xa7d8('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 04cc1b3..190f692 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 _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x3b634e,_0x563ebb){var _0x5ac7fa=function(_0x2dd747){while(--_0x2dd747){_0x3b634e['push'](_0x3b634e['shift']());}};_0x5ac7fa(++_0x563ebb);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5527d3,_0x2add5e){_0x5527d3=_0x5527d3-0x0;var _0x48f1ac=_0xc1c6[_0x5527d3];return _0x48f1ac;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5496,0x175));var _0x6549=function(_0x169b95,_0x461309){_0x169b95=_0x169b95-0x0;var _0x51811a=_0x5496[_0x169b95];return _0x51811a;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a2d2a34..a8e1037 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 _0x33ac=['stringify','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2e0d1f,_0x211fa2){_0x2e0d1f=_0x2e0d1f-0x0;var _0x41e39b=_0x33ac[_0x2e0d1f];return _0x41e39b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc33a('0x1'));var moment=require(_0xc33a('0x2'));var BPromise=require(_0xc33a('0x3'));var Mustache=require(_0xc33a('0x4'));var util=require(_0xc33a('0x5'));var path=require(_0xc33a('0x6'));var sox=require(_0xc33a('0x7'));var csv=require(_0xc33a('0x8'));var ejs=require(_0xc33a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc33a('0xa'));var crypto=require(_0xc33a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc33a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc33a('0xd'));var Papa=require(_0xc33a('0xe'));var Redis=require(_0xc33a('0xf'));var authService=require(_0xc33a('0x10'));var qs=require(_0xc33a('0x11'));var as=require(_0xc33a('0x12'));var hardwareService=require(_0xc33a('0x13'));var logger=require(_0xc33a('0x14'))(_0xc33a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc33a('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc33a('0x17')](config[_0xc33a('0x18')],{'host':_0xc33a('0x19'),'port':0x18eb});var socket=require(_0xc33a('0x1a'))(new Redis(config[_0xc33a('0x18')]));require(_0xc33a('0x1b'))['register'](socket);function respondWithStatusCode(_0x2737cd,_0x794d54){_0x794d54=_0x794d54||0xcc;return function(_0x14ccbf){if(_0x14ccbf){return _0x2737cd['sendStatus'](_0x794d54);}return _0x2737cd[_0xc33a('0x1c')](_0x794d54)['end']();};}function respondWithResult(_0x6d5b1,_0x3e1646){_0x3e1646=_0x3e1646||0xc8;return function(_0x236280){if(_0x236280){return _0x6d5b1[_0xc33a('0x1c')](_0x3e1646)[_0xc33a('0x1d')](_0x236280);}};}function respondWithFilteredResult(_0x4fa7d0,_0x480e34){return function(_0x40d736){if(_0x40d736){var _0x35d888=typeof _0x480e34[_0xc33a('0x1e')]===_0xc33a('0x1f')&&typeof _0x480e34[_0xc33a('0x20')]===_0xc33a('0x1f');var _0x3ee9cf=_0x40d736[_0xc33a('0x21')];var _0x5693e5=_0x35d888?0x0:_0x480e34[_0xc33a('0x1e')];var _0x1dd735=_0x35d888?_0x40d736[_0xc33a('0x21')]:_0x480e34[_0xc33a('0x1e')]+_0x480e34['limit'];var _0x17d70e;if(_0x1dd735>=_0x3ee9cf){_0x1dd735=_0x3ee9cf;_0x17d70e=0xc8;}else{_0x17d70e=0xce;}_0x4fa7d0[_0xc33a('0x1c')](_0x17d70e);return _0x4fa7d0['set'](_0xc33a('0x22'),_0x5693e5+'-'+_0x1dd735+'/'+_0x3ee9cf)[_0xc33a('0x1d')](_0x40d736);}return null;};}function patchUpdates(_0x3b7aba){return function(_0x22bd74){try{jsonpatch[_0xc33a('0x23')](_0x22bd74,_0x3b7aba,!![]);}catch(_0xd16dc5){return BPromise[_0xc33a('0x24')](_0xd16dc5);}return _0x22bd74[_0xc33a('0x25')]();};}function saveUpdates(_0x1481a0,_0x3cd050){return function(_0x1f829a){if(_0x1f829a){return _0x1f829a[_0xc33a('0x26')](_0x1481a0)[_0xc33a('0x27')](function(_0x37b32d){return _0x37b32d;});}return null;};}function removeEntity(_0x29d3d3,_0x3d3c3b){return function(_0x118ab3){if(_0x118ab3){return _0x118ab3[_0xc33a('0x28')]()[_0xc33a('0x27')](function(){_0x29d3d3['status'](0xcc)[_0xc33a('0x29')]();});}};}function handleEntityNotFound(_0x18d77d,_0x429f9b){return function(_0x4d62be){if(!_0x4d62be){_0x18d77d[_0xc33a('0x2a')](0x194);}return _0x4d62be;};}function handleError(_0x163f2a,_0x1745a4){_0x1745a4=_0x1745a4||0x1f4;return function(_0x2a1cc8){logger[_0xc33a('0x2b')](_0x2a1cc8[_0xc33a('0x2c')]);if(_0x2a1cc8['name']){delete _0x2a1cc8[_0xc33a('0x2d')];}_0x163f2a[_0xc33a('0x1c')](_0x1745a4)[_0xc33a('0x2e')](_0x2a1cc8);};}exports['show']=function(_0x4c0e6e,_0x301762){var _0xcaf599={'raw':![],'where':{'id':_0x4c0e6e[_0xc33a('0x2f')]['id']}},_0x25667b={};_0x25667b[_0xc33a('0x30')]=_[_0xc33a('0x31')](db[_0xc33a('0x32')][_0xc33a('0x33')]);_0x25667b[_0xc33a('0x34')]=_['keys'](_0x4c0e6e['query']);_0x25667b['filters']=_[_0xc33a('0x35')](_0x25667b[_0xc33a('0x30')],_0x25667b[_0xc33a('0x34')]);_0xcaf599[_0xc33a('0x36')]=_[_0xc33a('0x35')](_0x25667b[_0xc33a('0x30')],qs['fields'](_0x4c0e6e[_0xc33a('0x34')][_0xc33a('0x37')]));_0xcaf599[_0xc33a('0x36')]=_0xcaf599[_0xc33a('0x36')][_0xc33a('0x38')]?_0xcaf599[_0xc33a('0x36')]:_0x25667b[_0xc33a('0x30')];if(_0x4c0e6e[_0xc33a('0x34')][_0xc33a('0x39')]){_0xcaf599[_0xc33a('0x3a')]=[{'all':!![]}];}_0xcaf599=_[_0xc33a('0x3b')]({},_0xcaf599,_0x4c0e6e[_0xc33a('0x3c')]);return db['DashboardItem'][_0xc33a('0x3d')](_0xcaf599)['then'](handleEntityNotFound(_0x301762,null))['then'](respondWithResult(_0x301762,null))[_0xc33a('0x3e')](handleError(_0x301762,null));};exports['destroy']=function(_0xef555d,_0x43b21e){return db[_0xc33a('0x32')][_0xc33a('0x3d')]({'where':{'id':_0xef555d[_0xc33a('0x2f')]['id']}})[_0xc33a('0x27')](handleEntityNotFound(_0x43b21e,null))['then'](removeEntity(_0x43b21e,null))[_0xc33a('0x3e')](handleError(_0x43b21e,null));};function widgetAttributes(_0x5a2fa4){try{switch(_0x5a2fa4[_0xc33a('0x3f')]){case _0xc33a('0x40'):return[{'name':_0xc33a('0x41'),'value':_0x5a2fa4[_0xc33a('0x41')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x0]?_0x5a2fa4[_0xc33a('0x42')][0x0][_0xc33a('0x43')]:undefined)||_0xc33a('0x44')}];case _0xc33a('0x45'):return[{'name':'attrPath','value':_0x5a2fa4[_0xc33a('0x46')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x0]?_0x5a2fa4['attrs'][0x0][_0xc33a('0x43')]:undefined)||''}];case _0xc33a('0x47'):return[{'name':_0xc33a('0x48'),'value':_0x5a2fa4[_0xc33a('0x48')]||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x0]?_0x5a2fa4['attrs'][0x0]['value']:undefined)||_0xc33a('0x49')},{'name':_0xc33a('0x4a'),'value':_0x5a2fa4[_0xc33a('0x4a')]||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x1]?_0x5a2fa4[_0xc33a('0x42')][0x1][_0xc33a('0x43')]:undefined)||_0xc33a('0x4b')},{'name':_0xc33a('0x4c'),'value':_0x5a2fa4[_0xc33a('0x4c')]||(_0x5a2fa4['attrs']&&_0x5a2fa4['attrs'][0x2]?_0x5a2fa4[_0xc33a('0x42')][0x2][_0xc33a('0x43')]:undefined)||0xc}];case _0xc33a('0x4d'):return[{'name':_0xc33a('0x4e'),'value':_0x5a2fa4[_0xc33a('0x4e')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x0]?_0x5a2fa4[_0xc33a('0x42')][0x0][_0xc33a('0x43')]:undefined)||'total'},{'name':_0xc33a('0x4f'),'value':_0x5a2fa4['attrVoiceQueues']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x1]?_0x5a2fa4[_0xc33a('0x42')][0x1][_0xc33a('0x43')]:undefined)||[]},{'name':_0xc33a('0x4c'),'value':_0x5a2fa4[_0xc33a('0x4c')]||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x2]?_0x5a2fa4[_0xc33a('0x42')][0x2][_0xc33a('0x43')]:undefined)||0x14},{'name':_0xc33a('0x50'),'value':_0x5a2fa4[_0xc33a('0x50')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x3]?_0x5a2fa4[_0xc33a('0x42')][0x3][_0xc33a('0x43')]:undefined)||_0xc33a('0x51')},{'name':'attrEmailAccounts','value':_0x5a2fa4[_0xc33a('0x52')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x4]?_0x5a2fa4[_0xc33a('0x42')][0x4][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x53'),'value':_0x5a2fa4[_0xc33a('0x53')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x5]?_0x5a2fa4['attrs'][0x5][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x54'),'value':_0x5a2fa4['attrSmsAccounts']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x6]?_0x5a2fa4[_0xc33a('0x42')][0x6][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x55'),'value':_0x5a2fa4[_0xc33a('0x55')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x7]?_0x5a2fa4[_0xc33a('0x42')][0x7][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x56'),'value':_0x5a2fa4['attrWhatsappAccounts']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x8]?_0x5a2fa4[_0xc33a('0x42')][0x8][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x57'),'value':_0x5a2fa4['attrChatWebsites']||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x9]?_0x5a2fa4[_0xc33a('0x42')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xc33a('0x58'):return[{'name':_0xc33a('0x59'),'value':_0x5a2fa4[_0xc33a('0x59')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x0]?_0x5a2fa4[_0xc33a('0x42')][0x0][_0xc33a('0x43')]:undefined)||_0xc33a('0x5a')},{'name':_0xc33a('0x5b'),'value':_0x5a2fa4[_0xc33a('0x5b')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x1]?_0x5a2fa4[_0xc33a('0x42')][0x1][_0xc33a('0x43')]:undefined)||null},{'name':_0xc33a('0x5c'),'value':_0x5a2fa4[_0xc33a('0x5c')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4['attrs'][0x2]?_0x5a2fa4[_0xc33a('0x42')][0x2][_0xc33a('0x43')]:undefined)||null},{'name':_0xc33a('0x4f'),'value':_0x5a2fa4[_0xc33a('0x4f')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x3]?_0x5a2fa4[_0xc33a('0x42')][0x3][_0xc33a('0x43')]:undefined)||[]},{'name':_0xc33a('0x50'),'value':_0x5a2fa4[_0xc33a('0x50')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4['attrs'][0x4]?_0x5a2fa4[_0xc33a('0x42')][0x4][_0xc33a('0x43')]:undefined)||_0xc33a('0x51')},{'name':_0xc33a('0x52'),'value':_0x5a2fa4['attrEmailAccounts']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x5]?_0x5a2fa4[_0xc33a('0x42')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5a2fa4[_0xc33a('0x53')]||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x6]?_0x5a2fa4[_0xc33a('0x42')][0x6]['value']:undefined)||''},{'name':_0xc33a('0x54'),'value':_0x5a2fa4[_0xc33a('0x54')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x7]?_0x5a2fa4[_0xc33a('0x42')][0x7][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x55'),'value':_0x5a2fa4[_0xc33a('0x55')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x8]?_0x5a2fa4[_0xc33a('0x42')][0x8][_0xc33a('0x43')]:undefined)||''},{'name':_0xc33a('0x56'),'value':_0x5a2fa4[_0xc33a('0x56')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0x9]?_0x5a2fa4[_0xc33a('0x42')][0x9]['value']:undefined)||''},{'name':_0xc33a('0x57'),'value':_0x5a2fa4['attrChatWebsites']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4[_0xc33a('0x42')][0xa]?_0x5a2fa4[_0xc33a('0x42')][0xa][_0xc33a('0x43')]:undefined)||''}];case'web-report':return[{'name':_0xc33a('0x5d'),'type':_0x5a2fa4['reportType']||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4['attrs'][0x0]?_0x5a2fa4[_0xc33a('0x42')][0x0][_0xc33a('0x3f')]:undefined)||null,'value':_0x5a2fa4[_0xc33a('0x5d')]||(_0x5a2fa4[_0xc33a('0x42')]&&_0x5a2fa4['attrs'][0x0]?_0x5a2fa4['attrs'][0x0]['value']:undefined)||null},{'name':_0xc33a('0x5e'),'value':_0x5a2fa4[_0xc33a('0x5e')]||(_0x5a2fa4['attrs']&&_0x5a2fa4[_0xc33a('0x42')][0x1]?_0x5a2fa4[_0xc33a('0x42')][0x1][_0xc33a('0x43')]:undefined)||0x0}];default:return[];}}catch(_0xa323a1){logger[_0xc33a('0x2b')](_0xc33a('0x5f'),JSON[_0xc33a('0x60')](_0xa323a1));return[];}}exports[_0xc33a('0x61')]=function(_0x1cc3bb,_0x47d06a){if(_0x1cc3bb[_0xc33a('0x62')]){_0x1cc3bb[_0xc33a('0x62')][_0xc33a('0x42')]=widgetAttributes(_0x1cc3bb[_0xc33a('0x62')]);}return db[_0xc33a('0x32')][_0xc33a('0x61')](_0x1cc3bb['body'],{})[_0xc33a('0x27')](respondWithResult(_0x47d06a,0xc9))[_0xc33a('0x3e')](handleError(_0x47d06a,null));};exports['update']=function(_0x29b977,_0x50e6bf){if(_0x29b977[_0xc33a('0x62')]['id']){delete _0x29b977[_0xc33a('0x62')]['id'];}_0x29b977[_0xc33a('0x62')]['attrs']=widgetAttributes(_0x29b977[_0xc33a('0x62')]);return db[_0xc33a('0x32')][_0xc33a('0x3d')]({'where':{'id':_0x29b977[_0xc33a('0x2f')]['id']}})[_0xc33a('0x27')](handleEntityNotFound(_0x50e6bf,null))['then'](saveUpdates(_0x29b977[_0xc33a('0x62')],null))[_0xc33a('0x27')](respondWithResult(_0x50e6bf,null))[_0xc33a('0x3e')](handleError(_0x50e6bf,null));}; \ No newline at end of file +var _0x539d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','params','model','keys','DashboardItem','query','intersection','attributes','fields','length','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x205328,_0x12c15a){var _0x4a30eb=function(_0x226d48){while(--_0x226d48){_0x205328['push'](_0x205328['shift']());}};_0x4a30eb(++_0x12c15a);}(_0x539d,0x17b));var _0xd539=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x539d[_0xab9f3d];return _0x5283bf;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd539('0x1'));var jsonpatch=require(_0xd539('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd539('0x3'));var Mustache=require(_0xd539('0x4'));var util=require(_0xd539('0x5'));var path=require(_0xd539('0x6'));var sox=require(_0xd539('0x7'));var csv=require('to-csv');var ejs=require(_0xd539('0x8'));var fs=require('fs');var fs_extra=require(_0xd539('0x9'));var _=require(_0xd539('0xa'));var squel=require(_0xd539('0xb'));var crypto=require(_0xd539('0xc'));var jsforce=require(_0xd539('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd539('0xe'));var querystring=require(_0xd539('0xf'));var Papa=require(_0xd539('0x10'));var Redis=require(_0xd539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd539('0x12'));var hardwareService=require(_0xd539('0x13'));var logger=require(_0xd539('0x14'))(_0xd539('0x15'));var utils=require(_0xd539('0x16'));var config=require(_0xd539('0x17'));var licenseUtil=require(_0xd539('0x18'));var db=require(_0xd539('0x19'))['db'];config['redis']=_[_0xd539('0x1a')](config[_0xd539('0x1b')],{'host':_0xd539('0x1c'),'port':0x18eb});var socket=require(_0xd539('0x1d'))(new Redis(config[_0xd539('0x1b')]));require(_0xd539('0x1e'))['register'](socket);function respondWithStatusCode(_0x278f49,_0x6ef028){_0x6ef028=_0x6ef028||0xcc;return function(_0x1fbb31){if(_0x1fbb31){return _0x278f49[_0xd539('0x1f')](_0x6ef028);}return _0x278f49[_0xd539('0x20')](_0x6ef028)[_0xd539('0x21')]();};}function respondWithResult(_0x30aea1,_0xe32f19){_0xe32f19=_0xe32f19||0xc8;return function(_0x30414e){if(_0x30414e){return _0x30aea1[_0xd539('0x20')](_0xe32f19)[_0xd539('0x22')](_0x30414e);}};}function respondWithFilteredResult(_0x54d8ff,_0x363035){return function(_0x41fb1e){if(_0x41fb1e){var _0x6d6bbe=typeof _0x363035[_0xd539('0x23')]===_0xd539('0x24')&&typeof _0x363035[_0xd539('0x25')]===_0xd539('0x24');var _0x1714cf=_0x41fb1e['count'];var _0x4ce589=_0x6d6bbe?0x0:_0x363035[_0xd539('0x23')];var _0x360ceb=_0x6d6bbe?_0x41fb1e[_0xd539('0x26')]:_0x363035[_0xd539('0x23')]+_0x363035['limit'];var _0x91917b;if(_0x360ceb>=_0x1714cf){_0x360ceb=_0x1714cf;_0x91917b=0xc8;}else{_0x91917b=0xce;}_0x54d8ff[_0xd539('0x20')](_0x91917b);return _0x54d8ff[_0xd539('0x27')](_0xd539('0x28'),_0x4ce589+'-'+_0x360ceb+'/'+_0x1714cf)[_0xd539('0x22')](_0x41fb1e);}return null;};}function patchUpdates(_0x13445e){return function(_0x38985c){try{jsonpatch[_0xd539('0x29')](_0x38985c,_0x13445e,!![]);}catch(_0x349610){return BPromise['reject'](_0x349610);}return _0x38985c[_0xd539('0x2a')]();};}function saveUpdates(_0x57789d,_0x3563f1){return function(_0x584642){if(_0x584642){return _0x584642['update'](_0x57789d)[_0xd539('0x2b')](function(_0xfd3352){return _0xfd3352;});}return null;};}function removeEntity(_0x1280c2,_0xc1789e){return function(_0x4e6152){if(_0x4e6152){return _0x4e6152[_0xd539('0x2c')]()['then'](function(){_0x1280c2[_0xd539('0x20')](0xcc)[_0xd539('0x21')]();});}};}function handleEntityNotFound(_0x247898,_0x86c2c2){return function(_0x5a9d68){if(!_0x5a9d68){_0x247898['sendStatus'](0x194);}return _0x5a9d68;};}function handleError(_0x24f94c,_0x40720f){_0x40720f=_0x40720f||0x1f4;return function(_0x4f717b){logger['error'](_0x4f717b['stack']);if(_0x4f717b[_0xd539('0x2d')]){delete _0x4f717b[_0xd539('0x2d')];}_0x24f94c[_0xd539('0x20')](_0x40720f)[_0xd539('0x2e')](_0x4f717b);};}exports['show']=function(_0x430840,_0x2662fe){var _0x516806={'raw':![],'where':{'id':_0x430840[_0xd539('0x2f')]['id']}},_0x1b0c81={};_0x1b0c81[_0xd539('0x30')]=_[_0xd539('0x31')](db[_0xd539('0x32')]['rawAttributes']);_0x1b0c81[_0xd539('0x33')]=_['keys'](_0x430840[_0xd539('0x33')]);_0x1b0c81['filters']=_[_0xd539('0x34')](_0x1b0c81['model'],_0x1b0c81[_0xd539('0x33')]);_0x516806[_0xd539('0x35')]=_[_0xd539('0x34')](_0x1b0c81[_0xd539('0x30')],qs[_0xd539('0x36')](_0x430840[_0xd539('0x33')][_0xd539('0x36')]));_0x516806[_0xd539('0x35')]=_0x516806[_0xd539('0x35')][_0xd539('0x37')]?_0x516806[_0xd539('0x35')]:_0x1b0c81['model'];if(_0x430840[_0xd539('0x33')]['includeAll']){_0x516806[_0xd539('0x38')]=[{'all':!![]}];}_0x516806=_[_0xd539('0x39')]({},_0x516806,_0x430840['options']);return db[_0xd539('0x32')][_0xd539('0x3a')](_0x516806)['then'](handleEntityNotFound(_0x2662fe,null))['then'](respondWithResult(_0x2662fe,null))[_0xd539('0x3b')](handleError(_0x2662fe,null));};exports[_0xd539('0x2c')]=function(_0x42fbbd,_0x243b38){return db['DashboardItem'][_0xd539('0x3a')]({'where':{'id':_0x42fbbd[_0xd539('0x2f')]['id']}})[_0xd539('0x2b')](handleEntityNotFound(_0x243b38,null))[_0xd539('0x2b')](removeEntity(_0x243b38,null))['catch'](handleError(_0x243b38,null));};function widgetAttributes(_0x443832){try{switch(_0x443832[_0xd539('0x3c')]){case _0xd539('0x3d'):return[{'name':_0xd539('0x3e'),'value':_0x443832[_0xd539('0x3e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x0]?_0x443832['attrs'][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x41')}];case _0xd539('0x42'):return[{'name':_0xd539('0x43'),'value':_0x443832['attrPath']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0]['value']:undefined)||''}];case _0xd539('0x44'):return[{'name':'attrHourFormat','value':_0x443832[_0xd539('0x45')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832['attrs'][0x0]['value']:undefined)||_0xd539('0x46')},{'name':_0xd539('0x47'),'value':_0x443832[_0xd539('0x47')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832[_0xd539('0x3f')][0x1]['value']:undefined)||_0xd539('0x48')},{'name':_0xd539('0x49'),'value':_0x443832[_0xd539('0x49')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x2]?_0x443832['attrs'][0x2]['value']:undefined)||0xc}];case _0xd539('0x4a'):return[{'name':_0xd539('0x4b'),'value':_0x443832[_0xd539('0x4b')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x0]?_0x443832[_0xd539('0x3f')][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x4c')},{'name':_0xd539('0x4d'),'value':_0x443832['attrVoiceQueues']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832['attrs'][0x1][_0xd539('0x40')]:undefined)||[]},{'name':_0xd539('0x49'),'value':_0x443832[_0xd539('0x49')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x2]?_0x443832[_0xd539('0x3f')][0x2][_0xd539('0x40')]:undefined)||0x14},{'name':_0xd539('0x4e'),'value':_0x443832[_0xd539('0x4e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x3]?_0x443832[_0xd539('0x3f')][0x3][_0xd539('0x40')]:undefined)||_0xd539('0x4f')},{'name':_0xd539('0x50'),'value':_0x443832['attrEmailAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x4]?_0x443832[_0xd539('0x3f')][0x4][_0xd539('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x443832[_0xd539('0x51')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x5]?_0x443832[_0xd539('0x3f')][0x5][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x52'),'value':_0x443832[_0xd539('0x52')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x6]?_0x443832[_0xd539('0x3f')][0x6][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x53'),'value':_0x443832[_0xd539('0x53')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x7]?_0x443832[_0xd539('0x3f')][0x7][_0xd539('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x443832['attrWhatsappAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x8]?_0x443832['attrs'][0x8][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x54'),'value':_0x443832[_0xd539('0x54')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x9]?_0x443832[_0xd539('0x3f')][0x9][_0xd539('0x40')]:undefined)||''}];case _0xd539('0x55'):case _0xd539('0x56'):return[{'name':'attrSerie1','value':_0x443832[_0xd539('0x57')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832['attrs'][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x4c')},{'name':_0xd539('0x58'),'value':_0x443832[_0xd539('0x58')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832[_0xd539('0x3f')][0x1][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x59'),'value':_0x443832[_0xd539('0x59')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x2]?_0x443832[_0xd539('0x3f')][0x2][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x4d'),'value':_0x443832['attrVoiceQueues']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x3]?_0x443832['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x443832[_0xd539('0x4e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x4]?_0x443832[_0xd539('0x3f')][0x4]['value']:undefined)||_0xd539('0x4f')},{'name':_0xd539('0x50'),'value':_0x443832['attrEmailAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x5]?_0x443832[_0xd539('0x3f')][0x5]['value']:undefined)||''},{'name':_0xd539('0x51'),'value':_0x443832[_0xd539('0x51')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x6]?_0x443832[_0xd539('0x3f')][0x6][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x52'),'value':_0x443832['attrSmsAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x7]?_0x443832[_0xd539('0x3f')][0x7][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x53'),'value':_0x443832[_0xd539('0x53')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x8]?_0x443832[_0xd539('0x3f')][0x8][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x5a'),'value':_0x443832[_0xd539('0x5a')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x9]?_0x443832[_0xd539('0x3f')][0x9][_0xd539('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x443832[_0xd539('0x54')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0xa]?_0x443832[_0xd539('0x3f')][0xa][_0xd539('0x40')]:undefined)||''}];case _0xd539('0x5b'):return[{'name':_0xd539('0x5c'),'type':_0x443832[_0xd539('0x5d')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0]['type']:undefined)||null,'value':_0x443832['attrReport']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x5e'),'value':_0x443832[_0xd539('0x5e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x1]?_0x443832[_0xd539('0x3f')][0x1][_0xd539('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1a9d6b){logger[_0xd539('0x5f')](_0xd539('0x60'),JSON['stringify'](_0x1a9d6b));return[];}}exports[_0xd539('0x61')]=function(_0x5d2a2f,_0x558c16){if(_0x5d2a2f['body']){_0x5d2a2f[_0xd539('0x62')][_0xd539('0x3f')]=widgetAttributes(_0x5d2a2f[_0xd539('0x62')]);}return db[_0xd539('0x32')][_0xd539('0x61')](_0x5d2a2f[_0xd539('0x62')],{})['then'](respondWithResult(_0x558c16,0xc9))['catch'](handleError(_0x558c16,null));};exports[_0xd539('0x63')]=function(_0x47c90d,_0x4a66cf){if(_0x47c90d['body']['id']){delete _0x47c90d[_0xd539('0x62')]['id'];}_0x47c90d['body']['attrs']=widgetAttributes(_0x47c90d[_0xd539('0x62')]);return db[_0xd539('0x32')][_0xd539('0x3a')]({'where':{'id':_0x47c90d['params']['id']}})[_0xd539('0x2b')](handleEntityNotFound(_0x4a66cf,null))[_0xd539('0x2b')](saveUpdates(_0x47c90d[_0xd539('0x62')],null))[_0xd539('0x2b')](respondWithResult(_0x4a66cf,null))[_0xd539('0x3b')](handleError(_0x4a66cf,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 5c40840..b347b4b 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 _0x4d11=['../../mysqldb','DashboardItem','save','update','hasOwnProperty','exports','events'];(function(_0x4e3d47,_0x32ca58){var _0x328dc9=function(_0x3640bf){while(--_0x3640bf){_0x4e3d47['push'](_0x4e3d47['shift']());}};_0x328dc9(++_0x32ca58);}(_0x4d11,0xc3));var _0x14d1=function(_0x276c8d,_0x437fa6){_0x276c8d=_0x276c8d-0x0;var _0x51c99f=_0x4d11[_0x276c8d];return _0x51c99f;};'use strict';var EventEmitter=require(_0x14d1('0x0'));var DashboardItem=require(_0x14d1('0x1'))['db'][_0x14d1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x14d1('0x3'),'afterUpdate':_0x14d1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x7ac8e2){return function(_0x1792a1,_0x1f5924,_0x2445e7){DashboardItemEvents['emit'](_0x7ac8e2+':'+_0x1792a1['id'],_0x1792a1);DashboardItemEvents['emit'](_0x7ac8e2,_0x1792a1);_0x2445e7(null);};}for(var e in events){if(events[_0x14d1('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x14d1('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x3b52=['events','../../mysqldb','DashboardItem','setMaxListeners','save','emit','hook','exports'];(function(_0x398fb4,_0x1242c5){var _0x3d7f87=function(_0x32d968){while(--_0x32d968){_0x398fb4['push'](_0x398fb4['shift']());}};_0x3d7f87(++_0x1242c5);}(_0x3b52,0x78));var _0x23b5=function(_0x526db6,_0x29fe04){_0x526db6=_0x526db6-0x0;var _0x7f5065=_0x3b52[_0x526db6];return _0x7f5065;};'use strict';var EventEmitter=require(_0x23b5('0x0'));var DashboardItem=require(_0x23b5('0x1'))['db'][_0x23b5('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x23b5('0x3')](0x0);var events={'afterCreate':_0x23b5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e49ca){return function(_0x7b3449,_0x2fb84e,_0x2f6197){DashboardItemEvents[_0x23b5('0x5')](_0x4e49ca+':'+_0x7b3449['id'],_0x7b3449);DashboardItemEvents['emit'](_0x4e49ca,_0x7b3449);_0x2f6197(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x23b5('0x6')](e,emitEvent(event));}}module[_0x23b5('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 342ac0a..79f3a65 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 _0xf44c=['DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x13f849,_0x4fecb1){var _0xfb2f18=function(_0x3873d3){while(--_0x3873d3){_0x13f849['push'](_0x13f849['shift']());}};_0xfb2f18(++_0x4fecb1);}(_0xf44c,0x1c9));var _0xcf44=function(_0x4e56eb,_0xe6fd79){_0x4e56eb=_0x4e56eb-0x0;var _0x3c8092=_0xf44c[_0x4e56eb];return _0x3c8092;};'use strict';var _=require(_0xcf44('0x0'));var util=require(_0xcf44('0x1'));var logger=require(_0xcf44('0x2'))(_0xcf44('0x3'));var moment=require('moment');var BPromise=require(_0xcf44('0x4'));var rp=require(_0xcf44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf44('0x6'));var config=require(_0xcf44('0x7'));var attributes=require(_0xcf44('0x8'));module[_0xcf44('0x9')]=function(_0x125b64,_0xb1e39d){return _0x125b64[_0xcf44('0xa')](_0xcf44('0xb'),attributes,{'tableName':_0xcf44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6782=['../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x4f1225,_0x13fe83){var _0xa5c0b=function(_0x523141){while(--_0x523141){_0x4f1225['push'](_0x4f1225['shift']());}};_0xa5c0b(++_0x13fe83);}(_0x6782,0x1f1));var _0x2678=function(_0x101d10,_0x4c2657){_0x101d10=_0x101d10-0x0;var _0x33b6ad=_0x6782[_0x101d10];return _0x33b6ad;};'use strict';var _=require(_0x2678('0x0'));var util=require(_0x2678('0x1'));var logger=require(_0x2678('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2678('0x3'));var rp=require(_0x2678('0x4'));var fs=require('fs');var path=require(_0x2678('0x5'));var rimraf=require(_0x2678('0x6'));var config=require(_0x2678('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x2678('0x8')]=function(_0xcdec8c,_0x479b1b){return _0xcdec8c[_0x2678('0x9')](_0x2678('0xa'),attributes,{'tableName':_0x2678('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 baf275e..2a4b4d0 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 _0x0f53=['message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x571f2e,_0x53f476){var _0x540a52=function(_0x455ea3){while(--_0x455ea3){_0x571f2e['push'](_0x571f2e['shift']());}};_0x540a52(++_0x53f476);}(_0x0f53,0x10b));var _0x30f5=function(_0xedd3fc,_0x26b377){_0xedd3fc=_0xedd3fc-0x0;var _0x8d0712=_0x0f53[_0xedd3fc];return _0x8d0712;};'use strict';var _=require('lodash');var util=require(_0x30f5('0x0'));var moment=require(_0x30f5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30f5('0x2'))['db'];var utils=require(_0x30f5('0x3'));var logger=require(_0x30f5('0x4'))(_0x30f5('0x5'));var config=require(_0x30f5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30f5('0x7')]({'port':0x232a});config[_0x30f5('0x8')]=_[_0x30f5('0x9')](config[_0x30f5('0x8')],{'host':_0x30f5('0xa'),'port':0x18eb});var socket=require(_0x30f5('0xb'))(new Redis(config[_0x30f5('0x8')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x87aab5,_0x1a671d,_0x6dfbbf){return new BPromise(function(_0x18d4b3,_0x4de30f){return client[_0x30f5('0xc')](_0x87aab5,_0x6dfbbf)['then'](function(_0x412258){logger[_0x30f5('0xd')](_0x30f5('0xe'),_0x1a671d,_0x30f5('0xf'));logger[_0x30f5('0x10')](_0x30f5('0x11'),_0x1a671d,_0x30f5('0xf'),JSON[_0x30f5('0x12')](_0x412258));if(_0x412258[_0x30f5('0x13')]){if(_0x412258[_0x30f5('0x13')][_0x30f5('0x14')]===0x1f4){logger[_0x30f5('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1a671d,_0x412258['error'][_0x30f5('0x15')]);return _0x4de30f(_0x412258[_0x30f5('0x13')][_0x30f5('0x15')]);}logger['error'](_0x30f5('0xe'),_0x1a671d,_0x412258[_0x30f5('0x13')]['message']);return _0x18d4b3(_0x412258[_0x30f5('0x13')][_0x30f5('0x15')]);}else{logger[_0x30f5('0xd')](_0x30f5('0xe'),_0x1a671d,_0x30f5('0xf'));_0x18d4b3(_0x412258[_0x30f5('0x16')][_0x30f5('0x15')]);}})[_0x30f5('0x17')](function(_0x5452a9){logger['error'](_0x30f5('0xe'),_0x1a671d,_0x5452a9);_0x4de30f(_0x5452a9);});});} \ No newline at end of file +var _0x62b9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','./dashboardItem.socket','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x199b64,_0x5d1120){var _0x42b220=function(_0x26d4e6){while(--_0x26d4e6){_0x199b64['push'](_0x199b64['shift']());}};_0x42b220(++_0x5d1120);}(_0x62b9,0x1e6));var _0x962b=function(_0x1429a2,_0x1312bf){_0x1429a2=_0x1429a2-0x0;var _0x46eaf1=_0x62b9[_0x1429a2];return _0x46eaf1;};'use strict';var _=require(_0x962b('0x0'));var util=require(_0x962b('0x1'));var moment=require(_0x962b('0x2'));var BPromise=require(_0x962b('0x3'));var rs=require(_0x962b('0x4'));var fs=require('fs');var Redis=require(_0x962b('0x5'));var db=require(_0x962b('0x6'))['db'];var utils=require(_0x962b('0x7'));var logger=require(_0x962b('0x8'))('rpc');var config=require(_0x962b('0x9'));var jayson=require(_0x962b('0xa'));var client=jayson[_0x962b('0xb')]['http']({'port':0x232a});config['redis']=_[_0x962b('0xc')](config['redis'],{'host':_0x962b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x962b('0xe'))['register'](socket);function respondWithRpcPromise(_0x151c6c,_0xfa413f,_0xafd595){return new BPromise(function(_0x420d93,_0x54de6b){return client[_0x962b('0xf')](_0x151c6c,_0xafd595)['then'](function(_0x453d6c){logger[_0x962b('0x10')](_0x962b('0x11'),_0xfa413f,_0x962b('0x12'));logger[_0x962b('0x13')](_0x962b('0x14'),_0xfa413f,_0x962b('0x12'),JSON[_0x962b('0x15')](_0x453d6c));if(_0x453d6c['error']){if(_0x453d6c[_0x962b('0x16')][_0x962b('0x17')]===0x1f4){logger[_0x962b('0x16')]('DashboardItem,\x20%s,\x20%s',_0xfa413f,_0x453d6c[_0x962b('0x16')][_0x962b('0x18')]);return _0x54de6b(_0x453d6c[_0x962b('0x16')][_0x962b('0x18')]);}logger[_0x962b('0x16')]('DashboardItem,\x20%s,\x20%s',_0xfa413f,_0x453d6c[_0x962b('0x16')][_0x962b('0x18')]);return _0x420d93(_0x453d6c[_0x962b('0x16')][_0x962b('0x18')]);}else{logger[_0x962b('0x10')](_0x962b('0x11'),_0xfa413f,_0x962b('0x12'));_0x420d93(_0x453d6c[_0x962b('0x19')][_0x962b('0x18')]);}})[_0x962b('0x1a')](function(_0xe932fc){logger[_0x962b('0x16')](_0x962b('0x11'),_0xfa413f,_0xe932fc);_0x54de6b(_0xe932fc);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b75343d..b9f8fa9 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 _0x4cb0=['length','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x472d6f,_0x4d598d){var _0x26b18b=function(_0x2de4ee){while(--_0x2de4ee){_0x472d6f['push'](_0x472d6f['shift']());}};_0x26b18b(++_0x4d598d);}(_0x4cb0,0x1d1));var _0x04cb=function(_0x199667,_0x1375f4){_0x199667=_0x199667-0x0;var _0x189869=_0x4cb0[_0x199667];return _0x189869;};'use strict';var DashboardItemEvents=require(_0x04cb('0x0'));var events=[_0x04cb('0x1'),_0x04cb('0x2'),_0x04cb('0x3')];function createListener(_0x233105,_0x315ef2){return function(_0x38d14b){_0x315ef2[_0x04cb('0x4')](_0x233105,_0x38d14b);};}function removeListener(_0x2e5188,_0x5d893d){return function(){DashboardItemEvents[_0x04cb('0x5')](_0x2e5188,_0x5d893d);};}exports[_0x04cb('0x6')]=function(_0x1dec53){for(var _0x17f526=0x0,_0xdbbb04=events[_0x04cb('0x7')];_0x17f526<_0xdbbb04;_0x17f526++){var _0x4010a3=events[_0x17f526];var _0x4679f6=createListener('dashboardItem:'+_0x4010a3,_0x1dec53);DashboardItemEvents['on'](_0x4010a3,_0x4679f6);}}; \ No newline at end of file +var _0x2cba=['update','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x2cba,0xa6));var _0xa2cb=function(_0xf41b94,_0x49cb28){_0xf41b94=_0xf41b94-0x0;var _0x1339bd=_0x2cba[_0xf41b94];return _0x1339bd;};'use strict';var DashboardItemEvents=require(_0xa2cb('0x0'));var events=['save',_0xa2cb('0x1'),_0xa2cb('0x2')];function createListener(_0x59dd37,_0x1d7c33){return function(_0x2fa91d){_0x1d7c33['emit'](_0x59dd37,_0x2fa91d);};}function removeListener(_0x2019de,_0x2ab42b){return function(){DashboardItemEvents[_0xa2cb('0x3')](_0x2019de,_0x2ab42b);};}exports[_0xa2cb('0x4')]=function(_0x5219d4){for(var _0x4226d2=0x0,_0x2cc2cb=events[_0xa2cb('0x5')];_0x4226d2<_0x2cc2cb;_0x4226d2++){var _0x580a4e=events[_0x4226d2];var _0x2170f2=createListener(_0xa2cb('0x6')+_0x580a4e,_0x5219d4);DashboardItemEvents['on'](_0x580a4e,_0x2170f2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 99692a4..118c609 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 _0x52c6=['./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x573ea2,_0x1517e4){var _0x2dc6ab=function(_0x49a03d){while(--_0x49a03d){_0x573ea2['push'](_0x573ea2['shift']());}};_0x2dc6ab(++_0x1517e4);}(_0x52c6,0xa3));var _0x652c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x52c6[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x652c('0x0'));var util=require('util');var path=require(_0x652c('0x1'));var timeout=require(_0x652c('0x2'));var express=require('express');var router=express[_0x652c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x652c('0x4'));var interaction=require(_0x652c('0x5'));var config=require(_0x652c('0x6'));var controller=require(_0x652c('0x7'));router[_0x652c('0x8')](_0x652c('0x9'),auth[_0x652c('0xa')](),controller['show']);router[_0x652c('0xb')]('/',auth[_0x652c('0xa')](),controller[_0x652c('0xc')]);router[_0x652c('0xd')](_0x652c('0x9'),auth[_0x652c('0xa')](),controller[_0x652c('0xe')]);router[_0x652c('0xf')](_0x652c('0x9'),auth['isAuthenticated'](),controller[_0x652c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2c2f=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports'];(function(_0x4c3bd1,_0x559e59){var _0x238b95=function(_0x8fcb66){while(--_0x8fcb66){_0x4c3bd1['push'](_0x4c3bd1['shift']());}};_0x238b95(++_0x559e59);}(_0x2c2f,0x85));var _0xf2c2=function(_0x497537,_0xea98a6){_0x497537=_0x497537-0x0;var _0x1f1401=_0x2c2f[_0x497537];return _0x1f1401;};'use strict';var multer=require(_0xf2c2('0x0'));var util=require('util');var path=require(_0xf2c2('0x1'));var timeout=require(_0xf2c2('0x2'));var express=require(_0xf2c2('0x3'));var router=express[_0xf2c2('0x4')]();var fs_extra=require(_0xf2c2('0x5'));var auth=require(_0xf2c2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf2c2('0x7'));var controller=require(_0xf2c2('0x8'));router[_0xf2c2('0x9')](_0xf2c2('0xa'),auth['isAuthenticated'](),controller[_0xf2c2('0xb')]);router[_0xf2c2('0xc')]('/',auth[_0xf2c2('0xd')](),controller[_0xf2c2('0xe')]);router['put'](_0xf2c2('0xa'),auth['isAuthenticated'](),controller[_0xf2c2('0xf')]);router[_0xf2c2('0x10')](_0xf2c2('0xa'),auth[_0xf2c2('0xd')](),controller[_0xf2c2('0x11')]);module[_0xf2c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ed65f37..cc26812 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 _0xa667=['STRING','sequelize','ENUM','first','second','third'];(function(_0x34f90c,_0x52f433){var _0x153613=function(_0x177685){while(--_0x177685){_0x34f90c['push'](_0x34f90c['shift']());}};_0x153613(++_0x52f433);}(_0xa667,0x17b));var _0x7a66=function(_0x11c847,_0x2142d7){_0x11c847=_0x11c847-0x0;var _0x1e8dbf=_0xa667[_0x11c847];return _0x1e8dbf;};'use strict';var Sequelize=require(_0x7a66('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x7a66('0x1')](_0x7a66('0x2'),_0x7a66('0x3'),_0x7a66('0x4')),'allowNull':![],'defaultValue':_0x7a66('0x2')},'description':{'type':Sequelize[_0x7a66('0x5')]}}; \ No newline at end of file +var _0x4074=['second','third','sequelize','STRING','first'];(function(_0x1ba766,_0x45100d){var _0x176013=function(_0x5104b6){while(--_0x5104b6){_0x1ba766['push'](_0x1ba766['shift']());}};_0x176013(++_0x45100d);}(_0x4074,0x129));var _0x4407=function(_0x55336c,_0x33aa57){_0x55336c=_0x55336c-0x0;var _0x3cb9eb=_0x4074[_0x55336c];return _0x3cb9eb;};'use strict';var Sequelize=require(_0x4407('0x0'));module['exports']={'name':{'type':Sequelize[_0x4407('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4407('0x2'),_0x4407('0x3'),_0x4407('0x4')),'allowNull':![],'defaultValue':_0x4407('0x2')},'description':{'type':Sequelize[_0x4407('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 62155bd..9acc7eb 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 _0x74d4=['options','Disposition','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','get','Dispositions','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x74d4,0x112));var _0x474d=function(_0xb581e7,_0xd8d5d0){_0xb581e7=_0xb581e7-0x0;var _0x434268=_0x74d4[_0xb581e7];return _0x434268;};'use strict';var emlformat=require(_0x474d('0x0'));var rimraf=require(_0x474d('0x1'));var zipdir=require(_0x474d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x474d('0x3'));var moment=require('moment');var BPromise=require(_0x474d('0x4'));var Mustache=require('mustache');var util=require(_0x474d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x474d('0x6'));var ejs=require(_0x474d('0x7'));var fs=require('fs');var fs_extra=require(_0x474d('0x8'));var _=require(_0x474d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x474d('0xa'));var deskjs=require(_0x474d('0xb'));var toCsv=require(_0x474d('0x6'));var querystring=require('querystring');var Papa=require(_0x474d('0xc'));var Redis=require(_0x474d('0xd'));var authService=require(_0x474d('0xe'));var qs=require(_0x474d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x474d('0x10'));var logger=require(_0x474d('0x11'))('api');var utils=require(_0x474d('0x12'));var config=require(_0x474d('0x13'));var licenseUtil=require(_0x474d('0x14'));var db=require(_0x474d('0x15'))['db'];function respondWithStatusCode(_0x2ea131,_0x244254){_0x244254=_0x244254||0xcc;return function(_0x3f3ce0){if(_0x3f3ce0){return _0x2ea131['sendStatus'](_0x244254);}return _0x2ea131[_0x474d('0x16')](_0x244254)[_0x474d('0x17')]();};}function respondWithResult(_0x257d22,_0x486d46){_0x486d46=_0x486d46||0xc8;return function(_0x490542){if(_0x490542){return _0x257d22['status'](_0x486d46)[_0x474d('0x18')](_0x490542);}};}function respondWithFilteredResult(_0x5d6ea5,_0x10d90b){return function(_0x3a0eb4){if(_0x3a0eb4){var _0x49e9cf=typeof _0x10d90b['offset']==='undefined'&&typeof _0x10d90b[_0x474d('0x19')]===_0x474d('0x1a');var _0x5e4eea=_0x3a0eb4[_0x474d('0x1b')];var _0x1ba4ac=_0x49e9cf?0x0:_0x10d90b[_0x474d('0x1c')];var _0x3655ee=_0x49e9cf?_0x3a0eb4[_0x474d('0x1b')]:_0x10d90b['offset']+_0x10d90b[_0x474d('0x19')];var _0x25e3f8;if(_0x3655ee>=_0x5e4eea){_0x3655ee=_0x5e4eea;_0x25e3f8=0xc8;}else{_0x25e3f8=0xce;}_0x5d6ea5['status'](_0x25e3f8);return _0x5d6ea5[_0x474d('0x1d')](_0x474d('0x1e'),_0x1ba4ac+'-'+_0x3655ee+'/'+_0x5e4eea)[_0x474d('0x18')](_0x3a0eb4);}return null;};}function patchUpdates(_0x15eb1c){return function(_0x9a3f14){try{jsonpatch[_0x474d('0x1f')](_0x9a3f14,_0x15eb1c,!![]);}catch(_0x5cfd34){return BPromise[_0x474d('0x20')](_0x5cfd34);}return _0x9a3f14[_0x474d('0x21')]();};}function saveUpdates(_0x16a4b6,_0x2bc9ed){return function(_0x6e8b2f){if(_0x6e8b2f){return _0x6e8b2f[_0x474d('0x22')](_0x16a4b6)['then'](function(_0x15e3cd){return _0x15e3cd;});}return null;};}function removeEntity(_0x579309,_0x362984){return function(_0x52e007){if(_0x52e007){return _0x52e007['destroy']()[_0x474d('0x23')](function(){var _0x48349f=_0x52e007[_0x474d('0x24')]({'plain':!![]});var _0x4af5a6=_0x474d('0x25');return db['UserProfileResource'][_0x474d('0x26')]({'where':{'type':_0x4af5a6,'resourceId':_0x48349f['id']}})[_0x474d('0x23')](function(){return _0x52e007;});})['then'](function(){_0x579309[_0x474d('0x16')](0xcc)[_0x474d('0x17')]();});}};}function handleEntityNotFound(_0x164e45,_0x555257){return function(_0x3fbbaf){if(!_0x3fbbaf){_0x164e45[_0x474d('0x27')](0x194);}return _0x3fbbaf;};}function handleError(_0x4fe2da,_0x3dbb84){_0x3dbb84=_0x3dbb84||0x1f4;return function(_0x763361){logger['error'](_0x763361[_0x474d('0x28')]);if(_0x763361['name']){delete _0x763361[_0x474d('0x29')];}_0x4fe2da[_0x474d('0x16')](_0x3dbb84)[_0x474d('0x2a')](_0x763361);};}exports[_0x474d('0x2b')]=function(_0x33c0df,_0x334295){var _0x401318={},_0x5f0b15={},_0x4190cc={'count':0x0,'rows':[]};var _0x13dbce=_[_0x474d('0x2c')](db['Disposition'][_0x474d('0x2d')],function(_0x2db915){return{'name':_0x2db915[_0x474d('0x2e')],'type':_0x2db915[_0x474d('0x2f')][_0x474d('0x30')]};});_0x5f0b15['model']=_[_0x474d('0x2c')](_0x13dbce,_0x474d('0x29'));_0x5f0b15[_0x474d('0x31')]=_[_0x474d('0x32')](_0x33c0df[_0x474d('0x31')]);_0x5f0b15[_0x474d('0x33')]=_[_0x474d('0x34')](_0x5f0b15['model'],_0x5f0b15[_0x474d('0x31')]);_0x401318['attributes']=_[_0x474d('0x34')](_0x5f0b15[_0x474d('0x35')],qs[_0x474d('0x36')](_0x33c0df[_0x474d('0x31')][_0x474d('0x36')]));_0x401318[_0x474d('0x37')]=_0x401318[_0x474d('0x37')][_0x474d('0x38')]?_0x401318['attributes']:_0x5f0b15['model'];if(!_0x33c0df['query'][_0x474d('0x39')](_0x474d('0x3a'))){_0x401318[_0x474d('0x19')]=qs['limit'](_0x33c0df[_0x474d('0x31')][_0x474d('0x19')]);_0x401318[_0x474d('0x1c')]=qs[_0x474d('0x1c')](_0x33c0df[_0x474d('0x31')][_0x474d('0x1c')]);}_0x401318[_0x474d('0x3b')]=qs[_0x474d('0x3c')](_0x33c0df['query'][_0x474d('0x3c')]);_0x401318[_0x474d('0x3d')]=qs[_0x474d('0x33')](_[_0x474d('0x3e')](_0x33c0df[_0x474d('0x31')],_0x5f0b15['filters']),_0x13dbce);if(_0x33c0df[_0x474d('0x31')][_0x474d('0x3f')]){_0x401318[_0x474d('0x3d')]=_[_0x474d('0x40')](_0x401318['where'],{'$or':_['map'](_0x13dbce,function(_0x2c0203){if(_0x2c0203['type']!==_0x474d('0x41')){var _0x57646f={};_0x57646f[_0x2c0203[_0x474d('0x29')]]={'$like':'%'+_0x33c0df[_0x474d('0x31')][_0x474d('0x3f')]+'%'};return _0x57646f;}})});}_0x401318=_[_0x474d('0x40')]({},_0x401318,_0x33c0df[_0x474d('0x42')]);var _0x26d0e2={'where':_0x401318['where']};return db[_0x474d('0x43')][_0x474d('0x1b')](_0x26d0e2)['then'](function(_0x5a5d91){_0x4190cc[_0x474d('0x1b')]=_0x5a5d91;if(_0x33c0df[_0x474d('0x31')][_0x474d('0x44')]){_0x401318[_0x474d('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x474d('0x46')](_0x401318);})[_0x474d('0x23')](function(_0x1c04d2){_0x4190cc[_0x474d('0x47')]=_0x1c04d2;return _0x4190cc;})[_0x474d('0x23')](respondWithFilteredResult(_0x334295,_0x401318))[_0x474d('0x48')](handleError(_0x334295,null));};exports[_0x474d('0x49')]=function(_0x57fb93,_0x27370d){var _0x3f6929={'raw':!![],'where':{'id':_0x57fb93['params']['id']}},_0x767c95={};_0x767c95['model']=_['keys'](db[_0x474d('0x43')][_0x474d('0x2d')]);_0x767c95[_0x474d('0x31')]=_[_0x474d('0x32')](_0x57fb93[_0x474d('0x31')]);_0x767c95[_0x474d('0x33')]=_[_0x474d('0x34')](_0x767c95[_0x474d('0x35')],_0x767c95['query']);_0x3f6929['attributes']=_[_0x474d('0x34')](_0x767c95['model'],qs[_0x474d('0x36')](_0x57fb93['query'][_0x474d('0x36')]));_0x3f6929[_0x474d('0x37')]=_0x3f6929[_0x474d('0x37')][_0x474d('0x38')]?_0x3f6929[_0x474d('0x37')]:_0x767c95['model'];if(_0x57fb93[_0x474d('0x31')][_0x474d('0x44')]){_0x3f6929[_0x474d('0x45')]=[{'all':!![]}];}_0x3f6929=_[_0x474d('0x40')]({},_0x3f6929,_0x57fb93[_0x474d('0x42')]);return db['Disposition'][_0x474d('0x4a')](_0x3f6929)['then'](handleEntityNotFound(_0x27370d,null))[_0x474d('0x23')](respondWithResult(_0x27370d,null))['catch'](handleError(_0x27370d,null));};exports[_0x474d('0x4b')]=function(_0xa1e4a,_0xca5f6b){return db[_0x474d('0x43')][_0x474d('0x4b')](_0xa1e4a['body'],{})['then'](function(_0x3a6783){var _0x2a922c=_0xa1e4a[_0x474d('0x4c')]['get']({'plain':!![]});if(!_0x2a922c)throw new Error(_0x474d('0x4d'));if(_0x2a922c[_0x474d('0x4e')]===_0x474d('0x4c')){var _0x15be73=_0x3a6783[_0x474d('0x24')]({'plain':!![]});var _0x3f4413=_0x474d('0x25');return db[_0x474d('0x4f')][_0x474d('0x4a')]({'where':{'name':_0x3f4413,'userProfileId':_0x2a922c['userProfileId']},'raw':!![]})[_0x474d('0x23')](function(_0x253958){if(_0x253958&&_0x253958[_0x474d('0x50')]===0x0){return db[_0x474d('0x51')][_0x474d('0x4b')]({'name':_0x15be73[_0x474d('0x29')],'resourceId':_0x15be73['id'],'type':_0x253958[_0x474d('0x29')],'sectionId':_0x253958['id']},{})['then'](function(){return _0x3a6783;});}else{return _0x3a6783;}})[_0x474d('0x48')](function(_0x1b3fd3){logger['error'](_0x474d('0x52'),_0x1b3fd3);throw _0x1b3fd3;});}return _0x3a6783;})[_0x474d('0x23')](respondWithResult(_0xca5f6b,0xc9))['catch'](handleError(_0xca5f6b,null));};exports[_0x474d('0x22')]=function(_0x790eba,_0x5f02b5){if(_0x790eba[_0x474d('0x53')]['id']){delete _0x790eba[_0x474d('0x53')]['id'];}return db[_0x474d('0x43')][_0x474d('0x4a')]({'where':{'id':_0x790eba[_0x474d('0x54')]['id']}})[_0x474d('0x23')](handleEntityNotFound(_0x5f02b5,null))['then'](saveUpdates(_0x790eba[_0x474d('0x53')],null))[_0x474d('0x23')](respondWithResult(_0x5f02b5,null))[_0x474d('0x48')](handleError(_0x5f02b5,null));};exports['destroy']=function(_0x31de5b,_0x53abdd){return db[_0x474d('0x43')][_0x474d('0x4a')]({'where':{'id':_0x31de5b[_0x474d('0x54')]['id']}})[_0x474d('0x23')](handleEntityNotFound(_0x53abdd,null))[_0x474d('0x23')](removeEntity(_0x53abdd,null))['catch'](handleError(_0x53abdd,null));}; \ No newline at end of file +var _0x09f4=['findAll','params','length','find','catch','create','user','role','UserProfileSection','autoAssociation','body','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','Dispositions','end','error','stack','send','index','Disposition','rawAttributes','fieldName','key','model','map','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','includeAll','include'];(function(_0x13b608,_0x3ce51f){var _0x48e9a1=function(_0xf7637f){while(--_0xf7637f){_0x13b608['push'](_0x13b608['shift']());}};_0x48e9a1(++_0x3ce51f);}(_0x09f4,0x1a5));var _0x409f=function(_0x5e6d75,_0xe87dbc){_0x5e6d75=_0x5e6d75-0x0;var _0x3243f5=_0x09f4[_0x5e6d75];return _0x3243f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x409f('0x0'));var zipdir=require(_0x409f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x409f('0x2'));var moment=require(_0x409f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x409f('0x4'));var util=require(_0x409f('0x5'));var path=require('path');var sox=require(_0x409f('0x6'));var csv=require(_0x409f('0x7'));var ejs=require(_0x409f('0x8'));var fs=require('fs');var fs_extra=require(_0x409f('0x9'));var _=require(_0x409f('0xa'));var squel=require(_0x409f('0xb'));var crypto=require(_0x409f('0xc'));var jsforce=require(_0x409f('0xd'));var deskjs=require(_0x409f('0xe'));var toCsv=require(_0x409f('0x7'));var querystring=require(_0x409f('0xf'));var Papa=require(_0x409f('0x10'));var Redis=require(_0x409f('0x11'));var authService=require(_0x409f('0x12'));var qs=require(_0x409f('0x13'));var as=require(_0x409f('0x14'));var hardwareService=require(_0x409f('0x15'));var logger=require(_0x409f('0x16'))(_0x409f('0x17'));var utils=require(_0x409f('0x18'));var config=require(_0x409f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381655,_0x10a7f1){_0x10a7f1=_0x10a7f1||0xcc;return function(_0x65a90f){if(_0x65a90f){return _0x381655[_0x409f('0x1a')](_0x10a7f1);}return _0x381655[_0x409f('0x1b')](_0x10a7f1)['end']();};}function respondWithResult(_0x521b90,_0x36c95b){_0x36c95b=_0x36c95b||0xc8;return function(_0x1596c1){if(_0x1596c1){return _0x521b90['status'](_0x36c95b)[_0x409f('0x1c')](_0x1596c1);}};}function respondWithFilteredResult(_0xae346b,_0x1cf64b){return function(_0x209b0c){if(_0x209b0c){var _0x12e772=typeof _0x1cf64b['offset']===_0x409f('0x1d')&&typeof _0x1cf64b[_0x409f('0x1e')]===_0x409f('0x1d');var _0x593453=_0x209b0c[_0x409f('0x1f')];var _0x2b4940=_0x12e772?0x0:_0x1cf64b['offset'];var _0x4623e2=_0x12e772?_0x209b0c[_0x409f('0x1f')]:_0x1cf64b[_0x409f('0x20')]+_0x1cf64b['limit'];var _0x534428;if(_0x4623e2>=_0x593453){_0x4623e2=_0x593453;_0x534428=0xc8;}else{_0x534428=0xce;}_0xae346b[_0x409f('0x1b')](_0x534428);return _0xae346b[_0x409f('0x21')](_0x409f('0x22'),_0x2b4940+'-'+_0x4623e2+'/'+_0x593453)[_0x409f('0x1c')](_0x209b0c);}return null;};}function patchUpdates(_0x3980dd){return function(_0xe73f18){try{jsonpatch['apply'](_0xe73f18,_0x3980dd,!![]);}catch(_0x3608e1){return BPromise[_0x409f('0x23')](_0x3608e1);}return _0xe73f18[_0x409f('0x24')]();};}function saveUpdates(_0x16a6fd,_0x4a526d){return function(_0x2f295a){if(_0x2f295a){return _0x2f295a[_0x409f('0x25')](_0x16a6fd)['then'](function(_0x119c40){return _0x119c40;});}return null;};}function removeEntity(_0x2cecbe,_0x3849b6){return function(_0x3745c6){if(_0x3745c6){return _0x3745c6[_0x409f('0x26')]()[_0x409f('0x27')](function(){var _0x31dacc=_0x3745c6[_0x409f('0x28')]({'plain':!![]});var _0x73c5b7=_0x409f('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x73c5b7,'resourceId':_0x31dacc['id']}})[_0x409f('0x27')](function(){return _0x3745c6;});})[_0x409f('0x27')](function(){_0x2cecbe[_0x409f('0x1b')](0xcc)[_0x409f('0x2a')]();});}};}function handleEntityNotFound(_0x383c11,_0x599bfa){return function(_0x3004ba){if(!_0x3004ba){_0x383c11['sendStatus'](0x194);}return _0x3004ba;};}function handleError(_0x4b83e2,_0x19461a){_0x19461a=_0x19461a||0x1f4;return function(_0x3389fa){logger[_0x409f('0x2b')](_0x3389fa[_0x409f('0x2c')]);if(_0x3389fa['name']){delete _0x3389fa['name'];}_0x4b83e2['status'](_0x19461a)[_0x409f('0x2d')](_0x3389fa);};}exports[_0x409f('0x2e')]=function(_0x510e4f,_0x18b8b6){var _0x93821f={},_0x51a40a={},_0x37972f={'count':0x0,'rows':[]};var _0x2a4a6e=_['map'](db[_0x409f('0x2f')][_0x409f('0x30')],function(_0x50a99d){return{'name':_0x50a99d[_0x409f('0x31')],'type':_0x50a99d['type'][_0x409f('0x32')]};});_0x51a40a[_0x409f('0x33')]=_[_0x409f('0x34')](_0x2a4a6e,_0x409f('0x35'));_0x51a40a[_0x409f('0x36')]=_[_0x409f('0x37')](_0x510e4f[_0x409f('0x36')]);_0x51a40a['filters']=_['intersection'](_0x51a40a[_0x409f('0x33')],_0x51a40a[_0x409f('0x36')]);_0x93821f[_0x409f('0x38')]=_[_0x409f('0x39')](_0x51a40a[_0x409f('0x33')],qs[_0x409f('0x3a')](_0x510e4f[_0x409f('0x36')][_0x409f('0x3a')]));_0x93821f['attributes']=_0x93821f[_0x409f('0x38')]['length']?_0x93821f[_0x409f('0x38')]:_0x51a40a[_0x409f('0x33')];if(!_0x510e4f['query'][_0x409f('0x3b')](_0x409f('0x3c'))){_0x93821f['limit']=qs[_0x409f('0x1e')](_0x510e4f[_0x409f('0x36')][_0x409f('0x1e')]);_0x93821f[_0x409f('0x20')]=qs[_0x409f('0x20')](_0x510e4f[_0x409f('0x36')][_0x409f('0x20')]);}_0x93821f[_0x409f('0x3d')]=qs['sort'](_0x510e4f['query'][_0x409f('0x3e')]);_0x93821f[_0x409f('0x3f')]=qs[_0x409f('0x40')](_['pick'](_0x510e4f['query'],_0x51a40a[_0x409f('0x40')]),_0x2a4a6e);if(_0x510e4f[_0x409f('0x36')]['filter']){_0x93821f[_0x409f('0x3f')]=_[_0x409f('0x41')](_0x93821f[_0x409f('0x3f')],{'$or':_['map'](_0x2a4a6e,function(_0x2805df){if(_0x2805df[_0x409f('0x42')]!==_0x409f('0x43')){var _0x53634d={};_0x53634d[_0x2805df[_0x409f('0x35')]]={'$like':'%'+_0x510e4f[_0x409f('0x36')][_0x409f('0x44')]+'%'};return _0x53634d;}})});}_0x93821f=_['merge']({},_0x93821f,_0x510e4f['options']);var _0x39c3c9={'where':_0x93821f[_0x409f('0x3f')]};return db[_0x409f('0x2f')][_0x409f('0x1f')](_0x39c3c9)[_0x409f('0x27')](function(_0xbdbdfc){_0x37972f[_0x409f('0x1f')]=_0xbdbdfc;if(_0x510e4f['query'][_0x409f('0x45')]){_0x93821f[_0x409f('0x46')]=[{'all':!![]}];}return db[_0x409f('0x2f')][_0x409f('0x47')](_0x93821f);})[_0x409f('0x27')](function(_0x95cc5a){_0x37972f['rows']=_0x95cc5a;return _0x37972f;})[_0x409f('0x27')](respondWithFilteredResult(_0x18b8b6,_0x93821f))['catch'](handleError(_0x18b8b6,null));};exports['show']=function(_0x4efbc1,_0x4327c8){var _0x49cdc7={'raw':!![],'where':{'id':_0x4efbc1[_0x409f('0x48')]['id']}},_0x273851={};_0x273851[_0x409f('0x33')]=_[_0x409f('0x37')](db['Disposition']['rawAttributes']);_0x273851[_0x409f('0x36')]=_[_0x409f('0x37')](_0x4efbc1[_0x409f('0x36')]);_0x273851[_0x409f('0x40')]=_['intersection'](_0x273851['model'],_0x273851[_0x409f('0x36')]);_0x49cdc7[_0x409f('0x38')]=_[_0x409f('0x39')](_0x273851[_0x409f('0x33')],qs[_0x409f('0x3a')](_0x4efbc1['query']['fields']));_0x49cdc7['attributes']=_0x49cdc7[_0x409f('0x38')][_0x409f('0x49')]?_0x49cdc7[_0x409f('0x38')]:_0x273851['model'];if(_0x4efbc1['query'][_0x409f('0x45')]){_0x49cdc7[_0x409f('0x46')]=[{'all':!![]}];}_0x49cdc7=_[_0x409f('0x41')]({},_0x49cdc7,_0x4efbc1['options']);return db[_0x409f('0x2f')][_0x409f('0x4a')](_0x49cdc7)[_0x409f('0x27')](handleEntityNotFound(_0x4327c8,null))[_0x409f('0x27')](respondWithResult(_0x4327c8,null))[_0x409f('0x4b')](handleError(_0x4327c8,null));};exports[_0x409f('0x4c')]=function(_0x563218,_0x5b7628){return db['Disposition'][_0x409f('0x4c')](_0x563218['body'],{})[_0x409f('0x27')](function(_0x569d8c){var _0x1caf37=_0x563218[_0x409f('0x4d')][_0x409f('0x28')]({'plain':!![]});if(!_0x1caf37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1caf37[_0x409f('0x4e')]===_0x409f('0x4d')){var _0x14651c=_0x569d8c[_0x409f('0x28')]({'plain':!![]});var _0x4cdb64=_0x409f('0x29');return db[_0x409f('0x4f')][_0x409f('0x4a')]({'where':{'name':_0x4cdb64,'userProfileId':_0x1caf37['userProfileId']},'raw':!![]})[_0x409f('0x27')](function(_0x265f10){if(_0x265f10&&_0x265f10[_0x409f('0x50')]===0x0){return db['UserProfileResource'][_0x409f('0x4c')]({'name':_0x14651c[_0x409f('0x35')],'resourceId':_0x14651c['id'],'type':_0x265f10[_0x409f('0x35')],'sectionId':_0x265f10['id']},{})['then'](function(){return _0x569d8c;});}else{return _0x569d8c;}})[_0x409f('0x4b')](function(_0x5de1c8){logger[_0x409f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5de1c8);throw _0x5de1c8;});}return _0x569d8c;})[_0x409f('0x27')](respondWithResult(_0x5b7628,0xc9))[_0x409f('0x4b')](handleError(_0x5b7628,null));};exports[_0x409f('0x25')]=function(_0x639b19,_0x69604c){if(_0x639b19[_0x409f('0x51')]['id']){delete _0x639b19[_0x409f('0x51')]['id'];}return db['Disposition'][_0x409f('0x4a')]({'where':{'id':_0x639b19[_0x409f('0x48')]['id']}})[_0x409f('0x27')](handleEntityNotFound(_0x69604c,null))[_0x409f('0x27')](saveUpdates(_0x639b19[_0x409f('0x51')],null))['then'](respondWithResult(_0x69604c,null))[_0x409f('0x4b')](handleError(_0x69604c,null));};exports[_0x409f('0x26')]=function(_0x4e0f41,_0x5a7c90){return db[_0x409f('0x2f')]['find']({'where':{'id':_0x4e0f41[_0x409f('0x48')]['id']}})[_0x409f('0x27')](handleEntityNotFound(_0x5a7c90,null))[_0x409f('0x27')](removeEntity(_0x5a7c90,null))['catch'](handleError(_0x5a7c90,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ebec338..3e6a9be 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 _0x8776=['WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x11f8c4,_0x324cbb){var _0x41e210=function(_0x3849b2){while(--_0x3849b2){_0x11f8c4['push'](_0x11f8c4['shift']());}};_0x41e210(++_0x324cbb);}(_0x8776,0x1ef));var _0x6877=function(_0x4edab5,_0x88c491){_0x4edab5=_0x4edab5-0x0;var _0x179478=_0x8776[_0x4edab5];return _0x179478;};'use strict';var _=require(_0x6877('0x0'));var util=require(_0x6877('0x1'));var logger=require(_0x6877('0x2'))(_0x6877('0x3'));var moment=require('moment');var BPromise=require(_0x6877('0x4'));var rp=require(_0x6877('0x5'));var fs=require('fs');var path=require(_0x6877('0x6'));var rimraf=require(_0x6877('0x7'));var config=require('../../config/environment');var attributes=require(_0x6877('0x8'));module['exports']=function(_0x1d70d8,_0x5af796){return _0x1d70d8[_0x6877('0x9')](_0x6877('0xa'),attributes,{'tableName':_0x6877('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6877('0xc'),'fields':['name',_0x6877('0xd')]},{'unique':!![],'name':_0x6877('0xe'),'fields':[_0x6877('0xf'),_0x6877('0x10')]},{'unique':!![],'name':_0x6877('0x11'),'fields':[_0x6877('0xf'),_0x6877('0x12')]},{'unique':!![],'name':_0x6877('0x13'),'fields':[_0x6877('0xf'),_0x6877('0x14')]},{'unique':!![],'name':'name_fax','fields':[_0x6877('0xf'),_0x6877('0x15')]},{'unique':!![],'name':_0x6877('0x16'),'fields':['name',_0x6877('0x17')]},{'unique':!![],'name':_0x6877('0x18'),'fields':[_0x6877('0xf'),_0x6877('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacbe=['name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','moment','bluebird','request-promise','./disposition.attributes','exports','define','Disposition','name_voice','ListId','name_chat'];(function(_0x1d2ca4,_0x469af6){var _0x35398a=function(_0x3638f6){while(--_0x3638f6){_0x1d2ca4['push'](_0x1d2ca4['shift']());}};_0x35398a(++_0x469af6);}(_0xacbe,0x8e));var _0xeacb=function(_0x4b9ebe,_0xb28ff1){_0x4b9ebe=_0x4b9ebe-0x0;var _0x4bd8f7=_0xacbe[_0x4b9ebe];return _0x4bd8f7;};'use strict';var _=require('lodash');var util=require(_0xeacb('0x0'));var logger=require('../../config/logger')(_0xeacb('0x1'));var moment=require(_0xeacb('0x2'));var BPromise=require(_0xeacb('0x3'));var rp=require(_0xeacb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeacb('0x5'));module[_0xeacb('0x6')]=function(_0x49c71b,_0x716478){return _0x49c71b[_0xeacb('0x7')](_0xeacb('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xeacb('0x9'),'fields':['name',_0xeacb('0xa')]},{'unique':!![],'name':_0xeacb('0xb'),'fields':[_0xeacb('0xc'),_0xeacb('0xd')]},{'unique':!![],'name':_0xeacb('0xe'),'fields':[_0xeacb('0xc'),_0xeacb('0xf')]},{'unique':!![],'name':_0xeacb('0x10'),'fields':[_0xeacb('0xc'),_0xeacb('0x11')]},{'unique':!![],'name':_0xeacb('0x12'),'fields':[_0xeacb('0xc'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name',_0xeacb('0x13')]},{'unique':!![],'name':_0xeacb('0x14'),'fields':[_0xeacb('0xc'),_0xeacb('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 59ec8d7..a72a738 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(_0x387e0c,_0x2d8c2f){var _0x47b9b1=function(_0x3de523){while(--_0x3de523){_0x387e0c['push'](_0x387e0c['shift']());}};_0x47b9b1(++_0x2d8c2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x20fe69,_0x42f2f3){var _0x255443=function(_0x301e02){while(--_0x301e02){_0x20fe69['push'](_0x20fe69['shift']());}};_0x255443(++_0x42f2f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 1699f74..0d5112e 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 _0xc3f1=['put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xc3f1,0xe8));var _0x1c3f=function(_0x19e640,_0x292a17){_0x19e640=_0x19e640-0x0;var _0x3c4bcb=_0xc3f1[_0x19e640];return _0x3c4bcb;};'use strict';var multer=require(_0x1c3f('0x0'));var util=require(_0x1c3f('0x1'));var path=require(_0x1c3f('0x2'));var timeout=require(_0x1c3f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1c3f('0x4'));var auth=require(_0x1c3f('0x5'));var interaction=require(_0x1c3f('0x6'));var config=require(_0x1c3f('0x7'));var controller=require(_0x1c3f('0x8'));router[_0x1c3f('0x9')]('/',auth[_0x1c3f('0xa')](),controller[_0x1c3f('0xb')]);router[_0x1c3f('0x9')](_0x1c3f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1c3f('0xd')]('/',auth[_0x1c3f('0xa')](),controller[_0x1c3f('0xe')]);router[_0x1c3f('0xf')](_0x1c3f('0xc'),auth[_0x1c3f('0xa')](),controller[_0x1c3f('0x10')]);router[_0x1c3f('0x11')](_0x1c3f('0xc'),auth['isAuthenticated'](),controller[_0x1c3f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xed7b=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','update','delete','destroy','exports','multer','util'];(function(_0xa70f32,_0x314896){var _0xd92502=function(_0x1f025b){while(--_0x1f025b){_0xa70f32['push'](_0xa70f32['shift']());}};_0xd92502(++_0x314896);}(_0xed7b,0x130));var _0xbed7=function(_0x2b52bd,_0x3bb8b7){_0x2b52bd=_0x2b52bd-0x0;var _0x5cb451=_0xed7b[_0x2b52bd];return _0x5cb451;};'use strict';var multer=require(_0xbed7('0x0'));var util=require(_0xbed7('0x1'));var path=require(_0xbed7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbed7('0x3'));var router=express[_0xbed7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbed7('0x5'));var interaction=require(_0xbed7('0x6'));var config=require(_0xbed7('0x7'));var controller=require(_0xbed7('0x8'));router[_0xbed7('0x9')]('/',auth[_0xbed7('0xa')](),controller[_0xbed7('0xb')]);router[_0xbed7('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbed7('0xa')](),controller['create']);router['put'](_0xbed7('0xc'),auth[_0xbed7('0xa')](),controller[_0xbed7('0xd')]);router[_0xbed7('0xe')](_0xbed7('0xc'),auth[_0xbed7('0xa')](),controller[_0xbed7('0xf')]);module[_0xbed7('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7bb100d..10f5b39 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 _0x0618=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3249e5,_0x449631){var _0x1618ce=function(_0x3a1451){while(--_0x3a1451){_0x3249e5['push'](_0x3249e5['shift']());}};_0x1618ce(++_0x449631);}(_0x0618,0x1c6));var _0x8061=function(_0x2e87d8,_0x28babe){_0x2e87d8=_0x2e87d8-0x0;var _0x142f02=_0x0618[_0x2e87d8];return _0x142f02;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8061('0x2')]},'ecm':{'type':Sequelize[_0x8061('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8061('0x2')],'defaultValue':_0x8061('0x4')},'localstationid':{'type':Sequelize[_0x8061('0x2')],'unique':_0x8061('0x5')},'minrate':{'type':Sequelize[_0x8061('0x3')](_0x8061('0x6'),_0x8061('0x7'),_0x8061('0x8'),_0x8061('0x9'),_0x8061('0xa'),_0x8061('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x8061('0x3')]('2400',_0x8061('0x7'),_0x8061('0x8'),_0x8061('0x9'),_0x8061('0xa'),_0x8061('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x8061('0xc')},'gateway':{'type':Sequelize[_0x8061('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8061('0x3')](_0x8061('0xd'),_0x8061('0xe'),_0x8061('0xf'),_0x8061('0x10')),'defaultValue':_0x8061('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8061('0x11');}},'notificationSound':{'type':Sequelize[_0x8061('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8061('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8061('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8061('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8061('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8061('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8061('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x8061('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x8061('0x12')],'defaultValue':![],'comment':_0x8061('0x15'),'set':function(_0x322dae){if(!_0x322dae)this[_0x8061('0x16')](_0x8061('0x17'),null);this[_0x8061('0x16')](_0x8061('0x18'),_0x322dae);}}}; \ No newline at end of file +var _0x524e=['9600','14400','2400','12000','v17,v27,v29','INTEGER','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200'];(function(_0x4f1649,_0x489230){var _0xbf6176=function(_0x34c173){while(--_0x34c173){_0x4f1649['push'](_0x4f1649['shift']());}};_0xbf6176(++_0x489230);}(_0x524e,0x15e));var _0xe524=function(_0x541cc1,_0x339f36){_0x541cc1=_0x541cc1-0x0;var _0x400423=_0x524e[_0x541cc1];return _0x400423;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe524('0x0')]},'ecm':{'type':Sequelize[_0xe524('0x1')](_0xe524('0x2'),'no'),'defaultValue':_0xe524('0x2')},'headerinfo':{'type':Sequelize[_0xe524('0x0')],'defaultValue':_0xe524('0x3')},'localstationid':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x4')},'minrate':{'type':Sequelize[_0xe524('0x1')]('2400',_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),'12000',_0xe524('0x8')),'defaultValue':_0xe524('0x5')},'maxrate':{'type':Sequelize[_0xe524('0x1')](_0xe524('0x9'),_0xe524('0x5'),_0xe524('0x6'),_0xe524('0x7'),_0xe524('0xa'),_0xe524('0x8')),'defaultValue':_0xe524('0x8')},'modem':{'type':Sequelize[_0xe524('0x0')],'defaultValue':_0xe524('0xb')},'gateway':{'type':Sequelize[_0xe524('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe524('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe524('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe524('0x1')]('SIP','IAX',_0xe524('0xd'),_0xe524('0xe')),'defaultValue':_0xe524('0xf')},'key':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe524('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe524('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe524('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe524('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe524('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe524('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xe524('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5a5c0d){if(!_0x5a5c0d)this[_0xe524('0x13')]('mandatoryDispositionPauseId',null);this[_0xe524('0x13')](_0xe524('0x14'),_0x5a5c0d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e4f5c8d..ffb013d 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 _0x0656=['type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','FaxAccountId','Disposition','findOne','filter','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','get','FaxAccounts','status','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName'];(function(_0x13dc4b,_0x4635e8){var _0x25626d=function(_0x21b6e1){while(--_0x21b6e1){_0x13dc4b['push'](_0x13dc4b['shift']());}};_0x25626d(++_0x4635e8);}(_0x0656,0x145));var _0x6065=function(_0x36984f,_0x4d6bbc){_0x36984f=_0x36984f-0x0;var _0x3ee7a5=_0x0656[_0x36984f];return _0x3ee7a5;};'use strict';var emlformat=require(_0x6065('0x0'));var rimraf=require(_0x6065('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6065('0x2'));var rp=require(_0x6065('0x3'));var moment=require(_0x6065('0x4'));var BPromise=require(_0x6065('0x5'));var Mustache=require(_0x6065('0x6'));var util=require(_0x6065('0x7'));var path=require(_0x6065('0x8'));var sox=require(_0x6065('0x9'));var csv=require(_0x6065('0xa'));var ejs=require(_0x6065('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6065('0xc'));var squel=require(_0x6065('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6065('0xe'));var toCsv=require(_0x6065('0xa'));var querystring=require(_0x6065('0xf'));var Papa=require(_0x6065('0x10'));var Redis=require('ioredis');var authService=require(_0x6065('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6065('0x12'));var logger=require('../../config/logger')(_0x6065('0x13'));var utils=require('../../config/utils');var config=require(_0x6065('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6065('0x15')]=_[_0x6065('0x16')](config['redis'],{'host':_0x6065('0x17'),'port':0x18eb});var socket=require(_0x6065('0x18'))(new Redis(config['redis']));require(_0x6065('0x19'))[_0x6065('0x1a')](socket);var jayson=require(_0x6065('0x1b'));var client=jayson['client'][_0x6065('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x6065('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x551af9,_0x239633,_0x3265fe,_0x461ff4){return new BPromise(function(_0xc5de25,_0x4b81e4){var _0x42953c=_0x461ff4||client;return _0x42953c[_0x6065('0x1d')](_0x551af9,_0x3265fe)[_0x6065('0x1e')](function(_0x5019b7){logger[_0x6065('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x239633,_0x6065('0x20'));logger[_0x6065('0x21')](_0x6065('0x22'),_0x239633,'request\x20sent',JSON['stringify'](_0x5019b7));if(_0x5019b7[_0x6065('0x23')]){if(_0x5019b7[_0x6065('0x23')]['code']===0x1f4){logger[_0x6065('0x23')](_0x6065('0x24'),_0x239633,_0x5019b7[_0x6065('0x23')]['message']);return _0x4b81e4(_0x5019b7['error'][_0x6065('0x25')]);}logger['error'](_0x6065('0x24'),_0x239633,_0x5019b7['error'][_0x6065('0x25')]);return _0xc5de25(_0x5019b7[_0x6065('0x23')]['message']);}else{logger[_0x6065('0x1f')](_0x6065('0x24'),_0x239633,'request\x20sent');_0xc5de25(_0x5019b7[_0x6065('0x26')]['message']);}})[_0x6065('0x27')](function(_0x35a033){logger['error'](_0x6065('0x24'),_0x239633,_0x35a033);_0x4b81e4(_0x35a033);});});}function respondWithStatusCode(_0x31e6b1,_0xf3883d){_0xf3883d=_0xf3883d||0xcc;return function(_0x4511fe){if(_0x4511fe){return _0x31e6b1[_0x6065('0x28')](_0xf3883d);}return _0x31e6b1['status'](_0xf3883d)[_0x6065('0x29')]();};}function respondWithResult(_0x400ca0,_0x38cfa3){_0x38cfa3=_0x38cfa3||0xc8;return function(_0x57adbf){if(_0x57adbf){return _0x400ca0['status'](_0x38cfa3)[_0x6065('0x2a')](_0x57adbf);}};}function respondWithFilteredResult(_0x5efe4e,_0x39e767){return function(_0x3458c1){if(_0x3458c1){var _0x11057d=typeof _0x39e767[_0x6065('0x2b')]===_0x6065('0x2c')&&typeof _0x39e767[_0x6065('0x2d')]===_0x6065('0x2c');var _0x12a548=_0x3458c1['count'];var _0x1f647d=_0x11057d?0x0:_0x39e767[_0x6065('0x2b')];var _0x34f4f8=_0x11057d?_0x3458c1[_0x6065('0x2e')]:_0x39e767[_0x6065('0x2b')]+_0x39e767[_0x6065('0x2d')];var _0x44d570;if(_0x34f4f8>=_0x12a548){_0x34f4f8=_0x12a548;_0x44d570=0xc8;}else{_0x44d570=0xce;}_0x5efe4e['status'](_0x44d570);return _0x5efe4e['set'](_0x6065('0x2f'),_0x1f647d+'-'+_0x34f4f8+'/'+_0x12a548)[_0x6065('0x2a')](_0x3458c1);}return null;};}function patchUpdates(_0x2b6ef9){return function(_0x2b4784){try{jsonpatch['apply'](_0x2b4784,_0x2b6ef9,!![]);}catch(_0x153b8d){return BPromise[_0x6065('0x30')](_0x153b8d);}return _0x2b4784[_0x6065('0x31')]();};}function saveUpdates(_0x2c87b5,_0xa19678){return function(_0x352f0a){if(_0x352f0a){return _0x352f0a[_0x6065('0x32')](_0x2c87b5)[_0x6065('0x1e')](function(_0x2b11ca){return _0x2b11ca;});}return null;};}function removeEntity(_0x34c45c,_0x17ba9a){return function(_0x3f45b6){if(_0x3f45b6){return _0x3f45b6[_0x6065('0x33')]()[_0x6065('0x1e')](function(){var _0x51ff56=_0x3f45b6[_0x6065('0x34')]({'plain':!![]});var _0x56e410=_0x6065('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x56e410,'resourceId':_0x51ff56['id']}})[_0x6065('0x1e')](function(){return _0x3f45b6;});})[_0x6065('0x1e')](function(){_0x34c45c[_0x6065('0x36')](0xcc)[_0x6065('0x29')]();});}};}function handleEntityNotFound(_0x349d52,_0x2e3f3e){return function(_0x455056){if(!_0x455056){_0x349d52['sendStatus'](0x194);}return _0x455056;};}function handleError(_0x167dd0,_0x51dbc1){_0x51dbc1=_0x51dbc1||0x1f4;return function(_0xceec8a){logger[_0x6065('0x23')](_0xceec8a['stack']);if(_0xceec8a['name']){delete _0xceec8a[_0x6065('0x37')];}_0x167dd0['status'](_0x51dbc1)['send'](_0xceec8a);};}exports[_0x6065('0x38')]=function(_0x3a35a3,_0x519257){var _0x1cb7f3={'include':[{'model':db[_0x6065('0x39')],'as':_0x6065('0x3a')}]},_0xfb9de0={},_0x4d70ff={'count':0x0,'rows':[]};var _0x54e839=_[_0x6065('0x3b')](db[_0x6065('0x3c')][_0x6065('0x3d')],function(_0x413d6f){return{'name':_0x413d6f[_0x6065('0x3e')],'type':_0x413d6f[_0x6065('0x3f')][_0x6065('0x40')]};});_0xfb9de0['model']=_['map'](_0x54e839,_0x6065('0x37'));_0xfb9de0[_0x6065('0x41')]=_['keys'](_0x3a35a3[_0x6065('0x41')]);_0xfb9de0['filters']=_[_0x6065('0x42')](_0xfb9de0[_0x6065('0x43')],_0xfb9de0[_0x6065('0x41')]);_0x1cb7f3[_0x6065('0x44')]=_['intersection'](_0xfb9de0[_0x6065('0x43')],qs[_0x6065('0x45')](_0x3a35a3[_0x6065('0x41')][_0x6065('0x45')]));_0x1cb7f3[_0x6065('0x44')]=_0x1cb7f3['attributes'][_0x6065('0x46')]?_0x1cb7f3[_0x6065('0x44')]:_0xfb9de0['model'];if(!_0x3a35a3['query'][_0x6065('0x47')](_0x6065('0x48'))){_0x1cb7f3['limit']=qs[_0x6065('0x2d')](_0x3a35a3[_0x6065('0x41')]['limit']);_0x1cb7f3[_0x6065('0x2b')]=qs[_0x6065('0x2b')](_0x3a35a3[_0x6065('0x41')][_0x6065('0x2b')]);}_0x1cb7f3[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x3a35a3[_0x6065('0x41')]['sort']);_0x1cb7f3[_0x6065('0x4b')]=qs[_0x6065('0x4c')](_[_0x6065('0x4d')](_0x3a35a3[_0x6065('0x41')],_0xfb9de0[_0x6065('0x4c')]),_0x54e839);if(_0x3a35a3[_0x6065('0x41')]['filter']){_0x1cb7f3[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0x1cb7f3[_0x6065('0x4b')],{'$or':_[_0x6065('0x3b')](_0x54e839,function(_0x1fe5c6){if(_0x1fe5c6[_0x6065('0x3f')]!==_0x6065('0x4f')){var _0x29acdb={};_0x29acdb[_0x1fe5c6[_0x6065('0x37')]]={'$like':'%'+_0x3a35a3[_0x6065('0x41')]['filter']+'%'};return _0x29acdb;}})});}_0x1cb7f3=_[_0x6065('0x4e')]({},_0x1cb7f3,_0x3a35a3['options']);var _0x98e600={'where':_0x1cb7f3[_0x6065('0x4b')]};return db[_0x6065('0x3c')][_0x6065('0x2e')](_0x98e600)['then'](function(_0x57598f){_0x4d70ff['count']=_0x57598f;if(_0x3a35a3[_0x6065('0x41')][_0x6065('0x50')]){_0x1cb7f3[_0x6065('0x51')]=[{'all':!![]}];}return db[_0x6065('0x3c')]['findAll'](_0x1cb7f3);})[_0x6065('0x1e')](function(_0x4a7618){_0x4d70ff[_0x6065('0x52')]=_0x4a7618;return _0x4d70ff;})[_0x6065('0x1e')](respondWithFilteredResult(_0x519257,_0x1cb7f3))[_0x6065('0x27')](handleError(_0x519257,null));};exports[_0x6065('0x53')]=function(_0x468e0c,_0xae4951){var _0x385eba={'raw':![],'where':{'id':_0x468e0c[_0x6065('0x54')]['id']},'include':[{'model':db[_0x6065('0x39')],'as':_0x6065('0x3a')}]},_0x3a6996={};_0x3a6996[_0x6065('0x43')]=_[_0x6065('0x55')](db[_0x6065('0x3c')][_0x6065('0x3d')]);_0x3a6996[_0x6065('0x41')]=_[_0x6065('0x55')](_0x468e0c['query']);_0x3a6996[_0x6065('0x4c')]=_['intersection'](_0x3a6996[_0x6065('0x43')],_0x3a6996['query']);_0x385eba[_0x6065('0x44')]=_[_0x6065('0x42')](_0x3a6996[_0x6065('0x43')],qs[_0x6065('0x45')](_0x468e0c[_0x6065('0x41')][_0x6065('0x45')]));_0x385eba[_0x6065('0x44')]=_0x385eba[_0x6065('0x44')][_0x6065('0x46')]?_0x385eba[_0x6065('0x44')]:_0x3a6996[_0x6065('0x43')];if(_0x468e0c[_0x6065('0x41')][_0x6065('0x50')]){_0x385eba[_0x6065('0x51')]=[{'all':!![]}];}_0x385eba=_['merge']({},_0x385eba,_0x468e0c[_0x6065('0x56')]);return db[_0x6065('0x3c')][_0x6065('0x57')](_0x385eba)[_0x6065('0x1e')](handleEntityNotFound(_0xae4951,null))[_0x6065('0x1e')](respondWithResult(_0xae4951,null))[_0x6065('0x27')](handleError(_0xae4951,null));};exports['create']=function(_0x5a92a1,_0x2367c5){return db['FaxAccount'][_0x6065('0x58')](_0x5a92a1[_0x6065('0x59')],{})[_0x6065('0x1e')](function(_0x3aea26){var _0x1ea0c5=_0x5a92a1['user'][_0x6065('0x34')]({'plain':!![]});if(!_0x1ea0c5)throw new Error(_0x6065('0x5a'));if(_0x1ea0c5['role']==='user'){var _0x444f60=_0x3aea26[_0x6065('0x34')]({'plain':!![]});var _0x2c15b9=_0x6065('0x35');return db[_0x6065('0x5b')][_0x6065('0x57')]({'where':{'name':_0x2c15b9,'userProfileId':_0x1ea0c5[_0x6065('0x5c')]},'raw':!![]})[_0x6065('0x1e')](function(_0x6a3cd){if(_0x6a3cd&&_0x6a3cd[_0x6065('0x5d')]===0x0){return db[_0x6065('0x5e')][_0x6065('0x58')]({'name':_0x444f60[_0x6065('0x37')],'resourceId':_0x444f60['id'],'type':_0x6a3cd['name'],'sectionId':_0x6a3cd['id']},{})[_0x6065('0x1e')](function(){return _0x3aea26;});}else{return _0x3aea26;}})[_0x6065('0x27')](function(_0x980bb9){logger[_0x6065('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x980bb9);throw _0x980bb9;});}return _0x3aea26;})['then'](respondWithResult(_0x2367c5,0xc9))[_0x6065('0x27')](handleError(_0x2367c5,null));};exports[_0x6065('0x32')]=function(_0x39ac85,_0x42001e){if(_0x39ac85[_0x6065('0x59')]['id']){delete _0x39ac85['body']['id'];}return db[_0x6065('0x3c')]['find']({'where':{'id':_0x39ac85[_0x6065('0x54')]['id']},'include':[{'model':db[_0x6065('0x39')],'as':_0x6065('0x3a')}]})[_0x6065('0x1e')](handleEntityNotFound(_0x42001e,null))[_0x6065('0x1e')](saveUpdates(_0x39ac85[_0x6065('0x59')],null))[_0x6065('0x1e')](respondWithResult(_0x42001e,null))['catch'](handleError(_0x42001e,null));};exports[_0x6065('0x33')]=function(_0x1ca516,_0x1f785c){return db['FaxAccount']['find']({'where':{'id':_0x1ca516['params']['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x1f785c,null))['then'](removeEntity(_0x1f785c,null))['catch'](handleError(_0x1f785c,null));};exports['describe']=function(_0x19b4e2,_0x40203d){return db[_0x6065('0x3c')][_0x6065('0x5f')]()[_0x6065('0x1e')](respondWithResult(_0x40203d,null))['catch'](handleError(_0x40203d,null));};exports['addDisposition']=function(_0x18b6c5,_0x3890ba,_0x160c74){if(_0x18b6c5[_0x6065('0x59')]['id']){delete _0x18b6c5[_0x6065('0x59')]['id'];}return db[_0x6065('0x3c')]['find']({'where':{'id':_0x18b6c5['params']['id']}})['then'](handleEntityNotFound(_0x3890ba,null))[_0x6065('0x1e')](function(_0x1451d8){if(_0x1451d8){_0x18b6c5['body'][_0x6065('0x60')]=_0x1451d8['id'];return db[_0x6065('0x61')][_0x6065('0x58')](_0x18b6c5[_0x6065('0x59')]);}})[_0x6065('0x1e')](respondWithResult(_0x3890ba,null))[_0x6065('0x27')](handleError(_0x3890ba,null));};exports['getDispositions']=function(_0x2fbb1a,_0x241888,_0x8d31bd){var _0xdb9399={'raw':![],'where':{}};var _0x3c3f2c={};var _0x3fdaaa={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6065('0x62')]({'where':{'id':_0x2fbb1a[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x241888,null))[_0x6065('0x1e')](function(_0x4c2e1c){if(_0x4c2e1c){_0x3c3f2c[_0x6065('0x43')]=_['keys'](db[_0x6065('0x61')]['rawAttributes']);_0x3c3f2c[_0x6065('0x41')]=_['keys'](_0x2fbb1a[_0x6065('0x41')]);_0x3c3f2c[_0x6065('0x4c')]=_[_0x6065('0x42')](_0x3c3f2c[_0x6065('0x43')],_0x3c3f2c[_0x6065('0x41')]);_0xdb9399[_0x6065('0x44')]=_[_0x6065('0x42')](_0x3c3f2c[_0x6065('0x43')],qs['fields'](_0x2fbb1a['query'][_0x6065('0x45')]));_0xdb9399[_0x6065('0x44')]=_0xdb9399[_0x6065('0x44')][_0x6065('0x46')]?_0xdb9399[_0x6065('0x44')]:_0x3c3f2c[_0x6065('0x43')];if(!_0x2fbb1a['query'][_0x6065('0x47')](_0x6065('0x48'))){_0xdb9399[_0x6065('0x2d')]=qs['limit'](_0x2fbb1a[_0x6065('0x41')][_0x6065('0x2d')]);_0xdb9399[_0x6065('0x2b')]=qs[_0x6065('0x2b')](_0x2fbb1a[_0x6065('0x41')][_0x6065('0x2b')]);}_0xdb9399[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x2fbb1a['query']['sort']);_0xdb9399[_0x6065('0x4b')]=qs['filters'](_[_0x6065('0x4d')](_0x2fbb1a[_0x6065('0x41')],_0x3c3f2c[_0x6065('0x4c')]));_0xdb9399['where'][_0x6065('0x60')]=_0x4c2e1c['id'];if(_0x2fbb1a['query']['filter']){_0xdb9399[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0xdb9399[_0x6065('0x4b')],{'$or':_[_0x6065('0x3b')](_0xdb9399['attributes'],function(_0x104543){var _0x20ae84={};_0x20ae84[_0x104543]={'$like':'%'+_0x2fbb1a[_0x6065('0x41')][_0x6065('0x63')]+'%'};return _0x20ae84;})});}_0xdb9399=_[_0x6065('0x4e')]({},_0xdb9399,_0x2fbb1a[_0x6065('0x56')]);return db[_0x6065('0x61')]['count']({'where':_0xdb9399['where']})['then'](function(_0x4f6730){_0x3fdaaa[_0x6065('0x2e')]=_0x4f6730;if(_0x2fbb1a[_0x6065('0x41')][_0x6065('0x50')]){_0xdb9399[_0x6065('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xdb9399);})[_0x6065('0x1e')](function(_0x335ce5){_0x3fdaaa['rows']=_0x335ce5;return _0x3fdaaa;});}})[_0x6065('0x1e')](respondWithFilteredResult(_0x241888,_0xdb9399))[_0x6065('0x27')](handleError(_0x241888,null));};exports[_0x6065('0x64')]=function(_0x462b40,_0x43a075,_0x5a4f47){return db[_0x6065('0x3c')][_0x6065('0x57')]({'where':{'id':_0x462b40[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x43a075,null))[_0x6065('0x1e')](function(_0xe23325){if(_0xe23325){return _0xe23325[_0x6065('0x64')](_0x462b40[_0x6065('0x41')]['ids']);}})[_0x6065('0x1e')](respondWithStatusCode(_0x43a075,null))[_0x6065('0x27')](handleError(_0x43a075,null));};exports[_0x6065('0x65')]=function(_0x2853bd,_0x36932e,_0x527889){if(_0x2853bd[_0x6065('0x59')]['id']){delete _0x2853bd['body']['id'];}return db[_0x6065('0x3c')][_0x6065('0x57')]({'where':{'id':_0x2853bd[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x36932e,null))['then'](function(_0x3ecdff){if(_0x3ecdff){_0x2853bd[_0x6065('0x59')]['FaxAccountId']=_0x3ecdff['id'];return db['CannedAnswer'][_0x6065('0x58')](_0x2853bd['body']);}})[_0x6065('0x1e')](respondWithResult(_0x36932e,null))[_0x6065('0x27')](handleError(_0x36932e,null));};exports[_0x6065('0x66')]=function(_0x21417e,_0x1029cf,_0x2a4cd3){var _0x3b21f7={'raw':![],'where':{}};var _0x49eda7={};var _0x4ba5eb={'count':0x0,'rows':[]};return db[_0x6065('0x3c')][_0x6065('0x62')]({'where':{'id':_0x21417e['params']['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x1029cf,null))['then'](function(_0x18d32a){if(_0x18d32a){_0x49eda7['model']=_['keys'](db[_0x6065('0x67')][_0x6065('0x3d')]);_0x49eda7['query']=_['keys'](_0x21417e[_0x6065('0x41')]);_0x49eda7[_0x6065('0x4c')]=_[_0x6065('0x42')](_0x49eda7['model'],_0x49eda7[_0x6065('0x41')]);_0x3b21f7[_0x6065('0x44')]=_[_0x6065('0x42')](_0x49eda7[_0x6065('0x43')],qs['fields'](_0x21417e[_0x6065('0x41')][_0x6065('0x45')]));_0x3b21f7['attributes']=_0x3b21f7[_0x6065('0x44')][_0x6065('0x46')]?_0x3b21f7[_0x6065('0x44')]:_0x49eda7[_0x6065('0x43')];if(!_0x21417e[_0x6065('0x41')]['hasOwnProperty'](_0x6065('0x48'))){_0x3b21f7[_0x6065('0x2d')]=qs['limit'](_0x21417e['query'][_0x6065('0x2d')]);_0x3b21f7[_0x6065('0x2b')]=qs[_0x6065('0x2b')](_0x21417e[_0x6065('0x41')]['offset']);}_0x3b21f7[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x21417e[_0x6065('0x41')]['sort']);_0x3b21f7[_0x6065('0x4b')]=qs[_0x6065('0x4c')](_[_0x6065('0x4d')](_0x21417e['query'],_0x49eda7[_0x6065('0x4c')]));_0x3b21f7['where']['FaxAccountId']=_0x18d32a['id'];if(_0x21417e[_0x6065('0x41')]['filter']){_0x3b21f7[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0x3b21f7[_0x6065('0x4b')],{'$or':_['map'](_0x3b21f7['attributes'],function(_0x42efc3){var _0x55d9b0={};_0x55d9b0[_0x42efc3]={'$like':'%'+_0x21417e['query']['filter']+'%'};return _0x55d9b0;})});}_0x3b21f7=_[_0x6065('0x4e')]({},_0x3b21f7,_0x21417e[_0x6065('0x56')]);return db[_0x6065('0x67')][_0x6065('0x2e')]({'where':_0x3b21f7[_0x6065('0x4b')]})[_0x6065('0x1e')](function(_0x143692){_0x4ba5eb[_0x6065('0x2e')]=_0x143692;if(_0x21417e[_0x6065('0x41')]['includeAll']){_0x3b21f7[_0x6065('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6065('0x68')](_0x3b21f7);})[_0x6065('0x1e')](function(_0x5b98a9){_0x4ba5eb['rows']=_0x5b98a9;return _0x4ba5eb;});}})[_0x6065('0x1e')](respondWithFilteredResult(_0x1029cf,_0x3b21f7))['catch'](handleError(_0x1029cf,null));};exports[_0x6065('0x69')]=function(_0x544db1,_0x54b037,_0x5d7944){return db['FaxAccount'][_0x6065('0x57')]({'where':{'id':_0x544db1[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x54b037,null))['then'](function(_0x109237){if(_0x109237){return _0x109237[_0x6065('0x69')](_0x544db1[_0x6065('0x41')][_0x6065('0x6a')]);}})['then'](respondWithStatusCode(_0x54b037,null))[_0x6065('0x27')](handleError(_0x54b037,null));};exports['addInteraction']=function(_0x54cdc3,_0x3a2261,_0x32e814){return db[_0x6065('0x6b')]['find']({'where':{'id':_0x54cdc3[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x3a2261,null))[_0x6065('0x1e')](function(_0xcbc411){if(_0xcbc411){return _0xcbc411[_0x6065('0x6c')](_0x54cdc3[_0x6065('0x59')][_0x6065('0x6a')],_[_0x6065('0x6d')](_0x54cdc3[_0x6065('0x59')],[_0x6065('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x3a2261,null))[_0x6065('0x27')](handleError(_0x3a2261,null));};exports[_0x6065('0x6e')]=function(_0x2f2404,_0x40854c,_0x2ac311){var _0x31fe9b={'raw':![],'where':{}};var _0x327dd9={};var _0x4a20ce={'count':0x0,'rows':[]};return db[_0x6065('0x3c')][_0x6065('0x62')]({'where':{'id':_0x2f2404['params']['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x40854c,null))['then'](function(_0xfed0cf){if(_0xfed0cf){_0x327dd9['model']=_[_0x6065('0x55')](db[_0x6065('0x6b')][_0x6065('0x3d')]);_0x327dd9[_0x6065('0x41')]=_[_0x6065('0x55')](_0x2f2404[_0x6065('0x41')]);_0x327dd9[_0x6065('0x4c')]=_[_0x6065('0x42')](_0x327dd9['model'],_0x327dd9[_0x6065('0x41')]);_0x31fe9b[_0x6065('0x44')]=_['intersection'](_0x327dd9[_0x6065('0x43')],qs[_0x6065('0x45')](_0x2f2404[_0x6065('0x41')][_0x6065('0x45')]));_0x31fe9b[_0x6065('0x44')]=_0x31fe9b['attributes'][_0x6065('0x46')]?_0x31fe9b[_0x6065('0x44')]:_0x327dd9[_0x6065('0x43')];if(!_0x2f2404[_0x6065('0x41')][_0x6065('0x47')](_0x6065('0x48'))){_0x31fe9b[_0x6065('0x2d')]=qs[_0x6065('0x2d')](_0x2f2404[_0x6065('0x41')][_0x6065('0x2d')]);_0x31fe9b['offset']=qs[_0x6065('0x2b')](_0x2f2404[_0x6065('0x41')][_0x6065('0x2b')]);}_0x31fe9b[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x2f2404[_0x6065('0x41')]['sort']);_0x31fe9b[_0x6065('0x4b')]=qs[_0x6065('0x4c')](_[_0x6065('0x4d')](_0x2f2404[_0x6065('0x41')],_0x327dd9[_0x6065('0x4c')]));_0x31fe9b[_0x6065('0x4b')][_0x6065('0x60')]=_0xfed0cf['id'];if(_0x2f2404[_0x6065('0x41')][_0x6065('0x63')]){_0x31fe9b[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0x31fe9b[_0x6065('0x4b')],{'$or':_[_0x6065('0x3b')](_0x31fe9b['attributes'],function(_0x2defc9){var _0x1f1e03={};_0x1f1e03[_0x2defc9]={'$like':'%'+_0x2f2404[_0x6065('0x41')]['filter']+'%'};return _0x1f1e03;})});}_0x31fe9b=_[_0x6065('0x4e')]({},_0x31fe9b,_0x2f2404[_0x6065('0x56')]);return db[_0x6065('0x6b')][_0x6065('0x2e')]({'where':_0x31fe9b[_0x6065('0x4b')]})['then'](function(_0x146042){_0x4a20ce['count']=_0x146042;if(_0x2f2404[_0x6065('0x41')][_0x6065('0x50')]){_0x31fe9b[_0x6065('0x51')]=[{'model':db['CmContact'],'as':_0x6065('0x6f'),'required':![]},{'model':db[_0x6065('0x70')],'as':_0x6065('0x71'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x6065('0x72'),'attributes':['id','name',_0x6065('0x73')],'where':_0x2f2404[_0x6065('0x41')][_0x6065('0x74')]?{'id':_0x2f2404[_0x6065('0x41')]['tag']}:undefined,'required':_0x2f2404['query'][_0x6065('0x74')]?!![]:![]}];}return db[_0x6065('0x6b')][_0x6065('0x68')](_0x31fe9b);})[_0x6065('0x1e')](function(_0x476175){_0x4a20ce[_0x6065('0x52')]=_0x476175;return _0x4a20ce;});}})['then'](respondWithFilteredResult(_0x40854c,_0x31fe9b))[_0x6065('0x27')](handleError(_0x40854c,null));};exports[_0x6065('0x75')]=function(_0x119fee,_0x2c95cf){var _0xb84c27=_0x119fee[_0x6065('0x54')]['id'];var _0x431720=_0x119fee[_0x6065('0x59')];var _0x256376=0xc8;var _0x2508d7=null;return db[_0x6065('0x76')][_0x6065('0x77')]({'isolationLevel':db['sequelize'][_0x6065('0x78')][_0x6065('0x79')][_0x6065('0x7a')]},function(_0x2abab3){return db['FaxAccount'][_0x6065('0x62')]({'where':{'id':_0xb84c27},'transaction':_0x2abab3})[_0x6065('0x1e')](function(_0x4d5d76){if(_0x4d5d76){return db[_0x6065('0x7b')]['destroy']({'where':{'FaxAccountId':_0xb84c27},'transaction':_0x2abab3})[_0x6065('0x1e')](function(){var _0x3abf31=_['map'](_0x431720,function(_0x5bc5d7){_0x5bc5d7[_0x6065('0x60')]=_0xb84c27;return _0x5bc5d7;});return db[_0x6065('0x7b')][_0x6065('0x7c')](_0x3abf31,{'transaction':_0x2abab3});});}else{_0x256376=0x194;_0x2508d7=[];}});})[_0x6065('0x1e')](function(){if(_0x256376!==0x194){return db['FaxApplication'][_0x6065('0x7d')]({'where':{'FaxAccountId':_0xb84c27},'order':_0x6065('0x7e')})[_0x6065('0x1e')](function(_0x4194ee){_0x2508d7=_0x4194ee;});}})['catch'](function(_0x42d86f){_0x256376=0x1f4;logger[_0x6065('0x23')](_0x42d86f['stack']);if(_0x42d86f[_0x6065('0x37')]){delete _0x42d86f[_0x6065('0x37')];}_0x2508d7=_0x42d86f;})['finally'](function(){if(_0x2508d7===null){_0x2c95cf[_0x6065('0x28')](_0x256376);}else{if(_0x256376===0x1f4){_0x2c95cf['status'](_0x256376)[_0x6065('0x7f')](_0x2508d7);}else{_0x2c95cf['status'](_0x256376)[_0x6065('0x2a')](_0x2508d7);}}});};exports[_0x6065('0x80')]=function(_0x11161f,_0x47f031,_0x1f876b){var _0x1583a6={};var _0x41b1f0={};var _0x53f0ae;var _0x44fdae;return db[_0x6065('0x3c')][_0x6065('0x62')]({'where':{'id':_0x11161f[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x47f031,null))[_0x6065('0x1e')](function(_0x505129){if(_0x505129){_0x53f0ae=_0x505129;_0x41b1f0[_0x6065('0x43')]=_[_0x6065('0x55')](db[_0x6065('0x7b')]['rawAttributes']);_0x41b1f0[_0x6065('0x41')]=_[_0x6065('0x55')](_0x11161f[_0x6065('0x41')]);_0x41b1f0['filters']=_[_0x6065('0x42')](_0x41b1f0['model'],_0x41b1f0[_0x6065('0x41')]);_0x1583a6[_0x6065('0x44')]=_[_0x6065('0x42')](_0x41b1f0[_0x6065('0x43')],qs[_0x6065('0x45')](_0x11161f[_0x6065('0x41')][_0x6065('0x45')]));_0x1583a6[_0x6065('0x44')]=_0x1583a6[_0x6065('0x44')]['length']?_0x1583a6['attributes']:_0x41b1f0['model'];_0x1583a6[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x11161f[_0x6065('0x41')][_0x6065('0x4a')]);_0x1583a6[_0x6065('0x4b')]=qs[_0x6065('0x4c')](_['pick'](_0x11161f['query'],_0x41b1f0[_0x6065('0x4c')]));if(_0x11161f[_0x6065('0x41')][_0x6065('0x63')]){_0x1583a6[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0x1583a6[_0x6065('0x4b')],{'$or':_[_0x6065('0x3b')](_0x1583a6[_0x6065('0x44')],function(_0x2d7221){var _0x46a802={};_0x46a802[_0x2d7221]={'$like':'%'+_0x11161f['query'][_0x6065('0x63')]+'%'};return _0x46a802;})});}_0x1583a6=_['merge']({},_0x1583a6,_0x11161f[_0x6065('0x56')]);return _0x53f0ae['getApplications'](_0x1583a6);}})['then'](function(_0x2de7bd){if(_0x2de7bd){_0x44fdae=_0x2de7bd[_0x6065('0x46')];if(!_0x11161f[_0x6065('0x41')][_0x6065('0x47')](_0x6065('0x48'))){_0x1583a6[_0x6065('0x2d')]=qs[_0x6065('0x2d')](_0x11161f[_0x6065('0x41')][_0x6065('0x2d')]);_0x1583a6[_0x6065('0x2b')]=qs[_0x6065('0x2b')](_0x11161f[_0x6065('0x41')][_0x6065('0x2b')]);}return _0x53f0ae[_0x6065('0x80')](_0x1583a6);}})[_0x6065('0x1e')](function(_0x308a7b){if(_0x308a7b){return _0x308a7b?{'count':_0x44fdae,'rows':_0x308a7b}:null;}})[_0x6065('0x1e')](respondWithResult(_0x47f031,null))[_0x6065('0x27')](handleError(_0x47f031,null));};function Extension(_0x68758b,_0x2cc0b2,_0x1faca3,_0x38bc66){this['context']=_0x6065('0x81');this[_0x6065('0x82')]=_0x68758b[_0x6065('0x83')];this[_0x6065('0x84')]=_0x38bc66;this[_0x6065('0x3f')]=_0x6065('0x85');this['description']=_0x6065('0x86');this[_0x6065('0x60')]=_0x68758b['id'];this[_0x6065('0x7e')]=_0x2cc0b2;this['appdata']=_0x1faca3;}function createExtensionsReciveFax(_0x191219){var _0x5374bd=0x1;var _0x5ca668=[];_0x5ca668[_0x6065('0x87')](new Extension(_0x191219,_0x5374bd,'',_0x6065('0x88')));_0x5374bd+=0x1;_0x5ca668['push'](new Extension(_0x191219,_0x5374bd,_0x6065('0x89'),_0x6065('0x8a')));_0x5374bd+=0x1;for(var _0x3a0a90 in _0x191219){if(_0x191219[_0x6065('0x47')](_0x3a0a90)&&(_0x3a0a90===_0x6065('0x8b')||_0x3a0a90===_0x6065('0x83')||_0x3a0a90===_0x6065('0x8c')||_0x3a0a90===_0x6065('0x8d')||_0x3a0a90===_0x6065('0x8e')||_0x3a0a90===_0x6065('0x8f')||_0x3a0a90===_0x6065('0x90')||_0x3a0a90===_0x6065('0x91')||_0x3a0a90==='t38timeout')){_0x5ca668[_0x6065('0x87')](new Extension(_0x191219,_0x5374bd,_0x6065('0x92')+_0x3a0a90+')='+_0x191219[_0x3a0a90],_0x6065('0x8a')));_0x5374bd+=0x1;}}_0x5ca668[_0x6065('0x87')](new Extension(_0x191219,_0x5374bd,'6',_0x6065('0x93')));_0x5374bd+=0x1;_0x5ca668['push'](new Extension(_0x191219,_0x5374bd,_0x6065('0x94'),_0x6065('0x95')));_0x5374bd=0x0;return _0x5ca668;}exports[_0x6065('0x96')]=function(_0x467a6d,_0x27848d,_0x20e3ff){var _0x3f449c;return db['sequelize']['transaction'](function(_0x2c9d9f){return db['FaxAccount'][_0x6065('0x58')](_0x467a6d['body'],{'transaction':_0x2c9d9f})['then'](function(_0x240fd1){_0x3f449c=_0x240fd1['get']({'plain':!![]});return db[_0x6065('0x97')]['bulkCreate'](createExtensionsReciveFax(_0x3f449c),{'transaction':_0x2c9d9f});});})['then'](function(){return _0x3f449c;})[_0x6065('0x1e')](respondWithResult(_0x27848d,null))[_0x6065('0x27')](handleError(_0x27848d,null));};exports['updateAccountApplications']=function(_0x390d8e,_0x29485a,_0x2afbfe){var _0x3bc4f2;return db[_0x6065('0x76')][_0x6065('0x77')](function(_0x2a6078){return db[_0x6065('0x3c')][_0x6065('0x32')](_0x390d8e[_0x6065('0x59')],{'where':{'id':_0x390d8e['body']['id']},'transaction':_0x2a6078})['then'](function(_0x43011a){return db[_0x6065('0x97')]['destroy']({'where':{'FaxAccountId':_0x390d8e[_0x6065('0x59')]['id']},'transaction':_0x2a6078})['then'](function(_0xdc40f9){return db[_0x6065('0x97')]['bulkCreate'](createExtensionsReciveFax(_[_0x6065('0x6d')](_0x390d8e[_0x6065('0x59')],[_0x6065('0x98'),_0x6065('0x40'),_0x6065('0x99'),_0x6065('0x9a'),_0x6065('0x9b'),_0x6065('0x9c')])),{'transaction':_0x2a6078});});});})[_0x6065('0x1e')](function(){return db[_0x6065('0x3c')]['findById'](_0x390d8e[_0x6065('0x59')]['id']);})['then'](respondWithResult(_0x29485a,null))[_0x6065('0x27')](handleError(_0x29485a,null));};exports[_0x6065('0x9d')]=function(_0x5e1fea,_0x5613c7,_0xe86124){var _0x415a7b={'raw':!![],'where':{}};var _0x962a0f={};var _0x3593f4={'count':0x0,'rows':[]};return db[_0x6065('0x3c')][_0x6065('0x62')]({'where':{'id':_0x5e1fea[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x5613c7,null))[_0x6065('0x1e')](function(_0x4ac4da){if(_0x4ac4da){_0x962a0f[_0x6065('0x43')]=_[_0x6065('0x55')](db[_0x6065('0x9e')][_0x6065('0x3d')]);_0x962a0f['query']=_['keys'](_0x5e1fea[_0x6065('0x41')]);_0x962a0f[_0x6065('0x4c')]=_[_0x6065('0x42')](_0x962a0f[_0x6065('0x43')],_0x962a0f['query']);_0x415a7b[_0x6065('0x44')]=_[_0x6065('0x42')](_0x962a0f['model'],qs[_0x6065('0x45')](_0x5e1fea[_0x6065('0x41')][_0x6065('0x45')]));_0x415a7b[_0x6065('0x44')]=_0x415a7b[_0x6065('0x44')]['length']?_0x415a7b[_0x6065('0x44')]:_0x962a0f['model'];if(!_0x5e1fea[_0x6065('0x41')][_0x6065('0x47')]('nolimit')){_0x415a7b['limit']=qs['limit'](_0x5e1fea[_0x6065('0x41')][_0x6065('0x2d')]);_0x415a7b[_0x6065('0x2b')]=qs[_0x6065('0x2b')](_0x5e1fea[_0x6065('0x41')][_0x6065('0x2b')]);}_0x415a7b[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x5e1fea['query'][_0x6065('0x4a')]);_0x415a7b['where']=qs['filters'](_[_0x6065('0x4d')](_0x5e1fea[_0x6065('0x41')],_0x962a0f[_0x6065('0x4c')]));_0x415a7b['where']['FaxAccountId']=_0x4ac4da['id'];if(_0x5e1fea['query'][_0x6065('0x63')]){_0x415a7b[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0x415a7b[_0x6065('0x4b')],{'$or':_['map'](_0x415a7b[_0x6065('0x44')],function(_0x396a34){var _0x5a65af={};_0x5a65af[_0x396a34]={'$like':'%'+_0x5e1fea[_0x6065('0x41')][_0x6065('0x63')]+'%'};return _0x5a65af;})});}if(_0x5e1fea[_0x6065('0x41')][_0x6065('0x9f')]){var _0x5e5d3a=_0x5e1fea[_0x6065('0x41')]['$gte'][_0x6065('0xa0')](',');var _0xb00c01={};_0xb00c01[_0x5e5d3a[0x0]]={'$gte':moment(_0x5e5d3a[0x1])[_0x6065('0xa1')](_0x6065('0xa2'))};_0x415a7b['where']=_[_0x6065('0x4e')](_0x415a7b[_0x6065('0x4b')],_0xb00c01);}_0x415a7b=_[_0x6065('0x4e')]({},_0x415a7b,_0x5e1fea[_0x6065('0x56')]);return db[_0x6065('0x9e')][_0x6065('0x2e')]({'where':_0x415a7b[_0x6065('0x4b')]})[_0x6065('0x1e')](function(_0x3284d9){_0x3593f4[_0x6065('0x2e')]=_0x3284d9;if(_0x5e1fea[_0x6065('0x41')][_0x6065('0x50')]){_0x415a7b['include']=[{'all':!![]}];}return db['FaxMessage'][_0x6065('0x68')](_0x415a7b);})[_0x6065('0x1e')](function(_0x568131){_0x3593f4[_0x6065('0x52')]=_0x568131;return _0x3593f4;});}})['then'](respondWithFilteredResult(_0x5613c7,_0x415a7b))[_0x6065('0x27')](handleError(_0x5613c7,null));};exports[_0x6065('0x7f')]=function(_0x3b3d13,_0x12753a,_0x4c3d9d){var _0x8d816a,_0x5dad78={},_0x5862c0;if(_0x3b3d13[_0x6065('0x59')]['to']){_0x5862c0=_0x3b3d13[_0x6065('0x59')]['to'][0x0];}return db[_0x6065('0x3c')][_0x6065('0x57')]({'where':{'id':_0x3b3d13[_0x6065('0x54')]['id']},'include':[{'model':db[_0x6065('0xa3')],'as':_0x6065('0xa4'),'include':[{'model':db[_0x6065('0xa5')],'as':_0x6065('0xa6'),'where':{'fax':_0x5862c0},'limit':0x1,'order':[[_0x6065('0x9a'),_0x6065('0xa7')]]}]}]})[_0x6065('0x1e')](handleEntityNotFound(_0x12753a,null))[_0x6065('0x1e')](function(_0x36346f){_0x8d816a=_0x36346f;if(_0x3b3d13['body'][_0x6065('0xa8')]&&_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][_0x6065('0x46')]){for(var _0x29d3a5=0x0;_0x29d3a5<_0x3b3d13[_0x6065('0x59')]['attachments']['length'];_0x29d3a5+=0x1){_0x3b3d13['body'][_0x6065('0xa8')][_0x29d3a5]={'filename':_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][_0x29d3a5][_0x6065('0x37')],'id':_0x3b3d13[_0x6065('0x59')]['attachments'][_0x29d3a5]['id'],'path':path[_0x6065('0xa9')](config[_0x6065('0xaa')],_0x6065('0xab'),_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][_0x29d3a5][_0x6065('0xac')])};}}return respondWithRpcPromise('CheckAfterSend',_0x6065('0xad'),{'FaxAccountId':_[_0x6065('0xae')](_0x3b3d13['params']['id'])?undefined:_0x3b3d13[_0x6065('0x54')]['id'],'path':_[_0x6065('0xae')](_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0x8')])?undefined:_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0x8')],'fax':_['isNil'](_0x3b3d13[_0x6065('0x59')]['to'][0x0])?undefined:_0x3b3d13['body']['to'][0x0]},client9002);})[_0x6065('0x1e')](function(){if(_0x8d816a){if(_[_0x6065('0xae')](_0x3b3d13['body'][_0x6065('0xaf')])){_0x3b3d13[_0x6065('0x59')][_0x6065('0xaf')]=util[_0x6065('0xa1')]('\x22%s\x22\x20<%s>',_0x8d816a[_0x6065('0x37')],_0x8d816a['fax']);}if(_0x8d816a[_0x6065('0xa4')]){if(_0x8d816a[_0x6065('0xa4')][_0x6065('0xa6')][_0x6065('0x46')]){return _0x8d816a[_0x6065('0xa4')][_0x6065('0xa6')][0x0];}else{return db[_0x6065('0xa5')]['create'](_[_0x6065('0x16')](_0x3b3d13[_0x6065('0x59')],{'firstName':_0x3b3d13[_0x6065('0x59')]['to'][0x0],'phone':_0x3b3d13['body']['to'][0x0],'fax':_0x3b3d13[_0x6065('0x59')]['to'][0x0],'ListId':_0x8d816a[_0x6065('0x9c')]}));}}else{throw new Error(_0x6065('0xb0'));}}else{throw new Error(_0x6065('0xb1'));}})[_0x6065('0x1e')](function(_0xf8ea51){if(_0xf8ea51){return db[_0x6065('0x6b')]['find']({'where':{'ContactId':_0xf8ea51['id'],'closed':![],'FaxAccountId':_0x8d816a['id']}})[_0x6065('0x1e')](function(_0x1f9baa){if(_0x1f9baa){return[_0x1f9baa,![]];}return db[_0x6065('0x6b')][_0x6065('0x58')]({'UserId':_0x3b3d13[_0x6065('0xb2')]['id'],'ContactId':_0xf8ea51['id'],'FaxAccountId':_0x8d816a['id'],'fax':_0x3b3d13[_0x6065('0x59')]['to'][0x0],'firstMsgDirection':_0x6065('0xb3'),'Messages':[_[_0x6065('0x4e')](_0x3b3d13[_0x6065('0x59')],{'read':![],'body':_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0xb4')],'FaxAccountId':_0x8d816a['id'],'UserId':_0x3b3d13[_0x6065('0xb2')]['id'],'ContactId':_0xf8ea51['id'],'AttachmentId':_0x3b3d13[_0x6065('0x59')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x6065('0x9e')],'as':_0x6065('0xb5')}]})[_0x6065('0x1e')](function(_0x5cd497){return[_0x5cd497,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6065('0xb6')](function(_0x3fef1b,_0x42ea57){if(_0x42ea57){return _0x3fef1b;}return db[_0x6065('0x9e')][_0x6065('0x58')]({'direction':_0x6065('0xb3'),'read':![],'body':_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0xb4')],'FaxAccountId':_0x8d816a['id'],'FaxInteractionId':_0x3fef1b['id'],'UserId':_0x3b3d13[_0x6065('0xb2')]['id'],'ContactId':_0x3fef1b[_0x6065('0xb7')],'AttachmentId':_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0]['id']})[_0x6065('0x1e')](function(_0x392736){_0x3fef1b[_0x6065('0xb8')]['Messages']=[];_0x3fef1b['dataValues']['Messages']['push'](_0x392736[_0x6065('0xb8')]);return _0x3fef1b;});})['then'](function(_0x59c593){respondWithRpcPromise('SendFax',_0x6065('0xb9'),{'FaxAccountId':_[_0x6065('0xae')](_0x3b3d13['params']['id'])?undefined:_0x3b3d13[_0x6065('0x54')]['id'],'path':_[_0x6065('0xae')](_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0x8')])?undefined:_0x3b3d13[_0x6065('0x59')][_0x6065('0xa8')][0x0][_0x6065('0x8')],'fax':_[_0x6065('0xae')](_0x3b3d13[_0x6065('0x59')]['to'][0x0])?undefined:_0x3b3d13[_0x6065('0x59')]['to'][0x0],'AttachmentId':_0x3b3d13[_0x6065('0x59')]['attachments'][0x0]['id']},client9002)[_0x6065('0x1e')](function(_0x525daf){logger[_0x6065('0x1f')](_0x6065('0xba'),_0x525daf);})[_0x6065('0x27')](function(_0x561195){logger[_0x6065('0x1f')](_0x6065('0xba'),_0x561195);});return _0x59c593;})[_0x6065('0x1e')](respondWithResult(_0x12753a,null))['catch'](handleError(_0x12753a,null));};exports[_0x6065('0xbb')]=function(_0x4d65da,_0x1a76c2,_0x9290f3){return db[_0x6065('0x3c')][_0x6065('0x57')]({'where':{'id':_0x4d65da[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x1a76c2,null))[_0x6065('0x1e')](function(_0xda852e){if(_0xda852e){return _0xda852e[_0x6065('0xbb')](_0x4d65da[_0x6065('0x59')]['ids'],_[_0x6065('0x6d')](_0x4d65da[_0x6065('0x59')],[_0x6065('0x6a'),'id'])||{})[_0x6065('0xb6')](function(_0x4794e8){for(var _0x601e7b=0x0;_0x601e7b<_0x4d65da[_0x6065('0x59')][_0x6065('0x6a')][_0x6065('0x46')];_0x601e7b+=0x1){socket['emit'](_0x6065('0xbc'),{'UserId':Number(_0x4d65da[_0x6065('0x59')][_0x6065('0x6a')][_0x601e7b]),'FaxAccountId':Number(_0x4d65da[_0x6065('0x54')]['id'])});}return _0x4794e8;});}})['then'](respondWithResult(_0x1a76c2,null))[_0x6065('0x27')](handleError(_0x1a76c2,null));};exports[_0x6065('0xbd')]=function(_0x24770e,_0x9b5e1b,_0x21a95c){return db[_0x6065('0x3c')]['find']({'where':{'id':_0x24770e['params']['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x9b5e1b,null))[_0x6065('0x1e')](function(_0x4e96d2){if(_0x4e96d2){return _0x4e96d2[_0x6065('0xbd')](_0x24770e[_0x6065('0x41')][_0x6065('0x6a')])[_0x6065('0x1e')](function(){if(_[_0x6065('0xbe')](_0x24770e[_0x6065('0x41')][_0x6065('0x6a')])){for(var _0x36db44=0x0;_0x36db44<_0x24770e['query']['ids'][_0x6065('0x46')];_0x36db44+=0x1){socket[_0x6065('0xbf')](_0x6065('0xc0'),{'UserId':Number(_0x24770e[_0x6065('0x41')][_0x6065('0x6a')][_0x36db44]),'FaxAccountId':Number(_0x24770e[_0x6065('0x54')]['id'])});}}else{socket[_0x6065('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x24770e[_0x6065('0x41')][_0x6065('0x6a')]),'FaxAccountId':Number(_0x24770e[_0x6065('0x54')]['id'])});}});}})[_0x6065('0x1e')](respondWithStatusCode(_0x9b5e1b,null))[_0x6065('0x27')](handleError(_0x9b5e1b,null));};exports['getAgents']=function(_0x23b4cb,_0x32e19a,_0x31cc28){var _0xe2e755={};var _0x19878b={};var _0x4409bd;var _0x3e0adf;return db['FaxAccount'][_0x6065('0x62')]({'where':{'id':_0x23b4cb[_0x6065('0x54')]['id']}})[_0x6065('0x1e')](handleEntityNotFound(_0x32e19a,null))[_0x6065('0x1e')](function(_0x50f63d){if(_0x50f63d){_0x4409bd=_0x50f63d;_0x19878b['model']=_['keys'](db[_0x6065('0x70')][_0x6065('0x3d')]);_0x19878b[_0x6065('0x41')]=_[_0x6065('0x55')](_0x23b4cb[_0x6065('0x41')]);_0x19878b[_0x6065('0x4c')]=_[_0x6065('0x42')](_0x19878b[_0x6065('0x43')],_0x19878b[_0x6065('0x41')]);_0xe2e755[_0x6065('0x44')]=_[_0x6065('0x42')](_0x19878b['model'],qs[_0x6065('0x45')](_0x23b4cb[_0x6065('0x41')]['fields']));_0xe2e755['attributes']=_0xe2e755[_0x6065('0x44')][_0x6065('0x46')]?_0xe2e755[_0x6065('0x44')]:_0x19878b[_0x6065('0x43')];_0xe2e755[_0x6065('0x49')]=qs[_0x6065('0x4a')](_0x23b4cb[_0x6065('0x41')][_0x6065('0x4a')]);_0xe2e755[_0x6065('0x4b')]=qs[_0x6065('0x4c')](_[_0x6065('0x4d')](_0x23b4cb['query'],_0x19878b['filters']));if(_0x23b4cb[_0x6065('0x41')][_0x6065('0x63')]){_0xe2e755[_0x6065('0x4b')]=_[_0x6065('0x4e')](_0xe2e755[_0x6065('0x4b')],{'$or':_[_0x6065('0x3b')](_0xe2e755[_0x6065('0x44')],function(_0x579397){var _0x2dc8a8={};_0x2dc8a8[_0x579397]={'$like':'%'+_0x23b4cb[_0x6065('0x41')][_0x6065('0x63')]+'%'};return _0x2dc8a8;})});}_0xe2e755=_[_0x6065('0x4e')]({},_0xe2e755,_0x23b4cb[_0x6065('0x56')]);return _0x4409bd[_0x6065('0xc1')](_0xe2e755);}})['then'](function(_0xd1b4f0){if(_0xd1b4f0){_0x3e0adf=_0xd1b4f0[_0x6065('0x46')];if(!_0x23b4cb['query'][_0x6065('0x47')]('nolimit')){_0xe2e755[_0x6065('0x2d')]=qs['limit'](_0x23b4cb[_0x6065('0x41')][_0x6065('0x2d')]);_0xe2e755[_0x6065('0x2b')]=qs['offset'](_0x23b4cb[_0x6065('0x41')][_0x6065('0x2b')]);}return _0x4409bd[_0x6065('0xc1')](_0xe2e755);}})[_0x6065('0x1e')](function(_0x365576){if(_0x365576){return _0x365576?{'count':_0x3e0adf,'rows':_0x365576}:null;}})[_0x6065('0x1e')](respondWithResult(_0x32e19a,null))[_0x6065('0x27')](handleError(_0x32e19a,null));}; \ No newline at end of file +var _0x986d=['List','DESC','attachments','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','addAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','undefined','count','reject','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','ReceiveFax','bulkCreate','updateAccountApplications','VoiceExtension','omit','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList'];(function(_0x14de4e,_0x13322a){var _0x539edb=function(_0x23ac72){while(--_0x23ac72){_0x14de4e['push'](_0x14de4e['shift']());}};_0x539edb(++_0x13322a);}(_0x986d,0xd6));var _0xd986=function(_0x5ec274,_0x10fc84){_0x5ec274=_0x5ec274-0x0;var _0x1dbac4=_0x986d[_0x5ec274];return _0x1dbac4;};'use strict';var emlformat=require(_0xd986('0x0'));var rimraf=require(_0xd986('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd986('0x2'));var rp=require(_0xd986('0x3'));var moment=require(_0xd986('0x4'));var BPromise=require(_0xd986('0x5'));var Mustache=require('mustache');var util=require(_0xd986('0x6'));var path=require('path');var sox=require(_0xd986('0x7'));var csv=require(_0xd986('0x8'));var ejs=require(_0xd986('0x9'));var fs=require('fs');var fs_extra=require(_0xd986('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd986('0xb'));var jsforce=require(_0xd986('0xc'));var deskjs=require(_0xd986('0xd'));var toCsv=require(_0xd986('0x8'));var querystring=require(_0xd986('0xe'));var Papa=require(_0xd986('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd986('0x10'));var as=require(_0xd986('0x11'));var hardwareService=require(_0xd986('0x12'));var logger=require(_0xd986('0x13'))(_0xd986('0x14'));var utils=require(_0xd986('0x15'));var config=require(_0xd986('0x16'));var licenseUtil=require(_0xd986('0x17'));var db=require(_0xd986('0x18'))['db'];config[_0xd986('0x19')]=_[_0xd986('0x1a')](config[_0xd986('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd986('0x1b'))(new Redis(config[_0xd986('0x19')]));require(_0xd986('0x1c'))[_0xd986('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd986('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0xd986('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x176d43,_0x4d9183,_0x4ca47f,_0x18119a){return new BPromise(function(_0x26bb5f,_0x3bc725){var _0x43daa1=_0x18119a||client;return _0x43daa1[_0xd986('0x20')](_0x176d43,_0x4ca47f)[_0xd986('0x21')](function(_0x247222){logger['info'](_0xd986('0x22'),_0x4d9183,_0xd986('0x23'));logger[_0xd986('0x24')](_0xd986('0x25'),_0x4d9183,_0xd986('0x23'),JSON[_0xd986('0x26')](_0x247222));if(_0x247222[_0xd986('0x27')]){if(_0x247222[_0xd986('0x27')][_0xd986('0x28')]===0x1f4){logger[_0xd986('0x27')](_0xd986('0x22'),_0x4d9183,_0x247222['error'][_0xd986('0x29')]);return _0x3bc725(_0x247222['error'][_0xd986('0x29')]);}logger['error'](_0xd986('0x22'),_0x4d9183,_0x247222[_0xd986('0x27')][_0xd986('0x29')]);return _0x26bb5f(_0x247222['error'][_0xd986('0x29')]);}else{logger[_0xd986('0x2a')](_0xd986('0x22'),_0x4d9183,_0xd986('0x23'));_0x26bb5f(_0x247222[_0xd986('0x2b')]['message']);}})[_0xd986('0x2c')](function(_0xb4f9b2){logger[_0xd986('0x27')](_0xd986('0x22'),_0x4d9183,_0xb4f9b2);_0x3bc725(_0xb4f9b2);});});}function respondWithStatusCode(_0xe9051a,_0x344418){_0x344418=_0x344418||0xcc;return function(_0x325df3){if(_0x325df3){return _0xe9051a['sendStatus'](_0x344418);}return _0xe9051a[_0xd986('0x2d')](_0x344418)[_0xd986('0x2e')]();};}function respondWithResult(_0x8bc54c,_0x155e36){_0x155e36=_0x155e36||0xc8;return function(_0x472fd7){if(_0x472fd7){return _0x8bc54c['status'](_0x155e36)[_0xd986('0x2f')](_0x472fd7);}};}function respondWithFilteredResult(_0xe06ff5,_0x3fdb33){return function(_0xba876d){if(_0xba876d){var _0x194598=typeof _0x3fdb33[_0xd986('0x30')]==='undefined'&&typeof _0x3fdb33[_0xd986('0x31')]===_0xd986('0x32');var _0x54d1b9=_0xba876d[_0xd986('0x33')];var _0x1b8db2=_0x194598?0x0:_0x3fdb33['offset'];var _0x10a3d5=_0x194598?_0xba876d[_0xd986('0x33')]:_0x3fdb33[_0xd986('0x30')]+_0x3fdb33['limit'];var _0x1268d9;if(_0x10a3d5>=_0x54d1b9){_0x10a3d5=_0x54d1b9;_0x1268d9=0xc8;}else{_0x1268d9=0xce;}_0xe06ff5[_0xd986('0x2d')](_0x1268d9);return _0xe06ff5['set']('Content-Range',_0x1b8db2+'-'+_0x10a3d5+'/'+_0x54d1b9)[_0xd986('0x2f')](_0xba876d);}return null;};}function patchUpdates(_0x58dc76){return function(_0x3fb954){try{jsonpatch['apply'](_0x3fb954,_0x58dc76,!![]);}catch(_0x10035a){return BPromise[_0xd986('0x34')](_0x10035a);}return _0x3fb954['save']();};}function saveUpdates(_0x3a55a2,_0x106a00){return function(_0x4def5e){if(_0x4def5e){return _0x4def5e[_0xd986('0x35')](_0x3a55a2)[_0xd986('0x21')](function(_0x540c59){return _0x540c59;});}return null;};}function removeEntity(_0x58e926,_0x2b31b7){return function(_0x14335d){if(_0x14335d){return _0x14335d['destroy']()['then'](function(){var _0x54ab16=_0x14335d[_0xd986('0x36')]({'plain':!![]});var _0x109d52='FaxAccounts';return db[_0xd986('0x37')][_0xd986('0x38')]({'where':{'type':_0x109d52,'resourceId':_0x54ab16['id']}})[_0xd986('0x21')](function(){return _0x14335d;});})[_0xd986('0x21')](function(){_0x58e926[_0xd986('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7be6,_0x18fd3f){return function(_0x300b5d){if(!_0x300b5d){_0x5a7be6[_0xd986('0x39')](0x194);}return _0x300b5d;};}function handleError(_0x108fa5,_0x1c10bd){_0x1c10bd=_0x1c10bd||0x1f4;return function(_0x21281c){logger['error'](_0x21281c[_0xd986('0x3a')]);if(_0x21281c[_0xd986('0x3b')]){delete _0x21281c[_0xd986('0x3b')];}_0x108fa5[_0xd986('0x2d')](_0x1c10bd)[_0xd986('0x3c')](_0x21281c);};}exports[_0xd986('0x3d')]=function(_0x2dfdaa,_0x1b8e85){var _0x11e37d={'include':[{'model':db[_0xd986('0x3e')],'as':_0xd986('0x3f')}]},_0x244164={},_0x106997={'count':0x0,'rows':[]};var _0x16f841=_[_0xd986('0x40')](db[_0xd986('0x41')][_0xd986('0x42')],function(_0x2aea1a){return{'name':_0x2aea1a[_0xd986('0x43')],'type':_0x2aea1a[_0xd986('0x44')][_0xd986('0x45')]};});_0x244164['model']=_[_0xd986('0x40')](_0x16f841,_0xd986('0x3b'));_0x244164[_0xd986('0x46')]=_['keys'](_0x2dfdaa[_0xd986('0x46')]);_0x244164[_0xd986('0x47')]=_[_0xd986('0x48')](_0x244164[_0xd986('0x49')],_0x244164[_0xd986('0x46')]);_0x11e37d[_0xd986('0x4a')]=_[_0xd986('0x48')](_0x244164['model'],qs[_0xd986('0x4b')](_0x2dfdaa[_0xd986('0x46')][_0xd986('0x4b')]));_0x11e37d[_0xd986('0x4a')]=_0x11e37d[_0xd986('0x4a')][_0xd986('0x4c')]?_0x11e37d[_0xd986('0x4a')]:_0x244164[_0xd986('0x49')];if(!_0x2dfdaa[_0xd986('0x46')][_0xd986('0x4d')](_0xd986('0x4e'))){_0x11e37d[_0xd986('0x31')]=qs[_0xd986('0x31')](_0x2dfdaa[_0xd986('0x46')][_0xd986('0x31')]);_0x11e37d[_0xd986('0x30')]=qs[_0xd986('0x30')](_0x2dfdaa[_0xd986('0x46')][_0xd986('0x30')]);}_0x11e37d[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0x2dfdaa['query'][_0xd986('0x50')]);_0x11e37d['where']=qs[_0xd986('0x47')](_[_0xd986('0x51')](_0x2dfdaa[_0xd986('0x46')],_0x244164[_0xd986('0x47')]),_0x16f841);if(_0x2dfdaa[_0xd986('0x46')][_0xd986('0x52')]){_0x11e37d[_0xd986('0x53')]=_[_0xd986('0x54')](_0x11e37d['where'],{'$or':_['map'](_0x16f841,function(_0x399f4b){if(_0x399f4b[_0xd986('0x44')]!=='VIRTUAL'){var _0xb1d925={};_0xb1d925[_0x399f4b[_0xd986('0x3b')]]={'$like':'%'+_0x2dfdaa[_0xd986('0x46')][_0xd986('0x52')]+'%'};return _0xb1d925;}})});}_0x11e37d=_['merge']({},_0x11e37d,_0x2dfdaa[_0xd986('0x55')]);var _0x410392={'where':_0x11e37d[_0xd986('0x53')]};return db['FaxAccount'][_0xd986('0x33')](_0x410392)['then'](function(_0x579540){_0x106997[_0xd986('0x33')]=_0x579540;if(_0x2dfdaa['query'][_0xd986('0x56')]){_0x11e37d[_0xd986('0x57')]=[{'all':!![]}];}return db[_0xd986('0x41')][_0xd986('0x58')](_0x11e37d);})[_0xd986('0x21')](function(_0x3038b1){_0x106997[_0xd986('0x59')]=_0x3038b1;return _0x106997;})[_0xd986('0x21')](respondWithFilteredResult(_0x1b8e85,_0x11e37d))[_0xd986('0x2c')](handleError(_0x1b8e85,null));};exports['show']=function(_0x4c55da,_0x3c78ef){var _0x1759c6={'raw':![],'where':{'id':_0x4c55da[_0xd986('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x110ee0={};_0x110ee0[_0xd986('0x49')]=_['keys'](db[_0xd986('0x41')][_0xd986('0x42')]);_0x110ee0[_0xd986('0x46')]=_[_0xd986('0x5b')](_0x4c55da[_0xd986('0x46')]);_0x110ee0[_0xd986('0x47')]=_[_0xd986('0x48')](_0x110ee0[_0xd986('0x49')],_0x110ee0['query']);_0x1759c6[_0xd986('0x4a')]=_[_0xd986('0x48')](_0x110ee0['model'],qs['fields'](_0x4c55da[_0xd986('0x46')][_0xd986('0x4b')]));_0x1759c6[_0xd986('0x4a')]=_0x1759c6[_0xd986('0x4a')][_0xd986('0x4c')]?_0x1759c6[_0xd986('0x4a')]:_0x110ee0[_0xd986('0x49')];if(_0x4c55da['query']['includeAll']){_0x1759c6[_0xd986('0x57')]=[{'all':!![]}];}_0x1759c6=_['merge']({},_0x1759c6,_0x4c55da['options']);return db['FaxAccount'][_0xd986('0x5c')](_0x1759c6)[_0xd986('0x21')](handleEntityNotFound(_0x3c78ef,null))[_0xd986('0x21')](respondWithResult(_0x3c78ef,null))[_0xd986('0x2c')](handleError(_0x3c78ef,null));};exports[_0xd986('0x5d')]=function(_0x39b41e,_0x5c0553){return db[_0xd986('0x41')][_0xd986('0x5d')](_0x39b41e[_0xd986('0x5e')],{})['then'](function(_0x24175d){var _0x4b9b90=_0x39b41e[_0xd986('0x5f')][_0xd986('0x36')]({'plain':!![]});if(!_0x4b9b90)throw new Error(_0xd986('0x60'));if(_0x4b9b90[_0xd986('0x61')]==='user'){var _0x370ac6=_0x24175d['get']({'plain':!![]});var _0x553904='FaxAccounts';return db[_0xd986('0x62')][_0xd986('0x5c')]({'where':{'name':_0x553904,'userProfileId':_0x4b9b90['userProfileId']},'raw':!![]})[_0xd986('0x21')](function(_0x4a9780){if(_0x4a9780&&_0x4a9780[_0xd986('0x63')]===0x0){return db['UserProfileResource'][_0xd986('0x5d')]({'name':_0x370ac6[_0xd986('0x3b')],'resourceId':_0x370ac6['id'],'type':_0x4a9780[_0xd986('0x3b')],'sectionId':_0x4a9780['id']},{})[_0xd986('0x21')](function(){return _0x24175d;});}else{return _0x24175d;}})['catch'](function(_0x3bb949){logger['error'](_0xd986('0x64'),_0x3bb949);throw _0x3bb949;});}return _0x24175d;})['then'](respondWithResult(_0x5c0553,0xc9))[_0xd986('0x2c')](handleError(_0x5c0553,null));};exports['update']=function(_0x39f6ed,_0x5208dd){if(_0x39f6ed[_0xd986('0x5e')]['id']){delete _0x39f6ed['body']['id'];}return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x39f6ed[_0xd986('0x5a')]['id']},'include':[{'model':db[_0xd986('0x3e')],'as':_0xd986('0x3f')}]})[_0xd986('0x21')](handleEntityNotFound(_0x5208dd,null))[_0xd986('0x21')](saveUpdates(_0x39f6ed['body'],null))[_0xd986('0x21')](respondWithResult(_0x5208dd,null))['catch'](handleError(_0x5208dd,null));};exports[_0xd986('0x38')]=function(_0x2dc639,_0xd5ca25){return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x2dc639['params']['id']}})['then'](handleEntityNotFound(_0xd5ca25,null))[_0xd986('0x21')](removeEntity(_0xd5ca25,null))['catch'](handleError(_0xd5ca25,null));};exports[_0xd986('0x65')]=function(_0x3bae51,_0xf9422){return db[_0xd986('0x41')][_0xd986('0x65')]()[_0xd986('0x21')](respondWithResult(_0xf9422,null))[_0xd986('0x2c')](handleError(_0xf9422,null));};exports[_0xd986('0x66')]=function(_0x1094fa,_0x316ef4,_0x335b61){if(_0x1094fa['body']['id']){delete _0x1094fa[_0xd986('0x5e')]['id'];}return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x1094fa[_0xd986('0x5a')]['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x316ef4,null))['then'](function(_0x5be546){if(_0x5be546){_0x1094fa['body'][_0xd986('0x67')]=_0x5be546['id'];return db['Disposition'][_0xd986('0x5d')](_0x1094fa[_0xd986('0x5e')]);}})[_0xd986('0x21')](respondWithResult(_0x316ef4,null))['catch'](handleError(_0x316ef4,null));};exports[_0xd986('0x68')]=function(_0x57d8bf,_0x3b78ac,_0x5c811f){var _0x50507e={'raw':![],'where':{}};var _0x4bda18={};var _0x4e1925={'count':0x0,'rows':[]};return db[_0xd986('0x41')][_0xd986('0x69')]({'where':{'id':_0x57d8bf[_0xd986('0x5a')]['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x3b78ac,null))[_0xd986('0x21')](function(_0xedf8db){if(_0xedf8db){_0x4bda18[_0xd986('0x49')]=_['keys'](db[_0xd986('0x6a')][_0xd986('0x42')]);_0x4bda18[_0xd986('0x46')]=_['keys'](_0x57d8bf['query']);_0x4bda18['filters']=_[_0xd986('0x48')](_0x4bda18['model'],_0x4bda18[_0xd986('0x46')]);_0x50507e[_0xd986('0x4a')]=_[_0xd986('0x48')](_0x4bda18['model'],qs[_0xd986('0x4b')](_0x57d8bf['query']['fields']));_0x50507e['attributes']=_0x50507e[_0xd986('0x4a')][_0xd986('0x4c')]?_0x50507e['attributes']:_0x4bda18[_0xd986('0x49')];if(!_0x57d8bf[_0xd986('0x46')][_0xd986('0x4d')]('nolimit')){_0x50507e[_0xd986('0x31')]=qs[_0xd986('0x31')](_0x57d8bf[_0xd986('0x46')]['limit']);_0x50507e[_0xd986('0x30')]=qs[_0xd986('0x30')](_0x57d8bf[_0xd986('0x46')]['offset']);}_0x50507e[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0x57d8bf[_0xd986('0x46')][_0xd986('0x50')]);_0x50507e['where']=qs[_0xd986('0x47')](_[_0xd986('0x51')](_0x57d8bf['query'],_0x4bda18[_0xd986('0x47')]));_0x50507e['where']['FaxAccountId']=_0xedf8db['id'];if(_0x57d8bf['query'][_0xd986('0x52')]){_0x50507e[_0xd986('0x53')]=_[_0xd986('0x54')](_0x50507e['where'],{'$or':_[_0xd986('0x40')](_0x50507e[_0xd986('0x4a')],function(_0x3f5399){var _0x48e40b={};_0x48e40b[_0x3f5399]={'$like':'%'+_0x57d8bf[_0xd986('0x46')][_0xd986('0x52')]+'%'};return _0x48e40b;})});}_0x50507e=_[_0xd986('0x54')]({},_0x50507e,_0x57d8bf[_0xd986('0x55')]);return db[_0xd986('0x6a')][_0xd986('0x33')]({'where':_0x50507e[_0xd986('0x53')]})[_0xd986('0x21')](function(_0x15f50c){_0x4e1925[_0xd986('0x33')]=_0x15f50c;if(_0x57d8bf[_0xd986('0x46')]['includeAll']){_0x50507e[_0xd986('0x57')]=[{'all':!![]}];}return db[_0xd986('0x6a')][_0xd986('0x58')](_0x50507e);})[_0xd986('0x21')](function(_0x971860){_0x4e1925['rows']=_0x971860;return _0x4e1925;});}})[_0xd986('0x21')](respondWithFilteredResult(_0x3b78ac,_0x50507e))[_0xd986('0x2c')](handleError(_0x3b78ac,null));};exports['removeDispositions']=function(_0x10468b,_0x59e4fb,_0x24ca7e){return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x10468b['params']['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x59e4fb,null))[_0xd986('0x21')](function(_0x4aa96d){if(_0x4aa96d){return _0x4aa96d[_0xd986('0x6b')](_0x10468b['query'][_0xd986('0x6c')]);}})[_0xd986('0x21')](respondWithStatusCode(_0x59e4fb,null))['catch'](handleError(_0x59e4fb,null));};exports[_0xd986('0x6d')]=function(_0x528dc9,_0x3e8833,_0x2c68c7){if(_0x528dc9[_0xd986('0x5e')]['id']){delete _0x528dc9[_0xd986('0x5e')]['id'];}return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x528dc9[_0xd986('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3e8833,null))[_0xd986('0x21')](function(_0x395ab1){if(_0x395ab1){_0x528dc9['body'][_0xd986('0x67')]=_0x395ab1['id'];return db[_0xd986('0x6e')][_0xd986('0x5d')](_0x528dc9[_0xd986('0x5e')]);}})[_0xd986('0x21')](respondWithResult(_0x3e8833,null))[_0xd986('0x2c')](handleError(_0x3e8833,null));};exports['getAnswers']=function(_0x1fa1ce,_0x3cfbb9,_0x216378){var _0x568a29={'raw':![],'where':{}};var _0x57defd={};var _0x4ab389={'count':0x0,'rows':[]};return db[_0xd986('0x41')][_0xd986('0x69')]({'where':{'id':_0x1fa1ce[_0xd986('0x5a')]['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x3cfbb9,null))[_0xd986('0x21')](function(_0x1f870d){if(_0x1f870d){_0x57defd['model']=_[_0xd986('0x5b')](db[_0xd986('0x6e')]['rawAttributes']);_0x57defd['query']=_['keys'](_0x1fa1ce[_0xd986('0x46')]);_0x57defd[_0xd986('0x47')]=_[_0xd986('0x48')](_0x57defd['model'],_0x57defd[_0xd986('0x46')]);_0x568a29[_0xd986('0x4a')]=_[_0xd986('0x48')](_0x57defd[_0xd986('0x49')],qs[_0xd986('0x4b')](_0x1fa1ce[_0xd986('0x46')][_0xd986('0x4b')]));_0x568a29['attributes']=_0x568a29[_0xd986('0x4a')][_0xd986('0x4c')]?_0x568a29[_0xd986('0x4a')]:_0x57defd['model'];if(!_0x1fa1ce[_0xd986('0x46')][_0xd986('0x4d')]('nolimit')){_0x568a29[_0xd986('0x31')]=qs[_0xd986('0x31')](_0x1fa1ce[_0xd986('0x46')][_0xd986('0x31')]);_0x568a29['offset']=qs[_0xd986('0x30')](_0x1fa1ce['query']['offset']);}_0x568a29[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0x1fa1ce[_0xd986('0x46')]['sort']);_0x568a29[_0xd986('0x53')]=qs[_0xd986('0x47')](_[_0xd986('0x51')](_0x1fa1ce[_0xd986('0x46')],_0x57defd[_0xd986('0x47')]));_0x568a29['where']['FaxAccountId']=_0x1f870d['id'];if(_0x1fa1ce[_0xd986('0x46')][_0xd986('0x52')]){_0x568a29[_0xd986('0x53')]=_['merge'](_0x568a29[_0xd986('0x53')],{'$or':_['map'](_0x568a29[_0xd986('0x4a')],function(_0x5ea18c){var _0x5d5568={};_0x5d5568[_0x5ea18c]={'$like':'%'+_0x1fa1ce['query'][_0xd986('0x52')]+'%'};return _0x5d5568;})});}_0x568a29=_[_0xd986('0x54')]({},_0x568a29,_0x1fa1ce['options']);return db[_0xd986('0x6e')][_0xd986('0x33')]({'where':_0x568a29[_0xd986('0x53')]})[_0xd986('0x21')](function(_0x4c5889){_0x4ab389[_0xd986('0x33')]=_0x4c5889;if(_0x1fa1ce['query'][_0xd986('0x56')]){_0x568a29[_0xd986('0x57')]=[{'all':!![]}];}return db[_0xd986('0x6e')][_0xd986('0x58')](_0x568a29);})['then'](function(_0x1c2c48){_0x4ab389[_0xd986('0x59')]=_0x1c2c48;return _0x4ab389;});}})['then'](respondWithFilteredResult(_0x3cfbb9,_0x568a29))[_0xd986('0x2c')](handleError(_0x3cfbb9,null));};exports['removeAnswers']=function(_0x3da9cc,_0x47c19e,_0x5750e4){return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x3da9cc[_0xd986('0x5a')]['id']}})['then'](handleEntityNotFound(_0x47c19e,null))['then'](function(_0x58cccc){if(_0x58cccc){return _0x58cccc['removeAnswers'](_0x3da9cc[_0xd986('0x46')][_0xd986('0x6c')]);}})[_0xd986('0x21')](respondWithStatusCode(_0x47c19e,null))['catch'](handleError(_0x47c19e,null));};exports[_0xd986('0x6f')]=function(_0x12ecb2,_0x2708a6,_0x3e4e52){return db[_0xd986('0x70')][_0xd986('0x5c')]({'where':{'id':_0x12ecb2[_0xd986('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2708a6,null))[_0xd986('0x21')](function(_0x2738ab){if(_0x2738ab){return _0x2738ab[_0xd986('0x6f')](_0x12ecb2[_0xd986('0x5e')]['ids'],_['omit'](_0x12ecb2[_0xd986('0x5e')],[_0xd986('0x6c'),'id'])||{});}})[_0xd986('0x21')](respondWithResult(_0x2708a6,null))[_0xd986('0x2c')](handleError(_0x2708a6,null));};exports[_0xd986('0x71')]=function(_0x21ca82,_0x1d7181,_0x31a809){var _0x26236f={'raw':![],'where':{}};var _0x13c7b2={};var _0x524df9={'count':0x0,'rows':[]};return db[_0xd986('0x41')][_0xd986('0x69')]({'where':{'id':_0x21ca82[_0xd986('0x5a')]['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x1d7181,null))[_0xd986('0x21')](function(_0x39ad73){if(_0x39ad73){_0x13c7b2['model']=_[_0xd986('0x5b')](db[_0xd986('0x70')]['rawAttributes']);_0x13c7b2[_0xd986('0x46')]=_[_0xd986('0x5b')](_0x21ca82[_0xd986('0x46')]);_0x13c7b2[_0xd986('0x47')]=_[_0xd986('0x48')](_0x13c7b2['model'],_0x13c7b2[_0xd986('0x46')]);_0x26236f[_0xd986('0x4a')]=_[_0xd986('0x48')](_0x13c7b2[_0xd986('0x49')],qs[_0xd986('0x4b')](_0x21ca82[_0xd986('0x46')][_0xd986('0x4b')]));_0x26236f[_0xd986('0x4a')]=_0x26236f[_0xd986('0x4a')][_0xd986('0x4c')]?_0x26236f[_0xd986('0x4a')]:_0x13c7b2['model'];if(!_0x21ca82[_0xd986('0x46')][_0xd986('0x4d')](_0xd986('0x4e'))){_0x26236f[_0xd986('0x31')]=qs['limit'](_0x21ca82[_0xd986('0x46')][_0xd986('0x31')]);_0x26236f[_0xd986('0x30')]=qs['offset'](_0x21ca82[_0xd986('0x46')][_0xd986('0x30')]);}_0x26236f[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0x21ca82[_0xd986('0x46')][_0xd986('0x50')]);_0x26236f['where']=qs['filters'](_['pick'](_0x21ca82[_0xd986('0x46')],_0x13c7b2['filters']));_0x26236f[_0xd986('0x53')][_0xd986('0x67')]=_0x39ad73['id'];if(_0x21ca82['query'][_0xd986('0x52')]){_0x26236f[_0xd986('0x53')]=_[_0xd986('0x54')](_0x26236f[_0xd986('0x53')],{'$or':_[_0xd986('0x40')](_0x26236f['attributes'],function(_0x579866){var _0x544aab={};_0x544aab[_0x579866]={'$like':'%'+_0x21ca82[_0xd986('0x46')]['filter']+'%'};return _0x544aab;})});}_0x26236f=_[_0xd986('0x54')]({},_0x26236f,_0x21ca82[_0xd986('0x55')]);return db['FaxInteraction']['count']({'where':_0x26236f[_0xd986('0x53')]})[_0xd986('0x21')](function(_0x28599d){_0x524df9[_0xd986('0x33')]=_0x28599d;if(_0x21ca82[_0xd986('0x46')][_0xd986('0x56')]){_0x26236f[_0xd986('0x57')]=[{'model':db[_0xd986('0x72')],'as':_0xd986('0x73'),'required':![]},{'model':db[_0xd986('0x74')],'as':_0xd986('0x75'),'attributes':[_0xd986('0x3b'),_0xd986('0x76'),'internal'],'required':![]},{'model':db[_0xd986('0x77')],'as':_0xd986('0x78'),'attributes':['id',_0xd986('0x3b'),_0xd986('0x79')],'where':_0x21ca82[_0xd986('0x46')]['tag']?{'id':_0x21ca82[_0xd986('0x46')]['tag']}:undefined,'required':_0x21ca82[_0xd986('0x46')][_0xd986('0x7a')]?!![]:![]}];}return db[_0xd986('0x70')]['findAll'](_0x26236f);})[_0xd986('0x21')](function(_0x1e0856){_0x524df9['rows']=_0x1e0856;return _0x524df9;});}})[_0xd986('0x21')](respondWithFilteredResult(_0x1d7181,_0x26236f))[_0xd986('0x2c')](handleError(_0x1d7181,null));};exports[_0xd986('0x7b')]=function(_0x4e6870,_0x3b3563){var _0x35b1ac=_0x4e6870['params']['id'];var _0x216a03=_0x4e6870[_0xd986('0x5e')];var _0x4fec46=0xc8;var _0x2719d4=null;return db['sequelize'][_0xd986('0x7c')]({'isolationLevel':db[_0xd986('0x7d')]['Transaction'][_0xd986('0x7e')][_0xd986('0x7f')]},function(_0x4ec736){return db[_0xd986('0x41')][_0xd986('0x69')]({'where':{'id':_0x35b1ac},'transaction':_0x4ec736})[_0xd986('0x21')](function(_0x512553){if(_0x512553){return db['FaxApplication'][_0xd986('0x38')]({'where':{'FaxAccountId':_0x35b1ac},'transaction':_0x4ec736})[_0xd986('0x21')](function(){var _0x4dedbc=_[_0xd986('0x40')](_0x216a03,function(_0x32178b){_0x32178b[_0xd986('0x67')]=_0x35b1ac;return _0x32178b;});return db[_0xd986('0x80')]['bulkCreate'](_0x4dedbc,{'transaction':_0x4ec736});});}else{_0x4fec46=0x194;_0x2719d4=[];}});})[_0xd986('0x21')](function(){if(_0x4fec46!==0x194){return db[_0xd986('0x80')][_0xd986('0x81')]({'where':{'FaxAccountId':_0x35b1ac},'order':_0xd986('0x82')})[_0xd986('0x21')](function(_0x146d5f){_0x2719d4=_0x146d5f;});}})[_0xd986('0x2c')](function(_0x304f26){_0x4fec46=0x1f4;logger['error'](_0x304f26['stack']);if(_0x304f26[_0xd986('0x3b')]){delete _0x304f26[_0xd986('0x3b')];}_0x2719d4=_0x304f26;})[_0xd986('0x83')](function(){if(_0x2719d4===null){_0x3b3563['sendStatus'](_0x4fec46);}else{if(_0x4fec46===0x1f4){_0x3b3563[_0xd986('0x2d')](_0x4fec46)[_0xd986('0x3c')](_0x2719d4);}else{_0x3b3563[_0xd986('0x2d')](_0x4fec46)[_0xd986('0x2f')](_0x2719d4);}}});};exports[_0xd986('0x84')]=function(_0x49a458,_0x5d55f9,_0xf810f1){var _0x8d61ed={};var _0x2ee62d={};var _0x41aacc;var _0x2b12e2;return db[_0xd986('0x41')][_0xd986('0x69')]({'where':{'id':_0x49a458[_0xd986('0x5a')]['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x5d55f9,null))[_0xd986('0x21')](function(_0x5d5441){if(_0x5d5441){_0x41aacc=_0x5d5441;_0x2ee62d['model']=_[_0xd986('0x5b')](db[_0xd986('0x80')]['rawAttributes']);_0x2ee62d[_0xd986('0x46')]=_[_0xd986('0x5b')](_0x49a458[_0xd986('0x46')]);_0x2ee62d['filters']=_[_0xd986('0x48')](_0x2ee62d[_0xd986('0x49')],_0x2ee62d[_0xd986('0x46')]);_0x8d61ed['attributes']=_['intersection'](_0x2ee62d[_0xd986('0x49')],qs[_0xd986('0x4b')](_0x49a458[_0xd986('0x46')][_0xd986('0x4b')]));_0x8d61ed[_0xd986('0x4a')]=_0x8d61ed['attributes'][_0xd986('0x4c')]?_0x8d61ed[_0xd986('0x4a')]:_0x2ee62d[_0xd986('0x49')];_0x8d61ed[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0x49a458[_0xd986('0x46')]['sort']);_0x8d61ed['where']=qs[_0xd986('0x47')](_['pick'](_0x49a458['query'],_0x2ee62d[_0xd986('0x47')]));if(_0x49a458[_0xd986('0x46')]['filter']){_0x8d61ed[_0xd986('0x53')]=_[_0xd986('0x54')](_0x8d61ed[_0xd986('0x53')],{'$or':_[_0xd986('0x40')](_0x8d61ed['attributes'],function(_0x303404){var _0x454016={};_0x454016[_0x303404]={'$like':'%'+_0x49a458[_0xd986('0x46')][_0xd986('0x52')]+'%'};return _0x454016;})});}_0x8d61ed=_['merge']({},_0x8d61ed,_0x49a458[_0xd986('0x55')]);return _0x41aacc[_0xd986('0x84')](_0x8d61ed);}})[_0xd986('0x21')](function(_0xcc8472){if(_0xcc8472){_0x2b12e2=_0xcc8472[_0xd986('0x4c')];if(!_0x49a458[_0xd986('0x46')][_0xd986('0x4d')](_0xd986('0x4e'))){_0x8d61ed['limit']=qs[_0xd986('0x31')](_0x49a458[_0xd986('0x46')][_0xd986('0x31')]);_0x8d61ed[_0xd986('0x30')]=qs[_0xd986('0x30')](_0x49a458[_0xd986('0x46')][_0xd986('0x30')]);}return _0x41aacc[_0xd986('0x84')](_0x8d61ed);}})['then'](function(_0x3280d8){if(_0x3280d8){return _0x3280d8?{'count':_0x2b12e2,'rows':_0x3280d8}:null;}})[_0xd986('0x21')](respondWithResult(_0x5d55f9,null))[_0xd986('0x2c')](handleError(_0x5d55f9,null));};function Extension(_0x328393,_0x262ca8,_0x57e882,_0xf5f0c5){this[_0xd986('0x85')]=_0xd986('0x86');this[_0xd986('0x87')]=_0x328393[_0xd986('0x88')];this[_0xd986('0x89')]=_0xf5f0c5;this['type']=_0xd986('0x8a');this[_0xd986('0x8b')]=_0xd986('0x8c');this[_0xd986('0x67')]=_0x328393['id'];this[_0xd986('0x82')]=_0x262ca8;this['appdata']=_0x57e882;}function createExtensionsReciveFax(_0x10179a){var _0x345068=0x1;var _0x13229c=[];_0x13229c[_0xd986('0x8d')](new Extension(_0x10179a,_0x345068,'','Answer'));_0x345068+=0x1;_0x13229c['push'](new Extension(_0x10179a,_0x345068,_0xd986('0x8e'),'Set'));_0x345068+=0x1;for(var _0x3a50cd in _0x10179a){if(_0x10179a['hasOwnProperty'](_0x3a50cd)&&(_0x3a50cd==='ecm'||_0x3a50cd===_0xd986('0x88')||_0x3a50cd===_0xd986('0x8f')||_0x3a50cd===_0xd986('0x90')||_0x3a50cd===_0xd986('0x91')||_0x3a50cd===_0xd986('0x92')||_0x3a50cd===_0xd986('0x93')||_0x3a50cd===_0xd986('0x94')||_0x3a50cd==='t38timeout')){_0x13229c[_0xd986('0x8d')](new Extension(_0x10179a,_0x345068,_0xd986('0x95')+_0x3a50cd+')='+_0x10179a[_0x3a50cd],'Set'));_0x345068+=0x1;}}_0x13229c['push'](new Extension(_0x10179a,_0x345068,'6','Wait'));_0x345068+=0x1;_0x13229c[_0xd986('0x8d')](new Extension(_0x10179a,_0x345068,'/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',_0xd986('0x96')));_0x345068=0x0;return _0x13229c;}exports['addAccountApplications']=function(_0x52b9fe,_0x19efa3,_0x56d924){var _0xfa3deb;return db[_0xd986('0x7d')][_0xd986('0x7c')](function(_0xfdf7d0){return db['FaxAccount'][_0xd986('0x5d')](_0x52b9fe[_0xd986('0x5e')],{'transaction':_0xfdf7d0})[_0xd986('0x21')](function(_0x541c96){_0xfa3deb=_0x541c96['get']({'plain':!![]});return db['VoiceExtension'][_0xd986('0x97')](createExtensionsReciveFax(_0xfa3deb),{'transaction':_0xfdf7d0});});})[_0xd986('0x21')](function(){return _0xfa3deb;})[_0xd986('0x21')](respondWithResult(_0x19efa3,null))[_0xd986('0x2c')](handleError(_0x19efa3,null));};exports[_0xd986('0x98')]=function(_0x4f8202,_0x30dc8d,_0x2732a7){var _0x2534f6;return db[_0xd986('0x7d')][_0xd986('0x7c')](function(_0x294b58){return db[_0xd986('0x41')][_0xd986('0x35')](_0x4f8202[_0xd986('0x5e')],{'where':{'id':_0x4f8202[_0xd986('0x5e')]['id']},'transaction':_0x294b58})[_0xd986('0x21')](function(_0x4b566f){return db[_0xd986('0x99')][_0xd986('0x38')]({'where':{'FaxAccountId':_0x4f8202['body']['id']},'transaction':_0x294b58})[_0xd986('0x21')](function(_0x232356){return db[_0xd986('0x99')][_0xd986('0x97')](createExtensionsReciveFax(_[_0xd986('0x9a')](_0x4f8202['body'],[_0xd986('0x9b'),_0xd986('0x45'),_0xd986('0x9c'),_0xd986('0x9d'),'TrunkId',_0xd986('0x9e')])),{'transaction':_0x294b58});});});})[_0xd986('0x21')](function(){return db[_0xd986('0x41')][_0xd986('0x9f')](_0x4f8202[_0xd986('0x5e')]['id']);})['then'](respondWithResult(_0x30dc8d,null))[_0xd986('0x2c')](handleError(_0x30dc8d,null));};exports[_0xd986('0xa0')]=function(_0x44180e,_0x3e4346,_0x49490b){var _0x3bf370={'raw':!![],'where':{}};var _0x4d1561={};var _0x22bdbc={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd986('0x69')]({'where':{'id':_0x44180e['params']['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x3e4346,null))[_0xd986('0x21')](function(_0x5d626b){if(_0x5d626b){_0x4d1561[_0xd986('0x49')]=_[_0xd986('0x5b')](db[_0xd986('0xa1')]['rawAttributes']);_0x4d1561[_0xd986('0x46')]=_[_0xd986('0x5b')](_0x44180e['query']);_0x4d1561[_0xd986('0x47')]=_[_0xd986('0x48')](_0x4d1561[_0xd986('0x49')],_0x4d1561['query']);_0x3bf370['attributes']=_[_0xd986('0x48')](_0x4d1561[_0xd986('0x49')],qs[_0xd986('0x4b')](_0x44180e[_0xd986('0x46')][_0xd986('0x4b')]));_0x3bf370[_0xd986('0x4a')]=_0x3bf370[_0xd986('0x4a')][_0xd986('0x4c')]?_0x3bf370[_0xd986('0x4a')]:_0x4d1561[_0xd986('0x49')];if(!_0x44180e['query'][_0xd986('0x4d')](_0xd986('0x4e'))){_0x3bf370[_0xd986('0x31')]=qs[_0xd986('0x31')](_0x44180e['query'][_0xd986('0x31')]);_0x3bf370[_0xd986('0x30')]=qs[_0xd986('0x30')](_0x44180e[_0xd986('0x46')][_0xd986('0x30')]);}_0x3bf370['order']=qs[_0xd986('0x50')](_0x44180e[_0xd986('0x46')][_0xd986('0x50')]);_0x3bf370['where']=qs[_0xd986('0x47')](_[_0xd986('0x51')](_0x44180e[_0xd986('0x46')],_0x4d1561[_0xd986('0x47')]));_0x3bf370[_0xd986('0x53')][_0xd986('0x67')]=_0x5d626b['id'];if(_0x44180e[_0xd986('0x46')][_0xd986('0x52')]){_0x3bf370[_0xd986('0x53')]=_[_0xd986('0x54')](_0x3bf370[_0xd986('0x53')],{'$or':_[_0xd986('0x40')](_0x3bf370[_0xd986('0x4a')],function(_0x1c756b){var _0x5ce35d={};_0x5ce35d[_0x1c756b]={'$like':'%'+_0x44180e[_0xd986('0x46')][_0xd986('0x52')]+'%'};return _0x5ce35d;})});}if(_0x44180e[_0xd986('0x46')][_0xd986('0xa2')]){var _0x486539=_0x44180e[_0xd986('0x46')][_0xd986('0xa2')][_0xd986('0xa3')](',');var _0x42c1aa={};_0x42c1aa[_0x486539[0x0]]={'$gte':moment(_0x486539[0x1])[_0xd986('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3bf370[_0xd986('0x53')]=_['merge'](_0x3bf370[_0xd986('0x53')],_0x42c1aa);}_0x3bf370=_[_0xd986('0x54')]({},_0x3bf370,_0x44180e[_0xd986('0x55')]);return db[_0xd986('0xa1')][_0xd986('0x33')]({'where':_0x3bf370['where']})['then'](function(_0x7096f9){_0x22bdbc['count']=_0x7096f9;if(_0x44180e[_0xd986('0x46')]['includeAll']){_0x3bf370['include']=[{'all':!![]}];}return db[_0xd986('0xa1')][_0xd986('0x58')](_0x3bf370);})[_0xd986('0x21')](function(_0x136ddf){_0x22bdbc[_0xd986('0x59')]=_0x136ddf;return _0x22bdbc;});}})[_0xd986('0x21')](respondWithFilteredResult(_0x3e4346,_0x3bf370))[_0xd986('0x2c')](handleError(_0x3e4346,null));};exports['send']=function(_0x1dfef8,_0x4db6ec,_0x320bbd){var _0x4330b7,_0x401860={},_0x31c90d;if(_0x1dfef8[_0xd986('0x5e')]['to']){_0x31c90d=_0x1dfef8[_0xd986('0x5e')]['to'][0x0];}return db['FaxAccount'][_0xd986('0x5c')]({'where':{'id':_0x1dfef8['params']['id']},'include':[{'model':db[_0xd986('0xa5')],'as':_0xd986('0xa6'),'include':[{'model':db[_0xd986('0x72')],'as':'Contacts','where':{'fax':_0x31c90d},'limit':0x1,'order':[[_0xd986('0x9d'),_0xd986('0xa7')]]}]}]})[_0xd986('0x21')](handleEntityNotFound(_0x4db6ec,null))['then'](function(_0x56375c){_0x4330b7=_0x56375c;if(_0x1dfef8['body'][_0xd986('0xa8')]&&_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][_0xd986('0x4c')]){for(var _0x2e0f4d=0x0;_0x2e0f4d<_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][_0xd986('0x4c')];_0x2e0f4d+=0x1){_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][_0x2e0f4d]={'filename':_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][_0x2e0f4d][_0xd986('0x3b')],'id':_0x1dfef8['body'][_0xd986('0xa8')][_0x2e0f4d]['id'],'path':path['join'](config['root'],_0xd986('0xa9'),_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][_0x2e0f4d]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0xd986('0xaa'),{'FaxAccountId':_[_0xd986('0xab')](_0x1dfef8['params']['id'])?undefined:_0x1dfef8[_0xd986('0x5a')]['id'],'path':_['isNil'](_0x1dfef8[_0xd986('0x5e')]['attachments'][0x0][_0xd986('0xac')])?undefined:_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][0x0]['path'],'fax':_['isNil'](_0x1dfef8[_0xd986('0x5e')]['to'][0x0])?undefined:_0x1dfef8[_0xd986('0x5e')]['to'][0x0]},client9002);})[_0xd986('0x21')](function(){if(_0x4330b7){if(_[_0xd986('0xab')](_0x1dfef8['body'][_0xd986('0xad')])){_0x1dfef8['body'][_0xd986('0xad')]=util['format'](_0xd986('0xae'),_0x4330b7[_0xd986('0x3b')],_0x4330b7['fax']);}if(_0x4330b7[_0xd986('0xa6')]){if(_0x4330b7[_0xd986('0xa6')][_0xd986('0xaf')][_0xd986('0x4c')]){return _0x4330b7[_0xd986('0xa6')][_0xd986('0xaf')][0x0];}else{return db[_0xd986('0x72')][_0xd986('0x5d')](_[_0xd986('0x1a')](_0x1dfef8[_0xd986('0x5e')],{'firstName':_0x1dfef8[_0xd986('0x5e')]['to'][0x0],'phone':_0x1dfef8['body']['to'][0x0],'fax':_0x1dfef8[_0xd986('0x5e')]['to'][0x0],'ListId':_0x4330b7[_0xd986('0x9e')]}));}}else{throw new Error(_0xd986('0xb0'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xd986('0x21')](function(_0x47cfcc){if(_0x47cfcc){return db['FaxInteraction'][_0xd986('0x5c')]({'where':{'ContactId':_0x47cfcc['id'],'closed':![],'FaxAccountId':_0x4330b7['id']}})[_0xd986('0x21')](function(_0x2085d6){if(_0x2085d6){return[_0x2085d6,![]];}return db[_0xd986('0x70')]['create']({'UserId':_0x1dfef8[_0xd986('0x5f')]['id'],'ContactId':_0x47cfcc['id'],'FaxAccountId':_0x4330b7['id'],'fax':_0x1dfef8[_0xd986('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd986('0x54')](_0x1dfef8[_0xd986('0x5e')],{'read':![],'body':_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][0x0][_0xd986('0xb1')],'FaxAccountId':_0x4330b7['id'],'UserId':_0x1dfef8['user']['id'],'ContactId':_0x47cfcc['id'],'AttachmentId':_0x1dfef8['body'][_0xd986('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xd986('0xa1')],'as':_0xd986('0xb2')}]})['then'](function(_0x9c5479){return[_0x9c5479,!![]];});});}else{throw new Error(_0xd986('0xb3'));}})[_0xd986('0xb4')](function(_0x2132c8,_0x7ff8a4){if(_0x7ff8a4){return _0x2132c8;}return db[_0xd986('0xa1')][_0xd986('0x5d')]({'direction':_0xd986('0xb5'),'read':![],'body':_0x1dfef8['body'][_0xd986('0xa8')][0x0][_0xd986('0xb1')],'FaxAccountId':_0x4330b7['id'],'FaxInteractionId':_0x2132c8['id'],'UserId':_0x1dfef8[_0xd986('0x5f')]['id'],'ContactId':_0x2132c8[_0xd986('0xb6')],'AttachmentId':_0x1dfef8[_0xd986('0x5e')][_0xd986('0xa8')][0x0]['id']})[_0xd986('0x21')](function(_0x413d52){_0x2132c8[_0xd986('0xb7')][_0xd986('0xb2')]=[];_0x2132c8[_0xd986('0xb7')]['Messages'][_0xd986('0x8d')](_0x413d52['dataValues']);return _0x2132c8;});})[_0xd986('0x21')](function(_0xc1a3ec){respondWithRpcPromise(_0xd986('0xb8'),_0xd986('0xb8'),{'FaxAccountId':_[_0xd986('0xab')](_0x1dfef8['params']['id'])?undefined:_0x1dfef8[_0xd986('0x5a')]['id'],'path':_[_0xd986('0xab')](_0x1dfef8[_0xd986('0x5e')]['attachments'][0x0]['path'])?undefined:_0x1dfef8['body'][_0xd986('0xa8')][0x0][_0xd986('0xac')],'fax':_[_0xd986('0xab')](_0x1dfef8[_0xd986('0x5e')]['to'][0x0])?undefined:_0x1dfef8[_0xd986('0x5e')]['to'][0x0],'AttachmentId':_0x1dfef8['body'][_0xd986('0xa8')][0x0]['id']},client9002)[_0xd986('0x21')](function(_0x4fa185){logger[_0xd986('0x2a')]('SendFaxRpc,\x20%s',_0x4fa185);})[_0xd986('0x2c')](function(_0x34e7aa){logger[_0xd986('0x2a')]('SendFaxRpc,\x20%s',_0x34e7aa);});return _0xc1a3ec;})['then'](respondWithResult(_0x4db6ec,null))[_0xd986('0x2c')](handleError(_0x4db6ec,null));};exports[_0xd986('0xb9')]=function(_0x1dce7f,_0x314b25,_0x1c0c1d){return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x1dce7f[_0xd986('0x5a')]['id']}})['then'](handleEntityNotFound(_0x314b25,null))[_0xd986('0x21')](function(_0x436fe7){if(_0x436fe7){return _0x436fe7[_0xd986('0xb9')](_0x1dce7f['body']['ids'],_[_0xd986('0x9a')](_0x1dce7f['body'],[_0xd986('0x6c'),'id'])||{})[_0xd986('0xb4')](function(_0x138576){for(var _0x3e5be9=0x0;_0x3e5be9<_0x1dce7f[_0xd986('0x5e')][_0xd986('0x6c')]['length'];_0x3e5be9+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x1dce7f['body'][_0xd986('0x6c')][_0x3e5be9]),'FaxAccountId':Number(_0x1dce7f[_0xd986('0x5a')]['id'])});}return _0x138576;});}})[_0xd986('0x21')](respondWithResult(_0x314b25,null))[_0xd986('0x2c')](handleError(_0x314b25,null));};exports['removeAgents']=function(_0x549477,_0x3c7285,_0x43209d){return db[_0xd986('0x41')][_0xd986('0x5c')]({'where':{'id':_0x549477['params']['id']}})[_0xd986('0x21')](handleEntityNotFound(_0x3c7285,null))[_0xd986('0x21')](function(_0x2e8e16){if(_0x2e8e16){return _0x2e8e16['removeAgents'](_0x549477['query'][_0xd986('0x6c')])[_0xd986('0x21')](function(){if(_[_0xd986('0xba')](_0x549477['query'][_0xd986('0x6c')])){for(var _0x2009e9=0x0;_0x2009e9<_0x549477[_0xd986('0x46')][_0xd986('0x6c')][_0xd986('0x4c')];_0x2009e9+=0x1){socket[_0xd986('0xbb')](_0xd986('0xbc'),{'UserId':Number(_0x549477[_0xd986('0x46')]['ids'][_0x2009e9]),'FaxAccountId':Number(_0x549477[_0xd986('0x5a')]['id'])});}}else{socket[_0xd986('0xbb')]('userFaxAccount:remove',{'UserId':Number(_0x549477['query'][_0xd986('0x6c')]),'FaxAccountId':Number(_0x549477[_0xd986('0x5a')]['id'])});}});}})[_0xd986('0x21')](respondWithStatusCode(_0x3c7285,null))['catch'](handleError(_0x3c7285,null));};exports['getAgents']=function(_0xd979cf,_0x1a7858,_0x4e541f){var _0xd62db4={};var _0x26a297={};var _0x50e582;var _0x2432f5;return db[_0xd986('0x41')]['findOne']({'where':{'id':_0xd979cf[_0xd986('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1a7858,null))[_0xd986('0x21')](function(_0x115c28){if(_0x115c28){_0x50e582=_0x115c28;_0x26a297['model']=_[_0xd986('0x5b')](db[_0xd986('0x74')]['rawAttributes']);_0x26a297[_0xd986('0x46')]=_[_0xd986('0x5b')](_0xd979cf[_0xd986('0x46')]);_0x26a297[_0xd986('0x47')]=_[_0xd986('0x48')](_0x26a297[_0xd986('0x49')],_0x26a297[_0xd986('0x46')]);_0xd62db4[_0xd986('0x4a')]=_['intersection'](_0x26a297[_0xd986('0x49')],qs[_0xd986('0x4b')](_0xd979cf[_0xd986('0x46')][_0xd986('0x4b')]));_0xd62db4[_0xd986('0x4a')]=_0xd62db4[_0xd986('0x4a')][_0xd986('0x4c')]?_0xd62db4[_0xd986('0x4a')]:_0x26a297['model'];_0xd62db4[_0xd986('0x4f')]=qs[_0xd986('0x50')](_0xd979cf['query'][_0xd986('0x50')]);_0xd62db4[_0xd986('0x53')]=qs[_0xd986('0x47')](_[_0xd986('0x51')](_0xd979cf[_0xd986('0x46')],_0x26a297[_0xd986('0x47')]));if(_0xd979cf['query'][_0xd986('0x52')]){_0xd62db4['where']=_[_0xd986('0x54')](_0xd62db4[_0xd986('0x53')],{'$or':_[_0xd986('0x40')](_0xd62db4[_0xd986('0x4a')],function(_0x26316b){var _0x3f1adf={};_0x3f1adf[_0x26316b]={'$like':'%'+_0xd979cf['query'][_0xd986('0x52')]+'%'};return _0x3f1adf;})});}_0xd62db4=_[_0xd986('0x54')]({},_0xd62db4,_0xd979cf[_0xd986('0x55')]);return _0x50e582[_0xd986('0xbd')](_0xd62db4);}})[_0xd986('0x21')](function(_0x251f96){if(_0x251f96){_0x2432f5=_0x251f96[_0xd986('0x4c')];if(!_0xd979cf[_0xd986('0x46')][_0xd986('0x4d')]('nolimit')){_0xd62db4[_0xd986('0x31')]=qs[_0xd986('0x31')](_0xd979cf[_0xd986('0x46')]['limit']);_0xd62db4[_0xd986('0x30')]=qs['offset'](_0xd979cf[_0xd986('0x46')][_0xd986('0x30')]);}return _0x50e582[_0xd986('0xbd')](_0xd62db4);}})[_0xd986('0x21')](function(_0x584113){if(_0x584113){return _0x584113?{'count':_0x2432f5,'rows':_0x584113}:null;}})[_0xd986('0x21')](respondWithResult(_0x1a7858,null))[_0xd986('0x2c')](handleError(_0x1a7858,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5d96da0..f81698b 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 _0x0fe0=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0fe0,0x1d2));var _0x00fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fe0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x00fe('0x0'));var FaxAccount=require(_0x00fe('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x00fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x00fe('0x3')};function emitEvent(_0x5b8af5){return function(_0xbff9b,_0x1303e5,_0x5601dc){FaxAccountEvents[_0x00fe('0x4')](_0x5b8af5+':'+_0xbff9b['id'],_0xbff9b);FaxAccountEvents[_0x00fe('0x4')](_0x5b8af5,_0xbff9b);_0x5601dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x00fe('0x5')](e,emitEvent(event));}}module[_0x00fe('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xe48c=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','update'];(function(_0x504c8e,_0xc12a61){var _0x12180c=function(_0x4d8f5c){while(--_0x4d8f5c){_0x504c8e['push'](_0x504c8e['shift']());}};_0x12180c(++_0xc12a61);}(_0xe48c,0xd7));var _0xce48=function(_0x4d7dea,_0xdb2f6e){_0x4d7dea=_0x4d7dea-0x0;var _0x155a10=_0xe48c[_0x4d7dea];return _0x155a10;};'use strict';var EventEmitter=require(_0xce48('0x0'));var FaxAccount=require(_0xce48('0x1'))['db'][_0xce48('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce48('0x3'),'afterUpdate':_0xce48('0x4'),'afterDestroy':_0xce48('0x5')};function emitEvent(_0x2ed17a){return function(_0x269af5,_0x3f3a3f,_0x344967){FaxAccountEvents['emit'](_0x2ed17a+':'+_0x269af5['id'],_0x269af5);FaxAccountEvents[_0xce48('0x6')](_0x2ed17a,_0x269af5);_0x344967(null);};}for(var e in events){if(events[_0xce48('0x7')](e)){var event=events[e];FaxAccount[_0xce48('0x8')](e,emitEvent(event));}}module[_0xce48('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 540f51f..50b6f5b 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 _0xc6ad=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash'];(function(_0x17ebb6,_0x465af7){var _0x32ec22=function(_0x160ff0){while(--_0x160ff0){_0x17ebb6['push'](_0x17ebb6['shift']());}};_0x32ec22(++_0x465af7);}(_0xc6ad,0xdc));var _0xdc6a=function(_0x2c5fa2,_0x4db145){_0x2c5fa2=_0x2c5fa2-0x0;var _0x3894a5=_0xc6ad[_0x2c5fa2];return _0x3894a5;};'use strict';var _=require(_0xdc6a('0x0'));var util=require(_0xdc6a('0x1'));var logger=require('../../config/logger')(_0xdc6a('0x2'));var moment=require(_0xdc6a('0x3'));var BPromise=require(_0xdc6a('0x4'));var rp=require(_0xdc6a('0x5'));var fs=require('fs');var path=require(_0xdc6a('0x6'));var rimraf=require(_0xdc6a('0x7'));var config=require(_0xdc6a('0x8'));var attributes=require(_0xdc6a('0x9'));module[_0xdc6a('0xa')]=function(_0x52a21b,_0x129a1b){return _0x52a21b[_0xdc6a('0xb')]('FaxAccount',attributes,{'tableName':_0xdc6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8221=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8221,0x99));var _0x1822=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x8221[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var logger=require(_0x1822('0x2'))(_0x1822('0x3'));var moment=require(_0x1822('0x4'));var BPromise=require(_0x1822('0x5'));var rp=require(_0x1822('0x6'));var fs=require('fs');var path=require(_0x1822('0x7'));var rimraf=require(_0x1822('0x8'));var config=require(_0x1822('0x9'));var attributes=require(_0x1822('0xa'));module[_0x1822('0xb')]=function(_0x2c6d82,_0x51fa5d){return _0x2c6d82[_0x1822('0xc')](_0x1822('0xd'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f865eab..a9c92e4 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 _0x5da3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','body','fax','describe','Sequelize','ValidationError','keys','updatedAt','difference','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','create','FaxInteraction','find','Contact\x20not\x20found','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','queueId','unshift','queue','*,*,*,*','Start','startRouting','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5da3,0xee));var _0x35da=function(_0x13cdda,_0x4a0cd1){_0x13cdda=_0x13cdda-0x0;var _0x324b40=_0x5da3[_0x13cdda];return _0x324b40;};'use strict';var _=require(_0x35da('0x0'));var util=require(_0x35da('0x1'));var moment=require('moment');var BPromise=require(_0x35da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35da('0x3'));var db=require(_0x35da('0x4'))['db'];var utils=require(_0x35da('0x5'));var logger=require(_0x35da('0x6'))(_0x35da('0x7'));var config=require(_0x35da('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x35da('0x9')]['http']({'port':0x232c});config[_0x35da('0xa')]=_[_0x35da('0xb')](config[_0x35da('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35da('0xa')]));require(_0x35da('0xc'))['register'](socket);function respondWithRpcPromise(_0x4633db,_0x53a15e,_0x2ee196){return new BPromise(function(_0x218cda,_0x90329e){return client['request'](_0x4633db,_0x2ee196)[_0x35da('0xd')](function(_0x3d02d4){logger[_0x35da('0xe')](_0x35da('0xf'),_0x53a15e,_0x35da('0x10'));logger['debug'](_0x35da('0x11'),_0x53a15e,_0x35da('0x10'),JSON['stringify'](_0x3d02d4));if(_0x3d02d4[_0x35da('0x12')]){if(_0x3d02d4[_0x35da('0x12')]['code']===0x1f4){logger[_0x35da('0x12')]('FaxAccount,\x20%s,\x20%s',_0x53a15e,_0x3d02d4[_0x35da('0x12')]['message']);return _0x90329e(_0x3d02d4[_0x35da('0x12')][_0x35da('0x13')]);}logger[_0x35da('0x12')](_0x35da('0xf'),_0x53a15e,_0x3d02d4[_0x35da('0x12')][_0x35da('0x13')]);return _0x218cda(_0x3d02d4['error'][_0x35da('0x13')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x53a15e,_0x35da('0x10'));_0x218cda(_0x3d02d4[_0x35da('0x14')]['message']);}})['catch'](function(_0x270ac9){logger[_0x35da('0x12')](_0x35da('0xf'),_0x53a15e,_0x270ac9);_0x90329e(_0x270ac9);});});}exports[_0x35da('0x15')]=function(_0xebc0a9){var _0x5977e2=this;return new Promise(function(_0x4d9d2f,_0x57bff9){return db[_0x35da('0x16')][_0x35da('0x17')]({'raw':_0xebc0a9['options']?_0xebc0a9['options']['raw']===undefined?!![]:![]:!![],'where':_0xebc0a9['options']?_0xebc0a9[_0x35da('0x18')][_0x35da('0x19')]||null:null,'attributes':_0xebc0a9[_0x35da('0x18')]?_0xebc0a9[_0x35da('0x18')][_0x35da('0x1a')]||null:null,'limit':_0xebc0a9['options']?_0xebc0a9[_0x35da('0x18')][_0x35da('0x1b')]||null:null,'include':_0xebc0a9['options']?_0xebc0a9[_0x35da('0x18')][_0x35da('0x1c')]?_[_0x35da('0x1d')](_0xebc0a9[_0x35da('0x18')][_0x35da('0x1c')],function(_0x245125){return{'model':db[_0x245125['model']],'as':_0x245125['as'],'attributes':_0x245125[_0x35da('0x1a')],'include':_0x245125[_0x35da('0x1c')]?_[_0x35da('0x1d')](_0x245125[_0x35da('0x1c')],function(_0x5ddf09){return{'model':db[_0x5ddf09['model']],'as':_0x5ddf09['as'],'attributes':_0x5ddf09[_0x35da('0x1a')],'include':_0x5ddf09[_0x35da('0x1c')]?_[_0x35da('0x1d')](_0x5ddf09[_0x35da('0x1c')],function(_0x40d291){return{'model':db[_0x40d291[_0x35da('0x1e')]],'as':_0x40d291['as'],'attributes':_0x40d291[_0x35da('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x177c00){logger['info'](_0x35da('0x15'),_0xebc0a9);logger[_0x35da('0x1f')](_0x35da('0x15'),_0xebc0a9,JSON['stringify'](_0x177c00));_0x4d9d2f(_0x177c00);})[_0x35da('0x20')](function(_0x45ce60){logger[_0x35da('0x12')](_0x35da('0x15'),_0x45ce60[_0x35da('0x13')],_0xebc0a9);_0x57bff9(_0x5977e2['error'](0x1f4,_0x45ce60['message']));});});};exports['NotifyFaxAccount']=function(_0x19093d,_0x5c8a2a,_0x7e2101){var _0x4752ed=this;return new Promise(function(_0x457a30,_0x36f80a){var _0x53e0db={'body':_0x19093d[_0x35da('0x21')],'channel':_0x35da('0x22')};var _0x1e55e7=[];var _0x2d6cd1=[];var _0x2cba19={};return db['CmContact'][_0x35da('0x23')]()[_0x35da('0xd')](function(_0x144e10){if(!_0x144e10){throw new db[(_0x35da('0x24'))][(_0x35da('0x25'))]('no\x20available\x20attributes');}_0x1e55e7=_['difference'](_[_0x35da('0x26')](_0x144e10),['createdAt',_0x35da('0x27')]);_0x2d6cd1=_[_0x35da('0x28')](_[_0x35da('0x26')](_0x144e10),[_0x35da('0x29'),_0x35da('0x27'),'CompanyId',_0x35da('0x2a')]);if(_0x19093d['body']['id']){delete _0x19093d[_0x35da('0x21')]['id'];}if(_[_0x35da('0x2b')](_0x19093d[_0x35da('0x21')][_0x35da('0x2c')])){throw new db[(_0x35da('0x24'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x35da('0x2b')](_0x19093d[_0x35da('0x21')][_0x35da('0x21')])||_0x19093d[_0x35da('0x21')][_0x35da('0x21')]===''){throw new db[(_0x35da('0x24'))]['ValidationError'](_0x35da('0x2d'));}if(_['isNil'](_0x19093d[_0x35da('0x21')][_0x35da('0x2e')])){throw new db[(_0x35da('0x24'))]['ValidationError'](_0x35da('0x2f')+_0x2d6cd1);}if(!_[_0x35da('0x30')](_0x2d6cd1,_0x19093d[_0x35da('0x21')][_0x35da('0x2e')])){throw new db[(_0x35da('0x24'))][(_0x35da('0x25'))](_0x35da('0x31')+_0x2d6cd1);}_0x2cba19[_0x19093d['body'][_0x35da('0x2e')]]=_0x19093d[_0x35da('0x21')][_0x35da('0x2c')];})[_0x35da('0xd')](function(){return db[_0x35da('0x16')]['find']({'where':{'id':_0x19093d[_0x35da('0x32')]['id']},'include':[{'model':db['CmList'],'as':_0x35da('0x33'),'include':[{'model':db[_0x35da('0x34')],'as':_0x35da('0x35'),'where':_0x2cba19,'limit':0x1,'order':[[_0x35da('0x27'),_0x35da('0x36')]]}]},{'model':db[_0x35da('0x37')],'as':_0x35da('0x38')}]});})[_0x35da('0xd')](function(_0x564a15){if(_0x564a15&&_0x564a15[_0x35da('0x33')]){var _0x4e4461=_0x564a15[_0x35da('0x39')]({'plain':!![]});_0x53e0db[_0x35da('0x32')]=_0x4e4461;_0x53e0db[_0x35da('0x3a')]=_0x4e4461[_0x35da('0x38')];_0x53e0db[_0x35da('0x3b')]=_0x4e4461[_0x35da('0x33')];_0x53e0db['applications']=_['orderBy'](_0x53e0db[_0x35da('0x3a')],['priority'],['asc']);if(_0x53e0db[_0x35da('0x32')][_0x35da('0x38')]){delete _0x53e0db[_0x35da('0x32')]['Applications'];}if(_0x53e0db['account'][_0x35da('0x33')]&&_0x53e0db[_0x35da('0x32')][_0x35da('0x33')][_0x35da('0x35')]['length']){return _0x53e0db['account'][_0x35da('0x33')]['Contacts'][0x0];}var _0x1b87a0=_[_0x35da('0xb')](_0x19093d[_0x35da('0x21')],{'firstName':_0x19093d[_0x35da('0x21')][_0x35da('0x2c')],'ListId':_0x4e4461[_0x35da('0x2a')]});_0x1b87a0[_0x19093d['body'][_0x35da('0x2e')]]=_0x19093d[_0x35da('0x21')][_0x35da('0x2c')];return db['CmContact'][_0x35da('0x3c')](_0x1b87a0,{'fields':_0x1e55e7,'raw':!![]});}})[_0x35da('0xd')](function(_0x2e4f0c){_0x53e0db['contact']=_0x2e4f0c;if(_0x2e4f0c){var _0x58c4b1={'ContactId':_0x2e4f0c['id'],'FaxAccountId':_0x19093d[_0x35da('0x32')]['id'],'fax':_0x2e4f0c[_0x35da('0x22')]};return db[_0x35da('0x3d')][_0x35da('0x3e')]({'where':{'ContactId':_0x2e4f0c['id'],'closed':![],'FaxAccountId':_0x19093d[_0x35da('0x32')]['id']}})['then'](function(_0x5558a1){if(_0x5558a1){return[_0x5558a1,![]];}return db[_0x35da('0x3d')][_0x35da('0x3c')](_0x58c4b1)[_0x35da('0xd')](function(_0x3a6f9d){return[_0x3a6f9d,!![]];});});}else{throw new Error(_0x35da('0x3f'));}})['spread'](function(_0x5ee650,_0x1a1708){var _0x439ea0=_0x5ee650[_0x35da('0x39')]({'plain':!![]});if(_0x1a1708){if(_0x53e0db[_0x35da('0x32')]['autoclose']){_0x53e0db[_0x35da('0x3a')][_0x35da('0x40')]({'id':0x0,'priority':_0x53e0db[_0x35da('0x3a')]['length']+0x1,'app':_0x35da('0x41'),'appdata':_0x35da('0x42'),'interval':'*,*,*,*'});}_0x439ea0[_0x35da('0x43')]=!![];}else{_0x439ea0['created']=![];}_0x53e0db[_0x35da('0x44')]=_0x439ea0;return db[_0x35da('0x45')][_0x35da('0x3c')]({'body':_0x19093d['body'][_0x35da('0x21')],'FaxAccountId':_0x19093d['account']['id'],'FaxInteractionId':_0x5ee650['id'],'direction':'in','ContactId':_0x5ee650[_0x35da('0x46')],'AttachmentId':_0x19093d[_0x35da('0x21')][_0x35da('0x47')]});})['then'](function(_0x54683b){_0x53e0db['message']=_0x54683b;if(!_0x53e0db['interaction']['UserId'])return;return db[_0x35da('0x48')][_0x35da('0x3e')]({'attributes':['id',_0x35da('0x49')],'where':{'id':_0x53e0db[_0x35da('0x44')]['UserId']}});})[_0x35da('0xd')](function(_0x34c7c9){if(_0x34c7c9){_0x53e0db[_0x35da('0x3a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x34c7c9['name']+','+(_0x53e0db[_0x35da('0x32')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x53e0db[_0x35da('0x44')]['queueId'])return;return db['FaxQueue'][_0x35da('0x3e')]({'attributes':['id',_0x35da('0x49')],'where':{'id':_0x53e0db[_0x35da('0x44')][_0x35da('0x4a')]}});})[_0x35da('0xd')](function(_0xc3ce1b){if(_0xc3ce1b){_0x53e0db[_0x35da('0x3a')][_0x35da('0x4b')]({'id':0x0,'priority':0x1,'app':_0x35da('0x4c'),'appdata':_0xc3ce1b['name']+','+(_0x53e0db['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x35da('0x4d')});}return respondWithRpcPromise(_0x35da('0x4e'),_0x35da('0x4f'),_0x53e0db);})[_0x35da('0xd')](function(_0x5b7faa){_0x457a30(_0x5b7faa);})[_0x35da('0x20')](function(_0x520b33){_0x36f80a(_0x4752ed['error'](0x1f4,_0x520b33[_0x35da('0x13')]));});});}; \ No newline at end of file +var _0xb518=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','body','describe','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','keys','CompanyId','from','Sequelize','isNil','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','FaxAccount','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','list','orderBy','applications','priority','asc','length','ListId','create','contact','fax','FaxInteraction','spread','autoclose','push','created','ContactId','AttachmentId','name','unshift','agent','waitForTheAssignedAgent','interaction','FaxQueue','queueId','waitForTheAssignedQueue','*,*,*,*','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d6332,_0x9f607c){var _0xa50e30=function(_0x50c27b){while(--_0x50c27b){_0x2d6332['push'](_0x2d6332['shift']());}};_0xa50e30(++_0x9f607c);}(_0xb518,0x175));var _0x8b51=function(_0x335965,_0x2e6970){_0x335965=_0x335965-0x0;var _0x32d93f=_0xb518[_0x335965];return _0x32d93f;};'use strict';var _=require(_0x8b51('0x0'));var util=require(_0x8b51('0x1'));var moment=require(_0x8b51('0x2'));var BPromise=require(_0x8b51('0x3'));var rs=require(_0x8b51('0x4'));var fs=require('fs');var Redis=require(_0x8b51('0x5'));var db=require(_0x8b51('0x6'))['db'];var utils=require(_0x8b51('0x7'));var logger=require(_0x8b51('0x8'))(_0x8b51('0x9'));var config=require(_0x8b51('0xa'));var jayson=require(_0x8b51('0xb'));var client=jayson[_0x8b51('0xc')][_0x8b51('0xd')]({'port':0x232c});config[_0x8b51('0xe')]=_[_0x8b51('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8b51('0x10'))(new Redis(config[_0x8b51('0xe')]));require(_0x8b51('0x11'))[_0x8b51('0x12')](socket);function respondWithRpcPromise(_0x2bc028,_0x9d676e,_0x164487){return new BPromise(function(_0x544a71,_0x4344d6){return client['request'](_0x2bc028,_0x164487)[_0x8b51('0x13')](function(_0x49e416){logger[_0x8b51('0x14')](_0x8b51('0x15'),_0x9d676e,_0x8b51('0x16'));logger[_0x8b51('0x17')](_0x8b51('0x18'),_0x9d676e,_0x8b51('0x16'),JSON[_0x8b51('0x19')](_0x49e416));if(_0x49e416['error']){if(_0x49e416['error'][_0x8b51('0x1a')]===0x1f4){logger[_0x8b51('0x1b')](_0x8b51('0x15'),_0x9d676e,_0x49e416[_0x8b51('0x1b')][_0x8b51('0x1c')]);return _0x4344d6(_0x49e416[_0x8b51('0x1b')][_0x8b51('0x1c')]);}logger[_0x8b51('0x1b')](_0x8b51('0x15'),_0x9d676e,_0x49e416[_0x8b51('0x1b')][_0x8b51('0x1c')]);return _0x544a71(_0x49e416[_0x8b51('0x1b')][_0x8b51('0x1c')]);}else{logger[_0x8b51('0x14')](_0x8b51('0x15'),_0x9d676e,'request\x20sent');_0x544a71(_0x49e416['result'][_0x8b51('0x1c')]);}})[_0x8b51('0x1d')](function(_0x1cb51c){logger[_0x8b51('0x1b')](_0x8b51('0x15'),_0x9d676e,_0x1cb51c);_0x4344d6(_0x1cb51c);});});}exports[_0x8b51('0x1e')]=function(_0x3e15ba){var _0x405854=this;return new Promise(function(_0x172121,_0x53dcfa){return db['FaxAccount'][_0x8b51('0x1f')]({'raw':_0x3e15ba['options']?_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x21')]===undefined?!![]:![]:!![],'where':_0x3e15ba['options']?_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x22')]||null:null,'attributes':_0x3e15ba['options']?_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x23')]||null:null,'limit':_0x3e15ba[_0x8b51('0x20')]?_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x24')]||null:null,'include':_0x3e15ba[_0x8b51('0x20')]?_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x25')]?_[_0x8b51('0x26')](_0x3e15ba[_0x8b51('0x20')][_0x8b51('0x25')],function(_0x4254d1){return{'model':db[_0x4254d1['model']],'as':_0x4254d1['as'],'attributes':_0x4254d1[_0x8b51('0x23')],'include':_0x4254d1[_0x8b51('0x25')]?_[_0x8b51('0x26')](_0x4254d1[_0x8b51('0x25')],function(_0x4dc3b){return{'model':db[_0x4dc3b[_0x8b51('0x27')]],'as':_0x4dc3b['as'],'attributes':_0x4dc3b[_0x8b51('0x23')],'include':_0x4dc3b[_0x8b51('0x25')]?_[_0x8b51('0x26')](_0x4dc3b[_0x8b51('0x25')],function(_0x3b6a09){return{'model':db[_0x3b6a09[_0x8b51('0x27')]],'as':_0x3b6a09['as'],'attributes':_0x3b6a09[_0x8b51('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8b51('0x13')](function(_0x37bf6a){logger[_0x8b51('0x14')]('GetFaxAccount',_0x3e15ba);logger[_0x8b51('0x17')](_0x8b51('0x1e'),_0x3e15ba,JSON[_0x8b51('0x19')](_0x37bf6a));_0x172121(_0x37bf6a);})['catch'](function(_0x5e7af2){logger['error']('GetFaxAccount',_0x5e7af2['message'],_0x3e15ba);_0x53dcfa(_0x405854[_0x8b51('0x1b')](0x1f4,_0x5e7af2[_0x8b51('0x1c')]));});});};exports['NotifyFaxAccount']=function(_0x3b9319,_0x231824,_0x5807fe){var _0x5e593a=this;return new Promise(function(_0x158ba2,_0xf95158){var _0x445a96={'body':_0x3b9319[_0x8b51('0x28')],'channel':'fax'};var _0x3376ae=[];var _0x4bec82=[];var _0x49e799={};return db['CmContact'][_0x8b51('0x29')]()[_0x8b51('0x13')](function(_0x1efbf9){if(!_0x1efbf9){throw new db['Sequelize'][(_0x8b51('0x2a'))](_0x8b51('0x2b'));}_0x3376ae=_['difference'](_['keys'](_0x1efbf9),[_0x8b51('0x2c'),_0x8b51('0x2d')]);_0x4bec82=_[_0x8b51('0x2e')](_[_0x8b51('0x2f')](_0x1efbf9),[_0x8b51('0x2c'),_0x8b51('0x2d'),_0x8b51('0x30'),'ListId']);if(_0x3b9319[_0x8b51('0x28')]['id']){delete _0x3b9319['body']['id'];}if(_['isNil'](_0x3b9319[_0x8b51('0x28')][_0x8b51('0x31')])){throw new db[(_0x8b51('0x32'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x8b51('0x33')](_0x3b9319['body'][_0x8b51('0x28')])||_0x3b9319[_0x8b51('0x28')][_0x8b51('0x28')]===''){throw new db[(_0x8b51('0x32'))][(_0x8b51('0x2a'))](_0x8b51('0x34'));}if(_[_0x8b51('0x33')](_0x3b9319[_0x8b51('0x28')]['mapKey'])){throw new db['Sequelize'][(_0x8b51('0x2a'))](_0x8b51('0x35')+_0x4bec82);}if(!_[_0x8b51('0x36')](_0x4bec82,_0x3b9319[_0x8b51('0x28')][_0x8b51('0x37')])){throw new db[(_0x8b51('0x32'))][(_0x8b51('0x2a'))](_0x8b51('0x38')+_0x4bec82);}_0x49e799[_0x3b9319[_0x8b51('0x28')][_0x8b51('0x37')]]=_0x3b9319[_0x8b51('0x28')][_0x8b51('0x31')];})[_0x8b51('0x13')](function(){return db[_0x8b51('0x39')][_0x8b51('0x3a')]({'where':{'id':_0x3b9319[_0x8b51('0x3b')]['id']},'include':[{'model':db[_0x8b51('0x3c')],'as':_0x8b51('0x3d'),'include':[{'model':db[_0x8b51('0x3e')],'as':_0x8b51('0x3f'),'where':_0x49e799,'limit':0x1,'order':[[_0x8b51('0x2d'),_0x8b51('0x40')]]}]},{'model':db[_0x8b51('0x41')],'as':_0x8b51('0x42')}]});})[_0x8b51('0x13')](function(_0x4a7020){if(_0x4a7020&&_0x4a7020[_0x8b51('0x3d')]){var _0x46c9ad=_0x4a7020[_0x8b51('0x43')]({'plain':!![]});_0x445a96[_0x8b51('0x3b')]=_0x46c9ad;_0x445a96['applications']=_0x46c9ad[_0x8b51('0x42')];_0x445a96[_0x8b51('0x44')]=_0x46c9ad['List'];_0x445a96['applications']=_[_0x8b51('0x45')](_0x445a96[_0x8b51('0x46')],[_0x8b51('0x47')],[_0x8b51('0x48')]);if(_0x445a96['account'][_0x8b51('0x42')]){delete _0x445a96[_0x8b51('0x3b')][_0x8b51('0x42')];}if(_0x445a96[_0x8b51('0x3b')][_0x8b51('0x3d')]&&_0x445a96[_0x8b51('0x3b')][_0x8b51('0x3d')][_0x8b51('0x3f')][_0x8b51('0x49')]){return _0x445a96['account'][_0x8b51('0x3d')][_0x8b51('0x3f')][0x0];}var _0x2919fd=_['defaults'](_0x3b9319[_0x8b51('0x28')],{'firstName':_0x3b9319[_0x8b51('0x28')][_0x8b51('0x31')],'ListId':_0x46c9ad[_0x8b51('0x4a')]});_0x2919fd[_0x3b9319[_0x8b51('0x28')][_0x8b51('0x37')]]=_0x3b9319['body'][_0x8b51('0x31')];return db['CmContact'][_0x8b51('0x4b')](_0x2919fd,{'fields':_0x3376ae,'raw':!![]});}})[_0x8b51('0x13')](function(_0x28ffe0){_0x445a96[_0x8b51('0x4c')]=_0x28ffe0;if(_0x28ffe0){var _0x52d0b2={'ContactId':_0x28ffe0['id'],'FaxAccountId':_0x3b9319[_0x8b51('0x3b')]['id'],'fax':_0x28ffe0[_0x8b51('0x4d')]};return db[_0x8b51('0x4e')][_0x8b51('0x3a')]({'where':{'ContactId':_0x28ffe0['id'],'closed':![],'FaxAccountId':_0x3b9319[_0x8b51('0x3b')]['id']}})[_0x8b51('0x13')](function(_0x1e1207){if(_0x1e1207){return[_0x1e1207,![]];}return db[_0x8b51('0x4e')]['create'](_0x52d0b2)[_0x8b51('0x13')](function(_0x8dd708){return[_0x8dd708,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8b51('0x4f')](function(_0x3b5f11,_0x183279){var _0x8ae29f=_0x3b5f11[_0x8b51('0x43')]({'plain':!![]});if(_0x183279){if(_0x445a96['account'][_0x8b51('0x50')]){_0x445a96[_0x8b51('0x46')][_0x8b51('0x51')]({'id':0x0,'priority':_0x445a96[_0x8b51('0x46')][_0x8b51('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x8ae29f[_0x8b51('0x52')]=!![];}else{_0x8ae29f[_0x8b51('0x52')]=![];}_0x445a96['interaction']=_0x8ae29f;return db['FaxMessage'][_0x8b51('0x4b')]({'body':_0x3b9319[_0x8b51('0x28')][_0x8b51('0x28')],'FaxAccountId':_0x3b9319[_0x8b51('0x3b')]['id'],'FaxInteractionId':_0x3b5f11['id'],'direction':'in','ContactId':_0x3b5f11[_0x8b51('0x53')],'AttachmentId':_0x3b9319[_0x8b51('0x28')][_0x8b51('0x54')]});})[_0x8b51('0x13')](function(_0x1f1308){_0x445a96['message']=_0x1f1308;if(!_0x445a96['interaction']['UserId'])return;return db['User'][_0x8b51('0x3a')]({'attributes':['id',_0x8b51('0x55')],'where':{'id':_0x445a96['interaction']['UserId']}});})['then'](function(_0x168834){if(_0x168834){_0x445a96['applications'][_0x8b51('0x56')]({'id':0x0,'priority':0x0,'app':_0x8b51('0x57'),'appdata':_0x168834[_0x8b51('0x55')]+','+(_0x445a96[_0x8b51('0x3b')][_0x8b51('0x58')]||0xa),'interval':'*,*,*,*'});}if(!_0x445a96[_0x8b51('0x59')]['queueId'])return;return db[_0x8b51('0x5a')][_0x8b51('0x3a')]({'attributes':['id',_0x8b51('0x55')],'where':{'id':_0x445a96[_0x8b51('0x59')][_0x8b51('0x5b')]}});})[_0x8b51('0x13')](function(_0x3237e6){if(_0x3237e6){_0x445a96[_0x8b51('0x46')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3237e6[_0x8b51('0x55')]+','+(_0x445a96[_0x8b51('0x3b')][_0x8b51('0x5c')]||0x12c),'interval':_0x8b51('0x5d')});}return respondWithRpcPromise('Start',_0x8b51('0x5e'),_0x445a96);})['then'](function(_0x578673){_0x158ba2(_0x578673);})['catch'](function(_0x2c75c9){_0xf95158(_0x5e593a[_0x8b51('0x1b')](0x1f4,_0x2c75c9[_0x8b51('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6898ea7..ec84bc3 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 _0x73b2=['removeListener','register','length','./faxAccount.events','remove','update','emit'];(function(_0x25c5a4,_0x1922b9){var _0x3f191b=function(_0x4931f0){while(--_0x4931f0){_0x25c5a4['push'](_0x25c5a4['shift']());}};_0x3f191b(++_0x1922b9);}(_0x73b2,0xf8));var _0x273b=function(_0x332d85,_0x1aa72b){_0x332d85=_0x332d85-0x0;var _0x9257bc=_0x73b2[_0x332d85];return _0x9257bc;};'use strict';var FaxAccountEvents=require(_0x273b('0x0'));var events=['save',_0x273b('0x1'),_0x273b('0x2')];function createListener(_0x252d54,_0x3e66bb){return function(_0x97a6d0){_0x3e66bb[_0x273b('0x3')](_0x252d54,_0x97a6d0);};}function removeListener(_0x631abe,_0x48e48e){return function(){FaxAccountEvents[_0x273b('0x4')](_0x631abe,_0x48e48e);};}exports[_0x273b('0x5')]=function(_0x30d762){for(var _0xc9e46a=0x0,_0x1038f2=events[_0x273b('0x6')];_0xc9e46a<_0x1038f2;_0xc9e46a++){var _0x15c564=events[_0xc9e46a];var _0x346d8b=createListener('faxAccount:'+_0x15c564,_0x30d762);FaxAccountEvents['on'](_0x15c564,_0x346d8b);}}; \ No newline at end of file +var _0x0bf5=['save','remove','update','emit','register','length','faxAccount:','./faxAccount.events'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x0bf5,0xcf));var _0x50bf=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0bf5[_0x51020b];return _0x371e47;};'use strict';var FaxAccountEvents=require(_0x50bf('0x0'));var events=[_0x50bf('0x1'),_0x50bf('0x2'),_0x50bf('0x3')];function createListener(_0x23cf0c,_0x57cd20){return function(_0xf1fb5e){_0x57cd20[_0x50bf('0x4')](_0x23cf0c,_0xf1fb5e);};}function removeListener(_0x2d0d73,_0x3fb5e4){return function(){FaxAccountEvents['removeListener'](_0x2d0d73,_0x3fb5e4);};}exports[_0x50bf('0x5')]=function(_0x505b82){for(var _0x5adc2e=0x0,_0x56e356=events[_0x50bf('0x6')];_0x5adc2e<_0x56e356;_0x5adc2e++){var _0x20f6d2=events[_0x5adc2e];var _0x1baba8=createListener(_0x50bf('0x7')+_0x20f6d2,_0x505b82);FaxAccountEvents['on'](_0x20f6d2,_0x1baba8);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index b4e7723..6fa938c 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 _0x81cb=['/:id','destroy','delete','removeDispositions','removeAnswers','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getApplications','/:id/messages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','put','update'];(function(_0x466c0f,_0x52d50c){var _0x3ac74f=function(_0xca0b68){while(--_0xca0b68){_0x466c0f['push'](_0x466c0f['shift']());}};_0x3ac74f(++_0x52d50c);}(_0x81cb,0x1ce));var _0xb81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81cb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb81c('0x0'));var timeout=require(_0xb81c('0x1'));var express=require('express');var router=express[_0xb81c('0x2')]();var fs_extra=require(_0xb81c('0x3'));var auth=require(_0xb81c('0x4'));var interaction=require(_0xb81c('0x5'));var config=require('../../config/environment');var controller=require(_0xb81c('0x6'));router[_0xb81c('0x7')]('/',auth[_0xb81c('0x8')](),controller[_0xb81c('0x9')]);router[_0xb81c('0x7')](_0xb81c('0xa'),auth[_0xb81c('0x8')](),controller[_0xb81c('0xb')]);router[_0xb81c('0x7')]('/:id',auth[_0xb81c('0x8')](),controller['show']);router[_0xb81c('0x7')](_0xb81c('0xc'),auth[_0xb81c('0x8')](),controller[_0xb81c('0xd')]);router[_0xb81c('0x7')](_0xb81c('0xe'),auth[_0xb81c('0x8')](),controller[_0xb81c('0xf')]);router[_0xb81c('0x7')](_0xb81c('0x10'),auth[_0xb81c('0x8')](),controller['getInteractions']);router[_0xb81c('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb81c('0x11')]);router['get'](_0xb81c('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb81c('0x7')](_0xb81c('0x13'),auth[_0xb81c('0x8')](),controller['getAgents']);router[_0xb81c('0x14')]('/',auth[_0xb81c('0x8')](),controller[_0xb81c('0x15')]);router[_0xb81c('0x14')](_0xb81c('0xc'),auth[_0xb81c('0x8')](),controller[_0xb81c('0x16')]);router[_0xb81c('0x14')]('/:id/canned_answers',auth[_0xb81c('0x8')](),controller[_0xb81c('0x17')]);router[_0xb81c('0x14')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xb81c('0x18')]);router[_0xb81c('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb81c('0x19')]);router[_0xb81c('0x14')](_0xb81c('0x1a'),auth[_0xb81c('0x8')](),controller[_0xb81c('0x1b')]);router[_0xb81c('0x14')](_0xb81c('0x1c'),auth[_0xb81c('0x8')](),controller['updateAccountApplications']);router[_0xb81c('0x14')]('/:id/send',auth[_0xb81c('0x8')](),controller[_0xb81c('0x1d')]);router[_0xb81c('0x14')](_0xb81c('0x13'),auth[_0xb81c('0x8')](),controller['addAgents']);router[_0xb81c('0x1e')]('/:id',auth[_0xb81c('0x8')](),controller[_0xb81c('0x1f')]);router['delete'](_0xb81c('0x20'),auth[_0xb81c('0x8')](),controller[_0xb81c('0x21')]);router[_0xb81c('0x22')](_0xb81c('0xc'),auth[_0xb81c('0x8')](),controller[_0xb81c('0x23')]);router[_0xb81c('0x22')](_0xb81c('0xe'),auth[_0xb81c('0x8')](),controller[_0xb81c('0x24')]);router['delete'](_0xb81c('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb81c('0x25')]=router; \ No newline at end of file +var _0x7c9c=['show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','/:id/applications','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x517932,_0x502ead){var _0x5815a6=function(_0xcc7d71){while(--_0xcc7d71){_0x517932['push'](_0x517932['shift']());}};_0x5815a6(++_0x502ead);}(_0x7c9c,0xb5));var _0xc7c9=function(_0x10abfe,_0x7a9ad6){_0x10abfe=_0x10abfe-0x0;var _0x473c1b=_0x7c9c[_0x10abfe];return _0x473c1b;};'use strict';var multer=require('multer');var util=require(_0xc7c9('0x0'));var path=require('path');var timeout=require(_0xc7c9('0x1'));var express=require(_0xc7c9('0x2'));var router=express[_0xc7c9('0x3')]();var fs_extra=require(_0xc7c9('0x4'));var auth=require(_0xc7c9('0x5'));var interaction=require(_0xc7c9('0x6'));var config=require(_0xc7c9('0x7'));var controller=require(_0xc7c9('0x8'));router[_0xc7c9('0x9')]('/',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0xb')]);router[_0xc7c9('0x9')]('/describe',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0xc')]);router[_0xc7c9('0x9')](_0xc7c9('0xd'),auth['isAuthenticated'](),controller[_0xc7c9('0xe')]);router[_0xc7c9('0x9')](_0xc7c9('0xf'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x10')]);router['get']('/:id/canned_answers',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x11')]);router[_0xc7c9('0x9')](_0xc7c9('0x12'),auth[_0xc7c9('0xa')](),controller['getInteractions']);router[_0xc7c9('0x9')](_0xc7c9('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0xc7c9('0x9')]('/:id/messages',auth[_0xc7c9('0xa')](),controller['getMessages']);router[_0xc7c9('0x9')](_0xc7c9('0x14'),auth['isAuthenticated'](),controller[_0xc7c9('0x15')]);router[_0xc7c9('0x16')]('/',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x17')]);router[_0xc7c9('0x16')](_0xc7c9('0xf'),auth[_0xc7c9('0xa')](),controller['addDisposition']);router[_0xc7c9('0x16')]('/:id/canned_answers',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x18')]);router[_0xc7c9('0x16')](_0xc7c9('0x12'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x19')]);router[_0xc7c9('0x16')](_0xc7c9('0x13'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x1a')]);router['post']('/addaccountapplications',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x1b')]);router[_0xc7c9('0x16')](_0xc7c9('0x1c'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x1d')]);router[_0xc7c9('0x16')](_0xc7c9('0x1e'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x1f')]);router[_0xc7c9('0x16')]('/:id/users',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x20')]);router[_0xc7c9('0x21')](_0xc7c9('0xd'),auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x22')]);router[_0xc7c9('0x23')]('/:id',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x24')]);router[_0xc7c9('0x23')](_0xc7c9('0xf'),auth['isAuthenticated'](),controller[_0xc7c9('0x25')]);router[_0xc7c9('0x23')]('/:id/canned_answers',auth[_0xc7c9('0xa')](),controller[_0xc7c9('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 24d4b42..d4a67e8 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 _0x69bf=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2e6a7e,_0x302049){var _0x3eef29=function(_0x58f702){while(--_0x58f702){_0x2e6a7e['push'](_0x2e6a7e['shift']());}};_0x3eef29(++_0x302049);}(_0x69bf,0x148));var _0xf69b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69bf[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf69b('0x0'));module[_0xf69b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf69b('0x2')],'allowNull':![],'defaultValue':_0xf69b('0x3')},'appdata':{'type':Sequelize[_0xf69b('0x4')]()},'description':{'type':Sequelize[_0xf69b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf69b('0x5')}}; \ No newline at end of file +var _0x0434=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x190aba,_0x46809c){var _0x807831=function(_0x13c104){while(--_0x13c104){_0x190aba['push'](_0x190aba['shift']());}};_0x807831(++_0x46809c);}(_0x0434,0x18e));var _0x4043=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x0434[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0x4043('0x0'));module[_0x4043('0x1')]={'priority':{'type':Sequelize[_0x4043('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4043('0x3')],'allowNull':![],'defaultValue':_0x4043('0x4')},'appdata':{'type':Sequelize[_0x4043('0x5')]()},'description':{'type':Sequelize[_0x4043('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4043('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index abbe373..9adf0b0 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 _0x3591=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','destroy','then','error','name','send','index','map','fieldName','type','key','model','keys','query','intersection'];(function(_0x101fcc,_0x264c50){var _0x4a1dd7=function(_0x46f3e3){while(--_0x46f3e3){_0x101fcc['push'](_0x101fcc['shift']());}};_0x4a1dd7(++_0x264c50);}(_0x3591,0x1e0));var _0x1359=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3591[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1359('0x0'));var jsonpatch=require(_0x1359('0x1'));var rp=require(_0x1359('0x2'));var moment=require(_0x1359('0x3'));var BPromise=require(_0x1359('0x4'));var Mustache=require(_0x1359('0x5'));var util=require(_0x1359('0x6'));var path=require(_0x1359('0x7'));var sox=require(_0x1359('0x8'));var csv=require(_0x1359('0x9'));var ejs=require(_0x1359('0xa'));var fs=require('fs');var fs_extra=require(_0x1359('0xb'));var _=require(_0x1359('0xc'));var squel=require(_0x1359('0xd'));var crypto=require(_0x1359('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1359('0xf'));var toCsv=require(_0x1359('0x9'));var querystring=require(_0x1359('0x10'));var Papa=require(_0x1359('0x11'));var Redis=require(_0x1359('0x12'));var authService=require(_0x1359('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1359('0x14'));var hardwareService=require(_0x1359('0x15'));var logger=require(_0x1359('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1359('0x17'));var licenseUtil=require(_0x1359('0x18'));var db=require(_0x1359('0x19'))['db'];function respondWithStatusCode(_0x1def21,_0x51ff45){_0x51ff45=_0x51ff45||0xcc;return function(_0x10680e){if(_0x10680e){return _0x1def21[_0x1359('0x1a')](_0x51ff45);}return _0x1def21['status'](_0x51ff45)[_0x1359('0x1b')]();};}function respondWithResult(_0x5619e6,_0x2bdce9){_0x2bdce9=_0x2bdce9||0xc8;return function(_0x569e6e){if(_0x569e6e){return _0x5619e6['status'](_0x2bdce9)[_0x1359('0x1c')](_0x569e6e);}};}function respondWithFilteredResult(_0xbf123d,_0x48baa6){return function(_0x5856ac){if(_0x5856ac){var _0x341722=typeof _0x48baa6[_0x1359('0x1d')]===_0x1359('0x1e')&&typeof _0x48baa6[_0x1359('0x1f')]===_0x1359('0x1e');var _0x54d1be=_0x5856ac[_0x1359('0x20')];var _0x52ec70=_0x341722?0x0:_0x48baa6[_0x1359('0x1d')];var _0x11abff=_0x341722?_0x5856ac['count']:_0x48baa6[_0x1359('0x1d')]+_0x48baa6[_0x1359('0x1f')];var _0x7085dd;if(_0x11abff>=_0x54d1be){_0x11abff=_0x54d1be;_0x7085dd=0xc8;}else{_0x7085dd=0xce;}_0xbf123d[_0x1359('0x21')](_0x7085dd);return _0xbf123d[_0x1359('0x22')](_0x1359('0x23'),_0x52ec70+'-'+_0x11abff+'/'+_0x54d1be)[_0x1359('0x1c')](_0x5856ac);}return null;};}function patchUpdates(_0x1c11a0){return function(_0x1e0ec2){try{jsonpatch['apply'](_0x1e0ec2,_0x1c11a0,!![]);}catch(_0x51b29e){return BPromise[_0x1359('0x24')](_0x51b29e);}return _0x1e0ec2['save']();};}function saveUpdates(_0x4b42b2,_0x228f35){return function(_0x3d7cca){if(_0x3d7cca){return _0x3d7cca[_0x1359('0x25')](_0x4b42b2)['then'](function(_0x43ea78){return _0x43ea78;});}return null;};}function removeEntity(_0x464879,_0x34ed73){return function(_0x2d2359){if(_0x2d2359){return _0x2d2359[_0x1359('0x26')]()[_0x1359('0x27')](function(){_0x464879[_0x1359('0x21')](0xcc)[_0x1359('0x1b')]();});}};}function handleEntityNotFound(_0x387d14,_0x58631f){return function(_0x11db58){if(!_0x11db58){_0x387d14[_0x1359('0x1a')](0x194);}return _0x11db58;};}function handleError(_0x12fc5e,_0xa5d787){_0xa5d787=_0xa5d787||0x1f4;return function(_0x46fb98){logger[_0x1359('0x28')](_0x46fb98['stack']);if(_0x46fb98['name']){delete _0x46fb98[_0x1359('0x29')];}_0x12fc5e[_0x1359('0x21')](_0xa5d787)[_0x1359('0x2a')](_0x46fb98);};}exports[_0x1359('0x2b')]=function(_0x228372,_0x112600){var _0x139052={},_0xff25ea={},_0x581a68={'count':0x0,'rows':[]};var _0xd6b822=_[_0x1359('0x2c')](db['FaxApplication']['rawAttributes'],function(_0xf0bdf8){return{'name':_0xf0bdf8[_0x1359('0x2d')],'type':_0xf0bdf8[_0x1359('0x2e')][_0x1359('0x2f')]};});_0xff25ea[_0x1359('0x30')]=_[_0x1359('0x2c')](_0xd6b822,_0x1359('0x29'));_0xff25ea['query']=_[_0x1359('0x31')](_0x228372[_0x1359('0x32')]);_0xff25ea['filters']=_[_0x1359('0x33')](_0xff25ea[_0x1359('0x30')],_0xff25ea[_0x1359('0x32')]);_0x139052[_0x1359('0x34')]=_[_0x1359('0x33')](_0xff25ea['model'],qs['fields'](_0x228372[_0x1359('0x32')]['fields']));_0x139052[_0x1359('0x34')]=_0x139052['attributes'][_0x1359('0x35')]?_0x139052[_0x1359('0x34')]:_0xff25ea['model'];if(!_0x228372[_0x1359('0x32')][_0x1359('0x36')]('nolimit')){_0x139052[_0x1359('0x1f')]=qs[_0x1359('0x1f')](_0x228372['query'][_0x1359('0x1f')]);_0x139052[_0x1359('0x1d')]=qs[_0x1359('0x1d')](_0x228372[_0x1359('0x32')]['offset']);}_0x139052[_0x1359('0x37')]=qs[_0x1359('0x38')](_0x228372[_0x1359('0x32')][_0x1359('0x38')]);_0x139052[_0x1359('0x39')]=qs[_0x1359('0x3a')](_[_0x1359('0x3b')](_0x228372['query'],_0xff25ea[_0x1359('0x3a')]),_0xd6b822);if(_0x228372['query'][_0x1359('0x3c')]){_0x139052[_0x1359('0x39')]=_['merge'](_0x139052[_0x1359('0x39')],{'$or':_[_0x1359('0x2c')](_0xd6b822,function(_0xd7a588){if(_0xd7a588[_0x1359('0x2e')]!=='VIRTUAL'){var _0x3f6b21={};_0x3f6b21[_0xd7a588[_0x1359('0x29')]]={'$like':'%'+_0x228372[_0x1359('0x32')][_0x1359('0x3c')]+'%'};return _0x3f6b21;}})});}_0x139052=_[_0x1359('0x3d')]({},_0x139052,_0x228372[_0x1359('0x3e')]);var _0x2b75d3={'where':_0x139052[_0x1359('0x39')]};return db[_0x1359('0x3f')][_0x1359('0x20')](_0x2b75d3)[_0x1359('0x27')](function(_0x30b714){_0x581a68[_0x1359('0x20')]=_0x30b714;if(_0x228372[_0x1359('0x32')][_0x1359('0x40')]){_0x139052[_0x1359('0x41')]=[{'all':!![]}];}return db[_0x1359('0x3f')][_0x1359('0x42')](_0x139052);})[_0x1359('0x27')](function(_0xe84fa4){_0x581a68[_0x1359('0x43')]=_0xe84fa4;return _0x581a68;})['then'](respondWithFilteredResult(_0x112600,_0x139052))[_0x1359('0x44')](handleError(_0x112600,null));};exports[_0x1359('0x45')]=function(_0x1cb85a,_0x16d0a4){var _0x1923b3={'raw':!![],'where':{'id':_0x1cb85a[_0x1359('0x46')]['id']}},_0x4fd02f={};_0x4fd02f[_0x1359('0x30')]=_['keys'](db['FaxApplication'][_0x1359('0x47')]);_0x4fd02f[_0x1359('0x32')]=_[_0x1359('0x31')](_0x1cb85a[_0x1359('0x32')]);_0x4fd02f[_0x1359('0x3a')]=_[_0x1359('0x33')](_0x4fd02f[_0x1359('0x30')],_0x4fd02f['query']);_0x1923b3[_0x1359('0x34')]=_['intersection'](_0x4fd02f[_0x1359('0x30')],qs[_0x1359('0x48')](_0x1cb85a['query'][_0x1359('0x48')]));_0x1923b3[_0x1359('0x34')]=_0x1923b3[_0x1359('0x34')][_0x1359('0x35')]?_0x1923b3[_0x1359('0x34')]:_0x4fd02f[_0x1359('0x30')];if(_0x1cb85a[_0x1359('0x32')][_0x1359('0x40')]){_0x1923b3[_0x1359('0x41')]=[{'all':!![]}];}_0x1923b3=_[_0x1359('0x3d')]({},_0x1923b3,_0x1cb85a['options']);return db[_0x1359('0x3f')][_0x1359('0x49')](_0x1923b3)['then'](handleEntityNotFound(_0x16d0a4,null))[_0x1359('0x27')](respondWithResult(_0x16d0a4,null))['catch'](handleError(_0x16d0a4,null));};exports[_0x1359('0x4a')]=function(_0x347f56,_0x5bbde3){return db[_0x1359('0x3f')]['create'](_0x347f56['body'],{})[_0x1359('0x27')](respondWithResult(_0x5bbde3,0xc9))[_0x1359('0x44')](handleError(_0x5bbde3,null));};exports[_0x1359('0x25')]=function(_0x33c568,_0x152caa){if(_0x33c568['body']['id']){delete _0x33c568[_0x1359('0x4b')]['id'];}return db['FaxApplication'][_0x1359('0x49')]({'where':{'id':_0x33c568[_0x1359('0x46')]['id']}})[_0x1359('0x27')](handleEntityNotFound(_0x152caa,null))[_0x1359('0x27')](saveUpdates(_0x33c568[_0x1359('0x4b')],null))[_0x1359('0x27')](respondWithResult(_0x152caa,null))[_0x1359('0x44')](handleError(_0x152caa,null));};exports['destroy']=function(_0x38dc40,_0x398370){return db[_0x1359('0x3f')][_0x1359('0x49')]({'where':{'id':_0x38dc40[_0x1359('0x46')]['id']}})[_0x1359('0x27')](handleEntityNotFound(_0x398370,null))[_0x1359('0x27')](removeEntity(_0x398370,null))[_0x1359('0x44')](handleError(_0x398370,null));}; \ No newline at end of file +var _0xd2c2=['then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save'];(function(_0x27e6a2,_0x59eb63){var _0x41998b=function(_0x14c1fc){while(--_0x14c1fc){_0x27e6a2['push'](_0x27e6a2['shift']());}};_0x41998b(++_0x59eb63);}(_0xd2c2,0x6d));var _0x2d2c=function(_0xf746b,_0x16af2d){_0xf746b=_0xf746b-0x0;var _0xcc764b=_0xd2c2[_0xf746b];return _0xcc764b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d2c('0x0'));var zipdir=require(_0x2d2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d2c('0x2'));var BPromise=require(_0x2d2c('0x3'));var Mustache=require('mustache');var util=require(_0x2d2c('0x4'));var path=require(_0x2d2c('0x5'));var sox=require(_0x2d2c('0x6'));var csv=require(_0x2d2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2d2c('0x8'));var crypto=require(_0x2d2c('0x9'));var jsforce=require(_0x2d2c('0xa'));var deskjs=require(_0x2d2c('0xb'));var toCsv=require(_0x2d2c('0x7'));var querystring=require(_0x2d2c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2d2c('0xd'));var authService=require(_0x2d2c('0xe'));var qs=require(_0x2d2c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2d2c('0x10'));var logger=require('../../config/logger')(_0x2d2c('0x11'));var utils=require(_0x2d2c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2d2c('0x13'));var db=require(_0x2d2c('0x14'))['db'];function respondWithStatusCode(_0x925f38,_0x164b65){_0x164b65=_0x164b65||0xcc;return function(_0x3ec7a8){if(_0x3ec7a8){return _0x925f38[_0x2d2c('0x15')](_0x164b65);}return _0x925f38[_0x2d2c('0x16')](_0x164b65)[_0x2d2c('0x17')]();};}function respondWithResult(_0x14bf6e,_0x3b0e04){_0x3b0e04=_0x3b0e04||0xc8;return function(_0xf417cd){if(_0xf417cd){return _0x14bf6e['status'](_0x3b0e04)[_0x2d2c('0x18')](_0xf417cd);}};}function respondWithFilteredResult(_0x523488,_0x463d0a){return function(_0x174b9f){if(_0x174b9f){var _0x677b55=typeof _0x463d0a[_0x2d2c('0x19')]==='undefined'&&typeof _0x463d0a['limit']===_0x2d2c('0x1a');var _0x3c0048=_0x174b9f[_0x2d2c('0x1b')];var _0xd902f7=_0x677b55?0x0:_0x463d0a['offset'];var _0x1b8486=_0x677b55?_0x174b9f[_0x2d2c('0x1b')]:_0x463d0a[_0x2d2c('0x19')]+_0x463d0a[_0x2d2c('0x1c')];var _0x16a408;if(_0x1b8486>=_0x3c0048){_0x1b8486=_0x3c0048;_0x16a408=0xc8;}else{_0x16a408=0xce;}_0x523488['status'](_0x16a408);return _0x523488['set']('Content-Range',_0xd902f7+'-'+_0x1b8486+'/'+_0x3c0048)[_0x2d2c('0x18')](_0x174b9f);}return null;};}function patchUpdates(_0x27cb19){return function(_0x3b6e3b){try{jsonpatch['apply'](_0x3b6e3b,_0x27cb19,!![]);}catch(_0x20b566){return BPromise[_0x2d2c('0x1d')](_0x20b566);}return _0x3b6e3b[_0x2d2c('0x1e')]();};}function saveUpdates(_0x3fb0b9,_0x16551d){return function(_0x434263){if(_0x434263){return _0x434263['update'](_0x3fb0b9)[_0x2d2c('0x1f')](function(_0x4c9a77){return _0x4c9a77;});}return null;};}function removeEntity(_0x3bae34,_0x2421fe){return function(_0x21e07c){if(_0x21e07c){return _0x21e07c[_0x2d2c('0x20')]()[_0x2d2c('0x1f')](function(){_0x3bae34['status'](0xcc)[_0x2d2c('0x17')]();});}};}function handleEntityNotFound(_0x3bb18d,_0x114403){return function(_0x3f7b41){if(!_0x3f7b41){_0x3bb18d[_0x2d2c('0x15')](0x194);}return _0x3f7b41;};}function handleError(_0x2cc609,_0x189750){_0x189750=_0x189750||0x1f4;return function(_0x443917){logger['error'](_0x443917[_0x2d2c('0x21')]);if(_0x443917[_0x2d2c('0x22')]){delete _0x443917[_0x2d2c('0x22')];}_0x2cc609[_0x2d2c('0x16')](_0x189750)[_0x2d2c('0x23')](_0x443917);};}exports[_0x2d2c('0x24')]=function(_0x20e849,_0x17094c){var _0x336e69={},_0x15d41b={},_0x187e2f={'count':0x0,'rows':[]};var _0x366a8e=_[_0x2d2c('0x25')](db[_0x2d2c('0x26')][_0x2d2c('0x27')],function(_0x22da48){return{'name':_0x22da48[_0x2d2c('0x28')],'type':_0x22da48[_0x2d2c('0x29')]['key']};});_0x15d41b[_0x2d2c('0x2a')]=_[_0x2d2c('0x25')](_0x366a8e,_0x2d2c('0x22'));_0x15d41b[_0x2d2c('0x2b')]=_[_0x2d2c('0x2c')](_0x20e849['query']);_0x15d41b[_0x2d2c('0x2d')]=_[_0x2d2c('0x2e')](_0x15d41b[_0x2d2c('0x2a')],_0x15d41b[_0x2d2c('0x2b')]);_0x336e69['attributes']=_[_0x2d2c('0x2e')](_0x15d41b[_0x2d2c('0x2a')],qs[_0x2d2c('0x2f')](_0x20e849[_0x2d2c('0x2b')][_0x2d2c('0x2f')]));_0x336e69[_0x2d2c('0x30')]=_0x336e69[_0x2d2c('0x30')][_0x2d2c('0x31')]?_0x336e69[_0x2d2c('0x30')]:_0x15d41b[_0x2d2c('0x2a')];if(!_0x20e849[_0x2d2c('0x2b')][_0x2d2c('0x32')]('nolimit')){_0x336e69[_0x2d2c('0x1c')]=qs[_0x2d2c('0x1c')](_0x20e849['query'][_0x2d2c('0x1c')]);_0x336e69[_0x2d2c('0x19')]=qs[_0x2d2c('0x19')](_0x20e849[_0x2d2c('0x2b')][_0x2d2c('0x19')]);}_0x336e69[_0x2d2c('0x33')]=qs[_0x2d2c('0x34')](_0x20e849['query'][_0x2d2c('0x34')]);_0x336e69[_0x2d2c('0x35')]=qs[_0x2d2c('0x2d')](_[_0x2d2c('0x36')](_0x20e849[_0x2d2c('0x2b')],_0x15d41b[_0x2d2c('0x2d')]),_0x366a8e);if(_0x20e849[_0x2d2c('0x2b')][_0x2d2c('0x37')]){_0x336e69[_0x2d2c('0x35')]=_[_0x2d2c('0x38')](_0x336e69['where'],{'$or':_[_0x2d2c('0x25')](_0x366a8e,function(_0x5b7da2){if(_0x5b7da2[_0x2d2c('0x29')]!==_0x2d2c('0x39')){var _0x5e54ea={};_0x5e54ea[_0x5b7da2[_0x2d2c('0x22')]]={'$like':'%'+_0x20e849[_0x2d2c('0x2b')][_0x2d2c('0x37')]+'%'};return _0x5e54ea;}})});}_0x336e69=_['merge']({},_0x336e69,_0x20e849[_0x2d2c('0x3a')]);var _0x5d28b7={'where':_0x336e69[_0x2d2c('0x35')]};return db[_0x2d2c('0x26')][_0x2d2c('0x1b')](_0x5d28b7)[_0x2d2c('0x1f')](function(_0x39a462){_0x187e2f[_0x2d2c('0x1b')]=_0x39a462;if(_0x20e849['query'][_0x2d2c('0x3b')]){_0x336e69[_0x2d2c('0x3c')]=[{'all':!![]}];}return db[_0x2d2c('0x26')][_0x2d2c('0x3d')](_0x336e69);})[_0x2d2c('0x1f')](function(_0x3df109){_0x187e2f[_0x2d2c('0x3e')]=_0x3df109;return _0x187e2f;})['then'](respondWithFilteredResult(_0x17094c,_0x336e69))[_0x2d2c('0x3f')](handleError(_0x17094c,null));};exports[_0x2d2c('0x40')]=function(_0x426b38,_0x66711e){var _0x12d11a={'raw':!![],'where':{'id':_0x426b38['params']['id']}},_0x3e7264={};_0x3e7264[_0x2d2c('0x2a')]=_['keys'](db[_0x2d2c('0x26')][_0x2d2c('0x27')]);_0x3e7264[_0x2d2c('0x2b')]=_[_0x2d2c('0x2c')](_0x426b38[_0x2d2c('0x2b')]);_0x3e7264[_0x2d2c('0x2d')]=_['intersection'](_0x3e7264[_0x2d2c('0x2a')],_0x3e7264[_0x2d2c('0x2b')]);_0x12d11a['attributes']=_[_0x2d2c('0x2e')](_0x3e7264['model'],qs[_0x2d2c('0x2f')](_0x426b38['query'][_0x2d2c('0x2f')]));_0x12d11a[_0x2d2c('0x30')]=_0x12d11a['attributes'][_0x2d2c('0x31')]?_0x12d11a[_0x2d2c('0x30')]:_0x3e7264['model'];if(_0x426b38[_0x2d2c('0x2b')][_0x2d2c('0x3b')]){_0x12d11a[_0x2d2c('0x3c')]=[{'all':!![]}];}_0x12d11a=_[_0x2d2c('0x38')]({},_0x12d11a,_0x426b38[_0x2d2c('0x3a')]);return db[_0x2d2c('0x26')][_0x2d2c('0x41')](_0x12d11a)[_0x2d2c('0x1f')](handleEntityNotFound(_0x66711e,null))['then'](respondWithResult(_0x66711e,null))['catch'](handleError(_0x66711e,null));};exports[_0x2d2c('0x42')]=function(_0x132e30,_0x5842eb){return db['FaxApplication']['create'](_0x132e30[_0x2d2c('0x43')],{})['then'](respondWithResult(_0x5842eb,0xc9))[_0x2d2c('0x3f')](handleError(_0x5842eb,null));};exports[_0x2d2c('0x44')]=function(_0x3bbe1b,_0x176de3){if(_0x3bbe1b[_0x2d2c('0x43')]['id']){delete _0x3bbe1b[_0x2d2c('0x43')]['id'];}return db[_0x2d2c('0x26')][_0x2d2c('0x41')]({'where':{'id':_0x3bbe1b[_0x2d2c('0x45')]['id']}})[_0x2d2c('0x1f')](handleEntityNotFound(_0x176de3,null))[_0x2d2c('0x1f')](saveUpdates(_0x3bbe1b[_0x2d2c('0x43')],null))['then'](respondWithResult(_0x176de3,null))[_0x2d2c('0x3f')](handleError(_0x176de3,null));};exports[_0x2d2c('0x20')]=function(_0x5951c1,_0x568f54){return db[_0x2d2c('0x26')][_0x2d2c('0x41')]({'where':{'id':_0x5951c1[_0x2d2c('0x45')]['id']}})['then'](handleEntityNotFound(_0x568f54,null))['then'](removeEntity(_0x568f54,null))[_0x2d2c('0x3f')](handleError(_0x568f54,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 17f7211..715beac 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 _0x7c52=['define','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x2f89a1,_0x3b920a){var _0x5b8132=function(_0x25d21d){while(--_0x25d21d){_0x2f89a1['push'](_0x2f89a1['shift']());}};_0x5b8132(++_0x3b920a);}(_0x7c52,0xf4));var _0x27c5=function(_0x8dd543,_0x5caf81){_0x8dd543=_0x8dd543-0x0;var _0x46c5a7=_0x7c52[_0x8dd543];return _0x46c5a7;};'use strict';var _=require(_0x27c5('0x0'));var util=require('util');var logger=require(_0x27c5('0x1'))(_0x27c5('0x2'));var moment=require(_0x27c5('0x3'));var BPromise=require(_0x27c5('0x4'));var rp=require(_0x27c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27c5('0x6'));var config=require(_0x27c5('0x7'));var attributes=require(_0x27c5('0x8'));module['exports']=function(_0x268f63,_0x396187){return _0x268f63[_0x27c5('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x27c5('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa691=['fax_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','./faxApplication.attributes','define','FaxApplication'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0xa691,0xcf));var _0x1a69=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa691[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x1a69('0x0'));var logger=require('../../config/logger')(_0x1a69('0x1'));var moment=require(_0x1a69('0x2'));var BPromise=require(_0x1a69('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a69('0x4'));var rimraf=require(_0x1a69('0x5'));var config=require('../../config/environment');var attributes=require(_0x1a69('0x6'));module['exports']=function(_0x12d396,_0x19baad){return _0x12d396[_0x1a69('0x7')](_0x1a69('0x8'),attributes,{'tableName':_0x1a69('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a69('0xa'),'collate':_0x1a69('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index cf33a07..90123be 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 _0x8e81=['FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','FaxApplication,\x20%s,\x20%s','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug'];(function(_0x515a2a,_0x510aea){var _0x32b5fa=function(_0x53b54e){while(--_0x53b54e){_0x515a2a['push'](_0x515a2a['shift']());}};_0x32b5fa(++_0x510aea);}(_0x8e81,0x1d0));var _0x18e8=function(_0x54555e,_0x10564e){_0x54555e=_0x54555e-0x0;var _0x474d86=_0x8e81[_0x54555e];return _0x474d86;};'use strict';var _=require(_0x18e8('0x0'));var util=require(_0x18e8('0x1'));var moment=require(_0x18e8('0x2'));var BPromise=require(_0x18e8('0x3'));var rs=require(_0x18e8('0x4'));var fs=require('fs');var Redis=require(_0x18e8('0x5'));var db=require(_0x18e8('0x6'))['db'];var utils=require(_0x18e8('0x7'));var logger=require(_0x18e8('0x8'))(_0x18e8('0x9'));var config=require(_0x18e8('0xa'));var jayson=require(_0x18e8('0xb'));var client=jayson['client'][_0x18e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32a7d5,_0x6bfe3d,_0x3e579a){return new BPromise(function(_0x2157ef,_0x3f0ddf){return client['request'](_0x32a7d5,_0x3e579a)[_0x18e8('0xd')](function(_0x1d11ec){logger[_0x18e8('0xe')]('FaxApplication,\x20%s,\x20%s',_0x6bfe3d,'request\x20sent');logger[_0x18e8('0xf')](_0x18e8('0x10'),_0x6bfe3d,_0x18e8('0x11'),JSON[_0x18e8('0x12')](_0x1d11ec));if(_0x1d11ec[_0x18e8('0x13')]){if(_0x1d11ec['error']['code']===0x1f4){logger[_0x18e8('0x13')]('FaxApplication,\x20%s,\x20%s',_0x6bfe3d,_0x1d11ec[_0x18e8('0x13')][_0x18e8('0x14')]);return _0x3f0ddf(_0x1d11ec['error'][_0x18e8('0x14')]);}logger[_0x18e8('0x13')](_0x18e8('0x15'),_0x6bfe3d,_0x1d11ec[_0x18e8('0x13')][_0x18e8('0x14')]);return _0x2157ef(_0x1d11ec[_0x18e8('0x13')]['message']);}else{logger[_0x18e8('0xe')](_0x18e8('0x15'),_0x6bfe3d,'request\x20sent');_0x2157ef(_0x1d11ec[_0x18e8('0x16')][_0x18e8('0x14')]);}})['catch'](function(_0x4ceac6){logger[_0x18e8('0x13')]('FaxApplication,\x20%s,\x20%s',_0x6bfe3d,_0x4ceac6);_0x3f0ddf(_0x4ceac6);});});}exports[_0x18e8('0x17')]=function(_0x2e62c8){var _0x3bc271=this;return new Promise(function(_0x1e9d1a,_0xf88e0d){return db[_0x18e8('0x18')][_0x18e8('0x19')](_0x2e62c8['body'],{'raw':_0x2e62c8[_0x18e8('0x1a')]?_0x2e62c8[_0x18e8('0x1a')][_0x18e8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e62c8[_0x18e8('0x1a')]?_0x2e62c8['options'][_0x18e8('0x1c')]||null:null,'attributes':_0x2e62c8[_0x18e8('0x1a')]?_0x2e62c8[_0x18e8('0x1a')][_0x18e8('0x1d')]||null:null,'limit':_0x2e62c8[_0x18e8('0x1a')]?_0x2e62c8['options'][_0x18e8('0x1e')]||null:null})['then'](function(_0x203990){logger[_0x18e8('0xe')](_0x18e8('0x17'),_0x2e62c8);logger['debug'](_0x18e8('0x17'),_0x2e62c8,JSON['stringify'](_0x203990));_0x1e9d1a(_0x203990);})[_0x18e8('0x1f')](function(_0x4e85b9){logger[_0x18e8('0x13')](_0x18e8('0x17'),_0x4e85b9[_0x18e8('0x14')],_0x2e62c8);_0xf88e0d(_0x3bc271[_0x18e8('0x13')](0x1f4,_0x4e85b9[_0x18e8('0x14')]));});});}; \ No newline at end of file +var _0x169c=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','stringify','lodash','util','bluebird','randomstring'];(function(_0x43df79,_0x218b4e){var _0x28a785=function(_0x4394ca){while(--_0x4394ca){_0x43df79['push'](_0x43df79['shift']());}};_0x28a785(++_0x218b4e);}(_0x169c,0x1dc));var _0xc169=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x169c[_0x65d12e];return _0x4274e0;};'use strict';var _=require(_0xc169('0x0'));var util=require(_0xc169('0x1'));var moment=require('moment');var BPromise=require(_0xc169('0x2'));var rs=require(_0xc169('0x3'));var fs=require('fs');var Redis=require(_0xc169('0x4'));var db=require(_0xc169('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc169('0x6'))(_0xc169('0x7'));var config=require(_0xc169('0x8'));var jayson=require(_0xc169('0x9'));var client=jayson[_0xc169('0xa')][_0xc169('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x199d05,_0x278d7a,_0x2c770d){return new BPromise(function(_0x49d809,_0x795885){return client[_0xc169('0xc')](_0x199d05,_0x2c770d)[_0xc169('0xd')](function(_0x2fd246){logger['info'](_0xc169('0xe'),_0x278d7a,_0xc169('0xf'));logger[_0xc169('0x10')](_0xc169('0x11'),_0x278d7a,_0xc169('0xf'),JSON['stringify'](_0x2fd246));if(_0x2fd246[_0xc169('0x12')]){if(_0x2fd246['error'][_0xc169('0x13')]===0x1f4){logger[_0xc169('0x12')](_0xc169('0xe'),_0x278d7a,_0x2fd246[_0xc169('0x12')][_0xc169('0x14')]);return _0x795885(_0x2fd246['error']['message']);}logger[_0xc169('0x12')]('FaxApplication,\x20%s,\x20%s',_0x278d7a,_0x2fd246[_0xc169('0x12')][_0xc169('0x14')]);return _0x49d809(_0x2fd246[_0xc169('0x12')]['message']);}else{logger[_0xc169('0x15')](_0xc169('0xe'),_0x278d7a,_0xc169('0xf'));_0x49d809(_0x2fd246['result']['message']);}})[_0xc169('0x16')](function(_0x2f5801){logger[_0xc169('0x12')]('FaxApplication,\x20%s,\x20%s',_0x278d7a,_0x2f5801);_0x795885(_0x2f5801);});});}exports[_0xc169('0x17')]=function(_0x59ce87){var _0x15d8a5=this;return new Promise(function(_0x605a9a,_0x8dbde5){return db[_0xc169('0x18')][_0xc169('0x19')](_0x59ce87[_0xc169('0x1a')],{'raw':_0x59ce87['options']?_0x59ce87[_0xc169('0x1b')][_0xc169('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ce87[_0xc169('0x1b')]?_0x59ce87['options'][_0xc169('0x1d')]||null:null,'attributes':_0x59ce87['options']?_0x59ce87['options'][_0xc169('0x1e')]||null:null,'limit':_0x59ce87['options']?_0x59ce87[_0xc169('0x1b')]['limit']||null:null})['then'](function(_0x6c0e70){logger[_0xc169('0x15')](_0xc169('0x17'),_0x59ce87);logger['debug'](_0xc169('0x17'),_0x59ce87,JSON[_0xc169('0x1f')](_0x6c0e70));_0x605a9a(_0x6c0e70);})[_0xc169('0x16')](function(_0x49e1eb){logger[_0xc169('0x12')](_0xc169('0x17'),_0x49e1eb['message'],_0x59ce87);_0x8dbde5(_0x15d8a5[_0xc169('0x12')](0x1f4,_0x49e1eb[_0xc169('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0fed212..44039a6 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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2ed774,_0x27cbfe){var _0x22a7f8=function(_0x168928){while(--_0x168928){_0x2ed774['push'](_0x2ed774['shift']());}};_0x22a7f8(++_0x27cbfe);}(_0xb7e7,0x121));var _0x7b7e=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xb7e7[_0x75f869];return _0x10af8b;};'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 +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x4dbf68,_0x390d94){var _0x4c372f=function(_0x408b23){while(--_0x408b23){_0x4dbf68['push'](_0x4dbf68['shift']());}};_0x4c372f(++_0x390d94);}(_0x2032,0xd9));var _0x2203=function(_0x2d7f1d,_0x34b86b){_0x2d7f1d=_0x2d7f1d-0x0;var _0x4a7731=_0x2032[_0x2d7f1d];return _0x4a7731;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a0215c8..50ae0dc 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 _0x4b17=['STRING','ENUM','out','DATE','INTEGER','sequelize','BOOLEAN'];(function(_0x3846f6,_0x3bd53b){var _0x512121=function(_0x16b5f4){while(--_0x16b5f4){_0x3846f6['push'](_0x3846f6['shift']());}};_0x512121(++_0x3bd53b);}(_0x4b17,0x10f));var _0x74b1=function(_0x2afb44,_0x249a57){_0x2afb44=_0x2afb44-0x0;var _0x15ccc2=_0x4b17[_0x2afb44];return _0x15ccc2;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x74b1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x74b1('0x2')]},'secondDisposition':{'type':Sequelize[_0x74b1('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74b1('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74b1('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x74b1('0x3')]('in',_0x74b1('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x74b1('0x6')]}}; \ No newline at end of file +var _0x7bd0=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x27af80,_0x396b70){var _0x855bc7=function(_0x2c9733){while(--_0x2c9733){_0x27af80['push'](_0x27af80['shift']());}};_0x855bc7(++_0x396b70);}(_0x7bd0,0x111));var _0x07bd=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x7bd0[_0x52ea08];return _0x28d546;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'closed':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x07bd('0x3')]},'disposition':{'type':Sequelize[_0x07bd('0x4')]},'secondDisposition':{'type':Sequelize[_0x07bd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x07bd('0x4')]},'note':{'type':Sequelize[_0x07bd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x07bd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x07bd('0x5')]('in',_0x07bd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x07bd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x07bd('0x5')]('in',_0x07bd('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x07bd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index feaf527..b3414da 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 _0x9705=['index','map','FaxInteraction','rawAttributes','fieldName','key','findAll','fax','user','show','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','body','catch','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','emit','faxInteractionTags:save','removeTags','toString','join','root','files','tmp','server','attachments','push','Attachment','get','mkdirSync','Messages','basename','createReadStream','createWriteStream','resolve','download','log','err','unlinkSync','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9705,0x1d9));var _0x5970=function(_0x8704c6,_0x221f5d){_0x8704c6=_0x8704c6-0x0;var _0x4b3e8d=_0x9705[_0x8704c6];return _0x4b3e8d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5970('0x0'));var moment=require(_0x5970('0x1'));var BPromise=require(_0x5970('0x2'));var util=require(_0x5970('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x5970('0x4'));var Redis=require(_0x5970('0x5'));var interaction=require(_0x5970('0x6'));var qs=require(_0x5970('0x7'));var logger=require('../../config/logger')(_0x5970('0x8'));var config=require(_0x5970('0x9'));var db=require(_0x5970('0xa'))['db'];config[_0x5970('0xb')]=_[_0x5970('0xc')](config[_0x5970('0xb')],{'host':_0x5970('0xd'),'port':0x18eb});var socket=require(_0x5970('0xe'))(new Redis(config[_0x5970('0xb')]));require(_0x5970('0xf'))['register'](socket);function respondWithStatusCode(_0x58a362,_0x3606d8){_0x3606d8=_0x3606d8||0xcc;return function(_0x239877){if(_0x239877){return _0x58a362['sendStatus'](_0x3606d8);}return _0x58a362[_0x5970('0x10')](_0x3606d8)[_0x5970('0x11')]();};}function respondWithResult(_0x729cdd,_0x498246){_0x498246=_0x498246||0xc8;return function(_0x4a9998){if(_0x4a9998){return _0x729cdd[_0x5970('0x10')](_0x498246)['json'](_0x4a9998);}};}function respondWithFilteredResult(_0x341f49,_0x302f74){return function(_0x339acb){if(_0x339acb){var _0x240c0b=typeof _0x302f74[_0x5970('0x12')]===_0x5970('0x13')&&typeof _0x302f74[_0x5970('0x14')]===_0x5970('0x13');var _0x5eadc9=_0x339acb[_0x5970('0x15')];var _0xc50d20=_0x240c0b?0x0:_0x302f74[_0x5970('0x12')];var _0x3f8068=_0x240c0b?_0x339acb[_0x5970('0x15')]:_0x302f74['offset']+_0x302f74[_0x5970('0x14')];var _0x2a94c0;if(_0x3f8068>=_0x5eadc9){_0x3f8068=_0x5eadc9;_0x2a94c0=0xc8;}else{_0x2a94c0=0xce;}_0x341f49[_0x5970('0x10')](_0x2a94c0);return _0x341f49['set'](_0x5970('0x16'),_0xc50d20+'-'+_0x3f8068+'/'+_0x5eadc9)[_0x5970('0x17')](_0x339acb);}return null;};}function saveUpdates(_0x53d323){return function(_0x84c65f){if(_0x84c65f){return _0x84c65f[_0x5970('0x18')](_0x53d323)[_0x5970('0x19')](function(_0x3cc3e6){return _0x3cc3e6;});}return null;};}function removeEntity(_0x2db808){return function(_0x1b9d12){if(_0x1b9d12){return _0x1b9d12[_0x5970('0x1a')]()[_0x5970('0x19')](function(){_0x2db808[_0x5970('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfdaacf){return function(_0x5939d8){if(!_0x5939d8){_0xfdaacf[_0x5970('0x1b')](0x194);}return _0x5939d8;};}function handleError(_0x59b58d,_0x46bbfc){_0x46bbfc=_0x46bbfc||0x1f4;return function(_0x3ed419){logger[_0x5970('0x1c')](_0x3ed419[_0x5970('0x1d')]);if(_0x3ed419[_0x5970('0x1e')]){delete _0x3ed419['name'];}_0x59b58d[_0x5970('0x10')](_0x46bbfc)[_0x5970('0x1f')](_0x3ed419);};}exports[_0x5970('0x20')]=function(_0x407280,_0x5cd9bf){var _0x1f1b9f={};var _0x163c78=_[_0x5970('0x21')](db[_0x5970('0x22')][_0x5970('0x23')],function(_0x3cd1b3){return{'name':_0x3cd1b3[_0x5970('0x24')],'type':_0x3cd1b3['type'][_0x5970('0x25')]};});_0x1f1b9f=qs['getOptions'](_0x163c78,_0x407280);return interaction[_0x5970('0x26')](_0x5970('0x27'),_0x407280['query'],_0x407280[_0x5970('0x28')],_0x1f1b9f,_0x163c78)[_0x5970('0x19')](respondWithFilteredResult(_0x5cd9bf,_0x1f1b9f))['catch'](handleError(_0x5cd9bf,null));};exports[_0x5970('0x29')]=function(_0x260093,_0x1605f7){var _0x21ece8={'raw':![],'where':{'id':_0x260093['params']['id']}},_0x3929d2={};_0x3929d2[_0x5970('0x2a')]=_[_0x5970('0x2b')](db[_0x5970('0x22')][_0x5970('0x23')]);_0x3929d2['query']=_[_0x5970('0x2b')](_0x260093[_0x5970('0x2c')]);_0x3929d2['filters']=_[_0x5970('0x2d')](_0x3929d2['model'],_0x3929d2[_0x5970('0x2c')]);_0x21ece8['attributes']=_[_0x5970('0x2d')](_0x3929d2['model'],qs[_0x5970('0x2e')](_0x260093[_0x5970('0x2c')]['fields']));_0x21ece8[_0x5970('0x2f')]=_0x21ece8[_0x5970('0x2f')][_0x5970('0x30')]?_0x21ece8[_0x5970('0x2f')]:_0x3929d2['model'];if(_0x260093['query'][_0x5970('0x31')]){_0x21ece8[_0x5970('0x32')]=[{'all':!![]}];}_0x21ece8=_[_0x5970('0x33')]({},_0x21ece8,_0x260093[_0x5970('0x34')]);return db[_0x5970('0x22')][_0x5970('0x35')](_0x21ece8)[_0x5970('0x19')](handleEntityNotFound(_0x1605f7,null))['then'](respondWithResult(_0x1605f7,null))['catch'](handleError(_0x1605f7,null));};exports['create']=function(_0x5cab47,_0x2466f1){return db['FaxInteraction']['create'](_0x5cab47[_0x5970('0x36')],{})[_0x5970('0x19')](respondWithResult(_0x2466f1,0xc9))[_0x5970('0x37')](handleError(_0x2466f1,null));};exports[_0x5970('0x18')]=function(_0x49920d,_0x48d2e8){if(_0x49920d['body']['id']){delete _0x49920d[_0x5970('0x36')]['id'];}return db['FaxInteraction'][_0x5970('0x35')]({'where':{'id':_0x49920d['params']['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x48d2e8,null))[_0x5970('0x19')](saveUpdates(_0x49920d[_0x5970('0x36')],null))[_0x5970('0x19')](respondWithResult(_0x48d2e8,null))['catch'](handleError(_0x48d2e8,null));};exports[_0x5970('0x1a')]=function(_0x35e516,_0x20ef46){return db[_0x5970('0x22')][_0x5970('0x35')]({'where':{'id':_0x35e516[_0x5970('0x38')]['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x20ef46,null))[_0x5970('0x19')](removeEntity(_0x20ef46,null))[_0x5970('0x37')](handleError(_0x20ef46,null));};exports['describe']=function(_0xf28f80,_0x4aae9a){return db[_0x5970('0x22')][_0x5970('0x39')]()[_0x5970('0x19')](respondWithResult(_0x4aae9a,null))[_0x5970('0x37')](handleError(_0x4aae9a,null));};exports[_0x5970('0x3a')]=function(_0x33fc9a,_0x12aeae){return db[_0x5970('0x3b')][_0x5970('0x35')]({'where':{'id':_0x33fc9a[_0x5970('0x38')]['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x12aeae,null))[_0x5970('0x19')](function(_0xdd0677){if(_0xdd0677){return _0xdd0677[_0x5970('0x3a')](_0x33fc9a[_0x5970('0x36')][_0x5970('0x3c')],_[_0x5970('0x3d')](_0x33fc9a['body'],['ids','id'])||{});}})[_0x5970('0x19')](respondWithResult(_0x12aeae,null))['catch'](handleError(_0x12aeae,null));};exports[_0x5970('0x3e')]=function(_0x5a77f8,_0x1c1143){var _0x457c04={'raw':![],'where':{}};var _0x3a9202={};var _0x180ca5={'count':0x0,'rows':[]};return db[_0x5970('0x22')][_0x5970('0x3f')]({'where':{'id':_0x5a77f8[_0x5970('0x38')]['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x1c1143,null))[_0x5970('0x19')](function(_0xbe8591){if(_0xbe8591){_0x3a9202[_0x5970('0x2a')]=_[_0x5970('0x2b')](db[_0x5970('0x3b')][_0x5970('0x23')]);_0x3a9202[_0x5970('0x2c')]=_[_0x5970('0x2b')](_0x5a77f8[_0x5970('0x2c')]);_0x3a9202['filters']=_[_0x5970('0x2d')](_0x3a9202['model'],_0x3a9202[_0x5970('0x2c')]);_0x457c04[_0x5970('0x2f')]=_[_0x5970('0x2d')](_0x3a9202[_0x5970('0x2a')],qs[_0x5970('0x2e')](_0x5a77f8[_0x5970('0x2c')][_0x5970('0x2e')]));_0x457c04[_0x5970('0x2f')]=_0x457c04['attributes'][_0x5970('0x30')]?_0x457c04[_0x5970('0x2f')]:_0x3a9202[_0x5970('0x2a')];if(!_0x5a77f8[_0x5970('0x2c')][_0x5970('0x40')](_0x5970('0x41'))){_0x457c04[_0x5970('0x14')]=qs[_0x5970('0x14')](_0x5a77f8[_0x5970('0x2c')][_0x5970('0x14')]);_0x457c04[_0x5970('0x12')]=qs[_0x5970('0x12')](_0x5a77f8['query'][_0x5970('0x12')]);}_0x457c04['order']=qs[_0x5970('0x42')](_0x5a77f8['query'][_0x5970('0x42')]);_0x457c04[_0x5970('0x43')]=qs[_0x5970('0x44')](_[_0x5970('0x45')](_0x5a77f8[_0x5970('0x2c')],_0x3a9202[_0x5970('0x44')]));_0x457c04[_0x5970('0x43')]['FaxInteractionId']=_0xbe8591['id'];if(_0x5a77f8['query'][_0x5970('0x46')]){_0x457c04['where']=_[_0x5970('0x33')](_0x457c04['where'],{'$or':_[_0x5970('0x21')](_0x457c04[_0x5970('0x2f')],function(_0x492a9b){var _0x285005={};_0x285005[_0x492a9b]={'$like':'%'+_0x5a77f8[_0x5970('0x2c')]['filter']+'%'};return _0x285005;})});}if(_0x5a77f8[_0x5970('0x2c')][_0x5970('0x47')]){var _0x5a14de=_0x5a77f8[_0x5970('0x2c')]['$gte'][_0x5970('0x48')](',');var _0x3b8eca={};_0x3b8eca[_0x5a14de[0x0]]={'$gte':moment(_0x5a14de[0x1])[_0x5970('0x49')](_0x5970('0x4a'))};_0x457c04[_0x5970('0x43')]=_[_0x5970('0x33')](_0x457c04[_0x5970('0x43')],_0x3b8eca);}_0x457c04=_[_0x5970('0x33')]({},_0x457c04,_0x5a77f8[_0x5970('0x34')]);return db[_0x5970('0x3b')]['count']({'where':_0x457c04[_0x5970('0x43')]})['then'](function(_0x2c7077){_0x180ca5[_0x5970('0x15')]=_0x2c7077;if(_0x5a77f8[_0x5970('0x2c')][_0x5970('0x31')]){_0x457c04['include']=[{'all':!![]}];}return db[_0x5970('0x3b')][_0x5970('0x26')](_0x457c04);})[_0x5970('0x19')](function(_0x296db9){_0x180ca5[_0x5970('0x4b')]=_0x296db9;return _0x180ca5;});}})[_0x5970('0x19')](respondWithFilteredResult(_0x1c1143,_0x457c04))[_0x5970('0x37')](handleError(_0x1c1143,null));};exports[_0x5970('0x4c')]=function(_0x3d8e08,_0x1725a4){return db[_0x5970('0x22')][_0x5970('0x35')]({'where':{'id':_0x3d8e08[_0x5970('0x38')]['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x1725a4,null))[_0x5970('0x19')](function(_0x11ca97){if(_0x11ca97){return _0x11ca97[_0x5970('0x4d')](_0x3d8e08[_0x5970('0x36')][_0x5970('0x3c')],_[_0x5970('0x3d')](_0x3d8e08['body'],[_0x5970('0x3c'),'id'])||{})['spread'](function(){return db['Tag'][_0x5970('0x26')]({'attributes':['id','name','color'],'where':{'id':_0x3d8e08[_0x5970('0x36')][_0x5970('0x3c')]}});})[_0x5970('0x19')](function(_0x14c2bb){socket[_0x5970('0x4e')](_0x5970('0x4f'),{'id':Number(_0x3d8e08['params']['id']),'tags':_0x14c2bb||[]});return{'id':Number(_0x3d8e08[_0x5970('0x38')]['id']),'tags':_0x14c2bb||[]};});}})[_0x5970('0x19')](respondWithResult(_0x1725a4,null))[_0x5970('0x37')](handleError(_0x1725a4,null));};exports['removeTags']=function(_0xcc82a3,_0x3116e7){return db[_0x5970('0x22')][_0x5970('0x35')]({'where':{'id':_0xcc82a3[_0x5970('0x38')]['id']}})[_0x5970('0x19')](handleEntityNotFound(_0x3116e7,null))[_0x5970('0x19')](function(_0xff95ce){if(_0xff95ce){return _0xff95ce[_0x5970('0x50')](_0xcc82a3[_0x5970('0x2c')]['ids']);}})[_0x5970('0x19')](respondWithStatusCode(_0x3116e7,null))['catch'](handleError(_0x3116e7,null));};exports['download']=function(_0x46fc9a,_0x226168){var _0x3d0716=moment()['unix']()[_0x5970('0x51')]();var _0x29baac=path[_0x5970('0x52')](config[_0x5970('0x53')],'server',_0x5970('0x54'),_0x5970('0x55'));var _0x5baf3f=path[_0x5970('0x52')](config[_0x5970('0x53')],_0x5970('0x56'),'files',_0x5970('0x57'));var _0x282d64=path[_0x5970('0x52')](_0x29baac,_0x3d0716);var _0x46a301=util[_0x5970('0x49')]('transcript-%d-%s.zip',_0x46fc9a[_0x5970('0x38')]['id'],_0x3d0716);var _0x2dc201=path[_0x5970('0x52')](_0x29baac,_0x46a301);var _0x274f1e=[];_0x274f1e[_0x5970('0x58')]({'model':db[_0x5970('0x59')],'as':_0x5970('0x59'),'raw':!![]});var _0x1c596d=[{'model':db[_0x5970('0x3b')],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x274f1e}];return db['FaxInteraction'][_0x5970('0x35')]({'where':{'id':_0x46fc9a['params']['id']},'include':_0x1c596d})[_0x5970('0x19')](handleEntityNotFound(_0x226168,null))[_0x5970('0x19')](function(_0x7599e3){if(_0x7599e3&&_0x7599e3['Messages']){var _0x7ca4c7=_0x7599e3[_0x5970('0x5a')]({'plain':!![]});fs[_0x5970('0x5b')](_0x282d64);for(var _0x527282=0x0;_0x527282<_0x7ca4c7[_0x5970('0x5c')]['length'];_0x527282++){var _0x4290ff=_0x7ca4c7[_0x5970('0x5c')][_0x527282][_0x5970('0x59')];if(_0x4290ff){var _0x43cf85=path['join'](_0x5baf3f,_0x4290ff[_0x5970('0x5d')]);if(fs['existsSync'](_0x43cf85)){fs[_0x5970('0x5e')](_0x43cf85)['pipe'](fs[_0x5970('0x5f')](path[_0x5970('0x52')](_0x282d64,_0x4290ff['basename'])));}}}return BPromise[_0x5970('0x60')]()[_0x5970('0x19')](function(){return new BPromise(function(_0x4afb5b,_0x5e26a8){zipdir(_0x282d64,{'saveTo':_0x2dc201},function(_0x13ed71,_0x598b57){if(_0x13ed71)return _0x5e26a8(_0x13ed71);return _0x4afb5b(_0x598b57);});})['then'](function(){return new BPromise(function(_0x15d832,_0x2e6ad7){rimraf(_0x282d64,function(_0x36ce0f){if(_0x36ce0f)_0x2e6ad7(_0x36ce0f);return _0x15d832();});});})[_0x5970('0x19')](function(){return _0x226168[_0x5970('0x61')](_0x2dc201,_0x46a301,function(_0x2bf0a1){if(_0x2bf0a1){console[_0x5970('0x62')](_0x5970('0x63'),_0x2bf0a1);}else{fs[_0x5970('0x64')](_0x2dc201);}});});});}else{return _0x226168[_0x5970('0x1b')](0xc8);}})[_0x5970('0x37')](handleError(_0x226168,null));}; \ No newline at end of file +var _0xaf32=['./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x48289f,_0x10ed8f){var _0x291692=function(_0x11dcdb){while(--_0x11dcdb){_0x48289f['push'](_0x48289f['shift']());}};_0x291692(++_0x10ed8f);}(_0xaf32,0x12d));var _0x2af3=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0xaf32[_0x356307];return _0x59e722;};'use strict';var rimraf=require(_0x2af3('0x0'));var zipdir=require(_0x2af3('0x1'));var moment=require(_0x2af3('0x2'));var BPromise=require(_0x2af3('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x2af3('0x4'));var Redis=require(_0x2af3('0x5'));var interaction=require(_0x2af3('0x6'));var qs=require(_0x2af3('0x7'));var logger=require(_0x2af3('0x8'))('api');var config=require(_0x2af3('0x9'));var db=require(_0x2af3('0xa'))['db'];config[_0x2af3('0xb')]=_[_0x2af3('0xc')](config[_0x2af3('0xb')],{'host':_0x2af3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2af3('0xb')]));require(_0x2af3('0xe'))[_0x2af3('0xf')](socket);function respondWithStatusCode(_0x5aaac9,_0x52ecf9){_0x52ecf9=_0x52ecf9||0xcc;return function(_0x1bd851){if(_0x1bd851){return _0x5aaac9[_0x2af3('0x10')](_0x52ecf9);}return _0x5aaac9[_0x2af3('0x11')](_0x52ecf9)[_0x2af3('0x12')]();};}function respondWithResult(_0x12db4c,_0x1b3ae9){_0x1b3ae9=_0x1b3ae9||0xc8;return function(_0x1a239d){if(_0x1a239d){return _0x12db4c[_0x2af3('0x11')](_0x1b3ae9)[_0x2af3('0x13')](_0x1a239d);}};}function respondWithFilteredResult(_0x264d36,_0x3e3d03){return function(_0xa4ebd){if(_0xa4ebd){var _0x277200=typeof _0x3e3d03[_0x2af3('0x14')]===_0x2af3('0x15')&&typeof _0x3e3d03[_0x2af3('0x16')]==='undefined';var _0x21504c=_0xa4ebd[_0x2af3('0x17')];var _0x45ab59=_0x277200?0x0:_0x3e3d03[_0x2af3('0x14')];var _0x5ce7ab=_0x277200?_0xa4ebd[_0x2af3('0x17')]:_0x3e3d03[_0x2af3('0x14')]+_0x3e3d03[_0x2af3('0x16')];var _0x2fa6d1;if(_0x5ce7ab>=_0x21504c){_0x5ce7ab=_0x21504c;_0x2fa6d1=0xc8;}else{_0x2fa6d1=0xce;}_0x264d36['status'](_0x2fa6d1);return _0x264d36[_0x2af3('0x18')](_0x2af3('0x19'),_0x45ab59+'-'+_0x5ce7ab+'/'+_0x21504c)[_0x2af3('0x13')](_0xa4ebd);}return null;};}function saveUpdates(_0x41670c){return function(_0x4adda8){if(_0x4adda8){return _0x4adda8['update'](_0x41670c)[_0x2af3('0x1a')](function(_0x3c0036){return _0x3c0036;});}return null;};}function removeEntity(_0x83efc4){return function(_0xa06578){if(_0xa06578){return _0xa06578['destroy']()[_0x2af3('0x1a')](function(){_0x83efc4['status'](0xcc)[_0x2af3('0x12')]();});}};}function handleEntityNotFound(_0x47204e){return function(_0x37f053){if(!_0x37f053){_0x47204e[_0x2af3('0x10')](0x194);}return _0x37f053;};}function handleError(_0x31d1c6,_0x8a8bf1){_0x8a8bf1=_0x8a8bf1||0x1f4;return function(_0x3efb62){logger[_0x2af3('0x1b')](_0x3efb62[_0x2af3('0x1c')]);if(_0x3efb62[_0x2af3('0x1d')]){delete _0x3efb62['name'];}_0x31d1c6[_0x2af3('0x11')](_0x8a8bf1)[_0x2af3('0x1e')](_0x3efb62);};}exports['index']=function(_0x1f461b,_0x4e80b7){var _0x147fee={};var _0xc2db54=_['map'](db[_0x2af3('0x1f')][_0x2af3('0x20')],function(_0x28829b){return{'name':_0x28829b[_0x2af3('0x21')],'type':_0x28829b[_0x2af3('0x22')][_0x2af3('0x23')]};});_0x147fee=qs[_0x2af3('0x24')](_0xc2db54,_0x1f461b);return interaction[_0x2af3('0x25')](_0x2af3('0x26'),_0x1f461b[_0x2af3('0x27')],_0x1f461b[_0x2af3('0x28')],_0x147fee,_0xc2db54)[_0x2af3('0x1a')](respondWithFilteredResult(_0x4e80b7,_0x147fee))[_0x2af3('0x29')](handleError(_0x4e80b7,null));};exports['show']=function(_0x5cb0a9,_0x465c66){var _0x38f6a2={'raw':![],'where':{'id':_0x5cb0a9[_0x2af3('0x2a')]['id']}},_0x547b14={};_0x547b14[_0x2af3('0x2b')]=_[_0x2af3('0x2c')](db[_0x2af3('0x1f')][_0x2af3('0x20')]);_0x547b14[_0x2af3('0x27')]=_[_0x2af3('0x2c')](_0x5cb0a9[_0x2af3('0x27')]);_0x547b14[_0x2af3('0x2d')]=_[_0x2af3('0x2e')](_0x547b14[_0x2af3('0x2b')],_0x547b14[_0x2af3('0x27')]);_0x38f6a2[_0x2af3('0x2f')]=_[_0x2af3('0x2e')](_0x547b14[_0x2af3('0x2b')],qs[_0x2af3('0x30')](_0x5cb0a9[_0x2af3('0x27')][_0x2af3('0x30')]));_0x38f6a2[_0x2af3('0x2f')]=_0x38f6a2['attributes'][_0x2af3('0x31')]?_0x38f6a2['attributes']:_0x547b14[_0x2af3('0x2b')];if(_0x5cb0a9['query'][_0x2af3('0x32')]){_0x38f6a2[_0x2af3('0x33')]=[{'all':!![]}];}_0x38f6a2=_[_0x2af3('0x34')]({},_0x38f6a2,_0x5cb0a9[_0x2af3('0x35')]);return db[_0x2af3('0x1f')][_0x2af3('0x36')](_0x38f6a2)['then'](handleEntityNotFound(_0x465c66,null))[_0x2af3('0x1a')](respondWithResult(_0x465c66,null))[_0x2af3('0x29')](handleError(_0x465c66,null));};exports[_0x2af3('0x37')]=function(_0x431ca6,_0x21a70c){return db[_0x2af3('0x1f')][_0x2af3('0x37')](_0x431ca6[_0x2af3('0x38')],{})[_0x2af3('0x1a')](respondWithResult(_0x21a70c,0xc9))[_0x2af3('0x29')](handleError(_0x21a70c,null));};exports['update']=function(_0x456b18,_0x391c93){if(_0x456b18[_0x2af3('0x38')]['id']){delete _0x456b18[_0x2af3('0x38')]['id'];}return db[_0x2af3('0x1f')][_0x2af3('0x36')]({'where':{'id':_0x456b18['params']['id']}})[_0x2af3('0x1a')](handleEntityNotFound(_0x391c93,null))['then'](saveUpdates(_0x456b18[_0x2af3('0x38')],null))[_0x2af3('0x1a')](respondWithResult(_0x391c93,null))['catch'](handleError(_0x391c93,null));};exports[_0x2af3('0x39')]=function(_0x2cfc24,_0x3054bf){return db['FaxInteraction'][_0x2af3('0x36')]({'where':{'id':_0x2cfc24[_0x2af3('0x2a')]['id']}})[_0x2af3('0x1a')](handleEntityNotFound(_0x3054bf,null))[_0x2af3('0x1a')](removeEntity(_0x3054bf,null))[_0x2af3('0x29')](handleError(_0x3054bf,null));};exports[_0x2af3('0x3a')]=function(_0x96fd16,_0x32e0b3){return db[_0x2af3('0x1f')][_0x2af3('0x3a')]()[_0x2af3('0x1a')](respondWithResult(_0x32e0b3,null))[_0x2af3('0x29')](handleError(_0x32e0b3,null));};exports[_0x2af3('0x3b')]=function(_0x186a3b,_0x45dd12){return db[_0x2af3('0x3c')][_0x2af3('0x36')]({'where':{'id':_0x186a3b['params']['id']}})[_0x2af3('0x1a')](handleEntityNotFound(_0x45dd12,null))['then'](function(_0x17e5c0){if(_0x17e5c0){return _0x17e5c0[_0x2af3('0x3b')](_0x186a3b[_0x2af3('0x38')][_0x2af3('0x3d')],_[_0x2af3('0x3e')](_0x186a3b[_0x2af3('0x38')],[_0x2af3('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x45dd12,null))['catch'](handleError(_0x45dd12,null));};exports[_0x2af3('0x3f')]=function(_0x4fc614,_0x3d323c){var _0x3045ec={'raw':![],'where':{}};var _0x4f3060={};var _0xd8085a={'count':0x0,'rows':[]};return db[_0x2af3('0x1f')][_0x2af3('0x40')]({'where':{'id':_0x4fc614[_0x2af3('0x2a')]['id']}})[_0x2af3('0x1a')](handleEntityNotFound(_0x3d323c,null))[_0x2af3('0x1a')](function(_0x7330da){if(_0x7330da){_0x4f3060['model']=_[_0x2af3('0x2c')](db[_0x2af3('0x3c')][_0x2af3('0x20')]);_0x4f3060[_0x2af3('0x27')]=_[_0x2af3('0x2c')](_0x4fc614[_0x2af3('0x27')]);_0x4f3060[_0x2af3('0x2d')]=_[_0x2af3('0x2e')](_0x4f3060[_0x2af3('0x2b')],_0x4f3060[_0x2af3('0x27')]);_0x3045ec[_0x2af3('0x2f')]=_[_0x2af3('0x2e')](_0x4f3060[_0x2af3('0x2b')],qs[_0x2af3('0x30')](_0x4fc614[_0x2af3('0x27')][_0x2af3('0x30')]));_0x3045ec['attributes']=_0x3045ec[_0x2af3('0x2f')][_0x2af3('0x31')]?_0x3045ec['attributes']:_0x4f3060[_0x2af3('0x2b')];if(!_0x4fc614['query'][_0x2af3('0x41')](_0x2af3('0x42'))){_0x3045ec[_0x2af3('0x16')]=qs[_0x2af3('0x16')](_0x4fc614[_0x2af3('0x27')][_0x2af3('0x16')]);_0x3045ec[_0x2af3('0x14')]=qs[_0x2af3('0x14')](_0x4fc614[_0x2af3('0x27')]['offset']);}_0x3045ec[_0x2af3('0x43')]=qs[_0x2af3('0x44')](_0x4fc614[_0x2af3('0x27')][_0x2af3('0x44')]);_0x3045ec[_0x2af3('0x45')]=qs[_0x2af3('0x2d')](_['pick'](_0x4fc614['query'],_0x4f3060[_0x2af3('0x2d')]));_0x3045ec[_0x2af3('0x45')][_0x2af3('0x46')]=_0x7330da['id'];if(_0x4fc614[_0x2af3('0x27')][_0x2af3('0x47')]){_0x3045ec[_0x2af3('0x45')]=_[_0x2af3('0x34')](_0x3045ec[_0x2af3('0x45')],{'$or':_['map'](_0x3045ec[_0x2af3('0x2f')],function(_0x3c1a51){var _0x5003c2={};_0x5003c2[_0x3c1a51]={'$like':'%'+_0x4fc614[_0x2af3('0x27')][_0x2af3('0x47')]+'%'};return _0x5003c2;})});}if(_0x4fc614[_0x2af3('0x27')][_0x2af3('0x48')]){var _0x2535a3=_0x4fc614[_0x2af3('0x27')][_0x2af3('0x48')][_0x2af3('0x49')](',');var _0x30ed5f={};_0x30ed5f[_0x2535a3[0x0]]={'$gte':moment(_0x2535a3[0x1])[_0x2af3('0x4a')](_0x2af3('0x4b'))};_0x3045ec[_0x2af3('0x45')]=_['merge'](_0x3045ec[_0x2af3('0x45')],_0x30ed5f);}_0x3045ec=_[_0x2af3('0x34')]({},_0x3045ec,_0x4fc614[_0x2af3('0x35')]);return db[_0x2af3('0x3c')][_0x2af3('0x17')]({'where':_0x3045ec[_0x2af3('0x45')]})[_0x2af3('0x1a')](function(_0x3b6351){_0xd8085a[_0x2af3('0x17')]=_0x3b6351;if(_0x4fc614[_0x2af3('0x27')][_0x2af3('0x32')]){_0x3045ec['include']=[{'all':!![]}];}return db['FaxMessage'][_0x2af3('0x25')](_0x3045ec);})[_0x2af3('0x1a')](function(_0x189976){_0xd8085a[_0x2af3('0x4c')]=_0x189976;return _0xd8085a;});}})['then'](respondWithFilteredResult(_0x3d323c,_0x3045ec))['catch'](handleError(_0x3d323c,null));};exports[_0x2af3('0x4d')]=function(_0x16d3e8,_0x3d112b){return db[_0x2af3('0x1f')][_0x2af3('0x36')]({'where':{'id':_0x16d3e8[_0x2af3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3d112b,null))[_0x2af3('0x1a')](function(_0x1da569){if(_0x1da569){return _0x1da569[_0x2af3('0x4e')](_0x16d3e8[_0x2af3('0x38')][_0x2af3('0x3d')],_[_0x2af3('0x3e')](_0x16d3e8[_0x2af3('0x38')],[_0x2af3('0x3d'),'id'])||{})[_0x2af3('0x4f')](function(){return db['Tag'][_0x2af3('0x25')]({'attributes':['id','name',_0x2af3('0x50')],'where':{'id':_0x16d3e8[_0x2af3('0x38')][_0x2af3('0x3d')]}});})[_0x2af3('0x1a')](function(_0x1b506f){socket[_0x2af3('0x51')](_0x2af3('0x52'),{'id':Number(_0x16d3e8['params']['id']),'tags':_0x1b506f||[]});return{'id':Number(_0x16d3e8[_0x2af3('0x2a')]['id']),'tags':_0x1b506f||[]};});}})['then'](respondWithResult(_0x3d112b,null))[_0x2af3('0x29')](handleError(_0x3d112b,null));};exports[_0x2af3('0x53')]=function(_0x101ebf,_0x6793d6){return db[_0x2af3('0x1f')][_0x2af3('0x36')]({'where':{'id':_0x101ebf[_0x2af3('0x2a')]['id']}})[_0x2af3('0x1a')](handleEntityNotFound(_0x6793d6,null))[_0x2af3('0x1a')](function(_0x3ac64a){if(_0x3ac64a){return _0x3ac64a[_0x2af3('0x53')](_0x101ebf['query'][_0x2af3('0x3d')]);}})[_0x2af3('0x1a')](respondWithStatusCode(_0x6793d6,null))['catch'](handleError(_0x6793d6,null));};exports[_0x2af3('0x54')]=function(_0x4b48bc,_0x6417de){var _0x30ddb0=moment()['unix']()['toString']();var _0xf59639=path[_0x2af3('0x55')](config[_0x2af3('0x56')],_0x2af3('0x57'),_0x2af3('0x58'),_0x2af3('0x59'));var _0x4fc9c1=path[_0x2af3('0x55')](config[_0x2af3('0x56')],_0x2af3('0x57'),'files',_0x2af3('0x5a'));var _0x74b409=path[_0x2af3('0x55')](_0xf59639,_0x30ddb0);var _0x410afe=util['format']('transcript-%d-%s.zip',_0x4b48bc[_0x2af3('0x2a')]['id'],_0x30ddb0);var _0x13fc42=path[_0x2af3('0x55')](_0xf59639,_0x410afe);var _0x4dfb2f=[];_0x4dfb2f[_0x2af3('0x5b')]({'model':db[_0x2af3('0x5c')],'as':_0x2af3('0x5c'),'raw':!![]});var _0x31ac5c=[{'model':db[_0x2af3('0x3c')],'as':_0x2af3('0x5d'),'attributes':['id','body',_0x2af3('0x5e')],'include':_0x4dfb2f}];return db[_0x2af3('0x1f')][_0x2af3('0x36')]({'where':{'id':_0x4b48bc[_0x2af3('0x2a')]['id']},'include':_0x31ac5c})[_0x2af3('0x1a')](handleEntityNotFound(_0x6417de,null))[_0x2af3('0x1a')](function(_0x4da783){if(_0x4da783&&_0x4da783['Messages']){var _0x18714e=_0x4da783[_0x2af3('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x74b409);for(var _0x237b63=0x0;_0x237b63<_0x18714e['Messages']['length'];_0x237b63++){var _0x34261e=_0x18714e[_0x2af3('0x5d')][_0x237b63][_0x2af3('0x5c')];if(_0x34261e){var _0x2d99ab=path[_0x2af3('0x55')](_0x4fc9c1,_0x34261e[_0x2af3('0x60')]);if(fs[_0x2af3('0x61')](_0x2d99ab)){fs[_0x2af3('0x62')](_0x2d99ab)[_0x2af3('0x63')](fs[_0x2af3('0x64')](path[_0x2af3('0x55')](_0x74b409,_0x34261e[_0x2af3('0x60')])));}}}return BPromise[_0x2af3('0x65')]()['then'](function(){return new BPromise(function(_0x150419,_0x16f108){zipdir(_0x74b409,{'saveTo':_0x13fc42},function(_0x44e4c2,_0xfac3f6){if(_0x44e4c2)return _0x16f108(_0x44e4c2);return _0x150419(_0xfac3f6);});})[_0x2af3('0x1a')](function(){return new BPromise(function(_0x771fe3,_0x306272){rimraf(_0x74b409,function(_0x361ce0){if(_0x361ce0)_0x306272(_0x361ce0);return _0x771fe3();});});})['then'](function(){return _0x6417de['download'](_0x13fc42,_0x410afe,function(_0x363309){if(_0x363309){console[_0x2af3('0x66')](_0x2af3('0x67'),_0x363309);}else{fs[_0x2af3('0x68')](_0x13fc42);}});});});}else{return _0x6417de[_0x2af3('0x10')](0xc8);}})[_0x2af3('0x29')](handleError(_0x6417de,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a1a6df9..9f285df 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 _0x87c3=['catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x9b2b21,_0x156db){var _0x5a35bf=function(_0x261563){while(--_0x261563){_0x9b2b21['push'](_0x9b2b21['shift']());}};_0x5a35bf(++_0x156db);}(_0x87c3,0x17f));var _0x387c=function(_0x487afa,_0xe779ea){_0x487afa=_0x487afa-0x0;var _0x3edf60=_0x87c3[_0x487afa];return _0x3edf60;};'use strict';var EventEmitter=require(_0x387c('0x0'));var FaxInteraction=require(_0x387c('0x1'))['db'][_0x387c('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x387c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x387c('0x4')](0x0);var events={'afterCreate':_0x387c('0x5'),'afterUpdate':_0x387c('0x6'),'afterDestroy':_0x387c('0x7')};function emitEvent(_0x5df259){return function(_0x5bbc38,_0x4fc1b3,_0x5ad4e5){_0x5bbc38['getUsers']({'attributes':['id'],'raw':!![]})[_0x387c('0x8')](function(_0x17c031){_0x5bbc38[_0x387c('0x9')](_0x387c('0xa'),_0x17c031[_0x387c('0xb')](function(_0x43b7b1){return{'id':_0x43b7b1['id']};}));return FaxMessage[_0x387c('0xc')]({'where':{'FaxInteractionId':_0x5bbc38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x387c('0x8')](function(_0x5a7f2f){_0x5bbc38[_0x387c('0x9')](_0x387c('0xd'),_0x5a7f2f[_0x387c('0xe')]);FaxInteractionEvents[_0x387c('0xf')](_0x5df259+':'+_0x5bbc38['id'],_0x5bbc38);FaxInteractionEvents[_0x387c('0xf')](_0x5df259,_0x5bbc38);_0x5ad4e5(null);})[_0x387c('0x10')](_0x5ad4e5(null));};}for(var e in events){if(events[_0x387c('0x11')](e)){var event=events[e];FaxInteraction[_0x387c('0x12')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x8d5d=['FaxInteraction','FaxMessage','save','update','remove','setDataValue','Users','map','findAll','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3e7c7,_0x523e67){var _0x26a930=function(_0x414221){while(--_0x414221){_0x3e7c7['push'](_0x3e7c7['shift']());}};_0x26a930(++_0x523e67);}(_0x8d5d,0x7e));var _0xd8d5=function(_0x5e9b08,_0x4f903f){_0x5e9b08=_0x5e9b08-0x0;var _0x3c09ab=_0x8d5d[_0x5e9b08];return _0x3c09ab;};'use strict';var EventEmitter=require(_0xd8d5('0x0'));var FaxInteraction=require(_0xd8d5('0x1'))['db'][_0xd8d5('0x2')];var FaxMessage=require(_0xd8d5('0x1'))['db'][_0xd8d5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8d5('0x4'),'afterUpdate':_0xd8d5('0x5'),'afterDestroy':_0xd8d5('0x6')};function emitEvent(_0x50d182){return function(_0x342c2a,_0x21b0e6,_0x21fbdc){_0x342c2a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1e65ec){_0x342c2a[_0xd8d5('0x7')](_0xd8d5('0x8'),_0x1e65ec[_0xd8d5('0x9')](function(_0x5bd355){return{'id':_0x5bd355['id']};}));return FaxMessage[_0xd8d5('0xa')]({'where':{'FaxInteractionId':_0x342c2a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd8a6b5){_0x342c2a[_0xd8d5('0x7')](_0xd8d5('0xb'),_0xd8a6b5[_0xd8d5('0xc')]);FaxInteractionEvents['emit'](_0x50d182+':'+_0x342c2a['id'],_0x342c2a);FaxInteractionEvents['emit'](_0x50d182,_0x342c2a);_0x21fbdc(null);})['catch'](_0x21fbdc(null));};}for(var e in events){if(events[_0xd8d5('0xd')](e)){var event=events[e];FaxInteraction[_0xd8d5('0xe')](e,emitEvent(event));}}module[_0xd8d5('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 27ed4c5..04d032c 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 _0x2a07=['exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x52c50a,_0x67af43){var _0x3ef475=function(_0x58230f){while(--_0x58230f){_0x52c50a['push'](_0x52c50a['shift']());}};_0x3ef475(++_0x67af43);}(_0x2a07,0x74));var _0x72a0=function(_0x300d0e,_0x4fcd1b){_0x300d0e=_0x300d0e-0x0;var _0x1903cb=_0x2a07[_0x300d0e];return _0x1903cb;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c04eb,_0x22270e,_0x1d32e9){if(_0x2c04eb[_0x72a0('0xe')](_0x72a0('0xf'))){_0x2c04eb['closedAt']=moment()[_0x72a0('0x10')](_0x72a0('0x11'));}_0x1d32e9(null,_0x2c04eb);}}});}; \ No newline at end of file +var _0x2837=['rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4a3f1c,_0x15767d){var _0xd5a773=function(_0x23f298){while(--_0x23f298){_0x4a3f1c['push'](_0x4a3f1c['shift']());}};_0xd5a773(++_0x15767d);}(_0x2837,0x12b));var _0x7283=function(_0x5670dc,_0x400f08){_0x5670dc=_0x5670dc-0x0;var _0x4a4fc4=_0x2837[_0x5670dc];return _0x4a4fc4;};'use strict';var _=require(_0x7283('0x0'));var util=require(_0x7283('0x1'));var logger=require(_0x7283('0x2'))('api');var moment=require(_0x7283('0x3'));var BPromise=require(_0x7283('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7283('0x5'));var config=require(_0x7283('0x6'));var attributes=require(_0x7283('0x7'));module['exports']=function(_0x30e082,_0x5ee4f1){return _0x30e082[_0x7283('0x8')](_0x7283('0x9'),attributes,{'tableName':_0x7283('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e560f,_0x334c01,_0x3af2ec){if(_0x1e560f[_0x7283('0xb')](_0x7283('0xc'))){_0x1e560f[_0x7283('0xd')]=moment()[_0x7283('0xe')](_0x7283('0xf'));}_0x3af2ec(null,_0x1e560f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 26f6dc3..86bf3dd 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 _0xcd15=['error','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd15,0x15d));var _0x5cd1=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xcd15[_0x291d3f];return _0x242080;};'use strict';var _=require(_0x5cd1('0x0'));var util=require(_0x5cd1('0x1'));var moment=require(_0x5cd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cd1('0x3'));var fs=require('fs');var Redis=require(_0x5cd1('0x4'));var db=require(_0x5cd1('0x5'))['db'];var utils=require(_0x5cd1('0x6'));var logger=require(_0x5cd1('0x7'))(_0x5cd1('0x8'));var config=require(_0x5cd1('0x9'));var jayson=require(_0x5cd1('0xa'));var client=jayson[_0x5cd1('0xb')]['http']({'port':0x232a});config[_0x5cd1('0xc')]=_['defaults'](config[_0x5cd1('0xc')],{'host':_0x5cd1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5cd1('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xf6a6ec,_0x31bb35,_0x312194){return new BPromise(function(_0x4a2a72,_0x5f5b0b){return client['request'](_0xf6a6ec,_0x312194)['then'](function(_0x1842ef){logger[_0x5cd1('0xe')](_0x5cd1('0xf'),_0x31bb35,_0x5cd1('0x10'));logger[_0x5cd1('0x11')](_0x5cd1('0x12'),_0x31bb35,'request\x20sent',JSON[_0x5cd1('0x13')](_0x1842ef));if(_0x1842ef[_0x5cd1('0x14')]){if(_0x1842ef[_0x5cd1('0x14')]['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x31bb35,_0x1842ef[_0x5cd1('0x14')]['message']);return _0x5f5b0b(_0x1842ef[_0x5cd1('0x14')][_0x5cd1('0x15')]);}logger['error'](_0x5cd1('0xf'),_0x31bb35,_0x1842ef[_0x5cd1('0x14')][_0x5cd1('0x15')]);return _0x4a2a72(_0x1842ef[_0x5cd1('0x14')]['message']);}else{logger[_0x5cd1('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x31bb35,'request\x20sent');_0x4a2a72(_0x1842ef[_0x5cd1('0x16')][_0x5cd1('0x15')]);}})[_0x5cd1('0x17')](function(_0x2cf86d){logger[_0x5cd1('0x14')](_0x5cd1('0xf'),_0x31bb35,_0x2cf86d);_0x5f5b0b(_0x2cf86d);});});}exports[_0x5cd1('0x18')]=function(_0x318dda){var _0x547b7c=this;return new Promise(function(_0x6cb4a3,_0x3b0034){return db[_0x5cd1('0x19')][_0x5cd1('0x1a')](_0x318dda[_0x5cd1('0x1b')],{'raw':_0x318dda[_0x5cd1('0x1c')]?_0x318dda[_0x5cd1('0x1c')][_0x5cd1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x318dda[_0x5cd1('0x1c')]?_0x318dda['options'][_0x5cd1('0x1e')]||null:null,'attributes':_0x318dda['options']?_0x318dda[_0x5cd1('0x1c')][_0x5cd1('0x1f')]||null:null,'limit':_0x318dda['options']?_0x318dda[_0x5cd1('0x1c')][_0x5cd1('0x20')]||null:null})['then'](function(_0x19e8b6){logger[_0x5cd1('0xe')](_0x5cd1('0x18'),_0x318dda);logger['debug'](_0x5cd1('0x18'),_0x318dda,JSON[_0x5cd1('0x13')](_0x19e8b6));_0x6cb4a3(_0x19e8b6);})[_0x5cd1('0x17')](function(_0x3dde29){logger[_0x5cd1('0x14')](_0x5cd1('0x18'),_0x3dde29[_0x5cd1('0x15')],_0x318dda);_0x3b0034(_0x547b7c[_0x5cd1('0x14')](0x1f4,_0x3dde29['message']));});});};exports[_0x5cd1('0x21')]=function(_0x1ce450){return new Promise(function(_0x283170,_0x544f9d){return db[_0x5cd1('0x19')][_0x5cd1('0x22')]({'where':_0x1ce450[_0x5cd1('0x1c')]?_0x1ce450[_0x5cd1('0x1c')][_0x5cd1('0x1e')]||null:null})[_0x5cd1('0x23')](function(_0x36229e){if(_0x36229e){return _0x36229e[_0x5cd1('0x24')](_0x1ce450['body'][_0x5cd1('0x25')],_[_0x5cd1('0x26')](_0x1ce450['body'],[_0x5cd1('0x25'),'id'])||{});}})[_0x5cd1('0x27')](function(_0x40a2d4){logger[_0x5cd1('0xe')]('AddTags',_0x1ce450);logger[_0x5cd1('0x11')](_0x5cd1('0x28'),_0x1ce450,JSON['stringify'](_0x40a2d4));_0x283170(_0x40a2d4);})[_0x5cd1('0x17')](function(_0xcb21e){logger[_0x5cd1('0x14')](_0x5cd1('0x28'),_0xcb21e[_0x5cd1('0x15')],_0x1ce450);_0x544f9d(_this[_0x5cd1('0x14')](0x1f4,_0xcb21e[_0x5cd1('0x15')]));});});}; \ No newline at end of file +var _0x1d58=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x1d58,0xd4));var _0x81d5=function(_0x1e206b,_0x14fc80){_0x1e206b=_0x1e206b-0x0;var _0x102091=_0x1d58[_0x1e206b];return _0x102091;};'use strict';var _=require(_0x81d5('0x0'));var util=require(_0x81d5('0x1'));var moment=require(_0x81d5('0x2'));var BPromise=require(_0x81d5('0x3'));var rs=require(_0x81d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x81d5('0x5'))(_0x81d5('0x6'));var config=require(_0x81d5('0x7'));var jayson=require(_0x81d5('0x8'));var client=jayson[_0x81d5('0x9')][_0x81d5('0xa')]({'port':0x232a});config['redis']=_[_0x81d5('0xb')](config[_0x81d5('0xc')],{'host':_0x81d5('0xd'),'port':0x18eb});var socket=require(_0x81d5('0xe'))(new Redis(config[_0x81d5('0xc')]));require(_0x81d5('0xf'))[_0x81d5('0x10')](socket);function respondWithRpcPromise(_0x3c07ff,_0x3ce25c,_0x51cd78){return new BPromise(function(_0x58801b,_0x2cc8d0){return client[_0x81d5('0x11')](_0x3c07ff,_0x51cd78)['then'](function(_0x3128c9){logger[_0x81d5('0x12')](_0x81d5('0x13'),_0x3ce25c,_0x81d5('0x14'));logger[_0x81d5('0x15')](_0x81d5('0x16'),_0x3ce25c,_0x81d5('0x14'),JSON[_0x81d5('0x17')](_0x3128c9));if(_0x3128c9['error']){if(_0x3128c9[_0x81d5('0x18')][_0x81d5('0x19')]===0x1f4){logger['error'](_0x81d5('0x13'),_0x3ce25c,_0x3128c9[_0x81d5('0x18')][_0x81d5('0x1a')]);return _0x2cc8d0(_0x3128c9['error'][_0x81d5('0x1a')]);}logger[_0x81d5('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x3ce25c,_0x3128c9[_0x81d5('0x18')][_0x81d5('0x1a')]);return _0x58801b(_0x3128c9[_0x81d5('0x18')][_0x81d5('0x1a')]);}else{logger[_0x81d5('0x12')](_0x81d5('0x13'),_0x3ce25c,_0x81d5('0x14'));_0x58801b(_0x3128c9[_0x81d5('0x1b')][_0x81d5('0x1a')]);}})[_0x81d5('0x1c')](function(_0x592c65){logger[_0x81d5('0x18')](_0x81d5('0x13'),_0x3ce25c,_0x592c65);_0x2cc8d0(_0x592c65);});});}exports[_0x81d5('0x1d')]=function(_0x45cd5d){var _0xaea7dd=this;return new Promise(function(_0x1abbdc,_0x5919db){return db[_0x81d5('0x1e')][_0x81d5('0x1f')](_0x45cd5d[_0x81d5('0x20')],{'raw':_0x45cd5d[_0x81d5('0x21')]?_0x45cd5d['options'][_0x81d5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45cd5d[_0x81d5('0x21')]?_0x45cd5d[_0x81d5('0x21')][_0x81d5('0x23')]||null:null,'attributes':_0x45cd5d[_0x81d5('0x21')]?_0x45cd5d[_0x81d5('0x21')][_0x81d5('0x24')]||null:null,'limit':_0x45cd5d[_0x81d5('0x21')]?_0x45cd5d[_0x81d5('0x21')][_0x81d5('0x25')]||null:null})[_0x81d5('0x26')](function(_0x1be31c){logger['info'](_0x81d5('0x1d'),_0x45cd5d);logger[_0x81d5('0x15')](_0x81d5('0x1d'),_0x45cd5d,JSON['stringify'](_0x1be31c));_0x1abbdc(_0x1be31c);})['catch'](function(_0x7218f1){logger[_0x81d5('0x18')](_0x81d5('0x1d'),_0x7218f1['message'],_0x45cd5d);_0x5919db(_0xaea7dd[_0x81d5('0x18')](0x1f4,_0x7218f1['message']));});});};exports[_0x81d5('0x27')]=function(_0x1c94a7){return new Promise(function(_0x16470d,_0x1ff6f2){return db[_0x81d5('0x1e')][_0x81d5('0x28')]({'where':_0x1c94a7['options']?_0x1c94a7['options'][_0x81d5('0x23')]||null:null})[_0x81d5('0x26')](function(_0x426d38){if(_0x426d38){return _0x426d38[_0x81d5('0x29')](_0x1c94a7[_0x81d5('0x20')][_0x81d5('0x2a')],_[_0x81d5('0x2b')](_0x1c94a7['body'],[_0x81d5('0x2a'),'id'])||{});}})[_0x81d5('0x2c')](function(_0x557b11){logger[_0x81d5('0x12')](_0x81d5('0x2d'),_0x1c94a7);logger[_0x81d5('0x15')]('AddTags',_0x1c94a7,JSON[_0x81d5('0x17')](_0x557b11));_0x16470d(_0x557b11);})[_0x81d5('0x1c')](function(_0xc1de6f){logger[_0x81d5('0x18')]('AddTags',_0xc1de6f[_0x81d5('0x1a')],_0x1c94a7);_0x1ff6f2(_this[_0x81d5('0x18')](0x1f4,_0xc1de6f[_0x81d5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index b2f738d..c162753 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 _0xb65b=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x3a70b9,_0x520e82){var _0x1f0ae7=function(_0x4a2cd0){while(--_0x4a2cd0){_0x3a70b9['push'](_0x3a70b9['shift']());}};_0x1f0ae7(++_0x520e82);}(_0xb65b,0x1c6));var _0xbb65=function(_0xd6834f,_0xb6191c){_0xd6834f=_0xd6834f-0x0;var _0x10d036=_0xb65b[_0xd6834f];return _0x10d036;};'use strict';var FaxInteractionEvents=require(_0xbb65('0x0'));var events=[_0xbb65('0x1'),'remove',_0xbb65('0x2')];function createListener(_0xc660cc,_0x133fe0){return function(_0x4b818b){_0x133fe0[_0xbb65('0x3')](_0xc660cc,_0x4b818b);};}function removeListener(_0x3472f3,_0x420d63){return function(){FaxInteractionEvents[_0xbb65('0x4')](_0x3472f3,_0x420d63);};}exports[_0xbb65('0x5')]=function(_0x48eab5){for(var _0x9d323e=0x0,_0x48e79d=events[_0xbb65('0x6')];_0x9d323e<_0x48e79d;_0x9d323e++){var _0x4541ca=events[_0x9d323e];var _0x3fa623=createListener(_0xbb65('0x7')+_0x4541ca,_0x48eab5);FaxInteractionEvents['on'](_0x4541ca,_0x3fa623);}}; \ No newline at end of file +var _0xee2f=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x446537,_0x472934){var _0x4f850d=function(_0x11fc95){while(--_0x11fc95){_0x446537['push'](_0x446537['shift']());}};_0x4f850d(++_0x472934);}(_0xee2f,0xa3));var _0xfee2=function(_0x3ce6b2,_0x1fc0b0){_0x3ce6b2=_0x3ce6b2-0x0;var _0x98a558=_0xee2f[_0x3ce6b2];return _0x98a558;};'use strict';var FaxInteractionEvents=require(_0xfee2('0x0'));var events=[_0xfee2('0x1'),_0xfee2('0x2'),_0xfee2('0x3')];function createListener(_0x4880c8,_0x470db5){return function(_0x9fef68){_0x470db5['emit'](_0x4880c8,_0x9fef68);};}function removeListener(_0x4a85e9,_0x261f42){return function(){FaxInteractionEvents[_0xfee2('0x4')](_0x4a85e9,_0x261f42);};}exports['register']=function(_0x3de872){for(var _0x4e9fde=0x0,_0x232cbb=events['length'];_0x4e9fde<_0x232cbb;_0x4e9fde++){var _0x4628fb=events[_0x4e9fde];var _0x1ec86=createListener(_0xfee2('0x5')+_0x4628fb,_0x3de872);FaxInteractionEvents['on'](_0x4628fb,_0x1ec86);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ea36c50..1368ff3 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 _0x81e2=['removeTags','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','faxinteraction:addtags','addTags','tracked','fax','update','delete','faxinteraction:destroy','destroy','/:id/tags'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x81e2,0x1c1));var _0x281e=function(_0x2d6fbf,_0x4a57e4){_0x2d6fbf=_0x2d6fbf-0x0;var _0x469de9=_0x81e2[_0x2d6fbf];return _0x469de9;};'use strict';var multer=require(_0x281e('0x0'));var util=require(_0x281e('0x1'));var path=require(_0x281e('0x2'));var timeout=require('connect-timeout');var express=require(_0x281e('0x3'));var router=express['Router']();var fs_extra=require(_0x281e('0x4'));var auth=require(_0x281e('0x5'));var interaction=require(_0x281e('0x6'));var config=require(_0x281e('0x7'));var controller=require(_0x281e('0x8'));router['get']('/',auth[_0x281e('0x9')](),controller[_0x281e('0xa')]);router['get'](_0x281e('0xb'),auth[_0x281e('0x9')](),controller['describe']);router[_0x281e('0xc')](_0x281e('0xd'),auth[_0x281e('0x9')](),controller[_0x281e('0xe')]);router[_0x281e('0xc')](_0x281e('0xf'),auth[_0x281e('0x9')](),controller[_0x281e('0x10')]);router[_0x281e('0xc')](_0x281e('0x11'),auth['isAuthenticated'](),controller[_0x281e('0x12')]);router[_0x281e('0x13')]('/',auth[_0x281e('0x9')](),controller[_0x281e('0x14')]);router[_0x281e('0x13')](_0x281e('0xf'),auth[_0x281e('0x9')](),controller[_0x281e('0x15')]);router[_0x281e('0x13')]('/:id/tags',auth[_0x281e('0x9')](),interaction['tracked']('fax',_0x281e('0x16')),controller[_0x281e('0x17')]);router['put'](_0x281e('0xd'),auth[_0x281e('0x9')](),interaction[_0x281e('0x18')](_0x281e('0x19'),'faxinteraction:update'),controller[_0x281e('0x1a')]);router[_0x281e('0x1b')]('/:id',auth[_0x281e('0x9')](),interaction['tracked'](_0x281e('0x19'),_0x281e('0x1c')),controller[_0x281e('0x1d')]);router[_0x281e('0x1b')](_0x281e('0x1e'),auth[_0x281e('0x9')](),controller[_0x281e('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xdff5=['put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','faxinteraction:addtags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdff5,0x100));var _0x5dff=function(_0x54dffa,_0x4e7399){_0x54dffa=_0x54dffa-0x0;var _0x5eaef6=_0xdff5[_0x54dffa];return _0x5eaef6;};'use strict';var multer=require('multer');var util=require(_0x5dff('0x0'));var path=require(_0x5dff('0x1'));var timeout=require(_0x5dff('0x2'));var express=require(_0x5dff('0x3'));var router=express[_0x5dff('0x4')]();var fs_extra=require(_0x5dff('0x5'));var auth=require(_0x5dff('0x6'));var interaction=require(_0x5dff('0x7'));var config=require(_0x5dff('0x8'));var controller=require(_0x5dff('0x9'));router[_0x5dff('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5dff('0xa')]('/describe',auth[_0x5dff('0xb')](),controller[_0x5dff('0xc')]);router[_0x5dff('0xa')](_0x5dff('0xd'),auth[_0x5dff('0xb')](),controller['show']);router[_0x5dff('0xa')](_0x5dff('0xe'),auth['isAuthenticated'](),controller[_0x5dff('0xf')]);router['get'](_0x5dff('0x10'),auth[_0x5dff('0xb')](),controller[_0x5dff('0x11')]);router[_0x5dff('0x12')]('/',auth[_0x5dff('0xb')](),controller[_0x5dff('0x13')]);router[_0x5dff('0x12')](_0x5dff('0xe'),auth[_0x5dff('0xb')](),controller[_0x5dff('0x14')]);router[_0x5dff('0x12')]('/:id/tags',auth[_0x5dff('0xb')](),interaction[_0x5dff('0x15')]('fax',_0x5dff('0x16')),controller['addTags']);router[_0x5dff('0x17')]('/:id',auth[_0x5dff('0xb')](),interaction[_0x5dff('0x15')]('fax',_0x5dff('0x18')),controller[_0x5dff('0x19')]);router[_0x5dff('0x1a')]('/:id',auth[_0x5dff('0xb')](),interaction[_0x5dff('0x15')](_0x5dff('0x1b'),_0x5dff('0x1c')),controller[_0x5dff('0x1d')]);router['delete']('/:id/tags',auth[_0x5dff('0xb')](),controller['removeTags']);module[_0x5dff('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f965631..ed62f8b 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 _0xaf93=['DATE','sequelize','exports','BOOLEAN','ENUM','out','TEXT'];(function(_0x44d85d,_0x477ae2){var _0x55f365=function(_0x84b597){while(--_0x84b597){_0x44d85d['push'](_0x44d85d['shift']());}};_0x55f365(++_0x477ae2);}(_0xaf93,0x151));var _0x3af9=function(_0x4f89c4,_0x19bddd){_0x4f89c4=_0x4f89c4-0x0;var _0x551018=_0xaf93[_0x4f89c4];return _0x551018;};'use strict';var Sequelize=require(_0x3af9('0x0'));module[_0x3af9('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3af9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3af9('0x3')]('in','out'),'defaultValue':_0x3af9('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x3af9('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3af9('0x6')]}}; \ No newline at end of file +var _0x8ce3=['out','TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8ce3,0xc3));var _0x38ce=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0x8ce3[_0x228a4a];return _0x3d3937;};'use strict';var Sequelize=require(_0x38ce('0x0'));module[_0x38ce('0x1')]={'body':{'type':Sequelize['TEXT'](_0x38ce('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x38ce('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x38ce('0x4')]('in',_0x38ce('0x5')),'defaultValue':_0x38ce('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x38ce('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x38ce('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6befd37..f23709e 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 _0x8ef8=['acceptMessage','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','FaxMessage','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null'];(function(_0x17e2e7,_0xe9e1d0){var _0x2ed751=function(_0x4292a4){while(--_0x4292a4){_0x17e2e7['push'](_0x17e2e7['shift']());}};_0x2ed751(++_0xe9e1d0);}(_0x8ef8,0x145));var _0x88ef=function(_0x5ef92c,_0x4f09ee){_0x5ef92c=_0x5ef92c-0x0;var _0x269b29=_0x8ef8[_0x5ef92c];return _0x269b29;};'use strict';var emlformat=require(_0x88ef('0x0'));var rimraf=require(_0x88ef('0x1'));var zipdir=require(_0x88ef('0x2'));var jsonpatch=require(_0x88ef('0x3'));var rp=require(_0x88ef('0x4'));var moment=require(_0x88ef('0x5'));var BPromise=require(_0x88ef('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x88ef('0x7'));var sox=require(_0x88ef('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ef('0x9'));var squel=require(_0x88ef('0xa'));var crypto=require(_0x88ef('0xb'));var jsforce=require(_0x88ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x88ef('0xd'));var querystring=require(_0x88ef('0xe'));var Papa=require(_0x88ef('0xf'));var Redis=require('ioredis');var authService=require(_0x88ef('0x10'));var qs=require(_0x88ef('0x11'));var as=require(_0x88ef('0x12'));var hardwareService=require(_0x88ef('0x13'));var logger=require(_0x88ef('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x88ef('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x88ef('0x16'))['db'];config[_0x88ef('0x17')]=_['defaults'](config[_0x88ef('0x17')],{'host':_0x88ef('0x18'),'port':0x18eb});var socket=require(_0x88ef('0x19'))(new Redis(config[_0x88ef('0x17')]));require(_0x88ef('0x1a'))[_0x88ef('0x1b')](socket);var jayson=require(_0x88ef('0x1c'));var client=jayson[_0x88ef('0x1d')][_0x88ef('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x88ef('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x262ac3,_0x109b35,_0x91aba5,_0x1eea3d){return new BPromise(function(_0x112ed4,_0x2271c2){var _0x278c2e=_0x1eea3d||client;return _0x278c2e[_0x88ef('0x1f')](_0x262ac3,_0x91aba5)['then'](function(_0x1d9475){logger[_0x88ef('0x20')](_0x88ef('0x21'),_0x109b35,_0x88ef('0x22'));logger[_0x88ef('0x23')](_0x88ef('0x24'),_0x109b35,_0x88ef('0x22'),JSON['stringify'](_0x1d9475));if(_0x1d9475['error']){if(_0x1d9475[_0x88ef('0x25')][_0x88ef('0x26')]===0x1f4){logger[_0x88ef('0x25')]('FaxMessage,\x20%s,\x20%s',_0x109b35,_0x1d9475['error'][_0x88ef('0x27')]);return _0x2271c2(_0x1d9475[_0x88ef('0x25')][_0x88ef('0x27')]);}logger[_0x88ef('0x25')](_0x88ef('0x21'),_0x109b35,_0x1d9475['error'][_0x88ef('0x27')]);return _0x112ed4(_0x1d9475['error']['message']);}else{logger[_0x88ef('0x20')](_0x88ef('0x21'),_0x109b35,_0x88ef('0x22'));_0x112ed4(_0x1d9475[_0x88ef('0x28')][_0x88ef('0x27')]);}})[_0x88ef('0x29')](function(_0x41fde3){logger[_0x88ef('0x25')]('FaxMessage,\x20%s,\x20%s',_0x109b35,_0x41fde3);_0x2271c2(_0x41fde3);});});}function respondWithStatusCode(_0x1df162,_0x345385){_0x345385=_0x345385||0xcc;return function(_0x4beae1){if(_0x4beae1){return _0x1df162[_0x88ef('0x2a')](_0x345385);}return _0x1df162['status'](_0x345385)[_0x88ef('0x2b')]();};}function respondWithResult(_0x34ae4d,_0x32fc00){_0x32fc00=_0x32fc00||0xc8;return function(_0x4ca608){if(_0x4ca608){return _0x34ae4d[_0x88ef('0x2c')](_0x32fc00)[_0x88ef('0x2d')](_0x4ca608);}};}function respondWithFilteredResult(_0x3926c1,_0x35290a){return function(_0x50bd8f){if(_0x50bd8f){var _0x1fa4ac=typeof _0x35290a[_0x88ef('0x2e')]===_0x88ef('0x2f')&&typeof _0x35290a['limit']==='undefined';var _0x17228b=_0x50bd8f[_0x88ef('0x30')];var _0x419ed4=_0x1fa4ac?0x0:_0x35290a[_0x88ef('0x2e')];var _0x3fa1ec=_0x1fa4ac?_0x50bd8f[_0x88ef('0x30')]:_0x35290a[_0x88ef('0x2e')]+_0x35290a[_0x88ef('0x31')];var _0x29f8eb;if(_0x3fa1ec>=_0x17228b){_0x3fa1ec=_0x17228b;_0x29f8eb=0xc8;}else{_0x29f8eb=0xce;}_0x3926c1[_0x88ef('0x2c')](_0x29f8eb);return _0x3926c1[_0x88ef('0x32')](_0x88ef('0x33'),_0x419ed4+'-'+_0x3fa1ec+'/'+_0x17228b)[_0x88ef('0x2d')](_0x50bd8f);}return null;};}function patchUpdates(_0x16c697){return function(_0x21c488){try{jsonpatch[_0x88ef('0x34')](_0x21c488,_0x16c697,!![]);}catch(_0x25f005){return BPromise[_0x88ef('0x35')](_0x25f005);}return _0x21c488[_0x88ef('0x36')]();};}function saveUpdates(_0x509266,_0x37f736){return function(_0xde3924){if(_0xde3924){return _0xde3924[_0x88ef('0x37')](_0x509266)['then'](function(_0x4223c3){return _0x4223c3;});}return null;};}function removeEntity(_0x4e56c9,_0x3d1520){return function(_0x3cccdd){if(_0x3cccdd){return _0x3cccdd[_0x88ef('0x38')]()[_0x88ef('0x39')](function(){_0x4e56c9[_0x88ef('0x2c')](0xcc)[_0x88ef('0x2b')]();});}};}function handleEntityNotFound(_0x3c66ed,_0x484ce6){return function(_0x273dd2){if(!_0x273dd2){_0x3c66ed[_0x88ef('0x2a')](0x194);}return _0x273dd2;};}function handleError(_0x1483ce,_0x315c53){_0x315c53=_0x315c53||0x1f4;return function(_0x4d02dc){logger[_0x88ef('0x25')](_0x4d02dc[_0x88ef('0x3a')]);if(_0x4d02dc[_0x88ef('0x3b')]){delete _0x4d02dc[_0x88ef('0x3b')];}_0x1483ce[_0x88ef('0x2c')](_0x315c53)[_0x88ef('0x3c')](_0x4d02dc);};}exports[_0x88ef('0x3d')]=function(_0x348a6b,_0x1ed0bf){var _0x2124f3={},_0x1b5b28={},_0x4f9335={'count':0x0,'rows':[]};var _0x3e3b4e=_['map'](db['FaxMessage'][_0x88ef('0x3e')],function(_0x4c5be1){return{'name':_0x4c5be1[_0x88ef('0x3f')],'type':_0x4c5be1[_0x88ef('0x40')][_0x88ef('0x41')]};});_0x1b5b28[_0x88ef('0x42')]=_[_0x88ef('0x43')](_0x3e3b4e,'name');_0x1b5b28[_0x88ef('0x44')]=_[_0x88ef('0x45')](_0x348a6b[_0x88ef('0x44')]);_0x1b5b28[_0x88ef('0x46')]=_['intersection'](_0x1b5b28[_0x88ef('0x42')],_0x1b5b28[_0x88ef('0x44')]);_0x2124f3['attributes']=_[_0x88ef('0x47')](_0x1b5b28[_0x88ef('0x42')],qs[_0x88ef('0x48')](_0x348a6b[_0x88ef('0x44')][_0x88ef('0x48')]));_0x2124f3[_0x88ef('0x49')]=_0x2124f3[_0x88ef('0x49')][_0x88ef('0x4a')]?_0x2124f3[_0x88ef('0x49')]:_0x1b5b28[_0x88ef('0x42')];if(!_0x348a6b[_0x88ef('0x44')][_0x88ef('0x4b')](_0x88ef('0x4c'))){_0x2124f3[_0x88ef('0x31')]=qs['limit'](_0x348a6b[_0x88ef('0x44')][_0x88ef('0x31')]);_0x2124f3[_0x88ef('0x2e')]=qs[_0x88ef('0x2e')](_0x348a6b[_0x88ef('0x44')][_0x88ef('0x2e')]);}_0x2124f3['order']=qs[_0x88ef('0x4d')](_0x348a6b['query'][_0x88ef('0x4d')]);_0x2124f3['where']=qs[_0x88ef('0x46')](_[_0x88ef('0x4e')](_0x348a6b[_0x88ef('0x44')],_0x1b5b28[_0x88ef('0x46')]),_0x3e3b4e);if(_0x348a6b['query'][_0x88ef('0x4f')]){_0x2124f3[_0x88ef('0x50')]=_[_0x88ef('0x51')](_0x2124f3['where'],{'$or':_[_0x88ef('0x43')](_0x3e3b4e,function(_0x33a2fc){if(_0x33a2fc[_0x88ef('0x40')]!==_0x88ef('0x52')){var _0xe9e1cf={};_0xe9e1cf[_0x33a2fc[_0x88ef('0x3b')]]={'$like':'%'+_0x348a6b['query'][_0x88ef('0x4f')]+'%'};return _0xe9e1cf;}})});}_0x2124f3=_[_0x88ef('0x51')]({},_0x2124f3,_0x348a6b[_0x88ef('0x53')]);var _0x91e781={'where':_0x2124f3[_0x88ef('0x50')]};return db['FaxMessage'][_0x88ef('0x30')](_0x91e781)['then'](function(_0xab1f4e){_0x4f9335[_0x88ef('0x30')]=_0xab1f4e;if(_0x348a6b[_0x88ef('0x44')][_0x88ef('0x54')]){_0x2124f3[_0x88ef('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0x88ef('0x56')](_0x2124f3);})[_0x88ef('0x39')](function(_0x1150f7){_0x4f9335['rows']=_0x1150f7;return _0x4f9335;})[_0x88ef('0x39')](respondWithFilteredResult(_0x1ed0bf,_0x2124f3))['catch'](handleError(_0x1ed0bf,null));};exports[_0x88ef('0x57')]=function(_0x3266cf,_0x38365e){var _0x53e139={'raw':!![],'where':{'id':_0x3266cf[_0x88ef('0x58')]['id']}},_0x2c6e96={};_0x2c6e96['model']=_[_0x88ef('0x45')](db[_0x88ef('0x59')][_0x88ef('0x3e')]);_0x2c6e96[_0x88ef('0x44')]=_[_0x88ef('0x45')](_0x3266cf[_0x88ef('0x44')]);_0x2c6e96[_0x88ef('0x46')]=_[_0x88ef('0x47')](_0x2c6e96[_0x88ef('0x42')],_0x2c6e96[_0x88ef('0x44')]);_0x53e139[_0x88ef('0x49')]=_['intersection'](_0x2c6e96[_0x88ef('0x42')],qs[_0x88ef('0x48')](_0x3266cf['query'][_0x88ef('0x48')]));_0x53e139[_0x88ef('0x49')]=_0x53e139[_0x88ef('0x49')][_0x88ef('0x4a')]?_0x53e139[_0x88ef('0x49')]:_0x2c6e96[_0x88ef('0x42')];if(_0x3266cf[_0x88ef('0x44')][_0x88ef('0x54')]){_0x53e139[_0x88ef('0x55')]=[{'all':!![]}];}_0x53e139=_[_0x88ef('0x51')]({},_0x53e139,_0x3266cf['options']);return db[_0x88ef('0x59')][_0x88ef('0x5a')](_0x53e139)['then'](handleEntityNotFound(_0x38365e,null))[_0x88ef('0x39')](respondWithResult(_0x38365e,null))[_0x88ef('0x29')](handleError(_0x38365e,null));};exports[_0x88ef('0x37')]=function(_0x2b4910,_0x247731){if(_0x2b4910[_0x88ef('0x5b')]['id']){delete _0x2b4910[_0x88ef('0x5b')]['id'];}return db[_0x88ef('0x59')][_0x88ef('0x5a')]({'where':{'id':_0x2b4910['params']['id']}})[_0x88ef('0x39')](handleEntityNotFound(_0x247731,null))['then'](saveUpdates(_0x2b4910['body'],null))[_0x88ef('0x39')](respondWithResult(_0x247731,null))[_0x88ef('0x29')](handleError(_0x247731,null));};exports['destroy']=function(_0x5a93b1,_0x1fd384){return db[_0x88ef('0x59')][_0x88ef('0x5a')]({'where':{'id':_0x5a93b1[_0x88ef('0x58')]['id']}})[_0x88ef('0x39')](handleEntityNotFound(_0x1fd384,null))[_0x88ef('0x39')](removeEntity(_0x1fd384,null))[_0x88ef('0x29')](handleError(_0x1fd384,null));};exports[_0x88ef('0x5c')]=function(_0x253099,_0x274978){return db['FaxMessage']['describe']()[_0x88ef('0x39')](respondWithResult(_0x274978,null))['catch'](handleError(_0x274978,null));};var interaction_log=require(_0x88ef('0x14'))(_0x88ef('0x5d'));exports[_0x88ef('0x5e')]=function(_0xe01c56,_0x19437c,_0x27d271){var _0x50171f={'agent':{},'channel':_0x88ef('0x5f')};if(_0xe01c56['body']['id']){delete _0xe01c56[_0x88ef('0x5b')]['id'];}_0xe01c56[_0x88ef('0x5b')][_0x88ef('0x60')]=!![];_0xe01c56[_0x88ef('0x5b')][_0x88ef('0x61')]=moment()[_0x88ef('0x62')](_0x88ef('0x63'));_0xe01c56[_0x88ef('0x5b')]['UserId']=_0xe01c56['body'][_0x88ef('0x64')]||_0xe01c56[_0x88ef('0x65')]['id'];_0x50171f['agent']['id']=_0xe01c56[_0x88ef('0x5b')][_0x88ef('0x64')];return db[_0x88ef('0x59')][_0x88ef('0x5a')]({'where':{'id':_0xe01c56[_0x88ef('0x58')]['id'],'UserId':null}})[_0x88ef('0x39')](handleEntityNotFound(_0x19437c,null))['then'](saveUpdates(_0xe01c56[_0x88ef('0x5b')],null))[_0x88ef('0x39')](function(_0x438ccb){if(_0x438ccb){_0x50171f[_0x88ef('0x27')]=_0x438ccb[_0x88ef('0x66')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x438ccb[_0x88ef('0x67')]}});}return null;})[_0x88ef('0x39')](handleEntityNotFound(_0x19437c,null))[_0x88ef('0x39')](function(_0x1bed9d){if(_0x1bed9d){return _0x1bed9d[_0x88ef('0x37')]({'UserId':_0xe01c56[_0x88ef('0x5b')][_0x88ef('0x64')],'read1stAt':_[_0x88ef('0x68')](_0x1bed9d['read1stAt'])?moment()['format'](_0x88ef('0x63')):undefined});}return null;})[_0x88ef('0x39')](function(_0x4a3bf6){if(_0x4a3bf6){_0x50171f[_0x88ef('0x69')]=_0x4a3bf6[_0x88ef('0x66')]({'plain':!![]});interaction_log[_0x88ef('0x20')](_0x88ef('0x6a'),_0xe01c56[_0x88ef('0x65')]['id'],_0xe01c56[_0x88ef('0x65')]['name'],_0xe01c56[_0x88ef('0x65')][_0x88ef('0x6b')],_0x50171f[_0x88ef('0x69')]['id'],_0xe01c56[_0x88ef('0x5b')]?JSON[_0x88ef('0x6c')](_0xe01c56[_0x88ef('0x5b')]):_0x88ef('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x88ef('0x6e'),_0x50171f);}return null;})[_0x88ef('0x39')](function(_0x27a987){var _0x416997='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x27a987[_0x88ef('0x27')]['ContactId'];return db['sequelize'][_0x88ef('0x44')](_0x416997,{'type':db[_0x88ef('0x6f')][_0x88ef('0x70')][_0x88ef('0x71')],'raw':!![]})[_0x88ef('0x39')](function(_0x4dbfea){return _0x4dbfea;});})['then'](function(_0x5af828){if(_0x5af828){_0x50171f[_0x88ef('0x27')][_0x88ef('0x72')]=_0x5af828[0x0];if(!_0xe01c56[_0x88ef('0x5b')]['UserId'])return;return db['User'][_0x88ef('0x5a')]({'where':{'id':_0xe01c56[_0x88ef('0x5b')][_0x88ef('0x64')],'role':_0x88ef('0x73')},'attributes':['id',_0x88ef('0x3b'),_0x88ef('0x74'),_0x88ef('0x75'),_0x88ef('0x76')],'raw':!![]});}return null;})['then'](function(_0x790c9e){if(!_0x790c9e)return null;_0x50171f['message']['agent']=_0x790c9e;return _0x50171f;})[_0x88ef('0x39')](function(_0x3a74ca){if(_0x3a74ca){if(_0xe01c56['body']['manual']){_0x50171f['message'][_0x88ef('0x77')]=util['format'](_0x88ef('0x78'),_0xe01c56['user'][_0x88ef('0x3b')]);_0x50171f['message'][_0x88ef('0x79')]=_0x50171f[_0x88ef('0x79')];_0x50171f[_0x88ef('0x27')][_0x88ef('0x7a')]=_0x50171f[_0x88ef('0x79')];_0x50171f[_0x88ef('0x27')][_0x88ef('0x7b')]=_0x88ef('0x5e');return respondWithRpcPromise(_0x88ef('0x7c'),_0x88ef('0x7c'),{'event':_0x88ef('0x7d'),'message':_0x50171f[_0x88ef('0x27')]},client9002)[_0x88ef('0x39')](function(){return _0x50171f;});}return _0x50171f;}return null;})[_0x88ef('0x39')](respondWithResult(_0x19437c,null))[_0x88ef('0x29')](handleError(_0x19437c,null));};var interaction_log=require(_0x88ef('0x14'))(_0x88ef('0x5d'));exports[_0x88ef('0x35')]=function(_0x229587,_0x5e0c49,_0x4b8660){var _0x40dedf={'agent':{},'channel':'fax'};if(_0x229587[_0x88ef('0x5b')]['id']){delete _0x229587[_0x88ef('0x5b')]['id'];}_0x229587['body']['UserId']=_0x229587['body']['UserId']||_0x229587[_0x88ef('0x65')]['id'];_0x40dedf[_0x88ef('0x73')]['id']=_0x229587[_0x88ef('0x5b')][_0x88ef('0x64')];return db[_0x88ef('0x59')]['find']({'where':{'id':_0x229587['params']['id'],'UserId':null}})[_0x88ef('0x39')](handleEntityNotFound(_0x5e0c49,null))[_0x88ef('0x39')](function(_0x2de2b7){if(_0x2de2b7){_0x40dedf[_0x88ef('0x27')]=_0x2de2b7[_0x88ef('0x66')]({'plain':!![]});return db[_0x88ef('0x7e')][_0x88ef('0x5a')]({'where':{'id':_0x2de2b7['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5e0c49,null))['then'](function(_0x482e5d){if(_0x482e5d){_0x40dedf[_0x88ef('0x69')]=_0x482e5d['get']({'plain':!![]});interaction_log[_0x88ef('0x20')](_0x88ef('0x7f'),_0x229587[_0x88ef('0x65')]['id'],_0x229587[_0x88ef('0x65')][_0x88ef('0x3b')],_0x229587[_0x88ef('0x65')][_0x88ef('0x6b')],_0x40dedf[_0x88ef('0x69')]['id'],_0x229587[_0x88ef('0x5b')]?JSON['stringify'](_0x229587[_0x88ef('0x5b')]):_0x88ef('0x6d'));return respondWithRpcPromise('RejectMessage',_0x88ef('0x80'),_0x40dedf);}return null;})[_0x88ef('0x39')](function(_0x13c344){var _0x59d899='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x13c344[_0x88ef('0x27')][_0x88ef('0x81')];return db[_0x88ef('0x82')][_0x88ef('0x44')](_0x59d899,{'type':db[_0x88ef('0x6f')][_0x88ef('0x70')][_0x88ef('0x71')],'raw':!![]})[_0x88ef('0x39')](function(_0x5a4057){return _0x5a4057;});})[_0x88ef('0x39')](function(_0x336904){if(_0x336904){_0x40dedf[_0x88ef('0x27')][_0x88ef('0x72')]=_0x336904[0x0];if(!_0x229587[_0x88ef('0x5b')][_0x88ef('0x64')])return;return db['User'][_0x88ef('0x5a')]({'where':{'id':_0x229587[_0x88ef('0x5b')][_0x88ef('0x64')],'role':'agent'},'attributes':['id','name',_0x88ef('0x74'),_0x88ef('0x75'),_0x88ef('0x76')],'raw':!![]});}return null;})['then'](function(_0x3f2f41){if(!_0x3f2f41)return null;_0x40dedf[_0x88ef('0x27')][_0x88ef('0x73')]=_0x3f2f41;return _0x40dedf;})[_0x88ef('0x39')](function(_0x3ffc84){if(_0x3ffc84){_0x3ffc84[_0x88ef('0x27')][_0x88ef('0x77')]=util[_0x88ef('0x62')](_0x88ef('0x78'),_0x229587[_0x88ef('0x65')]['name']);_0x3ffc84[_0x88ef('0x27')][_0x88ef('0x79')]=_0x40dedf[_0x88ef('0x79')];_0x3ffc84[_0x88ef('0x27')]['motionChannel']=_0x40dedf[_0x88ef('0x79')];_0x3ffc84[_0x88ef('0x27')][_0x88ef('0x7b')]='reject';respondWithRpcPromise('EventManager',_0x88ef('0x7c'),{'event':_0x88ef('0x83'),'message':_0x3ffc84[_0x88ef('0x27')]},client9002);return _0x40dedf;}return null;})[_0x88ef('0x39')](respondWithResult(_0x5e0c49,null))[_0x88ef('0x29')](handleError(_0x5e0c49,null));};exports[_0x88ef('0x84')]=function(_0xc0b90f,_0xdc8488){var _0x51cb5c;return db['FaxMessage'][_0x88ef('0x84')](_0xc0b90f[_0x88ef('0x5b')],{})[_0x88ef('0x39')](function(_0x468569){_0x51cb5c=_0x468569;return db['CmContact'][_0x88ef('0x85')]({'where':{'id':_0x51cb5c[_0x88ef('0x81')]}});})[_0x88ef('0x39')](function(_0x4c2782){if(_['isNil'](_0x4c2782)){return;}else{_0x51cb5c[_0x88ef('0x5f')]=_0x4c2782['fax'];return db[_0x88ef('0x86')][_0x88ef('0x85')]({'where':{'id':_0x51cb5c[_0x88ef('0x87')]}});}})['then'](function(_0x2e876e){return respondWithRpcPromise(_0x88ef('0x88'),_0x88ef('0x88'),{'FaxAccountId':_[_0x88ef('0x68')](_0xc0b90f['body'])?undefined:_0xc0b90f[_0x88ef('0x5b')]['FaxAccountId'],'path':_[_0x88ef('0x68')](_0x2e876e)?undefined:util['format'](_0x88ef('0x89'),_0x2e876e[_0x88ef('0x8a')]),'fax':_[_0x88ef('0x68')](_0x51cb5c['fax'])?undefined:_0x51cb5c[_0x88ef('0x5f')],'AttachmentId':_0x51cb5c[_0x88ef('0x87')]},client9002);})[_0x88ef('0x39')](respondWithResult(_0xdc8488,0xc9))[_0x88ef('0x29')](handleError(_0xdc8488,null));};exports[_0x88ef('0x8b')]=function(_0x553778,_0x3c7c06){var _0x5d40b2=path[_0x88ef('0x8c')](config[_0x88ef('0x8d')],_0x88ef('0x8e'),_0x88ef('0x8f'),_0x88ef('0x90'));return db[_0x88ef('0x59')][_0x88ef('0x5a')]({'where':{'id':_0x553778[_0x88ef('0x58')]['id']},'include':[{'model':db['Attachment'],'as':_0x88ef('0x86')}]})['then'](handleEntityNotFound(_0x3c7c06,null))[_0x88ef('0x39')](function(_0x213417){if(_0x213417){return _0x3c7c06[_0x88ef('0x8b')](path[_0x88ef('0x8c')](_0x5d40b2,_0x213417['Attachment']['basename']));}})[_0x88ef('0x29')](handleError(_0x3c7c06,null));}; \ No newline at end of file +var _0x9038=['acceptmessage','reject','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','User','fullname','event','create','CmContact','findOne','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','sendStatus','offset','undefined','count','limit','status','Content-Range','json','destroy','stack','send','map','FaxMessage','rawAttributes','fieldName','key','name','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','findAll','show','params','fields','includeAll','include','find','update','body','describe','fax-interactions','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager'];(function(_0xe8ec7a,_0x3cf106){var _0x5341e4=function(_0x33b0c4){while(--_0x33b0c4){_0xe8ec7a['push'](_0xe8ec7a['shift']());}};_0x5341e4(++_0x3cf106);}(_0x9038,0x13d));var _0x8903=function(_0x59bd5,_0x582410){_0x59bd5=_0x59bd5-0x0;var _0x82c625=_0x9038[_0x59bd5];return _0x82c625;};'use strict';var emlformat=require(_0x8903('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8903('0x1'));var jsonpatch=require(_0x8903('0x2'));var rp=require(_0x8903('0x3'));var moment=require(_0x8903('0x4'));var BPromise=require(_0x8903('0x5'));var Mustache=require('mustache');var util=require(_0x8903('0x6'));var path=require(_0x8903('0x7'));var sox=require(_0x8903('0x8'));var csv=require(_0x8903('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8903('0xa'));var squel=require(_0x8903('0xb'));var crypto=require(_0x8903('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8903('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8903('0xe'));var Redis=require(_0x8903('0xf'));var authService=require(_0x8903('0x10'));var qs=require(_0x8903('0x11'));var as=require(_0x8903('0x12'));var hardwareService=require(_0x8903('0x13'));var logger=require(_0x8903('0x14'))(_0x8903('0x15'));var utils=require(_0x8903('0x16'));var config=require(_0x8903('0x17'));var licenseUtil=require(_0x8903('0x18'));var db=require(_0x8903('0x19'))['db'];config[_0x8903('0x1a')]=_[_0x8903('0x1b')](config['redis'],{'host':_0x8903('0x1c'),'port':0x18eb});var socket=require(_0x8903('0x1d'))(new Redis(config[_0x8903('0x1a')]));require(_0x8903('0x1e'))[_0x8903('0x1f')](socket);var jayson=require(_0x8903('0x20'));var client=jayson['client'][_0x8903('0x21')]({'port':0x232c});var client9002=jayson[_0x8903('0x22')][_0x8903('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x326a33,_0xa27fc,_0xbdc30d,_0x5af45b){return new BPromise(function(_0x1ac6f0,_0xeeb387){var _0x11f3dc=_0x5af45b||client;return _0x11f3dc[_0x8903('0x23')](_0x326a33,_0xbdc30d)[_0x8903('0x24')](function(_0x3e26ca){logger[_0x8903('0x25')](_0x8903('0x26'),_0xa27fc,'request\x20sent');logger[_0x8903('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xa27fc,'request\x20sent',JSON['stringify'](_0x3e26ca));if(_0x3e26ca[_0x8903('0x28')]){if(_0x3e26ca[_0x8903('0x28')][_0x8903('0x29')]===0x1f4){logger['error'](_0x8903('0x26'),_0xa27fc,_0x3e26ca[_0x8903('0x28')][_0x8903('0x2a')]);return _0xeeb387(_0x3e26ca[_0x8903('0x28')]['message']);}logger[_0x8903('0x28')](_0x8903('0x26'),_0xa27fc,_0x3e26ca[_0x8903('0x28')][_0x8903('0x2a')]);return _0x1ac6f0(_0x3e26ca['error'][_0x8903('0x2a')]);}else{logger[_0x8903('0x25')](_0x8903('0x26'),_0xa27fc,_0x8903('0x2b'));_0x1ac6f0(_0x3e26ca['result']['message']);}})[_0x8903('0x2c')](function(_0x2597f3){logger[_0x8903('0x28')](_0x8903('0x26'),_0xa27fc,_0x2597f3);_0xeeb387(_0x2597f3);});});}function respondWithStatusCode(_0x6bce47,_0xcc251b){_0xcc251b=_0xcc251b||0xcc;return function(_0x476e26){if(_0x476e26){return _0x6bce47[_0x8903('0x2d')](_0xcc251b);}return _0x6bce47['status'](_0xcc251b)['end']();};}function respondWithResult(_0x161099,_0x2aa1df){_0x2aa1df=_0x2aa1df||0xc8;return function(_0x48a155){if(_0x48a155){return _0x161099['status'](_0x2aa1df)['json'](_0x48a155);}};}function respondWithFilteredResult(_0x5f3990,_0x15f73c){return function(_0x5e95da){if(_0x5e95da){var _0x303365=typeof _0x15f73c[_0x8903('0x2e')]===_0x8903('0x2f')&&typeof _0x15f73c['limit']===_0x8903('0x2f');var _0x3781b0=_0x5e95da[_0x8903('0x30')];var _0x94babc=_0x303365?0x0:_0x15f73c['offset'];var _0x5b2473=_0x303365?_0x5e95da[_0x8903('0x30')]:_0x15f73c[_0x8903('0x2e')]+_0x15f73c[_0x8903('0x31')];var _0x38b297;if(_0x5b2473>=_0x3781b0){_0x5b2473=_0x3781b0;_0x38b297=0xc8;}else{_0x38b297=0xce;}_0x5f3990[_0x8903('0x32')](_0x38b297);return _0x5f3990['set'](_0x8903('0x33'),_0x94babc+'-'+_0x5b2473+'/'+_0x3781b0)[_0x8903('0x34')](_0x5e95da);}return null;};}function patchUpdates(_0x31579e){return function(_0x516702){try{jsonpatch['apply'](_0x516702,_0x31579e,!![]);}catch(_0xde5509){return BPromise['reject'](_0xde5509);}return _0x516702['save']();};}function saveUpdates(_0xbf8423,_0x47d21f){return function(_0x491fa7){if(_0x491fa7){return _0x491fa7['update'](_0xbf8423)[_0x8903('0x24')](function(_0x13213f){return _0x13213f;});}return null;};}function removeEntity(_0x8aa2e9,_0x17a629){return function(_0x134e81){if(_0x134e81){return _0x134e81[_0x8903('0x35')]()['then'](function(){_0x8aa2e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e19e9,_0x51e32c){return function(_0x4a544f){if(!_0x4a544f){_0x3e19e9[_0x8903('0x2d')](0x194);}return _0x4a544f;};}function handleError(_0x275d4e,_0x398eb9){_0x398eb9=_0x398eb9||0x1f4;return function(_0x1d2e5a){logger[_0x8903('0x28')](_0x1d2e5a[_0x8903('0x36')]);if(_0x1d2e5a['name']){delete _0x1d2e5a['name'];}_0x275d4e[_0x8903('0x32')](_0x398eb9)[_0x8903('0x37')](_0x1d2e5a);};}exports['index']=function(_0x44d5e5,_0x5ac08c){var _0x1d4eb6={},_0x3e8150={},_0xa99bfb={'count':0x0,'rows':[]};var _0x3d5cab=_[_0x8903('0x38')](db[_0x8903('0x39')][_0x8903('0x3a')],function(_0x293ba6){return{'name':_0x293ba6[_0x8903('0x3b')],'type':_0x293ba6['type'][_0x8903('0x3c')]};});_0x3e8150['model']=_[_0x8903('0x38')](_0x3d5cab,_0x8903('0x3d'));_0x3e8150[_0x8903('0x3e')]=_[_0x8903('0x3f')](_0x44d5e5[_0x8903('0x3e')]);_0x3e8150['filters']=_[_0x8903('0x40')](_0x3e8150[_0x8903('0x41')],_0x3e8150['query']);_0x1d4eb6['attributes']=_[_0x8903('0x40')](_0x3e8150[_0x8903('0x41')],qs['fields'](_0x44d5e5[_0x8903('0x3e')]['fields']));_0x1d4eb6[_0x8903('0x42')]=_0x1d4eb6['attributes'][_0x8903('0x43')]?_0x1d4eb6[_0x8903('0x42')]:_0x3e8150[_0x8903('0x41')];if(!_0x44d5e5[_0x8903('0x3e')][_0x8903('0x44')](_0x8903('0x45'))){_0x1d4eb6[_0x8903('0x31')]=qs[_0x8903('0x31')](_0x44d5e5[_0x8903('0x3e')][_0x8903('0x31')]);_0x1d4eb6['offset']=qs['offset'](_0x44d5e5[_0x8903('0x3e')][_0x8903('0x2e')]);}_0x1d4eb6[_0x8903('0x46')]=qs[_0x8903('0x47')](_0x44d5e5[_0x8903('0x3e')][_0x8903('0x47')]);_0x1d4eb6[_0x8903('0x48')]=qs['filters'](_[_0x8903('0x49')](_0x44d5e5[_0x8903('0x3e')],_0x3e8150[_0x8903('0x4a')]),_0x3d5cab);if(_0x44d5e5[_0x8903('0x3e')][_0x8903('0x4b')]){_0x1d4eb6[_0x8903('0x48')]=_['merge'](_0x1d4eb6['where'],{'$or':_['map'](_0x3d5cab,function(_0x5024d3){if(_0x5024d3[_0x8903('0x4c')]!==_0x8903('0x4d')){var _0x2660f5={};_0x2660f5[_0x5024d3[_0x8903('0x3d')]]={'$like':'%'+_0x44d5e5[_0x8903('0x3e')][_0x8903('0x4b')]+'%'};return _0x2660f5;}})});}_0x1d4eb6=_[_0x8903('0x4e')]({},_0x1d4eb6,_0x44d5e5[_0x8903('0x4f')]);var _0x4b502e={'where':_0x1d4eb6[_0x8903('0x48')]};return db[_0x8903('0x39')][_0x8903('0x30')](_0x4b502e)[_0x8903('0x24')](function(_0x514b2){_0xa99bfb[_0x8903('0x30')]=_0x514b2;if(_0x44d5e5[_0x8903('0x3e')]['includeAll']){_0x1d4eb6['include']=[{'all':!![]}];}return db[_0x8903('0x39')][_0x8903('0x50')](_0x1d4eb6);})[_0x8903('0x24')](function(_0x57b39d){_0xa99bfb['rows']=_0x57b39d;return _0xa99bfb;})[_0x8903('0x24')](respondWithFilteredResult(_0x5ac08c,_0x1d4eb6))[_0x8903('0x2c')](handleError(_0x5ac08c,null));};exports[_0x8903('0x51')]=function(_0x2a32ad,_0x1de5e5){var _0x146838={'raw':!![],'where':{'id':_0x2a32ad[_0x8903('0x52')]['id']}},_0xf3033a={};_0xf3033a[_0x8903('0x41')]=_[_0x8903('0x3f')](db[_0x8903('0x39')][_0x8903('0x3a')]);_0xf3033a[_0x8903('0x3e')]=_['keys'](_0x2a32ad['query']);_0xf3033a[_0x8903('0x4a')]=_[_0x8903('0x40')](_0xf3033a['model'],_0xf3033a[_0x8903('0x3e')]);_0x146838[_0x8903('0x42')]=_[_0x8903('0x40')](_0xf3033a[_0x8903('0x41')],qs[_0x8903('0x53')](_0x2a32ad['query'][_0x8903('0x53')]));_0x146838[_0x8903('0x42')]=_0x146838[_0x8903('0x42')][_0x8903('0x43')]?_0x146838[_0x8903('0x42')]:_0xf3033a[_0x8903('0x41')];if(_0x2a32ad[_0x8903('0x3e')][_0x8903('0x54')]){_0x146838[_0x8903('0x55')]=[{'all':!![]}];}_0x146838=_[_0x8903('0x4e')]({},_0x146838,_0x2a32ad[_0x8903('0x4f')]);return db['FaxMessage'][_0x8903('0x56')](_0x146838)[_0x8903('0x24')](handleEntityNotFound(_0x1de5e5,null))['then'](respondWithResult(_0x1de5e5,null))[_0x8903('0x2c')](handleError(_0x1de5e5,null));};exports[_0x8903('0x57')]=function(_0x164846,_0x6fdf18){if(_0x164846[_0x8903('0x58')]['id']){delete _0x164846[_0x8903('0x58')]['id'];}return db[_0x8903('0x39')][_0x8903('0x56')]({'where':{'id':_0x164846[_0x8903('0x52')]['id']}})['then'](handleEntityNotFound(_0x6fdf18,null))[_0x8903('0x24')](saveUpdates(_0x164846[_0x8903('0x58')],null))['then'](respondWithResult(_0x6fdf18,null))[_0x8903('0x2c')](handleError(_0x6fdf18,null));};exports['destroy']=function(_0x1fabfd,_0x4b84c0){return db[_0x8903('0x39')][_0x8903('0x56')]({'where':{'id':_0x1fabfd[_0x8903('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b84c0,null))[_0x8903('0x24')](removeEntity(_0x4b84c0,null))[_0x8903('0x2c')](handleError(_0x4b84c0,null));};exports[_0x8903('0x59')]=function(_0x25b05c,_0x3453f8){return db[_0x8903('0x39')][_0x8903('0x59')]()[_0x8903('0x24')](respondWithResult(_0x3453f8,null))[_0x8903('0x2c')](handleError(_0x3453f8,null));};var interaction_log=require(_0x8903('0x14'))(_0x8903('0x5a'));exports['accept']=function(_0x356717,_0x1c7e89,_0x35c4bd){var _0x3b1496={'agent':{},'channel':_0x8903('0x5b')};if(_0x356717[_0x8903('0x58')]['id']){delete _0x356717['body']['id'];}_0x356717['body'][_0x8903('0x5c')]=!![];_0x356717[_0x8903('0x58')]['readAt']=moment()[_0x8903('0x5d')](_0x8903('0x5e'));_0x356717[_0x8903('0x58')][_0x8903('0x5f')]=_0x356717[_0x8903('0x58')][_0x8903('0x5f')]||_0x356717[_0x8903('0x60')]['id'];_0x3b1496['agent']['id']=_0x356717[_0x8903('0x58')][_0x8903('0x5f')];return db[_0x8903('0x39')][_0x8903('0x56')]({'where':{'id':_0x356717['params']['id'],'UserId':null}})[_0x8903('0x24')](handleEntityNotFound(_0x1c7e89,null))[_0x8903('0x24')](saveUpdates(_0x356717[_0x8903('0x58')],null))['then'](function(_0x198ebd){if(_0x198ebd){_0x3b1496['message']=_0x198ebd[_0x8903('0x61')]({'plain':!![]});return db[_0x8903('0x62')][_0x8903('0x56')]({'where':{'id':_0x198ebd['FaxInteractionId']}});}return null;})[_0x8903('0x24')](handleEntityNotFound(_0x1c7e89,null))['then'](function(_0x2b5371){if(_0x2b5371){return _0x2b5371['update']({'UserId':_0x356717[_0x8903('0x58')][_0x8903('0x5f')],'read1stAt':_[_0x8903('0x63')](_0x2b5371[_0x8903('0x64')])?moment()[_0x8903('0x5d')](_0x8903('0x5e')):undefined});}return null;})[_0x8903('0x24')](function(_0x27ef9e){if(_0x27ef9e){_0x3b1496[_0x8903('0x65')]=_0x27ef9e[_0x8903('0x61')]({'plain':!![]});interaction_log[_0x8903('0x25')](_0x8903('0x66'),_0x356717[_0x8903('0x60')]['id'],_0x356717[_0x8903('0x60')][_0x8903('0x3d')],_0x356717[_0x8903('0x60')][_0x8903('0x67')],_0x3b1496[_0x8903('0x65')]['id'],_0x356717['body']?JSON[_0x8903('0x68')](_0x356717[_0x8903('0x58')]):_0x8903('0x69'));return respondWithRpcPromise(_0x8903('0x6a'),_0x8903('0x6b'),_0x3b1496);}return null;})[_0x8903('0x24')](function(_0x1829d2){var _0x1115be=_0x8903('0x6c')+_0x1829d2[_0x8903('0x2a')][_0x8903('0x6d')];return db[_0x8903('0x6e')][_0x8903('0x3e')](_0x1115be,{'type':db['Sequelize'][_0x8903('0x6f')][_0x8903('0x70')],'raw':!![]})['then'](function(_0x1d8271){return _0x1d8271;});})['then'](function(_0x150f44){if(_0x150f44){_0x3b1496[_0x8903('0x2a')][_0x8903('0x71')]=_0x150f44[0x0];if(!_0x356717[_0x8903('0x58')][_0x8903('0x5f')])return;return db['User'][_0x8903('0x56')]({'where':{'id':_0x356717[_0x8903('0x58')][_0x8903('0x5f')],'role':_0x8903('0x72')},'attributes':['id',_0x8903('0x3d'),'fullname',_0x8903('0x73'),_0x8903('0x74')],'raw':!![]});}return null;})['then'](function(_0x1ffea9){if(!_0x1ffea9)return null;_0x3b1496[_0x8903('0x2a')][_0x8903('0x72')]=_0x1ffea9;return _0x3b1496;})[_0x8903('0x24')](function(_0x38fe01){if(_0x38fe01){if(_0x356717['body'][_0x8903('0x75')]){_0x3b1496['message'][_0x8903('0x76')]=util['format'](_0x8903('0x77'),_0x356717[_0x8903('0x60')]['name']);_0x3b1496['message']['channel']=_0x3b1496[_0x8903('0x78')];_0x3b1496['message'][_0x8903('0x79')]=_0x3b1496['channel'];_0x3b1496['message']['event']=_0x8903('0x7a');return respondWithRpcPromise(_0x8903('0x7b'),_0x8903('0x7b'),{'event':_0x8903('0x7c'),'message':_0x3b1496[_0x8903('0x2a')]},client9002)[_0x8903('0x24')](function(){return _0x3b1496;});}return _0x3b1496;}return null;})[_0x8903('0x24')](respondWithResult(_0x1c7e89,null))[_0x8903('0x2c')](handleError(_0x1c7e89,null));};var interaction_log=require(_0x8903('0x14'))(_0x8903('0x5a'));exports[_0x8903('0x7d')]=function(_0x45a9dc,_0x3340cd,_0x173947){var _0x48f679={'agent':{},'channel':_0x8903('0x5b')};if(_0x45a9dc[_0x8903('0x58')]['id']){delete _0x45a9dc[_0x8903('0x58')]['id'];}_0x45a9dc[_0x8903('0x58')]['UserId']=_0x45a9dc[_0x8903('0x58')][_0x8903('0x5f')]||_0x45a9dc[_0x8903('0x60')]['id'];_0x48f679[_0x8903('0x72')]['id']=_0x45a9dc['body']['UserId'];return db[_0x8903('0x39')][_0x8903('0x56')]({'where':{'id':_0x45a9dc['params']['id'],'UserId':null}})[_0x8903('0x24')](handleEntityNotFound(_0x3340cd,null))[_0x8903('0x24')](function(_0x5cbcaa){if(_0x5cbcaa){_0x48f679['message']=_0x5cbcaa['get']({'plain':!![]});return db[_0x8903('0x62')][_0x8903('0x56')]({'where':{'id':_0x5cbcaa[_0x8903('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x3340cd,null))['then'](function(_0x2e3273){if(_0x2e3273){_0x48f679[_0x8903('0x65')]=_0x2e3273['get']({'plain':!![]});interaction_log[_0x8903('0x25')](_0x8903('0x7f'),_0x45a9dc[_0x8903('0x60')]['id'],_0x45a9dc['user'][_0x8903('0x3d')],_0x45a9dc[_0x8903('0x60')][_0x8903('0x67')],_0x48f679[_0x8903('0x65')]['id'],_0x45a9dc[_0x8903('0x58')]?JSON[_0x8903('0x68')](_0x45a9dc[_0x8903('0x58')]):_0x8903('0x69'));return respondWithRpcPromise(_0x8903('0x80'),_0x8903('0x81'),_0x48f679);}return null;})['then'](function(_0x33e095){var _0x3cb5cc=_0x8903('0x6c')+_0x33e095[_0x8903('0x2a')][_0x8903('0x6d')];return db[_0x8903('0x6e')][_0x8903('0x3e')](_0x3cb5cc,{'type':db[_0x8903('0x82')][_0x8903('0x6f')][_0x8903('0x70')],'raw':!![]})[_0x8903('0x24')](function(_0xd7789){return _0xd7789;});})[_0x8903('0x24')](function(_0x22dcfc){if(_0x22dcfc){_0x48f679['message'][_0x8903('0x71')]=_0x22dcfc[0x0];if(!_0x45a9dc[_0x8903('0x58')][_0x8903('0x5f')])return;return db[_0x8903('0x83')][_0x8903('0x56')]({'where':{'id':_0x45a9dc[_0x8903('0x58')]['UserId'],'role':_0x8903('0x72')},'attributes':['id',_0x8903('0x3d'),_0x8903('0x84'),_0x8903('0x73'),_0x8903('0x74')],'raw':!![]});}return null;})[_0x8903('0x24')](function(_0x3437d4){if(!_0x3437d4)return null;_0x48f679[_0x8903('0x2a')]['agent']=_0x3437d4;return _0x48f679;})[_0x8903('0x24')](function(_0x2adbee){if(_0x2adbee){_0x2adbee[_0x8903('0x2a')][_0x8903('0x76')]=util[_0x8903('0x5d')](_0x8903('0x77'),_0x45a9dc[_0x8903('0x60')]['name']);_0x2adbee[_0x8903('0x2a')][_0x8903('0x78')]=_0x48f679[_0x8903('0x78')];_0x2adbee['message'][_0x8903('0x79')]=_0x48f679[_0x8903('0x78')];_0x2adbee['message'][_0x8903('0x85')]=_0x8903('0x7d');respondWithRpcPromise(_0x8903('0x7b'),_0x8903('0x7b'),{'event':'rejectmessage','message':_0x2adbee['message']},client9002);return _0x48f679;}return null;})['then'](respondWithResult(_0x3340cd,null))[_0x8903('0x2c')](handleError(_0x3340cd,null));};exports[_0x8903('0x86')]=function(_0x34f611,_0x91bf95){var _0x22cd2c;return db['FaxMessage'][_0x8903('0x86')](_0x34f611[_0x8903('0x58')],{})['then'](function(_0xbfcc3c){_0x22cd2c=_0xbfcc3c;return db[_0x8903('0x87')][_0x8903('0x88')]({'where':{'id':_0x22cd2c[_0x8903('0x6d')]}});})[_0x8903('0x24')](function(_0x41afdf){if(_['isNil'](_0x41afdf)){return;}else{_0x22cd2c[_0x8903('0x5b')]=_0x41afdf[_0x8903('0x5b')];return db[_0x8903('0x89')][_0x8903('0x88')]({'where':{'id':_0x22cd2c[_0x8903('0x8a')]}});}})[_0x8903('0x24')](function(_0x2ba479){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x8903('0x63')](_0x34f611[_0x8903('0x58')])?undefined:_0x34f611[_0x8903('0x58')]['FaxAccountId'],'path':_[_0x8903('0x63')](_0x2ba479)?undefined:util[_0x8903('0x5d')](_0x8903('0x8b'),_0x2ba479[_0x8903('0x8c')]),'fax':_[_0x8903('0x63')](_0x22cd2c[_0x8903('0x5b')])?undefined:_0x22cd2c[_0x8903('0x5b')],'AttachmentId':_0x22cd2c['AttachmentId']},client9002);})[_0x8903('0x24')](respondWithResult(_0x91bf95,0xc9))[_0x8903('0x2c')](handleError(_0x91bf95,null));};exports['download']=function(_0x30fdb6,_0x1f4e2e){var _0x2d49a2=path[_0x8903('0x8d')](config[_0x8903('0x8e')],_0x8903('0x8f'),_0x8903('0x90'),_0x8903('0x91'));return db[_0x8903('0x39')][_0x8903('0x56')]({'where':{'id':_0x30fdb6[_0x8903('0x52')]['id']},'include':[{'model':db[_0x8903('0x89')],'as':_0x8903('0x89')}]})[_0x8903('0x24')](handleEntityNotFound(_0x1f4e2e,null))[_0x8903('0x24')](function(_0x564406){if(_0x564406){return _0x1f4e2e[_0x8903('0x92')](path[_0x8903('0x8d')](_0x2d49a2,_0x564406[_0x8903('0x89')][_0x8903('0x8c')]));}})[_0x8903('0x2c')](handleError(_0x1f4e2e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a2c557d..f6a5c1a 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 _0xfcbe=['FaxMessage','setMaxListeners','save','update','remove','hasOwnProperty','../../mysqldb'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x4c89d1,_0x30d007){_0x4c89d1=_0x4c89d1-0x0;var _0x24dce2=_0xfcbe[_0x4c89d1];return _0x24dce2;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xefcb('0x0'))['db'][_0xefcb('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xefcb('0x2')](0x0);var events={'afterCreate':_0xefcb('0x3'),'afterUpdate':_0xefcb('0x4'),'afterDestroy':_0xefcb('0x5')};function emitEvent(_0x5cb515){return function(_0xbfb8c6,_0x14f3b5,_0x53c9b9){FaxMessageEvents['emit'](_0x5cb515+':'+_0xbfb8c6['id'],_0xbfb8c6);FaxMessageEvents['emit'](_0x5cb515,_0xbfb8c6);_0x53c9b9(null);};}for(var e in events){if(events[_0xefcb('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xc1c6=['../../mysqldb','FaxMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x36fe9a,_0x18a772){var _0x219124=function(_0x44954f){while(--_0x44954f){_0x36fe9a['push'](_0x36fe9a['shift']());}};_0x219124(++_0x18a772);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2243ed,_0x162d31){_0x2243ed=_0x2243ed-0x0;var _0x107486=_0xc1c6[_0x2243ed];return _0x107486;};'use strict';var EventEmitter=require(_0x6c1c('0x0'));var FaxMessage=require(_0x6c1c('0x1'))['db'][_0x6c1c('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c1c('0x3'),'afterUpdate':'update','afterDestroy':_0x6c1c('0x4')};function emitEvent(_0x40ff59){return function(_0x265d2c,_0x59f799,_0x56ed6f){FaxMessageEvents[_0x6c1c('0x5')](_0x40ff59+':'+_0x265d2c['id'],_0x265d2c);FaxMessageEvents['emit'](_0x40ff59,_0x265d2c);_0x56ed6f(null);};}for(var e in events){if(events[_0x6c1c('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6c1c('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 94b9871..843b503 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 _0xd62c=['exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes'];(function(_0x514816,_0x49afbf){var _0x20a9bc=function(_0x3849b3){while(--_0x3849b3){_0x514816['push'](_0x514816['shift']());}};_0x20a9bc(++_0x49afbf);}(_0xd62c,0x1b1));var _0xcd62=function(_0x112f87,_0x2e84a9){_0x112f87=_0x112f87-0x0;var _0x214196=_0xd62c[_0x112f87];return _0x214196;};'use strict';var _=require(_0xcd62('0x0'));var util=require('util');var logger=require(_0xcd62('0x1'))(_0xcd62('0x2'));var moment=require(_0xcd62('0x3'));var BPromise=require(_0xcd62('0x4'));var rp=require(_0xcd62('0x5'));var fs=require('fs');var path=require(_0xcd62('0x6'));var rimraf=require('rimraf');var config=require(_0xcd62('0x7'));var attributes=require(_0xcd62('0x8'));module[_0xcd62('0x9')]=function(_0x2413e4,_0x750616){return _0x2413e4[_0xcd62('0xa')](_0xcd62('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xcd62('0xc'),'fields':[_0xcd62('0xd')],'type':_0xcd62('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d4456,_0x1997e6,_0x5dcfb2){var _0x4db793=_0x2413e4['models'];var _0x120c28=_0x3d4456['get']({'plain':!![]});if(_0x120c28[_0xcd62('0xf')][_0xcd62('0x10')]()==='in'||_0x120c28[_0xcd62('0xf')]['toLowerCase']()==='out'&&!_0x120c28[_0xcd62('0x11')]&&!_[_0xcd62('0x12')](_0x120c28[_0xcd62('0x13')])){_0x4db793[_0xcd62('0x14')][_0xcd62('0x15')]({'where':{'id':_0x120c28[_0xcd62('0x16')]}})['then'](function(_0x2f15ca){if(_0x2f15ca){_0x2f15ca[_0xcd62('0x17')]({'lastMsgAt':_0x120c28['createdAt'],'lastMsgDirection':_0x120c28[_0xcd62('0xf')]['toLowerCase']()});}})[_0xcd62('0x18')](function(_0x1cf44d){console['error'](_0x1cf44d);});}_0x5dcfb2();}},'charset':'utf8mb4','collate':_0xcd62('0x19')});}; \ No newline at end of file +var _0xb5de=['catch','error','utf8mb4','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','findOne','FaxInteractionId','then','update','createdAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5de,0x13b));var _0xeb5d=function(_0xa23505,_0x2bc163){_0xa23505=_0xa23505-0x0;var _0x2b2fae=_0xb5de[_0xa23505];return _0x2b2fae;};'use strict';var _=require(_0xeb5d('0x0'));var util=require(_0xeb5d('0x1'));var logger=require(_0xeb5d('0x2'))('api');var moment=require(_0xeb5d('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb5d('0x4'));var fs=require('fs');var path=require(_0xeb5d('0x5'));var rimraf=require('rimraf');var config=require(_0xeb5d('0x6'));var attributes=require('./faxMessage.attributes');module[_0xeb5d('0x7')]=function(_0x2ca1a7,_0x80020b){return _0x2ca1a7[_0xeb5d('0x8')]('FaxMessage',attributes,{'tableName':_0xeb5d('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xeb5d('0xa')],'type':_0xeb5d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1801eb,_0x5b4822,_0x2214fc){var _0x23fb59=_0x2ca1a7[_0xeb5d('0xc')];var _0x2c5163=_0x1801eb[_0xeb5d('0xd')]({'plain':!![]});if(_0x2c5163[_0xeb5d('0xe')][_0xeb5d('0xf')]()==='in'||_0x2c5163[_0xeb5d('0xe')][_0xeb5d('0xf')]()==='out'&&!_0x2c5163[_0xeb5d('0x10')]&&!_['isNil'](_0x2c5163[_0xeb5d('0x11')])){_0x23fb59['FaxInteraction'][_0xeb5d('0x12')]({'where':{'id':_0x2c5163[_0xeb5d('0x13')]}})[_0xeb5d('0x14')](function(_0x549a8f){if(_0x549a8f){_0x549a8f[_0xeb5d('0x15')]({'lastMsgAt':_0x2c5163[_0xeb5d('0x16')],'lastMsgDirection':_0x2c5163[_0xeb5d('0xe')][_0xeb5d('0xf')]()});}})[_0xeb5d('0x17')](function(_0x39508c){console[_0xeb5d('0x18')](_0x39508c);});}_0x2214fc();}},'charset':_0xeb5d('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index bc64780..c5aeb5a 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 _0x5636=['error','code','message','result','CreateFaxMessage','FaxMessage','body','options','then','UpdateFaxMessage','update','where','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1fc512,_0x1996db){var _0xae94b9=function(_0x18f59d){while(--_0x18f59d){_0x1fc512['push'](_0x1fc512['shift']());}};_0xae94b9(++_0x1996db);}(_0x5636,0x102));var _0x6563=function(_0x2c83fa,_0x218bc0){_0x2c83fa=_0x2c83fa-0x0;var _0x37cc82=_0x5636[_0x2c83fa];return _0x37cc82;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});config[_0x6563('0xa')]=_[_0x6563('0xb')](config[_0x6563('0xa')],{'host':_0x6563('0xc'),'port':0x18eb});var socket=require(_0x6563('0xd'))(new Redis(config[_0x6563('0xa')]));require(_0x6563('0xe'))[_0x6563('0xf')](socket);function respondWithRpcPromise(_0x516d1a,_0x51fdc2,_0x2946f3){return new BPromise(function(_0x129fa3,_0x490a56){return client['request'](_0x516d1a,_0x2946f3)['then'](function(_0x1ef002){logger[_0x6563('0x10')](_0x6563('0x11'),_0x51fdc2,_0x6563('0x12'));logger[_0x6563('0x13')](_0x6563('0x14'),_0x51fdc2,_0x6563('0x12'),JSON[_0x6563('0x15')](_0x1ef002));if(_0x1ef002[_0x6563('0x16')]){if(_0x1ef002['error'][_0x6563('0x17')]===0x1f4){logger['error'](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x490a56(_0x1ef002[_0x6563('0x16')]['message']);}logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x129fa3(_0x1ef002['error'][_0x6563('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x51fdc2,'request\x20sent');_0x129fa3(_0x1ef002[_0x6563('0x19')]['message']);}})['catch'](function(_0x27651b){logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x27651b);_0x490a56(_0x27651b);});});}exports[_0x6563('0x1a')]=function(_0xf8b544){var _0x10811d=this;return new Promise(function(_0x37ba3,_0x93a45){return db[_0x6563('0x1b')]['create'](_0xf8b544[_0x6563('0x1c')],{'raw':_0xf8b544[_0x6563('0x1d')]?_0xf8b544[_0x6563('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6563('0x1e')](function(_0x5c37bb){logger[_0x6563('0x10')](_0x6563('0x1a'),_0xf8b544);logger['debug']('CreateFaxMessage',_0xf8b544,JSON[_0x6563('0x15')](_0x5c37bb));_0x37ba3(_0x5c37bb);})['catch'](function(_0x1097d0){logger[_0x6563('0x16')](_0x6563('0x1a'),_0x1097d0['message'],_0xf8b544);_0x93a45(_0x10811d[_0x6563('0x16')](0x1f4,_0x1097d0['message']));});});};exports[_0x6563('0x1f')]=function(_0x1590e6){var _0x5e5aeb=this;return new Promise(function(_0x365b16,_0x28252d){return db['FaxMessage'][_0x6563('0x20')](_0x1590e6['body'],{'raw':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')][_0x6563('0x21')]||null:null,'attributes':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')]['attributes']||null:null,'limit':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['limit']||null:null})[_0x6563('0x1e')](function(_0x35af37){logger[_0x6563('0x10')](_0x6563('0x1f'),_0x1590e6);logger[_0x6563('0x13')](_0x6563('0x1f'),_0x1590e6,JSON[_0x6563('0x15')](_0x35af37));_0x365b16(_0x35af37);})[_0x6563('0x22')](function(_0x101b24){logger[_0x6563('0x16')]('UpdateFaxMessage',_0x101b24[_0x6563('0x18')],_0x1590e6);_0x28252d(_0x5e5aeb[_0x6563('0x16')](0x1f4,_0x101b24[_0x6563('0x18')]));});});}; \ No newline at end of file +var _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x50013e,_0x1e5e5d){var _0x3daeb5=function(_0x54d861){while(--_0x54d861){_0x50013e['push'](_0x50013e['shift']());}};_0x3daeb5(++_0x1e5e5d);}(_0xac9d,0x14d));var _0xdac9=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xac9d[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 01d7fb9..3c495e4 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 _0xc5b4=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc5b4,0xee));var _0x4c5b=function(_0x57baba,_0x57411f){_0x57baba=_0x57baba-0x0;var _0x48720d=_0xc5b4[_0x57baba];return _0x48720d;};'use strict';var FaxMessageEvents=require(_0x4c5b('0x0'));var events=['save',_0x4c5b('0x1'),_0x4c5b('0x2')];function createListener(_0x8cc2fb,_0x42f607){return function(_0x1a41d0){_0x42f607[_0x4c5b('0x3')](_0x8cc2fb,_0x1a41d0);};}function removeListener(_0x3c0aa0,_0x58980f){return function(){FaxMessageEvents[_0x4c5b('0x4')](_0x3c0aa0,_0x58980f);};}exports[_0x4c5b('0x5')]=function(_0x1246d9){for(var _0xde829a=0x0,_0x517845=events[_0x4c5b('0x6')];_0xde829a<_0x517845;_0xde829a++){var _0x3c4bb8=events[_0xde829a];var _0x3e729e=createListener(_0x4c5b('0x7')+_0x3c4bb8,_0x1246d9);FaxMessageEvents['on'](_0x3c4bb8,_0x3e729e);}}; \ No newline at end of file +var _0xe952=['./faxMessage.events','update','removeListener','register'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xe952,0x14c));var _0x2e95=function(_0x15c903,_0x4ab918){_0x15c903=_0x15c903-0x0;var _0x57027f=_0xe952[_0x15c903];return _0x57027f;};'use strict';var FaxMessageEvents=require(_0x2e95('0x0'));var events=['save','remove',_0x2e95('0x1')];function createListener(_0x58a0cf,_0x4e4e3c){return function(_0x5ace20){_0x4e4e3c['emit'](_0x58a0cf,_0x5ace20);};}function removeListener(_0x251cba,_0x532a47){return function(){FaxMessageEvents[_0x2e95('0x2')](_0x251cba,_0x532a47);};}exports[_0x2e95('0x3')]=function(_0x43fbd0){for(var _0x317a03=0x0,_0x5949d5=events['length'];_0x317a03<_0x5949d5;_0x317a03++){var _0x1cc3af=events[_0x317a03];var _0x49315d=createListener('faxMessage:'+_0x1cc3af,_0x43fbd0);FaxMessageEvents['on'](_0x1cc3af,_0x49315d);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 50a3986..3d7c56a 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 _0xb49a=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show','download','post','tracked','fax','create'];(function(_0x15b4ba,_0x2f485b){var _0x37a719=function(_0x8acda3){while(--_0x8acda3){_0x15b4ba['push'](_0x15b4ba['shift']());}};_0x37a719(++_0x2f485b);}(_0xb49a,0xfb));var _0xab49=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0xb49a[_0x446789];return _0x534e45;};'use strict';var multer=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var path=require(_0xab49('0x2'));var timeout=require(_0xab49('0x3'));var express=require(_0xab49('0x4'));var router=express['Router']();var fs_extra=require(_0xab49('0x5'));var auth=require(_0xab49('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab49('0x7'));router[_0xab49('0x8')]('/',auth[_0xab49('0x9')](),controller[_0xab49('0xa')]);router[_0xab49('0x8')](_0xab49('0xb'),auth[_0xab49('0x9')](),controller['describe']);router[_0xab49('0x8')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0xd')]);router[_0xab49('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xab49('0xe')]);router[_0xab49('0xf')]('/',auth[_0xab49('0x9')](),interaction[_0xab49('0x10')](_0xab49('0x11'),'faxmessage:create'),controller[_0xab49('0x12')]);router[_0xab49('0x13')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x14')]);router[_0xab49('0x13')](_0xab49('0x15'),auth[_0xab49('0x9')](),controller[_0xab49('0x16')]);router[_0xab49('0x13')](_0xab49('0x17'),auth['isAuthenticated'](),controller[_0xab49('0x18')]);router[_0xab49('0x19')](_0xab49('0xc'),auth[_0xab49('0x9')](),controller[_0xab49('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x16d2,0x123));var _0x216d=function(_0x4abf13,_0x28742a){_0x4abf13=_0x4abf13-0x0;var _0x27b0e5=_0x16d2[_0x4abf13];return _0x27b0e5;};'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['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ac8d3de..65c909b 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 _0x053f=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x1ddf49,_0x3356eb){var _0x5958e9=function(_0xd7600e){while(--_0xd7600e){_0x1ddf49['push'](_0x1ddf49['shift']());}};_0x5958e9(++_0x3356eb);}(_0x053f,0xbf));var _0xf053=function(_0x340f21,_0x16f08c){_0x340f21=_0x340f21-0x0;var _0x2ad508=_0x053f[_0x340f21];return _0x2ad508;};'use strict';var Sequelize=require('sequelize');module[_0xf053('0x0')]={'name':{'type':Sequelize[_0xf053('0x1')],'unique':_0xf053('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf053('0x1')]},'timeout':{'type':Sequelize[_0xf053('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf053('0x4')](_0xf053('0x5'),_0xf053('0x6'),_0xf053('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xff59=['roundrobin','exports','STRING','INTEGER','rrmemory'];(function(_0x203c97,_0x231c73){var _0x5b53b3=function(_0x4778fe){while(--_0x4778fe){_0x203c97['push'](_0x203c97['shift']());}};_0x5b53b3(++_0x231c73);}(_0xff59,0x79));var _0x9ff5=function(_0x4b8a78,_0x4f1c49){_0x4b8a78=_0x4b8a78-0x0;var _0x9d4015=_0xff59[_0x4b8a78];return _0x9d4015;};'use strict';var Sequelize=require('sequelize');module[_0x9ff5('0x0')]={'name':{'type':Sequelize[_0x9ff5('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9ff5('0x1')]},'timeout':{'type':Sequelize[_0x9ff5('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9ff5('0x3'),'beepall',_0x9ff5('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9ff5('0x2')],'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 710c23c..bbd27d4 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 _0x7ee1=['toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','bluebird','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','FaxQueues','end','sendStatus','error','stack','send','index','map','FaxQueue','rawAttributes','type','key','getOptions','where','include','rows','catch','params','model','query','keys','attributes','intersection','fields','length','includeAll','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','pick','FaxQueueId','filter','User','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','filters','nolimit','ids','findAll','Agents','voicePause','sequelize','transaction','addTeams','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x119d06,_0x437c9f){var _0x719586=function(_0x2066f9){while(--_0x2066f9){_0x119d06['push'](_0x119d06['shift']());}};_0x719586(++_0x437c9f);}(_0x7ee1,0x8d));var _0x17ee=function(_0x4f5ef6,_0x5560ae){_0x4f5ef6=_0x4f5ef6-0x0;var _0x31f594=_0x7ee1[_0x4f5ef6];return _0x31f594;};'use strict';var BPromise=require(_0x17ee('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x17ee('0x1'));var qs=require(_0x17ee('0x2'));var logger=require(_0x17ee('0x3'))('api');var config=require(_0x17ee('0x4'));var db=require(_0x17ee('0x5'))['db'];config[_0x17ee('0x6')]=_[_0x17ee('0x7')](config['redis'],{'host':_0x17ee('0x8'),'port':0x18eb});var socket=require(_0x17ee('0x9'))(new Redis(config['redis']));require(_0x17ee('0xa'))['register'](socket);function respondWithStatusCode(_0x3d767b,_0xfa5096){_0xfa5096=_0xfa5096||0xcc;return function(_0x2c961f){if(_0x2c961f){return _0x3d767b['sendStatus'](_0xfa5096);}return _0x3d767b['status'](_0xfa5096)['end']();};}function respondWithResult(_0x17f935,_0x4ee1e0){_0x4ee1e0=_0x4ee1e0||0xc8;return function(_0x155964){if(_0x155964){return _0x17f935[_0x17ee('0xb')](_0x4ee1e0)[_0x17ee('0xc')](_0x155964);}};}function respondWithFilteredResult(_0x3d4f0f,_0x57fae0){return function(_0x1acde5){if(_0x1acde5){var _0x51b5d9=typeof _0x57fae0[_0x17ee('0xd')]===_0x17ee('0xe')&&typeof _0x57fae0[_0x17ee('0xf')]===_0x17ee('0xe');var _0x308ec7=_0x1acde5[_0x17ee('0x10')];var _0x225d05=_0x51b5d9?0x0:_0x57fae0[_0x17ee('0xd')];var _0x1e734f=_0x51b5d9?_0x1acde5[_0x17ee('0x10')]:_0x57fae0[_0x17ee('0xd')]+_0x57fae0['limit'];var _0x4b66be;if(_0x1e734f>=_0x308ec7){_0x1e734f=_0x308ec7;_0x4b66be=0xc8;}else{_0x4b66be=0xce;}_0x3d4f0f['status'](_0x4b66be);return _0x3d4f0f['set'](_0x17ee('0x11'),_0x225d05+'-'+_0x1e734f+'/'+_0x308ec7)[_0x17ee('0xc')](_0x1acde5);}return null;};}function saveUpdates(_0x1b87c3){return function(_0x2e2287){if(_0x2e2287){return _0x2e2287[_0x17ee('0x12')](_0x1b87c3)[_0x17ee('0x13')](function(_0x63d27f){return _0x63d27f;});}return null;};}function removeEntity(_0x587ca7){return function(_0x44fe58){if(_0x44fe58){return _0x44fe58[_0x17ee('0x14')]()[_0x17ee('0x13')](function(){var _0x11ca6b=_0x44fe58[_0x17ee('0x15')]({'plain':!![]});var _0x57925d=_0x17ee('0x16');return db['UserProfileResource'][_0x17ee('0x14')]({'where':{'type':_0x57925d,'resourceId':_0x11ca6b['id']}})['then'](function(){return _0x44fe58;});})[_0x17ee('0x13')](function(){_0x587ca7[_0x17ee('0xb')](0xcc)[_0x17ee('0x17')]();});}};}function handleEntityNotFound(_0xdbeb6a){return function(_0x3e23f8){if(!_0x3e23f8){_0xdbeb6a[_0x17ee('0x18')](0x194);}return _0x3e23f8;};}function handleError(_0x44548f,_0x14295f){_0x14295f=_0x14295f||0x1f4;return function(_0x1425e5){logger[_0x17ee('0x19')](_0x1425e5[_0x17ee('0x1a')]);if(_0x1425e5['name']){delete _0x1425e5['name'];}_0x44548f[_0x17ee('0xb')](_0x14295f)[_0x17ee('0x1b')](_0x1425e5);};}exports[_0x17ee('0x1c')]=function(_0x9b379d,_0x3bbddf){var _0xea358f={};var _0x2f6e84={'count':0x0,'rows':[]};var _0x1d8aa2=_[_0x17ee('0x1d')](db[_0x17ee('0x1e')][_0x17ee('0x1f')],function(_0x2a332f){return{'name':_0x2a332f['fieldName'],'type':_0x2a332f[_0x17ee('0x20')][_0x17ee('0x21')]};});_0xea358f=qs[_0x17ee('0x22')](_0x1d8aa2,_0x9b379d);var _0x258018={'where':_0xea358f[_0x17ee('0x23')]};return db['FaxQueue'][_0x17ee('0x10')](_0x258018)[_0x17ee('0x13')](function(_0x295186){_0x2f6e84['count']=_0x295186;_0xea358f[_0x17ee('0x24')]=qs[_0x17ee('0x24')](_0x9b379d['query']);return db[_0x17ee('0x1e')]['findAll'](_0xea358f);})[_0x17ee('0x13')](function(_0x5a44c4){_0x2f6e84[_0x17ee('0x25')]=_0x5a44c4;return _0x2f6e84;})[_0x17ee('0x13')](respondWithFilteredResult(_0x3bbddf,_0xea358f))[_0x17ee('0x26')](handleError(_0x3bbddf,null));};exports['show']=function(_0x3e513a,_0x7fb525){var _0x57bfd4={'raw':!![],'where':{'id':_0x3e513a[_0x17ee('0x27')]['id']}},_0xf20ed7={};_0xf20ed7[_0x17ee('0x28')]=_['keys'](db['FaxQueue'][_0x17ee('0x1f')]);_0xf20ed7[_0x17ee('0x29')]=_[_0x17ee('0x2a')](_0x3e513a[_0x17ee('0x29')]);_0xf20ed7['filters']=_['intersection'](_0xf20ed7[_0x17ee('0x28')],_0xf20ed7[_0x17ee('0x29')]);_0x57bfd4[_0x17ee('0x2b')]=_[_0x17ee('0x2c')](_0xf20ed7[_0x17ee('0x28')],qs[_0x17ee('0x2d')](_0x3e513a[_0x17ee('0x29')]['fields']));_0x57bfd4['attributes']=_0x57bfd4['attributes'][_0x17ee('0x2e')]?_0x57bfd4['attributes']:_0xf20ed7[_0x17ee('0x28')];if(_0x3e513a[_0x17ee('0x29')][_0x17ee('0x2f')]){_0x57bfd4['include']=[{'all':!![]}];}_0x57bfd4=_[_0x17ee('0x30')]({},_0x57bfd4,_0x3e513a[_0x17ee('0x31')]);return db['FaxQueue']['find'](_0x57bfd4)[_0x17ee('0x13')](handleEntityNotFound(_0x7fb525,null))[_0x17ee('0x13')](respondWithResult(_0x7fb525,null))[_0x17ee('0x26')](handleError(_0x7fb525,null));};exports[_0x17ee('0x32')]=function(_0x2273a6,_0x5a2c08){return db['FaxQueue'][_0x17ee('0x32')](_0x2273a6[_0x17ee('0x33')],{})[_0x17ee('0x13')](function(_0x30fdb7){var _0x3543ee=_0x2273a6[_0x17ee('0x34')]['get']({'plain':!![]});if(!_0x3543ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3543ee[_0x17ee('0x35')]===_0x17ee('0x34')){var _0x2580b4=_0x30fdb7[_0x17ee('0x15')]({'plain':!![]});var _0x18ff00=_0x17ee('0x16');return db[_0x17ee('0x36')][_0x17ee('0x37')]({'where':{'name':_0x18ff00,'userProfileId':_0x3543ee[_0x17ee('0x38')]},'raw':!![]})[_0x17ee('0x13')](function(_0x53cb88){if(_0x53cb88&&_0x53cb88['autoAssociation']===0x0){return db['UserProfileResource'][_0x17ee('0x32')]({'name':_0x2580b4[_0x17ee('0x39')],'resourceId':_0x2580b4['id'],'type':_0x53cb88[_0x17ee('0x39')],'sectionId':_0x53cb88['id']},{})[_0x17ee('0x13')](function(){return _0x30fdb7;});}else{return _0x30fdb7;}})['catch'](function(_0x4516c5){logger[_0x17ee('0x19')](_0x17ee('0x3a'),_0x4516c5);throw _0x4516c5;});}return _0x30fdb7;})[_0x17ee('0x13')](respondWithResult(_0x5a2c08,0xc9))['catch'](handleError(_0x5a2c08,null));};exports[_0x17ee('0x12')]=function(_0x55b4e2,_0x2b9f50){if(_0x55b4e2[_0x17ee('0x33')]['id']){delete _0x55b4e2[_0x17ee('0x33')]['id'];}return db[_0x17ee('0x1e')][_0x17ee('0x37')]({'where':{'id':_0x55b4e2[_0x17ee('0x27')]['id']}})['then'](handleEntityNotFound(_0x2b9f50,null))[_0x17ee('0x13')](saveUpdates(_0x55b4e2[_0x17ee('0x33')],null))[_0x17ee('0x13')](respondWithResult(_0x2b9f50,null))[_0x17ee('0x26')](handleError(_0x2b9f50,null));};exports[_0x17ee('0x14')]=function(_0x284944,_0x27f787){return db[_0x17ee('0x1e')][_0x17ee('0x37')]({'where':{'id':_0x284944[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x27f787,null))[_0x17ee('0x13')](removeEntity(_0x27f787,null))['catch'](handleError(_0x27f787,null));};exports[_0x17ee('0x3b')]=function(_0x35d687,_0x578510){return db['FaxQueue']['describe']()[_0x17ee('0x13')](respondWithResult(_0x578510,null))[_0x17ee('0x26')](handleError(_0x578510,null));};exports[_0x17ee('0x3c')]=function(_0x45aa19,_0x1a14e0){var _0x5b394b={'raw':!![],'where':{}},_0x226adc={},_0x40d95a;return db[_0x17ee('0x1e')][_0x17ee('0x3d')]({'where':{'id':_0x45aa19[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x1a14e0,null))[_0x17ee('0x13')](function(_0x22e797){if(_0x22e797){_0x40d95a=_0x22e797[_0x17ee('0x15')]({'plain':!![]});_0x226adc[_0x17ee('0x28')]=_[_0x17ee('0x2a')](db[_0x17ee('0x3e')]['rawAttributes']);_0x226adc['query']=_[_0x17ee('0x2a')](_0x45aa19[_0x17ee('0x29')]);_0x226adc['filters']=_['intersection'](_0x226adc[_0x17ee('0x28')],_0x226adc['query']);_0x5b394b[_0x17ee('0x2b')]=_[_0x17ee('0x2c')](_0x226adc[_0x17ee('0x28')],qs[_0x17ee('0x2d')](_0x45aa19[_0x17ee('0x29')][_0x17ee('0x2d')]));_0x5b394b[_0x17ee('0x2b')]=_0x5b394b[_0x17ee('0x2b')][_0x17ee('0x2e')]?_0x5b394b[_0x17ee('0x2b')]:_0x226adc[_0x17ee('0x28')];if(!_0x45aa19[_0x17ee('0x29')][_0x17ee('0x3f')]('nolimit')){_0x5b394b[_0x17ee('0xf')]=qs[_0x17ee('0xf')](_0x45aa19['query'][_0x17ee('0xf')]);_0x5b394b[_0x17ee('0xd')]=qs['offset'](_0x45aa19[_0x17ee('0x29')][_0x17ee('0xd')]);}_0x5b394b[_0x17ee('0x40')]=qs[_0x17ee('0x41')](_0x45aa19[_0x17ee('0x29')][_0x17ee('0x41')]);_0x5b394b[_0x17ee('0x23')]=qs['filters'](_[_0x17ee('0x42')](_0x45aa19['query'],_0x226adc['filters']));_0x5b394b[_0x17ee('0x23')][_0x17ee('0x43')]=_0x22e797['id'];if(_0x45aa19[_0x17ee('0x29')]['filter']){_0x5b394b['where']=_[_0x17ee('0x30')](_0x5b394b[_0x17ee('0x23')],{'$or':_[_0x17ee('0x1d')](_0x5b394b[_0x17ee('0x2b')],function(_0x2dbabe){var _0x2b98f1={};_0x2b98f1[_0x2dbabe]={'$like':'%'+_0x45aa19[_0x17ee('0x29')][_0x17ee('0x44')]+'%'};return _0x2b98f1;})});}_0x5b394b=_['merge']({},_0x5b394b,_0x45aa19[_0x17ee('0x31')]);return db[_0x17ee('0x3e')]['findAll'](_0x5b394b);}})['then'](function(_0x59b2e7){if(_0x59b2e7){return db[_0x17ee('0x45')]['findAndCountAll']({'where':{'id':_['map'](_0x59b2e7,'UserId'),'role':_0x17ee('0x46')},'attributes':['id',_0x17ee('0x39'),_0x17ee('0x47'),'updatedAt',_0x17ee('0x48')]});}})[_0x17ee('0x13')](function(_0x407317){if(_0x407317){return{'count':_0x407317[_0x17ee('0x10')],'rows':_['map'](_0x407317[_0x17ee('0x25')],function(_0x10093b){return{'membername':_0x10093b['name'],'UserId':_0x10093b['id'],'queue_name':_0x40d95a[_0x17ee('0x39')],'FaxQueueId':_0x40d95a['id'],'interface':util[_0x17ee('0x49')](_0x17ee('0x4a'),_0x17ee('0x4b'),_0x10093b[_0x17ee('0x39')]),'penalty':0x0,'paused':_0x10093b[_0x17ee('0x47')],'createdAt':_0x10093b[_0x17ee('0x48')],'updatedAt':_0x10093b[_0x17ee('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17ee('0x13')](respondWithFilteredResult(_0x1a14e0,_0x5b394b))[_0x17ee('0x26')](handleError(_0x1a14e0,null));};exports[_0x17ee('0x4d')]=function(_0x4db694,_0x2859f0){var _0x18a340={};var _0x4d308e={};var _0x3cc10b;var _0x288f55;return db[_0x17ee('0x1e')]['findOne']({'where':{'id':_0x4db694[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x2859f0,null))[_0x17ee('0x13')](function(_0x1eb4e5){if(_0x1eb4e5){_0x3cc10b=_0x1eb4e5;_0x4d308e['model']=_[_0x17ee('0x2a')](db[_0x17ee('0x4e')]['rawAttributes']);_0x4d308e[_0x17ee('0x29')]=_[_0x17ee('0x2a')](_0x4db694[_0x17ee('0x29')]);_0x4d308e[_0x17ee('0x4f')]=_[_0x17ee('0x2c')](_0x4d308e[_0x17ee('0x28')],_0x4d308e[_0x17ee('0x29')]);_0x18a340[_0x17ee('0x2b')]=_[_0x17ee('0x2c')](_0x4d308e[_0x17ee('0x28')],qs[_0x17ee('0x2d')](_0x4db694['query'][_0x17ee('0x2d')]));_0x18a340['attributes']=_0x18a340[_0x17ee('0x2b')][_0x17ee('0x2e')]?_0x18a340[_0x17ee('0x2b')]:_0x4d308e['model'];_0x18a340['order']=qs[_0x17ee('0x41')](_0x4db694[_0x17ee('0x29')][_0x17ee('0x41')]);_0x18a340[_0x17ee('0x23')]=qs['filters'](_[_0x17ee('0x42')](_0x4db694['query'],_0x4d308e['filters']));if(_0x4db694[_0x17ee('0x29')][_0x17ee('0x44')]){_0x18a340['where']=_['merge'](_0x18a340[_0x17ee('0x23')],{'$or':_[_0x17ee('0x1d')](_0x18a340['attributes'],function(_0x41ccac){var _0x421744={};_0x421744[_0x41ccac]={'$like':'%'+_0x4db694[_0x17ee('0x29')][_0x17ee('0x44')]+'%'};return _0x421744;})});}_0x18a340=_[_0x17ee('0x30')]({},_0x18a340,_0x4db694[_0x17ee('0x31')]);return _0x3cc10b[_0x17ee('0x4d')](_0x18a340);}})['then'](function(_0x1ac252){if(_0x1ac252){_0x288f55=_0x1ac252[_0x17ee('0x2e')];if(!_0x4db694[_0x17ee('0x29')][_0x17ee('0x3f')](_0x17ee('0x50'))){_0x18a340[_0x17ee('0xf')]=qs[_0x17ee('0xf')](_0x4db694[_0x17ee('0x29')][_0x17ee('0xf')]);_0x18a340[_0x17ee('0xd')]=qs[_0x17ee('0xd')](_0x4db694['query'][_0x17ee('0xd')]);}return _0x3cc10b[_0x17ee('0x4d')](_0x18a340);}})[_0x17ee('0x13')](function(_0x258569){if(_0x258569){return _0x258569?{'count':_0x288f55,'rows':_0x258569}:null;}})[_0x17ee('0x13')](respondWithResult(_0x2859f0,null))[_0x17ee('0x26')](handleError(_0x2859f0,null));};exports['addTeams']=function(_0x2d04d2,_0x34d23d){var _0x55c7af=_0x2d04d2[_0x17ee('0x33')][_0x17ee('0x51')];return db[_0x17ee('0x4e')][_0x17ee('0x52')]({'where':{'id':_0x55c7af},'attributes':['id'],'include':[{'model':db[_0x17ee('0x45')],'as':_0x17ee('0x53'),'attributes':['id','name','online',_0x17ee('0x54'),'interface'],'raw':!![]}]})[_0x17ee('0x13')](function(_0x1719d9){if(_0x1719d9){var _0x5097eb=_['flatMap'](_0x1719d9,function(_0x1b8507){var _0x94c07=_0x1b8507[_0x17ee('0x15')]({'plain':!![]});return _0x94c07['Agents'];});return db[_0x17ee('0x1e')][_0x17ee('0x37')]({'where':{'id':_0x2d04d2[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](function(_0x51228d){return db[_0x17ee('0x55')][_0x17ee('0x56')](function(_0x2e933f){return _0x51228d[_0x17ee('0x57')](_0x55c7af,{'transaction':_0x2e933f})[_0x17ee('0x13')](function(){return BPromise[_0x17ee('0x58')](_0x5097eb,function(_0x36d3a2){return db[_0x17ee('0x3e')][_0x17ee('0x59')]({'where':{'UserId':_0x36d3a2['id'],'FaxQueueId':_0x2d04d2[_0x17ee('0x27')]['id']},'transaction':_0x2e933f});});})[_0x17ee('0x13')](function(){_0x5097eb['forEach'](function(_0x207833){socket[_0x17ee('0x5a')](_0x17ee('0x5b'),{'UserId':_0x207833['id'],'FaxQueueId':_0x51228d['id']});});});});});}})[_0x17ee('0x13')](respondWithStatusCode(_0x34d23d,null))[_0x17ee('0x26')](handleError(_0x34d23d,null));};exports[_0x17ee('0x5c')]=function(_0x1738f3,_0x5b294f){return db[_0x17ee('0x4e')][_0x17ee('0x52')]({'where':{'id':_0x1738f3[_0x17ee('0x29')][_0x17ee('0x51')]},'attributes':['id'],'include':[{'model':db[_0x17ee('0x45')],'as':_0x17ee('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5b294f,null))[_0x17ee('0x13')](function(_0x3c6536){var _0x40f002=_[_0x17ee('0x1d')](_0x3c6536,'id');var _0x359420=[];var _0x3b8188=[];var _0x5caa8f=squel[_0x17ee('0x5d')]();_0x5caa8f[_0x17ee('0x5e')](_0x17ee('0x5f'))[_0x17ee('0x60')](_0x17ee('0x61'),'tq')[_0x17ee('0x62')](_0x17ee('0x63'),'ut',_0x17ee('0x64'))[_0x17ee('0x23')](_0x17ee('0x65'),_0x1738f3[_0x17ee('0x27')]['id']);for(var _0xedd714=0x0;_0xedd714<_0x3c6536['length'];_0xedd714+=0x1){let _0x436622=_0x3c6536[_0xedd714];for(var _0x3d2c2e=0x0;_0x3d2c2e<_0x436622['Agents'][_0x17ee('0x2e')];_0x3d2c2e+=0x1){let _0x304029=_0x436622[_0x17ee('0x53')][_0x3d2c2e];var _0x53ddb7=_0x5caa8f[_0x17ee('0x66')]();_0x53ddb7[_0x17ee('0x23')](_0x17ee('0x67'),_0x304029['id']);_0x3b8188[_0x17ee('0x68')](db[_0x17ee('0x55')][_0x17ee('0x29')](_0x53ddb7[_0x17ee('0x69')](),{'type':db['sequelize'][_0x17ee('0x6a')][_0x17ee('0x6b')]})[_0x17ee('0x13')](function(_0x5daff0){if(_0x5daff0[_0x17ee('0x2e')]===0x1){return _0x304029['id'];}else{var _0x188da2=_[_0x17ee('0x6c')](_[_0x17ee('0x1d')](_0x5daff0,_0x17ee('0x6d')),function(_0x4d6a45){return _[_0x17ee('0x6e')](_0x40f002,_0x4d6a45);});if(_0x188da2){return _0x304029['id'];}}}));}}return BPromise['all'](_0x3b8188)[_0x17ee('0x13')](function(_0xeeb388){_0x359420=_(_0x359420)[_0x17ee('0x6f')](_0xeeb388)[_0x17ee('0x70')]()[_0x17ee('0x71')]();return db[_0x17ee('0x1e')][_0x17ee('0x37')]({'where':{'id':_0x1738f3['params']['id']}})[_0x17ee('0x13')](function(_0x3b9a31){return db[_0x17ee('0x55')][_0x17ee('0x56')](function(_0x1b96b2){return _0x3b9a31['removeTeams'](_0x1738f3[_0x17ee('0x29')][_0x17ee('0x51')],{'transaction':_0x1b96b2})['then'](function(){if(!_[_0x17ee('0x72')](_0x359420)){return _0x3b9a31[_0x17ee('0x73')](_0x359420,{'transaction':_0x1b96b2});}})[_0x17ee('0x13')](function(){_0x359420[_0x17ee('0x74')](function(_0x564a2e){socket[_0x17ee('0x5a')]('userFaxQueue:remove',{'UserId':_0x564a2e,'FaxQueueId':_0x3b9a31['id']});});});});});});})[_0x17ee('0x13')](respondWithStatusCode(_0x5b294f,null))[_0x17ee('0x26')](handleError(_0x5b294f,null));};exports[_0x17ee('0x75')]=function(_0x75bf67,_0x38f3a1){return db[_0x17ee('0x1e')]['find']({'where':{'id':_0x75bf67[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x38f3a1,null))[_0x17ee('0x13')](function(_0x1bd6cb){if(_0x1bd6cb){return _0x1bd6cb[_0x17ee('0x75')](_0x75bf67[_0x17ee('0x33')][_0x17ee('0x51')],_[_0x17ee('0x76')](_0x75bf67[_0x17ee('0x33')],[_0x17ee('0x51'),'id'])||{})[_0x17ee('0x77')](function(_0x27961c){for(var _0x39220a=0x0;_0x39220a<_0x75bf67['body']['ids'][_0x17ee('0x2e')];_0x39220a+=0x1){socket[_0x17ee('0x5a')](_0x17ee('0x5b'),{'UserId':Number(_0x75bf67[_0x17ee('0x33')][_0x17ee('0x51')][_0x39220a]),'FaxQueueId':Number(_0x75bf67['params']['id'])});}return _0x27961c;});}})[_0x17ee('0x13')](respondWithResult(_0x38f3a1,null))[_0x17ee('0x26')](handleError(_0x38f3a1,null));};exports[_0x17ee('0x73')]=function(_0x2e6906,_0x633b58){return db[_0x17ee('0x1e')][_0x17ee('0x37')]({'where':{'id':_0x2e6906[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x633b58,null))[_0x17ee('0x13')](function(_0x350fd5){if(_0x350fd5){return _0x350fd5['removeAgents'](_0x2e6906[_0x17ee('0x29')][_0x17ee('0x51')])['then'](function(){if(_[_0x17ee('0x78')](_0x2e6906[_0x17ee('0x29')]['ids'])){for(var _0x2aaae6=0x0;_0x2aaae6<_0x2e6906['query'][_0x17ee('0x51')][_0x17ee('0x2e')];_0x2aaae6+=0x1){socket[_0x17ee('0x5a')](_0x17ee('0x79'),{'UserId':Number(_0x2e6906['query'][_0x17ee('0x51')][_0x2aaae6]),'FaxQueueId':Number(_0x2e6906[_0x17ee('0x27')]['id'])});}}else{socket[_0x17ee('0x5a')]('userFaxQueue:remove',{'UserId':Number(_0x2e6906[_0x17ee('0x29')]['ids']),'FaxQueueId':Number(_0x2e6906[_0x17ee('0x27')]['id'])});}});}})[_0x17ee('0x13')](respondWithStatusCode(_0x633b58,null))[_0x17ee('0x26')](handleError(_0x633b58,null));};exports[_0x17ee('0x7a')]=function(_0x47f8d9,_0x1995de){var _0x405dc5={};var _0x378fd8={};var _0x15fb5d;var _0x3531c8;return db['FaxQueue'][_0x17ee('0x3d')]({'where':{'id':_0x47f8d9[_0x17ee('0x27')]['id']}})[_0x17ee('0x13')](handleEntityNotFound(_0x1995de,null))[_0x17ee('0x13')](function(_0x2198c6){if(_0x2198c6){_0x15fb5d=_0x2198c6;_0x378fd8['model']=_['keys'](db[_0x17ee('0x45')][_0x17ee('0x1f')]);_0x378fd8[_0x17ee('0x29')]=_[_0x17ee('0x2a')](_0x47f8d9[_0x17ee('0x29')]);_0x378fd8['filters']=_[_0x17ee('0x2c')](_0x378fd8[_0x17ee('0x28')],_0x378fd8[_0x17ee('0x29')]);_0x405dc5['attributes']=_[_0x17ee('0x2c')](_0x378fd8[_0x17ee('0x28')],qs[_0x17ee('0x2d')](_0x47f8d9[_0x17ee('0x29')][_0x17ee('0x2d')]));_0x405dc5['attributes']=_0x405dc5[_0x17ee('0x2b')]['length']?_0x405dc5['attributes']:_0x378fd8['model'];_0x405dc5['order']=qs[_0x17ee('0x41')](_0x47f8d9['query'][_0x17ee('0x41')]);_0x405dc5[_0x17ee('0x23')]=qs['filters'](_[_0x17ee('0x42')](_0x47f8d9[_0x17ee('0x29')],_0x378fd8[_0x17ee('0x4f')]));if(_0x47f8d9[_0x17ee('0x29')][_0x17ee('0x44')]){_0x405dc5[_0x17ee('0x23')]=_[_0x17ee('0x30')](_0x405dc5[_0x17ee('0x23')],{'$or':_[_0x17ee('0x1d')](_0x405dc5[_0x17ee('0x2b')],function(_0x5295bc){var _0x18178b={};_0x18178b[_0x5295bc]={'$like':'%'+_0x47f8d9[_0x17ee('0x29')]['filter']+'%'};return _0x18178b;})});}_0x405dc5=_['merge']({},_0x405dc5,_0x47f8d9['options']);return _0x15fb5d['getAgents'](_0x405dc5);}})[_0x17ee('0x13')](function(_0x2384c8){if(_0x2384c8){_0x3531c8=_0x2384c8['length'];if(!_0x47f8d9[_0x17ee('0x29')][_0x17ee('0x3f')]('nolimit')){_0x405dc5[_0x17ee('0xf')]=qs[_0x17ee('0xf')](_0x47f8d9[_0x17ee('0x29')]['limit']);_0x405dc5[_0x17ee('0xd')]=qs['offset'](_0x47f8d9[_0x17ee('0x29')][_0x17ee('0xd')]);}return _0x15fb5d[_0x17ee('0x7a')](_0x405dc5);}})[_0x17ee('0x13')](function(_0x3124d1){if(_0x3124d1){return _0x3124d1?{'count':_0x3531c8,'rows':_0x3124d1}:null;}})[_0x17ee('0x13')](respondWithResult(_0x1995de,null))[_0x17ee('0x26')](handleError(_0x1995de,null));}; \ No newline at end of file +var _0xb931=['undefined','count','set','Content-Range','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','where','include','query','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','limit','sort','filter','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','pick','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','findAll','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','compact','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset'];(function(_0x2cf7d5,_0x1b6cfa){var _0x12e409=function(_0x281427){while(--_0x281427){_0x2cf7d5['push'](_0x2cf7d5['shift']());}};_0x12e409(++_0x1b6cfa);}(_0xb931,0x155));var _0x1b93=function(_0xf50fb9,_0x1a0fc9){_0xf50fb9=_0xf50fb9-0x0;var _0x2d287e=_0xb931[_0xf50fb9];return _0x2d287e;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1b93('0x0'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x1b93('0x1'));var logger=require(_0x1b93('0x2'))(_0x1b93('0x3'));var config=require(_0x1b93('0x4'));var db=require(_0x1b93('0x5'))['db'];config[_0x1b93('0x6')]=_[_0x1b93('0x7')](config[_0x1b93('0x6')],{'host':_0x1b93('0x8'),'port':0x18eb});var socket=require(_0x1b93('0x9'))(new Redis(config[_0x1b93('0x6')]));require(_0x1b93('0xa'))[_0x1b93('0xb')](socket);function respondWithStatusCode(_0x3dc130,_0xa1d294){_0xa1d294=_0xa1d294||0xcc;return function(_0x59e100){if(_0x59e100){return _0x3dc130['sendStatus'](_0xa1d294);}return _0x3dc130[_0x1b93('0xc')](_0xa1d294)[_0x1b93('0xd')]();};}function respondWithResult(_0x12026b,_0x4aa9fb){_0x4aa9fb=_0x4aa9fb||0xc8;return function(_0x38e7da){if(_0x38e7da){return _0x12026b['status'](_0x4aa9fb)[_0x1b93('0xe')](_0x38e7da);}};}function respondWithFilteredResult(_0x4391ec,_0x5c53ae){return function(_0x49e16b){if(_0x49e16b){var _0x3f8dc6=typeof _0x5c53ae[_0x1b93('0xf')]===_0x1b93('0x10')&&typeof _0x5c53ae['limit']===_0x1b93('0x10');var _0x4d6496=_0x49e16b[_0x1b93('0x11')];var _0x12ca65=_0x3f8dc6?0x0:_0x5c53ae[_0x1b93('0xf')];var _0x1ea97a=_0x3f8dc6?_0x49e16b[_0x1b93('0x11')]:_0x5c53ae[_0x1b93('0xf')]+_0x5c53ae['limit'];var _0x140515;if(_0x1ea97a>=_0x4d6496){_0x1ea97a=_0x4d6496;_0x140515=0xc8;}else{_0x140515=0xce;}_0x4391ec[_0x1b93('0xc')](_0x140515);return _0x4391ec[_0x1b93('0x12')](_0x1b93('0x13'),_0x12ca65+'-'+_0x1ea97a+'/'+_0x4d6496)['json'](_0x49e16b);}return null;};}function saveUpdates(_0x294be5){return function(_0x42b8d4){if(_0x42b8d4){return _0x42b8d4['update'](_0x294be5)[_0x1b93('0x14')](function(_0x339c5b){return _0x339c5b;});}return null;};}function removeEntity(_0x4ed0d5){return function(_0x5ccbf4){if(_0x5ccbf4){return _0x5ccbf4[_0x1b93('0x15')]()[_0x1b93('0x14')](function(){var _0x296d4e=_0x5ccbf4[_0x1b93('0x16')]({'plain':!![]});var _0x474263='FaxQueues';return db[_0x1b93('0x17')][_0x1b93('0x15')]({'where':{'type':_0x474263,'resourceId':_0x296d4e['id']}})['then'](function(){return _0x5ccbf4;});})['then'](function(){_0x4ed0d5[_0x1b93('0xc')](0xcc)[_0x1b93('0xd')]();});}};}function handleEntityNotFound(_0x44c4d5){return function(_0x79363e){if(!_0x79363e){_0x44c4d5[_0x1b93('0x18')](0x194);}return _0x79363e;};}function handleError(_0x333390,_0x577a22){_0x577a22=_0x577a22||0x1f4;return function(_0x43e492){logger[_0x1b93('0x19')](_0x43e492[_0x1b93('0x1a')]);if(_0x43e492['name']){delete _0x43e492[_0x1b93('0x1b')];}_0x333390[_0x1b93('0xc')](_0x577a22)[_0x1b93('0x1c')](_0x43e492);};}exports[_0x1b93('0x1d')]=function(_0x25561b,_0x6f5350){var _0x13cddc={};var _0x309ac5={'count':0x0,'rows':[]};var _0x14626a=_[_0x1b93('0x1e')](db[_0x1b93('0x1f')][_0x1b93('0x20')],function(_0xa15258){return{'name':_0xa15258[_0x1b93('0x21')],'type':_0xa15258[_0x1b93('0x22')]['key']};});_0x13cddc=qs['getOptions'](_0x14626a,_0x25561b);var _0x5dccf3={'where':_0x13cddc[_0x1b93('0x23')]};return db[_0x1b93('0x1f')][_0x1b93('0x11')](_0x5dccf3)[_0x1b93('0x14')](function(_0xc47d69){_0x309ac5['count']=_0xc47d69;_0x13cddc['include']=qs[_0x1b93('0x24')](_0x25561b[_0x1b93('0x25')]);return db[_0x1b93('0x1f')]['findAll'](_0x13cddc);})[_0x1b93('0x14')](function(_0x49873d){_0x309ac5[_0x1b93('0x26')]=_0x49873d;return _0x309ac5;})[_0x1b93('0x14')](respondWithFilteredResult(_0x6f5350,_0x13cddc))[_0x1b93('0x27')](handleError(_0x6f5350,null));};exports['show']=function(_0x54a2cb,_0xa0f296){var _0x488891={'raw':!![],'where':{'id':_0x54a2cb[_0x1b93('0x28')]['id']}},_0x1310a9={};_0x1310a9[_0x1b93('0x29')]=_['keys'](db[_0x1b93('0x1f')][_0x1b93('0x20')]);_0x1310a9[_0x1b93('0x25')]=_[_0x1b93('0x2a')](_0x54a2cb[_0x1b93('0x25')]);_0x1310a9[_0x1b93('0x2b')]=_[_0x1b93('0x2c')](_0x1310a9[_0x1b93('0x29')],_0x1310a9[_0x1b93('0x25')]);_0x488891[_0x1b93('0x2d')]=_[_0x1b93('0x2c')](_0x1310a9['model'],qs['fields'](_0x54a2cb[_0x1b93('0x25')][_0x1b93('0x2e')]));_0x488891[_0x1b93('0x2d')]=_0x488891[_0x1b93('0x2d')][_0x1b93('0x2f')]?_0x488891[_0x1b93('0x2d')]:_0x1310a9[_0x1b93('0x29')];if(_0x54a2cb['query']['includeAll']){_0x488891['include']=[{'all':!![]}];}_0x488891=_[_0x1b93('0x30')]({},_0x488891,_0x54a2cb[_0x1b93('0x31')]);return db['FaxQueue']['find'](_0x488891)[_0x1b93('0x14')](handleEntityNotFound(_0xa0f296,null))[_0x1b93('0x14')](respondWithResult(_0xa0f296,null))['catch'](handleError(_0xa0f296,null));};exports[_0x1b93('0x32')]=function(_0x5d2590,_0x413013){return db[_0x1b93('0x1f')][_0x1b93('0x32')](_0x5d2590[_0x1b93('0x33')],{})[_0x1b93('0x14')](function(_0x2b292f){var _0x538e18=_0x5d2590[_0x1b93('0x34')]['get']({'plain':!![]});if(!_0x538e18)throw new Error(_0x1b93('0x35'));if(_0x538e18['role']===_0x1b93('0x34')){var _0x3bf62d=_0x2b292f[_0x1b93('0x16')]({'plain':!![]});var _0x3f68fb=_0x1b93('0x36');return db[_0x1b93('0x37')][_0x1b93('0x38')]({'where':{'name':_0x3f68fb,'userProfileId':_0x538e18[_0x1b93('0x39')]},'raw':!![]})[_0x1b93('0x14')](function(_0x42913e){if(_0x42913e&&_0x42913e[_0x1b93('0x3a')]===0x0){return db[_0x1b93('0x17')][_0x1b93('0x32')]({'name':_0x3bf62d[_0x1b93('0x1b')],'resourceId':_0x3bf62d['id'],'type':_0x42913e['name'],'sectionId':_0x42913e['id']},{})[_0x1b93('0x14')](function(){return _0x2b292f;});}else{return _0x2b292f;}})[_0x1b93('0x27')](function(_0x318d13){logger['error'](_0x1b93('0x3b'),_0x318d13);throw _0x318d13;});}return _0x2b292f;})[_0x1b93('0x14')](respondWithResult(_0x413013,0xc9))[_0x1b93('0x27')](handleError(_0x413013,null));};exports[_0x1b93('0x3c')]=function(_0xd1017,_0x4ec427){if(_0xd1017['body']['id']){delete _0xd1017['body']['id'];}return db[_0x1b93('0x1f')]['find']({'where':{'id':_0xd1017['params']['id']}})[_0x1b93('0x14')](handleEntityNotFound(_0x4ec427,null))[_0x1b93('0x14')](saveUpdates(_0xd1017[_0x1b93('0x33')],null))[_0x1b93('0x14')](respondWithResult(_0x4ec427,null))[_0x1b93('0x27')](handleError(_0x4ec427,null));};exports[_0x1b93('0x15')]=function(_0x1ba979,_0x571edc){return db['FaxQueue'][_0x1b93('0x38')]({'where':{'id':_0x1ba979[_0x1b93('0x28')]['id']}})['then'](handleEntityNotFound(_0x571edc,null))[_0x1b93('0x14')](removeEntity(_0x571edc,null))[_0x1b93('0x27')](handleError(_0x571edc,null));};exports['describe']=function(_0x1833ec,_0x580ed5){return db[_0x1b93('0x1f')][_0x1b93('0x3d')]()['then'](respondWithResult(_0x580ed5,null))[_0x1b93('0x27')](handleError(_0x580ed5,null));};exports[_0x1b93('0x3e')]=function(_0x401a52,_0x27738f){var _0x49b3c8={'raw':!![],'where':{}},_0x25929d={},_0x114ee3;return db[_0x1b93('0x1f')][_0x1b93('0x3f')]({'where':{'id':_0x401a52['params']['id']}})[_0x1b93('0x14')](handleEntityNotFound(_0x27738f,null))[_0x1b93('0x14')](function(_0x4d7f30){if(_0x4d7f30){_0x114ee3=_0x4d7f30[_0x1b93('0x16')]({'plain':!![]});_0x25929d['model']=_[_0x1b93('0x2a')](db[_0x1b93('0x40')][_0x1b93('0x20')]);_0x25929d[_0x1b93('0x25')]=_['keys'](_0x401a52[_0x1b93('0x25')]);_0x25929d[_0x1b93('0x2b')]=_[_0x1b93('0x2c')](_0x25929d[_0x1b93('0x29')],_0x25929d[_0x1b93('0x25')]);_0x49b3c8['attributes']=_[_0x1b93('0x2c')](_0x25929d['model'],qs['fields'](_0x401a52[_0x1b93('0x25')][_0x1b93('0x2e')]));_0x49b3c8[_0x1b93('0x2d')]=_0x49b3c8[_0x1b93('0x2d')][_0x1b93('0x2f')]?_0x49b3c8['attributes']:_0x25929d[_0x1b93('0x29')];if(!_0x401a52[_0x1b93('0x25')][_0x1b93('0x41')](_0x1b93('0x42'))){_0x49b3c8[_0x1b93('0x43')]=qs['limit'](_0x401a52[_0x1b93('0x25')]['limit']);_0x49b3c8[_0x1b93('0xf')]=qs['offset'](_0x401a52['query'][_0x1b93('0xf')]);}_0x49b3c8['order']=qs[_0x1b93('0x44')](_0x401a52['query']['sort']);_0x49b3c8[_0x1b93('0x23')]=qs[_0x1b93('0x2b')](_['pick'](_0x401a52[_0x1b93('0x25')],_0x25929d[_0x1b93('0x2b')]));_0x49b3c8[_0x1b93('0x23')]['FaxQueueId']=_0x4d7f30['id'];if(_0x401a52[_0x1b93('0x25')][_0x1b93('0x45')]){_0x49b3c8['where']=_[_0x1b93('0x30')](_0x49b3c8[_0x1b93('0x23')],{'$or':_[_0x1b93('0x1e')](_0x49b3c8[_0x1b93('0x2d')],function(_0x5e3921){var _0xf527b9={};_0xf527b9[_0x5e3921]={'$like':'%'+_0x401a52[_0x1b93('0x25')][_0x1b93('0x45')]+'%'};return _0xf527b9;})});}_0x49b3c8=_[_0x1b93('0x30')]({},_0x49b3c8,_0x401a52['options']);return db[_0x1b93('0x40')]['findAll'](_0x49b3c8);}})['then'](function(_0x4a22d8){if(_0x4a22d8){return db[_0x1b93('0x46')][_0x1b93('0x47')]({'where':{'id':_[_0x1b93('0x1e')](_0x4a22d8,_0x1b93('0x48')),'role':_0x1b93('0x49')},'attributes':['id',_0x1b93('0x1b'),_0x1b93('0x4a'),_0x1b93('0x4b'),_0x1b93('0x4c')]});}})['then'](function(_0x1e4551){if(_0x1e4551){return{'count':_0x1e4551[_0x1b93('0x11')],'rows':_['map'](_0x1e4551['rows'],function(_0x361328){return{'membername':_0x361328[_0x1b93('0x1b')],'UserId':_0x361328['id'],'queue_name':_0x114ee3[_0x1b93('0x1b')],'FaxQueueId':_0x114ee3['id'],'interface':util[_0x1b93('0x4d')](_0x1b93('0x4e'),_0x1b93('0x4f'),_0x361328[_0x1b93('0x1b')]),'penalty':0x0,'paused':_0x361328[_0x1b93('0x4a')],'createdAt':_0x361328['createdAt'],'updatedAt':_0x361328[_0x1b93('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1b93('0x14')](respondWithFilteredResult(_0x27738f,_0x49b3c8))[_0x1b93('0x27')](handleError(_0x27738f,null));};exports[_0x1b93('0x50')]=function(_0x60296e,_0x32cf6c){var _0x1c6054={};var _0x259a2c={};var _0x55bcee;var _0x38cf79;return db[_0x1b93('0x1f')][_0x1b93('0x3f')]({'where':{'id':_0x60296e[_0x1b93('0x28')]['id']}})[_0x1b93('0x14')](handleEntityNotFound(_0x32cf6c,null))['then'](function(_0x175ce7){if(_0x175ce7){_0x55bcee=_0x175ce7;_0x259a2c['model']=_['keys'](db[_0x1b93('0x51')][_0x1b93('0x20')]);_0x259a2c[_0x1b93('0x25')]=_[_0x1b93('0x2a')](_0x60296e['query']);_0x259a2c[_0x1b93('0x2b')]=_['intersection'](_0x259a2c['model'],_0x259a2c[_0x1b93('0x25')]);_0x1c6054['attributes']=_[_0x1b93('0x2c')](_0x259a2c[_0x1b93('0x29')],qs[_0x1b93('0x2e')](_0x60296e[_0x1b93('0x25')][_0x1b93('0x2e')]));_0x1c6054[_0x1b93('0x2d')]=_0x1c6054[_0x1b93('0x2d')][_0x1b93('0x2f')]?_0x1c6054['attributes']:_0x259a2c[_0x1b93('0x29')];_0x1c6054[_0x1b93('0x52')]=qs[_0x1b93('0x44')](_0x60296e[_0x1b93('0x25')][_0x1b93('0x44')]);_0x1c6054[_0x1b93('0x23')]=qs[_0x1b93('0x2b')](_[_0x1b93('0x53')](_0x60296e['query'],_0x259a2c[_0x1b93('0x2b')]));if(_0x60296e[_0x1b93('0x25')]['filter']){_0x1c6054[_0x1b93('0x23')]=_[_0x1b93('0x30')](_0x1c6054['where'],{'$or':_['map'](_0x1c6054['attributes'],function(_0xbbe1a7){var _0x1fbf44={};_0x1fbf44[_0xbbe1a7]={'$like':'%'+_0x60296e['query'][_0x1b93('0x45')]+'%'};return _0x1fbf44;})});}_0x1c6054=_[_0x1b93('0x30')]({},_0x1c6054,_0x60296e[_0x1b93('0x31')]);return _0x55bcee[_0x1b93('0x50')](_0x1c6054);}})['then'](function(_0x42236e){if(_0x42236e){_0x38cf79=_0x42236e[_0x1b93('0x2f')];if(!_0x60296e[_0x1b93('0x25')]['hasOwnProperty'](_0x1b93('0x42'))){_0x1c6054['limit']=qs['limit'](_0x60296e[_0x1b93('0x25')]['limit']);_0x1c6054[_0x1b93('0xf')]=qs['offset'](_0x60296e[_0x1b93('0x25')][_0x1b93('0xf')]);}return _0x55bcee[_0x1b93('0x50')](_0x1c6054);}})['then'](function(_0x168647){if(_0x168647){return _0x168647?{'count':_0x38cf79,'rows':_0x168647}:null;}})[_0x1b93('0x14')](respondWithResult(_0x32cf6c,null))[_0x1b93('0x27')](handleError(_0x32cf6c,null));};exports[_0x1b93('0x54')]=function(_0x80edbe,_0x3decc2){var _0x2df888=_0x80edbe[_0x1b93('0x33')][_0x1b93('0x55')];return db[_0x1b93('0x51')]['findAll']({'where':{'id':_0x2df888},'attributes':['id'],'include':[{'model':db[_0x1b93('0x46')],'as':_0x1b93('0x56'),'attributes':['id','name',_0x1b93('0x57'),_0x1b93('0x58'),'interface'],'raw':!![]}]})[_0x1b93('0x14')](function(_0x2e3b06){if(_0x2e3b06){var _0x51fc34=_[_0x1b93('0x59')](_0x2e3b06,function(_0x380ece){var _0x4f0134=_0x380ece['get']({'plain':!![]});return _0x4f0134['Agents'];});return db[_0x1b93('0x1f')][_0x1b93('0x38')]({'where':{'id':_0x80edbe[_0x1b93('0x28')]['id']}})[_0x1b93('0x14')](function(_0x117513){return db[_0x1b93('0x5a')][_0x1b93('0x5b')](function(_0x16dfd4){return _0x117513[_0x1b93('0x54')](_0x2df888,{'transaction':_0x16dfd4})[_0x1b93('0x14')](function(){return BPromise[_0x1b93('0x5c')](_0x51fc34,function(_0xb0d3){return db[_0x1b93('0x40')][_0x1b93('0x5d')]({'where':{'UserId':_0xb0d3['id'],'FaxQueueId':_0x80edbe[_0x1b93('0x28')]['id']},'transaction':_0x16dfd4});});})[_0x1b93('0x14')](function(){_0x51fc34[_0x1b93('0x5e')](function(_0xf38fc5){socket[_0x1b93('0x5f')](_0x1b93('0x60'),{'UserId':_0xf38fc5['id'],'FaxQueueId':_0x117513['id']});});});});});}})[_0x1b93('0x14')](respondWithStatusCode(_0x3decc2,null))[_0x1b93('0x27')](handleError(_0x3decc2,null));};exports['removeTeams']=function(_0x319600,_0x3cbefd){return db['Team'][_0x1b93('0x61')]({'where':{'id':_0x319600[_0x1b93('0x25')][_0x1b93('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1b93('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3cbefd,null))[_0x1b93('0x14')](function(_0x578d77){var _0x3a757c=_['map'](_0x578d77,'id');var _0x1d35ae=[];var _0x10c3d0=[];var _0x24f0ac=squel['select']();_0x24f0ac[_0x1b93('0x62')](_0x1b93('0x63'))[_0x1b93('0x64')]('team_has_fax_queues','tq')[_0x1b93('0x65')](_0x1b93('0x66'),'ut',_0x1b93('0x67'))[_0x1b93('0x23')](_0x1b93('0x68'),_0x319600[_0x1b93('0x28')]['id']);for(var _0x4b0066=0x0;_0x4b0066<_0x578d77[_0x1b93('0x2f')];_0x4b0066+=0x1){let _0x35bbe6=_0x578d77[_0x4b0066];for(var _0x21a7be=0x0;_0x21a7be<_0x35bbe6[_0x1b93('0x56')][_0x1b93('0x2f')];_0x21a7be+=0x1){let _0x131411=_0x35bbe6[_0x1b93('0x56')][_0x21a7be];var _0x325088=_0x24f0ac[_0x1b93('0x69')]();_0x325088[_0x1b93('0x23')]('ut.UserId\x20=\x20?',_0x131411['id']);_0x10c3d0[_0x1b93('0x6a')](db[_0x1b93('0x5a')][_0x1b93('0x25')](_0x325088[_0x1b93('0x6b')](),{'type':db[_0x1b93('0x5a')]['QueryTypes'][_0x1b93('0x6c')]})['then'](function(_0x8d14fe){if(_0x8d14fe['length']===0x1){return _0x131411['id'];}else{var _0x5db261=_[_0x1b93('0x6d')](_[_0x1b93('0x1e')](_0x8d14fe,_0x1b93('0x6e')),function(_0x12c5a4){return _['includes'](_0x3a757c,_0x12c5a4);});if(_0x5db261){return _0x131411['id'];}}}));}}return BPromise['all'](_0x10c3d0)[_0x1b93('0x14')](function(_0x39ce65){_0x1d35ae=_(_0x1d35ae)['union'](_0x39ce65)[_0x1b93('0x6f')]()['value']();return db[_0x1b93('0x1f')][_0x1b93('0x38')]({'where':{'id':_0x319600[_0x1b93('0x28')]['id']}})['then'](function(_0x17f07c){return db['sequelize'][_0x1b93('0x5b')](function(_0x1beaec){return _0x17f07c['removeTeams'](_0x319600[_0x1b93('0x25')]['ids'],{'transaction':_0x1beaec})[_0x1b93('0x14')](function(){if(!_['isEmpty'](_0x1d35ae)){return _0x17f07c[_0x1b93('0x70')](_0x1d35ae,{'transaction':_0x1beaec});}})['then'](function(){_0x1d35ae[_0x1b93('0x5e')](function(_0x27f984){socket[_0x1b93('0x5f')](_0x1b93('0x71'),{'UserId':_0x27f984,'FaxQueueId':_0x17f07c['id']});});});});});});})[_0x1b93('0x14')](respondWithStatusCode(_0x3cbefd,null))[_0x1b93('0x27')](handleError(_0x3cbefd,null));};exports['addAgents']=function(_0x2e9226,_0x48cb0c){return db[_0x1b93('0x1f')]['find']({'where':{'id':_0x2e9226['params']['id']}})[_0x1b93('0x14')](handleEntityNotFound(_0x48cb0c,null))[_0x1b93('0x14')](function(_0x21ce26){if(_0x21ce26){return _0x21ce26[_0x1b93('0x72')](_0x2e9226[_0x1b93('0x33')][_0x1b93('0x55')],_[_0x1b93('0x73')](_0x2e9226['body'],[_0x1b93('0x55'),'id'])||{})[_0x1b93('0x74')](function(_0xbb3118){for(var _0x4b5b77=0x0;_0x4b5b77<_0x2e9226['body']['ids'][_0x1b93('0x2f')];_0x4b5b77+=0x1){socket[_0x1b93('0x5f')]('userFaxQueue:save',{'UserId':Number(_0x2e9226[_0x1b93('0x33')][_0x1b93('0x55')][_0x4b5b77]),'FaxQueueId':Number(_0x2e9226['params']['id'])});}return _0xbb3118;});}})[_0x1b93('0x14')](respondWithResult(_0x48cb0c,null))[_0x1b93('0x27')](handleError(_0x48cb0c,null));};exports['removeAgents']=function(_0x2055d0,_0x52b1c9){return db[_0x1b93('0x1f')]['find']({'where':{'id':_0x2055d0['params']['id']}})['then'](handleEntityNotFound(_0x52b1c9,null))[_0x1b93('0x14')](function(_0x27769f){if(_0x27769f){return _0x27769f[_0x1b93('0x70')](_0x2055d0['query'][_0x1b93('0x55')])[_0x1b93('0x14')](function(){if(_[_0x1b93('0x75')](_0x2055d0['query'][_0x1b93('0x55')])){for(var _0x4df27d=0x0;_0x4df27d<_0x2055d0[_0x1b93('0x25')]['ids'][_0x1b93('0x2f')];_0x4df27d+=0x1){socket[_0x1b93('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x2055d0['query'][_0x1b93('0x55')][_0x4df27d]),'FaxQueueId':Number(_0x2055d0[_0x1b93('0x28')]['id'])});}}else{socket['emit'](_0x1b93('0x71'),{'UserId':Number(_0x2055d0[_0x1b93('0x25')][_0x1b93('0x55')]),'FaxQueueId':Number(_0x2055d0[_0x1b93('0x28')]['id'])});}});}})[_0x1b93('0x14')](respondWithStatusCode(_0x52b1c9,null))[_0x1b93('0x27')](handleError(_0x52b1c9,null));};exports[_0x1b93('0x76')]=function(_0x33652a,_0x1db5c4){var _0x23064a={};var _0xa44ce0={};var _0x7d2033;var _0x7c6603;return db[_0x1b93('0x1f')]['findOne']({'where':{'id':_0x33652a[_0x1b93('0x28')]['id']}})[_0x1b93('0x14')](handleEntityNotFound(_0x1db5c4,null))[_0x1b93('0x14')](function(_0x475d87){if(_0x475d87){_0x7d2033=_0x475d87;_0xa44ce0['model']=_['keys'](db[_0x1b93('0x46')][_0x1b93('0x20')]);_0xa44ce0[_0x1b93('0x25')]=_[_0x1b93('0x2a')](_0x33652a[_0x1b93('0x25')]);_0xa44ce0['filters']=_[_0x1b93('0x2c')](_0xa44ce0[_0x1b93('0x29')],_0xa44ce0['query']);_0x23064a[_0x1b93('0x2d')]=_['intersection'](_0xa44ce0[_0x1b93('0x29')],qs['fields'](_0x33652a[_0x1b93('0x25')][_0x1b93('0x2e')]));_0x23064a['attributes']=_0x23064a[_0x1b93('0x2d')]['length']?_0x23064a[_0x1b93('0x2d')]:_0xa44ce0['model'];_0x23064a[_0x1b93('0x52')]=qs['sort'](_0x33652a[_0x1b93('0x25')]['sort']);_0x23064a[_0x1b93('0x23')]=qs['filters'](_[_0x1b93('0x53')](_0x33652a[_0x1b93('0x25')],_0xa44ce0['filters']));if(_0x33652a[_0x1b93('0x25')][_0x1b93('0x45')]){_0x23064a['where']=_['merge'](_0x23064a[_0x1b93('0x23')],{'$or':_[_0x1b93('0x1e')](_0x23064a[_0x1b93('0x2d')],function(_0x216f48){var _0x96d901={};_0x96d901[_0x216f48]={'$like':'%'+_0x33652a['query'][_0x1b93('0x45')]+'%'};return _0x96d901;})});}_0x23064a=_[_0x1b93('0x30')]({},_0x23064a,_0x33652a[_0x1b93('0x31')]);return _0x7d2033['getAgents'](_0x23064a);}})[_0x1b93('0x14')](function(_0x56c95c){if(_0x56c95c){_0x7c6603=_0x56c95c[_0x1b93('0x2f')];if(!_0x33652a[_0x1b93('0x25')][_0x1b93('0x41')](_0x1b93('0x42'))){_0x23064a['limit']=qs[_0x1b93('0x43')](_0x33652a[_0x1b93('0x25')][_0x1b93('0x43')]);_0x23064a[_0x1b93('0xf')]=qs[_0x1b93('0xf')](_0x33652a['query'][_0x1b93('0xf')]);}return _0x7d2033[_0x1b93('0x76')](_0x23064a);}})['then'](function(_0x569fd6){if(_0x569fd6){return _0x569fd6?{'count':_0x7c6603,'rows':_0x569fd6}:null;}})[_0x1b93('0x14')](respondWithResult(_0x1db5c4,null))[_0x1b93('0x27')](handleError(_0x1db5c4,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 427c4b5..9056834 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 _0x444f=['hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x279488,_0x5582f2){var _0xd18f98=function(_0x30ea2b){while(--_0x30ea2b){_0x279488['push'](_0x279488['shift']());}};_0xd18f98(++_0x5582f2);}(_0x444f,0x71));var _0xf444=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0x444f[_0x3441e9];return _0x7f9ada;};'use strict';var EventEmitter=require(_0xf444('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf444('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf444('0x2')](0x0);var events={'afterCreate':_0xf444('0x3'),'afterUpdate':_0xf444('0x4'),'afterDestroy':_0xf444('0x5')};function emitEvent(_0x545f52){return function(_0x4df30e,_0x533775,_0x1cc9b4){FaxQueueEvents['emit'](_0x545f52+':'+_0x4df30e['id'],_0x4df30e);FaxQueueEvents[_0xf444('0x6')](_0x545f52,_0x4df30e);_0x1cc9b4(null);};}for(var e in events){if(events[_0xf444('0x7')](e)){var event=events[e];FaxQueue[_0xf444('0x8')](e,emitEvent(event));}}module[_0xf444('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x67d6=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x13b120,_0x1883a1){var _0x4b8379=function(_0x53cb08){while(--_0x53cb08){_0x13b120['push'](_0x13b120['shift']());}};_0x4b8379(++_0x1883a1);}(_0x67d6,0x165));var _0x667d=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x67d6[_0x2906e6];return _0x12517a;};'use strict';var EventEmitter=require(_0x667d('0x0'));var FaxQueue=require(_0x667d('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x667d('0x2'),'afterUpdate':_0x667d('0x3'),'afterDestroy':_0x667d('0x4')};function emitEvent(_0x39b726){return function(_0x164722,_0x395cfd,_0x3abe74){FaxQueueEvents[_0x667d('0x5')](_0x39b726+':'+_0x164722['id'],_0x164722);FaxQueueEvents[_0x667d('0x5')](_0x39b726,_0x164722);_0x3abe74(null);};}for(var e in events){if(events[_0x667d('0x6')](e)){var event=events[e];FaxQueue[_0x667d('0x7')](e,emitEvent(event));}}module[_0x667d('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 47711c8..08d86b1 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 _0x8517=['../../config/environment','./faxQueue.attributes','exports','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x8517,0x1e3));var _0x7851=function(_0x5324eb,_0x3eb513){_0x5324eb=_0x5324eb-0x0;var _0x91d61c=_0x8517[_0x5324eb];return _0x91d61c;};'use strict';var _=require(_0x7851('0x0'));var util=require(_0x7851('0x1'));var logger=require(_0x7851('0x2'))(_0x7851('0x3'));var moment=require(_0x7851('0x4'));var BPromise=require('bluebird');var rp=require(_0x7851('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7851('0x6'));var config=require(_0x7851('0x7'));var attributes=require(_0x7851('0x8'));module[_0x7851('0x9')]=function(_0x45e807,_0x3863cc){return _0x45e807['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a5e=['moment','request-promise','rimraf','exports','define','lodash','util','../../config/logger','api'];(function(_0x4995e8,_0x5b0c0f){var _0x19ab5a=function(_0x55ea8a){while(--_0x55ea8a){_0x4995e8['push'](_0x4995e8['shift']());}};_0x19ab5a(++_0x5b0c0f);}(_0x7a5e,0x71));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var logger=require(_0xe7a5('0x2'))(_0xe7a5('0x3'));var moment=require(_0xe7a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xe7a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a5('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xe7a5('0x7')]=function(_0x334df9,_0x577c89){return _0x334df9[_0xe7a5('0x8')]('FaxQueue',attributes,{'tableName':'fax_queues','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 c47f672..4492bc3 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 _0x1afa=['redis','defaults','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueue','findAll','options','raw','limit','include','map','model','attributes','GetFaxQueue','ShowFaxQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x154d64,_0x31886f){var _0x1edf86=function(_0x12e902){while(--_0x12e902){_0x154d64['push'](_0x154d64['shift']());}};_0x1edf86(++_0x31886f);}(_0x1afa,0x185));var _0xa1af=function(_0x4faf96,_0x489a92){_0x4faf96=_0x4faf96-0x0;var _0x464bd6=_0x1afa[_0x4faf96];return _0x464bd6;};'use strict';var _=require('lodash');var util=require(_0xa1af('0x0'));var moment=require(_0xa1af('0x1'));var BPromise=require(_0xa1af('0x2'));var rs=require(_0xa1af('0x3'));var fs=require('fs');var Redis=require(_0xa1af('0x4'));var db=require(_0xa1af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1af('0x6'))(_0xa1af('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1af('0x8'));var client=jayson[_0xa1af('0x9')][_0xa1af('0xa')]({'port':0x232a});config[_0xa1af('0xb')]=_[_0xa1af('0xc')](config[_0xa1af('0xb')],{'host':_0xa1af('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa1af('0xe'))[_0xa1af('0xf')](socket);function respondWithRpcPromise(_0x7c21f7,_0x27599c,_0x499f66){return new BPromise(function(_0x49a8d6,_0x975811){return client['request'](_0x7c21f7,_0x499f66)[_0xa1af('0x10')](function(_0x42c591){logger[_0xa1af('0x11')](_0xa1af('0x12'),_0x27599c,_0xa1af('0x13'));logger[_0xa1af('0x14')](_0xa1af('0x15'),_0x27599c,_0xa1af('0x13'),JSON[_0xa1af('0x16')](_0x42c591));if(_0x42c591['error']){if(_0x42c591[_0xa1af('0x17')][_0xa1af('0x18')]===0x1f4){logger[_0xa1af('0x17')]('FaxQueue,\x20%s,\x20%s',_0x27599c,_0x42c591[_0xa1af('0x17')][_0xa1af('0x19')]);return _0x975811(_0x42c591[_0xa1af('0x17')][_0xa1af('0x19')]);}logger[_0xa1af('0x17')]('FaxQueue,\x20%s,\x20%s',_0x27599c,_0x42c591[_0xa1af('0x17')][_0xa1af('0x19')]);return _0x49a8d6(_0x42c591[_0xa1af('0x17')][_0xa1af('0x19')]);}else{logger[_0xa1af('0x11')](_0xa1af('0x12'),_0x27599c,_0xa1af('0x13'));_0x49a8d6(_0x42c591[_0xa1af('0x1a')][_0xa1af('0x19')]);}})['catch'](function(_0x22353c){logger[_0xa1af('0x17')](_0xa1af('0x12'),_0x27599c,_0x22353c);_0x975811(_0x22353c);});});}exports['GetFaxQueue']=function(_0x3745fa){var _0xbe1063=this;return new Promise(function(_0x20afb7,_0x35f425){return db[_0xa1af('0x1b')][_0xa1af('0x1c')]({'raw':_0x3745fa[_0xa1af('0x1d')]?_0x3745fa[_0xa1af('0x1d')][_0xa1af('0x1e')]===undefined?!![]:![]:!![],'where':_0x3745fa[_0xa1af('0x1d')]?_0x3745fa[_0xa1af('0x1d')]['where']||null:null,'attributes':_0x3745fa[_0xa1af('0x1d')]?_0x3745fa[_0xa1af('0x1d')]['attributes']||null:null,'limit':_0x3745fa['options']?_0x3745fa[_0xa1af('0x1d')][_0xa1af('0x1f')]||null:null,'include':_0x3745fa[_0xa1af('0x1d')]?_0x3745fa[_0xa1af('0x1d')][_0xa1af('0x20')]?_[_0xa1af('0x21')](_0x3745fa[_0xa1af('0x1d')][_0xa1af('0x20')],function(_0x1e627d){return{'model':db[_0x1e627d[_0xa1af('0x22')]],'as':_0x1e627d['as'],'attributes':_0x1e627d['attributes'],'include':_0x1e627d[_0xa1af('0x20')]?_['map'](_0x1e627d['include'],function(_0x21bd3d){return{'model':db[_0x21bd3d['model']],'as':_0x21bd3d['as'],'attributes':_0x21bd3d[_0xa1af('0x23')],'include':_0x21bd3d['include']?_['map'](_0x21bd3d[_0xa1af('0x20')],function(_0x53818a){return{'model':db[_0x53818a[_0xa1af('0x22')]],'as':_0x53818a['as'],'attributes':_0x53818a[_0xa1af('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a5a81){logger[_0xa1af('0x11')]('GetFaxQueue',_0x3745fa);logger[_0xa1af('0x14')](_0xa1af('0x24'),_0x3745fa,JSON[_0xa1af('0x16')](_0x1a5a81));_0x20afb7(_0x1a5a81);})['catch'](function(_0x335c51){logger[_0xa1af('0x17')](_0xa1af('0x24'),_0x335c51[_0xa1af('0x19')],_0x3745fa);_0x35f425(_0xbe1063[_0xa1af('0x17')](0x1f4,_0x335c51[_0xa1af('0x19')]));});});};exports[_0xa1af('0x25')]=function(_0x1a7c86){var _0x1b6786=this;return new Promise(function(_0x37a740,_0x2be2c6){return db[_0xa1af('0x1b')][_0xa1af('0x26')]({'raw':_0x1a7c86[_0xa1af('0x1d')]?_0x1a7c86[_0xa1af('0x1d')][_0xa1af('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a7c86[_0xa1af('0x1d')]?_0x1a7c86[_0xa1af('0x1d')][_0xa1af('0x27')]||null:null,'attributes':_0x1a7c86[_0xa1af('0x1d')]?_0x1a7c86[_0xa1af('0x1d')][_0xa1af('0x23')]||null:null,'include':_0x1a7c86[_0xa1af('0x1d')]?_0x1a7c86[_0xa1af('0x1d')][_0xa1af('0x20')]?_[_0xa1af('0x21')](_0x1a7c86[_0xa1af('0x1d')][_0xa1af('0x20')],function(_0x420e2a){return{'model':db[_0x420e2a[_0xa1af('0x22')]],'as':_0x420e2a['as'],'attributes':_0x420e2a[_0xa1af('0x23')],'include':_0x420e2a['include']?_['map'](_0x420e2a[_0xa1af('0x20')],function(_0x51a68f){return{'model':db[_0x51a68f[_0xa1af('0x22')]],'as':_0x51a68f['as'],'attributes':_0x51a68f[_0xa1af('0x23')],'include':_0x51a68f[_0xa1af('0x20')]?_[_0xa1af('0x21')](_0x51a68f[_0xa1af('0x20')],function(_0x5879db){return{'model':db[_0x5879db[_0xa1af('0x22')]],'as':_0x5879db['as'],'attributes':_0x5879db[_0xa1af('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4478e0){logger[_0xa1af('0x11')](_0xa1af('0x25'),_0x1a7c86);logger[_0xa1af('0x14')]('ShowFaxQueue',_0x1a7c86,JSON[_0xa1af('0x16')](_0x4478e0));_0x37a740(_0x4478e0);})['catch'](function(_0x1f23f3){logger[_0xa1af('0x17')](_0xa1af('0x25'),_0x1f23f3[_0xa1af('0x19')],_0x1a7c86);_0x2be2c6(_0x1b6786[_0xa1af('0x17')](0x1f4,_0x1f23f3[_0xa1af('0x19')]));});});}; \ No newline at end of file +var _0x68e6=['FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','options','raw','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','find','where','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x68e6,0x88));var _0x668e=function(_0xcc840a,_0x30482e){_0xcc840a=_0xcc840a-0x0;var _0x2d61b1=_0x68e6[_0xcc840a];return _0x2d61b1;};'use strict';var _=require('lodash');var util=require(_0x668e('0x0'));var moment=require(_0x668e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x668e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x668e('0x3'));var logger=require(_0x668e('0x4'))('rpc');var config=require(_0x668e('0x5'));var jayson=require(_0x668e('0x6'));var client=jayson[_0x668e('0x7')]['http']({'port':0x232a});config[_0x668e('0x8')]=_[_0x668e('0x9')](config[_0x668e('0x8')],{'host':_0x668e('0xa'),'port':0x18eb});var socket=require(_0x668e('0xb'))(new Redis(config['redis']));require(_0x668e('0xc'))[_0x668e('0xd')](socket);function respondWithRpcPromise(_0x33a0f2,_0xe2bb31,_0x1001ba){return new BPromise(function(_0x1787b8,_0x2055d9){return client[_0x668e('0xe')](_0x33a0f2,_0x1001ba)[_0x668e('0xf')](function(_0xdc543){logger[_0x668e('0x10')](_0x668e('0x11'),_0xe2bb31,_0x668e('0x12'));logger[_0x668e('0x13')](_0x668e('0x14'),_0xe2bb31,_0x668e('0x12'),JSON[_0x668e('0x15')](_0xdc543));if(_0xdc543[_0x668e('0x16')]){if(_0xdc543[_0x668e('0x16')][_0x668e('0x17')]===0x1f4){logger[_0x668e('0x16')](_0x668e('0x11'),_0xe2bb31,_0xdc543['error']['message']);return _0x2055d9(_0xdc543[_0x668e('0x16')][_0x668e('0x18')]);}logger['error'](_0x668e('0x11'),_0xe2bb31,_0xdc543[_0x668e('0x16')][_0x668e('0x18')]);return _0x1787b8(_0xdc543[_0x668e('0x16')][_0x668e('0x18')]);}else{logger[_0x668e('0x10')](_0x668e('0x11'),_0xe2bb31,_0x668e('0x12'));_0x1787b8(_0xdc543[_0x668e('0x19')][_0x668e('0x18')]);}})[_0x668e('0x1a')](function(_0x56edfb){logger[_0x668e('0x16')](_0x668e('0x11'),_0xe2bb31,_0x56edfb);_0x2055d9(_0x56edfb);});});}exports[_0x668e('0x1b')]=function(_0x1062c5){var _0x38f539=this;return new Promise(function(_0x3eba73,_0x5f5e16){return db['FaxQueue']['findAll']({'raw':_0x1062c5[_0x668e('0x1c')]?_0x1062c5['options'][_0x668e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1062c5[_0x668e('0x1c')]?_0x1062c5[_0x668e('0x1c')]['where']||null:null,'attributes':_0x1062c5['options']?_0x1062c5['options'][_0x668e('0x1e')]||null:null,'limit':_0x1062c5['options']?_0x1062c5['options'][_0x668e('0x1f')]||null:null,'include':_0x1062c5[_0x668e('0x1c')]?_0x1062c5[_0x668e('0x1c')][_0x668e('0x20')]?_[_0x668e('0x21')](_0x1062c5[_0x668e('0x1c')][_0x668e('0x20')],function(_0x363f28){return{'model':db[_0x363f28[_0x668e('0x22')]],'as':_0x363f28['as'],'attributes':_0x363f28[_0x668e('0x1e')],'include':_0x363f28[_0x668e('0x20')]?_['map'](_0x363f28[_0x668e('0x20')],function(_0x2e459b){return{'model':db[_0x2e459b[_0x668e('0x22')]],'as':_0x2e459b['as'],'attributes':_0x2e459b[_0x668e('0x1e')],'include':_0x2e459b['include']?_[_0x668e('0x21')](_0x2e459b['include'],function(_0x21a6bc){return{'model':db[_0x21a6bc[_0x668e('0x22')]],'as':_0x21a6bc['as'],'attributes':_0x21a6bc[_0x668e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x668e('0xf')](function(_0x57082d){logger[_0x668e('0x10')](_0x668e('0x1b'),_0x1062c5);logger[_0x668e('0x13')]('GetFaxQueue',_0x1062c5,JSON[_0x668e('0x15')](_0x57082d));_0x3eba73(_0x57082d);})[_0x668e('0x1a')](function(_0x2b877c){logger[_0x668e('0x16')](_0x668e('0x1b'),_0x2b877c[_0x668e('0x18')],_0x1062c5);_0x5f5e16(_0x38f539[_0x668e('0x16')](0x1f4,_0x2b877c['message']));});});};exports[_0x668e('0x23')]=function(_0x4cb69e){var _0xd0c20f=this;return new Promise(function(_0x8f830a,_0x27e9a8){return db[_0x668e('0x24')][_0x668e('0x25')]({'raw':_0x4cb69e[_0x668e('0x1c')]?_0x4cb69e['options'][_0x668e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4cb69e['options']?_0x4cb69e[_0x668e('0x1c')][_0x668e('0x26')]||null:null,'attributes':_0x4cb69e['options']?_0x4cb69e[_0x668e('0x1c')][_0x668e('0x1e')]||null:null,'include':_0x4cb69e['options']?_0x4cb69e[_0x668e('0x1c')]['include']?_[_0x668e('0x21')](_0x4cb69e[_0x668e('0x1c')][_0x668e('0x20')],function(_0x484991){return{'model':db[_0x484991[_0x668e('0x22')]],'as':_0x484991['as'],'attributes':_0x484991[_0x668e('0x1e')],'include':_0x484991['include']?_[_0x668e('0x21')](_0x484991[_0x668e('0x20')],function(_0x4337b3){return{'model':db[_0x4337b3[_0x668e('0x22')]],'as':_0x4337b3['as'],'attributes':_0x4337b3[_0x668e('0x1e')],'include':_0x4337b3[_0x668e('0x20')]?_['map'](_0x4337b3[_0x668e('0x20')],function(_0x17964e){return{'model':db[_0x17964e['model']],'as':_0x17964e['as'],'attributes':_0x17964e[_0x668e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x668e('0xf')](function(_0x356a32){logger[_0x668e('0x10')]('ShowFaxQueue',_0x4cb69e);logger[_0x668e('0x13')](_0x668e('0x23'),_0x4cb69e,JSON[_0x668e('0x15')](_0x356a32));_0x8f830a(_0x356a32);})[_0x668e('0x1a')](function(_0x4fe679){logger[_0x668e('0x16')](_0x668e('0x23'),_0x4fe679[_0x668e('0x18')],_0x4cb69e);_0x27e9a8(_0xd0c20f[_0x668e('0x16')](0x1f4,_0x4fe679[_0x668e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7762d49..0500808 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 _0x5a93=['save','update','emit','register','length','faxQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a93,0xf6));var _0x35a9=function(_0x50f82b,_0x5f1c05){_0x50f82b=_0x50f82b-0x0;var _0x1c4dbb=_0x5a93[_0x50f82b];return _0x1c4dbb;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x35a9('0x0'),'remove',_0x35a9('0x1')];function createListener(_0x9383e7,_0x55853a){return function(_0x55782b){_0x55853a[_0x35a9('0x2')](_0x9383e7,_0x55782b);};}function removeListener(_0xf10dcf,_0x3a23d6){return function(){FaxQueueEvents['removeListener'](_0xf10dcf,_0x3a23d6);};}exports[_0x35a9('0x3')]=function(_0x27ed9f){for(var _0x2e8a14=0x0,_0x354490=events[_0x35a9('0x4')];_0x2e8a14<_0x354490;_0x2e8a14++){var _0x45e6f7=events[_0x2e8a14];var _0x71d143=createListener(_0x35a9('0x5')+_0x45e6f7,_0x27ed9f);FaxQueueEvents['on'](_0x45e6f7,_0x71d143);}}; \ No newline at end of file +var _0x0f50=['remove','update','removeListener','register','length','faxQueue:','save'];(function(_0x43b3e0,_0xca2a01){var _0x504079=function(_0x4f785e){while(--_0x4f785e){_0x43b3e0['push'](_0x43b3e0['shift']());}};_0x504079(++_0xca2a01);}(_0x0f50,0x6f));var _0x00f5=function(_0x3926c0,_0x1e607d){_0x3926c0=_0x3926c0-0x0;var _0x2b8b20=_0x0f50[_0x3926c0];return _0x2b8b20;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x00f5('0x0'),_0x00f5('0x1'),_0x00f5('0x2')];function createListener(_0x3b7060,_0x3b0542){return function(_0x2114e8){_0x3b0542['emit'](_0x3b7060,_0x2114e8);};}function removeListener(_0x38ee38,_0x15f7f7){return function(){FaxQueueEvents[_0x00f5('0x3')](_0x38ee38,_0x15f7f7);};}exports[_0x00f5('0x4')]=function(_0x56ff06){for(var _0xb4baba=0x0,_0x3f7344=events[_0x00f5('0x5')];_0xb4baba<_0x3f7344;_0xb4baba++){var _0x3bef29=events[_0xb4baba];var _0x11100b=createListener(_0x00f5('0x6')+_0x3bef29,_0x56ff06);FaxQueueEvents['on'](_0x3bef29,_0x11100b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a6e5a04..4d37e9b 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 _0x11e5=['update','destroy','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x11e5,0x8b));var _0x511e=function(_0x3c3f11,_0x45368d){_0x3c3f11=_0x3c3f11-0x0;var _0x390f9d=_0x11e5[_0x3c3f11];return _0x390f9d;};'use strict';var multer=require(_0x511e('0x0'));var util=require('util');var path=require(_0x511e('0x1'));var timeout=require(_0x511e('0x2'));var express=require('express');var router=express[_0x511e('0x3')]();var fs_extra=require(_0x511e('0x4'));var auth=require(_0x511e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x511e('0x6'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0x511e('0x7')](),controller[_0x511e('0x8')]);router[_0x511e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x511e('0xa')]);router[_0x511e('0x9')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0xc')]);router[_0x511e('0x9')](_0x511e('0xd'),auth[_0x511e('0x7')](),controller[_0x511e('0xe')]);router[_0x511e('0x9')](_0x511e('0xf'),auth['isAuthenticated'](),controller[_0x511e('0x10')]);router['get']('/:id/users',auth[_0x511e('0x7')](),controller[_0x511e('0x11')]);router[_0x511e('0x12')]('/',auth[_0x511e('0x7')](),controller[_0x511e('0x13')]);router[_0x511e('0x12')]('/:id/teams',auth[_0x511e('0x7')](),controller[_0x511e('0x14')]);router['post'](_0x511e('0x15'),auth[_0x511e('0x7')](),controller['addAgents']);router[_0x511e('0x16')](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0x17')]);router['delete'](_0x511e('0xb'),auth[_0x511e('0x7')](),controller[_0x511e('0x18')]);router['delete'](_0x511e('0xf'),auth['isAuthenticated'](),controller[_0x511e('0x19')]);router['delete']('/:id/users',auth[_0x511e('0x7')](),controller['removeAgents']);module[_0x511e('0x1a')]=router; \ No newline at end of file +var _0x199c=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x199c,0x1d8));var _0xc199=function(_0x455108,_0x375582){_0x455108=_0x455108-0x0;var _0x1fca42=_0x199c[_0x455108];return _0x1fca42;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc199('0x0'));var timeout=require(_0xc199('0x1'));var express=require(_0xc199('0x2'));var router=express[_0xc199('0x3')]();var fs_extra=require(_0xc199('0x4'));var auth=require(_0xc199('0x5'));var interaction=require(_0xc199('0x6'));var config=require(_0xc199('0x7'));var controller=require('./faxQueue.controller');router[_0xc199('0x8')]('/',auth[_0xc199('0x9')](),controller['index']);router['get'](_0xc199('0xa'),auth[_0xc199('0x9')](),controller[_0xc199('0xb')]);router[_0xc199('0x8')](_0xc199('0xc'),auth[_0xc199('0x9')](),controller[_0xc199('0xd')]);router[_0xc199('0x8')]('/:id/members',auth[_0xc199('0x9')](),controller[_0xc199('0xe')]);router[_0xc199('0x8')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x10')]);router['get'](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x12')]);router[_0xc199('0x13')]('/',auth[_0xc199('0x9')](),controller['create']);router[_0xc199('0x13')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x14')]);router[_0xc199('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xc199('0x15')]);router['put'](_0xc199('0xc'),auth[_0xc199('0x9')](),controller['update']);router[_0xc199('0x16')]('/:id',auth[_0xc199('0x9')](),controller[_0xc199('0x17')]);router[_0xc199('0x16')](_0xc199('0xf'),auth[_0xc199('0x9')](),controller[_0xc199('0x18')]);router[_0xc199('0x16')](_0xc199('0x11'),auth[_0xc199('0x9')](),controller[_0xc199('0x19')]);module[_0xc199('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0e6bcad..b5afe7a 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 _0x0c34=['DATE','moment','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0c34,0x1a5));var _0x40c3=function(_0x25721b,_0x346e66){_0x25721b=_0x25721b-0x0;var _0x567e11=_0x0c34[_0x25721b];return _0x567e11;};'use strict';var moment=require(_0x40c3('0x0'));var Sequelize=require(_0x40c3('0x1'));module[_0x40c3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x40c3('0x3')]},'joinAt':{'type':Sequelize[_0x40c3('0x4')]},'leaveAt':{'type':Sequelize[_0x40c3('0x4')]},'acceptAt':{'type':Sequelize[_0x40c3('0x4')]},'exitAt':{'type':Sequelize[_0x40c3('0x4')]},'reason':{'type':Sequelize[_0x40c3('0x3')]}}; \ No newline at end of file +var _0x0845=['STRING','DATE','moment'];(function(_0x105172,_0x31d8a8){var _0x39370f=function(_0x5a8fed){while(--_0x5a8fed){_0x105172['push'](_0x105172['shift']());}};_0x39370f(++_0x31d8a8);}(_0x0845,0x125));var _0x5084=function(_0xe61242,_0x62ad30){_0xe61242=_0xe61242-0x0;var _0x2b0530=_0x0845[_0xe61242];return _0x2b0530;};'use strict';var moment=require(_0x5084('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5084('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5084('0x1')]},'joinAt':{'type':Sequelize[_0x5084('0x2')]},'leaveAt':{'type':Sequelize[_0x5084('0x2')]},'acceptAt':{'type':Sequelize[_0x5084('0x2')]},'exitAt':{'type':Sequelize[_0x5084('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 153adf6..b2443e6 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 _0xb634=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','filter','where','VIRTUAL','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','zip-dir'];(function(_0x23760a,_0x5a5b98){var _0x42744b=function(_0x566429){while(--_0x566429){_0x23760a['push'](_0x23760a['shift']());}};_0x42744b(++_0x5a5b98);}(_0xb634,0x1c0));var _0x4b63=function(_0x493c3a,_0x1da742){_0x493c3a=_0x493c3a-0x0;var _0x50bb2b=_0xb634[_0x493c3a];return _0x50bb2b;};'use strict';var emlformat=require(_0x4b63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b63('0x1'));var jsonpatch=require(_0x4b63('0x2'));var rp=require(_0x4b63('0x3'));var moment=require('moment');var BPromise=require(_0x4b63('0x4'));var Mustache=require(_0x4b63('0x5'));var util=require(_0x4b63('0x6'));var path=require(_0x4b63('0x7'));var sox=require(_0x4b63('0x8'));var csv=require(_0x4b63('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b63('0xa'));var squel=require('squel');var crypto=require(_0x4b63('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b63('0xc'));var toCsv=require(_0x4b63('0x9'));var querystring=require('querystring');var Papa=require(_0x4b63('0xd'));var Redis=require(_0x4b63('0xe'));var authService=require(_0x4b63('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b63('0x10'));var hardwareService=require(_0x4b63('0x11'));var logger=require(_0x4b63('0x12'))(_0x4b63('0x13'));var utils=require(_0x4b63('0x14'));var config=require(_0x4b63('0x15'));var licenseUtil=require(_0x4b63('0x16'));var db=require(_0x4b63('0x17'))['db'];function respondWithStatusCode(_0x2cb7fe,_0x2d4985){_0x2d4985=_0x2d4985||0xcc;return function(_0x121bfd){if(_0x121bfd){return _0x2cb7fe[_0x4b63('0x18')](_0x2d4985);}return _0x2cb7fe['status'](_0x2d4985)[_0x4b63('0x19')]();};}function respondWithResult(_0x3e4574,_0x35a5fb){_0x35a5fb=_0x35a5fb||0xc8;return function(_0x1d0374){if(_0x1d0374){return _0x3e4574[_0x4b63('0x1a')](_0x35a5fb)[_0x4b63('0x1b')](_0x1d0374);}};}function respondWithFilteredResult(_0x3e7c87,_0x5c94c6){return function(_0x975c4b){if(_0x975c4b){var _0x49709e=typeof _0x5c94c6[_0x4b63('0x1c')]===_0x4b63('0x1d')&&typeof _0x5c94c6[_0x4b63('0x1e')]===_0x4b63('0x1d');var _0x197498=_0x975c4b[_0x4b63('0x1f')];var _0x1e488c=_0x49709e?0x0:_0x5c94c6['offset'];var _0x523863=_0x49709e?_0x975c4b[_0x4b63('0x1f')]:_0x5c94c6['offset']+_0x5c94c6[_0x4b63('0x1e')];var _0x4021cf;if(_0x523863>=_0x197498){_0x523863=_0x197498;_0x4021cf=0xc8;}else{_0x4021cf=0xce;}_0x3e7c87[_0x4b63('0x1a')](_0x4021cf);return _0x3e7c87['set'](_0x4b63('0x20'),_0x1e488c+'-'+_0x523863+'/'+_0x197498)[_0x4b63('0x1b')](_0x975c4b);}return null;};}function patchUpdates(_0x57c5f4){return function(_0x59a3d2){try{jsonpatch[_0x4b63('0x21')](_0x59a3d2,_0x57c5f4,!![]);}catch(_0x4282f6){return BPromise[_0x4b63('0x22')](_0x4282f6);}return _0x59a3d2[_0x4b63('0x23')]();};}function saveUpdates(_0xe1461e,_0x167337){return function(_0x2350dc){if(_0x2350dc){return _0x2350dc[_0x4b63('0x24')](_0xe1461e)[_0x4b63('0x25')](function(_0x10f8e7){return _0x10f8e7;});}return null;};}function removeEntity(_0xacb37a,_0x269faf){return function(_0x8940d6){if(_0x8940d6){return _0x8940d6[_0x4b63('0x26')]()['then'](function(){_0xacb37a[_0x4b63('0x1a')](0xcc)[_0x4b63('0x19')]();});}};}function handleEntityNotFound(_0x444860,_0x26b6f9){return function(_0x11326d){if(!_0x11326d){_0x444860['sendStatus'](0x194);}return _0x11326d;};}function handleError(_0xab6ac8,_0x495478){_0x495478=_0x495478||0x1f4;return function(_0x417d92){logger[_0x4b63('0x27')](_0x417d92['stack']);if(_0x417d92['name']){delete _0x417d92[_0x4b63('0x28')];}_0xab6ac8[_0x4b63('0x1a')](_0x495478)[_0x4b63('0x29')](_0x417d92);};}exports[_0x4b63('0x2a')]=function(_0x8852f1,_0x208af0){var _0x1e7ed0={},_0x5a9648={},_0x310ab0={'count':0x0,'rows':[]};var _0x56497c=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0x5a28b7){return{'name':_0x5a28b7[_0x4b63('0x2b')],'type':_0x5a28b7[_0x4b63('0x2c')][_0x4b63('0x2d')]};});_0x5a9648[_0x4b63('0x2e')]=_[_0x4b63('0x2f')](_0x56497c,_0x4b63('0x28'));_0x5a9648['query']=_[_0x4b63('0x30')](_0x8852f1['query']);_0x5a9648[_0x4b63('0x31')]=_[_0x4b63('0x32')](_0x5a9648[_0x4b63('0x2e')],_0x5a9648[_0x4b63('0x33')]);_0x1e7ed0[_0x4b63('0x34')]=_[_0x4b63('0x32')](_0x5a9648['model'],qs[_0x4b63('0x35')](_0x8852f1['query']['fields']));_0x1e7ed0[_0x4b63('0x34')]=_0x1e7ed0[_0x4b63('0x34')][_0x4b63('0x36')]?_0x1e7ed0['attributes']:_0x5a9648[_0x4b63('0x2e')];if(!_0x8852f1['query'][_0x4b63('0x37')](_0x4b63('0x38'))){_0x1e7ed0['limit']=qs[_0x4b63('0x1e')](_0x8852f1['query'][_0x4b63('0x1e')]);_0x1e7ed0['offset']=qs[_0x4b63('0x1c')](_0x8852f1[_0x4b63('0x33')][_0x4b63('0x1c')]);}_0x1e7ed0['order']=qs['sort'](_0x8852f1[_0x4b63('0x33')]['sort']);_0x1e7ed0['where']=qs[_0x4b63('0x31')](_['pick'](_0x8852f1[_0x4b63('0x33')],_0x5a9648[_0x4b63('0x31')]),_0x56497c);if(_0x8852f1[_0x4b63('0x33')][_0x4b63('0x39')]){_0x1e7ed0[_0x4b63('0x3a')]=_['merge'](_0x1e7ed0[_0x4b63('0x3a')],{'$or':_['map'](_0x56497c,function(_0x36e706){if(_0x36e706[_0x4b63('0x2c')]!==_0x4b63('0x3b')){var _0x315dc6={};_0x315dc6[_0x36e706[_0x4b63('0x28')]]={'$like':'%'+_0x8852f1[_0x4b63('0x33')][_0x4b63('0x39')]+'%'};return _0x315dc6;}})});}_0x1e7ed0=_[_0x4b63('0x3c')]({},_0x1e7ed0,_0x8852f1[_0x4b63('0x3d')]);var _0x3c0930={'where':_0x1e7ed0[_0x4b63('0x3a')]};return db[_0x4b63('0x3e')][_0x4b63('0x1f')](_0x3c0930)[_0x4b63('0x25')](function(_0x1b27b4){_0x310ab0['count']=_0x1b27b4;if(_0x8852f1['query'][_0x4b63('0x3f')]){_0x1e7ed0[_0x4b63('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x4b63('0x41')](_0x1e7ed0);})[_0x4b63('0x25')](function(_0x3ef21e){_0x310ab0[_0x4b63('0x42')]=_0x3ef21e;return _0x310ab0;})[_0x4b63('0x25')](respondWithFilteredResult(_0x208af0,_0x1e7ed0))[_0x4b63('0x43')](handleError(_0x208af0,null));};exports[_0x4b63('0x44')]=function(_0x2ff9cd,_0x26a22c){var _0x5ebe9c={'raw':!![],'where':{'id':_0x2ff9cd['params']['id']}},_0x45cc94={};_0x45cc94[_0x4b63('0x2e')]=_['keys'](db[_0x4b63('0x3e')][_0x4b63('0x45')]);_0x45cc94[_0x4b63('0x33')]=_[_0x4b63('0x30')](_0x2ff9cd[_0x4b63('0x33')]);_0x45cc94[_0x4b63('0x31')]=_[_0x4b63('0x32')](_0x45cc94[_0x4b63('0x2e')],_0x45cc94['query']);_0x5ebe9c[_0x4b63('0x34')]=_[_0x4b63('0x32')](_0x45cc94[_0x4b63('0x2e')],qs[_0x4b63('0x35')](_0x2ff9cd[_0x4b63('0x33')][_0x4b63('0x35')]));_0x5ebe9c[_0x4b63('0x34')]=_0x5ebe9c[_0x4b63('0x34')][_0x4b63('0x36')]?_0x5ebe9c[_0x4b63('0x34')]:_0x45cc94[_0x4b63('0x2e')];if(_0x2ff9cd[_0x4b63('0x33')][_0x4b63('0x3f')]){_0x5ebe9c['include']=[{'all':!![]}];}_0x5ebe9c=_[_0x4b63('0x3c')]({},_0x5ebe9c,_0x2ff9cd[_0x4b63('0x3d')]);return db['FaxQueueReport'][_0x4b63('0x46')](_0x5ebe9c)['then'](handleEntityNotFound(_0x26a22c,null))[_0x4b63('0x25')](respondWithResult(_0x26a22c,null))[_0x4b63('0x43')](handleError(_0x26a22c,null));};exports[_0x4b63('0x47')]=function(_0x1c8b9d,_0x403f46){return db[_0x4b63('0x3e')][_0x4b63('0x47')](_0x1c8b9d[_0x4b63('0x48')],{})[_0x4b63('0x25')](respondWithResult(_0x403f46,0xc9))[_0x4b63('0x43')](handleError(_0x403f46,null));};exports[_0x4b63('0x24')]=function(_0x130ca2,_0x35f4cf){if(_0x130ca2['body']['id']){delete _0x130ca2['body']['id'];}return db[_0x4b63('0x3e')]['find']({'where':{'id':_0x130ca2[_0x4b63('0x49')]['id']}})[_0x4b63('0x25')](handleEntityNotFound(_0x35f4cf,null))[_0x4b63('0x25')](saveUpdates(_0x130ca2[_0x4b63('0x48')],null))['then'](respondWithResult(_0x35f4cf,null))[_0x4b63('0x43')](handleError(_0x35f4cf,null));};exports[_0x4b63('0x26')]=function(_0x10cfdb,_0xf07322){return db['FaxQueueReport'][_0x4b63('0x46')]({'where':{'id':_0x10cfdb[_0x4b63('0x49')]['id']}})[_0x4b63('0x25')](handleEntityNotFound(_0xf07322,null))['then'](removeEntity(_0xf07322,null))[_0x4b63('0x43')](handleError(_0xf07322,null));};exports[_0x4b63('0x4a')]=function(_0x58b70e,_0x5dd48a){return db[_0x4b63('0x3e')][_0x4b63('0x4a')]()[_0x4b63('0x25')](respondWithResult(_0x5dd48a,null))[_0x4b63('0x43')](handleError(_0x5dd48a,null));}; \ No newline at end of file +var _0x8ccb=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then','error','stack','send','FaxQueueReport','rawAttributes','type','model','name','query','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','map','VIRTUAL','includeAll','findAll','rows','keys','fields','include','options','find','create','catch','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra'];(function(_0x588cf2,_0x2e250a){var _0x437057=function(_0x3c75cb){while(--_0x3c75cb){_0x588cf2['push'](_0x588cf2['shift']());}};_0x437057(++_0x2e250a);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x8ccb[_0x2cef86];return _0x46dfd6;};'use strict';var emlformat=require(_0xb8cc('0x0'));var rimraf=require(_0xb8cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8cc('0x2'));var rp=require(_0xb8cc('0x3'));var moment=require(_0xb8cc('0x4'));var BPromise=require(_0xb8cc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb8cc('0x6'));var sox=require(_0xb8cc('0x7'));var csv=require(_0xb8cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8cc('0x9'));var _=require(_0xb8cc('0xa'));var squel=require(_0xb8cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb8cc('0xc'));var deskjs=require(_0xb8cc('0xd'));var toCsv=require(_0xb8cc('0x8'));var querystring=require('querystring');var Papa=require(_0xb8cc('0xe'));var Redis=require(_0xb8cc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8cc('0x10'));var hardwareService=require(_0xb8cc('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb8cc('0x12'));var config=require(_0xb8cc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8cc('0x14'))['db'];function respondWithStatusCode(_0x2c1cbc,_0xfd89e0){_0xfd89e0=_0xfd89e0||0xcc;return function(_0x2875e0){if(_0x2875e0){return _0x2c1cbc[_0xb8cc('0x15')](_0xfd89e0);}return _0x2c1cbc[_0xb8cc('0x16')](_0xfd89e0)[_0xb8cc('0x17')]();};}function respondWithResult(_0x4983ae,_0x11ecf2){_0x11ecf2=_0x11ecf2||0xc8;return function(_0x5ec8a7){if(_0x5ec8a7){return _0x4983ae[_0xb8cc('0x16')](_0x11ecf2)[_0xb8cc('0x18')](_0x5ec8a7);}};}function respondWithFilteredResult(_0x183056,_0x5f3b91){return function(_0x1f8b8d){if(_0x1f8b8d){var _0x274cab=typeof _0x5f3b91[_0xb8cc('0x19')]==='undefined'&&typeof _0x5f3b91[_0xb8cc('0x1a')]==='undefined';var _0x131c44=_0x1f8b8d['count'];var _0x2ac4cc=_0x274cab?0x0:_0x5f3b91[_0xb8cc('0x19')];var _0x2b7130=_0x274cab?_0x1f8b8d[_0xb8cc('0x1b')]:_0x5f3b91[_0xb8cc('0x19')]+_0x5f3b91['limit'];var _0x1c1022;if(_0x2b7130>=_0x131c44){_0x2b7130=_0x131c44;_0x1c1022=0xc8;}else{_0x1c1022=0xce;}_0x183056[_0xb8cc('0x16')](_0x1c1022);return _0x183056[_0xb8cc('0x1c')]('Content-Range',_0x2ac4cc+'-'+_0x2b7130+'/'+_0x131c44)[_0xb8cc('0x18')](_0x1f8b8d);}return null;};}function patchUpdates(_0x1a81b4){return function(_0x4a7aac){try{jsonpatch[_0xb8cc('0x1d')](_0x4a7aac,_0x1a81b4,!![]);}catch(_0xe5ad50){return BPromise['reject'](_0xe5ad50);}return _0x4a7aac[_0xb8cc('0x1e')]();};}function saveUpdates(_0xdcb33d,_0xd1c676){return function(_0x1d372c){if(_0x1d372c){return _0x1d372c[_0xb8cc('0x1f')](_0xdcb33d)[_0xb8cc('0x20')](function(_0x1a0467){return _0x1a0467;});}return null;};}function removeEntity(_0x59608c,_0x50aa38){return function(_0x8b6b21){if(_0x8b6b21){return _0x8b6b21['destroy']()[_0xb8cc('0x20')](function(){_0x59608c['status'](0xcc)[_0xb8cc('0x17')]();});}};}function handleEntityNotFound(_0xbb1918,_0x335f32){return function(_0x77a162){if(!_0x77a162){_0xbb1918['sendStatus'](0x194);}return _0x77a162;};}function handleError(_0x2c4aa0,_0x2cc7f3){_0x2cc7f3=_0x2cc7f3||0x1f4;return function(_0x400de6){logger[_0xb8cc('0x21')](_0x400de6[_0xb8cc('0x22')]);if(_0x400de6['name']){delete _0x400de6['name'];}_0x2c4aa0[_0xb8cc('0x16')](_0x2cc7f3)[_0xb8cc('0x23')](_0x400de6);};}exports['index']=function(_0x3e4a37,_0x5cc936){var _0x23f204={},_0x2634a4={},_0x1d1514={'count':0x0,'rows':[]};var _0x118a18=_['map'](db[_0xb8cc('0x24')][_0xb8cc('0x25')],function(_0x282579){return{'name':_0x282579['fieldName'],'type':_0x282579[_0xb8cc('0x26')]['key']};});_0x2634a4[_0xb8cc('0x27')]=_['map'](_0x118a18,_0xb8cc('0x28'));_0x2634a4[_0xb8cc('0x29')]=_['keys'](_0x3e4a37[_0xb8cc('0x29')]);_0x2634a4[_0xb8cc('0x2a')]=_[_0xb8cc('0x2b')](_0x2634a4[_0xb8cc('0x27')],_0x2634a4[_0xb8cc('0x29')]);_0x23f204[_0xb8cc('0x2c')]=_[_0xb8cc('0x2b')](_0x2634a4['model'],qs['fields'](_0x3e4a37[_0xb8cc('0x29')]['fields']));_0x23f204[_0xb8cc('0x2c')]=_0x23f204['attributes']['length']?_0x23f204[_0xb8cc('0x2c')]:_0x2634a4[_0xb8cc('0x27')];if(!_0x3e4a37[_0xb8cc('0x29')]['hasOwnProperty'](_0xb8cc('0x2d'))){_0x23f204[_0xb8cc('0x1a')]=qs[_0xb8cc('0x1a')](_0x3e4a37[_0xb8cc('0x29')][_0xb8cc('0x1a')]);_0x23f204[_0xb8cc('0x19')]=qs[_0xb8cc('0x19')](_0x3e4a37[_0xb8cc('0x29')][_0xb8cc('0x19')]);}_0x23f204[_0xb8cc('0x2e')]=qs[_0xb8cc('0x2f')](_0x3e4a37[_0xb8cc('0x29')][_0xb8cc('0x2f')]);_0x23f204[_0xb8cc('0x30')]=qs[_0xb8cc('0x2a')](_[_0xb8cc('0x31')](_0x3e4a37[_0xb8cc('0x29')],_0x2634a4[_0xb8cc('0x2a')]),_0x118a18);if(_0x3e4a37['query']['filter']){_0x23f204[_0xb8cc('0x30')]=_[_0xb8cc('0x32')](_0x23f204[_0xb8cc('0x30')],{'$or':_[_0xb8cc('0x33')](_0x118a18,function(_0x25cde5){if(_0x25cde5[_0xb8cc('0x26')]!==_0xb8cc('0x34')){var _0x1564e9={};_0x1564e9[_0x25cde5[_0xb8cc('0x28')]]={'$like':'%'+_0x3e4a37['query']['filter']+'%'};return _0x1564e9;}})});}_0x23f204=_['merge']({},_0x23f204,_0x3e4a37['options']);var _0xf7a2c={'where':_0x23f204['where']};return db[_0xb8cc('0x24')]['count'](_0xf7a2c)[_0xb8cc('0x20')](function(_0x23ece3){_0x1d1514[_0xb8cc('0x1b')]=_0x23ece3;if(_0x3e4a37[_0xb8cc('0x29')][_0xb8cc('0x35')]){_0x23f204['include']=[{'all':!![]}];}return db[_0xb8cc('0x24')][_0xb8cc('0x36')](_0x23f204);})[_0xb8cc('0x20')](function(_0x4d8942){_0x1d1514[_0xb8cc('0x37')]=_0x4d8942;return _0x1d1514;})['then'](respondWithFilteredResult(_0x5cc936,_0x23f204))['catch'](handleError(_0x5cc936,null));};exports['show']=function(_0x143679,_0xd54827){var _0x3d2f26={'raw':!![],'where':{'id':_0x143679['params']['id']}},_0x3f3a96={};_0x3f3a96['model']=_[_0xb8cc('0x38')](db['FaxQueueReport']['rawAttributes']);_0x3f3a96[_0xb8cc('0x29')]=_[_0xb8cc('0x38')](_0x143679[_0xb8cc('0x29')]);_0x3f3a96[_0xb8cc('0x2a')]=_['intersection'](_0x3f3a96[_0xb8cc('0x27')],_0x3f3a96[_0xb8cc('0x29')]);_0x3d2f26['attributes']=_[_0xb8cc('0x2b')](_0x3f3a96[_0xb8cc('0x27')],qs[_0xb8cc('0x39')](_0x143679[_0xb8cc('0x29')][_0xb8cc('0x39')]));_0x3d2f26[_0xb8cc('0x2c')]=_0x3d2f26[_0xb8cc('0x2c')]['length']?_0x3d2f26[_0xb8cc('0x2c')]:_0x3f3a96[_0xb8cc('0x27')];if(_0x143679[_0xb8cc('0x29')][_0xb8cc('0x35')]){_0x3d2f26[_0xb8cc('0x3a')]=[{'all':!![]}];}_0x3d2f26=_[_0xb8cc('0x32')]({},_0x3d2f26,_0x143679[_0xb8cc('0x3b')]);return db['FaxQueueReport'][_0xb8cc('0x3c')](_0x3d2f26)['then'](handleEntityNotFound(_0xd54827,null))['then'](respondWithResult(_0xd54827,null))['catch'](handleError(_0xd54827,null));};exports[_0xb8cc('0x3d')]=function(_0x1fe418,_0x210d59){return db[_0xb8cc('0x24')]['create'](_0x1fe418['body'],{})[_0xb8cc('0x20')](respondWithResult(_0x210d59,0xc9))[_0xb8cc('0x3e')](handleError(_0x210d59,null));};exports[_0xb8cc('0x1f')]=function(_0x3e5e32,_0x3216a4){if(_0x3e5e32[_0xb8cc('0x3f')]['id']){delete _0x3e5e32[_0xb8cc('0x3f')]['id'];}return db[_0xb8cc('0x24')][_0xb8cc('0x3c')]({'where':{'id':_0x3e5e32[_0xb8cc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3216a4,null))[_0xb8cc('0x20')](saveUpdates(_0x3e5e32[_0xb8cc('0x3f')],null))[_0xb8cc('0x20')](respondWithResult(_0x3216a4,null))[_0xb8cc('0x3e')](handleError(_0x3216a4,null));};exports['destroy']=function(_0x2ac1be,_0x4688b4){return db[_0xb8cc('0x24')]['find']({'where':{'id':_0x2ac1be[_0xb8cc('0x40')]['id']}})[_0xb8cc('0x20')](handleEntityNotFound(_0x4688b4,null))[_0xb8cc('0x20')](removeEntity(_0x4688b4,null))['catch'](handleError(_0x4688b4,null));};exports[_0xb8cc('0x41')]=function(_0x289f6c,_0x563e4f){return db[_0xb8cc('0x24')][_0xb8cc('0x41')]()[_0xb8cc('0x20')](respondWithResult(_0x563e4f,null))['catch'](handleError(_0x563e4f,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9d5fce9..20a1306 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x4a27d5,_0x3c55a7){var _0x452f75=function(_0x396c39){while(--_0x396c39){_0x4a27d5['push'](_0x4a27d5['shift']());}};_0x452f75(++_0x3c55a7);}(_0xe14b,0x93));var _0xbe14=function(_0x3bd581,_0x29133e){_0x3bd581=_0x3bd581-0x0;var _0x231c11=_0xe14b[_0x3bd581];return _0x231c11;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x30e913,_0x1249e3){var _0x11d733=function(_0x3df02e){while(--_0x3df02e){_0x30e913['push'](_0x30e913['shift']());}};_0x11d733(++_0x1249e3);}(_0x53ec,0x192));var _0xc53e=function(_0x12dd11,_0x52b882){_0x12dd11=_0x12dd11-0x0;var _0x3a502b=_0x53ec[_0x12dd11];return _0x3a502b;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index cc15d32..98643d7 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 _0x3117=['FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x82559d,_0x412a99){var _0x455aab=function(_0x56d344){while(--_0x56d344){_0x82559d['push'](_0x82559d['shift']());}};_0x455aab(++_0x412a99);}(_0x3117,0x150));var _0x7311=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x3117[_0x274638];return _0x5755df;};'use strict';var _=require(_0x7311('0x0'));var util=require(_0x7311('0x1'));var moment=require(_0x7311('0x2'));var BPromise=require(_0x7311('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7311('0x4'));var db=require(_0x7311('0x5'))['db'];var utils=require(_0x7311('0x6'));var logger=require(_0x7311('0x7'))(_0x7311('0x8'));var config=require(_0x7311('0x9'));var jayson=require(_0x7311('0xa'));var client=jayson[_0x7311('0xb')][_0x7311('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4753e5,_0x15e7b8,_0x35e7bd){return new BPromise(function(_0x26d8a8,_0x1fed5b){return client[_0x7311('0xd')](_0x4753e5,_0x35e7bd)[_0x7311('0xe')](function(_0x4f8605){logger[_0x7311('0xf')](_0x7311('0x10'),_0x15e7b8,_0x7311('0x11'));logger['debug'](_0x7311('0x12'),_0x15e7b8,'request\x20sent',JSON[_0x7311('0x13')](_0x4f8605));if(_0x4f8605['error']){if(_0x4f8605[_0x7311('0x14')]['code']===0x1f4){logger[_0x7311('0x14')](_0x7311('0x10'),_0x15e7b8,_0x4f8605[_0x7311('0x14')]['message']);return _0x1fed5b(_0x4f8605[_0x7311('0x14')]['message']);}logger['error'](_0x7311('0x10'),_0x15e7b8,_0x4f8605[_0x7311('0x14')]['message']);return _0x26d8a8(_0x4f8605[_0x7311('0x14')][_0x7311('0x15')]);}else{logger[_0x7311('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x15e7b8,_0x7311('0x11'));_0x26d8a8(_0x4f8605[_0x7311('0x16')][_0x7311('0x15')]);}})[_0x7311('0x17')](function(_0xcc9f95){logger[_0x7311('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x15e7b8,_0xcc9f95);_0x1fed5b(_0xcc9f95);});});}exports['CreateFaxQueueReport']=function(_0x56bf52){var _0x549280=this;return new Promise(function(_0x564f89,_0xb1c07f){return db[_0x7311('0x18')][_0x7311('0x19')](_0x56bf52[_0x7311('0x1a')],{'raw':_0x56bf52[_0x7311('0x1b')]?_0x56bf52[_0x7311('0x1b')][_0x7311('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x48d0cf){logger[_0x7311('0xf')](_0x7311('0x1d'),_0x56bf52);logger[_0x7311('0x1e')](_0x7311('0x1d'),_0x56bf52,JSON[_0x7311('0x13')](_0x48d0cf));_0x564f89(_0x48d0cf);})[_0x7311('0x17')](function(_0x4fd99c){logger['error'](_0x7311('0x1d'),_0x4fd99c[_0x7311('0x15')],_0x56bf52);_0xb1c07f(_0x549280[_0x7311('0x14')](0x1f4,_0x4fd99c[_0x7311('0x15')]));});});};exports[_0x7311('0x1f')]=function(_0x153c4b){var _0x4f03b8=this;return new Promise(function(_0x3fac31,_0x212069){return db[_0x7311('0x18')][_0x7311('0x20')](_0x153c4b[_0x7311('0x1a')],{'raw':_0x153c4b[_0x7311('0x1b')]?_0x153c4b[_0x7311('0x1b')][_0x7311('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153c4b[_0x7311('0x1b')]?_0x153c4b[_0x7311('0x1b')][_0x7311('0x21')]||null:null,'attributes':_0x153c4b['options']?_0x153c4b[_0x7311('0x1b')][_0x7311('0x22')]||null:null,'limit':_0x153c4b[_0x7311('0x1b')]?_0x153c4b[_0x7311('0x1b')][_0x7311('0x23')]||null:null})['then'](function(_0x1b356c){logger[_0x7311('0xf')](_0x7311('0x1f'),_0x153c4b);logger['debug'](_0x7311('0x1f'),_0x153c4b,JSON[_0x7311('0x13')](_0x1b356c));_0x3fac31(_0x1b356c);})['catch'](function(_0x4d5ad3){logger[_0x7311('0x14')](_0x7311('0x1f'),_0x4d5ad3[_0x7311('0x15')],_0x153c4b);_0x212069(_0x4f03b8[_0x7311('0x14')](0x1f4,_0x4d5ad3[_0x7311('0x15')]));});});}; \ No newline at end of file +var _0x4434=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','FaxQueueReport','body','options','CreateFaxQueueReport','stringify','raw','where','attributes','limit','then','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xba2236,_0x56bf52){var _0x4c951e=function(_0x1d7f26){while(--_0x1d7f26){_0xba2236['push'](_0xba2236['shift']());}};_0x4c951e(++_0x56bf52);}(_0x4434,0x196));var _0x4443=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4434[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var moment=require(_0x4443('0x2'));var BPromise=require(_0x4443('0x3'));var rs=require(_0x4443('0x4'));var fs=require('fs');var Redis=require(_0x4443('0x5'));var db=require(_0x4443('0x6'))['db'];var utils=require(_0x4443('0x7'));var logger=require('../../config/logger')(_0x4443('0x8'));var config=require(_0x4443('0x9'));var jayson=require(_0x4443('0xa'));var client=jayson[_0x4443('0xb')][_0x4443('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49d7b0,_0x539b02,_0xc07bea){return new BPromise(function(_0x5b9638,_0x1ff9de){return client[_0x4443('0xd')](_0x49d7b0,_0xc07bea)['then'](function(_0xe36a24){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x539b02,_0x4443('0xe'));logger[_0x4443('0xf')](_0x4443('0x10'),_0x539b02,_0x4443('0xe'),JSON['stringify'](_0xe36a24));if(_0xe36a24[_0x4443('0x11')]){if(_0xe36a24['error'][_0x4443('0x12')]===0x1f4){logger[_0x4443('0x11')](_0x4443('0x13'),_0x539b02,_0xe36a24['error']['message']);return _0x1ff9de(_0xe36a24[_0x4443('0x11')][_0x4443('0x14')]);}logger[_0x4443('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x539b02,_0xe36a24[_0x4443('0x11')][_0x4443('0x14')]);return _0x5b9638(_0xe36a24['error'][_0x4443('0x14')]);}else{logger[_0x4443('0x15')](_0x4443('0x13'),_0x539b02,_0x4443('0xe'));_0x5b9638(_0xe36a24[_0x4443('0x16')][_0x4443('0x14')]);}})[_0x4443('0x17')](function(_0x55c3a7){logger[_0x4443('0x11')](_0x4443('0x13'),_0x539b02,_0x55c3a7);_0x1ff9de(_0x55c3a7);});});}exports['CreateFaxQueueReport']=function(_0x4e70da){var _0x3e92a=this;return new Promise(function(_0x190874,_0x164441){return db[_0x4443('0x18')]['create'](_0x4e70da[_0x4443('0x19')],{'raw':_0x4e70da[_0x4443('0x1a')]?_0x4e70da['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x242407){logger[_0x4443('0x15')](_0x4443('0x1b'),_0x4e70da);logger[_0x4443('0xf')](_0x4443('0x1b'),_0x4e70da,JSON[_0x4443('0x1c')](_0x242407));_0x190874(_0x242407);})[_0x4443('0x17')](function(_0x6e19ca){logger[_0x4443('0x11')](_0x4443('0x1b'),_0x6e19ca[_0x4443('0x14')],_0x4e70da);_0x164441(_0x3e92a[_0x4443('0x11')](0x1f4,_0x6e19ca[_0x4443('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x253b9f){var _0x54ebbe=this;return new Promise(function(_0x2ddbb9,_0x14317d){return db[_0x4443('0x18')]['update'](_0x253b9f['body'],{'raw':_0x253b9f['options']?_0x253b9f[_0x4443('0x1a')][_0x4443('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253b9f['options']?_0x253b9f[_0x4443('0x1a')][_0x4443('0x1e')]||null:null,'attributes':_0x253b9f['options']?_0x253b9f[_0x4443('0x1a')][_0x4443('0x1f')]||null:null,'limit':_0x253b9f[_0x4443('0x1a')]?_0x253b9f[_0x4443('0x1a')][_0x4443('0x20')]||null:null})[_0x4443('0x21')](function(_0x4a193b){logger[_0x4443('0x15')](_0x4443('0x22'),_0x253b9f);logger[_0x4443('0xf')](_0x4443('0x22'),_0x253b9f,JSON['stringify'](_0x4a193b));_0x2ddbb9(_0x4a193b);})[_0x4443('0x17')](function(_0x1889bd){logger[_0x4443('0x11')](_0x4443('0x22'),_0x1889bd['message'],_0x253b9f);_0x14317d(_0x54ebbe[_0x4443('0x11')](0x1f4,_0x1889bd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 156cc4d..e8cd2ee 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 _0x75f6=['isAuthenticated','describe','post','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','/describe'];(function(_0x11feb0,_0x422566){var _0xf02667=function(_0x380c55){while(--_0x380c55){_0x11feb0['push'](_0x11feb0['shift']());}};_0xf02667(++_0x422566);}(_0x75f6,0x9b));var _0x675f=function(_0x5badf8,_0x12fd62){_0x5badf8=_0x5badf8-0x0;var _0x485142=_0x75f6[_0x5badf8];return _0x485142;};'use strict';var multer=require(_0x675f('0x0'));var util=require(_0x675f('0x1'));var path=require(_0x675f('0x2'));var timeout=require(_0x675f('0x3'));var express=require(_0x675f('0x4'));var router=express[_0x675f('0x5')]();var fs_extra=require(_0x675f('0x6'));var auth=require(_0x675f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x675f('0x8'));var controller=require(_0x675f('0x9'));router[_0x675f('0xa')]('/',auth['isAuthenticated'](),controller[_0x675f('0xb')]);router[_0x675f('0xa')](_0x675f('0xc'),auth[_0x675f('0xd')](),controller[_0x675f('0xe')]);router[_0x675f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x675f('0xf')]('/',auth[_0x675f('0xd')](),controller['create']);router[_0x675f('0x10')]('/:id',auth[_0x675f('0xd')](),controller['update']);router[_0x675f('0x11')](_0x675f('0x12'),auth[_0x675f('0xd')](),controller[_0x675f('0x13')]);module[_0x675f('0x14')]=router; \ No newline at end of file +var _0x80f0=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x10c3b0,_0x4c168f){var _0x37f5a5=function(_0x474782){while(--_0x474782){_0x10c3b0['push'](_0x10c3b0['shift']());}};_0x37f5a5(++_0x4c168f);}(_0x80f0,0x7f));var _0x080f=function(_0x56914d,_0x157311){_0x56914d=_0x56914d-0x0;var _0x51278b=_0x80f0[_0x56914d];return _0x51278b;};'use strict';var multer=require('multer');var util=require(_0x080f('0x0'));var path=require(_0x080f('0x1'));var timeout=require(_0x080f('0x2'));var express=require(_0x080f('0x3'));var router=express[_0x080f('0x4')]();var fs_extra=require(_0x080f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x080f('0x6'));var controller=require(_0x080f('0x7'));router[_0x080f('0x8')]('/',auth[_0x080f('0x9')](),controller[_0x080f('0xa')]);router[_0x080f('0x8')](_0x080f('0xb'),auth[_0x080f('0x9')](),controller[_0x080f('0xc')]);router[_0x080f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x080f('0xd')]);router[_0x080f('0xe')]('/',auth[_0x080f('0x9')](),controller[_0x080f('0xf')]);router[_0x080f('0x10')](_0x080f('0x11'),auth[_0x080f('0x9')](),controller[_0x080f('0x12')]);router[_0x080f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x080f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 007454c..7e244d0 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x34e8,0x12c));var _0x834e=function(_0x29d577,_0x57de7c){_0x29d577=_0x29d577-0x0;var _0x39f52d=_0x34e8[_0x29d577];return _0x39f52d;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xb43b,0x1b2));var _0xbb43=function(_0x27c470,_0x13ae66){_0x27c470=_0x27c470-0x0;var _0x3561ce=_0xb43b[_0x27c470];return _0x3561ce;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 53fada1..df676bd 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 _0xc854=['include','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','end','error','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll'];(function(_0x4f4519,_0x22dca3){var _0x3945d2=function(_0x16010d){while(--_0x16010d){_0x4f4519['push'](_0x4f4519['shift']());}};_0x3945d2(++_0x22dca3);}(_0xc854,0x1f3));var _0x4c85=function(_0x3f5d1a,_0x33400b){_0x3f5d1a=_0x3f5d1a-0x0;var _0x2db38a=_0xc854[_0x3f5d1a];return _0x2db38a;};'use strict';var emlformat=require(_0x4c85('0x0'));var rimraf=require(_0x4c85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c85('0x2'));var moment=require(_0x4c85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c85('0x4'));var util=require(_0x4c85('0x5'));var path=require('path');var sox=require(_0x4c85('0x6'));var csv=require(_0x4c85('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c85('0x8'));var _=require(_0x4c85('0x9'));var squel=require(_0x4c85('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c85('0xb'));var toCsv=require(_0x4c85('0x7'));var querystring=require('querystring');var Papa=require(_0x4c85('0xc'));var Redis=require('ioredis');var authService=require(_0x4c85('0xd'));var qs=require(_0x4c85('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c85('0xf'));var logger=require(_0x4c85('0x10'))(_0x4c85('0x11'));var utils=require('../../config/utils');var config=require(_0x4c85('0x12'));var licenseUtil=require(_0x4c85('0x13'));var db=require(_0x4c85('0x14'))['db'];function respondWithStatusCode(_0x4b45b8,_0x324150){_0x324150=_0x324150||0xcc;return function(_0x2e0788){if(_0x2e0788){return _0x4b45b8[_0x4c85('0x15')](_0x324150);}return _0x4b45b8['status'](_0x324150)['end']();};}function respondWithResult(_0x3ece2e,_0x212c14){_0x212c14=_0x212c14||0xc8;return function(_0x3ca6bb){if(_0x3ca6bb){return _0x3ece2e[_0x4c85('0x16')](_0x212c14)[_0x4c85('0x17')](_0x3ca6bb);}};}function respondWithFilteredResult(_0x40af2b,_0x38bbf1){return function(_0x66233d){if(_0x66233d){var _0x21fb8f=typeof _0x38bbf1[_0x4c85('0x18')]===_0x4c85('0x19')&&typeof _0x38bbf1[_0x4c85('0x1a')]==='undefined';var _0x33b5fd=_0x66233d['count'];var _0x5f5a6a=_0x21fb8f?0x0:_0x38bbf1[_0x4c85('0x18')];var _0x1fb61f=_0x21fb8f?_0x66233d[_0x4c85('0x1b')]:_0x38bbf1[_0x4c85('0x18')]+_0x38bbf1[_0x4c85('0x1a')];var _0x4bc52c;if(_0x1fb61f>=_0x33b5fd){_0x1fb61f=_0x33b5fd;_0x4bc52c=0xc8;}else{_0x4bc52c=0xce;}_0x40af2b[_0x4c85('0x16')](_0x4bc52c);return _0x40af2b[_0x4c85('0x1c')]('Content-Range',_0x5f5a6a+'-'+_0x1fb61f+'/'+_0x33b5fd)[_0x4c85('0x17')](_0x66233d);}return null;};}function patchUpdates(_0xd210c4){return function(_0x59e2d1){try{jsonpatch['apply'](_0x59e2d1,_0xd210c4,!![]);}catch(_0x44a3d4){return BPromise[_0x4c85('0x1d')](_0x44a3d4);}return _0x59e2d1[_0x4c85('0x1e')]();};}function saveUpdates(_0x32b42f,_0x5e3bb8){return function(_0x28bc8f){if(_0x28bc8f){return _0x28bc8f[_0x4c85('0x1f')](_0x32b42f)['then'](function(_0x1158f5){return _0x1158f5;});}return null;};}function removeEntity(_0x2fa5f8,_0x4f0013){return function(_0x2b6668){if(_0x2b6668){return _0x2b6668['destroy']()[_0x4c85('0x20')](function(){_0x2fa5f8[_0x4c85('0x16')](0xcc)[_0x4c85('0x21')]();});}};}function handleEntityNotFound(_0x59e461,_0x18cb9a){return function(_0x484be6){if(!_0x484be6){_0x59e461['sendStatus'](0x194);}return _0x484be6;};}function handleError(_0x3ef732,_0x29fb63){_0x29fb63=_0x29fb63||0x1f4;return function(_0x2af90c){logger[_0x4c85('0x22')](_0x2af90c['stack']);if(_0x2af90c['name']){delete _0x2af90c[_0x4c85('0x23')];}_0x3ef732[_0x4c85('0x16')](_0x29fb63)[_0x4c85('0x24')](_0x2af90c);};}exports['index']=function(_0x4df857,_0x111cb6){var _0x17dcce={},_0x2cbb5b={},_0x5035d2={'count':0x0,'rows':[]};var _0x5bbe5a=_[_0x4c85('0x25')](db[_0x4c85('0x26')][_0x4c85('0x27')],function(_0x3a8305){return{'name':_0x3a8305[_0x4c85('0x28')],'type':_0x3a8305[_0x4c85('0x29')][_0x4c85('0x2a')]};});_0x2cbb5b['model']=_[_0x4c85('0x25')](_0x5bbe5a,'name');_0x2cbb5b[_0x4c85('0x2b')]=_[_0x4c85('0x2c')](_0x4df857[_0x4c85('0x2b')]);_0x2cbb5b[_0x4c85('0x2d')]=_[_0x4c85('0x2e')](_0x2cbb5b[_0x4c85('0x2f')],_0x2cbb5b['query']);_0x17dcce[_0x4c85('0x30')]=_['intersection'](_0x2cbb5b[_0x4c85('0x2f')],qs[_0x4c85('0x31')](_0x4df857[_0x4c85('0x2b')]['fields']));_0x17dcce[_0x4c85('0x30')]=_0x17dcce['attributes'][_0x4c85('0x32')]?_0x17dcce[_0x4c85('0x30')]:_0x2cbb5b[_0x4c85('0x2f')];if(!_0x4df857[_0x4c85('0x2b')][_0x4c85('0x33')](_0x4c85('0x34'))){_0x17dcce[_0x4c85('0x1a')]=qs['limit'](_0x4df857[_0x4c85('0x2b')][_0x4c85('0x1a')]);_0x17dcce['offset']=qs['offset'](_0x4df857[_0x4c85('0x2b')][_0x4c85('0x18')]);}_0x17dcce[_0x4c85('0x35')]=qs['sort'](_0x4df857[_0x4c85('0x2b')][_0x4c85('0x36')]);_0x17dcce['where']=qs[_0x4c85('0x2d')](_[_0x4c85('0x37')](_0x4df857['query'],_0x2cbb5b[_0x4c85('0x2d')]),_0x5bbe5a);if(_0x4df857[_0x4c85('0x2b')][_0x4c85('0x38')]){_0x17dcce[_0x4c85('0x39')]=_[_0x4c85('0x3a')](_0x17dcce[_0x4c85('0x39')],{'$or':_[_0x4c85('0x25')](_0x5bbe5a,function(_0x48b62a){if(_0x48b62a['type']!==_0x4c85('0x3b')){var _0x3561e4={};_0x3561e4[_0x48b62a[_0x4c85('0x23')]]={'$like':'%'+_0x4df857[_0x4c85('0x2b')][_0x4c85('0x38')]+'%'};return _0x3561e4;}})});}_0x17dcce=_[_0x4c85('0x3a')]({},_0x17dcce,_0x4df857['options']);var _0x112408={'where':_0x17dcce[_0x4c85('0x39')]};return db[_0x4c85('0x26')][_0x4c85('0x1b')](_0x112408)[_0x4c85('0x20')](function(_0x339a35){_0x5035d2[_0x4c85('0x1b')]=_0x339a35;if(_0x4df857[_0x4c85('0x2b')][_0x4c85('0x3c')]){_0x17dcce[_0x4c85('0x3d')]=[{'all':!![]}];}return db[_0x4c85('0x26')][_0x4c85('0x3e')](_0x17dcce);})['then'](function(_0x2cba21){_0x5035d2[_0x4c85('0x3f')]=_0x2cba21;return _0x5035d2;})[_0x4c85('0x20')](respondWithFilteredResult(_0x111cb6,_0x17dcce))[_0x4c85('0x40')](handleError(_0x111cb6,null));};exports['show']=function(_0x2ec9e1,_0xbb5d16){var _0x59f256={'raw':!![],'where':{'id':_0x2ec9e1[_0x4c85('0x41')]['id']}},_0xb381f7={};_0xb381f7[_0x4c85('0x2f')]=_[_0x4c85('0x2c')](db[_0x4c85('0x26')][_0x4c85('0x27')]);_0xb381f7[_0x4c85('0x2b')]=_[_0x4c85('0x2c')](_0x2ec9e1[_0x4c85('0x2b')]);_0xb381f7['filters']=_[_0x4c85('0x2e')](_0xb381f7['model'],_0xb381f7[_0x4c85('0x2b')]);_0x59f256['attributes']=_[_0x4c85('0x2e')](_0xb381f7[_0x4c85('0x2f')],qs[_0x4c85('0x31')](_0x2ec9e1['query'][_0x4c85('0x31')]));_0x59f256['attributes']=_0x59f256[_0x4c85('0x30')][_0x4c85('0x32')]?_0x59f256['attributes']:_0xb381f7['model'];if(_0x2ec9e1['query']['includeAll']){_0x59f256[_0x4c85('0x3d')]=[{'all':!![]}];}_0x59f256=_['merge']({},_0x59f256,_0x2ec9e1['options']);return db[_0x4c85('0x26')]['find'](_0x59f256)[_0x4c85('0x20')](handleEntityNotFound(_0xbb5d16,null))[_0x4c85('0x20')](respondWithResult(_0xbb5d16,null))[_0x4c85('0x40')](handleError(_0xbb5d16,null));};exports[_0x4c85('0x42')]=function(_0x47c359,_0x3368b6){return db['FaxTransferReport'][_0x4c85('0x42')](_0x47c359[_0x4c85('0x43')],{})[_0x4c85('0x20')](respondWithResult(_0x3368b6,0xc9))['catch'](handleError(_0x3368b6,null));};exports['update']=function(_0x399dba,_0x37bddf){if(_0x399dba[_0x4c85('0x43')]['id']){delete _0x399dba[_0x4c85('0x43')]['id'];}return db[_0x4c85('0x26')][_0x4c85('0x44')]({'where':{'id':_0x399dba[_0x4c85('0x41')]['id']}})[_0x4c85('0x20')](handleEntityNotFound(_0x37bddf,null))['then'](saveUpdates(_0x399dba['body'],null))['then'](respondWithResult(_0x37bddf,null))['catch'](handleError(_0x37bddf,null));};exports['destroy']=function(_0x10d232,_0x2c9b9e){return db[_0x4c85('0x26')][_0x4c85('0x44')]({'where':{'id':_0x10d232[_0x4c85('0x41')]['id']}})[_0x4c85('0x20')](handleEntityNotFound(_0x2c9b9e,null))[_0x4c85('0x20')](removeEntity(_0x2c9b9e,null))[_0x4c85('0x40')](handleError(_0x2c9b9e,null));};exports[_0x4c85('0x45')]=function(_0x540012,_0x43e0b1){return db[_0x4c85('0x26')][_0x4c85('0x45')]()[_0x4c85('0x20')](respondWithResult(_0x43e0b1,null))['catch'](handleError(_0x43e0b1,null));}; \ No newline at end of file +var _0x136e=['json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','options','includeAll','then','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','end'];(function(_0x5cde8c,_0x2b5812){var _0x3290ed=function(_0x32f1fe){while(--_0x32f1fe){_0x5cde8c['push'](_0x5cde8c['shift']());}};_0x3290ed(++_0x2b5812);}(_0x136e,0x15f));var _0xe136=function(_0x363bf7,_0x483a32){_0x363bf7=_0x363bf7-0x0;var _0x3dd7c7=_0x136e[_0x363bf7];return _0x3dd7c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe136('0x0'));var zipdir=require(_0xe136('0x1'));var jsonpatch=require(_0xe136('0x2'));var rp=require(_0xe136('0x3'));var moment=require(_0xe136('0x4'));var BPromise=require(_0xe136('0x5'));var Mustache=require(_0xe136('0x6'));var util=require(_0xe136('0x7'));var path=require(_0xe136('0x8'));var sox=require(_0xe136('0x9'));var csv=require('to-csv');var ejs=require(_0xe136('0xa'));var fs=require('fs');var fs_extra=require(_0xe136('0xb'));var _=require(_0xe136('0xc'));var squel=require('squel');var crypto=require(_0xe136('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe136('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe136('0xf'));var Papa=require(_0xe136('0x10'));var Redis=require(_0xe136('0x11'));var authService=require(_0xe136('0x12'));var qs=require(_0xe136('0x13'));var as=require(_0xe136('0x14'));var hardwareService=require(_0xe136('0x15'));var logger=require(_0xe136('0x16'))('api');var utils=require(_0xe136('0x17'));var config=require(_0xe136('0x18'));var licenseUtil=require(_0xe136('0x19'));var db=require(_0xe136('0x1a'))['db'];function respondWithStatusCode(_0x39527d,_0xbc0217){_0xbc0217=_0xbc0217||0xcc;return function(_0x50e594){if(_0x50e594){return _0x39527d[_0xe136('0x1b')](_0xbc0217);}return _0x39527d['status'](_0xbc0217)[_0xe136('0x1c')]();};}function respondWithResult(_0x409ab3,_0x3705df){_0x3705df=_0x3705df||0xc8;return function(_0x3b5955){if(_0x3b5955){return _0x409ab3['status'](_0x3705df)[_0xe136('0x1d')](_0x3b5955);}};}function respondWithFilteredResult(_0x1348ac,_0x5ca709){return function(_0x36822c){if(_0x36822c){var _0x3353d4=typeof _0x5ca709[_0xe136('0x1e')]===_0xe136('0x1f')&&typeof _0x5ca709[_0xe136('0x20')]===_0xe136('0x1f');var _0x1df5c4=_0x36822c['count'];var _0x4dd456=_0x3353d4?0x0:_0x5ca709[_0xe136('0x1e')];var _0x12d006=_0x3353d4?_0x36822c[_0xe136('0x21')]:_0x5ca709[_0xe136('0x1e')]+_0x5ca709[_0xe136('0x20')];var _0x42156e;if(_0x12d006>=_0x1df5c4){_0x12d006=_0x1df5c4;_0x42156e=0xc8;}else{_0x42156e=0xce;}_0x1348ac[_0xe136('0x22')](_0x42156e);return _0x1348ac[_0xe136('0x23')](_0xe136('0x24'),_0x4dd456+'-'+_0x12d006+'/'+_0x1df5c4)[_0xe136('0x1d')](_0x36822c);}return null;};}function patchUpdates(_0x298903){return function(_0x52de26){try{jsonpatch['apply'](_0x52de26,_0x298903,!![]);}catch(_0x82d15f){return BPromise[_0xe136('0x25')](_0x82d15f);}return _0x52de26[_0xe136('0x26')]();};}function saveUpdates(_0x448cc2,_0xf5e16b){return function(_0x33247f){if(_0x33247f){return _0x33247f[_0xe136('0x27')](_0x448cc2)['then'](function(_0x5b5bfa){return _0x5b5bfa;});}return null;};}function removeEntity(_0xfd627,_0x413f92){return function(_0x5bb3a1){if(_0x5bb3a1){return _0x5bb3a1[_0xe136('0x28')]()['then'](function(){_0xfd627[_0xe136('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x358f55,_0x1d90fe){return function(_0x565922){if(!_0x565922){_0x358f55[_0xe136('0x1b')](0x194);}return _0x565922;};}function handleError(_0x154b4f,_0x2e2951){_0x2e2951=_0x2e2951||0x1f4;return function(_0x1b20f2){logger['error'](_0x1b20f2[_0xe136('0x29')]);if(_0x1b20f2['name']){delete _0x1b20f2['name'];}_0x154b4f['status'](_0x2e2951)[_0xe136('0x2a')](_0x1b20f2);};}exports[_0xe136('0x2b')]=function(_0x3dbe00,_0x302b05){var _0x243f0a={},_0xcd0f34={},_0x5d90f6={'count':0x0,'rows':[]};var _0x3ab77b=_[_0xe136('0x2c')](db[_0xe136('0x2d')][_0xe136('0x2e')],function(_0x6b77b9){return{'name':_0x6b77b9[_0xe136('0x2f')],'type':_0x6b77b9[_0xe136('0x30')]['key']};});_0xcd0f34[_0xe136('0x31')]=_[_0xe136('0x2c')](_0x3ab77b,'name');_0xcd0f34[_0xe136('0x32')]=_[_0xe136('0x33')](_0x3dbe00[_0xe136('0x32')]);_0xcd0f34[_0xe136('0x34')]=_[_0xe136('0x35')](_0xcd0f34[_0xe136('0x31')],_0xcd0f34[_0xe136('0x32')]);_0x243f0a['attributes']=_[_0xe136('0x35')](_0xcd0f34[_0xe136('0x31')],qs['fields'](_0x3dbe00[_0xe136('0x32')][_0xe136('0x36')]));_0x243f0a[_0xe136('0x37')]=_0x243f0a[_0xe136('0x37')]['length']?_0x243f0a[_0xe136('0x37')]:_0xcd0f34[_0xe136('0x31')];if(!_0x3dbe00[_0xe136('0x32')][_0xe136('0x38')]('nolimit')){_0x243f0a[_0xe136('0x20')]=qs[_0xe136('0x20')](_0x3dbe00[_0xe136('0x32')][_0xe136('0x20')]);_0x243f0a[_0xe136('0x1e')]=qs[_0xe136('0x1e')](_0x3dbe00['query'][_0xe136('0x1e')]);}_0x243f0a[_0xe136('0x39')]=qs[_0xe136('0x3a')](_0x3dbe00[_0xe136('0x32')][_0xe136('0x3a')]);_0x243f0a[_0xe136('0x3b')]=qs[_0xe136('0x34')](_[_0xe136('0x3c')](_0x3dbe00[_0xe136('0x32')],_0xcd0f34[_0xe136('0x34')]),_0x3ab77b);if(_0x3dbe00['query'][_0xe136('0x3d')]){_0x243f0a[_0xe136('0x3b')]=_['merge'](_0x243f0a['where'],{'$or':_[_0xe136('0x2c')](_0x3ab77b,function(_0x36fd5d){if(_0x36fd5d['type']!==_0xe136('0x3e')){var _0xac0082={};_0xac0082[_0x36fd5d[_0xe136('0x3f')]]={'$like':'%'+_0x3dbe00[_0xe136('0x32')]['filter']+'%'};return _0xac0082;}})});}_0x243f0a=_['merge']({},_0x243f0a,_0x3dbe00[_0xe136('0x40')]);var _0x2ff071={'where':_0x243f0a['where']};return db[_0xe136('0x2d')][_0xe136('0x21')](_0x2ff071)['then'](function(_0x1a19e6){_0x5d90f6[_0xe136('0x21')]=_0x1a19e6;if(_0x3dbe00[_0xe136('0x32')][_0xe136('0x41')]){_0x243f0a['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x243f0a);})[_0xe136('0x42')](function(_0xdb05f2){_0x5d90f6[_0xe136('0x43')]=_0xdb05f2;return _0x5d90f6;})[_0xe136('0x42')](respondWithFilteredResult(_0x302b05,_0x243f0a))[_0xe136('0x44')](handleError(_0x302b05,null));};exports[_0xe136('0x45')]=function(_0x141b8e,_0x1fcbcb){var _0xb91872={'raw':!![],'where':{'id':_0x141b8e[_0xe136('0x46')]['id']}},_0x507cad={};_0x507cad[_0xe136('0x31')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x507cad[_0xe136('0x32')]=_[_0xe136('0x33')](_0x141b8e['query']);_0x507cad['filters']=_[_0xe136('0x35')](_0x507cad['model'],_0x507cad[_0xe136('0x32')]);_0xb91872[_0xe136('0x37')]=_['intersection'](_0x507cad['model'],qs[_0xe136('0x36')](_0x141b8e[_0xe136('0x32')][_0xe136('0x36')]));_0xb91872[_0xe136('0x37')]=_0xb91872[_0xe136('0x37')][_0xe136('0x47')]?_0xb91872[_0xe136('0x37')]:_0x507cad[_0xe136('0x31')];if(_0x141b8e[_0xe136('0x32')][_0xe136('0x41')]){_0xb91872['include']=[{'all':!![]}];}_0xb91872=_['merge']({},_0xb91872,_0x141b8e['options']);return db[_0xe136('0x2d')][_0xe136('0x48')](_0xb91872)[_0xe136('0x42')](handleEntityNotFound(_0x1fcbcb,null))[_0xe136('0x42')](respondWithResult(_0x1fcbcb,null))[_0xe136('0x44')](handleError(_0x1fcbcb,null));};exports[_0xe136('0x49')]=function(_0x503b0a,_0x5011f8){return db[_0xe136('0x2d')][_0xe136('0x49')](_0x503b0a[_0xe136('0x4a')],{})['then'](respondWithResult(_0x5011f8,0xc9))['catch'](handleError(_0x5011f8,null));};exports[_0xe136('0x27')]=function(_0x3e85af,_0x15e40e){if(_0x3e85af[_0xe136('0x4a')]['id']){delete _0x3e85af[_0xe136('0x4a')]['id'];}return db['FaxTransferReport'][_0xe136('0x48')]({'where':{'id':_0x3e85af[_0xe136('0x46')]['id']}})[_0xe136('0x42')](handleEntityNotFound(_0x15e40e,null))['then'](saveUpdates(_0x3e85af[_0xe136('0x4a')],null))[_0xe136('0x42')](respondWithResult(_0x15e40e,null))[_0xe136('0x44')](handleError(_0x15e40e,null));};exports[_0xe136('0x28')]=function(_0x1906ce,_0x5627e4){return db['FaxTransferReport']['find']({'where':{'id':_0x1906ce[_0xe136('0x46')]['id']}})['then'](handleEntityNotFound(_0x5627e4,null))[_0xe136('0x42')](removeEntity(_0x5627e4,null))[_0xe136('0x44')](handleError(_0x5627e4,null));};exports[_0xe136('0x4b')]=function(_0x54aff6,_0x3bd877){return db[_0xe136('0x2d')][_0xe136('0x4b')]()['then'](respondWithResult(_0x3bd877,null))['catch'](handleError(_0x3bd877,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3a91dbd..10ad56b 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 _0x17fa=['util','../../config/logger','request-promise','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x258c1b,_0x512728){var _0x25a846=function(_0x4075a7){while(--_0x4075a7){_0x258c1b['push'](_0x258c1b['shift']());}};_0x25a846(++_0x512728);}(_0x17fa,0x190));var _0xa17f=function(_0x13b499,_0x5e65b0){_0x13b499=_0x13b499-0x0;var _0x38bf6c=_0x17fa[_0x13b499];return _0x38bf6c;};'use strict';var _=require('lodash');var util=require(_0xa17f('0x0'));var logger=require(_0xa17f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa17f('0x2'));var fs=require('fs');var path=require(_0xa17f('0x3'));var rimraf=require(_0xa17f('0x4'));var config=require('../../config/environment');var attributes=require(_0xa17f('0x5'));module[_0xa17f('0x6')]=function(_0x319623,_0x5737a0){return _0x319623['define'](_0xa17f('0x7'),attributes,{'tableName':_0xa17f('0x8'),'paranoid':![],'indexes':[{'name':_0xa17f('0x9'),'fields':[_0xa17f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9b4=['rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2c1439,_0x5a9bb4){var _0x4c9e68=function(_0x41b722){while(--_0x41b722){_0x2c1439['push'](_0x2c1439['shift']());}};_0x4c9e68(++_0x5a9bb4);}(_0xe9b4,0x1f1));var _0x4e9b=function(_0x3c627b,_0x5085bb){_0x3c627b=_0x3c627b-0x0;var _0x5dde2c=_0xe9b4[_0x3c627b];return _0x5dde2c;};'use strict';var _=require('lodash');var util=require(_0x4e9b('0x0'));var logger=require(_0x4e9b('0x1'))(_0x4e9b('0x2'));var moment=require(_0x4e9b('0x3'));var BPromise=require(_0x4e9b('0x4'));var rp=require(_0x4e9b('0x5'));var fs=require('fs');var path=require(_0x4e9b('0x6'));var rimraf=require(_0x4e9b('0x7'));var config=require(_0x4e9b('0x8'));var attributes=require(_0x4e9b('0x9'));module[_0x4e9b('0xa')]=function(_0xa7cd01,_0x5d063b){return _0xa7cd01['define'](_0x4e9b('0xb'),attributes,{'tableName':_0x4e9b('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4e9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c522455..83e94a7 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 _0x8ae5=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x380b7d,_0xbc0704){var _0x2cfa93=function(_0x264d3d){while(--_0x264d3d){_0x380b7d['push'](_0x380b7d['shift']());}};_0x2cfa93(++_0xbc0704);}(_0x8ae5,0x1ac));var _0x58ae=function(_0x3a16d8,_0x165f1e){_0x3a16d8=_0x3a16d8-0x0;var _0x292ef0=_0x8ae5[_0x3a16d8];return _0x292ef0;};'use strict';var _=require(_0x58ae('0x0'));var util=require(_0x58ae('0x1'));var moment=require('moment');var BPromise=require(_0x58ae('0x2'));var rs=require(_0x58ae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x58ae('0x5'))(_0x58ae('0x6'));var config=require(_0x58ae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x58ae('0x8')][_0x58ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ce492,_0x585d48,_0x4f89b0){return new BPromise(function(_0x1573f3,_0x49f8e0){return client[_0x58ae('0xa')](_0x4ce492,_0x4f89b0)[_0x58ae('0xb')](function(_0x1b8498){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x585d48,_0x58ae('0xc'));logger[_0x58ae('0xd')](_0x58ae('0xe'),_0x585d48,_0x58ae('0xc'),JSON['stringify'](_0x1b8498));if(_0x1b8498['error']){if(_0x1b8498[_0x58ae('0xf')][_0x58ae('0x10')]===0x1f4){logger[_0x58ae('0xf')](_0x58ae('0x11'),_0x585d48,_0x1b8498[_0x58ae('0xf')][_0x58ae('0x12')]);return _0x49f8e0(_0x1b8498[_0x58ae('0xf')][_0x58ae('0x12')]);}logger[_0x58ae('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x585d48,_0x1b8498[_0x58ae('0xf')][_0x58ae('0x12')]);return _0x1573f3(_0x1b8498[_0x58ae('0xf')]['message']);}else{logger['info'](_0x58ae('0x11'),_0x585d48,_0x58ae('0xc'));_0x1573f3(_0x1b8498[_0x58ae('0x13')][_0x58ae('0x12')]);}})['catch'](function(_0x30d23e){logger['error'](_0x58ae('0x11'),_0x585d48,_0x30d23e);_0x49f8e0(_0x30d23e);});});} \ No newline at end of file +var _0x010e=['bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','message','FaxTransferReport,\x20%s,\x20%s','lodash','util','moment'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x010e,0x179));var _0xe010=function(_0x3ce907,_0x5851f0){_0x3ce907=_0x3ce907-0x0;var _0xbc9d48=_0x010e[_0x3ce907];return _0xbc9d48;};'use strict';var _=require(_0xe010('0x0'));var util=require(_0xe010('0x1'));var moment=require(_0xe010('0x2'));var BPromise=require(_0xe010('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe010('0x4'))['db'];var utils=require(_0xe010('0x5'));var logger=require('../../config/logger')(_0xe010('0x6'));var config=require(_0xe010('0x7'));var jayson=require(_0xe010('0x8'));var client=jayson[_0xe010('0x9')][_0xe010('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e2fd9,_0x72d908,_0xf9809a){return new BPromise(function(_0x5dc675,_0x1e1ef9){return client[_0xe010('0xb')](_0x4e2fd9,_0xf9809a)['then'](function(_0x427b1e){logger[_0xe010('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x72d908,'request\x20sent');logger[_0xe010('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x72d908,_0xe010('0xe'),JSON[_0xe010('0xf')](_0x427b1e));if(_0x427b1e[_0xe010('0x10')]){if(_0x427b1e[_0xe010('0x10')]['code']===0x1f4){logger[_0xe010('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x72d908,_0x427b1e['error'][_0xe010('0x11')]);return _0x1e1ef9(_0x427b1e[_0xe010('0x10')][_0xe010('0x11')]);}logger[_0xe010('0x10')](_0xe010('0x12'),_0x72d908,_0x427b1e[_0xe010('0x10')][_0xe010('0x11')]);return _0x5dc675(_0x427b1e[_0xe010('0x10')][_0xe010('0x11')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x72d908,_0xe010('0xe'));_0x5dc675(_0x427b1e['result'][_0xe010('0x11')]);}})['catch'](function(_0x1194dc){logger['error'](_0xe010('0x12'),_0x72d908,_0x1194dc);_0x1e1ef9(_0x1194dc);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a1fb52e..218a6d8 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 _0x7336=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x309cbc,_0x543e8f){var _0x2ac832=function(_0xfe43bc){while(--_0xfe43bc){_0x309cbc['push'](_0x309cbc['shift']());}};_0x2ac832(++_0x543e8f);}(_0x7336,0x17c));var _0x6733=function(_0x2594ad,_0x2d04f1){_0x2594ad=_0x2594ad-0x0;var _0x29045e=_0x7336[_0x2594ad];return _0x29045e;};'use strict';var multer=require('multer');var util=require(_0x6733('0x0'));var path=require(_0x6733('0x1'));var timeout=require(_0x6733('0x2'));var express=require(_0x6733('0x3'));var router=express['Router']();var fs_extra=require(_0x6733('0x4'));var auth=require(_0x6733('0x5'));var interaction=require(_0x6733('0x6'));var config=require(_0x6733('0x7'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x6733('0x8')](),controller['index']);router[_0x6733('0x9')](_0x6733('0xa'),auth[_0x6733('0x8')](),controller[_0x6733('0xb')]);router[_0x6733('0x9')](_0x6733('0xc'),auth['isAuthenticated'](),controller[_0x6733('0xd')]);router[_0x6733('0xe')]('/',auth[_0x6733('0x8')](),controller['create']);router[_0x6733('0xf')](_0x6733('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6733('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6733('0x11')]);module[_0x6733('0x12')]=router; \ No newline at end of file +var _0xad9d=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0xad9d,0x17a));var _0xdad9=function(_0x512c12,_0x2900d6){_0x512c12=_0x512c12-0x0;var _0x4b7ff9=_0xad9d[_0x512c12];return _0x4b7ff9;};'use strict';var multer=require(_0xdad9('0x0'));var util=require(_0xdad9('0x1'));var path=require('path');var timeout=require(_0xdad9('0x2'));var express=require(_0xdad9('0x3'));var router=express[_0xdad9('0x4')]();var fs_extra=require(_0xdad9('0x5'));var auth=require(_0xdad9('0x6'));var interaction=require(_0xdad9('0x7'));var config=require(_0xdad9('0x8'));var controller=require(_0xdad9('0x9'));router[_0xdad9('0xa')]('/',auth['isAuthenticated'](),controller[_0xdad9('0xb')]);router[_0xdad9('0xa')](_0xdad9('0xc'),auth[_0xdad9('0xd')](),controller[_0xdad9('0xe')]);router[_0xdad9('0xa')](_0xdad9('0xf'),auth['isAuthenticated'](),controller[_0xdad9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdad9('0x11')]('/:id',auth[_0xdad9('0xd')](),controller[_0xdad9('0x12')]);router[_0xdad9('0x13')](_0xdad9('0xf'),auth[_0xdad9('0xd')](),controller[_0xdad9('0x14')]);module[_0xdad9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a6c277b..1093252 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 _0x53a1=['./intDeskAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x24bc1e,_0x14de05){var _0x4fcbe9=function(_0x2ed7d3){while(--_0x2ed7d3){_0x24bc1e['push'](_0x24bc1e['shift']());}};_0x4fcbe9(++_0x14de05);}(_0x53a1,0x77));var _0x153a=function(_0x572613,_0x39eb0f){_0x572613=_0x572613-0x0;var _0x1afa69=_0x53a1[_0x572613];return _0x1afa69;};'use strict';var multer=require(_0x153a('0x0'));var util=require(_0x153a('0x1'));var path=require(_0x153a('0x2'));var timeout=require(_0x153a('0x3'));var express=require(_0x153a('0x4'));var router=express[_0x153a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x153a('0x6'));var controller=require(_0x153a('0x7'));router[_0x153a('0x8')]('/',auth[_0x153a('0x9')](),controller['index']);router[_0x153a('0x8')](_0x153a('0xa'),auth['isAuthenticated'](),controller[_0x153a('0xb')]);router[_0x153a('0x8')]('/:id/configurations',auth[_0x153a('0x9')](),controller[_0x153a('0xc')]);router[_0x153a('0x8')](_0x153a('0xd'),auth[_0x153a('0x9')](),controller[_0x153a('0xe')]);router['post']('/',auth[_0x153a('0x9')](),controller[_0x153a('0xf')]);router[_0x153a('0x10')]('/:id/configurations',auth[_0x153a('0x9')](),controller[_0x153a('0x11')]);router[_0x153a('0x12')](_0x153a('0xa'),auth[_0x153a('0x9')](),controller['update']);router[_0x153a('0x13')](_0x153a('0xa'),auth[_0x153a('0x9')](),controller['destroy']);module[_0x153a('0x14')]=router; \ No newline at end of file +var _0x02fd=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x02fd,0x1ad));var _0xd02f=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x02fd[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0xd02f('0x0'));var util=require(_0xd02f('0x1'));var path=require(_0xd02f('0x2'));var timeout=require(_0xd02f('0x3'));var express=require(_0xd02f('0x4'));var router=express['Router']();var fs_extra=require(_0xd02f('0x5'));var auth=require(_0xd02f('0x6'));var interaction=require(_0xd02f('0x7'));var config=require('../../config/environment');var controller=require(_0xd02f('0x8'));router[_0xd02f('0x9')]('/',auth[_0xd02f('0xa')](),controller[_0xd02f('0xb')]);router['get'](_0xd02f('0xc'),auth[_0xd02f('0xa')](),controller[_0xd02f('0xd')]);router[_0xd02f('0x9')](_0xd02f('0xe'),auth[_0xd02f('0xa')](),controller[_0xd02f('0xf')]);router[_0xd02f('0x9')](_0xd02f('0x10'),auth[_0xd02f('0xa')](),controller['getFields']);router[_0xd02f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd02f('0x11')](_0xd02f('0xe'),auth[_0xd02f('0xa')](),controller[_0xd02f('0x12')]);router['put']('/:id',auth[_0xd02f('0xa')](),controller['update']);router[_0xd02f('0x13')](_0xd02f('0xc'),auth[_0xd02f('0xa')](),controller[_0xd02f('0x14')]);module[_0xd02f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 881ab2f..389b608 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 _0xd35d=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x3111cf,_0x1b4cd2){var _0x193cae=function(_0x1608bf){while(--_0x1608bf){_0x3111cf['push'](_0x3111cf['shift']());}};_0x193cae(++_0x1b4cd2);}(_0xd35d,0x74));var _0xdd35=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0xd35d[_0x310d10];return _0x1fb8af;};'use strict';var Sequelize=require(_0xdd35('0x0'));module[_0xdd35('0x1')]={'name':{'type':Sequelize[_0xdd35('0x2')]},'description':{'type':Sequelize[_0xdd35('0x2')]},'username':{'type':Sequelize[_0xdd35('0x2')]},'remoteUri':{'type':Sequelize[_0xdd35('0x2')]},'authType':{'type':Sequelize[_0xdd35('0x3')](_0xdd35('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xdd35('0x2')]},'consumerKey':{'type':Sequelize[_0xdd35('0x2')]},'consumerSecret':{'type':Sequelize[_0xdd35('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xdd35('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdd35('0x5'),_0xdd35('0x6')),'defaultValue':_0xdd35('0x5')}}; \ No newline at end of file +var _0xe688=['STRING','basic','ENUM','integrationTab','exports'];(function(_0x577aed,_0x4aeebe){var _0xb0b00b=function(_0x3c987a){while(--_0x3c987a){_0x577aed['push'](_0x577aed['shift']());}};_0xb0b00b(++_0x4aeebe);}(_0xe688,0x130));var _0x8e68=function(_0x1a7037,_0x200862){_0x1a7037=_0x1a7037-0x0;var _0x5971c8=_0xe688[_0x1a7037];return _0x5971c8;};'use strict';var Sequelize=require('sequelize');module[_0x8e68('0x0')]={'name':{'type':Sequelize[_0x8e68('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8e68('0x1')]},'remoteUri':{'type':Sequelize[_0x8e68('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x8e68('0x2')),'defaultValue':_0x8e68('0x2')},'password':{'type':Sequelize[_0x8e68('0x1')]},'consumerKey':{'type':Sequelize[_0x8e68('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x8e68('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8e68('0x3')](_0x8e68('0x4'),'newTab'),'defaultValue':_0x8e68('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b999d95..6464dd2 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 _0x6c90=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','error','name','index','map','DeskAccount','rawAttributes','fieldName'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x6c90,0xba));var _0x06c9=function(_0x5bf4fe,_0x4b762b){_0x5bf4fe=_0x5bf4fe-0x0;var _0x1a5848=_0x6c90[_0x5bf4fe];return _0x1a5848;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06c9('0x1'));var rp=require(_0x06c9('0x2'));var moment=require(_0x06c9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x06c9('0x4'));var path=require(_0x06c9('0x5'));var sox=require(_0x06c9('0x6'));var csv=require('to-csv');var ejs=require(_0x06c9('0x7'));var fs=require('fs');var fs_extra=require(_0x06c9('0x8'));var _=require(_0x06c9('0x9'));var squel=require(_0x06c9('0xa'));var crypto=require(_0x06c9('0xb'));var jsforce=require(_0x06c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x06c9('0xd'));var querystring=require(_0x06c9('0xe'));var Papa=require(_0x06c9('0xf'));var Redis=require(_0x06c9('0x10'));var authService=require(_0x06c9('0x11'));var qs=require(_0x06c9('0x12'));var as=require(_0x06c9('0x13'));var hardwareService=require(_0x06c9('0x14'));var logger=require(_0x06c9('0x15'))(_0x06c9('0x16'));var utils=require(_0x06c9('0x17'));var config=require(_0x06c9('0x18'));var licenseUtil=require(_0x06c9('0x19'));var db=require(_0x06c9('0x1a'))['db'];var integrations=require(_0x06c9('0x1b'));function respondWithStatusCode(_0x2a9d8e,_0x1be887){_0x1be887=_0x1be887||0xcc;return function(_0x97e7ca){if(_0x97e7ca){return _0x2a9d8e[_0x06c9('0x1c')](_0x1be887);}return _0x2a9d8e[_0x06c9('0x1d')](_0x1be887)[_0x06c9('0x1e')]();};}function respondWithResult(_0xd8b171,_0x451a3f){_0x451a3f=_0x451a3f||0xc8;return function(_0x58a88e){if(_0x58a88e){return _0xd8b171['status'](_0x451a3f)[_0x06c9('0x1f')](_0x58a88e);}};}function respondWithFilteredResult(_0x3fc46e,_0x525839){return function(_0x48cd41){if(_0x48cd41){var _0x42f85e=typeof _0x525839['offset']===_0x06c9('0x20')&&typeof _0x525839[_0x06c9('0x21')]==='undefined';var _0x2fd7ce=_0x48cd41[_0x06c9('0x22')];var _0x48baed=_0x42f85e?0x0:_0x525839['offset'];var _0x5ecebf=_0x42f85e?_0x48cd41[_0x06c9('0x22')]:_0x525839[_0x06c9('0x23')]+_0x525839[_0x06c9('0x21')];var _0x109ad3;if(_0x5ecebf>=_0x2fd7ce){_0x5ecebf=_0x2fd7ce;_0x109ad3=0xc8;}else{_0x109ad3=0xce;}_0x3fc46e[_0x06c9('0x1d')](_0x109ad3);return _0x3fc46e['set'](_0x06c9('0x24'),_0x48baed+'-'+_0x5ecebf+'/'+_0x2fd7ce)[_0x06c9('0x1f')](_0x48cd41);}return null;};}function patchUpdates(_0x317f95){return function(_0x3610b9){try{jsonpatch[_0x06c9('0x25')](_0x3610b9,_0x317f95,!![]);}catch(_0x1beca1){return BPromise['reject'](_0x1beca1);}return _0x3610b9[_0x06c9('0x26')]();};}function saveUpdates(_0x25186e,_0x294c4f){return function(_0x3d5a49){if(_0x3d5a49){return _0x3d5a49['update'](_0x25186e)[_0x06c9('0x27')](function(_0x484f30){return _0x484f30;});}return null;};}function removeEntity(_0x2353a4,_0x1bde57){return function(_0x44a00f){if(_0x44a00f){return _0x44a00f[_0x06c9('0x28')]()[_0x06c9('0x27')](function(){_0x2353a4[_0x06c9('0x1d')](0xcc)[_0x06c9('0x1e')]();});}};}function handleEntityNotFound(_0x5bf285,_0x5a1d1a){return function(_0x32007d){if(!_0x32007d){_0x5bf285[_0x06c9('0x1c')](0x194);}return _0x32007d;};}function handleError(_0x3fc80a,_0x4ea354){_0x4ea354=_0x4ea354||0x1f4;return function(_0x11c0f0){logger[_0x06c9('0x29')](_0x11c0f0['stack']);if(_0x11c0f0[_0x06c9('0x2a')]){delete _0x11c0f0[_0x06c9('0x2a')];}_0x3fc80a['status'](_0x4ea354)['send'](_0x11c0f0);};}exports[_0x06c9('0x2b')]=function(_0x5dd3cf,_0x367329){var _0x9ad89c={},_0x328301={},_0x5b7bcb={'count':0x0,'rows':[]};var _0x3445ff=_[_0x06c9('0x2c')](db[_0x06c9('0x2d')][_0x06c9('0x2e')],function(_0x3541cb){return{'name':_0x3541cb[_0x06c9('0x2f')],'type':_0x3541cb[_0x06c9('0x30')][_0x06c9('0x31')]};});_0x328301[_0x06c9('0x32')]=_[_0x06c9('0x2c')](_0x3445ff,'name');_0x328301[_0x06c9('0x33')]=_[_0x06c9('0x34')](_0x5dd3cf[_0x06c9('0x33')]);_0x328301[_0x06c9('0x35')]=_[_0x06c9('0x36')](_0x328301['model'],_0x328301[_0x06c9('0x33')]);_0x9ad89c[_0x06c9('0x37')]=_[_0x06c9('0x36')](_0x328301[_0x06c9('0x32')],qs[_0x06c9('0x38')](_0x5dd3cf['query'][_0x06c9('0x38')]));_0x9ad89c[_0x06c9('0x37')]=_0x9ad89c['attributes'][_0x06c9('0x39')]?_0x9ad89c[_0x06c9('0x37')]:_0x328301['model'];if(!_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x3a')](_0x06c9('0x3b'))){_0x9ad89c[_0x06c9('0x21')]=qs[_0x06c9('0x21')](_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x21')]);_0x9ad89c[_0x06c9('0x23')]=qs[_0x06c9('0x23')](_0x5dd3cf['query'][_0x06c9('0x23')]);}_0x9ad89c['order']=qs[_0x06c9('0x3c')](_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x3c')]);_0x9ad89c[_0x06c9('0x3d')]=qs['filters'](_[_0x06c9('0x3e')](_0x5dd3cf[_0x06c9('0x33')],_0x328301[_0x06c9('0x35')]),_0x3445ff);if(_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x3f')]){_0x9ad89c[_0x06c9('0x3d')]=_[_0x06c9('0x40')](_0x9ad89c[_0x06c9('0x3d')],{'$or':_['map'](_0x3445ff,function(_0x197e6f){if(_0x197e6f[_0x06c9('0x30')]!=='VIRTUAL'){var _0xdbad99={};_0xdbad99[_0x197e6f['name']]={'$like':'%'+_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x3f')]+'%'};return _0xdbad99;}})});}_0x9ad89c=_[_0x06c9('0x40')]({},_0x9ad89c,_0x5dd3cf[_0x06c9('0x41')]);var _0x36aa44={'where':_0x9ad89c['where']};return db['DeskAccount'][_0x06c9('0x22')](_0x36aa44)[_0x06c9('0x27')](function(_0x4142ae){_0x5b7bcb[_0x06c9('0x22')]=_0x4142ae;if(_0x5dd3cf[_0x06c9('0x33')][_0x06c9('0x42')]){_0x9ad89c[_0x06c9('0x43')]=[{'all':!![]}];}return db[_0x06c9('0x2d')][_0x06c9('0x44')](_0x9ad89c);})[_0x06c9('0x27')](function(_0x4c2e96){_0x5b7bcb[_0x06c9('0x45')]=_0x4c2e96;return _0x5b7bcb;})[_0x06c9('0x27')](respondWithFilteredResult(_0x367329,_0x9ad89c))[_0x06c9('0x46')](handleError(_0x367329,null));};exports[_0x06c9('0x47')]=function(_0x179428,_0x3903ba){var _0x249bd0={'raw':![],'where':{'id':_0x179428[_0x06c9('0x48')]['id']}},_0x3e261a={};_0x3e261a[_0x06c9('0x32')]=_[_0x06c9('0x34')](db[_0x06c9('0x2d')]['rawAttributes']);_0x3e261a[_0x06c9('0x33')]=_[_0x06c9('0x34')](_0x179428[_0x06c9('0x33')]);_0x3e261a[_0x06c9('0x35')]=_[_0x06c9('0x36')](_0x3e261a['model'],_0x3e261a['query']);_0x249bd0[_0x06c9('0x37')]=_[_0x06c9('0x36')](_0x3e261a[_0x06c9('0x32')],qs[_0x06c9('0x38')](_0x179428[_0x06c9('0x33')]['fields']));_0x249bd0[_0x06c9('0x37')]=_0x249bd0[_0x06c9('0x37')][_0x06c9('0x39')]?_0x249bd0[_0x06c9('0x37')]:_0x3e261a[_0x06c9('0x32')];if(_0x179428[_0x06c9('0x33')]['includeAll']){_0x249bd0[_0x06c9('0x43')]=[{'all':!![]}];}_0x249bd0=_['merge']({},_0x249bd0,_0x179428[_0x06c9('0x41')]);return db[_0x06c9('0x2d')]['find'](_0x249bd0)[_0x06c9('0x27')](handleEntityNotFound(_0x3903ba,null))[_0x06c9('0x27')](respondWithResult(_0x3903ba,null))[_0x06c9('0x46')](handleError(_0x3903ba,null));};exports[_0x06c9('0x49')]=function(_0x930c0,_0x4705d4){return db['DeskAccount'][_0x06c9('0x49')](_0x930c0[_0x06c9('0x4a')],{})[_0x06c9('0x27')](respondWithResult(_0x4705d4,0xc9))[_0x06c9('0x46')](handleError(_0x4705d4,null));};exports[_0x06c9('0x4b')]=function(_0xe0b1f2,_0x2ece01){if(_0xe0b1f2[_0x06c9('0x4a')]['id']){delete _0xe0b1f2[_0x06c9('0x4a')]['id'];}return db[_0x06c9('0x2d')]['find']({'where':{'id':_0xe0b1f2['params']['id']}})['then'](handleEntityNotFound(_0x2ece01,null))[_0x06c9('0x27')](saveUpdates(_0xe0b1f2['body'],null))[_0x06c9('0x27')](respondWithResult(_0x2ece01,null))[_0x06c9('0x46')](handleError(_0x2ece01,null));};exports[_0x06c9('0x28')]=function(_0x3bf346,_0xad0e84){return db['DeskAccount'][_0x06c9('0x4c')]({'where':{'id':_0x3bf346['params']['id']}})[_0x06c9('0x27')](handleEntityNotFound(_0xad0e84,null))[_0x06c9('0x27')](removeEntity(_0xad0e84,null))['catch'](handleError(_0xad0e84,null));};exports[_0x06c9('0x4d')]=function(_0x38b57c,_0x329bb4,_0x407f1b){var _0xa9a20a={};var _0x10af5a={};var _0x5c7b60;var _0x4bf2b1;return db[_0x06c9('0x2d')][_0x06c9('0x4e')]({'where':{'id':_0x38b57c[_0x06c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x329bb4,null))[_0x06c9('0x27')](function(_0x14d6ff){if(_0x14d6ff){_0x5c7b60=_0x14d6ff;_0x10af5a[_0x06c9('0x32')]=_[_0x06c9('0x34')](db[_0x06c9('0x4f')][_0x06c9('0x2e')]);_0x10af5a[_0x06c9('0x33')]=_[_0x06c9('0x34')](_0x38b57c[_0x06c9('0x33')]);_0x10af5a[_0x06c9('0x35')]=_[_0x06c9('0x36')](_0x10af5a[_0x06c9('0x32')],_0x10af5a[_0x06c9('0x33')]);_0xa9a20a[_0x06c9('0x37')]=_[_0x06c9('0x36')](_0x10af5a[_0x06c9('0x32')],qs[_0x06c9('0x38')](_0x38b57c[_0x06c9('0x33')][_0x06c9('0x38')]));_0xa9a20a[_0x06c9('0x37')]=_0xa9a20a[_0x06c9('0x37')][_0x06c9('0x39')]?_0xa9a20a[_0x06c9('0x37')]:_0x10af5a['model'];_0xa9a20a[_0x06c9('0x50')]=qs['sort'](_0x38b57c[_0x06c9('0x33')][_0x06c9('0x3c')]);_0xa9a20a[_0x06c9('0x3d')]=qs[_0x06c9('0x35')](_[_0x06c9('0x3e')](_0x38b57c[_0x06c9('0x33')],_0x10af5a['filters']));if(_0x38b57c['query'][_0x06c9('0x3f')]){_0xa9a20a[_0x06c9('0x3d')]=_['merge'](_0xa9a20a[_0x06c9('0x3d')],{'$or':_[_0x06c9('0x2c')](_0xa9a20a['attributes'],function(_0x5aad6e){var _0x34d2fb={};_0x34d2fb[_0x5aad6e]={'$like':'%'+_0x38b57c[_0x06c9('0x33')][_0x06c9('0x3f')]+'%'};return _0x34d2fb;})});}_0xa9a20a=_[_0x06c9('0x40')]({},_0xa9a20a,_0x38b57c[_0x06c9('0x41')]);return _0x5c7b60[_0x06c9('0x4d')](_0xa9a20a);}})[_0x06c9('0x27')](function(_0x24003a){if(_0x24003a){_0x4bf2b1=_0x24003a[_0x06c9('0x39')];if(!_0x38b57c[_0x06c9('0x33')][_0x06c9('0x3a')](_0x06c9('0x3b'))){_0xa9a20a[_0x06c9('0x21')]=qs['limit'](_0x38b57c[_0x06c9('0x33')]['limit']);_0xa9a20a[_0x06c9('0x23')]=qs['offset'](_0x38b57c[_0x06c9('0x33')][_0x06c9('0x23')]);}return _0x5c7b60[_0x06c9('0x4d')](_0xa9a20a);}})[_0x06c9('0x27')](function(_0x1b1ba6){if(_0x1b1ba6){return _0x1b1ba6?{'count':_0x4bf2b1,'rows':_0x1b1ba6}:null;}})[_0x06c9('0x27')](respondWithResult(_0x329bb4,null))[_0x06c9('0x46')](handleError(_0x329bb4,null));};exports[_0x06c9('0x51')]=function(_0x3cb0a1,_0x5618cd,_0x540561){if(_0x3cb0a1[_0x06c9('0x4a')]['id']){delete _0x3cb0a1[_0x06c9('0x4a')]['id'];}return db[_0x06c9('0x2d')][_0x06c9('0x4e')]({'where':{'id':_0x3cb0a1['params']['id']}})['then'](handleEntityNotFound(_0x5618cd,null))[_0x06c9('0x27')](function(_0x1daf23){if(_0x1daf23){_0x3cb0a1['body'][_0x06c9('0x52')]=_0x1daf23['id'];_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x53')]=integrations[_0x06c9('0x54')](_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x55')],_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x30')]);_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x56')]=integrations[_0x06c9('0x57')](_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x55')],_0x3cb0a1[_0x06c9('0x4a')][_0x06c9('0x30')]);return db['DeskConfiguration'][_0x06c9('0x49')](_0x3cb0a1[_0x06c9('0x4a')],{'include':[{'model':db[_0x06c9('0x58')],'as':_0x06c9('0x53')},{'model':db[_0x06c9('0x58')],'as':_0x06c9('0x56')}]});}return null;})['then'](respondWithResult(_0x5618cd,null))[_0x06c9('0x46')](handleError(_0x5618cd,null));};exports[_0x06c9('0x59')]=function(_0x109efc,_0xb10f45,_0x4ddf00){var _0x6527f6=[{'name':_0x06c9('0x5a'),'label':_0x06c9('0x5a'),'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 _0x4e75e0='';return db['DeskAccount'][_0x06c9('0x4e')]({'where':{'id':_0x109efc[_0x06c9('0x48')]['id']},'attributes':['id','remoteUri',_0x06c9('0x5b'),_0x06c9('0x5c'),_0x06c9('0x5d'),_0x06c9('0x5e'),_0x06c9('0x5f'),'token',_0x06c9('0x60')]})[_0x06c9('0x27')](handleEntityNotFound(_0xb10f45,null))[_0x06c9('0x27')](function(_0x223bf2){if(_0x223bf2){_0x4e75e0=_0x223bf2[_0x06c9('0x61')];var _0x2361d5=_0x4e75e0['slice'](-0x1);if(_0x2361d5==='/'){_0x4e75e0=_0x4e75e0[_0x06c9('0x62')](0x0,_0x4e75e0['lastIndexOf'](_0x2361d5));}var _0x385eed={'method':_0x06c9('0x63'),'uri':util[_0x06c9('0x64')](_0x06c9('0x65'),_0x4e75e0),'headers':{'Content-Type':'application/json','Accept':_0x06c9('0x66')},'json':!![]};if(_0x223bf2[_0x06c9('0x5b')]===_0x06c9('0x67')){_0x385eed[_0x06c9('0x68')][_0x06c9('0x69')]=util[_0x06c9('0x64')](_0x06c9('0x6a'),new Buffer(util[_0x06c9('0x64')](_0x06c9('0x6b'),_0x223bf2[_0x06c9('0x5c')],_0x223bf2[_0x06c9('0x5d')]))[_0x06c9('0x6c')]('base64'));}return rp(_0x385eed)[_0x06c9('0x27')](function(_0x29fd25){return _0x6527f6[_0x06c9('0x6d')](_[_0x06c9('0x2c')](_0x29fd25[_0x06c9('0x6e')]['entries'],function(_0x3d20e3){return{'id':_0x3d20e3[_0x06c9('0x2a')],'name':_0x3d20e3[_0x06c9('0x2a')],'type':_0x3d20e3[_0x06c9('0x30')],'active':_0x3d20e3[_0x06c9('0x6f')],'label':_0x3d20e3['label'],'custom':!![]};}));});}})[_0x06c9('0x27')](function(_0x298b17){return{'count':_0x298b17[_0x06c9('0x39')],'rows':_0x298b17};})[_0x06c9('0x27')](respondWithResult(_0xb10f45,null))[_0x06c9('0x46')](function(_0x54fb1b){var _0x33e473=_0x109efc[_0x06c9('0x33')][_0x06c9('0x70')]?0x1f4:_0x54fb1b[_0x06c9('0x71')]||0x1f4;logger[_0x06c9('0x29')](_0x06c9('0x72'),'getFields',_0x33e473,JSON[_0x06c9('0x73')](_0x54fb1b));delete _0x54fb1b[_0x06c9('0x2a')];if(_0x33e473===0x191){_0x33e473=0x190;}_0xb10f45[_0x06c9('0x1d')](_0x33e473)[_0x06c9('0x74')](_0x109efc[_0x06c9('0x33')][_0x06c9('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x54fb1b[_0x06c9('0x71')]}:_0x54fb1b);});}; \ No newline at end of file +var _0xc1ce=['end','offset','undefined','limit','count','set','reject','save','destroy','then','sendStatus','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','map','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','params','length','find','create','update','body','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','token','tokenSecret','slice','format','%s/custom_fields','basic','headers','Authorization','Basic\x20%s','password','base64','concat','entries','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','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','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status'];(function(_0x16f77c,_0x5256b1){var _0x78986e=function(_0x10430){while(--_0x10430){_0x16f77c['push'](_0x16f77c['shift']());}};_0x78986e(++_0x5256b1);}(_0xc1ce,0x191));var _0xec1c=function(_0x5c2a2c,_0xced8b4){_0x5c2a2c=_0x5c2a2c-0x0;var _0x59b759=_0xc1ce[_0x5c2a2c];return _0x59b759;};'use strict';var emlformat=require(_0xec1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec1c('0x1'));var jsonpatch=require(_0xec1c('0x2'));var rp=require('request-promise');var moment=require(_0xec1c('0x3'));var BPromise=require(_0xec1c('0x4'));var Mustache=require(_0xec1c('0x5'));var util=require(_0xec1c('0x6'));var path=require(_0xec1c('0x7'));var sox=require(_0xec1c('0x8'));var csv=require(_0xec1c('0x9'));var ejs=require(_0xec1c('0xa'));var fs=require('fs');var fs_extra=require(_0xec1c('0xb'));var _=require(_0xec1c('0xc'));var squel=require('squel');var crypto=require(_0xec1c('0xd'));var jsforce=require(_0xec1c('0xe'));var deskjs=require(_0xec1c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xec1c('0x10'));var Papa=require(_0xec1c('0x11'));var Redis=require(_0xec1c('0x12'));var authService=require(_0xec1c('0x13'));var qs=require(_0xec1c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec1c('0x15'))(_0xec1c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec1c('0x17'));var db=require(_0xec1c('0x18'))['db'];var integrations=require(_0xec1c('0x19'));function respondWithStatusCode(_0xfac4cc,_0xc1eb40){_0xc1eb40=_0xc1eb40||0xcc;return function(_0x3c453e){if(_0x3c453e){return _0xfac4cc['sendStatus'](_0xc1eb40);}return _0xfac4cc[_0xec1c('0x1a')](_0xc1eb40)[_0xec1c('0x1b')]();};}function respondWithResult(_0x481186,_0x27545c){_0x27545c=_0x27545c||0xc8;return function(_0x36a1e7){if(_0x36a1e7){return _0x481186['status'](_0x27545c)['json'](_0x36a1e7);}};}function respondWithFilteredResult(_0x4f7fc0,_0x514cd3){return function(_0x63ccde){if(_0x63ccde){var _0x4ce7c5=typeof _0x514cd3[_0xec1c('0x1c')]===_0xec1c('0x1d')&&typeof _0x514cd3[_0xec1c('0x1e')]==='undefined';var _0x433fd4=_0x63ccde[_0xec1c('0x1f')];var _0x5c4597=_0x4ce7c5?0x0:_0x514cd3[_0xec1c('0x1c')];var _0x332ff1=_0x4ce7c5?_0x63ccde[_0xec1c('0x1f')]:_0x514cd3[_0xec1c('0x1c')]+_0x514cd3[_0xec1c('0x1e')];var _0x401b78;if(_0x332ff1>=_0x433fd4){_0x332ff1=_0x433fd4;_0x401b78=0xc8;}else{_0x401b78=0xce;}_0x4f7fc0['status'](_0x401b78);return _0x4f7fc0[_0xec1c('0x20')]('Content-Range',_0x5c4597+'-'+_0x332ff1+'/'+_0x433fd4)['json'](_0x63ccde);}return null;};}function patchUpdates(_0x4e533e){return function(_0x1df077){try{jsonpatch['apply'](_0x1df077,_0x4e533e,!![]);}catch(_0x56d26d){return BPromise[_0xec1c('0x21')](_0x56d26d);}return _0x1df077[_0xec1c('0x22')]();};}function saveUpdates(_0x3326e5,_0x4738dd){return function(_0x16bae3){if(_0x16bae3){return _0x16bae3['update'](_0x3326e5)['then'](function(_0x5a337d){return _0x5a337d;});}return null;};}function removeEntity(_0x180ea9,_0x2f41eb){return function(_0x203ce2){if(_0x203ce2){return _0x203ce2[_0xec1c('0x23')]()[_0xec1c('0x24')](function(){_0x180ea9[_0xec1c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad9f2,_0x2f95a2){return function(_0x60fbef){if(!_0x60fbef){_0x5ad9f2[_0xec1c('0x25')](0x194);}return _0x60fbef;};}function handleError(_0x58b9e2,_0x4026af){_0x4026af=_0x4026af||0x1f4;return function(_0x463c9c){logger[_0xec1c('0x26')](_0x463c9c[_0xec1c('0x27')]);if(_0x463c9c[_0xec1c('0x28')]){delete _0x463c9c[_0xec1c('0x28')];}_0x58b9e2[_0xec1c('0x1a')](_0x4026af)['send'](_0x463c9c);};}exports[_0xec1c('0x29')]=function(_0x2e13db,_0x3fc706){var _0x24ff6e={},_0x49dfae={},_0x1e1490={'count':0x0,'rows':[]};var _0x99d985=_['map'](db['DeskAccount'][_0xec1c('0x2a')],function(_0x57cddc){return{'name':_0x57cddc['fieldName'],'type':_0x57cddc[_0xec1c('0x2b')][_0xec1c('0x2c')]};});_0x49dfae[_0xec1c('0x2d')]=_['map'](_0x99d985,_0xec1c('0x28'));_0x49dfae[_0xec1c('0x2e')]=_[_0xec1c('0x2f')](_0x2e13db[_0xec1c('0x2e')]);_0x49dfae[_0xec1c('0x30')]=_[_0xec1c('0x31')](_0x49dfae[_0xec1c('0x2d')],_0x49dfae[_0xec1c('0x2e')]);_0x24ff6e[_0xec1c('0x32')]=_[_0xec1c('0x31')](_0x49dfae[_0xec1c('0x2d')],qs[_0xec1c('0x33')](_0x2e13db['query'][_0xec1c('0x33')]));_0x24ff6e[_0xec1c('0x32')]=_0x24ff6e['attributes']['length']?_0x24ff6e['attributes']:_0x49dfae[_0xec1c('0x2d')];if(!_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x34')](_0xec1c('0x35'))){_0x24ff6e[_0xec1c('0x1e')]=qs[_0xec1c('0x1e')](_0x2e13db['query']['limit']);_0x24ff6e[_0xec1c('0x1c')]=qs[_0xec1c('0x1c')](_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x1c')]);}_0x24ff6e['order']=qs[_0xec1c('0x36')](_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x36')]);_0x24ff6e['where']=qs['filters'](_[_0xec1c('0x37')](_0x2e13db[_0xec1c('0x2e')],_0x49dfae[_0xec1c('0x30')]),_0x99d985);if(_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x38')]){_0x24ff6e['where']=_[_0xec1c('0x39')](_0x24ff6e[_0xec1c('0x3a')],{'$or':_[_0xec1c('0x3b')](_0x99d985,function(_0x58a0b4){if(_0x58a0b4['type']!==_0xec1c('0x3c')){var _0x205c19={};_0x205c19[_0x58a0b4[_0xec1c('0x28')]]={'$like':'%'+_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x38')]+'%'};return _0x205c19;}})});}_0x24ff6e=_['merge']({},_0x24ff6e,_0x2e13db[_0xec1c('0x3d')]);var _0x145470={'where':_0x24ff6e['where']};return db[_0xec1c('0x3e')]['count'](_0x145470)[_0xec1c('0x24')](function(_0x2261c4){_0x1e1490['count']=_0x2261c4;if(_0x2e13db[_0xec1c('0x2e')][_0xec1c('0x3f')]){_0x24ff6e[_0xec1c('0x40')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x24ff6e);})['then'](function(_0x46d967){_0x1e1490[_0xec1c('0x41')]=_0x46d967;return _0x1e1490;})[_0xec1c('0x24')](respondWithFilteredResult(_0x3fc706,_0x24ff6e))[_0xec1c('0x42')](handleError(_0x3fc706,null));};exports['show']=function(_0xcace76,_0x21aa60){var _0x5aa95a={'raw':![],'where':{'id':_0xcace76[_0xec1c('0x43')]['id']}},_0x527af6={};_0x527af6[_0xec1c('0x2d')]=_[_0xec1c('0x2f')](db[_0xec1c('0x3e')][_0xec1c('0x2a')]);_0x527af6['query']=_[_0xec1c('0x2f')](_0xcace76[_0xec1c('0x2e')]);_0x527af6[_0xec1c('0x30')]=_['intersection'](_0x527af6[_0xec1c('0x2d')],_0x527af6[_0xec1c('0x2e')]);_0x5aa95a['attributes']=_[_0xec1c('0x31')](_0x527af6['model'],qs['fields'](_0xcace76[_0xec1c('0x2e')]['fields']));_0x5aa95a[_0xec1c('0x32')]=_0x5aa95a['attributes'][_0xec1c('0x44')]?_0x5aa95a['attributes']:_0x527af6['model'];if(_0xcace76[_0xec1c('0x2e')][_0xec1c('0x3f')]){_0x5aa95a[_0xec1c('0x40')]=[{'all':!![]}];}_0x5aa95a=_[_0xec1c('0x39')]({},_0x5aa95a,_0xcace76[_0xec1c('0x3d')]);return db[_0xec1c('0x3e')][_0xec1c('0x45')](_0x5aa95a)['then'](handleEntityNotFound(_0x21aa60,null))[_0xec1c('0x24')](respondWithResult(_0x21aa60,null))['catch'](handleError(_0x21aa60,null));};exports[_0xec1c('0x46')]=function(_0x452684,_0x170cc4){return db[_0xec1c('0x3e')][_0xec1c('0x46')](_0x452684['body'],{})[_0xec1c('0x24')](respondWithResult(_0x170cc4,0xc9))[_0xec1c('0x42')](handleError(_0x170cc4,null));};exports[_0xec1c('0x47')]=function(_0x4e64e3,_0x3cb21c){if(_0x4e64e3[_0xec1c('0x48')]['id']){delete _0x4e64e3[_0xec1c('0x48')]['id'];}return db[_0xec1c('0x3e')][_0xec1c('0x45')]({'where':{'id':_0x4e64e3[_0xec1c('0x43')]['id']}})[_0xec1c('0x24')](handleEntityNotFound(_0x3cb21c,null))[_0xec1c('0x24')](saveUpdates(_0x4e64e3['body'],null))['then'](respondWithResult(_0x3cb21c,null))[_0xec1c('0x42')](handleError(_0x3cb21c,null));};exports[_0xec1c('0x23')]=function(_0x28db33,_0x690cb3){return db[_0xec1c('0x3e')]['find']({'where':{'id':_0x28db33[_0xec1c('0x43')]['id']}})[_0xec1c('0x24')](handleEntityNotFound(_0x690cb3,null))[_0xec1c('0x24')](removeEntity(_0x690cb3,null))[_0xec1c('0x42')](handleError(_0x690cb3,null));};exports[_0xec1c('0x49')]=function(_0x3014bc,_0x43bc41,_0x69284b){var _0x172dce={};var _0x2abb18={};var _0x3f572c;var _0x27c0f9;return db[_0xec1c('0x3e')][_0xec1c('0x4a')]({'where':{'id':_0x3014bc[_0xec1c('0x43')]['id']}})[_0xec1c('0x24')](handleEntityNotFound(_0x43bc41,null))[_0xec1c('0x24')](function(_0x3ee82c){if(_0x3ee82c){_0x3f572c=_0x3ee82c;_0x2abb18[_0xec1c('0x2d')]=_[_0xec1c('0x2f')](db['DeskConfiguration'][_0xec1c('0x2a')]);_0x2abb18[_0xec1c('0x2e')]=_[_0xec1c('0x2f')](_0x3014bc[_0xec1c('0x2e')]);_0x2abb18['filters']=_[_0xec1c('0x31')](_0x2abb18[_0xec1c('0x2d')],_0x2abb18['query']);_0x172dce[_0xec1c('0x32')]=_[_0xec1c('0x31')](_0x2abb18[_0xec1c('0x2d')],qs[_0xec1c('0x33')](_0x3014bc[_0xec1c('0x2e')][_0xec1c('0x33')]));_0x172dce[_0xec1c('0x32')]=_0x172dce[_0xec1c('0x32')][_0xec1c('0x44')]?_0x172dce[_0xec1c('0x32')]:_0x2abb18[_0xec1c('0x2d')];_0x172dce[_0xec1c('0x4b')]=qs[_0xec1c('0x36')](_0x3014bc[_0xec1c('0x2e')][_0xec1c('0x36')]);_0x172dce[_0xec1c('0x3a')]=qs[_0xec1c('0x30')](_[_0xec1c('0x37')](_0x3014bc['query'],_0x2abb18[_0xec1c('0x30')]));if(_0x3014bc['query']['filter']){_0x172dce[_0xec1c('0x3a')]=_[_0xec1c('0x39')](_0x172dce['where'],{'$or':_['map'](_0x172dce['attributes'],function(_0xcfee56){var _0x2165f7={};_0x2165f7[_0xcfee56]={'$like':'%'+_0x3014bc[_0xec1c('0x2e')][_0xec1c('0x38')]+'%'};return _0x2165f7;})});}_0x172dce=_[_0xec1c('0x39')]({},_0x172dce,_0x3014bc[_0xec1c('0x3d')]);return _0x3f572c[_0xec1c('0x49')](_0x172dce);}})[_0xec1c('0x24')](function(_0x1e3c9d){if(_0x1e3c9d){_0x27c0f9=_0x1e3c9d['length'];if(!_0x3014bc[_0xec1c('0x2e')][_0xec1c('0x34')](_0xec1c('0x35'))){_0x172dce['limit']=qs[_0xec1c('0x1e')](_0x3014bc[_0xec1c('0x2e')]['limit']);_0x172dce[_0xec1c('0x1c')]=qs['offset'](_0x3014bc[_0xec1c('0x2e')][_0xec1c('0x1c')]);}return _0x3f572c[_0xec1c('0x49')](_0x172dce);}})[_0xec1c('0x24')](function(_0x5dd630){if(_0x5dd630){return _0x5dd630?{'count':_0x27c0f9,'rows':_0x5dd630}:null;}})[_0xec1c('0x24')](respondWithResult(_0x43bc41,null))[_0xec1c('0x42')](handleError(_0x43bc41,null));};exports[_0xec1c('0x4c')]=function(_0x441410,_0x55f90b,_0x555754){if(_0x441410[_0xec1c('0x48')]['id']){delete _0x441410[_0xec1c('0x48')]['id'];}return db[_0xec1c('0x3e')][_0xec1c('0x4a')]({'where':{'id':_0x441410[_0xec1c('0x43')]['id']}})[_0xec1c('0x24')](handleEntityNotFound(_0x55f90b,null))[_0xec1c('0x24')](function(_0x3d8194){if(_0x3d8194){_0x441410[_0xec1c('0x48')]['AccountId']=_0x3d8194['id'];_0x441410[_0xec1c('0x48')][_0xec1c('0x4d')]=integrations[_0xec1c('0x4e')](_0x441410[_0xec1c('0x48')]['channel'],_0x441410[_0xec1c('0x48')][_0xec1c('0x2b')]);_0x441410[_0xec1c('0x48')][_0xec1c('0x4f')]=integrations[_0xec1c('0x50')](_0x441410[_0xec1c('0x48')][_0xec1c('0x51')],_0x441410[_0xec1c('0x48')][_0xec1c('0x2b')]);return db[_0xec1c('0x52')][_0xec1c('0x46')](_0x441410[_0xec1c('0x48')],{'include':[{'model':db[_0xec1c('0x53')],'as':_0xec1c('0x4d')},{'model':db[_0xec1c('0x53')],'as':_0xec1c('0x4f')}]});}return null;})['then'](respondWithResult(_0x55f90b,null))[_0xec1c('0x42')](handleError(_0x55f90b,null));};exports[_0xec1c('0x54')]=function(_0x1c7281,_0x267f27,_0x3e9e0b){var _0x44b8f5=[{'name':_0xec1c('0x55'),'label':_0xec1c('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5be0f7='';return db[_0xec1c('0x3e')][_0xec1c('0x4a')]({'where':{'id':_0x1c7281[_0xec1c('0x43')]['id']},'attributes':['id',_0xec1c('0x56'),_0xec1c('0x57'),_0xec1c('0x58'),'password','consumerKey','consumerSecret',_0xec1c('0x59'),_0xec1c('0x5a')]})['then'](handleEntityNotFound(_0x267f27,null))['then'](function(_0x72bdc8){if(_0x72bdc8){_0x5be0f7=_0x72bdc8[_0xec1c('0x56')];var _0x5947a4=_0x5be0f7[_0xec1c('0x5b')](-0x1);if(_0x5947a4==='/'){_0x5be0f7=_0x5be0f7['substring'](0x0,_0x5be0f7['lastIndexOf'](_0x5947a4));}var _0x1bcb32={'method':'GET','uri':util[_0xec1c('0x5c')](_0xec1c('0x5d'),_0x5be0f7),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x72bdc8['authType']===_0xec1c('0x5e')){_0x1bcb32[_0xec1c('0x5f')][_0xec1c('0x60')]=util[_0xec1c('0x5c')](_0xec1c('0x61'),new Buffer(util['format']('%s:%s',_0x72bdc8[_0xec1c('0x58')],_0x72bdc8[_0xec1c('0x62')]))['toString'](_0xec1c('0x63')));}return rp(_0x1bcb32)['then'](function(_0x2121c4){return _0x44b8f5[_0xec1c('0x64')](_[_0xec1c('0x3b')](_0x2121c4['_embedded'][_0xec1c('0x65')],function(_0x1e996e){return{'id':_0x1e996e[_0xec1c('0x28')],'name':_0x1e996e[_0xec1c('0x28')],'type':_0x1e996e[_0xec1c('0x2b')],'active':_0x1e996e['active'],'label':_0x1e996e['label'],'custom':!![]};}));});}})[_0xec1c('0x24')](function(_0x336a3c){return{'count':_0x336a3c['length'],'rows':_0x336a3c};})[_0xec1c('0x24')](respondWithResult(_0x267f27,null))[_0xec1c('0x42')](function(_0x5e92a8){var _0x56587a=_0x1c7281['query'][_0xec1c('0x66')]?0x1f4:_0x5e92a8['statusCode']||0x1f4;logger[_0xec1c('0x26')](_0xec1c('0x67'),_0xec1c('0x54'),_0x56587a,JSON[_0xec1c('0x68')](_0x5e92a8));delete _0x5e92a8[_0xec1c('0x28')];if(_0x56587a===0x191){_0x56587a=0x190;}_0x267f27[_0xec1c('0x1a')](_0x56587a)[_0xec1c('0x69')](_0x1c7281['query']['test']?{'message':_0xec1c('0x6a'),'statusCode':_0x5e92a8['statusCode']}:_0x5e92a8);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 64a3285..1dc701e 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 _0x69a9=['exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x7cbb23,_0x404d77){var _0x306654=function(_0x381372){while(--_0x381372){_0x7cbb23['push'](_0x7cbb23['shift']());}};_0x306654(++_0x404d77);}(_0x69a9,0x108));var _0x969a=function(_0x1e0bb9,_0x24088b){_0x1e0bb9=_0x1e0bb9-0x0;var _0x24901d=_0x69a9[_0x1e0bb9];return _0x24901d;};'use strict';var _=require(_0x969a('0x0'));var util=require(_0x969a('0x1'));var logger=require(_0x969a('0x2'))('api');var moment=require(_0x969a('0x3'));var BPromise=require(_0x969a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x969a('0x5'));var rimraf=require('rimraf');var config=require(_0x969a('0x6'));var attributes=require(_0x969a('0x7'));var integrations=require(_0x969a('0x8'));module[_0x969a('0x9')]=function(_0x2256ad,_0x23459e){return _0x2256ad[_0x969a('0xa')](_0x969a('0xb'),attributes,{'tableName':_0x969a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c33=['DeskAccount','int_desk_accounts','lodash','util','bluebird','request-promise','path','exports'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x1c33,0x102));var _0x31c3=function(_0x37c4bc,_0x269244){_0x37c4bc=_0x37c4bc-0x0;var _0xac3d95=_0x1c33[_0x37c4bc];return _0xac3d95;};'use strict';var _=require(_0x31c3('0x0'));var util=require(_0x31c3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x31c3('0x2'));var rp=require(_0x31c3('0x3'));var fs=require('fs');var path=require(_0x31c3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x31c3('0x5')]=function(_0x35c59b,_0x2fcb57){return _0x35c59b['define'](_0x31c3('0x6'),attributes,{'tableName':_0x31c3('0x7'),'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 6df29d6..fa95373 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 _0x4452=['find','where','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetDeskAccount','ShowDeskAccount'];(function(_0x3987dd,_0x504def){var _0x49d10d=function(_0x5d4dc4){while(--_0x5d4dc4){_0x3987dd['push'](_0x3987dd['shift']());}};_0x49d10d(++_0x504def);}(_0x4452,0xe7));var _0x2445=function(_0x339359,_0x473af6){_0x339359=_0x339359-0x0;var _0x1b1062=_0x4452[_0x339359];return _0x1b1062;};'use strict';var _=require(_0x2445('0x0'));var util=require(_0x2445('0x1'));var moment=require(_0x2445('0x2'));var BPromise=require(_0x2445('0x3'));var rs=require(_0x2445('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2445('0x5'));var logger=require(_0x2445('0x6'))(_0x2445('0x7'));var config=require(_0x2445('0x8'));var jayson=require(_0x2445('0x9'));var client=jayson[_0x2445('0xa')][_0x2445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bc473,_0x23afe9,_0x4dd507){return new BPromise(function(_0x108c25,_0x113fd9){return client[_0x2445('0xc')](_0x2bc473,_0x4dd507)[_0x2445('0xd')](function(_0x4eb845){logger[_0x2445('0xe')]('DeskAccount,\x20%s,\x20%s',_0x23afe9,_0x2445('0xf'));logger[_0x2445('0x10')](_0x2445('0x11'),_0x23afe9,_0x2445('0xf'),JSON['stringify'](_0x4eb845));if(_0x4eb845[_0x2445('0x12')]){if(_0x4eb845[_0x2445('0x12')][_0x2445('0x13')]===0x1f4){logger[_0x2445('0x12')](_0x2445('0x14'),_0x23afe9,_0x4eb845[_0x2445('0x12')][_0x2445('0x15')]);return _0x113fd9(_0x4eb845[_0x2445('0x12')][_0x2445('0x15')]);}logger[_0x2445('0x12')](_0x2445('0x14'),_0x23afe9,_0x4eb845[_0x2445('0x12')]['message']);return _0x108c25(_0x4eb845[_0x2445('0x12')][_0x2445('0x15')]);}else{logger[_0x2445('0xe')](_0x2445('0x14'),_0x23afe9,_0x2445('0xf'));_0x108c25(_0x4eb845[_0x2445('0x16')][_0x2445('0x15')]);}})[_0x2445('0x17')](function(_0xeca9e4){logger[_0x2445('0x12')](_0x2445('0x14'),_0x23afe9,_0xeca9e4);_0x113fd9(_0xeca9e4);});});}exports['GetDeskAccount']=function(_0x1e087d){var _0x1020e0=this;return new Promise(function(_0x510237,_0x299d89){return db[_0x2445('0x18')][_0x2445('0x19')]({'raw':_0x1e087d[_0x2445('0x1a')]?_0x1e087d[_0x2445('0x1a')][_0x2445('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e087d[_0x2445('0x1a')]?_0x1e087d[_0x2445('0x1a')]['where']||null:null,'attributes':_0x1e087d[_0x2445('0x1a')]?_0x1e087d[_0x2445('0x1a')][_0x2445('0x1c')]||null:null,'limit':_0x1e087d['options']?_0x1e087d[_0x2445('0x1a')][_0x2445('0x1d')]||null:null,'include':_0x1e087d[_0x2445('0x1a')]?_0x1e087d['options'][_0x2445('0x1e')]?_[_0x2445('0x1f')](_0x1e087d[_0x2445('0x1a')][_0x2445('0x1e')],function(_0x3c39fb){return{'model':db[_0x3c39fb['model']],'as':_0x3c39fb['as'],'attributes':_0x3c39fb[_0x2445('0x1c')],'include':_0x3c39fb[_0x2445('0x1e')]?_[_0x2445('0x1f')](_0x3c39fb['include'],function(_0x45995e){return{'model':db[_0x45995e[_0x2445('0x20')]],'as':_0x45995e['as'],'attributes':_0x45995e[_0x2445('0x1c')],'include':_0x45995e['include']?_[_0x2445('0x1f')](_0x45995e[_0x2445('0x1e')],function(_0x534f0e){return{'model':db[_0x534f0e['model']],'as':_0x534f0e['as'],'attributes':_0x534f0e[_0x2445('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2445('0xd')](function(_0x1186f1){logger[_0x2445('0xe')](_0x2445('0x21'),_0x1e087d);logger[_0x2445('0x10')](_0x2445('0x21'),_0x1e087d,JSON['stringify'](_0x1186f1));_0x510237(_0x1186f1);})[_0x2445('0x17')](function(_0x32fff7){logger['error']('GetDeskAccount',_0x32fff7[_0x2445('0x15')],_0x1e087d);_0x299d89(_0x1020e0[_0x2445('0x12')](0x1f4,_0x32fff7[_0x2445('0x15')]));});});};exports[_0x2445('0x22')]=function(_0x45b2eb){var _0x1c7525=this;return new Promise(function(_0x257bcc,_0x15853d){return db[_0x2445('0x18')][_0x2445('0x23')]({'raw':_0x45b2eb[_0x2445('0x1a')]?_0x45b2eb[_0x2445('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x45b2eb[_0x2445('0x1a')]?_0x45b2eb[_0x2445('0x1a')][_0x2445('0x24')]||null:null,'attributes':_0x45b2eb[_0x2445('0x1a')]?_0x45b2eb[_0x2445('0x1a')][_0x2445('0x1c')]||null:null,'include':_0x45b2eb[_0x2445('0x1a')]?_0x45b2eb['options'][_0x2445('0x1e')]?_['map'](_0x45b2eb[_0x2445('0x1a')]['include'],function(_0x1866b2){return{'model':db[_0x1866b2[_0x2445('0x20')]],'as':_0x1866b2['as'],'attributes':_0x1866b2['attributes'],'include':_0x1866b2[_0x2445('0x1e')]?_[_0x2445('0x1f')](_0x1866b2[_0x2445('0x1e')],function(_0x228e10){return{'model':db[_0x228e10[_0x2445('0x20')]],'as':_0x228e10['as'],'attributes':_0x228e10[_0x2445('0x1c')],'include':_0x228e10[_0x2445('0x1e')]?_[_0x2445('0x1f')](_0x228e10[_0x2445('0x1e')],function(_0x4381e8){return{'model':db[_0x4381e8[_0x2445('0x20')]],'as':_0x4381e8['as'],'attributes':_0x4381e8[_0x2445('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2445('0xd')](function(_0x1af682){logger[_0x2445('0xe')](_0x2445('0x22'),_0x45b2eb);logger[_0x2445('0x10')](_0x2445('0x22'),_0x45b2eb,JSON[_0x2445('0x25')](_0x1af682));_0x257bcc(_0x1af682);})[_0x2445('0x17')](function(_0x780ae8){logger['error'](_0x2445('0x22'),_0x780ae8[_0x2445('0x15')],_0x45b2eb);_0x15853d(_0x1c7525['error'](0x1f4,_0x780ae8[_0x2445('0x15')]));});});}; \ No newline at end of file +var _0xf8cb=['then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4da9c3,_0x263c3f){var _0x2f4b65=function(_0x316856){while(--_0x316856){_0x4da9c3['push'](_0x4da9c3['shift']());}};_0x2f4b65(++_0x263c3f);}(_0xf8cb,0x136));var _0xbf8c=function(_0x3c9c09,_0x16e1ed){_0x3c9c09=_0x3c9c09-0x0;var _0x3fbd95=_0xf8cb[_0x3c9c09];return _0x3fbd95;};'use strict';var _=require(_0xbf8c('0x0'));var util=require(_0xbf8c('0x1'));var moment=require(_0xbf8c('0x2'));var BPromise=require(_0xbf8c('0x3'));var rs=require(_0xbf8c('0x4'));var fs=require('fs');var Redis=require(_0xbf8c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf8c('0x6'));var logger=require(_0xbf8c('0x7'))(_0xbf8c('0x8'));var config=require(_0xbf8c('0x9'));var jayson=require(_0xbf8c('0xa'));var client=jayson[_0xbf8c('0xb')][_0xbf8c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe813bf,_0x4e77c,_0x4bfbcb){return new BPromise(function(_0x54774c,_0x3997d8){return client[_0xbf8c('0xd')](_0xe813bf,_0x4bfbcb)[_0xbf8c('0xe')](function(_0x528016){logger[_0xbf8c('0xf')](_0xbf8c('0x10'),_0x4e77c,_0xbf8c('0x11'));logger[_0xbf8c('0x12')](_0xbf8c('0x13'),_0x4e77c,_0xbf8c('0x11'),JSON['stringify'](_0x528016));if(_0x528016[_0xbf8c('0x14')]){if(_0x528016[_0xbf8c('0x14')][_0xbf8c('0x15')]===0x1f4){logger[_0xbf8c('0x14')](_0xbf8c('0x10'),_0x4e77c,_0x528016[_0xbf8c('0x14')][_0xbf8c('0x16')]);return _0x3997d8(_0x528016[_0xbf8c('0x14')]['message']);}logger[_0xbf8c('0x14')](_0xbf8c('0x10'),_0x4e77c,_0x528016[_0xbf8c('0x14')]['message']);return _0x54774c(_0x528016[_0xbf8c('0x14')][_0xbf8c('0x16')]);}else{logger[_0xbf8c('0xf')]('DeskAccount,\x20%s,\x20%s',_0x4e77c,_0xbf8c('0x11'));_0x54774c(_0x528016[_0xbf8c('0x17')]['message']);}})[_0xbf8c('0x18')](function(_0x17d554){logger[_0xbf8c('0x14')](_0xbf8c('0x10'),_0x4e77c,_0x17d554);_0x3997d8(_0x17d554);});});}exports[_0xbf8c('0x19')]=function(_0x4f5c8f){var _0x31f3e8=this;return new Promise(function(_0x4a7352,_0x42ad3b){return db[_0xbf8c('0x1a')][_0xbf8c('0x1b')]({'raw':_0x4f5c8f[_0xbf8c('0x1c')]?_0x4f5c8f[_0xbf8c('0x1c')][_0xbf8c('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f5c8f[_0xbf8c('0x1c')]?_0x4f5c8f[_0xbf8c('0x1c')][_0xbf8c('0x1e')]||null:null,'attributes':_0x4f5c8f[_0xbf8c('0x1c')]?_0x4f5c8f['options'][_0xbf8c('0x1f')]||null:null,'limit':_0x4f5c8f[_0xbf8c('0x1c')]?_0x4f5c8f[_0xbf8c('0x1c')]['limit']||null:null,'include':_0x4f5c8f['options']?_0x4f5c8f[_0xbf8c('0x1c')][_0xbf8c('0x20')]?_[_0xbf8c('0x21')](_0x4f5c8f['options'][_0xbf8c('0x20')],function(_0x2a7c88){return{'model':db[_0x2a7c88[_0xbf8c('0x22')]],'as':_0x2a7c88['as'],'attributes':_0x2a7c88[_0xbf8c('0x1f')],'include':_0x2a7c88[_0xbf8c('0x20')]?_[_0xbf8c('0x21')](_0x2a7c88[_0xbf8c('0x20')],function(_0x181b37){return{'model':db[_0x181b37['model']],'as':_0x181b37['as'],'attributes':_0x181b37[_0xbf8c('0x1f')],'include':_0x181b37[_0xbf8c('0x20')]?_['map'](_0x181b37[_0xbf8c('0x20')],function(_0x220a48){return{'model':db[_0x220a48[_0xbf8c('0x22')]],'as':_0x220a48['as'],'attributes':_0x220a48[_0xbf8c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbf8c('0xe')](function(_0x55a4c5){logger[_0xbf8c('0xf')]('GetDeskAccount',_0x4f5c8f);logger[_0xbf8c('0x12')](_0xbf8c('0x19'),_0x4f5c8f,JSON['stringify'](_0x55a4c5));_0x4a7352(_0x55a4c5);})['catch'](function(_0x15165a){logger[_0xbf8c('0x14')](_0xbf8c('0x19'),_0x15165a[_0xbf8c('0x16')],_0x4f5c8f);_0x42ad3b(_0x31f3e8['error'](0x1f4,_0x15165a[_0xbf8c('0x16')]));});});};exports[_0xbf8c('0x23')]=function(_0x537710){var _0x51a9eb=this;return new Promise(function(_0x7cba4,_0x4c01f5){return db[_0xbf8c('0x1a')]['find']({'raw':_0x537710[_0xbf8c('0x1c')]?_0x537710['options'][_0xbf8c('0x1d')]===undefined?!![]:![]:!![],'where':_0x537710['options']?_0x537710['options']['where']||null:null,'attributes':_0x537710[_0xbf8c('0x1c')]?_0x537710[_0xbf8c('0x1c')][_0xbf8c('0x1f')]||null:null,'include':_0x537710[_0xbf8c('0x1c')]?_0x537710['options'][_0xbf8c('0x20')]?_['map'](_0x537710[_0xbf8c('0x1c')][_0xbf8c('0x20')],function(_0x550811){return{'model':db[_0x550811['model']],'as':_0x550811['as'],'attributes':_0x550811[_0xbf8c('0x1f')],'include':_0x550811['include']?_[_0xbf8c('0x21')](_0x550811[_0xbf8c('0x20')],function(_0xbc9d36){return{'model':db[_0xbc9d36[_0xbf8c('0x22')]],'as':_0xbc9d36['as'],'attributes':_0xbc9d36[_0xbf8c('0x1f')],'include':_0xbc9d36[_0xbf8c('0x20')]?_[_0xbf8c('0x21')](_0xbc9d36['include'],function(_0x33fea5){return{'model':db[_0x33fea5[_0xbf8c('0x22')]],'as':_0x33fea5['as'],'attributes':_0x33fea5[_0xbf8c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f42ab){logger['info'](_0xbf8c('0x23'),_0x537710);logger[_0xbf8c('0x12')]('ShowDeskAccount',_0x537710,JSON['stringify'](_0x2f42ab));_0x7cba4(_0x2f42ab);})['catch'](function(_0x3667cb){logger[_0xbf8c('0x14')](_0xbf8c('0x23'),_0x3667cb['message'],_0x537710);_0x4c01f5(_0x51a9eb[_0xbf8c('0x14')](0x1f4,_0x3667cb[_0xbf8c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index dc2b6d1..81e619e 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5cda66,_0x118246){var _0x28d8f9=function(_0x385b24){while(--_0x385b24){_0x5cda66['push'](_0x5cda66['shift']());}};_0x28d8f9(++_0x118246);}(_0x3e74,0x175));var _0x43e7=function(_0x348aa6,_0x3d7f6e){_0x348aa6=_0x348aa6-0x0;var _0x4fe7d6=_0x3e74[_0x348aa6];return _0x4fe7d6;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +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(_0x30efcd,_0x125a69){var _0x3d666d=function(_0x33465f){while(--_0x33465f){_0x30efcd['push'](_0x30efcd['shift']());}};_0x3d666d(++_0x125a69);}(_0x008c,0x188));var _0xc008=function(_0x292600,_0x120a55){_0x292600=_0x292600-0x0;var _0x2ef83b=_0x008c[_0x292600];return _0x2ef83b;};'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 fa66c49..2dbff9c 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 _0x2d58=['STRING','exports'];(function(_0xd94c26,_0x184bc7){var _0xa8587=function(_0x32ea43){while(--_0x32ea43){_0xd94c26['push'](_0xd94c26['shift']());}};_0xa8587(++_0x184bc7);}(_0x2d58,0x187));var _0x82d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d58[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x82d5('0x0')]={'name':{'type':Sequelize[_0x82d5('0x1')]},'description':{'type':Sequelize[_0x82d5('0x1')]}}; \ No newline at end of file +var _0x6802=['exports','STRING','sequelize'];(function(_0x4776cc,_0xe3d5a4){var _0x2f1ffb=function(_0x53644f){while(--_0x53644f){_0x4776cc['push'](_0x4776cc['shift']());}};_0x2f1ffb(++_0xe3d5a4);}(_0x6802,0x1c4));var _0x2680=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6802[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x2680('0x0'));module[_0x2680('0x1')]={'name':{'type':Sequelize[_0x2680('0x2')]},'description':{'type':Sequelize[_0x2680('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 96d67b5..e44ce71 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 _0x84f1=['hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','show','keys','rawAttributes','includeAll','catch','create','body','params','find','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','DeskConfiguration','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length'];(function(_0x2c906b,_0x29e76d){var _0x5d258b=function(_0x974982){while(--_0x974982){_0x2c906b['push'](_0x2c906b['shift']());}};_0x5d258b(++_0x29e76d);}(_0x84f1,0x73));var _0x184f=function(_0x284998,_0x55e05b){_0x284998=_0x284998-0x0;var _0x4146aa=_0x84f1[_0x284998];return _0x4146aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x184f('0x0'));var zipdir=require(_0x184f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x184f('0x2'));var moment=require(_0x184f('0x3'));var BPromise=require(_0x184f('0x4'));var Mustache=require('mustache');var util=require(_0x184f('0x5'));var path=require(_0x184f('0x6'));var sox=require(_0x184f('0x7'));var csv=require('to-csv');var ejs=require(_0x184f('0x8'));var fs=require('fs');var fs_extra=require(_0x184f('0x9'));var _=require(_0x184f('0xa'));var squel=require(_0x184f('0xb'));var crypto=require(_0x184f('0xc'));var jsforce=require(_0x184f('0xd'));var deskjs=require(_0x184f('0xe'));var toCsv=require(_0x184f('0xf'));var querystring=require(_0x184f('0x10'));var Papa=require(_0x184f('0x11'));var Redis=require(_0x184f('0x12'));var authService=require(_0x184f('0x13'));var qs=require(_0x184f('0x14'));var as=require(_0x184f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x184f('0x16'))(_0x184f('0x17'));var utils=require(_0x184f('0x18'));var config=require(_0x184f('0x19'));var licenseUtil=require(_0x184f('0x1a'));var db=require(_0x184f('0x1b'))['db'];function respondWithStatusCode(_0x2808ff,_0x5b31ec){_0x5b31ec=_0x5b31ec||0xcc;return function(_0x2eff05){if(_0x2eff05){return _0x2808ff[_0x184f('0x1c')](_0x5b31ec);}return _0x2808ff[_0x184f('0x1d')](_0x5b31ec)[_0x184f('0x1e')]();};}function respondWithResult(_0x5b219f,_0xf77f08){_0xf77f08=_0xf77f08||0xc8;return function(_0x80bb55){if(_0x80bb55){return _0x5b219f['status'](_0xf77f08)[_0x184f('0x1f')](_0x80bb55);}};}function respondWithFilteredResult(_0x18c5e9,_0x43a334){return function(_0x19b710){if(_0x19b710){var _0x3d5be5=typeof _0x43a334[_0x184f('0x20')]===_0x184f('0x21')&&typeof _0x43a334[_0x184f('0x22')]===_0x184f('0x21');var _0x2b21b7=_0x19b710[_0x184f('0x23')];var _0x437502=_0x3d5be5?0x0:_0x43a334['offset'];var _0x2b0949=_0x3d5be5?_0x19b710[_0x184f('0x23')]:_0x43a334[_0x184f('0x20')]+_0x43a334['limit'];var _0x5e903f;if(_0x2b0949>=_0x2b21b7){_0x2b0949=_0x2b21b7;_0x5e903f=0xc8;}else{_0x5e903f=0xce;}_0x18c5e9[_0x184f('0x1d')](_0x5e903f);return _0x18c5e9[_0x184f('0x24')](_0x184f('0x25'),_0x437502+'-'+_0x2b0949+'/'+_0x2b21b7)[_0x184f('0x1f')](_0x19b710);}return null;};}function patchUpdates(_0x3d2338){return function(_0xa22ed5){try{jsonpatch[_0x184f('0x26')](_0xa22ed5,_0x3d2338,!![]);}catch(_0x42e00c){return BPromise[_0x184f('0x27')](_0x42e00c);}return _0xa22ed5['save']();};}function saveUpdates(_0x4c16e9,_0x3813cb){return function(_0x40fc74){if(_0x40fc74){return _0x40fc74[_0x184f('0x28')](_0x4c16e9)[_0x184f('0x29')](function(_0x592760){return _0x592760;});}return null;};}function removeEntity(_0x4a57c0,_0x37fe94){return function(_0x2dc441){if(_0x2dc441){return _0x2dc441[_0x184f('0x2a')]()[_0x184f('0x29')](function(){_0x4a57c0[_0x184f('0x1d')](0xcc)[_0x184f('0x1e')]();});}};}function handleEntityNotFound(_0x2bce20,_0x4f8042){return function(_0x552e66){if(!_0x552e66){_0x2bce20[_0x184f('0x1c')](0x194);}return _0x552e66;};}function handleError(_0x41a056,_0x3008b1){_0x3008b1=_0x3008b1||0x1f4;return function(_0x2ab636){logger['error'](_0x2ab636[_0x184f('0x2b')]);if(_0x2ab636[_0x184f('0x2c')]){delete _0x2ab636['name'];}_0x41a056['status'](_0x3008b1)[_0x184f('0x2d')](_0x2ab636);};}exports[_0x184f('0x2e')]=function(_0x5a6f61,_0x5cc14f){var _0x5133a0={},_0x24399f={},_0x589237={'count':0x0,'rows':[]};var _0x2e9825=_['map'](db[_0x184f('0x2f')]['rawAttributes'],function(_0x4d7f9a){return{'name':_0x4d7f9a[_0x184f('0x30')],'type':_0x4d7f9a[_0x184f('0x31')][_0x184f('0x32')]};});_0x24399f[_0x184f('0x33')]=_[_0x184f('0x34')](_0x2e9825,'name');_0x24399f['query']=_['keys'](_0x5a6f61[_0x184f('0x35')]);_0x24399f[_0x184f('0x36')]=_['intersection'](_0x24399f[_0x184f('0x33')],_0x24399f[_0x184f('0x35')]);_0x5133a0[_0x184f('0x37')]=_[_0x184f('0x38')](_0x24399f[_0x184f('0x33')],qs[_0x184f('0x39')](_0x5a6f61[_0x184f('0x35')]['fields']));_0x5133a0[_0x184f('0x37')]=_0x5133a0[_0x184f('0x37')][_0x184f('0x3a')]?_0x5133a0['attributes']:_0x24399f['model'];if(!_0x5a6f61[_0x184f('0x35')][_0x184f('0x3b')](_0x184f('0x3c'))){_0x5133a0[_0x184f('0x22')]=qs[_0x184f('0x22')](_0x5a6f61[_0x184f('0x35')]['limit']);_0x5133a0[_0x184f('0x20')]=qs[_0x184f('0x20')](_0x5a6f61['query'][_0x184f('0x20')]);}_0x5133a0[_0x184f('0x3d')]=qs['sort'](_0x5a6f61[_0x184f('0x35')][_0x184f('0x3e')]);_0x5133a0[_0x184f('0x3f')]=qs['filters'](_[_0x184f('0x40')](_0x5a6f61['query'],_0x24399f[_0x184f('0x36')]),_0x2e9825);if(_0x5a6f61[_0x184f('0x35')]['filter']){_0x5133a0[_0x184f('0x3f')]=_[_0x184f('0x41')](_0x5133a0[_0x184f('0x3f')],{'$or':_['map'](_0x2e9825,function(_0xd7bb9){if(_0xd7bb9[_0x184f('0x31')]!==_0x184f('0x42')){var _0x4fad28={};_0x4fad28[_0xd7bb9[_0x184f('0x2c')]]={'$like':'%'+_0x5a6f61[_0x184f('0x35')][_0x184f('0x43')]+'%'};return _0x4fad28;}})});}_0x5133a0=_[_0x184f('0x41')]({},_0x5133a0,_0x5a6f61[_0x184f('0x44')]);var _0x1cf9b6={'where':_0x5133a0[_0x184f('0x3f')]};return db[_0x184f('0x2f')][_0x184f('0x23')](_0x1cf9b6)['then'](function(_0x4f3303){_0x589237[_0x184f('0x23')]=_0x4f3303;if(_0x5a6f61[_0x184f('0x35')]['includeAll']){_0x5133a0[_0x184f('0x45')]=[{'all':!![]}];}return db[_0x184f('0x2f')]['findAll'](_0x5133a0);})[_0x184f('0x29')](function(_0x3f7290){_0x589237['rows']=_0x3f7290;return _0x589237;})['then'](respondWithFilteredResult(_0x5cc14f,_0x5133a0))['catch'](handleError(_0x5cc14f,null));};exports[_0x184f('0x46')]=function(_0x3e1ad2,_0xb1a3e4){var _0x279908={'raw':![],'where':{'id':_0x3e1ad2['params']['id']}},_0x4054f1={};_0x4054f1['model']=_[_0x184f('0x47')](db[_0x184f('0x2f')][_0x184f('0x48')]);_0x4054f1[_0x184f('0x35')]=_[_0x184f('0x47')](_0x3e1ad2[_0x184f('0x35')]);_0x4054f1[_0x184f('0x36')]=_[_0x184f('0x38')](_0x4054f1[_0x184f('0x33')],_0x4054f1[_0x184f('0x35')]);_0x279908['attributes']=_[_0x184f('0x38')](_0x4054f1[_0x184f('0x33')],qs['fields'](_0x3e1ad2[_0x184f('0x35')][_0x184f('0x39')]));_0x279908[_0x184f('0x37')]=_0x279908[_0x184f('0x37')][_0x184f('0x3a')]?_0x279908['attributes']:_0x4054f1[_0x184f('0x33')];if(_0x3e1ad2[_0x184f('0x35')][_0x184f('0x49')]){_0x279908['include']=[{'all':!![]}];}_0x279908=_['merge']({},_0x279908,_0x3e1ad2[_0x184f('0x44')]);return db[_0x184f('0x2f')]['find'](_0x279908)[_0x184f('0x29')](handleEntityNotFound(_0xb1a3e4,null))[_0x184f('0x29')](respondWithResult(_0xb1a3e4,null))[_0x184f('0x4a')](handleError(_0xb1a3e4,null));};exports[_0x184f('0x4b')]=function(_0x5222a3,_0x2b3b1b){return db[_0x184f('0x2f')]['create'](_0x5222a3[_0x184f('0x4c')],{})['then'](respondWithResult(_0x2b3b1b,0xc9))[_0x184f('0x4a')](handleError(_0x2b3b1b,null));};exports[_0x184f('0x28')]=function(_0xef0b65,_0x36bce2){if(_0xef0b65[_0x184f('0x4c')]['id']){delete _0xef0b65[_0x184f('0x4c')]['id'];}return db[_0x184f('0x2f')]['find']({'where':{'id':_0xef0b65[_0x184f('0x4d')]['id']}})[_0x184f('0x29')](handleEntityNotFound(_0x36bce2,null))[_0x184f('0x29')](saveUpdates(_0xef0b65[_0x184f('0x4c')],null))[_0x184f('0x29')](respondWithResult(_0x36bce2,null))[_0x184f('0x4a')](handleError(_0x36bce2,null));};exports[_0x184f('0x2a')]=function(_0x18ac80,_0xc7ac7f){return db[_0x184f('0x2f')][_0x184f('0x4e')]({'where':{'id':_0x18ac80[_0x184f('0x4d')]['id']}})[_0x184f('0x29')](handleEntityNotFound(_0xc7ac7f,null))['then'](removeEntity(_0xc7ac7f,null))[_0x184f('0x4a')](handleError(_0xc7ac7f,null));};exports[_0x184f('0x4f')]=function(_0x2be2e4,_0x3cb91a,_0x85caad){var _0x1e310d={};var _0x5c3962={};var _0x414335;var _0x34c486;return db[_0x184f('0x2f')][_0x184f('0x50')]({'where':{'id':_0x2be2e4['params']['id']}})[_0x184f('0x29')](handleEntityNotFound(_0x3cb91a,null))[_0x184f('0x29')](function(_0x30f110){if(_0x30f110){_0x414335=_0x30f110;_0x5c3962[_0x184f('0x33')]=_[_0x184f('0x47')](db[_0x184f('0x51')][_0x184f('0x48')]);_0x5c3962[_0x184f('0x35')]=_[_0x184f('0x47')](_0x2be2e4[_0x184f('0x35')]);_0x5c3962[_0x184f('0x36')]=_[_0x184f('0x38')](_0x5c3962['model'],_0x5c3962[_0x184f('0x35')]);_0x1e310d['attributes']=_[_0x184f('0x38')](_0x5c3962[_0x184f('0x33')],qs[_0x184f('0x39')](_0x2be2e4[_0x184f('0x35')][_0x184f('0x39')]));_0x1e310d[_0x184f('0x37')]=_0x1e310d[_0x184f('0x37')]['length']?_0x1e310d[_0x184f('0x37')]:_0x5c3962['model'];_0x1e310d[_0x184f('0x3d')]=qs[_0x184f('0x3e')](_0x2be2e4[_0x184f('0x35')][_0x184f('0x3e')]);_0x1e310d[_0x184f('0x3f')]=qs[_0x184f('0x36')](_[_0x184f('0x40')](_0x2be2e4[_0x184f('0x35')],_0x5c3962[_0x184f('0x36')]));if(_0x2be2e4[_0x184f('0x35')][_0x184f('0x43')]){_0x1e310d[_0x184f('0x3f')]=_[_0x184f('0x41')](_0x1e310d[_0x184f('0x3f')],{'$or':_[_0x184f('0x34')](_0x1e310d['attributes'],function(_0xd01993){var _0x3256f3={};_0x3256f3[_0xd01993]={'$like':'%'+_0x2be2e4[_0x184f('0x35')][_0x184f('0x43')]+'%'};return _0x3256f3;})});}_0x1e310d=_[_0x184f('0x41')]({},_0x1e310d,_0x2be2e4[_0x184f('0x44')]);return _0x414335['getFields'](_0x1e310d);}})[_0x184f('0x29')](function(_0x4fef66){if(_0x4fef66){_0x34c486=_0x4fef66['length'];if(!_0x2be2e4[_0x184f('0x35')][_0x184f('0x3b')]('nolimit')){_0x1e310d['limit']=qs[_0x184f('0x22')](_0x2be2e4['query'][_0x184f('0x22')]);_0x1e310d[_0x184f('0x20')]=qs['offset'](_0x2be2e4[_0x184f('0x35')][_0x184f('0x20')]);}return _0x414335['getFields'](_0x1e310d);}})['then'](function(_0xc23bbc){if(_0xc23bbc){return _0xc23bbc?{'count':_0x34c486,'rows':_0xc23bbc}:null;}})[_0x184f('0x29')](respondWithResult(_0x3cb91a,null))['catch'](handleError(_0x3cb91a,null));};exports[_0x184f('0x52')]=function(_0x163bb6,_0x1c73ab,_0x22ff27){var _0x22b9ef={};var _0x478a82={};var _0x4d419f;var _0x2191c9;return db[_0x184f('0x2f')]['findOne']({'where':{'id':_0x163bb6[_0x184f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1c73ab,null))[_0x184f('0x29')](function(_0x1470bf){if(_0x1470bf){_0x4d419f=_0x1470bf;_0x478a82[_0x184f('0x33')]=_[_0x184f('0x47')](db[_0x184f('0x51')][_0x184f('0x48')]);_0x478a82['query']=_[_0x184f('0x47')](_0x163bb6['query']);_0x478a82[_0x184f('0x36')]=_[_0x184f('0x38')](_0x478a82['model'],_0x478a82['query']);_0x22b9ef[_0x184f('0x37')]=_['intersection'](_0x478a82[_0x184f('0x33')],qs[_0x184f('0x39')](_0x163bb6[_0x184f('0x35')][_0x184f('0x39')]));_0x22b9ef[_0x184f('0x37')]=_0x22b9ef[_0x184f('0x37')]['length']?_0x22b9ef[_0x184f('0x37')]:_0x478a82[_0x184f('0x33')];_0x22b9ef[_0x184f('0x3d')]=qs[_0x184f('0x3e')](_0x163bb6[_0x184f('0x35')][_0x184f('0x3e')]);_0x22b9ef['where']=qs['filters'](_[_0x184f('0x40')](_0x163bb6['query'],_0x478a82[_0x184f('0x36')]));if(_0x163bb6[_0x184f('0x35')]['filter']){_0x22b9ef[_0x184f('0x3f')]=_[_0x184f('0x41')](_0x22b9ef['where'],{'$or':_[_0x184f('0x34')](_0x22b9ef[_0x184f('0x37')],function(_0x18f8de){var _0x346a22={};_0x346a22[_0x18f8de]={'$like':'%'+_0x163bb6[_0x184f('0x35')][_0x184f('0x43')]+'%'};return _0x346a22;})});}_0x22b9ef=_['merge']({},_0x22b9ef,_0x163bb6[_0x184f('0x44')]);return _0x4d419f['getSubjects'](_0x22b9ef);}})['then'](function(_0x536356){if(_0x536356){_0x2191c9=_0x536356['length'];if(!_0x163bb6[_0x184f('0x35')]['hasOwnProperty'](_0x184f('0x3c'))){_0x22b9ef['limit']=qs['limit'](_0x163bb6['query'][_0x184f('0x22')]);_0x22b9ef[_0x184f('0x20')]=qs['offset'](_0x163bb6['query'][_0x184f('0x20')]);}return _0x4d419f[_0x184f('0x52')](_0x22b9ef);}})[_0x184f('0x29')](function(_0x223ef3){if(_0x223ef3){return _0x223ef3?{'count':_0x2191c9,'rows':_0x223ef3}:null;}})[_0x184f('0x29')](respondWithResult(_0x1c73ab,null))[_0x184f('0x4a')](handleError(_0x1c73ab,null));};exports[_0x184f('0x53')]=function(_0x3675c2,_0x2a43d0,_0xe8c0f6){var _0x3b5e7b={};var _0x47e279={};var _0x14267f;var _0x48a21c;return db[_0x184f('0x2f')][_0x184f('0x50')]({'where':{'id':_0x3675c2[_0x184f('0x4d')]['id']}})[_0x184f('0x29')](handleEntityNotFound(_0x2a43d0,null))[_0x184f('0x29')](function(_0xf3b76e){if(_0xf3b76e){_0x14267f=_0xf3b76e;_0x47e279['model']=_[_0x184f('0x47')](db[_0x184f('0x51')][_0x184f('0x48')]);_0x47e279[_0x184f('0x35')]=_[_0x184f('0x47')](_0x3675c2[_0x184f('0x35')]);_0x47e279[_0x184f('0x36')]=_[_0x184f('0x38')](_0x47e279['model'],_0x47e279['query']);_0x3b5e7b[_0x184f('0x37')]=_[_0x184f('0x38')](_0x47e279[_0x184f('0x33')],qs[_0x184f('0x39')](_0x3675c2[_0x184f('0x35')][_0x184f('0x39')]));_0x3b5e7b[_0x184f('0x37')]=_0x3b5e7b[_0x184f('0x37')]['length']?_0x3b5e7b['attributes']:_0x47e279['model'];_0x3b5e7b[_0x184f('0x3d')]=qs['sort'](_0x3675c2[_0x184f('0x35')][_0x184f('0x3e')]);_0x3b5e7b[_0x184f('0x3f')]=qs[_0x184f('0x36')](_['pick'](_0x3675c2[_0x184f('0x35')],_0x47e279['filters']));if(_0x3675c2[_0x184f('0x35')][_0x184f('0x43')]){_0x3b5e7b[_0x184f('0x3f')]=_['merge'](_0x3b5e7b[_0x184f('0x3f')],{'$or':_[_0x184f('0x34')](_0x3b5e7b[_0x184f('0x37')],function(_0x4a43bb){var _0x4c32b7={};_0x4c32b7[_0x4a43bb]={'$like':'%'+_0x3675c2[_0x184f('0x35')][_0x184f('0x43')]+'%'};return _0x4c32b7;})});}_0x3b5e7b=_[_0x184f('0x41')]({},_0x3b5e7b,_0x3675c2['options']);return _0x14267f[_0x184f('0x53')](_0x3b5e7b);}})['then'](function(_0x4c36cc){if(_0x4c36cc){_0x48a21c=_0x4c36cc['length'];if(!_0x3675c2[_0x184f('0x35')]['hasOwnProperty'](_0x184f('0x3c'))){_0x3b5e7b[_0x184f('0x22')]=qs['limit'](_0x3675c2['query'][_0x184f('0x22')]);_0x3b5e7b[_0x184f('0x20')]=qs[_0x184f('0x20')](_0x3675c2[_0x184f('0x35')][_0x184f('0x20')]);}return _0x14267f[_0x184f('0x53')](_0x3b5e7b);}})['then'](function(_0x30743c){if(_0x30743c){return _0x30743c?{'count':_0x48a21c,'rows':_0x30743c}:null;}})[_0x184f('0x29')](respondWithResult(_0x2a43d0,null))[_0x184f('0x4a')](handleError(_0x2a43d0,null));};exports[_0x184f('0x54')]=function(_0x91bef4,_0x497257,_0x3cbf99){var _0x420864={};var _0x58da70={};var _0x15bacf;var _0x185ef2;return db[_0x184f('0x2f')][_0x184f('0x50')]({'where':{'id':_0x91bef4[_0x184f('0x4d')]['id']}})[_0x184f('0x29')](handleEntityNotFound(_0x497257,null))['then'](function(_0x4fedef){if(_0x4fedef){_0x15bacf=_0x4fedef;_0x58da70['model']=_['keys'](db['Tag'][_0x184f('0x48')]);_0x58da70['query']=_[_0x184f('0x47')](_0x91bef4['query']);_0x58da70[_0x184f('0x36')]=_['intersection'](_0x58da70[_0x184f('0x33')],_0x58da70[_0x184f('0x35')]);_0x420864[_0x184f('0x37')]=_['intersection'](_0x58da70['model'],qs[_0x184f('0x39')](_0x91bef4[_0x184f('0x35')][_0x184f('0x39')]));_0x420864[_0x184f('0x37')]=_0x420864['attributes'][_0x184f('0x3a')]?_0x420864[_0x184f('0x37')]:_0x58da70[_0x184f('0x33')];_0x420864[_0x184f('0x3d')]=qs['sort'](_0x91bef4[_0x184f('0x35')]['sort']);_0x420864[_0x184f('0x3f')]=qs['filters'](_[_0x184f('0x40')](_0x91bef4[_0x184f('0x35')],_0x58da70[_0x184f('0x36')]));if(_0x91bef4[_0x184f('0x35')]['filter']){_0x420864[_0x184f('0x3f')]=_[_0x184f('0x41')](_0x420864[_0x184f('0x3f')],{'$or':_[_0x184f('0x34')](_0x420864[_0x184f('0x37')],function(_0x2769d1){var _0x56aa08={};_0x56aa08[_0x2769d1]={'$like':'%'+_0x91bef4[_0x184f('0x35')][_0x184f('0x43')]+'%'};return _0x56aa08;})});}_0x420864=_[_0x184f('0x41')]({},_0x420864,_0x91bef4['options']);return _0x15bacf[_0x184f('0x54')](_0x420864);}})['then'](function(_0x1d1429){if(_0x1d1429){_0x185ef2=_0x1d1429['length'];if(!_0x91bef4[_0x184f('0x35')][_0x184f('0x3b')](_0x184f('0x3c'))){_0x420864[_0x184f('0x22')]=qs[_0x184f('0x22')](_0x91bef4[_0x184f('0x35')][_0x184f('0x22')]);_0x420864[_0x184f('0x20')]=qs[_0x184f('0x20')](_0x91bef4[_0x184f('0x35')]['offset']);}return _0x15bacf[_0x184f('0x54')](_0x420864);}})[_0x184f('0x29')](function(_0x377401){if(_0x377401){return _0x377401?{'count':_0x185ef2,'rows':_0x377401}:null;}})[_0x184f('0x29')](respondWithResult(_0x497257,null))['catch'](handleError(_0x497257,null));};exports[_0x184f('0x55')]=function(_0x14f1ea,_0x34ab19,_0x1d6f60){if(_0x14f1ea[_0x184f('0x4c')]['id']){delete _0x14f1ea['body']['id'];}return db[_0x184f('0x2f')][_0x184f('0x50')]({'where':{'id':_0x14f1ea[_0x184f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ab19,null))[_0x184f('0x29')](function(_0x109114){if(_0x109114){return _0x109114['setTags'](_0x14f1ea[_0x184f('0x4c')][_0x184f('0x56')]||[]);}return null;})['then'](respondWithResult(_0x34ab19,null))[_0x184f('0x4a')](handleError(_0x34ab19,null));}; \ No newline at end of file +var _0x1b55=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','then','include','findAll','catch','show','params','includeAll','find','create','body','getFields','findOne','DeskField','length','nolimit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x19f424,_0x5b593d){var _0x369d21=function(_0x471715){while(--_0x471715){_0x19f424['push'](_0x19f424['shift']());}};_0x369d21(++_0x5b593d);}(_0x1b55,0x13a));var _0x51b5=function(_0x34f32c,_0x39fe66){_0x34f32c=_0x34f32c-0x0;var _0x54de91=_0x1b55[_0x34f32c];return _0x54de91;};'use strict';var emlformat=require(_0x51b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51b5('0x2'));var moment=require(_0x51b5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51b5('0x4'));var util=require('util');var path=require(_0x51b5('0x5'));var sox=require(_0x51b5('0x6'));var csv=require(_0x51b5('0x7'));var ejs=require(_0x51b5('0x8'));var fs=require('fs');var fs_extra=require(_0x51b5('0x9'));var _=require('lodash');var squel=require(_0x51b5('0xa'));var crypto=require(_0x51b5('0xb'));var jsforce=require(_0x51b5('0xc'));var deskjs=require(_0x51b5('0xd'));var toCsv=require(_0x51b5('0x7'));var querystring=require(_0x51b5('0xe'));var Papa=require('papaparse');var Redis=require(_0x51b5('0xf'));var authService=require(_0x51b5('0x10'));var qs=require(_0x51b5('0x11'));var as=require(_0x51b5('0x12'));var hardwareService=require(_0x51b5('0x13'));var logger=require('../../config/logger')(_0x51b5('0x14'));var utils=require(_0x51b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x51b5('0x16'));var db=require(_0x51b5('0x17'))['db'];function respondWithStatusCode(_0x596386,_0x15e027){_0x15e027=_0x15e027||0xcc;return function(_0x51c93f){if(_0x51c93f){return _0x596386[_0x51b5('0x18')](_0x15e027);}return _0x596386[_0x51b5('0x19')](_0x15e027)[_0x51b5('0x1a')]();};}function respondWithResult(_0x5f0549,_0x4ceb8d){_0x4ceb8d=_0x4ceb8d||0xc8;return function(_0x11d4f8){if(_0x11d4f8){return _0x5f0549[_0x51b5('0x19')](_0x4ceb8d)[_0x51b5('0x1b')](_0x11d4f8);}};}function respondWithFilteredResult(_0x315f95,_0x399aaf){return function(_0x26f884){if(_0x26f884){var _0x2dcaf0=typeof _0x399aaf[_0x51b5('0x1c')]===_0x51b5('0x1d')&&typeof _0x399aaf[_0x51b5('0x1e')]==='undefined';var _0xe0b38e=_0x26f884[_0x51b5('0x1f')];var _0x21f174=_0x2dcaf0?0x0:_0x399aaf[_0x51b5('0x1c')];var _0x29a5c2=_0x2dcaf0?_0x26f884[_0x51b5('0x1f')]:_0x399aaf[_0x51b5('0x1c')]+_0x399aaf[_0x51b5('0x1e')];var _0x4a1e03;if(_0x29a5c2>=_0xe0b38e){_0x29a5c2=_0xe0b38e;_0x4a1e03=0xc8;}else{_0x4a1e03=0xce;}_0x315f95['status'](_0x4a1e03);return _0x315f95[_0x51b5('0x20')](_0x51b5('0x21'),_0x21f174+'-'+_0x29a5c2+'/'+_0xe0b38e)['json'](_0x26f884);}return null;};}function patchUpdates(_0x5eed70){return function(_0x3ebe6b){try{jsonpatch[_0x51b5('0x22')](_0x3ebe6b,_0x5eed70,!![]);}catch(_0x5f38e9){return BPromise[_0x51b5('0x23')](_0x5f38e9);}return _0x3ebe6b['save']();};}function saveUpdates(_0xf87017,_0x15f59a){return function(_0x2a4ba2){if(_0x2a4ba2){return _0x2a4ba2[_0x51b5('0x24')](_0xf87017)['then'](function(_0x145038){return _0x145038;});}return null;};}function removeEntity(_0x5669c9,_0x129e9d){return function(_0xbe4c5a){if(_0xbe4c5a){return _0xbe4c5a[_0x51b5('0x25')]()['then'](function(){_0x5669c9[_0x51b5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c157f,_0x13dd77){return function(_0x4c0f00){if(!_0x4c0f00){_0x2c157f['sendStatus'](0x194);}return _0x4c0f00;};}function handleError(_0x53bc14,_0xac685){_0xac685=_0xac685||0x1f4;return function(_0x3b4a35){logger[_0x51b5('0x26')](_0x3b4a35[_0x51b5('0x27')]);if(_0x3b4a35['name']){delete _0x3b4a35[_0x51b5('0x28')];}_0x53bc14[_0x51b5('0x19')](_0xac685)[_0x51b5('0x29')](_0x3b4a35);};}exports[_0x51b5('0x2a')]=function(_0x5398fc,_0x157625){var _0x13c989={},_0x58b6ab={},_0x1a217a={'count':0x0,'rows':[]};var _0x220c30=_[_0x51b5('0x2b')](db[_0x51b5('0x2c')][_0x51b5('0x2d')],function(_0x170fff){return{'name':_0x170fff[_0x51b5('0x2e')],'type':_0x170fff[_0x51b5('0x2f')]['key']};});_0x58b6ab[_0x51b5('0x30')]=_[_0x51b5('0x2b')](_0x220c30,'name');_0x58b6ab[_0x51b5('0x31')]=_[_0x51b5('0x32')](_0x5398fc[_0x51b5('0x31')]);_0x58b6ab[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x58b6ab['model'],_0x58b6ab['query']);_0x13c989[_0x51b5('0x35')]=_[_0x51b5('0x34')](_0x58b6ab['model'],qs['fields'](_0x5398fc[_0x51b5('0x31')][_0x51b5('0x36')]));_0x13c989['attributes']=_0x13c989['attributes']['length']?_0x13c989['attributes']:_0x58b6ab['model'];if(!_0x5398fc[_0x51b5('0x31')][_0x51b5('0x37')]('nolimit')){_0x13c989[_0x51b5('0x1e')]=qs[_0x51b5('0x1e')](_0x5398fc[_0x51b5('0x31')][_0x51b5('0x1e')]);_0x13c989[_0x51b5('0x1c')]=qs[_0x51b5('0x1c')](_0x5398fc[_0x51b5('0x31')][_0x51b5('0x1c')]);}_0x13c989[_0x51b5('0x38')]=qs[_0x51b5('0x39')](_0x5398fc[_0x51b5('0x31')][_0x51b5('0x39')]);_0x13c989[_0x51b5('0x3a')]=qs[_0x51b5('0x33')](_['pick'](_0x5398fc[_0x51b5('0x31')],_0x58b6ab[_0x51b5('0x33')]),_0x220c30);if(_0x5398fc[_0x51b5('0x31')]['filter']){_0x13c989['where']=_['merge'](_0x13c989[_0x51b5('0x3a')],{'$or':_['map'](_0x220c30,function(_0x5b27e9){if(_0x5b27e9[_0x51b5('0x2f')]!==_0x51b5('0x3b')){var _0xd675ed={};_0xd675ed[_0x5b27e9[_0x51b5('0x28')]]={'$like':'%'+_0x5398fc['query'][_0x51b5('0x3c')]+'%'};return _0xd675ed;}})});}_0x13c989=_[_0x51b5('0x3d')]({},_0x13c989,_0x5398fc[_0x51b5('0x3e')]);var _0x52585f={'where':_0x13c989[_0x51b5('0x3a')]};return db['DeskConfiguration']['count'](_0x52585f)[_0x51b5('0x3f')](function(_0x2967de){_0x1a217a['count']=_0x2967de;if(_0x5398fc[_0x51b5('0x31')]['includeAll']){_0x13c989[_0x51b5('0x40')]=[{'all':!![]}];}return db[_0x51b5('0x2c')][_0x51b5('0x41')](_0x13c989);})[_0x51b5('0x3f')](function(_0x2ad118){_0x1a217a['rows']=_0x2ad118;return _0x1a217a;})[_0x51b5('0x3f')](respondWithFilteredResult(_0x157625,_0x13c989))[_0x51b5('0x42')](handleError(_0x157625,null));};exports[_0x51b5('0x43')]=function(_0x13b088,_0x1191f9){var _0x3221de={'raw':![],'where':{'id':_0x13b088[_0x51b5('0x44')]['id']}},_0x53801c={};_0x53801c[_0x51b5('0x30')]=_[_0x51b5('0x32')](db['DeskConfiguration'][_0x51b5('0x2d')]);_0x53801c[_0x51b5('0x31')]=_[_0x51b5('0x32')](_0x13b088[_0x51b5('0x31')]);_0x53801c[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x53801c[_0x51b5('0x30')],_0x53801c[_0x51b5('0x31')]);_0x3221de[_0x51b5('0x35')]=_[_0x51b5('0x34')](_0x53801c['model'],qs[_0x51b5('0x36')](_0x13b088['query'][_0x51b5('0x36')]));_0x3221de[_0x51b5('0x35')]=_0x3221de[_0x51b5('0x35')]['length']?_0x3221de[_0x51b5('0x35')]:_0x53801c[_0x51b5('0x30')];if(_0x13b088[_0x51b5('0x31')][_0x51b5('0x45')]){_0x3221de[_0x51b5('0x40')]=[{'all':!![]}];}_0x3221de=_[_0x51b5('0x3d')]({},_0x3221de,_0x13b088['options']);return db[_0x51b5('0x2c')][_0x51b5('0x46')](_0x3221de)[_0x51b5('0x3f')](handleEntityNotFound(_0x1191f9,null))[_0x51b5('0x3f')](respondWithResult(_0x1191f9,null))['catch'](handleError(_0x1191f9,null));};exports['create']=function(_0x9c8394,_0x2a5a33){return db[_0x51b5('0x2c')][_0x51b5('0x47')](_0x9c8394[_0x51b5('0x48')],{})[_0x51b5('0x3f')](respondWithResult(_0x2a5a33,0xc9))[_0x51b5('0x42')](handleError(_0x2a5a33,null));};exports[_0x51b5('0x24')]=function(_0x595e67,_0x581ce2){if(_0x595e67[_0x51b5('0x48')]['id']){delete _0x595e67[_0x51b5('0x48')]['id'];}return db[_0x51b5('0x2c')]['find']({'where':{'id':_0x595e67[_0x51b5('0x44')]['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x581ce2,null))[_0x51b5('0x3f')](saveUpdates(_0x595e67['body'],null))[_0x51b5('0x3f')](respondWithResult(_0x581ce2,null))[_0x51b5('0x42')](handleError(_0x581ce2,null));};exports[_0x51b5('0x25')]=function(_0x11d6cb,_0x2cc46d){return db[_0x51b5('0x2c')][_0x51b5('0x46')]({'where':{'id':_0x11d6cb[_0x51b5('0x44')]['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x2cc46d,null))[_0x51b5('0x3f')](removeEntity(_0x2cc46d,null))[_0x51b5('0x42')](handleError(_0x2cc46d,null));};exports[_0x51b5('0x49')]=function(_0x122223,_0x10e12b,_0x51af28){var _0x30a544={};var _0x56c35a={};var _0x39fad1;var _0x193b99;return db[_0x51b5('0x2c')][_0x51b5('0x4a')]({'where':{'id':_0x122223[_0x51b5('0x44')]['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x10e12b,null))['then'](function(_0x1871aa){if(_0x1871aa){_0x39fad1=_0x1871aa;_0x56c35a[_0x51b5('0x30')]=_[_0x51b5('0x32')](db[_0x51b5('0x4b')]['rawAttributes']);_0x56c35a[_0x51b5('0x31')]=_[_0x51b5('0x32')](_0x122223[_0x51b5('0x31')]);_0x56c35a[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x56c35a[_0x51b5('0x30')],_0x56c35a[_0x51b5('0x31')]);_0x30a544[_0x51b5('0x35')]=_[_0x51b5('0x34')](_0x56c35a[_0x51b5('0x30')],qs[_0x51b5('0x36')](_0x122223[_0x51b5('0x31')]['fields']));_0x30a544[_0x51b5('0x35')]=_0x30a544[_0x51b5('0x35')][_0x51b5('0x4c')]?_0x30a544['attributes']:_0x56c35a[_0x51b5('0x30')];_0x30a544['order']=qs[_0x51b5('0x39')](_0x122223['query'][_0x51b5('0x39')]);_0x30a544[_0x51b5('0x3a')]=qs['filters'](_['pick'](_0x122223[_0x51b5('0x31')],_0x56c35a[_0x51b5('0x33')]));if(_0x122223['query']['filter']){_0x30a544[_0x51b5('0x3a')]=_[_0x51b5('0x3d')](_0x30a544[_0x51b5('0x3a')],{'$or':_[_0x51b5('0x2b')](_0x30a544['attributes'],function(_0x5d27f3){var _0x1db5c3={};_0x1db5c3[_0x5d27f3]={'$like':'%'+_0x122223[_0x51b5('0x31')][_0x51b5('0x3c')]+'%'};return _0x1db5c3;})});}_0x30a544=_[_0x51b5('0x3d')]({},_0x30a544,_0x122223['options']);return _0x39fad1[_0x51b5('0x49')](_0x30a544);}})[_0x51b5('0x3f')](function(_0x26c9f6){if(_0x26c9f6){_0x193b99=_0x26c9f6['length'];if(!_0x122223[_0x51b5('0x31')][_0x51b5('0x37')](_0x51b5('0x4d'))){_0x30a544['limit']=qs[_0x51b5('0x1e')](_0x122223[_0x51b5('0x31')][_0x51b5('0x1e')]);_0x30a544[_0x51b5('0x1c')]=qs[_0x51b5('0x1c')](_0x122223[_0x51b5('0x31')]['offset']);}return _0x39fad1[_0x51b5('0x49')](_0x30a544);}})[_0x51b5('0x3f')](function(_0x246bf5){if(_0x246bf5){return _0x246bf5?{'count':_0x193b99,'rows':_0x246bf5}:null;}})['then'](respondWithResult(_0x10e12b,null))[_0x51b5('0x42')](handleError(_0x10e12b,null));};exports[_0x51b5('0x4e')]=function(_0x166780,_0x388fc3,_0x9399a3){var _0x5d33e1={};var _0x5ada4d={};var _0x2431b1;var _0x16c01c;return db[_0x51b5('0x2c')][_0x51b5('0x4a')]({'where':{'id':_0x166780[_0x51b5('0x44')]['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x388fc3,null))[_0x51b5('0x3f')](function(_0x3d5b66){if(_0x3d5b66){_0x2431b1=_0x3d5b66;_0x5ada4d[_0x51b5('0x30')]=_[_0x51b5('0x32')](db[_0x51b5('0x4b')]['rawAttributes']);_0x5ada4d[_0x51b5('0x31')]=_[_0x51b5('0x32')](_0x166780[_0x51b5('0x31')]);_0x5ada4d[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x5ada4d['model'],_0x5ada4d[_0x51b5('0x31')]);_0x5d33e1[_0x51b5('0x35')]=_[_0x51b5('0x34')](_0x5ada4d['model'],qs[_0x51b5('0x36')](_0x166780['query'][_0x51b5('0x36')]));_0x5d33e1[_0x51b5('0x35')]=_0x5d33e1[_0x51b5('0x35')][_0x51b5('0x4c')]?_0x5d33e1['attributes']:_0x5ada4d['model'];_0x5d33e1[_0x51b5('0x38')]=qs['sort'](_0x166780[_0x51b5('0x31')][_0x51b5('0x39')]);_0x5d33e1[_0x51b5('0x3a')]=qs['filters'](_[_0x51b5('0x4f')](_0x166780[_0x51b5('0x31')],_0x5ada4d[_0x51b5('0x33')]));if(_0x166780[_0x51b5('0x31')][_0x51b5('0x3c')]){_0x5d33e1[_0x51b5('0x3a')]=_['merge'](_0x5d33e1[_0x51b5('0x3a')],{'$or':_[_0x51b5('0x2b')](_0x5d33e1[_0x51b5('0x35')],function(_0x5d8900){var _0x1d8022={};_0x1d8022[_0x5d8900]={'$like':'%'+_0x166780[_0x51b5('0x31')]['filter']+'%'};return _0x1d8022;})});}_0x5d33e1=_[_0x51b5('0x3d')]({},_0x5d33e1,_0x166780[_0x51b5('0x3e')]);return _0x2431b1[_0x51b5('0x4e')](_0x5d33e1);}})[_0x51b5('0x3f')](function(_0x424c49){if(_0x424c49){_0x16c01c=_0x424c49[_0x51b5('0x4c')];if(!_0x166780[_0x51b5('0x31')][_0x51b5('0x37')](_0x51b5('0x4d'))){_0x5d33e1['limit']=qs[_0x51b5('0x1e')](_0x166780[_0x51b5('0x31')][_0x51b5('0x1e')]);_0x5d33e1[_0x51b5('0x1c')]=qs[_0x51b5('0x1c')](_0x166780[_0x51b5('0x31')]['offset']);}return _0x2431b1[_0x51b5('0x4e')](_0x5d33e1);}})[_0x51b5('0x3f')](function(_0x236df3){if(_0x236df3){return _0x236df3?{'count':_0x16c01c,'rows':_0x236df3}:null;}})[_0x51b5('0x3f')](respondWithResult(_0x388fc3,null))[_0x51b5('0x42')](handleError(_0x388fc3,null));};exports[_0x51b5('0x50')]=function(_0xb62094,_0xb18b43,_0x3ee8fb){var _0x5014d4={};var _0x23bcd9={};var _0x48b390;var _0x141acb;return db[_0x51b5('0x2c')][_0x51b5('0x4a')]({'where':{'id':_0xb62094[_0x51b5('0x44')]['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0xb18b43,null))[_0x51b5('0x3f')](function(_0xc6506c){if(_0xc6506c){_0x48b390=_0xc6506c;_0x23bcd9[_0x51b5('0x30')]=_['keys'](db[_0x51b5('0x4b')]['rawAttributes']);_0x23bcd9[_0x51b5('0x31')]=_[_0x51b5('0x32')](_0xb62094[_0x51b5('0x31')]);_0x23bcd9[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x23bcd9[_0x51b5('0x30')],_0x23bcd9[_0x51b5('0x31')]);_0x5014d4[_0x51b5('0x35')]=_['intersection'](_0x23bcd9[_0x51b5('0x30')],qs[_0x51b5('0x36')](_0xb62094['query'][_0x51b5('0x36')]));_0x5014d4['attributes']=_0x5014d4[_0x51b5('0x35')][_0x51b5('0x4c')]?_0x5014d4['attributes']:_0x23bcd9[_0x51b5('0x30')];_0x5014d4[_0x51b5('0x38')]=qs[_0x51b5('0x39')](_0xb62094[_0x51b5('0x31')]['sort']);_0x5014d4['where']=qs[_0x51b5('0x33')](_['pick'](_0xb62094[_0x51b5('0x31')],_0x23bcd9['filters']));if(_0xb62094[_0x51b5('0x31')]['filter']){_0x5014d4[_0x51b5('0x3a')]=_[_0x51b5('0x3d')](_0x5014d4['where'],{'$or':_[_0x51b5('0x2b')](_0x5014d4[_0x51b5('0x35')],function(_0x231b67){var _0x4cf45b={};_0x4cf45b[_0x231b67]={'$like':'%'+_0xb62094[_0x51b5('0x31')][_0x51b5('0x3c')]+'%'};return _0x4cf45b;})});}_0x5014d4=_[_0x51b5('0x3d')]({},_0x5014d4,_0xb62094[_0x51b5('0x3e')]);return _0x48b390[_0x51b5('0x50')](_0x5014d4);}})[_0x51b5('0x3f')](function(_0x1405d4){if(_0x1405d4){_0x141acb=_0x1405d4['length'];if(!_0xb62094['query']['hasOwnProperty'](_0x51b5('0x4d'))){_0x5014d4[_0x51b5('0x1e')]=qs[_0x51b5('0x1e')](_0xb62094[_0x51b5('0x31')][_0x51b5('0x1e')]);_0x5014d4[_0x51b5('0x1c')]=qs[_0x51b5('0x1c')](_0xb62094[_0x51b5('0x31')][_0x51b5('0x1c')]);}return _0x48b390[_0x51b5('0x50')](_0x5014d4);}})[_0x51b5('0x3f')](function(_0x4539ca){if(_0x4539ca){return _0x4539ca?{'count':_0x141acb,'rows':_0x4539ca}:null;}})['then'](respondWithResult(_0xb18b43,null))[_0x51b5('0x42')](handleError(_0xb18b43,null));};exports[_0x51b5('0x51')]=function(_0x2fd4ca,_0x1ef8d0,_0xc35a69){var _0xae8051={};var _0x4f2ba5={};var _0x57bbc4;var _0x544d57;return db[_0x51b5('0x2c')][_0x51b5('0x4a')]({'where':{'id':_0x2fd4ca['params']['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x1ef8d0,null))[_0x51b5('0x3f')](function(_0x1e0183){if(_0x1e0183){_0x57bbc4=_0x1e0183;_0x4f2ba5[_0x51b5('0x30')]=_[_0x51b5('0x32')](db[_0x51b5('0x52')][_0x51b5('0x2d')]);_0x4f2ba5['query']=_['keys'](_0x2fd4ca[_0x51b5('0x31')]);_0x4f2ba5[_0x51b5('0x33')]=_[_0x51b5('0x34')](_0x4f2ba5[_0x51b5('0x30')],_0x4f2ba5[_0x51b5('0x31')]);_0xae8051[_0x51b5('0x35')]=_['intersection'](_0x4f2ba5[_0x51b5('0x30')],qs[_0x51b5('0x36')](_0x2fd4ca['query'][_0x51b5('0x36')]));_0xae8051[_0x51b5('0x35')]=_0xae8051[_0x51b5('0x35')]['length']?_0xae8051[_0x51b5('0x35')]:_0x4f2ba5[_0x51b5('0x30')];_0xae8051['order']=qs['sort'](_0x2fd4ca['query'][_0x51b5('0x39')]);_0xae8051[_0x51b5('0x3a')]=qs[_0x51b5('0x33')](_['pick'](_0x2fd4ca['query'],_0x4f2ba5['filters']));if(_0x2fd4ca[_0x51b5('0x31')][_0x51b5('0x3c')]){_0xae8051[_0x51b5('0x3a')]=_[_0x51b5('0x3d')](_0xae8051['where'],{'$or':_[_0x51b5('0x2b')](_0xae8051[_0x51b5('0x35')],function(_0x3f015f){var _0x1c03f6={};_0x1c03f6[_0x3f015f]={'$like':'%'+_0x2fd4ca[_0x51b5('0x31')][_0x51b5('0x3c')]+'%'};return _0x1c03f6;})});}_0xae8051=_['merge']({},_0xae8051,_0x2fd4ca['options']);return _0x57bbc4['getTags'](_0xae8051);}})[_0x51b5('0x3f')](function(_0x24ac05){if(_0x24ac05){_0x544d57=_0x24ac05[_0x51b5('0x4c')];if(!_0x2fd4ca[_0x51b5('0x31')][_0x51b5('0x37')](_0x51b5('0x4d'))){_0xae8051[_0x51b5('0x1e')]=qs[_0x51b5('0x1e')](_0x2fd4ca[_0x51b5('0x31')][_0x51b5('0x1e')]);_0xae8051[_0x51b5('0x1c')]=qs[_0x51b5('0x1c')](_0x2fd4ca[_0x51b5('0x31')][_0x51b5('0x1c')]);}return _0x57bbc4[_0x51b5('0x51')](_0xae8051);}})[_0x51b5('0x3f')](function(_0x2df6a7){if(_0x2df6a7){return _0x2df6a7?{'count':_0x544d57,'rows':_0x2df6a7}:null;}})['then'](respondWithResult(_0x1ef8d0,null))['catch'](handleError(_0x1ef8d0,null));};exports[_0x51b5('0x53')]=function(_0x4493b2,_0x3eb630,_0xf7efdf){if(_0x4493b2[_0x51b5('0x48')]['id']){delete _0x4493b2[_0x51b5('0x48')]['id'];}return db[_0x51b5('0x2c')]['findOne']({'where':{'id':_0x4493b2['params']['id']}})[_0x51b5('0x3f')](handleEntityNotFound(_0x3eb630,null))[_0x51b5('0x3f')](function(_0xa6459e){if(_0xa6459e){return _0xa6459e[_0x51b5('0x53')](_0x4493b2['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x3eb630,null))['catch'](handleError(_0x3eb630,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9a31320..72017b9 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 _0xed60=['util','api','moment','request-promise','path','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x5101b8,_0xe57d1d){var _0x4644e0=function(_0x4a6bd1){while(--_0x4a6bd1){_0x5101b8['push'](_0x5101b8['shift']());}};_0x4644e0(++_0xe57d1d);}(_0xed60,0x81));var _0x0ed6=function(_0x27d1eb,_0x308210){_0x27d1eb=_0x27d1eb-0x0;var _0x2f3c57=_0xed60[_0x27d1eb];return _0x2f3c57;};'use strict';var _=require(_0x0ed6('0x0'));var util=require(_0x0ed6('0x1'));var logger=require('../../config/logger')(_0x0ed6('0x2'));var moment=require(_0x0ed6('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ed6('0x4'));var fs=require('fs');var path=require(_0x0ed6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ed6('0x6'));module[_0x0ed6('0x7')]=function(_0x453996,_0x12d9da){return _0x453996['define'](_0x0ed6('0x8'),attributes,{'tableName':_0x0ed6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd461=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x3015f9,_0x6eeb0d){var _0x3390b6=function(_0x4cff57){while(--_0x4cff57){_0x3015f9['push'](_0x3015f9['shift']());}};_0x3390b6(++_0x6eeb0d);}(_0xd461,0x13f));var _0x1d46=function(_0x275dae,_0x54e496){_0x275dae=_0x275dae-0x0;var _0x4c7a18=_0xd461[_0x275dae];return _0x4c7a18;};'use strict';var _=require('lodash');var util=require(_0x1d46('0x0'));var logger=require('../../config/logger')(_0x1d46('0x1'));var moment=require(_0x1d46('0x2'));var BPromise=require(_0x1d46('0x3'));var rp=require(_0x1d46('0x4'));var fs=require('fs');var path=require(_0x1d46('0x5'));var rimraf=require(_0x1d46('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x1d46('0x7')]=function(_0x47e18e,_0xcdf505){return _0x47e18e[_0x1d46('0x8')](_0x1d46('0x9'),attributes,{'tableName':_0x1d46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index ac37081..0e70084 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 _0xfd7b=['request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x51df00,_0x4ac573){var _0x198328=function(_0x24e0ec){while(--_0x24e0ec){_0x51df00['push'](_0x51df00['shift']());}};_0x198328(++_0x4ac573);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xfd7b[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var moment=require(_0xbfd7('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfd7('0x6'))(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbfd7('0x9')][_0xbfd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3d61,_0x4210a0,_0x4f25bf){return new BPromise(function(_0x174ff2,_0x51e9cf){return client[_0xbfd7('0xb')](_0x5e3d61,_0x4f25bf)['then'](function(_0x52cc23){logger[_0xbfd7('0xc')](_0xbfd7('0xd'),_0x4210a0,_0xbfd7('0xe'));logger[_0xbfd7('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4210a0,_0xbfd7('0xe'),JSON[_0xbfd7('0x10')](_0x52cc23));if(_0x52cc23[_0xbfd7('0x11')]){if(_0x52cc23['error'][_0xbfd7('0x12')]===0x1f4){logger[_0xbfd7('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x4210a0,_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);return _0x51e9cf(_0x52cc23['error'][_0xbfd7('0x13')]);}logger[_0xbfd7('0x11')](_0xbfd7('0xd'),_0x4210a0,_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);return _0x174ff2(_0x52cc23[_0xbfd7('0x11')][_0xbfd7('0x13')]);}else{logger[_0xbfd7('0xc')](_0xbfd7('0xd'),_0x4210a0,_0xbfd7('0xe'));_0x174ff2(_0x52cc23[_0xbfd7('0x14')][_0xbfd7('0x13')]);}})[_0xbfd7('0x15')](function(_0x19b889){logger[_0xbfd7('0x11')](_0xbfd7('0xd'),_0x4210a0,_0x19b889);_0x51e9cf(_0x19b889);});});} \ No newline at end of file +var _0xa547=['DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0xee1455,_0x24b625){var _0x395717=function(_0x3362cd){while(--_0x3362cd){_0xee1455['push'](_0xee1455['shift']());}};_0x395717(++_0x24b625);}(_0xa547,0xb0));var _0x7a54=function(_0x184327,_0x5251df){_0x184327=_0x184327-0x0;var _0x2c93fe=_0xa547[_0x184327];return _0x2c93fe;};'use strict';var _=require('lodash');var util=require(_0x7a54('0x0'));var moment=require('moment');var BPromise=require(_0x7a54('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a54('0x2'));var db=require(_0x7a54('0x3'))['db'];var utils=require(_0x7a54('0x4'));var logger=require(_0x7a54('0x5'))(_0x7a54('0x6'));var config=require(_0x7a54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a54('0x8')][_0x7a54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdeaa1c,_0x3f5dd7,_0x47c987){return new BPromise(function(_0x4fa36d,_0xc88c16){return client[_0x7a54('0xa')](_0xdeaa1c,_0x47c987)[_0x7a54('0xb')](function(_0x2b9188){logger[_0x7a54('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3f5dd7,'request\x20sent');logger['debug'](_0x7a54('0xd'),_0x3f5dd7,_0x7a54('0xe'),JSON[_0x7a54('0xf')](_0x2b9188));if(_0x2b9188[_0x7a54('0x10')]){if(_0x2b9188[_0x7a54('0x10')][_0x7a54('0x11')]===0x1f4){logger[_0x7a54('0x10')](_0x7a54('0x12'),_0x3f5dd7,_0x2b9188[_0x7a54('0x10')][_0x7a54('0x13')]);return _0xc88c16(_0x2b9188[_0x7a54('0x10')][_0x7a54('0x13')]);}logger['error'](_0x7a54('0x12'),_0x3f5dd7,_0x2b9188[_0x7a54('0x10')][_0x7a54('0x13')]);return _0x4fa36d(_0x2b9188[_0x7a54('0x10')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3f5dd7,'request\x20sent');_0x4fa36d(_0x2b9188[_0x7a54('0x14')][_0x7a54('0x13')]);}})['catch'](function(_0x1fcc0d){logger['error'](_0x7a54('0x12'),_0x3f5dd7,_0x1fcc0d);_0xc88c16(_0x1fcc0d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 36d0ff2..d010478 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 _0x8bf1=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var path=require(_0x18bf('0x2'));var timeout=require(_0x18bf('0x3'));var express=require(_0x18bf('0x4'));var router=express[_0x18bf('0x5')]();var fs_extra=require(_0x18bf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18bf('0x7'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0x18bf('0x8')]('/',auth[_0x18bf('0x9')](),controller['index']);router[_0x18bf('0x8')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xb')]);router['post']('/',auth[_0x18bf('0x9')](),controller['create']);router['put'](_0x18bf('0xa'),auth['isAuthenticated'](),controller[_0x18bf('0xc')]);router['delete']('/:id',auth[_0x18bf('0x9')](),controller[_0x18bf('0xd')]);module[_0x18bf('0xe')]=router; \ No newline at end of file +var _0x21fe=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post'];(function(_0xa6fa2c,_0x236532){var _0x6fbd44=function(_0xcd3772){while(--_0xcd3772){_0xa6fa2c['push'](_0xa6fa2c['shift']());}};_0x6fbd44(++_0x236532);}(_0x21fe,0x136));var _0xe21f=function(_0x3d5092,_0x54047f){_0x3d5092=_0x3d5092-0x0;var _0x4b825a=_0x21fe[_0x3d5092];return _0x4b825a;};'use strict';var multer=require(_0xe21f('0x0'));var util=require('util');var path=require(_0xe21f('0x1'));var timeout=require(_0xe21f('0x2'));var express=require(_0xe21f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe21f('0x4'));var interaction=require(_0xe21f('0x5'));var config=require(_0xe21f('0x6'));var controller=require(_0xe21f('0x7'));router[_0xe21f('0x8')]('/',auth[_0xe21f('0x9')](),controller['index']);router[_0xe21f('0x8')](_0xe21f('0xa'),auth[_0xe21f('0x9')](),controller[_0xe21f('0xb')]);router[_0xe21f('0xc')]('/',auth['isAuthenticated'](),controller[_0xe21f('0xd')]);router[_0xe21f('0xe')](_0xe21f('0xa'),auth[_0xe21f('0x9')](),controller[_0xe21f('0xf')]);router[_0xe21f('0x10')](_0xe21f('0xa'),auth[_0xe21f('0x9')](),controller[_0xe21f('0x11')]);module[_0xe21f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0d9aaf0..02ed580 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 _0x56d7=['ENUM','variable','customVariable','sequelize','string','STRING'];(function(_0x45567f,_0x8d2f0b){var _0x38e662=function(_0x15fbcb){while(--_0x15fbcb){_0x45567f['push'](_0x45567f['shift']());}};_0x38e662(++_0x8d2f0b);}(_0x56d7,0x1d7));var _0x756d=function(_0x5222cf,_0x469dc3){_0x5222cf=_0x5222cf-0x0;var _0x4ffa2e=_0x56d7[_0x5222cf];return _0x4ffa2e;};'use strict';var Sequelize=require(_0x756d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x756d('0x1'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x756d('0x1')},'content':{'type':Sequelize[_0x756d('0x2')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x756d('0x3')]('string',_0x756d('0x4'),_0x756d('0x5'))},'keyContent':{'type':Sequelize[_0x756d('0x2')]},'idField':{'type':Sequelize[_0x756d('0x2')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d6e=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x22a90a,_0x461cdd){var _0x511604=function(_0x273219){while(--_0x273219){_0x22a90a['push'](_0x22a90a['shift']());}};_0x511604(++_0x461cdd);}(_0x8d6e,0x126));var _0xe8d6=function(_0x3f22c2,_0x2379ab){_0x3f22c2=_0x3f22c2-0x0;var _0x229d9c=_0x8d6e[_0x3f22c2];return _0x229d9c;};'use strict';var Sequelize=require('sequelize');module[_0xe8d6('0x0')]={'type':{'type':Sequelize[_0xe8d6('0x1')](_0xe8d6('0x2'),_0xe8d6('0x3'),_0xe8d6('0x4'),_0xe8d6('0x5'),_0xe8d6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe8d6('0x7')]},'key':{'type':Sequelize[_0xe8d6('0x7')]},'keyType':{'type':Sequelize[_0xe8d6('0x1')](_0xe8d6('0x2'),_0xe8d6('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe8d6('0x7')]},'customField':{'type':Sequelize[_0xe8d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe8d6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7121cc7..f8a1dd6 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 _0x241e=['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','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','fieldName','key','map','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','DeskField','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x441abc,_0x4287bc){var _0x52bf3a=function(_0x1cef29){while(--_0x1cef29){_0x441abc['push'](_0x441abc['shift']());}};_0x52bf3a(++_0x4287bc);}(_0x241e,0x1b4));var _0xe241=function(_0x2be79e,_0x4ac3c7){_0x2be79e=_0x2be79e-0x0;var _0x11baf2=_0x241e[_0x2be79e];return _0x11baf2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe241('0x0'));var jsonpatch=require(_0xe241('0x1'));var rp=require('request-promise');var moment=require(_0xe241('0x2'));var BPromise=require(_0xe241('0x3'));var Mustache=require(_0xe241('0x4'));var util=require(_0xe241('0x5'));var path=require(_0xe241('0x6'));var sox=require(_0xe241('0x7'));var csv=require(_0xe241('0x8'));var ejs=require(_0xe241('0x9'));var fs=require('fs');var fs_extra=require(_0xe241('0xa'));var _=require(_0xe241('0xb'));var squel=require(_0xe241('0xc'));var crypto=require(_0xe241('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe241('0xe'));var toCsv=require(_0xe241('0x8'));var querystring=require(_0xe241('0xf'));var Papa=require('papaparse');var Redis=require(_0xe241('0x10'));var authService=require(_0xe241('0x11'));var qs=require(_0xe241('0x12'));var as=require(_0xe241('0x13'));var hardwareService=require(_0xe241('0x14'));var logger=require(_0xe241('0x15'))('api');var utils=require(_0xe241('0x16'));var config=require(_0xe241('0x17'));var licenseUtil=require(_0xe241('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47b5f0,_0x151258){_0x151258=_0x151258||0xcc;return function(_0x11b0cc){if(_0x11b0cc){return _0x47b5f0[_0xe241('0x19')](_0x151258);}return _0x47b5f0[_0xe241('0x1a')](_0x151258)[_0xe241('0x1b')]();};}function respondWithResult(_0x471de4,_0x15ad6c){_0x15ad6c=_0x15ad6c||0xc8;return function(_0x4e8f79){if(_0x4e8f79){return _0x471de4[_0xe241('0x1a')](_0x15ad6c)['json'](_0x4e8f79);}};}function respondWithFilteredResult(_0x214bf1,_0x411e0e){return function(_0x2260f3){if(_0x2260f3){var _0x4249ff=typeof _0x411e0e[_0xe241('0x1c')]===_0xe241('0x1d')&&typeof _0x411e0e[_0xe241('0x1e')]===_0xe241('0x1d');var _0x3602bd=_0x2260f3[_0xe241('0x1f')];var _0x4daafb=_0x4249ff?0x0:_0x411e0e[_0xe241('0x1c')];var _0xb62d55=_0x4249ff?_0x2260f3[_0xe241('0x1f')]:_0x411e0e[_0xe241('0x1c')]+_0x411e0e[_0xe241('0x1e')];var _0x13e181;if(_0xb62d55>=_0x3602bd){_0xb62d55=_0x3602bd;_0x13e181=0xc8;}else{_0x13e181=0xce;}_0x214bf1['status'](_0x13e181);return _0x214bf1[_0xe241('0x20')](_0xe241('0x21'),_0x4daafb+'-'+_0xb62d55+'/'+_0x3602bd)[_0xe241('0x22')](_0x2260f3);}return null;};}function patchUpdates(_0x30e988){return function(_0x28e89b){try{jsonpatch['apply'](_0x28e89b,_0x30e988,!![]);}catch(_0x10996a){return BPromise[_0xe241('0x23')](_0x10996a);}return _0x28e89b[_0xe241('0x24')]();};}function saveUpdates(_0x41bb04,_0x34baab){return function(_0x5e4e01){if(_0x5e4e01){return _0x5e4e01[_0xe241('0x25')](_0x41bb04)[_0xe241('0x26')](function(_0x558d22){return _0x558d22;});}return null;};}function removeEntity(_0x162e07,_0x1b8c23){return function(_0x5cd487){if(_0x5cd487){return _0x5cd487[_0xe241('0x27')]()[_0xe241('0x26')](function(){_0x162e07[_0xe241('0x1a')](0xcc)[_0xe241('0x1b')]();});}};}function handleEntityNotFound(_0x411e3c,_0x3d8fb9){return function(_0x3acea8){if(!_0x3acea8){_0x411e3c['sendStatus'](0x194);}return _0x3acea8;};}function handleError(_0x267fe3,_0x1bc6c3){_0x1bc6c3=_0x1bc6c3||0x1f4;return function(_0x1695ac){logger[_0xe241('0x28')](_0x1695ac[_0xe241('0x29')]);if(_0x1695ac[_0xe241('0x2a')]){delete _0x1695ac[_0xe241('0x2a')];}_0x267fe3[_0xe241('0x1a')](_0x1bc6c3)['send'](_0x1695ac);};}exports['index']=function(_0x272973,_0x1c32b5){var _0x2d213f={},_0x2042bf={},_0x521d1e={'count':0x0,'rows':[]};var _0x3399cc=_['map'](db['DeskField']['rawAttributes'],function(_0x3ece5d){return{'name':_0x3ece5d[_0xe241('0x2b')],'type':_0x3ece5d['type'][_0xe241('0x2c')]};});_0x2042bf['model']=_[_0xe241('0x2d')](_0x3399cc,_0xe241('0x2a'));_0x2042bf['query']=_[_0xe241('0x2e')](_0x272973[_0xe241('0x2f')]);_0x2042bf[_0xe241('0x30')]=_['intersection'](_0x2042bf[_0xe241('0x31')],_0x2042bf[_0xe241('0x2f')]);_0x2d213f[_0xe241('0x32')]=_[_0xe241('0x33')](_0x2042bf['model'],qs['fields'](_0x272973[_0xe241('0x2f')][_0xe241('0x34')]));_0x2d213f[_0xe241('0x32')]=_0x2d213f['attributes']['length']?_0x2d213f[_0xe241('0x32')]:_0x2042bf[_0xe241('0x31')];if(!_0x272973['query'][_0xe241('0x35')](_0xe241('0x36'))){_0x2d213f[_0xe241('0x1e')]=qs[_0xe241('0x1e')](_0x272973['query'][_0xe241('0x1e')]);_0x2d213f[_0xe241('0x1c')]=qs['offset'](_0x272973[_0xe241('0x2f')]['offset']);}_0x2d213f[_0xe241('0x37')]=qs[_0xe241('0x38')](_0x272973[_0xe241('0x2f')][_0xe241('0x38')]);_0x2d213f[_0xe241('0x39')]=qs[_0xe241('0x30')](_[_0xe241('0x3a')](_0x272973[_0xe241('0x2f')],_0x2042bf[_0xe241('0x30')]),_0x3399cc);if(_0x272973[_0xe241('0x2f')][_0xe241('0x3b')]){_0x2d213f[_0xe241('0x39')]=_[_0xe241('0x3c')](_0x2d213f['where'],{'$or':_[_0xe241('0x2d')](_0x3399cc,function(_0x1c7562){if(_0x1c7562[_0xe241('0x3d')]!==_0xe241('0x3e')){var _0x40b991={};_0x40b991[_0x1c7562[_0xe241('0x2a')]]={'$like':'%'+_0x272973[_0xe241('0x2f')][_0xe241('0x3b')]+'%'};return _0x40b991;}})});}_0x2d213f=_[_0xe241('0x3c')]({},_0x2d213f,_0x272973[_0xe241('0x3f')]);var _0x1650bb={'where':_0x2d213f[_0xe241('0x39')]};return db[_0xe241('0x40')]['count'](_0x1650bb)[_0xe241('0x26')](function(_0x25c1e1){_0x521d1e[_0xe241('0x1f')]=_0x25c1e1;if(_0x272973[_0xe241('0x2f')]['includeAll']){_0x2d213f[_0xe241('0x41')]=[{'all':!![]}];}return db['DeskField'][_0xe241('0x42')](_0x2d213f);})[_0xe241('0x26')](function(_0x32d735){_0x521d1e[_0xe241('0x43')]=_0x32d735;return _0x521d1e;})[_0xe241('0x26')](respondWithFilteredResult(_0x1c32b5,_0x2d213f))['catch'](handleError(_0x1c32b5,null));};exports[_0xe241('0x44')]=function(_0xd2c00c,_0x1c0912){var _0x3412c9={'raw':!![],'where':{'id':_0xd2c00c[_0xe241('0x45')]['id']}},_0x368625={};_0x368625[_0xe241('0x31')]=_[_0xe241('0x2e')](db[_0xe241('0x40')][_0xe241('0x46')]);_0x368625['query']=_['keys'](_0xd2c00c[_0xe241('0x2f')]);_0x368625[_0xe241('0x30')]=_['intersection'](_0x368625['model'],_0x368625[_0xe241('0x2f')]);_0x3412c9[_0xe241('0x32')]=_['intersection'](_0x368625[_0xe241('0x31')],qs[_0xe241('0x34')](_0xd2c00c[_0xe241('0x2f')][_0xe241('0x34')]));_0x3412c9['attributes']=_0x3412c9['attributes']['length']?_0x3412c9[_0xe241('0x32')]:_0x368625['model'];if(_0xd2c00c['query']['includeAll']){_0x3412c9[_0xe241('0x41')]=[{'all':!![]}];}_0x3412c9=_['merge']({},_0x3412c9,_0xd2c00c[_0xe241('0x3f')]);return db[_0xe241('0x40')][_0xe241('0x47')](_0x3412c9)[_0xe241('0x26')](handleEntityNotFound(_0x1c0912,null))[_0xe241('0x26')](respondWithResult(_0x1c0912,null))[_0xe241('0x48')](handleError(_0x1c0912,null));};exports[_0xe241('0x49')]=function(_0x2063f2,_0x309e02){return db[_0xe241('0x40')]['create'](_0x2063f2[_0xe241('0x4a')],{})['then'](respondWithResult(_0x309e02,0xc9))['catch'](handleError(_0x309e02,null));};exports['update']=function(_0x13c2b9,_0x5e6fe6){if(_0x13c2b9['body']['id']){delete _0x13c2b9[_0xe241('0x4a')]['id'];}return db[_0xe241('0x40')]['find']({'where':{'id':_0x13c2b9[_0xe241('0x45')]['id']}})[_0xe241('0x26')](handleEntityNotFound(_0x5e6fe6,null))['then'](saveUpdates(_0x13c2b9[_0xe241('0x4a')],null))['then'](respondWithResult(_0x5e6fe6,null))[_0xe241('0x48')](handleError(_0x5e6fe6,null));};exports[_0xe241('0x27')]=function(_0x5401b2,_0x1a0221){return db[_0xe241('0x40')]['find']({'where':{'id':_0x5401b2['params']['id']}})[_0xe241('0x26')](handleEntityNotFound(_0x1a0221,null))['then'](removeEntity(_0x1a0221,null))[_0xe241('0x48')](handleError(_0x1a0221,null));}; \ No newline at end of file +var _0xcc30=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xfd1424,_0x3b14fb){var _0x2d8c88=function(_0x5940dc){while(--_0x5940dc){_0xfd1424['push'](_0xfd1424['shift']());}};_0x2d8c88(++_0x3b14fb);}(_0xcc30,0x1a9));var _0x0cc3=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xcc30[_0x190ff6];return _0x5356d2;};'use strict';var emlformat=require(_0x0cc3('0x0'));var rimraf=require(_0x0cc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cc3('0x2'));var rp=require(_0x0cc3('0x3'));var moment=require('moment');var BPromise=require(_0x0cc3('0x4'));var Mustache=require(_0x0cc3('0x5'));var util=require(_0x0cc3('0x6'));var path=require(_0x0cc3('0x7'));var sox=require('sox');var csv=require(_0x0cc3('0x8'));var ejs=require(_0x0cc3('0x9'));var fs=require('fs');var fs_extra=require(_0x0cc3('0xa'));var _=require(_0x0cc3('0xb'));var squel=require(_0x0cc3('0xc'));var crypto=require(_0x0cc3('0xd'));var jsforce=require(_0x0cc3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0cc3('0x8'));var querystring=require(_0x0cc3('0xf'));var Papa=require(_0x0cc3('0x10'));var Redis=require(_0x0cc3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0cc3('0x12'));var hardwareService=require(_0x0cc3('0x13'));var logger=require(_0x0cc3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0cc3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cc3('0x16'))['db'];function respondWithStatusCode(_0x3f5860,_0x2b4a86){_0x2b4a86=_0x2b4a86||0xcc;return function(_0x11ab19){if(_0x11ab19){return _0x3f5860['sendStatus'](_0x2b4a86);}return _0x3f5860[_0x0cc3('0x17')](_0x2b4a86)[_0x0cc3('0x18')]();};}function respondWithResult(_0x3bae8f,_0x6df54c){_0x6df54c=_0x6df54c||0xc8;return function(_0x1e1799){if(_0x1e1799){return _0x3bae8f[_0x0cc3('0x17')](_0x6df54c)['json'](_0x1e1799);}};}function respondWithFilteredResult(_0x3c22e1,_0x1b731c){return function(_0x439ec8){if(_0x439ec8){var _0x46c93a=typeof _0x1b731c[_0x0cc3('0x19')]===_0x0cc3('0x1a')&&typeof _0x1b731c[_0x0cc3('0x1b')]===_0x0cc3('0x1a');var _0x3f0caf=_0x439ec8[_0x0cc3('0x1c')];var _0xacd3bb=_0x46c93a?0x0:_0x1b731c['offset'];var _0x1b2b30=_0x46c93a?_0x439ec8['count']:_0x1b731c['offset']+_0x1b731c[_0x0cc3('0x1b')];var _0x467555;if(_0x1b2b30>=_0x3f0caf){_0x1b2b30=_0x3f0caf;_0x467555=0xc8;}else{_0x467555=0xce;}_0x3c22e1['status'](_0x467555);return _0x3c22e1[_0x0cc3('0x1d')](_0x0cc3('0x1e'),_0xacd3bb+'-'+_0x1b2b30+'/'+_0x3f0caf)['json'](_0x439ec8);}return null;};}function patchUpdates(_0x26326a){return function(_0x1b59c2){try{jsonpatch['apply'](_0x1b59c2,_0x26326a,!![]);}catch(_0x4740e3){return BPromise[_0x0cc3('0x1f')](_0x4740e3);}return _0x1b59c2[_0x0cc3('0x20')]();};}function saveUpdates(_0x2a5add,_0x69962f){return function(_0x52c371){if(_0x52c371){return _0x52c371[_0x0cc3('0x21')](_0x2a5add)[_0x0cc3('0x22')](function(_0x38911b){return _0x38911b;});}return null;};}function removeEntity(_0x28081b,_0x2ea31a){return function(_0x58da38){if(_0x58da38){return _0x58da38[_0x0cc3('0x23')]()[_0x0cc3('0x22')](function(){_0x28081b[_0x0cc3('0x17')](0xcc)[_0x0cc3('0x18')]();});}};}function handleEntityNotFound(_0x545942,_0x313bca){return function(_0x931e3){if(!_0x931e3){_0x545942[_0x0cc3('0x24')](0x194);}return _0x931e3;};}function handleError(_0x370957,_0x59c7cd){_0x59c7cd=_0x59c7cd||0x1f4;return function(_0x39e725){logger[_0x0cc3('0x25')](_0x39e725['stack']);if(_0x39e725[_0x0cc3('0x26')]){delete _0x39e725[_0x0cc3('0x26')];}_0x370957[_0x0cc3('0x17')](_0x59c7cd)[_0x0cc3('0x27')](_0x39e725);};}exports[_0x0cc3('0x28')]=function(_0x44086b,_0x205230){var _0x56f813={},_0x423eef={},_0x1e9bc5={'count':0x0,'rows':[]};var _0x53a23f=_[_0x0cc3('0x29')](db[_0x0cc3('0x2a')][_0x0cc3('0x2b')],function(_0x4cbbdf){return{'name':_0x4cbbdf[_0x0cc3('0x2c')],'type':_0x4cbbdf[_0x0cc3('0x2d')][_0x0cc3('0x2e')]};});_0x423eef[_0x0cc3('0x2f')]=_[_0x0cc3('0x29')](_0x53a23f,_0x0cc3('0x26'));_0x423eef[_0x0cc3('0x30')]=_[_0x0cc3('0x31')](_0x44086b[_0x0cc3('0x30')]);_0x423eef['filters']=_['intersection'](_0x423eef['model'],_0x423eef[_0x0cc3('0x30')]);_0x56f813[_0x0cc3('0x32')]=_[_0x0cc3('0x33')](_0x423eef['model'],qs['fields'](_0x44086b[_0x0cc3('0x30')][_0x0cc3('0x34')]));_0x56f813[_0x0cc3('0x32')]=_0x56f813[_0x0cc3('0x32')][_0x0cc3('0x35')]?_0x56f813[_0x0cc3('0x32')]:_0x423eef[_0x0cc3('0x2f')];if(!_0x44086b['query'][_0x0cc3('0x36')](_0x0cc3('0x37'))){_0x56f813[_0x0cc3('0x1b')]=qs[_0x0cc3('0x1b')](_0x44086b[_0x0cc3('0x30')][_0x0cc3('0x1b')]);_0x56f813[_0x0cc3('0x19')]=qs['offset'](_0x44086b[_0x0cc3('0x30')][_0x0cc3('0x19')]);}_0x56f813[_0x0cc3('0x38')]=qs[_0x0cc3('0x39')](_0x44086b['query'][_0x0cc3('0x39')]);_0x56f813['where']=qs[_0x0cc3('0x3a')](_[_0x0cc3('0x3b')](_0x44086b[_0x0cc3('0x30')],_0x423eef[_0x0cc3('0x3a')]),_0x53a23f);if(_0x44086b['query'][_0x0cc3('0x3c')]){_0x56f813[_0x0cc3('0x3d')]=_[_0x0cc3('0x3e')](_0x56f813[_0x0cc3('0x3d')],{'$or':_[_0x0cc3('0x29')](_0x53a23f,function(_0x161bb0){if(_0x161bb0[_0x0cc3('0x2d')]!=='VIRTUAL'){var _0x2b8664={};_0x2b8664[_0x161bb0[_0x0cc3('0x26')]]={'$like':'%'+_0x44086b[_0x0cc3('0x30')][_0x0cc3('0x3c')]+'%'};return _0x2b8664;}})});}_0x56f813=_['merge']({},_0x56f813,_0x44086b[_0x0cc3('0x3f')]);var _0xe3442={'where':_0x56f813[_0x0cc3('0x3d')]};return db[_0x0cc3('0x2a')][_0x0cc3('0x1c')](_0xe3442)[_0x0cc3('0x22')](function(_0x17ebc2){_0x1e9bc5[_0x0cc3('0x1c')]=_0x17ebc2;if(_0x44086b[_0x0cc3('0x30')][_0x0cc3('0x40')]){_0x56f813[_0x0cc3('0x41')]=[{'all':!![]}];}return db[_0x0cc3('0x2a')]['findAll'](_0x56f813);})[_0x0cc3('0x22')](function(_0x55a406){_0x1e9bc5[_0x0cc3('0x42')]=_0x55a406;return _0x1e9bc5;})[_0x0cc3('0x22')](respondWithFilteredResult(_0x205230,_0x56f813))[_0x0cc3('0x43')](handleError(_0x205230,null));};exports[_0x0cc3('0x44')]=function(_0x59e880,_0x1e6964){var _0x2bebd7={'raw':!![],'where':{'id':_0x59e880[_0x0cc3('0x45')]['id']}},_0x129b08={};_0x129b08[_0x0cc3('0x2f')]=_[_0x0cc3('0x31')](db[_0x0cc3('0x2a')]['rawAttributes']);_0x129b08['query']=_[_0x0cc3('0x31')](_0x59e880[_0x0cc3('0x30')]);_0x129b08[_0x0cc3('0x3a')]=_[_0x0cc3('0x33')](_0x129b08[_0x0cc3('0x2f')],_0x129b08[_0x0cc3('0x30')]);_0x2bebd7[_0x0cc3('0x32')]=_[_0x0cc3('0x33')](_0x129b08[_0x0cc3('0x2f')],qs[_0x0cc3('0x34')](_0x59e880[_0x0cc3('0x30')]['fields']));_0x2bebd7['attributes']=_0x2bebd7[_0x0cc3('0x32')][_0x0cc3('0x35')]?_0x2bebd7[_0x0cc3('0x32')]:_0x129b08[_0x0cc3('0x2f')];if(_0x59e880['query'][_0x0cc3('0x40')]){_0x2bebd7[_0x0cc3('0x41')]=[{'all':!![]}];}_0x2bebd7=_['merge']({},_0x2bebd7,_0x59e880[_0x0cc3('0x3f')]);return db[_0x0cc3('0x2a')][_0x0cc3('0x46')](_0x2bebd7)[_0x0cc3('0x22')](handleEntityNotFound(_0x1e6964,null))[_0x0cc3('0x22')](respondWithResult(_0x1e6964,null))[_0x0cc3('0x43')](handleError(_0x1e6964,null));};exports['create']=function(_0x4b11c9,_0x3f8090){return db[_0x0cc3('0x2a')][_0x0cc3('0x47')](_0x4b11c9['body'],{})[_0x0cc3('0x22')](respondWithResult(_0x3f8090,0xc9))[_0x0cc3('0x43')](handleError(_0x3f8090,null));};exports[_0x0cc3('0x21')]=function(_0x4e5d98,_0xa5dc6a){if(_0x4e5d98[_0x0cc3('0x48')]['id']){delete _0x4e5d98['body']['id'];}return db[_0x0cc3('0x2a')][_0x0cc3('0x46')]({'where':{'id':_0x4e5d98[_0x0cc3('0x45')]['id']}})['then'](handleEntityNotFound(_0xa5dc6a,null))['then'](saveUpdates(_0x4e5d98[_0x0cc3('0x48')],null))[_0x0cc3('0x22')](respondWithResult(_0xa5dc6a,null))[_0x0cc3('0x43')](handleError(_0xa5dc6a,null));};exports[_0x0cc3('0x23')]=function(_0x1beb34,_0x4ea3c3){return db[_0x0cc3('0x2a')]['find']({'where':{'id':_0x1beb34[_0x0cc3('0x45')]['id']}})[_0x0cc3('0x22')](handleEntityNotFound(_0x4ea3c3,null))[_0x0cc3('0x22')](removeEntity(_0x4ea3c3,null))[_0x0cc3('0x43')](handleError(_0x4ea3c3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 1cb62ad..83ecf45 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 _0x6667=['FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x4563e6,_0x229ea7){var _0x18aeed=function(_0x26c2b1){while(--_0x26c2b1){_0x4563e6['push'](_0x4563e6['shift']());}};_0x18aeed(++_0x229ea7);}(_0x6667,0x1d5));var _0x7666=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x6667[_0x12a554];return _0x244ba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7666('0x0'))('api');var moment=require(_0x7666('0x1'));var BPromise=require(_0x7666('0x2'));var rp=require(_0x7666('0x3'));var fs=require('fs');var path=require(_0x7666('0x4'));var rimraf=require(_0x7666('0x5'));var config=require('../../config/environment');var attributes=require(_0x7666('0x6'));module[_0x7666('0x7')]=function(_0x42fcb4,_0x143fcf){return _0x42fcb4['define'](_0x7666('0x8'),attributes,{'tableName':_0x7666('0x9'),'paranoid':![],'indexes':[{'name':_0x7666('0xa'),'fields':[_0x7666('0xb'),_0x7666('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c7a=['rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x1d65f9,_0x2bac9e){var _0x274f74=function(_0x5bb6e3){while(--_0x5bb6e3){_0x1d65f9['push'](_0x1d65f9['shift']());}};_0x274f74(++_0x2bac9e);}(_0x9c7a,0x13d));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9c7('0x0'));var util=require('util');var logger=require(_0xa9c7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa9c7('0x2'));var rp=require(_0xa9c7('0x3'));var fs=require('fs');var path=require(_0xa9c7('0x4'));var rimraf=require(_0xa9c7('0x5'));var config=require(_0xa9c7('0x6'));var attributes=require(_0xa9c7('0x7'));module[_0xa9c7('0x8')]=function(_0x3a74ef,_0x2b2380){return _0x3a74ef['define'](_0xa9c7('0x9'),attributes,{'tableName':_0xa9c7('0xa'),'paranoid':![],'indexes':[{'name':_0xa9c7('0xb'),'fields':[_0xa9c7('0xc'),_0xa9c7('0xd')],'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 22926c6..54f8b8b 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 _0x85cc=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','DeskField,\x20%s,\x20%s'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x85cc,0xef));var _0xc85c=function(_0x3db02f,_0x7a9ed3){_0x3db02f=_0x3db02f-0x0;var _0x7383d4=_0x85cc[_0x3db02f];return _0x7383d4;};'use strict';var _=require(_0xc85c('0x0'));var util=require(_0xc85c('0x1'));var moment=require(_0xc85c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc85c('0x3'));var fs=require('fs');var Redis=require(_0xc85c('0x4'));var db=require(_0xc85c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc85c('0x6'))(_0xc85c('0x7'));var config=require(_0xc85c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc85c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea0dd,_0x2d26dc,_0x16878c){return new BPromise(function(_0x6314ee,_0x5a53f3){return client[_0xc85c('0xa')](_0x2ea0dd,_0x16878c)['then'](function(_0x2d9c7f){logger[_0xc85c('0xb')](_0xc85c('0xc'),_0x2d26dc,_0xc85c('0xd'));logger[_0xc85c('0xe')](_0xc85c('0xf'),_0x2d26dc,_0xc85c('0xd'),JSON[_0xc85c('0x10')](_0x2d9c7f));if(_0x2d9c7f['error']){if(_0x2d9c7f[_0xc85c('0x11')]['code']===0x1f4){logger[_0xc85c('0x11')](_0xc85c('0xc'),_0x2d26dc,_0x2d9c7f[_0xc85c('0x11')][_0xc85c('0x12')]);return _0x5a53f3(_0x2d9c7f['error'][_0xc85c('0x12')]);}logger[_0xc85c('0x11')](_0xc85c('0xc'),_0x2d26dc,_0x2d9c7f[_0xc85c('0x11')][_0xc85c('0x12')]);return _0x6314ee(_0x2d9c7f[_0xc85c('0x11')][_0xc85c('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x2d26dc,_0xc85c('0xd'));_0x6314ee(_0x2d9c7f[_0xc85c('0x13')][_0xc85c('0x12')]);}})[_0xc85c('0x14')](function(_0x5653a3){logger[_0xc85c('0x11')](_0xc85c('0xc'),_0x2d26dc,_0x5653a3);_0x5a53f3(_0x5653a3);});});} \ No newline at end of file +var _0x85d8=['message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','DeskField,\x20%s,\x20%s'];(function(_0x232309,_0x14811f){var _0x5e85ff=function(_0x4a0fdb){while(--_0x4a0fdb){_0x232309['push'](_0x232309['shift']());}};_0x5e85ff(++_0x14811f);}(_0x85d8,0x18e));var _0x885d=function(_0x552d67,_0x6ac3dd){_0x552d67=_0x552d67-0x0;var _0x812d4=_0x85d8[_0x552d67];return _0x812d4;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x885d('0x2'));var fs=require('fs');var Redis=require(_0x885d('0x3'));var db=require(_0x885d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x885d('0x5'));var config=require(_0x885d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x885d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412246,_0x4fd7c9,_0x31fbcb){return new BPromise(function(_0x497957,_0x5d7b51){return client[_0x885d('0x8')](_0x412246,_0x31fbcb)[_0x885d('0x9')](function(_0x3c700f){logger[_0x885d('0xa')]('DeskField,\x20%s,\x20%s',_0x4fd7c9,_0x885d('0xb'));logger[_0x885d('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4fd7c9,_0x885d('0xb'),JSON[_0x885d('0xd')](_0x3c700f));if(_0x3c700f[_0x885d('0xe')]){if(_0x3c700f[_0x885d('0xe')]['code']===0x1f4){logger[_0x885d('0xe')](_0x885d('0xf'),_0x4fd7c9,_0x3c700f[_0x885d('0xe')][_0x885d('0x10')]);return _0x5d7b51(_0x3c700f[_0x885d('0xe')]['message']);}logger[_0x885d('0xe')](_0x885d('0xf'),_0x4fd7c9,_0x3c700f[_0x885d('0xe')]['message']);return _0x497957(_0x3c700f[_0x885d('0xe')]['message']);}else{logger[_0x885d('0xa')](_0x885d('0xf'),_0x4fd7c9,_0x885d('0xb'));_0x497957(_0x3c700f['result'][_0x885d('0x10')]);}})[_0x885d('0x11')](function(_0x10ef9f){logger[_0x885d('0xe')](_0x885d('0xf'),_0x4fd7c9,_0x10ef9f);_0x5d7b51(_0x10ef9f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 406b4af..0bb2f0f 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 _0xbdc6=['/:id/configurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xbdc6,0xa3));var _0x6bdc=function(_0x4f1349,_0x50693c){_0x4f1349=_0x4f1349-0x0;var _0x47b53a=_0xbdc6[_0x4f1349];return _0x47b53a;};'use strict';var multer=require(_0x6bdc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6bdc('0x1'));var express=require(_0x6bdc('0x2'));var router=express[_0x6bdc('0x3')]();var fs_extra=require(_0x6bdc('0x4'));var auth=require(_0x6bdc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6bdc('0x6'));var controller=require(_0x6bdc('0x7'));router[_0x6bdc('0x8')]('/',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0xa')]);router[_0x6bdc('0x8')](_0x6bdc('0xb'),auth[_0x6bdc('0x9')](),controller[_0x6bdc('0xc')]);router[_0x6bdc('0x8')](_0x6bdc('0xd'),auth[_0x6bdc('0x9')](),controller['getConfigurations']);router[_0x6bdc('0x8')]('/:id/fields',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0xe')]);router[_0x6bdc('0xf')]('/',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0x10')]);router[_0x6bdc('0xf')]('/:id/configurations',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0x11')]);router[_0x6bdc('0x12')]('/:id',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0x13')]);router['delete']('/:id',auth[_0x6bdc('0x9')](),controller[_0x6bdc('0x14')]);module[_0x6bdc('0x15')]=router; \ No newline at end of file +var _0x293e=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports'];(function(_0x2d5766,_0x26f3c3){var _0x3b1d0a=function(_0x20c6a6){while(--_0x20c6a6){_0x2d5766['push'](_0x2d5766['shift']());}};_0x3b1d0a(++_0x26f3c3);}(_0x293e,0x160));var _0xe293=function(_0x5d4b40,_0x506da8){_0x5d4b40=_0x5d4b40-0x0;var _0x27f7ef=_0x293e[_0x5d4b40];return _0x27f7ef;};'use strict';var multer=require('multer');var util=require(_0xe293('0x0'));var path=require(_0xe293('0x1'));var timeout=require(_0xe293('0x2'));var express=require('express');var router=express[_0xe293('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe293('0x4'));var interaction=require(_0xe293('0x5'));var config=require(_0xe293('0x6'));var controller=require(_0xe293('0x7'));router[_0xe293('0x8')]('/',auth[_0xe293('0x9')](),controller[_0xe293('0xa')]);router[_0xe293('0x8')](_0xe293('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe293('0x8')](_0xe293('0xc'),auth['isAuthenticated'](),controller[_0xe293('0xd')]);router[_0xe293('0x8')]('/:id/fields',auth[_0xe293('0x9')](),controller[_0xe293('0xe')]);router[_0xe293('0xf')]('/',auth[_0xe293('0x9')](),controller[_0xe293('0x10')]);router[_0xe293('0xf')]('/:id/configurations',auth[_0xe293('0x9')](),controller[_0xe293('0x11')]);router[_0xe293('0x12')](_0xe293('0xb'),auth[_0xe293('0x9')](),controller[_0xe293('0x13')]);router['delete'](_0xe293('0xb'),auth[_0xe293('0x9')](),controller[_0xe293('0x14')]);module[_0xe293('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fffa423..afab8f1 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 _0xbccd=['sequelize','STRING','BOOLEAN'];(function(_0x51d7c2,_0x47dd35){var _0x2d5e76=function(_0x5c9042){while(--_0x5c9042){_0x51d7c2['push'](_0x51d7c2['shift']());}};_0x2d5e76(++_0x47dd35);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbccd[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0xdbcc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdbcc('0x1')]},'password':{'type':Sequelize[_0xdbcc('0x1')]},'remoteUri':{'type':Sequelize[_0xdbcc('0x1')]},'tenantId':{'type':Sequelize[_0xdbcc('0x1')]},'clientId':{'type':Sequelize[_0xdbcc('0x1')]},'clientSecret':{'type':Sequelize[_0xdbcc('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdbcc('0x1')]},'modernAuthentication':{'type':Sequelize[_0xdbcc('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5697=['STRING','sequelize'];(function(_0x57fbae,_0x4efdc1){var _0x45d3df=function(_0x489a73){while(--_0x489a73){_0x57fbae['push'](_0x57fbae['shift']());}};_0x45d3df(++_0x4efdc1);}(_0x5697,0x1b5));var _0x7569=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x5697[_0x581960];return _0x4ee892;};'use strict';var Sequelize=require(_0x7569('0x0'));module['exports']={'name':{'type':Sequelize[_0x7569('0x1')]},'username':{'type':Sequelize[_0x7569('0x1')]},'password':{'type':Sequelize[_0x7569('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7569('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ead7b38..1d8e487 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 _0xfe13=['StateAttributeMetadata','concat','test','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','UserLocalizedLabel','Value','DisplayName','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false','LogicalName','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','slice','%s/api/data/v9.0/','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','POST','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','@odata.type','substring','push','all','forEach','lastIndexOf','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata'];(function(_0x1b0a9d,_0x45a72a){var _0x719225=function(_0x5038d9){while(--_0x5038d9){_0x1b0a9d['push'](_0x1b0a9d['shift']());}};_0x719225(++_0x45a72a);}(_0xfe13,0x178));var _0x3fe1=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0xfe13[_0x284807];return _0x50c774;};'use strict';var rp=require(_0x3fe1('0x0'));var util=require('util');var _=require(_0x3fe1('0x1'));var qs=require(_0x3fe1('0x2'));var logger=require(_0x3fe1('0x3'))(_0x3fe1('0x4'));var db=require(_0x3fe1('0x5'))['db'];var integrations=require(_0x3fe1('0x6'));function respondWithResult(_0x4b3537,_0x5074c4){_0x5074c4=_0x5074c4||0xc8;return function(_0x40401b){if(_0x40401b){return _0x4b3537[_0x3fe1('0x7')](_0x5074c4)[_0x3fe1('0x8')](_0x40401b);}};}function respondWithFilteredResult(_0x5caa2e,_0xe33444){return function(_0x228b55){if(_0x228b55){var _0x1c3fac=typeof _0xe33444[_0x3fe1('0x9')]===_0x3fe1('0xa')&&typeof _0xe33444['limit']==='undefined';var _0x47651f=_0x228b55[_0x3fe1('0xb')];var _0x1513b6=_0x1c3fac?0x0:_0xe33444[_0x3fe1('0x9')];var _0x2aece3=_0x1c3fac?_0x228b55[_0x3fe1('0xb')]:_0xe33444[_0x3fe1('0x9')]+_0xe33444[_0x3fe1('0xc')];var _0x4b4878;if(_0x2aece3>=_0x47651f){_0x2aece3=_0x47651f;_0x4b4878=0xc8;}else{_0x4b4878=0xce;}_0x5caa2e[_0x3fe1('0x7')](_0x4b4878);return _0x5caa2e[_0x3fe1('0xd')](_0x3fe1('0xe'),_0x1513b6+'-'+_0x2aece3+'/'+_0x47651f)[_0x3fe1('0x8')](_0x228b55);}return null;};}function saveUpdates(_0x120411){return function(_0xda23ad){if(_0xda23ad){return _0xda23ad[_0x3fe1('0xf')](_0x120411)[_0x3fe1('0x10')](function(_0x2bbc6b){return _0x2bbc6b;});}return null;};}function removeEntity(_0x59e62b){return function(_0x753172){if(_0x753172){return _0x753172[_0x3fe1('0x11')]()[_0x3fe1('0x10')](function(){_0x59e62b[_0x3fe1('0x7')](0xcc)[_0x3fe1('0x12')]();});}};}function handleEntityNotFound(_0x56e720){return function(_0x47055f){if(!_0x47055f){_0x56e720[_0x3fe1('0x13')](0x194);}return _0x47055f;};}function handleError(_0x2a802d,_0x208bb7){_0x208bb7=_0x208bb7||0x1f4;return function(_0x1bbb4c){logger[_0x3fe1('0x14')](_0x1bbb4c[_0x3fe1('0x15')]);if(_0x1bbb4c[_0x3fe1('0x16')]){delete _0x1bbb4c[_0x3fe1('0x16')];}_0x2a802d[_0x3fe1('0x7')](_0x208bb7)['send'](_0x1bbb4c);};}exports['index']=function(_0x933f82,_0x2462a1){var _0x427a44={},_0x3ad672={},_0x2fb150={'count':0x0,'rows':[]};var _0x211261=_[_0x3fe1('0x17')](db[_0x3fe1('0x18')][_0x3fe1('0x19')],function(_0x1d3532){return{'name':_0x1d3532[_0x3fe1('0x1a')],'type':_0x1d3532[_0x3fe1('0x1b')][_0x3fe1('0x1c')]};});_0x3ad672['model']=_[_0x3fe1('0x17')](_0x211261,'name');_0x3ad672['query']=_[_0x3fe1('0x1d')](_0x933f82['query']);_0x3ad672[_0x3fe1('0x1e')]=_[_0x3fe1('0x1f')](_0x3ad672[_0x3fe1('0x20')],_0x3ad672[_0x3fe1('0x21')]);_0x427a44[_0x3fe1('0x22')]=_[_0x3fe1('0x1f')](_0x3ad672[_0x3fe1('0x20')],qs[_0x3fe1('0x23')](_0x933f82[_0x3fe1('0x21')]['fields']));_0x427a44[_0x3fe1('0x22')]=_0x427a44['attributes']['length']?_0x427a44[_0x3fe1('0x22')]:_0x3ad672[_0x3fe1('0x20')];if(!_0x933f82[_0x3fe1('0x21')][_0x3fe1('0x24')](_0x3fe1('0x25'))){_0x427a44[_0x3fe1('0xc')]=qs[_0x3fe1('0xc')](_0x933f82[_0x3fe1('0x21')][_0x3fe1('0xc')]);_0x427a44[_0x3fe1('0x9')]=qs['offset'](_0x933f82[_0x3fe1('0x21')][_0x3fe1('0x9')]);}_0x427a44[_0x3fe1('0x26')]=qs[_0x3fe1('0x27')](_0x933f82[_0x3fe1('0x21')][_0x3fe1('0x27')]);_0x427a44[_0x3fe1('0x28')]=qs[_0x3fe1('0x1e')](_[_0x3fe1('0x29')](_0x933f82[_0x3fe1('0x21')],_0x3ad672[_0x3fe1('0x1e')]),_0x211261);if(_0x933f82[_0x3fe1('0x21')][_0x3fe1('0x2a')]){_0x427a44[_0x3fe1('0x28')]=_[_0x3fe1('0x2b')](_0x427a44['where'],{'$or':_[_0x3fe1('0x17')](_0x211261,function(_0x3495da){if(_0x3495da[_0x3fe1('0x1b')]!==_0x3fe1('0x2c')){var _0x33ecd8={};_0x33ecd8[_0x3495da[_0x3fe1('0x16')]]={'$like':'%'+_0x933f82['query'][_0x3fe1('0x2a')]+'%'};return _0x33ecd8;}})});}_0x427a44=_[_0x3fe1('0x2b')]({},_0x427a44,_0x933f82[_0x3fe1('0x2d')]);var _0x3f4bcd={'where':_0x427a44[_0x3fe1('0x28')]};return db[_0x3fe1('0x18')][_0x3fe1('0xb')](_0x3f4bcd)['then'](function(_0x4d46e8){_0x2fb150[_0x3fe1('0xb')]=_0x4d46e8;if(_0x933f82[_0x3fe1('0x21')][_0x3fe1('0x2e')]){_0x427a44['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x3fe1('0x2f')](_0x427a44);})[_0x3fe1('0x10')](function(_0x12caf4){_0x2fb150[_0x3fe1('0x30')]=_0x12caf4;return _0x2fb150;})[_0x3fe1('0x10')](respondWithFilteredResult(_0x2462a1,_0x427a44))[_0x3fe1('0x31')](handleError(_0x2462a1,null));};exports[_0x3fe1('0x32')]=function(_0x4540ed,_0x3c879a){var _0x1b9b52={'raw':![],'where':{'id':_0x4540ed[_0x3fe1('0x33')]['id']}},_0x5d0cf9={};_0x5d0cf9[_0x3fe1('0x20')]=_['keys'](db[_0x3fe1('0x18')]['rawAttributes']);_0x5d0cf9['query']=_[_0x3fe1('0x1d')](_0x4540ed['query']);_0x5d0cf9['filters']=_[_0x3fe1('0x1f')](_0x5d0cf9[_0x3fe1('0x20')],_0x5d0cf9[_0x3fe1('0x21')]);_0x1b9b52[_0x3fe1('0x22')]=_[_0x3fe1('0x1f')](_0x5d0cf9[_0x3fe1('0x20')],qs[_0x3fe1('0x23')](_0x4540ed['query']['fields']));_0x1b9b52['attributes']=_0x1b9b52[_0x3fe1('0x22')][_0x3fe1('0x34')]?_0x1b9b52[_0x3fe1('0x22')]:_0x5d0cf9[_0x3fe1('0x20')];if(_0x4540ed['query'][_0x3fe1('0x2e')]){_0x1b9b52['include']=[{'all':!![]}];}_0x1b9b52=_['merge']({},_0x1b9b52,_0x4540ed[_0x3fe1('0x2d')]);return db[_0x3fe1('0x18')][_0x3fe1('0x35')](_0x1b9b52)[_0x3fe1('0x10')](handleEntityNotFound(_0x3c879a,null))[_0x3fe1('0x10')](respondWithResult(_0x3c879a,null))[_0x3fe1('0x31')](handleError(_0x3c879a,null));};exports[_0x3fe1('0x36')]=function(_0x559881,_0x504443){return db[_0x3fe1('0x18')][_0x3fe1('0x36')](_0x559881[_0x3fe1('0x37')],{})[_0x3fe1('0x10')](respondWithResult(_0x504443,0xc9))[_0x3fe1('0x31')](handleError(_0x504443,null));};exports['update']=function(_0x151a59,_0x446d56){if(_0x151a59[_0x3fe1('0x37')]['id']){delete _0x151a59[_0x3fe1('0x37')]['id'];}return db[_0x3fe1('0x18')]['find']({'where':{'id':_0x151a59[_0x3fe1('0x33')]['id']}})['then'](handleEntityNotFound(_0x446d56,null))['then'](saveUpdates(_0x151a59['body'],null))[_0x3fe1('0x10')](respondWithResult(_0x446d56,null))[_0x3fe1('0x31')](handleError(_0x446d56,null));};exports[_0x3fe1('0x11')]=function(_0x1909b9,_0x7ff694){return db[_0x3fe1('0x18')][_0x3fe1('0x35')]({'where':{'id':_0x1909b9[_0x3fe1('0x33')]['id']}})[_0x3fe1('0x10')](handleEntityNotFound(_0x7ff694,null))['then'](removeEntity(_0x7ff694,null))[_0x3fe1('0x31')](handleError(_0x7ff694,null));};exports[_0x3fe1('0x38')]=function(_0x19a862,_0x1a1e69){var _0x1476d6={};var _0x15b04d={};var _0x1a2133;var _0x1cb6c3;return db['Dynamics365Account'][_0x3fe1('0x39')]({'where':{'id':_0x19a862['params']['id']}})[_0x3fe1('0x10')](handleEntityNotFound(_0x1a1e69,null))[_0x3fe1('0x10')](function(_0x28d6a8){if(_0x28d6a8){_0x1a2133=_0x28d6a8;_0x15b04d[_0x3fe1('0x20')]=_[_0x3fe1('0x1d')](db['Dynamics365Configuration'][_0x3fe1('0x19')]);_0x15b04d[_0x3fe1('0x21')]=_[_0x3fe1('0x1d')](_0x19a862['query']);_0x15b04d[_0x3fe1('0x1e')]=_[_0x3fe1('0x1f')](_0x15b04d[_0x3fe1('0x20')],_0x15b04d[_0x3fe1('0x21')]);_0x1476d6[_0x3fe1('0x22')]=_[_0x3fe1('0x1f')](_0x15b04d['model'],qs[_0x3fe1('0x23')](_0x19a862[_0x3fe1('0x21')][_0x3fe1('0x23')]));_0x1476d6[_0x3fe1('0x22')]=_0x1476d6[_0x3fe1('0x22')][_0x3fe1('0x34')]?_0x1476d6[_0x3fe1('0x22')]:_0x15b04d['model'];_0x1476d6['order']=qs['sort'](_0x19a862[_0x3fe1('0x21')]['sort']);_0x1476d6[_0x3fe1('0x28')]=qs[_0x3fe1('0x1e')](_['pick'](_0x19a862[_0x3fe1('0x21')],_0x15b04d[_0x3fe1('0x1e')]));if(_0x19a862[_0x3fe1('0x21')]['filter']){_0x1476d6['where']=_[_0x3fe1('0x2b')](_0x1476d6['where'],{'$or':_[_0x3fe1('0x17')](_0x1476d6['attributes'],function(_0x1cc08a){var _0x50822e={};_0x50822e[_0x1cc08a]={'$like':'%'+_0x19a862['query'][_0x3fe1('0x2a')]+'%'};return _0x50822e;})});}_0x1476d6=_[_0x3fe1('0x2b')]({},_0x1476d6,_0x19a862[_0x3fe1('0x2d')]);return _0x1a2133[_0x3fe1('0x38')](_0x1476d6);}})[_0x3fe1('0x10')](function(_0x55270e){if(_0x55270e){_0x1cb6c3=_0x55270e[_0x3fe1('0x34')];if(!_0x19a862[_0x3fe1('0x21')]['hasOwnProperty'](_0x3fe1('0x25'))){_0x1476d6[_0x3fe1('0xc')]=qs[_0x3fe1('0xc')](_0x19a862['query'][_0x3fe1('0xc')]);_0x1476d6[_0x3fe1('0x9')]=qs[_0x3fe1('0x9')](_0x19a862['query'][_0x3fe1('0x9')]);}return _0x1a2133[_0x3fe1('0x38')](_0x1476d6);}})[_0x3fe1('0x10')](function(_0x1b03b1){if(_0x1b03b1){return _0x1b03b1?{'count':_0x1cb6c3,'rows':_0x1b03b1}:null;}})[_0x3fe1('0x10')](respondWithResult(_0x1a1e69,null))[_0x3fe1('0x31')](handleError(_0x1a1e69,null));};exports[_0x3fe1('0x3a')]=function(_0x2b60f4,_0x35208a){if(_0x2b60f4[_0x3fe1('0x37')]['id']){delete _0x2b60f4[_0x3fe1('0x37')]['id'];}return db[_0x3fe1('0x18')][_0x3fe1('0x39')]({'where':{'id':_0x2b60f4['params']['id']}})['then'](handleEntityNotFound(_0x35208a,null))[_0x3fe1('0x10')](function(_0x11845c){if(_0x11845c){_0x2b60f4[_0x3fe1('0x37')]['AccountId']=_0x11845c['id'];_0x2b60f4[_0x3fe1('0x37')][_0x3fe1('0x3b')]=integrations[_0x3fe1('0x3c')](_0x2b60f4[_0x3fe1('0x37')]['channel'],_0x2b60f4[_0x3fe1('0x37')]['type']);_0x2b60f4[_0x3fe1('0x37')][_0x3fe1('0x3d')]=integrations[_0x3fe1('0x3e')](_0x2b60f4['body'][_0x3fe1('0x3f')],_0x2b60f4[_0x3fe1('0x37')][_0x3fe1('0x1b')]);return db[_0x3fe1('0x40')][_0x3fe1('0x36')](_0x2b60f4[_0x3fe1('0x37')],{'include':[{'model':db[_0x3fe1('0x41')],'as':_0x3fe1('0x3b')},{'model':db['Dynamics365Field'],'as':_0x3fe1('0x3d')}]});}return null;})[_0x3fe1('0x10')](respondWithResult(_0x35208a,null))[_0x3fe1('0x31')](handleError(_0x35208a,null));};function sanitizeRemoteUri(_0x1977dc){var _0x3cb566=_0x1977dc[_0x3fe1('0x42')](-0x1);if(_0x3cb566==='/')return _0x1977dc['substring'](0x0,_0x1977dc['lastIndexOf'](_0x3cb566));return _0x1977dc;}function getWebApiUrl(_0x4a1aa6){return util['format'](_0x3fe1('0x43'),_0x4a1aa6);}exports['getFields']=function(_0x180604,_0x461fd9){var _0x52fa3e=_0x180604['query'][_0x3fe1('0x44')];var _0x1ba6ad=_0x52fa3e==='incident'?_0x3fe1('0x45'):'PhoneCall';var _0x236cad='';var _0x3b9fe4='';var _0x4c4702='';var _0x4f909b='';var _0x34b89c='';var _0x3393fb='';var _0x36ddf3='';var _0x59ce8a='';var _0x283523=[_0x3fe1('0x46'),_0x3fe1('0x47'),_0x3fe1('0x48'),_0x3fe1('0x49'),_0x3fe1('0x4a'),_0x3fe1('0x4b'),'phonenumber',_0x3fe1('0x4c'),'directioncode',_0x3fe1('0x4d')];var _0x1428a4=[_0x3fe1('0x4e'),_0x3fe1('0x4f'),_0x3fe1('0x50'),_0x3fe1('0x51'),_0x3fe1('0x52'),_0x3fe1('0x53'),'contractdetailidname',_0x3fe1('0x54'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x3fe1('0x55'),_0x3fe1('0x56'),_0x3fe1('0x57'),_0x3fe1('0x58'),'createdonbehalfbyyominame','customeridname','customeridtype',_0x3fe1('0x59'),_0x3fe1('0x5a'),_0x3fe1('0x5b'),_0x3fe1('0x5c'),_0x3fe1('0x5d'),_0x3fe1('0x5e'),'exchangerate','firstresponsebykpiidname',_0x3fe1('0x5f'),_0x3fe1('0x60'),_0x3fe1('0x61'),_0x3fe1('0x62'),_0x3fe1('0x63'),'masteridname',_0x3fe1('0x64'),_0x3fe1('0x65'),_0x3fe1('0x66'),_0x3fe1('0x67'),'modifiedon',_0x3fe1('0x68'),_0x3fe1('0x69'),_0x3fe1('0x6a'),_0x3fe1('0x6b'),_0x3fe1('0x6c'),_0x3fe1('0x6d'),_0x3fe1('0x6e'),_0x3fe1('0x6f'),'owneridtype',_0x3fe1('0x70'),_0x3fe1('0x71'),'primarycontactidname',_0x3fe1('0x72'),_0x3fe1('0x73'),_0x3fe1('0x74'),_0x3fe1('0x75'),_0x3fe1('0x76'),'resolvebykpiidname',_0x3fe1('0x77'),_0x3fe1('0x78'),_0x3fe1('0x79'),'sentimentvalue',_0x3fe1('0x7a'),_0x3fe1('0x7b'),_0x3fe1('0x7c'),'statecode',_0x3fe1('0x7d'),'subjectidname','ticketnumber',_0x3fe1('0x7e'),_0x3fe1('0x7f'),_0x3fe1('0x80'),'utcconversiontimezonecode','versionnumber'];var _0x2dcf91=_0x283523['concat'](_0x1428a4);return db[_0x3fe1('0x18')]['findOne']({'where':{'id':_0x180604[_0x3fe1('0x33')]['id']},'attributes':['id',_0x3fe1('0x81'),_0x3fe1('0x82'),_0x3fe1('0x83'),_0x3fe1('0x84'),_0x3fe1('0x85'),'clientSecret',_0x3fe1('0x86')],'include':[{'model':db[_0x3fe1('0x87')],'as':_0x3fe1('0x87'),'attributes':['id','data5',_0x3fe1('0x88')]}]})[_0x3fe1('0x10')](handleEntityNotFound(_0x461fd9,null))[_0x3fe1('0x10')](function(_0x4d2adc){if(_0x4d2adc){if(_0x4d2adc[_0x3fe1('0x86')]){_0x4d2adc[_0x3fe1('0x89')]=_0x4d2adc[_0x3fe1('0x87')][_0x3fe1('0x8a')];_0x59ce8a=sanitizeRemoteUri(_0x4d2adc['CloudProvider']['data7']);_0x36ddf3=getWebApiUrl(_0x59ce8a);return _0x4d2adc;}_0x59ce8a=sanitizeRemoteUri(_0x4d2adc[_0x3fe1('0x83')]);_0x36ddf3=getWebApiUrl(_0x59ce8a);var _0x20b4b4={'method':_0x3fe1('0x8b'),'uri':'https://login.microsoftonline.com/'+_0x4d2adc[_0x3fe1('0x84')]+'/oauth2/token','form':{'client_id':_0x4d2adc[_0x3fe1('0x85')],'resource':_0x59ce8a,'username':_0x4d2adc[_0x3fe1('0x81')],'password':_0x4d2adc['password'],'grant_type':_0x3fe1('0x82'),'client_secret':_0x4d2adc[_0x3fe1('0x8c')]},'json':!![]};return rp(_0x20b4b4);}})[_0x3fe1('0x10')](function(_0x345848){_0x3393fb=_0x345848[_0x3fe1('0x89')];var _0x2205a8={'method':_0x3fe1('0x8d'),'uri':encodeURI(_0x36ddf3+_0x3fe1('0x8e')+_0x1ba6ad+'\x27'),'headers':{'Authorization':_0x3fe1('0x8f')+_0x3393fb,'If-None-Match':null,'OData-Version':_0x3fe1('0x90')},'json':!![]};return rp(_0x2205a8);})['then'](function(_0x5863ef){var _0x554b85=_0x5863ef[_0x3fe1('0x91')][0x0];var _0xb4e0ef=_0x554b85[_0x3fe1('0x92')];var _0x947407={'method':_0x3fe1('0x8d'),'uri':_0x36ddf3+_0x3fe1('0x93')+_0xb4e0ef+_0x3fe1('0x94'),'headers':{'Authorization':_0x3fe1('0x8f')+_0x3393fb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x947407);})[_0x3fe1('0x10')](function(_0x20aecf){_0x236cad=_0x20aecf;_0x3b9fe4=_0x236cad[_0x3fe1('0x95')];_0x3b9fe4=_['remove'](_0x3b9fe4,function(_0x7a2687){return!_0x2dcf91[_0x3fe1('0x96')](_0x7a2687['LogicalName']);});var _0xe195bd=[];var _0x2f67b7=[];_0x3b9fe4['forEach'](function(_0x22b22c){if(_0x22b22c[_0x3fe1('0x97')]){var _0xdedc21=_0x22b22c[_0x3fe1('0x97')][_0x3fe1('0x98')](_0x22b22c['@odata.type']['lastIndexOf']('.')+0x1);if(_0xdedc21==='PicklistAttributeMetadata'){_0xe195bd[_0x3fe1('0x99')](getSelectList(_0x36ddf3,_0x52fa3e,_0x2f67b7,_0x236cad['MetadataId'],_0x22b22c[_0x3fe1('0x92')],_0x3393fb));}}});return Promise[_0x3fe1('0x9a')](_0xe195bd);})[_0x3fe1('0x10')](function(_0x34f3de){_0x4c4702=_0x34f3de[0x0];var _0x586e9a=[];var _0x469d90=[];_0x3b9fe4['forEach'](function(_0x3b2536){if(!_['isNil'](_0x3b2536[_0x3fe1('0x97')])){var _0x4439d1=_0x3b2536[_0x3fe1('0x97')][_0x3fe1('0x98')](_0x3b2536[_0x3fe1('0x97')]['lastIndexOf']('.')+0x1);if(_0x4439d1==='BooleanAttributeMetadata'){_0x586e9a[_0x3fe1('0x99')](getBooleanList(_0x36ddf3,_0x52fa3e,_0x469d90,_0x236cad[_0x3fe1('0x92')],_0x3b2536[_0x3fe1('0x92')],_0x3393fb));}}});return Promise[_0x3fe1('0x9a')](_0x586e9a);})[_0x3fe1('0x10')](function(_0x19bc43){_0x4f909b=_0x19bc43[0x0];var _0x4a6291=[];var _0x458cb7=[];_0x3b9fe4[_0x3fe1('0x9b')](function(_0x512b13){if(_0x512b13[_0x3fe1('0x97')]){var _0x50ff10=_0x512b13[_0x3fe1('0x97')][_0x3fe1('0x98')](_0x512b13[_0x3fe1('0x97')][_0x3fe1('0x9c')]('.')+0x1);if(_0x50ff10===_0x3fe1('0x9d')||_0x50ff10==='DoubleAttributeMetadata'||_0x50ff10===_0x3fe1('0x9e')||_0x50ff10===_0x3fe1('0x9f')||_0x50ff10===_0x3fe1('0xa0')||_0x50ff10===_0x3fe1('0xa1')||_0x50ff10===_0x3fe1('0xa2')||_0x50ff10===_0x3fe1('0xa3')||_0x50ff10===_0x3fe1('0xa4')||_0x50ff10==='DecimalAttributeMetadata'){_0x4a6291[_0x3fe1('0x99')](getInputList(_0x36ddf3,_0x52fa3e,_0x50ff10,_0x458cb7,_0x236cad[_0x3fe1('0x92')],_0x512b13[_0x3fe1('0x92')],_0x3393fb));}}});return Promise[_0x3fe1('0x9a')](_0x4a6291);})[_0x3fe1('0x10')](function(_0x5331d5){_0x34b89c=_0x5331d5[0x0];var _0x289245=_0x4c4702[_0x3fe1('0xa5')](_0x4f909b)[_0x3fe1('0xa5')](_0x34b89c);var _0x367a6a={'count':_0x289245[_0x3fe1('0x34')],'rows':_0x289245};return _0x367a6a;})[_0x3fe1('0x10')](respondWithResult(_0x461fd9,null))[_0x3fe1('0x31')](function(_0x40200e){var _0xec00eb=_0x180604[_0x3fe1('0x21')][_0x3fe1('0xa6')]?0x1f4:_0x40200e['statusCode']||0x1f4;logger[_0x3fe1('0x14')](_0x40200e[_0x3fe1('0x15')]);delete _0x40200e[_0x3fe1('0x16')];if(_0xec00eb===0x191){_0xec00eb=0x190;}_0x461fd9[_0x3fe1('0x7')](_0xec00eb)['send'](_0x180604[_0x3fe1('0x21')][_0x3fe1('0xa6')]?{'message':_0x3fe1('0xa7'),'statusCode':_0x40200e['statusCode']}:_0x40200e);});};function getSelectList(_0x825691,_0xd64107,_0x358f15,_0x11b0c7,_0x3e89a7,_0x3b5a5c){var _0x459f0b={'method':'GET','uri':_0x825691+'EntityDefinitions('+_0x11b0c7+')/Attributes('+_0x3e89a7+_0x3fe1('0xa8')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x3fe1('0x8f')+_0x3b5a5c,'If-None-Match':null,'OData-Version':_0x3fe1('0x90')},'json':!![]};return rp(_0x459f0b)[_0x3fe1('0x10')](function(_0x27dd11){var _0x556121=[];var _0x4d8274=_0x27dd11[_0x3fe1('0xa9')]['Options'];_0x4d8274[_0x3fe1('0x9b')](function(_0x1552e6){_0x556121[_0x3fe1('0x99')]({'name':_0x1552e6['Label'][_0x3fe1('0xaa')]['Label'],'value':String(_0x1552e6[_0x3fe1('0xab')])});});var _0x425127={'id':_0xd64107+'_'+_0x27dd11['LogicalName'],'name':_0x27dd11[_0x3fe1('0xac')][_0x3fe1('0xaa')][_0x3fe1('0xad')],'custom':![],'options':_0x556121};_0x358f15[_0x3fe1('0x99')](_0x425127);return _0x358f15;});}function getBooleanList(_0x20dcb3,_0x258a43,_0x590ffc,_0x1fb753,_0x24c8a3,_0x57b814){var _0x57b04a={'method':_0x3fe1('0x8d'),'uri':_0x20dcb3+_0x3fe1('0x93')+_0x1fb753+_0x3fe1('0xae')+_0x24c8a3+_0x3fe1('0xaf'),'headers':{'Authorization':_0x3fe1('0x8f')+_0x57b814,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x57b04a)[_0x3fe1('0x10')](function(_0x22e9f0){var _0x340b95=[];_0x340b95['push']({'name':_0x22e9f0[_0x3fe1('0xa9')][_0x3fe1('0xb0')][_0x3fe1('0xad')][_0x3fe1('0xaa')][_0x3fe1('0xad')],'value':'true'},{'name':_0x22e9f0[_0x3fe1('0xa9')]['FalseOption']['Label'][_0x3fe1('0xaa')][_0x3fe1('0xad')],'value':_0x3fe1('0xb1')});var _0x1106b2={'id':_0x258a43+'_'+_0x22e9f0[_0x3fe1('0xb2')],'name':_0x22e9f0[_0x3fe1('0xac')][_0x3fe1('0xaa')][_0x3fe1('0xad')],'custom':![],'options':_0x340b95};_0x590ffc[_0x3fe1('0x99')](_0x1106b2);return _0x590ffc;});}function getInputList(_0x16d2a1,_0x54bb0e,_0x30ce73,_0x3bd313,_0x2914dd,_0x539525,_0x3074a6){var _0x5030eb={'method':_0x3fe1('0x8d'),'uri':_0x16d2a1+_0x3fe1('0x93')+_0x2914dd+_0x3fe1('0xae')+_0x539525+')/Microsoft.Dynamics.CRM.'+_0x30ce73+_0x3fe1('0xb3'),'headers':{'Authorization':_0x3fe1('0x8f')+_0x3074a6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5030eb)['then'](function(_0x2204f2){var _0x46010f={'id':_0x54bb0e+'_'+_0x2204f2['LogicalName'],'name':_0x2204f2[_0x3fe1('0xac')][_0x3fe1('0xaa')]?_0x2204f2[_0x3fe1('0xac')][_0x3fe1('0xaa')][_0x3fe1('0xad')]:_0x2204f2[_0x3fe1('0xb2')],'custom':![],'options':[]};_0x3bd313['push'](_0x46010f);return _0x3bd313;});} \ No newline at end of file +var _0x0f6c=['clientId','modernAuthentication','CloudProvider','access_token','data5','data7','https://login.microsoftonline.com/','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','UserLocalizedLabel','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','json','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','keys','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId'];(function(_0x454925,_0x2e2c0a){var _0x29f54d=function(_0x4c883c){while(--_0x4c883c){_0x454925['push'](_0x454925['shift']());}};_0x29f54d(++_0x2e2c0a);}(_0x0f6c,0xe1));var _0xc0f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0f6c[_0x3947c9];return _0x2e7871;};'use strict';var rp=require(_0xc0f6('0x0'));var util=require('util');var _=require(_0xc0f6('0x1'));var qs=require(_0xc0f6('0x2'));var logger=require(_0xc0f6('0x3'))(_0xc0f6('0x4'));var db=require(_0xc0f6('0x5'))['db'];var integrations=require(_0xc0f6('0x6'));function respondWithResult(_0x1bb5a7,_0x323fc1){_0x323fc1=_0x323fc1||0xc8;return function(_0x23d66d){if(_0x23d66d){return _0x1bb5a7[_0xc0f6('0x7')](_0x323fc1)['json'](_0x23d66d);}};}function respondWithFilteredResult(_0xb2c122,_0x174043){return function(_0x5b82f0){if(_0x5b82f0){var _0x1d89b7=typeof _0x174043[_0xc0f6('0x8')]===_0xc0f6('0x9')&&typeof _0x174043['limit']==='undefined';var _0xae71a9=_0x5b82f0[_0xc0f6('0xa')];var _0x3b0193=_0x1d89b7?0x0:_0x174043[_0xc0f6('0x8')];var _0x48c72c=_0x1d89b7?_0x5b82f0[_0xc0f6('0xa')]:_0x174043['offset']+_0x174043[_0xc0f6('0xb')];var _0x59bb0a;if(_0x48c72c>=_0xae71a9){_0x48c72c=_0xae71a9;_0x59bb0a=0xc8;}else{_0x59bb0a=0xce;}_0xb2c122[_0xc0f6('0x7')](_0x59bb0a);return _0xb2c122[_0xc0f6('0xc')](_0xc0f6('0xd'),_0x3b0193+'-'+_0x48c72c+'/'+_0xae71a9)[_0xc0f6('0xe')](_0x5b82f0);}return null;};}function saveUpdates(_0x22cdf8){return function(_0x8fce29){if(_0x8fce29){return _0x8fce29['update'](_0x22cdf8)['then'](function(_0x473a17){return _0x473a17;});}return null;};}function removeEntity(_0x2ee581){return function(_0x49cfcb){if(_0x49cfcb){return _0x49cfcb[_0xc0f6('0xf')]()['then'](function(){_0x2ee581[_0xc0f6('0x7')](0xcc)[_0xc0f6('0x10')]();});}};}function handleEntityNotFound(_0x28f75f){return function(_0x7c701b){if(!_0x7c701b){_0x28f75f['sendStatus'](0x194);}return _0x7c701b;};}function handleError(_0x5bc44b,_0x140c64){_0x140c64=_0x140c64||0x1f4;return function(_0x7becd7){logger[_0xc0f6('0x11')](_0x7becd7[_0xc0f6('0x12')]);if(_0x7becd7[_0xc0f6('0x13')]){delete _0x7becd7[_0xc0f6('0x13')];}_0x5bc44b[_0xc0f6('0x7')](_0x140c64)[_0xc0f6('0x14')](_0x7becd7);};}exports[_0xc0f6('0x15')]=function(_0x5f4e85,_0x31eb74){var _0x5b8e1f={},_0xf988a2={},_0x506e43={'count':0x0,'rows':[]};var _0x6a7687=_[_0xc0f6('0x16')](db[_0xc0f6('0x17')][_0xc0f6('0x18')],function(_0x2a9ebc){return{'name':_0x2a9ebc[_0xc0f6('0x19')],'type':_0x2a9ebc[_0xc0f6('0x1a')][_0xc0f6('0x1b')]};});_0xf988a2[_0xc0f6('0x1c')]=_[_0xc0f6('0x16')](_0x6a7687,_0xc0f6('0x13'));_0xf988a2[_0xc0f6('0x1d')]=_['keys'](_0x5f4e85[_0xc0f6('0x1d')]);_0xf988a2['filters']=_[_0xc0f6('0x1e')](_0xf988a2[_0xc0f6('0x1c')],_0xf988a2[_0xc0f6('0x1d')]);_0x5b8e1f[_0xc0f6('0x1f')]=_[_0xc0f6('0x1e')](_0xf988a2[_0xc0f6('0x1c')],qs['fields'](_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x20')]));_0x5b8e1f[_0xc0f6('0x1f')]=_0x5b8e1f[_0xc0f6('0x1f')]['length']?_0x5b8e1f[_0xc0f6('0x1f')]:_0xf988a2['model'];if(!_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x21')](_0xc0f6('0x22'))){_0x5b8e1f['limit']=qs['limit'](_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0xb')]);_0x5b8e1f[_0xc0f6('0x8')]=qs['offset'](_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x8')]);}_0x5b8e1f[_0xc0f6('0x23')]=qs[_0xc0f6('0x24')](_0x5f4e85['query'][_0xc0f6('0x24')]);_0x5b8e1f[_0xc0f6('0x25')]=qs['filters'](_[_0xc0f6('0x26')](_0x5f4e85[_0xc0f6('0x1d')],_0xf988a2[_0xc0f6('0x27')]),_0x6a7687);if(_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x28')]){_0x5b8e1f[_0xc0f6('0x25')]=_[_0xc0f6('0x29')](_0x5b8e1f['where'],{'$or':_[_0xc0f6('0x16')](_0x6a7687,function(_0x59af71){if(_0x59af71[_0xc0f6('0x1a')]!=='VIRTUAL'){var _0x14f71c={};_0x14f71c[_0x59af71[_0xc0f6('0x13')]]={'$like':'%'+_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x28')]+'%'};return _0x14f71c;}})});}_0x5b8e1f=_[_0xc0f6('0x29')]({},_0x5b8e1f,_0x5f4e85[_0xc0f6('0x2a')]);var _0x427add={'where':_0x5b8e1f[_0xc0f6('0x25')]};return db['Dynamics365Account'][_0xc0f6('0xa')](_0x427add)[_0xc0f6('0x2b')](function(_0xdec1a7){_0x506e43[_0xc0f6('0xa')]=_0xdec1a7;if(_0x5f4e85[_0xc0f6('0x1d')][_0xc0f6('0x2c')]){_0x5b8e1f[_0xc0f6('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xc0f6('0x2e')](_0x5b8e1f);})[_0xc0f6('0x2b')](function(_0x5049cc){_0x506e43[_0xc0f6('0x2f')]=_0x5049cc;return _0x506e43;})[_0xc0f6('0x2b')](respondWithFilteredResult(_0x31eb74,_0x5b8e1f))[_0xc0f6('0x30')](handleError(_0x31eb74,null));};exports[_0xc0f6('0x31')]=function(_0x2949cc,_0x4acf5d){var _0x101464={'raw':![],'where':{'id':_0x2949cc['params']['id']}},_0x30370e={};_0x30370e[_0xc0f6('0x1c')]=_['keys'](db['Dynamics365Account'][_0xc0f6('0x18')]);_0x30370e['query']=_['keys'](_0x2949cc[_0xc0f6('0x1d')]);_0x30370e[_0xc0f6('0x27')]=_[_0xc0f6('0x1e')](_0x30370e[_0xc0f6('0x1c')],_0x30370e[_0xc0f6('0x1d')]);_0x101464[_0xc0f6('0x1f')]=_[_0xc0f6('0x1e')](_0x30370e[_0xc0f6('0x1c')],qs[_0xc0f6('0x20')](_0x2949cc[_0xc0f6('0x1d')]['fields']));_0x101464['attributes']=_0x101464['attributes'][_0xc0f6('0x32')]?_0x101464[_0xc0f6('0x1f')]:_0x30370e[_0xc0f6('0x1c')];if(_0x2949cc[_0xc0f6('0x1d')]['includeAll']){_0x101464['include']=[{'all':!![]}];}_0x101464=_[_0xc0f6('0x29')]({},_0x101464,_0x2949cc[_0xc0f6('0x2a')]);return db['Dynamics365Account'][_0xc0f6('0x33')](_0x101464)[_0xc0f6('0x2b')](handleEntityNotFound(_0x4acf5d,null))[_0xc0f6('0x2b')](respondWithResult(_0x4acf5d,null))['catch'](handleError(_0x4acf5d,null));};exports[_0xc0f6('0x34')]=function(_0x1edf81,_0x44bde0){return db[_0xc0f6('0x17')]['create'](_0x1edf81['body'],{})[_0xc0f6('0x2b')](respondWithResult(_0x44bde0,0xc9))['catch'](handleError(_0x44bde0,null));};exports['update']=function(_0x585340,_0x2d8283){if(_0x585340[_0xc0f6('0x35')]['id']){delete _0x585340[_0xc0f6('0x35')]['id'];}return db[_0xc0f6('0x17')][_0xc0f6('0x33')]({'where':{'id':_0x585340['params']['id']}})[_0xc0f6('0x2b')](handleEntityNotFound(_0x2d8283,null))[_0xc0f6('0x2b')](saveUpdates(_0x585340['body'],null))[_0xc0f6('0x2b')](respondWithResult(_0x2d8283,null))['catch'](handleError(_0x2d8283,null));};exports[_0xc0f6('0xf')]=function(_0x3e6a25,_0x4e7679){return db[_0xc0f6('0x17')]['find']({'where':{'id':_0x3e6a25[_0xc0f6('0x36')]['id']}})[_0xc0f6('0x2b')](handleEntityNotFound(_0x4e7679,null))[_0xc0f6('0x2b')](removeEntity(_0x4e7679,null))['catch'](handleError(_0x4e7679,null));};exports[_0xc0f6('0x37')]=function(_0x162612,_0xd8238f){var _0x3d7c22={};var _0x439160={};var _0x4ba591;var _0x310a0b;return db['Dynamics365Account'][_0xc0f6('0x38')]({'where':{'id':_0x162612[_0xc0f6('0x36')]['id']}})[_0xc0f6('0x2b')](handleEntityNotFound(_0xd8238f,null))[_0xc0f6('0x2b')](function(_0x6bded3){if(_0x6bded3){_0x4ba591=_0x6bded3;_0x439160[_0xc0f6('0x1c')]=_['keys'](db[_0xc0f6('0x39')][_0xc0f6('0x18')]);_0x439160[_0xc0f6('0x1d')]=_[_0xc0f6('0x3a')](_0x162612[_0xc0f6('0x1d')]);_0x439160['filters']=_[_0xc0f6('0x1e')](_0x439160['model'],_0x439160[_0xc0f6('0x1d')]);_0x3d7c22['attributes']=_[_0xc0f6('0x1e')](_0x439160['model'],qs[_0xc0f6('0x20')](_0x162612[_0xc0f6('0x1d')][_0xc0f6('0x20')]));_0x3d7c22[_0xc0f6('0x1f')]=_0x3d7c22['attributes'][_0xc0f6('0x32')]?_0x3d7c22['attributes']:_0x439160['model'];_0x3d7c22[_0xc0f6('0x23')]=qs['sort'](_0x162612[_0xc0f6('0x1d')][_0xc0f6('0x24')]);_0x3d7c22[_0xc0f6('0x25')]=qs[_0xc0f6('0x27')](_['pick'](_0x162612[_0xc0f6('0x1d')],_0x439160['filters']));if(_0x162612[_0xc0f6('0x1d')][_0xc0f6('0x28')]){_0x3d7c22[_0xc0f6('0x25')]=_[_0xc0f6('0x29')](_0x3d7c22[_0xc0f6('0x25')],{'$or':_[_0xc0f6('0x16')](_0x3d7c22[_0xc0f6('0x1f')],function(_0x431cf6){var _0x3c7b4e={};_0x3c7b4e[_0x431cf6]={'$like':'%'+_0x162612[_0xc0f6('0x1d')][_0xc0f6('0x28')]+'%'};return _0x3c7b4e;})});}_0x3d7c22=_[_0xc0f6('0x29')]({},_0x3d7c22,_0x162612[_0xc0f6('0x2a')]);return _0x4ba591[_0xc0f6('0x37')](_0x3d7c22);}})[_0xc0f6('0x2b')](function(_0x39d9c3){if(_0x39d9c3){_0x310a0b=_0x39d9c3['length'];if(!_0x162612[_0xc0f6('0x1d')]['hasOwnProperty'](_0xc0f6('0x22'))){_0x3d7c22['limit']=qs[_0xc0f6('0xb')](_0x162612[_0xc0f6('0x1d')][_0xc0f6('0xb')]);_0x3d7c22['offset']=qs[_0xc0f6('0x8')](_0x162612[_0xc0f6('0x1d')][_0xc0f6('0x8')]);}return _0x4ba591['getConfigurations'](_0x3d7c22);}})[_0xc0f6('0x2b')](function(_0x37991c){if(_0x37991c){return _0x37991c?{'count':_0x310a0b,'rows':_0x37991c}:null;}})[_0xc0f6('0x2b')](respondWithResult(_0xd8238f,null))[_0xc0f6('0x30')](handleError(_0xd8238f,null));};exports['addConfiguration']=function(_0x17c032,_0x33ae35){if(_0x17c032[_0xc0f6('0x35')]['id']){delete _0x17c032[_0xc0f6('0x35')]['id'];}return db[_0xc0f6('0x17')][_0xc0f6('0x38')]({'where':{'id':_0x17c032[_0xc0f6('0x36')]['id']}})[_0xc0f6('0x2b')](handleEntityNotFound(_0x33ae35,null))[_0xc0f6('0x2b')](function(_0x29e225){if(_0x29e225){_0x17c032[_0xc0f6('0x35')][_0xc0f6('0x3b')]=_0x29e225['id'];_0x17c032[_0xc0f6('0x35')][_0xc0f6('0x3c')]=integrations[_0xc0f6('0x3d')](_0x17c032[_0xc0f6('0x35')][_0xc0f6('0x3e')],_0x17c032['body'][_0xc0f6('0x1a')]);_0x17c032[_0xc0f6('0x35')]['Descriptions']=integrations[_0xc0f6('0x3f')](_0x17c032[_0xc0f6('0x35')]['channel'],_0x17c032[_0xc0f6('0x35')][_0xc0f6('0x1a')]);return db[_0xc0f6('0x39')][_0xc0f6('0x34')](_0x17c032['body'],{'include':[{'model':db[_0xc0f6('0x40')],'as':_0xc0f6('0x3c')},{'model':db[_0xc0f6('0x40')],'as':'Descriptions'}]});}return null;})[_0xc0f6('0x2b')](respondWithResult(_0x33ae35,null))['catch'](handleError(_0x33ae35,null));};function sanitizeRemoteUri(_0x1cd772){var _0x135696=_0x1cd772['slice'](-0x1);if(_0x135696==='/')return _0x1cd772[_0xc0f6('0x41')](0x0,_0x1cd772[_0xc0f6('0x42')](_0x135696));return _0x1cd772;}function getWebApiUrl(_0x3f9e13){return util['format'](_0xc0f6('0x43'),_0x3f9e13);}exports['getFields']=function(_0x374219,_0x1c2b9c){var _0x1af103=_0x374219['query'][_0xc0f6('0x44')];var _0xdf5285=_0x1af103==='incident'?'Incident':_0xc0f6('0x45');var _0x231969='';var _0x787226='';var _0xb346a8='';var _0x372b19='';var _0x22d4dc='';var _0x42fef7='';var _0x517c76='';var _0x19528e='';var _0x398fc6=[_0xc0f6('0x46'),_0xc0f6('0x47'),_0xc0f6('0x48'),'ownerid',_0xc0f6('0x49'),_0xc0f6('0x4a'),'phonenumber',_0xc0f6('0x4b'),_0xc0f6('0x4c'),_0xc0f6('0x4d')];var _0x4ee0d8=[_0xc0f6('0x4e'),_0xc0f6('0x4f'),'actualserviceunits','billedserviceunits',_0xc0f6('0x50'),'contactidyominame','contractdetailidname',_0xc0f6('0x51'),_0xc0f6('0x52'),_0xc0f6('0x53'),_0xc0f6('0x54'),_0xc0f6('0x55'),_0xc0f6('0x56'),_0xc0f6('0x57'),_0xc0f6('0x58'),'customeridname','customeridtype',_0xc0f6('0x59'),'emailaddress',_0xc0f6('0x5a'),_0xc0f6('0x5b'),_0xc0f6('0x5c'),_0xc0f6('0x5d'),_0xc0f6('0x5e'),'firstresponsebykpiidname','followupby','importsequencenumber',_0xc0f6('0x5f'),_0xc0f6('0x60'),_0xc0f6('0x61'),_0xc0f6('0x62'),_0xc0f6('0x63'),_0xc0f6('0x64'),_0xc0f6('0x65'),_0xc0f6('0x66'),'modifiedon',_0xc0f6('0x67'),_0xc0f6('0x68'),_0xc0f6('0x69'),_0xc0f6('0x6a'),_0xc0f6('0x6b'),_0xc0f6('0x6c'),'overriddencreatedon',_0xc0f6('0x6d'),_0xc0f6('0x6e'),_0xc0f6('0x6f'),_0xc0f6('0x70'),_0xc0f6('0x71'),_0xc0f6('0x72'),_0xc0f6('0x73'),_0xc0f6('0x74'),_0xc0f6('0x75'),_0xc0f6('0x76'),'resolvebykpiidname',_0xc0f6('0x77'),_0xc0f6('0x78'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0xc0f6('0x79'),_0xc0f6('0x7a'),_0xc0f6('0x7b'),_0xc0f6('0x7c'),_0xc0f6('0x7d'),'ticketnumber','timezoneruleversionnumber',_0xc0f6('0x7e'),_0xc0f6('0x7f'),_0xc0f6('0x80'),_0xc0f6('0x81')];var _0x4ce12b=_0x398fc6['concat'](_0x4ee0d8);return db[_0xc0f6('0x17')]['findOne']({'where':{'id':_0x374219['params']['id']},'attributes':['id','username',_0xc0f6('0x82'),_0xc0f6('0x83'),_0xc0f6('0x84'),_0xc0f6('0x85'),'clientSecret',_0xc0f6('0x86')],'include':[{'model':db[_0xc0f6('0x87')],'as':'CloudProvider','attributes':['id','data5','data7']}]})[_0xc0f6('0x2b')](handleEntityNotFound(_0x1c2b9c,null))[_0xc0f6('0x2b')](function(_0x3ce802){if(_0x3ce802){if(_0x3ce802[_0xc0f6('0x86')]){_0x3ce802[_0xc0f6('0x88')]=_0x3ce802[_0xc0f6('0x87')][_0xc0f6('0x89')];_0x19528e=sanitizeRemoteUri(_0x3ce802[_0xc0f6('0x87')][_0xc0f6('0x8a')]);_0x517c76=getWebApiUrl(_0x19528e);return _0x3ce802;}_0x19528e=sanitizeRemoteUri(_0x3ce802[_0xc0f6('0x83')]);_0x517c76=getWebApiUrl(_0x19528e);var _0x48c707={'method':'POST','uri':_0xc0f6('0x8b')+_0x3ce802[_0xc0f6('0x84')]+'/oauth2/token','form':{'client_id':_0x3ce802['clientId'],'resource':_0x19528e,'username':_0x3ce802['username'],'password':_0x3ce802[_0xc0f6('0x82')],'grant_type':_0xc0f6('0x82'),'client_secret':_0x3ce802[_0xc0f6('0x8c')]},'json':!![]};return rp(_0x48c707);}})[_0xc0f6('0x2b')](function(_0x3683ae){_0x42fef7=_0x3683ae[_0xc0f6('0x88')];var _0xb0cadc={'method':_0xc0f6('0x8d'),'uri':encodeURI(_0x517c76+_0xc0f6('0x8e')+_0xdf5285+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x42fef7,'If-None-Match':null,'OData-Version':_0xc0f6('0x8f')},'json':!![]};return rp(_0xb0cadc);})[_0xc0f6('0x2b')](function(_0x40ff49){var _0x4112d6=_0x40ff49['value'][0x0];var _0x8111da=_0x4112d6[_0xc0f6('0x90')];var _0x45358c={'method':'GET','uri':_0x517c76+_0xc0f6('0x91')+_0x8111da+_0xc0f6('0x92'),'headers':{'Authorization':'Bearer\x20'+_0x42fef7,'If-None-Match':null,'OData-Version':_0xc0f6('0x8f')},'json':!![]};return rp(_0x45358c);})['then'](function(_0x18f1c2){_0x231969=_0x18f1c2;_0x787226=_0x231969[_0xc0f6('0x93')];_0x787226=_[_0xc0f6('0x94')](_0x787226,function(_0x209222){return!_0x4ce12b['includes'](_0x209222[_0xc0f6('0x95')]);});var _0x45c592=[];var _0x1af30e=[];_0x787226['forEach'](function(_0x124bbb){if(_0x124bbb[_0xc0f6('0x96')]){var _0x2673a8=_0x124bbb[_0xc0f6('0x96')][_0xc0f6('0x41')](_0x124bbb[_0xc0f6('0x96')][_0xc0f6('0x42')]('.')+0x1);if(_0x2673a8===_0xc0f6('0x97')){_0x45c592[_0xc0f6('0x98')](getSelectList(_0x517c76,_0x1af103,_0x1af30e,_0x231969[_0xc0f6('0x90')],_0x124bbb['MetadataId'],_0x42fef7));}}});return Promise[_0xc0f6('0x99')](_0x45c592);})[_0xc0f6('0x2b')](function(_0x469b8f){_0xb346a8=_0x469b8f[0x0];var _0x49a661=[];var _0xbb1bed=[];_0x787226[_0xc0f6('0x9a')](function(_0x267830){if(!_[_0xc0f6('0x9b')](_0x267830['@odata.type'])){var _0x4c4657=_0x267830['@odata.type'][_0xc0f6('0x41')](_0x267830[_0xc0f6('0x96')][_0xc0f6('0x42')]('.')+0x1);if(_0x4c4657==='BooleanAttributeMetadata'){_0x49a661['push'](getBooleanList(_0x517c76,_0x1af103,_0xbb1bed,_0x231969[_0xc0f6('0x90')],_0x267830[_0xc0f6('0x90')],_0x42fef7));}}});return Promise[_0xc0f6('0x99')](_0x49a661);})[_0xc0f6('0x2b')](function(_0x1287c3){_0x372b19=_0x1287c3[0x0];var _0x373c79=[];var _0x310b88=[];_0x787226[_0xc0f6('0x9a')](function(_0x439de2){if(_0x439de2[_0xc0f6('0x96')]){var _0x64555=_0x439de2[_0xc0f6('0x96')]['substring'](_0x439de2[_0xc0f6('0x96')]['lastIndexOf']('.')+0x1);if(_0x64555==='StringAttributeMetadata'||_0x64555==='DoubleAttributeMetadata'||_0x64555===_0xc0f6('0x9c')||_0x64555==='IntegerAttributeMetadata'||_0x64555===_0xc0f6('0x9d')||_0x64555==='DateTimeAttributeMetadata'||_0x64555===_0xc0f6('0x9e')||_0x64555==='EntityNameAttributeMetadata'||_0x64555==='StateAttributeMetadata'||_0x64555==='DecimalAttributeMetadata'){_0x373c79[_0xc0f6('0x98')](getInputList(_0x517c76,_0x1af103,_0x64555,_0x310b88,_0x231969[_0xc0f6('0x90')],_0x439de2[_0xc0f6('0x90')],_0x42fef7));}}});return Promise[_0xc0f6('0x99')](_0x373c79);})[_0xc0f6('0x2b')](function(_0x570243){_0x22d4dc=_0x570243[0x0];var _0x1c561f=_0xb346a8[_0xc0f6('0x9f')](_0x372b19)[_0xc0f6('0x9f')](_0x22d4dc);var _0x360928={'count':_0x1c561f[_0xc0f6('0x32')],'rows':_0x1c561f};return _0x360928;})[_0xc0f6('0x2b')](respondWithResult(_0x1c2b9c,null))[_0xc0f6('0x30')](function(_0xda752b){var _0x24cc7c=_0x374219[_0xc0f6('0x1d')][_0xc0f6('0xa0')]?0x1f4:_0xda752b['statusCode']||0x1f4;logger[_0xc0f6('0x11')](_0xda752b[_0xc0f6('0x12')]);delete _0xda752b['name'];if(_0x24cc7c===0x191){_0x24cc7c=0x190;}_0x1c2b9c['status'](_0x24cc7c)[_0xc0f6('0x14')](_0x374219[_0xc0f6('0x1d')][_0xc0f6('0xa0')]?{'message':_0xc0f6('0xa1'),'statusCode':_0xda752b[_0xc0f6('0xa2')]}:_0xda752b);});};function getSelectList(_0xc97a10,_0x85a543,_0x285a71,_0x56d396,_0x347e1a,_0x25704e){var _0x31ea38={'method':_0xc0f6('0x8d'),'uri':_0xc97a10+'EntityDefinitions('+_0x56d396+_0xc0f6('0xa3')+_0x347e1a+_0xc0f6('0xa4')+_0xc0f6('0xa5'),'headers':{'Authorization':_0xc0f6('0xa6')+_0x25704e,'If-None-Match':null,'OData-Version':_0xc0f6('0x8f')},'json':!![]};return rp(_0x31ea38)[_0xc0f6('0x2b')](function(_0x5ae777){var _0x3834dd=[];var _0xf88f7=_0x5ae777[_0xc0f6('0xa7')]['Options'];_0xf88f7['forEach'](function(_0x9d67de){_0x3834dd[_0xc0f6('0x98')]({'name':_0x9d67de['Label'][_0xc0f6('0xa8')][_0xc0f6('0xa9')],'value':String(_0x9d67de[_0xc0f6('0xaa')])});});var _0x7c381c={'id':_0x85a543+'_'+_0x5ae777[_0xc0f6('0x95')],'name':_0x5ae777['DisplayName'][_0xc0f6('0xa8')]['Label'],'custom':![],'options':_0x3834dd};_0x285a71[_0xc0f6('0x98')](_0x7c381c);return _0x285a71;});}function getBooleanList(_0x2bbbf6,_0x16676a,_0x17db91,_0x546631,_0x46abd1,_0x4877c9){var _0x9f1fe0={'method':_0xc0f6('0x8d'),'uri':_0x2bbbf6+_0xc0f6('0x91')+_0x546631+_0xc0f6('0xa3')+_0x46abd1+_0xc0f6('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x4877c9,'If-None-Match':null,'OData-Version':_0xc0f6('0x8f')},'json':!![]};return rp(_0x9f1fe0)['then'](function(_0x3bd078){var _0x426b9f=[];_0x426b9f[_0xc0f6('0x98')]({'name':_0x3bd078[_0xc0f6('0xa7')][_0xc0f6('0xac')][_0xc0f6('0xa9')][_0xc0f6('0xa8')][_0xc0f6('0xa9')],'value':_0xc0f6('0xad')},{'name':_0x3bd078['OptionSet'][_0xc0f6('0xae')][_0xc0f6('0xa9')][_0xc0f6('0xa8')][_0xc0f6('0xa9')],'value':_0xc0f6('0xaf')});var _0x599e18={'id':_0x16676a+'_'+_0x3bd078['LogicalName'],'name':_0x3bd078['DisplayName'][_0xc0f6('0xa8')]['Label'],'custom':![],'options':_0x426b9f};_0x17db91['push'](_0x599e18);return _0x17db91;});}function getInputList(_0x3f27b7,_0x14f805,_0x4e99b9,_0x52b382,_0x83eecd,_0x753b64,_0x2747bc){var _0x5334c6={'method':_0xc0f6('0x8d'),'uri':_0x3f27b7+_0xc0f6('0x91')+_0x83eecd+_0xc0f6('0xa3')+_0x753b64+_0xc0f6('0xb0')+_0x4e99b9+_0xc0f6('0xb1'),'headers':{'Authorization':_0xc0f6('0xa6')+_0x2747bc,'If-None-Match':null,'OData-Version':_0xc0f6('0x8f')},'json':!![]};return rp(_0x5334c6)[_0xc0f6('0x2b')](function(_0x29ff74){var _0x510fba={'id':_0x14f805+'_'+_0x29ff74[_0xc0f6('0x95')],'name':_0x29ff74[_0xc0f6('0xb2')][_0xc0f6('0xa8')]?_0x29ff74[_0xc0f6('0xb2')][_0xc0f6('0xa8')]['Label']:_0x29ff74[_0xc0f6('0x95')],'custom':![],'options':[]};_0x52b382[_0xc0f6('0x98')](_0x510fba);return _0x52b382;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 029363b..87202d2 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x3ab080,_0x2b8205){var _0x48d481=function(_0x3c8cb1){while(--_0x3c8cb1){_0x3ab080['push'](_0x3ab080['shift']());}};_0x48d481(++_0x2b8205);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40e4dc,_0x3bd67d){var _0x44a378=function(_0xbbf6b5){while(--_0xbbf6b5){_0x40e4dc['push'](_0x40e4dc['shift']());}};_0x44a378(++_0x3bd67d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e1e9cb0..8d83911 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 _0x71f6=['client','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','info','ShowDynamics365Account','catch','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x579d51,_0x50019e){var _0x8920fd=function(_0x41fb71){while(--_0x41fb71){_0x579d51['push'](_0x579d51['shift']());}};_0x8920fd(++_0x50019e);}(_0x71f6,0xf7));var _0x671f=function(_0x23bd99,_0x267473){_0x23bd99=_0x23bd99-0x0;var _0x8213c8=_0x71f6[_0x23bd99];return _0x8213c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x671f('0x0'));var fs=require('fs');var Redis=require(_0x671f('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x671f('0x2'));var logger=require(_0x671f('0x3'))(_0x671f('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x671f('0x5')][_0x671f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17e4d6,_0xa506c,_0x33ede5){return new BPromise(function(_0x2c0fe0,_0x2d87a6){return client[_0x671f('0x7')](_0x17e4d6,_0x33ede5)['then'](function(_0x3f750b){logger['info'](_0x671f('0x8'),_0xa506c,_0x671f('0x9'));logger[_0x671f('0xa')](_0x671f('0xb'),_0xa506c,_0x671f('0x9'),JSON[_0x671f('0xc')](_0x3f750b));if(_0x3f750b[_0x671f('0xd')]){if(_0x3f750b[_0x671f('0xd')]['code']===0x1f4){logger[_0x671f('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0xa506c,_0x3f750b[_0x671f('0xd')]['message']);return _0x2d87a6(_0x3f750b['error'][_0x671f('0xe')]);}logger[_0x671f('0xd')](_0x671f('0x8'),_0xa506c,_0x3f750b[_0x671f('0xd')][_0x671f('0xe')]);return _0x2c0fe0(_0x3f750b[_0x671f('0xd')][_0x671f('0xe')]);}else{logger['info'](_0x671f('0x8'),_0xa506c,_0x671f('0x9'));_0x2c0fe0(_0x3f750b['result'][_0x671f('0xe')]);}})['catch'](function(_0x1c26d0){logger[_0x671f('0xd')](_0x671f('0x8'),_0xa506c,_0x1c26d0);_0x2d87a6(_0x1c26d0);});});}exports[_0x671f('0xf')]=function(_0x17c51e){var _0x1e7573=this;return new Promise(function(_0x27eba9,_0x1d234f){return db[_0x671f('0x10')]['findAll']({'raw':_0x17c51e[_0x671f('0x11')]?_0x17c51e['options'][_0x671f('0x12')]===undefined?!![]:![]:!![],'where':_0x17c51e['options']?_0x17c51e[_0x671f('0x11')][_0x671f('0x13')]||null:null,'attributes':_0x17c51e[_0x671f('0x11')]?_0x17c51e['options'][_0x671f('0x14')]||null:null,'limit':_0x17c51e[_0x671f('0x11')]?_0x17c51e['options'][_0x671f('0x15')]||null:null,'include':_0x17c51e[_0x671f('0x11')]?_0x17c51e[_0x671f('0x11')][_0x671f('0x16')]?_[_0x671f('0x17')](_0x17c51e[_0x671f('0x11')][_0x671f('0x16')],function(_0x46eb67){return{'model':db[_0x46eb67['model']],'as':_0x46eb67['as'],'attributes':_0x46eb67[_0x671f('0x14')],'include':_0x46eb67['include']?_[_0x671f('0x17')](_0x46eb67['include'],function(_0x537bbf){return{'model':db[_0x537bbf[_0x671f('0x18')]],'as':_0x537bbf['as'],'attributes':_0x537bbf[_0x671f('0x14')],'include':_0x537bbf['include']?_['map'](_0x537bbf[_0x671f('0x16')],function(_0x4842aa){return{'model':db[_0x4842aa[_0x671f('0x18')]],'as':_0x4842aa['as'],'attributes':_0x4842aa[_0x671f('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x505b47){logger['info'](_0x671f('0xf'),_0x17c51e);logger[_0x671f('0xa')](_0x671f('0xf'),_0x17c51e,JSON['stringify'](_0x505b47));_0x27eba9(_0x505b47);})['catch'](function(_0xdab857){logger[_0x671f('0xd')]('GetDynamics365Account',_0xdab857[_0x671f('0xe')],_0x17c51e);_0x1d234f(_0x1e7573[_0x671f('0xd')](0x1f4,_0xdab857['message']));});});};exports['ShowDynamics365Account']=function(_0x4fa367){var _0x39bce9=this;return new Promise(function(_0x5d9bb0,_0xad590f){return db[_0x671f('0x10')]['find']({'raw':_0x4fa367[_0x671f('0x11')]?_0x4fa367['options'][_0x671f('0x12')]===undefined?!![]:![]:!![],'where':_0x4fa367[_0x671f('0x11')]?_0x4fa367[_0x671f('0x11')][_0x671f('0x13')]||null:null,'attributes':_0x4fa367[_0x671f('0x11')]?_0x4fa367[_0x671f('0x11')]['attributes']||null:null,'include':_0x4fa367['options']?_0x4fa367[_0x671f('0x11')][_0x671f('0x16')]?_[_0x671f('0x17')](_0x4fa367[_0x671f('0x11')][_0x671f('0x16')],function(_0x41fda9){return{'model':db[_0x41fda9[_0x671f('0x18')]],'as':_0x41fda9['as'],'attributes':_0x41fda9[_0x671f('0x14')],'include':_0x41fda9[_0x671f('0x16')]?_[_0x671f('0x17')](_0x41fda9[_0x671f('0x16')],function(_0x41f5ee){return{'model':db[_0x41f5ee['model']],'as':_0x41f5ee['as'],'attributes':_0x41f5ee[_0x671f('0x14')],'include':_0x41f5ee['include']?_['map'](_0x41f5ee[_0x671f('0x16')],function(_0xa945e1){return{'model':db[_0xa945e1[_0x671f('0x18')]],'as':_0xa945e1['as'],'attributes':_0xa945e1[_0x671f('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x985ec4){logger[_0x671f('0x19')](_0x671f('0x1a'),_0x4fa367);logger[_0x671f('0xa')](_0x671f('0x1a'),_0x4fa367,JSON['stringify'](_0x985ec4));_0x5d9bb0(_0x985ec4);})[_0x671f('0x1b')](function(_0x1afa21){logger[_0x671f('0xd')](_0x671f('0x1a'),_0x1afa21[_0x671f('0xe')],_0x4fa367);_0xad590f(_0x39bce9['error'](0x1f4,_0x1afa21['message']));});});}; \ No newline at end of file +var _0x3b36=['GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','message','error','Dynamics365Account,\x20%s,\x20%s','catch'];(function(_0x14ad92,_0x3b4315){var _0x41ceae=function(_0x252cd1){while(--_0x252cd1){_0x14ad92['push'](_0x14ad92['shift']());}};_0x41ceae(++_0x3b4315);}(_0x3b36,0xd9));var _0x63b3=function(_0x4df79f,_0x35fc2a){_0x4df79f=_0x4df79f-0x0;var _0x57109e=_0x3b36[_0x4df79f];return _0x57109e;};'use strict';var _=require(_0x63b3('0x0'));var util=require(_0x63b3('0x1'));var moment=require('moment');var BPromise=require(_0x63b3('0x2'));var rs=require(_0x63b3('0x3'));var fs=require('fs');var Redis=require(_0x63b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x63b3('0x5'))(_0x63b3('0x6'));var config=require(_0x63b3('0x7'));var jayson=require(_0x63b3('0x8'));var client=jayson['client'][_0x63b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b6fbd,_0x1d0136,_0x21bd5b){return new BPromise(function(_0x46cf18,_0x16a481){return client['request'](_0x2b6fbd,_0x21bd5b)[_0x63b3('0xa')](function(_0x4db47a){logger[_0x63b3('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x1d0136,_0x63b3('0xc'));logger[_0x63b3('0xd')](_0x63b3('0xe'),_0x1d0136,'request\x20sent',JSON[_0x63b3('0xf')](_0x4db47a));if(_0x4db47a['error']){if(_0x4db47a['error'][_0x63b3('0x10')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x1d0136,_0x4db47a['error'][_0x63b3('0x11')]);return _0x16a481(_0x4db47a[_0x63b3('0x12')][_0x63b3('0x11')]);}logger[_0x63b3('0x12')](_0x63b3('0x13'),_0x1d0136,_0x4db47a[_0x63b3('0x12')][_0x63b3('0x11')]);return _0x46cf18(_0x4db47a[_0x63b3('0x12')][_0x63b3('0x11')]);}else{logger[_0x63b3('0xb')](_0x63b3('0x13'),_0x1d0136,_0x63b3('0xc'));_0x46cf18(_0x4db47a['result'][_0x63b3('0x11')]);}})[_0x63b3('0x14')](function(_0xc10a8a){logger['error'](_0x63b3('0x13'),_0x1d0136,_0xc10a8a);_0x16a481(_0xc10a8a);});});}exports[_0x63b3('0x15')]=function(_0x44ade3){var _0x1ccf02=this;return new Promise(function(_0x42e06a,_0x2fb8b4){return db[_0x63b3('0x16')][_0x63b3('0x17')]({'raw':_0x44ade3['options']?_0x44ade3[_0x63b3('0x18')][_0x63b3('0x19')]===undefined?!![]:![]:!![],'where':_0x44ade3[_0x63b3('0x18')]?_0x44ade3[_0x63b3('0x18')][_0x63b3('0x1a')]||null:null,'attributes':_0x44ade3[_0x63b3('0x18')]?_0x44ade3[_0x63b3('0x18')][_0x63b3('0x1b')]||null:null,'limit':_0x44ade3[_0x63b3('0x18')]?_0x44ade3['options'][_0x63b3('0x1c')]||null:null,'include':_0x44ade3[_0x63b3('0x18')]?_0x44ade3[_0x63b3('0x18')][_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x44ade3[_0x63b3('0x18')][_0x63b3('0x1d')],function(_0x8efe19){return{'model':db[_0x8efe19['model']],'as':_0x8efe19['as'],'attributes':_0x8efe19['attributes'],'include':_0x8efe19[_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x8efe19[_0x63b3('0x1d')],function(_0x55a372){return{'model':db[_0x55a372[_0x63b3('0x1f')]],'as':_0x55a372['as'],'attributes':_0x55a372['attributes'],'include':_0x55a372[_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x55a372[_0x63b3('0x1d')],function(_0x24e84d){return{'model':db[_0x24e84d[_0x63b3('0x1f')]],'as':_0x24e84d['as'],'attributes':_0x24e84d[_0x63b3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x63b3('0xa')](function(_0x2682ba){logger[_0x63b3('0xb')](_0x63b3('0x15'),_0x44ade3);logger[_0x63b3('0xd')](_0x63b3('0x15'),_0x44ade3,JSON[_0x63b3('0xf')](_0x2682ba));_0x42e06a(_0x2682ba);})[_0x63b3('0x14')](function(_0x2b2591){logger[_0x63b3('0x12')](_0x63b3('0x15'),_0x2b2591[_0x63b3('0x11')],_0x44ade3);_0x2fb8b4(_0x1ccf02[_0x63b3('0x12')](0x1f4,_0x2b2591[_0x63b3('0x11')]));});});};exports[_0x63b3('0x20')]=function(_0x36b986){var _0x7f6ae6=this;return new Promise(function(_0xa332b,_0x4872e4){return db[_0x63b3('0x16')][_0x63b3('0x21')]({'raw':_0x36b986[_0x63b3('0x18')]?_0x36b986[_0x63b3('0x18')][_0x63b3('0x19')]===undefined?!![]:![]:!![],'where':_0x36b986[_0x63b3('0x18')]?_0x36b986[_0x63b3('0x18')][_0x63b3('0x1a')]||null:null,'attributes':_0x36b986[_0x63b3('0x18')]?_0x36b986[_0x63b3('0x18')][_0x63b3('0x1b')]||null:null,'include':_0x36b986[_0x63b3('0x18')]?_0x36b986[_0x63b3('0x18')][_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x36b986[_0x63b3('0x18')][_0x63b3('0x1d')],function(_0x57be5f){return{'model':db[_0x57be5f[_0x63b3('0x1f')]],'as':_0x57be5f['as'],'attributes':_0x57be5f[_0x63b3('0x1b')],'include':_0x57be5f[_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x57be5f[_0x63b3('0x1d')],function(_0x250f69){return{'model':db[_0x250f69['model']],'as':_0x250f69['as'],'attributes':_0x250f69['attributes'],'include':_0x250f69[_0x63b3('0x1d')]?_[_0x63b3('0x1e')](_0x250f69[_0x63b3('0x1d')],function(_0x477c23){return{'model':db[_0x477c23[_0x63b3('0x1f')]],'as':_0x477c23['as'],'attributes':_0x477c23[_0x63b3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x63b3('0xa')](function(_0x277cf0){logger[_0x63b3('0xb')](_0x63b3('0x20'),_0x36b986);logger[_0x63b3('0xd')](_0x63b3('0x20'),_0x36b986,JSON[_0x63b3('0xf')](_0x277cf0));_0xa332b(_0x277cf0);})[_0x63b3('0x14')](function(_0x3ca2de){logger['error'](_0x63b3('0x20'),_0x3ca2de[_0x63b3('0x11')],_0x36b986);_0x4872e4(_0x7f6ae6[_0x63b3('0x12')](0x1f4,_0x3ca2de['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index c2582f9..90b51d0 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 _0x26f0=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x5830d6,_0x3841e1){var _0x5dff92=function(_0x76f516){while(--_0x76f516){_0x5830d6['push'](_0x5830d6['shift']());}};_0x5dff92(++_0x3841e1);}(_0x26f0,0xf4));var _0x026f=function(_0x23cc51,_0xb5be71){_0x23cc51=_0x23cc51-0x0;var _0x19aac1=_0x26f0[_0x23cc51];return _0x19aac1;};'use strict';var multer=require(_0x026f('0x0'));var util=require(_0x026f('0x1'));var path=require(_0x026f('0x2'));var timeout=require(_0x026f('0x3'));var express=require('express');var router=express[_0x026f('0x4')]();var fs_extra=require(_0x026f('0x5'));var auth=require(_0x026f('0x6'));var interaction=require(_0x026f('0x7'));var config=require(_0x026f('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x026f('0x9')]('/',auth['isAuthenticated'](),controller[_0x026f('0xa')]);router['get'](_0x026f('0xb'),auth[_0x026f('0xc')](),controller['show']);router[_0x026f('0x9')]('/:id/fields',auth[_0x026f('0xc')](),controller[_0x026f('0xd')]);router['get'](_0x026f('0xe'),auth['isAuthenticated'](),controller[_0x026f('0xf')]);router[_0x026f('0x9')](_0x026f('0x10'),auth[_0x026f('0xc')](),controller[_0x026f('0x11')]);router[_0x026f('0x12')]('/',auth[_0x026f('0xc')](),controller['create']);router[_0x026f('0x13')](_0x026f('0xb'),auth[_0x026f('0xc')](),controller[_0x026f('0x14')]);router[_0x026f('0x15')](_0x026f('0xb'),auth[_0x026f('0xc')](),controller[_0x026f('0x16')]);module[_0x026f('0x17')]=router; \ No newline at end of file +var _0x4e63=['/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects'];(function(_0x436ad6,_0x3b164d){var _0x42ff62=function(_0x4ae006){while(--_0x4ae006){_0x436ad6['push'](_0x436ad6['shift']());}};_0x42ff62(++_0x3b164d);}(_0x4e63,0x1ad));var _0x34e6=function(_0x1e99d7,_0x18fa1f){_0x1e99d7=_0x1e99d7-0x0;var _0x3970bf=_0x4e63[_0x1e99d7];return _0x3970bf;};'use strict';var multer=require('multer');var util=require(_0x34e6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x34e6('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34e6('0x2'));var interaction=require(_0x34e6('0x3'));var config=require('../../config/environment');var controller=require(_0x34e6('0x4'));router[_0x34e6('0x5')]('/',auth[_0x34e6('0x6')](),controller[_0x34e6('0x7')]);router[_0x34e6('0x5')]('/:id',auth[_0x34e6('0x6')](),controller[_0x34e6('0x8')]);router[_0x34e6('0x5')]('/:id/fields',auth[_0x34e6('0x6')](),controller[_0x34e6('0x9')]);router['get'](_0x34e6('0xa'),auth['isAuthenticated'](),controller[_0x34e6('0xb')]);router[_0x34e6('0x5')](_0x34e6('0xc'),auth[_0x34e6('0x6')](),controller[_0x34e6('0xd')]);router[_0x34e6('0xe')]('/',auth[_0x34e6('0x6')](),controller[_0x34e6('0xf')]);router[_0x34e6('0x10')](_0x34e6('0x11'),auth[_0x34e6('0x6')](),controller['update']);router[_0x34e6('0x12')](_0x34e6('0x11'),auth[_0x34e6('0x6')](),controller[_0x34e6('0x13')]);module[_0x34e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 83a0eec..7ba4e2f 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 _0x7679=['ENUM','phonecall','incident','contact','nothing','STRING','BOOLEAN','sequelize'];(function(_0x24a654,_0x20ce45){var _0x395ed2=function(_0x45bc5a){while(--_0x45bc5a){_0x24a654['push'](_0x24a654['shift']());}};_0x395ed2(++_0x20ce45);}(_0x7679,0x147));var _0x9767=function(_0xc24407,_0x97c48d){_0xc24407=_0xc24407-0x0;var _0x577936=_0x7679[_0xc24407];return _0x577936;};'use strict';var Sequelize=require(_0x9767('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9767('0x1')]('incident',_0x9767('0x2')),'defaultValue':_0x9767('0x3')},'moduleCreate':{'type':Sequelize[_0x9767('0x1')](_0x9767('0x4'),_0x9767('0x5')),'defaultValue':_0x9767('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9767('0x6')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9767('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xda76=['ENUM','incident','contact','BOOLEAN','sequelize','exports','STRING'];(function(_0x36a19c,_0x1f33c4){var _0x6cf1f=function(_0x1639ba){while(--_0x1639ba){_0x36a19c['push'](_0x36a19c['shift']());}};_0x6cf1f(++_0x1f33c4);}(_0xda76,0xf2));var _0x6da7=function(_0x410f4d,_0x1c8d9c){_0x410f4d=_0x410f4d-0x0;var _0x1c63f5=_0xda76[_0x410f4d];return _0x1c63f5;};'use strict';var Sequelize=require(_0x6da7('0x0'));module[_0x6da7('0x1')]={'name':{'type':Sequelize[_0x6da7('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6da7('0x3')](_0x6da7('0x4'),'phonecall'),'defaultValue':_0x6da7('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x6da7('0x5'),'nothing'),'defaultValue':_0x6da7('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6da7('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f40a796..27226be 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 _0xed70=['../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','stack','name','send','map','Dynamics365Configuration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','include','rows','catch','show','params','keys','rawAttributes','merge','options','find','create','body','getFields','findOne','Dynamics365Field','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1dcf5d,_0x4fc9ac){var _0x5ccb09=function(_0x2ab7c7){while(--_0x2ab7c7){_0x1dcf5d['push'](_0x1dcf5d['shift']());}};_0x5ccb09(++_0x4fc9ac);}(_0xed70,0x1ee));var _0x0ed7=function(_0x312d54,_0x3c3133){_0x312d54=_0x312d54-0x0;var _0x5a5236=_0xed70[_0x312d54];return _0x5a5236;};'use strict';var emlformat=require(_0x0ed7('0x0'));var rimraf=require(_0x0ed7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ed7('0x2'));var BPromise=require(_0x0ed7('0x3'));var Mustache=require(_0x0ed7('0x4'));var util=require(_0x0ed7('0x5'));var path=require(_0x0ed7('0x6'));var sox=require(_0x0ed7('0x7'));var csv=require(_0x0ed7('0x8'));var ejs=require(_0x0ed7('0x9'));var fs=require('fs');var fs_extra=require(_0x0ed7('0xa'));var _=require('lodash');var squel=require(_0x0ed7('0xb'));var crypto=require(_0x0ed7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ed7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0ed7('0xd'));var authService=require(_0x0ed7('0xe'));var qs=require(_0x0ed7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ed7('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0ed7('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ed7('0x12'))['db'];function respondWithStatusCode(_0x525436,_0xc89943){_0xc89943=_0xc89943||0xcc;return function(_0x1659e8){if(_0x1659e8){return _0x525436[_0x0ed7('0x13')](_0xc89943);}return _0x525436['status'](_0xc89943)[_0x0ed7('0x14')]();};}function respondWithResult(_0x42343f,_0x48b813){_0x48b813=_0x48b813||0xc8;return function(_0x4bde31){if(_0x4bde31){return _0x42343f[_0x0ed7('0x15')](_0x48b813)[_0x0ed7('0x16')](_0x4bde31);}};}function respondWithFilteredResult(_0x2079ed,_0x598907){return function(_0x55fe31){if(_0x55fe31){var _0x2499ce=typeof _0x598907[_0x0ed7('0x17')]===_0x0ed7('0x18')&&typeof _0x598907['limit']===_0x0ed7('0x18');var _0x190ec2=_0x55fe31['count'];var _0x58f9b0=_0x2499ce?0x0:_0x598907['offset'];var _0x417c18=_0x2499ce?_0x55fe31[_0x0ed7('0x19')]:_0x598907[_0x0ed7('0x17')]+_0x598907['limit'];var _0x186b4c;if(_0x417c18>=_0x190ec2){_0x417c18=_0x190ec2;_0x186b4c=0xc8;}else{_0x186b4c=0xce;}_0x2079ed[_0x0ed7('0x15')](_0x186b4c);return _0x2079ed['set'](_0x0ed7('0x1a'),_0x58f9b0+'-'+_0x417c18+'/'+_0x190ec2)[_0x0ed7('0x16')](_0x55fe31);}return null;};}function patchUpdates(_0x3fa46f){return function(_0x5c3265){try{jsonpatch[_0x0ed7('0x1b')](_0x5c3265,_0x3fa46f,!![]);}catch(_0x1195bd){return BPromise['reject'](_0x1195bd);}return _0x5c3265[_0x0ed7('0x1c')]();};}function saveUpdates(_0x458615,_0x2f276b){return function(_0x390e29){if(_0x390e29){return _0x390e29[_0x0ed7('0x1d')](_0x458615)[_0x0ed7('0x1e')](function(_0x875f40){return _0x875f40;});}return null;};}function removeEntity(_0xf441a8,_0x3ee9be){return function(_0x2d0ab4){if(_0x2d0ab4){return _0x2d0ab4[_0x0ed7('0x1f')]()[_0x0ed7('0x1e')](function(){_0xf441a8['status'](0xcc)[_0x0ed7('0x14')]();});}};}function handleEntityNotFound(_0xf2250,_0x265656){return function(_0xfe57a8){if(!_0xfe57a8){_0xf2250[_0x0ed7('0x13')](0x194);}return _0xfe57a8;};}function handleError(_0x595503,_0x3571f9){_0x3571f9=_0x3571f9||0x1f4;return function(_0xfeab57){logger['error'](_0xfeab57[_0x0ed7('0x20')]);if(_0xfeab57['name']){delete _0xfeab57[_0x0ed7('0x21')];}_0x595503[_0x0ed7('0x15')](_0x3571f9)[_0x0ed7('0x22')](_0xfeab57);};}exports['index']=function(_0x4a9955,_0x9f630d){var _0x274973={},_0x3e7f8a={},_0x7875f6={'count':0x0,'rows':[]};var _0x3f8166=_[_0x0ed7('0x23')](db[_0x0ed7('0x24')]['rawAttributes'],function(_0x4ed67b){return{'name':_0x4ed67b[_0x0ed7('0x25')],'type':_0x4ed67b[_0x0ed7('0x26')][_0x0ed7('0x27')]};});_0x3e7f8a[_0x0ed7('0x28')]=_[_0x0ed7('0x23')](_0x3f8166,_0x0ed7('0x21'));_0x3e7f8a[_0x0ed7('0x29')]=_['keys'](_0x4a9955[_0x0ed7('0x29')]);_0x3e7f8a[_0x0ed7('0x2a')]=_[_0x0ed7('0x2b')](_0x3e7f8a[_0x0ed7('0x28')],_0x3e7f8a['query']);_0x274973[_0x0ed7('0x2c')]=_[_0x0ed7('0x2b')](_0x3e7f8a[_0x0ed7('0x28')],qs[_0x0ed7('0x2d')](_0x4a9955[_0x0ed7('0x29')][_0x0ed7('0x2d')]));_0x274973[_0x0ed7('0x2c')]=_0x274973['attributes'][_0x0ed7('0x2e')]?_0x274973[_0x0ed7('0x2c')]:_0x3e7f8a['model'];if(!_0x4a9955['query']['hasOwnProperty'](_0x0ed7('0x2f'))){_0x274973[_0x0ed7('0x30')]=qs['limit'](_0x4a9955['query']['limit']);_0x274973[_0x0ed7('0x17')]=qs[_0x0ed7('0x17')](_0x4a9955['query']['offset']);}_0x274973['order']=qs[_0x0ed7('0x31')](_0x4a9955['query'][_0x0ed7('0x31')]);_0x274973[_0x0ed7('0x32')]=qs['filters'](_[_0x0ed7('0x33')](_0x4a9955[_0x0ed7('0x29')],_0x3e7f8a[_0x0ed7('0x2a')]),_0x3f8166);if(_0x4a9955['query'][_0x0ed7('0x34')]){_0x274973['where']=_['merge'](_0x274973['where'],{'$or':_[_0x0ed7('0x23')](_0x3f8166,function(_0x19d19d){if(_0x19d19d[_0x0ed7('0x26')]!==_0x0ed7('0x35')){var _0x5340ce={};_0x5340ce[_0x19d19d[_0x0ed7('0x21')]]={'$like':'%'+_0x4a9955[_0x0ed7('0x29')][_0x0ed7('0x34')]+'%'};return _0x5340ce;}})});}_0x274973=_['merge']({},_0x274973,_0x4a9955['options']);var _0x2460d9={'where':_0x274973[_0x0ed7('0x32')]};return db['Dynamics365Configuration'][_0x0ed7('0x19')](_0x2460d9)[_0x0ed7('0x1e')](function(_0xa9ba52){_0x7875f6[_0x0ed7('0x19')]=_0xa9ba52;if(_0x4a9955[_0x0ed7('0x29')]['includeAll']){_0x274973[_0x0ed7('0x36')]=[{'all':!![]}];}return db[_0x0ed7('0x24')]['findAll'](_0x274973);})[_0x0ed7('0x1e')](function(_0x11ec3e){_0x7875f6[_0x0ed7('0x37')]=_0x11ec3e;return _0x7875f6;})[_0x0ed7('0x1e')](respondWithFilteredResult(_0x9f630d,_0x274973))[_0x0ed7('0x38')](handleError(_0x9f630d,null));};exports[_0x0ed7('0x39')]=function(_0x3dd899,_0x425b2c){var _0x41ba1d={'raw':![],'where':{'id':_0x3dd899[_0x0ed7('0x3a')]['id']}},_0x440d19={};_0x440d19[_0x0ed7('0x28')]=_[_0x0ed7('0x3b')](db[_0x0ed7('0x24')][_0x0ed7('0x3c')]);_0x440d19[_0x0ed7('0x29')]=_['keys'](_0x3dd899[_0x0ed7('0x29')]);_0x440d19[_0x0ed7('0x2a')]=_['intersection'](_0x440d19[_0x0ed7('0x28')],_0x440d19['query']);_0x41ba1d[_0x0ed7('0x2c')]=_[_0x0ed7('0x2b')](_0x440d19[_0x0ed7('0x28')],qs[_0x0ed7('0x2d')](_0x3dd899['query'][_0x0ed7('0x2d')]));_0x41ba1d[_0x0ed7('0x2c')]=_0x41ba1d[_0x0ed7('0x2c')]['length']?_0x41ba1d[_0x0ed7('0x2c')]:_0x440d19[_0x0ed7('0x28')];if(_0x3dd899['query']['includeAll']){_0x41ba1d[_0x0ed7('0x36')]=[{'all':!![]}];}_0x41ba1d=_[_0x0ed7('0x3d')]({},_0x41ba1d,_0x3dd899[_0x0ed7('0x3e')]);return db[_0x0ed7('0x24')][_0x0ed7('0x3f')](_0x41ba1d)['then'](handleEntityNotFound(_0x425b2c,null))[_0x0ed7('0x1e')](respondWithResult(_0x425b2c,null))[_0x0ed7('0x38')](handleError(_0x425b2c,null));};exports['create']=function(_0x386d3b,_0x1986aa){return db[_0x0ed7('0x24')][_0x0ed7('0x40')](_0x386d3b[_0x0ed7('0x41')],{})[_0x0ed7('0x1e')](respondWithResult(_0x1986aa,0xc9))[_0x0ed7('0x38')](handleError(_0x1986aa,null));};exports[_0x0ed7('0x1d')]=function(_0xf37bf7,_0x3250c8){if(_0xf37bf7['body']['id']){delete _0xf37bf7[_0x0ed7('0x41')]['id'];}return db['Dynamics365Configuration'][_0x0ed7('0x3f')]({'where':{'id':_0xf37bf7['params']['id']}})[_0x0ed7('0x1e')](handleEntityNotFound(_0x3250c8,null))[_0x0ed7('0x1e')](saveUpdates(_0xf37bf7[_0x0ed7('0x41')],null))['then'](respondWithResult(_0x3250c8,null))['catch'](handleError(_0x3250c8,null));};exports[_0x0ed7('0x1f')]=function(_0x5f2208,_0x4d4f65){return db['Dynamics365Configuration'][_0x0ed7('0x3f')]({'where':{'id':_0x5f2208[_0x0ed7('0x3a')]['id']}})[_0x0ed7('0x1e')](handleEntityNotFound(_0x4d4f65,null))[_0x0ed7('0x1e')](removeEntity(_0x4d4f65,null))['catch'](handleError(_0x4d4f65,null));};exports[_0x0ed7('0x42')]=function(_0x1698f9,_0x30624d,_0x26721d){var _0x454ceb={};var _0x2e1fa7={};var _0x960d9c;var _0x3c44d5;return db[_0x0ed7('0x24')][_0x0ed7('0x43')]({'where':{'id':_0x1698f9[_0x0ed7('0x3a')]['id']}})[_0x0ed7('0x1e')](handleEntityNotFound(_0x30624d,null))[_0x0ed7('0x1e')](function(_0x2ede3d){if(_0x2ede3d){_0x960d9c=_0x2ede3d;_0x2e1fa7[_0x0ed7('0x28')]=_[_0x0ed7('0x3b')](db[_0x0ed7('0x44')][_0x0ed7('0x3c')]);_0x2e1fa7[_0x0ed7('0x29')]=_[_0x0ed7('0x3b')](_0x1698f9[_0x0ed7('0x29')]);_0x2e1fa7['filters']=_[_0x0ed7('0x2b')](_0x2e1fa7[_0x0ed7('0x28')],_0x2e1fa7[_0x0ed7('0x29')]);_0x454ceb[_0x0ed7('0x2c')]=_[_0x0ed7('0x2b')](_0x2e1fa7[_0x0ed7('0x28')],qs[_0x0ed7('0x2d')](_0x1698f9['query'][_0x0ed7('0x2d')]));_0x454ceb['attributes']=_0x454ceb[_0x0ed7('0x2c')]['length']?_0x454ceb['attributes']:_0x2e1fa7[_0x0ed7('0x28')];_0x454ceb[_0x0ed7('0x45')]=qs[_0x0ed7('0x31')](_0x1698f9[_0x0ed7('0x29')][_0x0ed7('0x31')]);_0x454ceb['where']=qs[_0x0ed7('0x2a')](_['pick'](_0x1698f9['query'],_0x2e1fa7[_0x0ed7('0x2a')]));if(_0x1698f9[_0x0ed7('0x29')][_0x0ed7('0x34')]){_0x454ceb[_0x0ed7('0x32')]=_[_0x0ed7('0x3d')](_0x454ceb[_0x0ed7('0x32')],{'$or':_[_0x0ed7('0x23')](_0x454ceb['attributes'],function(_0x1c8fa8){var _0x2bc284={};_0x2bc284[_0x1c8fa8]={'$like':'%'+_0x1698f9[_0x0ed7('0x29')]['filter']+'%'};return _0x2bc284;})});}_0x454ceb=_[_0x0ed7('0x3d')]({},_0x454ceb,_0x1698f9['options']);return _0x960d9c[_0x0ed7('0x42')](_0x454ceb);}})[_0x0ed7('0x1e')](function(_0x4b0c4a){if(_0x4b0c4a){_0x3c44d5=_0x4b0c4a['length'];if(!_0x1698f9[_0x0ed7('0x29')][_0x0ed7('0x46')]('nolimit')){_0x454ceb['limit']=qs[_0x0ed7('0x30')](_0x1698f9[_0x0ed7('0x29')][_0x0ed7('0x30')]);_0x454ceb[_0x0ed7('0x17')]=qs['offset'](_0x1698f9[_0x0ed7('0x29')]['offset']);}return _0x960d9c['getFields'](_0x454ceb);}})[_0x0ed7('0x1e')](function(_0x1b505f){if(_0x1b505f){return _0x1b505f?{'count':_0x3c44d5,'rows':_0x1b505f}:null;}})['then'](respondWithResult(_0x30624d,null))[_0x0ed7('0x38')](handleError(_0x30624d,null));};exports['getSubjects']=function(_0x1f20b9,_0x216929,_0x30b9be){var _0x2c5028={};var _0x53da95={};var _0x43dd75;var _0x235dfc;return db[_0x0ed7('0x24')][_0x0ed7('0x43')]({'where':{'id':_0x1f20b9[_0x0ed7('0x3a')]['id']}})['then'](handleEntityNotFound(_0x216929,null))[_0x0ed7('0x1e')](function(_0x39d8af){if(_0x39d8af){_0x43dd75=_0x39d8af;_0x53da95[_0x0ed7('0x28')]=_[_0x0ed7('0x3b')](db[_0x0ed7('0x44')][_0x0ed7('0x3c')]);_0x53da95[_0x0ed7('0x29')]=_[_0x0ed7('0x3b')](_0x1f20b9[_0x0ed7('0x29')]);_0x53da95[_0x0ed7('0x2a')]=_['intersection'](_0x53da95[_0x0ed7('0x28')],_0x53da95[_0x0ed7('0x29')]);_0x2c5028[_0x0ed7('0x2c')]=_['intersection'](_0x53da95['model'],qs['fields'](_0x1f20b9[_0x0ed7('0x29')][_0x0ed7('0x2d')]));_0x2c5028[_0x0ed7('0x2c')]=_0x2c5028[_0x0ed7('0x2c')][_0x0ed7('0x2e')]?_0x2c5028[_0x0ed7('0x2c')]:_0x53da95[_0x0ed7('0x28')];_0x2c5028['order']=qs[_0x0ed7('0x31')](_0x1f20b9[_0x0ed7('0x29')][_0x0ed7('0x31')]);_0x2c5028[_0x0ed7('0x32')]=qs[_0x0ed7('0x2a')](_[_0x0ed7('0x33')](_0x1f20b9[_0x0ed7('0x29')],_0x53da95[_0x0ed7('0x2a')]));if(_0x1f20b9['query'][_0x0ed7('0x34')]){_0x2c5028[_0x0ed7('0x32')]=_[_0x0ed7('0x3d')](_0x2c5028[_0x0ed7('0x32')],{'$or':_['map'](_0x2c5028['attributes'],function(_0x2a941e){var _0x399737={};_0x399737[_0x2a941e]={'$like':'%'+_0x1f20b9[_0x0ed7('0x29')][_0x0ed7('0x34')]+'%'};return _0x399737;})});}_0x2c5028=_[_0x0ed7('0x3d')]({},_0x2c5028,_0x1f20b9[_0x0ed7('0x3e')]);return _0x43dd75[_0x0ed7('0x47')](_0x2c5028);}})[_0x0ed7('0x1e')](function(_0x566baf){if(_0x566baf){_0x235dfc=_0x566baf[_0x0ed7('0x2e')];if(!_0x1f20b9[_0x0ed7('0x29')][_0x0ed7('0x46')](_0x0ed7('0x2f'))){_0x2c5028[_0x0ed7('0x30')]=qs[_0x0ed7('0x30')](_0x1f20b9['query'][_0x0ed7('0x30')]);_0x2c5028[_0x0ed7('0x17')]=qs[_0x0ed7('0x17')](_0x1f20b9[_0x0ed7('0x29')][_0x0ed7('0x17')]);}return _0x43dd75[_0x0ed7('0x47')](_0x2c5028);}})[_0x0ed7('0x1e')](function(_0x2cbb55){if(_0x2cbb55){return _0x2cbb55?{'count':_0x235dfc,'rows':_0x2cbb55}:null;}})[_0x0ed7('0x1e')](respondWithResult(_0x216929,null))[_0x0ed7('0x38')](handleError(_0x216929,null));};exports[_0x0ed7('0x48')]=function(_0x415513,_0x525665,_0x1f9181){var _0x4699a2={};var _0x202ad5={};var _0xe747f8;var _0x69a086;return db['Dynamics365Configuration'][_0x0ed7('0x43')]({'where':{'id':_0x415513[_0x0ed7('0x3a')]['id']}})[_0x0ed7('0x1e')](handleEntityNotFound(_0x525665,null))[_0x0ed7('0x1e')](function(_0x4992e0){if(_0x4992e0){_0xe747f8=_0x4992e0;_0x202ad5['model']=_[_0x0ed7('0x3b')](db['Dynamics365Field'][_0x0ed7('0x3c')]);_0x202ad5[_0x0ed7('0x29')]=_[_0x0ed7('0x3b')](_0x415513[_0x0ed7('0x29')]);_0x202ad5['filters']=_['intersection'](_0x202ad5[_0x0ed7('0x28')],_0x202ad5[_0x0ed7('0x29')]);_0x4699a2[_0x0ed7('0x2c')]=_[_0x0ed7('0x2b')](_0x202ad5[_0x0ed7('0x28')],qs[_0x0ed7('0x2d')](_0x415513[_0x0ed7('0x29')][_0x0ed7('0x2d')]));_0x4699a2['attributes']=_0x4699a2[_0x0ed7('0x2c')][_0x0ed7('0x2e')]?_0x4699a2[_0x0ed7('0x2c')]:_0x202ad5['model'];_0x4699a2[_0x0ed7('0x45')]=qs[_0x0ed7('0x31')](_0x415513['query'][_0x0ed7('0x31')]);_0x4699a2[_0x0ed7('0x32')]=qs[_0x0ed7('0x2a')](_[_0x0ed7('0x33')](_0x415513[_0x0ed7('0x29')],_0x202ad5[_0x0ed7('0x2a')]));if(_0x415513[_0x0ed7('0x29')][_0x0ed7('0x34')]){_0x4699a2[_0x0ed7('0x32')]=_['merge'](_0x4699a2['where'],{'$or':_[_0x0ed7('0x23')](_0x4699a2[_0x0ed7('0x2c')],function(_0x2e6892){var _0x38dc29={};_0x38dc29[_0x2e6892]={'$like':'%'+_0x415513['query'][_0x0ed7('0x34')]+'%'};return _0x38dc29;})});}_0x4699a2=_['merge']({},_0x4699a2,_0x415513['options']);return _0xe747f8[_0x0ed7('0x48')](_0x4699a2);}})[_0x0ed7('0x1e')](function(_0x42c311){if(_0x42c311){_0x69a086=_0x42c311['length'];if(!_0x415513[_0x0ed7('0x29')]['hasOwnProperty'](_0x0ed7('0x2f'))){_0x4699a2[_0x0ed7('0x30')]=qs[_0x0ed7('0x30')](_0x415513[_0x0ed7('0x29')][_0x0ed7('0x30')]);_0x4699a2[_0x0ed7('0x17')]=qs[_0x0ed7('0x17')](_0x415513[_0x0ed7('0x29')][_0x0ed7('0x17')]);}return _0xe747f8[_0x0ed7('0x48')](_0x4699a2);}})['then'](function(_0x139559){if(_0x139559){return _0x139559?{'count':_0x69a086,'rows':_0x139559}:null;}})[_0x0ed7('0x1e')](respondWithResult(_0x525665,null))['catch'](handleError(_0x525665,null));}; \ No newline at end of file +var _0x9770=['model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','map','Dynamics365Configuration','rawAttributes','type'];(function(_0x27a42a,_0x357b68){var _0x3d1cf3=function(_0x3f045c){while(--_0x3f045c){_0x27a42a['push'](_0x27a42a['shift']());}};_0x3d1cf3(++_0x357b68);}(_0x9770,0xc1));var _0x0977=function(_0xa6ee09,_0xb83143){_0xa6ee09=_0xa6ee09-0x0;var _0x2f810f=_0x9770[_0xa6ee09];return _0x2f810f;};'use strict';var emlformat=require(_0x0977('0x0'));var rimraf=require(_0x0977('0x1'));var zipdir=require(_0x0977('0x2'));var jsonpatch=require(_0x0977('0x3'));var rp=require(_0x0977('0x4'));var moment=require(_0x0977('0x5'));var BPromise=require(_0x0977('0x6'));var Mustache=require('mustache');var util=require(_0x0977('0x7'));var path=require('path');var sox=require(_0x0977('0x8'));var csv=require('to-csv');var ejs=require(_0x0977('0x9'));var fs=require('fs');var fs_extra=require(_0x0977('0xa'));var _=require(_0x0977('0xb'));var squel=require(_0x0977('0xc'));var crypto=require(_0x0977('0xd'));var jsforce=require(_0x0977('0xe'));var deskjs=require(_0x0977('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0977('0x10'));var Papa=require(_0x0977('0x11'));var Redis=require('ioredis');var authService=require(_0x0977('0x12'));var qs=require(_0x0977('0x13'));var as=require(_0x0977('0x14'));var hardwareService=require(_0x0977('0x15'));var logger=require(_0x0977('0x16'))(_0x0977('0x17'));var utils=require('../../config/utils');var config=require(_0x0977('0x18'));var licenseUtil=require(_0x0977('0x19'));var db=require(_0x0977('0x1a'))['db'];function respondWithStatusCode(_0x501f0f,_0x1ee346){_0x1ee346=_0x1ee346||0xcc;return function(_0x35ec6a){if(_0x35ec6a){return _0x501f0f[_0x0977('0x1b')](_0x1ee346);}return _0x501f0f[_0x0977('0x1c')](_0x1ee346)[_0x0977('0x1d')]();};}function respondWithResult(_0x15dffb,_0x1edb08){_0x1edb08=_0x1edb08||0xc8;return function(_0x5dec43){if(_0x5dec43){return _0x15dffb['status'](_0x1edb08)['json'](_0x5dec43);}};}function respondWithFilteredResult(_0x2d2dca,_0xc9d28a){return function(_0x4b110b){if(_0x4b110b){var _0x511dd4=typeof _0xc9d28a[_0x0977('0x1e')]===_0x0977('0x1f')&&typeof _0xc9d28a['limit']===_0x0977('0x1f');var _0x26ea1b=_0x4b110b[_0x0977('0x20')];var _0x557a8a=_0x511dd4?0x0:_0xc9d28a['offset'];var _0x473e1f=_0x511dd4?_0x4b110b[_0x0977('0x20')]:_0xc9d28a[_0x0977('0x1e')]+_0xc9d28a['limit'];var _0x40b1c3;if(_0x473e1f>=_0x26ea1b){_0x473e1f=_0x26ea1b;_0x40b1c3=0xc8;}else{_0x40b1c3=0xce;}_0x2d2dca[_0x0977('0x1c')](_0x40b1c3);return _0x2d2dca['set'](_0x0977('0x21'),_0x557a8a+'-'+_0x473e1f+'/'+_0x26ea1b)[_0x0977('0x22')](_0x4b110b);}return null;};}function patchUpdates(_0x1510fc){return function(_0x4e167b){try{jsonpatch['apply'](_0x4e167b,_0x1510fc,!![]);}catch(_0x5123f0){return BPromise[_0x0977('0x23')](_0x5123f0);}return _0x4e167b[_0x0977('0x24')]();};}function saveUpdates(_0xf6df59,_0x3deb00){return function(_0x3a050f){if(_0x3a050f){return _0x3a050f[_0x0977('0x25')](_0xf6df59)[_0x0977('0x26')](function(_0x49dbae){return _0x49dbae;});}return null;};}function removeEntity(_0x22048b,_0x347980){return function(_0x126dfc){if(_0x126dfc){return _0x126dfc[_0x0977('0x27')]()[_0x0977('0x26')](function(){_0x22048b[_0x0977('0x1c')](0xcc)[_0x0977('0x1d')]();});}};}function handleEntityNotFound(_0xb20384,_0x102f72){return function(_0x391542){if(!_0x391542){_0xb20384[_0x0977('0x1b')](0x194);}return _0x391542;};}function handleError(_0x4b4750,_0x477cc6){_0x477cc6=_0x477cc6||0x1f4;return function(_0x4fe0f7){logger[_0x0977('0x28')](_0x4fe0f7[_0x0977('0x29')]);if(_0x4fe0f7[_0x0977('0x2a')]){delete _0x4fe0f7[_0x0977('0x2a')];}_0x4b4750['status'](_0x477cc6)['send'](_0x4fe0f7);};}exports['index']=function(_0x3a5a17,_0x17ef1f){var _0x5470e1={},_0xa046aa={},_0x5039bd={'count':0x0,'rows':[]};var _0x855758=_[_0x0977('0x2b')](db[_0x0977('0x2c')][_0x0977('0x2d')],function(_0x177c69){return{'name':_0x177c69['fieldName'],'type':_0x177c69[_0x0977('0x2e')]['key']};});_0xa046aa[_0x0977('0x2f')]=_[_0x0977('0x2b')](_0x855758,_0x0977('0x2a'));_0xa046aa[_0x0977('0x30')]=_['keys'](_0x3a5a17[_0x0977('0x30')]);_0xa046aa[_0x0977('0x31')]=_['intersection'](_0xa046aa[_0x0977('0x2f')],_0xa046aa[_0x0977('0x30')]);_0x5470e1['attributes']=_[_0x0977('0x32')](_0xa046aa[_0x0977('0x2f')],qs[_0x0977('0x33')](_0x3a5a17['query'][_0x0977('0x33')]));_0x5470e1[_0x0977('0x34')]=_0x5470e1[_0x0977('0x34')]['length']?_0x5470e1[_0x0977('0x34')]:_0xa046aa[_0x0977('0x2f')];if(!_0x3a5a17['query'][_0x0977('0x35')]('nolimit')){_0x5470e1[_0x0977('0x36')]=qs[_0x0977('0x36')](_0x3a5a17[_0x0977('0x30')][_0x0977('0x36')]);_0x5470e1[_0x0977('0x1e')]=qs['offset'](_0x3a5a17['query'][_0x0977('0x1e')]);}_0x5470e1[_0x0977('0x37')]=qs[_0x0977('0x38')](_0x3a5a17['query'][_0x0977('0x38')]);_0x5470e1[_0x0977('0x39')]=qs[_0x0977('0x31')](_[_0x0977('0x3a')](_0x3a5a17['query'],_0xa046aa[_0x0977('0x31')]),_0x855758);if(_0x3a5a17[_0x0977('0x30')][_0x0977('0x3b')]){_0x5470e1['where']=_[_0x0977('0x3c')](_0x5470e1[_0x0977('0x39')],{'$or':_[_0x0977('0x2b')](_0x855758,function(_0x8abff9){if(_0x8abff9[_0x0977('0x2e')]!=='VIRTUAL'){var _0x9d7350={};_0x9d7350[_0x8abff9[_0x0977('0x2a')]]={'$like':'%'+_0x3a5a17[_0x0977('0x30')][_0x0977('0x3b')]+'%'};return _0x9d7350;}})});}_0x5470e1=_[_0x0977('0x3c')]({},_0x5470e1,_0x3a5a17[_0x0977('0x3d')]);var _0x205b89={'where':_0x5470e1[_0x0977('0x39')]};return db['Dynamics365Configuration'][_0x0977('0x20')](_0x205b89)['then'](function(_0x2293aa){_0x5039bd[_0x0977('0x20')]=_0x2293aa;if(_0x3a5a17[_0x0977('0x30')]['includeAll']){_0x5470e1[_0x0977('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x0977('0x3f')](_0x5470e1);})['then'](function(_0x41cbfa){_0x5039bd[_0x0977('0x40')]=_0x41cbfa;return _0x5039bd;})[_0x0977('0x26')](respondWithFilteredResult(_0x17ef1f,_0x5470e1))[_0x0977('0x41')](handleError(_0x17ef1f,null));};exports[_0x0977('0x42')]=function(_0x5251a9,_0x10ba20){var _0x56417c={'raw':![],'where':{'id':_0x5251a9[_0x0977('0x43')]['id']}},_0x28cc53={};_0x28cc53[_0x0977('0x2f')]=_[_0x0977('0x44')](db[_0x0977('0x2c')][_0x0977('0x2d')]);_0x28cc53[_0x0977('0x30')]=_['keys'](_0x5251a9['query']);_0x28cc53['filters']=_[_0x0977('0x32')](_0x28cc53[_0x0977('0x2f')],_0x28cc53[_0x0977('0x30')]);_0x56417c[_0x0977('0x34')]=_[_0x0977('0x32')](_0x28cc53[_0x0977('0x2f')],qs[_0x0977('0x33')](_0x5251a9[_0x0977('0x30')][_0x0977('0x33')]));_0x56417c[_0x0977('0x34')]=_0x56417c[_0x0977('0x34')][_0x0977('0x45')]?_0x56417c['attributes']:_0x28cc53['model'];if(_0x5251a9[_0x0977('0x30')][_0x0977('0x46')]){_0x56417c[_0x0977('0x3e')]=[{'all':!![]}];}_0x56417c=_[_0x0977('0x3c')]({},_0x56417c,_0x5251a9['options']);return db['Dynamics365Configuration'][_0x0977('0x47')](_0x56417c)[_0x0977('0x26')](handleEntityNotFound(_0x10ba20,null))['then'](respondWithResult(_0x10ba20,null))['catch'](handleError(_0x10ba20,null));};exports[_0x0977('0x48')]=function(_0x2c7f2f,_0x5f1628){return db[_0x0977('0x2c')]['create'](_0x2c7f2f[_0x0977('0x49')],{})[_0x0977('0x26')](respondWithResult(_0x5f1628,0xc9))[_0x0977('0x41')](handleError(_0x5f1628,null));};exports[_0x0977('0x25')]=function(_0x258410,_0x403672){if(_0x258410[_0x0977('0x49')]['id']){delete _0x258410[_0x0977('0x49')]['id'];}return db[_0x0977('0x2c')][_0x0977('0x47')]({'where':{'id':_0x258410['params']['id']}})[_0x0977('0x26')](handleEntityNotFound(_0x403672,null))['then'](saveUpdates(_0x258410['body'],null))[_0x0977('0x26')](respondWithResult(_0x403672,null))[_0x0977('0x41')](handleError(_0x403672,null));};exports[_0x0977('0x27')]=function(_0x1edb40,_0x3b8502){return db['Dynamics365Configuration']['find']({'where':{'id':_0x1edb40[_0x0977('0x43')]['id']}})[_0x0977('0x26')](handleEntityNotFound(_0x3b8502,null))['then'](removeEntity(_0x3b8502,null))[_0x0977('0x41')](handleError(_0x3b8502,null));};exports[_0x0977('0x4a')]=function(_0x2fe6dd,_0x1da967,_0x139174){var _0x2a3ec3={};var _0x41595c={};var _0x5333f9;var _0x8aa65d;return db[_0x0977('0x2c')][_0x0977('0x4b')]({'where':{'id':_0x2fe6dd['params']['id']}})[_0x0977('0x26')](handleEntityNotFound(_0x1da967,null))['then'](function(_0x4a7eae){if(_0x4a7eae){_0x5333f9=_0x4a7eae;_0x41595c[_0x0977('0x2f')]=_[_0x0977('0x44')](db[_0x0977('0x4c')][_0x0977('0x2d')]);_0x41595c[_0x0977('0x30')]=_[_0x0977('0x44')](_0x2fe6dd[_0x0977('0x30')]);_0x41595c['filters']=_[_0x0977('0x32')](_0x41595c['model'],_0x41595c[_0x0977('0x30')]);_0x2a3ec3[_0x0977('0x34')]=_[_0x0977('0x32')](_0x41595c[_0x0977('0x2f')],qs[_0x0977('0x33')](_0x2fe6dd[_0x0977('0x30')]['fields']));_0x2a3ec3[_0x0977('0x34')]=_0x2a3ec3['attributes']['length']?_0x2a3ec3[_0x0977('0x34')]:_0x41595c[_0x0977('0x2f')];_0x2a3ec3[_0x0977('0x37')]=qs['sort'](_0x2fe6dd[_0x0977('0x30')][_0x0977('0x38')]);_0x2a3ec3[_0x0977('0x39')]=qs['filters'](_[_0x0977('0x3a')](_0x2fe6dd['query'],_0x41595c[_0x0977('0x31')]));if(_0x2fe6dd[_0x0977('0x30')][_0x0977('0x3b')]){_0x2a3ec3[_0x0977('0x39')]=_[_0x0977('0x3c')](_0x2a3ec3[_0x0977('0x39')],{'$or':_[_0x0977('0x2b')](_0x2a3ec3['attributes'],function(_0x2f963e){var _0x4dde44={};_0x4dde44[_0x2f963e]={'$like':'%'+_0x2fe6dd[_0x0977('0x30')][_0x0977('0x3b')]+'%'};return _0x4dde44;})});}_0x2a3ec3=_['merge']({},_0x2a3ec3,_0x2fe6dd[_0x0977('0x3d')]);return _0x5333f9[_0x0977('0x4a')](_0x2a3ec3);}})[_0x0977('0x26')](function(_0xefbd9e){if(_0xefbd9e){_0x8aa65d=_0xefbd9e[_0x0977('0x45')];if(!_0x2fe6dd[_0x0977('0x30')][_0x0977('0x35')]('nolimit')){_0x2a3ec3[_0x0977('0x36')]=qs[_0x0977('0x36')](_0x2fe6dd[_0x0977('0x30')]['limit']);_0x2a3ec3[_0x0977('0x1e')]=qs[_0x0977('0x1e')](_0x2fe6dd[_0x0977('0x30')][_0x0977('0x1e')]);}return _0x5333f9['getFields'](_0x2a3ec3);}})[_0x0977('0x26')](function(_0x4f2ad2){if(_0x4f2ad2){return _0x4f2ad2?{'count':_0x8aa65d,'rows':_0x4f2ad2}:null;}})[_0x0977('0x26')](respondWithResult(_0x1da967,null))[_0x0977('0x41')](handleError(_0x1da967,null));};exports[_0x0977('0x4d')]=function(_0x33d247,_0x1b8987,_0x31713e){var _0x16f309={};var _0x26f544={};var _0x2b0f59;var _0x5a5241;return db[_0x0977('0x2c')][_0x0977('0x4b')]({'where':{'id':_0x33d247[_0x0977('0x43')]['id']}})[_0x0977('0x26')](handleEntityNotFound(_0x1b8987,null))[_0x0977('0x26')](function(_0x5b61a8){if(_0x5b61a8){_0x2b0f59=_0x5b61a8;_0x26f544[_0x0977('0x2f')]=_['keys'](db['Dynamics365Field'][_0x0977('0x2d')]);_0x26f544[_0x0977('0x30')]=_[_0x0977('0x44')](_0x33d247[_0x0977('0x30')]);_0x26f544[_0x0977('0x31')]=_[_0x0977('0x32')](_0x26f544[_0x0977('0x2f')],_0x26f544[_0x0977('0x30')]);_0x16f309[_0x0977('0x34')]=_[_0x0977('0x32')](_0x26f544['model'],qs[_0x0977('0x33')](_0x33d247[_0x0977('0x30')]['fields']));_0x16f309[_0x0977('0x34')]=_0x16f309[_0x0977('0x34')][_0x0977('0x45')]?_0x16f309[_0x0977('0x34')]:_0x26f544['model'];_0x16f309['order']=qs[_0x0977('0x38')](_0x33d247['query'][_0x0977('0x38')]);_0x16f309[_0x0977('0x39')]=qs[_0x0977('0x31')](_[_0x0977('0x3a')](_0x33d247[_0x0977('0x30')],_0x26f544['filters']));if(_0x33d247[_0x0977('0x30')]['filter']){_0x16f309[_0x0977('0x39')]=_[_0x0977('0x3c')](_0x16f309[_0x0977('0x39')],{'$or':_[_0x0977('0x2b')](_0x16f309[_0x0977('0x34')],function(_0x31e152){var _0x1df200={};_0x1df200[_0x31e152]={'$like':'%'+_0x33d247[_0x0977('0x30')][_0x0977('0x3b')]+'%'};return _0x1df200;})});}_0x16f309=_[_0x0977('0x3c')]({},_0x16f309,_0x33d247[_0x0977('0x3d')]);return _0x2b0f59[_0x0977('0x4d')](_0x16f309);}})[_0x0977('0x26')](function(_0x338101){if(_0x338101){_0x5a5241=_0x338101[_0x0977('0x45')];if(!_0x33d247[_0x0977('0x30')][_0x0977('0x35')](_0x0977('0x4e'))){_0x16f309[_0x0977('0x36')]=qs[_0x0977('0x36')](_0x33d247[_0x0977('0x30')][_0x0977('0x36')]);_0x16f309['offset']=qs[_0x0977('0x1e')](_0x33d247['query'][_0x0977('0x1e')]);}return _0x2b0f59[_0x0977('0x4d')](_0x16f309);}})['then'](function(_0x598f6a){if(_0x598f6a){return _0x598f6a?{'count':_0x5a5241,'rows':_0x598f6a}:null;}})[_0x0977('0x26')](respondWithResult(_0x1b8987,null))[_0x0977('0x41')](handleError(_0x1b8987,null));};exports[_0x0977('0x4f')]=function(_0x2c6e4c,_0x48566e,_0x3ed610){var _0x1c080e={};var _0x48d5f5={};var _0x69cb90;var _0x5c960b;return db[_0x0977('0x2c')][_0x0977('0x4b')]({'where':{'id':_0x2c6e4c[_0x0977('0x43')]['id']}})[_0x0977('0x26')](handleEntityNotFound(_0x48566e,null))[_0x0977('0x26')](function(_0x833f14){if(_0x833f14){_0x69cb90=_0x833f14;_0x48d5f5['model']=_[_0x0977('0x44')](db['Dynamics365Field'][_0x0977('0x2d')]);_0x48d5f5['query']=_[_0x0977('0x44')](_0x2c6e4c[_0x0977('0x30')]);_0x48d5f5[_0x0977('0x31')]=_['intersection'](_0x48d5f5[_0x0977('0x2f')],_0x48d5f5[_0x0977('0x30')]);_0x1c080e[_0x0977('0x34')]=_[_0x0977('0x32')](_0x48d5f5['model'],qs[_0x0977('0x33')](_0x2c6e4c[_0x0977('0x30')][_0x0977('0x33')]));_0x1c080e[_0x0977('0x34')]=_0x1c080e[_0x0977('0x34')][_0x0977('0x45')]?_0x1c080e[_0x0977('0x34')]:_0x48d5f5[_0x0977('0x2f')];_0x1c080e[_0x0977('0x37')]=qs['sort'](_0x2c6e4c[_0x0977('0x30')][_0x0977('0x38')]);_0x1c080e['where']=qs[_0x0977('0x31')](_[_0x0977('0x3a')](_0x2c6e4c[_0x0977('0x30')],_0x48d5f5[_0x0977('0x31')]));if(_0x2c6e4c[_0x0977('0x30')][_0x0977('0x3b')]){_0x1c080e[_0x0977('0x39')]=_[_0x0977('0x3c')](_0x1c080e[_0x0977('0x39')],{'$or':_[_0x0977('0x2b')](_0x1c080e[_0x0977('0x34')],function(_0x511371){var _0x280377={};_0x280377[_0x511371]={'$like':'%'+_0x2c6e4c[_0x0977('0x30')][_0x0977('0x3b')]+'%'};return _0x280377;})});}_0x1c080e=_[_0x0977('0x3c')]({},_0x1c080e,_0x2c6e4c[_0x0977('0x3d')]);return _0x69cb90[_0x0977('0x4f')](_0x1c080e);}})[_0x0977('0x26')](function(_0x1c7f75){if(_0x1c7f75){_0x5c960b=_0x1c7f75[_0x0977('0x45')];if(!_0x2c6e4c[_0x0977('0x30')][_0x0977('0x35')](_0x0977('0x4e'))){_0x1c080e[_0x0977('0x36')]=qs[_0x0977('0x36')](_0x2c6e4c['query']['limit']);_0x1c080e['offset']=qs[_0x0977('0x1e')](_0x2c6e4c['query']['offset']);}return _0x69cb90[_0x0977('0x4f')](_0x1c080e);}})['then'](function(_0x50c03c){if(_0x50c03c){return _0x50c03c?{'count':_0x5c960b,'rows':_0x50c03c}:null;}})[_0x0977('0x26')](respondWithResult(_0x48566e,null))['catch'](handleError(_0x48566e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f4460c3..db24940 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 _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x43e34c,_0x2ff75e){var _0x41d6e1=function(_0x4afa5d){while(--_0x4afa5d){_0x43e34c['push'](_0x43e34c['shift']());}};_0x41d6e1(++_0x2ff75e);}(_0x34e8,0x12c));var _0x834e=function(_0x1e6322,_0x1d4066){_0x1e6322=_0x1e6322-0x0;var _0x3610a1=_0x34e8[_0x1e6322];return _0x3610a1;};'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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x3a8695,_0x311d43){var _0x184da3=function(_0xb39902){while(--_0xb39902){_0x3a8695['push'](_0x3a8695['shift']());}};_0x184da3(++_0x311d43);}(_0xf109,0xce));var _0x9f10=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xf109[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 213a118..acdadd2 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 _0xd0cb=['stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x4cc807,_0x30b1a5){var _0x38a2bb=function(_0x46cf48){while(--_0x46cf48){_0x4cc807['push'](_0x4cc807['shift']());}};_0x38a2bb(++_0x30b1a5);}(_0xd0cb,0xb0));var _0xbd0c=function(_0x4b1062,_0x4c383c){_0x4b1062=_0x4b1062-0x0;var _0x497e91=_0xd0cb[_0x4b1062];return _0x497e91;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbd0c('0x0'));var rs=require(_0xbd0c('0x1'));var fs=require('fs');var Redis=require(_0xbd0c('0x2'));var db=require(_0xbd0c('0x3'))['db'];var utils=require(_0xbd0c('0x4'));var logger=require(_0xbd0c('0x5'))(_0xbd0c('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0c('0x7'));var client=jayson['client'][_0xbd0c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c7fd6,_0x4076b6,_0x1731de){return new BPromise(function(_0x4159a6,_0x4c80c4){return client['request'](_0x1c7fd6,_0x1731de)[_0xbd0c('0x9')](function(_0x3f3192){logger[_0xbd0c('0xa')](_0xbd0c('0xb'),_0x4076b6,_0xbd0c('0xc'));logger['debug'](_0xbd0c('0xd'),_0x4076b6,_0xbd0c('0xc'),JSON[_0xbd0c('0xe')](_0x3f3192));if(_0x3f3192['error']){if(_0x3f3192[_0xbd0c('0xf')]['code']===0x1f4){logger[_0xbd0c('0xf')](_0xbd0c('0xb'),_0x4076b6,_0x3f3192['error'][_0xbd0c('0x10')]);return _0x4c80c4(_0x3f3192[_0xbd0c('0xf')]['message']);}logger['error'](_0xbd0c('0xb'),_0x4076b6,_0x3f3192[_0xbd0c('0xf')][_0xbd0c('0x10')]);return _0x4159a6(_0x3f3192[_0xbd0c('0xf')][_0xbd0c('0x10')]);}else{logger[_0xbd0c('0xa')](_0xbd0c('0xb'),_0x4076b6,_0xbd0c('0xc'));_0x4159a6(_0x3f3192[_0xbd0c('0x11')][_0xbd0c('0x10')]);}})[_0xbd0c('0x12')](function(_0x5827cb){logger[_0xbd0c('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4076b6,_0x5827cb);_0x4c80c4(_0x5827cb);});});} \ No newline at end of file +var _0xeb6a=['request\x20sent','debug','code','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2655f1,_0x570453){var _0x3080ef=function(_0x4f2a19){while(--_0x4f2a19){_0x2655f1['push'](_0x2655f1['shift']());}};_0x3080ef(++_0x570453);}(_0xeb6a,0x196));var _0xaeb6=function(_0xb9f5dc,_0x360b18){_0xb9f5dc=_0xb9f5dc-0x0;var _0x48c5ba=_0xeb6a[_0xb9f5dc];return _0x48c5ba;};'use strict';var _=require(_0xaeb6('0x0'));var util=require('util');var moment=require(_0xaeb6('0x1'));var BPromise=require(_0xaeb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaeb6('0x3'));var db=require(_0xaeb6('0x4'))['db'];var utils=require(_0xaeb6('0x5'));var logger=require(_0xaeb6('0x6'))(_0xaeb6('0x7'));var config=require(_0xaeb6('0x8'));var jayson=require(_0xaeb6('0x9'));var client=jayson[_0xaeb6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ebafa,_0x295752,_0x4210aa){return new BPromise(function(_0x309280,_0x5e8d48){return client[_0xaeb6('0xb')](_0x2ebafa,_0x4210aa)['then'](function(_0x169789){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x295752,_0xaeb6('0xc'));logger[_0xaeb6('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x295752,_0xaeb6('0xc'),JSON['stringify'](_0x169789));if(_0x169789['error']){if(_0x169789['error'][_0xaeb6('0xe')]===0x1f4){logger[_0xaeb6('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x295752,_0x169789[_0xaeb6('0xf')][_0xaeb6('0x10')]);return _0x5e8d48(_0x169789[_0xaeb6('0xf')][_0xaeb6('0x10')]);}logger[_0xaeb6('0xf')](_0xaeb6('0x11'),_0x295752,_0x169789[_0xaeb6('0xf')][_0xaeb6('0x10')]);return _0x309280(_0x169789[_0xaeb6('0xf')][_0xaeb6('0x10')]);}else{logger['info'](_0xaeb6('0x11'),_0x295752,_0xaeb6('0xc'));_0x309280(_0x169789[_0xaeb6('0x12')][_0xaeb6('0x10')]);}})['catch'](function(_0x15acd8){logger[_0xaeb6('0xf')](_0xaeb6('0x11'),_0x295752,_0x15acd8);_0x5e8d48(_0x15acd8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index cd3e9e3..f223284 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 _0x9eb8=['get','isAuthenticated','index','/:id','post','create','put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x51c50a,_0x80ba65){var _0x23251c=function(_0x2609dd){while(--_0x2609dd){_0x51c50a['push'](_0x51c50a['shift']());}};_0x23251c(++_0x80ba65);}(_0x9eb8,0x107));var _0x89eb=function(_0x8ab862,_0x498efe){_0x8ab862=_0x8ab862-0x0;var _0x34bf17=_0x9eb8[_0x8ab862];return _0x34bf17;};'use strict';var multer=require(_0x89eb('0x0'));var util=require(_0x89eb('0x1'));var path=require('path');var timeout=require(_0x89eb('0x2'));var express=require(_0x89eb('0x3'));var router=express[_0x89eb('0x4')]();var fs_extra=require(_0x89eb('0x5'));var auth=require(_0x89eb('0x6'));var interaction=require(_0x89eb('0x7'));var config=require(_0x89eb('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x89eb('0x9')]('/',auth[_0x89eb('0xa')](),controller[_0x89eb('0xb')]);router[_0x89eb('0x9')](_0x89eb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x89eb('0xd')]('/',auth[_0x89eb('0xa')](),controller[_0x89eb('0xe')]);router[_0x89eb('0xf')](_0x89eb('0xc'),auth[_0x89eb('0xa')](),controller['update']);router['delete'](_0x89eb('0xc'),auth[_0x89eb('0xa')](),controller[_0x89eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x40fa=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','multer','connect-timeout'];(function(_0x116215,_0x23a2a6){var _0x1885a2=function(_0x439365){while(--_0x439365){_0x116215['push'](_0x116215['shift']());}};_0x1885a2(++_0x23a2a6);}(_0x40fa,0xc4));var _0xa40f=function(_0x45c2c4,_0x504135){_0x45c2c4=_0x45c2c4-0x0;var _0x18f847=_0x40fa[_0x45c2c4];return _0x18f847;};'use strict';var multer=require(_0xa40f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa40f('0x1'));var express=require(_0xa40f('0x2'));var router=express[_0xa40f('0x3')]();var fs_extra=require(_0xa40f('0x4'));var auth=require(_0xa40f('0x5'));var interaction=require(_0xa40f('0x6'));var config=require(_0xa40f('0x7'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xa40f('0x8')](),controller[_0xa40f('0x9')]);router[_0xa40f('0xa')](_0xa40f('0xb'),auth[_0xa40f('0x8')](),controller[_0xa40f('0xc')]);router[_0xa40f('0xd')]('/',auth[_0xa40f('0x8')](),controller[_0xa40f('0xe')]);router[_0xa40f('0xf')](_0xa40f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xa40f('0x10')](_0xa40f('0xb'),auth[_0xa40f('0x8')](),controller[_0xa40f('0x11')]);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 0532c3b..adc4047 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 _0xffe0=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffe0,0xbf));var _0x0ffe=function(_0x4652ef,_0x289ccf){_0x4652ef=_0x4652ef-0x0;var _0x5f3813=_0xffe0[_0x4652ef];return _0x5f3813;};'use strict';var Sequelize=require(_0x0ffe('0x0'));module[_0x0ffe('0x1')]={'type':{'type':Sequelize[_0x0ffe('0x2')](_0x0ffe('0x3'),_0x0ffe('0x4'),_0x0ffe('0x5'),_0x0ffe('0x6'),_0x0ffe('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0ffe('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0ffe('0x2')]('string','variable',_0x0ffe('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0ffe('0x8')]},'customField':{'type':Sequelize[_0x0ffe('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb775=['ENUM','string','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x4bcc24,_0x1b79c3){var _0x1928b0=function(_0x5f1c80){while(--_0x5f1c80){_0x4bcc24['push'](_0x4bcc24['shift']());}};_0x1928b0(++_0x1b79c3);}(_0xb775,0x15e));var _0x5b77=function(_0x3a1bac,_0x5c61aa){_0x3a1bac=_0x3a1bac-0x0;var _0x26b48e=_0xb775[_0x3a1bac];return _0x26b48e;};'use strict';var Sequelize=require(_0x5b77('0x0'));module[_0x5b77('0x1')]={'type':{'type':Sequelize[_0x5b77('0x2')](_0x5b77('0x3'),'variable','customVariable',_0x5b77('0x4'),'picklist'),'defaultValue':_0x5b77('0x3')},'content':{'type':Sequelize[_0x5b77('0x5')]},'key':{'type':Sequelize[_0x5b77('0x5')]},'keyType':{'type':Sequelize[_0x5b77('0x2')](_0x5b77('0x3'),_0x5b77('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5b77('0x5')]},'nameField':{'type':Sequelize[_0x5b77('0x5')]},'customField':{'type':Sequelize[_0x5b77('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b77('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 41b38c5..89c5401 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 _0xd290=['apply','reject','save','update','destroy','then','error','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x3df596,_0x19ec11){var _0x36e23=function(_0x966d57){while(--_0x966d57){_0x3df596['push'](_0x3df596['shift']());}};_0x36e23(++_0x19ec11);}(_0xd290,0x1d9));var _0x0d29=function(_0x5f4c9c,_0x1550df){_0x5f4c9c=_0x5f4c9c-0x0;var _0x3de71b=_0xd290[_0x5f4c9c];return _0x3de71b;};'use strict';var emlformat=require(_0x0d29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d29('0x1'));var jsonpatch=require(_0x0d29('0x2'));var rp=require(_0x0d29('0x3'));var moment=require('moment');var BPromise=require(_0x0d29('0x4'));var Mustache=require('mustache');var util=require(_0x0d29('0x5'));var path=require('path');var sox=require(_0x0d29('0x6'));var csv=require('to-csv');var ejs=require(_0x0d29('0x7'));var fs=require('fs');var fs_extra=require(_0x0d29('0x8'));var _=require(_0x0d29('0x9'));var squel=require(_0x0d29('0xa'));var crypto=require(_0x0d29('0xb'));var jsforce=require(_0x0d29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0d29('0xd'));var querystring=require(_0x0d29('0xe'));var Papa=require(_0x0d29('0xf'));var Redis=require(_0x0d29('0x10'));var authService=require(_0x0d29('0x11'));var qs=require(_0x0d29('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d29('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0d29('0x14'));var db=require(_0x0d29('0x15'))['db'];function respondWithStatusCode(_0x31cf95,_0x4bb52a){_0x4bb52a=_0x4bb52a||0xcc;return function(_0x311c71){if(_0x311c71){return _0x31cf95[_0x0d29('0x16')](_0x4bb52a);}return _0x31cf95[_0x0d29('0x17')](_0x4bb52a)[_0x0d29('0x18')]();};}function respondWithResult(_0x18e724,_0x3c9056){_0x3c9056=_0x3c9056||0xc8;return function(_0x39cd6c){if(_0x39cd6c){return _0x18e724[_0x0d29('0x17')](_0x3c9056)[_0x0d29('0x19')](_0x39cd6c);}};}function respondWithFilteredResult(_0x563f0f,_0x21115e){return function(_0x23e210){if(_0x23e210){var _0x17c0db=typeof _0x21115e[_0x0d29('0x1a')]===_0x0d29('0x1b')&&typeof _0x21115e[_0x0d29('0x1c')]===_0x0d29('0x1b');var _0x55b44a=_0x23e210['count'];var _0x12e6bc=_0x17c0db?0x0:_0x21115e['offset'];var _0x916116=_0x17c0db?_0x23e210[_0x0d29('0x1d')]:_0x21115e[_0x0d29('0x1a')]+_0x21115e['limit'];var _0x24eb65;if(_0x916116>=_0x55b44a){_0x916116=_0x55b44a;_0x24eb65=0xc8;}else{_0x24eb65=0xce;}_0x563f0f['status'](_0x24eb65);return _0x563f0f['set'](_0x0d29('0x1e'),_0x12e6bc+'-'+_0x916116+'/'+_0x55b44a)[_0x0d29('0x19')](_0x23e210);}return null;};}function patchUpdates(_0xce33ec){return function(_0x3eb2dc){try{jsonpatch[_0x0d29('0x1f')](_0x3eb2dc,_0xce33ec,!![]);}catch(_0x25eee2){return BPromise[_0x0d29('0x20')](_0x25eee2);}return _0x3eb2dc[_0x0d29('0x21')]();};}function saveUpdates(_0x557cf5,_0x43a099){return function(_0x65ca6d){if(_0x65ca6d){return _0x65ca6d[_0x0d29('0x22')](_0x557cf5)['then'](function(_0x16a10e){return _0x16a10e;});}return null;};}function removeEntity(_0x2b16a6,_0x442013){return function(_0x24c61e){if(_0x24c61e){return _0x24c61e[_0x0d29('0x23')]()[_0x0d29('0x24')](function(){_0x2b16a6[_0x0d29('0x17')](0xcc)[_0x0d29('0x18')]();});}};}function handleEntityNotFound(_0x47b92b,_0x4dbc38){return function(_0x5999d4){if(!_0x5999d4){_0x47b92b[_0x0d29('0x16')](0x194);}return _0x5999d4;};}function handleError(_0x566628,_0x193c0f){_0x193c0f=_0x193c0f||0x1f4;return function(_0x54f8af){logger[_0x0d29('0x25')](_0x54f8af['stack']);if(_0x54f8af[_0x0d29('0x26')]){delete _0x54f8af[_0x0d29('0x26')];}_0x566628[_0x0d29('0x17')](_0x193c0f)[_0x0d29('0x27')](_0x54f8af);};}exports[_0x0d29('0x28')]=function(_0x514316,_0x4359cc){var _0x5052b2={},_0x3ae748={},_0x4b4aa2={'count':0x0,'rows':[]};var _0x312389=_['map'](db[_0x0d29('0x29')][_0x0d29('0x2a')],function(_0x48eae5){return{'name':_0x48eae5[_0x0d29('0x2b')],'type':_0x48eae5[_0x0d29('0x2c')][_0x0d29('0x2d')]};});_0x3ae748[_0x0d29('0x2e')]=_[_0x0d29('0x2f')](_0x312389,_0x0d29('0x26'));_0x3ae748[_0x0d29('0x30')]=_[_0x0d29('0x31')](_0x514316['query']);_0x3ae748['filters']=_[_0x0d29('0x32')](_0x3ae748[_0x0d29('0x2e')],_0x3ae748[_0x0d29('0x30')]);_0x5052b2[_0x0d29('0x33')]=_[_0x0d29('0x32')](_0x3ae748[_0x0d29('0x2e')],qs['fields'](_0x514316[_0x0d29('0x30')][_0x0d29('0x34')]));_0x5052b2[_0x0d29('0x33')]=_0x5052b2[_0x0d29('0x33')][_0x0d29('0x35')]?_0x5052b2[_0x0d29('0x33')]:_0x3ae748['model'];if(!_0x514316[_0x0d29('0x30')][_0x0d29('0x36')](_0x0d29('0x37'))){_0x5052b2[_0x0d29('0x1c')]=qs['limit'](_0x514316[_0x0d29('0x30')][_0x0d29('0x1c')]);_0x5052b2[_0x0d29('0x1a')]=qs[_0x0d29('0x1a')](_0x514316[_0x0d29('0x30')][_0x0d29('0x1a')]);}_0x5052b2[_0x0d29('0x38')]=qs['sort'](_0x514316['query']['sort']);_0x5052b2[_0x0d29('0x39')]=qs[_0x0d29('0x3a')](_[_0x0d29('0x3b')](_0x514316[_0x0d29('0x30')],_0x3ae748['filters']),_0x312389);if(_0x514316[_0x0d29('0x30')][_0x0d29('0x3c')]){_0x5052b2['where']=_[_0x0d29('0x3d')](_0x5052b2[_0x0d29('0x39')],{'$or':_['map'](_0x312389,function(_0x40b71b){if(_0x40b71b[_0x0d29('0x2c')]!==_0x0d29('0x3e')){var _0x22b2bf={};_0x22b2bf[_0x40b71b['name']]={'$like':'%'+_0x514316['query'][_0x0d29('0x3c')]+'%'};return _0x22b2bf;}})});}_0x5052b2=_[_0x0d29('0x3d')]({},_0x5052b2,_0x514316[_0x0d29('0x3f')]);var _0x442bc3={'where':_0x5052b2[_0x0d29('0x39')]};return db[_0x0d29('0x29')][_0x0d29('0x1d')](_0x442bc3)[_0x0d29('0x24')](function(_0x11fae1){_0x4b4aa2[_0x0d29('0x1d')]=_0x11fae1;if(_0x514316[_0x0d29('0x30')][_0x0d29('0x40')]){_0x5052b2[_0x0d29('0x41')]=[{'all':!![]}];}return db[_0x0d29('0x29')]['findAll'](_0x5052b2);})[_0x0d29('0x24')](function(_0x2b9d5f){_0x4b4aa2[_0x0d29('0x42')]=_0x2b9d5f;return _0x4b4aa2;})[_0x0d29('0x24')](respondWithFilteredResult(_0x4359cc,_0x5052b2))[_0x0d29('0x43')](handleError(_0x4359cc,null));};exports[_0x0d29('0x44')]=function(_0x386cf5,_0x27e60f){var _0xc96fcd={'raw':!![],'where':{'id':_0x386cf5[_0x0d29('0x45')]['id']}},_0x3c279c={};_0x3c279c[_0x0d29('0x2e')]=_['keys'](db[_0x0d29('0x29')][_0x0d29('0x2a')]);_0x3c279c[_0x0d29('0x30')]=_['keys'](_0x386cf5[_0x0d29('0x30')]);_0x3c279c['filters']=_['intersection'](_0x3c279c[_0x0d29('0x2e')],_0x3c279c[_0x0d29('0x30')]);_0xc96fcd[_0x0d29('0x33')]=_[_0x0d29('0x32')](_0x3c279c[_0x0d29('0x2e')],qs[_0x0d29('0x34')](_0x386cf5[_0x0d29('0x30')][_0x0d29('0x34')]));_0xc96fcd['attributes']=_0xc96fcd[_0x0d29('0x33')][_0x0d29('0x35')]?_0xc96fcd[_0x0d29('0x33')]:_0x3c279c[_0x0d29('0x2e')];if(_0x386cf5['query'][_0x0d29('0x40')]){_0xc96fcd['include']=[{'all':!![]}];}_0xc96fcd=_[_0x0d29('0x3d')]({},_0xc96fcd,_0x386cf5[_0x0d29('0x3f')]);return db[_0x0d29('0x29')][_0x0d29('0x46')](_0xc96fcd)[_0x0d29('0x24')](handleEntityNotFound(_0x27e60f,null))[_0x0d29('0x24')](respondWithResult(_0x27e60f,null))[_0x0d29('0x43')](handleError(_0x27e60f,null));};exports['create']=function(_0x23470b,_0x50096c){return db['Dynamics365Field']['create'](_0x23470b['body'],{})[_0x0d29('0x24')](respondWithResult(_0x50096c,0xc9))['catch'](handleError(_0x50096c,null));};exports[_0x0d29('0x22')]=function(_0x1d8642,_0x13e53a){if(_0x1d8642['body']['id']){delete _0x1d8642[_0x0d29('0x47')]['id'];}return db[_0x0d29('0x29')][_0x0d29('0x46')]({'where':{'id':_0x1d8642['params']['id']}})[_0x0d29('0x24')](handleEntityNotFound(_0x13e53a,null))[_0x0d29('0x24')](saveUpdates(_0x1d8642[_0x0d29('0x47')],null))['then'](respondWithResult(_0x13e53a,null))['catch'](handleError(_0x13e53a,null));};exports['destroy']=function(_0xc9536f,_0xb65087){return db[_0x0d29('0x29')][_0x0d29('0x46')]({'where':{'id':_0xc9536f['params']['id']}})[_0x0d29('0x24')](handleEntityNotFound(_0xb65087,null))[_0x0d29('0x24')](removeEntity(_0xb65087,null))['catch'](handleError(_0xb65087,null));}; \ No newline at end of file +var _0xbce6=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','update','params','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xbce6,0xe9));var _0x6bce=function(_0x93ed48,_0x34877e){_0x93ed48=_0x93ed48-0x0;var _0x34ab46=_0xbce6[_0x93ed48];return _0x34ab46;};'use strict';var emlformat=require(_0x6bce('0x0'));var rimraf=require(_0x6bce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bce('0x2'));var moment=require('moment');var BPromise=require(_0x6bce('0x3'));var Mustache=require(_0x6bce('0x4'));var util=require('util');var path=require(_0x6bce('0x5'));var sox=require('sox');var csv=require(_0x6bce('0x6'));var ejs=require(_0x6bce('0x7'));var fs=require('fs');var fs_extra=require(_0x6bce('0x8'));var _=require('lodash');var squel=require(_0x6bce('0x9'));var crypto=require(_0x6bce('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6bce('0xb'));var toCsv=require(_0x6bce('0x6'));var querystring=require('querystring');var Papa=require(_0x6bce('0xc'));var Redis=require('ioredis');var authService=require(_0x6bce('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6bce('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bce('0xf'))(_0x6bce('0x10'));var utils=require(_0x6bce('0x11'));var config=require(_0x6bce('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x497db5,_0x561a9a){_0x561a9a=_0x561a9a||0xcc;return function(_0x3efd56){if(_0x3efd56){return _0x497db5[_0x6bce('0x13')](_0x561a9a);}return _0x497db5[_0x6bce('0x14')](_0x561a9a)[_0x6bce('0x15')]();};}function respondWithResult(_0x1ebe49,_0x188473){_0x188473=_0x188473||0xc8;return function(_0x4b8bba){if(_0x4b8bba){return _0x1ebe49[_0x6bce('0x14')](_0x188473)[_0x6bce('0x16')](_0x4b8bba);}};}function respondWithFilteredResult(_0xbe7086,_0x10a4d8){return function(_0x94a919){if(_0x94a919){var _0x2c305c=typeof _0x10a4d8[_0x6bce('0x17')]==='undefined'&&typeof _0x10a4d8[_0x6bce('0x18')]===_0x6bce('0x19');var _0x45a81b=_0x94a919[_0x6bce('0x1a')];var _0x38cf12=_0x2c305c?0x0:_0x10a4d8[_0x6bce('0x17')];var _0xef3461=_0x2c305c?_0x94a919[_0x6bce('0x1a')]:_0x10a4d8[_0x6bce('0x17')]+_0x10a4d8['limit'];var _0x42bec1;if(_0xef3461>=_0x45a81b){_0xef3461=_0x45a81b;_0x42bec1=0xc8;}else{_0x42bec1=0xce;}_0xbe7086[_0x6bce('0x14')](_0x42bec1);return _0xbe7086[_0x6bce('0x1b')](_0x6bce('0x1c'),_0x38cf12+'-'+_0xef3461+'/'+_0x45a81b)[_0x6bce('0x16')](_0x94a919);}return null;};}function patchUpdates(_0x1b49d1){return function(_0x13b815){try{jsonpatch[_0x6bce('0x1d')](_0x13b815,_0x1b49d1,!![]);}catch(_0x4a8cfb){return BPromise[_0x6bce('0x1e')](_0x4a8cfb);}return _0x13b815['save']();};}function saveUpdates(_0x492ef9,_0x1547e0){return function(_0x16e6b5){if(_0x16e6b5){return _0x16e6b5['update'](_0x492ef9)['then'](function(_0x5d0d88){return _0x5d0d88;});}return null;};}function removeEntity(_0x4af7d7,_0x24cd31){return function(_0x419623){if(_0x419623){return _0x419623[_0x6bce('0x1f')]()[_0x6bce('0x20')](function(){_0x4af7d7['status'](0xcc)[_0x6bce('0x15')]();});}};}function handleEntityNotFound(_0x46be84,_0x1203d4){return function(_0x1f9e26){if(!_0x1f9e26){_0x46be84[_0x6bce('0x13')](0x194);}return _0x1f9e26;};}function handleError(_0x2a82ae,_0x5c86ef){_0x5c86ef=_0x5c86ef||0x1f4;return function(_0x225752){logger[_0x6bce('0x21')](_0x225752[_0x6bce('0x22')]);if(_0x225752[_0x6bce('0x23')]){delete _0x225752[_0x6bce('0x23')];}_0x2a82ae[_0x6bce('0x14')](_0x5c86ef)[_0x6bce('0x24')](_0x225752);};}exports[_0x6bce('0x25')]=function(_0x2c2b40,_0x44a1de){var _0x14298e={},_0xbbc97d={},_0x46d6c4={'count':0x0,'rows':[]};var _0x1776cc=_[_0x6bce('0x26')](db[_0x6bce('0x27')][_0x6bce('0x28')],function(_0x1efd56){return{'name':_0x1efd56['fieldName'],'type':_0x1efd56[_0x6bce('0x29')][_0x6bce('0x2a')]};});_0xbbc97d[_0x6bce('0x2b')]=_[_0x6bce('0x26')](_0x1776cc,_0x6bce('0x23'));_0xbbc97d[_0x6bce('0x2c')]=_[_0x6bce('0x2d')](_0x2c2b40[_0x6bce('0x2c')]);_0xbbc97d[_0x6bce('0x2e')]=_[_0x6bce('0x2f')](_0xbbc97d['model'],_0xbbc97d[_0x6bce('0x2c')]);_0x14298e[_0x6bce('0x30')]=_[_0x6bce('0x2f')](_0xbbc97d[_0x6bce('0x2b')],qs[_0x6bce('0x31')](_0x2c2b40[_0x6bce('0x2c')]['fields']));_0x14298e[_0x6bce('0x30')]=_0x14298e['attributes'][_0x6bce('0x32')]?_0x14298e[_0x6bce('0x30')]:_0xbbc97d[_0x6bce('0x2b')];if(!_0x2c2b40[_0x6bce('0x2c')][_0x6bce('0x33')]('nolimit')){_0x14298e['limit']=qs[_0x6bce('0x18')](_0x2c2b40[_0x6bce('0x2c')]['limit']);_0x14298e[_0x6bce('0x17')]=qs[_0x6bce('0x17')](_0x2c2b40[_0x6bce('0x2c')][_0x6bce('0x17')]);}_0x14298e[_0x6bce('0x34')]=qs[_0x6bce('0x35')](_0x2c2b40[_0x6bce('0x2c')][_0x6bce('0x35')]);_0x14298e[_0x6bce('0x36')]=qs[_0x6bce('0x2e')](_[_0x6bce('0x37')](_0x2c2b40[_0x6bce('0x2c')],_0xbbc97d[_0x6bce('0x2e')]),_0x1776cc);if(_0x2c2b40[_0x6bce('0x2c')][_0x6bce('0x38')]){_0x14298e[_0x6bce('0x36')]=_['merge'](_0x14298e[_0x6bce('0x36')],{'$or':_[_0x6bce('0x26')](_0x1776cc,function(_0x15c437){if(_0x15c437[_0x6bce('0x29')]!==_0x6bce('0x39')){var _0x183d8e={};_0x183d8e[_0x15c437[_0x6bce('0x23')]]={'$like':'%'+_0x2c2b40[_0x6bce('0x2c')]['filter']+'%'};return _0x183d8e;}})});}_0x14298e=_[_0x6bce('0x3a')]({},_0x14298e,_0x2c2b40[_0x6bce('0x3b')]);var _0x4cb8b6={'where':_0x14298e['where']};return db[_0x6bce('0x27')][_0x6bce('0x1a')](_0x4cb8b6)[_0x6bce('0x20')](function(_0xc97940){_0x46d6c4[_0x6bce('0x1a')]=_0xc97940;if(_0x2c2b40[_0x6bce('0x2c')][_0x6bce('0x3c')]){_0x14298e[_0x6bce('0x3d')]=[{'all':!![]}];}return db[_0x6bce('0x27')][_0x6bce('0x3e')](_0x14298e);})[_0x6bce('0x20')](function(_0x3d667b){_0x46d6c4['rows']=_0x3d667b;return _0x46d6c4;})[_0x6bce('0x20')](respondWithFilteredResult(_0x44a1de,_0x14298e))[_0x6bce('0x3f')](handleError(_0x44a1de,null));};exports[_0x6bce('0x40')]=function(_0x3074b2,_0x52a6f2){var _0x1de5ff={'raw':!![],'where':{'id':_0x3074b2['params']['id']}},_0x587036={};_0x587036['model']=_['keys'](db[_0x6bce('0x27')]['rawAttributes']);_0x587036[_0x6bce('0x2c')]=_[_0x6bce('0x2d')](_0x3074b2[_0x6bce('0x2c')]);_0x587036[_0x6bce('0x2e')]=_[_0x6bce('0x2f')](_0x587036[_0x6bce('0x2b')],_0x587036[_0x6bce('0x2c')]);_0x1de5ff[_0x6bce('0x30')]=_[_0x6bce('0x2f')](_0x587036[_0x6bce('0x2b')],qs[_0x6bce('0x31')](_0x3074b2[_0x6bce('0x2c')][_0x6bce('0x31')]));_0x1de5ff[_0x6bce('0x30')]=_0x1de5ff['attributes']['length']?_0x1de5ff[_0x6bce('0x30')]:_0x587036[_0x6bce('0x2b')];if(_0x3074b2[_0x6bce('0x2c')][_0x6bce('0x3c')]){_0x1de5ff[_0x6bce('0x3d')]=[{'all':!![]}];}_0x1de5ff=_[_0x6bce('0x3a')]({},_0x1de5ff,_0x3074b2['options']);return db[_0x6bce('0x27')][_0x6bce('0x41')](_0x1de5ff)[_0x6bce('0x20')](handleEntityNotFound(_0x52a6f2,null))[_0x6bce('0x20')](respondWithResult(_0x52a6f2,null))[_0x6bce('0x3f')](handleError(_0x52a6f2,null));};exports['create']=function(_0x3918b5,_0x1ac9bd){return db['Dynamics365Field'][_0x6bce('0x42')](_0x3918b5[_0x6bce('0x43')],{})[_0x6bce('0x20')](respondWithResult(_0x1ac9bd,0xc9))[_0x6bce('0x3f')](handleError(_0x1ac9bd,null));};exports[_0x6bce('0x44')]=function(_0x164096,_0x3f4672){if(_0x164096[_0x6bce('0x43')]['id']){delete _0x164096[_0x6bce('0x43')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x164096['params']['id']}})['then'](handleEntityNotFound(_0x3f4672,null))[_0x6bce('0x20')](saveUpdates(_0x164096[_0x6bce('0x43')],null))[_0x6bce('0x20')](respondWithResult(_0x3f4672,null))[_0x6bce('0x3f')](handleError(_0x3f4672,null));};exports['destroy']=function(_0x41270e,_0x52de16){return db[_0x6bce('0x27')][_0x6bce('0x41')]({'where':{'id':_0x41270e[_0x6bce('0x45')]['id']}})['then'](handleEntityNotFound(_0x52de16,null))[_0x6bce('0x20')](removeEntity(_0x52de16,null))[_0x6bce('0x3f')](handleError(_0x52de16,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8f3233a..cf78706 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 _0xb280=['request-promise','path','rimraf','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c4e52,_0x3216f3){var _0x317574=function(_0x2e5715){while(--_0x2e5715){_0x4c4e52['push'](_0x4c4e52['shift']());}};_0x317574(++_0x3216f3);}(_0xb280,0x1aa));var _0x0b28=function(_0x350ac1,_0x47cc16){_0x350ac1=_0x350ac1-0x0;var _0xaa58a0=_0xb280[_0x350ac1];return _0xaa58a0;};'use strict';var _=require(_0x0b28('0x0'));var util=require(_0x0b28('0x1'));var logger=require(_0x0b28('0x2'))(_0x0b28('0x3'));var moment=require(_0x0b28('0x4'));var BPromise=require(_0x0b28('0x5'));var rp=require(_0x0b28('0x6'));var fs=require('fs');var path=require(_0x0b28('0x7'));var rimraf=require(_0x0b28('0x8'));var config=require(_0x0b28('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x0b28('0xa')]=function(_0x3b06b0,_0x553211){return _0x3b06b0['define'](_0x0b28('0xb'),attributes,{'tableName':_0x0b28('0xc'),'paranoid':![],'indexes':[{'name':_0x0b28('0xd'),'fields':[_0x0b28('0xe'),_0x0b28('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90a3=['bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x563e37,_0x57ec90){var _0x445543=function(_0x519237){while(--_0x519237){_0x563e37['push'](_0x563e37['shift']());}};_0x445543(++_0x57ec90);}(_0x90a3,0x14c));var _0x390a=function(_0x2b5122,_0x19137a){_0x2b5122=_0x2b5122-0x0;var _0x9d66c8=_0x90a3[_0x2b5122];return _0x9d66c8;};'use strict';var _=require('lodash');var util=require(_0x390a('0x0'));var logger=require(_0x390a('0x1'))(_0x390a('0x2'));var moment=require(_0x390a('0x3'));var BPromise=require(_0x390a('0x4'));var rp=require(_0x390a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x390a('0x6'));var config=require(_0x390a('0x7'));var attributes=require(_0x390a('0x8'));module[_0x390a('0x9')]=function(_0x250f23,_0x3c85ef){return _0x250f23[_0x390a('0xa')](_0x390a('0xb'),attributes,{'tableName':_0x390a('0xc'),'paranoid':![],'indexes':[{'name':_0x390a('0xd'),'fields':[_0x390a('0xe'),_0x390a('0xf')],'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 6c6765c..adc0a19 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 _0x8079=['client','http','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x31de91,_0x33d458){var _0x196d6d=function(_0x13564d){while(--_0x13564d){_0x31de91['push'](_0x31de91['shift']());}};_0x196d6d(++_0x33d458);}(_0x8079,0xa3));var _0x9807=function(_0x4ec612,_0x57dfd6){_0x4ec612=_0x4ec612-0x0;var _0x52a015=_0x8079[_0x4ec612];return _0x52a015;};'use strict';var _=require(_0x9807('0x0'));var util=require('util');var moment=require(_0x9807('0x1'));var BPromise=require(_0x9807('0x2'));var rs=require(_0x9807('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9807('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9807('0x5'));var config=require(_0x9807('0x6'));var jayson=require(_0x9807('0x7'));var client=jayson[_0x9807('0x8')][_0x9807('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dc4b5,_0x505af3,_0x23a541){return new BPromise(function(_0x203854,_0x4a8979){return client['request'](_0x5dc4b5,_0x23a541)['then'](function(_0x154520){logger[_0x9807('0xa')](_0x9807('0xb'),_0x505af3,_0x9807('0xc'));logger['debug'](_0x9807('0xd'),_0x505af3,_0x9807('0xc'),JSON['stringify'](_0x154520));if(_0x154520[_0x9807('0xe')]){if(_0x154520[_0x9807('0xe')][_0x9807('0xf')]===0x1f4){logger[_0x9807('0xe')](_0x9807('0xb'),_0x505af3,_0x154520[_0x9807('0xe')][_0x9807('0x10')]);return _0x4a8979(_0x154520['error']['message']);}logger[_0x9807('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x505af3,_0x154520[_0x9807('0xe')][_0x9807('0x10')]);return _0x203854(_0x154520[_0x9807('0xe')]['message']);}else{logger[_0x9807('0xa')](_0x9807('0xb'),_0x505af3,_0x9807('0xc'));_0x203854(_0x154520[_0x9807('0x11')][_0x9807('0x10')]);}})[_0x9807('0x12')](function(_0x2bfd16){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x505af3,_0x2bfd16);_0x4a8979(_0x2bfd16);});});} \ No newline at end of file +var _0x2784=['../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','catch','bluebird','randomstring','../../mysqldb'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2784,0x1bf));var _0x4278=function(_0x1c11fb,_0x3ffa67){_0x1c11fb=_0x1c11fb-0x0;var _0x5ee749=_0x2784[_0x1c11fb];return _0x5ee749;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4278('0x0'));var rs=require(_0x4278('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4278('0x2'))['db'];var utils=require(_0x4278('0x3'));var logger=require('../../config/logger')(_0x4278('0x4'));var config=require(_0x4278('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4278('0x6')][_0x4278('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x579c02,_0x2518a0,_0x58ceb5){return new BPromise(function(_0x56cec9,_0x2a7c93){return client[_0x4278('0x8')](_0x579c02,_0x58ceb5)['then'](function(_0x375914){logger[_0x4278('0x9')]('Dynamics365Field,\x20%s,\x20%s',_0x2518a0,_0x4278('0xa'));logger['debug'](_0x4278('0xb'),_0x2518a0,'request\x20sent',JSON[_0x4278('0xc')](_0x375914));if(_0x375914['error']){if(_0x375914[_0x4278('0xd')][_0x4278('0xe')]===0x1f4){logger[_0x4278('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x2518a0,_0x375914[_0x4278('0xd')][_0x4278('0xf')]);return _0x2a7c93(_0x375914[_0x4278('0xd')][_0x4278('0xf')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2518a0,_0x375914[_0x4278('0xd')][_0x4278('0xf')]);return _0x56cec9(_0x375914[_0x4278('0xd')][_0x4278('0xf')]);}else{logger['info'](_0x4278('0x10'),_0x2518a0,_0x4278('0xa'));_0x56cec9(_0x375914['result'][_0x4278('0xf')]);}})[_0x4278('0x11')](function(_0x13c2c1){logger[_0x4278('0xd')](_0x4278('0x10'),_0x2518a0,_0x13c2c1);_0x2a7c93(_0x13c2c1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 858ac6f..5137dd3 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 _0x729d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x4f13f8,_0x5e13c5){var _0x1e6b83=function(_0x26e15b){while(--_0x26e15b){_0x4f13f8['push'](_0x4f13f8['shift']());}};_0x1e6b83(++_0x5e13c5);}(_0x729d,0x129));var _0xd729=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x729d[_0x35e92e];return _0x1205a8;};'use strict';var multer=require(_0xd729('0x0'));var util=require(_0xd729('0x1'));var path=require(_0xd729('0x2'));var timeout=require('connect-timeout');var express=require(_0xd729('0x3'));var router=express[_0xd729('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd729('0x5'));var interaction=require(_0xd729('0x6'));var config=require(_0xd729('0x7'));var controller=require(_0xd729('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd729('0x9')]);router['get'](_0xd729('0xa'),auth[_0xd729('0xb')](),controller[_0xd729('0xc')]);router[_0xd729('0xd')](_0xd729('0xe'),auth[_0xd729('0xb')](),controller[_0xd729('0xf')]);router[_0xd729('0xd')](_0xd729('0x10'),auth['isAuthenticated'](),controller[_0xd729('0x11')]);router[_0xd729('0x12')]('/',auth['isAuthenticated'](),controller[_0xd729('0x13')]);router['post'](_0xd729('0xe'),auth['isAuthenticated'](),controller[_0xd729('0x14')]);router[_0xd729('0x15')](_0xd729('0xa'),auth[_0xd729('0xb')](),controller[_0xd729('0x16')]);router[_0xd729('0x17')](_0xd729('0xa'),auth[_0xd729('0xb')](),controller[_0xd729('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['addConfiguration','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x115270,_0x2d5328){var _0x470bd2=function(_0x531ff0){while(--_0x531ff0){_0x115270['push'](_0x115270['shift']());}};_0x470bd2(++_0x2d5328);}(_0xcb91,0x11a));var _0x1cb9=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xcb91[_0x2caaef];return _0xd011f8;};'use strict';var multer=require('multer');var util=require(_0x1cb9('0x0'));var path=require(_0x1cb9('0x1'));var timeout=require(_0x1cb9('0x2'));var express=require(_0x1cb9('0x3'));var router=express[_0x1cb9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1cb9('0x6'));var controller=require(_0x1cb9('0x7'));router[_0x1cb9('0x8')]('/',auth[_0x1cb9('0x9')](),controller['index']);router[_0x1cb9('0x8')](_0x1cb9('0xa'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x8')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x8')](_0x1cb9('0xe'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x1cb9('0x12')]);router['put'](_0x1cb9('0xa'),auth[_0x1cb9('0x9')](),controller['update']);router['delete'](_0x1cb9('0xa'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e8286b3..8cf7608 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 _0x430c=['sequelize','STRING','username'];(function(_0x514f94,_0x366e06){var _0x50d662=function(_0x397167){while(--_0x397167){_0x514f94['push'](_0x514f94['shift']());}};_0x50d662(++_0x366e06);}(_0x430c,0x1a1));var _0xc430=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x430c[_0x15cdcb];return _0x37b069;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc430('0x1')]},'username':{'type':Sequelize[_0xc430('0x1')],'unique':_0xc430('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0424=['username','STRING'];(function(_0x1fe9d8,_0x1b8bca){var _0xc894d7=function(_0x1bb97c){while(--_0x1bb97c){_0x1fe9d8['push'](_0x1fe9d8['shift']());}};_0xc894d7(++_0x1b8bca);}(_0x0424,0x159));var _0x4042=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x0424[_0xcf5436];return _0xc4f5c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index a0dc1b9..0e6da24 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 _0xe13e=['statusCode','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','base64','requester','subject','agent','priority','group','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','test'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee13('0x0'));var jsonpatch=require(_0xee13('0x1'));var rp=require(_0xee13('0x2'));var moment=require(_0xee13('0x3'));var BPromise=require(_0xee13('0x4'));var Mustache=require(_0xee13('0x5'));var util=require(_0xee13('0x6'));var path=require(_0xee13('0x7'));var sox=require(_0xee13('0x8'));var csv=require(_0xee13('0x9'));var ejs=require(_0xee13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee13('0xb'));var squel=require(_0xee13('0xc'));var crypto=require(_0xee13('0xd'));var jsforce=require(_0xee13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xee13('0x9'));var querystring=require(_0xee13('0xf'));var Papa=require(_0xee13('0x10'));var Redis=require(_0xee13('0x11'));var authService=require(_0xee13('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee13('0x13'));var hardwareService=require(_0xee13('0x14'));var logger=require('../../config/logger')(_0xee13('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee13('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3060d8,_0x43f002){_0x43f002=_0x43f002||0xcc;return function(_0x1bbc15){if(_0x1bbc15){return _0x3060d8[_0xee13('0x17')](_0x43f002);}return _0x3060d8[_0xee13('0x18')](_0x43f002)[_0xee13('0x19')]();};}function respondWithResult(_0x2f7cd3,_0x50fd97){_0x50fd97=_0x50fd97||0xc8;return function(_0x383ca0){if(_0x383ca0){return _0x2f7cd3[_0xee13('0x18')](_0x50fd97)[_0xee13('0x1a')](_0x383ca0);}};}function respondWithFilteredResult(_0x53e5a5,_0x38eb56){return function(_0x6de406){if(_0x6de406){var _0x4cc57c=typeof _0x38eb56[_0xee13('0x1b')]===_0xee13('0x1c')&&typeof _0x38eb56[_0xee13('0x1d')]===_0xee13('0x1c');var _0x2513b2=_0x6de406[_0xee13('0x1e')];var _0xd353d0=_0x4cc57c?0x0:_0x38eb56[_0xee13('0x1b')];var _0x3806b0=_0x4cc57c?_0x6de406[_0xee13('0x1e')]:_0x38eb56['offset']+_0x38eb56[_0xee13('0x1d')];var _0x1ab3f8;if(_0x3806b0>=_0x2513b2){_0x3806b0=_0x2513b2;_0x1ab3f8=0xc8;}else{_0x1ab3f8=0xce;}_0x53e5a5['status'](_0x1ab3f8);return _0x53e5a5[_0xee13('0x1f')]('Content-Range',_0xd353d0+'-'+_0x3806b0+'/'+_0x2513b2)[_0xee13('0x1a')](_0x6de406);}return null;};}function patchUpdates(_0x4a49c0){return function(_0x364769){try{jsonpatch[_0xee13('0x20')](_0x364769,_0x4a49c0,!![]);}catch(_0x51e2d0){return BPromise[_0xee13('0x21')](_0x51e2d0);}return _0x364769[_0xee13('0x22')]();};}function saveUpdates(_0x3f9dfd,_0x3231b0){return function(_0x3d5354){if(_0x3d5354){return _0x3d5354['update'](_0x3f9dfd)[_0xee13('0x23')](function(_0x46bd44){return _0x46bd44;});}return null;};}function removeEntity(_0x4c705c,_0x255ff2){return function(_0x4fe9b8){if(_0x4fe9b8){return _0x4fe9b8[_0xee13('0x24')]()['then'](function(){_0x4c705c['status'](0xcc)[_0xee13('0x19')]();});}};}function handleEntityNotFound(_0x323e1e,_0x49eddd){return function(_0x2b5f64){if(!_0x2b5f64){_0x323e1e[_0xee13('0x17')](0x194);}return _0x2b5f64;};}function handleError(_0x19096f,_0x48b604){_0x48b604=_0x48b604||0x1f4;return function(_0x4aec7a){logger[_0xee13('0x25')](_0x4aec7a[_0xee13('0x26')]);if(_0x4aec7a[_0xee13('0x27')]){delete _0x4aec7a[_0xee13('0x27')];}_0x19096f[_0xee13('0x18')](_0x48b604)[_0xee13('0x28')](_0x4aec7a);};}exports[_0xee13('0x29')]=function(_0x29ddad,_0x28d237){var _0x458e12={},_0x3aeaac={},_0x37f57d={'count':0x0,'rows':[]};var _0x352c4a=_[_0xee13('0x2a')](db[_0xee13('0x2b')][_0xee13('0x2c')],function(_0x4bc1f6){return{'name':_0x4bc1f6['fieldName'],'type':_0x4bc1f6[_0xee13('0x2d')][_0xee13('0x2e')]};});_0x3aeaac[_0xee13('0x2f')]=_[_0xee13('0x2a')](_0x352c4a,'name');_0x3aeaac[_0xee13('0x30')]=_[_0xee13('0x31')](_0x29ddad[_0xee13('0x30')]);_0x3aeaac[_0xee13('0x32')]=_[_0xee13('0x33')](_0x3aeaac[_0xee13('0x2f')],_0x3aeaac[_0xee13('0x30')]);_0x458e12[_0xee13('0x34')]=_[_0xee13('0x33')](_0x3aeaac['model'],qs[_0xee13('0x35')](_0x29ddad['query']['fields']));_0x458e12[_0xee13('0x34')]=_0x458e12['attributes'][_0xee13('0x36')]?_0x458e12['attributes']:_0x3aeaac[_0xee13('0x2f')];if(!_0x29ddad[_0xee13('0x30')][_0xee13('0x37')](_0xee13('0x38'))){_0x458e12[_0xee13('0x1d')]=qs[_0xee13('0x1d')](_0x29ddad[_0xee13('0x30')][_0xee13('0x1d')]);_0x458e12[_0xee13('0x1b')]=qs['offset'](_0x29ddad[_0xee13('0x30')][_0xee13('0x1b')]);}_0x458e12[_0xee13('0x39')]=qs['sort'](_0x29ddad[_0xee13('0x30')][_0xee13('0x3a')]);_0x458e12[_0xee13('0x3b')]=qs[_0xee13('0x32')](_[_0xee13('0x3c')](_0x29ddad[_0xee13('0x30')],_0x3aeaac['filters']),_0x352c4a);if(_0x29ddad[_0xee13('0x30')][_0xee13('0x3d')]){_0x458e12[_0xee13('0x3b')]=_['merge'](_0x458e12[_0xee13('0x3b')],{'$or':_[_0xee13('0x2a')](_0x352c4a,function(_0x54e788){if(_0x54e788[_0xee13('0x2d')]!==_0xee13('0x3e')){var _0x2da61b={};_0x2da61b[_0x54e788[_0xee13('0x27')]]={'$like':'%'+_0x29ddad[_0xee13('0x30')]['filter']+'%'};return _0x2da61b;}})});}_0x458e12=_['merge']({},_0x458e12,_0x29ddad[_0xee13('0x3f')]);var _0x28869e={'where':_0x458e12[_0xee13('0x3b')]};return db[_0xee13('0x2b')][_0xee13('0x1e')](_0x28869e)[_0xee13('0x23')](function(_0x3f5cca){_0x37f57d[_0xee13('0x1e')]=_0x3f5cca;if(_0x29ddad[_0xee13('0x30')]['includeAll']){_0x458e12[_0xee13('0x40')]=[{'all':!![]}];}return db[_0xee13('0x2b')][_0xee13('0x41')](_0x458e12);})[_0xee13('0x23')](function(_0x51ed87){_0x37f57d['rows']=_0x51ed87;return _0x37f57d;})['then'](respondWithFilteredResult(_0x28d237,_0x458e12))[_0xee13('0x42')](handleError(_0x28d237,null));};exports['show']=function(_0x4b5288,_0x16d84a){var _0x4a7ce6={'raw':![],'where':{'id':_0x4b5288[_0xee13('0x43')]['id']}},_0x37cc44={};_0x37cc44[_0xee13('0x2f')]=_['keys'](db[_0xee13('0x2b')][_0xee13('0x2c')]);_0x37cc44['query']=_['keys'](_0x4b5288['query']);_0x37cc44[_0xee13('0x32')]=_['intersection'](_0x37cc44[_0xee13('0x2f')],_0x37cc44[_0xee13('0x30')]);_0x4a7ce6[_0xee13('0x34')]=_[_0xee13('0x33')](_0x37cc44[_0xee13('0x2f')],qs[_0xee13('0x35')](_0x4b5288[_0xee13('0x30')][_0xee13('0x35')]));_0x4a7ce6[_0xee13('0x34')]=_0x4a7ce6[_0xee13('0x34')][_0xee13('0x36')]?_0x4a7ce6[_0xee13('0x34')]:_0x37cc44[_0xee13('0x2f')];if(_0x4b5288[_0xee13('0x30')][_0xee13('0x44')]){_0x4a7ce6[_0xee13('0x40')]=[{'all':!![]}];}_0x4a7ce6=_[_0xee13('0x45')]({},_0x4a7ce6,_0x4b5288[_0xee13('0x3f')]);return db[_0xee13('0x2b')][_0xee13('0x46')](_0x4a7ce6)[_0xee13('0x23')](handleEntityNotFound(_0x16d84a,null))[_0xee13('0x23')](respondWithResult(_0x16d84a,null))[_0xee13('0x42')](handleError(_0x16d84a,null));};exports[_0xee13('0x47')]=function(_0x33676c,_0x313c74){return db['FreshdeskAccount'][_0xee13('0x47')](_0x33676c[_0xee13('0x48')],{})[_0xee13('0x23')](respondWithResult(_0x313c74,0xc9))[_0xee13('0x42')](handleError(_0x313c74,null));};exports[_0xee13('0x49')]=function(_0x587642,_0x599343){if(_0x587642['body']['id']){delete _0x587642[_0xee13('0x48')]['id'];}return db[_0xee13('0x2b')][_0xee13('0x46')]({'where':{'id':_0x587642[_0xee13('0x43')]['id']}})[_0xee13('0x23')](handleEntityNotFound(_0x599343,null))[_0xee13('0x23')](saveUpdates(_0x587642[_0xee13('0x48')],null))['then'](respondWithResult(_0x599343,null))[_0xee13('0x42')](handleError(_0x599343,null));};exports[_0xee13('0x24')]=function(_0x225eda,_0x2d0a07){return db['FreshdeskAccount'][_0xee13('0x46')]({'where':{'id':_0x225eda[_0xee13('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d0a07,null))['then'](removeEntity(_0x2d0a07,null))[_0xee13('0x42')](handleError(_0x2d0a07,null));};exports[_0xee13('0x4a')]=function(_0x37fe13,_0xb1c8d,_0x1d6157){var _0x43d530={};var _0x39bbf1={};var _0x17a8ec;var _0x4b3ea2;return db[_0xee13('0x2b')][_0xee13('0x4b')]({'where':{'id':_0x37fe13[_0xee13('0x43')]['id']}})[_0xee13('0x23')](handleEntityNotFound(_0xb1c8d,null))['then'](function(_0x2d8889){if(_0x2d8889){_0x17a8ec=_0x2d8889;_0x39bbf1['model']=_['keys'](db[_0xee13('0x4c')]['rawAttributes']);_0x39bbf1[_0xee13('0x30')]=_[_0xee13('0x31')](_0x37fe13[_0xee13('0x30')]);_0x39bbf1[_0xee13('0x32')]=_[_0xee13('0x33')](_0x39bbf1['model'],_0x39bbf1[_0xee13('0x30')]);_0x43d530['attributes']=_[_0xee13('0x33')](_0x39bbf1[_0xee13('0x2f')],qs[_0xee13('0x35')](_0x37fe13[_0xee13('0x30')][_0xee13('0x35')]));_0x43d530[_0xee13('0x34')]=_0x43d530[_0xee13('0x34')][_0xee13('0x36')]?_0x43d530['attributes']:_0x39bbf1[_0xee13('0x2f')];_0x43d530[_0xee13('0x39')]=qs['sort'](_0x37fe13[_0xee13('0x30')][_0xee13('0x3a')]);_0x43d530[_0xee13('0x3b')]=qs[_0xee13('0x32')](_['pick'](_0x37fe13[_0xee13('0x30')],_0x39bbf1[_0xee13('0x32')]));if(_0x37fe13[_0xee13('0x30')][_0xee13('0x3d')]){_0x43d530[_0xee13('0x3b')]=_[_0xee13('0x45')](_0x43d530['where'],{'$or':_[_0xee13('0x2a')](_0x43d530['attributes'],function(_0x3409ba){var _0x23ba4b={};_0x23ba4b[_0x3409ba]={'$like':'%'+_0x37fe13['query'][_0xee13('0x3d')]+'%'};return _0x23ba4b;})});}_0x43d530=_[_0xee13('0x45')]({},_0x43d530,_0x37fe13[_0xee13('0x3f')]);return _0x17a8ec['getConfigurations'](_0x43d530);}})[_0xee13('0x23')](function(_0x4ee2e1){if(_0x4ee2e1){_0x4b3ea2=_0x4ee2e1[_0xee13('0x36')];if(!_0x37fe13['query'][_0xee13('0x37')](_0xee13('0x38'))){_0x43d530[_0xee13('0x1d')]=qs[_0xee13('0x1d')](_0x37fe13[_0xee13('0x30')]['limit']);_0x43d530[_0xee13('0x1b')]=qs['offset'](_0x37fe13[_0xee13('0x30')][_0xee13('0x1b')]);}return _0x17a8ec[_0xee13('0x4a')](_0x43d530);}})['then'](function(_0x57e4c8){if(_0x57e4c8){return _0x57e4c8?{'count':_0x4b3ea2,'rows':_0x57e4c8}:null;}})[_0xee13('0x23')](respondWithResult(_0xb1c8d,null))[_0xee13('0x42')](handleError(_0xb1c8d,null));};exports[_0xee13('0x4d')]=function(_0x33eeb1,_0x3453c2,_0x567ab3){if(_0x33eeb1[_0xee13('0x48')]['id']){delete _0x33eeb1['body']['id'];}return db[_0xee13('0x2b')][_0xee13('0x4b')]({'where':{'id':_0x33eeb1[_0xee13('0x43')]['id']}})[_0xee13('0x23')](handleEntityNotFound(_0x3453c2,null))[_0xee13('0x23')](function(_0x25ef35){if(_0x25ef35){_0x33eeb1[_0xee13('0x48')][_0xee13('0x4e')]=_0x25ef35['id'];_0x33eeb1[_0xee13('0x48')][_0xee13('0x4f')]=integrations['getSubjects'](_0x33eeb1[_0xee13('0x48')][_0xee13('0x50')],_0x33eeb1[_0xee13('0x48')][_0xee13('0x2d')]);_0x33eeb1['body'][_0xee13('0x51')]=integrations[_0xee13('0x52')](_0x33eeb1['body']['channel'],_0x33eeb1[_0xee13('0x48')]['type']);return db[_0xee13('0x4c')][_0xee13('0x47')](_0x33eeb1[_0xee13('0x48')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0xee13('0x53')],'as':_0xee13('0x51')}]});}return null;})[_0xee13('0x23')](respondWithResult(_0x3453c2,null))[_0xee13('0x42')](handleError(_0x3453c2,null));};exports[_0xee13('0x54')]=function(_0x5d0906,_0x16bc95,_0x3f208a){var _0x2cdb7c='';return db[_0xee13('0x2b')][_0xee13('0x4b')]({'where':{'id':_0x5d0906[_0xee13('0x43')]['id']},'attributes':['id',_0xee13('0x55'),_0xee13('0x56')]})[_0xee13('0x23')](handleEntityNotFound(_0x16bc95,null))[_0xee13('0x23')](function(_0x30ae31){if(_0x30ae31){_0x2cdb7c=_0x30ae31['remoteUri'];var _0x576d3c=_0x2cdb7c[_0xee13('0x57')](-0x1);if(_0x576d3c==='/'){_0x2cdb7c=_0x2cdb7c[_0xee13('0x58')](0x0,_0x2cdb7c[_0xee13('0x59')](_0x576d3c));}return rp({'method':'GET','uri':util[_0xee13('0x5a')](_0xee13('0x5b'),_0x2cdb7c,_0xee13('0x5c')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xee13('0x5a')]('%s:X',_0x30ae31[_0xee13('0x56')]))['toString'](_0xee13('0x5d')))},'json':!![]});}})[_0xee13('0x23')](function(_0x534a43){if(_0x534a43){var _0x3dd4c9=[_0xee13('0x5e'),_0xee13('0x5f'),_0xee13('0x60'),'description',_0xee13('0x18'),_0xee13('0x61'),_0xee13('0x62'),'source',_0xee13('0x63'),_0xee13('0x62'),_0xee13('0x64')];_[_0xee13('0x65')](_0x534a43,function(_0x2420d2){return _0x3dd4c9[_0xee13('0x66')](_0x2420d2[_0xee13('0x27')])||!_0x2420d2[_0xee13('0x67')]&&_0x2420d2[_0xee13('0x2d')]!=='custom_text'&&_0x2420d2[_0xee13('0x2d')]!==_0xee13('0x68');});return{'count':_0x534a43[_0xee13('0x36')],'rows':_[_0xee13('0x2a')](_0x534a43,function(_0x5f0200){return{'id':_0x5f0200[_0xee13('0x27')],'name':_0x5f0200[_0xee13('0x69')],'custom':!_0x5f0200[_0xee13('0x67')],'options':_0x5f0200[_0xee13('0x6a')]?_[_0xee13('0x2a')](_0x5f0200['choices'],function(_0x1060e3){return{'name':_['capitalize'](_0x1060e3),'value':_0x1060e3};}):[]};})};}})[_0xee13('0x23')](respondWithResult(_0x16bc95,null))[_0xee13('0x42')](function(_0x828108){var _0x1d7b0e=_0x5d0906['query'][_0xee13('0x6b')]?0x1f4:_0x828108[_0xee13('0x6c')]||0x1f4;logger[_0xee13('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xee13('0x54'),_0x1d7b0e,JSON['stringify'](_0x828108));delete _0x828108[_0xee13('0x27')];if(_0x1d7b0e===0x191){_0x1d7b0e=0x190;}_0x16bc95[_0xee13('0x18')](_0x1d7b0e)[_0xee13('0x28')](_0x5d0906[_0xee13('0x30')][_0xee13('0x6b')]?{'message':_0xee13('0x6d'),'statusCode':_0x828108[_0xee13('0x6c')]}:_0x828108);});}; \ No newline at end of file +var _0xc2e8=['choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','options','addConfiguration','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','apiKey','base64','requester','priority','group','source','remove','default'];(function(_0x4b0342,_0x5b071c){var _0xc62aa3=function(_0x501b2e){while(--_0x501b2e){_0x4b0342['push'](_0x4b0342['shift']());}};_0xc62aa3(++_0x5b071c);}(_0xc2e8,0x70));var _0x8c2e=function(_0x24bfe2,_0x4ba64a){_0x24bfe2=_0x24bfe2-0x0;var _0x53d71d=_0xc2e8[_0x24bfe2];return _0x53d71d;};'use strict';var emlformat=require(_0x8c2e('0x0'));var rimraf=require(_0x8c2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8c2e('0x2'));var moment=require('moment');var BPromise=require(_0x8c2e('0x3'));var Mustache=require(_0x8c2e('0x4'));var util=require(_0x8c2e('0x5'));var path=require('path');var sox=require(_0x8c2e('0x6'));var csv=require(_0x8c2e('0x7'));var ejs=require(_0x8c2e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c2e('0x9'));var toCsv=require(_0x8c2e('0x7'));var querystring=require(_0x8c2e('0xa'));var Papa=require(_0x8c2e('0xb'));var Redis=require(_0x8c2e('0xc'));var authService=require(_0x8c2e('0xd'));var qs=require(_0x8c2e('0xe'));var as=require(_0x8c2e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c2e('0x10'))(_0x8c2e('0x11'));var utils=require(_0x8c2e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8c2e('0x13'));function respondWithStatusCode(_0x364b18,_0x2952f4){_0x2952f4=_0x2952f4||0xcc;return function(_0x3e6f17){if(_0x3e6f17){return _0x364b18[_0x8c2e('0x14')](_0x2952f4);}return _0x364b18[_0x8c2e('0x15')](_0x2952f4)[_0x8c2e('0x16')]();};}function respondWithResult(_0x4f9398,_0x5bedbb){_0x5bedbb=_0x5bedbb||0xc8;return function(_0x154f3b){if(_0x154f3b){return _0x4f9398[_0x8c2e('0x15')](_0x5bedbb)[_0x8c2e('0x17')](_0x154f3b);}};}function respondWithFilteredResult(_0x2787af,_0x203b3a){return function(_0x3e5f16){if(_0x3e5f16){var _0x58016d=typeof _0x203b3a[_0x8c2e('0x18')]===_0x8c2e('0x19')&&typeof _0x203b3a[_0x8c2e('0x1a')]===_0x8c2e('0x19');var _0x572e8c=_0x3e5f16[_0x8c2e('0x1b')];var _0x8aa81d=_0x58016d?0x0:_0x203b3a[_0x8c2e('0x18')];var _0x56d9f4=_0x58016d?_0x3e5f16['count']:_0x203b3a[_0x8c2e('0x18')]+_0x203b3a['limit'];var _0x3d1f08;if(_0x56d9f4>=_0x572e8c){_0x56d9f4=_0x572e8c;_0x3d1f08=0xc8;}else{_0x3d1f08=0xce;}_0x2787af[_0x8c2e('0x15')](_0x3d1f08);return _0x2787af['set'](_0x8c2e('0x1c'),_0x8aa81d+'-'+_0x56d9f4+'/'+_0x572e8c)[_0x8c2e('0x17')](_0x3e5f16);}return null;};}function patchUpdates(_0x3f98f0){return function(_0x4e35d7){try{jsonpatch[_0x8c2e('0x1d')](_0x4e35d7,_0x3f98f0,!![]);}catch(_0x5641e1){return BPromise[_0x8c2e('0x1e')](_0x5641e1);}return _0x4e35d7['save']();};}function saveUpdates(_0x4937b0,_0x308dd9){return function(_0x29e755){if(_0x29e755){return _0x29e755['update'](_0x4937b0)['then'](function(_0xfc60d2){return _0xfc60d2;});}return null;};}function removeEntity(_0x5a389d,_0x350cc5){return function(_0x3e2aa0){if(_0x3e2aa0){return _0x3e2aa0[_0x8c2e('0x1f')]()['then'](function(){_0x5a389d[_0x8c2e('0x15')](0xcc)[_0x8c2e('0x16')]();});}};}function handleEntityNotFound(_0x2dfd48,_0x389297){return function(_0x5714dc){if(!_0x5714dc){_0x2dfd48[_0x8c2e('0x14')](0x194);}return _0x5714dc;};}function handleError(_0x50f221,_0x4e823d){_0x4e823d=_0x4e823d||0x1f4;return function(_0x231d37){logger[_0x8c2e('0x20')](_0x231d37['stack']);if(_0x231d37['name']){delete _0x231d37[_0x8c2e('0x21')];}_0x50f221[_0x8c2e('0x15')](_0x4e823d)[_0x8c2e('0x22')](_0x231d37);};}exports[_0x8c2e('0x23')]=function(_0xf9b0d4,_0x4696e3){var _0x39a9bc={},_0x589304={},_0x5e123b={'count':0x0,'rows':[]};var _0x4dcca3=_[_0x8c2e('0x24')](db[_0x8c2e('0x25')][_0x8c2e('0x26')],function(_0x534315){return{'name':_0x534315[_0x8c2e('0x27')],'type':_0x534315[_0x8c2e('0x28')][_0x8c2e('0x29')]};});_0x589304[_0x8c2e('0x2a')]=_[_0x8c2e('0x24')](_0x4dcca3,'name');_0x589304[_0x8c2e('0x2b')]=_[_0x8c2e('0x2c')](_0xf9b0d4['query']);_0x589304[_0x8c2e('0x2d')]=_[_0x8c2e('0x2e')](_0x589304[_0x8c2e('0x2a')],_0x589304[_0x8c2e('0x2b')]);_0x39a9bc[_0x8c2e('0x2f')]=_[_0x8c2e('0x2e')](_0x589304[_0x8c2e('0x2a')],qs[_0x8c2e('0x30')](_0xf9b0d4['query'][_0x8c2e('0x30')]));_0x39a9bc[_0x8c2e('0x2f')]=_0x39a9bc[_0x8c2e('0x2f')][_0x8c2e('0x31')]?_0x39a9bc[_0x8c2e('0x2f')]:_0x589304[_0x8c2e('0x2a')];if(!_0xf9b0d4[_0x8c2e('0x2b')][_0x8c2e('0x32')](_0x8c2e('0x33'))){_0x39a9bc['limit']=qs[_0x8c2e('0x1a')](_0xf9b0d4[_0x8c2e('0x2b')][_0x8c2e('0x1a')]);_0x39a9bc[_0x8c2e('0x18')]=qs[_0x8c2e('0x18')](_0xf9b0d4['query']['offset']);}_0x39a9bc[_0x8c2e('0x34')]=qs[_0x8c2e('0x35')](_0xf9b0d4[_0x8c2e('0x2b')][_0x8c2e('0x35')]);_0x39a9bc[_0x8c2e('0x36')]=qs[_0x8c2e('0x2d')](_[_0x8c2e('0x37')](_0xf9b0d4['query'],_0x589304['filters']),_0x4dcca3);if(_0xf9b0d4[_0x8c2e('0x2b')][_0x8c2e('0x38')]){_0x39a9bc[_0x8c2e('0x36')]=_[_0x8c2e('0x39')](_0x39a9bc[_0x8c2e('0x36')],{'$or':_[_0x8c2e('0x24')](_0x4dcca3,function(_0xe450c2){if(_0xe450c2[_0x8c2e('0x28')]!=='VIRTUAL'){var _0x22ea04={};_0x22ea04[_0xe450c2[_0x8c2e('0x21')]]={'$like':'%'+_0xf9b0d4[_0x8c2e('0x2b')]['filter']+'%'};return _0x22ea04;}})});}_0x39a9bc=_[_0x8c2e('0x39')]({},_0x39a9bc,_0xf9b0d4['options']);var _0x280188={'where':_0x39a9bc[_0x8c2e('0x36')]};return db[_0x8c2e('0x25')]['count'](_0x280188)['then'](function(_0x708c1b){_0x5e123b[_0x8c2e('0x1b')]=_0x708c1b;if(_0xf9b0d4['query'][_0x8c2e('0x3a')]){_0x39a9bc[_0x8c2e('0x3b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x8c2e('0x3c')](_0x39a9bc);})['then'](function(_0x17dff4){_0x5e123b[_0x8c2e('0x3d')]=_0x17dff4;return _0x5e123b;})[_0x8c2e('0x3e')](respondWithFilteredResult(_0x4696e3,_0x39a9bc))[_0x8c2e('0x3f')](handleError(_0x4696e3,null));};exports[_0x8c2e('0x40')]=function(_0x491047,_0x342c18){var _0x2ae43f={'raw':![],'where':{'id':_0x491047[_0x8c2e('0x41')]['id']}},_0x42bd71={};_0x42bd71['model']=_['keys'](db[_0x8c2e('0x25')][_0x8c2e('0x26')]);_0x42bd71[_0x8c2e('0x2b')]=_[_0x8c2e('0x2c')](_0x491047[_0x8c2e('0x2b')]);_0x42bd71[_0x8c2e('0x2d')]=_[_0x8c2e('0x2e')](_0x42bd71[_0x8c2e('0x2a')],_0x42bd71['query']);_0x2ae43f[_0x8c2e('0x2f')]=_[_0x8c2e('0x2e')](_0x42bd71[_0x8c2e('0x2a')],qs[_0x8c2e('0x30')](_0x491047[_0x8c2e('0x2b')][_0x8c2e('0x30')]));_0x2ae43f[_0x8c2e('0x2f')]=_0x2ae43f[_0x8c2e('0x2f')][_0x8c2e('0x31')]?_0x2ae43f[_0x8c2e('0x2f')]:_0x42bd71[_0x8c2e('0x2a')];if(_0x491047['query'][_0x8c2e('0x3a')]){_0x2ae43f[_0x8c2e('0x3b')]=[{'all':!![]}];}_0x2ae43f=_[_0x8c2e('0x39')]({},_0x2ae43f,_0x491047['options']);return db[_0x8c2e('0x25')][_0x8c2e('0x42')](_0x2ae43f)[_0x8c2e('0x3e')](handleEntityNotFound(_0x342c18,null))[_0x8c2e('0x3e')](respondWithResult(_0x342c18,null))[_0x8c2e('0x3f')](handleError(_0x342c18,null));};exports[_0x8c2e('0x43')]=function(_0x2cd691,_0x1c866a){return db[_0x8c2e('0x25')][_0x8c2e('0x43')](_0x2cd691[_0x8c2e('0x44')],{})[_0x8c2e('0x3e')](respondWithResult(_0x1c866a,0xc9))['catch'](handleError(_0x1c866a,null));};exports['update']=function(_0x3c0dff,_0xe9e8d3){if(_0x3c0dff['body']['id']){delete _0x3c0dff['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x3c0dff[_0x8c2e('0x41')]['id']}})[_0x8c2e('0x3e')](handleEntityNotFound(_0xe9e8d3,null))[_0x8c2e('0x3e')](saveUpdates(_0x3c0dff[_0x8c2e('0x44')],null))[_0x8c2e('0x3e')](respondWithResult(_0xe9e8d3,null))[_0x8c2e('0x3f')](handleError(_0xe9e8d3,null));};exports[_0x8c2e('0x1f')]=function(_0x108ff8,_0x3f8443){return db[_0x8c2e('0x25')][_0x8c2e('0x42')]({'where':{'id':_0x108ff8[_0x8c2e('0x41')]['id']}})[_0x8c2e('0x3e')](handleEntityNotFound(_0x3f8443,null))['then'](removeEntity(_0x3f8443,null))[_0x8c2e('0x3f')](handleError(_0x3f8443,null));};exports[_0x8c2e('0x45')]=function(_0x49c00,_0x32380f,_0x494f02){var _0x2739f0={};var _0x2455ee={};var _0x28a274;var _0x3d9423;return db[_0x8c2e('0x25')][_0x8c2e('0x46')]({'where':{'id':_0x49c00[_0x8c2e('0x41')]['id']}})[_0x8c2e('0x3e')](handleEntityNotFound(_0x32380f,null))[_0x8c2e('0x3e')](function(_0x26abbc){if(_0x26abbc){_0x28a274=_0x26abbc;_0x2455ee['model']=_[_0x8c2e('0x2c')](db[_0x8c2e('0x47')][_0x8c2e('0x26')]);_0x2455ee[_0x8c2e('0x2b')]=_['keys'](_0x49c00[_0x8c2e('0x2b')]);_0x2455ee['filters']=_[_0x8c2e('0x2e')](_0x2455ee['model'],_0x2455ee[_0x8c2e('0x2b')]);_0x2739f0['attributes']=_[_0x8c2e('0x2e')](_0x2455ee['model'],qs[_0x8c2e('0x30')](_0x49c00[_0x8c2e('0x2b')]['fields']));_0x2739f0[_0x8c2e('0x2f')]=_0x2739f0[_0x8c2e('0x2f')][_0x8c2e('0x31')]?_0x2739f0['attributes']:_0x2455ee[_0x8c2e('0x2a')];_0x2739f0[_0x8c2e('0x34')]=qs['sort'](_0x49c00[_0x8c2e('0x2b')]['sort']);_0x2739f0['where']=qs[_0x8c2e('0x2d')](_[_0x8c2e('0x37')](_0x49c00[_0x8c2e('0x2b')],_0x2455ee[_0x8c2e('0x2d')]));if(_0x49c00[_0x8c2e('0x2b')][_0x8c2e('0x38')]){_0x2739f0[_0x8c2e('0x36')]=_[_0x8c2e('0x39')](_0x2739f0[_0x8c2e('0x36')],{'$or':_[_0x8c2e('0x24')](_0x2739f0[_0x8c2e('0x2f')],function(_0x5b5408){var _0x5c083a={};_0x5c083a[_0x5b5408]={'$like':'%'+_0x49c00[_0x8c2e('0x2b')][_0x8c2e('0x38')]+'%'};return _0x5c083a;})});}_0x2739f0=_[_0x8c2e('0x39')]({},_0x2739f0,_0x49c00[_0x8c2e('0x48')]);return _0x28a274['getConfigurations'](_0x2739f0);}})[_0x8c2e('0x3e')](function(_0x32566f){if(_0x32566f){_0x3d9423=_0x32566f[_0x8c2e('0x31')];if(!_0x49c00[_0x8c2e('0x2b')]['hasOwnProperty'](_0x8c2e('0x33'))){_0x2739f0[_0x8c2e('0x1a')]=qs[_0x8c2e('0x1a')](_0x49c00[_0x8c2e('0x2b')][_0x8c2e('0x1a')]);_0x2739f0[_0x8c2e('0x18')]=qs[_0x8c2e('0x18')](_0x49c00[_0x8c2e('0x2b')][_0x8c2e('0x18')]);}return _0x28a274[_0x8c2e('0x45')](_0x2739f0);}})[_0x8c2e('0x3e')](function(_0x5659b7){if(_0x5659b7){return _0x5659b7?{'count':_0x3d9423,'rows':_0x5659b7}:null;}})['then'](respondWithResult(_0x32380f,null))[_0x8c2e('0x3f')](handleError(_0x32380f,null));};exports[_0x8c2e('0x49')]=function(_0x3e1417,_0x4552bb,_0x424ae3){if(_0x3e1417[_0x8c2e('0x44')]['id']){delete _0x3e1417[_0x8c2e('0x44')]['id'];}return db[_0x8c2e('0x25')]['findOne']({'where':{'id':_0x3e1417[_0x8c2e('0x41')]['id']}})[_0x8c2e('0x3e')](handleEntityNotFound(_0x4552bb,null))[_0x8c2e('0x3e')](function(_0xe05cfd){if(_0xe05cfd){_0x3e1417[_0x8c2e('0x44')]['AccountId']=_0xe05cfd['id'];_0x3e1417[_0x8c2e('0x44')][_0x8c2e('0x4a')]=integrations['getSubjects'](_0x3e1417[_0x8c2e('0x44')][_0x8c2e('0x4b')],_0x3e1417['body'][_0x8c2e('0x28')]);_0x3e1417[_0x8c2e('0x44')][_0x8c2e('0x4c')]=integrations[_0x8c2e('0x4d')](_0x3e1417[_0x8c2e('0x44')][_0x8c2e('0x4b')],_0x3e1417['body'][_0x8c2e('0x28')]);return db[_0x8c2e('0x47')][_0x8c2e('0x43')](_0x3e1417[_0x8c2e('0x44')],{'include':[{'model':db[_0x8c2e('0x4e')],'as':_0x8c2e('0x4a')},{'model':db[_0x8c2e('0x4e')],'as':_0x8c2e('0x4c')}]});}return null;})['then'](respondWithResult(_0x4552bb,null))[_0x8c2e('0x3f')](handleError(_0x4552bb,null));};exports['getFields']=function(_0x54bd87,_0x1c7fa1,_0x537820){var _0x1b6035='';return db[_0x8c2e('0x25')][_0x8c2e('0x46')]({'where':{'id':_0x54bd87[_0x8c2e('0x41')]['id']},'attributes':['id',_0x8c2e('0x4f'),'apiKey']})[_0x8c2e('0x3e')](handleEntityNotFound(_0x1c7fa1,null))['then'](function(_0x34cf32){if(_0x34cf32){_0x1b6035=_0x34cf32[_0x8c2e('0x4f')];var _0x733672=_0x1b6035[_0x8c2e('0x50')](-0x1);if(_0x733672==='/'){_0x1b6035=_0x1b6035[_0x8c2e('0x51')](0x0,_0x1b6035[_0x8c2e('0x52')](_0x733672));}return rp({'method':_0x8c2e('0x53'),'uri':util[_0x8c2e('0x54')](_0x8c2e('0x55'),_0x1b6035,_0x8c2e('0x56')),'headers':{'Authorization':util[_0x8c2e('0x54')]('Basic\x20%s',new Buffer(util['format'](_0x8c2e('0x57'),_0x34cf32[_0x8c2e('0x58')]))['toString'](_0x8c2e('0x59')))},'json':!![]});}})[_0x8c2e('0x3e')](function(_0x2b1ffa){if(_0x2b1ffa){var _0x5017c7=[_0x8c2e('0x5a'),'subject','agent','description',_0x8c2e('0x15'),_0x8c2e('0x5b'),_0x8c2e('0x5c'),_0x8c2e('0x5d'),'ticket_type',_0x8c2e('0x5c'),'company'];_[_0x8c2e('0x5e')](_0x2b1ffa,function(_0x255dc9){return _0x5017c7['includes'](_0x255dc9[_0x8c2e('0x21')])||!_0x255dc9[_0x8c2e('0x5f')]&&_0x255dc9[_0x8c2e('0x28')]!=='custom_text'&&_0x255dc9[_0x8c2e('0x28')]!=='custom_dropdown';});return{'count':_0x2b1ffa['length'],'rows':_[_0x8c2e('0x24')](_0x2b1ffa,function(_0x359d79){return{'id':_0x359d79['name'],'name':_0x359d79['label'],'custom':!_0x359d79[_0x8c2e('0x5f')],'options':_0x359d79['choices']?_[_0x8c2e('0x24')](_0x359d79[_0x8c2e('0x60')],function(_0x4bd01d){return{'name':_[_0x8c2e('0x61')](_0x4bd01d),'value':_0x4bd01d};}):[]};})};}})[_0x8c2e('0x3e')](respondWithResult(_0x1c7fa1,null))['catch'](function(_0x5be9f1){var _0x4a22d1=_0x54bd87['query'][_0x8c2e('0x62')]?0x1f4:_0x5be9f1[_0x8c2e('0x63')]||0x1f4;logger['error'](_0x8c2e('0x64'),_0x8c2e('0x65'),_0x4a22d1,JSON[_0x8c2e('0x66')](_0x5be9f1));delete _0x5be9f1[_0x8c2e('0x21')];if(_0x4a22d1===0x191){_0x4a22d1=0x190;}_0x1c7fa1['status'](_0x4a22d1)[_0x8c2e('0x22')](_0x54bd87['query'][_0x8c2e('0x62')]?{'message':_0x8c2e('0x67'),'statusCode':_0x5be9f1[_0x8c2e('0x63')]}:_0x5be9f1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 6ee5072..0bd64e9 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 _0xfa7e=['../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x26970a,_0xcd175a){var _0xd7483f=function(_0x75b113){while(--_0x75b113){_0x26970a['push'](_0x26970a['shift']());}};_0xd7483f(++_0xcd175a);}(_0xfa7e,0x170));var _0xefa7=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xfa7e[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xefa7('0x0'));var util=require(_0xefa7('0x1'));var logger=require(_0xefa7('0x2'))(_0xefa7('0x3'));var moment=require('moment');var BPromise=require(_0xefa7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefa7('0x5'));var rimraf=require('rimraf');var config=require(_0xefa7('0x6'));var attributes=require(_0xefa7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x541444,_0x4721ee){return _0x541444[_0xefa7('0x8')](_0xefa7('0x9'),attributes,{'tableName':_0xefa7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x134b=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x28db6f,_0xcc30d){var _0x4a541e=function(_0x2b359d){while(--_0x2b359d){_0x28db6f['push'](_0x28db6f['shift']());}};_0x4a541e(++_0xcc30d);}(_0x134b,0x1ee));var _0xb134=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x134b[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xb134('0x0'));var util=require(_0xb134('0x1'));var logger=require('../../config/logger')(_0xb134('0x2'));var moment=require(_0xb134('0x3'));var BPromise=require(_0xb134('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb134('0x5'));var rimraf=require(_0xb134('0x6'));var config=require(_0xb134('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb134('0x8'));module['exports']=function(_0x4661cf,_0x1d5620){return _0x4661cf[_0xb134('0x9')](_0xb134('0xa'),attributes,{'tableName':_0xb134('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 0698b1c..51d3e17 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 _0x4b24=['where','attributes','limit','include','model','map','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','raw','options'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x4b24,0xa3));var _0x44b2=function(_0x2a7093,_0x52f222){_0x2a7093=_0x2a7093-0x0;var _0x31ed7c=_0x4b24[_0x2a7093];return _0x31ed7c;};'use strict';var _=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var moment=require(_0x44b2('0x2'));var BPromise=require(_0x44b2('0x3'));var rs=require(_0x44b2('0x4'));var fs=require('fs');var Redis=require(_0x44b2('0x5'));var db=require(_0x44b2('0x6'))['db'];var utils=require(_0x44b2('0x7'));var logger=require(_0x44b2('0x8'))(_0x44b2('0x9'));var config=require(_0x44b2('0xa'));var jayson=require(_0x44b2('0xb'));var client=jayson[_0x44b2('0xc')][_0x44b2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x596383,_0x3abfcc,_0x441d5f){return new BPromise(function(_0x4b6b26,_0x39083f){return client[_0x44b2('0xe')](_0x596383,_0x441d5f)[_0x44b2('0xf')](function(_0x53bda3){logger[_0x44b2('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x3abfcc,_0x44b2('0x11'));logger[_0x44b2('0x12')](_0x44b2('0x13'),_0x3abfcc,_0x44b2('0x11'),JSON[_0x44b2('0x14')](_0x53bda3));if(_0x53bda3[_0x44b2('0x15')]){if(_0x53bda3[_0x44b2('0x15')][_0x44b2('0x16')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3abfcc,_0x53bda3[_0x44b2('0x15')][_0x44b2('0x17')]);return _0x39083f(_0x53bda3['error'][_0x44b2('0x17')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3abfcc,_0x53bda3[_0x44b2('0x15')][_0x44b2('0x17')]);return _0x4b6b26(_0x53bda3[_0x44b2('0x15')][_0x44b2('0x17')]);}else{logger[_0x44b2('0x10')](_0x44b2('0x18'),_0x3abfcc,'request\x20sent');_0x4b6b26(_0x53bda3[_0x44b2('0x19')][_0x44b2('0x17')]);}})[_0x44b2('0x1a')](function(_0x5637ee){logger[_0x44b2('0x15')](_0x44b2('0x18'),_0x3abfcc,_0x5637ee);_0x39083f(_0x5637ee);});});}exports[_0x44b2('0x1b')]=function(_0x4b04b7){var _0x534dd0=this;return new Promise(function(_0x3b8bd4,_0x12339e){return db[_0x44b2('0x1c')][_0x44b2('0x1d')]({'raw':_0x4b04b7['options']?_0x4b04b7['options'][_0x44b2('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b04b7[_0x44b2('0x1f')]?_0x4b04b7[_0x44b2('0x1f')][_0x44b2('0x20')]||null:null,'attributes':_0x4b04b7['options']?_0x4b04b7[_0x44b2('0x1f')][_0x44b2('0x21')]||null:null,'limit':_0x4b04b7['options']?_0x4b04b7[_0x44b2('0x1f')][_0x44b2('0x22')]||null:null,'include':_0x4b04b7['options']?_0x4b04b7[_0x44b2('0x1f')][_0x44b2('0x23')]?_['map'](_0x4b04b7['options']['include'],function(_0x288530){return{'model':db[_0x288530[_0x44b2('0x24')]],'as':_0x288530['as'],'attributes':_0x288530[_0x44b2('0x21')],'include':_0x288530[_0x44b2('0x23')]?_[_0x44b2('0x25')](_0x288530[_0x44b2('0x23')],function(_0x3bd061){return{'model':db[_0x3bd061[_0x44b2('0x24')]],'as':_0x3bd061['as'],'attributes':_0x3bd061[_0x44b2('0x21')],'include':_0x3bd061[_0x44b2('0x23')]?_[_0x44b2('0x25')](_0x3bd061[_0x44b2('0x23')],function(_0x51f883){return{'model':db[_0x51f883[_0x44b2('0x24')]],'as':_0x51f883['as'],'attributes':_0x51f883[_0x44b2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x44b2('0xf')](function(_0x5bac68){logger[_0x44b2('0x10')](_0x44b2('0x1b'),_0x4b04b7);logger[_0x44b2('0x12')](_0x44b2('0x1b'),_0x4b04b7,JSON[_0x44b2('0x14')](_0x5bac68));_0x3b8bd4(_0x5bac68);})[_0x44b2('0x1a')](function(_0x46cd11){logger[_0x44b2('0x15')](_0x44b2('0x1b'),_0x46cd11['message'],_0x4b04b7);_0x12339e(_0x534dd0[_0x44b2('0x15')](0x1f4,_0x46cd11['message']));});});};exports[_0x44b2('0x26')]=function(_0x1e190b){var _0x37b2ee=this;return new Promise(function(_0x170bce,_0x58a259){return db[_0x44b2('0x1c')]['find']({'raw':_0x1e190b[_0x44b2('0x1f')]?_0x1e190b['options'][_0x44b2('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e190b[_0x44b2('0x1f')]?_0x1e190b[_0x44b2('0x1f')][_0x44b2('0x20')]||null:null,'attributes':_0x1e190b['options']?_0x1e190b[_0x44b2('0x1f')][_0x44b2('0x21')]||null:null,'include':_0x1e190b[_0x44b2('0x1f')]?_0x1e190b[_0x44b2('0x1f')][_0x44b2('0x23')]?_[_0x44b2('0x25')](_0x1e190b[_0x44b2('0x1f')][_0x44b2('0x23')],function(_0xa246ef){return{'model':db[_0xa246ef[_0x44b2('0x24')]],'as':_0xa246ef['as'],'attributes':_0xa246ef[_0x44b2('0x21')],'include':_0xa246ef[_0x44b2('0x23')]?_[_0x44b2('0x25')](_0xa246ef[_0x44b2('0x23')],function(_0x351b9c){return{'model':db[_0x351b9c[_0x44b2('0x24')]],'as':_0x351b9c['as'],'attributes':_0x351b9c['attributes'],'include':_0x351b9c[_0x44b2('0x23')]?_[_0x44b2('0x25')](_0x351b9c['include'],function(_0x68bb8c){return{'model':db[_0x68bb8c['model']],'as':_0x68bb8c['as'],'attributes':_0x68bb8c[_0x44b2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x44b2('0xf')](function(_0x44e418){logger['info'](_0x44b2('0x26'),_0x1e190b);logger[_0x44b2('0x12')](_0x44b2('0x26'),_0x1e190b,JSON['stringify'](_0x44e418));_0x170bce(_0x44e418);})['catch'](function(_0xdfd8fc){logger[_0x44b2('0x15')](_0x44b2('0x26'),_0xdfd8fc[_0x44b2('0x17')],_0x1e190b);_0x58a259(_0x37b2ee[_0x44b2('0x15')](0x1f4,_0xdfd8fc[_0x44b2('0x17')]));});});}; \ No newline at end of file +var _0xf265=['limit','include','model','map','then','GetFreshdeskAccount','ShowFreshdeskAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0xf265,0xda));var _0x5f26=function(_0x1c865d,_0x6e2bb9){_0x1c865d=_0x1c865d-0x0;var _0x1466bc=_0xf265[_0x1c865d];return _0x1466bc;};'use strict';var _=require('lodash');var util=require(_0x5f26('0x0'));var moment=require(_0x5f26('0x1'));var BPromise=require(_0x5f26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f26('0x3'));var db=require(_0x5f26('0x4'))['db'];var utils=require(_0x5f26('0x5'));var logger=require(_0x5f26('0x6'))(_0x5f26('0x7'));var config=require(_0x5f26('0x8'));var jayson=require(_0x5f26('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd46c31,_0x223e02,_0x317bbb){return new BPromise(function(_0x1a4ec4,_0x14b3c3){return client['request'](_0xd46c31,_0x317bbb)['then'](function(_0x5b1691){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x223e02,_0x5f26('0xa'));logger[_0x5f26('0xb')](_0x5f26('0xc'),_0x223e02,_0x5f26('0xa'),JSON[_0x5f26('0xd')](_0x5b1691));if(_0x5b1691[_0x5f26('0xe')]){if(_0x5b1691[_0x5f26('0xe')][_0x5f26('0xf')]===0x1f4){logger[_0x5f26('0xe')](_0x5f26('0x10'),_0x223e02,_0x5b1691['error']['message']);return _0x14b3c3(_0x5b1691[_0x5f26('0xe')][_0x5f26('0x11')]);}logger[_0x5f26('0xe')](_0x5f26('0x10'),_0x223e02,_0x5b1691[_0x5f26('0xe')][_0x5f26('0x11')]);return _0x1a4ec4(_0x5b1691[_0x5f26('0xe')]['message']);}else{logger[_0x5f26('0x12')](_0x5f26('0x10'),_0x223e02,'request\x20sent');_0x1a4ec4(_0x5b1691[_0x5f26('0x13')][_0x5f26('0x11')]);}})[_0x5f26('0x14')](function(_0x210308){logger[_0x5f26('0xe')](_0x5f26('0x10'),_0x223e02,_0x210308);_0x14b3c3(_0x210308);});});}exports['GetFreshdeskAccount']=function(_0x5a0cb9){var _0x2a84d2=this;return new Promise(function(_0x2c892c,_0x379473){return db[_0x5f26('0x15')][_0x5f26('0x16')]({'raw':_0x5a0cb9[_0x5f26('0x17')]?_0x5a0cb9[_0x5f26('0x17')][_0x5f26('0x18')]===undefined?!![]:![]:!![],'where':_0x5a0cb9[_0x5f26('0x17')]?_0x5a0cb9[_0x5f26('0x17')][_0x5f26('0x19')]||null:null,'attributes':_0x5a0cb9['options']?_0x5a0cb9['options'][_0x5f26('0x1a')]||null:null,'limit':_0x5a0cb9[_0x5f26('0x17')]?_0x5a0cb9[_0x5f26('0x17')][_0x5f26('0x1b')]||null:null,'include':_0x5a0cb9['options']?_0x5a0cb9['options'][_0x5f26('0x1c')]?_['map'](_0x5a0cb9[_0x5f26('0x17')][_0x5f26('0x1c')],function(_0x1df7e9){return{'model':db[_0x1df7e9[_0x5f26('0x1d')]],'as':_0x1df7e9['as'],'attributes':_0x1df7e9[_0x5f26('0x1a')],'include':_0x1df7e9[_0x5f26('0x1c')]?_[_0x5f26('0x1e')](_0x1df7e9[_0x5f26('0x1c')],function(_0x45f8ce){return{'model':db[_0x45f8ce[_0x5f26('0x1d')]],'as':_0x45f8ce['as'],'attributes':_0x45f8ce[_0x5f26('0x1a')],'include':_0x45f8ce['include']?_[_0x5f26('0x1e')](_0x45f8ce[_0x5f26('0x1c')],function(_0x58787b){return{'model':db[_0x58787b[_0x5f26('0x1d')]],'as':_0x58787b['as'],'attributes':_0x58787b[_0x5f26('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f26('0x1f')](function(_0x44d308){logger['info'](_0x5f26('0x20'),_0x5a0cb9);logger[_0x5f26('0xb')]('GetFreshdeskAccount',_0x5a0cb9,JSON['stringify'](_0x44d308));_0x2c892c(_0x44d308);})['catch'](function(_0x2b594c){logger[_0x5f26('0xe')]('GetFreshdeskAccount',_0x2b594c[_0x5f26('0x11')],_0x5a0cb9);_0x379473(_0x2a84d2['error'](0x1f4,_0x2b594c[_0x5f26('0x11')]));});});};exports[_0x5f26('0x21')]=function(_0x40b6b6){var _0x408fd4=this;return new Promise(function(_0xbb70fb,_0x2ee6d1){return db[_0x5f26('0x15')][_0x5f26('0x22')]({'raw':_0x40b6b6['options']?_0x40b6b6[_0x5f26('0x17')][_0x5f26('0x18')]===undefined?!![]:![]:!![],'where':_0x40b6b6[_0x5f26('0x17')]?_0x40b6b6[_0x5f26('0x17')][_0x5f26('0x19')]||null:null,'attributes':_0x40b6b6[_0x5f26('0x17')]?_0x40b6b6[_0x5f26('0x17')][_0x5f26('0x1a')]||null:null,'include':_0x40b6b6[_0x5f26('0x17')]?_0x40b6b6[_0x5f26('0x17')][_0x5f26('0x1c')]?_[_0x5f26('0x1e')](_0x40b6b6[_0x5f26('0x17')][_0x5f26('0x1c')],function(_0x1aa38d){return{'model':db[_0x1aa38d[_0x5f26('0x1d')]],'as':_0x1aa38d['as'],'attributes':_0x1aa38d[_0x5f26('0x1a')],'include':_0x1aa38d['include']?_[_0x5f26('0x1e')](_0x1aa38d[_0x5f26('0x1c')],function(_0x527b01){return{'model':db[_0x527b01['model']],'as':_0x527b01['as'],'attributes':_0x527b01[_0x5f26('0x1a')],'include':_0x527b01[_0x5f26('0x1c')]?_[_0x5f26('0x1e')](_0x527b01[_0x5f26('0x1c')],function(_0x20148b){return{'model':db[_0x20148b[_0x5f26('0x1d')]],'as':_0x20148b['as'],'attributes':_0x20148b[_0x5f26('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5812dd){logger[_0x5f26('0x12')](_0x5f26('0x21'),_0x40b6b6);logger[_0x5f26('0xb')](_0x5f26('0x21'),_0x40b6b6,JSON['stringify'](_0x5812dd));_0xbb70fb(_0x5812dd);})[_0x5f26('0x14')](function(_0x2c8681){logger[_0x5f26('0xe')](_0x5f26('0x21'),_0x2c8681['message'],_0x40b6b6);_0x2ee6d1(_0x408fd4[_0x5f26('0xe')](0x1f4,_0x2c8681[_0x5f26('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e9a6aa1..1d01a68 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 _0x7587=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','connect-timeout'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x7587,0x1f3));var _0x7758=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7587[_0xbb091];return _0x467a04;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7758('0x0'));var express=require('express');var router=express[_0x7758('0x1')]();var fs_extra=require(_0x7758('0x2'));var auth=require(_0x7758('0x3'));var interaction=require(_0x7758('0x4'));var config=require(_0x7758('0x5'));var controller=require(_0x7758('0x6'));router[_0x7758('0x7')]('/',auth['isAuthenticated'](),controller[_0x7758('0x8')]);router[_0x7758('0x7')](_0x7758('0x9'),auth['isAuthenticated'](),controller[_0x7758('0xa')]);router['get']('/:id/fields',auth[_0x7758('0xb')](),controller[_0x7758('0xc')]);router[_0x7758('0x7')](_0x7758('0xd'),auth['isAuthenticated'](),controller[_0x7758('0xe')]);router[_0x7758('0x7')](_0x7758('0xf'),auth[_0x7758('0xb')](),controller[_0x7758('0x10')]);router[_0x7758('0x7')](_0x7758('0x11'),auth[_0x7758('0xb')](),controller[_0x7758('0x12')]);router['post']('/',auth[_0x7758('0xb')](),controller[_0x7758('0x13')]);router[_0x7758('0x14')](_0x7758('0x11'),auth[_0x7758('0xb')](),controller[_0x7758('0x15')]);router[_0x7758('0x16')](_0x7758('0x9'),auth['isAuthenticated'](),controller[_0x7758('0x17')]);router[_0x7758('0x18')]('/:id',auth[_0x7758('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98c5=['create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post'];(function(_0x2e449c,_0x259b76){var _0x414611=function(_0x4ff7f1){while(--_0x4ff7f1){_0x2e449c['push'](_0x2e449c['shift']());}};_0x414611(++_0x259b76);}(_0x98c5,0x1bd));var _0x598c=function(_0x5081ca,_0x2b63e0){_0x5081ca=_0x5081ca-0x0;var _0x18c554=_0x98c5[_0x5081ca];return _0x18c554;};'use strict';var multer=require('multer');var util=require(_0x598c('0x0'));var path=require(_0x598c('0x1'));var timeout=require(_0x598c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x598c('0x3'));var interaction=require(_0x598c('0x4'));var config=require(_0x598c('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x598c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x598c('0x6')](_0x598c('0x7'),auth[_0x598c('0x8')](),controller['show']);router[_0x598c('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x598c('0x9')]);router[_0x598c('0x6')]('/:id/subjects',auth[_0x598c('0x8')](),controller['getSubjects']);router[_0x598c('0x6')](_0x598c('0xa'),auth[_0x598c('0x8')](),controller[_0x598c('0xb')]);router['get'](_0x598c('0xc'),auth[_0x598c('0x8')](),controller[_0x598c('0xd')]);router[_0x598c('0xe')]('/',auth[_0x598c('0x8')](),controller[_0x598c('0xf')]);router[_0x598c('0xe')](_0x598c('0xc'),auth[_0x598c('0x8')](),controller['setTags']);router[_0x598c('0x10')](_0x598c('0x7'),auth[_0x598c('0x8')](),controller['update']);router[_0x598c('0x11')](_0x598c('0x7'),auth['isAuthenticated'](),controller[_0x598c('0x12')]);module[_0x598c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 1e711e4..7230d5b 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 _0xf613=['sequelize','STRING'];(function(_0x5b61d0,_0x1e5ec8){var _0x58008f=function(_0x515e78){while(--_0x515e78){_0x5b61d0['push'](_0x5b61d0['shift']());}};_0x58008f(++_0x1e5ec8);}(_0xf613,0x13c));var _0x3f61=function(_0x423797,_0x3d393b){_0x423797=_0x423797-0x0;var _0x57ec0c=_0xf613[_0x423797];return _0x57ec0c;};'use strict';var Sequelize=require(_0x3f61('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f61('0x1')]},'description':{'type':Sequelize[_0x3f61('0x1')]}}; \ No newline at end of file +var _0x18a9=['exports','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x18a9,0xda));var _0x918a=function(_0xaeedf9,_0x2832a5){_0xaeedf9=_0xaeedf9-0x0;var _0x3f1174=_0x18a9[_0xaeedf9];return _0x3f1174;};'use strict';var Sequelize=require(_0x918a('0x0'));module[_0x918a('0x1')]={'name':{'type':Sequelize[_0x918a('0x2')]},'description':{'type':Sequelize[_0x918a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 42132ed..0fd6a94 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 _0x7ccc=['../../config/utils','../../config/license/util','../../mysqldb','status','offset','limit','count','set','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','getFields','findOne','FreshdeskField','filter','getSubjects','hasOwnProperty','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1eea29,_0x4152bc){var _0x2671d2=function(_0x550c91){while(--_0x550c91){_0x1eea29['push'](_0x1eea29['shift']());}};_0x2671d2(++_0x4152bc);}(_0x7ccc,0x95));var _0xc7cc=function(_0x4d30ac,_0x112604){_0x4d30ac=_0x4d30ac-0x0;var _0x279f70=_0x7ccc[_0x4d30ac];return _0x279f70;};'use strict';var emlformat=require(_0xc7cc('0x0'));var rimraf=require(_0xc7cc('0x1'));var zipdir=require(_0xc7cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc7cc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc7cc('0x4'));var util=require(_0xc7cc('0x5'));var path=require(_0xc7cc('0x6'));var sox=require(_0xc7cc('0x7'));var csv=require(_0xc7cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7cc('0x9'));var _=require(_0xc7cc('0xa'));var squel=require(_0xc7cc('0xb'));var crypto=require(_0xc7cc('0xc'));var jsforce=require(_0xc7cc('0xd'));var deskjs=require(_0xc7cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc7cc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc7cc('0x10'));var qs=require(_0xc7cc('0x11'));var as=require(_0xc7cc('0x12'));var hardwareService=require(_0xc7cc('0x13'));var logger=require('../../config/logger')(_0xc7cc('0x14'));var utils=require(_0xc7cc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7cc('0x16'));var db=require(_0xc7cc('0x17'))['db'];function respondWithStatusCode(_0x1d125c,_0x4e4735){_0x4e4735=_0x4e4735||0xcc;return function(_0x56ee1c){if(_0x56ee1c){return _0x1d125c['sendStatus'](_0x4e4735);}return _0x1d125c[_0xc7cc('0x18')](_0x4e4735)['end']();};}function respondWithResult(_0x2e60dc,_0x1dc587){_0x1dc587=_0x1dc587||0xc8;return function(_0x5ec9e2){if(_0x5ec9e2){return _0x2e60dc['status'](_0x1dc587)['json'](_0x5ec9e2);}};}function respondWithFilteredResult(_0x1efcc3,_0x20ca4e){return function(_0x4fa204){if(_0x4fa204){var _0x7dd9db=typeof _0x20ca4e[_0xc7cc('0x19')]==='undefined'&&typeof _0x20ca4e[_0xc7cc('0x1a')]==='undefined';var _0x30ca30=_0x4fa204[_0xc7cc('0x1b')];var _0x42b572=_0x7dd9db?0x0:_0x20ca4e['offset'];var _0x183ece=_0x7dd9db?_0x4fa204[_0xc7cc('0x1b')]:_0x20ca4e[_0xc7cc('0x19')]+_0x20ca4e['limit'];var _0x193dd1;if(_0x183ece>=_0x30ca30){_0x183ece=_0x30ca30;_0x193dd1=0xc8;}else{_0x193dd1=0xce;}_0x1efcc3[_0xc7cc('0x18')](_0x193dd1);return _0x1efcc3[_0xc7cc('0x1c')]('Content-Range',_0x42b572+'-'+_0x183ece+'/'+_0x30ca30)[_0xc7cc('0x1d')](_0x4fa204);}return null;};}function patchUpdates(_0x48e35d){return function(_0x24756c){try{jsonpatch[_0xc7cc('0x1e')](_0x24756c,_0x48e35d,!![]);}catch(_0x3e0bae){return BPromise[_0xc7cc('0x1f')](_0x3e0bae);}return _0x24756c[_0xc7cc('0x20')]();};}function saveUpdates(_0x3b843d,_0x50566a){return function(_0x1c7ede){if(_0x1c7ede){return _0x1c7ede['update'](_0x3b843d)[_0xc7cc('0x21')](function(_0x6a460a){return _0x6a460a;});}return null;};}function removeEntity(_0x5a66cc,_0x175a08){return function(_0x2e5894){if(_0x2e5894){return _0x2e5894[_0xc7cc('0x22')]()['then'](function(){_0x5a66cc[_0xc7cc('0x18')](0xcc)[_0xc7cc('0x23')]();});}};}function handleEntityNotFound(_0x9d5e97,_0x5dceda){return function(_0x41b18a){if(!_0x41b18a){_0x9d5e97[_0xc7cc('0x24')](0x194);}return _0x41b18a;};}function handleError(_0x338996,_0x16bbab){_0x16bbab=_0x16bbab||0x1f4;return function(_0x588800){logger[_0xc7cc('0x25')](_0x588800[_0xc7cc('0x26')]);if(_0x588800[_0xc7cc('0x27')]){delete _0x588800['name'];}_0x338996['status'](_0x16bbab)[_0xc7cc('0x28')](_0x588800);};}exports['index']=function(_0x42ae9b,_0x580c48){var _0x4e6811={},_0x15d021={},_0x594745={'count':0x0,'rows':[]};var _0x468076=_[_0xc7cc('0x29')](db[_0xc7cc('0x2a')][_0xc7cc('0x2b')],function(_0x3aada1){return{'name':_0x3aada1[_0xc7cc('0x2c')],'type':_0x3aada1['type'][_0xc7cc('0x2d')]};});_0x15d021[_0xc7cc('0x2e')]=_['map'](_0x468076,_0xc7cc('0x27'));_0x15d021[_0xc7cc('0x2f')]=_[_0xc7cc('0x30')](_0x42ae9b[_0xc7cc('0x2f')]);_0x15d021[_0xc7cc('0x31')]=_[_0xc7cc('0x32')](_0x15d021[_0xc7cc('0x2e')],_0x15d021['query']);_0x4e6811[_0xc7cc('0x33')]=_[_0xc7cc('0x32')](_0x15d021[_0xc7cc('0x2e')],qs[_0xc7cc('0x34')](_0x42ae9b['query'][_0xc7cc('0x34')]));_0x4e6811[_0xc7cc('0x33')]=_0x4e6811[_0xc7cc('0x33')][_0xc7cc('0x35')]?_0x4e6811[_0xc7cc('0x33')]:_0x15d021[_0xc7cc('0x2e')];if(!_0x42ae9b[_0xc7cc('0x2f')]['hasOwnProperty']('nolimit')){_0x4e6811['limit']=qs[_0xc7cc('0x1a')](_0x42ae9b[_0xc7cc('0x2f')][_0xc7cc('0x1a')]);_0x4e6811[_0xc7cc('0x19')]=qs['offset'](_0x42ae9b[_0xc7cc('0x2f')][_0xc7cc('0x19')]);}_0x4e6811[_0xc7cc('0x36')]=qs[_0xc7cc('0x37')](_0x42ae9b[_0xc7cc('0x2f')][_0xc7cc('0x37')]);_0x4e6811[_0xc7cc('0x38')]=qs[_0xc7cc('0x31')](_[_0xc7cc('0x39')](_0x42ae9b[_0xc7cc('0x2f')],_0x15d021['filters']),_0x468076);if(_0x42ae9b['query']['filter']){_0x4e6811['where']=_['merge'](_0x4e6811[_0xc7cc('0x38')],{'$or':_[_0xc7cc('0x29')](_0x468076,function(_0x2cc0b3){if(_0x2cc0b3[_0xc7cc('0x3a')]!==_0xc7cc('0x3b')){var _0x90f47a={};_0x90f47a[_0x2cc0b3[_0xc7cc('0x27')]]={'$like':'%'+_0x42ae9b[_0xc7cc('0x2f')]['filter']+'%'};return _0x90f47a;}})});}_0x4e6811=_[_0xc7cc('0x3c')]({},_0x4e6811,_0x42ae9b['options']);var _0x4411b6={'where':_0x4e6811[_0xc7cc('0x38')]};return db['FreshdeskConfiguration'][_0xc7cc('0x1b')](_0x4411b6)[_0xc7cc('0x21')](function(_0x348345){_0x594745[_0xc7cc('0x1b')]=_0x348345;if(_0x42ae9b[_0xc7cc('0x2f')][_0xc7cc('0x3d')]){_0x4e6811['include']=[{'all':!![]}];}return db[_0xc7cc('0x2a')][_0xc7cc('0x3e')](_0x4e6811);})['then'](function(_0x25e4a2){_0x594745[_0xc7cc('0x3f')]=_0x25e4a2;return _0x594745;})['then'](respondWithFilteredResult(_0x580c48,_0x4e6811))[_0xc7cc('0x40')](handleError(_0x580c48,null));};exports[_0xc7cc('0x41')]=function(_0x4203ea,_0x470260){var _0x3044ea={'raw':![],'where':{'id':_0x4203ea[_0xc7cc('0x42')]['id']}},_0x5cf0be={};_0x5cf0be[_0xc7cc('0x2e')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x5cf0be[_0xc7cc('0x2f')]=_[_0xc7cc('0x30')](_0x4203ea['query']);_0x5cf0be[_0xc7cc('0x31')]=_[_0xc7cc('0x32')](_0x5cf0be['model'],_0x5cf0be[_0xc7cc('0x2f')]);_0x3044ea[_0xc7cc('0x33')]=_['intersection'](_0x5cf0be['model'],qs[_0xc7cc('0x34')](_0x4203ea[_0xc7cc('0x2f')]['fields']));_0x3044ea[_0xc7cc('0x33')]=_0x3044ea['attributes'][_0xc7cc('0x35')]?_0x3044ea[_0xc7cc('0x33')]:_0x5cf0be[_0xc7cc('0x2e')];if(_0x4203ea[_0xc7cc('0x2f')][_0xc7cc('0x3d')]){_0x3044ea[_0xc7cc('0x43')]=[{'all':!![]}];}_0x3044ea=_['merge']({},_0x3044ea,_0x4203ea[_0xc7cc('0x44')]);return db[_0xc7cc('0x2a')][_0xc7cc('0x45')](_0x3044ea)['then'](handleEntityNotFound(_0x470260,null))['then'](respondWithResult(_0x470260,null))[_0xc7cc('0x40')](handleError(_0x470260,null));};exports[_0xc7cc('0x46')]=function(_0x4f1fc4,_0x5887bd){return db[_0xc7cc('0x2a')][_0xc7cc('0x46')](_0x4f1fc4[_0xc7cc('0x47')],{})[_0xc7cc('0x21')](respondWithResult(_0x5887bd,0xc9))[_0xc7cc('0x40')](handleError(_0x5887bd,null));};exports[_0xc7cc('0x48')]=function(_0x1e2b0a,_0x4e3d7f){if(_0x1e2b0a[_0xc7cc('0x47')]['id']){delete _0x1e2b0a[_0xc7cc('0x47')]['id'];}return db[_0xc7cc('0x2a')][_0xc7cc('0x45')]({'where':{'id':_0x1e2b0a['params']['id']}})['then'](handleEntityNotFound(_0x4e3d7f,null))[_0xc7cc('0x21')](saveUpdates(_0x1e2b0a['body'],null))[_0xc7cc('0x21')](respondWithResult(_0x4e3d7f,null))[_0xc7cc('0x40')](handleError(_0x4e3d7f,null));};exports[_0xc7cc('0x22')]=function(_0x307790,_0x4e9c29){return db[_0xc7cc('0x2a')][_0xc7cc('0x45')]({'where':{'id':_0x307790[_0xc7cc('0x42')]['id']}})[_0xc7cc('0x21')](handleEntityNotFound(_0x4e9c29,null))[_0xc7cc('0x21')](removeEntity(_0x4e9c29,null))[_0xc7cc('0x40')](handleError(_0x4e9c29,null));};exports[_0xc7cc('0x49')]=function(_0x1884db,_0x30bebb,_0x1ea877){var _0x5b9416={};var _0x551e62={};var _0x472189;var _0x1416a6;return db[_0xc7cc('0x2a')][_0xc7cc('0x4a')]({'where':{'id':_0x1884db['params']['id']}})[_0xc7cc('0x21')](handleEntityNotFound(_0x30bebb,null))[_0xc7cc('0x21')](function(_0x448ea9){if(_0x448ea9){_0x472189=_0x448ea9;_0x551e62[_0xc7cc('0x2e')]=_[_0xc7cc('0x30')](db[_0xc7cc('0x4b')][_0xc7cc('0x2b')]);_0x551e62[_0xc7cc('0x2f')]=_[_0xc7cc('0x30')](_0x1884db[_0xc7cc('0x2f')]);_0x551e62[_0xc7cc('0x31')]=_['intersection'](_0x551e62[_0xc7cc('0x2e')],_0x551e62[_0xc7cc('0x2f')]);_0x5b9416[_0xc7cc('0x33')]=_[_0xc7cc('0x32')](_0x551e62['model'],qs[_0xc7cc('0x34')](_0x1884db[_0xc7cc('0x2f')][_0xc7cc('0x34')]));_0x5b9416['attributes']=_0x5b9416[_0xc7cc('0x33')][_0xc7cc('0x35')]?_0x5b9416[_0xc7cc('0x33')]:_0x551e62['model'];_0x5b9416[_0xc7cc('0x36')]=qs[_0xc7cc('0x37')](_0x1884db[_0xc7cc('0x2f')][_0xc7cc('0x37')]);_0x5b9416['where']=qs[_0xc7cc('0x31')](_['pick'](_0x1884db[_0xc7cc('0x2f')],_0x551e62[_0xc7cc('0x31')]));if(_0x1884db['query'][_0xc7cc('0x4c')]){_0x5b9416['where']=_[_0xc7cc('0x3c')](_0x5b9416[_0xc7cc('0x38')],{'$or':_['map'](_0x5b9416[_0xc7cc('0x33')],function(_0x1b3097){var _0x527d53={};_0x527d53[_0x1b3097]={'$like':'%'+_0x1884db[_0xc7cc('0x2f')][_0xc7cc('0x4c')]+'%'};return _0x527d53;})});}_0x5b9416=_['merge']({},_0x5b9416,_0x1884db[_0xc7cc('0x44')]);return _0x472189['getFields'](_0x5b9416);}})[_0xc7cc('0x21')](function(_0x424bec){if(_0x424bec){_0x1416a6=_0x424bec[_0xc7cc('0x35')];if(!_0x1884db[_0xc7cc('0x2f')]['hasOwnProperty']('nolimit')){_0x5b9416[_0xc7cc('0x1a')]=qs[_0xc7cc('0x1a')](_0x1884db[_0xc7cc('0x2f')][_0xc7cc('0x1a')]);_0x5b9416[_0xc7cc('0x19')]=qs['offset'](_0x1884db[_0xc7cc('0x2f')]['offset']);}return _0x472189[_0xc7cc('0x49')](_0x5b9416);}})[_0xc7cc('0x21')](function(_0x129b85){if(_0x129b85){return _0x129b85?{'count':_0x1416a6,'rows':_0x129b85}:null;}})['then'](respondWithResult(_0x30bebb,null))['catch'](handleError(_0x30bebb,null));};exports[_0xc7cc('0x4d')]=function(_0x40ff81,_0x290747,_0x2abad0){var _0x182844={};var _0x4ed064={};var _0x5c33c2;var _0x3ae932;return db[_0xc7cc('0x2a')][_0xc7cc('0x4a')]({'where':{'id':_0x40ff81['params']['id']}})['then'](handleEntityNotFound(_0x290747,null))['then'](function(_0x2c3b84){if(_0x2c3b84){_0x5c33c2=_0x2c3b84;_0x4ed064['model']=_[_0xc7cc('0x30')](db['FreshdeskField']['rawAttributes']);_0x4ed064[_0xc7cc('0x2f')]=_[_0xc7cc('0x30')](_0x40ff81['query']);_0x4ed064[_0xc7cc('0x31')]=_[_0xc7cc('0x32')](_0x4ed064[_0xc7cc('0x2e')],_0x4ed064['query']);_0x182844[_0xc7cc('0x33')]=_[_0xc7cc('0x32')](_0x4ed064['model'],qs[_0xc7cc('0x34')](_0x40ff81[_0xc7cc('0x2f')][_0xc7cc('0x34')]));_0x182844[_0xc7cc('0x33')]=_0x182844[_0xc7cc('0x33')]['length']?_0x182844['attributes']:_0x4ed064['model'];_0x182844['order']=qs[_0xc7cc('0x37')](_0x40ff81['query'][_0xc7cc('0x37')]);_0x182844['where']=qs['filters'](_[_0xc7cc('0x39')](_0x40ff81[_0xc7cc('0x2f')],_0x4ed064[_0xc7cc('0x31')]));if(_0x40ff81['query'][_0xc7cc('0x4c')]){_0x182844[_0xc7cc('0x38')]=_[_0xc7cc('0x3c')](_0x182844[_0xc7cc('0x38')],{'$or':_[_0xc7cc('0x29')](_0x182844[_0xc7cc('0x33')],function(_0x18d632){var _0x337784={};_0x337784[_0x18d632]={'$like':'%'+_0x40ff81[_0xc7cc('0x2f')]['filter']+'%'};return _0x337784;})});}_0x182844=_[_0xc7cc('0x3c')]({},_0x182844,_0x40ff81[_0xc7cc('0x44')]);return _0x5c33c2[_0xc7cc('0x4d')](_0x182844);}})[_0xc7cc('0x21')](function(_0x33bf8f){if(_0x33bf8f){_0x3ae932=_0x33bf8f['length'];if(!_0x40ff81[_0xc7cc('0x2f')][_0xc7cc('0x4e')](_0xc7cc('0x4f'))){_0x182844[_0xc7cc('0x1a')]=qs[_0xc7cc('0x1a')](_0x40ff81['query'][_0xc7cc('0x1a')]);_0x182844[_0xc7cc('0x19')]=qs[_0xc7cc('0x19')](_0x40ff81[_0xc7cc('0x2f')][_0xc7cc('0x19')]);}return _0x5c33c2['getSubjects'](_0x182844);}})[_0xc7cc('0x21')](function(_0x56d98e){if(_0x56d98e){return _0x56d98e?{'count':_0x3ae932,'rows':_0x56d98e}:null;}})[_0xc7cc('0x21')](respondWithResult(_0x290747,null))[_0xc7cc('0x40')](handleError(_0x290747,null));};exports[_0xc7cc('0x50')]=function(_0x5820cb,_0x46553f,_0x17ce1a){var _0x460d41={};var _0x3b0b02={};var _0x51ae41;var _0x319680;return db[_0xc7cc('0x2a')][_0xc7cc('0x4a')]({'where':{'id':_0x5820cb[_0xc7cc('0x42')]['id']}})[_0xc7cc('0x21')](handleEntityNotFound(_0x46553f,null))[_0xc7cc('0x21')](function(_0x38a793){if(_0x38a793){_0x51ae41=_0x38a793;_0x3b0b02[_0xc7cc('0x2e')]=_[_0xc7cc('0x30')](db[_0xc7cc('0x4b')][_0xc7cc('0x2b')]);_0x3b0b02[_0xc7cc('0x2f')]=_[_0xc7cc('0x30')](_0x5820cb[_0xc7cc('0x2f')]);_0x3b0b02['filters']=_[_0xc7cc('0x32')](_0x3b0b02[_0xc7cc('0x2e')],_0x3b0b02['query']);_0x460d41[_0xc7cc('0x33')]=_['intersection'](_0x3b0b02[_0xc7cc('0x2e')],qs['fields'](_0x5820cb[_0xc7cc('0x2f')][_0xc7cc('0x34')]));_0x460d41[_0xc7cc('0x33')]=_0x460d41[_0xc7cc('0x33')]['length']?_0x460d41['attributes']:_0x3b0b02[_0xc7cc('0x2e')];_0x460d41[_0xc7cc('0x36')]=qs[_0xc7cc('0x37')](_0x5820cb[_0xc7cc('0x2f')][_0xc7cc('0x37')]);_0x460d41[_0xc7cc('0x38')]=qs[_0xc7cc('0x31')](_['pick'](_0x5820cb[_0xc7cc('0x2f')],_0x3b0b02[_0xc7cc('0x31')]));if(_0x5820cb['query']['filter']){_0x460d41[_0xc7cc('0x38')]=_['merge'](_0x460d41[_0xc7cc('0x38')],{'$or':_[_0xc7cc('0x29')](_0x460d41[_0xc7cc('0x33')],function(_0x1e9932){var _0x2600aa={};_0x2600aa[_0x1e9932]={'$like':'%'+_0x5820cb[_0xc7cc('0x2f')][_0xc7cc('0x4c')]+'%'};return _0x2600aa;})});}_0x460d41=_[_0xc7cc('0x3c')]({},_0x460d41,_0x5820cb[_0xc7cc('0x44')]);return _0x51ae41[_0xc7cc('0x50')](_0x460d41);}})[_0xc7cc('0x21')](function(_0x420987){if(_0x420987){_0x319680=_0x420987['length'];if(!_0x5820cb[_0xc7cc('0x2f')][_0xc7cc('0x4e')](_0xc7cc('0x4f'))){_0x460d41['limit']=qs[_0xc7cc('0x1a')](_0x5820cb[_0xc7cc('0x2f')][_0xc7cc('0x1a')]);_0x460d41[_0xc7cc('0x19')]=qs['offset'](_0x5820cb[_0xc7cc('0x2f')]['offset']);}return _0x51ae41[_0xc7cc('0x50')](_0x460d41);}})[_0xc7cc('0x21')](function(_0x3f64b2){if(_0x3f64b2){return _0x3f64b2?{'count':_0x319680,'rows':_0x3f64b2}:null;}})[_0xc7cc('0x21')](respondWithResult(_0x46553f,null))[_0xc7cc('0x40')](handleError(_0x46553f,null));};exports[_0xc7cc('0x51')]=function(_0x30a27e,_0x346126,_0xad1fbe){var _0x40e4cc={};var _0x35751e={};var _0x53e3a7;var _0x1ef674;return db[_0xc7cc('0x2a')]['findOne']({'where':{'id':_0x30a27e[_0xc7cc('0x42')]['id']}})[_0xc7cc('0x21')](handleEntityNotFound(_0x346126,null))['then'](function(_0x1c4e17){if(_0x1c4e17){_0x53e3a7=_0x1c4e17;_0x35751e[_0xc7cc('0x2e')]=_[_0xc7cc('0x30')](db[_0xc7cc('0x52')][_0xc7cc('0x2b')]);_0x35751e[_0xc7cc('0x2f')]=_['keys'](_0x30a27e[_0xc7cc('0x2f')]);_0x35751e[_0xc7cc('0x31')]=_['intersection'](_0x35751e[_0xc7cc('0x2e')],_0x35751e['query']);_0x40e4cc[_0xc7cc('0x33')]=_[_0xc7cc('0x32')](_0x35751e['model'],qs[_0xc7cc('0x34')](_0x30a27e[_0xc7cc('0x2f')]['fields']));_0x40e4cc[_0xc7cc('0x33')]=_0x40e4cc[_0xc7cc('0x33')][_0xc7cc('0x35')]?_0x40e4cc[_0xc7cc('0x33')]:_0x35751e[_0xc7cc('0x2e')];_0x40e4cc[_0xc7cc('0x36')]=qs['sort'](_0x30a27e[_0xc7cc('0x2f')][_0xc7cc('0x37')]);_0x40e4cc[_0xc7cc('0x38')]=qs[_0xc7cc('0x31')](_[_0xc7cc('0x39')](_0x30a27e['query'],_0x35751e['filters']));if(_0x30a27e[_0xc7cc('0x2f')]['filter']){_0x40e4cc[_0xc7cc('0x38')]=_['merge'](_0x40e4cc[_0xc7cc('0x38')],{'$or':_[_0xc7cc('0x29')](_0x40e4cc[_0xc7cc('0x33')],function(_0x2f81c5){var _0x1756ae={};_0x1756ae[_0x2f81c5]={'$like':'%'+_0x30a27e['query'][_0xc7cc('0x4c')]+'%'};return _0x1756ae;})});}_0x40e4cc=_['merge']({},_0x40e4cc,_0x30a27e[_0xc7cc('0x44')]);return _0x53e3a7[_0xc7cc('0x51')](_0x40e4cc);}})['then'](function(_0x5b2c23){if(_0x5b2c23){_0x1ef674=_0x5b2c23[_0xc7cc('0x35')];if(!_0x30a27e[_0xc7cc('0x2f')][_0xc7cc('0x4e')](_0xc7cc('0x4f'))){_0x40e4cc[_0xc7cc('0x1a')]=qs[_0xc7cc('0x1a')](_0x30a27e[_0xc7cc('0x2f')][_0xc7cc('0x1a')]);_0x40e4cc[_0xc7cc('0x19')]=qs[_0xc7cc('0x19')](_0x30a27e[_0xc7cc('0x2f')]['offset']);}return _0x53e3a7['getTags'](_0x40e4cc);}})['then'](function(_0x1be44b){if(_0x1be44b){return _0x1be44b?{'count':_0x1ef674,'rows':_0x1be44b}:null;}})[_0xc7cc('0x21')](respondWithResult(_0x346126,null))[_0xc7cc('0x40')](handleError(_0x346126,null));};exports[_0xc7cc('0x53')]=function(_0x39e8b5,_0x90fcfd,_0x421550){if(_0x39e8b5[_0xc7cc('0x47')]['id']){delete _0x39e8b5[_0xc7cc('0x47')]['id'];}return db[_0xc7cc('0x2a')]['findOne']({'where':{'id':_0x39e8b5[_0xc7cc('0x42')]['id']}})[_0xc7cc('0x21')](handleEntityNotFound(_0x90fcfd,null))[_0xc7cc('0x21')](function(_0x5ba57e){if(_0x5ba57e){return _0x5ba57e[_0xc7cc('0x53')](_0x39e8b5['body'][_0xc7cc('0x54')]||[]);}return null;})[_0xc7cc('0x21')](respondWithResult(_0x90fcfd,null))[_0xc7cc('0x40')](handleError(_0x90fcfd,null));}; \ No newline at end of file +var _0x56a9=['map','hasOwnProperty','findOne','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','end','error','stack','name','send','index','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','pick','filter','VIRTUAL','merge','options','where','FreshdeskConfiguration','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','getFields','FreshdeskField','sort'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0x56a9,0xac));var _0x956a=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x56a9[_0x5f42f1];return _0x5534ee;};'use strict';var emlformat=require(_0x956a('0x0'));var rimraf=require(_0x956a('0x1'));var zipdir=require(_0x956a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x956a('0x3'));var Mustache=require(_0x956a('0x4'));var util=require('util');var path=require(_0x956a('0x5'));var sox=require(_0x956a('0x6'));var csv=require(_0x956a('0x7'));var ejs=require(_0x956a('0x8'));var fs=require('fs');var fs_extra=require(_0x956a('0x9'));var _=require('lodash');var squel=require(_0x956a('0xa'));var crypto=require(_0x956a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x956a('0x7'));var querystring=require(_0x956a('0xc'));var Papa=require(_0x956a('0xd'));var Redis=require('ioredis');var authService=require(_0x956a('0xe'));var qs=require(_0x956a('0xf'));var as=require(_0x956a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x956a('0x11'))(_0x956a('0x12'));var utils=require(_0x956a('0x13'));var config=require(_0x956a('0x14'));var licenseUtil=require(_0x956a('0x15'));var db=require(_0x956a('0x16'))['db'];function respondWithStatusCode(_0xa3b138,_0xd24631){_0xd24631=_0xd24631||0xcc;return function(_0x1edf80){if(_0x1edf80){return _0xa3b138[_0x956a('0x17')](_0xd24631);}return _0xa3b138[_0x956a('0x18')](_0xd24631)['end']();};}function respondWithResult(_0x354730,_0x49ea19){_0x49ea19=_0x49ea19||0xc8;return function(_0x1275f8){if(_0x1275f8){return _0x354730[_0x956a('0x18')](_0x49ea19)[_0x956a('0x19')](_0x1275f8);}};}function respondWithFilteredResult(_0x59e474,_0x5b9c1c){return function(_0x3d381a){if(_0x3d381a){var _0x43db80=typeof _0x5b9c1c['offset']===_0x956a('0x1a')&&typeof _0x5b9c1c[_0x956a('0x1b')]===_0x956a('0x1a');var _0x1a30bf=_0x3d381a['count'];var _0x5b61b9=_0x43db80?0x0:_0x5b9c1c[_0x956a('0x1c')];var _0x106746=_0x43db80?_0x3d381a[_0x956a('0x1d')]:_0x5b9c1c[_0x956a('0x1c')]+_0x5b9c1c['limit'];var _0x45e857;if(_0x106746>=_0x1a30bf){_0x106746=_0x1a30bf;_0x45e857=0xc8;}else{_0x45e857=0xce;}_0x59e474['status'](_0x45e857);return _0x59e474[_0x956a('0x1e')](_0x956a('0x1f'),_0x5b61b9+'-'+_0x106746+'/'+_0x1a30bf)[_0x956a('0x19')](_0x3d381a);}return null;};}function patchUpdates(_0x2d63c0){return function(_0x5df70b){try{jsonpatch[_0x956a('0x20')](_0x5df70b,_0x2d63c0,!![]);}catch(_0x4349b0){return BPromise['reject'](_0x4349b0);}return _0x5df70b['save']();};}function saveUpdates(_0x18ecba,_0x2fb3c0){return function(_0x4e7fc6){if(_0x4e7fc6){return _0x4e7fc6[_0x956a('0x21')](_0x18ecba)[_0x956a('0x22')](function(_0x4ce2f8){return _0x4ce2f8;});}return null;};}function removeEntity(_0x162fa6,_0x29a6cf){return function(_0x36a888){if(_0x36a888){return _0x36a888['destroy']()[_0x956a('0x22')](function(){_0x162fa6[_0x956a('0x18')](0xcc)[_0x956a('0x23')]();});}};}function handleEntityNotFound(_0x16e95f,_0x503a42){return function(_0x50f458){if(!_0x50f458){_0x16e95f[_0x956a('0x17')](0x194);}return _0x50f458;};}function handleError(_0x555d68,_0x4bf04d){_0x4bf04d=_0x4bf04d||0x1f4;return function(_0x237ae1){logger[_0x956a('0x24')](_0x237ae1[_0x956a('0x25')]);if(_0x237ae1[_0x956a('0x26')]){delete _0x237ae1[_0x956a('0x26')];}_0x555d68[_0x956a('0x18')](_0x4bf04d)[_0x956a('0x27')](_0x237ae1);};}exports[_0x956a('0x28')]=function(_0x2bcc9f,_0x519324){var _0x2ffa36={},_0x44d7ba={},_0x2ff9a2={'count':0x0,'rows':[]};var _0x64adf2=_['map'](db['FreshdeskConfiguration'][_0x956a('0x29')],function(_0xe3b7c0){return{'name':_0xe3b7c0['fieldName'],'type':_0xe3b7c0[_0x956a('0x2a')]['key']};});_0x44d7ba['model']=_['map'](_0x64adf2,_0x956a('0x26'));_0x44d7ba[_0x956a('0x2b')]=_[_0x956a('0x2c')](_0x2bcc9f[_0x956a('0x2b')]);_0x44d7ba[_0x956a('0x2d')]=_[_0x956a('0x2e')](_0x44d7ba[_0x956a('0x2f')],_0x44d7ba[_0x956a('0x2b')]);_0x2ffa36['attributes']=_[_0x956a('0x2e')](_0x44d7ba[_0x956a('0x2f')],qs['fields'](_0x2bcc9f[_0x956a('0x2b')][_0x956a('0x30')]));_0x2ffa36[_0x956a('0x31')]=_0x2ffa36['attributes'][_0x956a('0x32')]?_0x2ffa36[_0x956a('0x31')]:_0x44d7ba[_0x956a('0x2f')];if(!_0x2bcc9f[_0x956a('0x2b')]['hasOwnProperty'](_0x956a('0x33'))){_0x2ffa36['limit']=qs['limit'](_0x2bcc9f[_0x956a('0x2b')]['limit']);_0x2ffa36[_0x956a('0x1c')]=qs[_0x956a('0x1c')](_0x2bcc9f['query'][_0x956a('0x1c')]);}_0x2ffa36[_0x956a('0x34')]=qs['sort'](_0x2bcc9f[_0x956a('0x2b')]['sort']);_0x2ffa36['where']=qs['filters'](_[_0x956a('0x35')](_0x2bcc9f[_0x956a('0x2b')],_0x44d7ba['filters']),_0x64adf2);if(_0x2bcc9f[_0x956a('0x2b')][_0x956a('0x36')]){_0x2ffa36['where']=_['merge'](_0x2ffa36['where'],{'$or':_['map'](_0x64adf2,function(_0xe25a5c){if(_0xe25a5c[_0x956a('0x2a')]!==_0x956a('0x37')){var _0x5b97a9={};_0x5b97a9[_0xe25a5c[_0x956a('0x26')]]={'$like':'%'+_0x2bcc9f['query'][_0x956a('0x36')]+'%'};return _0x5b97a9;}})});}_0x2ffa36=_[_0x956a('0x38')]({},_0x2ffa36,_0x2bcc9f[_0x956a('0x39')]);var _0x8f2bb4={'where':_0x2ffa36[_0x956a('0x3a')]};return db[_0x956a('0x3b')][_0x956a('0x1d')](_0x8f2bb4)['then'](function(_0x2dbfb2){_0x2ff9a2[_0x956a('0x1d')]=_0x2dbfb2;if(_0x2bcc9f[_0x956a('0x2b')]['includeAll']){_0x2ffa36[_0x956a('0x3c')]=[{'all':!![]}];}return db[_0x956a('0x3b')][_0x956a('0x3d')](_0x2ffa36);})[_0x956a('0x22')](function(_0x5750be){_0x2ff9a2[_0x956a('0x3e')]=_0x5750be;return _0x2ff9a2;})[_0x956a('0x22')](respondWithFilteredResult(_0x519324,_0x2ffa36))[_0x956a('0x3f')](handleError(_0x519324,null));};exports[_0x956a('0x40')]=function(_0x2840b3,_0x2e14c6){var _0x5a4e9d={'raw':![],'where':{'id':_0x2840b3[_0x956a('0x41')]['id']}},_0x270448={};_0x270448[_0x956a('0x2f')]=_[_0x956a('0x2c')](db[_0x956a('0x3b')]['rawAttributes']);_0x270448[_0x956a('0x2b')]=_[_0x956a('0x2c')](_0x2840b3[_0x956a('0x2b')]);_0x270448[_0x956a('0x2d')]=_[_0x956a('0x2e')](_0x270448[_0x956a('0x2f')],_0x270448[_0x956a('0x2b')]);_0x5a4e9d[_0x956a('0x31')]=_[_0x956a('0x2e')](_0x270448[_0x956a('0x2f')],qs[_0x956a('0x30')](_0x2840b3['query'][_0x956a('0x30')]));_0x5a4e9d[_0x956a('0x31')]=_0x5a4e9d['attributes']['length']?_0x5a4e9d[_0x956a('0x31')]:_0x270448[_0x956a('0x2f')];if(_0x2840b3[_0x956a('0x2b')][_0x956a('0x42')]){_0x5a4e9d[_0x956a('0x3c')]=[{'all':!![]}];}_0x5a4e9d=_[_0x956a('0x38')]({},_0x5a4e9d,_0x2840b3[_0x956a('0x39')]);return db['FreshdeskConfiguration'][_0x956a('0x43')](_0x5a4e9d)[_0x956a('0x22')](handleEntityNotFound(_0x2e14c6,null))[_0x956a('0x22')](respondWithResult(_0x2e14c6,null))[_0x956a('0x3f')](handleError(_0x2e14c6,null));};exports[_0x956a('0x44')]=function(_0x2f5b7a,_0xc0ed68){return db['FreshdeskConfiguration'][_0x956a('0x44')](_0x2f5b7a[_0x956a('0x45')],{})[_0x956a('0x22')](respondWithResult(_0xc0ed68,0xc9))[_0x956a('0x3f')](handleError(_0xc0ed68,null));};exports['update']=function(_0x31b518,_0x52f373){if(_0x31b518['body']['id']){delete _0x31b518[_0x956a('0x45')]['id'];}return db[_0x956a('0x3b')][_0x956a('0x43')]({'where':{'id':_0x31b518[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x52f373,null))[_0x956a('0x22')](saveUpdates(_0x31b518[_0x956a('0x45')],null))[_0x956a('0x22')](respondWithResult(_0x52f373,null))['catch'](handleError(_0x52f373,null));};exports[_0x956a('0x46')]=function(_0x43f310,_0x41d8f4){return db[_0x956a('0x3b')][_0x956a('0x43')]({'where':{'id':_0x43f310[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x41d8f4,null))[_0x956a('0x22')](removeEntity(_0x41d8f4,null))['catch'](handleError(_0x41d8f4,null));};exports[_0x956a('0x47')]=function(_0x244c32,_0x52ce62,_0xf638df){var _0x33a680={};var _0x4976c4={};var _0x1d56db;var _0x428b10;return db[_0x956a('0x3b')]['findOne']({'where':{'id':_0x244c32['params']['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x52ce62,null))[_0x956a('0x22')](function(_0x1847e2){if(_0x1847e2){_0x1d56db=_0x1847e2;_0x4976c4[_0x956a('0x2f')]=_[_0x956a('0x2c')](db[_0x956a('0x48')][_0x956a('0x29')]);_0x4976c4[_0x956a('0x2b')]=_[_0x956a('0x2c')](_0x244c32['query']);_0x4976c4['filters']=_[_0x956a('0x2e')](_0x4976c4[_0x956a('0x2f')],_0x4976c4['query']);_0x33a680[_0x956a('0x31')]=_['intersection'](_0x4976c4[_0x956a('0x2f')],qs[_0x956a('0x30')](_0x244c32[_0x956a('0x2b')][_0x956a('0x30')]));_0x33a680['attributes']=_0x33a680[_0x956a('0x31')][_0x956a('0x32')]?_0x33a680[_0x956a('0x31')]:_0x4976c4[_0x956a('0x2f')];_0x33a680['order']=qs[_0x956a('0x49')](_0x244c32['query'][_0x956a('0x49')]);_0x33a680[_0x956a('0x3a')]=qs[_0x956a('0x2d')](_[_0x956a('0x35')](_0x244c32[_0x956a('0x2b')],_0x4976c4[_0x956a('0x2d')]));if(_0x244c32[_0x956a('0x2b')][_0x956a('0x36')]){_0x33a680[_0x956a('0x3a')]=_['merge'](_0x33a680[_0x956a('0x3a')],{'$or':_[_0x956a('0x4a')](_0x33a680[_0x956a('0x31')],function(_0x5daf9e){var _0x58a947={};_0x58a947[_0x5daf9e]={'$like':'%'+_0x244c32[_0x956a('0x2b')][_0x956a('0x36')]+'%'};return _0x58a947;})});}_0x33a680=_[_0x956a('0x38')]({},_0x33a680,_0x244c32[_0x956a('0x39')]);return _0x1d56db['getFields'](_0x33a680);}})['then'](function(_0x43ec44){if(_0x43ec44){_0x428b10=_0x43ec44['length'];if(!_0x244c32[_0x956a('0x2b')][_0x956a('0x4b')](_0x956a('0x33'))){_0x33a680[_0x956a('0x1b')]=qs[_0x956a('0x1b')](_0x244c32[_0x956a('0x2b')][_0x956a('0x1b')]);_0x33a680[_0x956a('0x1c')]=qs[_0x956a('0x1c')](_0x244c32['query'][_0x956a('0x1c')]);}return _0x1d56db[_0x956a('0x47')](_0x33a680);}})[_0x956a('0x22')](function(_0x395f92){if(_0x395f92){return _0x395f92?{'count':_0x428b10,'rows':_0x395f92}:null;}})['then'](respondWithResult(_0x52ce62,null))[_0x956a('0x3f')](handleError(_0x52ce62,null));};exports['getSubjects']=function(_0x1bf2b1,_0xee11d7,_0x19ad99){var _0x224478={};var _0x45f15d={};var _0x5c601d;var _0x330402;return db[_0x956a('0x3b')][_0x956a('0x4c')]({'where':{'id':_0x1bf2b1[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0xee11d7,null))['then'](function(_0x275e99){if(_0x275e99){_0x5c601d=_0x275e99;_0x45f15d[_0x956a('0x2f')]=_[_0x956a('0x2c')](db['FreshdeskField'][_0x956a('0x29')]);_0x45f15d[_0x956a('0x2b')]=_['keys'](_0x1bf2b1['query']);_0x45f15d[_0x956a('0x2d')]=_[_0x956a('0x2e')](_0x45f15d[_0x956a('0x2f')],_0x45f15d[_0x956a('0x2b')]);_0x224478['attributes']=_[_0x956a('0x2e')](_0x45f15d[_0x956a('0x2f')],qs[_0x956a('0x30')](_0x1bf2b1['query']['fields']));_0x224478[_0x956a('0x31')]=_0x224478['attributes'][_0x956a('0x32')]?_0x224478['attributes']:_0x45f15d['model'];_0x224478['order']=qs[_0x956a('0x49')](_0x1bf2b1[_0x956a('0x2b')][_0x956a('0x49')]);_0x224478[_0x956a('0x3a')]=qs[_0x956a('0x2d')](_[_0x956a('0x35')](_0x1bf2b1['query'],_0x45f15d[_0x956a('0x2d')]));if(_0x1bf2b1[_0x956a('0x2b')][_0x956a('0x36')]){_0x224478['where']=_[_0x956a('0x38')](_0x224478[_0x956a('0x3a')],{'$or':_['map'](_0x224478[_0x956a('0x31')],function(_0x4c65e3){var _0x15e37a={};_0x15e37a[_0x4c65e3]={'$like':'%'+_0x1bf2b1['query'][_0x956a('0x36')]+'%'};return _0x15e37a;})});}_0x224478=_[_0x956a('0x38')]({},_0x224478,_0x1bf2b1[_0x956a('0x39')]);return _0x5c601d[_0x956a('0x4d')](_0x224478);}})[_0x956a('0x22')](function(_0x2fd7ac){if(_0x2fd7ac){_0x330402=_0x2fd7ac[_0x956a('0x32')];if(!_0x1bf2b1[_0x956a('0x2b')][_0x956a('0x4b')](_0x956a('0x33'))){_0x224478[_0x956a('0x1b')]=qs['limit'](_0x1bf2b1['query'][_0x956a('0x1b')]);_0x224478[_0x956a('0x1c')]=qs['offset'](_0x1bf2b1[_0x956a('0x2b')][_0x956a('0x1c')]);}return _0x5c601d[_0x956a('0x4d')](_0x224478);}})[_0x956a('0x22')](function(_0x5292e3){if(_0x5292e3){return _0x5292e3?{'count':_0x330402,'rows':_0x5292e3}:null;}})[_0x956a('0x22')](respondWithResult(_0xee11d7,null))['catch'](handleError(_0xee11d7,null));};exports[_0x956a('0x4e')]=function(_0x2d15c6,_0x1486ca,_0x1ff411){var _0x107394={};var _0x1b379d={};var _0x5c9533;var _0x603d7f;return db[_0x956a('0x3b')][_0x956a('0x4c')]({'where':{'id':_0x2d15c6[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x1486ca,null))[_0x956a('0x22')](function(_0x422c2f){if(_0x422c2f){_0x5c9533=_0x422c2f;_0x1b379d[_0x956a('0x2f')]=_[_0x956a('0x2c')](db['FreshdeskField'][_0x956a('0x29')]);_0x1b379d[_0x956a('0x2b')]=_[_0x956a('0x2c')](_0x2d15c6[_0x956a('0x2b')]);_0x1b379d[_0x956a('0x2d')]=_[_0x956a('0x2e')](_0x1b379d['model'],_0x1b379d[_0x956a('0x2b')]);_0x107394['attributes']=_['intersection'](_0x1b379d[_0x956a('0x2f')],qs['fields'](_0x2d15c6[_0x956a('0x2b')][_0x956a('0x30')]));_0x107394['attributes']=_0x107394[_0x956a('0x31')][_0x956a('0x32')]?_0x107394[_0x956a('0x31')]:_0x1b379d[_0x956a('0x2f')];_0x107394[_0x956a('0x34')]=qs[_0x956a('0x49')](_0x2d15c6[_0x956a('0x2b')][_0x956a('0x49')]);_0x107394[_0x956a('0x3a')]=qs[_0x956a('0x2d')](_[_0x956a('0x35')](_0x2d15c6[_0x956a('0x2b')],_0x1b379d[_0x956a('0x2d')]));if(_0x2d15c6[_0x956a('0x2b')][_0x956a('0x36')]){_0x107394[_0x956a('0x3a')]=_[_0x956a('0x38')](_0x107394[_0x956a('0x3a')],{'$or':_[_0x956a('0x4a')](_0x107394[_0x956a('0x31')],function(_0x20391c){var _0x5dca68={};_0x5dca68[_0x20391c]={'$like':'%'+_0x2d15c6['query'][_0x956a('0x36')]+'%'};return _0x5dca68;})});}_0x107394=_[_0x956a('0x38')]({},_0x107394,_0x2d15c6['options']);return _0x5c9533[_0x956a('0x4e')](_0x107394);}})[_0x956a('0x22')](function(_0x5392bf){if(_0x5392bf){_0x603d7f=_0x5392bf[_0x956a('0x32')];if(!_0x2d15c6[_0x956a('0x2b')][_0x956a('0x4b')](_0x956a('0x33'))){_0x107394[_0x956a('0x1b')]=qs[_0x956a('0x1b')](_0x2d15c6[_0x956a('0x2b')][_0x956a('0x1b')]);_0x107394[_0x956a('0x1c')]=qs[_0x956a('0x1c')](_0x2d15c6['query']['offset']);}return _0x5c9533['getDescriptions'](_0x107394);}})[_0x956a('0x22')](function(_0x56e0f8){if(_0x56e0f8){return _0x56e0f8?{'count':_0x603d7f,'rows':_0x56e0f8}:null;}})['then'](respondWithResult(_0x1486ca,null))[_0x956a('0x3f')](handleError(_0x1486ca,null));};exports[_0x956a('0x4f')]=function(_0x9399e5,_0x85fcd3,_0x28576e){var _0x418de3={};var _0x514a2a={};var _0x3d2dfe;var _0x2ffad3;return db[_0x956a('0x3b')][_0x956a('0x4c')]({'where':{'id':_0x9399e5[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x85fcd3,null))[_0x956a('0x22')](function(_0x5befea){if(_0x5befea){_0x3d2dfe=_0x5befea;_0x514a2a[_0x956a('0x2f')]=_[_0x956a('0x2c')](db[_0x956a('0x50')][_0x956a('0x29')]);_0x514a2a[_0x956a('0x2b')]=_[_0x956a('0x2c')](_0x9399e5[_0x956a('0x2b')]);_0x514a2a[_0x956a('0x2d')]=_[_0x956a('0x2e')](_0x514a2a[_0x956a('0x2f')],_0x514a2a['query']);_0x418de3['attributes']=_[_0x956a('0x2e')](_0x514a2a[_0x956a('0x2f')],qs[_0x956a('0x30')](_0x9399e5[_0x956a('0x2b')][_0x956a('0x30')]));_0x418de3[_0x956a('0x31')]=_0x418de3[_0x956a('0x31')][_0x956a('0x32')]?_0x418de3[_0x956a('0x31')]:_0x514a2a[_0x956a('0x2f')];_0x418de3[_0x956a('0x34')]=qs['sort'](_0x9399e5['query'][_0x956a('0x49')]);_0x418de3[_0x956a('0x3a')]=qs[_0x956a('0x2d')](_['pick'](_0x9399e5[_0x956a('0x2b')],_0x514a2a[_0x956a('0x2d')]));if(_0x9399e5[_0x956a('0x2b')]['filter']){_0x418de3[_0x956a('0x3a')]=_[_0x956a('0x38')](_0x418de3[_0x956a('0x3a')],{'$or':_[_0x956a('0x4a')](_0x418de3[_0x956a('0x31')],function(_0x3e82a0){var _0x31b6fe={};_0x31b6fe[_0x3e82a0]={'$like':'%'+_0x9399e5[_0x956a('0x2b')]['filter']+'%'};return _0x31b6fe;})});}_0x418de3=_[_0x956a('0x38')]({},_0x418de3,_0x9399e5[_0x956a('0x39')]);return _0x3d2dfe[_0x956a('0x4f')](_0x418de3);}})[_0x956a('0x22')](function(_0x131a4f){if(_0x131a4f){_0x2ffad3=_0x131a4f[_0x956a('0x32')];if(!_0x9399e5[_0x956a('0x2b')][_0x956a('0x4b')](_0x956a('0x33'))){_0x418de3[_0x956a('0x1b')]=qs[_0x956a('0x1b')](_0x9399e5[_0x956a('0x2b')]['limit']);_0x418de3[_0x956a('0x1c')]=qs[_0x956a('0x1c')](_0x9399e5[_0x956a('0x2b')][_0x956a('0x1c')]);}return _0x3d2dfe['getTags'](_0x418de3);}})[_0x956a('0x22')](function(_0x2c3ead){if(_0x2c3ead){return _0x2c3ead?{'count':_0x2ffad3,'rows':_0x2c3ead}:null;}})[_0x956a('0x22')](respondWithResult(_0x85fcd3,null))['catch'](handleError(_0x85fcd3,null));};exports['setTags']=function(_0x2d266c,_0x4423b5,_0x21af77){if(_0x2d266c[_0x956a('0x45')]['id']){delete _0x2d266c[_0x956a('0x45')]['id'];}return db[_0x956a('0x3b')][_0x956a('0x4c')]({'where':{'id':_0x2d266c[_0x956a('0x41')]['id']}})[_0x956a('0x22')](handleEntityNotFound(_0x4423b5,null))[_0x956a('0x22')](function(_0x4e250f){if(_0x4e250f){return _0x4e250f['setTags'](_0x2d266c[_0x956a('0x45')][_0x956a('0x51')]||[]);}return null;})['then'](respondWithResult(_0x4423b5,null))['catch'](handleError(_0x4423b5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index fef0a45..9c08f52 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 _0x2426=['./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x175c40,_0x46c90f){var _0x2a1797=function(_0x84e93f){while(--_0x84e93f){_0x175c40['push'](_0x175c40['shift']());}};_0x2a1797(++_0x46c90f);}(_0x2426,0xba));var _0x6242=function(_0x4e8fa5,_0x5ca320){_0x4e8fa5=_0x4e8fa5-0x0;var _0x52dc0a=_0x2426[_0x4e8fa5];return _0x52dc0a;};'use strict';var _=require(_0x6242('0x0'));var util=require(_0x6242('0x1'));var logger=require(_0x6242('0x2'))(_0x6242('0x3'));var moment=require(_0x6242('0x4'));var BPromise=require(_0x6242('0x5'));var rp=require(_0x6242('0x6'));var fs=require('fs');var path=require(_0x6242('0x7'));var rimraf=require(_0x6242('0x8'));var config=require(_0x6242('0x9'));var attributes=require(_0x6242('0xa'));module[_0x6242('0xb')]=function(_0x6e190e,_0x4676f6){return _0x6e190e[_0x6242('0xc')]('FreshdeskConfiguration',attributes,{'tableName':_0x6242('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe665=['api','moment','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe665,0x1d2));var _0x5e66=function(_0x18bf14,_0x333cc2){_0x18bf14=_0x18bf14-0x0;var _0x3c4767=_0xe665[_0x18bf14];return _0x3c4767;};'use strict';var _=require(_0x5e66('0x0'));var util=require(_0x5e66('0x1'));var logger=require('../../config/logger')(_0x5e66('0x2'));var moment=require(_0x5e66('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e66('0x4'));var rimraf=require(_0x5e66('0x5'));var config=require(_0x5e66('0x6'));var attributes=require(_0x5e66('0x7'));module[_0x5e66('0x8')]=function(_0x418b9b,_0x3a73bc){return _0x418b9b[_0x5e66('0x9')](_0x5e66('0xa'),attributes,{'tableName':_0x5e66('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 b1dfabe..2305d05 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 _0xf758=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf758,0x7a));var _0x8f75=function(_0x13248d,_0x35184a){_0x13248d=_0x13248d-0x0;var _0x564f27=_0xf758[_0x13248d];return _0x564f27;};'use strict';var _=require(_0x8f75('0x0'));var util=require(_0x8f75('0x1'));var moment=require(_0x8f75('0x2'));var BPromise=require(_0x8f75('0x3'));var rs=require(_0x8f75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f75('0x5'))['db'];var utils=require(_0x8f75('0x6'));var logger=require('../../config/logger')(_0x8f75('0x7'));var config=require(_0x8f75('0x8'));var jayson=require(_0x8f75('0x9'));var client=jayson['client'][_0x8f75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de810,_0xcdc6fa,_0x20bceb){return new BPromise(function(_0x405044,_0x5ceaa9){return client[_0x8f75('0xb')](_0x5de810,_0x20bceb)[_0x8f75('0xc')](function(_0x4be146){logger[_0x8f75('0xd')](_0x8f75('0xe'),_0xcdc6fa,_0x8f75('0xf'));logger['debug'](_0x8f75('0x10'),_0xcdc6fa,_0x8f75('0xf'),JSON[_0x8f75('0x11')](_0x4be146));if(_0x4be146[_0x8f75('0x12')]){if(_0x4be146[_0x8f75('0x12')][_0x8f75('0x13')]===0x1f4){logger['error'](_0x8f75('0xe'),_0xcdc6fa,_0x4be146[_0x8f75('0x12')][_0x8f75('0x14')]);return _0x5ceaa9(_0x4be146[_0x8f75('0x12')]['message']);}logger['error'](_0x8f75('0xe'),_0xcdc6fa,_0x4be146[_0x8f75('0x12')]['message']);return _0x405044(_0x4be146[_0x8f75('0x12')]['message']);}else{logger[_0x8f75('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xcdc6fa,_0x8f75('0xf'));_0x405044(_0x4be146[_0x8f75('0x15')][_0x8f75('0x14')]);}})[_0x8f75('0x16')](function(_0x5c1f56){logger[_0x8f75('0x12')](_0x8f75('0xe'),_0xcdc6fa,_0x5c1f56);_0x5ceaa9(_0x5c1f56);});});} \ No newline at end of file +var _0xbbcd=['../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0xbbcd,0x116));var _0xdbbc=function(_0x540718,_0x52d325){_0x540718=_0x540718-0x0;var _0x4eb661=_0xbbcd[_0x540718];return _0x4eb661;};'use strict';var _=require(_0xdbbc('0x0'));var util=require(_0xdbbc('0x1'));var moment=require('moment');var BPromise=require(_0xdbbc('0x2'));var rs=require(_0xdbbc('0x3'));var fs=require('fs');var Redis=require(_0xdbbc('0x4'));var db=require(_0xdbbc('0x5'))['db'];var utils=require(_0xdbbc('0x6'));var logger=require('../../config/logger')(_0xdbbc('0x7'));var config=require(_0xdbbc('0x8'));var jayson=require(_0xdbbc('0x9'));var client=jayson['client'][_0xdbbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f9d4e,_0x1f4e73,_0x225f57){return new BPromise(function(_0x39f576,_0x263b04){return client[_0xdbbc('0xb')](_0x4f9d4e,_0x225f57)[_0xdbbc('0xc')](function(_0x4b39e5){logger[_0xdbbc('0xd')](_0xdbbc('0xe'),_0x1f4e73,'request\x20sent');logger['debug'](_0xdbbc('0xf'),_0x1f4e73,_0xdbbc('0x10'),JSON[_0xdbbc('0x11')](_0x4b39e5));if(_0x4b39e5['error']){if(_0x4b39e5[_0xdbbc('0x12')][_0xdbbc('0x13')]===0x1f4){logger[_0xdbbc('0x12')](_0xdbbc('0xe'),_0x1f4e73,_0x4b39e5[_0xdbbc('0x12')][_0xdbbc('0x14')]);return _0x263b04(_0x4b39e5['error'][_0xdbbc('0x14')]);}logger['error'](_0xdbbc('0xe'),_0x1f4e73,_0x4b39e5[_0xdbbc('0x12')]['message']);return _0x39f576(_0x4b39e5[_0xdbbc('0x12')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f4e73,_0xdbbc('0x10'));_0x39f576(_0x4b39e5['result'][_0xdbbc('0x14')]);}})[_0xdbbc('0x15')](function(_0xb59169){logger['error'](_0xdbbc('0xe'),_0x1f4e73,_0xb59169);_0x263b04(_0xb59169);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5070571..aea9dfd 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 _0x2325=['show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','/:id'];(function(_0x300030,_0x121ece){var _0x1a1607=function(_0x33926a){while(--_0x33926a){_0x300030['push'](_0x300030['shift']());}};_0x1a1607(++_0x121ece);}(_0x2325,0x1d2));var _0x5232=function(_0x461d1d,_0x50e2ad){_0x461d1d=_0x461d1d-0x0;var _0x1a5384=_0x2325[_0x461d1d];return _0x1a5384;};'use strict';var multer=require(_0x5232('0x0'));var util=require(_0x5232('0x1'));var path=require(_0x5232('0x2'));var timeout=require(_0x5232('0x3'));var express=require(_0x5232('0x4'));var router=express[_0x5232('0x5')]();var fs_extra=require(_0x5232('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5232('0x7'));var config=require(_0x5232('0x8'));var controller=require(_0x5232('0x9'));router['get']('/',auth[_0x5232('0xa')](),controller[_0x5232('0xb')]);router[_0x5232('0xc')](_0x5232('0xd'),auth[_0x5232('0xa')](),controller[_0x5232('0xe')]);router['post']('/',auth[_0x5232('0xa')](),controller[_0x5232('0xf')]);router[_0x5232('0x10')](_0x5232('0xd'),auth[_0x5232('0xa')](),controller[_0x5232('0x11')]);router['delete'](_0x5232('0xd'),auth['isAuthenticated'](),controller[_0x5232('0x12')]);module[_0x5232('0x13')]=router; \ No newline at end of file +var _0x749d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x34c8fe,_0x1dd397){var _0x316ef5=function(_0x26c6a0){while(--_0x26c6a0){_0x34c8fe['push'](_0x34c8fe['shift']());}};_0x316ef5(++_0x1dd397);}(_0x749d,0x1be));var _0xd749=function(_0x57622c,_0x4b22e2){_0x57622c=_0x57622c-0x0;var _0x34f5d6=_0x749d[_0x57622c];return _0x34f5d6;};'use strict';var multer=require(_0xd749('0x0'));var util=require(_0xd749('0x1'));var path=require(_0xd749('0x2'));var timeout=require(_0xd749('0x3'));var express=require(_0xd749('0x4'));var router=express['Router']();var fs_extra=require(_0xd749('0x5'));var auth=require(_0xd749('0x6'));var interaction=require(_0xd749('0x7'));var config=require('../../config/environment');var controller=require(_0xd749('0x8'));router[_0xd749('0x9')]('/',auth[_0xd749('0xa')](),controller[_0xd749('0xb')]);router[_0xd749('0x9')](_0xd749('0xc'),auth[_0xd749('0xa')](),controller['show']);router[_0xd749('0xd')]('/',auth[_0xd749('0xa')](),controller['create']);router[_0xd749('0xe')](_0xd749('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd749('0xf')](_0xd749('0xc'),auth['isAuthenticated'](),controller[_0xd749('0x10')]);module[_0xd749('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0a0d1a8..3d56a20 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 _0x91b0=['ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x91b0,0x1ed));var _0x091b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x91b0[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x091b('0x0'));module[_0x091b('0x1')]={'type':{'type':Sequelize[_0x091b('0x2')]('string','variable',_0x091b('0x3'),_0x091b('0x4'),'picklist'),'defaultValue':_0x091b('0x5')},'content':{'type':Sequelize[_0x091b('0x6')]},'key':{'type':Sequelize[_0x091b('0x6')]},'keyType':{'type':Sequelize[_0x091b('0x2')](_0x091b('0x5'),_0x091b('0x7'),_0x091b('0x3'))},'keyContent':{'type':Sequelize[_0x091b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x091b('0x6')]},'customField':{'type':Sequelize[_0x091b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb2e=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x17c3c9,_0x5d70b5){var _0x2cc030=function(_0xc26884){while(--_0xc26884){_0x17c3c9['push'](_0x17c3c9['shift']());}};_0x2cc030(++_0x5d70b5);}(_0xbb2e,0xd6));var _0xebb2=function(_0x130e38,_0x543ba7){_0x130e38=_0x130e38-0x0;var _0x316b68=_0xbb2e[_0x130e38];return _0x316b68;};'use strict';var Sequelize=require(_0xebb2('0x0'));module['exports']={'type':{'type':Sequelize[_0xebb2('0x1')](_0xebb2('0x2'),_0xebb2('0x3'),_0xebb2('0x4'),_0xebb2('0x5'),'picklist'),'defaultValue':_0xebb2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xebb2('0x6')]},'keyType':{'type':Sequelize[_0xebb2('0x1')](_0xebb2('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xebb2('0x6')]},'idField':{'type':Sequelize[_0xebb2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xebb2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 6c37ade..83d8431 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 _0xe205=['merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','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','set','Content-Range','save','update','then','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x1fb2fe,_0x544a05){var _0x31e4a8=function(_0x117316){while(--_0x117316){_0x1fb2fe['push'](_0x1fb2fe['shift']());}};_0x31e4a8(++_0x544a05);}(_0xe205,0xa7));var _0x5e20=function(_0x1867f5,_0x419bcb){_0x1867f5=_0x1867f5-0x0;var _0x1cb0a4=_0xe205[_0x1867f5];return _0x1cb0a4;};'use strict';var emlformat=require(_0x5e20('0x0'));var rimraf=require(_0x5e20('0x1'));var zipdir=require(_0x5e20('0x2'));var jsonpatch=require(_0x5e20('0x3'));var rp=require(_0x5e20('0x4'));var moment=require(_0x5e20('0x5'));var BPromise=require(_0x5e20('0x6'));var Mustache=require(_0x5e20('0x7'));var util=require(_0x5e20('0x8'));var path=require('path');var sox=require(_0x5e20('0x9'));var csv=require(_0x5e20('0xa'));var ejs=require(_0x5e20('0xb'));var fs=require('fs');var fs_extra=require(_0x5e20('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xa'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=typeof _0x148ada[_0x5e20('0x1d')]===_0x5e20('0x1e')&&typeof _0x148ada[_0x5e20('0x1f')]===_0x5e20('0x1e');var _0x2f194b=_0x294df8[_0x5e20('0x20')];var _0x1cc706=_0x542b3c?0x0:_0x148ada[_0x5e20('0x1d')];var _0x4d3e4a=_0x542b3c?_0x294df8[_0x5e20('0x20')]:_0x148ada[_0x5e20('0x1d')]+_0x148ada['limit'];var _0x295eb3;if(_0x4d3e4a>=_0x2f194b){_0x4d3e4a=_0x2f194b;_0x295eb3=0xc8;}else{_0x295eb3=0xce;}_0x275026[_0x5e20('0x1b')](_0x295eb3);return _0x275026[_0x5e20('0x21')](_0x5e20('0x22'),_0x1cc706+'-'+_0x4d3e4a+'/'+_0x2f194b)['json'](_0x294df8);}return null;};}function patchUpdates(_0x2954fc){return function(_0x50f222){try{jsonpatch['apply'](_0x50f222,_0x2954fc,!![]);}catch(_0x57c7c5){return BPromise['reject'](_0x57c7c5);}return _0x50f222[_0x5e20('0x23')]();};}function saveUpdates(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x24')](_0x5cca90)[_0x5e20('0x25')](function(_0x3ef7fa){return _0x3ef7fa;});}return null;};}function removeEntity(_0x2d4614,_0x4c5732){return function(_0x15705f){if(_0x15705f){return _0x15705f['destroy']()['then'](function(){_0x2d4614[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x2bae08,_0x1b01af){return function(_0xbf7a24){if(!_0xbf7a24){_0x2bae08[_0x5e20('0x19')](0x194);}return _0xbf7a24;};}function handleError(_0x2973b3,_0x5809fd){_0x5809fd=_0x5809fd||0x1f4;return function(_0x3bf4f4){logger[_0x5e20('0x26')](_0x3bf4f4[_0x5e20('0x27')]);if(_0x3bf4f4[_0x5e20('0x28')]){delete _0x3bf4f4['name'];}_0x2973b3[_0x5e20('0x1b')](_0x5809fd)[_0x5e20('0x29')](_0x3bf4f4);};}exports[_0x5e20('0x2a')]=function(_0x222e7a,_0xbed73a){var _0x19709b={},_0x5ec45b={},_0xbc2b0e={'count':0x0,'rows':[]};var _0x34a3d6=_['map'](db[_0x5e20('0x2b')][_0x5e20('0x2c')],function(_0x335f1e){return{'name':_0x335f1e[_0x5e20('0x2d')],'type':_0x335f1e[_0x5e20('0x2e')][_0x5e20('0x2f')]};});_0x5ec45b['model']=_[_0x5e20('0x30')](_0x34a3d6,_0x5e20('0x28'));_0x5ec45b[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0x222e7a[_0x5e20('0x31')]);_0x5ec45b[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x5ec45b[_0x5e20('0x35')],_0x5ec45b[_0x5e20('0x31')]);_0x19709b[_0x5e20('0x36')]=_[_0x5e20('0x34')](_0x5ec45b['model'],qs[_0x5e20('0x37')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x37')]));_0x19709b['attributes']=_0x19709b[_0x5e20('0x36')][_0x5e20('0x38')]?_0x19709b[_0x5e20('0x36')]:_0x5ec45b[_0x5e20('0x35')];if(!_0x222e7a[_0x5e20('0x31')][_0x5e20('0x39')](_0x5e20('0x3a'))){_0x19709b[_0x5e20('0x1f')]=qs[_0x5e20('0x1f')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x1f')]);_0x19709b[_0x5e20('0x1d')]=qs[_0x5e20('0x1d')](_0x222e7a[_0x5e20('0x31')]['offset']);}_0x19709b[_0x5e20('0x3b')]=qs['sort'](_0x222e7a['query'][_0x5e20('0x3c')]);_0x19709b[_0x5e20('0x3d')]=qs['filters'](_[_0x5e20('0x3e')](_0x222e7a[_0x5e20('0x31')],_0x5ec45b['filters']),_0x34a3d6);if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]){_0x19709b[_0x5e20('0x3d')]=_[_0x5e20('0x40')](_0x19709b[_0x5e20('0x3d')],{'$or':_[_0x5e20('0x30')](_0x34a3d6,function(_0x94925e){if(_0x94925e[_0x5e20('0x2e')]!==_0x5e20('0x41')){var _0x20be56={};_0x20be56[_0x94925e[_0x5e20('0x28')]]={'$like':'%'+_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]+'%'};return _0x20be56;}})});}_0x19709b=_[_0x5e20('0x40')]({},_0x19709b,_0x222e7a[_0x5e20('0x42')]);var _0x3d618c={'where':_0x19709b[_0x5e20('0x3d')]};return db[_0x5e20('0x2b')]['count'](_0x3d618c)[_0x5e20('0x25')](function(_0x29215f){_0xbc2b0e[_0x5e20('0x20')]=_0x29215f;if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x43')]){_0x19709b['include']=[{'all':!![]}];}return db[_0x5e20('0x2b')][_0x5e20('0x44')](_0x19709b);})[_0x5e20('0x25')](function(_0x24c05f){_0xbc2b0e[_0x5e20('0x45')]=_0x24c05f;return _0xbc2b0e;})[_0x5e20('0x25')](respondWithFilteredResult(_0xbed73a,_0x19709b))['catch'](handleError(_0xbed73a,null));};exports[_0x5e20('0x46')]=function(_0xc24cce,_0xa52d83){var _0x5a21f0={'raw':!![],'where':{'id':_0xc24cce[_0x5e20('0x47')]['id']}},_0x2b031d={};_0x2b031d[_0x5e20('0x35')]=_[_0x5e20('0x32')](db[_0x5e20('0x2b')][_0x5e20('0x2c')]);_0x2b031d[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0xc24cce['query']);_0x2b031d[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x2b031d[_0x5e20('0x35')],_0x2b031d['query']);_0x5a21f0[_0x5e20('0x36')]=_['intersection'](_0x2b031d[_0x5e20('0x35')],qs[_0x5e20('0x37')](_0xc24cce[_0x5e20('0x31')][_0x5e20('0x37')]));_0x5a21f0[_0x5e20('0x36')]=_0x5a21f0['attributes'][_0x5e20('0x38')]?_0x5a21f0['attributes']:_0x2b031d['model'];if(_0xc24cce[_0x5e20('0x31')][_0x5e20('0x43')]){_0x5a21f0[_0x5e20('0x48')]=[{'all':!![]}];}_0x5a21f0=_[_0x5e20('0x40')]({},_0x5a21f0,_0xc24cce[_0x5e20('0x42')]);return db[_0x5e20('0x2b')][_0x5e20('0x49')](_0x5a21f0)['then'](handleEntityNotFound(_0xa52d83,null))['then'](respondWithResult(_0xa52d83,null))[_0x5e20('0x4a')](handleError(_0xa52d83,null));};exports[_0x5e20('0x4b')]=function(_0x5e84bd,_0x22b84e){return db[_0x5e20('0x2b')][_0x5e20('0x4b')](_0x5e84bd[_0x5e20('0x4c')],{})[_0x5e20('0x25')](respondWithResult(_0x22b84e,0xc9))['catch'](handleError(_0x22b84e,null));};exports[_0x5e20('0x24')]=function(_0x245b52,_0x25491e){if(_0x245b52[_0x5e20('0x4c')]['id']){delete _0x245b52[_0x5e20('0x4c')]['id'];}return db[_0x5e20('0x2b')][_0x5e20('0x49')]({'where':{'id':_0x245b52[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x25491e,null))['then'](saveUpdates(_0x245b52['body'],null))[_0x5e20('0x25')](respondWithResult(_0x25491e,null))[_0x5e20('0x4a')](handleError(_0x25491e,null));};exports['destroy']=function(_0x4392ca,_0x4bfea7){return db[_0x5e20('0x2b')]['find']({'where':{'id':_0x4392ca[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bfea7,null))[_0x5e20('0x25')](removeEntity(_0x4bfea7,null))[_0x5e20('0x4a')](handleError(_0x4bfea7,null));}; \ No newline at end of file +var _0x402f=['Content-Range','json','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','FreshdeskField','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','status','limit','undefined','count','offset','set'];(function(_0x41626a,_0xad7be){var _0x2ad368=function(_0x286325){while(--_0x286325){_0x41626a['push'](_0x41626a['shift']());}};_0x2ad368(++_0xad7be);}(_0x402f,0x6f));var _0xf402=function(_0x253811,_0x14e6e1){_0x253811=_0x253811-0x0;var _0x1e813e=_0x402f[_0x253811];return _0x1e813e;};'use strict';var emlformat=require(_0xf402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf402('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf402('0x2'));var BPromise=require(_0xf402('0x3'));var Mustache=require(_0xf402('0x4'));var util=require('util');var path=require(_0xf402('0x5'));var sox=require('sox');var csv=require(_0xf402('0x6'));var ejs=require(_0xf402('0x7'));var fs=require('fs');var fs_extra=require(_0xf402('0x8'));var _=require(_0xf402('0x9'));var squel=require(_0xf402('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf402('0xb'));var toCsv=require(_0xf402('0x6'));var querystring=require(_0xf402('0xc'));var Papa=require(_0xf402('0xd'));var Redis=require(_0xf402('0xe'));var authService=require(_0xf402('0xf'));var qs=require(_0xf402('0x10'));var as=require(_0xf402('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf402('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46758d,_0x4f8073){_0x4f8073=_0x4f8073||0xcc;return function(_0x5c127f){if(_0x5c127f){return _0x46758d['sendStatus'](_0x4f8073);}return _0x46758d[_0xf402('0x13')](_0x4f8073)['end']();};}function respondWithResult(_0x2ff50e,_0xb3deb6){_0xb3deb6=_0xb3deb6||0xc8;return function(_0x1ce72a){if(_0x1ce72a){return _0x2ff50e[_0xf402('0x13')](_0xb3deb6)['json'](_0x1ce72a);}};}function respondWithFilteredResult(_0x16767b,_0x4baaec){return function(_0x3af9e3){if(_0x3af9e3){var _0x5e38d8=typeof _0x4baaec['offset']==='undefined'&&typeof _0x4baaec[_0xf402('0x14')]===_0xf402('0x15');var _0xd406bf=_0x3af9e3[_0xf402('0x16')];var _0x2fbe36=_0x5e38d8?0x0:_0x4baaec[_0xf402('0x17')];var _0x3ed3eb=_0x5e38d8?_0x3af9e3[_0xf402('0x16')]:_0x4baaec[_0xf402('0x17')]+_0x4baaec[_0xf402('0x14')];var _0x5bb928;if(_0x3ed3eb>=_0xd406bf){_0x3ed3eb=_0xd406bf;_0x5bb928=0xc8;}else{_0x5bb928=0xce;}_0x16767b[_0xf402('0x13')](_0x5bb928);return _0x16767b[_0xf402('0x18')](_0xf402('0x19'),_0x2fbe36+'-'+_0x3ed3eb+'/'+_0xd406bf)[_0xf402('0x1a')](_0x3af9e3);}return null;};}function patchUpdates(_0x3d3ed4){return function(_0x30f661){try{jsonpatch[_0xf402('0x1b')](_0x30f661,_0x3d3ed4,!![]);}catch(_0xf52248){return BPromise[_0xf402('0x1c')](_0xf52248);}return _0x30f661['save']();};}function saveUpdates(_0x3cfe38,_0x4ffe46){return function(_0x297a68){if(_0x297a68){return _0x297a68[_0xf402('0x1d')](_0x3cfe38)[_0xf402('0x1e')](function(_0x477709){return _0x477709;});}return null;};}function removeEntity(_0x20dca1,_0x9cbd83){return function(_0x1b8064){if(_0x1b8064){return _0x1b8064[_0xf402('0x1f')]()[_0xf402('0x1e')](function(){_0x20dca1[_0xf402('0x13')](0xcc)[_0xf402('0x20')]();});}};}function handleEntityNotFound(_0xfad629,_0x5ddae3){return function(_0x3285bd){if(!_0x3285bd){_0xfad629[_0xf402('0x21')](0x194);}return _0x3285bd;};}function handleError(_0x28fc75,_0x35543b){_0x35543b=_0x35543b||0x1f4;return function(_0x566a3d){logger['error'](_0x566a3d[_0xf402('0x22')]);if(_0x566a3d[_0xf402('0x23')]){delete _0x566a3d[_0xf402('0x23')];}_0x28fc75[_0xf402('0x13')](_0x35543b)[_0xf402('0x24')](_0x566a3d);};}exports['index']=function(_0x39a38a,_0x47c0fb){var _0x1574e3={},_0xe3dc2f={},_0x45ead3={'count':0x0,'rows':[]};var _0xb28d88=_[_0xf402('0x25')](db['FreshdeskField'][_0xf402('0x26')],function(_0x3720c6){return{'name':_0x3720c6[_0xf402('0x27')],'type':_0x3720c6['type']['key']};});_0xe3dc2f[_0xf402('0x28')]=_[_0xf402('0x25')](_0xb28d88,_0xf402('0x23'));_0xe3dc2f[_0xf402('0x29')]=_[_0xf402('0x2a')](_0x39a38a['query']);_0xe3dc2f[_0xf402('0x2b')]=_[_0xf402('0x2c')](_0xe3dc2f[_0xf402('0x28')],_0xe3dc2f[_0xf402('0x29')]);_0x1574e3[_0xf402('0x2d')]=_[_0xf402('0x2c')](_0xe3dc2f['model'],qs[_0xf402('0x2e')](_0x39a38a[_0xf402('0x29')][_0xf402('0x2e')]));_0x1574e3['attributes']=_0x1574e3['attributes'][_0xf402('0x2f')]?_0x1574e3[_0xf402('0x2d')]:_0xe3dc2f[_0xf402('0x28')];if(!_0x39a38a['query'][_0xf402('0x30')](_0xf402('0x31'))){_0x1574e3[_0xf402('0x14')]=qs[_0xf402('0x14')](_0x39a38a[_0xf402('0x29')][_0xf402('0x14')]);_0x1574e3['offset']=qs[_0xf402('0x17')](_0x39a38a[_0xf402('0x29')][_0xf402('0x17')]);}_0x1574e3[_0xf402('0x32')]=qs[_0xf402('0x33')](_0x39a38a['query'][_0xf402('0x33')]);_0x1574e3[_0xf402('0x34')]=qs[_0xf402('0x2b')](_['pick'](_0x39a38a['query'],_0xe3dc2f[_0xf402('0x2b')]),_0xb28d88);if(_0x39a38a['query'][_0xf402('0x35')]){_0x1574e3[_0xf402('0x34')]=_['merge'](_0x1574e3[_0xf402('0x34')],{'$or':_[_0xf402('0x25')](_0xb28d88,function(_0x2bb0b1){if(_0x2bb0b1[_0xf402('0x36')]!==_0xf402('0x37')){var _0x1f224e={};_0x1f224e[_0x2bb0b1[_0xf402('0x23')]]={'$like':'%'+_0x39a38a[_0xf402('0x29')]['filter']+'%'};return _0x1f224e;}})});}_0x1574e3=_[_0xf402('0x38')]({},_0x1574e3,_0x39a38a[_0xf402('0x39')]);var _0xc36243={'where':_0x1574e3[_0xf402('0x34')]};return db[_0xf402('0x3a')]['count'](_0xc36243)[_0xf402('0x1e')](function(_0x5de8c5){_0x45ead3[_0xf402('0x16')]=_0x5de8c5;if(_0x39a38a[_0xf402('0x29')][_0xf402('0x3b')]){_0x1574e3[_0xf402('0x3c')]=[{'all':!![]}];}return db[_0xf402('0x3a')][_0xf402('0x3d')](_0x1574e3);})[_0xf402('0x1e')](function(_0x5d8a26){_0x45ead3['rows']=_0x5d8a26;return _0x45ead3;})[_0xf402('0x1e')](respondWithFilteredResult(_0x47c0fb,_0x1574e3))[_0xf402('0x3e')](handleError(_0x47c0fb,null));};exports[_0xf402('0x3f')]=function(_0x350d71,_0x14fa65){var _0x1fe222={'raw':!![],'where':{'id':_0x350d71[_0xf402('0x40')]['id']}},_0x488587={};_0x488587[_0xf402('0x28')]=_[_0xf402('0x2a')](db[_0xf402('0x3a')]['rawAttributes']);_0x488587[_0xf402('0x29')]=_[_0xf402('0x2a')](_0x350d71[_0xf402('0x29')]);_0x488587[_0xf402('0x2b')]=_[_0xf402('0x2c')](_0x488587[_0xf402('0x28')],_0x488587['query']);_0x1fe222[_0xf402('0x2d')]=_[_0xf402('0x2c')](_0x488587['model'],qs['fields'](_0x350d71[_0xf402('0x29')][_0xf402('0x2e')]));_0x1fe222['attributes']=_0x1fe222[_0xf402('0x2d')][_0xf402('0x2f')]?_0x1fe222[_0xf402('0x2d')]:_0x488587['model'];if(_0x350d71[_0xf402('0x29')]['includeAll']){_0x1fe222[_0xf402('0x3c')]=[{'all':!![]}];}_0x1fe222=_['merge']({},_0x1fe222,_0x350d71[_0xf402('0x39')]);return db[_0xf402('0x3a')]['find'](_0x1fe222)['then'](handleEntityNotFound(_0x14fa65,null))[_0xf402('0x1e')](respondWithResult(_0x14fa65,null))[_0xf402('0x3e')](handleError(_0x14fa65,null));};exports['create']=function(_0x4afd40,_0x213c51){return db[_0xf402('0x3a')][_0xf402('0x41')](_0x4afd40[_0xf402('0x42')],{})[_0xf402('0x1e')](respondWithResult(_0x213c51,0xc9))[_0xf402('0x3e')](handleError(_0x213c51,null));};exports[_0xf402('0x1d')]=function(_0xf91b26,_0x48dc6){if(_0xf91b26['body']['id']){delete _0xf91b26[_0xf402('0x42')]['id'];}return db[_0xf402('0x3a')][_0xf402('0x43')]({'where':{'id':_0xf91b26['params']['id']}})[_0xf402('0x1e')](handleEntityNotFound(_0x48dc6,null))[_0xf402('0x1e')](saveUpdates(_0xf91b26[_0xf402('0x42')],null))[_0xf402('0x1e')](respondWithResult(_0x48dc6,null))['catch'](handleError(_0x48dc6,null));};exports[_0xf402('0x1f')]=function(_0x411fa3,_0x206601){return db[_0xf402('0x3a')][_0xf402('0x43')]({'where':{'id':_0x411fa3[_0xf402('0x40')]['id']}})[_0xf402('0x1e')](handleEntityNotFound(_0x206601,null))[_0xf402('0x1e')](removeEntity(_0x206601,null))[_0xf402('0x3e')](handleError(_0x206601,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c8c56f7..5e6b03c 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 _0x19cf=['exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x19cf,0x124));var _0xf19c=function(_0xca25cd,_0x5bf276){_0xca25cd=_0xca25cd-0x0;var _0x58b91f=_0x19cf[_0xca25cd];return _0x58b91f;};'use strict';var _=require(_0xf19c('0x0'));var util=require('util');var logger=require(_0xf19c('0x1'))(_0xf19c('0x2'));var moment=require(_0xf19c('0x3'));var BPromise=require(_0xf19c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf19c('0x5'));var rimraf=require('rimraf');var config=require(_0xf19c('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0xf19c('0x7')]=function(_0x550c9e,_0xd508e9){return _0x550c9e[_0xf19c('0x8')](_0xf19c('0x9'),attributes,{'tableName':_0xf19c('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xf19c('0xb'),_0xf19c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05d9=['freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x163ea6,_0x572369){var _0x46342e=function(_0x109190){while(--_0x109190){_0x163ea6['push'](_0x163ea6['shift']());}};_0x46342e(++_0x572369);}(_0x05d9,0x1b3));var _0x905d=function(_0x321e84,_0x3ed015){_0x321e84=_0x321e84-0x0;var _0x5a3dd8=_0x05d9[_0x321e84];return _0x5a3dd8;};'use strict';var _=require(_0x905d('0x0'));var util=require(_0x905d('0x1'));var logger=require(_0x905d('0x2'))(_0x905d('0x3'));var moment=require(_0x905d('0x4'));var BPromise=require(_0x905d('0x5'));var rp=require(_0x905d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x905d('0x7'));var config=require('../../config/environment');var attributes=require(_0x905d('0x8'));module[_0x905d('0x9')]=function(_0x5ac361,_0x37159e){return _0x5ac361[_0x905d('0xa')](_0x905d('0xb'),attributes,{'tableName':_0x905d('0xc'),'paranoid':![],'indexes':[{'name':_0x905d('0xd'),'fields':[_0x905d('0xe'),_0x905d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c2e38b6..6289987 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 _0x178f=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x16f6ea,_0x4b65ea){var _0x299a81=function(_0x520659){while(--_0x520659){_0x16f6ea['push'](_0x16f6ea['shift']());}};_0x299a81(++_0x4b65ea);}(_0x178f,0x143));var _0xf178=function(_0x5dfe50,_0x9e7e47){_0x5dfe50=_0x5dfe50-0x0;var _0x2b2b33=_0x178f[_0x5dfe50];return _0x2b2b33;};'use strict';var _=require('lodash');var util=require(_0xf178('0x0'));var moment=require(_0xf178('0x1'));var BPromise=require(_0xf178('0x2'));var rs=require(_0xf178('0x3'));var fs=require('fs');var Redis=require(_0xf178('0x4'));var db=require(_0xf178('0x5'))['db'];var utils=require(_0xf178('0x6'));var logger=require(_0xf178('0x7'))(_0xf178('0x8'));var config=require(_0xf178('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf178('0xa')][_0xf178('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f891b,_0x4640f3,_0x433d24){return new BPromise(function(_0x285757,_0x687d17){return client[_0xf178('0xc')](_0x1f891b,_0x433d24)['then'](function(_0x213ff6){logger[_0xf178('0xd')](_0xf178('0xe'),_0x4640f3,_0xf178('0xf'));logger[_0xf178('0x10')](_0xf178('0x11'),_0x4640f3,'request\x20sent',JSON['stringify'](_0x213ff6));if(_0x213ff6[_0xf178('0x12')]){if(_0x213ff6[_0xf178('0x12')][_0xf178('0x13')]===0x1f4){logger[_0xf178('0x12')](_0xf178('0xe'),_0x4640f3,_0x213ff6[_0xf178('0x12')]['message']);return _0x687d17(_0x213ff6['error'][_0xf178('0x14')]);}logger[_0xf178('0x12')](_0xf178('0xe'),_0x4640f3,_0x213ff6[_0xf178('0x12')][_0xf178('0x14')]);return _0x285757(_0x213ff6[_0xf178('0x12')][_0xf178('0x14')]);}else{logger[_0xf178('0xd')](_0xf178('0xe'),_0x4640f3,'request\x20sent');_0x285757(_0x213ff6[_0xf178('0x15')]['message']);}})[_0xf178('0x16')](function(_0x170c97){logger[_0xf178('0x12')](_0xf178('0xe'),_0x4640f3,_0x170c97);_0x687d17(_0x170c97);});});} \ No newline at end of file +var _0xa5b3=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x57cf48,_0x5443dd){var _0x1adc31=function(_0xaacd21){while(--_0xaacd21){_0x57cf48['push'](_0x57cf48['shift']());}};_0x1adc31(++_0x5443dd);}(_0xa5b3,0x1bd));var _0x3a5b=function(_0xdab6d8,_0x1a4b65){_0xdab6d8=_0xdab6d8-0x0;var _0x251921=_0xa5b3[_0xdab6d8];return _0x251921;};'use strict';var _=require(_0x3a5b('0x0'));var util=require('util');var moment=require(_0x3a5b('0x1'));var BPromise=require(_0x3a5b('0x2'));var rs=require(_0x3a5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a5b('0x4'))['db'];var utils=require(_0x3a5b('0x5'));var logger=require(_0x3a5b('0x6'))(_0x3a5b('0x7'));var config=require(_0x3a5b('0x8'));var jayson=require(_0x3a5b('0x9'));var client=jayson[_0x3a5b('0xa')][_0x3a5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x272c8c,_0x4b3660,_0x47dda3){return new BPromise(function(_0x1518ad,_0x45bb5b){return client[_0x3a5b('0xc')](_0x272c8c,_0x47dda3)[_0x3a5b('0xd')](function(_0x32e106){logger[_0x3a5b('0xe')](_0x3a5b('0xf'),_0x4b3660,'request\x20sent');logger[_0x3a5b('0x10')](_0x3a5b('0x11'),_0x4b3660,_0x3a5b('0x12'),JSON[_0x3a5b('0x13')](_0x32e106));if(_0x32e106['error']){if(_0x32e106[_0x3a5b('0x14')]['code']===0x1f4){logger[_0x3a5b('0x14')](_0x3a5b('0xf'),_0x4b3660,_0x32e106[_0x3a5b('0x14')][_0x3a5b('0x15')]);return _0x45bb5b(_0x32e106[_0x3a5b('0x14')][_0x3a5b('0x15')]);}logger[_0x3a5b('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x4b3660,_0x32e106[_0x3a5b('0x14')][_0x3a5b('0x15')]);return _0x1518ad(_0x32e106[_0x3a5b('0x14')][_0x3a5b('0x15')]);}else{logger[_0x3a5b('0xe')](_0x3a5b('0xf'),_0x4b3660,_0x3a5b('0x12'));_0x1518ad(_0x32e106[_0x3a5b('0x16')][_0x3a5b('0x15')]);}})[_0x3a5b('0x17')](function(_0x4357a9){logger[_0x3a5b('0x14')](_0x3a5b('0xf'),_0x4b3660,_0x4357a9);_0x45bb5b(_0x4357a9);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 3b5f9ca..e965f59 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 _0xb9a7=['addConfiguration','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create'];(function(_0x228c13,_0x527e14){var _0x29ed27=function(_0xd5136d){while(--_0xd5136d){_0x228c13['push'](_0x228c13['shift']());}};_0x29ed27(++_0x527e14);}(_0xb9a7,0x112));var _0x7b9a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xb9a7[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x7b9a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7b9a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7b9a('0x2'));var interaction=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var controller=require(_0x7b9a('0x5'));router[_0x7b9a('0x6')]('/',auth[_0x7b9a('0x7')](),controller[_0x7b9a('0x8')]);router[_0x7b9a('0x6')](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['show']);router[_0x7b9a('0x6')](_0x7b9a('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7b9a('0xb'),auth[_0x7b9a('0x7')](),controller['getFields']);router[_0x7b9a('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b9a('0xd')]);router['post'](_0x7b9a('0xa'),auth[_0x7b9a('0x7')](),controller[_0x7b9a('0xe')]);router['put'](_0x7b9a('0x9'),auth[_0x7b9a('0x7')](),controller['update']);router[_0x7b9a('0xf')](_0x7b9a('0x9'),auth['isAuthenticated'](),controller[_0x7b9a('0x10')]);module[_0x7b9a('0x11')]=router; \ No newline at end of file +var _0x2547=['addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x6d794a,_0x16206a){var _0x3ba75a=function(_0x41f810){while(--_0x41f810){_0x6d794a['push'](_0x6d794a['shift']());}};_0x3ba75a(++_0x16206a);}(_0x2547,0x1cd));var _0x7254=function(_0x193af7,_0x53702a){_0x193af7=_0x193af7-0x0;var _0x46ff68=_0x2547[_0x193af7];return _0x46ff68;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0x12')]);router['post'](_0x7254('0xe'),auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['put'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x15')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x16')]);module[_0x7254('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6b75420..9e613e8 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 _0x4888=['exports','STRING','username'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4888,0x198));var _0x8488=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x4888[_0x1fa381];return _0x47eefe;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x7b84,0x17c));var _0x47b8=function(_0x49401e,_0x36a2bf){_0x49401e=_0x49401e-0x0;var _0x2ef299=_0x7b84[_0x49401e];return _0x2ef299;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 0a3ad64..97caeeb 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 _0x20d9=['api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x20d9,0x123));var _0x920d=function(_0x3a1796,_0x3a6cf9){_0x3a1796=_0x3a1796-0x0;var _0x483be5=_0x20d9[_0x3a1796];return _0x483be5;};'use strict';var emlformat=require(_0x920d('0x0'));var rimraf=require(_0x920d('0x1'));var zipdir=require(_0x920d('0x2'));var jsonpatch=require(_0x920d('0x3'));var rp=require(_0x920d('0x4'));var moment=require(_0x920d('0x5'));var BPromise=require(_0x920d('0x6'));var Mustache=require(_0x920d('0x7'));var util=require(_0x920d('0x8'));var path=require(_0x920d('0x9'));var sox=require(_0x920d('0xa'));var csv=require(_0x920d('0xb'));var ejs=require(_0x920d('0xc'));var fs=require('fs');var fs_extra=require(_0x920d('0xd'));var _=require(_0x920d('0xe'));var squel=require(_0x920d('0xf'));var crypto=require(_0x920d('0x10'));var jsforce=require(_0x920d('0x11'));var deskjs=require(_0x920d('0x12'));var toCsv=require(_0x920d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x920d('0x13'));var qs=require(_0x920d('0x14'));var as=require(_0x920d('0x15'));var hardwareService=require(_0x920d('0x16'));var logger=require(_0x920d('0x17'))(_0x920d('0x18'));var utils=require(_0x920d('0x19'));var config=require(_0x920d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x920d('0x1b'))['db'];var integrations=require(_0x920d('0x1c'));function respondWithStatusCode(_0xdac1a7,_0x25766a){_0x25766a=_0x25766a||0xcc;return function(_0x1a898e){if(_0x1a898e){return _0xdac1a7['sendStatus'](_0x25766a);}return _0xdac1a7['status'](_0x25766a)[_0x920d('0x1d')]();};}function respondWithResult(_0x3d74e8,_0x5850e7){_0x5850e7=_0x5850e7||0xc8;return function(_0x50b5c7){if(_0x50b5c7){return _0x3d74e8[_0x920d('0x1e')](_0x5850e7)[_0x920d('0x1f')](_0x50b5c7);}};}function respondWithFilteredResult(_0x3e6ec9,_0x3f1a44){return function(_0x34d602){if(_0x34d602){var _0x473c2e=typeof _0x3f1a44[_0x920d('0x20')]===_0x920d('0x21')&&typeof _0x3f1a44[_0x920d('0x22')]===_0x920d('0x21');var _0x2ce90f=_0x34d602[_0x920d('0x23')];var _0x29496a=_0x473c2e?0x0:_0x3f1a44['offset'];var _0x1e151e=_0x473c2e?_0x34d602[_0x920d('0x23')]:_0x3f1a44[_0x920d('0x20')]+_0x3f1a44['limit'];var _0x583504;if(_0x1e151e>=_0x2ce90f){_0x1e151e=_0x2ce90f;_0x583504=0xc8;}else{_0x583504=0xce;}_0x3e6ec9['status'](_0x583504);return _0x3e6ec9[_0x920d('0x24')]('Content-Range',_0x29496a+'-'+_0x1e151e+'/'+_0x2ce90f)[_0x920d('0x1f')](_0x34d602);}return null;};}function patchUpdates(_0x37ccf5){return function(_0x19a055){try{jsonpatch[_0x920d('0x25')](_0x19a055,_0x37ccf5,!![]);}catch(_0x4c4133){return BPromise[_0x920d('0x26')](_0x4c4133);}return _0x19a055[_0x920d('0x27')]();};}function saveUpdates(_0x15da0b,_0x2c7343){return function(_0x291592){if(_0x291592){return _0x291592['update'](_0x15da0b)['then'](function(_0x58e74e){return _0x58e74e;});}return null;};}function removeEntity(_0x5911b1,_0x1f09fb){return function(_0x1b7d8e){if(_0x1b7d8e){return _0x1b7d8e[_0x920d('0x28')]()[_0x920d('0x29')](function(){_0x5911b1[_0x920d('0x1e')](0xcc)[_0x920d('0x1d')]();});}};}function handleEntityNotFound(_0x85c916,_0x303c10){return function(_0x3dd341){if(!_0x3dd341){_0x85c916['sendStatus'](0x194);}return _0x3dd341;};}function handleError(_0x347f36,_0x1f83ff){_0x1f83ff=_0x1f83ff||0x1f4;return function(_0x42f6a2){logger[_0x920d('0x2a')](_0x42f6a2[_0x920d('0x2b')]);if(_0x42f6a2['name']){delete _0x42f6a2[_0x920d('0x2c')];}_0x347f36['status'](_0x1f83ff)[_0x920d('0x2d')](_0x42f6a2);};}exports['index']=function(_0x5e0ebe,_0x3cbfad){var _0x101ec3={},_0x37da40={},_0x4dac18={'count':0x0,'rows':[]};var _0x2ddc76=_[_0x920d('0x2e')](db[_0x920d('0x2f')][_0x920d('0x30')],function(_0x39b8e5){return{'name':_0x39b8e5[_0x920d('0x31')],'type':_0x39b8e5[_0x920d('0x32')]['key']};});_0x37da40[_0x920d('0x33')]=_[_0x920d('0x2e')](_0x2ddc76,_0x920d('0x2c'));_0x37da40[_0x920d('0x34')]=_[_0x920d('0x35')](_0x5e0ebe[_0x920d('0x34')]);_0x37da40[_0x920d('0x36')]=_[_0x920d('0x37')](_0x37da40['model'],_0x37da40[_0x920d('0x34')]);_0x101ec3[_0x920d('0x38')]=_[_0x920d('0x37')](_0x37da40['model'],qs[_0x920d('0x39')](_0x5e0ebe[_0x920d('0x34')][_0x920d('0x39')]));_0x101ec3[_0x920d('0x38')]=_0x101ec3[_0x920d('0x38')][_0x920d('0x3a')]?_0x101ec3[_0x920d('0x38')]:_0x37da40['model'];if(!_0x5e0ebe[_0x920d('0x34')][_0x920d('0x3b')](_0x920d('0x3c'))){_0x101ec3[_0x920d('0x22')]=qs['limit'](_0x5e0ebe['query'][_0x920d('0x22')]);_0x101ec3[_0x920d('0x20')]=qs[_0x920d('0x20')](_0x5e0ebe[_0x920d('0x34')][_0x920d('0x20')]);}_0x101ec3[_0x920d('0x3d')]=qs['sort'](_0x5e0ebe[_0x920d('0x34')][_0x920d('0x3e')]);_0x101ec3['where']=qs[_0x920d('0x36')](_[_0x920d('0x3f')](_0x5e0ebe['query'],_0x37da40[_0x920d('0x36')]),_0x2ddc76);if(_0x5e0ebe[_0x920d('0x34')][_0x920d('0x40')]){_0x101ec3[_0x920d('0x41')]=_[_0x920d('0x42')](_0x101ec3['where'],{'$or':_[_0x920d('0x2e')](_0x2ddc76,function(_0x238236){if(_0x238236[_0x920d('0x32')]!==_0x920d('0x43')){var _0x4122d9={};_0x4122d9[_0x238236['name']]={'$like':'%'+_0x5e0ebe[_0x920d('0x34')][_0x920d('0x40')]+'%'};return _0x4122d9;}})});}_0x101ec3=_[_0x920d('0x42')]({},_0x101ec3,_0x5e0ebe[_0x920d('0x44')]);var _0x25b7e7={'where':_0x101ec3['where']};return db[_0x920d('0x2f')]['count'](_0x25b7e7)[_0x920d('0x29')](function(_0x7636fb){_0x4dac18['count']=_0x7636fb;if(_0x5e0ebe['query'][_0x920d('0x45')]){_0x101ec3['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x920d('0x46')](_0x101ec3);})[_0x920d('0x29')](function(_0x2c6dbc){_0x4dac18[_0x920d('0x47')]=_0x2c6dbc;return _0x4dac18;})[_0x920d('0x29')](respondWithFilteredResult(_0x3cbfad,_0x101ec3))[_0x920d('0x48')](handleError(_0x3cbfad,null));};exports[_0x920d('0x49')]=function(_0x1dfdb3,_0x21709f){var _0x2832ab={'raw':![],'where':{'id':_0x1dfdb3[_0x920d('0x4a')]['id']}},_0x12fc36={};_0x12fc36[_0x920d('0x33')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x12fc36[_0x920d('0x34')]=_[_0x920d('0x35')](_0x1dfdb3['query']);_0x12fc36[_0x920d('0x36')]=_[_0x920d('0x37')](_0x12fc36['model'],_0x12fc36['query']);_0x2832ab[_0x920d('0x38')]=_[_0x920d('0x37')](_0x12fc36[_0x920d('0x33')],qs[_0x920d('0x39')](_0x1dfdb3[_0x920d('0x34')][_0x920d('0x39')]));_0x2832ab[_0x920d('0x38')]=_0x2832ab['attributes'][_0x920d('0x3a')]?_0x2832ab[_0x920d('0x38')]:_0x12fc36[_0x920d('0x33')];if(_0x1dfdb3[_0x920d('0x34')][_0x920d('0x45')]){_0x2832ab[_0x920d('0x4b')]=[{'all':!![]}];}_0x2832ab=_[_0x920d('0x42')]({},_0x2832ab,_0x1dfdb3['options']);return db[_0x920d('0x2f')][_0x920d('0x4c')](_0x2832ab)[_0x920d('0x29')](handleEntityNotFound(_0x21709f,null))[_0x920d('0x29')](respondWithResult(_0x21709f,null))[_0x920d('0x48')](handleError(_0x21709f,null));};exports[_0x920d('0x4d')]=function(_0x54f784,_0x7cc3c0){return db[_0x920d('0x2f')][_0x920d('0x4d')](_0x54f784[_0x920d('0x4e')],{})[_0x920d('0x29')](respondWithResult(_0x7cc3c0,0xc9))[_0x920d('0x48')](handleError(_0x7cc3c0,null));};exports['update']=function(_0x1db5c5,_0x52512c){if(_0x1db5c5[_0x920d('0x4e')]['id']){delete _0x1db5c5[_0x920d('0x4e')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x1db5c5[_0x920d('0x4a')]['id']}})[_0x920d('0x29')](handleEntityNotFound(_0x52512c,null))[_0x920d('0x29')](saveUpdates(_0x1db5c5[_0x920d('0x4e')],null))[_0x920d('0x29')](respondWithResult(_0x52512c,null))[_0x920d('0x48')](handleError(_0x52512c,null));};exports[_0x920d('0x28')]=function(_0x418e1b,_0x5e6a7b){return db['FreshsalesAccount'][_0x920d('0x4c')]({'where':{'id':_0x418e1b['params']['id']}})[_0x920d('0x29')](handleEntityNotFound(_0x5e6a7b,null))[_0x920d('0x29')](removeEntity(_0x5e6a7b,null))[_0x920d('0x48')](handleError(_0x5e6a7b,null));};exports[_0x920d('0x4f')]=function(_0x5c1aaf,_0x3f5c5c,_0x439868){var _0x2ac73b={};var _0x3c0065={};var _0x45bb37;var _0x4356ef;return db[_0x920d('0x2f')][_0x920d('0x50')]({'where':{'id':_0x5c1aaf[_0x920d('0x4a')]['id']}})[_0x920d('0x29')](handleEntityNotFound(_0x3f5c5c,null))['then'](function(_0x3860ad){if(_0x3860ad){_0x45bb37=_0x3860ad;_0x3c0065[_0x920d('0x33')]=_['keys'](db['FreshsalesConfiguration'][_0x920d('0x30')]);_0x3c0065['query']=_[_0x920d('0x35')](_0x5c1aaf[_0x920d('0x34')]);_0x3c0065[_0x920d('0x36')]=_['intersection'](_0x3c0065['model'],_0x3c0065[_0x920d('0x34')]);_0x2ac73b[_0x920d('0x38')]=_[_0x920d('0x37')](_0x3c0065[_0x920d('0x33')],qs[_0x920d('0x39')](_0x5c1aaf[_0x920d('0x34')][_0x920d('0x39')]));_0x2ac73b['attributes']=_0x2ac73b[_0x920d('0x38')]['length']?_0x2ac73b[_0x920d('0x38')]:_0x3c0065['model'];_0x2ac73b[_0x920d('0x3d')]=qs[_0x920d('0x3e')](_0x5c1aaf[_0x920d('0x34')][_0x920d('0x3e')]);_0x2ac73b[_0x920d('0x41')]=qs[_0x920d('0x36')](_[_0x920d('0x3f')](_0x5c1aaf[_0x920d('0x34')],_0x3c0065[_0x920d('0x36')]));if(_0x5c1aaf[_0x920d('0x34')][_0x920d('0x40')]){_0x2ac73b[_0x920d('0x41')]=_[_0x920d('0x42')](_0x2ac73b[_0x920d('0x41')],{'$or':_['map'](_0x2ac73b['attributes'],function(_0x2f3277){var _0xa22a4f={};_0xa22a4f[_0x2f3277]={'$like':'%'+_0x5c1aaf[_0x920d('0x34')]['filter']+'%'};return _0xa22a4f;})});}_0x2ac73b=_[_0x920d('0x42')]({},_0x2ac73b,_0x5c1aaf['options']);return _0x45bb37[_0x920d('0x4f')](_0x2ac73b);}})[_0x920d('0x29')](function(_0x32c46d){if(_0x32c46d){_0x4356ef=_0x32c46d['length'];if(!_0x5c1aaf[_0x920d('0x34')][_0x920d('0x3b')](_0x920d('0x3c'))){_0x2ac73b['limit']=qs[_0x920d('0x22')](_0x5c1aaf[_0x920d('0x34')][_0x920d('0x22')]);_0x2ac73b[_0x920d('0x20')]=qs[_0x920d('0x20')](_0x5c1aaf[_0x920d('0x34')][_0x920d('0x20')]);}return _0x45bb37[_0x920d('0x4f')](_0x2ac73b);}})[_0x920d('0x29')](function(_0x43f6bf){if(_0x43f6bf){return _0x43f6bf?{'count':_0x4356ef,'rows':_0x43f6bf}:null;}})['then'](respondWithResult(_0x3f5c5c,null))[_0x920d('0x48')](handleError(_0x3f5c5c,null));};exports[_0x920d('0x51')]=function(_0x2aab7b,_0x5f337a,_0x2b8154){if(_0x2aab7b['body']['id']){delete _0x2aab7b[_0x920d('0x4e')]['id'];}return db[_0x920d('0x2f')][_0x920d('0x50')]({'where':{'id':_0x2aab7b[_0x920d('0x4a')]['id']}})[_0x920d('0x29')](handleEntityNotFound(_0x5f337a,null))[_0x920d('0x29')](function(_0x3eb83d){if(_0x3eb83d){_0x2aab7b[_0x920d('0x4e')][_0x920d('0x52')]=_0x3eb83d['id'];_0x2aab7b[_0x920d('0x4e')][_0x920d('0x53')]=integrations[_0x920d('0x54')](_0x2aab7b['body'][_0x920d('0x55')],_0x2aab7b[_0x920d('0x4e')][_0x920d('0x32')]);_0x2aab7b[_0x920d('0x4e')][_0x920d('0x56')]=integrations[_0x920d('0x57')](_0x2aab7b[_0x920d('0x4e')][_0x920d('0x55')],_0x2aab7b[_0x920d('0x4e')]['type']);return db['FreshsalesConfiguration'][_0x920d('0x4d')](_0x2aab7b[_0x920d('0x4e')],{'include':[{'model':db[_0x920d('0x58')],'as':_0x920d('0x53')},{'model':db['FreshsalesField'],'as':_0x920d('0x56')}]});}return null;})[_0x920d('0x29')](respondWithResult(_0x5f337a,null))[_0x920d('0x48')](handleError(_0x5f337a,null));};exports['getFields']=function(_0x56b573,_0x2946cb,_0x283e3b){var _0xb9a1f3='';var _0x35aecc='';return db['FreshsalesAccount'][_0x920d('0x50')]({'where':{'id':_0x56b573[_0x920d('0x4a')]['id']},'attributes':['id',_0x920d('0x59'),_0x920d('0x5a'),_0x920d('0x5b')]})['then'](handleEntityNotFound(_0x2946cb,null))[_0x920d('0x29')](function(_0x52db13){if(_0x52db13){_0x35aecc=_0x52db13['username'];_0xb9a1f3=_0x52db13['remoteUri'];var _0x52cac9=_0x52db13[_0x920d('0x5a')][_0x920d('0x5c')](-0x1);if(_0x52cac9==='/'){_0xb9a1f3=_0xb9a1f3[_0x920d('0x5d')](0x0,_0xb9a1f3[_0x920d('0x5e')](_0x52cac9));}return rp({'method':'GET','uri':util[_0x920d('0x5f')]('%s%s',_0xb9a1f3,_0x920d('0x60')),'headers':{'Authorization':_0x920d('0x61')+_0x52db13[_0x920d('0x5b')]},'json':!![]});}})[_0x920d('0x29')](function(_0x5c2d89){if(_0x5c2d89){var _0x3cfb6d=_0x5c2d89['users'];var _0xfb5a0e=![];var _0x3b20a6=null;for(_0x3b20a6=0x0;_0x3b20a6<_0x3cfb6d[_0x920d('0x3a')];_0x3b20a6++){if(_0x3cfb6d[_0x3b20a6][_0x920d('0x62')]===_0x35aecc){_0xfb5a0e=!![];}}if(_0xfb5a0e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x920d('0x63')});}}})['then'](respondWithResult(_0x2946cb,null))[_0x920d('0x48')](function(_0x5469d5){var _0xa80d60=_0x56b573[_0x920d('0x34')][_0x920d('0x64')]?0x1f4:_0x5469d5['statusCode']||0x1f4;logger['error'](_0x920d('0x65'),_0x920d('0x66'),_0xa80d60,JSON[_0x920d('0x67')](_0x5469d5));delete _0x5469d5[_0x920d('0x2c')];if(_0xa80d60===0x191){_0xa80d60=0x190;}_0x2946cb[_0x920d('0x1e')](_0xa80d60)[_0x920d('0x2d')](_0x56b573[_0x920d('0x34')][_0x920d('0x64')]?{'message':_0x920d('0x68'),'statusCode':_0x5469d5['statusCode']}:_0x5469d5);});}; \ No newline at end of file +var _0xdf85=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','params','length','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','pick','hasOwnProperty','addConfiguration','channel','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x54d59f,_0x1561e4){var _0x55d260=function(_0x21aeeb){while(--_0x21aeeb){_0x54d59f['push'](_0x54d59f['shift']());}};_0x55d260(++_0x1561e4);}(_0xdf85,0x12c));var _0x5df8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xdf85[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0x5df8('0x0'));var rimraf=require(_0x5df8('0x1'));var zipdir=require(_0x5df8('0x2'));var jsonpatch=require(_0x5df8('0x3'));var rp=require('request-promise');var moment=require(_0x5df8('0x4'));var BPromise=require(_0x5df8('0x5'));var Mustache=require(_0x5df8('0x6'));var util=require(_0x5df8('0x7'));var path=require(_0x5df8('0x8'));var sox=require(_0x5df8('0x9'));var csv=require(_0x5df8('0xa'));var ejs=require(_0x5df8('0xb'));var fs=require('fs');var fs_extra=require(_0x5df8('0xc'));var _=require(_0x5df8('0xd'));var squel=require('squel');var crypto=require(_0x5df8('0xe'));var jsforce=require(_0x5df8('0xf'));var deskjs=require(_0x5df8('0x10'));var toCsv=require(_0x5df8('0xa'));var querystring=require(_0x5df8('0x11'));var Papa=require(_0x5df8('0x12'));var Redis=require(_0x5df8('0x13'));var authService=require(_0x5df8('0x14'));var qs=require(_0x5df8('0x15'));var as=require(_0x5df8('0x16'));var hardwareService=require(_0x5df8('0x17'));var logger=require(_0x5df8('0x18'))(_0x5df8('0x19'));var utils=require(_0x5df8('0x1a'));var config=require(_0x5df8('0x1b'));var licenseUtil=require(_0x5df8('0x1c'));var db=require(_0x5df8('0x1d'))['db'];var integrations=require(_0x5df8('0x1e'));function respondWithStatusCode(_0x2b997b,_0x5c8d54){_0x5c8d54=_0x5c8d54||0xcc;return function(_0x52e06b){if(_0x52e06b){return _0x2b997b['sendStatus'](_0x5c8d54);}return _0x2b997b['status'](_0x5c8d54)['end']();};}function respondWithResult(_0x58af25,_0x445d1b){_0x445d1b=_0x445d1b||0xc8;return function(_0x3b4893){if(_0x3b4893){return _0x58af25[_0x5df8('0x1f')](_0x445d1b)[_0x5df8('0x20')](_0x3b4893);}};}function respondWithFilteredResult(_0x131cc3,_0x551d71){return function(_0x3d7184){if(_0x3d7184){var _0x4ce9a5=typeof _0x551d71[_0x5df8('0x21')]===_0x5df8('0x22')&&typeof _0x551d71[_0x5df8('0x23')]===_0x5df8('0x22');var _0x308ee8=_0x3d7184['count'];var _0x43013b=_0x4ce9a5?0x0:_0x551d71[_0x5df8('0x21')];var _0x147182=_0x4ce9a5?_0x3d7184[_0x5df8('0x24')]:_0x551d71[_0x5df8('0x21')]+_0x551d71[_0x5df8('0x23')];var _0xf9beb8;if(_0x147182>=_0x308ee8){_0x147182=_0x308ee8;_0xf9beb8=0xc8;}else{_0xf9beb8=0xce;}_0x131cc3[_0x5df8('0x1f')](_0xf9beb8);return _0x131cc3['set'](_0x5df8('0x25'),_0x43013b+'-'+_0x147182+'/'+_0x308ee8)['json'](_0x3d7184);}return null;};}function patchUpdates(_0x3468d3){return function(_0x586c31){try{jsonpatch[_0x5df8('0x26')](_0x586c31,_0x3468d3,!![]);}catch(_0x22c387){return BPromise[_0x5df8('0x27')](_0x22c387);}return _0x586c31[_0x5df8('0x28')]();};}function saveUpdates(_0x60a72c,_0x329eae){return function(_0x290a20){if(_0x290a20){return _0x290a20[_0x5df8('0x29')](_0x60a72c)[_0x5df8('0x2a')](function(_0x1eb501){return _0x1eb501;});}return null;};}function removeEntity(_0x227265,_0x471ea5){return function(_0x3d390){if(_0x3d390){return _0x3d390[_0x5df8('0x2b')]()[_0x5df8('0x2a')](function(){_0x227265['status'](0xcc)[_0x5df8('0x2c')]();});}};}function handleEntityNotFound(_0x1dcc73,_0x44f372){return function(_0x1b811e){if(!_0x1b811e){_0x1dcc73[_0x5df8('0x2d')](0x194);}return _0x1b811e;};}function handleError(_0x3ca980,_0x2c3462){_0x2c3462=_0x2c3462||0x1f4;return function(_0x3bfa92){logger[_0x5df8('0x2e')](_0x3bfa92['stack']);if(_0x3bfa92[_0x5df8('0x2f')]){delete _0x3bfa92[_0x5df8('0x2f')];}_0x3ca980['status'](_0x2c3462)[_0x5df8('0x30')](_0x3bfa92);};}exports['index']=function(_0x1c9a9f,_0x275434){var _0x32926d={},_0x159768={},_0x4efab8={'count':0x0,'rows':[]};var _0x483f1c=_[_0x5df8('0x31')](db[_0x5df8('0x32')][_0x5df8('0x33')],function(_0x3f648f){return{'name':_0x3f648f[_0x5df8('0x34')],'type':_0x3f648f['type'][_0x5df8('0x35')]};});_0x159768[_0x5df8('0x36')]=_[_0x5df8('0x31')](_0x483f1c,_0x5df8('0x2f'));_0x159768[_0x5df8('0x37')]=_[_0x5df8('0x38')](_0x1c9a9f[_0x5df8('0x37')]);_0x159768[_0x5df8('0x39')]=_['intersection'](_0x159768[_0x5df8('0x36')],_0x159768[_0x5df8('0x37')]);_0x32926d['attributes']=_[_0x5df8('0x3a')](_0x159768[_0x5df8('0x36')],qs[_0x5df8('0x3b')](_0x1c9a9f['query'][_0x5df8('0x3b')]));_0x32926d['attributes']=_0x32926d['attributes']['length']?_0x32926d[_0x5df8('0x3c')]:_0x159768['model'];if(!_0x1c9a9f[_0x5df8('0x37')]['hasOwnProperty'](_0x5df8('0x3d'))){_0x32926d['limit']=qs['limit'](_0x1c9a9f[_0x5df8('0x37')][_0x5df8('0x23')]);_0x32926d[_0x5df8('0x21')]=qs['offset'](_0x1c9a9f[_0x5df8('0x37')][_0x5df8('0x21')]);}_0x32926d['order']=qs['sort'](_0x1c9a9f['query'][_0x5df8('0x3e')]);_0x32926d[_0x5df8('0x3f')]=qs[_0x5df8('0x39')](_['pick'](_0x1c9a9f[_0x5df8('0x37')],_0x159768[_0x5df8('0x39')]),_0x483f1c);if(_0x1c9a9f[_0x5df8('0x37')][_0x5df8('0x40')]){_0x32926d['where']=_[_0x5df8('0x41')](_0x32926d[_0x5df8('0x3f')],{'$or':_[_0x5df8('0x31')](_0x483f1c,function(_0x5dd4e){if(_0x5dd4e[_0x5df8('0x42')]!=='VIRTUAL'){var _0x3dd015={};_0x3dd015[_0x5dd4e[_0x5df8('0x2f')]]={'$like':'%'+_0x1c9a9f[_0x5df8('0x37')]['filter']+'%'};return _0x3dd015;}})});}_0x32926d=_[_0x5df8('0x41')]({},_0x32926d,_0x1c9a9f[_0x5df8('0x43')]);var _0x1eeebf={'where':_0x32926d[_0x5df8('0x3f')]};return db[_0x5df8('0x32')][_0x5df8('0x24')](_0x1eeebf)['then'](function(_0x1ff71e){_0x4efab8[_0x5df8('0x24')]=_0x1ff71e;if(_0x1c9a9f['query'][_0x5df8('0x44')]){_0x32926d[_0x5df8('0x45')]=[{'all':!![]}];}return db[_0x5df8('0x32')][_0x5df8('0x46')](_0x32926d);})['then'](function(_0x4e3804){_0x4efab8['rows']=_0x4e3804;return _0x4efab8;})[_0x5df8('0x2a')](respondWithFilteredResult(_0x275434,_0x32926d))[_0x5df8('0x47')](handleError(_0x275434,null));};exports['show']=function(_0x48b1d7,_0x3b8bf3){var _0x578a1a={'raw':![],'where':{'id':_0x48b1d7[_0x5df8('0x48')]['id']}},_0x58979c={};_0x58979c['model']=_[_0x5df8('0x38')](db[_0x5df8('0x32')][_0x5df8('0x33')]);_0x58979c['query']=_[_0x5df8('0x38')](_0x48b1d7[_0x5df8('0x37')]);_0x58979c['filters']=_[_0x5df8('0x3a')](_0x58979c['model'],_0x58979c[_0x5df8('0x37')]);_0x578a1a[_0x5df8('0x3c')]=_[_0x5df8('0x3a')](_0x58979c['model'],qs[_0x5df8('0x3b')](_0x48b1d7[_0x5df8('0x37')][_0x5df8('0x3b')]));_0x578a1a['attributes']=_0x578a1a[_0x5df8('0x3c')][_0x5df8('0x49')]?_0x578a1a['attributes']:_0x58979c[_0x5df8('0x36')];if(_0x48b1d7[_0x5df8('0x37')]['includeAll']){_0x578a1a[_0x5df8('0x45')]=[{'all':!![]}];}_0x578a1a=_[_0x5df8('0x41')]({},_0x578a1a,_0x48b1d7[_0x5df8('0x43')]);return db[_0x5df8('0x32')][_0x5df8('0x4a')](_0x578a1a)[_0x5df8('0x2a')](handleEntityNotFound(_0x3b8bf3,null))['then'](respondWithResult(_0x3b8bf3,null))[_0x5df8('0x47')](handleError(_0x3b8bf3,null));};exports[_0x5df8('0x4b')]=function(_0x430012,_0x5b2589){return db[_0x5df8('0x32')]['create'](_0x430012[_0x5df8('0x4c')],{})[_0x5df8('0x2a')](respondWithResult(_0x5b2589,0xc9))[_0x5df8('0x47')](handleError(_0x5b2589,null));};exports[_0x5df8('0x29')]=function(_0x5554bc,_0x5fc6e3){if(_0x5554bc[_0x5df8('0x4c')]['id']){delete _0x5554bc[_0x5df8('0x4c')]['id'];}return db[_0x5df8('0x32')][_0x5df8('0x4a')]({'where':{'id':_0x5554bc[_0x5df8('0x48')]['id']}})[_0x5df8('0x2a')](handleEntityNotFound(_0x5fc6e3,null))[_0x5df8('0x2a')](saveUpdates(_0x5554bc[_0x5df8('0x4c')],null))[_0x5df8('0x2a')](respondWithResult(_0x5fc6e3,null))[_0x5df8('0x47')](handleError(_0x5fc6e3,null));};exports[_0x5df8('0x2b')]=function(_0x57b84e,_0x56b37f){return db[_0x5df8('0x32')]['find']({'where':{'id':_0x57b84e[_0x5df8('0x48')]['id']}})[_0x5df8('0x2a')](handleEntityNotFound(_0x56b37f,null))[_0x5df8('0x2a')](removeEntity(_0x56b37f,null))['catch'](handleError(_0x56b37f,null));};exports[_0x5df8('0x4d')]=function(_0x1aa0af,_0x23fe57,_0x470c67){var _0x55f483={};var _0x3931a1={};var _0x17a027;var _0x4bc798;return db[_0x5df8('0x32')][_0x5df8('0x4e')]({'where':{'id':_0x1aa0af[_0x5df8('0x48')]['id']}})[_0x5df8('0x2a')](handleEntityNotFound(_0x23fe57,null))[_0x5df8('0x2a')](function(_0x8dfa6b){if(_0x8dfa6b){_0x17a027=_0x8dfa6b;_0x3931a1[_0x5df8('0x36')]=_[_0x5df8('0x38')](db[_0x5df8('0x4f')][_0x5df8('0x33')]);_0x3931a1[_0x5df8('0x37')]=_[_0x5df8('0x38')](_0x1aa0af[_0x5df8('0x37')]);_0x3931a1['filters']=_[_0x5df8('0x3a')](_0x3931a1[_0x5df8('0x36')],_0x3931a1[_0x5df8('0x37')]);_0x55f483[_0x5df8('0x3c')]=_[_0x5df8('0x3a')](_0x3931a1['model'],qs['fields'](_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x3b')]));_0x55f483[_0x5df8('0x3c')]=_0x55f483[_0x5df8('0x3c')][_0x5df8('0x49')]?_0x55f483[_0x5df8('0x3c')]:_0x3931a1[_0x5df8('0x36')];_0x55f483[_0x5df8('0x50')]=qs[_0x5df8('0x3e')](_0x1aa0af[_0x5df8('0x37')]['sort']);_0x55f483['where']=qs[_0x5df8('0x39')](_[_0x5df8('0x51')](_0x1aa0af[_0x5df8('0x37')],_0x3931a1['filters']));if(_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x40')]){_0x55f483[_0x5df8('0x3f')]=_[_0x5df8('0x41')](_0x55f483[_0x5df8('0x3f')],{'$or':_['map'](_0x55f483[_0x5df8('0x3c')],function(_0x3389ad){var _0x4cb6a4={};_0x4cb6a4[_0x3389ad]={'$like':'%'+_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x40')]+'%'};return _0x4cb6a4;})});}_0x55f483=_[_0x5df8('0x41')]({},_0x55f483,_0x1aa0af[_0x5df8('0x43')]);return _0x17a027[_0x5df8('0x4d')](_0x55f483);}})[_0x5df8('0x2a')](function(_0x2efa4){if(_0x2efa4){_0x4bc798=_0x2efa4[_0x5df8('0x49')];if(!_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x52')](_0x5df8('0x3d'))){_0x55f483[_0x5df8('0x23')]=qs[_0x5df8('0x23')](_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x23')]);_0x55f483[_0x5df8('0x21')]=qs['offset'](_0x1aa0af[_0x5df8('0x37')][_0x5df8('0x21')]);}return _0x17a027['getConfigurations'](_0x55f483);}})[_0x5df8('0x2a')](function(_0x1162b1){if(_0x1162b1){return _0x1162b1?{'count':_0x4bc798,'rows':_0x1162b1}:null;}})[_0x5df8('0x2a')](respondWithResult(_0x23fe57,null))[_0x5df8('0x47')](handleError(_0x23fe57,null));};exports[_0x5df8('0x53')]=function(_0x198f07,_0x279512,_0x43442e){if(_0x198f07[_0x5df8('0x4c')]['id']){delete _0x198f07[_0x5df8('0x4c')]['id'];}return db['FreshsalesAccount'][_0x5df8('0x4e')]({'where':{'id':_0x198f07[_0x5df8('0x48')]['id']}})[_0x5df8('0x2a')](handleEntityNotFound(_0x279512,null))[_0x5df8('0x2a')](function(_0x2d3521){if(_0x2d3521){_0x198f07['body']['AccountId']=_0x2d3521['id'];_0x198f07['body']['Subjects']=integrations['getSubjects'](_0x198f07[_0x5df8('0x4c')][_0x5df8('0x54')],_0x198f07['body']['type']);_0x198f07['body']['Descriptions']=integrations['getDescriptions'](_0x198f07['body'][_0x5df8('0x54')],_0x198f07[_0x5df8('0x4c')][_0x5df8('0x42')]);return db[_0x5df8('0x4f')][_0x5df8('0x4b')](_0x198f07[_0x5df8('0x4c')],{'include':[{'model':db[_0x5df8('0x55')],'as':_0x5df8('0x56')},{'model':db[_0x5df8('0x55')],'as':_0x5df8('0x57')}]});}return null;})[_0x5df8('0x2a')](respondWithResult(_0x279512,null))['catch'](handleError(_0x279512,null));};exports[_0x5df8('0x58')]=function(_0x640cb3,_0xc9fd68,_0xf7180){var _0x27523d='';var _0x44df64='';return db[_0x5df8('0x32')][_0x5df8('0x4e')]({'where':{'id':_0x640cb3[_0x5df8('0x48')]['id']},'attributes':['id',_0x5df8('0x59'),_0x5df8('0x5a'),'apiKey']})[_0x5df8('0x2a')](handleEntityNotFound(_0xc9fd68,null))[_0x5df8('0x2a')](function(_0x1d66ee){if(_0x1d66ee){_0x44df64=_0x1d66ee[_0x5df8('0x59')];_0x27523d=_0x1d66ee[_0x5df8('0x5a')];var _0x22b2ef=_0x1d66ee[_0x5df8('0x5a')]['slice'](-0x1);if(_0x22b2ef==='/'){_0x27523d=_0x27523d['substring'](0x0,_0x27523d[_0x5df8('0x5b')](_0x22b2ef));}return rp({'method':_0x5df8('0x5c'),'uri':util[_0x5df8('0x5d')](_0x5df8('0x5e'),_0x27523d,_0x5df8('0x5f')),'headers':{'Authorization':_0x5df8('0x60')+_0x1d66ee['apiKey']},'json':!![]});}})[_0x5df8('0x2a')](function(_0x2af285){if(_0x2af285){var _0xaf7b25=_0x2af285[_0x5df8('0x61')];var _0x1b99b7=![];var _0x17a07a=null;for(_0x17a07a=0x0;_0x17a07a<_0xaf7b25[_0x5df8('0x49')];_0x17a07a++){if(_0xaf7b25[_0x17a07a][_0x5df8('0x62')]===_0x44df64){_0x1b99b7=!![];}}if(_0x1b99b7){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x5df8('0x2a')](respondWithResult(_0xc9fd68,null))[_0x5df8('0x47')](function(_0x52cd5f){var _0x4608c5=_0x640cb3['query'][_0x5df8('0x63')]?0x1f4:_0x52cd5f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x5df8('0x58'),_0x4608c5,JSON[_0x5df8('0x64')](_0x52cd5f));delete _0x52cd5f[_0x5df8('0x2f')];if(_0x4608c5===0x191){_0x4608c5=0x190;}_0xc9fd68[_0x5df8('0x1f')](_0x4608c5)[_0x5df8('0x30')](_0x640cb3[_0x5df8('0x37')][_0x5df8('0x63')]?{'message':_0x5df8('0x65'),'statusCode':_0x52cd5f[_0x5df8('0x66')]}:_0x52cd5f);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index aef2332..7356316 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 _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x27876c,_0x215485){var _0x39ac36=function(_0xab3e68){while(--_0xab3e68){_0x27876c['push'](_0x27876c['shift']());}};_0x39ac36(++_0x215485);}(_0x6050,0x196));var _0x0605=function(_0x3c4693,_0x497066){_0x3c4693=_0x3c4693-0x0;var _0x20a765=_0x6050[_0x3c4693];return _0x20a765;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4888=['exports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x5288fb,_0x363926){var _0x4401de=function(_0x5519c6){while(--_0x5519c6){_0x5288fb['push'](_0x5288fb['shift']());}};_0x4401de(++_0x363926);}(_0x4888,0x198));var _0x8488=function(_0x400f2a,_0x52a559){_0x400f2a=_0x400f2a-0x0;var _0x3dd8d1=_0x4888[_0x400f2a];return _0x3dd8d1;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));var integrations=require(_0x8488('0x9'));module[_0x8488('0xa')]=function(_0x326887,_0x19e508){return _0x326887['define']('FreshsalesAccount',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 99a61c2..2101b35 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 _0xe2fe=['find','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowFreshsalesAccount'];(function(_0x5af2fb,_0x3067d2){var _0x507d81=function(_0x1856a5){while(--_0x1856a5){_0x5af2fb['push'](_0x5af2fb['shift']());}};_0x507d81(++_0x3067d2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')]({'raw':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options'][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x17')]||null:null,'attributes':_0x502eb6[_0xee2f('0x15')]?_0x502eb6['options']['attributes']||null:null,'limit':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x18')]||null:null,'include':_0x502eb6[_0xee2f('0x15')]?_0x502eb6[_0xee2f('0x15')][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x502eb6['options'][_0xee2f('0x19')],function(_0x2c47c5){return{'model':db[_0x2c47c5[_0xee2f('0x1b')]],'as':_0x2c47c5['as'],'attributes':_0x2c47c5[_0xee2f('0x1c')],'include':_0x2c47c5[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x2c47c5[_0xee2f('0x19')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1b')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x1c')],'include':_0x13013f[_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x13013f[_0xee2f('0x19')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bdbb){logger[_0xee2f('0xb')](_0xee2f('0x12'),_0x502eb6);logger[_0xee2f('0x1d')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0x18bdbb));_0x40b5bc(_0x18bdbb);})['catch'](function(_0x3d3806){logger['error'](_0xee2f('0x12'),_0x3d3806[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x3d3806[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1e')]=function(_0x47d5a6){var _0x310c0b=this;return new Promise(function(_0xd16e35,_0x56706e){return db['FreshsalesAccount'][_0xee2f('0x1f')]({'raw':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x16')]===undefined?!![]:![]:!![],'where':_0x47d5a6['options']?_0x47d5a6[_0xee2f('0x15')]['where']||null:null,'attributes':_0x47d5a6['options']?_0x47d5a6['options'][_0xee2f('0x1c')]||null:null,'include':_0x47d5a6[_0xee2f('0x15')]?_0x47d5a6['options'][_0xee2f('0x19')]?_[_0xee2f('0x1a')](_0x47d5a6[_0xee2f('0x15')][_0xee2f('0x19')],function(_0x1c3a01){return{'model':db[_0x1c3a01['model']],'as':_0x1c3a01['as'],'attributes':_0x1c3a01[_0xee2f('0x1c')],'include':_0x1c3a01['include']?_[_0xee2f('0x1a')](_0x1c3a01[_0xee2f('0x19')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x1c')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1a')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1b')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0xa')](function(_0x1b9f6c){logger[_0xee2f('0xb')](_0xee2f('0x1e'),_0x47d5a6);logger[_0xee2f('0x1d')](_0xee2f('0x1e'),_0x47d5a6,JSON[_0xee2f('0xd')](_0x1b9f6c));_0xd16e35(_0x1b9f6c);})[_0xee2f('0x20')](function(_0x5ad0a7){logger[_0xee2f('0xe')]('ShowFreshsalesAccount',_0x5ad0a7[_0xee2f('0xf')],_0x47d5a6);_0x56706e(_0x310c0b[_0xee2f('0xe')](0x1f4,_0x5ad0a7[_0xee2f('0xf')]));});});}; \ No newline at end of file +var _0x6d38=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','include','model','debug','catch','ShowFreshsalesAccount','find','map','util'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6d38[_0x164eca];return _0x2ce562;};'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']('FreshsalesAccount,\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);});});}exports[_0x86d3('0x12')]=function(_0x46feec){var _0x120ef3=this;return new Promise(function(_0x33e459,_0x32dee7){return db[_0x86d3('0x13')]['findAll']({'raw':_0x46feec[_0x86d3('0x14')]?_0x46feec['options'][_0x86d3('0x15')]===undefined?!![]:![]:!![],'where':_0x46feec['options']?_0x46feec['options'][_0x86d3('0x16')]||null:null,'attributes':_0x46feec[_0x86d3('0x14')]?_0x46feec[_0x86d3('0x14')][_0x86d3('0x17')]||null:null,'limit':_0x46feec['options']?_0x46feec[_0x86d3('0x14')]['limit']||null:null,'include':_0x46feec[_0x86d3('0x14')]?_0x46feec[_0x86d3('0x14')][_0x86d3('0x18')]?_['map'](_0x46feec[_0x86d3('0x14')][_0x86d3('0x18')],function(_0x1fa4ac){return{'model':db[_0x1fa4ac['model']],'as':_0x1fa4ac['as'],'attributes':_0x1fa4ac['attributes'],'include':_0x1fa4ac[_0x86d3('0x18')]?_['map'](_0x1fa4ac[_0x86d3('0x18')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x19')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x17')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x18')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42413c){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x46feec);logger[_0x86d3('0x1a')](_0x86d3('0x12'),_0x46feec,JSON[_0x86d3('0xd')](_0x42413c));_0x33e459(_0x42413c);})[_0x86d3('0x1b')](function(_0x35d708){logger[_0x86d3('0xe')](_0x86d3('0x12'),_0x35d708[_0x86d3('0xf')],_0x46feec);_0x32dee7(_0x120ef3[_0x86d3('0xe')](0x1f4,_0x35d708[_0x86d3('0xf')]));});});};exports[_0x86d3('0x1c')]=function(_0x5b09f6){var _0x120a0c=this;return new Promise(function(_0x403be3,_0x2bda35){return db[_0x86d3('0x13')][_0x86d3('0x1d')]({'raw':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6['options'][_0x86d3('0x15')]===undefined?!![]:![]:!![],'where':_0x5b09f6['options']?_0x5b09f6['options'][_0x86d3('0x16')]||null:null,'attributes':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6[_0x86d3('0x14')]['attributes']||null:null,'include':_0x5b09f6[_0x86d3('0x14')]?_0x5b09f6[_0x86d3('0x14')]['include']?_[_0x86d3('0x1e')](_0x5b09f6[_0x86d3('0x14')][_0x86d3('0x18')],function(_0x476eb3){return{'model':db[_0x476eb3[_0x86d3('0x19')]],'as':_0x476eb3['as'],'attributes':_0x476eb3[_0x86d3('0x17')],'include':_0x476eb3[_0x86d3('0x18')]?_[_0x86d3('0x1e')](_0x476eb3['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x17')],'include':_0x4cdf45['include']?_[_0x86d3('0x1e')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x19')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0xa')](function(_0x1e22c2){logger[_0x86d3('0x10')](_0x86d3('0x1c'),_0x5b09f6);logger['debug'](_0x86d3('0x1c'),_0x5b09f6,JSON[_0x86d3('0xd')](_0x1e22c2));_0x403be3(_0x1e22c2);})['catch'](function(_0x178fc6){logger[_0x86d3('0xe')](_0x86d3('0x1c'),_0x178fc6[_0x86d3('0xf')],_0x5b09f6);_0x2bda35(_0x120a0c['error'](0x1f4,_0x178fc6[_0x86d3('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 964d667..35a3844 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 _0x5f00=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','multer','util','path'];(function(_0xe111d,_0x530bb4){var _0x4f8927=function(_0xce464f){while(--_0xce464f){_0xe111d['push'](_0xe111d['shift']());}};_0x4f8927(++_0x530bb4);}(_0x5f00,0xe7));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x05f0('0x0'));var util=require(_0x05f0('0x1'));var path=require(_0x05f0('0x2'));var timeout=require(_0x05f0('0x3'));var express=require(_0x05f0('0x4'));var router=express[_0x05f0('0x5')]();var fs_extra=require(_0x05f0('0x6'));var auth=require(_0x05f0('0x7'));var interaction=require(_0x05f0('0x8'));var config=require(_0x05f0('0x9'));var controller=require(_0x05f0('0xa'));router[_0x05f0('0xb')]('/',auth[_0x05f0('0xc')](),controller[_0x05f0('0xd')]);router[_0x05f0('0xb')](_0x05f0('0xe'),auth['isAuthenticated'](),controller[_0x05f0('0xf')]);router[_0x05f0('0xb')](_0x05f0('0x10'),auth[_0x05f0('0xc')](),controller[_0x05f0('0x11')]);router[_0x05f0('0xb')](_0x05f0('0x12'),auth[_0x05f0('0xc')](),controller[_0x05f0('0x13')]);router[_0x05f0('0xb')](_0x05f0('0x14'),auth['isAuthenticated'](),controller[_0x05f0('0x15')]);router[_0x05f0('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x05f0('0x17')]('/:id',auth[_0x05f0('0xc')](),controller[_0x05f0('0x18')]);router[_0x05f0('0x19')](_0x05f0('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f49=['getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x1228bb,_0x517288){var _0x2b1a0c=function(_0x58142d){while(--_0x58142d){_0x1228bb['push'](_0x1228bb['shift']());}};_0x2b1a0c(++_0x517288);}(_0x5f49,0xb2));var _0x95f4=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x5f49[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require(_0x95f4('0x0'));var util=require(_0x95f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x95f4('0x2'));var router=express[_0x95f4('0x3')]();var fs_extra=require(_0x95f4('0x4'));var auth=require(_0x95f4('0x5'));var interaction=require(_0x95f4('0x6'));var config=require('../../config/environment');var controller=require(_0x95f4('0x7'));router[_0x95f4('0x8')]('/',auth[_0x95f4('0x9')](),controller[_0x95f4('0xa')]);router['get'](_0x95f4('0xb'),auth[_0x95f4('0x9')](),controller[_0x95f4('0xc')]);router[_0x95f4('0x8')](_0x95f4('0xd'),auth['isAuthenticated'](),controller[_0x95f4('0xe')]);router[_0x95f4('0x8')](_0x95f4('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x95f4('0x10'),auth['isAuthenticated'](),controller[_0x95f4('0x11')]);router[_0x95f4('0x12')]('/',auth[_0x95f4('0x9')](),controller[_0x95f4('0x13')]);router['put'](_0x95f4('0xb'),auth[_0x95f4('0x9')](),controller[_0x95f4('0x14')]);router[_0x95f4('0x15')]('/:id',auth[_0x95f4('0x9')](),controller[_0x95f4('0x16')]);module[_0x95f4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a577dab..e1532d0 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 _0x6552=['exports','STRING','sequelize'];(function(_0x4a72d1,_0x22e689){var _0x59e1ea=function(_0x158bcb){while(--_0x158bcb){_0x4a72d1['push'](_0x4a72d1['shift']());}};_0x59e1ea(++_0x22e689);}(_0x6552,0x1df));var _0x2655=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x6552[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x2655('0x0'));module[_0x2655('0x1')]={'name':{'type':Sequelize[_0x2655('0x2')]},'description':{'type':Sequelize[_0x2655('0x2')]}}; \ No newline at end of file +var _0x6d6e=['sequelize','exports','STRING'];(function(_0x58c239,_0x1788bc){var _0x1cd7cb=function(_0x4359b5){while(--_0x4359b5){_0x58c239['push'](_0x58c239['shift']());}};_0x1cd7cb(++_0x1788bc);}(_0x6d6e,0x120));var _0xe6d6=function(_0x169ffe,_0x26aa53){_0x169ffe=_0x169ffe-0x0;var _0x50f948=_0x6d6e[_0x169ffe];return _0x50f948;};'use strict';var Sequelize=require(_0xe6d6('0x0'));module[_0xe6d6('0x1')]={'name':{'type':Sequelize[_0xe6d6('0x2')]},'description':{'type':Sequelize[_0xe6d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 426e882..249544d 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 _0x03f0=['findOne','FreshsalesField','rawAttributes','getDescriptions','getFields','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','update','then','error','stack','name','map','FreshsalesConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getSubjects'];(function(_0xb5bb47,_0x5357e2){var _0x17042a=function(_0x4e0fe8){while(--_0x4e0fe8){_0xb5bb47['push'](_0xb5bb47['shift']());}};_0x17042a(++_0x5357e2);}(_0x03f0,0xe9));var _0x003f=function(_0x2d4e79,_0x344f89){_0x2d4e79=_0x2d4e79-0x0;var _0x69b734=_0x03f0[_0x2d4e79];return _0x69b734;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x003f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x003f('0x1'));var rp=require(_0x003f('0x2'));var moment=require(_0x003f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x003f('0x4'));var path=require(_0x003f('0x5'));var sox=require(_0x003f('0x6'));var csv=require(_0x003f('0x7'));var ejs=require(_0x003f('0x8'));var fs=require('fs');var fs_extra=require(_0x003f('0x9'));var _=require(_0x003f('0xa'));var squel=require('squel');var crypto=require(_0x003f('0xb'));var jsforce=require(_0x003f('0xc'));var deskjs=require(_0x003f('0xd'));var toCsv=require(_0x003f('0x7'));var querystring=require(_0x003f('0xe'));var Papa=require(_0x003f('0xf'));var Redis=require(_0x003f('0x10'));var authService=require(_0x003f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x003f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x003f('0x13'));var utils=require(_0x003f('0x14'));var config=require(_0x003f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x003f('0x16'))['db'];function respondWithStatusCode(_0x24235a,_0x80dc24){_0x80dc24=_0x80dc24||0xcc;return function(_0x305af1){if(_0x305af1){return _0x24235a[_0x003f('0x17')](_0x80dc24);}return _0x24235a['status'](_0x80dc24)[_0x003f('0x18')]();};}function respondWithResult(_0x20a4c6,_0x415a78){_0x415a78=_0x415a78||0xc8;return function(_0x47438f){if(_0x47438f){return _0x20a4c6[_0x003f('0x19')](_0x415a78)[_0x003f('0x1a')](_0x47438f);}};}function respondWithFilteredResult(_0x12e8c3,_0x284074){return function(_0x4a3c5c){if(_0x4a3c5c){var _0xa8a200=typeof _0x284074['offset']===_0x003f('0x1b')&&typeof _0x284074[_0x003f('0x1c')]===_0x003f('0x1b');var _0x2f0e0b=_0x4a3c5c[_0x003f('0x1d')];var _0xd69b66=_0xa8a200?0x0:_0x284074[_0x003f('0x1e')];var _0x38228c=_0xa8a200?_0x4a3c5c[_0x003f('0x1d')]:_0x284074[_0x003f('0x1e')]+_0x284074[_0x003f('0x1c')];var _0x2bad99;if(_0x38228c>=_0x2f0e0b){_0x38228c=_0x2f0e0b;_0x2bad99=0xc8;}else{_0x2bad99=0xce;}_0x12e8c3['status'](_0x2bad99);return _0x12e8c3[_0x003f('0x1f')]('Content-Range',_0xd69b66+'-'+_0x38228c+'/'+_0x2f0e0b)['json'](_0x4a3c5c);}return null;};}function patchUpdates(_0x247149){return function(_0x20b33a){try{jsonpatch['apply'](_0x20b33a,_0x247149,!![]);}catch(_0x3db062){return BPromise[_0x003f('0x20')](_0x3db062);}return _0x20b33a[_0x003f('0x21')]();};}function saveUpdates(_0xc82370,_0xe56ea9){return function(_0x487a2b){if(_0x487a2b){return _0x487a2b[_0x003f('0x22')](_0xc82370)[_0x003f('0x23')](function(_0x385138){return _0x385138;});}return null;};}function removeEntity(_0x11b1a3,_0x199d8c){return function(_0x56b978){if(_0x56b978){return _0x56b978['destroy']()[_0x003f('0x23')](function(){_0x11b1a3[_0x003f('0x19')](0xcc)[_0x003f('0x18')]();});}};}function handleEntityNotFound(_0x5a8cd6,_0x491bc5){return function(_0x19be3b){if(!_0x19be3b){_0x5a8cd6[_0x003f('0x17')](0x194);}return _0x19be3b;};}function handleError(_0x45ba08,_0x13fd28){_0x13fd28=_0x13fd28||0x1f4;return function(_0x598f28){logger[_0x003f('0x24')](_0x598f28[_0x003f('0x25')]);if(_0x598f28[_0x003f('0x26')]){delete _0x598f28['name'];}_0x45ba08[_0x003f('0x19')](_0x13fd28)['send'](_0x598f28);};}exports['index']=function(_0x1c789a,_0x17e578){var _0x45694c={},_0x3fc8f8={},_0x15ff58={'count':0x0,'rows':[]};var _0x23ac29=_[_0x003f('0x27')](db[_0x003f('0x28')]['rawAttributes'],function(_0xffd7b3){return{'name':_0xffd7b3['fieldName'],'type':_0xffd7b3[_0x003f('0x29')][_0x003f('0x2a')]};});_0x3fc8f8[_0x003f('0x2b')]=_[_0x003f('0x27')](_0x23ac29,_0x003f('0x26'));_0x3fc8f8[_0x003f('0x2c')]=_[_0x003f('0x2d')](_0x1c789a[_0x003f('0x2c')]);_0x3fc8f8[_0x003f('0x2e')]=_[_0x003f('0x2f')](_0x3fc8f8[_0x003f('0x2b')],_0x3fc8f8[_0x003f('0x2c')]);_0x45694c['attributes']=_[_0x003f('0x2f')](_0x3fc8f8[_0x003f('0x2b')],qs[_0x003f('0x30')](_0x1c789a['query'][_0x003f('0x30')]));_0x45694c[_0x003f('0x31')]=_0x45694c[_0x003f('0x31')][_0x003f('0x32')]?_0x45694c[_0x003f('0x31')]:_0x3fc8f8[_0x003f('0x2b')];if(!_0x1c789a[_0x003f('0x2c')][_0x003f('0x33')](_0x003f('0x34'))){_0x45694c[_0x003f('0x1c')]=qs['limit'](_0x1c789a[_0x003f('0x2c')]['limit']);_0x45694c[_0x003f('0x1e')]=qs[_0x003f('0x1e')](_0x1c789a[_0x003f('0x2c')][_0x003f('0x1e')]);}_0x45694c[_0x003f('0x35')]=qs['sort'](_0x1c789a[_0x003f('0x2c')][_0x003f('0x36')]);_0x45694c[_0x003f('0x37')]=qs[_0x003f('0x2e')](_[_0x003f('0x38')](_0x1c789a[_0x003f('0x2c')],_0x3fc8f8[_0x003f('0x2e')]),_0x23ac29);if(_0x1c789a['query'][_0x003f('0x39')]){_0x45694c['where']=_[_0x003f('0x3a')](_0x45694c[_0x003f('0x37')],{'$or':_[_0x003f('0x27')](_0x23ac29,function(_0x33b19f){if(_0x33b19f[_0x003f('0x29')]!=='VIRTUAL'){var _0x30fa9e={};_0x30fa9e[_0x33b19f[_0x003f('0x26')]]={'$like':'%'+_0x1c789a[_0x003f('0x2c')][_0x003f('0x39')]+'%'};return _0x30fa9e;}})});}_0x45694c=_[_0x003f('0x3a')]({},_0x45694c,_0x1c789a[_0x003f('0x3b')]);var _0x8f38c2={'where':_0x45694c['where']};return db[_0x003f('0x28')]['count'](_0x8f38c2)[_0x003f('0x23')](function(_0x23cfc0){_0x15ff58['count']=_0x23cfc0;if(_0x1c789a['query'][_0x003f('0x3c')]){_0x45694c[_0x003f('0x3d')]=[{'all':!![]}];}return db[_0x003f('0x28')]['findAll'](_0x45694c);})[_0x003f('0x23')](function(_0x1bf2ad){_0x15ff58[_0x003f('0x3e')]=_0x1bf2ad;return _0x15ff58;})[_0x003f('0x23')](respondWithFilteredResult(_0x17e578,_0x45694c))[_0x003f('0x3f')](handleError(_0x17e578,null));};exports[_0x003f('0x40')]=function(_0x16960a,_0x4d2b8a){var _0x136db9={'raw':![],'where':{'id':_0x16960a[_0x003f('0x41')]['id']}},_0x2d17d5={};_0x2d17d5[_0x003f('0x2b')]=_[_0x003f('0x2d')](db[_0x003f('0x28')]['rawAttributes']);_0x2d17d5[_0x003f('0x2c')]=_[_0x003f('0x2d')](_0x16960a[_0x003f('0x2c')]);_0x2d17d5[_0x003f('0x2e')]=_['intersection'](_0x2d17d5['model'],_0x2d17d5[_0x003f('0x2c')]);_0x136db9[_0x003f('0x31')]=_[_0x003f('0x2f')](_0x2d17d5[_0x003f('0x2b')],qs['fields'](_0x16960a[_0x003f('0x2c')][_0x003f('0x30')]));_0x136db9[_0x003f('0x31')]=_0x136db9[_0x003f('0x31')][_0x003f('0x32')]?_0x136db9['attributes']:_0x2d17d5[_0x003f('0x2b')];if(_0x16960a[_0x003f('0x2c')]['includeAll']){_0x136db9[_0x003f('0x3d')]=[{'all':!![]}];}_0x136db9=_['merge']({},_0x136db9,_0x16960a[_0x003f('0x3b')]);return db[_0x003f('0x28')][_0x003f('0x42')](_0x136db9)[_0x003f('0x23')](handleEntityNotFound(_0x4d2b8a,null))[_0x003f('0x23')](respondWithResult(_0x4d2b8a,null))[_0x003f('0x3f')](handleError(_0x4d2b8a,null));};exports[_0x003f('0x43')]=function(_0xb5d539,_0x53b7cf){return db[_0x003f('0x28')][_0x003f('0x43')](_0xb5d539['body'],{})[_0x003f('0x23')](respondWithResult(_0x53b7cf,0xc9))[_0x003f('0x3f')](handleError(_0x53b7cf,null));};exports[_0x003f('0x22')]=function(_0x311bb2,_0x1681dd){if(_0x311bb2[_0x003f('0x44')]['id']){delete _0x311bb2['body']['id'];}return db['FreshsalesConfiguration'][_0x003f('0x42')]({'where':{'id':_0x311bb2['params']['id']}})[_0x003f('0x23')](handleEntityNotFound(_0x1681dd,null))['then'](saveUpdates(_0x311bb2[_0x003f('0x44')],null))[_0x003f('0x23')](respondWithResult(_0x1681dd,null))[_0x003f('0x3f')](handleError(_0x1681dd,null));};exports[_0x003f('0x45')]=function(_0xfcb08a,_0x175350){return db['FreshsalesConfiguration'][_0x003f('0x42')]({'where':{'id':_0xfcb08a['params']['id']}})['then'](handleEntityNotFound(_0x175350,null))[_0x003f('0x23')](removeEntity(_0x175350,null))[_0x003f('0x3f')](handleError(_0x175350,null));};exports[_0x003f('0x46')]=function(_0x39043a,_0x49b578,_0x2973b7){var _0x59af27={};var _0x17d8b4={};var _0x50257e;var _0xc25ff7;return db[_0x003f('0x28')][_0x003f('0x47')]({'where':{'id':_0x39043a[_0x003f('0x41')]['id']}})[_0x003f('0x23')](handleEntityNotFound(_0x49b578,null))[_0x003f('0x23')](function(_0x4bb63f){if(_0x4bb63f){_0x50257e=_0x4bb63f;_0x17d8b4[_0x003f('0x2b')]=_[_0x003f('0x2d')](db[_0x003f('0x48')][_0x003f('0x49')]);_0x17d8b4[_0x003f('0x2c')]=_[_0x003f('0x2d')](_0x39043a[_0x003f('0x2c')]);_0x17d8b4['filters']=_[_0x003f('0x2f')](_0x17d8b4[_0x003f('0x2b')],_0x17d8b4['query']);_0x59af27['attributes']=_[_0x003f('0x2f')](_0x17d8b4[_0x003f('0x2b')],qs[_0x003f('0x30')](_0x39043a[_0x003f('0x2c')]['fields']));_0x59af27[_0x003f('0x31')]=_0x59af27[_0x003f('0x31')][_0x003f('0x32')]?_0x59af27[_0x003f('0x31')]:_0x17d8b4[_0x003f('0x2b')];_0x59af27[_0x003f('0x35')]=qs['sort'](_0x39043a['query']['sort']);_0x59af27[_0x003f('0x37')]=qs[_0x003f('0x2e')](_[_0x003f('0x38')](_0x39043a[_0x003f('0x2c')],_0x17d8b4[_0x003f('0x2e')]));if(_0x39043a[_0x003f('0x2c')][_0x003f('0x39')]){_0x59af27[_0x003f('0x37')]=_[_0x003f('0x3a')](_0x59af27[_0x003f('0x37')],{'$or':_[_0x003f('0x27')](_0x59af27['attributes'],function(_0x147759){var _0x36b5b7={};_0x36b5b7[_0x147759]={'$like':'%'+_0x39043a['query'][_0x003f('0x39')]+'%'};return _0x36b5b7;})});}_0x59af27=_[_0x003f('0x3a')]({},_0x59af27,_0x39043a[_0x003f('0x3b')]);return _0x50257e[_0x003f('0x46')](_0x59af27);}})[_0x003f('0x23')](function(_0x3fa801){if(_0x3fa801){_0xc25ff7=_0x3fa801[_0x003f('0x32')];if(!_0x39043a[_0x003f('0x2c')][_0x003f('0x33')](_0x003f('0x34'))){_0x59af27['limit']=qs[_0x003f('0x1c')](_0x39043a[_0x003f('0x2c')][_0x003f('0x1c')]);_0x59af27[_0x003f('0x1e')]=qs[_0x003f('0x1e')](_0x39043a[_0x003f('0x2c')][_0x003f('0x1e')]);}return _0x50257e[_0x003f('0x46')](_0x59af27);}})['then'](function(_0x5d7c7b){if(_0x5d7c7b){return _0x5d7c7b?{'count':_0xc25ff7,'rows':_0x5d7c7b}:null;}})[_0x003f('0x23')](respondWithResult(_0x49b578,null))[_0x003f('0x3f')](handleError(_0x49b578,null));};exports[_0x003f('0x4a')]=function(_0x503e3d,_0x38fb90,_0x250327){var _0x10e882={};var _0x562536={};var _0x25479d;var _0x510e8d;return db['FreshsalesConfiguration'][_0x003f('0x47')]({'where':{'id':_0x503e3d['params']['id']}})[_0x003f('0x23')](handleEntityNotFound(_0x38fb90,null))[_0x003f('0x23')](function(_0x2ce1ad){if(_0x2ce1ad){_0x25479d=_0x2ce1ad;_0x562536[_0x003f('0x2b')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x562536[_0x003f('0x2c')]=_[_0x003f('0x2d')](_0x503e3d[_0x003f('0x2c')]);_0x562536['filters']=_[_0x003f('0x2f')](_0x562536[_0x003f('0x2b')],_0x562536[_0x003f('0x2c')]);_0x10e882['attributes']=_['intersection'](_0x562536['model'],qs['fields'](_0x503e3d[_0x003f('0x2c')]['fields']));_0x10e882['attributes']=_0x10e882[_0x003f('0x31')][_0x003f('0x32')]?_0x10e882['attributes']:_0x562536['model'];_0x10e882['order']=qs[_0x003f('0x36')](_0x503e3d[_0x003f('0x2c')][_0x003f('0x36')]);_0x10e882[_0x003f('0x37')]=qs[_0x003f('0x2e')](_[_0x003f('0x38')](_0x503e3d[_0x003f('0x2c')],_0x562536[_0x003f('0x2e')]));if(_0x503e3d['query'][_0x003f('0x39')]){_0x10e882[_0x003f('0x37')]=_['merge'](_0x10e882[_0x003f('0x37')],{'$or':_['map'](_0x10e882[_0x003f('0x31')],function(_0x176ca1){var _0x1b7b27={};_0x1b7b27[_0x176ca1]={'$like':'%'+_0x503e3d[_0x003f('0x2c')][_0x003f('0x39')]+'%'};return _0x1b7b27;})});}_0x10e882=_[_0x003f('0x3a')]({},_0x10e882,_0x503e3d[_0x003f('0x3b')]);return _0x25479d[_0x003f('0x4a')](_0x10e882);}})[_0x003f('0x23')](function(_0x3f1dd6){if(_0x3f1dd6){_0x510e8d=_0x3f1dd6[_0x003f('0x32')];if(!_0x503e3d[_0x003f('0x2c')][_0x003f('0x33')](_0x003f('0x34'))){_0x10e882['limit']=qs[_0x003f('0x1c')](_0x503e3d[_0x003f('0x2c')][_0x003f('0x1c')]);_0x10e882['offset']=qs[_0x003f('0x1e')](_0x503e3d[_0x003f('0x2c')][_0x003f('0x1e')]);}return _0x25479d['getDescriptions'](_0x10e882);}})[_0x003f('0x23')](function(_0x52a811){if(_0x52a811){return _0x52a811?{'count':_0x510e8d,'rows':_0x52a811}:null;}})[_0x003f('0x23')](respondWithResult(_0x38fb90,null))['catch'](handleError(_0x38fb90,null));};exports[_0x003f('0x4b')]=function(_0x169bc8,_0xa3b8c2,_0x1ceff3){var _0x1707bf={};var _0x2f0876={};var _0x5a795d;var _0x54ce32;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x169bc8[_0x003f('0x41')]['id']}})[_0x003f('0x23')](handleEntityNotFound(_0xa3b8c2,null))[_0x003f('0x23')](function(_0x464904){if(_0x464904){_0x5a795d=_0x464904;_0x2f0876[_0x003f('0x2b')]=_['keys'](db[_0x003f('0x48')][_0x003f('0x49')]);_0x2f0876[_0x003f('0x2c')]=_[_0x003f('0x2d')](_0x169bc8[_0x003f('0x2c')]);_0x2f0876[_0x003f('0x2e')]=_['intersection'](_0x2f0876[_0x003f('0x2b')],_0x2f0876[_0x003f('0x2c')]);_0x1707bf[_0x003f('0x31')]=_[_0x003f('0x2f')](_0x2f0876[_0x003f('0x2b')],qs['fields'](_0x169bc8['query'][_0x003f('0x30')]));_0x1707bf[_0x003f('0x31')]=_0x1707bf[_0x003f('0x31')][_0x003f('0x32')]?_0x1707bf[_0x003f('0x31')]:_0x2f0876['model'];_0x1707bf[_0x003f('0x35')]=qs[_0x003f('0x36')](_0x169bc8[_0x003f('0x2c')][_0x003f('0x36')]);_0x1707bf['where']=qs[_0x003f('0x2e')](_[_0x003f('0x38')](_0x169bc8[_0x003f('0x2c')],_0x2f0876['filters']));if(_0x169bc8[_0x003f('0x2c')][_0x003f('0x39')]){_0x1707bf[_0x003f('0x37')]=_[_0x003f('0x3a')](_0x1707bf[_0x003f('0x37')],{'$or':_['map'](_0x1707bf['attributes'],function(_0x307a01){var _0x1f3187={};_0x1f3187[_0x307a01]={'$like':'%'+_0x169bc8['query'][_0x003f('0x39')]+'%'};return _0x1f3187;})});}_0x1707bf=_[_0x003f('0x3a')]({},_0x1707bf,_0x169bc8[_0x003f('0x3b')]);return _0x5a795d[_0x003f('0x4b')](_0x1707bf);}})[_0x003f('0x23')](function(_0x1cc640){if(_0x1cc640){_0x54ce32=_0x1cc640[_0x003f('0x32')];if(!_0x169bc8['query'][_0x003f('0x33')](_0x003f('0x34'))){_0x1707bf[_0x003f('0x1c')]=qs[_0x003f('0x1c')](_0x169bc8[_0x003f('0x2c')][_0x003f('0x1c')]);_0x1707bf[_0x003f('0x1e')]=qs[_0x003f('0x1e')](_0x169bc8['query']['offset']);}return _0x5a795d[_0x003f('0x4b')](_0x1707bf);}})[_0x003f('0x23')](function(_0x1d4874){if(_0x1d4874){return _0x1d4874?{'count':_0x54ce32,'rows':_0x1d4874}:null;}})[_0x003f('0x23')](respondWithResult(_0xa3b8c2,null))[_0x003f('0x3f')](handleError(_0xa3b8c2,null));}; \ No newline at end of file +var _0x48f8=['rows','params','fields','catch','create','body','find','findOne','FreshsalesField','pick','getSubjects','getDescriptions','getFields','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','destroy','then','end','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x78b0ad,_0x3a0ff8){var _0x25e02b=function(_0x33f698){while(--_0x33f698){_0x78b0ad['push'](_0x78b0ad['shift']());}};_0x25e02b(++_0x3a0ff8);}(_0x48f8,0x149));var _0x848f=function(_0x3d31b9,_0x14c843){_0x3d31b9=_0x3d31b9-0x0;var _0x203d77=_0x48f8[_0x3d31b9];return _0x203d77;};'use strict';var emlformat=require(_0x848f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x848f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x848f('0x2'));var moment=require(_0x848f('0x3'));var BPromise=require(_0x848f('0x4'));var Mustache=require(_0x848f('0x5'));var util=require(_0x848f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x848f('0x7'));var ejs=require(_0x848f('0x8'));var fs=require('fs');var fs_extra=require(_0x848f('0x9'));var _=require(_0x848f('0xa'));var squel=require('squel');var crypto=require(_0x848f('0xb'));var jsforce=require(_0x848f('0xc'));var deskjs=require(_0x848f('0xd'));var toCsv=require(_0x848f('0x7'));var querystring=require(_0x848f('0xe'));var Papa=require('papaparse');var Redis=require(_0x848f('0xf'));var authService=require(_0x848f('0x10'));var qs=require(_0x848f('0x11'));var as=require(_0x848f('0x12'));var hardwareService=require(_0x848f('0x13'));var logger=require(_0x848f('0x14'))(_0x848f('0x15'));var utils=require(_0x848f('0x16'));var config=require(_0x848f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x848f('0x18'))['db'];function respondWithStatusCode(_0xf12253,_0x1aa52c){_0x1aa52c=_0x1aa52c||0xcc;return function(_0x125e7b){if(_0x125e7b){return _0xf12253[_0x848f('0x19')](_0x1aa52c);}return _0xf12253[_0x848f('0x1a')](_0x1aa52c)['end']();};}function respondWithResult(_0x460d18,_0x49eaa3){_0x49eaa3=_0x49eaa3||0xc8;return function(_0x35c2d1){if(_0x35c2d1){return _0x460d18[_0x848f('0x1a')](_0x49eaa3)[_0x848f('0x1b')](_0x35c2d1);}};}function respondWithFilteredResult(_0x2a6571,_0x261130){return function(_0x370ef4){if(_0x370ef4){var _0x2882eb=typeof _0x261130[_0x848f('0x1c')]===_0x848f('0x1d')&&typeof _0x261130['limit']===_0x848f('0x1d');var _0x4d3fa9=_0x370ef4[_0x848f('0x1e')];var _0x4503c8=_0x2882eb?0x0:_0x261130[_0x848f('0x1c')];var _0x3a7926=_0x2882eb?_0x370ef4[_0x848f('0x1e')]:_0x261130[_0x848f('0x1c')]+_0x261130[_0x848f('0x1f')];var _0x5cb129;if(_0x3a7926>=_0x4d3fa9){_0x3a7926=_0x4d3fa9;_0x5cb129=0xc8;}else{_0x5cb129=0xce;}_0x2a6571[_0x848f('0x1a')](_0x5cb129);return _0x2a6571[_0x848f('0x20')]('Content-Range',_0x4503c8+'-'+_0x3a7926+'/'+_0x4d3fa9)[_0x848f('0x1b')](_0x370ef4);}return null;};}function patchUpdates(_0x3f9b69){return function(_0x3f740c){try{jsonpatch[_0x848f('0x21')](_0x3f740c,_0x3f9b69,!![]);}catch(_0x227d12){return BPromise['reject'](_0x227d12);}return _0x3f740c['save']();};}function saveUpdates(_0x385df4,_0x315db1){return function(_0x357efa){if(_0x357efa){return _0x357efa[_0x848f('0x22')](_0x385df4)['then'](function(_0x5a4e32){return _0x5a4e32;});}return null;};}function removeEntity(_0x2e12f8,_0x22146c){return function(_0x13e983){if(_0x13e983){return _0x13e983[_0x848f('0x23')]()[_0x848f('0x24')](function(){_0x2e12f8[_0x848f('0x1a')](0xcc)[_0x848f('0x25')]();});}};}function handleEntityNotFound(_0x22cfd0,_0x29c1ba){return function(_0x53aeb8){if(!_0x53aeb8){_0x22cfd0[_0x848f('0x19')](0x194);}return _0x53aeb8;};}function handleError(_0x4c7223,_0x3e8fc2){_0x3e8fc2=_0x3e8fc2||0x1f4;return function(_0xfe0b64){logger['error'](_0xfe0b64[_0x848f('0x26')]);if(_0xfe0b64[_0x848f('0x27')]){delete _0xfe0b64[_0x848f('0x27')];}_0x4c7223[_0x848f('0x1a')](_0x3e8fc2)['send'](_0xfe0b64);};}exports[_0x848f('0x28')]=function(_0x99f1d6,_0x4dbbf8){var _0xac3fea={},_0x33b0f9={},_0x209193={'count':0x0,'rows':[]};var _0x131fb2=_['map'](db[_0x848f('0x29')][_0x848f('0x2a')],function(_0x39d1ec){return{'name':_0x39d1ec[_0x848f('0x2b')],'type':_0x39d1ec['type'][_0x848f('0x2c')]};});_0x33b0f9[_0x848f('0x2d')]=_[_0x848f('0x2e')](_0x131fb2,_0x848f('0x27'));_0x33b0f9['query']=_[_0x848f('0x2f')](_0x99f1d6[_0x848f('0x30')]);_0x33b0f9[_0x848f('0x31')]=_[_0x848f('0x32')](_0x33b0f9[_0x848f('0x2d')],_0x33b0f9[_0x848f('0x30')]);_0xac3fea['attributes']=_[_0x848f('0x32')](_0x33b0f9[_0x848f('0x2d')],qs['fields'](_0x99f1d6[_0x848f('0x30')]['fields']));_0xac3fea[_0x848f('0x33')]=_0xac3fea[_0x848f('0x33')][_0x848f('0x34')]?_0xac3fea['attributes']:_0x33b0f9['model'];if(!_0x99f1d6[_0x848f('0x30')][_0x848f('0x35')](_0x848f('0x36'))){_0xac3fea[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x99f1d6[_0x848f('0x30')][_0x848f('0x1f')]);_0xac3fea[_0x848f('0x1c')]=qs['offset'](_0x99f1d6[_0x848f('0x30')][_0x848f('0x1c')]);}_0xac3fea[_0x848f('0x37')]=qs[_0x848f('0x38')](_0x99f1d6[_0x848f('0x30')]['sort']);_0xac3fea['where']=qs[_0x848f('0x31')](_['pick'](_0x99f1d6[_0x848f('0x30')],_0x33b0f9[_0x848f('0x31')]),_0x131fb2);if(_0x99f1d6[_0x848f('0x30')][_0x848f('0x39')]){_0xac3fea['where']=_[_0x848f('0x3a')](_0xac3fea[_0x848f('0x3b')],{'$or':_['map'](_0x131fb2,function(_0x584818){if(_0x584818[_0x848f('0x3c')]!==_0x848f('0x3d')){var _0x4d230b={};_0x4d230b[_0x584818[_0x848f('0x27')]]={'$like':'%'+_0x99f1d6[_0x848f('0x30')][_0x848f('0x39')]+'%'};return _0x4d230b;}})});}_0xac3fea=_[_0x848f('0x3a')]({},_0xac3fea,_0x99f1d6[_0x848f('0x3e')]);var _0x3cebbb={'where':_0xac3fea['where']};return db[_0x848f('0x29')][_0x848f('0x1e')](_0x3cebbb)[_0x848f('0x24')](function(_0x1b7f69){_0x209193[_0x848f('0x1e')]=_0x1b7f69;if(_0x99f1d6[_0x848f('0x30')][_0x848f('0x3f')]){_0xac3fea[_0x848f('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x848f('0x41')](_0xac3fea);})[_0x848f('0x24')](function(_0x16133a){_0x209193[_0x848f('0x42')]=_0x16133a;return _0x209193;})['then'](respondWithFilteredResult(_0x4dbbf8,_0xac3fea))['catch'](handleError(_0x4dbbf8,null));};exports['show']=function(_0x20f1d9,_0x53ed18){var _0x2c6b0e={'raw':![],'where':{'id':_0x20f1d9[_0x848f('0x43')]['id']}},_0x5f0bca={};_0x5f0bca['model']=_['keys'](db[_0x848f('0x29')]['rawAttributes']);_0x5f0bca[_0x848f('0x30')]=_[_0x848f('0x2f')](_0x20f1d9[_0x848f('0x30')]);_0x5f0bca['filters']=_[_0x848f('0x32')](_0x5f0bca['model'],_0x5f0bca[_0x848f('0x30')]);_0x2c6b0e[_0x848f('0x33')]=_[_0x848f('0x32')](_0x5f0bca[_0x848f('0x2d')],qs['fields'](_0x20f1d9[_0x848f('0x30')][_0x848f('0x44')]));_0x2c6b0e[_0x848f('0x33')]=_0x2c6b0e['attributes'][_0x848f('0x34')]?_0x2c6b0e[_0x848f('0x33')]:_0x5f0bca[_0x848f('0x2d')];if(_0x20f1d9['query'][_0x848f('0x3f')]){_0x2c6b0e[_0x848f('0x40')]=[{'all':!![]}];}_0x2c6b0e=_['merge']({},_0x2c6b0e,_0x20f1d9[_0x848f('0x3e')]);return db[_0x848f('0x29')]['find'](_0x2c6b0e)[_0x848f('0x24')](handleEntityNotFound(_0x53ed18,null))['then'](respondWithResult(_0x53ed18,null))[_0x848f('0x45')](handleError(_0x53ed18,null));};exports[_0x848f('0x46')]=function(_0x55094a,_0x4947e0){return db[_0x848f('0x29')]['create'](_0x55094a[_0x848f('0x47')],{})[_0x848f('0x24')](respondWithResult(_0x4947e0,0xc9))[_0x848f('0x45')](handleError(_0x4947e0,null));};exports[_0x848f('0x22')]=function(_0x4af435,_0x414c4c){if(_0x4af435[_0x848f('0x47')]['id']){delete _0x4af435[_0x848f('0x47')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4af435[_0x848f('0x43')]['id']}})['then'](handleEntityNotFound(_0x414c4c,null))[_0x848f('0x24')](saveUpdates(_0x4af435[_0x848f('0x47')],null))[_0x848f('0x24')](respondWithResult(_0x414c4c,null))[_0x848f('0x45')](handleError(_0x414c4c,null));};exports[_0x848f('0x23')]=function(_0x5898b0,_0x3ad760){return db['FreshsalesConfiguration'][_0x848f('0x48')]({'where':{'id':_0x5898b0['params']['id']}})[_0x848f('0x24')](handleEntityNotFound(_0x3ad760,null))[_0x848f('0x24')](removeEntity(_0x3ad760,null))['catch'](handleError(_0x3ad760,null));};exports['getSubjects']=function(_0x29dd51,_0x54e7ab,_0x4dc50c){var _0x3e2545={};var _0x1b138b={};var _0x5a5db9;var _0x1103fb;return db[_0x848f('0x29')][_0x848f('0x49')]({'where':{'id':_0x29dd51[_0x848f('0x43')]['id']}})[_0x848f('0x24')](handleEntityNotFound(_0x54e7ab,null))['then'](function(_0x1bdea0){if(_0x1bdea0){_0x5a5db9=_0x1bdea0;_0x1b138b[_0x848f('0x2d')]=_[_0x848f('0x2f')](db[_0x848f('0x4a')][_0x848f('0x2a')]);_0x1b138b['query']=_[_0x848f('0x2f')](_0x29dd51[_0x848f('0x30')]);_0x1b138b['filters']=_[_0x848f('0x32')](_0x1b138b[_0x848f('0x2d')],_0x1b138b[_0x848f('0x30')]);_0x3e2545['attributes']=_[_0x848f('0x32')](_0x1b138b[_0x848f('0x2d')],qs[_0x848f('0x44')](_0x29dd51['query']['fields']));_0x3e2545[_0x848f('0x33')]=_0x3e2545[_0x848f('0x33')]['length']?_0x3e2545['attributes']:_0x1b138b[_0x848f('0x2d')];_0x3e2545[_0x848f('0x37')]=qs[_0x848f('0x38')](_0x29dd51[_0x848f('0x30')][_0x848f('0x38')]);_0x3e2545[_0x848f('0x3b')]=qs[_0x848f('0x31')](_[_0x848f('0x4b')](_0x29dd51[_0x848f('0x30')],_0x1b138b[_0x848f('0x31')]));if(_0x29dd51['query'][_0x848f('0x39')]){_0x3e2545[_0x848f('0x3b')]=_['merge'](_0x3e2545[_0x848f('0x3b')],{'$or':_[_0x848f('0x2e')](_0x3e2545[_0x848f('0x33')],function(_0xf9add3){var _0x50fca0={};_0x50fca0[_0xf9add3]={'$like':'%'+_0x29dd51[_0x848f('0x30')][_0x848f('0x39')]+'%'};return _0x50fca0;})});}_0x3e2545=_['merge']({},_0x3e2545,_0x29dd51[_0x848f('0x3e')]);return _0x5a5db9[_0x848f('0x4c')](_0x3e2545);}})[_0x848f('0x24')](function(_0x388df4){if(_0x388df4){_0x1103fb=_0x388df4[_0x848f('0x34')];if(!_0x29dd51['query'][_0x848f('0x35')](_0x848f('0x36'))){_0x3e2545[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x29dd51[_0x848f('0x30')][_0x848f('0x1f')]);_0x3e2545[_0x848f('0x1c')]=qs['offset'](_0x29dd51[_0x848f('0x30')][_0x848f('0x1c')]);}return _0x5a5db9['getSubjects'](_0x3e2545);}})[_0x848f('0x24')](function(_0x3ffbd8){if(_0x3ffbd8){return _0x3ffbd8?{'count':_0x1103fb,'rows':_0x3ffbd8}:null;}})[_0x848f('0x24')](respondWithResult(_0x54e7ab,null))[_0x848f('0x45')](handleError(_0x54e7ab,null));};exports['getDescriptions']=function(_0x396842,_0x33a9fe,_0x47fe35){var _0x454639={};var _0x2970b3={};var _0x2433f8;var _0x36aa88;return db[_0x848f('0x29')][_0x848f('0x49')]({'where':{'id':_0x396842[_0x848f('0x43')]['id']}})[_0x848f('0x24')](handleEntityNotFound(_0x33a9fe,null))[_0x848f('0x24')](function(_0x473d53){if(_0x473d53){_0x2433f8=_0x473d53;_0x2970b3[_0x848f('0x2d')]=_[_0x848f('0x2f')](db[_0x848f('0x4a')]['rawAttributes']);_0x2970b3[_0x848f('0x30')]=_[_0x848f('0x2f')](_0x396842[_0x848f('0x30')]);_0x2970b3['filters']=_[_0x848f('0x32')](_0x2970b3[_0x848f('0x2d')],_0x2970b3['query']);_0x454639[_0x848f('0x33')]=_['intersection'](_0x2970b3[_0x848f('0x2d')],qs[_0x848f('0x44')](_0x396842[_0x848f('0x30')][_0x848f('0x44')]));_0x454639[_0x848f('0x33')]=_0x454639[_0x848f('0x33')]['length']?_0x454639[_0x848f('0x33')]:_0x2970b3[_0x848f('0x2d')];_0x454639['order']=qs[_0x848f('0x38')](_0x396842['query'][_0x848f('0x38')]);_0x454639[_0x848f('0x3b')]=qs[_0x848f('0x31')](_[_0x848f('0x4b')](_0x396842[_0x848f('0x30')],_0x2970b3[_0x848f('0x31')]));if(_0x396842[_0x848f('0x30')][_0x848f('0x39')]){_0x454639[_0x848f('0x3b')]=_[_0x848f('0x3a')](_0x454639[_0x848f('0x3b')],{'$or':_[_0x848f('0x2e')](_0x454639[_0x848f('0x33')],function(_0x5ed533){var _0x2e371d={};_0x2e371d[_0x5ed533]={'$like':'%'+_0x396842[_0x848f('0x30')]['filter']+'%'};return _0x2e371d;})});}_0x454639=_[_0x848f('0x3a')]({},_0x454639,_0x396842[_0x848f('0x3e')]);return _0x2433f8[_0x848f('0x4d')](_0x454639);}})[_0x848f('0x24')](function(_0x289cec){if(_0x289cec){_0x36aa88=_0x289cec['length'];if(!_0x396842[_0x848f('0x30')][_0x848f('0x35')]('nolimit')){_0x454639['limit']=qs[_0x848f('0x1f')](_0x396842[_0x848f('0x30')][_0x848f('0x1f')]);_0x454639[_0x848f('0x1c')]=qs[_0x848f('0x1c')](_0x396842['query']['offset']);}return _0x2433f8[_0x848f('0x4d')](_0x454639);}})['then'](function(_0x316955){if(_0x316955){return _0x316955?{'count':_0x36aa88,'rows':_0x316955}:null;}})[_0x848f('0x24')](respondWithResult(_0x33a9fe,null))['catch'](handleError(_0x33a9fe,null));};exports[_0x848f('0x4e')]=function(_0x523969,_0x4b949e,_0x322562){var _0x3a9273={};var _0x3aba84={};var _0x9d85d4;var _0x595e03;return db[_0x848f('0x29')]['findOne']({'where':{'id':_0x523969[_0x848f('0x43')]['id']}})[_0x848f('0x24')](handleEntityNotFound(_0x4b949e,null))['then'](function(_0x283905){if(_0x283905){_0x9d85d4=_0x283905;_0x3aba84[_0x848f('0x2d')]=_[_0x848f('0x2f')](db[_0x848f('0x4a')]['rawAttributes']);_0x3aba84[_0x848f('0x30')]=_[_0x848f('0x2f')](_0x523969[_0x848f('0x30')]);_0x3aba84['filters']=_[_0x848f('0x32')](_0x3aba84[_0x848f('0x2d')],_0x3aba84[_0x848f('0x30')]);_0x3a9273[_0x848f('0x33')]=_[_0x848f('0x32')](_0x3aba84[_0x848f('0x2d')],qs[_0x848f('0x44')](_0x523969[_0x848f('0x30')]['fields']));_0x3a9273[_0x848f('0x33')]=_0x3a9273[_0x848f('0x33')]['length']?_0x3a9273[_0x848f('0x33')]:_0x3aba84[_0x848f('0x2d')];_0x3a9273[_0x848f('0x37')]=qs[_0x848f('0x38')](_0x523969['query']['sort']);_0x3a9273[_0x848f('0x3b')]=qs['filters'](_[_0x848f('0x4b')](_0x523969[_0x848f('0x30')],_0x3aba84[_0x848f('0x31')]));if(_0x523969['query'][_0x848f('0x39')]){_0x3a9273[_0x848f('0x3b')]=_[_0x848f('0x3a')](_0x3a9273[_0x848f('0x3b')],{'$or':_[_0x848f('0x2e')](_0x3a9273['attributes'],function(_0xa259ff){var _0x159582={};_0x159582[_0xa259ff]={'$like':'%'+_0x523969['query'][_0x848f('0x39')]+'%'};return _0x159582;})});}_0x3a9273=_[_0x848f('0x3a')]({},_0x3a9273,_0x523969[_0x848f('0x3e')]);return _0x9d85d4['getFields'](_0x3a9273);}})[_0x848f('0x24')](function(_0x2ba6c8){if(_0x2ba6c8){_0x595e03=_0x2ba6c8['length'];if(!_0x523969[_0x848f('0x30')][_0x848f('0x35')](_0x848f('0x36'))){_0x3a9273[_0x848f('0x1f')]=qs[_0x848f('0x1f')](_0x523969[_0x848f('0x30')][_0x848f('0x1f')]);_0x3a9273['offset']=qs[_0x848f('0x1c')](_0x523969[_0x848f('0x30')][_0x848f('0x1c')]);}return _0x9d85d4[_0x848f('0x4e')](_0x3a9273);}})['then'](function(_0x37d7b1){if(_0x37d7b1){return _0x37d7b1?{'count':_0x595e03,'rows':_0x37d7b1}:null;}})[_0x848f('0x24')](respondWithResult(_0x4b949e,null))[_0x848f('0x45')](handleError(_0x4b949e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 78e032b..a2e6f02 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 _0xf761=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','int_freshsales_configurations'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0xf761,0x171));var _0x1f76=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xf761[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0x1f76('0x0'));var util=require(_0x1f76('0x1'));var logger=require(_0x1f76('0x2'))(_0x1f76('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f76('0x4'));var rimraf=require(_0x1f76('0x5'));var config=require(_0x1f76('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x1f76('0x7')]=function(_0x374ce5,_0x4cbbf0){return _0x374ce5['define']('FreshsalesConfiguration',attributes,{'tableName':_0x1f76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c89=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x3d5c9f,_0x5a7dd6){var _0x29c0f5=function(_0x48bd32){while(--_0x48bd32){_0x3d5c9f['push'](_0x3d5c9f['shift']());}};_0x29c0f5(++_0x5a7dd6);}(_0x1c89,0x1b8));var _0x91c8=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x1c89[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0x91c8('0x0'));var util=require(_0x91c8('0x1'));var logger=require(_0x91c8('0x2'))('api');var moment=require(_0x91c8('0x3'));var BPromise=require(_0x91c8('0x4'));var rp=require(_0x91c8('0x5'));var fs=require('fs');var path=require(_0x91c8('0x6'));var rimraf=require(_0x91c8('0x7'));var config=require('../../config/environment');var attributes=require(_0x91c8('0x8'));module[_0x91c8('0x9')]=function(_0x317084,_0x34c26c){return _0x317084[_0x91c8('0xa')](_0x91c8('0xb'),attributes,{'tableName':_0x91c8('0xc'),'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 2386baf..407c62f 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 _0xf7cf=['../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xf7cf,0x124));var _0xff7c=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0xf7cf[_0x452450];return _0x448b19;};'use strict';var _=require(_0xff7c('0x0'));var util=require(_0xff7c('0x1'));var moment=require(_0xff7c('0x2'));var BPromise=require(_0xff7c('0x3'));var rs=require(_0xff7c('0x4'));var fs=require('fs');var Redis=require(_0xff7c('0x5'));var db=require(_0xff7c('0x6'))['db'];var utils=require(_0xff7c('0x7'));var logger=require(_0xff7c('0x8'))(_0xff7c('0x9'));var config=require(_0xff7c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xff7c('0xb')][_0xff7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x527e34,_0x231c50,_0x19f723){return new BPromise(function(_0x5cf490,_0x8ddf5){return client['request'](_0x527e34,_0x19f723)[_0xff7c('0xd')](function(_0x3f62aa){logger[_0xff7c('0xe')](_0xff7c('0xf'),_0x231c50,_0xff7c('0x10'));logger[_0xff7c('0x11')](_0xff7c('0x12'),_0x231c50,_0xff7c('0x10'),JSON[_0xff7c('0x13')](_0x3f62aa));if(_0x3f62aa['error']){if(_0x3f62aa[_0xff7c('0x14')][_0xff7c('0x15')]===0x1f4){logger['error'](_0xff7c('0xf'),_0x231c50,_0x3f62aa[_0xff7c('0x14')][_0xff7c('0x16')]);return _0x8ddf5(_0x3f62aa['error'][_0xff7c('0x16')]);}logger[_0xff7c('0x14')](_0xff7c('0xf'),_0x231c50,_0x3f62aa[_0xff7c('0x14')][_0xff7c('0x16')]);return _0x5cf490(_0x3f62aa[_0xff7c('0x14')]['message']);}else{logger[_0xff7c('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x231c50,_0xff7c('0x10'));_0x5cf490(_0x3f62aa[_0xff7c('0x17')][_0xff7c('0x16')]);}})[_0xff7c('0x18')](function(_0x3e75e6){logger[_0xff7c('0x14')](_0xff7c('0xf'),_0x231c50,_0x3e75e6);_0x8ddf5(_0x3e75e6);});});} \ No newline at end of file +var _0x6d07=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x6d07,0x113));var _0x76d0=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x6d07[_0x429948];return _0x35d5d1;};'use strict';var _=require('lodash');var util=require(_0x76d0('0x0'));var moment=require(_0x76d0('0x1'));var BPromise=require(_0x76d0('0x2'));var rs=require(_0x76d0('0x3'));var fs=require('fs');var Redis=require(_0x76d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76d0('0x5'));var logger=require(_0x76d0('0x6'))('rpc');var config=require(_0x76d0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dec0b,_0x31fce9,_0x331d71){return new BPromise(function(_0x4763cc,_0xcd392d){return client[_0x76d0('0x9')](_0x1dec0b,_0x331d71)['then'](function(_0x56424a){logger[_0x76d0('0xa')](_0x76d0('0xb'),_0x31fce9,_0x76d0('0xc'));logger[_0x76d0('0xd')](_0x76d0('0xe'),_0x31fce9,_0x76d0('0xc'),JSON[_0x76d0('0xf')](_0x56424a));if(_0x56424a[_0x76d0('0x10')]){if(_0x56424a[_0x76d0('0x10')][_0x76d0('0x11')]===0x1f4){logger[_0x76d0('0x10')](_0x76d0('0xb'),_0x31fce9,_0x56424a['error']['message']);return _0xcd392d(_0x56424a[_0x76d0('0x10')][_0x76d0('0x12')]);}logger[_0x76d0('0x10')](_0x76d0('0xb'),_0x31fce9,_0x56424a[_0x76d0('0x10')][_0x76d0('0x12')]);return _0x4763cc(_0x56424a[_0x76d0('0x10')]['message']);}else{logger[_0x76d0('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x31fce9,_0x76d0('0xc'));_0x4763cc(_0x56424a[_0x76d0('0x13')][_0x76d0('0x12')]);}})[_0x76d0('0x14')](function(_0x48f312){logger[_0x76d0('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x31fce9,_0x48f312);_0xcd392d(_0x48f312);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3451e89..2bbf32f 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 _0xa5ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xe90882,_0x4dd072){var _0x150545=function(_0x2e2cc6){while(--_0x2e2cc6){_0xe90882['push'](_0xe90882['shift']());}};_0x150545(++_0x4dd072);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xa5ca[_0x223461];return _0x4dbe0a;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa5c('0x3')]();var fs_extra=require(_0xaa5c('0x4'));var auth=require(_0xaa5c('0x5'));var interaction=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var controller=require(_0xaa5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaa5c('0x9')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['show']);router['post']('/',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xc')]);router[_0xaa5c('0xd')]('/:id',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xe')]);router[_0xaa5c('0xf')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x10')]);module[_0xaa5c('0x11')]=router; \ No newline at end of file +var _0x50a8=['multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports'];(function(_0xed952f,_0x17420e){var _0x585cd1=function(_0x5a6982){while(--_0x5a6982){_0xed952f['push'](_0xed952f['shift']());}};_0x585cd1(++_0x17420e);}(_0x50a8,0x198));var _0x850a=function(_0x132edb,_0x54e052){_0x132edb=_0x132edb-0x0;var _0x294aab=_0x50a8[_0x132edb];return _0x294aab;};'use strict';var multer=require(_0x850a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x850a('0x1'));var router=express['Router']();var fs_extra=require(_0x850a('0x2'));var auth=require(_0x850a('0x3'));var interaction=require(_0x850a('0x4'));var config=require(_0x850a('0x5'));var controller=require(_0x850a('0x6'));router[_0x850a('0x7')]('/',auth[_0x850a('0x8')](),controller[_0x850a('0x9')]);router[_0x850a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x850a('0xa')]);router[_0x850a('0xb')]('/',auth[_0x850a('0x8')](),controller[_0x850a('0xc')]);router['put'](_0x850a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x850a('0xe')](_0x850a('0xd'),auth[_0x850a('0x8')](),controller[_0x850a('0xf')]);module[_0x850a('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 9ccf0fb..e6fe583 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 _0x3830=['variable','picklist','STRING','customVariable','sequelize','ENUM','string'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3830,0x115));var _0x0383=function(_0x5874ca,_0xf90b52){_0x5874ca=_0x5874ca-0x0;var _0x4b41d7=_0x3830[_0x5874ca];return _0x4b41d7;};'use strict';var Sequelize=require(_0x0383('0x0'));module['exports']={'type':{'type':Sequelize[_0x0383('0x1')](_0x0383('0x2'),_0x0383('0x3'),'customVariable','keyValue',_0x0383('0x4')),'defaultValue':_0x0383('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0383('0x5')]},'keyType':{'type':Sequelize[_0x0383('0x1')](_0x0383('0x2'),_0x0383('0x3'),_0x0383('0x6'))},'keyContent':{'type':Sequelize[_0x0383('0x5')]},'idField':{'type':Sequelize[_0x0383('0x5')]},'nameField':{'type':Sequelize[_0x0383('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0383('0x5')]}}; \ No newline at end of file +var _0x3ff1=['sequelize','exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN'];(function(_0x1ea6eb,_0x33d3d4){var _0x127200=function(_0x5ef9b8){while(--_0x5ef9b8){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x127200(++_0x33d3d4);}(_0x3ff1,0x132));var _0x13ff=function(_0x46d14b,_0x147907){_0x46d14b=_0x46d14b-0x0;var _0x367dfd=_0x3ff1[_0x46d14b];return _0x367dfd;};'use strict';var Sequelize=require(_0x13ff('0x0'));module[_0x13ff('0x1')]={'type':{'type':Sequelize[_0x13ff('0x2')](_0x13ff('0x3'),'variable',_0x13ff('0x4'),'keyValue',_0x13ff('0x5')),'defaultValue':_0x13ff('0x3')},'content':{'type':Sequelize[_0x13ff('0x6')]},'key':{'type':Sequelize[_0x13ff('0x6')]},'keyType':{'type':Sequelize[_0x13ff('0x2')]('string',_0x13ff('0x7'),_0x13ff('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x13ff('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x13ff('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x13ff('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 9bfe9a5..068d4c7 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 _0x4f8e=['offset','limit','apply','save','update','then','destroy','end','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','create','body','find','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x23fd09,_0x51c74c){var _0x5d8176=function(_0x178bc6){while(--_0x178bc6){_0x23fd09['push'](_0x23fd09['shift']());}};_0x5d8176(++_0x51c74c);}(_0x4f8e,0x1e3));var _0xe4f8=function(_0x17eba5,_0x434f32){_0x17eba5=_0x17eba5-0x0;var _0x1aa6f1=_0x4f8e[_0x17eba5];return _0x1aa6f1;};'use strict';var emlformat=require(_0xe4f8('0x0'));var rimraf=require(_0xe4f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe4f8('0x2'));var moment=require(_0xe4f8('0x3'));var BPromise=require(_0xe4f8('0x4'));var Mustache=require(_0xe4f8('0x5'));var util=require(_0xe4f8('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4f8('0x7'));var fs=require('fs');var fs_extra=require(_0xe4f8('0x8'));var _=require('lodash');var squel=require(_0xe4f8('0x9'));var crypto=require(_0xe4f8('0xa'));var jsforce=require(_0xe4f8('0xb'));var deskjs=require(_0xe4f8('0xc'));var toCsv=require(_0xe4f8('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4f8('0xe'));var authService=require(_0xe4f8('0xf'));var qs=require(_0xe4f8('0x10'));var as=require(_0xe4f8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4f8('0x12'))(_0xe4f8('0x13'));var utils=require(_0xe4f8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe4f8('0x15'));var db=require(_0xe4f8('0x16'))['db'];function respondWithStatusCode(_0x5754d6,_0x39c92c){_0x39c92c=_0x39c92c||0xcc;return function(_0xb23f10){if(_0xb23f10){return _0x5754d6[_0xe4f8('0x17')](_0x39c92c);}return _0x5754d6['status'](_0x39c92c)['end']();};}function respondWithResult(_0x4d46fb,_0x192161){_0x192161=_0x192161||0xc8;return function(_0x30e6e5){if(_0x30e6e5){return _0x4d46fb[_0xe4f8('0x18')](_0x192161)[_0xe4f8('0x19')](_0x30e6e5);}};}function respondWithFilteredResult(_0x59f232,_0xd8123b){return function(_0x2b11f2){if(_0x2b11f2){var _0xb68000=typeof _0xd8123b['offset']===_0xe4f8('0x1a')&&typeof _0xd8123b['limit']===_0xe4f8('0x1a');var _0x1642f0=_0x2b11f2[_0xe4f8('0x1b')];var _0x4c7122=_0xb68000?0x0:_0xd8123b[_0xe4f8('0x1c')];var _0x577b72=_0xb68000?_0x2b11f2[_0xe4f8('0x1b')]:_0xd8123b[_0xe4f8('0x1c')]+_0xd8123b[_0xe4f8('0x1d')];var _0x43ce8a;if(_0x577b72>=_0x1642f0){_0x577b72=_0x1642f0;_0x43ce8a=0xc8;}else{_0x43ce8a=0xce;}_0x59f232[_0xe4f8('0x18')](_0x43ce8a);return _0x59f232['set']('Content-Range',_0x4c7122+'-'+_0x577b72+'/'+_0x1642f0)[_0xe4f8('0x19')](_0x2b11f2);}return null;};}function patchUpdates(_0x364880){return function(_0x89eeda){try{jsonpatch[_0xe4f8('0x1e')](_0x89eeda,_0x364880,!![]);}catch(_0x1d68bb){return BPromise['reject'](_0x1d68bb);}return _0x89eeda[_0xe4f8('0x1f')]();};}function saveUpdates(_0x53a677,_0x2f9a07){return function(_0x335657){if(_0x335657){return _0x335657[_0xe4f8('0x20')](_0x53a677)[_0xe4f8('0x21')](function(_0x200133){return _0x200133;});}return null;};}function removeEntity(_0x3abe00,_0x3a0cf6){return function(_0x276d90){if(_0x276d90){return _0x276d90[_0xe4f8('0x22')]()[_0xe4f8('0x21')](function(){_0x3abe00[_0xe4f8('0x18')](0xcc)[_0xe4f8('0x23')]();});}};}function handleEntityNotFound(_0x25c2e7,_0x14b716){return function(_0x8f6c1b){if(!_0x8f6c1b){_0x25c2e7[_0xe4f8('0x17')](0x194);}return _0x8f6c1b;};}function handleError(_0x158b36,_0xdf8017){_0xdf8017=_0xdf8017||0x1f4;return function(_0x54c7e5){logger[_0xe4f8('0x24')](_0x54c7e5['stack']);if(_0x54c7e5[_0xe4f8('0x25')]){delete _0x54c7e5[_0xe4f8('0x25')];}_0x158b36[_0xe4f8('0x18')](_0xdf8017)[_0xe4f8('0x26')](_0x54c7e5);};}exports[_0xe4f8('0x27')]=function(_0x2230f9,_0x448ebb){var _0x352ea2={},_0x160ca2={},_0x1309cd={'count':0x0,'rows':[]};var _0x519157=_[_0xe4f8('0x28')](db[_0xe4f8('0x29')][_0xe4f8('0x2a')],function(_0x26ea04){return{'name':_0x26ea04[_0xe4f8('0x2b')],'type':_0x26ea04['type'][_0xe4f8('0x2c')]};});_0x160ca2[_0xe4f8('0x2d')]=_[_0xe4f8('0x28')](_0x519157,'name');_0x160ca2[_0xe4f8('0x2e')]=_[_0xe4f8('0x2f')](_0x2230f9[_0xe4f8('0x2e')]);_0x160ca2[_0xe4f8('0x30')]=_[_0xe4f8('0x31')](_0x160ca2[_0xe4f8('0x2d')],_0x160ca2['query']);_0x352ea2['attributes']=_['intersection'](_0x160ca2[_0xe4f8('0x2d')],qs[_0xe4f8('0x32')](_0x2230f9[_0xe4f8('0x2e')][_0xe4f8('0x32')]));_0x352ea2[_0xe4f8('0x33')]=_0x352ea2['attributes'][_0xe4f8('0x34')]?_0x352ea2[_0xe4f8('0x33')]:_0x160ca2[_0xe4f8('0x2d')];if(!_0x2230f9['query'][_0xe4f8('0x35')](_0xe4f8('0x36'))){_0x352ea2[_0xe4f8('0x1d')]=qs[_0xe4f8('0x1d')](_0x2230f9[_0xe4f8('0x2e')][_0xe4f8('0x1d')]);_0x352ea2[_0xe4f8('0x1c')]=qs['offset'](_0x2230f9[_0xe4f8('0x2e')][_0xe4f8('0x1c')]);}_0x352ea2[_0xe4f8('0x37')]=qs['sort'](_0x2230f9['query'][_0xe4f8('0x38')]);_0x352ea2[_0xe4f8('0x39')]=qs[_0xe4f8('0x30')](_[_0xe4f8('0x3a')](_0x2230f9[_0xe4f8('0x2e')],_0x160ca2[_0xe4f8('0x30')]),_0x519157);if(_0x2230f9['query'][_0xe4f8('0x3b')]){_0x352ea2[_0xe4f8('0x39')]=_[_0xe4f8('0x3c')](_0x352ea2['where'],{'$or':_['map'](_0x519157,function(_0x41c753){if(_0x41c753[_0xe4f8('0x3d')]!==_0xe4f8('0x3e')){var _0x3d1bdf={};_0x3d1bdf[_0x41c753[_0xe4f8('0x25')]]={'$like':'%'+_0x2230f9['query'][_0xe4f8('0x3b')]+'%'};return _0x3d1bdf;}})});}_0x352ea2=_['merge']({},_0x352ea2,_0x2230f9[_0xe4f8('0x3f')]);var _0x452897={'where':_0x352ea2['where']};return db[_0xe4f8('0x29')][_0xe4f8('0x1b')](_0x452897)[_0xe4f8('0x21')](function(_0x32ac84){_0x1309cd[_0xe4f8('0x1b')]=_0x32ac84;if(_0x2230f9[_0xe4f8('0x2e')]['includeAll']){_0x352ea2[_0xe4f8('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0xe4f8('0x41')](_0x352ea2);})[_0xe4f8('0x21')](function(_0x2cd854){_0x1309cd[_0xe4f8('0x42')]=_0x2cd854;return _0x1309cd;})['then'](respondWithFilteredResult(_0x448ebb,_0x352ea2))[_0xe4f8('0x43')](handleError(_0x448ebb,null));};exports[_0xe4f8('0x44')]=function(_0x58e7d3,_0x5e7f6a){var _0x4703b8={'raw':!![],'where':{'id':_0x58e7d3['params']['id']}},_0x5bef0e={};_0x5bef0e[_0xe4f8('0x2d')]=_[_0xe4f8('0x2f')](db[_0xe4f8('0x29')][_0xe4f8('0x2a')]);_0x5bef0e[_0xe4f8('0x2e')]=_[_0xe4f8('0x2f')](_0x58e7d3[_0xe4f8('0x2e')]);_0x5bef0e[_0xe4f8('0x30')]=_[_0xe4f8('0x31')](_0x5bef0e[_0xe4f8('0x2d')],_0x5bef0e[_0xe4f8('0x2e')]);_0x4703b8['attributes']=_[_0xe4f8('0x31')](_0x5bef0e[_0xe4f8('0x2d')],qs[_0xe4f8('0x32')](_0x58e7d3['query']['fields']));_0x4703b8[_0xe4f8('0x33')]=_0x4703b8['attributes'][_0xe4f8('0x34')]?_0x4703b8[_0xe4f8('0x33')]:_0x5bef0e[_0xe4f8('0x2d')];if(_0x58e7d3[_0xe4f8('0x2e')]['includeAll']){_0x4703b8[_0xe4f8('0x40')]=[{'all':!![]}];}_0x4703b8=_[_0xe4f8('0x3c')]({},_0x4703b8,_0x58e7d3['options']);return db[_0xe4f8('0x29')]['find'](_0x4703b8)['then'](handleEntityNotFound(_0x5e7f6a,null))[_0xe4f8('0x21')](respondWithResult(_0x5e7f6a,null))[_0xe4f8('0x43')](handleError(_0x5e7f6a,null));};exports['create']=function(_0x9c5394,_0x4d74c1){return db[_0xe4f8('0x29')][_0xe4f8('0x45')](_0x9c5394[_0xe4f8('0x46')],{})[_0xe4f8('0x21')](respondWithResult(_0x4d74c1,0xc9))[_0xe4f8('0x43')](handleError(_0x4d74c1,null));};exports['update']=function(_0x504b26,_0x300e36){if(_0x504b26[_0xe4f8('0x46')]['id']){delete _0x504b26[_0xe4f8('0x46')]['id'];}return db[_0xe4f8('0x29')][_0xe4f8('0x47')]({'where':{'id':_0x504b26[_0xe4f8('0x48')]['id']}})[_0xe4f8('0x21')](handleEntityNotFound(_0x300e36,null))['then'](saveUpdates(_0x504b26[_0xe4f8('0x46')],null))[_0xe4f8('0x21')](respondWithResult(_0x300e36,null))[_0xe4f8('0x43')](handleError(_0x300e36,null));};exports[_0xe4f8('0x22')]=function(_0x551997,_0x4e339d){return db['FreshsalesField'][_0xe4f8('0x47')]({'where':{'id':_0x551997[_0xe4f8('0x48')]['id']}})[_0xe4f8('0x21')](handleEntityNotFound(_0x4e339d,null))['then'](removeEntity(_0x4e339d,null))[_0xe4f8('0x43')](handleError(_0x4e339d,null));}; \ No newline at end of file +var _0x3b5a=['stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','FreshsalesField','includeAll','include','catch','show','params','keys','attributes','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0xf1765a,_0xd2c928){var _0xc7fc31=function(_0x269414){while(--_0x269414){_0xf1765a['push'](_0xf1765a['shift']());}};_0xc7fc31(++_0xd2c928);}(_0x3b5a,0x67));var _0xa3b5=function(_0x3c23fd,_0x2018c2){_0x3c23fd=_0x3c23fd-0x0;var _0x3636a1=_0x3b5a[_0x3c23fd];return _0x3636a1;};'use strict';var emlformat=require(_0xa3b5('0x0'));var rimraf=require(_0xa3b5('0x1'));var zipdir=require(_0xa3b5('0x2'));var jsonpatch=require(_0xa3b5('0x3'));var rp=require(_0xa3b5('0x4'));var moment=require(_0xa3b5('0x5'));var BPromise=require(_0xa3b5('0x6'));var Mustache=require(_0xa3b5('0x7'));var util=require('util');var path=require(_0xa3b5('0x8'));var sox=require('sox');var csv=require(_0xa3b5('0x9'));var ejs=require(_0xa3b5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3b5('0xb'));var squel=require(_0xa3b5('0xc'));var crypto=require(_0xa3b5('0xd'));var jsforce=require(_0xa3b5('0xe'));var deskjs=require(_0xa3b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa3b5('0x10'));var Papa=require('papaparse');var Redis=require(_0xa3b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa3b5('0x12'));var as=require(_0xa3b5('0x13'));var hardwareService=require(_0xa3b5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa3b5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa3b5('0x16'));var db=require(_0xa3b5('0x17'))['db'];function respondWithStatusCode(_0x2bdd01,_0xb6ddd5){_0xb6ddd5=_0xb6ddd5||0xcc;return function(_0xa53bc3){if(_0xa53bc3){return _0x2bdd01[_0xa3b5('0x18')](_0xb6ddd5);}return _0x2bdd01['status'](_0xb6ddd5)[_0xa3b5('0x19')]();};}function respondWithResult(_0x43cec2,_0x2054ea){_0x2054ea=_0x2054ea||0xc8;return function(_0x3da2e2){if(_0x3da2e2){return _0x43cec2['status'](_0x2054ea)['json'](_0x3da2e2);}};}function respondWithFilteredResult(_0x29a093,_0x11fd58){return function(_0x48a3b1){if(_0x48a3b1){var _0x4f0e12=typeof _0x11fd58[_0xa3b5('0x1a')]===_0xa3b5('0x1b')&&typeof _0x11fd58[_0xa3b5('0x1c')]===_0xa3b5('0x1b');var _0x51fbfb=_0x48a3b1[_0xa3b5('0x1d')];var _0xe41034=_0x4f0e12?0x0:_0x11fd58[_0xa3b5('0x1a')];var _0xe3900a=_0x4f0e12?_0x48a3b1[_0xa3b5('0x1d')]:_0x11fd58[_0xa3b5('0x1a')]+_0x11fd58[_0xa3b5('0x1c')];var _0x50d3c7;if(_0xe3900a>=_0x51fbfb){_0xe3900a=_0x51fbfb;_0x50d3c7=0xc8;}else{_0x50d3c7=0xce;}_0x29a093[_0xa3b5('0x1e')](_0x50d3c7);return _0x29a093[_0xa3b5('0x1f')](_0xa3b5('0x20'),_0xe41034+'-'+_0xe3900a+'/'+_0x51fbfb)['json'](_0x48a3b1);}return null;};}function patchUpdates(_0xa70d26){return function(_0x4675a3){try{jsonpatch[_0xa3b5('0x21')](_0x4675a3,_0xa70d26,!![]);}catch(_0x1185b9){return BPromise[_0xa3b5('0x22')](_0x1185b9);}return _0x4675a3[_0xa3b5('0x23')]();};}function saveUpdates(_0x1f4c8e,_0x2945f8){return function(_0x93f83c){if(_0x93f83c){return _0x93f83c['update'](_0x1f4c8e)[_0xa3b5('0x24')](function(_0x1643f6){return _0x1643f6;});}return null;};}function removeEntity(_0x204e90,_0x45490b){return function(_0x5791ff){if(_0x5791ff){return _0x5791ff[_0xa3b5('0x25')]()[_0xa3b5('0x24')](function(){_0x204e90[_0xa3b5('0x1e')](0xcc)[_0xa3b5('0x19')]();});}};}function handleEntityNotFound(_0x45902c,_0x5b864b){return function(_0x300b8e){if(!_0x300b8e){_0x45902c['sendStatus'](0x194);}return _0x300b8e;};}function handleError(_0x2b4aae,_0x2b3fbc){_0x2b3fbc=_0x2b3fbc||0x1f4;return function(_0x33d9d8){logger[_0xa3b5('0x26')](_0x33d9d8[_0xa3b5('0x27')]);if(_0x33d9d8['name']){delete _0x33d9d8[_0xa3b5('0x28')];}_0x2b4aae[_0xa3b5('0x1e')](_0x2b3fbc)['send'](_0x33d9d8);};}exports[_0xa3b5('0x29')]=function(_0x537ff6,_0x3eeebb){var _0x35c764={},_0x247b4f={},_0x3f62ce={'count':0x0,'rows':[]};var _0x44f61e=_[_0xa3b5('0x2a')](db['FreshsalesField'][_0xa3b5('0x2b')],function(_0x438412){return{'name':_0x438412[_0xa3b5('0x2c')],'type':_0x438412[_0xa3b5('0x2d')]['key']};});_0x247b4f[_0xa3b5('0x2e')]=_[_0xa3b5('0x2a')](_0x44f61e,_0xa3b5('0x28'));_0x247b4f[_0xa3b5('0x2f')]=_['keys'](_0x537ff6[_0xa3b5('0x2f')]);_0x247b4f[_0xa3b5('0x30')]=_[_0xa3b5('0x31')](_0x247b4f[_0xa3b5('0x2e')],_0x247b4f[_0xa3b5('0x2f')]);_0x35c764['attributes']=_['intersection'](_0x247b4f[_0xa3b5('0x2e')],qs[_0xa3b5('0x32')](_0x537ff6[_0xa3b5('0x2f')][_0xa3b5('0x32')]));_0x35c764['attributes']=_0x35c764['attributes']['length']?_0x35c764['attributes']:_0x247b4f[_0xa3b5('0x2e')];if(!_0x537ff6[_0xa3b5('0x2f')][_0xa3b5('0x33')](_0xa3b5('0x34'))){_0x35c764['limit']=qs[_0xa3b5('0x1c')](_0x537ff6['query']['limit']);_0x35c764['offset']=qs[_0xa3b5('0x1a')](_0x537ff6[_0xa3b5('0x2f')][_0xa3b5('0x1a')]);}_0x35c764['order']=qs[_0xa3b5('0x35')](_0x537ff6['query'][_0xa3b5('0x35')]);_0x35c764[_0xa3b5('0x36')]=qs[_0xa3b5('0x30')](_['pick'](_0x537ff6[_0xa3b5('0x2f')],_0x247b4f[_0xa3b5('0x30')]),_0x44f61e);if(_0x537ff6[_0xa3b5('0x2f')][_0xa3b5('0x37')]){_0x35c764[_0xa3b5('0x36')]=_[_0xa3b5('0x38')](_0x35c764[_0xa3b5('0x36')],{'$or':_[_0xa3b5('0x2a')](_0x44f61e,function(_0x502dc7){if(_0x502dc7[_0xa3b5('0x2d')]!=='VIRTUAL'){var _0x3af140={};_0x3af140[_0x502dc7[_0xa3b5('0x28')]]={'$like':'%'+_0x537ff6[_0xa3b5('0x2f')]['filter']+'%'};return _0x3af140;}})});}_0x35c764=_[_0xa3b5('0x38')]({},_0x35c764,_0x537ff6[_0xa3b5('0x39')]);var _0x3e2a8f={'where':_0x35c764[_0xa3b5('0x36')]};return db[_0xa3b5('0x3a')][_0xa3b5('0x1d')](_0x3e2a8f)['then'](function(_0x477c63){_0x3f62ce[_0xa3b5('0x1d')]=_0x477c63;if(_0x537ff6['query'][_0xa3b5('0x3b')]){_0x35c764[_0xa3b5('0x3c')]=[{'all':!![]}];}return db[_0xa3b5('0x3a')]['findAll'](_0x35c764);})['then'](function(_0x53e496){_0x3f62ce['rows']=_0x53e496;return _0x3f62ce;})[_0xa3b5('0x24')](respondWithFilteredResult(_0x3eeebb,_0x35c764))[_0xa3b5('0x3d')](handleError(_0x3eeebb,null));};exports[_0xa3b5('0x3e')]=function(_0x4627b7,_0x5425d6){var _0x10ab12={'raw':!![],'where':{'id':_0x4627b7[_0xa3b5('0x3f')]['id']}},_0x2b8b4c={};_0x2b8b4c[_0xa3b5('0x2e')]=_[_0xa3b5('0x40')](db[_0xa3b5('0x3a')]['rawAttributes']);_0x2b8b4c[_0xa3b5('0x2f')]=_[_0xa3b5('0x40')](_0x4627b7[_0xa3b5('0x2f')]);_0x2b8b4c[_0xa3b5('0x30')]=_['intersection'](_0x2b8b4c[_0xa3b5('0x2e')],_0x2b8b4c[_0xa3b5('0x2f')]);_0x10ab12['attributes']=_[_0xa3b5('0x31')](_0x2b8b4c[_0xa3b5('0x2e')],qs[_0xa3b5('0x32')](_0x4627b7[_0xa3b5('0x2f')][_0xa3b5('0x32')]));_0x10ab12['attributes']=_0x10ab12[_0xa3b5('0x41')][_0xa3b5('0x42')]?_0x10ab12[_0xa3b5('0x41')]:_0x2b8b4c[_0xa3b5('0x2e')];if(_0x4627b7[_0xa3b5('0x2f')][_0xa3b5('0x3b')]){_0x10ab12[_0xa3b5('0x3c')]=[{'all':!![]}];}_0x10ab12=_[_0xa3b5('0x38')]({},_0x10ab12,_0x4627b7['options']);return db[_0xa3b5('0x3a')][_0xa3b5('0x43')](_0x10ab12)[_0xa3b5('0x24')](handleEntityNotFound(_0x5425d6,null))[_0xa3b5('0x24')](respondWithResult(_0x5425d6,null))[_0xa3b5('0x3d')](handleError(_0x5425d6,null));};exports[_0xa3b5('0x44')]=function(_0x3ba108,_0x8b5ab3){return db[_0xa3b5('0x3a')][_0xa3b5('0x44')](_0x3ba108[_0xa3b5('0x45')],{})[_0xa3b5('0x24')](respondWithResult(_0x8b5ab3,0xc9))[_0xa3b5('0x3d')](handleError(_0x8b5ab3,null));};exports[_0xa3b5('0x46')]=function(_0x2dc2b8,_0x18a843){if(_0x2dc2b8['body']['id']){delete _0x2dc2b8[_0xa3b5('0x45')]['id'];}return db[_0xa3b5('0x3a')][_0xa3b5('0x43')]({'where':{'id':_0x2dc2b8[_0xa3b5('0x3f')]['id']}})[_0xa3b5('0x24')](handleEntityNotFound(_0x18a843,null))[_0xa3b5('0x24')](saveUpdates(_0x2dc2b8[_0xa3b5('0x45')],null))[_0xa3b5('0x24')](respondWithResult(_0x18a843,null))[_0xa3b5('0x3d')](handleError(_0x18a843,null));};exports[_0xa3b5('0x25')]=function(_0x53cf12,_0x2aa1f8){return db['FreshsalesField'][_0xa3b5('0x43')]({'where':{'id':_0x53cf12[_0xa3b5('0x3f')]['id']}})[_0xa3b5('0x24')](handleEntityNotFound(_0x2aa1f8,null))['then'](removeEntity(_0x2aa1f8,null))['catch'](handleError(_0x2aa1f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f401164..ab1de7b 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 _0xce14=['./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField','FieldId','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3c35da,_0x5dee85){var _0x551fed=function(_0x4d5672){while(--_0x4d5672){_0x3c35da['push'](_0x3c35da['shift']());}};_0x551fed(++_0x5dee85);}(_0xce14,0x17f));var _0x4ce1=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xce14[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x4ce1('0x0'));var logger=require('../../config/logger')(_0x4ce1('0x1'));var moment=require(_0x4ce1('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ce1('0x3'));var fs=require('fs');var path=require(_0x4ce1('0x4'));var rimraf=require(_0x4ce1('0x5'));var config=require(_0x4ce1('0x6'));var attributes=require(_0x4ce1('0x7'));module['exports']=function(_0x10aaa0,_0x3954d4){return _0x10aaa0[_0x4ce1('0x8')](_0x4ce1('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4ce1('0xa'),'fields':[_0x4ce1('0xb'),_0x4ce1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f5=['freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields'];(function(_0x695685,_0x2067b2){var _0x1b2090=function(_0x1325ba){while(--_0x1325ba){_0x695685['push'](_0x695685['shift']());}};_0x1b2090(++_0x2067b2);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x28dc09,_0x1009e9){_0x28dc09=_0x28dc09-0x0;var _0x8a87c8=_0xd2f5[_0x28dc09];return _0x8a87c8;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var logger=require(_0x5d2f('0x2'))(_0x5d2f('0x3'));var moment=require('moment');var BPromise=require(_0x5d2f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var attributes=require(_0x5d2f('0x7'));module['exports']=function(_0x2f7121,_0x2157af){return _0x2f7121[_0x5d2f('0x8')]('FreshsalesField',attributes,{'tableName':_0x5d2f('0x9'),'paranoid':![],'indexes':[{'name':_0x5d2f('0xa'),'fields':[_0x5d2f('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 22b82ef..1d46e22 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x687b,0x14a));var _0xb687=function(_0x51b2f1,_0x22c27a){_0x51b2f1=_0x51b2f1-0x0;var _0xf9ddf8=_0x687b[_0x51b2f1];return _0xf9ddf8;};'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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2779fc,_0x3491f2){var _0x241a2d=function(_0x36daf2){while(--_0x36daf2){_0x2779fc['push'](_0x2779fc['shift']());}};_0x241a2d(++_0x3491f2);}(_0x90b1,0x1bb));var _0x190b=function(_0x286c17,_0x51742e){_0x286c17=_0x286c17-0x0;var _0x52f89c=_0x90b1[_0x286c17];return _0x52f89c;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3a4ce6b..92145a5 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x29c4d0,_0x1b1b76){var _0x29eec5=function(_0x4cec11){while(--_0x4cec11){_0x29c4d0['push'](_0x29c4d0['shift']());}};_0x29eec5(++_0x1b1b76);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2cc862,_0x55a9a3){var _0x2d9e4d=function(_0x455107){while(--_0x455107){_0x2cc862['push'](_0x2cc862['shift']());}};_0x2d9e4d(++_0x55a9a3);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b2a54b2..4a6e3db 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 _0x8861=['username','ENUM','integrationTab','newTab','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8861,0x6d));var _0x1886=function(_0x136116,_0xb1856e){_0x136116=_0x136116-0x0;var _0x204c6b=_0x8861[_0x136116];return _0x204c6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1886('0x0')]},'description':{'type':Sequelize[_0x1886('0x0')]},'username':{'type':Sequelize[_0x1886('0x0')],'unique':_0x1886('0x1')},'remoteUri':{'type':Sequelize[_0x1886('0x0')]},'password':{'type':Sequelize[_0x1886('0x0')]},'clientId':{'type':Sequelize[_0x1886('0x0')]},'clientSecret':{'type':Sequelize[_0x1886('0x0')]},'securityToken':{'type':Sequelize[_0x1886('0x0')]},'serverUrl':{'type':Sequelize[_0x1886('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x1886('0x2')](_0x1886('0x3'),_0x1886('0x4')),'defaultValue':_0x1886('0x3')}}; \ No newline at end of file +var _0xc2c7=['username','ENUM','integrationTab','exports','STRING'];(function(_0x24e27b,_0x15f684){var _0x3ee7d5=function(_0x1f2c8c){while(--_0x1f2c8c){_0x24e27b['push'](_0x24e27b['shift']());}};_0x3ee7d5(++_0x15f684);}(_0xc2c7,0x134));var _0x7c2c=function(_0x12dbe8,_0x5d33f6){_0x12dbe8=_0x12dbe8-0x0;var _0x26046d=_0xc2c7[_0x12dbe8];return _0x26046d;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')]},'password':{'type':Sequelize[_0x7c2c('0x1')]},'clientId':{'type':Sequelize[_0x7c2c('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7c2c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7c2c('0x3')](_0x7c2c('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7b5b4b9..8ea33b9 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 _0xc108=['stack','name','send','index','map','SalesforceAccount','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','findOne','rawAttributes','pick','nolimit','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','clientSecret','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x56a1e3,_0x15d568){var _0x1ab8e0=function(_0xc69208){while(--_0xc69208){_0x56a1e3['push'](_0x56a1e3['shift']());}};_0x1ab8e0(++_0x15d568);}(_0xc108,0xcf));var _0x8c10=function(_0x44ffee,_0x1b5dc6){_0x44ffee=_0x44ffee-0x0;var _0x56a4d2=_0xc108[_0x44ffee];return _0x56a4d2;};'use strict';var emlformat=require(_0x8c10('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8c10('0x1'));var rp=require(_0x8c10('0x2'));var moment=require('moment');var BPromise=require(_0x8c10('0x3'));var Mustache=require('mustache');var util=require(_0x8c10('0x4'));var path=require(_0x8c10('0x5'));var sox=require(_0x8c10('0x6'));var csv=require('to-csv');var ejs=require(_0x8c10('0x7'));var fs=require('fs');var fs_extra=require(_0x8c10('0x8'));var _=require(_0x8c10('0x9'));var squel=require('squel');var crypto=require(_0x8c10('0xa'));var jsforce=require(_0x8c10('0xb'));var deskjs=require(_0x8c10('0xc'));var toCsv=require(_0x8c10('0xd'));var querystring=require(_0x8c10('0xe'));var Papa=require(_0x8c10('0xf'));var Redis=require(_0x8c10('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8c10('0x11'));var as=require(_0x8c10('0x12'));var hardwareService=require(_0x8c10('0x13'));var logger=require(_0x8c10('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c10('0x15'));var db=require(_0x8c10('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b84e3,_0x4b7f46){_0x4b7f46=_0x4b7f46||0xcc;return function(_0x13505f){if(_0x13505f){return _0x5b84e3[_0x8c10('0x17')](_0x4b7f46);}return _0x5b84e3[_0x8c10('0x18')](_0x4b7f46)[_0x8c10('0x19')]();};}function respondWithResult(_0x3aa509,_0x5ab750){_0x5ab750=_0x5ab750||0xc8;return function(_0x5cfa88){if(_0x5cfa88){return _0x3aa509[_0x8c10('0x18')](_0x5ab750)[_0x8c10('0x1a')](_0x5cfa88);}};}function respondWithFilteredResult(_0x2de8fc,_0x3e1b62){return function(_0x3129e3){if(_0x3129e3){var _0x489515=typeof _0x3e1b62[_0x8c10('0x1b')]==='undefined'&&typeof _0x3e1b62[_0x8c10('0x1c')]===_0x8c10('0x1d');var _0x240921=_0x3129e3[_0x8c10('0x1e')];var _0x448f83=_0x489515?0x0:_0x3e1b62[_0x8c10('0x1b')];var _0x5d4f62=_0x489515?_0x3129e3[_0x8c10('0x1e')]:_0x3e1b62[_0x8c10('0x1b')]+_0x3e1b62[_0x8c10('0x1c')];var _0x2bb42d;if(_0x5d4f62>=_0x240921){_0x5d4f62=_0x240921;_0x2bb42d=0xc8;}else{_0x2bb42d=0xce;}_0x2de8fc['status'](_0x2bb42d);return _0x2de8fc[_0x8c10('0x1f')](_0x8c10('0x20'),_0x448f83+'-'+_0x5d4f62+'/'+_0x240921)[_0x8c10('0x1a')](_0x3129e3);}return null;};}function patchUpdates(_0x37dd13){return function(_0x4f590d){try{jsonpatch[_0x8c10('0x21')](_0x4f590d,_0x37dd13,!![]);}catch(_0x3824b8){return BPromise['reject'](_0x3824b8);}return _0x4f590d[_0x8c10('0x22')]();};}function saveUpdates(_0x4176c7,_0x187260){return function(_0x25ffa4){if(_0x25ffa4){return _0x25ffa4[_0x8c10('0x23')](_0x4176c7)[_0x8c10('0x24')](function(_0x4c1ea6){return _0x4c1ea6;});}return null;};}function removeEntity(_0x47e90f,_0x26795e){return function(_0x130aab){if(_0x130aab){return _0x130aab[_0x8c10('0x25')]()[_0x8c10('0x24')](function(){_0x47e90f[_0x8c10('0x18')](0xcc)[_0x8c10('0x19')]();});}};}function handleEntityNotFound(_0x2b8cfd,_0x1d480e){return function(_0x8c907c){if(!_0x8c907c){_0x2b8cfd[_0x8c10('0x17')](0x194);}return _0x8c907c;};}function handleError(_0x3ca5ff,_0x24a464){_0x24a464=_0x24a464||0x1f4;return function(_0x6a8078){logger[_0x8c10('0x26')](_0x6a8078[_0x8c10('0x27')]);if(_0x6a8078['name']){delete _0x6a8078[_0x8c10('0x28')];}_0x3ca5ff[_0x8c10('0x18')](_0x24a464)[_0x8c10('0x29')](_0x6a8078);};}exports[_0x8c10('0x2a')]=function(_0x57bc2e,_0x4e2886){var _0x2875a5={},_0x5de232={},_0x3928ab={'count':0x0,'rows':[]};var _0x84befa=_[_0x8c10('0x2b')](db[_0x8c10('0x2c')]['rawAttributes'],function(_0x3b84d3){return{'name':_0x3b84d3['fieldName'],'type':_0x3b84d3['type'][_0x8c10('0x2d')]};});_0x5de232['model']=_[_0x8c10('0x2b')](_0x84befa,_0x8c10('0x28'));_0x5de232[_0x8c10('0x2e')]=_[_0x8c10('0x2f')](_0x57bc2e['query']);_0x5de232['filters']=_[_0x8c10('0x30')](_0x5de232['model'],_0x5de232['query']);_0x2875a5[_0x8c10('0x31')]=_[_0x8c10('0x30')](_0x5de232[_0x8c10('0x32')],qs[_0x8c10('0x33')](_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x33')]));_0x2875a5[_0x8c10('0x31')]=_0x2875a5['attributes'][_0x8c10('0x34')]?_0x2875a5[_0x8c10('0x31')]:_0x5de232[_0x8c10('0x32')];if(!_0x57bc2e['query'][_0x8c10('0x35')]('nolimit')){_0x2875a5[_0x8c10('0x1c')]=qs['limit'](_0x57bc2e[_0x8c10('0x2e')]['limit']);_0x2875a5[_0x8c10('0x1b')]=qs[_0x8c10('0x1b')](_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x1b')]);}_0x2875a5[_0x8c10('0x36')]=qs[_0x8c10('0x37')](_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x37')]);_0x2875a5[_0x8c10('0x38')]=qs[_0x8c10('0x39')](_['pick'](_0x57bc2e['query'],_0x5de232[_0x8c10('0x39')]),_0x84befa);if(_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x3a')]){_0x2875a5[_0x8c10('0x38')]=_[_0x8c10('0x3b')](_0x2875a5[_0x8c10('0x38')],{'$or':_[_0x8c10('0x2b')](_0x84befa,function(_0x4abda5){if(_0x4abda5[_0x8c10('0x3c')]!==_0x8c10('0x3d')){var _0x2b78c5={};_0x2b78c5[_0x4abda5[_0x8c10('0x28')]]={'$like':'%'+_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x3a')]+'%'};return _0x2b78c5;}})});}_0x2875a5=_[_0x8c10('0x3b')]({},_0x2875a5,_0x57bc2e[_0x8c10('0x3e')]);var _0x52865f={'where':_0x2875a5[_0x8c10('0x38')]};return db[_0x8c10('0x2c')][_0x8c10('0x1e')](_0x52865f)['then'](function(_0x503f72){_0x3928ab[_0x8c10('0x1e')]=_0x503f72;if(_0x57bc2e[_0x8c10('0x2e')][_0x8c10('0x3f')]){_0x2875a5[_0x8c10('0x40')]=[{'all':!![]}];}return db[_0x8c10('0x2c')][_0x8c10('0x41')](_0x2875a5);})[_0x8c10('0x24')](function(_0x464a9d){_0x3928ab['rows']=_0x464a9d;return _0x3928ab;})[_0x8c10('0x24')](respondWithFilteredResult(_0x4e2886,_0x2875a5))['catch'](handleError(_0x4e2886,null));};exports[_0x8c10('0x42')]=function(_0x411e7f,_0x531908){var _0x1ef755={'raw':![],'where':{'id':_0x411e7f[_0x8c10('0x43')]['id']}},_0x2222fc={};_0x2222fc['model']=_[_0x8c10('0x2f')](db[_0x8c10('0x2c')]['rawAttributes']);_0x2222fc[_0x8c10('0x2e')]=_[_0x8c10('0x2f')](_0x411e7f[_0x8c10('0x2e')]);_0x2222fc[_0x8c10('0x39')]=_['intersection'](_0x2222fc['model'],_0x2222fc['query']);_0x1ef755[_0x8c10('0x31')]=_[_0x8c10('0x30')](_0x2222fc[_0x8c10('0x32')],qs[_0x8c10('0x33')](_0x411e7f['query'][_0x8c10('0x33')]));_0x1ef755[_0x8c10('0x31')]=_0x1ef755[_0x8c10('0x31')]['length']?_0x1ef755[_0x8c10('0x31')]:_0x2222fc[_0x8c10('0x32')];if(_0x411e7f[_0x8c10('0x2e')]['includeAll']){_0x1ef755['include']=[{'all':!![]}];}_0x1ef755=_[_0x8c10('0x3b')]({},_0x1ef755,_0x411e7f[_0x8c10('0x3e')]);return db[_0x8c10('0x2c')][_0x8c10('0x44')](_0x1ef755)[_0x8c10('0x24')](handleEntityNotFound(_0x531908,null))[_0x8c10('0x24')](respondWithResult(_0x531908,null))[_0x8c10('0x45')](handleError(_0x531908,null));};exports[_0x8c10('0x46')]=function(_0x264828,_0x5cf500){return db[_0x8c10('0x2c')]['create'](_0x264828[_0x8c10('0x47')],{})[_0x8c10('0x24')](respondWithResult(_0x5cf500,0xc9))[_0x8c10('0x45')](handleError(_0x5cf500,null));};exports[_0x8c10('0x23')]=function(_0x274903,_0x27921f){if(_0x274903[_0x8c10('0x47')]['id']){delete _0x274903[_0x8c10('0x47')]['id'];}return db[_0x8c10('0x2c')][_0x8c10('0x44')]({'where':{'id':_0x274903[_0x8c10('0x43')]['id']}})[_0x8c10('0x24')](handleEntityNotFound(_0x27921f,null))[_0x8c10('0x24')](saveUpdates(_0x274903[_0x8c10('0x47')],null))[_0x8c10('0x24')](respondWithResult(_0x27921f,null))[_0x8c10('0x45')](handleError(_0x27921f,null));};exports['destroy']=function(_0x3e2ae6,_0x125980){return db[_0x8c10('0x2c')][_0x8c10('0x44')]({'where':{'id':_0x3e2ae6[_0x8c10('0x43')]['id']}})[_0x8c10('0x24')](handleEntityNotFound(_0x125980,null))['then'](removeEntity(_0x125980,null))[_0x8c10('0x45')](handleError(_0x125980,null));};exports['getConfigurations']=function(_0x264fb6,_0x20f0e6,_0x4eb11f){var _0x283d2c={};var _0x34c53e={};var _0xa78dff;var _0x331962;return db[_0x8c10('0x2c')][_0x8c10('0x48')]({'where':{'id':_0x264fb6[_0x8c10('0x43')]['id']}})[_0x8c10('0x24')](handleEntityNotFound(_0x20f0e6,null))[_0x8c10('0x24')](function(_0x3f3997){if(_0x3f3997){_0xa78dff=_0x3f3997;_0x34c53e[_0x8c10('0x32')]=_[_0x8c10('0x2f')](db['SalesforceConfiguration'][_0x8c10('0x49')]);_0x34c53e['query']=_['keys'](_0x264fb6[_0x8c10('0x2e')]);_0x34c53e[_0x8c10('0x39')]=_[_0x8c10('0x30')](_0x34c53e['model'],_0x34c53e[_0x8c10('0x2e')]);_0x283d2c[_0x8c10('0x31')]=_['intersection'](_0x34c53e[_0x8c10('0x32')],qs[_0x8c10('0x33')](_0x264fb6[_0x8c10('0x2e')][_0x8c10('0x33')]));_0x283d2c[_0x8c10('0x31')]=_0x283d2c['attributes'][_0x8c10('0x34')]?_0x283d2c[_0x8c10('0x31')]:_0x34c53e['model'];_0x283d2c[_0x8c10('0x36')]=qs[_0x8c10('0x37')](_0x264fb6[_0x8c10('0x2e')][_0x8c10('0x37')]);_0x283d2c['where']=qs[_0x8c10('0x39')](_[_0x8c10('0x4a')](_0x264fb6[_0x8c10('0x2e')],_0x34c53e[_0x8c10('0x39')]));if(_0x264fb6[_0x8c10('0x2e')][_0x8c10('0x3a')]){_0x283d2c['where']=_[_0x8c10('0x3b')](_0x283d2c['where'],{'$or':_[_0x8c10('0x2b')](_0x283d2c['attributes'],function(_0x551759){var _0x588020={};_0x588020[_0x551759]={'$like':'%'+_0x264fb6['query'][_0x8c10('0x3a')]+'%'};return _0x588020;})});}_0x283d2c=_[_0x8c10('0x3b')]({},_0x283d2c,_0x264fb6[_0x8c10('0x3e')]);return _0xa78dff['getConfigurations'](_0x283d2c);}})[_0x8c10('0x24')](function(_0x5cc7d5){if(_0x5cc7d5){_0x331962=_0x5cc7d5[_0x8c10('0x34')];if(!_0x264fb6[_0x8c10('0x2e')][_0x8c10('0x35')](_0x8c10('0x4b'))){_0x283d2c['limit']=qs['limit'](_0x264fb6['query'][_0x8c10('0x1c')]);_0x283d2c['offset']=qs['offset'](_0x264fb6[_0x8c10('0x2e')][_0x8c10('0x1b')]);}return _0xa78dff[_0x8c10('0x4c')](_0x283d2c);}})[_0x8c10('0x24')](function(_0x4311b5){if(_0x4311b5){return _0x4311b5?{'count':_0x331962,'rows':_0x4311b5}:null;}})['then'](respondWithResult(_0x20f0e6,null))['catch'](handleError(_0x20f0e6,null));};exports[_0x8c10('0x4d')]=function(_0x70bbe4,_0x5950fe,_0x1717a6){if(_0x70bbe4['body']['id']){delete _0x70bbe4[_0x8c10('0x47')]['id'];}return db['SalesforceAccount'][_0x8c10('0x48')]({'where':{'id':_0x70bbe4[_0x8c10('0x43')]['id']}})['then'](handleEntityNotFound(_0x5950fe,null))['then'](function(_0x9fdf){if(_0x9fdf){_0x70bbe4['body']['AccountId']=_0x9fdf['id'];_0x70bbe4[_0x8c10('0x47')]['Subjects']=integrations['getSubjects'](_0x70bbe4[_0x8c10('0x47')][_0x8c10('0x4e')],_0x70bbe4[_0x8c10('0x47')][_0x8c10('0x3c')]);_0x70bbe4[_0x8c10('0x47')][_0x8c10('0x4f')]=integrations[_0x8c10('0x50')](_0x70bbe4['body'][_0x8c10('0x4e')],_0x70bbe4['body'][_0x8c10('0x3c')]);return db['SalesforceConfiguration'][_0x8c10('0x46')](_0x70bbe4[_0x8c10('0x47')],{'include':[{'model':db[_0x8c10('0x51')],'as':_0x8c10('0x52')},{'model':db[_0x8c10('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5950fe,null))[_0x8c10('0x45')](handleError(_0x5950fe,null));};exports[_0x8c10('0x53')]=function(_0x213c8a,_0x3b2515,_0x41617e){var _0x2a8146;var _0x589f81='';var _0x30d79d='Task';return db[_0x8c10('0x2c')][_0x8c10('0x48')]({'where':{'id':_0x213c8a['params']['id']},'attributes':['id',_0x8c10('0x54'),'clientId','clientSecret',_0x8c10('0x55'),_0x8c10('0x56'),_0x8c10('0x57')]})[_0x8c10('0x24')](handleEntityNotFound(_0x3b2515,null))['then'](function(_0x45bf2a){if(_0x45bf2a){_0x589f81=_0x45bf2a[_0x8c10('0x54')];var _0x43ee25=_0x589f81[_0x8c10('0x58')](-0x1);if(_0x43ee25==='/'){_0x589f81=_0x589f81[_0x8c10('0x59')](0x0,_0x589f81[_0x8c10('0x5a')](_0x43ee25));}_0x2a8146=new jsforce[(_0x8c10('0x5b'))]({'oauth2':{'loginUrl':_0x589f81,'clientId':_0x45bf2a[_0x8c10('0x5c')],'clientSecret':_0x45bf2a[_0x8c10('0x5d')]}});return _0x2a8146[_0x8c10('0x5e')](_0x45bf2a[_0x8c10('0x55')],_0x45bf2a[_0x8c10('0x56')][_0x8c10('0x5f')](_0x45bf2a[_0x8c10('0x57')]));}})[_0x8c10('0x24')](function(_0x288d7b){if(_0x288d7b){if(!_[_0x8c10('0x60')](_0x213c8a[_0x8c10('0x2e')]['ticketType'])){_0x30d79d=_0x213c8a[_0x8c10('0x2e')][_0x8c10('0x61')];}return _0x2a8146[_0x8c10('0x62')](_0x30d79d)[_0x8c10('0x63')]();}})[_0x8c10('0x24')](function(_0x2751b5){var _0x48beb4=['OwnerId',_0x8c10('0x64'),_0x8c10('0x65'),_0x8c10('0x66'),_0x8c10('0x67'),'Description'];var _0x48d78f=[_0x8c10('0x68'),'int',_0x8c10('0x69'),_0x8c10('0x6a'),_0x8c10('0x6b'),_0x8c10('0x6c'),_0x8c10('0x6d')];if(_0x2751b5){_[_0x8c10('0x6e')](_0x2751b5[_0x8c10('0x33')],function(_0x50d6bf){return _0x48beb4[_0x8c10('0x6f')](_0x50d6bf[_0x8c10('0x28')])||!_0x48d78f['includes'](_0x50d6bf[_0x8c10('0x3c')]);});return{'count':_0x2751b5[_0x8c10('0x33')][_0x8c10('0x34')],'rows':_['map'](_0x2751b5[_0x8c10('0x33')],function(_0x58aba7){return{'id':_0x58aba7[_0x8c10('0x28')],'name':_0x58aba7[_0x8c10('0x70')],'custom':_0x58aba7['custom'],'options':_0x58aba7['picklistValues']['length']>0x0?_[_0x8c10('0x2b')](_0x58aba7[_0x8c10('0x71')],function(_0x2cbc5e){return{'name':_0x2cbc5e[_0x8c10('0x70')],'value':_0x2cbc5e[_0x8c10('0x72')]};}):_0x58aba7[_0x8c10('0x3c')]==_0x8c10('0x6a')?[{'name':_0x8c10('0x73'),'value':_0x8c10('0x74')},{'name':_0x8c10('0x75'),'value':'false'}]:[]};})};}})[_0x8c10('0x24')](respondWithResult(_0x3b2515,null))[_0x8c10('0x45')](function(_0x42d581){var _0x1ede97=_0x213c8a['query']['test']?0x1f4:_0x42d581[_0x8c10('0x76')]||0x1f4;logger['error'](_0x8c10('0x77'),_0x8c10('0x53'),_0x1ede97,JSON[_0x8c10('0x78')](_0x42d581));delete _0x42d581[_0x8c10('0x28')];if(_0x1ede97===0x191){_0x1ede97=0x190;}_0x3b2515['status'](_0x1ede97)[_0x8c10('0x29')](_0x213c8a['query'][_0x8c10('0x79')]?{'message':_0x8c10('0x7a'),'statusCode':_0x42d581['statusCode']}:_0x42d581);});}; \ No newline at end of file +var _0xa211=['remoteUri','clientId','clientSecret','securityToken','slice','substring','Connection','login','username','password','concat','ticketType','sobject','ActivityDate','IsReminderSet','Subject','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','destroy','then','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','params','includeAll','include','find','create','body','catch','getConfigurations','findOne','SalesforceConfiguration','sort','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa211,0x97));var _0x1a21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa211[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x1a21('0x0'));var rimraf=require(_0x1a21('0x1'));var zipdir=require(_0x1a21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a21('0x3'));var path=require('path');var sox=require(_0x1a21('0x4'));var csv=require(_0x1a21('0x5'));var ejs=require(_0x1a21('0x6'));var fs=require('fs');var fs_extra=require(_0x1a21('0x7'));var _=require(_0x1a21('0x8'));var squel=require(_0x1a21('0x9'));var crypto=require(_0x1a21('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1a21('0xb'));var toCsv=require(_0x1a21('0x5'));var querystring=require('querystring');var Papa=require(_0x1a21('0xc'));var Redis=require(_0x1a21('0xd'));var authService=require(_0x1a21('0xe'));var qs=require(_0x1a21('0xf'));var as=require(_0x1a21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a21('0x11'))(_0x1a21('0x12'));var utils=require('../../config/utils');var config=require(_0x1a21('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a21('0x14'))['db'];var integrations=require(_0x1a21('0x15'));function respondWithStatusCode(_0x571156,_0x465c22){_0x465c22=_0x465c22||0xcc;return function(_0x3e48e6){if(_0x3e48e6){return _0x571156[_0x1a21('0x16')](_0x465c22);}return _0x571156[_0x1a21('0x17')](_0x465c22)[_0x1a21('0x18')]();};}function respondWithResult(_0x3877f2,_0x54de87){_0x54de87=_0x54de87||0xc8;return function(_0x1368fc){if(_0x1368fc){return _0x3877f2['status'](_0x54de87)[_0x1a21('0x19')](_0x1368fc);}};}function respondWithFilteredResult(_0x60f91a,_0x48bd11){return function(_0x4b3696){if(_0x4b3696){var _0x1c64b6=typeof _0x48bd11[_0x1a21('0x1a')]==='undefined'&&typeof _0x48bd11[_0x1a21('0x1b')]===_0x1a21('0x1c');var _0x1979f5=_0x4b3696[_0x1a21('0x1d')];var _0x39ef0d=_0x1c64b6?0x0:_0x48bd11[_0x1a21('0x1a')];var _0x1f70a5=_0x1c64b6?_0x4b3696['count']:_0x48bd11[_0x1a21('0x1a')]+_0x48bd11[_0x1a21('0x1b')];var _0x5735c6;if(_0x1f70a5>=_0x1979f5){_0x1f70a5=_0x1979f5;_0x5735c6=0xc8;}else{_0x5735c6=0xce;}_0x60f91a[_0x1a21('0x17')](_0x5735c6);return _0x60f91a[_0x1a21('0x1e')]('Content-Range',_0x39ef0d+'-'+_0x1f70a5+'/'+_0x1979f5)[_0x1a21('0x19')](_0x4b3696);}return null;};}function patchUpdates(_0x2c1bf6){return function(_0x478e2d){try{jsonpatch['apply'](_0x478e2d,_0x2c1bf6,!![]);}catch(_0xc0c438){return BPromise[_0x1a21('0x1f')](_0xc0c438);}return _0x478e2d['save']();};}function saveUpdates(_0x41ee5f,_0x4491e5){return function(_0x1f738a){if(_0x1f738a){return _0x1f738a[_0x1a21('0x20')](_0x41ee5f)['then'](function(_0xb7e533){return _0xb7e533;});}return null;};}function removeEntity(_0x56727c,_0x432f9e){return function(_0x14cba1){if(_0x14cba1){return _0x14cba1[_0x1a21('0x21')]()[_0x1a21('0x22')](function(){_0x56727c[_0x1a21('0x17')](0xcc)[_0x1a21('0x18')]();});}};}function handleEntityNotFound(_0x2108a3,_0xe6f7c5){return function(_0x3229e5){if(!_0x3229e5){_0x2108a3['sendStatus'](0x194);}return _0x3229e5;};}function handleError(_0x1ad2c3,_0x4477ae){_0x4477ae=_0x4477ae||0x1f4;return function(_0x5f2013){logger[_0x1a21('0x23')](_0x5f2013[_0x1a21('0x24')]);if(_0x5f2013['name']){delete _0x5f2013[_0x1a21('0x25')];}_0x1ad2c3[_0x1a21('0x17')](_0x4477ae)[_0x1a21('0x26')](_0x5f2013);};}exports[_0x1a21('0x27')]=function(_0x482fdf,_0x19ed14){var _0x3f326={},_0x35e7bd={},_0x3172c4={'count':0x0,'rows':[]};var _0x543360=_['map'](db[_0x1a21('0x28')][_0x1a21('0x29')],function(_0x1e8d27){return{'name':_0x1e8d27[_0x1a21('0x2a')],'type':_0x1e8d27['type'][_0x1a21('0x2b')]};});_0x35e7bd[_0x1a21('0x2c')]=_[_0x1a21('0x2d')](_0x543360,'name');_0x35e7bd[_0x1a21('0x2e')]=_[_0x1a21('0x2f')](_0x482fdf[_0x1a21('0x2e')]);_0x35e7bd['filters']=_[_0x1a21('0x30')](_0x35e7bd[_0x1a21('0x2c')],_0x35e7bd[_0x1a21('0x2e')]);_0x3f326[_0x1a21('0x31')]=_[_0x1a21('0x30')](_0x35e7bd[_0x1a21('0x2c')],qs[_0x1a21('0x32')](_0x482fdf[_0x1a21('0x2e')][_0x1a21('0x32')]));_0x3f326[_0x1a21('0x31')]=_0x3f326[_0x1a21('0x31')][_0x1a21('0x33')]?_0x3f326['attributes']:_0x35e7bd['model'];if(!_0x482fdf['query']['hasOwnProperty'](_0x1a21('0x34'))){_0x3f326['limit']=qs[_0x1a21('0x1b')](_0x482fdf[_0x1a21('0x2e')][_0x1a21('0x1b')]);_0x3f326[_0x1a21('0x1a')]=qs['offset'](_0x482fdf[_0x1a21('0x2e')][_0x1a21('0x1a')]);}_0x3f326[_0x1a21('0x35')]=qs['sort'](_0x482fdf[_0x1a21('0x2e')]['sort']);_0x3f326[_0x1a21('0x36')]=qs[_0x1a21('0x37')](_[_0x1a21('0x38')](_0x482fdf[_0x1a21('0x2e')],_0x35e7bd[_0x1a21('0x37')]),_0x543360);if(_0x482fdf[_0x1a21('0x2e')][_0x1a21('0x39')]){_0x3f326[_0x1a21('0x36')]=_[_0x1a21('0x3a')](_0x3f326['where'],{'$or':_['map'](_0x543360,function(_0x50cb11){if(_0x50cb11[_0x1a21('0x3b')]!==_0x1a21('0x3c')){var _0x39ab88={};_0x39ab88[_0x50cb11[_0x1a21('0x25')]]={'$like':'%'+_0x482fdf['query'][_0x1a21('0x39')]+'%'};return _0x39ab88;}})});}_0x3f326=_['merge']({},_0x3f326,_0x482fdf[_0x1a21('0x3d')]);var _0x148043={'where':_0x3f326['where']};return db['SalesforceAccount']['count'](_0x148043)[_0x1a21('0x22')](function(_0x5dcabd){_0x3172c4[_0x1a21('0x1d')]=_0x5dcabd;if(_0x482fdf['query']['includeAll']){_0x3f326['include']=[{'all':!![]}];}return db[_0x1a21('0x28')][_0x1a21('0x3e')](_0x3f326);})[_0x1a21('0x22')](function(_0x25183c){_0x3172c4['rows']=_0x25183c;return _0x3172c4;})[_0x1a21('0x22')](respondWithFilteredResult(_0x19ed14,_0x3f326))['catch'](handleError(_0x19ed14,null));};exports['show']=function(_0x33eeb6,_0x1011f2){var _0x5ce185={'raw':![],'where':{'id':_0x33eeb6[_0x1a21('0x3f')]['id']}},_0x122d1f={};_0x122d1f[_0x1a21('0x2c')]=_['keys'](db[_0x1a21('0x28')][_0x1a21('0x29')]);_0x122d1f['query']=_[_0x1a21('0x2f')](_0x33eeb6[_0x1a21('0x2e')]);_0x122d1f[_0x1a21('0x37')]=_[_0x1a21('0x30')](_0x122d1f['model'],_0x122d1f['query']);_0x5ce185[_0x1a21('0x31')]=_[_0x1a21('0x30')](_0x122d1f[_0x1a21('0x2c')],qs['fields'](_0x33eeb6[_0x1a21('0x2e')][_0x1a21('0x32')]));_0x5ce185[_0x1a21('0x31')]=_0x5ce185[_0x1a21('0x31')][_0x1a21('0x33')]?_0x5ce185['attributes']:_0x122d1f[_0x1a21('0x2c')];if(_0x33eeb6[_0x1a21('0x2e')][_0x1a21('0x40')]){_0x5ce185[_0x1a21('0x41')]=[{'all':!![]}];}_0x5ce185=_[_0x1a21('0x3a')]({},_0x5ce185,_0x33eeb6['options']);return db['SalesforceAccount'][_0x1a21('0x42')](_0x5ce185)['then'](handleEntityNotFound(_0x1011f2,null))[_0x1a21('0x22')](respondWithResult(_0x1011f2,null))['catch'](handleError(_0x1011f2,null));};exports[_0x1a21('0x43')]=function(_0x44f8d8,_0x4a0aaa){return db['SalesforceAccount']['create'](_0x44f8d8['body'],{})[_0x1a21('0x22')](respondWithResult(_0x4a0aaa,0xc9))['catch'](handleError(_0x4a0aaa,null));};exports[_0x1a21('0x20')]=function(_0x345c01,_0x50c407){if(_0x345c01[_0x1a21('0x44')]['id']){delete _0x345c01[_0x1a21('0x44')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x345c01[_0x1a21('0x3f')]['id']}})[_0x1a21('0x22')](handleEntityNotFound(_0x50c407,null))[_0x1a21('0x22')](saveUpdates(_0x345c01[_0x1a21('0x44')],null))[_0x1a21('0x22')](respondWithResult(_0x50c407,null))['catch'](handleError(_0x50c407,null));};exports[_0x1a21('0x21')]=function(_0x2642e2,_0x56d59c){return db['SalesforceAccount'][_0x1a21('0x42')]({'where':{'id':_0x2642e2[_0x1a21('0x3f')]['id']}})[_0x1a21('0x22')](handleEntityNotFound(_0x56d59c,null))[_0x1a21('0x22')](removeEntity(_0x56d59c,null))[_0x1a21('0x45')](handleError(_0x56d59c,null));};exports[_0x1a21('0x46')]=function(_0x36af11,_0x284b7,_0x556319){var _0x1a3bc5={};var _0x593f82={};var _0x2a3c8;var _0x4df539;return db[_0x1a21('0x28')][_0x1a21('0x47')]({'where':{'id':_0x36af11[_0x1a21('0x3f')]['id']}})['then'](handleEntityNotFound(_0x284b7,null))[_0x1a21('0x22')](function(_0x104c07){if(_0x104c07){_0x2a3c8=_0x104c07;_0x593f82['model']=_[_0x1a21('0x2f')](db[_0x1a21('0x48')][_0x1a21('0x29')]);_0x593f82['query']=_['keys'](_0x36af11['query']);_0x593f82[_0x1a21('0x37')]=_[_0x1a21('0x30')](_0x593f82[_0x1a21('0x2c')],_0x593f82['query']);_0x1a3bc5[_0x1a21('0x31')]=_[_0x1a21('0x30')](_0x593f82['model'],qs[_0x1a21('0x32')](_0x36af11[_0x1a21('0x2e')][_0x1a21('0x32')]));_0x1a3bc5[_0x1a21('0x31')]=_0x1a3bc5['attributes']['length']?_0x1a3bc5['attributes']:_0x593f82[_0x1a21('0x2c')];_0x1a3bc5['order']=qs[_0x1a21('0x49')](_0x36af11[_0x1a21('0x2e')]['sort']);_0x1a3bc5['where']=qs[_0x1a21('0x37')](_[_0x1a21('0x38')](_0x36af11[_0x1a21('0x2e')],_0x593f82[_0x1a21('0x37')]));if(_0x36af11[_0x1a21('0x2e')]['filter']){_0x1a3bc5[_0x1a21('0x36')]=_[_0x1a21('0x3a')](_0x1a3bc5[_0x1a21('0x36')],{'$or':_[_0x1a21('0x2d')](_0x1a3bc5['attributes'],function(_0x1d17ef){var _0xf15cc2={};_0xf15cc2[_0x1d17ef]={'$like':'%'+_0x36af11['query'][_0x1a21('0x39')]+'%'};return _0xf15cc2;})});}_0x1a3bc5=_[_0x1a21('0x3a')]({},_0x1a3bc5,_0x36af11[_0x1a21('0x3d')]);return _0x2a3c8['getConfigurations'](_0x1a3bc5);}})[_0x1a21('0x22')](function(_0x277af4){if(_0x277af4){_0x4df539=_0x277af4[_0x1a21('0x33')];if(!_0x36af11[_0x1a21('0x2e')][_0x1a21('0x4a')](_0x1a21('0x34'))){_0x1a3bc5['limit']=qs[_0x1a21('0x1b')](_0x36af11['query'][_0x1a21('0x1b')]);_0x1a3bc5[_0x1a21('0x1a')]=qs[_0x1a21('0x1a')](_0x36af11[_0x1a21('0x2e')][_0x1a21('0x1a')]);}return _0x2a3c8[_0x1a21('0x46')](_0x1a3bc5);}})['then'](function(_0x1cf54f){if(_0x1cf54f){return _0x1cf54f?{'count':_0x4df539,'rows':_0x1cf54f}:null;}})[_0x1a21('0x22')](respondWithResult(_0x284b7,null))[_0x1a21('0x45')](handleError(_0x284b7,null));};exports['addConfiguration']=function(_0xa62874,_0x44ce21,_0x41f576){if(_0xa62874[_0x1a21('0x44')]['id']){delete _0xa62874[_0x1a21('0x44')]['id'];}return db['SalesforceAccount'][_0x1a21('0x47')]({'where':{'id':_0xa62874[_0x1a21('0x3f')]['id']}})[_0x1a21('0x22')](handleEntityNotFound(_0x44ce21,null))['then'](function(_0x26a594){if(_0x26a594){_0xa62874[_0x1a21('0x44')][_0x1a21('0x4b')]=_0x26a594['id'];_0xa62874[_0x1a21('0x44')][_0x1a21('0x4c')]=integrations['getSubjects'](_0xa62874[_0x1a21('0x44')][_0x1a21('0x4d')],_0xa62874[_0x1a21('0x44')][_0x1a21('0x3b')]);_0xa62874[_0x1a21('0x44')][_0x1a21('0x4e')]=integrations[_0x1a21('0x4f')](_0xa62874[_0x1a21('0x44')][_0x1a21('0x4d')],_0xa62874[_0x1a21('0x44')][_0x1a21('0x3b')]);return db[_0x1a21('0x48')]['create'](_0xa62874[_0x1a21('0x44')],{'include':[{'model':db[_0x1a21('0x50')],'as':'Subjects'},{'model':db[_0x1a21('0x50')],'as':_0x1a21('0x4e')}]});}return null;})[_0x1a21('0x22')](respondWithResult(_0x44ce21,null))[_0x1a21('0x45')](handleError(_0x44ce21,null));};exports[_0x1a21('0x51')]=function(_0x357b5e,_0x4839c6,_0x3db8c0){var _0x169e16;var _0x5348b2='';var _0x2555f9=_0x1a21('0x52');return db['SalesforceAccount'][_0x1a21('0x47')]({'where':{'id':_0x357b5e[_0x1a21('0x3f')]['id']},'attributes':['id',_0x1a21('0x53'),_0x1a21('0x54'),_0x1a21('0x55'),'username','password',_0x1a21('0x56')]})['then'](handleEntityNotFound(_0x4839c6,null))['then'](function(_0x525b27){if(_0x525b27){_0x5348b2=_0x525b27[_0x1a21('0x53')];var _0x293f21=_0x5348b2[_0x1a21('0x57')](-0x1);if(_0x293f21==='/'){_0x5348b2=_0x5348b2[_0x1a21('0x58')](0x0,_0x5348b2['lastIndexOf'](_0x293f21));}_0x169e16=new jsforce[(_0x1a21('0x59'))]({'oauth2':{'loginUrl':_0x5348b2,'clientId':_0x525b27[_0x1a21('0x54')],'clientSecret':_0x525b27[_0x1a21('0x55')]}});return _0x169e16[_0x1a21('0x5a')](_0x525b27[_0x1a21('0x5b')],_0x525b27[_0x1a21('0x5c')][_0x1a21('0x5d')](_0x525b27[_0x1a21('0x56')]));}})[_0x1a21('0x22')](function(_0x3278d3){if(_0x3278d3){if(!_['isNil'](_0x357b5e[_0x1a21('0x2e')][_0x1a21('0x5e')])){_0x2555f9=_0x357b5e[_0x1a21('0x2e')][_0x1a21('0x5e')];}return _0x169e16[_0x1a21('0x5f')](_0x2555f9)['describe']();}})[_0x1a21('0x22')](function(_0x53a10a){var _0x221d27=['OwnerId',_0x1a21('0x60'),_0x1a21('0x61'),'IsRecurrence',_0x1a21('0x62'),'Description'];var _0x16c424=['string','int',_0x1a21('0x63'),_0x1a21('0x64'),_0x1a21('0x65'),_0x1a21('0x66'),'phone'];if(_0x53a10a){_[_0x1a21('0x67')](_0x53a10a[_0x1a21('0x32')],function(_0x43f9ad){return _0x221d27[_0x1a21('0x68')](_0x43f9ad[_0x1a21('0x25')])||!_0x16c424[_0x1a21('0x68')](_0x43f9ad[_0x1a21('0x3b')]);});return{'count':_0x53a10a[_0x1a21('0x32')][_0x1a21('0x33')],'rows':_[_0x1a21('0x2d')](_0x53a10a[_0x1a21('0x32')],function(_0x2955fb){return{'id':_0x2955fb[_0x1a21('0x25')],'name':_0x2955fb[_0x1a21('0x69')],'custom':_0x2955fb[_0x1a21('0x6a')],'options':_0x2955fb['picklistValues']['length']>0x0?_[_0x1a21('0x2d')](_0x2955fb[_0x1a21('0x6b')],function(_0x1f0549){return{'name':_0x1f0549[_0x1a21('0x69')],'value':_0x1f0549[_0x1a21('0x6c')]};}):_0x2955fb['type']==_0x1a21('0x64')?[{'name':_0x1a21('0x6d'),'value':_0x1a21('0x6e')},{'name':_0x1a21('0x6f'),'value':'false'}]:[]};})};}})[_0x1a21('0x22')](respondWithResult(_0x4839c6,null))['catch'](function(_0x291d11){var _0x5ace68=_0x357b5e[_0x1a21('0x2e')][_0x1a21('0x70')]?0x1f4:_0x291d11[_0x1a21('0x71')]||0x1f4;logger[_0x1a21('0x23')](_0x1a21('0x72'),_0x1a21('0x51'),_0x5ace68,JSON[_0x1a21('0x73')](_0x291d11));delete _0x291d11[_0x1a21('0x25')];if(_0x5ace68===0x191){_0x5ace68=0x190;}_0x4839c6[_0x1a21('0x17')](_0x5ace68)[_0x1a21('0x26')](_0x357b5e[_0x1a21('0x2e')][_0x1a21('0x70')]?{'message':_0x1a21('0x74'),'statusCode':_0x291d11['statusCode']}:_0x291d11);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 476e6a9..40f475d 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 _0x172c=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x172c,0xb9));var _0xc172=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x172c[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xc172('0x0'));var util=require(_0xc172('0x1'));var logger=require(_0xc172('0x2'))(_0xc172('0x3'));var moment=require('moment');var BPromise=require(_0xc172('0x4'));var rp=require(_0xc172('0x5'));var fs=require('fs');var path=require(_0xc172('0x6'));var rimraf=require('rimraf');var config=require(_0xc172('0x7'));var attributes=require(_0xc172('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2a2fcd,_0x43ca97){return _0x2a2fcd[_0xc172('0x9')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe78c=['SalesforceAccount','int_salesforce_accounts','util','moment','request-promise','path','exports'];(function(_0x39b48c,_0xcbfb29){var _0x24f43f=function(_0xf6b565){while(--_0xf6b565){_0x39b48c['push'](_0x39b48c['shift']());}};_0x24f43f(++_0xcbfb29);}(_0xe78c,0xaa));var _0xce78=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe78c[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xce78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xce78('0x1'));var BPromise=require('bluebird');var rp=require(_0xce78('0x2'));var fs=require('fs');var path=require(_0xce78('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xce78('0x4')]=function(_0x967d31,_0x2afba0){return _0x967d31['define'](_0xce78('0x5'),attributes,{'tableName':_0xce78('0x6'),'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 38fcf18..611834b 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 _0x9d9d=['SalesforceAccount','options','raw','attributes','limit','map','include','model','then','stringify','ShowSalesforceAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','GetSalesforceAccount'];(function(_0x3cf23b,_0xbfec3f){var _0x72be8d=function(_0x4817fc){while(--_0x4817fc){_0x3cf23b['push'](_0x3cf23b['shift']());}};_0x72be8d(++_0xbfec3f);}(_0x9d9d,0x1ba));var _0xd9d9=function(_0x4aec8d,_0x27f7eb){_0x4aec8d=_0x4aec8d-0x0;var _0x44cd13=_0x9d9d[_0x4aec8d];return _0x44cd13;};'use strict';var _=require(_0xd9d9('0x0'));var util=require(_0xd9d9('0x1'));var moment=require(_0xd9d9('0x2'));var BPromise=require(_0xd9d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9d9('0x4'));var db=require(_0xd9d9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9d9('0x6'))('rpc');var config=require(_0xd9d9('0x7'));var jayson=require(_0xd9d9('0x8'));var client=jayson['client'][_0xd9d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e487,_0xfb3e36,_0x455177){return new BPromise(function(_0x2f7512,_0x132614){return client[_0xd9d9('0xa')](_0x44e487,_0x455177)['then'](function(_0x569c46){logger['info'](_0xd9d9('0xb'),_0xfb3e36,'request\x20sent');logger[_0xd9d9('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xfb3e36,_0xd9d9('0xd'),JSON['stringify'](_0x569c46));if(_0x569c46[_0xd9d9('0xe')]){if(_0x569c46['error']['code']===0x1f4){logger[_0xd9d9('0xe')](_0xd9d9('0xb'),_0xfb3e36,_0x569c46[_0xd9d9('0xe')]['message']);return _0x132614(_0x569c46[_0xd9d9('0xe')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xfb3e36,_0x569c46[_0xd9d9('0xe')]['message']);return _0x2f7512(_0x569c46[_0xd9d9('0xe')][_0xd9d9('0xf')]);}else{logger[_0xd9d9('0x10')](_0xd9d9('0xb'),_0xfb3e36,_0xd9d9('0xd'));_0x2f7512(_0x569c46[_0xd9d9('0x11')][_0xd9d9('0xf')]);}})[_0xd9d9('0x12')](function(_0x1eccbf){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0xfb3e36,_0x1eccbf);_0x132614(_0x1eccbf);});});}exports[_0xd9d9('0x13')]=function(_0x1b3fb4){var _0x42ca1b=this;return new Promise(function(_0x554930,_0x2e95e7){return db[_0xd9d9('0x14')]['findAll']({'raw':_0x1b3fb4[_0xd9d9('0x15')]?_0x1b3fb4[_0xd9d9('0x15')][_0xd9d9('0x16')]===undefined?!![]:![]:!![],'where':_0x1b3fb4[_0xd9d9('0x15')]?_0x1b3fb4[_0xd9d9('0x15')]['where']||null:null,'attributes':_0x1b3fb4[_0xd9d9('0x15')]?_0x1b3fb4[_0xd9d9('0x15')][_0xd9d9('0x17')]||null:null,'limit':_0x1b3fb4[_0xd9d9('0x15')]?_0x1b3fb4[_0xd9d9('0x15')][_0xd9d9('0x18')]||null:null,'include':_0x1b3fb4[_0xd9d9('0x15')]?_0x1b3fb4[_0xd9d9('0x15')]['include']?_[_0xd9d9('0x19')](_0x1b3fb4[_0xd9d9('0x15')][_0xd9d9('0x1a')],function(_0x529a8e){return{'model':db[_0x529a8e[_0xd9d9('0x1b')]],'as':_0x529a8e['as'],'attributes':_0x529a8e['attributes'],'include':_0x529a8e[_0xd9d9('0x1a')]?_[_0xd9d9('0x19')](_0x529a8e[_0xd9d9('0x1a')],function(_0x15a040){return{'model':db[_0x15a040['model']],'as':_0x15a040['as'],'attributes':_0x15a040['attributes'],'include':_0x15a040[_0xd9d9('0x1a')]?_[_0xd9d9('0x19')](_0x15a040[_0xd9d9('0x1a')],function(_0x56a5d9){return{'model':db[_0x56a5d9[_0xd9d9('0x1b')]],'as':_0x56a5d9['as'],'attributes':_0x56a5d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9d9('0x1c')](function(_0xc39e56){logger[_0xd9d9('0x10')](_0xd9d9('0x13'),_0x1b3fb4);logger[_0xd9d9('0xc')]('GetSalesforceAccount',_0x1b3fb4,JSON[_0xd9d9('0x1d')](_0xc39e56));_0x554930(_0xc39e56);})[_0xd9d9('0x12')](function(_0xf0d9ca){logger[_0xd9d9('0xe')](_0xd9d9('0x13'),_0xf0d9ca[_0xd9d9('0xf')],_0x1b3fb4);_0x2e95e7(_0x42ca1b['error'](0x1f4,_0xf0d9ca[_0xd9d9('0xf')]));});});};exports[_0xd9d9('0x1e')]=function(_0x3c9f33){var _0x57b4cf=this;return new Promise(function(_0xe8985,_0x43d45a){return db['SalesforceAccount'][_0xd9d9('0x1f')]({'raw':_0x3c9f33[_0xd9d9('0x15')]?_0x3c9f33[_0xd9d9('0x15')][_0xd9d9('0x16')]===undefined?!![]:![]:!![],'where':_0x3c9f33['options']?_0x3c9f33[_0xd9d9('0x15')][_0xd9d9('0x20')]||null:null,'attributes':_0x3c9f33['options']?_0x3c9f33[_0xd9d9('0x15')]['attributes']||null:null,'include':_0x3c9f33[_0xd9d9('0x15')]?_0x3c9f33[_0xd9d9('0x15')][_0xd9d9('0x1a')]?_[_0xd9d9('0x19')](_0x3c9f33[_0xd9d9('0x15')]['include'],function(_0x5c36b0){return{'model':db[_0x5c36b0[_0xd9d9('0x1b')]],'as':_0x5c36b0['as'],'attributes':_0x5c36b0['attributes'],'include':_0x5c36b0[_0xd9d9('0x1a')]?_[_0xd9d9('0x19')](_0x5c36b0['include'],function(_0x332334){return{'model':db[_0x332334[_0xd9d9('0x1b')]],'as':_0x332334['as'],'attributes':_0x332334[_0xd9d9('0x17')],'include':_0x332334[_0xd9d9('0x1a')]?_[_0xd9d9('0x19')](_0x332334[_0xd9d9('0x1a')],function(_0x84212){return{'model':db[_0x84212[_0xd9d9('0x1b')]],'as':_0x84212['as'],'attributes':_0x84212[_0xd9d9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd9d9('0x1c')](function(_0x2c6a3e){logger[_0xd9d9('0x10')]('ShowSalesforceAccount',_0x3c9f33);logger[_0xd9d9('0xc')]('ShowSalesforceAccount',_0x3c9f33,JSON[_0xd9d9('0x1d')](_0x2c6a3e));_0xe8985(_0x2c6a3e);})[_0xd9d9('0x12')](function(_0xe5b39b){logger[_0xd9d9('0xe')](_0xd9d9('0x1e'),_0xe5b39b[_0xd9d9('0xf')],_0x3c9f33);_0x43d45a(_0x57b4cf[_0xd9d9('0xe')](0x1f4,_0xe5b39b[_0xd9d9('0xf')]));});});}; \ No newline at end of file +var _0xbabe=['request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','map','model','include','then','find','ShowSalesforceAccount','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x1a2095,_0x52ba48){var _0x1d35ad=function(_0x5ecb71){while(--_0x5ecb71){_0x1a2095['push'](_0x1a2095['shift']());}};_0x1d35ad(++_0x52ba48);}(_0xbabe,0x12e));var _0xebab=function(_0x3730ec,_0x29b2a8){_0x3730ec=_0x3730ec-0x0;var _0x19fcab=_0xbabe[_0x3730ec];return _0x19fcab;};'use strict';var _=require(_0xebab('0x0'));var util=require(_0xebab('0x1'));var moment=require('moment');var BPromise=require(_0xebab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xebab('0x4'))(_0xebab('0x5'));var config=require('../../config/environment');var jayson=require(_0xebab('0x6'));var client=jayson['client'][_0xebab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ead71,_0x1b21a5,_0x4e231b){return new BPromise(function(_0x2f4db4,_0xe7b7ab){return client[_0xebab('0x8')](_0x3ead71,_0x4e231b)['then'](function(_0x5d83e1){logger[_0xebab('0x9')](_0xebab('0xa'),_0x1b21a5,'request\x20sent');logger[_0xebab('0xb')](_0xebab('0xc'),_0x1b21a5,_0xebab('0xd'),JSON[_0xebab('0xe')](_0x5d83e1));if(_0x5d83e1[_0xebab('0xf')]){if(_0x5d83e1['error']['code']===0x1f4){logger[_0xebab('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x1b21a5,_0x5d83e1[_0xebab('0xf')][_0xebab('0x10')]);return _0xe7b7ab(_0x5d83e1[_0xebab('0xf')]['message']);}logger[_0xebab('0xf')](_0xebab('0xa'),_0x1b21a5,_0x5d83e1[_0xebab('0xf')]['message']);return _0x2f4db4(_0x5d83e1[_0xebab('0xf')][_0xebab('0x10')]);}else{logger[_0xebab('0x9')](_0xebab('0xa'),_0x1b21a5,_0xebab('0xd'));_0x2f4db4(_0x5d83e1[_0xebab('0x11')]['message']);}})[_0xebab('0x12')](function(_0x71de6e){logger[_0xebab('0xf')](_0xebab('0xa'),_0x1b21a5,_0x71de6e);_0xe7b7ab(_0x71de6e);});});}exports[_0xebab('0x13')]=function(_0x55be30){var _0xc87bc4=this;return new Promise(function(_0x9e684a,_0x41214c){return db[_0xebab('0x14')][_0xebab('0x15')]({'raw':_0x55be30[_0xebab('0x16')]?_0x55be30[_0xebab('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x55be30['options']?_0x55be30[_0xebab('0x16')][_0xebab('0x17')]||null:null,'attributes':_0x55be30['options']?_0x55be30[_0xebab('0x16')][_0xebab('0x18')]||null:null,'limit':_0x55be30[_0xebab('0x16')]?_0x55be30[_0xebab('0x16')]['limit']||null:null,'include':_0x55be30[_0xebab('0x16')]?_0x55be30['options']['include']?_[_0xebab('0x19')](_0x55be30['options']['include'],function(_0x1c0c5c){return{'model':db[_0x1c0c5c[_0xebab('0x1a')]],'as':_0x1c0c5c['as'],'attributes':_0x1c0c5c[_0xebab('0x18')],'include':_0x1c0c5c[_0xebab('0x1b')]?_[_0xebab('0x19')](_0x1c0c5c[_0xebab('0x1b')],function(_0x433df3){return{'model':db[_0x433df3[_0xebab('0x1a')]],'as':_0x433df3['as'],'attributes':_0x433df3[_0xebab('0x18')],'include':_0x433df3[_0xebab('0x1b')]?_[_0xebab('0x19')](_0x433df3['include'],function(_0x42ea40){return{'model':db[_0x42ea40[_0xebab('0x1a')]],'as':_0x42ea40['as'],'attributes':_0x42ea40[_0xebab('0x18')]};}):[]};}):[]};}):[]:[]})[_0xebab('0x1c')](function(_0x186658){logger[_0xebab('0x9')]('GetSalesforceAccount',_0x55be30);logger['debug'](_0xebab('0x13'),_0x55be30,JSON[_0xebab('0xe')](_0x186658));_0x9e684a(_0x186658);})[_0xebab('0x12')](function(_0x43287a){logger[_0xebab('0xf')](_0xebab('0x13'),_0x43287a['message'],_0x55be30);_0x41214c(_0xc87bc4[_0xebab('0xf')](0x1f4,_0x43287a[_0xebab('0x10')]));});});};exports['ShowSalesforceAccount']=function(_0x1643b8){var _0x52ba19=this;return new Promise(function(_0x17d22c,_0x39da16){return db[_0xebab('0x14')][_0xebab('0x1d')]({'raw':_0x1643b8[_0xebab('0x16')]?_0x1643b8[_0xebab('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1643b8[_0xebab('0x16')]?_0x1643b8[_0xebab('0x16')][_0xebab('0x17')]||null:null,'attributes':_0x1643b8[_0xebab('0x16')]?_0x1643b8[_0xebab('0x16')][_0xebab('0x18')]||null:null,'include':_0x1643b8[_0xebab('0x16')]?_0x1643b8['options'][_0xebab('0x1b')]?_[_0xebab('0x19')](_0x1643b8[_0xebab('0x16')]['include'],function(_0x28b4c5){return{'model':db[_0x28b4c5[_0xebab('0x1a')]],'as':_0x28b4c5['as'],'attributes':_0x28b4c5[_0xebab('0x18')],'include':_0x28b4c5[_0xebab('0x1b')]?_['map'](_0x28b4c5['include'],function(_0xa025d8){return{'model':db[_0xa025d8[_0xebab('0x1a')]],'as':_0xa025d8['as'],'attributes':_0xa025d8['attributes'],'include':_0xa025d8[_0xebab('0x1b')]?_[_0xebab('0x19')](_0xa025d8[_0xebab('0x1b')],function(_0x1a77de){return{'model':db[_0x1a77de[_0xebab('0x1a')]],'as':_0x1a77de['as'],'attributes':_0x1a77de[_0xebab('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e8a62){logger['info'](_0xebab('0x1e'),_0x1643b8);logger[_0xebab('0xb')](_0xebab('0x1e'),_0x1643b8,JSON[_0xebab('0xe')](_0x1e8a62));_0x17d22c(_0x1e8a62);})[_0xebab('0x12')](function(_0x1e8b8e){logger[_0xebab('0xf')]('ShowSalesforceAccount',_0x1e8b8e[_0xebab('0x10')],_0x1643b8);_0x39da16(_0x52ba19[_0xebab('0xf')](0x1f4,_0x1e8b8e[_0xebab('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0174b23..37a79e7 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x38380f,_0x46681b){var _0x23cab8=function(_0x4c171c){while(--_0x4c171c){_0x38380f['push'](_0x38380f['shift']());}};_0x23cab8(++_0x46681b);}(_0xadb5,0xad));var _0x5adb=function(_0x400c26,_0x512a68){_0x400c26=_0x400c26-0x0;var _0x59006f=_0xadb5[_0x400c26];return _0x59006f;};'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('./intSalesforceConfiguration.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xdb28,0x106));var _0x8db2=function(_0x88bb12,_0x472b06){_0x88bb12=_0x88bb12-0x0;var _0x5afcaf=_0xdb28[_0x88bb12];return _0x5afcaf;};'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 6f34c36..56a3f8d 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 _0x6995=['lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead','account','nothing'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x6995,0xfd));var _0x5699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6995[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x5699('0x0'));module[_0x5699('0x1')]={'name':{'type':Sequelize[_0x5699('0x2')]},'description':{'type':Sequelize[_0x5699('0x2')]},'ticketType':{'type':Sequelize[_0x5699('0x3')](_0x5699('0x4'),_0x5699('0x5')),'defaultValue':_0x5699('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5699('0x6'),_0x5699('0x7'),'lead',_0x5699('0x8'),_0x5699('0x9')),'defaultValue':_0x5699('0x6')},'moduleCreate':{'type':Sequelize[_0x5699('0x3')](_0x5699('0xa'),'contact','lead',_0x5699('0x9')),'defaultValue':_0x5699('0xb')},'leadId':{'type':Sequelize[_0x5699('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5699('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5699('0x2')]}}; \ No newline at end of file +var _0xceaf=['lead','account_contact_lead','account','sequelize','STRING','ENUM','Task','contact_lead','contact'];(function(_0x1617dc,_0x53a03c){var _0x420427=function(_0x4ed2f5){while(--_0x4ed2f5){_0x1617dc['push'](_0x1617dc['shift']());}};_0x420427(++_0x53a03c);}(_0xceaf,0x17d));var _0xfcea=function(_0x3839a7,_0x5af8b0){_0x3839a7=_0x3839a7-0x0;var _0x3309cd=_0xceaf[_0x3839a7];return _0x3309cd;};'use strict';var Sequelize=require(_0xfcea('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfcea('0x1')]},'ticketType':{'type':Sequelize[_0xfcea('0x2')](_0xfcea('0x3'),'Case'),'defaultValue':_0xfcea('0x3')},'moduleSearch':{'type':Sequelize[_0xfcea('0x2')](_0xfcea('0x4'),_0xfcea('0x5'),_0xfcea('0x6'),_0xfcea('0x7'),'account'),'defaultValue':_0xfcea('0x4')},'moduleCreate':{'type':Sequelize[_0xfcea('0x2')]('nothing',_0xfcea('0x5'),'lead',_0xfcea('0x8')),'defaultValue':_0xfcea('0x6')},'leadId':{'type':Sequelize[_0xfcea('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xfcea('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xfcea('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xfcea('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index aa518e1..0e5dcc6 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 _0x9fdc=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','rows','show','params','keys','length','find','catch','create','body','getFields','findOne','getSubjects','getDescriptions','SalesforceField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x963c1c,_0x229a46){var _0x1ee029=function(_0x280b28){while(--_0x280b28){_0x963c1c['push'](_0x963c1c['shift']());}};_0x1ee029(++_0x229a46);}(_0x9fdc,0x18e));var _0xc9fd=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x9fdc[_0x5774be];return _0x4914b4;};'use strict';var emlformat=require(_0xc9fd('0x0'));var rimraf=require(_0xc9fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9fd('0x2'));var rp=require(_0xc9fd('0x3'));var moment=require(_0xc9fd('0x4'));var BPromise=require(_0xc9fd('0x5'));var Mustache=require(_0xc9fd('0x6'));var util=require(_0xc9fd('0x7'));var path=require(_0xc9fd('0x8'));var sox=require(_0xc9fd('0x9'));var csv=require(_0xc9fd('0xa'));var ejs=require(_0xc9fd('0xb'));var fs=require('fs');var fs_extra=require(_0xc9fd('0xc'));var _=require(_0xc9fd('0xd'));var squel=require(_0xc9fd('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9fd('0xf'));var toCsv=require(_0xc9fd('0xa'));var querystring=require(_0xc9fd('0x10'));var Papa=require('papaparse');var Redis=require(_0xc9fd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc9fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9fd('0x13'));var logger=require(_0xc9fd('0x14'))(_0xc9fd('0x15'));var utils=require(_0xc9fd('0x16'));var config=require(_0xc9fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47546e,_0x152692){_0x152692=_0x152692||0xcc;return function(_0x55faf6){if(_0x55faf6){return _0x47546e[_0xc9fd('0x18')](_0x152692);}return _0x47546e['status'](_0x152692)[_0xc9fd('0x19')]();};}function respondWithResult(_0x17e98e,_0xca7c18){_0xca7c18=_0xca7c18||0xc8;return function(_0x4dfb70){if(_0x4dfb70){return _0x17e98e[_0xc9fd('0x1a')](_0xca7c18)[_0xc9fd('0x1b')](_0x4dfb70);}};}function respondWithFilteredResult(_0xf7287e,_0x4581a2){return function(_0x5a1e25){if(_0x5a1e25){var _0x14f39d=typeof _0x4581a2[_0xc9fd('0x1c')]==='undefined'&&typeof _0x4581a2[_0xc9fd('0x1d')]===_0xc9fd('0x1e');var _0x1b70ad=_0x5a1e25[_0xc9fd('0x1f')];var _0x299bc3=_0x14f39d?0x0:_0x4581a2[_0xc9fd('0x1c')];var _0x495e9a=_0x14f39d?_0x5a1e25['count']:_0x4581a2[_0xc9fd('0x1c')]+_0x4581a2['limit'];var _0x212faf;if(_0x495e9a>=_0x1b70ad){_0x495e9a=_0x1b70ad;_0x212faf=0xc8;}else{_0x212faf=0xce;}_0xf7287e[_0xc9fd('0x1a')](_0x212faf);return _0xf7287e[_0xc9fd('0x20')](_0xc9fd('0x21'),_0x299bc3+'-'+_0x495e9a+'/'+_0x1b70ad)[_0xc9fd('0x1b')](_0x5a1e25);}return null;};}function patchUpdates(_0x1208ed){return function(_0x527712){try{jsonpatch[_0xc9fd('0x22')](_0x527712,_0x1208ed,!![]);}catch(_0x3298f1){return BPromise[_0xc9fd('0x23')](_0x3298f1);}return _0x527712[_0xc9fd('0x24')]();};}function saveUpdates(_0x55d112,_0x5a858d){return function(_0x35d7c5){if(_0x35d7c5){return _0x35d7c5[_0xc9fd('0x25')](_0x55d112)[_0xc9fd('0x26')](function(_0x490b8c){return _0x490b8c;});}return null;};}function removeEntity(_0x414e6f,_0x3adaa2){return function(_0x324f81){if(_0x324f81){return _0x324f81[_0xc9fd('0x27')]()['then'](function(){_0x414e6f[_0xc9fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56af05,_0x5809d2){return function(_0x55d0b7){if(!_0x55d0b7){_0x56af05[_0xc9fd('0x18')](0x194);}return _0x55d0b7;};}function handleError(_0x1bf579,_0x5299ae){_0x5299ae=_0x5299ae||0x1f4;return function(_0x40ffa7){logger[_0xc9fd('0x28')](_0x40ffa7[_0xc9fd('0x29')]);if(_0x40ffa7[_0xc9fd('0x2a')]){delete _0x40ffa7['name'];}_0x1bf579[_0xc9fd('0x1a')](_0x5299ae)[_0xc9fd('0x2b')](_0x40ffa7);};}exports[_0xc9fd('0x2c')]=function(_0xb4634d,_0xdd1d7f){var _0x381d43={},_0x2ca098={},_0x596a86={'count':0x0,'rows':[]};var _0x33aee8=_[_0xc9fd('0x2d')](db['SalesforceConfiguration'][_0xc9fd('0x2e')],function(_0x22054d){return{'name':_0x22054d[_0xc9fd('0x2f')],'type':_0x22054d['type']['key']};});_0x2ca098[_0xc9fd('0x30')]=_[_0xc9fd('0x2d')](_0x33aee8,_0xc9fd('0x2a'));_0x2ca098[_0xc9fd('0x31')]=_['keys'](_0xb4634d[_0xc9fd('0x31')]);_0x2ca098[_0xc9fd('0x32')]=_[_0xc9fd('0x33')](_0x2ca098['model'],_0x2ca098[_0xc9fd('0x31')]);_0x381d43[_0xc9fd('0x34')]=_[_0xc9fd('0x33')](_0x2ca098['model'],qs[_0xc9fd('0x35')](_0xb4634d[_0xc9fd('0x31')]['fields']));_0x381d43[_0xc9fd('0x34')]=_0x381d43[_0xc9fd('0x34')]['length']?_0x381d43['attributes']:_0x2ca098[_0xc9fd('0x30')];if(!_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x36')](_0xc9fd('0x37'))){_0x381d43[_0xc9fd('0x1d')]=qs[_0xc9fd('0x1d')](_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x1d')]);_0x381d43[_0xc9fd('0x1c')]=qs['offset'](_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x1c')]);}_0x381d43[_0xc9fd('0x38')]=qs['sort'](_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x39')]);_0x381d43[_0xc9fd('0x3a')]=qs[_0xc9fd('0x32')](_[_0xc9fd('0x3b')](_0xb4634d['query'],_0x2ca098[_0xc9fd('0x32')]),_0x33aee8);if(_0xb4634d[_0xc9fd('0x31')]['filter']){_0x381d43[_0xc9fd('0x3a')]=_[_0xc9fd('0x3c')](_0x381d43[_0xc9fd('0x3a')],{'$or':_['map'](_0x33aee8,function(_0x49b6d2){if(_0x49b6d2[_0xc9fd('0x3d')]!==_0xc9fd('0x3e')){var _0x38eb6c={};_0x38eb6c[_0x49b6d2[_0xc9fd('0x2a')]]={'$like':'%'+_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x3f')]+'%'};return _0x38eb6c;}})});}_0x381d43=_[_0xc9fd('0x3c')]({},_0x381d43,_0xb4634d[_0xc9fd('0x40')]);var _0x531752={'where':_0x381d43['where']};return db[_0xc9fd('0x41')][_0xc9fd('0x1f')](_0x531752)['then'](function(_0x57a162){_0x596a86['count']=_0x57a162;if(_0xb4634d[_0xc9fd('0x31')][_0xc9fd('0x42')]){_0x381d43['include']=[{'all':!![]}];}return db[_0xc9fd('0x41')]['findAll'](_0x381d43);})[_0xc9fd('0x26')](function(_0x2c5414){_0x596a86[_0xc9fd('0x43')]=_0x2c5414;return _0x596a86;})[_0xc9fd('0x26')](respondWithFilteredResult(_0xdd1d7f,_0x381d43))['catch'](handleError(_0xdd1d7f,null));};exports[_0xc9fd('0x44')]=function(_0x1e739a,_0x135ff9){var _0x34eed4={'raw':![],'where':{'id':_0x1e739a[_0xc9fd('0x45')]['id']}},_0x1205b2={};_0x1205b2[_0xc9fd('0x30')]=_['keys'](db[_0xc9fd('0x41')][_0xc9fd('0x2e')]);_0x1205b2[_0xc9fd('0x31')]=_[_0xc9fd('0x46')](_0x1e739a[_0xc9fd('0x31')]);_0x1205b2['filters']=_['intersection'](_0x1205b2[_0xc9fd('0x30')],_0x1205b2[_0xc9fd('0x31')]);_0x34eed4[_0xc9fd('0x34')]=_[_0xc9fd('0x33')](_0x1205b2[_0xc9fd('0x30')],qs[_0xc9fd('0x35')](_0x1e739a[_0xc9fd('0x31')][_0xc9fd('0x35')]));_0x34eed4[_0xc9fd('0x34')]=_0x34eed4['attributes'][_0xc9fd('0x47')]?_0x34eed4[_0xc9fd('0x34')]:_0x1205b2[_0xc9fd('0x30')];if(_0x1e739a['query']['includeAll']){_0x34eed4['include']=[{'all':!![]}];}_0x34eed4=_['merge']({},_0x34eed4,_0x1e739a[_0xc9fd('0x40')]);return db[_0xc9fd('0x41')][_0xc9fd('0x48')](_0x34eed4)[_0xc9fd('0x26')](handleEntityNotFound(_0x135ff9,null))[_0xc9fd('0x26')](respondWithResult(_0x135ff9,null))[_0xc9fd('0x49')](handleError(_0x135ff9,null));};exports[_0xc9fd('0x4a')]=function(_0x532f36,_0x3d7460){return db[_0xc9fd('0x41')][_0xc9fd('0x4a')](_0x532f36[_0xc9fd('0x4b')],{})[_0xc9fd('0x26')](respondWithResult(_0x3d7460,0xc9))[_0xc9fd('0x49')](handleError(_0x3d7460,null));};exports[_0xc9fd('0x25')]=function(_0x42427e,_0x1ee818){if(_0x42427e[_0xc9fd('0x4b')]['id']){delete _0x42427e[_0xc9fd('0x4b')]['id'];}return db[_0xc9fd('0x41')]['find']({'where':{'id':_0x42427e['params']['id']}})['then'](handleEntityNotFound(_0x1ee818,null))[_0xc9fd('0x26')](saveUpdates(_0x42427e[_0xc9fd('0x4b')],null))[_0xc9fd('0x26')](respondWithResult(_0x1ee818,null))[_0xc9fd('0x49')](handleError(_0x1ee818,null));};exports['destroy']=function(_0x98e52e,_0x13b1f8){return db[_0xc9fd('0x41')][_0xc9fd('0x48')]({'where':{'id':_0x98e52e[_0xc9fd('0x45')]['id']}})[_0xc9fd('0x26')](handleEntityNotFound(_0x13b1f8,null))[_0xc9fd('0x26')](removeEntity(_0x13b1f8,null))[_0xc9fd('0x49')](handleError(_0x13b1f8,null));};exports[_0xc9fd('0x4c')]=function(_0x474636,_0x21c204,_0xf6db82){var _0x48c2a8={};var _0x111be7={};var _0x903f17;var _0x51b18b;return db[_0xc9fd('0x41')][_0xc9fd('0x4d')]({'where':{'id':_0x474636[_0xc9fd('0x45')]['id']}})[_0xc9fd('0x26')](handleEntityNotFound(_0x21c204,null))[_0xc9fd('0x26')](function(_0x4db808){if(_0x4db808){_0x903f17=_0x4db808;_0x111be7[_0xc9fd('0x30')]=_[_0xc9fd('0x46')](db['SalesforceField']['rawAttributes']);_0x111be7['query']=_['keys'](_0x474636['query']);_0x111be7[_0xc9fd('0x32')]=_[_0xc9fd('0x33')](_0x111be7['model'],_0x111be7[_0xc9fd('0x31')]);_0x48c2a8[_0xc9fd('0x34')]=_[_0xc9fd('0x33')](_0x111be7[_0xc9fd('0x30')],qs[_0xc9fd('0x35')](_0x474636['query']['fields']));_0x48c2a8[_0xc9fd('0x34')]=_0x48c2a8[_0xc9fd('0x34')][_0xc9fd('0x47')]?_0x48c2a8[_0xc9fd('0x34')]:_0x111be7[_0xc9fd('0x30')];_0x48c2a8[_0xc9fd('0x38')]=qs[_0xc9fd('0x39')](_0x474636['query'][_0xc9fd('0x39')]);_0x48c2a8[_0xc9fd('0x3a')]=qs[_0xc9fd('0x32')](_['pick'](_0x474636[_0xc9fd('0x31')],_0x111be7[_0xc9fd('0x32')]));if(_0x474636[_0xc9fd('0x31')][_0xc9fd('0x3f')]){_0x48c2a8['where']=_[_0xc9fd('0x3c')](_0x48c2a8[_0xc9fd('0x3a')],{'$or':_[_0xc9fd('0x2d')](_0x48c2a8[_0xc9fd('0x34')],function(_0x31d508){var _0x416cc0={};_0x416cc0[_0x31d508]={'$like':'%'+_0x474636[_0xc9fd('0x31')][_0xc9fd('0x3f')]+'%'};return _0x416cc0;})});}_0x48c2a8=_[_0xc9fd('0x3c')]({},_0x48c2a8,_0x474636[_0xc9fd('0x40')]);return _0x903f17[_0xc9fd('0x4c')](_0x48c2a8);}})[_0xc9fd('0x26')](function(_0x11efd2){if(_0x11efd2){_0x51b18b=_0x11efd2[_0xc9fd('0x47')];if(!_0x474636[_0xc9fd('0x31')][_0xc9fd('0x36')](_0xc9fd('0x37'))){_0x48c2a8[_0xc9fd('0x1d')]=qs[_0xc9fd('0x1d')](_0x474636[_0xc9fd('0x31')][_0xc9fd('0x1d')]);_0x48c2a8[_0xc9fd('0x1c')]=qs['offset'](_0x474636[_0xc9fd('0x31')][_0xc9fd('0x1c')]);}return _0x903f17[_0xc9fd('0x4c')](_0x48c2a8);}})[_0xc9fd('0x26')](function(_0x56b2bc){if(_0x56b2bc){return _0x56b2bc?{'count':_0x51b18b,'rows':_0x56b2bc}:null;}})[_0xc9fd('0x26')](respondWithResult(_0x21c204,null))['catch'](handleError(_0x21c204,null));};exports[_0xc9fd('0x4e')]=function(_0x5f1688,_0x106a22,_0x206bb4){var _0x27842e={};var _0x3a108e={};var _0x11c513;var _0x364d25;return db[_0xc9fd('0x41')]['findOne']({'where':{'id':_0x5f1688['params']['id']}})[_0xc9fd('0x26')](handleEntityNotFound(_0x106a22,null))[_0xc9fd('0x26')](function(_0x5ab2dd){if(_0x5ab2dd){_0x11c513=_0x5ab2dd;_0x3a108e[_0xc9fd('0x30')]=_['keys'](db['SalesforceField'][_0xc9fd('0x2e')]);_0x3a108e['query']=_[_0xc9fd('0x46')](_0x5f1688[_0xc9fd('0x31')]);_0x3a108e[_0xc9fd('0x32')]=_['intersection'](_0x3a108e['model'],_0x3a108e['query']);_0x27842e[_0xc9fd('0x34')]=_['intersection'](_0x3a108e[_0xc9fd('0x30')],qs['fields'](_0x5f1688[_0xc9fd('0x31')][_0xc9fd('0x35')]));_0x27842e[_0xc9fd('0x34')]=_0x27842e[_0xc9fd('0x34')][_0xc9fd('0x47')]?_0x27842e[_0xc9fd('0x34')]:_0x3a108e['model'];_0x27842e[_0xc9fd('0x38')]=qs[_0xc9fd('0x39')](_0x5f1688['query']['sort']);_0x27842e[_0xc9fd('0x3a')]=qs[_0xc9fd('0x32')](_[_0xc9fd('0x3b')](_0x5f1688[_0xc9fd('0x31')],_0x3a108e[_0xc9fd('0x32')]));if(_0x5f1688['query'][_0xc9fd('0x3f')]){_0x27842e[_0xc9fd('0x3a')]=_[_0xc9fd('0x3c')](_0x27842e[_0xc9fd('0x3a')],{'$or':_[_0xc9fd('0x2d')](_0x27842e[_0xc9fd('0x34')],function(_0x24c97d){var _0x1c440a={};_0x1c440a[_0x24c97d]={'$like':'%'+_0x5f1688[_0xc9fd('0x31')][_0xc9fd('0x3f')]+'%'};return _0x1c440a;})});}_0x27842e=_['merge']({},_0x27842e,_0x5f1688[_0xc9fd('0x40')]);return _0x11c513[_0xc9fd('0x4e')](_0x27842e);}})[_0xc9fd('0x26')](function(_0x244590){if(_0x244590){_0x364d25=_0x244590[_0xc9fd('0x47')];if(!_0x5f1688['query'][_0xc9fd('0x36')](_0xc9fd('0x37'))){_0x27842e['limit']=qs[_0xc9fd('0x1d')](_0x5f1688['query'][_0xc9fd('0x1d')]);_0x27842e['offset']=qs[_0xc9fd('0x1c')](_0x5f1688[_0xc9fd('0x31')]['offset']);}return _0x11c513[_0xc9fd('0x4e')](_0x27842e);}})[_0xc9fd('0x26')](function(_0x4ca27d){if(_0x4ca27d){return _0x4ca27d?{'count':_0x364d25,'rows':_0x4ca27d}:null;}})[_0xc9fd('0x26')](respondWithResult(_0x106a22,null))[_0xc9fd('0x49')](handleError(_0x106a22,null));};exports[_0xc9fd('0x4f')]=function(_0x58cbb9,_0x29f173,_0xe37c19){var _0x8a1431={};var _0x157a0f={};var _0x3b8fb6;var _0x125f8;return db[_0xc9fd('0x41')]['findOne']({'where':{'id':_0x58cbb9[_0xc9fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x29f173,null))[_0xc9fd('0x26')](function(_0x2732d2){if(_0x2732d2){_0x3b8fb6=_0x2732d2;_0x157a0f['model']=_[_0xc9fd('0x46')](db[_0xc9fd('0x50')][_0xc9fd('0x2e')]);_0x157a0f['query']=_[_0xc9fd('0x46')](_0x58cbb9[_0xc9fd('0x31')]);_0x157a0f[_0xc9fd('0x32')]=_[_0xc9fd('0x33')](_0x157a0f[_0xc9fd('0x30')],_0x157a0f[_0xc9fd('0x31')]);_0x8a1431[_0xc9fd('0x34')]=_[_0xc9fd('0x33')](_0x157a0f[_0xc9fd('0x30')],qs[_0xc9fd('0x35')](_0x58cbb9['query'][_0xc9fd('0x35')]));_0x8a1431[_0xc9fd('0x34')]=_0x8a1431[_0xc9fd('0x34')]['length']?_0x8a1431['attributes']:_0x157a0f[_0xc9fd('0x30')];_0x8a1431[_0xc9fd('0x38')]=qs['sort'](_0x58cbb9[_0xc9fd('0x31')][_0xc9fd('0x39')]);_0x8a1431[_0xc9fd('0x3a')]=qs[_0xc9fd('0x32')](_[_0xc9fd('0x3b')](_0x58cbb9['query'],_0x157a0f[_0xc9fd('0x32')]));if(_0x58cbb9[_0xc9fd('0x31')]['filter']){_0x8a1431['where']=_[_0xc9fd('0x3c')](_0x8a1431['where'],{'$or':_[_0xc9fd('0x2d')](_0x8a1431[_0xc9fd('0x34')],function(_0x23d802){var _0x278a89={};_0x278a89[_0x23d802]={'$like':'%'+_0x58cbb9[_0xc9fd('0x31')]['filter']+'%'};return _0x278a89;})});}_0x8a1431=_[_0xc9fd('0x3c')]({},_0x8a1431,_0x58cbb9[_0xc9fd('0x40')]);return _0x3b8fb6[_0xc9fd('0x4f')](_0x8a1431);}})[_0xc9fd('0x26')](function(_0x31e9ff){if(_0x31e9ff){_0x125f8=_0x31e9ff[_0xc9fd('0x47')];if(!_0x58cbb9['query'][_0xc9fd('0x36')]('nolimit')){_0x8a1431['limit']=qs[_0xc9fd('0x1d')](_0x58cbb9[_0xc9fd('0x31')][_0xc9fd('0x1d')]);_0x8a1431[_0xc9fd('0x1c')]=qs[_0xc9fd('0x1c')](_0x58cbb9[_0xc9fd('0x31')][_0xc9fd('0x1c')]);}return _0x3b8fb6[_0xc9fd('0x4f')](_0x8a1431);}})[_0xc9fd('0x26')](function(_0x167aaa){if(_0x167aaa){return _0x167aaa?{'count':_0x125f8,'rows':_0x167aaa}:null;}})['then'](respondWithResult(_0x29f173,null))[_0xc9fd('0x49')](handleError(_0x29f173,null));}; \ No newline at end of file +var _0xd8fd=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','create','body','find','destroy','getFields','findOne','SalesforceField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x525e4a,_0x31736b){var _0x1eb647=function(_0x1db11c){while(--_0x1db11c){_0x525e4a['push'](_0x525e4a['shift']());}};_0x1eb647(++_0x31736b);}(_0xd8fd,0xe4));var _0xdd8f=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0xd8fd[_0x175866];return _0x4a561b;};'use strict';var emlformat=require(_0xdd8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd8f('0x2'));var moment=require(_0xdd8f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd8f('0x4'));var util=require(_0xdd8f('0x5'));var path=require(_0xdd8f('0x6'));var sox=require(_0xdd8f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd8f('0x8'));var _=require(_0xdd8f('0x9'));var squel=require(_0xdd8f('0xa'));var crypto=require(_0xdd8f('0xb'));var jsforce=require(_0xdd8f('0xc'));var deskjs=require(_0xdd8f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdd8f('0xe'));var Papa=require(_0xdd8f('0xf'));var Redis=require(_0xdd8f('0x10'));var authService=require(_0xdd8f('0x11'));var qs=require(_0xdd8f('0x12'));var as=require(_0xdd8f('0x13'));var hardwareService=require(_0xdd8f('0x14'));var logger=require(_0xdd8f('0x15'))(_0xdd8f('0x16'));var utils=require(_0xdd8f('0x17'));var config=require(_0xdd8f('0x18'));var licenseUtil=require(_0xdd8f('0x19'));var db=require(_0xdd8f('0x1a'))['db'];function respondWithStatusCode(_0x4aacfd,_0x4658f9){_0x4658f9=_0x4658f9||0xcc;return function(_0x13b32d){if(_0x13b32d){return _0x4aacfd[_0xdd8f('0x1b')](_0x4658f9);}return _0x4aacfd['status'](_0x4658f9)['end']();};}function respondWithResult(_0x16e610,_0xb99ee4){_0xb99ee4=_0xb99ee4||0xc8;return function(_0x1bd7f7){if(_0x1bd7f7){return _0x16e610['status'](_0xb99ee4)[_0xdd8f('0x1c')](_0x1bd7f7);}};}function respondWithFilteredResult(_0x472cb8,_0x39ae2a){return function(_0x5cec56){if(_0x5cec56){var _0x3aaac8=typeof _0x39ae2a[_0xdd8f('0x1d')]===_0xdd8f('0x1e')&&typeof _0x39ae2a[_0xdd8f('0x1f')]==='undefined';var _0x1727c7=_0x5cec56['count'];var _0x347335=_0x3aaac8?0x0:_0x39ae2a['offset'];var _0x578e2a=_0x3aaac8?_0x5cec56[_0xdd8f('0x20')]:_0x39ae2a[_0xdd8f('0x1d')]+_0x39ae2a[_0xdd8f('0x1f')];var _0x421947;if(_0x578e2a>=_0x1727c7){_0x578e2a=_0x1727c7;_0x421947=0xc8;}else{_0x421947=0xce;}_0x472cb8[_0xdd8f('0x21')](_0x421947);return _0x472cb8[_0xdd8f('0x22')](_0xdd8f('0x23'),_0x347335+'-'+_0x578e2a+'/'+_0x1727c7)[_0xdd8f('0x1c')](_0x5cec56);}return null;};}function patchUpdates(_0x4bc834){return function(_0x3273a6){try{jsonpatch[_0xdd8f('0x24')](_0x3273a6,_0x4bc834,!![]);}catch(_0x2b475f){return BPromise[_0xdd8f('0x25')](_0x2b475f);}return _0x3273a6[_0xdd8f('0x26')]();};}function saveUpdates(_0x370405,_0x1c57c2){return function(_0x560c6b){if(_0x560c6b){return _0x560c6b[_0xdd8f('0x27')](_0x370405)['then'](function(_0x2a631e){return _0x2a631e;});}return null;};}function removeEntity(_0x1de8b8,_0x4b07e3){return function(_0x131b5a){if(_0x131b5a){return _0x131b5a['destroy']()['then'](function(){_0x1de8b8[_0xdd8f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10951b,_0x4d4d68){return function(_0x4c0047){if(!_0x4c0047){_0x10951b[_0xdd8f('0x1b')](0x194);}return _0x4c0047;};}function handleError(_0x477e65,_0x179a8b){_0x179a8b=_0x179a8b||0x1f4;return function(_0x1fbd70){logger[_0xdd8f('0x28')](_0x1fbd70['stack']);if(_0x1fbd70[_0xdd8f('0x29')]){delete _0x1fbd70['name'];}_0x477e65[_0xdd8f('0x21')](_0x179a8b)[_0xdd8f('0x2a')](_0x1fbd70);};}exports[_0xdd8f('0x2b')]=function(_0x1bac42,_0x4b1901){var _0x4d5baa={},_0x42cfb1={},_0x43b404={'count':0x0,'rows':[]};var _0xe290bd=_[_0xdd8f('0x2c')](db[_0xdd8f('0x2d')][_0xdd8f('0x2e')],function(_0x8b9b75){return{'name':_0x8b9b75[_0xdd8f('0x2f')],'type':_0x8b9b75['type'][_0xdd8f('0x30')]};});_0x42cfb1['model']=_[_0xdd8f('0x2c')](_0xe290bd,'name');_0x42cfb1[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x1bac42[_0xdd8f('0x31')]);_0x42cfb1[_0xdd8f('0x33')]=_[_0xdd8f('0x34')](_0x42cfb1[_0xdd8f('0x35')],_0x42cfb1['query']);_0x4d5baa[_0xdd8f('0x36')]=_[_0xdd8f('0x34')](_0x42cfb1[_0xdd8f('0x35')],qs[_0xdd8f('0x37')](_0x1bac42[_0xdd8f('0x31')][_0xdd8f('0x37')]));_0x4d5baa['attributes']=_0x4d5baa[_0xdd8f('0x36')][_0xdd8f('0x38')]?_0x4d5baa['attributes']:_0x42cfb1[_0xdd8f('0x35')];if(!_0x1bac42[_0xdd8f('0x31')]['hasOwnProperty'](_0xdd8f('0x39'))){_0x4d5baa['limit']=qs[_0xdd8f('0x1f')](_0x1bac42['query'][_0xdd8f('0x1f')]);_0x4d5baa[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x1bac42[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}_0x4d5baa[_0xdd8f('0x3a')]=qs[_0xdd8f('0x3b')](_0x1bac42[_0xdd8f('0x31')][_0xdd8f('0x3b')]);_0x4d5baa[_0xdd8f('0x3c')]=qs['filters'](_['pick'](_0x1bac42[_0xdd8f('0x31')],_0x42cfb1['filters']),_0xe290bd);if(_0x1bac42['query'][_0xdd8f('0x3d')]){_0x4d5baa[_0xdd8f('0x3c')]=_[_0xdd8f('0x3e')](_0x4d5baa[_0xdd8f('0x3c')],{'$or':_['map'](_0xe290bd,function(_0x1fab30){if(_0x1fab30[_0xdd8f('0x3f')]!==_0xdd8f('0x40')){var _0x40981a={};_0x40981a[_0x1fab30[_0xdd8f('0x29')]]={'$like':'%'+_0x1bac42['query']['filter']+'%'};return _0x40981a;}})});}_0x4d5baa=_[_0xdd8f('0x3e')]({},_0x4d5baa,_0x1bac42[_0xdd8f('0x41')]);var _0x5e76b2={'where':_0x4d5baa[_0xdd8f('0x3c')]};return db[_0xdd8f('0x2d')][_0xdd8f('0x20')](_0x5e76b2)[_0xdd8f('0x42')](function(_0x149ef7){_0x43b404[_0xdd8f('0x20')]=_0x149ef7;if(_0x1bac42[_0xdd8f('0x31')][_0xdd8f('0x43')]){_0x4d5baa[_0xdd8f('0x44')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xdd8f('0x45')](_0x4d5baa);})['then'](function(_0x5b0736){_0x43b404['rows']=_0x5b0736;return _0x43b404;})['then'](respondWithFilteredResult(_0x4b1901,_0x4d5baa))[_0xdd8f('0x46')](handleError(_0x4b1901,null));};exports[_0xdd8f('0x47')]=function(_0x4425ca,_0x3924b6){var _0x4d9fe2={'raw':![],'where':{'id':_0x4425ca[_0xdd8f('0x48')]['id']}},_0x2e08ff={};_0x2e08ff[_0xdd8f('0x35')]=_[_0xdd8f('0x32')](db['SalesforceConfiguration'][_0xdd8f('0x2e')]);_0x2e08ff[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x4425ca['query']);_0x2e08ff[_0xdd8f('0x33')]=_[_0xdd8f('0x34')](_0x2e08ff['model'],_0x2e08ff[_0xdd8f('0x31')]);_0x4d9fe2[_0xdd8f('0x36')]=_['intersection'](_0x2e08ff[_0xdd8f('0x35')],qs['fields'](_0x4425ca[_0xdd8f('0x31')]['fields']));_0x4d9fe2['attributes']=_0x4d9fe2['attributes'][_0xdd8f('0x38')]?_0x4d9fe2[_0xdd8f('0x36')]:_0x2e08ff['model'];if(_0x4425ca[_0xdd8f('0x31')]['includeAll']){_0x4d9fe2[_0xdd8f('0x44')]=[{'all':!![]}];}_0x4d9fe2=_['merge']({},_0x4d9fe2,_0x4425ca[_0xdd8f('0x41')]);return db[_0xdd8f('0x2d')]['find'](_0x4d9fe2)[_0xdd8f('0x42')](handleEntityNotFound(_0x3924b6,null))[_0xdd8f('0x42')](respondWithResult(_0x3924b6,null))['catch'](handleError(_0x3924b6,null));};exports[_0xdd8f('0x49')]=function(_0xfde93a,_0x2b8a0c){return db['SalesforceConfiguration'][_0xdd8f('0x49')](_0xfde93a[_0xdd8f('0x4a')],{})['then'](respondWithResult(_0x2b8a0c,0xc9))[_0xdd8f('0x46')](handleError(_0x2b8a0c,null));};exports[_0xdd8f('0x27')]=function(_0x1b5eca,_0x242201){if(_0x1b5eca[_0xdd8f('0x4a')]['id']){delete _0x1b5eca[_0xdd8f('0x4a')]['id'];}return db['SalesforceConfiguration'][_0xdd8f('0x4b')]({'where':{'id':_0x1b5eca[_0xdd8f('0x48')]['id']}})['then'](handleEntityNotFound(_0x242201,null))[_0xdd8f('0x42')](saveUpdates(_0x1b5eca['body'],null))[_0xdd8f('0x42')](respondWithResult(_0x242201,null))[_0xdd8f('0x46')](handleError(_0x242201,null));};exports[_0xdd8f('0x4c')]=function(_0x3da070,_0x2e764f){return db['SalesforceConfiguration'][_0xdd8f('0x4b')]({'where':{'id':_0x3da070[_0xdd8f('0x48')]['id']}})[_0xdd8f('0x42')](handleEntityNotFound(_0x2e764f,null))[_0xdd8f('0x42')](removeEntity(_0x2e764f,null))[_0xdd8f('0x46')](handleError(_0x2e764f,null));};exports[_0xdd8f('0x4d')]=function(_0x580444,_0x60def6,_0x948f19){var _0x35d279={};var _0x2e53b6={};var _0x551e81;var _0x2bc6de;return db[_0xdd8f('0x2d')][_0xdd8f('0x4e')]({'where':{'id':_0x580444['params']['id']}})[_0xdd8f('0x42')](handleEntityNotFound(_0x60def6,null))['then'](function(_0x522091){if(_0x522091){_0x551e81=_0x522091;_0x2e53b6[_0xdd8f('0x35')]=_[_0xdd8f('0x32')](db[_0xdd8f('0x4f')][_0xdd8f('0x2e')]);_0x2e53b6['query']=_[_0xdd8f('0x32')](_0x580444['query']);_0x2e53b6[_0xdd8f('0x33')]=_[_0xdd8f('0x34')](_0x2e53b6[_0xdd8f('0x35')],_0x2e53b6[_0xdd8f('0x31')]);_0x35d279[_0xdd8f('0x36')]=_['intersection'](_0x2e53b6[_0xdd8f('0x35')],qs[_0xdd8f('0x37')](_0x580444[_0xdd8f('0x31')][_0xdd8f('0x37')]));_0x35d279[_0xdd8f('0x36')]=_0x35d279[_0xdd8f('0x36')]['length']?_0x35d279[_0xdd8f('0x36')]:_0x2e53b6[_0xdd8f('0x35')];_0x35d279[_0xdd8f('0x3a')]=qs[_0xdd8f('0x3b')](_0x580444['query'][_0xdd8f('0x3b')]);_0x35d279[_0xdd8f('0x3c')]=qs['filters'](_[_0xdd8f('0x50')](_0x580444['query'],_0x2e53b6[_0xdd8f('0x33')]));if(_0x580444[_0xdd8f('0x31')]['filter']){_0x35d279['where']=_[_0xdd8f('0x3e')](_0x35d279[_0xdd8f('0x3c')],{'$or':_[_0xdd8f('0x2c')](_0x35d279[_0xdd8f('0x36')],function(_0x229840){var _0x384259={};_0x384259[_0x229840]={'$like':'%'+_0x580444[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x384259;})});}_0x35d279=_['merge']({},_0x35d279,_0x580444['options']);return _0x551e81['getFields'](_0x35d279);}})[_0xdd8f('0x42')](function(_0x52736f){if(_0x52736f){_0x2bc6de=_0x52736f[_0xdd8f('0x38')];if(!_0x580444['query'][_0xdd8f('0x51')](_0xdd8f('0x39'))){_0x35d279['limit']=qs[_0xdd8f('0x1f')](_0x580444['query'][_0xdd8f('0x1f')]);_0x35d279[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x580444[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}return _0x551e81[_0xdd8f('0x4d')](_0x35d279);}})[_0xdd8f('0x42')](function(_0x54af7f){if(_0x54af7f){return _0x54af7f?{'count':_0x2bc6de,'rows':_0x54af7f}:null;}})[_0xdd8f('0x42')](respondWithResult(_0x60def6,null))[_0xdd8f('0x46')](handleError(_0x60def6,null));};exports[_0xdd8f('0x52')]=function(_0x4deb58,_0x21019b,_0x31da9e){var _0x50012c={};var _0x589ab9={};var _0x3fb555;var _0x10a576;return db[_0xdd8f('0x2d')][_0xdd8f('0x4e')]({'where':{'id':_0x4deb58[_0xdd8f('0x48')]['id']}})['then'](handleEntityNotFound(_0x21019b,null))['then'](function(_0x5cf2a1){if(_0x5cf2a1){_0x3fb555=_0x5cf2a1;_0x589ab9['model']=_['keys'](db[_0xdd8f('0x4f')][_0xdd8f('0x2e')]);_0x589ab9[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x4deb58['query']);_0x589ab9['filters']=_[_0xdd8f('0x34')](_0x589ab9['model'],_0x589ab9['query']);_0x50012c[_0xdd8f('0x36')]=_[_0xdd8f('0x34')](_0x589ab9['model'],qs[_0xdd8f('0x37')](_0x4deb58[_0xdd8f('0x31')]['fields']));_0x50012c[_0xdd8f('0x36')]=_0x50012c[_0xdd8f('0x36')]['length']?_0x50012c[_0xdd8f('0x36')]:_0x589ab9[_0xdd8f('0x35')];_0x50012c[_0xdd8f('0x3a')]=qs[_0xdd8f('0x3b')](_0x4deb58[_0xdd8f('0x31')][_0xdd8f('0x3b')]);_0x50012c[_0xdd8f('0x3c')]=qs['filters'](_[_0xdd8f('0x50')](_0x4deb58['query'],_0x589ab9[_0xdd8f('0x33')]));if(_0x4deb58[_0xdd8f('0x31')][_0xdd8f('0x3d')]){_0x50012c[_0xdd8f('0x3c')]=_[_0xdd8f('0x3e')](_0x50012c[_0xdd8f('0x3c')],{'$or':_[_0xdd8f('0x2c')](_0x50012c[_0xdd8f('0x36')],function(_0x454e6e){var _0x5bb313={};_0x5bb313[_0x454e6e]={'$like':'%'+_0x4deb58[_0xdd8f('0x31')]['filter']+'%'};return _0x5bb313;})});}_0x50012c=_[_0xdd8f('0x3e')]({},_0x50012c,_0x4deb58[_0xdd8f('0x41')]);return _0x3fb555[_0xdd8f('0x52')](_0x50012c);}})['then'](function(_0x2e5be9){if(_0x2e5be9){_0x10a576=_0x2e5be9[_0xdd8f('0x38')];if(!_0x4deb58[_0xdd8f('0x31')][_0xdd8f('0x51')](_0xdd8f('0x39'))){_0x50012c[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x4deb58[_0xdd8f('0x31')][_0xdd8f('0x1f')]);_0x50012c['offset']=qs['offset'](_0x4deb58[_0xdd8f('0x31')]['offset']);}return _0x3fb555[_0xdd8f('0x52')](_0x50012c);}})['then'](function(_0x3e65d3){if(_0x3e65d3){return _0x3e65d3?{'count':_0x10a576,'rows':_0x3e65d3}:null;}})[_0xdd8f('0x42')](respondWithResult(_0x21019b,null))[_0xdd8f('0x46')](handleError(_0x21019b,null));};exports['getDescriptions']=function(_0x5dcb69,_0x4a08e4,_0x2e460c){var _0x4bd771={};var _0x189f81={};var _0x33154b;var _0xd81f41;return db['SalesforceConfiguration'][_0xdd8f('0x4e')]({'where':{'id':_0x5dcb69[_0xdd8f('0x48')]['id']}})[_0xdd8f('0x42')](handleEntityNotFound(_0x4a08e4,null))['then'](function(_0x1e8588){if(_0x1e8588){_0x33154b=_0x1e8588;_0x189f81[_0xdd8f('0x35')]=_[_0xdd8f('0x32')](db[_0xdd8f('0x4f')][_0xdd8f('0x2e')]);_0x189f81[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x5dcb69[_0xdd8f('0x31')]);_0x189f81['filters']=_[_0xdd8f('0x34')](_0x189f81['model'],_0x189f81[_0xdd8f('0x31')]);_0x4bd771[_0xdd8f('0x36')]=_['intersection'](_0x189f81[_0xdd8f('0x35')],qs[_0xdd8f('0x37')](_0x5dcb69[_0xdd8f('0x31')][_0xdd8f('0x37')]));_0x4bd771[_0xdd8f('0x36')]=_0x4bd771[_0xdd8f('0x36')][_0xdd8f('0x38')]?_0x4bd771['attributes']:_0x189f81['model'];_0x4bd771[_0xdd8f('0x3a')]=qs[_0xdd8f('0x3b')](_0x5dcb69[_0xdd8f('0x31')][_0xdd8f('0x3b')]);_0x4bd771[_0xdd8f('0x3c')]=qs[_0xdd8f('0x33')](_[_0xdd8f('0x50')](_0x5dcb69['query'],_0x189f81[_0xdd8f('0x33')]));if(_0x5dcb69['query']['filter']){_0x4bd771['where']=_['merge'](_0x4bd771['where'],{'$or':_['map'](_0x4bd771[_0xdd8f('0x36')],function(_0x28ce87){var _0x2b9041={};_0x2b9041[_0x28ce87]={'$like':'%'+_0x5dcb69[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x2b9041;})});}_0x4bd771=_[_0xdd8f('0x3e')]({},_0x4bd771,_0x5dcb69[_0xdd8f('0x41')]);return _0x33154b[_0xdd8f('0x53')](_0x4bd771);}})[_0xdd8f('0x42')](function(_0x318009){if(_0x318009){_0xd81f41=_0x318009[_0xdd8f('0x38')];if(!_0x5dcb69[_0xdd8f('0x31')][_0xdd8f('0x51')]('nolimit')){_0x4bd771['limit']=qs[_0xdd8f('0x1f')](_0x5dcb69['query'][_0xdd8f('0x1f')]);_0x4bd771[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x5dcb69[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}return _0x33154b[_0xdd8f('0x53')](_0x4bd771);}})[_0xdd8f('0x42')](function(_0x1fa964){if(_0x1fa964){return _0x1fa964?{'count':_0xd81f41,'rows':_0x1fa964}:null;}})[_0xdd8f('0x42')](respondWithResult(_0x4a08e4,null))['catch'](handleError(_0x4a08e4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ecfd09a..fc135c5 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 _0x8ec4=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','api','moment','bluebird','request-promise'];(function(_0x4f33e9,_0x2b699a){var _0x3ee7c4=function(_0x59c560){while(--_0x59c560){_0x4f33e9['push'](_0x4f33e9['shift']());}};_0x3ee7c4(++_0x2b699a);}(_0x8ec4,0xdf));var _0x48ec=function(_0x243fa3,_0x4b4684){_0x243fa3=_0x243fa3-0x0;var _0x544586=_0x8ec4[_0x243fa3];return _0x544586;};'use strict';var _=require(_0x48ec('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ec('0x1'));var moment=require(_0x48ec('0x2'));var BPromise=require(_0x48ec('0x3'));var rp=require(_0x48ec('0x4'));var fs=require('fs');var path=require(_0x48ec('0x5'));var rimraf=require(_0x48ec('0x6'));var config=require(_0x48ec('0x7'));var attributes=require(_0x48ec('0x8'));module['exports']=function(_0x54b88d,_0x107e63){return _0x54b88d[_0x48ec('0x9')](_0x48ec('0xa'),attributes,{'tableName':_0x48ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dde=['path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c6501,_0x5b0362){var _0x3709c7=function(_0x370aaf){while(--_0x370aaf){_0x3c6501['push'](_0x3c6501['shift']());}};_0x3709c7(++_0x5b0362);}(_0x2dde,0x1db));var _0xe2dd=function(_0x4a2447,_0xe6831a){_0x4a2447=_0x4a2447-0x0;var _0x48f6e5=_0x2dde[_0x4a2447];return _0x48f6e5;};'use strict';var _=require(_0xe2dd('0x0'));var util=require(_0xe2dd('0x1'));var logger=require(_0xe2dd('0x2'))('api');var moment=require(_0xe2dd('0x3'));var BPromise=require(_0xe2dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2dd('0x5'));var rimraf=require(_0xe2dd('0x6'));var config=require('../../config/environment');var attributes=require(_0xe2dd('0x7'));module[_0xe2dd('0x8')]=function(_0x42cf33,_0x24add0){return _0x42cf33[_0xe2dd('0x9')](_0xe2dd('0xa'),attributes,{'tableName':_0xe2dd('0xb'),'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 ec6d76d..cd45da3 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 _0xcfb0=['request\x20sent','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug'];(function(_0x3ff3c2,_0x4cd083){var _0x1fb2a4=function(_0x28c1ce){while(--_0x28c1ce){_0x3ff3c2['push'](_0x3ff3c2['shift']());}};_0x1fb2a4(++_0x4cd083);}(_0xcfb0,0x124));var _0x0cfb=function(_0x290169,_0x2a2377){_0x290169=_0x290169-0x0;var _0x3aa33e=_0xcfb0[_0x290169];return _0x3aa33e;};'use strict';var _=require('lodash');var util=require(_0x0cfb('0x0'));var moment=require(_0x0cfb('0x1'));var BPromise=require('bluebird');var rs=require(_0x0cfb('0x2'));var fs=require('fs');var Redis=require(_0x0cfb('0x3'));var db=require(_0x0cfb('0x4'))['db'];var utils=require(_0x0cfb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0cfb('0x6')][_0x0cfb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1509b5,_0x2a81f3,_0x55cc21){return new BPromise(function(_0x4b94a9,_0x928098){return client[_0x0cfb('0x8')](_0x1509b5,_0x55cc21)[_0x0cfb('0x9')](function(_0x334fa3){logger['info'](_0x0cfb('0xa'),_0x2a81f3,'request\x20sent');logger[_0x0cfb('0xb')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2a81f3,_0x0cfb('0xc'),JSON[_0x0cfb('0xd')](_0x334fa3));if(_0x334fa3[_0x0cfb('0xe')]){if(_0x334fa3['error']['code']===0x1f4){logger[_0x0cfb('0xe')](_0x0cfb('0xa'),_0x2a81f3,_0x334fa3[_0x0cfb('0xe')][_0x0cfb('0xf')]);return _0x928098(_0x334fa3[_0x0cfb('0xe')]['message']);}logger[_0x0cfb('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2a81f3,_0x334fa3['error']['message']);return _0x4b94a9(_0x334fa3[_0x0cfb('0xe')]['message']);}else{logger[_0x0cfb('0x10')](_0x0cfb('0xa'),_0x2a81f3,_0x0cfb('0xc'));_0x4b94a9(_0x334fa3[_0x0cfb('0x11')]['message']);}})[_0x0cfb('0x12')](function(_0xbbeb8d){logger[_0x0cfb('0xe')](_0x0cfb('0xa'),_0x2a81f3,_0xbbeb8d);_0x928098(_0xbbeb8d);});});} \ No newline at end of file +var _0x7516=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x330458,_0xa91caa){var _0x2990d8=function(_0x512807){while(--_0x512807){_0x330458['push'](_0x330458['shift']());}};_0x2990d8(++_0xa91caa);}(_0x7516,0xba));var _0x6751=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x7516[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x6751('0x0'));var util=require(_0x6751('0x1'));var moment=require(_0x6751('0x2'));var BPromise=require('bluebird');var rs=require(_0x6751('0x3'));var fs=require('fs');var Redis=require(_0x6751('0x4'));var db=require(_0x6751('0x5'))['db'];var utils=require(_0x6751('0x6'));var logger=require(_0x6751('0x7'))(_0x6751('0x8'));var config=require(_0x6751('0x9'));var jayson=require(_0x6751('0xa'));var client=jayson['client'][_0x6751('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2417ef,_0x9e05d3,_0x50611f){return new BPromise(function(_0x7a83ba,_0x1464ca){return client[_0x6751('0xc')](_0x2417ef,_0x50611f)[_0x6751('0xd')](function(_0xf6998e){logger[_0x6751('0xe')](_0x6751('0xf'),_0x9e05d3,'request\x20sent');logger['debug'](_0x6751('0x10'),_0x9e05d3,_0x6751('0x11'),JSON[_0x6751('0x12')](_0xf6998e));if(_0xf6998e['error']){if(_0xf6998e[_0x6751('0x13')][_0x6751('0x14')]===0x1f4){logger[_0x6751('0x13')](_0x6751('0xf'),_0x9e05d3,_0xf6998e[_0x6751('0x13')][_0x6751('0x15')]);return _0x1464ca(_0xf6998e[_0x6751('0x13')][_0x6751('0x15')]);}logger[_0x6751('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x9e05d3,_0xf6998e[_0x6751('0x13')][_0x6751('0x15')]);return _0x7a83ba(_0xf6998e[_0x6751('0x13')][_0x6751('0x15')]);}else{logger[_0x6751('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x9e05d3,_0x6751('0x11'));_0x7a83ba(_0xf6998e[_0x6751('0x16')]['message']);}})[_0x6751('0x17')](function(_0x3bd205){logger[_0x6751('0x13')](_0x6751('0xf'),_0x9e05d3,_0x3bd205);_0x1464ca(_0x3bd205);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5c17fce..7755ef1 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 _0x54aa=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','put','/:id','update','delete'];(function(_0x41f3e8,_0x8a519a){var _0x1358ea=function(_0x2053b1){while(--_0x2053b1){_0x41f3e8['push'](_0x41f3e8['shift']());}};_0x1358ea(++_0x8a519a);}(_0x54aa,0xc8));var _0xa54a=function(_0x95547b,_0x299359){_0x95547b=_0x95547b-0x0;var _0x445df9=_0x54aa[_0x95547b];return _0x445df9;};'use strict';var multer=require(_0xa54a('0x0'));var util=require(_0xa54a('0x1'));var path=require('path');var timeout=require(_0xa54a('0x2'));var express=require('express');var router=express[_0xa54a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa54a('0x4'));var interaction=require(_0xa54a('0x5'));var config=require(_0xa54a('0x6'));var controller=require('./intSalesforceField.controller');router[_0xa54a('0x7')]('/',auth['isAuthenticated'](),controller[_0xa54a('0x8')]);router[_0xa54a('0x7')]('/:id',auth[_0xa54a('0x9')](),controller[_0xa54a('0xa')]);router[_0xa54a('0xb')]('/',auth[_0xa54a('0x9')](),controller['create']);router[_0xa54a('0xc')](_0xa54a('0xd'),auth['isAuthenticated'](),controller[_0xa54a('0xe')]);router[_0xa54a('0xf')]('/:id',auth[_0xa54a('0x9')](),controller[_0xa54a('0x10')]);module[_0xa54a('0x11')]=router; \ No newline at end of file +var _0xd19c=['/:id','show','post','create','update','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd19c,0xd3));var _0xcd19=function(_0x5c3bfc,_0x48438e){_0x5c3bfc=_0x5c3bfc-0x0;var _0x246b7b=_0xd19c[_0x5c3bfc];return _0x246b7b;};'use strict';var multer=require(_0xcd19('0x0'));var util=require('util');var path=require(_0xcd19('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcd19('0x2')]();var fs_extra=require(_0xcd19('0x3'));var auth=require(_0xcd19('0x4'));var interaction=require(_0xcd19('0x5'));var config=require('../../config/environment');var controller=require(_0xcd19('0x6'));router[_0xcd19('0x7')]('/',auth[_0xcd19('0x8')](),controller[_0xcd19('0x9')]);router[_0xcd19('0x7')](_0xcd19('0xa'),auth[_0xcd19('0x8')](),controller[_0xcd19('0xb')]);router[_0xcd19('0xc')]('/',auth[_0xcd19('0x8')](),controller[_0xcd19('0xd')]);router['put'](_0xcd19('0xa'),auth[_0xcd19('0x8')](),controller[_0xcd19('0xe')]);router['delete'](_0xcd19('0xa'),auth[_0xcd19('0x8')](),controller[_0xcd19('0xf')]);module[_0xcd19('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 4745b7b..b888924 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 _0xac08=['STRING','customVariable','ENUM','string','variable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac08,0x64));var _0x8ac0=function(_0x5b4d15,_0x47effb){_0x5b4d15=_0x5b4d15-0x0;var _0x5f934a=_0xac08[_0x5b4d15];return _0x5f934a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8ac0('0x0')](_0x8ac0('0x1'),_0x8ac0('0x2'),'customVariable',_0x8ac0('0x3'),_0x8ac0('0x4')),'defaultValue':_0x8ac0('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8ac0('0x5')]},'keyType':{'type':Sequelize[_0x8ac0('0x0')](_0x8ac0('0x1'),_0x8ac0('0x2'),_0x8ac0('0x6'))},'keyContent':{'type':Sequelize[_0x8ac0('0x5')]},'idField':{'type':Sequelize[_0x8ac0('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4c3=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x4ab2cb,_0x4fbb44){var _0x3b07c6=function(_0x3d68f7){while(--_0x3d68f7){_0x4ab2cb['push'](_0x4ab2cb['shift']());}};_0x3b07c6(++_0x4fbb44);}(_0xd4c3,0x15d));var _0x3d4c=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0xd4c3[_0xf4666e];return _0x1853f1;};'use strict';var Sequelize=require(_0x3d4c('0x0'));module[_0x3d4c('0x1')]={'type':{'type':Sequelize[_0x3d4c('0x2')](_0x3d4c('0x3'),_0x3d4c('0x4'),'customVariable',_0x3d4c('0x5'),_0x3d4c('0x6')),'defaultValue':_0x3d4c('0x3')},'content':{'type':Sequelize[_0x3d4c('0x7')]},'key':{'type':Sequelize[_0x3d4c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3d4c('0x3'),_0x3d4c('0x4'),_0x3d4c('0x8'))},'keyContent':{'type':Sequelize[_0x3d4c('0x7')]},'idField':{'type':Sequelize[_0x3d4c('0x7')]},'variableName':{'type':Sequelize[_0x3d4c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c413b74..9c48e1e 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 _0x2bb6=['offset','undefined','limit','count','Content-Range','reject','save','then','status','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','fields','length','includeAll','create','body','update','find','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','end','json'];(function(_0x12953b,_0x1a5a04){var _0x3bd8f2=function(_0x1c284b){while(--_0x1c284b){_0x12953b['push'](_0x12953b['shift']());}};_0x3bd8f2(++_0x1a5a04);}(_0x2bb6,0x146));var _0x62bb=function(_0xb012e3,_0x33b165){_0xb012e3=_0xb012e3-0x0;var _0x195c7e=_0x2bb6[_0xb012e3];return _0x195c7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x62bb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62bb('0x1'));var moment=require(_0x62bb('0x2'));var BPromise=require(_0x62bb('0x3'));var Mustache=require(_0x62bb('0x4'));var util=require(_0x62bb('0x5'));var path=require(_0x62bb('0x6'));var sox=require(_0x62bb('0x7'));var csv=require(_0x62bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62bb('0x9'));var _=require('lodash');var squel=require(_0x62bb('0xa'));var crypto=require(_0x62bb('0xb'));var jsforce=require(_0x62bb('0xc'));var deskjs=require(_0x62bb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x62bb('0xe'));var Papa=require(_0x62bb('0xf'));var Redis=require('ioredis');var authService=require(_0x62bb('0x10'));var qs=require(_0x62bb('0x11'));var as=require(_0x62bb('0x12'));var hardwareService=require(_0x62bb('0x13'));var logger=require(_0x62bb('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x62bb('0x15'))['db'];function respondWithStatusCode(_0x273d81,_0x2a05ef){_0x2a05ef=_0x2a05ef||0xcc;return function(_0x461fa5){if(_0x461fa5){return _0x273d81['sendStatus'](_0x2a05ef);}return _0x273d81['status'](_0x2a05ef)[_0x62bb('0x16')]();};}function respondWithResult(_0x477246,_0x4d67b6){_0x4d67b6=_0x4d67b6||0xc8;return function(_0x57ca29){if(_0x57ca29){return _0x477246['status'](_0x4d67b6)[_0x62bb('0x17')](_0x57ca29);}};}function respondWithFilteredResult(_0x41afe5,_0x4f9b60){return function(_0x1cd0d3){if(_0x1cd0d3){var _0x45c6ce=typeof _0x4f9b60[_0x62bb('0x18')]===_0x62bb('0x19')&&typeof _0x4f9b60[_0x62bb('0x1a')]===_0x62bb('0x19');var _0xdac046=_0x1cd0d3[_0x62bb('0x1b')];var _0x250860=_0x45c6ce?0x0:_0x4f9b60['offset'];var _0x3462b6=_0x45c6ce?_0x1cd0d3['count']:_0x4f9b60[_0x62bb('0x18')]+_0x4f9b60[_0x62bb('0x1a')];var _0x1817d6;if(_0x3462b6>=_0xdac046){_0x3462b6=_0xdac046;_0x1817d6=0xc8;}else{_0x1817d6=0xce;}_0x41afe5['status'](_0x1817d6);return _0x41afe5['set'](_0x62bb('0x1c'),_0x250860+'-'+_0x3462b6+'/'+_0xdac046)[_0x62bb('0x17')](_0x1cd0d3);}return null;};}function patchUpdates(_0x5cc326){return function(_0x442ade){try{jsonpatch['apply'](_0x442ade,_0x5cc326,!![]);}catch(_0x5311d8){return BPromise[_0x62bb('0x1d')](_0x5311d8);}return _0x442ade[_0x62bb('0x1e')]();};}function saveUpdates(_0x379088,_0x32ae25){return function(_0x5203dd){if(_0x5203dd){return _0x5203dd['update'](_0x379088)['then'](function(_0x44feaa){return _0x44feaa;});}return null;};}function removeEntity(_0x4fca2f,_0x22cd8d){return function(_0x4a2faf){if(_0x4a2faf){return _0x4a2faf['destroy']()[_0x62bb('0x1f')](function(){_0x4fca2f[_0x62bb('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221763,_0x2bab1a){return function(_0x54dfa9){if(!_0x54dfa9){_0x221763['sendStatus'](0x194);}return _0x54dfa9;};}function handleError(_0x1729a3,_0xfafaa6){_0xfafaa6=_0xfafaa6||0x1f4;return function(_0x2c3032){logger['error'](_0x2c3032[_0x62bb('0x21')]);if(_0x2c3032[_0x62bb('0x22')]){delete _0x2c3032[_0x62bb('0x22')];}_0x1729a3['status'](_0xfafaa6)[_0x62bb('0x23')](_0x2c3032);};}exports[_0x62bb('0x24')]=function(_0x133de9,_0x4145ad){var _0x41c377={},_0x347d06={},_0x2f2983={'count':0x0,'rows':[]};var _0x36a93f=_[_0x62bb('0x25')](db[_0x62bb('0x26')][_0x62bb('0x27')],function(_0xd59602){return{'name':_0xd59602[_0x62bb('0x28')],'type':_0xd59602[_0x62bb('0x29')][_0x62bb('0x2a')]};});_0x347d06[_0x62bb('0x2b')]=_[_0x62bb('0x25')](_0x36a93f,_0x62bb('0x22'));_0x347d06[_0x62bb('0x2c')]=_[_0x62bb('0x2d')](_0x133de9['query']);_0x347d06[_0x62bb('0x2e')]=_[_0x62bb('0x2f')](_0x347d06[_0x62bb('0x2b')],_0x347d06[_0x62bb('0x2c')]);_0x41c377[_0x62bb('0x30')]=_['intersection'](_0x347d06[_0x62bb('0x2b')],qs['fields'](_0x133de9[_0x62bb('0x2c')]['fields']));_0x41c377[_0x62bb('0x30')]=_0x41c377[_0x62bb('0x30')]['length']?_0x41c377['attributes']:_0x347d06[_0x62bb('0x2b')];if(!_0x133de9[_0x62bb('0x2c')][_0x62bb('0x31')](_0x62bb('0x32'))){_0x41c377[_0x62bb('0x1a')]=qs['limit'](_0x133de9['query'][_0x62bb('0x1a')]);_0x41c377[_0x62bb('0x18')]=qs[_0x62bb('0x18')](_0x133de9['query'][_0x62bb('0x18')]);}_0x41c377[_0x62bb('0x33')]=qs[_0x62bb('0x34')](_0x133de9[_0x62bb('0x2c')]['sort']);_0x41c377[_0x62bb('0x35')]=qs[_0x62bb('0x2e')](_[_0x62bb('0x36')](_0x133de9[_0x62bb('0x2c')],_0x347d06[_0x62bb('0x2e')]),_0x36a93f);if(_0x133de9[_0x62bb('0x2c')][_0x62bb('0x37')]){_0x41c377[_0x62bb('0x35')]=_[_0x62bb('0x38')](_0x41c377[_0x62bb('0x35')],{'$or':_[_0x62bb('0x25')](_0x36a93f,function(_0x3f10a0){if(_0x3f10a0[_0x62bb('0x29')]!==_0x62bb('0x39')){var _0x528d1f={};_0x528d1f[_0x3f10a0[_0x62bb('0x22')]]={'$like':'%'+_0x133de9[_0x62bb('0x2c')][_0x62bb('0x37')]+'%'};return _0x528d1f;}})});}_0x41c377=_['merge']({},_0x41c377,_0x133de9[_0x62bb('0x3a')]);var _0xa7c26d={'where':_0x41c377[_0x62bb('0x35')]};return db[_0x62bb('0x26')][_0x62bb('0x1b')](_0xa7c26d)['then'](function(_0x55ec77){_0x2f2983[_0x62bb('0x1b')]=_0x55ec77;if(_0x133de9['query']['includeAll']){_0x41c377[_0x62bb('0x3b')]=[{'all':!![]}];}return db[_0x62bb('0x26')]['findAll'](_0x41c377);})[_0x62bb('0x1f')](function(_0x3a82ce){_0x2f2983['rows']=_0x3a82ce;return _0x2f2983;})[_0x62bb('0x1f')](respondWithFilteredResult(_0x4145ad,_0x41c377))[_0x62bb('0x3c')](handleError(_0x4145ad,null));};exports[_0x62bb('0x3d')]=function(_0x2760c8,_0x4e8388){var _0x2b682f={'raw':!![],'where':{'id':_0x2760c8[_0x62bb('0x3e')]['id']}},_0x542327={};_0x542327[_0x62bb('0x2b')]=_['keys'](db[_0x62bb('0x26')]['rawAttributes']);_0x542327[_0x62bb('0x2c')]=_['keys'](_0x2760c8[_0x62bb('0x2c')]);_0x542327['filters']=_[_0x62bb('0x2f')](_0x542327[_0x62bb('0x2b')],_0x542327[_0x62bb('0x2c')]);_0x2b682f[_0x62bb('0x30')]=_[_0x62bb('0x2f')](_0x542327[_0x62bb('0x2b')],qs[_0x62bb('0x3f')](_0x2760c8[_0x62bb('0x2c')][_0x62bb('0x3f')]));_0x2b682f[_0x62bb('0x30')]=_0x2b682f[_0x62bb('0x30')][_0x62bb('0x40')]?_0x2b682f[_0x62bb('0x30')]:_0x542327[_0x62bb('0x2b')];if(_0x2760c8[_0x62bb('0x2c')][_0x62bb('0x41')]){_0x2b682f['include']=[{'all':!![]}];}_0x2b682f=_[_0x62bb('0x38')]({},_0x2b682f,_0x2760c8[_0x62bb('0x3a')]);return db[_0x62bb('0x26')]['find'](_0x2b682f)[_0x62bb('0x1f')](handleEntityNotFound(_0x4e8388,null))[_0x62bb('0x1f')](respondWithResult(_0x4e8388,null))[_0x62bb('0x3c')](handleError(_0x4e8388,null));};exports[_0x62bb('0x42')]=function(_0x4482f8,_0x157c03){return db[_0x62bb('0x26')][_0x62bb('0x42')](_0x4482f8[_0x62bb('0x43')],{})['then'](respondWithResult(_0x157c03,0xc9))['catch'](handleError(_0x157c03,null));};exports[_0x62bb('0x44')]=function(_0x382a00,_0x3d9e82){if(_0x382a00[_0x62bb('0x43')]['id']){delete _0x382a00[_0x62bb('0x43')]['id'];}return db[_0x62bb('0x26')]['find']({'where':{'id':_0x382a00[_0x62bb('0x3e')]['id']}})[_0x62bb('0x1f')](handleEntityNotFound(_0x3d9e82,null))[_0x62bb('0x1f')](saveUpdates(_0x382a00['body'],null))[_0x62bb('0x1f')](respondWithResult(_0x3d9e82,null))[_0x62bb('0x3c')](handleError(_0x3d9e82,null));};exports['destroy']=function(_0x37647c,_0x18e2a1){return db['SalesforceField'][_0x62bb('0x45')]({'where':{'id':_0x37647c['params']['id']}})[_0x62bb('0x1f')](handleEntityNotFound(_0x18e2a1,null))[_0x62bb('0x1f')](removeEntity(_0x18e2a1,null))[_0x62bb('0x3c')](handleError(_0x18e2a1,null));}; \ No newline at end of file +var _0x05f7=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','model','map'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x05f7,0xaf));var _0x705f=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x05f7[_0x50cd41];return _0x399475;};'use strict';var emlformat=require(_0x705f('0x0'));var rimraf=require(_0x705f('0x1'));var zipdir=require(_0x705f('0x2'));var jsonpatch=require(_0x705f('0x3'));var rp=require(_0x705f('0x4'));var moment=require(_0x705f('0x5'));var BPromise=require(_0x705f('0x6'));var Mustache=require('mustache');var util=require(_0x705f('0x7'));var path=require('path');var sox=require(_0x705f('0x8'));var csv=require('to-csv');var ejs=require(_0x705f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x705f('0xa'));var squel=require('squel');var crypto=require(_0x705f('0xb'));var jsforce=require(_0x705f('0xc'));var deskjs=require(_0x705f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x705f('0xe'));var Papa=require(_0x705f('0xf'));var Redis=require(_0x705f('0x10'));var authService=require(_0x705f('0x11'));var qs=require(_0x705f('0x12'));var as=require(_0x705f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x705f('0x14'))(_0x705f('0x15'));var utils=require(_0x705f('0x16'));var config=require(_0x705f('0x17'));var licenseUtil=require(_0x705f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2586,_0x49b43c){_0x49b43c=_0x49b43c||0xcc;return function(_0x1d626a){if(_0x1d626a){return _0x4f2586[_0x705f('0x19')](_0x49b43c);}return _0x4f2586['status'](_0x49b43c)[_0x705f('0x1a')]();};}function respondWithResult(_0x18f1ef,_0x1f3c5f){_0x1f3c5f=_0x1f3c5f||0xc8;return function(_0x2cf582){if(_0x2cf582){return _0x18f1ef[_0x705f('0x1b')](_0x1f3c5f)[_0x705f('0x1c')](_0x2cf582);}};}function respondWithFilteredResult(_0x4ad4b7,_0x322508){return function(_0x29c307){if(_0x29c307){var _0x30bbfb=typeof _0x322508['offset']===_0x705f('0x1d')&&typeof _0x322508[_0x705f('0x1e')]===_0x705f('0x1d');var _0x313e6c=_0x29c307[_0x705f('0x1f')];var _0x682934=_0x30bbfb?0x0:_0x322508[_0x705f('0x20')];var _0x2f8f88=_0x30bbfb?_0x29c307[_0x705f('0x1f')]:_0x322508[_0x705f('0x20')]+_0x322508['limit'];var _0x74fc90;if(_0x2f8f88>=_0x313e6c){_0x2f8f88=_0x313e6c;_0x74fc90=0xc8;}else{_0x74fc90=0xce;}_0x4ad4b7[_0x705f('0x1b')](_0x74fc90);return _0x4ad4b7[_0x705f('0x21')](_0x705f('0x22'),_0x682934+'-'+_0x2f8f88+'/'+_0x313e6c)[_0x705f('0x1c')](_0x29c307);}return null;};}function patchUpdates(_0x1e0fa0){return function(_0x745b44){try{jsonpatch['apply'](_0x745b44,_0x1e0fa0,!![]);}catch(_0x2038a5){return BPromise['reject'](_0x2038a5);}return _0x745b44[_0x705f('0x23')]();};}function saveUpdates(_0x48ab8c,_0x4daecc){return function(_0x52b468){if(_0x52b468){return _0x52b468[_0x705f('0x24')](_0x48ab8c)[_0x705f('0x25')](function(_0x472008){return _0x472008;});}return null;};}function removeEntity(_0x2ac386,_0xb44393){return function(_0x4ef421){if(_0x4ef421){return _0x4ef421[_0x705f('0x26')]()['then'](function(){_0x2ac386['status'](0xcc)[_0x705f('0x1a')]();});}};}function handleEntityNotFound(_0x43d969,_0x465435){return function(_0x587db5){if(!_0x587db5){_0x43d969[_0x705f('0x19')](0x194);}return _0x587db5;};}function handleError(_0x1c5974,_0x100a3d){_0x100a3d=_0x100a3d||0x1f4;return function(_0x2400a9){logger[_0x705f('0x27')](_0x2400a9['stack']);if(_0x2400a9[_0x705f('0x28')]){delete _0x2400a9['name'];}_0x1c5974[_0x705f('0x1b')](_0x100a3d)['send'](_0x2400a9);};}exports[_0x705f('0x29')]=function(_0x429337,_0x2ba30d){var _0x1fb3cd={},_0x3118ec={},_0x10465e={'count':0x0,'rows':[]};var _0x2beb6f=_['map'](db['SalesforceField'][_0x705f('0x2a')],function(_0x4f9c6b){return{'name':_0x4f9c6b[_0x705f('0x2b')],'type':_0x4f9c6b[_0x705f('0x2c')]['key']};});_0x3118ec[_0x705f('0x2d')]=_[_0x705f('0x2e')](_0x2beb6f,'name');_0x3118ec['query']=_['keys'](_0x429337[_0x705f('0x2f')]);_0x3118ec[_0x705f('0x30')]=_[_0x705f('0x31')](_0x3118ec[_0x705f('0x2d')],_0x3118ec[_0x705f('0x2f')]);_0x1fb3cd[_0x705f('0x32')]=_[_0x705f('0x31')](_0x3118ec['model'],qs[_0x705f('0x33')](_0x429337['query'][_0x705f('0x33')]));_0x1fb3cd[_0x705f('0x32')]=_0x1fb3cd[_0x705f('0x32')][_0x705f('0x34')]?_0x1fb3cd['attributes']:_0x3118ec[_0x705f('0x2d')];if(!_0x429337[_0x705f('0x2f')][_0x705f('0x35')](_0x705f('0x36'))){_0x1fb3cd['limit']=qs[_0x705f('0x1e')](_0x429337['query'][_0x705f('0x1e')]);_0x1fb3cd['offset']=qs[_0x705f('0x20')](_0x429337[_0x705f('0x2f')][_0x705f('0x20')]);}_0x1fb3cd[_0x705f('0x37')]=qs[_0x705f('0x38')](_0x429337[_0x705f('0x2f')][_0x705f('0x38')]);_0x1fb3cd[_0x705f('0x39')]=qs[_0x705f('0x30')](_[_0x705f('0x3a')](_0x429337[_0x705f('0x2f')],_0x3118ec[_0x705f('0x30')]),_0x2beb6f);if(_0x429337[_0x705f('0x2f')][_0x705f('0x3b')]){_0x1fb3cd[_0x705f('0x39')]=_[_0x705f('0x3c')](_0x1fb3cd[_0x705f('0x39')],{'$or':_[_0x705f('0x2e')](_0x2beb6f,function(_0x48a9d6){if(_0x48a9d6[_0x705f('0x2c')]!==_0x705f('0x3d')){var _0x16cd56={};_0x16cd56[_0x48a9d6[_0x705f('0x28')]]={'$like':'%'+_0x429337[_0x705f('0x2f')]['filter']+'%'};return _0x16cd56;}})});}_0x1fb3cd=_['merge']({},_0x1fb3cd,_0x429337[_0x705f('0x3e')]);var _0x6debff={'where':_0x1fb3cd[_0x705f('0x39')]};return db[_0x705f('0x3f')][_0x705f('0x1f')](_0x6debff)[_0x705f('0x25')](function(_0x915de8){_0x10465e[_0x705f('0x1f')]=_0x915de8;if(_0x429337['query']['includeAll']){_0x1fb3cd['include']=[{'all':!![]}];}return db[_0x705f('0x3f')][_0x705f('0x40')](_0x1fb3cd);})['then'](function(_0x3b32d9){_0x10465e[_0x705f('0x41')]=_0x3b32d9;return _0x10465e;})[_0x705f('0x25')](respondWithFilteredResult(_0x2ba30d,_0x1fb3cd))[_0x705f('0x42')](handleError(_0x2ba30d,null));};exports[_0x705f('0x43')]=function(_0x58e510,_0x83704){var _0x36469b={'raw':!![],'where':{'id':_0x58e510[_0x705f('0x44')]['id']}},_0x57a943={};_0x57a943['model']=_[_0x705f('0x45')](db[_0x705f('0x3f')][_0x705f('0x2a')]);_0x57a943[_0x705f('0x2f')]=_[_0x705f('0x45')](_0x58e510[_0x705f('0x2f')]);_0x57a943[_0x705f('0x30')]=_[_0x705f('0x31')](_0x57a943[_0x705f('0x2d')],_0x57a943[_0x705f('0x2f')]);_0x36469b[_0x705f('0x32')]=_[_0x705f('0x31')](_0x57a943[_0x705f('0x2d')],qs[_0x705f('0x33')](_0x58e510['query'][_0x705f('0x33')]));_0x36469b[_0x705f('0x32')]=_0x36469b[_0x705f('0x32')][_0x705f('0x34')]?_0x36469b[_0x705f('0x32')]:_0x57a943['model'];if(_0x58e510[_0x705f('0x2f')][_0x705f('0x46')]){_0x36469b['include']=[{'all':!![]}];}_0x36469b=_[_0x705f('0x3c')]({},_0x36469b,_0x58e510[_0x705f('0x3e')]);return db[_0x705f('0x3f')][_0x705f('0x47')](_0x36469b)[_0x705f('0x25')](handleEntityNotFound(_0x83704,null))[_0x705f('0x25')](respondWithResult(_0x83704,null))[_0x705f('0x42')](handleError(_0x83704,null));};exports['create']=function(_0x54dccb,_0x566f54){return db[_0x705f('0x3f')][_0x705f('0x48')](_0x54dccb[_0x705f('0x49')],{})[_0x705f('0x25')](respondWithResult(_0x566f54,0xc9))['catch'](handleError(_0x566f54,null));};exports[_0x705f('0x24')]=function(_0x5e2fba,_0x521692){if(_0x5e2fba['body']['id']){delete _0x5e2fba[_0x705f('0x49')]['id'];}return db[_0x705f('0x3f')]['find']({'where':{'id':_0x5e2fba[_0x705f('0x44')]['id']}})['then'](handleEntityNotFound(_0x521692,null))[_0x705f('0x25')](saveUpdates(_0x5e2fba[_0x705f('0x49')],null))[_0x705f('0x25')](respondWithResult(_0x521692,null))[_0x705f('0x42')](handleError(_0x521692,null));};exports[_0x705f('0x26')]=function(_0x2cfe39,_0x496d13){return db[_0x705f('0x3f')][_0x705f('0x47')]({'where':{'id':_0x2cfe39[_0x705f('0x44')]['id']}})[_0x705f('0x25')](handleEntityNotFound(_0x496d13,null))['then'](removeEntity(_0x496d13,null))['catch'](handleError(_0x496d13,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 419ba3e..97e8b1c 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 _0xd8d9=['moment','request-promise','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','../../config/logger','api'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xd8d9,0xb8));var _0x9d8d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xd8d9[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x9d8d('0x0'));var util=require('util');var logger=require(_0x9d8d('0x1'))(_0x9d8d('0x2'));var moment=require(_0x9d8d('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d8d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d8d('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x9d8d('0x6')]=function(_0x3480e4,_0x536d8f){return _0x3480e4[_0x9d8d('0x7')]('SalesforceField',attributes,{'tableName':_0x9d8d('0x8'),'paranoid':![],'indexes':[{'name':_0x9d8d('0x9'),'fields':[_0x9d8d('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c7f=['idField','FieldId','lodash','util','bluebird','path','rimraf','../../config/environment','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x442b41,_0x22dc53){var _0x140d06=function(_0x5afa6d){while(--_0x5afa6d){_0x442b41['push'](_0x442b41['shift']());}};_0x140d06(++_0x22dc53);}(_0x1c7f,0x7b));var _0xf1c7=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x1c7f[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0xf1c7('0x0'));var util=require(_0xf1c7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf1c7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1c7('0x3'));var rimraf=require(_0xf1c7('0x4'));var config=require(_0xf1c7('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x2dce3d,_0x459252){return _0x2dce3d['define'](_0xf1c7('0x6'),attributes,{'tableName':_0xf1c7('0x7'),'paranoid':![],'indexes':[{'name':_0xf1c7('0x8'),'fields':[_0xf1c7('0x9'),_0xf1c7('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index ca7aef9..ef97ad2 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 _0x8439=['randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird'];(function(_0x4641d5,_0x5bf8c9){var _0x253adb=function(_0x281659){while(--_0x281659){_0x4641d5['push'](_0x4641d5['shift']());}};_0x253adb(++_0x5bf8c9);}(_0x8439,0x80));var _0x9843=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x8439[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x9843('0x0'));var util=require(_0x9843('0x1'));var moment=require(_0x9843('0x2'));var BPromise=require(_0x9843('0x3'));var rs=require(_0x9843('0x4'));var fs=require('fs');var Redis=require(_0x9843('0x5'));var db=require(_0x9843('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9843('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9843('0x8'));var client=jayson[_0x9843('0x9')][_0x9843('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d5151,_0x525a9b,_0x375d4f){return new BPromise(function(_0x62ef04,_0x4aaa69){return client[_0x9843('0xb')](_0x4d5151,_0x375d4f)[_0x9843('0xc')](function(_0x3925bb){logger[_0x9843('0xd')](_0x9843('0xe'),_0x525a9b,_0x9843('0xf'));logger['debug'](_0x9843('0x10'),_0x525a9b,_0x9843('0xf'),JSON[_0x9843('0x11')](_0x3925bb));if(_0x3925bb['error']){if(_0x3925bb['error'][_0x9843('0x12')]===0x1f4){logger['error'](_0x9843('0xe'),_0x525a9b,_0x3925bb[_0x9843('0x13')]['message']);return _0x4aaa69(_0x3925bb[_0x9843('0x13')][_0x9843('0x14')]);}logger[_0x9843('0x13')]('SalesforceField,\x20%s,\x20%s',_0x525a9b,_0x3925bb[_0x9843('0x13')]['message']);return _0x62ef04(_0x3925bb[_0x9843('0x13')][_0x9843('0x14')]);}else{logger['info'](_0x9843('0xe'),_0x525a9b,_0x9843('0xf'));_0x62ef04(_0x3925bb[_0x9843('0x15')]['message']);}})['catch'](function(_0x2161db){logger[_0x9843('0x13')](_0x9843('0xe'),_0x525a9b,_0x2161db);_0x4aaa69(_0x2161db);});});} \ No newline at end of file +var _0x4ab9=['http','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x36dca4,_0x13b938){var _0x4ec30f=function(_0x385dc4){while(--_0x385dc4){_0x36dca4['push'](_0x36dca4['shift']());}};_0x4ec30f(++_0x13b938);}(_0x4ab9,0xc9));var _0x94ab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4ab9[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x94ab('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94ab('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x94ab('0x2'));var logger=require(_0x94ab('0x3'))(_0x94ab('0x4'));var config=require(_0x94ab('0x5'));var jayson=require(_0x94ab('0x6'));var client=jayson[_0x94ab('0x7')][_0x94ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d0ea3,_0x2210b7,_0x199241){return new BPromise(function(_0x3d87ed,_0x3379e5){return client['request'](_0x1d0ea3,_0x199241)[_0x94ab('0x9')](function(_0x2689d3){logger['info'](_0x94ab('0xa'),_0x2210b7,'request\x20sent');logger[_0x94ab('0xb')](_0x94ab('0xc'),_0x2210b7,'request\x20sent',JSON[_0x94ab('0xd')](_0x2689d3));if(_0x2689d3['error']){if(_0x2689d3['error'][_0x94ab('0xe')]===0x1f4){logger[_0x94ab('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2210b7,_0x2689d3[_0x94ab('0xf')][_0x94ab('0x10')]);return _0x3379e5(_0x2689d3['error']['message']);}logger[_0x94ab('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2210b7,_0x2689d3[_0x94ab('0xf')][_0x94ab('0x10')]);return _0x3d87ed(_0x2689d3['error'][_0x94ab('0x10')]);}else{logger[_0x94ab('0x11')](_0x94ab('0xa'),_0x2210b7,'request\x20sent');_0x3d87ed(_0x2689d3['result'][_0x94ab('0x10')]);}})[_0x94ab('0x12')](function(_0x341d97){logger[_0x94ab('0xf')](_0x94ab('0xa'),_0x2210b7,_0x341d97);_0x3379e5(_0x341d97);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cd4bd5e..fae417a 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 _0x1d65=['../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2c9d30,_0xb7653e){var _0x2ca878=function(_0x2923ef){while(--_0x2923ef){_0x2c9d30['push'](_0x2c9d30['shift']());}};_0x2ca878(++_0xb7653e);}(_0x1d65,0x199));var _0x51d6=function(_0x55f477,_0x4a4e0c){_0x55f477=_0x55f477-0x0;var _0x24355c=_0x1d65[_0x55f477];return _0x24355c;};'use strict';var multer=require(_0x51d6('0x0'));var util=require(_0x51d6('0x1'));var path=require(_0x51d6('0x2'));var timeout=require(_0x51d6('0x3'));var express=require(_0x51d6('0x4'));var router=express[_0x51d6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x51d6('0x6'));var interaction=require(_0x51d6('0x7'));var config=require(_0x51d6('0x8'));var controller=require(_0x51d6('0x9'));router[_0x51d6('0xa')]('/',auth[_0x51d6('0xb')](),controller[_0x51d6('0xc')]);router['get'](_0x51d6('0xd'),auth[_0x51d6('0xb')](),controller[_0x51d6('0xe')]);router[_0x51d6('0xa')](_0x51d6('0xf'),auth[_0x51d6('0xb')](),controller['getConfigurations']);router[_0x51d6('0xa')](_0x51d6('0x10'),auth[_0x51d6('0xb')](),controller[_0x51d6('0x11')]);router[_0x51d6('0x12')]('/',auth[_0x51d6('0xb')](),controller[_0x51d6('0x13')]);router[_0x51d6('0x12')](_0x51d6('0xf'),auth[_0x51d6('0xb')](),controller[_0x51d6('0x14')]);router[_0x51d6('0x15')](_0x51d6('0xd'),auth[_0x51d6('0xb')](),controller[_0x51d6('0x16')]);router[_0x51d6('0x17')](_0x51d6('0xd'),auth[_0x51d6('0xb')](),controller[_0x51d6('0x18')]);module[_0x51d6('0x19')]=router; \ No newline at end of file +var _0x29bc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x37ec76,_0x283732){var _0x449327=function(_0x4207ae){while(--_0x4207ae){_0x37ec76['push'](_0x37ec76['shift']());}};_0x449327(++_0x283732);}(_0x29bc,0x163));var _0xc29b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x29bc[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0xc29b('0x0'));var util=require(_0xc29b('0x1'));var path=require(_0xc29b('0x2'));var timeout=require(_0xc29b('0x3'));var express=require(_0xc29b('0x4'));var router=express[_0xc29b('0x5')]();var fs_extra=require(_0xc29b('0x6'));var auth=require(_0xc29b('0x7'));var interaction=require(_0xc29b('0x8'));var config=require(_0xc29b('0x9'));var controller=require(_0xc29b('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc29b('0xb')]('/:id',auth[_0xc29b('0xc')](),controller[_0xc29b('0xd')]);router[_0xc29b('0xb')]('/:id/configurations',auth[_0xc29b('0xc')](),controller[_0xc29b('0xe')]);router[_0xc29b('0xb')](_0xc29b('0xf'),auth[_0xc29b('0xc')](),controller[_0xc29b('0x10')]);router[_0xc29b('0x11')]('/',auth[_0xc29b('0xc')](),controller[_0xc29b('0x12')]);router['post'](_0xc29b('0x13'),auth[_0xc29b('0xc')](),controller[_0xc29b('0x14')]);router[_0xc29b('0x15')](_0xc29b('0x16'),auth[_0xc29b('0xc')](),controller['update']);router['delete'](_0xc29b('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0xc29b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2e1b314..6b549cc 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 _0xfd58=['remoteUri','exports','STRING'];(function(_0x31dbb3,_0x5d594b){var _0x1ff6e2=function(_0x4d65f0){while(--_0x4d65f0){_0x31dbb3['push'](_0x31dbb3['shift']());}};_0x1ff6e2(++_0x5d594b);}(_0xfd58,0x1e1));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x8fd5('0x0')]={'name':{'type':Sequelize[_0x8fd5('0x1')]},'description':{'type':Sequelize[_0x8fd5('0x1')]},'username':{'type':Sequelize[_0x8fd5('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8fd5('0x1')]},'remoteUri':{'type':Sequelize[_0x8fd5('0x1')],'unique':_0x8fd5('0x2')},'serverUrl':{'type':Sequelize[_0x8fd5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbdcb=['username','remoteUri','exports','STRING'];(function(_0x4b0c77,_0x3db9e6){var _0xf77008=function(_0x3edfa2){while(--_0x3edfa2){_0x4b0c77['push'](_0x4b0c77['shift']());}};_0xf77008(++_0x3db9e6);}(_0xbdcb,0x1c6));var _0xbbdc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbdcb[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module[_0xbbdc('0x0')]={'name':{'type':Sequelize[_0xbbdc('0x1')]},'description':{'type':Sequelize[_0xbbdc('0x1')]},'username':{'type':Sequelize[_0xbbdc('0x1')],'unique':_0xbbdc('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbbdc('0x1')]},'remoteUri':{'type':Sequelize[_0xbbdc('0x1')],'unique':_0xbbdc('0x3')},'serverUrl':{'type':Sequelize[_0xbbdc('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 3932cac..0831443 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 _0x80b9=['destroy','end','name','index','map','ServicenowAccount','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','catch','body','find','params','getConfigurations','ServicenowConfiguration','order','pick','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','create','ServicenowField','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','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','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments_and_work_notes','due_date','reopen_count','sys_tags','correlation_id','location','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','TCL:\x20_object','label','push','all','test','statusCode','send','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x80b9,0x8a));var _0x980b=function(_0x12b68c,_0x117047){_0x12b68c=_0x12b68c-0x0;var _0x1405d2=_0x80b9[_0x12b68c];return _0x1405d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x980b('0x0'));var zipdir=require(_0x980b('0x1'));var jsonpatch=require(_0x980b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x980b('0x3'));var Mustache=require('mustache');var util=require(_0x980b('0x4'));var path=require(_0x980b('0x5'));var sox=require(_0x980b('0x6'));var csv=require('to-csv');var ejs=require(_0x980b('0x7'));var fs=require('fs');var fs_extra=require(_0x980b('0x8'));var _=require(_0x980b('0x9'));var squel=require('squel');var crypto=require(_0x980b('0xa'));var jsforce=require(_0x980b('0xb'));var deskjs=require(_0x980b('0xc'));var toCsv=require(_0x980b('0xd'));var querystring=require(_0x980b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x980b('0xf'));var qs=require(_0x980b('0x10'));var as=require(_0x980b('0x11'));var hardwareService=require(_0x980b('0x12'));var logger=require(_0x980b('0x13'))(_0x980b('0x14'));var utils=require(_0x980b('0x15'));var config=require(_0x980b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x980b('0x17'));function respondWithStatusCode(_0x5252d3,_0x200d97){_0x200d97=_0x200d97||0xcc;return function(_0x469211){if(_0x469211){return _0x5252d3[_0x980b('0x18')](_0x200d97);}return _0x5252d3[_0x980b('0x19')](_0x200d97)['end']();};}function respondWithResult(_0x41d169,_0x3c6834){_0x3c6834=_0x3c6834||0xc8;return function(_0x207997){if(_0x207997){return _0x41d169[_0x980b('0x19')](_0x3c6834)['json'](_0x207997);}};}function respondWithFilteredResult(_0x47e8a5,_0x3d822a){return function(_0x5be95b){if(_0x5be95b){var _0x4d0b6f=typeof _0x3d822a[_0x980b('0x1a')]===_0x980b('0x1b')&&typeof _0x3d822a[_0x980b('0x1c')]===_0x980b('0x1b');var _0xb13f9=_0x5be95b[_0x980b('0x1d')];var _0x173b81=_0x4d0b6f?0x0:_0x3d822a[_0x980b('0x1a')];var _0x34ac2f=_0x4d0b6f?_0x5be95b[_0x980b('0x1d')]:_0x3d822a['offset']+_0x3d822a[_0x980b('0x1c')];var _0x32a14b;if(_0x34ac2f>=_0xb13f9){_0x34ac2f=_0xb13f9;_0x32a14b=0xc8;}else{_0x32a14b=0xce;}_0x47e8a5[_0x980b('0x19')](_0x32a14b);return _0x47e8a5[_0x980b('0x1e')](_0x980b('0x1f'),_0x173b81+'-'+_0x34ac2f+'/'+_0xb13f9)[_0x980b('0x20')](_0x5be95b);}return null;};}function patchUpdates(_0xde3c8e){return function(_0x992e10){try{jsonpatch['apply'](_0x992e10,_0xde3c8e,!![]);}catch(_0x405b07){return BPromise[_0x980b('0x21')](_0x405b07);}return _0x992e10[_0x980b('0x22')]();};}function saveUpdates(_0x2c2d3e,_0x5785dc){return function(_0x227200){if(_0x227200){return _0x227200[_0x980b('0x23')](_0x2c2d3e)[_0x980b('0x24')](function(_0x502451){return _0x502451;});}return null;};}function removeEntity(_0x352fa2,_0x1f28ce){return function(_0x263147){if(_0x263147){return _0x263147[_0x980b('0x25')]()[_0x980b('0x24')](function(){_0x352fa2[_0x980b('0x19')](0xcc)[_0x980b('0x26')]();});}};}function handleEntityNotFound(_0x569e46,_0x2faeb4){return function(_0x2660fb){if(!_0x2660fb){_0x569e46[_0x980b('0x18')](0x194);}return _0x2660fb;};}function handleError(_0x3bacf4,_0x1eab58){_0x1eab58=_0x1eab58||0x1f4;return function(_0x40b1ac){logger['error'](_0x40b1ac['stack']);if(_0x40b1ac[_0x980b('0x27')]){delete _0x40b1ac[_0x980b('0x27')];}_0x3bacf4[_0x980b('0x19')](_0x1eab58)['send'](_0x40b1ac);};}exports[_0x980b('0x28')]=function(_0x138c85,_0x1e5918){var _0x32fc91={},_0x1b19f7={},_0x1d723a={'count':0x0,'rows':[]};var _0x16b989=_[_0x980b('0x29')](db[_0x980b('0x2a')]['rawAttributes'],function(_0xd32297){return{'name':_0xd32297[_0x980b('0x2b')],'type':_0xd32297[_0x980b('0x2c')]['key']};});_0x1b19f7[_0x980b('0x2d')]=_[_0x980b('0x29')](_0x16b989,_0x980b('0x27'));_0x1b19f7[_0x980b('0x2e')]=_[_0x980b('0x2f')](_0x138c85[_0x980b('0x2e')]);_0x1b19f7['filters']=_[_0x980b('0x30')](_0x1b19f7[_0x980b('0x2d')],_0x1b19f7[_0x980b('0x2e')]);_0x32fc91['attributes']=_[_0x980b('0x30')](_0x1b19f7[_0x980b('0x2d')],qs['fields'](_0x138c85['query'][_0x980b('0x31')]));_0x32fc91[_0x980b('0x32')]=_0x32fc91[_0x980b('0x32')][_0x980b('0x33')]?_0x32fc91[_0x980b('0x32')]:_0x1b19f7[_0x980b('0x2d')];if(!_0x138c85[_0x980b('0x2e')][_0x980b('0x34')]('nolimit')){_0x32fc91[_0x980b('0x1c')]=qs[_0x980b('0x1c')](_0x138c85[_0x980b('0x2e')]['limit']);_0x32fc91['offset']=qs[_0x980b('0x1a')](_0x138c85[_0x980b('0x2e')][_0x980b('0x1a')]);}_0x32fc91['order']=qs['sort'](_0x138c85[_0x980b('0x2e')][_0x980b('0x35')]);_0x32fc91[_0x980b('0x36')]=qs[_0x980b('0x37')](_['pick'](_0x138c85[_0x980b('0x2e')],_0x1b19f7[_0x980b('0x37')]),_0x16b989);if(_0x138c85['query'][_0x980b('0x38')]){_0x32fc91[_0x980b('0x36')]=_[_0x980b('0x39')](_0x32fc91[_0x980b('0x36')],{'$or':_[_0x980b('0x29')](_0x16b989,function(_0x306b2d){if(_0x306b2d[_0x980b('0x2c')]!==_0x980b('0x3a')){var _0x517907={};_0x517907[_0x306b2d[_0x980b('0x27')]]={'$like':'%'+_0x138c85[_0x980b('0x2e')]['filter']+'%'};return _0x517907;}})});}_0x32fc91=_[_0x980b('0x39')]({},_0x32fc91,_0x138c85[_0x980b('0x3b')]);var _0x39d3c0={'where':_0x32fc91['where']};return db[_0x980b('0x2a')][_0x980b('0x1d')](_0x39d3c0)[_0x980b('0x24')](function(_0x4f2dfe){_0x1d723a[_0x980b('0x1d')]=_0x4f2dfe;if(_0x138c85[_0x980b('0x2e')][_0x980b('0x3c')]){_0x32fc91[_0x980b('0x3d')]=[{'all':!![]}];}return db[_0x980b('0x2a')]['findAll'](_0x32fc91);})[_0x980b('0x24')](function(_0x589d84){_0x1d723a[_0x980b('0x3e')]=_0x589d84;return _0x1d723a;})[_0x980b('0x24')](respondWithFilteredResult(_0x1e5918,_0x32fc91))['catch'](handleError(_0x1e5918,null));};exports[_0x980b('0x3f')]=function(_0x2bed32,_0x373fb1){var _0x1578da={'raw':![],'where':{'id':_0x2bed32['params']['id']}},_0x2767f4={};_0x2767f4['model']=_[_0x980b('0x2f')](db[_0x980b('0x2a')][_0x980b('0x40')]);_0x2767f4['query']=_[_0x980b('0x2f')](_0x2bed32[_0x980b('0x2e')]);_0x2767f4[_0x980b('0x37')]=_[_0x980b('0x30')](_0x2767f4[_0x980b('0x2d')],_0x2767f4[_0x980b('0x2e')]);_0x1578da['attributes']=_['intersection'](_0x2767f4[_0x980b('0x2d')],qs[_0x980b('0x31')](_0x2bed32[_0x980b('0x2e')][_0x980b('0x31')]));_0x1578da[_0x980b('0x32')]=_0x1578da['attributes'][_0x980b('0x33')]?_0x1578da[_0x980b('0x32')]:_0x2767f4['model'];if(_0x2bed32['query'][_0x980b('0x3c')]){_0x1578da[_0x980b('0x3d')]=[{'all':!![]}];}_0x1578da=_[_0x980b('0x39')]({},_0x1578da,_0x2bed32[_0x980b('0x3b')]);return db[_0x980b('0x2a')]['find'](_0x1578da)[_0x980b('0x24')](handleEntityNotFound(_0x373fb1,null))[_0x980b('0x24')](respondWithResult(_0x373fb1,null))[_0x980b('0x41')](handleError(_0x373fb1,null));};exports['create']=function(_0x26f8b4,_0x3631d8){return db[_0x980b('0x2a')]['create'](_0x26f8b4[_0x980b('0x42')],{})[_0x980b('0x24')](respondWithResult(_0x3631d8,0xc9))[_0x980b('0x41')](handleError(_0x3631d8,null));};exports['update']=function(_0x548161,_0x5cc044){if(_0x548161[_0x980b('0x42')]['id']){delete _0x548161['body']['id'];}return db[_0x980b('0x2a')][_0x980b('0x43')]({'where':{'id':_0x548161['params']['id']}})['then'](handleEntityNotFound(_0x5cc044,null))[_0x980b('0x24')](saveUpdates(_0x548161[_0x980b('0x42')],null))['then'](respondWithResult(_0x5cc044,null))[_0x980b('0x41')](handleError(_0x5cc044,null));};exports[_0x980b('0x25')]=function(_0x29641b,_0x12bdc8){return db['ServicenowAccount'][_0x980b('0x43')]({'where':{'id':_0x29641b[_0x980b('0x44')]['id']}})['then'](handleEntityNotFound(_0x12bdc8,null))[_0x980b('0x24')](removeEntity(_0x12bdc8,null))[_0x980b('0x41')](handleError(_0x12bdc8,null));};exports[_0x980b('0x45')]=function(_0x4a580f,_0x14e815,_0x452fc3){var _0x1c5d99={};var _0x486a79={};var _0x466cff;var _0x2f7851;return db[_0x980b('0x2a')]['findOne']({'where':{'id':_0x4a580f['params']['id']}})[_0x980b('0x24')](handleEntityNotFound(_0x14e815,null))['then'](function(_0x29a26f){if(_0x29a26f){_0x466cff=_0x29a26f;_0x486a79[_0x980b('0x2d')]=_[_0x980b('0x2f')](db[_0x980b('0x46')][_0x980b('0x40')]);_0x486a79[_0x980b('0x2e')]=_[_0x980b('0x2f')](_0x4a580f[_0x980b('0x2e')]);_0x486a79['filters']=_[_0x980b('0x30')](_0x486a79[_0x980b('0x2d')],_0x486a79[_0x980b('0x2e')]);_0x1c5d99['attributes']=_['intersection'](_0x486a79[_0x980b('0x2d')],qs[_0x980b('0x31')](_0x4a580f[_0x980b('0x2e')]['fields']));_0x1c5d99[_0x980b('0x32')]=_0x1c5d99[_0x980b('0x32')]['length']?_0x1c5d99[_0x980b('0x32')]:_0x486a79[_0x980b('0x2d')];_0x1c5d99[_0x980b('0x47')]=qs[_0x980b('0x35')](_0x4a580f['query']['sort']);_0x1c5d99[_0x980b('0x36')]=qs[_0x980b('0x37')](_[_0x980b('0x48')](_0x4a580f[_0x980b('0x2e')],_0x486a79['filters']));if(_0x4a580f[_0x980b('0x2e')][_0x980b('0x38')]){_0x1c5d99[_0x980b('0x36')]=_['merge'](_0x1c5d99[_0x980b('0x36')],{'$or':_[_0x980b('0x29')](_0x1c5d99['attributes'],function(_0x3cb4d){var _0x49e082={};_0x49e082[_0x3cb4d]={'$like':'%'+_0x4a580f[_0x980b('0x2e')][_0x980b('0x38')]+'%'};return _0x49e082;})});}_0x1c5d99=_[_0x980b('0x39')]({},_0x1c5d99,_0x4a580f['options']);return _0x466cff['getConfigurations'](_0x1c5d99);}})[_0x980b('0x24')](function(_0x359844){if(_0x359844){_0x2f7851=_0x359844[_0x980b('0x33')];if(!_0x4a580f[_0x980b('0x2e')][_0x980b('0x34')](_0x980b('0x49'))){_0x1c5d99[_0x980b('0x1c')]=qs[_0x980b('0x1c')](_0x4a580f[_0x980b('0x2e')][_0x980b('0x1c')]);_0x1c5d99[_0x980b('0x1a')]=qs[_0x980b('0x1a')](_0x4a580f[_0x980b('0x2e')][_0x980b('0x1a')]);}return _0x466cff['getConfigurations'](_0x1c5d99);}})[_0x980b('0x24')](function(_0x15ef31){if(_0x15ef31){return _0x15ef31?{'count':_0x2f7851,'rows':_0x15ef31}:null;}})[_0x980b('0x24')](respondWithResult(_0x14e815,null))[_0x980b('0x41')](handleError(_0x14e815,null));};exports[_0x980b('0x4a')]=function(_0x2ba158,_0x49118a,_0x49f4e0){if(_0x2ba158[_0x980b('0x42')]['id']){delete _0x2ba158[_0x980b('0x42')]['id'];}return db[_0x980b('0x2a')][_0x980b('0x4b')]({'where':{'id':_0x2ba158['params']['id']}})[_0x980b('0x24')](handleEntityNotFound(_0x49118a,null))[_0x980b('0x24')](function(_0x17d4e4){if(_0x17d4e4){_0x2ba158[_0x980b('0x42')][_0x980b('0x4c')]=_0x17d4e4['id'];_0x2ba158[_0x980b('0x42')][_0x980b('0x4d')]=integrations['getSubjects'](_0x2ba158[_0x980b('0x42')][_0x980b('0x4e')],_0x2ba158['body'][_0x980b('0x2c')]);_0x2ba158[_0x980b('0x42')][_0x980b('0x4f')]=integrations[_0x980b('0x50')](_0x2ba158[_0x980b('0x42')][_0x980b('0x4e')],_0x2ba158[_0x980b('0x42')]['type']);return db[_0x980b('0x46')][_0x980b('0x51')](_0x2ba158[_0x980b('0x42')],{'include':[{'model':db['ServicenowField'],'as':_0x980b('0x4d')},{'model':db[_0x980b('0x52')],'as':_0x980b('0x4f')}]});}return null;})[_0x980b('0x24')](respondWithResult(_0x49118a,null))['catch'](handleError(_0x49118a,null));};exports['getFields']=function(_0x397740,_0x4aceb0,_0x19e3be){var _0x3d47a5=[_0x980b('0x53'),_0x980b('0x54'),_0x980b('0x55'),_0x980b('0x56'),'close_code','notify',_0x980b('0x57'),_0x980b('0x58'),_0x980b('0x59')];var _0x110eb7=['parent',_0x980b('0x53'),_0x980b('0x5a'),_0x980b('0x5b'),_0x980b('0x5c'),_0x980b('0x5d'),'child_incidents',_0x980b('0x54'),_0x980b('0x5e'),'number',_0x980b('0x5f'),'sys_updated_by',_0x980b('0x60'),_0x980b('0x61'),_0x980b('0x62'),_0x980b('0x63'),_0x980b('0x64'),'sys_created_by',_0x980b('0x55'),_0x980b('0x47'),_0x980b('0x65'),_0x980b('0x66'),'cmdb_ci','delivery_plan',_0x980b('0x67'),_0x980b('0x68'),_0x980b('0x69'),_0x980b('0x6a'),_0x980b('0x6b'),_0x980b('0x6c'),'rfc',_0x980b('0x6d'),_0x980b('0x6e'),_0x980b('0x6f'),'business_duration','group_list',_0x980b('0x70'),_0x980b('0x71'),_0x980b('0x72'),'caller_id',_0x980b('0x73'),'subcategory',_0x980b('0x74'),_0x980b('0x75'),'close_code',_0x980b('0x76'),_0x980b('0x77'),_0x980b('0x78'),_0x980b('0x79'),_0x980b('0x7a'),_0x980b('0x7b'),_0x980b('0x7c'),'calendar_duration','notify',_0x980b('0x7d'),_0x980b('0x7e'),_0x980b('0x7f'),'follow_up',_0x980b('0x80'),_0x980b('0x81'),_0x980b('0x82'),_0x980b('0x83'),_0x980b('0x57'),_0x980b('0x84'),_0x980b('0x85'),'company',_0x980b('0x86'),_0x980b('0x87'),_0x980b('0x88'),_0x980b('0x58'),'comments','sla_due','approval',_0x980b('0x89'),_0x980b('0x8a'),'sys_mod_count',_0x980b('0x8b'),_0x980b('0x8c'),'escalation','upon_approval',_0x980b('0x8d'),_0x980b('0x8e'),_0x980b('0x59')];var _0x520149='';var _0x243d02='';var _0x4d1916=[];var _0x2bde6c='';var _0x4de0e6='';var _0x361f1c=[];var _0x5810a7='';var _0x234ecd='';var _0x38990c={};var _0x6d6aec='';return db[_0x980b('0x2a')]['findOne']({'where':{'id':_0x397740[_0x980b('0x44')]['id']},'attributes':['id','username','password',_0x980b('0x8f'),_0x980b('0x90'),_0x980b('0x91')]})[_0x980b('0x24')](handleEntityNotFound(_0x4aceb0,null))[_0x980b('0x24')](function(_0x587dab){if(_0x587dab){_0x6d6aec=_0x587dab[_0x980b('0x90')];var _0x5abb87=_0x6d6aec['slice'](-0x1);if(_0x5abb87==='/'){_0x6d6aec=_0x6d6aec[_0x980b('0x92')](0x0,_0x6d6aec[_0x980b('0x93')](_0x5abb87));}_0x234ecd=util[_0x980b('0x94')](_0x980b('0x95'),_0x6d6aec);_0x5810a7=util[_0x980b('0x94')](_0x980b('0x96'),_0x6d6aec);_0x38990c={'user':_0x587dab[_0x980b('0x97')],'pass':_0x587dab[_0x980b('0x98')]};var _0x5d362f={'method':_0x980b('0x99'),'uri':_0x234ecd+_0x980b('0x9a'),'auth':_0x38990c,'json':!![]};return rp(_0x5d362f);}})[_0x980b('0x24')](function(_0x41e3cf){if(_0x41e3cf['result'][_0x980b('0x33')]>0x0){_0x520149=_0x41e3cf[_0x980b('0x9b')];}console[_0x980b('0x9c')](_0x980b('0x9d'),_0x520149);_0x361f1c=[];_0x243d02=Object[_0x980b('0x9e')]([],_0x520149);_['remove'](_0x243d02,function(_0x5f054b){return!_0x3d47a5[_0x980b('0x9f')](_0x5f054b[_0x980b('0x27')]);});_0x243d02[_0x980b('0xa0')](function(_0x2e9d71){var _0x56353d=createFieldObject(_0x5810a7,_0x38990c,_0x2e9d71[_0x980b('0xa1')],_0x2e9d71[_0x980b('0x27')],_0x2e9d71['label'],![]);_0x361f1c['push'](_0x56353d);});return Promise['all'](_0x361f1c);})['then'](function(_0x4037cb){_0x4d1916=_0x4037cb;_0x2bde6c=Object[_0x980b('0x9e')]([],_0x520149);console[_0x980b('0x9c')](_0x980b('0xa2'),_0x520149);_['remove'](_0x2bde6c,function(_0x35d90f){return _0x110eb7['includes'](_0x35d90f[_0x980b('0x27')]);});console[_0x980b('0x9c')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2bde6c);_0x361f1c=[];_0x2bde6c['forEach'](function(_0x258cfd){var _0x18e79d=createFieldObject(_0x5810a7,_0x38990c,_0x258cfd[_0x980b('0xa1')],_0x258cfd[_0x980b('0x27')],_0x258cfd[_0x980b('0xa3')],!![]);_0x361f1c[_0x980b('0xa4')](_0x18e79d);});return Promise[_0x980b('0xa5')](_0x361f1c);})[_0x980b('0x24')](function(_0x4324de){_0x4de0e6=_0x4324de;var _0x2939c7=_0x4d1916['concat'](_0x4de0e6);return{'count':_0x2939c7[_0x980b('0x33')],'rows':_0x2939c7};})[_0x980b('0x24')](respondWithResult(_0x4aceb0,null))[_0x980b('0x41')](function(_0x10cd01){console[_0x980b('0x9c')]('ServiceNow\x20error:\x20'+_0x10cd01);var _0xf1b465=_0x397740[_0x980b('0x2e')][_0x980b('0xa6')]?0x1f4:_0x10cd01[_0x980b('0xa7')]||0x1f4;logger['error'](_0x10cd01['stack']);delete _0x10cd01[_0x980b('0x27')];if(_0xf1b465===0x191){_0xf1b465=0x190;}_0x4aceb0[_0x980b('0x19')](_0xf1b465)[_0x980b('0xa8')](_0x397740[_0x980b('0x2e')][_0x980b('0xa6')]?{'message':'Wrong\x20credentials','statusCode':_0x10cd01['statusCode']}:_0x10cd01);});};function createFieldObject(_0x92536b,_0x6b5228,_0x101b55,_0x43be4a,_0x14d1a1,_0x1c7bab){return new Promise(function(_0x1d710e,_0x494afb){var _0x37a515={'id':_0x43be4a,'name':_0x14d1a1,'custom':_0x1c7bab};if(_0x101b55===_0x980b('0xa9')){_0x37a515[_0x980b('0x3b')]=[{'name':'True','value':'true'},{'name':_0x980b('0xaa'),'value':_0x980b('0xab')}];_0x1d710e(_0x37a515);}else{var _0x3105db={'method':_0x980b('0x99'),'uri':_0x92536b+_0x980b('0xac')+_0x43be4a,'auth':_0x6b5228,'json':!![]};return rp(_0x3105db)[_0x980b('0x24')](function(_0x325cf1){var _0x14a451=[];if(_0x325cf1[_0x980b('0x9b')]['length']>0x0){_0x325cf1['result'][_0x980b('0xa0')](function(_0x313430){if(_0x313430[_0x980b('0xad')]==='false'){var _0x591442={'name':_0x313430[_0x980b('0xa3')],'value':_0x313430[_0x980b('0xae')]};_0x14a451[_0x980b('0xa4')](_0x591442);}});}_0x37a515[_0x980b('0x3b')]=_0x14a451;if(_0x37a515[_0x980b('0x3b')][_0x980b('0x33')]>0x0){_0x1d710e(_0x37a515);}else{if(_0x1c7bab==![]){_0x1d710e();}else{_0x1d710e(_0x37a515);}}});}});} \ No newline at end of file +var _0xa1cf=['channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','expected_start','opened_at','business_duration','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','true','False','false','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','type','merge','options','ServicenowAccount','includeAll','include','then','rows','params','find','create','body','catch','destroy','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions'];(function(_0x527b13,_0x3fb493){var _0x110d75=function(_0x190bff){while(--_0x190bff){_0x527b13['push'](_0x527b13['shift']());}};_0x110d75(++_0x3fb493);}(_0xa1cf,0x11c));var _0xfa1c=function(_0x1fb8ac,_0x28f0af){_0x1fb8ac=_0x1fb8ac-0x0;var _0x45908c=_0xa1cf[_0x1fb8ac];return _0x45908c;};'use strict';var emlformat=require(_0xfa1c('0x0'));var rimraf=require(_0xfa1c('0x1'));var zipdir=require(_0xfa1c('0x2'));var jsonpatch=require(_0xfa1c('0x3'));var rp=require('request-promise');var moment=require(_0xfa1c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfa1c('0x5'));var util=require(_0xfa1c('0x6'));var path=require(_0xfa1c('0x7'));var sox=require(_0xfa1c('0x8'));var csv=require(_0xfa1c('0x9'));var ejs=require(_0xfa1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa1c('0xb'));var squel=require(_0xfa1c('0xc'));var crypto=require(_0xfa1c('0xd'));var jsforce=require(_0xfa1c('0xe'));var deskjs=require(_0xfa1c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa1c('0x10'));var Redis=require(_0xfa1c('0x11'));var authService=require(_0xfa1c('0x12'));var qs=require(_0xfa1c('0x13'));var as=require(_0xfa1c('0x14'));var hardwareService=require(_0xfa1c('0x15'));var logger=require(_0xfa1c('0x16'))(_0xfa1c('0x17'));var utils=require(_0xfa1c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x25f068,_0xcb672d){_0xcb672d=_0xcb672d||0xcc;return function(_0x2d994c){if(_0x2d994c){return _0x25f068[_0xfa1c('0x19')](_0xcb672d);}return _0x25f068[_0xfa1c('0x1a')](_0xcb672d)[_0xfa1c('0x1b')]();};}function respondWithResult(_0x5bf473,_0x49a521){_0x49a521=_0x49a521||0xc8;return function(_0x4a7eb2){if(_0x4a7eb2){return _0x5bf473[_0xfa1c('0x1a')](_0x49a521)[_0xfa1c('0x1c')](_0x4a7eb2);}};}function respondWithFilteredResult(_0x5295f4,_0x452cd1){return function(_0x158fcb){if(_0x158fcb){var _0x1c8b89=typeof _0x452cd1['offset']===_0xfa1c('0x1d')&&typeof _0x452cd1[_0xfa1c('0x1e')]===_0xfa1c('0x1d');var _0x2ffee6=_0x158fcb[_0xfa1c('0x1f')];var _0xcf415d=_0x1c8b89?0x0:_0x452cd1[_0xfa1c('0x20')];var _0x400250=_0x1c8b89?_0x158fcb[_0xfa1c('0x1f')]:_0x452cd1[_0xfa1c('0x20')]+_0x452cd1[_0xfa1c('0x1e')];var _0x3db944;if(_0x400250>=_0x2ffee6){_0x400250=_0x2ffee6;_0x3db944=0xc8;}else{_0x3db944=0xce;}_0x5295f4[_0xfa1c('0x1a')](_0x3db944);return _0x5295f4[_0xfa1c('0x21')](_0xfa1c('0x22'),_0xcf415d+'-'+_0x400250+'/'+_0x2ffee6)[_0xfa1c('0x1c')](_0x158fcb);}return null;};}function patchUpdates(_0x1444e4){return function(_0x26340c){try{jsonpatch[_0xfa1c('0x23')](_0x26340c,_0x1444e4,!![]);}catch(_0x565934){return BPromise[_0xfa1c('0x24')](_0x565934);}return _0x26340c[_0xfa1c('0x25')]();};}function saveUpdates(_0x331b3a,_0x250e88){return function(_0xca820f){if(_0xca820f){return _0xca820f[_0xfa1c('0x26')](_0x331b3a)['then'](function(_0x2dc76c){return _0x2dc76c;});}return null;};}function removeEntity(_0x51ad4f,_0x28c795){return function(_0x2d1243){if(_0x2d1243){return _0x2d1243['destroy']()['then'](function(){_0x51ad4f[_0xfa1c('0x1a')](0xcc)[_0xfa1c('0x1b')]();});}};}function handleEntityNotFound(_0x163c22,_0x49d056){return function(_0x2899bf){if(!_0x2899bf){_0x163c22[_0xfa1c('0x19')](0x194);}return _0x2899bf;};}function handleError(_0x220571,_0x1ed35c){_0x1ed35c=_0x1ed35c||0x1f4;return function(_0x47073f){logger[_0xfa1c('0x27')](_0x47073f[_0xfa1c('0x28')]);if(_0x47073f['name']){delete _0x47073f[_0xfa1c('0x29')];}_0x220571[_0xfa1c('0x1a')](_0x1ed35c)['send'](_0x47073f);};}exports[_0xfa1c('0x2a')]=function(_0x39ef88,_0x22627c){var _0x365673={},_0x4d4f1e={},_0x71937={'count':0x0,'rows':[]};var _0x2c0d3a=_[_0xfa1c('0x2b')](db['ServicenowAccount'][_0xfa1c('0x2c')],function(_0x2e9619){return{'name':_0x2e9619[_0xfa1c('0x2d')],'type':_0x2e9619['type'][_0xfa1c('0x2e')]};});_0x4d4f1e[_0xfa1c('0x2f')]=_[_0xfa1c('0x2b')](_0x2c0d3a,_0xfa1c('0x29'));_0x4d4f1e[_0xfa1c('0x30')]=_[_0xfa1c('0x31')](_0x39ef88[_0xfa1c('0x30')]);_0x4d4f1e['filters']=_[_0xfa1c('0x32')](_0x4d4f1e[_0xfa1c('0x2f')],_0x4d4f1e['query']);_0x365673['attributes']=_[_0xfa1c('0x32')](_0x4d4f1e[_0xfa1c('0x2f')],qs['fields'](_0x39ef88[_0xfa1c('0x30')][_0xfa1c('0x33')]));_0x365673[_0xfa1c('0x34')]=_0x365673[_0xfa1c('0x34')][_0xfa1c('0x35')]?_0x365673[_0xfa1c('0x34')]:_0x4d4f1e['model'];if(!_0x39ef88[_0xfa1c('0x30')]['hasOwnProperty'](_0xfa1c('0x36'))){_0x365673['limit']=qs[_0xfa1c('0x1e')](_0x39ef88[_0xfa1c('0x30')][_0xfa1c('0x1e')]);_0x365673[_0xfa1c('0x20')]=qs[_0xfa1c('0x20')](_0x39ef88[_0xfa1c('0x30')]['offset']);}_0x365673[_0xfa1c('0x37')]=qs[_0xfa1c('0x38')](_0x39ef88[_0xfa1c('0x30')][_0xfa1c('0x38')]);_0x365673[_0xfa1c('0x39')]=qs['filters'](_[_0xfa1c('0x3a')](_0x39ef88[_0xfa1c('0x30')],_0x4d4f1e[_0xfa1c('0x3b')]),_0x2c0d3a);if(_0x39ef88['query'][_0xfa1c('0x3c')]){_0x365673['where']=_['merge'](_0x365673['where'],{'$or':_[_0xfa1c('0x2b')](_0x2c0d3a,function(_0x3f0ba0){if(_0x3f0ba0[_0xfa1c('0x3d')]!=='VIRTUAL'){var _0x183506={};_0x183506[_0x3f0ba0[_0xfa1c('0x29')]]={'$like':'%'+_0x39ef88[_0xfa1c('0x30')][_0xfa1c('0x3c')]+'%'};return _0x183506;}})});}_0x365673=_[_0xfa1c('0x3e')]({},_0x365673,_0x39ef88[_0xfa1c('0x3f')]);var _0x48fb83={'where':_0x365673['where']};return db[_0xfa1c('0x40')][_0xfa1c('0x1f')](_0x48fb83)['then'](function(_0x56e9dc){_0x71937[_0xfa1c('0x1f')]=_0x56e9dc;if(_0x39ef88['query'][_0xfa1c('0x41')]){_0x365673[_0xfa1c('0x42')]=[{'all':!![]}];}return db[_0xfa1c('0x40')]['findAll'](_0x365673);})[_0xfa1c('0x43')](function(_0x5d13b7){_0x71937[_0xfa1c('0x44')]=_0x5d13b7;return _0x71937;})[_0xfa1c('0x43')](respondWithFilteredResult(_0x22627c,_0x365673))['catch'](handleError(_0x22627c,null));};exports['show']=function(_0x423c28,_0x4e9b74){var _0x5b02d2={'raw':![],'where':{'id':_0x423c28[_0xfa1c('0x45')]['id']}},_0x1a3338={};_0x1a3338['model']=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x1a3338[_0xfa1c('0x30')]=_[_0xfa1c('0x31')](_0x423c28[_0xfa1c('0x30')]);_0x1a3338[_0xfa1c('0x3b')]=_[_0xfa1c('0x32')](_0x1a3338[_0xfa1c('0x2f')],_0x1a3338[_0xfa1c('0x30')]);_0x5b02d2['attributes']=_[_0xfa1c('0x32')](_0x1a3338[_0xfa1c('0x2f')],qs[_0xfa1c('0x33')](_0x423c28[_0xfa1c('0x30')]['fields']));_0x5b02d2['attributes']=_0x5b02d2[_0xfa1c('0x34')]['length']?_0x5b02d2['attributes']:_0x1a3338['model'];if(_0x423c28[_0xfa1c('0x30')][_0xfa1c('0x41')]){_0x5b02d2[_0xfa1c('0x42')]=[{'all':!![]}];}_0x5b02d2=_[_0xfa1c('0x3e')]({},_0x5b02d2,_0x423c28[_0xfa1c('0x3f')]);return db[_0xfa1c('0x40')][_0xfa1c('0x46')](_0x5b02d2)[_0xfa1c('0x43')](handleEntityNotFound(_0x4e9b74,null))[_0xfa1c('0x43')](respondWithResult(_0x4e9b74,null))['catch'](handleError(_0x4e9b74,null));};exports[_0xfa1c('0x47')]=function(_0x1cd49c,_0x5cb43d){return db[_0xfa1c('0x40')][_0xfa1c('0x47')](_0x1cd49c[_0xfa1c('0x48')],{})['then'](respondWithResult(_0x5cb43d,0xc9))[_0xfa1c('0x49')](handleError(_0x5cb43d,null));};exports[_0xfa1c('0x26')]=function(_0x2cff4a,_0x54993f){if(_0x2cff4a[_0xfa1c('0x48')]['id']){delete _0x2cff4a[_0xfa1c('0x48')]['id'];}return db[_0xfa1c('0x40')][_0xfa1c('0x46')]({'where':{'id':_0x2cff4a[_0xfa1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x54993f,null))['then'](saveUpdates(_0x2cff4a[_0xfa1c('0x48')],null))[_0xfa1c('0x43')](respondWithResult(_0x54993f,null))[_0xfa1c('0x49')](handleError(_0x54993f,null));};exports[_0xfa1c('0x4a')]=function(_0x4e2d4d,_0x22ebd5){return db['ServicenowAccount'][_0xfa1c('0x46')]({'where':{'id':_0x4e2d4d[_0xfa1c('0x45')]['id']}})[_0xfa1c('0x43')](handleEntityNotFound(_0x22ebd5,null))[_0xfa1c('0x43')](removeEntity(_0x22ebd5,null))['catch'](handleError(_0x22ebd5,null));};exports[_0xfa1c('0x4b')]=function(_0x5a4fe4,_0x173951,_0x4ce106){var _0x277ba7={};var _0x321e8e={};var _0xf62b2d;var _0x5c0ebb;return db[_0xfa1c('0x40')][_0xfa1c('0x4c')]({'where':{'id':_0x5a4fe4[_0xfa1c('0x45')]['id']}})[_0xfa1c('0x43')](handleEntityNotFound(_0x173951,null))[_0xfa1c('0x43')](function(_0x589ee3){if(_0x589ee3){_0xf62b2d=_0x589ee3;_0x321e8e['model']=_[_0xfa1c('0x31')](db[_0xfa1c('0x4d')][_0xfa1c('0x2c')]);_0x321e8e[_0xfa1c('0x30')]=_[_0xfa1c('0x31')](_0x5a4fe4[_0xfa1c('0x30')]);_0x321e8e[_0xfa1c('0x3b')]=_[_0xfa1c('0x32')](_0x321e8e[_0xfa1c('0x2f')],_0x321e8e[_0xfa1c('0x30')]);_0x277ba7[_0xfa1c('0x34')]=_[_0xfa1c('0x32')](_0x321e8e[_0xfa1c('0x2f')],qs[_0xfa1c('0x33')](_0x5a4fe4[_0xfa1c('0x30')][_0xfa1c('0x33')]));_0x277ba7[_0xfa1c('0x34')]=_0x277ba7[_0xfa1c('0x34')][_0xfa1c('0x35')]?_0x277ba7['attributes']:_0x321e8e[_0xfa1c('0x2f')];_0x277ba7[_0xfa1c('0x37')]=qs[_0xfa1c('0x38')](_0x5a4fe4[_0xfa1c('0x30')]['sort']);_0x277ba7[_0xfa1c('0x39')]=qs[_0xfa1c('0x3b')](_[_0xfa1c('0x3a')](_0x5a4fe4[_0xfa1c('0x30')],_0x321e8e[_0xfa1c('0x3b')]));if(_0x5a4fe4[_0xfa1c('0x30')][_0xfa1c('0x3c')]){_0x277ba7['where']=_['merge'](_0x277ba7['where'],{'$or':_['map'](_0x277ba7[_0xfa1c('0x34')],function(_0x4000c0){var _0x599f86={};_0x599f86[_0x4000c0]={'$like':'%'+_0x5a4fe4['query'][_0xfa1c('0x3c')]+'%'};return _0x599f86;})});}_0x277ba7=_[_0xfa1c('0x3e')]({},_0x277ba7,_0x5a4fe4['options']);return _0xf62b2d[_0xfa1c('0x4b')](_0x277ba7);}})['then'](function(_0x444b6f){if(_0x444b6f){_0x5c0ebb=_0x444b6f[_0xfa1c('0x35')];if(!_0x5a4fe4[_0xfa1c('0x30')][_0xfa1c('0x4e')]('nolimit')){_0x277ba7[_0xfa1c('0x1e')]=qs[_0xfa1c('0x1e')](_0x5a4fe4[_0xfa1c('0x30')][_0xfa1c('0x1e')]);_0x277ba7[_0xfa1c('0x20')]=qs[_0xfa1c('0x20')](_0x5a4fe4[_0xfa1c('0x30')][_0xfa1c('0x20')]);}return _0xf62b2d['getConfigurations'](_0x277ba7);}})[_0xfa1c('0x43')](function(_0x5bade3){if(_0x5bade3){return _0x5bade3?{'count':_0x5c0ebb,'rows':_0x5bade3}:null;}})[_0xfa1c('0x43')](respondWithResult(_0x173951,null))[_0xfa1c('0x49')](handleError(_0x173951,null));};exports[_0xfa1c('0x4f')]=function(_0x2fe62f,_0x114a40,_0x34901d){if(_0x2fe62f['body']['id']){delete _0x2fe62f['body']['id'];}return db[_0xfa1c('0x40')][_0xfa1c('0x4c')]({'where':{'id':_0x2fe62f[_0xfa1c('0x45')]['id']}})[_0xfa1c('0x43')](handleEntityNotFound(_0x114a40,null))[_0xfa1c('0x43')](function(_0x12bafd){if(_0x12bafd){_0x2fe62f[_0xfa1c('0x48')][_0xfa1c('0x50')]=_0x12bafd['id'];_0x2fe62f[_0xfa1c('0x48')]['Subjects']=integrations[_0xfa1c('0x51')](_0x2fe62f['body']['channel'],_0x2fe62f[_0xfa1c('0x48')][_0xfa1c('0x3d')]);_0x2fe62f['body'][_0xfa1c('0x52')]=integrations[_0xfa1c('0x53')](_0x2fe62f[_0xfa1c('0x48')][_0xfa1c('0x54')],_0x2fe62f[_0xfa1c('0x48')][_0xfa1c('0x3d')]);return db['ServicenowConfiguration'][_0xfa1c('0x47')](_0x2fe62f[_0xfa1c('0x48')],{'include':[{'model':db[_0xfa1c('0x55')],'as':_0xfa1c('0x56')},{'model':db[_0xfa1c('0x55')],'as':'Descriptions'}]});}return null;})[_0xfa1c('0x43')](respondWithResult(_0x114a40,null))['catch'](handleError(_0x114a40,null));};exports[_0xfa1c('0x57')]=function(_0x4a6f56,_0x1f9a19,_0x5816dd){var _0x49445e=[_0xfa1c('0x58'),_0xfa1c('0x59'),_0xfa1c('0x5a'),_0xfa1c('0x5b'),_0xfa1c('0x5c'),_0xfa1c('0x5d'),_0xfa1c('0x5e'),_0xfa1c('0x5f'),_0xfa1c('0x60')];var _0xbee498=[_0xfa1c('0x61'),_0xfa1c('0x58'),_0xfa1c('0x62'),_0xfa1c('0x63'),_0xfa1c('0x64'),'sys_updated_on',_0xfa1c('0x65'),_0xfa1c('0x59'),_0xfa1c('0x66'),'number',_0xfa1c('0x67'),_0xfa1c('0x68'),_0xfa1c('0x69'),_0xfa1c('0x6a'),_0xfa1c('0x6b'),_0xfa1c('0x6c'),_0xfa1c('0x6d'),_0xfa1c('0x6e'),'knowledge',_0xfa1c('0x37'),_0xfa1c('0x6f'),_0xfa1c('0x70'),'cmdb_ci',_0xfa1c('0x71'),_0xfa1c('0x72'),_0xfa1c('0x73'),'work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked',_0xfa1c('0x74'),_0xfa1c('0x75'),_0xfa1c('0x76'),'group_list',_0xfa1c('0x77'),_0xfa1c('0x78'),'resolved_at','caller_id',_0xfa1c('0x79'),_0xfa1c('0x5b'),_0xfa1c('0x7a'),_0xfa1c('0x7b'),'close_code',_0xfa1c('0x7c'),_0xfa1c('0x7d'),_0xfa1c('0x7e'),'assignment_group','business_stc',_0xfa1c('0x7f'),_0xfa1c('0x80'),_0xfa1c('0x81'),'notify',_0xfa1c('0x82'),'close_notes',_0xfa1c('0x83'),_0xfa1c('0x84'),_0xfa1c('0x85'),_0xfa1c('0x86'),_0xfa1c('0x87'),_0xfa1c('0x88'),'incident_state',_0xfa1c('0x89'),_0xfa1c('0x8a'),_0xfa1c('0x8b'),'reassignment_count',_0xfa1c('0x8c'),_0xfa1c('0x8d'),_0xfa1c('0x5f'),_0xfa1c('0x8e'),_0xfa1c('0x8f'),_0xfa1c('0x90'),_0xfa1c('0x91'),_0xfa1c('0x92'),_0xfa1c('0x93'),_0xfa1c('0x94'),_0xfa1c('0x95'),_0xfa1c('0x96'),_0xfa1c('0x97'),'correlation_id',_0xfa1c('0x98'),_0xfa1c('0x60')];var _0x314776='';var _0xbe63ef='';var _0x2041e8=[];var _0x3fdd9f='';var _0xae8e7f='';var _0x900bae=[];var _0x3f0d5d='';var _0x196521='';var _0x48f2bd={};var _0x2020e4='';return db[_0xfa1c('0x40')]['findOne']({'where':{'id':_0x4a6f56[_0xfa1c('0x45')]['id']},'attributes':['id','username',_0xfa1c('0x99'),_0xfa1c('0x9a'),_0xfa1c('0x9b'),_0xfa1c('0x9c')]})[_0xfa1c('0x43')](handleEntityNotFound(_0x1f9a19,null))['then'](function(_0x530f34){if(_0x530f34){_0x2020e4=_0x530f34[_0xfa1c('0x9b')];var _0x6b1a84=_0x2020e4[_0xfa1c('0x9d')](-0x1);if(_0x6b1a84==='/'){_0x2020e4=_0x2020e4[_0xfa1c('0x9e')](0x0,_0x2020e4[_0xfa1c('0x9f')](_0x6b1a84));}_0x196521=util['format'](_0xfa1c('0xa0'),_0x2020e4);_0x3f0d5d=util['format']('%s/api/now/table/',_0x2020e4);_0x48f2bd={'user':_0x530f34[_0xfa1c('0xa1')],'pass':_0x530f34[_0xfa1c('0x99')]};var _0xe1d434={'method':_0xfa1c('0xa2'),'uri':_0x196521+_0xfa1c('0xa3'),'auth':_0x48f2bd,'json':!![]};return rp(_0xe1d434);}})['then'](function(_0xf5c272){if(_0xf5c272[_0xfa1c('0xa4')][_0xfa1c('0x35')]>0x0){_0x314776=_0xf5c272[_0xfa1c('0xa4')];}console[_0xfa1c('0xa5')](_0xfa1c('0xa6'),_0x314776);_0x900bae=[];_0xbe63ef=Object[_0xfa1c('0xa7')]([],_0x314776);_['remove'](_0xbe63ef,function(_0x2a9643){return!_0x49445e[_0xfa1c('0xa8')](_0x2a9643[_0xfa1c('0x29')]);});_0xbe63ef[_0xfa1c('0xa9')](function(_0x479604){var _0x1714b4=createFieldObject(_0x3f0d5d,_0x48f2bd,_0x479604[_0xfa1c('0xaa')],_0x479604[_0xfa1c('0x29')],_0x479604[_0xfa1c('0xab')],![]);_0x900bae[_0xfa1c('0xac')](_0x1714b4);});return Promise[_0xfa1c('0xad')](_0x900bae);})[_0xfa1c('0x43')](function(_0x1b5240){_0x2041e8=_0x1b5240;_0x3fdd9f=Object[_0xfa1c('0xa7')]([],_0x314776);console['log']('TCL:\x20_object',_0x314776);_[_0xfa1c('0xae')](_0x3fdd9f,function(_0x1c47d0){return _0xbee498['includes'](_0x1c47d0[_0xfa1c('0x29')]);});console[_0xfa1c('0xa5')](_0xfa1c('0xaf'),_0x3fdd9f);_0x900bae=[];_0x3fdd9f['forEach'](function(_0x45d8e8){var _0x3b7c5a=createFieldObject(_0x3f0d5d,_0x48f2bd,_0x45d8e8[_0xfa1c('0xaa')],_0x45d8e8[_0xfa1c('0x29')],_0x45d8e8[_0xfa1c('0xab')],!![]);_0x900bae[_0xfa1c('0xac')](_0x3b7c5a);});return Promise[_0xfa1c('0xad')](_0x900bae);})[_0xfa1c('0x43')](function(_0x1d2b11){_0xae8e7f=_0x1d2b11;var _0x574f1c=_0x2041e8['concat'](_0xae8e7f);return{'count':_0x574f1c[_0xfa1c('0x35')],'rows':_0x574f1c};})[_0xfa1c('0x43')](respondWithResult(_0x1f9a19,null))[_0xfa1c('0x49')](function(_0x3e9fae){console['log'](_0xfa1c('0xb0')+_0x3e9fae);var _0x3a35c5=_0x4a6f56['query'][_0xfa1c('0xb1')]?0x1f4:_0x3e9fae['statusCode']||0x1f4;logger[_0xfa1c('0x27')](_0x3e9fae['stack']);delete _0x3e9fae[_0xfa1c('0x29')];if(_0x3a35c5===0x191){_0x3a35c5=0x190;}_0x1f9a19['status'](_0x3a35c5)['send'](_0x4a6f56[_0xfa1c('0x30')][_0xfa1c('0xb1')]?{'message':_0xfa1c('0xb2'),'statusCode':_0x3e9fae[_0xfa1c('0xb3')]}:_0x3e9fae);});};function createFieldObject(_0x40fc23,_0x4cf6e0,_0x55c8a6,_0x261c87,_0x3479cc,_0x3a5ab2){return new Promise(function(_0x2ed01f,_0x535553){var _0x259cdd={'id':_0x261c87,'name':_0x3479cc,'custom':_0x3a5ab2};if(_0x55c8a6===_0xfa1c('0xb4')){_0x259cdd[_0xfa1c('0x3f')]=[{'name':'True','value':_0xfa1c('0xb5')},{'name':_0xfa1c('0xb6'),'value':_0xfa1c('0xb7')}];_0x2ed01f(_0x259cdd);}else{var _0x338470={'method':_0xfa1c('0xa2'),'uri':_0x40fc23+'sys_choice?sysparm_query=name=incident^element='+_0x261c87,'auth':_0x4cf6e0,'json':!![]};return rp(_0x338470)['then'](function(_0x32e9b2){var _0x1a57ff=[];if(_0x32e9b2[_0xfa1c('0xa4')]['length']>0x0){_0x32e9b2[_0xfa1c('0xa4')][_0xfa1c('0xa9')](function(_0x43ea96){if(_0x43ea96['inactive']===_0xfa1c('0xb7')){var _0x299d7f={'name':_0x43ea96[_0xfa1c('0xab')],'value':_0x43ea96['value']};_0x1a57ff[_0xfa1c('0xac')](_0x299d7f);}});}_0x259cdd[_0xfa1c('0x3f')]=_0x1a57ff;if(_0x259cdd[_0xfa1c('0x3f')][_0xfa1c('0x35')]>0x0){_0x2ed01f(_0x259cdd);}else{if(_0x3a5ab2==![]){_0x2ed01f();}else{_0x2ed01f(_0x259cdd);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index edd4f34..7b8ddd4 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x7b9117,_0x22e200){var _0x3e53b2=function(_0x555a8d){while(--_0x555a8d){_0x7b9117['push'](_0x7b9117['shift']());}};_0x3e53b2(++_0x22e200);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x268bcf,_0x564a7e){_0x268bcf=_0x268bcf-0x0;var _0x1d5373=_0xdbf5[_0x268bcf];return _0x1d5373;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment'];(function(_0x4da8c9,_0xf82fae){var _0x4ba6de=function(_0x23f6e1){while(--_0x23f6e1){_0x4da8c9['push'](_0x4da8c9['shift']());}};_0x4ba6de(++_0xf82fae);}(_0xda19,0xd5));var _0x9da1=function(_0x37739b,_0xd29b7){_0x37739b=_0x37739b-0x0;var _0x3983ea=_0xda19[_0x37739b];return _0x3983ea;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));var integrations=require(_0x9da1('0x7'));module[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return _0x2dcbc6[_0x9da1('0x9')](_0x9da1('0xa'),attributes,{'tableName':_0x9da1('0xb'),'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 4afc3a6..c8ff8c1 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 _0x898a=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','map','include','model','attributes','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f8184,_0x59e343){var _0x3e19d8=function(_0x1a2a68){while(--_0x1a2a68){_0x1f8184['push'](_0x1f8184['shift']());}};_0x3e19d8(++_0x59e343);}(_0x898a,0x85));var _0xa898=function(_0x2d72af,_0x1fc2f5){_0x2d72af=_0x2d72af-0x0;var _0x2578b7=_0x898a[_0x2d72af];return _0x2578b7;};'use strict';var _=require(_0xa898('0x0'));var util=require('util');var moment=require(_0xa898('0x1'));var BPromise=require(_0xa898('0x2'));var rs=require(_0xa898('0x3'));var fs=require('fs');var Redis=require(_0xa898('0x4'));var db=require(_0xa898('0x5'))['db'];var utils=require(_0xa898('0x6'));var logger=require('../../config/logger')(_0xa898('0x7'));var config=require(_0xa898('0x8'));var jayson=require(_0xa898('0x9'));var client=jayson[_0xa898('0xa')][_0xa898('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205a37,_0x13c55b,_0x1d6842){return new BPromise(function(_0x1902a7,_0x44b433){return client[_0xa898('0xc')](_0x205a37,_0x1d6842)[_0xa898('0xd')](function(_0x480443){logger[_0xa898('0xe')](_0xa898('0xf'),_0x13c55b,_0xa898('0x10'));logger[_0xa898('0x11')](_0xa898('0x12'),_0x13c55b,'request\x20sent',JSON[_0xa898('0x13')](_0x480443));if(_0x480443[_0xa898('0x14')]){if(_0x480443[_0xa898('0x14')][_0xa898('0x15')]===0x1f4){logger[_0xa898('0x14')](_0xa898('0xf'),_0x13c55b,_0x480443[_0xa898('0x14')]['message']);return _0x44b433(_0x480443[_0xa898('0x14')][_0xa898('0x16')]);}logger[_0xa898('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x13c55b,_0x480443[_0xa898('0x14')][_0xa898('0x16')]);return _0x1902a7(_0x480443[_0xa898('0x14')][_0xa898('0x16')]);}else{logger['info'](_0xa898('0xf'),_0x13c55b,'request\x20sent');_0x1902a7(_0x480443[_0xa898('0x17')][_0xa898('0x16')]);}})[_0xa898('0x18')](function(_0x309a61){logger[_0xa898('0x14')](_0xa898('0xf'),_0x13c55b,_0x309a61);_0x44b433(_0x309a61);});});}exports[_0xa898('0x19')]=function(_0x28bd24){var _0x5d57cb=this;return new Promise(function(_0x43c9f2,_0x5b25b9){return db[_0xa898('0x1a')]['findAll']({'raw':_0x28bd24[_0xa898('0x1b')]?_0x28bd24['options'][_0xa898('0x1c')]===undefined?!![]:![]:!![],'where':_0x28bd24[_0xa898('0x1b')]?_0x28bd24[_0xa898('0x1b')][_0xa898('0x1d')]||null:null,'attributes':_0x28bd24['options']?_0x28bd24['options']['attributes']||null:null,'limit':_0x28bd24[_0xa898('0x1b')]?_0x28bd24[_0xa898('0x1b')][_0xa898('0x1e')]||null:null,'include':_0x28bd24[_0xa898('0x1b')]?_0x28bd24['options']['include']?_[_0xa898('0x1f')](_0x28bd24[_0xa898('0x1b')][_0xa898('0x20')],function(_0x32f981){return{'model':db[_0x32f981[_0xa898('0x21')]],'as':_0x32f981['as'],'attributes':_0x32f981[_0xa898('0x22')],'include':_0x32f981[_0xa898('0x20')]?_[_0xa898('0x1f')](_0x32f981['include'],function(_0x252701){return{'model':db[_0x252701[_0xa898('0x21')]],'as':_0x252701['as'],'attributes':_0x252701[_0xa898('0x22')],'include':_0x252701['include']?_[_0xa898('0x1f')](_0x252701[_0xa898('0x20')],function(_0x12ee5e){return{'model':db[_0x12ee5e['model']],'as':_0x12ee5e['as'],'attributes':_0x12ee5e[_0xa898('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa898('0xd')](function(_0x1b2e07){logger[_0xa898('0xe')](_0xa898('0x19'),_0x28bd24);logger['debug'](_0xa898('0x19'),_0x28bd24,JSON[_0xa898('0x13')](_0x1b2e07));_0x43c9f2(_0x1b2e07);})[_0xa898('0x18')](function(_0x32f435){logger['error'](_0xa898('0x19'),_0x32f435['message'],_0x28bd24);_0x5b25b9(_0x5d57cb[_0xa898('0x14')](0x1f4,_0x32f435[_0xa898('0x16')]));});});};exports[_0xa898('0x23')]=function(_0x31288f){var _0x5ee916=this;return new Promise(function(_0x38cd87,_0x1210b8){return db[_0xa898('0x1a')][_0xa898('0x24')]({'raw':_0x31288f[_0xa898('0x1b')]?_0x31288f[_0xa898('0x1b')][_0xa898('0x1c')]===undefined?!![]:![]:!![],'where':_0x31288f[_0xa898('0x1b')]?_0x31288f['options'][_0xa898('0x1d')]||null:null,'attributes':_0x31288f[_0xa898('0x1b')]?_0x31288f['options'][_0xa898('0x22')]||null:null,'include':_0x31288f['options']?_0x31288f['options'][_0xa898('0x20')]?_[_0xa898('0x1f')](_0x31288f[_0xa898('0x1b')][_0xa898('0x20')],function(_0x5b770e){return{'model':db[_0x5b770e[_0xa898('0x21')]],'as':_0x5b770e['as'],'attributes':_0x5b770e[_0xa898('0x22')],'include':_0x5b770e[_0xa898('0x20')]?_[_0xa898('0x1f')](_0x5b770e[_0xa898('0x20')],function(_0x332d3c){return{'model':db[_0x332d3c[_0xa898('0x21')]],'as':_0x332d3c['as'],'attributes':_0x332d3c[_0xa898('0x22')],'include':_0x332d3c[_0xa898('0x20')]?_[_0xa898('0x1f')](_0x332d3c[_0xa898('0x20')],function(_0x382a23){return{'model':db[_0x382a23[_0xa898('0x21')]],'as':_0x382a23['as'],'attributes':_0x382a23['attributes']};}):[]};}):[]};}):[]:[]})[_0xa898('0xd')](function(_0x46ed87){logger[_0xa898('0xe')](_0xa898('0x23'),_0x31288f);logger[_0xa898('0x11')](_0xa898('0x23'),_0x31288f,JSON[_0xa898('0x13')](_0x46ed87));_0x38cd87(_0x46ed87);})[_0xa898('0x18')](function(_0x46217d){logger['error'](_0xa898('0x23'),_0x46217d[_0xa898('0x16')],_0x31288f);_0x1210b8(_0x5ee916[_0xa898('0x14')](0x1f4,_0x46217d[_0xa898('0x16')]));});});}; \ No newline at end of file +var _0x7a3b=['options','where','attributes','limit','include','map','model','info','debug','find','raw','ShowServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount'];(function(_0x2454a7,_0x177cd7){var _0x410192=function(_0xcacbf4){while(--_0xcacbf4){_0x2454a7['push'](_0x2454a7['shift']());}};_0x410192(++_0x177cd7);}(_0x7a3b,0x1e0));var _0xb7a3=function(_0x505b9b,_0x78544d){_0x505b9b=_0x505b9b-0x0;var _0xaa29ea=_0x7a3b[_0x505b9b];return _0xaa29ea;};'use strict';var _=require(_0xb7a3('0x0'));var util=require(_0xb7a3('0x1'));var moment=require('moment');var BPromise=require(_0xb7a3('0x2'));var rs=require(_0xb7a3('0x3'));var fs=require('fs');var Redis=require(_0xb7a3('0x4'));var db=require(_0xb7a3('0x5'))['db'];var utils=require(_0xb7a3('0x6'));var logger=require(_0xb7a3('0x7'))(_0xb7a3('0x8'));var config=require(_0xb7a3('0x9'));var jayson=require(_0xb7a3('0xa'));var client=jayson[_0xb7a3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33743a,_0x30d163,_0x432369){return new BPromise(function(_0x2f0fbd,_0x399b5c){return client[_0xb7a3('0xc')](_0x33743a,_0x432369)[_0xb7a3('0xd')](function(_0x58f25f){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x30d163,_0xb7a3('0xe'));logger['debug'](_0xb7a3('0xf'),_0x30d163,_0xb7a3('0xe'),JSON[_0xb7a3('0x10')](_0x58f25f));if(_0x58f25f[_0xb7a3('0x11')]){if(_0x58f25f[_0xb7a3('0x11')][_0xb7a3('0x12')]===0x1f4){logger[_0xb7a3('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x30d163,_0x58f25f[_0xb7a3('0x11')][_0xb7a3('0x13')]);return _0x399b5c(_0x58f25f[_0xb7a3('0x11')]['message']);}logger['error'](_0xb7a3('0x14'),_0x30d163,_0x58f25f['error']['message']);return _0x2f0fbd(_0x58f25f[_0xb7a3('0x11')][_0xb7a3('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x30d163,'request\x20sent');_0x2f0fbd(_0x58f25f[_0xb7a3('0x15')][_0xb7a3('0x13')]);}})[_0xb7a3('0x16')](function(_0x134df9){logger[_0xb7a3('0x11')](_0xb7a3('0x14'),_0x30d163,_0x134df9);_0x399b5c(_0x134df9);});});}exports[_0xb7a3('0x17')]=function(_0x534b57){var _0x1fc16c=this;return new Promise(function(_0x185c51,_0x3a7031){return db['ServicenowAccount']['findAll']({'raw':_0x534b57[_0xb7a3('0x18')]?_0x534b57[_0xb7a3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x534b57[_0xb7a3('0x18')]?_0x534b57['options'][_0xb7a3('0x19')]||null:null,'attributes':_0x534b57['options']?_0x534b57[_0xb7a3('0x18')][_0xb7a3('0x1a')]||null:null,'limit':_0x534b57[_0xb7a3('0x18')]?_0x534b57['options'][_0xb7a3('0x1b')]||null:null,'include':_0x534b57['options']?_0x534b57[_0xb7a3('0x18')][_0xb7a3('0x1c')]?_[_0xb7a3('0x1d')](_0x534b57[_0xb7a3('0x18')][_0xb7a3('0x1c')],function(_0x3f7cea){return{'model':db[_0x3f7cea['model']],'as':_0x3f7cea['as'],'attributes':_0x3f7cea[_0xb7a3('0x1a')],'include':_0x3f7cea[_0xb7a3('0x1c')]?_['map'](_0x3f7cea[_0xb7a3('0x1c')],function(_0x2bc777){return{'model':db[_0x2bc777[_0xb7a3('0x1e')]],'as':_0x2bc777['as'],'attributes':_0x2bc777[_0xb7a3('0x1a')],'include':_0x2bc777[_0xb7a3('0x1c')]?_[_0xb7a3('0x1d')](_0x2bc777[_0xb7a3('0x1c')],function(_0x52fb6b){return{'model':db[_0x52fb6b[_0xb7a3('0x1e')]],'as':_0x52fb6b['as'],'attributes':_0x52fb6b[_0xb7a3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb7a3('0xd')](function(_0xbc682b){logger[_0xb7a3('0x1f')](_0xb7a3('0x17'),_0x534b57);logger[_0xb7a3('0x20')](_0xb7a3('0x17'),_0x534b57,JSON[_0xb7a3('0x10')](_0xbc682b));_0x185c51(_0xbc682b);})['catch'](function(_0x381901){logger[_0xb7a3('0x11')]('GetServicenowAccount',_0x381901[_0xb7a3('0x13')],_0x534b57);_0x3a7031(_0x1fc16c[_0xb7a3('0x11')](0x1f4,_0x381901[_0xb7a3('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x402b81){var _0x556384=this;return new Promise(function(_0x2ed3f4,_0x1d9655){return db['ServicenowAccount'][_0xb7a3('0x21')]({'raw':_0x402b81[_0xb7a3('0x18')]?_0x402b81[_0xb7a3('0x18')][_0xb7a3('0x22')]===undefined?!![]:![]:!![],'where':_0x402b81[_0xb7a3('0x18')]?_0x402b81['options'][_0xb7a3('0x19')]||null:null,'attributes':_0x402b81[_0xb7a3('0x18')]?_0x402b81[_0xb7a3('0x18')][_0xb7a3('0x1a')]||null:null,'include':_0x402b81['options']?_0x402b81[_0xb7a3('0x18')][_0xb7a3('0x1c')]?_[_0xb7a3('0x1d')](_0x402b81['options'][_0xb7a3('0x1c')],function(_0x38ab41){return{'model':db[_0x38ab41['model']],'as':_0x38ab41['as'],'attributes':_0x38ab41[_0xb7a3('0x1a')],'include':_0x38ab41['include']?_[_0xb7a3('0x1d')](_0x38ab41['include'],function(_0x100f14){return{'model':db[_0x100f14[_0xb7a3('0x1e')]],'as':_0x100f14['as'],'attributes':_0x100f14[_0xb7a3('0x1a')],'include':_0x100f14['include']?_[_0xb7a3('0x1d')](_0x100f14[_0xb7a3('0x1c')],function(_0x3e2189){return{'model':db[_0x3e2189[_0xb7a3('0x1e')]],'as':_0x3e2189['as'],'attributes':_0x3e2189['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x246fd6){logger['info']('ShowServicenowAccount',_0x402b81);logger['debug']('ShowServicenowAccount',_0x402b81,JSON['stringify'](_0x246fd6));_0x2ed3f4(_0x246fd6);})[_0xb7a3('0x16')](function(_0xcd3425){logger[_0xb7a3('0x11')](_0xb7a3('0x23'),_0xcd3425[_0xb7a3('0x13')],_0x402b81);_0x1d9655(_0x556384[_0xb7a3('0x11')](0x1f4,_0xcd3425['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 34aade7..641f1b9 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 _0x3b17=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy'];(function(_0x24d5e4,_0x3f638e){var _0x24ece4=function(_0x49d341){while(--_0x49d341){_0x24d5e4['push'](_0x24d5e4['shift']());}};_0x24ece4(++_0x3f638e);}(_0x3b17,0xfd));var _0x73b1=function(_0x13dddc,_0x4bbd9e){_0x13dddc=_0x13dddc-0x0;var _0x44166c=_0x3b17[_0x13dddc];return _0x44166c;};'use strict';var multer=require(_0x73b1('0x0'));var util=require(_0x73b1('0x1'));var path=require('path');var timeout=require(_0x73b1('0x2'));var express=require(_0x73b1('0x3'));var router=express[_0x73b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73b1('0x5'));var interaction=require(_0x73b1('0x6'));var config=require(_0x73b1('0x7'));var controller=require(_0x73b1('0x8'));router[_0x73b1('0x9')]('/',auth[_0x73b1('0xa')](),controller[_0x73b1('0xb')]);router[_0x73b1('0x9')](_0x73b1('0xc'),auth[_0x73b1('0xa')](),controller[_0x73b1('0xd')]);router['get'](_0x73b1('0xe'),auth[_0x73b1('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x73b1('0xa')](),controller[_0x73b1('0xf')]);router[_0x73b1('0x9')](_0x73b1('0x10'),auth[_0x73b1('0xa')](),controller[_0x73b1('0x11')]);router[_0x73b1('0x12')]('/',auth[_0x73b1('0xa')](),controller[_0x73b1('0x13')]);router[_0x73b1('0x14')](_0x73b1('0xc'),auth[_0x73b1('0xa')](),controller['update']);router[_0x73b1('0x15')]('/:id',auth[_0x73b1('0xa')](),controller[_0x73b1('0x16')]);module['exports']=router; \ No newline at end of file +var _0x271f=['getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x271f,0xb6));var _0xf271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf271('0x0'));var util=require(_0xf271('0x1'));var path=require(_0xf271('0x2'));var timeout=require(_0xf271('0x3'));var express=require(_0xf271('0x4'));var router=express[_0xf271('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf271('0x6'));var interaction=require(_0xf271('0x7'));var config=require(_0xf271('0x8'));var controller=require(_0xf271('0x9'));router[_0xf271('0xa')]('/',auth[_0xf271('0xb')](),controller[_0xf271('0xc')]);router[_0xf271('0xa')](_0xf271('0xd'),auth[_0xf271('0xb')](),controller['show']);router[_0xf271('0xa')](_0xf271('0xe'),auth['isAuthenticated'](),controller[_0xf271('0xf')]);router[_0xf271('0xa')]('/:id/subjects',auth[_0xf271('0xb')](),controller[_0xf271('0x10')]);router[_0xf271('0xa')](_0xf271('0x11'),auth[_0xf271('0xb')](),controller[_0xf271('0x12')]);router[_0xf271('0x13')]('/',auth[_0xf271('0xb')](),controller[_0xf271('0x14')]);router['put']('/:id',auth[_0xf271('0xb')](),controller[_0xf271('0x15')]);router[_0xf271('0x16')](_0xf271('0xd'),auth[_0xf271('0xb')](),controller[_0xf271('0x17')]);module[_0xf271('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index aac3fec..47131e9 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 _0xd123=['exports','STRING','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd123,0x10d));var _0x3d12=function(_0x333bb9,_0x334274){_0x333bb9=_0x333bb9-0x0;var _0xfa004a=_0xd123[_0x333bb9];return _0xfa004a;};'use strict';var Sequelize=require(_0x3d12('0x0'));module[_0x3d12('0x1')]={'name':{'type':Sequelize[_0x3d12('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1818=['exports','STRING','sequelize'];(function(_0x3962bd,_0x40009f){var _0x2405d8=function(_0x399dc0){while(--_0x399dc0){_0x3962bd['push'](_0x3962bd['shift']());}};_0x2405d8(++_0x40009f);}(_0x1818,0x1e8));var _0x8181=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x1818[_0x19a49f];return _0x5351ae;};'use strict';var Sequelize=require(_0x8181('0x0'));module[_0x8181('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8181('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f400148..c3b1a9c 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 _0xd81d=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','findOne','ServicenowField','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x4f4330,_0x4a829a){var _0xf73264=function(_0x404dee){while(--_0x404dee){_0x4f4330['push'](_0x4f4330['shift']());}};_0xf73264(++_0x4a829a);}(_0xd81d,0xe3));var _0xdd81=function(_0x3cf79e,_0x56701e){_0x3cf79e=_0x3cf79e-0x0;var _0x390151=_0xd81d[_0x3cf79e];return _0x390151;};'use strict';var emlformat=require(_0xdd81('0x0'));var rimraf=require(_0xdd81('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd81('0x2'));var rp=require(_0xdd81('0x3'));var moment=require(_0xdd81('0x4'));var BPromise=require(_0xdd81('0x5'));var Mustache=require('mustache');var util=require(_0xdd81('0x6'));var path=require(_0xdd81('0x7'));var sox=require(_0xdd81('0x8'));var csv=require('to-csv');var ejs=require(_0xdd81('0x9'));var fs=require('fs');var fs_extra=require(_0xdd81('0xa'));var _=require(_0xdd81('0xb'));var squel=require(_0xdd81('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd81('0xd'));var deskjs=require(_0xdd81('0xe'));var toCsv=require(_0xdd81('0xf'));var querystring=require(_0xdd81('0x10'));var Papa=require(_0xdd81('0x11'));var Redis=require(_0xdd81('0x12'));var authService=require(_0xdd81('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdd81('0x14'));var hardwareService=require(_0xdd81('0x15'));var logger=require(_0xdd81('0x16'))(_0xdd81('0x17'));var utils=require(_0xdd81('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdd81('0x19'));var db=require(_0xdd81('0x1a'))['db'];function respondWithStatusCode(_0x169451,_0x2545d9){_0x2545d9=_0x2545d9||0xcc;return function(_0x10521a){if(_0x10521a){return _0x169451['sendStatus'](_0x2545d9);}return _0x169451[_0xdd81('0x1b')](_0x2545d9)['end']();};}function respondWithResult(_0x103fca,_0x330ee5){_0x330ee5=_0x330ee5||0xc8;return function(_0x4afa2c){if(_0x4afa2c){return _0x103fca[_0xdd81('0x1b')](_0x330ee5)['json'](_0x4afa2c);}};}function respondWithFilteredResult(_0x333983,_0x3f851e){return function(_0x53f50b){if(_0x53f50b){var _0x358462=typeof _0x3f851e[_0xdd81('0x1c')]==='undefined'&&typeof _0x3f851e[_0xdd81('0x1d')]===_0xdd81('0x1e');var _0x24b1b5=_0x53f50b['count'];var _0x2d62c4=_0x358462?0x0:_0x3f851e[_0xdd81('0x1c')];var _0xdf52d6=_0x358462?_0x53f50b[_0xdd81('0x1f')]:_0x3f851e['offset']+_0x3f851e[_0xdd81('0x1d')];var _0x27c281;if(_0xdf52d6>=_0x24b1b5){_0xdf52d6=_0x24b1b5;_0x27c281=0xc8;}else{_0x27c281=0xce;}_0x333983[_0xdd81('0x1b')](_0x27c281);return _0x333983[_0xdd81('0x20')](_0xdd81('0x21'),_0x2d62c4+'-'+_0xdf52d6+'/'+_0x24b1b5)[_0xdd81('0x22')](_0x53f50b);}return null;};}function patchUpdates(_0x986f60){return function(_0x15865c){try{jsonpatch[_0xdd81('0x23')](_0x15865c,_0x986f60,!![]);}catch(_0x37dbbc){return BPromise['reject'](_0x37dbbc);}return _0x15865c[_0xdd81('0x24')]();};}function saveUpdates(_0x30cd98,_0xd57290){return function(_0x21b8cf){if(_0x21b8cf){return _0x21b8cf[_0xdd81('0x25')](_0x30cd98)['then'](function(_0x2d408a){return _0x2d408a;});}return null;};}function removeEntity(_0x325df5,_0x138aa5){return function(_0x33d730){if(_0x33d730){return _0x33d730[_0xdd81('0x26')]()[_0xdd81('0x27')](function(){_0x325df5[_0xdd81('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb085,_0x49d57c){return function(_0x3d02ec){if(!_0x3d02ec){_0x2eb085['sendStatus'](0x194);}return _0x3d02ec;};}function handleError(_0x2aeda7,_0x4534fc){_0x4534fc=_0x4534fc||0x1f4;return function(_0x4b3c35){logger[_0xdd81('0x28')](_0x4b3c35[_0xdd81('0x29')]);if(_0x4b3c35['name']){delete _0x4b3c35[_0xdd81('0x2a')];}_0x2aeda7['status'](_0x4534fc)[_0xdd81('0x2b')](_0x4b3c35);};}exports['index']=function(_0x54f5bc,_0x198d87){var _0x2628a6={},_0x5c7f98={},_0xc57546={'count':0x0,'rows':[]};var _0x58cff3=_[_0xdd81('0x2c')](db[_0xdd81('0x2d')][_0xdd81('0x2e')],function(_0x4c077d){return{'name':_0x4c077d['fieldName'],'type':_0x4c077d[_0xdd81('0x2f')][_0xdd81('0x30')]};});_0x5c7f98[_0xdd81('0x31')]=_[_0xdd81('0x2c')](_0x58cff3,_0xdd81('0x2a'));_0x5c7f98[_0xdd81('0x32')]=_[_0xdd81('0x33')](_0x54f5bc[_0xdd81('0x32')]);_0x5c7f98[_0xdd81('0x34')]=_[_0xdd81('0x35')](_0x5c7f98[_0xdd81('0x31')],_0x5c7f98[_0xdd81('0x32')]);_0x2628a6[_0xdd81('0x36')]=_['intersection'](_0x5c7f98[_0xdd81('0x31')],qs[_0xdd81('0x37')](_0x54f5bc[_0xdd81('0x32')][_0xdd81('0x37')]));_0x2628a6['attributes']=_0x2628a6[_0xdd81('0x36')][_0xdd81('0x38')]?_0x2628a6[_0xdd81('0x36')]:_0x5c7f98[_0xdd81('0x31')];if(!_0x54f5bc[_0xdd81('0x32')]['hasOwnProperty'](_0xdd81('0x39'))){_0x2628a6[_0xdd81('0x1d')]=qs['limit'](_0x54f5bc[_0xdd81('0x32')][_0xdd81('0x1d')]);_0x2628a6[_0xdd81('0x1c')]=qs[_0xdd81('0x1c')](_0x54f5bc['query'][_0xdd81('0x1c')]);}_0x2628a6[_0xdd81('0x3a')]=qs[_0xdd81('0x3b')](_0x54f5bc[_0xdd81('0x32')][_0xdd81('0x3b')]);_0x2628a6[_0xdd81('0x3c')]=qs[_0xdd81('0x34')](_['pick'](_0x54f5bc[_0xdd81('0x32')],_0x5c7f98[_0xdd81('0x34')]),_0x58cff3);if(_0x54f5bc[_0xdd81('0x32')][_0xdd81('0x3d')]){_0x2628a6[_0xdd81('0x3c')]=_[_0xdd81('0x3e')](_0x2628a6[_0xdd81('0x3c')],{'$or':_[_0xdd81('0x2c')](_0x58cff3,function(_0x1c705a){if(_0x1c705a['type']!==_0xdd81('0x3f')){var _0x2df26b={};_0x2df26b[_0x1c705a[_0xdd81('0x2a')]]={'$like':'%'+_0x54f5bc[_0xdd81('0x32')]['filter']+'%'};return _0x2df26b;}})});}_0x2628a6=_[_0xdd81('0x3e')]({},_0x2628a6,_0x54f5bc['options']);var _0x59e1e0={'where':_0x2628a6[_0xdd81('0x3c')]};return db[_0xdd81('0x2d')][_0xdd81('0x1f')](_0x59e1e0)[_0xdd81('0x27')](function(_0x828ef5){_0xc57546[_0xdd81('0x1f')]=_0x828ef5;if(_0x54f5bc[_0xdd81('0x32')][_0xdd81('0x40')]){_0x2628a6[_0xdd81('0x41')]=[{'all':!![]}];}return db[_0xdd81('0x2d')][_0xdd81('0x42')](_0x2628a6);})[_0xdd81('0x27')](function(_0x53fd95){_0xc57546[_0xdd81('0x43')]=_0x53fd95;return _0xc57546;})[_0xdd81('0x27')](respondWithFilteredResult(_0x198d87,_0x2628a6))[_0xdd81('0x44')](handleError(_0x198d87,null));};exports['show']=function(_0x75679,_0x1be88e){var _0x482363={'raw':![],'where':{'id':_0x75679[_0xdd81('0x45')]['id']}},_0x54fb57={};_0x54fb57['model']=_[_0xdd81('0x33')](db[_0xdd81('0x2d')][_0xdd81('0x2e')]);_0x54fb57[_0xdd81('0x32')]=_[_0xdd81('0x33')](_0x75679[_0xdd81('0x32')]);_0x54fb57[_0xdd81('0x34')]=_[_0xdd81('0x35')](_0x54fb57[_0xdd81('0x31')],_0x54fb57[_0xdd81('0x32')]);_0x482363[_0xdd81('0x36')]=_[_0xdd81('0x35')](_0x54fb57[_0xdd81('0x31')],qs[_0xdd81('0x37')](_0x75679['query'][_0xdd81('0x37')]));_0x482363[_0xdd81('0x36')]=_0x482363[_0xdd81('0x36')]['length']?_0x482363[_0xdd81('0x36')]:_0x54fb57[_0xdd81('0x31')];if(_0x75679[_0xdd81('0x32')][_0xdd81('0x40')]){_0x482363['include']=[{'all':!![]}];}_0x482363=_[_0xdd81('0x3e')]({},_0x482363,_0x75679[_0xdd81('0x46')]);return db[_0xdd81('0x2d')][_0xdd81('0x47')](_0x482363)[_0xdd81('0x27')](handleEntityNotFound(_0x1be88e,null))[_0xdd81('0x27')](respondWithResult(_0x1be88e,null))[_0xdd81('0x44')](handleError(_0x1be88e,null));};exports[_0xdd81('0x48')]=function(_0x4fa285,_0x5849ac){return db[_0xdd81('0x2d')][_0xdd81('0x48')](_0x4fa285[_0xdd81('0x49')],{})[_0xdd81('0x27')](respondWithResult(_0x5849ac,0xc9))['catch'](handleError(_0x5849ac,null));};exports[_0xdd81('0x25')]=function(_0x24ff69,_0x163a38){if(_0x24ff69[_0xdd81('0x49')]['id']){delete _0x24ff69[_0xdd81('0x49')]['id'];}return db[_0xdd81('0x2d')][_0xdd81('0x47')]({'where':{'id':_0x24ff69[_0xdd81('0x45')]['id']}})[_0xdd81('0x27')](handleEntityNotFound(_0x163a38,null))[_0xdd81('0x27')](saveUpdates(_0x24ff69[_0xdd81('0x49')],null))['then'](respondWithResult(_0x163a38,null))['catch'](handleError(_0x163a38,null));};exports[_0xdd81('0x26')]=function(_0x58a213,_0x2a3456){return db[_0xdd81('0x2d')][_0xdd81('0x47')]({'where':{'id':_0x58a213[_0xdd81('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a3456,null))[_0xdd81('0x27')](removeEntity(_0x2a3456,null))[_0xdd81('0x44')](handleError(_0x2a3456,null));};exports['getFields']=function(_0x204dfa,_0x2a4e77,_0x5c3819){var _0x50d1f9={};var _0x2d78a5={};var _0x57f5fe;var _0x531aa8;return db['ServicenowConfiguration'][_0xdd81('0x4a')]({'where':{'id':_0x204dfa[_0xdd81('0x45')]['id']}})[_0xdd81('0x27')](handleEntityNotFound(_0x2a4e77,null))['then'](function(_0x5c22b9){if(_0x5c22b9){_0x57f5fe=_0x5c22b9;_0x2d78a5[_0xdd81('0x31')]=_[_0xdd81('0x33')](db[_0xdd81('0x4b')][_0xdd81('0x2e')]);_0x2d78a5[_0xdd81('0x32')]=_[_0xdd81('0x33')](_0x204dfa[_0xdd81('0x32')]);_0x2d78a5['filters']=_[_0xdd81('0x35')](_0x2d78a5['model'],_0x2d78a5[_0xdd81('0x32')]);_0x50d1f9[_0xdd81('0x36')]=_[_0xdd81('0x35')](_0x2d78a5['model'],qs['fields'](_0x204dfa[_0xdd81('0x32')][_0xdd81('0x37')]));_0x50d1f9[_0xdd81('0x36')]=_0x50d1f9[_0xdd81('0x36')][_0xdd81('0x38')]?_0x50d1f9[_0xdd81('0x36')]:_0x2d78a5['model'];_0x50d1f9[_0xdd81('0x3a')]=qs['sort'](_0x204dfa[_0xdd81('0x32')]['sort']);_0x50d1f9[_0xdd81('0x3c')]=qs[_0xdd81('0x34')](_['pick'](_0x204dfa[_0xdd81('0x32')],_0x2d78a5[_0xdd81('0x34')]));if(_0x204dfa[_0xdd81('0x32')]['filter']){_0x50d1f9[_0xdd81('0x3c')]=_[_0xdd81('0x3e')](_0x50d1f9[_0xdd81('0x3c')],{'$or':_[_0xdd81('0x2c')](_0x50d1f9[_0xdd81('0x36')],function(_0x41217c){var _0x3482c3={};_0x3482c3[_0x41217c]={'$like':'%'+_0x204dfa[_0xdd81('0x32')][_0xdd81('0x3d')]+'%'};return _0x3482c3;})});}_0x50d1f9=_[_0xdd81('0x3e')]({},_0x50d1f9,_0x204dfa[_0xdd81('0x46')]);return _0x57f5fe['getFields'](_0x50d1f9);}})[_0xdd81('0x27')](function(_0x436171){if(_0x436171){_0x531aa8=_0x436171['length'];if(!_0x204dfa[_0xdd81('0x32')][_0xdd81('0x4c')]('nolimit')){_0x50d1f9[_0xdd81('0x1d')]=qs['limit'](_0x204dfa['query']['limit']);_0x50d1f9['offset']=qs[_0xdd81('0x1c')](_0x204dfa[_0xdd81('0x32')][_0xdd81('0x1c')]);}return _0x57f5fe[_0xdd81('0x4d')](_0x50d1f9);}})[_0xdd81('0x27')](function(_0x194ce8){if(_0x194ce8){return _0x194ce8?{'count':_0x531aa8,'rows':_0x194ce8}:null;}})[_0xdd81('0x27')](respondWithResult(_0x2a4e77,null))[_0xdd81('0x44')](handleError(_0x2a4e77,null));};exports[_0xdd81('0x4e')]=function(_0xd1759b,_0x325bf0,_0x5beb3b){var _0x5f4fd1={};var _0x21bea5={};var _0x4dba31;var _0x5a9733;return db[_0xdd81('0x2d')][_0xdd81('0x4a')]({'where':{'id':_0xd1759b[_0xdd81('0x45')]['id']}})['then'](handleEntityNotFound(_0x325bf0,null))[_0xdd81('0x27')](function(_0x17cff0){if(_0x17cff0){_0x4dba31=_0x17cff0;_0x21bea5[_0xdd81('0x31')]=_['keys'](db[_0xdd81('0x4b')]['rawAttributes']);_0x21bea5[_0xdd81('0x32')]=_[_0xdd81('0x33')](_0xd1759b['query']);_0x21bea5[_0xdd81('0x34')]=_[_0xdd81('0x35')](_0x21bea5[_0xdd81('0x31')],_0x21bea5['query']);_0x5f4fd1[_0xdd81('0x36')]=_['intersection'](_0x21bea5[_0xdd81('0x31')],qs['fields'](_0xd1759b['query'][_0xdd81('0x37')]));_0x5f4fd1[_0xdd81('0x36')]=_0x5f4fd1['attributes']['length']?_0x5f4fd1[_0xdd81('0x36')]:_0x21bea5[_0xdd81('0x31')];_0x5f4fd1[_0xdd81('0x3a')]=qs['sort'](_0xd1759b[_0xdd81('0x32')][_0xdd81('0x3b')]);_0x5f4fd1['where']=qs[_0xdd81('0x34')](_['pick'](_0xd1759b[_0xdd81('0x32')],_0x21bea5[_0xdd81('0x34')]));if(_0xd1759b[_0xdd81('0x32')][_0xdd81('0x3d')]){_0x5f4fd1[_0xdd81('0x3c')]=_['merge'](_0x5f4fd1['where'],{'$or':_[_0xdd81('0x2c')](_0x5f4fd1['attributes'],function(_0x5be0e2){var _0x4b6d9e={};_0x4b6d9e[_0x5be0e2]={'$like':'%'+_0xd1759b[_0xdd81('0x32')][_0xdd81('0x3d')]+'%'};return _0x4b6d9e;})});}_0x5f4fd1=_[_0xdd81('0x3e')]({},_0x5f4fd1,_0xd1759b[_0xdd81('0x46')]);return _0x4dba31[_0xdd81('0x4e')](_0x5f4fd1);}})[_0xdd81('0x27')](function(_0x20216a){if(_0x20216a){_0x5a9733=_0x20216a[_0xdd81('0x38')];if(!_0xd1759b[_0xdd81('0x32')][_0xdd81('0x4c')]('nolimit')){_0x5f4fd1[_0xdd81('0x1d')]=qs[_0xdd81('0x1d')](_0xd1759b[_0xdd81('0x32')][_0xdd81('0x1d')]);_0x5f4fd1['offset']=qs['offset'](_0xd1759b[_0xdd81('0x32')][_0xdd81('0x1c')]);}return _0x4dba31['getSubjects'](_0x5f4fd1);}})['then'](function(_0x2c87a2){if(_0x2c87a2){return _0x2c87a2?{'count':_0x5a9733,'rows':_0x2c87a2}:null;}})[_0xdd81('0x27')](respondWithResult(_0x325bf0,null))[_0xdd81('0x44')](handleError(_0x325bf0,null));};exports[_0xdd81('0x4f')]=function(_0x2414b0,_0xd511df,_0x2cf143){var _0x59aeec={};var _0x41c253={};var _0xbcd36;var _0x313112;return db[_0xdd81('0x2d')][_0xdd81('0x4a')]({'where':{'id':_0x2414b0[_0xdd81('0x45')]['id']}})[_0xdd81('0x27')](handleEntityNotFound(_0xd511df,null))['then'](function(_0x7caf46){if(_0x7caf46){_0xbcd36=_0x7caf46;_0x41c253[_0xdd81('0x31')]=_[_0xdd81('0x33')](db['ServicenowField'][_0xdd81('0x2e')]);_0x41c253['query']=_[_0xdd81('0x33')](_0x2414b0[_0xdd81('0x32')]);_0x41c253[_0xdd81('0x34')]=_[_0xdd81('0x35')](_0x41c253[_0xdd81('0x31')],_0x41c253['query']);_0x59aeec[_0xdd81('0x36')]=_[_0xdd81('0x35')](_0x41c253[_0xdd81('0x31')],qs['fields'](_0x2414b0[_0xdd81('0x32')][_0xdd81('0x37')]));_0x59aeec[_0xdd81('0x36')]=_0x59aeec[_0xdd81('0x36')][_0xdd81('0x38')]?_0x59aeec['attributes']:_0x41c253[_0xdd81('0x31')];_0x59aeec[_0xdd81('0x3a')]=qs['sort'](_0x2414b0[_0xdd81('0x32')][_0xdd81('0x3b')]);_0x59aeec['where']=qs[_0xdd81('0x34')](_['pick'](_0x2414b0['query'],_0x41c253[_0xdd81('0x34')]));if(_0x2414b0['query']['filter']){_0x59aeec[_0xdd81('0x3c')]=_['merge'](_0x59aeec[_0xdd81('0x3c')],{'$or':_[_0xdd81('0x2c')](_0x59aeec['attributes'],function(_0x23b95a){var _0x5186d7={};_0x5186d7[_0x23b95a]={'$like':'%'+_0x2414b0['query'][_0xdd81('0x3d')]+'%'};return _0x5186d7;})});}_0x59aeec=_['merge']({},_0x59aeec,_0x2414b0[_0xdd81('0x46')]);return _0xbcd36[_0xdd81('0x4f')](_0x59aeec);}})[_0xdd81('0x27')](function(_0x4b3af7){if(_0x4b3af7){_0x313112=_0x4b3af7[_0xdd81('0x38')];if(!_0x2414b0[_0xdd81('0x32')][_0xdd81('0x4c')](_0xdd81('0x39'))){_0x59aeec[_0xdd81('0x1d')]=qs[_0xdd81('0x1d')](_0x2414b0[_0xdd81('0x32')][_0xdd81('0x1d')]);_0x59aeec[_0xdd81('0x1c')]=qs[_0xdd81('0x1c')](_0x2414b0[_0xdd81('0x32')][_0xdd81('0x1c')]);}return _0xbcd36[_0xdd81('0x4f')](_0x59aeec);}})[_0xdd81('0x27')](function(_0x10ffe5){if(_0x10ffe5){return _0x10ffe5?{'count':_0x313112,'rows':_0x10ffe5}:null;}})['then'](respondWithResult(_0xd511df,null))[_0xdd81('0x44')](handleError(_0xd511df,null));}; \ No newline at end of file +var _0x87fb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','offset','limit','set','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','params','keys','include','find','catch','create','body','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x87fb,0xde));var _0xb87f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x87fb[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xb87f('0x0'));var rimraf=require(_0xb87f('0x1'));var zipdir=require(_0xb87f('0x2'));var jsonpatch=require(_0xb87f('0x3'));var rp=require(_0xb87f('0x4'));var moment=require(_0xb87f('0x5'));var BPromise=require(_0xb87f('0x6'));var Mustache=require('mustache');var util=require(_0xb87f('0x7'));var path=require(_0xb87f('0x8'));var sox=require(_0xb87f('0x9'));var csv=require(_0xb87f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb87f('0xb'));var crypto=require(_0xb87f('0xc'));var jsforce=require(_0xb87f('0xd'));var deskjs=require(_0xb87f('0xe'));var toCsv=require(_0xb87f('0xa'));var querystring=require(_0xb87f('0xf'));var Papa=require(_0xb87f('0x10'));var Redis=require(_0xb87f('0x11'));var authService=require(_0xb87f('0x12'));var qs=require(_0xb87f('0x13'));var as=require(_0xb87f('0x14'));var hardwareService=require(_0xb87f('0x15'));var logger=require(_0xb87f('0x16'))(_0xb87f('0x17'));var utils=require(_0xb87f('0x18'));var config=require(_0xb87f('0x19'));var licenseUtil=require(_0xb87f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37f57e,_0x3f4532){_0x3f4532=_0x3f4532||0xcc;return function(_0x233f30){if(_0x233f30){return _0x37f57e['sendStatus'](_0x3f4532);}return _0x37f57e[_0xb87f('0x1b')](_0x3f4532)[_0xb87f('0x1c')]();};}function respondWithResult(_0x2081db,_0x3e4025){_0x3e4025=_0x3e4025||0xc8;return function(_0x1ecb8c){if(_0x1ecb8c){return _0x2081db[_0xb87f('0x1b')](_0x3e4025)['json'](_0x1ecb8c);}};}function respondWithFilteredResult(_0x2a9e68,_0x25fccf){return function(_0x3ee6d4){if(_0x3ee6d4){var _0x45590e=typeof _0x25fccf['offset']===_0xb87f('0x1d')&&typeof _0x25fccf['limit']===_0xb87f('0x1d');var _0x3a85f1=_0x3ee6d4['count'];var _0x6b7364=_0x45590e?0x0:_0x25fccf['offset'];var _0x185620=_0x45590e?_0x3ee6d4['count']:_0x25fccf[_0xb87f('0x1e')]+_0x25fccf[_0xb87f('0x1f')];var _0x5345f2;if(_0x185620>=_0x3a85f1){_0x185620=_0x3a85f1;_0x5345f2=0xc8;}else{_0x5345f2=0xce;}_0x2a9e68[_0xb87f('0x1b')](_0x5345f2);return _0x2a9e68[_0xb87f('0x20')](_0xb87f('0x21'),_0x6b7364+'-'+_0x185620+'/'+_0x3a85f1)[_0xb87f('0x22')](_0x3ee6d4);}return null;};}function patchUpdates(_0x26444f){return function(_0x254e35){try{jsonpatch['apply'](_0x254e35,_0x26444f,!![]);}catch(_0xf4c1f){return BPromise['reject'](_0xf4c1f);}return _0x254e35[_0xb87f('0x23')]();};}function saveUpdates(_0x68a765,_0x2fb569){return function(_0x4b3f86){if(_0x4b3f86){return _0x4b3f86[_0xb87f('0x24')](_0x68a765)[_0xb87f('0x25')](function(_0x5148ab){return _0x5148ab;});}return null;};}function removeEntity(_0x22557f,_0x3ad213){return function(_0x3acd59){if(_0x3acd59){return _0x3acd59[_0xb87f('0x26')]()['then'](function(){_0x22557f['status'](0xcc)[_0xb87f('0x1c')]();});}};}function handleEntityNotFound(_0x458cee,_0x3adea9){return function(_0x5ee6a8){if(!_0x5ee6a8){_0x458cee[_0xb87f('0x27')](0x194);}return _0x5ee6a8;};}function handleError(_0x40851c,_0x240e20){_0x240e20=_0x240e20||0x1f4;return function(_0x5eb427){logger[_0xb87f('0x28')](_0x5eb427[_0xb87f('0x29')]);if(_0x5eb427[_0xb87f('0x2a')]){delete _0x5eb427[_0xb87f('0x2a')];}_0x40851c[_0xb87f('0x1b')](_0x240e20)['send'](_0x5eb427);};}exports['index']=function(_0x1d2adc,_0x48c15d){var _0x2d9ce3={},_0x4ca505={},_0x2d2496={'count':0x0,'rows':[]};var _0x2dfc46=_['map'](db[_0xb87f('0x2b')][_0xb87f('0x2c')],function(_0x2cdcc9){return{'name':_0x2cdcc9[_0xb87f('0x2d')],'type':_0x2cdcc9[_0xb87f('0x2e')][_0xb87f('0x2f')]};});_0x4ca505[_0xb87f('0x30')]=_[_0xb87f('0x31')](_0x2dfc46,_0xb87f('0x2a'));_0x4ca505[_0xb87f('0x32')]=_['keys'](_0x1d2adc[_0xb87f('0x32')]);_0x4ca505[_0xb87f('0x33')]=_[_0xb87f('0x34')](_0x4ca505[_0xb87f('0x30')],_0x4ca505[_0xb87f('0x32')]);_0x2d9ce3[_0xb87f('0x35')]=_[_0xb87f('0x34')](_0x4ca505['model'],qs['fields'](_0x1d2adc[_0xb87f('0x32')][_0xb87f('0x36')]));_0x2d9ce3[_0xb87f('0x35')]=_0x2d9ce3[_0xb87f('0x35')][_0xb87f('0x37')]?_0x2d9ce3[_0xb87f('0x35')]:_0x4ca505[_0xb87f('0x30')];if(!_0x1d2adc[_0xb87f('0x32')][_0xb87f('0x38')]('nolimit')){_0x2d9ce3[_0xb87f('0x1f')]=qs[_0xb87f('0x1f')](_0x1d2adc[_0xb87f('0x32')]['limit']);_0x2d9ce3[_0xb87f('0x1e')]=qs[_0xb87f('0x1e')](_0x1d2adc[_0xb87f('0x32')][_0xb87f('0x1e')]);}_0x2d9ce3[_0xb87f('0x39')]=qs[_0xb87f('0x3a')](_0x1d2adc['query'][_0xb87f('0x3a')]);_0x2d9ce3[_0xb87f('0x3b')]=qs[_0xb87f('0x33')](_[_0xb87f('0x3c')](_0x1d2adc[_0xb87f('0x32')],_0x4ca505['filters']),_0x2dfc46);if(_0x1d2adc['query'][_0xb87f('0x3d')]){_0x2d9ce3[_0xb87f('0x3b')]=_[_0xb87f('0x3e')](_0x2d9ce3[_0xb87f('0x3b')],{'$or':_[_0xb87f('0x31')](_0x2dfc46,function(_0x40da21){if(_0x40da21['type']!==_0xb87f('0x3f')){var _0x500ae6={};_0x500ae6[_0x40da21[_0xb87f('0x2a')]]={'$like':'%'+_0x1d2adc[_0xb87f('0x32')][_0xb87f('0x3d')]+'%'};return _0x500ae6;}})});}_0x2d9ce3=_[_0xb87f('0x3e')]({},_0x2d9ce3,_0x1d2adc[_0xb87f('0x40')]);var _0x38cf40={'where':_0x2d9ce3[_0xb87f('0x3b')]};return db[_0xb87f('0x2b')][_0xb87f('0x41')](_0x38cf40)[_0xb87f('0x25')](function(_0x42db63){_0x2d2496['count']=_0x42db63;if(_0x1d2adc[_0xb87f('0x32')]['includeAll']){_0x2d9ce3['include']=[{'all':!![]}];}return db[_0xb87f('0x2b')][_0xb87f('0x42')](_0x2d9ce3);})['then'](function(_0x2c672e){_0x2d2496[_0xb87f('0x43')]=_0x2c672e;return _0x2d2496;})['then'](respondWithFilteredResult(_0x48c15d,_0x2d9ce3))['catch'](handleError(_0x48c15d,null));};exports['show']=function(_0x4726cb,_0x13b8f7){var _0x43f530={'raw':![],'where':{'id':_0x4726cb[_0xb87f('0x44')]['id']}},_0x1a6c6f={};_0x1a6c6f[_0xb87f('0x30')]=_[_0xb87f('0x45')](db[_0xb87f('0x2b')]['rawAttributes']);_0x1a6c6f['query']=_[_0xb87f('0x45')](_0x4726cb[_0xb87f('0x32')]);_0x1a6c6f[_0xb87f('0x33')]=_['intersection'](_0x1a6c6f['model'],_0x1a6c6f[_0xb87f('0x32')]);_0x43f530[_0xb87f('0x35')]=_[_0xb87f('0x34')](_0x1a6c6f[_0xb87f('0x30')],qs[_0xb87f('0x36')](_0x4726cb['query'][_0xb87f('0x36')]));_0x43f530[_0xb87f('0x35')]=_0x43f530['attributes'][_0xb87f('0x37')]?_0x43f530[_0xb87f('0x35')]:_0x1a6c6f['model'];if(_0x4726cb['query']['includeAll']){_0x43f530[_0xb87f('0x46')]=[{'all':!![]}];}_0x43f530=_['merge']({},_0x43f530,_0x4726cb[_0xb87f('0x40')]);return db[_0xb87f('0x2b')][_0xb87f('0x47')](_0x43f530)['then'](handleEntityNotFound(_0x13b8f7,null))['then'](respondWithResult(_0x13b8f7,null))[_0xb87f('0x48')](handleError(_0x13b8f7,null));};exports[_0xb87f('0x49')]=function(_0x380025,_0x10d542){return db['ServicenowConfiguration'][_0xb87f('0x49')](_0x380025[_0xb87f('0x4a')],{})['then'](respondWithResult(_0x10d542,0xc9))[_0xb87f('0x48')](handleError(_0x10d542,null));};exports['update']=function(_0x219ba4,_0x1c217e){if(_0x219ba4[_0xb87f('0x4a')]['id']){delete _0x219ba4[_0xb87f('0x4a')]['id'];}return db[_0xb87f('0x2b')][_0xb87f('0x47')]({'where':{'id':_0x219ba4[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x1c217e,null))['then'](saveUpdates(_0x219ba4[_0xb87f('0x4a')],null))[_0xb87f('0x25')](respondWithResult(_0x1c217e,null))[_0xb87f('0x48')](handleError(_0x1c217e,null));};exports['destroy']=function(_0x11804f,_0x269070){return db[_0xb87f('0x2b')]['find']({'where':{'id':_0x11804f[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x269070,null))[_0xb87f('0x25')](removeEntity(_0x269070,null))[_0xb87f('0x48')](handleError(_0x269070,null));};exports['getFields']=function(_0x3f1b7b,_0x56d64c,_0xf3c2de){var _0x14b680={};var _0x4fa4ef={};var _0x28a5a6;var _0x5297ca;return db[_0xb87f('0x2b')][_0xb87f('0x4b')]({'where':{'id':_0x3f1b7b[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x56d64c,null))[_0xb87f('0x25')](function(_0x50f04d){if(_0x50f04d){_0x28a5a6=_0x50f04d;_0x4fa4ef[_0xb87f('0x30')]=_['keys'](db[_0xb87f('0x4c')]['rawAttributes']);_0x4fa4ef[_0xb87f('0x32')]=_[_0xb87f('0x45')](_0x3f1b7b[_0xb87f('0x32')]);_0x4fa4ef['filters']=_[_0xb87f('0x34')](_0x4fa4ef[_0xb87f('0x30')],_0x4fa4ef['query']);_0x14b680[_0xb87f('0x35')]=_[_0xb87f('0x34')](_0x4fa4ef[_0xb87f('0x30')],qs[_0xb87f('0x36')](_0x3f1b7b[_0xb87f('0x32')][_0xb87f('0x36')]));_0x14b680[_0xb87f('0x35')]=_0x14b680[_0xb87f('0x35')][_0xb87f('0x37')]?_0x14b680[_0xb87f('0x35')]:_0x4fa4ef[_0xb87f('0x30')];_0x14b680[_0xb87f('0x39')]=qs[_0xb87f('0x3a')](_0x3f1b7b[_0xb87f('0x32')][_0xb87f('0x3a')]);_0x14b680[_0xb87f('0x3b')]=qs['filters'](_[_0xb87f('0x3c')](_0x3f1b7b['query'],_0x4fa4ef[_0xb87f('0x33')]));if(_0x3f1b7b[_0xb87f('0x32')][_0xb87f('0x3d')]){_0x14b680['where']=_[_0xb87f('0x3e')](_0x14b680['where'],{'$or':_[_0xb87f('0x31')](_0x14b680['attributes'],function(_0x1d8886){var _0x21fb4c={};_0x21fb4c[_0x1d8886]={'$like':'%'+_0x3f1b7b[_0xb87f('0x32')][_0xb87f('0x3d')]+'%'};return _0x21fb4c;})});}_0x14b680=_['merge']({},_0x14b680,_0x3f1b7b[_0xb87f('0x40')]);return _0x28a5a6[_0xb87f('0x4d')](_0x14b680);}})[_0xb87f('0x25')](function(_0x15d7a0){if(_0x15d7a0){_0x5297ca=_0x15d7a0[_0xb87f('0x37')];if(!_0x3f1b7b[_0xb87f('0x32')][_0xb87f('0x38')](_0xb87f('0x4e'))){_0x14b680[_0xb87f('0x1f')]=qs[_0xb87f('0x1f')](_0x3f1b7b['query'][_0xb87f('0x1f')]);_0x14b680[_0xb87f('0x1e')]=qs[_0xb87f('0x1e')](_0x3f1b7b['query']['offset']);}return _0x28a5a6[_0xb87f('0x4d')](_0x14b680);}})[_0xb87f('0x25')](function(_0x303631){if(_0x303631){return _0x303631?{'count':_0x5297ca,'rows':_0x303631}:null;}})[_0xb87f('0x25')](respondWithResult(_0x56d64c,null))['catch'](handleError(_0x56d64c,null));};exports['getSubjects']=function(_0x3fb6ce,_0x4a1050,_0x1c154e){var _0x268ea9={};var _0x1a0a9b={};var _0x650386;var _0x4ede33;return db['ServicenowConfiguration'][_0xb87f('0x4b')]({'where':{'id':_0x3fb6ce['params']['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x4a1050,null))[_0xb87f('0x25')](function(_0x3473af){if(_0x3473af){_0x650386=_0x3473af;_0x1a0a9b['model']=_[_0xb87f('0x45')](db[_0xb87f('0x4c')][_0xb87f('0x2c')]);_0x1a0a9b['query']=_[_0xb87f('0x45')](_0x3fb6ce[_0xb87f('0x32')]);_0x1a0a9b[_0xb87f('0x33')]=_[_0xb87f('0x34')](_0x1a0a9b[_0xb87f('0x30')],_0x1a0a9b['query']);_0x268ea9['attributes']=_[_0xb87f('0x34')](_0x1a0a9b['model'],qs[_0xb87f('0x36')](_0x3fb6ce[_0xb87f('0x32')]['fields']));_0x268ea9[_0xb87f('0x35')]=_0x268ea9[_0xb87f('0x35')][_0xb87f('0x37')]?_0x268ea9['attributes']:_0x1a0a9b[_0xb87f('0x30')];_0x268ea9['order']=qs[_0xb87f('0x3a')](_0x3fb6ce[_0xb87f('0x32')][_0xb87f('0x3a')]);_0x268ea9[_0xb87f('0x3b')]=qs[_0xb87f('0x33')](_[_0xb87f('0x3c')](_0x3fb6ce[_0xb87f('0x32')],_0x1a0a9b[_0xb87f('0x33')]));if(_0x3fb6ce[_0xb87f('0x32')][_0xb87f('0x3d')]){_0x268ea9[_0xb87f('0x3b')]=_[_0xb87f('0x3e')](_0x268ea9[_0xb87f('0x3b')],{'$or':_[_0xb87f('0x31')](_0x268ea9[_0xb87f('0x35')],function(_0x49dc4b){var _0x1a6c7d={};_0x1a6c7d[_0x49dc4b]={'$like':'%'+_0x3fb6ce[_0xb87f('0x32')][_0xb87f('0x3d')]+'%'};return _0x1a6c7d;})});}_0x268ea9=_[_0xb87f('0x3e')]({},_0x268ea9,_0x3fb6ce['options']);return _0x650386[_0xb87f('0x4f')](_0x268ea9);}})['then'](function(_0x38234e){if(_0x38234e){_0x4ede33=_0x38234e[_0xb87f('0x37')];if(!_0x3fb6ce['query']['hasOwnProperty']('nolimit')){_0x268ea9[_0xb87f('0x1f')]=qs[_0xb87f('0x1f')](_0x3fb6ce[_0xb87f('0x32')]['limit']);_0x268ea9[_0xb87f('0x1e')]=qs[_0xb87f('0x1e')](_0x3fb6ce[_0xb87f('0x32')][_0xb87f('0x1e')]);}return _0x650386[_0xb87f('0x4f')](_0x268ea9);}})[_0xb87f('0x25')](function(_0x3a782c){if(_0x3a782c){return _0x3a782c?{'count':_0x4ede33,'rows':_0x3a782c}:null;}})[_0xb87f('0x25')](respondWithResult(_0x4a1050,null))[_0xb87f('0x48')](handleError(_0x4a1050,null));};exports[_0xb87f('0x50')]=function(_0x21dbb0,_0x454626,_0x958312){var _0x12ef03={};var _0x2e03ba={};var _0x2a2c35;var _0x4fd6cd;return db[_0xb87f('0x2b')][_0xb87f('0x4b')]({'where':{'id':_0x21dbb0[_0xb87f('0x44')]['id']}})[_0xb87f('0x25')](handleEntityNotFound(_0x454626,null))[_0xb87f('0x25')](function(_0xbe3cf5){if(_0xbe3cf5){_0x2a2c35=_0xbe3cf5;_0x2e03ba['model']=_['keys'](db[_0xb87f('0x4c')][_0xb87f('0x2c')]);_0x2e03ba['query']=_[_0xb87f('0x45')](_0x21dbb0['query']);_0x2e03ba['filters']=_['intersection'](_0x2e03ba[_0xb87f('0x30')],_0x2e03ba['query']);_0x12ef03['attributes']=_[_0xb87f('0x34')](_0x2e03ba[_0xb87f('0x30')],qs[_0xb87f('0x36')](_0x21dbb0[_0xb87f('0x32')][_0xb87f('0x36')]));_0x12ef03[_0xb87f('0x35')]=_0x12ef03[_0xb87f('0x35')]['length']?_0x12ef03['attributes']:_0x2e03ba[_0xb87f('0x30')];_0x12ef03[_0xb87f('0x39')]=qs[_0xb87f('0x3a')](_0x21dbb0[_0xb87f('0x32')][_0xb87f('0x3a')]);_0x12ef03[_0xb87f('0x3b')]=qs[_0xb87f('0x33')](_['pick'](_0x21dbb0[_0xb87f('0x32')],_0x2e03ba[_0xb87f('0x33')]));if(_0x21dbb0[_0xb87f('0x32')]['filter']){_0x12ef03[_0xb87f('0x3b')]=_[_0xb87f('0x3e')](_0x12ef03[_0xb87f('0x3b')],{'$or':_[_0xb87f('0x31')](_0x12ef03[_0xb87f('0x35')],function(_0x4c6b4d){var _0x7b1ad6={};_0x7b1ad6[_0x4c6b4d]={'$like':'%'+_0x21dbb0['query'][_0xb87f('0x3d')]+'%'};return _0x7b1ad6;})});}_0x12ef03=_[_0xb87f('0x3e')]({},_0x12ef03,_0x21dbb0['options']);return _0x2a2c35['getDescriptions'](_0x12ef03);}})[_0xb87f('0x25')](function(_0x2dd1cf){if(_0x2dd1cf){_0x4fd6cd=_0x2dd1cf[_0xb87f('0x37')];if(!_0x21dbb0['query'][_0xb87f('0x38')]('nolimit')){_0x12ef03['limit']=qs[_0xb87f('0x1f')](_0x21dbb0[_0xb87f('0x32')]['limit']);_0x12ef03['offset']=qs[_0xb87f('0x1e')](_0x21dbb0['query']['offset']);}return _0x2a2c35['getDescriptions'](_0x12ef03);}})[_0xb87f('0x25')](function(_0x250334){if(_0x250334){return _0x250334?{'count':_0x4fd6cd,'rows':_0x250334}:null;}})[_0xb87f('0x25')](respondWithResult(_0x454626,null))['catch'](handleError(_0x454626,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2f4a1c8..f163b6c 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 _0xf34f=['int_servicenow_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define'];(function(_0x144231,_0x55b7d6){var _0x4da45a=function(_0x12fc92){while(--_0x12fc92){_0x144231['push'](_0x144231['shift']());}};_0x4da45a(++_0x55b7d6);}(_0xf34f,0x64));var _0xff34=function(_0x473cc2,_0x6743d2){_0x473cc2=_0x473cc2-0x0;var _0x570067=_0xf34f[_0x473cc2];return _0x570067;};'use strict';var _=require(_0xff34('0x0'));var util=require('util');var logger=require(_0xff34('0x1'))('api');var moment=require(_0xff34('0x2'));var BPromise=require('bluebird');var rp=require(_0xff34('0x3'));var fs=require('fs');var path=require(_0xff34('0x4'));var rimraf=require(_0xff34('0x5'));var config=require('../../config/environment');var attributes=require(_0xff34('0x6'));module['exports']=function(_0x1f436c,_0x5ba057){return _0x1f436c[_0xff34('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0xff34('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9d=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0xcabc86,_0x16d071){var _0x3f2250=function(_0x1d815e){while(--_0x1d815e){_0xcabc86['push'](_0xcabc86['shift']());}};_0x3f2250(++_0x16d071);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x23a5c1,_0x2da088){_0x23a5c1=_0x23a5c1-0x0;var _0x308040=_0xfe9d[_0x23a5c1];return _0x308040;};'use strict';var _=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var logger=require(_0xdfe9('0x2'))(_0xdfe9('0x3'));var moment=require(_0xdfe9('0x4'));var BPromise=require('bluebird');var rp=require(_0xdfe9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfe9('0x6'));var config=require(_0xdfe9('0x7'));var attributes=require(_0xdfe9('0x8'));module[_0xdfe9('0x9')]=function(_0xeb5238,_0x582904){return _0xeb5238['define'](_0xdfe9('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 35ca457..56a8848 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 _0x363c=['rpc','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x363c,0x15e));var _0xc363=function(_0x7404d4,_0x15eff4){_0x7404d4=_0x7404d4-0x0;var _0x37f6fc=_0x363c[_0x7404d4];return _0x37f6fc;};'use strict';var _=require(_0xc363('0x0'));var util=require('util');var moment=require(_0xc363('0x1'));var BPromise=require(_0xc363('0x2'));var rs=require(_0xc363('0x3'));var fs=require('fs');var Redis=require(_0xc363('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc363('0x5'));var logger=require(_0xc363('0x6'))(_0xc363('0x7'));var config=require('../../config/environment');var jayson=require(_0xc363('0x8'));var client=jayson['client'][_0xc363('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49a02f,_0x41766a,_0x39e6e9){return new BPromise(function(_0x45e46c,_0x3e2b22){return client[_0xc363('0xa')](_0x49a02f,_0x39e6e9)[_0xc363('0xb')](function(_0x2b1465){logger[_0xc363('0xc')](_0xc363('0xd'),_0x41766a,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x41766a,'request\x20sent',JSON[_0xc363('0xe')](_0x2b1465));if(_0x2b1465[_0xc363('0xf')]){if(_0x2b1465[_0xc363('0xf')][_0xc363('0x10')]===0x1f4){logger['error'](_0xc363('0xd'),_0x41766a,_0x2b1465['error'][_0xc363('0x11')]);return _0x3e2b22(_0x2b1465['error'][_0xc363('0x11')]);}logger[_0xc363('0xf')](_0xc363('0xd'),_0x41766a,_0x2b1465['error']['message']);return _0x45e46c(_0x2b1465[_0xc363('0xf')][_0xc363('0x11')]);}else{logger[_0xc363('0xc')](_0xc363('0xd'),_0x41766a,_0xc363('0x12'));_0x45e46c(_0x2b1465[_0xc363('0x13')][_0xc363('0x11')]);}})[_0xc363('0x14')](function(_0x4899af){logger[_0xc363('0xf')](_0xc363('0xd'),_0x41766a,_0x4899af);_0x3e2b22(_0x4899af);});});} \ No newline at end of file +var _0xaee6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x32369e,_0x44a601){var _0x40e585=function(_0x3abc92){while(--_0x3abc92){_0x32369e['push'](_0x32369e['shift']());}};_0x40e585(++_0x44a601);}(_0xaee6,0x187));var _0x6aee=function(_0x397cf7,_0x4b9fae){_0x397cf7=_0x397cf7-0x0;var _0x5a11c1=_0xaee6[_0x397cf7];return _0x5a11c1;};'use strict';var _=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var moment=require(_0x6aee('0x2'));var BPromise=require(_0x6aee('0x3'));var rs=require(_0x6aee('0x4'));var fs=require('fs');var Redis=require(_0x6aee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aee('0x6'));var logger=require(_0x6aee('0x7'))(_0x6aee('0x8'));var config=require('../../config/environment');var jayson=require(_0x6aee('0x9'));var client=jayson[_0x6aee('0xa')][_0x6aee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x441367,_0x437b2f,_0x19f528){return new BPromise(function(_0x366743,_0x47db4e){return client['request'](_0x441367,_0x19f528)[_0x6aee('0xc')](function(_0x5ac194){logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x437b2f,_0x6aee('0xf'));logger['debug'](_0x6aee('0x10'),_0x437b2f,_0x6aee('0xf'),JSON[_0x6aee('0x11')](_0x5ac194));if(_0x5ac194[_0x6aee('0x12')]){if(_0x5ac194['error'][_0x6aee('0x13')]===0x1f4){logger['error'](_0x6aee('0xe'),_0x437b2f,_0x5ac194[_0x6aee('0x12')][_0x6aee('0x14')]);return _0x47db4e(_0x5ac194[_0x6aee('0x12')][_0x6aee('0x14')]);}logger['error'](_0x6aee('0xe'),_0x437b2f,_0x5ac194[_0x6aee('0x12')]['message']);return _0x366743(_0x5ac194['error'][_0x6aee('0x14')]);}else{logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x437b2f,_0x6aee('0xf'));_0x366743(_0x5ac194[_0x6aee('0x15')][_0x6aee('0x14')]);}})[_0x6aee('0x16')](function(_0x2d84c0){logger['error'](_0x6aee('0xe'),_0x437b2f,_0x2d84c0);_0x47db4e(_0x2d84c0);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4fbf9a3..b0e76b3 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 _0x1d49=['index','get','show','create','/:id','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated'];(function(_0x504a4d,_0x5c7535){var _0x563dac=function(_0x16e12c){while(--_0x16e12c){_0x504a4d['push'](_0x504a4d['shift']());}};_0x563dac(++_0x5c7535);}(_0x1d49,0x126));var _0x91d4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1d49[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x91d4('0x0'));var util=require(_0x91d4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x91d4('0x2'));var router=express[_0x91d4('0x3')]();var fs_extra=require(_0x91d4('0x4'));var auth=require(_0x91d4('0x5'));var interaction=require(_0x91d4('0x6'));var config=require(_0x91d4('0x7'));var controller=require(_0x91d4('0x8'));router['get']('/',auth[_0x91d4('0x9')](),controller[_0x91d4('0xa')]);router[_0x91d4('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x91d4('0xc')]);router['post']('/',auth[_0x91d4('0x9')](),controller[_0x91d4('0xd')]);router['put'](_0x91d4('0xe'),auth[_0x91d4('0x9')](),controller['update']);router['delete']('/:id',auth[_0x91d4('0x9')](),controller[_0x91d4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe368=['show','post','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x223d4b,_0x20ec75){var _0x4b92f4=function(_0x2e9e57){while(--_0x2e9e57){_0x223d4b['push'](_0x223d4b['shift']());}};_0x4b92f4(++_0x20ec75);}(_0xe368,0x192));var _0x8e36=function(_0x5f089d,_0x460a37){_0x5f089d=_0x5f089d-0x0;var _0x6ff3ef=_0xe368[_0x5f089d];return _0x6ff3ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e36('0x0'));var timeout=require('connect-timeout');var express=require(_0x8e36('0x1'));var router=express[_0x8e36('0x2')]();var fs_extra=require(_0x8e36('0x3'));var auth=require(_0x8e36('0x4'));var interaction=require(_0x8e36('0x5'));var config=require(_0x8e36('0x6'));var controller=require(_0x8e36('0x7'));router[_0x8e36('0x8')]('/',auth[_0x8e36('0x9')](),controller[_0x8e36('0xa')]);router['get'](_0x8e36('0xb'),auth[_0x8e36('0x9')](),controller[_0x8e36('0xc')]);router[_0x8e36('0xd')]('/',auth[_0x8e36('0x9')](),controller['create']);router[_0x8e36('0xe')](_0x8e36('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8e36('0xf')](_0x8e36('0xb'),auth[_0x8e36('0x9')](),controller[_0x8e36('0x10')]);module[_0x8e36('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 305df8d..57a775b 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 _0x65cf=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x65cf,0x16c));var _0xf65c=function(_0x334ab1,_0x2048db){_0x334ab1=_0x334ab1-0x0;var _0x261863=_0x65cf[_0x334ab1];return _0x261863;};'use strict';var Sequelize=require(_0xf65c('0x0'));module[_0xf65c('0x1')]={'type':{'type':Sequelize[_0xf65c('0x2')](_0xf65c('0x3'),_0xf65c('0x4'),_0xf65c('0x5'),_0xf65c('0x6'),_0xf65c('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf65c('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf65c('0x2')](_0xf65c('0x3'),_0xf65c('0x4'),_0xf65c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf65c('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf65c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf65c('0x8')]}}; \ No newline at end of file +var _0x3dbd=['BOOLEAN','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1627bf,_0xfb0eec){var _0x2a69f3=function(_0x44309d){while(--_0x44309d){_0x1627bf['push'](_0x1627bf['shift']());}};_0x2a69f3(++_0xfb0eec);}(_0x3dbd,0x121));var _0xd3db=function(_0x316541,_0x2e27e0){_0x316541=_0x316541-0x0;var _0x5a0767=_0x3dbd[_0x316541];return _0x5a0767;};'use strict';var Sequelize=require('sequelize');module[_0xd3db('0x0')]={'type':{'type':Sequelize[_0xd3db('0x1')](_0xd3db('0x2'),_0xd3db('0x3'),_0xd3db('0x4'),'keyValue',_0xd3db('0x5')),'defaultValue':_0xd3db('0x2')},'content':{'type':Sequelize[_0xd3db('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd3db('0x1')](_0xd3db('0x2'),'variable',_0xd3db('0x4'))},'keyContent':{'type':Sequelize[_0xd3db('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd3db('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd3db('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 54bccca..8246bec 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 _0x1f0c=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','ServicenowField','findAll','catch','show','params','rawAttributes','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x3ee8bd,_0x58a4de){var _0x5e64ae=function(_0x3fba49){while(--_0x3fba49){_0x3ee8bd['push'](_0x3ee8bd['shift']());}};_0x5e64ae(++_0x58a4de);}(_0x1f0c,0x1be));var _0xc1f0=function(_0x41427c,_0x39699b){_0x41427c=_0x41427c-0x0;var _0x2a5dd7=_0x1f0c[_0x41427c];return _0x2a5dd7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1f0('0x0'));var zipdir=require(_0xc1f0('0x1'));var jsonpatch=require(_0xc1f0('0x2'));var rp=require(_0xc1f0('0x3'));var moment=require('moment');var BPromise=require(_0xc1f0('0x4'));var Mustache=require(_0xc1f0('0x5'));var util=require('util');var path=require(_0xc1f0('0x6'));var sox=require(_0xc1f0('0x7'));var csv=require(_0xc1f0('0x8'));var ejs=require(_0xc1f0('0x9'));var fs=require('fs');var fs_extra=require(_0xc1f0('0xa'));var _=require(_0xc1f0('0xb'));var squel=require('squel');var crypto=require(_0xc1f0('0xc'));var jsforce=require(_0xc1f0('0xd'));var deskjs=require(_0xc1f0('0xe'));var toCsv=require(_0xc1f0('0x8'));var querystring=require(_0xc1f0('0xf'));var Papa=require(_0xc1f0('0x10'));var Redis=require(_0xc1f0('0x11'));var authService=require(_0xc1f0('0x12'));var qs=require(_0xc1f0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc1f0('0x15'));var config=require(_0xc1f0('0x16'));var licenseUtil=require(_0xc1f0('0x17'));var db=require(_0xc1f0('0x18'))['db'];function respondWithStatusCode(_0x3be063,_0x29af22){_0x29af22=_0x29af22||0xcc;return function(_0x1eb09d){if(_0x1eb09d){return _0x3be063[_0xc1f0('0x19')](_0x29af22);}return _0x3be063['status'](_0x29af22)[_0xc1f0('0x1a')]();};}function respondWithResult(_0x1081d5,_0x5f43d3){_0x5f43d3=_0x5f43d3||0xc8;return function(_0x2db9d2){if(_0x2db9d2){return _0x1081d5[_0xc1f0('0x1b')](_0x5f43d3)['json'](_0x2db9d2);}};}function respondWithFilteredResult(_0x34000b,_0x144e54){return function(_0x848253){if(_0x848253){var _0x2a6f41=typeof _0x144e54[_0xc1f0('0x1c')]==='undefined'&&typeof _0x144e54['limit']===_0xc1f0('0x1d');var _0x305ff2=_0x848253[_0xc1f0('0x1e')];var _0x32284b=_0x2a6f41?0x0:_0x144e54[_0xc1f0('0x1c')];var _0x20090b=_0x2a6f41?_0x848253['count']:_0x144e54['offset']+_0x144e54[_0xc1f0('0x1f')];var _0x278071;if(_0x20090b>=_0x305ff2){_0x20090b=_0x305ff2;_0x278071=0xc8;}else{_0x278071=0xce;}_0x34000b['status'](_0x278071);return _0x34000b[_0xc1f0('0x20')](_0xc1f0('0x21'),_0x32284b+'-'+_0x20090b+'/'+_0x305ff2)[_0xc1f0('0x22')](_0x848253);}return null;};}function patchUpdates(_0xf49e13){return function(_0x1121cc){try{jsonpatch[_0xc1f0('0x23')](_0x1121cc,_0xf49e13,!![]);}catch(_0x151704){return BPromise[_0xc1f0('0x24')](_0x151704);}return _0x1121cc[_0xc1f0('0x25')]();};}function saveUpdates(_0x2bd400,_0x22888a){return function(_0x3b35f2){if(_0x3b35f2){return _0x3b35f2['update'](_0x2bd400)[_0xc1f0('0x26')](function(_0x35234b){return _0x35234b;});}return null;};}function removeEntity(_0x4d47bb,_0x3931f9){return function(_0xa29709){if(_0xa29709){return _0xa29709[_0xc1f0('0x27')]()['then'](function(){_0x4d47bb['status'](0xcc)[_0xc1f0('0x1a')]();});}};}function handleEntityNotFound(_0x5a99d8,_0x2b6341){return function(_0x3eba6f){if(!_0x3eba6f){_0x5a99d8['sendStatus'](0x194);}return _0x3eba6f;};}function handleError(_0x4ab126,_0xe043b){_0xe043b=_0xe043b||0x1f4;return function(_0x5c8ee6){logger[_0xc1f0('0x28')](_0x5c8ee6[_0xc1f0('0x29')]);if(_0x5c8ee6[_0xc1f0('0x2a')]){delete _0x5c8ee6[_0xc1f0('0x2a')];}_0x4ab126[_0xc1f0('0x1b')](_0xe043b)['send'](_0x5c8ee6);};}exports[_0xc1f0('0x2b')]=function(_0x3849de,_0x1f8cd2){var _0x553462={},_0x170679={},_0x214d06={'count':0x0,'rows':[]};var _0x42342e=_[_0xc1f0('0x2c')](db['ServicenowField']['rawAttributes'],function(_0x588f64){return{'name':_0x588f64['fieldName'],'type':_0x588f64[_0xc1f0('0x2d')][_0xc1f0('0x2e')]};});_0x170679[_0xc1f0('0x2f')]=_[_0xc1f0('0x2c')](_0x42342e,'name');_0x170679[_0xc1f0('0x30')]=_[_0xc1f0('0x31')](_0x3849de[_0xc1f0('0x30')]);_0x170679[_0xc1f0('0x32')]=_[_0xc1f0('0x33')](_0x170679[_0xc1f0('0x2f')],_0x170679[_0xc1f0('0x30')]);_0x553462[_0xc1f0('0x34')]=_[_0xc1f0('0x33')](_0x170679[_0xc1f0('0x2f')],qs[_0xc1f0('0x35')](_0x3849de[_0xc1f0('0x30')]['fields']));_0x553462[_0xc1f0('0x34')]=_0x553462[_0xc1f0('0x34')][_0xc1f0('0x36')]?_0x553462[_0xc1f0('0x34')]:_0x170679['model'];if(!_0x3849de[_0xc1f0('0x30')][_0xc1f0('0x37')](_0xc1f0('0x38'))){_0x553462[_0xc1f0('0x1f')]=qs[_0xc1f0('0x1f')](_0x3849de['query']['limit']);_0x553462[_0xc1f0('0x1c')]=qs[_0xc1f0('0x1c')](_0x3849de[_0xc1f0('0x30')][_0xc1f0('0x1c')]);}_0x553462[_0xc1f0('0x39')]=qs[_0xc1f0('0x3a')](_0x3849de[_0xc1f0('0x30')][_0xc1f0('0x3a')]);_0x553462['where']=qs['filters'](_['pick'](_0x3849de[_0xc1f0('0x30')],_0x170679[_0xc1f0('0x32')]),_0x42342e);if(_0x3849de['query'][_0xc1f0('0x3b')]){_0x553462[_0xc1f0('0x3c')]=_[_0xc1f0('0x3d')](_0x553462[_0xc1f0('0x3c')],{'$or':_[_0xc1f0('0x2c')](_0x42342e,function(_0x1cd71b){if(_0x1cd71b[_0xc1f0('0x2d')]!==_0xc1f0('0x3e')){var _0x4c9507={};_0x4c9507[_0x1cd71b[_0xc1f0('0x2a')]]={'$like':'%'+_0x3849de[_0xc1f0('0x30')]['filter']+'%'};return _0x4c9507;}})});}_0x553462=_['merge']({},_0x553462,_0x3849de[_0xc1f0('0x3f')]);var _0xfb06c7={'where':_0x553462[_0xc1f0('0x3c')]};return db['ServicenowField'][_0xc1f0('0x1e')](_0xfb06c7)[_0xc1f0('0x26')](function(_0x5335a7){_0x214d06[_0xc1f0('0x1e')]=_0x5335a7;if(_0x3849de[_0xc1f0('0x30')][_0xc1f0('0x40')]){_0x553462['include']=[{'all':!![]}];}return db[_0xc1f0('0x41')][_0xc1f0('0x42')](_0x553462);})[_0xc1f0('0x26')](function(_0x588f2a){_0x214d06['rows']=_0x588f2a;return _0x214d06;})[_0xc1f0('0x26')](respondWithFilteredResult(_0x1f8cd2,_0x553462))[_0xc1f0('0x43')](handleError(_0x1f8cd2,null));};exports[_0xc1f0('0x44')]=function(_0x5e4fab,_0xb3b94c){var _0x131de6={'raw':!![],'where':{'id':_0x5e4fab[_0xc1f0('0x45')]['id']}},_0x65878b={};_0x65878b[_0xc1f0('0x2f')]=_['keys'](db[_0xc1f0('0x41')][_0xc1f0('0x46')]);_0x65878b[_0xc1f0('0x30')]=_['keys'](_0x5e4fab[_0xc1f0('0x30')]);_0x65878b[_0xc1f0('0x32')]=_[_0xc1f0('0x33')](_0x65878b[_0xc1f0('0x2f')],_0x65878b[_0xc1f0('0x30')]);_0x131de6[_0xc1f0('0x34')]=_[_0xc1f0('0x33')](_0x65878b['model'],qs[_0xc1f0('0x35')](_0x5e4fab[_0xc1f0('0x30')][_0xc1f0('0x35')]));_0x131de6['attributes']=_0x131de6[_0xc1f0('0x34')][_0xc1f0('0x36')]?_0x131de6['attributes']:_0x65878b[_0xc1f0('0x2f')];if(_0x5e4fab[_0xc1f0('0x30')][_0xc1f0('0x40')]){_0x131de6[_0xc1f0('0x47')]=[{'all':!![]}];}_0x131de6=_[_0xc1f0('0x3d')]({},_0x131de6,_0x5e4fab[_0xc1f0('0x3f')]);return db['ServicenowField'][_0xc1f0('0x48')](_0x131de6)[_0xc1f0('0x26')](handleEntityNotFound(_0xb3b94c,null))[_0xc1f0('0x26')](respondWithResult(_0xb3b94c,null))[_0xc1f0('0x43')](handleError(_0xb3b94c,null));};exports[_0xc1f0('0x49')]=function(_0x438e9f,_0x21b874){return db[_0xc1f0('0x41')][_0xc1f0('0x49')](_0x438e9f[_0xc1f0('0x4a')],{})[_0xc1f0('0x26')](respondWithResult(_0x21b874,0xc9))[_0xc1f0('0x43')](handleError(_0x21b874,null));};exports[_0xc1f0('0x4b')]=function(_0x1c6f4b,_0x2cfd1d){if(_0x1c6f4b[_0xc1f0('0x4a')]['id']){delete _0x1c6f4b[_0xc1f0('0x4a')]['id'];}return db[_0xc1f0('0x41')][_0xc1f0('0x48')]({'where':{'id':_0x1c6f4b[_0xc1f0('0x45')]['id']}})[_0xc1f0('0x26')](handleEntityNotFound(_0x2cfd1d,null))[_0xc1f0('0x26')](saveUpdates(_0x1c6f4b[_0xc1f0('0x4a')],null))[_0xc1f0('0x26')](respondWithResult(_0x2cfd1d,null))[_0xc1f0('0x43')](handleError(_0x2cfd1d,null));};exports[_0xc1f0('0x27')]=function(_0x1f3c0e,_0x11e612){return db['ServicenowField']['find']({'where':{'id':_0x1f3c0e[_0xc1f0('0x45')]['id']}})[_0xc1f0('0x26')](handleEntityNotFound(_0x11e612,null))[_0xc1f0('0x26')](removeEntity(_0x11e612,null))[_0xc1f0('0x43')](handleError(_0x11e612,null));}; \ No newline at end of file +var _0xd488=['pick','filter','merge','where','type','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','catch','params','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0xd488,0x146));var _0x8d48=function(_0xbf09ab,_0x251a19){_0xbf09ab=_0xbf09ab-0x0;var _0x2a9aef=_0xd488[_0xbf09ab];return _0x2a9aef;};'use strict';var emlformat=require(_0x8d48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d48('0x1'));var jsonpatch=require(_0x8d48('0x2'));var rp=require(_0x8d48('0x3'));var moment=require(_0x8d48('0x4'));var BPromise=require(_0x8d48('0x5'));var Mustache=require(_0x8d48('0x6'));var util=require(_0x8d48('0x7'));var path=require(_0x8d48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d48('0x9'));var squel=require(_0x8d48('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8d48('0xb'));var toCsv=require(_0x8d48('0xc'));var querystring=require(_0x8d48('0xd'));var Papa=require(_0x8d48('0xe'));var Redis=require(_0x8d48('0xf'));var authService=require(_0x8d48('0x10'));var qs=require(_0x8d48('0x11'));var as=require(_0x8d48('0x12'));var hardwareService=require(_0x8d48('0x13'));var logger=require(_0x8d48('0x14'))(_0x8d48('0x15'));var utils=require(_0x8d48('0x16'));var config=require(_0x8d48('0x17'));var licenseUtil=require(_0x8d48('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ae37c,_0x3989db){_0x3989db=_0x3989db||0xcc;return function(_0x38a505){if(_0x38a505){return _0x5ae37c[_0x8d48('0x19')](_0x3989db);}return _0x5ae37c[_0x8d48('0x1a')](_0x3989db)[_0x8d48('0x1b')]();};}function respondWithResult(_0x2e3708,_0xe9c39c){_0xe9c39c=_0xe9c39c||0xc8;return function(_0x19385c){if(_0x19385c){return _0x2e3708[_0x8d48('0x1a')](_0xe9c39c)[_0x8d48('0x1c')](_0x19385c);}};}function respondWithFilteredResult(_0x1eff19,_0x74e026){return function(_0x3a831e){if(_0x3a831e){var _0x147b07=typeof _0x74e026[_0x8d48('0x1d')]===_0x8d48('0x1e')&&typeof _0x74e026[_0x8d48('0x1f')]===_0x8d48('0x1e');var _0x172d9b=_0x3a831e[_0x8d48('0x20')];var _0x3199ef=_0x147b07?0x0:_0x74e026['offset'];var _0x132177=_0x147b07?_0x3a831e[_0x8d48('0x20')]:_0x74e026['offset']+_0x74e026[_0x8d48('0x1f')];var _0x19d406;if(_0x132177>=_0x172d9b){_0x132177=_0x172d9b;_0x19d406=0xc8;}else{_0x19d406=0xce;}_0x1eff19[_0x8d48('0x1a')](_0x19d406);return _0x1eff19[_0x8d48('0x21')](_0x8d48('0x22'),_0x3199ef+'-'+_0x132177+'/'+_0x172d9b)[_0x8d48('0x1c')](_0x3a831e);}return null;};}function patchUpdates(_0x51012d){return function(_0x35a231){try{jsonpatch[_0x8d48('0x23')](_0x35a231,_0x51012d,!![]);}catch(_0x51ae18){return BPromise[_0x8d48('0x24')](_0x51ae18);}return _0x35a231['save']();};}function saveUpdates(_0x59e197,_0x439586){return function(_0x6b712d){if(_0x6b712d){return _0x6b712d['update'](_0x59e197)[_0x8d48('0x25')](function(_0x232684){return _0x232684;});}return null;};}function removeEntity(_0xe67560,_0x5489a7){return function(_0x5164b5){if(_0x5164b5){return _0x5164b5[_0x8d48('0x26')]()[_0x8d48('0x25')](function(){_0xe67560[_0x8d48('0x1a')](0xcc)[_0x8d48('0x1b')]();});}};}function handleEntityNotFound(_0xd37c61,_0xec27bb){return function(_0x592d21){if(!_0x592d21){_0xd37c61['sendStatus'](0x194);}return _0x592d21;};}function handleError(_0x5d6fd4,_0x995271){_0x995271=_0x995271||0x1f4;return function(_0x3338b7){logger[_0x8d48('0x27')](_0x3338b7[_0x8d48('0x28')]);if(_0x3338b7[_0x8d48('0x29')]){delete _0x3338b7[_0x8d48('0x29')];}_0x5d6fd4[_0x8d48('0x1a')](_0x995271)[_0x8d48('0x2a')](_0x3338b7);};}exports[_0x8d48('0x2b')]=function(_0x102895,_0x15d1c4){var _0x37e058={},_0x368ee1={},_0x27dd4d={'count':0x0,'rows':[]};var _0x1436ad=_[_0x8d48('0x2c')](db['ServicenowField'][_0x8d48('0x2d')],function(_0x261c8b){return{'name':_0x261c8b[_0x8d48('0x2e')],'type':_0x261c8b['type'][_0x8d48('0x2f')]};});_0x368ee1[_0x8d48('0x30')]=_[_0x8d48('0x2c')](_0x1436ad,'name');_0x368ee1[_0x8d48('0x31')]=_[_0x8d48('0x32')](_0x102895['query']);_0x368ee1[_0x8d48('0x33')]=_[_0x8d48('0x34')](_0x368ee1[_0x8d48('0x30')],_0x368ee1[_0x8d48('0x31')]);_0x37e058['attributes']=_['intersection'](_0x368ee1[_0x8d48('0x30')],qs[_0x8d48('0x35')](_0x102895[_0x8d48('0x31')][_0x8d48('0x35')]));_0x37e058[_0x8d48('0x36')]=_0x37e058[_0x8d48('0x36')][_0x8d48('0x37')]?_0x37e058[_0x8d48('0x36')]:_0x368ee1[_0x8d48('0x30')];if(!_0x102895[_0x8d48('0x31')]['hasOwnProperty'](_0x8d48('0x38'))){_0x37e058['limit']=qs[_0x8d48('0x1f')](_0x102895[_0x8d48('0x31')][_0x8d48('0x1f')]);_0x37e058[_0x8d48('0x1d')]=qs[_0x8d48('0x1d')](_0x102895[_0x8d48('0x31')][_0x8d48('0x1d')]);}_0x37e058[_0x8d48('0x39')]=qs[_0x8d48('0x3a')](_0x102895['query'][_0x8d48('0x3a')]);_0x37e058['where']=qs[_0x8d48('0x33')](_[_0x8d48('0x3b')](_0x102895[_0x8d48('0x31')],_0x368ee1[_0x8d48('0x33')]),_0x1436ad);if(_0x102895['query'][_0x8d48('0x3c')]){_0x37e058['where']=_[_0x8d48('0x3d')](_0x37e058[_0x8d48('0x3e')],{'$or':_['map'](_0x1436ad,function(_0x841839){if(_0x841839[_0x8d48('0x3f')]!==_0x8d48('0x40')){var _0x5cb578={};_0x5cb578[_0x841839['name']]={'$like':'%'+_0x102895['query'][_0x8d48('0x3c')]+'%'};return _0x5cb578;}})});}_0x37e058=_['merge']({},_0x37e058,_0x102895[_0x8d48('0x41')]);var _0xd8244d={'where':_0x37e058['where']};return db[_0x8d48('0x42')][_0x8d48('0x20')](_0xd8244d)[_0x8d48('0x25')](function(_0x29fa94){_0x27dd4d[_0x8d48('0x20')]=_0x29fa94;if(_0x102895[_0x8d48('0x31')][_0x8d48('0x43')]){_0x37e058[_0x8d48('0x44')]=[{'all':!![]}];}return db[_0x8d48('0x42')][_0x8d48('0x45')](_0x37e058);})[_0x8d48('0x25')](function(_0x4bf2aa){_0x27dd4d[_0x8d48('0x46')]=_0x4bf2aa;return _0x27dd4d;})[_0x8d48('0x25')](respondWithFilteredResult(_0x15d1c4,_0x37e058))[_0x8d48('0x47')](handleError(_0x15d1c4,null));};exports['show']=function(_0x18bf71,_0x1e2b41){var _0x3358dc={'raw':!![],'where':{'id':_0x18bf71[_0x8d48('0x48')]['id']}},_0x5ad1d0={};_0x5ad1d0[_0x8d48('0x30')]=_[_0x8d48('0x32')](db[_0x8d48('0x42')]['rawAttributes']);_0x5ad1d0[_0x8d48('0x31')]=_[_0x8d48('0x32')](_0x18bf71[_0x8d48('0x31')]);_0x5ad1d0['filters']=_[_0x8d48('0x34')](_0x5ad1d0[_0x8d48('0x30')],_0x5ad1d0[_0x8d48('0x31')]);_0x3358dc[_0x8d48('0x36')]=_[_0x8d48('0x34')](_0x5ad1d0[_0x8d48('0x30')],qs[_0x8d48('0x35')](_0x18bf71[_0x8d48('0x31')]['fields']));_0x3358dc[_0x8d48('0x36')]=_0x3358dc['attributes'][_0x8d48('0x37')]?_0x3358dc[_0x8d48('0x36')]:_0x5ad1d0['model'];if(_0x18bf71[_0x8d48('0x31')][_0x8d48('0x43')]){_0x3358dc['include']=[{'all':!![]}];}_0x3358dc=_[_0x8d48('0x3d')]({},_0x3358dc,_0x18bf71[_0x8d48('0x41')]);return db[_0x8d48('0x42')][_0x8d48('0x49')](_0x3358dc)[_0x8d48('0x25')](handleEntityNotFound(_0x1e2b41,null))[_0x8d48('0x25')](respondWithResult(_0x1e2b41,null))[_0x8d48('0x47')](handleError(_0x1e2b41,null));};exports[_0x8d48('0x4a')]=function(_0x9ce78,_0x41111c){return db[_0x8d48('0x42')]['create'](_0x9ce78['body'],{})['then'](respondWithResult(_0x41111c,0xc9))[_0x8d48('0x47')](handleError(_0x41111c,null));};exports[_0x8d48('0x4b')]=function(_0xb1fa06,_0x4aec77){if(_0xb1fa06['body']['id']){delete _0xb1fa06[_0x8d48('0x4c')]['id'];}return db[_0x8d48('0x42')][_0x8d48('0x49')]({'where':{'id':_0xb1fa06[_0x8d48('0x48')]['id']}})[_0x8d48('0x25')](handleEntityNotFound(_0x4aec77,null))[_0x8d48('0x25')](saveUpdates(_0xb1fa06[_0x8d48('0x4c')],null))[_0x8d48('0x25')](respondWithResult(_0x4aec77,null))['catch'](handleError(_0x4aec77,null));};exports['destroy']=function(_0x132a3d,_0x3e4f9c){return db[_0x8d48('0x42')][_0x8d48('0x49')]({'where':{'id':_0x132a3d[_0x8d48('0x48')]['id']}})[_0x8d48('0x25')](handleEntityNotFound(_0x3e4f9c,null))['then'](removeEntity(_0x3e4f9c,null))[_0x8d48('0x47')](handleError(_0x3e4f9c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 71980cf..f8b76c3 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 _0x53f7=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x53f7,0x80));var _0x753f=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0x53f7[_0x407bd8];return _0x20b6c9;};'use strict';var _=require(_0x753f('0x0'));var util=require(_0x753f('0x1'));var logger=require(_0x753f('0x2'))(_0x753f('0x3'));var moment=require(_0x753f('0x4'));var BPromise=require(_0x753f('0x5'));var rp=require(_0x753f('0x6'));var fs=require('fs');var path=require(_0x753f('0x7'));var rimraf=require(_0x753f('0x8'));var config=require(_0x753f('0x9'));var attributes=require(_0x753f('0xa'));module[_0x753f('0xb')]=function(_0x1b48ad,_0x44736b){return _0x1b48ad[_0x753f('0xc')](_0x753f('0xd'),attributes,{'tableName':_0x753f('0xe'),'paranoid':![],'indexes':[{'name':_0x753f('0xf'),'fields':[_0x753f('0x10'),_0x753f('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb265=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId'];(function(_0x17459c,_0x377a56){var _0xbf3473=function(_0x446a1f){while(--_0x446a1f){_0x17459c['push'](_0x17459c['shift']());}};_0xbf3473(++_0x377a56);}(_0xb265,0xe0));var _0x5b26=function(_0x283859,_0x12a013){_0x283859=_0x283859-0x0;var _0x30433f=_0xb265[_0x283859];return _0x30433f;};'use strict';var _=require(_0x5b26('0x0'));var util=require(_0x5b26('0x1'));var logger=require(_0x5b26('0x2'))(_0x5b26('0x3'));var moment=require(_0x5b26('0x4'));var BPromise=require(_0x5b26('0x5'));var rp=require(_0x5b26('0x6'));var fs=require('fs');var path=require(_0x5b26('0x7'));var rimraf=require(_0x5b26('0x8'));var config=require('../../config/environment');var attributes=require(_0x5b26('0x9'));module[_0x5b26('0xa')]=function(_0x323909,_0x143d68){return _0x323909[_0x5b26('0xb')](_0x5b26('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5b26('0xd'),'fields':[_0x5b26('0xe'),_0x5b26('0xf')],'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 c456511..4df4a7d 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x3bf329,_0x2a8dda){var _0x5dc33b=function(_0x5bc0e6){while(--_0x5bc0e6){_0x3bf329['push'](_0x3bf329['shift']());}};_0x5dc33b(++_0x2a8dda);}(_0xb7e7,0x121));var _0x7b7e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb7e7[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x35daeb,_0x2d9432){var _0xb93a82=function(_0x18befe){while(--_0x18befe){_0x35daeb['push'](_0x35daeb['shift']());}};_0xb93a82(++_0x2d9432);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3d2cf6a..f1766fc 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 _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(_0x182aa5,_0x588364){var _0x37702b=function(_0x21b872){while(--_0x21b872){_0x182aa5['push'](_0x182aa5['shift']());}};_0x37702b(++_0x588364);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 _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(_0x53afd2,_0x497a22){var _0x2a70bf=function(_0x300af4){while(--_0x300af4){_0x53afd2['push'](_0x53afd2['shift']());}};_0x2a70bf(++_0x497a22);}(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4c6f22d..f4bd608 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(_0x491048,_0x330f2f){var _0x49c414=function(_0x6045c3){while(--_0x6045c3){_0x491048['push'](_0x491048['shift']());}};_0x49c414(++_0x330f2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x6c41db,_0x116927){var _0x20a6b6=function(_0x2f47ec){while(--_0x2f47ec){_0x6c41db['push'](_0x6c41db['shift']());}};_0x20a6b6(++_0x116927);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 7f4dbe0..cd3e6ce 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 _0xcb06=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','length','merge','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','order','nolimit','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0xcd9f55,_0x18b352){var _0xb407ec=function(_0x6e098f){while(--_0x6e098f){_0xcd9f55['push'](_0xcd9f55['shift']());}};_0xb407ec(++_0x18b352);}(_0xcb06,0x79));var _0x6cb0=function(_0x59ed0e,_0x41a60f){_0x59ed0e=_0x59ed0e-0x0;var _0x9a8307=_0xcb06[_0x59ed0e];return _0x9a8307;};'use strict';var emlformat=require(_0x6cb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cb0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cb0('0x2'));var moment=require(_0x6cb0('0x3'));var BPromise=require(_0x6cb0('0x4'));var Mustache=require(_0x6cb0('0x5'));var util=require(_0x6cb0('0x6'));var path=require('path');var sox=require(_0x6cb0('0x7'));var csv=require(_0x6cb0('0x8'));var ejs=require(_0x6cb0('0x9'));var fs=require('fs');var fs_extra=require(_0x6cb0('0xa'));var _=require(_0x6cb0('0xb'));var squel=require(_0x6cb0('0xc'));var crypto=require(_0x6cb0('0xd'));var jsforce=require(_0x6cb0('0xe'));var deskjs=require(_0x6cb0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6cb0('0x10'));var Papa=require(_0x6cb0('0x11'));var Redis=require(_0x6cb0('0x12'));var authService=require(_0x6cb0('0x13'));var qs=require(_0x6cb0('0x14'));var as=require(_0x6cb0('0x15'));var hardwareService=require(_0x6cb0('0x16'));var logger=require(_0x6cb0('0x17'))(_0x6cb0('0x18'));var utils=require(_0x6cb0('0x19'));var config=require(_0x6cb0('0x1a'));var licenseUtil=require(_0x6cb0('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6cb0('0x1c'));function respondWithStatusCode(_0x3ea794,_0x3b58b8){_0x3b58b8=_0x3b58b8||0xcc;return function(_0x915a26){if(_0x915a26){return _0x3ea794[_0x6cb0('0x1d')](_0x3b58b8);}return _0x3ea794[_0x6cb0('0x1e')](_0x3b58b8)[_0x6cb0('0x1f')]();};}function respondWithResult(_0x2d5810,_0x21b6f4){_0x21b6f4=_0x21b6f4||0xc8;return function(_0x96b469){if(_0x96b469){return _0x2d5810[_0x6cb0('0x1e')](_0x21b6f4)['json'](_0x96b469);}};}function respondWithFilteredResult(_0x158764,_0x29ef6e){return function(_0x1061d8){if(_0x1061d8){var _0x561184=typeof _0x29ef6e[_0x6cb0('0x20')]===_0x6cb0('0x21')&&typeof _0x29ef6e[_0x6cb0('0x22')]===_0x6cb0('0x21');var _0x42a8ec=_0x1061d8[_0x6cb0('0x23')];var _0x4fa55f=_0x561184?0x0:_0x29ef6e[_0x6cb0('0x20')];var _0x1fef24=_0x561184?_0x1061d8[_0x6cb0('0x23')]:_0x29ef6e[_0x6cb0('0x20')]+_0x29ef6e[_0x6cb0('0x22')];var _0x349bbb;if(_0x1fef24>=_0x42a8ec){_0x1fef24=_0x42a8ec;_0x349bbb=0xc8;}else{_0x349bbb=0xce;}_0x158764[_0x6cb0('0x1e')](_0x349bbb);return _0x158764[_0x6cb0('0x24')](_0x6cb0('0x25'),_0x4fa55f+'-'+_0x1fef24+'/'+_0x42a8ec)[_0x6cb0('0x26')](_0x1061d8);}return null;};}function patchUpdates(_0x2282a7){return function(_0xbf9c47){try{jsonpatch['apply'](_0xbf9c47,_0x2282a7,!![]);}catch(_0x3afd52){return BPromise['reject'](_0x3afd52);}return _0xbf9c47[_0x6cb0('0x27')]();};}function saveUpdates(_0x2df960,_0x21bd5e){return function(_0x5aef54){if(_0x5aef54){return _0x5aef54[_0x6cb0('0x28')](_0x2df960)[_0x6cb0('0x29')](function(_0x154b26){return _0x154b26;});}return null;};}function removeEntity(_0x5d4635,_0x2c3740){return function(_0x4233de){if(_0x4233de){return _0x4233de[_0x6cb0('0x2a')]()[_0x6cb0('0x29')](function(){_0x5d4635[_0x6cb0('0x1e')](0xcc)[_0x6cb0('0x1f')]();});}};}function handleEntityNotFound(_0x24a862,_0x3e4320){return function(_0x3b5d2f){if(!_0x3b5d2f){_0x24a862[_0x6cb0('0x1d')](0x194);}return _0x3b5d2f;};}function handleError(_0x3b7943,_0x47bb14){_0x47bb14=_0x47bb14||0x1f4;return function(_0xa3a102){logger[_0x6cb0('0x2b')](_0xa3a102[_0x6cb0('0x2c')]);if(_0xa3a102[_0x6cb0('0x2d')]){delete _0xa3a102['name'];}_0x3b7943[_0x6cb0('0x1e')](_0x47bb14)[_0x6cb0('0x2e')](_0xa3a102);};}exports[_0x6cb0('0x2f')]=function(_0x1bc81c,_0x3e2bc7){var _0x1a4868={},_0x479b81={},_0x2288f9={'count':0x0,'rows':[]};var _0x536e1f=_['map'](db[_0x6cb0('0x30')][_0x6cb0('0x31')],function(_0x50ed51){return{'name':_0x50ed51[_0x6cb0('0x32')],'type':_0x50ed51[_0x6cb0('0x33')][_0x6cb0('0x34')]};});_0x479b81[_0x6cb0('0x35')]=_[_0x6cb0('0x36')](_0x536e1f,_0x6cb0('0x2d'));_0x479b81[_0x6cb0('0x37')]=_[_0x6cb0('0x38')](_0x1bc81c[_0x6cb0('0x37')]);_0x479b81[_0x6cb0('0x39')]=_[_0x6cb0('0x3a')](_0x479b81[_0x6cb0('0x35')],_0x479b81['query']);_0x1a4868['attributes']=_[_0x6cb0('0x3a')](_0x479b81[_0x6cb0('0x35')],qs['fields'](_0x1bc81c[_0x6cb0('0x37')]['fields']));_0x1a4868[_0x6cb0('0x3b')]=_0x1a4868[_0x6cb0('0x3b')]['length']?_0x1a4868[_0x6cb0('0x3b')]:_0x479b81[_0x6cb0('0x35')];if(!_0x1bc81c[_0x6cb0('0x37')][_0x6cb0('0x3c')]('nolimit')){_0x1a4868[_0x6cb0('0x22')]=qs[_0x6cb0('0x22')](_0x1bc81c['query'][_0x6cb0('0x22')]);_0x1a4868[_0x6cb0('0x20')]=qs[_0x6cb0('0x20')](_0x1bc81c[_0x6cb0('0x37')][_0x6cb0('0x20')]);}_0x1a4868['order']=qs[_0x6cb0('0x3d')](_0x1bc81c[_0x6cb0('0x37')][_0x6cb0('0x3d')]);_0x1a4868[_0x6cb0('0x3e')]=qs['filters'](_[_0x6cb0('0x3f')](_0x1bc81c[_0x6cb0('0x37')],_0x479b81[_0x6cb0('0x39')]),_0x536e1f);if(_0x1bc81c['query'][_0x6cb0('0x40')]){_0x1a4868[_0x6cb0('0x3e')]=_['merge'](_0x1a4868[_0x6cb0('0x3e')],{'$or':_['map'](_0x536e1f,function(_0x3e0a0a){if(_0x3e0a0a['type']!==_0x6cb0('0x41')){var _0xe5947c={};_0xe5947c[_0x3e0a0a['name']]={'$like':'%'+_0x1bc81c['query'][_0x6cb0('0x40')]+'%'};return _0xe5947c;}})});}_0x1a4868=_['merge']({},_0x1a4868,_0x1bc81c[_0x6cb0('0x42')]);var _0x15d593={'where':_0x1a4868[_0x6cb0('0x3e')]};return db[_0x6cb0('0x30')][_0x6cb0('0x23')](_0x15d593)[_0x6cb0('0x29')](function(_0x30a57f){_0x2288f9['count']=_0x30a57f;if(_0x1bc81c[_0x6cb0('0x37')][_0x6cb0('0x43')]){_0x1a4868[_0x6cb0('0x44')]=[{'all':!![]}];}return db[_0x6cb0('0x30')]['findAll'](_0x1a4868);})[_0x6cb0('0x29')](function(_0x86d836){_0x2288f9[_0x6cb0('0x45')]=_0x86d836;return _0x2288f9;})[_0x6cb0('0x29')](respondWithFilteredResult(_0x3e2bc7,_0x1a4868))[_0x6cb0('0x46')](handleError(_0x3e2bc7,null));};exports[_0x6cb0('0x47')]=function(_0x2916c2,_0x190522){var _0x442f4e={'raw':![],'where':{'id':_0x2916c2[_0x6cb0('0x48')]['id']}},_0x4775e0={};_0x4775e0[_0x6cb0('0x35')]=_[_0x6cb0('0x38')](db[_0x6cb0('0x30')][_0x6cb0('0x31')]);_0x4775e0[_0x6cb0('0x37')]=_[_0x6cb0('0x38')](_0x2916c2[_0x6cb0('0x37')]);_0x4775e0['filters']=_[_0x6cb0('0x3a')](_0x4775e0[_0x6cb0('0x35')],_0x4775e0['query']);_0x442f4e[_0x6cb0('0x3b')]=_[_0x6cb0('0x3a')](_0x4775e0['model'],qs['fields'](_0x2916c2[_0x6cb0('0x37')][_0x6cb0('0x49')]));_0x442f4e[_0x6cb0('0x3b')]=_0x442f4e[_0x6cb0('0x3b')][_0x6cb0('0x4a')]?_0x442f4e[_0x6cb0('0x3b')]:_0x4775e0['model'];if(_0x2916c2[_0x6cb0('0x37')]['includeAll']){_0x442f4e[_0x6cb0('0x44')]=[{'all':!![]}];}_0x442f4e=_[_0x6cb0('0x4b')]({},_0x442f4e,_0x2916c2[_0x6cb0('0x42')]);return db[_0x6cb0('0x30')]['find'](_0x442f4e)['then'](handleEntityNotFound(_0x190522,null))['then'](respondWithResult(_0x190522,null))[_0x6cb0('0x46')](handleError(_0x190522,null));};exports[_0x6cb0('0x4c')]=function(_0x57d9a6,_0x43a6b1){return db['SugarcrmAccount'][_0x6cb0('0x4c')](_0x57d9a6[_0x6cb0('0x4d')],{})[_0x6cb0('0x29')](respondWithResult(_0x43a6b1,0xc9))[_0x6cb0('0x46')](handleError(_0x43a6b1,null));};exports[_0x6cb0('0x28')]=function(_0x10c87e,_0x57dd57){if(_0x10c87e['body']['id']){delete _0x10c87e[_0x6cb0('0x4d')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x10c87e[_0x6cb0('0x48')]['id']}})[_0x6cb0('0x29')](handleEntityNotFound(_0x57dd57,null))[_0x6cb0('0x29')](saveUpdates(_0x10c87e[_0x6cb0('0x4d')],null))[_0x6cb0('0x29')](respondWithResult(_0x57dd57,null))[_0x6cb0('0x46')](handleError(_0x57dd57,null));};exports[_0x6cb0('0x2a')]=function(_0x2236ef,_0x512c6d){return db[_0x6cb0('0x30')][_0x6cb0('0x4e')]({'where':{'id':_0x2236ef[_0x6cb0('0x48')]['id']}})[_0x6cb0('0x29')](handleEntityNotFound(_0x512c6d,null))['then'](removeEntity(_0x512c6d,null))[_0x6cb0('0x46')](handleError(_0x512c6d,null));};exports[_0x6cb0('0x4f')]=function(_0x103d59,_0x2027f3,_0x3fb84a){var _0x14c14e={};var _0x43448d={};var _0x1efe2e;var _0x32ca1a;return db[_0x6cb0('0x30')][_0x6cb0('0x50')]({'where':{'id':_0x103d59[_0x6cb0('0x48')]['id']}})[_0x6cb0('0x29')](handleEntityNotFound(_0x2027f3,null))['then'](function(_0x30896a){if(_0x30896a){_0x1efe2e=_0x30896a;_0x43448d['model']=_[_0x6cb0('0x38')](db[_0x6cb0('0x51')][_0x6cb0('0x31')]);_0x43448d['query']=_[_0x6cb0('0x38')](_0x103d59['query']);_0x43448d[_0x6cb0('0x39')]=_[_0x6cb0('0x3a')](_0x43448d[_0x6cb0('0x35')],_0x43448d['query']);_0x14c14e['attributes']=_[_0x6cb0('0x3a')](_0x43448d[_0x6cb0('0x35')],qs[_0x6cb0('0x49')](_0x103d59['query'][_0x6cb0('0x49')]));_0x14c14e['attributes']=_0x14c14e[_0x6cb0('0x3b')][_0x6cb0('0x4a')]?_0x14c14e[_0x6cb0('0x3b')]:_0x43448d[_0x6cb0('0x35')];_0x14c14e[_0x6cb0('0x52')]=qs[_0x6cb0('0x3d')](_0x103d59['query'][_0x6cb0('0x3d')]);_0x14c14e[_0x6cb0('0x3e')]=qs[_0x6cb0('0x39')](_[_0x6cb0('0x3f')](_0x103d59['query'],_0x43448d[_0x6cb0('0x39')]));if(_0x103d59[_0x6cb0('0x37')][_0x6cb0('0x40')]){_0x14c14e[_0x6cb0('0x3e')]=_['merge'](_0x14c14e[_0x6cb0('0x3e')],{'$or':_['map'](_0x14c14e[_0x6cb0('0x3b')],function(_0x3e88aa){var _0x72a620={};_0x72a620[_0x3e88aa]={'$like':'%'+_0x103d59['query'][_0x6cb0('0x40')]+'%'};return _0x72a620;})});}_0x14c14e=_[_0x6cb0('0x4b')]({},_0x14c14e,_0x103d59['options']);return _0x1efe2e[_0x6cb0('0x4f')](_0x14c14e);}})['then'](function(_0x4ee988){if(_0x4ee988){_0x32ca1a=_0x4ee988[_0x6cb0('0x4a')];if(!_0x103d59['query'][_0x6cb0('0x3c')](_0x6cb0('0x53'))){_0x14c14e['limit']=qs[_0x6cb0('0x22')](_0x103d59[_0x6cb0('0x37')]['limit']);_0x14c14e[_0x6cb0('0x20')]=qs['offset'](_0x103d59[_0x6cb0('0x37')][_0x6cb0('0x20')]);}return _0x1efe2e['getConfigurations'](_0x14c14e);}})[_0x6cb0('0x29')](function(_0x2c9c0c){if(_0x2c9c0c){return _0x2c9c0c?{'count':_0x32ca1a,'rows':_0x2c9c0c}:null;}})[_0x6cb0('0x29')](respondWithResult(_0x2027f3,null))[_0x6cb0('0x46')](handleError(_0x2027f3,null));};exports['addConfiguration']=function(_0x4ebed4,_0x3435f7,_0x371911){if(_0x4ebed4[_0x6cb0('0x4d')]['id']){delete _0x4ebed4[_0x6cb0('0x4d')]['id'];}return db[_0x6cb0('0x30')][_0x6cb0('0x50')]({'where':{'id':_0x4ebed4[_0x6cb0('0x48')]['id']}})['then'](handleEntityNotFound(_0x3435f7,null))[_0x6cb0('0x29')](function(_0x1370dc){if(_0x1370dc){_0x4ebed4[_0x6cb0('0x4d')]['AccountId']=_0x1370dc['id'];_0x4ebed4[_0x6cb0('0x4d')]['Subjects']=integrations['getSubjects'](_0x4ebed4[_0x6cb0('0x4d')]['channel'],_0x4ebed4[_0x6cb0('0x4d')]['type']);_0x4ebed4[_0x6cb0('0x4d')][_0x6cb0('0x54')]=integrations[_0x6cb0('0x55')](_0x4ebed4[_0x6cb0('0x4d')][_0x6cb0('0x56')],_0x4ebed4[_0x6cb0('0x4d')][_0x6cb0('0x33')]);return db[_0x6cb0('0x51')]['create'](_0x4ebed4['body'],{'include':[{'model':db[_0x6cb0('0x57')],'as':_0x6cb0('0x58')},{'model':db[_0x6cb0('0x57')],'as':_0x6cb0('0x54')}]});}return null;})['then'](respondWithResult(_0x3435f7,null))[_0x6cb0('0x46')](handleError(_0x3435f7,null));};exports[_0x6cb0('0x59')]=function(_0x26b9e1,_0x27e37f,_0x321c8d){var _0x49a137='';var _0xfc80bb=['id',_0x6cb0('0x2d'),_0x6cb0('0x5a'),_0x6cb0('0x5b'),_0x6cb0('0x5c'),_0x6cb0('0x5d'),_0x6cb0('0x5e'),_0x6cb0('0x5f'),_0x6cb0('0x60'),_0x6cb0('0x61'),_0x6cb0('0x62'),_0x6cb0('0x63')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x26b9e1[_0x6cb0('0x48')]['id']},'attributes':['id',_0x6cb0('0x64'),_0x6cb0('0x65'),'remoteUri']})[_0x6cb0('0x29')](handleEntityNotFound(_0x27e37f,null))[_0x6cb0('0x29')](function(_0x290beb){if(_0x290beb){_0x49a137=_0x290beb[_0x6cb0('0x66')];var _0x347ffe=_0x49a137[_0x6cb0('0x67')](-0x1);if(_0x347ffe==='/'){_0x49a137=_0x49a137[_0x6cb0('0x68')](0x0,_0x49a137[_0x6cb0('0x69')](_0x347ffe));}return rp({'method':_0x6cb0('0x6a'),'uri':util[_0x6cb0('0x6b')]('%s%s',_0x49a137,_0x6cb0('0x6c')),'json':!![],'form':{'method':_0x6cb0('0x6d'),'input_type':_0x6cb0('0x6e'),'response_type':_0x6cb0('0x6e'),'rest_data':JSON[_0x6cb0('0x6f')]({'user_auth':{'user_name':_0x290beb[_0x6cb0('0x64')],'password':_0x290beb[_0x6cb0('0x65')],'encryption':_0x6cb0('0x70')},'application':_0x6cb0('0x71')})}});}})[_0x6cb0('0x29')](function(_0x49c876){if(_0x49c876&&_0x49c876['name']!=='Invalid\x20Login'&&_0x49c876[_0x6cb0('0x2d')]!==_0x6cb0('0x72')){return rp({'method':'POST','uri':util[_0x6cb0('0x6b')]('%s%s',_0x49a137,_0x6cb0('0x6c')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6cb0('0x6e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x49c876['id'],'module_name':'Calls'})}})[_0x6cb0('0x29')](function(_0x538776){if(_0x538776){var _0x5cbee5=_[_0x6cb0('0x73')](_0x538776[_0x6cb0('0x74')]);_[_0x6cb0('0x75')](_0x5cbee5,function(_0x85649c){return _0xfc80bb[_0x6cb0('0x76')](_0x85649c[_0x6cb0('0x2d')]);});return{'count':_0x5cbee5[_0x6cb0('0x4a')],'rows':_[_0x6cb0('0x36')](_0x5cbee5,function(_0x3a6dfb){return{'id':_0x3a6dfb['name'],'name':_0x3a6dfb[_0x6cb0('0x77')],'custom':_[_0x6cb0('0x78')](_0x3a6dfb['name'],'_c')?!![]:![],'options':_0x3a6dfb[_0x6cb0('0x42')]?_['map'](_[_0x6cb0('0x73')](_0x3a6dfb[_0x6cb0('0x42')]),function(_0x3c09f3){return{'name':_0x3c09f3[_0x6cb0('0x79')],'value':_0x3c09f3[_0x6cb0('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x27e37f,null))['catch'](function(_0x98f8b7){var _0x15671b=_0x26b9e1[_0x6cb0('0x37')][_0x6cb0('0x7a')]?0x1f4:_0x98f8b7[_0x6cb0('0x7b')]||0x1f4;logger['error'](_0x6cb0('0x7c'),_0x6cb0('0x59'),_0x15671b,JSON[_0x6cb0('0x6f')](_0x98f8b7));delete _0x98f8b7[_0x6cb0('0x2d')];if(_0x15671b===0x191){_0x15671b=0x190;}_0x27e37f[_0x6cb0('0x1e')](_0x15671b)['send'](_0x26b9e1[_0x6cb0('0x37')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x98f8b7[_0x6cb0('0x7b')]}:_0x98f8b7);});}else{var _0x1752cb=0x1f4;_0x27e37f['status'](_0x1752cb)['send']({'message':_0x6cb0('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0bcc=['where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','order','sort','pick','filter'];(function(_0x39ef8b,_0x4c6223){var _0x535ec1=function(_0x3b1f09){while(--_0x3b1f09){_0x39ef8b['push'](_0x39ef8b['shift']());}};_0x535ec1(++_0x4c6223);}(_0x0bcc,0x128));var _0xc0bc=function(_0x4b0ec6,_0x20ca44){_0x4b0ec6=_0x4b0ec6-0x0;var _0x40044a=_0x0bcc[_0x4b0ec6];return _0x40044a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0bc('0x0'));var zipdir=require(_0xc0bc('0x1'));var jsonpatch=require(_0xc0bc('0x2'));var rp=require('request-promise');var moment=require(_0xc0bc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0bc('0x4'));var util=require('util');var path=require(_0xc0bc('0x5'));var sox=require(_0xc0bc('0x6'));var csv=require('to-csv');var ejs=require(_0xc0bc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc0bc('0x8'));var squel=require(_0xc0bc('0x9'));var crypto=require('crypto');var jsforce=require(_0xc0bc('0xa'));var deskjs=require(_0xc0bc('0xb'));var toCsv=require(_0xc0bc('0xc'));var querystring=require('querystring');var Papa=require(_0xc0bc('0xd'));var Redis=require(_0xc0bc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc0bc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0bc('0x10'));var logger=require('../../config/logger')(_0xc0bc('0x11'));var utils=require('../../config/utils');var config=require(_0xc0bc('0x12'));var licenseUtil=require(_0xc0bc('0x13'));var db=require(_0xc0bc('0x14'))['db'];var integrations=require(_0xc0bc('0x15'));function respondWithStatusCode(_0x2582e5,_0x3a55ec){_0x3a55ec=_0x3a55ec||0xcc;return function(_0x3acf6c){if(_0x3acf6c){return _0x2582e5[_0xc0bc('0x16')](_0x3a55ec);}return _0x2582e5[_0xc0bc('0x17')](_0x3a55ec)[_0xc0bc('0x18')]();};}function respondWithResult(_0x40f40f,_0x364643){_0x364643=_0x364643||0xc8;return function(_0x9f580a){if(_0x9f580a){return _0x40f40f[_0xc0bc('0x17')](_0x364643)[_0xc0bc('0x19')](_0x9f580a);}};}function respondWithFilteredResult(_0xce4c94,_0x1c83d7){return function(_0x499f64){if(_0x499f64){var _0x20a25f=typeof _0x1c83d7[_0xc0bc('0x1a')]===_0xc0bc('0x1b')&&typeof _0x1c83d7[_0xc0bc('0x1c')]===_0xc0bc('0x1b');var _0x4a816e=_0x499f64['count'];var _0x6adf03=_0x20a25f?0x0:_0x1c83d7[_0xc0bc('0x1a')];var _0x1d1429=_0x20a25f?_0x499f64[_0xc0bc('0x1d')]:_0x1c83d7['offset']+_0x1c83d7[_0xc0bc('0x1c')];var _0x2f6353;if(_0x1d1429>=_0x4a816e){_0x1d1429=_0x4a816e;_0x2f6353=0xc8;}else{_0x2f6353=0xce;}_0xce4c94[_0xc0bc('0x17')](_0x2f6353);return _0xce4c94['set'](_0xc0bc('0x1e'),_0x6adf03+'-'+_0x1d1429+'/'+_0x4a816e)['json'](_0x499f64);}return null;};}function patchUpdates(_0x43cef8){return function(_0x28bee1){try{jsonpatch['apply'](_0x28bee1,_0x43cef8,!![]);}catch(_0x5b5612){return BPromise['reject'](_0x5b5612);}return _0x28bee1[_0xc0bc('0x1f')]();};}function saveUpdates(_0x5853ef,_0x4c82db){return function(_0x5c0e46){if(_0x5c0e46){return _0x5c0e46[_0xc0bc('0x20')](_0x5853ef)[_0xc0bc('0x21')](function(_0x517470){return _0x517470;});}return null;};}function removeEntity(_0x279885,_0x3cc6da){return function(_0x56f2e3){if(_0x56f2e3){return _0x56f2e3[_0xc0bc('0x22')]()[_0xc0bc('0x21')](function(){_0x279885[_0xc0bc('0x17')](0xcc)[_0xc0bc('0x18')]();});}};}function handleEntityNotFound(_0x55b4f7,_0x381dfd){return function(_0x282d04){if(!_0x282d04){_0x55b4f7['sendStatus'](0x194);}return _0x282d04;};}function handleError(_0x37d632,_0x29c2c9){_0x29c2c9=_0x29c2c9||0x1f4;return function(_0x30621b){logger['error'](_0x30621b[_0xc0bc('0x23')]);if(_0x30621b['name']){delete _0x30621b[_0xc0bc('0x24')];}_0x37d632[_0xc0bc('0x17')](_0x29c2c9)[_0xc0bc('0x25')](_0x30621b);};}exports[_0xc0bc('0x26')]=function(_0x1bfbf1,_0x83b1a9){var _0x5d6aa6={},_0x700c3={},_0x4f5531={'count':0x0,'rows':[]};var _0x3caa1c=_[_0xc0bc('0x27')](db[_0xc0bc('0x28')]['rawAttributes'],function(_0x52f1f5){return{'name':_0x52f1f5[_0xc0bc('0x29')],'type':_0x52f1f5[_0xc0bc('0x2a')]['key']};});_0x700c3['model']=_[_0xc0bc('0x27')](_0x3caa1c,_0xc0bc('0x24'));_0x700c3[_0xc0bc('0x2b')]=_[_0xc0bc('0x2c')](_0x1bfbf1['query']);_0x700c3[_0xc0bc('0x2d')]=_[_0xc0bc('0x2e')](_0x700c3['model'],_0x700c3[_0xc0bc('0x2b')]);_0x5d6aa6[_0xc0bc('0x2f')]=_[_0xc0bc('0x2e')](_0x700c3[_0xc0bc('0x30')],qs[_0xc0bc('0x31')](_0x1bfbf1['query'][_0xc0bc('0x31')]));_0x5d6aa6[_0xc0bc('0x2f')]=_0x5d6aa6[_0xc0bc('0x2f')][_0xc0bc('0x32')]?_0x5d6aa6[_0xc0bc('0x2f')]:_0x700c3['model'];if(!_0x1bfbf1[_0xc0bc('0x2b')]['hasOwnProperty']('nolimit')){_0x5d6aa6[_0xc0bc('0x1c')]=qs[_0xc0bc('0x1c')](_0x1bfbf1[_0xc0bc('0x2b')]['limit']);_0x5d6aa6['offset']=qs['offset'](_0x1bfbf1[_0xc0bc('0x2b')][_0xc0bc('0x1a')]);}_0x5d6aa6[_0xc0bc('0x33')]=qs[_0xc0bc('0x34')](_0x1bfbf1[_0xc0bc('0x2b')]['sort']);_0x5d6aa6['where']=qs[_0xc0bc('0x2d')](_[_0xc0bc('0x35')](_0x1bfbf1['query'],_0x700c3[_0xc0bc('0x2d')]),_0x3caa1c);if(_0x1bfbf1[_0xc0bc('0x2b')][_0xc0bc('0x36')]){_0x5d6aa6[_0xc0bc('0x37')]=_['merge'](_0x5d6aa6[_0xc0bc('0x37')],{'$or':_[_0xc0bc('0x27')](_0x3caa1c,function(_0x5c5561){if(_0x5c5561[_0xc0bc('0x2a')]!==_0xc0bc('0x38')){var _0x641499={};_0x641499[_0x5c5561[_0xc0bc('0x24')]]={'$like':'%'+_0x1bfbf1[_0xc0bc('0x2b')]['filter']+'%'};return _0x641499;}})});}_0x5d6aa6=_[_0xc0bc('0x39')]({},_0x5d6aa6,_0x1bfbf1[_0xc0bc('0x3a')]);var _0x1aabec={'where':_0x5d6aa6[_0xc0bc('0x37')]};return db['SugarcrmAccount'][_0xc0bc('0x1d')](_0x1aabec)['then'](function(_0x1d0741){_0x4f5531[_0xc0bc('0x1d')]=_0x1d0741;if(_0x1bfbf1[_0xc0bc('0x2b')][_0xc0bc('0x3b')]){_0x5d6aa6[_0xc0bc('0x3c')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc0bc('0x3d')](_0x5d6aa6);})[_0xc0bc('0x21')](function(_0xc3415d){_0x4f5531['rows']=_0xc3415d;return _0x4f5531;})[_0xc0bc('0x21')](respondWithFilteredResult(_0x83b1a9,_0x5d6aa6))[_0xc0bc('0x3e')](handleError(_0x83b1a9,null));};exports[_0xc0bc('0x3f')]=function(_0x1a8fb2,_0x5a39ba){var _0x2e698b={'raw':![],'where':{'id':_0x1a8fb2[_0xc0bc('0x40')]['id']}},_0x10d04d={};_0x10d04d[_0xc0bc('0x30')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x10d04d['query']=_['keys'](_0x1a8fb2[_0xc0bc('0x2b')]);_0x10d04d[_0xc0bc('0x2d')]=_[_0xc0bc('0x2e')](_0x10d04d['model'],_0x10d04d[_0xc0bc('0x2b')]);_0x2e698b['attributes']=_[_0xc0bc('0x2e')](_0x10d04d[_0xc0bc('0x30')],qs[_0xc0bc('0x31')](_0x1a8fb2[_0xc0bc('0x2b')][_0xc0bc('0x31')]));_0x2e698b[_0xc0bc('0x2f')]=_0x2e698b[_0xc0bc('0x2f')][_0xc0bc('0x32')]?_0x2e698b[_0xc0bc('0x2f')]:_0x10d04d[_0xc0bc('0x30')];if(_0x1a8fb2['query']['includeAll']){_0x2e698b['include']=[{'all':!![]}];}_0x2e698b=_['merge']({},_0x2e698b,_0x1a8fb2[_0xc0bc('0x3a')]);return db[_0xc0bc('0x28')]['find'](_0x2e698b)[_0xc0bc('0x21')](handleEntityNotFound(_0x5a39ba,null))[_0xc0bc('0x21')](respondWithResult(_0x5a39ba,null))[_0xc0bc('0x3e')](handleError(_0x5a39ba,null));};exports[_0xc0bc('0x41')]=function(_0x477d2f,_0x5a392f){return db[_0xc0bc('0x28')][_0xc0bc('0x41')](_0x477d2f[_0xc0bc('0x42')],{})[_0xc0bc('0x21')](respondWithResult(_0x5a392f,0xc9))[_0xc0bc('0x3e')](handleError(_0x5a392f,null));};exports[_0xc0bc('0x20')]=function(_0x2e0e48,_0x29e9dc){if(_0x2e0e48[_0xc0bc('0x42')]['id']){delete _0x2e0e48[_0xc0bc('0x42')]['id'];}return db['SugarcrmAccount'][_0xc0bc('0x43')]({'where':{'id':_0x2e0e48[_0xc0bc('0x40')]['id']}})[_0xc0bc('0x21')](handleEntityNotFound(_0x29e9dc,null))[_0xc0bc('0x21')](saveUpdates(_0x2e0e48['body'],null))['then'](respondWithResult(_0x29e9dc,null))['catch'](handleError(_0x29e9dc,null));};exports[_0xc0bc('0x22')]=function(_0x25d9e8,_0x429130){return db[_0xc0bc('0x28')][_0xc0bc('0x43')]({'where':{'id':_0x25d9e8['params']['id']}})['then'](handleEntityNotFound(_0x429130,null))['then'](removeEntity(_0x429130,null))[_0xc0bc('0x3e')](handleError(_0x429130,null));};exports[_0xc0bc('0x44')]=function(_0x10d4d3,_0x39e669,_0x48eb25){var _0x27baee={};var _0x5af96e={};var _0x45c04e;var _0x115985;return db[_0xc0bc('0x28')][_0xc0bc('0x45')]({'where':{'id':_0x10d4d3[_0xc0bc('0x40')]['id']}})[_0xc0bc('0x21')](handleEntityNotFound(_0x39e669,null))[_0xc0bc('0x21')](function(_0x17b849){if(_0x17b849){_0x45c04e=_0x17b849;_0x5af96e[_0xc0bc('0x30')]=_[_0xc0bc('0x2c')](db[_0xc0bc('0x46')]['rawAttributes']);_0x5af96e[_0xc0bc('0x2b')]=_[_0xc0bc('0x2c')](_0x10d4d3[_0xc0bc('0x2b')]);_0x5af96e['filters']=_[_0xc0bc('0x2e')](_0x5af96e[_0xc0bc('0x30')],_0x5af96e[_0xc0bc('0x2b')]);_0x27baee['attributes']=_[_0xc0bc('0x2e')](_0x5af96e[_0xc0bc('0x30')],qs[_0xc0bc('0x31')](_0x10d4d3['query'][_0xc0bc('0x31')]));_0x27baee[_0xc0bc('0x2f')]=_0x27baee[_0xc0bc('0x2f')][_0xc0bc('0x32')]?_0x27baee['attributes']:_0x5af96e['model'];_0x27baee[_0xc0bc('0x33')]=qs['sort'](_0x10d4d3['query'][_0xc0bc('0x34')]);_0x27baee['where']=qs[_0xc0bc('0x2d')](_[_0xc0bc('0x35')](_0x10d4d3['query'],_0x5af96e[_0xc0bc('0x2d')]));if(_0x10d4d3[_0xc0bc('0x2b')][_0xc0bc('0x36')]){_0x27baee[_0xc0bc('0x37')]=_['merge'](_0x27baee[_0xc0bc('0x37')],{'$or':_['map'](_0x27baee[_0xc0bc('0x2f')],function(_0x4d9d01){var _0xe86e2b={};_0xe86e2b[_0x4d9d01]={'$like':'%'+_0x10d4d3[_0xc0bc('0x2b')][_0xc0bc('0x36')]+'%'};return _0xe86e2b;})});}_0x27baee=_[_0xc0bc('0x39')]({},_0x27baee,_0x10d4d3[_0xc0bc('0x3a')]);return _0x45c04e[_0xc0bc('0x44')](_0x27baee);}})[_0xc0bc('0x21')](function(_0x15f3cc){if(_0x15f3cc){_0x115985=_0x15f3cc[_0xc0bc('0x32')];if(!_0x10d4d3['query']['hasOwnProperty'](_0xc0bc('0x47'))){_0x27baee['limit']=qs[_0xc0bc('0x1c')](_0x10d4d3['query'][_0xc0bc('0x1c')]);_0x27baee['offset']=qs[_0xc0bc('0x1a')](_0x10d4d3[_0xc0bc('0x2b')][_0xc0bc('0x1a')]);}return _0x45c04e[_0xc0bc('0x44')](_0x27baee);}})[_0xc0bc('0x21')](function(_0x41688d){if(_0x41688d){return _0x41688d?{'count':_0x115985,'rows':_0x41688d}:null;}})[_0xc0bc('0x21')](respondWithResult(_0x39e669,null))['catch'](handleError(_0x39e669,null));};exports[_0xc0bc('0x48')]=function(_0x3f3ae3,_0x617b89,_0x4043e3){if(_0x3f3ae3[_0xc0bc('0x42')]['id']){delete _0x3f3ae3[_0xc0bc('0x42')]['id'];}return db[_0xc0bc('0x28')][_0xc0bc('0x45')]({'where':{'id':_0x3f3ae3[_0xc0bc('0x40')]['id']}})['then'](handleEntityNotFound(_0x617b89,null))[_0xc0bc('0x21')](function(_0x3f1010){if(_0x3f1010){_0x3f3ae3[_0xc0bc('0x42')][_0xc0bc('0x49')]=_0x3f1010['id'];_0x3f3ae3[_0xc0bc('0x42')][_0xc0bc('0x4a')]=integrations[_0xc0bc('0x4b')](_0x3f3ae3[_0xc0bc('0x42')][_0xc0bc('0x4c')],_0x3f3ae3['body'][_0xc0bc('0x2a')]);_0x3f3ae3[_0xc0bc('0x42')]['Descriptions']=integrations['getDescriptions'](_0x3f3ae3['body']['channel'],_0x3f3ae3['body'][_0xc0bc('0x2a')]);return db['SugarcrmConfiguration'][_0xc0bc('0x41')](_0x3f3ae3['body'],{'include':[{'model':db[_0xc0bc('0x4d')],'as':_0xc0bc('0x4a')},{'model':db[_0xc0bc('0x4d')],'as':_0xc0bc('0x4e')}]});}return null;})['then'](respondWithResult(_0x617b89,null))['catch'](handleError(_0x617b89,null));};exports[_0xc0bc('0x4f')]=function(_0x5ed40a,_0x1f1713,_0x14e9ce){var _0x1f3e29='';var _0x175b0b=['id',_0xc0bc('0x24'),_0xc0bc('0x50'),_0xc0bc('0x51'),_0xc0bc('0x52'),_0xc0bc('0x53'),_0xc0bc('0x54'),'duration_minutes',_0xc0bc('0x55'),_0xc0bc('0x56'),_0xc0bc('0x57'),'direction'];return db[_0xc0bc('0x28')][_0xc0bc('0x45')]({'where':{'id':_0x5ed40a['params']['id']},'attributes':['id',_0xc0bc('0x58'),_0xc0bc('0x59'),'remoteUri']})[_0xc0bc('0x21')](handleEntityNotFound(_0x1f1713,null))[_0xc0bc('0x21')](function(_0x58d5d4){if(_0x58d5d4){_0x1f3e29=_0x58d5d4[_0xc0bc('0x5a')];var _0x35d750=_0x1f3e29[_0xc0bc('0x5b')](-0x1);if(_0x35d750==='/'){_0x1f3e29=_0x1f3e29[_0xc0bc('0x5c')](0x0,_0x1f3e29[_0xc0bc('0x5d')](_0x35d750));}return rp({'method':_0xc0bc('0x5e'),'uri':util[_0xc0bc('0x5f')](_0xc0bc('0x60'),_0x1f3e29,_0xc0bc('0x61')),'json':!![],'form':{'method':_0xc0bc('0x62'),'input_type':'JSON','response_type':_0xc0bc('0x63'),'rest_data':JSON[_0xc0bc('0x64')]({'user_auth':{'user_name':_0x58d5d4[_0xc0bc('0x58')],'password':_0x58d5d4[_0xc0bc('0x59')],'encryption':_0xc0bc('0x65')},'application':_0xc0bc('0x66')})}});}})[_0xc0bc('0x21')](function(_0x2bee43){if(_0x2bee43&&_0x2bee43[_0xc0bc('0x24')]!==_0xc0bc('0x67')&&_0x2bee43[_0xc0bc('0x24')]!==_0xc0bc('0x68')){return rp({'method':'POST','uri':util[_0xc0bc('0x5f')](_0xc0bc('0x60'),_0x1f3e29,_0xc0bc('0x61')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xc0bc('0x63'),'rest_data':JSON[_0xc0bc('0x64')]({'session':_0x2bee43['id'],'module_name':_0xc0bc('0x69')})}})[_0xc0bc('0x21')](function(_0x2ca74d){if(_0x2ca74d){var _0x5104e8=_[_0xc0bc('0x6a')](_0x2ca74d[_0xc0bc('0x6b')]);_[_0xc0bc('0x6c')](_0x5104e8,function(_0x48a35c){return _0x175b0b[_0xc0bc('0x6d')](_0x48a35c[_0xc0bc('0x24')]);});return{'count':_0x5104e8[_0xc0bc('0x32')],'rows':_[_0xc0bc('0x27')](_0x5104e8,function(_0xe94e26){return{'id':_0xe94e26[_0xc0bc('0x24')],'name':_0xe94e26[_0xc0bc('0x6e')],'custom':_[_0xc0bc('0x6f')](_0xe94e26[_0xc0bc('0x24')],'_c')?!![]:![],'options':_0xe94e26[_0xc0bc('0x3a')]?_[_0xc0bc('0x27')](_['values'](_0xe94e26['options']),function(_0x20d702){return{'name':_0x20d702[_0xc0bc('0x70')],'value':_0x20d702[_0xc0bc('0x24')]};}):[]};})};}})[_0xc0bc('0x21')](respondWithResult(_0x1f1713,null))['catch'](function(_0x54dfeb){var _0x147c7e=_0x5ed40a[_0xc0bc('0x2b')][_0xc0bc('0x71')]?0x1f4:_0x54dfeb[_0xc0bc('0x72')]||0x1f4;logger['error'](_0xc0bc('0x73'),'getFields',_0x147c7e,JSON[_0xc0bc('0x64')](_0x54dfeb));delete _0x54dfeb[_0xc0bc('0x24')];if(_0x147c7e===0x191){_0x147c7e=0x190;}_0x1f1713[_0xc0bc('0x17')](_0x147c7e)[_0xc0bc('0x25')](_0x5ed40a[_0xc0bc('0x2b')][_0xc0bc('0x71')]?{'message':_0xc0bc('0x74'),'statusCode':_0x54dfeb[_0xc0bc('0x72')]}:_0x54dfeb);});}else{var _0x1954d3=0x1f4;_0x1f1713[_0xc0bc('0x17')](_0x1954d3)['send']({'message':_0xc0bc('0x74'),'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 ded34d8..181a4b1 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 _0x68db=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x3a4b2a,_0x1d17d2){var _0xe2640e=function(_0x58f4d2){while(--_0x58f4d2){_0x3a4b2a['push'](_0x3a4b2a['shift']());}};_0xe2640e(++_0x1d17d2);}(_0x68db,0x166));var _0xb68d=function(_0x1d49c6,_0x36c18e){_0x1d49c6=_0x1d49c6-0x0;var _0x55bceb=_0x68db[_0x1d49c6];return _0x55bceb;};'use strict';var _=require(_0xb68d('0x0'));var util=require(_0xb68d('0x1'));var logger=require(_0xb68d('0x2'))(_0xb68d('0x3'));var moment=require(_0xb68d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb68d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb68d('0x6'));var config=require(_0xb68d('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xb68d('0x8'));module[_0xb68d('0x9')]=function(_0x48d019,_0xdfc118){return _0x48d019['define'](_0xb68d('0xa'),attributes,{'tableName':_0xb68d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff69=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x532dd2,_0x34ebd8){var _0x570994=function(_0x367fdf){while(--_0x367fdf){_0x532dd2['push'](_0x532dd2['shift']());}};_0x570994(++_0x34ebd8);}(_0xff69,0x119));var _0x9ff6=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0xff69[_0x28258a];return _0x4e968e;};'use strict';var _=require(_0x9ff6('0x0'));var util=require(_0x9ff6('0x1'));var logger=require('../../config/logger')(_0x9ff6('0x2'));var moment=require(_0x9ff6('0x3'));var BPromise=require(_0x9ff6('0x4'));var rp=require(_0x9ff6('0x5'));var fs=require('fs');var path=require(_0x9ff6('0x6'));var rimraf=require('rimraf');var config=require(_0x9ff6('0x7'));var attributes=require(_0x9ff6('0x8'));var integrations=require(_0x9ff6('0x9'));module['exports']=function(_0x11e00d,_0x45f400){return _0x11e00d['define'](_0x9ff6('0xa'),attributes,{'tableName':_0x9ff6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 83917ec..5c2a0be 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 _0x314d=['find','stringify','lodash','util','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','include','map','model','ShowSugarcrmAccount'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x314d,0x14c));var _0xd314=function(_0x160034,_0x38c68d){_0x160034=_0x160034-0x0;var _0x1783a1=_0x314d[_0x160034];return _0x1783a1;};'use strict';var _=require(_0xd314('0x0'));var util=require(_0xd314('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd314('0x2'));var logger=require('../../config/logger')(_0xd314('0x3'));var config=require(_0xd314('0x4'));var jayson=require(_0xd314('0x5'));var client=jayson[_0xd314('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c8cf,_0x567e69,_0xa2f19c){return new BPromise(function(_0x35b910,_0x40ef92){return client[_0xd314('0x7')](_0x37c8cf,_0xa2f19c)[_0xd314('0x8')](function(_0x4cfda3){logger[_0xd314('0x9')](_0xd314('0xa'),_0x567e69,_0xd314('0xb'));logger[_0xd314('0xc')](_0xd314('0xd'),_0x567e69,_0xd314('0xb'),JSON['stringify'](_0x4cfda3));if(_0x4cfda3[_0xd314('0xe')]){if(_0x4cfda3['error'][_0xd314('0xf')]===0x1f4){logger[_0xd314('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x567e69,_0x4cfda3[_0xd314('0xe')]['message']);return _0x40ef92(_0x4cfda3[_0xd314('0xe')][_0xd314('0x10')]);}logger['error'](_0xd314('0xa'),_0x567e69,_0x4cfda3[_0xd314('0xe')][_0xd314('0x10')]);return _0x35b910(_0x4cfda3[_0xd314('0xe')][_0xd314('0x10')]);}else{logger[_0xd314('0x9')](_0xd314('0xa'),_0x567e69,'request\x20sent');_0x35b910(_0x4cfda3[_0xd314('0x11')]['message']);}})[_0xd314('0x12')](function(_0x29bb9b){logger[_0xd314('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x567e69,_0x29bb9b);_0x40ef92(_0x29bb9b);});});}exports[_0xd314('0x13')]=function(_0x169a6a){var _0x460977=this;return new Promise(function(_0x22da52,_0x547fe6){return db[_0xd314('0x14')]['findAll']({'raw':_0x169a6a[_0xd314('0x15')]?_0x169a6a[_0xd314('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x169a6a['options']?_0x169a6a[_0xd314('0x15')][_0xd314('0x16')]||null:null,'attributes':_0x169a6a[_0xd314('0x15')]?_0x169a6a[_0xd314('0x15')][_0xd314('0x17')]||null:null,'limit':_0x169a6a['options']?_0x169a6a[_0xd314('0x15')]['limit']||null:null,'include':_0x169a6a[_0xd314('0x15')]?_0x169a6a[_0xd314('0x15')][_0xd314('0x18')]?_[_0xd314('0x19')](_0x169a6a[_0xd314('0x15')][_0xd314('0x18')],function(_0x11e69a){return{'model':db[_0x11e69a[_0xd314('0x1a')]],'as':_0x11e69a['as'],'attributes':_0x11e69a[_0xd314('0x17')],'include':_0x11e69a['include']?_[_0xd314('0x19')](_0x11e69a['include'],function(_0x302312){return{'model':db[_0x302312[_0xd314('0x1a')]],'as':_0x302312['as'],'attributes':_0x302312[_0xd314('0x17')],'include':_0x302312[_0xd314('0x18')]?_[_0xd314('0x19')](_0x302312[_0xd314('0x18')],function(_0x1d6483){return{'model':db[_0x1d6483[_0xd314('0x1a')]],'as':_0x1d6483['as'],'attributes':_0x1d6483[_0xd314('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd314('0x8')](function(_0x27e2f4){logger[_0xd314('0x9')](_0xd314('0x13'),_0x169a6a);logger[_0xd314('0xc')](_0xd314('0x13'),_0x169a6a,JSON['stringify'](_0x27e2f4));_0x22da52(_0x27e2f4);})[_0xd314('0x12')](function(_0x25c63f){logger[_0xd314('0xe')](_0xd314('0x13'),_0x25c63f[_0xd314('0x10')],_0x169a6a);_0x547fe6(_0x460977[_0xd314('0xe')](0x1f4,_0x25c63f[_0xd314('0x10')]));});});};exports[_0xd314('0x1b')]=function(_0x223866){var _0x565fde=this;return new Promise(function(_0x26e11c,_0x4b05da){return db['SugarcrmAccount'][_0xd314('0x1c')]({'raw':_0x223866[_0xd314('0x15')]?_0x223866['options']['raw']===undefined?!![]:![]:!![],'where':_0x223866[_0xd314('0x15')]?_0x223866['options'][_0xd314('0x16')]||null:null,'attributes':_0x223866[_0xd314('0x15')]?_0x223866[_0xd314('0x15')][_0xd314('0x17')]||null:null,'include':_0x223866['options']?_0x223866[_0xd314('0x15')][_0xd314('0x18')]?_[_0xd314('0x19')](_0x223866['options'][_0xd314('0x18')],function(_0x585968){return{'model':db[_0x585968['model']],'as':_0x585968['as'],'attributes':_0x585968[_0xd314('0x17')],'include':_0x585968[_0xd314('0x18')]?_[_0xd314('0x19')](_0x585968['include'],function(_0x2ea540){return{'model':db[_0x2ea540['model']],'as':_0x2ea540['as'],'attributes':_0x2ea540[_0xd314('0x17')],'include':_0x2ea540[_0xd314('0x18')]?_[_0xd314('0x19')](_0x2ea540[_0xd314('0x18')],function(_0x3197cb){return{'model':db[_0x3197cb[_0xd314('0x1a')]],'as':_0x3197cb['as'],'attributes':_0x3197cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd314('0x8')](function(_0x59c797){logger[_0xd314('0x9')]('ShowSugarcrmAccount',_0x223866);logger['debug'](_0xd314('0x1b'),_0x223866,JSON[_0xd314('0x1d')](_0x59c797));_0x26e11c(_0x59c797);})[_0xd314('0x12')](function(_0x266024){logger['error']('ShowSugarcrmAccount',_0x266024[_0xd314('0x10')],_0x223866);_0x4b05da(_0x565fde[_0xd314('0xe')](0x1f4,_0x266024[_0xd314('0x10')]));});});}; \ No newline at end of file +var _0xcbdd=['catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowSugarcrmAccount','find','lodash','util','moment','ioredis','../../config/utils','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2e8a44,_0x324aa5){var _0x45c32c=function(_0x40578e){while(--_0x40578e){_0x2e8a44['push'](_0x2e8a44['shift']());}};_0x45c32c(++_0x324aa5);}(_0xcbdd,0x18f));var _0xdcbd=function(_0x4478f3,_0x439da5){_0x4478f3=_0x4478f3-0x0;var _0x4197ce=_0xcbdd[_0x4478f3];return _0x4197ce;};'use strict';var _=require(_0xdcbd('0x0'));var util=require(_0xdcbd('0x1'));var moment=require(_0xdcbd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcbd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcbd('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdcbd('0x5'));var client=jayson[_0xdcbd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195794,_0xea46ee,_0x2f53e9){return new BPromise(function(_0x220b53,_0xc9f7d6){return client[_0xdcbd('0x7')](_0x195794,_0x2f53e9)[_0xdcbd('0x8')](function(_0x2a66d2){logger[_0xdcbd('0x9')](_0xdcbd('0xa'),_0xea46ee,_0xdcbd('0xb'));logger['debug'](_0xdcbd('0xc'),_0xea46ee,_0xdcbd('0xb'),JSON['stringify'](_0x2a66d2));if(_0x2a66d2['error']){if(_0x2a66d2[_0xdcbd('0xd')][_0xdcbd('0xe')]===0x1f4){logger[_0xdcbd('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0xea46ee,_0x2a66d2[_0xdcbd('0xd')][_0xdcbd('0xf')]);return _0xc9f7d6(_0x2a66d2[_0xdcbd('0xd')][_0xdcbd('0xf')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xea46ee,_0x2a66d2[_0xdcbd('0xd')][_0xdcbd('0xf')]);return _0x220b53(_0x2a66d2['error']['message']);}else{logger[_0xdcbd('0x9')](_0xdcbd('0xa'),_0xea46ee,_0xdcbd('0xb'));_0x220b53(_0x2a66d2[_0xdcbd('0x10')][_0xdcbd('0xf')]);}})[_0xdcbd('0x11')](function(_0x150534){logger[_0xdcbd('0xd')](_0xdcbd('0xa'),_0xea46ee,_0x150534);_0xc9f7d6(_0x150534);});});}exports[_0xdcbd('0x12')]=function(_0x4bae07){var _0x51e656=this;return new Promise(function(_0x24caa2,_0x4bcb35){return db['SugarcrmAccount'][_0xdcbd('0x13')]({'raw':_0x4bae07[_0xdcbd('0x14')]?_0x4bae07[_0xdcbd('0x14')][_0xdcbd('0x15')]===undefined?!![]:![]:!![],'where':_0x4bae07[_0xdcbd('0x14')]?_0x4bae07['options'][_0xdcbd('0x16')]||null:null,'attributes':_0x4bae07[_0xdcbd('0x14')]?_0x4bae07[_0xdcbd('0x14')][_0xdcbd('0x17')]||null:null,'limit':_0x4bae07['options']?_0x4bae07['options'][_0xdcbd('0x18')]||null:null,'include':_0x4bae07[_0xdcbd('0x14')]?_0x4bae07[_0xdcbd('0x14')][_0xdcbd('0x19')]?_[_0xdcbd('0x1a')](_0x4bae07[_0xdcbd('0x14')]['include'],function(_0x58db5d){return{'model':db[_0x58db5d['model']],'as':_0x58db5d['as'],'attributes':_0x58db5d['attributes'],'include':_0x58db5d[_0xdcbd('0x19')]?_[_0xdcbd('0x1a')](_0x58db5d['include'],function(_0x4b32c7){return{'model':db[_0x4b32c7[_0xdcbd('0x1b')]],'as':_0x4b32c7['as'],'attributes':_0x4b32c7[_0xdcbd('0x17')],'include':_0x4b32c7[_0xdcbd('0x19')]?_['map'](_0x4b32c7['include'],function(_0x5694d5){return{'model':db[_0x5694d5[_0xdcbd('0x1b')]],'as':_0x5694d5['as'],'attributes':_0x5694d5[_0xdcbd('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x446714){logger[_0xdcbd('0x9')]('GetSugarcrmAccount',_0x4bae07);logger[_0xdcbd('0x1c')]('GetSugarcrmAccount',_0x4bae07,JSON[_0xdcbd('0x1d')](_0x446714));_0x24caa2(_0x446714);})[_0xdcbd('0x11')](function(_0x29f3a8){logger[_0xdcbd('0xd')](_0xdcbd('0x12'),_0x29f3a8['message'],_0x4bae07);_0x4bcb35(_0x51e656[_0xdcbd('0xd')](0x1f4,_0x29f3a8[_0xdcbd('0xf')]));});});};exports[_0xdcbd('0x1e')]=function(_0x5c2083){var _0x3b1eaf=this;return new Promise(function(_0x45549c,_0x4f7990){return db['SugarcrmAccount'][_0xdcbd('0x1f')]({'raw':_0x5c2083[_0xdcbd('0x14')]?_0x5c2083[_0xdcbd('0x14')][_0xdcbd('0x15')]===undefined?!![]:![]:!![],'where':_0x5c2083[_0xdcbd('0x14')]?_0x5c2083[_0xdcbd('0x14')]['where']||null:null,'attributes':_0x5c2083[_0xdcbd('0x14')]?_0x5c2083[_0xdcbd('0x14')][_0xdcbd('0x17')]||null:null,'include':_0x5c2083['options']?_0x5c2083[_0xdcbd('0x14')][_0xdcbd('0x19')]?_['map'](_0x5c2083[_0xdcbd('0x14')][_0xdcbd('0x19')],function(_0x76b7ea){return{'model':db[_0x76b7ea[_0xdcbd('0x1b')]],'as':_0x76b7ea['as'],'attributes':_0x76b7ea[_0xdcbd('0x17')],'include':_0x76b7ea['include']?_[_0xdcbd('0x1a')](_0x76b7ea[_0xdcbd('0x19')],function(_0x5a7fc8){return{'model':db[_0x5a7fc8[_0xdcbd('0x1b')]],'as':_0x5a7fc8['as'],'attributes':_0x5a7fc8[_0xdcbd('0x17')],'include':_0x5a7fc8[_0xdcbd('0x19')]?_['map'](_0x5a7fc8[_0xdcbd('0x19')],function(_0xe8b7f3){return{'model':db[_0xe8b7f3[_0xdcbd('0x1b')]],'as':_0xe8b7f3['as'],'attributes':_0xe8b7f3[_0xdcbd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdcbd('0x8')](function(_0x246ffc){logger['info'](_0xdcbd('0x1e'),_0x5c2083);logger[_0xdcbd('0x1c')](_0xdcbd('0x1e'),_0x5c2083,JSON[_0xdcbd('0x1d')](_0x246ffc));_0x45549c(_0x246ffc);})[_0xdcbd('0x11')](function(_0x57aa7a){logger[_0xdcbd('0xd')]('ShowSugarcrmAccount',_0x57aa7a['message'],_0x5c2083);_0x4f7990(_0x3b1eaf[_0xdcbd('0xd')](0x1f4,_0x57aa7a[_0xdcbd('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9386068..f8eaf69 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 _0xf800=['../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41c941,_0x3db533){var _0x405441=function(_0x4473ed){while(--_0x4473ed){_0x41c941['push'](_0x41c941['shift']());}};_0x405441(++_0x3db533);}(_0xf800,0x190));var _0x0f80=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf800[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0f80('0x0'));var util=require(_0x0f80('0x1'));var path=require(_0x0f80('0x2'));var timeout=require(_0x0f80('0x3'));var express=require(_0x0f80('0x4'));var router=express['Router']();var fs_extra=require(_0x0f80('0x5'));var auth=require(_0x0f80('0x6'));var interaction=require(_0x0f80('0x7'));var config=require(_0x0f80('0x8'));var controller=require(_0x0f80('0x9'));router['get']('/',auth[_0x0f80('0xa')](),controller['index']);router[_0x0f80('0xb')](_0x0f80('0xc'),auth['isAuthenticated'](),controller[_0x0f80('0xd')]);router[_0x0f80('0xb')](_0x0f80('0xe'),auth[_0x0f80('0xa')](),controller[_0x0f80('0xf')]);router[_0x0f80('0xb')](_0x0f80('0x10'),auth[_0x0f80('0xa')](),controller[_0x0f80('0x11')]);router[_0x0f80('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x0f80('0x12')]);router['post']('/',auth[_0x0f80('0xa')](),controller[_0x0f80('0x13')]);router[_0x0f80('0x14')]('/:id',auth[_0x0f80('0xa')](),controller[_0x0f80('0x15')]);router['delete'](_0x0f80('0xc'),auth[_0x0f80('0xa')](),controller[_0x0f80('0x16')]);module[_0x0f80('0x17')]=router; \ No newline at end of file +var _0x1fed=['isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show'];(function(_0x526caa,_0x1924ab){var _0x260d50=function(_0x1a9744){while(--_0x1a9744){_0x526caa['push'](_0x526caa['shift']());}};_0x260d50(++_0x1924ab);}(_0x1fed,0x1c2));var _0xd1fe=function(_0x43b21d,_0x5d5677){_0x43b21d=_0x43b21d-0x0;var _0x1de400=_0x1fed[_0x43b21d];return _0x1de400;};'use strict';var multer=require(_0xd1fe('0x0'));var util=require(_0xd1fe('0x1'));var path=require(_0xd1fe('0x2'));var timeout=require(_0xd1fe('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd1fe('0x4'));var auth=require(_0xd1fe('0x5'));var interaction=require(_0xd1fe('0x6'));var config=require(_0xd1fe('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xd1fe('0x8')]('/',auth['isAuthenticated'](),controller[_0xd1fe('0x9')]);router[_0xd1fe('0x8')](_0xd1fe('0xa'),auth['isAuthenticated'](),controller[_0xd1fe('0xb')]);router[_0xd1fe('0x8')]('/:id/fields',auth[_0xd1fe('0xc')](),controller['getFields']);router[_0xd1fe('0x8')](_0xd1fe('0xd'),auth[_0xd1fe('0xc')](),controller[_0xd1fe('0xe')]);router['get'](_0xd1fe('0xf'),auth['isAuthenticated'](),controller[_0xd1fe('0x10')]);router[_0xd1fe('0x11')]('/',auth[_0xd1fe('0xc')](),controller[_0xd1fe('0x12')]);router[_0xd1fe('0x13')]('/:id',auth[_0xd1fe('0xc')](),controller[_0xd1fe('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd1fe('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 2acc9bd..b4e5642 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 _0xf0e4=['STRING'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xf0e4,0xc6));var _0x4f0e=function(_0x541fc0,_0x4a0206){_0x541fc0=_0x541fc0-0x0;var _0x526347=_0xf0e4[_0x541fc0];return _0x526347;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f0e('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d16=['exports','sequelize'];(function(_0x1ceed7,_0x54f642){var _0x1bbf2e=function(_0x1fc6f0){while(--_0x1fc6f0){_0x1ceed7['push'](_0x1ceed7['shift']());}};_0x1bbf2e(++_0x54f642);}(_0x9d16,0x81));var _0x69d1=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x9d16[_0x15fc7a];return _0x3aa9f4;};'use strict';var Sequelize=require(_0x69d1('0x0'));module[_0x69d1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 635d76b..18afbbe 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 _0x8c65=['crypto','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','getFields','SugarcrmField','nolimit','getSubjects','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1176b1,_0x55c4a4){var _0x49cfb8=function(_0x3f7bc6){while(--_0x3f7bc6){_0x1176b1['push'](_0x1176b1['shift']());}};_0x49cfb8(++_0x55c4a4);}(_0x8c65,0x145));var _0x58c6=function(_0x1c2599,_0x4db2c1){_0x1c2599=_0x1c2599-0x0;var _0x5debd9=_0x8c65[_0x1c2599];return _0x5debd9;};'use strict';var emlformat=require(_0x58c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x58c6('0x1'));var jsonpatch=require(_0x58c6('0x2'));var rp=require(_0x58c6('0x3'));var moment=require(_0x58c6('0x4'));var BPromise=require(_0x58c6('0x5'));var Mustache=require(_0x58c6('0x6'));var util=require(_0x58c6('0x7'));var path=require(_0x58c6('0x8'));var sox=require(_0x58c6('0x9'));var csv=require(_0x58c6('0xa'));var ejs=require(_0x58c6('0xb'));var fs=require('fs');var fs_extra=require(_0x58c6('0xc'));var _=require(_0x58c6('0xd'));var squel=require(_0x58c6('0xe'));var crypto=require(_0x58c6('0xf'));var jsforce=require(_0x58c6('0x10'));var deskjs=require(_0x58c6('0x11'));var toCsv=require('to-csv');var querystring=require(_0x58c6('0x12'));var Papa=require(_0x58c6('0x13'));var Redis=require('ioredis');var authService=require(_0x58c6('0x14'));var qs=require(_0x58c6('0x15'));var as=require(_0x58c6('0x16'));var hardwareService=require(_0x58c6('0x17'));var logger=require(_0x58c6('0x18'))('api');var utils=require(_0x58c6('0x19'));var config=require(_0x58c6('0x1a'));var licenseUtil=require(_0x58c6('0x1b'));var db=require(_0x58c6('0x1c'))['db'];function respondWithStatusCode(_0x466179,_0x2b70ea){_0x2b70ea=_0x2b70ea||0xcc;return function(_0x2fc21a){if(_0x2fc21a){return _0x466179[_0x58c6('0x1d')](_0x2b70ea);}return _0x466179[_0x58c6('0x1e')](_0x2b70ea)[_0x58c6('0x1f')]();};}function respondWithResult(_0x4eff51,_0x4dc664){_0x4dc664=_0x4dc664||0xc8;return function(_0x3139c4){if(_0x3139c4){return _0x4eff51[_0x58c6('0x1e')](_0x4dc664)[_0x58c6('0x20')](_0x3139c4);}};}function respondWithFilteredResult(_0x4b8d4c,_0x51cf62){return function(_0x456bc2){if(_0x456bc2){var _0x1b1435=typeof _0x51cf62[_0x58c6('0x21')]===_0x58c6('0x22')&&typeof _0x51cf62[_0x58c6('0x23')]===_0x58c6('0x22');var _0x128f1=_0x456bc2[_0x58c6('0x24')];var _0xc08de5=_0x1b1435?0x0:_0x51cf62[_0x58c6('0x21')];var _0x578278=_0x1b1435?_0x456bc2['count']:_0x51cf62['offset']+_0x51cf62[_0x58c6('0x23')];var _0x6cbce1;if(_0x578278>=_0x128f1){_0x578278=_0x128f1;_0x6cbce1=0xc8;}else{_0x6cbce1=0xce;}_0x4b8d4c[_0x58c6('0x1e')](_0x6cbce1);return _0x4b8d4c[_0x58c6('0x25')]('Content-Range',_0xc08de5+'-'+_0x578278+'/'+_0x128f1)[_0x58c6('0x20')](_0x456bc2);}return null;};}function patchUpdates(_0x38016f){return function(_0x49af23){try{jsonpatch[_0x58c6('0x26')](_0x49af23,_0x38016f,!![]);}catch(_0x370c5f){return BPromise[_0x58c6('0x27')](_0x370c5f);}return _0x49af23['save']();};}function saveUpdates(_0x342ca1,_0x1e7cf2){return function(_0x411dc4){if(_0x411dc4){return _0x411dc4[_0x58c6('0x28')](_0x342ca1)[_0x58c6('0x29')](function(_0x1416e8){return _0x1416e8;});}return null;};}function removeEntity(_0x41c952,_0x23fef4){return function(_0x2a4eac){if(_0x2a4eac){return _0x2a4eac[_0x58c6('0x2a')]()[_0x58c6('0x29')](function(){_0x41c952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa23a5,_0x4804d2){return function(_0x1e759e){if(!_0x1e759e){_0xaa23a5[_0x58c6('0x1d')](0x194);}return _0x1e759e;};}function handleError(_0x4680de,_0xb1ab99){_0xb1ab99=_0xb1ab99||0x1f4;return function(_0x5efb99){logger[_0x58c6('0x2b')](_0x5efb99['stack']);if(_0x5efb99[_0x58c6('0x2c')]){delete _0x5efb99['name'];}_0x4680de[_0x58c6('0x1e')](_0xb1ab99)[_0x58c6('0x2d')](_0x5efb99);};}exports['index']=function(_0x1f6116,_0x122e1a){var _0x31f685={},_0x191a59={},_0x6b4deb={'count':0x0,'rows':[]};var _0x230871=_[_0x58c6('0x2e')](db[_0x58c6('0x2f')][_0x58c6('0x30')],function(_0x2b96cf){return{'name':_0x2b96cf[_0x58c6('0x31')],'type':_0x2b96cf[_0x58c6('0x32')][_0x58c6('0x33')]};});_0x191a59[_0x58c6('0x34')]=_[_0x58c6('0x2e')](_0x230871,_0x58c6('0x2c'));_0x191a59[_0x58c6('0x35')]=_[_0x58c6('0x36')](_0x1f6116['query']);_0x191a59[_0x58c6('0x37')]=_[_0x58c6('0x38')](_0x191a59['model'],_0x191a59[_0x58c6('0x35')]);_0x31f685['attributes']=_[_0x58c6('0x38')](_0x191a59[_0x58c6('0x34')],qs[_0x58c6('0x39')](_0x1f6116[_0x58c6('0x35')][_0x58c6('0x39')]));_0x31f685[_0x58c6('0x3a')]=_0x31f685[_0x58c6('0x3a')][_0x58c6('0x3b')]?_0x31f685[_0x58c6('0x3a')]:_0x191a59[_0x58c6('0x34')];if(!_0x1f6116[_0x58c6('0x35')][_0x58c6('0x3c')]('nolimit')){_0x31f685[_0x58c6('0x23')]=qs['limit'](_0x1f6116['query'][_0x58c6('0x23')]);_0x31f685[_0x58c6('0x21')]=qs[_0x58c6('0x21')](_0x1f6116[_0x58c6('0x35')]['offset']);}_0x31f685[_0x58c6('0x3d')]=qs['sort'](_0x1f6116[_0x58c6('0x35')][_0x58c6('0x3e')]);_0x31f685['where']=qs[_0x58c6('0x37')](_[_0x58c6('0x3f')](_0x1f6116[_0x58c6('0x35')],_0x191a59[_0x58c6('0x37')]),_0x230871);if(_0x1f6116[_0x58c6('0x35')][_0x58c6('0x40')]){_0x31f685[_0x58c6('0x41')]=_[_0x58c6('0x42')](_0x31f685[_0x58c6('0x41')],{'$or':_[_0x58c6('0x2e')](_0x230871,function(_0x2e7eb9){if(_0x2e7eb9[_0x58c6('0x32')]!==_0x58c6('0x43')){var _0x4e66e6={};_0x4e66e6[_0x2e7eb9[_0x58c6('0x2c')]]={'$like':'%'+_0x1f6116[_0x58c6('0x35')][_0x58c6('0x40')]+'%'};return _0x4e66e6;}})});}_0x31f685=_[_0x58c6('0x42')]({},_0x31f685,_0x1f6116[_0x58c6('0x44')]);var _0x4cc5d0={'where':_0x31f685['where']};return db[_0x58c6('0x2f')][_0x58c6('0x24')](_0x4cc5d0)[_0x58c6('0x29')](function(_0x59cf5d){_0x6b4deb[_0x58c6('0x24')]=_0x59cf5d;if(_0x1f6116[_0x58c6('0x35')][_0x58c6('0x45')]){_0x31f685[_0x58c6('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x58c6('0x47')](_0x31f685);})[_0x58c6('0x29')](function(_0x10de30){_0x6b4deb[_0x58c6('0x48')]=_0x10de30;return _0x6b4deb;})[_0x58c6('0x29')](respondWithFilteredResult(_0x122e1a,_0x31f685))['catch'](handleError(_0x122e1a,null));};exports[_0x58c6('0x49')]=function(_0xc7c0c0,_0x46ddca){var _0x38f0c6={'raw':![],'where':{'id':_0xc7c0c0[_0x58c6('0x4a')]['id']}},_0x3e025d={};_0x3e025d[_0x58c6('0x34')]=_[_0x58c6('0x36')](db[_0x58c6('0x2f')][_0x58c6('0x30')]);_0x3e025d[_0x58c6('0x35')]=_['keys'](_0xc7c0c0[_0x58c6('0x35')]);_0x3e025d[_0x58c6('0x37')]=_[_0x58c6('0x38')](_0x3e025d[_0x58c6('0x34')],_0x3e025d[_0x58c6('0x35')]);_0x38f0c6['attributes']=_['intersection'](_0x3e025d['model'],qs[_0x58c6('0x39')](_0xc7c0c0[_0x58c6('0x35')][_0x58c6('0x39')]));_0x38f0c6['attributes']=_0x38f0c6[_0x58c6('0x3a')][_0x58c6('0x3b')]?_0x38f0c6[_0x58c6('0x3a')]:_0x3e025d['model'];if(_0xc7c0c0[_0x58c6('0x35')][_0x58c6('0x45')]){_0x38f0c6[_0x58c6('0x46')]=[{'all':!![]}];}_0x38f0c6=_['merge']({},_0x38f0c6,_0xc7c0c0[_0x58c6('0x44')]);return db[_0x58c6('0x2f')][_0x58c6('0x4b')](_0x38f0c6)['then'](handleEntityNotFound(_0x46ddca,null))[_0x58c6('0x29')](respondWithResult(_0x46ddca,null))['catch'](handleError(_0x46ddca,null));};exports[_0x58c6('0x4c')]=function(_0x14a74d,_0x1e1c83){return db[_0x58c6('0x2f')][_0x58c6('0x4c')](_0x14a74d[_0x58c6('0x4d')],{})[_0x58c6('0x29')](respondWithResult(_0x1e1c83,0xc9))[_0x58c6('0x4e')](handleError(_0x1e1c83,null));};exports[_0x58c6('0x28')]=function(_0x57a6bb,_0xa7349e){if(_0x57a6bb[_0x58c6('0x4d')]['id']){delete _0x57a6bb[_0x58c6('0x4d')]['id'];}return db[_0x58c6('0x2f')][_0x58c6('0x4b')]({'where':{'id':_0x57a6bb['params']['id']}})[_0x58c6('0x29')](handleEntityNotFound(_0xa7349e,null))[_0x58c6('0x29')](saveUpdates(_0x57a6bb[_0x58c6('0x4d')],null))[_0x58c6('0x29')](respondWithResult(_0xa7349e,null))[_0x58c6('0x4e')](handleError(_0xa7349e,null));};exports['destroy']=function(_0x26a844,_0x18fa7a){return db[_0x58c6('0x2f')][_0x58c6('0x4b')]({'where':{'id':_0x26a844[_0x58c6('0x4a')]['id']}})[_0x58c6('0x29')](handleEntityNotFound(_0x18fa7a,null))[_0x58c6('0x29')](removeEntity(_0x18fa7a,null))[_0x58c6('0x4e')](handleError(_0x18fa7a,null));};exports[_0x58c6('0x4f')]=function(_0x391986,_0x45fe7a,_0x17c55a){var _0x35fe4a={};var _0x523e55={};var _0x154e30;var _0x29e254;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x391986[_0x58c6('0x4a')]['id']}})[_0x58c6('0x29')](handleEntityNotFound(_0x45fe7a,null))[_0x58c6('0x29')](function(_0x462e45){if(_0x462e45){_0x154e30=_0x462e45;_0x523e55[_0x58c6('0x34')]=_[_0x58c6('0x36')](db[_0x58c6('0x50')][_0x58c6('0x30')]);_0x523e55[_0x58c6('0x35')]=_[_0x58c6('0x36')](_0x391986[_0x58c6('0x35')]);_0x523e55['filters']=_['intersection'](_0x523e55[_0x58c6('0x34')],_0x523e55[_0x58c6('0x35')]);_0x35fe4a[_0x58c6('0x3a')]=_[_0x58c6('0x38')](_0x523e55[_0x58c6('0x34')],qs['fields'](_0x391986[_0x58c6('0x35')]['fields']));_0x35fe4a['attributes']=_0x35fe4a[_0x58c6('0x3a')][_0x58c6('0x3b')]?_0x35fe4a[_0x58c6('0x3a')]:_0x523e55['model'];_0x35fe4a[_0x58c6('0x3d')]=qs['sort'](_0x391986['query']['sort']);_0x35fe4a[_0x58c6('0x41')]=qs[_0x58c6('0x37')](_[_0x58c6('0x3f')](_0x391986['query'],_0x523e55[_0x58c6('0x37')]));if(_0x391986[_0x58c6('0x35')][_0x58c6('0x40')]){_0x35fe4a[_0x58c6('0x41')]=_[_0x58c6('0x42')](_0x35fe4a[_0x58c6('0x41')],{'$or':_[_0x58c6('0x2e')](_0x35fe4a[_0x58c6('0x3a')],function(_0x48da68){var _0x7290bc={};_0x7290bc[_0x48da68]={'$like':'%'+_0x391986[_0x58c6('0x35')][_0x58c6('0x40')]+'%'};return _0x7290bc;})});}_0x35fe4a=_['merge']({},_0x35fe4a,_0x391986[_0x58c6('0x44')]);return _0x154e30[_0x58c6('0x4f')](_0x35fe4a);}})[_0x58c6('0x29')](function(_0x128e54){if(_0x128e54){_0x29e254=_0x128e54[_0x58c6('0x3b')];if(!_0x391986[_0x58c6('0x35')]['hasOwnProperty'](_0x58c6('0x51'))){_0x35fe4a[_0x58c6('0x23')]=qs[_0x58c6('0x23')](_0x391986[_0x58c6('0x35')]['limit']);_0x35fe4a[_0x58c6('0x21')]=qs[_0x58c6('0x21')](_0x391986[_0x58c6('0x35')][_0x58c6('0x21')]);}return _0x154e30[_0x58c6('0x4f')](_0x35fe4a);}})[_0x58c6('0x29')](function(_0x337069){if(_0x337069){return _0x337069?{'count':_0x29e254,'rows':_0x337069}:null;}})[_0x58c6('0x29')](respondWithResult(_0x45fe7a,null))[_0x58c6('0x4e')](handleError(_0x45fe7a,null));};exports[_0x58c6('0x52')]=function(_0x184fb8,_0x38f06d,_0x21b6b6){var _0x5615b7={};var _0x440914={};var _0x34d2f7;var _0x36c292;return db[_0x58c6('0x2f')][_0x58c6('0x53')]({'where':{'id':_0x184fb8[_0x58c6('0x4a')]['id']}})[_0x58c6('0x29')](handleEntityNotFound(_0x38f06d,null))[_0x58c6('0x29')](function(_0x3eb35c){if(_0x3eb35c){_0x34d2f7=_0x3eb35c;_0x440914[_0x58c6('0x34')]=_['keys'](db[_0x58c6('0x50')][_0x58c6('0x30')]);_0x440914[_0x58c6('0x35')]=_[_0x58c6('0x36')](_0x184fb8['query']);_0x440914['filters']=_[_0x58c6('0x38')](_0x440914[_0x58c6('0x34')],_0x440914[_0x58c6('0x35')]);_0x5615b7[_0x58c6('0x3a')]=_['intersection'](_0x440914[_0x58c6('0x34')],qs[_0x58c6('0x39')](_0x184fb8[_0x58c6('0x35')][_0x58c6('0x39')]));_0x5615b7[_0x58c6('0x3a')]=_0x5615b7[_0x58c6('0x3a')][_0x58c6('0x3b')]?_0x5615b7[_0x58c6('0x3a')]:_0x440914[_0x58c6('0x34')];_0x5615b7[_0x58c6('0x3d')]=qs[_0x58c6('0x3e')](_0x184fb8['query'][_0x58c6('0x3e')]);_0x5615b7[_0x58c6('0x41')]=qs[_0x58c6('0x37')](_['pick'](_0x184fb8[_0x58c6('0x35')],_0x440914[_0x58c6('0x37')]));if(_0x184fb8[_0x58c6('0x35')]['filter']){_0x5615b7['where']=_[_0x58c6('0x42')](_0x5615b7['where'],{'$or':_[_0x58c6('0x2e')](_0x5615b7['attributes'],function(_0x2eed79){var _0x10e775={};_0x10e775[_0x2eed79]={'$like':'%'+_0x184fb8[_0x58c6('0x35')]['filter']+'%'};return _0x10e775;})});}_0x5615b7=_[_0x58c6('0x42')]({},_0x5615b7,_0x184fb8['options']);return _0x34d2f7[_0x58c6('0x52')](_0x5615b7);}})[_0x58c6('0x29')](function(_0x296d25){if(_0x296d25){_0x36c292=_0x296d25['length'];if(!_0x184fb8['query'][_0x58c6('0x3c')](_0x58c6('0x51'))){_0x5615b7['limit']=qs[_0x58c6('0x23')](_0x184fb8[_0x58c6('0x35')][_0x58c6('0x23')]);_0x5615b7[_0x58c6('0x21')]=qs['offset'](_0x184fb8[_0x58c6('0x35')]['offset']);}return _0x34d2f7[_0x58c6('0x52')](_0x5615b7);}})['then'](function(_0x3c4fe5){if(_0x3c4fe5){return _0x3c4fe5?{'count':_0x36c292,'rows':_0x3c4fe5}:null;}})[_0x58c6('0x29')](respondWithResult(_0x38f06d,null))[_0x58c6('0x4e')](handleError(_0x38f06d,null));};exports['getDescriptions']=function(_0x100768,_0x4925bf,_0x205f9f){var _0x43cad2={};var _0x509e42={};var _0x5958c4;var _0x3098a1;return db[_0x58c6('0x2f')][_0x58c6('0x53')]({'where':{'id':_0x100768[_0x58c6('0x4a')]['id']}})[_0x58c6('0x29')](handleEntityNotFound(_0x4925bf,null))[_0x58c6('0x29')](function(_0x42f378){if(_0x42f378){_0x5958c4=_0x42f378;_0x509e42[_0x58c6('0x34')]=_[_0x58c6('0x36')](db[_0x58c6('0x50')][_0x58c6('0x30')]);_0x509e42['query']=_[_0x58c6('0x36')](_0x100768[_0x58c6('0x35')]);_0x509e42[_0x58c6('0x37')]=_['intersection'](_0x509e42['model'],_0x509e42[_0x58c6('0x35')]);_0x43cad2[_0x58c6('0x3a')]=_[_0x58c6('0x38')](_0x509e42[_0x58c6('0x34')],qs[_0x58c6('0x39')](_0x100768[_0x58c6('0x35')]['fields']));_0x43cad2[_0x58c6('0x3a')]=_0x43cad2[_0x58c6('0x3a')][_0x58c6('0x3b')]?_0x43cad2[_0x58c6('0x3a')]:_0x509e42[_0x58c6('0x34')];_0x43cad2['order']=qs['sort'](_0x100768['query'][_0x58c6('0x3e')]);_0x43cad2[_0x58c6('0x41')]=qs[_0x58c6('0x37')](_[_0x58c6('0x3f')](_0x100768[_0x58c6('0x35')],_0x509e42[_0x58c6('0x37')]));if(_0x100768['query'][_0x58c6('0x40')]){_0x43cad2[_0x58c6('0x41')]=_[_0x58c6('0x42')](_0x43cad2['where'],{'$or':_[_0x58c6('0x2e')](_0x43cad2[_0x58c6('0x3a')],function(_0x24adc8){var _0x2d42e2={};_0x2d42e2[_0x24adc8]={'$like':'%'+_0x100768[_0x58c6('0x35')][_0x58c6('0x40')]+'%'};return _0x2d42e2;})});}_0x43cad2=_[_0x58c6('0x42')]({},_0x43cad2,_0x100768[_0x58c6('0x44')]);return _0x5958c4[_0x58c6('0x54')](_0x43cad2);}})['then'](function(_0x31f701){if(_0x31f701){_0x3098a1=_0x31f701[_0x58c6('0x3b')];if(!_0x100768['query'][_0x58c6('0x3c')](_0x58c6('0x51'))){_0x43cad2[_0x58c6('0x23')]=qs[_0x58c6('0x23')](_0x100768[_0x58c6('0x35')]['limit']);_0x43cad2[_0x58c6('0x21')]=qs[_0x58c6('0x21')](_0x100768[_0x58c6('0x35')][_0x58c6('0x21')]);}return _0x5958c4[_0x58c6('0x54')](_0x43cad2);}})[_0x58c6('0x29')](function(_0x328956){if(_0x328956){return _0x328956?{'count':_0x3098a1,'rows':_0x328956}:null;}})[_0x58c6('0x29')](respondWithResult(_0x4925bf,null))[_0x58c6('0x4e')](handleError(_0x4925bf,null));}; \ No newline at end of file +var _0x4fd8=['set','Content-Range','reject','update','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','params','include','find','create','body','destroy','findOne','SugarcrmField','order','pick','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x56ef44,_0x7c23ae){var _0x5d498=function(_0x113502){while(--_0x113502){_0x56ef44['push'](_0x56ef44['shift']());}};_0x5d498(++_0x7c23ae);}(_0x4fd8,0x79));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x84fd('0x0'));var rimraf=require(_0x84fd('0x1'));var zipdir=require(_0x84fd('0x2'));var jsonpatch=require(_0x84fd('0x3'));var rp=require(_0x84fd('0x4'));var moment=require(_0x84fd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x84fd('0x6'));var util=require(_0x84fd('0x7'));var path=require('path');var sox=require(_0x84fd('0x8'));var csv=require('to-csv');var ejs=require(_0x84fd('0x9'));var fs=require('fs');var fs_extra=require(_0x84fd('0xa'));var _=require('lodash');var squel=require(_0x84fd('0xb'));var crypto=require(_0x84fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x84fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x84fd('0xe'));var Papa=require('papaparse');var Redis=require(_0x84fd('0xf'));var authService=require(_0x84fd('0x10'));var qs=require(_0x84fd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x84fd('0x12'))(_0x84fd('0x13'));var utils=require(_0x84fd('0x14'));var config=require(_0x84fd('0x15'));var licenseUtil=require(_0x84fd('0x16'));var db=require(_0x84fd('0x17'))['db'];function respondWithStatusCode(_0x186bc5,_0x1ad8a7){_0x1ad8a7=_0x1ad8a7||0xcc;return function(_0x4aa723){if(_0x4aa723){return _0x186bc5[_0x84fd('0x18')](_0x1ad8a7);}return _0x186bc5[_0x84fd('0x19')](_0x1ad8a7)[_0x84fd('0x1a')]();};}function respondWithResult(_0x392aaa,_0x10d15d){_0x10d15d=_0x10d15d||0xc8;return function(_0x19d0c5){if(_0x19d0c5){return _0x392aaa[_0x84fd('0x19')](_0x10d15d)['json'](_0x19d0c5);}};}function respondWithFilteredResult(_0x792a1f,_0x3c0899){return function(_0x5a4b2c){if(_0x5a4b2c){var _0x352e8e=typeof _0x3c0899[_0x84fd('0x1b')]===_0x84fd('0x1c')&&typeof _0x3c0899[_0x84fd('0x1d')]===_0x84fd('0x1c');var _0x3115dd=_0x5a4b2c['count'];var _0x193096=_0x352e8e?0x0:_0x3c0899['offset'];var _0x3580ae=_0x352e8e?_0x5a4b2c[_0x84fd('0x1e')]:_0x3c0899[_0x84fd('0x1b')]+_0x3c0899[_0x84fd('0x1d')];var _0x3b71a0;if(_0x3580ae>=_0x3115dd){_0x3580ae=_0x3115dd;_0x3b71a0=0xc8;}else{_0x3b71a0=0xce;}_0x792a1f['status'](_0x3b71a0);return _0x792a1f[_0x84fd('0x1f')](_0x84fd('0x20'),_0x193096+'-'+_0x3580ae+'/'+_0x3115dd)['json'](_0x5a4b2c);}return null;};}function patchUpdates(_0x364ab9){return function(_0x36a476){try{jsonpatch['apply'](_0x36a476,_0x364ab9,!![]);}catch(_0x5069cb){return BPromise[_0x84fd('0x21')](_0x5069cb);}return _0x36a476['save']();};}function saveUpdates(_0x43b3a3,_0x4c218e){return function(_0x3fe42a){if(_0x3fe42a){return _0x3fe42a[_0x84fd('0x22')](_0x43b3a3)['then'](function(_0x4aee48){return _0x4aee48;});}return null;};}function removeEntity(_0x2255b4,_0x1ba161){return function(_0x417e6a){if(_0x417e6a){return _0x417e6a['destroy']()['then'](function(){_0x2255b4[_0x84fd('0x19')](0xcc)[_0x84fd('0x1a')]();});}};}function handleEntityNotFound(_0x35c676,_0x5a218f){return function(_0x2192a3){if(!_0x2192a3){_0x35c676[_0x84fd('0x18')](0x194);}return _0x2192a3;};}function handleError(_0x5526a7,_0x4c0473){_0x4c0473=_0x4c0473||0x1f4;return function(_0x3ad3c2){logger['error'](_0x3ad3c2[_0x84fd('0x23')]);if(_0x3ad3c2[_0x84fd('0x24')]){delete _0x3ad3c2[_0x84fd('0x24')];}_0x5526a7['status'](_0x4c0473)[_0x84fd('0x25')](_0x3ad3c2);};}exports[_0x84fd('0x26')]=function(_0x6dd12a,_0x58020e){var _0x90b05c={},_0x2b276d={},_0x210d91={'count':0x0,'rows':[]};var _0x5ab869=_[_0x84fd('0x27')](db[_0x84fd('0x28')][_0x84fd('0x29')],function(_0x1643c0){return{'name':_0x1643c0['fieldName'],'type':_0x1643c0['type'][_0x84fd('0x2a')]};});_0x2b276d['model']=_['map'](_0x5ab869,_0x84fd('0x24'));_0x2b276d[_0x84fd('0x2b')]=_[_0x84fd('0x2c')](_0x6dd12a[_0x84fd('0x2b')]);_0x2b276d[_0x84fd('0x2d')]=_[_0x84fd('0x2e')](_0x2b276d[_0x84fd('0x2f')],_0x2b276d[_0x84fd('0x2b')]);_0x90b05c[_0x84fd('0x30')]=_[_0x84fd('0x2e')](_0x2b276d['model'],qs[_0x84fd('0x31')](_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x31')]));_0x90b05c['attributes']=_0x90b05c[_0x84fd('0x30')][_0x84fd('0x32')]?_0x90b05c[_0x84fd('0x30')]:_0x2b276d[_0x84fd('0x2f')];if(!_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x33')]('nolimit')){_0x90b05c[_0x84fd('0x1d')]=qs[_0x84fd('0x1d')](_0x6dd12a['query'][_0x84fd('0x1d')]);_0x90b05c[_0x84fd('0x1b')]=qs[_0x84fd('0x1b')](_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x1b')]);}_0x90b05c['order']=qs[_0x84fd('0x34')](_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x34')]);_0x90b05c[_0x84fd('0x35')]=qs['filters'](_['pick'](_0x6dd12a[_0x84fd('0x2b')],_0x2b276d['filters']),_0x5ab869);if(_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x36')]){_0x90b05c[_0x84fd('0x35')]=_[_0x84fd('0x37')](_0x90b05c['where'],{'$or':_[_0x84fd('0x27')](_0x5ab869,function(_0x4889c4){if(_0x4889c4['type']!==_0x84fd('0x38')){var _0x5e9f48={};_0x5e9f48[_0x4889c4[_0x84fd('0x24')]]={'$like':'%'+_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x36')]+'%'};return _0x5e9f48;}})});}_0x90b05c=_[_0x84fd('0x37')]({},_0x90b05c,_0x6dd12a[_0x84fd('0x39')]);var _0xa3e635={'where':_0x90b05c[_0x84fd('0x35')]};return db[_0x84fd('0x28')]['count'](_0xa3e635)[_0x84fd('0x3a')](function(_0x52d21d){_0x210d91['count']=_0x52d21d;if(_0x6dd12a[_0x84fd('0x2b')][_0x84fd('0x3b')]){_0x90b05c['include']=[{'all':!![]}];}return db[_0x84fd('0x28')]['findAll'](_0x90b05c);})[_0x84fd('0x3a')](function(_0x147f9a){_0x210d91[_0x84fd('0x3c')]=_0x147f9a;return _0x210d91;})['then'](respondWithFilteredResult(_0x58020e,_0x90b05c))[_0x84fd('0x3d')](handleError(_0x58020e,null));};exports['show']=function(_0x1389f9,_0x1428b6){var _0xc2527e={'raw':![],'where':{'id':_0x1389f9[_0x84fd('0x3e')]['id']}},_0x536b21={};_0x536b21[_0x84fd('0x2f')]=_[_0x84fd('0x2c')](db[_0x84fd('0x28')][_0x84fd('0x29')]);_0x536b21[_0x84fd('0x2b')]=_[_0x84fd('0x2c')](_0x1389f9[_0x84fd('0x2b')]);_0x536b21[_0x84fd('0x2d')]=_['intersection'](_0x536b21['model'],_0x536b21['query']);_0xc2527e[_0x84fd('0x30')]=_[_0x84fd('0x2e')](_0x536b21[_0x84fd('0x2f')],qs[_0x84fd('0x31')](_0x1389f9[_0x84fd('0x2b')][_0x84fd('0x31')]));_0xc2527e['attributes']=_0xc2527e[_0x84fd('0x30')][_0x84fd('0x32')]?_0xc2527e['attributes']:_0x536b21['model'];if(_0x1389f9['query'][_0x84fd('0x3b')]){_0xc2527e[_0x84fd('0x3f')]=[{'all':!![]}];}_0xc2527e=_[_0x84fd('0x37')]({},_0xc2527e,_0x1389f9['options']);return db['SugarcrmConfiguration'][_0x84fd('0x40')](_0xc2527e)['then'](handleEntityNotFound(_0x1428b6,null))[_0x84fd('0x3a')](respondWithResult(_0x1428b6,null))['catch'](handleError(_0x1428b6,null));};exports['create']=function(_0x403bcd,_0x513b4f){return db[_0x84fd('0x28')][_0x84fd('0x41')](_0x403bcd['body'],{})[_0x84fd('0x3a')](respondWithResult(_0x513b4f,0xc9))[_0x84fd('0x3d')](handleError(_0x513b4f,null));};exports[_0x84fd('0x22')]=function(_0x3394ed,_0x54711a){if(_0x3394ed['body']['id']){delete _0x3394ed['body']['id'];}return db[_0x84fd('0x28')][_0x84fd('0x40')]({'where':{'id':_0x3394ed[_0x84fd('0x3e')]['id']}})[_0x84fd('0x3a')](handleEntityNotFound(_0x54711a,null))[_0x84fd('0x3a')](saveUpdates(_0x3394ed[_0x84fd('0x42')],null))[_0x84fd('0x3a')](respondWithResult(_0x54711a,null))[_0x84fd('0x3d')](handleError(_0x54711a,null));};exports[_0x84fd('0x43')]=function(_0x1af6e8,_0xbaea08){return db['SugarcrmConfiguration'][_0x84fd('0x40')]({'where':{'id':_0x1af6e8['params']['id']}})[_0x84fd('0x3a')](handleEntityNotFound(_0xbaea08,null))[_0x84fd('0x3a')](removeEntity(_0xbaea08,null))['catch'](handleError(_0xbaea08,null));};exports['getFields']=function(_0x26985a,_0x28df55,_0x1e28e2){var _0x180abb={};var _0x25829c={};var _0x2313f2;var _0xa53342;return db[_0x84fd('0x28')][_0x84fd('0x44')]({'where':{'id':_0x26985a[_0x84fd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28df55,null))[_0x84fd('0x3a')](function(_0x526e28){if(_0x526e28){_0x2313f2=_0x526e28;_0x25829c[_0x84fd('0x2f')]=_['keys'](db[_0x84fd('0x45')][_0x84fd('0x29')]);_0x25829c[_0x84fd('0x2b')]=_[_0x84fd('0x2c')](_0x26985a[_0x84fd('0x2b')]);_0x25829c[_0x84fd('0x2d')]=_[_0x84fd('0x2e')](_0x25829c[_0x84fd('0x2f')],_0x25829c[_0x84fd('0x2b')]);_0x180abb[_0x84fd('0x30')]=_[_0x84fd('0x2e')](_0x25829c[_0x84fd('0x2f')],qs[_0x84fd('0x31')](_0x26985a[_0x84fd('0x2b')][_0x84fd('0x31')]));_0x180abb[_0x84fd('0x30')]=_0x180abb[_0x84fd('0x30')][_0x84fd('0x32')]?_0x180abb[_0x84fd('0x30')]:_0x25829c[_0x84fd('0x2f')];_0x180abb[_0x84fd('0x46')]=qs['sort'](_0x26985a['query']['sort']);_0x180abb['where']=qs[_0x84fd('0x2d')](_[_0x84fd('0x47')](_0x26985a[_0x84fd('0x2b')],_0x25829c[_0x84fd('0x2d')]));if(_0x26985a[_0x84fd('0x2b')][_0x84fd('0x36')]){_0x180abb[_0x84fd('0x35')]=_[_0x84fd('0x37')](_0x180abb['where'],{'$or':_[_0x84fd('0x27')](_0x180abb['attributes'],function(_0x3f89bb){var _0x5c7211={};_0x5c7211[_0x3f89bb]={'$like':'%'+_0x26985a[_0x84fd('0x2b')][_0x84fd('0x36')]+'%'};return _0x5c7211;})});}_0x180abb=_['merge']({},_0x180abb,_0x26985a[_0x84fd('0x39')]);return _0x2313f2[_0x84fd('0x48')](_0x180abb);}})[_0x84fd('0x3a')](function(_0xad5ad){if(_0xad5ad){_0xa53342=_0xad5ad[_0x84fd('0x32')];if(!_0x26985a['query'][_0x84fd('0x33')](_0x84fd('0x49'))){_0x180abb[_0x84fd('0x1d')]=qs['limit'](_0x26985a[_0x84fd('0x2b')]['limit']);_0x180abb[_0x84fd('0x1b')]=qs[_0x84fd('0x1b')](_0x26985a[_0x84fd('0x2b')][_0x84fd('0x1b')]);}return _0x2313f2['getFields'](_0x180abb);}})['then'](function(_0x11c388){if(_0x11c388){return _0x11c388?{'count':_0xa53342,'rows':_0x11c388}:null;}})['then'](respondWithResult(_0x28df55,null))[_0x84fd('0x3d')](handleError(_0x28df55,null));};exports[_0x84fd('0x4a')]=function(_0xb6ecf5,_0x7b6a06,_0x2889b7){var _0x3a58e2={};var _0xb22206={};var _0x519f26;var _0x147a3c;return db[_0x84fd('0x28')][_0x84fd('0x44')]({'where':{'id':_0xb6ecf5[_0x84fd('0x3e')]['id']}})[_0x84fd('0x3a')](handleEntityNotFound(_0x7b6a06,null))[_0x84fd('0x3a')](function(_0x53ed58){if(_0x53ed58){_0x519f26=_0x53ed58;_0xb22206[_0x84fd('0x2f')]=_[_0x84fd('0x2c')](db[_0x84fd('0x45')][_0x84fd('0x29')]);_0xb22206[_0x84fd('0x2b')]=_[_0x84fd('0x2c')](_0xb6ecf5[_0x84fd('0x2b')]);_0xb22206[_0x84fd('0x2d')]=_[_0x84fd('0x2e')](_0xb22206[_0x84fd('0x2f')],_0xb22206[_0x84fd('0x2b')]);_0x3a58e2[_0x84fd('0x30')]=_[_0x84fd('0x2e')](_0xb22206['model'],qs['fields'](_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x31')]));_0x3a58e2['attributes']=_0x3a58e2[_0x84fd('0x30')][_0x84fd('0x32')]?_0x3a58e2['attributes']:_0xb22206[_0x84fd('0x2f')];_0x3a58e2[_0x84fd('0x46')]=qs[_0x84fd('0x34')](_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x34')]);_0x3a58e2[_0x84fd('0x35')]=qs[_0x84fd('0x2d')](_[_0x84fd('0x47')](_0xb6ecf5[_0x84fd('0x2b')],_0xb22206[_0x84fd('0x2d')]));if(_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x36')]){_0x3a58e2[_0x84fd('0x35')]=_[_0x84fd('0x37')](_0x3a58e2[_0x84fd('0x35')],{'$or':_[_0x84fd('0x27')](_0x3a58e2[_0x84fd('0x30')],function(_0xb9171e){var _0x316c50={};_0x316c50[_0xb9171e]={'$like':'%'+_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x36')]+'%'};return _0x316c50;})});}_0x3a58e2=_[_0x84fd('0x37')]({},_0x3a58e2,_0xb6ecf5[_0x84fd('0x39')]);return _0x519f26['getSubjects'](_0x3a58e2);}})['then'](function(_0xbb0307){if(_0xbb0307){_0x147a3c=_0xbb0307[_0x84fd('0x32')];if(!_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x33')](_0x84fd('0x49'))){_0x3a58e2[_0x84fd('0x1d')]=qs[_0x84fd('0x1d')](_0xb6ecf5['query'][_0x84fd('0x1d')]);_0x3a58e2[_0x84fd('0x1b')]=qs[_0x84fd('0x1b')](_0xb6ecf5[_0x84fd('0x2b')][_0x84fd('0x1b')]);}return _0x519f26[_0x84fd('0x4a')](_0x3a58e2);}})[_0x84fd('0x3a')](function(_0x5762e9){if(_0x5762e9){return _0x5762e9?{'count':_0x147a3c,'rows':_0x5762e9}:null;}})['then'](respondWithResult(_0x7b6a06,null))['catch'](handleError(_0x7b6a06,null));};exports[_0x84fd('0x4b')]=function(_0x58a83e,_0x5199ba,_0x4f4c32){var _0xbc6b87={};var _0x3335a7={};var _0x1102c7;var _0x2d6ce2;return db[_0x84fd('0x28')][_0x84fd('0x44')]({'where':{'id':_0x58a83e[_0x84fd('0x3e')]['id']}})[_0x84fd('0x3a')](handleEntityNotFound(_0x5199ba,null))[_0x84fd('0x3a')](function(_0x14e8fe){if(_0x14e8fe){_0x1102c7=_0x14e8fe;_0x3335a7[_0x84fd('0x2f')]=_[_0x84fd('0x2c')](db[_0x84fd('0x45')][_0x84fd('0x29')]);_0x3335a7[_0x84fd('0x2b')]=_[_0x84fd('0x2c')](_0x58a83e['query']);_0x3335a7['filters']=_[_0x84fd('0x2e')](_0x3335a7[_0x84fd('0x2f')],_0x3335a7['query']);_0xbc6b87['attributes']=_[_0x84fd('0x2e')](_0x3335a7[_0x84fd('0x2f')],qs[_0x84fd('0x31')](_0x58a83e[_0x84fd('0x2b')]['fields']));_0xbc6b87[_0x84fd('0x30')]=_0xbc6b87['attributes']['length']?_0xbc6b87['attributes']:_0x3335a7[_0x84fd('0x2f')];_0xbc6b87[_0x84fd('0x46')]=qs['sort'](_0x58a83e[_0x84fd('0x2b')]['sort']);_0xbc6b87[_0x84fd('0x35')]=qs[_0x84fd('0x2d')](_[_0x84fd('0x47')](_0x58a83e[_0x84fd('0x2b')],_0x3335a7[_0x84fd('0x2d')]));if(_0x58a83e[_0x84fd('0x2b')]['filter']){_0xbc6b87[_0x84fd('0x35')]=_[_0x84fd('0x37')](_0xbc6b87[_0x84fd('0x35')],{'$or':_['map'](_0xbc6b87['attributes'],function(_0x5022b9){var _0xefa214={};_0xefa214[_0x5022b9]={'$like':'%'+_0x58a83e[_0x84fd('0x2b')]['filter']+'%'};return _0xefa214;})});}_0xbc6b87=_[_0x84fd('0x37')]({},_0xbc6b87,_0x58a83e[_0x84fd('0x39')]);return _0x1102c7['getDescriptions'](_0xbc6b87);}})[_0x84fd('0x3a')](function(_0x279198){if(_0x279198){_0x2d6ce2=_0x279198[_0x84fd('0x32')];if(!_0x58a83e[_0x84fd('0x2b')][_0x84fd('0x33')]('nolimit')){_0xbc6b87[_0x84fd('0x1d')]=qs[_0x84fd('0x1d')](_0x58a83e[_0x84fd('0x2b')][_0x84fd('0x1d')]);_0xbc6b87[_0x84fd('0x1b')]=qs[_0x84fd('0x1b')](_0x58a83e[_0x84fd('0x2b')][_0x84fd('0x1b')]);}return _0x1102c7[_0x84fd('0x4b')](_0xbc6b87);}})['then'](function(_0x789c82){if(_0x789c82){return _0x789c82?{'count':_0x2d6ce2,'rows':_0x789c82}:null;}})[_0x84fd('0x3a')](respondWithResult(_0x5199ba,null))[_0x84fd('0x3d')](handleError(_0x5199ba,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cbc9037..5dbd6db 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 _0x4e12=['bluebird','request-promise','path','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment'];(function(_0x220c0d,_0x4cf856){var _0x1fef2a=function(_0xb80303){while(--_0xb80303){_0x220c0d['push'](_0x220c0d['shift']());}};_0x1fef2a(++_0x4cf856);}(_0x4e12,0x130));var _0x24e1=function(_0x56c0d8,_0x3844fb){_0x56c0d8=_0x56c0d8-0x0;var _0x1a4629=_0x4e12[_0x56c0d8];return _0x1a4629;};'use strict';var _=require('lodash');var util=require(_0x24e1('0x0'));var logger=require(_0x24e1('0x1'))(_0x24e1('0x2'));var moment=require(_0x24e1('0x3'));var BPromise=require(_0x24e1('0x4'));var rp=require(_0x24e1('0x5'));var fs=require('fs');var path=require(_0x24e1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x24e1('0x7')]=function(_0x140ec8,_0x3dc7c6){return _0x140ec8[_0x24e1('0x8')](_0x24e1('0x9'),attributes,{'tableName':_0x24e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d4=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x15782b,_0x1ad2fc){var _0x4b12a4=function(_0x9a83d2){while(--_0x9a83d2){_0x15782b['push'](_0x15782b['shift']());}};_0x4b12a4(++_0x1ad2fc);}(_0x38d4,0x168));var _0x438d=function(_0x4e08da,_0x12d221){_0x4e08da=_0x4e08da-0x0;var _0x23e4e4=_0x38d4[_0x4e08da];return _0x23e4e4;};'use strict';var _=require(_0x438d('0x0'));var util=require(_0x438d('0x1'));var logger=require(_0x438d('0x2'))(_0x438d('0x3'));var moment=require(_0x438d('0x4'));var BPromise=require(_0x438d('0x5'));var rp=require(_0x438d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x438d('0x7'));var config=require(_0x438d('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x438d('0x9')]=function(_0x355e67,_0x4fbfa0){return _0x355e67['define']('SugarcrmConfiguration',attributes,{'tableName':_0x438d('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 7a729b1..4a470e1 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 _0xc601=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xc601,0x12a));var _0x1c60=function(_0x2f948a,_0x574d50){_0x2f948a=_0x2f948a-0x0;var _0x5666a4=_0xc601[_0x2f948a];return _0x5666a4;};'use strict';var _=require(_0x1c60('0x0'));var util=require(_0x1c60('0x1'));var moment=require(_0x1c60('0x2'));var BPromise=require(_0x1c60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c60('0x4'));var db=require(_0x1c60('0x5'))['db'];var utils=require(_0x1c60('0x6'));var logger=require(_0x1c60('0x7'))('rpc');var config=require(_0x1c60('0x8'));var jayson=require(_0x1c60('0x9'));var client=jayson[_0x1c60('0xa')][_0x1c60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c98c0,_0x2017e3,_0x6d3ef0){return new BPromise(function(_0x3c3017,_0x6620ab){return client[_0x1c60('0xc')](_0x9c98c0,_0x6d3ef0)['then'](function(_0x5eb0bf){logger[_0x1c60('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2017e3,_0x1c60('0xe'));logger[_0x1c60('0xf')](_0x1c60('0x10'),_0x2017e3,'request\x20sent',JSON['stringify'](_0x5eb0bf));if(_0x5eb0bf['error']){if(_0x5eb0bf[_0x1c60('0x11')][_0x1c60('0x12')]===0x1f4){logger[_0x1c60('0x11')](_0x1c60('0x13'),_0x2017e3,_0x5eb0bf['error'][_0x1c60('0x14')]);return _0x6620ab(_0x5eb0bf[_0x1c60('0x11')][_0x1c60('0x14')]);}logger['error'](_0x1c60('0x13'),_0x2017e3,_0x5eb0bf[_0x1c60('0x11')][_0x1c60('0x14')]);return _0x3c3017(_0x5eb0bf[_0x1c60('0x11')][_0x1c60('0x14')]);}else{logger[_0x1c60('0xd')](_0x1c60('0x13'),_0x2017e3,'request\x20sent');_0x3c3017(_0x5eb0bf[_0x1c60('0x15')][_0x1c60('0x14')]);}})[_0x1c60('0x16')](function(_0x4a01dd){logger['error'](_0x1c60('0x13'),_0x2017e3,_0x4a01dd);_0x6620ab(_0x4a01dd);});});} \ No newline at end of file +var _0xa031=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x156701,_0xc63195){var _0x2362c3=function(_0x5421c9){while(--_0x5421c9){_0x156701['push'](_0x156701['shift']());}};_0x2362c3(++_0xc63195);}(_0xa031,0x16c));var _0x1a03=function(_0xc9424e,_0x4d528b){_0xc9424e=_0xc9424e-0x0;var _0x36cabc=_0xa031[_0xc9424e];return _0x36cabc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a03('0x0'));var BPromise=require(_0x1a03('0x1'));var rs=require(_0x1a03('0x2'));var fs=require('fs');var Redis=require(_0x1a03('0x3'));var db=require(_0x1a03('0x4'))['db'];var utils=require(_0x1a03('0x5'));var logger=require(_0x1a03('0x6'))(_0x1a03('0x7'));var config=require(_0x1a03('0x8'));var jayson=require(_0x1a03('0x9'));var client=jayson['client'][_0x1a03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a54a,_0x57a8bd,_0x54f40d){return new BPromise(function(_0x515d50,_0x12ccdf){return client[_0x1a03('0xb')](_0x18a54a,_0x54f40d)['then'](function(_0x3e4da6){logger[_0x1a03('0xc')](_0x1a03('0xd'),_0x57a8bd,'request\x20sent');logger[_0x1a03('0xe')](_0x1a03('0xf'),_0x57a8bd,_0x1a03('0x10'),JSON[_0x1a03('0x11')](_0x3e4da6));if(_0x3e4da6[_0x1a03('0x12')]){if(_0x3e4da6[_0x1a03('0x12')][_0x1a03('0x13')]===0x1f4){logger['error'](_0x1a03('0xd'),_0x57a8bd,_0x3e4da6['error']['message']);return _0x12ccdf(_0x3e4da6[_0x1a03('0x12')][_0x1a03('0x14')]);}logger[_0x1a03('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x57a8bd,_0x3e4da6[_0x1a03('0x12')][_0x1a03('0x14')]);return _0x515d50(_0x3e4da6[_0x1a03('0x12')][_0x1a03('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x57a8bd,'request\x20sent');_0x515d50(_0x3e4da6[_0x1a03('0x15')]['message']);}})[_0x1a03('0x16')](function(_0x3611d0){logger[_0x1a03('0x12')](_0x1a03('0xd'),_0x57a8bd,_0x3611d0);_0x12ccdf(_0x3611d0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6528701..13d5f58 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 _0x0b27=['multer','connect-timeout','Router','fs-extra','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x17ba69,_0x78794c){var _0xd4fc1=function(_0x2dae9c){while(--_0x2dae9c){_0x17ba69['push'](_0x17ba69['shift']());}};_0xd4fc1(++_0x78794c);}(_0x0b27,0xe0));var _0x70b2=function(_0x2f8287,_0x579557){_0x2f8287=_0x2f8287-0x0;var _0x210f6c=_0x0b27[_0x2f8287];return _0x210f6c;};'use strict';var multer=require(_0x70b2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x70b2('0x1'));var express=require('express');var router=express[_0x70b2('0x2')]();var fs_extra=require(_0x70b2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x70b2('0x4')]('/',auth[_0x70b2('0x5')](),controller[_0x70b2('0x6')]);router[_0x70b2('0x4')](_0x70b2('0x7'),auth[_0x70b2('0x5')](),controller[_0x70b2('0x8')]);router[_0x70b2('0x9')]('/',auth['isAuthenticated'](),controller[_0x70b2('0xa')]);router[_0x70b2('0xb')](_0x70b2('0x7'),auth[_0x70b2('0x5')](),controller[_0x70b2('0xc')]);router[_0x70b2('0xd')](_0x70b2('0x7'),auth[_0x70b2('0x5')](),controller[_0x70b2('0xe')]);module[_0x70b2('0xf')]=router; \ No newline at end of file +var _0x78de=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x78de,0x1c1));var _0xe78d=function(_0x7cf8eb,_0x5a470e){_0x7cf8eb=_0x7cf8eb-0x0;var _0x24e417=_0x78de[_0x7cf8eb];return _0x24e417;};'use strict';var multer=require(_0xe78d('0x0'));var util=require(_0xe78d('0x1'));var path=require(_0xe78d('0x2'));var timeout=require(_0xe78d('0x3'));var express=require(_0xe78d('0x4'));var router=express[_0xe78d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe78d('0x6'));var interaction=require(_0xe78d('0x7'));var config=require(_0xe78d('0x8'));var controller=require(_0xe78d('0x9'));router[_0xe78d('0xa')]('/',auth[_0xe78d('0xb')](),controller[_0xe78d('0xc')]);router[_0xe78d('0xa')]('/:id',auth[_0xe78d('0xb')](),controller[_0xe78d('0xd')]);router['post']('/',auth[_0xe78d('0xb')](),controller['create']);router[_0xe78d('0xe')](_0xe78d('0xf'),auth[_0xe78d('0xb')](),controller['update']);router[_0xe78d('0x10')](_0xe78d('0xf'),auth[_0xe78d('0xb')](),controller[_0xe78d('0x11')]);module[_0xe78d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 65cf241..f9f705f 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 _0x5517=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x4f37fa,_0x583f8b){var _0x43eba2=function(_0x94588b){while(--_0x94588b){_0x4f37fa['push'](_0x4f37fa['shift']());}};_0x43eba2(++_0x583f8b);}(_0x5517,0x159));var _0x7551=function(_0x339e1c,_0x51c267){_0x339e1c=_0x339e1c-0x0;var _0x56d998=_0x5517[_0x339e1c];return _0x56d998;};'use strict';var Sequelize=require(_0x7551('0x0'));module[_0x7551('0x1')]={'type':{'type':Sequelize[_0x7551('0x2')]('string',_0x7551('0x3'),_0x7551('0x4'),'keyValue',_0x7551('0x5')),'defaultValue':_0x7551('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7551('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x7551('0x3'),_0x7551('0x4'))},'keyContent':{'type':Sequelize[_0x7551('0x7')]},'idField':{'type':Sequelize[_0x7551('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7551('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7551('0x7')]}}; \ No newline at end of file +var _0x8b34=['picklist','STRING','ENUM','string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x2499ff,_0x178d70){var _0x3e3e72=function(_0x2f986b){while(--_0x2f986b){_0x2499ff['push'](_0x2499ff['shift']());}};_0x3e3e72(++_0x178d70);}(_0x8b34,0xaf));var _0x48b3=function(_0x45ac5f,_0x41fb25){_0x45ac5f=_0x45ac5f-0x0;var _0x20f83d=_0x8b34[_0x45ac5f];return _0x20f83d;};'use strict';var Sequelize=require(_0x48b3('0x0'));module[_0x48b3('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x48b3('0x2'),_0x48b3('0x3'),_0x48b3('0x4'),_0x48b3('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x48b3('0x6')]},'keyType':{'type':Sequelize[_0x48b3('0x7')](_0x48b3('0x8'),_0x48b3('0x2'),_0x48b3('0x3'))},'keyContent':{'type':Sequelize[_0x48b3('0x6')]},'idField':{'type':Sequelize[_0x48b3('0x6')]},'nameField':{'type':Sequelize[_0x48b3('0x6')]},'customField':{'type':Sequelize[_0x48b3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x48b3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d276f7e..85c7223 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 _0xd5cf=['rows','catch','show','params','length','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','offset','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','findAll'];(function(_0x4a45c6,_0x584aeb){var _0x4b49a7=function(_0x253bbe){while(--_0x253bbe){_0x4a45c6['push'](_0x4a45c6['shift']());}};_0x4b49a7(++_0x584aeb);}(_0xd5cf,0x17e));var _0xfd5c=function(_0x43c601,_0x4ffee0){_0x43c601=_0x43c601-0x0;var _0x1a9369=_0xd5cf[_0x43c601];return _0x1a9369;};'use strict';var emlformat=require(_0xfd5c('0x0'));var rimraf=require(_0xfd5c('0x1'));var zipdir=require(_0xfd5c('0x2'));var jsonpatch=require(_0xfd5c('0x3'));var rp=require(_0xfd5c('0x4'));var moment=require(_0xfd5c('0x5'));var BPromise=require(_0xfd5c('0x6'));var Mustache=require('mustache');var util=require(_0xfd5c('0x7'));var path=require(_0xfd5c('0x8'));var sox=require('sox');var csv=require(_0xfd5c('0x9'));var ejs=require(_0xfd5c('0xa'));var fs=require('fs');var fs_extra=require(_0xfd5c('0xb'));var _=require(_0xfd5c('0xc'));var squel=require(_0xfd5c('0xd'));var crypto=require('crypto');var jsforce=require(_0xfd5c('0xe'));var deskjs=require(_0xfd5c('0xf'));var toCsv=require(_0xfd5c('0x9'));var querystring=require(_0xfd5c('0x10'));var Papa=require(_0xfd5c('0x11'));var Redis=require(_0xfd5c('0x12'));var authService=require(_0xfd5c('0x13'));var qs=require(_0xfd5c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd5c('0x15'));var logger=require('../../config/logger')(_0xfd5c('0x16'));var utils=require('../../config/utils');var config=require(_0xfd5c('0x17'));var licenseUtil=require(_0xfd5c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291991,_0x40eead){_0x40eead=_0x40eead||0xcc;return function(_0x3d2942){if(_0x3d2942){return _0x291991['sendStatus'](_0x40eead);}return _0x291991[_0xfd5c('0x19')](_0x40eead)[_0xfd5c('0x1a')]();};}function respondWithResult(_0x3d88cf,_0x563233){_0x563233=_0x563233||0xc8;return function(_0x1f7d04){if(_0x1f7d04){return _0x3d88cf[_0xfd5c('0x19')](_0x563233)['json'](_0x1f7d04);}};}function respondWithFilteredResult(_0x429db0,_0x5ed6c8){return function(_0x126413){if(_0x126413){var _0x5a490a=typeof _0x5ed6c8[_0xfd5c('0x1b')]==='undefined'&&typeof _0x5ed6c8[_0xfd5c('0x1c')]==='undefined';var _0x33f791=_0x126413[_0xfd5c('0x1d')];var _0x16bb4f=_0x5a490a?0x0:_0x5ed6c8[_0xfd5c('0x1b')];var _0x4fdcc2=_0x5a490a?_0x126413[_0xfd5c('0x1d')]:_0x5ed6c8[_0xfd5c('0x1b')]+_0x5ed6c8['limit'];var _0x45fbc4;if(_0x4fdcc2>=_0x33f791){_0x4fdcc2=_0x33f791;_0x45fbc4=0xc8;}else{_0x45fbc4=0xce;}_0x429db0[_0xfd5c('0x19')](_0x45fbc4);return _0x429db0[_0xfd5c('0x1e')](_0xfd5c('0x1f'),_0x16bb4f+'-'+_0x4fdcc2+'/'+_0x33f791)[_0xfd5c('0x20')](_0x126413);}return null;};}function patchUpdates(_0x1e9183){return function(_0x393896){try{jsonpatch[_0xfd5c('0x21')](_0x393896,_0x1e9183,!![]);}catch(_0x70d7a){return BPromise['reject'](_0x70d7a);}return _0x393896['save']();};}function saveUpdates(_0x1c38d0,_0x2b5efe){return function(_0x1ac3d5){if(_0x1ac3d5){return _0x1ac3d5[_0xfd5c('0x22')](_0x1c38d0)[_0xfd5c('0x23')](function(_0x184b30){return _0x184b30;});}return null;};}function removeEntity(_0x264f7f,_0xa95d46){return function(_0x1de189){if(_0x1de189){return _0x1de189[_0xfd5c('0x24')]()['then'](function(){_0x264f7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x279e2b,_0x13441f){return function(_0x5c87ef){if(!_0x5c87ef){_0x279e2b[_0xfd5c('0x25')](0x194);}return _0x5c87ef;};}function handleError(_0x2a3665,_0x53c9ee){_0x53c9ee=_0x53c9ee||0x1f4;return function(_0x5f3373){logger[_0xfd5c('0x26')](_0x5f3373['stack']);if(_0x5f3373[_0xfd5c('0x27')]){delete _0x5f3373[_0xfd5c('0x27')];}_0x2a3665['status'](_0x53c9ee)[_0xfd5c('0x28')](_0x5f3373);};}exports[_0xfd5c('0x29')]=function(_0x13015c,_0x565bc4){var _0x4bc706={},_0x25e5b0={},_0x314297={'count':0x0,'rows':[]};var _0x22f816=_[_0xfd5c('0x2a')](db['SugarcrmField'][_0xfd5c('0x2b')],function(_0x581fa1){return{'name':_0x581fa1[_0xfd5c('0x2c')],'type':_0x581fa1[_0xfd5c('0x2d')][_0xfd5c('0x2e')]};});_0x25e5b0['model']=_[_0xfd5c('0x2a')](_0x22f816,_0xfd5c('0x27'));_0x25e5b0[_0xfd5c('0x2f')]=_[_0xfd5c('0x30')](_0x13015c['query']);_0x25e5b0[_0xfd5c('0x31')]=_[_0xfd5c('0x32')](_0x25e5b0['model'],_0x25e5b0[_0xfd5c('0x2f')]);_0x4bc706[_0xfd5c('0x33')]=_[_0xfd5c('0x32')](_0x25e5b0[_0xfd5c('0x34')],qs[_0xfd5c('0x35')](_0x13015c[_0xfd5c('0x2f')][_0xfd5c('0x35')]));_0x4bc706[_0xfd5c('0x33')]=_0x4bc706['attributes']['length']?_0x4bc706['attributes']:_0x25e5b0[_0xfd5c('0x34')];if(!_0x13015c[_0xfd5c('0x2f')][_0xfd5c('0x36')](_0xfd5c('0x37'))){_0x4bc706[_0xfd5c('0x1c')]=qs['limit'](_0x13015c[_0xfd5c('0x2f')]['limit']);_0x4bc706[_0xfd5c('0x1b')]=qs[_0xfd5c('0x1b')](_0x13015c['query'][_0xfd5c('0x1b')]);}_0x4bc706[_0xfd5c('0x38')]=qs[_0xfd5c('0x39')](_0x13015c[_0xfd5c('0x2f')][_0xfd5c('0x39')]);_0x4bc706[_0xfd5c('0x3a')]=qs[_0xfd5c('0x31')](_[_0xfd5c('0x3b')](_0x13015c[_0xfd5c('0x2f')],_0x25e5b0[_0xfd5c('0x31')]),_0x22f816);if(_0x13015c['query'][_0xfd5c('0x3c')]){_0x4bc706[_0xfd5c('0x3a')]=_[_0xfd5c('0x3d')](_0x4bc706['where'],{'$or':_[_0xfd5c('0x2a')](_0x22f816,function(_0x15b719){if(_0x15b719[_0xfd5c('0x2d')]!==_0xfd5c('0x3e')){var _0x5978e7={};_0x5978e7[_0x15b719[_0xfd5c('0x27')]]={'$like':'%'+_0x13015c[_0xfd5c('0x2f')][_0xfd5c('0x3c')]+'%'};return _0x5978e7;}})});}_0x4bc706=_[_0xfd5c('0x3d')]({},_0x4bc706,_0x13015c[_0xfd5c('0x3f')]);var _0x4de40a={'where':_0x4bc706[_0xfd5c('0x3a')]};return db[_0xfd5c('0x40')]['count'](_0x4de40a)[_0xfd5c('0x23')](function(_0xa3fd6d){_0x314297[_0xfd5c('0x1d')]=_0xa3fd6d;if(_0x13015c[_0xfd5c('0x2f')][_0xfd5c('0x41')]){_0x4bc706[_0xfd5c('0x42')]=[{'all':!![]}];}return db['SugarcrmField'][_0xfd5c('0x43')](_0x4bc706);})[_0xfd5c('0x23')](function(_0x5857a2){_0x314297[_0xfd5c('0x44')]=_0x5857a2;return _0x314297;})[_0xfd5c('0x23')](respondWithFilteredResult(_0x565bc4,_0x4bc706))[_0xfd5c('0x45')](handleError(_0x565bc4,null));};exports[_0xfd5c('0x46')]=function(_0x2445bc,_0x15761e){var _0x3e4ba8={'raw':!![],'where':{'id':_0x2445bc[_0xfd5c('0x47')]['id']}},_0x432537={};_0x432537[_0xfd5c('0x34')]=_[_0xfd5c('0x30')](db['SugarcrmField'][_0xfd5c('0x2b')]);_0x432537[_0xfd5c('0x2f')]=_['keys'](_0x2445bc[_0xfd5c('0x2f')]);_0x432537[_0xfd5c('0x31')]=_[_0xfd5c('0x32')](_0x432537[_0xfd5c('0x34')],_0x432537[_0xfd5c('0x2f')]);_0x3e4ba8['attributes']=_[_0xfd5c('0x32')](_0x432537[_0xfd5c('0x34')],qs[_0xfd5c('0x35')](_0x2445bc['query']['fields']));_0x3e4ba8[_0xfd5c('0x33')]=_0x3e4ba8['attributes'][_0xfd5c('0x48')]?_0x3e4ba8[_0xfd5c('0x33')]:_0x432537[_0xfd5c('0x34')];if(_0x2445bc[_0xfd5c('0x2f')]['includeAll']){_0x3e4ba8[_0xfd5c('0x42')]=[{'all':!![]}];}_0x3e4ba8=_['merge']({},_0x3e4ba8,_0x2445bc[_0xfd5c('0x3f')]);return db[_0xfd5c('0x40')][_0xfd5c('0x49')](_0x3e4ba8)[_0xfd5c('0x23')](handleEntityNotFound(_0x15761e,null))[_0xfd5c('0x23')](respondWithResult(_0x15761e,null))[_0xfd5c('0x45')](handleError(_0x15761e,null));};exports[_0xfd5c('0x4a')]=function(_0x3f8c58,_0x5eaea7){return db[_0xfd5c('0x40')][_0xfd5c('0x4a')](_0x3f8c58['body'],{})[_0xfd5c('0x23')](respondWithResult(_0x5eaea7,0xc9))['catch'](handleError(_0x5eaea7,null));};exports[_0xfd5c('0x22')]=function(_0x441786,_0x2800c9){if(_0x441786['body']['id']){delete _0x441786['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x441786['params']['id']}})['then'](handleEntityNotFound(_0x2800c9,null))[_0xfd5c('0x23')](saveUpdates(_0x441786['body'],null))['then'](respondWithResult(_0x2800c9,null))['catch'](handleError(_0x2800c9,null));};exports[_0xfd5c('0x24')]=function(_0x10e008,_0x1bd83b){return db[_0xfd5c('0x40')][_0xfd5c('0x49')]({'where':{'id':_0x10e008['params']['id']}})[_0xfd5c('0x23')](handleEntityNotFound(_0x1bd83b,null))['then'](removeEntity(_0x1bd83b,null))[_0xfd5c('0x45')](handleError(_0x1bd83b,null));}; \ No newline at end of file +var _0xfda1=['query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','count','include','findAll','params','includeAll','find','create','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','keys'];(function(_0x341d6b,_0x35657e){var _0x5a3d65=function(_0x434502){while(--_0x434502){_0x341d6b['push'](_0x341d6b['shift']());}};_0x5a3d65(++_0x35657e);}(_0xfda1,0x1d3));var _0x1fda=function(_0x37df6f,_0x51d002){_0x37df6f=_0x37df6f-0x0;var _0x87e89b=_0xfda1[_0x37df6f];return _0x87e89b;};'use strict';var emlformat=require(_0x1fda('0x0'));var rimraf=require(_0x1fda('0x1'));var zipdir=require(_0x1fda('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fda('0x3'));var moment=require(_0x1fda('0x4'));var BPromise=require(_0x1fda('0x5'));var Mustache=require('mustache');var util=require(_0x1fda('0x6'));var path=require('path');var sox=require(_0x1fda('0x7'));var csv=require(_0x1fda('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fda('0x9'));var _=require(_0x1fda('0xa'));var squel=require(_0x1fda('0xb'));var crypto=require('crypto');var jsforce=require(_0x1fda('0xc'));var deskjs=require(_0x1fda('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1fda('0xe'));var Papa=require(_0x1fda('0xf'));var Redis=require(_0x1fda('0x10'));var authService=require(_0x1fda('0x11'));var qs=require(_0x1fda('0x12'));var as=require(_0x1fda('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fda('0x14'))(_0x1fda('0x15'));var utils=require(_0x1fda('0x16'));var config=require(_0x1fda('0x17'));var licenseUtil=require(_0x1fda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18e0f2,_0x1a3254){_0x1a3254=_0x1a3254||0xcc;return function(_0x4d9690){if(_0x4d9690){return _0x18e0f2[_0x1fda('0x19')](_0x1a3254);}return _0x18e0f2[_0x1fda('0x1a')](_0x1a3254)[_0x1fda('0x1b')]();};}function respondWithResult(_0x3e68d9,_0x3a652e){_0x3a652e=_0x3a652e||0xc8;return function(_0x3f84d1){if(_0x3f84d1){return _0x3e68d9[_0x1fda('0x1a')](_0x3a652e)[_0x1fda('0x1c')](_0x3f84d1);}};}function respondWithFilteredResult(_0x2644d3,_0x53f0de){return function(_0x1d8080){if(_0x1d8080){var _0x5f0f0f=typeof _0x53f0de[_0x1fda('0x1d')]==='undefined'&&typeof _0x53f0de[_0x1fda('0x1e')]===_0x1fda('0x1f');var _0x5cc8b2=_0x1d8080['count'];var _0x4666ec=_0x5f0f0f?0x0:_0x53f0de[_0x1fda('0x1d')];var _0x528251=_0x5f0f0f?_0x1d8080['count']:_0x53f0de['offset']+_0x53f0de[_0x1fda('0x1e')];var _0x47c321;if(_0x528251>=_0x5cc8b2){_0x528251=_0x5cc8b2;_0x47c321=0xc8;}else{_0x47c321=0xce;}_0x2644d3[_0x1fda('0x1a')](_0x47c321);return _0x2644d3[_0x1fda('0x20')](_0x1fda('0x21'),_0x4666ec+'-'+_0x528251+'/'+_0x5cc8b2)['json'](_0x1d8080);}return null;};}function patchUpdates(_0x331e75){return function(_0xd78374){try{jsonpatch[_0x1fda('0x22')](_0xd78374,_0x331e75,!![]);}catch(_0x5205e3){return BPromise['reject'](_0x5205e3);}return _0xd78374[_0x1fda('0x23')]();};}function saveUpdates(_0x1086f0,_0x41eefe){return function(_0x2ac9f4){if(_0x2ac9f4){return _0x2ac9f4[_0x1fda('0x24')](_0x1086f0)['then'](function(_0x43dcac){return _0x43dcac;});}return null;};}function removeEntity(_0x20a3a2,_0x194122){return function(_0x552350){if(_0x552350){return _0x552350[_0x1fda('0x25')]()[_0x1fda('0x26')](function(){_0x20a3a2['status'](0xcc)[_0x1fda('0x1b')]();});}};}function handleEntityNotFound(_0x8c0d24,_0xe698db){return function(_0x4dfd78){if(!_0x4dfd78){_0x8c0d24['sendStatus'](0x194);}return _0x4dfd78;};}function handleError(_0x35c537,_0x406982){_0x406982=_0x406982||0x1f4;return function(_0x342b0d){logger['error'](_0x342b0d[_0x1fda('0x27')]);if(_0x342b0d[_0x1fda('0x28')]){delete _0x342b0d[_0x1fda('0x28')];}_0x35c537[_0x1fda('0x1a')](_0x406982)[_0x1fda('0x29')](_0x342b0d);};}exports[_0x1fda('0x2a')]=function(_0x2bc942,_0x2e5d55){var _0x48d20a={},_0x5c258c={},_0x4ab0cc={'count':0x0,'rows':[]};var _0x4341d5=_['map'](db[_0x1fda('0x2b')][_0x1fda('0x2c')],function(_0x12aabc){return{'name':_0x12aabc[_0x1fda('0x2d')],'type':_0x12aabc[_0x1fda('0x2e')][_0x1fda('0x2f')]};});_0x5c258c[_0x1fda('0x30')]=_[_0x1fda('0x31')](_0x4341d5,_0x1fda('0x28'));_0x5c258c['query']=_[_0x1fda('0x32')](_0x2bc942[_0x1fda('0x33')]);_0x5c258c[_0x1fda('0x34')]=_[_0x1fda('0x35')](_0x5c258c[_0x1fda('0x30')],_0x5c258c['query']);_0x48d20a['attributes']=_[_0x1fda('0x35')](_0x5c258c[_0x1fda('0x30')],qs[_0x1fda('0x36')](_0x2bc942[_0x1fda('0x33')][_0x1fda('0x36')]));_0x48d20a['attributes']=_0x48d20a['attributes'][_0x1fda('0x37')]?_0x48d20a[_0x1fda('0x38')]:_0x5c258c['model'];if(!_0x2bc942[_0x1fda('0x33')][_0x1fda('0x39')](_0x1fda('0x3a'))){_0x48d20a[_0x1fda('0x1e')]=qs['limit'](_0x2bc942[_0x1fda('0x33')][_0x1fda('0x1e')]);_0x48d20a[_0x1fda('0x1d')]=qs[_0x1fda('0x1d')](_0x2bc942[_0x1fda('0x33')][_0x1fda('0x1d')]);}_0x48d20a['order']=qs[_0x1fda('0x3b')](_0x2bc942[_0x1fda('0x33')]['sort']);_0x48d20a['where']=qs[_0x1fda('0x34')](_[_0x1fda('0x3c')](_0x2bc942[_0x1fda('0x33')],_0x5c258c[_0x1fda('0x34')]),_0x4341d5);if(_0x2bc942[_0x1fda('0x33')]['filter']){_0x48d20a[_0x1fda('0x3d')]=_[_0x1fda('0x3e')](_0x48d20a['where'],{'$or':_[_0x1fda('0x31')](_0x4341d5,function(_0x4e0882){if(_0x4e0882['type']!=='VIRTUAL'){var _0x27d7c0={};_0x27d7c0[_0x4e0882[_0x1fda('0x28')]]={'$like':'%'+_0x2bc942[_0x1fda('0x33')][_0x1fda('0x3f')]+'%'};return _0x27d7c0;}})});}_0x48d20a=_[_0x1fda('0x3e')]({},_0x48d20a,_0x2bc942[_0x1fda('0x40')]);var _0x591087={'where':_0x48d20a['where']};return db[_0x1fda('0x2b')][_0x1fda('0x41')](_0x591087)[_0x1fda('0x26')](function(_0x27d96f){_0x4ab0cc[_0x1fda('0x41')]=_0x27d96f;if(_0x2bc942[_0x1fda('0x33')]['includeAll']){_0x48d20a[_0x1fda('0x42')]=[{'all':!![]}];}return db[_0x1fda('0x2b')][_0x1fda('0x43')](_0x48d20a);})[_0x1fda('0x26')](function(_0x347436){_0x4ab0cc['rows']=_0x347436;return _0x4ab0cc;})[_0x1fda('0x26')](respondWithFilteredResult(_0x2e5d55,_0x48d20a))['catch'](handleError(_0x2e5d55,null));};exports['show']=function(_0x42c1a4,_0x2c6157){var _0x28a111={'raw':!![],'where':{'id':_0x42c1a4[_0x1fda('0x44')]['id']}},_0x413522={};_0x413522[_0x1fda('0x30')]=_[_0x1fda('0x32')](db['SugarcrmField'][_0x1fda('0x2c')]);_0x413522[_0x1fda('0x33')]=_[_0x1fda('0x32')](_0x42c1a4[_0x1fda('0x33')]);_0x413522[_0x1fda('0x34')]=_['intersection'](_0x413522['model'],_0x413522[_0x1fda('0x33')]);_0x28a111[_0x1fda('0x38')]=_[_0x1fda('0x35')](_0x413522[_0x1fda('0x30')],qs['fields'](_0x42c1a4[_0x1fda('0x33')][_0x1fda('0x36')]));_0x28a111['attributes']=_0x28a111['attributes'][_0x1fda('0x37')]?_0x28a111[_0x1fda('0x38')]:_0x413522['model'];if(_0x42c1a4[_0x1fda('0x33')][_0x1fda('0x45')]){_0x28a111[_0x1fda('0x42')]=[{'all':!![]}];}_0x28a111=_[_0x1fda('0x3e')]({},_0x28a111,_0x42c1a4[_0x1fda('0x40')]);return db[_0x1fda('0x2b')][_0x1fda('0x46')](_0x28a111)[_0x1fda('0x26')](handleEntityNotFound(_0x2c6157,null))[_0x1fda('0x26')](respondWithResult(_0x2c6157,null))['catch'](handleError(_0x2c6157,null));};exports[_0x1fda('0x47')]=function(_0x174a91,_0x199991){return db['SugarcrmField'][_0x1fda('0x47')](_0x174a91['body'],{})[_0x1fda('0x26')](respondWithResult(_0x199991,0xc9))[_0x1fda('0x48')](handleError(_0x199991,null));};exports[_0x1fda('0x24')]=function(_0x4bf2f9,_0xf38c60){if(_0x4bf2f9[_0x1fda('0x49')]['id']){delete _0x4bf2f9[_0x1fda('0x49')]['id'];}return db[_0x1fda('0x2b')][_0x1fda('0x46')]({'where':{'id':_0x4bf2f9['params']['id']}})['then'](handleEntityNotFound(_0xf38c60,null))['then'](saveUpdates(_0x4bf2f9[_0x1fda('0x49')],null))[_0x1fda('0x26')](respondWithResult(_0xf38c60,null))[_0x1fda('0x48')](handleError(_0xf38c60,null));};exports['destroy']=function(_0x51fd8c,_0xf0dfa8){return db[_0x1fda('0x2b')]['find']({'where':{'id':_0x51fd8c[_0x1fda('0x44')]['id']}})[_0x1fda('0x26')](handleEntityNotFound(_0xf0dfa8,null))[_0x1fda('0x26')](removeEntity(_0xf0dfa8,null))[_0x1fda('0x48')](handleError(_0xf0dfa8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c14e6f9..8a3b2f3 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 _0x5f11=['sugarcrm_unique_index','idField','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x35a088,_0x2a668d){var _0x1ead4a=function(_0x358d79){while(--_0x358d79){_0x35a088['push'](_0x35a088['shift']());}};_0x1ead4a(++_0x2a668d);}(_0x5f11,0xc6));var _0x15f1=function(_0x24f4df,_0x2eba9e){_0x24f4df=_0x24f4df-0x0;var _0x4025db=_0x5f11[_0x24f4df];return _0x4025db;};'use strict';var _=require(_0x15f1('0x0'));var util=require('util');var logger=require(_0x15f1('0x1'))(_0x15f1('0x2'));var moment=require('moment');var BPromise=require(_0x15f1('0x3'));var rp=require(_0x15f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15f1('0x5'));var config=require(_0x15f1('0x6'));var attributes=require(_0x15f1('0x7'));module[_0x15f1('0x8')]=function(_0x5eaeab,_0x10a174){return _0x5eaeab[_0x15f1('0x9')](_0x15f1('0xa'),attributes,{'tableName':_0x15f1('0xb'),'paranoid':![],'indexes':[{'name':_0x15f1('0xc'),'fields':[_0x15f1('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd0=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SugarcrmField','sugarcrm_unique_index','idField','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2cd0,0xc2));var _0x02cd=function(_0x321ee3,_0x627274){_0x321ee3=_0x321ee3-0x0;var _0x2bc44f=_0x2cd0[_0x321ee3];return _0x2bc44f;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var logger=require(_0x02cd('0x2'))(_0x02cd('0x3'));var moment=require(_0x02cd('0x4'));var BPromise=require('bluebird');var rp=require(_0x02cd('0x5'));var fs=require('fs');var path=require(_0x02cd('0x6'));var rimraf=require(_0x02cd('0x7'));var config=require(_0x02cd('0x8'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x1b1f21,_0x580c61){return _0x1b1f21[_0x02cd('0x9')](_0x02cd('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x02cd('0xb'),'fields':[_0x02cd('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index b866683..562e787 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 _0x847a=['SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x847a,0xf5));var _0xa847=function(_0x5882c5,_0x17b5e9){_0x5882c5=_0x5882c5-0x0;var _0x59dd45=_0x847a[_0x5882c5];return _0x59dd45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa847('0x0'));var BPromise=require(_0xa847('0x1'));var rs=require(_0xa847('0x2'));var fs=require('fs');var Redis=require(_0xa847('0x3'));var db=require(_0xa847('0x4'))['db'];var utils=require(_0xa847('0x5'));var logger=require(_0xa847('0x6'))('rpc');var config=require(_0xa847('0x7'));var jayson=require(_0xa847('0x8'));var client=jayson[_0xa847('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377825,_0x1ae446,_0x29728e){return new BPromise(function(_0x4b55d6,_0x25c8d8){return client[_0xa847('0xa')](_0x377825,_0x29728e)[_0xa847('0xb')](function(_0x96ba1f){logger['info'](_0xa847('0xc'),_0x1ae446,_0xa847('0xd'));logger[_0xa847('0xe')](_0xa847('0xf'),_0x1ae446,'request\x20sent',JSON['stringify'](_0x96ba1f));if(_0x96ba1f[_0xa847('0x10')]){if(_0x96ba1f[_0xa847('0x10')][_0xa847('0x11')]===0x1f4){logger['error'](_0xa847('0xc'),_0x1ae446,_0x96ba1f[_0xa847('0x10')][_0xa847('0x12')]);return _0x25c8d8(_0x96ba1f[_0xa847('0x10')][_0xa847('0x12')]);}logger['error'](_0xa847('0xc'),_0x1ae446,_0x96ba1f[_0xa847('0x10')][_0xa847('0x12')]);return _0x4b55d6(_0x96ba1f[_0xa847('0x10')][_0xa847('0x12')]);}else{logger[_0xa847('0x13')](_0xa847('0xc'),_0x1ae446,_0xa847('0xd'));_0x4b55d6(_0x96ba1f['result'][_0xa847('0x12')]);}})['catch'](function(_0x3cd77c){logger[_0xa847('0x10')](_0xa847('0xc'),_0x1ae446,_0x3cd77c);_0x25c8d8(_0x3cd77c);});});} \ No newline at end of file +var _0xaed9=['../../config/logger','../../config/environment','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xe965c5,_0x246139){var _0x4a0f4c=function(_0x266fc8){while(--_0x266fc8){_0xe965c5['push'](_0xe965c5['shift']());}};_0x4a0f4c(++_0x246139);}(_0xaed9,0x158));var _0x9aed=function(_0x504678,_0x3b8a96){_0x504678=_0x504678-0x0;var _0x289bf8=_0xaed9[_0x504678];return _0x289bf8;};'use strict';var _=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var moment=require(_0x9aed('0x2'));var BPromise=require(_0x9aed('0x3'));var rs=require(_0x9aed('0x4'));var fs=require('fs');var Redis=require(_0x9aed('0x5'));var db=require(_0x9aed('0x6'))['db'];var utils=require(_0x9aed('0x7'));var logger=require(_0x9aed('0x8'))('rpc');var config=require(_0x9aed('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9aed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5654ef,_0x30596f,_0xc47cc){return new BPromise(function(_0x2012fe,_0x5ec7d0){return client[_0x9aed('0xb')](_0x5654ef,_0xc47cc)[_0x9aed('0xc')](function(_0x5dfea1){logger['info'](_0x9aed('0xd'),_0x30596f,_0x9aed('0xe'));logger[_0x9aed('0xf')](_0x9aed('0x10'),_0x30596f,_0x9aed('0xe'),JSON[_0x9aed('0x11')](_0x5dfea1));if(_0x5dfea1['error']){if(_0x5dfea1['error']['code']===0x1f4){logger[_0x9aed('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x30596f,_0x5dfea1[_0x9aed('0x12')][_0x9aed('0x13')]);return _0x5ec7d0(_0x5dfea1[_0x9aed('0x12')]['message']);}logger[_0x9aed('0x12')](_0x9aed('0xd'),_0x30596f,_0x5dfea1[_0x9aed('0x12')][_0x9aed('0x13')]);return _0x2012fe(_0x5dfea1[_0x9aed('0x12')][_0x9aed('0x13')]);}else{logger['info'](_0x9aed('0xd'),_0x30596f,_0x9aed('0xe'));_0x2012fe(_0x5dfea1[_0x9aed('0x14')]['message']);}})[_0x9aed('0x15')](function(_0x2b43f4){logger['error'](_0x9aed('0xd'),_0x30596f,_0x2b43f4);_0x5ec7d0(_0x2b43f4);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 30fc134..5edfe70 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 _0x2e3b=['/:id/fields','getFields','create','post','addConfiguration','put','delete','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x2e3b,0x81));var _0xb2e3=function(_0x37f5c9,_0x5e654a){_0x37f5c9=_0x37f5c9-0x0;var _0x592258=_0x2e3b[_0x37f5c9];return _0x592258;};'use strict';var multer=require('multer');var util=require(_0xb2e3('0x0'));var path=require(_0xb2e3('0x1'));var timeout=require(_0xb2e3('0x2'));var express=require(_0xb2e3('0x3'));var router=express[_0xb2e3('0x4')]();var fs_extra=require(_0xb2e3('0x5'));var auth=require(_0xb2e3('0x6'));var interaction=require(_0xb2e3('0x7'));var config=require('../../config/environment');var controller=require(_0xb2e3('0x8'));router[_0xb2e3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2e3('0xa')]);router[_0xb2e3('0x9')]('/:id',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xc')]);router['get'](_0xb2e3('0xd'),auth[_0xb2e3('0xb')](),controller[_0xb2e3('0xe')]);router[_0xb2e3('0x9')](_0xb2e3('0xf'),auth['isAuthenticated'](),controller[_0xb2e3('0x10')]);router['post']('/',auth[_0xb2e3('0xb')](),controller[_0xb2e3('0x11')]);router[_0xb2e3('0x12')](_0xb2e3('0xd'),auth[_0xb2e3('0xb')](),controller[_0xb2e3('0x13')]);router[_0xb2e3('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb2e3('0x15')](_0xb2e3('0x16'),auth[_0xb2e3('0xb')](),controller[_0xb2e3('0x17')]);module['exports']=router; \ No newline at end of file +var _0xbb53=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getConfigurations','create','/:id/configurations','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5615e9,_0x2e23ae){var _0x44e14b=function(_0x3c8164){while(--_0x3c8164){_0x5615e9['push'](_0x5615e9['shift']());}};_0x44e14b(++_0x2e23ae);}(_0xbb53,0x121));var _0x3bb5=function(_0x25efd2,_0x22ff9d){_0x25efd2=_0x25efd2-0x0;var _0x507e82=_0xbb53[_0x25efd2];return _0x507e82;};'use strict';var multer=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var path=require(_0x3bb5('0x2'));var timeout=require(_0x3bb5('0x3'));var express=require(_0x3bb5('0x4'));var router=express[_0x3bb5('0x5')]();var fs_extra=require(_0x3bb5('0x6'));var auth=require(_0x3bb5('0x7'));var interaction=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xb')]);router[_0x3bb5('0xc')](_0x3bb5('0xd'),auth[_0x3bb5('0xa')](),controller['show']);router['get']('/:id/configurations',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xe')]);router[_0x3bb5('0xc')]('/:id/fields',auth[_0x3bb5('0xa')](),controller['getFields']);router['post']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xf')]);router['post'](_0x3bb5('0x10'),auth['isAuthenticated'](),controller[_0x3bb5('0x11')]);router['put']('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x12')]);router[_0x3bb5('0x13')]('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d370a9b..ed0c130 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 _0x7cab=['HelpDesk','sequelize','STRING'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x7cab,0x1db));var _0xb7ca=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x7cab[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0xb7ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xb7ca('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb7ca('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb7ca('0x1')],'allowNull':![],'defaultValue':_0xb7ca('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb7ca('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb7ca('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2d5e=['STRING','sequelize'];(function(_0x5bd346,_0x5f0430){var _0x425c2c=function(_0x2145eb){while(--_0x2145eb){_0x5bd346['push'](_0x5bd346['shift']());}};_0x425c2c(++_0x5f0430);}(_0x2d5e,0x7f));var _0xe2d5=function(_0x494937,_0x34884a){_0x494937=_0x494937-0x0;var _0xf3fadf=_0x2d5e[_0x494937];return _0xf3fadf;};'use strict';var Sequelize=require(_0xe2d5('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe2d5('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'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 908a775..66821c9 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 _0xb8ef=['end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','VtigerAccount','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','params','length','find','catch','create','body','destroy','getConfigurations','VtigerConfiguration','rawAttributes','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8ef,0x156));var _0xfb8e=function(_0x20f87f,_0x26ba32){_0x20f87f=_0x20f87f-0x0;var _0x322b2b=_0xb8ef[_0x20f87f];return _0x322b2b;};'use strict';var emlformat=require(_0xfb8e('0x0'));var rimraf=require(_0xfb8e('0x1'));var zipdir=require(_0xfb8e('0x2'));var jsonpatch=require(_0xfb8e('0x3'));var rp=require(_0xfb8e('0x4'));var moment=require(_0xfb8e('0x5'));var BPromise=require(_0xfb8e('0x6'));var Mustache=require('mustache');var util=require(_0xfb8e('0x7'));var path=require(_0xfb8e('0x8'));var sox=require(_0xfb8e('0x9'));var csv=require(_0xfb8e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb8e('0xb'));var _=require(_0xfb8e('0xc'));var squel=require(_0xfb8e('0xd'));var crypto=require(_0xfb8e('0xe'));var jsforce=require(_0xfb8e('0xf'));var deskjs=require(_0xfb8e('0x10'));var toCsv=require(_0xfb8e('0xa'));var querystring=require(_0xfb8e('0x11'));var Papa=require(_0xfb8e('0x12'));var Redis=require(_0xfb8e('0x13'));var authService=require(_0xfb8e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfb8e('0x15'));var hardwareService=require(_0xfb8e('0x16'));var logger=require(_0xfb8e('0x17'))(_0xfb8e('0x18'));var utils=require('../../config/utils');var config=require(_0xfb8e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb8e('0x1a'))['db'];var integrations=require(_0xfb8e('0x1b'));function respondWithStatusCode(_0x279fcc,_0x4d0e08){_0x4d0e08=_0x4d0e08||0xcc;return function(_0x127c1b){if(_0x127c1b){return _0x279fcc[_0xfb8e('0x1c')](_0x4d0e08);}return _0x279fcc[_0xfb8e('0x1d')](_0x4d0e08)[_0xfb8e('0x1e')]();};}function respondWithResult(_0x46cc39,_0x1c80c3){_0x1c80c3=_0x1c80c3||0xc8;return function(_0x868faf){if(_0x868faf){return _0x46cc39['status'](_0x1c80c3)[_0xfb8e('0x1f')](_0x868faf);}};}function respondWithFilteredResult(_0x5bec8d,_0x23916b){return function(_0x274884){if(_0x274884){var _0x7fd1b3=typeof _0x23916b['offset']===_0xfb8e('0x20')&&typeof _0x23916b['limit']===_0xfb8e('0x20');var _0x2086ad=_0x274884[_0xfb8e('0x21')];var _0x240f78=_0x7fd1b3?0x0:_0x23916b[_0xfb8e('0x22')];var _0x451214=_0x7fd1b3?_0x274884['count']:_0x23916b[_0xfb8e('0x22')]+_0x23916b[_0xfb8e('0x23')];var _0x52510f;if(_0x451214>=_0x2086ad){_0x451214=_0x2086ad;_0x52510f=0xc8;}else{_0x52510f=0xce;}_0x5bec8d[_0xfb8e('0x1d')](_0x52510f);return _0x5bec8d[_0xfb8e('0x24')](_0xfb8e('0x25'),_0x240f78+'-'+_0x451214+'/'+_0x2086ad)[_0xfb8e('0x1f')](_0x274884);}return null;};}function patchUpdates(_0x26befc){return function(_0x256f78){try{jsonpatch[_0xfb8e('0x26')](_0x256f78,_0x26befc,!![]);}catch(_0x1a9b77){return BPromise[_0xfb8e('0x27')](_0x1a9b77);}return _0x256f78[_0xfb8e('0x28')]();};}function saveUpdates(_0x3eda64,_0x42fc34){return function(_0xe5c188){if(_0xe5c188){return _0xe5c188[_0xfb8e('0x29')](_0x3eda64)[_0xfb8e('0x2a')](function(_0x12b67c){return _0x12b67c;});}return null;};}function removeEntity(_0x5d05f9,_0x527a76){return function(_0x5c34b9){if(_0x5c34b9){return _0x5c34b9['destroy']()['then'](function(){_0x5d05f9['status'](0xcc)[_0xfb8e('0x1e')]();});}};}function handleEntityNotFound(_0x30610a,_0x5616ed){return function(_0x2f8ed3){if(!_0x2f8ed3){_0x30610a[_0xfb8e('0x1c')](0x194);}return _0x2f8ed3;};}function handleError(_0x2618de,_0x188ba0){_0x188ba0=_0x188ba0||0x1f4;return function(_0x586b09){logger[_0xfb8e('0x2b')](_0x586b09[_0xfb8e('0x2c')]);if(_0x586b09[_0xfb8e('0x2d')]){delete _0x586b09[_0xfb8e('0x2d')];}_0x2618de[_0xfb8e('0x1d')](_0x188ba0)['send'](_0x586b09);};}exports['index']=function(_0x15a945,_0x2d6ac){var _0xec8fac={},_0x4145d4={},_0x1d5b07={'count':0x0,'rows':[]};var _0x2266ed=_[_0xfb8e('0x2e')](db[_0xfb8e('0x2f')]['rawAttributes'],function(_0x389b31){return{'name':_0x389b31[_0xfb8e('0x30')],'type':_0x389b31['type']['key']};});_0x4145d4[_0xfb8e('0x31')]=_[_0xfb8e('0x2e')](_0x2266ed,_0xfb8e('0x2d'));_0x4145d4[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x15a945[_0xfb8e('0x32')]);_0x4145d4[_0xfb8e('0x34')]=_['intersection'](_0x4145d4[_0xfb8e('0x31')],_0x4145d4['query']);_0xec8fac[_0xfb8e('0x35')]=_[_0xfb8e('0x36')](_0x4145d4['model'],qs['fields'](_0x15a945[_0xfb8e('0x32')][_0xfb8e('0x37')]));_0xec8fac[_0xfb8e('0x35')]=_0xec8fac[_0xfb8e('0x35')]['length']?_0xec8fac[_0xfb8e('0x35')]:_0x4145d4[_0xfb8e('0x31')];if(!_0x15a945[_0xfb8e('0x32')][_0xfb8e('0x38')]('nolimit')){_0xec8fac[_0xfb8e('0x23')]=qs[_0xfb8e('0x23')](_0x15a945[_0xfb8e('0x32')]['limit']);_0xec8fac[_0xfb8e('0x22')]=qs[_0xfb8e('0x22')](_0x15a945['query']['offset']);}_0xec8fac[_0xfb8e('0x39')]=qs[_0xfb8e('0x3a')](_0x15a945[_0xfb8e('0x32')]['sort']);_0xec8fac[_0xfb8e('0x3b')]=qs[_0xfb8e('0x34')](_['pick'](_0x15a945[_0xfb8e('0x32')],_0x4145d4['filters']),_0x2266ed);if(_0x15a945[_0xfb8e('0x32')][_0xfb8e('0x3c')]){_0xec8fac[_0xfb8e('0x3b')]=_['merge'](_0xec8fac[_0xfb8e('0x3b')],{'$or':_['map'](_0x2266ed,function(_0x2536e1){if(_0x2536e1['type']!=='VIRTUAL'){var _0x2c59ad={};_0x2c59ad[_0x2536e1[_0xfb8e('0x2d')]]={'$like':'%'+_0x15a945[_0xfb8e('0x32')][_0xfb8e('0x3c')]+'%'};return _0x2c59ad;}})});}_0xec8fac=_[_0xfb8e('0x3d')]({},_0xec8fac,_0x15a945[_0xfb8e('0x3e')]);var _0x504feb={'where':_0xec8fac[_0xfb8e('0x3b')]};return db[_0xfb8e('0x2f')][_0xfb8e('0x21')](_0x504feb)['then'](function(_0x373d14){_0x1d5b07[_0xfb8e('0x21')]=_0x373d14;if(_0x15a945['query'][_0xfb8e('0x3f')]){_0xec8fac['include']=[{'all':!![]}];}return db[_0xfb8e('0x2f')][_0xfb8e('0x40')](_0xec8fac);})[_0xfb8e('0x2a')](function(_0x3fed13){_0x1d5b07[_0xfb8e('0x41')]=_0x3fed13;return _0x1d5b07;})[_0xfb8e('0x2a')](respondWithFilteredResult(_0x2d6ac,_0xec8fac))['catch'](handleError(_0x2d6ac,null));};exports['show']=function(_0x2462ab,_0xd36a63){var _0x3001dd={'raw':![],'where':{'id':_0x2462ab[_0xfb8e('0x42')]['id']}},_0x4242d2={};_0x4242d2['model']=_['keys'](db[_0xfb8e('0x2f')]['rawAttributes']);_0x4242d2['query']=_[_0xfb8e('0x33')](_0x2462ab[_0xfb8e('0x32')]);_0x4242d2[_0xfb8e('0x34')]=_[_0xfb8e('0x36')](_0x4242d2['model'],_0x4242d2[_0xfb8e('0x32')]);_0x3001dd['attributes']=_[_0xfb8e('0x36')](_0x4242d2['model'],qs[_0xfb8e('0x37')](_0x2462ab['query'][_0xfb8e('0x37')]));_0x3001dd[_0xfb8e('0x35')]=_0x3001dd['attributes'][_0xfb8e('0x43')]?_0x3001dd[_0xfb8e('0x35')]:_0x4242d2['model'];if(_0x2462ab['query']['includeAll']){_0x3001dd['include']=[{'all':!![]}];}_0x3001dd=_[_0xfb8e('0x3d')]({},_0x3001dd,_0x2462ab['options']);return db['VtigerAccount'][_0xfb8e('0x44')](_0x3001dd)['then'](handleEntityNotFound(_0xd36a63,null))[_0xfb8e('0x2a')](respondWithResult(_0xd36a63,null))[_0xfb8e('0x45')](handleError(_0xd36a63,null));};exports[_0xfb8e('0x46')]=function(_0x2c453b,_0x599682){return db[_0xfb8e('0x2f')][_0xfb8e('0x46')](_0x2c453b[_0xfb8e('0x47')],{})[_0xfb8e('0x2a')](respondWithResult(_0x599682,0xc9))[_0xfb8e('0x45')](handleError(_0x599682,null));};exports[_0xfb8e('0x29')]=function(_0x599a26,_0x28691d){if(_0x599a26[_0xfb8e('0x47')]['id']){delete _0x599a26[_0xfb8e('0x47')]['id'];}return db[_0xfb8e('0x2f')]['find']({'where':{'id':_0x599a26[_0xfb8e('0x42')]['id']}})[_0xfb8e('0x2a')](handleEntityNotFound(_0x28691d,null))[_0xfb8e('0x2a')](saveUpdates(_0x599a26[_0xfb8e('0x47')],null))[_0xfb8e('0x2a')](respondWithResult(_0x28691d,null))[_0xfb8e('0x45')](handleError(_0x28691d,null));};exports[_0xfb8e('0x48')]=function(_0x111583,_0x3de86a){return db[_0xfb8e('0x2f')][_0xfb8e('0x44')]({'where':{'id':_0x111583['params']['id']}})[_0xfb8e('0x2a')](handleEntityNotFound(_0x3de86a,null))[_0xfb8e('0x2a')](removeEntity(_0x3de86a,null))['catch'](handleError(_0x3de86a,null));};exports[_0xfb8e('0x49')]=function(_0x1d6d02,_0x45870e,_0x3c34cf){var _0x264b3f={};var _0x3b3824={};var _0x442662;var _0x10c946;return db[_0xfb8e('0x2f')]['findOne']({'where':{'id':_0x1d6d02[_0xfb8e('0x42')]['id']}})[_0xfb8e('0x2a')](handleEntityNotFound(_0x45870e,null))[_0xfb8e('0x2a')](function(_0x244eab){if(_0x244eab){_0x442662=_0x244eab;_0x3b3824[_0xfb8e('0x31')]=_['keys'](db[_0xfb8e('0x4a')][_0xfb8e('0x4b')]);_0x3b3824[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x1d6d02[_0xfb8e('0x32')]);_0x3b3824[_0xfb8e('0x34')]=_[_0xfb8e('0x36')](_0x3b3824['model'],_0x3b3824[_0xfb8e('0x32')]);_0x264b3f[_0xfb8e('0x35')]=_[_0xfb8e('0x36')](_0x3b3824[_0xfb8e('0x31')],qs[_0xfb8e('0x37')](_0x1d6d02[_0xfb8e('0x32')][_0xfb8e('0x37')]));_0x264b3f['attributes']=_0x264b3f['attributes'][_0xfb8e('0x43')]?_0x264b3f[_0xfb8e('0x35')]:_0x3b3824[_0xfb8e('0x31')];_0x264b3f['order']=qs['sort'](_0x1d6d02[_0xfb8e('0x32')][_0xfb8e('0x3a')]);_0x264b3f[_0xfb8e('0x3b')]=qs['filters'](_[_0xfb8e('0x4c')](_0x1d6d02[_0xfb8e('0x32')],_0x3b3824['filters']));if(_0x1d6d02[_0xfb8e('0x32')]['filter']){_0x264b3f[_0xfb8e('0x3b')]=_[_0xfb8e('0x3d')](_0x264b3f[_0xfb8e('0x3b')],{'$or':_['map'](_0x264b3f[_0xfb8e('0x35')],function(_0x4c92bc){var _0x368d94={};_0x368d94[_0x4c92bc]={'$like':'%'+_0x1d6d02['query']['filter']+'%'};return _0x368d94;})});}_0x264b3f=_['merge']({},_0x264b3f,_0x1d6d02['options']);return _0x442662[_0xfb8e('0x49')](_0x264b3f);}})[_0xfb8e('0x2a')](function(_0x2942f7){if(_0x2942f7){_0x10c946=_0x2942f7['length'];if(!_0x1d6d02['query'][_0xfb8e('0x38')]('nolimit')){_0x264b3f[_0xfb8e('0x23')]=qs[_0xfb8e('0x23')](_0x1d6d02[_0xfb8e('0x32')]['limit']);_0x264b3f[_0xfb8e('0x22')]=qs[_0xfb8e('0x22')](_0x1d6d02['query']['offset']);}return _0x442662[_0xfb8e('0x49')](_0x264b3f);}})['then'](function(_0x3544f4){if(_0x3544f4){return _0x3544f4?{'count':_0x10c946,'rows':_0x3544f4}:null;}})[_0xfb8e('0x2a')](respondWithResult(_0x45870e,null))[_0xfb8e('0x45')](handleError(_0x45870e,null));};exports[_0xfb8e('0x4d')]=function(_0xa5c61e,_0xcf6e4a,_0x5474d0){if(_0xa5c61e[_0xfb8e('0x47')]['id']){delete _0xa5c61e['body']['id'];}return db[_0xfb8e('0x2f')][_0xfb8e('0x4e')]({'where':{'id':_0xa5c61e[_0xfb8e('0x42')]['id']}})[_0xfb8e('0x2a')](handleEntityNotFound(_0xcf6e4a,null))['then'](function(_0x44bf3a){if(_0x44bf3a){_0xa5c61e[_0xfb8e('0x47')][_0xfb8e('0x4f')]=_0x44bf3a['id'];_0xa5c61e[_0xfb8e('0x47')][_0xfb8e('0x50')]=integrations[_0xfb8e('0x51')](_0xa5c61e[_0xfb8e('0x47')]['channel'],_0xa5c61e[_0xfb8e('0x47')][_0xfb8e('0x52')]);_0xa5c61e['body'][_0xfb8e('0x53')]=integrations[_0xfb8e('0x54')](_0xa5c61e['body'][_0xfb8e('0x55')],_0xa5c61e[_0xfb8e('0x47')][_0xfb8e('0x52')]);return db[_0xfb8e('0x4a')]['create'](_0xa5c61e[_0xfb8e('0x47')],{'include':[{'model':db[_0xfb8e('0x56')],'as':'Subjects'},{'model':db[_0xfb8e('0x56')],'as':_0xfb8e('0x53')}]});}return null;})[_0xfb8e('0x2a')](respondWithResult(_0xcf6e4a,null))[_0xfb8e('0x45')](handleError(_0xcf6e4a,null));};var md5=require(_0xfb8e('0x57'));exports[_0xfb8e('0x58')]=function(_0x265f67,_0x19eacf,_0x2a0841){var _0x3aea45=null;var _0x5cd5da=null;var _0x4e726f=null;var _0x304bc9=null;var _0x419962='';return db[_0xfb8e('0x2f')][_0xfb8e('0x4e')]({'where':{'id':_0x265f67['params']['id']},'attributes':['id',_0xfb8e('0x2d'),_0xfb8e('0x59'),_0xfb8e('0x5a'),_0xfb8e('0x5b'),_0xfb8e('0x5c'),'serverUrl',_0xfb8e('0x5d')]})[_0xfb8e('0x2a')](handleEntityNotFound(_0x19eacf,null))[_0xfb8e('0x2a')](function(_0x3ef0c4){if(_0x3ef0c4){_0x3aea45=_0x3ef0c4['username'];_0x5cd5da=_0x3ef0c4[_0xfb8e('0x5d')];_0x4e726f=_0x3ef0c4[_0xfb8e('0x5b')];_0x419962=_0x3ef0c4['remoteUri'];var _0x401fe6=_0x419962[_0xfb8e('0x5e')](-0x1);if(_0x401fe6==='/'){_0x419962=_0x419962[_0xfb8e('0x5f')](0x0,_0x419962['lastIndexOf'](_0x401fe6));}_0x304bc9=util[_0xfb8e('0x60')](_0xfb8e('0x61'),_0x419962);var _0x24cd5d={'method':_0xfb8e('0x62'),'uri':_0x304bc9,'qs':{'operation':'getchallenge','username':_0x3ef0c4[_0xfb8e('0x59')]},'json':!![]};return rp(_0x24cd5d);}})[_0xfb8e('0x2a')](function(_0x123704){if(_0x123704[_0xfb8e('0x63')]){var _0x20c77d={'method':_0xfb8e('0x64'),'uri':_0x304bc9,'form':{'operation':_0xfb8e('0x65'),'username':_0x3aea45,'accessKey':md5(_0x123704[_0xfb8e('0x66')][_0xfb8e('0x67')]+_0x5cd5da)},'json':!![]};return rp(_0x20c77d);}})[_0xfb8e('0x2a')](function(_0x118985){if(_0x118985['success']){var _0x2c0b0e={'method':_0xfb8e('0x62'),'uri':_0x304bc9,'qs':{'operation':_0xfb8e('0x68'),'username':_0x3aea45,'sessionName':_0x118985[_0xfb8e('0x66')][_0xfb8e('0x69')],'elementType':_0x4e726f},'json':!![]};return rp(_0x2c0b0e);}})[_0xfb8e('0x2a')](function(_0x4a5adc){if(_0x4a5adc['success']){var _0xb86bf1=[_0xfb8e('0x6a'),_0xfb8e('0x6b'),'owner'];_[_0xfb8e('0x6c')](_0x4a5adc[_0xfb8e('0x66')]['fields'],function(_0x310406){return _0xb86bf1[_0xfb8e('0x6d')](_0x310406[_0xfb8e('0x52')][_0xfb8e('0x2d')]);});_[_0xfb8e('0x6c')](_0x4a5adc[_0xfb8e('0x66')]['fields'],function(_0x52d86e){return _0x52d86e[_0xfb8e('0x6e')]==='false';});return{'count':_0x4a5adc['result']['fields'][_0xfb8e('0x43')],'rows':_[_0xfb8e('0x2e')](_0x4a5adc[_0xfb8e('0x66')][_0xfb8e('0x37')],function(_0x1c7daa){return{'id':_0x1c7daa[_0xfb8e('0x2d')],'name':_0x1c7daa[_0xfb8e('0x6f')],'custom':_[_0xfb8e('0x70')](_0x1c7daa['name'],_0xfb8e('0x71'))?!![]:![],'options':_0x1c7daa[_0xfb8e('0x52')][_0xfb8e('0x2d')]===_0xfb8e('0x72')&&_0x1c7daa['type'][_0xfb8e('0x73')][_0xfb8e('0x43')]>0x0?_[_0xfb8e('0x2e')](_0x1c7daa['type'][_0xfb8e('0x73')],function(_0xb84129){return{'name':_0xb84129['label'],'value':_0xb84129[_0xfb8e('0x74')]};}):[]};})};}})[_0xfb8e('0x2a')](respondWithResult(_0x19eacf,null))[_0xfb8e('0x45')](function(_0x4b42e6){console[_0xfb8e('0x75')](_0xfb8e('0x76')+_0x4b42e6);var _0x1fbed2=_0x265f67['query']['test']?0x1f4:_0x4b42e6[_0xfb8e('0x77')]||0x1f4;logger[_0xfb8e('0x2b')](_0xfb8e('0x78'),_0xfb8e('0x58'),_0x1fbed2,JSON[_0xfb8e('0x79')](_0x4b42e6));delete _0x4b42e6[_0xfb8e('0x2d')];if(_0x1fbed2===0x191){_0x1fbed2=0x190;}_0x19eacf[_0xfb8e('0x1d')](_0x1fbed2)['send'](_0x265f67[_0xfb8e('0x32')][_0xfb8e('0x7a')]?{'message':_0xfb8e('0x7b'),'statusCode':_0x4b42e6[_0xfb8e('0x77')]}:_0x4b42e6);});}; \ No newline at end of file +var _0x3d17=['moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','POST','result','describe','reference','remove','includes','editable','false','label','picklist','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','name','index','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','VtigerConfiguration','VtigerField','Subjects','md5','username','description'];(function(_0x264d15,_0x3b231a){var _0x1ad022=function(_0x3116e8){while(--_0x3116e8){_0x264d15['push'](_0x264d15['shift']());}};_0x1ad022(++_0x3b231a);}(_0x3d17,0x91));var _0x73d1=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x3d17[_0x5c768b];return _0x335af8;};'use strict';var emlformat=require(_0x73d1('0x0'));var rimraf=require(_0x73d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73d1('0x2'));var rp=require(_0x73d1('0x3'));var moment=require(_0x73d1('0x4'));var BPromise=require(_0x73d1('0x5'));var Mustache=require(_0x73d1('0x6'));var util=require(_0x73d1('0x7'));var path=require('path');var sox=require(_0x73d1('0x8'));var csv=require(_0x73d1('0x9'));var ejs=require(_0x73d1('0xa'));var fs=require('fs');var fs_extra=require(_0x73d1('0xb'));var _=require('lodash');var squel=require(_0x73d1('0xc'));var crypto=require('crypto');var jsforce=require(_0x73d1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x73d1('0xe'));var Redis=require('ioredis');var authService=require(_0x73d1('0xf'));var qs=require(_0x73d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73d1('0x11'));var logger=require(_0x73d1('0x12'))(_0x73d1('0x13'));var utils=require(_0x73d1('0x14'));var config=require(_0x73d1('0x15'));var licenseUtil=require(_0x73d1('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x73d1('0x17'));function respondWithStatusCode(_0x482df3,_0x2106c8){_0x2106c8=_0x2106c8||0xcc;return function(_0x338eb5){if(_0x338eb5){return _0x482df3[_0x73d1('0x18')](_0x2106c8);}return _0x482df3[_0x73d1('0x19')](_0x2106c8)[_0x73d1('0x1a')]();};}function respondWithResult(_0xfb61e6,_0x542f69){_0x542f69=_0x542f69||0xc8;return function(_0x4bd72d){if(_0x4bd72d){return _0xfb61e6[_0x73d1('0x19')](_0x542f69)[_0x73d1('0x1b')](_0x4bd72d);}};}function respondWithFilteredResult(_0x263c7b,_0x5cd53b){return function(_0xd249ea){if(_0xd249ea){var _0x399cbd=typeof _0x5cd53b[_0x73d1('0x1c')]===_0x73d1('0x1d')&&typeof _0x5cd53b[_0x73d1('0x1e')]===_0x73d1('0x1d');var _0x1f3979=_0xd249ea[_0x73d1('0x1f')];var _0x3d0e33=_0x399cbd?0x0:_0x5cd53b[_0x73d1('0x1c')];var _0x5b8807=_0x399cbd?_0xd249ea['count']:_0x5cd53b[_0x73d1('0x1c')]+_0x5cd53b[_0x73d1('0x1e')];var _0x3d6227;if(_0x5b8807>=_0x1f3979){_0x5b8807=_0x1f3979;_0x3d6227=0xc8;}else{_0x3d6227=0xce;}_0x263c7b['status'](_0x3d6227);return _0x263c7b[_0x73d1('0x20')]('Content-Range',_0x3d0e33+'-'+_0x5b8807+'/'+_0x1f3979)[_0x73d1('0x1b')](_0xd249ea);}return null;};}function patchUpdates(_0x56bcd2){return function(_0x3a946d){try{jsonpatch[_0x73d1('0x21')](_0x3a946d,_0x56bcd2,!![]);}catch(_0x3995b2){return BPromise[_0x73d1('0x22')](_0x3995b2);}return _0x3a946d[_0x73d1('0x23')]();};}function saveUpdates(_0x5bc196,_0x231963){return function(_0x14abb2){if(_0x14abb2){return _0x14abb2['update'](_0x5bc196)['then'](function(_0x454e26){return _0x454e26;});}return null;};}function removeEntity(_0xcac3c4,_0x5f2364){return function(_0x5e45f3){if(_0x5e45f3){return _0x5e45f3[_0x73d1('0x24')]()[_0x73d1('0x25')](function(){_0xcac3c4[_0x73d1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb5747c,_0x246a14){return function(_0x4ba20e){if(!_0x4ba20e){_0xb5747c[_0x73d1('0x18')](0x194);}return _0x4ba20e;};}function handleError(_0x2becdd,_0x1e753d){_0x1e753d=_0x1e753d||0x1f4;return function(_0x129004){logger[_0x73d1('0x26')](_0x129004['stack']);if(_0x129004[_0x73d1('0x27')]){delete _0x129004[_0x73d1('0x27')];}_0x2becdd[_0x73d1('0x19')](_0x1e753d)['send'](_0x129004);};}exports[_0x73d1('0x28')]=function(_0x5d199b,_0x395d14){var _0x9f6858={},_0xd0d1d0={},_0x462d5b={'count':0x0,'rows':[]};var _0x2d8124=_[_0x73d1('0x29')](db[_0x73d1('0x2a')][_0x73d1('0x2b')],function(_0x1b92ba){return{'name':_0x1b92ba[_0x73d1('0x2c')],'type':_0x1b92ba[_0x73d1('0x2d')]['key']};});_0xd0d1d0[_0x73d1('0x2e')]=_[_0x73d1('0x29')](_0x2d8124,_0x73d1('0x27'));_0xd0d1d0['query']=_[_0x73d1('0x2f')](_0x5d199b[_0x73d1('0x30')]);_0xd0d1d0[_0x73d1('0x31')]=_[_0x73d1('0x32')](_0xd0d1d0[_0x73d1('0x2e')],_0xd0d1d0['query']);_0x9f6858['attributes']=_[_0x73d1('0x32')](_0xd0d1d0[_0x73d1('0x2e')],qs[_0x73d1('0x33')](_0x5d199b[_0x73d1('0x30')][_0x73d1('0x33')]));_0x9f6858[_0x73d1('0x34')]=_0x9f6858[_0x73d1('0x34')][_0x73d1('0x35')]?_0x9f6858['attributes']:_0xd0d1d0[_0x73d1('0x2e')];if(!_0x5d199b['query'][_0x73d1('0x36')](_0x73d1('0x37'))){_0x9f6858[_0x73d1('0x1e')]=qs[_0x73d1('0x1e')](_0x5d199b[_0x73d1('0x30')][_0x73d1('0x1e')]);_0x9f6858[_0x73d1('0x1c')]=qs[_0x73d1('0x1c')](_0x5d199b['query'][_0x73d1('0x1c')]);}_0x9f6858[_0x73d1('0x38')]=qs[_0x73d1('0x39')](_0x5d199b[_0x73d1('0x30')][_0x73d1('0x39')]);_0x9f6858[_0x73d1('0x3a')]=qs[_0x73d1('0x31')](_[_0x73d1('0x3b')](_0x5d199b[_0x73d1('0x30')],_0xd0d1d0['filters']),_0x2d8124);if(_0x5d199b[_0x73d1('0x30')][_0x73d1('0x3c')]){_0x9f6858[_0x73d1('0x3a')]=_['merge'](_0x9f6858[_0x73d1('0x3a')],{'$or':_[_0x73d1('0x29')](_0x2d8124,function(_0x42732a){if(_0x42732a['type']!==_0x73d1('0x3d')){var _0x46642d={};_0x46642d[_0x42732a[_0x73d1('0x27')]]={'$like':'%'+_0x5d199b['query'][_0x73d1('0x3c')]+'%'};return _0x46642d;}})});}_0x9f6858=_[_0x73d1('0x3e')]({},_0x9f6858,_0x5d199b['options']);var _0x2b21bd={'where':_0x9f6858[_0x73d1('0x3a')]};return db[_0x73d1('0x2a')]['count'](_0x2b21bd)[_0x73d1('0x25')](function(_0x1bff5a){_0x462d5b[_0x73d1('0x1f')]=_0x1bff5a;if(_0x5d199b[_0x73d1('0x30')]['includeAll']){_0x9f6858['include']=[{'all':!![]}];}return db[_0x73d1('0x2a')][_0x73d1('0x3f')](_0x9f6858);})[_0x73d1('0x25')](function(_0x4b2a5e){_0x462d5b[_0x73d1('0x40')]=_0x4b2a5e;return _0x462d5b;})[_0x73d1('0x25')](respondWithFilteredResult(_0x395d14,_0x9f6858))[_0x73d1('0x41')](handleError(_0x395d14,null));};exports['show']=function(_0x104a16,_0x13b0cf){var _0x590f1d={'raw':![],'where':{'id':_0x104a16[_0x73d1('0x42')]['id']}},_0x5ef8ce={};_0x5ef8ce[_0x73d1('0x2e')]=_[_0x73d1('0x2f')](db['VtigerAccount'][_0x73d1('0x2b')]);_0x5ef8ce[_0x73d1('0x30')]=_[_0x73d1('0x2f')](_0x104a16[_0x73d1('0x30')]);_0x5ef8ce['filters']=_[_0x73d1('0x32')](_0x5ef8ce[_0x73d1('0x2e')],_0x5ef8ce[_0x73d1('0x30')]);_0x590f1d['attributes']=_['intersection'](_0x5ef8ce['model'],qs[_0x73d1('0x33')](_0x104a16[_0x73d1('0x30')]['fields']));_0x590f1d[_0x73d1('0x34')]=_0x590f1d['attributes'][_0x73d1('0x35')]?_0x590f1d['attributes']:_0x5ef8ce['model'];if(_0x104a16[_0x73d1('0x30')]['includeAll']){_0x590f1d[_0x73d1('0x43')]=[{'all':!![]}];}_0x590f1d=_[_0x73d1('0x3e')]({},_0x590f1d,_0x104a16['options']);return db[_0x73d1('0x2a')][_0x73d1('0x44')](_0x590f1d)[_0x73d1('0x25')](handleEntityNotFound(_0x13b0cf,null))[_0x73d1('0x25')](respondWithResult(_0x13b0cf,null))[_0x73d1('0x41')](handleError(_0x13b0cf,null));};exports[_0x73d1('0x45')]=function(_0x4aa9d0,_0x5ce6c1){return db[_0x73d1('0x2a')][_0x73d1('0x45')](_0x4aa9d0[_0x73d1('0x46')],{})['then'](respondWithResult(_0x5ce6c1,0xc9))[_0x73d1('0x41')](handleError(_0x5ce6c1,null));};exports[_0x73d1('0x47')]=function(_0x3cd9ce,_0x4ac0ee){if(_0x3cd9ce[_0x73d1('0x46')]['id']){delete _0x3cd9ce[_0x73d1('0x46')]['id'];}return db[_0x73d1('0x2a')][_0x73d1('0x44')]({'where':{'id':_0x3cd9ce['params']['id']}})['then'](handleEntityNotFound(_0x4ac0ee,null))[_0x73d1('0x25')](saveUpdates(_0x3cd9ce[_0x73d1('0x46')],null))[_0x73d1('0x25')](respondWithResult(_0x4ac0ee,null))[_0x73d1('0x41')](handleError(_0x4ac0ee,null));};exports[_0x73d1('0x24')]=function(_0x50e396,_0x30605d){return db[_0x73d1('0x2a')]['find']({'where':{'id':_0x50e396[_0x73d1('0x42')]['id']}})[_0x73d1('0x25')](handleEntityNotFound(_0x30605d,null))['then'](removeEntity(_0x30605d,null))[_0x73d1('0x41')](handleError(_0x30605d,null));};exports[_0x73d1('0x48')]=function(_0x54b400,_0x126a9d,_0x574a04){var _0x123830={};var _0xdc99e4={};var _0x193f15;var _0x500639;return db[_0x73d1('0x2a')]['findOne']({'where':{'id':_0x54b400[_0x73d1('0x42')]['id']}})['then'](handleEntityNotFound(_0x126a9d,null))['then'](function(_0x532b5c){if(_0x532b5c){_0x193f15=_0x532b5c;_0xdc99e4[_0x73d1('0x2e')]=_[_0x73d1('0x2f')](db['VtigerConfiguration'][_0x73d1('0x2b')]);_0xdc99e4['query']=_['keys'](_0x54b400['query']);_0xdc99e4['filters']=_[_0x73d1('0x32')](_0xdc99e4[_0x73d1('0x2e')],_0xdc99e4[_0x73d1('0x30')]);_0x123830[_0x73d1('0x34')]=_[_0x73d1('0x32')](_0xdc99e4[_0x73d1('0x2e')],qs[_0x73d1('0x33')](_0x54b400[_0x73d1('0x30')][_0x73d1('0x33')]));_0x123830[_0x73d1('0x34')]=_0x123830[_0x73d1('0x34')]['length']?_0x123830[_0x73d1('0x34')]:_0xdc99e4[_0x73d1('0x2e')];_0x123830['order']=qs[_0x73d1('0x39')](_0x54b400['query'][_0x73d1('0x39')]);_0x123830['where']=qs['filters'](_[_0x73d1('0x3b')](_0x54b400[_0x73d1('0x30')],_0xdc99e4[_0x73d1('0x31')]));if(_0x54b400[_0x73d1('0x30')]['filter']){_0x123830[_0x73d1('0x3a')]=_[_0x73d1('0x3e')](_0x123830[_0x73d1('0x3a')],{'$or':_['map'](_0x123830[_0x73d1('0x34')],function(_0x1fc6b4){var _0x9253b0={};_0x9253b0[_0x1fc6b4]={'$like':'%'+_0x54b400[_0x73d1('0x30')][_0x73d1('0x3c')]+'%'};return _0x9253b0;})});}_0x123830=_['merge']({},_0x123830,_0x54b400['options']);return _0x193f15[_0x73d1('0x48')](_0x123830);}})['then'](function(_0x486687){if(_0x486687){_0x500639=_0x486687['length'];if(!_0x54b400['query'][_0x73d1('0x36')]('nolimit')){_0x123830['limit']=qs[_0x73d1('0x1e')](_0x54b400[_0x73d1('0x30')][_0x73d1('0x1e')]);_0x123830[_0x73d1('0x1c')]=qs[_0x73d1('0x1c')](_0x54b400['query'][_0x73d1('0x1c')]);}return _0x193f15[_0x73d1('0x48')](_0x123830);}})['then'](function(_0x9f1b40){if(_0x9f1b40){return _0x9f1b40?{'count':_0x500639,'rows':_0x9f1b40}:null;}})[_0x73d1('0x25')](respondWithResult(_0x126a9d,null))['catch'](handleError(_0x126a9d,null));};exports[_0x73d1('0x49')]=function(_0x42aa7e,_0x594f2c,_0x32cb25){if(_0x42aa7e['body']['id']){delete _0x42aa7e[_0x73d1('0x46')]['id'];}return db[_0x73d1('0x2a')][_0x73d1('0x4a')]({'where':{'id':_0x42aa7e[_0x73d1('0x42')]['id']}})[_0x73d1('0x25')](handleEntityNotFound(_0x594f2c,null))[_0x73d1('0x25')](function(_0x34c53c){if(_0x34c53c){_0x42aa7e[_0x73d1('0x46')][_0x73d1('0x4b')]=_0x34c53c['id'];_0x42aa7e[_0x73d1('0x46')]['Subjects']=integrations[_0x73d1('0x4c')](_0x42aa7e[_0x73d1('0x46')][_0x73d1('0x4d')],_0x42aa7e[_0x73d1('0x46')][_0x73d1('0x2d')]);_0x42aa7e[_0x73d1('0x46')][_0x73d1('0x4e')]=integrations['getDescriptions'](_0x42aa7e['body'][_0x73d1('0x4d')],_0x42aa7e['body'][_0x73d1('0x2d')]);return db[_0x73d1('0x4f')][_0x73d1('0x45')](_0x42aa7e['body'],{'include':[{'model':db[_0x73d1('0x50')],'as':_0x73d1('0x51')},{'model':db[_0x73d1('0x50')],'as':_0x73d1('0x4e')}]});}return null;})['then'](respondWithResult(_0x594f2c,null))[_0x73d1('0x41')](handleError(_0x594f2c,null));};var md5=require(_0x73d1('0x52'));exports['getFields']=function(_0x4a1c72,_0xc5bf67,_0x165a4e){var _0x41e75e=null;var _0x3a82c6=null;var _0x262dd8=null;var _0x1d1d35=null;var _0x8e77eb='';return db[_0x73d1('0x2a')][_0x73d1('0x4a')]({'where':{'id':_0x4a1c72[_0x73d1('0x42')]['id']},'attributes':['id',_0x73d1('0x27'),_0x73d1('0x53'),_0x73d1('0x54'),_0x73d1('0x55'),_0x73d1('0x56'),_0x73d1('0x57'),'accessKey']})[_0x73d1('0x25')](handleEntityNotFound(_0xc5bf67,null))[_0x73d1('0x25')](function(_0x9cc856){if(_0x9cc856){_0x41e75e=_0x9cc856[_0x73d1('0x53')];_0x3a82c6=_0x9cc856[_0x73d1('0x58')];_0x262dd8=_0x9cc856[_0x73d1('0x55')];_0x8e77eb=_0x9cc856['remoteUri'];var _0x249f80=_0x8e77eb[_0x73d1('0x59')](-0x1);if(_0x249f80==='/'){_0x8e77eb=_0x8e77eb['substring'](0x0,_0x8e77eb[_0x73d1('0x5a')](_0x249f80));}_0x1d1d35=util[_0x73d1('0x5b')]('%s/webservice.php',_0x8e77eb);var _0x355df8={'method':_0x73d1('0x5c'),'uri':_0x1d1d35,'qs':{'operation':_0x73d1('0x5d'),'username':_0x9cc856[_0x73d1('0x53')]},'json':!![]};return rp(_0x355df8);}})['then'](function(_0x304d7f){if(_0x304d7f[_0x73d1('0x5e')]){var _0x54ebe3={'method':_0x73d1('0x5f'),'uri':_0x1d1d35,'form':{'operation':'login','username':_0x41e75e,'accessKey':md5(_0x304d7f[_0x73d1('0x60')]['token']+_0x3a82c6)},'json':!![]};return rp(_0x54ebe3);}})[_0x73d1('0x25')](function(_0x379de0){if(_0x379de0[_0x73d1('0x5e')]){var _0x37b750={'method':'GET','uri':_0x1d1d35,'qs':{'operation':_0x73d1('0x61'),'username':_0x41e75e,'sessionName':_0x379de0[_0x73d1('0x60')]['sessionName'],'elementType':_0x262dd8},'json':!![]};return rp(_0x37b750);}})['then'](function(_0x58da56){if(_0x58da56['success']){var _0x5c61ff=['autogenerated',_0x73d1('0x62'),'owner'];_[_0x73d1('0x63')](_0x58da56['result'][_0x73d1('0x33')],function(_0xce2977){return _0x5c61ff[_0x73d1('0x64')](_0xce2977[_0x73d1('0x2d')]['name']);});_[_0x73d1('0x63')](_0x58da56[_0x73d1('0x60')][_0x73d1('0x33')],function(_0x11c6ae){return _0x11c6ae[_0x73d1('0x65')]===_0x73d1('0x66');});return{'count':_0x58da56[_0x73d1('0x60')][_0x73d1('0x33')][_0x73d1('0x35')],'rows':_[_0x73d1('0x29')](_0x58da56['result'][_0x73d1('0x33')],function(_0x60cda4){return{'id':_0x60cda4['name'],'name':_0x60cda4[_0x73d1('0x67')],'custom':_['startsWith'](_0x60cda4[_0x73d1('0x27')],'cf_')?!![]:![],'options':_0x60cda4[_0x73d1('0x2d')][_0x73d1('0x27')]===_0x73d1('0x68')&&_0x60cda4['type'][_0x73d1('0x69')][_0x73d1('0x35')]>0x0?_[_0x73d1('0x29')](_0x60cda4[_0x73d1('0x2d')]['picklistValues'],function(_0x18e376){return{'name':_0x18e376[_0x73d1('0x67')],'value':_0x18e376[_0x73d1('0x6a')]};}):[]};})};}})[_0x73d1('0x25')](respondWithResult(_0xc5bf67,null))['catch'](function(_0x5ee40c){console[_0x73d1('0x6b')](_0x73d1('0x6c')+_0x5ee40c);var _0x3f5418=_0x4a1c72[_0x73d1('0x30')]['test']?0x1f4:_0x5ee40c['statusCode']||0x1f4;logger[_0x73d1('0x26')](_0x73d1('0x6d'),'getFields',_0x3f5418,JSON[_0x73d1('0x6e')](_0x5ee40c));delete _0x5ee40c['name'];if(_0x3f5418===0x191){_0x3f5418=0x190;}_0xc5bf67[_0x73d1('0x19')](_0x3f5418)[_0x73d1('0x6f')](_0x4a1c72[_0x73d1('0x30')][_0x73d1('0x70')]?{'message':_0x73d1('0x71'),'statusCode':_0x5ee40c[_0x73d1('0x72')]}:_0x5ee40c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 66cd6be..2811762 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 _0x29c7=['define','int_vtiger_accounts','lodash','util','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0x29c7,0xa4));var _0x729c=function(_0x3f5f86,_0x5bce99){_0x3f5f86=_0x3f5f86-0x0;var _0x46a54b=_0x29c7[_0x3f5f86];return _0x46a54b;};'use strict';var _=require(_0x729c('0x0'));var util=require(_0x729c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x729c('0x2'));var rp=require(_0x729c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x729c('0x4'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x729c('0x5'));module[_0x729c('0x6')]=function(_0x26baad,_0x29d43b){return _0x26baad[_0x729c('0x7')]('VtigerAccount',attributes,{'tableName':_0x729c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d2a=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3e44c9,_0x75eff){var _0x4dd5a8=function(_0x23d1f3){while(--_0x23d1f3){_0x3e44c9['push'](_0x3e44c9['shift']());}};_0x4dd5a8(++_0x75eff);}(_0x1d2a,0x64));var _0xa1d2=function(_0x4c979e,_0x579ec1){_0x4c979e=_0x4c979e-0x0;var _0x3b84db=_0x1d2a[_0x4c979e];return _0x3b84db;};'use strict';var _=require(_0xa1d2('0x0'));var util=require(_0xa1d2('0x1'));var logger=require(_0xa1d2('0x2'))('api');var moment=require(_0xa1d2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1d2('0x4'));var rimraf=require(_0xa1d2('0x5'));var config=require(_0xa1d2('0x6'));var attributes=require(_0xa1d2('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa1d2('0x8')]=function(_0xa9194f,_0x57dc97){return _0xa9194f[_0xa1d2('0x9')](_0xa1d2('0xa'),attributes,{'tableName':_0xa1d2('0xb'),'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 10e138c..a755c64 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','include','map','model','then','ShowVtigerAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xcb91[_0x1d87fc];return _0x492b56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetVtigerAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['VtigerAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowVtigerAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ 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(_0x527985,_0x5bd201){var _0x1ec16c=function(_0x4ff303){while(--_0x4ff303){_0x527985['push'](_0x527985['shift']());}};_0x1ec16c(++_0x5bd201);}(_0xf45e,0x115));var _0xef45=function(_0x148bd1,_0x3cae67){_0x148bd1=_0x148bd1-0x0;var _0x2a4911=_0xf45e[_0x148bd1];return _0x2a4911;};'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 74a28af..323c122 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 _0x696e=['isAuthenticated','get','show','getDescriptions','post','create','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x414d12,_0x2a7dd1){var _0x42446b=function(_0x56cb05){while(--_0x56cb05){_0x414d12['push'](_0x414d12['shift']());}};_0x42446b(++_0x2a7dd1);}(_0x696e,0xb5));var _0xe696=function(_0x5d4e32,_0xd993e){_0x5d4e32=_0x5d4e32-0x0;var _0x118b85=_0x696e[_0x5d4e32];return _0x118b85;};'use strict';var multer=require(_0xe696('0x0'));var util=require('util');var path=require(_0xe696('0x1'));var timeout=require(_0xe696('0x2'));var express=require(_0xe696('0x3'));var router=express[_0xe696('0x4')]();var fs_extra=require(_0xe696('0x5'));var auth=require(_0xe696('0x6'));var interaction=require(_0xe696('0x7'));var config=require(_0xe696('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xe696('0x9')](),controller['index']);router[_0xe696('0xa')]('/:id',auth[_0xe696('0x9')](),controller[_0xe696('0xb')]);router[_0xe696('0xa')]('/:id/fields',auth[_0xe696('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xe696('0x9')](),controller['getSubjects']);router[_0xe696('0xa')]('/:id/descriptions',auth[_0xe696('0x9')](),controller[_0xe696('0xc')]);router[_0xe696('0xd')]('/',auth[_0xe696('0x9')](),controller[_0xe696('0xe')]);router['put'](_0xe696('0xf'),auth[_0xe696('0x9')](),controller[_0xe696('0x10')]);router['delete'](_0xe696('0xf'),auth['isAuthenticated'](),controller[_0xe696('0x11')]);module[_0xe696('0x12')]=router; \ No newline at end of file +var _0x9744=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','multer'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x9744,0x1df));var _0x4974=function(_0x3ff13,_0x3fdd45){_0x3ff13=_0x3ff13-0x0;var _0x28c909=_0x9744[_0x3ff13];return _0x28c909;};'use strict';var multer=require(_0x4974('0x0'));var util=require('util');var path=require(_0x4974('0x1'));var timeout=require(_0x4974('0x2'));var express=require('express');var router=express[_0x4974('0x3')]();var fs_extra=require(_0x4974('0x4'));var auth=require(_0x4974('0x5'));var interaction=require(_0x4974('0x6'));var config=require(_0x4974('0x7'));var controller=require(_0x4974('0x8'));router[_0x4974('0x9')]('/',auth[_0x4974('0xa')](),controller[_0x4974('0xb')]);router[_0x4974('0x9')](_0x4974('0xc'),auth[_0x4974('0xa')](),controller[_0x4974('0xd')]);router[_0x4974('0x9')](_0x4974('0xe'),auth[_0x4974('0xa')](),controller[_0x4974('0xf')]);router[_0x4974('0x9')](_0x4974('0x10'),auth[_0x4974('0xa')](),controller['getSubjects']);router[_0x4974('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4974('0x11')]);router[_0x4974('0x12')]('/',auth[_0x4974('0xa')](),controller[_0x4974('0x13')]);router[_0x4974('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4974('0x15')]);router[_0x4974('0x16')](_0x4974('0xc'),auth[_0x4974('0xa')](),controller[_0x4974('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 47be522..b6ebce2 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 _0x781e=['sequelize','STRING'];(function(_0x4a313b,_0x54e01c){var _0x417d04=function(_0x45371f){while(--_0x45371f){_0x4a313b['push'](_0x4a313b['shift']());}};_0x417d04(++_0x54e01c);}(_0x781e,0x19a));var _0xe781=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x781e[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xe781('0x0'));module['exports']={'name':{'type':Sequelize[_0xe781('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd989=['sequelize','exports','STRING'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xd989,0xb7));var _0x9d98=function(_0xe616f4,_0x433679){_0xe616f4=_0xe616f4-0x0;var _0x259e56=_0xd989[_0xe616f4];return _0x259e56;};'use strict';var Sequelize=require(_0x9d98('0x0'));module[_0x9d98('0x1')]={'name':{'type':Sequelize[_0x9d98('0x2')]},'description':{'type':Sequelize[_0x9d98('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2a09096..1b7b973 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 _0x951c=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','VtigerField','pick','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName'];(function(_0x5653db,_0x286ccb){var _0x4cc675=function(_0x3f291f){while(--_0x3f291f){_0x5653db['push'](_0x5653db['shift']());}};_0x4cc675(++_0x286ccb);}(_0x951c,0x71));var _0xc951=function(_0x5a12f0,_0x583b5e){_0x5a12f0=_0x5a12f0-0x0;var _0x27c673=_0x951c[_0x5a12f0];return _0x27c673;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc951('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc951('0x1'));var rp=require(_0xc951('0x2'));var moment=require('moment');var BPromise=require(_0xc951('0x3'));var Mustache=require(_0xc951('0x4'));var util=require(_0xc951('0x5'));var path=require(_0xc951('0x6'));var sox=require(_0xc951('0x7'));var csv=require(_0xc951('0x8'));var ejs=require(_0xc951('0x9'));var fs=require('fs');var fs_extra=require(_0xc951('0xa'));var _=require(_0xc951('0xb'));var squel=require(_0xc951('0xc'));var crypto=require(_0xc951('0xd'));var jsforce=require(_0xc951('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc951('0x8'));var querystring=require('querystring');var Papa=require(_0xc951('0xf'));var Redis=require(_0xc951('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc951('0x11'));var as=require(_0xc951('0x12'));var hardwareService=require(_0xc951('0x13'));var logger=require('../../config/logger')(_0xc951('0x14'));var utils=require(_0xc951('0x15'));var config=require(_0xc951('0x16'));var licenseUtil=require(_0xc951('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f873f,_0x5c0fca){_0x5c0fca=_0x5c0fca||0xcc;return function(_0x500aa3){if(_0x500aa3){return _0x2f873f[_0xc951('0x18')](_0x5c0fca);}return _0x2f873f[_0xc951('0x19')](_0x5c0fca)[_0xc951('0x1a')]();};}function respondWithResult(_0x42c1d4,_0x5a34b4){_0x5a34b4=_0x5a34b4||0xc8;return function(_0x56d5eb){if(_0x56d5eb){return _0x42c1d4['status'](_0x5a34b4)[_0xc951('0x1b')](_0x56d5eb);}};}function respondWithFilteredResult(_0x2fe794,_0x518785){return function(_0x81aa6f){if(_0x81aa6f){var _0x51487f=typeof _0x518785['offset']===_0xc951('0x1c')&&typeof _0x518785['limit']===_0xc951('0x1c');var _0x32d851=_0x81aa6f[_0xc951('0x1d')];var _0x4d383a=_0x51487f?0x0:_0x518785['offset'];var _0x21d338=_0x51487f?_0x81aa6f[_0xc951('0x1d')]:_0x518785[_0xc951('0x1e')]+_0x518785[_0xc951('0x1f')];var _0x265c23;if(_0x21d338>=_0x32d851){_0x21d338=_0x32d851;_0x265c23=0xc8;}else{_0x265c23=0xce;}_0x2fe794['status'](_0x265c23);return _0x2fe794['set']('Content-Range',_0x4d383a+'-'+_0x21d338+'/'+_0x32d851)[_0xc951('0x1b')](_0x81aa6f);}return null;};}function patchUpdates(_0x351a9f){return function(_0x486556){try{jsonpatch['apply'](_0x486556,_0x351a9f,!![]);}catch(_0x4ea041){return BPromise['reject'](_0x4ea041);}return _0x486556[_0xc951('0x20')]();};}function saveUpdates(_0x1673f2,_0x4f7bae){return function(_0x14bad1){if(_0x14bad1){return _0x14bad1[_0xc951('0x21')](_0x1673f2)[_0xc951('0x22')](function(_0x2e0c54){return _0x2e0c54;});}return null;};}function removeEntity(_0x5221d1,_0x2229a4){return function(_0x458059){if(_0x458059){return _0x458059[_0xc951('0x23')]()[_0xc951('0x22')](function(){_0x5221d1['status'](0xcc)[_0xc951('0x1a')]();});}};}function handleEntityNotFound(_0x540fb4,_0x3eb624){return function(_0x39b09e){if(!_0x39b09e){_0x540fb4[_0xc951('0x18')](0x194);}return _0x39b09e;};}function handleError(_0x31a951,_0x46ed42){_0x46ed42=_0x46ed42||0x1f4;return function(_0x17448d){logger[_0xc951('0x24')](_0x17448d[_0xc951('0x25')]);if(_0x17448d[_0xc951('0x26')]){delete _0x17448d[_0xc951('0x26')];}_0x31a951[_0xc951('0x19')](_0x46ed42)[_0xc951('0x27')](_0x17448d);};}exports[_0xc951('0x28')]=function(_0x27e08c,_0x2446fc){var _0xfc7e4a={},_0x3456b6={},_0x2a18ca={'count':0x0,'rows':[]};var _0x507b0c=_[_0xc951('0x29')](db[_0xc951('0x2a')][_0xc951('0x2b')],function(_0x3f6d18){return{'name':_0x3f6d18[_0xc951('0x2c')],'type':_0x3f6d18[_0xc951('0x2d')][_0xc951('0x2e')]};});_0x3456b6[_0xc951('0x2f')]=_[_0xc951('0x29')](_0x507b0c,_0xc951('0x26'));_0x3456b6[_0xc951('0x30')]=_[_0xc951('0x31')](_0x27e08c[_0xc951('0x30')]);_0x3456b6[_0xc951('0x32')]=_[_0xc951('0x33')](_0x3456b6[_0xc951('0x2f')],_0x3456b6[_0xc951('0x30')]);_0xfc7e4a[_0xc951('0x34')]=_[_0xc951('0x33')](_0x3456b6[_0xc951('0x2f')],qs[_0xc951('0x35')](_0x27e08c['query'][_0xc951('0x35')]));_0xfc7e4a[_0xc951('0x34')]=_0xfc7e4a['attributes'][_0xc951('0x36')]?_0xfc7e4a['attributes']:_0x3456b6[_0xc951('0x2f')];if(!_0x27e08c[_0xc951('0x30')][_0xc951('0x37')]('nolimit')){_0xfc7e4a[_0xc951('0x1f')]=qs['limit'](_0x27e08c[_0xc951('0x30')][_0xc951('0x1f')]);_0xfc7e4a[_0xc951('0x1e')]=qs['offset'](_0x27e08c[_0xc951('0x30')][_0xc951('0x1e')]);}_0xfc7e4a[_0xc951('0x38')]=qs[_0xc951('0x39')](_0x27e08c[_0xc951('0x30')][_0xc951('0x39')]);_0xfc7e4a[_0xc951('0x3a')]=qs[_0xc951('0x32')](_['pick'](_0x27e08c['query'],_0x3456b6[_0xc951('0x32')]),_0x507b0c);if(_0x27e08c['query'][_0xc951('0x3b')]){_0xfc7e4a[_0xc951('0x3a')]=_[_0xc951('0x3c')](_0xfc7e4a[_0xc951('0x3a')],{'$or':_[_0xc951('0x29')](_0x507b0c,function(_0x5a3c33){if(_0x5a3c33[_0xc951('0x2d')]!=='VIRTUAL'){var _0x2c246f={};_0x2c246f[_0x5a3c33['name']]={'$like':'%'+_0x27e08c['query']['filter']+'%'};return _0x2c246f;}})});}_0xfc7e4a=_[_0xc951('0x3c')]({},_0xfc7e4a,_0x27e08c[_0xc951('0x3d')]);var _0x183626={'where':_0xfc7e4a[_0xc951('0x3a')]};return db[_0xc951('0x2a')][_0xc951('0x1d')](_0x183626)['then'](function(_0x1e8cf7){_0x2a18ca[_0xc951('0x1d')]=_0x1e8cf7;if(_0x27e08c[_0xc951('0x30')][_0xc951('0x3e')]){_0xfc7e4a[_0xc951('0x3f')]=[{'all':!![]}];}return db[_0xc951('0x2a')][_0xc951('0x40')](_0xfc7e4a);})[_0xc951('0x22')](function(_0x2d0b37){_0x2a18ca[_0xc951('0x41')]=_0x2d0b37;return _0x2a18ca;})[_0xc951('0x22')](respondWithFilteredResult(_0x2446fc,_0xfc7e4a))['catch'](handleError(_0x2446fc,null));};exports[_0xc951('0x42')]=function(_0x161b75,_0x1844b5){var _0x21f210={'raw':![],'where':{'id':_0x161b75[_0xc951('0x43')]['id']}},_0x2afbfe={};_0x2afbfe[_0xc951('0x2f')]=_[_0xc951('0x31')](db[_0xc951('0x2a')][_0xc951('0x2b')]);_0x2afbfe[_0xc951('0x30')]=_['keys'](_0x161b75['query']);_0x2afbfe['filters']=_[_0xc951('0x33')](_0x2afbfe[_0xc951('0x2f')],_0x2afbfe[_0xc951('0x30')]);_0x21f210[_0xc951('0x34')]=_[_0xc951('0x33')](_0x2afbfe[_0xc951('0x2f')],qs['fields'](_0x161b75[_0xc951('0x30')][_0xc951('0x35')]));_0x21f210[_0xc951('0x34')]=_0x21f210[_0xc951('0x34')][_0xc951('0x36')]?_0x21f210[_0xc951('0x34')]:_0x2afbfe[_0xc951('0x2f')];if(_0x161b75[_0xc951('0x30')][_0xc951('0x3e')]){_0x21f210[_0xc951('0x3f')]=[{'all':!![]}];}_0x21f210=_['merge']({},_0x21f210,_0x161b75[_0xc951('0x3d')]);return db[_0xc951('0x2a')][_0xc951('0x44')](_0x21f210)[_0xc951('0x22')](handleEntityNotFound(_0x1844b5,null))[_0xc951('0x22')](respondWithResult(_0x1844b5,null))[_0xc951('0x45')](handleError(_0x1844b5,null));};exports['create']=function(_0x4f2474,_0x2fb504){return db[_0xc951('0x2a')][_0xc951('0x46')](_0x4f2474[_0xc951('0x47')],{})[_0xc951('0x22')](respondWithResult(_0x2fb504,0xc9))[_0xc951('0x45')](handleError(_0x2fb504,null));};exports[_0xc951('0x21')]=function(_0xbe8777,_0x39d8eb){if(_0xbe8777[_0xc951('0x47')]['id']){delete _0xbe8777[_0xc951('0x47')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0xbe8777[_0xc951('0x43')]['id']}})[_0xc951('0x22')](handleEntityNotFound(_0x39d8eb,null))[_0xc951('0x22')](saveUpdates(_0xbe8777[_0xc951('0x47')],null))[_0xc951('0x22')](respondWithResult(_0x39d8eb,null))[_0xc951('0x45')](handleError(_0x39d8eb,null));};exports[_0xc951('0x23')]=function(_0x5193cc,_0x43f5b1){return db[_0xc951('0x2a')]['find']({'where':{'id':_0x5193cc[_0xc951('0x43')]['id']}})[_0xc951('0x22')](handleEntityNotFound(_0x43f5b1,null))[_0xc951('0x22')](removeEntity(_0x43f5b1,null))[_0xc951('0x45')](handleError(_0x43f5b1,null));};exports[_0xc951('0x48')]=function(_0x8fb874,_0x3278a3,_0x278bc9){var _0xf94d32={};var _0x23f9c7={};var _0x2de9d4;var _0x3a511f;return db[_0xc951('0x2a')][_0xc951('0x49')]({'where':{'id':_0x8fb874['params']['id']}})[_0xc951('0x22')](handleEntityNotFound(_0x3278a3,null))[_0xc951('0x22')](function(_0x2defea){if(_0x2defea){_0x2de9d4=_0x2defea;_0x23f9c7['model']=_[_0xc951('0x31')](db[_0xc951('0x4a')][_0xc951('0x2b')]);_0x23f9c7[_0xc951('0x30')]=_[_0xc951('0x31')](_0x8fb874[_0xc951('0x30')]);_0x23f9c7[_0xc951('0x32')]=_['intersection'](_0x23f9c7[_0xc951('0x2f')],_0x23f9c7[_0xc951('0x30')]);_0xf94d32[_0xc951('0x34')]=_[_0xc951('0x33')](_0x23f9c7[_0xc951('0x2f')],qs['fields'](_0x8fb874[_0xc951('0x30')][_0xc951('0x35')]));_0xf94d32[_0xc951('0x34')]=_0xf94d32[_0xc951('0x34')]['length']?_0xf94d32[_0xc951('0x34')]:_0x23f9c7[_0xc951('0x2f')];_0xf94d32['order']=qs['sort'](_0x8fb874[_0xc951('0x30')][_0xc951('0x39')]);_0xf94d32[_0xc951('0x3a')]=qs['filters'](_[_0xc951('0x4b')](_0x8fb874['query'],_0x23f9c7[_0xc951('0x32')]));if(_0x8fb874[_0xc951('0x30')][_0xc951('0x3b')]){_0xf94d32[_0xc951('0x3a')]=_[_0xc951('0x3c')](_0xf94d32[_0xc951('0x3a')],{'$or':_[_0xc951('0x29')](_0xf94d32[_0xc951('0x34')],function(_0x3c9ae7){var _0x58e487={};_0x58e487[_0x3c9ae7]={'$like':'%'+_0x8fb874[_0xc951('0x30')]['filter']+'%'};return _0x58e487;})});}_0xf94d32=_[_0xc951('0x3c')]({},_0xf94d32,_0x8fb874[_0xc951('0x3d')]);return _0x2de9d4[_0xc951('0x48')](_0xf94d32);}})[_0xc951('0x22')](function(_0x3ef610){if(_0x3ef610){_0x3a511f=_0x3ef610[_0xc951('0x36')];if(!_0x8fb874[_0xc951('0x30')][_0xc951('0x37')](_0xc951('0x4c'))){_0xf94d32[_0xc951('0x1f')]=qs[_0xc951('0x1f')](_0x8fb874[_0xc951('0x30')][_0xc951('0x1f')]);_0xf94d32[_0xc951('0x1e')]=qs[_0xc951('0x1e')](_0x8fb874['query'][_0xc951('0x1e')]);}return _0x2de9d4[_0xc951('0x48')](_0xf94d32);}})[_0xc951('0x22')](function(_0x5ecc65){if(_0x5ecc65){return _0x5ecc65?{'count':_0x3a511f,'rows':_0x5ecc65}:null;}})[_0xc951('0x22')](respondWithResult(_0x3278a3,null))[_0xc951('0x45')](handleError(_0x3278a3,null));};exports[_0xc951('0x4d')]=function(_0x22f3fb,_0x50c912,_0x40824d){var _0x798591={};var _0x176693={};var _0x2cba4e;var _0x19e97f;return db[_0xc951('0x2a')][_0xc951('0x49')]({'where':{'id':_0x22f3fb['params']['id']}})[_0xc951('0x22')](handleEntityNotFound(_0x50c912,null))[_0xc951('0x22')](function(_0x1d6973){if(_0x1d6973){_0x2cba4e=_0x1d6973;_0x176693[_0xc951('0x2f')]=_[_0xc951('0x31')](db[_0xc951('0x4a')][_0xc951('0x2b')]);_0x176693[_0xc951('0x30')]=_['keys'](_0x22f3fb[_0xc951('0x30')]);_0x176693[_0xc951('0x32')]=_[_0xc951('0x33')](_0x176693[_0xc951('0x2f')],_0x176693[_0xc951('0x30')]);_0x798591[_0xc951('0x34')]=_[_0xc951('0x33')](_0x176693[_0xc951('0x2f')],qs[_0xc951('0x35')](_0x22f3fb[_0xc951('0x30')][_0xc951('0x35')]));_0x798591[_0xc951('0x34')]=_0x798591[_0xc951('0x34')][_0xc951('0x36')]?_0x798591['attributes']:_0x176693[_0xc951('0x2f')];_0x798591[_0xc951('0x38')]=qs[_0xc951('0x39')](_0x22f3fb[_0xc951('0x30')][_0xc951('0x39')]);_0x798591[_0xc951('0x3a')]=qs['filters'](_[_0xc951('0x4b')](_0x22f3fb[_0xc951('0x30')],_0x176693[_0xc951('0x32')]));if(_0x22f3fb['query'][_0xc951('0x3b')]){_0x798591[_0xc951('0x3a')]=_[_0xc951('0x3c')](_0x798591['where'],{'$or':_[_0xc951('0x29')](_0x798591[_0xc951('0x34')],function(_0xb80cad){var _0x5c02a1={};_0x5c02a1[_0xb80cad]={'$like':'%'+_0x22f3fb[_0xc951('0x30')][_0xc951('0x3b')]+'%'};return _0x5c02a1;})});}_0x798591=_['merge']({},_0x798591,_0x22f3fb[_0xc951('0x3d')]);return _0x2cba4e[_0xc951('0x4d')](_0x798591);}})['then'](function(_0x573b12){if(_0x573b12){_0x19e97f=_0x573b12[_0xc951('0x36')];if(!_0x22f3fb[_0xc951('0x30')]['hasOwnProperty'](_0xc951('0x4c'))){_0x798591[_0xc951('0x1f')]=qs['limit'](_0x22f3fb[_0xc951('0x30')][_0xc951('0x1f')]);_0x798591[_0xc951('0x1e')]=qs[_0xc951('0x1e')](_0x22f3fb[_0xc951('0x30')][_0xc951('0x1e')]);}return _0x2cba4e[_0xc951('0x4d')](_0x798591);}})[_0xc951('0x22')](function(_0x5b3a66){if(_0x5b3a66){return _0x5b3a66?{'count':_0x19e97f,'rows':_0x5b3a66}:null;}})[_0xc951('0x22')](respondWithResult(_0x50c912,null))[_0xc951('0x45')](handleError(_0x50c912,null));};exports[_0xc951('0x4e')]=function(_0x475cfe,_0x3e5354,_0x14109c){var _0x437f17={};var _0x266e22={};var _0x3f4254;var _0x1cadf3;return db[_0xc951('0x2a')][_0xc951('0x49')]({'where':{'id':_0x475cfe['params']['id']}})[_0xc951('0x22')](handleEntityNotFound(_0x3e5354,null))[_0xc951('0x22')](function(_0x18a919){if(_0x18a919){_0x3f4254=_0x18a919;_0x266e22[_0xc951('0x2f')]=_['keys'](db[_0xc951('0x4a')][_0xc951('0x2b')]);_0x266e22['query']=_[_0xc951('0x31')](_0x475cfe[_0xc951('0x30')]);_0x266e22[_0xc951('0x32')]=_[_0xc951('0x33')](_0x266e22[_0xc951('0x2f')],_0x266e22[_0xc951('0x30')]);_0x437f17[_0xc951('0x34')]=_[_0xc951('0x33')](_0x266e22['model'],qs['fields'](_0x475cfe[_0xc951('0x30')][_0xc951('0x35')]));_0x437f17[_0xc951('0x34')]=_0x437f17['attributes'][_0xc951('0x36')]?_0x437f17[_0xc951('0x34')]:_0x266e22[_0xc951('0x2f')];_0x437f17[_0xc951('0x38')]=qs[_0xc951('0x39')](_0x475cfe[_0xc951('0x30')][_0xc951('0x39')]);_0x437f17[_0xc951('0x3a')]=qs[_0xc951('0x32')](_[_0xc951('0x4b')](_0x475cfe['query'],_0x266e22[_0xc951('0x32')]));if(_0x475cfe[_0xc951('0x30')]['filter']){_0x437f17[_0xc951('0x3a')]=_[_0xc951('0x3c')](_0x437f17[_0xc951('0x3a')],{'$or':_[_0xc951('0x29')](_0x437f17['attributes'],function(_0x1a9249){var _0x3fc4ad={};_0x3fc4ad[_0x1a9249]={'$like':'%'+_0x475cfe[_0xc951('0x30')][_0xc951('0x3b')]+'%'};return _0x3fc4ad;})});}_0x437f17=_[_0xc951('0x3c')]({},_0x437f17,_0x475cfe['options']);return _0x3f4254['getDescriptions'](_0x437f17);}})[_0xc951('0x22')](function(_0x174574){if(_0x174574){_0x1cadf3=_0x174574[_0xc951('0x36')];if(!_0x475cfe[_0xc951('0x30')][_0xc951('0x37')]('nolimit')){_0x437f17['limit']=qs[_0xc951('0x1f')](_0x475cfe[_0xc951('0x30')][_0xc951('0x1f')]);_0x437f17[_0xc951('0x1e')]=qs[_0xc951('0x1e')](_0x475cfe['query']['offset']);}return _0x3f4254[_0xc951('0x4e')](_0x437f17);}})['then'](function(_0x19039e){if(_0x19039e){return _0x19039e?{'count':_0x1cadf3,'rows':_0x19039e}:null;}})[_0xc951('0x22')](respondWithResult(_0x3e5354,null))[_0xc951('0x45')](handleError(_0x3e5354,null));}; \ No newline at end of file +var _0x78db=['stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','rows','catch','params','options','create','body','find','getFields','findOne','VtigerField','length','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','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/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error'];(function(_0x548003,_0x19cd0e){var _0x459a44=function(_0x1057c3){while(--_0x1057c3){_0x548003['push'](_0x548003['shift']());}};_0x459a44(++_0x19cd0e);}(_0x78db,0xcc));var _0xb78d=function(_0x2e2b45,_0x2a07e3){_0x2e2b45=_0x2e2b45-0x0;var _0x2bf3c2=_0x78db[_0x2e2b45];return _0x2bf3c2;};'use strict';var emlformat=require(_0xb78d('0x0'));var rimraf=require(_0xb78d('0x1'));var zipdir=require(_0xb78d('0x2'));var jsonpatch=require(_0xb78d('0x3'));var rp=require(_0xb78d('0x4'));var moment=require(_0xb78d('0x5'));var BPromise=require(_0xb78d('0x6'));var Mustache=require('mustache');var util=require(_0xb78d('0x7'));var path=require(_0xb78d('0x8'));var sox=require('sox');var csv=require(_0xb78d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb78d('0xa'));var _=require(_0xb78d('0xb'));var squel=require(_0xb78d('0xc'));var crypto=require(_0xb78d('0xd'));var jsforce=require(_0xb78d('0xe'));var deskjs=require(_0xb78d('0xf'));var toCsv=require(_0xb78d('0x9'));var querystring=require('querystring');var Papa=require(_0xb78d('0x10'));var Redis=require(_0xb78d('0x11'));var authService=require(_0xb78d('0x12'));var qs=require(_0xb78d('0x13'));var as=require(_0xb78d('0x14'));var hardwareService=require(_0xb78d('0x15'));var logger=require(_0xb78d('0x16'))(_0xb78d('0x17'));var utils=require(_0xb78d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb78d('0x19'));var db=require(_0xb78d('0x1a'))['db'];function respondWithStatusCode(_0x297911,_0x110f18){_0x110f18=_0x110f18||0xcc;return function(_0x21dd8e){if(_0x21dd8e){return _0x297911['sendStatus'](_0x110f18);}return _0x297911['status'](_0x110f18)[_0xb78d('0x1b')]();};}function respondWithResult(_0x3cd53b,_0x198f73){_0x198f73=_0x198f73||0xc8;return function(_0x3717d3){if(_0x3717d3){return _0x3cd53b[_0xb78d('0x1c')](_0x198f73)[_0xb78d('0x1d')](_0x3717d3);}};}function respondWithFilteredResult(_0xaf46b0,_0x173c43){return function(_0x476431){if(_0x476431){var _0x24fb45=typeof _0x173c43[_0xb78d('0x1e')]===_0xb78d('0x1f')&&typeof _0x173c43['limit']===_0xb78d('0x1f');var _0x3c70b9=_0x476431[_0xb78d('0x20')];var _0x2839e5=_0x24fb45?0x0:_0x173c43['offset'];var _0x3c3489=_0x24fb45?_0x476431[_0xb78d('0x20')]:_0x173c43[_0xb78d('0x1e')]+_0x173c43[_0xb78d('0x21')];var _0x5ae008;if(_0x3c3489>=_0x3c70b9){_0x3c3489=_0x3c70b9;_0x5ae008=0xc8;}else{_0x5ae008=0xce;}_0xaf46b0[_0xb78d('0x1c')](_0x5ae008);return _0xaf46b0[_0xb78d('0x22')](_0xb78d('0x23'),_0x2839e5+'-'+_0x3c3489+'/'+_0x3c70b9)['json'](_0x476431);}return null;};}function patchUpdates(_0x5def3f){return function(_0x41496c){try{jsonpatch['apply'](_0x41496c,_0x5def3f,!![]);}catch(_0x101f05){return BPromise[_0xb78d('0x24')](_0x101f05);}return _0x41496c['save']();};}function saveUpdates(_0x122687,_0xb2c350){return function(_0x45cc89){if(_0x45cc89){return _0x45cc89[_0xb78d('0x25')](_0x122687)[_0xb78d('0x26')](function(_0x5b9a6c){return _0x5b9a6c;});}return null;};}function removeEntity(_0x1a38f7,_0x13fdb2){return function(_0x77868a){if(_0x77868a){return _0x77868a[_0xb78d('0x27')]()['then'](function(){_0x1a38f7['status'](0xcc)[_0xb78d('0x1b')]();});}};}function handleEntityNotFound(_0x6b2d13,_0x57cde7){return function(_0x21bb4b){if(!_0x21bb4b){_0x6b2d13[_0xb78d('0x28')](0x194);}return _0x21bb4b;};}function handleError(_0x665909,_0x363788){_0x363788=_0x363788||0x1f4;return function(_0x7a052b){logger[_0xb78d('0x29')](_0x7a052b[_0xb78d('0x2a')]);if(_0x7a052b[_0xb78d('0x2b')]){delete _0x7a052b[_0xb78d('0x2b')];}_0x665909[_0xb78d('0x1c')](_0x363788)[_0xb78d('0x2c')](_0x7a052b);};}exports[_0xb78d('0x2d')]=function(_0x6123da,_0x42089a){var _0x26a846={},_0xc41f21={},_0x5940b8={'count':0x0,'rows':[]};var _0x308792=_[_0xb78d('0x2e')](db['VtigerConfiguration'][_0xb78d('0x2f')],function(_0x59bf4b){return{'name':_0x59bf4b['fieldName'],'type':_0x59bf4b[_0xb78d('0x30')]['key']};});_0xc41f21['model']=_[_0xb78d('0x2e')](_0x308792,_0xb78d('0x2b'));_0xc41f21[_0xb78d('0x31')]=_[_0xb78d('0x32')](_0x6123da[_0xb78d('0x31')]);_0xc41f21[_0xb78d('0x33')]=_[_0xb78d('0x34')](_0xc41f21[_0xb78d('0x35')],_0xc41f21[_0xb78d('0x31')]);_0x26a846[_0xb78d('0x36')]=_['intersection'](_0xc41f21[_0xb78d('0x35')],qs['fields'](_0x6123da[_0xb78d('0x31')][_0xb78d('0x37')]));_0x26a846[_0xb78d('0x36')]=_0x26a846[_0xb78d('0x36')]['length']?_0x26a846['attributes']:_0xc41f21[_0xb78d('0x35')];if(!_0x6123da[_0xb78d('0x31')][_0xb78d('0x38')](_0xb78d('0x39'))){_0x26a846[_0xb78d('0x21')]=qs[_0xb78d('0x21')](_0x6123da[_0xb78d('0x31')][_0xb78d('0x21')]);_0x26a846[_0xb78d('0x1e')]=qs[_0xb78d('0x1e')](_0x6123da[_0xb78d('0x31')][_0xb78d('0x1e')]);}_0x26a846[_0xb78d('0x3a')]=qs[_0xb78d('0x3b')](_0x6123da[_0xb78d('0x31')][_0xb78d('0x3b')]);_0x26a846['where']=qs['filters'](_['pick'](_0x6123da[_0xb78d('0x31')],_0xc41f21[_0xb78d('0x33')]),_0x308792);if(_0x6123da[_0xb78d('0x31')][_0xb78d('0x3c')]){_0x26a846['where']=_[_0xb78d('0x3d')](_0x26a846[_0xb78d('0x3e')],{'$or':_[_0xb78d('0x2e')](_0x308792,function(_0x41f6c3){if(_0x41f6c3[_0xb78d('0x30')]!==_0xb78d('0x3f')){var _0x24dd9b={};_0x24dd9b[_0x41f6c3[_0xb78d('0x2b')]]={'$like':'%'+_0x6123da['query'][_0xb78d('0x3c')]+'%'};return _0x24dd9b;}})});}_0x26a846=_[_0xb78d('0x3d')]({},_0x26a846,_0x6123da['options']);var _0x5723ce={'where':_0x26a846[_0xb78d('0x3e')]};return db['VtigerConfiguration'][_0xb78d('0x20')](_0x5723ce)[_0xb78d('0x26')](function(_0x348353){_0x5940b8[_0xb78d('0x20')]=_0x348353;if(_0x6123da[_0xb78d('0x31')][_0xb78d('0x40')]){_0x26a846[_0xb78d('0x41')]=[{'all':!![]}];}return db[_0xb78d('0x42')][_0xb78d('0x43')](_0x26a846);})[_0xb78d('0x26')](function(_0x3cbe13){_0x5940b8[_0xb78d('0x44')]=_0x3cbe13;return _0x5940b8;})[_0xb78d('0x26')](respondWithFilteredResult(_0x42089a,_0x26a846))[_0xb78d('0x45')](handleError(_0x42089a,null));};exports['show']=function(_0x4a6911,_0x261551){var _0x14b122={'raw':![],'where':{'id':_0x4a6911[_0xb78d('0x46')]['id']}},_0x25e35a={};_0x25e35a['model']=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x25e35a[_0xb78d('0x31')]=_['keys'](_0x4a6911['query']);_0x25e35a[_0xb78d('0x33')]=_[_0xb78d('0x34')](_0x25e35a[_0xb78d('0x35')],_0x25e35a[_0xb78d('0x31')]);_0x14b122[_0xb78d('0x36')]=_[_0xb78d('0x34')](_0x25e35a['model'],qs[_0xb78d('0x37')](_0x4a6911[_0xb78d('0x31')][_0xb78d('0x37')]));_0x14b122['attributes']=_0x14b122[_0xb78d('0x36')]['length']?_0x14b122['attributes']:_0x25e35a[_0xb78d('0x35')];if(_0x4a6911[_0xb78d('0x31')][_0xb78d('0x40')]){_0x14b122[_0xb78d('0x41')]=[{'all':!![]}];}_0x14b122=_['merge']({},_0x14b122,_0x4a6911[_0xb78d('0x47')]);return db[_0xb78d('0x42')]['find'](_0x14b122)['then'](handleEntityNotFound(_0x261551,null))[_0xb78d('0x26')](respondWithResult(_0x261551,null))[_0xb78d('0x45')](handleError(_0x261551,null));};exports['create']=function(_0x577d4a,_0x10d42c){return db['VtigerConfiguration'][_0xb78d('0x48')](_0x577d4a[_0xb78d('0x49')],{})[_0xb78d('0x26')](respondWithResult(_0x10d42c,0xc9))[_0xb78d('0x45')](handleError(_0x10d42c,null));};exports['update']=function(_0x858e6b,_0x438cbb){if(_0x858e6b[_0xb78d('0x49')]['id']){delete _0x858e6b[_0xb78d('0x49')]['id'];}return db['VtigerConfiguration'][_0xb78d('0x4a')]({'where':{'id':_0x858e6b[_0xb78d('0x46')]['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x438cbb,null))[_0xb78d('0x26')](saveUpdates(_0x858e6b[_0xb78d('0x49')],null))[_0xb78d('0x26')](respondWithResult(_0x438cbb,null))[_0xb78d('0x45')](handleError(_0x438cbb,null));};exports[_0xb78d('0x27')]=function(_0x2171ff,_0x14b433){return db[_0xb78d('0x42')][_0xb78d('0x4a')]({'where':{'id':_0x2171ff[_0xb78d('0x46')]['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x14b433,null))[_0xb78d('0x26')](removeEntity(_0x14b433,null))[_0xb78d('0x45')](handleError(_0x14b433,null));};exports[_0xb78d('0x4b')]=function(_0x5770a5,_0x29beae,_0x4a6e08){var _0x391054={};var _0xe9500={};var _0x182095;var _0x5cfdda;return db['VtigerConfiguration'][_0xb78d('0x4c')]({'where':{'id':_0x5770a5[_0xb78d('0x46')]['id']}})['then'](handleEntityNotFound(_0x29beae,null))['then'](function(_0x4e7044){if(_0x4e7044){_0x182095=_0x4e7044;_0xe9500[_0xb78d('0x35')]=_['keys'](db[_0xb78d('0x4d')][_0xb78d('0x2f')]);_0xe9500['query']=_['keys'](_0x5770a5['query']);_0xe9500[_0xb78d('0x33')]=_[_0xb78d('0x34')](_0xe9500[_0xb78d('0x35')],_0xe9500[_0xb78d('0x31')]);_0x391054[_0xb78d('0x36')]=_['intersection'](_0xe9500[_0xb78d('0x35')],qs[_0xb78d('0x37')](_0x5770a5[_0xb78d('0x31')][_0xb78d('0x37')]));_0x391054[_0xb78d('0x36')]=_0x391054[_0xb78d('0x36')][_0xb78d('0x4e')]?_0x391054[_0xb78d('0x36')]:_0xe9500[_0xb78d('0x35')];_0x391054['order']=qs[_0xb78d('0x3b')](_0x5770a5[_0xb78d('0x31')]['sort']);_0x391054[_0xb78d('0x3e')]=qs[_0xb78d('0x33')](_['pick'](_0x5770a5[_0xb78d('0x31')],_0xe9500['filters']));if(_0x5770a5[_0xb78d('0x31')][_0xb78d('0x3c')]){_0x391054[_0xb78d('0x3e')]=_['merge'](_0x391054[_0xb78d('0x3e')],{'$or':_[_0xb78d('0x2e')](_0x391054[_0xb78d('0x36')],function(_0x26a133){var _0x38d82d={};_0x38d82d[_0x26a133]={'$like':'%'+_0x5770a5[_0xb78d('0x31')][_0xb78d('0x3c')]+'%'};return _0x38d82d;})});}_0x391054=_[_0xb78d('0x3d')]({},_0x391054,_0x5770a5['options']);return _0x182095[_0xb78d('0x4b')](_0x391054);}})[_0xb78d('0x26')](function(_0x5982b4){if(_0x5982b4){_0x5cfdda=_0x5982b4[_0xb78d('0x4e')];if(!_0x5770a5['query'][_0xb78d('0x38')]('nolimit')){_0x391054[_0xb78d('0x21')]=qs[_0xb78d('0x21')](_0x5770a5['query']['limit']);_0x391054[_0xb78d('0x1e')]=qs[_0xb78d('0x1e')](_0x5770a5[_0xb78d('0x31')]['offset']);}return _0x182095['getFields'](_0x391054);}})[_0xb78d('0x26')](function(_0x4af14){if(_0x4af14){return _0x4af14?{'count':_0x5cfdda,'rows':_0x4af14}:null;}})[_0xb78d('0x26')](respondWithResult(_0x29beae,null))[_0xb78d('0x45')](handleError(_0x29beae,null));};exports['getSubjects']=function(_0x1a1271,_0x28dfb1,_0x26aaca){var _0x3a3f78={};var _0x2473f3={};var _0x5986e8;var _0x210adc;return db[_0xb78d('0x42')][_0xb78d('0x4c')]({'where':{'id':_0x1a1271['params']['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x28dfb1,null))[_0xb78d('0x26')](function(_0x4519a2){if(_0x4519a2){_0x5986e8=_0x4519a2;_0x2473f3[_0xb78d('0x35')]=_['keys'](db[_0xb78d('0x4d')][_0xb78d('0x2f')]);_0x2473f3[_0xb78d('0x31')]=_[_0xb78d('0x32')](_0x1a1271['query']);_0x2473f3[_0xb78d('0x33')]=_[_0xb78d('0x34')](_0x2473f3[_0xb78d('0x35')],_0x2473f3['query']);_0x3a3f78[_0xb78d('0x36')]=_['intersection'](_0x2473f3['model'],qs[_0xb78d('0x37')](_0x1a1271[_0xb78d('0x31')]['fields']));_0x3a3f78[_0xb78d('0x36')]=_0x3a3f78[_0xb78d('0x36')]['length']?_0x3a3f78['attributes']:_0x2473f3[_0xb78d('0x35')];_0x3a3f78[_0xb78d('0x3a')]=qs[_0xb78d('0x3b')](_0x1a1271['query']['sort']);_0x3a3f78[_0xb78d('0x3e')]=qs['filters'](_[_0xb78d('0x4f')](_0x1a1271[_0xb78d('0x31')],_0x2473f3[_0xb78d('0x33')]));if(_0x1a1271[_0xb78d('0x31')]['filter']){_0x3a3f78[_0xb78d('0x3e')]=_[_0xb78d('0x3d')](_0x3a3f78[_0xb78d('0x3e')],{'$or':_[_0xb78d('0x2e')](_0x3a3f78[_0xb78d('0x36')],function(_0x272831){var _0x16adc1={};_0x16adc1[_0x272831]={'$like':'%'+_0x1a1271[_0xb78d('0x31')][_0xb78d('0x3c')]+'%'};return _0x16adc1;})});}_0x3a3f78=_[_0xb78d('0x3d')]({},_0x3a3f78,_0x1a1271[_0xb78d('0x47')]);return _0x5986e8[_0xb78d('0x50')](_0x3a3f78);}})[_0xb78d('0x26')](function(_0x885151){if(_0x885151){_0x210adc=_0x885151['length'];if(!_0x1a1271[_0xb78d('0x31')][_0xb78d('0x38')](_0xb78d('0x39'))){_0x3a3f78[_0xb78d('0x21')]=qs[_0xb78d('0x21')](_0x1a1271[_0xb78d('0x31')]['limit']);_0x3a3f78[_0xb78d('0x1e')]=qs['offset'](_0x1a1271[_0xb78d('0x31')]['offset']);}return _0x5986e8[_0xb78d('0x50')](_0x3a3f78);}})[_0xb78d('0x26')](function(_0x504412){if(_0x504412){return _0x504412?{'count':_0x210adc,'rows':_0x504412}:null;}})[_0xb78d('0x26')](respondWithResult(_0x28dfb1,null))[_0xb78d('0x45')](handleError(_0x28dfb1,null));};exports[_0xb78d('0x51')]=function(_0x5cec0e,_0x117d95,_0xde94c3){var _0xf3cd27={};var _0x5aa5a1={};var _0x2ae25b;var _0xf908c2;return db[_0xb78d('0x42')]['findOne']({'where':{'id':_0x5cec0e[_0xb78d('0x46')]['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x117d95,null))[_0xb78d('0x26')](function(_0x39f453){if(_0x39f453){_0x2ae25b=_0x39f453;_0x5aa5a1[_0xb78d('0x35')]=_[_0xb78d('0x32')](db[_0xb78d('0x4d')][_0xb78d('0x2f')]);_0x5aa5a1[_0xb78d('0x31')]=_[_0xb78d('0x32')](_0x5cec0e[_0xb78d('0x31')]);_0x5aa5a1['filters']=_[_0xb78d('0x34')](_0x5aa5a1[_0xb78d('0x35')],_0x5aa5a1[_0xb78d('0x31')]);_0xf3cd27['attributes']=_[_0xb78d('0x34')](_0x5aa5a1[_0xb78d('0x35')],qs[_0xb78d('0x37')](_0x5cec0e[_0xb78d('0x31')]['fields']));_0xf3cd27['attributes']=_0xf3cd27[_0xb78d('0x36')][_0xb78d('0x4e')]?_0xf3cd27[_0xb78d('0x36')]:_0x5aa5a1['model'];_0xf3cd27[_0xb78d('0x3a')]=qs[_0xb78d('0x3b')](_0x5cec0e['query'][_0xb78d('0x3b')]);_0xf3cd27[_0xb78d('0x3e')]=qs[_0xb78d('0x33')](_[_0xb78d('0x4f')](_0x5cec0e[_0xb78d('0x31')],_0x5aa5a1[_0xb78d('0x33')]));if(_0x5cec0e['query'][_0xb78d('0x3c')]){_0xf3cd27['where']=_['merge'](_0xf3cd27[_0xb78d('0x3e')],{'$or':_[_0xb78d('0x2e')](_0xf3cd27['attributes'],function(_0x41e6f6){var _0x5f5b1b={};_0x5f5b1b[_0x41e6f6]={'$like':'%'+_0x5cec0e[_0xb78d('0x31')][_0xb78d('0x3c')]+'%'};return _0x5f5b1b;})});}_0xf3cd27=_[_0xb78d('0x3d')]({},_0xf3cd27,_0x5cec0e[_0xb78d('0x47')]);return _0x2ae25b[_0xb78d('0x51')](_0xf3cd27);}})[_0xb78d('0x26')](function(_0x226c56){if(_0x226c56){_0xf908c2=_0x226c56[_0xb78d('0x4e')];if(!_0x5cec0e[_0xb78d('0x31')][_0xb78d('0x38')](_0xb78d('0x39'))){_0xf3cd27['limit']=qs[_0xb78d('0x21')](_0x5cec0e[_0xb78d('0x31')][_0xb78d('0x21')]);_0xf3cd27['offset']=qs['offset'](_0x5cec0e[_0xb78d('0x31')][_0xb78d('0x1e')]);}return _0x2ae25b[_0xb78d('0x51')](_0xf3cd27);}})['then'](function(_0x44de91){if(_0x44de91){return _0x44de91?{'count':_0xf908c2,'rows':_0x44de91}:null;}})[_0xb78d('0x26')](respondWithResult(_0x117d95,null))[_0xb78d('0x45')](handleError(_0x117d95,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4564748..0d9ba3e 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 _0xa4ef=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x245644,_0x4907fc){var _0x13e5fd=function(_0x5704ad){while(--_0x5704ad){_0x245644['push'](_0x245644['shift']());}};_0x13e5fd(++_0x4907fc);}(_0xa4ef,0xcb));var _0xfa4e=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa4ef[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa4e('0x0'))(_0xfa4e('0x1'));var moment=require(_0xfa4e('0x2'));var BPromise=require(_0xfa4e('0x3'));var rp=require(_0xfa4e('0x4'));var fs=require('fs');var path=require(_0xfa4e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa4e('0x6'));module[_0xfa4e('0x7')]=function(_0x464336,_0x4c4855){return _0x464336[_0xfa4e('0x8')](_0xfa4e('0x9'),attributes,{'tableName':_0xfa4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c3=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x52f1ca,_0x3f6d4f){var _0x15b351=function(_0x987e3c){while(--_0x987e3c){_0x52f1ca['push'](_0x52f1ca['shift']());}};_0x15b351(++_0x3f6d4f);}(_0xc1c3,0xa6));var _0x3c1c=function(_0x5b4b93,_0x43e509){_0x5b4b93=_0x5b4b93-0x0;var _0x663462=_0xc1c3[_0x5b4b93];return _0x663462;};'use strict';var _=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var logger=require(_0x3c1c('0x2'))(_0x3c1c('0x3'));var moment=require(_0x3c1c('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c1c('0x6'));var config=require(_0x3c1c('0x7'));var attributes=require(_0x3c1c('0x8'));module['exports']=function(_0x56b5c5,_0x3f7625){return _0x56b5c5[_0x3c1c('0x9')](_0x3c1c('0xa'),attributes,{'tableName':_0x3c1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index ba216a3..9733d9c 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 _0xca81=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e56dc,_0x53bd84){var _0x5ed964=function(_0x53c191){while(--_0x53c191){_0x5e56dc['push'](_0x5e56dc['shift']());}};_0x5ed964(++_0x53bd84);}(_0xca81,0x16d));var _0x1ca8=function(_0x11859e,_0x287d2b){_0x11859e=_0x11859e-0x0;var _0x1d306b=_0xca81[_0x11859e];return _0x1d306b;};'use strict';var _=require('lodash');var util=require(_0x1ca8('0x0'));var moment=require(_0x1ca8('0x1'));var BPromise=require(_0x1ca8('0x2'));var rs=require(_0x1ca8('0x3'));var fs=require('fs');var Redis=require(_0x1ca8('0x4'));var db=require(_0x1ca8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1ca8('0x6'));var config=require(_0x1ca8('0x7'));var jayson=require(_0x1ca8('0x8'));var client=jayson[_0x1ca8('0x9')][_0x1ca8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f2b3e,_0x695b95,_0x485e19){return new BPromise(function(_0x2a44a7,_0x4e323c){return client[_0x1ca8('0xb')](_0x5f2b3e,_0x485e19)[_0x1ca8('0xc')](function(_0x20e684){logger[_0x1ca8('0xd')](_0x1ca8('0xe'),_0x695b95,_0x1ca8('0xf'));logger[_0x1ca8('0x10')](_0x1ca8('0x11'),_0x695b95,_0x1ca8('0xf'),JSON[_0x1ca8('0x12')](_0x20e684));if(_0x20e684[_0x1ca8('0x13')]){if(_0x20e684[_0x1ca8('0x13')][_0x1ca8('0x14')]===0x1f4){logger['error'](_0x1ca8('0xe'),_0x695b95,_0x20e684[_0x1ca8('0x13')]['message']);return _0x4e323c(_0x20e684['error'][_0x1ca8('0x15')]);}logger[_0x1ca8('0x13')](_0x1ca8('0xe'),_0x695b95,_0x20e684[_0x1ca8('0x13')][_0x1ca8('0x15')]);return _0x2a44a7(_0x20e684['error'][_0x1ca8('0x15')]);}else{logger[_0x1ca8('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x695b95,_0x1ca8('0xf'));_0x2a44a7(_0x20e684[_0x1ca8('0x16')][_0x1ca8('0x15')]);}})[_0x1ca8('0x17')](function(_0x5645ca){logger[_0x1ca8('0x13')](_0x1ca8('0xe'),_0x695b95,_0x5645ca);_0x4e323c(_0x5645ca);});});} \ No newline at end of file +var _0xe5bc=['../../config/utils','rpc','../../config/environment','jayson/promise','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5f1431,_0x49bea0){var _0x165500=function(_0xdb081a){while(--_0xdb081a){_0x5f1431['push'](_0x5f1431['shift']());}};_0x165500(++_0x49bea0);}(_0xe5bc,0x1dd));var _0xce5b=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xe5bc[_0x4480b9];return _0x3f0f02;};'use strict';var _=require(_0xce5b('0x0'));var util=require(_0xce5b('0x1'));var moment=require(_0xce5b('0x2'));var BPromise=require(_0xce5b('0x3'));var rs=require(_0xce5b('0x4'));var fs=require('fs');var Redis=require(_0xce5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce5b('0x6'));var logger=require('../../config/logger')(_0xce5b('0x7'));var config=require(_0xce5b('0x8'));var jayson=require(_0xce5b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15b1a8,_0x439a68,_0x253ce6){return new BPromise(function(_0x565f7a,_0x303b5){return client[_0xce5b('0xa')](_0x15b1a8,_0x253ce6)['then'](function(_0x161c20){logger['info'](_0xce5b('0xb'),_0x439a68,_0xce5b('0xc'));logger[_0xce5b('0xd')](_0xce5b('0xe'),_0x439a68,'request\x20sent',JSON[_0xce5b('0xf')](_0x161c20));if(_0x161c20[_0xce5b('0x10')]){if(_0x161c20[_0xce5b('0x10')][_0xce5b('0x11')]===0x1f4){logger['error'](_0xce5b('0xb'),_0x439a68,_0x161c20['error'][_0xce5b('0x12')]);return _0x303b5(_0x161c20[_0xce5b('0x10')]['message']);}logger[_0xce5b('0x10')](_0xce5b('0xb'),_0x439a68,_0x161c20[_0xce5b('0x10')]['message']);return _0x565f7a(_0x161c20[_0xce5b('0x10')][_0xce5b('0x12')]);}else{logger['info'](_0xce5b('0xb'),_0x439a68,'request\x20sent');_0x565f7a(_0x161c20[_0xce5b('0x13')][_0xce5b('0x12')]);}})[_0xce5b('0x14')](function(_0x134332){logger['error'](_0xce5b('0xb'),_0x439a68,_0x134332);_0x303b5(_0x134332);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index b8a570a..77b9cbd 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 _0xb1c8=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','connect-timeout'];(function(_0x54e645,_0x178e60){var _0x565072=function(_0x1bfa07){while(--_0x1bfa07){_0x54e645['push'](_0x54e645['shift']());}};_0x565072(++_0x178e60);}(_0xb1c8,0x1a8));var _0x8b1c=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xb1c8[_0x3b3f4f];return _0x174dbe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8b1c('0x0'));var express=require(_0x8b1c('0x1'));var router=express['Router']();var fs_extra=require(_0x8b1c('0x2'));var auth=require(_0x8b1c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8b1c('0x4'));var controller=require('./intVtigerField.controller');router[_0x8b1c('0x5')]('/',auth[_0x8b1c('0x6')](),controller[_0x8b1c('0x7')]);router[_0x8b1c('0x5')]('/:id',auth[_0x8b1c('0x6')](),controller[_0x8b1c('0x8')]);router[_0x8b1c('0x9')]('/',auth[_0x8b1c('0x6')](),controller[_0x8b1c('0xa')]);router[_0x8b1c('0xb')](_0x8b1c('0xc'),auth['isAuthenticated'](),controller[_0x8b1c('0xd')]);router[_0x8b1c('0xe')](_0x8b1c('0xc'),auth[_0x8b1c('0x6')](),controller[_0x8b1c('0xf')]);module[_0x8b1c('0x10')]=router; \ No newline at end of file +var _0xc7ca=['get','isAuthenticated','show','post','create','put','/:id','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller'];(function(_0xc5975b,_0x41608d){var _0x1452a0=function(_0x25deaa){while(--_0x25deaa){_0xc5975b['push'](_0xc5975b['shift']());}};_0x1452a0(++_0x41608d);}(_0xc7ca,0x1c8));var _0xac7c=function(_0x261a4c,_0x5b3eeb){_0x261a4c=_0x261a4c-0x0;var _0x1abaf8=_0xc7ca[_0x261a4c];return _0x1abaf8;};'use strict';var multer=require(_0xac7c('0x0'));var util=require(_0xac7c('0x1'));var path=require(_0xac7c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac7c('0x3')]();var fs_extra=require(_0xac7c('0x4'));var auth=require(_0xac7c('0x5'));var interaction=require(_0xac7c('0x6'));var config=require('../../config/environment');var controller=require(_0xac7c('0x7'));router[_0xac7c('0x8')]('/',auth[_0xac7c('0x9')](),controller['index']);router['get']('/:id',auth[_0xac7c('0x9')](),controller[_0xac7c('0xa')]);router[_0xac7c('0xb')]('/',auth[_0xac7c('0x9')](),controller[_0xac7c('0xc')]);router[_0xac7c('0xd')](_0xac7c('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xac7c('0xe'),auth[_0xac7c('0x9')](),controller['destroy']);module[_0xac7c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 5133cc7..07679c7 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 _0xa283=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3008ee,_0xba7d04){var _0x13ed61=function(_0x1789d9){while(--_0x1789d9){_0x3008ee['push'](_0x3008ee['shift']());}};_0x13ed61(++_0xba7d04);}(_0xa283,0x1b3));var _0x3a28=function(_0x2fb426,_0x925ce1){_0x2fb426=_0x2fb426-0x0;var _0x57ec50=_0xa283[_0x2fb426];return _0x57ec50;};'use strict';var Sequelize=require(_0x3a28('0x0'));module[_0x3a28('0x1')]={'type':{'type':Sequelize[_0x3a28('0x2')](_0x3a28('0x3'),_0x3a28('0x4'),_0x3a28('0x5'),'keyValue',_0x3a28('0x6')),'defaultValue':_0x3a28('0x3')},'content':{'type':Sequelize[_0x3a28('0x7')]},'key':{'type':Sequelize[_0x3a28('0x7')]},'keyType':{'type':Sequelize[_0x3a28('0x2')]('string',_0x3a28('0x4'),_0x3a28('0x5'))},'keyContent':{'type':Sequelize[_0x3a28('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3a28('0x7')]},'customField':{'type':Sequelize[_0x3a28('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25c8=['string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','STRING'];(function(_0x3e4abe,_0x4a9af8){var _0x47e61d=function(_0x5a112f){while(--_0x5a112f){_0x3e4abe['push'](_0x3e4abe['shift']());}};_0x47e61d(++_0x4a9af8);}(_0x25c8,0x11b));var _0x825c=function(_0x134612,_0x3d27be){_0x134612=_0x134612-0x0;var _0x57a3a3=_0x25c8[_0x134612];return _0x57a3a3;};'use strict';var Sequelize=require(_0x825c('0x0'));module[_0x825c('0x1')]={'type':{'type':Sequelize[_0x825c('0x2')]('string','variable',_0x825c('0x3'),_0x825c('0x4'),_0x825c('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x825c('0x6')]},'keyType':{'type':Sequelize[_0x825c('0x2')](_0x825c('0x7'),_0x825c('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x825c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x825c('0x6')]},'customField':{'type':Sequelize[_0x825c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c93f99e..ee04698 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 _0x3b8a=['destroy','stack','name','send','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','VtigerField','findAll','rows','catch','show','include','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then'];(function(_0x58492f,_0x5a0b0d){var _0x1003af=function(_0x272b29){while(--_0x272b29){_0x58492f['push'](_0x58492f['shift']());}};_0x1003af(++_0x5a0b0d);}(_0x3b8a,0x72));var _0xa3b8=function(_0x2a8e04,_0x5004f6){_0x2a8e04=_0x2a8e04-0x0;var _0x361d08=_0x3b8a[_0x2a8e04];return _0x361d08;};'use strict';var emlformat=require(_0xa3b8('0x0'));var rimraf=require(_0xa3b8('0x1'));var zipdir=require(_0xa3b8('0x2'));var jsonpatch=require(_0xa3b8('0x3'));var rp=require(_0xa3b8('0x4'));var moment=require(_0xa3b8('0x5'));var BPromise=require(_0xa3b8('0x6'));var Mustache=require(_0xa3b8('0x7'));var util=require(_0xa3b8('0x8'));var path=require('path');var sox=require(_0xa3b8('0x9'));var csv=require(_0xa3b8('0xa'));var ejs=require(_0xa3b8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3b8('0xc'));var _=require(_0xa3b8('0xd'));var squel=require(_0xa3b8('0xe'));var crypto=require(_0xa3b8('0xf'));var jsforce=require(_0xa3b8('0x10'));var deskjs=require(_0xa3b8('0x11'));var toCsv=require(_0xa3b8('0xa'));var querystring=require(_0xa3b8('0x12'));var Papa=require(_0xa3b8('0x13'));var Redis=require(_0xa3b8('0x14'));var authService=require(_0xa3b8('0x15'));var qs=require(_0xa3b8('0x16'));var as=require(_0xa3b8('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3b8('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xa3b8('0x19'));var licenseUtil=require(_0xa3b8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f34a7,_0x18c206){_0x18c206=_0x18c206||0xcc;return function(_0x475954){if(_0x475954){return _0x2f34a7['sendStatus'](_0x18c206);}return _0x2f34a7[_0xa3b8('0x1b')](_0x18c206)[_0xa3b8('0x1c')]();};}function respondWithResult(_0x3d9fb8,_0x386bbd){_0x386bbd=_0x386bbd||0xc8;return function(_0x85512){if(_0x85512){return _0x3d9fb8[_0xa3b8('0x1b')](_0x386bbd)[_0xa3b8('0x1d')](_0x85512);}};}function respondWithFilteredResult(_0x5ed33a,_0xc8f1d6){return function(_0x56e1a7){if(_0x56e1a7){var _0x15aeec=typeof _0xc8f1d6[_0xa3b8('0x1e')]==='undefined'&&typeof _0xc8f1d6[_0xa3b8('0x1f')]===_0xa3b8('0x20');var _0x223425=_0x56e1a7[_0xa3b8('0x21')];var _0x214b39=_0x15aeec?0x0:_0xc8f1d6['offset'];var _0x4a307e=_0x15aeec?_0x56e1a7[_0xa3b8('0x21')]:_0xc8f1d6[_0xa3b8('0x1e')]+_0xc8f1d6['limit'];var _0x3a7454;if(_0x4a307e>=_0x223425){_0x4a307e=_0x223425;_0x3a7454=0xc8;}else{_0x3a7454=0xce;}_0x5ed33a['status'](_0x3a7454);return _0x5ed33a['set'](_0xa3b8('0x22'),_0x214b39+'-'+_0x4a307e+'/'+_0x223425)[_0xa3b8('0x1d')](_0x56e1a7);}return null;};}function patchUpdates(_0x179ac7){return function(_0x510f93){try{jsonpatch[_0xa3b8('0x23')](_0x510f93,_0x179ac7,!![]);}catch(_0xd81355){return BPromise[_0xa3b8('0x24')](_0xd81355);}return _0x510f93[_0xa3b8('0x25')]();};}function saveUpdates(_0xc6ff09,_0x9fac52){return function(_0x2b30ea){if(_0x2b30ea){return _0x2b30ea[_0xa3b8('0x26')](_0xc6ff09)[_0xa3b8('0x27')](function(_0x19dd30){return _0x19dd30;});}return null;};}function removeEntity(_0xb20db7,_0x386b84){return function(_0x323d5c){if(_0x323d5c){return _0x323d5c[_0xa3b8('0x28')]()['then'](function(){_0xb20db7[_0xa3b8('0x1b')](0xcc)[_0xa3b8('0x1c')]();});}};}function handleEntityNotFound(_0x15b781,_0x59e0f9){return function(_0x23ac17){if(!_0x23ac17){_0x15b781['sendStatus'](0x194);}return _0x23ac17;};}function handleError(_0x57ae42,_0x53a9c0){_0x53a9c0=_0x53a9c0||0x1f4;return function(_0x3cd5e2){logger['error'](_0x3cd5e2[_0xa3b8('0x29')]);if(_0x3cd5e2[_0xa3b8('0x2a')]){delete _0x3cd5e2[_0xa3b8('0x2a')];}_0x57ae42[_0xa3b8('0x1b')](_0x53a9c0)[_0xa3b8('0x2b')](_0x3cd5e2);};}exports['index']=function(_0x206ea3,_0x4f0860){var _0x5d4ed6={},_0x558081={},_0x53be15={'count':0x0,'rows':[]};var _0x53074d=_['map'](db['VtigerField'][_0xa3b8('0x2c')],function(_0x1c414d){return{'name':_0x1c414d[_0xa3b8('0x2d')],'type':_0x1c414d[_0xa3b8('0x2e')][_0xa3b8('0x2f')]};});_0x558081['model']=_['map'](_0x53074d,'name');_0x558081[_0xa3b8('0x30')]=_[_0xa3b8('0x31')](_0x206ea3[_0xa3b8('0x30')]);_0x558081[_0xa3b8('0x32')]=_[_0xa3b8('0x33')](_0x558081[_0xa3b8('0x34')],_0x558081[_0xa3b8('0x30')]);_0x5d4ed6[_0xa3b8('0x35')]=_[_0xa3b8('0x33')](_0x558081['model'],qs[_0xa3b8('0x36')](_0x206ea3[_0xa3b8('0x30')][_0xa3b8('0x36')]));_0x5d4ed6['attributes']=_0x5d4ed6[_0xa3b8('0x35')][_0xa3b8('0x37')]?_0x5d4ed6[_0xa3b8('0x35')]:_0x558081[_0xa3b8('0x34')];if(!_0x206ea3[_0xa3b8('0x30')][_0xa3b8('0x38')](_0xa3b8('0x39'))){_0x5d4ed6['limit']=qs[_0xa3b8('0x1f')](_0x206ea3[_0xa3b8('0x30')][_0xa3b8('0x1f')]);_0x5d4ed6[_0xa3b8('0x1e')]=qs['offset'](_0x206ea3[_0xa3b8('0x30')][_0xa3b8('0x1e')]);}_0x5d4ed6[_0xa3b8('0x3a')]=qs[_0xa3b8('0x3b')](_0x206ea3[_0xa3b8('0x30')]['sort']);_0x5d4ed6[_0xa3b8('0x3c')]=qs['filters'](_[_0xa3b8('0x3d')](_0x206ea3[_0xa3b8('0x30')],_0x558081[_0xa3b8('0x32')]),_0x53074d);if(_0x206ea3[_0xa3b8('0x30')][_0xa3b8('0x3e')]){_0x5d4ed6[_0xa3b8('0x3c')]=_[_0xa3b8('0x3f')](_0x5d4ed6['where'],{'$or':_[_0xa3b8('0x40')](_0x53074d,function(_0x3f97b7){if(_0x3f97b7['type']!==_0xa3b8('0x41')){var _0x5d8440={};_0x5d8440[_0x3f97b7[_0xa3b8('0x2a')]]={'$like':'%'+_0x206ea3[_0xa3b8('0x30')]['filter']+'%'};return _0x5d8440;}})});}_0x5d4ed6=_['merge']({},_0x5d4ed6,_0x206ea3[_0xa3b8('0x42')]);var _0x39613c={'where':_0x5d4ed6[_0xa3b8('0x3c')]};return db[_0xa3b8('0x43')][_0xa3b8('0x21')](_0x39613c)[_0xa3b8('0x27')](function(_0x654772){_0x53be15[_0xa3b8('0x21')]=_0x654772;if(_0x206ea3[_0xa3b8('0x30')]['includeAll']){_0x5d4ed6['include']=[{'all':!![]}];}return db[_0xa3b8('0x43')][_0xa3b8('0x44')](_0x5d4ed6);})[_0xa3b8('0x27')](function(_0x66e317){_0x53be15[_0xa3b8('0x45')]=_0x66e317;return _0x53be15;})[_0xa3b8('0x27')](respondWithFilteredResult(_0x4f0860,_0x5d4ed6))[_0xa3b8('0x46')](handleError(_0x4f0860,null));};exports[_0xa3b8('0x47')]=function(_0x29f0d5,_0x2ddf92){var _0x26c334={'raw':!![],'where':{'id':_0x29f0d5['params']['id']}},_0x56a0ed={};_0x56a0ed[_0xa3b8('0x34')]=_[_0xa3b8('0x31')](db[_0xa3b8('0x43')]['rawAttributes']);_0x56a0ed[_0xa3b8('0x30')]=_[_0xa3b8('0x31')](_0x29f0d5[_0xa3b8('0x30')]);_0x56a0ed[_0xa3b8('0x32')]=_[_0xa3b8('0x33')](_0x56a0ed[_0xa3b8('0x34')],_0x56a0ed[_0xa3b8('0x30')]);_0x26c334[_0xa3b8('0x35')]=_[_0xa3b8('0x33')](_0x56a0ed[_0xa3b8('0x34')],qs[_0xa3b8('0x36')](_0x29f0d5[_0xa3b8('0x30')][_0xa3b8('0x36')]));_0x26c334[_0xa3b8('0x35')]=_0x26c334[_0xa3b8('0x35')][_0xa3b8('0x37')]?_0x26c334['attributes']:_0x56a0ed[_0xa3b8('0x34')];if(_0x29f0d5[_0xa3b8('0x30')]['includeAll']){_0x26c334[_0xa3b8('0x48')]=[{'all':!![]}];}_0x26c334=_[_0xa3b8('0x3f')]({},_0x26c334,_0x29f0d5[_0xa3b8('0x42')]);return db[_0xa3b8('0x43')]['find'](_0x26c334)[_0xa3b8('0x27')](handleEntityNotFound(_0x2ddf92,null))[_0xa3b8('0x27')](respondWithResult(_0x2ddf92,null))[_0xa3b8('0x46')](handleError(_0x2ddf92,null));};exports[_0xa3b8('0x49')]=function(_0x2b1166,_0x35268b){return db[_0xa3b8('0x43')][_0xa3b8('0x49')](_0x2b1166[_0xa3b8('0x4a')],{})[_0xa3b8('0x27')](respondWithResult(_0x35268b,0xc9))['catch'](handleError(_0x35268b,null));};exports['update']=function(_0x41c677,_0x12e58c){if(_0x41c677[_0xa3b8('0x4a')]['id']){delete _0x41c677[_0xa3b8('0x4a')]['id'];}return db[_0xa3b8('0x43')]['find']({'where':{'id':_0x41c677[_0xa3b8('0x4b')]['id']}})[_0xa3b8('0x27')](handleEntityNotFound(_0x12e58c,null))['then'](saveUpdates(_0x41c677[_0xa3b8('0x4a')],null))[_0xa3b8('0x27')](respondWithResult(_0x12e58c,null))[_0xa3b8('0x46')](handleError(_0x12e58c,null));};exports[_0xa3b8('0x28')]=function(_0x35b2b0,_0x10970a){return db[_0xa3b8('0x43')][_0xa3b8('0x4c')]({'where':{'id':_0x35b2b0[_0xa3b8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10970a,null))['then'](removeEntity(_0x10970a,null))['catch'](handleError(_0x10970a,null));}; \ No newline at end of file +var _0xc14a=['end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','VtigerField','includeAll','rows','catch','show','params','keys','include','create','update','body','destroy','find','eml-format','rimraf','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xba903,_0x2fc6e8){var _0x2bf8b0=function(_0x708fb1){while(--_0x708fb1){_0xba903['push'](_0xba903['shift']());}};_0x2bf8b0(++_0x2fc6e8);}(_0xc14a,0x7c));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xac14('0x0'));var rimraf=require(_0xac14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac14('0x2'));var rp=require('request-promise');var moment=require(_0xac14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xac14('0x5'));var csv=require('to-csv');var ejs=require(_0xac14('0x6'));var fs=require('fs');var fs_extra=require(_0xac14('0x7'));var _=require(_0xac14('0x8'));var squel=require(_0xac14('0x9'));var crypto=require(_0xac14('0xa'));var jsforce=require(_0xac14('0xb'));var deskjs=require(_0xac14('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac14('0xd'));var Redis=require('ioredis');var authService=require(_0xac14('0xe'));var qs=require(_0xac14('0xf'));var as=require(_0xac14('0x10'));var hardwareService=require(_0xac14('0x11'));var logger=require(_0xac14('0x12'))(_0xac14('0x13'));var utils=require(_0xac14('0x14'));var config=require(_0xac14('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xac14('0x16'))['db'];function respondWithStatusCode(_0x36573d,_0xf9791){_0xf9791=_0xf9791||0xcc;return function(_0x47da11){if(_0x47da11){return _0x36573d[_0xac14('0x17')](_0xf9791);}return _0x36573d['status'](_0xf9791)[_0xac14('0x18')]();};}function respondWithResult(_0x1578b5,_0x33ced6){_0x33ced6=_0x33ced6||0xc8;return function(_0x25ff49){if(_0x25ff49){return _0x1578b5[_0xac14('0x19')](_0x33ced6)[_0xac14('0x1a')](_0x25ff49);}};}function respondWithFilteredResult(_0x3bc9f3,_0x2b1590){return function(_0x2a4317){if(_0x2a4317){var _0x414c5e=typeof _0x2b1590['offset']===_0xac14('0x1b')&&typeof _0x2b1590['limit']===_0xac14('0x1b');var _0x34a710=_0x2a4317[_0xac14('0x1c')];var _0x34f7d0=_0x414c5e?0x0:_0x2b1590[_0xac14('0x1d')];var _0x848bb1=_0x414c5e?_0x2a4317['count']:_0x2b1590[_0xac14('0x1d')]+_0x2b1590[_0xac14('0x1e')];var _0x1d08c6;if(_0x848bb1>=_0x34a710){_0x848bb1=_0x34a710;_0x1d08c6=0xc8;}else{_0x1d08c6=0xce;}_0x3bc9f3['status'](_0x1d08c6);return _0x3bc9f3[_0xac14('0x1f')](_0xac14('0x20'),_0x34f7d0+'-'+_0x848bb1+'/'+_0x34a710)[_0xac14('0x1a')](_0x2a4317);}return null;};}function patchUpdates(_0x42a0bd){return function(_0x1a3ed2){try{jsonpatch[_0xac14('0x21')](_0x1a3ed2,_0x42a0bd,!![]);}catch(_0x239c66){return BPromise[_0xac14('0x22')](_0x239c66);}return _0x1a3ed2[_0xac14('0x23')]();};}function saveUpdates(_0x505400,_0x3ec66f){return function(_0x7464a6){if(_0x7464a6){return _0x7464a6['update'](_0x505400)[_0xac14('0x24')](function(_0x241ae8){return _0x241ae8;});}return null;};}function removeEntity(_0x261adb,_0x11d254){return function(_0x1ba509){if(_0x1ba509){return _0x1ba509['destroy']()['then'](function(){_0x261adb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2729a4,_0x40a3d5){return function(_0x3a5ba5){if(!_0x3a5ba5){_0x2729a4['sendStatus'](0x194);}return _0x3a5ba5;};}function handleError(_0x411e28,_0x13caa8){_0x13caa8=_0x13caa8||0x1f4;return function(_0x36ac27){logger['error'](_0x36ac27['stack']);if(_0x36ac27['name']){delete _0x36ac27[_0xac14('0x25')];}_0x411e28[_0xac14('0x19')](_0x13caa8)[_0xac14('0x26')](_0x36ac27);};}exports[_0xac14('0x27')]=function(_0x2026a2,_0x13dca9){var _0x16c921={},_0x46c930={},_0xa74f10={'count':0x0,'rows':[]};var _0x46cc81=_[_0xac14('0x28')](db['VtigerField'][_0xac14('0x29')],function(_0x296233){return{'name':_0x296233[_0xac14('0x2a')],'type':_0x296233['type'][_0xac14('0x2b')]};});_0x46c930[_0xac14('0x2c')]=_[_0xac14('0x28')](_0x46cc81,_0xac14('0x25'));_0x46c930[_0xac14('0x2d')]=_['keys'](_0x2026a2[_0xac14('0x2d')]);_0x46c930['filters']=_['intersection'](_0x46c930[_0xac14('0x2c')],_0x46c930[_0xac14('0x2d')]);_0x16c921[_0xac14('0x2e')]=_[_0xac14('0x2f')](_0x46c930[_0xac14('0x2c')],qs[_0xac14('0x30')](_0x2026a2[_0xac14('0x2d')][_0xac14('0x30')]));_0x16c921[_0xac14('0x2e')]=_0x16c921['attributes'][_0xac14('0x31')]?_0x16c921[_0xac14('0x2e')]:_0x46c930[_0xac14('0x2c')];if(!_0x2026a2['query']['hasOwnProperty'](_0xac14('0x32'))){_0x16c921[_0xac14('0x1e')]=qs[_0xac14('0x1e')](_0x2026a2[_0xac14('0x2d')][_0xac14('0x1e')]);_0x16c921[_0xac14('0x1d')]=qs[_0xac14('0x1d')](_0x2026a2[_0xac14('0x2d')][_0xac14('0x1d')]);}_0x16c921[_0xac14('0x33')]=qs[_0xac14('0x34')](_0x2026a2[_0xac14('0x2d')]['sort']);_0x16c921['where']=qs[_0xac14('0x35')](_[_0xac14('0x36')](_0x2026a2[_0xac14('0x2d')],_0x46c930[_0xac14('0x35')]),_0x46cc81);if(_0x2026a2[_0xac14('0x2d')]['filter']){_0x16c921[_0xac14('0x37')]=_[_0xac14('0x38')](_0x16c921[_0xac14('0x37')],{'$or':_[_0xac14('0x28')](_0x46cc81,function(_0xca514c){if(_0xca514c[_0xac14('0x39')]!==_0xac14('0x3a')){var _0x518322={};_0x518322[_0xca514c[_0xac14('0x25')]]={'$like':'%'+_0x2026a2[_0xac14('0x2d')][_0xac14('0x3b')]+'%'};return _0x518322;}})});}_0x16c921=_[_0xac14('0x38')]({},_0x16c921,_0x2026a2[_0xac14('0x3c')]);var _0x3a58eb={'where':_0x16c921[_0xac14('0x37')]};return db[_0xac14('0x3d')][_0xac14('0x1c')](_0x3a58eb)['then'](function(_0x3f1538){_0xa74f10[_0xac14('0x1c')]=_0x3f1538;if(_0x2026a2['query'][_0xac14('0x3e')]){_0x16c921['include']=[{'all':!![]}];}return db[_0xac14('0x3d')]['findAll'](_0x16c921);})[_0xac14('0x24')](function(_0x2d1b1e){_0xa74f10[_0xac14('0x3f')]=_0x2d1b1e;return _0xa74f10;})[_0xac14('0x24')](respondWithFilteredResult(_0x13dca9,_0x16c921))[_0xac14('0x40')](handleError(_0x13dca9,null));};exports[_0xac14('0x41')]=function(_0x230318,_0x44e94b){var _0x585e79={'raw':!![],'where':{'id':_0x230318[_0xac14('0x42')]['id']}},_0x523203={};_0x523203['model']=_[_0xac14('0x43')](db[_0xac14('0x3d')][_0xac14('0x29')]);_0x523203[_0xac14('0x2d')]=_[_0xac14('0x43')](_0x230318[_0xac14('0x2d')]);_0x523203[_0xac14('0x35')]=_[_0xac14('0x2f')](_0x523203[_0xac14('0x2c')],_0x523203[_0xac14('0x2d')]);_0x585e79[_0xac14('0x2e')]=_[_0xac14('0x2f')](_0x523203[_0xac14('0x2c')],qs[_0xac14('0x30')](_0x230318[_0xac14('0x2d')][_0xac14('0x30')]));_0x585e79['attributes']=_0x585e79[_0xac14('0x2e')]['length']?_0x585e79[_0xac14('0x2e')]:_0x523203[_0xac14('0x2c')];if(_0x230318['query'][_0xac14('0x3e')]){_0x585e79[_0xac14('0x44')]=[{'all':!![]}];}_0x585e79=_[_0xac14('0x38')]({},_0x585e79,_0x230318[_0xac14('0x3c')]);return db[_0xac14('0x3d')]['find'](_0x585e79)[_0xac14('0x24')](handleEntityNotFound(_0x44e94b,null))['then'](respondWithResult(_0x44e94b,null))['catch'](handleError(_0x44e94b,null));};exports[_0xac14('0x45')]=function(_0x40c343,_0x52c581){return db[_0xac14('0x3d')][_0xac14('0x45')](_0x40c343['body'],{})[_0xac14('0x24')](respondWithResult(_0x52c581,0xc9))[_0xac14('0x40')](handleError(_0x52c581,null));};exports[_0xac14('0x46')]=function(_0x180e3e,_0x263f59){if(_0x180e3e[_0xac14('0x47')]['id']){delete _0x180e3e[_0xac14('0x47')]['id'];}return db[_0xac14('0x3d')]['find']({'where':{'id':_0x180e3e[_0xac14('0x42')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0x263f59,null))[_0xac14('0x24')](saveUpdates(_0x180e3e['body'],null))[_0xac14('0x24')](respondWithResult(_0x263f59,null))[_0xac14('0x40')](handleError(_0x263f59,null));};exports[_0xac14('0x48')]=function(_0x81bace,_0xd01740){return db[_0xac14('0x3d')][_0xac14('0x49')]({'where':{'id':_0x81bace[_0xac14('0x42')]['id']}})[_0xac14('0x24')](handleEntityNotFound(_0xd01740,null))[_0xac14('0x24')](removeEntity(_0xd01740,null))[_0xac14('0x40')](handleError(_0xd01740,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5efa5d4..af64e25 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 _0x887b=['FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','vtiger_unique_index'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x887b,0x1c9));var _0xb887=function(_0x4c055c,_0x208f29){_0x4c055c=_0x4c055c-0x0;var _0x1a9c9a=_0x887b[_0x4c055c];return _0x1a9c9a;};'use strict';var _=require('lodash');var util=require(_0xb887('0x0'));var logger=require(_0xb887('0x1'))('api');var moment=require(_0xb887('0x2'));var BPromise=require(_0xb887('0x3'));var rp=require(_0xb887('0x4'));var fs=require('fs');var path=require(_0xb887('0x5'));var rimraf=require(_0xb887('0x6'));var config=require(_0xb887('0x7'));var attributes=require(_0xb887('0x8'));module['exports']=function(_0x3cb144,_0x248dea){return _0x3cb144['define'](_0xb887('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xb887('0xa'),'fields':['idField',_0xb887('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4cc=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','int_vtiger_fields','idField','FieldId','lodash','../../config/logger'];(function(_0x475191,_0x5bce86){var _0x189e96=function(_0x46d6a2){while(--_0x46d6a2){_0x475191['push'](_0x475191['shift']());}};_0x189e96(++_0x5bce86);}(_0xd4cc,0x1ec));var _0xcd4c=function(_0x3e13be,_0x12afb7){_0x3e13be=_0x3e13be-0x0;var _0xfcf134=_0xd4cc[_0x3e13be];return _0xfcf134;};'use strict';var _=require(_0xcd4c('0x0'));var util=require('util');var logger=require(_0xcd4c('0x1'))(_0xcd4c('0x2'));var moment=require(_0xcd4c('0x3'));var BPromise=require(_0xcd4c('0x4'));var rp=require(_0xcd4c('0x5'));var fs=require('fs');var path=require(_0xcd4c('0x6'));var rimraf=require('rimraf');var config=require(_0xcd4c('0x7'));var attributes=require(_0xcd4c('0x8'));module[_0xcd4c('0x9')]=function(_0x1d17c9,_0x3b9635){return _0x1d17c9['define']('VtigerField',attributes,{'tableName':_0xcd4c('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xcd4c('0xb'),_0xcd4c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index ccbbe61..7c71819 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 _0xc077=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http'];(function(_0x215480,_0x24a050){var _0x26cd27=function(_0x468455){while(--_0x468455){_0x215480['push'](_0x215480['shift']());}};_0x26cd27(++_0x24a050);}(_0xc077,0x197));var _0x7c07=function(_0x102402,_0x4eaaf8){_0x102402=_0x102402-0x0;var _0x321b44=_0xc077[_0x102402];return _0x321b44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c07('0x0'));var BPromise=require(_0x7c07('0x1'));var rs=require(_0x7c07('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c07('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c07('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c07('0x5'));var client=jayson['client'][_0x7c07('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c8d88,_0x291b05,_0x38ed55){return new BPromise(function(_0xcdf773,_0x13cce1){return client[_0x7c07('0x7')](_0x1c8d88,_0x38ed55)[_0x7c07('0x8')](function(_0x221801){logger[_0x7c07('0x9')](_0x7c07('0xa'),_0x291b05,_0x7c07('0xb'));logger[_0x7c07('0xc')](_0x7c07('0xd'),_0x291b05,_0x7c07('0xb'),JSON['stringify'](_0x221801));if(_0x221801[_0x7c07('0xe')]){if(_0x221801[_0x7c07('0xe')][_0x7c07('0xf')]===0x1f4){logger[_0x7c07('0xe')](_0x7c07('0xa'),_0x291b05,_0x221801[_0x7c07('0xe')]['message']);return _0x13cce1(_0x221801[_0x7c07('0xe')][_0x7c07('0x10')]);}logger[_0x7c07('0xe')](_0x7c07('0xa'),_0x291b05,_0x221801['error'][_0x7c07('0x10')]);return _0xcdf773(_0x221801[_0x7c07('0xe')][_0x7c07('0x10')]);}else{logger['info'](_0x7c07('0xa'),_0x291b05,_0x7c07('0xb'));_0xcdf773(_0x221801['result']['message']);}})[_0x7c07('0x11')](function(_0x4f1f8d){logger[_0x7c07('0xe')]('VtigerField,\x20%s,\x20%s',_0x291b05,_0x4f1f8d);_0x13cce1(_0x4f1f8d);});});} \ No newline at end of file +var _0x5692=['error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','code'];(function(_0x500c02,_0x17afde){var _0x1a1efd=function(_0xa52f03){while(--_0xa52f03){_0x500c02['push'](_0x500c02['shift']());}};_0x1a1efd(++_0x17afde);}(_0x5692,0xac));var _0x2569=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5692[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x2569('0x0'));var moment=require('moment');var BPromise=require(_0x2569('0x1'));var rs=require(_0x2569('0x2'));var fs=require('fs');var Redis=require(_0x2569('0x3'));var db=require(_0x2569('0x4'))['db'];var utils=require(_0x2569('0x5'));var logger=require(_0x2569('0x6'))(_0x2569('0x7'));var config=require(_0x2569('0x8'));var jayson=require(_0x2569('0x9'));var client=jayson[_0x2569('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2710d7,_0x2be267,_0x1696c9){return new BPromise(function(_0x44093b,_0x959e03){return client['request'](_0x2710d7,_0x1696c9)[_0x2569('0xb')](function(_0x400ef3){logger[_0x2569('0xc')](_0x2569('0xd'),_0x2be267,_0x2569('0xe'));logger['debug'](_0x2569('0xf'),_0x2be267,'request\x20sent',JSON['stringify'](_0x400ef3));if(_0x400ef3['error']){if(_0x400ef3['error'][_0x2569('0x10')]===0x1f4){logger[_0x2569('0x11')](_0x2569('0xd'),_0x2be267,_0x400ef3['error'][_0x2569('0x12')]);return _0x959e03(_0x400ef3['error']['message']);}logger[_0x2569('0x11')](_0x2569('0xd'),_0x2be267,_0x400ef3[_0x2569('0x11')][_0x2569('0x12')]);return _0x44093b(_0x400ef3[_0x2569('0x11')][_0x2569('0x12')]);}else{logger[_0x2569('0xc')]('VtigerField,\x20%s,\x20%s',_0x2be267,_0x2569('0xe'));_0x44093b(_0x400ef3[_0x2569('0x13')]['message']);}})[_0x2569('0x14')](function(_0x57d040){logger[_0x2569('0x11')](_0x2569('0xd'),_0x2be267,_0x57d040);_0x959e03(_0x57d040);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1e4b73a..13cfd72 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 _0xee51=['express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xd75684,_0x5458df){var _0x13cff1=function(_0x25fa1a){while(--_0x25fa1a){_0xd75684['push'](_0xd75684['shift']());}};_0x13cff1(++_0x5458df);}(_0xee51,0x7a));var _0x1ee5=function(_0x21c926,_0x563c30){_0x21c926=_0x21c926-0x0;var _0x2a46ed=_0xee51[_0x21c926];return _0x2a46ed;};'use strict';var multer=require(_0x1ee5('0x0'));var util=require(_0x1ee5('0x1'));var path=require(_0x1ee5('0x2'));var timeout=require(_0x1ee5('0x3'));var express=require(_0x1ee5('0x4'));var router=express[_0x1ee5('0x5')]();var fs_extra=require(_0x1ee5('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ee5('0x7'));var controller=require(_0x1ee5('0x8'));router[_0x1ee5('0x9')]('/',auth[_0x1ee5('0xa')](),controller['index']);router[_0x1ee5('0x9')](_0x1ee5('0xb'),auth[_0x1ee5('0xa')](),controller[_0x1ee5('0xc')]);router[_0x1ee5('0x9')](_0x1ee5('0xd'),auth[_0x1ee5('0xa')](),controller[_0x1ee5('0xe')]);router[_0x1ee5('0x9')](_0x1ee5('0xf'),auth[_0x1ee5('0xa')](),controller['getFields']);router[_0x1ee5('0x10')]('/',auth[_0x1ee5('0xa')](),controller['create']);router['post'](_0x1ee5('0xd'),auth[_0x1ee5('0xa')](),controller['addConfiguration']);router['put'](_0x1ee5('0xb'),auth[_0x1ee5('0xa')](),controller[_0x1ee5('0x11')]);router[_0x1ee5('0x12')](_0x1ee5('0xb'),auth[_0x1ee5('0xa')](),controller[_0x1ee5('0x13')]);module[_0x1ee5('0x14')]=router; \ No newline at end of file +var _0x76a4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','delete','destroy','multer'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0x76a4,0xe9));var _0x476a=function(_0x15aeeb,_0x2a12f5){_0x15aeeb=_0x15aeeb-0x0;var _0x13d495=_0x76a4[_0x15aeeb];return _0x13d495;};'use strict';var multer=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var path=require(_0x476a('0x2'));var timeout=require(_0x476a('0x3'));var express=require(_0x476a('0x4'));var router=express[_0x476a('0x5')]();var fs_extra=require(_0x476a('0x6'));var auth=require(_0x476a('0x7'));var interaction=require(_0x476a('0x8'));var config=require(_0x476a('0x9'));var controller=require(_0x476a('0xa'));router[_0x476a('0xb')]('/',auth[_0x476a('0xc')](),controller[_0x476a('0xd')]);router[_0x476a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x476a('0xe')]);router[_0x476a('0xb')](_0x476a('0xf'),auth[_0x476a('0xc')](),controller[_0x476a('0x10')]);router[_0x476a('0xb')](_0x476a('0x11'),auth[_0x476a('0xc')](),controller[_0x476a('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x476a('0x13')]);router['post'](_0x476a('0xf'),auth['isAuthenticated'](),controller[_0x476a('0x14')]);router[_0x476a('0x15')](_0x476a('0x16'),auth[_0x476a('0xc')](),controller[_0x476a('0x17')]);router[_0x476a('0x18')](_0x476a('0x16'),auth['isAuthenticated'](),controller[_0x476a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e803ae7..f6ed3c9 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 _0x01d9=['sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab','newTab'];(function(_0xc0aca6,_0x2ffaff){var _0x58f3b0=function(_0x559bbb){while(--_0x559bbb){_0xc0aca6['push'](_0xc0aca6['shift']());}};_0x58f3b0(++_0x2ffaff);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')]},'description':{'type':Sequelize[_0x901d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x901d('0x3')},'password':{'type':Sequelize[_0x901d('0x2')]},'token':{'type':Sequelize[_0x901d('0x2')]},'remoteUri':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x4')},'authType':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6'),'token'),'defaultValue':_0x901d('0x6')},'serverUrl':{'type':Sequelize[_0x901d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x7'),_0x901d('0x8')),'defaultValue':_0x901d('0x7')}}; \ No newline at end of file +var _0x7ea9=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x2492b6,_0x25d5eb){var _0x2498a9=function(_0x24c411){while(--_0x24c411){_0x2492b6['push'](_0x2492b6['shift']());}};_0x2498a9(++_0x25d5eb);}(_0x7ea9,0xec));var _0x97ea=function(_0x568228,_0x5f238c){_0x568228=_0x568228-0x0;var _0x1b7709=_0x7ea9[_0x568228];return _0x1b7709;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'name':{'type':Sequelize[_0x97ea('0x1')]},'description':{'type':Sequelize[_0x97ea('0x1')]},'username':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x97ea('0x1')]},'remoteUri':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x3')},'authType':{'type':Sequelize['ENUM'](_0x97ea('0x4'),_0x97ea('0x5')),'defaultValue':_0x97ea('0x4')},'serverUrl':{'type':Sequelize[_0x97ea('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x97ea('0x6'),_0x97ea('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6a1e8a1..e7e69c0 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 _0xb9be=['count','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','order','AccountId','getSubjects','type','Descriptions','channel','ZendeskConfiguration','ZendeskField','Subjects','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','subject','description','assignee','remove','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined'];(function(_0x542884,_0x48761c){var _0x4cac82=function(_0x5abed4){while(--_0x5abed4){_0x542884['push'](_0x542884['shift']());}};_0x4cac82(++_0x48761c);}(_0xb9be,0xc5));var _0xeb9b=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xb9be[_0x219d87];return _0x22823d;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];var integrations=require(_0xeb9b('0x19'));function respondWithStatusCode(_0x2a01df,_0x51598f){_0x51598f=_0x51598f||0xcc;return function(_0x5e94e3){if(_0x5e94e3){return _0x2a01df['sendStatus'](_0x51598f);}return _0x2a01df[_0xeb9b('0x1a')](_0x51598f)[_0xeb9b('0x1b')]();};}function respondWithResult(_0x2674e6,_0x4ec46d){_0x4ec46d=_0x4ec46d||0xc8;return function(_0x5926e1){if(_0x5926e1){return _0x2674e6['status'](_0x4ec46d)[_0xeb9b('0x1c')](_0x5926e1);}};}function respondWithFilteredResult(_0x1a5f27,_0x406afd){return function(_0x3fa308){if(_0x3fa308){var _0x2c9aa6=typeof _0x406afd[_0xeb9b('0x1d')]===_0xeb9b('0x1e')&&typeof _0x406afd['limit']===_0xeb9b('0x1e');var _0x36e871=_0x3fa308[_0xeb9b('0x1f')];var _0x3a11e3=_0x2c9aa6?0x0:_0x406afd[_0xeb9b('0x1d')];var _0x1a140c=_0x2c9aa6?_0x3fa308[_0xeb9b('0x1f')]:_0x406afd[_0xeb9b('0x1d')]+_0x406afd[_0xeb9b('0x20')];var _0x26e312;if(_0x1a140c>=_0x36e871){_0x1a140c=_0x36e871;_0x26e312=0xc8;}else{_0x26e312=0xce;}_0x1a5f27['status'](_0x26e312);return _0x1a5f27[_0xeb9b('0x21')]('Content-Range',_0x3a11e3+'-'+_0x1a140c+'/'+_0x36e871)['json'](_0x3fa308);}return null;};}function patchUpdates(_0x580498){return function(_0x703f0b){try{jsonpatch['apply'](_0x703f0b,_0x580498,!![]);}catch(_0xbed5ce){return BPromise[_0xeb9b('0x22')](_0xbed5ce);}return _0x703f0b[_0xeb9b('0x23')]();};}function saveUpdates(_0x37d7e0,_0x3c8be7){return function(_0x43dab8){if(_0x43dab8){return _0x43dab8[_0xeb9b('0x24')](_0x37d7e0)[_0xeb9b('0x25')](function(_0x142d1c){return _0x142d1c;});}return null;};}function removeEntity(_0x46df93,_0x61c86d){return function(_0x296f95){if(_0x296f95){return _0x296f95[_0xeb9b('0x26')]()[_0xeb9b('0x25')](function(){_0x46df93[_0xeb9b('0x1a')](0xcc)[_0xeb9b('0x1b')]();});}};}function handleEntityNotFound(_0x4c997e,_0xd57390){return function(_0x4ed960){if(!_0x4ed960){_0x4c997e[_0xeb9b('0x27')](0x194);}return _0x4ed960;};}function handleError(_0x5d6846,_0x347ec1){_0x347ec1=_0x347ec1||0x1f4;return function(_0x4361b9){logger[_0xeb9b('0x28')](_0x4361b9[_0xeb9b('0x29')]);if(_0x4361b9['name']){delete _0x4361b9[_0xeb9b('0x2a')];}_0x5d6846[_0xeb9b('0x1a')](_0x347ec1)['send'](_0x4361b9);};}exports[_0xeb9b('0x2b')]=function(_0x33bb1d,_0x5ce745){var _0x2a4b51={},_0x2ea20f={},_0x4188d5={'count':0x0,'rows':[]};var _0x48c5f4=_[_0xeb9b('0x2c')](db['ZendeskAccount'][_0xeb9b('0x2d')],function(_0x4c1331){return{'name':_0x4c1331[_0xeb9b('0x2e')],'type':_0x4c1331['type'][_0xeb9b('0x2f')]};});_0x2ea20f['model']=_[_0xeb9b('0x2c')](_0x48c5f4,'name');_0x2ea20f[_0xeb9b('0x30')]=_[_0xeb9b('0x31')](_0x33bb1d[_0xeb9b('0x30')]);_0x2ea20f[_0xeb9b('0x32')]=_[_0xeb9b('0x33')](_0x2ea20f[_0xeb9b('0x34')],_0x2ea20f[_0xeb9b('0x30')]);_0x2a4b51[_0xeb9b('0x35')]=_[_0xeb9b('0x33')](_0x2ea20f[_0xeb9b('0x34')],qs['fields'](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x36')]));_0x2a4b51[_0xeb9b('0x35')]=_0x2a4b51[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0x2a4b51[_0xeb9b('0x35')]:_0x2ea20f[_0xeb9b('0x34')];if(!_0x33bb1d['query'][_0xeb9b('0x38')](_0xeb9b('0x39'))){_0x2a4b51[_0xeb9b('0x20')]=qs['limit'](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x20')]);_0x2a4b51[_0xeb9b('0x1d')]=qs[_0xeb9b('0x1d')](_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x1d')]);}_0x2a4b51['order']=qs[_0xeb9b('0x3a')](_0x33bb1d[_0xeb9b('0x30')]['sort']);_0x2a4b51[_0xeb9b('0x3b')]=qs[_0xeb9b('0x32')](_[_0xeb9b('0x3c')](_0x33bb1d[_0xeb9b('0x30')],_0x2ea20f[_0xeb9b('0x32')]),_0x48c5f4);if(_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x3d')]){_0x2a4b51['where']=_[_0xeb9b('0x3e')](_0x2a4b51[_0xeb9b('0x3b')],{'$or':_[_0xeb9b('0x2c')](_0x48c5f4,function(_0x53d2f7){if(_0x53d2f7['type']!=='VIRTUAL'){var _0x26dc71={};_0x26dc71[_0x53d2f7[_0xeb9b('0x2a')]]={'$like':'%'+_0x33bb1d[_0xeb9b('0x30')]['filter']+'%'};return _0x26dc71;}})});}_0x2a4b51=_[_0xeb9b('0x3e')]({},_0x2a4b51,_0x33bb1d[_0xeb9b('0x3f')]);var _0x240d8d={'where':_0x2a4b51[_0xeb9b('0x3b')]};return db[_0xeb9b('0x40')][_0xeb9b('0x1f')](_0x240d8d)[_0xeb9b('0x25')](function(_0x492122){_0x4188d5[_0xeb9b('0x1f')]=_0x492122;if(_0x33bb1d[_0xeb9b('0x30')][_0xeb9b('0x41')]){_0x2a4b51['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xeb9b('0x42')](_0x2a4b51);})[_0xeb9b('0x25')](function(_0x495998){_0x4188d5[_0xeb9b('0x43')]=_0x495998;return _0x4188d5;})['then'](respondWithFilteredResult(_0x5ce745,_0x2a4b51))[_0xeb9b('0x44')](handleError(_0x5ce745,null));};exports[_0xeb9b('0x45')]=function(_0x28b075,_0x300565){var _0xbee63e={'raw':![],'where':{'id':_0x28b075[_0xeb9b('0x46')]['id']}},_0x10f483={};_0x10f483[_0xeb9b('0x34')]=_[_0xeb9b('0x31')](db[_0xeb9b('0x40')][_0xeb9b('0x2d')]);_0x10f483[_0xeb9b('0x30')]=_['keys'](_0x28b075['query']);_0x10f483[_0xeb9b('0x32')]=_['intersection'](_0x10f483[_0xeb9b('0x34')],_0x10f483[_0xeb9b('0x30')]);_0xbee63e[_0xeb9b('0x35')]=_['intersection'](_0x10f483[_0xeb9b('0x34')],qs[_0xeb9b('0x36')](_0x28b075['query'][_0xeb9b('0x36')]));_0xbee63e[_0xeb9b('0x35')]=_0xbee63e[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0xbee63e[_0xeb9b('0x35')]:_0x10f483[_0xeb9b('0x34')];if(_0x28b075[_0xeb9b('0x30')][_0xeb9b('0x41')]){_0xbee63e['include']=[{'all':!![]}];}_0xbee63e=_['merge']({},_0xbee63e,_0x28b075[_0xeb9b('0x3f')]);return db['ZendeskAccount']['find'](_0xbee63e)[_0xeb9b('0x25')](handleEntityNotFound(_0x300565,null))[_0xeb9b('0x25')](respondWithResult(_0x300565,null))[_0xeb9b('0x44')](handleError(_0x300565,null));};exports[_0xeb9b('0x47')]=function(_0x45bc74,_0x2fd6ee){return db['ZendeskAccount']['create'](_0x45bc74['body'],{})[_0xeb9b('0x25')](respondWithResult(_0x2fd6ee,0xc9))['catch'](handleError(_0x2fd6ee,null));};exports[_0xeb9b('0x24')]=function(_0x2ee59c,_0x2ae9bf){if(_0x2ee59c[_0xeb9b('0x48')]['id']){delete _0x2ee59c[_0xeb9b('0x48')]['id'];}return db[_0xeb9b('0x40')][_0xeb9b('0x49')]({'where':{'id':_0x2ee59c[_0xeb9b('0x46')]['id']}})[_0xeb9b('0x25')](handleEntityNotFound(_0x2ae9bf,null))[_0xeb9b('0x25')](saveUpdates(_0x2ee59c['body'],null))['then'](respondWithResult(_0x2ae9bf,null))[_0xeb9b('0x44')](handleError(_0x2ae9bf,null));};exports[_0xeb9b('0x26')]=function(_0x542ef4,_0x19bfe9){return db['ZendeskAccount'][_0xeb9b('0x49')]({'where':{'id':_0x542ef4[_0xeb9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x19bfe9,null))['then'](removeEntity(_0x19bfe9,null))['catch'](handleError(_0x19bfe9,null));};exports[_0xeb9b('0x4a')]=function(_0x32d8cd,_0x263453,_0x4fe9d0){var _0x4ded40={};var _0x471161={};var _0x1833c2;var _0x3e6e73;return db[_0xeb9b('0x40')][_0xeb9b('0x4b')]({'where':{'id':_0x32d8cd[_0xeb9b('0x46')]['id']}})['then'](handleEntityNotFound(_0x263453,null))[_0xeb9b('0x25')](function(_0x1fab7a){if(_0x1fab7a){_0x1833c2=_0x1fab7a;_0x471161['model']=_[_0xeb9b('0x31')](db['ZendeskConfiguration'][_0xeb9b('0x2d')]);_0x471161[_0xeb9b('0x30')]=_['keys'](_0x32d8cd[_0xeb9b('0x30')]);_0x471161['filters']=_[_0xeb9b('0x33')](_0x471161[_0xeb9b('0x34')],_0x471161[_0xeb9b('0x30')]);_0x4ded40[_0xeb9b('0x35')]=_[_0xeb9b('0x33')](_0x471161['model'],qs[_0xeb9b('0x36')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x36')]));_0x4ded40['attributes']=_0x4ded40[_0xeb9b('0x35')][_0xeb9b('0x37')]?_0x4ded40[_0xeb9b('0x35')]:_0x471161[_0xeb9b('0x34')];_0x4ded40[_0xeb9b('0x4c')]=qs[_0xeb9b('0x3a')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x3a')]);_0x4ded40[_0xeb9b('0x3b')]=qs[_0xeb9b('0x32')](_[_0xeb9b('0x3c')](_0x32d8cd['query'],_0x471161['filters']));if(_0x32d8cd['query'][_0xeb9b('0x3d')]){_0x4ded40['where']=_[_0xeb9b('0x3e')](_0x4ded40[_0xeb9b('0x3b')],{'$or':_[_0xeb9b('0x2c')](_0x4ded40['attributes'],function(_0x27deea){var _0xb29d24={};_0xb29d24[_0x27deea]={'$like':'%'+_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x3d')]+'%'};return _0xb29d24;})});}_0x4ded40=_[_0xeb9b('0x3e')]({},_0x4ded40,_0x32d8cd[_0xeb9b('0x3f')]);return _0x1833c2[_0xeb9b('0x4a')](_0x4ded40);}})[_0xeb9b('0x25')](function(_0x58a3e2){if(_0x58a3e2){_0x3e6e73=_0x58a3e2['length'];if(!_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x38')](_0xeb9b('0x39'))){_0x4ded40['limit']=qs[_0xeb9b('0x20')](_0x32d8cd['query'][_0xeb9b('0x20')]);_0x4ded40['offset']=qs[_0xeb9b('0x1d')](_0x32d8cd[_0xeb9b('0x30')][_0xeb9b('0x1d')]);}return _0x1833c2[_0xeb9b('0x4a')](_0x4ded40);}})[_0xeb9b('0x25')](function(_0x4be938){if(_0x4be938){return _0x4be938?{'count':_0x3e6e73,'rows':_0x4be938}:null;}})[_0xeb9b('0x25')](respondWithResult(_0x263453,null))[_0xeb9b('0x44')](handleError(_0x263453,null));};exports['addConfiguration']=function(_0x5a690a,_0x436470,_0x39c248){if(_0x5a690a['body']['id']){delete _0x5a690a[_0xeb9b('0x48')]['id'];}return db['ZendeskAccount'][_0xeb9b('0x4b')]({'where':{'id':_0x5a690a['params']['id']}})[_0xeb9b('0x25')](handleEntityNotFound(_0x436470,null))[_0xeb9b('0x25')](function(_0x417221){if(_0x417221){_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x4d')]=_0x417221['id'];_0x5a690a[_0xeb9b('0x48')]['Subjects']=integrations[_0xeb9b('0x4e')](_0x5a690a[_0xeb9b('0x48')]['channel'],_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x4f')]);_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x50')]=integrations['getDescriptions'](_0x5a690a[_0xeb9b('0x48')][_0xeb9b('0x51')],_0x5a690a['body'][_0xeb9b('0x4f')]);return db[_0xeb9b('0x52')][_0xeb9b('0x47')](_0x5a690a[_0xeb9b('0x48')],{'include':[{'model':db[_0xeb9b('0x53')],'as':_0xeb9b('0x54')},{'model':db[_0xeb9b('0x53')],'as':'Descriptions'}]});}return null;})[_0xeb9b('0x25')](respondWithResult(_0x436470,null))[_0xeb9b('0x44')](handleError(_0x436470,null));};exports['getFields']=function(_0x289654,_0x6a85fd,_0x2fb07e){var _0x25398e='';return db['ZendeskAccount'][_0xeb9b('0x4b')]({'where':{'id':_0x289654[_0xeb9b('0x46')]['id']},'attributes':['id',_0xeb9b('0x55'),_0xeb9b('0x56'),_0xeb9b('0x57'),_0xeb9b('0x58'),_0xeb9b('0x59')]})[_0xeb9b('0x25')](handleEntityNotFound(_0x6a85fd,null))[_0xeb9b('0x25')](function(_0x128d43){if(_0x128d43){_0x25398e=_0x128d43[_0xeb9b('0x59')];var _0xbbde9c=_0x25398e[_0xeb9b('0x5a')](-0x1);if(_0xbbde9c==='/'){_0x25398e=_0x25398e[_0xeb9b('0x5b')](0x0,_0x25398e[_0xeb9b('0x5c')](_0xbbde9c));}var _0xd619ca={'method':'GET','uri':util[_0xeb9b('0x5d')](_0xeb9b('0x5e'),_0x25398e,_0xeb9b('0x5f')),'json':!![]};switch(_0x128d43['authType']){case'password':_0xd619ca[_0xeb9b('0x60')]={'Authorization':util['format'](_0xeb9b('0x61'),new Buffer(util[_0xeb9b('0x5d')](_0xeb9b('0x62'),_0x128d43[_0xeb9b('0x55')],_0x128d43[_0xeb9b('0x56')]))[_0xeb9b('0x63')](_0xeb9b('0x64')))};break;case _0xeb9b('0x57'):_0xd619ca[_0xeb9b('0x60')]={'Authorization':util[_0xeb9b('0x5d')](_0xeb9b('0x61'),new Buffer(util[_0xeb9b('0x5d')]('%s/token:%s',_0x128d43['username'],_0x128d43[_0xeb9b('0x57')]))['toString']('base64'))};break;default:throw new db[(_0xeb9b('0x65'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0xd619ca);}})['then'](function(_0x346ba9){if(_0x346ba9){var _0x3147bc=[_0xeb9b('0x66'),_0xeb9b('0x67'),'group',_0xeb9b('0x68')];_[_0xeb9b('0x69')](_0x346ba9[_0xeb9b('0x5f')],function(_0x4e5cfb){return _0x3147bc['includes'](_0x4e5cfb[_0xeb9b('0x4f')]);});return{'count':_0x346ba9['ticket_fields'][_0xeb9b('0x37')],'rows':_['map'](_0x346ba9['ticket_fields'],function(_0xa7e9c3){return{'id':_0xa7e9c3['id'],'name':_0xa7e9c3['position']>0x7?_0xa7e9c3[_0xeb9b('0x6a')]:_0xa7e9c3['type'],'custom':_0xa7e9c3['position']>0x7?!![]:![],'options':_0xa7e9c3[_0xeb9b('0x6b')]?_0xa7e9c3[_0xeb9b('0x6b')]:_0xa7e9c3[_0xeb9b('0x6c')]?_0xa7e9c3[_0xeb9b('0x6c')]:[]};})};}})['then'](respondWithResult(_0x6a85fd,null))[_0xeb9b('0x44')](function(_0x31de58){var _0x3f395a=_0x289654[_0xeb9b('0x30')][_0xeb9b('0x6d')]?0x1f4:_0x31de58[_0xeb9b('0x6e')]||0x1f4;logger['error'](_0xeb9b('0x6f'),'getFields',_0x3f395a,JSON[_0xeb9b('0x70')](_0x31de58));delete _0x31de58[_0xeb9b('0x2a')];if(_0x3f395a===0x191){_0x3f395a=0x190;}_0x6a85fd['status'](_0x3f395a)[_0xeb9b('0x71')](_0x289654['query'][_0xeb9b('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x31de58[_0xeb9b('0x6e')]}:_0x31de58);});}; \ No newline at end of file +var _0x7af2=['pick','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x4403ed,_0x247377){var _0x28a29e=function(_0x4592ab){while(--_0x4592ab){_0x4403ed['push'](_0x4403ed['shift']());}};_0x28a29e(++_0x247377);}(_0x7af2,0x119));var _0x27af=function(_0x18bbfb,_0x49a75b){_0x18bbfb=_0x18bbfb-0x0;var _0x2ecb96=_0x7af2[_0x18bbfb];return _0x2ecb96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x406340,_0x203501){_0x203501=_0x203501||0xcc;return function(_0x1fd964){if(_0x1fd964){return _0x406340[_0x27af('0x17')](_0x203501);}return _0x406340[_0x27af('0x18')](_0x203501)[_0x27af('0x19')]();};}function respondWithResult(_0x234825,_0x3da435){_0x3da435=_0x3da435||0xc8;return function(_0x423222){if(_0x423222){return _0x234825[_0x27af('0x18')](_0x3da435)[_0x27af('0x1a')](_0x423222);}};}function respondWithFilteredResult(_0x9c2d4b,_0x2d7800){return function(_0x3102c4){if(_0x3102c4){var _0x2bfc9=typeof _0x2d7800[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x2d7800[_0x27af('0x1d')]==='undefined';var _0x315661=_0x3102c4[_0x27af('0x1e')];var _0x5997ae=_0x2bfc9?0x0:_0x2d7800['offset'];var _0x20a6d7=_0x2bfc9?_0x3102c4[_0x27af('0x1e')]:_0x2d7800[_0x27af('0x1b')]+_0x2d7800[_0x27af('0x1d')];var _0xec699a;if(_0x20a6d7>=_0x315661){_0x20a6d7=_0x315661;_0xec699a=0xc8;}else{_0xec699a=0xce;}_0x9c2d4b['status'](_0xec699a);return _0x9c2d4b[_0x27af('0x1f')](_0x27af('0x20'),_0x5997ae+'-'+_0x20a6d7+'/'+_0x315661)[_0x27af('0x1a')](_0x3102c4);}return null;};}function patchUpdates(_0x5e7c19){return function(_0x19afb1){try{jsonpatch[_0x27af('0x21')](_0x19afb1,_0x5e7c19,!![]);}catch(_0x2ae47e){return BPromise['reject'](_0x2ae47e);}return _0x19afb1[_0x27af('0x22')]();};}function saveUpdates(_0x2460f4,_0x30720b){return function(_0x2af76d){if(_0x2af76d){return _0x2af76d[_0x27af('0x23')](_0x2460f4)[_0x27af('0x24')](function(_0x43dd9e){return _0x43dd9e;});}return null;};}function removeEntity(_0x35b36d,_0x2e1bb0){return function(_0x49780b){if(_0x49780b){return _0x49780b['destroy']()['then'](function(){_0x35b36d[_0x27af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12625c,_0x396326){return function(_0x4ba49f){if(!_0x4ba49f){_0x12625c[_0x27af('0x17')](0x194);}return _0x4ba49f;};}function handleError(_0x1d9341,_0x463e36){_0x463e36=_0x463e36||0x1f4;return function(_0x424490){logger[_0x27af('0x25')](_0x424490[_0x27af('0x26')]);if(_0x424490[_0x27af('0x27')]){delete _0x424490['name'];}_0x1d9341[_0x27af('0x18')](_0x463e36)[_0x27af('0x28')](_0x424490);};}exports[_0x27af('0x29')]=function(_0xe009a,_0x25d65a){var _0xa08dd9={},_0x42a5b7={},_0x2b26ac={'count':0x0,'rows':[]};var _0x4406e2=_[_0x27af('0x2a')](db[_0x27af('0x2b')]['rawAttributes'],function(_0x15e867){return{'name':_0x15e867[_0x27af('0x2c')],'type':_0x15e867[_0x27af('0x2d')][_0x27af('0x2e')]};});_0x42a5b7[_0x27af('0x2f')]=_[_0x27af('0x2a')](_0x4406e2,'name');_0x42a5b7['query']=_[_0x27af('0x30')](_0xe009a[_0x27af('0x31')]);_0x42a5b7['filters']=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],_0x42a5b7[_0x27af('0x31')]);_0xa08dd9[_0x27af('0x33')]=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xe009a[_0x27af('0x31')][_0x27af('0x34')]));_0xa08dd9[_0x27af('0x33')]=_0xa08dd9[_0x27af('0x33')]['length']?_0xa08dd9['attributes']:_0x42a5b7[_0x27af('0x2f')];if(!_0xe009a[_0x27af('0x31')]['hasOwnProperty'](_0x27af('0x35'))){_0xa08dd9[_0x27af('0x1d')]=qs['limit'](_0xe009a[_0x27af('0x31')][_0x27af('0x1d')]);_0xa08dd9[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xe009a[_0x27af('0x31')]['offset']);}_0xa08dd9[_0x27af('0x36')]=qs[_0x27af('0x37')](_0xe009a['query']['sort']);_0xa08dd9[_0x27af('0x38')]=qs[_0x27af('0x39')](_[_0x27af('0x3a')](_0xe009a[_0x27af('0x31')],_0x42a5b7[_0x27af('0x39')]),_0x4406e2);if(_0xe009a[_0x27af('0x31')]['filter']){_0xa08dd9[_0x27af('0x38')]=_['merge'](_0xa08dd9[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x4406e2,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x5f5504={};_0x5f5504[_0x2a6b14[_0x27af('0x27')]]={'$like':'%'+_0xe009a[_0x27af('0x31')][_0x27af('0x3c')]+'%'};return _0x5f5504;}})});}_0xa08dd9=_[_0x27af('0x3d')]({},_0xa08dd9,_0xe009a[_0x27af('0x3e')]);var _0x32b558={'where':_0xa08dd9[_0x27af('0x38')]};return db[_0x27af('0x2b')][_0x27af('0x1e')](_0x32b558)[_0x27af('0x24')](function(_0xda424e){_0x2b26ac[_0x27af('0x1e')]=_0xda424e;if(_0xe009a[_0x27af('0x31')][_0x27af('0x3f')]){_0xa08dd9['include']=[{'all':!![]}];}return db[_0x27af('0x2b')][_0x27af('0x40')](_0xa08dd9);})[_0x27af('0x24')](function(_0x373c05){_0x2b26ac['rows']=_0x373c05;return _0x2b26ac;})[_0x27af('0x24')](respondWithFilteredResult(_0x25d65a,_0xa08dd9))['catch'](handleError(_0x25d65a,null));};exports['show']=function(_0x2425dd,_0x3c9c81){var _0x279f99={'raw':![],'where':{'id':_0x2425dd[_0x27af('0x41')]['id']}},_0x17efd6={};_0x17efd6[_0x27af('0x2f')]=_[_0x27af('0x30')](db[_0x27af('0x2b')][_0x27af('0x42')]);_0x17efd6[_0x27af('0x31')]=_[_0x27af('0x30')](_0x2425dd[_0x27af('0x31')]);_0x17efd6['filters']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],_0x17efd6['query']);_0x279f99['attributes']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x2425dd[_0x27af('0x31')][_0x27af('0x34')]));_0x279f99['attributes']=_0x279f99[_0x27af('0x33')]['length']?_0x279f99[_0x27af('0x33')]:_0x17efd6[_0x27af('0x2f')];if(_0x2425dd[_0x27af('0x31')][_0x27af('0x3f')]){_0x279f99[_0x27af('0x43')]=[{'all':!![]}];}_0x279f99=_[_0x27af('0x3d')]({},_0x279f99,_0x2425dd[_0x27af('0x3e')]);return db['ZendeskAccount']['find'](_0x279f99)[_0x27af('0x24')](handleEntityNotFound(_0x3c9c81,null))['then'](respondWithResult(_0x3c9c81,null))[_0x27af('0x44')](handleError(_0x3c9c81,null));};exports[_0x27af('0x45')]=function(_0x226025,_0x389962){return db[_0x27af('0x2b')][_0x27af('0x45')](_0x226025[_0x27af('0x46')],{})['then'](respondWithResult(_0x389962,0xc9))[_0x27af('0x44')](handleError(_0x389962,null));};exports[_0x27af('0x23')]=function(_0x20e180,_0x3fdc0e){if(_0x20e180[_0x27af('0x46')]['id']){delete _0x20e180['body']['id'];}return db[_0x27af('0x2b')][_0x27af('0x47')]({'where':{'id':_0x20e180[_0x27af('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fdc0e,null))['then'](saveUpdates(_0x20e180[_0x27af('0x46')],null))[_0x27af('0x24')](respondWithResult(_0x3fdc0e,null))[_0x27af('0x44')](handleError(_0x3fdc0e,null));};exports['destroy']=function(_0x495794,_0x2fad23){return db['ZendeskAccount'][_0x27af('0x47')]({'where':{'id':_0x495794[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2fad23,null))[_0x27af('0x24')](removeEntity(_0x2fad23,null))[_0x27af('0x44')](handleError(_0x2fad23,null));};exports[_0x27af('0x48')]=function(_0x123533,_0x374794,_0x1b6d94){var _0x24d8bf={};var _0x23369a={};var _0x5c02c1;var _0x76ed78;return db[_0x27af('0x2b')][_0x27af('0x49')]({'where':{'id':_0x123533[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x374794,null))[_0x27af('0x24')](function(_0x20c155){if(_0x20c155){_0x5c02c1=_0x20c155;_0x23369a[_0x27af('0x2f')]=_['keys'](db[_0x27af('0x4a')]['rawAttributes']);_0x23369a[_0x27af('0x31')]=_[_0x27af('0x30')](_0x123533[_0x27af('0x31')]);_0x23369a['filters']=_[_0x27af('0x32')](_0x23369a['model'],_0x23369a[_0x27af('0x31')]);_0x24d8bf[_0x27af('0x33')]=_[_0x27af('0x32')](_0x23369a['model'],qs[_0x27af('0x34')](_0x123533['query'][_0x27af('0x34')]));_0x24d8bf['attributes']=_0x24d8bf[_0x27af('0x33')][_0x27af('0x4b')]?_0x24d8bf[_0x27af('0x33')]:_0x23369a['model'];_0x24d8bf['order']=qs[_0x27af('0x37')](_0x123533[_0x27af('0x31')][_0x27af('0x37')]);_0x24d8bf[_0x27af('0x38')]=qs['filters'](_[_0x27af('0x3a')](_0x123533[_0x27af('0x31')],_0x23369a[_0x27af('0x39')]));if(_0x123533[_0x27af('0x31')][_0x27af('0x3c')]){_0x24d8bf[_0x27af('0x38')]=_['merge'](_0x24d8bf[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x24d8bf[_0x27af('0x33')],function(_0x2401c7){var _0x49eb46={};_0x49eb46[_0x2401c7]={'$like':'%'+_0x123533[_0x27af('0x31')]['filter']+'%'};return _0x49eb46;})});}_0x24d8bf=_[_0x27af('0x3d')]({},_0x24d8bf,_0x123533[_0x27af('0x3e')]);return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x13a5a8){if(_0x13a5a8){_0x76ed78=_0x13a5a8['length'];if(!_0x123533['query'][_0x27af('0x4c')](_0x27af('0x35'))){_0x24d8bf[_0x27af('0x1d')]=qs['limit'](_0x123533[_0x27af('0x31')][_0x27af('0x1d')]);_0x24d8bf['offset']=qs[_0x27af('0x1b')](_0x123533[_0x27af('0x31')]['offset']);}return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x1fa50b){if(_0x1fa50b){return _0x1fa50b?{'count':_0x76ed78,'rows':_0x1fa50b}:null;}})['then'](respondWithResult(_0x374794,null))['catch'](handleError(_0x374794,null));};exports[_0x27af('0x4d')]=function(_0xf97695,_0x2a8534,_0x266220){if(_0xf97695[_0x27af('0x46')]['id']){delete _0xf97695[_0x27af('0x46')]['id'];}return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0xf97695['params']['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2a8534,null))[_0x27af('0x24')](function(_0xa692f6){if(_0xa692f6){_0xf97695[_0x27af('0x46')][_0x27af('0x4e')]=_0xa692f6['id'];_0xf97695[_0x27af('0x46')][_0x27af('0x4f')]=integrations[_0x27af('0x50')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695[_0x27af('0x46')][_0x27af('0x2d')]);_0xf97695[_0x27af('0x46')][_0x27af('0x52')]=integrations[_0x27af('0x53')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695['body'][_0x27af('0x2d')]);return db[_0x27af('0x4a')]['create'](_0xf97695[_0x27af('0x46')],{'include':[{'model':db[_0x27af('0x54')],'as':_0x27af('0x4f')},{'model':db[_0x27af('0x54')],'as':_0x27af('0x52')}]});}return null;})[_0x27af('0x24')](respondWithResult(_0x2a8534,null))['catch'](handleError(_0x2a8534,null));};exports[_0x27af('0x55')]=function(_0x31a595,_0x3a2958,_0x4ab463){var _0x5d7af4='';return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0x31a595[_0x27af('0x41')]['id']},'attributes':['id',_0x27af('0x56'),_0x27af('0x57'),_0x27af('0x58'),_0x27af('0x59'),'remoteUri']})[_0x27af('0x24')](handleEntityNotFound(_0x3a2958,null))[_0x27af('0x24')](function(_0x4ac2a3){if(_0x4ac2a3){_0x5d7af4=_0x4ac2a3[_0x27af('0x5a')];var _0xc0a98c=_0x5d7af4['slice'](-0x1);if(_0xc0a98c==='/'){_0x5d7af4=_0x5d7af4['substring'](0x0,_0x5d7af4[_0x27af('0x5b')](_0xc0a98c));}var _0x287f7c={'method':_0x27af('0x5c'),'uri':util[_0x27af('0x5d')](_0x27af('0x5e'),_0x5d7af4,_0x27af('0x5f')),'json':!![]};switch(_0x4ac2a3[_0x27af('0x59')]){case'password':_0x287f7c[_0x27af('0x60')]={'Authorization':util[_0x27af('0x5d')](_0x27af('0x61'),new Buffer(util[_0x27af('0x5d')]('%s:%s',_0x4ac2a3['username'],_0x4ac2a3[_0x27af('0x57')]))[_0x27af('0x62')](_0x27af('0x63')))};break;case _0x27af('0x58'):_0x287f7c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x27af('0x5d')](_0x27af('0x64'),_0x4ac2a3[_0x27af('0x56')],_0x4ac2a3[_0x27af('0x58')]))[_0x27af('0x62')](_0x27af('0x63')))};break;default:throw new db['Sequelize']['ValidationError'](_0x27af('0x65'));}return rp(_0x287f7c);}})[_0x27af('0x24')](function(_0x55637f){if(_0x55637f){var _0x2c3d30=['subject','description',_0x27af('0x66'),_0x27af('0x67')];_[_0x27af('0x68')](_0x55637f[_0x27af('0x5f')],function(_0x2b7e18){return _0x2c3d30[_0x27af('0x69')](_0x2b7e18[_0x27af('0x2d')]);});return{'count':_0x55637f[_0x27af('0x5f')][_0x27af('0x4b')],'rows':_[_0x27af('0x2a')](_0x55637f[_0x27af('0x5f')],function(_0x4dd124){return{'id':_0x4dd124['id'],'name':_0x4dd124[_0x27af('0x6a')]>0x7?_0x4dd124[_0x27af('0x6b')]:_0x4dd124[_0x27af('0x2d')],'custom':_0x4dd124['position']>0x7?!![]:![],'options':_0x4dd124[_0x27af('0x6c')]?_0x4dd124[_0x27af('0x6c')]:_0x4dd124[_0x27af('0x6d')]?_0x4dd124['custom_field_options']:[]};})};}})[_0x27af('0x24')](respondWithResult(_0x3a2958,null))['catch'](function(_0x118d06){var _0x9350fa=_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?0x1f4:_0x118d06[_0x27af('0x6f')]||0x1f4;logger[_0x27af('0x25')](_0x27af('0x70'),_0x27af('0x55'),_0x9350fa,JSON['stringify'](_0x118d06));delete _0x118d06[_0x27af('0x27')];if(_0x9350fa===0x191){_0x9350fa=0x190;}_0x3a2958['status'](_0x9350fa)[_0x27af('0x28')](_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x118d06['statusCode']}:_0x118d06);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index be03fe3..7ce4a29 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 _0xf7ce=['ZendeskAccount','int_zendesk_accounts','lodash','util','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf7ce,0x183));var _0xef7c=function(_0x515f78,_0x3b69be){_0x515f78=_0x515f78-0x0;var _0x506f6c=_0xf7ce[_0x515f78];return _0x506f6c;};'use strict';var _=require(_0xef7c('0x0'));var util=require(_0xef7c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef7c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef7c('0x3'));var rimraf=require('rimraf');var config=require(_0xef7c('0x4'));var attributes=require(_0xef7c('0x5'));var integrations=require(_0xef7c('0x6'));module[_0xef7c('0x7')]=function(_0x5f42f2,_0xc69323){return _0x5f42f2[_0xef7c('0x8')](_0xef7c('0x9'),attributes,{'tableName':_0xef7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa73c=['ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x10b3e4,_0x312bce){var _0x34c18d=function(_0x1b2f43){while(--_0x1b2f43){_0x10b3e4['push'](_0x10b3e4['shift']());}};_0x34c18d(++_0x312bce);}(_0xa73c,0x1a6));var _0xca73=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa73c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca73('0x0'));var logger=require(_0xca73('0x1'))(_0xca73('0x2'));var moment=require(_0xca73('0x3'));var BPromise=require(_0xca73('0x4'));var rp=require(_0xca73('0x5'));var fs=require('fs');var path=require(_0xca73('0x6'));var rimraf=require(_0xca73('0x7'));var config=require(_0xca73('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xca73('0x9')]=function(_0x90526c,_0x25e5d6){return _0x90526c['define'](_0xca73('0xa'),attributes,{'tableName':_0xca73('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 38a0144..053a60e 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 _0xac0d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','model','include','find','map','ShowZendeskAccount','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1a5f35,_0x2d4190){var _0x2c0809=function(_0x474b92){while(--_0x474b92){_0x1a5f35['push'](_0x1a5f35['shift']());}};_0x2c0809(++_0x2d4190);}(_0xac0d,0x181));var _0xdac0=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xac0d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xdac0('0x0'));var util=require(_0xdac0('0x1'));var moment=require(_0xdac0('0x2'));var BPromise=require(_0xdac0('0x3'));var rs=require(_0xdac0('0x4'));var fs=require('fs');var Redis=require(_0xdac0('0x5'));var db=require(_0xdac0('0x6'))['db'];var utils=require(_0xdac0('0x7'));var logger=require(_0xdac0('0x8'))(_0xdac0('0x9'));var config=require(_0xdac0('0xa'));var jayson=require(_0xdac0('0xb'));var client=jayson[_0xdac0('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12480a,_0x5d94ef,_0x14a30d){return new BPromise(function(_0x54eafa,_0x43956a){return client[_0xdac0('0xd')](_0x12480a,_0x14a30d)[_0xdac0('0xe')](function(_0x22d2c2){logger[_0xdac0('0xf')](_0xdac0('0x10'),_0x5d94ef,_0xdac0('0x11'));logger[_0xdac0('0x12')](_0xdac0('0x13'),_0x5d94ef,_0xdac0('0x11'),JSON[_0xdac0('0x14')](_0x22d2c2));if(_0x22d2c2['error']){if(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x16')]===0x1f4){logger[_0xdac0('0x15')](_0xdac0('0x10'),_0x5d94ef,_0x22d2c2[_0xdac0('0x15')]['message']);return _0x43956a(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);}logger[_0xdac0('0x15')](_0xdac0('0x10'),_0x5d94ef,_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);return _0x54eafa(_0x22d2c2[_0xdac0('0x15')][_0xdac0('0x17')]);}else{logger[_0xdac0('0xf')](_0xdac0('0x10'),_0x5d94ef,_0xdac0('0x11'));_0x54eafa(_0x22d2c2[_0xdac0('0x18')][_0xdac0('0x17')]);}})['catch'](function(_0x48e8cc){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x5d94ef,_0x48e8cc);_0x43956a(_0x48e8cc);});});}exports[_0xdac0('0x19')]=function(_0x5a21b9){var _0x1c5af4=this;return new Promise(function(_0xe796aa,_0x56f02c){return db[_0xdac0('0x1a')][_0xdac0('0x1b')]({'raw':_0x5a21b9['options']?_0x5a21b9[_0xdac0('0x1c')][_0xdac0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a21b9['options']?_0x5a21b9[_0xdac0('0x1c')][_0xdac0('0x1e')]||null:null,'attributes':_0x5a21b9[_0xdac0('0x1c')]?_0x5a21b9[_0xdac0('0x1c')][_0xdac0('0x1f')]||null:null,'limit':_0x5a21b9[_0xdac0('0x1c')]?_0x5a21b9[_0xdac0('0x1c')][_0xdac0('0x20')]||null:null,'include':_0x5a21b9[_0xdac0('0x1c')]?_0x5a21b9[_0xdac0('0x1c')]['include']?_['map'](_0x5a21b9[_0xdac0('0x1c')]['include'],function(_0x22e1b4){return{'model':db[_0x22e1b4[_0xdac0('0x21')]],'as':_0x22e1b4['as'],'attributes':_0x22e1b4[_0xdac0('0x1f')],'include':_0x22e1b4[_0xdac0('0x22')]?_['map'](_0x22e1b4[_0xdac0('0x22')],function(_0x572632){return{'model':db[_0x572632[_0xdac0('0x21')]],'as':_0x572632['as'],'attributes':_0x572632[_0xdac0('0x1f')],'include':_0x572632['include']?_['map'](_0x572632['include'],function(_0x11ad42){return{'model':db[_0x11ad42[_0xdac0('0x21')]],'as':_0x11ad42['as'],'attributes':_0x11ad42[_0xdac0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdac0('0xe')](function(_0x247e74){logger[_0xdac0('0xf')](_0xdac0('0x19'),_0x5a21b9);logger['debug'](_0xdac0('0x19'),_0x5a21b9,JSON[_0xdac0('0x14')](_0x247e74));_0xe796aa(_0x247e74);})['catch'](function(_0x41ed5f){logger[_0xdac0('0x15')](_0xdac0('0x19'),_0x41ed5f[_0xdac0('0x17')],_0x5a21b9);_0x56f02c(_0x1c5af4[_0xdac0('0x15')](0x1f4,_0x41ed5f[_0xdac0('0x17')]));});});};exports['ShowZendeskAccount']=function(_0x1c2e6d){var _0x49ca74=this;return new Promise(function(_0x36c327,_0x3c19a6){return db[_0xdac0('0x1a')][_0xdac0('0x23')]({'raw':_0x1c2e6d[_0xdac0('0x1c')]?_0x1c2e6d[_0xdac0('0x1c')][_0xdac0('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c2e6d[_0xdac0('0x1c')]?_0x1c2e6d[_0xdac0('0x1c')]['where']||null:null,'attributes':_0x1c2e6d['options']?_0x1c2e6d[_0xdac0('0x1c')][_0xdac0('0x1f')]||null:null,'include':_0x1c2e6d[_0xdac0('0x1c')]?_0x1c2e6d[_0xdac0('0x1c')][_0xdac0('0x22')]?_['map'](_0x1c2e6d[_0xdac0('0x1c')]['include'],function(_0x438c65){return{'model':db[_0x438c65[_0xdac0('0x21')]],'as':_0x438c65['as'],'attributes':_0x438c65['attributes'],'include':_0x438c65['include']?_[_0xdac0('0x24')](_0x438c65['include'],function(_0x358fe9){return{'model':db[_0x358fe9[_0xdac0('0x21')]],'as':_0x358fe9['as'],'attributes':_0x358fe9['attributes'],'include':_0x358fe9[_0xdac0('0x22')]?_[_0xdac0('0x24')](_0x358fe9[_0xdac0('0x22')],function(_0x17200e){return{'model':db[_0x17200e['model']],'as':_0x17200e['as'],'attributes':_0x17200e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39f579){logger[_0xdac0('0xf')](_0xdac0('0x25'),_0x1c2e6d);logger['debug'](_0xdac0('0x25'),_0x1c2e6d,JSON[_0xdac0('0x14')](_0x39f579));_0x36c327(_0x39f579);})[_0xdac0('0x26')](function(_0x4c7331){logger[_0xdac0('0x15')]('ShowZendeskAccount',_0x4c7331[_0xdac0('0x17')],_0x1c2e6d);_0x3c19a6(_0x49ca74[_0xdac0('0x15')](0x1f4,_0x4c7331['message']));});});}; \ No newline at end of file +var _0x18c9=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowZendeskAccount','find'];(function(_0x494699,_0xfcd936){var _0xf1b54c=function(_0x4fb306){while(--_0x4fb306){_0x494699['push'](_0x494699['shift']());}};_0xf1b54c(++_0xfcd936);}(_0x18c9,0x72));var _0x918c=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x18c9[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x918c('0x0'));var util=require(_0x918c('0x1'));var moment=require(_0x918c('0x2'));var BPromise=require(_0x918c('0x3'));var rs=require(_0x918c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x918c('0x5'))['db'];var utils=require(_0x918c('0x6'));var logger=require(_0x918c('0x7'))(_0x918c('0x8'));var config=require('../../config/environment');var jayson=require(_0x918c('0x9'));var client=jayson[_0x918c('0xa')][_0x918c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337deb,_0x468ffb,_0x38c74b){return new BPromise(function(_0x2b13f8,_0x488cf2){return client[_0x918c('0xc')](_0x337deb,_0x38c74b)['then'](function(_0x4b1e1a){logger['info'](_0x918c('0xd'),_0x468ffb,'request\x20sent');logger[_0x918c('0xe')](_0x918c('0xf'),_0x468ffb,_0x918c('0x10'),JSON[_0x918c('0x11')](_0x4b1e1a));if(_0x4b1e1a['error']){if(_0x4b1e1a[_0x918c('0x12')][_0x918c('0x13')]===0x1f4){logger[_0x918c('0x12')](_0x918c('0xd'),_0x468ffb,_0x4b1e1a[_0x918c('0x12')]['message']);return _0x488cf2(_0x4b1e1a[_0x918c('0x12')]['message']);}logger[_0x918c('0x12')](_0x918c('0xd'),_0x468ffb,_0x4b1e1a['error']['message']);return _0x2b13f8(_0x4b1e1a[_0x918c('0x12')][_0x918c('0x14')]);}else{logger[_0x918c('0x15')](_0x918c('0xd'),_0x468ffb,_0x918c('0x10'));_0x2b13f8(_0x4b1e1a[_0x918c('0x16')][_0x918c('0x14')]);}})[_0x918c('0x17')](function(_0x35fc35){logger[_0x918c('0x12')](_0x918c('0xd'),_0x468ffb,_0x35fc35);_0x488cf2(_0x35fc35);});});}exports[_0x918c('0x18')]=function(_0x3b5b7e){var _0x47592c=this;return new Promise(function(_0x21d47a,_0x2e88d9){return db[_0x918c('0x19')][_0x918c('0x1a')]({'raw':_0x3b5b7e[_0x918c('0x1b')]?_0x3b5b7e[_0x918c('0x1b')][_0x918c('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b5b7e[_0x918c('0x1b')]?_0x3b5b7e[_0x918c('0x1b')][_0x918c('0x1d')]||null:null,'attributes':_0x3b5b7e['options']?_0x3b5b7e[_0x918c('0x1b')][_0x918c('0x1e')]||null:null,'limit':_0x3b5b7e[_0x918c('0x1b')]?_0x3b5b7e[_0x918c('0x1b')][_0x918c('0x1f')]||null:null,'include':_0x3b5b7e[_0x918c('0x1b')]?_0x3b5b7e['options'][_0x918c('0x20')]?_[_0x918c('0x21')](_0x3b5b7e[_0x918c('0x1b')]['include'],function(_0x169eae){return{'model':db[_0x169eae['model']],'as':_0x169eae['as'],'attributes':_0x169eae[_0x918c('0x1e')],'include':_0x169eae['include']?_['map'](_0x169eae[_0x918c('0x20')],function(_0x45ed29){return{'model':db[_0x45ed29[_0x918c('0x22')]],'as':_0x45ed29['as'],'attributes':_0x45ed29[_0x918c('0x1e')],'include':_0x45ed29[_0x918c('0x20')]?_[_0x918c('0x21')](_0x45ed29['include'],function(_0x1deda9){return{'model':db[_0x1deda9['model']],'as':_0x1deda9['as'],'attributes':_0x1deda9[_0x918c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x918c('0x23')](function(_0x2ac27b){logger[_0x918c('0x15')]('GetZendeskAccount',_0x3b5b7e);logger['debug'](_0x918c('0x18'),_0x3b5b7e,JSON[_0x918c('0x11')](_0x2ac27b));_0x21d47a(_0x2ac27b);})['catch'](function(_0x3ef6bc){logger[_0x918c('0x12')](_0x918c('0x18'),_0x3ef6bc[_0x918c('0x14')],_0x3b5b7e);_0x2e88d9(_0x47592c['error'](0x1f4,_0x3ef6bc[_0x918c('0x14')]));});});};exports[_0x918c('0x24')]=function(_0x1fc248){var _0x3d5186=this;return new Promise(function(_0x592c34,_0x1e4c8a){return db[_0x918c('0x19')][_0x918c('0x25')]({'raw':_0x1fc248[_0x918c('0x1b')]?_0x1fc248[_0x918c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc248[_0x918c('0x1b')]?_0x1fc248[_0x918c('0x1b')][_0x918c('0x1d')]||null:null,'attributes':_0x1fc248[_0x918c('0x1b')]?_0x1fc248[_0x918c('0x1b')]['attributes']||null:null,'include':_0x1fc248[_0x918c('0x1b')]?_0x1fc248['options'][_0x918c('0x20')]?_['map'](_0x1fc248['options'][_0x918c('0x20')],function(_0x152c0d){return{'model':db[_0x152c0d[_0x918c('0x22')]],'as':_0x152c0d['as'],'attributes':_0x152c0d[_0x918c('0x1e')],'include':_0x152c0d[_0x918c('0x20')]?_[_0x918c('0x21')](_0x152c0d[_0x918c('0x20')],function(_0x19be40){return{'model':db[_0x19be40[_0x918c('0x22')]],'as':_0x19be40['as'],'attributes':_0x19be40[_0x918c('0x1e')],'include':_0x19be40['include']?_['map'](_0x19be40['include'],function(_0xb846f8){return{'model':db[_0xb846f8[_0x918c('0x22')]],'as':_0xb846f8['as'],'attributes':_0xb846f8[_0x918c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14a74e){logger['info']('ShowZendeskAccount',_0x1fc248);logger[_0x918c('0xe')](_0x918c('0x24'),_0x1fc248,JSON[_0x918c('0x11')](_0x14a74e));_0x592c34(_0x14a74e);})[_0x918c('0x17')](function(_0x5909b6){logger[_0x918c('0x12')]('ShowZendeskAccount',_0x5909b6[_0x918c('0x14')],_0x1fc248);_0x1e4c8a(_0x3d5186[_0x918c('0x12')](0x1f4,_0x5909b6['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0da3093..201072d 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x333965,_0x16e0f5){_0x333965=_0x333965-0x0;var _0x50290e=_0xbdb7[_0x333965];return _0x50290e;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x1f7116,_0x377bf8){var _0x375fd0=function(_0x5df70a){while(--_0x5df70a){_0x1f7116['push'](_0x1f7116['shift']());}};_0x375fd0(++_0x377bf8);}(_0xb10b,0x12a));var _0xbb10=function(_0x241d9c,_0x37d233){_0x241d9c=_0x241d9c-0x0;var _0x3783d4=_0xb10b[_0x241d9c];return _0x3783d4;};'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['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8777e65..f084499 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 _0xf63f=['STRING','sequelize'];(function(_0x2ebaa3,_0x223a80){var _0x14dd94=function(_0x3f9495){while(--_0x3f9495){_0x2ebaa3['push'](_0x2ebaa3['shift']());}};_0x14dd94(++_0x223a80);}(_0xf63f,0x11b));var _0xff63=function(_0x1a0b62,_0x3439b4){_0x1a0b62=_0x1a0b62-0x0;var _0x19a618=_0xf63f[_0x1a0b62];return _0x19a618;};'use strict';var Sequelize=require(_0xff63('0x0'));module['exports']={'name':{'type':Sequelize[_0xff63('0x1')]},'description':{'type':Sequelize[_0xff63('0x1')]}}; \ No newline at end of file +var _0xf2a6=['exports','STRING','sequelize'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xf2a6,0x146));var _0x6f2a=function(_0xab38b6,_0x4df28e){_0xab38b6=_0xab38b6-0x0;var _0x57aba4=_0xf2a6[_0xab38b6];return _0x57aba4;};'use strict';var Sequelize=require(_0x6f2a('0x0'));module[_0x6f2a('0x1')]={'name':{'type':Sequelize[_0x6f2a('0x2')]},'description':{'type':Sequelize[_0x6f2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 38be001..7f5a794 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 _0xf897=['apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','length','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','keys','options','body','find','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','hasOwnProperty','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range'];(function(_0x4fc440,_0x5af4ad){var _0x48264f=function(_0x24d2d0){while(--_0x24d2d0){_0x4fc440['push'](_0x4fc440['shift']());}};_0x48264f(++_0x5af4ad);}(_0xf897,0x182));var _0x7f89=function(_0x1f9862,_0x1047d7){_0x1f9862=_0x1f9862-0x0;var _0x5c41b0=_0xf897[_0x1f9862];return _0x5c41b0;};'use strict';var emlformat=require(_0x7f89('0x0'));var rimraf=require(_0x7f89('0x1'));var zipdir=require(_0x7f89('0x2'));var jsonpatch=require(_0x7f89('0x3'));var rp=require(_0x7f89('0x4'));var moment=require('moment');var BPromise=require(_0x7f89('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f89('0x6'));var sox=require(_0x7f89('0x7'));var csv=require(_0x7f89('0x8'));var ejs=require(_0x7f89('0x9'));var fs=require('fs');var fs_extra=require(_0x7f89('0xa'));var _=require(_0x7f89('0xb'));var squel=require(_0x7f89('0xc'));var crypto=require(_0x7f89('0xd'));var jsforce=require(_0x7f89('0xe'));var deskjs=require(_0x7f89('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7f89('0x10'));var Papa=require(_0x7f89('0x11'));var Redis=require(_0x7f89('0x12'));var authService=require(_0x7f89('0x13'));var qs=require(_0x7f89('0x14'));var as=require(_0x7f89('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f89('0x16'))(_0x7f89('0x17'));var utils=require(_0x7f89('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7f89('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55370a,_0x567040){_0x567040=_0x567040||0xcc;return function(_0x152456){if(_0x152456){return _0x55370a[_0x7f89('0x1a')](_0x567040);}return _0x55370a[_0x7f89('0x1b')](_0x567040)['end']();};}function respondWithResult(_0x101445,_0x294ea1){_0x294ea1=_0x294ea1||0xc8;return function(_0x1c9af0){if(_0x1c9af0){return _0x101445['status'](_0x294ea1)[_0x7f89('0x1c')](_0x1c9af0);}};}function respondWithFilteredResult(_0x2c2811,_0x18daad){return function(_0x4a2fe2){if(_0x4a2fe2){var _0x2d91be=typeof _0x18daad[_0x7f89('0x1d')]==='undefined'&&typeof _0x18daad[_0x7f89('0x1e')]==='undefined';var _0x4c6789=_0x4a2fe2[_0x7f89('0x1f')];var _0x5dbb5b=_0x2d91be?0x0:_0x18daad[_0x7f89('0x1d')];var _0x32d9fe=_0x2d91be?_0x4a2fe2[_0x7f89('0x1f')]:_0x18daad[_0x7f89('0x1d')]+_0x18daad['limit'];var _0xe759c2;if(_0x32d9fe>=_0x4c6789){_0x32d9fe=_0x4c6789;_0xe759c2=0xc8;}else{_0xe759c2=0xce;}_0x2c2811[_0x7f89('0x1b')](_0xe759c2);return _0x2c2811[_0x7f89('0x20')](_0x7f89('0x21'),_0x5dbb5b+'-'+_0x32d9fe+'/'+_0x4c6789)[_0x7f89('0x1c')](_0x4a2fe2);}return null;};}function patchUpdates(_0x65ba99){return function(_0x1494cf){try{jsonpatch[_0x7f89('0x22')](_0x1494cf,_0x65ba99,!![]);}catch(_0x4fb970){return BPromise[_0x7f89('0x23')](_0x4fb970);}return _0x1494cf[_0x7f89('0x24')]();};}function saveUpdates(_0x5d3e3b,_0x517935){return function(_0x3c817c){if(_0x3c817c){return _0x3c817c[_0x7f89('0x25')](_0x5d3e3b)[_0x7f89('0x26')](function(_0x9c1cad){return _0x9c1cad;});}return null;};}function removeEntity(_0x1070f9,_0x2bad4a){return function(_0x546aee){if(_0x546aee){return _0x546aee[_0x7f89('0x27')]()[_0x7f89('0x26')](function(){_0x1070f9[_0x7f89('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0ef1,_0x248e00){return function(_0x10e452){if(!_0x10e452){_0x3e0ef1[_0x7f89('0x1a')](0x194);}return _0x10e452;};}function handleError(_0x4f5b43,_0x3906e9){_0x3906e9=_0x3906e9||0x1f4;return function(_0x45b74c){logger['error'](_0x45b74c[_0x7f89('0x28')]);if(_0x45b74c[_0x7f89('0x29')]){delete _0x45b74c[_0x7f89('0x29')];}_0x4f5b43[_0x7f89('0x1b')](_0x3906e9)[_0x7f89('0x2a')](_0x45b74c);};}exports[_0x7f89('0x2b')]=function(_0x1ca6f2,_0x1aac3f){var _0x4c9ad7={},_0x5b760a={},_0x4af660={'count':0x0,'rows':[]};var _0x2e0506=_[_0x7f89('0x2c')](db[_0x7f89('0x2d')][_0x7f89('0x2e')],function(_0x4b9461){return{'name':_0x4b9461[_0x7f89('0x2f')],'type':_0x4b9461[_0x7f89('0x30')][_0x7f89('0x31')]};});_0x5b760a['model']=_[_0x7f89('0x2c')](_0x2e0506,_0x7f89('0x29'));_0x5b760a[_0x7f89('0x32')]=_['keys'](_0x1ca6f2[_0x7f89('0x32')]);_0x5b760a[_0x7f89('0x33')]=_[_0x7f89('0x34')](_0x5b760a[_0x7f89('0x35')],_0x5b760a[_0x7f89('0x32')]);_0x4c9ad7['attributes']=_['intersection'](_0x5b760a['model'],qs[_0x7f89('0x36')](_0x1ca6f2[_0x7f89('0x32')][_0x7f89('0x36')]));_0x4c9ad7['attributes']=_0x4c9ad7['attributes'][_0x7f89('0x37')]?_0x4c9ad7[_0x7f89('0x38')]:_0x5b760a['model'];if(!_0x1ca6f2[_0x7f89('0x32')]['hasOwnProperty']('nolimit')){_0x4c9ad7['limit']=qs[_0x7f89('0x1e')](_0x1ca6f2['query'][_0x7f89('0x1e')]);_0x4c9ad7[_0x7f89('0x1d')]=qs[_0x7f89('0x1d')](_0x1ca6f2[_0x7f89('0x32')]['offset']);}_0x4c9ad7[_0x7f89('0x39')]=qs[_0x7f89('0x3a')](_0x1ca6f2[_0x7f89('0x32')][_0x7f89('0x3a')]);_0x4c9ad7[_0x7f89('0x3b')]=qs[_0x7f89('0x33')](_[_0x7f89('0x3c')](_0x1ca6f2[_0x7f89('0x32')],_0x5b760a[_0x7f89('0x33')]),_0x2e0506);if(_0x1ca6f2[_0x7f89('0x32')][_0x7f89('0x3d')]){_0x4c9ad7['where']=_[_0x7f89('0x3e')](_0x4c9ad7['where'],{'$or':_[_0x7f89('0x2c')](_0x2e0506,function(_0x35d4b8){if(_0x35d4b8[_0x7f89('0x30')]!=='VIRTUAL'){var _0x2d2eae={};_0x2d2eae[_0x35d4b8[_0x7f89('0x29')]]={'$like':'%'+_0x1ca6f2[_0x7f89('0x32')][_0x7f89('0x3d')]+'%'};return _0x2d2eae;}})});}_0x4c9ad7=_['merge']({},_0x4c9ad7,_0x1ca6f2['options']);var _0x3ee58a={'where':_0x4c9ad7['where']};return db['ZendeskConfiguration']['count'](_0x3ee58a)['then'](function(_0xf9e4cb){_0x4af660[_0x7f89('0x1f')]=_0xf9e4cb;if(_0x1ca6f2['query'][_0x7f89('0x3f')]){_0x4c9ad7[_0x7f89('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x7f89('0x41')](_0x4c9ad7);})['then'](function(_0x302ad2){_0x4af660[_0x7f89('0x42')]=_0x302ad2;return _0x4af660;})['then'](respondWithFilteredResult(_0x1aac3f,_0x4c9ad7))[_0x7f89('0x43')](handleError(_0x1aac3f,null));};exports['show']=function(_0x232e98,_0x59c553){var _0x9964ab={'raw':![],'where':{'id':_0x232e98[_0x7f89('0x44')]['id']}},_0x47e270={};_0x47e270['model']=_['keys'](db[_0x7f89('0x2d')]['rawAttributes']);_0x47e270[_0x7f89('0x32')]=_[_0x7f89('0x45')](_0x232e98[_0x7f89('0x32')]);_0x47e270[_0x7f89('0x33')]=_[_0x7f89('0x34')](_0x47e270[_0x7f89('0x35')],_0x47e270[_0x7f89('0x32')]);_0x9964ab[_0x7f89('0x38')]=_[_0x7f89('0x34')](_0x47e270['model'],qs[_0x7f89('0x36')](_0x232e98['query'][_0x7f89('0x36')]));_0x9964ab[_0x7f89('0x38')]=_0x9964ab[_0x7f89('0x38')][_0x7f89('0x37')]?_0x9964ab[_0x7f89('0x38')]:_0x47e270['model'];if(_0x232e98[_0x7f89('0x32')]['includeAll']){_0x9964ab['include']=[{'all':!![]}];}_0x9964ab=_[_0x7f89('0x3e')]({},_0x9964ab,_0x232e98[_0x7f89('0x46')]);return db[_0x7f89('0x2d')]['find'](_0x9964ab)['then'](handleEntityNotFound(_0x59c553,null))[_0x7f89('0x26')](respondWithResult(_0x59c553,null))['catch'](handleError(_0x59c553,null));};exports['create']=function(_0x17799b,_0x267d6d){return db['ZendeskConfiguration']['create'](_0x17799b['body'],{})['then'](respondWithResult(_0x267d6d,0xc9))[_0x7f89('0x43')](handleError(_0x267d6d,null));};exports[_0x7f89('0x25')]=function(_0x2ad86,_0x1400ce){if(_0x2ad86[_0x7f89('0x47')]['id']){delete _0x2ad86[_0x7f89('0x47')]['id'];}return db['ZendeskConfiguration'][_0x7f89('0x48')]({'where':{'id':_0x2ad86['params']['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x1400ce,null))[_0x7f89('0x26')](saveUpdates(_0x2ad86['body'],null))[_0x7f89('0x26')](respondWithResult(_0x1400ce,null))['catch'](handleError(_0x1400ce,null));};exports[_0x7f89('0x27')]=function(_0x5d2bf2,_0x43a3b7){return db['ZendeskConfiguration'][_0x7f89('0x48')]({'where':{'id':_0x5d2bf2['params']['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x43a3b7,null))[_0x7f89('0x26')](removeEntity(_0x43a3b7,null))[_0x7f89('0x43')](handleError(_0x43a3b7,null));};exports[_0x7f89('0x49')]=function(_0x11d6dd,_0xb18efd,_0x15e649){var _0x4946e4={};var _0x429df7={};var _0x47f276;var _0x3f9963;return db[_0x7f89('0x2d')][_0x7f89('0x4a')]({'where':{'id':_0x11d6dd[_0x7f89('0x44')]['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0xb18efd,null))[_0x7f89('0x26')](function(_0x1604ce){if(_0x1604ce){_0x47f276=_0x1604ce;_0x429df7[_0x7f89('0x35')]=_[_0x7f89('0x45')](db[_0x7f89('0x4b')][_0x7f89('0x2e')]);_0x429df7[_0x7f89('0x32')]=_[_0x7f89('0x45')](_0x11d6dd[_0x7f89('0x32')]);_0x429df7[_0x7f89('0x33')]=_[_0x7f89('0x34')](_0x429df7[_0x7f89('0x35')],_0x429df7[_0x7f89('0x32')]);_0x4946e4[_0x7f89('0x38')]=_[_0x7f89('0x34')](_0x429df7[_0x7f89('0x35')],qs[_0x7f89('0x36')](_0x11d6dd['query'][_0x7f89('0x36')]));_0x4946e4[_0x7f89('0x38')]=_0x4946e4['attributes'][_0x7f89('0x37')]?_0x4946e4['attributes']:_0x429df7[_0x7f89('0x35')];_0x4946e4['order']=qs[_0x7f89('0x3a')](_0x11d6dd[_0x7f89('0x32')][_0x7f89('0x3a')]);_0x4946e4[_0x7f89('0x3b')]=qs[_0x7f89('0x33')](_[_0x7f89('0x3c')](_0x11d6dd[_0x7f89('0x32')],_0x429df7['filters']));if(_0x11d6dd['query'][_0x7f89('0x3d')]){_0x4946e4[_0x7f89('0x3b')]=_['merge'](_0x4946e4[_0x7f89('0x3b')],{'$or':_['map'](_0x4946e4[_0x7f89('0x38')],function(_0x3f665a){var _0x3983d1={};_0x3983d1[_0x3f665a]={'$like':'%'+_0x11d6dd[_0x7f89('0x32')][_0x7f89('0x3d')]+'%'};return _0x3983d1;})});}_0x4946e4=_[_0x7f89('0x3e')]({},_0x4946e4,_0x11d6dd['options']);return _0x47f276['getFields'](_0x4946e4);}})['then'](function(_0x310444){if(_0x310444){_0x3f9963=_0x310444[_0x7f89('0x37')];if(!_0x11d6dd[_0x7f89('0x32')]['hasOwnProperty'](_0x7f89('0x4c'))){_0x4946e4[_0x7f89('0x1e')]=qs[_0x7f89('0x1e')](_0x11d6dd[_0x7f89('0x32')][_0x7f89('0x1e')]);_0x4946e4[_0x7f89('0x1d')]=qs[_0x7f89('0x1d')](_0x11d6dd[_0x7f89('0x32')]['offset']);}return _0x47f276[_0x7f89('0x49')](_0x4946e4);}})[_0x7f89('0x26')](function(_0x4d4edf){if(_0x4d4edf){return _0x4d4edf?{'count':_0x3f9963,'rows':_0x4d4edf}:null;}})['then'](respondWithResult(_0xb18efd,null))[_0x7f89('0x43')](handleError(_0xb18efd,null));};exports['getSubjects']=function(_0x1dbeeb,_0x5f5ae7,_0x5cdca2){var _0x8e04c={};var _0x57b07c={};var _0x269b4d;var _0x241e0f;return db[_0x7f89('0x2d')]['findOne']({'where':{'id':_0x1dbeeb[_0x7f89('0x44')]['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x5f5ae7,null))[_0x7f89('0x26')](function(_0x1eae49){if(_0x1eae49){_0x269b4d=_0x1eae49;_0x57b07c[_0x7f89('0x35')]=_['keys'](db[_0x7f89('0x4b')]['rawAttributes']);_0x57b07c[_0x7f89('0x32')]=_[_0x7f89('0x45')](_0x1dbeeb[_0x7f89('0x32')]);_0x57b07c['filters']=_['intersection'](_0x57b07c[_0x7f89('0x35')],_0x57b07c['query']);_0x8e04c[_0x7f89('0x38')]=_[_0x7f89('0x34')](_0x57b07c['model'],qs[_0x7f89('0x36')](_0x1dbeeb[_0x7f89('0x32')][_0x7f89('0x36')]));_0x8e04c[_0x7f89('0x38')]=_0x8e04c[_0x7f89('0x38')]['length']?_0x8e04c[_0x7f89('0x38')]:_0x57b07c['model'];_0x8e04c[_0x7f89('0x39')]=qs[_0x7f89('0x3a')](_0x1dbeeb['query'][_0x7f89('0x3a')]);_0x8e04c[_0x7f89('0x3b')]=qs[_0x7f89('0x33')](_[_0x7f89('0x3c')](_0x1dbeeb['query'],_0x57b07c[_0x7f89('0x33')]));if(_0x1dbeeb['query'][_0x7f89('0x3d')]){_0x8e04c[_0x7f89('0x3b')]=_[_0x7f89('0x3e')](_0x8e04c['where'],{'$or':_[_0x7f89('0x2c')](_0x8e04c[_0x7f89('0x38')],function(_0x581f1c){var _0x4b6144={};_0x4b6144[_0x581f1c]={'$like':'%'+_0x1dbeeb[_0x7f89('0x32')][_0x7f89('0x3d')]+'%'};return _0x4b6144;})});}_0x8e04c=_[_0x7f89('0x3e')]({},_0x8e04c,_0x1dbeeb[_0x7f89('0x46')]);return _0x269b4d[_0x7f89('0x4d')](_0x8e04c);}})[_0x7f89('0x26')](function(_0x533a33){if(_0x533a33){_0x241e0f=_0x533a33[_0x7f89('0x37')];if(!_0x1dbeeb[_0x7f89('0x32')]['hasOwnProperty'](_0x7f89('0x4c'))){_0x8e04c[_0x7f89('0x1e')]=qs[_0x7f89('0x1e')](_0x1dbeeb[_0x7f89('0x32')][_0x7f89('0x1e')]);_0x8e04c['offset']=qs[_0x7f89('0x1d')](_0x1dbeeb[_0x7f89('0x32')][_0x7f89('0x1d')]);}return _0x269b4d[_0x7f89('0x4d')](_0x8e04c);}})['then'](function(_0x14d6b2){if(_0x14d6b2){return _0x14d6b2?{'count':_0x241e0f,'rows':_0x14d6b2}:null;}})[_0x7f89('0x26')](respondWithResult(_0x5f5ae7,null))[_0x7f89('0x43')](handleError(_0x5f5ae7,null));};exports[_0x7f89('0x4e')]=function(_0x2f9a28,_0x1fad49,_0x39ae2a){var _0x5c17d2={};var _0x353dfd={};var _0x3fb9de;var _0x5e9864;return db[_0x7f89('0x2d')][_0x7f89('0x4a')]({'where':{'id':_0x2f9a28[_0x7f89('0x44')]['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x1fad49,null))[_0x7f89('0x26')](function(_0x14b39d){if(_0x14b39d){_0x3fb9de=_0x14b39d;_0x353dfd[_0x7f89('0x35')]=_['keys'](db[_0x7f89('0x4b')]['rawAttributes']);_0x353dfd['query']=_[_0x7f89('0x45')](_0x2f9a28[_0x7f89('0x32')]);_0x353dfd[_0x7f89('0x33')]=_[_0x7f89('0x34')](_0x353dfd['model'],_0x353dfd[_0x7f89('0x32')]);_0x5c17d2[_0x7f89('0x38')]=_[_0x7f89('0x34')](_0x353dfd['model'],qs[_0x7f89('0x36')](_0x2f9a28[_0x7f89('0x32')][_0x7f89('0x36')]));_0x5c17d2[_0x7f89('0x38')]=_0x5c17d2[_0x7f89('0x38')][_0x7f89('0x37')]?_0x5c17d2[_0x7f89('0x38')]:_0x353dfd[_0x7f89('0x35')];_0x5c17d2['order']=qs[_0x7f89('0x3a')](_0x2f9a28[_0x7f89('0x32')]['sort']);_0x5c17d2[_0x7f89('0x3b')]=qs['filters'](_['pick'](_0x2f9a28[_0x7f89('0x32')],_0x353dfd[_0x7f89('0x33')]));if(_0x2f9a28[_0x7f89('0x32')][_0x7f89('0x3d')]){_0x5c17d2[_0x7f89('0x3b')]=_['merge'](_0x5c17d2[_0x7f89('0x3b')],{'$or':_[_0x7f89('0x2c')](_0x5c17d2[_0x7f89('0x38')],function(_0x18db72){var _0x4950b4={};_0x4950b4[_0x18db72]={'$like':'%'+_0x2f9a28[_0x7f89('0x32')]['filter']+'%'};return _0x4950b4;})});}_0x5c17d2=_[_0x7f89('0x3e')]({},_0x5c17d2,_0x2f9a28['options']);return _0x3fb9de[_0x7f89('0x4e')](_0x5c17d2);}})[_0x7f89('0x26')](function(_0x1d5c41){if(_0x1d5c41){_0x5e9864=_0x1d5c41[_0x7f89('0x37')];if(!_0x2f9a28['query'][_0x7f89('0x4f')](_0x7f89('0x4c'))){_0x5c17d2[_0x7f89('0x1e')]=qs[_0x7f89('0x1e')](_0x2f9a28[_0x7f89('0x32')][_0x7f89('0x1e')]);_0x5c17d2[_0x7f89('0x1d')]=qs[_0x7f89('0x1d')](_0x2f9a28['query'][_0x7f89('0x1d')]);}return _0x3fb9de[_0x7f89('0x4e')](_0x5c17d2);}})[_0x7f89('0x26')](function(_0x3bed9d){if(_0x3bed9d){return _0x3bed9d?{'count':_0x5e9864,'rows':_0x3bed9d}:null;}})[_0x7f89('0x26')](respondWithResult(_0x1fad49,null))[_0x7f89('0x43')](handleError(_0x1fad49,null));};exports[_0x7f89('0x50')]=function(_0x17c6db,_0x3ea169,_0x491ff0){var _0xefd56c={};var _0x3c7435={};var _0x2092a1;var _0x2f0d14;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x17c6db[_0x7f89('0x44')]['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x3ea169,null))['then'](function(_0x3a5795){if(_0x3a5795){_0x2092a1=_0x3a5795;_0x3c7435[_0x7f89('0x35')]=_[_0x7f89('0x45')](db[_0x7f89('0x51')][_0x7f89('0x2e')]);_0x3c7435[_0x7f89('0x32')]=_[_0x7f89('0x45')](_0x17c6db[_0x7f89('0x32')]);_0x3c7435[_0x7f89('0x33')]=_[_0x7f89('0x34')](_0x3c7435[_0x7f89('0x35')],_0x3c7435[_0x7f89('0x32')]);_0xefd56c[_0x7f89('0x38')]=_['intersection'](_0x3c7435[_0x7f89('0x35')],qs[_0x7f89('0x36')](_0x17c6db['query'][_0x7f89('0x36')]));_0xefd56c['attributes']=_0xefd56c[_0x7f89('0x38')]['length']?_0xefd56c[_0x7f89('0x38')]:_0x3c7435[_0x7f89('0x35')];_0xefd56c['order']=qs[_0x7f89('0x3a')](_0x17c6db[_0x7f89('0x32')][_0x7f89('0x3a')]);_0xefd56c[_0x7f89('0x3b')]=qs[_0x7f89('0x33')](_[_0x7f89('0x3c')](_0x17c6db[_0x7f89('0x32')],_0x3c7435['filters']));if(_0x17c6db[_0x7f89('0x32')][_0x7f89('0x3d')]){_0xefd56c[_0x7f89('0x3b')]=_['merge'](_0xefd56c[_0x7f89('0x3b')],{'$or':_['map'](_0xefd56c[_0x7f89('0x38')],function(_0x279fb9){var _0x4cce26={};_0x4cce26[_0x279fb9]={'$like':'%'+_0x17c6db['query'][_0x7f89('0x3d')]+'%'};return _0x4cce26;})});}_0xefd56c=_[_0x7f89('0x3e')]({},_0xefd56c,_0x17c6db[_0x7f89('0x46')]);return _0x2092a1[_0x7f89('0x50')](_0xefd56c);}})['then'](function(_0xf2b696){if(_0xf2b696){_0x2f0d14=_0xf2b696['length'];if(!_0x17c6db['query'][_0x7f89('0x4f')](_0x7f89('0x4c'))){_0xefd56c[_0x7f89('0x1e')]=qs[_0x7f89('0x1e')](_0x17c6db[_0x7f89('0x32')][_0x7f89('0x1e')]);_0xefd56c[_0x7f89('0x1d')]=qs['offset'](_0x17c6db[_0x7f89('0x32')][_0x7f89('0x1d')]);}return _0x2092a1[_0x7f89('0x50')](_0xefd56c);}})['then'](function(_0x9f68c5){if(_0x9f68c5){return _0x9f68c5?{'count':_0x2f0d14,'rows':_0x9f68c5}:null;}})[_0x7f89('0x26')](respondWithResult(_0x3ea169,null))[_0x7f89('0x43')](handleError(_0x3ea169,null));};exports[_0x7f89('0x52')]=function(_0x9cbb04,_0x3ec558,_0x306647){if(_0x9cbb04['body']['id']){delete _0x9cbb04[_0x7f89('0x47')]['id'];}return db[_0x7f89('0x2d')][_0x7f89('0x4a')]({'where':{'id':_0x9cbb04[_0x7f89('0x44')]['id']}})[_0x7f89('0x26')](handleEntityNotFound(_0x3ec558,null))['then'](function(_0x5dc81c){if(_0x5dc81c){return _0x5dc81c[_0x7f89('0x52')](_0x9cbb04[_0x7f89('0x47')][_0x7f89('0x53')]||[]);}return null;})[_0x7f89('0x26')](respondWithResult(_0x3ec558,null))[_0x7f89('0x43')](handleError(_0x3ec558,null));}; \ No newline at end of file +var _0xd02c=['pick','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','save','update','destroy','end','error','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','then','rows','catch','show','params','keys','includeAll','create','body','find','getFields','ZendeskField'];(function(_0x5b8fde,_0x4ca005){var _0x27df49=function(_0x3dd21e){while(--_0x3dd21e){_0x5b8fde['push'](_0x5b8fde['shift']());}};_0x27df49(++_0x4ca005);}(_0xd02c,0xaa));var _0xcd02=function(_0xc0126a,_0x52f9e1){_0xc0126a=_0xc0126a-0x0;var _0xdb22ca=_0xd02c[_0xc0126a];return _0xdb22ca;};'use strict';var emlformat=require(_0xcd02('0x0'));var rimraf=require(_0xcd02('0x1'));var zipdir=require(_0xcd02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd02('0x3'));var moment=require(_0xcd02('0x4'));var BPromise=require(_0xcd02('0x5'));var Mustache=require(_0xcd02('0x6'));var util=require('util');var path=require(_0xcd02('0x7'));var sox=require(_0xcd02('0x8'));var csv=require(_0xcd02('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd02('0xa'));var _=require('lodash');var squel=require(_0xcd02('0xb'));var crypto=require(_0xcd02('0xc'));var jsforce=require(_0xcd02('0xd'));var deskjs=require(_0xcd02('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcd02('0xf'));var Papa=require(_0xcd02('0x10'));var Redis=require(_0xcd02('0x11'));var authService=require(_0xcd02('0x12'));var qs=require(_0xcd02('0x13'));var as=require(_0xcd02('0x14'));var hardwareService=require(_0xcd02('0x15'));var logger=require(_0xcd02('0x16'))(_0xcd02('0x17'));var utils=require(_0xcd02('0x18'));var config=require(_0xcd02('0x19'));var licenseUtil=require(_0xcd02('0x1a'));var db=require(_0xcd02('0x1b'))['db'];function respondWithStatusCode(_0x3a5d33,_0x3bf19e){_0x3bf19e=_0x3bf19e||0xcc;return function(_0x30ea73){if(_0x30ea73){return _0x3a5d33[_0xcd02('0x1c')](_0x3bf19e);}return _0x3a5d33[_0xcd02('0x1d')](_0x3bf19e)['end']();};}function respondWithResult(_0xdbc4de,_0x522387){_0x522387=_0x522387||0xc8;return function(_0xa158a0){if(_0xa158a0){return _0xdbc4de[_0xcd02('0x1d')](_0x522387)[_0xcd02('0x1e')](_0xa158a0);}};}function respondWithFilteredResult(_0x1837d8,_0x44bdf9){return function(_0xa80c43){if(_0xa80c43){var _0x53f842=typeof _0x44bdf9[_0xcd02('0x1f')]==='undefined'&&typeof _0x44bdf9[_0xcd02('0x20')]==='undefined';var _0x380645=_0xa80c43[_0xcd02('0x21')];var _0x43800f=_0x53f842?0x0:_0x44bdf9[_0xcd02('0x1f')];var _0x2a9155=_0x53f842?_0xa80c43[_0xcd02('0x21')]:_0x44bdf9['offset']+_0x44bdf9[_0xcd02('0x20')];var _0x4c0100;if(_0x2a9155>=_0x380645){_0x2a9155=_0x380645;_0x4c0100=0xc8;}else{_0x4c0100=0xce;}_0x1837d8[_0xcd02('0x1d')](_0x4c0100);return _0x1837d8[_0xcd02('0x22')](_0xcd02('0x23'),_0x43800f+'-'+_0x2a9155+'/'+_0x380645)[_0xcd02('0x1e')](_0xa80c43);}return null;};}function patchUpdates(_0x3ce37e){return function(_0x380042){try{jsonpatch['apply'](_0x380042,_0x3ce37e,!![]);}catch(_0x13ac76){return BPromise['reject'](_0x13ac76);}return _0x380042[_0xcd02('0x24')]();};}function saveUpdates(_0x5c0f71,_0xbe0915){return function(_0x57df57){if(_0x57df57){return _0x57df57[_0xcd02('0x25')](_0x5c0f71)['then'](function(_0xd33080){return _0xd33080;});}return null;};}function removeEntity(_0x3cd49d,_0x35ab2e){return function(_0x48876a){if(_0x48876a){return _0x48876a[_0xcd02('0x26')]()['then'](function(){_0x3cd49d[_0xcd02('0x1d')](0xcc)[_0xcd02('0x27')]();});}};}function handleEntityNotFound(_0x228e05,_0x2c6549){return function(_0x4ec4ec){if(!_0x4ec4ec){_0x228e05[_0xcd02('0x1c')](0x194);}return _0x4ec4ec;};}function handleError(_0x167d90,_0x265bc6){_0x265bc6=_0x265bc6||0x1f4;return function(_0x30bd15){logger[_0xcd02('0x28')](_0x30bd15[_0xcd02('0x29')]);if(_0x30bd15['name']){delete _0x30bd15[_0xcd02('0x2a')];}_0x167d90['status'](_0x265bc6)['send'](_0x30bd15);};}exports['index']=function(_0x5f1218,_0x3806a0){var _0x705f9e={},_0x52c370={},_0x41e171={'count':0x0,'rows':[]};var _0x33cd06=_[_0xcd02('0x2b')](db[_0xcd02('0x2c')][_0xcd02('0x2d')],function(_0x5be364){return{'name':_0x5be364[_0xcd02('0x2e')],'type':_0x5be364[_0xcd02('0x2f')]['key']};});_0x52c370[_0xcd02('0x30')]=_[_0xcd02('0x2b')](_0x33cd06,'name');_0x52c370['query']=_['keys'](_0x5f1218['query']);_0x52c370[_0xcd02('0x31')]=_[_0xcd02('0x32')](_0x52c370[_0xcd02('0x30')],_0x52c370[_0xcd02('0x33')]);_0x705f9e[_0xcd02('0x34')]=_[_0xcd02('0x32')](_0x52c370[_0xcd02('0x30')],qs[_0xcd02('0x35')](_0x5f1218[_0xcd02('0x33')][_0xcd02('0x35')]));_0x705f9e[_0xcd02('0x34')]=_0x705f9e['attributes'][_0xcd02('0x36')]?_0x705f9e[_0xcd02('0x34')]:_0x52c370[_0xcd02('0x30')];if(!_0x5f1218[_0xcd02('0x33')][_0xcd02('0x37')](_0xcd02('0x38'))){_0x705f9e[_0xcd02('0x20')]=qs[_0xcd02('0x20')](_0x5f1218[_0xcd02('0x33')][_0xcd02('0x20')]);_0x705f9e['offset']=qs['offset'](_0x5f1218['query'][_0xcd02('0x1f')]);}_0x705f9e[_0xcd02('0x39')]=qs[_0xcd02('0x3a')](_0x5f1218['query']['sort']);_0x705f9e[_0xcd02('0x3b')]=qs['filters'](_['pick'](_0x5f1218[_0xcd02('0x33')],_0x52c370['filters']),_0x33cd06);if(_0x5f1218['query'][_0xcd02('0x3c')]){_0x705f9e[_0xcd02('0x3b')]=_['merge'](_0x705f9e[_0xcd02('0x3b')],{'$or':_['map'](_0x33cd06,function(_0x28eea8){if(_0x28eea8['type']!=='VIRTUAL'){var _0x5d43ca={};_0x5d43ca[_0x28eea8['name']]={'$like':'%'+_0x5f1218[_0xcd02('0x33')][_0xcd02('0x3c')]+'%'};return _0x5d43ca;}})});}_0x705f9e=_[_0xcd02('0x3d')]({},_0x705f9e,_0x5f1218[_0xcd02('0x3e')]);var _0x4839d3={'where':_0x705f9e[_0xcd02('0x3b')]};return db[_0xcd02('0x2c')][_0xcd02('0x21')](_0x4839d3)['then'](function(_0x162060){_0x41e171[_0xcd02('0x21')]=_0x162060;if(_0x5f1218['query']['includeAll']){_0x705f9e[_0xcd02('0x3f')]=[{'all':!![]}];}return db[_0xcd02('0x2c')]['findAll'](_0x705f9e);})[_0xcd02('0x40')](function(_0x2ac2e1){_0x41e171[_0xcd02('0x41')]=_0x2ac2e1;return _0x41e171;})['then'](respondWithFilteredResult(_0x3806a0,_0x705f9e))[_0xcd02('0x42')](handleError(_0x3806a0,null));};exports[_0xcd02('0x43')]=function(_0x4340d7,_0xe24950){var _0xada7ba={'raw':![],'where':{'id':_0x4340d7[_0xcd02('0x44')]['id']}},_0x4155e2={};_0x4155e2[_0xcd02('0x30')]=_[_0xcd02('0x45')](db['ZendeskConfiguration'][_0xcd02('0x2d')]);_0x4155e2[_0xcd02('0x33')]=_[_0xcd02('0x45')](_0x4340d7[_0xcd02('0x33')]);_0x4155e2[_0xcd02('0x31')]=_[_0xcd02('0x32')](_0x4155e2[_0xcd02('0x30')],_0x4155e2[_0xcd02('0x33')]);_0xada7ba[_0xcd02('0x34')]=_['intersection'](_0x4155e2[_0xcd02('0x30')],qs[_0xcd02('0x35')](_0x4340d7[_0xcd02('0x33')]['fields']));_0xada7ba[_0xcd02('0x34')]=_0xada7ba[_0xcd02('0x34')]['length']?_0xada7ba[_0xcd02('0x34')]:_0x4155e2['model'];if(_0x4340d7['query'][_0xcd02('0x46')]){_0xada7ba[_0xcd02('0x3f')]=[{'all':!![]}];}_0xada7ba=_[_0xcd02('0x3d')]({},_0xada7ba,_0x4340d7[_0xcd02('0x3e')]);return db['ZendeskConfiguration']['find'](_0xada7ba)['then'](handleEntityNotFound(_0xe24950,null))[_0xcd02('0x40')](respondWithResult(_0xe24950,null))[_0xcd02('0x42')](handleError(_0xe24950,null));};exports['create']=function(_0x666a98,_0x430f69){return db[_0xcd02('0x2c')][_0xcd02('0x47')](_0x666a98[_0xcd02('0x48')],{})[_0xcd02('0x40')](respondWithResult(_0x430f69,0xc9))[_0xcd02('0x42')](handleError(_0x430f69,null));};exports['update']=function(_0x40175c,_0x4ec6db){if(_0x40175c['body']['id']){delete _0x40175c[_0xcd02('0x48')]['id'];}return db[_0xcd02('0x2c')][_0xcd02('0x49')]({'where':{'id':_0x40175c[_0xcd02('0x44')]['id']}})[_0xcd02('0x40')](handleEntityNotFound(_0x4ec6db,null))[_0xcd02('0x40')](saveUpdates(_0x40175c[_0xcd02('0x48')],null))['then'](respondWithResult(_0x4ec6db,null))[_0xcd02('0x42')](handleError(_0x4ec6db,null));};exports[_0xcd02('0x26')]=function(_0x22f545,_0x123752){return db[_0xcd02('0x2c')][_0xcd02('0x49')]({'where':{'id':_0x22f545[_0xcd02('0x44')]['id']}})['then'](handleEntityNotFound(_0x123752,null))['then'](removeEntity(_0x123752,null))[_0xcd02('0x42')](handleError(_0x123752,null));};exports[_0xcd02('0x4a')]=function(_0x12de8c,_0x2c4be7,_0x14436f){var _0x239d85={};var _0x598277={};var _0x355078;var _0x2fff62;return db[_0xcd02('0x2c')]['findOne']({'where':{'id':_0x12de8c[_0xcd02('0x44')]['id']}})[_0xcd02('0x40')](handleEntityNotFound(_0x2c4be7,null))['then'](function(_0x58c3d0){if(_0x58c3d0){_0x355078=_0x58c3d0;_0x598277[_0xcd02('0x30')]=_[_0xcd02('0x45')](db[_0xcd02('0x4b')]['rawAttributes']);_0x598277[_0xcd02('0x33')]=_[_0xcd02('0x45')](_0x12de8c[_0xcd02('0x33')]);_0x598277[_0xcd02('0x31')]=_[_0xcd02('0x32')](_0x598277[_0xcd02('0x30')],_0x598277[_0xcd02('0x33')]);_0x239d85[_0xcd02('0x34')]=_[_0xcd02('0x32')](_0x598277[_0xcd02('0x30')],qs[_0xcd02('0x35')](_0x12de8c[_0xcd02('0x33')]['fields']));_0x239d85[_0xcd02('0x34')]=_0x239d85[_0xcd02('0x34')]['length']?_0x239d85[_0xcd02('0x34')]:_0x598277[_0xcd02('0x30')];_0x239d85[_0xcd02('0x39')]=qs[_0xcd02('0x3a')](_0x12de8c[_0xcd02('0x33')][_0xcd02('0x3a')]);_0x239d85[_0xcd02('0x3b')]=qs[_0xcd02('0x31')](_[_0xcd02('0x4c')](_0x12de8c[_0xcd02('0x33')],_0x598277[_0xcd02('0x31')]));if(_0x12de8c[_0xcd02('0x33')][_0xcd02('0x3c')]){_0x239d85['where']=_['merge'](_0x239d85[_0xcd02('0x3b')],{'$or':_[_0xcd02('0x2b')](_0x239d85[_0xcd02('0x34')],function(_0x53112f){var _0x4e684d={};_0x4e684d[_0x53112f]={'$like':'%'+_0x12de8c[_0xcd02('0x33')][_0xcd02('0x3c')]+'%'};return _0x4e684d;})});}_0x239d85=_[_0xcd02('0x3d')]({},_0x239d85,_0x12de8c[_0xcd02('0x3e')]);return _0x355078['getFields'](_0x239d85);}})[_0xcd02('0x40')](function(_0x340604){if(_0x340604){_0x2fff62=_0x340604[_0xcd02('0x36')];if(!_0x12de8c[_0xcd02('0x33')][_0xcd02('0x37')](_0xcd02('0x38'))){_0x239d85[_0xcd02('0x20')]=qs[_0xcd02('0x20')](_0x12de8c[_0xcd02('0x33')][_0xcd02('0x20')]);_0x239d85[_0xcd02('0x1f')]=qs[_0xcd02('0x1f')](_0x12de8c[_0xcd02('0x33')]['offset']);}return _0x355078[_0xcd02('0x4a')](_0x239d85);}})[_0xcd02('0x40')](function(_0x15530c){if(_0x15530c){return _0x15530c?{'count':_0x2fff62,'rows':_0x15530c}:null;}})[_0xcd02('0x40')](respondWithResult(_0x2c4be7,null))[_0xcd02('0x42')](handleError(_0x2c4be7,null));};exports['getSubjects']=function(_0x333fbf,_0x1bdd07,_0x477f4b){var _0x37fcf8={};var _0x221901={};var _0x3c0cef;var _0x3a531d;return db[_0xcd02('0x2c')][_0xcd02('0x4d')]({'where':{'id':_0x333fbf['params']['id']}})['then'](handleEntityNotFound(_0x1bdd07,null))[_0xcd02('0x40')](function(_0x562d74){if(_0x562d74){_0x3c0cef=_0x562d74;_0x221901[_0xcd02('0x30')]=_[_0xcd02('0x45')](db[_0xcd02('0x4b')][_0xcd02('0x2d')]);_0x221901[_0xcd02('0x33')]=_[_0xcd02('0x45')](_0x333fbf['query']);_0x221901[_0xcd02('0x31')]=_[_0xcd02('0x32')](_0x221901[_0xcd02('0x30')],_0x221901[_0xcd02('0x33')]);_0x37fcf8[_0xcd02('0x34')]=_[_0xcd02('0x32')](_0x221901[_0xcd02('0x30')],qs[_0xcd02('0x35')](_0x333fbf[_0xcd02('0x33')]['fields']));_0x37fcf8[_0xcd02('0x34')]=_0x37fcf8[_0xcd02('0x34')][_0xcd02('0x36')]?_0x37fcf8['attributes']:_0x221901[_0xcd02('0x30')];_0x37fcf8[_0xcd02('0x39')]=qs[_0xcd02('0x3a')](_0x333fbf['query'][_0xcd02('0x3a')]);_0x37fcf8['where']=qs[_0xcd02('0x31')](_[_0xcd02('0x4c')](_0x333fbf['query'],_0x221901['filters']));if(_0x333fbf[_0xcd02('0x33')][_0xcd02('0x3c')]){_0x37fcf8[_0xcd02('0x3b')]=_[_0xcd02('0x3d')](_0x37fcf8[_0xcd02('0x3b')],{'$or':_[_0xcd02('0x2b')](_0x37fcf8[_0xcd02('0x34')],function(_0x422927){var _0x4fbd28={};_0x4fbd28[_0x422927]={'$like':'%'+_0x333fbf[_0xcd02('0x33')][_0xcd02('0x3c')]+'%'};return _0x4fbd28;})});}_0x37fcf8=_['merge']({},_0x37fcf8,_0x333fbf['options']);return _0x3c0cef['getSubjects'](_0x37fcf8);}})['then'](function(_0x3eca22){if(_0x3eca22){_0x3a531d=_0x3eca22[_0xcd02('0x36')];if(!_0x333fbf[_0xcd02('0x33')][_0xcd02('0x37')](_0xcd02('0x38'))){_0x37fcf8[_0xcd02('0x20')]=qs[_0xcd02('0x20')](_0x333fbf[_0xcd02('0x33')][_0xcd02('0x20')]);_0x37fcf8[_0xcd02('0x1f')]=qs['offset'](_0x333fbf[_0xcd02('0x33')]['offset']);}return _0x3c0cef['getSubjects'](_0x37fcf8);}})[_0xcd02('0x40')](function(_0x8153b3){if(_0x8153b3){return _0x8153b3?{'count':_0x3a531d,'rows':_0x8153b3}:null;}})['then'](respondWithResult(_0x1bdd07,null))[_0xcd02('0x42')](handleError(_0x1bdd07,null));};exports[_0xcd02('0x4e')]=function(_0x1f6e82,_0x590184,_0x50e1cc){var _0x55bdb4={};var _0x1c6d75={};var _0x4961cc;var _0x31964e;return db[_0xcd02('0x2c')][_0xcd02('0x4d')]({'where':{'id':_0x1f6e82[_0xcd02('0x44')]['id']}})[_0xcd02('0x40')](handleEntityNotFound(_0x590184,null))[_0xcd02('0x40')](function(_0x3120b4){if(_0x3120b4){_0x4961cc=_0x3120b4;_0x1c6d75[_0xcd02('0x30')]=_['keys'](db[_0xcd02('0x4b')][_0xcd02('0x2d')]);_0x1c6d75[_0xcd02('0x33')]=_[_0xcd02('0x45')](_0x1f6e82[_0xcd02('0x33')]);_0x1c6d75['filters']=_[_0xcd02('0x32')](_0x1c6d75['model'],_0x1c6d75[_0xcd02('0x33')]);_0x55bdb4[_0xcd02('0x34')]=_['intersection'](_0x1c6d75[_0xcd02('0x30')],qs[_0xcd02('0x35')](_0x1f6e82[_0xcd02('0x33')][_0xcd02('0x35')]));_0x55bdb4[_0xcd02('0x34')]=_0x55bdb4[_0xcd02('0x34')][_0xcd02('0x36')]?_0x55bdb4[_0xcd02('0x34')]:_0x1c6d75[_0xcd02('0x30')];_0x55bdb4[_0xcd02('0x39')]=qs['sort'](_0x1f6e82['query'][_0xcd02('0x3a')]);_0x55bdb4[_0xcd02('0x3b')]=qs[_0xcd02('0x31')](_[_0xcd02('0x4c')](_0x1f6e82[_0xcd02('0x33')],_0x1c6d75['filters']));if(_0x1f6e82['query'][_0xcd02('0x3c')]){_0x55bdb4[_0xcd02('0x3b')]=_[_0xcd02('0x3d')](_0x55bdb4[_0xcd02('0x3b')],{'$or':_[_0xcd02('0x2b')](_0x55bdb4[_0xcd02('0x34')],function(_0x11f3ec){var _0x5ca910={};_0x5ca910[_0x11f3ec]={'$like':'%'+_0x1f6e82[_0xcd02('0x33')][_0xcd02('0x3c')]+'%'};return _0x5ca910;})});}_0x55bdb4=_[_0xcd02('0x3d')]({},_0x55bdb4,_0x1f6e82[_0xcd02('0x3e')]);return _0x4961cc[_0xcd02('0x4e')](_0x55bdb4);}})[_0xcd02('0x40')](function(_0x4372ca){if(_0x4372ca){_0x31964e=_0x4372ca[_0xcd02('0x36')];if(!_0x1f6e82[_0xcd02('0x33')][_0xcd02('0x37')](_0xcd02('0x38'))){_0x55bdb4[_0xcd02('0x20')]=qs[_0xcd02('0x20')](_0x1f6e82[_0xcd02('0x33')][_0xcd02('0x20')]);_0x55bdb4['offset']=qs[_0xcd02('0x1f')](_0x1f6e82[_0xcd02('0x33')][_0xcd02('0x1f')]);}return _0x4961cc[_0xcd02('0x4e')](_0x55bdb4);}})[_0xcd02('0x40')](function(_0x355c61){if(_0x355c61){return _0x355c61?{'count':_0x31964e,'rows':_0x355c61}:null;}})[_0xcd02('0x40')](respondWithResult(_0x590184,null))[_0xcd02('0x42')](handleError(_0x590184,null));};exports['getTags']=function(_0x437c0b,_0x2c588e,_0x5ad759){var _0x200d98={};var _0x79ed44={};var _0x166415;var _0x531e28;return db[_0xcd02('0x2c')][_0xcd02('0x4d')]({'where':{'id':_0x437c0b[_0xcd02('0x44')]['id']}})[_0xcd02('0x40')](handleEntityNotFound(_0x2c588e,null))['then'](function(_0x26daf6){if(_0x26daf6){_0x166415=_0x26daf6;_0x79ed44['model']=_[_0xcd02('0x45')](db['Tag'][_0xcd02('0x2d')]);_0x79ed44[_0xcd02('0x33')]=_[_0xcd02('0x45')](_0x437c0b[_0xcd02('0x33')]);_0x79ed44[_0xcd02('0x31')]=_['intersection'](_0x79ed44[_0xcd02('0x30')],_0x79ed44[_0xcd02('0x33')]);_0x200d98['attributes']=_['intersection'](_0x79ed44[_0xcd02('0x30')],qs['fields'](_0x437c0b[_0xcd02('0x33')][_0xcd02('0x35')]));_0x200d98[_0xcd02('0x34')]=_0x200d98[_0xcd02('0x34')][_0xcd02('0x36')]?_0x200d98['attributes']:_0x79ed44['model'];_0x200d98['order']=qs['sort'](_0x437c0b[_0xcd02('0x33')]['sort']);_0x200d98[_0xcd02('0x3b')]=qs[_0xcd02('0x31')](_[_0xcd02('0x4c')](_0x437c0b[_0xcd02('0x33')],_0x79ed44[_0xcd02('0x31')]));if(_0x437c0b[_0xcd02('0x33')][_0xcd02('0x3c')]){_0x200d98['where']=_[_0xcd02('0x3d')](_0x200d98[_0xcd02('0x3b')],{'$or':_[_0xcd02('0x2b')](_0x200d98[_0xcd02('0x34')],function(_0x359597){var _0x5a179e={};_0x5a179e[_0x359597]={'$like':'%'+_0x437c0b[_0xcd02('0x33')]['filter']+'%'};return _0x5a179e;})});}_0x200d98=_['merge']({},_0x200d98,_0x437c0b[_0xcd02('0x3e')]);return _0x166415[_0xcd02('0x4f')](_0x200d98);}})[_0xcd02('0x40')](function(_0x4f3590){if(_0x4f3590){_0x531e28=_0x4f3590[_0xcd02('0x36')];if(!_0x437c0b[_0xcd02('0x33')]['hasOwnProperty'](_0xcd02('0x38'))){_0x200d98['limit']=qs[_0xcd02('0x20')](_0x437c0b[_0xcd02('0x33')]['limit']);_0x200d98[_0xcd02('0x1f')]=qs[_0xcd02('0x1f')](_0x437c0b[_0xcd02('0x33')][_0xcd02('0x1f')]);}return _0x166415['getTags'](_0x200d98);}})[_0xcd02('0x40')](function(_0x4f6537){if(_0x4f6537){return _0x4f6537?{'count':_0x531e28,'rows':_0x4f6537}:null;}})['then'](respondWithResult(_0x2c588e,null))['catch'](handleError(_0x2c588e,null));};exports[_0xcd02('0x50')]=function(_0x59debf,_0x34b9df,_0x592fb6){if(_0x59debf[_0xcd02('0x48')]['id']){delete _0x59debf[_0xcd02('0x48')]['id'];}return db[_0xcd02('0x2c')][_0xcd02('0x4d')]({'where':{'id':_0x59debf[_0xcd02('0x44')]['id']}})[_0xcd02('0x40')](handleEntityNotFound(_0x34b9df,null))[_0xcd02('0x40')](function(_0x57d77c){if(_0x57d77c){return _0x57d77c['setTags'](_0x59debf[_0xcd02('0x48')][_0xcd02('0x51')]||[]);}return null;})[_0xcd02('0x40')](respondWithResult(_0x34b9df,null))[_0xcd02('0x42')](handleError(_0x34b9df,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index a339ad5..37a56a8 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 _0x9348=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x17d3fc,_0x4c5f0d){var _0x47fcd0=function(_0x56241f){while(--_0x56241f){_0x17d3fc['push'](_0x17d3fc['shift']());}};_0x47fcd0(++_0x4c5f0d);}(_0x9348,0x10d));var _0x8934=function(_0x546869,_0x52b42d){_0x546869=_0x546869-0x0;var _0x74b2e3=_0x9348[_0x546869];return _0x74b2e3;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x3de3,0x1ce));var _0x33de=function(_0x4b9d74,_0x1e6348){_0x4b9d74=_0x4b9d74-0x0;var _0x55de5e=_0x3de3[_0x4b9d74];return _0x55de5e;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index de0b74a..074b608 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 _0x5f33=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5125f0,_0x5b53d9){var _0x234a90=function(_0x17d97f){while(--_0x17d97f){_0x5125f0['push'](_0x5125f0['shift']());}};_0x234a90(++_0x5b53d9);}(_0x5f33,0x124));var _0x35f3=function(_0x1624aa,_0x48d127){_0x1624aa=_0x1624aa-0x0;var _0x28bef6=_0x5f33[_0x1624aa];return _0x28bef6;};'use strict';var _=require(_0x35f3('0x0'));var util=require(_0x35f3('0x1'));var moment=require('moment');var BPromise=require(_0x35f3('0x2'));var rs=require(_0x35f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35f3('0x5'));var config=require(_0x35f3('0x6'));var jayson=require(_0x35f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7df4,_0x29c287,_0x4e4c73){return new BPromise(function(_0x24e4da,_0x4a159e){return client[_0x35f3('0x8')](_0x4c7df4,_0x4e4c73)['then'](function(_0x14e1b3){logger[_0x35f3('0x9')](_0x35f3('0xa'),_0x29c287,_0x35f3('0xb'));logger[_0x35f3('0xc')](_0x35f3('0xd'),_0x29c287,_0x35f3('0xb'),JSON['stringify'](_0x14e1b3));if(_0x14e1b3['error']){if(_0x14e1b3['error'][_0x35f3('0xe')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x29c287,_0x14e1b3[_0x35f3('0xf')][_0x35f3('0x10')]);return _0x4a159e(_0x14e1b3[_0x35f3('0xf')][_0x35f3('0x10')]);}logger[_0x35f3('0xf')](_0x35f3('0xa'),_0x29c287,_0x14e1b3['error'][_0x35f3('0x10')]);return _0x24e4da(_0x14e1b3[_0x35f3('0xf')][_0x35f3('0x10')]);}else{logger[_0x35f3('0x9')](_0x35f3('0xa'),_0x29c287,_0x35f3('0xb'));_0x24e4da(_0x14e1b3[_0x35f3('0x11')]['message']);}})[_0x35f3('0x12')](function(_0x37695b){logger['error'](_0x35f3('0xa'),_0x29c287,_0x37695b);_0x4a159e(_0x37695b);});});} \ No newline at end of file +var _0x44e9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x44e9,0x196));var _0x944e=function(_0x1f2c07,_0x554d50){_0x1f2c07=_0x1f2c07-0x0;var _0x5ab317=_0x44e9[_0x1f2c07];return _0x5ab317;};'use strict';var _=require(_0x944e('0x0'));var util=require(_0x944e('0x1'));var moment=require('moment');var BPromise=require(_0x944e('0x2'));var rs=require(_0x944e('0x3'));var fs=require('fs');var Redis=require(_0x944e('0x4'));var db=require(_0x944e('0x5'))['db'];var utils=require(_0x944e('0x6'));var logger=require(_0x944e('0x7'))(_0x944e('0x8'));var config=require(_0x944e('0x9'));var jayson=require(_0x944e('0xa'));var client=jayson['client'][_0x944e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b8b25,_0x519445,_0x327bc8){return new BPromise(function(_0x36b3fc,_0x180a90){return client[_0x944e('0xc')](_0x2b8b25,_0x327bc8)[_0x944e('0xd')](function(_0xa1ec4c){logger[_0x944e('0xe')](_0x944e('0xf'),_0x519445,_0x944e('0x10'));logger[_0x944e('0x11')](_0x944e('0x12'),_0x519445,_0x944e('0x10'),JSON[_0x944e('0x13')](_0xa1ec4c));if(_0xa1ec4c[_0x944e('0x14')]){if(_0xa1ec4c['error'][_0x944e('0x15')]===0x1f4){logger[_0x944e('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x519445,_0xa1ec4c[_0x944e('0x14')]['message']);return _0x180a90(_0xa1ec4c[_0x944e('0x14')][_0x944e('0x16')]);}logger[_0x944e('0x14')](_0x944e('0xf'),_0x519445,_0xa1ec4c['error'][_0x944e('0x16')]);return _0x36b3fc(_0xa1ec4c[_0x944e('0x14')][_0x944e('0x16')]);}else{logger[_0x944e('0xe')](_0x944e('0xf'),_0x519445,_0x944e('0x10'));_0x36b3fc(_0xa1ec4c['result'][_0x944e('0x16')]);}})[_0x944e('0x17')](function(_0x4256e7){logger[_0x944e('0x14')](_0x944e('0xf'),_0x519445,_0x4256e7);_0x180a90(_0x4256e7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 89dd1c1..b377d50 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 _0x7bcb=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','show','post'];(function(_0x2caf46,_0x4f5cdf){var _0x20676e=function(_0x3b0af0){while(--_0x3b0af0){_0x2caf46['push'](_0x2caf46['shift']());}};_0x20676e(++_0x4f5cdf);}(_0x7bcb,0xb7));var _0xb7bc=function(_0x30d9b5,_0x39b36d){_0x30d9b5=_0x30d9b5-0x0;var _0x4429af=_0x7bcb[_0x30d9b5];return _0x4429af;};'use strict';var multer=require(_0xb7bc('0x0'));var util=require(_0xb7bc('0x1'));var path=require(_0xb7bc('0x2'));var timeout=require(_0xb7bc('0x3'));var express=require(_0xb7bc('0x4'));var router=express['Router']();var fs_extra=require(_0xb7bc('0x5'));var auth=require(_0xb7bc('0x6'));var interaction=require(_0xb7bc('0x7'));var config=require(_0xb7bc('0x8'));var controller=require(_0xb7bc('0x9'));router[_0xb7bc('0xa')]('/',auth['isAuthenticated'](),controller[_0xb7bc('0xb')]);router['get'](_0xb7bc('0xc'),auth['isAuthenticated'](),controller[_0xb7bc('0xd')]);router[_0xb7bc('0xe')]('/',auth['isAuthenticated'](),controller[_0xb7bc('0xf')]);router[_0xb7bc('0x10')](_0xb7bc('0xc'),auth[_0xb7bc('0x11')](),controller[_0xb7bc('0x12')]);router[_0xb7bc('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb7bc('0x14')]);module[_0xb7bc('0x15')]=router; \ No newline at end of file +var _0x772a=['update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x5dd072,_0x3fecef){var _0x556d18=function(_0x163778){while(--_0x163778){_0x5dd072['push'](_0x5dd072['shift']());}};_0x556d18(++_0x3fecef);}(_0x772a,0xc3));var _0xa772=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x772a[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa772('0x0'));var timeout=require(_0xa772('0x1'));var express=require(_0xa772('0x2'));var router=express[_0xa772('0x3')]();var fs_extra=require(_0xa772('0x4'));var auth=require(_0xa772('0x5'));var interaction=require(_0xa772('0x6'));var config=require(_0xa772('0x7'));var controller=require('./intZendeskField.controller');router[_0xa772('0x8')]('/',auth[_0xa772('0x9')](),controller[_0xa772('0xa')]);router[_0xa772('0x8')](_0xa772('0xb'),auth[_0xa772('0x9')](),controller[_0xa772('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa772('0xb'),auth[_0xa772('0x9')](),controller[_0xa772('0xd')]);router[_0xa772('0xe')](_0xa772('0xb'),auth[_0xa772('0x9')](),controller['destroy']);module[_0xa772('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c40c93c..f1ee449 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 _0x155d=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x38da4d,_0x2e0982){var _0xbed138=function(_0xf8feee){while(--_0xf8feee){_0x38da4d['push'](_0x38da4d['shift']());}};_0xbed138(++_0x2e0982);}(_0x155d,0xa3));var _0xd155=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x155d[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd155('0x0')](_0xd155('0x1'),_0xd155('0x2'),_0xd155('0x3'),_0xd155('0x4'),_0xd155('0x5')),'defaultValue':_0xd155('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd155('0x6')]},'keyType':{'type':Sequelize[_0xd155('0x0')](_0xd155('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd155('0x6')]},'idField':{'type':Sequelize[_0xd155('0x6')]},'nameField':{'type':Sequelize[_0xd155('0x6')]},'customField':{'type':Sequelize[_0xd155('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd155('0x6')]}}; \ No newline at end of file +var _0x6aaf=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x59c029,_0x22466c){var _0x17df29=function(_0x3f3192){while(--_0x3f3192){_0x59c029['push'](_0x59c029['shift']());}};_0x17df29(++_0x22466c);}(_0x6aaf,0x1ad));var _0xf6aa=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0x6aaf[_0x27fedb];return _0x58ab78;};'use strict';var Sequelize=require('sequelize');module[_0xf6aa('0x0')]={'type':{'type':Sequelize[_0xf6aa('0x1')](_0xf6aa('0x2'),_0xf6aa('0x3'),_0xf6aa('0x4'),_0xf6aa('0x5'),'picklist'),'defaultValue':_0xf6aa('0x2')},'content':{'type':Sequelize[_0xf6aa('0x6')]},'key':{'type':Sequelize[_0xf6aa('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf6aa('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf6aa('0x6')]},'idField':{'type':Sequelize[_0xf6aa('0x6')]},'nameField':{'type':Sequelize[_0xf6aa('0x6')]},'customField':{'type':Sequelize[_0xf6aa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf6aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8e93163..5e3cf7c 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 _0xf443=['bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','rimraf','request-promise','moment'];(function(_0x55e4e1,_0x352a79){var _0x1644e8=function(_0x4a2446){while(--_0x4a2446){_0x55e4e1['push'](_0x55e4e1['shift']());}};_0x1644e8(++_0x352a79);}(_0xf443,0xda));var _0x3f44=function(_0x4babf5,_0x13f305){_0x4babf5=_0x4babf5-0x0;var _0x24c40a=_0xf443[_0x4babf5];return _0x24c40a;};'use strict';var emlformat=require(_0x3f44('0x0'));var rimraf=require(_0x3f44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f44('0x2'));var moment=require(_0x3f44('0x3'));var BPromise=require(_0x3f44('0x4'));var Mustache=require(_0x3f44('0x5'));var util=require(_0x3f44('0x6'));var path=require(_0x3f44('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f44('0x8'));var _=require('lodash');var squel=require(_0x3f44('0x9'));var crypto=require(_0x3f44('0xa'));var jsforce=require(_0x3f44('0xb'));var deskjs=require(_0x3f44('0xc'));var toCsv=require(_0x3f44('0xd'));var querystring=require(_0x3f44('0xe'));var Papa=require(_0x3f44('0xf'));var Redis=require(_0x3f44('0x10'));var authService=require(_0x3f44('0x11'));var qs=require(_0x3f44('0x12'));var as=require(_0x3f44('0x13'));var hardwareService=require(_0x3f44('0x14'));var logger=require(_0x3f44('0x15'))(_0x3f44('0x16'));var utils=require(_0x3f44('0x17'));var config=require(_0x3f44('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f44('0x19'))['db'];function respondWithStatusCode(_0x66c684,_0x5a5d0c){_0x5a5d0c=_0x5a5d0c||0xcc;return function(_0x800ef3){if(_0x800ef3){return _0x66c684[_0x3f44('0x1a')](_0x5a5d0c);}return _0x66c684[_0x3f44('0x1b')](_0x5a5d0c)[_0x3f44('0x1c')]();};}function respondWithResult(_0x34aa51,_0x2f0c9d){_0x2f0c9d=_0x2f0c9d||0xc8;return function(_0x153d0d){if(_0x153d0d){return _0x34aa51[_0x3f44('0x1b')](_0x2f0c9d)[_0x3f44('0x1d')](_0x153d0d);}};}function respondWithFilteredResult(_0x228fc2,_0x1d1249){return function(_0x524a53){if(_0x524a53){var _0x79c6d2=typeof _0x1d1249[_0x3f44('0x1e')]===_0x3f44('0x1f')&&typeof _0x1d1249[_0x3f44('0x20')]===_0x3f44('0x1f');var _0x511d55=_0x524a53[_0x3f44('0x21')];var _0x3f032d=_0x79c6d2?0x0:_0x1d1249['offset'];var _0x2f406f=_0x79c6d2?_0x524a53[_0x3f44('0x21')]:_0x1d1249['offset']+_0x1d1249[_0x3f44('0x20')];var _0x1a9503;if(_0x2f406f>=_0x511d55){_0x2f406f=_0x511d55;_0x1a9503=0xc8;}else{_0x1a9503=0xce;}_0x228fc2[_0x3f44('0x1b')](_0x1a9503);return _0x228fc2[_0x3f44('0x22')]('Content-Range',_0x3f032d+'-'+_0x2f406f+'/'+_0x511d55)['json'](_0x524a53);}return null;};}function patchUpdates(_0x581850){return function(_0x2b8939){try{jsonpatch['apply'](_0x2b8939,_0x581850,!![]);}catch(_0x58b530){return BPromise[_0x3f44('0x23')](_0x58b530);}return _0x2b8939[_0x3f44('0x24')]();};}function saveUpdates(_0x526338,_0x30f586){return function(_0x13f92f){if(_0x13f92f){return _0x13f92f['update'](_0x526338)[_0x3f44('0x25')](function(_0x3cfc87){return _0x3cfc87;});}return null;};}function removeEntity(_0x336d7a,_0x2fbb9a){return function(_0x17e138){if(_0x17e138){return _0x17e138[_0x3f44('0x26')]()[_0x3f44('0x25')](function(){_0x336d7a[_0x3f44('0x1b')](0xcc)[_0x3f44('0x1c')]();});}};}function handleEntityNotFound(_0x3debc6,_0x47ad7c){return function(_0x5c61df){if(!_0x5c61df){_0x3debc6[_0x3f44('0x1a')](0x194);}return _0x5c61df;};}function handleError(_0x373024,_0x4a13aa){_0x4a13aa=_0x4a13aa||0x1f4;return function(_0x1c01e5){logger[_0x3f44('0x27')](_0x1c01e5['stack']);if(_0x1c01e5[_0x3f44('0x28')]){delete _0x1c01e5[_0x3f44('0x28')];}_0x373024[_0x3f44('0x1b')](_0x4a13aa)['send'](_0x1c01e5);};}exports[_0x3f44('0x29')]=function(_0x551af0,_0x27387b){var _0x1dc529={},_0x9c3861={},_0x27110e={'count':0x0,'rows':[]};var _0x90fcd0=_[_0x3f44('0x2a')](db[_0x3f44('0x2b')][_0x3f44('0x2c')],function(_0x37ad1a){return{'name':_0x37ad1a[_0x3f44('0x2d')],'type':_0x37ad1a[_0x3f44('0x2e')]['key']};});_0x9c3861[_0x3f44('0x2f')]=_['map'](_0x90fcd0,'name');_0x9c3861[_0x3f44('0x30')]=_[_0x3f44('0x31')](_0x551af0[_0x3f44('0x30')]);_0x9c3861['filters']=_[_0x3f44('0x32')](_0x9c3861[_0x3f44('0x2f')],_0x9c3861['query']);_0x1dc529[_0x3f44('0x33')]=_[_0x3f44('0x32')](_0x9c3861[_0x3f44('0x2f')],qs[_0x3f44('0x34')](_0x551af0[_0x3f44('0x30')][_0x3f44('0x34')]));_0x1dc529[_0x3f44('0x33')]=_0x1dc529['attributes']['length']?_0x1dc529[_0x3f44('0x33')]:_0x9c3861[_0x3f44('0x2f')];if(!_0x551af0['query'][_0x3f44('0x35')](_0x3f44('0x36'))){_0x1dc529[_0x3f44('0x20')]=qs[_0x3f44('0x20')](_0x551af0[_0x3f44('0x30')]['limit']);_0x1dc529[_0x3f44('0x1e')]=qs['offset'](_0x551af0[_0x3f44('0x30')]['offset']);}_0x1dc529[_0x3f44('0x37')]=qs[_0x3f44('0x38')](_0x551af0['query']['sort']);_0x1dc529['where']=qs[_0x3f44('0x39')](_['pick'](_0x551af0['query'],_0x9c3861['filters']),_0x90fcd0);if(_0x551af0[_0x3f44('0x30')]['filter']){_0x1dc529[_0x3f44('0x3a')]=_['merge'](_0x1dc529['where'],{'$or':_['map'](_0x90fcd0,function(_0x370e8d){if(_0x370e8d[_0x3f44('0x2e')]!==_0x3f44('0x3b')){var _0x59f73b={};_0x59f73b[_0x370e8d[_0x3f44('0x28')]]={'$like':'%'+_0x551af0[_0x3f44('0x30')][_0x3f44('0x3c')]+'%'};return _0x59f73b;}})});}_0x1dc529=_[_0x3f44('0x3d')]({},_0x1dc529,_0x551af0[_0x3f44('0x3e')]);var _0x100d89={'where':_0x1dc529[_0x3f44('0x3a')]};return db[_0x3f44('0x2b')]['count'](_0x100d89)[_0x3f44('0x25')](function(_0x5129ae){_0x27110e[_0x3f44('0x21')]=_0x5129ae;if(_0x551af0[_0x3f44('0x30')][_0x3f44('0x3f')]){_0x1dc529[_0x3f44('0x40')]=[{'all':!![]}];}return db[_0x3f44('0x2b')][_0x3f44('0x41')](_0x1dc529);})[_0x3f44('0x25')](function(_0x3ef9e7){_0x27110e[_0x3f44('0x42')]=_0x3ef9e7;return _0x27110e;})['then'](respondWithFilteredResult(_0x27387b,_0x1dc529))[_0x3f44('0x43')](handleError(_0x27387b,null));};exports['show']=function(_0x3b0233,_0x39beaa){var _0x3c10bd={'raw':!![],'where':{'id':_0x3b0233[_0x3f44('0x44')]['id']}},_0xa1fba2={};_0xa1fba2[_0x3f44('0x2f')]=_[_0x3f44('0x31')](db[_0x3f44('0x2b')][_0x3f44('0x2c')]);_0xa1fba2['query']=_[_0x3f44('0x31')](_0x3b0233[_0x3f44('0x30')]);_0xa1fba2[_0x3f44('0x39')]=_['intersection'](_0xa1fba2['model'],_0xa1fba2[_0x3f44('0x30')]);_0x3c10bd[_0x3f44('0x33')]=_['intersection'](_0xa1fba2[_0x3f44('0x2f')],qs[_0x3f44('0x34')](_0x3b0233[_0x3f44('0x30')][_0x3f44('0x34')]));_0x3c10bd[_0x3f44('0x33')]=_0x3c10bd[_0x3f44('0x33')][_0x3f44('0x45')]?_0x3c10bd['attributes']:_0xa1fba2[_0x3f44('0x2f')];if(_0x3b0233['query'][_0x3f44('0x3f')]){_0x3c10bd[_0x3f44('0x40')]=[{'all':!![]}];}_0x3c10bd=_['merge']({},_0x3c10bd,_0x3b0233[_0x3f44('0x3e')]);return db[_0x3f44('0x2b')][_0x3f44('0x46')](_0x3c10bd)['then'](handleEntityNotFound(_0x39beaa,null))[_0x3f44('0x25')](respondWithResult(_0x39beaa,null))[_0x3f44('0x43')](handleError(_0x39beaa,null));};exports[_0x3f44('0x47')]=function(_0x1d3217,_0x55601a){return db[_0x3f44('0x2b')][_0x3f44('0x47')](_0x1d3217[_0x3f44('0x48')],{})[_0x3f44('0x25')](respondWithResult(_0x55601a,0xc9))[_0x3f44('0x43')](handleError(_0x55601a,null));};exports[_0x3f44('0x49')]=function(_0x201ce3,_0x3761f1){if(_0x201ce3[_0x3f44('0x48')]['id']){delete _0x201ce3[_0x3f44('0x48')]['id'];}return db['ZendeskField'][_0x3f44('0x46')]({'where':{'id':_0x201ce3[_0x3f44('0x44')]['id']}})[_0x3f44('0x25')](handleEntityNotFound(_0x3761f1,null))[_0x3f44('0x25')](saveUpdates(_0x201ce3['body'],null))[_0x3f44('0x25')](respondWithResult(_0x3761f1,null))[_0x3f44('0x43')](handleError(_0x3761f1,null));};exports['destroy']=function(_0x2dd003,_0x5a9e2f){return db['ZendeskField']['find']({'where':{'id':_0x2dd003['params']['id']}})[_0x3f44('0x25')](handleEntityNotFound(_0x5a9e2f,null))[_0x3f44('0x25')](removeEntity(_0x5a9e2f,null))[_0x3f44('0x43')](handleError(_0x5a9e2f,null));}; \ No newline at end of file +var _0xb248=['../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x22d736,_0x23bae0){var _0xdc782f=function(_0x375c18){while(--_0x375c18){_0x22d736['push'](_0x22d736['shift']());}};_0xdc782f(++_0x23bae0);}(_0xb248,0xc6));var _0x8b24=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb248[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];function respondWithStatusCode(_0x3d3450,_0x40c1e6){_0x40c1e6=_0x40c1e6||0xcc;return function(_0x40ea49){if(_0x40ea49){return _0x3d3450['sendStatus'](_0x40c1e6);}return _0x3d3450['status'](_0x40c1e6)[_0x8b24('0x19')]();};}function respondWithResult(_0x4433c0,_0xf92148){_0xf92148=_0xf92148||0xc8;return function(_0x32a451){if(_0x32a451){return _0x4433c0[_0x8b24('0x1a')](_0xf92148)[_0x8b24('0x1b')](_0x32a451);}};}function respondWithFilteredResult(_0x11d2ee,_0x3cd934){return function(_0x4e66ae){if(_0x4e66ae){var _0x5a5745=typeof _0x3cd934['offset']===_0x8b24('0x1c')&&typeof _0x3cd934['limit']==='undefined';var _0xafc423=_0x4e66ae[_0x8b24('0x1d')];var _0x527af7=_0x5a5745?0x0:_0x3cd934[_0x8b24('0x1e')];var _0x5e3c52=_0x5a5745?_0x4e66ae[_0x8b24('0x1d')]:_0x3cd934['offset']+_0x3cd934[_0x8b24('0x1f')];var _0x521f5c;if(_0x5e3c52>=_0xafc423){_0x5e3c52=_0xafc423;_0x521f5c=0xc8;}else{_0x521f5c=0xce;}_0x11d2ee[_0x8b24('0x1a')](_0x521f5c);return _0x11d2ee[_0x8b24('0x20')](_0x8b24('0x21'),_0x527af7+'-'+_0x5e3c52+'/'+_0xafc423)[_0x8b24('0x1b')](_0x4e66ae);}return null;};}function patchUpdates(_0x2a4f2d){return function(_0x44aae9){try{jsonpatch[_0x8b24('0x22')](_0x44aae9,_0x2a4f2d,!![]);}catch(_0x5c9c38){return BPromise[_0x8b24('0x23')](_0x5c9c38);}return _0x44aae9[_0x8b24('0x24')]();};}function saveUpdates(_0x4fff3c,_0xd9b96){return function(_0x13dd68){if(_0x13dd68){return _0x13dd68[_0x8b24('0x25')](_0x4fff3c)[_0x8b24('0x26')](function(_0x12a9f4){return _0x12a9f4;});}return null;};}function removeEntity(_0x10b721,_0x347591){return function(_0x3fddf8){if(_0x3fddf8){return _0x3fddf8[_0x8b24('0x27')]()[_0x8b24('0x26')](function(){_0x10b721[_0x8b24('0x1a')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x2cfb27,_0x3d541e){return function(_0x19600a){if(!_0x19600a){_0x2cfb27[_0x8b24('0x28')](0x194);}return _0x19600a;};}function handleError(_0x1fe79f,_0x1a62e9){_0x1a62e9=_0x1a62e9||0x1f4;return function(_0x44ee85){logger[_0x8b24('0x29')](_0x44ee85[_0x8b24('0x2a')]);if(_0x44ee85[_0x8b24('0x2b')]){delete _0x44ee85[_0x8b24('0x2b')];}_0x1fe79f[_0x8b24('0x1a')](_0x1a62e9)[_0x8b24('0x2c')](_0x44ee85);};}exports[_0x8b24('0x2d')]=function(_0x267f1e,_0x140a50){var _0x5d3958={},_0x36ff89={},_0x59d6e1={'count':0x0,'rows':[]};var _0xadbba0=_[_0x8b24('0x2e')](db[_0x8b24('0x2f')][_0x8b24('0x30')],function(_0x1ab949){return{'name':_0x1ab949['fieldName'],'type':_0x1ab949[_0x8b24('0x31')][_0x8b24('0x32')]};});_0x36ff89[_0x8b24('0x33')]=_['map'](_0xadbba0,'name');_0x36ff89['query']=_[_0x8b24('0x34')](_0x267f1e[_0x8b24('0x35')]);_0x36ff89[_0x8b24('0x36')]=_[_0x8b24('0x37')](_0x36ff89[_0x8b24('0x33')],_0x36ff89[_0x8b24('0x35')]);_0x5d3958[_0x8b24('0x38')]=_[_0x8b24('0x37')](_0x36ff89[_0x8b24('0x33')],qs['fields'](_0x267f1e[_0x8b24('0x35')][_0x8b24('0x39')]));_0x5d3958[_0x8b24('0x38')]=_0x5d3958['attributes'][_0x8b24('0x3a')]?_0x5d3958[_0x8b24('0x38')]:_0x36ff89[_0x8b24('0x33')];if(!_0x267f1e[_0x8b24('0x35')][_0x8b24('0x3b')](_0x8b24('0x3c'))){_0x5d3958[_0x8b24('0x1f')]=qs[_0x8b24('0x1f')](_0x267f1e[_0x8b24('0x35')]['limit']);_0x5d3958[_0x8b24('0x1e')]=qs[_0x8b24('0x1e')](_0x267f1e['query'][_0x8b24('0x1e')]);}_0x5d3958[_0x8b24('0x3d')]=qs['sort'](_0x267f1e[_0x8b24('0x35')][_0x8b24('0x3e')]);_0x5d3958[_0x8b24('0x3f')]=qs[_0x8b24('0x36')](_['pick'](_0x267f1e[_0x8b24('0x35')],_0x36ff89[_0x8b24('0x36')]),_0xadbba0);if(_0x267f1e[_0x8b24('0x35')][_0x8b24('0x40')]){_0x5d3958[_0x8b24('0x3f')]=_[_0x8b24('0x41')](_0x5d3958['where'],{'$or':_[_0x8b24('0x2e')](_0xadbba0,function(_0x30ef3e){if(_0x30ef3e[_0x8b24('0x31')]!==_0x8b24('0x42')){var _0x223faa={};_0x223faa[_0x30ef3e[_0x8b24('0x2b')]]={'$like':'%'+_0x267f1e[_0x8b24('0x35')][_0x8b24('0x40')]+'%'};return _0x223faa;}})});}_0x5d3958=_[_0x8b24('0x41')]({},_0x5d3958,_0x267f1e[_0x8b24('0x43')]);var _0x24f0d6={'where':_0x5d3958['where']};return db[_0x8b24('0x2f')]['count'](_0x24f0d6)[_0x8b24('0x26')](function(_0x6db741){_0x59d6e1[_0x8b24('0x1d')]=_0x6db741;if(_0x267f1e['query'][_0x8b24('0x44')]){_0x5d3958[_0x8b24('0x45')]=[{'all':!![]}];}return db[_0x8b24('0x2f')]['findAll'](_0x5d3958);})[_0x8b24('0x26')](function(_0x4f8da5){_0x59d6e1['rows']=_0x4f8da5;return _0x59d6e1;})[_0x8b24('0x26')](respondWithFilteredResult(_0x140a50,_0x5d3958))['catch'](handleError(_0x140a50,null));};exports['show']=function(_0x32d752,_0xd3f68){var _0x3ee117={'raw':!![],'where':{'id':_0x32d752[_0x8b24('0x46')]['id']}},_0x3c6dc2={};_0x3c6dc2[_0x8b24('0x33')]=_[_0x8b24('0x34')](db['ZendeskField']['rawAttributes']);_0x3c6dc2[_0x8b24('0x35')]=_[_0x8b24('0x34')](_0x32d752[_0x8b24('0x35')]);_0x3c6dc2[_0x8b24('0x36')]=_['intersection'](_0x3c6dc2[_0x8b24('0x33')],_0x3c6dc2[_0x8b24('0x35')]);_0x3ee117[_0x8b24('0x38')]=_['intersection'](_0x3c6dc2[_0x8b24('0x33')],qs['fields'](_0x32d752[_0x8b24('0x35')][_0x8b24('0x39')]));_0x3ee117['attributes']=_0x3ee117[_0x8b24('0x38')][_0x8b24('0x3a')]?_0x3ee117[_0x8b24('0x38')]:_0x3c6dc2[_0x8b24('0x33')];if(_0x32d752[_0x8b24('0x35')][_0x8b24('0x44')]){_0x3ee117[_0x8b24('0x45')]=[{'all':!![]}];}_0x3ee117=_[_0x8b24('0x41')]({},_0x3ee117,_0x32d752[_0x8b24('0x43')]);return db[_0x8b24('0x2f')][_0x8b24('0x47')](_0x3ee117)[_0x8b24('0x26')](handleEntityNotFound(_0xd3f68,null))['then'](respondWithResult(_0xd3f68,null))[_0x8b24('0x48')](handleError(_0xd3f68,null));};exports['create']=function(_0x245a02,_0x43cd46){return db['ZendeskField']['create'](_0x245a02[_0x8b24('0x49')],{})[_0x8b24('0x26')](respondWithResult(_0x43cd46,0xc9))[_0x8b24('0x48')](handleError(_0x43cd46,null));};exports[_0x8b24('0x25')]=function(_0x407b2f,_0x22619e){if(_0x407b2f[_0x8b24('0x49')]['id']){delete _0x407b2f[_0x8b24('0x49')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x407b2f['params']['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x22619e,null))['then'](saveUpdates(_0x407b2f[_0x8b24('0x49')],null))[_0x8b24('0x26')](respondWithResult(_0x22619e,null))[_0x8b24('0x48')](handleError(_0x22619e,null));};exports[_0x8b24('0x27')]=function(_0x58a26d,_0x3bc90a){return db[_0x8b24('0x2f')][_0x8b24('0x47')]({'where':{'id':_0x58a26d[_0x8b24('0x46')]['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x3bc90a,null))[_0x8b24('0x26')](removeEntity(_0x3bc90a,null))[_0x8b24('0x48')](handleError(_0x3bc90a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a98e7d0..3adaef6 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 _0x050b=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x240e23,_0x4e2b86){var _0x1a7272=function(_0x5ccdc1){while(--_0x5ccdc1){_0x240e23['push'](_0x240e23['shift']());}};_0x1a7272(++_0x4e2b86);}(_0x050b,0xb1));var _0xb050=function(_0x3284c0,_0x3605ed){_0x3284c0=_0x3284c0-0x0;var _0x47bef3=_0x050b[_0x3284c0];return _0x47bef3;};'use strict';var _=require(_0xb050('0x0'));var util=require(_0xb050('0x1'));var logger=require(_0xb050('0x2'))('api');var moment=require(_0xb050('0x3'));var BPromise=require(_0xb050('0x4'));var rp=require(_0xb050('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb050('0x6'));var config=require(_0xb050('0x7'));var attributes=require(_0xb050('0x8'));module[_0xb050('0x9')]=function(_0x2e9d64,_0x57811a){return _0x2e9d64[_0xb050('0xa')](_0xb050('0xb'),attributes,{'tableName':_0xb050('0xc'),'paranoid':![],'indexes':[{'name':_0xb050('0xd'),'fields':[_0xb050('0xe'),_0xb050('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01b3=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x5af272,_0x20fff3){var _0x1a2c6f=function(_0x59ba3a){while(--_0x59ba3a){_0x5af272['push'](_0x5af272['shift']());}};_0x1a2c6f(++_0x20fff3);}(_0x01b3,0xe8));var _0x301b=function(_0x566ed8,_0x1e4f53){_0x566ed8=_0x566ed8-0x0;var _0x38d29d=_0x01b3[_0x566ed8];return _0x38d29d;};'use strict';var _=require(_0x301b('0x0'));var util=require(_0x301b('0x1'));var logger=require('../../config/logger')(_0x301b('0x2'));var moment=require(_0x301b('0x3'));var BPromise=require(_0x301b('0x4'));var rp=require(_0x301b('0x5'));var fs=require('fs');var path=require(_0x301b('0x6'));var rimraf=require('rimraf');var config=require(_0x301b('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x301b('0x8')]=function(_0x176a85,_0x32abf0){return _0x176a85[_0x301b('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x301b('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 43538ea..92a949e 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 _0x0b03=['code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d208c,_0x1d3be7){var _0x5e8852=function(_0x5d4415){while(--_0x5d4415){_0x5d208c['push'](_0x5d208c['shift']());}};_0x5e8852(++_0x1d3be7);}(_0x0b03,0x81));var _0x30b0=function(_0xa35408,_0x315f2a){_0xa35408=_0xa35408-0x0;var _0xc71d1b=_0x0b03[_0xa35408];return _0xc71d1b;};'use strict';var _=require(_0x30b0('0x0'));var util=require(_0x30b0('0x1'));var moment=require('moment');var BPromise=require(_0x30b0('0x2'));var rs=require(_0x30b0('0x3'));var fs=require('fs');var Redis=require(_0x30b0('0x4'));var db=require(_0x30b0('0x5'))['db'];var utils=require(_0x30b0('0x6'));var logger=require('../../config/logger')(_0x30b0('0x7'));var config=require(_0x30b0('0x8'));var jayson=require(_0x30b0('0x9'));var client=jayson[_0x30b0('0xa')][_0x30b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4706b4,_0x1a94a1,_0x8e7f61){return new BPromise(function(_0x494588,_0x5ebdaf){return client['request'](_0x4706b4,_0x8e7f61)['then'](function(_0x276ac7){logger['info'](_0x30b0('0xc'),_0x1a94a1,_0x30b0('0xd'));logger[_0x30b0('0xe')](_0x30b0('0xf'),_0x1a94a1,'request\x20sent',JSON[_0x30b0('0x10')](_0x276ac7));if(_0x276ac7[_0x30b0('0x11')]){if(_0x276ac7['error'][_0x30b0('0x12')]===0x1f4){logger[_0x30b0('0x11')](_0x30b0('0xc'),_0x1a94a1,_0x276ac7[_0x30b0('0x11')]['message']);return _0x5ebdaf(_0x276ac7[_0x30b0('0x11')][_0x30b0('0x13')]);}logger[_0x30b0('0x11')](_0x30b0('0xc'),_0x1a94a1,_0x276ac7['error'][_0x30b0('0x13')]);return _0x494588(_0x276ac7[_0x30b0('0x11')][_0x30b0('0x13')]);}else{logger[_0x30b0('0x14')](_0x30b0('0xc'),_0x1a94a1,_0x30b0('0xd'));_0x494588(_0x276ac7['result'][_0x30b0('0x13')]);}})['catch'](function(_0x5060d8){logger[_0x30b0('0x11')](_0x30b0('0xc'),_0x1a94a1,_0x5060d8);_0x5ebdaf(_0x5060d8);});});} \ No newline at end of file +var _0xec6e=['http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x21714f,_0x4afc9b){var _0x425bf7=function(_0x4105c6){while(--_0x4105c6){_0x21714f['push'](_0x21714f['shift']());}};_0x425bf7(++_0x4afc9b);}(_0xec6e,0x195));var _0xeec6=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xec6e[_0xce6f11];return _0x35b709;};'use strict';var _=require(_0xeec6('0x0'));var util=require(_0xeec6('0x1'));var moment=require('moment');var BPromise=require(_0xeec6('0x2'));var rs=require(_0xeec6('0x3'));var fs=require('fs');var Redis=require(_0xeec6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeec6('0x5'));var logger=require(_0xeec6('0x6'))('rpc');var config=require(_0xeec6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeec6('0x8')][_0xeec6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2080,_0x2ed8ce,_0x16b59a){return new BPromise(function(_0x323ac8,_0x19da83){return client['request'](_0x1c2080,_0x16b59a)[_0xeec6('0xa')](function(_0x13b0ec){logger[_0xeec6('0xb')](_0xeec6('0xc'),_0x2ed8ce,_0xeec6('0xd'));logger[_0xeec6('0xe')](_0xeec6('0xf'),_0x2ed8ce,_0xeec6('0xd'),JSON['stringify'](_0x13b0ec));if(_0x13b0ec[_0xeec6('0x10')]){if(_0x13b0ec[_0xeec6('0x10')]['code']===0x1f4){logger[_0xeec6('0x10')](_0xeec6('0xc'),_0x2ed8ce,_0x13b0ec[_0xeec6('0x10')][_0xeec6('0x11')]);return _0x19da83(_0x13b0ec['error'][_0xeec6('0x11')]);}logger[_0xeec6('0x10')](_0xeec6('0xc'),_0x2ed8ce,_0x13b0ec[_0xeec6('0x10')]['message']);return _0x323ac8(_0x13b0ec[_0xeec6('0x10')][_0xeec6('0x11')]);}else{logger['info'](_0xeec6('0xc'),_0x2ed8ce,_0xeec6('0xd'));_0x323ac8(_0x13b0ec['result'][_0xeec6('0x11')]);}})['catch'](function(_0x452b8b){logger['error'](_0xeec6('0xc'),_0x2ed8ce,_0x452b8b);_0x19da83(_0x452b8b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index be984c5..3e01f8b 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 _0x60d4=['show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x40e415,_0x503a64){var _0x496ed4=function(_0x1365cd){while(--_0x1365cd){_0x40e415['push'](_0x40e415['shift']());}};_0x496ed4(++_0x503a64);}(_0x60d4,0x1ed));var _0x460d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x460d('0x0'));var util=require(_0x460d('0x1'));var path=require(_0x460d('0x2'));var timeout=require(_0x460d('0x3'));var express=require(_0x460d('0x4'));var router=express['Router']();var fs_extra=require(_0x460d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x460d('0x6'));var config=require(_0x460d('0x7'));var controller=require(_0x460d('0x8'));router[_0x460d('0x9')]('/',auth[_0x460d('0xa')](),controller[_0x460d('0xb')]);router[_0x460d('0x9')](_0x460d('0xc'),auth[_0x460d('0xa')](),controller[_0x460d('0xd')]);router[_0x460d('0x9')](_0x460d('0xe'),auth[_0x460d('0xa')](),controller[_0x460d('0xf')]);router[_0x460d('0x9')](_0x460d('0x10'),auth[_0x460d('0xa')](),controller['getFields']);router[_0x460d('0x11')]('/',auth[_0x460d('0xa')](),controller['create']);router[_0x460d('0x11')]('/:id/configurations',auth[_0x460d('0xa')](),controller[_0x460d('0x12')]);router[_0x460d('0x13')]('/:id',auth[_0x460d('0xa')](),controller[_0x460d('0x14')]);router['delete'](_0x460d('0xc'),auth[_0x460d('0xa')](),controller[_0x460d('0x15')]);module[_0x460d('0x16')]=router; \ No newline at end of file +var _0x5e88=['post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create'];(function(_0x21125f,_0x8079f8){var _0x2f421d=function(_0x231299){while(--_0x231299){_0x21125f['push'](_0x21125f['shift']());}};_0x2f421d(++_0x8079f8);}(_0x5e88,0xb5));var _0x85e8=function(_0x19e1f4,_0x1e6b05){_0x19e1f4=_0x19e1f4-0x0;var _0x4624e8=_0x5e88[_0x19e1f4];return _0x4624e8;};'use strict';var multer=require(_0x85e8('0x0'));var util=require(_0x85e8('0x1'));var path=require(_0x85e8('0x2'));var timeout=require(_0x85e8('0x3'));var express=require(_0x85e8('0x4'));var router=express[_0x85e8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85e8('0x6'));var controller=require('./intZohoAccount.controller');router[_0x85e8('0x7')]('/',auth['isAuthenticated'](),controller[_0x85e8('0x8')]);router[_0x85e8('0x7')](_0x85e8('0x9'),auth['isAuthenticated'](),controller[_0x85e8('0xa')]);router[_0x85e8('0x7')](_0x85e8('0xb'),auth[_0x85e8('0xc')](),controller[_0x85e8('0xd')]);router[_0x85e8('0x7')](_0x85e8('0xe'),auth[_0x85e8('0xc')](),controller[_0x85e8('0xf')]);router['post']('/',auth[_0x85e8('0xc')](),controller[_0x85e8('0x10')]);router[_0x85e8('0x11')](_0x85e8('0xb'),auth[_0x85e8('0xc')](),controller[_0x85e8('0x12')]);router[_0x85e8('0x13')](_0x85e8('0x9'),auth[_0x85e8('0xc')](),controller['update']);router[_0x85e8('0x14')](_0x85e8('0x9'),auth[_0x85e8('0xc')](),controller[_0x85e8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0e87688..7f73efd 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 _0x91a7=['STRING','exports'];(function(_0x2ec3a7,_0x1d5993){var _0x507f82=function(_0x5ce431){while(--_0x5ce431){_0x2ec3a7['push'](_0x2ec3a7['shift']());}};_0x507f82(++_0x1d5993);}(_0x91a7,0xe7));var _0x791a=function(_0x2cc731,_0xd5fc0f){_0x2cc731=_0x2cc731-0x0;var _0x536de2=_0x91a7[_0x2cc731];return _0x536de2;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file +var _0xa75b=['sequelize','STRING'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa75b,0x170));var _0xba75=function(_0x4c590d,_0x46f04d){_0x4c590d=_0x4c590d-0x0;var _0x4ffc0f=_0xa75b[_0x4c590d];return _0x4ffc0f;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba75('0x1')]},'host':{'type':Sequelize[_0xba75('0x1')]},'zone':{'type':Sequelize[_0xba75('0x1')]},'clientId':{'type':Sequelize[_0xba75('0x1')]},'clientSecret':{'type':Sequelize[_0xba75('0x1')]},'serverUrl':{'type':Sequelize[_0xba75('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xba75('0x1')]},'refreshToken':{'type':Sequelize[_0xba75('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f091c65..770e317 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 _0xff30=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','getConfigurations','pick','addConfiguration','findOne','AccountId','Subjects','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','com','slice','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0xff30,0x104));var _0x0ff3=function(_0x1fd8bf,_0x236db0){_0x1fd8bf=_0x1fd8bf-0x0;var _0x197f7a=_0xff30[_0x1fd8bf];return _0x197f7a;};'use strict';var emlformat=require(_0x0ff3('0x0'));var rimraf=require(_0x0ff3('0x1'));var zipdir=require(_0x0ff3('0x2'));var jsonpatch=require(_0x0ff3('0x3'));var rp=require(_0x0ff3('0x4'));var moment=require(_0x0ff3('0x5'));var BPromise=require(_0x0ff3('0x6'));var Mustache=require(_0x0ff3('0x7'));var util=require(_0x0ff3('0x8'));var path=require(_0x0ff3('0x9'));var sox=require(_0x0ff3('0xa'));var csv=require(_0x0ff3('0xb'));var ejs=require(_0x0ff3('0xc'));var fs=require('fs');var fs_extra=require(_0x0ff3('0xd'));var _=require(_0x0ff3('0xe'));var squel=require(_0x0ff3('0xf'));var crypto=require(_0x0ff3('0x10'));var jsforce=require(_0x0ff3('0x11'));var deskjs=require(_0x0ff3('0x12'));var toCsv=require('to-csv');var querystring=require(_0x0ff3('0x13'));var Papa=require(_0x0ff3('0x14'));var Redis=require(_0x0ff3('0x15'));var authService=require(_0x0ff3('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x0ff3('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ff3('0x18'))(_0x0ff3('0x19'));var utils=require(_0x0ff3('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ff3('0x1b'))['db'];var integrations=require(_0x0ff3('0x1c'));function respondWithStatusCode(_0xf0655b,_0xe0b610){_0xe0b610=_0xe0b610||0xcc;return function(_0x52b3e1){if(_0x52b3e1){return _0xf0655b[_0x0ff3('0x1d')](_0xe0b610);}return _0xf0655b[_0x0ff3('0x1e')](_0xe0b610)['end']();};}function respondWithResult(_0x170a7c,_0x142012){_0x142012=_0x142012||0xc8;return function(_0x96a3e1){if(_0x96a3e1){return _0x170a7c['status'](_0x142012)[_0x0ff3('0x1f')](_0x96a3e1);}};}function respondWithFilteredResult(_0x3af3fb,_0x47d027){return function(_0x25b6b4){if(_0x25b6b4){var _0x47b25b=typeof _0x47d027['offset']===_0x0ff3('0x20')&&typeof _0x47d027[_0x0ff3('0x21')]===_0x0ff3('0x20');var _0x54294f=_0x25b6b4[_0x0ff3('0x22')];var _0x21a357=_0x47b25b?0x0:_0x47d027[_0x0ff3('0x23')];var _0x2465b8=_0x47b25b?_0x25b6b4[_0x0ff3('0x22')]:_0x47d027['offset']+_0x47d027['limit'];var _0x309929;if(_0x2465b8>=_0x54294f){_0x2465b8=_0x54294f;_0x309929=0xc8;}else{_0x309929=0xce;}_0x3af3fb[_0x0ff3('0x1e')](_0x309929);return _0x3af3fb['set'](_0x0ff3('0x24'),_0x21a357+'-'+_0x2465b8+'/'+_0x54294f)['json'](_0x25b6b4);}return null;};}function patchUpdates(_0xd23451){return function(_0x8885a4){try{jsonpatch[_0x0ff3('0x25')](_0x8885a4,_0xd23451,!![]);}catch(_0x9fde80){return BPromise[_0x0ff3('0x26')](_0x9fde80);}return _0x8885a4[_0x0ff3('0x27')]();};}function saveUpdates(_0x1663f5,_0x3649a6){return function(_0x5ce2f4){if(_0x5ce2f4){return _0x5ce2f4[_0x0ff3('0x28')](_0x1663f5)[_0x0ff3('0x29')](function(_0x1b1a28){return _0x1b1a28;});}return null;};}function removeEntity(_0x1c0e87,_0x53b0b3){return function(_0x12f2bd){if(_0x12f2bd){return _0x12f2bd['destroy']()['then'](function(){_0x1c0e87['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x162f0e,_0x7969bc){return function(_0x53007e){if(!_0x53007e){_0x162f0e[_0x0ff3('0x1d')](0x194);}return _0x53007e;};}function handleError(_0x29b2ed,_0x151819){_0x151819=_0x151819||0x1f4;return function(_0x13cbe2){logger['error'](_0x13cbe2[_0x0ff3('0x2a')]);if(_0x13cbe2[_0x0ff3('0x2b')]){delete _0x13cbe2[_0x0ff3('0x2b')];}_0x29b2ed[_0x0ff3('0x1e')](_0x151819)['send'](_0x13cbe2);};}exports[_0x0ff3('0x2c')]=function(_0x2a42ba,_0x5bc412){var _0x118ae6={},_0x2a3115={},_0x550583={'count':0x0,'rows':[]};var _0x197ac8=_[_0x0ff3('0x2d')](db[_0x0ff3('0x2e')][_0x0ff3('0x2f')],function(_0x463f08){return{'name':_0x463f08[_0x0ff3('0x30')],'type':_0x463f08[_0x0ff3('0x31')][_0x0ff3('0x32')]};});_0x2a3115[_0x0ff3('0x33')]=_[_0x0ff3('0x2d')](_0x197ac8,'name');_0x2a3115[_0x0ff3('0x34')]=_['keys'](_0x2a42ba[_0x0ff3('0x34')]);_0x2a3115[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x2a3115[_0x0ff3('0x33')],_0x2a3115['query']);_0x118ae6[_0x0ff3('0x37')]=_['intersection'](_0x2a3115[_0x0ff3('0x33')],qs[_0x0ff3('0x38')](_0x2a42ba[_0x0ff3('0x34')][_0x0ff3('0x38')]));_0x118ae6[_0x0ff3('0x37')]=_0x118ae6[_0x0ff3('0x37')][_0x0ff3('0x39')]?_0x118ae6[_0x0ff3('0x37')]:_0x2a3115[_0x0ff3('0x33')];if(!_0x2a42ba['query'][_0x0ff3('0x3a')](_0x0ff3('0x3b'))){_0x118ae6[_0x0ff3('0x21')]=qs[_0x0ff3('0x21')](_0x2a42ba[_0x0ff3('0x34')][_0x0ff3('0x21')]);_0x118ae6[_0x0ff3('0x23')]=qs[_0x0ff3('0x23')](_0x2a42ba[_0x0ff3('0x34')][_0x0ff3('0x23')]);}_0x118ae6[_0x0ff3('0x3c')]=qs[_0x0ff3('0x3d')](_0x2a42ba[_0x0ff3('0x34')]['sort']);_0x118ae6['where']=qs['filters'](_['pick'](_0x2a42ba[_0x0ff3('0x34')],_0x2a3115[_0x0ff3('0x35')]),_0x197ac8);if(_0x2a42ba[_0x0ff3('0x34')][_0x0ff3('0x3e')]){_0x118ae6[_0x0ff3('0x3f')]=_[_0x0ff3('0x40')](_0x118ae6['where'],{'$or':_[_0x0ff3('0x2d')](_0x197ac8,function(_0x1cfc56){if(_0x1cfc56[_0x0ff3('0x31')]!==_0x0ff3('0x41')){var _0x87f165={};_0x87f165[_0x1cfc56[_0x0ff3('0x2b')]]={'$like':'%'+_0x2a42ba[_0x0ff3('0x34')][_0x0ff3('0x3e')]+'%'};return _0x87f165;}})});}_0x118ae6=_[_0x0ff3('0x40')]({},_0x118ae6,_0x2a42ba[_0x0ff3('0x42')]);var _0x48b388={'where':_0x118ae6[_0x0ff3('0x3f')]};return db[_0x0ff3('0x2e')][_0x0ff3('0x22')](_0x48b388)[_0x0ff3('0x29')](function(_0x67a94d){_0x550583['count']=_0x67a94d;if(_0x2a42ba['query'][_0x0ff3('0x43')]){_0x118ae6[_0x0ff3('0x44')]=[{'all':!![]}];}return db[_0x0ff3('0x2e')]['findAll'](_0x118ae6);})[_0x0ff3('0x29')](function(_0xe69e7){_0x550583['rows']=_0xe69e7;return _0x550583;})[_0x0ff3('0x29')](respondWithFilteredResult(_0x5bc412,_0x118ae6))[_0x0ff3('0x45')](handleError(_0x5bc412,null));};exports[_0x0ff3('0x46')]=function(_0x5949fb,_0x26f55a){var _0x57a608={'raw':![],'where':{'id':_0x5949fb[_0x0ff3('0x47')]['id']}},_0x375742={};_0x375742['model']=_[_0x0ff3('0x48')](db['ZohoAccount'][_0x0ff3('0x2f')]);_0x375742[_0x0ff3('0x34')]=_[_0x0ff3('0x48')](_0x5949fb[_0x0ff3('0x34')]);_0x375742[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x375742[_0x0ff3('0x33')],_0x375742[_0x0ff3('0x34')]);_0x57a608['attributes']=_[_0x0ff3('0x36')](_0x375742[_0x0ff3('0x33')],qs[_0x0ff3('0x38')](_0x5949fb['query'][_0x0ff3('0x38')]));_0x57a608['attributes']=_0x57a608['attributes'][_0x0ff3('0x39')]?_0x57a608[_0x0ff3('0x37')]:_0x375742[_0x0ff3('0x33')];if(_0x5949fb[_0x0ff3('0x34')][_0x0ff3('0x43')]){_0x57a608['include']=[{'all':!![]}];}_0x57a608=_['merge']({},_0x57a608,_0x5949fb[_0x0ff3('0x42')]);return db[_0x0ff3('0x2e')][_0x0ff3('0x49')](_0x57a608)['then'](handleEntityNotFound(_0x26f55a,null))['then'](respondWithResult(_0x26f55a,null))[_0x0ff3('0x45')](handleError(_0x26f55a,null));};exports['create']=function(_0x2f2dc2,_0x1a93c6){return db[_0x0ff3('0x2e')][_0x0ff3('0x4a')](_0x2f2dc2['body'],{})[_0x0ff3('0x29')](respondWithResult(_0x1a93c6,0xc9))['catch'](handleError(_0x1a93c6,null));};exports[_0x0ff3('0x28')]=function(_0x406928,_0x18ba18){if(_0x406928[_0x0ff3('0x4b')]['id']){delete _0x406928[_0x0ff3('0x4b')]['id'];}return db[_0x0ff3('0x2e')][_0x0ff3('0x49')]({'where':{'id':_0x406928[_0x0ff3('0x47')]['id']}})['then'](handleEntityNotFound(_0x18ba18,null))[_0x0ff3('0x29')](saveUpdates(_0x406928['body'],null))[_0x0ff3('0x29')](respondWithResult(_0x18ba18,null))[_0x0ff3('0x45')](handleError(_0x18ba18,null));};exports['destroy']=function(_0x5b21b0,_0x5876f0){return db['ZohoAccount'][_0x0ff3('0x49')]({'where':{'id':_0x5b21b0[_0x0ff3('0x47')]['id']}})[_0x0ff3('0x29')](handleEntityNotFound(_0x5876f0,null))['then'](removeEntity(_0x5876f0,null))[_0x0ff3('0x45')](handleError(_0x5876f0,null));};exports[_0x0ff3('0x4c')]=function(_0x131d9e,_0x2228d6,_0x250528){var _0x35ef5b={};var _0x2632aa={};var _0x2e3116;var _0x3bc12b;return db[_0x0ff3('0x2e')]['findOne']({'where':{'id':_0x131d9e[_0x0ff3('0x47')]['id']}})[_0x0ff3('0x29')](handleEntityNotFound(_0x2228d6,null))['then'](function(_0x54187c){if(_0x54187c){_0x2e3116=_0x54187c;_0x2632aa[_0x0ff3('0x33')]=_[_0x0ff3('0x48')](db['ZohoConfiguration'][_0x0ff3('0x2f')]);_0x2632aa[_0x0ff3('0x34')]=_[_0x0ff3('0x48')](_0x131d9e[_0x0ff3('0x34')]);_0x2632aa[_0x0ff3('0x35')]=_[_0x0ff3('0x36')](_0x2632aa[_0x0ff3('0x33')],_0x2632aa[_0x0ff3('0x34')]);_0x35ef5b[_0x0ff3('0x37')]=_[_0x0ff3('0x36')](_0x2632aa[_0x0ff3('0x33')],qs[_0x0ff3('0x38')](_0x131d9e[_0x0ff3('0x34')][_0x0ff3('0x38')]));_0x35ef5b['attributes']=_0x35ef5b['attributes'][_0x0ff3('0x39')]?_0x35ef5b[_0x0ff3('0x37')]:_0x2632aa['model'];_0x35ef5b['order']=qs[_0x0ff3('0x3d')](_0x131d9e[_0x0ff3('0x34')]['sort']);_0x35ef5b[_0x0ff3('0x3f')]=qs[_0x0ff3('0x35')](_[_0x0ff3('0x4d')](_0x131d9e['query'],_0x2632aa['filters']));if(_0x131d9e[_0x0ff3('0x34')][_0x0ff3('0x3e')]){_0x35ef5b[_0x0ff3('0x3f')]=_[_0x0ff3('0x40')](_0x35ef5b['where'],{'$or':_[_0x0ff3('0x2d')](_0x35ef5b[_0x0ff3('0x37')],function(_0x25e46d){var _0x18f3bf={};_0x18f3bf[_0x25e46d]={'$like':'%'+_0x131d9e['query']['filter']+'%'};return _0x18f3bf;})});}_0x35ef5b=_['merge']({},_0x35ef5b,_0x131d9e['options']);return _0x2e3116[_0x0ff3('0x4c')](_0x35ef5b);}})[_0x0ff3('0x29')](function(_0x117495){if(_0x117495){_0x3bc12b=_0x117495[_0x0ff3('0x39')];if(!_0x131d9e[_0x0ff3('0x34')]['hasOwnProperty']('nolimit')){_0x35ef5b[_0x0ff3('0x21')]=qs[_0x0ff3('0x21')](_0x131d9e[_0x0ff3('0x34')]['limit']);_0x35ef5b['offset']=qs[_0x0ff3('0x23')](_0x131d9e['query'][_0x0ff3('0x23')]);}return _0x2e3116[_0x0ff3('0x4c')](_0x35ef5b);}})[_0x0ff3('0x29')](function(_0x5b55a5){if(_0x5b55a5){return _0x5b55a5?{'count':_0x3bc12b,'rows':_0x5b55a5}:null;}})[_0x0ff3('0x29')](respondWithResult(_0x2228d6,null))[_0x0ff3('0x45')](handleError(_0x2228d6,null));};exports[_0x0ff3('0x4e')]=function(_0x5414d6,_0x238632,_0x407576){if(_0x5414d6['body']['id']){delete _0x5414d6['body']['id'];}return db[_0x0ff3('0x2e')][_0x0ff3('0x4f')]({'where':{'id':_0x5414d6[_0x0ff3('0x47')]['id']}})['then'](handleEntityNotFound(_0x238632,null))['then'](function(_0x2bbc1c){if(_0x2bbc1c){_0x5414d6[_0x0ff3('0x4b')][_0x0ff3('0x50')]=_0x2bbc1c['id'];_0x5414d6[_0x0ff3('0x4b')][_0x0ff3('0x51')]=integrations['getSubjects'](_0x5414d6[_0x0ff3('0x4b')][_0x0ff3('0x52')],_0x5414d6['body']['type']);_0x5414d6[_0x0ff3('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x5414d6[_0x0ff3('0x4b')]['channel'],_0x5414d6[_0x0ff3('0x4b')][_0x0ff3('0x31')]);return db[_0x0ff3('0x53')][_0x0ff3('0x4a')](_0x5414d6[_0x0ff3('0x4b')],{'include':[{'model':db[_0x0ff3('0x54')],'as':_0x0ff3('0x51')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x0ff3('0x29')](respondWithResult(_0x238632,null))[_0x0ff3('0x45')](handleError(_0x238632,null));};function getAccessToken(_0x1692a5){return new Promise(function(_0x16bc77,_0x4ec4e8){var _0x384305;switch(_0x1692a5[_0x0ff3('0x55')]){case'US':_0x384305='https://accounts.zoho.com';break;case'AU':_0x384305=_0x0ff3('0x56');break;case'EU':_0x384305=_0x0ff3('0x57');break;case'IN':_0x384305=_0x0ff3('0x58');break;case'CN':_0x384305='https://accounts.zoho.com.cn';break;default:_0x384305=_0x0ff3('0x57');break;}var _0x2d4297={'method':_0x0ff3('0x59'),'uri':_0x384305+_0x0ff3('0x5a'),'qs':{'refresh_token':_0x1692a5[_0x0ff3('0x5b')],'client_id':_0x1692a5['clientId'],'client_secret':_0x1692a5[_0x0ff3('0x5c')],'grant_type':_0x0ff3('0x5d')},'json':!![]};return rp(_0x2d4297)[_0x0ff3('0x29')](function(_0x2834d4){if(_0x2834d4[_0x0ff3('0x5e')]){_0x16bc77(_0x2834d4[_0x0ff3('0x5e')]);}else{_0x4ec4e8(_0x0ff3('0x5f'));}})['catch'](function(_0x761c){_0x4ec4e8(_0x761c);});});}exports[_0x0ff3('0x60')]=function(_0x33b26,_0x1f5f02,_0x212dea){var _0x5374d,_0x49cab4,_0x4ea274,_0x61a4e8,_0x50962e;return db[_0x0ff3('0x2e')][_0x0ff3('0x4f')]({'where':{'id':_0x33b26[_0x0ff3('0x47')]['id']},'attributes':['id',_0x0ff3('0x61'),_0x0ff3('0x55'),'clientId',_0x0ff3('0x5c'),_0x0ff3('0x62'),_0x0ff3('0x63'),'refreshToken']})[_0x0ff3('0x29')](handleEntityNotFound(_0x1f5f02,null))[_0x0ff3('0x29')](function(_0x1c91da){_0x50962e=_0x1c91da;_0x5374d=_0x50962e[_0x0ff3('0x61')];_0x49cab4=_0x5374d==='zoho.eu'?'eu':_0x0ff3('0x64');_0x4ea274=_0x50962e[_0x0ff3('0x62')];var _0x2ba78a=_0x4ea274[_0x0ff3('0x65')](-0x1);if(_0x2ba78a==='/'||_0x2ba78a==='\x5c'||_0x2ba78a===':'){_0x4ea274=_0x4ea274[_0x0ff3('0x66')](0x0,_0x4ea274['lastIndexOf'](_0x2ba78a));}if(!_0x50962e[_0x0ff3('0x5b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x50962e);})[_0x0ff3('0x29')](function(_0x3e8a13){if(_0x3e8a13){return rp({'method':_0x0ff3('0x67'),'uri':util[_0x0ff3('0x68')](_0x0ff3('0x69'),_0x49cab4),'qs':{'module':_0x0ff3('0x6a')},'headers':{'Authorization':_0x0ff3('0x6b')+_0x3e8a13},'json':!![]});}})[_0x0ff3('0x29')](function(_0x615d84){if(_0x615d84){if(_0x615d84[_0x0ff3('0x6c')]&&_0x615d84['response'][_0x0ff3('0x6d')]){throw new Error(_0x615d84[_0x0ff3('0x6c')][_0x0ff3('0x6d')][_0x0ff3('0x6e')]);}var _0x378710=[];var _0x15625e=[];var _0x219f44=[_0x0ff3('0x6f'),_0x0ff3('0x70'),_0x0ff3('0x71'),'WhoId',_0x0ff3('0x72'),_0x0ff3('0x73'),'Call_Start_Time',_0x0ff3('0x74')];_0x15625e=_[_0x0ff3('0x75')](_0x615d84[_0x0ff3('0x38')],function(_0x412a1a){return _0x219f44['includes'](_0x412a1a[_0x0ff3('0x76')]);});for(var _0x284834=0x0;_0x284834<_0x15625e['length'];_0x284834++){if(_0x15625e[_0x284834][_0x0ff3('0x77')]===![]){_0x378710[_0x0ff3('0x78')]({'id':_0x15625e[_0x284834]['id'],'name':_0x15625e[_0x284834][_0x0ff3('0x79')],'custom':_0x15625e[_0x284834][_0x0ff3('0x7a')],'options':_0x15625e[_0x284834]['data_type']===_0x0ff3('0x7b')&&_0x15625e[_0x284834]['pick_list_values'][_0x0ff3('0x39')]>-0x1?_['map'](_0x15625e[_0x284834][_0x0ff3('0x7c')],function(_0xcb9562){return{'name':_0xcb9562,'value':_0xcb9562};}):[]});}}return{'count':_0x378710[_0x0ff3('0x39')],'rows':_0x378710};}else{return{'count':0x0,'rows':[]};}})[_0x0ff3('0x29')](respondWithResult(_0x1f5f02,null))['catch'](function(_0x1fe44e){var _0x4adde4=_0x33b26[_0x0ff3('0x34')][_0x0ff3('0x7d')]?0x1f4:_0x1fe44e[_0x0ff3('0x7e')]||0x1f4;logger[_0x0ff3('0x6d')](_0x0ff3('0x7f'),'getFields',_0x4adde4,JSON[_0x0ff3('0x80')](_0x1fe44e));delete _0x1fe44e[_0x0ff3('0x2b')];if(_0x4adde4===0x191){_0x4adde4=0x190;}_0x1f5f02[_0x0ff3('0x1e')](_0x4adde4)[_0x0ff3('0x81')](_0x33b26['query'][_0x0ff3('0x7d')]?{'message':_0x0ff3('0x82'),'statusCode':_0x1fe44e[_0x0ff3('0x7e')]}:_0x1fe44e);});}; \ No newline at end of file +var _0x880c=['body','getConfigurations','findOne','params','ZohoConfiguration','order','pick','nolimit','addConfiguration','Subjects','channel','getDescriptions','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','code','refreshToken','zoho.eu','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','response','error','message','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','ZohoAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','includeAll','options','find','create'];(function(_0x5df99d,_0x2885ff){var _0x55d82b=function(_0x58c144){while(--_0x58c144){_0x5df99d['push'](_0x5df99d['shift']());}};_0x55d82b(++_0x2885ff);}(_0x880c,0x19d));var _0xc880=function(_0x2e6f2e,_0x2ec0f4){_0x2e6f2e=_0x2e6f2e-0x0;var _0x5635aa=_0x880c[_0x2e6f2e];return _0x5635aa;};'use strict';var emlformat=require(_0xc880('0x0'));var rimraf=require(_0xc880('0x1'));var zipdir=require(_0xc880('0x2'));var jsonpatch=require(_0xc880('0x3'));var rp=require('request-promise');var moment=require(_0xc880('0x4'));var BPromise=require(_0xc880('0x5'));var Mustache=require(_0xc880('0x6'));var util=require(_0xc880('0x7'));var path=require(_0xc880('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc880('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc880('0xa'));var squel=require(_0xc880('0xb'));var crypto=require(_0xc880('0xc'));var jsforce=require(_0xc880('0xd'));var deskjs=require(_0xc880('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc880('0xf'));var Papa=require(_0xc880('0x10'));var Redis=require(_0xc880('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc880('0x12'));var hardwareService=require(_0xc880('0x13'));var logger=require(_0xc880('0x14'))(_0xc880('0x15'));var utils=require(_0xc880('0x16'));var config=require(_0xc880('0x17'));var licenseUtil=require(_0xc880('0x18'));var db=require(_0xc880('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x147370,_0x2d5738){_0x2d5738=_0x2d5738||0xcc;return function(_0xe79e49){if(_0xe79e49){return _0x147370[_0xc880('0x1a')](_0x2d5738);}return _0x147370['status'](_0x2d5738)[_0xc880('0x1b')]();};}function respondWithResult(_0x5ac61a,_0x2da082){_0x2da082=_0x2da082||0xc8;return function(_0x2b63f7){if(_0x2b63f7){return _0x5ac61a[_0xc880('0x1c')](_0x2da082)[_0xc880('0x1d')](_0x2b63f7);}};}function respondWithFilteredResult(_0x362060,_0x529a6a){return function(_0x5965bf){if(_0x5965bf){var _0x44f611=typeof _0x529a6a[_0xc880('0x1e')]===_0xc880('0x1f')&&typeof _0x529a6a[_0xc880('0x20')]===_0xc880('0x1f');var _0x3d92ed=_0x5965bf[_0xc880('0x21')];var _0x2afd96=_0x44f611?0x0:_0x529a6a[_0xc880('0x1e')];var _0x4463a3=_0x44f611?_0x5965bf[_0xc880('0x21')]:_0x529a6a[_0xc880('0x1e')]+_0x529a6a[_0xc880('0x20')];var _0x4a60c5;if(_0x4463a3>=_0x3d92ed){_0x4463a3=_0x3d92ed;_0x4a60c5=0xc8;}else{_0x4a60c5=0xce;}_0x362060[_0xc880('0x1c')](_0x4a60c5);return _0x362060[_0xc880('0x22')](_0xc880('0x23'),_0x2afd96+'-'+_0x4463a3+'/'+_0x3d92ed)['json'](_0x5965bf);}return null;};}function patchUpdates(_0x379ddf){return function(_0x2c8872){try{jsonpatch[_0xc880('0x24')](_0x2c8872,_0x379ddf,!![]);}catch(_0x28d76a){return BPromise[_0xc880('0x25')](_0x28d76a);}return _0x2c8872[_0xc880('0x26')]();};}function saveUpdates(_0x39f92e,_0x516e62){return function(_0x5e36ca){if(_0x5e36ca){return _0x5e36ca[_0xc880('0x27')](_0x39f92e)[_0xc880('0x28')](function(_0x5571e2){return _0x5571e2;});}return null;};}function removeEntity(_0x36068f,_0x1fad05){return function(_0x1a83c6){if(_0x1a83c6){return _0x1a83c6[_0xc880('0x29')]()[_0xc880('0x28')](function(){_0x36068f['status'](0xcc)[_0xc880('0x1b')]();});}};}function handleEntityNotFound(_0x1b25f8,_0x5e576a){return function(_0x23c259){if(!_0x23c259){_0x1b25f8[_0xc880('0x1a')](0x194);}return _0x23c259;};}function handleError(_0x4aa210,_0x2d6f35){_0x2d6f35=_0x2d6f35||0x1f4;return function(_0x43eb12){logger['error'](_0x43eb12[_0xc880('0x2a')]);if(_0x43eb12[_0xc880('0x2b')]){delete _0x43eb12[_0xc880('0x2b')];}_0x4aa210[_0xc880('0x1c')](_0x2d6f35)['send'](_0x43eb12);};}exports['index']=function(_0xc9c1d4,_0x28dbcc){var _0x3a608a={},_0x586934={},_0x4bc822={'count':0x0,'rows':[]};var _0x190e2a=_['map'](db[_0xc880('0x2c')][_0xc880('0x2d')],function(_0x2309a7){return{'name':_0x2309a7[_0xc880('0x2e')],'type':_0x2309a7[_0xc880('0x2f')]['key']};});_0x586934[_0xc880('0x30')]=_[_0xc880('0x31')](_0x190e2a,'name');_0x586934[_0xc880('0x32')]=_[_0xc880('0x33')](_0xc9c1d4[_0xc880('0x32')]);_0x586934[_0xc880('0x34')]=_[_0xc880('0x35')](_0x586934['model'],_0x586934[_0xc880('0x32')]);_0x3a608a[_0xc880('0x36')]=_[_0xc880('0x35')](_0x586934[_0xc880('0x30')],qs[_0xc880('0x37')](_0xc9c1d4[_0xc880('0x32')][_0xc880('0x37')]));_0x3a608a['attributes']=_0x3a608a[_0xc880('0x36')][_0xc880('0x38')]?_0x3a608a[_0xc880('0x36')]:_0x586934[_0xc880('0x30')];if(!_0xc9c1d4[_0xc880('0x32')][_0xc880('0x39')]('nolimit')){_0x3a608a['limit']=qs[_0xc880('0x20')](_0xc9c1d4[_0xc880('0x32')][_0xc880('0x20')]);_0x3a608a['offset']=qs[_0xc880('0x1e')](_0xc9c1d4[_0xc880('0x32')]['offset']);}_0x3a608a['order']=qs['sort'](_0xc9c1d4[_0xc880('0x32')][_0xc880('0x3a')]);_0x3a608a[_0xc880('0x3b')]=qs[_0xc880('0x34')](_['pick'](_0xc9c1d4['query'],_0x586934[_0xc880('0x34')]),_0x190e2a);if(_0xc9c1d4[_0xc880('0x32')][_0xc880('0x3c')]){_0x3a608a[_0xc880('0x3b')]=_[_0xc880('0x3d')](_0x3a608a[_0xc880('0x3b')],{'$or':_[_0xc880('0x31')](_0x190e2a,function(_0x7078d3){if(_0x7078d3[_0xc880('0x2f')]!==_0xc880('0x3e')){var _0x219507={};_0x219507[_0x7078d3[_0xc880('0x2b')]]={'$like':'%'+_0xc9c1d4[_0xc880('0x32')][_0xc880('0x3c')]+'%'};return _0x219507;}})});}_0x3a608a=_[_0xc880('0x3d')]({},_0x3a608a,_0xc9c1d4['options']);var _0x49a20a={'where':_0x3a608a[_0xc880('0x3b')]};return db['ZohoAccount'][_0xc880('0x21')](_0x49a20a)[_0xc880('0x28')](function(_0x44ef79){_0x4bc822[_0xc880('0x21')]=_0x44ef79;if(_0xc9c1d4[_0xc880('0x32')]['includeAll']){_0x3a608a[_0xc880('0x3f')]=[{'all':!![]}];}return db[_0xc880('0x2c')]['findAll'](_0x3a608a);})[_0xc880('0x28')](function(_0x575186){_0x4bc822[_0xc880('0x40')]=_0x575186;return _0x4bc822;})[_0xc880('0x28')](respondWithFilteredResult(_0x28dbcc,_0x3a608a))[_0xc880('0x41')](handleError(_0x28dbcc,null));};exports[_0xc880('0x42')]=function(_0x360bda,_0x2c76c){var _0x2bc2bc={'raw':![],'where':{'id':_0x360bda['params']['id']}},_0x11bf17={};_0x11bf17[_0xc880('0x30')]=_[_0xc880('0x33')](db[_0xc880('0x2c')][_0xc880('0x2d')]);_0x11bf17[_0xc880('0x32')]=_[_0xc880('0x33')](_0x360bda[_0xc880('0x32')]);_0x11bf17['filters']=_[_0xc880('0x35')](_0x11bf17[_0xc880('0x30')],_0x11bf17[_0xc880('0x32')]);_0x2bc2bc[_0xc880('0x36')]=_[_0xc880('0x35')](_0x11bf17['model'],qs[_0xc880('0x37')](_0x360bda['query'][_0xc880('0x37')]));_0x2bc2bc[_0xc880('0x36')]=_0x2bc2bc[_0xc880('0x36')][_0xc880('0x38')]?_0x2bc2bc[_0xc880('0x36')]:_0x11bf17[_0xc880('0x30')];if(_0x360bda[_0xc880('0x32')][_0xc880('0x43')]){_0x2bc2bc[_0xc880('0x3f')]=[{'all':!![]}];}_0x2bc2bc=_['merge']({},_0x2bc2bc,_0x360bda[_0xc880('0x44')]);return db[_0xc880('0x2c')][_0xc880('0x45')](_0x2bc2bc)[_0xc880('0x28')](handleEntityNotFound(_0x2c76c,null))['then'](respondWithResult(_0x2c76c,null))[_0xc880('0x41')](handleError(_0x2c76c,null));};exports[_0xc880('0x46')]=function(_0x25ca09,_0x53cd0e){return db[_0xc880('0x2c')][_0xc880('0x46')](_0x25ca09[_0xc880('0x47')],{})[_0xc880('0x28')](respondWithResult(_0x53cd0e,0xc9))[_0xc880('0x41')](handleError(_0x53cd0e,null));};exports[_0xc880('0x27')]=function(_0x2db85f,_0x24cff2){if(_0x2db85f[_0xc880('0x47')]['id']){delete _0x2db85f[_0xc880('0x47')]['id'];}return db[_0xc880('0x2c')][_0xc880('0x45')]({'where':{'id':_0x2db85f['params']['id']}})['then'](handleEntityNotFound(_0x24cff2,null))[_0xc880('0x28')](saveUpdates(_0x2db85f['body'],null))['then'](respondWithResult(_0x24cff2,null))['catch'](handleError(_0x24cff2,null));};exports[_0xc880('0x29')]=function(_0x1f459b,_0xc9963b){return db['ZohoAccount'][_0xc880('0x45')]({'where':{'id':_0x1f459b['params']['id']}})['then'](handleEntityNotFound(_0xc9963b,null))[_0xc880('0x28')](removeEntity(_0xc9963b,null))['catch'](handleError(_0xc9963b,null));};exports[_0xc880('0x48')]=function(_0x1ad1de,_0x4a4738,_0x29ae5b){var _0x4fad59={};var _0x22a127={};var _0xbffd72;var _0x20e5b7;return db[_0xc880('0x2c')][_0xc880('0x49')]({'where':{'id':_0x1ad1de[_0xc880('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a4738,null))[_0xc880('0x28')](function(_0x286fdd){if(_0x286fdd){_0xbffd72=_0x286fdd;_0x22a127[_0xc880('0x30')]=_[_0xc880('0x33')](db[_0xc880('0x4b')][_0xc880('0x2d')]);_0x22a127[_0xc880('0x32')]=_[_0xc880('0x33')](_0x1ad1de[_0xc880('0x32')]);_0x22a127[_0xc880('0x34')]=_[_0xc880('0x35')](_0x22a127['model'],_0x22a127[_0xc880('0x32')]);_0x4fad59[_0xc880('0x36')]=_[_0xc880('0x35')](_0x22a127[_0xc880('0x30')],qs['fields'](_0x1ad1de['query'][_0xc880('0x37')]));_0x4fad59[_0xc880('0x36')]=_0x4fad59[_0xc880('0x36')][_0xc880('0x38')]?_0x4fad59[_0xc880('0x36')]:_0x22a127[_0xc880('0x30')];_0x4fad59[_0xc880('0x4c')]=qs[_0xc880('0x3a')](_0x1ad1de[_0xc880('0x32')][_0xc880('0x3a')]);_0x4fad59[_0xc880('0x3b')]=qs['filters'](_[_0xc880('0x4d')](_0x1ad1de[_0xc880('0x32')],_0x22a127[_0xc880('0x34')]));if(_0x1ad1de[_0xc880('0x32')]['filter']){_0x4fad59[_0xc880('0x3b')]=_[_0xc880('0x3d')](_0x4fad59[_0xc880('0x3b')],{'$or':_[_0xc880('0x31')](_0x4fad59[_0xc880('0x36')],function(_0x152486){var _0x5c7830={};_0x5c7830[_0x152486]={'$like':'%'+_0x1ad1de['query'][_0xc880('0x3c')]+'%'};return _0x5c7830;})});}_0x4fad59=_[_0xc880('0x3d')]({},_0x4fad59,_0x1ad1de[_0xc880('0x44')]);return _0xbffd72[_0xc880('0x48')](_0x4fad59);}})[_0xc880('0x28')](function(_0x157eae){if(_0x157eae){_0x20e5b7=_0x157eae[_0xc880('0x38')];if(!_0x1ad1de[_0xc880('0x32')]['hasOwnProperty'](_0xc880('0x4e'))){_0x4fad59[_0xc880('0x20')]=qs[_0xc880('0x20')](_0x1ad1de[_0xc880('0x32')][_0xc880('0x20')]);_0x4fad59['offset']=qs[_0xc880('0x1e')](_0x1ad1de[_0xc880('0x32')][_0xc880('0x1e')]);}return _0xbffd72['getConfigurations'](_0x4fad59);}})['then'](function(_0x4c6771){if(_0x4c6771){return _0x4c6771?{'count':_0x20e5b7,'rows':_0x4c6771}:null;}})[_0xc880('0x28')](respondWithResult(_0x4a4738,null))[_0xc880('0x41')](handleError(_0x4a4738,null));};exports[_0xc880('0x4f')]=function(_0xcc6fc1,_0x381beb,_0x48d1da){if(_0xcc6fc1[_0xc880('0x47')]['id']){delete _0xcc6fc1[_0xc880('0x47')]['id'];}return db[_0xc880('0x2c')][_0xc880('0x49')]({'where':{'id':_0xcc6fc1['params']['id']}})[_0xc880('0x28')](handleEntityNotFound(_0x381beb,null))[_0xc880('0x28')](function(_0x281322){if(_0x281322){_0xcc6fc1[_0xc880('0x47')]['AccountId']=_0x281322['id'];_0xcc6fc1['body'][_0xc880('0x50')]=integrations['getSubjects'](_0xcc6fc1['body'][_0xc880('0x51')],_0xcc6fc1['body'][_0xc880('0x2f')]);_0xcc6fc1['body']['Descriptions']=integrations[_0xc880('0x52')](_0xcc6fc1['body'][_0xc880('0x51')],_0xcc6fc1[_0xc880('0x47')][_0xc880('0x2f')]);return db[_0xc880('0x4b')][_0xc880('0x46')](_0xcc6fc1['body'],{'include':[{'model':db[_0xc880('0x53')],'as':'Subjects'},{'model':db[_0xc880('0x53')],'as':_0xc880('0x54')}]});}return null;})[_0xc880('0x28')](respondWithResult(_0x381beb,null))[_0xc880('0x41')](handleError(_0x381beb,null));};function getAccessToken(_0x370816){return new Promise(function(_0x3e44e6,_0x2a5a22){var _0x31927e;switch(_0x370816['zone']){case'US':_0x31927e=_0xc880('0x55');break;case'AU':_0x31927e='https://accounts.zoho.com.au';break;case'EU':_0x31927e=_0xc880('0x56');break;case'IN':_0x31927e='https://accounts.zoho.in';break;case'CN':_0x31927e='https://accounts.zoho.com.cn';break;default:_0x31927e=_0xc880('0x56');break;}var _0x41c1de={'method':'POST','uri':_0x31927e+_0xc880('0x57'),'qs':{'refresh_token':_0x370816['refreshToken'],'client_id':_0x370816['clientId'],'client_secret':_0x370816['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x41c1de)['then'](function(_0x4b95b0){if(_0x4b95b0['access_token']){_0x3e44e6(_0x4b95b0[_0xc880('0x58')]);}else{_0x2a5a22(_0xc880('0x59'));}})['catch'](function(_0x2da398){_0x2a5a22(_0x2da398);});});}exports[_0xc880('0x5a')]=function(_0x2e9ffe,_0x413be5,_0x1e1493){var _0x22620c,_0x20d66f,_0x53e429,_0x5788ca,_0x5733f5;return db[_0xc880('0x2c')]['findOne']({'where':{'id':_0x2e9ffe['params']['id']},'attributes':['id',_0xc880('0x5b'),_0xc880('0x5c'),'clientId','clientSecret','serverUrl',_0xc880('0x5d'),_0xc880('0x5e')]})['then'](handleEntityNotFound(_0x413be5,null))[_0xc880('0x28')](function(_0x2a1151){_0x5733f5=_0x2a1151;_0x22620c=_0x5733f5[_0xc880('0x5b')];_0x20d66f=_0x22620c===_0xc880('0x5f')?'eu':'com';_0x53e429=_0x5733f5[_0xc880('0x60')];var _0x2bfb4c=_0x53e429[_0xc880('0x61')](-0x1);if(_0x2bfb4c==='/'||_0x2bfb4c==='\x5c'||_0x2bfb4c===':'){_0x53e429=_0x53e429[_0xc880('0x62')](0x0,_0x53e429[_0xc880('0x63')](_0x2bfb4c));}if(!_0x5733f5[_0xc880('0x5e')]){throw new Error(_0xc880('0x64'));}return getAccessToken(_0x5733f5);})[_0xc880('0x28')](function(_0x46d431){if(_0x46d431){return rp({'method':'GET','uri':util['format'](_0xc880('0x65'),_0x20d66f),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x46d431},'json':!![]});}})['then'](function(_0x1451d3){if(_0x1451d3){if(_0x1451d3['response']&&_0x1451d3[_0xc880('0x66')]['error']){throw new Error(_0x1451d3['response'][_0xc880('0x67')][_0xc880('0x68')]);}var _0x48849c=[];var _0x304285=[];var _0x88190b=['Owner',_0xc880('0x69'),_0xc880('0x6a'),_0xc880('0x6b'),_0xc880('0x6c'),'Call_Result',_0xc880('0x6d'),_0xc880('0x6e')];_0x304285=_[_0xc880('0x6f')](_0x1451d3[_0xc880('0x37')],function(_0x1f3ce8){return _0x88190b['includes'](_0x1f3ce8[_0xc880('0x70')]);});for(var _0x1ff777=0x0;_0x1ff777<_0x304285[_0xc880('0x38')];_0x1ff777++){if(_0x304285[_0x1ff777][_0xc880('0x71')]===![]){_0x48849c['push']({'id':_0x304285[_0x1ff777]['id'],'name':_0x304285[_0x1ff777][_0xc880('0x72')],'custom':_0x304285[_0x1ff777][_0xc880('0x73')],'options':_0x304285[_0x1ff777][_0xc880('0x74')]==='picklist'&&_0x304285[_0x1ff777]['pick_list_values'][_0xc880('0x38')]>-0x1?_[_0xc880('0x31')](_0x304285[_0x1ff777][_0xc880('0x75')],function(_0x3e6d58){return{'name':_0x3e6d58,'value':_0x3e6d58};}):[]});}}return{'count':_0x48849c[_0xc880('0x38')],'rows':_0x48849c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x413be5,null))[_0xc880('0x41')](function(_0x1427f3){var _0x1accbb=_0x2e9ffe[_0xc880('0x32')]['test']?0x1f4:_0x1427f3['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc880('0x5a'),_0x1accbb,JSON['stringify'](_0x1427f3));delete _0x1427f3[_0xc880('0x2b')];if(_0x1accbb===0x191){_0x1accbb=0x190;}_0x413be5[_0xc880('0x1c')](_0x1accbb)[_0xc880('0x76')](_0x2e9ffe[_0xc880('0x32')][_0xc880('0x77')]?{'message':_0xc880('0x78'),'statusCode':_0x1427f3['statusCode']}:_0x1427f3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c31a60f..7ca60b1 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 _0x96c8=['https://accounts.zoho.com.au','code','then','api','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','serverUrl','changed','clientId','clientSecret','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','name','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x96c8,0x1a5));var _0x896c=function(_0x8b89f3,_0x340803){_0x8b89f3=_0x8b89f3-0x0;var _0x27b107=_0x96c8[_0x8b89f3];return _0x27b107;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x896c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x896c('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x896c('0x2'));var attributes=require(_0x896c('0x3'));var integrations=require(_0x896c('0x4'));module['exports']=function(_0x358dcf,_0x5cf54d){return _0x358dcf[_0x896c('0x5')](_0x896c('0x6'),attributes,{'tableName':_0x896c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50c546,_0x4d36ef,_0xbcadc7){if(_0x50c546['changed']('zone')||_0x50c546['changed'](_0x896c('0x8'))||_0x50c546[_0x896c('0x9')](_0x896c('0xa'))||_0x50c546[_0x896c('0x9')](_0x896c('0xb'))||_0x50c546[_0x896c('0x9')]('code')||_0x50c546['changed'](_0x896c('0xc'))){var _0xbf3def,_0xc1640;_0xbf3def=_0x50c546[_0x896c('0x8')];var _0x29f8e3=_0xbf3def['slice'](-0x1);if(_0x29f8e3==='/'||_0x29f8e3==='\x5c'||_0x29f8e3===':'){_0xbf3def=_0xbf3def[_0x896c('0xd')](0x0,_0xbf3def[_0x896c('0xe')](_0x29f8e3));}switch(_0x50c546[_0x896c('0xf')]){case'US':_0xc1640=_0x896c('0x10');break;case'AU':_0xc1640='https://accounts.zoho.com.au';break;case'IN':_0xc1640=_0x896c('0x11');break;case'CN':_0xc1640=_0x896c('0x12');break;default:_0xc1640=_0x896c('0x13');break;}var _0x1f053a={'method':_0x896c('0x14'),'uri':_0xc1640+_0x896c('0x15'),'form':{'grant_type':_0x896c('0x16'),'client_id':_0x50c546[_0x896c('0xa')],'client_secret':_0x50c546[_0x896c('0xb')],'redirect_uri':_0x50c546[_0x896c('0x8')],'code':_0x50c546['code']},'headers':{'Content-Type':_0x896c('0x17')}};return rp(_0x1f053a)['then'](function(_0x32c180){var _0x10aa0a=JSON[_0x896c('0x18')](_0x32c180);if(_0x10aa0a[_0x896c('0x19')]){_0x50c546[_0x896c('0x1a')]=_0x10aa0a[_0x896c('0x19')];logger[_0x896c('0x1b')](util['format'](_0x896c('0x1c'),_0x50c546['name'],_0x50c546['id']));}else{logger[_0x896c('0x1d')](util[_0x896c('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x50c546[_0x896c('0x1f')],_0x50c546['id']),util[_0x896c('0x20')](_0x10aa0a,{'showHidden':![],'depth':null}));}return _0xbcadc7(null,_0x4d36ef);})[_0x896c('0x21')](function(_0x3edf26){logger[_0x896c('0x1d')](util['format'](_0x896c('0x22'),_0x50c546[_0x896c('0x1f')],_0x50c546['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xbcadc7(_0x3edf26);});}else{return _0xbcadc7(null,_0x4d36ef);}},'beforeUpdate':function(_0x247e6c,_0x226bce,_0x26dff9){if(_0x247e6c[_0x896c('0x9')](_0x896c('0xf'))||_0x247e6c[_0x896c('0x9')]('serverUrl')||_0x247e6c['changed'](_0x896c('0xa'))||_0x247e6c[_0x896c('0x9')]('clientSecret')||_0x247e6c[_0x896c('0x9')]('code')||_0x247e6c[_0x896c('0x9')](_0x896c('0xc'))){var _0xf708e9,_0xfe4205;_0xf708e9=_0x247e6c[_0x896c('0x8')];var _0x278218=_0xf708e9['slice'](-0x1);if(_0x278218==='/'||_0x278218==='\x5c'||_0x278218===':'){_0xf708e9=_0xf708e9['substring'](0x0,_0xf708e9[_0x896c('0xe')](_0x278218));}switch(_0x247e6c[_0x896c('0xf')]){case'US':_0xfe4205=_0x896c('0x10');break;case'AU':_0xfe4205=_0x896c('0x23');break;case'IN':_0xfe4205=_0x896c('0x11');break;case'CN':_0xfe4205=_0x896c('0x12');break;default:_0xfe4205=_0x896c('0x13');break;}var _0x597599={'method':_0x896c('0x14'),'uri':_0xfe4205+'/oauth/v2/token','form':{'grant_type':_0x896c('0x16'),'client_id':_0x247e6c[_0x896c('0xa')],'client_secret':_0x247e6c['clientSecret'],'redirect_uri':_0x247e6c[_0x896c('0x8')],'code':_0x247e6c[_0x896c('0x24')]},'headers':{'Content-Type':_0x896c('0x17')}};return rp(_0x597599)[_0x896c('0x25')](function(_0x499185){var _0x1b6922=JSON[_0x896c('0x18')](_0x499185);if(_0x1b6922[_0x896c('0x19')]){_0x247e6c['refreshToken']=_0x1b6922[_0x896c('0x19')];logger[_0x896c('0x1b')](util[_0x896c('0x1e')](_0x896c('0x1c'),_0x247e6c[_0x896c('0x1f')],_0x247e6c['id']));}else{logger[_0x896c('0x1d')](util[_0x896c('0x1e')](_0x896c('0x22'),_0x247e6c['name'],_0x247e6c['id']),util[_0x896c('0x20')](_0x1b6922,{'showHidden':![],'depth':null}));}return _0x26dff9(null,_0x226bce);})[_0x896c('0x21')](function(_0x4b0b09){logger[_0x896c('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x247e6c[_0x896c('0x1f')],_0x247e6c['id']),util[_0x896c('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x26dff9(_0x4b0b09);});}else{return _0x26dff9(null,_0x226bce);}}}});}; \ No newline at end of file +var _0xe243=['zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','https://accounts.zoho.com','https://accounts.zoho.in','POST','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','bluebird','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x271f72,_0x8b9627){var _0x1b4ad1=function(_0x26abcf){while(--_0x26abcf){_0x271f72['push'](_0x271f72['shift']());}};_0x1b4ad1(++_0x8b9627);}(_0xe243,0x116));var _0x3e24=function(_0x39e144,_0x4b4847){_0x39e144=_0x39e144-0x0;var _0x5ba205=_0xe243[_0x39e144];return _0x5ba205;};'use strict';var _=require('lodash');var util=require(_0x3e24('0x0'));var logger=require(_0x3e24('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3e24('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e24('0x3'));var rimraf=require(_0x3e24('0x4'));var config=require('../../config/environment');var attributes=require(_0x3e24('0x5'));var integrations=require(_0x3e24('0x6'));module[_0x3e24('0x7')]=function(_0xba9e21,_0x16ec5f){return _0xba9e21['define']('ZohoAccount',attributes,{'tableName':_0x3e24('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x599520,_0x11ab32,_0x17dc75){if(_0x599520[_0x3e24('0x9')]('zone')||_0x599520[_0x3e24('0x9')](_0x3e24('0xa'))||_0x599520[_0x3e24('0x9')](_0x3e24('0xb'))||_0x599520[_0x3e24('0x9')](_0x3e24('0xc'))||_0x599520['changed'](_0x3e24('0xd'))||_0x599520[_0x3e24('0x9')](_0x3e24('0xe'))){var _0x534e50,_0x2afd12;_0x534e50=_0x599520[_0x3e24('0xa')];var _0x599cef=_0x534e50[_0x3e24('0xf')](-0x1);if(_0x599cef==='/'||_0x599cef==='\x5c'||_0x599cef===':'){_0x534e50=_0x534e50[_0x3e24('0x10')](0x0,_0x534e50[_0x3e24('0x11')](_0x599cef));}switch(_0x599520[_0x3e24('0x12')]){case'US':_0x2afd12='https://accounts.zoho.com';break;case'AU':_0x2afd12=_0x3e24('0x13');break;case'IN':_0x2afd12='https://accounts.zoho.in';break;case'CN':_0x2afd12='https://accounts.zoho.com.cn';break;default:_0x2afd12=_0x3e24('0x14');break;}var _0xf5b192={'method':'POST','uri':_0x2afd12+_0x3e24('0x15'),'form':{'grant_type':_0x3e24('0x16'),'client_id':_0x599520[_0x3e24('0xb')],'client_secret':_0x599520['clientSecret'],'redirect_uri':_0x599520[_0x3e24('0xa')],'code':_0x599520['code']},'headers':{'Content-Type':_0x3e24('0x17')}};return rp(_0xf5b192)['then'](function(_0x171e36){var _0x43e4c1=JSON[_0x3e24('0x18')](_0x171e36);if(_0x43e4c1[_0x3e24('0x19')]){_0x599520[_0x3e24('0x1a')]=_0x43e4c1['refresh_token'];logger['info'](util['format'](_0x3e24('0x1b'),_0x599520[_0x3e24('0x1c')],_0x599520['id']));}else{logger[_0x3e24('0x1d')](util[_0x3e24('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x599520[_0x3e24('0x1c')],_0x599520['id']),util[_0x3e24('0x1f')](_0x43e4c1,{'showHidden':![],'depth':null}));}return _0x17dc75(null,_0x11ab32);})[_0x3e24('0x20')](function(_0x12c42c){logger[_0x3e24('0x1d')](util[_0x3e24('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x599520[_0x3e24('0x1c')],_0x599520['id']),util[_0x3e24('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x17dc75(_0x12c42c);});}else{return _0x17dc75(null,_0x11ab32);}},'beforeUpdate':function(_0x15c27d,_0x4542ec,_0x551e3e){if(_0x15c27d[_0x3e24('0x9')](_0x3e24('0x12'))||_0x15c27d[_0x3e24('0x9')](_0x3e24('0xa'))||_0x15c27d['changed'](_0x3e24('0xb'))||_0x15c27d['changed'](_0x3e24('0xc'))||_0x15c27d[_0x3e24('0x9')]('code')||_0x15c27d[_0x3e24('0x9')](_0x3e24('0xe'))){var _0x580069,_0xc26cd1;_0x580069=_0x15c27d[_0x3e24('0xa')];var _0x35385b=_0x580069[_0x3e24('0xf')](-0x1);if(_0x35385b==='/'||_0x35385b==='\x5c'||_0x35385b===':'){_0x580069=_0x580069[_0x3e24('0x10')](0x0,_0x580069['lastIndexOf'](_0x35385b));}switch(_0x15c27d[_0x3e24('0x12')]){case'US':_0xc26cd1=_0x3e24('0x21');break;case'AU':_0xc26cd1='https://accounts.zoho.com.au';break;case'IN':_0xc26cd1=_0x3e24('0x22');break;case'CN':_0xc26cd1='https://accounts.zoho.com.cn';break;default:_0xc26cd1='https://accounts.zoho.eu';break;}var _0x53f048={'method':_0x3e24('0x23'),'uri':_0xc26cd1+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x15c27d[_0x3e24('0xb')],'client_secret':_0x15c27d[_0x3e24('0xc')],'redirect_uri':_0x15c27d[_0x3e24('0xa')],'code':_0x15c27d[_0x3e24('0xd')]},'headers':{'Content-Type':_0x3e24('0x17')}};return rp(_0x53f048)['then'](function(_0x52ace1){var _0xfd727d=JSON[_0x3e24('0x18')](_0x52ace1);if(_0xfd727d[_0x3e24('0x19')]){_0x15c27d[_0x3e24('0x1a')]=_0xfd727d[_0x3e24('0x19')];logger['info'](util[_0x3e24('0x1e')](_0x3e24('0x1b'),_0x15c27d['name'],_0x15c27d['id']));}else{logger[_0x3e24('0x1d')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x15c27d[_0x3e24('0x1c')],_0x15c27d['id']),util[_0x3e24('0x1f')](_0xfd727d,{'showHidden':![],'depth':null}));}return _0x551e3e(null,_0x4542ec);})[_0x3e24('0x20')](function(_0x275fcd){logger[_0x3e24('0x1d')](util[_0x3e24('0x1e')](_0x3e24('0x24'),_0x15c27d['name'],_0x15c27d['id']),util[_0x3e24('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x551e3e(_0x275fcd);});}else{return _0x551e3e(null,_0x4542ec);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 82ca3bf..ecfb3be 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 _0x1c52=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','catch','ShowZohoAccount','find','raw','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b5744,_0x1d2361){var _0x494b69=function(_0x5b9e94){while(--_0x5b9e94){_0x1b5744['push'](_0x1b5744['shift']());}};_0x494b69(++_0x1d2361);}(_0x1c52,0x7c));var _0x21c5=function(_0x484723,_0x2e2433){_0x484723=_0x484723-0x0;var _0x11a655=_0x1c52[_0x484723];return _0x11a655;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));var BPromise=require(_0x21c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21c5('0x4'));var logger=require(_0x21c5('0x5'))('rpc');var config=require(_0x21c5('0x6'));var jayson=require(_0x21c5('0x7'));var client=jayson[_0x21c5('0x8')][_0x21c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b12d5,_0xed0195,_0xb4b1e4){return new BPromise(function(_0x4c5a4f,_0xd34da2){return client[_0x21c5('0xa')](_0x5b12d5,_0xb4b1e4)[_0x21c5('0xb')](function(_0x27389f){logger['info'](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));logger[_0x21c5('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xed0195,_0x21c5('0xd'),JSON['stringify'](_0x27389f));if(_0x27389f[_0x21c5('0xf')]){if(_0x27389f[_0x21c5('0xf')][_0x21c5('0x10')]===0x1f4){logger[_0x21c5('0xf')]('ZohoAccount,\x20%s,\x20%s',_0xed0195,_0x27389f[_0x21c5('0xf')]['message']);return _0xd34da2(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}logger['error'](_0x21c5('0xc'),_0xed0195,_0x27389f['error']['message']);return _0x4c5a4f(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}else{logger[_0x21c5('0x12')](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));_0x4c5a4f(_0x27389f[_0x21c5('0x13')][_0x21c5('0x11')]);}})['catch'](function(_0x331080){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xed0195,_0x331080);_0xd34da2(_0x331080);});});}exports[_0x21c5('0x14')]=function(_0x56696e){var _0x4daf4d=this;return new Promise(function(_0x1bc8a4,_0x4e630f){return db[_0x21c5('0x15')]['findAll']({'raw':_0x56696e[_0x21c5('0x16')]?_0x56696e['options']['raw']===undefined?!![]:![]:!![],'where':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x17')]||null:null,'attributes':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'limit':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x19')]||null:null,'include':_0x56696e['options']?_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')],function(_0x4bf186){return{'model':db[_0x4bf186[_0x21c5('0x1c')]],'as':_0x4bf186['as'],'attributes':_0x4bf186[_0x21c5('0x18')],'include':_0x4bf186[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4bf186[_0x21c5('0x1a')],function(_0x4d3215){return{'model':db[_0x4d3215['model']],'as':_0x4d3215['as'],'attributes':_0x4d3215[_0x21c5('0x18')],'include':_0x4d3215[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4d3215[_0x21c5('0x1a')],function(_0x2ae029){return{'model':db[_0x2ae029[_0x21c5('0x1c')]],'as':_0x2ae029['as'],'attributes':_0x2ae029['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5918df){logger[_0x21c5('0x12')](_0x21c5('0x14'),_0x56696e);logger[_0x21c5('0xe')](_0x21c5('0x14'),_0x56696e,JSON['stringify'](_0x5918df));_0x1bc8a4(_0x5918df);})[_0x21c5('0x1d')](function(_0x428b60){logger[_0x21c5('0xf')](_0x21c5('0x14'),_0x428b60[_0x21c5('0x11')],_0x56696e);_0x4e630f(_0x4daf4d['error'](0x1f4,_0x428b60['message']));});});};exports[_0x21c5('0x1e')]=function(_0x29a15b){var _0x3353b3=this;return new Promise(function(_0x177ca1,_0x39662b){return db[_0x21c5('0x15')][_0x21c5('0x1f')]({'raw':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x20')]===undefined?!![]:![]:!![],'where':_0x29a15b['options']?_0x29a15b['options'][_0x21c5('0x17')]||null:null,'attributes':_0x29a15b['options']?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'include':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')]['include']?_[_0x21c5('0x1b')](_0x29a15b['options'][_0x21c5('0x1a')],function(_0x5a3308){return{'model':db[_0x5a3308[_0x21c5('0x1c')]],'as':_0x5a3308['as'],'attributes':_0x5a3308[_0x21c5('0x18')],'include':_0x5a3308[_0x21c5('0x1a')]?_['map'](_0x5a3308[_0x21c5('0x1a')],function(_0x4d52ca){return{'model':db[_0x4d52ca[_0x21c5('0x1c')]],'as':_0x4d52ca['as'],'attributes':_0x4d52ca[_0x21c5('0x18')],'include':_0x4d52ca[_0x21c5('0x1a')]?_['map'](_0x4d52ca[_0x21c5('0x1a')],function(_0x535498){return{'model':db[_0x535498['model']],'as':_0x535498['as'],'attributes':_0x535498[_0x21c5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x21c5('0xb')](function(_0x1a25b7){logger[_0x21c5('0x12')]('ShowZohoAccount',_0x29a15b);logger[_0x21c5('0xe')](_0x21c5('0x1e'),_0x29a15b,JSON[_0x21c5('0x21')](_0x1a25b7));_0x177ca1(_0x1a25b7);})[_0x21c5('0x1d')](function(_0x20ec3a){logger[_0x21c5('0xf')](_0x21c5('0x1e'),_0x20ec3a[_0x21c5('0x11')],_0x29a15b);_0x39662b(_0x3353b3['error'](0x1f4,_0x20ec3a[_0x21c5('0x11')]));});});}; \ No newline at end of file +var _0xd481=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','include','map','model','attributes','ShowZohoAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xd481,0x1e4));var _0x1d48=function(_0x52f187,_0x47eb0d){_0x52f187=_0x52f187-0x0;var _0x552957=_0xd481[_0x52f187];return _0x552957;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require(_0x1d48('0x1'));var BPromise=require(_0x1d48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d48('0x3'));var db=require(_0x1d48('0x4'))['db'];var utils=require(_0x1d48('0x5'));var logger=require('../../config/logger')(_0x1d48('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d48('0x7'));var client=jayson[_0x1d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472584,_0x3099cc,_0x3b8bd4){return new BPromise(function(_0x27c383,_0x1fc969){return client[_0x1d48('0x9')](_0x472584,_0x3b8bd4)[_0x1d48('0xa')](function(_0x303dce){logger[_0x1d48('0xb')](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));logger[_0x1d48('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3099cc,_0x1d48('0xd'),JSON[_0x1d48('0xf')](_0x303dce));if(_0x303dce[_0x1d48('0x10')]){if(_0x303dce[_0x1d48('0x10')][_0x1d48('0x11')]===0x1f4){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x1fc969(_0x303dce[_0x1d48('0x10')]['message']);}logger[_0x1d48('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x27c383(_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);}else{logger['info'](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));_0x27c383(_0x303dce[_0x1d48('0x13')]['message']);}})[_0x1d48('0x14')](function(_0x433c92){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x433c92);_0x1fc969(_0x433c92);});});}exports[_0x1d48('0x15')]=function(_0x2a007c){var _0x1bcd95=this;return new Promise(function(_0x258c7a,_0xec25a1){return db['ZohoAccount']['findAll']({'raw':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x17')]===undefined?!![]:![]:!![],'where':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x18')]||null:null,'attributes':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')]['attributes']||null:null,'limit':_0x2a007c[_0x1d48('0x16')]?_0x2a007c[_0x1d48('0x16')]['limit']||null:null,'include':_0x2a007c['options']?_0x2a007c[_0x1d48('0x16')][_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x2a007c[_0x1d48('0x16')][_0x1d48('0x19')],function(_0x20a9ba){return{'model':db[_0x20a9ba[_0x1d48('0x1b')]],'as':_0x20a9ba['as'],'attributes':_0x20a9ba[_0x1d48('0x1c')],'include':_0x20a9ba[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x20a9ba['include'],function(_0x4e44eb){return{'model':db[_0x4e44eb[_0x1d48('0x1b')]],'as':_0x4e44eb['as'],'attributes':_0x4e44eb[_0x1d48('0x1c')],'include':_0x4e44eb[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x4e44eb[_0x1d48('0x19')],function(_0x7631b4){return{'model':db[_0x7631b4['model']],'as':_0x7631b4['as'],'attributes':_0x7631b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d48('0xa')](function(_0x280505){logger['info'](_0x1d48('0x15'),_0x2a007c);logger[_0x1d48('0xe')](_0x1d48('0x15'),_0x2a007c,JSON[_0x1d48('0xf')](_0x280505));_0x258c7a(_0x280505);})['catch'](function(_0x4cac26){logger[_0x1d48('0x10')](_0x1d48('0x15'),_0x4cac26[_0x1d48('0x12')],_0x2a007c);_0xec25a1(_0x1bcd95[_0x1d48('0x10')](0x1f4,_0x4cac26['message']));});});};exports[_0x1d48('0x1d')]=function(_0x3dee70){var _0x41e050=this;return new Promise(function(_0x25408e,_0x3cae45){return db['ZohoAccount'][_0x1d48('0x1e')]({'raw':_0x3dee70[_0x1d48('0x16')]?_0x3dee70[_0x1d48('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3dee70[_0x1d48('0x16')]?_0x3dee70['options']['where']||null:null,'attributes':_0x3dee70[_0x1d48('0x16')]?_0x3dee70[_0x1d48('0x16')][_0x1d48('0x1c')]||null:null,'include':_0x3dee70['options']?_0x3dee70[_0x1d48('0x16')][_0x1d48('0x19')]?_['map'](_0x3dee70[_0x1d48('0x16')][_0x1d48('0x19')],function(_0x189a89){return{'model':db[_0x189a89['model']],'as':_0x189a89['as'],'attributes':_0x189a89[_0x1d48('0x1c')],'include':_0x189a89['include']?_[_0x1d48('0x1a')](_0x189a89[_0x1d48('0x19')],function(_0x3de6be){return{'model':db[_0x3de6be['model']],'as':_0x3de6be['as'],'attributes':_0x3de6be['attributes'],'include':_0x3de6be[_0x1d48('0x19')]?_[_0x1d48('0x1a')](_0x3de6be[_0x1d48('0x19')],function(_0x438a0d){return{'model':db[_0x438a0d[_0x1d48('0x1b')]],'as':_0x438a0d['as'],'attributes':_0x438a0d[_0x1d48('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1d48('0xa')](function(_0x2476fe){logger[_0x1d48('0xb')](_0x1d48('0x1d'),_0x3dee70);logger[_0x1d48('0xe')](_0x1d48('0x1d'),_0x3dee70,JSON[_0x1d48('0xf')](_0x2476fe));_0x25408e(_0x2476fe);})[_0x1d48('0x14')](function(_0x458ec3){logger[_0x1d48('0x10')](_0x1d48('0x1d'),_0x458ec3[_0x1d48('0x12')],_0x3dee70);_0x3cae45(_0x41e050[_0x1d48('0x10')](0x1f4,_0x458ec3[_0x1d48('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9b1e86c..a864d83 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 _0x8d94=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions','post','create','put','update','destroy'];(function(_0x42b902,_0x3c49fd){var _0x2d9d68=function(_0x2175bf){while(--_0x2175bf){_0x42b902['push'](_0x42b902['shift']());}};_0x2d9d68(++_0x3c49fd);}(_0x8d94,0x1e5));var _0x48d9=function(_0x45c6dd,_0x5471de){_0x45c6dd=_0x45c6dd-0x0;var _0x1cf36e=_0x8d94[_0x45c6dd];return _0x1cf36e;};'use strict';var multer=require(_0x48d9('0x0'));var util=require('util');var path=require(_0x48d9('0x1'));var timeout=require(_0x48d9('0x2'));var express=require(_0x48d9('0x3'));var router=express[_0x48d9('0x4')]();var fs_extra=require(_0x48d9('0x5'));var auth=require(_0x48d9('0x6'));var interaction=require(_0x48d9('0x7'));var config=require(_0x48d9('0x8'));var controller=require(_0x48d9('0x9'));router[_0x48d9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x48d9('0xb'),auth[_0x48d9('0xc')](),controller[_0x48d9('0xd')]);router[_0x48d9('0xa')]('/:id/fields',auth[_0x48d9('0xc')](),controller['getFields']);router[_0x48d9('0xa')](_0x48d9('0xe'),auth[_0x48d9('0xc')](),controller['getSubjects']);router[_0x48d9('0xa')](_0x48d9('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x48d9('0x10')]('/',auth[_0x48d9('0xc')](),controller[_0x48d9('0x11')]);router[_0x48d9('0x12')]('/:id',auth[_0x48d9('0xc')](),controller[_0x48d9('0x13')]);router['delete'](_0x48d9('0xb'),auth[_0x48d9('0xc')](),controller[_0x48d9('0x14')]);module[_0x48d9('0x15')]=router; \ No newline at end of file +var _0x1552=['exports','multer','path','express','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy'];(function(_0x535301,_0x230eef){var _0x2caa60=function(_0x429950){while(--_0x429950){_0x535301['push'](_0x535301['shift']());}};_0x2caa60(++_0x230eef);}(_0x1552,0x6a));var _0x2155=function(_0x374870,_0x82a474){_0x374870=_0x374870-0x0;var _0x4de8f4=_0x1552[_0x374870];return _0x4de8f4;};'use strict';var multer=require(_0x2155('0x0'));var util=require('util');var path=require(_0x2155('0x1'));var timeout=require('connect-timeout');var express=require(_0x2155('0x2'));var router=express['Router']();var fs_extra=require(_0x2155('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2155('0x4'));var config=require('../../config/environment');var controller=require(_0x2155('0x5'));router[_0x2155('0x6')]('/',auth[_0x2155('0x7')](),controller[_0x2155('0x8')]);router['get'](_0x2155('0x9'),auth[_0x2155('0x7')](),controller[_0x2155('0xa')]);router['get']('/:id/fields',auth[_0x2155('0x7')](),controller[_0x2155('0xb')]);router[_0x2155('0x6')](_0x2155('0xc'),auth[_0x2155('0x7')](),controller[_0x2155('0xd')]);router[_0x2155('0x6')](_0x2155('0xe'),auth[_0x2155('0x7')](),controller['getDescriptions']);router[_0x2155('0xf')]('/',auth[_0x2155('0x7')](),controller[_0x2155('0x10')]);router['put'](_0x2155('0x9'),auth[_0x2155('0x7')](),controller[_0x2155('0x11')]);router[_0x2155('0x12')](_0x2155('0x9'),auth[_0x2155('0x7')](),controller[_0x2155('0x13')]);module[_0x2155('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2538081..c9e63ac 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 _0x25f6=['exports','STRING','ENUM','nothing','lead','contact_lead','contact','sequelize'];(function(_0x509051,_0x457a40){var _0x3fb3ea=function(_0x59021a){while(--_0x59021a){_0x509051['push'](_0x509051['shift']());}};_0x3fb3ea(++_0x457a40);}(_0x25f6,0x197));var _0x625f=function(_0x31bcbe,_0x4ce65b){_0x31bcbe=_0x31bcbe-0x0;var _0x485320=_0x25f6[_0x31bcbe];return _0x485320;};'use strict';var Sequelize=require(_0x625f('0x0'));module[_0x625f('0x1')]={'name':{'type':Sequelize[_0x625f('0x2')]},'moduleCreate':{'type':Sequelize[_0x625f('0x3')]('lead','contact',_0x625f('0x4')),'defaultValue':_0x625f('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x625f('0x6'),_0x625f('0x7'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x625f('0x2')]}}; \ No newline at end of file +var _0x4202=['sequelize','exports','ENUM','contact','nothing','contact_lead','lead'];(function(_0x51a032,_0x43ab93){var _0x59b1f0=function(_0x4b2969){while(--_0x4b2969){_0x51a032['push'](_0x51a032['shift']());}};_0x59b1f0(++_0x43ab93);}(_0x4202,0x8c));var _0x2420=function(_0x98ac1f,_0x2effb0){_0x98ac1f=_0x98ac1f-0x0;var _0x1579d1=_0x4202[_0x98ac1f];return _0x1579d1;};'use strict';var Sequelize=require(_0x2420('0x0'));module[_0x2420('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x2420('0x2')]('lead',_0x2420('0x3'),_0x2420('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x2420('0x2')](_0x2420('0x5'),'contact',_0x2420('0x6')),'defaultValue':_0x2420('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 51cad50..4007a31 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 _0xaec0=['save','update','then','destroy','end','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x1e3769,_0x1b5754){var _0x2f15e1=function(_0x279e8a){while(--_0x279e8a){_0x1e3769['push'](_0x1e3769['shift']());}};_0x2f15e1(++_0x1b5754);}(_0xaec0,0x1ba));var _0x0aec=function(_0x434337,_0x4a7695){_0x434337=_0x434337-0x0;var _0x1afd41=_0xaec0[_0x434337];return _0x1afd41;};'use strict';var emlformat=require(_0x0aec('0x0'));var rimraf=require(_0x0aec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0aec('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0aec('0x3'));var util=require(_0x0aec('0x4'));var path=require(_0x0aec('0x5'));var sox=require(_0x0aec('0x6'));var csv=require(_0x0aec('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0aec('0x8'));var _=require(_0x0aec('0x9'));var squel=require(_0x0aec('0xa'));var crypto=require(_0x0aec('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0aec('0xc'));var Redis=require(_0x0aec('0xd'));var authService=require(_0x0aec('0xe'));var qs=require(_0x0aec('0xf'));var as=require(_0x0aec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0aec('0x11'))(_0x0aec('0x12'));var utils=require(_0x0aec('0x13'));var config=require(_0x0aec('0x14'));var licenseUtil=require(_0x0aec('0x15'));var db=require(_0x0aec('0x16'))['db'];function respondWithStatusCode(_0x35e24f,_0x1f010e){_0x1f010e=_0x1f010e||0xcc;return function(_0x178ef3){if(_0x178ef3){return _0x35e24f[_0x0aec('0x17')](_0x1f010e);}return _0x35e24f[_0x0aec('0x18')](_0x1f010e)['end']();};}function respondWithResult(_0x35f048,_0x13e016){_0x13e016=_0x13e016||0xc8;return function(_0x36e5d8){if(_0x36e5d8){return _0x35f048[_0x0aec('0x18')](_0x13e016)[_0x0aec('0x19')](_0x36e5d8);}};}function respondWithFilteredResult(_0x25052f,_0xb5a8e3){return function(_0x4e1718){if(_0x4e1718){var _0x194df9=typeof _0xb5a8e3[_0x0aec('0x1a')]==='undefined'&&typeof _0xb5a8e3[_0x0aec('0x1b')]===_0x0aec('0x1c');var _0x4c842a=_0x4e1718[_0x0aec('0x1d')];var _0x25e3a4=_0x194df9?0x0:_0xb5a8e3[_0x0aec('0x1a')];var _0x4c3d34=_0x194df9?_0x4e1718['count']:_0xb5a8e3['offset']+_0xb5a8e3[_0x0aec('0x1b')];var _0x3197a1;if(_0x4c3d34>=_0x4c842a){_0x4c3d34=_0x4c842a;_0x3197a1=0xc8;}else{_0x3197a1=0xce;}_0x25052f[_0x0aec('0x18')](_0x3197a1);return _0x25052f[_0x0aec('0x1e')](_0x0aec('0x1f'),_0x25e3a4+'-'+_0x4c3d34+'/'+_0x4c842a)['json'](_0x4e1718);}return null;};}function patchUpdates(_0xcdb105){return function(_0x47bf6d){try{jsonpatch['apply'](_0x47bf6d,_0xcdb105,!![]);}catch(_0x55be85){return BPromise['reject'](_0x55be85);}return _0x47bf6d[_0x0aec('0x20')]();};}function saveUpdates(_0x5a75bf,_0xfe1a62){return function(_0x1996c0){if(_0x1996c0){return _0x1996c0[_0x0aec('0x21')](_0x5a75bf)[_0x0aec('0x22')](function(_0x1fc6a7){return _0x1fc6a7;});}return null;};}function removeEntity(_0x1af989,_0x379746){return function(_0x2e7d6c){if(_0x2e7d6c){return _0x2e7d6c[_0x0aec('0x23')]()['then'](function(){_0x1af989['status'](0xcc)[_0x0aec('0x24')]();});}};}function handleEntityNotFound(_0x35c05d,_0x109f9a){return function(_0x3e0bc8){if(!_0x3e0bc8){_0x35c05d['sendStatus'](0x194);}return _0x3e0bc8;};}function handleError(_0xf37761,_0x48e660){_0x48e660=_0x48e660||0x1f4;return function(_0x273b2d){logger['error'](_0x273b2d[_0x0aec('0x25')]);if(_0x273b2d['name']){delete _0x273b2d[_0x0aec('0x26')];}_0xf37761[_0x0aec('0x18')](_0x48e660)[_0x0aec('0x27')](_0x273b2d);};}exports[_0x0aec('0x28')]=function(_0x2c1f50,_0x34475b){var _0x383e26={},_0x120679={},_0x1449b6={'count':0x0,'rows':[]};var _0x5841a0=_[_0x0aec('0x29')](db[_0x0aec('0x2a')][_0x0aec('0x2b')],function(_0x468443){return{'name':_0x468443[_0x0aec('0x2c')],'type':_0x468443[_0x0aec('0x2d')]['key']};});_0x120679[_0x0aec('0x2e')]=_[_0x0aec('0x29')](_0x5841a0,_0x0aec('0x26'));_0x120679['query']=_[_0x0aec('0x2f')](_0x2c1f50[_0x0aec('0x30')]);_0x120679[_0x0aec('0x31')]=_[_0x0aec('0x32')](_0x120679[_0x0aec('0x2e')],_0x120679[_0x0aec('0x30')]);_0x383e26[_0x0aec('0x33')]=_[_0x0aec('0x32')](_0x120679[_0x0aec('0x2e')],qs[_0x0aec('0x34')](_0x2c1f50[_0x0aec('0x30')]['fields']));_0x383e26['attributes']=_0x383e26['attributes'][_0x0aec('0x35')]?_0x383e26[_0x0aec('0x33')]:_0x120679['model'];if(!_0x2c1f50['query']['hasOwnProperty'](_0x0aec('0x36'))){_0x383e26[_0x0aec('0x1b')]=qs[_0x0aec('0x1b')](_0x2c1f50['query'][_0x0aec('0x1b')]);_0x383e26[_0x0aec('0x1a')]=qs['offset'](_0x2c1f50[_0x0aec('0x30')][_0x0aec('0x1a')]);}_0x383e26[_0x0aec('0x37')]=qs['sort'](_0x2c1f50[_0x0aec('0x30')][_0x0aec('0x38')]);_0x383e26[_0x0aec('0x39')]=qs[_0x0aec('0x31')](_[_0x0aec('0x3a')](_0x2c1f50[_0x0aec('0x30')],_0x120679['filters']),_0x5841a0);if(_0x2c1f50['query'][_0x0aec('0x3b')]){_0x383e26[_0x0aec('0x39')]=_[_0x0aec('0x3c')](_0x383e26['where'],{'$or':_[_0x0aec('0x29')](_0x5841a0,function(_0x51f8a1){if(_0x51f8a1[_0x0aec('0x2d')]!==_0x0aec('0x3d')){var _0x19dced={};_0x19dced[_0x51f8a1[_0x0aec('0x26')]]={'$like':'%'+_0x2c1f50[_0x0aec('0x30')][_0x0aec('0x3b')]+'%'};return _0x19dced;}})});}_0x383e26=_[_0x0aec('0x3c')]({},_0x383e26,_0x2c1f50[_0x0aec('0x3e')]);var _0x5cc15b={'where':_0x383e26[_0x0aec('0x39')]};return db[_0x0aec('0x2a')][_0x0aec('0x1d')](_0x5cc15b)[_0x0aec('0x22')](function(_0x5d40e2){_0x1449b6[_0x0aec('0x1d')]=_0x5d40e2;if(_0x2c1f50[_0x0aec('0x30')][_0x0aec('0x3f')]){_0x383e26[_0x0aec('0x40')]=[{'all':!![]}];}return db[_0x0aec('0x2a')][_0x0aec('0x41')](_0x383e26);})[_0x0aec('0x22')](function(_0x5890b1){_0x1449b6[_0x0aec('0x42')]=_0x5890b1;return _0x1449b6;})[_0x0aec('0x22')](respondWithFilteredResult(_0x34475b,_0x383e26))[_0x0aec('0x43')](handleError(_0x34475b,null));};exports[_0x0aec('0x44')]=function(_0x193208,_0x5a09d9){var _0x1ebe1d={'raw':![],'where':{'id':_0x193208['params']['id']}},_0x4f9693={};_0x4f9693['model']=_[_0x0aec('0x2f')](db[_0x0aec('0x2a')][_0x0aec('0x2b')]);_0x4f9693[_0x0aec('0x30')]=_[_0x0aec('0x2f')](_0x193208[_0x0aec('0x30')]);_0x4f9693[_0x0aec('0x31')]=_[_0x0aec('0x32')](_0x4f9693[_0x0aec('0x2e')],_0x4f9693[_0x0aec('0x30')]);_0x1ebe1d[_0x0aec('0x33')]=_[_0x0aec('0x32')](_0x4f9693[_0x0aec('0x2e')],qs[_0x0aec('0x34')](_0x193208['query'][_0x0aec('0x34')]));_0x1ebe1d[_0x0aec('0x33')]=_0x1ebe1d[_0x0aec('0x33')][_0x0aec('0x35')]?_0x1ebe1d[_0x0aec('0x33')]:_0x4f9693[_0x0aec('0x2e')];if(_0x193208['query'][_0x0aec('0x3f')]){_0x1ebe1d['include']=[{'all':!![]}];}_0x1ebe1d=_[_0x0aec('0x3c')]({},_0x1ebe1d,_0x193208['options']);return db[_0x0aec('0x2a')][_0x0aec('0x45')](_0x1ebe1d)['then'](handleEntityNotFound(_0x5a09d9,null))[_0x0aec('0x22')](respondWithResult(_0x5a09d9,null))['catch'](handleError(_0x5a09d9,null));};exports['create']=function(_0x5f13e9,_0x43b773){return db[_0x0aec('0x2a')][_0x0aec('0x46')](_0x5f13e9[_0x0aec('0x47')],{})[_0x0aec('0x22')](respondWithResult(_0x43b773,0xc9))[_0x0aec('0x43')](handleError(_0x43b773,null));};exports[_0x0aec('0x21')]=function(_0x9cbf4e,_0x1a4791){if(_0x9cbf4e[_0x0aec('0x47')]['id']){delete _0x9cbf4e['body']['id'];}return db['ZohoConfiguration'][_0x0aec('0x45')]({'where':{'id':_0x9cbf4e['params']['id']}})[_0x0aec('0x22')](handleEntityNotFound(_0x1a4791,null))[_0x0aec('0x22')](saveUpdates(_0x9cbf4e[_0x0aec('0x47')],null))[_0x0aec('0x22')](respondWithResult(_0x1a4791,null))[_0x0aec('0x43')](handleError(_0x1a4791,null));};exports['destroy']=function(_0xe5b805,_0x4ccbb2){return db['ZohoConfiguration'][_0x0aec('0x45')]({'where':{'id':_0xe5b805[_0x0aec('0x48')]['id']}})[_0x0aec('0x22')](handleEntityNotFound(_0x4ccbb2,null))[_0x0aec('0x22')](removeEntity(_0x4ccbb2,null))[_0x0aec('0x43')](handleError(_0x4ccbb2,null));};exports[_0x0aec('0x49')]=function(_0x7985f2,_0x5df1be,_0x2c82e4){var _0x433b8a={};var _0x4a5e82={};var _0x1b5538;var _0x524295;return db[_0x0aec('0x2a')][_0x0aec('0x4a')]({'where':{'id':_0x7985f2['params']['id']}})[_0x0aec('0x22')](handleEntityNotFound(_0x5df1be,null))[_0x0aec('0x22')](function(_0x9e59a2){if(_0x9e59a2){_0x1b5538=_0x9e59a2;_0x4a5e82[_0x0aec('0x2e')]=_['keys'](db[_0x0aec('0x4b')][_0x0aec('0x2b')]);_0x4a5e82[_0x0aec('0x30')]=_[_0x0aec('0x2f')](_0x7985f2['query']);_0x4a5e82[_0x0aec('0x31')]=_[_0x0aec('0x32')](_0x4a5e82[_0x0aec('0x2e')],_0x4a5e82[_0x0aec('0x30')]);_0x433b8a[_0x0aec('0x33')]=_['intersection'](_0x4a5e82[_0x0aec('0x2e')],qs[_0x0aec('0x34')](_0x7985f2[_0x0aec('0x30')][_0x0aec('0x34')]));_0x433b8a[_0x0aec('0x33')]=_0x433b8a[_0x0aec('0x33')][_0x0aec('0x35')]?_0x433b8a[_0x0aec('0x33')]:_0x4a5e82[_0x0aec('0x2e')];_0x433b8a[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_0x7985f2[_0x0aec('0x30')][_0x0aec('0x38')]);_0x433b8a['where']=qs[_0x0aec('0x31')](_[_0x0aec('0x3a')](_0x7985f2[_0x0aec('0x30')],_0x4a5e82['filters']));if(_0x7985f2['query']['filter']){_0x433b8a['where']=_[_0x0aec('0x3c')](_0x433b8a[_0x0aec('0x39')],{'$or':_[_0x0aec('0x29')](_0x433b8a[_0x0aec('0x33')],function(_0x1809cd){var _0x1e250b={};_0x1e250b[_0x1809cd]={'$like':'%'+_0x7985f2[_0x0aec('0x30')][_0x0aec('0x3b')]+'%'};return _0x1e250b;})});}_0x433b8a=_[_0x0aec('0x3c')]({},_0x433b8a,_0x7985f2[_0x0aec('0x3e')]);return _0x1b5538[_0x0aec('0x49')](_0x433b8a);}})['then'](function(_0x46105e){if(_0x46105e){_0x524295=_0x46105e['length'];if(!_0x7985f2[_0x0aec('0x30')][_0x0aec('0x4c')]('nolimit')){_0x433b8a[_0x0aec('0x1b')]=qs[_0x0aec('0x1b')](_0x7985f2[_0x0aec('0x30')]['limit']);_0x433b8a['offset']=qs[_0x0aec('0x1a')](_0x7985f2[_0x0aec('0x30')][_0x0aec('0x1a')]);}return _0x1b5538[_0x0aec('0x49')](_0x433b8a);}})[_0x0aec('0x22')](function(_0x3987fa){if(_0x3987fa){return _0x3987fa?{'count':_0x524295,'rows':_0x3987fa}:null;}})[_0x0aec('0x22')](respondWithResult(_0x5df1be,null))[_0x0aec('0x43')](handleError(_0x5df1be,null));};exports[_0x0aec('0x4d')]=function(_0x4209bf,_0x3557ee,_0x2a6782){var _0xdcd426={};var _0x91ad3d={};var _0x994809;var _0x32ef7c;return db['ZohoConfiguration'][_0x0aec('0x4a')]({'where':{'id':_0x4209bf[_0x0aec('0x48')]['id']}})[_0x0aec('0x22')](handleEntityNotFound(_0x3557ee,null))[_0x0aec('0x22')](function(_0x3cdd30){if(_0x3cdd30){_0x994809=_0x3cdd30;_0x91ad3d[_0x0aec('0x2e')]=_['keys'](db[_0x0aec('0x4b')][_0x0aec('0x2b')]);_0x91ad3d['query']=_[_0x0aec('0x2f')](_0x4209bf[_0x0aec('0x30')]);_0x91ad3d[_0x0aec('0x31')]=_[_0x0aec('0x32')](_0x91ad3d[_0x0aec('0x2e')],_0x91ad3d[_0x0aec('0x30')]);_0xdcd426['attributes']=_['intersection'](_0x91ad3d[_0x0aec('0x2e')],qs[_0x0aec('0x34')](_0x4209bf[_0x0aec('0x30')]['fields']));_0xdcd426[_0x0aec('0x33')]=_0xdcd426[_0x0aec('0x33')][_0x0aec('0x35')]?_0xdcd426['attributes']:_0x91ad3d[_0x0aec('0x2e')];_0xdcd426[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_0x4209bf['query'][_0x0aec('0x38')]);_0xdcd426[_0x0aec('0x39')]=qs[_0x0aec('0x31')](_['pick'](_0x4209bf[_0x0aec('0x30')],_0x91ad3d[_0x0aec('0x31')]));if(_0x4209bf[_0x0aec('0x30')][_0x0aec('0x3b')]){_0xdcd426[_0x0aec('0x39')]=_[_0x0aec('0x3c')](_0xdcd426[_0x0aec('0x39')],{'$or':_[_0x0aec('0x29')](_0xdcd426[_0x0aec('0x33')],function(_0xb98056){var _0x5102df={};_0x5102df[_0xb98056]={'$like':'%'+_0x4209bf[_0x0aec('0x30')][_0x0aec('0x3b')]+'%'};return _0x5102df;})});}_0xdcd426=_['merge']({},_0xdcd426,_0x4209bf['options']);return _0x994809[_0x0aec('0x4d')](_0xdcd426);}})['then'](function(_0x55eede){if(_0x55eede){_0x32ef7c=_0x55eede['length'];if(!_0x4209bf['query']['hasOwnProperty'](_0x0aec('0x36'))){_0xdcd426[_0x0aec('0x1b')]=qs['limit'](_0x4209bf[_0x0aec('0x30')]['limit']);_0xdcd426[_0x0aec('0x1a')]=qs[_0x0aec('0x1a')](_0x4209bf['query'][_0x0aec('0x1a')]);}return _0x994809[_0x0aec('0x4d')](_0xdcd426);}})['then'](function(_0x1cec7c){if(_0x1cec7c){return _0x1cec7c?{'count':_0x32ef7c,'rows':_0x1cec7c}:null;}})[_0x0aec('0x22')](respondWithResult(_0x3557ee,null))[_0x0aec('0x43')](handleError(_0x3557ee,null));};exports[_0x0aec('0x4e')]=function(_0x2d5d87,_0x531ebd,_0x3f3dd7){var _0x30358c={};var _0x376fe3={};var _0x5d9f7b;var _0x41c360;return db[_0x0aec('0x2a')][_0x0aec('0x4a')]({'where':{'id':_0x2d5d87[_0x0aec('0x48')]['id']}})[_0x0aec('0x22')](handleEntityNotFound(_0x531ebd,null))[_0x0aec('0x22')](function(_0x25b264){if(_0x25b264){_0x5d9f7b=_0x25b264;_0x376fe3[_0x0aec('0x2e')]=_[_0x0aec('0x2f')](db[_0x0aec('0x4b')]['rawAttributes']);_0x376fe3['query']=_[_0x0aec('0x2f')](_0x2d5d87[_0x0aec('0x30')]);_0x376fe3[_0x0aec('0x31')]=_[_0x0aec('0x32')](_0x376fe3[_0x0aec('0x2e')],_0x376fe3['query']);_0x30358c[_0x0aec('0x33')]=_[_0x0aec('0x32')](_0x376fe3[_0x0aec('0x2e')],qs[_0x0aec('0x34')](_0x2d5d87[_0x0aec('0x30')]['fields']));_0x30358c['attributes']=_0x30358c[_0x0aec('0x33')][_0x0aec('0x35')]?_0x30358c['attributes']:_0x376fe3[_0x0aec('0x2e')];_0x30358c[_0x0aec('0x37')]=qs[_0x0aec('0x38')](_0x2d5d87[_0x0aec('0x30')]['sort']);_0x30358c['where']=qs[_0x0aec('0x31')](_[_0x0aec('0x3a')](_0x2d5d87[_0x0aec('0x30')],_0x376fe3['filters']));if(_0x2d5d87[_0x0aec('0x30')][_0x0aec('0x3b')]){_0x30358c[_0x0aec('0x39')]=_[_0x0aec('0x3c')](_0x30358c[_0x0aec('0x39')],{'$or':_[_0x0aec('0x29')](_0x30358c[_0x0aec('0x33')],function(_0x48ed47){var _0x4bb7d1={};_0x4bb7d1[_0x48ed47]={'$like':'%'+_0x2d5d87[_0x0aec('0x30')]['filter']+'%'};return _0x4bb7d1;})});}_0x30358c=_['merge']({},_0x30358c,_0x2d5d87[_0x0aec('0x3e')]);return _0x5d9f7b['getDescriptions'](_0x30358c);}})[_0x0aec('0x22')](function(_0x325900){if(_0x325900){_0x41c360=_0x325900[_0x0aec('0x35')];if(!_0x2d5d87[_0x0aec('0x30')][_0x0aec('0x4c')](_0x0aec('0x36'))){_0x30358c['limit']=qs[_0x0aec('0x1b')](_0x2d5d87[_0x0aec('0x30')][_0x0aec('0x1b')]);_0x30358c['offset']=qs[_0x0aec('0x1a')](_0x2d5d87['query']['offset']);}return _0x5d9f7b[_0x0aec('0x4e')](_0x30358c);}})[_0x0aec('0x22')](function(_0xa024a1){if(_0xa024a1){return _0xa024a1?{'count':_0x41c360,'rows':_0xa024a1}:null;}})[_0x0aec('0x22')](respondWithResult(_0x531ebd,null))[_0x0aec('0x43')](handleError(_0x531ebd,null));}; \ No newline at end of file +var _0x9969=['mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','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','send','index','ZohoConfiguration','rawAttributes','type','key','map','name','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x4ad60b,_0x3056fc){var _0x54a32e=function(_0x54c2c8){while(--_0x54c2c8){_0x4ad60b['push'](_0x4ad60b['shift']());}};_0x54a32e(++_0x3056fc);}(_0x9969,0x19a));var _0x9996=function(_0x3ae1d5,_0x206382){_0x3ae1d5=_0x3ae1d5-0x0;var _0x5e7d02=_0x9969[_0x3ae1d5];return _0x5e7d02;};'use strict';var emlformat=require(_0x9996('0x0'));var rimraf=require(_0x9996('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9996('0x2'));var rp=require('request-promise');var moment=require(_0x9996('0x3'));var BPromise=require(_0x9996('0x4'));var Mustache=require(_0x9996('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9996('0x6'));var csv=require(_0x9996('0x7'));var ejs=require(_0x9996('0x8'));var fs=require('fs');var fs_extra=require(_0x9996('0x9'));var _=require(_0x9996('0xa'));var squel=require(_0x9996('0xb'));var crypto=require(_0x9996('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9996('0xd'));var toCsv=require(_0x9996('0x7'));var querystring=require(_0x9996('0xe'));var Papa=require(_0x9996('0xf'));var Redis=require(_0x9996('0x10'));var authService=require(_0x9996('0x11'));var qs=require(_0x9996('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9996('0x13'));var logger=require(_0x9996('0x14'))(_0x9996('0x15'));var utils=require('../../config/utils');var config=require(_0x9996('0x16'));var licenseUtil=require(_0x9996('0x17'));var db=require(_0x9996('0x18'))['db'];function respondWithStatusCode(_0x29a79f,_0x5865c6){_0x5865c6=_0x5865c6||0xcc;return function(_0xf8ae76){if(_0xf8ae76){return _0x29a79f[_0x9996('0x19')](_0x5865c6);}return _0x29a79f['status'](_0x5865c6)['end']();};}function respondWithResult(_0x2a4e5e,_0x330fe0){_0x330fe0=_0x330fe0||0xc8;return function(_0x531608){if(_0x531608){return _0x2a4e5e[_0x9996('0x1a')](_0x330fe0)['json'](_0x531608);}};}function respondWithFilteredResult(_0x393478,_0x3e1a44){return function(_0x56a6cd){if(_0x56a6cd){var _0x1bcdf0=typeof _0x3e1a44[_0x9996('0x1b')]===_0x9996('0x1c')&&typeof _0x3e1a44[_0x9996('0x1d')]==='undefined';var _0xe4bc3f=_0x56a6cd[_0x9996('0x1e')];var _0x494815=_0x1bcdf0?0x0:_0x3e1a44['offset'];var _0x17c02c=_0x1bcdf0?_0x56a6cd[_0x9996('0x1e')]:_0x3e1a44[_0x9996('0x1b')]+_0x3e1a44[_0x9996('0x1d')];var _0x10d448;if(_0x17c02c>=_0xe4bc3f){_0x17c02c=_0xe4bc3f;_0x10d448=0xc8;}else{_0x10d448=0xce;}_0x393478[_0x9996('0x1a')](_0x10d448);return _0x393478[_0x9996('0x1f')](_0x9996('0x20'),_0x494815+'-'+_0x17c02c+'/'+_0xe4bc3f)[_0x9996('0x21')](_0x56a6cd);}return null;};}function patchUpdates(_0x2b58eb){return function(_0x3efed2){try{jsonpatch[_0x9996('0x22')](_0x3efed2,_0x2b58eb,!![]);}catch(_0x63e533){return BPromise[_0x9996('0x23')](_0x63e533);}return _0x3efed2[_0x9996('0x24')]();};}function saveUpdates(_0x5b94da,_0x4be2a2){return function(_0x2f8d67){if(_0x2f8d67){return _0x2f8d67[_0x9996('0x25')](_0x5b94da)[_0x9996('0x26')](function(_0x5b5af6){return _0x5b5af6;});}return null;};}function removeEntity(_0x510f3e,_0x387307){return function(_0x27f365){if(_0x27f365){return _0x27f365[_0x9996('0x27')]()[_0x9996('0x26')](function(){_0x510f3e[_0x9996('0x1a')](0xcc)[_0x9996('0x28')]();});}};}function handleEntityNotFound(_0x22dbb3,_0xd0cd){return function(_0x3cc0ea){if(!_0x3cc0ea){_0x22dbb3[_0x9996('0x19')](0x194);}return _0x3cc0ea;};}function handleError(_0x959a7,_0x1c9f19){_0x1c9f19=_0x1c9f19||0x1f4;return function(_0x35ec47){logger[_0x9996('0x29')](_0x35ec47[_0x9996('0x2a')]);if(_0x35ec47['name']){delete _0x35ec47['name'];}_0x959a7[_0x9996('0x1a')](_0x1c9f19)[_0x9996('0x2b')](_0x35ec47);};}exports[_0x9996('0x2c')]=function(_0x495242,_0x51b887){var _0x32e2e9={},_0x16a7ba={},_0x50ce27={'count':0x0,'rows':[]};var _0x4d08ac=_['map'](db[_0x9996('0x2d')][_0x9996('0x2e')],function(_0x5877d8){return{'name':_0x5877d8['fieldName'],'type':_0x5877d8[_0x9996('0x2f')][_0x9996('0x30')]};});_0x16a7ba['model']=_[_0x9996('0x31')](_0x4d08ac,_0x9996('0x32'));_0x16a7ba[_0x9996('0x33')]=_[_0x9996('0x34')](_0x495242[_0x9996('0x33')]);_0x16a7ba['filters']=_['intersection'](_0x16a7ba[_0x9996('0x35')],_0x16a7ba[_0x9996('0x33')]);_0x32e2e9[_0x9996('0x36')]=_[_0x9996('0x37')](_0x16a7ba['model'],qs[_0x9996('0x38')](_0x495242['query'][_0x9996('0x38')]));_0x32e2e9['attributes']=_0x32e2e9[_0x9996('0x36')][_0x9996('0x39')]?_0x32e2e9[_0x9996('0x36')]:_0x16a7ba[_0x9996('0x35')];if(!_0x495242[_0x9996('0x33')][_0x9996('0x3a')](_0x9996('0x3b'))){_0x32e2e9['limit']=qs['limit'](_0x495242[_0x9996('0x33')][_0x9996('0x1d')]);_0x32e2e9[_0x9996('0x1b')]=qs[_0x9996('0x1b')](_0x495242[_0x9996('0x33')][_0x9996('0x1b')]);}_0x32e2e9[_0x9996('0x3c')]=qs[_0x9996('0x3d')](_0x495242[_0x9996('0x33')][_0x9996('0x3d')]);_0x32e2e9[_0x9996('0x3e')]=qs[_0x9996('0x3f')](_[_0x9996('0x40')](_0x495242[_0x9996('0x33')],_0x16a7ba[_0x9996('0x3f')]),_0x4d08ac);if(_0x495242[_0x9996('0x33')][_0x9996('0x41')]){_0x32e2e9[_0x9996('0x3e')]=_[_0x9996('0x42')](_0x32e2e9[_0x9996('0x3e')],{'$or':_[_0x9996('0x31')](_0x4d08ac,function(_0x343cce){if(_0x343cce[_0x9996('0x2f')]!==_0x9996('0x43')){var _0x11845b={};_0x11845b[_0x343cce[_0x9996('0x32')]]={'$like':'%'+_0x495242['query'][_0x9996('0x41')]+'%'};return _0x11845b;}})});}_0x32e2e9=_['merge']({},_0x32e2e9,_0x495242['options']);var _0x37f7c5={'where':_0x32e2e9[_0x9996('0x3e')]};return db[_0x9996('0x2d')]['count'](_0x37f7c5)[_0x9996('0x26')](function(_0xd2577){_0x50ce27[_0x9996('0x1e')]=_0xd2577;if(_0x495242[_0x9996('0x33')][_0x9996('0x44')]){_0x32e2e9[_0x9996('0x45')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x9996('0x46')](_0x32e2e9);})['then'](function(_0x2709b8){_0x50ce27[_0x9996('0x47')]=_0x2709b8;return _0x50ce27;})[_0x9996('0x26')](respondWithFilteredResult(_0x51b887,_0x32e2e9))['catch'](handleError(_0x51b887,null));};exports[_0x9996('0x48')]=function(_0x249ab0,_0x560d60){var _0x5b8468={'raw':![],'where':{'id':_0x249ab0[_0x9996('0x49')]['id']}},_0x25cc93={};_0x25cc93[_0x9996('0x35')]=_['keys'](db[_0x9996('0x2d')]['rawAttributes']);_0x25cc93[_0x9996('0x33')]=_[_0x9996('0x34')](_0x249ab0[_0x9996('0x33')]);_0x25cc93[_0x9996('0x3f')]=_[_0x9996('0x37')](_0x25cc93[_0x9996('0x35')],_0x25cc93['query']);_0x5b8468[_0x9996('0x36')]=_[_0x9996('0x37')](_0x25cc93[_0x9996('0x35')],qs[_0x9996('0x38')](_0x249ab0[_0x9996('0x33')]['fields']));_0x5b8468['attributes']=_0x5b8468[_0x9996('0x36')][_0x9996('0x39')]?_0x5b8468[_0x9996('0x36')]:_0x25cc93[_0x9996('0x35')];if(_0x249ab0[_0x9996('0x33')][_0x9996('0x44')]){_0x5b8468[_0x9996('0x45')]=[{'all':!![]}];}_0x5b8468=_[_0x9996('0x42')]({},_0x5b8468,_0x249ab0[_0x9996('0x4a')]);return db[_0x9996('0x2d')]['find'](_0x5b8468)[_0x9996('0x26')](handleEntityNotFound(_0x560d60,null))['then'](respondWithResult(_0x560d60,null))[_0x9996('0x4b')](handleError(_0x560d60,null));};exports[_0x9996('0x4c')]=function(_0x385dc1,_0xdb3d98){return db[_0x9996('0x2d')][_0x9996('0x4c')](_0x385dc1[_0x9996('0x4d')],{})[_0x9996('0x26')](respondWithResult(_0xdb3d98,0xc9))[_0x9996('0x4b')](handleError(_0xdb3d98,null));};exports[_0x9996('0x25')]=function(_0x15ec8a,_0x3722e6){if(_0x15ec8a[_0x9996('0x4d')]['id']){delete _0x15ec8a[_0x9996('0x4d')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x15ec8a['params']['id']}})[_0x9996('0x26')](handleEntityNotFound(_0x3722e6,null))[_0x9996('0x26')](saveUpdates(_0x15ec8a[_0x9996('0x4d')],null))[_0x9996('0x26')](respondWithResult(_0x3722e6,null))['catch'](handleError(_0x3722e6,null));};exports[_0x9996('0x27')]=function(_0x39e0c0,_0x3cdad4){return db['ZohoConfiguration'][_0x9996('0x4e')]({'where':{'id':_0x39e0c0[_0x9996('0x49')]['id']}})[_0x9996('0x26')](handleEntityNotFound(_0x3cdad4,null))[_0x9996('0x26')](removeEntity(_0x3cdad4,null))['catch'](handleError(_0x3cdad4,null));};exports[_0x9996('0x4f')]=function(_0xb2df46,_0x50e7f7,_0x266c1d){var _0x2e14bb={};var _0x1a2798={};var _0x1d1e1c;var _0x45e17b;return db[_0x9996('0x2d')]['findOne']({'where':{'id':_0xb2df46[_0x9996('0x49')]['id']}})['then'](handleEntityNotFound(_0x50e7f7,null))[_0x9996('0x26')](function(_0x207a82){if(_0x207a82){_0x1d1e1c=_0x207a82;_0x1a2798[_0x9996('0x35')]=_[_0x9996('0x34')](db['ZohoField'][_0x9996('0x2e')]);_0x1a2798[_0x9996('0x33')]=_['keys'](_0xb2df46[_0x9996('0x33')]);_0x1a2798[_0x9996('0x3f')]=_[_0x9996('0x37')](_0x1a2798[_0x9996('0x35')],_0x1a2798[_0x9996('0x33')]);_0x2e14bb[_0x9996('0x36')]=_['intersection'](_0x1a2798[_0x9996('0x35')],qs['fields'](_0xb2df46[_0x9996('0x33')][_0x9996('0x38')]));_0x2e14bb[_0x9996('0x36')]=_0x2e14bb['attributes'][_0x9996('0x39')]?_0x2e14bb[_0x9996('0x36')]:_0x1a2798[_0x9996('0x35')];_0x2e14bb[_0x9996('0x3c')]=qs[_0x9996('0x3d')](_0xb2df46[_0x9996('0x33')]['sort']);_0x2e14bb[_0x9996('0x3e')]=qs['filters'](_['pick'](_0xb2df46[_0x9996('0x33')],_0x1a2798[_0x9996('0x3f')]));if(_0xb2df46['query']['filter']){_0x2e14bb['where']=_[_0x9996('0x42')](_0x2e14bb['where'],{'$or':_[_0x9996('0x31')](_0x2e14bb['attributes'],function(_0x53d780){var _0x5a99c8={};_0x5a99c8[_0x53d780]={'$like':'%'+_0xb2df46['query'][_0x9996('0x41')]+'%'};return _0x5a99c8;})});}_0x2e14bb=_['merge']({},_0x2e14bb,_0xb2df46[_0x9996('0x4a')]);return _0x1d1e1c['getFields'](_0x2e14bb);}})[_0x9996('0x26')](function(_0x1e8e65){if(_0x1e8e65){_0x45e17b=_0x1e8e65[_0x9996('0x39')];if(!_0xb2df46[_0x9996('0x33')][_0x9996('0x3a')](_0x9996('0x3b'))){_0x2e14bb['limit']=qs[_0x9996('0x1d')](_0xb2df46[_0x9996('0x33')][_0x9996('0x1d')]);_0x2e14bb[_0x9996('0x1b')]=qs[_0x9996('0x1b')](_0xb2df46[_0x9996('0x33')][_0x9996('0x1b')]);}return _0x1d1e1c[_0x9996('0x4f')](_0x2e14bb);}})[_0x9996('0x26')](function(_0x536b6d){if(_0x536b6d){return _0x536b6d?{'count':_0x45e17b,'rows':_0x536b6d}:null;}})[_0x9996('0x26')](respondWithResult(_0x50e7f7,null))[_0x9996('0x4b')](handleError(_0x50e7f7,null));};exports[_0x9996('0x50')]=function(_0x49263c,_0x1fe011,_0x5794e9){var _0x3bdc4b={};var _0x2c9588={};var _0x261ca5;var _0xbdb953;return db[_0x9996('0x2d')][_0x9996('0x51')]({'where':{'id':_0x49263c[_0x9996('0x49')]['id']}})[_0x9996('0x26')](handleEntityNotFound(_0x1fe011,null))[_0x9996('0x26')](function(_0x42b566){if(_0x42b566){_0x261ca5=_0x42b566;_0x2c9588['model']=_['keys'](db['ZohoField'][_0x9996('0x2e')]);_0x2c9588['query']=_[_0x9996('0x34')](_0x49263c[_0x9996('0x33')]);_0x2c9588[_0x9996('0x3f')]=_['intersection'](_0x2c9588[_0x9996('0x35')],_0x2c9588[_0x9996('0x33')]);_0x3bdc4b[_0x9996('0x36')]=_[_0x9996('0x37')](_0x2c9588[_0x9996('0x35')],qs[_0x9996('0x38')](_0x49263c[_0x9996('0x33')][_0x9996('0x38')]));_0x3bdc4b[_0x9996('0x36')]=_0x3bdc4b[_0x9996('0x36')][_0x9996('0x39')]?_0x3bdc4b[_0x9996('0x36')]:_0x2c9588[_0x9996('0x35')];_0x3bdc4b['order']=qs['sort'](_0x49263c[_0x9996('0x33')]['sort']);_0x3bdc4b['where']=qs['filters'](_[_0x9996('0x40')](_0x49263c['query'],_0x2c9588[_0x9996('0x3f')]));if(_0x49263c['query']['filter']){_0x3bdc4b[_0x9996('0x3e')]=_[_0x9996('0x42')](_0x3bdc4b[_0x9996('0x3e')],{'$or':_[_0x9996('0x31')](_0x3bdc4b[_0x9996('0x36')],function(_0x197a03){var _0xfb2bb7={};_0xfb2bb7[_0x197a03]={'$like':'%'+_0x49263c[_0x9996('0x33')]['filter']+'%'};return _0xfb2bb7;})});}_0x3bdc4b=_['merge']({},_0x3bdc4b,_0x49263c[_0x9996('0x4a')]);return _0x261ca5['getSubjects'](_0x3bdc4b);}})[_0x9996('0x26')](function(_0x1324ee){if(_0x1324ee){_0xbdb953=_0x1324ee['length'];if(!_0x49263c[_0x9996('0x33')][_0x9996('0x3a')](_0x9996('0x3b'))){_0x3bdc4b['limit']=qs[_0x9996('0x1d')](_0x49263c[_0x9996('0x33')]['limit']);_0x3bdc4b[_0x9996('0x1b')]=qs[_0x9996('0x1b')](_0x49263c[_0x9996('0x33')][_0x9996('0x1b')]);}return _0x261ca5['getSubjects'](_0x3bdc4b);}})[_0x9996('0x26')](function(_0x54e664){if(_0x54e664){return _0x54e664?{'count':_0xbdb953,'rows':_0x54e664}:null;}})[_0x9996('0x26')](respondWithResult(_0x1fe011,null))[_0x9996('0x4b')](handleError(_0x1fe011,null));};exports['getDescriptions']=function(_0x577925,_0x244c69,_0x280184){var _0x56e63b={};var _0x23c287={};var _0x138198;var _0x4f6915;return db['ZohoConfiguration'][_0x9996('0x51')]({'where':{'id':_0x577925['params']['id']}})[_0x9996('0x26')](handleEntityNotFound(_0x244c69,null))[_0x9996('0x26')](function(_0x4edb72){if(_0x4edb72){_0x138198=_0x4edb72;_0x23c287[_0x9996('0x35')]=_[_0x9996('0x34')](db['ZohoField'][_0x9996('0x2e')]);_0x23c287[_0x9996('0x33')]=_[_0x9996('0x34')](_0x577925[_0x9996('0x33')]);_0x23c287[_0x9996('0x3f')]=_[_0x9996('0x37')](_0x23c287[_0x9996('0x35')],_0x23c287[_0x9996('0x33')]);_0x56e63b[_0x9996('0x36')]=_[_0x9996('0x37')](_0x23c287[_0x9996('0x35')],qs[_0x9996('0x38')](_0x577925[_0x9996('0x33')]['fields']));_0x56e63b[_0x9996('0x36')]=_0x56e63b['attributes'][_0x9996('0x39')]?_0x56e63b['attributes']:_0x23c287[_0x9996('0x35')];_0x56e63b[_0x9996('0x3c')]=qs['sort'](_0x577925[_0x9996('0x33')]['sort']);_0x56e63b[_0x9996('0x3e')]=qs[_0x9996('0x3f')](_[_0x9996('0x40')](_0x577925['query'],_0x23c287[_0x9996('0x3f')]));if(_0x577925[_0x9996('0x33')]['filter']){_0x56e63b['where']=_[_0x9996('0x42')](_0x56e63b[_0x9996('0x3e')],{'$or':_[_0x9996('0x31')](_0x56e63b[_0x9996('0x36')],function(_0x3fa3d2){var _0x81ef8c={};_0x81ef8c[_0x3fa3d2]={'$like':'%'+_0x577925[_0x9996('0x33')][_0x9996('0x41')]+'%'};return _0x81ef8c;})});}_0x56e63b=_[_0x9996('0x42')]({},_0x56e63b,_0x577925[_0x9996('0x4a')]);return _0x138198[_0x9996('0x52')](_0x56e63b);}})[_0x9996('0x26')](function(_0x4cb655){if(_0x4cb655){_0x4f6915=_0x4cb655['length'];if(!_0x577925['query'][_0x9996('0x3a')](_0x9996('0x3b'))){_0x56e63b[_0x9996('0x1d')]=qs['limit'](_0x577925[_0x9996('0x33')][_0x9996('0x1d')]);_0x56e63b[_0x9996('0x1b')]=qs[_0x9996('0x1b')](_0x577925[_0x9996('0x33')][_0x9996('0x1b')]);}return _0x138198[_0x9996('0x52')](_0x56e63b);}})['then'](function(_0x515d3c){if(_0x515d3c){return _0x515d3c?{'count':_0x4f6915,'rows':_0x515d3c}:null;}})[_0x9996('0x26')](respondWithResult(_0x244c69,null))[_0x9996('0x4b')](handleError(_0x244c69,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 47c6088..82f93e0 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 _0x25fb=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x151583,_0x4ee353){var _0x36661c=function(_0x37889a){while(--_0x37889a){_0x151583['push'](_0x151583['shift']());}};_0x36661c(++_0x4ee353);}(_0x25fb,0xb0));var _0xb25f=function(_0x61b83,_0xd6768e){_0x61b83=_0x61b83-0x0;var _0x1b9756=_0x25fb[_0x61b83];return _0x1b9756;};'use strict';var _=require(_0xb25f('0x0'));var util=require(_0xb25f('0x1'));var logger=require('../../config/logger')(_0xb25f('0x2'));var moment=require(_0xb25f('0x3'));var BPromise=require(_0xb25f('0x4'));var rp=require(_0xb25f('0x5'));var fs=require('fs');var path=require(_0xb25f('0x6'));var rimraf=require(_0xb25f('0x7'));var config=require(_0xb25f('0x8'));var attributes=require(_0xb25f('0x9'));module[_0xb25f('0xa')]=function(_0x54b218,_0x8c78fa){return _0x54b218[_0xb25f('0xb')]('ZohoConfiguration',attributes,{'tableName':_0xb25f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee03=['int_zoho_configurations','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x51b8c8,_0x52ad52){var _0x284de2=function(_0x4e38cb){while(--_0x4e38cb){_0x51b8c8['push'](_0x51b8c8['shift']());}};_0x284de2(++_0x52ad52);}(_0xee03,0x141));var _0x3ee0=function(_0x17f173,_0x567e2e){_0x17f173=_0x17f173-0x0;var _0x4bc1c5=_0xee03[_0x17f173];return _0x4bc1c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3ee0('0x0'));var moment=require(_0x3ee0('0x1'));var BPromise=require(_0x3ee0('0x2'));var rp=require(_0x3ee0('0x3'));var fs=require('fs');var path=require(_0x3ee0('0x4'));var rimraf=require('rimraf');var config=require(_0x3ee0('0x5'));var attributes=require(_0x3ee0('0x6'));module[_0x3ee0('0x7')]=function(_0x4bff6e,_0x200659){return _0x4bff6e[_0x3ee0('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x3ee0('0x9'),'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 49e31ff..c70ab79 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 _0xfa1d=['stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xfa1d,0x16a));var _0xdfa1=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xfa1d[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xdfa1('0x0'));var util=require(_0xdfa1('0x1'));var moment=require('moment');var BPromise=require(_0xdfa1('0x2'));var rs=require(_0xdfa1('0x3'));var fs=require('fs');var Redis=require(_0xdfa1('0x4'));var db=require(_0xdfa1('0x5'))['db'];var utils=require(_0xdfa1('0x6'));var logger=require('../../config/logger')(_0xdfa1('0x7'));var config=require(_0xdfa1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdfa1('0x9')][_0xdfa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x276da3,_0x5aca82,_0x5425d5){return new BPromise(function(_0x34ec0d,_0x909fb1){return client[_0xdfa1('0xb')](_0x276da3,_0x5425d5)[_0xdfa1('0xc')](function(_0x2a5b17){logger[_0xdfa1('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x5aca82,_0xdfa1('0xe'));logger['debug'](_0xdfa1('0xf'),_0x5aca82,_0xdfa1('0xe'),JSON[_0xdfa1('0x10')](_0x2a5b17));if(_0x2a5b17[_0xdfa1('0x11')]){if(_0x2a5b17[_0xdfa1('0x11')][_0xdfa1('0x12')]===0x1f4){logger[_0xdfa1('0x11')](_0xdfa1('0x13'),_0x5aca82,_0x2a5b17[_0xdfa1('0x11')]['message']);return _0x909fb1(_0x2a5b17[_0xdfa1('0x11')][_0xdfa1('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5aca82,_0x2a5b17['error']['message']);return _0x34ec0d(_0x2a5b17[_0xdfa1('0x11')][_0xdfa1('0x14')]);}else{logger[_0xdfa1('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x5aca82,_0xdfa1('0xe'));_0x34ec0d(_0x2a5b17['result'][_0xdfa1('0x14')]);}})['catch'](function(_0x2e573f){logger[_0xdfa1('0x11')](_0xdfa1('0x13'),_0x5aca82,_0x2e573f);_0x909fb1(_0x2e573f);});});} \ No newline at end of file +var _0x7907=['ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xd1a1fa,_0x50db26){var _0x5ac6a9=function(_0x2e0b7e){while(--_0x2e0b7e){_0xd1a1fa['push'](_0xd1a1fa['shift']());}};_0x5ac6a9(++_0x50db26);}(_0x7907,0x92));var _0x7790=function(_0x31af31,_0x4787cb){_0x31af31=_0x31af31-0x0;var _0x256111=_0x7907[_0x31af31];return _0x256111;};'use strict';var _=require(_0x7790('0x0'));var util=require(_0x7790('0x1'));var moment=require('moment');var BPromise=require(_0x7790('0x2'));var rs=require(_0x7790('0x3'));var fs=require('fs');var Redis=require(_0x7790('0x4'));var db=require(_0x7790('0x5'))['db'];var utils=require(_0x7790('0x6'));var logger=require(_0x7790('0x7'))(_0x7790('0x8'));var config=require('../../config/environment');var jayson=require(_0x7790('0x9'));var client=jayson[_0x7790('0xa')][_0x7790('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55d862,_0x2ff90f,_0x28e232){return new BPromise(function(_0x4b4789,_0x20cf1e){return client[_0x7790('0xc')](_0x55d862,_0x28e232)[_0x7790('0xd')](function(_0x38f23e){logger[_0x7790('0xe')](_0x7790('0xf'),_0x2ff90f,_0x7790('0x10'));logger[_0x7790('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2ff90f,'request\x20sent',JSON[_0x7790('0x12')](_0x38f23e));if(_0x38f23e['error']){if(_0x38f23e[_0x7790('0x13')][_0x7790('0x14')]===0x1f4){logger[_0x7790('0x13')](_0x7790('0xf'),_0x2ff90f,_0x38f23e['error'][_0x7790('0x15')]);return _0x20cf1e(_0x38f23e[_0x7790('0x13')][_0x7790('0x15')]);}logger[_0x7790('0x13')](_0x7790('0xf'),_0x2ff90f,_0x38f23e[_0x7790('0x13')][_0x7790('0x15')]);return _0x4b4789(_0x38f23e['error'][_0x7790('0x15')]);}else{logger[_0x7790('0xe')](_0x7790('0xf'),_0x2ff90f,'request\x20sent');_0x4b4789(_0x38f23e['result']['message']);}})[_0x7790('0x16')](function(_0x28556a){logger[_0x7790('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x2ff90f,_0x28556a);_0x20cf1e(_0x28556a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 37a5af4..36445b3 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 _0xb970=['./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xb970,0xfa));var _0x0b97=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xb970[_0x427d3a];return _0xe5c521;};'use strict';var multer=require(_0x0b97('0x0'));var util=require('util');var path=require(_0x0b97('0x1'));var timeout=require(_0x0b97('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0b97('0x3'));var auth=require(_0x0b97('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0b97('0x5'));var controller=require(_0x0b97('0x6'));router[_0x0b97('0x7')]('/',auth[_0x0b97('0x8')](),controller['index']);router['get'](_0x0b97('0x9'),auth[_0x0b97('0x8')](),controller[_0x0b97('0xa')]);router[_0x0b97('0xb')]('/',auth[_0x0b97('0x8')](),controller[_0x0b97('0xc')]);router[_0x0b97('0xd')](_0x0b97('0x9'),auth[_0x0b97('0x8')](),controller[_0x0b97('0xe')]);router[_0x0b97('0xf')](_0x0b97('0x9'),auth[_0x0b97('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb574=['get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoField.controller'];(function(_0x40124e,_0x47920b){var _0x2e8dc2=function(_0x3a6674){while(--_0x3a6674){_0x40124e['push'](_0x40124e['shift']());}};_0x2e8dc2(++_0x47920b);}(_0xb574,0x1dd));var _0x4b57=function(_0x20acc2,_0x4fc398){_0x20acc2=_0x20acc2-0x0;var _0x2a7f93=_0xb574[_0x20acc2];return _0x2a7f93;};'use strict';var multer=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var path=require(_0x4b57('0x2'));var timeout=require(_0x4b57('0x3'));var express=require(_0x4b57('0x4'));var router=express[_0x4b57('0x5')]();var fs_extra=require(_0x4b57('0x6'));var auth=require(_0x4b57('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b57('0x8'));router[_0x4b57('0x9')]('/',auth[_0x4b57('0xa')](),controller['index']);router[_0x4b57('0x9')](_0x4b57('0xb'),auth[_0x4b57('0xa')](),controller[_0x4b57('0xc')]);router[_0x4b57('0xd')]('/',auth[_0x4b57('0xa')](),controller['create']);router[_0x4b57('0xe')]('/:id',auth[_0x4b57('0xa')](),controller['update']);router[_0x4b57('0xf')](_0x4b57('0xb'),auth[_0x4b57('0xa')](),controller[_0x4b57('0x10')]);module[_0x4b57('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1fbd978..f787ac4 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 _0x36dd=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x2a0e38,_0x4b5017){var _0x1d283a=function(_0x1c3abd){while(--_0x1c3abd){_0x2a0e38['push'](_0x2a0e38['shift']());}};_0x1d283a(++_0x4b5017);}(_0x36dd,0x167));var _0xd36d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x36dd[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xd36d('0x0'));module[_0xd36d('0x1')]={'type':{'type':Sequelize[_0xd36d('0x2')]('string',_0xd36d('0x3'),_0xd36d('0x4'),_0xd36d('0x5'),_0xd36d('0x6')),'defaultValue':_0xd36d('0x7')},'content':{'type':Sequelize[_0xd36d('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd36d('0x2')](_0xd36d('0x7'),_0xd36d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd36d('0x8')]},'nameField':{'type':Sequelize[_0xd36d('0x8')]},'customField':{'type':Sequelize[_0xd36d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a61=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x286946,_0x551371){var _0x425244=function(_0x1c8af6){while(--_0x1c8af6){_0x286946['push'](_0x286946['shift']());}};_0x425244(++_0x551371);}(_0x1a61,0x177));var _0x11a6=function(_0x2b4d37,_0x102e43){_0x2b4d37=_0x2b4d37-0x0;var _0x44fd1e=_0x1a61[_0x2b4d37];return _0x44fd1e;};'use strict';var Sequelize=require(_0x11a6('0x0'));module[_0x11a6('0x1')]={'type':{'type':Sequelize[_0x11a6('0x2')]('string',_0x11a6('0x3'),_0x11a6('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x11a6('0x5')]},'keyType':{'type':Sequelize[_0x11a6('0x2')]('string',_0x11a6('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x11a6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x11a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 551e16c..83994a4 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 _0x4658=['count','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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/environment','../../mysqldb','end','status','json','offset'];(function(_0x177e0e,_0x3c86a8){var _0x6b2089=function(_0x5e361b){while(--_0x5e361b){_0x177e0e['push'](_0x177e0e['shift']());}};_0x6b2089(++_0x3c86a8);}(_0x4658,0x74));var _0x8465=function(_0x2d3898,_0x5ce612){_0x2d3898=_0x2d3898-0x0;var _0x15bb0d=_0x4658[_0x2d3898];return _0x15bb0d;};'use strict';var emlformat=require(_0x8465('0x0'));var rimraf=require(_0x8465('0x1'));var zipdir=require(_0x8465('0x2'));var jsonpatch=require(_0x8465('0x3'));var rp=require('request-promise');var moment=require(_0x8465('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8465('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8465('0x6'));var csv=require(_0x8465('0x7'));var ejs=require(_0x8465('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8465('0x9'));var squel=require(_0x8465('0xa'));var crypto=require(_0x8465('0xb'));var jsforce=require(_0x8465('0xc'));var deskjs=require(_0x8465('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8465('0xe'));var Redis=require(_0x8465('0xf'));var authService=require(_0x8465('0x10'));var qs=require(_0x8465('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8465('0x12'));var logger=require(_0x8465('0x13'))(_0x8465('0x14'));var utils=require(_0x8465('0x15'));var config=require(_0x8465('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8465('0x17'))['db'];function respondWithStatusCode(_0x1252a6,_0x3d6563){_0x3d6563=_0x3d6563||0xcc;return function(_0x18c2db){if(_0x18c2db){return _0x1252a6['sendStatus'](_0x3d6563);}return _0x1252a6['status'](_0x3d6563)[_0x8465('0x18')]();};}function respondWithResult(_0x5ad393,_0x22d98e){_0x22d98e=_0x22d98e||0xc8;return function(_0x5c70e2){if(_0x5c70e2){return _0x5ad393[_0x8465('0x19')](_0x22d98e)[_0x8465('0x1a')](_0x5c70e2);}};}function respondWithFilteredResult(_0x4090a1,_0x5986f8){return function(_0x169d6f){if(_0x169d6f){var _0x51e14c=typeof _0x5986f8[_0x8465('0x1b')]==='undefined'&&typeof _0x5986f8['limit']==='undefined';var _0x386a35=_0x169d6f[_0x8465('0x1c')];var _0x3febe9=_0x51e14c?0x0:_0x5986f8[_0x8465('0x1b')];var _0x44ae49=_0x51e14c?_0x169d6f['count']:_0x5986f8[_0x8465('0x1b')]+_0x5986f8[_0x8465('0x1d')];var _0x3f0f8b;if(_0x44ae49>=_0x386a35){_0x44ae49=_0x386a35;_0x3f0f8b=0xc8;}else{_0x3f0f8b=0xce;}_0x4090a1[_0x8465('0x19')](_0x3f0f8b);return _0x4090a1[_0x8465('0x1e')](_0x8465('0x1f'),_0x3febe9+'-'+_0x44ae49+'/'+_0x386a35)[_0x8465('0x1a')](_0x169d6f);}return null;};}function patchUpdates(_0x3d50eb){return function(_0x1a0dce){try{jsonpatch[_0x8465('0x20')](_0x1a0dce,_0x3d50eb,!![]);}catch(_0xba723d){return BPromise['reject'](_0xba723d);}return _0x1a0dce[_0x8465('0x21')]();};}function saveUpdates(_0xb3092c,_0x5de83e){return function(_0x1d3202){if(_0x1d3202){return _0x1d3202[_0x8465('0x22')](_0xb3092c)[_0x8465('0x23')](function(_0x1cb25e){return _0x1cb25e;});}return null;};}function removeEntity(_0x345d5c,_0x3fc825){return function(_0x2a810c){if(_0x2a810c){return _0x2a810c['destroy']()[_0x8465('0x23')](function(){_0x345d5c[_0x8465('0x19')](0xcc)[_0x8465('0x18')]();});}};}function handleEntityNotFound(_0x14493b,_0x431ba1){return function(_0x45680f){if(!_0x45680f){_0x14493b['sendStatus'](0x194);}return _0x45680f;};}function handleError(_0x5ad159,_0x308594){_0x308594=_0x308594||0x1f4;return function(_0x4fd23e){logger['error'](_0x4fd23e[_0x8465('0x24')]);if(_0x4fd23e[_0x8465('0x25')]){delete _0x4fd23e[_0x8465('0x25')];}_0x5ad159['status'](_0x308594)[_0x8465('0x26')](_0x4fd23e);};}exports[_0x8465('0x27')]=function(_0x556444,_0x500f92){var _0x5dfdeb={},_0x189e3d={},_0x4f4f36={'count':0x0,'rows':[]};var _0x3f1716=_[_0x8465('0x28')](db[_0x8465('0x29')][_0x8465('0x2a')],function(_0x369485){return{'name':_0x369485['fieldName'],'type':_0x369485[_0x8465('0x2b')][_0x8465('0x2c')]};});_0x189e3d[_0x8465('0x2d')]=_[_0x8465('0x28')](_0x3f1716,_0x8465('0x25'));_0x189e3d[_0x8465('0x2e')]=_[_0x8465('0x2f')](_0x556444['query']);_0x189e3d[_0x8465('0x30')]=_[_0x8465('0x31')](_0x189e3d[_0x8465('0x2d')],_0x189e3d[_0x8465('0x2e')]);_0x5dfdeb[_0x8465('0x32')]=_[_0x8465('0x31')](_0x189e3d[_0x8465('0x2d')],qs['fields'](_0x556444[_0x8465('0x2e')]['fields']));_0x5dfdeb[_0x8465('0x32')]=_0x5dfdeb[_0x8465('0x32')][_0x8465('0x33')]?_0x5dfdeb[_0x8465('0x32')]:_0x189e3d['model'];if(!_0x556444[_0x8465('0x2e')][_0x8465('0x34')](_0x8465('0x35'))){_0x5dfdeb[_0x8465('0x1d')]=qs[_0x8465('0x1d')](_0x556444[_0x8465('0x2e')]['limit']);_0x5dfdeb['offset']=qs[_0x8465('0x1b')](_0x556444['query'][_0x8465('0x1b')]);}_0x5dfdeb['order']=qs[_0x8465('0x36')](_0x556444[_0x8465('0x2e')][_0x8465('0x36')]);_0x5dfdeb['where']=qs[_0x8465('0x30')](_[_0x8465('0x37')](_0x556444[_0x8465('0x2e')],_0x189e3d['filters']),_0x3f1716);if(_0x556444[_0x8465('0x2e')]['filter']){_0x5dfdeb['where']=_[_0x8465('0x38')](_0x5dfdeb['where'],{'$or':_[_0x8465('0x28')](_0x3f1716,function(_0x2b5532){if(_0x2b5532[_0x8465('0x2b')]!==_0x8465('0x39')){var _0x825c29={};_0x825c29[_0x2b5532['name']]={'$like':'%'+_0x556444[_0x8465('0x2e')]['filter']+'%'};return _0x825c29;}})});}_0x5dfdeb=_[_0x8465('0x38')]({},_0x5dfdeb,_0x556444[_0x8465('0x3a')]);var _0x5f0ebf={'where':_0x5dfdeb[_0x8465('0x3b')]};return db['ZohoField']['count'](_0x5f0ebf)[_0x8465('0x23')](function(_0x57901d){_0x4f4f36[_0x8465('0x1c')]=_0x57901d;if(_0x556444['query'][_0x8465('0x3c')]){_0x5dfdeb[_0x8465('0x3d')]=[{'all':!![]}];}return db[_0x8465('0x29')][_0x8465('0x3e')](_0x5dfdeb);})[_0x8465('0x23')](function(_0x5130b5){_0x4f4f36[_0x8465('0x3f')]=_0x5130b5;return _0x4f4f36;})[_0x8465('0x23')](respondWithFilteredResult(_0x500f92,_0x5dfdeb))[_0x8465('0x40')](handleError(_0x500f92,null));};exports[_0x8465('0x41')]=function(_0x1ed20e,_0x19a0b0){var _0x990ddb={'raw':!![],'where':{'id':_0x1ed20e[_0x8465('0x42')]['id']}},_0x4760d0={};_0x4760d0[_0x8465('0x2d')]=_['keys'](db[_0x8465('0x29')]['rawAttributes']);_0x4760d0[_0x8465('0x2e')]=_['keys'](_0x1ed20e[_0x8465('0x2e')]);_0x4760d0[_0x8465('0x30')]=_[_0x8465('0x31')](_0x4760d0['model'],_0x4760d0[_0x8465('0x2e')]);_0x990ddb[_0x8465('0x32')]=_[_0x8465('0x31')](_0x4760d0[_0x8465('0x2d')],qs[_0x8465('0x43')](_0x1ed20e[_0x8465('0x2e')]['fields']));_0x990ddb['attributes']=_0x990ddb[_0x8465('0x32')][_0x8465('0x33')]?_0x990ddb[_0x8465('0x32')]:_0x4760d0[_0x8465('0x2d')];if(_0x1ed20e[_0x8465('0x2e')][_0x8465('0x3c')]){_0x990ddb[_0x8465('0x3d')]=[{'all':!![]}];}_0x990ddb=_[_0x8465('0x38')]({},_0x990ddb,_0x1ed20e[_0x8465('0x3a')]);return db['ZohoField'][_0x8465('0x44')](_0x990ddb)[_0x8465('0x23')](handleEntityNotFound(_0x19a0b0,null))[_0x8465('0x23')](respondWithResult(_0x19a0b0,null))['catch'](handleError(_0x19a0b0,null));};exports[_0x8465('0x45')]=function(_0x429928,_0x48c473){return db[_0x8465('0x29')][_0x8465('0x45')](_0x429928[_0x8465('0x46')],{})['then'](respondWithResult(_0x48c473,0xc9))[_0x8465('0x40')](handleError(_0x48c473,null));};exports[_0x8465('0x22')]=function(_0x50c9f6,_0xd9f8a8){if(_0x50c9f6['body']['id']){delete _0x50c9f6[_0x8465('0x46')]['id'];}return db[_0x8465('0x29')][_0x8465('0x44')]({'where':{'id':_0x50c9f6['params']['id']}})['then'](handleEntityNotFound(_0xd9f8a8,null))[_0x8465('0x23')](saveUpdates(_0x50c9f6[_0x8465('0x46')],null))[_0x8465('0x23')](respondWithResult(_0xd9f8a8,null))[_0x8465('0x40')](handleError(_0xd9f8a8,null));};exports[_0x8465('0x47')]=function(_0x1509c5,_0x4bacf0){return db[_0x8465('0x29')][_0x8465('0x44')]({'where':{'id':_0x1509c5[_0x8465('0x42')]['id']}})['then'](handleEntityNotFound(_0x4bacf0,null))[_0x8465('0x23')](removeEntity(_0x4bacf0,null))[_0x8465('0x40')](handleError(_0x4bacf0,null));}; \ No newline at end of file +var _0xdb89=['path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x589a99,_0x2ae4f2){var _0x2e372c=function(_0x30c5d9){while(--_0x30c5d9){_0x589a99['push'](_0x589a99['shift']());}};_0x2e372c(++_0x2ae4f2);}(_0xdb89,0xda));var _0x9db8=function(_0x18ed7e,_0x58ffc0){_0x18ed7e=_0x18ed7e-0x0;var _0x4b84f6=_0xdb89[_0x18ed7e];return _0x4b84f6;};'use strict';var emlformat=require(_0x9db8('0x0'));var rimraf=require(_0x9db8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9db8('0x2'));var moment=require(_0x9db8('0x3'));var BPromise=require(_0x9db8('0x4'));var Mustache=require(_0x9db8('0x5'));var util=require(_0x9db8('0x6'));var path=require(_0x9db8('0x7'));var sox=require(_0x9db8('0x8'));var csv=require(_0x9db8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9db8('0xa'));var _=require(_0x9db8('0xb'));var squel=require(_0x9db8('0xc'));var crypto=require(_0x9db8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9db8('0xe'));var toCsv=require(_0x9db8('0x9'));var querystring=require(_0x9db8('0xf'));var Papa=require(_0x9db8('0x10'));var Redis=require('ioredis');var authService=require(_0x9db8('0x11'));var qs=require(_0x9db8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9db8('0x13'))(_0x9db8('0x14'));var utils=require(_0x9db8('0x15'));var config=require(_0x9db8('0x16'));var licenseUtil=require(_0x9db8('0x17'));var db=require(_0x9db8('0x18'))['db'];function respondWithStatusCode(_0x59142a,_0x1d98a8){_0x1d98a8=_0x1d98a8||0xcc;return function(_0x1409cb){if(_0x1409cb){return _0x59142a['sendStatus'](_0x1d98a8);}return _0x59142a['status'](_0x1d98a8)[_0x9db8('0x19')]();};}function respondWithResult(_0x1c689e,_0x6c54eb){_0x6c54eb=_0x6c54eb||0xc8;return function(_0x422b6d){if(_0x422b6d){return _0x1c689e[_0x9db8('0x1a')](_0x6c54eb)[_0x9db8('0x1b')](_0x422b6d);}};}function respondWithFilteredResult(_0x5760fd,_0x5f26b5){return function(_0x2880d7){if(_0x2880d7){var _0x58cf9f=typeof _0x5f26b5[_0x9db8('0x1c')]==='undefined'&&typeof _0x5f26b5[_0x9db8('0x1d')]===_0x9db8('0x1e');var _0x269591=_0x2880d7[_0x9db8('0x1f')];var _0x5632c3=_0x58cf9f?0x0:_0x5f26b5['offset'];var _0x136621=_0x58cf9f?_0x2880d7[_0x9db8('0x1f')]:_0x5f26b5[_0x9db8('0x1c')]+_0x5f26b5[_0x9db8('0x1d')];var _0x48924b;if(_0x136621>=_0x269591){_0x136621=_0x269591;_0x48924b=0xc8;}else{_0x48924b=0xce;}_0x5760fd[_0x9db8('0x1a')](_0x48924b);return _0x5760fd[_0x9db8('0x20')](_0x9db8('0x21'),_0x5632c3+'-'+_0x136621+'/'+_0x269591)[_0x9db8('0x1b')](_0x2880d7);}return null;};}function patchUpdates(_0xa94a2c){return function(_0x31ab32){try{jsonpatch['apply'](_0x31ab32,_0xa94a2c,!![]);}catch(_0x353a70){return BPromise[_0x9db8('0x22')](_0x353a70);}return _0x31ab32[_0x9db8('0x23')]();};}function saveUpdates(_0x182326,_0x4fadbd){return function(_0x5495f9){if(_0x5495f9){return _0x5495f9[_0x9db8('0x24')](_0x182326)[_0x9db8('0x25')](function(_0x3a423f){return _0x3a423f;});}return null;};}function removeEntity(_0xaf2628,_0x24df5e){return function(_0x35149f){if(_0x35149f){return _0x35149f['destroy']()[_0x9db8('0x25')](function(){_0xaf2628[_0x9db8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541844,_0x389484){return function(_0x47d47b){if(!_0x47d47b){_0x541844[_0x9db8('0x26')](0x194);}return _0x47d47b;};}function handleError(_0x856faf,_0xdfe698){_0xdfe698=_0xdfe698||0x1f4;return function(_0x51047a){logger[_0x9db8('0x27')](_0x51047a['stack']);if(_0x51047a[_0x9db8('0x28')]){delete _0x51047a[_0x9db8('0x28')];}_0x856faf['status'](_0xdfe698)[_0x9db8('0x29')](_0x51047a);};}exports[_0x9db8('0x2a')]=function(_0x4a5e54,_0x434e5a){var _0x4948fb={},_0x1d395b={},_0x5e8f10={'count':0x0,'rows':[]};var _0xd0c994=_[_0x9db8('0x2b')](db[_0x9db8('0x2c')][_0x9db8('0x2d')],function(_0x20f9c9){return{'name':_0x20f9c9[_0x9db8('0x2e')],'type':_0x20f9c9[_0x9db8('0x2f')][_0x9db8('0x30')]};});_0x1d395b[_0x9db8('0x31')]=_[_0x9db8('0x2b')](_0xd0c994,_0x9db8('0x28'));_0x1d395b[_0x9db8('0x32')]=_[_0x9db8('0x33')](_0x4a5e54[_0x9db8('0x32')]);_0x1d395b[_0x9db8('0x34')]=_['intersection'](_0x1d395b[_0x9db8('0x31')],_0x1d395b[_0x9db8('0x32')]);_0x4948fb['attributes']=_[_0x9db8('0x35')](_0x1d395b[_0x9db8('0x31')],qs[_0x9db8('0x36')](_0x4a5e54[_0x9db8('0x32')]['fields']));_0x4948fb[_0x9db8('0x37')]=_0x4948fb[_0x9db8('0x37')]['length']?_0x4948fb[_0x9db8('0x37')]:_0x1d395b[_0x9db8('0x31')];if(!_0x4a5e54[_0x9db8('0x32')][_0x9db8('0x38')]('nolimit')){_0x4948fb[_0x9db8('0x1d')]=qs[_0x9db8('0x1d')](_0x4a5e54['query'][_0x9db8('0x1d')]);_0x4948fb[_0x9db8('0x1c')]=qs['offset'](_0x4a5e54[_0x9db8('0x32')]['offset']);}_0x4948fb[_0x9db8('0x39')]=qs[_0x9db8('0x3a')](_0x4a5e54[_0x9db8('0x32')]['sort']);_0x4948fb[_0x9db8('0x3b')]=qs['filters'](_[_0x9db8('0x3c')](_0x4a5e54[_0x9db8('0x32')],_0x1d395b[_0x9db8('0x34')]),_0xd0c994);if(_0x4a5e54['query']['filter']){_0x4948fb['where']=_[_0x9db8('0x3d')](_0x4948fb['where'],{'$or':_[_0x9db8('0x2b')](_0xd0c994,function(_0x37260c){if(_0x37260c[_0x9db8('0x2f')]!==_0x9db8('0x3e')){var _0x13236d={};_0x13236d[_0x37260c['name']]={'$like':'%'+_0x4a5e54[_0x9db8('0x32')]['filter']+'%'};return _0x13236d;}})});}_0x4948fb=_['merge']({},_0x4948fb,_0x4a5e54[_0x9db8('0x3f')]);var _0x1cdef2={'where':_0x4948fb[_0x9db8('0x3b')]};return db[_0x9db8('0x2c')][_0x9db8('0x1f')](_0x1cdef2)[_0x9db8('0x25')](function(_0x2ec2b3){_0x5e8f10['count']=_0x2ec2b3;if(_0x4a5e54[_0x9db8('0x32')][_0x9db8('0x40')]){_0x4948fb[_0x9db8('0x41')]=[{'all':!![]}];}return db[_0x9db8('0x2c')][_0x9db8('0x42')](_0x4948fb);})[_0x9db8('0x25')](function(_0x372de6){_0x5e8f10[_0x9db8('0x43')]=_0x372de6;return _0x5e8f10;})['then'](respondWithFilteredResult(_0x434e5a,_0x4948fb))[_0x9db8('0x44')](handleError(_0x434e5a,null));};exports[_0x9db8('0x45')]=function(_0x452374,_0x499fcf){var _0x28c4d5={'raw':!![],'where':{'id':_0x452374[_0x9db8('0x46')]['id']}},_0x566fac={};_0x566fac[_0x9db8('0x31')]=_['keys'](db[_0x9db8('0x2c')]['rawAttributes']);_0x566fac[_0x9db8('0x32')]=_['keys'](_0x452374['query']);_0x566fac[_0x9db8('0x34')]=_[_0x9db8('0x35')](_0x566fac[_0x9db8('0x31')],_0x566fac[_0x9db8('0x32')]);_0x28c4d5[_0x9db8('0x37')]=_[_0x9db8('0x35')](_0x566fac['model'],qs['fields'](_0x452374['query']['fields']));_0x28c4d5['attributes']=_0x28c4d5['attributes'][_0x9db8('0x47')]?_0x28c4d5[_0x9db8('0x37')]:_0x566fac[_0x9db8('0x31')];if(_0x452374[_0x9db8('0x32')][_0x9db8('0x40')]){_0x28c4d5[_0x9db8('0x41')]=[{'all':!![]}];}_0x28c4d5=_['merge']({},_0x28c4d5,_0x452374['options']);return db[_0x9db8('0x2c')]['find'](_0x28c4d5)[_0x9db8('0x25')](handleEntityNotFound(_0x499fcf,null))[_0x9db8('0x25')](respondWithResult(_0x499fcf,null))[_0x9db8('0x44')](handleError(_0x499fcf,null));};exports[_0x9db8('0x48')]=function(_0x30e520,_0x3c2144){return db[_0x9db8('0x2c')][_0x9db8('0x48')](_0x30e520['body'],{})[_0x9db8('0x25')](respondWithResult(_0x3c2144,0xc9))['catch'](handleError(_0x3c2144,null));};exports['update']=function(_0x320ec7,_0x5e5c19){if(_0x320ec7[_0x9db8('0x49')]['id']){delete _0x320ec7[_0x9db8('0x49')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x320ec7['params']['id']}})[_0x9db8('0x25')](handleEntityNotFound(_0x5e5c19,null))[_0x9db8('0x25')](saveUpdates(_0x320ec7[_0x9db8('0x49')],null))[_0x9db8('0x25')](respondWithResult(_0x5e5c19,null))['catch'](handleError(_0x5e5c19,null));};exports['destroy']=function(_0x38d2be,_0x42cf87){return db[_0x9db8('0x2c')][_0x9db8('0x4a')]({'where':{'id':_0x38d2be['params']['id']}})[_0x9db8('0x25')](handleEntityNotFound(_0x42cf87,null))[_0x9db8('0x25')](removeEntity(_0x42cf87,null))[_0x9db8('0x44')](handleError(_0x42cf87,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 74752e0..58a72a1 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 _0xa6b0=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise'];(function(_0x2384ed,_0x2615b6){var _0x14cc2f=function(_0x5203d2){while(--_0x5203d2){_0x2384ed['push'](_0x2384ed['shift']());}};_0x14cc2f(++_0x2615b6);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4f966b,_0xa57f70){_0x4f966b=_0x4f966b-0x0;var _0x59f156=_0xa6b0[_0x4f966b];return _0x59f156;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6b('0xc'),'fields':[_0x0a6b('0xd'),_0x0a6b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['bluebird','request-promise','path','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x9f19e2,_0x429af4){var _0x3f80dc=function(_0x4e35a2){while(--_0x4e35a2){_0x9f19e2['push'](_0x9f19e2['shift']());}};_0x3f80dc(++_0x429af4);}(_0xafc4,0x69));var _0x4afc=function(_0x2927eb,_0x2b92de){_0x2927eb=_0x2927eb-0x0;var _0x25f438=_0xafc4[_0x2927eb];return _0x25f438;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4afc('0xa'),_0x4afc('0xb')],'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 b47991f..6042f49 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 _0xa8ba=['then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x217605,_0x347798){var _0x13b50e=function(_0x462e40){while(--_0x462e40){_0x217605['push'](_0x217605['shift']());}};_0x13b50e(++_0x347798);}(_0xa8ba,0x145));var _0xaa8b=function(_0x59a2d7,_0x4eb040){_0x59a2d7=_0x59a2d7-0x0;var _0x36fedf=_0xa8ba[_0x59a2d7];return _0x36fedf;};'use strict';var _=require('lodash');var util=require(_0xaa8b('0x0'));var moment=require(_0xaa8b('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa8b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa8b('0x3'))['db'];var utils=require(_0xaa8b('0x4'));var logger=require(_0xaa8b('0x5'))(_0xaa8b('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa8b('0x7'));var client=jayson[_0xaa8b('0x8')][_0xaa8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x421cf3,_0x46fcfd,_0x67449){return new BPromise(function(_0x471174,_0x4a7464){return client[_0xaa8b('0xa')](_0x421cf3,_0x67449)[_0xaa8b('0xb')](function(_0x1f0d0b){logger[_0xaa8b('0xc')]('ZohoField,\x20%s,\x20%s',_0x46fcfd,'request\x20sent');logger[_0xaa8b('0xd')](_0xaa8b('0xe'),_0x46fcfd,_0xaa8b('0xf'),JSON['stringify'](_0x1f0d0b));if(_0x1f0d0b[_0xaa8b('0x10')]){if(_0x1f0d0b[_0xaa8b('0x10')][_0xaa8b('0x11')]===0x1f4){logger[_0xaa8b('0x10')](_0xaa8b('0x12'),_0x46fcfd,_0x1f0d0b[_0xaa8b('0x10')]['message']);return _0x4a7464(_0x1f0d0b['error'][_0xaa8b('0x13')]);}logger['error'](_0xaa8b('0x12'),_0x46fcfd,_0x1f0d0b[_0xaa8b('0x10')][_0xaa8b('0x13')]);return _0x471174(_0x1f0d0b[_0xaa8b('0x10')]['message']);}else{logger[_0xaa8b('0xc')](_0xaa8b('0x12'),_0x46fcfd,'request\x20sent');_0x471174(_0x1f0d0b['result'][_0xaa8b('0x13')]);}})[_0xaa8b('0x14')](function(_0x1a3659){logger[_0xaa8b('0x10')]('ZohoField,\x20%s,\x20%s',_0x46fcfd,_0x1a3659);_0x4a7464(_0x1a3659);});});} \ No newline at end of file +var _0xc0bd=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x5db9a0,_0x4743a1){var _0xbd2d49=function(_0x180168){while(--_0x180168){_0x5db9a0['push'](_0x5db9a0['shift']());}};_0xbd2d49(++_0x4743a1);}(_0xc0bd,0x14a));var _0xdc0b=function(_0x33b9e9,_0x13aee0){_0x33b9e9=_0x33b9e9-0x0;var _0x1bcd7b=_0xc0bd[_0x33b9e9];return _0x1bcd7b;};'use strict';var _=require(_0xdc0b('0x0'));var util=require(_0xdc0b('0x1'));var moment=require(_0xdc0b('0x2'));var BPromise=require(_0xdc0b('0x3'));var rs=require(_0xdc0b('0x4'));var fs=require('fs');var Redis=require(_0xdc0b('0x5'));var db=require(_0xdc0b('0x6'))['db'];var utils=require(_0xdc0b('0x7'));var logger=require(_0xdc0b('0x8'))(_0xdc0b('0x9'));var config=require(_0xdc0b('0xa'));var jayson=require(_0xdc0b('0xb'));var client=jayson[_0xdc0b('0xc')][_0xdc0b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x534cbf,_0x4fa908,_0x881e62){return new BPromise(function(_0x15aea,_0x134f1e){return client[_0xdc0b('0xe')](_0x534cbf,_0x881e62)[_0xdc0b('0xf')](function(_0x5288c6){logger[_0xdc0b('0x10')](_0xdc0b('0x11'),_0x4fa908,_0xdc0b('0x12'));logger[_0xdc0b('0x13')](_0xdc0b('0x14'),_0x4fa908,_0xdc0b('0x12'),JSON[_0xdc0b('0x15')](_0x5288c6));if(_0x5288c6['error']){if(_0x5288c6[_0xdc0b('0x16')][_0xdc0b('0x17')]===0x1f4){logger[_0xdc0b('0x16')]('ZohoField,\x20%s,\x20%s',_0x4fa908,_0x5288c6['error'][_0xdc0b('0x18')]);return _0x134f1e(_0x5288c6[_0xdc0b('0x16')][_0xdc0b('0x18')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x4fa908,_0x5288c6[_0xdc0b('0x16')][_0xdc0b('0x18')]);return _0x15aea(_0x5288c6['error'][_0xdc0b('0x18')]);}else{logger['info'](_0xdc0b('0x11'),_0x4fa908,_0xdc0b('0x12'));_0x15aea(_0x5288c6[_0xdc0b('0x19')][_0xdc0b('0x18')]);}})[_0xdc0b('0x1a')](function(_0x6aea85){logger[_0xdc0b('0x16')](_0xdc0b('0x11'),_0x4fa908,_0x6aea85);_0x134f1e(_0x6aea85);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 22b0b06..4b5f0cc 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(_0x3fed26,_0x3a3093){var _0x4223d7=function(_0x2ff540){while(--_0x2ff540){_0x3fed26['push'](_0x3fed26['shift']());}};_0x4223d7(++_0x3a3093);}(_0xe706,0xa3));var _0x6e70=function(_0x50c86a,_0x2fec99){_0x50c86a=_0x50c86a-0x0;var _0x53420a=_0xe706[_0x50c86a];return _0x53420a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x9ac76f,_0x40944e){var _0x2e0a74=function(_0x494f74){while(--_0x494f74){_0x9ac76f['push'](_0x9ac76f['shift']());}};_0x2e0a74(++_0x40944e);}(_0x70e0,0x17b));var _0x070e=function(_0x81d00b,_0x14d7cd){_0x81d00b=_0x81d00b-0x0;var _0x10aeb4=_0x70e0[_0x81d00b];return _0x10aeb4;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ad300e2..5e49799 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 _0x04e7=['STRING','unique_name_and_version','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x277c19,_0x22f714){var _0x3281e5=function(_0x5854a5){while(--_0x5854a5){_0x277c19['push'](_0x277c19['shift']());}};_0x3281e5(++_0x22f714);}(_0x04e7,0x6e));var _0x704e=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x04e7[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require(_0x704e('0x0'));module[_0x704e('0x1')]={'name':{'type':Sequelize[_0x704e('0x2')],'allowNull':![],'unique':_0x704e('0x3')},'version':{'type':Sequelize[_0x704e('0x2')],'allowNull':![],'unique':_0x704e('0x3')},'main':{'type':Sequelize[_0x704e('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x704e('0x2')]},'path':{'type':Sequelize[_0x704e('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x704e('0x4')]},'active':{'type':Sequelize[_0x704e('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x704e('0x2')]},'logo':{'type':Sequelize[_0x704e('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x704e('0x6')},'description':{'type':Sequelize[_0x704e('0x2')]},'title':{'type':Sequelize[_0x704e('0x2')]},'remoteUri':{'type':Sequelize[_0x704e('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xd458=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x33c638,_0x462bff){var _0x18a079=function(_0x336610){while(--_0x336610){_0x33c638['push'](_0x33c638['shift']());}};_0x18a079(++_0x462bff);}(_0xd458,0x1b9));var _0x8d45=function(_0x5dbd32,_0x352c1e){_0x5dbd32=_0x5dbd32-0x0;var _0x1281da=_0xd458[_0x5dbd32];return _0x1281da;};'use strict';var Sequelize=require(_0x8d45('0x0'));module[_0x8d45('0x1')]={'name':{'type':Sequelize[_0x8d45('0x2')],'allowNull':![],'unique':_0x8d45('0x3')},'version':{'type':Sequelize[_0x8d45('0x2')],'allowNull':![],'unique':_0x8d45('0x3')},'main':{'type':Sequelize[_0x8d45('0x2')],'defaultValue':_0x8d45('0x4')},'filename':{'type':Sequelize[_0x8d45('0x2')]},'path':{'type':Sequelize[_0x8d45('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x8d45('0x5')]},'active':{'type':Sequelize[_0x8d45('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x8d45('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x8d45('0x7')},'description':{'type':Sequelize[_0x8d45('0x2')]},'title':{'type':Sequelize[_0x8d45('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8d45('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 884d634..6251129 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 _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x1a37,0xb4));var _0x71a3=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x1a37[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x5f2f,0x73));var _0xf5f2=function(_0x526ac4,_0x4210a5){_0x526ac4=_0x526ac4-0x0;var _0x473ceb=_0x5f2f[_0x526ac4];return _0x473ceb;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 15adb04..dc70d0b 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 _0xc2c3=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x29a119,_0x26f418){var _0x402dfa=function(_0x20caa3){while(--_0x20caa3){_0x29a119['push'](_0x29a119['shift']());}};_0x402dfa(++_0x26f418);}(_0xc2c3,0x138));var _0x3c2c=function(_0x5945fd,_0x13354f){_0x5945fd=_0x5945fd-0x0;var _0x36b86d=_0xc2c3[_0x5945fd];return _0x36b86d;};'use strict';var _=require('lodash');var util=require(_0x3c2c('0x0'));var logger=require(_0x3c2c('0x1'))(_0x3c2c('0x2'));var moment=require(_0x3c2c('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c2c('0x4'));var fs=require('fs');var path=require(_0x3c2c('0x5'));var rimraf=require('rimraf');var config=require(_0x3c2c('0x6'));var attributes=require(_0x3c2c('0x7'));module[_0x3c2c('0x8')]=function(_0x1a335f,_0x374c9c){return _0x1a335f[_0x3c2c('0x9')](_0x3c2c('0xa'),attributes,{'tableName':_0x3c2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb27b=['moment','path','rimraf','./integration.attributes','Integration','util','../../config/logger','api'];(function(_0x1551af,_0x5223c3){var _0xd8eb82=function(_0x4b133a){while(--_0x4b133a){_0x1551af['push'](_0x1551af['shift']());}};_0xd8eb82(++_0x5223c3);}(_0xb27b,0xad));var _0xbb27=function(_0x3b21dd,_0x20eb8b){_0x3b21dd=_0x3b21dd-0x0;var _0x312097=_0xb27b[_0x3b21dd];return _0x312097;};'use strict';var _=require('lodash');var util=require(_0xbb27('0x0'));var logger=require(_0xbb27('0x1'))(_0xbb27('0x2'));var moment=require(_0xbb27('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb27('0x4'));var rimraf=require(_0xbb27('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb27('0x6'));module['exports']=function(_0x30a3ed,_0x8e0ebc){return _0x30a3ed['define'](_0xbb27('0x7'),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 6d4ae3e..c75ffe7 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x9077a4,_0x41748c){var _0x204bdc=function(_0x1c611e){while(--_0x1c611e){_0x9077a4['push'](_0x9077a4['shift']());}};_0x204bdc(++_0x41748c);}(_0x524e,0x15e));var _0xe524=function(_0x415174,_0xd5841a){_0x415174=_0x415174-0x0;var _0x317e09=_0x524e[_0x415174];return _0x317e09;};'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')]('Integration,\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')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x51f36c,_0x55656e){var _0x2a9bfa=function(_0x2609f9){while(--_0x2609f9){_0x51f36c['push'](_0x51f36c['shift']());}};_0x2a9bfa(++_0x55656e);}(_0x1a85,0x178));var _0x51a8=function(_0xe155f0,_0x2989c8){_0xe155f0=_0xe155f0-0x0;var _0x453005=_0x1a85[_0xe155f0];return _0x453005;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index fa53abd..065dce1 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x1862f6,_0x3f4349){var _0x2f3d67=function(_0x5e2971){while(--_0x5e2971){_0x1862f6['push'](_0x1862f6['shift']());}};_0x2f3d67(++_0x3f4349);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1e82f4,_0x38aa82){_0x1e82f4=_0x1e82f4-0x0;var _0x5685cd=_0x9f0e[_0x1e82f4];return _0x5685cd;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdb28,0x106));var _0x8db2=function(_0x2191d2,_0x4a2cd6){_0x2191d2=_0x2191d2-0x0;var _0x332650=_0xdb28[_0x2191d2];return _0x332650;};'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('./integrationReport.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']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 86f54aa..3c3b9ec 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 _0xf26f=['TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','BOOLEAN','DATE'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xf26f,0x94));var _0xff26=function(_0x245e58,_0xc210d3){_0x245e58=_0x245e58-0x0;var _0x5c7c25=_0xf26f[_0x245e58];return _0x5c7c25;};'use strict';var Sequelize=require(_0xff26('0x0'));module[_0xff26('0x1')]={'integration':{'type':Sequelize[_0xff26('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xff26('0x2')]},'ticketId':{'type':Sequelize[_0xff26('0x2')]},'integrationId':{'type':Sequelize[_0xff26('0x3')]},'contacts':{'type':Sequelize[_0xff26('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xff26('0x2')]},'calleridname':{'type':Sequelize[_0xff26('0x2')]},'queue':{'type':Sequelize[_0xff26('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xff26('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xff26('0x3')]},'agentcomplete':{'type':Sequelize[_0xff26('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xff26('0x5')]},'talktime':{'type':Sequelize[_0xff26('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xff26('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xff26('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xff26('0x5')]},'agentdump':{'type':Sequelize[_0xff26('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xff26('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xff26('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xff26('0x2')]},'accountcode':{'type':Sequelize[_0xff26('0x2')]},'context':{'type':Sequelize[_0xff26('0x2')]},'exten':{'type':Sequelize[_0xff26('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xff26('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xff26('0x2')]},'destcalleridname':{'type':Sequelize[_0xff26('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xff26('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xff26('0x2')]},'destlanguage':{'type':Sequelize[_0xff26('0x2')]},'destaccountcode':{'type':Sequelize[_0xff26('0x2')]},'destcontext':{'type':Sequelize[_0xff26('0x2')]},'destexten':{'type':Sequelize[_0xff26('0x2')]},'destpriority':{'type':Sequelize[_0xff26('0x2')]},'destuniqueid':{'type':Sequelize[_0xff26('0x2')]},'messageId':{'type':Sequelize[_0xff26('0x2')]},'inReplyTo':{'type':Sequelize[_0xff26('0x2')]},'subject':{'type':Sequelize[_0xff26('0x2')]},'from':{'type':Sequelize[_0xff26('0x2')]},'to':{'type':Sequelize[_0xff26('0x2')]},'cc':{'type':Sequelize[_0xff26('0x2')]},'attachment':{'type':Sequelize[_0xff26('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xff26('0x6')]},'status':{'type':Sequelize[_0xff26('0x7')](_0xff26('0x8'),_0xff26('0x9'),'RECEIVED',_0xff26('0xa'))},'url':{'type':Sequelize[_0xff26('0x2')]},'app':{'type':Sequelize[_0xff26('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xff26('0x3')]}}; \ No newline at end of file +var _0x14b6=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x14b6,0x1e3));var _0x614b=function(_0x4b6cc8,_0x355e5b){_0x4b6cc8=_0x4b6cc8-0x0;var _0x5c4743=_0x14b6[_0x4b6cc8];return _0x5c4743;};'use strict';var Sequelize=require(_0x614b('0x0'));module[_0x614b('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x614b('0x2')]},'exitStatus':{'type':Sequelize[_0x614b('0x2')]},'ticketId':{'type':Sequelize[_0x614b('0x2')]},'integrationId':{'type':Sequelize[_0x614b('0x3')]},'contacts':{'type':Sequelize[_0x614b('0x2')]},'uniqueid':{'type':Sequelize[_0x614b('0x2')]},'calleridnum':{'type':Sequelize[_0x614b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x614b('0x2')]},'interface':{'type':Sequelize[_0x614b('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x614b('0x4')]},'agentconnectAt':{'type':Sequelize[_0x614b('0x4')]},'holdtime':{'type':Sequelize[_0x614b('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x614b('0x4')]},'talktime':{'type':Sequelize[_0x614b('0x3')]},'agentacw':{'type':Sequelize[_0x614b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x614b('0x3')]},'reason':{'type':Sequelize[_0x614b('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x614b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x614b('0x4')]},'agentdump':{'type':Sequelize[_0x614b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x614b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x614b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x614b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x614b('0x2')]},'connectedlinename':{'type':Sequelize[_0x614b('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x614b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x614b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x614b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x614b('0x2')]},'destcalleridname':{'type':Sequelize[_0x614b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x614b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x614b('0x2')]},'destlanguage':{'type':Sequelize[_0x614b('0x2')]},'destaccountcode':{'type':Sequelize[_0x614b('0x2')]},'destcontext':{'type':Sequelize[_0x614b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x614b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x614b('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x614b('0x2')]},'from':{'type':Sequelize[_0x614b('0x2')]},'to':{'type':Sequelize[_0x614b('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x614b('0x6')]},'html':{'type':Sequelize[_0x614b('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x614b('0x7')](_0x614b('0x8'),_0x614b('0x9'),_0x614b('0xa'),_0x614b('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x614b('0x2')]},'appdata':{'type':Sequelize[_0x614b('0x2')]},'projectId':{'type':Sequelize[_0x614b('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c3c6de1..eb6ab70 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 _0xbba4=['intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','VIRTUAL','options','IntegrationReport','includeAll','include','rows','catch','show','params','keys','merge','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','map','rawAttributes','fieldName','model','query','filters'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xbba4,0x109));var _0x4bba=function(_0x210705,_0x241721){_0x210705=_0x210705-0x0;var _0x38918b=_0xbba4[_0x210705];return _0x38918b;};'use strict';var emlformat=require(_0x4bba('0x0'));var rimraf=require(_0x4bba('0x1'));var zipdir=require(_0x4bba('0x2'));var jsonpatch=require(_0x4bba('0x3'));var rp=require(_0x4bba('0x4'));var moment=require(_0x4bba('0x5'));var BPromise=require(_0x4bba('0x6'));var Mustache=require(_0x4bba('0x7'));var util=require(_0x4bba('0x8'));var path=require(_0x4bba('0x9'));var sox=require(_0x4bba('0xa'));var csv=require(_0x4bba('0xb'));var ejs=require(_0x4bba('0xc'));var fs=require('fs');var fs_extra=require(_0x4bba('0xd'));var _=require(_0x4bba('0xe'));var squel=require(_0x4bba('0xf'));var crypto=require(_0x4bba('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x4bba('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4bba('0x12'));var Papa=require(_0x4bba('0x13'));var Redis=require(_0x4bba('0x14'));var authService=require(_0x4bba('0x15'));var qs=require(_0x4bba('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bba('0x17'))(_0x4bba('0x18'));var utils=require(_0x4bba('0x19'));var config=require(_0x4bba('0x1a'));var licenseUtil=require(_0x4bba('0x1b'));var db=require(_0x4bba('0x1c'))['db'];function respondWithStatusCode(_0x20063a,_0x301390){_0x301390=_0x301390||0xcc;return function(_0x9536c6){if(_0x9536c6){return _0x20063a[_0x4bba('0x1d')](_0x301390);}return _0x20063a[_0x4bba('0x1e')](_0x301390)[_0x4bba('0x1f')]();};}function respondWithResult(_0x5ba788,_0x38ebbc){_0x38ebbc=_0x38ebbc||0xc8;return function(_0x264b50){if(_0x264b50){return _0x5ba788[_0x4bba('0x1e')](_0x38ebbc)[_0x4bba('0x20')](_0x264b50);}};}function respondWithFilteredResult(_0xedc84d,_0x884be){return function(_0x539936){if(_0x539936){var _0x482100=typeof _0x884be[_0x4bba('0x21')]===_0x4bba('0x22')&&typeof _0x884be[_0x4bba('0x23')]===_0x4bba('0x22');var _0x9d42ad=_0x539936[_0x4bba('0x24')];var _0x85f3ce=_0x482100?0x0:_0x884be[_0x4bba('0x21')];var _0x37f0e=_0x482100?_0x539936['count']:_0x884be[_0x4bba('0x21')]+_0x884be[_0x4bba('0x23')];var _0x3bbc6c;if(_0x37f0e>=_0x9d42ad){_0x37f0e=_0x9d42ad;_0x3bbc6c=0xc8;}else{_0x3bbc6c=0xce;}_0xedc84d[_0x4bba('0x1e')](_0x3bbc6c);return _0xedc84d[_0x4bba('0x25')](_0x4bba('0x26'),_0x85f3ce+'-'+_0x37f0e+'/'+_0x9d42ad)[_0x4bba('0x20')](_0x539936);}return null;};}function patchUpdates(_0x256499){return function(_0x1b9a9e){try{jsonpatch[_0x4bba('0x27')](_0x1b9a9e,_0x256499,!![]);}catch(_0x2b313f){return BPromise[_0x4bba('0x28')](_0x2b313f);}return _0x1b9a9e[_0x4bba('0x29')]();};}function saveUpdates(_0x4eaa33,_0x274d83){return function(_0x28d652){if(_0x28d652){return _0x28d652['update'](_0x4eaa33)[_0x4bba('0x2a')](function(_0x12190d){return _0x12190d;});}return null;};}function removeEntity(_0x5c9352,_0x964159){return function(_0x22ed31){if(_0x22ed31){return _0x22ed31['destroy']()[_0x4bba('0x2a')](function(){_0x5c9352[_0x4bba('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45eb87,_0x2ec0c1){return function(_0x539276){if(!_0x539276){_0x45eb87[_0x4bba('0x1d')](0x194);}return _0x539276;};}function handleError(_0x322fbf,_0x5c6dce){_0x5c6dce=_0x5c6dce||0x1f4;return function(_0x5bbd9d){logger['error'](_0x5bbd9d['stack']);if(_0x5bbd9d[_0x4bba('0x2b')]){delete _0x5bbd9d[_0x4bba('0x2b')];}_0x322fbf[_0x4bba('0x1e')](_0x5c6dce)[_0x4bba('0x2c')](_0x5bbd9d);};}exports['index']=function(_0x3a7426,_0x33f033){var _0x3eb388={},_0x34c73b={},_0x37abbf={'count':0x0,'rows':[]};var _0x4b1238=_[_0x4bba('0x2d')](db['IntegrationReport'][_0x4bba('0x2e')],function(_0x445d68){return{'name':_0x445d68[_0x4bba('0x2f')],'type':_0x445d68['type']['key']};});_0x34c73b[_0x4bba('0x30')]=_[_0x4bba('0x2d')](_0x4b1238,_0x4bba('0x2b'));_0x34c73b[_0x4bba('0x31')]=_['keys'](_0x3a7426[_0x4bba('0x31')]);_0x34c73b[_0x4bba('0x32')]=_[_0x4bba('0x33')](_0x34c73b['model'],_0x34c73b['query']);_0x3eb388[_0x4bba('0x34')]=_[_0x4bba('0x33')](_0x34c73b[_0x4bba('0x30')],qs[_0x4bba('0x35')](_0x3a7426[_0x4bba('0x31')][_0x4bba('0x35')]));_0x3eb388[_0x4bba('0x34')]=_0x3eb388['attributes'][_0x4bba('0x36')]?_0x3eb388['attributes']:_0x34c73b['model'];if(!_0x3a7426[_0x4bba('0x31')][_0x4bba('0x37')]('nolimit')){_0x3eb388['limit']=qs['limit'](_0x3a7426[_0x4bba('0x31')][_0x4bba('0x23')]);_0x3eb388[_0x4bba('0x21')]=qs[_0x4bba('0x21')](_0x3a7426[_0x4bba('0x31')][_0x4bba('0x21')]);}_0x3eb388[_0x4bba('0x38')]=qs[_0x4bba('0x39')](_0x3a7426[_0x4bba('0x31')]['sort']);_0x3eb388['where']=qs[_0x4bba('0x32')](_[_0x4bba('0x3a')](_0x3a7426[_0x4bba('0x31')],_0x34c73b[_0x4bba('0x32')]),_0x4b1238);if(_0x3a7426[_0x4bba('0x31')][_0x4bba('0x3b')]){_0x3eb388[_0x4bba('0x3c')]=_['merge'](_0x3eb388['where'],{'$or':_[_0x4bba('0x2d')](_0x4b1238,function(_0x50fa41){if(_0x50fa41[_0x4bba('0x3d')]!==_0x4bba('0x3e')){var _0x1dfbc2={};_0x1dfbc2[_0x50fa41[_0x4bba('0x2b')]]={'$like':'%'+_0x3a7426[_0x4bba('0x31')]['filter']+'%'};return _0x1dfbc2;}})});}_0x3eb388=_['merge']({},_0x3eb388,_0x3a7426[_0x4bba('0x3f')]);var _0x3c7a23={'where':_0x3eb388['where']};return db[_0x4bba('0x40')][_0x4bba('0x24')](_0x3c7a23)['then'](function(_0x3d3fdf){_0x37abbf[_0x4bba('0x24')]=_0x3d3fdf;if(_0x3a7426[_0x4bba('0x31')][_0x4bba('0x41')]){_0x3eb388[_0x4bba('0x42')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x3eb388);})[_0x4bba('0x2a')](function(_0x28c963){_0x37abbf[_0x4bba('0x43')]=_0x28c963;return _0x37abbf;})[_0x4bba('0x2a')](respondWithFilteredResult(_0x33f033,_0x3eb388))[_0x4bba('0x44')](handleError(_0x33f033,null));};exports[_0x4bba('0x45')]=function(_0x266b82,_0x20a396){var _0x3054be={'raw':![],'where':{'id':_0x266b82[_0x4bba('0x46')]['id']}},_0x1502a5={};_0x1502a5[_0x4bba('0x30')]=_['keys'](db['IntegrationReport'][_0x4bba('0x2e')]);_0x1502a5[_0x4bba('0x31')]=_[_0x4bba('0x47')](_0x266b82[_0x4bba('0x31')]);_0x1502a5[_0x4bba('0x32')]=_[_0x4bba('0x33')](_0x1502a5['model'],_0x1502a5[_0x4bba('0x31')]);_0x3054be[_0x4bba('0x34')]=_['intersection'](_0x1502a5[_0x4bba('0x30')],qs[_0x4bba('0x35')](_0x266b82[_0x4bba('0x31')][_0x4bba('0x35')]));_0x3054be['attributes']=_0x3054be['attributes'][_0x4bba('0x36')]?_0x3054be[_0x4bba('0x34')]:_0x1502a5['model'];if(_0x266b82[_0x4bba('0x31')][_0x4bba('0x41')]){_0x3054be[_0x4bba('0x42')]=[{'all':!![]}];}_0x3054be=_[_0x4bba('0x48')]({},_0x3054be,_0x266b82[_0x4bba('0x3f')]);return db[_0x4bba('0x40')][_0x4bba('0x49')](_0x3054be)[_0x4bba('0x2a')](handleEntityNotFound(_0x20a396,null))[_0x4bba('0x2a')](respondWithResult(_0x20a396,null))['catch'](handleError(_0x20a396,null));};exports[_0x4bba('0x4a')]=function(_0x3265c6,_0x5370a1){return db[_0x4bba('0x40')][_0x4bba('0x4a')](_0x3265c6[_0x4bba('0x4b')],{})[_0x4bba('0x2a')](respondWithResult(_0x5370a1,0xc9))[_0x4bba('0x44')](handleError(_0x5370a1,null));};exports[_0x4bba('0x4c')]=function(_0xeb48b2,_0x46a614){if(_0xeb48b2[_0x4bba('0x4b')]['id']){delete _0xeb48b2[_0x4bba('0x4b')]['id'];}return db['IntegrationReport'][_0x4bba('0x49')]({'where':{'id':_0xeb48b2[_0x4bba('0x46')]['id']}})[_0x4bba('0x2a')](handleEntityNotFound(_0x46a614,null))[_0x4bba('0x2a')](saveUpdates(_0xeb48b2['body'],null))['then'](respondWithResult(_0x46a614,null))[_0x4bba('0x44')](handleError(_0x46a614,null));};exports[_0x4bba('0x4d')]=function(_0x4f008a,_0x27d307){return db[_0x4bba('0x40')][_0x4bba('0x49')]({'where':{'id':_0x4f008a[_0x4bba('0x46')]['id']}})['then'](handleEntityNotFound(_0x27d307,null))[_0x4bba('0x2a')](removeEntity(_0x27d307,null))[_0x4bba('0x44')](handleError(_0x27d307,null));};exports[_0x4bba('0x4e')]=function(_0x49000d,_0x1e69c8){return db[_0x4bba('0x40')][_0x4bba('0x4e')]()[_0x4bba('0x2a')](respondWithResult(_0x1e69c8,null))[_0x4bba('0x44')](handleError(_0x1e69c8,null));}; \ No newline at end of file +var _0x9345=['merge','count','include','rows','catch','show','params','keys','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','then','error','name','map','IntegrationReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x16f17f,_0x17d3b6){var _0x390360=function(_0x118216){while(--_0x118216){_0x16f17f['push'](_0x16f17f['shift']());}};_0x390360(++_0x17d3b6);}(_0x9345,0x11c));var _0x5934=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x9345[_0x946518];return _0x909b69;};'use strict';var emlformat=require(_0x5934('0x0'));var rimraf=require(_0x5934('0x1'));var zipdir=require(_0x5934('0x2'));var jsonpatch=require(_0x5934('0x3'));var rp=require(_0x5934('0x4'));var moment=require('moment');var BPromise=require(_0x5934('0x5'));var Mustache=require('mustache');var util=require(_0x5934('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5934('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5934('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5934('0x9'));var jsforce=require(_0x5934('0xa'));var deskjs=require(_0x5934('0xb'));var toCsv=require(_0x5934('0x7'));var querystring=require(_0x5934('0xc'));var Papa=require('papaparse');var Redis=require(_0x5934('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5934('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5934('0xf'))(_0x5934('0x10'));var utils=require(_0x5934('0x11'));var config=require(_0x5934('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5934('0x13'))['db'];function respondWithStatusCode(_0x536950,_0x2f5d88){_0x2f5d88=_0x2f5d88||0xcc;return function(_0x593e77){if(_0x593e77){return _0x536950[_0x5934('0x14')](_0x2f5d88);}return _0x536950[_0x5934('0x15')](_0x2f5d88)[_0x5934('0x16')]();};}function respondWithResult(_0x48a86b,_0x48b43b){_0x48b43b=_0x48b43b||0xc8;return function(_0x55bc20){if(_0x55bc20){return _0x48a86b['status'](_0x48b43b)['json'](_0x55bc20);}};}function respondWithFilteredResult(_0x54754a,_0x4b33d1){return function(_0x5bf220){if(_0x5bf220){var _0x4b5f6d=typeof _0x4b33d1[_0x5934('0x17')]===_0x5934('0x18')&&typeof _0x4b33d1[_0x5934('0x19')]==='undefined';var _0x20b542=_0x5bf220['count'];var _0x92e01a=_0x4b5f6d?0x0:_0x4b33d1['offset'];var _0x488e8c=_0x4b5f6d?_0x5bf220['count']:_0x4b33d1[_0x5934('0x17')]+_0x4b33d1[_0x5934('0x19')];var _0x3332f2;if(_0x488e8c>=_0x20b542){_0x488e8c=_0x20b542;_0x3332f2=0xc8;}else{_0x3332f2=0xce;}_0x54754a[_0x5934('0x15')](_0x3332f2);return _0x54754a[_0x5934('0x1a')](_0x5934('0x1b'),_0x92e01a+'-'+_0x488e8c+'/'+_0x20b542)[_0x5934('0x1c')](_0x5bf220);}return null;};}function patchUpdates(_0x4af393){return function(_0x282a90){try{jsonpatch[_0x5934('0x1d')](_0x282a90,_0x4af393,!![]);}catch(_0x20fd18){return BPromise['reject'](_0x20fd18);}return _0x282a90[_0x5934('0x1e')]();};}function saveUpdates(_0x22dee4,_0x1b2c7f){return function(_0x1b5430){if(_0x1b5430){return _0x1b5430[_0x5934('0x1f')](_0x22dee4)['then'](function(_0x19f120){return _0x19f120;});}return null;};}function removeEntity(_0x2a92be,_0x2bdd3b){return function(_0x121c07){if(_0x121c07){return _0x121c07[_0x5934('0x20')]()[_0x5934('0x21')](function(){_0x2a92be['status'](0xcc)[_0x5934('0x16')]();});}};}function handleEntityNotFound(_0x50e9d7,_0x46f3f8){return function(_0x4da2a8){if(!_0x4da2a8){_0x50e9d7[_0x5934('0x14')](0x194);}return _0x4da2a8;};}function handleError(_0x4bedf3,_0x5048d8){_0x5048d8=_0x5048d8||0x1f4;return function(_0x5c486d){logger[_0x5934('0x22')](_0x5c486d['stack']);if(_0x5c486d[_0x5934('0x23')]){delete _0x5c486d[_0x5934('0x23')];}_0x4bedf3[_0x5934('0x15')](_0x5048d8)['send'](_0x5c486d);};}exports['index']=function(_0x2675e1,_0x3782aa){var _0x229bc0={},_0x3fdf76={},_0x223828={'count':0x0,'rows':[]};var _0x4060d5=_[_0x5934('0x24')](db[_0x5934('0x25')][_0x5934('0x26')],function(_0x5799ab){return{'name':_0x5799ab[_0x5934('0x27')],'type':_0x5799ab[_0x5934('0x28')]['key']};});_0x3fdf76[_0x5934('0x29')]=_[_0x5934('0x24')](_0x4060d5,_0x5934('0x23'));_0x3fdf76['query']=_['keys'](_0x2675e1[_0x5934('0x2a')]);_0x3fdf76[_0x5934('0x2b')]=_[_0x5934('0x2c')](_0x3fdf76[_0x5934('0x29')],_0x3fdf76[_0x5934('0x2a')]);_0x229bc0[_0x5934('0x2d')]=_[_0x5934('0x2c')](_0x3fdf76[_0x5934('0x29')],qs['fields'](_0x2675e1['query'][_0x5934('0x2e')]));_0x229bc0[_0x5934('0x2d')]=_0x229bc0[_0x5934('0x2d')][_0x5934('0x2f')]?_0x229bc0[_0x5934('0x2d')]:_0x3fdf76['model'];if(!_0x2675e1[_0x5934('0x2a')][_0x5934('0x30')](_0x5934('0x31'))){_0x229bc0[_0x5934('0x19')]=qs[_0x5934('0x19')](_0x2675e1[_0x5934('0x2a')][_0x5934('0x19')]);_0x229bc0[_0x5934('0x17')]=qs[_0x5934('0x17')](_0x2675e1[_0x5934('0x2a')]['offset']);}_0x229bc0[_0x5934('0x32')]=qs[_0x5934('0x33')](_0x2675e1[_0x5934('0x2a')][_0x5934('0x33')]);_0x229bc0[_0x5934('0x34')]=qs['filters'](_[_0x5934('0x35')](_0x2675e1[_0x5934('0x2a')],_0x3fdf76['filters']),_0x4060d5);if(_0x2675e1[_0x5934('0x2a')][_0x5934('0x36')]){_0x229bc0[_0x5934('0x34')]=_['merge'](_0x229bc0['where'],{'$or':_[_0x5934('0x24')](_0x4060d5,function(_0x2ebdea){if(_0x2ebdea[_0x5934('0x28')]!==_0x5934('0x37')){var _0x238c04={};_0x238c04[_0x2ebdea[_0x5934('0x23')]]={'$like':'%'+_0x2675e1[_0x5934('0x2a')][_0x5934('0x36')]+'%'};return _0x238c04;}})});}_0x229bc0=_[_0x5934('0x38')]({},_0x229bc0,_0x2675e1['options']);var _0x322ca8={'where':_0x229bc0[_0x5934('0x34')]};return db['IntegrationReport'][_0x5934('0x39')](_0x322ca8)[_0x5934('0x21')](function(_0x40b89d){_0x223828[_0x5934('0x39')]=_0x40b89d;if(_0x2675e1['query']['includeAll']){_0x229bc0[_0x5934('0x3a')]=[{'all':!![]}];}return db[_0x5934('0x25')]['findAll'](_0x229bc0);})[_0x5934('0x21')](function(_0x124ba7){_0x223828[_0x5934('0x3b')]=_0x124ba7;return _0x223828;})[_0x5934('0x21')](respondWithFilteredResult(_0x3782aa,_0x229bc0))[_0x5934('0x3c')](handleError(_0x3782aa,null));};exports[_0x5934('0x3d')]=function(_0x1786a2,_0x29a812){var _0x5e0578={'raw':![],'where':{'id':_0x1786a2[_0x5934('0x3e')]['id']}},_0x4587fd={};_0x4587fd[_0x5934('0x29')]=_[_0x5934('0x3f')](db[_0x5934('0x25')][_0x5934('0x26')]);_0x4587fd[_0x5934('0x2a')]=_[_0x5934('0x3f')](_0x1786a2[_0x5934('0x2a')]);_0x4587fd[_0x5934('0x2b')]=_[_0x5934('0x2c')](_0x4587fd['model'],_0x4587fd[_0x5934('0x2a')]);_0x5e0578[_0x5934('0x2d')]=_[_0x5934('0x2c')](_0x4587fd[_0x5934('0x29')],qs[_0x5934('0x2e')](_0x1786a2[_0x5934('0x2a')][_0x5934('0x2e')]));_0x5e0578['attributes']=_0x5e0578['attributes'][_0x5934('0x2f')]?_0x5e0578[_0x5934('0x2d')]:_0x4587fd['model'];if(_0x1786a2['query']['includeAll']){_0x5e0578[_0x5934('0x3a')]=[{'all':!![]}];}_0x5e0578=_[_0x5934('0x38')]({},_0x5e0578,_0x1786a2[_0x5934('0x40')]);return db[_0x5934('0x25')][_0x5934('0x41')](_0x5e0578)['then'](handleEntityNotFound(_0x29a812,null))['then'](respondWithResult(_0x29a812,null))['catch'](handleError(_0x29a812,null));};exports['create']=function(_0xc88cfc,_0x590a6f){return db[_0x5934('0x25')]['create'](_0xc88cfc[_0x5934('0x42')],{})[_0x5934('0x21')](respondWithResult(_0x590a6f,0xc9))[_0x5934('0x3c')](handleError(_0x590a6f,null));};exports['update']=function(_0x22689a,_0x42f993){if(_0x22689a[_0x5934('0x42')]['id']){delete _0x22689a[_0x5934('0x42')]['id'];}return db['IntegrationReport'][_0x5934('0x41')]({'where':{'id':_0x22689a[_0x5934('0x3e')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x42f993,null))['then'](saveUpdates(_0x22689a['body'],null))['then'](respondWithResult(_0x42f993,null))[_0x5934('0x3c')](handleError(_0x42f993,null));};exports['destroy']=function(_0x206b29,_0x27b0ea){return db[_0x5934('0x25')][_0x5934('0x41')]({'where':{'id':_0x206b29[_0x5934('0x3e')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x27b0ea,null))[_0x5934('0x21')](removeEntity(_0x27b0ea,null))['catch'](handleError(_0x27b0ea,null));};exports[_0x5934('0x43')]=function(_0x5f3212,_0x4ab835){return db['IntegrationReport'][_0x5934('0x43')]()[_0x5934('0x21')](respondWithResult(_0x4ab835,null))['catch'](handleError(_0x4ab835,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index cb7689b..c7680b2 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 _0xee10=['request-promise','path','rimraf','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','bluebird'];(function(_0x17d96b,_0x346ba7){var _0x949d6f=function(_0x50ef76){while(--_0x50ef76){_0x17d96b['push'](_0x17d96b['shift']());}};_0x949d6f(++_0x346ba7);}(_0xee10,0x163));var _0x0ee1=function(_0x52c4b4,_0x48278b){_0x52c4b4=_0x52c4b4-0x0;var _0x12be5b=_0xee10[_0x52c4b4];return _0x12be5b;};'use strict';var _=require(_0x0ee1('0x0'));var util=require(_0x0ee1('0x1'));var logger=require(_0x0ee1('0x2'))(_0x0ee1('0x3'));var moment=require('moment');var BPromise=require(_0x0ee1('0x4'));var rp=require(_0x0ee1('0x5'));var fs=require('fs');var path=require(_0x0ee1('0x6'));var rimraf=require(_0x0ee1('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ee1('0x8'));module[_0x0ee1('0x9')]=function(_0x5030bc,_0x3b9ca2){return _0x5030bc[_0x0ee1('0xa')]('IntegrationReport',attributes,{'tableName':_0x0ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6856=['exports','IntegrationReport','report_integration','../../config/logger','api','moment','request-promise','./integrationReport.attributes'];(function(_0x204ec8,_0x4999dc){var _0xc29699=function(_0x15864b){while(--_0x15864b){_0x204ec8['push'](_0x204ec8['shift']());}};_0xc29699(++_0x4999dc);}(_0x6856,0x7b));var _0x6685=function(_0x3ee44d,_0x4ca3a4){_0x3ee44d=_0x3ee44d-0x0;var _0x43dc4e=_0x6856[_0x3ee44d];return _0x43dc4e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6685('0x0'))(_0x6685('0x1'));var moment=require(_0x6685('0x2'));var BPromise=require('bluebird');var rp=require(_0x6685('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6685('0x4'));module[_0x6685('0x5')]=function(_0x44675d,_0x5ec429){return _0x44675d['define'](_0x6685('0x6'),attributes,{'tableName':_0x6685('0x7'),'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 c808d5c..fcd0c5b 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x14e79d,_0x6b091a){var _0x14e1b2=function(_0x318eed){while(--_0x318eed){_0x14e79d['push'](_0x14e79d['shift']());}};_0x14e1b2(++_0x6b091a);}(_0xba34,0x119));var _0x4ba3=function(_0x3be072,_0x115237){_0x3be072=_0x3be072-0x0;var _0x5a4ec6=_0xba34[_0x3be072];return _0x5a4ec6;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0x1261=['then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3e6d25,_0x1dae9c){var _0x3600be=function(_0x3c9849){while(--_0x3c9849){_0x3e6d25['push'](_0x3e6d25['shift']());}};_0x3600be(++_0x1dae9c);}(_0x1261,0x144));var _0x1126=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0x1261[_0x350182];return _0x4a0892;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a3f9ea4..a68d44e 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 _0x8a87=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','update','destroy','exports','multer','path','connect-timeout'];(function(_0x58ba13,_0x220c0b){var _0x4382c2=function(_0x50c98d){while(--_0x50c98d){_0x58ba13['push'](_0x58ba13['shift']());}};_0x4382c2(++_0x220c0b);}(_0x8a87,0xa5));var _0x78a8=function(_0x34fab4,_0x194738){_0x34fab4=_0x34fab4-0x0;var _0x42fa5c=_0x8a87[_0x34fab4];return _0x42fa5c;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require(_0x78a8('0x1'));var timeout=require(_0x78a8('0x2'));var express=require('express');var router=express[_0x78a8('0x3')]();var fs_extra=require(_0x78a8('0x4'));var auth=require(_0x78a8('0x5'));var interaction=require(_0x78a8('0x6'));var config=require(_0x78a8('0x7'));var controller=require(_0x78a8('0x8'));router[_0x78a8('0x9')]('/',auth[_0x78a8('0xa')](),controller[_0x78a8('0xb')]);router[_0x78a8('0x9')](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller['show']);router[_0x78a8('0x9')](_0x78a8('0xd'),auth[_0x78a8('0xa')](),controller[_0x78a8('0xe')]);router[_0x78a8('0xf')]('/',auth[_0x78a8('0xa')](),controller['create']);router['post'](_0x78a8('0xd'),auth[_0x78a8('0xa')](),controller['addInterval']);router[_0x78a8('0xf')](_0x78a8('0x10'),auth[_0x78a8('0xa')](),controller[_0x78a8('0x11')]);router['put'](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller[_0x78a8('0x12')]);router['delete']('/:id',auth[_0x78a8('0xa')](),controller[_0x78a8('0x13')]);module[_0x78a8('0x14')]=router; \ No newline at end of file +var _0xf006=['addIntervals','put','/:id','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf006,0x146));var _0x6f00=function(_0x2ee2da,_0x4f7458){_0x2ee2da=_0x2ee2da-0x0;var _0x59214d=_0xf006[_0x2ee2da];return _0x59214d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/:id',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xa')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xc')]);router['post'](_0x6f00('0xd'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);router[_0x6f00('0xf')](_0x6f00('0x10'),auth['isAuthenticated'](),controller[_0x6f00('0x11')]);router['delete'](_0x6f00('0x10'),auth['isAuthenticated'](),controller[_0x6f00('0x12')]);module[_0x6f00('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ca2e384..be633fa 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 _0x06a9=['sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x06a9,0xb4));var _0x906a=function(_0x394739,_0x19ce1e){_0x394739=_0x394739-0x0;var _0x48d11e=_0x06a9[_0x394739];return _0x48d11e;};'use strict';var Sequelize=require(_0x906a('0x0'));module[_0x906a('0x1')]={'name':{'type':Sequelize[_0x906a('0x2')]},'description':{'type':Sequelize[_0x906a('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb29b=['exports','STRING'];(function(_0x20c352,_0x226128){var _0x31cdf1=function(_0x3cf7ff){while(--_0x3cf7ff){_0x20c352['push'](_0x20c352['shift']());}};_0x31cdf1(++_0x226128);}(_0xb29b,0x102));var _0xbb29=function(_0x11595a,_0x58ed48){_0x11595a=_0x11595a-0x0;var _0x34cc1e=_0xb29b[_0x11595a];return _0x34cc1e;};'use strict';var Sequelize=require('sequelize');module[_0xbb29('0x0')]={'name':{'type':Sequelize[_0xbb29('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbb29('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 8627d33..599a8d5 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 _0x94a8=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x38f4c1,_0xaf0cc1){var _0x4fe811=function(_0x17640c){while(--_0x17640c){_0x38f4c1['push'](_0x38f4c1['shift']());}};_0x4fe811(++_0xaf0cc1);}(_0x94a8,0x1b0));var _0x894a=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x94a8[_0x34021d];return _0x16597b;};'use strict';var emlformat=require(_0x894a('0x0'));var rimraf=require(_0x894a('0x1'));var zipdir=require(_0x894a('0x2'));var jsonpatch=require(_0x894a('0x3'));var rp=require(_0x894a('0x4'));var moment=require(_0x894a('0x5'));var BPromise=require(_0x894a('0x6'));var Mustache=require(_0x894a('0x7'));var util=require(_0x894a('0x8'));var path=require(_0x894a('0x9'));var sox=require(_0x894a('0xa'));var csv=require(_0x894a('0xb'));var ejs=require(_0x894a('0xc'));var fs=require('fs');var fs_extra=require(_0x894a('0xd'));var _=require(_0x894a('0xe'));var squel=require('squel');var crypto=require(_0x894a('0xf'));var jsforce=require(_0x894a('0x10'));var deskjs=require(_0x894a('0x11'));var toCsv=require(_0x894a('0xb'));var querystring=require(_0x894a('0x12'));var Papa=require('papaparse');var Redis=require(_0x894a('0x13'));var authService=require(_0x894a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x894a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x894a('0x16'));var utils=require(_0x894a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x894a('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x894a('0x19'));function respondWithStatusCode(_0x4f70da,_0x510e14){_0x510e14=_0x510e14||0xcc;return function(_0x5e0aef){if(_0x5e0aef){return _0x4f70da[_0x894a('0x1a')](_0x510e14);}return _0x4f70da['status'](_0x510e14)[_0x894a('0x1b')]();};}function respondWithResult(_0x49a65a,_0x1f7426){_0x1f7426=_0x1f7426||0xc8;return function(_0x4ea5da){if(_0x4ea5da){return _0x49a65a[_0x894a('0x1c')](_0x1f7426)['json'](_0x4ea5da);}};}function respondWithFilteredResult(_0x14d0f8,_0x10e213){return function(_0x485c46){if(_0x485c46){var _0x50b3b2=typeof _0x10e213['offset']===_0x894a('0x1d')&&typeof _0x10e213['limit']===_0x894a('0x1d');var _0x3505e9=_0x485c46['count'];var _0x989ed1=_0x50b3b2?0x0:_0x10e213['offset'];var _0x30ddfb=_0x50b3b2?_0x485c46[_0x894a('0x1e')]:_0x10e213[_0x894a('0x1f')]+_0x10e213[_0x894a('0x20')];var _0xad9fdb;if(_0x30ddfb>=_0x3505e9){_0x30ddfb=_0x3505e9;_0xad9fdb=0xc8;}else{_0xad9fdb=0xce;}_0x14d0f8['status'](_0xad9fdb);return _0x14d0f8[_0x894a('0x21')]('Content-Range',_0x989ed1+'-'+_0x30ddfb+'/'+_0x3505e9)[_0x894a('0x22')](_0x485c46);}return null;};}function patchUpdates(_0x2dd749){return function(_0x5bc368){try{jsonpatch[_0x894a('0x23')](_0x5bc368,_0x2dd749,!![]);}catch(_0x4dba70){return BPromise[_0x894a('0x24')](_0x4dba70);}return _0x5bc368[_0x894a('0x25')]();};}function saveUpdates(_0x8dfa41,_0x7be6d8){return function(_0x5a8ebb){if(_0x5a8ebb){return _0x5a8ebb['update'](_0x8dfa41)[_0x894a('0x26')](function(_0x2d8954){return _0x2d8954;});}return null;};}function removeEntity(_0x538662,_0x3cac6b){return function(_0x5aa3a7){if(_0x5aa3a7){return _0x5aa3a7[_0x894a('0x27')]()[_0x894a('0x26')](function(){var _0x4c2df9=_0x5aa3a7[_0x894a('0x28')]({'plain':!![]});var _0x5397fa=_0x894a('0x29');return db[_0x894a('0x2a')][_0x894a('0x27')]({'where':{'type':_0x5397fa,'resourceId':_0x4c2df9['id']}})[_0x894a('0x26')](function(){return _0x5aa3a7;});})[_0x894a('0x26')](function(){_0x538662[_0x894a('0x1c')](0xcc)[_0x894a('0x1b')]();});}};}function handleEntityNotFound(_0x583cdd,_0x291b42){return function(_0x323973){if(!_0x323973){_0x583cdd[_0x894a('0x1a')](0x194);}return _0x323973;};}function handleError(_0x20d738,_0x4143b7){_0x4143b7=_0x4143b7||0x1f4;return function(_0x385324){logger[_0x894a('0x2b')](_0x385324['stack']);if(_0x385324['name']){delete _0x385324[_0x894a('0x2c')];}_0x20d738[_0x894a('0x1c')](_0x4143b7)[_0x894a('0x2d')](_0x385324);};}exports[_0x894a('0x2e')]=function(_0x965f07,_0x102607){var _0x33941b={},_0x9ac248={},_0x4fe54d={'count':0x0,'rows':[]};var _0x1a73ca=_[_0x894a('0x2f')](db[_0x894a('0x30')][_0x894a('0x31')],function(_0x27dd08){return{'name':_0x27dd08['fieldName'],'type':_0x27dd08[_0x894a('0x32')]['key']};});_0x9ac248[_0x894a('0x33')]=_[_0x894a('0x2f')](_0x1a73ca,'name');_0x9ac248['query']=_[_0x894a('0x34')](_0x965f07['query']);_0x9ac248[_0x894a('0x35')]=_[_0x894a('0x36')](_0x9ac248[_0x894a('0x33')],_0x9ac248[_0x894a('0x37')]);_0x33941b[_0x894a('0x38')]=_[_0x894a('0x36')](_0x9ac248[_0x894a('0x33')],qs[_0x894a('0x39')](_0x965f07['query'][_0x894a('0x39')]));_0x33941b[_0x894a('0x38')]=_0x33941b['attributes'][_0x894a('0x3a')]?_0x33941b['attributes']:_0x9ac248[_0x894a('0x33')];if(!_0x965f07[_0x894a('0x37')]['hasOwnProperty'](_0x894a('0x3b'))){_0x33941b[_0x894a('0x20')]=qs[_0x894a('0x20')](_0x965f07[_0x894a('0x37')][_0x894a('0x20')]);_0x33941b[_0x894a('0x1f')]=qs[_0x894a('0x1f')](_0x965f07[_0x894a('0x37')]['offset']);}_0x33941b[_0x894a('0x3c')]=qs[_0x894a('0x3d')](_0x965f07[_0x894a('0x37')][_0x894a('0x3d')]);_0x33941b[_0x894a('0x3e')]=qs['filters'](_[_0x894a('0x3f')](_0x965f07[_0x894a('0x37')],_0x9ac248[_0x894a('0x35')]),_0x1a73ca);if(_0x965f07[_0x894a('0x37')]['filter']){_0x33941b[_0x894a('0x3e')]=_[_0x894a('0x40')](_0x33941b[_0x894a('0x3e')],{'$or':_[_0x894a('0x2f')](_0x1a73ca,function(_0x3cc937){if(_0x3cc937[_0x894a('0x32')]!==_0x894a('0x41')){var _0x5d59f4={};_0x5d59f4[_0x3cc937['name']]={'$like':'%'+_0x965f07[_0x894a('0x37')][_0x894a('0x42')]+'%'};return _0x5d59f4;}})});}_0x33941b=_[_0x894a('0x40')]({},_0x33941b,_0x965f07['options']);var _0x15aaeb={'where':_0x33941b[_0x894a('0x3e')]};return db[_0x894a('0x30')][_0x894a('0x1e')](_0x15aaeb)[_0x894a('0x26')](function(_0x23d537){_0x4fe54d[_0x894a('0x1e')]=_0x23d537;if(_0x965f07['query'][_0x894a('0x43')]){_0x33941b[_0x894a('0x44')]=[{'all':!![]}];}return db[_0x894a('0x30')]['findAll'](_0x33941b);})['then'](function(_0x3bc398){_0x4fe54d['rows']=_0x3bc398;return _0x4fe54d;})[_0x894a('0x26')](respondWithFilteredResult(_0x102607,_0x33941b))[_0x894a('0x45')](handleError(_0x102607,null));};exports['show']=function(_0x4a3976,_0x1fc050){var _0x3a5191={'raw':!![],'where':{'id':_0x4a3976[_0x894a('0x46')]['id']}},_0x547053={};_0x547053[_0x894a('0x33')]=_['keys'](db[_0x894a('0x30')][_0x894a('0x31')]);_0x547053[_0x894a('0x37')]=_[_0x894a('0x34')](_0x4a3976[_0x894a('0x37')]);_0x547053[_0x894a('0x35')]=_[_0x894a('0x36')](_0x547053[_0x894a('0x33')],_0x547053[_0x894a('0x37')]);_0x3a5191[_0x894a('0x38')]=_[_0x894a('0x36')](_0x547053[_0x894a('0x33')],qs[_0x894a('0x39')](_0x4a3976['query'][_0x894a('0x39')]));_0x3a5191[_0x894a('0x38')]=_0x3a5191['attributes'][_0x894a('0x3a')]?_0x3a5191['attributes']:_0x547053[_0x894a('0x33')];if(_0x4a3976[_0x894a('0x37')]['includeAll']){_0x3a5191[_0x894a('0x44')]=[{'all':!![]}];}_0x3a5191=_[_0x894a('0x40')]({},_0x3a5191,_0x4a3976[_0x894a('0x47')]);return db[_0x894a('0x30')][_0x894a('0x48')](_0x3a5191)[_0x894a('0x26')](handleEntityNotFound(_0x1fc050,null))[_0x894a('0x26')](respondWithResult(_0x1fc050,null))[_0x894a('0x45')](handleError(_0x1fc050,null));};exports[_0x894a('0x49')]=function(_0x52a4d6,_0x1c4017){return db[_0x894a('0x30')][_0x894a('0x49')](_0x52a4d6[_0x894a('0x4a')],{})['then'](function(_0x12f2c2){var _0x508057=_0x52a4d6[_0x894a('0x4b')][_0x894a('0x28')]({'plain':!![]});if(!_0x508057)throw new Error(_0x894a('0x4c'));if(_0x508057[_0x894a('0x4d')]===_0x894a('0x4b')){var _0x433b1d=_0x12f2c2[_0x894a('0x28')]({'plain':!![]});var _0x43ec46='Intervals';return db['UserProfileSection'][_0x894a('0x48')]({'where':{'name':_0x43ec46,'userProfileId':_0x508057[_0x894a('0x4e')]},'raw':!![]})[_0x894a('0x26')](function(_0x215072){if(_0x215072&&_0x215072[_0x894a('0x4f')]===0x0){return db[_0x894a('0x2a')][_0x894a('0x49')]({'name':_0x433b1d[_0x894a('0x2c')],'resourceId':_0x433b1d['id'],'type':_0x215072[_0x894a('0x2c')],'sectionId':_0x215072['id']},{})[_0x894a('0x26')](function(){return _0x12f2c2;});}else{return _0x12f2c2;}})[_0x894a('0x45')](function(_0x2971a6){logger[_0x894a('0x2b')](_0x894a('0x50'),_0x2971a6);throw _0x2971a6;});}return _0x12f2c2;})['then'](respondWithResult(_0x1c4017,0xc9))['catch'](handleError(_0x1c4017,null));};exports[_0x894a('0x51')]=function(_0xd9df4b,_0x210dfb){if(_0xd9df4b['body']['id']){delete _0xd9df4b[_0x894a('0x4a')]['id'];}return db[_0x894a('0x30')][_0x894a('0x48')]({'where':{'id':_0xd9df4b[_0x894a('0x46')]['id']}})[_0x894a('0x26')](handleEntityNotFound(_0x210dfb,null))[_0x894a('0x26')](saveUpdates(_0xd9df4b[_0x894a('0x4a')],null))[_0x894a('0x26')](respondWithResult(_0x210dfb,null))[_0x894a('0x45')](handleError(_0x210dfb,null));};exports[_0x894a('0x27')]=function(_0x562f9f,_0x503ea9){return db['Interval'][_0x894a('0x48')]({'where':{'id':_0x562f9f[_0x894a('0x46')]['id']}})[_0x894a('0x26')](handleEntityNotFound(_0x503ea9,null))[_0x894a('0x26')](removeEntity(_0x503ea9,null))[_0x894a('0x45')](handleError(_0x503ea9,null));};exports['addInterval']=function(_0x3c5dd6,_0x213b8a,_0x1f6c2f){if(_0x3c5dd6[_0x894a('0x4a')]['id']){delete _0x3c5dd6[_0x894a('0x4a')]['id'];}return db[_0x894a('0x30')][_0x894a('0x48')]({'where':{'id':_0x3c5dd6['params']['id']}})[_0x894a('0x26')](handleEntityNotFound(_0x213b8a,null))[_0x894a('0x26')](function(_0x41497b){if(_0x41497b){_0x3c5dd6[_0x894a('0x4a')][_0x894a('0x52')]=_0x41497b['id'];return db[_0x894a('0x30')][_0x894a('0x49')](_0x3c5dd6['body']);}})[_0x894a('0x26')](respondWithResult(_0x213b8a,null))[_0x894a('0x45')](handleError(_0x213b8a,null));};exports[_0x894a('0x53')]=function(_0xc2b768,_0x672a8a,_0x24d972){var _0x53a407={};var _0x54f0a1={};var _0x27b78f;var _0x55595f;return db['Interval']['findOne']({'where':{'id':_0xc2b768[_0x894a('0x46')]['id']}})[_0x894a('0x26')](handleEntityNotFound(_0x672a8a,null))[_0x894a('0x26')](function(_0x23186d){if(_0x23186d){_0x27b78f=_0x23186d;_0x54f0a1[_0x894a('0x33')]=_['keys'](db[_0x894a('0x30')]['rawAttributes']);_0x54f0a1[_0x894a('0x37')]=_['keys'](_0xc2b768['query']);_0x54f0a1[_0x894a('0x35')]=_['intersection'](_0x54f0a1[_0x894a('0x33')],_0x54f0a1[_0x894a('0x37')]);_0x53a407[_0x894a('0x38')]=_[_0x894a('0x36')](_0x54f0a1[_0x894a('0x33')],qs['fields'](_0xc2b768[_0x894a('0x37')][_0x894a('0x39')]));_0x53a407['attributes']=_0x53a407[_0x894a('0x38')][_0x894a('0x3a')]?_0x53a407['attributes']:_0x54f0a1[_0x894a('0x33')];_0x53a407['order']=qs[_0x894a('0x3d')](_0xc2b768[_0x894a('0x37')][_0x894a('0x3d')]);_0x53a407[_0x894a('0x3e')]=qs[_0x894a('0x35')](_[_0x894a('0x3f')](_0xc2b768['query'],_0x54f0a1['filters']));if(_0xc2b768[_0x894a('0x37')][_0x894a('0x42')]){_0x53a407[_0x894a('0x3e')]=_[_0x894a('0x40')](_0x53a407['where'],{'$or':_[_0x894a('0x2f')](_0x53a407['attributes'],function(_0x4a10dc){var _0x256487={};_0x256487[_0x4a10dc]={'$like':'%'+_0xc2b768[_0x894a('0x37')][_0x894a('0x42')]+'%'};return _0x256487;})});}_0x53a407=_['merge']({},_0x53a407,_0xc2b768[_0x894a('0x47')]);return _0x27b78f[_0x894a('0x53')](_0x53a407);}})['then'](function(_0x41d2af){if(_0x41d2af){_0x55595f=_0x41d2af[_0x894a('0x3a')];if(!_0xc2b768[_0x894a('0x37')][_0x894a('0x54')](_0x894a('0x3b'))){_0x53a407[_0x894a('0x20')]=qs['limit'](_0xc2b768[_0x894a('0x37')]['limit']);_0x53a407['offset']=qs[_0x894a('0x1f')](_0xc2b768[_0x894a('0x37')][_0x894a('0x1f')]);}return _0x27b78f[_0x894a('0x53')](_0x53a407);}})[_0x894a('0x26')](function(_0x5b228c){if(_0x5b228c){return _0x5b228c?{'count':_0x55595f,'rows':_0x5b228c}:null;}})[_0x894a('0x26')](respondWithResult(_0x672a8a,null))[_0x894a('0x45')](handleError(_0x672a8a,null));};exports[_0x894a('0x55')]=function(_0x1e4820,_0x182576,_0x1af99d){return db['Interval'][_0x894a('0x56')]({'where':{'id':_0x1e4820['params']['id']}})['then'](handleEntityNotFound(_0x182576,null))[_0x894a('0x26')](function(_0x3ddcfd){if(_0x3ddcfd){return db[_0x894a('0x57')]['transaction'](function(_0x5b9b85){return db[_0x894a('0x30')]['destroy']({'where':{'IntervalId':_0x1e4820[_0x894a('0x46')]['id']},'transaction':_0x5b9b85})[_0x894a('0x26')](function(_0x4e89d1){var _0x4be837=_['map'](_0x1e4820[_0x894a('0x4a')],function(_0x35dd1c){delete _0x35dd1c['id'];_0x35dd1c[_0x894a('0x52')]=_0x1e4820[_0x894a('0x46')]['id'];return _0x35dd1c;});return db[_0x894a('0x30')][_0x894a('0x58')](_0x4be837,{'transaction':_0x5b9b85});});})[_0x894a('0x26')](function(){return db[_0x894a('0x30')][_0x894a('0x59')]({'where':{'IntervalId':_0x1e4820['params']['id']}});});}})[_0x894a('0x26')](respondWithResult(_0x182576,null))['catch'](handleError(_0x182576,null));}; \ No newline at end of file +var _0x28f1=['bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','sendStatus','name','send','Interval','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','nolimit','findOne','sequelize','transaction'];(function(_0x311183,_0x214738){var _0x1381d7=function(_0x532295){while(--_0x532295){_0x311183['push'](_0x311183['shift']());}};_0x1381d7(++_0x214738);}(_0x28f1,0x171));var _0x128f=function(_0x42eeea,_0x4339da){_0x42eeea=_0x42eeea-0x0;var _0x4872ab=_0x28f1[_0x42eeea];return _0x4872ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x128f('0x0'));var zipdir=require(_0x128f('0x1'));var jsonpatch=require(_0x128f('0x2'));var rp=require(_0x128f('0x3'));var moment=require(_0x128f('0x4'));var BPromise=require(_0x128f('0x5'));var Mustache=require('mustache');var util=require(_0x128f('0x6'));var path=require('path');var sox=require(_0x128f('0x7'));var csv=require(_0x128f('0x8'));var ejs=require(_0x128f('0x9'));var fs=require('fs');var fs_extra=require(_0x128f('0xa'));var _=require(_0x128f('0xb'));var squel=require(_0x128f('0xc'));var crypto=require(_0x128f('0xd'));var jsforce=require(_0x128f('0xe'));var deskjs=require(_0x128f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x128f('0x10'));var Papa=require(_0x128f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x128f('0x12'));var as=require(_0x128f('0x13'));var hardwareService=require(_0x128f('0x14'));var logger=require(_0x128f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x128f('0x16'));var licenseUtil=require(_0x128f('0x17'));var db=require(_0x128f('0x18'))['db'];var extensions=require(_0x128f('0x19'));function respondWithStatusCode(_0x5eccad,_0x1d2371){_0x1d2371=_0x1d2371||0xcc;return function(_0xc24995){if(_0xc24995){return _0x5eccad['sendStatus'](_0x1d2371);}return _0x5eccad['status'](_0x1d2371)[_0x128f('0x1a')]();};}function respondWithResult(_0xe93ef1,_0x35480a){_0x35480a=_0x35480a||0xc8;return function(_0x13ba25){if(_0x13ba25){return _0xe93ef1[_0x128f('0x1b')](_0x35480a)[_0x128f('0x1c')](_0x13ba25);}};}function respondWithFilteredResult(_0x49686d,_0x1362b4){return function(_0x18c355){if(_0x18c355){var _0x810ac8=typeof _0x1362b4[_0x128f('0x1d')]===_0x128f('0x1e')&&typeof _0x1362b4[_0x128f('0x1f')]==='undefined';var _0x244439=_0x18c355['count'];var _0x2f2f10=_0x810ac8?0x0:_0x1362b4[_0x128f('0x1d')];var _0x5ea0c4=_0x810ac8?_0x18c355[_0x128f('0x20')]:_0x1362b4['offset']+_0x1362b4['limit'];var _0x43a878;if(_0x5ea0c4>=_0x244439){_0x5ea0c4=_0x244439;_0x43a878=0xc8;}else{_0x43a878=0xce;}_0x49686d[_0x128f('0x1b')](_0x43a878);return _0x49686d[_0x128f('0x21')]('Content-Range',_0x2f2f10+'-'+_0x5ea0c4+'/'+_0x244439)[_0x128f('0x1c')](_0x18c355);}return null;};}function patchUpdates(_0x156a46){return function(_0x4c4f89){try{jsonpatch[_0x128f('0x22')](_0x4c4f89,_0x156a46,!![]);}catch(_0x5d10cc){return BPromise[_0x128f('0x23')](_0x5d10cc);}return _0x4c4f89[_0x128f('0x24')]();};}function saveUpdates(_0x4261c0,_0x29f94c){return function(_0x25ecad){if(_0x25ecad){return _0x25ecad[_0x128f('0x25')](_0x4261c0)[_0x128f('0x26')](function(_0x312928){return _0x312928;});}return null;};}function removeEntity(_0x3f986f,_0x4945de){return function(_0x359030){if(_0x359030){return _0x359030['destroy']()[_0x128f('0x26')](function(){var _0x35a908=_0x359030[_0x128f('0x27')]({'plain':!![]});var _0x19cb55=_0x128f('0x28');return db[_0x128f('0x29')][_0x128f('0x2a')]({'where':{'type':_0x19cb55,'resourceId':_0x35a908['id']}})[_0x128f('0x26')](function(){return _0x359030;});})[_0x128f('0x26')](function(){_0x3f986f[_0x128f('0x1b')](0xcc)[_0x128f('0x1a')]();});}};}function handleEntityNotFound(_0x339b34,_0x4a7e6a){return function(_0x2c55d6){if(!_0x2c55d6){_0x339b34[_0x128f('0x2b')](0x194);}return _0x2c55d6;};}function handleError(_0x2baecc,_0x236e2a){_0x236e2a=_0x236e2a||0x1f4;return function(_0x1c4fd7){logger['error'](_0x1c4fd7['stack']);if(_0x1c4fd7[_0x128f('0x2c')]){delete _0x1c4fd7['name'];}_0x2baecc[_0x128f('0x1b')](_0x236e2a)[_0x128f('0x2d')](_0x1c4fd7);};}exports['index']=function(_0x173f4d,_0x41c1df){var _0x53d244={},_0x5f3c7c={},_0x3470e0={'count':0x0,'rows':[]};var _0x12e57b=_['map'](db[_0x128f('0x2e')]['rawAttributes'],function(_0x6fb1a1){return{'name':_0x6fb1a1[_0x128f('0x2f')],'type':_0x6fb1a1[_0x128f('0x30')][_0x128f('0x31')]};});_0x5f3c7c[_0x128f('0x32')]=_[_0x128f('0x33')](_0x12e57b,_0x128f('0x2c'));_0x5f3c7c[_0x128f('0x34')]=_[_0x128f('0x35')](_0x173f4d[_0x128f('0x34')]);_0x5f3c7c[_0x128f('0x36')]=_[_0x128f('0x37')](_0x5f3c7c['model'],_0x5f3c7c['query']);_0x53d244[_0x128f('0x38')]=_[_0x128f('0x37')](_0x5f3c7c[_0x128f('0x32')],qs[_0x128f('0x39')](_0x173f4d[_0x128f('0x34')][_0x128f('0x39')]));_0x53d244[_0x128f('0x38')]=_0x53d244['attributes'][_0x128f('0x3a')]?_0x53d244[_0x128f('0x38')]:_0x5f3c7c[_0x128f('0x32')];if(!_0x173f4d[_0x128f('0x34')][_0x128f('0x3b')]('nolimit')){_0x53d244[_0x128f('0x1f')]=qs['limit'](_0x173f4d[_0x128f('0x34')][_0x128f('0x1f')]);_0x53d244[_0x128f('0x1d')]=qs['offset'](_0x173f4d[_0x128f('0x34')][_0x128f('0x1d')]);}_0x53d244[_0x128f('0x3c')]=qs[_0x128f('0x3d')](_0x173f4d['query'][_0x128f('0x3d')]);_0x53d244['where']=qs[_0x128f('0x36')](_[_0x128f('0x3e')](_0x173f4d[_0x128f('0x34')],_0x5f3c7c[_0x128f('0x36')]),_0x12e57b);if(_0x173f4d['query']['filter']){_0x53d244[_0x128f('0x3f')]=_[_0x128f('0x40')](_0x53d244[_0x128f('0x3f')],{'$or':_[_0x128f('0x33')](_0x12e57b,function(_0x3a5040){if(_0x3a5040[_0x128f('0x30')]!==_0x128f('0x41')){var _0x2a7ae8={};_0x2a7ae8[_0x3a5040['name']]={'$like':'%'+_0x173f4d['query'][_0x128f('0x42')]+'%'};return _0x2a7ae8;}})});}_0x53d244=_[_0x128f('0x40')]({},_0x53d244,_0x173f4d[_0x128f('0x43')]);var _0x3d7c17={'where':_0x53d244[_0x128f('0x3f')]};return db[_0x128f('0x2e')][_0x128f('0x20')](_0x3d7c17)[_0x128f('0x26')](function(_0x2e8d1d){_0x3470e0['count']=_0x2e8d1d;if(_0x173f4d[_0x128f('0x34')][_0x128f('0x44')]){_0x53d244[_0x128f('0x45')]=[{'all':!![]}];}return db['Interval'][_0x128f('0x46')](_0x53d244);})[_0x128f('0x26')](function(_0x4caa19){_0x3470e0['rows']=_0x4caa19;return _0x3470e0;})[_0x128f('0x26')](respondWithFilteredResult(_0x41c1df,_0x53d244))[_0x128f('0x47')](handleError(_0x41c1df,null));};exports[_0x128f('0x48')]=function(_0x4d9c91,_0x5cb01f){var _0x53c039={'raw':!![],'where':{'id':_0x4d9c91[_0x128f('0x49')]['id']}},_0x43fc91={};_0x43fc91['model']=_[_0x128f('0x35')](db[_0x128f('0x2e')][_0x128f('0x4a')]);_0x43fc91['query']=_[_0x128f('0x35')](_0x4d9c91['query']);_0x43fc91[_0x128f('0x36')]=_['intersection'](_0x43fc91[_0x128f('0x32')],_0x43fc91[_0x128f('0x34')]);_0x53c039[_0x128f('0x38')]=_[_0x128f('0x37')](_0x43fc91[_0x128f('0x32')],qs[_0x128f('0x39')](_0x4d9c91['query'][_0x128f('0x39')]));_0x53c039[_0x128f('0x38')]=_0x53c039[_0x128f('0x38')][_0x128f('0x3a')]?_0x53c039[_0x128f('0x38')]:_0x43fc91[_0x128f('0x32')];if(_0x4d9c91[_0x128f('0x34')][_0x128f('0x44')]){_0x53c039[_0x128f('0x45')]=[{'all':!![]}];}_0x53c039=_[_0x128f('0x40')]({},_0x53c039,_0x4d9c91[_0x128f('0x43')]);return db[_0x128f('0x2e')][_0x128f('0x4b')](_0x53c039)[_0x128f('0x26')](handleEntityNotFound(_0x5cb01f,null))['then'](respondWithResult(_0x5cb01f,null))['catch'](handleError(_0x5cb01f,null));};exports[_0x128f('0x4c')]=function(_0x14a234,_0x5438d1){return db[_0x128f('0x2e')][_0x128f('0x4c')](_0x14a234[_0x128f('0x4d')],{})[_0x128f('0x26')](function(_0xf9fe14){var _0x33b8db=_0x14a234['user'][_0x128f('0x27')]({'plain':!![]});if(!_0x33b8db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33b8db[_0x128f('0x4e')]==='user'){var _0x307650=_0xf9fe14['get']({'plain':!![]});var _0x575036=_0x128f('0x28');return db[_0x128f('0x4f')]['find']({'where':{'name':_0x575036,'userProfileId':_0x33b8db[_0x128f('0x50')]},'raw':!![]})['then'](function(_0x11a2c7){if(_0x11a2c7&&_0x11a2c7[_0x128f('0x51')]===0x0){return db['UserProfileResource'][_0x128f('0x4c')]({'name':_0x307650['name'],'resourceId':_0x307650['id'],'type':_0x11a2c7['name'],'sectionId':_0x11a2c7['id']},{})[_0x128f('0x26')](function(){return _0xf9fe14;});}else{return _0xf9fe14;}})[_0x128f('0x47')](function(_0x1f0b66){logger[_0x128f('0x52')](_0x128f('0x53'),_0x1f0b66);throw _0x1f0b66;});}return _0xf9fe14;})[_0x128f('0x26')](respondWithResult(_0x5438d1,0xc9))[_0x128f('0x47')](handleError(_0x5438d1,null));};exports['update']=function(_0x35bbc4,_0x5b06ef){if(_0x35bbc4[_0x128f('0x4d')]['id']){delete _0x35bbc4[_0x128f('0x4d')]['id'];}return db[_0x128f('0x2e')]['find']({'where':{'id':_0x35bbc4[_0x128f('0x49')]['id']}})[_0x128f('0x26')](handleEntityNotFound(_0x5b06ef,null))[_0x128f('0x26')](saveUpdates(_0x35bbc4[_0x128f('0x4d')],null))[_0x128f('0x26')](respondWithResult(_0x5b06ef,null))['catch'](handleError(_0x5b06ef,null));};exports[_0x128f('0x2a')]=function(_0x343b0a,_0x596396){return db[_0x128f('0x2e')][_0x128f('0x4b')]({'where':{'id':_0x343b0a['params']['id']}})['then'](handleEntityNotFound(_0x596396,null))[_0x128f('0x26')](removeEntity(_0x596396,null))[_0x128f('0x47')](handleError(_0x596396,null));};exports[_0x128f('0x54')]=function(_0x5ca77b,_0x3f4af1,_0x43c624){if(_0x5ca77b[_0x128f('0x4d')]['id']){delete _0x5ca77b[_0x128f('0x4d')]['id'];}return db['Interval'][_0x128f('0x4b')]({'where':{'id':_0x5ca77b[_0x128f('0x49')]['id']}})['then'](handleEntityNotFound(_0x3f4af1,null))[_0x128f('0x26')](function(_0x34d0fb){if(_0x34d0fb){_0x5ca77b[_0x128f('0x4d')][_0x128f('0x55')]=_0x34d0fb['id'];return db['Interval'][_0x128f('0x4c')](_0x5ca77b[_0x128f('0x4d')]);}})[_0x128f('0x26')](respondWithResult(_0x3f4af1,null))['catch'](handleError(_0x3f4af1,null));};exports[_0x128f('0x56')]=function(_0x1c4699,_0x5f27c9,_0x538342){var _0x15c936={};var _0x409cf8={};var _0x456924;var _0x219848;return db[_0x128f('0x2e')]['findOne']({'where':{'id':_0x1c4699[_0x128f('0x49')]['id']}})[_0x128f('0x26')](handleEntityNotFound(_0x5f27c9,null))[_0x128f('0x26')](function(_0x415e2c){if(_0x415e2c){_0x456924=_0x415e2c;_0x409cf8[_0x128f('0x32')]=_[_0x128f('0x35')](db['Interval']['rawAttributes']);_0x409cf8[_0x128f('0x34')]=_[_0x128f('0x35')](_0x1c4699[_0x128f('0x34')]);_0x409cf8[_0x128f('0x36')]=_[_0x128f('0x37')](_0x409cf8[_0x128f('0x32')],_0x409cf8[_0x128f('0x34')]);_0x15c936[_0x128f('0x38')]=_[_0x128f('0x37')](_0x409cf8[_0x128f('0x32')],qs[_0x128f('0x39')](_0x1c4699['query'][_0x128f('0x39')]));_0x15c936['attributes']=_0x15c936[_0x128f('0x38')][_0x128f('0x3a')]?_0x15c936['attributes']:_0x409cf8[_0x128f('0x32')];_0x15c936['order']=qs[_0x128f('0x3d')](_0x1c4699[_0x128f('0x34')][_0x128f('0x3d')]);_0x15c936['where']=qs[_0x128f('0x36')](_['pick'](_0x1c4699[_0x128f('0x34')],_0x409cf8[_0x128f('0x36')]));if(_0x1c4699[_0x128f('0x34')][_0x128f('0x42')]){_0x15c936[_0x128f('0x3f')]=_['merge'](_0x15c936[_0x128f('0x3f')],{'$or':_[_0x128f('0x33')](_0x15c936[_0x128f('0x38')],function(_0x228906){var _0x166a8e={};_0x166a8e[_0x228906]={'$like':'%'+_0x1c4699[_0x128f('0x34')][_0x128f('0x42')]+'%'};return _0x166a8e;})});}_0x15c936=_[_0x128f('0x40')]({},_0x15c936,_0x1c4699['options']);return _0x456924[_0x128f('0x56')](_0x15c936);}})[_0x128f('0x26')](function(_0x537723){if(_0x537723){_0x219848=_0x537723[_0x128f('0x3a')];if(!_0x1c4699['query']['hasOwnProperty'](_0x128f('0x57'))){_0x15c936[_0x128f('0x1f')]=qs['limit'](_0x1c4699[_0x128f('0x34')]['limit']);_0x15c936['offset']=qs['offset'](_0x1c4699['query'][_0x128f('0x1d')]);}return _0x456924[_0x128f('0x56')](_0x15c936);}})['then'](function(_0x462a62){if(_0x462a62){return _0x462a62?{'count':_0x219848,'rows':_0x462a62}:null;}})[_0x128f('0x26')](respondWithResult(_0x5f27c9,null))[_0x128f('0x47')](handleError(_0x5f27c9,null));};exports['addIntervals']=function(_0x2b0504,_0x18d80f,_0x288f59){return db['Interval'][_0x128f('0x58')]({'where':{'id':_0x2b0504['params']['id']}})['then'](handleEntityNotFound(_0x18d80f,null))[_0x128f('0x26')](function(_0x2156e1){if(_0x2156e1){return db[_0x128f('0x59')][_0x128f('0x5a')](function(_0x1dd261){return db['Interval'][_0x128f('0x2a')]({'where':{'IntervalId':_0x2b0504[_0x128f('0x49')]['id']},'transaction':_0x1dd261})['then'](function(_0xaf94a2){var _0x112347=_['map'](_0x2b0504[_0x128f('0x4d')],function(_0x30f724){delete _0x30f724['id'];_0x30f724[_0x128f('0x55')]=_0x2b0504['params']['id'];return _0x30f724;});return db[_0x128f('0x2e')][_0x128f('0x5b')](_0x112347,{'transaction':_0x1dd261});});})[_0x128f('0x26')](function(){return db[_0x128f('0x2e')][_0x128f('0x46')]({'where':{'IntervalId':_0x2b0504[_0x128f('0x49')]['id']}});});}})['then'](respondWithResult(_0x18d80f,null))[_0x128f('0x47')](handleError(_0x18d80f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e406982..3a80542 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 _0x51f0=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime','then'];(function(_0x8b987e,_0x323644){var _0x47248a=function(_0x1c7c50){while(--_0x1c7c50){_0x8b987e['push'](_0x8b987e['shift']());}};_0x47248a(++_0x323644);}(_0x51f0,0xe2));var _0x051f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x51f0[_0x397e5f];return _0x5302b8;};'use strict';var attributes=require(_0x051f('0x0'));var extensions=require(_0x051f('0x1'));var iftime=require(_0x051f('0x2'))[_0x051f('0x3')];module[_0x051f('0x4')]=function(_0x17153e){return _0x17153e[_0x051f('0x5')]('Interval',attributes,{'tableName':_0x051f('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x35af34){extensions[_0x051f('0x7')](_0x17153e,_0x35af34);},'afterBulkCreate':function(_0x4ae43d,_0x5a0bec,_0x475374){_0x475374();extensions[_0x051f('0x7')](_0x17153e,_0x4ae43d[0x0]);},'afterUpdate':function(_0x3238b1){extensions['rewrite'](_0x17153e,_0x3238b1);},'afterDestroy':function(_0x5f23e2){extensions[_0x051f('0x7')](_0x17153e,_0x5f23e2);}},'instanceMethods':{'ifTime':function(_0x52b301=undefined,_0x4f71e8=new Date()){if(typeof this[_0x051f('0x8')]==='string'){return iftime(this['interval'],_0x52b301,_0x4f71e8);}else{return this[_0x051f('0x9')]()['then'](function(_0x28c185){return Promise[_0x051f('0xa')](_0x28c185[_0x051f('0xb')](function(_0x270873){return _0x270873[_0x051f('0xc')](_0x52b301,_0x4f71e8);}));})[_0x051f('0xd')](function(_0x4481fb){return _0x4481fb[_0x051f('0xe')](function(_0x35202c,_0x50f064){return _0x35202c||_0x50f064;},![]);});}}}});}; \ No newline at end of file +var _0x7d13=['../../utils/iftime','define','tools_intervals','rewrite','interval','getIntervals','then','all','map','ifTime','./interval.attributes','../../components/extensions/rewrite'];(function(_0x4584b7,_0x1c2a05){var _0xdebaf7=function(_0x12804a){while(--_0x12804a){_0x4584b7['push'](_0x4584b7['shift']());}};_0xdebaf7(++_0x1c2a05);}(_0x7d13,0x136));var _0x37d1=function(_0x1b4912,_0x3e8bb9){_0x1b4912=_0x1b4912-0x0;var _0x48cac5=_0x7d13[_0x1b4912];return _0x48cac5;};'use strict';var attributes=require(_0x37d1('0x0'));var extensions=require(_0x37d1('0x1'));var iftime=require(_0x37d1('0x2'))['iftime'];module['exports']=function(_0x4d51df){return _0x4d51df[_0x37d1('0x3')]('Interval',attributes,{'tableName':_0x37d1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4636e6){extensions[_0x37d1('0x5')](_0x4d51df,_0x4636e6);},'afterBulkCreate':function(_0x131821,_0x1527ad,_0x58eacd){_0x58eacd();extensions['rewrite'](_0x4d51df,_0x131821[0x0]);},'afterUpdate':function(_0x6908c5){extensions[_0x37d1('0x5')](_0x4d51df,_0x6908c5);},'afterDestroy':function(_0x337fd9){extensions[_0x37d1('0x5')](_0x4d51df,_0x337fd9);}},'instanceMethods':{'ifTime':function(_0x243be3=undefined,_0x57713b=new Date()){if(typeof this[_0x37d1('0x6')]==='string'){return iftime(this['interval'],_0x243be3,_0x57713b);}else{return this[_0x37d1('0x7')]()[_0x37d1('0x8')](function(_0x1a2a25){return Promise[_0x37d1('0x9')](_0x1a2a25[_0x37d1('0xa')](function(_0x41ab4c){return _0x41ab4c[_0x37d1('0xb')](_0x243be3,_0x57713b);}));})[_0x37d1('0x8')](function(_0x994723){return _0x994723['reduce'](function(_0x5c3938,_0x3db194){return _0x5c3938||_0x3db194;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1717fea..d51e240 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 _0xf983=['limit','include','map','model','then','GetInterval','debug','stringify','catch','message','error','ShowInterval','Interval','find','info','findAll','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','isArray','lodash','../../mysqldb','../../utils/iftime','rpc','options','raw','where','attributes'];(function(_0x297933,_0xfa3522){var _0x51edae=function(_0x4ab167){while(--_0x4ab167){_0x297933['push'](_0x297933['shift']());}};_0x51edae(++_0xfa3522);}(_0xf983,0x1c6));var _0x3f98=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xf983[_0xdeac17];return _0x33aabd;};'use strict';var _=require(_0x3f98('0x0'));var util=require('util');var db=require(_0x3f98('0x1'))['db'];var iftime=require(_0x3f98('0x2'))['iftime'];var logger=require('../../config/logger')(_0x3f98('0x3'));exports['GetInterval']=function(_0x395921){var _0x5c1f53=this;return new Promise(function(_0x3d4286,_0x40342a){return db['Interval']['findAll']({'raw':_0x395921[_0x3f98('0x4')]?_0x395921[_0x3f98('0x4')][_0x3f98('0x5')]===undefined?!![]:![]:!![],'where':_0x395921[_0x3f98('0x4')]?_0x395921[_0x3f98('0x4')][_0x3f98('0x6')]||null:null,'attributes':_0x395921[_0x3f98('0x4')]?_0x395921[_0x3f98('0x4')][_0x3f98('0x7')]||null:null,'limit':_0x395921[_0x3f98('0x4')]?_0x395921['options'][_0x3f98('0x8')]||null:null,'include':_0x395921[_0x3f98('0x4')]?_0x395921['options'][_0x3f98('0x9')]?_[_0x3f98('0xa')](_0x395921[_0x3f98('0x4')][_0x3f98('0x9')],function(_0x2b8987){return{'model':db[_0x2b8987[_0x3f98('0xb')]],'as':_0x2b8987['as'],'attributes':_0x2b8987[_0x3f98('0x7')],'include':_0x2b8987['include']?_[_0x3f98('0xa')](_0x2b8987[_0x3f98('0x9')],function(_0x427e9f){return{'model':db[_0x427e9f[_0x3f98('0xb')]],'as':_0x427e9f['as'],'attributes':_0x427e9f[_0x3f98('0x7')],'include':_0x427e9f[_0x3f98('0x9')]?_[_0x3f98('0xa')](_0x427e9f[_0x3f98('0x9')],function(_0x2aff3d){return{'model':db[_0x2aff3d[_0x3f98('0xb')]],'as':_0x2aff3d['as'],'attributes':_0x2aff3d[_0x3f98('0x7')]};}):[]};}):[]};}):[]:[]})[_0x3f98('0xc')](function(_0x501a4a){logger['info'](_0x3f98('0xd'),_0x395921);logger[_0x3f98('0xe')]('GetInterval',_0x395921,JSON[_0x3f98('0xf')](_0x501a4a));_0x3d4286(_0x501a4a);})[_0x3f98('0x10')](function(_0xa9c71a){logger['error']('GetInterval',_0xa9c71a[_0x3f98('0x11')],_0x395921);_0x40342a(_0x5c1f53[_0x3f98('0x12')](0x1f4,_0xa9c71a[_0x3f98('0x11')]));});});};exports[_0x3f98('0x13')]=function(_0x50ffeb){var _0x37f631=this;return new Promise(function(_0x5db0dc,_0x2b68e4){return db[_0x3f98('0x14')][_0x3f98('0x15')]({'raw':_0x50ffeb[_0x3f98('0x4')]?_0x50ffeb[_0x3f98('0x4')][_0x3f98('0x5')]===undefined?!![]:![]:!![],'where':_0x50ffeb[_0x3f98('0x4')]?_0x50ffeb[_0x3f98('0x4')][_0x3f98('0x6')]||null:null,'attributes':_0x50ffeb['options']?_0x50ffeb[_0x3f98('0x4')]['attributes']||null:null,'include':_0x50ffeb[_0x3f98('0x4')]?_0x50ffeb[_0x3f98('0x4')][_0x3f98('0x9')]?_['map'](_0x50ffeb[_0x3f98('0x4')]['include'],function(_0x2537bc){return{'model':db[_0x2537bc[_0x3f98('0xb')]],'as':_0x2537bc['as'],'attributes':_0x2537bc['attributes'],'include':_0x2537bc['include']?_[_0x3f98('0xa')](_0x2537bc['include'],function(_0x2d1f7f){return{'model':db[_0x2d1f7f['model']],'as':_0x2d1f7f['as'],'attributes':_0x2d1f7f[_0x3f98('0x7')],'include':_0x2d1f7f[_0x3f98('0x9')]?_[_0x3f98('0xa')](_0x2d1f7f[_0x3f98('0x9')],function(_0x16ecb9){return{'model':db[_0x16ecb9['model']],'as':_0x16ecb9['as'],'attributes':_0x16ecb9[_0x3f98('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x158413){logger[_0x3f98('0x16')]('ShowInterval',_0x50ffeb);logger[_0x3f98('0xe')](_0x3f98('0x13'),_0x50ffeb,JSON[_0x3f98('0xf')](_0x158413));_0x5db0dc(_0x158413);})['catch'](function(_0x36665c){logger['error'](_0x3f98('0x13'),_0x36665c[_0x3f98('0x11')],_0x50ffeb);_0x2b68e4(_0x37f631[_0x3f98('0x12')](0x1f4,_0x36665c[_0x3f98('0x11')]));});});};function checkArrayOfIntervals(_0x72c281,_0x5cf0b4){var _0x1c43ca=[];return db[_0x3f98('0x14')][_0x3f98('0x17')]({'where':{'id':_0x72c281}})[_0x3f98('0xc')](function(_0x1648b4){_0x1c43ca=_0x1648b4;return Promise[_0x3f98('0x18')](_0x1c43ca[_0x3f98('0xa')](function(_0xde4e24){return _0xde4e24['ifTime'](_0x5cf0b4);}));})[_0x3f98('0xc')](function(_0x1ba54e){var _0x4e1f50=_0x1ba54e[_0x3f98('0x19')](function(_0x47bae2,_0x448814){return _0x47bae2||_0x448814;},![]);logger[_0x3f98('0x16')](util[_0x3f98('0x1a')](_0x3f98('0x1b'),_0x1c43ca[_0x3f98('0xa')](function(_0x4b9e9d){return _0x4b9e9d[_0x3f98('0x1c')];})[_0x3f98('0x1d')](',\x20'),_0x1c43ca['map'](function(_0x328783){return _0x328783['id'];})[_0x3f98('0x1d')](',\x20')));return _0x4e1f50;});}function checkSingleInterval(_0x103cca,_0x4a9de2){return db[_0x3f98('0x14')][_0x3f98('0x1e')](_0x103cca)[_0x3f98('0xc')](function(_0x16cbcb){if(_0x16cbcb){logger[_0x3f98('0x16')](util[_0x3f98('0x1a')](_0x3f98('0x1f'),_0x16cbcb['name'],_0x16cbcb['id']));return _0x16cbcb[_0x3f98('0x20')](_0x4a9de2);}});}exports[_0x3f98('0x21')]=function(_0x5c78c4){var _0x5e85fd=_0x5c78c4['intervalIds'];var _0x758fab=Array['isArray'](_0x5c78c4[_0x3f98('0x22')])?_0x5c78c4['intervals']:typeof _0x5c78c4[_0x3f98('0x22')]===_0x3f98('0x23')?[_0x5c78c4[_0x3f98('0x22')]]:[];var _0x37d5b8=_0x5c78c4[_0x3f98('0x24')]||undefined;var _0x2e2336=![];if(_0x758fab['length']){logger[_0x3f98('0x16')](util[_0x3f98('0x1a')](_0x3f98('0x25'),_0x758fab[_0x3f98('0x1d')](';\x20')));}if(_0x37d5b8){logger['info'](util[_0x3f98('0x1a')](_0x3f98('0x26'),_0x37d5b8));}logger[_0x3f98('0xe')]('Iftime',_0x2e2336);logger[_0x3f98('0x27')](_0x3f98('0x21'),_0x5c78c4);return Promise[_0x3f98('0x28')]()[_0x3f98('0xc')](function(){if(Array[_0x3f98('0x29')](_0x5e85fd)){return checkArrayOfIntervals(_0x5e85fd,_0x37d5b8);}else if(_0x5e85fd){return checkSingleInterval(_0x5e85fd,_0x37d5b8);}})[_0x3f98('0xc')](function(_0x56a0f6){var _0x47898b=_0x758fab[_0x3f98('0x19')](function(_0x2b608a,_0x3edbf5){return _0x2b608a||iftime(_0x3edbf5,_0x37d5b8);},![]);_0x2e2336=_0x56a0f6||_0x47898b;return _0x2e2336;})[_0x3f98('0x10')](function(_0x330591){logger[_0x3f98('0x12')]('IntervalIftime',_0x5c78c4,_0x330591);throw this['error'](0x1f4,_0x330591[_0x3f98('0x11')]);});}; \ No newline at end of file +var _0xcd87=['then','info','stringify','catch','error','ShowInterval','find','raw','map','debug','message','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','where','attributes','limit','include','model'];(function(_0x36448c,_0x515960){var _0x5e834d=function(_0xb69f3f){while(--_0xb69f3f){_0x36448c['push'](_0x36448c['shift']());}};_0x5e834d(++_0x515960);}(_0xcd87,0x19f));var _0x7cd8=function(_0x3e0823,_0x26462c){_0x3e0823=_0x3e0823-0x0;var _0x378282=_0xcd87[_0x3e0823];return _0x378282;};'use strict';var _=require('lodash');var util=require(_0x7cd8('0x0'));var db=require(_0x7cd8('0x1'))['db'];var iftime=require(_0x7cd8('0x2'))[_0x7cd8('0x3')];var logger=require(_0x7cd8('0x4'))(_0x7cd8('0x5'));exports[_0x7cd8('0x6')]=function(_0x4a4489){var _0x5cb761=this;return new Promise(function(_0x27b703,_0x1165f9){return db[_0x7cd8('0x7')][_0x7cd8('0x8')]({'raw':_0x4a4489[_0x7cd8('0x9')]?_0x4a4489[_0x7cd8('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4489[_0x7cd8('0x9')]?_0x4a4489[_0x7cd8('0x9')][_0x7cd8('0xa')]||null:null,'attributes':_0x4a4489[_0x7cd8('0x9')]?_0x4a4489[_0x7cd8('0x9')][_0x7cd8('0xb')]||null:null,'limit':_0x4a4489[_0x7cd8('0x9')]?_0x4a4489[_0x7cd8('0x9')][_0x7cd8('0xc')]||null:null,'include':_0x4a4489[_0x7cd8('0x9')]?_0x4a4489['options'][_0x7cd8('0xd')]?_['map'](_0x4a4489[_0x7cd8('0x9')][_0x7cd8('0xd')],function(_0x46f8d8){return{'model':db[_0x46f8d8[_0x7cd8('0xe')]],'as':_0x46f8d8['as'],'attributes':_0x46f8d8[_0x7cd8('0xb')],'include':_0x46f8d8[_0x7cd8('0xd')]?_['map'](_0x46f8d8[_0x7cd8('0xd')],function(_0x3ca11a){return{'model':db[_0x3ca11a[_0x7cd8('0xe')]],'as':_0x3ca11a['as'],'attributes':_0x3ca11a['attributes'],'include':_0x3ca11a[_0x7cd8('0xd')]?_['map'](_0x3ca11a['include'],function(_0x5c83df){return{'model':db[_0x5c83df[_0x7cd8('0xe')]],'as':_0x5c83df['as'],'attributes':_0x5c83df[_0x7cd8('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7cd8('0xf')](function(_0x54403f){logger[_0x7cd8('0x10')]('GetInterval',_0x4a4489);logger['debug'](_0x7cd8('0x6'),_0x4a4489,JSON[_0x7cd8('0x11')](_0x54403f));_0x27b703(_0x54403f);})[_0x7cd8('0x12')](function(_0x4d8015){logger[_0x7cd8('0x13')](_0x7cd8('0x6'),_0x4d8015['message'],_0x4a4489);_0x1165f9(_0x5cb761[_0x7cd8('0x13')](0x1f4,_0x4d8015['message']));});});};exports[_0x7cd8('0x14')]=function(_0xfe2398){var _0x30517b=this;return new Promise(function(_0x11db65,_0x3c1ecd){return db[_0x7cd8('0x7')][_0x7cd8('0x15')]({'raw':_0xfe2398[_0x7cd8('0x9')]?_0xfe2398['options'][_0x7cd8('0x16')]===undefined?!![]:![]:!![],'where':_0xfe2398['options']?_0xfe2398[_0x7cd8('0x9')][_0x7cd8('0xa')]||null:null,'attributes':_0xfe2398[_0x7cd8('0x9')]?_0xfe2398[_0x7cd8('0x9')][_0x7cd8('0xb')]||null:null,'include':_0xfe2398[_0x7cd8('0x9')]?_0xfe2398[_0x7cd8('0x9')][_0x7cd8('0xd')]?_[_0x7cd8('0x17')](_0xfe2398[_0x7cd8('0x9')][_0x7cd8('0xd')],function(_0x17beef){return{'model':db[_0x17beef['model']],'as':_0x17beef['as'],'attributes':_0x17beef[_0x7cd8('0xb')],'include':_0x17beef[_0x7cd8('0xd')]?_[_0x7cd8('0x17')](_0x17beef[_0x7cd8('0xd')],function(_0x4bcc52){return{'model':db[_0x4bcc52[_0x7cd8('0xe')]],'as':_0x4bcc52['as'],'attributes':_0x4bcc52['attributes'],'include':_0x4bcc52['include']?_[_0x7cd8('0x17')](_0x4bcc52[_0x7cd8('0xd')],function(_0x1b39b0){return{'model':db[_0x1b39b0[_0x7cd8('0xe')]],'as':_0x1b39b0['as'],'attributes':_0x1b39b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cd8('0xf')](function(_0xf5e6a9){logger[_0x7cd8('0x10')](_0x7cd8('0x14'),_0xfe2398);logger[_0x7cd8('0x18')](_0x7cd8('0x14'),_0xfe2398,JSON['stringify'](_0xf5e6a9));_0x11db65(_0xf5e6a9);})['catch'](function(_0x3be2d6){logger[_0x7cd8('0x13')]('ShowInterval',_0x3be2d6[_0x7cd8('0x19')],_0xfe2398);_0x3c1ecd(_0x30517b[_0x7cd8('0x13')](0x1f4,_0x3be2d6[_0x7cd8('0x19')]));});});};function checkArrayOfIntervals(_0x3baf44,_0x354237){var _0x42ec5e=[];return db[_0x7cd8('0x7')][_0x7cd8('0x8')]({'where':{'id':_0x3baf44}})['then'](function(_0xd6023e){_0x42ec5e=_0xd6023e;return Promise[_0x7cd8('0x1a')](_0x42ec5e[_0x7cd8('0x17')](function(_0x83ac7a){return _0x83ac7a[_0x7cd8('0x1b')](_0x354237);}));})[_0x7cd8('0xf')](function(_0x28f951){var _0x442cec=_0x28f951[_0x7cd8('0x1c')](function(_0x12175d,_0x5bbc47){return _0x12175d||_0x5bbc47;},![]);logger[_0x7cd8('0x10')](util[_0x7cd8('0x1d')](_0x7cd8('0x1e'),_0x42ec5e[_0x7cd8('0x17')](function(_0x25533e){return _0x25533e[_0x7cd8('0x1f')];})[_0x7cd8('0x20')](',\x20'),_0x42ec5e[_0x7cd8('0x17')](function(_0x26b3b6){return _0x26b3b6['id'];})[_0x7cd8('0x20')](',\x20')));return _0x442cec;});}function checkSingleInterval(_0x452bf3,_0x139b85){return db['Interval']['findById'](_0x452bf3)[_0x7cd8('0xf')](function(_0x180f67){if(_0x180f67){logger[_0x7cd8('0x10')](util[_0x7cd8('0x1d')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x180f67[_0x7cd8('0x1f')],_0x180f67['id']));return _0x180f67[_0x7cd8('0x1b')](_0x139b85);}});}exports[_0x7cd8('0x21')]=function(_0x1ca285){var _0x31770b=_0x1ca285[_0x7cd8('0x22')];var _0x493ae6=Array[_0x7cd8('0x23')](_0x1ca285[_0x7cd8('0x24')])?_0x1ca285[_0x7cd8('0x24')]:typeof _0x1ca285[_0x7cd8('0x24')]===_0x7cd8('0x25')?[_0x1ca285[_0x7cd8('0x24')]]:[];var _0x71d880=_0x1ca285['timezone']||undefined;var _0x3605e1=![];if(_0x493ae6[_0x7cd8('0x26')]){logger[_0x7cd8('0x10')](util[_0x7cd8('0x1d')](_0x7cd8('0x27'),_0x493ae6['join'](';\x20')));}if(_0x71d880){logger[_0x7cd8('0x10')](util[_0x7cd8('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x71d880));}logger[_0x7cd8('0x18')](_0x7cd8('0x28'),_0x3605e1);logger[_0x7cd8('0x29')]('IntervalIftime',_0x1ca285);return Promise[_0x7cd8('0x2a')]()[_0x7cd8('0xf')](function(){if(Array[_0x7cd8('0x23')](_0x31770b)){return checkArrayOfIntervals(_0x31770b,_0x71d880);}else if(_0x31770b){return checkSingleInterval(_0x31770b,_0x71d880);}})['then'](function(_0x37c837){var _0x4d3ebb=_0x493ae6['reduce'](function(_0x4e00bf,_0x3de5c4){return _0x4e00bf||iftime(_0x3de5c4,_0x71d880);},![]);_0x3605e1=_0x37c837||_0x4d3ebb;return _0x3605e1;})[_0x7cd8('0x12')](function(_0xf2f7dd){logger['error'](_0x7cd8('0x21'),_0x1ca285,_0xf2f7dd);throw this[_0x7cd8('0x13')](0x1f4,_0xf2f7dd[_0x7cd8('0x19')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2b4d968..5eec88d 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x323e88,_0xe4c765){var _0x53ecd1=function(_0x1bf1a8){while(--_0x1bf1a8){_0x323e88['push'](_0x323e88['shift']());}};_0x53ecd1(++_0xe4c765);}(_0x2032,0xd9));var _0x2203=function(_0x19b851,_0xedeca0){_0x19b851=_0x19b851-0x0;var _0x1c5ff4=_0x2032[_0x19b851];return _0x1c5ff4;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x38b6a6,_0x2b6a75){var _0x31995e=function(_0x13fe43){while(--_0x13fe43){_0x38b6a6['push'](_0x38b6a6['shift']());}};_0x31995e(++_0x2b6a75);}(_0xadb5,0xad));var _0x5adb=function(_0x202f7b,_0x424197){_0x202f7b=_0x202f7b-0x0;var _0x16d114=_0xadb5[_0x202f7b];return _0x16d114;};'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 31659d8..4c2bf89 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 _0xcd3c=['status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','utf8','data','end'];(function(_0x475d79,_0x16a3e4){var _0x5bc4b0=function(_0x3c304d){while(--_0x3c304d){_0x475d79['push'](_0x475d79['shift']());}};_0x5bc4b0(++_0x16a3e4);}(_0xcd3c,0x1da));var _0xccd3=function(_0x47435b,_0x250054){_0x47435b=_0x47435b-0x0;var _0x475b47=_0xcd3c[_0x47435b];return _0x475b47;};'use strict';var BPromise=require(_0xccd3('0x0'));var https=require(_0xccd3('0x1'));var logger=require(_0xccd3('0x2'))(_0xccd3('0x3'));var USERNAME=_0xccd3('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x3d03f5,_0x2f7ae4){var _0x7e8033={'fields':{'project':{'key':_0x3d03f5[_0xccd3('0x5')]||_0xccd3('0x6')},'summary':(_0x3d03f5[_0xccd3('0x7')]||'Report')+_0xccd3('0x8')+_0x3d03f5['ip'],'description':_0x3d03f5[_0xccd3('0x9')]||JSON[_0xccd3('0xa')](_0x3d03f5),'issuetype':{'name':_0x3d03f5[_0xccd3('0xb')]||_0xccd3('0xc')}}};_0x7e8033[_0xccd3('0xd')][_0xccd3('0xe')]=_0x3d03f5[_0xccd3('0xf')];_0x7e8033[_0xccd3('0xd')][_0xccd3('0x10')]=_0x3d03f5['oldToken'];_0x7e8033[_0xccd3('0xd')]['customfield_11502']=_0x3d03f5[_0xccd3('0x11')];_0x7e8033['fields'][_0xccd3('0x12')]=_0x3d03f5[_0xccd3('0x13')];_0x7e8033[_0xccd3('0xd')][_0xccd3('0x14')]=_0x3d03f5['reason'];_0x7e8033[_0xccd3('0xd')][_0xccd3('0x15')]=_0x3d03f5['ip'];var _0x25563b={'host':_0xccd3('0x16'),'port':0x1bb,'path':_0xccd3('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xccd3('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xccd3('0x19')](_0xccd3('0x1a'))}};var _0x181f44=JSON[_0xccd3('0xa')](_0x7e8033);var _0x5712dc=https[_0xccd3('0x1b')](_0x25563b,function(_0x29e61f){_0x29e61f[_0xccd3('0x1c')](_0xccd3('0x1d'));var _0x233408='';_0x29e61f['on'](_0xccd3('0x1e'),function(_0x9e2709){_0x233408+=_0x9e2709;});_0x29e61f['on'](_0xccd3('0x1f'),function(){if(_0x2f7ae4){return _0x2f7ae4[_0xccd3('0x20')](_0x29e61f[_0xccd3('0x21')])[_0xccd3('0x22')](JSON['parse'](_0x233408));}});});_0x5712dc['on'](_0xccd3('0x23'),function(_0x534de4){if(_0x2f7ae4){return _0x2f7ae4[_0xccd3('0x20')](0x1f4)[_0xccd3('0x22')]({'errors':[{'message':_0xccd3('0x24'),'type':'api.jira'}]});}});_0x5712dc[_0xccd3('0x25')](_0x181f44);_0x5712dc[_0xccd3('0x1f')]();}exports[_0xccd3('0x26')]=openIssue;exports[_0xccd3('0x27')]=function(_0x40154d,_0x28af39){_0x40154d[_0xccd3('0x28')]['ip']=_0x40154d[_0xccd3('0x29')][_0xccd3('0x2a')]||_0x40154d[_0xccd3('0x2b')][_0xccd3('0x2c')]||_0x40154d[_0xccd3('0x2d')][_0xccd3('0x2c')]||_0x40154d['connection'][_0xccd3('0x2d')][_0xccd3('0x2c')];return openIssue(_0x40154d[_0xccd3('0x28')],_0x28af39);}; \ No newline at end of file +var _0xb95b=['toString','request','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20'];(function(_0x2e2d96,_0x22a310){var _0x477e8d=function(_0xd433ad){while(--_0xd433ad){_0x2e2d96['push'](_0x2e2d96['shift']());}};_0x477e8d(++_0x22a310);}(_0xb95b,0x12d));var _0xbb95=function(_0x539bf1,_0x5b536b){_0x539bf1=_0x539bf1-0x0;var _0x5cccb6=_0xb95b[_0x539bf1];return _0x5cccb6;};'use strict';var BPromise=require(_0xbb95('0x0'));var https=require(_0xbb95('0x1'));var logger=require(_0xbb95('0x2'))(_0xbb95('0x3'));var USERNAME=_0xbb95('0x4');var PASSWORD=_0xbb95('0x5');function openIssue(_0xf7b0e4,_0x5b7003){var _0x1e22be={'fields':{'project':{'key':_0xf7b0e4['key']||_0xbb95('0x6')},'summary':(_0xf7b0e4[_0xbb95('0x7')]||_0xbb95('0x8'))+_0xbb95('0x9')+_0xf7b0e4['ip'],'description':_0xf7b0e4[_0xbb95('0xa')]||JSON[_0xbb95('0xb')](_0xf7b0e4),'issuetype':{'name':_0xf7b0e4[_0xbb95('0xc')]||_0xbb95('0xd')}}};_0x1e22be[_0xbb95('0xe')][_0xbb95('0xf')]=_0xf7b0e4['email'];_0x1e22be['fields'][_0xbb95('0x10')]=_0xf7b0e4[_0xbb95('0x11')];_0x1e22be[_0xbb95('0xe')][_0xbb95('0x12')]=_0xf7b0e4[_0xbb95('0x13')];_0x1e22be['fields'][_0xbb95('0x14')]=_0xf7b0e4[_0xbb95('0x15')];_0x1e22be[_0xbb95('0xe')][_0xbb95('0x16')]=_0xf7b0e4[_0xbb95('0x17')];_0x1e22be[_0xbb95('0xe')]['customfield_10102']=_0xf7b0e4['ip'];var _0x4f2f67={'host':_0xbb95('0x18'),'port':0x1bb,'path':_0xbb95('0x19'),'method':_0xbb95('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xbb95('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xbb95('0x1c')]('base64')}};var _0x4564ee=JSON[_0xbb95('0xb')](_0x1e22be);var _0x37eaa4=https[_0xbb95('0x1d')](_0x4f2f67,function(_0x53ef2b){_0x53ef2b['setEncoding']('utf8');var _0x5da045='';_0x53ef2b['on'](_0xbb95('0x1e'),function(_0xc4bfcb){_0x5da045+=_0xc4bfcb;});_0x53ef2b['on'](_0xbb95('0x1f'),function(){if(_0x5b7003){return _0x5b7003[_0xbb95('0x20')](_0x53ef2b[_0xbb95('0x21')])[_0xbb95('0x22')](JSON[_0xbb95('0x23')](_0x5da045));}});});_0x37eaa4['on'](_0xbb95('0x24'),function(_0x2bc443){if(_0x5b7003){return _0x5b7003[_0xbb95('0x20')](0x1f4)['json']({'errors':[{'message':_0xbb95('0x25'),'type':_0xbb95('0x26')}]});}});_0x37eaa4[_0xbb95('0x27')](_0x4564ee);_0x37eaa4['end']();}exports[_0xbb95('0x28')]=openIssue;exports[_0xbb95('0x29')]=function(_0x52f7a5,_0x597aa3){_0x52f7a5[_0xbb95('0x2a')]['ip']=_0x52f7a5[_0xbb95('0x2b')]['x-forwarded-for']||_0x52f7a5[_0xbb95('0x2c')][_0xbb95('0x2d')]||_0x52f7a5[_0xbb95('0x2e')]['remoteAddress']||_0x52f7a5[_0xbb95('0x2c')][_0xbb95('0x2e')][_0xbb95('0x2d')];return openIssue(_0x52f7a5[_0xbb95('0x2a')],_0x597aa3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 31d9cec..10516af 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x586406,_0x3456df){_0x586406=_0x586406-0x0;var _0x567a68=_0x17ba[_0x586406];return _0x567a68;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0xb4e6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4a794d,_0x2a0903){var _0x18902f=function(_0x4141c7){while(--_0x4141c7){_0x4a794d['push'](_0x4a794d['shift']());}};_0x18902f(++_0x2a0903);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xb4e6[_0x34c063];return _0x2c63a3;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router['get']('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0xd')]('/',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xe')]);router[_0x6b4e('0xf')](_0x6b4e('0x10'),auth['isAuthenticated'](),controller[_0x6b4e('0x11')]);router[_0x6b4e('0x12')]('/:id',auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x13')]);module[_0x6b4e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 25d896f..0bd9cd2 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x598cff,_0x120519){_0x598cff=_0x598cff-0x0;var _0x4152d8=_0x7a54[_0x598cff];return _0x4152d8;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0xf04969,_0x152b49){_0xf04969=_0xf04969-0x0;var _0x2e116f=_0x7a54[_0xf04969];return _0x2e116f;};'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 4bb8e11..188c852 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 _0x81d4=['sort','where','filters','pick','merge','VIRTUAL','name','options','count','includeAll','include','findAll','rows','catch','show','keys','create','update','body','find','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','set','json','apply','reject','then','destroy','sendStatus','error','stack','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19acda,_0x240a7a){var _0x359bc9=function(_0x58eeb1){while(--_0x58eeb1){_0x19acda['push'](_0x19acda['shift']());}};_0x359bc9(++_0x240a7a);}(_0x81d4,0x197));var _0x481d=function(_0x208fba,_0x393244){_0x208fba=_0x208fba-0x0;var _0x317733=_0x81d4[_0x208fba];return _0x317733;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x481d('0x0'));var zipdir=require(_0x481d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x481d('0x2'));var moment=require(_0x481d('0x3'));var BPromise=require(_0x481d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x481d('0x5'));var sox=require(_0x481d('0x6'));var csv=require(_0x481d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x481d('0x8'));var _=require(_0x481d('0x9'));var squel=require(_0x481d('0xa'));var crypto=require(_0x481d('0xb'));var jsforce=require(_0x481d('0xc'));var deskjs=require(_0x481d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x481d('0xe'));var Papa=require(_0x481d('0xf'));var Redis=require(_0x481d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x481d('0x11'));var as=require(_0x481d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x481d('0x13'))(_0x481d('0x14'));var utils=require(_0x481d('0x15'));var config=require(_0x481d('0x16'));var licenseUtil=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x9c7a08,_0x4e33fc){_0x4e33fc=_0x4e33fc||0xcc;return function(_0x3a751f){if(_0x3a751f){return _0x9c7a08['sendStatus'](_0x4e33fc);}return _0x9c7a08['status'](_0x4e33fc)[_0x481d('0x19')]();};}function respondWithResult(_0x18bd93,_0x2f32c8){_0x2f32c8=_0x2f32c8||0xc8;return function(_0x5cbe7e){if(_0x5cbe7e){return _0x18bd93[_0x481d('0x1a')](_0x2f32c8)['json'](_0x5cbe7e);}};}function respondWithFilteredResult(_0x1e3df6,_0x15bba7){return function(_0x222f72){if(_0x222f72){var _0x1bda12=typeof _0x15bba7[_0x481d('0x1b')]==='undefined'&&typeof _0x15bba7[_0x481d('0x1c')]===_0x481d('0x1d');var _0x3e2a27=_0x222f72['count'];var _0x21e2a5=_0x1bda12?0x0:_0x15bba7['offset'];var _0x3ef7c6=_0x1bda12?_0x222f72['count']:_0x15bba7[_0x481d('0x1b')]+_0x15bba7['limit'];var _0x30ef03;if(_0x3ef7c6>=_0x3e2a27){_0x3ef7c6=_0x3e2a27;_0x30ef03=0xc8;}else{_0x30ef03=0xce;}_0x1e3df6['status'](_0x30ef03);return _0x1e3df6[_0x481d('0x1e')]('Content-Range',_0x21e2a5+'-'+_0x3ef7c6+'/'+_0x3e2a27)[_0x481d('0x1f')](_0x222f72);}return null;};}function patchUpdates(_0x41a4de){return function(_0x4d56ea){try{jsonpatch[_0x481d('0x20')](_0x4d56ea,_0x41a4de,!![]);}catch(_0x3856b3){return BPromise[_0x481d('0x21')](_0x3856b3);}return _0x4d56ea['save']();};}function saveUpdates(_0x45745b,_0x4ab1e8){return function(_0x560b33){if(_0x560b33){return _0x560b33['update'](_0x45745b)[_0x481d('0x22')](function(_0x5a81e6){return _0x5a81e6;});}return null;};}function removeEntity(_0x53ff79,_0x280586){return function(_0x237c02){if(_0x237c02){return _0x237c02[_0x481d('0x23')]()['then'](function(){_0x53ff79[_0x481d('0x1a')](0xcc)[_0x481d('0x19')]();});}};}function handleEntityNotFound(_0x51e3a,_0x3cc630){return function(_0x485de5){if(!_0x485de5){_0x51e3a[_0x481d('0x24')](0x194);}return _0x485de5;};}function handleError(_0xd5145,_0x4adf1f){_0x4adf1f=_0x4adf1f||0x1f4;return function(_0x371cbe){logger[_0x481d('0x25')](_0x371cbe[_0x481d('0x26')]);if(_0x371cbe['name']){delete _0x371cbe['name'];}_0xd5145[_0x481d('0x1a')](_0x4adf1f)[_0x481d('0x27')](_0x371cbe);};}exports['index']=function(_0x55bf9c,_0x2ab9dc){var _0x15cb55={},_0x495fbb={},_0xe8060f={'count':0x0,'rows':[]};var _0x4170a1=_[_0x481d('0x28')](db[_0x481d('0x29')][_0x481d('0x2a')],function(_0x36bf9f){return{'name':_0x36bf9f[_0x481d('0x2b')],'type':_0x36bf9f[_0x481d('0x2c')][_0x481d('0x2d')]};});_0x495fbb['model']=_[_0x481d('0x28')](_0x4170a1,'name');_0x495fbb['query']=_['keys'](_0x55bf9c[_0x481d('0x2e')]);_0x495fbb['filters']=_[_0x481d('0x2f')](_0x495fbb['model'],_0x495fbb[_0x481d('0x2e')]);_0x15cb55[_0x481d('0x30')]=_[_0x481d('0x2f')](_0x495fbb[_0x481d('0x31')],qs[_0x481d('0x32')](_0x55bf9c[_0x481d('0x2e')][_0x481d('0x32')]));_0x15cb55[_0x481d('0x30')]=_0x15cb55[_0x481d('0x30')][_0x481d('0x33')]?_0x15cb55[_0x481d('0x30')]:_0x495fbb[_0x481d('0x31')];if(!_0x55bf9c[_0x481d('0x2e')][_0x481d('0x34')](_0x481d('0x35'))){_0x15cb55['limit']=qs[_0x481d('0x1c')](_0x55bf9c[_0x481d('0x2e')][_0x481d('0x1c')]);_0x15cb55[_0x481d('0x1b')]=qs[_0x481d('0x1b')](_0x55bf9c[_0x481d('0x2e')][_0x481d('0x1b')]);}_0x15cb55[_0x481d('0x36')]=qs['sort'](_0x55bf9c[_0x481d('0x2e')][_0x481d('0x37')]);_0x15cb55[_0x481d('0x38')]=qs[_0x481d('0x39')](_[_0x481d('0x3a')](_0x55bf9c['query'],_0x495fbb['filters']),_0x4170a1);if(_0x55bf9c[_0x481d('0x2e')]['filter']){_0x15cb55[_0x481d('0x38')]=_[_0x481d('0x3b')](_0x15cb55[_0x481d('0x38')],{'$or':_[_0x481d('0x28')](_0x4170a1,function(_0x463a44){if(_0x463a44[_0x481d('0x2c')]!==_0x481d('0x3c')){var _0x166c93={};_0x166c93[_0x463a44[_0x481d('0x3d')]]={'$like':'%'+_0x55bf9c['query']['filter']+'%'};return _0x166c93;}})});}_0x15cb55=_[_0x481d('0x3b')]({},_0x15cb55,_0x55bf9c[_0x481d('0x3e')]);var _0x4f69f1={'where':_0x15cb55[_0x481d('0x38')]};return db[_0x481d('0x29')]['count'](_0x4f69f1)[_0x481d('0x22')](function(_0x2e0db1){_0xe8060f[_0x481d('0x3f')]=_0x2e0db1;if(_0x55bf9c[_0x481d('0x2e')][_0x481d('0x40')]){_0x15cb55[_0x481d('0x41')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x481d('0x42')](_0x15cb55);})[_0x481d('0x22')](function(_0x128185){_0xe8060f[_0x481d('0x43')]=_0x128185;return _0xe8060f;})['then'](respondWithFilteredResult(_0x2ab9dc,_0x15cb55))[_0x481d('0x44')](handleError(_0x2ab9dc,null));};exports[_0x481d('0x45')]=function(_0x23ccc0,_0x3f3009){var _0x55a8a0={'raw':!![],'where':{'id':_0x23ccc0['params']['id']}},_0x2669b9={};_0x2669b9[_0x481d('0x31')]=_[_0x481d('0x46')](db[_0x481d('0x29')][_0x481d('0x2a')]);_0x2669b9[_0x481d('0x2e')]=_[_0x481d('0x46')](_0x23ccc0[_0x481d('0x2e')]);_0x2669b9[_0x481d('0x39')]=_['intersection'](_0x2669b9[_0x481d('0x31')],_0x2669b9[_0x481d('0x2e')]);_0x55a8a0[_0x481d('0x30')]=_[_0x481d('0x2f')](_0x2669b9['model'],qs[_0x481d('0x32')](_0x23ccc0[_0x481d('0x2e')][_0x481d('0x32')]));_0x55a8a0[_0x481d('0x30')]=_0x55a8a0[_0x481d('0x30')][_0x481d('0x33')]?_0x55a8a0[_0x481d('0x30')]:_0x2669b9[_0x481d('0x31')];if(_0x23ccc0[_0x481d('0x2e')][_0x481d('0x40')]){_0x55a8a0[_0x481d('0x41')]=[{'all':!![]}];}_0x55a8a0=_[_0x481d('0x3b')]({},_0x55a8a0,_0x23ccc0[_0x481d('0x3e')]);return db[_0x481d('0x29')]['find'](_0x55a8a0)['then'](handleEntityNotFound(_0x3f3009,null))[_0x481d('0x22')](respondWithResult(_0x3f3009,null))[_0x481d('0x44')](handleError(_0x3f3009,null));};exports[_0x481d('0x47')]=function(_0x24e38a,_0x4f7eed){return db[_0x481d('0x29')][_0x481d('0x47')](_0x24e38a['body'],{})[_0x481d('0x22')](respondWithResult(_0x4f7eed,0xc9))[_0x481d('0x44')](handleError(_0x4f7eed,null));};exports[_0x481d('0x48')]=function(_0x3075c5,_0x4d6bf9){if(_0x3075c5['body']['id']){delete _0x3075c5[_0x481d('0x49')]['id'];}return db[_0x481d('0x29')][_0x481d('0x4a')]({'where':{'id':_0x3075c5[_0x481d('0x4b')]['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x4d6bf9,null))[_0x481d('0x22')](saveUpdates(_0x3075c5[_0x481d('0x49')],null))[_0x481d('0x22')](respondWithResult(_0x4d6bf9,null))[_0x481d('0x44')](handleError(_0x4d6bf9,null));};exports['destroy']=function(_0x48b270,_0x586631){return db[_0x481d('0x29')][_0x481d('0x4a')]({'where':{'id':_0x48b270[_0x481d('0x4b')]['id']}})[_0x481d('0x22')](handleEntityNotFound(_0x586631,null))[_0x481d('0x22')](removeEntity(_0x586631,null))[_0x481d('0x44')](handleError(_0x586631,null));};exports[_0x481d('0x4c')]=function(_0x5c0022,_0x455273){return db[_0x481d('0x29')][_0x481d('0x4c')]()[_0x481d('0x22')](respondWithResult(_0x455273,null))[_0x481d('0x44')](handleError(_0x455273,null));}; \ No newline at end of file +var _0x093a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xcce3ea,_0x5352d6){var _0x2bd14b=function(_0x470fb5){while(--_0x470fb5){_0xcce3ea['push'](_0xcce3ea['shift']());}};_0x2bd14b(++_0x5352d6);}(_0x093a,0x16a));var _0xa093=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0x093a[_0xf84870];return _0x4541a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa093('0x0'));var zipdir=require(_0xa093('0x1'));var jsonpatch=require(_0xa093('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa093('0x3'));var Mustache=require(_0xa093('0x4'));var util=require(_0xa093('0x5'));var path=require(_0xa093('0x6'));var sox=require(_0xa093('0x7'));var csv=require(_0xa093('0x8'));var ejs=require(_0xa093('0x9'));var fs=require('fs');var fs_extra=require(_0xa093('0xa'));var _=require(_0xa093('0xb'));var squel=require(_0xa093('0xc'));var crypto=require(_0xa093('0xd'));var jsforce=require(_0xa093('0xe'));var deskjs=require(_0xa093('0xf'));var toCsv=require(_0xa093('0x8'));var querystring=require(_0xa093('0x10'));var Papa=require(_0xa093('0x11'));var Redis=require(_0xa093('0x12'));var authService=require(_0xa093('0x13'));var qs=require(_0xa093('0x14'));var as=require(_0xa093('0x15'));var hardwareService=require(_0xa093('0x16'));var logger=require('../../config/logger')(_0xa093('0x17'));var utils=require(_0xa093('0x18'));var config=require(_0xa093('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa093('0x1a'))['db'];function respondWithStatusCode(_0x37b045,_0x306405){_0x306405=_0x306405||0xcc;return function(_0x33b118){if(_0x33b118){return _0x37b045[_0xa093('0x1b')](_0x306405);}return _0x37b045[_0xa093('0x1c')](_0x306405)[_0xa093('0x1d')]();};}function respondWithResult(_0x5b7b2c,_0x108037){_0x108037=_0x108037||0xc8;return function(_0x56fc96){if(_0x56fc96){return _0x5b7b2c[_0xa093('0x1c')](_0x108037)[_0xa093('0x1e')](_0x56fc96);}};}function respondWithFilteredResult(_0x45005f,_0x2f8e67){return function(_0x8245d8){if(_0x8245d8){var _0x26ac40=typeof _0x2f8e67[_0xa093('0x1f')]===_0xa093('0x20')&&typeof _0x2f8e67['limit']===_0xa093('0x20');var _0x226d1e=_0x8245d8[_0xa093('0x21')];var _0x30782c=_0x26ac40?0x0:_0x2f8e67[_0xa093('0x1f')];var _0x3b63db=_0x26ac40?_0x8245d8[_0xa093('0x21')]:_0x2f8e67['offset']+_0x2f8e67[_0xa093('0x22')];var _0x4bcb2a;if(_0x3b63db>=_0x226d1e){_0x3b63db=_0x226d1e;_0x4bcb2a=0xc8;}else{_0x4bcb2a=0xce;}_0x45005f[_0xa093('0x1c')](_0x4bcb2a);return _0x45005f['set'](_0xa093('0x23'),_0x30782c+'-'+_0x3b63db+'/'+_0x226d1e)[_0xa093('0x1e')](_0x8245d8);}return null;};}function patchUpdates(_0x4b1a16){return function(_0x3841c8){try{jsonpatch[_0xa093('0x24')](_0x3841c8,_0x4b1a16,!![]);}catch(_0x93f81a){return BPromise[_0xa093('0x25')](_0x93f81a);}return _0x3841c8[_0xa093('0x26')]();};}function saveUpdates(_0x4b61c2,_0x2fa9ca){return function(_0x57125e){if(_0x57125e){return _0x57125e[_0xa093('0x27')](_0x4b61c2)['then'](function(_0x38d68a){return _0x38d68a;});}return null;};}function removeEntity(_0x329847,_0x2e909d){return function(_0x3aeb7f){if(_0x3aeb7f){return _0x3aeb7f[_0xa093('0x28')]()[_0xa093('0x29')](function(){_0x329847[_0xa093('0x1c')](0xcc)[_0xa093('0x1d')]();});}};}function handleEntityNotFound(_0x302f21,_0x536311){return function(_0xd20fd){if(!_0xd20fd){_0x302f21[_0xa093('0x1b')](0x194);}return _0xd20fd;};}function handleError(_0x1f9506,_0x36fd8f){_0x36fd8f=_0x36fd8f||0x1f4;return function(_0x31909b){logger[_0xa093('0x2a')](_0x31909b[_0xa093('0x2b')]);if(_0x31909b[_0xa093('0x2c')]){delete _0x31909b[_0xa093('0x2c')];}_0x1f9506[_0xa093('0x1c')](_0x36fd8f)['send'](_0x31909b);};}exports[_0xa093('0x2d')]=function(_0x1b9148,_0x2d0e05){var _0x238904={},_0xdae8ec={},_0x4cc949={'count':0x0,'rows':[]};var _0x507f20=_[_0xa093('0x2e')](db[_0xa093('0x2f')][_0xa093('0x30')],function(_0x1bfe1a){return{'name':_0x1bfe1a['fieldName'],'type':_0x1bfe1a['type']['key']};});_0xdae8ec[_0xa093('0x31')]=_['map'](_0x507f20,_0xa093('0x2c'));_0xdae8ec[_0xa093('0x32')]=_[_0xa093('0x33')](_0x1b9148['query']);_0xdae8ec[_0xa093('0x34')]=_[_0xa093('0x35')](_0xdae8ec[_0xa093('0x31')],_0xdae8ec[_0xa093('0x32')]);_0x238904[_0xa093('0x36')]=_[_0xa093('0x35')](_0xdae8ec[_0xa093('0x31')],qs[_0xa093('0x37')](_0x1b9148[_0xa093('0x32')][_0xa093('0x37')]));_0x238904[_0xa093('0x36')]=_0x238904[_0xa093('0x36')]['length']?_0x238904[_0xa093('0x36')]:_0xdae8ec['model'];if(!_0x1b9148[_0xa093('0x32')][_0xa093('0x38')](_0xa093('0x39'))){_0x238904[_0xa093('0x22')]=qs['limit'](_0x1b9148[_0xa093('0x32')]['limit']);_0x238904[_0xa093('0x1f')]=qs[_0xa093('0x1f')](_0x1b9148[_0xa093('0x32')][_0xa093('0x1f')]);}_0x238904[_0xa093('0x3a')]=qs['sort'](_0x1b9148[_0xa093('0x32')]['sort']);_0x238904[_0xa093('0x3b')]=qs['filters'](_['pick'](_0x1b9148[_0xa093('0x32')],_0xdae8ec[_0xa093('0x34')]),_0x507f20);if(_0x1b9148['query'][_0xa093('0x3c')]){_0x238904[_0xa093('0x3b')]=_['merge'](_0x238904[_0xa093('0x3b')],{'$or':_['map'](_0x507f20,function(_0x158a7b){if(_0x158a7b[_0xa093('0x3d')]!==_0xa093('0x3e')){var _0x4acb9b={};_0x4acb9b[_0x158a7b['name']]={'$like':'%'+_0x1b9148[_0xa093('0x32')][_0xa093('0x3c')]+'%'};return _0x4acb9b;}})});}_0x238904=_[_0xa093('0x3f')]({},_0x238904,_0x1b9148[_0xa093('0x40')]);var _0x425cdf={'where':_0x238904[_0xa093('0x3b')]};return db[_0xa093('0x2f')][_0xa093('0x21')](_0x425cdf)['then'](function(_0xe3e89b){_0x4cc949['count']=_0xe3e89b;if(_0x1b9148[_0xa093('0x32')][_0xa093('0x41')]){_0x238904[_0xa093('0x42')]=[{'all':!![]}];}return db[_0xa093('0x2f')][_0xa093('0x43')](_0x238904);})['then'](function(_0x2f5f07){_0x4cc949[_0xa093('0x44')]=_0x2f5f07;return _0x4cc949;})['then'](respondWithFilteredResult(_0x2d0e05,_0x238904))[_0xa093('0x45')](handleError(_0x2d0e05,null));};exports[_0xa093('0x46')]=function(_0x1f73eb,_0x3303da){var _0x58c10e={'raw':!![],'where':{'id':_0x1f73eb[_0xa093('0x47')]['id']}},_0x4205f8={};_0x4205f8[_0xa093('0x31')]=_[_0xa093('0x33')](db[_0xa093('0x2f')]['rawAttributes']);_0x4205f8[_0xa093('0x32')]=_[_0xa093('0x33')](_0x1f73eb[_0xa093('0x32')]);_0x4205f8[_0xa093('0x34')]=_['intersection'](_0x4205f8[_0xa093('0x31')],_0x4205f8[_0xa093('0x32')]);_0x58c10e[_0xa093('0x36')]=_[_0xa093('0x35')](_0x4205f8[_0xa093('0x31')],qs[_0xa093('0x37')](_0x1f73eb[_0xa093('0x32')][_0xa093('0x37')]));_0x58c10e[_0xa093('0x36')]=_0x58c10e[_0xa093('0x36')]['length']?_0x58c10e['attributes']:_0x4205f8[_0xa093('0x31')];if(_0x1f73eb[_0xa093('0x32')][_0xa093('0x41')]){_0x58c10e[_0xa093('0x42')]=[{'all':!![]}];}_0x58c10e=_[_0xa093('0x3f')]({},_0x58c10e,_0x1f73eb[_0xa093('0x40')]);return db[_0xa093('0x2f')][_0xa093('0x48')](_0x58c10e)[_0xa093('0x29')](handleEntityNotFound(_0x3303da,null))[_0xa093('0x29')](respondWithResult(_0x3303da,null))[_0xa093('0x45')](handleError(_0x3303da,null));};exports[_0xa093('0x49')]=function(_0x436c5c,_0x295c21){return db[_0xa093('0x2f')]['create'](_0x436c5c['body'],{})['then'](respondWithResult(_0x295c21,0xc9))[_0xa093('0x45')](handleError(_0x295c21,null));};exports[_0xa093('0x27')]=function(_0x36fb5a,_0x2fefaf){if(_0x36fb5a[_0xa093('0x4a')]['id']){delete _0x36fb5a[_0xa093('0x4a')]['id'];}return db[_0xa093('0x2f')][_0xa093('0x48')]({'where':{'id':_0x36fb5a['params']['id']}})[_0xa093('0x29')](handleEntityNotFound(_0x2fefaf,null))[_0xa093('0x29')](saveUpdates(_0x36fb5a[_0xa093('0x4a')],null))['then'](respondWithResult(_0x2fefaf,null))[_0xa093('0x45')](handleError(_0x2fefaf,null));};exports['destroy']=function(_0x5e567f,_0x21b83f){return db[_0xa093('0x2f')]['find']({'where':{'id':_0x5e567f[_0xa093('0x47')]['id']}})['then'](handleEntityNotFound(_0x21b83f,null))[_0xa093('0x29')](removeEntity(_0x21b83f,null))[_0xa093('0x45')](handleError(_0x21b83f,null));};exports[_0xa093('0x4b')]=function(_0xd88868,_0x142ef0){return db[_0xa093('0x2f')][_0xa093('0x4b')]()[_0xa093('0x29')](respondWithResult(_0x142ef0,null))[_0xa093('0x45')](handleError(_0x142ef0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 5a44dc8..ef98ec3 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 _0x044f=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','util','../../config/logger','api','bluebird','request-promise'];(function(_0x19ee96,_0x48b7d5){var _0x57aaf0=function(_0x26f332){while(--_0x26f332){_0x19ee96['push'](_0x19ee96['shift']());}};_0x57aaf0(++_0x48b7d5);}(_0x044f,0x7f));var _0xf044=function(_0x19b9d1,_0x4f603f){_0x19b9d1=_0x19b9d1-0x0;var _0x1ca4f7=_0x044f[_0x19b9d1];return _0x1ca4f7;};'use strict';var _=require('lodash');var util=require(_0xf044('0x0'));var logger=require(_0xf044('0x1'))(_0xf044('0x2'));var moment=require('moment');var BPromise=require(_0xf044('0x3'));var rp=require(_0xf044('0x4'));var fs=require('fs');var path=require(_0xf044('0x5'));var rimraf=require(_0xf044('0x6'));var config=require(_0xf044('0x7'));var attributes=require(_0xf044('0x8'));module[_0xf044('0x9')]=function(_0x1680b4,_0x113281){return _0x1680b4[_0xf044('0xa')](_0xf044('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b83=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_jscripty_answers','lodash','../../config/logger'];(function(_0xea10b4,_0x25f0f2){var _0x3247b5=function(_0x2fa67f){while(--_0x2fa67f){_0xea10b4['push'](_0xea10b4['shift']());}};_0x3247b5(++_0x25f0f2);}(_0x2b83,0x12a));var _0x32b8=function(_0x42b0cc,_0x401fc7){_0x42b0cc=_0x42b0cc-0x0;var _0x2ddd3c=_0x2b83[_0x42b0cc];return _0x2ddd3c;};'use strict';var _=require(_0x32b8('0x0'));var util=require('util');var logger=require(_0x32b8('0x1'))('api');var moment=require(_0x32b8('0x2'));var BPromise=require(_0x32b8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32b8('0x4'));var rimraf=require(_0x32b8('0x5'));var config=require(_0x32b8('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x32b8('0x7')]=function(_0x325bb6,_0x2651fb){return _0x325bb6[_0x32b8('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x32b8('0x9'),'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 24a4500..2ceb9a0 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 _0x03f5=['../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x32c336,_0x5704f0){var _0x11e4ae=function(_0x21e834){while(--_0x21e834){_0x32c336['push'](_0x32c336['shift']());}};_0x11e4ae(++_0x5704f0);}(_0x03f5,0x173));var _0x503f=function(_0x5dd181,_0x27d49c){_0x5dd181=_0x5dd181-0x0;var _0x19b152=_0x03f5[_0x5dd181];return _0x19b152;};'use strict';var _=require('lodash');var util=require(_0x503f('0x0'));var moment=require(_0x503f('0x1'));var BPromise=require(_0x503f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x503f('0x3'));var db=require(_0x503f('0x4'))['db'];var utils=require(_0x503f('0x5'));var logger=require('../../config/logger')(_0x503f('0x6'));var config=require(_0x503f('0x7'));var jayson=require(_0x503f('0x8'));var client=jayson[_0x503f('0x9')][_0x503f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x362769,_0x5c1477,_0x1fa70c){return new BPromise(function(_0x3b9e48,_0xde6900){return client[_0x503f('0xb')](_0x362769,_0x1fa70c)['then'](function(_0x4115eb){logger[_0x503f('0xc')](_0x503f('0xd'),_0x5c1477,_0x503f('0xe'));logger[_0x503f('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5c1477,'request\x20sent',JSON[_0x503f('0x10')](_0x4115eb));if(_0x4115eb['error']){if(_0x4115eb[_0x503f('0x11')][_0x503f('0x12')]===0x1f4){logger[_0x503f('0x11')](_0x503f('0xd'),_0x5c1477,_0x4115eb[_0x503f('0x11')][_0x503f('0x13')]);return _0xde6900(_0x4115eb['error'][_0x503f('0x13')]);}logger[_0x503f('0x11')](_0x503f('0xd'),_0x5c1477,_0x4115eb[_0x503f('0x11')][_0x503f('0x13')]);return _0x3b9e48(_0x4115eb['error'][_0x503f('0x13')]);}else{logger[_0x503f('0xc')](_0x503f('0xd'),_0x5c1477,_0x503f('0xe'));_0x3b9e48(_0x4115eb['result'][_0x503f('0x13')]);}})[_0x503f('0x14')](function(_0x5a5399){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5c1477,_0x5a5399);_0xde6900(_0x5a5399);});});} \ No newline at end of file +var _0x8ba8=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ba8,0xa9));var _0x88ba=function(_0x22d6bc,_0x407ccc){_0x22d6bc=_0x22d6bc-0x0;var _0x92f04=_0x8ba8[_0x22d6bc];return _0x92f04;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x88ba('0x0'));var BPromise=require(_0x88ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88ba('0x2'));var db=require(_0x88ba('0x3'))['db'];var utils=require(_0x88ba('0x4'));var logger=require(_0x88ba('0x5'))(_0x88ba('0x6'));var config=require(_0x88ba('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x88ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x208958,_0x4632c7,_0x26e473){return new BPromise(function(_0x1c1367,_0x48c460){return client['request'](_0x208958,_0x26e473)['then'](function(_0x5a81cf){logger[_0x88ba('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4632c7,_0x88ba('0xa'));logger[_0x88ba('0xb')](_0x88ba('0xc'),_0x4632c7,_0x88ba('0xa'),JSON['stringify'](_0x5a81cf));if(_0x5a81cf[_0x88ba('0xd')]){if(_0x5a81cf[_0x88ba('0xd')]['code']===0x1f4){logger['error'](_0x88ba('0xe'),_0x4632c7,_0x5a81cf[_0x88ba('0xd')][_0x88ba('0xf')]);return _0x48c460(_0x5a81cf[_0x88ba('0xd')][_0x88ba('0xf')]);}logger[_0x88ba('0xd')](_0x88ba('0xe'),_0x4632c7,_0x5a81cf['error'][_0x88ba('0xf')]);return _0x1c1367(_0x5a81cf['error']['message']);}else{logger[_0x88ba('0x9')](_0x88ba('0xe'),_0x4632c7,_0x88ba('0xa'));_0x1c1367(_0x5a81cf[_0x88ba('0x10')][_0x88ba('0xf')]);}})[_0x88ba('0x11')](function(_0x14ff53){logger[_0x88ba('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4632c7,_0x14ff53);_0x48c460(_0x14ff53);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8af45c8..1cfd37e 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 _0x5837=['post','clone','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','getSummary','create'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5837,0x11b));var _0x7583=function(_0x170f85,_0x234754){_0x170f85=_0x170f85-0x0;var _0x229661=_0x5837[_0x170f85];return _0x229661;};'use strict';var multer=require(_0x7583('0x0'));var util=require(_0x7583('0x1'));var path=require('path');var timeout=require(_0x7583('0x2'));var express=require('express');var router=express[_0x7583('0x3')]();var fs_extra=require(_0x7583('0x4'));var auth=require(_0x7583('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7583('0x6'));var controller=require(_0x7583('0x7'));router[_0x7583('0x8')]('/',auth[_0x7583('0x9')](),controller['index']);router['get'](_0x7583('0xa'),auth[_0x7583('0x9')](),controller['show']);router[_0x7583('0x8')]('/:id/sessions',auth[_0x7583('0x9')](),controller[_0x7583('0xb')]);router[_0x7583('0x8')](_0x7583('0xc'),auth[_0x7583('0x9')](),controller[_0x7583('0xd')]);router[_0x7583('0x8')]('/:id/summary',auth[_0x7583('0x9')](),timeout('30s'),controller[_0x7583('0xe')]);router['post']('/',auth[_0x7583('0x9')](),controller[_0x7583('0xf')]);router[_0x7583('0x10')]('/:id/clone',auth[_0x7583('0x9')](),controller[_0x7583('0x11')]);router[_0x7583('0x12')](_0x7583('0xa'),auth['isAuthenticated'](),controller[_0x7583('0x13')]);router[_0x7583('0x14')](_0x7583('0xa'),auth['isAuthenticated'](),controller[_0x7583('0x15')]);module[_0x7583('0x16')]=router; \ No newline at end of file +var _0xace2=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','index','get','/:id','isAuthenticated','show','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5aeefa,_0x4c2a82){var _0x5e6f28=function(_0x4a6bc2){while(--_0x4a6bc2){_0x5aeefa['push'](_0x5aeefa['shift']());}};_0x5e6f28(++_0x4c2a82);}(_0xace2,0x9c));var _0x2ace=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xace2[_0x5a7e3c];return _0x59252b;};'use strict';var multer=require(_0x2ace('0x0'));var util=require('util');var path=require(_0x2ace('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ace('0x2'));var router=express[_0x2ace('0x3')]();var fs_extra=require(_0x2ace('0x4'));var auth=require(_0x2ace('0x5'));var interaction=require(_0x2ace('0x6'));var config=require(_0x2ace('0x7'));var controller=require(_0x2ace('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ace('0x9')]);router[_0x2ace('0xa')](_0x2ace('0xb'),auth[_0x2ace('0xc')](),controller[_0x2ace('0xd')]);router['get']('/:id/sessions',auth[_0x2ace('0xc')](),controller['getSessions']);router[_0x2ace('0xa')](_0x2ace('0xe'),auth[_0x2ace('0xc')](),controller['getAnswers']);router[_0x2ace('0xa')](_0x2ace('0xf'),auth[_0x2ace('0xc')](),timeout(_0x2ace('0x10')),controller[_0x2ace('0x11')]);router[_0x2ace('0x12')]('/',auth[_0x2ace('0xc')](),controller[_0x2ace('0x13')]);router[_0x2ace('0x12')](_0x2ace('0x14'),auth['isAuthenticated'](),controller[_0x2ace('0x15')]);router[_0x2ace('0x16')](_0x2ace('0xb'),auth[_0x2ace('0xc')](),controller[_0x2ace('0x17')]);router[_0x2ace('0x18')](_0x2ace('0xb'),auth[_0x2ace('0xc')](),controller[_0x2ace('0x19')]);module[_0x2ace('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c3f7fea..0515b50 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 _0x613b=['isObjectLike','setDataValue','stringify','isString','formData','format','getDataValue','name','BOOLEAN','sequelize','util','STRING','TEXT'];(function(_0x3ba282,_0x1dde3d){var _0x374bfd=function(_0x536bbc){while(--_0x536bbc){_0x3ba282['push'](_0x3ba282['shift']());}};_0x374bfd(++_0x1dde3d);}(_0x613b,0x1dd));var _0xb613=function(_0x1c8e9a,_0x327773){_0x1c8e9a=_0x1c8e9a-0x0;var _0x57cd5a=_0x613b[_0x1c8e9a];return _0x57cd5a;};'use strict';var Sequelize=require(_0xb613('0x0'));var _=require('lodash');var util=require(_0xb613('0x1'));module['exports']={'name':{'type':Sequelize[_0xb613('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb613('0x2')]},'formData':{'type':Sequelize[_0xb613('0x3')]('long'),'set':function(_0x4e58ec){if(_[_0xb613('0x4')](_0x4e58ec)){this[_0xb613('0x5')]('formData',JSON[_0xb613('0x6')](_0x4e58ec));}else if(_[_0xb613('0x7')](_0x4e58ec)){this[_0xb613('0x5')](_0xb613('0x8'),_0x4e58ec);}else{this[_0xb613('0x5')](_0xb613('0x8'),util[_0xb613('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb613('0xa')](_0xb613('0xb'))||'',this[_0xb613('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb613('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc8d2=['BOOLEAN','util','exports','STRING','name','TEXT','long','isObjectLike','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xc8d2,0x16d));var _0x2c8d=function(_0x34207c,_0x21dfc2){_0x34207c=_0x34207c-0x0;var _0x3b1c2e=_0xc8d2[_0x34207c];return _0x3b1c2e;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x2c8d('0x0'));module[_0x2c8d('0x1')]={'name':{'type':Sequelize[_0x2c8d('0x2')],'unique':_0x2c8d('0x3')},'description':{'type':Sequelize[_0x2c8d('0x2')]},'formData':{'type':Sequelize[_0x2c8d('0x4')](_0x2c8d('0x5')),'set':function(_0x5151ad){if(_[_0x2c8d('0x6')](_0x5151ad)){this['setDataValue']('formData',JSON['stringify'](_0x5151ad));}else if(_[_0x2c8d('0x7')](_0x5151ad)){this['setDataValue'](_0x2c8d('0x8'),_0x5151ad);}else{this['setDataValue'](_0x2c8d('0x8'),util['format'](_0x2c8d('0x9'),this[_0x2c8d('0xa')](_0x2c8d('0x3'))||'',this['getDataValue'](_0x2c8d('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2c8d('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2c8d('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 284b561..6c8d3cd 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 _0x5f66=['name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','merge','options','JscriptyProject','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','user','error','getSessions','findOne','JscriptySessionReport','nolimit','order','pick','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','starttime','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','format','Content-type','text/csv','download','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','../../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','Projects','UserProfileResource'];(function(_0x417df0,_0x47917c){var _0x51048e=function(_0x13fc11){while(--_0x13fc11){_0x417df0['push'](_0x417df0['shift']());}};_0x51048e(++_0x47917c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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(){var _0x2774a1=_0x1eeaaa['get']({'plain':!![]});var _0x9d7bb0=_0x65f6('0x22');return db[_0x65f6('0x23')]['destroy']({'where':{'type':_0x9d7bb0,'resourceId':_0x2774a1['id']}})['then'](function(){return _0x1eeaaa;});})['then'](function(){_0xd173f4[_0x65f6('0x15')](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0x4b2292,_0x296cd9){return function(_0x28f710){if(!_0x28f710){_0x4b2292['sendStatus'](0x194);}return _0x28f710;};}function handleError(_0x325cb4,_0x2bff2b){_0x2bff2b=_0x2bff2b||0x1f4;return function(_0x28d0df){logger['error'](_0x28d0df['stack']);if(_0x28d0df['name']){delete _0x28d0df[_0x65f6('0x24')];}_0x325cb4[_0x65f6('0x15')](_0x2bff2b)[_0x65f6('0x25')](_0x28d0df);};}exports[_0x65f6('0x26')]=function(_0x518cac,_0x14a387){var _0x144e55={},_0x4ace4c={},_0x4ea23d={'count':0x0,'rows':[]};var _0x154cbd=_[_0x65f6('0x27')](db['JscriptyProject']['rawAttributes'],function(_0x10b368){return{'name':_0x10b368[_0x65f6('0x28')],'type':_0x10b368[_0x65f6('0x29')][_0x65f6('0x2a')]};});_0x4ace4c[_0x65f6('0x2b')]=_[_0x65f6('0x27')](_0x154cbd,'name');_0x4ace4c[_0x65f6('0x2c')]=_[_0x65f6('0x2d')](_0x518cac[_0x65f6('0x2c')]);_0x4ace4c['filters']=_[_0x65f6('0x2e')](_0x4ace4c[_0x65f6('0x2b')],_0x4ace4c[_0x65f6('0x2c')]);_0x144e55[_0x65f6('0x2f')]=_[_0x65f6('0x2e')](_0x4ace4c[_0x65f6('0x2b')],qs['fields'](_0x518cac[_0x65f6('0x2c')][_0x65f6('0x30')]));_0x144e55['attributes']=_0x144e55[_0x65f6('0x2f')]['length']?_0x144e55[_0x65f6('0x2f')]:_0x4ace4c['model'];if(!_0x518cac[_0x65f6('0x2c')][_0x65f6('0x31')]('nolimit')){_0x144e55[_0x65f6('0x19')]=qs[_0x65f6('0x19')](_0x518cac[_0x65f6('0x2c')]['limit']);_0x144e55['offset']=qs[_0x65f6('0x1b')](_0x518cac['query'][_0x65f6('0x1b')]);}_0x144e55['order']=qs[_0x65f6('0x32')](_0x518cac[_0x65f6('0x2c')]['sort']);_0x144e55[_0x65f6('0x33')]=qs['filters'](_['pick'](_0x518cac[_0x65f6('0x2c')],_0x4ace4c[_0x65f6('0x34')]),_0x154cbd);if(_0x518cac[_0x65f6('0x2c')][_0x65f6('0x35')]){_0x144e55[_0x65f6('0x33')]=_[_0x65f6('0x36')](_0x144e55[_0x65f6('0x33')],{'$or':_[_0x65f6('0x27')](_0x154cbd,function(_0x4f933b){if(_0x4f933b[_0x65f6('0x29')]!=='VIRTUAL'){var _0x12a589={};_0x12a589[_0x4f933b[_0x65f6('0x24')]]={'$like':'%'+_0x518cac[_0x65f6('0x2c')][_0x65f6('0x35')]+'%'};return _0x12a589;}})});}_0x144e55=_['merge']({},_0x144e55,_0x518cac[_0x65f6('0x37')]);var _0x1d6421={'where':_0x144e55[_0x65f6('0x33')]};return db[_0x65f6('0x38')][_0x65f6('0x1a')](_0x1d6421)[_0x65f6('0x21')](function(_0xed4c96){_0x4ea23d[_0x65f6('0x1a')]=_0xed4c96;if(_0x518cac[_0x65f6('0x2c')]['includeAll']){_0x144e55[_0x65f6('0x39')]=[{'all':!![]}];}return db[_0x65f6('0x38')][_0x65f6('0x3a')](_0x144e55);})[_0x65f6('0x21')](function(_0x83e2d9){_0x4ea23d[_0x65f6('0x3b')]=_0x83e2d9;return _0x4ea23d;})[_0x65f6('0x21')](respondWithFilteredResult(_0x14a387,_0x144e55))[_0x65f6('0x3c')](handleError(_0x14a387,null));};exports[_0x65f6('0x3d')]=function(_0x2abbed,_0xcf19da){var _0x2c008a={'raw':![],'where':{'id':_0x2abbed[_0x65f6('0x3e')]['id']}},_0x6c4d94={};_0x6c4d94[_0x65f6('0x2b')]=_[_0x65f6('0x2d')](db['JscriptyProject'][_0x65f6('0x3f')]);_0x6c4d94[_0x65f6('0x2c')]=_[_0x65f6('0x2d')](_0x2abbed[_0x65f6('0x2c')]);_0x6c4d94['filters']=_[_0x65f6('0x2e')](_0x6c4d94[_0x65f6('0x2b')],_0x6c4d94[_0x65f6('0x2c')]);_0x2c008a['attributes']=_[_0x65f6('0x2e')](_0x6c4d94[_0x65f6('0x2b')],qs[_0x65f6('0x30')](_0x2abbed[_0x65f6('0x2c')]['fields']));_0x2c008a[_0x65f6('0x2f')]=_0x2c008a['attributes'][_0x65f6('0x40')]?_0x2c008a[_0x65f6('0x2f')]:_0x6c4d94['model'];if(_0x2abbed[_0x65f6('0x2c')]['includeAll']){_0x2c008a[_0x65f6('0x39')]=[{'all':!![]}];}_0x2c008a=_[_0x65f6('0x36')]({},_0x2c008a,_0x2abbed[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x2c008a)[_0x65f6('0x21')](handleEntityNotFound(_0xcf19da,null))['then'](respondWithResult(_0xcf19da,null))['catch'](handleError(_0xcf19da,null));};exports[_0x65f6('0x42')]=function(_0x15d3ba,_0x3b647a){return db[_0x65f6('0x38')][_0x65f6('0x42')](_0x15d3ba[_0x65f6('0x43')],{})[_0x65f6('0x21')](function(_0x41690c){var _0x414f49=_0x15d3ba['user'][_0x65f6('0x44')]({'plain':!![]});if(!_0x414f49)throw new Error(_0x65f6('0x45'));if(_0x414f49[_0x65f6('0x46')]==='user'){var _0x47e749=_0x41690c[_0x65f6('0x44')]({'plain':!![]});var _0x49ba5a=_0x65f6('0x22');return db[_0x65f6('0x47')]['find']({'where':{'name':_0x49ba5a,'userProfileId':_0x414f49[_0x65f6('0x48')]},'raw':!![]})['then'](function(_0x247be3){if(_0x247be3&&_0x247be3[_0x65f6('0x49')]===0x0){return db[_0x65f6('0x23')]['create']({'name':_0x47e749[_0x65f6('0x24')],'resourceId':_0x47e749['id'],'type':_0x247be3[_0x65f6('0x24')],'sectionId':_0x247be3['id']},{})['then'](function(){return _0x41690c;});}else{return _0x41690c;}})[_0x65f6('0x3c')](function(_0x34312c){logger['error'](_0x65f6('0x4a'),_0x34312c);throw _0x34312c;});}return _0x41690c;})[_0x65f6('0x21')](respondWithResult(_0x3b647a,0xc9))[_0x65f6('0x3c')](handleError(_0x3b647a,null));};exports[_0x65f6('0x4b')]=function(_0x234fa7,_0x2350ca){var _0x1d620a={'where':{'id':_0x234fa7['params']['id']}},_0x305131={};_0x305131['model']=_['keys'](db[_0x65f6('0x38')][_0x65f6('0x3f')]);_0x1d620a[_0x65f6('0x2f')]=_[_0x65f6('0x2e')](_0x305131['model'],qs[_0x65f6('0x30')](_0x234fa7[_0x65f6('0x2c')][_0x65f6('0x30')]));_0x1d620a['attributes']=_0x1d620a[_0x65f6('0x2f')][_0x65f6('0x40')]?_0x1d620a[_0x65f6('0x2f')]:_0x305131['model'];if(_0x234fa7['query'][_0x65f6('0x4c')]){_0x1d620a[_0x65f6('0x39')]=[{'all':!![]}];}_0x1d620a=_[_0x65f6('0x36')]({},_0x1d620a,_0x234fa7[_0x65f6('0x37')]);return db[_0x65f6('0x38')][_0x65f6('0x41')](_0x1d620a)[_0x65f6('0x21')](handleEntityNotFound(_0x2350ca,null))[_0x65f6('0x21')](function(_0x2d8b5b){if(_0x2d8b5b){var _0xddbd90=_0x2d8b5b[_0x65f6('0x44')]({'plain':!![]});_0xddbd90=qs[_0x65f6('0x4d')](_0xddbd90,['id',_0x65f6('0x4e'),_0x65f6('0x4f')]);_0x234fa7['body']=_[_0x65f6('0x4d')](_0x234fa7[_0x65f6('0x43')],['id',_0x65f6('0x4e'),'updatedAt']);return db[_0x65f6('0x38')][_0x65f6('0x42')](_[_0x65f6('0x36')](_0xddbd90,_0x234fa7[_0x65f6('0x43')]),{'include':_0x234fa7['query'][_0x65f6('0x4c')]?[{'all':!![]}]:undefined})[_0x65f6('0x21')](function(_0xe5fc65){var _0x3e0d8b=_0x234fa7['user'][_0x65f6('0x44')]({'plain':!![]});if(!_0x3e0d8b)throw new Error(_0x65f6('0x45'));if(_0x3e0d8b['role']===_0x65f6('0x50')){var _0x26481e=_0xe5fc65[_0x65f6('0x44')]({'plain':!![]});var _0x51549d=_0x65f6('0x22');return db[_0x65f6('0x47')][_0x65f6('0x41')]({'where':{'name':_0x51549d,'userProfileId':_0x3e0d8b[_0x65f6('0x48')]},'raw':!![]})[_0x65f6('0x21')](function(_0x334fa1){if(_0x334fa1&&_0x334fa1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x26481e[_0x65f6('0x24')],'resourceId':_0x26481e['id'],'type':_0x334fa1[_0x65f6('0x24')],'sectionId':_0x334fa1['id']},{})[_0x65f6('0x21')](function(){return _0xe5fc65;});}else{return _0xe5fc65;}})[_0x65f6('0x3c')](function(_0xab6f0){logger[_0x65f6('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xab6f0);throw _0xab6f0;});}return _0xe5fc65;});}})[_0x65f6('0x21')](respondWithResult(_0x2350ca,0xc9))[_0x65f6('0x3c')](handleError(_0x2350ca,null));};exports['update']=function(_0x225aeb,_0x39c244){if(_0x225aeb[_0x65f6('0x43')]['id']){delete _0x225aeb['body']['id'];}return db[_0x65f6('0x38')][_0x65f6('0x41')]({'where':{'id':_0x225aeb['params']['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x39c244,null))[_0x65f6('0x21')](saveUpdates(_0x225aeb[_0x65f6('0x43')],null))[_0x65f6('0x21')](respondWithResult(_0x39c244,null))[_0x65f6('0x3c')](handleError(_0x39c244,null));};exports[_0x65f6('0x20')]=function(_0x2dbf47,_0x4e9bc1){return db['JscriptyProject'][_0x65f6('0x41')]({'where':{'id':_0x2dbf47[_0x65f6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e9bc1,null))[_0x65f6('0x21')](removeEntity(_0x4e9bc1,null))['catch'](handleError(_0x4e9bc1,null));};exports[_0x65f6('0x52')]=function(_0x4e0450,_0x440df1,_0xdc8989){var _0x1b8ac0={'raw':!![],'where':{}};var _0x2beeb7={};var _0x145aaa={'count':0x0,'rows':[]};return db[_0x65f6('0x38')][_0x65f6('0x53')]({'where':{'id':_0x4e0450[_0x65f6('0x3e')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x440df1,null))['then'](function(_0x480190){if(_0x480190){_0x2beeb7[_0x65f6('0x2b')]=_[_0x65f6('0x2d')](db[_0x65f6('0x54')]['rawAttributes']);_0x2beeb7['query']=_[_0x65f6('0x2d')](_0x4e0450[_0x65f6('0x2c')]);_0x2beeb7[_0x65f6('0x34')]=_[_0x65f6('0x2e')](_0x2beeb7[_0x65f6('0x2b')],_0x2beeb7[_0x65f6('0x2c')]);_0x1b8ac0['attributes']=_['intersection'](_0x2beeb7[_0x65f6('0x2b')],qs[_0x65f6('0x30')](_0x4e0450['query'][_0x65f6('0x30')]));_0x1b8ac0['attributes']=_0x1b8ac0[_0x65f6('0x2f')][_0x65f6('0x40')]?_0x1b8ac0[_0x65f6('0x2f')]:_0x2beeb7[_0x65f6('0x2b')];if(!_0x4e0450['query'][_0x65f6('0x31')](_0x65f6('0x55'))){_0x1b8ac0[_0x65f6('0x19')]=qs['limit'](_0x4e0450['query'][_0x65f6('0x19')]);_0x1b8ac0['offset']=qs[_0x65f6('0x1b')](_0x4e0450[_0x65f6('0x2c')][_0x65f6('0x1b')]);}_0x1b8ac0[_0x65f6('0x56')]=qs['sort'](_0x4e0450['query']['sort']);_0x1b8ac0[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_[_0x65f6('0x57')](_0x4e0450['query'],_0x2beeb7[_0x65f6('0x34')]));_0x1b8ac0[_0x65f6('0x33')][_0x65f6('0x58')]=_0x480190['id'];if(_0x4e0450['query'][_0x65f6('0x35')]){_0x1b8ac0[_0x65f6('0x33')]=_['merge'](_0x1b8ac0[_0x65f6('0x33')],{'$or':_[_0x65f6('0x27')](_0x1b8ac0['attributes'],function(_0x36baed){var _0x5ef825={};_0x5ef825[_0x36baed]={'$like':'%'+_0x4e0450[_0x65f6('0x2c')]['filter']+'%'};return _0x5ef825;})});}_0x1b8ac0=_[_0x65f6('0x36')]({},_0x1b8ac0,_0x4e0450[_0x65f6('0x37')]);return db['JscriptySessionReport'][_0x65f6('0x1a')]({'where':_0x1b8ac0[_0x65f6('0x33')]})[_0x65f6('0x21')](function(_0x299b85){_0x145aaa[_0x65f6('0x1a')]=_0x299b85;if(_0x4e0450[_0x65f6('0x2c')][_0x65f6('0x4c')]){_0x1b8ac0[_0x65f6('0x39')]=[{'all':!![]}];}return db[_0x65f6('0x54')][_0x65f6('0x3a')](_0x1b8ac0);})[_0x65f6('0x21')](function(_0x574d84){_0x145aaa[_0x65f6('0x3b')]=_0x574d84;return _0x145aaa;});}})[_0x65f6('0x21')](respondWithFilteredResult(_0x440df1,_0x1b8ac0))[_0x65f6('0x3c')](handleError(_0x440df1,null));};exports[_0x65f6('0x59')]=function(_0x5694f9,_0x453080,_0x12f81b){var _0x4a7928={'raw':!![],'where':{}};var _0x2e31c0={};var _0x556f53={'count':0x0,'rows':[]};return db[_0x65f6('0x38')]['findOne']({'where':{'id':_0x5694f9[_0x65f6('0x3e')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x453080,null))['then'](function(_0x4946c7){if(_0x4946c7){_0x2e31c0[_0x65f6('0x2b')]=_[_0x65f6('0x2d')](db['JscriptyAnswerReport'][_0x65f6('0x3f')]);_0x2e31c0[_0x65f6('0x2c')]=_[_0x65f6('0x2d')](_0x5694f9['query']);_0x2e31c0[_0x65f6('0x34')]=_[_0x65f6('0x2e')](_0x2e31c0['model'],_0x2e31c0[_0x65f6('0x2c')]);_0x4a7928['attributes']=_[_0x65f6('0x2e')](_0x2e31c0['model'],qs['fields'](_0x5694f9[_0x65f6('0x2c')][_0x65f6('0x30')]));_0x4a7928[_0x65f6('0x2f')]=_0x4a7928[_0x65f6('0x2f')][_0x65f6('0x40')]?_0x4a7928[_0x65f6('0x2f')]:_0x2e31c0[_0x65f6('0x2b')];if(!_0x5694f9[_0x65f6('0x2c')]['hasOwnProperty']('nolimit')){_0x4a7928[_0x65f6('0x19')]=qs['limit'](_0x5694f9[_0x65f6('0x2c')][_0x65f6('0x19')]);_0x4a7928[_0x65f6('0x1b')]=qs[_0x65f6('0x1b')](_0x5694f9[_0x65f6('0x2c')]['offset']);}_0x4a7928[_0x65f6('0x56')]=qs[_0x65f6('0x32')](_0x5694f9[_0x65f6('0x2c')]['sort']);_0x4a7928[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_[_0x65f6('0x57')](_0x5694f9[_0x65f6('0x2c')],_0x2e31c0[_0x65f6('0x34')]));_0x4a7928[_0x65f6('0x33')]['ProjectId']=_0x4946c7['id'];if(_0x5694f9['query'][_0x65f6('0x35')]){_0x4a7928[_0x65f6('0x33')]=_[_0x65f6('0x36')](_0x4a7928[_0x65f6('0x33')],{'$or':_['map'](_0x4a7928['attributes'],function(_0x336076){var _0x452f1e={};_0x452f1e[_0x336076]={'$like':'%'+_0x5694f9[_0x65f6('0x2c')][_0x65f6('0x35')]+'%'};return _0x452f1e;})});}_0x4a7928=_[_0x65f6('0x36')]({},_0x4a7928,_0x5694f9[_0x65f6('0x37')]);return db['JscriptyAnswerReport']['count']({'where':_0x4a7928['where']})[_0x65f6('0x21')](function(_0x2e63bb){_0x556f53[_0x65f6('0x1a')]=_0x2e63bb;if(_0x5694f9[_0x65f6('0x2c')]['includeAll']){_0x4a7928['include']=[{'all':!![]}];}return db[_0x65f6('0x5a')][_0x65f6('0x3a')](_0x4a7928);})['then'](function(_0x346fa9){_0x556f53['rows']=_0x346fa9;return _0x556f53;});}})[_0x65f6('0x21')](respondWithFilteredResult(_0x453080,_0x4a7928))['catch'](handleError(_0x453080,null));};function char(_0x3a30ed){return _0x65f6('0x5b')===typeof _0x3a30ed?String['fromCharCode'][_0x65f6('0x1d')](null,arguments):_0x3a30ed;}function needsEncapsulation(_0x330e18){return!!_0x330e18&&(_0x330e18[_0x65f6('0x5c')]()[_0x65f6('0x5d')](char(0xd))>=0x0||_0x330e18[_0x65f6('0x5c')]()[_0x65f6('0x5d')](char(0xa))>=0x0||_0x330e18['toString']()[_0x65f6('0x5d')](char(0x2c))>=0x0||_0x330e18['toString']()[_0x65f6('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x56336a){var _0x42e4cb=char(0x22),_0x3528be='\x5c'+char(0x22),_0xdf396c=_0x56336a[_0x65f6('0x5c')]()['replace'](new RegExp(_0x42e4cb,'g'),_0x3528be);return _0x42e4cb+_0xdf396c+_0x42e4cb;}exports[_0x65f6('0x5e')]=function(_0x35885c,_0x376a23,_0x5d42bd){var _0x52348e,_0xccd888;var _0x17d8f0={'where':{'ProjectId':_0x35885c['params']['id']}};if(_0x35885c[_0x65f6('0x2c')][_0x65f6('0x5f')]){_0x17d8f0[_0x65f6('0x33')]['starttime']=JSON[_0x65f6('0x60')](_0x35885c[_0x65f6('0x2c')]['startTime']);}return db[_0x65f6('0x54')][_0x65f6('0x3a')](_0x17d8f0)[_0x65f6('0x21')](handleEntityNotFound(_0x376a23,null))['then'](function(_0x2bb916){if(_0x2bb916){_0x52348e=_0x2bb916;return db[_0x65f6('0x61')][_0x65f6('0x3a')]({'where':{'SessionId':{'$in':_['map'](_0x52348e,'id')},'ProjectId':_0x35885c[_0x65f6('0x3e')]['id']},'order':'-createdAt'});}})[_0x65f6('0x21')](handleEntityNotFound(_0x376a23,null))[_0x65f6('0x21')](function(_0x31ec61){if(_0x31ec61){_0xccd888=_0x31ec61;var _0x22be6e={};for(var _0x29b2de=0x0,_0x430fb8=_0xccd888['length'];_0x29b2de<_0x430fb8;_0x29b2de++){if(!_0x22be6e[_0x65f6('0x31')](_0xccd888[_0x29b2de][_0x65f6('0x62')])){_0x22be6e[_0xccd888[_0x29b2de][_0x65f6('0x62')]]=needsEncapsulation(_0xccd888[_0x29b2de][_0x65f6('0x63')])?encapsulate(_0xccd888[_0x29b2de][_0x65f6('0x63')]):_0xccd888[_0x29b2de]['question'];}}var _0x59f421=[],_0x4c3818={};for(var _0x14dc7e=0x0,_0xdced81=_0x52348e[_0x65f6('0x40')];_0x14dc7e<_0xdced81;_0x14dc7e++){_0x4c3818={'ProjectId':_0x35885c['params']['id'],'SessionId':_0x52348e[_0x14dc7e]['id'],'StartTime':moment(_0x52348e[_0x14dc7e][_0x65f6('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3133f4=0x0,_0x41b58b=_0xccd888['length'];_0x3133f4<_0x41b58b;_0x3133f4++){if(_0xccd888[_0x3133f4][_0x65f6('0x65')]==_0x52348e[_0x14dc7e]['id']&&_0x22be6e[_0x65f6('0x31')](_0xccd888[_0x3133f4][_0x65f6('0x62')])){_0x4c3818[_0x22be6e[_0xccd888[_0x3133f4][_0x65f6('0x62')]]]=_0xccd888[_0x3133f4][_0x65f6('0x66')];}}for(var _0x1bd68f in _0x22be6e){if(!_0x4c3818[_0x65f6('0x31')](_0x22be6e[_0x1bd68f])){_0x4c3818[_0x22be6e[_0x1bd68f]]=null;}}_0x59f421[_0x65f6('0x67')](_0x4c3818);}return _0x59f421;}})[_0x65f6('0x21')](function(_0x350641){if(!_[_0x65f6('0x68')](_0x350641)){var _0x2ddda4=toCsv(_0x350641);var _0x5c9cc0=Date[_0x65f6('0x69')]();fs['writeFileSync'](util['format'](_0x65f6('0x6a'),_0x35885c[_0x65f6('0x3e')]['id'],_0x5c9cc0),_0x2ddda4);_0x376a23[_0x65f6('0x6b')](_0x65f6('0x6c'),'attachment;\x20filename='+util[_0x65f6('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x35885c['params']['id'],_0x5c9cc0));_0x376a23[_0x65f6('0x6b')](_0x65f6('0x6e'),_0x65f6('0x6f'));return _0x376a23[_0x65f6('0x70')](util[_0x65f6('0x6d')](_0x65f6('0x6a'),_0x35885c['params']['id'],_0x5c9cc0));}else{return _0x376a23[_0x65f6('0x14')](0xcc);}})['catch'](handleError(_0x376a23,null));}; \ No newline at end of file +var _0xd5c8=['now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Content-type','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','catch','show','params','filters','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','nolimit','pick','ProjectId','findAll','rows','getAnswers','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','parse','questionId','question','starttime','SessionId','answer'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0xd5c8,0x166));var _0x8d5c=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xd5c8[_0x552fce];return _0x3e27a2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d5c('0x0'));var jsonpatch=require(_0x8d5c('0x1'));var rp=require(_0x8d5c('0x2'));var moment=require(_0x8d5c('0x3'));var BPromise=require(_0x8d5c('0x4'));var Mustache=require(_0x8d5c('0x5'));var util=require(_0x8d5c('0x6'));var path=require(_0x8d5c('0x7'));var sox=require(_0x8d5c('0x8'));var csv=require('to-csv');var ejs=require(_0x8d5c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d5c('0xa'));var crypto=require(_0x8d5c('0xb'));var jsforce=require(_0x8d5c('0xc'));var deskjs=require(_0x8d5c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d5c('0xe'));var Redis=require('ioredis');var authService=require(_0x8d5c('0xf'));var qs=require(_0x8d5c('0x10'));var as=require(_0x8d5c('0x11'));var hardwareService=require(_0x8d5c('0x12'));var logger=require(_0x8d5c('0x13'))(_0x8d5c('0x14'));var utils=require(_0x8d5c('0x15'));var config=require(_0x8d5c('0x16'));var licenseUtil=require(_0x8d5c('0x17'));var db=require(_0x8d5c('0x18'))['db'];function respondWithStatusCode(_0x2a9a0e,_0x4152cd){_0x4152cd=_0x4152cd||0xcc;return function(_0x4c7321){if(_0x4c7321){return _0x2a9a0e[_0x8d5c('0x19')](_0x4152cd);}return _0x2a9a0e[_0x8d5c('0x1a')](_0x4152cd)[_0x8d5c('0x1b')]();};}function respondWithResult(_0x32dbd8,_0xa5a078){_0xa5a078=_0xa5a078||0xc8;return function(_0x149e54){if(_0x149e54){return _0x32dbd8[_0x8d5c('0x1a')](_0xa5a078)[_0x8d5c('0x1c')](_0x149e54);}};}function respondWithFilteredResult(_0x516388,_0x3146f4){return function(_0x144717){if(_0x144717){var _0x4ee2af=typeof _0x3146f4['offset']===_0x8d5c('0x1d')&&typeof _0x3146f4['limit']==='undefined';var _0x4f552a=_0x144717[_0x8d5c('0x1e')];var _0x43f233=_0x4ee2af?0x0:_0x3146f4[_0x8d5c('0x1f')];var _0x189005=_0x4ee2af?_0x144717[_0x8d5c('0x1e')]:_0x3146f4[_0x8d5c('0x1f')]+_0x3146f4['limit'];var _0x581eef;if(_0x189005>=_0x4f552a){_0x189005=_0x4f552a;_0x581eef=0xc8;}else{_0x581eef=0xce;}_0x516388['status'](_0x581eef);return _0x516388['set'](_0x8d5c('0x20'),_0x43f233+'-'+_0x189005+'/'+_0x4f552a)[_0x8d5c('0x1c')](_0x144717);}return null;};}function patchUpdates(_0x31cd31){return function(_0x273cba){try{jsonpatch[_0x8d5c('0x21')](_0x273cba,_0x31cd31,!![]);}catch(_0x9399ce){return BPromise[_0x8d5c('0x22')](_0x9399ce);}return _0x273cba[_0x8d5c('0x23')]();};}function saveUpdates(_0x28111e,_0x358b5b){return function(_0x2f7487){if(_0x2f7487){return _0x2f7487['update'](_0x28111e)[_0x8d5c('0x24')](function(_0x2c74ab){return _0x2c74ab;});}return null;};}function removeEntity(_0x4c0cdf,_0x251da8){return function(_0x3e7ed6){if(_0x3e7ed6){return _0x3e7ed6[_0x8d5c('0x25')]()[_0x8d5c('0x24')](function(){var _0x568bcf=_0x3e7ed6[_0x8d5c('0x26')]({'plain':!![]});var _0x22457f='Projects';return db['UserProfileResource'][_0x8d5c('0x25')]({'where':{'type':_0x22457f,'resourceId':_0x568bcf['id']}})[_0x8d5c('0x24')](function(){return _0x3e7ed6;});})['then'](function(){_0x4c0cdf['status'](0xcc)[_0x8d5c('0x1b')]();});}};}function handleEntityNotFound(_0x5ab95b,_0x5d40ba){return function(_0x20c2f3){if(!_0x20c2f3){_0x5ab95b[_0x8d5c('0x19')](0x194);}return _0x20c2f3;};}function handleError(_0x464907,_0x130af7){_0x130af7=_0x130af7||0x1f4;return function(_0xd060b1){logger[_0x8d5c('0x27')](_0xd060b1[_0x8d5c('0x28')]);if(_0xd060b1[_0x8d5c('0x29')]){delete _0xd060b1['name'];}_0x464907[_0x8d5c('0x1a')](_0x130af7)[_0x8d5c('0x2a')](_0xd060b1);};}exports[_0x8d5c('0x2b')]=function(_0x58feb4,_0xe7290){var _0x3116c5={},_0x3f9d1a={},_0x12377a={'count':0x0,'rows':[]};var _0xe20532=_[_0x8d5c('0x2c')](db[_0x8d5c('0x2d')][_0x8d5c('0x2e')],function(_0x37b9d0){return{'name':_0x37b9d0[_0x8d5c('0x2f')],'type':_0x37b9d0[_0x8d5c('0x30')][_0x8d5c('0x31')]};});_0x3f9d1a[_0x8d5c('0x32')]=_[_0x8d5c('0x2c')](_0xe20532,_0x8d5c('0x29'));_0x3f9d1a[_0x8d5c('0x33')]=_[_0x8d5c('0x34')](_0x58feb4[_0x8d5c('0x33')]);_0x3f9d1a['filters']=_['intersection'](_0x3f9d1a['model'],_0x3f9d1a['query']);_0x3116c5[_0x8d5c('0x35')]=_[_0x8d5c('0x36')](_0x3f9d1a[_0x8d5c('0x32')],qs['fields'](_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x37')]));_0x3116c5[_0x8d5c('0x35')]=_0x3116c5[_0x8d5c('0x35')]['length']?_0x3116c5[_0x8d5c('0x35')]:_0x3f9d1a['model'];if(!_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x38')]('nolimit')){_0x3116c5[_0x8d5c('0x39')]=qs[_0x8d5c('0x39')](_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x39')]);_0x3116c5[_0x8d5c('0x1f')]=qs[_0x8d5c('0x1f')](_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x1f')]);}_0x3116c5[_0x8d5c('0x3a')]=qs[_0x8d5c('0x3b')](_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x3b')]);_0x3116c5['where']=qs['filters'](_['pick'](_0x58feb4['query'],_0x3f9d1a['filters']),_0xe20532);if(_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x3c')]){_0x3116c5['where']=_[_0x8d5c('0x3d')](_0x3116c5[_0x8d5c('0x3e')],{'$or':_[_0x8d5c('0x2c')](_0xe20532,function(_0x365c1c){if(_0x365c1c[_0x8d5c('0x30')]!==_0x8d5c('0x3f')){var _0x4ca52d={};_0x4ca52d[_0x365c1c['name']]={'$like':'%'+_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x3c')]+'%'};return _0x4ca52d;}})});}_0x3116c5=_[_0x8d5c('0x3d')]({},_0x3116c5,_0x58feb4[_0x8d5c('0x40')]);var _0x2343c7={'where':_0x3116c5['where']};return db[_0x8d5c('0x2d')][_0x8d5c('0x1e')](_0x2343c7)[_0x8d5c('0x24')](function(_0x5943f2){_0x12377a['count']=_0x5943f2;if(_0x58feb4[_0x8d5c('0x33')][_0x8d5c('0x41')]){_0x3116c5[_0x8d5c('0x42')]=[{'all':!![]}];}return db[_0x8d5c('0x2d')]['findAll'](_0x3116c5);})['then'](function(_0x53b14c){_0x12377a['rows']=_0x53b14c;return _0x12377a;})[_0x8d5c('0x24')](respondWithFilteredResult(_0xe7290,_0x3116c5))[_0x8d5c('0x43')](handleError(_0xe7290,null));};exports[_0x8d5c('0x44')]=function(_0x3a129a,_0x404f75){var _0x13de8f={'raw':![],'where':{'id':_0x3a129a[_0x8d5c('0x45')]['id']}},_0x5a041d={};_0x5a041d[_0x8d5c('0x32')]=_[_0x8d5c('0x34')](db[_0x8d5c('0x2d')][_0x8d5c('0x2e')]);_0x5a041d[_0x8d5c('0x33')]=_[_0x8d5c('0x34')](_0x3a129a['query']);_0x5a041d[_0x8d5c('0x46')]=_[_0x8d5c('0x36')](_0x5a041d['model'],_0x5a041d[_0x8d5c('0x33')]);_0x13de8f['attributes']=_[_0x8d5c('0x36')](_0x5a041d[_0x8d5c('0x32')],qs[_0x8d5c('0x37')](_0x3a129a['query'][_0x8d5c('0x37')]));_0x13de8f[_0x8d5c('0x35')]=_0x13de8f[_0x8d5c('0x35')][_0x8d5c('0x47')]?_0x13de8f['attributes']:_0x5a041d['model'];if(_0x3a129a[_0x8d5c('0x33')][_0x8d5c('0x41')]){_0x13de8f['include']=[{'all':!![]}];}_0x13de8f=_[_0x8d5c('0x3d')]({},_0x13de8f,_0x3a129a[_0x8d5c('0x40')]);return db[_0x8d5c('0x2d')][_0x8d5c('0x48')](_0x13de8f)[_0x8d5c('0x24')](handleEntityNotFound(_0x404f75,null))['then'](respondWithResult(_0x404f75,null))[_0x8d5c('0x43')](handleError(_0x404f75,null));};exports[_0x8d5c('0x49')]=function(_0x2dfa25,_0x419d6a){return db[_0x8d5c('0x2d')][_0x8d5c('0x49')](_0x2dfa25[_0x8d5c('0x4a')],{})['then'](function(_0x35a3d){var _0x16930a=_0x2dfa25[_0x8d5c('0x4b')][_0x8d5c('0x26')]({'plain':!![]});if(!_0x16930a)throw new Error(_0x8d5c('0x4c'));if(_0x16930a[_0x8d5c('0x4d')]===_0x8d5c('0x4b')){var _0x190bdc=_0x35a3d[_0x8d5c('0x26')]({'plain':!![]});var _0xf39d50=_0x8d5c('0x4e');return db[_0x8d5c('0x4f')][_0x8d5c('0x48')]({'where':{'name':_0xf39d50,'userProfileId':_0x16930a['userProfileId']},'raw':!![]})[_0x8d5c('0x24')](function(_0x3d1430){if(_0x3d1430&&_0x3d1430[_0x8d5c('0x50')]===0x0){return db[_0x8d5c('0x51')]['create']({'name':_0x190bdc['name'],'resourceId':_0x190bdc['id'],'type':_0x3d1430[_0x8d5c('0x29')],'sectionId':_0x3d1430['id']},{})[_0x8d5c('0x24')](function(){return _0x35a3d;});}else{return _0x35a3d;}})[_0x8d5c('0x43')](function(_0x256091){logger['error'](_0x8d5c('0x52'),_0x256091);throw _0x256091;});}return _0x35a3d;})[_0x8d5c('0x24')](respondWithResult(_0x419d6a,0xc9))[_0x8d5c('0x43')](handleError(_0x419d6a,null));};exports[_0x8d5c('0x53')]=function(_0x45b470,_0x3dd48e){var _0x3d3b20={'where':{'id':_0x45b470[_0x8d5c('0x45')]['id']}},_0xcb19b2={};_0xcb19b2[_0x8d5c('0x32')]=_[_0x8d5c('0x34')](db[_0x8d5c('0x2d')][_0x8d5c('0x2e')]);_0x3d3b20[_0x8d5c('0x35')]=_[_0x8d5c('0x36')](_0xcb19b2[_0x8d5c('0x32')],qs[_0x8d5c('0x37')](_0x45b470[_0x8d5c('0x33')][_0x8d5c('0x37')]));_0x3d3b20['attributes']=_0x3d3b20['attributes'][_0x8d5c('0x47')]?_0x3d3b20[_0x8d5c('0x35')]:_0xcb19b2[_0x8d5c('0x32')];if(_0x45b470[_0x8d5c('0x33')][_0x8d5c('0x41')]){_0x3d3b20[_0x8d5c('0x42')]=[{'all':!![]}];}_0x3d3b20=_[_0x8d5c('0x3d')]({},_0x3d3b20,_0x45b470[_0x8d5c('0x40')]);return db[_0x8d5c('0x2d')][_0x8d5c('0x48')](_0x3d3b20)[_0x8d5c('0x24')](handleEntityNotFound(_0x3dd48e,null))[_0x8d5c('0x24')](function(_0x142d35){if(_0x142d35){var _0xe8a602=_0x142d35[_0x8d5c('0x26')]({'plain':!![]});_0xe8a602=qs[_0x8d5c('0x54')](_0xe8a602,['id',_0x8d5c('0x55'),_0x8d5c('0x56')]);_0x45b470[_0x8d5c('0x4a')]=_[_0x8d5c('0x54')](_0x45b470[_0x8d5c('0x4a')],['id','createdAt',_0x8d5c('0x56')]);return db['JscriptyProject'][_0x8d5c('0x49')](_[_0x8d5c('0x3d')](_0xe8a602,_0x45b470[_0x8d5c('0x4a')]),{'include':_0x45b470[_0x8d5c('0x33')][_0x8d5c('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x4efec4){var _0x93b50a=_0x45b470[_0x8d5c('0x4b')][_0x8d5c('0x26')]({'plain':!![]});if(!_0x93b50a)throw new Error(_0x8d5c('0x4c'));if(_0x93b50a['role']==='user'){var _0x238d9a=_0x4efec4[_0x8d5c('0x26')]({'plain':!![]});var _0x2e3e2d=_0x8d5c('0x4e');return db[_0x8d5c('0x4f')][_0x8d5c('0x48')]({'where':{'name':_0x2e3e2d,'userProfileId':_0x93b50a['userProfileId']},'raw':!![]})[_0x8d5c('0x24')](function(_0x220353){if(_0x220353&&_0x220353['autoAssociation']===0x0){return db[_0x8d5c('0x51')]['create']({'name':_0x238d9a[_0x8d5c('0x29')],'resourceId':_0x238d9a['id'],'type':_0x220353[_0x8d5c('0x29')],'sectionId':_0x220353['id']},{})[_0x8d5c('0x24')](function(){return _0x4efec4;});}else{return _0x4efec4;}})['catch'](function(_0x4e8858){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e8858);throw _0x4e8858;});}return _0x4efec4;});}})[_0x8d5c('0x24')](respondWithResult(_0x3dd48e,0xc9))[_0x8d5c('0x43')](handleError(_0x3dd48e,null));};exports[_0x8d5c('0x57')]=function(_0x7cd63d,_0x1a2fa5){if(_0x7cd63d[_0x8d5c('0x4a')]['id']){delete _0x7cd63d['body']['id'];}return db[_0x8d5c('0x2d')]['find']({'where':{'id':_0x7cd63d[_0x8d5c('0x45')]['id']}})[_0x8d5c('0x24')](handleEntityNotFound(_0x1a2fa5,null))[_0x8d5c('0x24')](saveUpdates(_0x7cd63d[_0x8d5c('0x4a')],null))[_0x8d5c('0x24')](respondWithResult(_0x1a2fa5,null))[_0x8d5c('0x43')](handleError(_0x1a2fa5,null));};exports[_0x8d5c('0x25')]=function(_0x58a377,_0x493941){return db[_0x8d5c('0x2d')][_0x8d5c('0x48')]({'where':{'id':_0x58a377[_0x8d5c('0x45')]['id']}})[_0x8d5c('0x24')](handleEntityNotFound(_0x493941,null))[_0x8d5c('0x24')](removeEntity(_0x493941,null))[_0x8d5c('0x43')](handleError(_0x493941,null));};exports[_0x8d5c('0x58')]=function(_0x5abe96,_0x1d145b,_0x46eb29){var _0x1bf198={'raw':!![],'where':{}};var _0x439826={};var _0x3afc6b={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8d5c('0x59')]({'where':{'id':_0x5abe96['params']['id']}})[_0x8d5c('0x24')](handleEntityNotFound(_0x1d145b,null))[_0x8d5c('0x24')](function(_0x43596a){if(_0x43596a){_0x439826[_0x8d5c('0x32')]=_[_0x8d5c('0x34')](db[_0x8d5c('0x5a')][_0x8d5c('0x2e')]);_0x439826[_0x8d5c('0x33')]=_[_0x8d5c('0x34')](_0x5abe96[_0x8d5c('0x33')]);_0x439826[_0x8d5c('0x46')]=_[_0x8d5c('0x36')](_0x439826[_0x8d5c('0x32')],_0x439826[_0x8d5c('0x33')]);_0x1bf198[_0x8d5c('0x35')]=_[_0x8d5c('0x36')](_0x439826['model'],qs[_0x8d5c('0x37')](_0x5abe96[_0x8d5c('0x33')]['fields']));_0x1bf198[_0x8d5c('0x35')]=_0x1bf198['attributes']['length']?_0x1bf198[_0x8d5c('0x35')]:_0x439826[_0x8d5c('0x32')];if(!_0x5abe96[_0x8d5c('0x33')][_0x8d5c('0x38')](_0x8d5c('0x5b'))){_0x1bf198['limit']=qs[_0x8d5c('0x39')](_0x5abe96[_0x8d5c('0x33')][_0x8d5c('0x39')]);_0x1bf198['offset']=qs[_0x8d5c('0x1f')](_0x5abe96[_0x8d5c('0x33')][_0x8d5c('0x1f')]);}_0x1bf198[_0x8d5c('0x3a')]=qs['sort'](_0x5abe96[_0x8d5c('0x33')][_0x8d5c('0x3b')]);_0x1bf198[_0x8d5c('0x3e')]=qs[_0x8d5c('0x46')](_[_0x8d5c('0x5c')](_0x5abe96[_0x8d5c('0x33')],_0x439826[_0x8d5c('0x46')]));_0x1bf198['where'][_0x8d5c('0x5d')]=_0x43596a['id'];if(_0x5abe96[_0x8d5c('0x33')][_0x8d5c('0x3c')]){_0x1bf198[_0x8d5c('0x3e')]=_[_0x8d5c('0x3d')](_0x1bf198[_0x8d5c('0x3e')],{'$or':_[_0x8d5c('0x2c')](_0x1bf198[_0x8d5c('0x35')],function(_0x54ec56){var _0x44946b={};_0x44946b[_0x54ec56]={'$like':'%'+_0x5abe96['query']['filter']+'%'};return _0x44946b;})});}_0x1bf198=_['merge']({},_0x1bf198,_0x5abe96[_0x8d5c('0x40')]);return db[_0x8d5c('0x5a')][_0x8d5c('0x1e')]({'where':_0x1bf198['where']})[_0x8d5c('0x24')](function(_0x5e86f5){_0x3afc6b[_0x8d5c('0x1e')]=_0x5e86f5;if(_0x5abe96['query'][_0x8d5c('0x41')]){_0x1bf198[_0x8d5c('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8d5c('0x5e')](_0x1bf198);})[_0x8d5c('0x24')](function(_0x463e95){_0x3afc6b[_0x8d5c('0x5f')]=_0x463e95;return _0x3afc6b;});}})[_0x8d5c('0x24')](respondWithFilteredResult(_0x1d145b,_0x1bf198))['catch'](handleError(_0x1d145b,null));};exports[_0x8d5c('0x60')]=function(_0x2514f1,_0xfc4a61,_0x317239){var _0x1952ab={'raw':!![],'where':{}};var _0x14ffec={};var _0x23dc38={'count':0x0,'rows':[]};return db[_0x8d5c('0x2d')][_0x8d5c('0x59')]({'where':{'id':_0x2514f1[_0x8d5c('0x45')]['id']}})[_0x8d5c('0x24')](handleEntityNotFound(_0xfc4a61,null))[_0x8d5c('0x24')](function(_0x3ea18c){if(_0x3ea18c){_0x14ffec['model']=_[_0x8d5c('0x34')](db['JscriptyAnswerReport'][_0x8d5c('0x2e')]);_0x14ffec[_0x8d5c('0x33')]=_[_0x8d5c('0x34')](_0x2514f1[_0x8d5c('0x33')]);_0x14ffec[_0x8d5c('0x46')]=_['intersection'](_0x14ffec[_0x8d5c('0x32')],_0x14ffec[_0x8d5c('0x33')]);_0x1952ab[_0x8d5c('0x35')]=_['intersection'](_0x14ffec[_0x8d5c('0x32')],qs['fields'](_0x2514f1['query'][_0x8d5c('0x37')]));_0x1952ab['attributes']=_0x1952ab[_0x8d5c('0x35')]['length']?_0x1952ab['attributes']:_0x14ffec['model'];if(!_0x2514f1[_0x8d5c('0x33')][_0x8d5c('0x38')](_0x8d5c('0x5b'))){_0x1952ab[_0x8d5c('0x39')]=qs[_0x8d5c('0x39')](_0x2514f1['query'][_0x8d5c('0x39')]);_0x1952ab[_0x8d5c('0x1f')]=qs[_0x8d5c('0x1f')](_0x2514f1[_0x8d5c('0x33')][_0x8d5c('0x1f')]);}_0x1952ab[_0x8d5c('0x3a')]=qs[_0x8d5c('0x3b')](_0x2514f1[_0x8d5c('0x33')][_0x8d5c('0x3b')]);_0x1952ab['where']=qs['filters'](_['pick'](_0x2514f1[_0x8d5c('0x33')],_0x14ffec['filters']));_0x1952ab['where'][_0x8d5c('0x5d')]=_0x3ea18c['id'];if(_0x2514f1[_0x8d5c('0x33')]['filter']){_0x1952ab[_0x8d5c('0x3e')]=_[_0x8d5c('0x3d')](_0x1952ab[_0x8d5c('0x3e')],{'$or':_[_0x8d5c('0x2c')](_0x1952ab[_0x8d5c('0x35')],function(_0x43a689){var _0x1fa505={};_0x1fa505[_0x43a689]={'$like':'%'+_0x2514f1[_0x8d5c('0x33')][_0x8d5c('0x3c')]+'%'};return _0x1fa505;})});}_0x1952ab=_[_0x8d5c('0x3d')]({},_0x1952ab,_0x2514f1[_0x8d5c('0x40')]);return db['JscriptyAnswerReport'][_0x8d5c('0x1e')]({'where':_0x1952ab[_0x8d5c('0x3e')]})[_0x8d5c('0x24')](function(_0x1fe8e4){_0x23dc38[_0x8d5c('0x1e')]=_0x1fe8e4;if(_0x2514f1[_0x8d5c('0x33')][_0x8d5c('0x41')]){_0x1952ab[_0x8d5c('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8d5c('0x5e')](_0x1952ab);})[_0x8d5c('0x24')](function(_0x27893a){_0x23dc38[_0x8d5c('0x5f')]=_0x27893a;return _0x23dc38;});}})['then'](respondWithFilteredResult(_0xfc4a61,_0x1952ab))['catch'](handleError(_0xfc4a61,null));};function char(_0x85f05c){return _0x8d5c('0x61')===typeof _0x85f05c?String[_0x8d5c('0x62')][_0x8d5c('0x21')](null,arguments):_0x85f05c;}function needsEncapsulation(_0x1852ca){return!!_0x1852ca&&(_0x1852ca['toString']()[_0x8d5c('0x63')](char(0xd))>=0x0||_0x1852ca[_0x8d5c('0x64')]()['indexOf'](char(0xa))>=0x0||_0x1852ca[_0x8d5c('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x1852ca[_0x8d5c('0x64')]()[_0x8d5c('0x63')](char(0x22))>=0x0);}function encapsulate(_0x1015aa){var _0x247c0e=char(0x22),_0x1aea50='\x5c'+char(0x22),_0x953cd6=_0x1015aa['toString']()[_0x8d5c('0x65')](new RegExp(_0x247c0e,'g'),_0x1aea50);return _0x247c0e+_0x953cd6+_0x247c0e;}exports[_0x8d5c('0x66')]=function(_0x1f2569,_0x38f04f,_0x8cad94){var _0x4a4b90,_0x1a401;var _0x2c55b6={'where':{'ProjectId':_0x1f2569[_0x8d5c('0x45')]['id']}};if(_0x1f2569[_0x8d5c('0x33')][_0x8d5c('0x67')]){_0x2c55b6[_0x8d5c('0x3e')]['starttime']=JSON[_0x8d5c('0x68')](_0x1f2569['query']['startTime']);}return db[_0x8d5c('0x5a')][_0x8d5c('0x5e')](_0x2c55b6)[_0x8d5c('0x24')](handleEntityNotFound(_0x38f04f,null))[_0x8d5c('0x24')](function(_0x3cbb82){if(_0x3cbb82){_0x4a4b90=_0x3cbb82;return db['JscriptyQuestionReport'][_0x8d5c('0x5e')]({'where':{'SessionId':{'$in':_[_0x8d5c('0x2c')](_0x4a4b90,'id')},'ProjectId':_0x1f2569[_0x8d5c('0x45')]['id']},'order':'-createdAt'});}})[_0x8d5c('0x24')](handleEntityNotFound(_0x38f04f,null))[_0x8d5c('0x24')](function(_0x389461){if(_0x389461){_0x1a401=_0x389461;var _0x364cad={};for(var _0x1fa809=0x0,_0x255081=_0x1a401[_0x8d5c('0x47')];_0x1fa809<_0x255081;_0x1fa809++){if(!_0x364cad[_0x8d5c('0x38')](_0x1a401[_0x1fa809][_0x8d5c('0x69')])){_0x364cad[_0x1a401[_0x1fa809][_0x8d5c('0x69')]]=needsEncapsulation(_0x1a401[_0x1fa809][_0x8d5c('0x6a')])?encapsulate(_0x1a401[_0x1fa809][_0x8d5c('0x6a')]):_0x1a401[_0x1fa809][_0x8d5c('0x6a')];}}var _0x329ba5=[],_0x3961d6={};for(var _0x27cfc9=0x0,_0x39b579=_0x4a4b90['length'];_0x27cfc9<_0x39b579;_0x27cfc9++){_0x3961d6={'ProjectId':_0x1f2569[_0x8d5c('0x45')]['id'],'SessionId':_0x4a4b90[_0x27cfc9]['id'],'StartTime':moment(_0x4a4b90[_0x27cfc9][_0x8d5c('0x6b')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1e267f=0x0,_0x29dce1=_0x1a401['length'];_0x1e267f<_0x29dce1;_0x1e267f++){if(_0x1a401[_0x1e267f][_0x8d5c('0x6c')]==_0x4a4b90[_0x27cfc9]['id']&&_0x364cad[_0x8d5c('0x38')](_0x1a401[_0x1e267f][_0x8d5c('0x69')])){_0x3961d6[_0x364cad[_0x1a401[_0x1e267f]['questionId']]]=_0x1a401[_0x1e267f][_0x8d5c('0x6d')];}}for(var _0x44de4e in _0x364cad){if(!_0x3961d6['hasOwnProperty'](_0x364cad[_0x44de4e])){_0x3961d6[_0x364cad[_0x44de4e]]=null;}}_0x329ba5['push'](_0x3961d6);}return _0x329ba5;}})[_0x8d5c('0x24')](function(_0x57bbd7){if(!_['isEmpty'](_0x57bbd7)){var _0x5d32aa=toCsv(_0x57bbd7);var _0x5cef71=Date[_0x8d5c('0x6e')]();fs[_0x8d5c('0x6f')](util[_0x8d5c('0x70')](_0x8d5c('0x71'),_0x1f2569[_0x8d5c('0x45')]['id'],_0x5cef71),_0x5d32aa);_0x38f04f['setHeader']('Content-disposition',_0x8d5c('0x72')+util[_0x8d5c('0x70')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f2569['params']['id'],_0x5cef71));_0x38f04f['setHeader'](_0x8d5c('0x73'),'text/csv');return _0x38f04f[_0x8d5c('0x74')](util[_0x8d5c('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f2569[_0x8d5c('0x45')]['id'],_0x5cef71));}else{return _0x38f04f[_0x8d5c('0x19')](0xcc);}})[_0x8d5c('0x43')](handleError(_0x38f04f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e5c7551..793d91b 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 _0xb5bb=['jscripty_projects','lodash','util','../../config/logger','moment','bluebird','JscriptyProject'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x5b49b8,_0x5e5ea8){_0x5b49b8=_0x5b49b8-0x0;var _0x3d01e7=_0xb5bb[_0x5b49b8];return _0x3d01e7;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var logger=require(_0xbb5b('0x2'))('api');var moment=require(_0xbb5b('0x3'));var BPromise=require(_0xbb5b('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('./jscriptyProject.attributes');module['exports']=function(_0x1c9622,_0x161047){return _0x1c9622['define'](_0xbb5b('0x5'),attributes,{'tableName':_0xbb5b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8585=['JscriptyProject','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./jscriptyProject.attributes','define'];(function(_0x636f40,_0x8db93c){var _0x5a1e9c=function(_0x3bd569){while(--_0x3bd569){_0x636f40['push'](_0x636f40['shift']());}};_0x5a1e9c(++_0x8db93c);}(_0x8585,0x64));var _0x5858=function(_0x3a8e5d,_0x1a5682){_0x3a8e5d=_0x3a8e5d-0x0;var _0x21788f=_0x8585[_0x3a8e5d];return _0x21788f;};'use strict';var _=require(_0x5858('0x0'));var util=require(_0x5858('0x1'));var logger=require(_0x5858('0x2'))('api');var moment=require(_0x5858('0x3'));var BPromise=require(_0x5858('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5858('0x5'));var attributes=require(_0x5858('0x6'));module['exports']=function(_0x5807a2,_0x35b37a){return _0x5807a2[_0x5858('0x7')](_0x5858('0x8'),attributes,{'tableName':'jscripty_projects','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 995278b..9b355ec 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(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2ff875,_0x5949ad){_0x2ff875=_0x2ff875-0x0;var _0x5caf7b=_0xf4eb[_0x2ff875];return _0x5caf7b;};'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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4ef53a,_0x2ca55f){var _0x5ab10a=function(_0x2a12f4){while(--_0x2a12f4){_0x4ef53a['push'](_0x4ef53a['shift']());}};_0x5ab10a(++_0x2ca55f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x238bd6,_0x45d046){_0x238bd6=_0x238bd6-0x0;var _0x45c4eb=_0xb43b[_0x238bd6];return _0x45c4eb;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0598d30..5ab9c67 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 _0x095c=['Router','fs-extra','../../components/auth/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x31f36c,_0x456b86){var _0x2558ff=function(_0x2487c9){while(--_0x2487c9){_0x31f36c['push'](_0x31f36c['shift']());}};_0x2558ff(++_0x456b86);}(_0x095c,0x19d));var _0xc095=function(_0x197b49,_0x11db75){_0x197b49=_0x197b49-0x0;var _0x529f3c=_0x095c[_0x197b49];return _0x529f3c;};'use strict';var multer=require(_0xc095('0x0'));var util=require(_0xc095('0x1'));var path=require(_0xc095('0x2'));var timeout=require(_0xc095('0x3'));var express=require(_0xc095('0x4'));var router=express[_0xc095('0x5')]();var fs_extra=require(_0xc095('0x6'));var auth=require(_0xc095('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc095('0x8'));router[_0xc095('0x9')]('/',auth[_0xc095('0xa')](),controller[_0xc095('0xb')]);router[_0xc095('0x9')](_0xc095('0xc'),auth[_0xc095('0xa')](),controller[_0xc095('0xd')]);router[_0xc095('0x9')](_0xc095('0xe'),auth['isAuthenticated'](),controller[_0xc095('0xf')]);router[_0xc095('0x10')]('/',auth[_0xc095('0xa')](),controller[_0xc095('0x11')]);router['put'](_0xc095('0xe'),auth[_0xc095('0xa')](),controller[_0xc095('0x12')]);router[_0xc095('0x13')]('/:id',auth[_0xc095('0xa')](),controller[_0xc095('0x14')]);module[_0xc095('0x15')]=router; \ No newline at end of file +var _0x31a7=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports'];(function(_0x3ea392,_0x59d098){var _0x160ddf=function(_0x24664a){while(--_0x24664a){_0x3ea392['push'](_0x3ea392['shift']());}};_0x160ddf(++_0x59d098);}(_0x31a7,0x17a));var _0x731a=function(_0x3c4dfe,_0x5543f2){_0x3c4dfe=_0x3c4dfe-0x0;var _0xa28d66=_0x31a7[_0x3c4dfe];return _0xa28d66;};'use strict';var multer=require(_0x731a('0x0'));var util=require(_0x731a('0x1'));var path=require('path');var timeout=require(_0x731a('0x2'));var express=require(_0x731a('0x3'));var router=express[_0x731a('0x4')]();var fs_extra=require(_0x731a('0x5'));var auth=require(_0x731a('0x6'));var interaction=require(_0x731a('0x7'));var config=require(_0x731a('0x8'));var controller=require(_0x731a('0x9'));router[_0x731a('0xa')]('/',auth[_0x731a('0xb')](),controller[_0x731a('0xc')]);router['get'](_0x731a('0xd'),auth[_0x731a('0xb')](),controller[_0x731a('0xe')]);router['get'](_0x731a('0xf'),auth[_0x731a('0xb')](),controller['show']);router[_0x731a('0x10')]('/',auth['isAuthenticated'](),controller[_0x731a('0x11')]);router['put']('/:id',auth[_0x731a('0xb')](),controller['update']);router[_0x731a('0x12')](_0x731a('0xf'),auth[_0x731a('0xb')](),controller[_0x731a('0x13')]);module[_0x731a('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d1bdedb..863b4e6 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9f5a,_0x3ec023){_0x3f9f5a=_0x3f9f5a-0x0;var _0x40a030=_0x7a54[_0x3f9f5a];return _0x40a030;};'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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x4e1559,_0x560587){_0x4e1559=_0x4e1559-0x0;var _0x461c6b=_0x7a54[_0x4e1559];return _0x461c6b;};'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 55e7b5c..71773eb 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 _0x50b3=['path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util'];(function(_0x1d97d8,_0x34a42b){var _0x198b15=function(_0x3a84ef){while(--_0x3a84ef){_0x1d97d8['push'](_0x1d97d8['shift']());}};_0x198b15(++_0x34a42b);}(_0x50b3,0x1dd));var _0x350b=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x50b3[_0x24697b];return _0x585b99;};'use strict';var emlformat=require(_0x350b('0x0'));var rimraf=require(_0x350b('0x1'));var zipdir=require(_0x350b('0x2'));var jsonpatch=require(_0x350b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x350b('0x4'));var Mustache=require('mustache');var util=require(_0x350b('0x5'));var path=require(_0x350b('0x6'));var sox=require(_0x350b('0x7'));var csv=require('to-csv');var ejs=require(_0x350b('0x8'));var fs=require('fs');var fs_extra=require(_0x350b('0x9'));var _=require(_0x350b('0xa'));var squel=require('squel');var crypto=require(_0x350b('0xb'));var jsforce=require(_0x350b('0xc'));var deskjs=require(_0x350b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x350b('0xe'));var Papa=require(_0x350b('0xf'));var Redis=require(_0x350b('0x10'));var authService=require(_0x350b('0x11'));var qs=require(_0x350b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x350b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x350b('0x14'));var config=require(_0x350b('0x15'));var licenseUtil=require(_0x350b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f02f,_0x29d2c7){_0x29d2c7=_0x29d2c7||0xcc;return function(_0xeeb236){if(_0xeeb236){return _0x59f02f['sendStatus'](_0x29d2c7);}return _0x59f02f['status'](_0x29d2c7)[_0x350b('0x17')]();};}function respondWithResult(_0x2e7aa2,_0x16273d){_0x16273d=_0x16273d||0xc8;return function(_0x351cc3){if(_0x351cc3){return _0x2e7aa2[_0x350b('0x18')](_0x16273d)[_0x350b('0x19')](_0x351cc3);}};}function respondWithFilteredResult(_0x4c2360,_0x53dbfc){return function(_0x3cffc6){if(_0x3cffc6){var _0x3417f9=typeof _0x53dbfc[_0x350b('0x1a')]===_0x350b('0x1b')&&typeof _0x53dbfc[_0x350b('0x1c')]==='undefined';var _0x839c2c=_0x3cffc6['count'];var _0x5f103c=_0x3417f9?0x0:_0x53dbfc[_0x350b('0x1a')];var _0x32ad60=_0x3417f9?_0x3cffc6[_0x350b('0x1d')]:_0x53dbfc['offset']+_0x53dbfc['limit'];var _0x4d1da5;if(_0x32ad60>=_0x839c2c){_0x32ad60=_0x839c2c;_0x4d1da5=0xc8;}else{_0x4d1da5=0xce;}_0x4c2360['status'](_0x4d1da5);return _0x4c2360[_0x350b('0x1e')](_0x350b('0x1f'),_0x5f103c+'-'+_0x32ad60+'/'+_0x839c2c)[_0x350b('0x19')](_0x3cffc6);}return null;};}function patchUpdates(_0x34d5b8){return function(_0x50f89c){try{jsonpatch['apply'](_0x50f89c,_0x34d5b8,!![]);}catch(_0x153448){return BPromise[_0x350b('0x20')](_0x153448);}return _0x50f89c[_0x350b('0x21')]();};}function saveUpdates(_0x7955a5,_0x157c86){return function(_0x1b088b){if(_0x1b088b){return _0x1b088b[_0x350b('0x22')](_0x7955a5)[_0x350b('0x23')](function(_0xb74e10){return _0xb74e10;});}return null;};}function removeEntity(_0xe66a28,_0x3a8b74){return function(_0xd2c3bf){if(_0xd2c3bf){return _0xd2c3bf[_0x350b('0x24')]()[_0x350b('0x23')](function(){_0xe66a28[_0x350b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230f09,_0x4cd093){return function(_0x307a5a){if(!_0x307a5a){_0x230f09['sendStatus'](0x194);}return _0x307a5a;};}function handleError(_0x482748,_0x39ed73){_0x39ed73=_0x39ed73||0x1f4;return function(_0x3d0db8){logger['error'](_0x3d0db8['stack']);if(_0x3d0db8[_0x350b('0x25')]){delete _0x3d0db8[_0x350b('0x25')];}_0x482748[_0x350b('0x18')](_0x39ed73)[_0x350b('0x26')](_0x3d0db8);};}exports['index']=function(_0x3450fe,_0x31fed5){var _0x1a44eb={},_0x238390={},_0x21585c={'count':0x0,'rows':[]};var _0x4ec6d2=_['map'](db[_0x350b('0x27')][_0x350b('0x28')],function(_0x18f848){return{'name':_0x18f848[_0x350b('0x29')],'type':_0x18f848['type'][_0x350b('0x2a')]};});_0x238390[_0x350b('0x2b')]=_['map'](_0x4ec6d2,_0x350b('0x25'));_0x238390[_0x350b('0x2c')]=_[_0x350b('0x2d')](_0x3450fe[_0x350b('0x2c')]);_0x238390[_0x350b('0x2e')]=_[_0x350b('0x2f')](_0x238390[_0x350b('0x2b')],_0x238390[_0x350b('0x2c')]);_0x1a44eb['attributes']=_['intersection'](_0x238390[_0x350b('0x2b')],qs[_0x350b('0x30')](_0x3450fe[_0x350b('0x2c')][_0x350b('0x30')]));_0x1a44eb[_0x350b('0x31')]=_0x1a44eb[_0x350b('0x31')][_0x350b('0x32')]?_0x1a44eb[_0x350b('0x31')]:_0x238390['model'];if(!_0x3450fe['query'][_0x350b('0x33')](_0x350b('0x34'))){_0x1a44eb[_0x350b('0x1c')]=qs['limit'](_0x3450fe['query'][_0x350b('0x1c')]);_0x1a44eb[_0x350b('0x1a')]=qs[_0x350b('0x1a')](_0x3450fe[_0x350b('0x2c')][_0x350b('0x1a')]);}_0x1a44eb['order']=qs[_0x350b('0x35')](_0x3450fe['query'][_0x350b('0x35')]);_0x1a44eb[_0x350b('0x36')]=qs['filters'](_[_0x350b('0x37')](_0x3450fe[_0x350b('0x2c')],_0x238390[_0x350b('0x2e')]),_0x4ec6d2);if(_0x3450fe[_0x350b('0x2c')][_0x350b('0x38')]){_0x1a44eb['where']=_[_0x350b('0x39')](_0x1a44eb[_0x350b('0x36')],{'$or':_['map'](_0x4ec6d2,function(_0x55565d){if(_0x55565d['type']!==_0x350b('0x3a')){var _0x178517={};_0x178517[_0x55565d[_0x350b('0x25')]]={'$like':'%'+_0x3450fe[_0x350b('0x2c')][_0x350b('0x38')]+'%'};return _0x178517;}})});}_0x1a44eb=_[_0x350b('0x39')]({},_0x1a44eb,_0x3450fe[_0x350b('0x3b')]);var _0x3c8f8e={'where':_0x1a44eb[_0x350b('0x36')]};return db[_0x350b('0x27')][_0x350b('0x1d')](_0x3c8f8e)[_0x350b('0x23')](function(_0x5e33c6){_0x21585c[_0x350b('0x1d')]=_0x5e33c6;if(_0x3450fe[_0x350b('0x2c')][_0x350b('0x3c')]){_0x1a44eb['include']=[{'all':!![]}];}return db[_0x350b('0x27')][_0x350b('0x3d')](_0x1a44eb);})[_0x350b('0x23')](function(_0x3f5f59){_0x21585c['rows']=_0x3f5f59;return _0x21585c;})['then'](respondWithFilteredResult(_0x31fed5,_0x1a44eb))[_0x350b('0x3e')](handleError(_0x31fed5,null));};exports[_0x350b('0x3f')]=function(_0x35263f,_0x17335c){var _0xe7cbc3={'raw':!![],'where':{'id':_0x35263f[_0x350b('0x40')]['id']}},_0x254b23={};_0x254b23[_0x350b('0x2b')]=_['keys'](db['JscriptyQuestionReport'][_0x350b('0x28')]);_0x254b23['query']=_[_0x350b('0x2d')](_0x35263f['query']);_0x254b23[_0x350b('0x2e')]=_['intersection'](_0x254b23[_0x350b('0x2b')],_0x254b23[_0x350b('0x2c')]);_0xe7cbc3['attributes']=_[_0x350b('0x2f')](_0x254b23[_0x350b('0x2b')],qs['fields'](_0x35263f[_0x350b('0x2c')]['fields']));_0xe7cbc3[_0x350b('0x31')]=_0xe7cbc3[_0x350b('0x31')][_0x350b('0x32')]?_0xe7cbc3[_0x350b('0x31')]:_0x254b23['model'];if(_0x35263f['query'][_0x350b('0x3c')]){_0xe7cbc3['include']=[{'all':!![]}];}_0xe7cbc3=_[_0x350b('0x39')]({},_0xe7cbc3,_0x35263f[_0x350b('0x3b')]);return db[_0x350b('0x27')]['find'](_0xe7cbc3)[_0x350b('0x23')](handleEntityNotFound(_0x17335c,null))[_0x350b('0x23')](respondWithResult(_0x17335c,null))[_0x350b('0x3e')](handleError(_0x17335c,null));};exports['create']=function(_0x4c7626,_0x2b5922){return db['JscriptyQuestionReport'][_0x350b('0x41')](_0x4c7626[_0x350b('0x42')],{})['then'](respondWithResult(_0x2b5922,0xc9))[_0x350b('0x3e')](handleError(_0x2b5922,null));};exports[_0x350b('0x22')]=function(_0x1e9158,_0x5df648){if(_0x1e9158[_0x350b('0x42')]['id']){delete _0x1e9158['body']['id'];}return db[_0x350b('0x27')][_0x350b('0x43')]({'where':{'id':_0x1e9158[_0x350b('0x40')]['id']}})[_0x350b('0x23')](handleEntityNotFound(_0x5df648,null))[_0x350b('0x23')](saveUpdates(_0x1e9158[_0x350b('0x42')],null))[_0x350b('0x23')](respondWithResult(_0x5df648,null))['catch'](handleError(_0x5df648,null));};exports[_0x350b('0x24')]=function(_0x2559e9,_0x4db074){return db[_0x350b('0x27')]['find']({'where':{'id':_0x2559e9[_0x350b('0x40')]['id']}})[_0x350b('0x23')](handleEntityNotFound(_0x4db074,null))['then'](removeEntity(_0x4db074,null))[_0x350b('0x3e')](handleError(_0x4db074,null));};exports[_0x350b('0x44')]=function(_0xaa9376,_0x1e3677){return db[_0x350b('0x27')][_0x350b('0x44')]()[_0x350b('0x23')](respondWithResult(_0x1e3677,null))[_0x350b('0x3e')](handleError(_0x1e3677,null));}; \ No newline at end of file +var _0x60f7=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','model','query','filters','intersection'];(function(_0x6ec118,_0x5def42){var _0x18f67c=function(_0x574378){while(--_0x574378){_0x6ec118['push'](_0x6ec118['shift']());}};_0x18f67c(++_0x5def42);}(_0x60f7,0xf2));var _0x760f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x60f7[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x760f('0x0'));var rimraf=require(_0x760f('0x1'));var zipdir=require(_0x760f('0x2'));var jsonpatch=require(_0x760f('0x3'));var rp=require('request-promise');var moment=require(_0x760f('0x4'));var BPromise=require(_0x760f('0x5'));var Mustache=require('mustache');var util=require(_0x760f('0x6'));var path=require(_0x760f('0x7'));var sox=require(_0x760f('0x8'));var csv=require(_0x760f('0x9'));var ejs=require(_0x760f('0xa'));var fs=require('fs');var fs_extra=require(_0x760f('0xb'));var _=require(_0x760f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x760f('0xd'));var deskjs=require(_0x760f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x760f('0xf'));var Papa=require(_0x760f('0x10'));var Redis=require(_0x760f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x760f('0x12'));var as=require(_0x760f('0x13'));var hardwareService=require(_0x760f('0x14'));var logger=require(_0x760f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x760f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x760f('0x17'))['db'];function respondWithStatusCode(_0x213881,_0x1606a9){_0x1606a9=_0x1606a9||0xcc;return function(_0x248913){if(_0x248913){return _0x213881[_0x760f('0x18')](_0x1606a9);}return _0x213881[_0x760f('0x19')](_0x1606a9)[_0x760f('0x1a')]();};}function respondWithResult(_0x13a907,_0x2f9f26){_0x2f9f26=_0x2f9f26||0xc8;return function(_0x1909a5){if(_0x1909a5){return _0x13a907[_0x760f('0x19')](_0x2f9f26)[_0x760f('0x1b')](_0x1909a5);}};}function respondWithFilteredResult(_0x56fa22,_0x33f26c){return function(_0x19e9a4){if(_0x19e9a4){var _0x36cfb2=typeof _0x33f26c[_0x760f('0x1c')]==='undefined'&&typeof _0x33f26c[_0x760f('0x1d')]==='undefined';var _0x4acf38=_0x19e9a4[_0x760f('0x1e')];var _0x491c7a=_0x36cfb2?0x0:_0x33f26c['offset'];var _0x2994db=_0x36cfb2?_0x19e9a4['count']:_0x33f26c[_0x760f('0x1c')]+_0x33f26c[_0x760f('0x1d')];var _0x46a7d4;if(_0x2994db>=_0x4acf38){_0x2994db=_0x4acf38;_0x46a7d4=0xc8;}else{_0x46a7d4=0xce;}_0x56fa22[_0x760f('0x19')](_0x46a7d4);return _0x56fa22[_0x760f('0x1f')](_0x760f('0x20'),_0x491c7a+'-'+_0x2994db+'/'+_0x4acf38)[_0x760f('0x1b')](_0x19e9a4);}return null;};}function patchUpdates(_0x531fd7){return function(_0x476315){try{jsonpatch[_0x760f('0x21')](_0x476315,_0x531fd7,!![]);}catch(_0x448694){return BPromise[_0x760f('0x22')](_0x448694);}return _0x476315['save']();};}function saveUpdates(_0x3a5a38,_0x5d04bd){return function(_0x16b5cd){if(_0x16b5cd){return _0x16b5cd[_0x760f('0x23')](_0x3a5a38)[_0x760f('0x24')](function(_0xc05048){return _0xc05048;});}return null;};}function removeEntity(_0x25398b,_0x5836d9){return function(_0x713f2e){if(_0x713f2e){return _0x713f2e[_0x760f('0x25')]()[_0x760f('0x24')](function(){_0x25398b[_0x760f('0x19')](0xcc)[_0x760f('0x1a')]();});}};}function handleEntityNotFound(_0x58bfae,_0x4464d4){return function(_0x2a6ccb){if(!_0x2a6ccb){_0x58bfae['sendStatus'](0x194);}return _0x2a6ccb;};}function handleError(_0x4e05f1,_0x59ba6f){_0x59ba6f=_0x59ba6f||0x1f4;return function(_0x1790f0){logger[_0x760f('0x26')](_0x1790f0[_0x760f('0x27')]);if(_0x1790f0[_0x760f('0x28')]){delete _0x1790f0[_0x760f('0x28')];}_0x4e05f1[_0x760f('0x19')](_0x59ba6f)[_0x760f('0x29')](_0x1790f0);};}exports[_0x760f('0x2a')]=function(_0x51cb09,_0x70e253){var _0x4f3f8c={},_0x1c18bd={},_0xbe7ae6={'count':0x0,'rows':[]};var _0x4e88e0=_[_0x760f('0x2b')](db[_0x760f('0x2c')]['rawAttributes'],function(_0x120b17){return{'name':_0x120b17[_0x760f('0x2d')],'type':_0x120b17['type']['key']};});_0x1c18bd[_0x760f('0x2e')]=_[_0x760f('0x2b')](_0x4e88e0,_0x760f('0x28'));_0x1c18bd['query']=_['keys'](_0x51cb09[_0x760f('0x2f')]);_0x1c18bd[_0x760f('0x30')]=_[_0x760f('0x31')](_0x1c18bd[_0x760f('0x2e')],_0x1c18bd['query']);_0x4f3f8c[_0x760f('0x32')]=_[_0x760f('0x31')](_0x1c18bd[_0x760f('0x2e')],qs[_0x760f('0x33')](_0x51cb09['query'][_0x760f('0x33')]));_0x4f3f8c[_0x760f('0x32')]=_0x4f3f8c[_0x760f('0x32')][_0x760f('0x34')]?_0x4f3f8c[_0x760f('0x32')]:_0x1c18bd[_0x760f('0x2e')];if(!_0x51cb09['query'][_0x760f('0x35')](_0x760f('0x36'))){_0x4f3f8c[_0x760f('0x1d')]=qs['limit'](_0x51cb09[_0x760f('0x2f')]['limit']);_0x4f3f8c[_0x760f('0x1c')]=qs[_0x760f('0x1c')](_0x51cb09[_0x760f('0x2f')][_0x760f('0x1c')]);}_0x4f3f8c['order']=qs[_0x760f('0x37')](_0x51cb09[_0x760f('0x2f')][_0x760f('0x37')]);_0x4f3f8c[_0x760f('0x38')]=qs[_0x760f('0x30')](_['pick'](_0x51cb09[_0x760f('0x2f')],_0x1c18bd[_0x760f('0x30')]),_0x4e88e0);if(_0x51cb09['query'][_0x760f('0x39')]){_0x4f3f8c[_0x760f('0x38')]=_['merge'](_0x4f3f8c[_0x760f('0x38')],{'$or':_[_0x760f('0x2b')](_0x4e88e0,function(_0x2043c2){if(_0x2043c2[_0x760f('0x3a')]!==_0x760f('0x3b')){var _0x53d087={};_0x53d087[_0x2043c2['name']]={'$like':'%'+_0x51cb09[_0x760f('0x2f')][_0x760f('0x39')]+'%'};return _0x53d087;}})});}_0x4f3f8c=_[_0x760f('0x3c')]({},_0x4f3f8c,_0x51cb09[_0x760f('0x3d')]);var _0x1aa092={'where':_0x4f3f8c[_0x760f('0x38')]};return db[_0x760f('0x2c')][_0x760f('0x1e')](_0x1aa092)[_0x760f('0x24')](function(_0x3d0012){_0xbe7ae6['count']=_0x3d0012;if(_0x51cb09[_0x760f('0x2f')][_0x760f('0x3e')]){_0x4f3f8c['include']=[{'all':!![]}];}return db[_0x760f('0x2c')][_0x760f('0x3f')](_0x4f3f8c);})['then'](function(_0x49d9b4){_0xbe7ae6['rows']=_0x49d9b4;return _0xbe7ae6;})['then'](respondWithFilteredResult(_0x70e253,_0x4f3f8c))[_0x760f('0x40')](handleError(_0x70e253,null));};exports[_0x760f('0x41')]=function(_0x1a2940,_0x441ee0){var _0x4c8f64={'raw':!![],'where':{'id':_0x1a2940[_0x760f('0x42')]['id']}},_0x5d611f={};_0x5d611f['model']=_[_0x760f('0x43')](db[_0x760f('0x2c')]['rawAttributes']);_0x5d611f[_0x760f('0x2f')]=_[_0x760f('0x43')](_0x1a2940['query']);_0x5d611f['filters']=_[_0x760f('0x31')](_0x5d611f[_0x760f('0x2e')],_0x5d611f['query']);_0x4c8f64['attributes']=_['intersection'](_0x5d611f['model'],qs[_0x760f('0x33')](_0x1a2940['query'][_0x760f('0x33')]));_0x4c8f64[_0x760f('0x32')]=_0x4c8f64['attributes'][_0x760f('0x34')]?_0x4c8f64[_0x760f('0x32')]:_0x5d611f[_0x760f('0x2e')];if(_0x1a2940[_0x760f('0x2f')][_0x760f('0x3e')]){_0x4c8f64[_0x760f('0x44')]=[{'all':!![]}];}_0x4c8f64=_[_0x760f('0x3c')]({},_0x4c8f64,_0x1a2940[_0x760f('0x3d')]);return db[_0x760f('0x2c')]['find'](_0x4c8f64)[_0x760f('0x24')](handleEntityNotFound(_0x441ee0,null))[_0x760f('0x24')](respondWithResult(_0x441ee0,null))['catch'](handleError(_0x441ee0,null));};exports['create']=function(_0x351ff3,_0x474ec3){return db[_0x760f('0x2c')][_0x760f('0x45')](_0x351ff3[_0x760f('0x46')],{})['then'](respondWithResult(_0x474ec3,0xc9))[_0x760f('0x40')](handleError(_0x474ec3,null));};exports[_0x760f('0x23')]=function(_0x2494a9,_0x40598d){if(_0x2494a9[_0x760f('0x46')]['id']){delete _0x2494a9[_0x760f('0x46')]['id'];}return db[_0x760f('0x2c')][_0x760f('0x47')]({'where':{'id':_0x2494a9[_0x760f('0x42')]['id']}})['then'](handleEntityNotFound(_0x40598d,null))['then'](saveUpdates(_0x2494a9[_0x760f('0x46')],null))[_0x760f('0x24')](respondWithResult(_0x40598d,null))[_0x760f('0x40')](handleError(_0x40598d,null));};exports['destroy']=function(_0x43b43c,_0x2c1f4a){return db[_0x760f('0x2c')][_0x760f('0x47')]({'where':{'id':_0x43b43c[_0x760f('0x42')]['id']}})[_0x760f('0x24')](handleEntityNotFound(_0x2c1f4a,null))['then'](removeEntity(_0x2c1f4a,null))[_0x760f('0x40')](handleError(_0x2c1f4a,null));};exports[_0x760f('0x48')]=function(_0x4c4d70,_0x25b70a){return db[_0x760f('0x2c')][_0x760f('0x48')]()[_0x760f('0x24')](respondWithResult(_0x25b70a,null))[_0x760f('0x40')](handleError(_0x25b70a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 128551f..27e36c7 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 _0x5eeb=['util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x5eeb,0x172));var _0xb5ee=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5eeb[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0xb5ee('0x0'));var logger=require(_0xb5ee('0x1'))(_0xb5ee('0x2'));var moment=require(_0xb5ee('0x3'));var BPromise=require(_0xb5ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5ee('0x5'));var rimraf=require(_0xb5ee('0x6'));var config=require('../../config/environment');var attributes=require(_0xb5ee('0x7'));module['exports']=function(_0xb9117e,_0x520456){return _0xb9117e['define'](_0xb5ee('0x8'),attributes,{'tableName':_0xb5ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ba8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x15d965,_0x3469d6){var _0x7243d=function(_0x53e782){while(--_0x53e782){_0x15d965['push'](_0x15d965['shift']());}};_0x7243d(++_0x3469d6);}(_0x2ba8,0xe9));var _0x82ba=function(_0x344110,_0x373ee3){_0x344110=_0x344110-0x0;var _0x14a81e=_0x2ba8[_0x344110];return _0x14a81e;};'use strict';var _=require(_0x82ba('0x0'));var util=require(_0x82ba('0x1'));var logger=require(_0x82ba('0x2'))(_0x82ba('0x3'));var moment=require(_0x82ba('0x4'));var BPromise=require('bluebird');var rp=require(_0x82ba('0x5'));var fs=require('fs');var path=require(_0x82ba('0x6'));var rimraf=require(_0x82ba('0x7'));var config=require(_0x82ba('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x82ba('0x9')]=function(_0x13ae8c,_0x1c4366){return _0x13ae8c[_0x82ba('0xa')](_0x82ba('0xb'),attributes,{'tableName':_0x82ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 83b7b23..241833e 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 _0x33a1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0x33a1,0xc5));var _0x133a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x33a1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x133a('0x0'));var moment=require('moment');var BPromise=require(_0x133a('0x1'));var rs=require(_0x133a('0x2'));var fs=require('fs');var Redis=require(_0x133a('0x3'));var db=require(_0x133a('0x4'))['db'];var utils=require(_0x133a('0x5'));var logger=require('../../config/logger')(_0x133a('0x6'));var config=require(_0x133a('0x7'));var jayson=require(_0x133a('0x8'));var client=jayson['client'][_0x133a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa2fbd6,_0xdf987,_0x599dc8){return new BPromise(function(_0x145b31,_0x42bf6f){return client[_0x133a('0xa')](_0xa2fbd6,_0x599dc8)['then'](function(_0x5f5117){logger[_0x133a('0xb')](_0x133a('0xc'),_0xdf987,_0x133a('0xd'));logger[_0x133a('0xe')](_0x133a('0xf'),_0xdf987,'request\x20sent',JSON[_0x133a('0x10')](_0x5f5117));if(_0x5f5117['error']){if(_0x5f5117[_0x133a('0x11')][_0x133a('0x12')]===0x1f4){logger['error'](_0x133a('0xc'),_0xdf987,_0x5f5117[_0x133a('0x11')][_0x133a('0x13')]);return _0x42bf6f(_0x5f5117[_0x133a('0x11')][_0x133a('0x13')]);}logger[_0x133a('0x11')](_0x133a('0xc'),_0xdf987,_0x5f5117[_0x133a('0x11')][_0x133a('0x13')]);return _0x145b31(_0x5f5117['error'][_0x133a('0x13')]);}else{logger['info'](_0x133a('0xc'),_0xdf987,_0x133a('0xd'));_0x145b31(_0x5f5117[_0x133a('0x14')][_0x133a('0x13')]);}})[_0x133a('0x15')](function(_0x76b137){logger[_0x133a('0x11')](_0x133a('0xc'),_0xdf987,_0x76b137);_0x42bf6f(_0x76b137);});});} \ No newline at end of file +var _0x02d6=['then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x5137cb,_0x5f54f4){var _0x1ee70d=function(_0x2891b9){while(--_0x2891b9){_0x5137cb['push'](_0x5137cb['shift']());}};_0x1ee70d(++_0x5f54f4);}(_0x02d6,0x1ef));var _0x602d=function(_0x6a555d,_0x57335f){_0x6a555d=_0x6a555d-0x0;var _0x28020b=_0x02d6[_0x6a555d];return _0x28020b;};'use strict';var _=require(_0x602d('0x0'));var util=require('util');var moment=require(_0x602d('0x1'));var BPromise=require(_0x602d('0x2'));var rs=require(_0x602d('0x3'));var fs=require('fs');var Redis=require(_0x602d('0x4'));var db=require(_0x602d('0x5'))['db'];var utils=require(_0x602d('0x6'));var logger=require(_0x602d('0x7'))(_0x602d('0x8'));var config=require('../../config/environment');var jayson=require(_0x602d('0x9'));var client=jayson['client'][_0x602d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2438bc,_0x38fcc5,_0x3cfe72){return new BPromise(function(_0x1aceb7,_0x1f0ca1){return client['request'](_0x2438bc,_0x3cfe72)[_0x602d('0xb')](function(_0x256da5){logger['info'](_0x602d('0xc'),_0x38fcc5,_0x602d('0xd'));logger[_0x602d('0xe')](_0x602d('0xf'),_0x38fcc5,_0x602d('0xd'),JSON[_0x602d('0x10')](_0x256da5));if(_0x256da5[_0x602d('0x11')]){if(_0x256da5[_0x602d('0x11')][_0x602d('0x12')]===0x1f4){logger[_0x602d('0x11')](_0x602d('0xc'),_0x38fcc5,_0x256da5[_0x602d('0x11')]['message']);return _0x1f0ca1(_0x256da5[_0x602d('0x11')][_0x602d('0x13')]);}logger[_0x602d('0x11')](_0x602d('0xc'),_0x38fcc5,_0x256da5[_0x602d('0x11')]['message']);return _0x1aceb7(_0x256da5[_0x602d('0x11')][_0x602d('0x13')]);}else{logger[_0x602d('0x14')](_0x602d('0xc'),_0x38fcc5,_0x602d('0xd'));_0x1aceb7(_0x256da5[_0x602d('0x15')][_0x602d('0x13')]);}})[_0x602d('0x16')](function(_0x16a1ad){logger['error'](_0x602d('0xc'),_0x38fcc5,_0x16a1ad);_0x1f0ca1(_0x16a1ad);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9bc5655..88c90c6 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 _0xad04=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','util','path','express'];(function(_0xdae156,_0x5d30d2){var _0x16f0a1=function(_0x4634d6){while(--_0x4634d6){_0xdae156['push'](_0xdae156['shift']());}};_0x16f0a1(++_0x5d30d2);}(_0xad04,0x1c5));var _0x4ad0=function(_0x2066e4,_0x493a08){_0x2066e4=_0x2066e4-0x0;var _0x24c3d1=_0xad04[_0x2066e4];return _0x24c3d1;};'use strict';var multer=require('multer');var util=require(_0x4ad0('0x0'));var path=require(_0x4ad0('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ad0('0x2'));var router=express['Router']();var fs_extra=require(_0x4ad0('0x3'));var auth=require(_0x4ad0('0x4'));var interaction=require(_0x4ad0('0x5'));var config=require(_0x4ad0('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4ad0('0x7')]);router['get'](_0x4ad0('0x8'),auth[_0x4ad0('0x9')](),controller['describe']);router[_0x4ad0('0xa')](_0x4ad0('0xb'),auth[_0x4ad0('0x9')](),controller[_0x4ad0('0xc')]);router[_0x4ad0('0xa')]('/:id/questions',auth[_0x4ad0('0x9')](),controller['getQuestions']);router[_0x4ad0('0xd')]('/',auth[_0x4ad0('0x9')](),controller[_0x4ad0('0xe')]);router[_0x4ad0('0xf')]('/:id',auth[_0x4ad0('0x9')](),controller[_0x4ad0('0x10')]);router[_0x4ad0('0x11')]('/:id',auth[_0x4ad0('0x9')](),controller[_0x4ad0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4b16=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a89bb,_0x7e902e){var _0x3807e7=function(_0x92ede7){while(--_0x92ede7){_0x4a89bb['push'](_0x4a89bb['shift']());}};_0x3807e7(++_0x7e902e);}(_0x4b16,0x125));var _0x64b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b16[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x64b1('0x0'));var util=require(_0x64b1('0x1'));var path=require('path');var timeout=require(_0x64b1('0x2'));var express=require(_0x64b1('0x3'));var router=express[_0x64b1('0x4')]();var fs_extra=require(_0x64b1('0x5'));var auth=require(_0x64b1('0x6'));var interaction=require(_0x64b1('0x7'));var config=require(_0x64b1('0x8'));var controller=require(_0x64b1('0x9'));router[_0x64b1('0xa')]('/',auth['isAuthenticated'](),controller[_0x64b1('0xb')]);router[_0x64b1('0xa')](_0x64b1('0xc'),auth[_0x64b1('0xd')](),controller[_0x64b1('0xe')]);router[_0x64b1('0xa')](_0x64b1('0xf'),auth[_0x64b1('0xd')](),controller[_0x64b1('0x10')]);router['get'](_0x64b1('0x11'),auth[_0x64b1('0xd')](),controller['getQuestions']);router[_0x64b1('0x12')]('/',auth[_0x64b1('0xd')](),controller[_0x64b1('0x13')]);router[_0x64b1('0x14')](_0x64b1('0xf'),auth['isAuthenticated'](),controller[_0x64b1('0x15')]);router[_0x64b1('0x16')](_0x64b1('0xf'),auth['isAuthenticated'](),controller[_0x64b1('0x17')]);module[_0x64b1('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9fea75e..52886b6 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 _0xd0d8=['DATE','setDataValue','starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x16af02,_0x57b8ab){var _0x2e43c1=function(_0x31c7b4){while(--_0x31c7b4){_0x16af02['push'](_0x16af02['shift']());}};_0x2e43c1(++_0x57b8ab);}(_0xd0d8,0xa7));var _0x8d0d=function(_0xc67084,_0x3e2efc){_0xc67084=_0xc67084-0x0;var _0x4d06c6=_0xd0d8[_0xc67084];return _0x4d06c6;};'use strict';var moment=require(_0x8d0d('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x8d0d('0x1')],'set':function(_0x4692c8){this[_0x8d0d('0x2')](_0x8d0d('0x3'),_0x4692c8);this[_0x8d0d('0x2')]('endtime',moment()['format'](_0x8d0d('0x4')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x8d0d('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8d0d('0x5')]},'calleridnum':{'type':Sequelize[_0x8d0d('0x5')]},'completed':{'type':Sequelize[_0x8d0d('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4a2=['DATE','STRING','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x28c109,_0x493acd){var _0x43a714=function(_0x4400b6){while(--_0x4400b6){_0x28c109['push'](_0x28c109['shift']());}};_0x43a714(++_0x493acd);}(_0xe4a2,0x161));var _0x2e4a=function(_0x598cf9,_0x51bb48){_0x598cf9=_0x598cf9-0x0;var _0x5180d6=_0xe4a2[_0x598cf9];return _0x5180d6;};'use strict';var moment=require('moment');var Sequelize=require(_0x2e4a('0x0'));module[_0x2e4a('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x41f755){this[_0x2e4a('0x2')](_0x2e4a('0x3'),_0x41f755);this[_0x2e4a('0x2')](_0x2e4a('0x4'),moment()[_0x2e4a('0x5')](_0x2e4a('0x6')));}},'endtime':{'type':Sequelize[_0x2e4a('0x7')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2e4a('0x8')]},'queue':{'type':Sequelize[_0x2e4a('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2e4a('0x8')]},'calleridnum':{'type':Sequelize[_0x2e4a('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9dd4e57..c76ad77 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 _0x5396=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','map','JscriptySessionReport','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','SessionId','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x10baba,_0x4d446c){var _0x3c4758=function(_0x279700){while(--_0x279700){_0x10baba['push'](_0x10baba['shift']());}};_0x3c4758(++_0x4d446c);}(_0x5396,0x134));var _0x6539=function(_0x541bba,_0x11e6ce){_0x541bba=_0x541bba-0x0;var _0x17967a=_0x5396[_0x541bba];return _0x17967a;};'use strict';var emlformat=require(_0x6539('0x0'));var rimraf=require(_0x6539('0x1'));var zipdir=require(_0x6539('0x2'));var jsonpatch=require(_0x6539('0x3'));var rp=require(_0x6539('0x4'));var moment=require(_0x6539('0x5'));var BPromise=require(_0x6539('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6539('0x7'));var csv=require(_0x6539('0x8'));var ejs=require(_0x6539('0x9'));var fs=require('fs');var fs_extra=require(_0x6539('0xa'));var _=require(_0x6539('0xb'));var squel=require(_0x6539('0xc'));var crypto=require(_0x6539('0xd'));var jsforce=require(_0x6539('0xe'));var deskjs=require(_0x6539('0xf'));var toCsv=require(_0x6539('0x8'));var querystring=require(_0x6539('0x10'));var Papa=require(_0x6539('0x11'));var Redis=require(_0x6539('0x12'));var authService=require(_0x6539('0x13'));var qs=require(_0x6539('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6539('0x15'));var logger=require(_0x6539('0x16'))(_0x6539('0x17'));var utils=require(_0x6539('0x18'));var config=require(_0x6539('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470294,_0x438312){_0x438312=_0x438312||0xcc;return function(_0x50bb16){if(_0x50bb16){return _0x470294[_0x6539('0x1a')](_0x438312);}return _0x470294[_0x6539('0x1b')](_0x438312)[_0x6539('0x1c')]();};}function respondWithResult(_0x350825,_0x30da5a){_0x30da5a=_0x30da5a||0xc8;return function(_0x53d548){if(_0x53d548){return _0x350825[_0x6539('0x1b')](_0x30da5a)[_0x6539('0x1d')](_0x53d548);}};}function respondWithFilteredResult(_0x3c5c1f,_0x588588){return function(_0x2292cb){if(_0x2292cb){var _0x7eec14=typeof _0x588588[_0x6539('0x1e')]===_0x6539('0x1f')&&typeof _0x588588[_0x6539('0x20')]==='undefined';var _0x1a32a2=_0x2292cb[_0x6539('0x21')];var _0x559a9e=_0x7eec14?0x0:_0x588588[_0x6539('0x1e')];var _0x1b774e=_0x7eec14?_0x2292cb[_0x6539('0x21')]:_0x588588[_0x6539('0x1e')]+_0x588588['limit'];var _0x288d13;if(_0x1b774e>=_0x1a32a2){_0x1b774e=_0x1a32a2;_0x288d13=0xc8;}else{_0x288d13=0xce;}_0x3c5c1f['status'](_0x288d13);return _0x3c5c1f[_0x6539('0x22')](_0x6539('0x23'),_0x559a9e+'-'+_0x1b774e+'/'+_0x1a32a2)[_0x6539('0x1d')](_0x2292cb);}return null;};}function patchUpdates(_0x5f2023){return function(_0x450502){try{jsonpatch[_0x6539('0x24')](_0x450502,_0x5f2023,!![]);}catch(_0x1d6e2a){return BPromise['reject'](_0x1d6e2a);}return _0x450502['save']();};}function saveUpdates(_0x2b3409,_0x303c14){return function(_0x4cc0f9){if(_0x4cc0f9){return _0x4cc0f9['update'](_0x2b3409)[_0x6539('0x25')](function(_0x2ff82e){return _0x2ff82e;});}return null;};}function removeEntity(_0x3546f3,_0x23c065){return function(_0x55d113){if(_0x55d113){return _0x55d113[_0x6539('0x26')]()[_0x6539('0x25')](function(){_0x3546f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x886fdd,_0x577b30){return function(_0x3c5fad){if(!_0x3c5fad){_0x886fdd[_0x6539('0x1a')](0x194);}return _0x3c5fad;};}function handleError(_0x4a7d17,_0x5c1b68){_0x5c1b68=_0x5c1b68||0x1f4;return function(_0x54b51f){logger[_0x6539('0x27')](_0x54b51f[_0x6539('0x28')]);if(_0x54b51f[_0x6539('0x29')]){delete _0x54b51f[_0x6539('0x29')];}_0x4a7d17[_0x6539('0x1b')](_0x5c1b68)['send'](_0x54b51f);};}exports['index']=function(_0x11eb71,_0x1805d4){var _0x3f05cf={},_0x5f3df2={},_0x23f1ce={'count':0x0,'rows':[]};var _0x478e82=_[_0x6539('0x2a')](db[_0x6539('0x2b')]['rawAttributes'],function(_0x97f996){return{'name':_0x97f996[_0x6539('0x2c')],'type':_0x97f996[_0x6539('0x2d')][_0x6539('0x2e')]};});_0x5f3df2[_0x6539('0x2f')]=_[_0x6539('0x2a')](_0x478e82,'name');_0x5f3df2[_0x6539('0x30')]=_['keys'](_0x11eb71['query']);_0x5f3df2[_0x6539('0x31')]=_['intersection'](_0x5f3df2[_0x6539('0x2f')],_0x5f3df2[_0x6539('0x30')]);_0x3f05cf['attributes']=_['intersection'](_0x5f3df2[_0x6539('0x2f')],qs[_0x6539('0x32')](_0x11eb71['query'][_0x6539('0x32')]));_0x3f05cf[_0x6539('0x33')]=_0x3f05cf[_0x6539('0x33')][_0x6539('0x34')]?_0x3f05cf[_0x6539('0x33')]:_0x5f3df2[_0x6539('0x2f')];if(!_0x11eb71['query'][_0x6539('0x35')](_0x6539('0x36'))){_0x3f05cf['limit']=qs['limit'](_0x11eb71['query'][_0x6539('0x20')]);_0x3f05cf['offset']=qs[_0x6539('0x1e')](_0x11eb71[_0x6539('0x30')][_0x6539('0x1e')]);}_0x3f05cf[_0x6539('0x37')]=qs[_0x6539('0x38')](_0x11eb71[_0x6539('0x30')][_0x6539('0x38')]);_0x3f05cf[_0x6539('0x39')]=qs[_0x6539('0x31')](_[_0x6539('0x3a')](_0x11eb71[_0x6539('0x30')],_0x5f3df2[_0x6539('0x31')]),_0x478e82);if(_0x11eb71['query']['filter']){_0x3f05cf[_0x6539('0x39')]=_[_0x6539('0x3b')](_0x3f05cf[_0x6539('0x39')],{'$or':_[_0x6539('0x2a')](_0x478e82,function(_0x21d680){if(_0x21d680[_0x6539('0x2d')]!==_0x6539('0x3c')){var _0x25247c={};_0x25247c[_0x21d680[_0x6539('0x29')]]={'$like':'%'+_0x11eb71[_0x6539('0x30')]['filter']+'%'};return _0x25247c;}})});}_0x3f05cf=_['merge']({},_0x3f05cf,_0x11eb71['options']);var _0x7b9cf0={'where':_0x3f05cf[_0x6539('0x39')]};return db[_0x6539('0x2b')][_0x6539('0x21')](_0x7b9cf0)[_0x6539('0x25')](function(_0x52ee18){_0x23f1ce[_0x6539('0x21')]=_0x52ee18;if(_0x11eb71['query'][_0x6539('0x3d')]){_0x3f05cf[_0x6539('0x3e')]=[{'all':!![]}];}return db[_0x6539('0x2b')][_0x6539('0x3f')](_0x3f05cf);})[_0x6539('0x25')](function(_0x18b6af){_0x23f1ce[_0x6539('0x40')]=_0x18b6af;return _0x23f1ce;})[_0x6539('0x25')](respondWithFilteredResult(_0x1805d4,_0x3f05cf))[_0x6539('0x41')](handleError(_0x1805d4,null));};exports[_0x6539('0x42')]=function(_0x325283,_0x581d91){var _0x2773b0={'raw':!![],'where':{'id':_0x325283[_0x6539('0x43')]['id']}},_0x5599ad={};_0x5599ad[_0x6539('0x2f')]=_[_0x6539('0x44')](db[_0x6539('0x2b')]['rawAttributes']);_0x5599ad[_0x6539('0x30')]=_[_0x6539('0x44')](_0x325283[_0x6539('0x30')]);_0x5599ad[_0x6539('0x31')]=_['intersection'](_0x5599ad['model'],_0x5599ad[_0x6539('0x30')]);_0x2773b0[_0x6539('0x33')]=_[_0x6539('0x45')](_0x5599ad[_0x6539('0x2f')],qs[_0x6539('0x32')](_0x325283[_0x6539('0x30')]['fields']));_0x2773b0[_0x6539('0x33')]=_0x2773b0[_0x6539('0x33')][_0x6539('0x34')]?_0x2773b0[_0x6539('0x33')]:_0x5599ad[_0x6539('0x2f')];if(_0x325283[_0x6539('0x30')][_0x6539('0x3d')]){_0x2773b0[_0x6539('0x3e')]=[{'all':!![]}];}_0x2773b0=_[_0x6539('0x3b')]({},_0x2773b0,_0x325283[_0x6539('0x46')]);return db[_0x6539('0x2b')][_0x6539('0x47')](_0x2773b0)['then'](handleEntityNotFound(_0x581d91,null))[_0x6539('0x25')](respondWithResult(_0x581d91,null))[_0x6539('0x41')](handleError(_0x581d91,null));};exports['create']=function(_0x45b298,_0x2563f4){return db[_0x6539('0x2b')][_0x6539('0x48')](_0x45b298[_0x6539('0x49')],{})['then'](respondWithResult(_0x2563f4,0xc9))[_0x6539('0x41')](handleError(_0x2563f4,null));};exports[_0x6539('0x4a')]=function(_0x5adb41,_0x4db337){if(_0x5adb41[_0x6539('0x49')]['id']){delete _0x5adb41[_0x6539('0x49')]['id'];}return db[_0x6539('0x2b')]['find']({'where':{'id':_0x5adb41[_0x6539('0x43')]['id']}})[_0x6539('0x25')](handleEntityNotFound(_0x4db337,null))[_0x6539('0x25')](saveUpdates(_0x5adb41[_0x6539('0x49')],null))[_0x6539('0x25')](respondWithResult(_0x4db337,null))[_0x6539('0x41')](handleError(_0x4db337,null));};exports['destroy']=function(_0x3ec975,_0x32d468){return db[_0x6539('0x2b')]['find']({'where':{'id':_0x3ec975[_0x6539('0x43')]['id']}})['then'](handleEntityNotFound(_0x32d468,null))[_0x6539('0x25')](removeEntity(_0x32d468,null))['catch'](handleError(_0x32d468,null));};exports['describe']=function(_0x37432d,_0x49b7c0){return db['JscriptySessionReport'][_0x6539('0x4b')]()[_0x6539('0x25')](respondWithResult(_0x49b7c0,null))[_0x6539('0x41')](handleError(_0x49b7c0,null));};exports[_0x6539('0x4c')]=function(_0x5bc29c,_0x493e7f,_0x2b5fdc){var _0x5a6d44={'raw':!![],'where':{}};var _0x4d022a={};var _0x2cbe10={'count':0x0,'rows':[]};return db[_0x6539('0x2b')][_0x6539('0x4d')]({'where':{'id':_0x5bc29c[_0x6539('0x43')]['id']}})[_0x6539('0x25')](handleEntityNotFound(_0x493e7f,null))['then'](function(_0x4722df){if(_0x4722df){_0x4d022a[_0x6539('0x2f')]=_[_0x6539('0x44')](db[_0x6539('0x4e')][_0x6539('0x4f')]);_0x4d022a['query']=_[_0x6539('0x44')](_0x5bc29c[_0x6539('0x30')]);_0x4d022a[_0x6539('0x31')]=_[_0x6539('0x45')](_0x4d022a[_0x6539('0x2f')],_0x4d022a[_0x6539('0x30')]);_0x5a6d44[_0x6539('0x33')]=_['intersection'](_0x4d022a[_0x6539('0x2f')],qs[_0x6539('0x32')](_0x5bc29c[_0x6539('0x30')][_0x6539('0x32')]));_0x5a6d44[_0x6539('0x33')]=_0x5a6d44[_0x6539('0x33')]['length']?_0x5a6d44[_0x6539('0x33')]:_0x4d022a[_0x6539('0x2f')];if(!_0x5bc29c[_0x6539('0x30')][_0x6539('0x35')](_0x6539('0x36'))){_0x5a6d44[_0x6539('0x20')]=qs[_0x6539('0x20')](_0x5bc29c[_0x6539('0x30')][_0x6539('0x20')]);_0x5a6d44[_0x6539('0x1e')]=qs['offset'](_0x5bc29c[_0x6539('0x30')][_0x6539('0x1e')]);}_0x5a6d44['order']=qs[_0x6539('0x38')](_0x5bc29c[_0x6539('0x30')][_0x6539('0x38')]);_0x5a6d44['where']=qs[_0x6539('0x31')](_[_0x6539('0x3a')](_0x5bc29c[_0x6539('0x30')],_0x4d022a['filters']));_0x5a6d44[_0x6539('0x39')][_0x6539('0x50')]=_0x4722df['id'];if(_0x5bc29c[_0x6539('0x30')]['filter']){_0x5a6d44[_0x6539('0x39')]=_['merge'](_0x5a6d44[_0x6539('0x39')],{'$or':_[_0x6539('0x2a')](_0x5a6d44[_0x6539('0x33')],function(_0x462361){var _0x388e1c={};_0x388e1c[_0x462361]={'$like':'%'+_0x5bc29c['query'][_0x6539('0x51')]+'%'};return _0x388e1c;})});}_0x5a6d44=_['merge']({},_0x5a6d44,_0x5bc29c[_0x6539('0x46')]);return db[_0x6539('0x4e')][_0x6539('0x21')]({'where':_0x5a6d44[_0x6539('0x39')]})[_0x6539('0x25')](function(_0x5422b6){_0x2cbe10[_0x6539('0x21')]=_0x5422b6;if(_0x5bc29c[_0x6539('0x30')][_0x6539('0x3d')]){_0x5a6d44[_0x6539('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x5a6d44);})[_0x6539('0x25')](function(_0x2d8ece){_0x2cbe10['rows']=_0x2d8ece;return _0x2cbe10;});}})[_0x6539('0x25')](respondWithFilteredResult(_0x493e7f,_0x5a6d44))[_0x6539('0x41')](handleError(_0x493e7f,null));}; \ No newline at end of file +var _0xffb9=['filter','VIRTUAL','merge','options','includeAll','include','rows','params','catch','create','body','find','describe','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x482feb,_0x1774da){var _0x130282=function(_0x1544e6){while(--_0x1544e6){_0x482feb['push'](_0x482feb['shift']());}};_0x130282(++_0x1774da);}(_0xffb9,0xa9));var _0x9ffb=function(_0x5f012b,_0x35fc89){_0x5f012b=_0x5f012b-0x0;var _0x26faf3=_0xffb9[_0x5f012b];return _0x26faf3;};'use strict';var emlformat=require(_0x9ffb('0x0'));var rimraf=require(_0x9ffb('0x1'));var zipdir=require(_0x9ffb('0x2'));var jsonpatch=require(_0x9ffb('0x3'));var rp=require('request-promise');var moment=require(_0x9ffb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9ffb('0x5'));var path=require(_0x9ffb('0x6'));var sox=require(_0x9ffb('0x7'));var csv=require('to-csv');var ejs=require(_0x9ffb('0x8'));var fs=require('fs');var fs_extra=require(_0x9ffb('0x9'));var _=require(_0x9ffb('0xa'));var squel=require('squel');var crypto=require(_0x9ffb('0xb'));var jsforce=require(_0x9ffb('0xc'));var deskjs=require(_0x9ffb('0xd'));var toCsv=require(_0x9ffb('0xe'));var querystring=require('querystring');var Papa=require(_0x9ffb('0xf'));var Redis=require('ioredis');var authService=require(_0x9ffb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ffb('0x11'))(_0x9ffb('0x12'));var utils=require(_0x9ffb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9ffb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448747,_0x77fee5){_0x77fee5=_0x77fee5||0xcc;return function(_0x103b3a){if(_0x103b3a){return _0x448747[_0x9ffb('0x15')](_0x77fee5);}return _0x448747['status'](_0x77fee5)[_0x9ffb('0x16')]();};}function respondWithResult(_0x46d432,_0x122473){_0x122473=_0x122473||0xc8;return function(_0x192f40){if(_0x192f40){return _0x46d432['status'](_0x122473)[_0x9ffb('0x17')](_0x192f40);}};}function respondWithFilteredResult(_0x2e3249,_0x38a6c6){return function(_0x3fa7e9){if(_0x3fa7e9){var _0x735553=typeof _0x38a6c6[_0x9ffb('0x18')]===_0x9ffb('0x19')&&typeof _0x38a6c6['limit']==='undefined';var _0x3194c7=_0x3fa7e9[_0x9ffb('0x1a')];var _0x1f2e0e=_0x735553?0x0:_0x38a6c6[_0x9ffb('0x18')];var _0x4581ef=_0x735553?_0x3fa7e9[_0x9ffb('0x1a')]:_0x38a6c6[_0x9ffb('0x18')]+_0x38a6c6['limit'];var _0x314413;if(_0x4581ef>=_0x3194c7){_0x4581ef=_0x3194c7;_0x314413=0xc8;}else{_0x314413=0xce;}_0x2e3249[_0x9ffb('0x1b')](_0x314413);return _0x2e3249['set'](_0x9ffb('0x1c'),_0x1f2e0e+'-'+_0x4581ef+'/'+_0x3194c7)[_0x9ffb('0x17')](_0x3fa7e9);}return null;};}function patchUpdates(_0x5b5d16){return function(_0x412690){try{jsonpatch[_0x9ffb('0x1d')](_0x412690,_0x5b5d16,!![]);}catch(_0x6d2799){return BPromise[_0x9ffb('0x1e')](_0x6d2799);}return _0x412690[_0x9ffb('0x1f')]();};}function saveUpdates(_0x396040,_0xa8bf82){return function(_0x2a92db){if(_0x2a92db){return _0x2a92db[_0x9ffb('0x20')](_0x396040)['then'](function(_0x2abdb7){return _0x2abdb7;});}return null;};}function removeEntity(_0x519938,_0x51f685){return function(_0x432e72){if(_0x432e72){return _0x432e72[_0x9ffb('0x21')]()[_0x9ffb('0x22')](function(){_0x519938[_0x9ffb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273194,_0x532f04){return function(_0x5758b4){if(!_0x5758b4){_0x273194[_0x9ffb('0x15')](0x194);}return _0x5758b4;};}function handleError(_0x5684b8,_0x2f7c74){_0x2f7c74=_0x2f7c74||0x1f4;return function(_0x4a8dfd){logger['error'](_0x4a8dfd['stack']);if(_0x4a8dfd[_0x9ffb('0x23')]){delete _0x4a8dfd['name'];}_0x5684b8[_0x9ffb('0x1b')](_0x2f7c74)[_0x9ffb('0x24')](_0x4a8dfd);};}exports[_0x9ffb('0x25')]=function(_0x1e3fa3,_0x5d2108){var _0x1a084a={},_0xd04973={},_0x389fb4={'count':0x0,'rows':[]};var _0x2cc2f5=_[_0x9ffb('0x26')](db[_0x9ffb('0x27')][_0x9ffb('0x28')],function(_0x26c7ae){return{'name':_0x26c7ae[_0x9ffb('0x29')],'type':_0x26c7ae[_0x9ffb('0x2a')][_0x9ffb('0x2b')]};});_0xd04973[_0x9ffb('0x2c')]=_['map'](_0x2cc2f5,_0x9ffb('0x23'));_0xd04973[_0x9ffb('0x2d')]=_[_0x9ffb('0x2e')](_0x1e3fa3[_0x9ffb('0x2d')]);_0xd04973[_0x9ffb('0x2f')]=_['intersection'](_0xd04973['model'],_0xd04973[_0x9ffb('0x2d')]);_0x1a084a[_0x9ffb('0x30')]=_[_0x9ffb('0x31')](_0xd04973[_0x9ffb('0x2c')],qs[_0x9ffb('0x32')](_0x1e3fa3['query'][_0x9ffb('0x32')]));_0x1a084a[_0x9ffb('0x30')]=_0x1a084a[_0x9ffb('0x30')][_0x9ffb('0x33')]?_0x1a084a[_0x9ffb('0x30')]:_0xd04973[_0x9ffb('0x2c')];if(!_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x34')](_0x9ffb('0x35'))){_0x1a084a[_0x9ffb('0x36')]=qs['limit'](_0x1e3fa3['query']['limit']);_0x1a084a['offset']=qs[_0x9ffb('0x18')](_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x18')]);}_0x1a084a[_0x9ffb('0x37')]=qs['sort'](_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x38')]);_0x1a084a[_0x9ffb('0x39')]=qs[_0x9ffb('0x2f')](_[_0x9ffb('0x3a')](_0x1e3fa3[_0x9ffb('0x2d')],_0xd04973[_0x9ffb('0x2f')]),_0x2cc2f5);if(_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x3b')]){_0x1a084a['where']=_['merge'](_0x1a084a['where'],{'$or':_[_0x9ffb('0x26')](_0x2cc2f5,function(_0x5a7b7b){if(_0x5a7b7b[_0x9ffb('0x2a')]!==_0x9ffb('0x3c')){var _0x53ffb4={};_0x53ffb4[_0x5a7b7b[_0x9ffb('0x23')]]={'$like':'%'+_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x3b')]+'%'};return _0x53ffb4;}})});}_0x1a084a=_[_0x9ffb('0x3d')]({},_0x1a084a,_0x1e3fa3[_0x9ffb('0x3e')]);var _0xdb60ed={'where':_0x1a084a[_0x9ffb('0x39')]};return db[_0x9ffb('0x27')][_0x9ffb('0x1a')](_0xdb60ed)[_0x9ffb('0x22')](function(_0x3632b1){_0x389fb4[_0x9ffb('0x1a')]=_0x3632b1;if(_0x1e3fa3[_0x9ffb('0x2d')][_0x9ffb('0x3f')]){_0x1a084a[_0x9ffb('0x40')]=[{'all':!![]}];}return db[_0x9ffb('0x27')]['findAll'](_0x1a084a);})[_0x9ffb('0x22')](function(_0x421739){_0x389fb4[_0x9ffb('0x41')]=_0x421739;return _0x389fb4;})[_0x9ffb('0x22')](respondWithFilteredResult(_0x5d2108,_0x1a084a))['catch'](handleError(_0x5d2108,null));};exports['show']=function(_0x4306de,_0x194fc0){var _0x605a31={'raw':!![],'where':{'id':_0x4306de[_0x9ffb('0x42')]['id']}},_0x58c52f={};_0x58c52f[_0x9ffb('0x2c')]=_['keys'](db[_0x9ffb('0x27')][_0x9ffb('0x28')]);_0x58c52f[_0x9ffb('0x2d')]=_['keys'](_0x4306de['query']);_0x58c52f[_0x9ffb('0x2f')]=_[_0x9ffb('0x31')](_0x58c52f[_0x9ffb('0x2c')],_0x58c52f[_0x9ffb('0x2d')]);_0x605a31[_0x9ffb('0x30')]=_[_0x9ffb('0x31')](_0x58c52f['model'],qs[_0x9ffb('0x32')](_0x4306de[_0x9ffb('0x2d')][_0x9ffb('0x32')]));_0x605a31['attributes']=_0x605a31[_0x9ffb('0x30')][_0x9ffb('0x33')]?_0x605a31['attributes']:_0x58c52f[_0x9ffb('0x2c')];if(_0x4306de[_0x9ffb('0x2d')][_0x9ffb('0x3f')]){_0x605a31['include']=[{'all':!![]}];}_0x605a31=_[_0x9ffb('0x3d')]({},_0x605a31,_0x4306de[_0x9ffb('0x3e')]);return db[_0x9ffb('0x27')]['find'](_0x605a31)[_0x9ffb('0x22')](handleEntityNotFound(_0x194fc0,null))[_0x9ffb('0x22')](respondWithResult(_0x194fc0,null))[_0x9ffb('0x43')](handleError(_0x194fc0,null));};exports[_0x9ffb('0x44')]=function(_0x1ad17f,_0x8800b9){return db[_0x9ffb('0x27')][_0x9ffb('0x44')](_0x1ad17f['body'],{})[_0x9ffb('0x22')](respondWithResult(_0x8800b9,0xc9))[_0x9ffb('0x43')](handleError(_0x8800b9,null));};exports[_0x9ffb('0x20')]=function(_0x36a56c,_0x8f93af){if(_0x36a56c['body']['id']){delete _0x36a56c[_0x9ffb('0x45')]['id'];}return db[_0x9ffb('0x27')][_0x9ffb('0x46')]({'where':{'id':_0x36a56c[_0x9ffb('0x42')]['id']}})[_0x9ffb('0x22')](handleEntityNotFound(_0x8f93af,null))['then'](saveUpdates(_0x36a56c[_0x9ffb('0x45')],null))['then'](respondWithResult(_0x8f93af,null))[_0x9ffb('0x43')](handleError(_0x8f93af,null));};exports[_0x9ffb('0x21')]=function(_0x5c381b,_0x3cd4ec){return db[_0x9ffb('0x27')][_0x9ffb('0x46')]({'where':{'id':_0x5c381b['params']['id']}})['then'](handleEntityNotFound(_0x3cd4ec,null))[_0x9ffb('0x22')](removeEntity(_0x3cd4ec,null))[_0x9ffb('0x43')](handleError(_0x3cd4ec,null));};exports[_0x9ffb('0x47')]=function(_0x4b7364,_0x55d0e8){return db[_0x9ffb('0x27')]['describe']()[_0x9ffb('0x22')](respondWithResult(_0x55d0e8,null))[_0x9ffb('0x43')](handleError(_0x55d0e8,null));};exports['getQuestions']=function(_0x2d99b6,_0x222ba2,_0x1a1996){var _0x9a63={'raw':!![],'where':{}};var _0x5c9975={};var _0x418608={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x9ffb('0x48')]({'where':{'id':_0x2d99b6[_0x9ffb('0x42')]['id']}})[_0x9ffb('0x22')](handleEntityNotFound(_0x222ba2,null))[_0x9ffb('0x22')](function(_0x3ffcb0){if(_0x3ffcb0){_0x5c9975['model']=_['keys'](db[_0x9ffb('0x49')][_0x9ffb('0x28')]);_0x5c9975[_0x9ffb('0x2d')]=_[_0x9ffb('0x2e')](_0x2d99b6['query']);_0x5c9975[_0x9ffb('0x2f')]=_[_0x9ffb('0x31')](_0x5c9975['model'],_0x5c9975['query']);_0x9a63[_0x9ffb('0x30')]=_[_0x9ffb('0x31')](_0x5c9975[_0x9ffb('0x2c')],qs['fields'](_0x2d99b6['query'][_0x9ffb('0x32')]));_0x9a63[_0x9ffb('0x30')]=_0x9a63[_0x9ffb('0x30')][_0x9ffb('0x33')]?_0x9a63[_0x9ffb('0x30')]:_0x5c9975['model'];if(!_0x2d99b6[_0x9ffb('0x2d')]['hasOwnProperty'](_0x9ffb('0x35'))){_0x9a63[_0x9ffb('0x36')]=qs[_0x9ffb('0x36')](_0x2d99b6[_0x9ffb('0x2d')]['limit']);_0x9a63[_0x9ffb('0x18')]=qs[_0x9ffb('0x18')](_0x2d99b6[_0x9ffb('0x2d')]['offset']);}_0x9a63[_0x9ffb('0x37')]=qs[_0x9ffb('0x38')](_0x2d99b6[_0x9ffb('0x2d')][_0x9ffb('0x38')]);_0x9a63['where']=qs['filters'](_[_0x9ffb('0x3a')](_0x2d99b6[_0x9ffb('0x2d')],_0x5c9975[_0x9ffb('0x2f')]));_0x9a63[_0x9ffb('0x39')][_0x9ffb('0x4a')]=_0x3ffcb0['id'];if(_0x2d99b6['query'][_0x9ffb('0x3b')]){_0x9a63[_0x9ffb('0x39')]=_[_0x9ffb('0x3d')](_0x9a63[_0x9ffb('0x39')],{'$or':_[_0x9ffb('0x26')](_0x9a63['attributes'],function(_0x5371ff){var _0x4d7ff5={};_0x4d7ff5[_0x5371ff]={'$like':'%'+_0x2d99b6[_0x9ffb('0x2d')][_0x9ffb('0x3b')]+'%'};return _0x4d7ff5;})});}_0x9a63=_['merge']({},_0x9a63,_0x2d99b6['options']);return db[_0x9ffb('0x49')][_0x9ffb('0x1a')]({'where':_0x9a63[_0x9ffb('0x39')]})[_0x9ffb('0x22')](function(_0x1f8eab){_0x418608[_0x9ffb('0x1a')]=_0x1f8eab;if(_0x2d99b6[_0x9ffb('0x2d')][_0x9ffb('0x3f')]){_0x9a63[_0x9ffb('0x40')]=[{'all':!![]}];}return db[_0x9ffb('0x49')][_0x9ffb('0x4b')](_0x9a63);})[_0x9ffb('0x22')](function(_0x169f46){_0x418608[_0x9ffb('0x41')]=_0x169f46;return _0x418608;});}})[_0x9ffb('0x22')](respondWithFilteredResult(_0x222ba2,_0x9a63))['catch'](handleError(_0x222ba2,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 217839b..13718ed 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 _0xbd51=['exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','./jscriptySessionReport.attributes'];(function(_0x33c1f6,_0x1488a8){var _0x469372=function(_0x202f83){while(--_0x202f83){_0x33c1f6['push'](_0x33c1f6['shift']());}};_0x469372(++_0x1488a8);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5d1169,_0x1bee75){_0x5d1169=_0x5d1169-0x0;var _0xc632b6=_0xbd51[_0x5d1169];return _0xc632b6;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x21f27d,_0x2305ba){var _0x504a7b=function(_0x1428f6){while(--_0x1428f6){_0x21f27d['push'](_0x21f27d['shift']());}};_0x504a7b(++_0x2305ba);}(_0x1db9,0x176));var _0x91db=function(_0x19ced2,_0x23ded6){_0x19ced2=_0x19ced2-0x0;var _0x1f5a20=_0x1db9[_0x19ced2];return _0x1f5a20;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 8cf2941..99dbafa 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 _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20b6eb,_0x2a0a98){var _0x25daee=function(_0x1e539a){while(--_0x1e539a){_0x20b6eb['push'](_0x20b6eb['shift']());}};_0x25daee(++_0x2a0a98);}(_0xafc4,0x69));var _0x4afc=function(_0x305648,_0x303cf0){_0x305648=_0x305648-0x0;var _0x234bb3=_0xafc4[_0x305648];return _0x234bb3;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b872d,_0x616881){var _0x11c1f9=function(_0x252a36){while(--_0x252a36){_0x2b872d['push'](_0x2b872d['shift']());}};_0x11c1f9(++_0x616881);}(_0x0295,0x1f0));var _0x5029=function(_0x53f125,_0x4ba12e){_0x53f125=_0x53f125-0x0;var _0x209b38=_0x0295[_0x53f125];return _0x209b38;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 180ac25..5645fc8 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 _0x9a96=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer'];(function(_0x58d085,_0x103939){var _0x55a8a4=function(_0x167fe9){while(--_0x167fe9){_0x58d085['push'](_0x58d085['shift']());}};_0x55a8a4(++_0x103939);}(_0x9a96,0xd0));var _0x69a9=function(_0xb12cf6,_0x50ea38){_0xb12cf6=_0xb12cf6-0x0;var _0x5cb823=_0x9a96[_0xb12cf6];return _0x5cb823;};'use strict';var multer=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var path=require(_0x69a9('0x2'));var timeout=require(_0x69a9('0x3'));var express=require(_0x69a9('0x4'));var router=express[_0x69a9('0x5')]();var fs_extra=require(_0x69a9('0x6'));var auth=require(_0x69a9('0x7'));var interaction=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var controller=require(_0x69a9('0xa'));router[_0x69a9('0xb')]('/',controller['index']);router[_0x69a9('0xc')](_0x69a9('0xd'),auth[_0x69a9('0xe')](),controller[_0x69a9('0xf')]);router['get'](_0x69a9('0x10'),auth[_0x69a9('0xe')](),controller[_0x69a9('0x11')]);module[_0x69a9('0x12')]=router; \ No newline at end of file +var _0xdb6b=['get','index','/:id','isAuthenticated','update','downloadLogFile','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x5856dd,_0x3732f2){var _0x372969=function(_0x36945d){while(--_0x36945d){_0x5856dd['push'](_0x5856dd['shift']());}};_0x372969(++_0x3732f2);}(_0xdb6b,0x87));var _0xbdb6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb6b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbdb6('0x0'));var util=require(_0xbdb6('0x1'));var path=require(_0xbdb6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdb6('0x3')]();var fs_extra=require(_0xbdb6('0x4'));var auth=require(_0xbdb6('0x5'));var interaction=require(_0xbdb6('0x6'));var config=require(_0xbdb6('0x7'));var controller=require(_0xbdb6('0x8'));router[_0xbdb6('0x9')]('/',controller[_0xbdb6('0xa')]);router['put'](_0xbdb6('0xb'),auth[_0xbdb6('0xc')](),controller[_0xbdb6('0xd')]);router[_0xbdb6('0x9')]('/download_log_file',auth[_0xbdb6('0xc')](),controller[_0xbdb6('0xe')]);module[_0xbdb6('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 40f689c..8d0c4dc 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 _0x8bf2=['STRING','exports','TEXT'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8bf2,0x1c6));var _0x28bf=function(_0x59e185,_0x51278c){_0x59e185=_0x59e185-0x0;var _0x5d28ca=_0x8bf2[_0x59e185];return _0x5d28ca;};'use strict';var Sequelize=require('sequelize');module[_0x28bf('0x0')]={'license':{'type':Sequelize[_0x28bf('0x1')]},'data1':{'type':Sequelize[_0x28bf('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfcec=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x4b36cd,_0x4da8d5){var _0x28ea27=function(_0x28b941){while(--_0x28b941){_0x4b36cd['push'](_0x4b36cd['shift']());}};_0x28ea27(++_0x4da8d5);}(_0xfcec,0x108));var _0xcfce=function(_0x2110bb,_0x5bf49e){_0x2110bb=_0x2110bb-0x0;var _0x5cf87c=_0xfcec[_0x2110bb];return _0x5cf87c;};'use strict';var Sequelize=require(_0xcfce('0x0'));module[_0xcfce('0x1')]={'license':{'type':Sequelize[_0xcfce('0x2')]},'data1':{'type':Sequelize[_0xcfce('0x3')]},'data2':{'type':Sequelize[_0xcfce('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xcfce('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 28fc2f8..2ad41db 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 _0xb857=['xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','License','rawAttributes','keys','query','intersection','model','fields','attributes','length','options','update','body','find','checkLicense','key','downloadLogFile','join','/var','log'];(function(_0x4e19ac,_0x3edc88){var _0x5947c7=function(_0x286781){while(--_0x286781){_0x4e19ac['push'](_0x4e19ac['shift']());}};_0x5947c7(++_0x3edc88);}(_0xb857,0xd5));var _0x7b85=function(_0x5337b9,_0x56fe88){_0x5337b9=_0x5337b9-0x0;var _0x5beae6=_0xb857[_0x5337b9];return _0x5beae6;};'use strict';var emlformat=require(_0x7b85('0x0'));var rimraf=require(_0x7b85('0x1'));var zipdir=require(_0x7b85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b85('0x3'));var BPromise=require(_0x7b85('0x4'));var Mustache=require(_0x7b85('0x5'));var util=require(_0x7b85('0x6'));var path=require('path');var sox=require(_0x7b85('0x7'));var csv=require(_0x7b85('0x8'));var ejs=require(_0x7b85('0x9'));var fs=require('fs');var fs_extra=require(_0x7b85('0xa'));var _=require(_0x7b85('0xb'));var squel=require(_0x7b85('0xc'));var crypto=require('crypto');var jsforce=require(_0x7b85('0xd'));var deskjs=require(_0x7b85('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b85('0xf'));var Redis=require('ioredis');var authService=require(_0x7b85('0x10'));var qs=require(_0x7b85('0x11'));var as=require(_0x7b85('0x12'));var hardwareService=require(_0x7b85('0x13'));var logger=require(_0x7b85('0x14'))(_0x7b85('0x15'));var utils=require('../../config/utils');var config=require(_0x7b85('0x16'));var licenseUtil=require(_0x7b85('0x17'));var db=require(_0x7b85('0x18'))['db'];function respondWithStatusCode(_0x10928b,_0x24c767){_0x24c767=_0x24c767||0xcc;return function(_0x21114b){if(_0x21114b){return _0x10928b[_0x7b85('0x19')](_0x24c767);}return _0x10928b[_0x7b85('0x1a')](_0x24c767)[_0x7b85('0x1b')]();};}function respondWithResult(_0x28b375,_0x58aeb1){_0x58aeb1=_0x58aeb1||0xc8;return function(_0x1eaf5d){if(_0x1eaf5d){return _0x28b375[_0x7b85('0x1a')](_0x58aeb1)['json'](_0x1eaf5d);}};}function respondWithFilteredResult(_0x3aac6d,_0x19c0ee){return function(_0x501e9d){if(_0x501e9d){var _0x2a26df=typeof _0x19c0ee[_0x7b85('0x1c')]===_0x7b85('0x1d')&&typeof _0x19c0ee['limit']===_0x7b85('0x1d');var _0x4ffdb7=_0x501e9d[_0x7b85('0x1e')];var _0x438530=_0x2a26df?0x0:_0x19c0ee[_0x7b85('0x1c')];var _0x5f3136=_0x2a26df?_0x501e9d['count']:_0x19c0ee[_0x7b85('0x1c')]+_0x19c0ee[_0x7b85('0x1f')];var _0x5b3ca2;if(_0x5f3136>=_0x4ffdb7){_0x5f3136=_0x4ffdb7;_0x5b3ca2=0xc8;}else{_0x5b3ca2=0xce;}_0x3aac6d[_0x7b85('0x1a')](_0x5b3ca2);return _0x3aac6d[_0x7b85('0x20')](_0x7b85('0x21'),_0x438530+'-'+_0x5f3136+'/'+_0x4ffdb7)['json'](_0x501e9d);}return null;};}function patchUpdates(_0x303f5a){return function(_0x4762db){try{jsonpatch[_0x7b85('0x22')](_0x4762db,_0x303f5a,!![]);}catch(_0x223bb5){return BPromise[_0x7b85('0x23')](_0x223bb5);}return _0x4762db[_0x7b85('0x24')]();};}function saveUpdates(_0x5274c7,_0x3e9af3){return function(_0x549636){if(_0x549636){return _0x549636['update'](_0x5274c7)[_0x7b85('0x25')](function(_0x1c73a3){return _0x1c73a3;});}return null;};}function removeEntity(_0x244066,_0x11d70d){return function(_0x2d520b){if(_0x2d520b){return _0x2d520b[_0x7b85('0x26')]()[_0x7b85('0x25')](function(){_0x244066[_0x7b85('0x1a')](0xcc)[_0x7b85('0x1b')]();});}};}function handleEntityNotFound(_0x4c5fe1,_0x1be58e){return function(_0x2b7dd7){if(!_0x2b7dd7){_0x4c5fe1['sendStatus'](0x194);}return _0x2b7dd7;};}function handleError(_0x49af01,_0x224b6a){_0x224b6a=_0x224b6a||0x1f4;return function(_0x20f612){logger[_0x7b85('0x27')](_0x20f612[_0x7b85('0x28')]);if(_0x20f612[_0x7b85('0x29')]){delete _0x20f612[_0x7b85('0x29')];}_0x49af01[_0x7b85('0x1a')](_0x224b6a)[_0x7b85('0x2a')](_0x20f612);};}var utilLicense=require('../../config/license/util');exports[_0x7b85('0x2b')]=function(_0x12f34c,_0x5bfe13){var _0x3a2d4c={'raw':!![],'where':{'id':0x1}},_0x430215={};_0x430215['model']=_['keys'](db[_0x7b85('0x2c')][_0x7b85('0x2d')]);_0x430215['query']=_[_0x7b85('0x2e')](_0x12f34c[_0x7b85('0x2f')]);_0x430215['filters']=_[_0x7b85('0x30')](_0x430215[_0x7b85('0x31')],_0x430215[_0x7b85('0x2f')]);_0x3a2d4c['attributes']=_[_0x7b85('0x30')](_0x430215['model'],qs['fields'](_0x12f34c['query'][_0x7b85('0x32')]));_0x3a2d4c[_0x7b85('0x33')]=_0x3a2d4c['attributes'][_0x7b85('0x34')]?_0x3a2d4c[_0x7b85('0x33')]:_0x430215[_0x7b85('0x31')];_0x3a2d4c=_['merge']({},_0x3a2d4c,_0x12f34c[_0x7b85('0x35')]);return utilLicense['getLicense'](_0x3a2d4c)[_0x7b85('0x25')](respondWithResult(_0x5bfe13,null))['catch'](handleError(_0x5bfe13,null));};exports[_0x7b85('0x36')]=function(_0x1abb4d,_0x38b6a4){if(_0x1abb4d[_0x7b85('0x37')]['id']){delete _0x1abb4d['body']['id'];}return db['License'][_0x7b85('0x38')]({'where':{'id':_0x1abb4d['params']['id']}})[_0x7b85('0x25')](handleEntityNotFound(_0x38b6a4,null))[_0x7b85('0x25')](function(_0x4d04dc){var _0x458f83=_0x4d04dc['get']({'plain':!![]});return utilLicense[_0x7b85('0x39')](_0x458f83,_0x1abb4d[_0x7b85('0x37')][_0x7b85('0x3a')]);})['then'](function(_0x343140){if(!_0x343140['demo']){return saveUpdates(_0x1abb4d[_0x7b85('0x37')],null);}return _0x343140;})[_0x7b85('0x25')](respondWithResult(_0x38b6a4,null))['catch'](handleError(_0x38b6a4,null));};exports[_0x7b85('0x3b')]=function(_0x41607d,_0x3b622c){var _0x144106='license-info.log';var _0x1064a8=path[_0x7b85('0x3c')](_0x7b85('0x3d'),_0x7b85('0x3e'),_0x7b85('0x3f'),_0x144106);_0x3b622c[_0x7b85('0x40')](_0x7b85('0x41'),_0x7b85('0x42')+_0x144106);_0x3b622c[_0x7b85('0x20')](_0x7b85('0x43'),'text/plain');_0x3b622c[_0x7b85('0x44')](_0x1064a8);}; \ No newline at end of file +var _0xb391=['lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','body','find','params','get','checkLicense','key','catch','join','xcally','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra'];(function(_0x25831a,_0x3027d1){var _0x141686=function(_0xac7268){while(--_0xac7268){_0x25831a['push'](_0x25831a['shift']());}};_0x141686(++_0x3027d1);}(_0xb391,0xfe));var _0x1b39=function(_0x45964b,_0xe849e5){_0x45964b=_0x45964b-0x0;var _0x4dc863=_0xb391[_0x45964b];return _0x4dc863;};'use strict';var emlformat=require(_0x1b39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b39('0x1'));var jsonpatch=require(_0x1b39('0x2'));var rp=require(_0x1b39('0x3'));var moment=require(_0x1b39('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1b39('0x5'));var util=require(_0x1b39('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1b39('0x7'));var ejs=require(_0x1b39('0x8'));var fs=require('fs');var fs_extra=require(_0x1b39('0x9'));var _=require(_0x1b39('0xa'));var squel=require('squel');var crypto=require(_0x1b39('0xb'));var jsforce=require(_0x1b39('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b39('0x7'));var querystring=require(_0x1b39('0xd'));var Papa=require('papaparse');var Redis=require(_0x1b39('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1b39('0xf'));var as=require(_0x1b39('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b39('0x11'))(_0x1b39('0x12'));var utils=require('../../config/utils');var config=require(_0x1b39('0x13'));var licenseUtil=require(_0x1b39('0x14'));var db=require(_0x1b39('0x15'))['db'];function respondWithStatusCode(_0x4dddf5,_0x5660d9){_0x5660d9=_0x5660d9||0xcc;return function(_0x162bcd){if(_0x162bcd){return _0x4dddf5[_0x1b39('0x16')](_0x5660d9);}return _0x4dddf5['status'](_0x5660d9)['end']();};}function respondWithResult(_0x5ddf40,_0x2f360c){_0x2f360c=_0x2f360c||0xc8;return function(_0x1214e8){if(_0x1214e8){return _0x5ddf40[_0x1b39('0x17')](_0x2f360c)[_0x1b39('0x18')](_0x1214e8);}};}function respondWithFilteredResult(_0x2042ac,_0xafd574){return function(_0x392cdf){if(_0x392cdf){var _0x16fe76=typeof _0xafd574[_0x1b39('0x19')]===_0x1b39('0x1a')&&typeof _0xafd574['limit']===_0x1b39('0x1a');var _0x2105ab=_0x392cdf[_0x1b39('0x1b')];var _0x37a2d7=_0x16fe76?0x0:_0xafd574[_0x1b39('0x19')];var _0x4b4abc=_0x16fe76?_0x392cdf[_0x1b39('0x1b')]:_0xafd574['offset']+_0xafd574[_0x1b39('0x1c')];var _0xefc594;if(_0x4b4abc>=_0x2105ab){_0x4b4abc=_0x2105ab;_0xefc594=0xc8;}else{_0xefc594=0xce;}_0x2042ac[_0x1b39('0x17')](_0xefc594);return _0x2042ac[_0x1b39('0x1d')](_0x1b39('0x1e'),_0x37a2d7+'-'+_0x4b4abc+'/'+_0x2105ab)[_0x1b39('0x18')](_0x392cdf);}return null;};}function patchUpdates(_0x1f20f4){return function(_0x23ec41){try{jsonpatch[_0x1b39('0x1f')](_0x23ec41,_0x1f20f4,!![]);}catch(_0x323291){return BPromise[_0x1b39('0x20')](_0x323291);}return _0x23ec41[_0x1b39('0x21')]();};}function saveUpdates(_0x1422eb,_0x35da34){return function(_0x161e79){if(_0x161e79){return _0x161e79[_0x1b39('0x22')](_0x1422eb)[_0x1b39('0x23')](function(_0x322e47){return _0x322e47;});}return null;};}function removeEntity(_0x5b6363,_0x68d9aa){return function(_0x288c4b){if(_0x288c4b){return _0x288c4b['destroy']()['then'](function(){_0x5b6363['status'](0xcc)[_0x1b39('0x24')]();});}};}function handleEntityNotFound(_0x1b8ced,_0x160695){return function(_0x3c34ac){if(!_0x3c34ac){_0x1b8ced[_0x1b39('0x16')](0x194);}return _0x3c34ac;};}function handleError(_0x4d5e16,_0x2895ec){_0x2895ec=_0x2895ec||0x1f4;return function(_0x21426a){logger[_0x1b39('0x25')](_0x21426a[_0x1b39('0x26')]);if(_0x21426a[_0x1b39('0x27')]){delete _0x21426a[_0x1b39('0x27')];}_0x4d5e16[_0x1b39('0x17')](_0x2895ec)[_0x1b39('0x28')](_0x21426a);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x4d1ceb,_0x2f23ce){var _0xa5a166={'raw':!![],'where':{'id':0x1}},_0x4299e3={};_0x4299e3[_0x1b39('0x29')]=_[_0x1b39('0x2a')](db[_0x1b39('0x2b')][_0x1b39('0x2c')]);_0x4299e3[_0x1b39('0x2d')]=_[_0x1b39('0x2a')](_0x4d1ceb[_0x1b39('0x2d')]);_0x4299e3[_0x1b39('0x2e')]=_[_0x1b39('0x2f')](_0x4299e3[_0x1b39('0x29')],_0x4299e3[_0x1b39('0x2d')]);_0xa5a166[_0x1b39('0x30')]=_['intersection'](_0x4299e3[_0x1b39('0x29')],qs[_0x1b39('0x31')](_0x4d1ceb['query'][_0x1b39('0x31')]));_0xa5a166[_0x1b39('0x30')]=_0xa5a166['attributes'][_0x1b39('0x32')]?_0xa5a166[_0x1b39('0x30')]:_0x4299e3[_0x1b39('0x29')];_0xa5a166=_[_0x1b39('0x33')]({},_0xa5a166,_0x4d1ceb['options']);return utilLicense[_0x1b39('0x34')](_0xa5a166)[_0x1b39('0x23')](respondWithResult(_0x2f23ce,null))['catch'](handleError(_0x2f23ce,null));};exports[_0x1b39('0x22')]=function(_0x31544f,_0x20109e){if(_0x31544f[_0x1b39('0x35')]['id']){delete _0x31544f[_0x1b39('0x35')]['id'];}return db['License'][_0x1b39('0x36')]({'where':{'id':_0x31544f[_0x1b39('0x37')]['id']}})[_0x1b39('0x23')](handleEntityNotFound(_0x20109e,null))[_0x1b39('0x23')](function(_0x5f1800){var _0x4c37d0=_0x5f1800[_0x1b39('0x38')]({'plain':!![]});return utilLicense[_0x1b39('0x39')](_0x4c37d0,_0x31544f[_0x1b39('0x35')][_0x1b39('0x3a')]);})[_0x1b39('0x23')](function(_0x57f020){if(!_0x57f020['demo']){return saveUpdates(_0x31544f[_0x1b39('0x35')],null);}return _0x57f020;})[_0x1b39('0x23')](respondWithResult(_0x20109e,null))[_0x1b39('0x3b')](handleError(_0x20109e,null));};exports['downloadLogFile']=function(_0x1df1ff,_0x5314c6){var _0x16d447='license-info.log';var _0x548b03=path[_0x1b39('0x3c')]('/var','log',_0x1b39('0x3d'),_0x16d447);_0x5314c6['setHeader'](_0x1b39('0x3e'),_0x1b39('0x3f')+_0x16d447);_0x5314c6[_0x1b39('0x1d')](_0x1b39('0x40'),'text/plain');_0x5314c6[_0x1b39('0x41')](_0x548b03);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3245c70..42a0189 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 _0x6d13=['request-promise','path','rimraf','../../config/environment','./license.attributes','define','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ff127,_0x3d6e2b){var _0x53af48=function(_0x4a0c47){while(--_0x4a0c47){_0x2ff127['push'](_0x2ff127['shift']());}};_0x53af48(++_0x3d6e2b);}(_0x6d13,0xe4));var _0x36d1=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x6d13[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x36d1('0x0'));var util=require(_0x36d1('0x1'));var logger=require(_0x36d1('0x2'))(_0x36d1('0x3'));var moment=require(_0x36d1('0x4'));var BPromise=require(_0x36d1('0x5'));var rp=require(_0x36d1('0x6'));var fs=require('fs');var path=require(_0x36d1('0x7'));var rimraf=require(_0x36d1('0x8'));var config=require(_0x36d1('0x9'));var attributes=require(_0x36d1('0xa'));module['exports']=function(_0x55b0bc,_0x480c90){return _0x55b0bc[_0x36d1('0xb')]('License',attributes,{'tableName':_0x36d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcef=['exports','define','License','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./license.attributes'];(function(_0x13a7b5,_0x17ad76){var _0x23ecf2=function(_0x243eee){while(--_0x243eee){_0x13a7b5['push'](_0x13a7b5['shift']());}};_0x23ecf2(++_0x17ad76);}(_0xdcef,0x1a7));var _0xfdce=function(_0x1bdae7,_0x5ee86d){_0x1bdae7=_0x1bdae7-0x0;var _0x56cc5a=_0xdcef[_0x1bdae7];return _0x56cc5a;};'use strict';var _=require(_0xfdce('0x0'));var util=require(_0xfdce('0x1'));var logger=require(_0xfdce('0x2'))('api');var moment=require(_0xfdce('0x3'));var BPromise=require(_0xfdce('0x4'));var rp=require(_0xfdce('0x5'));var fs=require('fs');var path=require(_0xfdce('0x6'));var rimraf=require('rimraf');var config=require(_0xfdce('0x7'));var attributes=require(_0xfdce('0x8'));module[_0xfdce('0x9')]=function(_0x150487,_0x23c78b){return _0x150487[_0xfdce('0xa')](_0xfdce('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 968f40c..868613d 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 _0x298d=['../../config/logger','rpc','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','../../mysqldb','../../config/utils'];(function(_0x1636c6,_0x3714b5){var _0x27e480=function(_0x148c9b){while(--_0x148c9b){_0x1636c6['push'](_0x1636c6['shift']());}};_0x27e480(++_0x3714b5);}(_0x298d,0x94));var _0xd298=function(_0x3752a5,_0x32f319){_0x3752a5=_0x3752a5-0x0;var _0x4191a1=_0x298d[_0x3752a5];return _0x4191a1;};'use strict';var _=require('lodash');var util=require(_0xd298('0x0'));var moment=require(_0xd298('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd298('0x2'))['db'];var utils=require(_0xd298('0x3'));var logger=require(_0xd298('0x4'))(_0xd298('0x5'));var config=require('../../config/environment');var jayson=require(_0xd298('0x6'));var client=jayson[_0xd298('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4cce,_0x2ff840,_0x56c3d6){return new BPromise(function(_0x4da2d7,_0x2e9900){return client[_0xd298('0x8')](_0x3a4cce,_0x56c3d6)[_0xd298('0x9')](function(_0xd7c162){logger[_0xd298('0xa')](_0xd298('0xb'),_0x2ff840,'request\x20sent');logger['debug'](_0xd298('0xc'),_0x2ff840,_0xd298('0xd'),JSON[_0xd298('0xe')](_0xd7c162));if(_0xd7c162['error']){if(_0xd7c162[_0xd298('0xf')][_0xd298('0x10')]===0x1f4){logger[_0xd298('0xf')](_0xd298('0xb'),_0x2ff840,_0xd7c162['error'][_0xd298('0x11')]);return _0x2e9900(_0xd7c162[_0xd298('0xf')][_0xd298('0x11')]);}logger['error'](_0xd298('0xb'),_0x2ff840,_0xd7c162[_0xd298('0xf')]['message']);return _0x4da2d7(_0xd7c162[_0xd298('0xf')][_0xd298('0x11')]);}else{logger[_0xd298('0xa')](_0xd298('0xb'),_0x2ff840,_0xd298('0xd'));_0x4da2d7(_0xd7c162[_0xd298('0x12')]['message']);}})['catch'](function(_0x2c4e51){logger[_0xd298('0xf')](_0xd298('0xb'),_0x2ff840,_0x2c4e51);_0x2e9900(_0x2c4e51);});});} \ No newline at end of file +var _0x2bb3=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','stringify','error'];(function(_0x374fb7,_0xe29ac3){var _0x3835ce=function(_0x245dc9){while(--_0x245dc9){_0x374fb7['push'](_0x374fb7['shift']());}};_0x3835ce(++_0xe29ac3);}(_0x2bb3,0x1d2));var _0x32bb=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x2bb3[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x32bb('0x0'));var util=require(_0x32bb('0x1'));var moment=require(_0x32bb('0x2'));var BPromise=require(_0x32bb('0x3'));var rs=require(_0x32bb('0x4'));var fs=require('fs');var Redis=require(_0x32bb('0x5'));var db=require(_0x32bb('0x6'))['db'];var utils=require(_0x32bb('0x7'));var logger=require(_0x32bb('0x8'))('rpc');var config=require(_0x32bb('0x9'));var jayson=require(_0x32bb('0xa'));var client=jayson[_0x32bb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x200f06,_0x2259db,_0x12da7b){return new BPromise(function(_0x1eb2c3,_0xb86c46){return client[_0x32bb('0xc')](_0x200f06,_0x12da7b)[_0x32bb('0xd')](function(_0x5cc121){logger[_0x32bb('0xe')]('License,\x20%s,\x20%s',_0x2259db,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x2259db,'request\x20sent',JSON[_0x32bb('0xf')](_0x5cc121));if(_0x5cc121[_0x32bb('0x10')]){if(_0x5cc121[_0x32bb('0x10')][_0x32bb('0x11')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x2259db,_0x5cc121['error'][_0x32bb('0x12')]);return _0xb86c46(_0x5cc121[_0x32bb('0x10')]['message']);}logger[_0x32bb('0x10')]('License,\x20%s,\x20%s',_0x2259db,_0x5cc121['error'][_0x32bb('0x12')]);return _0x1eb2c3(_0x5cc121[_0x32bb('0x10')][_0x32bb('0x12')]);}else{logger[_0x32bb('0xe')]('License,\x20%s,\x20%s',_0x2259db,'request\x20sent');_0x1eb2c3(_0x5cc121[_0x32bb('0x13')]['message']);}})[_0x32bb('0x14')](function(_0x5c84a0){logger['error']('License,\x20%s,\x20%s',_0x2259db,_0x5c84a0);_0xb86c46(_0x5c84a0);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 99aca07..3da8a13 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 _0x003a=['post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x003a,0x16c));var _0xa003=function(_0x546c15,_0x18a781){_0x546c15=_0x546c15-0x0;var _0x5a69a5=_0x003a[_0x546c15];return _0x5a69a5;};'use strict';var multer=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa003('0x2'));var auth=require(_0xa003('0x3'));var interaction=require(_0xa003('0x4'));var config=require(_0xa003('0x5'));var controller=require(_0xa003('0x6'));router[_0xa003('0x7')]('/',auth['isAuthenticated'](),controller[_0xa003('0x8')]);router[_0xa003('0x7')](_0xa003('0x9'),auth[_0xa003('0xa')](),controller['describe']);router['get'](_0xa003('0xb'),auth[_0xa003('0xa')](),controller[_0xa003('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa003('0xd')]);router[_0xa003('0x7')]('/:id/canned_answers',auth[_0xa003('0xa')](),controller[_0xa003('0xe')]);router['get'](_0xa003('0xf'),auth[_0xa003('0xa')](),controller[_0xa003('0x10')]);router[_0xa003('0x7')](_0xa003('0x11'),auth[_0xa003('0xa')](),controller[_0xa003('0x12')]);router[_0xa003('0x7')](_0xa003('0x13'),auth[_0xa003('0xa')](),controller[_0xa003('0x14')]);router[_0xa003('0x7')](_0xa003('0x15'),auth[_0xa003('0xa')](),controller[_0xa003('0x16')]);router[_0xa003('0x7')](_0xa003('0x17'),auth[_0xa003('0xa')](),controller[_0xa003('0x18')]);router[_0xa003('0x7')](_0xa003('0x19'),auth[_0xa003('0xa')](),controller[_0xa003('0x1a')]);router['get'](_0xa003('0x1b'),auth[_0xa003('0xa')](),controller['getAgents']);router[_0xa003('0x1c')](_0xa003('0x1d'),auth[_0xa003('0xa')](),controller[_0xa003('0x1e')]);router[_0xa003('0x1c')](_0xa003('0x1f'),auth[_0xa003('0xa')](),controller[_0xa003('0x20')]);router[_0xa003('0x1c')]('/',auth[_0xa003('0xa')](),controller[_0xa003('0x21')]);router['post'](_0xa003('0xf'),auth[_0xa003('0xa')](),controller[_0xa003('0x22')]);router['post'](_0xa003('0x11'),auth[_0xa003('0xa')](),controller[_0xa003('0x23')]);router[_0xa003('0x1c')](_0xa003('0x13'),auth[_0xa003('0xa')](),controller[_0xa003('0x24')]);router[_0xa003('0x1c')]('/:id/applications',auth[_0xa003('0xa')](),controller['addApplications']);router[_0xa003('0x1c')](_0xa003('0x25'),auth[_0xa003('0xa')](),controller[_0xa003('0x26')]);router[_0xa003('0x1c')](_0xa003('0x1b'),auth[_0xa003('0xa')](),controller[_0xa003('0x27')]);router[_0xa003('0x28')](_0xa003('0xb'),auth[_0xa003('0xa')](),controller['update']);router[_0xa003('0x29')](_0xa003('0x1d'),auth['isAuthenticated'](),controller[_0xa003('0x2a')]);router[_0xa003('0x29')]('/:id/canned_answers',auth[_0xa003('0xa')](),controller[_0xa003('0x2b')]);router[_0xa003('0x29')](_0xa003('0xf'),auth[_0xa003('0xa')](),controller[_0xa003('0x2c')]);router[_0xa003('0x29')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xa003('0x2d')]);router[_0xa003('0x29')](_0xa003('0xb'),auth[_0xa003('0xa')](),controller[_0xa003('0x2e')]);router[_0xa003('0x29')](_0xa003('0x1b'),auth[_0xa003('0xa')](),controller[_0xa003('0x2f')]);module[_0xa003('0x30')]=router; \ No newline at end of file +var _0xd329=['delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','create','addImap','addInteraction','/:id/send','/:id/users','addAgents'];(function(_0x4471d1,_0x5a0346){var _0x47bd14=function(_0x36c3c3){while(--_0x36c3c3){_0x4471d1['push'](_0x4471d1['shift']());}};_0x47bd14(++_0x5a0346);}(_0xd329,0xf8));var _0x9d32=function(_0x2d31d0,_0xb13637){_0x2d31d0=_0x2d31d0-0x0;var _0x255f30=_0xd329[_0x2d31d0];return _0x255f30;};'use strict';var multer=require(_0x9d32('0x0'));var util=require(_0x9d32('0x1'));var path=require(_0x9d32('0x2'));var timeout=require(_0x9d32('0x3'));var express=require('express');var router=express[_0x9d32('0x4')]();var fs_extra=require(_0x9d32('0x5'));var auth=require(_0x9d32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d32('0x7'));var controller=require(_0x9d32('0x8'));router[_0x9d32('0x9')]('/',auth[_0x9d32('0xa')](),controller[_0x9d32('0xb')]);router[_0x9d32('0x9')](_0x9d32('0xc'),auth[_0x9d32('0xa')](),controller[_0x9d32('0xd')]);router[_0x9d32('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9d32('0xe')]);router[_0x9d32('0x9')]('/:id/dispositions',auth[_0x9d32('0xa')](),controller[_0x9d32('0xf')]);router['get'](_0x9d32('0x10'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x11')]);router[_0x9d32('0x9')](_0x9d32('0x12'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x13')]);router[_0x9d32('0x9')](_0x9d32('0x14'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x15')]);router[_0x9d32('0x9')](_0x9d32('0x16'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x17')]);router[_0x9d32('0x9')](_0x9d32('0x18'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x19')]);router[_0x9d32('0x9')](_0x9d32('0x1a'),auth['isAuthenticated'](),controller[_0x9d32('0x1b')]);router[_0x9d32('0x9')](_0x9d32('0x1c'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x1d')]);router[_0x9d32('0x9')]('/:id/users',auth[_0x9d32('0xa')](),controller[_0x9d32('0x1e')]);router[_0x9d32('0x1f')](_0x9d32('0x20'),auth['isAuthenticated'](),controller[_0x9d32('0x21')]);router[_0x9d32('0x1f')](_0x9d32('0x10'),auth[_0x9d32('0xa')](),controller['addAnswer']);router['post']('/',auth[_0x9d32('0xa')](),controller[_0x9d32('0x22')]);router[_0x9d32('0x1f')](_0x9d32('0x12'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x23')]);router[_0x9d32('0x1f')](_0x9d32('0x14'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x9d32('0x1f')](_0x9d32('0x16'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x24')]);router[_0x9d32('0x1f')](_0x9d32('0x18'),auth[_0x9d32('0xa')](),controller['addApplications']);router[_0x9d32('0x1f')](_0x9d32('0x25'),auth['isAuthenticated'](),controller['send']);router[_0x9d32('0x1f')](_0x9d32('0x26'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x27')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9d32('0x28')](_0x9d32('0x20'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x29')]);router[_0x9d32('0x28')](_0x9d32('0x10'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x2a')]);router[_0x9d32('0x28')](_0x9d32('0x12'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x2b')]);router[_0x9d32('0x28')](_0x9d32('0x14'),auth[_0x9d32('0xa')](),controller[_0x9d32('0x2c')]);router[_0x9d32('0x28')](_0x9d32('0x2d'),auth[_0x9d32('0xa')](),controller['destroy']);router[_0x9d32('0x28')]('/:id/users',auth[_0x9d32('0xa')](),controller[_0x9d32('0x2e')]);module[_0x9d32('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index af75e36..19aeec6 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 _0x0cd9=['getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','outlook365'];(function(_0x37fa4f,_0x379eb2){var _0x17133f=function(_0x38b3ee){while(--_0x38b3ee){_0x37fa4f['push'](_0x37fa4f['shift']());}};_0x17133f(++_0x379eb2);}(_0x0cd9,0x10d));var _0x90cd=function(_0x402071,_0x462701){_0x402071=_0x402071-0x0;var _0x1d4d9b=_0x0cd9[_0x402071];return _0x1d4d9b;};'use strict';var Sequelize=require(_0x90cd('0x0'));module[_0x90cd('0x1')]={'description':{'type':Sequelize[_0x90cd('0x2')]},'name':{'type':Sequelize[_0x90cd('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x90cd('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x90cd('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x90cd('0x4')]},'markAsUnread':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x90cd('0x2')],'allowNull':![],'defaultValue':_0x90cd('0x5')},'fontSize':{'type':Sequelize[_0x90cd('0x6')](0x2)[_0x90cd('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x90cd('0x8');}},'notificationSound':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x90cd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x90cd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x90cd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x90cd('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x90cd('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x90cd('0x3')],'defaultValue':![],'comment':_0x90cd('0xa'),'set':function(_0x3fc23e){if(!_0x3fc23e)this[_0x90cd('0xb')](_0x90cd('0xc'),null);this[_0x90cd('0xb')](_0x90cd('0xd'),_0x3fc23e);}},'provider':{'type':Sequelize[_0x90cd('0xe')]('gmail','hotmail','yahoo',_0x90cd('0xf')),'defaultValue':null,'get':function(){if(!this[_0x90cd('0x10')](_0x90cd('0x11')))return _0x90cd('0x12');return this[_0x90cd('0x10')](_0x90cd('0x11'));},'set':function(_0x260b9d){if(_0x260b9d===_0x90cd('0x12'))_0x260b9d=null;return this[_0x90cd('0xb')]('provider',_0x260b9d);}}}; \ No newline at end of file +var _0x74e4=['sequelize','exports','STRING','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}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','gmail','yahoo','getDataValue','provider'];(function(_0xa8c3ed,_0x4b604c){var _0x1dc1ee=function(_0x29d123){while(--_0x29d123){_0xa8c3ed['push'](_0xa8c3ed['shift']());}};_0x1dc1ee(++_0x4b604c);}(_0x74e4,0x154));var _0x474e=function(_0x552a17,_0x25d23b){_0x552a17=_0x552a17-0x0;var _0x148e99=_0x74e4[_0x552a17];return _0x148e99;};'use strict';var Sequelize=require(_0x474e('0x0'));module[_0x474e('0x1')]={'description':{'type':Sequelize[_0x474e('0x2')]},'name':{'type':Sequelize[_0x474e('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x474e('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x474e('0x2')],'allowNull':![],'defaultValue':_0x474e('0x4')},'fontSize':{'type':Sequelize[_0x474e('0x5')](0x2)[_0x474e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x474e('0x3')],'defaultValue':function(){return _0x474e('0x7');}},'notificationSound':{'type':Sequelize[_0x474e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x474e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x474e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x474e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x474e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x474e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x474e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x474e('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x474e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x474e('0x8')],'defaultValue':![],'comment':_0x474e('0xa'),'set':function(_0x118004){if(!_0x118004)this['setDataValue'](_0x474e('0xb'),null);this[_0x474e('0xc')]('mandatoryDisposition',_0x118004);}},'provider':{'type':Sequelize['ENUM'](_0x474e('0xd'),'hotmail',_0x474e('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x474e('0xf')](_0x474e('0x10')))return'custom';return this['getDataValue'](_0x474e('0x10'));},'set':function(_0x3e2a03){if(_0x3e2a03==='custom')_0x3e2a03=null;return this[_0x474e('0xc')](_0x474e('0x10'),_0x3e2a03);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4650287..8c4bb49 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 _0xaf3b=['MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','sendStatus','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','MailAccount','rows','show','find','body','provider','custom','describe','params','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages'];(function(_0x2c5bac,_0x465d7e){var _0x1fcf33=function(_0x513b77){while(--_0x513b77){_0x2c5bac['push'](_0x2c5bac['shift']());}};_0x1fcf33(++_0x465d7e);}(_0xaf3b,0x1c0));var _0xbaf3=function(_0x1aa50a,_0x23f231){_0x1aa50a=_0x1aa50a-0x0;var _0x8bab64=_0xaf3b[_0x1aa50a];return _0x8bab64;};'use strict';var moment=require(_0xbaf3('0x0'));var BPromise=require(_0xbaf3('0x1'));var util=require('util');var path=require(_0xbaf3('0x2'));var _=require(_0xbaf3('0x3'));var juice=require(_0xbaf3('0x4'));var Redis=require('ioredis');var qs=require(_0xbaf3('0x5'));var logger=require(_0xbaf3('0x6'))('api');var config=require(_0xbaf3('0x7'));var db=require(_0xbaf3('0x8'))['db'];config['redis']=_['defaults'](config[_0xbaf3('0x9')],{'host':_0xbaf3('0xa'),'port':0x18eb});var socket=require(_0xbaf3('0xb'))(new Redis(config['redis']));require(_0xbaf3('0xc'))['register'](socket);var jayson=require(_0xbaf3('0xd'));var client=jayson[_0xbaf3('0xe')][_0xbaf3('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x2aaf0c,_0x4ce7d7,_0x3f94d7,_0x363ae5){return new BPromise(function(_0x2650f8,_0x165ada){var _0x3bdc88=_0x363ae5||client;return _0x3bdc88['request'](_0x2aaf0c,_0x3f94d7)[_0xbaf3('0x10')](function(_0x4cffe7){logger[_0xbaf3('0x11')](_0xbaf3('0x12'),_0x4ce7d7,'request\x20sent');logger[_0xbaf3('0x13')](_0xbaf3('0x14'),_0x4ce7d7,_0xbaf3('0x15'),JSON[_0xbaf3('0x16')](_0x4cffe7));if(_0x4cffe7[_0xbaf3('0x17')]){if(_0x4cffe7['error']['code']===0x1f4){logger[_0xbaf3('0x17')]('MailAccount,\x20%s,\x20%s',_0x4ce7d7,_0x4cffe7['error'][_0xbaf3('0x18')]);return _0x165ada(_0x4cffe7['error'][_0xbaf3('0x18')]);}logger[_0xbaf3('0x17')](_0xbaf3('0x12'),_0x4ce7d7,_0x4cffe7[_0xbaf3('0x17')][_0xbaf3('0x18')]);return _0x2650f8(_0x4cffe7[_0xbaf3('0x17')]['message']);}else{logger[_0xbaf3('0x11')](_0xbaf3('0x12'),_0x4ce7d7,_0xbaf3('0x15'));_0x2650f8(_0x4cffe7[_0xbaf3('0x19')][_0xbaf3('0x18')]);}})[_0xbaf3('0x1a')](function(_0x53ecc3){logger['error'](_0xbaf3('0x12'),_0x4ce7d7,_0x53ecc3);_0x165ada(_0x53ecc3);});});}function respondWithStatusCode(_0x3a7125,_0x4b5f74){_0x4b5f74=_0x4b5f74||0xcc;return function(_0x523603){if(_0x523603){return _0x3a7125['sendStatus'](_0x4b5f74);}return _0x3a7125['status'](_0x4b5f74)[_0xbaf3('0x1b')]();};}function respondWithResult(_0x453f39,_0x2735cb){_0x2735cb=_0x2735cb||0xc8;return function(_0x1047a1){if(_0x1047a1){return _0x453f39['status'](_0x2735cb)[_0xbaf3('0x1c')](_0x1047a1);}};}function respondWithFilteredResult(_0x481172,_0x40321d){return function(_0x337a18){if(_0x337a18){var _0x59fb17=typeof _0x40321d[_0xbaf3('0x1d')]===_0xbaf3('0x1e')&&typeof _0x40321d[_0xbaf3('0x1f')]===_0xbaf3('0x1e');var _0x269558=_0x337a18[_0xbaf3('0x20')];var _0x499cdc=_0x59fb17?0x0:_0x40321d['offset'];var _0x5d3184=_0x59fb17?_0x337a18[_0xbaf3('0x20')]:_0x40321d[_0xbaf3('0x1d')]+_0x40321d[_0xbaf3('0x1f')];var _0x45fa5f;if(_0x5d3184>=_0x269558){_0x5d3184=_0x269558;_0x45fa5f=0xc8;}else{_0x45fa5f=0xce;}_0x481172[_0xbaf3('0x21')](_0x45fa5f);return _0x481172[_0xbaf3('0x22')](_0xbaf3('0x23'),_0x499cdc+'-'+_0x5d3184+'/'+_0x269558)[_0xbaf3('0x1c')](_0x337a18);}return null;};}function saveUpdates(_0x2f080a){return function(_0xc681cd){if(_0xc681cd){return _0xc681cd[_0xbaf3('0x24')](_0x2f080a)['then'](function(_0x6f6d3f){return _0x6f6d3f;});}return null;};}function removeEntity(_0xdfa0e){return function(_0x2f375f){if(_0x2f375f){return _0x2f375f[_0xbaf3('0x25')]()[_0xbaf3('0x10')](function(){var _0x1c0f6e=_0x2f375f[_0xbaf3('0x26')]({'plain':!![]});var _0x1996a4=_0xbaf3('0x27');return db[_0xbaf3('0x28')][_0xbaf3('0x25')]({'where':{'type':_0x1996a4,'resourceId':_0x1c0f6e['id']}})['then'](function(){return _0x2f375f;});})[_0xbaf3('0x10')](function(){_0xdfa0e[_0xbaf3('0x21')](0xcc)[_0xbaf3('0x1b')]();});}};}function handleEntityNotFound(_0x5d04a7){return function(_0x537545){if(!_0x537545){_0x5d04a7[_0xbaf3('0x29')](0x194);}return _0x537545;};}function handleError(_0x1294f0,_0xe35f25){_0xe35f25=_0xe35f25||0x1f4;return function(_0x2e2c00){logger[_0xbaf3('0x17')](_0x2e2c00[_0xbaf3('0x2a')]);if(_0x2e2c00[_0xbaf3('0x2b')]){delete _0x2e2c00[_0xbaf3('0x2b')];}_0x1294f0[_0xbaf3('0x21')](_0xe35f25)['send'](_0x2e2c00);};}function getImapHost(_0x27f919){switch(_0x27f919){case'gmail':return _0xbaf3('0x2c');case _0xbaf3('0x2d'):return _0xbaf3('0x2e');case _0xbaf3('0x2f'):return _0xbaf3('0x30');case _0xbaf3('0x31'):return _0xbaf3('0x32');}throw new Error(_0xbaf3('0x33'),_0x27f919);}function getSmtpHost(_0x35bdec){switch(_0x35bdec){case _0xbaf3('0x34'):return _0xbaf3('0x35');case _0xbaf3('0x2d'):return _0xbaf3('0x36');case'hotmail':return _0xbaf3('0x37');case _0xbaf3('0x31'):return _0xbaf3('0x38');}throw new Error(_0xbaf3('0x33'),_0x35bdec);}function getAuthenticationOptions(_0x36f715,_0x40134f){var _0x526688={};var _0x3263aa={};if(_0x36f715){_0x526688[_0xbaf3('0x39')]=_0x3263aa['user']=_0x40134f['username'];_0x526688[_0xbaf3('0x3a')]=_0x3263aa[_0xbaf3('0x3b')]=_0x40134f[_0xbaf3('0x3a')];if(_0x40134f[_0xbaf3('0x3c')]){_0x526688[_0xbaf3('0x3c')]=_0x3263aa[_0xbaf3('0x3c')]=!![];_0x526688['CloudProviderId']=_0x3263aa[_0xbaf3('0x3d')]=_0x40134f[_0xbaf3('0x3d')];_0x526688[_0xbaf3('0x3a')]=_0x3263aa[_0xbaf3('0x3b')]=null;}else{_0x526688[_0xbaf3('0x3d')]=_0x3263aa[_0xbaf3('0x3d')]=null;}_0x526688[_0xbaf3('0x3e')]=getImapHost(_0x36f715);_0x526688[_0xbaf3('0x3f')]=0x3e1;_0x3263aa[_0xbaf3('0x3e')]=getSmtpHost(_0x36f715);_0x3263aa['port']=0x24b;_0x3263aa[_0xbaf3('0x40')]=![];_0x526688['service']=_0x3263aa[_0xbaf3('0x41')]=null;}else{if(_0x40134f[_0xbaf3('0x42')]){_0x526688[_0xbaf3('0x39')]=_0x3263aa['user']=_0x40134f['username'];_0x526688[_0xbaf3('0x3a')]=_0x3263aa[_0xbaf3('0x3b')]=_0x40134f[_0xbaf3('0x3a')];}else{_0x526688[_0xbaf3('0x42')]=_0x3263aa[_0xbaf3('0x42')]=![];_0x526688[_0xbaf3('0x39')]=_0x3263aa[_0xbaf3('0x39')]=null;_0x526688[_0xbaf3('0x3a')]=_0x3263aa[_0xbaf3('0x3b')]=null;}_0x526688[_0xbaf3('0x3e')]=_0x40134f['Imap'][_0xbaf3('0x3e')];_0x526688['port']=_0x40134f[_0xbaf3('0x43')]['port'];_0x3263aa[_0xbaf3('0x3e')]=_0x40134f[_0xbaf3('0x44')][_0xbaf3('0x3e')];_0x3263aa['port']=_0x40134f[_0xbaf3('0x44')][_0xbaf3('0x3f')];}return{'Imap':_0x526688,'Smtp':_0x3263aa};}exports[_0xbaf3('0x45')]=function(_0x4124ad,_0x1c9a60){var _0x223040={'include':[{'model':db[_0xbaf3('0x46')],'as':'Imap'},{'model':db[_0xbaf3('0x47')],'as':_0xbaf3('0x44')},{'model':db[_0xbaf3('0x48')],'as':_0xbaf3('0x49')}]},_0x56e2cc={},_0x1b8ea9={'count':0x0,'rows':[]};var _0xa9e6e3=_[_0xbaf3('0x4a')](db['MailAccount'][_0xbaf3('0x4b')],function(_0x16a61b){return{'name':_0x16a61b[_0xbaf3('0x4c')],'type':_0x16a61b[_0xbaf3('0x4d')][_0xbaf3('0x4e')]};});_0x56e2cc[_0xbaf3('0x4f')]=_[_0xbaf3('0x4a')](_0xa9e6e3,_0xbaf3('0x2b'));_0x56e2cc[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0x4124ad['query']);_0x56e2cc['filters']=_[_0xbaf3('0x52')](_0x56e2cc['model'],_0x56e2cc[_0xbaf3('0x50')]);_0x223040[_0xbaf3('0x53')]=_['intersection'](_0x56e2cc['model'],qs[_0xbaf3('0x54')](_0x4124ad[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x223040[_0xbaf3('0x53')]=_0x223040[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x223040['attributes']:_0x56e2cc[_0xbaf3('0x4f')];if(!_0x4124ad['query']['hasOwnProperty'](_0xbaf3('0x56'))){_0x223040[_0xbaf3('0x1f')]=qs[_0xbaf3('0x1f')](_0x4124ad[_0xbaf3('0x50')][_0xbaf3('0x1f')]);_0x223040[_0xbaf3('0x1d')]=qs[_0xbaf3('0x1d')](_0x4124ad['query'][_0xbaf3('0x1d')]);}_0x223040[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0x4124ad[_0xbaf3('0x50')][_0xbaf3('0x58')]);_0x223040[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_['pick'](_0x4124ad[_0xbaf3('0x50')],_0x56e2cc[_0xbaf3('0x5a')]),_0xa9e6e3);if(_0x4124ad[_0xbaf3('0x50')]['filter']){_0x223040['where']=_[_0xbaf3('0x5b')](_0x223040[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0xa9e6e3,function(_0x1f14ec){if(_0x1f14ec[_0xbaf3('0x4d')]!==_0xbaf3('0x5c')){var _0x528984={};_0x528984[_0x1f14ec[_0xbaf3('0x2b')]]={'$like':'%'+_0x4124ad[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0x528984;}})});}_0x223040=_[_0xbaf3('0x5b')]({},_0x223040,_0x4124ad[_0xbaf3('0x5e')]);var _0x2e31f1={'where':_0x223040['where']};return db['MailAccount'][_0xbaf3('0x20')](_0x2e31f1)[_0xbaf3('0x10')](function(_0x15ccd3){_0x1b8ea9[_0xbaf3('0x20')]=_0x15ccd3;if(_0x4124ad[_0xbaf3('0x50')][_0xbaf3('0x5f')]){_0x223040[_0xbaf3('0x60')]=[{'all':!![]}];}return db[_0xbaf3('0x61')]['findAll'](_0x223040);})['then'](function(_0x58d471){_0x1b8ea9[_0xbaf3('0x62')]=_0x58d471;return _0x1b8ea9;})[_0xbaf3('0x10')](respondWithFilteredResult(_0x1c9a60,_0x223040))['catch'](handleError(_0x1c9a60,null));};exports[_0xbaf3('0x63')]=function(_0x58d60d,_0x47eb8d){var _0x4955cb={'raw':![],'where':{'id':_0x58d60d['params']['id']},'include':[{'model':db[_0xbaf3('0x46')],'as':_0xbaf3('0x43')},{'model':db[_0xbaf3('0x47')],'as':'Smtp'},{'model':db[_0xbaf3('0x48')],'as':_0xbaf3('0x49')}]},_0x2fa6d0={};_0x2fa6d0[_0xbaf3('0x4f')]=_['keys'](db['MailAccount'][_0xbaf3('0x4b')]);_0x2fa6d0['query']=_[_0xbaf3('0x51')](_0x58d60d['query']);_0x2fa6d0[_0xbaf3('0x5a')]=_[_0xbaf3('0x52')](_0x2fa6d0[_0xbaf3('0x4f')],_0x2fa6d0[_0xbaf3('0x50')]);_0x4955cb[_0xbaf3('0x53')]=_[_0xbaf3('0x52')](_0x2fa6d0[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0x58d60d[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x4955cb[_0xbaf3('0x53')]=_0x4955cb[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x4955cb[_0xbaf3('0x53')]:_0x2fa6d0[_0xbaf3('0x4f')];if(_0x58d60d[_0xbaf3('0x50')]['includeAll']){_0x4955cb[_0xbaf3('0x60')]=[{'all':!![]}];}_0x4955cb=_[_0xbaf3('0x5b')]({},_0x4955cb,_0x58d60d[_0xbaf3('0x5e')]);return db[_0xbaf3('0x61')][_0xbaf3('0x64')](_0x4955cb)[_0xbaf3('0x10')](handleEntityNotFound(_0x47eb8d,null))[_0xbaf3('0x10')](respondWithResult(_0x47eb8d,null))[_0xbaf3('0x1a')](handleError(_0x47eb8d,null));};exports[_0xbaf3('0x24')]=function(_0x12c2b4,_0x331ff7){if(_0x12c2b4[_0xbaf3('0x65')]['id']){delete _0x12c2b4['body']['id'];}var _0x5da104=_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x66')]===_0xbaf3('0x67')?null:_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x66')];var _0x291a38=_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x43')]||{};var _0x198019=_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x44')]||{};if(_0x5da104){_0x291a38[_0xbaf3('0x3e')]=getImapHost(_0x5da104);_0x291a38['port']=0x3e1;_0x198019[_0xbaf3('0x3e')]=getSmtpHost(_0x5da104);_0x198019['port']=0x24b;_0x198019[_0xbaf3('0x40')]=![];}if(_0x198019['modernAuthentication']){_0x198019[_0xbaf3('0x40')]=![];}else{_0x198019[_0xbaf3('0x3d')]=null;}if(!_0x291a38[_0xbaf3('0x3c')])_0x291a38[_0xbaf3('0x3d')]=null;_0x12c2b4['body'][_0xbaf3('0x43')]=_0x291a38;_0x12c2b4['body'][_0xbaf3('0x44')]=_0x198019;return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0x12c2b4['params']['id']},'include':[{'model':db[_0xbaf3('0x46')],'as':_0xbaf3('0x43')},{'model':db['MailServerOut'],'as':_0xbaf3('0x44')},{'model':db[_0xbaf3('0x48')],'as':_0xbaf3('0x49')}]})[_0xbaf3('0x10')](handleEntityNotFound(_0x331ff7,null))[_0xbaf3('0x10')](function(_0x186391){if(!_0x186391)throw new Error('Mail\x20Account\x20not\x20found');if(_0x186391[_0xbaf3('0x41')])delete _0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x43')];return _0x186391;})[_0xbaf3('0x10')](saveUpdates(_0x12c2b4['body'],null))[_0xbaf3('0x10')](function(_0x1319cb){if(!_0x12c2b4['body'][_0xbaf3('0x43')])return _0x1319cb;return db[_0xbaf3('0x46')][_0xbaf3('0x24')](_0x12c2b4['body'][_0xbaf3('0x43')],{'where':{'MailAccountId':_0x1319cb['id']}})[_0xbaf3('0x10')](function(){return _0x1319cb;});})[_0xbaf3('0x10')](function(_0x2fa9b3){if(!_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x44')])return _0x2fa9b3;return db['MailServerOut'][_0xbaf3('0x24')](_0x12c2b4[_0xbaf3('0x65')][_0xbaf3('0x44')],{'where':{'MailAccountId':_0x2fa9b3['id']}})[_0xbaf3('0x10')](function(){return _0x2fa9b3;});})[_0xbaf3('0x10')](respondWithResult(_0x331ff7,null))[_0xbaf3('0x1a')](handleError(_0x331ff7,null));};exports['describe']=function(_0x5aebd4,_0x5974e9){return db['MailAccount'][_0xbaf3('0x68')]()[_0xbaf3('0x10')](respondWithResult(_0x5974e9,null))[_0xbaf3('0x1a')](handleError(_0x5974e9,null));};exports['addDisposition']=function(_0x2b4e56,_0x86d817){if(_0x2b4e56[_0xbaf3('0x65')]['id']){delete _0x2b4e56[_0xbaf3('0x65')]['id'];}return db[_0xbaf3('0x61')]['find']({'where':{'id':_0x2b4e56[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x86d817,null))[_0xbaf3('0x10')](function(_0xd7bc6a){if(_0xd7bc6a){_0x2b4e56[_0xbaf3('0x65')][_0xbaf3('0x6a')]=_0xd7bc6a['id'];return db[_0xbaf3('0x6b')][_0xbaf3('0x6c')](_0x2b4e56[_0xbaf3('0x65')]);}})['then'](respondWithResult(_0x86d817,null))[_0xbaf3('0x1a')](handleError(_0x86d817,null));};exports[_0xbaf3('0x6d')]=function(_0x47cd93,_0x5d64a9){var _0x3aa08c={'raw':![],'where':{}};var _0x13dd96={};var _0x2f7ec7={'count':0x0,'rows':[]};return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x47cd93[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x5d64a9,null))[_0xbaf3('0x10')](function(_0x5db6a7){if(_0x5db6a7){_0x13dd96[_0xbaf3('0x4f')]=_[_0xbaf3('0x51')](db[_0xbaf3('0x6b')]['rawAttributes']);_0x13dd96[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0x47cd93[_0xbaf3('0x50')]);_0x13dd96[_0xbaf3('0x5a')]=_[_0xbaf3('0x52')](_0x13dd96[_0xbaf3('0x4f')],_0x13dd96[_0xbaf3('0x50')]);_0x3aa08c[_0xbaf3('0x53')]=_['intersection'](_0x13dd96[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0x47cd93[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x3aa08c[_0xbaf3('0x53')]=_0x3aa08c[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x3aa08c['attributes']:_0x13dd96[_0xbaf3('0x4f')];if(!_0x47cd93['query'][_0xbaf3('0x6f')](_0xbaf3('0x56'))){_0x3aa08c['limit']=qs[_0xbaf3('0x1f')](_0x47cd93[_0xbaf3('0x50')][_0xbaf3('0x1f')]);_0x3aa08c[_0xbaf3('0x1d')]=qs[_0xbaf3('0x1d')](_0x47cd93[_0xbaf3('0x50')][_0xbaf3('0x1d')]);}_0x3aa08c[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0x47cd93[_0xbaf3('0x50')][_0xbaf3('0x58')]);_0x3aa08c[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_[_0xbaf3('0x70')](_0x47cd93[_0xbaf3('0x50')],_0x13dd96[_0xbaf3('0x5a')]));_0x3aa08c[_0xbaf3('0x59')][_0xbaf3('0x6a')]=_0x5db6a7['id'];if(_0x47cd93['query'][_0xbaf3('0x5d')]){_0x3aa08c['where']=_[_0xbaf3('0x5b')](_0x3aa08c[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0x3aa08c[_0xbaf3('0x53')],function(_0x423af9){var _0x768d4d={};_0x768d4d[_0x423af9]={'$like':'%'+_0x47cd93['query'][_0xbaf3('0x5d')]+'%'};return _0x768d4d;})});}_0x3aa08c=_[_0xbaf3('0x5b')]({},_0x3aa08c,_0x47cd93['options']);return db[_0xbaf3('0x6b')][_0xbaf3('0x20')]({'where':_0x3aa08c[_0xbaf3('0x59')]})['then'](function(_0x1a9ae3){_0x2f7ec7[_0xbaf3('0x20')]=_0x1a9ae3;if(_0x47cd93[_0xbaf3('0x50')]['includeAll']){_0x3aa08c[_0xbaf3('0x60')]=[{'all':!![]}];}return db['Disposition'][_0xbaf3('0x71')](_0x3aa08c);})[_0xbaf3('0x10')](function(_0x55eb14){_0x2f7ec7[_0xbaf3('0x62')]=_0x55eb14;return _0x2f7ec7;});}})[_0xbaf3('0x10')](respondWithFilteredResult(_0x5d64a9,_0x3aa08c))[_0xbaf3('0x1a')](handleError(_0x5d64a9,null));};exports[_0xbaf3('0x72')]=function(_0xfeb19c,_0x3ad7fa){return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0xfeb19c['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x3ad7fa,null))[_0xbaf3('0x10')](function(_0x33ba41){if(_0x33ba41){return _0x33ba41[_0xbaf3('0x72')](_0xfeb19c[_0xbaf3('0x50')][_0xbaf3('0x73')]);}})[_0xbaf3('0x10')](respondWithStatusCode(_0x3ad7fa,null))[_0xbaf3('0x1a')](handleError(_0x3ad7fa,null));};exports['addAnswer']=function(_0x2f7f8d,_0x77ec04){if(_0x2f7f8d[_0xbaf3('0x65')]['id']){delete _0x2f7f8d['body']['id'];}return db['MailAccount'][_0xbaf3('0x64')]({'where':{'id':_0x2f7f8d['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x77ec04,null))[_0xbaf3('0x10')](function(_0x586bd5){if(_0x586bd5){_0x2f7f8d[_0xbaf3('0x65')]['MailAccountId']=_0x586bd5['id'];return db[_0xbaf3('0x74')][_0xbaf3('0x6c')](_0x2f7f8d[_0xbaf3('0x65')]);}})[_0xbaf3('0x10')](respondWithResult(_0x77ec04,null))['catch'](handleError(_0x77ec04,null));};exports[_0xbaf3('0x75')]=function(_0x32b2b3,_0x111f80){var _0x444deb={'raw':![],'where':{}};var _0x27e816={};var _0x57c6c0={'count':0x0,'rows':[]};return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x32b2b3[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x111f80,null))[_0xbaf3('0x10')](function(_0x2a17b8){if(_0x2a17b8){_0x27e816['model']=_[_0xbaf3('0x51')](db[_0xbaf3('0x74')][_0xbaf3('0x4b')]);_0x27e816[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0x32b2b3[_0xbaf3('0x50')]);_0x27e816[_0xbaf3('0x5a')]=_['intersection'](_0x27e816[_0xbaf3('0x4f')],_0x27e816[_0xbaf3('0x50')]);_0x444deb[_0xbaf3('0x53')]=_[_0xbaf3('0x52')](_0x27e816[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0x32b2b3[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x444deb[_0xbaf3('0x53')]=_0x444deb[_0xbaf3('0x53')]['length']?_0x444deb['attributes']:_0x27e816['model'];if(!_0x32b2b3[_0xbaf3('0x50')]['hasOwnProperty'](_0xbaf3('0x56'))){_0x444deb[_0xbaf3('0x1f')]=qs[_0xbaf3('0x1f')](_0x32b2b3[_0xbaf3('0x50')][_0xbaf3('0x1f')]);_0x444deb['offset']=qs[_0xbaf3('0x1d')](_0x32b2b3['query'][_0xbaf3('0x1d')]);}_0x444deb[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0x32b2b3[_0xbaf3('0x50')][_0xbaf3('0x58')]);_0x444deb[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_[_0xbaf3('0x70')](_0x32b2b3[_0xbaf3('0x50')],_0x27e816[_0xbaf3('0x5a')]));_0x444deb['where']['MailAccountId']=_0x2a17b8['id'];if(_0x32b2b3[_0xbaf3('0x50')]['filter']){_0x444deb[_0xbaf3('0x59')]=_['merge'](_0x444deb[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0x444deb[_0xbaf3('0x53')],function(_0x4c8b01){var _0x2eec64={};_0x2eec64[_0x4c8b01]={'$like':'%'+_0x32b2b3[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0x2eec64;})});}_0x444deb=_[_0xbaf3('0x5b')]({},_0x444deb,_0x32b2b3[_0xbaf3('0x5e')]);return db[_0xbaf3('0x74')][_0xbaf3('0x20')]({'where':_0x444deb['where']})[_0xbaf3('0x10')](function(_0xd5f58d){_0x57c6c0[_0xbaf3('0x20')]=_0xd5f58d;if(_0x32b2b3[_0xbaf3('0x50')][_0xbaf3('0x5f')]){_0x444deb[_0xbaf3('0x60')]=[{'all':!![]}];}return db[_0xbaf3('0x74')]['findAll'](_0x444deb);})[_0xbaf3('0x10')](function(_0x4900a9){_0x57c6c0[_0xbaf3('0x62')]=_0x4900a9;return _0x57c6c0;});}})['then'](respondWithFilteredResult(_0x111f80,_0x444deb))[_0xbaf3('0x1a')](handleError(_0x111f80,null));};exports[_0xbaf3('0x76')]=function(_0x10edaf,_0x552fd9){return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0x10edaf[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x552fd9,null))['then'](function(_0x1a31fc){if(_0x1a31fc){return _0x1a31fc[_0xbaf3('0x76')](_0x10edaf[_0xbaf3('0x50')]['ids']);}})[_0xbaf3('0x10')](respondWithStatusCode(_0x552fd9,null))['catch'](handleError(_0x552fd9,null));};exports[_0xbaf3('0x6c')]=function(_0x269367,_0x57b181){var _0x147e47={'name':_0x269367[_0xbaf3('0x65')][_0xbaf3('0x2b')],'key':_0x269367[_0xbaf3('0x65')]['key'],'provider':_0x269367[_0xbaf3('0x65')][_0xbaf3('0x66')]===_0xbaf3('0x67')?null:_0x269367[_0xbaf3('0x65')][_0xbaf3('0x66')],'email':_0x269367['body'][_0xbaf3('0x77')],'ListId':_0x269367[_0xbaf3('0x65')][_0xbaf3('0x78')],'active':!_[_0xbaf3('0x79')](_0x269367[_0xbaf3('0x65')]['active'])?_0x269367[_0xbaf3('0x65')][_0xbaf3('0x7a')]:!![],'description':_0x269367[_0xbaf3('0x65')][_0xbaf3('0x7b')]||null};var _0x5a62d5=getAuthenticationOptions(_0x147e47[_0xbaf3('0x66')],_0x269367['body']);_0x147e47[_0xbaf3('0x43')]=_0x5a62d5[_0xbaf3('0x43')];_0x147e47[_0xbaf3('0x44')]=_0x5a62d5[_0xbaf3('0x44')];return db[_0xbaf3('0x61')][_0xbaf3('0x6c')](_0x147e47,{'include':[{'model':db['MailServerOut'],'as':_0xbaf3('0x44')},{'model':db[_0xbaf3('0x46')],'as':'Imap'}]})[_0xbaf3('0x10')](function(_0x33fe1c){var _0x229435=_0x269367[_0xbaf3('0x39')][_0xbaf3('0x26')]({'plain':!![]});if(!_0x229435)throw new Error(_0xbaf3('0x7c'));if(_0x229435[_0xbaf3('0x7d')]===_0xbaf3('0x39')){var _0x5ee553=_0x33fe1c[_0xbaf3('0x26')]({'plain':!![]});return db[_0xbaf3('0x7e')][_0xbaf3('0x64')]({'where':{'name':_0xbaf3('0x27'),'userProfileId':_0x229435[_0xbaf3('0x7f')]},'raw':!![]})[_0xbaf3('0x10')](function(_0x157876){if(_0x157876&&_0x157876[_0xbaf3('0x80')]===0x0){return db['UserProfileResource'][_0xbaf3('0x6c')]({'name':_0x5ee553['name'],'resourceId':_0x5ee553['id'],'type':_0x157876[_0xbaf3('0x2b')],'sectionId':_0x157876['id']},{})[_0xbaf3('0x10')](function(){return _0x33fe1c;});}else{return _0x33fe1c;}})[_0xbaf3('0x1a')](function(_0x60212){logger[_0xbaf3('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x60212);throw _0x60212;});}return _0x33fe1c;})[_0xbaf3('0x10')](respondWithResult(_0x57b181,0xc9))[_0xbaf3('0x1a')](handleError(_0x57b181,null));};exports[_0xbaf3('0x81')]=function(_0x84bc88,_0x261fcd){return db['MailAccount'][_0xbaf3('0x6e')]({'where':{'id':_0x84bc88['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x261fcd,null))[_0xbaf3('0x10')](function(_0x5449bd){if(_0x5449bd){return _0x5449bd[_0xbaf3('0x81')]();}return null;})[_0xbaf3('0x10')](respondWithResult(_0x261fcd,null))[_0xbaf3('0x1a')](handleError(_0x261fcd,null));};exports['addImap']=function(_0x4dd999,_0x52cd89){if(_0x4dd999['body']['id']){delete _0x4dd999[_0xbaf3('0x65')]['id'];}return db['MailAccount'][_0xbaf3('0x64')]({'where':{'id':_0x4dd999[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x52cd89,null))['then'](function(_0x108da6){if(_0x108da6){_0x4dd999['body'][_0xbaf3('0x6a')]=_0x108da6['id'];return db[_0xbaf3('0x46')][_0xbaf3('0x6c')](_0x4dd999['body']);}})[_0xbaf3('0x10')](respondWithResult(_0x52cd89,null))[_0xbaf3('0x1a')](handleError(_0x52cd89,null));};exports[_0xbaf3('0x82')]=function(_0x52ae48,_0x10af18){return db[_0xbaf3('0x61')]['findOne']({'where':{'id':_0x52ae48['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x10af18,null))[_0xbaf3('0x10')](function(_0x41140c){if(_0x41140c){return _0x41140c[_0xbaf3('0x83')](null);}return null;})[_0xbaf3('0x10')](respondWithStatusCode(_0x10af18,null))[_0xbaf3('0x1a')](handleError(_0x10af18,null));};exports[_0xbaf3('0x84')]=function(_0x2c45c9,_0x4b9d37){return db['MailAccount'][_0xbaf3('0x6e')]({'where':{'id':_0x2c45c9[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x4b9d37,null))['then'](function(_0x5f5199){if(_0x5f5199){return _0x5f5199[_0xbaf3('0x84')]();}return null;})[_0xbaf3('0x10')](respondWithResult(_0x4b9d37,null))[_0xbaf3('0x1a')](handleError(_0x4b9d37,null));};exports[_0xbaf3('0x85')]=function(_0x28ec16,_0x52aad5){if(_0x28ec16[_0xbaf3('0x65')]['id']){delete _0x28ec16[_0xbaf3('0x65')]['id'];}return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0x28ec16['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x52aad5,null))[_0xbaf3('0x10')](function(_0x4daebe){if(_0x4daebe){_0x28ec16['body'][_0xbaf3('0x6a')]=_0x4daebe['id'];return db[_0xbaf3('0x47')][_0xbaf3('0x6c')](_0x28ec16['body']);}})['then'](respondWithResult(_0x52aad5,null))['catch'](handleError(_0x52aad5,null));};exports[_0xbaf3('0x86')]=function(_0x1628cd,_0x34386c){return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x1628cd['params']['id']}})['then'](handleEntityNotFound(_0x34386c,null))[_0xbaf3('0x10')](function(_0x1a8195){if(_0x1a8195){return _0x1a8195[_0xbaf3('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x34386c,null))[_0xbaf3('0x1a')](handleError(_0x34386c,null));};exports[_0xbaf3('0x88')]=function(_0x2b3326,_0x3bfe8b){return db['MailInteraction'][_0xbaf3('0x64')]({'where':{'id':_0x2b3326[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x3bfe8b,null))[_0xbaf3('0x10')](function(_0x213f83){if(_0x213f83){return _0x213f83[_0xbaf3('0x88')](_0x2b3326[_0xbaf3('0x65')][_0xbaf3('0x73')],_[_0xbaf3('0x89')](_0x2b3326[_0xbaf3('0x65')],[_0xbaf3('0x73'),'id'])||{});}})['then'](respondWithResult(_0x3bfe8b,null))[_0xbaf3('0x1a')](handleError(_0x3bfe8b,null));};exports['getInteractions']=function(_0x126970,_0x2af455){var _0x142829={'raw':![],'where':{}};var _0x401d3a={};var _0x5d58ea={'count':0x0,'rows':[]};return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x126970[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x2af455,null))[_0xbaf3('0x10')](function(_0x3d5796){if(_0x3d5796){_0x401d3a[_0xbaf3('0x4f')]=_[_0xbaf3('0x51')](db[_0xbaf3('0x8a')][_0xbaf3('0x4b')]);_0x401d3a['query']=_[_0xbaf3('0x51')](_0x126970[_0xbaf3('0x50')]);_0x401d3a[_0xbaf3('0x5a')]=_[_0xbaf3('0x52')](_0x401d3a[_0xbaf3('0x4f')],_0x401d3a[_0xbaf3('0x50')]);_0x142829[_0xbaf3('0x53')]=_['intersection'](_0x401d3a[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0x126970['query']['fields']));_0x142829['attributes']=_0x142829[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x142829[_0xbaf3('0x53')]:_0x401d3a[_0xbaf3('0x4f')];if(!_0x126970[_0xbaf3('0x50')][_0xbaf3('0x6f')]('nolimit')){_0x142829[_0xbaf3('0x1f')]=qs['limit'](_0x126970[_0xbaf3('0x50')][_0xbaf3('0x1f')]);_0x142829['offset']=qs[_0xbaf3('0x1d')](_0x126970['query'][_0xbaf3('0x1d')]);}_0x142829['order']=qs[_0xbaf3('0x58')](_0x126970['query'][_0xbaf3('0x58')]);_0x142829['where']=qs[_0xbaf3('0x5a')](_[_0xbaf3('0x70')](_0x126970['query'],_0x401d3a[_0xbaf3('0x5a')]));_0x142829[_0xbaf3('0x59')][_0xbaf3('0x6a')]=_0x3d5796['id'];if(_0x126970[_0xbaf3('0x50')][_0xbaf3('0x5d')]){_0x142829[_0xbaf3('0x59')]=_[_0xbaf3('0x5b')](_0x142829['where'],{'$or':_['map'](_0x142829[_0xbaf3('0x53')],function(_0x745885){var _0x2875cc={};_0x2875cc[_0x745885]={'$like':'%'+_0x126970[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0x2875cc;})});}_0x142829=_[_0xbaf3('0x5b')]({},_0x142829,_0x126970[_0xbaf3('0x5e')]);return db[_0xbaf3('0x8a')][_0xbaf3('0x20')]({'where':_0x142829['where']})[_0xbaf3('0x10')](function(_0x24f190){_0x5d58ea[_0xbaf3('0x20')]=_0x24f190;if(_0x126970[_0xbaf3('0x50')][_0xbaf3('0x5f')]){_0x142829[_0xbaf3('0x60')]=[{'model':db[_0xbaf3('0x8b')],'as':_0xbaf3('0x8c'),'required':![]},{'model':db[_0xbaf3('0x8d')],'as':_0xbaf3('0x8e'),'attributes':[_0xbaf3('0x2b'),_0xbaf3('0x8f'),_0xbaf3('0x90')],'required':![]},{'model':db['Tag'],'as':_0xbaf3('0x91'),'attributes':['id',_0xbaf3('0x2b'),_0xbaf3('0x92')],'where':_0x126970[_0xbaf3('0x50')][_0xbaf3('0x93')]?{'id':_0x126970[_0xbaf3('0x50')][_0xbaf3('0x93')]}:undefined,'required':_0x126970[_0xbaf3('0x50')][_0xbaf3('0x93')]?!![]:![]}];}return db[_0xbaf3('0x8a')][_0xbaf3('0x71')](_0x142829);})['then'](function(_0x129c06){_0x5d58ea[_0xbaf3('0x62')]=_0x129c06;return _0x5d58ea;});}})['then'](respondWithFilteredResult(_0x2af455,_0x142829))[_0xbaf3('0x1a')](handleError(_0x2af455,null));};exports[_0xbaf3('0x94')]=function addApplications(_0x54e1d6,_0x4c84d5){var _0x16a23a=_0x54e1d6[_0xbaf3('0x69')]['id'];var _0x383c60=_0x54e1d6[_0xbaf3('0x65')];var _0x2a6161=0xc8;var _0x55d8c5=null;return db[_0xbaf3('0x95')][_0xbaf3('0x96')]({'isolationLevel':db[_0xbaf3('0x95')][_0xbaf3('0x97')][_0xbaf3('0x98')]['READ_COMMITTED']},function(_0x33791c){return db['MailAccount'][_0xbaf3('0x6e')]({'where':{'id':_0x16a23a},'transaction':_0x33791c})[_0xbaf3('0x10')](function(_0x33ce26){if(_0x33ce26){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x16a23a},'transaction':_0x33791c})['then'](function(){var _0x3fa103=_[_0xbaf3('0x4a')](_0x383c60,function(_0x40faed){_0x40faed[_0xbaf3('0x6a')]=_0x16a23a;return _0x40faed;});return db[_0xbaf3('0x99')][_0xbaf3('0x9a')](_0x3fa103,{'transaction':_0x33791c});});}else{_0x2a6161=0x194;_0x55d8c5=[];}});})[_0xbaf3('0x10')](function(){if(_0x2a6161!==0x194){return db['MailApplication'][_0xbaf3('0x9b')]({'where':{'MailAccountId':_0x16a23a},'order':_0xbaf3('0x9c')})[_0xbaf3('0x10')](function(_0x114147){_0x55d8c5=_0x114147;});}})[_0xbaf3('0x1a')](function(_0x5d8776){_0x2a6161=0x1f4;logger[_0xbaf3('0x17')](_0x5d8776[_0xbaf3('0x2a')]);if(_0x5d8776['name']){delete _0x5d8776['name'];}_0x55d8c5=_0x5d8776;})[_0xbaf3('0x9d')](function(){if(_0x55d8c5===null){_0x4c84d5[_0xbaf3('0x29')](_0x2a6161);}else{if(_0x2a6161===0x1f4){_0x4c84d5[_0xbaf3('0x21')](_0x2a6161)[_0xbaf3('0x9e')](_0x55d8c5);}else{_0x4c84d5['status'](_0x2a6161)[_0xbaf3('0x1c')](_0x55d8c5);}}});};exports[_0xbaf3('0x9f')]=function(_0xfdcde0,_0x46151b){var _0x24b33a={};var _0x374025={};var _0x48033a;var _0x5dcf29;return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0xfdcde0[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x46151b,null))[_0xbaf3('0x10')](function(_0x704958){if(_0x704958){_0x48033a=_0x704958;_0x374025[_0xbaf3('0x4f')]=_[_0xbaf3('0x51')](db['MailApplication'][_0xbaf3('0x4b')]);_0x374025[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0xfdcde0[_0xbaf3('0x50')]);_0x374025[_0xbaf3('0x5a')]=_['intersection'](_0x374025['model'],_0x374025['query']);_0x24b33a['attributes']=_[_0xbaf3('0x52')](_0x374025[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0xfdcde0['query'][_0xbaf3('0x54')]));_0x24b33a[_0xbaf3('0x53')]=_0x24b33a[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x24b33a[_0xbaf3('0x53')]:_0x374025['model'];_0x24b33a[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0xfdcde0['query'][_0xbaf3('0x58')]);_0x24b33a[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_[_0xbaf3('0x70')](_0xfdcde0['query'],_0x374025[_0xbaf3('0x5a')]));if(_0xfdcde0[_0xbaf3('0x50')][_0xbaf3('0x5d')]){_0x24b33a[_0xbaf3('0x59')]=_[_0xbaf3('0x5b')](_0x24b33a[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0x24b33a['attributes'],function(_0x5f34b5){var _0x10861c={};_0x10861c[_0x5f34b5]={'$like':'%'+_0xfdcde0[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0x10861c;})});}_0x24b33a=_['merge']({},_0x24b33a,_0xfdcde0[_0xbaf3('0x5e')]);return _0x48033a[_0xbaf3('0x9f')](_0x24b33a);}})[_0xbaf3('0x10')](function(_0x1938ef){if(_0x1938ef){_0x5dcf29=_0x1938ef['length'];if(!_0xfdcde0[_0xbaf3('0x50')][_0xbaf3('0x6f')](_0xbaf3('0x56'))){_0x24b33a['limit']=qs[_0xbaf3('0x1f')](_0xfdcde0['query'][_0xbaf3('0x1f')]);_0x24b33a[_0xbaf3('0x1d')]=qs['offset'](_0xfdcde0[_0xbaf3('0x50')]['offset']);}return _0x48033a[_0xbaf3('0x9f')](_0x24b33a);}})['then'](function(_0x5ef35c){if(_0x5ef35c){return _0x5ef35c?{'count':_0x5dcf29,'rows':_0x5ef35c}:null;}})[_0xbaf3('0x10')](respondWithResult(_0x46151b,null))[_0xbaf3('0x1a')](handleError(_0x46151b,null));};exports[_0xbaf3('0xa0')]=function(_0x4ac692,_0x3ee958){var _0x2d582e={'raw':!![],'where':{}};var _0x502db7={};var _0x1c406f={'count':0x0,'rows':[]};return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x4ac692[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x3ee958,null))['then'](function(_0x2de7ea){if(_0x2de7ea){_0x502db7[_0xbaf3('0x4f')]=_['keys'](db[_0xbaf3('0xa1')][_0xbaf3('0x4b')]);_0x502db7[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0x4ac692[_0xbaf3('0x50')]);_0x502db7[_0xbaf3('0x5a')]=_['intersection'](_0x502db7[_0xbaf3('0x4f')],_0x502db7[_0xbaf3('0x50')]);_0x2d582e[_0xbaf3('0x53')]=_[_0xbaf3('0x52')](_0x502db7[_0xbaf3('0x4f')],qs['fields'](_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x2d582e[_0xbaf3('0x53')]=_0x2d582e['attributes'][_0xbaf3('0x55')]?_0x2d582e[_0xbaf3('0x53')]:_0x502db7['model'];if(!_0x4ac692['query']['hasOwnProperty'](_0xbaf3('0x56'))){_0x2d582e[_0xbaf3('0x1f')]=qs['limit'](_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0x1f')]);_0x2d582e[_0xbaf3('0x1d')]=qs['offset'](_0x4ac692[_0xbaf3('0x50')]['offset']);}_0x2d582e[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0x58')]);_0x2d582e[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_[_0xbaf3('0x70')](_0x4ac692[_0xbaf3('0x50')],_0x502db7[_0xbaf3('0x5a')]));_0x2d582e[_0xbaf3('0x59')][_0xbaf3('0x6a')]=_0x2de7ea['id'];if(_0x4ac692['query'][_0xbaf3('0x5d')]){_0x2d582e[_0xbaf3('0x59')]=_[_0xbaf3('0x5b')](_0x2d582e[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0x2d582e[_0xbaf3('0x53')],function(_0x2a4ed4){var _0xb25ffa={};_0xb25ffa[_0x2a4ed4]={'$like':'%'+_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0xb25ffa;})});}if(_0x4ac692[_0xbaf3('0x50')]['$gte']){var _0x32b2b4=_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0xa2')][_0xbaf3('0xa3')](',');var _0x31ffa6={};_0x31ffa6[_0x32b2b4[0x0]]={'$gte':moment(_0x32b2b4[0x1])[_0xbaf3('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2d582e[_0xbaf3('0x59')]=_[_0xbaf3('0x5b')](_0x2d582e[_0xbaf3('0x59')],_0x31ffa6);}_0x2d582e=_['merge']({},_0x2d582e,_0x4ac692[_0xbaf3('0x5e')]);return db[_0xbaf3('0xa1')][_0xbaf3('0x20')]({'where':_0x2d582e[_0xbaf3('0x59')]})['then'](function(_0x573aa2){_0x1c406f['count']=_0x573aa2;if(_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0x5f')]){_0x2d582e[_0xbaf3('0x60')]=[{'all':!![]}];}return db[_0xbaf3('0xa1')][_0xbaf3('0x71')](_0x2d582e);})[_0xbaf3('0x10')](function(_0x3f8662){if(_0x4ac692[_0xbaf3('0x50')][_0xbaf3('0xa5')]===_0xbaf3('0xa6')){for(var _0x59a9c4=0x0;_0x59a9c4<_0x3f8662[_0xbaf3('0x55')];_0x59a9c4++){_0x3f8662[_0x59a9c4]['body']=juice(_0x3f8662[_0x59a9c4][_0xbaf3('0x65')]);}}_0x1c406f[_0xbaf3('0x62')]=_0x3f8662;return _0x1c406f;});}})[_0xbaf3('0x10')](respondWithFilteredResult(_0x3ee958,_0x2d582e))[_0xbaf3('0x1a')](handleError(_0x3ee958,null));};exports[_0xbaf3('0x9e')]=function(_0x4a0a93,_0x23f84e){var _0x12104c,_0x126c3c={},_0x226fde;if(_0x4a0a93['body']['to']){_0x226fde=_0x4a0a93[_0xbaf3('0x65')]['to']['split'](',')[0x0];}return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0x4a0a93['params']['id']},'include':[{'model':db[_0xbaf3('0xa7')],'as':_0xbaf3('0xa8'),'include':[{'model':db['CmContact'],'as':_0xbaf3('0xa9'),'where':{'email':_0x226fde},'limit':0x1,'order':[[_0xbaf3('0xaa'),_0xbaf3('0xab')]]}]},{'model':db[_0xbaf3('0x47')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xbaf3('0xac')],'as':_0xbaf3('0xac'),'raw':!![]}]}]})[_0xbaf3('0x10')](handleEntityNotFound(_0x23f84e,null))[_0xbaf3('0x10')](function(_0x456cb8){if(!_0x456cb8)return;_0x12104c=_0x456cb8;if(!_0x456cb8[_0xbaf3('0x44')])throw new Error(_0xbaf3('0xad'));if(_[_0xbaf3('0x79')](_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xae')])){_0x4a0a93['body']['from']=util[_0xbaf3('0xa4')](_0xbaf3('0xaf'),_0x456cb8[_0xbaf3('0x2b')],_0x456cb8[_0xbaf3('0x77')]||_0x456cb8[_0xbaf3('0x44')][_0xbaf3('0x39')]);}if(_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xb0')]&&_0x4a0a93['body'][_0xbaf3('0xb0')]['length']){for(var _0x363b72=0x0;_0x363b72<_0x4a0a93['body']['attachments']['length'];_0x363b72+=0x1){_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xb0')][_0x363b72]={'filename':_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xb0')][_0x363b72]['name'],'path':path[_0xbaf3('0xb1')](config[_0xbaf3('0xb2')],'server/files/attachments',_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xb0')][_0x363b72][_0xbaf3('0xb3')])};}}var _0x4f9d44=_0x456cb8[_0xbaf3('0xb4')]();return respondWithRpcPromise(_0xbaf3('0xb5'),_0xbaf3('0xb6'),{'account':_0x4f9d44,'message':_0x4a0a93[_0xbaf3('0x65')]});})['then'](function(_0x266b4f){if(!_0x266b4f)return;_0x126c3c=_0x266b4f;if(!_0x12104c['List'])throw new Error('List\x20not\x20found');if(_0x12104c[_0xbaf3('0xa8')][_0xbaf3('0xa9')][_0xbaf3('0x55')])return _0x12104c['List'][_0xbaf3('0xa9')][0x0];return db['CmContact'][_0xbaf3('0x6c')](_[_0xbaf3('0xb7')](_0x4a0a93[_0xbaf3('0x65')],{'firstName':_0x4a0a93[_0xbaf3('0x65')]['to'],'email':_0x4a0a93['body']['to'],'phone':_0x4a0a93['body']['to'],'ListId':_0x12104c['ListId']}));})[_0xbaf3('0x10')](function(_0x4def9a){if(!_0x4def9a)return;var _0x2c961f={'UserId':_0x4a0a93['user']['id'],'ContactId':_0x4def9a['id'],'MailAccountId':_0x12104c['id'],'inReplyTo':_0x126c3c[_0xbaf3('0xb8')],'to':_0x4a0a93['body'][_0xbaf3('0xae')],'cc':_0x4a0a93['body']['cc'],'subject':_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xb9')],'attach':_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xba')],'firstMsgDirection':_0xbaf3('0xbb'),'lastMsgAt':moment()['format'](_0xbaf3('0xbc')),'lastMsgDirection':_0xbaf3('0xbb'),'Messages':[_[_0xbaf3('0x5b')](_0x4a0a93[_0xbaf3('0x65')],{'messageId':_0x126c3c[_0xbaf3('0xb8')],'sentAt':moment()[_0xbaf3('0xa4')](_0xbaf3('0xbc')),'read':!![],'MailAccountId':_0x12104c['id'],'UserId':_0x4a0a93[_0xbaf3('0x39')]['id'],'ContactId':_0x4def9a['id']})]};if(_0x4a0a93['body']['Interaction']){_0x2c961f=_[_0xbaf3('0x5b')](_0x2c961f,_0x4a0a93[_0xbaf3('0x65')][_0xbaf3('0xbd')]);}return db[_0xbaf3('0x8a')]['create'](_0x2c961f,{'include':[{'model':db['MailMessage'],'as':_0xbaf3('0xbe')}]});})[_0xbaf3('0x10')](respondWithResult(_0x23f84e,null))[_0xbaf3('0x1a')](handleError(_0x23f84e,null));};exports[_0xbaf3('0xbf')]=function(_0x4df98d,_0x229290){return db['MailAccount'][_0xbaf3('0x64')]({'where':{'id':_0x4df98d['params']['id']},'include':[{'model':db[_0xbaf3('0x47')],'as':_0xbaf3('0x44'),'raw':!![],'include':[{'model':db[_0xbaf3('0xac')],'as':_0xbaf3('0xac'),'raw':!![]}]}]})[_0xbaf3('0x10')](handleEntityNotFound(_0x229290,null))[_0xbaf3('0x10')](function(_0x3ff65b){if(!_0x3ff65b[_0xbaf3('0x44')])return;var _0x288d2f=_0x3ff65b['getSmtpOptions']();return respondWithRpcPromise(_0xbaf3('0xc0'),_0xbaf3('0xbf'),{'account':_0x288d2f});})[_0xbaf3('0x10')](respondWithResult(_0x229290,null))[_0xbaf3('0x1a')](handleError(_0x229290,null));};exports[_0xbaf3('0x25')]=function(_0x15f51c,_0x910928){return db['MailAccount']['find']({'where':{'id':_0x15f51c[_0xbaf3('0x69')]['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x910928,null))[_0xbaf3('0x10')](function(_0x1aaf95){if(_0x1aaf95&&_0x1aaf95[_0xbaf3('0x41')]){throw new db['Sequelize'][(_0xbaf3('0xc1'))](_0xbaf3('0xc2'));}return _0x1aaf95;})['then'](removeEntity(_0x910928,null))[_0xbaf3('0x1a')](handleError(_0x910928,null));};exports[_0xbaf3('0xc3')]=function(_0x41f1bd,_0x5991b4){return db[_0xbaf3('0x61')]['find']({'where':{'id':_0x41f1bd[_0xbaf3('0x69')]['id']}})['then'](handleEntityNotFound(_0x5991b4,null))[_0xbaf3('0x10')](function(_0x588c8c){if(_0x588c8c){return _0x588c8c['addAgents'](_0x41f1bd[_0xbaf3('0x65')]['ids'],_[_0xbaf3('0x89')](_0x41f1bd[_0xbaf3('0x65')],['ids','id'])||{})[_0xbaf3('0xc4')](function(_0x57e2bc){for(var _0x399767=0x0;_0x399767<_0x41f1bd[_0xbaf3('0x65')][_0xbaf3('0x73')][_0xbaf3('0x55')];_0x399767+=0x1){socket[_0xbaf3('0xc5')](_0xbaf3('0xc6'),{'UserId':Number(_0x41f1bd[_0xbaf3('0x65')][_0xbaf3('0x73')][_0x399767]),'MailAccountId':Number(_0x41f1bd[_0xbaf3('0x69')]['id'])});}return _0x57e2bc;});}})[_0xbaf3('0x10')](respondWithResult(_0x5991b4,null))[_0xbaf3('0x1a')](handleError(_0x5991b4,null));};exports[_0xbaf3('0xc7')]=function(_0x4cc67b,_0x14aed7){return db[_0xbaf3('0x61')][_0xbaf3('0x64')]({'where':{'id':_0x4cc67b['params']['id']}})[_0xbaf3('0x10')](handleEntityNotFound(_0x14aed7,null))[_0xbaf3('0x10')](function(_0x231924){if(_0x231924){return _0x231924['removeAgents'](_0x4cc67b[_0xbaf3('0x50')][_0xbaf3('0x73')])[_0xbaf3('0x10')](function(){if(_[_0xbaf3('0xc8')](_0x4cc67b[_0xbaf3('0x50')][_0xbaf3('0x73')])){for(var _0x48ebd0=0x0;_0x48ebd0<_0x4cc67b[_0xbaf3('0x50')]['ids'][_0xbaf3('0x55')];_0x48ebd0+=0x1){socket['emit'](_0xbaf3('0xc9'),{'UserId':Number(_0x4cc67b[_0xbaf3('0x50')][_0xbaf3('0x73')][_0x48ebd0]),'MailAccountId':Number(_0x4cc67b[_0xbaf3('0x69')]['id'])});}}else{socket[_0xbaf3('0xc5')](_0xbaf3('0xc9'),{'UserId':Number(_0x4cc67b['query'][_0xbaf3('0x73')]),'MailAccountId':Number(_0x4cc67b[_0xbaf3('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0x14aed7,null))[_0xbaf3('0x1a')](handleError(_0x14aed7,null));};exports[_0xbaf3('0xca')]=function(_0x18383c,_0x37d0ea){var _0x5e552b={};var _0x1b44f6={};var _0x5b7051;var _0x13ff21;return db[_0xbaf3('0x61')][_0xbaf3('0x6e')]({'where':{'id':_0x18383c['params']['id']}})['then'](handleEntityNotFound(_0x37d0ea,null))[_0xbaf3('0x10')](function(_0x575264){if(_0x575264){_0x5b7051=_0x575264;_0x1b44f6[_0xbaf3('0x4f')]=_['keys'](db[_0xbaf3('0x8d')][_0xbaf3('0x4b')]);_0x1b44f6[_0xbaf3('0x50')]=_[_0xbaf3('0x51')](_0x18383c[_0xbaf3('0x50')]);_0x1b44f6[_0xbaf3('0x5a')]=_['intersection'](_0x1b44f6['model'],_0x1b44f6['query']);_0x5e552b[_0xbaf3('0x53')]=_[_0xbaf3('0x52')](_0x1b44f6[_0xbaf3('0x4f')],qs[_0xbaf3('0x54')](_0x18383c[_0xbaf3('0x50')][_0xbaf3('0x54')]));_0x5e552b['attributes']=_0x5e552b[_0xbaf3('0x53')][_0xbaf3('0x55')]?_0x5e552b[_0xbaf3('0x53')]:_0x1b44f6[_0xbaf3('0x4f')];_0x5e552b[_0xbaf3('0x57')]=qs[_0xbaf3('0x58')](_0x18383c[_0xbaf3('0x50')]['sort']);_0x5e552b[_0xbaf3('0x59')]=qs[_0xbaf3('0x5a')](_['pick'](_0x18383c[_0xbaf3('0x50')],_0x1b44f6[_0xbaf3('0x5a')]));if(_0x18383c[_0xbaf3('0x50')][_0xbaf3('0x5d')]){_0x5e552b[_0xbaf3('0x59')]=_['merge'](_0x5e552b[_0xbaf3('0x59')],{'$or':_[_0xbaf3('0x4a')](_0x5e552b[_0xbaf3('0x53')],function(_0x3977ea){var _0x26b66c={};_0x26b66c[_0x3977ea]={'$like':'%'+_0x18383c[_0xbaf3('0x50')][_0xbaf3('0x5d')]+'%'};return _0x26b66c;})});}_0x5e552b=_[_0xbaf3('0x5b')]({},_0x5e552b,_0x18383c['options']);return _0x5b7051[_0xbaf3('0xca')](_0x5e552b);}})['then'](function(_0x59b1ba){if(_0x59b1ba){_0x13ff21=_0x59b1ba[_0xbaf3('0x55')];if(!_0x18383c[_0xbaf3('0x50')][_0xbaf3('0x6f')](_0xbaf3('0x56'))){_0x5e552b[_0xbaf3('0x1f')]=qs[_0xbaf3('0x1f')](_0x18383c['query']['limit']);_0x5e552b[_0xbaf3('0x1d')]=qs['offset'](_0x18383c[_0xbaf3('0x50')]['offset']);}return _0x5b7051[_0xbaf3('0xca')](_0x5e552b);}})[_0xbaf3('0x10')](function(_0x3b77ef){if(_0x3b77ef){return _0x3b77ef?{'count':_0x13ff21,'rows':_0x3b77ef}:null;}})[_0xbaf3('0x10')](respondWithResult(_0x37d0ea,null))['catch'](handleError(_0x37d0ea,null));}; \ No newline at end of file +var _0x79f2=['MailAccountId','create','findOne','Disposition','nolimit','filter','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','CmContact','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','email','attachments','root','server/files/attachments','SendMail','sendMail','List\x20not\x20found','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','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','username','modernAuthentication','CloudProviderId','pass','host','port','secure','service','password','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','includeAll','include','show','rawAttributes','length','options','find','update','body','custom','provider','params','Mail\x20Account\x20not\x20found','describe'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x79f2,0x1de));var _0x279f=function(_0x2afb17,_0xb56d2f){_0x2afb17=_0x2afb17-0x0;var _0x12c7a1=_0x79f2[_0x2afb17];return _0x12c7a1;};'use strict';var moment=require(_0x279f('0x0'));var BPromise=require('bluebird');var util=require(_0x279f('0x1'));var path=require(_0x279f('0x2'));var _=require(_0x279f('0x3'));var juice=require('juice');var Redis=require(_0x279f('0x4'));var qs=require(_0x279f('0x5'));var logger=require('../../config/logger')(_0x279f('0x6'));var config=require(_0x279f('0x7'));var db=require('../../mysqldb')['db'];config[_0x279f('0x8')]=_[_0x279f('0x9')](config[_0x279f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x279f('0xa'))(new Redis(config[_0x279f('0x8')]));require(_0x279f('0xb'))[_0x279f('0xc')](socket);var jayson=require(_0x279f('0xd'));var client=jayson[_0x279f('0xe')][_0x279f('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4456df,_0x56ba18,_0x11f2dd,_0x1ca33d){return new BPromise(function(_0x1ffc64,_0x15e374){var _0xc39809=_0x1ca33d||client;return _0xc39809['request'](_0x4456df,_0x11f2dd)['then'](function(_0x58cb21){logger['info'](_0x279f('0x10'),_0x56ba18,_0x279f('0x11'));logger['debug'](_0x279f('0x12'),_0x56ba18,_0x279f('0x11'),JSON[_0x279f('0x13')](_0x58cb21));if(_0x58cb21[_0x279f('0x14')]){if(_0x58cb21[_0x279f('0x14')][_0x279f('0x15')]===0x1f4){logger[_0x279f('0x14')](_0x279f('0x10'),_0x56ba18,_0x58cb21[_0x279f('0x14')][_0x279f('0x16')]);return _0x15e374(_0x58cb21['error']['message']);}logger[_0x279f('0x14')](_0x279f('0x10'),_0x56ba18,_0x58cb21[_0x279f('0x14')]['message']);return _0x1ffc64(_0x58cb21[_0x279f('0x14')][_0x279f('0x16')]);}else{logger[_0x279f('0x17')](_0x279f('0x10'),_0x56ba18,_0x279f('0x11'));_0x1ffc64(_0x58cb21['result'][_0x279f('0x16')]);}})[_0x279f('0x18')](function(_0x27dec1){logger[_0x279f('0x14')](_0x279f('0x10'),_0x56ba18,_0x27dec1);_0x15e374(_0x27dec1);});});}function respondWithStatusCode(_0x133f96,_0x4da755){_0x4da755=_0x4da755||0xcc;return function(_0x42a8df){if(_0x42a8df){return _0x133f96[_0x279f('0x19')](_0x4da755);}return _0x133f96['status'](_0x4da755)[_0x279f('0x1a')]();};}function respondWithResult(_0x203045,_0x3bff50){_0x3bff50=_0x3bff50||0xc8;return function(_0x203259){if(_0x203259){return _0x203045[_0x279f('0x1b')](_0x3bff50)[_0x279f('0x1c')](_0x203259);}};}function respondWithFilteredResult(_0x5251e9,_0x3c225f){return function(_0x1d0cdb){if(_0x1d0cdb){var _0x1ee71b=typeof _0x3c225f[_0x279f('0x1d')]===_0x279f('0x1e')&&typeof _0x3c225f[_0x279f('0x1f')]===_0x279f('0x1e');var _0x254c14=_0x1d0cdb['count'];var _0x512a2d=_0x1ee71b?0x0:_0x3c225f[_0x279f('0x1d')];var _0x5c1791=_0x1ee71b?_0x1d0cdb[_0x279f('0x20')]:_0x3c225f['offset']+_0x3c225f[_0x279f('0x1f')];var _0x4a8a93;if(_0x5c1791>=_0x254c14){_0x5c1791=_0x254c14;_0x4a8a93=0xc8;}else{_0x4a8a93=0xce;}_0x5251e9[_0x279f('0x1b')](_0x4a8a93);return _0x5251e9['set'](_0x279f('0x21'),_0x512a2d+'-'+_0x5c1791+'/'+_0x254c14)[_0x279f('0x1c')](_0x1d0cdb);}return null;};}function saveUpdates(_0x28da48){return function(_0x34fbaa){if(_0x34fbaa){return _0x34fbaa['update'](_0x28da48)[_0x279f('0x22')](function(_0x54b36e){return _0x54b36e;});}return null;};}function removeEntity(_0x3a355c){return function(_0x4ad706){if(_0x4ad706){return _0x4ad706[_0x279f('0x23')]()['then'](function(){var _0x3aebfe=_0x4ad706[_0x279f('0x24')]({'plain':!![]});var _0x501324=_0x279f('0x25');return db[_0x279f('0x26')][_0x279f('0x23')]({'where':{'type':_0x501324,'resourceId':_0x3aebfe['id']}})[_0x279f('0x22')](function(){return _0x4ad706;});})['then'](function(){_0x3a355c[_0x279f('0x1b')](0xcc)[_0x279f('0x1a')]();});}};}function handleEntityNotFound(_0x38bc67){return function(_0xc2e7bb){if(!_0xc2e7bb){_0x38bc67['sendStatus'](0x194);}return _0xc2e7bb;};}function handleError(_0x420960,_0xa3dfab){_0xa3dfab=_0xa3dfab||0x1f4;return function(_0x571436){logger[_0x279f('0x14')](_0x571436[_0x279f('0x27')]);if(_0x571436[_0x279f('0x28')]){delete _0x571436[_0x279f('0x28')];}_0x420960['status'](_0xa3dfab)[_0x279f('0x29')](_0x571436);};}function getImapHost(_0x2f6c70){switch(_0x2f6c70){case _0x279f('0x2a'):return _0x279f('0x2b');case _0x279f('0x2c'):return'imap.mail.yahoo.com';case'hotmail':return _0x279f('0x2d');case _0x279f('0x2e'):return _0x279f('0x2f');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2f6c70);}function getSmtpHost(_0x20c105){switch(_0x20c105){case _0x279f('0x2a'):return _0x279f('0x30');case'yahoo':return _0x279f('0x31');case'hotmail':return _0x279f('0x32');case _0x279f('0x2e'):return _0x279f('0x33');}throw new Error(_0x279f('0x34'),_0x20c105);}function getAuthenticationOptions(_0x58a091,_0x5b999d){var _0x519383={};var _0x49281e={};if(_0x58a091){_0x519383[_0x279f('0x35')]=_0x49281e['user']=_0x5b999d[_0x279f('0x36')];_0x519383['password']=_0x49281e['pass']=_0x5b999d['password'];if(_0x5b999d[_0x279f('0x37')]){_0x519383[_0x279f('0x37')]=_0x49281e[_0x279f('0x37')]=!![];_0x519383[_0x279f('0x38')]=_0x49281e['CloudProviderId']=_0x5b999d[_0x279f('0x38')];_0x519383['password']=_0x49281e[_0x279f('0x39')]=null;}else{_0x519383[_0x279f('0x38')]=_0x49281e[_0x279f('0x38')]=null;}_0x519383[_0x279f('0x3a')]=getImapHost(_0x58a091);_0x519383['port']=0x3e1;_0x49281e[_0x279f('0x3a')]=getSmtpHost(_0x58a091);_0x49281e[_0x279f('0x3b')]=0x24b;_0x49281e[_0x279f('0x3c')]=![];_0x519383[_0x279f('0x3d')]=_0x49281e[_0x279f('0x3d')]=null;}else{if(_0x5b999d['authentication']){_0x519383['user']=_0x49281e[_0x279f('0x35')]=_0x5b999d[_0x279f('0x36')];_0x519383[_0x279f('0x3e')]=_0x49281e[_0x279f('0x39')]=_0x5b999d['password'];}else{_0x519383[_0x279f('0x3f')]=_0x49281e[_0x279f('0x3f')]=![];_0x519383[_0x279f('0x35')]=_0x49281e['user']=null;_0x519383[_0x279f('0x3e')]=_0x49281e[_0x279f('0x39')]=null;}_0x519383[_0x279f('0x3a')]=_0x5b999d[_0x279f('0x40')][_0x279f('0x3a')];_0x519383[_0x279f('0x3b')]=_0x5b999d['Imap'][_0x279f('0x3b')];_0x49281e[_0x279f('0x3a')]=_0x5b999d[_0x279f('0x41')]['host'];_0x49281e['port']=_0x5b999d[_0x279f('0x41')]['port'];}return{'Imap':_0x519383,'Smtp':_0x49281e};}exports[_0x279f('0x42')]=function(_0x2b8713,_0x35a0d0){var _0x257e61={'include':[{'model':db[_0x279f('0x43')],'as':_0x279f('0x40')},{'model':db[_0x279f('0x44')],'as':'Smtp'},{'model':db[_0x279f('0x45')],'as':_0x279f('0x46')}]},_0x283fda={},_0x2bc060={'count':0x0,'rows':[]};var _0x3da92a=_['map'](db[_0x279f('0x47')]['rawAttributes'],function(_0x1d6cbb){return{'name':_0x1d6cbb[_0x279f('0x48')],'type':_0x1d6cbb[_0x279f('0x49')][_0x279f('0x4a')]};});_0x283fda[_0x279f('0x4b')]=_[_0x279f('0x4c')](_0x3da92a,_0x279f('0x28'));_0x283fda[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x2b8713[_0x279f('0x4d')]);_0x283fda[_0x279f('0x4f')]=_[_0x279f('0x50')](_0x283fda[_0x279f('0x4b')],_0x283fda['query']);_0x257e61['attributes']=_['intersection'](_0x283fda[_0x279f('0x4b')],qs[_0x279f('0x51')](_0x2b8713[_0x279f('0x4d')]['fields']));_0x257e61[_0x279f('0x52')]=_0x257e61[_0x279f('0x52')]['length']?_0x257e61[_0x279f('0x52')]:_0x283fda['model'];if(!_0x2b8713[_0x279f('0x4d')][_0x279f('0x53')]('nolimit')){_0x257e61[_0x279f('0x1f')]=qs[_0x279f('0x1f')](_0x2b8713['query'][_0x279f('0x1f')]);_0x257e61[_0x279f('0x1d')]=qs[_0x279f('0x1d')](_0x2b8713[_0x279f('0x4d')]['offset']);}_0x257e61[_0x279f('0x54')]=qs[_0x279f('0x55')](_0x2b8713[_0x279f('0x4d')][_0x279f('0x55')]);_0x257e61[_0x279f('0x56')]=qs[_0x279f('0x4f')](_[_0x279f('0x57')](_0x2b8713[_0x279f('0x4d')],_0x283fda[_0x279f('0x4f')]),_0x3da92a);if(_0x2b8713[_0x279f('0x4d')]['filter']){_0x257e61[_0x279f('0x56')]=_['merge'](_0x257e61[_0x279f('0x56')],{'$or':_[_0x279f('0x4c')](_0x3da92a,function(_0x5b42e4){if(_0x5b42e4[_0x279f('0x49')]!==_0x279f('0x58')){var _0x541fb8={};_0x541fb8[_0x5b42e4[_0x279f('0x28')]]={'$like':'%'+_0x2b8713[_0x279f('0x4d')]['filter']+'%'};return _0x541fb8;}})});}_0x257e61=_[_0x279f('0x59')]({},_0x257e61,_0x2b8713['options']);var _0x11d022={'where':_0x257e61[_0x279f('0x56')]};return db[_0x279f('0x47')]['count'](_0x11d022)[_0x279f('0x22')](function(_0xd5d991){_0x2bc060[_0x279f('0x20')]=_0xd5d991;if(_0x2b8713[_0x279f('0x4d')][_0x279f('0x5a')]){_0x257e61[_0x279f('0x5b')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x257e61);})['then'](function(_0x5cb18f){_0x2bc060['rows']=_0x5cb18f;return _0x2bc060;})[_0x279f('0x22')](respondWithFilteredResult(_0x35a0d0,_0x257e61))[_0x279f('0x18')](handleError(_0x35a0d0,null));};exports[_0x279f('0x5c')]=function(_0x221514,_0xad29f){var _0x26d452={'raw':![],'where':{'id':_0x221514['params']['id']},'include':[{'model':db[_0x279f('0x43')],'as':_0x279f('0x40')},{'model':db[_0x279f('0x44')],'as':_0x279f('0x41')},{'model':db[_0x279f('0x45')],'as':_0x279f('0x46')}]},_0x2124f7={};_0x2124f7[_0x279f('0x4b')]=_['keys'](db[_0x279f('0x47')][_0x279f('0x5d')]);_0x2124f7['query']=_[_0x279f('0x4e')](_0x221514[_0x279f('0x4d')]);_0x2124f7[_0x279f('0x4f')]=_[_0x279f('0x50')](_0x2124f7[_0x279f('0x4b')],_0x2124f7[_0x279f('0x4d')]);_0x26d452[_0x279f('0x52')]=_[_0x279f('0x50')](_0x2124f7[_0x279f('0x4b')],qs[_0x279f('0x51')](_0x221514[_0x279f('0x4d')][_0x279f('0x51')]));_0x26d452['attributes']=_0x26d452['attributes'][_0x279f('0x5e')]?_0x26d452[_0x279f('0x52')]:_0x2124f7[_0x279f('0x4b')];if(_0x221514[_0x279f('0x4d')][_0x279f('0x5a')]){_0x26d452['include']=[{'all':!![]}];}_0x26d452=_[_0x279f('0x59')]({},_0x26d452,_0x221514[_0x279f('0x5f')]);return db[_0x279f('0x47')][_0x279f('0x60')](_0x26d452)[_0x279f('0x22')](handleEntityNotFound(_0xad29f,null))['then'](respondWithResult(_0xad29f,null))[_0x279f('0x18')](handleError(_0xad29f,null));};exports[_0x279f('0x61')]=function(_0x1cb463,_0x2252ae){if(_0x1cb463[_0x279f('0x62')]['id']){delete _0x1cb463[_0x279f('0x62')]['id'];}var _0x29477f=_0x1cb463[_0x279f('0x62')]['provider']===_0x279f('0x63')?null:_0x1cb463[_0x279f('0x62')][_0x279f('0x64')];var _0x24caed=_0x1cb463['body'][_0x279f('0x40')]||{};var _0x545a23=_0x1cb463[_0x279f('0x62')][_0x279f('0x41')]||{};if(_0x29477f){_0x24caed[_0x279f('0x3a')]=getImapHost(_0x29477f);_0x24caed[_0x279f('0x3b')]=0x3e1;_0x545a23[_0x279f('0x3a')]=getSmtpHost(_0x29477f);_0x545a23[_0x279f('0x3b')]=0x24b;_0x545a23[_0x279f('0x3c')]=![];}if(_0x545a23['modernAuthentication']){_0x545a23[_0x279f('0x3c')]=![];}else{_0x545a23[_0x279f('0x38')]=null;}if(!_0x24caed[_0x279f('0x37')])_0x24caed[_0x279f('0x38')]=null;_0x1cb463[_0x279f('0x62')]['Imap']=_0x24caed;_0x1cb463[_0x279f('0x62')]['Smtp']=_0x545a23;return db[_0x279f('0x47')][_0x279f('0x60')]({'where':{'id':_0x1cb463[_0x279f('0x65')]['id']},'include':[{'model':db[_0x279f('0x43')],'as':_0x279f('0x40')},{'model':db[_0x279f('0x44')],'as':_0x279f('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x279f('0x22')](handleEntityNotFound(_0x2252ae,null))[_0x279f('0x22')](function(_0x3f1ffb){if(!_0x3f1ffb)throw new Error(_0x279f('0x66'));if(_0x3f1ffb[_0x279f('0x3d')])delete _0x1cb463[_0x279f('0x62')][_0x279f('0x40')];return _0x3f1ffb;})[_0x279f('0x22')](saveUpdates(_0x1cb463['body'],null))[_0x279f('0x22')](function(_0x45faea){if(!_0x1cb463[_0x279f('0x62')][_0x279f('0x40')])return _0x45faea;return db[_0x279f('0x43')][_0x279f('0x61')](_0x1cb463[_0x279f('0x62')][_0x279f('0x40')],{'where':{'MailAccountId':_0x45faea['id']}})[_0x279f('0x22')](function(){return _0x45faea;});})[_0x279f('0x22')](function(_0x2295f0){if(!_0x1cb463[_0x279f('0x62')]['Smtp'])return _0x2295f0;return db[_0x279f('0x44')][_0x279f('0x61')](_0x1cb463[_0x279f('0x62')][_0x279f('0x41')],{'where':{'MailAccountId':_0x2295f0['id']}})[_0x279f('0x22')](function(){return _0x2295f0;});})[_0x279f('0x22')](respondWithResult(_0x2252ae,null))['catch'](handleError(_0x2252ae,null));};exports[_0x279f('0x67')]=function(_0x1b638a,_0x45d4ae){return db['MailAccount'][_0x279f('0x67')]()[_0x279f('0x22')](respondWithResult(_0x45d4ae,null))[_0x279f('0x18')](handleError(_0x45d4ae,null));};exports['addDisposition']=function(_0x6dcbe9,_0x58a270){if(_0x6dcbe9[_0x279f('0x62')]['id']){delete _0x6dcbe9['body']['id'];}return db[_0x279f('0x47')]['find']({'where':{'id':_0x6dcbe9[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x58a270,null))[_0x279f('0x22')](function(_0x429cf6){if(_0x429cf6){_0x6dcbe9[_0x279f('0x62')][_0x279f('0x68')]=_0x429cf6['id'];return db['Disposition'][_0x279f('0x69')](_0x6dcbe9[_0x279f('0x62')]);}})['then'](respondWithResult(_0x58a270,null))[_0x279f('0x18')](handleError(_0x58a270,null));};exports['getDispositions']=function(_0x1cbe63,_0x46d85d){var _0x2ac303={'raw':![],'where':{}};var _0x271689={};var _0x14df98={'count':0x0,'rows':[]};return db['MailAccount'][_0x279f('0x6a')]({'where':{'id':_0x1cbe63[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x46d85d,null))[_0x279f('0x22')](function(_0x4183b0){if(_0x4183b0){_0x271689['model']=_[_0x279f('0x4e')](db[_0x279f('0x6b')][_0x279f('0x5d')]);_0x271689[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x1cbe63[_0x279f('0x4d')]);_0x271689['filters']=_[_0x279f('0x50')](_0x271689[_0x279f('0x4b')],_0x271689[_0x279f('0x4d')]);_0x2ac303[_0x279f('0x52')]=_['intersection'](_0x271689[_0x279f('0x4b')],qs[_0x279f('0x51')](_0x1cbe63['query'][_0x279f('0x51')]));_0x2ac303[_0x279f('0x52')]=_0x2ac303[_0x279f('0x52')][_0x279f('0x5e')]?_0x2ac303['attributes']:_0x271689[_0x279f('0x4b')];if(!_0x1cbe63[_0x279f('0x4d')]['hasOwnProperty'](_0x279f('0x6c'))){_0x2ac303[_0x279f('0x1f')]=qs[_0x279f('0x1f')](_0x1cbe63[_0x279f('0x4d')][_0x279f('0x1f')]);_0x2ac303[_0x279f('0x1d')]=qs[_0x279f('0x1d')](_0x1cbe63['query']['offset']);}_0x2ac303['order']=qs[_0x279f('0x55')](_0x1cbe63[_0x279f('0x4d')]['sort']);_0x2ac303[_0x279f('0x56')]=qs['filters'](_[_0x279f('0x57')](_0x1cbe63[_0x279f('0x4d')],_0x271689[_0x279f('0x4f')]));_0x2ac303[_0x279f('0x56')][_0x279f('0x68')]=_0x4183b0['id'];if(_0x1cbe63[_0x279f('0x4d')][_0x279f('0x6d')]){_0x2ac303[_0x279f('0x56')]=_[_0x279f('0x59')](_0x2ac303[_0x279f('0x56')],{'$or':_[_0x279f('0x4c')](_0x2ac303[_0x279f('0x52')],function(_0x1c0fc4){var _0x12975d={};_0x12975d[_0x1c0fc4]={'$like':'%'+_0x1cbe63['query'][_0x279f('0x6d')]+'%'};return _0x12975d;})});}_0x2ac303=_[_0x279f('0x59')]({},_0x2ac303,_0x1cbe63[_0x279f('0x5f')]);return db[_0x279f('0x6b')][_0x279f('0x20')]({'where':_0x2ac303[_0x279f('0x56')]})[_0x279f('0x22')](function(_0x76b9dd){_0x14df98[_0x279f('0x20')]=_0x76b9dd;if(_0x1cbe63[_0x279f('0x4d')][_0x279f('0x5a')]){_0x2ac303[_0x279f('0x5b')]=[{'all':!![]}];}return db[_0x279f('0x6b')][_0x279f('0x6e')](_0x2ac303);})[_0x279f('0x22')](function(_0x4f7132){_0x14df98[_0x279f('0x6f')]=_0x4f7132;return _0x14df98;});}})['then'](respondWithFilteredResult(_0x46d85d,_0x2ac303))['catch'](handleError(_0x46d85d,null));};exports[_0x279f('0x70')]=function(_0x5ef02b,_0x4d8443){return db['MailAccount'][_0x279f('0x60')]({'where':{'id':_0x5ef02b['params']['id']}})['then'](handleEntityNotFound(_0x4d8443,null))[_0x279f('0x22')](function(_0x159c29){if(_0x159c29){return _0x159c29[_0x279f('0x70')](_0x5ef02b[_0x279f('0x4d')][_0x279f('0x71')]);}})['then'](respondWithStatusCode(_0x4d8443,null))[_0x279f('0x18')](handleError(_0x4d8443,null));};exports[_0x279f('0x72')]=function(_0x26a660,_0x1ac3fe){if(_0x26a660['body']['id']){delete _0x26a660[_0x279f('0x62')]['id'];}return db[_0x279f('0x47')][_0x279f('0x60')]({'where':{'id':_0x26a660[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x1ac3fe,null))[_0x279f('0x22')](function(_0x2b4669){if(_0x2b4669){_0x26a660['body'][_0x279f('0x68')]=_0x2b4669['id'];return db[_0x279f('0x73')][_0x279f('0x69')](_0x26a660[_0x279f('0x62')]);}})[_0x279f('0x22')](respondWithResult(_0x1ac3fe,null))['catch'](handleError(_0x1ac3fe,null));};exports['getAnswers']=function(_0x4c7b4a,_0x1c03b5){var _0xd3512c={'raw':![],'where':{}};var _0x19e033={};var _0x4ba882={'count':0x0,'rows':[]};return db['MailAccount'][_0x279f('0x6a')]({'where':{'id':_0x4c7b4a[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x1c03b5,null))['then'](function(_0x24d60e){if(_0x24d60e){_0x19e033[_0x279f('0x4b')]=_[_0x279f('0x4e')](db[_0x279f('0x73')][_0x279f('0x5d')]);_0x19e033[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x4c7b4a[_0x279f('0x4d')]);_0x19e033[_0x279f('0x4f')]=_[_0x279f('0x50')](_0x19e033['model'],_0x19e033['query']);_0xd3512c['attributes']=_['intersection'](_0x19e033[_0x279f('0x4b')],qs['fields'](_0x4c7b4a[_0x279f('0x4d')]['fields']));_0xd3512c['attributes']=_0xd3512c['attributes']['length']?_0xd3512c[_0x279f('0x52')]:_0x19e033['model'];if(!_0x4c7b4a['query'][_0x279f('0x53')](_0x279f('0x6c'))){_0xd3512c['limit']=qs[_0x279f('0x1f')](_0x4c7b4a[_0x279f('0x4d')][_0x279f('0x1f')]);_0xd3512c[_0x279f('0x1d')]=qs['offset'](_0x4c7b4a['query']['offset']);}_0xd3512c[_0x279f('0x54')]=qs['sort'](_0x4c7b4a[_0x279f('0x4d')][_0x279f('0x55')]);_0xd3512c[_0x279f('0x56')]=qs[_0x279f('0x4f')](_['pick'](_0x4c7b4a[_0x279f('0x4d')],_0x19e033['filters']));_0xd3512c[_0x279f('0x56')][_0x279f('0x68')]=_0x24d60e['id'];if(_0x4c7b4a[_0x279f('0x4d')][_0x279f('0x6d')]){_0xd3512c[_0x279f('0x56')]=_[_0x279f('0x59')](_0xd3512c[_0x279f('0x56')],{'$or':_[_0x279f('0x4c')](_0xd3512c[_0x279f('0x52')],function(_0x60e185){var _0x448ba0={};_0x448ba0[_0x60e185]={'$like':'%'+_0x4c7b4a[_0x279f('0x4d')][_0x279f('0x6d')]+'%'};return _0x448ba0;})});}_0xd3512c=_[_0x279f('0x59')]({},_0xd3512c,_0x4c7b4a[_0x279f('0x5f')]);return db[_0x279f('0x73')][_0x279f('0x20')]({'where':_0xd3512c[_0x279f('0x56')]})[_0x279f('0x22')](function(_0x5cf70a){_0x4ba882[_0x279f('0x20')]=_0x5cf70a;if(_0x4c7b4a[_0x279f('0x4d')][_0x279f('0x5a')]){_0xd3512c[_0x279f('0x5b')]=[{'all':!![]}];}return db[_0x279f('0x73')][_0x279f('0x6e')](_0xd3512c);})[_0x279f('0x22')](function(_0x500a92){_0x4ba882['rows']=_0x500a92;return _0x4ba882;});}})[_0x279f('0x22')](respondWithFilteredResult(_0x1c03b5,_0xd3512c))[_0x279f('0x18')](handleError(_0x1c03b5,null));};exports[_0x279f('0x74')]=function(_0xcb19fb,_0x10fe48){return db[_0x279f('0x47')][_0x279f('0x60')]({'where':{'id':_0xcb19fb[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x10fe48,null))['then'](function(_0x2c8454){if(_0x2c8454){return _0x2c8454[_0x279f('0x74')](_0xcb19fb[_0x279f('0x4d')][_0x279f('0x71')]);}})[_0x279f('0x22')](respondWithStatusCode(_0x10fe48,null))[_0x279f('0x18')](handleError(_0x10fe48,null));};exports[_0x279f('0x69')]=function(_0x586878,_0x271b4a){var _0x52cddd={'name':_0x586878[_0x279f('0x62')][_0x279f('0x28')],'key':_0x586878['body']['key'],'provider':_0x586878[_0x279f('0x62')][_0x279f('0x64')]===_0x279f('0x63')?null:_0x586878[_0x279f('0x62')][_0x279f('0x64')],'email':_0x586878[_0x279f('0x62')]['email'],'ListId':_0x586878['body'][_0x279f('0x75')],'active':!_[_0x279f('0x76')](_0x586878[_0x279f('0x62')][_0x279f('0x77')])?_0x586878[_0x279f('0x62')][_0x279f('0x77')]:!![],'description':_0x586878['body'][_0x279f('0x78')]||null};var _0x22d682=getAuthenticationOptions(_0x52cddd[_0x279f('0x64')],_0x586878[_0x279f('0x62')]);_0x52cddd[_0x279f('0x40')]=_0x22d682[_0x279f('0x40')];_0x52cddd[_0x279f('0x41')]=_0x22d682[_0x279f('0x41')];return db[_0x279f('0x47')][_0x279f('0x69')](_0x52cddd,{'include':[{'model':db[_0x279f('0x44')],'as':'Smtp'},{'model':db[_0x279f('0x43')],'as':'Imap'}]})[_0x279f('0x22')](function(_0x22cfe7){var _0xe04ed6=_0x586878[_0x279f('0x35')][_0x279f('0x24')]({'plain':!![]});if(!_0xe04ed6)throw new Error(_0x279f('0x79'));if(_0xe04ed6['role']===_0x279f('0x35')){var _0x18e549=_0x22cfe7[_0x279f('0x24')]({'plain':!![]});return db[_0x279f('0x7a')][_0x279f('0x60')]({'where':{'name':_0x279f('0x25'),'userProfileId':_0xe04ed6[_0x279f('0x7b')]},'raw':!![]})[_0x279f('0x22')](function(_0x1b29ae){if(_0x1b29ae&&_0x1b29ae[_0x279f('0x7c')]===0x0){return db[_0x279f('0x26')][_0x279f('0x69')]({'name':_0x18e549[_0x279f('0x28')],'resourceId':_0x18e549['id'],'type':_0x1b29ae['name'],'sectionId':_0x1b29ae['id']},{})['then'](function(){return _0x22cfe7;});}else{return _0x22cfe7;}})[_0x279f('0x18')](function(_0x32b8f2){logger[_0x279f('0x14')](_0x279f('0x7d'),_0x32b8f2);throw _0x32b8f2;});}return _0x22cfe7;})['then'](respondWithResult(_0x271b4a,0xc9))[_0x279f('0x18')](handleError(_0x271b4a,null));};exports[_0x279f('0x7e')]=function(_0x1e0a84,_0x914e44){return db[_0x279f('0x47')]['findOne']({'where':{'id':_0x1e0a84[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x914e44,null))[_0x279f('0x22')](function(_0x4d741e){if(_0x4d741e){return _0x4d741e['getImap']();}return null;})[_0x279f('0x22')](respondWithResult(_0x914e44,null))[_0x279f('0x18')](handleError(_0x914e44,null));};exports[_0x279f('0x7f')]=function(_0x474b7b,_0x49cb29){if(_0x474b7b['body']['id']){delete _0x474b7b[_0x279f('0x62')]['id'];}return db[_0x279f('0x47')]['find']({'where':{'id':_0x474b7b[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x49cb29,null))[_0x279f('0x22')](function(_0x35d8a2){if(_0x35d8a2){_0x474b7b[_0x279f('0x62')][_0x279f('0x68')]=_0x35d8a2['id'];return db['MailServerIn'][_0x279f('0x69')](_0x474b7b[_0x279f('0x62')]);}})[_0x279f('0x22')](respondWithResult(_0x49cb29,null))[_0x279f('0x18')](handleError(_0x49cb29,null));};exports[_0x279f('0x80')]=function(_0x10dbdd,_0x266929){return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x10dbdd[_0x279f('0x65')]['id']}})['then'](handleEntityNotFound(_0x266929,null))[_0x279f('0x22')](function(_0x43bb1d){if(_0x43bb1d){return _0x43bb1d[_0x279f('0x81')](null);}return null;})[_0x279f('0x22')](respondWithStatusCode(_0x266929,null))['catch'](handleError(_0x266929,null));};exports['getSmtp']=function(_0x54b727,_0x2b4fd4){return db['MailAccount']['findOne']({'where':{'id':_0x54b727[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x2b4fd4,null))[_0x279f('0x22')](function(_0x422eb4){if(_0x422eb4){return _0x422eb4[_0x279f('0x82')]();}return null;})[_0x279f('0x22')](respondWithResult(_0x2b4fd4,null))[_0x279f('0x18')](handleError(_0x2b4fd4,null));};exports['addSmtp']=function(_0x49c313,_0x1f7da8){if(_0x49c313[_0x279f('0x62')]['id']){delete _0x49c313[_0x279f('0x62')]['id'];}return db[_0x279f('0x47')]['find']({'where':{'id':_0x49c313[_0x279f('0x65')]['id']}})['then'](handleEntityNotFound(_0x1f7da8,null))[_0x279f('0x22')](function(_0x2731fb){if(_0x2731fb){_0x49c313[_0x279f('0x62')][_0x279f('0x68')]=_0x2731fb['id'];return db['MailServerOut'][_0x279f('0x69')](_0x49c313[_0x279f('0x62')]);}})['then'](respondWithResult(_0x1f7da8,null))['catch'](handleError(_0x1f7da8,null));};exports[_0x279f('0x83')]=function(_0x38e53b,_0x4e14f0){return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x38e53b[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x4e14f0,null))[_0x279f('0x22')](function(_0x3524b0){if(_0x3524b0){return _0x3524b0[_0x279f('0x84')](null);}return null;})[_0x279f('0x22')](respondWithStatusCode(_0x4e14f0,null))['catch'](handleError(_0x4e14f0,null));};exports['addInteraction']=function(_0x279c70,_0x4c97d9){return db[_0x279f('0x85')][_0x279f('0x60')]({'where':{'id':_0x279c70[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x4c97d9,null))[_0x279f('0x22')](function(_0x18e834){if(_0x18e834){return _0x18e834[_0x279f('0x86')](_0x279c70[_0x279f('0x62')][_0x279f('0x71')],_[_0x279f('0x87')](_0x279c70[_0x279f('0x62')],[_0x279f('0x71'),'id'])||{});}})['then'](respondWithResult(_0x4c97d9,null))[_0x279f('0x18')](handleError(_0x4c97d9,null));};exports[_0x279f('0x88')]=function(_0x105c2d,_0x443fa9){var _0x268903={'raw':![],'where':{}};var _0x937f5c={};var _0x2bb365={'count':0x0,'rows':[]};return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x105c2d[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x443fa9,null))[_0x279f('0x22')](function(_0x28a7e4){if(_0x28a7e4){_0x937f5c['model']=_[_0x279f('0x4e')](db[_0x279f('0x85')][_0x279f('0x5d')]);_0x937f5c[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x105c2d[_0x279f('0x4d')]);_0x937f5c[_0x279f('0x4f')]=_[_0x279f('0x50')](_0x937f5c['model'],_0x937f5c[_0x279f('0x4d')]);_0x268903['attributes']=_[_0x279f('0x50')](_0x937f5c[_0x279f('0x4b')],qs[_0x279f('0x51')](_0x105c2d[_0x279f('0x4d')][_0x279f('0x51')]));_0x268903['attributes']=_0x268903[_0x279f('0x52')][_0x279f('0x5e')]?_0x268903['attributes']:_0x937f5c['model'];if(!_0x105c2d[_0x279f('0x4d')][_0x279f('0x53')]('nolimit')){_0x268903[_0x279f('0x1f')]=qs[_0x279f('0x1f')](_0x105c2d['query'][_0x279f('0x1f')]);_0x268903[_0x279f('0x1d')]=qs['offset'](_0x105c2d[_0x279f('0x4d')][_0x279f('0x1d')]);}_0x268903[_0x279f('0x54')]=qs['sort'](_0x105c2d['query'][_0x279f('0x55')]);_0x268903[_0x279f('0x56')]=qs[_0x279f('0x4f')](_['pick'](_0x105c2d[_0x279f('0x4d')],_0x937f5c[_0x279f('0x4f')]));_0x268903[_0x279f('0x56')][_0x279f('0x68')]=_0x28a7e4['id'];if(_0x105c2d['query'][_0x279f('0x6d')]){_0x268903[_0x279f('0x56')]=_[_0x279f('0x59')](_0x268903[_0x279f('0x56')],{'$or':_['map'](_0x268903['attributes'],function(_0x55e195){var _0x2a9e71={};_0x2a9e71[_0x55e195]={'$like':'%'+_0x105c2d[_0x279f('0x4d')][_0x279f('0x6d')]+'%'};return _0x2a9e71;})});}_0x268903=_[_0x279f('0x59')]({},_0x268903,_0x105c2d[_0x279f('0x5f')]);return db[_0x279f('0x85')][_0x279f('0x20')]({'where':_0x268903[_0x279f('0x56')]})[_0x279f('0x22')](function(_0x4632e3){_0x2bb365[_0x279f('0x20')]=_0x4632e3;if(_0x105c2d[_0x279f('0x4d')]['includeAll']){_0x268903[_0x279f('0x5b')]=[{'model':db['CmContact'],'as':_0x279f('0x89'),'required':![]},{'model':db[_0x279f('0x8a')],'as':_0x279f('0x8b'),'attributes':[_0x279f('0x28'),_0x279f('0x8c'),_0x279f('0x8d')],'required':![]},{'model':db[_0x279f('0x8e')],'as':_0x279f('0x8f'),'attributes':['id','name',_0x279f('0x90')],'where':_0x105c2d[_0x279f('0x4d')][_0x279f('0x91')]?{'id':_0x105c2d[_0x279f('0x4d')][_0x279f('0x91')]}:undefined,'required':_0x105c2d[_0x279f('0x4d')][_0x279f('0x91')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x268903);})[_0x279f('0x22')](function(_0x309b70){_0x2bb365[_0x279f('0x6f')]=_0x309b70;return _0x2bb365;});}})['then'](respondWithFilteredResult(_0x443fa9,_0x268903))[_0x279f('0x18')](handleError(_0x443fa9,null));};exports[_0x279f('0x92')]=function addApplications(_0x4ce49d,_0x1d97a1){var _0xb333b5=_0x4ce49d[_0x279f('0x65')]['id'];var _0x8dce49=_0x4ce49d[_0x279f('0x62')];var _0x45a82f=0xc8;var _0x3962b1=null;return db[_0x279f('0x93')][_0x279f('0x94')]({'isolationLevel':db[_0x279f('0x93')][_0x279f('0x95')][_0x279f('0x96')]['READ_COMMITTED']},function(_0x76e56c){return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0xb333b5},'transaction':_0x76e56c})[_0x279f('0x22')](function(_0x5aa744){if(_0x5aa744){return db[_0x279f('0x97')][_0x279f('0x23')]({'where':{'MailAccountId':_0xb333b5},'transaction':_0x76e56c})[_0x279f('0x22')](function(){var _0x5cb395=_['map'](_0x8dce49,function(_0x49d476){_0x49d476[_0x279f('0x68')]=_0xb333b5;return _0x49d476;});return db['MailApplication'][_0x279f('0x98')](_0x5cb395,{'transaction':_0x76e56c});});}else{_0x45a82f=0x194;_0x3962b1=[];}});})[_0x279f('0x22')](function(){if(_0x45a82f!==0x194){return db[_0x279f('0x97')][_0x279f('0x99')]({'where':{'MailAccountId':_0xb333b5},'order':_0x279f('0x9a')})[_0x279f('0x22')](function(_0x1cdda3){_0x3962b1=_0x1cdda3;});}})[_0x279f('0x18')](function(_0x37656d){_0x45a82f=0x1f4;logger[_0x279f('0x14')](_0x37656d[_0x279f('0x27')]);if(_0x37656d[_0x279f('0x28')]){delete _0x37656d[_0x279f('0x28')];}_0x3962b1=_0x37656d;})[_0x279f('0x9b')](function(){if(_0x3962b1===null){_0x1d97a1[_0x279f('0x19')](_0x45a82f);}else{if(_0x45a82f===0x1f4){_0x1d97a1[_0x279f('0x1b')](_0x45a82f)[_0x279f('0x29')](_0x3962b1);}else{_0x1d97a1[_0x279f('0x1b')](_0x45a82f)[_0x279f('0x1c')](_0x3962b1);}}});};exports['getApplications']=function(_0x5426fe,_0x50c699){var _0x59e43c={};var _0x29c337={};var _0xad39e2;var _0x35a86d;return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x5426fe['params']['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x50c699,null))[_0x279f('0x22')](function(_0xb032cd){if(_0xb032cd){_0xad39e2=_0xb032cd;_0x29c337[_0x279f('0x4b')]=_['keys'](db['MailApplication'][_0x279f('0x5d')]);_0x29c337[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x5426fe[_0x279f('0x4d')]);_0x29c337[_0x279f('0x4f')]=_['intersection'](_0x29c337[_0x279f('0x4b')],_0x29c337['query']);_0x59e43c['attributes']=_[_0x279f('0x50')](_0x29c337[_0x279f('0x4b')],qs[_0x279f('0x51')](_0x5426fe['query'][_0x279f('0x51')]));_0x59e43c[_0x279f('0x52')]=_0x59e43c[_0x279f('0x52')][_0x279f('0x5e')]?_0x59e43c[_0x279f('0x52')]:_0x29c337['model'];_0x59e43c[_0x279f('0x54')]=qs[_0x279f('0x55')](_0x5426fe['query'][_0x279f('0x55')]);_0x59e43c[_0x279f('0x56')]=qs[_0x279f('0x4f')](_[_0x279f('0x57')](_0x5426fe[_0x279f('0x4d')],_0x29c337[_0x279f('0x4f')]));if(_0x5426fe[_0x279f('0x4d')][_0x279f('0x6d')]){_0x59e43c['where']=_[_0x279f('0x59')](_0x59e43c[_0x279f('0x56')],{'$or':_[_0x279f('0x4c')](_0x59e43c['attributes'],function(_0x153ef9){var _0x3d562c={};_0x3d562c[_0x153ef9]={'$like':'%'+_0x5426fe[_0x279f('0x4d')][_0x279f('0x6d')]+'%'};return _0x3d562c;})});}_0x59e43c=_[_0x279f('0x59')]({},_0x59e43c,_0x5426fe[_0x279f('0x5f')]);return _0xad39e2[_0x279f('0x9c')](_0x59e43c);}})[_0x279f('0x22')](function(_0xce52e3){if(_0xce52e3){_0x35a86d=_0xce52e3['length'];if(!_0x5426fe[_0x279f('0x4d')][_0x279f('0x53')](_0x279f('0x6c'))){_0x59e43c[_0x279f('0x1f')]=qs[_0x279f('0x1f')](_0x5426fe[_0x279f('0x4d')]['limit']);_0x59e43c[_0x279f('0x1d')]=qs['offset'](_0x5426fe['query'][_0x279f('0x1d')]);}return _0xad39e2[_0x279f('0x9c')](_0x59e43c);}})['then'](function(_0x4fdc07){if(_0x4fdc07){return _0x4fdc07?{'count':_0x35a86d,'rows':_0x4fdc07}:null;}})[_0x279f('0x22')](respondWithResult(_0x50c699,null))['catch'](handleError(_0x50c699,null));};exports['getMessages']=function(_0x51d90a,_0x4980c9){var _0x49f8a8={'raw':!![],'where':{}};var _0xff03bc={};var _0x5bbd4e={'count':0x0,'rows':[]};return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x51d90a[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x4980c9,null))[_0x279f('0x22')](function(_0x33a457){if(_0x33a457){_0xff03bc[_0x279f('0x4b')]=_['keys'](db['MailMessage'][_0x279f('0x5d')]);_0xff03bc[_0x279f('0x4d')]=_['keys'](_0x51d90a[_0x279f('0x4d')]);_0xff03bc[_0x279f('0x4f')]=_[_0x279f('0x50')](_0xff03bc[_0x279f('0x4b')],_0xff03bc[_0x279f('0x4d')]);_0x49f8a8[_0x279f('0x52')]=_[_0x279f('0x50')](_0xff03bc['model'],qs[_0x279f('0x51')](_0x51d90a[_0x279f('0x4d')]['fields']));_0x49f8a8[_0x279f('0x52')]=_0x49f8a8[_0x279f('0x52')]['length']?_0x49f8a8[_0x279f('0x52')]:_0xff03bc[_0x279f('0x4b')];if(!_0x51d90a[_0x279f('0x4d')][_0x279f('0x53')](_0x279f('0x6c'))){_0x49f8a8[_0x279f('0x1f')]=qs[_0x279f('0x1f')](_0x51d90a[_0x279f('0x4d')][_0x279f('0x1f')]);_0x49f8a8['offset']=qs[_0x279f('0x1d')](_0x51d90a['query'][_0x279f('0x1d')]);}_0x49f8a8[_0x279f('0x54')]=qs[_0x279f('0x55')](_0x51d90a['query'][_0x279f('0x55')]);_0x49f8a8[_0x279f('0x56')]=qs[_0x279f('0x4f')](_[_0x279f('0x57')](_0x51d90a[_0x279f('0x4d')],_0xff03bc[_0x279f('0x4f')]));_0x49f8a8[_0x279f('0x56')]['MailAccountId']=_0x33a457['id'];if(_0x51d90a[_0x279f('0x4d')][_0x279f('0x6d')]){_0x49f8a8[_0x279f('0x56')]=_['merge'](_0x49f8a8['where'],{'$or':_[_0x279f('0x4c')](_0x49f8a8[_0x279f('0x52')],function(_0x200ea7){var _0x3e2f37={};_0x3e2f37[_0x200ea7]={'$like':'%'+_0x51d90a[_0x279f('0x4d')][_0x279f('0x6d')]+'%'};return _0x3e2f37;})});}if(_0x51d90a[_0x279f('0x4d')][_0x279f('0x9d')]){var _0x2d32ff=_0x51d90a[_0x279f('0x4d')][_0x279f('0x9d')][_0x279f('0x9e')](',');var _0x215203={};_0x215203[_0x2d32ff[0x0]]={'$gte':moment(_0x2d32ff[0x1])['format'](_0x279f('0x9f'))};_0x49f8a8[_0x279f('0x56')]=_['merge'](_0x49f8a8[_0x279f('0x56')],_0x215203);}_0x49f8a8=_['merge']({},_0x49f8a8,_0x51d90a[_0x279f('0x5f')]);return db['MailMessage'][_0x279f('0x20')]({'where':_0x49f8a8[_0x279f('0x56')]})[_0x279f('0x22')](function(_0x5af6b7){_0x5bbd4e[_0x279f('0x20')]=_0x5af6b7;if(_0x51d90a[_0x279f('0x4d')][_0x279f('0x5a')]){_0x49f8a8['include']=[{'all':!![]}];}return db[_0x279f('0xa0')]['findAll'](_0x49f8a8);})['then'](function(_0x4b1eef){if(_0x51d90a[_0x279f('0x4d')][_0x279f('0xa1')]==='true'){for(var _0x172728=0x0;_0x172728<_0x4b1eef[_0x279f('0x5e')];_0x172728++){_0x4b1eef[_0x172728]['body']=juice(_0x4b1eef[_0x172728]['body']);}}_0x5bbd4e[_0x279f('0x6f')]=_0x4b1eef;return _0x5bbd4e;});}})[_0x279f('0x22')](respondWithFilteredResult(_0x4980c9,_0x49f8a8))['catch'](handleError(_0x4980c9,null));};exports['send']=function(_0x43a0c2,_0x51df04){var _0x1906df,_0x21da1c={},_0x3dcfd3;if(_0x43a0c2[_0x279f('0x62')]['to']){_0x3dcfd3=_0x43a0c2[_0x279f('0x62')]['to'][_0x279f('0x9e')](',')[0x0];}return db['MailAccount'][_0x279f('0x60')]({'where':{'id':_0x43a0c2['params']['id']},'include':[{'model':db[_0x279f('0xa2')],'as':_0x279f('0xa3'),'include':[{'model':db[_0x279f('0xa4')],'as':_0x279f('0xa5'),'where':{'email':_0x3dcfd3},'limit':0x1,'order':[['updatedAt',_0x279f('0xa6')]]}]},{'model':db[_0x279f('0x44')],'as':_0x279f('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x279f('0xa7'),'raw':!![]}]}]})[_0x279f('0x22')](handleEntityNotFound(_0x51df04,null))[_0x279f('0x22')](function(_0x4147c7){if(!_0x4147c7)return;_0x1906df=_0x4147c7;if(!_0x4147c7[_0x279f('0x41')])throw new Error(_0x279f('0xa8'));if(_[_0x279f('0x76')](_0x43a0c2[_0x279f('0x62')][_0x279f('0xa9')])){_0x43a0c2[_0x279f('0x62')]['from']=util[_0x279f('0xaa')]('%s\x20<%s>',_0x4147c7[_0x279f('0x28')],_0x4147c7[_0x279f('0xab')]||_0x4147c7[_0x279f('0x41')][_0x279f('0x35')]);}if(_0x43a0c2['body'][_0x279f('0xac')]&&_0x43a0c2[_0x279f('0x62')][_0x279f('0xac')][_0x279f('0x5e')]){for(var _0x58c3ff=0x0;_0x58c3ff<_0x43a0c2[_0x279f('0x62')]['attachments'][_0x279f('0x5e')];_0x58c3ff+=0x1){_0x43a0c2[_0x279f('0x62')]['attachments'][_0x58c3ff]={'filename':_0x43a0c2[_0x279f('0x62')][_0x279f('0xac')][_0x58c3ff][_0x279f('0x28')],'path':path['join'](config[_0x279f('0xad')],_0x279f('0xae'),_0x43a0c2[_0x279f('0x62')]['attachments'][_0x58c3ff]['basename'])};}}var _0x336f76=_0x4147c7['getSmtpOptions']();return respondWithRpcPromise(_0x279f('0xaf'),_0x279f('0xb0'),{'account':_0x336f76,'message':_0x43a0c2['body']});})[_0x279f('0x22')](function(_0x29c0bb){if(!_0x29c0bb)return;_0x21da1c=_0x29c0bb;if(!_0x1906df[_0x279f('0xa3')])throw new Error(_0x279f('0xb1'));if(_0x1906df[_0x279f('0xa3')][_0x279f('0xa5')][_0x279f('0x5e')])return _0x1906df['List']['Contacts'][0x0];return db['CmContact']['create'](_[_0x279f('0x9')](_0x43a0c2['body'],{'firstName':_0x43a0c2['body']['to'],'email':_0x43a0c2[_0x279f('0x62')]['to'],'phone':_0x43a0c2[_0x279f('0x62')]['to'],'ListId':_0x1906df[_0x279f('0x75')]}));})[_0x279f('0x22')](function(_0x3e0b34){if(!_0x3e0b34)return;var _0x49d340={'UserId':_0x43a0c2[_0x279f('0x35')]['id'],'ContactId':_0x3e0b34['id'],'MailAccountId':_0x1906df['id'],'inReplyTo':_0x21da1c['messageId'],'to':_0x43a0c2[_0x279f('0x62')]['from'],'cc':_0x43a0c2[_0x279f('0x62')]['cc'],'subject':_0x43a0c2[_0x279f('0x62')][_0x279f('0xb2')],'attach':_0x43a0c2[_0x279f('0x62')][_0x279f('0xb3')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x279f('0xaa')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x279f('0xb4'),'Messages':[_[_0x279f('0x59')](_0x43a0c2['body'],{'messageId':_0x21da1c['messageId'],'sentAt':moment()[_0x279f('0xaa')](_0x279f('0x9f')),'read':!![],'MailAccountId':_0x1906df['id'],'UserId':_0x43a0c2[_0x279f('0x35')]['id'],'ContactId':_0x3e0b34['id']})]};if(_0x43a0c2[_0x279f('0x62')]['Interaction']){_0x49d340=_[_0x279f('0x59')](_0x49d340,_0x43a0c2['body'][_0x279f('0xb5')]);}return db[_0x279f('0x85')][_0x279f('0x69')](_0x49d340,{'include':[{'model':db[_0x279f('0xa0')],'as':_0x279f('0xb6')}]});})['then'](respondWithResult(_0x51df04,null))[_0x279f('0x18')](handleError(_0x51df04,null));};exports[_0x279f('0xb7')]=function(_0x42c8e2,_0x934332){return db[_0x279f('0x47')]['find']({'where':{'id':_0x42c8e2[_0x279f('0x65')]['id']},'include':[{'model':db[_0x279f('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x279f('0xa7')],'as':_0x279f('0xa7'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x934332,null))['then'](function(_0x32c724){if(!_0x32c724[_0x279f('0x41')])return;var _0x1945b1=_0x32c724[_0x279f('0xb8')]();return respondWithRpcPromise('VerifySmtp',_0x279f('0xb7'),{'account':_0x1945b1});})[_0x279f('0x22')](respondWithResult(_0x934332,null))[_0x279f('0x18')](handleError(_0x934332,null));};exports[_0x279f('0x23')]=function(_0xcb66e8,_0x4390da){return db['MailAccount'][_0x279f('0x60')]({'where':{'id':_0xcb66e8[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x4390da,null))[_0x279f('0x22')](function(_0x3e33c3){if(_0x3e33c3&&_0x3e33c3['service']){throw new db['Sequelize'][(_0x279f('0xb9'))](_0x279f('0xba'));}return _0x3e33c3;})[_0x279f('0x22')](removeEntity(_0x4390da,null))['catch'](handleError(_0x4390da,null));};exports[_0x279f('0xbb')]=function(_0x304b6b,_0x128f75){return db[_0x279f('0x47')]['find']({'where':{'id':_0x304b6b[_0x279f('0x65')]['id']}})['then'](handleEntityNotFound(_0x128f75,null))[_0x279f('0x22')](function(_0x50ddb5){if(_0x50ddb5){return _0x50ddb5[_0x279f('0xbb')](_0x304b6b['body'][_0x279f('0x71')],_[_0x279f('0x87')](_0x304b6b[_0x279f('0x62')],[_0x279f('0x71'),'id'])||{})['spread'](function(_0x1a6d44){for(var _0x2c8260=0x0;_0x2c8260<_0x304b6b[_0x279f('0x62')][_0x279f('0x71')][_0x279f('0x5e')];_0x2c8260+=0x1){socket[_0x279f('0xbc')](_0x279f('0xbd'),{'UserId':Number(_0x304b6b['body']['ids'][_0x2c8260]),'MailAccountId':Number(_0x304b6b[_0x279f('0x65')]['id'])});}return _0x1a6d44;});}})[_0x279f('0x22')](respondWithResult(_0x128f75,null))[_0x279f('0x18')](handleError(_0x128f75,null));};exports[_0x279f('0xbe')]=function(_0x5a463b,_0x2c7800){return db[_0x279f('0x47')][_0x279f('0x60')]({'where':{'id':_0x5a463b[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x2c7800,null))['then'](function(_0x1c1c01){if(_0x1c1c01){return _0x1c1c01[_0x279f('0xbe')](_0x5a463b['query']['ids'])[_0x279f('0x22')](function(){if(_[_0x279f('0xbf')](_0x5a463b[_0x279f('0x4d')][_0x279f('0x71')])){for(var _0x3b0936=0x0;_0x3b0936<_0x5a463b[_0x279f('0x4d')][_0x279f('0x71')][_0x279f('0x5e')];_0x3b0936+=0x1){socket[_0x279f('0xbc')](_0x279f('0xc0'),{'UserId':Number(_0x5a463b[_0x279f('0x4d')][_0x279f('0x71')][_0x3b0936]),'MailAccountId':Number(_0x5a463b[_0x279f('0x65')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x5a463b[_0x279f('0x4d')][_0x279f('0x71')]),'MailAccountId':Number(_0x5a463b['params']['id'])});}});}})[_0x279f('0x22')](respondWithStatusCode(_0x2c7800,null))[_0x279f('0x18')](handleError(_0x2c7800,null));};exports['getAgents']=function(_0x514ed7,_0x10ea8c){var _0x3931ed={};var _0x567d16={};var _0x2c357a;var _0x5ed879;return db[_0x279f('0x47')][_0x279f('0x6a')]({'where':{'id':_0x514ed7[_0x279f('0x65')]['id']}})[_0x279f('0x22')](handleEntityNotFound(_0x10ea8c,null))['then'](function(_0x1dde55){if(_0x1dde55){_0x2c357a=_0x1dde55;_0x567d16[_0x279f('0x4b')]=_[_0x279f('0x4e')](db[_0x279f('0x8a')][_0x279f('0x5d')]);_0x567d16[_0x279f('0x4d')]=_[_0x279f('0x4e')](_0x514ed7[_0x279f('0x4d')]);_0x567d16[_0x279f('0x4f')]=_[_0x279f('0x50')](_0x567d16['model'],_0x567d16[_0x279f('0x4d')]);_0x3931ed[_0x279f('0x52')]=_[_0x279f('0x50')](_0x567d16['model'],qs[_0x279f('0x51')](_0x514ed7[_0x279f('0x4d')][_0x279f('0x51')]));_0x3931ed[_0x279f('0x52')]=_0x3931ed[_0x279f('0x52')][_0x279f('0x5e')]?_0x3931ed['attributes']:_0x567d16['model'];_0x3931ed[_0x279f('0x54')]=qs['sort'](_0x514ed7[_0x279f('0x4d')][_0x279f('0x55')]);_0x3931ed['where']=qs[_0x279f('0x4f')](_[_0x279f('0x57')](_0x514ed7[_0x279f('0x4d')],_0x567d16[_0x279f('0x4f')]));if(_0x514ed7['query'][_0x279f('0x6d')]){_0x3931ed[_0x279f('0x56')]=_[_0x279f('0x59')](_0x3931ed[_0x279f('0x56')],{'$or':_[_0x279f('0x4c')](_0x3931ed[_0x279f('0x52')],function(_0x347ca4){var _0x231a37={};_0x231a37[_0x347ca4]={'$like':'%'+_0x514ed7[_0x279f('0x4d')]['filter']+'%'};return _0x231a37;})});}_0x3931ed=_['merge']({},_0x3931ed,_0x514ed7[_0x279f('0x5f')]);return _0x2c357a[_0x279f('0xc1')](_0x3931ed);}})[_0x279f('0x22')](function(_0x53c3a9){if(_0x53c3a9){_0x5ed879=_0x53c3a9[_0x279f('0x5e')];if(!_0x514ed7[_0x279f('0x4d')][_0x279f('0x53')](_0x279f('0x6c'))){_0x3931ed['limit']=qs['limit'](_0x514ed7[_0x279f('0x4d')][_0x279f('0x1f')]);_0x3931ed[_0x279f('0x1d')]=qs['offset'](_0x514ed7[_0x279f('0x4d')]['offset']);}return _0x2c357a['getAgents'](_0x3931ed);}})[_0x279f('0x22')](function(_0x519e8e){if(_0x519e8e){return _0x519e8e?{'count':_0x5ed879,'rows':_0x519e8e}:null;}})[_0x279f('0x22')](respondWithResult(_0x10ea8c,null))[_0x279f('0x18')](handleError(_0x10ea8c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 802f68b..ab9e0fe 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 _0x5fdc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5fdc,0x127));var _0xc5fd=function(_0x246821,_0x33c029){_0x246821=_0x246821-0x0;var _0x487fba=_0x5fdc[_0x246821];return _0x487fba;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var MailAccount=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc5fd('0x3')](0x0);var events={'afterCreate':_0xc5fd('0x4'),'afterUpdate':_0xc5fd('0x5'),'afterDestroy':_0xc5fd('0x6')};function emitEvent(_0x4d015c){return function(_0xfdf928,_0x1b6205,_0xca27a0){MailAccountEvents[_0xc5fd('0x7')](_0x4d015c+':'+_0xfdf928['id'],_0xfdf928);MailAccountEvents[_0xc5fd('0x7')](_0x4d015c,_0xfdf928);_0xca27a0(null);};}for(var e in events){if(events[_0xc5fd('0x8')](e)){var event=events[e];MailAccount[_0xc5fd('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xef56=['exports','setMaxListeners','update','remove','emit','hook'];(function(_0x555828,_0x419b5e){var _0x5ea454=function(_0x1a0c2d){while(--_0x1a0c2d){_0x555828['push'](_0x555828['shift']());}};_0x5ea454(++_0x419b5e);}(_0xef56,0x103));var _0x6ef5=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xef56[_0x257642];return _0x3d813b;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6ef5('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ef5('0x1'),'afterDestroy':_0x6ef5('0x2')};function emitEvent(_0x379c5e){return function(_0x4d849c,_0x48ca2d,_0x1e6d88){MailAccountEvents[_0x6ef5('0x3')](_0x379c5e+':'+_0x4d849c['id'],_0x4d849c);MailAccountEvents[_0x6ef5('0x3')](_0x379c5e,_0x4d849c);_0x1e6d88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x6ef5('0x4')](e,emitEvent(event));}}module[_0x6ef5('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index cae2328..5997bfc 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 _0x50cf=['secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port'];(function(_0x561388,_0x148993){var _0x20e3f7=function(_0x380873){while(--_0x380873){_0x561388['push'](_0x561388['shift']());}};_0x20e3f7(++_0x148993);}(_0x50cf,0x19a));var _0xf50c=function(_0x130f2a,_0x42e69c){_0x130f2a=_0x130f2a-0x0;var _0x471c73=_0x50cf[_0x130f2a];return _0x471c73;};'use strict';var attributes=require(_0xf50c('0x0'));module[_0xf50c('0x1')]=function(_0x495361){return _0x495361['define'](_0xf50c('0x2'),attributes,{'tableName':_0xf50c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x9a06bd=this;var _0x70d13b={'id':_0x9a06bd['id'],'tls':{'rejectUnauthorized':![]}};if(_0x9a06bd[_0xf50c('0x4')]!==_0xf50c('0x5')){_0x70d13b[_0xf50c('0x6')]=_0x9a06bd[_0xf50c('0x4')];}else{_0x70d13b[_0xf50c('0x7')]=_0x9a06bd[_0xf50c('0x8')]['host'];_0x70d13b[_0xf50c('0x9')]=_0x9a06bd['Smtp'][_0xf50c('0x9')];_0x70d13b['secure']=_0x9a06bd[_0xf50c('0x8')][_0xf50c('0xa')];}if(_0x9a06bd['Smtp'][_0xf50c('0xb')]){if(_0x9a06bd[_0xf50c('0x8')][_0xf50c('0xc')]){if(!_0x9a06bd[_0xf50c('0x8')][_0xf50c('0xd')])throw new Error(_0xf50c('0xe'));_0x70d13b['auth']={'type':_0xf50c('0xf'),'user':_0x9a06bd[_0xf50c('0x8')][_0xf50c('0x10')],'accessToken':_0x9a06bd[_0xf50c('0x8')][_0xf50c('0xd')][_0xf50c('0x11')]};}else{_0x70d13b[_0xf50c('0x12')]={'user':_0x9a06bd[_0xf50c('0x8')][_0xf50c('0x10')],'pass':_0x9a06bd[_0xf50c('0x8')][_0xf50c('0x13')]};}}return _0x70d13b;}}});}; \ No newline at end of file +var _0xf19a=['auth','pass','./mailAccount.attributes','exports','define','provider','custom','service','host','port','Smtp','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','data5'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0xf19a,0x178));var _0xaf19=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0xf19a[_0x38b2d9];return _0x23a3e1;};'use strict';var attributes=require(_0xaf19('0x0'));module[_0xaf19('0x1')]=function(_0x223562){return _0x223562[_0xaf19('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a893a=this;var _0x426f7a={'id':_0x4a893a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a893a[_0xaf19('0x3')]!==_0xaf19('0x4')){_0x426f7a[_0xaf19('0x5')]=_0x4a893a[_0xaf19('0x3')];}else{_0x426f7a[_0xaf19('0x6')]=_0x4a893a['Smtp'][_0xaf19('0x6')];_0x426f7a[_0xaf19('0x7')]=_0x4a893a[_0xaf19('0x8')][_0xaf19('0x7')];_0x426f7a['secure']=_0x4a893a[_0xaf19('0x8')][_0xaf19('0x9')];}if(_0x4a893a['Smtp'][_0xaf19('0xa')]){if(_0x4a893a[_0xaf19('0x8')]['modernAuthentication']){if(!_0x4a893a[_0xaf19('0x8')][_0xaf19('0xb')])throw new Error(_0xaf19('0xc'));_0x426f7a['auth']={'type':_0xaf19('0xd'),'user':_0x4a893a[_0xaf19('0x8')]['user'],'accessToken':_0x4a893a['Smtp'][_0xaf19('0xb')][_0xaf19('0xe')]};}else{_0x426f7a[_0xaf19('0xf')]={'user':_0x4a893a['Smtp']['user'],'pass':_0x4a893a[_0xaf19('0x8')][_0xaf19('0x10')]};}}return _0x426f7a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c02b750..e2cfd08 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 _0x7d9f=['ChatOfflineMessageId','UserId','User','name','waitForTheAssignedAgent','queueId','unshift','queue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','info','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','update','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email'];(function(_0x556f93,_0x429fb1){var _0x23204a=function(_0x5a34ce){while(--_0x5a34ce){_0x556f93['push'](_0x556f93['shift']());}};_0x23204a(++_0x429fb1);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x957193,_0x3fec8b){_0x957193=_0x957193-0x0;var _0x9473f8=_0x7d9f[_0x957193];return _0x9473f8;};'use strict';var _=require(_0xf7d9('0x0'));var moment=require(_0xf7d9('0x1'));var BPromise=require(_0xf7d9('0x2'));var rs=require(_0xf7d9('0x3'));var Redis=require(_0xf7d9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xf7d9('0x5'))(_0xf7d9('0x6'));var config=require(_0xf7d9('0x7'));var jayson=require(_0xf7d9('0x8'));var client=jayson[_0xf7d9('0x9')]['http']({'port':0x232c});config['redis']=_[_0xf7d9('0xa')](config[_0xf7d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7d9('0xc'))(new Redis(config[_0xf7d9('0xb')]));require('./mailAccount.socket')[_0xf7d9('0xd')](socket);function respondWithRpcPromise(_0x4cd620,_0x265548,_0x33360a){return new BPromise(function(_0x5d2735,_0x560a34){return client[_0xf7d9('0xe')](_0x4cd620,_0x33360a)[_0xf7d9('0xf')](function(_0x2a14e2){logger['info']('MailAccount,\x20%s,\x20%s',_0x265548,_0xf7d9('0x10'));logger[_0xf7d9('0x11')](_0xf7d9('0x12'),_0x265548,_0xf7d9('0x10'),JSON['stringify'](_0x2a14e2));if(_0x2a14e2[_0xf7d9('0x13')]){if(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x14')]===0x1f4){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x560a34(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);}logger['error'](_0xf7d9('0x16'),_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x5d2735(_0x2a14e2['error']['message']);}else{logger[_0xf7d9('0x17')](_0xf7d9('0x16'),_0x265548,_0xf7d9('0x10'));_0x5d2735(_0x2a14e2['result'][_0xf7d9('0x15')]);}})[_0xf7d9('0x18')](function(_0x5eb7c9){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x5eb7c9);_0x560a34(_0x5eb7c9);});});}exports[_0xf7d9('0x19')]=function(_0x1bbc77){var _0x5e0b9e=this;return new Promise(function(_0x34acd2,_0x43dcff){return db[_0xf7d9('0x1a')][_0xf7d9('0x1b')]({'raw':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['where']||null:null,'attributes':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1e')]||null:null,'limit':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1f')]||null:null,'include':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['include']?_[_0xf7d9('0x20')](_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x21')],function(_0x595556){return{'model':db[_0x595556[_0xf7d9('0x22')]],'as':_0x595556['as'],'attributes':_0x595556['attributes'],'include':_0x595556[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x595556[_0xf7d9('0x21')],function(_0x5b1ea5){return{'model':db[_0x5b1ea5[_0xf7d9('0x22')]],'as':_0x5b1ea5['as'],'attributes':_0x5b1ea5[_0xf7d9('0x1e')],'include':_0x5b1ea5[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x5b1ea5[_0xf7d9('0x21')],function(_0x540086){return{'model':db[_0x540086[_0xf7d9('0x22')]],'as':_0x540086['as'],'attributes':_0x540086[_0xf7d9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x2c04c3){logger['info'](_0xf7d9('0x19'),_0x1bbc77);logger[_0xf7d9('0x11')](_0xf7d9('0x19'),_0x1bbc77,JSON[_0xf7d9('0x23')](_0x2c04c3));_0x34acd2(_0x2c04c3);})[_0xf7d9('0x18')](function(_0x16318f){logger['error']('GetMailAccount',_0x16318f['message'],_0x1bbc77);_0x43dcff(_0x5e0b9e[_0xf7d9('0x13')](0x1f4,_0x16318f['message']));});});};exports[_0xf7d9('0x24')]=function(_0x48c13c){var _0x3ecbb9=this;return new Promise(function(_0x59c246,_0x4ecfbd){return db['MailAccount'][_0xf7d9('0x25')]({'raw':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x26')]||null:null,'attributes':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1e')]||null:null,'include':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x21')]?_['map'](_0x48c13c['options'][_0xf7d9('0x21')],function(_0x1fd532){return{'model':db[_0x1fd532[_0xf7d9('0x22')]],'as':_0x1fd532['as'],'attributes':_0x1fd532['attributes'],'include':_0x1fd532[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1fd532[_0xf7d9('0x21')],function(_0x1be610){return{'model':db[_0x1be610[_0xf7d9('0x22')]],'as':_0x1be610['as'],'attributes':_0x1be610[_0xf7d9('0x1e')],'include':_0x1be610[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1be610[_0xf7d9('0x21')],function(_0x1c42bb){return{'model':db[_0x1c42bb[_0xf7d9('0x22')]],'as':_0x1c42bb['as'],'attributes':_0x1c42bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x4ce081){if(_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x27')]===!![])_0x4ce081[_0xf7d9('0x28')](_0xf7d9('0x29'),_0x4ce081['getSmtpOptions']());logger['info'](_0xf7d9('0x24'),_0x48c13c);logger['debug'](_0xf7d9('0x24'),_0x48c13c,JSON[_0xf7d9('0x23')](_0x4ce081));_0x59c246(_0x4ce081);})[_0xf7d9('0x18')](function(_0x1e412b){logger['error']('ShowMailAccount',_0x1e412b[_0xf7d9('0x15')],_0x48c13c);_0x4ecfbd(_0x3ecbb9[_0xf7d9('0x13')](0x1f4,_0x1e412b[_0xf7d9('0x15')]));});});};exports[_0xf7d9('0x2a')]=function(_0x4b4389){var _0x17731b=this;return new Promise(function(_0xd6d84f,_0xd7f316){var _0x33e692={'body':_0x4b4389[_0xf7d9('0x2b')],'channel':'mail'};var _0x28c932=_[_0xf7d9('0x2c')](_[_0xf7d9('0x2d')](db[_0xf7d9('0x2e')][_0xf7d9('0x2f')]),[_0xf7d9('0x30'),_0xf7d9('0x31'),_0xf7d9('0x32'),_0xf7d9('0x33')]);var _0x3d056f=![];if(_0x4b4389[_0xf7d9('0x2b')]['id']){delete _0x4b4389[_0xf7d9('0x2b')]['id'];}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')])){return _0xd7f316(_0x17731b['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')]['body'])||_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')]===''){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x35')));}if(_[_0xf7d9('0x36')](_0x4b4389['body'][_0xf7d9('0x37')])){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x38')+_0x28c932));}if(!_[_0xf7d9('0x39')](_0x28c932,_0x4b4389[_0xf7d9('0x2b')]['mapKey'])){return _0xd7f316(_0x17731b['error'](0x1f4,_0xf7d9('0x3a')+_0x28c932));}var _0x113a2b={};_0x113a2b[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389[_0xf7d9('0x2b')]['from'];return db[_0xf7d9('0x1a')]['find']({'where':{'id':_0x4b4389[_0xf7d9('0x3b')]['id']},'include':[{'model':db[_0xf7d9('0x3c')],'as':_0xf7d9('0x3d'),'include':[{'model':db[_0xf7d9('0x2e')],'as':_0xf7d9('0x3e'),'where':_0x113a2b,'limit':0x1,'order':[[_0xf7d9('0x31'),_0xf7d9('0x3f')]]}]},{'model':db[_0xf7d9('0x40')],'as':_0xf7d9('0x41')},{'model':db[_0xf7d9('0x42')],'as':_0xf7d9('0x43'),'include':[{'model':db[_0xf7d9('0x44')],'as':_0xf7d9('0x44')}]}]})[_0xf7d9('0xf')](function(_0x50731a){if(_0x50731a&&_0x50731a[_0xf7d9('0x3d')]){var _0x1f1ee5=_0x50731a['get']({'plain':!![]});_0x33e692['account']=_[_0xf7d9('0x45')](_0x1f1ee5,['Applications','List']);_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x29')]=_0x50731a[_0xf7d9('0x46')]();_0x33e692[_0xf7d9('0x47')]=_0x1f1ee5[_0xf7d9('0x41')];_0x33e692[_0xf7d9('0x48')]=_0x1f1ee5[_0xf7d9('0x3d')];_0x33e692[_0xf7d9('0x47')]=_[_0xf7d9('0x49')](_0x33e692[_0xf7d9('0x47')],[_0xf7d9('0x4a')],[_0xf7d9('0x4b')]);if(_0x33e692['account']&&_0x33e692['account'][_0xf7d9('0x4c')]){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x4d')]({'id':0x0,'priority':_0x33e692[_0xf7d9('0x47')]['length']+0x1,'app':_0xf7d9('0x4e'),'appdata':_0xf7d9('0x4c'),'interval':_0xf7d9('0x4f')});}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')];}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')];}if(_0x1f1ee5['List'][_0xf7d9('0x3e')][_0xf7d9('0x50')]){return _0x1f1ee5[_0xf7d9('0x3d')][_0xf7d9('0x3e')][0x0];}var _0x3c3bd3=_[_0xf7d9('0xa')](_0x4b4389['body'],{'firstName':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')],'ListId':_0x1f1ee5[_0xf7d9('0x33')]});_0x3c3bd3[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389['body'][_0xf7d9('0x34')];return db[_0xf7d9('0x2e')][_0xf7d9('0x51')](_0x3c3bd3);}else{throw new Error(_0xf7d9('0x52'));}})[_0xf7d9('0xf')](function(_0x379f88){_0x33e692[_0xf7d9('0x53')]=_0x379f88;if(_0x379f88){if(!_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]){_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]=rs[_0xf7d9('0x55')]()+'\x20'+_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['from'];}var _0x310c05={'ContactId':_0x379f88['id'],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'inReplyTo':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'cc':_0x4b4389['body'][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x56')],'attach':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x57')],'lastMsgAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x4b4389['account']['id']},'include':[{'model':db[_0xf7d9('0x5a')],'as':'Messages','attributes':[_0xf7d9('0x54')],'where':{'messageId':_0x4b4389['body']['message'][_0xf7d9('0x5b')]}}]})[_0xf7d9('0xf')](function(_0x2f469c){if(_0x2f469c){return[_0x2f469c,![]];}return db[_0xf7d9('0x5c')][_0xf7d9('0x51')](_0x310c05)[_0xf7d9('0xf')](function(_0x56feae){return[_0x56feae,!![]];});});}else{throw new Error(_0xf7d9('0x5d'));}})['spread'](function(_0x2ca4e5,_0x3d33f2){if(_0x2ca4e5){_0x3d056f=_0x3d33f2;if(!_0x3d33f2){return _0x2ca4e5[_0xf7d9('0x5e')]({'inReplyTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')]['message']['from'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x2ca4e5['attach']?_0x2ca4e5[_0xf7d9('0x57')]:_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x57')],'substatus':null,'substatusAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgAt':moment()['format'](_0xf7d9('0x59')),'lastMsgDirection':'in'});}else{return _0x2ca4e5;}}})[_0xf7d9('0xf')](function(_0x5c25d6){_0x33e692[_0xf7d9('0x5f')]=_0x5c25d6['get']({'plain':!![]});_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x60')]=_0x3d056f;return db['MailMessage']['create']({'body':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'MailInteractionId':_0x5c25d6['id'],'direction':'in','ContactId':_0x33e692[_0xf7d9('0x53')]['id'],'messageId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'from':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['to'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x57')],'Attachments':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x61')],'originTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x62')],'originCc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x63')],'bcc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x64')],'ChatWebsiteId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x65')]||null,'originChannel':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x66')]||_0xf7d9('0x67'),'ChatOfflineMessageId':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x68')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xf7d9('0xf')](function(_0x437240){_0x33e692[_0xf7d9('0x15')]=_0x437240;if(!_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x69')]){return;}return db[_0xf7d9('0x6a')][_0xf7d9('0x25')]({'attributes':['id',_0xf7d9('0x6b')],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['UserId']}});})[_0xf7d9('0xf')](function(_0x424774){if(_0x424774){_0x33e692['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x424774['name']+','+(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x6c')]||0xa),'interval':_0xf7d9('0x4f')});}if(!_0x33e692['interaction'][_0xf7d9('0x6d')]){return;}return db['MailQueue'][_0xf7d9('0x25')]({'attributes':['id','name'],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['queueId']}});})[_0xf7d9('0xf')](function(_0x4abd04){if(_0x4abd04){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x6e')]({'id':0x0,'priority':0x1,'app':_0xf7d9('0x6f'),'appdata':_0x4abd04[_0xf7d9('0x6b')]+','+(_0x33e692[_0xf7d9('0x3b')]['waitForTheAssignedQueue']||0x12c),'interval':_0xf7d9('0x4f')});}return respondWithRpcPromise('Start',_0xf7d9('0x70'),_0x33e692);})[_0xf7d9('0xf')](function(_0x52673b){_0xd6d84f(_0x52673b);})[_0xf7d9('0x18')](function(_0x50ec3c){_0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0x50ec3c[_0xf7d9('0x15')]));});});}; \ No newline at end of file +var _0x5162=['list','applications','orderBy','length','close','autoclose','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','update','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','model','map','info','stringify','ShowMailAccount','find','where','then','smtp','setDataValue','NotifyMailAccount','body','mail','keys','CmContact','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','account','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','Applications','smtpOptions','getSmtpOptions'];(function(_0x1c83f8,_0xb7b5fe){var _0x13dd8d=function(_0x1ce5c9){while(--_0x1ce5c9){_0x1c83f8['push'](_0x1c83f8['shift']());}};_0x13dd8d(++_0xb7b5fe);}(_0x5162,0x103));var _0x2516=function(_0x4a1327,_0x3642ab){_0x4a1327=_0x4a1327-0x0;var _0x2fcd03=_0x5162[_0x4a1327];return _0x2fcd03;};'use strict';var _=require(_0x2516('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require(_0x2516('0x1'))['db'];var logger=require(_0x2516('0x2'))(_0x2516('0x3'));var config=require(_0x2516('0x4'));var jayson=require(_0x2516('0x5'));var client=jayson[_0x2516('0x6')][_0x2516('0x7')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0x2516('0x8'),'port':0x18eb});var socket=require(_0x2516('0x9'))(new Redis(config[_0x2516('0xa')]));require(_0x2516('0xb'))[_0x2516('0xc')](socket);function respondWithRpcPromise(_0x32948b,_0x1cb817,_0x590875){return new BPromise(function(_0x409550,_0x3f7e71){return client[_0x2516('0xd')](_0x32948b,_0x590875)['then'](function(_0x530b1b){logger['info']('MailAccount,\x20%s,\x20%s',_0x1cb817,_0x2516('0xe'));logger[_0x2516('0xf')](_0x2516('0x10'),_0x1cb817,_0x2516('0xe'),JSON['stringify'](_0x530b1b));if(_0x530b1b[_0x2516('0x11')]){if(_0x530b1b[_0x2516('0x11')][_0x2516('0x12')]===0x1f4){logger[_0x2516('0x11')](_0x2516('0x13'),_0x1cb817,_0x530b1b[_0x2516('0x11')][_0x2516('0x14')]);return _0x3f7e71(_0x530b1b[_0x2516('0x11')][_0x2516('0x14')]);}logger[_0x2516('0x11')](_0x2516('0x13'),_0x1cb817,_0x530b1b[_0x2516('0x11')][_0x2516('0x14')]);return _0x409550(_0x530b1b[_0x2516('0x11')][_0x2516('0x14')]);}else{logger['info'](_0x2516('0x13'),_0x1cb817,_0x2516('0xe'));_0x409550(_0x530b1b[_0x2516('0x15')]['message']);}})[_0x2516('0x16')](function(_0x5e96c7){logger['error'](_0x2516('0x13'),_0x1cb817,_0x5e96c7);_0x3f7e71(_0x5e96c7);});});}exports[_0x2516('0x17')]=function(_0x151168){var _0x618aed=this;return new Promise(function(_0x198b93,_0x42ba50){return db[_0x2516('0x18')][_0x2516('0x19')]({'raw':_0x151168[_0x2516('0x1a')]?_0x151168[_0x2516('0x1a')][_0x2516('0x1b')]===undefined?!![]:![]:!![],'where':_0x151168[_0x2516('0x1a')]?_0x151168[_0x2516('0x1a')]['where']||null:null,'attributes':_0x151168['options']?_0x151168[_0x2516('0x1a')][_0x2516('0x1c')]||null:null,'limit':_0x151168[_0x2516('0x1a')]?_0x151168[_0x2516('0x1a')][_0x2516('0x1d')]||null:null,'include':_0x151168[_0x2516('0x1a')]?_0x151168[_0x2516('0x1a')][_0x2516('0x1e')]?_['map'](_0x151168[_0x2516('0x1a')][_0x2516('0x1e')],function(_0x774b60){return{'model':db[_0x774b60[_0x2516('0x1f')]],'as':_0x774b60['as'],'attributes':_0x774b60['attributes'],'include':_0x774b60[_0x2516('0x1e')]?_[_0x2516('0x20')](_0x774b60[_0x2516('0x1e')],function(_0x3d728a){return{'model':db[_0x3d728a[_0x2516('0x1f')]],'as':_0x3d728a['as'],'attributes':_0x3d728a['attributes'],'include':_0x3d728a[_0x2516('0x1e')]?_[_0x2516('0x20')](_0x3d728a[_0x2516('0x1e')],function(_0x2cb847){return{'model':db[_0x2cb847[_0x2516('0x1f')]],'as':_0x2cb847['as'],'attributes':_0x2cb847[_0x2516('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x136893){logger[_0x2516('0x21')]('GetMailAccount',_0x151168);logger[_0x2516('0xf')](_0x2516('0x17'),_0x151168,JSON[_0x2516('0x22')](_0x136893));_0x198b93(_0x136893);})[_0x2516('0x16')](function(_0x539704){logger[_0x2516('0x11')](_0x2516('0x17'),_0x539704[_0x2516('0x14')],_0x151168);_0x42ba50(_0x618aed[_0x2516('0x11')](0x1f4,_0x539704[_0x2516('0x14')]));});});};exports[_0x2516('0x23')]=function(_0x2978b2){var _0x2a5346=this;return new Promise(function(_0x20f6bf,_0xe29221){return db['MailAccount'][_0x2516('0x24')]({'raw':_0x2978b2['options']?_0x2978b2[_0x2516('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2978b2[_0x2516('0x1a')]?_0x2978b2['options'][_0x2516('0x25')]||null:null,'attributes':_0x2978b2[_0x2516('0x1a')]?_0x2978b2[_0x2516('0x1a')][_0x2516('0x1c')]||null:null,'include':_0x2978b2[_0x2516('0x1a')]?_0x2978b2[_0x2516('0x1a')][_0x2516('0x1e')]?_[_0x2516('0x20')](_0x2978b2[_0x2516('0x1a')]['include'],function(_0x2965e6){return{'model':db[_0x2965e6[_0x2516('0x1f')]],'as':_0x2965e6['as'],'attributes':_0x2965e6[_0x2516('0x1c')],'include':_0x2965e6[_0x2516('0x1e')]?_['map'](_0x2965e6['include'],function(_0x3f505f){return{'model':db[_0x3f505f[_0x2516('0x1f')]],'as':_0x3f505f['as'],'attributes':_0x3f505f[_0x2516('0x1c')],'include':_0x3f505f[_0x2516('0x1e')]?_[_0x2516('0x20')](_0x3f505f[_0x2516('0x1e')],function(_0x1979b5){return{'model':db[_0x1979b5[_0x2516('0x1f')]],'as':_0x1979b5['as'],'attributes':_0x1979b5[_0x2516('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2516('0x26')](function(_0x541d69){if(_0x2978b2['options'][_0x2516('0x27')]===!![])_0x541d69[_0x2516('0x28')]('smtpOptions',_0x541d69['getSmtpOptions']());logger[_0x2516('0x21')](_0x2516('0x23'),_0x2978b2);logger['debug'](_0x2516('0x23'),_0x2978b2,JSON['stringify'](_0x541d69));_0x20f6bf(_0x541d69);})[_0x2516('0x16')](function(_0x4412cf){logger['error'](_0x2516('0x23'),_0x4412cf[_0x2516('0x14')],_0x2978b2);_0xe29221(_0x2a5346[_0x2516('0x11')](0x1f4,_0x4412cf[_0x2516('0x14')]));});});};exports[_0x2516('0x29')]=function(_0x25c33a){var _0x2137a4=this;return new Promise(function(_0x2371a8,_0x346e31){var _0xc1c0fb={'body':_0x25c33a[_0x2516('0x2a')],'channel':_0x2516('0x2b')};var _0x89b14c=_['difference'](_[_0x2516('0x2c')](db[_0x2516('0x2d')]['rawAttributes']),[_0x2516('0x2e'),_0x2516('0x2f'),_0x2516('0x30'),_0x2516('0x31')]);var _0x421c58=![];if(_0x25c33a['body']['id']){delete _0x25c33a[_0x2516('0x2a')]['id'];}if(_[_0x2516('0x32')](_0x25c33a[_0x2516('0x2a')][_0x2516('0x33')])){return _0x346e31(_0x2137a4[_0x2516('0x11')](0x1f4,_0x2516('0x34')));}if(_['isNil'](_0x25c33a[_0x2516('0x2a')][_0x2516('0x2a')])||_0x25c33a[_0x2516('0x2a')][_0x2516('0x2a')]===''){return _0x346e31(_0x2137a4[_0x2516('0x11')](0x1f4,_0x2516('0x35')));}if(_[_0x2516('0x32')](_0x25c33a['body'][_0x2516('0x36')])){return _0x346e31(_0x2137a4['error'](0x1f4,_0x2516('0x37')+_0x89b14c));}if(!_['includes'](_0x89b14c,_0x25c33a[_0x2516('0x2a')][_0x2516('0x36')])){return _0x346e31(_0x2137a4[_0x2516('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x89b14c));}var _0x4a2de3={};_0x4a2de3[_0x25c33a[_0x2516('0x2a')][_0x2516('0x36')]]=_0x25c33a['body']['from'];return db[_0x2516('0x18')][_0x2516('0x24')]({'where':{'id':_0x25c33a[_0x2516('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x2516('0x39'),'include':[{'model':db['CmContact'],'as':_0x2516('0x3a'),'where':_0x4a2de3,'limit':0x1,'order':[[_0x2516('0x2f'),_0x2516('0x3b')]]}]},{'model':db[_0x2516('0x3c')],'as':'Applications'},{'model':db[_0x2516('0x3d')],'as':_0x2516('0x3e'),'include':[{'model':db[_0x2516('0x3f')],'as':_0x2516('0x3f')}]}]})[_0x2516('0x26')](function(_0x482883){if(_0x482883&&_0x482883[_0x2516('0x39')]){var _0x226466=_0x482883[_0x2516('0x40')]({'plain':!![]});_0xc1c0fb[_0x2516('0x38')]=_['omit'](_0x226466,[_0x2516('0x41'),_0x2516('0x39')]);_0xc1c0fb[_0x2516('0x38')][_0x2516('0x42')]=_0x482883[_0x2516('0x43')]();_0xc1c0fb['applications']=_0x226466[_0x2516('0x41')];_0xc1c0fb[_0x2516('0x44')]=_0x226466[_0x2516('0x39')];_0xc1c0fb[_0x2516('0x45')]=_[_0x2516('0x46')](_0xc1c0fb[_0x2516('0x45')],['priority'],['asc']);if(_0xc1c0fb['account']&&_0xc1c0fb[_0x2516('0x38')]['autoclose']){_0xc1c0fb['applications']['push']({'id':0x0,'priority':_0xc1c0fb[_0x2516('0x45')][_0x2516('0x47')]+0x1,'app':_0x2516('0x48'),'appdata':_0x2516('0x49'),'interval':_0x2516('0x4a')});}if(_0xc1c0fb['account'][_0x2516('0x41')]){delete _0xc1c0fb[_0x2516('0x38')][_0x2516('0x41')];}if(_0xc1c0fb['account'][_0x2516('0x39')]){delete _0xc1c0fb[_0x2516('0x38')]['List'];}if(_0x226466[_0x2516('0x39')][_0x2516('0x3a')][_0x2516('0x47')]){return _0x226466[_0x2516('0x39')][_0x2516('0x3a')][0x0];}var _0x5d92cb=_['defaults'](_0x25c33a[_0x2516('0x2a')],{'firstName':_0x25c33a['body'][_0x2516('0x33')],'ListId':_0x226466['ListId']});_0x5d92cb[_0x25c33a[_0x2516('0x2a')][_0x2516('0x36')]]=_0x25c33a[_0x2516('0x2a')][_0x2516('0x33')];return db[_0x2516('0x2d')][_0x2516('0x4b')](_0x5d92cb);}else{throw new Error(_0x2516('0x4c'));}})[_0x2516('0x26')](function(_0x424027){_0xc1c0fb[_0x2516('0x4d')]=_0x424027;if(_0x424027){if(!_0x25c33a[_0x2516('0x2a')]['message'][_0x2516('0x4e')]){_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['messageId']=rs[_0x2516('0x4f')]()+'\x20'+_0x25c33a['body'][_0x2516('0x14')][_0x2516('0x33')];}var _0x3d9e2d={'ContactId':_0x424027['id'],'MailAccountId':_0x25c33a['account']['id'],'inReplyTo':_0x25c33a['body']['message'][_0x2516('0x4e')],'to':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x33')],'cc':_0x25c33a['body'][_0x2516('0x14')]['cc'],'subject':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['subject'],'attach':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x50')],'lastMsgAt':moment()[_0x2516('0x51')](_0x2516('0x52')),'lastMsgDirection':'in'};return db[_0x2516('0x53')][_0x2516('0x24')]({'where':{'closed':![],'MailAccountId':_0x25c33a[_0x2516('0x38')]['id']},'include':[{'model':db[_0x2516('0x54')],'as':_0x2516('0x55'),'attributes':[_0x2516('0x4e')],'where':{'messageId':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['inReplyTo']}}]})[_0x2516('0x26')](function(_0x372461){if(_0x372461){return[_0x372461,![]];}return db[_0x2516('0x53')][_0x2516('0x4b')](_0x3d9e2d)[_0x2516('0x26')](function(_0x208cc5){return[_0x208cc5,!![]];});});}else{throw new Error(_0x2516('0x56'));}})['spread'](function(_0x3ce0d6,_0xab7abf){if(_0x3ce0d6){_0x421c58=_0xab7abf;if(!_0xab7abf){return _0x3ce0d6[_0x2516('0x57')]({'inReplyTo':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x4e')],'to':_0x25c33a['body']['message']['from'],'cc':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['cc'],'subject':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['subject'],'attach':_0x3ce0d6['attach']?_0x3ce0d6[_0x2516('0x50')]:_0x25c33a['body'][_0x2516('0x14')][_0x2516('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x2516('0x52')),'lastMsgAt':moment()[_0x2516('0x51')](_0x2516('0x52')),'lastMsgDirection':'in'});}else{return _0x3ce0d6;}}})[_0x2516('0x26')](function(_0x3069e3){_0xc1c0fb[_0x2516('0x58')]=_0x3069e3[_0x2516('0x40')]({'plain':!![]});_0xc1c0fb[_0x2516('0x58')][_0x2516('0x59')]=_0x421c58;return db['MailMessage']['create']({'body':_0x25c33a[_0x2516('0x2a')][_0x2516('0x2a')],'MailAccountId':_0x25c33a[_0x2516('0x38')]['id'],'MailInteractionId':_0x3069e3['id'],'direction':'in','ContactId':_0xc1c0fb['contact']['id'],'messageId':_0x25c33a[_0x2516('0x2a')]['message'][_0x2516('0x4e')],'from':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x33')],'to':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['to'],'cc':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['cc'],'subject':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')]['subject'],'attach':_0x25c33a['body'][_0x2516('0x14')]['attach'],'Attachments':_0x25c33a['body'][_0x2516('0x14')][_0x2516('0x5a')],'originTo':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x5b')],'originCc':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x5c')],'bcc':_0x25c33a[_0x2516('0x2a')]['message'][_0x2516('0x5d')],'ChatWebsiteId':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x5e')]||null,'originChannel':_0x25c33a['body'][_0x2516('0x14')][_0x2516('0x5f')]||_0x2516('0x60'),'ChatOfflineMessageId':_0x25c33a[_0x2516('0x2a')][_0x2516('0x14')][_0x2516('0x61')]||null},{'include':[{'model':db['Attachment'],'as':_0x2516('0x62')}]});})['then'](function(_0x509c68){_0xc1c0fb[_0x2516('0x14')]=_0x509c68;if(!_0xc1c0fb[_0x2516('0x58')][_0x2516('0x63')]){return;}return db['User'][_0x2516('0x24')]({'attributes':['id',_0x2516('0x64')],'where':{'id':_0xc1c0fb[_0x2516('0x58')][_0x2516('0x63')]}});})['then'](function(_0xbb8074){if(_0xbb8074){_0xc1c0fb[_0x2516('0x45')][_0x2516('0x65')]({'id':0x0,'priority':0x0,'app':_0x2516('0x66'),'appdata':_0xbb8074['name']+','+(_0xc1c0fb[_0x2516('0x38')][_0x2516('0x67')]||0xa),'interval':_0x2516('0x4a')});}if(!_0xc1c0fb['interaction'][_0x2516('0x68')]){return;}return db['MailQueue'][_0x2516('0x24')]({'attributes':['id',_0x2516('0x64')],'where':{'id':_0xc1c0fb[_0x2516('0x58')][_0x2516('0x68')]}});})[_0x2516('0x26')](function(_0x502cbf){if(_0x502cbf){_0xc1c0fb['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x2516('0x69'),'appdata':_0x502cbf[_0x2516('0x64')]+','+(_0xc1c0fb['account'][_0x2516('0x6a')]||0x12c),'interval':_0x2516('0x4a')});}return respondWithRpcPromise(_0x2516('0x6b'),_0x2516('0x6c'),_0xc1c0fb);})[_0x2516('0x26')](function(_0x20ee24){_0x2371a8(_0x20ee24);})['catch'](function(_0x84db05){_0x346e31(_0x2137a4[_0x2516('0x11')](0x1f4,_0x84db05[_0x2516('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b75ded6..4bd6c30 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 _0x32b8=['save','remove','removeListener','register','mailAccount:'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0x32b8,0x96));var _0x832b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x32b8[_0x2c91e9];return _0x13f0ff;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x832b('0x0'),_0x832b('0x1'),'update'];function createListener(_0x415818,_0x22f2ef){return function(_0x5ba7ce){_0x22f2ef['emit'](_0x415818,_0x5ba7ce);};}function removeListener(_0x2869a1,_0x39b0f3){return function(){MailAccountEvents[_0x832b('0x2')](_0x2869a1,_0x39b0f3);};}exports[_0x832b('0x3')]=function(_0xdc18){for(var _0x4bd578=0x0,_0xf8b413=events['length'];_0x4bd578<_0xf8b413;_0x4bd578++){var _0xabc3bd=events[_0x4bd578];var _0x6b9a75=createListener(_0x832b('0x4')+_0xabc3bd,_0xdc18);MailAccountEvents['on'](_0xabc3bd,_0x6b9a75);}}; \ No newline at end of file +var _0xe53c=['save','remove'];(function(_0x268f95,_0x49c51b){var _0x480311=function(_0x261631){while(--_0x261631){_0x268f95['push'](_0x268f95['shift']());}};_0x480311(++_0x49c51b);}(_0xe53c,0x17e));var _0xce53=function(_0x20f060,_0xe160c9){_0x20f060=_0x20f060-0x0;var _0x46077c=_0xe53c[_0x20f060];return _0x46077c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xce53('0x0'),_0xce53('0x1'),'update'];function createListener(_0x29506f,_0x47db0d){return function(_0x79ee59){_0x47db0d['emit'](_0x29506f,_0x79ee59);};}function removeListener(_0x1528e6,_0x21857c){return function(){MailAccountEvents['removeListener'](_0x1528e6,_0x21857c);};}exports['register']=function(_0xf2f463){for(var _0x15c1f1=0x0,_0x579aa3=events['length'];_0x15c1f1<_0x579aa3;_0x15c1f1++){var _0x4188ce=events[_0x15c1f1];var _0x5998cf=createListener('mailAccount:'+_0x4188ce,_0xf2f463);MailAccountEvents['on'](_0x4188ce,_0x5998cf);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2229f6d..8811eac 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 _0x5054=['show','put','isAuthenticated','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id'];(function(_0x2a418f,_0x39b19c){var _0x5ebd7e=function(_0x4a514a){while(--_0x4a514a){_0x2a418f['push'](_0x2a418f['shift']());}};_0x5ebd7e(++_0x39b19c);}(_0x5054,0x6f));var _0x4505=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5054[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x4505('0x0'));var path=require('path');var timeout=require(_0x4505('0x1'));var express=require(_0x4505('0x2'));var router=express['Router']();var fs_extra=require(_0x4505('0x3'));var auth=require(_0x4505('0x4'));var interaction=require(_0x4505('0x5'));var config=require(_0x4505('0x6'));var controller=require(_0x4505('0x7'));router['get'](_0x4505('0x8'),auth['isAuthenticated'](),controller[_0x4505('0x9')]);router[_0x4505('0xa')](_0x4505('0x8'),auth[_0x4505('0xb')](),controller['update']);router[_0x4505('0xc')]('/:id',auth[_0x4505('0xb')](),controller[_0x4505('0xd')]);module[_0x4505('0xe')]=router; \ No newline at end of file +var _0x9242=['/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x26cccb,_0x38d509){var _0xc3977d=function(_0x18b4c2){while(--_0x18b4c2){_0x26cccb['push'](_0x26cccb['shift']());}};_0xc3977d(++_0x38d509);}(_0x9242,0x76));var _0x2924=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x9242[_0x5d6c3e];return _0x44ecb7;};'use strict';var multer=require(_0x2924('0x0'));var util=require(_0x2924('0x1'));var path=require(_0x2924('0x2'));var timeout=require(_0x2924('0x3'));var express=require('express');var router=express[_0x2924('0x4')]();var fs_extra=require(_0x2924('0x5'));var auth=require(_0x2924('0x6'));var interaction=require(_0x2924('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0x2924('0x8'),auth[_0x2924('0x9')](),controller[_0x2924('0xa')]);router[_0x2924('0xb')](_0x2924('0x8'),auth[_0x2924('0x9')](),controller[_0x2924('0xc')]);router['delete'](_0x2924('0x8'),auth[_0x2924('0x9')](),controller[_0x2924('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9204ef7..294434b 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 _0xc343=['STRING','*,*,*,*','exports','noop','TEXT'];(function(_0x49b409,_0xa8f9c4){var _0x1e0209=function(_0x3db5e8){while(--_0x3db5e8){_0x49b409['push'](_0x49b409['shift']());}};_0x1e0209(++_0xa8f9c4);}(_0xc343,0x7f));var _0x3c34=function(_0x5f55bb,_0x41a1dc){_0x5f55bb=_0x5f55bb-0x0;var _0xeaa7a1=_0xc343[_0x5f55bb];return _0xeaa7a1;};'use strict';var Sequelize=require('sequelize');module[_0x3c34('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c34('0x1')},'appdata':{'type':Sequelize[_0x3c34('0x2')]()},'description':{'type':Sequelize[_0x3c34('0x3')]},'interval':{'type':Sequelize[_0x3c34('0x3')],'defaultValue':_0x3c34('0x4')}}; \ No newline at end of file +var _0x7c77=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x4cdd4e,_0x1308da){var _0x35812b=function(_0x14dd18){while(--_0x14dd18){_0x4cdd4e['push'](_0x4cdd4e['shift']());}};_0x35812b(++_0x1308da);}(_0x7c77,0x16c));var _0x77c7=function(_0x33ef7a,_0x40a369){_0x33ef7a=_0x33ef7a-0x0;var _0x484534=_0x7c77[_0x33ef7a];return _0x484534;};'use strict';var Sequelize=require('sequelize');module[_0x77c7('0x0')]={'priority':{'type':Sequelize[_0x77c7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x77c7('0x2')],'allowNull':![],'defaultValue':_0x77c7('0x3')},'appdata':{'type':Sequelize[_0x77c7('0x4')]()},'description':{'type':Sequelize[_0x77c7('0x2')]},'interval':{'type':Sequelize[_0x77c7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 57f358c..8eb0d57 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 _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xedd9,0xfc));var _0x9edd=function(_0x4230dc,_0x5b9c73){_0x4230dc=_0x4230dc-0x0;var _0x2d65d2=_0xedd9[_0x4230dc];return _0x2d65d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4bad26,_0x3b4a8b){var _0x14a1b0=function(_0x17f558){while(--_0x17f558){_0x4bad26['push'](_0x4bad26['shift']());}};_0x14a1b0(++_0x3b4a8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7e8664a..4a89366 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 _0xec84=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x593752,_0xfc3827){var _0x4612be=function(_0x2d64c6){while(--_0x2d64c6){_0x593752['push'](_0x593752['shift']());}};_0x4612be(++_0xfc3827);}(_0xec84,0x13d));var _0x4ec8=function(_0x5a7f0b,_0x19d7ab){_0x5a7f0b=_0x5a7f0b-0x0;var _0xce718d=_0xec84[_0x5a7f0b];return _0xce718d;};'use strict';var _=require(_0x4ec8('0x0'));var util=require('util');var logger=require(_0x4ec8('0x1'))(_0x4ec8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ec8('0x3'));var config=require(_0x4ec8('0x4'));var attributes=require(_0x4ec8('0x5'));module[_0x4ec8('0x6')]=function(_0x54058b,_0x159529){return _0x54058b[_0x4ec8('0x7')](_0x4ec8('0x8'),attributes,{'tableName':_0x4ec8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ec8('0xa'),'collate':_0x4ec8('0xb')});}; \ No newline at end of file +var _0xb37d=['lodash','util','api','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x1678a9,_0x31e6f4){var _0xef3146=function(_0x1e7040){while(--_0x1e7040){_0x1678a9['push'](_0x1678a9['shift']());}};_0xef3146(++_0x31e6f4);}(_0xb37d,0x1b8));var _0xdb37=function(_0x490e61,_0x7f848e){_0x490e61=_0x490e61-0x0;var _0x169bc6=_0xb37d[_0x490e61];return _0x169bc6;};'use strict';var _=require(_0xdb37('0x0'));var util=require(_0xdb37('0x1'));var logger=require('../../config/logger')(_0xdb37('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb37('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb37('0x4'));var config=require(_0xdb37('0x5'));var attributes=require(_0xdb37('0x6'));module[_0xdb37('0x7')]=function(_0x4c1d96,_0x15d5b3){return _0x4c1d96[_0xdb37('0x8')](_0xdb37('0x9'),attributes,{'tableName':_0xdb37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index d620fa7..35811cd 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 _0xde05=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xde05,0xf1));var _0x5de0=function(_0x1e3657,_0x289ba6){_0x1e3657=_0x1e3657-0x0;var _0x17ca57=_0xde05[_0x1e3657];return _0x17ca57;};'use strict';var _=require('lodash');var util=require(_0x5de0('0x0'));var moment=require(_0x5de0('0x1'));var BPromise=require(_0x5de0('0x2'));var rs=require(_0x5de0('0x3'));var fs=require('fs');var Redis=require(_0x5de0('0x4'));var db=require(_0x5de0('0x5'))['db'];var utils=require(_0x5de0('0x6'));var logger=require(_0x5de0('0x7'))(_0x5de0('0x8'));var config=require(_0x5de0('0x9'));var jayson=require(_0x5de0('0xa'));var client=jayson[_0x5de0('0xb')][_0x5de0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b3067,_0x219d01,_0x66b11d){return new BPromise(function(_0x2ec328,_0x15a815){return client[_0x5de0('0xd')](_0x4b3067,_0x66b11d)[_0x5de0('0xe')](function(_0x37a379){logger[_0x5de0('0xf')](_0x5de0('0x10'),_0x219d01,_0x5de0('0x11'));logger[_0x5de0('0x12')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x219d01,_0x5de0('0x11'),JSON[_0x5de0('0x13')](_0x37a379));if(_0x37a379['error']){if(_0x37a379[_0x5de0('0x14')]['code']===0x1f4){logger[_0x5de0('0x14')](_0x5de0('0x10'),_0x219d01,_0x37a379['error']['message']);return _0x15a815(_0x37a379[_0x5de0('0x14')]['message']);}logger[_0x5de0('0x14')]('MailApplication,\x20%s,\x20%s',_0x219d01,_0x37a379[_0x5de0('0x14')][_0x5de0('0x15')]);return _0x2ec328(_0x37a379[_0x5de0('0x14')][_0x5de0('0x15')]);}else{logger[_0x5de0('0xf')](_0x5de0('0x10'),_0x219d01,'request\x20sent');_0x2ec328(_0x37a379[_0x5de0('0x16')][_0x5de0('0x15')]);}})[_0x5de0('0x17')](function(_0x15fec4){logger[_0x5de0('0x14')](_0x5de0('0x10'),_0x219d01,_0x15fec4);_0x15a815(_0x15fec4);});});}exports[_0x5de0('0x18')]=function(_0xd1281d){var _0x41933c=this;return new Promise(function(_0x3b58a0,_0x5218ba){return db['MailApplication'][_0x5de0('0x19')](_0xd1281d[_0x5de0('0x1a')],{'raw':_0xd1281d[_0x5de0('0x1b')]?_0xd1281d[_0x5de0('0x1b')][_0x5de0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd1281d[_0x5de0('0x1b')]?_0xd1281d[_0x5de0('0x1b')][_0x5de0('0x1d')]||null:null,'attributes':_0xd1281d[_0x5de0('0x1b')]?_0xd1281d[_0x5de0('0x1b')][_0x5de0('0x1e')]||null:null,'limit':_0xd1281d[_0x5de0('0x1b')]?_0xd1281d[_0x5de0('0x1b')][_0x5de0('0x1f')]||null:null})[_0x5de0('0xe')](function(_0x3e4171){logger['info']('UpdateMailApplication',_0xd1281d);logger[_0x5de0('0x12')]('UpdateMailApplication',_0xd1281d,JSON[_0x5de0('0x13')](_0x3e4171));_0x3b58a0(_0x3e4171);})['catch'](function(_0x5b137d){logger[_0x5de0('0x14')]('UpdateMailApplication',_0x5b137d[_0x5de0('0x15')],_0xd1281d);_0x5218ba(_0x41933c[_0x5de0('0x14')](0x1f4,_0x5b137d[_0x5de0('0x15')]));});});}; \ No newline at end of file +var _0x69c4=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','update','body','raw','where','options','attributes','limit','UpdateMailApplication','lodash','util','moment','randomstring','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69c4,0x1d4));var _0x469c=function(_0x3ff8cf,_0x460778){_0x3ff8cf=_0x3ff8cf-0x0;var _0xa3654e=_0x69c4[_0x3ff8cf];return _0xa3654e;};'use strict';var _=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var moment=require(_0x469c('0x2'));var BPromise=require('bluebird');var rs=require(_0x469c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x469c('0x4'));var jayson=require(_0x469c('0x5'));var client=jayson[_0x469c('0x6')][_0x469c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x276407,_0xa52bb9,_0x5a87df){return new BPromise(function(_0x288ce5,_0x2ac568){return client[_0x469c('0x8')](_0x276407,_0x5a87df)[_0x469c('0x9')](function(_0x35bf02){logger[_0x469c('0xa')](_0x469c('0xb'),_0xa52bb9,_0x469c('0xc'));logger[_0x469c('0xd')](_0x469c('0xe'),_0xa52bb9,_0x469c('0xc'),JSON['stringify'](_0x35bf02));if(_0x35bf02[_0x469c('0xf')]){if(_0x35bf02[_0x469c('0xf')][_0x469c('0x10')]===0x1f4){logger[_0x469c('0xf')](_0x469c('0xb'),_0xa52bb9,_0x35bf02[_0x469c('0xf')][_0x469c('0x11')]);return _0x2ac568(_0x35bf02['error'][_0x469c('0x11')]);}logger[_0x469c('0xf')](_0x469c('0xb'),_0xa52bb9,_0x35bf02[_0x469c('0xf')][_0x469c('0x11')]);return _0x288ce5(_0x35bf02[_0x469c('0xf')][_0x469c('0x11')]);}else{logger[_0x469c('0xa')](_0x469c('0xb'),_0xa52bb9,_0x469c('0xc'));_0x288ce5(_0x35bf02[_0x469c('0x12')][_0x469c('0x11')]);}})[_0x469c('0x13')](function(_0x1ee7a3){logger[_0x469c('0xf')](_0x469c('0xb'),_0xa52bb9,_0x1ee7a3);_0x2ac568(_0x1ee7a3);});});}exports['UpdateMailApplication']=function(_0x214023){var _0x25c771=this;return new Promise(function(_0x61f497,_0x4da364){return db['MailApplication'][_0x469c('0x14')](_0x214023[_0x469c('0x15')],{'raw':_0x214023['options']?_0x214023['options'][_0x469c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x214023['options']?_0x214023['options'][_0x469c('0x17')]||null:null,'attributes':_0x214023[_0x469c('0x18')]?_0x214023[_0x469c('0x18')][_0x469c('0x19')]||null:null,'limit':_0x214023[_0x469c('0x18')]?_0x214023[_0x469c('0x18')][_0x469c('0x1a')]||null:null})[_0x469c('0x9')](function(_0x2eb945){logger[_0x469c('0xa')](_0x469c('0x1b'),_0x214023);logger[_0x469c('0xd')](_0x469c('0x1b'),_0x214023,JSON['stringify'](_0x2eb945));_0x61f497(_0x2eb945);})[_0x469c('0x13')](function(_0x4b2b54){logger[_0x469c('0xf')]('UpdateMailApplication',_0x4b2b54[_0x469c('0x11')],_0x214023);_0x4da364(_0x25c771[_0x469c('0xf')](0x1f4,_0x4b2b54[_0x469c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a369354..fbd1225 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 _0x2eff=['mailinteraction:destroy','destroy','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2eff,0x1a3));var _0xf2ef=function(_0x2416b9,_0x313d5d){_0x2416b9=_0x2416b9-0x0;var _0x9eefeb=_0x2eff[_0x2416b9];return _0x9eefeb;};'use strict';var express=require('express');var router=express[_0xf2ef('0x0')]();var auth=require(_0xf2ef('0x1'));var interaction=require(_0xf2ef('0x2'));var controller=require(_0xf2ef('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xf2ef('0x4')]);router[_0xf2ef('0x5')](_0xf2ef('0x6'),auth[_0xf2ef('0x7')](),controller[_0xf2ef('0x8')]);router['get'](_0xf2ef('0x9'),auth[_0xf2ef('0x7')](),controller[_0xf2ef('0xa')]);router['get'](_0xf2ef('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0xf2ef('0x5')]('/:id/download',auth[_0xf2ef('0x7')](),controller[_0xf2ef('0xc')]);router[_0xf2ef('0xd')]('/',auth['isAuthenticated'](),controller[_0xf2ef('0xe')]);router[_0xf2ef('0xd')]('/:id/messages',auth[_0xf2ef('0x7')](),controller['addMessage']);router[_0xf2ef('0xd')](_0xf2ef('0xf'),auth[_0xf2ef('0x7')](),interaction[_0xf2ef('0x10')](_0xf2ef('0x11'),_0xf2ef('0x12')),controller[_0xf2ef('0x13')]);router[_0xf2ef('0x14')](_0xf2ef('0x9'),auth[_0xf2ef('0x7')](),interaction['tracked'](_0xf2ef('0x11'),_0xf2ef('0x15')),controller['update']);router[_0xf2ef('0x16')]('/:id',auth[_0xf2ef('0x7')](),interaction[_0xf2ef('0x10')](_0xf2ef('0x11'),_0xf2ef('0x17')),controller[_0xf2ef('0x18')]);router[_0xf2ef('0x16')]('/:id/tags',auth[_0xf2ef('0x7')](),controller['removeTags']);module[_0xf2ef('0x19')]=router; \ No newline at end of file +var _0x5434=['update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update'];(function(_0x1daf2f,_0x2306dc){var _0x2a334b=function(_0x24e188){while(--_0x24e188){_0x1daf2f['push'](_0x1daf2f['shift']());}};_0x2a334b(++_0x2306dc);}(_0x5434,0x17f));var _0x4543=function(_0x2784d0,_0x1c2ce6){_0x2784d0=_0x2784d0-0x0;var _0x154ec7=_0x5434[_0x2784d0];return _0x154ec7;};'use strict';var express=require(_0x4543('0x0'));var router=express[_0x4543('0x1')]();var auth=require(_0x4543('0x2'));var interaction=require(_0x4543('0x3'));var controller=require(_0x4543('0x4'));router[_0x4543('0x5')]('/',auth[_0x4543('0x6')](),controller['index']);router[_0x4543('0x5')](_0x4543('0x7'),auth['isAuthenticated'](),controller[_0x4543('0x8')]);router[_0x4543('0x5')](_0x4543('0x9'),auth[_0x4543('0x6')](),controller[_0x4543('0xa')]);router['get']('/:id/messages',auth[_0x4543('0x6')](),controller['getMessages']);router['get'](_0x4543('0xb'),auth['isAuthenticated'](),controller[_0x4543('0xc')]);router[_0x4543('0xd')]('/',auth['isAuthenticated'](),controller[_0x4543('0xe')]);router[_0x4543('0xd')](_0x4543('0xf'),auth['isAuthenticated'](),controller[_0x4543('0x10')]);router[_0x4543('0xd')](_0x4543('0x11'),auth[_0x4543('0x6')](),interaction[_0x4543('0x12')](_0x4543('0x13'),_0x4543('0x14')),controller['addTags']);router[_0x4543('0x15')](_0x4543('0x9'),auth[_0x4543('0x6')](),interaction[_0x4543('0x12')](_0x4543('0x13'),_0x4543('0x16')),controller[_0x4543('0x17')]);router[_0x4543('0x18')](_0x4543('0x9'),auth[_0x4543('0x6')](),interaction[_0x4543('0x12')](_0x4543('0x13'),_0x4543('0x19')),controller[_0x4543('0x1a')]);router[_0x4543('0x18')](_0x4543('0x11'),auth[_0x4543('0x6')](),controller[_0x4543('0x1b')]);module[_0x4543('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 492dedc..cdc0779 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 _0x556c=['DATE','STRING','TEXT','long','ENUM','out','iconv','BOOLEAN'];(function(_0x3ec741,_0x1970b4){var _0x24a6b8=function(_0x58360b){while(--_0x58360b){_0x3ec741['push'](_0x3ec741['shift']());}};_0x24a6b8(++_0x1970b4);}(_0x556c,0xfe));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xc556('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc556('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc556('0x2')]},'disposition':{'type':Sequelize[_0xc556('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc556('0x3')]},'note':{'type':Sequelize[_0xc556('0x3')]},'inReplyTo':{'type':Sequelize[_0xc556('0x3')](0x1fe)},'to':{'type':Sequelize[_0xc556('0x3')]},'cc':{'type':Sequelize[_0xc556('0x4')](_0xc556('0x5'))},'subject':{'type':Sequelize[_0xc556('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc556('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc556('0x6')]('in',_0xc556('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc556('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc556('0x6')]('in',_0xc556('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc556('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xba6f=['sequelize','iconv','exports','BOOLEAN','STRING','ENUM','out','DATE','INTEGER'];(function(_0x33d6e7,_0x3e9e5e){var _0x3c13fa=function(_0x745814){while(--_0x745814){_0x33d6e7['push'](_0x33d6e7['shift']());}};_0x3c13fa(++_0x3e9e5e);}(_0xba6f,0x19e));var _0xfba6=function(_0xb37311,_0x180fef){_0xb37311=_0xb37311-0x0;var _0x496834=_0xba6f[_0xb37311];return _0x496834;};'use strict';var Sequelize=require(_0xfba6('0x0'));var iconv=require(_0xfba6('0x1'));module[_0xfba6('0x2')]={'closed':{'type':Sequelize[_0xfba6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfba6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfba6('0x4')]},'inReplyTo':{'type':Sequelize[_0xfba6('0x4')](0x1fe)},'to':{'type':Sequelize[_0xfba6('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xfba6('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xfba6('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfba6('0x5')]('in',_0xfba6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfba6('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xfba6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfba6('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfba6('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d0f0a61..df72461 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 _0x93b9=['headers','Bcc','Attachments','basename','existsSync','type','readFileSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','undefined','offset','limit','Content-Range','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','mail','query','catch','model','keys','filters','intersection','attributes','fields','length','includeAll','options','MailInteraction','find','create','body','params','destroy','describe','MailMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','merge','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','include','findAll','inlineCss','true','addTags','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','transcript-%d-%s.zip','attachments','Messages','from','bcc','subject','createdAt','get','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93b9,0x77));var _0x993b=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x93b9[_0x81e39d];return _0x548fbb;};'use strict';var emlformat=require(_0x993b('0x0'));var rimraf=require(_0x993b('0x1'));var zipdir=require(_0x993b('0x2'));var moment=require('moment');var BPromise=require(_0x993b('0x3'));var util=require(_0x993b('0x4'));var path=require(_0x993b('0x5'));var fs=require('fs');var _=require(_0x993b('0x6'));var juice=require('juice');var Redis=require(_0x993b('0x7'));var interaction=require(_0x993b('0x8'));var qs=require(_0x993b('0x9'));var logger=require(_0x993b('0xa'))(_0x993b('0xb'));var config=require(_0x993b('0xc'));var db=require(_0x993b('0xd'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0x993b('0xe')](config[_0x993b('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x993b('0x10'))(new Redis(config['redis']));require(_0x993b('0x11'))[_0x993b('0x12')](socket);function respondWithStatusCode(_0x3885d5,_0x1efb6e){_0x1efb6e=_0x1efb6e||0xcc;return function(_0xcffed5){if(_0xcffed5){return _0x3885d5[_0x993b('0x13')](_0x1efb6e);}return _0x3885d5[_0x993b('0x14')](_0x1efb6e)[_0x993b('0x15')]();};}function respondWithResult(_0x1bf84f,_0x36db72){_0x36db72=_0x36db72||0xc8;return function(_0x3fe185){if(_0x3fe185){return _0x1bf84f[_0x993b('0x14')](_0x36db72)['json'](_0x3fe185);}};}function respondWithFilteredResult(_0x123f6d,_0x4f4181){return function(_0x2436f1){if(_0x2436f1){var _0xd9a1cf=typeof _0x4f4181['offset']===_0x993b('0x16')&&typeof _0x4f4181['limit']===_0x993b('0x16');var _0xa478f1=_0x2436f1['count'];var _0x17f1ac=_0xd9a1cf?0x0:_0x4f4181[_0x993b('0x17')];var _0x38367c=_0xd9a1cf?_0x2436f1['count']:_0x4f4181[_0x993b('0x17')]+_0x4f4181[_0x993b('0x18')];var _0x22aa12;if(_0x38367c>=_0xa478f1){_0x38367c=_0xa478f1;_0x22aa12=0xc8;}else{_0x22aa12=0xce;}_0x123f6d['status'](_0x22aa12);return _0x123f6d['set'](_0x993b('0x19'),_0x17f1ac+'-'+_0x38367c+'/'+_0xa478f1)['json'](_0x2436f1);}return null;};}function saveUpdates(_0x2acc11){return function(_0xb27c58){if(_0xb27c58){return _0xb27c58[_0x993b('0x1a')](_0x2acc11)[_0x993b('0x1b')](function(_0xaa60e1){return _0xaa60e1;});}return null;};}function removeEntity(_0x1f98c2){return function(_0x2dea15){if(_0x2dea15){return _0x2dea15['destroy']()[_0x993b('0x1b')](function(){_0x1f98c2['status'](0xcc)[_0x993b('0x15')]();});}};}function handleEntityNotFound(_0xa6b20b){return function(_0x49d635){if(!_0x49d635){_0xa6b20b[_0x993b('0x13')](0x194);}return _0x49d635;};}function handleError(_0x60fd11,_0x2daa0f){_0x2daa0f=_0x2daa0f||0x1f4;return function(_0x4e54aa){logger['error'](_0x4e54aa[_0x993b('0x1c')]);if(_0x4e54aa[_0x993b('0x1d')]){delete _0x4e54aa[_0x993b('0x1d')];}_0x60fd11['status'](_0x2daa0f)[_0x993b('0x1e')](_0x4e54aa);};}exports[_0x993b('0x1f')]=function(_0x5bafc4,_0x481fd8){var _0x2c6b66={};var _0x2f7fb5=_[_0x993b('0x20')](db['MailInteraction'][_0x993b('0x21')],function(_0x11e1af){return{'name':_0x11e1af[_0x993b('0x22')],'type':_0x11e1af['type'][_0x993b('0x23')]};});_0x2c6b66=qs[_0x993b('0x24')](_0x2f7fb5,_0x5bafc4);return interaction['findAll'](_0x993b('0x25'),_0x5bafc4[_0x993b('0x26')],_0x5bafc4['user'],_0x2c6b66,_0x2f7fb5)[_0x993b('0x1b')](respondWithFilteredResult(_0x481fd8,_0x2c6b66))[_0x993b('0x27')](handleError(_0x481fd8,null));};exports['show']=function(_0x495dd3,_0x4d697f){var _0x23c596={'raw':![],'where':{'id':_0x495dd3['params']['id']}},_0x3696df={};_0x3696df[_0x993b('0x28')]=_[_0x993b('0x29')](db['MailInteraction'][_0x993b('0x21')]);_0x3696df[_0x993b('0x26')]=_[_0x993b('0x29')](_0x495dd3[_0x993b('0x26')]);_0x3696df[_0x993b('0x2a')]=_[_0x993b('0x2b')](_0x3696df[_0x993b('0x28')],_0x3696df['query']);_0x23c596[_0x993b('0x2c')]=_[_0x993b('0x2b')](_0x3696df['model'],qs[_0x993b('0x2d')](_0x495dd3[_0x993b('0x26')][_0x993b('0x2d')]));_0x23c596[_0x993b('0x2c')]=_0x23c596[_0x993b('0x2c')][_0x993b('0x2e')]?_0x23c596['attributes']:_0x3696df[_0x993b('0x28')];if(_0x495dd3[_0x993b('0x26')][_0x993b('0x2f')]){_0x23c596['include']=[{'all':!![]}];}_0x23c596=_['merge']({},_0x23c596,_0x495dd3[_0x993b('0x30')]);return db[_0x993b('0x31')][_0x993b('0x32')](_0x23c596)[_0x993b('0x1b')](handleEntityNotFound(_0x4d697f,null))[_0x993b('0x1b')](respondWithResult(_0x4d697f,null))[_0x993b('0x27')](handleError(_0x4d697f,null));};exports[_0x993b('0x33')]=function(_0x52e158,_0x3f6a6f){return db[_0x993b('0x31')][_0x993b('0x33')](_0x52e158[_0x993b('0x34')],{})[_0x993b('0x1b')](respondWithResult(_0x3f6a6f,0xc9))[_0x993b('0x27')](handleError(_0x3f6a6f,null));};exports[_0x993b('0x1a')]=function(_0x445c1b,_0x867871){if(_0x445c1b['body']['id']){delete _0x445c1b[_0x993b('0x34')]['id'];}return db['MailInteraction'][_0x993b('0x32')]({'where':{'id':_0x445c1b[_0x993b('0x35')]['id']}})[_0x993b('0x1b')](handleEntityNotFound(_0x867871,null))[_0x993b('0x1b')](saveUpdates(_0x445c1b['body'],null))[_0x993b('0x1b')](respondWithResult(_0x867871,null))[_0x993b('0x27')](handleError(_0x867871,null));};exports[_0x993b('0x36')]=function(_0x627f60,_0x359bba){return db[_0x993b('0x31')][_0x993b('0x32')]({'where':{'id':_0x627f60[_0x993b('0x35')]['id']}})['then'](handleEntityNotFound(_0x359bba,null))[_0x993b('0x1b')](removeEntity(_0x359bba,null))[_0x993b('0x27')](handleError(_0x359bba,null));};exports[_0x993b('0x37')]=function(_0x552d56,_0x54c655){return db['MailInteraction']['describe']()[_0x993b('0x1b')](respondWithResult(_0x54c655,null))[_0x993b('0x27')](handleError(_0x54c655,null));};exports['addMessage']=function(_0x3d298b,_0x3783cb){return db[_0x993b('0x38')][_0x993b('0x32')]({'where':{'id':_0x3d298b[_0x993b('0x35')]['id']}})[_0x993b('0x1b')](handleEntityNotFound(_0x3783cb,null))[_0x993b('0x1b')](function(_0x52404c){if(_0x52404c){return _0x52404c[_0x993b('0x39')](_0x3d298b[_0x993b('0x34')][_0x993b('0x3a')],_[_0x993b('0x3b')](_0x3d298b[_0x993b('0x34')],['ids','id'])||{});}})[_0x993b('0x1b')](respondWithResult(_0x3783cb,null))[_0x993b('0x27')](handleError(_0x3783cb,null));};exports[_0x993b('0x3c')]=function(_0x2fd199,_0x1cbd41){var _0x4ba901={'raw':![],'where':{}};var _0x2d0469={};var _0x2a93ee={'count':0x0,'rows':[]};return db[_0x993b('0x31')][_0x993b('0x3d')]({'where':{'id':_0x2fd199[_0x993b('0x35')]['id']}})[_0x993b('0x1b')](handleEntityNotFound(_0x1cbd41,null))[_0x993b('0x1b')](function(_0x2efd58){if(_0x2efd58){_0x2d0469[_0x993b('0x28')]=_[_0x993b('0x29')](db[_0x993b('0x38')][_0x993b('0x21')]);_0x2d0469[_0x993b('0x26')]=_[_0x993b('0x29')](_0x2fd199[_0x993b('0x26')]);_0x2d0469['filters']=_['intersection'](_0x2d0469[_0x993b('0x28')],_0x2d0469[_0x993b('0x26')]);_0x4ba901[_0x993b('0x2c')]=_[_0x993b('0x2b')](_0x2d0469[_0x993b('0x28')],qs[_0x993b('0x2d')](_0x2fd199[_0x993b('0x26')][_0x993b('0x2d')]));_0x4ba901[_0x993b('0x2c')]=_0x4ba901[_0x993b('0x2c')][_0x993b('0x2e')]?_0x4ba901['attributes']:_0x2d0469[_0x993b('0x28')];if(!_0x2fd199[_0x993b('0x26')][_0x993b('0x3e')](_0x993b('0x3f'))){_0x4ba901[_0x993b('0x18')]=qs['limit'](_0x2fd199['query'][_0x993b('0x18')]);_0x4ba901[_0x993b('0x17')]=qs[_0x993b('0x17')](_0x2fd199[_0x993b('0x26')][_0x993b('0x17')]);}_0x4ba901['order']=qs[_0x993b('0x40')](_0x2fd199[_0x993b('0x26')]['sort']);_0x4ba901[_0x993b('0x41')]=qs['filters'](_[_0x993b('0x42')](_0x2fd199[_0x993b('0x26')],_0x2d0469[_0x993b('0x2a')]));_0x4ba901['where'][_0x993b('0x43')]=_0x2efd58['id'];if(_0x2fd199[_0x993b('0x26')]['filter']){_0x4ba901[_0x993b('0x41')]=_[_0x993b('0x44')](_0x4ba901['where'],{'$or':_[_0x993b('0x20')](_0x4ba901['attributes'],function(_0x688ae6){var _0x3a97ba={};_0x3a97ba[_0x688ae6]={'$like':'%'+_0x2fd199[_0x993b('0x26')][_0x993b('0x45')]+'%'};return _0x3a97ba;})});}if(_0x2fd199[_0x993b('0x26')][_0x993b('0x46')]){var _0x5eb8a3=_0x2fd199[_0x993b('0x26')][_0x993b('0x46')]['split'](',');var _0x1e219c={};_0x1e219c[_0x5eb8a3[0x0]]={'$gte':moment(_0x5eb8a3[0x1])[_0x993b('0x47')](_0x993b('0x48'))};_0x4ba901[_0x993b('0x41')]=_[_0x993b('0x44')](_0x4ba901[_0x993b('0x41')],_0x1e219c);}_0x4ba901=_[_0x993b('0x44')]({},_0x4ba901,_0x2fd199[_0x993b('0x30')]);return db[_0x993b('0x38')][_0x993b('0x49')]({'where':_0x4ba901['where']})[_0x993b('0x1b')](function(_0xf0a75f){_0x2a93ee['count']=_0xf0a75f;if(_0x2fd199[_0x993b('0x26')]['includeAll']){_0x4ba901[_0x993b('0x4a')]=[{'all':!![]}];}return db[_0x993b('0x38')][_0x993b('0x4b')](_0x4ba901);})['then'](function(_0x449166){if(_0x2fd199['query'][_0x993b('0x4c')]===_0x993b('0x4d')){for(var _0x573cef=0x0;_0x573cef<_0x449166[_0x993b('0x2e')];_0x573cef++){_0x449166[_0x573cef][_0x993b('0x34')]=juice(_0x449166[_0x573cef][_0x993b('0x34')]);}}_0x2a93ee['rows']=_0x449166;return _0x2a93ee;});}})[_0x993b('0x1b')](respondWithFilteredResult(_0x1cbd41,_0x4ba901))[_0x993b('0x27')](handleError(_0x1cbd41,null));};exports[_0x993b('0x4e')]=function(_0x302c72,_0x173dbc){return db[_0x993b('0x31')][_0x993b('0x32')]({'where':{'id':_0x302c72[_0x993b('0x35')]['id']}})[_0x993b('0x1b')](handleEntityNotFound(_0x173dbc,null))[_0x993b('0x1b')](function(_0x436c85){if(_0x436c85){return _0x436c85['setTags'](_0x302c72['body']['ids'],_[_0x993b('0x3b')](_0x302c72[_0x993b('0x34')],['ids','id'])||{})['spread'](function(){return db[_0x993b('0x4f')]['findAll']({'attributes':['id',_0x993b('0x1d'),_0x993b('0x50')],'where':{'id':_0x302c72['body'][_0x993b('0x3a')]}});})[_0x993b('0x1b')](function(_0x3b7fc2){socket['emit'](_0x993b('0x51'),{'id':Number(_0x302c72[_0x993b('0x35')]['id']),'tags':_0x3b7fc2||[]});return{'id':Number(_0x302c72[_0x993b('0x35')]['id']),'tags':_0x3b7fc2||[]};});}})[_0x993b('0x1b')](respondWithResult(_0x173dbc,null))[_0x993b('0x27')](handleError(_0x173dbc,null));};exports[_0x993b('0x52')]=function(_0x2131d3,_0x310a5d){return db[_0x993b('0x31')][_0x993b('0x32')]({'where':{'id':_0x2131d3[_0x993b('0x35')]['id']}})[_0x993b('0x1b')](handleEntityNotFound(_0x310a5d,null))[_0x993b('0x1b')](function(_0x4184e5){if(_0x4184e5){return _0x4184e5[_0x993b('0x52')](_0x2131d3[_0x993b('0x26')][_0x993b('0x3a')]);}})[_0x993b('0x1b')](respondWithStatusCode(_0x310a5d,null))[_0x993b('0x27')](handleError(_0x310a5d,null));};exports[_0x993b('0x53')]=function(_0x458ece,_0x599b87){var _0x15501c=moment()[_0x993b('0x54')]()[_0x993b('0x55')]();var _0x795093=path['join'](config['root'],_0x993b('0x56'),_0x993b('0x57'),_0x993b('0x58'));var _0x142cf0=path[_0x993b('0x59')](config['root'],_0x993b('0x56'),_0x993b('0x57'),'attachments');var _0x24c2a7=path[_0x993b('0x59')](_0x795093,_0x15501c);var _0x271612=util['format'](_0x993b('0x5a'),_0x458ece[_0x993b('0x35')]['id'],_0x15501c);var _0x2f33b6=path[_0x993b('0x59')](_0x795093,_0x271612);var _0x19d32c=[];if(_0x458ece[_0x993b('0x26')][_0x993b('0x5b')]){_0x19d32c['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x38571b=[{'model':db[_0x993b('0x38')],'as':_0x993b('0x5c'),'attributes':['id',_0x993b('0x34'),_0x993b('0x5d'),'to','cc',_0x993b('0x5e'),_0x993b('0x5f'),_0x993b('0x60')],'where':{'secret':![]},'order':qs[_0x993b('0x40')]('id'),'include':_0x19d32c}];return db[_0x993b('0x31')]['find']({'where':{'id':_0x458ece[_0x993b('0x35')]['id']},'include':_0x38571b})[_0x993b('0x1b')](handleEntityNotFound(_0x599b87,null))['then'](function(_0x3fb943){if(_0x3fb943&&_0x3fb943['Messages']){var _0x1a9cd2=_0x3fb943[_0x993b('0x61')]({'plain':!![]});fs['mkdirSync'](_0x24c2a7);return BPromise[_0x993b('0x62')](_0x1a9cd2[_0x993b('0x5c')],function(_0x334613,_0x2025f7){var _0x141474={'from':_0x334613[_0x993b('0x5d')],'to':_0x334613['to']||_0x993b('0x63'),'subject':_0x334613[_0x993b('0x5f')],'html':htmlEntities['decode'](_0x334613[_0x993b('0x34')]),'headers':{'Date':moment(_0x334613[_0x993b('0x60')])[_0x993b('0x47')](_0x993b('0x64'))},'attachments':[]};if(_0x334613['cc']){_0x141474[_0x993b('0x65')]['Cc']=_0x334613['cc'];}if(_0x334613[_0x993b('0x5e')]){_0x141474[_0x993b('0x65')][_0x993b('0x66')]=_0x334613[_0x993b('0x5e')];}return new BPromise(function(_0xbee080,_0x1e3b3c){if(_0x334613[_0x993b('0x67')]){for(var _0x23a010=0x0;_0x23a010<_0x334613['Attachments'][_0x993b('0x2e')];_0x23a010++){var _0x2c2c9c=_0x334613[_0x993b('0x67')][_0x23a010];var _0x4422a6=path['join'](_0x142cf0,_0x2c2c9c[_0x993b('0x68')]);if(fs[_0x993b('0x69')](_0x4422a6)){_0x141474[_0x993b('0x5b')]['push']({'name':_0x2c2c9c[_0x993b('0x1d')],'contentType':_0x2c2c9c[_0x993b('0x6a')],'data':fs[_0x993b('0x6b')](_0x4422a6)});}}}emlformat['build'](_0x141474,function(_0x210b3b,_0x2637cc){if(_0x210b3b)return _0x1e3b3c(_0x210b3b);fs[_0x993b('0x6c')](path[_0x993b('0x59')](_0x24c2a7,util[_0x993b('0x47')](_0x993b('0x6d'),_0x2025f7)),_0x2637cc);return _0xbee080(_0x2637cc);});});})[_0x993b('0x1b')](function(){return new BPromise(function(_0x1a197a,_0x57d6b2){zipdir(_0x24c2a7,{'saveTo':_0x2f33b6},function(_0x3c8797,_0x59cd6a){if(_0x3c8797)return _0x57d6b2(_0x3c8797);return _0x1a197a(_0x59cd6a);});})[_0x993b('0x1b')](function(){return new BPromise(function(_0x162abc,_0x3c3a89){rimraf(_0x24c2a7,function(_0x421d09){if(_0x421d09)_0x3c3a89(_0x421d09);return _0x162abc();});});})[_0x993b('0x1b')](function(){return _0x599b87[_0x993b('0x53')](_0x2f33b6,_0x271612,function(_0x279368){if(!_0x279368)fs['unlinkSync'](_0x2f33b6);});});});}else{return _0x599b87[_0x993b('0x13')](0xc8);}})['catch'](handleError(_0x599b87,null));}; \ No newline at end of file +var _0xe830=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','setTags','omit','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','zip-dir','moment','util','path','lodash','../../components/parsers/qs','../../config/logger','api','html-entities','redis','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','update','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','type','key','getOptions','findAll','mail','query','user','show','params','model','keys','filters','attributes','intersection','fields','include','merge','options','find','then','create','body','catch','addMessage','MailMessage','ids','getMessages','findOne'];(function(_0x5458f4,_0x4d3557){var _0x4dcace=function(_0x13df62){while(--_0x13df62){_0x5458f4['push'](_0x5458f4['shift']());}};_0x4dcace(++_0x4d3557);}(_0xe830,0xa2));var _0x0e83=function(_0x2c7364,_0x294795){_0x2c7364=_0x2c7364-0x0;var _0x4560f8=_0xe830[_0x2c7364];return _0x4560f8;};'use strict';var emlformat=require(_0x0e83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e83('0x1'));var moment=require(_0x0e83('0x2'));var BPromise=require('bluebird');var util=require(_0x0e83('0x3'));var path=require(_0x0e83('0x4'));var fs=require('fs');var _=require(_0x0e83('0x5'));var juice=require('juice');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x0e83('0x6'));var logger=require(_0x0e83('0x7'))(_0x0e83('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x0e83('0x9'));config['redis']=_['defaults'](config[_0x0e83('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e83('0xb'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0xe47566,_0x48ae14){_0x48ae14=_0x48ae14||0xcc;return function(_0xc0e4a5){if(_0xc0e4a5){return _0xe47566[_0x0e83('0xc')](_0x48ae14);}return _0xe47566[_0x0e83('0xd')](_0x48ae14)[_0x0e83('0xe')]();};}function respondWithResult(_0x283c66,_0x4b86da){_0x4b86da=_0x4b86da||0xc8;return function(_0x589ef8){if(_0x589ef8){return _0x283c66[_0x0e83('0xd')](_0x4b86da)['json'](_0x589ef8);}};}function respondWithFilteredResult(_0x2b30c4,_0x231551){return function(_0x52e1c1){if(_0x52e1c1){var _0x56af08=typeof _0x231551[_0x0e83('0xf')]===_0x0e83('0x10')&&typeof _0x231551['limit']===_0x0e83('0x10');var _0x2881ed=_0x52e1c1[_0x0e83('0x11')];var _0x46843c=_0x56af08?0x0:_0x231551[_0x0e83('0xf')];var _0xe7f5dc=_0x56af08?_0x52e1c1[_0x0e83('0x11')]:_0x231551[_0x0e83('0xf')]+_0x231551[_0x0e83('0x12')];var _0x36d4a;if(_0xe7f5dc>=_0x2881ed){_0xe7f5dc=_0x2881ed;_0x36d4a=0xc8;}else{_0x36d4a=0xce;}_0x2b30c4['status'](_0x36d4a);return _0x2b30c4['set'](_0x0e83('0x13'),_0x46843c+'-'+_0xe7f5dc+'/'+_0x2881ed)[_0x0e83('0x14')](_0x52e1c1);}return null;};}function saveUpdates(_0xeb8d9d){return function(_0x1b5335){if(_0x1b5335){return _0x1b5335[_0x0e83('0x15')](_0xeb8d9d)['then'](function(_0x3496a6){return _0x3496a6;});}return null;};}function removeEntity(_0x4013a2){return function(_0x495349){if(_0x495349){return _0x495349[_0x0e83('0x16')]()['then'](function(){_0x4013a2[_0x0e83('0xd')](0xcc)[_0x0e83('0xe')]();});}};}function handleEntityNotFound(_0x1c0c30){return function(_0x242900){if(!_0x242900){_0x1c0c30[_0x0e83('0xc')](0x194);}return _0x242900;};}function handleError(_0xe198db,_0x242fb4){_0x242fb4=_0x242fb4||0x1f4;return function(_0x4f3d54){logger[_0x0e83('0x17')](_0x4f3d54[_0x0e83('0x18')]);if(_0x4f3d54[_0x0e83('0x19')]){delete _0x4f3d54[_0x0e83('0x19')];}_0xe198db[_0x0e83('0xd')](_0x242fb4)[_0x0e83('0x1a')](_0x4f3d54);};}exports[_0x0e83('0x1b')]=function(_0x374796,_0x196ddb){var _0x3cb036={};var _0x5c9e8e=_['map'](db[_0x0e83('0x1c')][_0x0e83('0x1d')],function(_0x22ab26){return{'name':_0x22ab26['fieldName'],'type':_0x22ab26[_0x0e83('0x1e')][_0x0e83('0x1f')]};});_0x3cb036=qs[_0x0e83('0x20')](_0x5c9e8e,_0x374796);return interaction[_0x0e83('0x21')](_0x0e83('0x22'),_0x374796[_0x0e83('0x23')],_0x374796[_0x0e83('0x24')],_0x3cb036,_0x5c9e8e)['then'](respondWithFilteredResult(_0x196ddb,_0x3cb036))['catch'](handleError(_0x196ddb,null));};exports[_0x0e83('0x25')]=function(_0x2a49a8,_0x1c0ead){var _0x491b46={'raw':![],'where':{'id':_0x2a49a8[_0x0e83('0x26')]['id']}},_0x57c7e4={};_0x57c7e4[_0x0e83('0x27')]=_['keys'](db[_0x0e83('0x1c')][_0x0e83('0x1d')]);_0x57c7e4[_0x0e83('0x23')]=_[_0x0e83('0x28')](_0x2a49a8[_0x0e83('0x23')]);_0x57c7e4[_0x0e83('0x29')]=_['intersection'](_0x57c7e4[_0x0e83('0x27')],_0x57c7e4[_0x0e83('0x23')]);_0x491b46[_0x0e83('0x2a')]=_[_0x0e83('0x2b')](_0x57c7e4['model'],qs[_0x0e83('0x2c')](_0x2a49a8[_0x0e83('0x23')][_0x0e83('0x2c')]));_0x491b46[_0x0e83('0x2a')]=_0x491b46['attributes']['length']?_0x491b46[_0x0e83('0x2a')]:_0x57c7e4[_0x0e83('0x27')];if(_0x2a49a8[_0x0e83('0x23')]['includeAll']){_0x491b46[_0x0e83('0x2d')]=[{'all':!![]}];}_0x491b46=_[_0x0e83('0x2e')]({},_0x491b46,_0x2a49a8[_0x0e83('0x2f')]);return db[_0x0e83('0x1c')][_0x0e83('0x30')](_0x491b46)[_0x0e83('0x31')](handleEntityNotFound(_0x1c0ead,null))[_0x0e83('0x31')](respondWithResult(_0x1c0ead,null))['catch'](handleError(_0x1c0ead,null));};exports[_0x0e83('0x32')]=function(_0x4416de,_0xd14bd8){return db[_0x0e83('0x1c')][_0x0e83('0x32')](_0x4416de[_0x0e83('0x33')],{})['then'](respondWithResult(_0xd14bd8,0xc9))[_0x0e83('0x34')](handleError(_0xd14bd8,null));};exports[_0x0e83('0x15')]=function(_0x3cf059,_0x33a370){if(_0x3cf059['body']['id']){delete _0x3cf059[_0x0e83('0x33')]['id'];}return db[_0x0e83('0x1c')]['find']({'where':{'id':_0x3cf059[_0x0e83('0x26')]['id']}})[_0x0e83('0x31')](handleEntityNotFound(_0x33a370,null))[_0x0e83('0x31')](saveUpdates(_0x3cf059[_0x0e83('0x33')],null))[_0x0e83('0x31')](respondWithResult(_0x33a370,null))[_0x0e83('0x34')](handleError(_0x33a370,null));};exports['destroy']=function(_0x31dcab,_0x44f25d){return db['MailInteraction'][_0x0e83('0x30')]({'where':{'id':_0x31dcab[_0x0e83('0x26')]['id']}})[_0x0e83('0x31')](handleEntityNotFound(_0x44f25d,null))[_0x0e83('0x31')](removeEntity(_0x44f25d,null))[_0x0e83('0x34')](handleError(_0x44f25d,null));};exports['describe']=function(_0x1d1a03,_0x173ca4){return db[_0x0e83('0x1c')]['describe']()[_0x0e83('0x31')](respondWithResult(_0x173ca4,null))['catch'](handleError(_0x173ca4,null));};exports[_0x0e83('0x35')]=function(_0xebc089,_0x2e1384){return db[_0x0e83('0x36')][_0x0e83('0x30')]({'where':{'id':_0xebc089[_0x0e83('0x26')]['id']}})[_0x0e83('0x31')](handleEntityNotFound(_0x2e1384,null))['then'](function(_0x3df06a){if(_0x3df06a){return _0x3df06a[_0x0e83('0x35')](_0xebc089[_0x0e83('0x33')][_0x0e83('0x37')],_['omit'](_0xebc089[_0x0e83('0x33')],['ids','id'])||{});}})['then'](respondWithResult(_0x2e1384,null))[_0x0e83('0x34')](handleError(_0x2e1384,null));};exports[_0x0e83('0x38')]=function(_0x2180d1,_0x10c5a6){var _0x4b001a={'raw':![],'where':{}};var _0x4b0fa9={};var _0x5cd1b1={'count':0x0,'rows':[]};return db[_0x0e83('0x1c')][_0x0e83('0x39')]({'where':{'id':_0x2180d1[_0x0e83('0x26')]['id']}})['then'](handleEntityNotFound(_0x10c5a6,null))[_0x0e83('0x31')](function(_0x5953b3){if(_0x5953b3){_0x4b0fa9['model']=_['keys'](db['MailMessage'][_0x0e83('0x1d')]);_0x4b0fa9['query']=_['keys'](_0x2180d1[_0x0e83('0x23')]);_0x4b0fa9[_0x0e83('0x29')]=_['intersection'](_0x4b0fa9[_0x0e83('0x27')],_0x4b0fa9[_0x0e83('0x23')]);_0x4b001a['attributes']=_[_0x0e83('0x2b')](_0x4b0fa9[_0x0e83('0x27')],qs[_0x0e83('0x2c')](_0x2180d1[_0x0e83('0x23')]['fields']));_0x4b001a[_0x0e83('0x2a')]=_0x4b001a['attributes'][_0x0e83('0x3a')]?_0x4b001a[_0x0e83('0x2a')]:_0x4b0fa9[_0x0e83('0x27')];if(!_0x2180d1['query'][_0x0e83('0x3b')](_0x0e83('0x3c'))){_0x4b001a[_0x0e83('0x12')]=qs[_0x0e83('0x12')](_0x2180d1[_0x0e83('0x23')][_0x0e83('0x12')]);_0x4b001a['offset']=qs[_0x0e83('0xf')](_0x2180d1[_0x0e83('0x23')][_0x0e83('0xf')]);}_0x4b001a[_0x0e83('0x3d')]=qs[_0x0e83('0x3e')](_0x2180d1[_0x0e83('0x23')][_0x0e83('0x3e')]);_0x4b001a[_0x0e83('0x3f')]=qs[_0x0e83('0x29')](_[_0x0e83('0x40')](_0x2180d1[_0x0e83('0x23')],_0x4b0fa9[_0x0e83('0x29')]));_0x4b001a[_0x0e83('0x3f')]['MailInteractionId']=_0x5953b3['id'];if(_0x2180d1[_0x0e83('0x23')][_0x0e83('0x41')]){_0x4b001a['where']=_['merge'](_0x4b001a[_0x0e83('0x3f')],{'$or':_[_0x0e83('0x42')](_0x4b001a[_0x0e83('0x2a')],function(_0x356e61){var _0x38b7a4={};_0x38b7a4[_0x356e61]={'$like':'%'+_0x2180d1[_0x0e83('0x23')]['filter']+'%'};return _0x38b7a4;})});}if(_0x2180d1[_0x0e83('0x23')][_0x0e83('0x43')]){var _0x74b829=_0x2180d1[_0x0e83('0x23')]['$gte'][_0x0e83('0x44')](',');var _0x2f7847={};_0x2f7847[_0x74b829[0x0]]={'$gte':moment(_0x74b829[0x1])[_0x0e83('0x45')](_0x0e83('0x46'))};_0x4b001a[_0x0e83('0x3f')]=_[_0x0e83('0x2e')](_0x4b001a[_0x0e83('0x3f')],_0x2f7847);}_0x4b001a=_[_0x0e83('0x2e')]({},_0x4b001a,_0x2180d1[_0x0e83('0x2f')]);return db['MailMessage'][_0x0e83('0x11')]({'where':_0x4b001a[_0x0e83('0x3f')]})[_0x0e83('0x31')](function(_0x1fd963){_0x5cd1b1[_0x0e83('0x11')]=_0x1fd963;if(_0x2180d1[_0x0e83('0x23')][_0x0e83('0x47')]){_0x4b001a[_0x0e83('0x2d')]=[{'all':!![]}];}return db[_0x0e83('0x36')][_0x0e83('0x21')](_0x4b001a);})[_0x0e83('0x31')](function(_0xa09abc){if(_0x2180d1[_0x0e83('0x23')][_0x0e83('0x48')]===_0x0e83('0x49')){for(var _0x3168dd=0x0;_0x3168dd<_0xa09abc['length'];_0x3168dd++){_0xa09abc[_0x3168dd][_0x0e83('0x33')]=juice(_0xa09abc[_0x3168dd][_0x0e83('0x33')]);}}_0x5cd1b1[_0x0e83('0x4a')]=_0xa09abc;return _0x5cd1b1;});}})[_0x0e83('0x31')](respondWithFilteredResult(_0x10c5a6,_0x4b001a))[_0x0e83('0x34')](handleError(_0x10c5a6,null));};exports[_0x0e83('0x4b')]=function(_0x32225d,_0x42110b){return db[_0x0e83('0x1c')][_0x0e83('0x30')]({'where':{'id':_0x32225d['params']['id']}})[_0x0e83('0x31')](handleEntityNotFound(_0x42110b,null))[_0x0e83('0x31')](function(_0x536cec){if(_0x536cec){return _0x536cec[_0x0e83('0x4c')](_0x32225d[_0x0e83('0x33')][_0x0e83('0x37')],_[_0x0e83('0x4d')](_0x32225d[_0x0e83('0x33')],[_0x0e83('0x37'),'id'])||{})['spread'](function(){return db[_0x0e83('0x4e')][_0x0e83('0x21')]({'attributes':['id',_0x0e83('0x19'),_0x0e83('0x4f')],'where':{'id':_0x32225d[_0x0e83('0x33')][_0x0e83('0x37')]}});})[_0x0e83('0x31')](function(_0x305184){socket[_0x0e83('0x50')](_0x0e83('0x51'),{'id':Number(_0x32225d['params']['id']),'tags':_0x305184||[]});return{'id':Number(_0x32225d[_0x0e83('0x26')]['id']),'tags':_0x305184||[]};});}})[_0x0e83('0x31')](respondWithResult(_0x42110b,null))['catch'](handleError(_0x42110b,null));};exports[_0x0e83('0x52')]=function(_0x6297b9,_0x24432b){return db[_0x0e83('0x1c')][_0x0e83('0x30')]({'where':{'id':_0x6297b9[_0x0e83('0x26')]['id']}})[_0x0e83('0x31')](handleEntityNotFound(_0x24432b,null))[_0x0e83('0x31')](function(_0x39b8bb){if(_0x39b8bb){return _0x39b8bb[_0x0e83('0x52')](_0x6297b9[_0x0e83('0x23')][_0x0e83('0x37')]);}})[_0x0e83('0x31')](respondWithStatusCode(_0x24432b,null))[_0x0e83('0x34')](handleError(_0x24432b,null));};exports['download']=function(_0x5d1e4b,_0x5e3db4){var _0x42bcb3=moment()[_0x0e83('0x53')]()[_0x0e83('0x54')]();var _0x3b0054=path[_0x0e83('0x55')](config[_0x0e83('0x56')],'server',_0x0e83('0x57'),_0x0e83('0x58'));var _0xc119b3=path[_0x0e83('0x55')](config['root'],'server',_0x0e83('0x57'),'attachments');var _0x135b81=path[_0x0e83('0x55')](_0x3b0054,_0x42bcb3);var _0x3691f7=util[_0x0e83('0x45')]('transcript-%d-%s.zip',_0x5d1e4b[_0x0e83('0x26')]['id'],_0x42bcb3);var _0x107655=path[_0x0e83('0x55')](_0x3b0054,_0x3691f7);var _0x473d8d=[];if(_0x5d1e4b['query'][_0x0e83('0x59')]){_0x473d8d[_0x0e83('0x5a')]({'model':db[_0x0e83('0x5b')],'as':_0x0e83('0x5c'),'raw':!![]});}var _0x5308fa=[{'model':db[_0x0e83('0x36')],'as':_0x0e83('0x5d'),'attributes':['id',_0x0e83('0x33'),_0x0e83('0x5e'),'to','cc',_0x0e83('0x5f'),_0x0e83('0x60'),'createdAt'],'where':{'secret':![]},'order':qs[_0x0e83('0x3e')]('id'),'include':_0x473d8d}];return db[_0x0e83('0x1c')][_0x0e83('0x30')]({'where':{'id':_0x5d1e4b[_0x0e83('0x26')]['id']},'include':_0x5308fa})[_0x0e83('0x31')](handleEntityNotFound(_0x5e3db4,null))['then'](function(_0x50c1b7){if(_0x50c1b7&&_0x50c1b7[_0x0e83('0x5d')]){var _0x80b109=_0x50c1b7['get']({'plain':!![]});fs['mkdirSync'](_0x135b81);return BPromise[_0x0e83('0x61')](_0x80b109[_0x0e83('0x5d')],function(_0x4d2ea6,_0x462271){var _0x78979f={'from':_0x4d2ea6[_0x0e83('0x5e')],'to':_0x4d2ea6['to']||_0x0e83('0x62'),'subject':_0x4d2ea6['subject'],'html':htmlEntities[_0x0e83('0x63')](_0x4d2ea6[_0x0e83('0x33')]),'headers':{'Date':moment(_0x4d2ea6[_0x0e83('0x64')])['format'](_0x0e83('0x65'))},'attachments':[]};if(_0x4d2ea6['cc']){_0x78979f[_0x0e83('0x66')]['Cc']=_0x4d2ea6['cc'];}if(_0x4d2ea6['bcc']){_0x78979f[_0x0e83('0x66')][_0x0e83('0x67')]=_0x4d2ea6['bcc'];}return new BPromise(function(_0x393221,_0x2d811d){if(_0x4d2ea6[_0x0e83('0x5c')]){for(var _0x22ae35=0x0;_0x22ae35<_0x4d2ea6[_0x0e83('0x5c')]['length'];_0x22ae35++){var _0x40f010=_0x4d2ea6[_0x0e83('0x5c')][_0x22ae35];var _0x1a0fe6=path[_0x0e83('0x55')](_0xc119b3,_0x40f010[_0x0e83('0x68')]);if(fs['existsSync'](_0x1a0fe6)){_0x78979f[_0x0e83('0x59')]['push']({'name':_0x40f010[_0x0e83('0x19')],'contentType':_0x40f010[_0x0e83('0x1e')],'data':fs[_0x0e83('0x69')](_0x1a0fe6)});}}}emlformat[_0x0e83('0x6a')](_0x78979f,function(_0x2ed71b,_0x475c21){if(_0x2ed71b)return _0x2d811d(_0x2ed71b);fs[_0x0e83('0x6b')](path['join'](_0x135b81,util[_0x0e83('0x45')]('message%d.eml',_0x462271)),_0x475c21);return _0x393221(_0x475c21);});});})['then'](function(){return new BPromise(function(_0x4461b8,_0x125fff){zipdir(_0x135b81,{'saveTo':_0x107655},function(_0x4f7390,_0x4fbfe4){if(_0x4f7390)return _0x125fff(_0x4f7390);return _0x4461b8(_0x4fbfe4);});})[_0x0e83('0x31')](function(){return new BPromise(function(_0x1977ee,_0x1647e7){rimraf(_0x135b81,function(_0x16bfb0){if(_0x16bfb0)_0x1647e7(_0x16bfb0);return _0x1977ee();});});})[_0x0e83('0x31')](function(){return _0x5e3db4[_0x0e83('0x6c')](_0x107655,_0x3691f7,function(_0x34c185){if(!_0x34c185)fs[_0x0e83('0x6d')](_0x107655);});});});}else{return _0x5e3db4['sendStatus'](0xc8);}})[_0x0e83('0x34')](handleError(_0x5e3db4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 0acce28..52920bd 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 _0xadfa=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x259ce8,_0x798276){var _0x5ef5c2=function(_0x1bb84e){while(--_0x1bb84e){_0x259ce8['push'](_0x259ce8['shift']());}};_0x5ef5c2(++_0x798276);}(_0xadfa,0x9e));var _0xaadf=function(_0x2ba8e3,_0x36657e){_0x2ba8e3=_0x2ba8e3-0x0;var _0x21b402=_0xadfa[_0x2ba8e3];return _0x21b402;};'use strict';var EventEmitter=require(_0xaadf('0x0'));var MailInteraction=require(_0xaadf('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xaadf('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xaadf('0x2')](0x0);var events={'afterCreate':_0xaadf('0x3'),'afterUpdate':'update','afterDestroy':_0xaadf('0x4')};function emitEvent(_0x564d8f){return function(_0xad59a8,_0x5814f3,_0xb6b7ad){_0xad59a8[_0xaadf('0x5')]({'attributes':['id'],'raw':!![]})[_0xaadf('0x6')](function(_0x2e3466){_0xad59a8[_0xaadf('0x7')](_0xaadf('0x8'),_0x2e3466[_0xaadf('0x9')](function(_0x1ba50a){return{'id':_0x1ba50a['id']};}));return MailMessage[_0xaadf('0xa')]({'where':{'MailInteractionId':_0xad59a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaadf('0x6')](function(_0x539d74){_0xad59a8['setDataValue'](_0xaadf('0xb'),_0x539d74['length']);MailInteractionEvents[_0xaadf('0xc')](_0x564d8f+':'+_0xad59a8['id'],_0xad59a8);MailInteractionEvents['emit'](_0x564d8f,_0xad59a8);_0xb6b7ad(null);})[_0xaadf('0xd')](_0xb6b7ad(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xaadf('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x1e3f=['update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0x1e3f,0x151));var _0xf1e3=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0x1e3f[_0x22a8c4];return _0x104c6d;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xf1e3('0x0')];var MailMessage=require(_0xf1e3('0x1'))['db'][_0xf1e3('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf1e3('0x3')](0x0);var events={'afterCreate':_0xf1e3('0x4'),'afterUpdate':_0xf1e3('0x5'),'afterDestroy':_0xf1e3('0x6')};function emitEvent(_0x15044c){return function(_0x59cf03,_0x530671,_0x3469b2){_0x59cf03['getUsers']({'attributes':['id'],'raw':!![]})[_0xf1e3('0x7')](function(_0x56eb9c){_0x59cf03[_0xf1e3('0x8')](_0xf1e3('0x9'),_0x56eb9c[_0xf1e3('0xa')](function(_0x46d962){return{'id':_0x46d962['id']};}));return MailMessage[_0xf1e3('0xb')]({'where':{'MailInteractionId':_0x59cf03['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1e3('0x7')](function(_0x4a1b13){_0x59cf03[_0xf1e3('0x8')](_0xf1e3('0xc'),_0x4a1b13[_0xf1e3('0xd')]);MailInteractionEvents[_0xf1e3('0xe')](_0x15044c+':'+_0x59cf03['id'],_0x59cf03);MailInteractionEvents[_0xf1e3('0xe')](_0x15044c,_0x59cf03);_0x3469b2(null);})[_0xf1e3('0xf')](_0x3469b2(null));};}for(var e in events){if(events[_0xf1e3('0x10')](e)){var event=events[e];MailInteraction[_0xf1e3('0x11')](e,emitEvent(event));}}module[_0xf1e3('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 4256804..fb0256c 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 _0x92f1=['moment','bluebird','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','models','get','MailMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x17302b,_0x30b744){var _0x14d737=function(_0x5bfd65){while(--_0x5bfd65){_0x17302b['push'](_0x17302b['shift']());}};_0x14d737(++_0x30b744);}(_0x92f1,0x1f0));var _0x192f=function(_0x2d09ee,_0x43daba){_0x2d09ee=_0x2d09ee-0x0;var _0x74fa7d=_0x92f1[_0x2d09ee];return _0x74fa7d;};'use strict';var _=require(_0x192f('0x0'));var util=require(_0x192f('0x1'));var logger=require(_0x192f('0x2'))(_0x192f('0x3'));var moment=require(_0x192f('0x4'));var BPromise=require(_0x192f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x192f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x192f('0x7'));module[_0x192f('0x8')]=function(_0x3a63c1,_0x39b4ef){return _0x3a63c1[_0x192f('0x9')](_0x192f('0xa'),attributes,{'tableName':_0x192f('0xb'),'paranoid':![],'indexes':[{'name':_0x192f('0xc'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x595d72,_0x4474ae,_0x385ff0){if(_0x595d72['substatus']){_0x595d72[_0x192f('0xd')]=moment()[_0x192f('0xe')](_0x192f('0xf'));}if(_0x595d72[_0x192f('0x10')]){_0x595d72['closedAt']=moment()['format'](_0x192f('0xf'));}_0x385ff0(null,_0x4474ae);},'beforeUpdate':function(_0x324121,_0xa6b41d,_0x45480b){if(_0x324121[_0x192f('0x11')](_0x192f('0x12'))){_0x324121[_0x192f('0xd')]=_0x324121[_0x192f('0x12')]?moment()[_0x192f('0xe')](_0x192f('0xf')):null;}if(_0x324121['changed'](_0x192f('0x10'))){_0x324121[_0x192f('0x13')]=moment()['format'](_0x192f('0xf'));_0x324121['substatus']=null;_0x324121[_0x192f('0xd')]=null;}_0x45480b(null,_0x324121);},'afterUpdate':function(_0x39a45c,_0x4d1194,_0x16f304){var _0x387af7=_0x3a63c1[_0x192f('0x14')];var _0x37e33e=_0x39a45c[_0x192f('0x15')]({'plain':!![]});if(_0x37e33e['closed']){return _0x387af7[_0x192f('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x37e33e['id']}})['then'](function(){_0x16f304();})['catch'](function(_0x1dc902){_0x16f304(_0x1dc902);});}else{_0x16f304();}}},'charset':_0x192f('0x17'),'collate':_0x192f('0x18')});}; \ No newline at end of file +var _0x4547=['moment','path','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x474437,_0x190bce){var _0x375104=function(_0x110c5e){while(--_0x110c5e){_0x474437['push'](_0x474437['shift']());}};_0x375104(++_0x190bce);}(_0x4547,0x130));var _0x7454=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0x4547[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0x7454('0x0'));var util=require(_0x7454('0x1'));var logger=require(_0x7454('0x2'))(_0x7454('0x3'));var moment=require(_0x7454('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7454('0x5'));var rimraf=require('rimraf');var config=require(_0x7454('0x6'));var attributes=require(_0x7454('0x7'));module[_0x7454('0x8')]=function(_0x1f2578,_0x5a81a6){return _0x1f2578[_0x7454('0x9')]('MailInteraction',attributes,{'tableName':_0x7454('0xa'),'paranoid':![],'indexes':[{'name':_0x7454('0xb'),'fields':['subject','to'],'type':_0x7454('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29c92c,_0x59b4e5,_0x1a7bd7){if(_0x29c92c[_0x7454('0xd')]){_0x29c92c[_0x7454('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x29c92c[_0x7454('0xf')]){_0x29c92c[_0x7454('0x10')]=moment()[_0x7454('0x11')](_0x7454('0x12'));}_0x1a7bd7(null,_0x59b4e5);},'beforeUpdate':function(_0x162e7c,_0x3d52a4,_0x5b56e0){if(_0x162e7c[_0x7454('0x13')]('substatus')){_0x162e7c['substatusAt']=_0x162e7c[_0x7454('0xd')]?moment()[_0x7454('0x11')](_0x7454('0x12')):null;}if(_0x162e7c[_0x7454('0x13')]('closed')){_0x162e7c[_0x7454('0x10')]=moment()['format'](_0x7454('0x12'));_0x162e7c[_0x7454('0xd')]=null;_0x162e7c[_0x7454('0xe')]=null;}_0x5b56e0(null,_0x162e7c);},'afterUpdate':function(_0x1ffff2,_0x102d16,_0x116648){var _0x27e1d7=_0x1f2578[_0x7454('0x14')];var _0x5bd4b1=_0x1ffff2[_0x7454('0x15')]({'plain':!![]});if(_0x5bd4b1[_0x7454('0xf')]){return _0x27e1d7[_0x7454('0x16')][_0x7454('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5bd4b1['id']}})[_0x7454('0x18')](function(){_0x116648();})[_0x7454('0x19')](function(_0x29cbf4){_0x116648(_0x29cbf4);});}else{_0x116648();}}},'charset':_0x7454('0x1a'),'collate':_0x7454('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4fdbb22..cc42f17 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 _0xe75a=['find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction'];(function(_0x1ade29,_0x3563ec){var _0x145c6c=function(_0x4a9b1a){while(--_0x4a9b1a){_0x1ade29['push'](_0x1ade29['shift']());}};_0x145c6c(++_0x3563ec);}(_0xe75a,0x1de));var _0xae75=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xe75a[_0x12d951];return _0x44de17;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var moment=require('moment');var BPromise=require(_0xae75('0x2'));var rs=require(_0xae75('0x3'));var fs=require('fs');var Redis=require(_0xae75('0x4'));var db=require(_0xae75('0x5'))['db'];var utils=require(_0xae75('0x6'));var logger=require(_0xae75('0x7'))(_0xae75('0x8'));var config=require(_0xae75('0x9'));var jayson=require(_0xae75('0xa'));var client=jayson[_0xae75('0xb')]['http']({'port':0x232a});config[_0xae75('0xc')]=_['defaults'](config['redis'],{'host':_0xae75('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0xae75('0xe')](socket);function respondWithRpcPromise(_0x553539,_0x58d7b9,_0x3a7360){return new BPromise(function(_0x3f6ae2,_0x55487c){return client[_0xae75('0xf')](_0x553539,_0x3a7360)[_0xae75('0x10')](function(_0x54aece){logger[_0xae75('0x11')](_0xae75('0x12'),_0x58d7b9,_0xae75('0x13'));logger['debug'](_0xae75('0x14'),_0x58d7b9,_0xae75('0x13'),JSON[_0xae75('0x15')](_0x54aece));if(_0x54aece[_0xae75('0x16')]){if(_0x54aece[_0xae75('0x16')][_0xae75('0x17')]===0x1f4){logger[_0xae75('0x16')](_0xae75('0x12'),_0x58d7b9,_0x54aece[_0xae75('0x16')][_0xae75('0x18')]);return _0x55487c(_0x54aece['error'][_0xae75('0x18')]);}logger[_0xae75('0x16')](_0xae75('0x12'),_0x58d7b9,_0x54aece[_0xae75('0x16')][_0xae75('0x18')]);return _0x3f6ae2(_0x54aece[_0xae75('0x16')]['message']);}else{logger['info'](_0xae75('0x12'),_0x58d7b9,_0xae75('0x13'));_0x3f6ae2(_0x54aece[_0xae75('0x19')]['message']);}})[_0xae75('0x1a')](function(_0x1e31ff){logger[_0xae75('0x16')](_0xae75('0x12'),_0x58d7b9,_0x1e31ff);_0x55487c(_0x1e31ff);});});}exports[_0xae75('0x1b')]=function(_0x1bf503){var _0x5984d0=this;return new Promise(function(_0x40f92c,_0x43b698){return db[_0xae75('0x1c')][_0xae75('0x1d')](_0x1bf503[_0xae75('0x1e')],{'raw':_0x1bf503[_0xae75('0x1f')]?_0x1bf503[_0xae75('0x1f')][_0xae75('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bf503[_0xae75('0x1f')]?_0x1bf503['options'][_0xae75('0x21')]||null:null,'attributes':_0x1bf503[_0xae75('0x1f')]?_0x1bf503[_0xae75('0x1f')][_0xae75('0x22')]||null:null,'limit':_0x1bf503['options']?_0x1bf503['options'][_0xae75('0x23')]||null:null})['then'](function(_0x245b74){logger[_0xae75('0x11')](_0xae75('0x1b'),_0x1bf503);logger[_0xae75('0x24')](_0xae75('0x1b'),_0x1bf503,JSON[_0xae75('0x15')](_0x245b74));_0x40f92c(_0x245b74);})[_0xae75('0x1a')](function(_0x3a30f8){logger[_0xae75('0x16')]('UpdateMailInteraction',_0x3a30f8[_0xae75('0x18')],_0x1bf503);_0x43b698(_0x5984d0['error'](0x1f4,_0x3a30f8[_0xae75('0x18')]));});});};exports[_0xae75('0x25')]=function(_0x4a7eb3){return new Promise(function(_0x5c6bec,_0x105007){return db['MailInteraction'][_0xae75('0x26')]({'where':_0x4a7eb3[_0xae75('0x1f')]?_0x4a7eb3[_0xae75('0x1f')][_0xae75('0x21')]||null:null})['then'](function(_0x4b4398){if(_0x4b4398){return _0x4b4398[_0xae75('0x27')](_0x4a7eb3['body'][_0xae75('0x28')],_['omit'](_0x4a7eb3[_0xae75('0x1e')],[_0xae75('0x28'),'id'])||{});}})[_0xae75('0x29')](function(_0x23ec50){logger[_0xae75('0x11')](_0xae75('0x2a'),_0x4a7eb3);logger[_0xae75('0x24')]('AddTags',_0x4a7eb3,JSON[_0xae75('0x15')](_0x23ec50));_0x5c6bec(_0x23ec50);})[_0xae75('0x1a')](function(_0x255669){logger[_0xae75('0x16')]('AddTags',_0x255669[_0xae75('0x18')],_0x4a7eb3);_0x105007(_this[_0xae75('0x16')](0x1f4,_0x255669[_0xae75('0x18')]));});});}; \ No newline at end of file +var _0x5a43=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','AddTagsToMailInteraction','then','addTags','ids'];(function(_0x52b3ce,_0x2c0ac0){var _0x80b81a=function(_0x1dcd01){while(--_0x1dcd01){_0x52b3ce['push'](_0x52b3ce['shift']());}};_0x80b81a(++_0x2c0ac0);}(_0x5a43,0xd0));var _0x35a4=function(_0x453cde,_0x2aa128){_0x453cde=_0x453cde-0x0;var _0x2efcab=_0x5a43[_0x453cde];return _0x2efcab;};'use strict';var _=require(_0x35a4('0x0'));var util=require(_0x35a4('0x1'));var moment=require(_0x35a4('0x2'));var BPromise=require(_0x35a4('0x3'));var rs=require(_0x35a4('0x4'));var fs=require('fs');var Redis=require(_0x35a4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35a4('0x6'))('rpc');var config=require(_0x35a4('0x7'));var jayson=require(_0x35a4('0x8'));var client=jayson[_0x35a4('0x9')][_0x35a4('0xa')]({'port':0x232a});config[_0x35a4('0xb')]=_[_0x35a4('0xc')](config[_0x35a4('0xb')],{'host':_0x35a4('0xd'),'port':0x18eb});var socket=require(_0x35a4('0xe'))(new Redis(config[_0x35a4('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x5731a0,_0x59596c,_0xe068ba){return new BPromise(function(_0x349757,_0x5beb25){return client[_0x35a4('0xf')](_0x5731a0,_0xe068ba)['then'](function(_0x2eca4d){logger[_0x35a4('0x10')](_0x35a4('0x11'),_0x59596c,_0x35a4('0x12'));logger[_0x35a4('0x13')](_0x35a4('0x14'),_0x59596c,'request\x20sent',JSON[_0x35a4('0x15')](_0x2eca4d));if(_0x2eca4d[_0x35a4('0x16')]){if(_0x2eca4d['error'][_0x35a4('0x17')]===0x1f4){logger[_0x35a4('0x16')](_0x35a4('0x11'),_0x59596c,_0x2eca4d[_0x35a4('0x16')]['message']);return _0x5beb25(_0x2eca4d['error'][_0x35a4('0x18')]);}logger[_0x35a4('0x16')](_0x35a4('0x11'),_0x59596c,_0x2eca4d[_0x35a4('0x16')][_0x35a4('0x18')]);return _0x349757(_0x2eca4d[_0x35a4('0x16')][_0x35a4('0x18')]);}else{logger['info'](_0x35a4('0x11'),_0x59596c,_0x35a4('0x12'));_0x349757(_0x2eca4d['result'][_0x35a4('0x18')]);}})[_0x35a4('0x19')](function(_0x5e57e9){logger['error'](_0x35a4('0x11'),_0x59596c,_0x5e57e9);_0x5beb25(_0x5e57e9);});});}exports[_0x35a4('0x1a')]=function(_0x2d3f84){var _0x3d9c19=this;return new Promise(function(_0x143e9a,_0x377472){return db[_0x35a4('0x1b')][_0x35a4('0x1c')](_0x2d3f84[_0x35a4('0x1d')],{'raw':_0x2d3f84[_0x35a4('0x1e')]?_0x2d3f84[_0x35a4('0x1e')][_0x35a4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d3f84['options']?_0x2d3f84[_0x35a4('0x1e')][_0x35a4('0x20')]||null:null,'attributes':_0x2d3f84['options']?_0x2d3f84['options']['attributes']||null:null,'limit':_0x2d3f84['options']?_0x2d3f84['options'][_0x35a4('0x21')]||null:null})['then'](function(_0x1b682c){logger[_0x35a4('0x10')](_0x35a4('0x1a'),_0x2d3f84);logger[_0x35a4('0x13')]('UpdateMailInteraction',_0x2d3f84,JSON['stringify'](_0x1b682c));_0x143e9a(_0x1b682c);})[_0x35a4('0x19')](function(_0x4259b4){logger[_0x35a4('0x16')](_0x35a4('0x1a'),_0x4259b4['message'],_0x2d3f84);_0x377472(_0x3d9c19[_0x35a4('0x16')](0x1f4,_0x4259b4[_0x35a4('0x18')]));});});};exports[_0x35a4('0x22')]=function(_0x52c13c){return new Promise(function(_0x524a43,_0x5ace80){return db['MailInteraction']['find']({'where':_0x52c13c['options']?_0x52c13c[_0x35a4('0x1e')]['where']||null:null})[_0x35a4('0x23')](function(_0x236186){if(_0x236186){return _0x236186[_0x35a4('0x24')](_0x52c13c[_0x35a4('0x1d')][_0x35a4('0x25')],_[_0x35a4('0x26')](_0x52c13c[_0x35a4('0x1d')],['ids','id'])||{});}})[_0x35a4('0x27')](function(_0x2ad7d1){logger[_0x35a4('0x10')]('AddTags',_0x52c13c);logger[_0x35a4('0x13')](_0x35a4('0x28'),_0x52c13c,JSON[_0x35a4('0x15')](_0x2ad7d1));_0x524a43(_0x2ad7d1);})[_0x35a4('0x19')](function(_0x22f40c){logger[_0x35a4('0x16')](_0x35a4('0x28'),_0x22f40c[_0x35a4('0x18')],_0x52c13c);_0x5ace80(_this[_0x35a4('0x16')](0x1f4,_0x22f40c[_0x35a4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 369277e..013f09c 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 _0xcbb6=['length','./mailInteraction.events','save','remove','update','removeListener','register'];(function(_0x210c7e,_0x575cf7){var _0x72c2c2=function(_0x4a9d84){while(--_0x4a9d84){_0x210c7e['push'](_0x210c7e['shift']());}};_0x72c2c2(++_0x575cf7);}(_0xcbb6,0x1b3));var _0x6cbb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcbb6[_0x19e35c];return _0x3e1fe8;};'use strict';var MailInteractionEvents=require(_0x6cbb('0x0'));var events=[_0x6cbb('0x1'),_0x6cbb('0x2'),_0x6cbb('0x3')];function createListener(_0x284788,_0x1dd7ed){return function(_0x8c0a86){_0x1dd7ed['emit'](_0x284788,_0x8c0a86);};}function removeListener(_0x43dce5,_0x2fb59b){return function(){MailInteractionEvents[_0x6cbb('0x4')](_0x43dce5,_0x2fb59b);};}exports[_0x6cbb('0x5')]=function(_0x3086d6){for(var _0x4f2ca4=0x0,_0x52f541=events[_0x6cbb('0x6')];_0x4f2ca4<_0x52f541;_0x4f2ca4++){var _0x22034a=events[_0x4f2ca4];var _0x5bfb7f=createListener('mailInteraction:'+_0x22034a,_0x3086d6);MailInteractionEvents['on'](_0x22034a,_0x5bfb7f);}}; \ No newline at end of file +var _0x9406=['./mailInteraction.events','save','update','emit','removeListener','length','mailInteraction:'];(function(_0x3c5492,_0x2debad){var _0x3ea145=function(_0x5b4312){while(--_0x5b4312){_0x3c5492['push'](_0x3c5492['shift']());}};_0x3ea145(++_0x2debad);}(_0x9406,0x19d));var _0x6940=function(_0x571094,_0x6c5d64){_0x571094=_0x571094-0x0;var _0x1598b5=_0x9406[_0x571094];return _0x1598b5;};'use strict';var MailInteractionEvents=require(_0x6940('0x0'));var events=[_0x6940('0x1'),'remove',_0x6940('0x2')];function createListener(_0x735a61,_0x4c5662){return function(_0x50ca34){_0x4c5662[_0x6940('0x3')](_0x735a61,_0x50ca34);};}function removeListener(_0x4fba6b,_0x3acf56){return function(){MailInteractionEvents[_0x6940('0x4')](_0x4fba6b,_0x3acf56);};}exports['register']=function(_0xc781c7){for(var _0x1a4b64=0x0,_0x20efc6=events[_0x6940('0x5')];_0x1a4b64<_0x20efc6;_0x1a4b64++){var _0x51d752=events[_0x1a4b64];var _0x54402e=createListener(_0x6940('0x6')+_0x51d752,_0xc781c7);MailInteractionEvents['on'](_0x51d752,_0x54402e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 620277f..da44e0b 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 _0x3360=['../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','create','update','put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','Router','../../components/interaction/service'];(function(_0x323305,_0x17caf2){var _0x46ba34=function(_0x54e523){while(--_0x54e523){_0x323305['push'](_0x323305['shift']());}};_0x46ba34(++_0x17caf2);}(_0x3360,0x1d7));var _0x0336=function(_0x51bf4c,_0xb14dc5){_0x51bf4c=_0x51bf4c-0x0;var _0x5aba54=_0x3360[_0x51bf4c];return _0x5aba54;};'use strict';var multer=require(_0x0336('0x0'));var util=require(_0x0336('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0336('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0336('0x3'));var config=require(_0x0336('0x4'));var controller=require(_0x0336('0x5'));router[_0x0336('0x6')]('/',auth[_0x0336('0x7')](),controller['index']);router['get'](_0x0336('0x8'),auth[_0x0336('0x7')](),controller[_0x0336('0x9')]);router[_0x0336('0x6')](_0x0336('0xa'),auth['isAuthenticated'](),controller[_0x0336('0xb')]);router[_0x0336('0x6')](_0x0336('0xc'),auth['isAuthenticated'](),controller[_0x0336('0xd')]);router['post']('/',auth[_0x0336('0x7')](),interaction[_0x0336('0xe')](_0x0336('0xf'),_0x0336('0x10')),controller[_0x0336('0x11')]);router['put'](_0x0336('0xa'),auth[_0x0336('0x7')](),controller[_0x0336('0x12')]);router[_0x0336('0x13')](_0x0336('0x14'),auth['isAuthenticated'](),controller[_0x0336('0x15')]);router[_0x0336('0x13')](_0x0336('0x16'),auth[_0x0336('0x7')](),controller['reject']);router[_0x0336('0x17')]('/:id',auth[_0x0336('0x7')](),controller[_0x0336('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2083=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x2b0b92,_0x32dbd2){var _0x342117=function(_0x4a38d9){while(--_0x4a38d9){_0x2b0b92['push'](_0x2b0b92['shift']());}};_0x342117(++_0x32dbd2);}(_0x2083,0x137));var _0x3208=function(_0x1eaae0,_0x469079){_0x1eaae0=_0x1eaae0-0x0;var _0x418342=_0x2083[_0x1eaae0];return _0x418342;};'use strict';var multer=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var path=require('path');var timeout=require(_0x3208('0x2'));var express=require(_0x3208('0x3'));var router=express[_0x3208('0x4')]();var fs_extra=require(_0x3208('0x5'));var auth=require(_0x3208('0x6'));var interaction=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3208('0x9')]);router[_0x3208('0xa')](_0x3208('0xb'),auth[_0x3208('0xc')](),controller['describe']);router[_0x3208('0xa')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller['show']);router['get'](_0x3208('0xe'),auth[_0x3208('0xc')](),controller[_0x3208('0xf')]);router[_0x3208('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3208('0x11'),_0x3208('0x12')),controller[_0x3208('0x13')]);router[_0x3208('0x14')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x15')]);router[_0x3208('0x14')](_0x3208('0x16'),auth[_0x3208('0xc')](),controller[_0x3208('0x17')]);router[_0x3208('0x14')](_0x3208('0x18'),auth[_0x3208('0xc')](),controller['reject']);router[_0x3208('0x19')](_0x3208('0xd'),auth[_0x3208('0xc')](),controller[_0x3208('0x1a')]);module[_0x3208('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b209ed6..5de6d64 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 _0x127a=['DATE','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x8ee0dd,_0x3581ea){var _0x259d92=function(_0x5a80c9){while(--_0x5a80c9){_0x8ee0dd['push'](_0x8ee0dd['shift']());}};_0x259d92(++_0x3581ea);}(_0x127a,0x12f));var _0xa127=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x127a[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xa127('0x0'));var _=require('lodash');module[_0xa127('0x1')]={'body':{'type':Sequelize[_0xa127('0x2')](_0xa127('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa127('0x2')](_0xa127('0x4'))},'read':{'type':Sequelize[_0xa127('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa127('0x6')]('in',_0xa127('0x7')),'defaultValue':_0xa127('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa127('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xa127('0x3'))},'cc':{'type':Sequelize[_0xa127('0x2')](_0xa127('0x3'))},'bcc':{'type':Sequelize[_0xa127('0x2')](_0xa127('0x3'))},'subject':{'type':Sequelize[_0xa127('0x2')]},'sentAt':{'type':Sequelize[_0xa127('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa127('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa127('0x9')]},'originTo':{'type':Sequelize[_0xa127('0x2')](_0xa127('0x3'))},'originCc':{'type':Sequelize[_0xa127('0x2')]('long')},'originChannel':{'type':Sequelize[_0xa127('0x6')](_0xa127('0xa'),_0xa127('0xb')),'defaultValue':_0xa127('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xe285=['Chat','sequelize','lodash','exports','TEXT','long','out','STRING','DATE','BOOLEAN','ENUM','Email'];(function(_0x528684,_0x199c3e){var _0x486275=function(_0x1fca92){while(--_0x1fca92){_0x528684['push'](_0x528684['shift']());}};_0x486275(++_0x199c3e);}(_0xe285,0xe5));var _0x5e28=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe285[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0x5e28('0x0'));var _=require(_0x5e28('0x1'));module[_0x5e28('0x2')]={'body':{'type':Sequelize[_0x5e28('0x3')](_0x5e28('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5e28('0x3')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5e28('0x5')),'defaultValue':_0x5e28('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x5e28('0x6')]},'to':{'type':Sequelize[_0x5e28('0x3')](_0x5e28('0x4'))},'cc':{'type':Sequelize[_0x5e28('0x3')](_0x5e28('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x5e28('0x3')]},'sentAt':{'type':Sequelize[_0x5e28('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5e28('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5e28('0x7')]},'originTo':{'type':Sequelize[_0x5e28('0x3')]('long')},'originCc':{'type':Sequelize[_0x5e28('0x3')]('long')},'originChannel':{'type':Sequelize[_0x5e28('0x9')](_0x5e28('0xa'),_0x5e28('0xb')),'defaultValue':_0x5e28('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3d8fd39..a2ca36a 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 _0xb616=['order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','intersection','merge','options','body','find','describe','create','direction','secret','split','MailAccount','findOne','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','length','join','root','server/files/attachments','basename','CmContact','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','fullname','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','contact','email','interface','rejectmessage','download','unix','toString','files','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','set','Content-Range','update','destroy','then','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xb616,0x1b3));var _0x6b61=function(_0xfdebd2,_0x39bbaf){_0xfdebd2=_0xfdebd2-0x0;var _0x529da2=_0xb616[_0xfdebd2];return _0x529da2;};'use strict';var emlformat=require(_0x6b61('0x0'));var moment=require(_0x6b61('0x1'));var BPromise=require(_0x6b61('0x2'));var util=require(_0x6b61('0x3'));var path=require(_0x6b61('0x4'));var fs=require('fs');var _=require(_0x6b61('0x5'));var Redis=require(_0x6b61('0x6'));var htmlToText=require(_0x6b61('0x7'));var qs=require(_0x6b61('0x8'));var logger=require(_0x6b61('0x9'))(_0x6b61('0xa'));var interaction_log=require(_0x6b61('0x9'))(_0x6b61('0xb'));var config=require(_0x6b61('0xc'));var db=require(_0x6b61('0xd'))['db'];config[_0x6b61('0xe')]=_[_0x6b61('0xf')](config[_0x6b61('0xe')],{'host':_0x6b61('0x10'),'port':0x18eb});var socket=require(_0x6b61('0x11'))(new Redis(config['redis']));var htmlEntities=require(_0x6b61('0x12'));require('./mailMessage.socket')[_0x6b61('0x13')](socket);var jayson=require(_0x6b61('0x14'));var client=jayson[_0x6b61('0x15')]['http']({'port':0x232c});var client9003=jayson[_0x6b61('0x15')][_0x6b61('0x16')]({'port':0x232b});var client9002=jayson[_0x6b61('0x15')][_0x6b61('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x5b2576,_0x224703,_0x269a38,_0x45ceae){return new BPromise(function(_0x198936,_0x53f6ea){var _0xb8e429=_0x45ceae||client;return _0xb8e429[_0x6b61('0x17')](_0x5b2576,_0x269a38)['then'](function(_0x56c1db){logger[_0x6b61('0x18')]('MailMessage,\x20%s,\x20%s',_0x224703,_0x6b61('0x19'));logger[_0x6b61('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x224703,'request\x20sent',JSON[_0x6b61('0x1b')](_0x56c1db));if(_0x56c1db[_0x6b61('0x1c')]){if(_0x56c1db[_0x6b61('0x1c')]['code']===0x1f4){logger[_0x6b61('0x1c')](_0x6b61('0x1d'),_0x224703,_0x56c1db[_0x6b61('0x1c')][_0x6b61('0x1e')]);return _0x53f6ea(_0x56c1db[_0x6b61('0x1c')][_0x6b61('0x1e')]);}logger[_0x6b61('0x1c')]('MailMessage,\x20%s,\x20%s',_0x224703,_0x56c1db[_0x6b61('0x1c')]['message']);return _0x198936(_0x56c1db['error'][_0x6b61('0x1e')]);}else{logger[_0x6b61('0x18')](_0x6b61('0x1d'),_0x224703,_0x6b61('0x19'));_0x198936(_0x56c1db['result'][_0x6b61('0x1e')]);}})[_0x6b61('0x1f')](function(_0x46f949){logger[_0x6b61('0x1c')]('MailMessage,\x20%s,\x20%s',_0x224703,_0x46f949);_0x53f6ea(_0x46f949);});});}function respondWithResult(_0x2ad804,_0x41b8a0){_0x41b8a0=_0x41b8a0||0xc8;return function(_0x477261){if(_0x477261){return _0x2ad804[_0x6b61('0x20')](_0x41b8a0)[_0x6b61('0x21')](_0x477261);}};}function respondWithFilteredResult(_0x544fd3,_0x106462){return function(_0x1a7444){if(_0x1a7444){var _0x40c7e3=typeof _0x106462[_0x6b61('0x22')]===_0x6b61('0x23')&&typeof _0x106462[_0x6b61('0x24')]===_0x6b61('0x23');var _0xb415ec=_0x1a7444['count'];var _0x1c9c8e=_0x40c7e3?0x0:_0x106462['offset'];var _0x46a05a=_0x40c7e3?_0x1a7444['count']:_0x106462['offset']+_0x106462[_0x6b61('0x24')];var _0x43715a;if(_0x46a05a>=_0xb415ec){_0x46a05a=_0xb415ec;_0x43715a=0xc8;}else{_0x43715a=0xce;}_0x544fd3[_0x6b61('0x20')](_0x43715a);return _0x544fd3[_0x6b61('0x25')](_0x6b61('0x26'),_0x1c9c8e+'-'+_0x46a05a+'/'+_0xb415ec)[_0x6b61('0x21')](_0x1a7444);}return null;};}function saveUpdates(_0x50446c){return function(_0x1b3a45){if(_0x1b3a45){return _0x1b3a45[_0x6b61('0x27')](_0x50446c)['then'](function(_0x1adab6){return _0x1adab6;});}return null;};}function removeEntity(_0xa2ace7){return function(_0xbc23c0){if(_0xbc23c0){return _0xbc23c0[_0x6b61('0x28')]()[_0x6b61('0x29')](function(){_0xa2ace7[_0x6b61('0x20')](0xcc)[_0x6b61('0x2a')]();});}};}function handleEntityNotFound(_0x3edef4){return function(_0x397264){if(!_0x397264){_0x3edef4[_0x6b61('0x2b')](0x194);}return _0x397264;};}function handleError(_0x2895ff,_0x130dae){_0x130dae=_0x130dae||0x1f4;return function(_0x1f3c2d){logger[_0x6b61('0x1c')](_0x1f3c2d['stack']);if(_0x1f3c2d[_0x6b61('0x2c')]){delete _0x1f3c2d['name'];}_0x2895ff[_0x6b61('0x20')](_0x130dae)[_0x6b61('0x2d')](_0x1f3c2d);};}exports[_0x6b61('0x2e')]=function(_0x31c1df,_0x30cfe7){var _0x3c9a00={},_0x360b33={},_0xf5a93c={'count':0x0,'rows':[]};var _0x4610af=_[_0x6b61('0x2f')](db[_0x6b61('0x30')][_0x6b61('0x31')],function(_0x4e5795){return{'name':_0x4e5795[_0x6b61('0x32')],'type':_0x4e5795[_0x6b61('0x33')][_0x6b61('0x34')]};});_0x360b33['model']=_['map'](_0x4610af,_0x6b61('0x2c'));_0x360b33[_0x6b61('0x35')]=_['keys'](_0x31c1df[_0x6b61('0x35')]);_0x360b33[_0x6b61('0x36')]=_['intersection'](_0x360b33[_0x6b61('0x37')],_0x360b33[_0x6b61('0x35')]);_0x3c9a00[_0x6b61('0x38')]=_['intersection'](_0x360b33[_0x6b61('0x37')],qs['fields'](_0x31c1df[_0x6b61('0x35')][_0x6b61('0x39')]));_0x3c9a00[_0x6b61('0x38')]=_0x3c9a00['attributes']['length']?_0x3c9a00[_0x6b61('0x38')]:_0x360b33['model'];if(!_0x31c1df['query'][_0x6b61('0x3a')](_0x6b61('0x3b'))){_0x3c9a00[_0x6b61('0x24')]=qs[_0x6b61('0x24')](_0x31c1df['query'][_0x6b61('0x24')]);_0x3c9a00[_0x6b61('0x22')]=qs[_0x6b61('0x22')](_0x31c1df[_0x6b61('0x35')][_0x6b61('0x22')]);}_0x3c9a00[_0x6b61('0x3c')]=qs[_0x6b61('0x3d')](_0x31c1df[_0x6b61('0x35')]['sort']);_0x3c9a00['where']=qs[_0x6b61('0x36')](_[_0x6b61('0x3e')](_0x31c1df[_0x6b61('0x35')],_0x360b33[_0x6b61('0x36')]),_0x4610af);if(_0x31c1df[_0x6b61('0x35')][_0x6b61('0x3f')]){_0x3c9a00[_0x6b61('0x40')]=_['merge'](_0x3c9a00[_0x6b61('0x40')],{'$or':_[_0x6b61('0x2f')](_0x4610af,function(_0x2ceb0f){if(_0x2ceb0f['type']!==_0x6b61('0x41')){var _0x1ee6dc={};_0x1ee6dc[_0x2ceb0f[_0x6b61('0x2c')]]={'$like':'%'+_0x31c1df[_0x6b61('0x35')][_0x6b61('0x3f')]+'%'};return _0x1ee6dc;}})});}_0x3c9a00=_['merge']({},_0x3c9a00,_0x31c1df['options']);var _0x381317={'where':_0x3c9a00['where']};return db[_0x6b61('0x30')]['count'](_0x381317)[_0x6b61('0x29')](function(_0x5084e2){_0xf5a93c['count']=_0x5084e2;if(_0x31c1df['query'][_0x6b61('0x42')]){_0x3c9a00[_0x6b61('0x43')]=[{'all':!![]}];}return db[_0x6b61('0x30')][_0x6b61('0x44')](_0x3c9a00);})[_0x6b61('0x29')](function(_0x304957){_0xf5a93c[_0x6b61('0x45')]=_0x304957;return _0xf5a93c;})[_0x6b61('0x29')](respondWithFilteredResult(_0x30cfe7,_0x3c9a00))[_0x6b61('0x1f')](handleError(_0x30cfe7,null));};exports[_0x6b61('0x46')]=function(_0x35a985,_0xdd3ce3){var _0x483a9a={'raw':!![],'where':{'id':_0x35a985[_0x6b61('0x47')]['id']}},_0x3b59ea={};_0x3b59ea[_0x6b61('0x37')]=_[_0x6b61('0x48')](db[_0x6b61('0x30')][_0x6b61('0x31')]);_0x3b59ea[_0x6b61('0x35')]=_['keys'](_0x35a985[_0x6b61('0x35')]);_0x3b59ea[_0x6b61('0x36')]=_[_0x6b61('0x49')](_0x3b59ea[_0x6b61('0x37')],_0x3b59ea[_0x6b61('0x35')]);_0x483a9a[_0x6b61('0x38')]=_[_0x6b61('0x49')](_0x3b59ea[_0x6b61('0x37')],qs['fields'](_0x35a985[_0x6b61('0x35')][_0x6b61('0x39')]));_0x483a9a[_0x6b61('0x38')]=_0x483a9a[_0x6b61('0x38')]['length']?_0x483a9a[_0x6b61('0x38')]:_0x3b59ea[_0x6b61('0x37')];if(_0x35a985[_0x6b61('0x35')][_0x6b61('0x42')]){_0x483a9a[_0x6b61('0x43')]=[{'all':!![]}];}_0x483a9a=_[_0x6b61('0x4a')]({},_0x483a9a,_0x35a985[_0x6b61('0x4b')]);return db[_0x6b61('0x30')]['find'](_0x483a9a)[_0x6b61('0x29')](handleEntityNotFound(_0xdd3ce3,null))[_0x6b61('0x29')](respondWithResult(_0xdd3ce3,null))['catch'](handleError(_0xdd3ce3,null));};exports[_0x6b61('0x27')]=function(_0x4bfb2f,_0x44fe5b){if(_0x4bfb2f['body']['id']){delete _0x4bfb2f[_0x6b61('0x4c')]['id'];}return db[_0x6b61('0x30')][_0x6b61('0x4d')]({'where':{'id':_0x4bfb2f[_0x6b61('0x47')]['id']}})[_0x6b61('0x29')](handleEntityNotFound(_0x44fe5b,null))['then'](saveUpdates(_0x4bfb2f[_0x6b61('0x4c')],null))[_0x6b61('0x29')](respondWithResult(_0x44fe5b,null))['catch'](handleError(_0x44fe5b,null));};exports['destroy']=function(_0x131106,_0x40fd17){return db[_0x6b61('0x30')][_0x6b61('0x4d')]({'where':{'id':_0x131106[_0x6b61('0x47')]['id']}})[_0x6b61('0x29')](handleEntityNotFound(_0x40fd17,null))[_0x6b61('0x29')](removeEntity(_0x40fd17,null))['catch'](handleError(_0x40fd17,null));};exports[_0x6b61('0x4e')]=function(_0x3fc572,_0x12e6bf){return db[_0x6b61('0x30')]['describe']()[_0x6b61('0x29')](respondWithResult(_0x12e6bf,null))[_0x6b61('0x1f')](handleError(_0x12e6bf,null));};exports[_0x6b61('0x4f')]=function(_0x2137cf,_0x393dcc){return db[_0x6b61('0x30')][_0x6b61('0x4f')](_0x2137cf['body'])[_0x6b61('0x29')](function(_0xa306cc){if(_0xa306cc){if(_0xa306cc[_0x6b61('0x50')]==='out'&&!_0xa306cc[_0x6b61('0x51')]){var _0x4ab5d8,_0x44ab86,_0x29666f;if(_0x2137cf[_0x6b61('0x4c')]['to']){_0x44ab86=_0x2137cf[_0x6b61('0x4c')]['to'][_0x6b61('0x52')](',')[0x0];}return db[_0x6b61('0x53')][_0x6b61('0x54')]({'where':{'id':_0xa306cc['MailAccountId']},'include':[{'model':db[_0x6b61('0x55')],'as':_0x6b61('0x56'),'include':[{'model':db['CmContact'],'as':_0x6b61('0x57'),'where':{'email':_0x44ab86},'limit':0x1,'order':[[_0x6b61('0x58'),_0x6b61('0x59')]]}]},{'model':db[_0x6b61('0x5a')],'as':_0x6b61('0x5b'),'raw':!![],'include':[{'model':db[_0x6b61('0x5c')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x56bf20){_0x4ab5d8=_0x56bf20;if(!_0x4ab5d8||!_0x4ab5d8[_0x6b61('0x5b')])return;var _0x11d8fe=_0x4ab5d8[_0x6b61('0x5d')]();if(_0x2137cf[_0x6b61('0x4c')][_0x6b61('0x5e')]&&_0x2137cf['body'][_0x6b61('0x5e')][_0x6b61('0x5f')]){for(var _0xe37bbf=0x0;_0xe37bbf<_0x2137cf[_0x6b61('0x4c')]['attachments'][_0x6b61('0x5f')];_0xe37bbf+=0x1){_0x2137cf['body'][_0x6b61('0x5e')][_0xe37bbf]={'filename':_0x2137cf[_0x6b61('0x4c')]['attachments'][_0xe37bbf][_0x6b61('0x2c')],'path':path[_0x6b61('0x60')](config[_0x6b61('0x61')],_0x6b61('0x62'),_0x2137cf[_0x6b61('0x4c')][_0x6b61('0x5e')][_0xe37bbf][_0x6b61('0x63')])};}}_0x29666f={'account':_0x11d8fe,'message':_0x2137cf['body']};return;})['then'](function(){if(_0x4ab5d8['List']){if(_0x4ab5d8[_0x6b61('0x56')][_0x6b61('0x57')][_0x6b61('0x5f')]){return _0x4ab5d8[_0x6b61('0x56')]['Contacts'][0x0];}else{return db[_0x6b61('0x64')]['create'](_['defaults'](_0x2137cf[_0x6b61('0x4c')],{'firstName':_0x2137cf[_0x6b61('0x4c')]['to'],'email':_0x2137cf[_0x6b61('0x4c')]['to'],'phone':_0x2137cf[_0x6b61('0x4c')]['to'],'ListId':_0x4ab5d8['ListId']}));}}else{throw new Error(_0x6b61('0x65'));}})[_0x6b61('0x29')](function(){if(_0x29666f){return respondWithRpcPromise(_0x6b61('0x66'),_0x6b61('0x67'),_0x29666f,client9003)[_0x6b61('0x29')](function(_0x1eb5dc){return _0xa306cc[_0x6b61('0x27')]({'read':!![],'messageId':_0x1eb5dc[_0x6b61('0x68')],'sentAt':moment()[_0x6b61('0x69')](_0x6b61('0x6a'))});})[_0x6b61('0x1f')](function(_0x13d2f5){logger[_0x6b61('0x1c')]('%s',JSON[_0x6b61('0x1b')](_0x13d2f5));return _0xa306cc;});}return _0xa306cc;});}return _0xa306cc;}})['then'](respondWithResult(_0x393dcc,0xc9))[_0x6b61('0x1f')](handleError(_0x393dcc,null));};exports[_0x6b61('0x6b')]=function(_0x3d7ca1,_0x42ec56){var _0x4c7bcc={'agent':{},'channel':_0x6b61('0x6c')};if(_0x3d7ca1[_0x6b61('0x4c')]['id']){delete _0x3d7ca1[_0x6b61('0x4c')]['id'];}_0x3d7ca1['body'][_0x6b61('0x6d')]=!![];_0x3d7ca1['body'][_0x6b61('0x6e')]=moment()['format'](_0x6b61('0x6a'));_0x3d7ca1[_0x6b61('0x4c')][_0x6b61('0x6f')]=_0x3d7ca1[_0x6b61('0x4c')][_0x6b61('0x6f')]||_0x3d7ca1[_0x6b61('0x70')]['id'];_0x4c7bcc[_0x6b61('0x71')]['id']=_0x3d7ca1[_0x6b61('0x4c')][_0x6b61('0x6f')];return db[_0x6b61('0x30')][_0x6b61('0x4d')]({'where':{'id':_0x3d7ca1[_0x6b61('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x42ec56,null))[_0x6b61('0x29')](saveUpdates(_0x3d7ca1[_0x6b61('0x4c')],null))[_0x6b61('0x29')](function(_0x541719){if(_0x541719){_0x4c7bcc['message']=_0x541719[_0x6b61('0x72')]({'plain':!![]});return db[_0x6b61('0x73')][_0x6b61('0x4d')]({'where':{'id':_0x541719['MailInteractionId']}});}return null;})[_0x6b61('0x29')](handleEntityNotFound(_0x42ec56,null))['then'](function(_0x57e6a2){if(_0x57e6a2){return _0x57e6a2[_0x6b61('0x27')]({'UserId':_0x3d7ca1['body'][_0x6b61('0x6f')],'read1stAt':_[_0x6b61('0x74')](_0x57e6a2[_0x6b61('0x75')])?moment()[_0x6b61('0x69')](_0x6b61('0x6a')):undefined});}return null;})[_0x6b61('0x29')](function(_0x1b6018){if(_0x1b6018){_0x4c7bcc[_0x6b61('0x76')]=_0x1b6018['get']({'plain':!![]});interaction_log[_0x6b61('0x18')](_0x6b61('0x77'),_0x3d7ca1['user']['id'],_0x3d7ca1[_0x6b61('0x70')]['name'],_0x3d7ca1['user'][_0x6b61('0x78')],_0x4c7bcc['interaction']['id'],_0x3d7ca1[_0x6b61('0x4c')]?JSON[_0x6b61('0x1b')](_0x3d7ca1[_0x6b61('0x4c')]):_0x6b61('0x79'));return respondWithRpcPromise('AcceptMessage',_0x6b61('0x7a'),_0x4c7bcc);}return null;})['then'](function(_0x3da53a){var _0x5d1f1c=_0x6b61('0x7b')+_0x3da53a['message'][_0x6b61('0x7c')];return db['sequelize']['query'](_0x5d1f1c,{'type':db['Sequelize'][_0x6b61('0x7d')][_0x6b61('0x7e')],'raw':!![]})[_0x6b61('0x29')](function(_0x38a2ed){return _0x38a2ed;});})[_0x6b61('0x29')](function(_0x42578c){if(_0x42578c){_0x4c7bcc['message']['contact']=_0x42578c[0x0];if(!_0x3d7ca1[_0x6b61('0x4c')]['UserId'])return;return db['User']['find']({'where':{'id':_0x3d7ca1['body'][_0x6b61('0x6f')],'role':_0x6b61('0x71')},'attributes':['id',_0x6b61('0x2c'),_0x6b61('0x7f'),'email',_0x6b61('0x80')],'raw':!![]});}return null;})[_0x6b61('0x29')](function(_0x2d5c09){if(!_0x2d5c09)return null;_0x4c7bcc[_0x6b61('0x1e')][_0x6b61('0x71')]=_0x2d5c09;return _0x4c7bcc;})['then'](function(_0x3a9c7b){if(_0x3a9c7b){if(_0x3d7ca1[_0x6b61('0x4c')][_0x6b61('0x81')]){_0x4c7bcc[_0x6b61('0x1e')]['interface']=util[_0x6b61('0x69')](_0x6b61('0x82'),_0x3d7ca1[_0x6b61('0x70')][_0x6b61('0x2c')]);_0x4c7bcc[_0x6b61('0x1e')]['channel']=_0x4c7bcc[_0x6b61('0x83')];_0x4c7bcc[_0x6b61('0x1e')][_0x6b61('0x84')]=_0x4c7bcc[_0x6b61('0x83')];_0x4c7bcc['message'][_0x6b61('0x85')]=_0x6b61('0x6b');_0x4c7bcc[_0x6b61('0x1e')][_0x6b61('0x4c')]=htmlToText[_0x6b61('0x86')](_0x4c7bcc['message'][_0x6b61('0x4c')]);return respondWithRpcPromise(_0x6b61('0x87'),_0x6b61('0x87'),{'event':'acceptmessage','message':_0x4c7bcc['message']},client9002)[_0x6b61('0x29')](function(){return _0x4c7bcc;});}return _0x4c7bcc;}return null;})[_0x6b61('0x29')](respondWithResult(_0x42ec56,null))[_0x6b61('0x1f')](handleError(_0x42ec56,null));};exports[_0x6b61('0x88')]=function(_0x5409c6,_0x41599f){var _0x141367={'agent':{},'channel':'mail'};if(_0x5409c6[_0x6b61('0x4c')]['id']){delete _0x5409c6['body']['id'];}_0x5409c6[_0x6b61('0x4c')][_0x6b61('0x6f')]=_0x5409c6[_0x6b61('0x4c')][_0x6b61('0x6f')]||_0x5409c6[_0x6b61('0x70')]['id'];_0x141367[_0x6b61('0x71')]['id']=_0x5409c6[_0x6b61('0x4c')][_0x6b61('0x6f')];return db[_0x6b61('0x30')][_0x6b61('0x4d')]({'where':{'id':_0x5409c6['params']['id'],'UserId':null}})[_0x6b61('0x29')](handleEntityNotFound(_0x41599f,null))[_0x6b61('0x29')](function(_0x1997f8){if(_0x1997f8){_0x141367[_0x6b61('0x1e')]=_0x1997f8[_0x6b61('0x72')]({'plain':!![]});return db['MailInteraction'][_0x6b61('0x4d')]({'where':{'id':_0x1997f8[_0x6b61('0x89')]}});}return null;})['then'](handleEntityNotFound(_0x41599f,null))[_0x6b61('0x29')](function(_0x34b858){if(_0x34b858){_0x141367[_0x6b61('0x76')]=_0x34b858['get']({'plain':!![]});interaction_log[_0x6b61('0x18')](_0x6b61('0x8a'),_0x5409c6[_0x6b61('0x70')]['id'],_0x5409c6[_0x6b61('0x70')][_0x6b61('0x2c')],_0x5409c6['user'][_0x6b61('0x78')],_0x141367[_0x6b61('0x76')]['id'],_0x5409c6[_0x6b61('0x4c')]?JSON[_0x6b61('0x1b')](_0x5409c6['body']):'null');return respondWithRpcPromise(_0x6b61('0x8b'),_0x6b61('0x8c'),_0x141367);}return null;})[_0x6b61('0x29')](function(_0x21a7b9){var _0x3d096d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21a7b9[_0x6b61('0x1e')]['ContactId'];return db[_0x6b61('0x8d')][_0x6b61('0x35')](_0x3d096d,{'type':db['Sequelize'][_0x6b61('0x7d')][_0x6b61('0x7e')],'raw':!![]})[_0x6b61('0x29')](function(_0x394408){return _0x394408;});})[_0x6b61('0x29')](function(_0x1144f4){if(_0x1144f4){_0x141367[_0x6b61('0x1e')][_0x6b61('0x8e')]=_0x1144f4[0x0];if(!_0x5409c6[_0x6b61('0x4c')][_0x6b61('0x6f')])return;return db['User'][_0x6b61('0x4d')]({'where':{'id':_0x5409c6[_0x6b61('0x4c')][_0x6b61('0x6f')],'role':_0x6b61('0x71')},'attributes':['id',_0x6b61('0x2c'),_0x6b61('0x7f'),_0x6b61('0x8f'),_0x6b61('0x80')],'raw':!![]});}return null;})['then'](function(_0x3bb68c){if(!_0x3bb68c)return null;_0x141367[_0x6b61('0x1e')][_0x6b61('0x71')]=_0x3bb68c;return _0x141367;})[_0x6b61('0x29')](function(_0x5e031e){if(_0x5e031e){_0x5e031e[_0x6b61('0x1e')][_0x6b61('0x90')]=util[_0x6b61('0x69')](_0x6b61('0x82'),_0x5409c6[_0x6b61('0x70')]['name']);_0x5e031e[_0x6b61('0x1e')]['channel']=_0x141367[_0x6b61('0x83')];_0x5e031e[_0x6b61('0x1e')][_0x6b61('0x84')]=_0x141367[_0x6b61('0x83')];_0x5e031e['message'][_0x6b61('0x85')]=_0x6b61('0x88');_0x5e031e[_0x6b61('0x1e')]['body']=htmlToText[_0x6b61('0x86')](_0x141367['message']['body']);respondWithRpcPromise('EventManager',_0x6b61('0x87'),{'event':_0x6b61('0x91'),'message':_0x5e031e[_0x6b61('0x1e')]},client9002);return _0x141367;}return null;})[_0x6b61('0x29')](respondWithResult(_0x41599f,null))[_0x6b61('0x1f')](handleError(_0x41599f,null));};exports[_0x6b61('0x92')]=function(_0x460979,_0x11a229){var _0x3ce0b2=moment()[_0x6b61('0x93')]()[_0x6b61('0x94')]();var _0x298381=path[_0x6b61('0x60')](config[_0x6b61('0x61')],'server',_0x6b61('0x95'),'tmp');var _0x39066f=path['join'](config[_0x6b61('0x61')],_0x6b61('0x96'),'files',_0x6b61('0x5e'));var _0x34164f=util[_0x6b61('0x69')](_0x6b61('0x97'),_0x3ce0b2);return db[_0x6b61('0x30')][_0x6b61('0x4d')]({'where':{'id':_0x460979['params']['id']},'attributes':['id',_0x6b61('0x4c'),_0x6b61('0x98'),'to','cc',_0x6b61('0x99'),_0x6b61('0x9a'),_0x6b61('0x9b')],'include':_0x460979['query'][_0x6b61('0x5e')]?[{'model':db[_0x6b61('0x9c')],'as':_0x6b61('0x9d')}]:undefined})['then'](handleEntityNotFound(_0x11a229,null))[_0x6b61('0x29')](function(_0x28a44b){if(_0x28a44b){var _0x2ad1bf=_0x28a44b;var _0x50007c={'from':_0x2ad1bf[_0x6b61('0x98')],'to':_0x2ad1bf['to'],'subject':_0x2ad1bf['subject'],'html':htmlEntities[_0x6b61('0x9e')](_0x2ad1bf[_0x6b61('0x4c')]),'headers':{'Date':moment(_0x2ad1bf[_0x6b61('0x9b')])[_0x6b61('0x69')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x28a44b['cc']){_0x50007c[_0x6b61('0x9f')]['Cc']=_0x28a44b['cc'];}if(_0x28a44b[_0x6b61('0x99')]){_0x50007c['headers']['Bcc']=_0x28a44b[_0x6b61('0x99')];}return new BPromise(function(_0x305be9,_0x557c16){if(_0x28a44b[_0x6b61('0x9d')]){for(var _0x41ccf5=0x0;_0x41ccf5<_0x28a44b[_0x6b61('0x9d')][_0x6b61('0x5f')];_0x41ccf5++){var _0x2c1a87=_0x28a44b['Attachments'][_0x41ccf5];var _0x495ed7=path[_0x6b61('0x60')](_0x39066f,_0x2c1a87[_0x6b61('0x63')]);if(fs['existsSync'](_0x495ed7)){_0x50007c[_0x6b61('0x5e')][_0x6b61('0xa0')]({'name':_0x2c1a87[_0x6b61('0x2c')],'contentType':_0x2c1a87['type'],'data':fs[_0x6b61('0xa1')](_0x495ed7)});}}}emlformat[_0x6b61('0xa2')](_0x50007c,function(_0x377a67,_0x11b79a){if(_0x377a67)return _0x557c16(_0x377a67);fs[_0x6b61('0xa3')](path[_0x6b61('0x60')](_0x298381,_0x34164f),_0x11b79a);return _0x305be9(_0x11b79a);});});}})['then'](function(_0x4eb143){if(_0x4eb143){return _0x11a229[_0x6b61('0x92')](path[_0x6b61('0x60')](_0x298381,_0x34164f),_0x34164f,function(_0x21331b){if(!_0x21331b)fs[_0x6b61('0xa4')](path['join'](_0x298381,_0x34164f));});}})[_0x6b61('0x1f')](handleError(_0x11a229,null));}; \ No newline at end of file +var _0x9209=['socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','undefined','offset','count','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','split','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','Bcc','existsSync','readFileSync','build','download','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost'];(function(_0x5edba0,_0x32a3dc){var _0x30488e=function(_0x169a50){while(--_0x169a50){_0x5edba0['push'](_0x5edba0['shift']());}};_0x30488e(++_0x32a3dc);}(_0x9209,0x1d9));var _0x9920=function(_0x4e3b2a,_0x57f0e0){_0x4e3b2a=_0x4e3b2a-0x0;var _0x28ddd8=_0x9209[_0x4e3b2a];return _0x28ddd8;};'use strict';var emlformat=require(_0x9920('0x0'));var moment=require(_0x9920('0x1'));var BPromise=require(_0x9920('0x2'));var util=require(_0x9920('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x9920('0x4'));var Redis=require(_0x9920('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x9920('0x6'));var logger=require(_0x9920('0x7'))(_0x9920('0x8'));var interaction_log=require(_0x9920('0x7'))('mail-interactions');var config=require(_0x9920('0x9'));var db=require(_0x9920('0xa'))['db'];config['redis']=_['defaults'](config[_0x9920('0xb')],{'host':_0x9920('0xc'),'port':0x18eb});var socket=require(_0x9920('0xd'))(new Redis(config['redis']));var htmlEntities=require(_0x9920('0xe'));require(_0x9920('0xf'))[_0x9920('0x10')](socket);var jayson=require(_0x9920('0x11'));var client=jayson['client'][_0x9920('0x12')]({'port':0x232c});var client9003=jayson[_0x9920('0x13')][_0x9920('0x12')]({'port':0x232b});var client9002=jayson[_0x9920('0x13')][_0x9920('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x32704a,_0x4fc8d8,_0xca10cd,_0x29d648){return new BPromise(function(_0x2b203f,_0x239939){var _0x1d3d06=_0x29d648||client;return _0x1d3d06[_0x9920('0x14')](_0x32704a,_0xca10cd)[_0x9920('0x15')](function(_0xeaaedd){logger[_0x9920('0x16')]('MailMessage,\x20%s,\x20%s',_0x4fc8d8,_0x9920('0x17'));logger[_0x9920('0x18')](_0x9920('0x19'),_0x4fc8d8,_0x9920('0x17'),JSON['stringify'](_0xeaaedd));if(_0xeaaedd[_0x9920('0x1a')]){if(_0xeaaedd[_0x9920('0x1a')]['code']===0x1f4){logger['error'](_0x9920('0x1b'),_0x4fc8d8,_0xeaaedd[_0x9920('0x1a')][_0x9920('0x1c')]);return _0x239939(_0xeaaedd[_0x9920('0x1a')][_0x9920('0x1c')]);}logger[_0x9920('0x1a')]('MailMessage,\x20%s,\x20%s',_0x4fc8d8,_0xeaaedd['error']['message']);return _0x2b203f(_0xeaaedd[_0x9920('0x1a')][_0x9920('0x1c')]);}else{logger[_0x9920('0x16')](_0x9920('0x1b'),_0x4fc8d8,'request\x20sent');_0x2b203f(_0xeaaedd[_0x9920('0x1d')][_0x9920('0x1c')]);}})[_0x9920('0x1e')](function(_0x1e1521){logger[_0x9920('0x1a')](_0x9920('0x1b'),_0x4fc8d8,_0x1e1521);_0x239939(_0x1e1521);});});}function respondWithResult(_0x4340f2,_0x2f9b80){_0x2f9b80=_0x2f9b80||0xc8;return function(_0x6e0838){if(_0x6e0838){return _0x4340f2[_0x9920('0x1f')](_0x2f9b80)[_0x9920('0x20')](_0x6e0838);}};}function respondWithFilteredResult(_0x31e7c3,_0x30c402){return function(_0x41dfb9){if(_0x41dfb9){var _0x358851=typeof _0x30c402['offset']==='undefined'&&typeof _0x30c402['limit']===_0x9920('0x21');var _0x29f202=_0x41dfb9['count'];var _0x33a4ad=_0x358851?0x0:_0x30c402[_0x9920('0x22')];var _0x2949f0=_0x358851?_0x41dfb9[_0x9920('0x23')]:_0x30c402[_0x9920('0x22')]+_0x30c402[_0x9920('0x24')];var _0x4b5487;if(_0x2949f0>=_0x29f202){_0x2949f0=_0x29f202;_0x4b5487=0xc8;}else{_0x4b5487=0xce;}_0x31e7c3[_0x9920('0x1f')](_0x4b5487);return _0x31e7c3[_0x9920('0x25')](_0x9920('0x26'),_0x33a4ad+'-'+_0x2949f0+'/'+_0x29f202)[_0x9920('0x20')](_0x41dfb9);}return null;};}function saveUpdates(_0x51ef99){return function(_0x4848c8){if(_0x4848c8){return _0x4848c8[_0x9920('0x27')](_0x51ef99)[_0x9920('0x15')](function(_0x4103ac){return _0x4103ac;});}return null;};}function removeEntity(_0x66a703){return function(_0x1431c1){if(_0x1431c1){return _0x1431c1[_0x9920('0x28')]()['then'](function(){_0x66a703[_0x9920('0x1f')](0xcc)[_0x9920('0x29')]();});}};}function handleEntityNotFound(_0x239e90){return function(_0x3d8d3f){if(!_0x3d8d3f){_0x239e90[_0x9920('0x2a')](0x194);}return _0x3d8d3f;};}function handleError(_0x32cca3,_0x3b65dd){_0x3b65dd=_0x3b65dd||0x1f4;return function(_0x428959){logger[_0x9920('0x1a')](_0x428959[_0x9920('0x2b')]);if(_0x428959[_0x9920('0x2c')]){delete _0x428959[_0x9920('0x2c')];}_0x32cca3[_0x9920('0x1f')](_0x3b65dd)['send'](_0x428959);};}exports[_0x9920('0x2d')]=function(_0x5a898b,_0xf3d194){var _0xc53400={},_0x3a78c8={},_0x2f7dee={'count':0x0,'rows':[]};var _0x430b2c=_[_0x9920('0x2e')](db[_0x9920('0x2f')][_0x9920('0x30')],function(_0x1a4003){return{'name':_0x1a4003[_0x9920('0x31')],'type':_0x1a4003['type'][_0x9920('0x32')]};});_0x3a78c8['model']=_[_0x9920('0x2e')](_0x430b2c,'name');_0x3a78c8[_0x9920('0x33')]=_[_0x9920('0x34')](_0x5a898b[_0x9920('0x33')]);_0x3a78c8['filters']=_['intersection'](_0x3a78c8[_0x9920('0x35')],_0x3a78c8[_0x9920('0x33')]);_0xc53400[_0x9920('0x36')]=_[_0x9920('0x37')](_0x3a78c8[_0x9920('0x35')],qs[_0x9920('0x38')](_0x5a898b['query'][_0x9920('0x38')]));_0xc53400[_0x9920('0x36')]=_0xc53400[_0x9920('0x36')][_0x9920('0x39')]?_0xc53400[_0x9920('0x36')]:_0x3a78c8[_0x9920('0x35')];if(!_0x5a898b[_0x9920('0x33')][_0x9920('0x3a')](_0x9920('0x3b'))){_0xc53400[_0x9920('0x24')]=qs[_0x9920('0x24')](_0x5a898b[_0x9920('0x33')][_0x9920('0x24')]);_0xc53400['offset']=qs[_0x9920('0x22')](_0x5a898b[_0x9920('0x33')][_0x9920('0x22')]);}_0xc53400[_0x9920('0x3c')]=qs['sort'](_0x5a898b[_0x9920('0x33')][_0x9920('0x3d')]);_0xc53400[_0x9920('0x3e')]=qs[_0x9920('0x3f')](_[_0x9920('0x40')](_0x5a898b[_0x9920('0x33')],_0x3a78c8['filters']),_0x430b2c);if(_0x5a898b[_0x9920('0x33')]['filter']){_0xc53400['where']=_['merge'](_0xc53400[_0x9920('0x3e')],{'$or':_[_0x9920('0x2e')](_0x430b2c,function(_0x286da0){if(_0x286da0[_0x9920('0x41')]!==_0x9920('0x42')){var _0x20df22={};_0x20df22[_0x286da0[_0x9920('0x2c')]]={'$like':'%'+_0x5a898b[_0x9920('0x33')]['filter']+'%'};return _0x20df22;}})});}_0xc53400=_[_0x9920('0x43')]({},_0xc53400,_0x5a898b[_0x9920('0x44')]);var _0x3a8aa4={'where':_0xc53400[_0x9920('0x3e')]};return db[_0x9920('0x2f')]['count'](_0x3a8aa4)[_0x9920('0x15')](function(_0x3124e4){_0x2f7dee[_0x9920('0x23')]=_0x3124e4;if(_0x5a898b[_0x9920('0x33')][_0x9920('0x45')]){_0xc53400[_0x9920('0x46')]=[{'all':!![]}];}return db['MailMessage'][_0x9920('0x47')](_0xc53400);})[_0x9920('0x15')](function(_0x5c2423){_0x2f7dee['rows']=_0x5c2423;return _0x2f7dee;})[_0x9920('0x15')](respondWithFilteredResult(_0xf3d194,_0xc53400))['catch'](handleError(_0xf3d194,null));};exports[_0x9920('0x48')]=function(_0x41543c,_0x381ef1){var _0x21f7e5={'raw':!![],'where':{'id':_0x41543c[_0x9920('0x49')]['id']}},_0x3823e2={};_0x3823e2[_0x9920('0x35')]=_[_0x9920('0x34')](db['MailMessage'][_0x9920('0x30')]);_0x3823e2[_0x9920('0x33')]=_['keys'](_0x41543c[_0x9920('0x33')]);_0x3823e2[_0x9920('0x3f')]=_[_0x9920('0x37')](_0x3823e2[_0x9920('0x35')],_0x3823e2[_0x9920('0x33')]);_0x21f7e5['attributes']=_[_0x9920('0x37')](_0x3823e2[_0x9920('0x35')],qs['fields'](_0x41543c[_0x9920('0x33')]['fields']));_0x21f7e5[_0x9920('0x36')]=_0x21f7e5[_0x9920('0x36')][_0x9920('0x39')]?_0x21f7e5[_0x9920('0x36')]:_0x3823e2['model'];if(_0x41543c[_0x9920('0x33')][_0x9920('0x45')]){_0x21f7e5['include']=[{'all':!![]}];}_0x21f7e5=_[_0x9920('0x43')]({},_0x21f7e5,_0x41543c['options']);return db[_0x9920('0x2f')][_0x9920('0x4a')](_0x21f7e5)[_0x9920('0x15')](handleEntityNotFound(_0x381ef1,null))[_0x9920('0x15')](respondWithResult(_0x381ef1,null))[_0x9920('0x1e')](handleError(_0x381ef1,null));};exports['update']=function(_0x2ccac8,_0x2fe7a0){if(_0x2ccac8[_0x9920('0x4b')]['id']){delete _0x2ccac8['body']['id'];}return db[_0x9920('0x2f')][_0x9920('0x4a')]({'where':{'id':_0x2ccac8[_0x9920('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe7a0,null))[_0x9920('0x15')](saveUpdates(_0x2ccac8[_0x9920('0x4b')],null))[_0x9920('0x15')](respondWithResult(_0x2fe7a0,null))[_0x9920('0x1e')](handleError(_0x2fe7a0,null));};exports['destroy']=function(_0x34853f,_0x4d35e5){return db[_0x9920('0x2f')][_0x9920('0x4a')]({'where':{'id':_0x34853f['params']['id']}})[_0x9920('0x15')](handleEntityNotFound(_0x4d35e5,null))[_0x9920('0x15')](removeEntity(_0x4d35e5,null))[_0x9920('0x1e')](handleError(_0x4d35e5,null));};exports[_0x9920('0x4c')]=function(_0x44d8ec,_0x53f7f9){return db[_0x9920('0x2f')][_0x9920('0x4c')]()['then'](respondWithResult(_0x53f7f9,null))[_0x9920('0x1e')](handleError(_0x53f7f9,null));};exports[_0x9920('0x4d')]=function(_0x2dd6ce,_0x27877b){return db[_0x9920('0x2f')][_0x9920('0x4d')](_0x2dd6ce[_0x9920('0x4b')])[_0x9920('0x15')](function(_0x3526fb){if(_0x3526fb){if(_0x3526fb[_0x9920('0x4e')]===_0x9920('0x4f')&&!_0x3526fb['secret']){var _0x352370,_0x167073,_0x5ab97e;if(_0x2dd6ce[_0x9920('0x4b')]['to']){_0x167073=_0x2dd6ce[_0x9920('0x4b')]['to'][_0x9920('0x50')](',')[0x0];}return db['MailAccount'][_0x9920('0x51')]({'where':{'id':_0x3526fb[_0x9920('0x52')]},'include':[{'model':db[_0x9920('0x53')],'as':'List','include':[{'model':db[_0x9920('0x54')],'as':_0x9920('0x55'),'where':{'email':_0x167073},'limit':0x1,'order':[[_0x9920('0x56'),_0x9920('0x57')]]}]},{'model':db[_0x9920('0x58')],'as':_0x9920('0x59'),'raw':!![],'include':[{'model':db[_0x9920('0x5a')],'as':_0x9920('0x5a'),'raw':!![]}]}]})[_0x9920('0x15')](function(_0x1e6606){_0x352370=_0x1e6606;if(!_0x352370||!_0x352370[_0x9920('0x59')])return;var _0x10bd3d=_0x352370[_0x9920('0x5b')]();if(_0x2dd6ce[_0x9920('0x4b')]['attachments']&&_0x2dd6ce[_0x9920('0x4b')]['attachments'][_0x9920('0x39')]){for(var _0x59af1d=0x0;_0x59af1d<_0x2dd6ce[_0x9920('0x4b')][_0x9920('0x5c')][_0x9920('0x39')];_0x59af1d+=0x1){_0x2dd6ce[_0x9920('0x4b')]['attachments'][_0x59af1d]={'filename':_0x2dd6ce[_0x9920('0x4b')][_0x9920('0x5c')][_0x59af1d][_0x9920('0x2c')],'path':path[_0x9920('0x5d')](config[_0x9920('0x5e')],_0x9920('0x5f'),_0x2dd6ce[_0x9920('0x4b')][_0x9920('0x5c')][_0x59af1d][_0x9920('0x60')])};}}_0x5ab97e={'account':_0x10bd3d,'message':_0x2dd6ce[_0x9920('0x4b')]};return;})[_0x9920('0x15')](function(){if(_0x352370[_0x9920('0x61')]){if(_0x352370['List']['Contacts'][_0x9920('0x39')]){return _0x352370[_0x9920('0x61')][_0x9920('0x55')][0x0];}else{return db['CmContact'][_0x9920('0x4d')](_['defaults'](_0x2dd6ce[_0x9920('0x4b')],{'firstName':_0x2dd6ce[_0x9920('0x4b')]['to'],'email':_0x2dd6ce['body']['to'],'phone':_0x2dd6ce[_0x9920('0x4b')]['to'],'ListId':_0x352370[_0x9920('0x62')]}));}}else{throw new Error(_0x9920('0x63'));}})[_0x9920('0x15')](function(){if(_0x5ab97e){return respondWithRpcPromise(_0x9920('0x64'),_0x9920('0x65'),_0x5ab97e,client9003)[_0x9920('0x15')](function(_0x48f2b8){return _0x3526fb[_0x9920('0x27')]({'read':!![],'messageId':_0x48f2b8[_0x9920('0x66')],'sentAt':moment()[_0x9920('0x67')](_0x9920('0x68'))});})['catch'](function(_0x1d9266){logger[_0x9920('0x1a')]('%s',JSON['stringify'](_0x1d9266));return _0x3526fb;});}return _0x3526fb;});}return _0x3526fb;}})['then'](respondWithResult(_0x27877b,0xc9))[_0x9920('0x1e')](handleError(_0x27877b,null));};exports[_0x9920('0x69')]=function(_0xd0799a,_0x386867){var _0x12dc7f={'agent':{},'channel':_0x9920('0x6a')};if(_0xd0799a[_0x9920('0x4b')]['id']){delete _0xd0799a[_0x9920('0x4b')]['id'];}_0xd0799a[_0x9920('0x4b')][_0x9920('0x6b')]=!![];_0xd0799a[_0x9920('0x4b')][_0x9920('0x6c')]=moment()['format'](_0x9920('0x68'));_0xd0799a[_0x9920('0x4b')][_0x9920('0x6d')]=_0xd0799a['body'][_0x9920('0x6d')]||_0xd0799a[_0x9920('0x6e')]['id'];_0x12dc7f['agent']['id']=_0xd0799a[_0x9920('0x4b')][_0x9920('0x6d')];return db[_0x9920('0x2f')]['find']({'where':{'id':_0xd0799a[_0x9920('0x49')]['id'],'UserId':null}})[_0x9920('0x15')](handleEntityNotFound(_0x386867,null))['then'](saveUpdates(_0xd0799a[_0x9920('0x4b')],null))[_0x9920('0x15')](function(_0x8f46b3){if(_0x8f46b3){_0x12dc7f['message']=_0x8f46b3[_0x9920('0x6f')]({'plain':!![]});return db[_0x9920('0x70')][_0x9920('0x4a')]({'where':{'id':_0x8f46b3[_0x9920('0x71')]}});}return null;})[_0x9920('0x15')](handleEntityNotFound(_0x386867,null))[_0x9920('0x15')](function(_0x5ddfc3){if(_0x5ddfc3){return _0x5ddfc3['update']({'UserId':_0xd0799a[_0x9920('0x4b')]['UserId'],'read1stAt':_[_0x9920('0x72')](_0x5ddfc3[_0x9920('0x73')])?moment()[_0x9920('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9920('0x15')](function(_0x5dda38){if(_0x5dda38){_0x12dc7f['interaction']=_0x5dda38[_0x9920('0x6f')]({'plain':!![]});interaction_log[_0x9920('0x16')](_0x9920('0x74'),_0xd0799a[_0x9920('0x6e')]['id'],_0xd0799a[_0x9920('0x6e')][_0x9920('0x2c')],_0xd0799a[_0x9920('0x6e')][_0x9920('0x75')],_0x12dc7f[_0x9920('0x76')]['id'],_0xd0799a[_0x9920('0x4b')]?JSON[_0x9920('0x77')](_0xd0799a['body']):_0x9920('0x78'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x12dc7f);}return null;})[_0x9920('0x15')](function(_0x5294ad){var _0x3967ed=_0x9920('0x79')+_0x5294ad[_0x9920('0x1c')]['ContactId'];return db[_0x9920('0x7a')][_0x9920('0x33')](_0x3967ed,{'type':db['Sequelize'][_0x9920('0x7b')]['SELECT'],'raw':!![]})[_0x9920('0x15')](function(_0x3540ac){return _0x3540ac;});})['then'](function(_0x2ea59b){if(_0x2ea59b){_0x12dc7f[_0x9920('0x1c')][_0x9920('0x7c')]=_0x2ea59b[0x0];if(!_0xd0799a[_0x9920('0x4b')][_0x9920('0x6d')])return;return db[_0x9920('0x7d')][_0x9920('0x4a')]({'where':{'id':_0xd0799a[_0x9920('0x4b')][_0x9920('0x6d')],'role':_0x9920('0x7e')},'attributes':['id',_0x9920('0x2c'),'fullname',_0x9920('0x7f'),_0x9920('0x80')],'raw':!![]});}return null;})[_0x9920('0x15')](function(_0x1a6306){if(!_0x1a6306)return null;_0x12dc7f[_0x9920('0x1c')]['agent']=_0x1a6306;return _0x12dc7f;})['then'](function(_0x10b11e){if(_0x10b11e){if(_0xd0799a[_0x9920('0x4b')][_0x9920('0x81')]){_0x12dc7f[_0x9920('0x1c')][_0x9920('0x82')]=util[_0x9920('0x67')](_0x9920('0x83'),_0xd0799a[_0x9920('0x6e')][_0x9920('0x2c')]);_0x12dc7f[_0x9920('0x1c')]['channel']=_0x12dc7f[_0x9920('0x84')];_0x12dc7f[_0x9920('0x1c')][_0x9920('0x85')]=_0x12dc7f['channel'];_0x12dc7f['message'][_0x9920('0x86')]=_0x9920('0x69');_0x12dc7f[_0x9920('0x1c')][_0x9920('0x4b')]=htmlToText[_0x9920('0x87')](_0x12dc7f[_0x9920('0x1c')][_0x9920('0x4b')]);return respondWithRpcPromise(_0x9920('0x88'),_0x9920('0x88'),{'event':_0x9920('0x89'),'message':_0x12dc7f[_0x9920('0x1c')]},client9002)['then'](function(){return _0x12dc7f;});}return _0x12dc7f;}return null;})[_0x9920('0x15')](respondWithResult(_0x386867,null))[_0x9920('0x1e')](handleError(_0x386867,null));};exports[_0x9920('0x8a')]=function(_0x2041a3,_0x15f411){var _0x300436={'agent':{},'channel':_0x9920('0x6a')};if(_0x2041a3[_0x9920('0x4b')]['id']){delete _0x2041a3[_0x9920('0x4b')]['id'];}_0x2041a3[_0x9920('0x4b')][_0x9920('0x6d')]=_0x2041a3[_0x9920('0x4b')][_0x9920('0x6d')]||_0x2041a3[_0x9920('0x6e')]['id'];_0x300436['agent']['id']=_0x2041a3[_0x9920('0x4b')][_0x9920('0x6d')];return db[_0x9920('0x2f')][_0x9920('0x4a')]({'where':{'id':_0x2041a3[_0x9920('0x49')]['id'],'UserId':null}})[_0x9920('0x15')](handleEntityNotFound(_0x15f411,null))[_0x9920('0x15')](function(_0x2fc16d){if(_0x2fc16d){_0x300436[_0x9920('0x1c')]=_0x2fc16d[_0x9920('0x6f')]({'plain':!![]});return db[_0x9920('0x70')][_0x9920('0x4a')]({'where':{'id':_0x2fc16d[_0x9920('0x71')]}});}return null;})[_0x9920('0x15')](handleEntityNotFound(_0x15f411,null))[_0x9920('0x15')](function(_0x42a2a4){if(_0x42a2a4){_0x300436['interaction']=_0x42a2a4[_0x9920('0x6f')]({'plain':!![]});interaction_log[_0x9920('0x16')](_0x9920('0x8b'),_0x2041a3[_0x9920('0x6e')]['id'],_0x2041a3[_0x9920('0x6e')][_0x9920('0x2c')],_0x2041a3[_0x9920('0x6e')][_0x9920('0x75')],_0x300436[_0x9920('0x76')]['id'],_0x2041a3[_0x9920('0x4b')]?JSON['stringify'](_0x2041a3[_0x9920('0x4b')]):_0x9920('0x78'));return respondWithRpcPromise(_0x9920('0x8c'),'rejectMessage',_0x300436);}return null;})['then'](function(_0x293e93){var _0x5947f5=_0x9920('0x79')+_0x293e93[_0x9920('0x1c')]['ContactId'];return db[_0x9920('0x7a')]['query'](_0x5947f5,{'type':db['Sequelize'][_0x9920('0x7b')][_0x9920('0x8d')],'raw':!![]})[_0x9920('0x15')](function(_0x4feccf){return _0x4feccf;});})['then'](function(_0x20cf9b){if(_0x20cf9b){_0x300436['message']['contact']=_0x20cf9b[0x0];if(!_0x2041a3[_0x9920('0x4b')][_0x9920('0x6d')])return;return db[_0x9920('0x7d')][_0x9920('0x4a')]({'where':{'id':_0x2041a3['body'][_0x9920('0x6d')],'role':'agent'},'attributes':['id',_0x9920('0x2c'),'fullname',_0x9920('0x7f'),_0x9920('0x80')],'raw':!![]});}return null;})[_0x9920('0x15')](function(_0x2c96c){if(!_0x2c96c)return null;_0x300436[_0x9920('0x1c')]['agent']=_0x2c96c;return _0x300436;})['then'](function(_0x4b76b3){if(_0x4b76b3){_0x4b76b3[_0x9920('0x1c')][_0x9920('0x82')]=util[_0x9920('0x67')](_0x9920('0x83'),_0x2041a3['user']['name']);_0x4b76b3[_0x9920('0x1c')]['channel']=_0x300436['channel'];_0x4b76b3[_0x9920('0x1c')]['motionChannel']=_0x300436[_0x9920('0x84')];_0x4b76b3[_0x9920('0x1c')][_0x9920('0x86')]=_0x9920('0x8a');_0x4b76b3['message'][_0x9920('0x4b')]=htmlToText[_0x9920('0x87')](_0x300436['message'][_0x9920('0x4b')]);respondWithRpcPromise(_0x9920('0x88'),'EventManager',{'event':_0x9920('0x8e'),'message':_0x4b76b3['message']},client9002);return _0x300436;}return null;})['then'](respondWithResult(_0x15f411,null))[_0x9920('0x1e')](handleError(_0x15f411,null));};exports['download']=function(_0x15823f,_0x56b415){var _0x2566ec=moment()[_0x9920('0x8f')]()[_0x9920('0x90')]();var _0x5930e8=path[_0x9920('0x5d')](config[_0x9920('0x5e')],_0x9920('0x91'),_0x9920('0x92'),_0x9920('0x93'));var _0x3ae973=path[_0x9920('0x5d')](config['root'],_0x9920('0x91'),_0x9920('0x92'),_0x9920('0x5c'));var _0x5cb259=util[_0x9920('0x67')](_0x9920('0x94'),_0x2566ec);return db[_0x9920('0x2f')][_0x9920('0x4a')]({'where':{'id':_0x15823f[_0x9920('0x49')]['id']},'attributes':['id',_0x9920('0x4b'),_0x9920('0x95'),'to','cc',_0x9920('0x96'),'subject',_0x9920('0x97')],'include':_0x15823f[_0x9920('0x33')]['attachments']?[{'model':db[_0x9920('0x98')],'as':_0x9920('0x99')}]:undefined})[_0x9920('0x15')](handleEntityNotFound(_0x56b415,null))[_0x9920('0x15')](function(_0x393263){if(_0x393263){var _0x53f591=_0x393263;var _0x4fe647={'from':_0x53f591['from'],'to':_0x53f591['to'],'subject':_0x53f591[_0x9920('0x9a')],'html':htmlEntities[_0x9920('0x9b')](_0x53f591[_0x9920('0x4b')]),'headers':{'Date':moment(_0x53f591['createdAt'])[_0x9920('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x393263['cc']){_0x4fe647['headers']['Cc']=_0x393263['cc'];}if(_0x393263[_0x9920('0x96')]){_0x4fe647['headers'][_0x9920('0x9c')]=_0x393263[_0x9920('0x96')];}return new BPromise(function(_0xd52a6e,_0x2a4c39){if(_0x393263[_0x9920('0x99')]){for(var _0x48246d=0x0;_0x48246d<_0x393263[_0x9920('0x99')]['length'];_0x48246d++){var _0x497339=_0x393263[_0x9920('0x99')][_0x48246d];var _0x247df0=path[_0x9920('0x5d')](_0x3ae973,_0x497339[_0x9920('0x60')]);if(fs[_0x9920('0x9d')](_0x247df0)){_0x4fe647[_0x9920('0x5c')]['push']({'name':_0x497339['name'],'contentType':_0x497339[_0x9920('0x41')],'data':fs[_0x9920('0x9e')](_0x247df0)});}}}emlformat[_0x9920('0x9f')](_0x4fe647,function(_0x3e1325,_0x22cff3){if(_0x3e1325)return _0x2a4c39(_0x3e1325);fs['writeFileSync'](path[_0x9920('0x5d')](_0x5930e8,_0x5cb259),_0x22cff3);return _0xd52a6e(_0x22cff3);});});}})[_0x9920('0x15')](function(_0x18d2e2){if(_0x18d2e2){return _0x56b415[_0x9920('0xa0')](path[_0x9920('0x5d')](_0x5930e8,_0x5cb259),_0x5cb259,function(_0x149738){if(!_0x149738)fs[_0x9920('0xa1')](path[_0x9920('0x5d')](_0x5930e8,_0x5cb259));});}})[_0x9920('0x1e')](handleError(_0x56b415,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5f0bfd7..ad25815 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 _0xc8cb=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x5161cb,_0x3e6165){var _0x1bf739=function(_0x2a7daf){while(--_0x2a7daf){_0x5161cb['push'](_0x5161cb['shift']());}};_0x1bf739(++_0x3e6165);}(_0xc8cb,0x181));var _0xbc8c=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xc8cb[_0x4bfac3];return _0x15f0f2;};'use strict';var EventEmitter=require(_0xbc8c('0x0'));var MailMessage=require(_0xbc8c('0x1'))['db'][_0xbc8c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbc8c('0x3')](0x0);var events={'afterCreate':_0xbc8c('0x4'),'afterUpdate':_0xbc8c('0x5'),'afterDestroy':_0xbc8c('0x6')};function emitEvent(_0x5ae2a2){return function(_0x1d99bc,_0x3c5155,_0x57f0b9){MailMessageEvents[_0xbc8c('0x7')](_0x5ae2a2+':'+_0x1d99bc['id'],_0x1d99bc);MailMessageEvents['emit'](_0x5ae2a2,_0x1d99bc);_0x57f0b9(null);};}for(var e in events){if(events[_0xbc8c('0x8')](e)){var event=events[e];MailMessage[_0xbc8c('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x11af=['MailMessage','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x28dec5,_0x56c06c){var _0x215ffe=function(_0x194e58){while(--_0x194e58){_0x28dec5['push'](_0x28dec5['shift']());}};_0x215ffe(++_0x56c06c);}(_0x11af,0xf6));var _0xf11a=function(_0x4481ec,_0x112c44){_0x4481ec=_0x4481ec-0x0;var _0x247cdc=_0x11af[_0x4481ec];return _0x247cdc;};'use strict';var EventEmitter=require(_0xf11a('0x0'));var MailMessage=require(_0xf11a('0x1'))['db'][_0xf11a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf11a('0x3'),'afterUpdate':'update','afterDestroy':_0xf11a('0x4')};function emitEvent(_0x15a95a){return function(_0x36d27a,_0x124c42,_0x58ed95){MailMessageEvents[_0xf11a('0x5')](_0x15a95a+':'+_0x36d27a['id'],_0x36d27a);MailMessageEvents[_0xf11a('0x5')](_0x15a95a,_0x36d27a);_0x58ed95(null);};}for(var e in events){if(events[_0xf11a('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xf11a('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1924a6c..7a55cd7 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 _0x06a2=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then'];(function(_0x319045,_0x22be2a){var _0x11694a=function(_0x5e2e88){while(--_0x5e2e88){_0x319045['push'](_0x319045['shift']());}};_0x11694a(++_0x22be2a);}(_0x06a2,0x1a8));var _0x206a=function(_0x552fcb,_0x533085){_0x552fcb=_0x552fcb-0x0;var _0x5d6231=_0x06a2[_0x552fcb];return _0x5d6231;};'use strict';var _=require(_0x206a('0x0'));var util=require(_0x206a('0x1'));var logger=require(_0x206a('0x2'))(_0x206a('0x3'));var moment=require(_0x206a('0x4'));var BPromise=require('bluebird');var rp=require(_0x206a('0x5'));var htmlToText=require(_0x206a('0x6'));var fs=require('fs');var path=require(_0x206a('0x7'));var rimraf=require(_0x206a('0x8'));var config=require(_0x206a('0x9'));var attributes=require(_0x206a('0xa'));module[_0x206a('0xb')]=function(_0x52c7ab,_0x2c7ed5){return _0x52c7ab[_0x206a('0xc')](_0x206a('0xd'),attributes,{'tableName':_0x206a('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x206a('0xf')]},{'name':_0x206a('0x10'),'fields':[_0x206a('0x11'),'subject'],'type':_0x206a('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3536a3,_0x42ce95,_0x2095a0){if(_0x3536a3[_0x206a('0x13')]){_0x3536a3[_0x206a('0x11')]=htmlToText[_0x206a('0x14')](_0x3536a3[_0x206a('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2095a0(null,_0x42ce95);},'afterCreate':function(_0xd45e0e,_0x1b3631,_0x4fc93e){var _0x13da26=_0x52c7ab[_0x206a('0x15')];var _0x1c5756=_0xd45e0e[_0x206a('0x16')]({'plain':!![]});if(_0x1c5756['direction'][_0x206a('0x17')]()==='in'||_0x1c5756[_0x206a('0x18')][_0x206a('0x17')]()===_0x206a('0x19')&&!_0x1c5756[_0x206a('0x1a')]&&!_['isNil'](_0x1c5756[_0x206a('0x1b')])){_0x13da26[_0x206a('0x1c')][_0x206a('0x1d')]({'where':{'id':_0x1c5756[_0x206a('0x1e')]}})[_0x206a('0x1f')](function(_0x49849f){if(_0x49849f){_0x49849f[_0x206a('0x20')]({'lastMsgAt':_0x1c5756[_0x206a('0x21')],'lastMsgDirection':_0x1c5756[_0x206a('0x18')][_0x206a('0x17')]()});}})[_0x206a('0x22')](function(_0x5321fb){console[_0x206a('0x23')](_0x5321fb);});}_0x4fc93e();}},'charset':_0x206a('0x24'),'collate':_0x206a('0x25')});}; \ No newline at end of file +var _0x8a8b=['bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2e6db4,_0x38cfcd){var _0x34c767=function(_0x5e1998){while(--_0x5e1998){_0x2e6db4['push'](_0x2e6db4['shift']());}};_0x34c767(++_0x38cfcd);}(_0x8a8b,0x93));var _0xb8a8=function(_0x5ea6eb,_0x2bed7b){_0x5ea6eb=_0x5ea6eb-0x0;var _0x3a0c97=_0x8a8b[_0x5ea6eb];return _0x3a0c97;};'use strict';var _=require(_0xb8a8('0x0'));var util=require(_0xb8a8('0x1'));var logger=require(_0xb8a8('0x2'))(_0xb8a8('0x3'));var moment=require(_0xb8a8('0x4'));var BPromise=require(_0xb8a8('0x5'));var rp=require('request-promise');var htmlToText=require(_0xb8a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8a8('0x7'));var config=require(_0xb8a8('0x8'));var attributes=require(_0xb8a8('0x9'));module[_0xb8a8('0xa')]=function(_0x20fbaa,_0x58ed6a){return _0x20fbaa[_0xb8a8('0xb')](_0xb8a8('0xc'),attributes,{'tableName':_0xb8a8('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xb8a8('0xe')]},{'name':'fti_mail_messages','fields':[_0xb8a8('0xf'),_0xb8a8('0x10')],'type':_0xb8a8('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a59e3,_0x462706,_0x2a9824){if(_0x5a59e3[_0xb8a8('0x12')]){_0x5a59e3['plainBody']=htmlToText[_0xb8a8('0x13')](_0x5a59e3[_0xb8a8('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2a9824(null,_0x462706);},'afterCreate':function(_0x54fcd0,_0xce3491,_0x40d760){var _0x754f78=_0x20fbaa[_0xb8a8('0x14')];var _0x528183=_0x54fcd0[_0xb8a8('0x15')]({'plain':!![]});if(_0x528183[_0xb8a8('0x16')][_0xb8a8('0x17')]()==='in'||_0x528183['direction'][_0xb8a8('0x17')]()===_0xb8a8('0x18')&&!_0x528183[_0xb8a8('0x19')]&&!_[_0xb8a8('0x1a')](_0x528183[_0xb8a8('0x1b')])){_0x754f78[_0xb8a8('0x1c')][_0xb8a8('0x1d')]({'where':{'id':_0x528183[_0xb8a8('0x1e')]}})[_0xb8a8('0x1f')](function(_0x42a95b){if(_0x42a95b){_0x42a95b[_0xb8a8('0x20')]({'lastMsgAt':_0x528183[_0xb8a8('0x21')],'lastMsgDirection':_0x528183[_0xb8a8('0x16')][_0xb8a8('0x17')]()});}})[_0xb8a8('0x22')](function(_0x44e63b){console[_0xb8a8('0x23')](_0x44e63b);});}_0x40d760();}},'charset':_0xb8a8('0x24'),'collate':_0xb8a8('0x25')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d8e8599..ddda418 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 _0x8aad=['raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','localhost','socket.io-emitter','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x2ac3ef,_0x4d48e4){var _0x514ceb=function(_0x235214){while(--_0x235214){_0x2ac3ef['push'](_0x2ac3ef['shift']());}};_0x514ceb(++_0x4d48e4);}(_0x8aad,0x146));var _0xd8aa=function(_0x38f129,_0x580e67){_0x38f129=_0x38f129-0x0;var _0x442743=_0x8aad[_0x38f129];return _0x442743;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});config[_0xd8aa('0x8')]=_['defaults'](config[_0xd8aa('0x8')],{'host':_0xd8aa('0x9'),'port':0x18eb});var socket=require(_0xd8aa('0xa'))(new Redis(config[_0xd8aa('0x8')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x24f3f1,_0x1d4cf6,_0x152c0a){return new BPromise(function(_0x228fda,_0x2c7edb){return client['request'](_0x24f3f1,_0x152c0a)[_0xd8aa('0xb')](function(_0x1619c6){logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));logger[_0xd8aa('0xf')](_0xd8aa('0x10'),_0x1d4cf6,_0xd8aa('0xe'),JSON[_0xd8aa('0x11')](_0x1619c6));if(_0x1619c6[_0xd8aa('0x12')]){if(_0x1619c6['error']['code']===0x1f4){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6[_0xd8aa('0x12')]['message']);return _0x2c7edb(_0x1619c6[_0xd8aa('0x12')][_0xd8aa('0x13')]);}logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6['error'][_0xd8aa('0x13')]);return _0x228fda(_0x1619c6[_0xd8aa('0x12')]['message']);}else{logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));_0x228fda(_0x1619c6[_0xd8aa('0x14')][_0xd8aa('0x13')]);}})['catch'](function(_0x43d3fa){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x43d3fa);_0x2c7edb(_0x43d3fa);});});}exports[_0xd8aa('0x15')]=function(_0x56936b){var _0x411b12=this;return new Promise(function(_0x3df281,_0x46d69b){return db[_0xd8aa('0x16')][_0xd8aa('0x17')](_0x56936b['body'],{'raw':_0x56936b[_0xd8aa('0x18')]?_0x56936b[_0xd8aa('0x18')][_0xd8aa('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xa7cf85){logger[_0xd8aa('0xc')](_0xd8aa('0x15'),_0x56936b);logger[_0xd8aa('0xf')](_0xd8aa('0x15'),_0x56936b,JSON[_0xd8aa('0x11')](_0xa7cf85));_0x3df281(_0xa7cf85);})[_0xd8aa('0x1a')](function(_0x34d957){logger[_0xd8aa('0x12')](_0xd8aa('0x15'),_0x34d957[_0xd8aa('0x13')],_0x56936b);_0x46d69b(_0x411b12[_0xd8aa('0x12')](0x1f4,_0x34d957[_0xd8aa('0x13')]));});});}; \ No newline at end of file +var _0x14a0=['code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x425146,_0x5011db){var _0x38bd61=function(_0x3c1c71){while(--_0x3c1c71){_0x425146['push'](_0x425146['shift']());}};_0x38bd61(++_0x5011db);}(_0x14a0,0x8e));var _0x014a=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x14a0[_0x12ca7a];return _0x2249df;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x014a('0xa')](config[_0x014a('0xb')],{'host':_0x014a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x014a('0xd'))['register'](socket);function respondWithRpcPromise(_0x490ea2,_0x5aa52f,_0x4f3539){return new BPromise(function(_0x330469,_0x4c7418){return client[_0x014a('0xe')](_0x490ea2,_0x4f3539)[_0x014a('0xf')](function(_0x543bbf){logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));logger[_0x014a('0x13')](_0x014a('0x14'),_0x5aa52f,_0x014a('0x12'),JSON[_0x014a('0x15')](_0x543bbf));if(_0x543bbf[_0x014a('0x16')]){if(_0x543bbf[_0x014a('0x16')][_0x014a('0x17')]===0x1f4){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x4c7418(_0x543bbf[_0x014a('0x16')]['message']);}logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x330469(_0x543bbf[_0x014a('0x16')][_0x014a('0x18')]);}else{logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));_0x330469(_0x543bbf[_0x014a('0x19')][_0x014a('0x18')]);}})[_0x014a('0x1a')](function(_0x3b9341){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x3b9341);_0x4c7418(_0x3b9341);});});}exports[_0x014a('0x1b')]=function(_0x34e5c3){var _0x5c69c5=this;return new Promise(function(_0x359903,_0x109a9c){return db[_0x014a('0x1c')][_0x014a('0x1d')](_0x34e5c3[_0x014a('0x1e')],{'raw':_0x34e5c3[_0x014a('0x1f')]?_0x34e5c3[_0x014a('0x1f')][_0x014a('0x20')]===undefined?!![]:![]:!![]})[_0x014a('0xf')](function(_0x486e66){logger[_0x014a('0x10')]('CreateMailMessage',_0x34e5c3);logger[_0x014a('0x13')](_0x014a('0x1b'),_0x34e5c3,JSON[_0x014a('0x15')](_0x486e66));_0x359903(_0x486e66);})[_0x014a('0x1a')](function(_0x2b3c10){logger[_0x014a('0x16')](_0x014a('0x1b'),_0x2b3c10[_0x014a('0x18')],_0x34e5c3);_0x109a9c(_0x5c69c5[_0x014a('0x16')](0x1f4,_0x2b3c10['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1675f4f..379d872 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 _0x8f94=['remove','update','emit','register','mailMessage:','./mailMessage.events','save'];(function(_0x1a3442,_0x368fc1){var _0x34d08c=function(_0x2fdc44){while(--_0x2fdc44){_0x1a3442['push'](_0x1a3442['shift']());}};_0x34d08c(++_0x368fc1);}(_0x8f94,0xd7));var _0x48f9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x8f94[_0x2f5ac5];return _0x37c9a8;};'use strict';var MailMessageEvents=require(_0x48f9('0x0'));var events=[_0x48f9('0x1'),_0x48f9('0x2'),_0x48f9('0x3')];function createListener(_0x3917f4,_0x596ddb){return function(_0x15c6be){_0x596ddb[_0x48f9('0x4')](_0x3917f4,_0x15c6be);};}function removeListener(_0x4ada9c,_0x18d217){return function(){MailMessageEvents['removeListener'](_0x4ada9c,_0x18d217);};}exports[_0x48f9('0x5')]=function(_0x5d427f){for(var _0x38c652=0x0,_0x45cdf7=events['length'];_0x38c652<_0x45cdf7;_0x38c652++){var _0x2fe384=events[_0x38c652];var _0x28704d=createListener(_0x48f9('0x6')+_0x2fe384,_0x5d427f);MailMessageEvents['on'](_0x2fe384,_0x28704d);}}; \ No newline at end of file +var _0xa351=['removeListener','mailMessage:','remove','update','emit'];(function(_0x5b4da6,_0x4ee260){var _0x12f7c0=function(_0x53986a){while(--_0x53986a){_0x5b4da6['push'](_0x5b4da6['shift']());}};_0x12f7c0(++_0x4ee260);}(_0xa351,0xac));var _0x1a35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa351[_0x4565bf];return _0x5610ba;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x1a35('0x0'),_0x1a35('0x1')];function createListener(_0x385859,_0xfc4ced){return function(_0xf41c19){_0xfc4ced[_0x1a35('0x2')](_0x385859,_0xf41c19);};}function removeListener(_0x24a4c5,_0x265b96){return function(){MailMessageEvents[_0x1a35('0x3')](_0x24a4c5,_0x265b96);};}exports['register']=function(_0x444876){for(var _0x42633d=0x0,_0x197359=events['length'];_0x42633d<_0x197359;_0x42633d++){var _0x25cdab=events[_0x42633d];var _0x46ca8a=createListener(_0x1a35('0x4')+_0x25cdab,_0x444876);MailMessageEvents['on'](_0x25cdab,_0x46ca8a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0b04419..4f9030c 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 _0x160f=['/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe'];(function(_0x1bb34f,_0x5f531f){var _0x36a21f=function(_0x2cd2a0){while(--_0x2cd2a0){_0x1bb34f['push'](_0x1bb34f['shift']());}};_0x36a21f(++_0x5f531f);}(_0x160f,0xb9));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf160('0x0'));var path=require('path');var timeout=require(_0xf160('0x1'));var express=require('express');var router=express[_0xf160('0x2')]();var fs_extra=require(_0xf160('0x3'));var auth=require(_0xf160('0x4'));var interaction=require(_0xf160('0x5'));var config=require(_0xf160('0x6'));var controller=require('./mailQueue.controller');router[_0xf160('0x7')]('/',auth['isAuthenticated'](),controller[_0xf160('0x8')]);router[_0xf160('0x7')]('/describe',auth[_0xf160('0x9')](),controller[_0xf160('0xa')]);router[_0xf160('0x7')](_0xf160('0xb'),auth[_0xf160('0x9')](),controller['show']);router[_0xf160('0x7')](_0xf160('0xc'),auth[_0xf160('0x9')](),controller[_0xf160('0xd')]);router['get'](_0xf160('0xe'),auth[_0xf160('0x9')](),controller[_0xf160('0xf')]);router[_0xf160('0x7')](_0xf160('0x10'),auth[_0xf160('0x9')](),controller[_0xf160('0x11')]);router[_0xf160('0x12')]('/',auth[_0xf160('0x9')](),controller[_0xf160('0x13')]);router[_0xf160('0x12')]('/:id/teams',auth[_0xf160('0x9')](),controller['addTeams']);router['post'](_0xf160('0x10'),auth[_0xf160('0x9')](),controller[_0xf160('0x14')]);router[_0xf160('0x15')]('/:id',auth[_0xf160('0x9')](),controller[_0xf160('0x16')]);router['delete']('/:id',auth[_0xf160('0x9')](),controller[_0xf160('0x17')]);router[_0xf160('0x18')](_0xf160('0xe'),auth[_0xf160('0x9')](),controller[_0xf160('0x19')]);router[_0xf160('0x18')](_0xf160('0x10'),auth['isAuthenticated'](),controller[_0xf160('0x1a')]);module[_0xf160('0x1b')]=router; \ No newline at end of file +var _0x7960=['fs-extra','../../components/auth/service','./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/teams','getTeams','post','addTeams','/:id/users','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7960,0xa3));var _0x0796=function(_0x471ad4,_0x2521ac){_0x471ad4=_0x471ad4-0x0;var _0x836460=_0x7960[_0x471ad4];return _0x836460;};'use strict';var multer=require(_0x0796('0x0'));var util=require(_0x0796('0x1'));var path=require('path');var timeout=require(_0x0796('0x2'));var express=require(_0x0796('0x3'));var router=express[_0x0796('0x4')]();var fs_extra=require(_0x0796('0x5'));var auth=require(_0x0796('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0796('0x7'));router[_0x0796('0x8')]('/',auth['isAuthenticated'](),controller[_0x0796('0x9')]);router[_0x0796('0x8')](_0x0796('0xa'),auth[_0x0796('0xb')](),controller['describe']);router['get'](_0x0796('0xc'),auth[_0x0796('0xb')](),controller['show']);router[_0x0796('0x8')]('/:id/members',auth[_0x0796('0xb')](),controller['getMembers']);router['get'](_0x0796('0xd'),auth[_0x0796('0xb')](),controller[_0x0796('0xe')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x0796('0xb')](),controller['create']);router[_0x0796('0xf')]('/:id/teams',auth[_0x0796('0xb')](),controller[_0x0796('0x10')]);router[_0x0796('0xf')](_0x0796('0x11'),auth[_0x0796('0xb')](),controller['addAgents']);router[_0x0796('0x12')](_0x0796('0xc'),auth[_0x0796('0xb')](),controller[_0x0796('0x13')]);router[_0x0796('0x14')]('/:id',auth[_0x0796('0xb')](),controller['destroy']);router[_0x0796('0x14')](_0x0796('0xd'),auth[_0x0796('0xb')](),controller[_0x0796('0x15')]);router[_0x0796('0x14')]('/:id/users',auth[_0x0796('0xb')](),controller[_0x0796('0x16')]);module[_0x0796('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 95cadb3..9f49d12 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 _0xedf8=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0xedf8,0x6a));var _0x8edf=function(_0x1938c4,_0x2c599a){_0x1938c4=_0x1938c4-0x0;var _0x5492e1=_0xedf8[_0x1938c4];return _0x5492e1;};'use strict';var Sequelize=require(_0x8edf('0x0'));module[_0x8edf('0x1')]={'name':{'type':Sequelize[_0x8edf('0x2')],'unique':_0x8edf('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8edf('0x2')]},'timeout':{'type':Sequelize[_0x8edf('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8edf('0x5')](_0x8edf('0x6'),_0x8edf('0x7'),_0x8edf('0x8'))}}; \ No newline at end of file +var _0x79d0=['ENUM','rrmemory','exports','STRING','name','INTEGER'];(function(_0x5cfd14,_0x59cca0){var _0x1ff95b=function(_0xa1e8c9){while(--_0xa1e8c9){_0x5cfd14['push'](_0x5cfd14['shift']());}};_0x1ff95b(++_0x59cca0);}(_0x79d0,0x170));var _0x079d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x79d0[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x079d('0x0')]={'name':{'type':Sequelize[_0x079d('0x1')],'unique':_0x079d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x079d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x079d('0x4')](_0x079d('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5c633be..ddff3fd 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 _0x313a=['fieldName','type','include','query','findAll','rows','catch','show','params','model','keys','attributes','intersection','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','getMembers','findOne','filters','hasOwnProperty','limit','order','sort','where','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','length','pick','filter','nolimit','ids','Agents','online','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','userMailQueue:remove','addAgents','spread','userMailQueue:save','removeAgents','isArray','getAgents','util','lodash','squel','ioredis','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','json','offset','undefined','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','status','end','error','stack','name','send','index','map','MailQueue','rawAttributes'];(function(_0x482fcc,_0x448923){var _0x16ab21=function(_0x468a99){while(--_0x468a99){_0x482fcc['push'](_0x482fcc['shift']());}};_0x16ab21(++_0x448923);}(_0x313a,0x14c));var _0xa313=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0x313a[_0x37862a];return _0x5b0104;};'use strict';var BPromise=require('bluebird');var util=require(_0xa313('0x0'));var _=require(_0xa313('0x1'));var squel=require(_0xa313('0x2'));var Redis=require(_0xa313('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa313('0x4'));var config=require('../../config/environment');var db=require(_0xa313('0x5'))['db'];config['redis']=_[_0xa313('0x6')](config[_0xa313('0x7')],{'host':_0xa313('0x8'),'port':0x18eb});var socket=require(_0xa313('0x9'))(new Redis(config[_0xa313('0x7')]));require('./mailQueue.socket')[_0xa313('0xa')](socket);function respondWithStatusCode(_0x4ee212,_0x29fa83){_0x29fa83=_0x29fa83||0xcc;return function(_0x210295){if(_0x210295){return _0x4ee212[_0xa313('0xb')](_0x29fa83);}return _0x4ee212['status'](_0x29fa83)['end']();};}function respondWithResult(_0x5c04a8,_0xe75fa5){_0xe75fa5=_0xe75fa5||0xc8;return function(_0x4a3a48){if(_0x4a3a48){return _0x5c04a8['status'](_0xe75fa5)[_0xa313('0xc')](_0x4a3a48);}};}function respondWithFilteredResult(_0x4a53ac,_0xeac3f5){return function(_0x400fb8){if(_0x400fb8){var _0xedf428=typeof _0xeac3f5[_0xa313('0xd')]===_0xa313('0xe')&&typeof _0xeac3f5['limit']===_0xa313('0xe');var _0x2792d0=_0x400fb8[_0xa313('0xf')];var _0x784dc1=_0xedf428?0x0:_0xeac3f5['offset'];var _0x5831a7=_0xedf428?_0x400fb8[_0xa313('0xf')]:_0xeac3f5['offset']+_0xeac3f5['limit'];var _0x1167f1;if(_0x5831a7>=_0x2792d0){_0x5831a7=_0x2792d0;_0x1167f1=0xc8;}else{_0x1167f1=0xce;}_0x4a53ac['status'](_0x1167f1);return _0x4a53ac[_0xa313('0x10')](_0xa313('0x11'),_0x784dc1+'-'+_0x5831a7+'/'+_0x2792d0)['json'](_0x400fb8);}return null;};}function saveUpdates(_0x4e742a){return function(_0x389297){if(_0x389297){return _0x389297[_0xa313('0x12')](_0x4e742a)[_0xa313('0x13')](function(_0x2881bb){return _0x2881bb;});}return null;};}function removeEntity(_0x3f015f){return function(_0x2a8678){if(_0x2a8678){return _0x2a8678['destroy']()[_0xa313('0x13')](function(){var _0x283d5f=_0x2a8678[_0xa313('0x14')]({'plain':!![]});var _0x1dd349=_0xa313('0x15');return db[_0xa313('0x16')][_0xa313('0x17')]({'where':{'type':_0x1dd349,'resourceId':_0x283d5f['id']}})[_0xa313('0x13')](function(){return _0x2a8678;});})['then'](function(){_0x3f015f[_0xa313('0x18')](0xcc)[_0xa313('0x19')]();});}};}function handleEntityNotFound(_0x7addd4){return function(_0x525255){if(!_0x525255){_0x7addd4[_0xa313('0xb')](0x194);}return _0x525255;};}function handleError(_0x23a5bf,_0x15269d){_0x15269d=_0x15269d||0x1f4;return function(_0x5ff196){logger[_0xa313('0x1a')](_0x5ff196[_0xa313('0x1b')]);if(_0x5ff196[_0xa313('0x1c')]){delete _0x5ff196[_0xa313('0x1c')];}_0x23a5bf[_0xa313('0x18')](_0x15269d)[_0xa313('0x1d')](_0x5ff196);};}exports[_0xa313('0x1e')]=function(_0x3d93eb,_0x13b849){var _0xda34d={};var _0x1a3486={'count':0x0,'rows':[]};var _0x3d0845=_[_0xa313('0x1f')](db[_0xa313('0x20')][_0xa313('0x21')],function(_0x54c963){return{'name':_0x54c963[_0xa313('0x22')],'type':_0x54c963[_0xa313('0x23')]['key']};});_0xda34d=qs['getOptions'](_0x3d0845,_0x3d93eb);var _0x539934={'where':_0xda34d['where']};return db[_0xa313('0x20')][_0xa313('0xf')](_0x539934)[_0xa313('0x13')](function(_0x37b558){_0x1a3486['count']=_0x37b558;_0xda34d[_0xa313('0x24')]=qs[_0xa313('0x24')](_0x3d93eb[_0xa313('0x25')]);return db['MailQueue'][_0xa313('0x26')](_0xda34d);})[_0xa313('0x13')](function(_0x3cd9f0){_0x1a3486[_0xa313('0x27')]=_0x3cd9f0;return _0x1a3486;})['then'](respondWithFilteredResult(_0x13b849,_0xda34d))[_0xa313('0x28')](handleError(_0x13b849,null));};exports[_0xa313('0x29')]=function(_0xc4b13c,_0x2e24ae){var _0x2dab91={'raw':!![],'where':{'id':_0xc4b13c[_0xa313('0x2a')]['id']}},_0x37138d={};_0x37138d[_0xa313('0x2b')]=_[_0xa313('0x2c')](db[_0xa313('0x20')]['rawAttributes']);_0x37138d[_0xa313('0x25')]=_['keys'](_0xc4b13c['query']);_0x37138d['filters']=_['intersection'](_0x37138d[_0xa313('0x2b')],_0x37138d[_0xa313('0x25')]);_0x2dab91[_0xa313('0x2d')]=_[_0xa313('0x2e')](_0x37138d[_0xa313('0x2b')],qs[_0xa313('0x2f')](_0xc4b13c['query'][_0xa313('0x2f')]));_0x2dab91[_0xa313('0x2d')]=_0x2dab91[_0xa313('0x2d')]['length']?_0x2dab91[_0xa313('0x2d')]:_0x37138d[_0xa313('0x2b')];if(_0xc4b13c[_0xa313('0x25')][_0xa313('0x30')]){_0x2dab91[_0xa313('0x24')]=[{'all':!![]}];}_0x2dab91=_[_0xa313('0x31')]({},_0x2dab91,_0xc4b13c[_0xa313('0x32')]);return db[_0xa313('0x20')][_0xa313('0x33')](_0x2dab91)[_0xa313('0x13')](handleEntityNotFound(_0x2e24ae,null))[_0xa313('0x13')](respondWithResult(_0x2e24ae,null))[_0xa313('0x28')](handleError(_0x2e24ae,null));};exports['create']=function(_0x4a46d2,_0x218767){return db[_0xa313('0x20')][_0xa313('0x34')](_0x4a46d2[_0xa313('0x35')],{})[_0xa313('0x13')](function(_0x2a6ebf){var _0x3271d7=_0x4a46d2[_0xa313('0x36')]['get']({'plain':!![]});if(!_0x3271d7)throw new Error(_0xa313('0x37'));if(_0x3271d7[_0xa313('0x38')]===_0xa313('0x36')){var _0xc82281=_0x2a6ebf[_0xa313('0x14')]({'plain':!![]});var _0x4643e3=_0xa313('0x15');return db['UserProfileSection'][_0xa313('0x33')]({'where':{'name':_0x4643e3,'userProfileId':_0x3271d7['userProfileId']},'raw':!![]})['then'](function(_0x476595){if(_0x476595&&_0x476595[_0xa313('0x39')]===0x0){return db[_0xa313('0x16')][_0xa313('0x34')]({'name':_0xc82281[_0xa313('0x1c')],'resourceId':_0xc82281['id'],'type':_0x476595['name'],'sectionId':_0x476595['id']},{})[_0xa313('0x13')](function(){return _0x2a6ebf;});}else{return _0x2a6ebf;}})['catch'](function(_0x5a6907){logger[_0xa313('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a6907);throw _0x5a6907;});}return _0x2a6ebf;})[_0xa313('0x13')](respondWithResult(_0x218767,0xc9))[_0xa313('0x28')](handleError(_0x218767,null));};exports[_0xa313('0x12')]=function(_0x3fd97e,_0x373624){if(_0x3fd97e[_0xa313('0x35')]['id']){delete _0x3fd97e[_0xa313('0x35')]['id'];}return db[_0xa313('0x20')][_0xa313('0x33')]({'where':{'id':_0x3fd97e[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](handleEntityNotFound(_0x373624,null))[_0xa313('0x13')](saveUpdates(_0x3fd97e[_0xa313('0x35')],null))[_0xa313('0x13')](respondWithResult(_0x373624,null))[_0xa313('0x28')](handleError(_0x373624,null));};exports[_0xa313('0x17')]=function(_0x1c6eed,_0x168481){return db[_0xa313('0x20')][_0xa313('0x33')]({'where':{'id':_0x1c6eed[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](handleEntityNotFound(_0x168481,null))['then'](removeEntity(_0x168481,null))[_0xa313('0x28')](handleError(_0x168481,null));};exports[_0xa313('0x3a')]=function(_0x390145,_0x30649e){return db['MailQueue'][_0xa313('0x3a')]()[_0xa313('0x13')](respondWithResult(_0x30649e,null))['catch'](handleError(_0x30649e,null));};exports[_0xa313('0x3b')]=function(_0x3a2e3b,_0x2965ea){var _0x4c453f={'raw':!![],'where':{}},_0xa40388={},_0x2bdad5;return db['MailQueue'][_0xa313('0x3c')]({'where':{'id':_0x3a2e3b[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](handleEntityNotFound(_0x2965ea,null))[_0xa313('0x13')](function(_0x19d1da){if(_0x19d1da){_0x2bdad5=_0x19d1da[_0xa313('0x14')]({'plain':!![]});_0xa40388[_0xa313('0x2b')]=_[_0xa313('0x2c')](db['UserMailQueue'][_0xa313('0x21')]);_0xa40388[_0xa313('0x25')]=_[_0xa313('0x2c')](_0x3a2e3b[_0xa313('0x25')]);_0xa40388[_0xa313('0x3d')]=_['intersection'](_0xa40388['model'],_0xa40388[_0xa313('0x25')]);_0x4c453f[_0xa313('0x2d')]=_[_0xa313('0x2e')](_0xa40388[_0xa313('0x2b')],qs['fields'](_0x3a2e3b['query']['fields']));_0x4c453f[_0xa313('0x2d')]=_0x4c453f[_0xa313('0x2d')]['length']?_0x4c453f['attributes']:_0xa40388[_0xa313('0x2b')];if(!_0x3a2e3b[_0xa313('0x25')][_0xa313('0x3e')]('nolimit')){_0x4c453f[_0xa313('0x3f')]=qs[_0xa313('0x3f')](_0x3a2e3b[_0xa313('0x25')][_0xa313('0x3f')]);_0x4c453f[_0xa313('0xd')]=qs[_0xa313('0xd')](_0x3a2e3b[_0xa313('0x25')][_0xa313('0xd')]);}_0x4c453f[_0xa313('0x40')]=qs[_0xa313('0x41')](_0x3a2e3b[_0xa313('0x25')]['sort']);_0x4c453f['where']=qs[_0xa313('0x3d')](_['pick'](_0x3a2e3b['query'],_0xa40388[_0xa313('0x3d')]));_0x4c453f[_0xa313('0x42')][_0xa313('0x43')]=_0x19d1da['id'];if(_0x3a2e3b['query']['filter']){_0x4c453f[_0xa313('0x42')]=_[_0xa313('0x31')](_0x4c453f[_0xa313('0x42')],{'$or':_['map'](_0x4c453f[_0xa313('0x2d')],function(_0x547515){var _0x5558a5={};_0x5558a5[_0x547515]={'$like':'%'+_0x3a2e3b[_0xa313('0x25')]['filter']+'%'};return _0x5558a5;})});}_0x4c453f=_['merge']({},_0x4c453f,_0x3a2e3b[_0xa313('0x32')]);return db[_0xa313('0x44')][_0xa313('0x26')](_0x4c453f);}})[_0xa313('0x13')](function(_0x2fe0da){if(_0x2fe0da){return db[_0xa313('0x45')][_0xa313('0x46')]({'where':{'id':_['map'](_0x2fe0da,_0xa313('0x47')),'role':'agent'},'attributes':['id',_0xa313('0x1c'),_0xa313('0x48'),_0xa313('0x49'),_0xa313('0x4a')]});}})[_0xa313('0x13')](function(_0x17fbd5){if(_0x17fbd5){return{'count':_0x17fbd5[_0xa313('0xf')],'rows':_[_0xa313('0x1f')](_0x17fbd5[_0xa313('0x27')],function(_0x661283){return{'membername':_0x661283['name'],'UserId':_0x661283['id'],'queue_name':_0x2bdad5[_0xa313('0x1c')],'MailQueueId':_0x2bdad5['id'],'interface':util[_0xa313('0x4b')]('%s/%s',_0xa313('0x4c'),_0x661283[_0xa313('0x1c')]),'penalty':0x0,'paused':_0x661283[_0xa313('0x48')],'createdAt':_0x661283['createdAt'],'updatedAt':_0x661283[_0xa313('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa313('0x13')](respondWithFilteredResult(_0x2965ea,_0x4c453f))[_0xa313('0x28')](handleError(_0x2965ea,null));};exports[_0xa313('0x4d')]=function(_0x465990,_0x373066){var _0x4f3b06={};var _0x39904e={};var _0x167faa;var _0x10fae5;return db[_0xa313('0x20')]['findOne']({'where':{'id':_0x465990[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](handleEntityNotFound(_0x373066,null))['then'](function(_0x43a3af){if(_0x43a3af){_0x167faa=_0x43a3af;_0x39904e[_0xa313('0x2b')]=_[_0xa313('0x2c')](db[_0xa313('0x4e')][_0xa313('0x21')]);_0x39904e[_0xa313('0x25')]=_[_0xa313('0x2c')](_0x465990[_0xa313('0x25')]);_0x39904e[_0xa313('0x3d')]=_[_0xa313('0x2e')](_0x39904e[_0xa313('0x2b')],_0x39904e[_0xa313('0x25')]);_0x4f3b06[_0xa313('0x2d')]=_[_0xa313('0x2e')](_0x39904e[_0xa313('0x2b')],qs[_0xa313('0x2f')](_0x465990[_0xa313('0x25')][_0xa313('0x2f')]));_0x4f3b06['attributes']=_0x4f3b06['attributes'][_0xa313('0x4f')]?_0x4f3b06[_0xa313('0x2d')]:_0x39904e[_0xa313('0x2b')];_0x4f3b06[_0xa313('0x40')]=qs[_0xa313('0x41')](_0x465990['query'][_0xa313('0x41')]);_0x4f3b06[_0xa313('0x42')]=qs[_0xa313('0x3d')](_[_0xa313('0x50')](_0x465990['query'],_0x39904e[_0xa313('0x3d')]));if(_0x465990[_0xa313('0x25')][_0xa313('0x51')]){_0x4f3b06[_0xa313('0x42')]=_[_0xa313('0x31')](_0x4f3b06[_0xa313('0x42')],{'$or':_[_0xa313('0x1f')](_0x4f3b06[_0xa313('0x2d')],function(_0x54e241){var _0xf1eb8c={};_0xf1eb8c[_0x54e241]={'$like':'%'+_0x465990[_0xa313('0x25')]['filter']+'%'};return _0xf1eb8c;})});}_0x4f3b06=_[_0xa313('0x31')]({},_0x4f3b06,_0x465990[_0xa313('0x32')]);return _0x167faa[_0xa313('0x4d')](_0x4f3b06);}})[_0xa313('0x13')](function(_0x2615e7){if(_0x2615e7){_0x10fae5=_0x2615e7[_0xa313('0x4f')];if(!_0x465990[_0xa313('0x25')][_0xa313('0x3e')](_0xa313('0x52'))){_0x4f3b06[_0xa313('0x3f')]=qs[_0xa313('0x3f')](_0x465990[_0xa313('0x25')][_0xa313('0x3f')]);_0x4f3b06[_0xa313('0xd')]=qs[_0xa313('0xd')](_0x465990[_0xa313('0x25')][_0xa313('0xd')]);}return _0x167faa['getTeams'](_0x4f3b06);}})['then'](function(_0x86ab25){if(_0x86ab25){return _0x86ab25?{'count':_0x10fae5,'rows':_0x86ab25}:null;}})[_0xa313('0x13')](respondWithResult(_0x373066,null))[_0xa313('0x28')](handleError(_0x373066,null));};exports['addTeams']=function(_0x453aa9,_0x199acd){var _0x304a8e=_0x453aa9[_0xa313('0x35')][_0xa313('0x53')];return db['Team'][_0xa313('0x26')]({'where':{'id':_0x304a8e},'attributes':['id'],'include':[{'model':db[_0xa313('0x45')],'as':_0xa313('0x54'),'attributes':['id','name',_0xa313('0x55'),'voicePause','interface'],'raw':!![]}]})[_0xa313('0x13')](function(_0x16a645){if(_0x16a645){var _0x1618f2=_[_0xa313('0x56')](_0x16a645,function(_0x1b7832){var _0x2d7116=_0x1b7832[_0xa313('0x14')]({'plain':!![]});return _0x2d7116[_0xa313('0x54')];});return db[_0xa313('0x20')][_0xa313('0x33')]({'where':{'id':_0x453aa9[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](function(_0x15d80f){return db[_0xa313('0x57')][_0xa313('0x58')](function(_0x41598d){return _0x15d80f[_0xa313('0x59')](_0x304a8e,{'transaction':_0x41598d})[_0xa313('0x13')](function(){return BPromise[_0xa313('0x5a')](_0x1618f2,function(_0x2d698a){return db['UserMailQueue'][_0xa313('0x5b')]({'where':{'UserId':_0x2d698a['id'],'MailQueueId':_0x453aa9[_0xa313('0x2a')]['id']},'transaction':_0x41598d});});})[_0xa313('0x13')](function(){_0x1618f2[_0xa313('0x5c')](function(_0x175949){socket[_0xa313('0x5d')]('userMailQueue:save',{'UserId':_0x175949['id'],'MailQueueId':_0x15d80f['id']});});});});});}})['then'](respondWithStatusCode(_0x199acd,null))[_0xa313('0x28')](handleError(_0x199acd,null));};exports['removeTeams']=function(_0xec444f,_0x48b533){return db[_0xa313('0x4e')][_0xa313('0x26')]({'where':{'id':_0xec444f[_0xa313('0x25')][_0xa313('0x53')]},'attributes':['id'],'include':[{'model':db[_0xa313('0x45')],'as':_0xa313('0x54'),'attributes':['id'],'raw':!![]}]})[_0xa313('0x13')](handleEntityNotFound(_0x48b533,null))['then'](function(_0x163826){var _0x8c7fc1=_['map'](_0x163826,'id');var _0x4353ef=[];var _0xfb8cc2=[];var _0x27c626=squel[_0xa313('0x5e')]();_0x27c626[_0xa313('0x5f')](_0xa313('0x60'))[_0xa313('0x61')](_0xa313('0x62'),'tq')[_0xa313('0x63')](_0xa313('0x64'),'ut',_0xa313('0x65'))[_0xa313('0x42')](_0xa313('0x66'),_0xec444f[_0xa313('0x2a')]['id']);for(var _0x5d8291=0x0;_0x5d8291<_0x163826[_0xa313('0x4f')];_0x5d8291+=0x1){let _0xece713=_0x163826[_0x5d8291];for(var _0xc589f2=0x0;_0xc589f2<_0xece713[_0xa313('0x54')][_0xa313('0x4f')];_0xc589f2+=0x1){let _0x440176=_0xece713[_0xa313('0x54')][_0xc589f2];var _0x34d53d=_0x27c626['clone']();_0x34d53d[_0xa313('0x42')](_0xa313('0x67'),_0x440176['id']);_0xfb8cc2[_0xa313('0x68')](db[_0xa313('0x57')][_0xa313('0x25')](_0x34d53d[_0xa313('0x69')](),{'type':db[_0xa313('0x57')][_0xa313('0x6a')][_0xa313('0x6b')]})['then'](function(_0x3da0cb){if(_0x3da0cb['length']===0x1){return _0x440176['id'];}else{var _0x5ae996=_[_0xa313('0x6c')](_[_0xa313('0x1f')](_0x3da0cb,'TeamId'),function(_0x4e8516){return _[_0xa313('0x6d')](_0x8c7fc1,_0x4e8516);});if(_0x5ae996){return _0x440176['id'];}}}));}}return BPromise[_0xa313('0x6e')](_0xfb8cc2)[_0xa313('0x13')](function(_0x4a6109){_0x4353ef=_(_0x4353ef)[_0xa313('0x6f')](_0x4a6109)[_0xa313('0x70')]()['value']();return db[_0xa313('0x20')][_0xa313('0x33')]({'where':{'id':_0xec444f[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](function(_0xe2bf53){return db[_0xa313('0x57')][_0xa313('0x58')](function(_0x3b3fc7){return _0xe2bf53[_0xa313('0x71')](_0xec444f['query'][_0xa313('0x53')],{'transaction':_0x3b3fc7})[_0xa313('0x13')](function(){if(!_[_0xa313('0x72')](_0x4353ef)){return _0xe2bf53['removeAgents'](_0x4353ef,{'transaction':_0x3b3fc7});}})[_0xa313('0x13')](function(){_0x4353ef[_0xa313('0x5c')](function(_0x3c30b2){socket[_0xa313('0x5d')](_0xa313('0x73'),{'UserId':_0x3c30b2,'MailQueueId':_0xe2bf53['id']});});});});});});})[_0xa313('0x13')](respondWithStatusCode(_0x48b533,null))['catch'](handleError(_0x48b533,null));};exports[_0xa313('0x74')]=function(_0x194212,_0x2ca0be){return db[_0xa313('0x20')]['find']({'where':{'id':_0x194212[_0xa313('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2ca0be,null))['then'](function(_0x2df4f0){if(_0x2df4f0){return _0x2df4f0[_0xa313('0x74')](_0x194212[_0xa313('0x35')][_0xa313('0x53')],_['omit'](_0x194212[_0xa313('0x35')],['ids','id'])||{})[_0xa313('0x75')](function(_0x5ef924){for(var _0x56d457=0x0;_0x56d457<_0x194212[_0xa313('0x35')][_0xa313('0x53')][_0xa313('0x4f')];_0x56d457+=0x1){socket['emit'](_0xa313('0x76'),{'UserId':Number(_0x194212[_0xa313('0x35')][_0xa313('0x53')][_0x56d457]),'MailQueueId':Number(_0x194212[_0xa313('0x2a')]['id'])});}return _0x5ef924;});}})[_0xa313('0x13')](respondWithResult(_0x2ca0be,null))[_0xa313('0x28')](handleError(_0x2ca0be,null));};exports[_0xa313('0x77')]=function(_0x313da6,_0x52f8dc){return db['MailQueue'][_0xa313('0x33')]({'where':{'id':_0x313da6['params']['id']}})[_0xa313('0x13')](handleEntityNotFound(_0x52f8dc,null))['then'](function(_0x595b59){if(_0x595b59){return _0x595b59[_0xa313('0x77')](_0x313da6['query']['ids'])[_0xa313('0x13')](function(){if(_[_0xa313('0x78')](_0x313da6[_0xa313('0x25')]['ids'])){for(var _0x3c328f=0x0;_0x3c328f<_0x313da6[_0xa313('0x25')]['ids'][_0xa313('0x4f')];_0x3c328f+=0x1){socket[_0xa313('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x313da6[_0xa313('0x25')][_0xa313('0x53')][_0x3c328f]),'MailQueueId':Number(_0x313da6[_0xa313('0x2a')]['id'])});}}else{socket[_0xa313('0x5d')](_0xa313('0x73'),{'UserId':Number(_0x313da6[_0xa313('0x25')][_0xa313('0x53')]),'MailQueueId':Number(_0x313da6[_0xa313('0x2a')]['id'])});}});}})[_0xa313('0x13')](respondWithStatusCode(_0x52f8dc,null))['catch'](handleError(_0x52f8dc,null));};exports[_0xa313('0x79')]=function(_0x628a12,_0xb8c08b){var _0x10f8c={};var _0x42de98={};var _0x381946;var _0x539465;return db[_0xa313('0x20')][_0xa313('0x3c')]({'where':{'id':_0x628a12[_0xa313('0x2a')]['id']}})[_0xa313('0x13')](handleEntityNotFound(_0xb8c08b,null))[_0xa313('0x13')](function(_0x4c96de){if(_0x4c96de){_0x381946=_0x4c96de;_0x42de98['model']=_[_0xa313('0x2c')](db[_0xa313('0x45')]['rawAttributes']);_0x42de98[_0xa313('0x25')]=_[_0xa313('0x2c')](_0x628a12[_0xa313('0x25')]);_0x42de98[_0xa313('0x3d')]=_[_0xa313('0x2e')](_0x42de98['model'],_0x42de98['query']);_0x10f8c[_0xa313('0x2d')]=_['intersection'](_0x42de98[_0xa313('0x2b')],qs[_0xa313('0x2f')](_0x628a12[_0xa313('0x25')][_0xa313('0x2f')]));_0x10f8c[_0xa313('0x2d')]=_0x10f8c['attributes'][_0xa313('0x4f')]?_0x10f8c[_0xa313('0x2d')]:_0x42de98[_0xa313('0x2b')];_0x10f8c[_0xa313('0x40')]=qs[_0xa313('0x41')](_0x628a12[_0xa313('0x25')][_0xa313('0x41')]);_0x10f8c[_0xa313('0x42')]=qs[_0xa313('0x3d')](_['pick'](_0x628a12[_0xa313('0x25')],_0x42de98[_0xa313('0x3d')]));if(_0x628a12[_0xa313('0x25')][_0xa313('0x51')]){_0x10f8c[_0xa313('0x42')]=_[_0xa313('0x31')](_0x10f8c[_0xa313('0x42')],{'$or':_[_0xa313('0x1f')](_0x10f8c[_0xa313('0x2d')],function(_0x1dc0e1){var _0x22f011={};_0x22f011[_0x1dc0e1]={'$like':'%'+_0x628a12['query'][_0xa313('0x51')]+'%'};return _0x22f011;})});}_0x10f8c=_[_0xa313('0x31')]({},_0x10f8c,_0x628a12[_0xa313('0x32')]);return _0x381946['getAgents'](_0x10f8c);}})[_0xa313('0x13')](function(_0x160254){if(_0x160254){_0x539465=_0x160254[_0xa313('0x4f')];if(!_0x628a12[_0xa313('0x25')]['hasOwnProperty'](_0xa313('0x52'))){_0x10f8c['limit']=qs[_0xa313('0x3f')](_0x628a12[_0xa313('0x25')][_0xa313('0x3f')]);_0x10f8c[_0xa313('0xd')]=qs['offset'](_0x628a12[_0xa313('0x25')][_0xa313('0xd')]);}return _0x381946[_0xa313('0x79')](_0x10f8c);}})[_0xa313('0x13')](function(_0x50b5d4){if(_0x50b5d4){return _0x50b5d4?{'count':_0x539465,'rows':_0x50b5d4}:null;}})['then'](respondWithResult(_0xb8c08b,null))[_0xa313('0x28')](handleError(_0xb8c08b,null));}; \ No newline at end of file +var _0xf631=['redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','show','params','model','keys','filters','intersection','attributes','fields','merge','find','catch','create','user','role','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','options','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','select','join','user_has_teams','MailQueueId\x20=\x20?','clone','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','order','bluebird','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x176eff,_0x38955b){var _0x375808=function(_0x516137){while(--_0x516137){_0x176eff['push'](_0x176eff['shift']());}};_0x375808(++_0x38955b);}(_0xf631,0x156));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x1f63('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x1f63('0x1'));var logger=require(_0x1f63('0x2'))(_0x1f63('0x3'));var config=require(_0x1f63('0x4'));var db=require(_0x1f63('0x5'))['db'];config[_0x1f63('0x6')]=_['defaults'](config[_0x1f63('0x6')],{'host':_0x1f63('0x7'),'port':0x18eb});var socket=require(_0x1f63('0x8'))(new Redis(config[_0x1f63('0x6')]));require(_0x1f63('0x9'))['register'](socket);function respondWithStatusCode(_0x1a90eb,_0x46d917){_0x46d917=_0x46d917||0xcc;return function(_0x4fbc28){if(_0x4fbc28){return _0x1a90eb[_0x1f63('0xa')](_0x46d917);}return _0x1a90eb[_0x1f63('0xb')](_0x46d917)[_0x1f63('0xc')]();};}function respondWithResult(_0x2219a4,_0x27d500){_0x27d500=_0x27d500||0xc8;return function(_0x105b39){if(_0x105b39){return _0x2219a4['status'](_0x27d500)[_0x1f63('0xd')](_0x105b39);}};}function respondWithFilteredResult(_0x24bc18,_0x4e392a){return function(_0xd1b56){if(_0xd1b56){var _0x2afd18=typeof _0x4e392a[_0x1f63('0xe')]===_0x1f63('0xf')&&typeof _0x4e392a[_0x1f63('0x10')]===_0x1f63('0xf');var _0x2b7dbc=_0xd1b56['count'];var _0x22434f=_0x2afd18?0x0:_0x4e392a[_0x1f63('0xe')];var _0x2f1ced=_0x2afd18?_0xd1b56['count']:_0x4e392a['offset']+_0x4e392a[_0x1f63('0x10')];var _0x1dfd7e;if(_0x2f1ced>=_0x2b7dbc){_0x2f1ced=_0x2b7dbc;_0x1dfd7e=0xc8;}else{_0x1dfd7e=0xce;}_0x24bc18[_0x1f63('0xb')](_0x1dfd7e);return _0x24bc18[_0x1f63('0x11')](_0x1f63('0x12'),_0x22434f+'-'+_0x2f1ced+'/'+_0x2b7dbc)['json'](_0xd1b56);}return null;};}function saveUpdates(_0x5712a9){return function(_0x12c319){if(_0x12c319){return _0x12c319[_0x1f63('0x13')](_0x5712a9)[_0x1f63('0x14')](function(_0x7e713d){return _0x7e713d;});}return null;};}function removeEntity(_0x48e146){return function(_0x123e0b){if(_0x123e0b){return _0x123e0b[_0x1f63('0x15')]()['then'](function(){var _0x393b88=_0x123e0b['get']({'plain':!![]});var _0x3635c7=_0x1f63('0x16');return db[_0x1f63('0x17')][_0x1f63('0x15')]({'where':{'type':_0x3635c7,'resourceId':_0x393b88['id']}})[_0x1f63('0x14')](function(){return _0x123e0b;});})[_0x1f63('0x14')](function(){_0x48e146[_0x1f63('0xb')](0xcc)[_0x1f63('0xc')]();});}};}function handleEntityNotFound(_0x313461){return function(_0x503ff0){if(!_0x503ff0){_0x313461['sendStatus'](0x194);}return _0x503ff0;};}function handleError(_0x2cbb2a,_0x710ed1){_0x710ed1=_0x710ed1||0x1f4;return function(_0x1ea3c9){logger['error'](_0x1ea3c9[_0x1f63('0x18')]);if(_0x1ea3c9[_0x1f63('0x19')]){delete _0x1ea3c9[_0x1f63('0x19')];}_0x2cbb2a[_0x1f63('0xb')](_0x710ed1)[_0x1f63('0x1a')](_0x1ea3c9);};}exports[_0x1f63('0x1b')]=function(_0x50f680,_0x45c061){var _0x346e43={};var _0x403857={'count':0x0,'rows':[]};var _0x597df6=_[_0x1f63('0x1c')](db[_0x1f63('0x1d')][_0x1f63('0x1e')],function(_0x3346e5){return{'name':_0x3346e5['fieldName'],'type':_0x3346e5[_0x1f63('0x1f')][_0x1f63('0x20')]};});_0x346e43=qs[_0x1f63('0x21')](_0x597df6,_0x50f680);var _0x76f3ed={'where':_0x346e43[_0x1f63('0x22')]};return db[_0x1f63('0x1d')][_0x1f63('0x23')](_0x76f3ed)[_0x1f63('0x14')](function(_0x3de58a){_0x403857['count']=_0x3de58a;_0x346e43[_0x1f63('0x24')]=qs[_0x1f63('0x24')](_0x50f680[_0x1f63('0x25')]);return db[_0x1f63('0x1d')]['findAll'](_0x346e43);})[_0x1f63('0x14')](function(_0x128d8e){_0x403857[_0x1f63('0x26')]=_0x128d8e;return _0x403857;})[_0x1f63('0x14')](respondWithFilteredResult(_0x45c061,_0x346e43))['catch'](handleError(_0x45c061,null));};exports[_0x1f63('0x27')]=function(_0x2eeb9a,_0x2fa026){var _0x3fc639={'raw':!![],'where':{'id':_0x2eeb9a[_0x1f63('0x28')]['id']}},_0x4b7f7c={};_0x4b7f7c[_0x1f63('0x29')]=_[_0x1f63('0x2a')](db[_0x1f63('0x1d')][_0x1f63('0x1e')]);_0x4b7f7c[_0x1f63('0x25')]=_[_0x1f63('0x2a')](_0x2eeb9a[_0x1f63('0x25')]);_0x4b7f7c[_0x1f63('0x2b')]=_[_0x1f63('0x2c')](_0x4b7f7c[_0x1f63('0x29')],_0x4b7f7c[_0x1f63('0x25')]);_0x3fc639[_0x1f63('0x2d')]=_['intersection'](_0x4b7f7c[_0x1f63('0x29')],qs[_0x1f63('0x2e')](_0x2eeb9a['query'][_0x1f63('0x2e')]));_0x3fc639[_0x1f63('0x2d')]=_0x3fc639[_0x1f63('0x2d')]['length']?_0x3fc639[_0x1f63('0x2d')]:_0x4b7f7c[_0x1f63('0x29')];if(_0x2eeb9a[_0x1f63('0x25')]['includeAll']){_0x3fc639[_0x1f63('0x24')]=[{'all':!![]}];}_0x3fc639=_[_0x1f63('0x2f')]({},_0x3fc639,_0x2eeb9a['options']);return db[_0x1f63('0x1d')][_0x1f63('0x30')](_0x3fc639)[_0x1f63('0x14')](handleEntityNotFound(_0x2fa026,null))['then'](respondWithResult(_0x2fa026,null))[_0x1f63('0x31')](handleError(_0x2fa026,null));};exports[_0x1f63('0x32')]=function(_0x145fb3,_0x529f32){return db['MailQueue'][_0x1f63('0x32')](_0x145fb3['body'],{})[_0x1f63('0x14')](function(_0x358ee0){var _0x174221=_0x145fb3[_0x1f63('0x33')]['get']({'plain':!![]});if(!_0x174221)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174221[_0x1f63('0x34')]===_0x1f63('0x33')){var _0x279146=_0x358ee0[_0x1f63('0x35')]({'plain':!![]});var _0x2330ff=_0x1f63('0x16');return db['UserProfileSection'][_0x1f63('0x30')]({'where':{'name':_0x2330ff,'userProfileId':_0x174221[_0x1f63('0x36')]},'raw':!![]})[_0x1f63('0x14')](function(_0x481059){if(_0x481059&&_0x481059[_0x1f63('0x37')]===0x0){return db[_0x1f63('0x17')][_0x1f63('0x32')]({'name':_0x279146['name'],'resourceId':_0x279146['id'],'type':_0x481059[_0x1f63('0x19')],'sectionId':_0x481059['id']},{})[_0x1f63('0x14')](function(){return _0x358ee0;});}else{return _0x358ee0;}})[_0x1f63('0x31')](function(_0x401f34){logger[_0x1f63('0x38')](_0x1f63('0x39'),_0x401f34);throw _0x401f34;});}return _0x358ee0;})[_0x1f63('0x14')](respondWithResult(_0x529f32,0xc9))['catch'](handleError(_0x529f32,null));};exports[_0x1f63('0x13')]=function(_0x27a1cb,_0x9125df){if(_0x27a1cb[_0x1f63('0x3a')]['id']){delete _0x27a1cb[_0x1f63('0x3a')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x27a1cb['params']['id']}})[_0x1f63('0x14')](handleEntityNotFound(_0x9125df,null))[_0x1f63('0x14')](saveUpdates(_0x27a1cb['body'],null))[_0x1f63('0x14')](respondWithResult(_0x9125df,null))[_0x1f63('0x31')](handleError(_0x9125df,null));};exports['destroy']=function(_0x3c7e63,_0x2e0b67){return db[_0x1f63('0x1d')][_0x1f63('0x30')]({'where':{'id':_0x3c7e63[_0x1f63('0x28')]['id']}})['then'](handleEntityNotFound(_0x2e0b67,null))[_0x1f63('0x14')](removeEntity(_0x2e0b67,null))['catch'](handleError(_0x2e0b67,null));};exports[_0x1f63('0x3b')]=function(_0x2e0c79,_0x33a548){return db['MailQueue'][_0x1f63('0x3b')]()[_0x1f63('0x14')](respondWithResult(_0x33a548,null))[_0x1f63('0x31')](handleError(_0x33a548,null));};exports[_0x1f63('0x3c')]=function(_0x3cd9b2,_0x34bebd){var _0x3fb11e={'raw':!![],'where':{}},_0x45409b={},_0xe0bb98;return db[_0x1f63('0x1d')][_0x1f63('0x3d')]({'where':{'id':_0x3cd9b2[_0x1f63('0x28')]['id']}})[_0x1f63('0x14')](handleEntityNotFound(_0x34bebd,null))[_0x1f63('0x14')](function(_0x288cb5){if(_0x288cb5){_0xe0bb98=_0x288cb5[_0x1f63('0x35')]({'plain':!![]});_0x45409b[_0x1f63('0x29')]=_[_0x1f63('0x2a')](db[_0x1f63('0x3e')][_0x1f63('0x1e')]);_0x45409b[_0x1f63('0x25')]=_[_0x1f63('0x2a')](_0x3cd9b2[_0x1f63('0x25')]);_0x45409b[_0x1f63('0x2b')]=_[_0x1f63('0x2c')](_0x45409b[_0x1f63('0x29')],_0x45409b[_0x1f63('0x25')]);_0x3fb11e[_0x1f63('0x2d')]=_[_0x1f63('0x2c')](_0x45409b[_0x1f63('0x29')],qs[_0x1f63('0x2e')](_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x2e')]));_0x3fb11e[_0x1f63('0x2d')]=_0x3fb11e[_0x1f63('0x2d')][_0x1f63('0x3f')]?_0x3fb11e[_0x1f63('0x2d')]:_0x45409b[_0x1f63('0x29')];if(!_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x40')](_0x1f63('0x41'))){_0x3fb11e[_0x1f63('0x10')]=qs['limit'](_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x10')]);_0x3fb11e[_0x1f63('0xe')]=qs[_0x1f63('0xe')](_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0xe')]);}_0x3fb11e['order']=qs[_0x1f63('0x42')](_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x42')]);_0x3fb11e[_0x1f63('0x22')]=qs[_0x1f63('0x2b')](_[_0x1f63('0x43')](_0x3cd9b2[_0x1f63('0x25')],_0x45409b[_0x1f63('0x2b')]));_0x3fb11e[_0x1f63('0x22')][_0x1f63('0x44')]=_0x288cb5['id'];if(_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x45')]){_0x3fb11e[_0x1f63('0x22')]=_[_0x1f63('0x2f')](_0x3fb11e[_0x1f63('0x22')],{'$or':_['map'](_0x3fb11e[_0x1f63('0x2d')],function(_0x215e74){var _0x25bc45={};_0x25bc45[_0x215e74]={'$like':'%'+_0x3cd9b2[_0x1f63('0x25')][_0x1f63('0x45')]+'%'};return _0x25bc45;})});}_0x3fb11e=_['merge']({},_0x3fb11e,_0x3cd9b2[_0x1f63('0x46')]);return db[_0x1f63('0x3e')][_0x1f63('0x47')](_0x3fb11e);}})[_0x1f63('0x14')](function(_0x2d4a1b){if(_0x2d4a1b){return db[_0x1f63('0x48')][_0x1f63('0x49')]({'where':{'id':_['map'](_0x2d4a1b,_0x1f63('0x4a')),'role':_0x1f63('0x4b')},'attributes':['id',_0x1f63('0x19'),_0x1f63('0x4c'),_0x1f63('0x4d'),_0x1f63('0x4e')]});}})[_0x1f63('0x14')](function(_0x416afa){if(_0x416afa){return{'count':_0x416afa['count'],'rows':_[_0x1f63('0x1c')](_0x416afa[_0x1f63('0x26')],function(_0x4987e7){return{'membername':_0x4987e7[_0x1f63('0x19')],'UserId':_0x4987e7['id'],'queue_name':_0xe0bb98[_0x1f63('0x19')],'MailQueueId':_0xe0bb98['id'],'interface':util[_0x1f63('0x4f')](_0x1f63('0x50'),_0x1f63('0x51'),_0x4987e7[_0x1f63('0x19')]),'penalty':0x0,'paused':_0x4987e7[_0x1f63('0x4c')],'createdAt':_0x4987e7['createdAt'],'updatedAt':_0x4987e7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x34bebd,_0x3fb11e))[_0x1f63('0x31')](handleError(_0x34bebd,null));};exports[_0x1f63('0x52')]=function(_0x3678b8,_0x35b88d){var _0x5c3b3f={};var _0x2aa5d0={};var _0x53748c;var _0x28b97d;return db[_0x1f63('0x1d')][_0x1f63('0x3d')]({'where':{'id':_0x3678b8[_0x1f63('0x28')]['id']}})['then'](handleEntityNotFound(_0x35b88d,null))[_0x1f63('0x14')](function(_0x37c4b1){if(_0x37c4b1){_0x53748c=_0x37c4b1;_0x2aa5d0[_0x1f63('0x29')]=_[_0x1f63('0x2a')](db[_0x1f63('0x53')][_0x1f63('0x1e')]);_0x2aa5d0[_0x1f63('0x25')]=_[_0x1f63('0x2a')](_0x3678b8[_0x1f63('0x25')]);_0x2aa5d0['filters']=_[_0x1f63('0x2c')](_0x2aa5d0[_0x1f63('0x29')],_0x2aa5d0['query']);_0x5c3b3f[_0x1f63('0x2d')]=_[_0x1f63('0x2c')](_0x2aa5d0['model'],qs['fields'](_0x3678b8['query'][_0x1f63('0x2e')]));_0x5c3b3f['attributes']=_0x5c3b3f[_0x1f63('0x2d')][_0x1f63('0x3f')]?_0x5c3b3f[_0x1f63('0x2d')]:_0x2aa5d0[_0x1f63('0x29')];_0x5c3b3f['order']=qs[_0x1f63('0x42')](_0x3678b8[_0x1f63('0x25')]['sort']);_0x5c3b3f[_0x1f63('0x22')]=qs['filters'](_['pick'](_0x3678b8[_0x1f63('0x25')],_0x2aa5d0[_0x1f63('0x2b')]));if(_0x3678b8[_0x1f63('0x25')]['filter']){_0x5c3b3f[_0x1f63('0x22')]=_['merge'](_0x5c3b3f['where'],{'$or':_['map'](_0x5c3b3f[_0x1f63('0x2d')],function(_0x4d7607){var _0x3f5a35={};_0x3f5a35[_0x4d7607]={'$like':'%'+_0x3678b8[_0x1f63('0x25')][_0x1f63('0x45')]+'%'};return _0x3f5a35;})});}_0x5c3b3f=_[_0x1f63('0x2f')]({},_0x5c3b3f,_0x3678b8[_0x1f63('0x46')]);return _0x53748c[_0x1f63('0x52')](_0x5c3b3f);}})[_0x1f63('0x14')](function(_0x31c9c9){if(_0x31c9c9){_0x28b97d=_0x31c9c9['length'];if(!_0x3678b8[_0x1f63('0x25')][_0x1f63('0x40')]('nolimit')){_0x5c3b3f[_0x1f63('0x10')]=qs[_0x1f63('0x10')](_0x3678b8[_0x1f63('0x25')][_0x1f63('0x10')]);_0x5c3b3f[_0x1f63('0xe')]=qs['offset'](_0x3678b8['query'][_0x1f63('0xe')]);}return _0x53748c[_0x1f63('0x52')](_0x5c3b3f);}})['then'](function(_0x414a50){if(_0x414a50){return _0x414a50?{'count':_0x28b97d,'rows':_0x414a50}:null;}})[_0x1f63('0x14')](respondWithResult(_0x35b88d,null))[_0x1f63('0x31')](handleError(_0x35b88d,null));};exports[_0x1f63('0x54')]=function(_0xe84450,_0x5771ab){var _0x3707bc=_0xe84450[_0x1f63('0x3a')][_0x1f63('0x55')];return db['Team']['findAll']({'where':{'id':_0x3707bc},'attributes':['id'],'include':[{'model':db[_0x1f63('0x48')],'as':_0x1f63('0x56'),'attributes':['id',_0x1f63('0x19'),_0x1f63('0x57'),_0x1f63('0x58'),_0x1f63('0x59')],'raw':!![]}]})[_0x1f63('0x14')](function(_0x15420e){if(_0x15420e){var _0x3eaea5=_['flatMap'](_0x15420e,function(_0x5a0874){var _0x22cf4e=_0x5a0874[_0x1f63('0x35')]({'plain':!![]});return _0x22cf4e['Agents'];});return db['MailQueue']['find']({'where':{'id':_0xe84450['params']['id']}})[_0x1f63('0x14')](function(_0x26ef94){return db[_0x1f63('0x5a')][_0x1f63('0x5b')](function(_0x31491f){return _0x26ef94['addTeams'](_0x3707bc,{'transaction':_0x31491f})[_0x1f63('0x14')](function(){return BPromise[_0x1f63('0x5c')](_0x3eaea5,function(_0x17056b){return db[_0x1f63('0x3e')]['findOrCreate']({'where':{'UserId':_0x17056b['id'],'MailQueueId':_0xe84450[_0x1f63('0x28')]['id']},'transaction':_0x31491f});});})['then'](function(){_0x3eaea5[_0x1f63('0x5d')](function(_0x126e1e){socket[_0x1f63('0x5e')](_0x1f63('0x5f'),{'UserId':_0x126e1e['id'],'MailQueueId':_0x26ef94['id']});});});});});}})[_0x1f63('0x14')](respondWithStatusCode(_0x5771ab,null))[_0x1f63('0x31')](handleError(_0x5771ab,null));};exports[_0x1f63('0x60')]=function(_0xf9ca1b,_0x40d424){return db[_0x1f63('0x53')][_0x1f63('0x47')]({'where':{'id':_0xf9ca1b[_0x1f63('0x25')][_0x1f63('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1f63('0x56'),'attributes':['id'],'raw':!![]}]})[_0x1f63('0x14')](handleEntityNotFound(_0x40d424,null))[_0x1f63('0x14')](function(_0x445837){var _0x462c55=_[_0x1f63('0x1c')](_0x445837,'id');var _0x5021d2=[];var _0x3b095e=[];var _0x2914ad=squel[_0x1f63('0x61')]();_0x2914ad['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x1f63('0x62')](_0x1f63('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1f63('0x22')](_0x1f63('0x64'),_0xf9ca1b['params']['id']);for(var _0x2fd868=0x0;_0x2fd868<_0x445837[_0x1f63('0x3f')];_0x2fd868+=0x1){let _0x567562=_0x445837[_0x2fd868];for(var _0x5403e1=0x0;_0x5403e1<_0x567562[_0x1f63('0x56')]['length'];_0x5403e1+=0x1){let _0x27211c=_0x567562[_0x1f63('0x56')][_0x5403e1];var _0x578ac2=_0x2914ad[_0x1f63('0x65')]();_0x578ac2[_0x1f63('0x22')]('ut.UserId\x20=\x20?',_0x27211c['id']);_0x3b095e['push'](db[_0x1f63('0x5a')][_0x1f63('0x25')](_0x578ac2['toString'](),{'type':db[_0x1f63('0x5a')]['QueryTypes'][_0x1f63('0x66')]})['then'](function(_0x5f14f0){if(_0x5f14f0[_0x1f63('0x3f')]===0x1){return _0x27211c['id'];}else{var _0x42bae8=_[_0x1f63('0x67')](_[_0x1f63('0x1c')](_0x5f14f0,'TeamId'),function(_0x4c6f51){return _[_0x1f63('0x68')](_0x462c55,_0x4c6f51);});if(_0x42bae8){return _0x27211c['id'];}}}));}}return BPromise[_0x1f63('0x69')](_0x3b095e)[_0x1f63('0x14')](function(_0x39e89e){_0x5021d2=_(_0x5021d2)[_0x1f63('0x6a')](_0x39e89e)[_0x1f63('0x6b')]()[_0x1f63('0x6c')]();return db[_0x1f63('0x1d')]['find']({'where':{'id':_0xf9ca1b[_0x1f63('0x28')]['id']}})[_0x1f63('0x14')](function(_0x18b665){return db[_0x1f63('0x5a')][_0x1f63('0x5b')](function(_0x58334e){return _0x18b665[_0x1f63('0x60')](_0xf9ca1b[_0x1f63('0x25')][_0x1f63('0x55')],{'transaction':_0x58334e})['then'](function(){if(!_[_0x1f63('0x6d')](_0x5021d2)){return _0x18b665[_0x1f63('0x6e')](_0x5021d2,{'transaction':_0x58334e});}})[_0x1f63('0x14')](function(){_0x5021d2[_0x1f63('0x5d')](function(_0xb7c08f){socket['emit'](_0x1f63('0x6f'),{'UserId':_0xb7c08f,'MailQueueId':_0x18b665['id']});});});});});});})[_0x1f63('0x14')](respondWithStatusCode(_0x40d424,null))[_0x1f63('0x31')](handleError(_0x40d424,null));};exports['addAgents']=function(_0x38c3f2,_0x3f430c){return db[_0x1f63('0x1d')][_0x1f63('0x30')]({'where':{'id':_0x38c3f2[_0x1f63('0x28')]['id']}})[_0x1f63('0x14')](handleEntityNotFound(_0x3f430c,null))[_0x1f63('0x14')](function(_0x3f0a83){if(_0x3f0a83){return _0x3f0a83[_0x1f63('0x70')](_0x38c3f2['body'][_0x1f63('0x55')],_['omit'](_0x38c3f2[_0x1f63('0x3a')],[_0x1f63('0x55'),'id'])||{})[_0x1f63('0x71')](function(_0x10eaf3){for(var _0x4c5474=0x0;_0x4c5474<_0x38c3f2['body'][_0x1f63('0x55')][_0x1f63('0x3f')];_0x4c5474+=0x1){socket[_0x1f63('0x5e')](_0x1f63('0x5f'),{'UserId':Number(_0x38c3f2[_0x1f63('0x3a')][_0x1f63('0x55')][_0x4c5474]),'MailQueueId':Number(_0x38c3f2['params']['id'])});}return _0x10eaf3;});}})[_0x1f63('0x14')](respondWithResult(_0x3f430c,null))[_0x1f63('0x31')](handleError(_0x3f430c,null));};exports[_0x1f63('0x6e')]=function(_0x4bcdc6,_0x1038dc){return db[_0x1f63('0x1d')][_0x1f63('0x30')]({'where':{'id':_0x4bcdc6[_0x1f63('0x28')]['id']}})[_0x1f63('0x14')](handleEntityNotFound(_0x1038dc,null))[_0x1f63('0x14')](function(_0x2a7fde){if(_0x2a7fde){return _0x2a7fde[_0x1f63('0x6e')](_0x4bcdc6[_0x1f63('0x25')][_0x1f63('0x55')])[_0x1f63('0x14')](function(){if(_['isArray'](_0x4bcdc6[_0x1f63('0x25')][_0x1f63('0x55')])){for(var _0x2e68d5=0x0;_0x2e68d5<_0x4bcdc6[_0x1f63('0x25')]['ids'][_0x1f63('0x3f')];_0x2e68d5+=0x1){socket[_0x1f63('0x5e')](_0x1f63('0x6f'),{'UserId':Number(_0x4bcdc6[_0x1f63('0x25')]['ids'][_0x2e68d5]),'MailQueueId':Number(_0x4bcdc6['params']['id'])});}}else{socket[_0x1f63('0x5e')](_0x1f63('0x6f'),{'UserId':Number(_0x4bcdc6[_0x1f63('0x25')][_0x1f63('0x55')]),'MailQueueId':Number(_0x4bcdc6[_0x1f63('0x28')]['id'])});}});}})[_0x1f63('0x14')](respondWithStatusCode(_0x1038dc,null))[_0x1f63('0x31')](handleError(_0x1038dc,null));};exports[_0x1f63('0x72')]=function(_0x32af65,_0x577228){var _0x578126={};var _0x4630d4={};var _0x59e520;var _0x3ca7aa;return db[_0x1f63('0x1d')][_0x1f63('0x3d')]({'where':{'id':_0x32af65[_0x1f63('0x28')]['id']}})[_0x1f63('0x14')](handleEntityNotFound(_0x577228,null))[_0x1f63('0x14')](function(_0x48e503){if(_0x48e503){_0x59e520=_0x48e503;_0x4630d4[_0x1f63('0x29')]=_['keys'](db[_0x1f63('0x48')]['rawAttributes']);_0x4630d4[_0x1f63('0x25')]=_['keys'](_0x32af65[_0x1f63('0x25')]);_0x4630d4[_0x1f63('0x2b')]=_[_0x1f63('0x2c')](_0x4630d4[_0x1f63('0x29')],_0x4630d4[_0x1f63('0x25')]);_0x578126[_0x1f63('0x2d')]=_[_0x1f63('0x2c')](_0x4630d4['model'],qs[_0x1f63('0x2e')](_0x32af65[_0x1f63('0x25')][_0x1f63('0x2e')]));_0x578126[_0x1f63('0x2d')]=_0x578126[_0x1f63('0x2d')][_0x1f63('0x3f')]?_0x578126['attributes']:_0x4630d4['model'];_0x578126[_0x1f63('0x73')]=qs[_0x1f63('0x42')](_0x32af65[_0x1f63('0x25')][_0x1f63('0x42')]);_0x578126[_0x1f63('0x22')]=qs[_0x1f63('0x2b')](_[_0x1f63('0x43')](_0x32af65['query'],_0x4630d4[_0x1f63('0x2b')]));if(_0x32af65[_0x1f63('0x25')]['filter']){_0x578126[_0x1f63('0x22')]=_[_0x1f63('0x2f')](_0x578126[_0x1f63('0x22')],{'$or':_[_0x1f63('0x1c')](_0x578126[_0x1f63('0x2d')],function(_0x47cac7){var _0x1bbe74={};_0x1bbe74[_0x47cac7]={'$like':'%'+_0x32af65['query'][_0x1f63('0x45')]+'%'};return _0x1bbe74;})});}_0x578126=_[_0x1f63('0x2f')]({},_0x578126,_0x32af65[_0x1f63('0x46')]);return _0x59e520[_0x1f63('0x72')](_0x578126);}})[_0x1f63('0x14')](function(_0x40f654){if(_0x40f654){_0x3ca7aa=_0x40f654['length'];if(!_0x32af65[_0x1f63('0x25')][_0x1f63('0x40')](_0x1f63('0x41'))){_0x578126['limit']=qs[_0x1f63('0x10')](_0x32af65[_0x1f63('0x25')][_0x1f63('0x10')]);_0x578126[_0x1f63('0xe')]=qs[_0x1f63('0xe')](_0x32af65[_0x1f63('0x25')][_0x1f63('0xe')]);}return _0x59e520[_0x1f63('0x72')](_0x578126);}})['then'](function(_0x4d49f0){if(_0x4d49f0){return _0x4d49f0?{'count':_0x3ca7aa,'rows':_0x4d49f0}:null;}})['then'](respondWithResult(_0x577228,null))['catch'](handleError(_0x577228,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8e9fa50..20be156 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 _0xc49d=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue'];(function(_0x50e17f,_0x37087b){var _0x217e8b=function(_0x812692){while(--_0x812692){_0x50e17f['push'](_0x50e17f['shift']());}};_0x217e8b(++_0x37087b);}(_0xc49d,0x141));var _0xdc49=function(_0x4ec288,_0x204b67){_0x4ec288=_0x4ec288-0x0;var _0x49b4ad=_0xc49d[_0x4ec288];return _0x49b4ad;};'use strict';var EventEmitter=require(_0xdc49('0x0'));var MailQueue=require(_0xdc49('0x1'))['db'][_0xdc49('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdc49('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc49('0x4'),'afterDestroy':_0xdc49('0x5')};function emitEvent(_0x2be4d8){return function(_0x3d7962,_0x5370bc,_0x249659){MailQueueEvents[_0xdc49('0x6')](_0x2be4d8+':'+_0x3d7962['id'],_0x3d7962);MailQueueEvents['emit'](_0x2be4d8,_0x3d7962);_0x249659(null);};}for(var e in events){if(events[_0xdc49('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xdc49('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x8b7c=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x5b78fe,_0x44542c){var _0x24ac3c=function(_0x552b51){while(--_0x552b51){_0x5b78fe['push'](_0x5b78fe['shift']());}};_0x24ac3c(++_0x44542c);}(_0x8b7c,0x15c));var _0xc8b7=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x8b7c[_0x2fb87c];return _0x43038b;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc8b7('0x0'))['db'][_0xc8b7('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc8b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc8b7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x484e2e){return function(_0x553433,_0x1229bc,_0x5f244e){MailQueueEvents['emit'](_0x484e2e+':'+_0x553433['id'],_0x553433);MailQueueEvents[_0xc8b7('0x4')](_0x484e2e,_0x553433);_0x5f244e(null);};}for(var e in events){if(events[_0xc8b7('0x5')](e)){var event=events[e];MailQueue[_0xc8b7('0x6')](e,emitEvent(event));}}module[_0xc8b7('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5fbcd39..1044da8 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 _0xf580=['exports','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','path','./mailQueue.attributes'];(function(_0x4de5be,_0x25aaae){var _0x40c385=function(_0xdec86f){while(--_0xdec86f){_0x4de5be['push'](_0x4de5be['shift']());}};_0x40c385(++_0x25aaae);}(_0xf580,0x70));var _0x0f58=function(_0x4e7d65,_0x1436f3){_0x4e7d65=_0x4e7d65-0x0;var _0xa8de2e=_0xf580[_0x4e7d65];return _0xa8de2e;};'use strict';var _=require(_0x0f58('0x0'));var util=require(_0x0f58('0x1'));var logger=require(_0x0f58('0x2'))(_0x0f58('0x3'));var moment=require(_0x0f58('0x4'));var BPromise=require(_0x0f58('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f58('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f58('0x7'));module[_0x0f58('0x8')]=function(_0x2277c2,_0x35f80b){return _0x2277c2['define'](_0x0f58('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe646=['path','rimraf','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4cb2dd,_0x21e6b1){var _0x3dda8f=function(_0x3931a1){while(--_0x3931a1){_0x4cb2dd['push'](_0x4cb2dd['shift']());}};_0x3dda8f(++_0x21e6b1);}(_0xe646,0x19e));var _0x6e64=function(_0x337e96,_0x4bc365){_0x337e96=_0x337e96-0x0;var _0xcf84=_0xe646[_0x337e96];return _0xcf84;};'use strict';var _=require(_0x6e64('0x0'));var util=require(_0x6e64('0x1'));var logger=require(_0x6e64('0x2'))('api');var moment=require(_0x6e64('0x3'));var BPromise=require(_0x6e64('0x4'));var rp=require(_0x6e64('0x5'));var fs=require('fs');var path=require(_0x6e64('0x6'));var rimraf=require(_0x6e64('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6e64('0x8')]=function(_0x390e7b,_0x28633a){return _0x390e7b[_0x6e64('0x9')](_0x6e64('0xa'),attributes,{'tableName':_0x6e64('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 d6e86a4..9a944ff 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 _0x2bfe=['include','model','map','then','ShowMailQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','debug','stringify','error','MailQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit'];(function(_0x3c97d6,_0x4e97b6){var _0x168184=function(_0xcf80c8){while(--_0xcf80c8){_0x3c97d6['push'](_0x3c97d6['shift']());}};_0x168184(++_0x4e97b6);}(_0x2bfe,0x125));var _0xe2bf=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x2bfe[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xe2bf('0x0'));var util=require(_0xe2bf('0x1'));var moment=require('moment');var BPromise=require(_0xe2bf('0x2'));var rs=require(_0xe2bf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2bf('0x4'))['db'];var utils=require(_0xe2bf('0x5'));var logger=require(_0xe2bf('0x6'))(_0xe2bf('0x7'));var config=require(_0xe2bf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe2bf('0x9')][_0xe2bf('0xa')]({'port':0x232a});config[_0xe2bf('0xb')]=_[_0xe2bf('0xc')](config['redis'],{'host':_0xe2bf('0xd'),'port':0x18eb});var socket=require(_0xe2bf('0xe'))(new Redis(config[_0xe2bf('0xb')]));require(_0xe2bf('0xf'))[_0xe2bf('0x10')](socket);function respondWithRpcPromise(_0x27b741,_0x5b5d23,_0x474294){return new BPromise(function(_0x432e5c,_0x37dcb7){return client[_0xe2bf('0x11')](_0x27b741,_0x474294)['then'](function(_0x63074c){logger[_0xe2bf('0x12')]('MailQueue,\x20%s,\x20%s',_0x5b5d23,'request\x20sent');logger[_0xe2bf('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x5b5d23,'request\x20sent',JSON[_0xe2bf('0x14')](_0x63074c));if(_0x63074c[_0xe2bf('0x15')]){if(_0x63074c['error']['code']===0x1f4){logger[_0xe2bf('0x15')](_0xe2bf('0x16'),_0x5b5d23,_0x63074c[_0xe2bf('0x15')][_0xe2bf('0x17')]);return _0x37dcb7(_0x63074c[_0xe2bf('0x15')][_0xe2bf('0x17')]);}logger[_0xe2bf('0x15')]('MailQueue,\x20%s,\x20%s',_0x5b5d23,_0x63074c['error'][_0xe2bf('0x17')]);return _0x432e5c(_0x63074c[_0xe2bf('0x15')]['message']);}else{logger[_0xe2bf('0x12')]('MailQueue,\x20%s,\x20%s',_0x5b5d23,_0xe2bf('0x18'));_0x432e5c(_0x63074c[_0xe2bf('0x19')]['message']);}})[_0xe2bf('0x1a')](function(_0x33d903){logger[_0xe2bf('0x15')](_0xe2bf('0x16'),_0x5b5d23,_0x33d903);_0x37dcb7(_0x33d903);});});}exports[_0xe2bf('0x1b')]=function(_0x341abd){var _0x3bd106=this;return new Promise(function(_0x57788b,_0x37c919){return db[_0xe2bf('0x1c')][_0xe2bf('0x1d')]({'raw':_0x341abd[_0xe2bf('0x1e')]?_0x341abd['options'][_0xe2bf('0x1f')]===undefined?!![]:![]:!![],'where':_0x341abd[_0xe2bf('0x1e')]?_0x341abd[_0xe2bf('0x1e')][_0xe2bf('0x20')]||null:null,'attributes':_0x341abd['options']?_0x341abd['options'][_0xe2bf('0x21')]||null:null,'limit':_0x341abd[_0xe2bf('0x1e')]?_0x341abd[_0xe2bf('0x1e')][_0xe2bf('0x22')]||null:null,'include':_0x341abd['options']?_0x341abd[_0xe2bf('0x1e')][_0xe2bf('0x23')]?_['map'](_0x341abd[_0xe2bf('0x1e')][_0xe2bf('0x23')],function(_0x18ed7b){return{'model':db[_0x18ed7b[_0xe2bf('0x24')]],'as':_0x18ed7b['as'],'attributes':_0x18ed7b[_0xe2bf('0x21')],'include':_0x18ed7b['include']?_[_0xe2bf('0x25')](_0x18ed7b[_0xe2bf('0x23')],function(_0x1140e7){return{'model':db[_0x1140e7[_0xe2bf('0x24')]],'as':_0x1140e7['as'],'attributes':_0x1140e7[_0xe2bf('0x21')],'include':_0x1140e7[_0xe2bf('0x23')]?_[_0xe2bf('0x25')](_0x1140e7['include'],function(_0x237387){return{'model':db[_0x237387[_0xe2bf('0x24')]],'as':_0x237387['as'],'attributes':_0x237387[_0xe2bf('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe2bf('0x26')](function(_0x37ef67){logger[_0xe2bf('0x12')](_0xe2bf('0x1b'),_0x341abd);logger['debug'](_0xe2bf('0x1b'),_0x341abd,JSON[_0xe2bf('0x14')](_0x37ef67));_0x57788b(_0x37ef67);})[_0xe2bf('0x1a')](function(_0x3a35a1){logger[_0xe2bf('0x15')](_0xe2bf('0x1b'),_0x3a35a1[_0xe2bf('0x17')],_0x341abd);_0x37c919(_0x3bd106[_0xe2bf('0x15')](0x1f4,_0x3a35a1[_0xe2bf('0x17')]));});});};exports[_0xe2bf('0x27')]=function(_0x2e07c7){var _0xa50635=this;return new Promise(function(_0x5ad578,_0xc5b1cf){return db[_0xe2bf('0x1c')][_0xe2bf('0x28')]({'raw':_0x2e07c7['options']?_0x2e07c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e07c7[_0xe2bf('0x1e')]?_0x2e07c7[_0xe2bf('0x1e')]['where']||null:null,'attributes':_0x2e07c7['options']?_0x2e07c7['options'][_0xe2bf('0x21')]||null:null,'include':_0x2e07c7[_0xe2bf('0x1e')]?_0x2e07c7['options']['include']?_[_0xe2bf('0x25')](_0x2e07c7[_0xe2bf('0x1e')][_0xe2bf('0x23')],function(_0x154d5b){return{'model':db[_0x154d5b[_0xe2bf('0x24')]],'as':_0x154d5b['as'],'attributes':_0x154d5b[_0xe2bf('0x21')],'include':_0x154d5b[_0xe2bf('0x23')]?_[_0xe2bf('0x25')](_0x154d5b[_0xe2bf('0x23')],function(_0x12a1ee){return{'model':db[_0x12a1ee['model']],'as':_0x12a1ee['as'],'attributes':_0x12a1ee[_0xe2bf('0x21')],'include':_0x12a1ee[_0xe2bf('0x23')]?_[_0xe2bf('0x25')](_0x12a1ee['include'],function(_0x3a2c31){return{'model':db[_0x3a2c31[_0xe2bf('0x24')]],'as':_0x3a2c31['as'],'attributes':_0x3a2c31[_0xe2bf('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe2bf('0x26')](function(_0x401720){logger[_0xe2bf('0x12')]('ShowMailQueue',_0x2e07c7);logger[_0xe2bf('0x13')](_0xe2bf('0x27'),_0x2e07c7,JSON['stringify'](_0x401720));_0x5ad578(_0x401720);})[_0xe2bf('0x1a')](function(_0x2276fe){logger[_0xe2bf('0x15')]('ShowMailQueue',_0x2276fe[_0xe2bf('0x17')],_0x2e07c7);_0xc5b1cf(_0xa50635[_0xe2bf('0x15')](0x1f4,_0x2276fe[_0xe2bf('0x17')]));});});}; \ No newline at end of file +var _0xf377=['MailQueue','findAll','options','raw','attributes','include','map','model','ShowMailQueue','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','localhost','socket.io-emitter','then','request\x20sent','debug','stringify','error','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf377,0x113));var _0x7f37=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xf377[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7f37('0x0'));var util=require(_0x7f37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7f37('0x2'));var fs=require('fs');var Redis=require(_0x7f37('0x3'));var db=require(_0x7f37('0x4'))['db'];var utils=require(_0x7f37('0x5'));var logger=require('../../config/logger')(_0x7f37('0x6'));var config=require('../../config/environment');var jayson=require(_0x7f37('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x7f37('0x8')]=_['defaults'](config[_0x7f37('0x8')],{'host':_0x7f37('0x9'),'port':0x18eb});var socket=require(_0x7f37('0xa'))(new Redis(config[_0x7f37('0x8')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x29a840,_0x4db08e,_0x1fb324){return new BPromise(function(_0x5988ef,_0x3cf538){return client['request'](_0x29a840,_0x1fb324)[_0x7f37('0xb')](function(_0x191dd9){logger['info']('MailQueue,\x20%s,\x20%s',_0x4db08e,_0x7f37('0xc'));logger[_0x7f37('0xd')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4db08e,_0x7f37('0xc'),JSON[_0x7f37('0xe')](_0x191dd9));if(_0x191dd9['error']){if(_0x191dd9['error']['code']===0x1f4){logger[_0x7f37('0xf')](_0x7f37('0x10'),_0x4db08e,_0x191dd9[_0x7f37('0xf')]['message']);return _0x3cf538(_0x191dd9[_0x7f37('0xf')][_0x7f37('0x11')]);}logger[_0x7f37('0xf')](_0x7f37('0x10'),_0x4db08e,_0x191dd9['error']['message']);return _0x5988ef(_0x191dd9[_0x7f37('0xf')][_0x7f37('0x11')]);}else{logger[_0x7f37('0x12')](_0x7f37('0x10'),_0x4db08e,_0x7f37('0xc'));_0x5988ef(_0x191dd9[_0x7f37('0x13')][_0x7f37('0x11')]);}})[_0x7f37('0x14')](function(_0x4710cf){logger['error']('MailQueue,\x20%s,\x20%s',_0x4db08e,_0x4710cf);_0x3cf538(_0x4710cf);});});}exports[_0x7f37('0x15')]=function(_0x321367){var _0x12fe8b=this;return new Promise(function(_0x4850ac,_0x3bcb88){return db[_0x7f37('0x16')][_0x7f37('0x17')]({'raw':_0x321367[_0x7f37('0x18')]?_0x321367[_0x7f37('0x18')][_0x7f37('0x19')]===undefined?!![]:![]:!![],'where':_0x321367['options']?_0x321367[_0x7f37('0x18')]['where']||null:null,'attributes':_0x321367[_0x7f37('0x18')]?_0x321367['options'][_0x7f37('0x1a')]||null:null,'limit':_0x321367[_0x7f37('0x18')]?_0x321367[_0x7f37('0x18')]['limit']||null:null,'include':_0x321367[_0x7f37('0x18')]?_0x321367[_0x7f37('0x18')][_0x7f37('0x1b')]?_[_0x7f37('0x1c')](_0x321367['options']['include'],function(_0x15da60){return{'model':db[_0x15da60[_0x7f37('0x1d')]],'as':_0x15da60['as'],'attributes':_0x15da60['attributes'],'include':_0x15da60[_0x7f37('0x1b')]?_[_0x7f37('0x1c')](_0x15da60['include'],function(_0x32b65a){return{'model':db[_0x32b65a['model']],'as':_0x32b65a['as'],'attributes':_0x32b65a['attributes'],'include':_0x32b65a[_0x7f37('0x1b')]?_[_0x7f37('0x1c')](_0x32b65a[_0x7f37('0x1b')],function(_0xc024de){return{'model':db[_0xc024de[_0x7f37('0x1d')]],'as':_0xc024de['as'],'attributes':_0xc024de['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f37('0xb')](function(_0x5a2ef4){logger['info']('GetMailQueue',_0x321367);logger[_0x7f37('0xd')]('GetMailQueue',_0x321367,JSON['stringify'](_0x5a2ef4));_0x4850ac(_0x5a2ef4);})[_0x7f37('0x14')](function(_0x5f1260){logger[_0x7f37('0xf')](_0x7f37('0x15'),_0x5f1260[_0x7f37('0x11')],_0x321367);_0x3bcb88(_0x12fe8b[_0x7f37('0xf')](0x1f4,_0x5f1260[_0x7f37('0x11')]));});});};exports[_0x7f37('0x1e')]=function(_0x1a7abf){var _0x3ae011=this;return new Promise(function(_0x46c2e2,_0x53a3dc){return db['MailQueue'][_0x7f37('0x1f')]({'raw':_0x1a7abf['options']?_0x1a7abf[_0x7f37('0x18')][_0x7f37('0x19')]===undefined?!![]:![]:!![],'where':_0x1a7abf['options']?_0x1a7abf[_0x7f37('0x18')][_0x7f37('0x20')]||null:null,'attributes':_0x1a7abf[_0x7f37('0x18')]?_0x1a7abf[_0x7f37('0x18')]['attributes']||null:null,'include':_0x1a7abf[_0x7f37('0x18')]?_0x1a7abf[_0x7f37('0x18')]['include']?_[_0x7f37('0x1c')](_0x1a7abf['options'][_0x7f37('0x1b')],function(_0x3ba2ba){return{'model':db[_0x3ba2ba[_0x7f37('0x1d')]],'as':_0x3ba2ba['as'],'attributes':_0x3ba2ba[_0x7f37('0x1a')],'include':_0x3ba2ba['include']?_[_0x7f37('0x1c')](_0x3ba2ba['include'],function(_0x10ebed){return{'model':db[_0x10ebed[_0x7f37('0x1d')]],'as':_0x10ebed['as'],'attributes':_0x10ebed[_0x7f37('0x1a')],'include':_0x10ebed[_0x7f37('0x1b')]?_[_0x7f37('0x1c')](_0x10ebed['include'],function(_0x1a9845){return{'model':db[_0x1a9845[_0x7f37('0x1d')]],'as':_0x1a9845['as'],'attributes':_0x1a9845['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f37('0xb')](function(_0x183c73){logger[_0x7f37('0x12')](_0x7f37('0x1e'),_0x1a7abf);logger[_0x7f37('0xd')]('ShowMailQueue',_0x1a7abf,JSON[_0x7f37('0xe')](_0x183c73));_0x46c2e2(_0x183c73);})[_0x7f37('0x14')](function(_0x3dee11){logger[_0x7f37('0xf')](_0x7f37('0x1e'),_0x3dee11[_0x7f37('0x11')],_0x1a7abf);_0x53a3dc(_0x3ae011['error'](0x1f4,_0x3dee11[_0x7f37('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 992326e..6f30110 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 _0xa098=['emit','removeListener','register','length','./mailQueue.events','remove'];(function(_0x11d9ad,_0x3907e8){var _0x567ada=function(_0x502ef1){while(--_0x502ef1){_0x11d9ad['push'](_0x11d9ad['shift']());}};_0x567ada(++_0x3907e8);}(_0xa098,0x94));var _0x8a09=function(_0x5692d9,_0x338288){_0x5692d9=_0x5692d9-0x0;var _0x23c79f=_0xa098[_0x5692d9];return _0x23c79f;};'use strict';var MailQueueEvents=require(_0x8a09('0x0'));var events=['save',_0x8a09('0x1'),'update'];function createListener(_0x7f3101,_0x25d672){return function(_0x110fa8){_0x25d672[_0x8a09('0x2')](_0x7f3101,_0x110fa8);};}function removeListener(_0x1d1119,_0x40974a){return function(){MailQueueEvents[_0x8a09('0x3')](_0x1d1119,_0x40974a);};}exports[_0x8a09('0x4')]=function(_0x222610){for(var _0x8b332e=0x0,_0x1401ce=events[_0x8a09('0x5')];_0x8b332e<_0x1401ce;_0x8b332e++){var _0x1573c2=events[_0x8b332e];var _0x70d00c=createListener('mailQueue:'+_0x1573c2,_0x222610);MailQueueEvents['on'](_0x1573c2,_0x70d00c);}}; \ No newline at end of file +var _0x14d0=['mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x29d6f1,_0x4465c0){var _0x3cd8b8=function(_0x4b8069){while(--_0x4b8069){_0x29d6f1['push'](_0x29d6f1['shift']());}};_0x3cd8b8(++_0x4465c0);}(_0x14d0,0x127));var _0x014d=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x14d0[_0x173452];return _0xee3fd0;};'use strict';var MailQueueEvents=require(_0x014d('0x0'));var events=[_0x014d('0x1'),_0x014d('0x2'),'update'];function createListener(_0x5efdee,_0x4939eb){return function(_0x44348d){_0x4939eb[_0x014d('0x3')](_0x5efdee,_0x44348d);};}function removeListener(_0x3f02b8,_0x4e6a11){return function(){MailQueueEvents[_0x014d('0x4')](_0x3f02b8,_0x4e6a11);};}exports['register']=function(_0x33d3ae){for(var _0x422af7=0x0,_0x19fc90=events['length'];_0x422af7<_0x19fc90;_0x422af7++){var _0x5aecf7=events[_0x422af7];var _0x3df439=createListener(_0x014d('0x5')+_0x5aecf7,_0x33d3ae);MailQueueEvents['on'](_0x5aecf7,_0x3df439);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1f7e4cc..ec05da8 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 _0x847b=['index','get','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x847b,0x161));var _0xb847=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x847b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb847('0x0'));var util=require(_0xb847('0x1'));var path=require('path');var timeout=require(_0xb847('0x2'));var express=require('express');var router=express[_0xb847('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb847('0x4'));var config=require(_0xb847('0x5'));var controller=require(_0xb847('0x6'));router['get']('/',auth[_0xb847('0x7')](),controller[_0xb847('0x8')]);router[_0xb847('0x9')](_0xb847('0xa'),auth[_0xb847('0x7')](),controller[_0xb847('0xb')]);router[_0xb847('0x9')](_0xb847('0xc'),auth[_0xb847('0x7')](),controller[_0xb847('0xd')]);router[_0xb847('0xe')]('/',auth[_0xb847('0x7')](),controller['create']);router[_0xb847('0xf')](_0xb847('0xc'),auth['isAuthenticated'](),controller[_0xb847('0x10')]);router[_0xb847('0x11')](_0xb847('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb847('0x12')]=router; \ No newline at end of file +var _0x6789=['/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','/describe','isAuthenticated','show','post','create','put','delete'];(function(_0x16ec4a,_0x259794){var _0x197e0b=function(_0x174336){while(--_0x174336){_0x16ec4a['push'](_0x16ec4a['shift']());}};_0x197e0b(++_0x259794);}(_0x6789,0x16b));var _0x9678=function(_0x4a49c1,_0x407b24){_0x4a49c1=_0x4a49c1-0x0;var _0x3901b5=_0x6789[_0x4a49c1];return _0x3901b5;};'use strict';var multer=require(_0x9678('0x0'));var util=require('util');var path=require(_0x9678('0x1'));var timeout=require(_0x9678('0x2'));var express=require(_0x9678('0x3'));var router=express[_0x9678('0x4')]();var fs_extra=require(_0x9678('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9678('0x6'));var config=require(_0x9678('0x7'));var controller=require(_0x9678('0x8'));router[_0x9678('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9678('0x9')](_0x9678('0xa'),auth[_0x9678('0xb')](),controller['describe']);router[_0x9678('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9678('0xc')]);router[_0x9678('0xd')]('/',auth['isAuthenticated'](),controller[_0x9678('0xe')]);router[_0x9678('0xf')]('/:id',auth[_0x9678('0xb')](),controller['update']);router[_0x9678('0x10')](_0x9678('0x11'),auth[_0x9678('0xb')](),controller[_0x9678('0x12')]);module[_0x9678('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 20a3d1c..161f9a3 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 _0x031f=['STRING','DATE','moment','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x031f,0x1c2));var _0xf031=function(_0x13d00f,_0x30af69){_0x13d00f=_0x13d00f-0x0;var _0x1b24be=_0x031f[_0x13d00f];return _0x1b24be;};'use strict';var moment=require(_0xf031('0x0'));var Sequelize=require('sequelize');module[_0xf031('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf031('0x2')]},'joinAt':{'type':Sequelize[_0xf031('0x3')]},'leaveAt':{'type':Sequelize[_0xf031('0x3')]},'acceptAt':{'type':Sequelize[_0xf031('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf031('0x2')]}}; \ No newline at end of file +var _0x5495=['DATE','sequelize','exports','STRING'];(function(_0x5b28c2,_0x808665){var _0x15d58d=function(_0x208c3a){while(--_0x208c3a){_0x5b28c2['push'](_0x5b28c2['shift']());}};_0x15d58d(++_0x808665);}(_0x5495,0x6d));var _0x5549=function(_0x1fa7a8,_0x4d3668){_0x1fa7a8=_0x1fa7a8-0x0;var _0x17f88d=_0x5495[_0x1fa7a8];return _0x17f88d;};'use strict';var moment=require('moment');var Sequelize=require(_0x5549('0x0'));module[_0x5549('0x1')]={'uniqueid':{'type':Sequelize[_0x5549('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5549('0x2')]},'joinAt':{'type':Sequelize[_0x5549('0x3')]},'leaveAt':{'type':Sequelize[_0x5549('0x3')]},'acceptAt':{'type':Sequelize[_0x5549('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5549('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b573d7f..f40458d 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 _0x3d04=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x100723,_0x2a98b1){var _0x475c29=function(_0x19db8b){while(--_0x19db8b){_0x100723['push'](_0x100723['shift']());}};_0x475c29(++_0x2a98b1);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c111,_0x44497b){return function(_0x5dd310){if(!_0x5dd310){_0x29c111[_0x43d0('0x16')](0x194);}return _0x5dd310;};}function handleError(_0x238c64,_0x5ac4c0){_0x5ac4c0=_0x5ac4c0||0x1f4;return function(_0x12df30){logger[_0x43d0('0x24')](_0x12df30[_0x43d0('0x25')]);if(_0x12df30['name']){delete _0x12df30[_0x43d0('0x26')];}_0x238c64[_0x43d0('0x17')](_0x5ac4c0)[_0x43d0('0x27')](_0x12df30);};}exports[_0x43d0('0x28')]=function(_0x37d78f,_0x440ecb){var _0x31a057={},_0x4a3cd4={},_0x2b0784={'count':0x0,'rows':[]};var _0x2f5bc5=_[_0x43d0('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x52c37b){return{'name':_0x52c37b[_0x43d0('0x2a')],'type':_0x52c37b[_0x43d0('0x2b')][_0x43d0('0x2c')]};});_0x4a3cd4[_0x43d0('0x2d')]=_[_0x43d0('0x29')](_0x2f5bc5,_0x43d0('0x26'));_0x4a3cd4['query']=_[_0x43d0('0x2e')](_0x37d78f[_0x43d0('0x2f')]);_0x4a3cd4[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],_0x4a3cd4[_0x43d0('0x2f')]);_0x31a057[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x37d78f[_0x43d0('0x2f')]['fields']));_0x31a057[_0x43d0('0x32')]=_0x31a057[_0x43d0('0x32')][_0x43d0('0x34')]?_0x31a057[_0x43d0('0x32')]:_0x4a3cd4['model'];if(!_0x37d78f[_0x43d0('0x2f')]['hasOwnProperty'](_0x43d0('0x35'))){_0x31a057[_0x43d0('0x19')]=qs['limit'](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x19')]);_0x31a057[_0x43d0('0x1c')]=qs[_0x43d0('0x1c')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x1c')]);}_0x31a057[_0x43d0('0x36')]=qs[_0x43d0('0x37')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x37')]);_0x31a057[_0x43d0('0x38')]=qs['filters'](_[_0x43d0('0x39')](_0x37d78f[_0x43d0('0x2f')],_0x4a3cd4[_0x43d0('0x30')]),_0x2f5bc5);if(_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x3a')]){_0x31a057[_0x43d0('0x38')]=_[_0x43d0('0x3b')](_0x31a057[_0x43d0('0x38')],{'$or':_[_0x43d0('0x29')](_0x2f5bc5,function(_0x43bcc5){if(_0x43bcc5[_0x43d0('0x2b')]!==_0x43d0('0x3c')){var _0x19843c={};_0x19843c[_0x43bcc5[_0x43d0('0x26')]]={'$like':'%'+_0x37d78f['query'][_0x43d0('0x3a')]+'%'};return _0x19843c;}})});}_0x31a057=_[_0x43d0('0x3b')]({},_0x31a057,_0x37d78f[_0x43d0('0x3d')]);var _0xc3f9c7={'where':_0x31a057[_0x43d0('0x38')]};return db[_0x43d0('0x3e')][_0x43d0('0x1b')](_0xc3f9c7)[_0x43d0('0x22')](function(_0x4ae965){_0x2b0784['count']=_0x4ae965;if(_0x37d78f[_0x43d0('0x2f')]['includeAll']){_0x31a057['include']=[{'all':!![]}];}return db[_0x43d0('0x3e')]['findAll'](_0x31a057);})[_0x43d0('0x22')](function(_0x5027d0){_0x2b0784[_0x43d0('0x3f')]=_0x5027d0;return _0x2b0784;})['then'](respondWithFilteredResult(_0x440ecb,_0x31a057))[_0x43d0('0x40')](handleError(_0x440ecb,null));};exports[_0x43d0('0x41')]=function(_0x468b32,_0x4e817e){var _0x3eb2e9={'raw':!![],'where':{'id':_0x468b32[_0x43d0('0x42')]['id']}},_0x520406={};_0x520406['model']=_['keys'](db[_0x43d0('0x3e')][_0x43d0('0x43')]);_0x520406['query']=_[_0x43d0('0x2e')](_0x468b32[_0x43d0('0x2f')]);_0x520406[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],_0x520406['query']);_0x3eb2e9[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x468b32['query'][_0x43d0('0x33')]));_0x3eb2e9[_0x43d0('0x32')]=_0x3eb2e9[_0x43d0('0x32')][_0x43d0('0x34')]?_0x3eb2e9[_0x43d0('0x32')]:_0x520406['model'];if(_0x468b32[_0x43d0('0x2f')][_0x43d0('0x44')]){_0x3eb2e9['include']=[{'all':!![]}];}_0x3eb2e9=_[_0x43d0('0x3b')]({},_0x3eb2e9,_0x468b32[_0x43d0('0x3d')]);return db[_0x43d0('0x3e')]['find'](_0x3eb2e9)[_0x43d0('0x22')](handleEntityNotFound(_0x4e817e,null))['then'](respondWithResult(_0x4e817e,null))[_0x43d0('0x40')](handleError(_0x4e817e,null));};exports['create']=function(_0x1f55e9,_0x269d99){return db[_0x43d0('0x3e')][_0x43d0('0x45')](_0x1f55e9[_0x43d0('0x46')],{})['then'](respondWithResult(_0x269d99,0xc9))[_0x43d0('0x40')](handleError(_0x269d99,null));};exports['update']=function(_0x5a6364,_0x3e7392){if(_0x5a6364[_0x43d0('0x46')]['id']){delete _0x5a6364[_0x43d0('0x46')]['id'];}return db[_0x43d0('0x3e')][_0x43d0('0x47')]({'where':{'id':_0x5a6364[_0x43d0('0x42')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3e7392,null))[_0x43d0('0x22')](saveUpdates(_0x5a6364[_0x43d0('0x46')],null))[_0x43d0('0x22')](respondWithResult(_0x3e7392,null))[_0x43d0('0x40')](handleError(_0x3e7392,null));};exports['destroy']=function(_0x338203,_0xd78af1){return db[_0x43d0('0x3e')]['find']({'where':{'id':_0x338203[_0x43d0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd78af1,null))['then'](removeEntity(_0xd78af1,null))[_0x43d0('0x40')](handleError(_0xd78af1,null));};exports[_0x43d0('0x48')]=function(_0x234571,_0x127815){return db[_0x43d0('0x3e')]['describe']()['then'](respondWithResult(_0x127815,null))[_0x43d0('0x40')](handleError(_0x127815,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x22a89f,_0x351e1b){var _0x7c28f2=function(_0x7c09ab){while(--_0x7c09ab){_0x22a89f['push'](_0x22a89f['shift']());}};_0x7c28f2(++_0x351e1b);}(_0xd943,0x15d));var _0x3d94=function(_0x4d9c2f,_0x48afcb){_0x4d9c2f=_0x4d9c2f-0x0;var _0x2204b5=_0xd943[_0x4d9c2f];return _0x2204b5;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':!![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['MailQueueReport']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0c2ca62..805dea6 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 _0x6a7d=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6a7d,0x12f));var _0xd6a7=function(_0x39531c,_0x4e4dfb){_0x39531c=_0x39531c-0x0;var _0x9dfc07=_0x6a7d[_0x39531c];return _0x9dfc07;};'use strict';var _=require(_0xd6a7('0x0'));var util=require(_0xd6a7('0x1'));var logger=require(_0xd6a7('0x2'))('api');var moment=require(_0xd6a7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6a7('0x4'));var fs=require('fs');var path=require(_0xd6a7('0x5'));var rimraf=require(_0xd6a7('0x6'));var config=require(_0xd6a7('0x7'));var attributes=require(_0xd6a7('0x8'));module[_0xd6a7('0x9')]=function(_0x42f4cd,_0x23a6dd){return _0x42f4cd[_0xd6a7('0xa')](_0xd6a7('0xb'),attributes,{'tableName':_0xd6a7('0xc'),'paranoid':![],'indexes':[{'name':_0xd6a7('0xd'),'fields':[_0xd6a7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6906=['path','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb8abe,_0x44b937){var _0x1eb6e6=function(_0x4337b8){while(--_0x4337b8){_0xb8abe['push'](_0xb8abe['shift']());}};_0x1eb6e6(++_0x44b937);}(_0x6906,0x1da));var _0x6690=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6906[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6690('0x0'));var util=require(_0x6690('0x1'));var logger=require(_0x6690('0x2'))(_0x6690('0x3'));var moment=require(_0x6690('0x4'));var BPromise=require(_0x6690('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6690('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0x6690('0x7')]=function(_0x3e9fe0,_0x50b175){return _0x3e9fe0[_0x6690('0x8')](_0x6690('0x9'),attributes,{'tableName':_0x6690('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6690('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 289f8d9..ecaed68 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x3e13c0,_0x2584a5){var _0x1d6bd2=function(_0x339845){while(--_0x339845){_0x3e13c0['push'](_0x3e13c0['shift']());}};_0x1d6bd2(++_0x2584a5);}(_0x7a54,0x106));var _0x47a5=function(_0x550080,_0x54c259){_0x550080=_0x550080-0x0;var _0xc9d864=_0x7a54[_0x550080];return _0xc9d864;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +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(_0x9976d9,_0x4e7b84){var _0x447eb2=function(_0x148b4d){while(--_0x148b4d){_0x9976d9['push'](_0x9976d9['shift']());}};_0x447eb2(++_0x4e7b84);}(_0x1261,0x144));var _0x1126=function(_0x47d6c8,_0x4195c5){_0x47d6c8=_0x47d6c8-0x0;var _0x42e495=_0x1261[_0x47d6c8];return _0x42e495;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 36f300a..a9eb8bb 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x189331,_0x1a076f){var _0x17c2a2=function(_0x2b8122){while(--_0x2b8122){_0x189331['push'](_0x189331['shift']());}};_0x17c2a2(++_0x1a076f);}(_0xedd9,0xfc));var _0x9edd=function(_0xcec1bc,_0x5ce91b){_0xcec1bc=_0xcec1bc-0x0;var _0x47ed09=_0xedd9[_0xcec1bc];return _0x47ed09;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b9666,_0x2329f4){var _0x5663a1=function(_0x4e0da6){while(--_0x4e0da6){_0x5b9666['push'](_0x5b9666['shift']());}};_0x5663a1(++_0x2329f4);}(_0x70e0,0x17b));var _0x070e=function(_0x196114,_0xc67ea6){_0x196114=_0x196114-0x0;var _0x2cfb58=_0x70e0[_0x196114];return _0x2cfb58;};'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 5e9dfcf..fe8d9a5 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 _0x480e=['sequelize','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x202bbf,_0x91d31b){var _0x3c76ec=function(_0x4d0350){while(--_0x4d0350){_0x202bbf['push'](_0x202bbf['shift']());}};_0x3c76ec(++_0x91d31b);}(_0x480e,0x6e));var _0xe480=function(_0x290fdb,_0x3bf4a0){_0x290fdb=_0x290fdb-0x0;var _0x228c2b=_0x480e[_0x290fdb];return _0x228c2b;};'use strict';var Sequelize=require(_0xe480('0x0'));module['exports']={'description':{'type':Sequelize[_0xe480('0x1')]},'host':{'type':Sequelize[_0xe480('0x1')]},'authentication':{'type':Sequelize[_0xe480('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe480('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xe480('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe480('0x1')],'defaultValue':_0xe480('0x3')},'connTimeout':{'type':Sequelize[_0xe480('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xe480('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6f7b=['exports','STRING','BOOLEAN','INTEGER'];(function(_0xb633f0,_0x55651a){var _0x5eaeb7=function(_0xb4e031){while(--_0xb4e031){_0xb633f0['push'](_0xb633f0['shift']());}};_0x5eaeb7(++_0x55651a);}(_0x6f7b,0xe4));var _0xb6f7=function(_0x5c9b3c,_0x389f7c){_0x5c9b3c=_0x5c9b3c-0x0;var _0x4d643f=_0x6f7b[_0x5c9b3c];return _0x4d643f;};'use strict';var Sequelize=require('sequelize');module[_0xb6f7('0x0')]={'description':{'type':Sequelize[_0xb6f7('0x1')]},'host':{'type':Sequelize[_0xb6f7('0x1')]},'authentication':{'type':Sequelize[_0xb6f7('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb6f7('0x1')]},'port':{'type':Sequelize[_0xb6f7('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb6f7('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xb6f7('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb6f7('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f27c306..917d1a6 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 _0xcc99=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xec3f84,_0x285677){var _0x3d23a4=function(_0x373a21){while(--_0x373a21){_0xec3f84['push'](_0xec3f84['shift']());}};_0x3d23a4(++_0x285677);}(_0xcc99,0x19a));var _0x9cc9=function(_0x4d4705,_0x4baf01){_0x4d4705=_0x4d4705-0x0;var _0x3be576=_0xcc99[_0x4d4705];return _0x3be576;};'use strict';var _=require(_0x9cc9('0x0'));var util=require(_0x9cc9('0x1'));var logger=require(_0x9cc9('0x2'))(_0x9cc9('0x3'));var moment=require('moment');var BPromise=require(_0x9cc9('0x4'));var rp=require(_0x9cc9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cc9('0x6'));var config=require(_0x9cc9('0x7'));var attributes=require(_0x9cc9('0x8'));module[_0x9cc9('0x9')]=function(_0x2014e6,_0xc2d8af){return _0x2014e6[_0x9cc9('0xa')](_0x9cc9('0xb'),attributes,{'tableName':_0x9cc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f6b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','mail_servers_in','lodash'];(function(_0x1e5068,_0x31e9c4){var _0x2230b6=function(_0xaa2ee){while(--_0xaa2ee){_0x1e5068['push'](_0x1e5068['shift']());}};_0x2230b6(++_0x31e9c4);}(_0x9f6b,0x15d));var _0xb9f6=function(_0x21a79f,_0x82e211){_0x21a79f=_0x21a79f-0x0;var _0x4f9015=_0x9f6b[_0x21a79f];return _0x4f9015;};'use strict';var _=require(_0xb9f6('0x0'));var util=require('util');var logger=require(_0xb9f6('0x1'))(_0xb9f6('0x2'));var moment=require(_0xb9f6('0x3'));var BPromise=require(_0xb9f6('0x4'));var rp=require(_0xb9f6('0x5'));var fs=require('fs');var path=require(_0xb9f6('0x6'));var rimraf=require(_0xb9f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xb9f6('0x8'));module['exports']=function(_0x5508cd,_0x3b222d){return _0x5508cd['define']('MailServerIn',attributes,{'tableName':_0xb9f6('0x9'),'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 886f913..310ca45 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 _0xf681=['error','code','message','result','catch','GetMailServerIn','raw','where','options','limit','include','attributes','map','model','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x109454,_0x51827d){var _0x29dd10=function(_0x35565c){while(--_0x35565c){_0x109454['push'](_0x109454['shift']());}};_0x29dd10(++_0x51827d);}(_0xf681,0xc9));var _0x1f68=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf681[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var moment=require(_0x1f68('0x1'));var BPromise=require(_0x1f68('0x2'));var rs=require(_0x1f68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f68('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f68('0x5'))(_0x1f68('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f68('0x7'));var client=jayson[_0x1f68('0x8')][_0x1f68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f4146,_0x5c4d78,_0x165727){return new BPromise(function(_0x1eb9ac,_0x439289){return client['request'](_0x5f4146,_0x165727)[_0x1f68('0xa')](function(_0x2c2446){logger[_0x1f68('0xb')](_0x1f68('0xc'),_0x5c4d78,_0x1f68('0xd'));logger[_0x1f68('0xe')](_0x1f68('0xf'),_0x5c4d78,_0x1f68('0xd'),JSON['stringify'](_0x2c2446));if(_0x2c2446[_0x1f68('0x10')]){if(_0x2c2446[_0x1f68('0x10')][_0x1f68('0x11')]===0x1f4){logger[_0x1f68('0x10')](_0x1f68('0xc'),_0x5c4d78,_0x2c2446['error'][_0x1f68('0x12')]);return _0x439289(_0x2c2446[_0x1f68('0x10')][_0x1f68('0x12')]);}logger[_0x1f68('0x10')](_0x1f68('0xc'),_0x5c4d78,_0x2c2446[_0x1f68('0x10')][_0x1f68('0x12')]);return _0x1eb9ac(_0x2c2446[_0x1f68('0x10')][_0x1f68('0x12')]);}else{logger[_0x1f68('0xb')]('MailServerIn,\x20%s,\x20%s',_0x5c4d78,'request\x20sent');_0x1eb9ac(_0x2c2446[_0x1f68('0x13')][_0x1f68('0x12')]);}})[_0x1f68('0x14')](function(_0x708c7c){logger[_0x1f68('0x10')](_0x1f68('0xc'),_0x5c4d78,_0x708c7c);_0x439289(_0x708c7c);});});}exports[_0x1f68('0x15')]=function(_0x4f4b3c){var _0x5a3897=this;return new Promise(function(_0x88f063,_0x160115){return db['MailServerIn']['findAll']({'raw':_0x4f4b3c['options']?_0x4f4b3c['options'][_0x1f68('0x16')]===undefined?!![]:![]:!![],'where':_0x4f4b3c['options']?_0x4f4b3c['options'][_0x1f68('0x17')]||null:null,'attributes':_0x4f4b3c[_0x1f68('0x18')]?_0x4f4b3c[_0x1f68('0x18')]['attributes']||null:null,'limit':_0x4f4b3c[_0x1f68('0x18')]?_0x4f4b3c[_0x1f68('0x18')][_0x1f68('0x19')]||null:null,'include':_0x4f4b3c[_0x1f68('0x18')]?_0x4f4b3c[_0x1f68('0x18')][_0x1f68('0x1a')]?_['map'](_0x4f4b3c[_0x1f68('0x18')][_0x1f68('0x1a')],function(_0x3d7e5a){return{'model':db[_0x3d7e5a['model']],'as':_0x3d7e5a['as'],'attributes':_0x3d7e5a[_0x1f68('0x1b')],'include':_0x3d7e5a['include']?_['map'](_0x3d7e5a[_0x1f68('0x1a')],function(_0xdb5be5){return{'model':db[_0xdb5be5['model']],'as':_0xdb5be5['as'],'attributes':_0xdb5be5[_0x1f68('0x1b')],'include':_0xdb5be5['include']?_[_0x1f68('0x1c')](_0xdb5be5['include'],function(_0x57bf30){return{'model':db[_0x57bf30[_0x1f68('0x1d')]],'as':_0x57bf30['as'],'attributes':_0x57bf30[_0x1f68('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1f68('0xa')](function(_0xde3790){logger[_0x1f68('0xb')]('GetMailServerIn',_0x4f4b3c);logger[_0x1f68('0xe')](_0x1f68('0x15'),_0x4f4b3c,JSON[_0x1f68('0x1e')](_0xde3790));_0x88f063(_0xde3790);})[_0x1f68('0x14')](function(_0x36739b){logger['error']('GetMailServerIn',_0x36739b[_0x1f68('0x12')],_0x4f4b3c);_0x160115(_0x5a3897[_0x1f68('0x10')](0x1f4,_0x36739b[_0x1f68('0x12')]));});});}; \ No newline at end of file +var _0x6944=['error','message','result','catch','findAll','options','raw','where','include','map','model','attributes','GetMailServerIn','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x13d978,_0x2f0647){var _0x2b1557=function(_0x30c608){while(--_0x30c608){_0x13d978['push'](_0x13d978['shift']());}};_0x2b1557(++_0x2f0647);}(_0x6944,0xe6));var _0x4694=function(_0x46f2b1,_0x45afee){_0x46f2b1=_0x46f2b1-0x0;var _0x5a833c=_0x6944[_0x46f2b1];return _0x5a833c;};'use strict';var _=require(_0x4694('0x0'));var util=require(_0x4694('0x1'));var moment=require(_0x4694('0x2'));var BPromise=require(_0x4694('0x3'));var rs=require(_0x4694('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4694('0x5'));var logger=require('../../config/logger')(_0x4694('0x6'));var config=require(_0x4694('0x7'));var jayson=require(_0x4694('0x8'));var client=jayson[_0x4694('0x9')][_0x4694('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364038,_0x2e05a1,_0x56ae53){return new BPromise(function(_0x4c6703,_0x33cba1){return client[_0x4694('0xb')](_0x364038,_0x56ae53)[_0x4694('0xc')](function(_0x5d2bd5){logger[_0x4694('0xd')](_0x4694('0xe'),_0x2e05a1,_0x4694('0xf'));logger[_0x4694('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2e05a1,_0x4694('0xf'),JSON[_0x4694('0x11')](_0x5d2bd5));if(_0x5d2bd5[_0x4694('0x12')]){if(_0x5d2bd5[_0x4694('0x12')]['code']===0x1f4){logger[_0x4694('0x12')]('MailServerIn,\x20%s,\x20%s',_0x2e05a1,_0x5d2bd5[_0x4694('0x12')]['message']);return _0x33cba1(_0x5d2bd5[_0x4694('0x12')]['message']);}logger[_0x4694('0x12')](_0x4694('0xe'),_0x2e05a1,_0x5d2bd5['error'][_0x4694('0x13')]);return _0x4c6703(_0x5d2bd5[_0x4694('0x12')][_0x4694('0x13')]);}else{logger[_0x4694('0xd')](_0x4694('0xe'),_0x2e05a1,_0x4694('0xf'));_0x4c6703(_0x5d2bd5[_0x4694('0x14')][_0x4694('0x13')]);}})[_0x4694('0x15')](function(_0x208ed8){logger[_0x4694('0x12')](_0x4694('0xe'),_0x2e05a1,_0x208ed8);_0x33cba1(_0x208ed8);});});}exports['GetMailServerIn']=function(_0x757e28){var _0x1a0bf6=this;return new Promise(function(_0x25b769,_0x24f025){return db['MailServerIn'][_0x4694('0x16')]({'raw':_0x757e28[_0x4694('0x17')]?_0x757e28[_0x4694('0x17')][_0x4694('0x18')]===undefined?!![]:![]:!![],'where':_0x757e28[_0x4694('0x17')]?_0x757e28['options'][_0x4694('0x19')]||null:null,'attributes':_0x757e28[_0x4694('0x17')]?_0x757e28[_0x4694('0x17')]['attributes']||null:null,'limit':_0x757e28[_0x4694('0x17')]?_0x757e28[_0x4694('0x17')]['limit']||null:null,'include':_0x757e28['options']?_0x757e28['options'][_0x4694('0x1a')]?_[_0x4694('0x1b')](_0x757e28['options'][_0x4694('0x1a')],function(_0x856c19){return{'model':db[_0x856c19[_0x4694('0x1c')]],'as':_0x856c19['as'],'attributes':_0x856c19[_0x4694('0x1d')],'include':_0x856c19[_0x4694('0x1a')]?_[_0x4694('0x1b')](_0x856c19[_0x4694('0x1a')],function(_0x57b572){return{'model':db[_0x57b572['model']],'as':_0x57b572['as'],'attributes':_0x57b572[_0x4694('0x1d')],'include':_0x57b572[_0x4694('0x1a')]?_['map'](_0x57b572[_0x4694('0x1a')],function(_0x422f99){return{'model':db[_0x422f99[_0x4694('0x1c')]],'as':_0x422f99['as'],'attributes':_0x422f99[_0x4694('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11893c){logger[_0x4694('0xd')]('GetMailServerIn',_0x757e28);logger[_0x4694('0x10')](_0x4694('0x1e'),_0x757e28,JSON['stringify'](_0x11893c));_0x25b769(_0x11893c);})[_0x4694('0x15')](function(_0x29775c){logger[_0x4694('0x12')](_0x4694('0x1e'),_0x29775c['message'],_0x757e28);_0x24f025(_0x1a0bf6[_0x4694('0x12')](0x1f4,_0x29775c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cce76f4..db6aeb5 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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x925585,_0x5bc75e){_0x925585=_0x925585-0x0;var _0x22329c=_0x7a54[_0x925585];return _0x22329c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x5384e3,_0x2235bb){_0x5384e3=_0x5384e3-0x0;var _0x57a004=_0x7a54[_0x5384e3];return _0x57a004;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index a71fa1d..b78122c 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 _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x431e85,_0x941ba8){var _0x5532d4=function(_0x41003e){while(--_0x41003e){_0x431e85['push'](_0x431e85['shift']());}};_0x5532d4(++_0x941ba8);}(_0xc788,0xc4));var _0x8c78=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xc788[_0x419550];return _0x55f9ef;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'secure':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8c78('0x2')]},'authentication':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb574=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x7fd596,_0x3a2875){var _0x595292=function(_0x43d125){while(--_0x43d125){_0x7fd596['push'](_0x7fd596['shift']());}};_0x595292(++_0x3a2875);}(_0xb574,0x106));var _0x4b57=function(_0x2b67e5,_0x44ac20){_0x2b67e5=_0x2b67e5-0x0;var _0x5e9547=_0xb574[_0x2b67e5];return _0x5e9547;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4b57('0x2')]},'user':{'type':Sequelize[_0x4b57('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4b57('0x3')]},'secure':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4b57('0x2')]},'authentication':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4b57('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 a94ffff..88b1b6c 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 _0x1c3f=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x17640f,_0xc52ab4){var _0x475f42=function(_0x3b8b3c){while(--_0x3b8b3c){_0x17640f['push'](_0x17640f['shift']());}};_0x475f42(++_0xc52ab4);}(_0x1c3f,0x7e));var _0xf1c3=function(_0x322306,_0x31fc80){_0x322306=_0x322306-0x0;var _0x4f9152=_0x1c3f[_0x322306];return _0x4f9152;};'use strict';var emlformat=require(_0xf1c3('0x0'));var rimraf=require(_0xf1c3('0x1'));var zipdir=require(_0xf1c3('0x2'));var jsonpatch=require(_0xf1c3('0x3'));var rp=require(_0xf1c3('0x4'));var moment=require(_0xf1c3('0x5'));var BPromise=require(_0xf1c3('0x6'));var Mustache=require(_0xf1c3('0x7'));var util=require('util');var path=require(_0xf1c3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1c3('0x9'));var _=require(_0xf1c3('0xa'));var squel=require('squel');var crypto=require(_0xf1c3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf1c3('0xc'));var toCsv=require(_0xf1c3('0xd'));var querystring=require(_0xf1c3('0xe'));var Papa=require(_0xf1c3('0xf'));var Redis=require(_0xf1c3('0x10'));var authService=require(_0xf1c3('0x11'));var qs=require(_0xf1c3('0x12'));var as=require(_0xf1c3('0x13'));var hardwareService=require(_0xf1c3('0x14'));var logger=require('../../config/logger')(_0xf1c3('0x15'));var utils=require(_0xf1c3('0x16'));var config=require(_0xf1c3('0x17'));var licenseUtil=require(_0xf1c3('0x18'));var db=require(_0xf1c3('0x19'))['db'];function respondWithStatusCode(_0x1cc114,_0x5b117a){_0x5b117a=_0x5b117a||0xcc;return function(_0x46cdf0){if(_0x46cdf0){return _0x1cc114[_0xf1c3('0x1a')](_0x5b117a);}return _0x1cc114[_0xf1c3('0x1b')](_0x5b117a)[_0xf1c3('0x1c')]();};}function respondWithResult(_0x324b97,_0x3e7659){_0x3e7659=_0x3e7659||0xc8;return function(_0x599dfe){if(_0x599dfe){return _0x324b97[_0xf1c3('0x1b')](_0x3e7659)[_0xf1c3('0x1d')](_0x599dfe);}};}function respondWithFilteredResult(_0x53c591,_0x519c15){return function(_0x4388ae){if(_0x4388ae){var _0x318a09=typeof _0x519c15[_0xf1c3('0x1e')]===_0xf1c3('0x1f')&&typeof _0x519c15[_0xf1c3('0x20')]===_0xf1c3('0x1f');var _0x20501c=_0x4388ae[_0xf1c3('0x21')];var _0x1a7b2f=_0x318a09?0x0:_0x519c15[_0xf1c3('0x1e')];var _0x5cbc81=_0x318a09?_0x4388ae[_0xf1c3('0x21')]:_0x519c15[_0xf1c3('0x1e')]+_0x519c15[_0xf1c3('0x20')];var _0x42787d;if(_0x5cbc81>=_0x20501c){_0x5cbc81=_0x20501c;_0x42787d=0xc8;}else{_0x42787d=0xce;}_0x53c591['status'](_0x42787d);return _0x53c591[_0xf1c3('0x22')](_0xf1c3('0x23'),_0x1a7b2f+'-'+_0x5cbc81+'/'+_0x20501c)[_0xf1c3('0x1d')](_0x4388ae);}return null;};}function patchUpdates(_0x2d1328){return function(_0x4b7e68){try{jsonpatch['apply'](_0x4b7e68,_0x2d1328,!![]);}catch(_0xcd5d3){return BPromise[_0xf1c3('0x24')](_0xcd5d3);}return _0x4b7e68[_0xf1c3('0x25')]();};}function saveUpdates(_0x25221c,_0x6f3d0f){return function(_0x1de883){if(_0x1de883){return _0x1de883[_0xf1c3('0x26')](_0x25221c)[_0xf1c3('0x27')](function(_0x2df2d1){return _0x2df2d1;});}return null;};}function removeEntity(_0x5c3a8d,_0x31f354){return function(_0x1bc620){if(_0x1bc620){return _0x1bc620['destroy']()['then'](function(){_0x5c3a8d[_0xf1c3('0x1b')](0xcc)[_0xf1c3('0x1c')]();});}};}function handleEntityNotFound(_0x4c0ff0,_0x30c440){return function(_0x27752b){if(!_0x27752b){_0x4c0ff0[_0xf1c3('0x1a')](0x194);}return _0x27752b;};}function handleError(_0x499fd8,_0x14ad15){_0x14ad15=_0x14ad15||0x1f4;return function(_0x21b7a2){logger[_0xf1c3('0x28')](_0x21b7a2[_0xf1c3('0x29')]);if(_0x21b7a2[_0xf1c3('0x2a')]){delete _0x21b7a2[_0xf1c3('0x2a')];}_0x499fd8[_0xf1c3('0x1b')](_0x14ad15)[_0xf1c3('0x2b')](_0x21b7a2);};}exports[_0xf1c3('0x2c')]=function(_0x599bc0,_0x4db42b){var _0x1d0b89={},_0x5dc93c={},_0x50a024={'count':0x0,'rows':[]};var _0x5c04b7=_[_0xf1c3('0x2d')](db[_0xf1c3('0x2e')][_0xf1c3('0x2f')],function(_0x38da0b){return{'name':_0x38da0b[_0xf1c3('0x30')],'type':_0x38da0b[_0xf1c3('0x31')][_0xf1c3('0x32')]};});_0x5dc93c[_0xf1c3('0x33')]=_[_0xf1c3('0x2d')](_0x5c04b7,_0xf1c3('0x2a'));_0x5dc93c[_0xf1c3('0x34')]=_[_0xf1c3('0x35')](_0x599bc0[_0xf1c3('0x34')]);_0x5dc93c[_0xf1c3('0x36')]=_['intersection'](_0x5dc93c['model'],_0x5dc93c[_0xf1c3('0x34')]);_0x1d0b89[_0xf1c3('0x37')]=_[_0xf1c3('0x38')](_0x5dc93c[_0xf1c3('0x33')],qs[_0xf1c3('0x39')](_0x599bc0[_0xf1c3('0x34')][_0xf1c3('0x39')]));_0x1d0b89[_0xf1c3('0x37')]=_0x1d0b89[_0xf1c3('0x37')]['length']?_0x1d0b89[_0xf1c3('0x37')]:_0x5dc93c[_0xf1c3('0x33')];if(!_0x599bc0['query'][_0xf1c3('0x3a')](_0xf1c3('0x3b'))){_0x1d0b89[_0xf1c3('0x20')]=qs[_0xf1c3('0x20')](_0x599bc0['query'][_0xf1c3('0x20')]);_0x1d0b89[_0xf1c3('0x1e')]=qs[_0xf1c3('0x1e')](_0x599bc0[_0xf1c3('0x34')][_0xf1c3('0x1e')]);}_0x1d0b89['order']=qs[_0xf1c3('0x3c')](_0x599bc0[_0xf1c3('0x34')]['sort']);_0x1d0b89[_0xf1c3('0x3d')]=qs['filters'](_['pick'](_0x599bc0['query'],_0x5dc93c['filters']),_0x5c04b7);if(_0x599bc0[_0xf1c3('0x34')][_0xf1c3('0x3e')]){_0x1d0b89['where']=_[_0xf1c3('0x3f')](_0x1d0b89[_0xf1c3('0x3d')],{'$or':_[_0xf1c3('0x2d')](_0x5c04b7,function(_0x527b34){if(_0x527b34[_0xf1c3('0x31')]!=='VIRTUAL'){var _0x2cefec={};_0x2cefec[_0x527b34[_0xf1c3('0x2a')]]={'$like':'%'+_0x599bc0[_0xf1c3('0x34')][_0xf1c3('0x3e')]+'%'};return _0x2cefec;}})});}_0x1d0b89=_[_0xf1c3('0x3f')]({},_0x1d0b89,_0x599bc0[_0xf1c3('0x40')]);var _0x40579f={'where':_0x1d0b89[_0xf1c3('0x3d')]};return db['MailServerOut'][_0xf1c3('0x21')](_0x40579f)[_0xf1c3('0x27')](function(_0x540259){_0x50a024['count']=_0x540259;if(_0x599bc0[_0xf1c3('0x34')]['includeAll']){_0x1d0b89[_0xf1c3('0x41')]=[{'all':!![]}];}return db[_0xf1c3('0x2e')][_0xf1c3('0x42')](_0x1d0b89);})[_0xf1c3('0x27')](function(_0x31673d){_0x50a024['rows']=_0x31673d;return _0x50a024;})[_0xf1c3('0x27')](respondWithFilteredResult(_0x4db42b,_0x1d0b89))[_0xf1c3('0x43')](handleError(_0x4db42b,null));};exports[_0xf1c3('0x44')]=function(_0x2f9ca7,_0x14346b){var _0x24c7e3={'raw':!![],'where':{'id':_0x2f9ca7[_0xf1c3('0x45')]['id']}},_0x847c97={};_0x847c97['model']=_[_0xf1c3('0x35')](db[_0xf1c3('0x2e')][_0xf1c3('0x2f')]);_0x847c97[_0xf1c3('0x34')]=_[_0xf1c3('0x35')](_0x2f9ca7[_0xf1c3('0x34')]);_0x847c97['filters']=_[_0xf1c3('0x38')](_0x847c97[_0xf1c3('0x33')],_0x847c97['query']);_0x24c7e3[_0xf1c3('0x37')]=_[_0xf1c3('0x38')](_0x847c97[_0xf1c3('0x33')],qs[_0xf1c3('0x39')](_0x2f9ca7[_0xf1c3('0x34')][_0xf1c3('0x39')]));_0x24c7e3['attributes']=_0x24c7e3['attributes'][_0xf1c3('0x46')]?_0x24c7e3[_0xf1c3('0x37')]:_0x847c97[_0xf1c3('0x33')];if(_0x2f9ca7['query']['includeAll']){_0x24c7e3[_0xf1c3('0x41')]=[{'all':!![]}];}_0x24c7e3=_[_0xf1c3('0x3f')]({},_0x24c7e3,_0x2f9ca7['options']);return db[_0xf1c3('0x2e')][_0xf1c3('0x47')](_0x24c7e3)[_0xf1c3('0x27')](handleEntityNotFound(_0x14346b,null))['then'](respondWithResult(_0x14346b,null))[_0xf1c3('0x43')](handleError(_0x14346b,null));};exports[_0xf1c3('0x48')]=function(_0x3a9407,_0x4d76c3){return db[_0xf1c3('0x2e')][_0xf1c3('0x48')](_0x3a9407[_0xf1c3('0x49')],{})[_0xf1c3('0x27')](respondWithResult(_0x4d76c3,0xc9))[_0xf1c3('0x43')](handleError(_0x4d76c3,null));};exports[_0xf1c3('0x26')]=function(_0x36f750,_0x37e5bd){if(_0x36f750['body']['id']){delete _0x36f750['body']['id'];}return db['MailServerOut'][_0xf1c3('0x47')]({'where':{'id':_0x36f750['params']['id']}})[_0xf1c3('0x27')](handleEntityNotFound(_0x37e5bd,null))[_0xf1c3('0x27')](saveUpdates(_0x36f750[_0xf1c3('0x49')],null))[_0xf1c3('0x27')](respondWithResult(_0x37e5bd,null))[_0xf1c3('0x43')](handleError(_0x37e5bd,null));};exports[_0xf1c3('0x4a')]=function(_0x39ab9b,_0x45b1db){return db[_0xf1c3('0x2e')][_0xf1c3('0x47')]({'where':{'id':_0x39ab9b[_0xf1c3('0x45')]['id']}})[_0xf1c3('0x27')](handleEntityNotFound(_0x45b1db,null))[_0xf1c3('0x27')](removeEntity(_0x45b1db,null))[_0xf1c3('0x43')](handleError(_0x45b1db,null));}; \ No newline at end of file +var _0x644f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailServerOut','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3a99a0,_0x5b7f7f){var _0x782cff=function(_0xbfdde8){while(--_0xbfdde8){_0x3a99a0['push'](_0x3a99a0['shift']());}};_0x782cff(++_0x5b7f7f);}(_0x644f,0x118));var _0xf644=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x644f[_0x39cd3c];return _0x47a0ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf644('0x0'));var zipdir=require(_0xf644('0x1'));var jsonpatch=require(_0xf644('0x2'));var rp=require(_0xf644('0x3'));var moment=require(_0xf644('0x4'));var BPromise=require(_0xf644('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf644('0x6'));var sox=require(_0xf644('0x7'));var csv=require(_0xf644('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf644('0x9'));var squel=require('squel');var crypto=require(_0xf644('0xa'));var jsforce=require(_0xf644('0xb'));var deskjs=require(_0xf644('0xc'));var toCsv=require(_0xf644('0x8'));var querystring=require(_0xf644('0xd'));var Papa=require(_0xf644('0xe'));var Redis=require(_0xf644('0xf'));var authService=require(_0xf644('0x10'));var qs=require(_0xf644('0x11'));var as=require(_0xf644('0x12'));var hardwareService=require(_0xf644('0x13'));var logger=require(_0xf644('0x14'))('api');var utils=require(_0xf644('0x15'));var config=require(_0xf644('0x16'));var licenseUtil=require(_0xf644('0x17'));var db=require(_0xf644('0x18'))['db'];function respondWithStatusCode(_0x254dff,_0x145193){_0x145193=_0x145193||0xcc;return function(_0x97c230){if(_0x97c230){return _0x254dff[_0xf644('0x19')](_0x145193);}return _0x254dff[_0xf644('0x1a')](_0x145193)[_0xf644('0x1b')]();};}function respondWithResult(_0x18cadb,_0x2114d7){_0x2114d7=_0x2114d7||0xc8;return function(_0x394895){if(_0x394895){return _0x18cadb[_0xf644('0x1a')](_0x2114d7)[_0xf644('0x1c')](_0x394895);}};}function respondWithFilteredResult(_0x1b437b,_0x40605f){return function(_0x4450c7){if(_0x4450c7){var _0x3ce8a9=typeof _0x40605f[_0xf644('0x1d')]===_0xf644('0x1e')&&typeof _0x40605f[_0xf644('0x1f')]==='undefined';var _0xfaa9f5=_0x4450c7['count'];var _0x25841e=_0x3ce8a9?0x0:_0x40605f[_0xf644('0x1d')];var _0x13738c=_0x3ce8a9?_0x4450c7[_0xf644('0x20')]:_0x40605f[_0xf644('0x1d')]+_0x40605f[_0xf644('0x1f')];var _0x221496;if(_0x13738c>=_0xfaa9f5){_0x13738c=_0xfaa9f5;_0x221496=0xc8;}else{_0x221496=0xce;}_0x1b437b[_0xf644('0x1a')](_0x221496);return _0x1b437b[_0xf644('0x21')](_0xf644('0x22'),_0x25841e+'-'+_0x13738c+'/'+_0xfaa9f5)['json'](_0x4450c7);}return null;};}function patchUpdates(_0x556c14){return function(_0x2bd1a2){try{jsonpatch[_0xf644('0x23')](_0x2bd1a2,_0x556c14,!![]);}catch(_0x169dd8){return BPromise['reject'](_0x169dd8);}return _0x2bd1a2[_0xf644('0x24')]();};}function saveUpdates(_0x5531a4,_0x466e1b){return function(_0x3d02a6){if(_0x3d02a6){return _0x3d02a6[_0xf644('0x25')](_0x5531a4)[_0xf644('0x26')](function(_0x23650a){return _0x23650a;});}return null;};}function removeEntity(_0x4950f4,_0x143549){return function(_0x5e889c){if(_0x5e889c){return _0x5e889c[_0xf644('0x27')]()[_0xf644('0x26')](function(){_0x4950f4[_0xf644('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7d01,_0xe44cb4){return function(_0x34e6ab){if(!_0x34e6ab){_0x3a7d01[_0xf644('0x19')](0x194);}return _0x34e6ab;};}function handleError(_0x460d91,_0x5c512e){_0x5c512e=_0x5c512e||0x1f4;return function(_0x1303a1){logger[_0xf644('0x28')](_0x1303a1['stack']);if(_0x1303a1[_0xf644('0x29')]){delete _0x1303a1[_0xf644('0x29')];}_0x460d91[_0xf644('0x1a')](_0x5c512e)[_0xf644('0x2a')](_0x1303a1);};}exports[_0xf644('0x2b')]=function(_0x2e9efd,_0x3f051b){var _0x1a5737={},_0x1c8212={},_0xef202b={'count':0x0,'rows':[]};var _0x422738=_[_0xf644('0x2c')](db[_0xf644('0x2d')]['rawAttributes'],function(_0xdb9aff){return{'name':_0xdb9aff['fieldName'],'type':_0xdb9aff['type'][_0xf644('0x2e')]};});_0x1c8212[_0xf644('0x2f')]=_[_0xf644('0x2c')](_0x422738,_0xf644('0x29'));_0x1c8212[_0xf644('0x30')]=_['keys'](_0x2e9efd['query']);_0x1c8212[_0xf644('0x31')]=_[_0xf644('0x32')](_0x1c8212[_0xf644('0x2f')],_0x1c8212[_0xf644('0x30')]);_0x1a5737['attributes']=_['intersection'](_0x1c8212[_0xf644('0x2f')],qs[_0xf644('0x33')](_0x2e9efd['query'][_0xf644('0x33')]));_0x1a5737['attributes']=_0x1a5737[_0xf644('0x34')][_0xf644('0x35')]?_0x1a5737['attributes']:_0x1c8212['model'];if(!_0x2e9efd[_0xf644('0x30')][_0xf644('0x36')]('nolimit')){_0x1a5737['limit']=qs[_0xf644('0x1f')](_0x2e9efd[_0xf644('0x30')][_0xf644('0x1f')]);_0x1a5737[_0xf644('0x1d')]=qs[_0xf644('0x1d')](_0x2e9efd[_0xf644('0x30')][_0xf644('0x1d')]);}_0x1a5737[_0xf644('0x37')]=qs[_0xf644('0x38')](_0x2e9efd['query'][_0xf644('0x38')]);_0x1a5737[_0xf644('0x39')]=qs[_0xf644('0x31')](_[_0xf644('0x3a')](_0x2e9efd[_0xf644('0x30')],_0x1c8212[_0xf644('0x31')]),_0x422738);if(_0x2e9efd[_0xf644('0x30')][_0xf644('0x3b')]){_0x1a5737[_0xf644('0x39')]=_[_0xf644('0x3c')](_0x1a5737[_0xf644('0x39')],{'$or':_[_0xf644('0x2c')](_0x422738,function(_0x503754){if(_0x503754[_0xf644('0x3d')]!==_0xf644('0x3e')){var _0x32191e={};_0x32191e[_0x503754[_0xf644('0x29')]]={'$like':'%'+_0x2e9efd[_0xf644('0x30')][_0xf644('0x3b')]+'%'};return _0x32191e;}})});}_0x1a5737=_[_0xf644('0x3c')]({},_0x1a5737,_0x2e9efd['options']);var _0x225813={'where':_0x1a5737[_0xf644('0x39')]};return db[_0xf644('0x2d')]['count'](_0x225813)[_0xf644('0x26')](function(_0x449d6d){_0xef202b[_0xf644('0x20')]=_0x449d6d;if(_0x2e9efd[_0xf644('0x30')]['includeAll']){_0x1a5737[_0xf644('0x3f')]=[{'all':!![]}];}return db[_0xf644('0x2d')][_0xf644('0x40')](_0x1a5737);})[_0xf644('0x26')](function(_0x2e306a){_0xef202b[_0xf644('0x41')]=_0x2e306a;return _0xef202b;})[_0xf644('0x26')](respondWithFilteredResult(_0x3f051b,_0x1a5737))['catch'](handleError(_0x3f051b,null));};exports[_0xf644('0x42')]=function(_0x22a4dc,_0x425262){var _0x4af414={'raw':!![],'where':{'id':_0x22a4dc[_0xf644('0x43')]['id']}},_0x1f9cc2={};_0x1f9cc2[_0xf644('0x2f')]=_[_0xf644('0x44')](db[_0xf644('0x2d')]['rawAttributes']);_0x1f9cc2['query']=_[_0xf644('0x44')](_0x22a4dc['query']);_0x1f9cc2[_0xf644('0x31')]=_[_0xf644('0x32')](_0x1f9cc2[_0xf644('0x2f')],_0x1f9cc2[_0xf644('0x30')]);_0x4af414[_0xf644('0x34')]=_[_0xf644('0x32')](_0x1f9cc2[_0xf644('0x2f')],qs['fields'](_0x22a4dc['query'][_0xf644('0x33')]));_0x4af414[_0xf644('0x34')]=_0x4af414[_0xf644('0x34')][_0xf644('0x35')]?_0x4af414[_0xf644('0x34')]:_0x1f9cc2[_0xf644('0x2f')];if(_0x22a4dc[_0xf644('0x30')][_0xf644('0x45')]){_0x4af414['include']=[{'all':!![]}];}_0x4af414=_['merge']({},_0x4af414,_0x22a4dc['options']);return db[_0xf644('0x2d')][_0xf644('0x46')](_0x4af414)[_0xf644('0x26')](handleEntityNotFound(_0x425262,null))[_0xf644('0x26')](respondWithResult(_0x425262,null))['catch'](handleError(_0x425262,null));};exports[_0xf644('0x47')]=function(_0x321822,_0x4aee1a){return db['MailServerOut']['create'](_0x321822[_0xf644('0x48')],{})['then'](respondWithResult(_0x4aee1a,0xc9))['catch'](handleError(_0x4aee1a,null));};exports['update']=function(_0xe34e68,_0x29843d){if(_0xe34e68[_0xf644('0x48')]['id']){delete _0xe34e68['body']['id'];}return db[_0xf644('0x2d')]['find']({'where':{'id':_0xe34e68[_0xf644('0x43')]['id']}})[_0xf644('0x26')](handleEntityNotFound(_0x29843d,null))['then'](saveUpdates(_0xe34e68[_0xf644('0x48')],null))[_0xf644('0x26')](respondWithResult(_0x29843d,null))[_0xf644('0x49')](handleError(_0x29843d,null));};exports['destroy']=function(_0x345975,_0x28275c){return db[_0xf644('0x2d')][_0xf644('0x46')]({'where':{'id':_0x345975[_0xf644('0x43')]['id']}})[_0xf644('0x26')](handleEntityNotFound(_0x28275c,null))[_0xf644('0x26')](removeEntity(_0x28275c,null))['catch'](handleError(_0x28275c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 42e3f5f..d856985 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 _0x627c=['define','MailServerOut','mail_servers_out','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x3621fc,_0x536bb7){var _0x25070f=function(_0x5742b7){while(--_0x5742b7){_0x3621fc['push'](_0x3621fc['shift']());}};_0x25070f(++_0x536bb7);}(_0x627c,0x142));var _0xc627=function(_0x2b43e8,_0x3ddc04){_0x2b43e8=_0x2b43e8-0x0;var _0x2f178d=_0x627c[_0x2b43e8];return _0x2f178d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc627('0x0'));var moment=require('moment');var BPromise=require(_0xc627('0x1'));var rp=require(_0xc627('0x2'));var fs=require('fs');var path=require(_0xc627('0x3'));var rimraf=require(_0xc627('0x4'));var config=require(_0xc627('0x5'));var attributes=require(_0xc627('0x6'));module[_0xc627('0x7')]=function(_0x5115a7,_0x19ce22){return _0x5115a7[_0xc627('0x8')](_0xc627('0x9'),attributes,{'tableName':_0xc627('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2b1=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x17c12d,_0x3134eb){var _0x44f14c=function(_0x189491){while(--_0x189491){_0x17c12d['push'](_0x17c12d['shift']());}};_0x44f14c(++_0x3134eb);}(_0xe2b1,0x18a));var _0x1e2b=function(_0xd6b4a0,_0x1aab6c){_0xd6b4a0=_0xd6b4a0-0x0;var _0x23ccda=_0xe2b1[_0xd6b4a0];return _0x23ccda;};'use strict';var _=require(_0x1e2b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1e2b('0x1'));var BPromise=require(_0x1e2b('0x2'));var rp=require(_0x1e2b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e2b('0x4'));var config=require(_0x1e2b('0x5'));var attributes=require(_0x1e2b('0x6'));module[_0x1e2b('0x7')]=function(_0x5b5cea,_0xd08d2f){return _0x5b5cea[_0x1e2b('0x8')](_0x1e2b('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9c113fd..53eefa7 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(_0x5a5e57,_0x40fdb7){var _0x59c185=function(_0x378df5){while(--_0x378df5){_0x5a5e57['push'](_0x5a5e57['shift']());}};_0x59c185(++_0x40fdb7);}(_0xdb28,0x106));var _0x8db2=function(_0xbd8a,_0x55a1e2){_0xbd8a=_0xbd8a-0x0;var _0x323cbc=_0xdb28[_0xbd8a];return _0x323cbc;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3afb13,_0x143f9d){var _0x664786=function(_0x207401){while(--_0x207401){_0x3afb13['push'](_0x3afb13['shift']());}};_0x664786(++_0x143f9d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa6953d,_0x3cdd33){_0xa6953d=_0xa6953d-0x0;var _0x381ccc=_0x5f2f[_0xa6953d];return _0x381ccc;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index ac965ab..ad973d8 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 _0x096e=['/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','describe'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x096e,0x1ec));var _0xe096=function(_0xc9e269,_0x4204bc){_0xc9e269=_0xc9e269-0x0;var _0x171ea0=_0x096e[_0xc9e269];return _0x171ea0;};'use strict';var multer=require(_0xe096('0x0'));var util=require(_0xe096('0x1'));var path=require(_0xe096('0x2'));var timeout=require(_0xe096('0x3'));var express=require(_0xe096('0x4'));var router=express[_0xe096('0x5')]();var fs_extra=require(_0xe096('0x6'));var auth=require(_0xe096('0x7'));var interaction=require(_0xe096('0x8'));var config=require(_0xe096('0x9'));var controller=require(_0xe096('0xa'));router[_0xe096('0xb')]('/',auth['isAuthenticated'](),controller[_0xe096('0xc')]);router[_0xe096('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xe096('0xd')]);router[_0xe096('0xb')](_0xe096('0xe'),auth['isAuthenticated'](),controller[_0xe096('0xf')]);router[_0xe096('0x10')]('/',auth[_0xe096('0x11')](),controller['create']);router[_0xe096('0x12')](_0xe096('0xe'),auth[_0xe096('0x11')](),controller[_0xe096('0x13')]);router[_0xe096('0x14')]('/:id',auth[_0xe096('0x11')](),controller[_0xe096('0x15')]);module[_0xe096('0x16')]=router; \ No newline at end of file +var _0x4c84=['express','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','multer','util','path','connect-timeout'];(function(_0x2563e4,_0x456262){var _0x53e6d8=function(_0x288a4c){while(--_0x288a4c){_0x2563e4['push'](_0x2563e4['shift']());}};_0x53e6d8(++_0x456262);}(_0x4c84,0x81));var _0x44c8=function(_0x50a31c,_0x501f45){_0x50a31c=_0x50a31c-0x0;var _0x220842=_0x4c84[_0x50a31c];return _0x220842;};'use strict';var multer=require(_0x44c8('0x0'));var util=require(_0x44c8('0x1'));var path=require(_0x44c8('0x2'));var timeout=require(_0x44c8('0x3'));var express=require(_0x44c8('0x4'));var router=express['Router']();var fs_extra=require(_0x44c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44c8('0x6'));var config=require(_0x44c8('0x7'));var controller=require(_0x44c8('0x8'));router[_0x44c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x44c8('0xa')]);router['get'](_0x44c8('0xb'),auth[_0x44c8('0xc')](),controller[_0x44c8('0xd')]);router[_0x44c8('0x9')](_0x44c8('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x44c8('0xf')]('/',auth['isAuthenticated'](),controller[_0x44c8('0x10')]);router['put'](_0x44c8('0xe'),auth['isAuthenticated'](),controller[_0x44c8('0x11')]);router[_0x44c8('0x12')](_0x44c8('0xe'),auth[_0x44c8('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 494d7df..a9e240d 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd046=['exports','STRING','name'];(function(_0x146f3e,_0x2f73d9){var _0x443afa=function(_0x563eaa){while(--_0x563eaa){_0x146f3e['push'](_0x146f3e['shift']());}};_0x443afa(++_0x2f73d9);}(_0xd046,0x129));var _0x6d04=function(_0x352f85,_0x23f927){_0x352f85=_0x352f85-0x0;var _0x303f5b=_0xd046[_0x352f85];return _0x303f5b;};'use strict';var Sequelize=require('sequelize');module[_0x6d04('0x0')]={'name':{'type':Sequelize[_0x6d04('0x1')],'unique':_0x6d04('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x13f5=['exports','STRING','name','sequelize'];(function(_0x38fdf4,_0x4bb05f){var _0x4159f4=function(_0x5bda80){while(--_0x5bda80){_0x38fdf4['push'](_0x38fdf4['shift']());}};_0x4159f4(++_0x4bb05f);}(_0x13f5,0xc3));var _0x513f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x13f5[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x513f('0x0'));module[_0x513f('0x1')]={'name':{'type':Sequelize[_0x513f('0x2')],'unique':_0x513f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 867f15b..4e7aedb 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 _0x6aa3=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','rows','catch','show','rawAttributes','find','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6aa3,0x94));var _0x36aa=function(_0x22eb5d,_0x2e519d){_0x22eb5d=_0x22eb5d-0x0;var _0x4a39ad=_0x6aa3[_0x22eb5d];return _0x4a39ad;};'use strict';var emlformat=require(_0x36aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x36aa('0x1'));var jsonpatch=require(_0x36aa('0x2'));var rp=require(_0x36aa('0x3'));var moment=require(_0x36aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36aa('0x5'));var util=require('util');var path=require(_0x36aa('0x6'));var sox=require(_0x36aa('0x7'));var csv=require(_0x36aa('0x8'));var ejs=require(_0x36aa('0x9'));var fs=require('fs');var fs_extra=require(_0x36aa('0xa'));var _=require(_0x36aa('0xb'));var squel=require(_0x36aa('0xc'));var crypto=require(_0x36aa('0xd'));var jsforce=require(_0x36aa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x36aa('0x8'));var querystring=require(_0x36aa('0xf'));var Papa=require(_0x36aa('0x10'));var Redis=require(_0x36aa('0x11'));var authService=require(_0x36aa('0x12'));var qs=require(_0x36aa('0x13'));var as=require(_0x36aa('0x14'));var hardwareService=require(_0x36aa('0x15'));var logger=require(_0x36aa('0x16'))(_0x36aa('0x17'));var utils=require(_0x36aa('0x18'));var config=require(_0x36aa('0x19'));var licenseUtil=require(_0x36aa('0x1a'));var db=require(_0x36aa('0x1b'))['db'];function respondWithStatusCode(_0xf8ca3b,_0x1cc017){_0x1cc017=_0x1cc017||0xcc;return function(_0x3bb271){if(_0x3bb271){return _0xf8ca3b['sendStatus'](_0x1cc017);}return _0xf8ca3b[_0x36aa('0x1c')](_0x1cc017)[_0x36aa('0x1d')]();};}function respondWithResult(_0x13b378,_0x3f0e59){_0x3f0e59=_0x3f0e59||0xc8;return function(_0x3b4c9a){if(_0x3b4c9a){return _0x13b378[_0x36aa('0x1c')](_0x3f0e59)['json'](_0x3b4c9a);}};}function respondWithFilteredResult(_0x114a89,_0x9b94ad){return function(_0x2e3d6f){if(_0x2e3d6f){var _0x4556e1=typeof _0x9b94ad['offset']===_0x36aa('0x1e')&&typeof _0x9b94ad[_0x36aa('0x1f')]===_0x36aa('0x1e');var _0x44ba99=_0x2e3d6f['count'];var _0x2a977f=_0x4556e1?0x0:_0x9b94ad['offset'];var _0x45b400=_0x4556e1?_0x2e3d6f[_0x36aa('0x20')]:_0x9b94ad[_0x36aa('0x21')]+_0x9b94ad[_0x36aa('0x1f')];var _0x3f8e77;if(_0x45b400>=_0x44ba99){_0x45b400=_0x44ba99;_0x3f8e77=0xc8;}else{_0x3f8e77=0xce;}_0x114a89[_0x36aa('0x1c')](_0x3f8e77);return _0x114a89[_0x36aa('0x22')](_0x36aa('0x23'),_0x2a977f+'-'+_0x45b400+'/'+_0x44ba99)[_0x36aa('0x24')](_0x2e3d6f);}return null;};}function patchUpdates(_0x266818){return function(_0x52e566){try{jsonpatch[_0x36aa('0x25')](_0x52e566,_0x266818,!![]);}catch(_0x2a84e5){return BPromise[_0x36aa('0x26')](_0x2a84e5);}return _0x52e566[_0x36aa('0x27')]();};}function saveUpdates(_0x1a2687,_0xac10ca){return function(_0x1cecbd){if(_0x1cecbd){return _0x1cecbd[_0x36aa('0x28')](_0x1a2687)[_0x36aa('0x29')](function(_0x346410){return _0x346410;});}return null;};}function removeEntity(_0x8457cb,_0x27f1b5){return function(_0x52379f){if(_0x52379f){return _0x52379f[_0x36aa('0x2a')]()['then'](function(){_0x8457cb['status'](0xcc)[_0x36aa('0x1d')]();});}};}function handleEntityNotFound(_0x237c18,_0x38d302){return function(_0x579ec3){if(!_0x579ec3){_0x237c18[_0x36aa('0x2b')](0x194);}return _0x579ec3;};}function handleError(_0x3c3ab8,_0xd60bb4){_0xd60bb4=_0xd60bb4||0x1f4;return function(_0x24e9c1){logger[_0x36aa('0x2c')](_0x24e9c1['stack']);if(_0x24e9c1[_0x36aa('0x2d')]){delete _0x24e9c1[_0x36aa('0x2d')];}_0x3c3ab8[_0x36aa('0x1c')](_0xd60bb4)[_0x36aa('0x2e')](_0x24e9c1);};}exports[_0x36aa('0x2f')]=function(_0xa45df9,_0x5b3b67){var _0x2a54f3={},_0x5753b9={},_0xbfdb85={'count':0x0,'rows':[]};var _0x295a4f=_[_0x36aa('0x30')](db['MailSubstatus']['rawAttributes'],function(_0x1b1449){return{'name':_0x1b1449[_0x36aa('0x31')],'type':_0x1b1449[_0x36aa('0x32')][_0x36aa('0x33')]};});_0x5753b9['model']=_[_0x36aa('0x30')](_0x295a4f,_0x36aa('0x2d'));_0x5753b9[_0x36aa('0x34')]=_[_0x36aa('0x35')](_0xa45df9[_0x36aa('0x34')]);_0x5753b9['filters']=_[_0x36aa('0x36')](_0x5753b9[_0x36aa('0x37')],_0x5753b9[_0x36aa('0x34')]);_0x2a54f3['attributes']=_[_0x36aa('0x36')](_0x5753b9[_0x36aa('0x37')],qs[_0x36aa('0x38')](_0xa45df9[_0x36aa('0x34')][_0x36aa('0x38')]));_0x2a54f3[_0x36aa('0x39')]=_0x2a54f3[_0x36aa('0x39')][_0x36aa('0x3a')]?_0x2a54f3[_0x36aa('0x39')]:_0x5753b9[_0x36aa('0x37')];if(!_0xa45df9[_0x36aa('0x34')][_0x36aa('0x3b')]('nolimit')){_0x2a54f3['limit']=qs[_0x36aa('0x1f')](_0xa45df9[_0x36aa('0x34')][_0x36aa('0x1f')]);_0x2a54f3[_0x36aa('0x21')]=qs[_0x36aa('0x21')](_0xa45df9[_0x36aa('0x34')][_0x36aa('0x21')]);}_0x2a54f3['order']=qs[_0x36aa('0x3c')](_0xa45df9[_0x36aa('0x34')][_0x36aa('0x3c')]);_0x2a54f3[_0x36aa('0x3d')]=qs['filters'](_[_0x36aa('0x3e')](_0xa45df9[_0x36aa('0x34')],_0x5753b9['filters']),_0x295a4f);if(_0xa45df9[_0x36aa('0x34')][_0x36aa('0x3f')]){_0x2a54f3['where']=_[_0x36aa('0x40')](_0x2a54f3[_0x36aa('0x3d')],{'$or':_[_0x36aa('0x30')](_0x295a4f,function(_0x377143){if(_0x377143[_0x36aa('0x32')]!==_0x36aa('0x41')){var _0xed35f2={};_0xed35f2[_0x377143[_0x36aa('0x2d')]]={'$like':'%'+_0xa45df9[_0x36aa('0x34')][_0x36aa('0x3f')]+'%'};return _0xed35f2;}})});}_0x2a54f3=_[_0x36aa('0x40')]({},_0x2a54f3,_0xa45df9[_0x36aa('0x42')]);var _0x5b2db9={'where':_0x2a54f3[_0x36aa('0x3d')]};return db[_0x36aa('0x43')]['count'](_0x5b2db9)[_0x36aa('0x29')](function(_0x2d24d1){_0xbfdb85[_0x36aa('0x20')]=_0x2d24d1;if(_0xa45df9[_0x36aa('0x34')][_0x36aa('0x44')]){_0x2a54f3[_0x36aa('0x45')]=[{'all':!![]}];}return db[_0x36aa('0x43')]['findAll'](_0x2a54f3);})[_0x36aa('0x29')](function(_0xc2104c){_0xbfdb85[_0x36aa('0x46')]=_0xc2104c;return _0xbfdb85;})[_0x36aa('0x29')](respondWithFilteredResult(_0x5b3b67,_0x2a54f3))[_0x36aa('0x47')](handleError(_0x5b3b67,null));};exports[_0x36aa('0x48')]=function(_0x38e934,_0x1afc14){var _0x2ca108={'raw':!![],'where':{'id':_0x38e934['params']['id']}},_0x4744f1={};_0x4744f1['model']=_[_0x36aa('0x35')](db['MailSubstatus'][_0x36aa('0x49')]);_0x4744f1[_0x36aa('0x34')]=_[_0x36aa('0x35')](_0x38e934['query']);_0x4744f1['filters']=_[_0x36aa('0x36')](_0x4744f1['model'],_0x4744f1[_0x36aa('0x34')]);_0x2ca108['attributes']=_[_0x36aa('0x36')](_0x4744f1[_0x36aa('0x37')],qs[_0x36aa('0x38')](_0x38e934[_0x36aa('0x34')]['fields']));_0x2ca108[_0x36aa('0x39')]=_0x2ca108[_0x36aa('0x39')][_0x36aa('0x3a')]?_0x2ca108[_0x36aa('0x39')]:_0x4744f1[_0x36aa('0x37')];if(_0x38e934[_0x36aa('0x34')]['includeAll']){_0x2ca108[_0x36aa('0x45')]=[{'all':!![]}];}_0x2ca108=_['merge']({},_0x2ca108,_0x38e934[_0x36aa('0x42')]);return db['MailSubstatus'][_0x36aa('0x4a')](_0x2ca108)[_0x36aa('0x29')](handleEntityNotFound(_0x1afc14,null))['then'](respondWithResult(_0x1afc14,null))[_0x36aa('0x47')](handleError(_0x1afc14,null));};exports['create']=function(_0x5b3d36,_0x27b274){return db[_0x36aa('0x43')]['create'](_0x5b3d36[_0x36aa('0x4b')],{})[_0x36aa('0x29')](respondWithResult(_0x27b274,0xc9))[_0x36aa('0x47')](handleError(_0x27b274,null));};exports[_0x36aa('0x28')]=function(_0x21a81f,_0x1a6fa7){if(_0x21a81f['body']['id']){delete _0x21a81f[_0x36aa('0x4b')]['id'];}return db[_0x36aa('0x43')][_0x36aa('0x4a')]({'where':{'id':_0x21a81f[_0x36aa('0x4c')]['id']}})[_0x36aa('0x29')](handleEntityNotFound(_0x1a6fa7,null))[_0x36aa('0x29')](saveUpdates(_0x21a81f[_0x36aa('0x4b')],null))[_0x36aa('0x29')](respondWithResult(_0x1a6fa7,null))[_0x36aa('0x47')](handleError(_0x1a6fa7,null));};exports[_0x36aa('0x2a')]=function(_0x634dff,_0xc07f05){return db[_0x36aa('0x43')][_0x36aa('0x4a')]({'where':{'id':_0x634dff[_0x36aa('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc07f05,null))[_0x36aa('0x29')](removeEntity(_0xc07f05,null))[_0x36aa('0x47')](handleError(_0xc07f05,null));};exports['describe']=function(_0x404fed,_0x41b02f){return db[_0x36aa('0x43')]['describe']()[_0x36aa('0x29')](respondWithResult(_0x41b02f,null))[_0x36aa('0x47')](handleError(_0x41b02f,null));}; \ No newline at end of file +var _0x1ea9=['fast-json-patch','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x1ea9,0xde));var _0x91ea=function(_0x2c98f0,_0x3f204f){_0x2c98f0=_0x2c98f0-0x0;var _0x4eaf96=_0x1ea9[_0x2c98f0];return _0x4eaf96;};'use strict';var emlformat=require(_0x91ea('0x0'));var rimraf=require(_0x91ea('0x1'));var zipdir=require(_0x91ea('0x2'));var jsonpatch=require(_0x91ea('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x91ea('0x4'));var util=require(_0x91ea('0x5'));var path=require(_0x91ea('0x6'));var sox=require(_0x91ea('0x7'));var csv=require('to-csv');var ejs=require(_0x91ea('0x8'));var fs=require('fs');var fs_extra=require(_0x91ea('0x9'));var _=require('lodash');var squel=require(_0x91ea('0xa'));var crypto=require('crypto');var jsforce=require(_0x91ea('0xb'));var deskjs=require(_0x91ea('0xc'));var toCsv=require(_0x91ea('0xd'));var querystring=require(_0x91ea('0xe'));var Papa=require(_0x91ea('0xf'));var Redis=require('ioredis');var authService=require(_0x91ea('0x10'));var qs=require(_0x91ea('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x91ea('0x12'));var utils=require(_0x91ea('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91ea('0x14'))['db'];function respondWithStatusCode(_0x5b5aee,_0x178391){_0x178391=_0x178391||0xcc;return function(_0x317ef2){if(_0x317ef2){return _0x5b5aee['sendStatus'](_0x178391);}return _0x5b5aee[_0x91ea('0x15')](_0x178391)['end']();};}function respondWithResult(_0x71f6d4,_0x1c60d2){_0x1c60d2=_0x1c60d2||0xc8;return function(_0x52c56e){if(_0x52c56e){return _0x71f6d4[_0x91ea('0x15')](_0x1c60d2)[_0x91ea('0x16')](_0x52c56e);}};}function respondWithFilteredResult(_0x154474,_0x2696f4){return function(_0xce7297){if(_0xce7297){var _0x84b9c8=typeof _0x2696f4[_0x91ea('0x17')]===_0x91ea('0x18')&&typeof _0x2696f4['limit']==='undefined';var _0x176f28=_0xce7297[_0x91ea('0x19')];var _0x583895=_0x84b9c8?0x0:_0x2696f4[_0x91ea('0x17')];var _0x579254=_0x84b9c8?_0xce7297[_0x91ea('0x19')]:_0x2696f4[_0x91ea('0x17')]+_0x2696f4[_0x91ea('0x1a')];var _0x558fa5;if(_0x579254>=_0x176f28){_0x579254=_0x176f28;_0x558fa5=0xc8;}else{_0x558fa5=0xce;}_0x154474[_0x91ea('0x15')](_0x558fa5);return _0x154474[_0x91ea('0x1b')](_0x91ea('0x1c'),_0x583895+'-'+_0x579254+'/'+_0x176f28)[_0x91ea('0x16')](_0xce7297);}return null;};}function patchUpdates(_0x2432ca){return function(_0x1f4b85){try{jsonpatch[_0x91ea('0x1d')](_0x1f4b85,_0x2432ca,!![]);}catch(_0x5b7317){return BPromise[_0x91ea('0x1e')](_0x5b7317);}return _0x1f4b85[_0x91ea('0x1f')]();};}function saveUpdates(_0x4a29c1,_0x320235){return function(_0x199cbb){if(_0x199cbb){return _0x199cbb[_0x91ea('0x20')](_0x4a29c1)[_0x91ea('0x21')](function(_0x399404){return _0x399404;});}return null;};}function removeEntity(_0x4de57b,_0x2f0aad){return function(_0x2f2980){if(_0x2f2980){return _0x2f2980[_0x91ea('0x22')]()[_0x91ea('0x21')](function(){_0x4de57b[_0x91ea('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126b0e,_0x4a95e8){return function(_0x2b0b23){if(!_0x2b0b23){_0x126b0e[_0x91ea('0x23')](0x194);}return _0x2b0b23;};}function handleError(_0x19c5bd,_0x292279){_0x292279=_0x292279||0x1f4;return function(_0x3c9b4){logger[_0x91ea('0x24')](_0x3c9b4[_0x91ea('0x25')]);if(_0x3c9b4[_0x91ea('0x26')]){delete _0x3c9b4[_0x91ea('0x26')];}_0x19c5bd[_0x91ea('0x15')](_0x292279)[_0x91ea('0x27')](_0x3c9b4);};}exports[_0x91ea('0x28')]=function(_0x43df49,_0x94b5c5){var _0x2b9b6d={},_0x2e6110={},_0x3a3f1b={'count':0x0,'rows':[]};var _0xfa402d=_['map'](db[_0x91ea('0x29')][_0x91ea('0x2a')],function(_0x59071d){return{'name':_0x59071d[_0x91ea('0x2b')],'type':_0x59071d[_0x91ea('0x2c')]['key']};});_0x2e6110[_0x91ea('0x2d')]=_[_0x91ea('0x2e')](_0xfa402d,'name');_0x2e6110[_0x91ea('0x2f')]=_[_0x91ea('0x30')](_0x43df49['query']);_0x2e6110[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x2e6110[_0x91ea('0x2d')],_0x2e6110[_0x91ea('0x2f')]);_0x2b9b6d[_0x91ea('0x33')]=_['intersection'](_0x2e6110['model'],qs[_0x91ea('0x34')](_0x43df49[_0x91ea('0x2f')][_0x91ea('0x34')]));_0x2b9b6d[_0x91ea('0x33')]=_0x2b9b6d[_0x91ea('0x33')][_0x91ea('0x35')]?_0x2b9b6d['attributes']:_0x2e6110[_0x91ea('0x2d')];if(!_0x43df49['query'][_0x91ea('0x36')](_0x91ea('0x37'))){_0x2b9b6d[_0x91ea('0x1a')]=qs['limit'](_0x43df49[_0x91ea('0x2f')][_0x91ea('0x1a')]);_0x2b9b6d[_0x91ea('0x17')]=qs[_0x91ea('0x17')](_0x43df49['query'][_0x91ea('0x17')]);}_0x2b9b6d[_0x91ea('0x38')]=qs['sort'](_0x43df49['query'][_0x91ea('0x39')]);_0x2b9b6d[_0x91ea('0x3a')]=qs[_0x91ea('0x31')](_[_0x91ea('0x3b')](_0x43df49[_0x91ea('0x2f')],_0x2e6110[_0x91ea('0x31')]),_0xfa402d);if(_0x43df49[_0x91ea('0x2f')][_0x91ea('0x3c')]){_0x2b9b6d['where']=_[_0x91ea('0x3d')](_0x2b9b6d[_0x91ea('0x3a')],{'$or':_[_0x91ea('0x2e')](_0xfa402d,function(_0x236c7b){if(_0x236c7b[_0x91ea('0x2c')]!==_0x91ea('0x3e')){var _0x3d8499={};_0x3d8499[_0x236c7b['name']]={'$like':'%'+_0x43df49['query'][_0x91ea('0x3c')]+'%'};return _0x3d8499;}})});}_0x2b9b6d=_['merge']({},_0x2b9b6d,_0x43df49[_0x91ea('0x3f')]);var _0x375e67={'where':_0x2b9b6d[_0x91ea('0x3a')]};return db['MailSubstatus'][_0x91ea('0x19')](_0x375e67)[_0x91ea('0x21')](function(_0x14570d){_0x3a3f1b[_0x91ea('0x19')]=_0x14570d;if(_0x43df49[_0x91ea('0x2f')][_0x91ea('0x40')]){_0x2b9b6d['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x91ea('0x41')](_0x2b9b6d);})['then'](function(_0x2e7bdd){_0x3a3f1b[_0x91ea('0x42')]=_0x2e7bdd;return _0x3a3f1b;})['then'](respondWithFilteredResult(_0x94b5c5,_0x2b9b6d))[_0x91ea('0x43')](handleError(_0x94b5c5,null));};exports[_0x91ea('0x44')]=function(_0x58bc4e,_0x4b2303){var _0x54526f={'raw':!![],'where':{'id':_0x58bc4e[_0x91ea('0x45')]['id']}},_0x5ebad3={};_0x5ebad3[_0x91ea('0x2d')]=_[_0x91ea('0x30')](db[_0x91ea('0x29')]['rawAttributes']);_0x5ebad3[_0x91ea('0x2f')]=_[_0x91ea('0x30')](_0x58bc4e[_0x91ea('0x2f')]);_0x5ebad3[_0x91ea('0x31')]=_[_0x91ea('0x32')](_0x5ebad3[_0x91ea('0x2d')],_0x5ebad3['query']);_0x54526f[_0x91ea('0x33')]=_[_0x91ea('0x32')](_0x5ebad3[_0x91ea('0x2d')],qs[_0x91ea('0x34')](_0x58bc4e[_0x91ea('0x2f')][_0x91ea('0x34')]));_0x54526f[_0x91ea('0x33')]=_0x54526f[_0x91ea('0x33')][_0x91ea('0x35')]?_0x54526f[_0x91ea('0x33')]:_0x5ebad3['model'];if(_0x58bc4e[_0x91ea('0x2f')][_0x91ea('0x40')]){_0x54526f[_0x91ea('0x46')]=[{'all':!![]}];}_0x54526f=_[_0x91ea('0x3d')]({},_0x54526f,_0x58bc4e['options']);return db['MailSubstatus']['find'](_0x54526f)[_0x91ea('0x21')](handleEntityNotFound(_0x4b2303,null))[_0x91ea('0x21')](respondWithResult(_0x4b2303,null))[_0x91ea('0x43')](handleError(_0x4b2303,null));};exports[_0x91ea('0x47')]=function(_0x352cc1,_0x13eaf7){return db[_0x91ea('0x29')][_0x91ea('0x47')](_0x352cc1[_0x91ea('0x48')],{})[_0x91ea('0x21')](respondWithResult(_0x13eaf7,0xc9))['catch'](handleError(_0x13eaf7,null));};exports[_0x91ea('0x20')]=function(_0x10e9d9,_0x3e3ab6){if(_0x10e9d9['body']['id']){delete _0x10e9d9['body']['id'];}return db[_0x91ea('0x29')][_0x91ea('0x49')]({'where':{'id':_0x10e9d9['params']['id']}})[_0x91ea('0x21')](handleEntityNotFound(_0x3e3ab6,null))[_0x91ea('0x21')](saveUpdates(_0x10e9d9['body'],null))[_0x91ea('0x21')](respondWithResult(_0x3e3ab6,null))['catch'](handleError(_0x3e3ab6,null));};exports['destroy']=function(_0x1964af,_0x3b1fd9){return db[_0x91ea('0x29')][_0x91ea('0x49')]({'where':{'id':_0x1964af[_0x91ea('0x45')]['id']}})[_0x91ea('0x21')](handleEntityNotFound(_0x3b1fd9,null))[_0x91ea('0x21')](removeEntity(_0x3b1fd9,null))[_0x91ea('0x43')](handleError(_0x3b1fd9,null));};exports[_0x91ea('0x4a')]=function(_0x1dee25,_0x3987ae){return db['MailSubstatus'][_0x91ea('0x4a')]()[_0x91ea('0x21')](respondWithResult(_0x3987ae,null))['catch'](handleError(_0x3987ae,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7bd0ca7..6a82a99 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 _0x8bce=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x34a568,_0x29e859){var _0x340873=function(_0x5dd6f3){while(--_0x5dd6f3){_0x34a568['push'](_0x34a568['shift']());}};_0x340873(++_0x29e859);}(_0x8bce,0xa9));var _0xe8bc=function(_0x12d034,_0x430f51){_0x12d034=_0x12d034-0x0;var _0x39d6e5=_0x8bce[_0x12d034];return _0x39d6e5;};'use strict';var EventEmitter=require(_0xe8bc('0x0'));var MailSubstatus=require(_0xe8bc('0x1'))['db'][_0xe8bc('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xe8bc('0x3')](0x0);var events={'afterUpdate':_0xe8bc('0x4')};function emitEvent(_0x41ad22){return function(_0x27e0ba,_0x5cdbde,_0x3eb531){MailSubstatusEvents[_0xe8bc('0x5')](_0x41ad22+':'+_0x27e0ba['id'],_0x27e0ba);MailSubstatusEvents[_0xe8bc('0x5')](_0x41ad22,_0x27e0ba);_0x3eb531(null);};}for(var e in events){if(events[_0xe8bc('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xe8bc('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x2390=['../../mysqldb','setMaxListeners','emit','hasOwnProperty','exports'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0x2390,0x6e));var _0x0239=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2390[_0x4b2436];return _0x4f5ab2;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x0239('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0239('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x1c880c){return function(_0x24b134,_0x2b5f58,_0x336665){MailSubstatusEvents[_0x0239('0x2')](_0x1c880c+':'+_0x24b134['id'],_0x24b134);MailSubstatusEvents['emit'](_0x1c880c,_0x24b134);_0x336665(null);};}for(var e in events){if(events[_0x0239('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x0239('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d7821ed..efadbee 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 _0x47e5=['define','MailSubstatus','Condition','update','name','mailSubstatus','then','catch','exports','models'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x47e5,0x102));var _0x547e=function(_0x3cf150,_0x178cb5){_0x3cf150=_0x3cf150-0x0;var _0x931f8b=_0x47e5[_0x3cf150];return _0x931f8b;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x547e('0x0')]=function(_0x5b6086){var _0x20ae3c=_0x5b6086[_0x547e('0x1')];return _0x5b6086[_0x547e('0x2')](_0x547e('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x46b699,_0x534423,_0x1c927d){return _0x20ae3c[_0x547e('0x4')][_0x547e('0x5')]({'value':_0x46b699[_0x547e('0x6')]},{'where':{'field':_0x547e('0x7'),'value':_0x46b699['_previousDataValues']['name']}})[_0x547e('0x8')](function(){_0x1c927d();})[_0x547e('0x9')](function(_0x474b32){_0x1c927d(_0x474b32);});}}});}; \ No newline at end of file +var _0xa108=['mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','models','define'];(function(_0xfbf42,_0x305f62){var _0xe7c787=function(_0x295e41){while(--_0x295e41){_0xfbf42['push'](_0xfbf42['shift']());}};_0xe7c787(++_0x305f62);}(_0xa108,0xc4));var _0x8a10=function(_0x4cd0f7,_0x550f0f){_0x4cd0f7=_0x4cd0f7-0x0;var _0x3a06a4=_0xa108[_0x4cd0f7];return _0x3a06a4;};'use strict';var attributes=require(_0x8a10('0x0'));module[_0x8a10('0x1')]=function(_0x2ed6f8){var _0x1a310f=_0x2ed6f8[_0x8a10('0x2')];return _0x2ed6f8[_0x8a10('0x3')]('MailSubstatus',attributes,{'tableName':_0x8a10('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x420375,_0x225bb0,_0x5d8000){return _0x1a310f['Condition'][_0x8a10('0x5')]({'value':_0x420375[_0x8a10('0x6')]},{'where':{'field':_0x8a10('0x7'),'value':_0x420375[_0x8a10('0x8')][_0x8a10('0x6')]}})[_0x8a10('0x9')](function(){_0x5d8000();})['catch'](function(_0x5e0026){_0x5d8000(_0x5e0026);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c8b1616..7faf920 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 _0xf804=['stringify','error','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x3a4aa1,_0x5acb2e){var _0x9e1bdf=function(_0x163537){while(--_0x163537){_0x3a4aa1['push'](_0x3a4aa1['shift']());}};_0x9e1bdf(++_0x5acb2e);}(_0xf804,0x13a));var _0x4f80=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf804[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var moment=require(_0x4f80('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f80('0x3'));var db=require(_0x4f80('0x4'))['db'];var utils=require(_0x4f80('0x5'));var logger=require(_0x4f80('0x6'))(_0x4f80('0x7'));var config=require(_0x4f80('0x8'));var jayson=require(_0x4f80('0x9'));var client=jayson['client'][_0x4f80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x425276,_0xd34cbe,_0x5763da){return new BPromise(function(_0x551a5c,_0x5a8c68){return client[_0x4f80('0xb')](_0x425276,_0x5763da)[_0x4f80('0xc')](function(_0x2559b8){logger[_0x4f80('0xd')]('MailSubstatus,\x20%s,\x20%s',_0xd34cbe,_0x4f80('0xe'));logger[_0x4f80('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xd34cbe,_0x4f80('0xe'),JSON[_0x4f80('0x10')](_0x2559b8));if(_0x2559b8['error']){if(_0x2559b8[_0x4f80('0x11')]['code']===0x1f4){logger[_0x4f80('0x11')]('MailSubstatus,\x20%s,\x20%s',_0xd34cbe,_0x2559b8['error'][_0x4f80('0x12')]);return _0x5a8c68(_0x2559b8[_0x4f80('0x11')]['message']);}logger[_0x4f80('0x11')](_0x4f80('0x13'),_0xd34cbe,_0x2559b8[_0x4f80('0x11')][_0x4f80('0x12')]);return _0x551a5c(_0x2559b8[_0x4f80('0x11')][_0x4f80('0x12')]);}else{logger[_0x4f80('0xd')](_0x4f80('0x13'),_0xd34cbe,'request\x20sent');_0x551a5c(_0x2559b8[_0x4f80('0x14')][_0x4f80('0x12')]);}})[_0x4f80('0x15')](function(_0x4e7425){logger[_0x4f80('0x11')](_0x4f80('0x13'),_0xd34cbe,_0x4e7425);_0x5a8c68(_0x4e7425);});});} \ No newline at end of file +var _0x0fcc=['info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug','error','code','MailSubstatus,\x20%s,\x20%s','message'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0fcc,0x8f));var _0xc0fc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0fcc[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0fc('0x0'));var BPromise=require('bluebird');var rs=require(_0xc0fc('0x1'));var fs=require('fs');var Redis=require(_0xc0fc('0x2'));var db=require(_0xc0fc('0x3'))['db'];var utils=require(_0xc0fc('0x4'));var logger=require(_0xc0fc('0x5'))(_0xc0fc('0x6'));var config=require(_0xc0fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0fc('0x8')][_0xc0fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1affe9,_0x4b8eaa,_0x579235){return new BPromise(function(_0x196b26,_0x155bb8){return client[_0xc0fc('0xa')](_0x1affe9,_0x579235)['then'](function(_0x543c4c){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x4b8eaa,_0xc0fc('0xb'));logger[_0xc0fc('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4b8eaa,_0xc0fc('0xb'),JSON['stringify'](_0x543c4c));if(_0x543c4c[_0xc0fc('0xd')]){if(_0x543c4c[_0xc0fc('0xd')][_0xc0fc('0xe')]===0x1f4){logger[_0xc0fc('0xd')](_0xc0fc('0xf'),_0x4b8eaa,_0x543c4c[_0xc0fc('0xd')][_0xc0fc('0x10')]);return _0x155bb8(_0x543c4c[_0xc0fc('0xd')]['message']);}logger['error'](_0xc0fc('0xf'),_0x4b8eaa,_0x543c4c[_0xc0fc('0xd')][_0xc0fc('0x10')]);return _0x196b26(_0x543c4c['error'][_0xc0fc('0x10')]);}else{logger[_0xc0fc('0x11')](_0xc0fc('0xf'),_0x4b8eaa,'request\x20sent');_0x196b26(_0x543c4c[_0xc0fc('0x12')][_0xc0fc('0x10')]);}})[_0xc0fc('0x13')](function(_0xb1356b){logger['error'](_0xc0fc('0xf'),_0x4b8eaa,_0xb1356b);_0x155bb8(_0xb1356b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ed23ca0..de09748 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 _0xd12c=['post','put','update','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd12c,0x9d));var _0xcd12=function(_0x23c99f,_0x3c46e8){_0x23c99f=_0x23c99f-0x0;var _0x424726=_0xd12c[_0x23c99f];return _0x424726;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd12('0x0'));var timeout=require('connect-timeout');var express=require(_0xcd12('0x1'));var router=express[_0xcd12('0x2')]();var fs_extra=require(_0xcd12('0x3'));var auth=require(_0xcd12('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd12('0x5'));var controller=require(_0xcd12('0x6'));router[_0xcd12('0x7')]('/',auth[_0xcd12('0x8')](),controller[_0xcd12('0x9')]);router[_0xcd12('0x7')](_0xcd12('0xa'),auth[_0xcd12('0x8')](),controller['describe']);router['get'](_0xcd12('0xb'),auth[_0xcd12('0x8')](),controller[_0xcd12('0xc')]);router[_0xcd12('0xd')]('/',auth[_0xcd12('0x8')](),controller['create']);router[_0xcd12('0xe')](_0xcd12('0xb'),auth[_0xcd12('0x8')](),controller[_0xcd12('0xf')]);router['delete']('/:id',auth[_0xcd12('0x8')](),controller['destroy']);module[_0xcd12('0x10')]=router; \ No newline at end of file +var _0x1884=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5705a7,_0x464bf1){var _0x5a20a8=function(_0x6ff5fe){while(--_0x6ff5fe){_0x5705a7['push'](_0x5705a7['shift']());}};_0x5a20a8(++_0x464bf1);}(_0x1884,0x1cf));var _0x4188=function(_0x26d5db,_0x3e2a2b){_0x26d5db=_0x26d5db-0x0;var _0x5a0f16=_0x1884[_0x26d5db];return _0x5a0f16;};'use strict';var multer=require(_0x4188('0x0'));var util=require(_0x4188('0x1'));var path=require(_0x4188('0x2'));var timeout=require(_0x4188('0x3'));var express=require('express');var router=express[_0x4188('0x4')]();var fs_extra=require(_0x4188('0x5'));var auth=require(_0x4188('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4188('0x7'));var controller=require(_0x4188('0x8'));router[_0x4188('0x9')]('/',auth[_0x4188('0xa')](),controller[_0x4188('0xb')]);router[_0x4188('0x9')]('/describe',auth[_0x4188('0xa')](),controller[_0x4188('0xc')]);router[_0x4188('0x9')](_0x4188('0xd'),auth[_0x4188('0xa')](),controller[_0x4188('0xe')]);router[_0x4188('0xf')]('/',auth['isAuthenticated'](),controller[_0x4188('0x10')]);router[_0x4188('0x11')](_0x4188('0xd'),auth[_0x4188('0xa')](),controller[_0x4188('0x12')]);router[_0x4188('0x13')](_0x4188('0xd'),auth[_0x4188('0xa')](),controller[_0x4188('0x14')]);module[_0x4188('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ed67073..c2345c5 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x34e8,0x12c));var _0x834e=function(_0x337b02,_0x36654e){_0x337b02=_0x337b02-0x0;var _0x432ff4=_0x34e8[_0x337b02];return _0x432ff4;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x38bdfd,_0x1e35ed){var _0x27d80e=function(_0x4c34ad){while(--_0x4c34ad){_0x38bdfd['push'](_0x38bdfd['shift']());}};_0x27d80e(++_0x1e35ed);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x00bb[_0x47b58b];return _0x46bebe;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index a269e71..c8b3e4c 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 _0xea75=['rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','apply','reject','update','then','destroy','error','stack','name','send','map','MailTransferReport'];(function(_0x5f13a2,_0x357de9){var _0xbd2015=function(_0x4253e5){while(--_0x4253e5){_0x5f13a2['push'](_0x5f13a2['shift']());}};_0xbd2015(++_0x357de9);}(_0xea75,0xf9));var _0x5ea7=function(_0x5b123c,_0x1eb070){_0x5b123c=_0x5b123c-0x0;var _0x334406=_0xea75[_0x5b123c];return _0x334406;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ea7('0x0'));var zipdir=require(_0x5ea7('0x1'));var jsonpatch=require(_0x5ea7('0x2'));var rp=require('request-promise');var moment=require(_0x5ea7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5ea7('0x4'));var util=require('util');var path=require(_0x5ea7('0x5'));var sox=require(_0x5ea7('0x6'));var csv=require(_0x5ea7('0x7'));var ejs=require(_0x5ea7('0x8'));var fs=require('fs');var fs_extra=require(_0x5ea7('0x9'));var _=require(_0x5ea7('0xa'));var squel=require(_0x5ea7('0xb'));var crypto=require(_0x5ea7('0xc'));var jsforce=require(_0x5ea7('0xd'));var deskjs=require(_0x5ea7('0xe'));var toCsv=require(_0x5ea7('0x7'));var querystring=require(_0x5ea7('0xf'));var Papa=require(_0x5ea7('0x10'));var Redis=require(_0x5ea7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5ea7('0x12'));var hardwareService=require(_0x5ea7('0x13'));var logger=require(_0x5ea7('0x14'))(_0x5ea7('0x15'));var utils=require(_0x5ea7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5ea7('0x17'));var db=require(_0x5ea7('0x18'))['db'];function respondWithStatusCode(_0x5b0393,_0x4a102f){_0x4a102f=_0x4a102f||0xcc;return function(_0x5c7069){if(_0x5c7069){return _0x5b0393[_0x5ea7('0x19')](_0x4a102f);}return _0x5b0393['status'](_0x4a102f)['end']();};}function respondWithResult(_0x86322d,_0x584d24){_0x584d24=_0x584d24||0xc8;return function(_0x274437){if(_0x274437){return _0x86322d['status'](_0x584d24)[_0x5ea7('0x1a')](_0x274437);}};}function respondWithFilteredResult(_0x871421,_0xe89c7b){return function(_0x27c346){if(_0x27c346){var _0x51ad9d=typeof _0xe89c7b[_0x5ea7('0x1b')]==='undefined'&&typeof _0xe89c7b['limit']===_0x5ea7('0x1c');var _0x5b9801=_0x27c346[_0x5ea7('0x1d')];var _0xbe6c67=_0x51ad9d?0x0:_0xe89c7b[_0x5ea7('0x1b')];var _0x30973b=_0x51ad9d?_0x27c346[_0x5ea7('0x1d')]:_0xe89c7b['offset']+_0xe89c7b[_0x5ea7('0x1e')];var _0x5f5092;if(_0x30973b>=_0x5b9801){_0x30973b=_0x5b9801;_0x5f5092=0xc8;}else{_0x5f5092=0xce;}_0x871421[_0x5ea7('0x1f')](_0x5f5092);return _0x871421['set']('Content-Range',_0xbe6c67+'-'+_0x30973b+'/'+_0x5b9801)['json'](_0x27c346);}return null;};}function patchUpdates(_0x27b1fd){return function(_0xf4581f){try{jsonpatch[_0x5ea7('0x20')](_0xf4581f,_0x27b1fd,!![]);}catch(_0x20ddaf){return BPromise[_0x5ea7('0x21')](_0x20ddaf);}return _0xf4581f['save']();};}function saveUpdates(_0x2eb153,_0x2bc855){return function(_0x47cd3c){if(_0x47cd3c){return _0x47cd3c[_0x5ea7('0x22')](_0x2eb153)[_0x5ea7('0x23')](function(_0x1f0a2a){return _0x1f0a2a;});}return null;};}function removeEntity(_0x2656b0,_0x663e34){return function(_0x4461d7){if(_0x4461d7){return _0x4461d7[_0x5ea7('0x24')]()[_0x5ea7('0x23')](function(){_0x2656b0[_0x5ea7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83f592,_0x4ab954){return function(_0x17210a){if(!_0x17210a){_0x83f592[_0x5ea7('0x19')](0x194);}return _0x17210a;};}function handleError(_0x480384,_0x31f908){_0x31f908=_0x31f908||0x1f4;return function(_0x75db2e){logger[_0x5ea7('0x25')](_0x75db2e[_0x5ea7('0x26')]);if(_0x75db2e[_0x5ea7('0x27')]){delete _0x75db2e[_0x5ea7('0x27')];}_0x480384[_0x5ea7('0x1f')](_0x31f908)[_0x5ea7('0x28')](_0x75db2e);};}exports['index']=function(_0x43a24f,_0x1cace6){var _0x49fa01={},_0x58ae72={},_0x20dc44={'count':0x0,'rows':[]};var _0x192b90=_[_0x5ea7('0x29')](db[_0x5ea7('0x2a')][_0x5ea7('0x2b')],function(_0x4f566d){return{'name':_0x4f566d[_0x5ea7('0x2c')],'type':_0x4f566d[_0x5ea7('0x2d')]['key']};});_0x58ae72[_0x5ea7('0x2e')]=_['map'](_0x192b90,_0x5ea7('0x27'));_0x58ae72['query']=_['keys'](_0x43a24f[_0x5ea7('0x2f')]);_0x58ae72['filters']=_[_0x5ea7('0x30')](_0x58ae72[_0x5ea7('0x2e')],_0x58ae72[_0x5ea7('0x2f')]);_0x49fa01[_0x5ea7('0x31')]=_['intersection'](_0x58ae72[_0x5ea7('0x2e')],qs[_0x5ea7('0x32')](_0x43a24f[_0x5ea7('0x2f')]['fields']));_0x49fa01['attributes']=_0x49fa01['attributes'][_0x5ea7('0x33')]?_0x49fa01[_0x5ea7('0x31')]:_0x58ae72[_0x5ea7('0x2e')];if(!_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x34')](_0x5ea7('0x35'))){_0x49fa01[_0x5ea7('0x1e')]=qs[_0x5ea7('0x1e')](_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x1e')]);_0x49fa01[_0x5ea7('0x1b')]=qs[_0x5ea7('0x1b')](_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x1b')]);}_0x49fa01['order']=qs[_0x5ea7('0x36')](_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x36')]);_0x49fa01[_0x5ea7('0x37')]=qs[_0x5ea7('0x38')](_['pick'](_0x43a24f['query'],_0x58ae72['filters']),_0x192b90);if(_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x39')]){_0x49fa01['where']=_[_0x5ea7('0x3a')](_0x49fa01[_0x5ea7('0x37')],{'$or':_[_0x5ea7('0x29')](_0x192b90,function(_0x1bedc8){if(_0x1bedc8[_0x5ea7('0x2d')]!==_0x5ea7('0x3b')){var _0x4eafcd={};_0x4eafcd[_0x1bedc8['name']]={'$like':'%'+_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x39')]+'%'};return _0x4eafcd;}})});}_0x49fa01=_[_0x5ea7('0x3a')]({},_0x49fa01,_0x43a24f[_0x5ea7('0x3c')]);var _0x145616={'where':_0x49fa01[_0x5ea7('0x37')]};return db[_0x5ea7('0x2a')][_0x5ea7('0x1d')](_0x145616)['then'](function(_0x51f3ad){_0x20dc44['count']=_0x51f3ad;if(_0x43a24f[_0x5ea7('0x2f')][_0x5ea7('0x3d')]){_0x49fa01[_0x5ea7('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x5ea7('0x3f')](_0x49fa01);})[_0x5ea7('0x23')](function(_0xbd5243){_0x20dc44[_0x5ea7('0x40')]=_0xbd5243;return _0x20dc44;})['then'](respondWithFilteredResult(_0x1cace6,_0x49fa01))['catch'](handleError(_0x1cace6,null));};exports[_0x5ea7('0x41')]=function(_0x59da52,_0x29a2ad){var _0x236b62={'raw':!![],'where':{'id':_0x59da52[_0x5ea7('0x42')]['id']}},_0x449c64={};_0x449c64[_0x5ea7('0x2e')]=_['keys'](db[_0x5ea7('0x2a')][_0x5ea7('0x2b')]);_0x449c64[_0x5ea7('0x2f')]=_[_0x5ea7('0x43')](_0x59da52['query']);_0x449c64[_0x5ea7('0x38')]=_[_0x5ea7('0x30')](_0x449c64[_0x5ea7('0x2e')],_0x449c64[_0x5ea7('0x2f')]);_0x236b62[_0x5ea7('0x31')]=_['intersection'](_0x449c64['model'],qs[_0x5ea7('0x32')](_0x59da52['query'][_0x5ea7('0x32')]));_0x236b62[_0x5ea7('0x31')]=_0x236b62[_0x5ea7('0x31')][_0x5ea7('0x33')]?_0x236b62[_0x5ea7('0x31')]:_0x449c64[_0x5ea7('0x2e')];if(_0x59da52[_0x5ea7('0x2f')][_0x5ea7('0x3d')]){_0x236b62[_0x5ea7('0x3e')]=[{'all':!![]}];}_0x236b62=_['merge']({},_0x236b62,_0x59da52['options']);return db['MailTransferReport'][_0x5ea7('0x44')](_0x236b62)[_0x5ea7('0x23')](handleEntityNotFound(_0x29a2ad,null))[_0x5ea7('0x23')](respondWithResult(_0x29a2ad,null))[_0x5ea7('0x45')](handleError(_0x29a2ad,null));};exports[_0x5ea7('0x46')]=function(_0x52724b,_0x1ea049){return db[_0x5ea7('0x2a')][_0x5ea7('0x46')](_0x52724b[_0x5ea7('0x47')],{})[_0x5ea7('0x23')](respondWithResult(_0x1ea049,0xc9))['catch'](handleError(_0x1ea049,null));};exports['update']=function(_0x44e7f5,_0x5f9584){if(_0x44e7f5[_0x5ea7('0x47')]['id']){delete _0x44e7f5[_0x5ea7('0x47')]['id'];}return db[_0x5ea7('0x2a')][_0x5ea7('0x44')]({'where':{'id':_0x44e7f5[_0x5ea7('0x42')]['id']}})[_0x5ea7('0x23')](handleEntityNotFound(_0x5f9584,null))['then'](saveUpdates(_0x44e7f5['body'],null))[_0x5ea7('0x23')](respondWithResult(_0x5f9584,null))[_0x5ea7('0x45')](handleError(_0x5f9584,null));};exports[_0x5ea7('0x24')]=function(_0x464934,_0xbb0f6b){return db[_0x5ea7('0x2a')][_0x5ea7('0x44')]({'where':{'id':_0x464934[_0x5ea7('0x42')]['id']}})['then'](handleEntityNotFound(_0xbb0f6b,null))['then'](removeEntity(_0xbb0f6b,null))['catch'](handleError(_0xbb0f6b,null));};exports[_0x5ea7('0x48')]=function(_0x222a45,_0x248742){return db['MailTransferReport'][_0x5ea7('0x48')]()['then'](respondWithResult(_0x248742,null))['catch'](handleError(_0x248742,null));}; \ No newline at end of file +var _0x3bdc=['fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','sendStatus','name','send','index','map','MailTransferReport'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x3bdc,0xb8));var _0xc3bd=function(_0x4510a0,_0x17ce31){_0x4510a0=_0x4510a0-0x0;var _0x4bd257=_0x3bdc[_0x4510a0];return _0x4bd257;};'use strict';var emlformat=require(_0xc3bd('0x0'));var rimraf=require(_0xc3bd('0x1'));var zipdir=require(_0xc3bd('0x2'));var jsonpatch=require(_0xc3bd('0x3'));var rp=require('request-promise');var moment=require(_0xc3bd('0x4'));var BPromise=require(_0xc3bd('0x5'));var Mustache=require(_0xc3bd('0x6'));var util=require('util');var path=require(_0xc3bd('0x7'));var sox=require(_0xc3bd('0x8'));var csv=require(_0xc3bd('0x9'));var ejs=require(_0xc3bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc3bd('0xb'));var crypto=require(_0xc3bd('0xc'));var jsforce=require(_0xc3bd('0xd'));var deskjs=require(_0xc3bd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc3bd('0xf'));var authService=require(_0xc3bd('0x10'));var qs=require(_0xc3bd('0x11'));var as=require(_0xc3bd('0x12'));var hardwareService=require(_0xc3bd('0x13'));var logger=require(_0xc3bd('0x14'))(_0xc3bd('0x15'));var utils=require('../../config/utils');var config=require(_0xc3bd('0x16'));var licenseUtil=require(_0xc3bd('0x17'));var db=require(_0xc3bd('0x18'))['db'];function respondWithStatusCode(_0x503405,_0x4f6a20){_0x4f6a20=_0x4f6a20||0xcc;return function(_0x3b436e){if(_0x3b436e){return _0x503405['sendStatus'](_0x4f6a20);}return _0x503405[_0xc3bd('0x19')](_0x4f6a20)[_0xc3bd('0x1a')]();};}function respondWithResult(_0x16f6ca,_0x20506c){_0x20506c=_0x20506c||0xc8;return function(_0xaf7924){if(_0xaf7924){return _0x16f6ca[_0xc3bd('0x19')](_0x20506c)['json'](_0xaf7924);}};}function respondWithFilteredResult(_0x1bc646,_0x11d6b2){return function(_0x43494d){if(_0x43494d){var _0x3392cf=typeof _0x11d6b2[_0xc3bd('0x1b')]===_0xc3bd('0x1c')&&typeof _0x11d6b2[_0xc3bd('0x1d')]===_0xc3bd('0x1c');var _0x464c7a=_0x43494d['count'];var _0xec529=_0x3392cf?0x0:_0x11d6b2[_0xc3bd('0x1b')];var _0x4e9bd2=_0x3392cf?_0x43494d[_0xc3bd('0x1e')]:_0x11d6b2['offset']+_0x11d6b2[_0xc3bd('0x1d')];var _0x455bad;if(_0x4e9bd2>=_0x464c7a){_0x4e9bd2=_0x464c7a;_0x455bad=0xc8;}else{_0x455bad=0xce;}_0x1bc646[_0xc3bd('0x19')](_0x455bad);return _0x1bc646[_0xc3bd('0x1f')](_0xc3bd('0x20'),_0xec529+'-'+_0x4e9bd2+'/'+_0x464c7a)[_0xc3bd('0x21')](_0x43494d);}return null;};}function patchUpdates(_0x1c90c4){return function(_0x41732a){try{jsonpatch[_0xc3bd('0x22')](_0x41732a,_0x1c90c4,!![]);}catch(_0x1ee05c){return BPromise[_0xc3bd('0x23')](_0x1ee05c);}return _0x41732a['save']();};}function saveUpdates(_0x7c3caa,_0x4465a6){return function(_0x2afba0){if(_0x2afba0){return _0x2afba0['update'](_0x7c3caa)['then'](function(_0x21c43e){return _0x21c43e;});}return null;};}function removeEntity(_0x4c0f3a,_0x41d9ae){return function(_0x2ca40a){if(_0x2ca40a){return _0x2ca40a[_0xc3bd('0x24')]()[_0xc3bd('0x25')](function(){_0x4c0f3a['status'](0xcc)[_0xc3bd('0x1a')]();});}};}function handleEntityNotFound(_0x4f3bdc,_0x884284){return function(_0x1f4c8a){if(!_0x1f4c8a){_0x4f3bdc[_0xc3bd('0x26')](0x194);}return _0x1f4c8a;};}function handleError(_0x1eec0c,_0x3b21b2){_0x3b21b2=_0x3b21b2||0x1f4;return function(_0x2d81de){logger['error'](_0x2d81de['stack']);if(_0x2d81de[_0xc3bd('0x27')]){delete _0x2d81de[_0xc3bd('0x27')];}_0x1eec0c[_0xc3bd('0x19')](_0x3b21b2)[_0xc3bd('0x28')](_0x2d81de);};}exports[_0xc3bd('0x29')]=function(_0x40b5f3,_0x455877){var _0x414d27={},_0x364d11={},_0x3af478={'count':0x0,'rows':[]};var _0x4b49ff=_[_0xc3bd('0x2a')](db[_0xc3bd('0x2b')]['rawAttributes'],function(_0x27449b){return{'name':_0x27449b[_0xc3bd('0x2c')],'type':_0x27449b[_0xc3bd('0x2d')][_0xc3bd('0x2e')]};});_0x364d11[_0xc3bd('0x2f')]=_[_0xc3bd('0x2a')](_0x4b49ff,_0xc3bd('0x27'));_0x364d11['query']=_[_0xc3bd('0x30')](_0x40b5f3[_0xc3bd('0x31')]);_0x364d11['filters']=_[_0xc3bd('0x32')](_0x364d11[_0xc3bd('0x2f')],_0x364d11[_0xc3bd('0x31')]);_0x414d27[_0xc3bd('0x33')]=_[_0xc3bd('0x32')](_0x364d11[_0xc3bd('0x2f')],qs[_0xc3bd('0x34')](_0x40b5f3[_0xc3bd('0x31')][_0xc3bd('0x34')]));_0x414d27[_0xc3bd('0x33')]=_0x414d27[_0xc3bd('0x33')][_0xc3bd('0x35')]?_0x414d27[_0xc3bd('0x33')]:_0x364d11[_0xc3bd('0x2f')];if(!_0x40b5f3[_0xc3bd('0x31')]['hasOwnProperty'](_0xc3bd('0x36'))){_0x414d27[_0xc3bd('0x1d')]=qs[_0xc3bd('0x1d')](_0x40b5f3['query'][_0xc3bd('0x1d')]);_0x414d27[_0xc3bd('0x1b')]=qs[_0xc3bd('0x1b')](_0x40b5f3[_0xc3bd('0x31')][_0xc3bd('0x1b')]);}_0x414d27[_0xc3bd('0x37')]=qs[_0xc3bd('0x38')](_0x40b5f3['query']['sort']);_0x414d27[_0xc3bd('0x39')]=qs[_0xc3bd('0x3a')](_[_0xc3bd('0x3b')](_0x40b5f3['query'],_0x364d11[_0xc3bd('0x3a')]),_0x4b49ff);if(_0x40b5f3[_0xc3bd('0x31')][_0xc3bd('0x3c')]){_0x414d27[_0xc3bd('0x39')]=_[_0xc3bd('0x3d')](_0x414d27[_0xc3bd('0x39')],{'$or':_['map'](_0x4b49ff,function(_0xa68d94){if(_0xa68d94['type']!==_0xc3bd('0x3e')){var _0x2752b3={};_0x2752b3[_0xa68d94['name']]={'$like':'%'+_0x40b5f3[_0xc3bd('0x31')][_0xc3bd('0x3c')]+'%'};return _0x2752b3;}})});}_0x414d27=_[_0xc3bd('0x3d')]({},_0x414d27,_0x40b5f3[_0xc3bd('0x3f')]);var _0x32077c={'where':_0x414d27['where']};return db[_0xc3bd('0x2b')]['count'](_0x32077c)[_0xc3bd('0x25')](function(_0x3a0be1){_0x3af478[_0xc3bd('0x1e')]=_0x3a0be1;if(_0x40b5f3[_0xc3bd('0x31')]['includeAll']){_0x414d27[_0xc3bd('0x40')]=[{'all':!![]}];}return db[_0xc3bd('0x2b')][_0xc3bd('0x41')](_0x414d27);})['then'](function(_0x1a8306){_0x3af478[_0xc3bd('0x42')]=_0x1a8306;return _0x3af478;})[_0xc3bd('0x25')](respondWithFilteredResult(_0x455877,_0x414d27))['catch'](handleError(_0x455877,null));};exports[_0xc3bd('0x43')]=function(_0x50438f,_0x31fd3a){var _0x229ba2={'raw':!![],'where':{'id':_0x50438f[_0xc3bd('0x44')]['id']}},_0x4130db={};_0x4130db['model']=_[_0xc3bd('0x30')](db['MailTransferReport'][_0xc3bd('0x45')]);_0x4130db[_0xc3bd('0x31')]=_[_0xc3bd('0x30')](_0x50438f['query']);_0x4130db[_0xc3bd('0x3a')]=_[_0xc3bd('0x32')](_0x4130db[_0xc3bd('0x2f')],_0x4130db[_0xc3bd('0x31')]);_0x229ba2[_0xc3bd('0x33')]=_['intersection'](_0x4130db[_0xc3bd('0x2f')],qs[_0xc3bd('0x34')](_0x50438f[_0xc3bd('0x31')][_0xc3bd('0x34')]));_0x229ba2[_0xc3bd('0x33')]=_0x229ba2['attributes']['length']?_0x229ba2[_0xc3bd('0x33')]:_0x4130db[_0xc3bd('0x2f')];if(_0x50438f[_0xc3bd('0x31')][_0xc3bd('0x46')]){_0x229ba2['include']=[{'all':!![]}];}_0x229ba2=_['merge']({},_0x229ba2,_0x50438f[_0xc3bd('0x3f')]);return db[_0xc3bd('0x2b')]['find'](_0x229ba2)[_0xc3bd('0x25')](handleEntityNotFound(_0x31fd3a,null))[_0xc3bd('0x25')](respondWithResult(_0x31fd3a,null))[_0xc3bd('0x47')](handleError(_0x31fd3a,null));};exports[_0xc3bd('0x48')]=function(_0x37486c,_0x5c1ca6){return db[_0xc3bd('0x2b')][_0xc3bd('0x48')](_0x37486c[_0xc3bd('0x49')],{})[_0xc3bd('0x25')](respondWithResult(_0x5c1ca6,0xc9))['catch'](handleError(_0x5c1ca6,null));};exports['update']=function(_0x17c7d2,_0x331d15){if(_0x17c7d2[_0xc3bd('0x49')]['id']){delete _0x17c7d2['body']['id'];}return db[_0xc3bd('0x2b')][_0xc3bd('0x4a')]({'where':{'id':_0x17c7d2['params']['id']}})[_0xc3bd('0x25')](handleEntityNotFound(_0x331d15,null))[_0xc3bd('0x25')](saveUpdates(_0x17c7d2['body'],null))[_0xc3bd('0x25')](respondWithResult(_0x331d15,null))[_0xc3bd('0x47')](handleError(_0x331d15,null));};exports[_0xc3bd('0x24')]=function(_0x258e6a,_0x2e70d0){return db[_0xc3bd('0x2b')][_0xc3bd('0x4a')]({'where':{'id':_0x258e6a['params']['id']}})[_0xc3bd('0x25')](handleEntityNotFound(_0x2e70d0,null))[_0xc3bd('0x25')](removeEntity(_0x2e70d0,null))[_0xc3bd('0x47')](handleError(_0x2e70d0,null));};exports[_0xc3bd('0x4b')]=function(_0x3e4b81,_0x43b52c){return db['MailTransferReport'][_0xc3bd('0x4b')]()['then'](respondWithResult(_0x43b52c,null))[_0xc3bd('0x47')](handleError(_0x43b52c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d314f88..03d315c 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 _0x943a=['lodash','api','moment','bluebird','rimraf','../../config/environment','exports','report_mail_transfer','uniqueid'];(function(_0x4f054c,_0x3a18b6){var _0x22488d=function(_0x10af22){while(--_0x10af22){_0x4f054c['push'](_0x4f054c['shift']());}};_0x22488d(++_0x3a18b6);}(_0x943a,0xfc));var _0xa943=function(_0x3a48ee,_0x261ad0){_0x3a48ee=_0x3a48ee-0x0;var _0x4d25f4=_0x943a[_0x3a48ee];return _0x4d25f4;};'use strict';var _=require(_0xa943('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa943('0x1'));var moment=require(_0xa943('0x2'));var BPromise=require(_0xa943('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa943('0x4'));var config=require(_0xa943('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0xa943('0x6')]=function(_0x441e94,_0x1069d5){return _0x441e94['define']('MailTransferReport',attributes,{'tableName':_0xa943('0x7'),'paranoid':![],'indexes':[{'name':_0xa943('0x8'),'fields':[_0xa943('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66d9=['util','../../config/logger','api','moment','path','rimraf','define','MailTransferReport','uniqueid','lodash'];(function(_0x4e6b3c,_0x2ad9db){var _0x344aaf=function(_0x419b2){while(--_0x419b2){_0x4e6b3c['push'](_0x4e6b3c['shift']());}};_0x344aaf(++_0x2ad9db);}(_0x66d9,0x1e9));var _0x966d=function(_0x3e8488,_0x59259a){_0x3e8488=_0x3e8488-0x0;var _0x4570c5=_0x66d9[_0x3e8488];return _0x4570c5;};'use strict';var _=require(_0x966d('0x0'));var util=require(_0x966d('0x1'));var logger=require(_0x966d('0x2'))(_0x966d('0x3'));var moment=require(_0x966d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x966d('0x5'));var rimraf=require(_0x966d('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x11538a,_0x1aa2b7){return _0x11538a[_0x966d('0x7')](_0x966d('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x966d('0x9'),'fields':[_0x966d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index f286c84..d30c250 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 _0xd899=['jayson/promise','client','request','then','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','info','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x253303,_0x53899b){var _0x5a7d23=function(_0x4152ee){while(--_0x4152ee){_0x253303['push'](_0x253303['shift']());}};_0x5a7d23(++_0x53899b);}(_0xd899,0x189));var _0x9d89=function(_0x58680e,_0x533f02){_0x58680e=_0x58680e-0x0;var _0x23a986=_0xd899[_0x58680e];return _0x23a986;};'use strict';var _=require(_0x9d89('0x0'));var util=require('util');var moment=require(_0x9d89('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d89('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d89('0x3'))['db'];var utils=require(_0x9d89('0x4'));var logger=require('../../config/logger')(_0x9d89('0x5'));var config=require(_0x9d89('0x6'));var jayson=require(_0x9d89('0x7'));var client=jayson[_0x9d89('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23887f,_0x557916,_0x41dba3){return new BPromise(function(_0x583c33,_0x42d904){return client[_0x9d89('0x9')](_0x23887f,_0x41dba3)[_0x9d89('0xa')](function(_0x20f5c9){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x557916,'request\x20sent');logger[_0x9d89('0xb')](_0x9d89('0xc'),_0x557916,_0x9d89('0xd'),JSON[_0x9d89('0xe')](_0x20f5c9));if(_0x20f5c9['error']){if(_0x20f5c9[_0x9d89('0xf')][_0x9d89('0x10')]===0x1f4){logger[_0x9d89('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x557916,_0x20f5c9[_0x9d89('0xf')][_0x9d89('0x11')]);return _0x42d904(_0x20f5c9[_0x9d89('0xf')][_0x9d89('0x11')]);}logger[_0x9d89('0xf')](_0x9d89('0x12'),_0x557916,_0x20f5c9[_0x9d89('0xf')][_0x9d89('0x11')]);return _0x583c33(_0x20f5c9['error'][_0x9d89('0x11')]);}else{logger[_0x9d89('0x13')](_0x9d89('0x12'),_0x557916,_0x9d89('0xd'));_0x583c33(_0x20f5c9['result'][_0x9d89('0x11')]);}})['catch'](function(_0x298603){logger['error'](_0x9d89('0x12'),_0x557916,_0x298603);_0x42d904(_0x298603);});});} \ No newline at end of file +var _0xd5d4=['MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xadca9d,_0x114f9f){var _0x552fd1=function(_0x12c7d7){while(--_0x12c7d7){_0xadca9d['push'](_0xadca9d['shift']());}};_0x552fd1(++_0x114f9f);}(_0xd5d4,0xc7));var _0x4d5d=function(_0x102b2b,_0x45d45e){_0x102b2b=_0x102b2b-0x0;var _0x55db93=_0xd5d4[_0x102b2b];return _0x55db93;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d5d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d5d('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d5d('0x2'))(_0x4d5d('0x3'));var config=require(_0x4d5d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4d5d('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283c1f,_0x67153d,_0x5936e3){return new BPromise(function(_0x5773f6,_0x47cf77){return client[_0x4d5d('0x6')](_0x283c1f,_0x5936e3)[_0x4d5d('0x7')](function(_0x533457){logger[_0x4d5d('0x8')](_0x4d5d('0x9'),_0x67153d,_0x4d5d('0xa'));logger['debug'](_0x4d5d('0xb'),_0x67153d,_0x4d5d('0xa'),JSON['stringify'](_0x533457));if(_0x533457[_0x4d5d('0xc')]){if(_0x533457[_0x4d5d('0xc')]['code']===0x1f4){logger['error'](_0x4d5d('0x9'),_0x67153d,_0x533457[_0x4d5d('0xc')]['message']);return _0x47cf77(_0x533457[_0x4d5d('0xc')][_0x4d5d('0xd')]);}logger[_0x4d5d('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x67153d,_0x533457['error'][_0x4d5d('0xd')]);return _0x5773f6(_0x533457[_0x4d5d('0xc')][_0x4d5d('0xd')]);}else{logger[_0x4d5d('0x8')](_0x4d5d('0x9'),_0x67153d,'request\x20sent');_0x5773f6(_0x533457['result'][_0x4d5d('0xd')]);}})[_0x4d5d('0xe')](function(_0x299488){logger['error'](_0x4d5d('0x9'),_0x67153d,_0x299488);_0x47cf77(_0x299488);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 29ba45e..e3fed6e 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 _0xe546=['get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller'];(function(_0x19d0d1,_0x2f1409){var _0x3cf757=function(_0x10ccf9){while(--_0x10ccf9){_0x19d0d1['push'](_0x19d0d1['shift']());}};_0x3cf757(++_0x2f1409);}(_0xe546,0x14e));var _0x6e54=function(_0x2c8522,_0x8e6d1){_0x2c8522=_0x2c8522-0x0;var _0x3d9aad=_0xe546[_0x2c8522];return _0x3d9aad;};'use strict';var multer=require(_0x6e54('0x0'));var util=require(_0x6e54('0x1'));var path=require('path');var timeout=require(_0x6e54('0x2'));var express=require(_0x6e54('0x3'));var router=express[_0x6e54('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6e54('0x6'));var controller=require(_0x6e54('0x7'));router[_0x6e54('0x8')]('/',auth[_0x6e54('0x9')](),controller[_0x6e54('0xa')]);router[_0x6e54('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6e54('0xb')]);router[_0x6e54('0x8')](_0x6e54('0xc'),auth[_0x6e54('0x9')](),controller[_0x6e54('0xd')]);router[_0x6e54('0xe')]('/',auth['isAuthenticated'](),controller[_0x6e54('0xf')]);router['put']('/:id',auth[_0x6e54('0x9')](),controller[_0x6e54('0x10')]);router[_0x6e54('0x11')](_0x6e54('0xc'),auth[_0x6e54('0x9')](),controller[_0x6e54('0x12')]);module['exports']=router; \ No newline at end of file +var _0xec6d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xec6d,0x7d));var _0xdec6=function(_0x2f418e,_0x4eef64){_0x2f418e=_0x2f418e-0x0;var _0xdafa52=_0xec6d[_0x2f418e];return _0xdafa52;};'use strict';var multer=require(_0xdec6('0x0'));var util=require(_0xdec6('0x1'));var path=require(_0xdec6('0x2'));var timeout=require(_0xdec6('0x3'));var express=require(_0xdec6('0x4'));var router=express['Router']();var fs_extra=require(_0xdec6('0x5'));var auth=require(_0xdec6('0x6'));var interaction=require(_0xdec6('0x7'));var config=require('../../config/environment');var controller=require(_0xdec6('0x8'));router[_0xdec6('0x9')]('/',auth[_0xdec6('0xa')](),controller['index']);router['get'](_0xdec6('0xb'),auth['isAuthenticated'](),controller[_0xdec6('0xc')]);router[_0xdec6('0x9')](_0xdec6('0xd'),auth[_0xdec6('0xa')](),controller[_0xdec6('0xe')]);router[_0xdec6('0xf')]('/',auth[_0xdec6('0xa')](),controller[_0xdec6('0x10')]);router['put']('/:id',auth[_0xdec6('0xa')](),controller[_0xdec6('0x11')]);router[_0xdec6('0x12')](_0xdec6('0xd'),auth['isAuthenticated'](),controller[_0xdec6('0x13')]);module[_0xdec6('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c07da87..7304fed 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 _0x5574=['INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x52743d,_0x3714f2){var _0x39ca9c=function(_0xeba0a5){while(--_0xeba0a5){_0x52743d['push'](_0x52743d['shift']());}};_0x39ca9c(++_0x3714f2);}(_0x5574,0x7c));var _0x4557=function(_0x411ea7,_0x47e820){_0x411ea7=_0x411ea7-0x0;var _0x3c7ef6=_0x5574[_0x411ea7];return _0x3c7ef6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4557('0x0'));module['exports']={'channel':{'type':Sequelize[_0x4557('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4557('0x1')],'defaultValue':_0x4557('0x2'),'comment':_0x4557('0x3')},'duration':{'type':Sequelize[_0x4557('0x4')]},'enterAt':{'type':Sequelize[_0x4557('0x5')]},'exitAt':{'type':Sequelize[_0x4557('0x5')],'set':function(_0x28acdf){var _0x296d64=moment(_0x28acdf);var _0x32572d=moment(this['getDataValue'](_0x4557('0x6')));var _0x2adb50=_0x296d64[_0x4557('0x7')](_0x32572d,_0x4557('0x8'));this[_0x4557('0x9')](_0x4557('0xa'),_0x28acdf);this[_0x4557('0x9')](_0x4557('0xb'),_0x2adb50>=0x0?_0x2adb50:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4557('0xc')},'data2':{'type':Sequelize[_0x4557('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4557('0x1')],'comment':_0x4557('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x4557('0xe')},'data5':{'type':Sequelize[_0x4557('0x1')],'comment':_0x4557('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x4557('0x4')]},'uniqueid':{'type':Sequelize[_0x4557('0x1')]}}; \ No newline at end of file +var _0xc11e=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment'];(function(_0x968498,_0x525901){var _0x4ba747=function(_0x33bfe3){while(--_0x33bfe3){_0x968498['push'](_0x968498['shift']());}};_0x4ba747(++_0x525901);}(_0xc11e,0x1ec));var _0xec11=function(_0x5d84d6,_0x1a4671){_0x5d84d6=_0x5d84d6-0x0;var _0x2cd0f5=_0xc11e[_0x5d84d6];return _0x2cd0f5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xec11('0x0'));module['exports']={'channel':{'type':Sequelize[_0xec11('0x1')]},'membername':{'type':Sequelize[_0xec11('0x1')]},'interface':{'type':Sequelize[_0xec11('0x1')]},'type':{'type':Sequelize[_0xec11('0x1')],'defaultValue':_0xec11('0x2'),'comment':_0xec11('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xec11('0x4')],'set':function(_0x4eac70){var _0x422a05=moment(_0x4eac70);var _0x46f00a=moment(this[_0xec11('0x5')](_0xec11('0x6')));var _0x162bc0=_0x422a05[_0xec11('0x7')](_0x46f00a,_0xec11('0x8'));this[_0xec11('0x9')](_0xec11('0xa'),_0x4eac70);this[_0xec11('0x9')](_0xec11('0xb'),_0x162bc0>=0x0?_0x162bc0:null);}},'data1':{'type':Sequelize[_0xec11('0x1')],'comment':_0xec11('0xc')},'data2':{'type':Sequelize[_0xec11('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xec11('0x1')],'comment':_0xec11('0xd')},'data4':{'type':Sequelize[_0xec11('0x1')],'comment':_0xec11('0xe')},'data5':{'type':Sequelize[_0xec11('0x1')],'comment':_0xec11('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xec11('0x10')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f4b02b4..0a1c258 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x1758d6,_0x49251a){var _0x11ff28=function(_0x3f413a){while(--_0x3f413a){_0x1758d6['push'](_0x1758d6['shift']());}};_0x11ff28(++_0x49251a);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +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(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 abd71f8..8eeb43e 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 _0xb022=['bluebird','path','../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','api'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0xb022,0xf4));var _0x2b02=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb022[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var logger=require('../../config/logger')(_0x2b02('0x2'));var moment=require('moment');var BPromise=require(_0x2b02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b02('0x4'));var rimraf=require('rimraf');var config=require(_0x2b02('0x5'));var attributes=require('./memberReport.attributes');module[_0x2b02('0x6')]=function(_0x40f1ca,_0x150c9d){return _0x40f1ca[_0x2b02('0x7')](_0x2b02('0x8'),attributes,{'tableName':_0x2b02('0x9'),'paranoid':![],'indexes':[{'name':_0x2b02('0xa'),'fields':[_0x2b02('0xb'),_0x2b02('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0ae=['exports','define','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x3c6110,_0x10837c){var _0xcf22e4=function(_0x33fe65){while(--_0x33fe65){_0x3c6110['push'](_0x3c6110['shift']());}};_0xcf22e4(++_0x10837c);}(_0xa0ae,0x15d));var _0xea0a=function(_0x4a3553,_0x12e68f){_0x4a3553=_0x4a3553-0x0;var _0x569d42=_0xa0ae[_0x4a3553];return _0x569d42;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var logger=require(_0xea0a('0x2'))(_0xea0a('0x3'));var moment=require(_0xea0a('0x4'));var BPromise=require(_0xea0a('0x5'));var rp=require(_0xea0a('0x6'));var fs=require('fs');var path=require(_0xea0a('0x7'));var rimraf=require(_0xea0a('0x8'));var config=require(_0xea0a('0x9'));var attributes=require(_0xea0a('0xa'));module[_0xea0a('0xb')]=function(_0x2dc77b,_0x219f65){return _0x2dc77b[_0xea0a('0xc')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xea0a('0xd'),'fields':['membername',_0xea0a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f6e9ab4..8a4e5c3 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 _0xc73a=['model','then','CreateMemberReport','body','update','UpdateMemberReport','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x3020b6,_0x498282){var _0x4597d5=function(_0x10a679){while(--_0x10a679){_0x3020b6['push'](_0x3020b6['shift']());}};_0x4597d5(++_0x498282);}(_0xc73a,0x72));var _0xac73=function(_0xb15b4c,_0x2f7c78){_0xb15b4c=_0xb15b4c-0x0;var _0x3ebfaf=_0xc73a[_0xb15b4c];return _0x3ebfaf;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var moment=require(_0xac73('0x1'));var BPromise=require(_0xac73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac73('0x3'))['db'];var utils=require(_0xac73('0x4'));var logger=require(_0xac73('0x5'))('rpc');var config=require(_0xac73('0x6'));var jayson=require(_0xac73('0x7'));var client=jayson[_0xac73('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9eb408,_0x24a1bc,_0x1cc38a){return new BPromise(function(_0x22638a,_0x4fe9a1){return client[_0xac73('0x9')](_0x9eb408,_0x1cc38a)['then'](function(_0x5da0ee){logger[_0xac73('0xa')](_0xac73('0xb'),_0x24a1bc,_0xac73('0xc'));logger[_0xac73('0xd')](_0xac73('0xe'),_0x24a1bc,_0xac73('0xc'),JSON[_0xac73('0xf')](_0x5da0ee));if(_0x5da0ee[_0xac73('0x10')]){if(_0x5da0ee['error'][_0xac73('0x11')]===0x1f4){logger[_0xac73('0x10')](_0xac73('0xb'),_0x24a1bc,_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);return _0x4fe9a1(_0x5da0ee[_0xac73('0x10')]['message']);}logger[_0xac73('0x10')]('MemberReport,\x20%s,\x20%s',_0x24a1bc,_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);return _0x22638a(_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);}else{logger['info'](_0xac73('0xb'),_0x24a1bc,_0xac73('0xc'));_0x22638a(_0x5da0ee['result'][_0xac73('0x12')]);}})[_0xac73('0x13')](function(_0x196f7a){logger['error'](_0xac73('0xb'),_0x24a1bc,_0x196f7a);_0x4fe9a1(_0x196f7a);});});}exports[_0xac73('0x14')]=function(_0x20fb6f){var _0x59c982=this;return new Promise(function(_0x3b6044,_0x4a122a){return db[_0xac73('0x15')][_0xac73('0x16')]({'raw':_0x20fb6f['options']?_0x20fb6f[_0xac73('0x17')][_0xac73('0x18')]===undefined?!![]:![]:!![],'where':_0x20fb6f[_0xac73('0x17')]?_0x20fb6f[_0xac73('0x17')][_0xac73('0x19')]||null:null,'attributes':_0x20fb6f[_0xac73('0x17')]?_0x20fb6f[_0xac73('0x17')][_0xac73('0x1a')]||null:null,'limit':_0x20fb6f[_0xac73('0x17')]?_0x20fb6f['options'][_0xac73('0x1b')]||null:null,'include':_0x20fb6f[_0xac73('0x17')]?_0x20fb6f[_0xac73('0x17')]['include']?_[_0xac73('0x1c')](_0x20fb6f['options'][_0xac73('0x1d')],function(_0x1a3b6f){return{'model':db[_0x1a3b6f[_0xac73('0x1e')]],'as':_0x1a3b6f['as'],'attributes':_0x1a3b6f[_0xac73('0x1a')],'include':_0x1a3b6f[_0xac73('0x1d')]?_[_0xac73('0x1c')](_0x1a3b6f[_0xac73('0x1d')],function(_0x4df196){return{'model':db[_0x4df196[_0xac73('0x1e')]],'as':_0x4df196['as'],'attributes':_0x4df196[_0xac73('0x1a')],'include':_0x4df196[_0xac73('0x1d')]?_[_0xac73('0x1c')](_0x4df196[_0xac73('0x1d')],function(_0x2dcfa6){return{'model':db[_0x2dcfa6['model']],'as':_0x2dcfa6['as'],'attributes':_0x2dcfa6[_0xac73('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac73('0x1f')](function(_0x3370af){logger[_0xac73('0xa')](_0xac73('0x14'),_0x20fb6f);logger[_0xac73('0xd')](_0xac73('0x14'),_0x20fb6f,JSON[_0xac73('0xf')](_0x3370af));_0x3b6044(_0x3370af);})[_0xac73('0x13')](function(_0x4bc16f){logger[_0xac73('0x10')](_0xac73('0x14'),_0x4bc16f[_0xac73('0x12')],_0x20fb6f);_0x4a122a(_0x59c982[_0xac73('0x10')](0x1f4,_0x4bc16f[_0xac73('0x12')]));});});};exports[_0xac73('0x20')]=function(_0x5cf86e){var _0x1b8221=this;return new Promise(function(_0x2a9550,_0x110f33){return db[_0xac73('0x15')]['create'](_0x5cf86e[_0xac73('0x21')],{'raw':_0x5cf86e[_0xac73('0x17')]?_0x5cf86e[_0xac73('0x17')][_0xac73('0x18')]===undefined?!![]:![]:!![]})[_0xac73('0x1f')](function(_0x3952c9){logger[_0xac73('0xa')](_0xac73('0x20'),_0x5cf86e);logger[_0xac73('0xd')](_0xac73('0x20'),_0x5cf86e,JSON[_0xac73('0xf')](_0x3952c9));_0x2a9550(_0x3952c9);})[_0xac73('0x13')](function(_0x3d059f){logger[_0xac73('0x10')](_0xac73('0x20'),_0x3d059f[_0xac73('0x12')],_0x5cf86e);_0x110f33(_0x1b8221[_0xac73('0x10')](0x1f4,_0x3d059f[_0xac73('0x12')]));});});};exports['UpdateMemberReport']=function(_0x110d14){var _0x3a1026=this;return new Promise(function(_0x2bc193,_0x4f46e6){return db['MemberReport'][_0xac73('0x22')](_0x110d14['body'],{'raw':_0x110d14['options']?_0x110d14[_0xac73('0x17')][_0xac73('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110d14[_0xac73('0x17')]?_0x110d14[_0xac73('0x17')]['where']||null:null,'attributes':_0x110d14[_0xac73('0x17')]?_0x110d14['options'][_0xac73('0x1a')]||null:null,'limit':_0x110d14[_0xac73('0x17')]?_0x110d14['options'][_0xac73('0x1b')]||null:null})[_0xac73('0x1f')](function(_0xd8d35e){logger[_0xac73('0xa')](_0xac73('0x23'),_0x110d14);logger[_0xac73('0xd')](_0xac73('0x23'),_0x110d14,JSON[_0xac73('0xf')](_0xd8d35e));_0x2bc193(_0xd8d35e);})[_0xac73('0x13')](function(_0x280cd2){logger['error'](_0xac73('0x23'),_0x280cd2['message'],_0x110d14);_0x4f46e6(_0x3a1026[_0xac73('0x10')](0x1f4,_0x280cd2['message']));});});}; \ No newline at end of file +var _0x044a=['include','map','model','then','CreateMemberReport','MemberReport','create','body','catch','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetMemberReport','options','raw','where','attributes','limit'];(function(_0x5a6f0d,_0x28bfa5){var _0x13d5f0=function(_0x2873d7){while(--_0x2873d7){_0x5a6f0d['push'](_0x5a6f0d['shift']());}};_0x13d5f0(++_0x28bfa5);}(_0x044a,0x173));var _0xa044=function(_0x5324ec,_0x79243d){_0x5324ec=_0x5324ec-0x0;var _0x21810e=_0x044a[_0x5324ec];return _0x21810e;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c04bb,_0x59b81b,_0xe12f7d){return new BPromise(function(_0x33f556,_0x936b2c){return client[_0xa044('0xd')](_0x1c04bb,_0xe12f7d)['then'](function(_0x3b1dcd){logger[_0xa044('0xe')](_0xa044('0xf'),_0x59b81b,'request\x20sent');logger[_0xa044('0x10')](_0xa044('0x11'),_0x59b81b,_0xa044('0x12'),JSON[_0xa044('0x13')](_0x3b1dcd));if(_0x3b1dcd['error']){if(_0x3b1dcd[_0xa044('0x14')]['code']===0x1f4){logger['error'](_0xa044('0xf'),_0x59b81b,_0x3b1dcd[_0xa044('0x14')][_0xa044('0x15')]);return _0x936b2c(_0x3b1dcd[_0xa044('0x14')][_0xa044('0x15')]);}logger[_0xa044('0x14')](_0xa044('0xf'),_0x59b81b,_0x3b1dcd['error'][_0xa044('0x15')]);return _0x33f556(_0x3b1dcd['error'][_0xa044('0x15')]);}else{logger[_0xa044('0xe')](_0xa044('0xf'),_0x59b81b,_0xa044('0x12'));_0x33f556(_0x3b1dcd[_0xa044('0x16')]['message']);}})['catch'](function(_0x21b78c){logger['error'](_0xa044('0xf'),_0x59b81b,_0x21b78c);_0x936b2c(_0x21b78c);});});}exports[_0xa044('0x17')]=function(_0x1b43c1){var _0x9774ab=this;return new Promise(function(_0x3ccbd3,_0x5c8e67){return db['MemberReport']['findAll']({'raw':_0x1b43c1[_0xa044('0x18')]?_0x1b43c1[_0xa044('0x18')][_0xa044('0x19')]===undefined?!![]:![]:!![],'where':_0x1b43c1['options']?_0x1b43c1[_0xa044('0x18')][_0xa044('0x1a')]||null:null,'attributes':_0x1b43c1['options']?_0x1b43c1[_0xa044('0x18')][_0xa044('0x1b')]||null:null,'limit':_0x1b43c1[_0xa044('0x18')]?_0x1b43c1['options'][_0xa044('0x1c')]||null:null,'include':_0x1b43c1[_0xa044('0x18')]?_0x1b43c1[_0xa044('0x18')][_0xa044('0x1d')]?_[_0xa044('0x1e')](_0x1b43c1[_0xa044('0x18')][_0xa044('0x1d')],function(_0x46f14c){return{'model':db[_0x46f14c[_0xa044('0x1f')]],'as':_0x46f14c['as'],'attributes':_0x46f14c['attributes'],'include':_0x46f14c['include']?_[_0xa044('0x1e')](_0x46f14c[_0xa044('0x1d')],function(_0x228d5e){return{'model':db[_0x228d5e['model']],'as':_0x228d5e['as'],'attributes':_0x228d5e[_0xa044('0x1b')],'include':_0x228d5e[_0xa044('0x1d')]?_['map'](_0x228d5e[_0xa044('0x1d')],function(_0x6746e8){return{'model':db[_0x6746e8['model']],'as':_0x6746e8['as'],'attributes':_0x6746e8[_0xa044('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa044('0x20')](function(_0x5d28d8){logger['info']('GetMemberReport',_0x1b43c1);logger[_0xa044('0x10')](_0xa044('0x17'),_0x1b43c1,JSON[_0xa044('0x13')](_0x5d28d8));_0x3ccbd3(_0x5d28d8);})['catch'](function(_0x267512){logger[_0xa044('0x14')]('GetMemberReport',_0x267512[_0xa044('0x15')],_0x1b43c1);_0x5c8e67(_0x9774ab['error'](0x1f4,_0x267512['message']));});});};exports[_0xa044('0x21')]=function(_0x48ad57){var _0x30fd39=this;return new Promise(function(_0x2acde1,_0x40627d){return db[_0xa044('0x22')][_0xa044('0x23')](_0x48ad57[_0xa044('0x24')],{'raw':_0x48ad57['options']?_0x48ad57[_0xa044('0x18')][_0xa044('0x19')]===undefined?!![]:![]:!![]})[_0xa044('0x20')](function(_0x2daf9e){logger['info'](_0xa044('0x21'),_0x48ad57);logger[_0xa044('0x10')]('CreateMemberReport',_0x48ad57,JSON['stringify'](_0x2daf9e));_0x2acde1(_0x2daf9e);})[_0xa044('0x25')](function(_0x2ed9c3){logger['error'](_0xa044('0x21'),_0x2ed9c3[_0xa044('0x15')],_0x48ad57);_0x40627d(_0x30fd39[_0xa044('0x14')](0x1f4,_0x2ed9c3['message']));});});};exports[_0xa044('0x26')]=function(_0x79b83){var _0x3b5a72=this;return new Promise(function(_0x394fc8,_0x31385c){return db['MemberReport'][_0xa044('0x27')](_0x79b83[_0xa044('0x24')],{'raw':_0x79b83[_0xa044('0x18')]?_0x79b83['options'][_0xa044('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x79b83[_0xa044('0x18')]?_0x79b83['options'][_0xa044('0x1a')]||null:null,'attributes':_0x79b83[_0xa044('0x18')]?_0x79b83[_0xa044('0x18')][_0xa044('0x1b')]||null:null,'limit':_0x79b83[_0xa044('0x18')]?_0x79b83[_0xa044('0x18')][_0xa044('0x1c')]||null:null})[_0xa044('0x20')](function(_0x4788d1){logger[_0xa044('0xe')](_0xa044('0x26'),_0x79b83);logger[_0xa044('0x10')](_0xa044('0x26'),_0x79b83,JSON[_0xa044('0x13')](_0x4788d1));_0x394fc8(_0x4788d1);})['catch'](function(_0x1400d9){logger['error'](_0xa044('0x26'),_0x1400d9[_0xa044('0x15')],_0x79b83);_0x31385c(_0x3b5a72['error'](0x1f4,_0x1400d9['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5844e4e..d24e095 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 _0xd010=['index','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0xe8e91,_0x401ca3){var _0x1258fe=function(_0x45ac8a){while(--_0x45ac8a){_0xe8e91['push'](_0xe8e91['shift']());}};_0x1258fe(++_0x401ca3);}(_0xd010,0xd2));var _0x0d01=function(_0x3b9363,_0x5d2100){_0x3b9363=_0x3b9363-0x0;var _0x37010a=_0xd010[_0x3b9363];return _0x37010a;};'use strict';var multer=require(_0x0d01('0x0'));var util=require(_0x0d01('0x1'));var path=require(_0x0d01('0x2'));var timeout=require(_0x0d01('0x3'));var express=require(_0x0d01('0x4'));var router=express['Router']();var fs_extra=require(_0x0d01('0x5'));var auth=require(_0x0d01('0x6'));var interaction=require(_0x0d01('0x7'));var config=require(_0x0d01('0x8'));var controller=require(_0x0d01('0x9'));router[_0x0d01('0xa')]('/',controller[_0x0d01('0xb')]);module[_0x0d01('0xc')]=router; \ No newline at end of file +var _0x15cb=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','util'];(function(_0x5dde5b,_0x1c2e75){var _0x255434=function(_0x52e66c){while(--_0x52e66c){_0x5dde5b['push'](_0x5dde5b['shift']());}};_0x255434(++_0x1c2e75);}(_0x15cb,0x16f));var _0xb15c=function(_0x552a43,_0x490939){_0x552a43=_0x552a43-0x0;var _0x39203a=_0x15cb[_0x552a43];return _0x39203a;};'use strict';var multer=require('multer');var util=require(_0xb15c('0x0'));var path=require('path');var timeout=require(_0xb15c('0x1'));var express=require('express');var router=express[_0xb15c('0x2')]();var fs_extra=require(_0xb15c('0x3'));var auth=require(_0xb15c('0x4'));var interaction=require(_0xb15c('0x5'));var config=require('../../config/environment');var controller=require(_0xb15c('0x6'));router[_0xb15c('0x7')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index c8b8813..9b11ff8 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 _0xafe4=['STRING','sequelize','exports'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0xafe4,0x145));var _0x4afe=function(_0xa99b64,_0x531288){_0xa99b64=_0xa99b64-0x0;var _0xd50abd=_0xafe4[_0xa99b64];return _0xd50abd;};'use strict';var Sequelize=require(_0x4afe('0x0'));module[_0x4afe('0x1')]={'version':{'type':Sequelize[_0x4afe('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x31bd=['STRING','version','exports'];(function(_0x4eb3ed,_0x10b7dd){var _0x4b9ed9=function(_0x44bdbb){while(--_0x44bdbb){_0x4eb3ed['push'](_0x4eb3ed['shift']());}};_0x4b9ed9(++_0x10b7dd);}(_0x31bd,0x15e));var _0xd31b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x31bd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xd31b('0x0')]={'version':{'type':Sequelize[_0xd31b('0x1')],'unique':_0xd31b('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index e20726c..fa79364 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 _0x5574=['order','where','merge','type','filter','options','then','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','end','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','model','fields','length','nolimit'];(function(_0x12ae31,_0x4072e4){var _0x1b38da=function(_0x386972){while(--_0x386972){_0x12ae31['push'](_0x12ae31['shift']());}};_0x1b38da(++_0x4072e4);}(_0x5574,0x169));var _0x4557=function(_0x326744,_0x1b644e){_0x326744=_0x326744-0x0;var _0x373b30=_0x5574[_0x326744];return _0x373b30;};'use strict';var emlformat=require(_0x4557('0x0'));var rimraf=require(_0x4557('0x1'));var zipdir=require(_0x4557('0x2'));var jsonpatch=require(_0x4557('0x3'));var rp=require(_0x4557('0x4'));var moment=require(_0x4557('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4557('0x6'));var util=require('util');var path=require(_0x4557('0x7'));var sox=require(_0x4557('0x8'));var csv=require(_0x4557('0x9'));var ejs=require(_0x4557('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4557('0xb'));var squel=require(_0x4557('0xc'));var crypto=require('crypto');var jsforce=require(_0x4557('0xd'));var deskjs=require(_0x4557('0xe'));var toCsv=require(_0x4557('0x9'));var querystring=require(_0x4557('0xf'));var Papa=require(_0x4557('0x10'));var Redis=require(_0x4557('0x11'));var authService=require(_0x4557('0x12'));var qs=require(_0x4557('0x13'));var as=require(_0x4557('0x14'));var hardwareService=require(_0x4557('0x15'));var logger=require(_0x4557('0x16'))(_0x4557('0x17'));var utils=require(_0x4557('0x18'));var config=require(_0x4557('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc403,_0x55430c){_0x55430c=_0x55430c||0xcc;return function(_0x2a47c0){if(_0x2a47c0){return _0x1dc403['sendStatus'](_0x55430c);}return _0x1dc403['status'](_0x55430c)['end']();};}function respondWithResult(_0x273984,_0x3833c6){_0x3833c6=_0x3833c6||0xc8;return function(_0x129de6){if(_0x129de6){return _0x273984[_0x4557('0x1a')](_0x3833c6)[_0x4557('0x1b')](_0x129de6);}};}function respondWithFilteredResult(_0x4a0f05,_0x57c72a){return function(_0x5c0818){if(_0x5c0818){var _0x4f4331=typeof _0x57c72a[_0x4557('0x1c')]==='undefined'&&typeof _0x57c72a[_0x4557('0x1d')]===_0x4557('0x1e');var _0x1d1af3=_0x5c0818[_0x4557('0x1f')];var _0x33295a=_0x4f4331?0x0:_0x57c72a[_0x4557('0x1c')];var _0x1be905=_0x4f4331?_0x5c0818[_0x4557('0x1f')]:_0x57c72a['offset']+_0x57c72a[_0x4557('0x1d')];var _0x26a389;if(_0x1be905>=_0x1d1af3){_0x1be905=_0x1d1af3;_0x26a389=0xc8;}else{_0x26a389=0xce;}_0x4a0f05[_0x4557('0x1a')](_0x26a389);return _0x4a0f05[_0x4557('0x20')](_0x4557('0x21'),_0x33295a+'-'+_0x1be905+'/'+_0x1d1af3)[_0x4557('0x1b')](_0x5c0818);}return null;};}function patchUpdates(_0xc2f94b){return function(_0xb58870){try{jsonpatch[_0x4557('0x22')](_0xb58870,_0xc2f94b,!![]);}catch(_0x32cbd7){return BPromise[_0x4557('0x23')](_0x32cbd7);}return _0xb58870['save']();};}function saveUpdates(_0x15e631,_0x30782f){return function(_0x27901d){if(_0x27901d){return _0x27901d[_0x4557('0x24')](_0x15e631)['then'](function(_0x168d73){return _0x168d73;});}return null;};}function removeEntity(_0x3d6a63,_0x488355){return function(_0x5c351b){if(_0x5c351b){return _0x5c351b[_0x4557('0x25')]()['then'](function(){_0x3d6a63['status'](0xcc)[_0x4557('0x26')]();});}};}function handleEntityNotFound(_0x1f2ab4,_0x340584){return function(_0x571a0a){if(!_0x571a0a){_0x1f2ab4[_0x4557('0x27')](0x194);}return _0x571a0a;};}function handleError(_0x3cfd84,_0x565071){_0x565071=_0x565071||0x1f4;return function(_0xd81303){logger[_0x4557('0x28')](_0xd81303[_0x4557('0x29')]);if(_0xd81303[_0x4557('0x2a')]){delete _0xd81303[_0x4557('0x2a')];}_0x3cfd84[_0x4557('0x1a')](_0x565071)[_0x4557('0x2b')](_0xd81303);};}exports[_0x4557('0x2c')]=function(_0x2060b0,_0x1d5aac){var _0x5b6949={},_0x50d5a5={},_0x404868={'count':0x0,'rows':[]};var _0x4ba3cc=_['map'](db[_0x4557('0x2d')][_0x4557('0x2e')],function(_0xe90c8e){return{'name':_0xe90c8e[_0x4557('0x2f')],'type':_0xe90c8e['type'][_0x4557('0x30')]};});_0x50d5a5['model']=_[_0x4557('0x31')](_0x4ba3cc,_0x4557('0x2a'));_0x50d5a5[_0x4557('0x32')]=_[_0x4557('0x33')](_0x2060b0[_0x4557('0x32')]);_0x50d5a5[_0x4557('0x34')]=_['intersection'](_0x50d5a5['model'],_0x50d5a5[_0x4557('0x32')]);_0x5b6949[_0x4557('0x35')]=_[_0x4557('0x36')](_0x50d5a5[_0x4557('0x37')],qs[_0x4557('0x38')](_0x2060b0['query'][_0x4557('0x38')]));_0x5b6949['attributes']=_0x5b6949['attributes'][_0x4557('0x39')]?_0x5b6949['attributes']:_0x50d5a5[_0x4557('0x37')];if(!_0x2060b0[_0x4557('0x32')]['hasOwnProperty'](_0x4557('0x3a'))){_0x5b6949['limit']=qs[_0x4557('0x1d')](_0x2060b0['query']['limit']);_0x5b6949[_0x4557('0x1c')]=qs[_0x4557('0x1c')](_0x2060b0[_0x4557('0x32')][_0x4557('0x1c')]);}_0x5b6949[_0x4557('0x3b')]=qs['sort'](_0x2060b0[_0x4557('0x32')]['sort']);_0x5b6949['where']=qs[_0x4557('0x34')](_['pick'](_0x2060b0['query'],_0x50d5a5['filters']),_0x4ba3cc);if(_0x2060b0[_0x4557('0x32')]['filter']){_0x5b6949[_0x4557('0x3c')]=_[_0x4557('0x3d')](_0x5b6949['where'],{'$or':_[_0x4557('0x31')](_0x4ba3cc,function(_0x554b60){if(_0x554b60[_0x4557('0x3e')]!=='VIRTUAL'){var _0xa4252e={};_0xa4252e[_0x554b60['name']]={'$like':'%'+_0x2060b0['query'][_0x4557('0x3f')]+'%'};return _0xa4252e;}})});}_0x5b6949=_[_0x4557('0x3d')]({},_0x5b6949,_0x2060b0[_0x4557('0x40')]);var _0x2c045a={'where':_0x5b6949[_0x4557('0x3c')]};return db[_0x4557('0x2d')][_0x4557('0x1f')](_0x2c045a)[_0x4557('0x41')](function(_0x18b42c){_0x404868[_0x4557('0x1f')]=_0x18b42c;if(_0x2060b0[_0x4557('0x32')]['includeAll']){_0x5b6949[_0x4557('0x42')]=[{'all':!![]}];}return db[_0x4557('0x2d')][_0x4557('0x43')](_0x5b6949);})[_0x4557('0x41')](function(_0x17a730){_0x404868[_0x4557('0x44')]=_0x17a730;return _0x404868;})[_0x4557('0x41')](respondWithFilteredResult(_0x1d5aac,_0x5b6949))[_0x4557('0x45')](handleError(_0x1d5aac,null));}; \ No newline at end of file +var _0xc0b9=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Migration','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','filters'];(function(_0x36fe26,_0x121344){var _0x684e51=function(_0x4542b2){while(--_0x4542b2){_0x36fe26['push'](_0x36fe26['shift']());}};_0x684e51(++_0x121344);}(_0xc0b9,0x12d));var _0x9c0b=function(_0x2b5d13,_0x26083b){_0x2b5d13=_0x2b5d13-0x0;var _0x26c145=_0xc0b9[_0x2b5d13];return _0x26c145;};'use strict';var emlformat=require(_0x9c0b('0x0'));var rimraf=require(_0x9c0b('0x1'));var zipdir=require(_0x9c0b('0x2'));var jsonpatch=require(_0x9c0b('0x3'));var rp=require(_0x9c0b('0x4'));var moment=require(_0x9c0b('0x5'));var BPromise=require(_0x9c0b('0x6'));var Mustache=require(_0x9c0b('0x7'));var util=require(_0x9c0b('0x8'));var path=require(_0x9c0b('0x9'));var sox=require(_0x9c0b('0xa'));var csv=require(_0x9c0b('0xb'));var ejs=require(_0x9c0b('0xc'));var fs=require('fs');var fs_extra=require(_0x9c0b('0xd'));var _=require(_0x9c0b('0xe'));var squel=require('squel');var crypto=require(_0x9c0b('0xf'));var jsforce=require(_0x9c0b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9c0b('0xb'));var querystring=require(_0x9c0b('0x11'));var Papa=require('papaparse');var Redis=require(_0x9c0b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9c0b('0x13'));var as=require(_0x9c0b('0x14'));var hardwareService=require(_0x9c0b('0x15'));var logger=require(_0x9c0b('0x16'))(_0x9c0b('0x17'));var utils=require('../../config/utils');var config=require(_0x9c0b('0x18'));var licenseUtil=require(_0x9c0b('0x19'));var db=require(_0x9c0b('0x1a'))['db'];function respondWithStatusCode(_0x165c36,_0x41a11f){_0x41a11f=_0x41a11f||0xcc;return function(_0x2f27e4){if(_0x2f27e4){return _0x165c36['sendStatus'](_0x41a11f);}return _0x165c36[_0x9c0b('0x1b')](_0x41a11f)['end']();};}function respondWithResult(_0x3fe8f2,_0x5936f6){_0x5936f6=_0x5936f6||0xc8;return function(_0x405009){if(_0x405009){return _0x3fe8f2[_0x9c0b('0x1b')](_0x5936f6)[_0x9c0b('0x1c')](_0x405009);}};}function respondWithFilteredResult(_0x50a82a,_0x2a9dc7){return function(_0x2ab94f){if(_0x2ab94f){var _0x1b2ac0=typeof _0x2a9dc7[_0x9c0b('0x1d')]===_0x9c0b('0x1e')&&typeof _0x2a9dc7[_0x9c0b('0x1f')]===_0x9c0b('0x1e');var _0x2d8e9d=_0x2ab94f[_0x9c0b('0x20')];var _0x5697de=_0x1b2ac0?0x0:_0x2a9dc7['offset'];var _0x2c8a50=_0x1b2ac0?_0x2ab94f[_0x9c0b('0x20')]:_0x2a9dc7[_0x9c0b('0x1d')]+_0x2a9dc7[_0x9c0b('0x1f')];var _0x5d5a71;if(_0x2c8a50>=_0x2d8e9d){_0x2c8a50=_0x2d8e9d;_0x5d5a71=0xc8;}else{_0x5d5a71=0xce;}_0x50a82a['status'](_0x5d5a71);return _0x50a82a[_0x9c0b('0x21')](_0x9c0b('0x22'),_0x5697de+'-'+_0x2c8a50+'/'+_0x2d8e9d)['json'](_0x2ab94f);}return null;};}function patchUpdates(_0x14ed73){return function(_0x2b3b56){try{jsonpatch[_0x9c0b('0x23')](_0x2b3b56,_0x14ed73,!![]);}catch(_0x26c8be){return BPromise[_0x9c0b('0x24')](_0x26c8be);}return _0x2b3b56[_0x9c0b('0x25')]();};}function saveUpdates(_0x34c6ea,_0x4f4afb){return function(_0x1ad33c){if(_0x1ad33c){return _0x1ad33c[_0x9c0b('0x26')](_0x34c6ea)[_0x9c0b('0x27')](function(_0x5af6f7){return _0x5af6f7;});}return null;};}function removeEntity(_0x2043e1,_0x3f6504){return function(_0x3ba3d0){if(_0x3ba3d0){return _0x3ba3d0[_0x9c0b('0x28')]()[_0x9c0b('0x27')](function(){_0x2043e1['status'](0xcc)[_0x9c0b('0x29')]();});}};}function handleEntityNotFound(_0x4c5412,_0x176a4e){return function(_0x4ace15){if(!_0x4ace15){_0x4c5412[_0x9c0b('0x2a')](0x194);}return _0x4ace15;};}function handleError(_0x398360,_0xe7bed1){_0xe7bed1=_0xe7bed1||0x1f4;return function(_0x565324){logger[_0x9c0b('0x2b')](_0x565324[_0x9c0b('0x2c')]);if(_0x565324[_0x9c0b('0x2d')]){delete _0x565324['name'];}_0x398360['status'](_0xe7bed1)['send'](_0x565324);};}exports[_0x9c0b('0x2e')]=function(_0x5991c6,_0x173640){var _0x447563={},_0x3a4058={},_0x3d093b={'count':0x0,'rows':[]};var _0x34d3e9=_[_0x9c0b('0x2f')](db['Migration'][_0x9c0b('0x30')],function(_0x364d1f){return{'name':_0x364d1f['fieldName'],'type':_0x364d1f[_0x9c0b('0x31')][_0x9c0b('0x32')]};});_0x3a4058[_0x9c0b('0x33')]=_[_0x9c0b('0x2f')](_0x34d3e9,_0x9c0b('0x2d'));_0x3a4058[_0x9c0b('0x34')]=_['keys'](_0x5991c6[_0x9c0b('0x34')]);_0x3a4058[_0x9c0b('0x35')]=_[_0x9c0b('0x36')](_0x3a4058[_0x9c0b('0x33')],_0x3a4058['query']);_0x447563[_0x9c0b('0x37')]=_[_0x9c0b('0x36')](_0x3a4058[_0x9c0b('0x33')],qs[_0x9c0b('0x38')](_0x5991c6[_0x9c0b('0x34')][_0x9c0b('0x38')]));_0x447563[_0x9c0b('0x37')]=_0x447563[_0x9c0b('0x37')][_0x9c0b('0x39')]?_0x447563[_0x9c0b('0x37')]:_0x3a4058['model'];if(!_0x5991c6[_0x9c0b('0x34')][_0x9c0b('0x3a')](_0x9c0b('0x3b'))){_0x447563[_0x9c0b('0x1f')]=qs[_0x9c0b('0x1f')](_0x5991c6[_0x9c0b('0x34')][_0x9c0b('0x1f')]);_0x447563[_0x9c0b('0x1d')]=qs[_0x9c0b('0x1d')](_0x5991c6[_0x9c0b('0x34')][_0x9c0b('0x1d')]);}_0x447563[_0x9c0b('0x3c')]=qs[_0x9c0b('0x3d')](_0x5991c6[_0x9c0b('0x34')]['sort']);_0x447563[_0x9c0b('0x3e')]=qs[_0x9c0b('0x35')](_[_0x9c0b('0x3f')](_0x5991c6[_0x9c0b('0x34')],_0x3a4058[_0x9c0b('0x35')]),_0x34d3e9);if(_0x5991c6[_0x9c0b('0x34')][_0x9c0b('0x40')]){_0x447563[_0x9c0b('0x3e')]=_['merge'](_0x447563[_0x9c0b('0x3e')],{'$or':_['map'](_0x34d3e9,function(_0xa90ecf){if(_0xa90ecf[_0x9c0b('0x31')]!==_0x9c0b('0x41')){var _0x14c642={};_0x14c642[_0xa90ecf[_0x9c0b('0x2d')]]={'$like':'%'+_0x5991c6['query'][_0x9c0b('0x40')]+'%'};return _0x14c642;}})});}_0x447563=_['merge']({},_0x447563,_0x5991c6[_0x9c0b('0x42')]);var _0x45eb10={'where':_0x447563[_0x9c0b('0x3e')]};return db[_0x9c0b('0x43')][_0x9c0b('0x20')](_0x45eb10)[_0x9c0b('0x27')](function(_0x7a7545){_0x3d093b['count']=_0x7a7545;if(_0x5991c6[_0x9c0b('0x34')]['includeAll']){_0x447563[_0x9c0b('0x44')]=[{'all':!![]}];}return db[_0x9c0b('0x43')][_0x9c0b('0x45')](_0x447563);})['then'](function(_0x8d480b){_0x3d093b['rows']=_0x8d480b;return _0x3d093b;})[_0x9c0b('0x27')](respondWithFilteredResult(_0x173640,_0x447563))[_0x9c0b('0x46')](handleError(_0x173640,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e1e56ab..34a7dfe 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 _0x95b3=['api','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define','Migration','lodash'];(function(_0x41d37d,_0x463d77){var _0x243e76=function(_0x17b2ba){while(--_0x17b2ba){_0x41d37d['push'](_0x41d37d['shift']());}};_0x243e76(++_0x463d77);}(_0x95b3,0xb3));var _0x395b=function(_0x3c4d31,_0x2672e5){_0x3c4d31=_0x3c4d31-0x0;var _0x12adfe=_0x95b3[_0x3c4d31];return _0x12adfe;};'use strict';var _=require(_0x395b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x395b('0x1'));var moment=require('moment');var BPromise=require(_0x395b('0x2'));var rp=require(_0x395b('0x3'));var fs=require('fs');var path=require(_0x395b('0x4'));var rimraf=require(_0x395b('0x5'));var config=require('../../config/environment');var attributes=require(_0x395b('0x6'));module[_0x395b('0x7')]=function(_0x35a28a,_0x4e6872){return _0x35a28a[_0x395b('0x8')](_0x395b('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b2=['moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','api'];(function(_0x3789d0,_0x221c86){var _0x538966=function(_0x51d7b1){while(--_0x51d7b1){_0x3789d0['push'](_0x3789d0['shift']());}};_0x538966(++_0x221c86);}(_0x85b2,0x19c));var _0x285b=function(_0x328894,_0xef4f9f){_0x328894=_0x328894-0x0;var _0x4651b5=_0x85b2[_0x328894];return _0x4651b5;};'use strict';var _=require(_0x285b('0x0'));var util=require(_0x285b('0x1'));var logger=require(_0x285b('0x2'))(_0x285b('0x3'));var moment=require(_0x285b('0x4'));var BPromise=require(_0x285b('0x5'));var rp=require(_0x285b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x285b('0x7'));var config=require(_0x285b('0x8'));var attributes=require(_0x285b('0x9'));module[_0x285b('0xa')]=function(_0x28ce3d,_0x431c01){return _0x28ce3d[_0x285b('0xb')](_0x285b('0xc'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5460826..52f362c 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 _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x105f43,_0x25ba16){var _0x99ca2f=function(_0x49afa3){while(--_0x49afa3){_0x105f43['push'](_0x105f43['shift']());}};_0x99ca2f(++_0x25ba16);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x522c7b,_0xbb61e8){_0x522c7b=_0x522c7b-0x0;var _0x1ebfec=_0x1d2d[_0x522c7b];return _0x1ebfec;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Migration,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file +var _0xa1aa=['jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa1aa,0x19b));var _0xaa1a=function(_0xcb63fd,_0x44e45c){_0xcb63fd=_0xcb63fd-0x0;var _0x555c39=_0xa1aa[_0xcb63fd];return _0x555c39;};'use strict';var _=require('lodash');var util=require(_0xaa1a('0x0'));var moment=require(_0xaa1a('0x1'));var BPromise=require(_0xaa1a('0x2'));var rs=require(_0xaa1a('0x3'));var fs=require('fs');var Redis=require(_0xaa1a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaa1a('0x5'))(_0xaa1a('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa1a('0x7'));var client=jayson[_0xaa1a('0x8')][_0xaa1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51169b,_0x3c1a12,_0x5d7de2){return new BPromise(function(_0x196232,_0x560ff3){return client[_0xaa1a('0xa')](_0x51169b,_0x5d7de2)[_0xaa1a('0xb')](function(_0x5e46e5){logger['info'](_0xaa1a('0xc'),_0x3c1a12,_0xaa1a('0xd'));logger[_0xaa1a('0xe')](_0xaa1a('0xf'),_0x3c1a12,'request\x20sent',JSON[_0xaa1a('0x10')](_0x5e46e5));if(_0x5e46e5[_0xaa1a('0x11')]){if(_0x5e46e5[_0xaa1a('0x11')][_0xaa1a('0x12')]===0x1f4){logger[_0xaa1a('0x11')](_0xaa1a('0xc'),_0x3c1a12,_0x5e46e5[_0xaa1a('0x11')][_0xaa1a('0x13')]);return _0x560ff3(_0x5e46e5[_0xaa1a('0x11')][_0xaa1a('0x13')]);}logger['error']('Migration,\x20%s,\x20%s',_0x3c1a12,_0x5e46e5[_0xaa1a('0x11')][_0xaa1a('0x13')]);return _0x196232(_0x5e46e5[_0xaa1a('0x11')][_0xaa1a('0x13')]);}else{logger[_0xaa1a('0x14')]('Migration,\x20%s,\x20%s',_0x3c1a12,_0xaa1a('0xd'));_0x196232(_0x5e46e5['result'][_0xaa1a('0x13')]);}})[_0xaa1a('0x15')](function(_0x246b67){logger[_0xaa1a('0x11')]('Migration,\x20%s,\x20%s',_0x3c1a12,_0x246b67);_0x560ff3(_0x246b67);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2d13ff6..09c7aca 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 _0x1867=['get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x3038be,_0x425d69){var _0x581d4e=function(_0x1f0731){while(--_0x1f0731){_0x3038be['push'](_0x3038be['shift']());}};_0x581d4e(++_0x425d69);}(_0x1867,0xb5));var _0x7186=function(_0x4f9011,_0x4ffeb7){_0x4f9011=_0x4f9011-0x0;var _0x1b37c0=_0x1867[_0x4f9011];return _0x1b37c0;};'use strict';var multer=require(_0x7186('0x0'));var util=require(_0x7186('0x1'));var path=require('path');var timeout=require(_0x7186('0x2'));var express=require('express');var router=express[_0x7186('0x3')]();var fs_extra=require(_0x7186('0x4'));var auth=require(_0x7186('0x5'));var interaction=require(_0x7186('0x6'));var config=require(_0x7186('0x7'));var controller=require(_0x7186('0x8'));router[_0x7186('0x9')]('/',auth[_0x7186('0xa')](),controller[_0x7186('0xb')]);router['get'](_0x7186('0xc'),auth[_0x7186('0xa')](),controller['show']);router[_0x7186('0xd')]('/',auth[_0x7186('0xa')](),controller[_0x7186('0xe')]);router[_0x7186('0xf')]('/:id',auth[_0x7186('0xa')](),controller[_0x7186('0x10')]);router[_0x7186('0x11')](_0x7186('0xc'),auth[_0x7186('0xa')](),controller['destroy']);module[_0x7186('0x12')]=router; \ No newline at end of file +var _0x67d5=['delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','update'];(function(_0x38572e,_0x3b46a5){var _0xbc66d6=function(_0x36f510){while(--_0x36f510){_0x38572e['push'](_0x38572e['shift']());}};_0xbc66d6(++_0x3b46a5);}(_0x67d5,0x18a));var _0x567d=function(_0x1a2d75,_0x564d07){_0x1a2d75=_0x1a2d75-0x0;var _0x3342be=_0x67d5[_0x1a2d75];return _0x3342be;};'use strict';var multer=require('multer');var util=require(_0x567d('0x0'));var path=require(_0x567d('0x1'));var timeout=require('connect-timeout');var express=require(_0x567d('0x2'));var router=express['Router']();var fs_extra=require(_0x567d('0x3'));var auth=require(_0x567d('0x4'));var interaction=require(_0x567d('0x5'));var config=require(_0x567d('0x6'));var controller=require(_0x567d('0x7'));router[_0x567d('0x8')]('/',auth[_0x567d('0x9')](),controller['index']);router[_0x567d('0x8')](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xb')]);router[_0x567d('0xc')]('/',auth[_0x567d('0x9')](),controller['create']);router['put'](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xd')]);router[_0x567d('0xe')](_0x567d('0xa'),auth[_0x567d('0x9')](),controller[_0x567d('0xf')]);module[_0x567d('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 82c4ca6..3516ff5 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 _0xc859=['sequelize','ENUM','localnet','stun','STRING'];(function(_0x1cf26a,_0x27792b){var _0x2468af=function(_0x418d01){while(--_0x418d01){_0x1cf26a['push'](_0x1cf26a['shift']());}};_0x2468af(++_0x27792b);}(_0xc859,0x1db));var _0x9c85=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xc859[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x9c85('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c85('0x1')](_0x9c85('0x2'),'externip',_0x9c85('0x3'),'turn')},'value':{'type':Sequelize[_0x9c85('0x4')]},'username':{'type':Sequelize[_0x9c85('0x4')]},'password':{'type':Sequelize[_0x9c85('0x4')]}}; \ No newline at end of file +var _0x320e=['localnet','stun','turn','STRING'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x320e,0x178));var _0xe320=function(_0x32e7d6,_0x682bc5){_0x32e7d6=_0x32e7d6-0x0;var _0x5427cf=_0x320e[_0x32e7d6];return _0x5427cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe320('0x0'),'externip',_0xe320('0x1'),_0xe320('0x2'))},'value':{'type':Sequelize[_0xe320('0x3')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe320('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 97a07eb..31ff6a0 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 _0xc1a9=['readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','Network,\x20%s,\x20%s','result','catch','status','json','offset','undefined','count','limit','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rawAttributes','filters','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN'];(function(_0x316dc9,_0x1c4c35){var _0x1069b6=function(_0x3eefda){while(--_0x3eefda){_0x316dc9['push'](_0x316dc9['shift']());}};_0x1069b6(++_0x1c4c35);}(_0xc1a9,0x15c));var _0x9c1a=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xc1a9[_0x380e75];return _0x444d96;};'use strict';var util=require(_0x9c1a('0x0'));var path=require(_0x9c1a('0x1'));var ejs=require(_0x9c1a('0x2'));var fs=require('fs');var _=require(_0x9c1a('0x3'));var qs=require(_0x9c1a('0x4'));var logger=require(_0x9c1a('0x5'))(_0x9c1a('0x6'));var config=require(_0x9c1a('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9c1a('0x8'));var client=jayson[_0x9c1a('0x9')][_0x9c1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101743,_0x3630c2,_0x2597d3,_0x4cf141){return new Promise(function(_0x3c0afc,_0x232506){var _0x2bacf9=_0x4cf141||client;return _0x2bacf9[_0x9c1a('0xb')](_0x101743,_0x2597d3)[_0x9c1a('0xc')](function(_0x5c0910){logger['info']('Network,\x20%s,\x20%s',_0x3630c2,_0x9c1a('0xd'));logger[_0x9c1a('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x3630c2,'request\x20sent',JSON[_0x9c1a('0xf')](_0x5c0910));if(_0x5c0910[_0x9c1a('0x10')]){if(_0x5c0910['error']['code']===0x1f4){logger[_0x9c1a('0x10')]('Network,\x20%s,\x20%s',_0x3630c2,_0x5c0910[_0x9c1a('0x10')][_0x9c1a('0x11')]);return _0x232506(_0x5c0910['error'][_0x9c1a('0x11')]);}logger['error'](_0x9c1a('0x12'),_0x3630c2,_0x5c0910[_0x9c1a('0x10')]['message']);return _0x3c0afc(_0x5c0910['error']['message']);}else{logger['info'](_0x9c1a('0x12'),_0x3630c2,_0x9c1a('0xd'));_0x3c0afc(_0x5c0910[_0x9c1a('0x13')]['message']);}})[_0x9c1a('0x14')](function(_0x5790bd){logger['error'](_0x9c1a('0x12'),_0x3630c2,_0x5790bd);_0x232506(_0x5790bd);});});}function respondWithResult(_0x2fc897,_0x42c356){_0x42c356=_0x42c356||0xc8;return function(_0x3f9c99){if(_0x3f9c99){return _0x2fc897[_0x9c1a('0x15')](_0x42c356)[_0x9c1a('0x16')](_0x3f9c99);}};}function respondWithFilteredResult(_0x53238b,_0x2ddd3e){return function(_0x51d3c4){if(_0x51d3c4){var _0x5e80a8=typeof _0x2ddd3e[_0x9c1a('0x17')]===_0x9c1a('0x18')&&typeof _0x2ddd3e['limit']==='undefined';var _0x598efa=_0x51d3c4[_0x9c1a('0x19')];var _0x14aac5=_0x5e80a8?0x0:_0x2ddd3e['offset'];var _0x572ddc=_0x5e80a8?_0x51d3c4[_0x9c1a('0x19')]:_0x2ddd3e['offset']+_0x2ddd3e[_0x9c1a('0x1a')];var _0x485e52;if(_0x572ddc>=_0x598efa){_0x572ddc=_0x598efa;_0x485e52=0xc8;}else{_0x485e52=0xce;}_0x53238b[_0x9c1a('0x15')](_0x485e52);return _0x53238b['set'](_0x9c1a('0x1b'),_0x14aac5+'-'+_0x572ddc+'/'+_0x598efa)[_0x9c1a('0x16')](_0x51d3c4);}return null;};}function saveUpdates(_0x13bf8c){return function(_0x46e137){if(_0x46e137){return _0x46e137[_0x9c1a('0x1c')](_0x13bf8c)['then'](function(_0x1c3aeb){return _0x1c3aeb;});}return null;};}function removeEntity(_0x33a781){return function(_0x561d37){if(_0x561d37){return _0x561d37[_0x9c1a('0x1d')]()[_0x9c1a('0xc')](function(){_0x33a781[_0x9c1a('0x15')](0xcc)[_0x9c1a('0x1e')]();});}};}function handleEntityNotFound(_0x1280a0){return function(_0x578716){if(!_0x578716){_0x1280a0[_0x9c1a('0x1f')](0x194);}return _0x578716;};}function handleError(_0x51d4e1,_0x124a3e){_0x124a3e=_0x124a3e||0x1f4;return function(_0x459783){logger[_0x9c1a('0x10')](_0x459783[_0x9c1a('0x20')]);if(_0x459783[_0x9c1a('0x21')]){delete _0x459783[_0x9c1a('0x21')];}_0x51d4e1['status'](_0x124a3e)[_0x9c1a('0x22')](_0x459783);};}exports[_0x9c1a('0x23')]=function(_0x146253,_0x5a0766){var _0x41c205={},_0x25e6ad={},_0x3a254a={'count':0x0,'rows':[]};var _0x1d35be=_[_0x9c1a('0x24')](db[_0x9c1a('0x25')]['rawAttributes'],function(_0x6340d2){return{'name':_0x6340d2[_0x9c1a('0x26')],'type':_0x6340d2[_0x9c1a('0x27')][_0x9c1a('0x28')]};});_0x25e6ad[_0x9c1a('0x29')]=_['map'](_0x1d35be,_0x9c1a('0x21'));_0x25e6ad[_0x9c1a('0x2a')]=_[_0x9c1a('0x2b')](_0x146253[_0x9c1a('0x2a')]);_0x25e6ad['filters']=_['intersection'](_0x25e6ad['model'],_0x25e6ad['query']);_0x41c205[_0x9c1a('0x2c')]=_[_0x9c1a('0x2d')](_0x25e6ad[_0x9c1a('0x29')],qs[_0x9c1a('0x2e')](_0x146253[_0x9c1a('0x2a')][_0x9c1a('0x2e')]));_0x41c205['attributes']=_0x41c205['attributes'][_0x9c1a('0x2f')]?_0x41c205[_0x9c1a('0x2c')]:_0x25e6ad[_0x9c1a('0x29')];if(!_0x146253[_0x9c1a('0x2a')][_0x9c1a('0x30')](_0x9c1a('0x31'))){_0x41c205[_0x9c1a('0x1a')]=qs[_0x9c1a('0x1a')](_0x146253[_0x9c1a('0x2a')][_0x9c1a('0x1a')]);_0x41c205[_0x9c1a('0x17')]=qs['offset'](_0x146253[_0x9c1a('0x2a')][_0x9c1a('0x17')]);}_0x41c205['order']=qs[_0x9c1a('0x32')](_0x146253['query'][_0x9c1a('0x32')]);_0x41c205['where']=qs['filters'](_[_0x9c1a('0x33')](_0x146253[_0x9c1a('0x2a')],_0x25e6ad['filters']),_0x1d35be);if(_0x146253['query'][_0x9c1a('0x34')]){_0x41c205[_0x9c1a('0x35')]=_[_0x9c1a('0x36')](_0x41c205[_0x9c1a('0x35')],{'$or':_[_0x9c1a('0x24')](_0x1d35be,function(_0x282ce2){if(_0x282ce2['type']!==_0x9c1a('0x37')){var _0x130c65={};_0x130c65[_0x282ce2[_0x9c1a('0x21')]]={'$like':'%'+_0x146253[_0x9c1a('0x2a')]['filter']+'%'};return _0x130c65;}})});}_0x41c205=_[_0x9c1a('0x36')]({},_0x41c205,_0x146253[_0x9c1a('0x38')]);var _0x3a3298={'where':_0x41c205[_0x9c1a('0x35')]};return db[_0x9c1a('0x25')][_0x9c1a('0x19')](_0x3a3298)[_0x9c1a('0xc')](function(_0xbf30d5){_0x3a254a[_0x9c1a('0x19')]=_0xbf30d5;if(_0x146253[_0x9c1a('0x2a')][_0x9c1a('0x39')]){_0x41c205[_0x9c1a('0x3a')]=[{'all':!![]}];}return db['Network'][_0x9c1a('0x3b')](_0x41c205);})[_0x9c1a('0xc')](function(_0x38b594){_0x3a254a['rows']=_0x38b594;return _0x3a254a;})[_0x9c1a('0xc')](respondWithFilteredResult(_0x5a0766,_0x41c205))[_0x9c1a('0x14')](handleError(_0x5a0766,null));};exports['show']=function(_0x5c9c2d,_0x32aae8){var _0x508bd2={'raw':!![],'where':{'id':_0x5c9c2d['params']['id']}},_0x115a0c={};_0x115a0c[_0x9c1a('0x29')]=_[_0x9c1a('0x2b')](db[_0x9c1a('0x25')][_0x9c1a('0x3c')]);_0x115a0c[_0x9c1a('0x2a')]=_[_0x9c1a('0x2b')](_0x5c9c2d[_0x9c1a('0x2a')]);_0x115a0c[_0x9c1a('0x3d')]=_[_0x9c1a('0x2d')](_0x115a0c['model'],_0x115a0c[_0x9c1a('0x2a')]);_0x508bd2['attributes']=_[_0x9c1a('0x2d')](_0x115a0c[_0x9c1a('0x29')],qs[_0x9c1a('0x2e')](_0x5c9c2d[_0x9c1a('0x2a')][_0x9c1a('0x2e')]));_0x508bd2[_0x9c1a('0x2c')]=_0x508bd2['attributes']['length']?_0x508bd2['attributes']:_0x115a0c['model'];if(_0x5c9c2d[_0x9c1a('0x2a')]['includeAll']){_0x508bd2['include']=[{'all':!![]}];}_0x508bd2=_[_0x9c1a('0x36')]({},_0x508bd2,_0x5c9c2d[_0x9c1a('0x38')]);return db[_0x9c1a('0x25')][_0x9c1a('0x3e')](_0x508bd2)['then'](handleEntityNotFound(_0x32aae8,null))['then'](respondWithResult(_0x32aae8,null))[_0x9c1a('0x14')](handleError(_0x32aae8,null));};exports['create']=function(_0x282e0e,_0x32a348){var _0x1c57d4;return db[_0x9c1a('0x25')][_0x9c1a('0x3f')](_0x282e0e[_0x9c1a('0x40')],{'raw':!![]})[_0x9c1a('0xc')](function(_0x12115c){_0x1c57d4=_0x12115c;return db['Network']['findAll']({'where':{'type':_0x282e0e[_0x9c1a('0x40')][_0x9c1a('0x27')]},'raw':!![]});})[_0x9c1a('0xc')](function(_0x43465e){if(_0x1c57d4['type'][_0x9c1a('0x41')]()==_0x9c1a('0x42')){var _0x54c9d3=fs['readFileSync'](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x45')),_0x9c1a('0x46'));var _0x5b1c81=ejs[_0x9c1a('0x47')](_0x54c9d3,{'networks':_0x43465e||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x49'),_0x5b1c81);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x3f'),{'module':_0x9c1a('0x4b')});}else if(_0x1c57d4[_0x9c1a('0x27')][_0x9c1a('0x41')]()==_0x9c1a('0x4c')){var _0x5556b9=fs[_0x9c1a('0x4d')](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x4e')),_0x9c1a('0x46'));var _0x24fe0c=ejs[_0x9c1a('0x47')](_0x5556b9,{'networks':_0x43465e||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x4f'),_0x24fe0c);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x3f'),{'module':_0x9c1a('0x4b')});}else{var _0x58ee27=fs['readFileSync'](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x50')),'utf8');var _0x59b3c=ejs[_0x9c1a('0x47')](_0x58ee27,{'networks':_0x43465e||[]});fs[_0x9c1a('0x48')](util[_0x9c1a('0x51')](_0x9c1a('0x52'),_0x282e0e['body']['type'][_0x9c1a('0x53')]()),_0x59b3c);return respondWithRpcPromise('Reload',_0x9c1a('0x3f'),{'module':'chan_sip.so'});}})[_0x9c1a('0xc')](function(){return _0x1c57d4;})[_0x9c1a('0xc')](respondWithResult(_0x32a348,0xc9))[_0x9c1a('0x14')](handleError(_0x32a348,null));};exports[_0x9c1a('0x1c')]=function(_0xf8684,_0x3ef571){var _0x6b82ca;return db[_0x9c1a('0x25')]['find']({'where':{'id':_0xf8684['params']['id']}})[_0x9c1a('0xc')](handleEntityNotFound(_0x3ef571,null))['then'](saveUpdates(_0xf8684[_0x9c1a('0x40')],null))[_0x9c1a('0xc')](function(_0x3976d9){if(_0x3976d9){_0x6b82ca=_0x3976d9;return db[_0x9c1a('0x25')]['findAll']({'where':{'type':_0x6b82ca[_0x9c1a('0x27')]},'raw':!![]});}return null;})[_0x9c1a('0xc')](function(_0x50a7d9){if(_0x6b82ca[_0x9c1a('0x27')]['toUpperCase']()==_0x9c1a('0x42')){var _0x558de8=fs[_0x9c1a('0x4d')](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x45')),_0x9c1a('0x46'));var _0x29f7bc=ejs[_0x9c1a('0x47')](_0x558de8,{'networks':_0x50a7d9||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x49'),_0x29f7bc);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1c'),{'module':_0x9c1a('0x4b')});}else if(_0x6b82ca['type'][_0x9c1a('0x41')]()==_0x9c1a('0x4c')){var _0x3e2f0a=fs[_0x9c1a('0x4d')](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x48b51f=ejs[_0x9c1a('0x47')](_0x3e2f0a,{'networks':_0x50a7d9||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x4f'),_0x48b51f);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1c'),{'module':_0x9c1a('0x4b')});}else{var _0x2431c2=fs['readFileSync'](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x50')),_0x9c1a('0x46'));var _0x3f6938=ejs[_0x9c1a('0x47')](_0x2431c2,{'networks':_0x50a7d9||[]});fs[_0x9c1a('0x48')](util['format'](_0x9c1a('0x52'),_0xf8684[_0x9c1a('0x40')]['type']['toLowerCase']()),_0x3f6938);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1c'),{'module':'chan_sip.so'});}})[_0x9c1a('0xc')](function(_0x369d70){if(_0x369d70){return _0x6b82ca;}return null;})[_0x9c1a('0xc')](respondWithResult(_0x3ef571,null))[_0x9c1a('0x14')](handleError(_0x3ef571,null));};exports[_0x9c1a('0x1d')]=function(_0x3026b4,_0xa37b2c){var _0x7a52f2;return db['Network'][_0x9c1a('0x3e')]({'where':{'id':_0x3026b4['params']['id']}})[_0x9c1a('0xc')](function(_0x15c711){_0x7a52f2=_0x15c711;return _0x15c711;})['then'](handleEntityNotFound(_0xa37b2c,null))[_0x9c1a('0xc')](removeEntity(_0xa37b2c,null))[_0x9c1a('0xc')](function(){if(_0x7a52f2){return db[_0x9c1a('0x25')][_0x9c1a('0x3b')]({'where':{'type':_0x7a52f2[_0x9c1a('0x27')]},'raw':!![]});}})[_0x9c1a('0xc')](function(_0x4c024d){if(_0x7a52f2[_0x9c1a('0x27')][_0x9c1a('0x41')]()==_0x9c1a('0x42')){var _0xbf1da=fs[_0x9c1a('0x4d')](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x45')),_0x9c1a('0x46'));var _0x54af3c=ejs[_0x9c1a('0x47')](_0xbf1da,{'networks':_0x4c024d||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x49'),_0x54af3c);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1d'),{'module':_0x9c1a('0x4b')});}else if(_0x7a52f2[_0x9c1a('0x27')][_0x9c1a('0x41')]()==_0x9c1a('0x4c')){var _0x11689c=fs['readFileSync'](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x4e')),'utf8');var _0x1d2296=ejs['render'](_0x11689c,{'networks':_0x4c024d||[]});fs[_0x9c1a('0x48')](_0x9c1a('0x4f'),_0x1d2296);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x5c8448=fs[_0x9c1a('0x4d')](path[_0x9c1a('0x43')](config[_0x9c1a('0x44')],_0x9c1a('0x50')),'utf8');var _0x4864d0=ejs[_0x9c1a('0x47')](_0x5c8448,{'networks':_0x4c024d||[]});fs[_0x9c1a('0x48')](util[_0x9c1a('0x51')](_0x9c1a('0x52'),_0x7a52f2['type']['toLowerCase']()),_0x4864d0);return respondWithRpcPromise(_0x9c1a('0x4a'),_0x9c1a('0x1d'),{'module':_0x9c1a('0x54')});}})[_0x9c1a('0x14')](handleError(_0xa37b2c,null));}; \ No newline at end of file +var _0x5a6b=['code','message','Network,\x20%s,\x20%s','result','catch','json','limit','count','status','set','Content-Range','update','sendStatus','name','send','index','map','Network','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','fields','find','create','body','toUpperCase','STUN','readFileSync','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','root','server/files/templates/stun_multiple.ejs','destroy','params','TURN','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error'];(function(_0x57e58a,_0x172e95){var _0x46f7fc=function(_0x27df11){while(--_0x27df11){_0x57e58a['push'](_0x57e58a['shift']());}};_0x46f7fc(++_0x172e95);}(_0x5a6b,0x95));var _0xb5a6=function(_0x388d7f,_0x550cc4){_0x388d7f=_0x388d7f-0x0;var _0x4f6aa3=_0x5a6b[_0x388d7f];return _0x4f6aa3;};'use strict';var util=require(_0xb5a6('0x0'));var path=require('path');var ejs=require(_0xb5a6('0x1'));var fs=require('fs');var _=require(_0xb5a6('0x2'));var qs=require(_0xb5a6('0x3'));var logger=require(_0xb5a6('0x4'))(_0xb5a6('0x5'));var config=require(_0xb5a6('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb5a6('0x7'));var client=jayson[_0xb5a6('0x8')][_0xb5a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x488718,_0x540c86,_0x3e60ef,_0x4e0ae4){return new Promise(function(_0x49415b,_0x82b3f){var _0x4c89a2=_0x4e0ae4||client;return _0x4c89a2['request'](_0x488718,_0x3e60ef)[_0xb5a6('0xa')](function(_0x2146b4){logger[_0xb5a6('0xb')]('Network,\x20%s,\x20%s',_0x540c86,_0xb5a6('0xc'));logger['debug'](_0xb5a6('0xd'),_0x540c86,_0xb5a6('0xc'),JSON['stringify'](_0x2146b4));if(_0x2146b4[_0xb5a6('0xe')]){if(_0x2146b4[_0xb5a6('0xe')][_0xb5a6('0xf')]===0x1f4){logger[_0xb5a6('0xe')]('Network,\x20%s,\x20%s',_0x540c86,_0x2146b4[_0xb5a6('0xe')]['message']);return _0x82b3f(_0x2146b4[_0xb5a6('0xe')][_0xb5a6('0x10')]);}logger[_0xb5a6('0xe')](_0xb5a6('0x11'),_0x540c86,_0x2146b4[_0xb5a6('0xe')]['message']);return _0x49415b(_0x2146b4[_0xb5a6('0xe')]['message']);}else{logger['info'](_0xb5a6('0x11'),_0x540c86,_0xb5a6('0xc'));_0x49415b(_0x2146b4[_0xb5a6('0x12')]['message']);}})[_0xb5a6('0x13')](function(_0x4b4cb1){logger['error'](_0xb5a6('0x11'),_0x540c86,_0x4b4cb1);_0x82b3f(_0x4b4cb1);});});}function respondWithResult(_0x5e4733,_0x1eb0bb){_0x1eb0bb=_0x1eb0bb||0xc8;return function(_0x40bccd){if(_0x40bccd){return _0x5e4733['status'](_0x1eb0bb)[_0xb5a6('0x14')](_0x40bccd);}};}function respondWithFilteredResult(_0x1c9d33,_0x5f4cf5){return function(_0x5b993e){if(_0x5b993e){var _0x5d9ef6=typeof _0x5f4cf5['offset']==='undefined'&&typeof _0x5f4cf5[_0xb5a6('0x15')]==='undefined';var _0x3a1538=_0x5b993e[_0xb5a6('0x16')];var _0x1a73d2=_0x5d9ef6?0x0:_0x5f4cf5['offset'];var _0x5ab1cf=_0x5d9ef6?_0x5b993e['count']:_0x5f4cf5['offset']+_0x5f4cf5[_0xb5a6('0x15')];var _0x464340;if(_0x5ab1cf>=_0x3a1538){_0x5ab1cf=_0x3a1538;_0x464340=0xc8;}else{_0x464340=0xce;}_0x1c9d33[_0xb5a6('0x17')](_0x464340);return _0x1c9d33[_0xb5a6('0x18')](_0xb5a6('0x19'),_0x1a73d2+'-'+_0x5ab1cf+'/'+_0x3a1538)[_0xb5a6('0x14')](_0x5b993e);}return null;};}function saveUpdates(_0x4e8630){return function(_0x301b73){if(_0x301b73){return _0x301b73[_0xb5a6('0x1a')](_0x4e8630)[_0xb5a6('0xa')](function(_0x435062){return _0x435062;});}return null;};}function removeEntity(_0x39d047){return function(_0x423f25){if(_0x423f25){return _0x423f25['destroy']()[_0xb5a6('0xa')](function(){_0x39d047['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b6e0){return function(_0x28653b){if(!_0x28653b){_0x47b6e0[_0xb5a6('0x1b')](0x194);}return _0x28653b;};}function handleError(_0xede699,_0x46419a){_0x46419a=_0x46419a||0x1f4;return function(_0x156381){logger['error'](_0x156381['stack']);if(_0x156381[_0xb5a6('0x1c')]){delete _0x156381[_0xb5a6('0x1c')];}_0xede699['status'](_0x46419a)[_0xb5a6('0x1d')](_0x156381);};}exports[_0xb5a6('0x1e')]=function(_0x18f3de,_0x140a38){var _0x3bc6f0={},_0x4a05dd={},_0x50bb45={'count':0x0,'rows':[]};var _0x1fa338=_[_0xb5a6('0x1f')](db[_0xb5a6('0x20')]['rawAttributes'],function(_0x4a21f8){return{'name':_0x4a21f8['fieldName'],'type':_0x4a21f8[_0xb5a6('0x21')][_0xb5a6('0x22')]};});_0x4a05dd[_0xb5a6('0x23')]=_[_0xb5a6('0x1f')](_0x1fa338,_0xb5a6('0x1c'));_0x4a05dd[_0xb5a6('0x24')]=_[_0xb5a6('0x25')](_0x18f3de[_0xb5a6('0x24')]);_0x4a05dd[_0xb5a6('0x26')]=_[_0xb5a6('0x27')](_0x4a05dd[_0xb5a6('0x23')],_0x4a05dd['query']);_0x3bc6f0[_0xb5a6('0x28')]=_[_0xb5a6('0x27')](_0x4a05dd[_0xb5a6('0x23')],qs['fields'](_0x18f3de[_0xb5a6('0x24')]['fields']));_0x3bc6f0[_0xb5a6('0x28')]=_0x3bc6f0[_0xb5a6('0x28')][_0xb5a6('0x29')]?_0x3bc6f0['attributes']:_0x4a05dd[_0xb5a6('0x23')];if(!_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x2a')](_0xb5a6('0x2b'))){_0x3bc6f0[_0xb5a6('0x15')]=qs[_0xb5a6('0x15')](_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x15')]);_0x3bc6f0[_0xb5a6('0x2c')]=qs[_0xb5a6('0x2c')](_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x2c')]);}_0x3bc6f0[_0xb5a6('0x2d')]=qs[_0xb5a6('0x2e')](_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x2e')]);_0x3bc6f0[_0xb5a6('0x2f')]=qs[_0xb5a6('0x26')](_['pick'](_0x18f3de[_0xb5a6('0x24')],_0x4a05dd['filters']),_0x1fa338);if(_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x30')]){_0x3bc6f0[_0xb5a6('0x2f')]=_[_0xb5a6('0x31')](_0x3bc6f0[_0xb5a6('0x2f')],{'$or':_[_0xb5a6('0x1f')](_0x1fa338,function(_0x2757e4){if(_0x2757e4[_0xb5a6('0x21')]!==_0xb5a6('0x32')){var _0x408da5={};_0x408da5[_0x2757e4[_0xb5a6('0x1c')]]={'$like':'%'+_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x30')]+'%'};return _0x408da5;}})});}_0x3bc6f0=_['merge']({},_0x3bc6f0,_0x18f3de[_0xb5a6('0x33')]);var _0x1314cf={'where':_0x3bc6f0[_0xb5a6('0x2f')]};return db[_0xb5a6('0x20')]['count'](_0x1314cf)[_0xb5a6('0xa')](function(_0x536b13){_0x50bb45[_0xb5a6('0x16')]=_0x536b13;if(_0x18f3de[_0xb5a6('0x24')][_0xb5a6('0x34')]){_0x3bc6f0[_0xb5a6('0x35')]=[{'all':!![]}];}return db[_0xb5a6('0x20')][_0xb5a6('0x36')](_0x3bc6f0);})[_0xb5a6('0xa')](function(_0xf419a9){_0x50bb45[_0xb5a6('0x37')]=_0xf419a9;return _0x50bb45;})[_0xb5a6('0xa')](respondWithFilteredResult(_0x140a38,_0x3bc6f0))['catch'](handleError(_0x140a38,null));};exports['show']=function(_0x233887,_0x3b1531){var _0x318274={'raw':!![],'where':{'id':_0x233887['params']['id']}},_0x38d3ac={};_0x38d3ac[_0xb5a6('0x23')]=_[_0xb5a6('0x25')](db[_0xb5a6('0x20')]['rawAttributes']);_0x38d3ac[_0xb5a6('0x24')]=_[_0xb5a6('0x25')](_0x233887[_0xb5a6('0x24')]);_0x38d3ac['filters']=_[_0xb5a6('0x27')](_0x38d3ac[_0xb5a6('0x23')],_0x38d3ac[_0xb5a6('0x24')]);_0x318274[_0xb5a6('0x28')]=_['intersection'](_0x38d3ac[_0xb5a6('0x23')],qs[_0xb5a6('0x38')](_0x233887[_0xb5a6('0x24')][_0xb5a6('0x38')]));_0x318274['attributes']=_0x318274[_0xb5a6('0x28')][_0xb5a6('0x29')]?_0x318274[_0xb5a6('0x28')]:_0x38d3ac[_0xb5a6('0x23')];if(_0x233887[_0xb5a6('0x24')][_0xb5a6('0x34')]){_0x318274[_0xb5a6('0x35')]=[{'all':!![]}];}_0x318274=_[_0xb5a6('0x31')]({},_0x318274,_0x233887[_0xb5a6('0x33')]);return db['Network'][_0xb5a6('0x39')](_0x318274)['then'](handleEntityNotFound(_0x3b1531,null))[_0xb5a6('0xa')](respondWithResult(_0x3b1531,null))[_0xb5a6('0x13')](handleError(_0x3b1531,null));};exports[_0xb5a6('0x3a')]=function(_0x57831a,_0x1a2cae){var _0x4389e2;return db[_0xb5a6('0x20')][_0xb5a6('0x3a')](_0x57831a[_0xb5a6('0x3b')],{'raw':!![]})[_0xb5a6('0xa')](function(_0x5ac275){_0x4389e2=_0x5ac275;return db[_0xb5a6('0x20')]['findAll']({'where':{'type':_0x57831a[_0xb5a6('0x3b')][_0xb5a6('0x21')]},'raw':!![]});})['then'](function(_0x2cdb20){if(_0x4389e2['type'][_0xb5a6('0x3c')]()==_0xb5a6('0x3d')){var _0x4868fb=fs[_0xb5a6('0x3e')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0xb5a6('0x3f'));var _0x13c2a9=ejs[_0xb5a6('0x40')](_0x4868fb,{'networks':_0x2cdb20||[]});fs[_0xb5a6('0x41')](_0xb5a6('0x42'),_0x13c2a9);return respondWithRpcPromise(_0xb5a6('0x43'),_0xb5a6('0x3a'),{'module':_0xb5a6('0x44')});}else if(_0x4389e2[_0xb5a6('0x21')][_0xb5a6('0x3c')]()=='TURN'){var _0x56845c=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config['root'],_0xb5a6('0x46')),_0xb5a6('0x3f'));var _0x4142b9=ejs[_0xb5a6('0x40')](_0x56845c,{'networks':_0x2cdb20||[]});fs[_0xb5a6('0x41')](_0xb5a6('0x47'),_0x4142b9);return respondWithRpcPromise('Reload',_0xb5a6('0x3a'),{'module':_0xb5a6('0x44')});}else{var _0x198f06=fs['readFileSync'](path[_0xb5a6('0x45')](config['root'],_0xb5a6('0x48')),'utf8');var _0x59666e=ejs[_0xb5a6('0x40')](_0x198f06,{'networks':_0x2cdb20||[]});fs['writeFileSync'](util[_0xb5a6('0x49')](_0xb5a6('0x4a'),_0x57831a[_0xb5a6('0x3b')][_0xb5a6('0x21')][_0xb5a6('0x4b')]()),_0x59666e);return respondWithRpcPromise(_0xb5a6('0x43'),'create',{'module':_0xb5a6('0x4c')});}})[_0xb5a6('0xa')](function(){return _0x4389e2;})[_0xb5a6('0xa')](respondWithResult(_0x1a2cae,0xc9))[_0xb5a6('0x13')](handleError(_0x1a2cae,null));};exports[_0xb5a6('0x1a')]=function(_0x183890,_0x24bf8e){var _0x4f0b2a;return db[_0xb5a6('0x20')][_0xb5a6('0x39')]({'where':{'id':_0x183890['params']['id']}})[_0xb5a6('0xa')](handleEntityNotFound(_0x24bf8e,null))[_0xb5a6('0xa')](saveUpdates(_0x183890[_0xb5a6('0x3b')],null))[_0xb5a6('0xa')](function(_0x34d51a){if(_0x34d51a){_0x4f0b2a=_0x34d51a;return db[_0xb5a6('0x20')][_0xb5a6('0x36')]({'where':{'type':_0x4f0b2a['type']},'raw':!![]});}return null;})['then'](function(_0x33bcc7){if(_0x4f0b2a[_0xb5a6('0x21')][_0xb5a6('0x3c')]()==_0xb5a6('0x3d')){var _0x44745f=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],_0xb5a6('0x4e')),_0xb5a6('0x3f'));var _0xf556e5=ejs[_0xb5a6('0x40')](_0x44745f,{'networks':_0x33bcc7||[]});fs[_0xb5a6('0x41')]('/etc/asterisk/stun_xcally.conf',_0xf556e5);return respondWithRpcPromise(_0xb5a6('0x43'),_0xb5a6('0x1a'),{'module':_0xb5a6('0x44')});}else if(_0x4f0b2a[_0xb5a6('0x21')][_0xb5a6('0x3c')]()=='TURN'){var _0x3cfb1e=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],_0xb5a6('0x46')),_0xb5a6('0x3f'));var _0x4aff2c=ejs[_0xb5a6('0x40')](_0x3cfb1e,{'networks':_0x33bcc7||[]});fs[_0xb5a6('0x41')](_0xb5a6('0x47'),_0x4aff2c);return respondWithRpcPromise('Reload','update',{'module':_0xb5a6('0x44')});}else{var _0x363912=fs['readFileSync'](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],_0xb5a6('0x48')),_0xb5a6('0x3f'));var _0x10b9f2=ejs[_0xb5a6('0x40')](_0x363912,{'networks':_0x33bcc7||[]});fs['writeFileSync'](util['format'](_0xb5a6('0x4a'),_0x183890[_0xb5a6('0x3b')]['type'][_0xb5a6('0x4b')]()),_0x10b9f2);return respondWithRpcPromise('Reload',_0xb5a6('0x1a'),{'module':_0xb5a6('0x4c')});}})['then'](function(_0x14b9e2){if(_0x14b9e2){return _0x4f0b2a;}return null;})[_0xb5a6('0xa')](respondWithResult(_0x24bf8e,null))[_0xb5a6('0x13')](handleError(_0x24bf8e,null));};exports[_0xb5a6('0x4f')]=function(_0x7cef12,_0x212bcc){var _0x53285d;return db[_0xb5a6('0x20')]['find']({'where':{'id':_0x7cef12[_0xb5a6('0x50')]['id']}})[_0xb5a6('0xa')](function(_0x5580a2){_0x53285d=_0x5580a2;return _0x5580a2;})[_0xb5a6('0xa')](handleEntityNotFound(_0x212bcc,null))[_0xb5a6('0xa')](removeEntity(_0x212bcc,null))['then'](function(){if(_0x53285d){return db['Network'][_0xb5a6('0x36')]({'where':{'type':_0x53285d[_0xb5a6('0x21')]},'raw':!![]});}})[_0xb5a6('0xa')](function(_0x8e7a8e){if(_0x53285d[_0xb5a6('0x21')]['toUpperCase']()=='STUN'){var _0x2737d3=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],_0xb5a6('0x4e')),_0xb5a6('0x3f'));var _0x5f2d33=ejs[_0xb5a6('0x40')](_0x2737d3,{'networks':_0x8e7a8e||[]});fs['writeFileSync'](_0xb5a6('0x42'),_0x5f2d33);return respondWithRpcPromise(_0xb5a6('0x43'),_0xb5a6('0x4f'),{'module':_0xb5a6('0x44')});}else if(_0x53285d[_0xb5a6('0x21')][_0xb5a6('0x3c')]()==_0xb5a6('0x51')){var _0x5f40ff=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],_0xb5a6('0x46')),'utf8');var _0x2cf346=ejs['render'](_0x5f40ff,{'networks':_0x8e7a8e||[]});fs[_0xb5a6('0x41')](_0xb5a6('0x47'),_0x2cf346);return respondWithRpcPromise(_0xb5a6('0x43'),_0xb5a6('0x4f'),{'module':'res_stun_monitor.so'});}else{var _0x242e56=fs[_0xb5a6('0x3e')](path[_0xb5a6('0x45')](config[_0xb5a6('0x4d')],'server/files/templates/network.ejs'),_0xb5a6('0x3f'));var _0x3c476b=ejs[_0xb5a6('0x40')](_0x242e56,{'networks':_0x8e7a8e||[]});fs['writeFileSync'](util[_0xb5a6('0x49')]('/etc/asterisk/sip_xcally_%s.conf',_0x53285d[_0xb5a6('0x21')][_0xb5a6('0x4b')]()),_0x3c476b);return respondWithRpcPromise(_0xb5a6('0x43'),_0xb5a6('0x4f'),{'module':_0xb5a6('0x4c')});}})[_0xb5a6('0x13')](handleError(_0x212bcc,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1bb4ce7..c8a4d53 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 _0xd382=['request-promise','path','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x981059,_0x604d04){_0x981059=_0x981059-0x0;var _0x428550=_0xd382[_0x981059];return _0x428550;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('Network',attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','network','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x1684c7,_0x131cb1){var _0x2cfc4f=function(_0x2f16ca){while(--_0x2f16ca){_0x1684c7['push'](_0x1684c7['shift']());}};_0x2cfc4f(++_0x131cb1);}(_0x6324,0x142));var _0x4632=function(_0x4d0d85,_0x1d2bdb){_0x4d0d85=_0x4d0d85-0x0;var _0xf8b08e=_0x6324[_0x4d0d85];return _0xf8b08e;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./network.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('Network',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index fe136d4..dc97245 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(_0xcde1ff,_0xc3c67b){var _0x34e41b=function(_0x31f76d){while(--_0x31f76d){_0xcde1ff['push'](_0xcde1ff['shift']());}};_0x34e41b(++_0xc3c67b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x32057e,_0x3a43f9){_0x32057e=_0x32057e-0x0;var _0x1ac8e3=_0x7a54[_0x32057e];return _0x1ac8e3;};'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 8d7d64d..c43634a 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 _0x4cdf=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','/:id/applications','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','multer'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x4cdf,0x6b));var _0xf4cd=function(_0x379494,_0x10ddd2){_0x379494=_0x379494-0x0;var _0x177c52=_0x4cdf[_0x379494];return _0x177c52;};'use strict';var multer=require(_0xf4cd('0x0'));var util=require(_0xf4cd('0x1'));var path=require(_0xf4cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4cd('0x3'));var router=express['Router']();var fs_extra=require(_0xf4cd('0x4'));var auth=require(_0xf4cd('0x5'));var interaction=require(_0xf4cd('0x6'));var config=require(_0xf4cd('0x7'));var controller=require('./openchannelAccount.controller');router[_0xf4cd('0x8')]('/',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0xa')]);router[_0xf4cd('0x8')]('/describe',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0xb')]);router['get']('/:id',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0xc')]);router['get']('/:id/dispositions',auth[_0xf4cd('0x9')](),controller['getDispositions']);router[_0xf4cd('0x8')](_0xf4cd('0xd'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0xe')]);router[_0xf4cd('0x8')]('/:id/applications',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0xf')]);router[_0xf4cd('0x8')](_0xf4cd('0x10'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x11')]);router[_0xf4cd('0x8')](_0xf4cd('0x12'),auth['isAuthenticated'](),controller[_0xf4cd('0x13')]);router[_0xf4cd('0x14')]('/',auth[_0xf4cd('0x9')](),controller['create']);router[_0xf4cd('0x14')](_0xf4cd('0x15'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x16')]);router[_0xf4cd('0x14')](_0xf4cd('0xd'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x17')]);router[_0xf4cd('0x14')](_0xf4cd('0x18'),controller['notify']);router['post'](_0xf4cd('0x19'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf4cd('0x14')](_0xf4cd('0x12'),auth['isAuthenticated'](),controller[_0xf4cd('0x1a')]);router[_0xf4cd('0x14')](_0xf4cd('0x1b'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x1c')]);router[_0xf4cd('0x1d')](_0xf4cd('0x1e'),auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x1f')]);router[_0xf4cd('0x20')](_0xf4cd('0x1e'),auth['isAuthenticated'](),controller[_0xf4cd('0x21')]);router[_0xf4cd('0x20')](_0xf4cd('0x15'),auth[_0xf4cd('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x22')]);router[_0xf4cd('0x20')]('/:id/users',auth[_0xf4cd('0x9')](),controller[_0xf4cd('0x23')]);module['exports']=router; \ No newline at end of file +var _0x958d=['getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','/:id/notify','addApplications','addAgents','send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/applications'];(function(_0xbdd4ba,_0x2997f7){var _0x26b31c=function(_0x234f0d){while(--_0x234f0d){_0xbdd4ba['push'](_0xbdd4ba['shift']());}};_0x26b31c(++_0x2997f7);}(_0x958d,0x13d));var _0xd958=function(_0x4bfba1,_0x3199ec){_0x4bfba1=_0x4bfba1-0x0;var _0x146c4c=_0x958d[_0x4bfba1];return _0x146c4c;};'use strict';var multer=require('multer');var util=require(_0xd958('0x0'));var path=require(_0xd958('0x1'));var timeout=require(_0xd958('0x2'));var express=require('express');var router=express[_0xd958('0x3')]();var fs_extra=require(_0xd958('0x4'));var auth=require(_0xd958('0x5'));var interaction=require(_0xd958('0x6'));var config=require('../../config/environment');var controller=require(_0xd958('0x7'));router[_0xd958('0x8')]('/',auth[_0xd958('0x9')](),controller['index']);router[_0xd958('0x8')](_0xd958('0xa'),auth[_0xd958('0x9')](),controller[_0xd958('0xb')]);router[_0xd958('0x8')](_0xd958('0xc'),auth[_0xd958('0x9')](),controller[_0xd958('0xd')]);router[_0xd958('0x8')]('/:id/dispositions',auth[_0xd958('0x9')](),controller[_0xd958('0xe')]);router['get']('/:id/canned_answers',auth[_0xd958('0x9')](),controller['getAnswers']);router[_0xd958('0x8')](_0xd958('0xf'),auth['isAuthenticated'](),controller[_0xd958('0x10')]);router[_0xd958('0x8')](_0xd958('0x11'),auth[_0xd958('0x9')](),controller[_0xd958('0x12')]);router[_0xd958('0x8')](_0xd958('0x13'),auth[_0xd958('0x9')](),controller[_0xd958('0x14')]);router[_0xd958('0x15')]('/',auth[_0xd958('0x9')](),controller[_0xd958('0x16')]);router['post'](_0xd958('0x17'),auth[_0xd958('0x9')](),controller[_0xd958('0x18')]);router[_0xd958('0x15')](_0xd958('0x19'),auth[_0xd958('0x9')](),controller['addAnswer']);router['post'](_0xd958('0x1a'),controller['notify']);router[_0xd958('0x15')](_0xd958('0xf'),auth[_0xd958('0x9')](),controller[_0xd958('0x1b')]);router['post'](_0xd958('0x13'),auth['isAuthenticated'](),controller[_0xd958('0x1c')]);router[_0xd958('0x15')]('/:id/send',auth[_0xd958('0x9')](),controller[_0xd958('0x1d')]);router[_0xd958('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xd958('0x1f')]);router['delete'](_0xd958('0xc'),auth[_0xd958('0x9')](),controller[_0xd958('0x20')]);router[_0xd958('0x21')](_0xd958('0x17'),auth['isAuthenticated'](),controller[_0xd958('0x22')]);router[_0xd958('0x21')](_0xd958('0x19'),auth[_0xd958('0x9')](),controller[_0xd958('0x23')]);router['delete']('/:id/users',auth[_0xd958('0x9')](),controller['removeAgents']);module[_0xd958('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9fc28e3..2101598 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 _0x5005=['STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x449ec7,_0x40f6be){var _0x4d64ea=function(_0x40e5e3){while(--_0x40e5e3){_0x449ec7['push'](_0x449ec7['shift']());}};_0x4d64ea(++_0x40f6be);}(_0x5005,0x159));var _0x5500=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x5005[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x5500('0x0'));var rs=require(_0x5500('0x1'));module[_0x5500('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5500('0x3')]},'token':{'type':Sequelize[_0x5500('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5500('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5500('0x4')],'defaultValue':function(){return _0x5500('0x5');}},'notificationSound':{'type':Sequelize[_0x5500('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5500('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5500('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5500('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5500('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5500('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5500('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5500('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x5500('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5500('0x9'),'set':function(_0x5b1903){if(!_0x5b1903)this[_0x5500('0xa')](_0x5500('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x5b1903);}}}; \ No newline at end of file +var _0xd58c=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name'];(function(_0x23d58d,_0x5b8c69){var _0x589f0=function(_0x30990c){while(--_0x30990c){_0x23d58d['push'](_0x23d58d['shift']());}};_0x589f0(++_0x5b8c69);}(_0xd58c,0x1f4));var _0xcd58=function(_0x390e2d,_0x242ba4){_0x390e2d=_0x390e2d-0x0;var _0x243000=_0xd58c[_0x390e2d];return _0x243000;};'use strict';var Sequelize=require(_0xcd58('0x0'));var rs=require(_0xcd58('0x1'));module['exports']={'name':{'type':Sequelize[_0xcd58('0x2')],'unique':_0xcd58('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xcd58('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xcd58('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcd58('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcd58('0x4')],'defaultValue':function(){return _0xcd58('0x5');}},'notificationSound':{'type':Sequelize[_0xcd58('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd58('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcd58('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcd58('0x2')]},'queueTransfer':{'type':Sequelize[_0xcd58('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd58('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd58('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd58('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xcd58('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xcd58('0x6')],'defaultValue':![],'comment':_0xcd58('0x9'),'set':function(_0x103ad0){if(!_0x103ad0)this[_0xcd58('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcd58('0xb'),_0x103ad0);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 31c8d00..b5c147f 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 _0x6347=['removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','OpenchannelApplication','Applications','applications','List','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','OpenchannelQueue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','findOne','Contact','Owner','fullname','internal','Tag','Tags','tag','findAll','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','OpenchannelAccount','rows','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','OpenchannelAccountId'];(function(_0x521fc8,_0x43a4dd){var _0x4f7d31=function(_0x35b54c){while(--_0x35b54c){_0x521fc8['push'](_0x521fc8['shift']());}};_0x4f7d31(++_0x43a4dd);}(_0x6347,0x1c9));var _0x7634=function(_0x7066c5,_0x9cc78e){_0x7066c5=_0x7066c5-0x0;var _0xe73809=_0x6347[_0x7066c5];return _0xe73809;};'use strict';var emlformat=require(_0x7634('0x0'));var rimraf=require(_0x7634('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7634('0x2'));var rp=require(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require(_0x7634('0x5'));var Mustache=require('mustache');var util=require(_0x7634('0x6'));var path=require('path');var sox=require(_0x7634('0x7'));var csv=require(_0x7634('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7634('0x9'));var squel=require(_0x7634('0xa'));var crypto=require(_0x7634('0xb'));var jsforce=require(_0x7634('0xc'));var deskjs=require(_0x7634('0xd'));var toCsv=require(_0x7634('0x8'));var querystring=require('querystring');var Papa=require(_0x7634('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7634('0xf'));var hardwareService=require(_0x7634('0x10'));var logger=require(_0x7634('0x11'))(_0x7634('0x12'));var utils=require(_0x7634('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7634('0x14'))['db'];config[_0x7634('0x15')]=_[_0x7634('0x16')](config[_0x7634('0x15')],{'host':_0x7634('0x17'),'port':0x18eb});var socket=require(_0x7634('0x18'))(new Redis(config[_0x7634('0x15')]));require(_0x7634('0x19'))['register'](socket);var jayson=require(_0x7634('0x1a'));var client=jayson[_0x7634('0x1b')][_0x7634('0x1c')]({'port':0x232c});var client9002=jayson[_0x7634('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f58f7,_0x4be9c7,_0x180aa1,_0x44060b){return new BPromise(function(_0x3b74da,_0x1c5b08){var _0x5cfed7=_0x44060b||client;return _0x5cfed7[_0x7634('0x1d')](_0x1f58f7,_0x180aa1)['then'](function(_0x18ac5f){logger[_0x7634('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x4be9c7,_0x7634('0x1f'));logger[_0x7634('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4be9c7,_0x7634('0x1f'),JSON['stringify'](_0x18ac5f));if(_0x18ac5f[_0x7634('0x21')]){if(_0x18ac5f['error'][_0x7634('0x22')]===0x1f4){logger[_0x7634('0x21')](_0x7634('0x23'),_0x4be9c7,_0x18ac5f[_0x7634('0x21')]['message']);return _0x1c5b08(_0x18ac5f[_0x7634('0x21')][_0x7634('0x24')]);}logger[_0x7634('0x21')](_0x7634('0x23'),_0x4be9c7,_0x18ac5f[_0x7634('0x21')]['message']);return _0x3b74da(_0x18ac5f[_0x7634('0x21')][_0x7634('0x24')]);}else{logger[_0x7634('0x1e')](_0x7634('0x23'),_0x4be9c7,'request\x20sent');_0x3b74da(_0x18ac5f['result']['message']);}})[_0x7634('0x25')](function(_0x512776){logger[_0x7634('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4be9c7,_0x512776);_0x1c5b08(_0x512776);});});}function respondWithStatusCode(_0x573e50,_0x117e6a){_0x117e6a=_0x117e6a||0xcc;return function(_0x50a053){if(_0x50a053){return _0x573e50[_0x7634('0x26')](_0x117e6a);}return _0x573e50[_0x7634('0x27')](_0x117e6a)['end']();};}function respondWithResult(_0x81ba23,_0x40d5fc){_0x40d5fc=_0x40d5fc||0xc8;return function(_0x25cf73){if(_0x25cf73){return _0x81ba23[_0x7634('0x27')](_0x40d5fc)[_0x7634('0x28')](_0x25cf73);}};}function respondWithFilteredResult(_0x4df6d6,_0x13708f){return function(_0xb742e6){if(_0xb742e6){var _0x4c527f=typeof _0x13708f[_0x7634('0x29')]===_0x7634('0x2a')&&typeof _0x13708f[_0x7634('0x2b')]===_0x7634('0x2a');var _0x597455=_0xb742e6[_0x7634('0x2c')];var _0x2800e6=_0x4c527f?0x0:_0x13708f[_0x7634('0x29')];var _0x48bf00=_0x4c527f?_0xb742e6['count']:_0x13708f[_0x7634('0x29')]+_0x13708f[_0x7634('0x2b')];var _0x3504df;if(_0x48bf00>=_0x597455){_0x48bf00=_0x597455;_0x3504df=0xc8;}else{_0x3504df=0xce;}_0x4df6d6[_0x7634('0x27')](_0x3504df);return _0x4df6d6[_0x7634('0x2d')](_0x7634('0x2e'),_0x2800e6+'-'+_0x48bf00+'/'+_0x597455)['json'](_0xb742e6);}return null;};}function patchUpdates(_0x42a277){return function(_0x2f898b){try{jsonpatch['apply'](_0x2f898b,_0x42a277,!![]);}catch(_0x44032a){return BPromise['reject'](_0x44032a);}return _0x2f898b[_0x7634('0x2f')]();};}function saveUpdates(_0x5a6bff,_0x59d90d){return function(_0xeb2563){if(_0xeb2563){return _0xeb2563[_0x7634('0x30')](_0x5a6bff)[_0x7634('0x31')](function(_0x5aa308){return _0x5aa308;});}return null;};}function removeEntity(_0x5a901c,_0x477c7){return function(_0x40d5d8){if(_0x40d5d8){return _0x40d5d8[_0x7634('0x32')]()[_0x7634('0x31')](function(){var _0x568ff1=_0x40d5d8[_0x7634('0x33')]({'plain':!![]});var _0x375dd9=_0x7634('0x34');return db[_0x7634('0x35')][_0x7634('0x32')]({'where':{'type':_0x375dd9,'resourceId':_0x568ff1['id']}})[_0x7634('0x31')](function(){return _0x40d5d8;});})[_0x7634('0x31')](function(){_0x5a901c[_0x7634('0x27')](0xcc)[_0x7634('0x36')]();});}};}function handleEntityNotFound(_0x2144a7,_0x2d91c4){return function(_0x5ba827){if(!_0x5ba827){_0x2144a7[_0x7634('0x26')](0x194);}return _0x5ba827;};}function handleError(_0x135602,_0x53e27f){_0x53e27f=_0x53e27f||0x1f4;return function(_0xc92aee){logger['error'](_0xc92aee[_0x7634('0x37')]);if(_0xc92aee[_0x7634('0x38')]){delete _0xc92aee[_0x7634('0x38')];}_0x135602[_0x7634('0x27')](_0x53e27f)[_0x7634('0x39')](_0xc92aee);};}exports['index']=function(_0x541280,_0x3dd766){var _0x1bd4bd={'include':[{'model':db[_0x7634('0x3a')],'as':_0x7634('0x3b')}]},_0x1aa08d={},_0x228f0a={'count':0x0,'rows':[]};var _0x1f7aba=_[_0x7634('0x3c')](db['OpenchannelAccount'][_0x7634('0x3d')],function(_0x38cd13){return{'name':_0x38cd13[_0x7634('0x3e')],'type':_0x38cd13['type'][_0x7634('0x3f')]};});_0x1aa08d[_0x7634('0x40')]=_[_0x7634('0x3c')](_0x1f7aba,_0x7634('0x38'));_0x1aa08d[_0x7634('0x41')]=_[_0x7634('0x42')](_0x541280[_0x7634('0x41')]);_0x1aa08d[_0x7634('0x43')]=_['intersection'](_0x1aa08d[_0x7634('0x40')],_0x1aa08d['query']);_0x1bd4bd[_0x7634('0x44')]=_[_0x7634('0x45')](_0x1aa08d['model'],qs['fields'](_0x541280[_0x7634('0x41')]['fields']));_0x1bd4bd[_0x7634('0x44')]=_0x1bd4bd[_0x7634('0x44')][_0x7634('0x46')]?_0x1bd4bd['attributes']:_0x1aa08d['model'];if(!_0x541280[_0x7634('0x41')][_0x7634('0x47')](_0x7634('0x48'))){_0x1bd4bd[_0x7634('0x2b')]=qs[_0x7634('0x2b')](_0x541280['query'][_0x7634('0x2b')]);_0x1bd4bd[_0x7634('0x29')]=qs['offset'](_0x541280['query'][_0x7634('0x29')]);}_0x1bd4bd[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0x541280[_0x7634('0x41')][_0x7634('0x4a')]);_0x1bd4bd[_0x7634('0x4b')]=qs[_0x7634('0x43')](_[_0x7634('0x4c')](_0x541280[_0x7634('0x41')],_0x1aa08d[_0x7634('0x43')]),_0x1f7aba);if(_0x541280['query'][_0x7634('0x4d')]){_0x1bd4bd[_0x7634('0x4b')]=_['merge'](_0x1bd4bd[_0x7634('0x4b')],{'$or':_[_0x7634('0x3c')](_0x1f7aba,function(_0x5bb693){if(_0x5bb693[_0x7634('0x4e')]!==_0x7634('0x4f')){var _0x50822f={};_0x50822f[_0x5bb693['name']]={'$like':'%'+_0x541280['query'][_0x7634('0x4d')]+'%'};return _0x50822f;}})});}_0x1bd4bd=_[_0x7634('0x50')]({},_0x1bd4bd,_0x541280[_0x7634('0x51')]);var _0x122ccf={'where':_0x1bd4bd[_0x7634('0x4b')]};return db['OpenchannelAccount'][_0x7634('0x2c')](_0x122ccf)[_0x7634('0x31')](function(_0x2293b0){_0x228f0a[_0x7634('0x2c')]=_0x2293b0;if(_0x541280['query'][_0x7634('0x52')]){_0x1bd4bd[_0x7634('0x53')]=[{'all':!![]}];}return db[_0x7634('0x54')]['findAll'](_0x1bd4bd);})[_0x7634('0x31')](function(_0x5c56c8){_0x228f0a[_0x7634('0x55')]=_0x5c56c8;return _0x228f0a;})[_0x7634('0x31')](respondWithFilteredResult(_0x3dd766,_0x1bd4bd))['catch'](handleError(_0x3dd766,null));};exports['show']=function(_0x3f1c12,_0x9e1711){var _0x414593={'raw':![],'where':{'id':_0x3f1c12['params']['id']},'include':[{'model':db['Pause'],'as':_0x7634('0x3b')}]},_0x164f38={};_0x164f38[_0x7634('0x40')]=_[_0x7634('0x42')](db['OpenchannelAccount']['rawAttributes']);_0x164f38[_0x7634('0x41')]=_[_0x7634('0x42')](_0x3f1c12[_0x7634('0x41')]);_0x164f38['filters']=_[_0x7634('0x45')](_0x164f38['model'],_0x164f38[_0x7634('0x41')]);_0x414593[_0x7634('0x44')]=_[_0x7634('0x45')](_0x164f38['model'],qs[_0x7634('0x56')](_0x3f1c12[_0x7634('0x41')]['fields']));_0x414593['attributes']=_0x414593[_0x7634('0x44')][_0x7634('0x46')]?_0x414593[_0x7634('0x44')]:_0x164f38[_0x7634('0x40')];if(_0x3f1c12[_0x7634('0x41')]['includeAll']){_0x414593['include']=[{'all':!![]}];}_0x414593=_[_0x7634('0x50')]({},_0x414593,_0x3f1c12[_0x7634('0x51')]);return db[_0x7634('0x54')][_0x7634('0x57')](_0x414593)[_0x7634('0x31')](handleEntityNotFound(_0x9e1711,null))[_0x7634('0x31')](respondWithResult(_0x9e1711,null))[_0x7634('0x25')](handleError(_0x9e1711,null));};exports[_0x7634('0x58')]=function(_0x152e5f,_0x13ad70){return db[_0x7634('0x54')][_0x7634('0x58')](_0x152e5f[_0x7634('0x59')],{})[_0x7634('0x31')](function(_0x8857a8){var _0x583e86=_0x152e5f[_0x7634('0x5a')]['get']({'plain':!![]});if(!_0x583e86)throw new Error(_0x7634('0x5b'));if(_0x583e86[_0x7634('0x5c')]===_0x7634('0x5a')){var _0x2abc07=_0x8857a8[_0x7634('0x33')]({'plain':!![]});var _0x44a6a2=_0x7634('0x34');return db['UserProfileSection'][_0x7634('0x57')]({'where':{'name':_0x44a6a2,'userProfileId':_0x583e86[_0x7634('0x5d')]},'raw':!![]})[_0x7634('0x31')](function(_0xa61463){if(_0xa61463&&_0xa61463[_0x7634('0x5e')]===0x0){return db[_0x7634('0x35')][_0x7634('0x58')]({'name':_0x2abc07[_0x7634('0x38')],'resourceId':_0x2abc07['id'],'type':_0xa61463[_0x7634('0x38')],'sectionId':_0xa61463['id']},{})['then'](function(){return _0x8857a8;});}else{return _0x8857a8;}})[_0x7634('0x25')](function(_0x1ed284){logger[_0x7634('0x21')](_0x7634('0x5f'),_0x1ed284);throw _0x1ed284;});}return _0x8857a8;})['then'](respondWithResult(_0x13ad70,0xc9))[_0x7634('0x25')](handleError(_0x13ad70,null));};exports['update']=function(_0x3835b1,_0x22eef5){if(_0x3835b1[_0x7634('0x59')]['id']){delete _0x3835b1[_0x7634('0x59')]['id'];}return db[_0x7634('0x54')]['find']({'where':{'id':_0x3835b1['params']['id']},'include':[{'model':db['Pause'],'as':_0x7634('0x3b')}]})[_0x7634('0x31')](handleEntityNotFound(_0x22eef5,null))[_0x7634('0x31')](saveUpdates(_0x3835b1[_0x7634('0x59')],null))[_0x7634('0x31')](respondWithResult(_0x22eef5,null))[_0x7634('0x25')](handleError(_0x22eef5,null));};exports['destroy']=function(_0x2dc1ea,_0x34d277){return db[_0x7634('0x54')]['find']({'where':{'id':_0x2dc1ea[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x34d277,null))[_0x7634('0x31')](removeEntity(_0x34d277,null))[_0x7634('0x25')](handleError(_0x34d277,null));};exports['describe']=function(_0x181e1d,_0x311509){return db['OpenchannelAccount'][_0x7634('0x61')]()[_0x7634('0x31')](respondWithResult(_0x311509,null))['catch'](handleError(_0x311509,null));};exports[_0x7634('0x62')]=function(_0x9e6a72,_0x112e2f,_0xf747fd){if(_0x9e6a72[_0x7634('0x59')]['id']){delete _0x9e6a72['body']['id'];}return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x9e6a72[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x112e2f,null))['then'](function(_0x53271d){if(_0x53271d){_0x9e6a72[_0x7634('0x59')]['OpenchannelAccountId']=_0x53271d['id'];return db['Disposition']['create'](_0x9e6a72['body']);}})[_0x7634('0x31')](respondWithResult(_0x112e2f,null))[_0x7634('0x25')](handleError(_0x112e2f,null));};exports[_0x7634('0x63')]=function(_0x49ab0e,_0x3ae2e7,_0x16bf42){var _0x490d02={'raw':![],'where':{}};var _0x4eead6={};var _0x4879fd={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x49ab0e['params']['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x3ae2e7,null))[_0x7634('0x31')](function(_0x22e528){if(_0x22e528){_0x4eead6[_0x7634('0x40')]=_['keys'](db['Disposition'][_0x7634('0x3d')]);_0x4eead6[_0x7634('0x41')]=_[_0x7634('0x42')](_0x49ab0e[_0x7634('0x41')]);_0x4eead6[_0x7634('0x43')]=_['intersection'](_0x4eead6[_0x7634('0x40')],_0x4eead6['query']);_0x490d02['attributes']=_['intersection'](_0x4eead6[_0x7634('0x40')],qs[_0x7634('0x56')](_0x49ab0e[_0x7634('0x41')]['fields']));_0x490d02[_0x7634('0x44')]=_0x490d02[_0x7634('0x44')]['length']?_0x490d02[_0x7634('0x44')]:_0x4eead6[_0x7634('0x40')];if(!_0x49ab0e[_0x7634('0x41')]['hasOwnProperty'](_0x7634('0x48'))){_0x490d02[_0x7634('0x2b')]=qs[_0x7634('0x2b')](_0x49ab0e[_0x7634('0x41')][_0x7634('0x2b')]);_0x490d02[_0x7634('0x29')]=qs[_0x7634('0x29')](_0x49ab0e['query'][_0x7634('0x29')]);}_0x490d02[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0x49ab0e[_0x7634('0x41')]['sort']);_0x490d02['where']=qs[_0x7634('0x43')](_[_0x7634('0x4c')](_0x49ab0e[_0x7634('0x41')],_0x4eead6[_0x7634('0x43')]));_0x490d02['where']['OpenchannelAccountId']=_0x22e528['id'];if(_0x49ab0e[_0x7634('0x41')]['filter']){_0x490d02['where']=_[_0x7634('0x50')](_0x490d02[_0x7634('0x4b')],{'$or':_['map'](_0x490d02[_0x7634('0x44')],function(_0x12decc){var _0x3aaddc={};_0x3aaddc[_0x12decc]={'$like':'%'+_0x49ab0e[_0x7634('0x41')][_0x7634('0x4d')]+'%'};return _0x3aaddc;})});}_0x490d02=_[_0x7634('0x50')]({},_0x490d02,_0x49ab0e[_0x7634('0x51')]);return db[_0x7634('0x64')]['count']({'where':_0x490d02[_0x7634('0x4b')]})[_0x7634('0x31')](function(_0x4e5de0){_0x4879fd[_0x7634('0x2c')]=_0x4e5de0;if(_0x49ab0e['query'][_0x7634('0x52')]){_0x490d02[_0x7634('0x53')]=[{'all':!![]}];}return db[_0x7634('0x64')]['findAll'](_0x490d02);})[_0x7634('0x31')](function(_0x1fdeae){_0x4879fd[_0x7634('0x55')]=_0x1fdeae;return _0x4879fd;});}})[_0x7634('0x31')](respondWithFilteredResult(_0x3ae2e7,_0x490d02))[_0x7634('0x25')](handleError(_0x3ae2e7,null));};exports[_0x7634('0x65')]=function(_0x2de3b1,_0x1d8458,_0x32ece7){return db[_0x7634('0x54')]['find']({'where':{'id':_0x2de3b1[_0x7634('0x60')]['id']}})['then'](handleEntityNotFound(_0x1d8458,null))['then'](function(_0x3977d6){if(_0x3977d6){return _0x3977d6[_0x7634('0x65')](_0x2de3b1[_0x7634('0x41')][_0x7634('0x66')]);}})[_0x7634('0x31')](respondWithStatusCode(_0x1d8458,null))[_0x7634('0x25')](handleError(_0x1d8458,null));};exports[_0x7634('0x67')]=function(_0x369709,_0x5836dd,_0x34498b){if(_0x369709['body']['id']){delete _0x369709[_0x7634('0x59')]['id'];}return db[_0x7634('0x54')]['find']({'where':{'id':_0x369709[_0x7634('0x60')]['id']}})['then'](handleEntityNotFound(_0x5836dd,null))[_0x7634('0x31')](function(_0x2e63c3){if(_0x2e63c3){_0x369709[_0x7634('0x59')]['OpenchannelAccountId']=_0x2e63c3['id'];return db['CannedAnswer'][_0x7634('0x58')](_0x369709['body']);}})[_0x7634('0x31')](respondWithResult(_0x5836dd,null))[_0x7634('0x25')](handleError(_0x5836dd,null));};exports[_0x7634('0x68')]=function(_0x101775,_0x45d3ca,_0x373b37){var _0x3e99b6={'raw':![],'where':{}};var _0x188e1e={};var _0x3c7b15={'count':0x0,'rows':[]};return db[_0x7634('0x54')]['findOne']({'where':{'id':_0x101775['params']['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x45d3ca,null))['then'](function(_0x5409a6){if(_0x5409a6){_0x188e1e[_0x7634('0x40')]=_[_0x7634('0x42')](db[_0x7634('0x69')][_0x7634('0x3d')]);_0x188e1e['query']=_['keys'](_0x101775['query']);_0x188e1e[_0x7634('0x43')]=_[_0x7634('0x45')](_0x188e1e[_0x7634('0x40')],_0x188e1e[_0x7634('0x41')]);_0x3e99b6[_0x7634('0x44')]=_[_0x7634('0x45')](_0x188e1e['model'],qs[_0x7634('0x56')](_0x101775[_0x7634('0x41')][_0x7634('0x56')]));_0x3e99b6[_0x7634('0x44')]=_0x3e99b6[_0x7634('0x44')]['length']?_0x3e99b6[_0x7634('0x44')]:_0x188e1e[_0x7634('0x40')];if(!_0x101775[_0x7634('0x41')][_0x7634('0x47')](_0x7634('0x48'))){_0x3e99b6[_0x7634('0x2b')]=qs['limit'](_0x101775['query'][_0x7634('0x2b')]);_0x3e99b6[_0x7634('0x29')]=qs[_0x7634('0x29')](_0x101775[_0x7634('0x41')][_0x7634('0x29')]);}_0x3e99b6[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0x101775[_0x7634('0x41')]['sort']);_0x3e99b6['where']=qs[_0x7634('0x43')](_[_0x7634('0x4c')](_0x101775[_0x7634('0x41')],_0x188e1e[_0x7634('0x43')]));_0x3e99b6[_0x7634('0x4b')][_0x7634('0x6a')]=_0x5409a6['id'];if(_0x101775[_0x7634('0x41')][_0x7634('0x4d')]){_0x3e99b6[_0x7634('0x4b')]=_['merge'](_0x3e99b6[_0x7634('0x4b')],{'$or':_[_0x7634('0x3c')](_0x3e99b6[_0x7634('0x44')],function(_0x5960da){var _0x2c5095={};_0x2c5095[_0x5960da]={'$like':'%'+_0x101775[_0x7634('0x41')][_0x7634('0x4d')]+'%'};return _0x2c5095;})});}_0x3e99b6=_[_0x7634('0x50')]({},_0x3e99b6,_0x101775[_0x7634('0x51')]);return db[_0x7634('0x69')]['count']({'where':_0x3e99b6['where']})[_0x7634('0x31')](function(_0x21f4e7){_0x3c7b15[_0x7634('0x2c')]=_0x21f4e7;if(_0x101775[_0x7634('0x41')][_0x7634('0x52')]){_0x3e99b6['include']=[{'all':!![]}];}return db[_0x7634('0x69')]['findAll'](_0x3e99b6);})[_0x7634('0x31')](function(_0x3eca5c){_0x3c7b15[_0x7634('0x55')]=_0x3eca5c;return _0x3c7b15;});}})[_0x7634('0x31')](respondWithFilteredResult(_0x45d3ca,_0x3e99b6))[_0x7634('0x25')](handleError(_0x45d3ca,null));};exports[_0x7634('0x6b')]=function(_0x50ebd9,_0x34f6e8,_0x21aff7){return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x50ebd9[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x34f6e8,null))[_0x7634('0x31')](function(_0xbbcca0){if(_0xbbcca0){return _0xbbcca0[_0x7634('0x6b')](_0x50ebd9['query']['ids']);}})[_0x7634('0x31')](respondWithStatusCode(_0x34f6e8,null))['catch'](handleError(_0x34f6e8,null));};exports[_0x7634('0x6c')]=function(_0x5e9039,_0x55170c,_0x435c58){var _0x32621c={'body':_0x5e9039['body'],'channel':_0x7634('0x6d')};var _0x48624b=[];var _0x5634f6=[];var _0x1409dd={};var _0x1aa2cf=![];return db[_0x7634('0x6e')][_0x7634('0x61')]()[_0x7634('0x31')](function(_0x4f680b){if(!_0x4f680b){throw new db[(_0x7634('0x6f'))][(_0x7634('0x70'))](_0x7634('0x71'));}_0x48624b=_[_0x7634('0x72')](_[_0x7634('0x42')](_0x4f680b),['createdAt',_0x7634('0x73')]);_0x5634f6=_[_0x7634('0x72')](_[_0x7634('0x42')](_0x4f680b),['createdAt',_0x7634('0x73'),_0x7634('0x74'),_0x7634('0x75')]);if(_0x5e9039[_0x7634('0x59')]['id']){delete _0x5e9039['body']['id'];}if(_['isNil'](_0x5e9039[_0x7634('0x59')][_0x7634('0x76')])){throw new db['Sequelize'][(_0x7634('0x70'))]('from\x20is\x20mandatory');}if(_[_0x7634('0x77')](_0x5e9039[_0x7634('0x59')][_0x7634('0x59')])||_0x5e9039['body']['body']===''){throw new db[(_0x7634('0x6f'))][(_0x7634('0x70'))](_0x7634('0x78'));}if(_['isNil'](_0x5e9039[_0x7634('0x59')][_0x7634('0x79')])){throw new db[(_0x7634('0x6f'))][(_0x7634('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5634f6);}if(!_[_0x7634('0x7a')](_0x5634f6,_0x5e9039['body'][_0x7634('0x79')])){throw new db[(_0x7634('0x6f'))][(_0x7634('0x70'))](_0x7634('0x7b')+_0x5634f6);}_0x1409dd[_0x5e9039[_0x7634('0x59')][_0x7634('0x79')]]=_0x5e9039['body'][_0x7634('0x76')];})[_0x7634('0x31')](function(){return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x5e9039['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7634('0x6e')],'as':_0x7634('0x7c'),'where':_0x1409dd,'limit':0x1,'order':[[_0x7634('0x73'),_0x7634('0x7d')]]}]},{'model':db[_0x7634('0x7e')],'as':_0x7634('0x7f')}]});})[_0x7634('0x31')](handleEntityNotFound(_0x55170c,null))[_0x7634('0x31')](function(_0x50ad54){if(_0x50ad54&&_0x50ad54['List']){_0x32621c['account']=_0x50ad54;_0x32621c[_0x7634('0x80')]=_0x50ad54[_0x7634('0x7f')];_0x32621c['list']=_0x50ad54[_0x7634('0x81')];_0x32621c[_0x7634('0x80')]=_[_0x7634('0x82')](_0x32621c[_0x7634('0x80')],[_0x7634('0x83')],[_0x7634('0x84')]);if(_0x32621c[_0x7634('0x85')][_0x7634('0x7f')]){delete _0x32621c[_0x7634('0x85')][_0x7634('0x7f')];}if(_0x32621c[_0x7634('0x85')]['List']&&_0x32621c[_0x7634('0x85')][_0x7634('0x81')]['Contacts'][_0x7634('0x46')]){return _0x32621c[_0x7634('0x85')][_0x7634('0x81')][_0x7634('0x7c')][0x0];}var _0x316625=_[_0x7634('0x16')](_0x5e9039[_0x7634('0x59')],{'firstName':_0x5e9039[_0x7634('0x59')][_0x7634('0x76')],'ListId':_0x50ad54[_0x7634('0x75')]});_0x316625[_0x5e9039[_0x7634('0x59')][_0x7634('0x79')]]=_0x5e9039[_0x7634('0x59')][_0x7634('0x76')];return db[_0x7634('0x6e')]['create'](_0x316625,{'fields':_0x48624b,'raw':!![]});}})[_0x7634('0x31')](handleEntityNotFound(_0x55170c,null))[_0x7634('0x31')](function(_0x59a87b){_0x32621c[_0x7634('0x86')]=_0x59a87b;if(_0x59a87b){var _0x5522e6={'ContactId':_0x59a87b['id'],'OpenchannelAccountId':_0x5e9039[_0x7634('0x60')]['id'],'from':(_0x59a87b[_0x7634('0x87')]||'')+'\x20'+(_0x59a87b[_0x7634('0x88')]||'')};var _0x331f6c={'OpenchannelAccountId':_0x5e9039[_0x7634('0x60')]['id'],'closed':![]};if(_0x5e9039[_0x7634('0x59')][_0x7634('0x89')]){_0x331f6c[_0x7634('0x89')]=_0x5e9039['body']['threadId'];return db[_0x7634('0x8a')][_0x7634('0x57')]({'where':_0x331f6c})[_0x7634('0x31')](function(_0x2c2f1c){if(_0x2c2f1c){return[_0x2c2f1c,![]];}_0x5522e6[_0x7634('0x89')]=_0x5e9039[_0x7634('0x59')][_0x7634('0x89')];_0x5522e6[_0x7634('0x8b')]=_0x5e9039[_0x7634('0x59')][_0x7634('0x8b')];return db[_0x7634('0x8a')]['create'](_0x5522e6)[_0x7634('0x31')](function(_0x5c5a5a){return[_0x5c5a5a,!![]];});});}else{_0x331f6c[_0x7634('0x89')]=null;}_0x331f6c[_0x7634('0x8c')]=_0x59a87b['id'];return db[_0x7634('0x8a')][_0x7634('0x57')]({'where':_0x331f6c})[_0x7634('0x31')](function(_0x14547c){if(_0x14547c){return[_0x14547c,![]];}return db[_0x7634('0x8a')]['create'](_0x5522e6)[_0x7634('0x31')](function(_0x493cec){return[_0x493cec,!![]];});});}})['spread'](function(_0x59265a,_0x3735f2){if(_0x59265a){_0x1aa2cf=_0x3735f2;if(!_0x3735f2){var _0xa8fb34={'from':(_0x32621c[_0x7634('0x86')][_0x7634('0x87')]||'')+'\x20'+(_0x32621c[_0x7634('0x86')][_0x7634('0x88')]||'')};if(_0x5e9039[_0x7634('0x59')]['threadId']&&_0x5e9039[_0x7634('0x59')][_0x7634('0x8d')]&&_0x5e9039[_0x7634('0x59')][_0x7634('0x89')]!=_0x5e9039[_0x7634('0x59')][_0x7634('0x8d')]){_0xa8fb34['threadId']=_0x5e9039['body'][_0x7634('0x8d')];}return _0x59265a['update'](_0xa8fb34);}else{return _0x59265a;}}})[_0x7634('0x31')](function(_0x114d91){_0x32621c['interaction']=_0x114d91['get']({'plain':!![]});_0x32621c[_0x7634('0x8e')][_0x7634('0x8f')]=_0x1aa2cf;if(_0x32621c[_0x7634('0x8e')][_0x7634('0x8f')]){if(_0x32621c['account']['autoclose']){_0x32621c[_0x7634('0x80')][_0x7634('0x90')]({'id':0x0,'priority':_0x32621c['applications'][_0x7634('0x46')]+0x1,'app':_0x7634('0x91'),'appdata':_0x7634('0x92'),'interval':_0x7634('0x93')});}}return db[_0x7634('0x94')][_0x7634('0x58')]({'body':_0x5e9039[_0x7634('0x59')][_0x7634('0x59')],'OpenchannelAccountId':_0x5e9039[_0x7634('0x60')]['id'],'OpenchannelInteractionId':_0x114d91['id'],'direction':'in','ContactId':_0x32621c['contact']['id'],'AttachmentId':_0x5e9039[_0x7634('0x59')]['AttachmentId']});})[_0x7634('0x31')](function(_0x15f28f){_0x32621c[_0x7634('0x24')]=_0x15f28f;if(!_0x32621c['interaction']['UserId'])return;return db[_0x7634('0x95')][_0x7634('0x57')]({'attributes':['id',_0x7634('0x38')],'where':{'id':_0x32621c[_0x7634('0x8e')][_0x7634('0x96')]}});})[_0x7634('0x31')](function(_0x27d2c1){if(_0x27d2c1){_0x32621c[_0x7634('0x80')][_0x7634('0x97')]({'id':0x0,'priority':0x0,'app':_0x7634('0x98'),'appdata':_0x27d2c1[_0x7634('0x38')]+','+(_0x32621c['account'][_0x7634('0x99')]||0xa),'interval':'*,*,*,*'});}if(!_0x32621c[_0x7634('0x8e')]['queueId'])return;return db[_0x7634('0x9a')]['find']({'attributes':['id',_0x7634('0x38')],'where':{'id':_0x32621c[_0x7634('0x8e')]['queueId']}});})[_0x7634('0x31')](function(_0x2ddada){if(_0x2ddada){_0x32621c[_0x7634('0x80')][_0x7634('0x97')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2ddada['name']+','+(_0x32621c[_0x7634('0x85')][_0x7634('0x9b')]||0x12c),'interval':_0x7634('0x93')});}return respondWithRpcPromise(_0x7634('0x9c'),'startRouting',_0x32621c);})[_0x7634('0x31')](function(_0x482d54){respondWithRpcPromise('EventManager',_0x7634('0x9d'),{'event':_0x7634('0x6c'),'message':_0x482d54},client9002);return _0x482d54;})[_0x7634('0x31')](respondWithResult(_0x55170c,null))[_0x7634('0x25')](handleError(_0x55170c,null));};exports[_0x7634('0x9e')]=function(_0x182ac4,_0x2e7674){var _0x41b21e=_0x182ac4[_0x7634('0x60')]['id'];var _0x1d0fb6=_0x182ac4[_0x7634('0x59')];var _0x422a05=0xc8;var _0x4546ed=null;return db[_0x7634('0x9f')][_0x7634('0xa0')]({'isolationLevel':db[_0x7634('0x9f')][_0x7634('0xa1')][_0x7634('0xa2')][_0x7634('0xa3')]},function(_0x505597){return db[_0x7634('0x54')]['findOne']({'where':{'id':_0x41b21e},'transaction':_0x505597})[_0x7634('0x31')](function(_0x225781){if(_0x225781){return db[_0x7634('0x7e')][_0x7634('0x32')]({'where':{'OpenchannelAccountId':_0x41b21e},'transaction':_0x505597})['then'](function(){var _0x4b4bde=_[_0x7634('0x3c')](_0x1d0fb6,function(_0x5b63af){_0x5b63af[_0x7634('0x6a')]=_0x41b21e;return _0x5b63af;});return db['OpenchannelApplication'][_0x7634('0xa4')](_0x4b4bde,{'transaction':_0x505597});});}else{_0x422a05=0x194;_0x4546ed=[];}});})[_0x7634('0x31')](function(){if(_0x422a05!==0x194){return db[_0x7634('0x7e')][_0x7634('0xa5')]({'where':{'OpenchannelAccountId':_0x41b21e},'order':_0x7634('0x83')})[_0x7634('0x31')](function(_0x44702d){_0x4546ed=_0x44702d;});}})[_0x7634('0x25')](function(_0x39e5e5){_0x422a05=0x1f4;logger['error'](_0x39e5e5[_0x7634('0x37')]);if(_0x39e5e5[_0x7634('0x38')]){delete _0x39e5e5[_0x7634('0x38')];}_0x4546ed=_0x39e5e5;})[_0x7634('0xa6')](function(){if(_0x4546ed===null){_0x2e7674[_0x7634('0x26')](_0x422a05);}else{if(_0x422a05===0x1f4){_0x2e7674[_0x7634('0x27')](_0x422a05)[_0x7634('0x39')](_0x4546ed);}else{_0x2e7674[_0x7634('0x27')](_0x422a05)[_0x7634('0x28')](_0x4546ed);}}});};exports[_0x7634('0xa7')]=function(_0x1b664d,_0x520381,_0x1c4476){var _0x275a6e={};var _0x4dbe4a={};var _0x3d4049;var _0x886bd8;return db[_0x7634('0x54')][_0x7634('0xa8')]({'where':{'id':_0x1b664d['params']['id']}})['then'](handleEntityNotFound(_0x520381,null))[_0x7634('0x31')](function(_0x3e0702){if(_0x3e0702){_0x3d4049=_0x3e0702;_0x4dbe4a['model']=_['keys'](db[_0x7634('0x7e')]['rawAttributes']);_0x4dbe4a[_0x7634('0x41')]=_[_0x7634('0x42')](_0x1b664d[_0x7634('0x41')]);_0x4dbe4a[_0x7634('0x43')]=_['intersection'](_0x4dbe4a[_0x7634('0x40')],_0x4dbe4a[_0x7634('0x41')]);_0x275a6e[_0x7634('0x44')]=_['intersection'](_0x4dbe4a[_0x7634('0x40')],qs[_0x7634('0x56')](_0x1b664d[_0x7634('0x41')][_0x7634('0x56')]));_0x275a6e[_0x7634('0x44')]=_0x275a6e[_0x7634('0x44')][_0x7634('0x46')]?_0x275a6e[_0x7634('0x44')]:_0x4dbe4a[_0x7634('0x40')];_0x275a6e[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0x1b664d[_0x7634('0x41')]['sort']);_0x275a6e[_0x7634('0x4b')]=qs['filters'](_[_0x7634('0x4c')](_0x1b664d[_0x7634('0x41')],_0x4dbe4a[_0x7634('0x43')]));if(_0x1b664d[_0x7634('0x41')]['filter']){_0x275a6e[_0x7634('0x4b')]=_[_0x7634('0x50')](_0x275a6e['where'],{'$or':_[_0x7634('0x3c')](_0x275a6e[_0x7634('0x44')],function(_0x22cecc){var _0x155f69={};_0x155f69[_0x22cecc]={'$like':'%'+_0x1b664d['query'][_0x7634('0x4d')]+'%'};return _0x155f69;})});}_0x275a6e=_[_0x7634('0x50')]({},_0x275a6e,_0x1b664d['options']);return _0x3d4049[_0x7634('0xa7')](_0x275a6e);}})[_0x7634('0x31')](function(_0x22a324){if(_0x22a324){_0x886bd8=_0x22a324[_0x7634('0x46')];if(!_0x1b664d[_0x7634('0x41')][_0x7634('0x47')](_0x7634('0x48'))){_0x275a6e['limit']=qs[_0x7634('0x2b')](_0x1b664d[_0x7634('0x41')][_0x7634('0x2b')]);_0x275a6e[_0x7634('0x29')]=qs[_0x7634('0x29')](_0x1b664d['query'][_0x7634('0x29')]);}return _0x3d4049['getApplications'](_0x275a6e);}})[_0x7634('0x31')](function(_0x3a9645){if(_0x3a9645){return _0x3a9645?{'count':_0x886bd8,'rows':_0x3a9645}:null;}})[_0x7634('0x31')](respondWithResult(_0x520381,null))['catch'](handleError(_0x520381,null));};exports['getInteractions']=function(_0xde5890,_0x10f50d,_0x2a947f){var _0x3db890={'raw':![],'where':{}};var _0x36d2a1={};var _0x31bd8a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7634('0xa8')]({'where':{'id':_0xde5890[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x10f50d,null))[_0x7634('0x31')](function(_0x38a67d){if(_0x38a67d){_0x36d2a1[_0x7634('0x40')]=_[_0x7634('0x42')](db[_0x7634('0x8a')]['rawAttributes']);_0x36d2a1[_0x7634('0x41')]=_[_0x7634('0x42')](_0xde5890[_0x7634('0x41')]);_0x36d2a1[_0x7634('0x43')]=_[_0x7634('0x45')](_0x36d2a1[_0x7634('0x40')],_0x36d2a1[_0x7634('0x41')]);_0x3db890['attributes']=_['intersection'](_0x36d2a1[_0x7634('0x40')],qs['fields'](_0xde5890[_0x7634('0x41')][_0x7634('0x56')]));_0x3db890[_0x7634('0x44')]=_0x3db890[_0x7634('0x44')][_0x7634('0x46')]?_0x3db890['attributes']:_0x36d2a1[_0x7634('0x40')];if(!_0xde5890[_0x7634('0x41')][_0x7634('0x47')](_0x7634('0x48'))){_0x3db890['limit']=qs['limit'](_0xde5890[_0x7634('0x41')][_0x7634('0x2b')]);_0x3db890[_0x7634('0x29')]=qs[_0x7634('0x29')](_0xde5890[_0x7634('0x41')]['offset']);}_0x3db890[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0xde5890[_0x7634('0x41')][_0x7634('0x4a')]);_0x3db890[_0x7634('0x4b')]=qs[_0x7634('0x43')](_[_0x7634('0x4c')](_0xde5890[_0x7634('0x41')],_0x36d2a1['filters']));_0x3db890['where'][_0x7634('0x6a')]=_0x38a67d['id'];if(_0xde5890[_0x7634('0x41')][_0x7634('0x4d')]){_0x3db890[_0x7634('0x4b')]=_[_0x7634('0x50')](_0x3db890[_0x7634('0x4b')],{'$or':_[_0x7634('0x3c')](_0x3db890[_0x7634('0x44')],function(_0x537b5e){var _0xbf61b8={};_0xbf61b8[_0x537b5e]={'$like':'%'+_0xde5890['query'][_0x7634('0x4d')]+'%'};return _0xbf61b8;})});}_0x3db890=_['merge']({},_0x3db890,_0xde5890['options']);return db[_0x7634('0x8a')][_0x7634('0x2c')]({'where':_0x3db890['where']})[_0x7634('0x31')](function(_0x52c396){_0x31bd8a[_0x7634('0x2c')]=_0x52c396;if(_0xde5890[_0x7634('0x41')][_0x7634('0x52')]){_0x3db890[_0x7634('0x53')]=[{'model':db['CmContact'],'as':_0x7634('0xa9'),'required':![]},{'model':db[_0x7634('0x95')],'as':_0x7634('0xaa'),'attributes':[_0x7634('0x38'),_0x7634('0xab'),_0x7634('0xac')],'required':![]},{'model':db[_0x7634('0xad')],'as':_0x7634('0xae'),'attributes':['id',_0x7634('0x38'),'color'],'where':_0xde5890[_0x7634('0x41')][_0x7634('0xaf')]?{'id':_0xde5890[_0x7634('0x41')][_0x7634('0xaf')]}:undefined,'required':_0xde5890['query'][_0x7634('0xaf')]?!![]:![]}];}return db[_0x7634('0x8a')][_0x7634('0xb0')](_0x3db890);})['then'](function(_0x228366){_0x31bd8a[_0x7634('0x55')]=_0x228366;return _0x31bd8a;});}})['then'](respondWithFilteredResult(_0x10f50d,_0x3db890))[_0x7634('0x25')](handleError(_0x10f50d,null));};exports[_0x7634('0xb1')]=function(_0x40cb86,_0x4965c2,_0x55a747){return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x40cb86['params']['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x4965c2,null))['then'](function(_0x39b36c){if(_0x39b36c){return _0x39b36c['addAgents'](_0x40cb86[_0x7634('0x59')][_0x7634('0x66')],_[_0x7634('0xb2')](_0x40cb86[_0x7634('0x59')],[_0x7634('0x66'),'id'])||{})[_0x7634('0xb3')](function(_0x5c9cc5){for(var _0x27f3c1=0x0;_0x27f3c1<_0x40cb86[_0x7634('0x59')]['ids'][_0x7634('0x46')];_0x27f3c1+=0x1){socket[_0x7634('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x40cb86[_0x7634('0x59')][_0x7634('0x66')][_0x27f3c1]),'OpenchannelAccountId':Number(_0x40cb86[_0x7634('0x60')]['id'])});}return _0x5c9cc5;});}})[_0x7634('0x31')](respondWithResult(_0x4965c2,null))[_0x7634('0x25')](handleError(_0x4965c2,null));};exports['removeAgents']=function(_0x31d1bc,_0x1dfd0e,_0xbd923b){return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x31d1bc[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x1dfd0e,null))[_0x7634('0x31')](function(_0x140501){if(_0x140501){return _0x140501[_0x7634('0xb5')](_0x31d1bc[_0x7634('0x41')][_0x7634('0x66')])[_0x7634('0x31')](function(){if(_[_0x7634('0xb6')](_0x31d1bc['query'][_0x7634('0x66')])){for(var _0x56eecf=0x0;_0x56eecf<_0x31d1bc[_0x7634('0x41')]['ids'][_0x7634('0x46')];_0x56eecf+=0x1){socket['emit'](_0x7634('0xb7'),{'UserId':Number(_0x31d1bc['query'][_0x7634('0x66')][_0x56eecf]),'OpenchannelAccountId':Number(_0x31d1bc[_0x7634('0x60')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x31d1bc[_0x7634('0x41')][_0x7634('0x66')]),'OpenchannelAccountId':Number(_0x31d1bc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1dfd0e,null))[_0x7634('0x25')](handleError(_0x1dfd0e,null));};exports[_0x7634('0xb8')]=function(_0x5ba12f,_0x54e70c,_0x397c31){var _0x4b9e24={};var _0x5afa6={};var _0x1de467;var _0x449b04;return db[_0x7634('0x54')][_0x7634('0xa8')]({'where':{'id':_0x5ba12f['params']['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x54e70c,null))[_0x7634('0x31')](function(_0x5ecd8c){if(_0x5ecd8c){_0x1de467=_0x5ecd8c;_0x5afa6['model']=_[_0x7634('0x42')](db['User']['rawAttributes']);_0x5afa6[_0x7634('0x41')]=_[_0x7634('0x42')](_0x5ba12f[_0x7634('0x41')]);_0x5afa6['filters']=_['intersection'](_0x5afa6[_0x7634('0x40')],_0x5afa6[_0x7634('0x41')]);_0x4b9e24[_0x7634('0x44')]=_['intersection'](_0x5afa6[_0x7634('0x40')],qs['fields'](_0x5ba12f[_0x7634('0x41')][_0x7634('0x56')]));_0x4b9e24[_0x7634('0x44')]=_0x4b9e24[_0x7634('0x44')][_0x7634('0x46')]?_0x4b9e24[_0x7634('0x44')]:_0x5afa6['model'];_0x4b9e24[_0x7634('0x49')]=qs[_0x7634('0x4a')](_0x5ba12f[_0x7634('0x41')][_0x7634('0x4a')]);_0x4b9e24[_0x7634('0x4b')]=qs[_0x7634('0x43')](_['pick'](_0x5ba12f[_0x7634('0x41')],_0x5afa6[_0x7634('0x43')]));if(_0x5ba12f[_0x7634('0x41')][_0x7634('0x4d')]){_0x4b9e24[_0x7634('0x4b')]=_[_0x7634('0x50')](_0x4b9e24['where'],{'$or':_[_0x7634('0x3c')](_0x4b9e24['attributes'],function(_0x594036){var _0x1ba181={};_0x1ba181[_0x594036]={'$like':'%'+_0x5ba12f[_0x7634('0x41')]['filter']+'%'};return _0x1ba181;})});}_0x4b9e24=_[_0x7634('0x50')]({},_0x4b9e24,_0x5ba12f[_0x7634('0x51')]);return _0x1de467[_0x7634('0xb8')](_0x4b9e24);}})['then'](function(_0x1eff3d){if(_0x1eff3d){_0x449b04=_0x1eff3d[_0x7634('0x46')];if(!_0x5ba12f[_0x7634('0x41')][_0x7634('0x47')]('nolimit')){_0x4b9e24[_0x7634('0x2b')]=qs['limit'](_0x5ba12f[_0x7634('0x41')][_0x7634('0x2b')]);_0x4b9e24[_0x7634('0x29')]=qs['offset'](_0x5ba12f[_0x7634('0x41')][_0x7634('0x29')]);}return _0x1de467[_0x7634('0xb8')](_0x4b9e24);}})['then'](function(_0x32cd27){if(_0x32cd27){return _0x32cd27?{'count':_0x449b04,'rows':_0x32cd27}:null;}})[_0x7634('0x31')](respondWithResult(_0x54e70c,null))[_0x7634('0x25')](handleError(_0x54e70c,null));};exports[_0x7634('0x39')]=function(_0x39537d,_0x2bf7b8,_0x5bf511){var _0x1e27f5,_0x46ed50,_0x2da48c;if(_[_0x7634('0x77')](_0x39537d[_0x7634('0x59')][_0x7634('0x59')])||_0x39537d[_0x7634('0x59')][_0x7634('0x59')]===''){throw new db[(_0x7634('0x6f'))][(_0x7634('0x70'))](_0x7634('0x78'));}if(_[_0x7634('0x77')](_0x39537d[_0x7634('0x59')]['to'])){}_0x1e27f5=_0x39537d[_0x7634('0x59')]['to'];return db['OpenchannelAccount'][_0x7634('0xa8')]({'where':{'id':_0x39537d[_0x7634('0x60')]['id']}})[_0x7634('0x31')](handleEntityNotFound(_0x2bf7b8,null))[_0x7634('0x31')](function(_0x207c7e){if(_0x207c7e){return db[_0x7634('0x54')][_0x7634('0x57')]({'where':{'id':_0x207c7e['id']},'include':[{'model':db['CmList'],'as':_0x7634('0x81'),'include':[{'model':db[_0x7634('0x6e')],'as':_0x7634('0x7c'),'where':{[_0x207c7e[_0x7634('0x79')]]:_0x1e27f5},'limit':0x1,'order':[['updatedAt',_0x7634('0x7d')]]}]}]})[_0x7634('0x31')](handleEntityNotFound(_0x2bf7b8,null))[_0x7634('0x31')](function(_0x3f282f){if(_0x3f282f&&_0x3f282f['List']){_0x46ed50=_0x3f282f[_0x7634('0x33')]({'plain':!![]});if(_0x46ed50['List']&&_0x46ed50[_0x7634('0x81')][_0x7634('0x7c')][_0x7634('0x46')]){return _0x46ed50[_0x7634('0x81')][_0x7634('0x7c')][0x0];}return db[_0x7634('0x6e')][_0x7634('0x58')](_['defaults'](_0x39537d[_0x7634('0x59')],{'firstName':_0x1e27f5,[_0x3f282f[_0x7634('0x79')]]:_0x1e27f5,'phone':_0x1e27f5,'ListId':_0x46ed50['ListId']}));}})[_0x7634('0x31')](handleEntityNotFound(_0x2bf7b8,null))[_0x7634('0x31')](function(_0x42bf7d){if(_0x42bf7d){_0x2da48c=_0x42bf7d;return db[_0x7634('0x8a')][_0x7634('0x57')]({'where':{'ContactId':_0x2da48c['id'],'closed':![],'OpenchannelAccountId':_0x46ed50['id']}})[_0x7634('0x31')](function(_0x33a22f){if(_0x33a22f){return[_0x33a22f,![]];}return db[_0x7634('0x8a')][_0x7634('0x58')]({'UserId':_0x39537d['user']['id'],'ContactId':_0x2da48c['id'],'OpenchannelAccountId':_0x46ed50['id'],'lastMsgDirection':_0x7634('0xb9'),'firstMsgDirection':_0x7634('0xb9'),'Messages':[_['merge'](_0x39537d[_0x7634('0x59')],{'read':![],'body':_0x39537d[_0x7634('0x59')]['body'],'OpenchannelAccountId':_0x46ed50['id'],'UserId':_0x39537d[_0x7634('0x5a')]['id'],'ContactId':_0x2da48c['id']})]},{'include':[{'model':db[_0x7634('0x94')],'as':_0x7634('0xba')}]})[_0x7634('0x31')](function(_0x1244de){return[_0x1244de,!![]];});});}})[_0x7634('0xb3')](function(_0x3078b5,_0x317b9f){if(_0x317b9f){return _0x3078b5;}return db[_0x7634('0x94')]['create'](_[_0x7634('0x50')](_0x39537d['body'],{'read':![],'body':_0x39537d[_0x7634('0x59')][_0x7634('0x59')],'OpenchannelAccountId':_0x46ed50['id'],'OpenchannelInteractionId':_0x3078b5['id'],'UserId':_0x39537d[_0x7634('0x5a')]['id'],'ContactId':_0x2da48c['id']}))[_0x7634('0x31')](function(_0x20b50b){_0x3078b5[_0x7634('0xbb')][_0x7634('0xba')]=[];_0x3078b5[_0x7634('0xbb')][_0x7634('0xba')][_0x7634('0x90')](_0x20b50b[_0x7634('0xbb')]);return _0x3078b5;});});}})['then'](respondWithResult(_0x2bf7b8,null))['catch'](handleError(_0x2bf7b8,null));}; \ No newline at end of file +var _0x5322=['CompanyId','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','applications','list','asc','account','from','ListId','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','getApplications','internal','Tags','color','tag','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','get','UserProfileResource','destroy','end','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','params','Pause','find','create','body','user','OpenchannelAccounts','UserProfileSection','autoAssociation','describe','Disposition','findAll','removeDispositions','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0x5322,0xff));var _0x2532=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x5322[_0x2c18a8];return _0x1e009a;};'use strict';var emlformat=require(_0x2532('0x0'));var rimraf=require(_0x2532('0x1'));var zipdir=require(_0x2532('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2532('0x3'));var moment=require(_0x2532('0x4'));var BPromise=require(_0x2532('0x5'));var Mustache=require(_0x2532('0x6'));var util=require('util');var path=require(_0x2532('0x7'));var sox=require(_0x2532('0x8'));var csv=require(_0x2532('0x9'));var ejs=require(_0x2532('0xa'));var fs=require('fs');var fs_extra=require(_0x2532('0xb'));var _=require(_0x2532('0xc'));var squel=require('squel');var crypto=require(_0x2532('0xd'));var jsforce=require(_0x2532('0xe'));var deskjs=require(_0x2532('0xf'));var toCsv=require(_0x2532('0x9'));var querystring=require(_0x2532('0x10'));var Papa=require(_0x2532('0x11'));var Redis=require('ioredis');var authService=require(_0x2532('0x12'));var qs=require(_0x2532('0x13'));var as=require(_0x2532('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2532('0x15'))(_0x2532('0x16'));var utils=require(_0x2532('0x17'));var config=require(_0x2532('0x18'));var licenseUtil=require(_0x2532('0x19'));var db=require(_0x2532('0x1a'))['db'];config[_0x2532('0x1b')]=_[_0x2532('0x1c')](config[_0x2532('0x1b')],{'host':_0x2532('0x1d'),'port':0x18eb});var socket=require(_0x2532('0x1e'))(new Redis(config[_0x2532('0x1b')]));require(_0x2532('0x1f'))[_0x2532('0x20')](socket);var jayson=require(_0x2532('0x21'));var client=jayson['client'][_0x2532('0x22')]({'port':0x232c});var client9002=jayson[_0x2532('0x23')][_0x2532('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4d07da,_0xecfd99,_0x3d41f1,_0x249021){return new BPromise(function(_0xe0f10c,_0x4fb0a9){var _0x106300=_0x249021||client;return _0x106300['request'](_0x4d07da,_0x3d41f1)[_0x2532('0x24')](function(_0x34f77e){logger[_0x2532('0x25')](_0x2532('0x26'),_0xecfd99,_0x2532('0x27'));logger[_0x2532('0x28')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xecfd99,_0x2532('0x27'),JSON[_0x2532('0x29')](_0x34f77e));if(_0x34f77e[_0x2532('0x2a')]){if(_0x34f77e[_0x2532('0x2a')]['code']===0x1f4){logger[_0x2532('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0xecfd99,_0x34f77e[_0x2532('0x2a')]['message']);return _0x4fb0a9(_0x34f77e[_0x2532('0x2a')][_0x2532('0x2b')]);}logger['error'](_0x2532('0x26'),_0xecfd99,_0x34f77e[_0x2532('0x2a')][_0x2532('0x2b')]);return _0xe0f10c(_0x34f77e[_0x2532('0x2a')]['message']);}else{logger[_0x2532('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0xecfd99,'request\x20sent');_0xe0f10c(_0x34f77e[_0x2532('0x2c')][_0x2532('0x2b')]);}})[_0x2532('0x2d')](function(_0x49d061){logger[_0x2532('0x2a')](_0x2532('0x26'),_0xecfd99,_0x49d061);_0x4fb0a9(_0x49d061);});});}function respondWithStatusCode(_0x5d16ac,_0x5514e8){_0x5514e8=_0x5514e8||0xcc;return function(_0x232cec){if(_0x232cec){return _0x5d16ac[_0x2532('0x2e')](_0x5514e8);}return _0x5d16ac[_0x2532('0x2f')](_0x5514e8)['end']();};}function respondWithResult(_0x449809,_0x585206){_0x585206=_0x585206||0xc8;return function(_0xc7831a){if(_0xc7831a){return _0x449809[_0x2532('0x2f')](_0x585206)[_0x2532('0x30')](_0xc7831a);}};}function respondWithFilteredResult(_0x2f134f,_0x26dcc1){return function(_0x594320){if(_0x594320){var _0x17c64a=typeof _0x26dcc1[_0x2532('0x31')]==='undefined'&&typeof _0x26dcc1[_0x2532('0x32')]==='undefined';var _0x496520=_0x594320[_0x2532('0x33')];var _0x4a9ae9=_0x17c64a?0x0:_0x26dcc1[_0x2532('0x31')];var _0x211940=_0x17c64a?_0x594320[_0x2532('0x33')]:_0x26dcc1[_0x2532('0x31')]+_0x26dcc1[_0x2532('0x32')];var _0x204759;if(_0x211940>=_0x496520){_0x211940=_0x496520;_0x204759=0xc8;}else{_0x204759=0xce;}_0x2f134f[_0x2532('0x2f')](_0x204759);return _0x2f134f[_0x2532('0x34')](_0x2532('0x35'),_0x4a9ae9+'-'+_0x211940+'/'+_0x496520)[_0x2532('0x30')](_0x594320);}return null;};}function patchUpdates(_0x46d708){return function(_0x5877d4){try{jsonpatch['apply'](_0x5877d4,_0x46d708,!![]);}catch(_0x1002c1){return BPromise[_0x2532('0x36')](_0x1002c1);}return _0x5877d4['save']();};}function saveUpdates(_0x28104e,_0x4bf2bb){return function(_0x28c2c9){if(_0x28c2c9){return _0x28c2c9[_0x2532('0x37')](_0x28104e)['then'](function(_0x506791){return _0x506791;});}return null;};}function removeEntity(_0x5e8881,_0x2149c9){return function(_0x335c23){if(_0x335c23){return _0x335c23['destroy']()[_0x2532('0x24')](function(){var _0x5abfe9=_0x335c23[_0x2532('0x38')]({'plain':!![]});var _0x5bad13='OpenchannelAccounts';return db[_0x2532('0x39')][_0x2532('0x3a')]({'where':{'type':_0x5bad13,'resourceId':_0x5abfe9['id']}})[_0x2532('0x24')](function(){return _0x335c23;});})[_0x2532('0x24')](function(){_0x5e8881[_0x2532('0x2f')](0xcc)[_0x2532('0x3b')]();});}};}function handleEntityNotFound(_0x1c5a5b,_0x29f669){return function(_0x37cf16){if(!_0x37cf16){_0x1c5a5b[_0x2532('0x2e')](0x194);}return _0x37cf16;};}function handleError(_0x69cab9,_0x23343d){_0x23343d=_0x23343d||0x1f4;return function(_0x579bf6){logger[_0x2532('0x2a')](_0x579bf6[_0x2532('0x3c')]);if(_0x579bf6['name']){delete _0x579bf6[_0x2532('0x3d')];}_0x69cab9[_0x2532('0x2f')](_0x23343d)[_0x2532('0x3e')](_0x579bf6);};}exports['index']=function(_0x35ae1d,_0x824412){var _0x1ffed6={'include':[{'model':db['Pause'],'as':_0x2532('0x3f')}]},_0x120649={},_0x3feedc={'count':0x0,'rows':[]};var _0xd05a61=_[_0x2532('0x40')](db[_0x2532('0x41')][_0x2532('0x42')],function(_0x3dbe9e){return{'name':_0x3dbe9e[_0x2532('0x43')],'type':_0x3dbe9e[_0x2532('0x44')][_0x2532('0x45')]};});_0x120649['model']=_[_0x2532('0x40')](_0xd05a61,_0x2532('0x3d'));_0x120649[_0x2532('0x46')]=_[_0x2532('0x47')](_0x35ae1d[_0x2532('0x46')]);_0x120649['filters']=_[_0x2532('0x48')](_0x120649[_0x2532('0x49')],_0x120649[_0x2532('0x46')]);_0x1ffed6[_0x2532('0x4a')]=_[_0x2532('0x48')](_0x120649['model'],qs[_0x2532('0x4b')](_0x35ae1d['query'][_0x2532('0x4b')]));_0x1ffed6[_0x2532('0x4a')]=_0x1ffed6['attributes'][_0x2532('0x4c')]?_0x1ffed6[_0x2532('0x4a')]:_0x120649[_0x2532('0x49')];if(!_0x35ae1d[_0x2532('0x46')][_0x2532('0x4d')](_0x2532('0x4e'))){_0x1ffed6[_0x2532('0x32')]=qs[_0x2532('0x32')](_0x35ae1d['query'][_0x2532('0x32')]);_0x1ffed6[_0x2532('0x31')]=qs[_0x2532('0x31')](_0x35ae1d[_0x2532('0x46')]['offset']);}_0x1ffed6[_0x2532('0x4f')]=qs[_0x2532('0x50')](_0x35ae1d['query'][_0x2532('0x50')]);_0x1ffed6[_0x2532('0x51')]=qs['filters'](_[_0x2532('0x52')](_0x35ae1d[_0x2532('0x46')],_0x120649[_0x2532('0x53')]),_0xd05a61);if(_0x35ae1d[_0x2532('0x46')][_0x2532('0x54')]){_0x1ffed6[_0x2532('0x51')]=_[_0x2532('0x55')](_0x1ffed6['where'],{'$or':_[_0x2532('0x40')](_0xd05a61,function(_0x1251d6){if(_0x1251d6[_0x2532('0x44')]!==_0x2532('0x56')){var _0x52dec0={};_0x52dec0[_0x1251d6['name']]={'$like':'%'+_0x35ae1d['query']['filter']+'%'};return _0x52dec0;}})});}_0x1ffed6=_[_0x2532('0x55')]({},_0x1ffed6,_0x35ae1d[_0x2532('0x57')]);var _0x2a483a={'where':_0x1ffed6['where']};return db[_0x2532('0x41')][_0x2532('0x33')](_0x2a483a)[_0x2532('0x24')](function(_0x2d6374){_0x3feedc[_0x2532('0x33')]=_0x2d6374;if(_0x35ae1d[_0x2532('0x46')][_0x2532('0x58')]){_0x1ffed6[_0x2532('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x1ffed6);})[_0x2532('0x24')](function(_0x2e7e53){_0x3feedc[_0x2532('0x5a')]=_0x2e7e53;return _0x3feedc;})[_0x2532('0x24')](respondWithFilteredResult(_0x824412,_0x1ffed6))[_0x2532('0x2d')](handleError(_0x824412,null));};exports['show']=function(_0x56ea7c,_0x28da55){var _0x10a3e1={'raw':![],'where':{'id':_0x56ea7c[_0x2532('0x5b')]['id']},'include':[{'model':db[_0x2532('0x5c')],'as':_0x2532('0x3f')}]},_0x41ca93={};_0x41ca93[_0x2532('0x49')]=_[_0x2532('0x47')](db[_0x2532('0x41')][_0x2532('0x42')]);_0x41ca93[_0x2532('0x46')]=_['keys'](_0x56ea7c['query']);_0x41ca93[_0x2532('0x53')]=_[_0x2532('0x48')](_0x41ca93[_0x2532('0x49')],_0x41ca93[_0x2532('0x46')]);_0x10a3e1[_0x2532('0x4a')]=_[_0x2532('0x48')](_0x41ca93[_0x2532('0x49')],qs[_0x2532('0x4b')](_0x56ea7c['query'][_0x2532('0x4b')]));_0x10a3e1['attributes']=_0x10a3e1[_0x2532('0x4a')][_0x2532('0x4c')]?_0x10a3e1[_0x2532('0x4a')]:_0x41ca93['model'];if(_0x56ea7c[_0x2532('0x46')][_0x2532('0x58')]){_0x10a3e1[_0x2532('0x59')]=[{'all':!![]}];}_0x10a3e1=_[_0x2532('0x55')]({},_0x10a3e1,_0x56ea7c[_0x2532('0x57')]);return db['OpenchannelAccount'][_0x2532('0x5d')](_0x10a3e1)[_0x2532('0x24')](handleEntityNotFound(_0x28da55,null))[_0x2532('0x24')](respondWithResult(_0x28da55,null))[_0x2532('0x2d')](handleError(_0x28da55,null));};exports[_0x2532('0x5e')]=function(_0x5d79e3,_0x1bf3b1){return db[_0x2532('0x41')][_0x2532('0x5e')](_0x5d79e3[_0x2532('0x5f')],{})[_0x2532('0x24')](function(_0xc70dc7){var _0x33a168=_0x5d79e3[_0x2532('0x60')][_0x2532('0x38')]({'plain':!![]});if(!_0x33a168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33a168['role']===_0x2532('0x60')){var _0x3d9731=_0xc70dc7[_0x2532('0x38')]({'plain':!![]});var _0x23a63b=_0x2532('0x61');return db[_0x2532('0x62')][_0x2532('0x5d')]({'where':{'name':_0x23a63b,'userProfileId':_0x33a168['userProfileId']},'raw':!![]})[_0x2532('0x24')](function(_0x4e789d){if(_0x4e789d&&_0x4e789d[_0x2532('0x63')]===0x0){return db[_0x2532('0x39')][_0x2532('0x5e')]({'name':_0x3d9731[_0x2532('0x3d')],'resourceId':_0x3d9731['id'],'type':_0x4e789d['name'],'sectionId':_0x4e789d['id']},{})[_0x2532('0x24')](function(){return _0xc70dc7;});}else{return _0xc70dc7;}})[_0x2532('0x2d')](function(_0x40a5c5){logger[_0x2532('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40a5c5);throw _0x40a5c5;});}return _0xc70dc7;})['then'](respondWithResult(_0x1bf3b1,0xc9))[_0x2532('0x2d')](handleError(_0x1bf3b1,null));};exports[_0x2532('0x37')]=function(_0x3df239,_0x47240f){if(_0x3df239[_0x2532('0x5f')]['id']){delete _0x3df239[_0x2532('0x5f')]['id'];}return db[_0x2532('0x41')][_0x2532('0x5d')]({'where':{'id':_0x3df239[_0x2532('0x5b')]['id']},'include':[{'model':db[_0x2532('0x5c')],'as':_0x2532('0x3f')}]})[_0x2532('0x24')](handleEntityNotFound(_0x47240f,null))[_0x2532('0x24')](saveUpdates(_0x3df239[_0x2532('0x5f')],null))[_0x2532('0x24')](respondWithResult(_0x47240f,null))[_0x2532('0x2d')](handleError(_0x47240f,null));};exports[_0x2532('0x3a')]=function(_0x1bb71e,_0xd72a62){return db[_0x2532('0x41')]['find']({'where':{'id':_0x1bb71e[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd72a62,null))[_0x2532('0x24')](removeEntity(_0xd72a62,null))[_0x2532('0x2d')](handleError(_0xd72a62,null));};exports[_0x2532('0x64')]=function(_0xf1ae59,_0x391cfa){return db[_0x2532('0x41')][_0x2532('0x64')]()['then'](respondWithResult(_0x391cfa,null))[_0x2532('0x2d')](handleError(_0x391cfa,null));};exports['addDisposition']=function(_0x19e6b7,_0x1408f2,_0x235abf){if(_0x19e6b7[_0x2532('0x5f')]['id']){delete _0x19e6b7[_0x2532('0x5f')]['id'];}return db[_0x2532('0x41')][_0x2532('0x5d')]({'where':{'id':_0x19e6b7[_0x2532('0x5b')]['id']}})[_0x2532('0x24')](handleEntityNotFound(_0x1408f2,null))[_0x2532('0x24')](function(_0x4fd33f){if(_0x4fd33f){_0x19e6b7[_0x2532('0x5f')]['OpenchannelAccountId']=_0x4fd33f['id'];return db[_0x2532('0x65')]['create'](_0x19e6b7['body']);}})['then'](respondWithResult(_0x1408f2,null))[_0x2532('0x2d')](handleError(_0x1408f2,null));};exports['getDispositions']=function(_0x586713,_0x7bcad0,_0x1abdf9){var _0x7c8b54={'raw':![],'where':{}};var _0x3a6661={};var _0x2c0224={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x586713[_0x2532('0x5b')]['id']}})[_0x2532('0x24')](handleEntityNotFound(_0x7bcad0,null))['then'](function(_0x13007a){if(_0x13007a){_0x3a6661[_0x2532('0x49')]=_[_0x2532('0x47')](db[_0x2532('0x65')][_0x2532('0x42')]);_0x3a6661['query']=_[_0x2532('0x47')](_0x586713[_0x2532('0x46')]);_0x3a6661[_0x2532('0x53')]=_[_0x2532('0x48')](_0x3a6661[_0x2532('0x49')],_0x3a6661['query']);_0x7c8b54[_0x2532('0x4a')]=_[_0x2532('0x48')](_0x3a6661[_0x2532('0x49')],qs[_0x2532('0x4b')](_0x586713[_0x2532('0x46')][_0x2532('0x4b')]));_0x7c8b54[_0x2532('0x4a')]=_0x7c8b54[_0x2532('0x4a')]['length']?_0x7c8b54['attributes']:_0x3a6661[_0x2532('0x49')];if(!_0x586713['query']['hasOwnProperty']('nolimit')){_0x7c8b54['limit']=qs[_0x2532('0x32')](_0x586713['query'][_0x2532('0x32')]);_0x7c8b54[_0x2532('0x31')]=qs[_0x2532('0x31')](_0x586713[_0x2532('0x46')][_0x2532('0x31')]);}_0x7c8b54[_0x2532('0x4f')]=qs[_0x2532('0x50')](_0x586713[_0x2532('0x46')][_0x2532('0x50')]);_0x7c8b54[_0x2532('0x51')]=qs[_0x2532('0x53')](_[_0x2532('0x52')](_0x586713[_0x2532('0x46')],_0x3a6661[_0x2532('0x53')]));_0x7c8b54['where']['OpenchannelAccountId']=_0x13007a['id'];if(_0x586713[_0x2532('0x46')][_0x2532('0x54')]){_0x7c8b54[_0x2532('0x51')]=_[_0x2532('0x55')](_0x7c8b54[_0x2532('0x51')],{'$or':_[_0x2532('0x40')](_0x7c8b54['attributes'],function(_0x22af67){var _0x15b4f3={};_0x15b4f3[_0x22af67]={'$like':'%'+_0x586713[_0x2532('0x46')]['filter']+'%'};return _0x15b4f3;})});}_0x7c8b54=_[_0x2532('0x55')]({},_0x7c8b54,_0x586713['options']);return db[_0x2532('0x65')]['count']({'where':_0x7c8b54[_0x2532('0x51')]})[_0x2532('0x24')](function(_0x42a70d){_0x2c0224['count']=_0x42a70d;if(_0x586713[_0x2532('0x46')][_0x2532('0x58')]){_0x7c8b54[_0x2532('0x59')]=[{'all':!![]}];}return db[_0x2532('0x65')][_0x2532('0x66')](_0x7c8b54);})[_0x2532('0x24')](function(_0x1e1bca){_0x2c0224['rows']=_0x1e1bca;return _0x2c0224;});}})[_0x2532('0x24')](respondWithFilteredResult(_0x7bcad0,_0x7c8b54))[_0x2532('0x2d')](handleError(_0x7bcad0,null));};exports[_0x2532('0x67')]=function(_0x17b057,_0x26d3da,_0x4b69b3){return db[_0x2532('0x41')][_0x2532('0x5d')]({'where':{'id':_0x17b057[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x26d3da,null))[_0x2532('0x24')](function(_0x32a866){if(_0x32a866){return _0x32a866[_0x2532('0x67')](_0x17b057[_0x2532('0x46')]['ids']);}})[_0x2532('0x24')](respondWithStatusCode(_0x26d3da,null))[_0x2532('0x2d')](handleError(_0x26d3da,null));};exports[_0x2532('0x68')]=function(_0x16a4fd,_0x12fd29,_0x171295){if(_0x16a4fd[_0x2532('0x5f')]['id']){delete _0x16a4fd[_0x2532('0x5f')]['id'];}return db[_0x2532('0x41')]['find']({'where':{'id':_0x16a4fd['params']['id']}})[_0x2532('0x24')](handleEntityNotFound(_0x12fd29,null))[_0x2532('0x24')](function(_0x356fd6){if(_0x356fd6){_0x16a4fd['body'][_0x2532('0x69')]=_0x356fd6['id'];return db[_0x2532('0x6a')][_0x2532('0x5e')](_0x16a4fd[_0x2532('0x5f')]);}})[_0x2532('0x24')](respondWithResult(_0x12fd29,null))[_0x2532('0x2d')](handleError(_0x12fd29,null));};exports[_0x2532('0x6b')]=function(_0x14f7df,_0x3258f0,_0x5ec49d){var _0x54da18={'raw':![],'where':{}};var _0x4b98fa={};var _0x189751={'count':0x0,'rows':[]};return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x14f7df[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3258f0,null))['then'](function(_0x19001a){if(_0x19001a){_0x4b98fa['model']=_['keys'](db['CannedAnswer'][_0x2532('0x42')]);_0x4b98fa[_0x2532('0x46')]=_[_0x2532('0x47')](_0x14f7df['query']);_0x4b98fa[_0x2532('0x53')]=_[_0x2532('0x48')](_0x4b98fa[_0x2532('0x49')],_0x4b98fa[_0x2532('0x46')]);_0x54da18[_0x2532('0x4a')]=_[_0x2532('0x48')](_0x4b98fa[_0x2532('0x49')],qs[_0x2532('0x4b')](_0x14f7df[_0x2532('0x46')][_0x2532('0x4b')]));_0x54da18[_0x2532('0x4a')]=_0x54da18[_0x2532('0x4a')][_0x2532('0x4c')]?_0x54da18[_0x2532('0x4a')]:_0x4b98fa[_0x2532('0x49')];if(!_0x14f7df['query'][_0x2532('0x4d')](_0x2532('0x4e'))){_0x54da18[_0x2532('0x32')]=qs[_0x2532('0x32')](_0x14f7df[_0x2532('0x46')][_0x2532('0x32')]);_0x54da18[_0x2532('0x31')]=qs[_0x2532('0x31')](_0x14f7df[_0x2532('0x46')][_0x2532('0x31')]);}_0x54da18[_0x2532('0x4f')]=qs[_0x2532('0x50')](_0x14f7df[_0x2532('0x46')][_0x2532('0x50')]);_0x54da18['where']=qs[_0x2532('0x53')](_[_0x2532('0x52')](_0x14f7df[_0x2532('0x46')],_0x4b98fa[_0x2532('0x53')]));_0x54da18[_0x2532('0x51')][_0x2532('0x69')]=_0x19001a['id'];if(_0x14f7df[_0x2532('0x46')]['filter']){_0x54da18[_0x2532('0x51')]=_['merge'](_0x54da18[_0x2532('0x51')],{'$or':_['map'](_0x54da18[_0x2532('0x4a')],function(_0xfe0ff9){var _0x5e750b={};_0x5e750b[_0xfe0ff9]={'$like':'%'+_0x14f7df[_0x2532('0x46')][_0x2532('0x54')]+'%'};return _0x5e750b;})});}_0x54da18=_['merge']({},_0x54da18,_0x14f7df[_0x2532('0x57')]);return db[_0x2532('0x6a')][_0x2532('0x33')]({'where':_0x54da18[_0x2532('0x51')]})[_0x2532('0x24')](function(_0x209259){_0x189751['count']=_0x209259;if(_0x14f7df['query'][_0x2532('0x58')]){_0x54da18[_0x2532('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2532('0x66')](_0x54da18);})['then'](function(_0x40aa10){_0x189751[_0x2532('0x5a')]=_0x40aa10;return _0x189751;});}})[_0x2532('0x24')](respondWithFilteredResult(_0x3258f0,_0x54da18))[_0x2532('0x2d')](handleError(_0x3258f0,null));};exports[_0x2532('0x6d')]=function(_0x14ab87,_0x3e6e7b,_0x53d675){return db['OpenchannelAccount'][_0x2532('0x5d')]({'where':{'id':_0x14ab87['params']['id']}})[_0x2532('0x24')](handleEntityNotFound(_0x3e6e7b,null))['then'](function(_0x4dbb19){if(_0x4dbb19){return _0x4dbb19[_0x2532('0x6d')](_0x14ab87[_0x2532('0x46')][_0x2532('0x6e')]);}})[_0x2532('0x24')](respondWithStatusCode(_0x3e6e7b,null))[_0x2532('0x2d')](handleError(_0x3e6e7b,null));};exports[_0x2532('0x6f')]=function(_0x5da379,_0x4f1e1b,_0x23289e){var _0x351a00={'body':_0x5da379[_0x2532('0x5f')],'channel':_0x2532('0x70')};var _0x5a9348=[];var _0x8948d8=[];var _0xa0d7b={};var _0x3b0540=![];return db['CmContact']['describe']()[_0x2532('0x24')](function(_0x45c576){if(!_0x45c576){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))](_0x2532('0x73'));}_0x5a9348=_[_0x2532('0x74')](_['keys'](_0x45c576),['createdAt','updatedAt']);_0x8948d8=_[_0x2532('0x74')](_['keys'](_0x45c576),[_0x2532('0x75'),_0x2532('0x76'),_0x2532('0x77'),'ListId']);if(_0x5da379[_0x2532('0x5f')]['id']){delete _0x5da379['body']['id'];}if(_[_0x2532('0x78')](_0x5da379['body']['from'])){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))](_0x2532('0x79'));}if(_['isNil'](_0x5da379[_0x2532('0x5f')][_0x2532('0x5f')])||_0x5da379['body']['body']===''){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5da379[_0x2532('0x5f')]['mapKey'])){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))](_0x2532('0x7a')+_0x8948d8);}if(!_['includes'](_0x8948d8,_0x5da379['body'][_0x2532('0x7b')])){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x8948d8);}_0xa0d7b[_0x5da379[_0x2532('0x5f')][_0x2532('0x7b')]]=_0x5da379['body']['from'];})[_0x2532('0x24')](function(){return db['OpenchannelAccount'][_0x2532('0x5d')]({'where':{'id':_0x5da379[_0x2532('0x5b')]['id']},'include':[{'model':db[_0x2532('0x7c')],'as':_0x2532('0x7d'),'include':[{'model':db[_0x2532('0x7e')],'as':_0x2532('0x7f'),'where':_0xa0d7b,'limit':0x1,'order':[[_0x2532('0x76'),_0x2532('0x80')]]}]},{'model':db[_0x2532('0x81')],'as':_0x2532('0x82')}]});})['then'](handleEntityNotFound(_0x4f1e1b,null))[_0x2532('0x24')](function(_0x352796){if(_0x352796&&_0x352796[_0x2532('0x7d')]){_0x351a00['account']=_0x352796;_0x351a00[_0x2532('0x83')]=_0x352796[_0x2532('0x82')];_0x351a00[_0x2532('0x84')]=_0x352796[_0x2532('0x7d')];_0x351a00[_0x2532('0x83')]=_['orderBy'](_0x351a00[_0x2532('0x83')],['priority'],[_0x2532('0x85')]);if(_0x351a00[_0x2532('0x86')][_0x2532('0x82')]){delete _0x351a00[_0x2532('0x86')]['Applications'];}if(_0x351a00['account']['List']&&_0x351a00[_0x2532('0x86')]['List'][_0x2532('0x7f')][_0x2532('0x4c')]){return _0x351a00['account'][_0x2532('0x7d')][_0x2532('0x7f')][0x0];}var _0x9893ff=_['defaults'](_0x5da379['body'],{'firstName':_0x5da379[_0x2532('0x5f')][_0x2532('0x87')],'ListId':_0x352796[_0x2532('0x88')]});_0x9893ff[_0x5da379['body'][_0x2532('0x7b')]]=_0x5da379[_0x2532('0x5f')][_0x2532('0x87')];return db['CmContact'][_0x2532('0x5e')](_0x9893ff,{'fields':_0x5a9348,'raw':!![]});}})[_0x2532('0x24')](handleEntityNotFound(_0x4f1e1b,null))['then'](function(_0x4b169c){_0x351a00['contact']=_0x4b169c;if(_0x4b169c){var _0x183a51={'ContactId':_0x4b169c['id'],'OpenchannelAccountId':_0x5da379[_0x2532('0x5b')]['id'],'from':(_0x4b169c[_0x2532('0x89')]||'')+'\x20'+(_0x4b169c[_0x2532('0x8a')]||'')};var _0x2a2e66={'OpenchannelAccountId':_0x5da379[_0x2532('0x5b')]['id'],'closed':![]};if(_0x5da379[_0x2532('0x5f')][_0x2532('0x8b')]){_0x2a2e66[_0x2532('0x8b')]=_0x5da379['body'][_0x2532('0x8b')];return db['OpenchannelInteraction']['find']({'where':_0x2a2e66})[_0x2532('0x24')](function(_0x24254e){if(_0x24254e){return[_0x24254e,![]];}_0x183a51['threadId']=_0x5da379[_0x2532('0x5f')][_0x2532('0x8b')];_0x183a51[_0x2532('0x8c')]=_0x5da379[_0x2532('0x5f')][_0x2532('0x8c')];return db['OpenchannelInteraction'][_0x2532('0x5e')](_0x183a51)[_0x2532('0x24')](function(_0x540c9b){return[_0x540c9b,!![]];});});}else{_0x2a2e66['threadId']=null;}_0x2a2e66['ContactId']=_0x4b169c['id'];return db[_0x2532('0x8d')]['find']({'where':_0x2a2e66})['then'](function(_0x261134){if(_0x261134){return[_0x261134,![]];}return db[_0x2532('0x8d')][_0x2532('0x5e')](_0x183a51)[_0x2532('0x24')](function(_0x3a0cbb){return[_0x3a0cbb,!![]];});});}})[_0x2532('0x8e')](function(_0x1b9dc5,_0x2850cb){if(_0x1b9dc5){_0x3b0540=_0x2850cb;if(!_0x2850cb){var _0x48d3ea={'from':(_0x351a00[_0x2532('0x8f')][_0x2532('0x89')]||'')+'\x20'+(_0x351a00[_0x2532('0x8f')][_0x2532('0x8a')]||'')};if(_0x5da379['body'][_0x2532('0x8b')]&&_0x5da379[_0x2532('0x5f')][_0x2532('0x90')]&&_0x5da379['body'][_0x2532('0x8b')]!=_0x5da379[_0x2532('0x5f')][_0x2532('0x90')]){_0x48d3ea[_0x2532('0x8b')]=_0x5da379[_0x2532('0x5f')]['messageId'];}return _0x1b9dc5[_0x2532('0x37')](_0x48d3ea);}else{return _0x1b9dc5;}}})[_0x2532('0x24')](function(_0xff35a7){_0x351a00[_0x2532('0x91')]=_0xff35a7[_0x2532('0x38')]({'plain':!![]});_0x351a00[_0x2532('0x91')][_0x2532('0x92')]=_0x3b0540;if(_0x351a00['interaction']['created']){if(_0x351a00[_0x2532('0x86')][_0x2532('0x93')]){_0x351a00[_0x2532('0x83')]['push']({'id':0x0,'priority':_0x351a00[_0x2532('0x83')]['length']+0x1,'app':_0x2532('0x94'),'appdata':_0x2532('0x95'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x2532('0x5e')]({'body':_0x5da379[_0x2532('0x5f')]['body'],'OpenchannelAccountId':_0x5da379[_0x2532('0x5b')]['id'],'OpenchannelInteractionId':_0xff35a7['id'],'direction':'in','ContactId':_0x351a00[_0x2532('0x8f')]['id'],'AttachmentId':_0x5da379['body'][_0x2532('0x96')]});})[_0x2532('0x24')](function(_0x2a2c83){_0x351a00[_0x2532('0x2b')]=_0x2a2c83;if(!_0x351a00[_0x2532('0x91')][_0x2532('0x97')])return;return db[_0x2532('0x98')][_0x2532('0x5d')]({'attributes':['id',_0x2532('0x3d')],'where':{'id':_0x351a00['interaction'][_0x2532('0x97')]}});})['then'](function(_0x4bda59){if(_0x4bda59){_0x351a00[_0x2532('0x83')][_0x2532('0x99')]({'id':0x0,'priority':0x0,'app':_0x2532('0x9a'),'appdata':_0x4bda59['name']+','+(_0x351a00[_0x2532('0x86')][_0x2532('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x351a00['interaction'][_0x2532('0x9c')])return;return db[_0x2532('0x9d')]['find']({'attributes':['id',_0x2532('0x3d')],'where':{'id':_0x351a00[_0x2532('0x91')]['queueId']}});})[_0x2532('0x24')](function(_0x2d5b72){if(_0x2d5b72){_0x351a00['applications'][_0x2532('0x99')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2d5b72['name']+','+(_0x351a00[_0x2532('0x86')][_0x2532('0x9e')]||0x12c),'interval':_0x2532('0x9f')});}return respondWithRpcPromise(_0x2532('0xa0'),_0x2532('0xa1'),_0x351a00);})[_0x2532('0x24')](function(_0x4fe2fd){respondWithRpcPromise(_0x2532('0xa2'),_0x2532('0xa2'),{'event':'notify','message':_0x4fe2fd},client9002);return _0x4fe2fd;})[_0x2532('0x24')](respondWithResult(_0x4f1e1b,null))[_0x2532('0x2d')](handleError(_0x4f1e1b,null));};exports[_0x2532('0xa3')]=function(_0x14a700,_0x1d4527){var _0x1a79f7=_0x14a700[_0x2532('0x5b')]['id'];var _0x333510=_0x14a700[_0x2532('0x5f')];var _0x139ce7=0xc8;var _0x115163=null;return db['sequelize'][_0x2532('0xa4')]({'isolationLevel':db['sequelize'][_0x2532('0xa5')][_0x2532('0xa6')][_0x2532('0xa7')]},function(_0x217364){return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x1a79f7},'transaction':_0x217364})[_0x2532('0x24')](function(_0x2ca591){if(_0x2ca591){return db[_0x2532('0x81')][_0x2532('0x3a')]({'where':{'OpenchannelAccountId':_0x1a79f7},'transaction':_0x217364})['then'](function(){var _0xca8018=_[_0x2532('0x40')](_0x333510,function(_0x1c1d56){_0x1c1d56[_0x2532('0x69')]=_0x1a79f7;return _0x1c1d56;});return db[_0x2532('0x81')][_0x2532('0xa8')](_0xca8018,{'transaction':_0x217364});});}else{_0x139ce7=0x194;_0x115163=[];}});})[_0x2532('0x24')](function(){if(_0x139ce7!==0x194){return db[_0x2532('0x81')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1a79f7},'order':_0x2532('0xa9')})[_0x2532('0x24')](function(_0x34e587){_0x115163=_0x34e587;});}})[_0x2532('0x2d')](function(_0xb5d753){_0x139ce7=0x1f4;logger[_0x2532('0x2a')](_0xb5d753['stack']);if(_0xb5d753[_0x2532('0x3d')]){delete _0xb5d753[_0x2532('0x3d')];}_0x115163=_0xb5d753;})['finally'](function(){if(_0x115163===null){_0x1d4527[_0x2532('0x2e')](_0x139ce7);}else{if(_0x139ce7===0x1f4){_0x1d4527[_0x2532('0x2f')](_0x139ce7)[_0x2532('0x3e')](_0x115163);}else{_0x1d4527[_0x2532('0x2f')](_0x139ce7)[_0x2532('0x30')](_0x115163);}}});};exports[_0x2532('0xaa')]=function(_0x42410b,_0x321e61,_0x3c0438){var _0xefe48d={};var _0xa9d115={};var _0x4593ce;var _0x547294;return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x42410b[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x321e61,null))['then'](function(_0x414639){if(_0x414639){_0x4593ce=_0x414639;_0xa9d115[_0x2532('0x49')]=_[_0x2532('0x47')](db['OpenchannelApplication'][_0x2532('0x42')]);_0xa9d115[_0x2532('0x46')]=_[_0x2532('0x47')](_0x42410b[_0x2532('0x46')]);_0xa9d115['filters']=_[_0x2532('0x48')](_0xa9d115['model'],_0xa9d115[_0x2532('0x46')]);_0xefe48d['attributes']=_['intersection'](_0xa9d115['model'],qs[_0x2532('0x4b')](_0x42410b[_0x2532('0x46')][_0x2532('0x4b')]));_0xefe48d[_0x2532('0x4a')]=_0xefe48d['attributes']['length']?_0xefe48d['attributes']:_0xa9d115['model'];_0xefe48d['order']=qs[_0x2532('0x50')](_0x42410b[_0x2532('0x46')][_0x2532('0x50')]);_0xefe48d[_0x2532('0x51')]=qs[_0x2532('0x53')](_[_0x2532('0x52')](_0x42410b['query'],_0xa9d115[_0x2532('0x53')]));if(_0x42410b[_0x2532('0x46')]['filter']){_0xefe48d[_0x2532('0x51')]=_[_0x2532('0x55')](_0xefe48d[_0x2532('0x51')],{'$or':_[_0x2532('0x40')](_0xefe48d['attributes'],function(_0x2ad271){var _0x69b0a0={};_0x69b0a0[_0x2ad271]={'$like':'%'+_0x42410b[_0x2532('0x46')][_0x2532('0x54')]+'%'};return _0x69b0a0;})});}_0xefe48d=_[_0x2532('0x55')]({},_0xefe48d,_0x42410b['options']);return _0x4593ce['getApplications'](_0xefe48d);}})[_0x2532('0x24')](function(_0x4830e8){if(_0x4830e8){_0x547294=_0x4830e8[_0x2532('0x4c')];if(!_0x42410b[_0x2532('0x46')][_0x2532('0x4d')](_0x2532('0x4e'))){_0xefe48d[_0x2532('0x32')]=qs[_0x2532('0x32')](_0x42410b['query'][_0x2532('0x32')]);_0xefe48d[_0x2532('0x31')]=qs[_0x2532('0x31')](_0x42410b[_0x2532('0x46')][_0x2532('0x31')]);}return _0x4593ce[_0x2532('0xaa')](_0xefe48d);}})[_0x2532('0x24')](function(_0x4a0c68){if(_0x4a0c68){return _0x4a0c68?{'count':_0x547294,'rows':_0x4a0c68}:null;}})[_0x2532('0x24')](respondWithResult(_0x321e61,null))[_0x2532('0x2d')](handleError(_0x321e61,null));};exports['getInteractions']=function(_0x4f0b7d,_0x267d11,_0x190c3b){var _0x2558cb={'raw':![],'where':{}};var _0xb82b11={};var _0x5c7795={'count':0x0,'rows':[]};return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x4f0b7d[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x267d11,null))['then'](function(_0xa6cd6f){if(_0xa6cd6f){_0xb82b11[_0x2532('0x49')]=_['keys'](db[_0x2532('0x8d')][_0x2532('0x42')]);_0xb82b11[_0x2532('0x46')]=_['keys'](_0x4f0b7d[_0x2532('0x46')]);_0xb82b11[_0x2532('0x53')]=_[_0x2532('0x48')](_0xb82b11['model'],_0xb82b11[_0x2532('0x46')]);_0x2558cb[_0x2532('0x4a')]=_[_0x2532('0x48')](_0xb82b11['model'],qs['fields'](_0x4f0b7d[_0x2532('0x46')][_0x2532('0x4b')]));_0x2558cb[_0x2532('0x4a')]=_0x2558cb[_0x2532('0x4a')][_0x2532('0x4c')]?_0x2558cb['attributes']:_0xb82b11[_0x2532('0x49')];if(!_0x4f0b7d[_0x2532('0x46')]['hasOwnProperty'](_0x2532('0x4e'))){_0x2558cb['limit']=qs[_0x2532('0x32')](_0x4f0b7d[_0x2532('0x46')]['limit']);_0x2558cb[_0x2532('0x31')]=qs[_0x2532('0x31')](_0x4f0b7d[_0x2532('0x46')][_0x2532('0x31')]);}_0x2558cb[_0x2532('0x4f')]=qs[_0x2532('0x50')](_0x4f0b7d['query'][_0x2532('0x50')]);_0x2558cb['where']=qs[_0x2532('0x53')](_[_0x2532('0x52')](_0x4f0b7d[_0x2532('0x46')],_0xb82b11[_0x2532('0x53')]));_0x2558cb['where'][_0x2532('0x69')]=_0xa6cd6f['id'];if(_0x4f0b7d[_0x2532('0x46')][_0x2532('0x54')]){_0x2558cb[_0x2532('0x51')]=_['merge'](_0x2558cb[_0x2532('0x51')],{'$or':_['map'](_0x2558cb[_0x2532('0x4a')],function(_0x525a86){var _0x30f0b6={};_0x30f0b6[_0x525a86]={'$like':'%'+_0x4f0b7d[_0x2532('0x46')][_0x2532('0x54')]+'%'};return _0x30f0b6;})});}_0x2558cb=_[_0x2532('0x55')]({},_0x2558cb,_0x4f0b7d[_0x2532('0x57')]);return db['OpenchannelInteraction'][_0x2532('0x33')]({'where':_0x2558cb['where']})[_0x2532('0x24')](function(_0x592104){_0x5c7795[_0x2532('0x33')]=_0x592104;if(_0x4f0b7d[_0x2532('0x46')]['includeAll']){_0x2558cb['include']=[{'model':db[_0x2532('0x7e')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0x2532('0xab')],'required':![]},{'model':db['Tag'],'as':_0x2532('0xac'),'attributes':['id',_0x2532('0x3d'),_0x2532('0xad')],'where':_0x4f0b7d[_0x2532('0x46')][_0x2532('0xae')]?{'id':_0x4f0b7d[_0x2532('0x46')][_0x2532('0xae')]}:undefined,'required':_0x4f0b7d[_0x2532('0x46')][_0x2532('0xae')]?!![]:![]}];}return db[_0x2532('0x8d')][_0x2532('0x66')](_0x2558cb);})['then'](function(_0x4171c1){_0x5c7795[_0x2532('0x5a')]=_0x4171c1;return _0x5c7795;});}})['then'](respondWithFilteredResult(_0x267d11,_0x2558cb))[_0x2532('0x2d')](handleError(_0x267d11,null));};exports['addAgents']=function(_0x31dce1,_0x74d7a9,_0x1edfeb){return db[_0x2532('0x41')][_0x2532('0x5d')]({'where':{'id':_0x31dce1[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x74d7a9,null))['then'](function(_0x5d1dfa){if(_0x5d1dfa){return _0x5d1dfa['addAgents'](_0x31dce1[_0x2532('0x5f')][_0x2532('0x6e')],_[_0x2532('0xaf')](_0x31dce1[_0x2532('0x5f')],[_0x2532('0x6e'),'id'])||{})['spread'](function(_0x2b4cef){for(var _0x42afe9=0x0;_0x42afe9<_0x31dce1['body'][_0x2532('0x6e')][_0x2532('0x4c')];_0x42afe9+=0x1){socket['emit'](_0x2532('0xb0'),{'UserId':Number(_0x31dce1[_0x2532('0x5f')][_0x2532('0x6e')][_0x42afe9]),'OpenchannelAccountId':Number(_0x31dce1[_0x2532('0x5b')]['id'])});}return _0x2b4cef;});}})['then'](respondWithResult(_0x74d7a9,null))['catch'](handleError(_0x74d7a9,null));};exports[_0x2532('0xb1')]=function(_0x39bbcb,_0x3b1fe6,_0x2e09d3){return db[_0x2532('0x41')][_0x2532('0x5d')]({'where':{'id':_0x39bbcb['params']['id']}})['then'](handleEntityNotFound(_0x3b1fe6,null))[_0x2532('0x24')](function(_0x572cc6){if(_0x572cc6){return _0x572cc6[_0x2532('0xb1')](_0x39bbcb[_0x2532('0x46')][_0x2532('0x6e')])[_0x2532('0x24')](function(){if(_['isArray'](_0x39bbcb[_0x2532('0x46')]['ids'])){for(var _0x3cd7de=0x0;_0x3cd7de<_0x39bbcb[_0x2532('0x46')]['ids']['length'];_0x3cd7de+=0x1){socket['emit'](_0x2532('0xb2'),{'UserId':Number(_0x39bbcb[_0x2532('0x46')]['ids'][_0x3cd7de]),'OpenchannelAccountId':Number(_0x39bbcb[_0x2532('0x5b')]['id'])});}}else{socket[_0x2532('0xb3')](_0x2532('0xb2'),{'UserId':Number(_0x39bbcb[_0x2532('0x46')][_0x2532('0x6e')]),'OpenchannelAccountId':Number(_0x39bbcb[_0x2532('0x5b')]['id'])});}});}})[_0x2532('0x24')](respondWithStatusCode(_0x3b1fe6,null))[_0x2532('0x2d')](handleError(_0x3b1fe6,null));};exports[_0x2532('0xb4')]=function(_0x1d2789,_0x4b6ac6,_0x4aa2c5){var _0x387bf9={};var _0x37881={};var _0x50a384;var _0x991362;return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x1d2789[_0x2532('0x5b')]['id']}})[_0x2532('0x24')](handleEntityNotFound(_0x4b6ac6,null))['then'](function(_0x16d99f){if(_0x16d99f){_0x50a384=_0x16d99f;_0x37881[_0x2532('0x49')]=_[_0x2532('0x47')](db[_0x2532('0x98')]['rawAttributes']);_0x37881['query']=_[_0x2532('0x47')](_0x1d2789[_0x2532('0x46')]);_0x37881[_0x2532('0x53')]=_[_0x2532('0x48')](_0x37881[_0x2532('0x49')],_0x37881[_0x2532('0x46')]);_0x387bf9[_0x2532('0x4a')]=_[_0x2532('0x48')](_0x37881['model'],qs['fields'](_0x1d2789[_0x2532('0x46')][_0x2532('0x4b')]));_0x387bf9[_0x2532('0x4a')]=_0x387bf9[_0x2532('0x4a')][_0x2532('0x4c')]?_0x387bf9[_0x2532('0x4a')]:_0x37881[_0x2532('0x49')];_0x387bf9[_0x2532('0x4f')]=qs[_0x2532('0x50')](_0x1d2789[_0x2532('0x46')][_0x2532('0x50')]);_0x387bf9['where']=qs[_0x2532('0x53')](_[_0x2532('0x52')](_0x1d2789[_0x2532('0x46')],_0x37881['filters']));if(_0x1d2789[_0x2532('0x46')][_0x2532('0x54')]){_0x387bf9[_0x2532('0x51')]=_[_0x2532('0x55')](_0x387bf9[_0x2532('0x51')],{'$or':_[_0x2532('0x40')](_0x387bf9[_0x2532('0x4a')],function(_0x54aac2){var _0x5ab3a5={};_0x5ab3a5[_0x54aac2]={'$like':'%'+_0x1d2789[_0x2532('0x46')][_0x2532('0x54')]+'%'};return _0x5ab3a5;})});}_0x387bf9=_[_0x2532('0x55')]({},_0x387bf9,_0x1d2789[_0x2532('0x57')]);return _0x50a384[_0x2532('0xb4')](_0x387bf9);}})['then'](function(_0x39ba35){if(_0x39ba35){_0x991362=_0x39ba35[_0x2532('0x4c')];if(!_0x1d2789['query'][_0x2532('0x4d')](_0x2532('0x4e'))){_0x387bf9['limit']=qs[_0x2532('0x32')](_0x1d2789['query']['limit']);_0x387bf9['offset']=qs[_0x2532('0x31')](_0x1d2789[_0x2532('0x46')][_0x2532('0x31')]);}return _0x50a384[_0x2532('0xb4')](_0x387bf9);}})[_0x2532('0x24')](function(_0x4f589b){if(_0x4f589b){return _0x4f589b?{'count':_0x991362,'rows':_0x4f589b}:null;}})[_0x2532('0x24')](respondWithResult(_0x4b6ac6,null))['catch'](handleError(_0x4b6ac6,null));};exports['send']=function(_0x440126,_0x5a9ae4,_0x34caf2){var _0x1fe12c,_0x366415,_0x199003;if(_[_0x2532('0x78')](_0x440126[_0x2532('0x5f')][_0x2532('0x5f')])||_0x440126['body']['body']===''){throw new db[(_0x2532('0x71'))][(_0x2532('0x72'))](_0x2532('0xb5'));}if(_[_0x2532('0x78')](_0x440126[_0x2532('0x5f')]['to'])){}_0x1fe12c=_0x440126[_0x2532('0x5f')]['to'];return db[_0x2532('0x41')][_0x2532('0x6c')]({'where':{'id':_0x440126[_0x2532('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5a9ae4,null))[_0x2532('0x24')](function(_0x322eca){if(_0x322eca){return db['OpenchannelAccount'][_0x2532('0x5d')]({'where':{'id':_0x322eca['id']},'include':[{'model':db[_0x2532('0x7c')],'as':_0x2532('0x7d'),'include':[{'model':db[_0x2532('0x7e')],'as':_0x2532('0x7f'),'where':{[_0x322eca['mapKey']]:_0x1fe12c},'limit':0x1,'order':[[_0x2532('0x76'),_0x2532('0x80')]]}]}]})[_0x2532('0x24')](handleEntityNotFound(_0x5a9ae4,null))[_0x2532('0x24')](function(_0x1b8429){if(_0x1b8429&&_0x1b8429[_0x2532('0x7d')]){_0x366415=_0x1b8429[_0x2532('0x38')]({'plain':!![]});if(_0x366415[_0x2532('0x7d')]&&_0x366415[_0x2532('0x7d')][_0x2532('0x7f')][_0x2532('0x4c')]){return _0x366415[_0x2532('0x7d')][_0x2532('0x7f')][0x0];}return db[_0x2532('0x7e')][_0x2532('0x5e')](_[_0x2532('0x1c')](_0x440126['body'],{'firstName':_0x1fe12c,[_0x1b8429[_0x2532('0x7b')]]:_0x1fe12c,'phone':_0x1fe12c,'ListId':_0x366415['ListId']}));}})['then'](handleEntityNotFound(_0x5a9ae4,null))[_0x2532('0x24')](function(_0x25a465){if(_0x25a465){_0x199003=_0x25a465;return db[_0x2532('0x8d')][_0x2532('0x5d')]({'where':{'ContactId':_0x199003['id'],'closed':![],'OpenchannelAccountId':_0x366415['id']}})[_0x2532('0x24')](function(_0x39148e){if(_0x39148e){return[_0x39148e,![]];}return db[_0x2532('0x8d')][_0x2532('0x5e')]({'UserId':_0x440126['user']['id'],'ContactId':_0x199003['id'],'OpenchannelAccountId':_0x366415['id'],'lastMsgDirection':_0x2532('0xb6'),'firstMsgDirection':_0x2532('0xb6'),'Messages':[_[_0x2532('0x55')](_0x440126[_0x2532('0x5f')],{'read':![],'body':_0x440126[_0x2532('0x5f')][_0x2532('0x5f')],'OpenchannelAccountId':_0x366415['id'],'UserId':_0x440126[_0x2532('0x60')]['id'],'ContactId':_0x199003['id']})]},{'include':[{'model':db[_0x2532('0xb7')],'as':_0x2532('0xb8')}]})[_0x2532('0x24')](function(_0x461ed3){return[_0x461ed3,!![]];});});}})[_0x2532('0x8e')](function(_0x5cec70,_0x15c857){if(_0x15c857){return _0x5cec70;}return db[_0x2532('0xb7')][_0x2532('0x5e')](_[_0x2532('0x55')](_0x440126[_0x2532('0x5f')],{'read':![],'body':_0x440126[_0x2532('0x5f')][_0x2532('0x5f')],'OpenchannelAccountId':_0x366415['id'],'OpenchannelInteractionId':_0x5cec70['id'],'UserId':_0x440126['user']['id'],'ContactId':_0x199003['id']}))[_0x2532('0x24')](function(_0x2d857e){_0x5cec70[_0x2532('0xb9')][_0x2532('0xb8')]=[];_0x5cec70[_0x2532('0xb9')][_0x2532('0xb8')][_0x2532('0xba')](_0x2d857e['dataValues']);return _0x5cec70;});});}})[_0x2532('0x24')](respondWithResult(_0x5a9ae4,null))[_0x2532('0x2d')](handleError(_0x5a9ae4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f614e17..600c36e 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x812136,_0x5df217){var _0x3b5c29=function(_0x207404){while(--_0x207404){_0x812136['push'](_0x812136['shift']());}};_0x3b5c29(++_0x5df217);}(_0x750a,0x140));var _0xa750=function(_0x75ac55,_0x376e68){_0x75ac55=_0x75ac55-0x0;var _0x3e5dd5=_0x750a[_0x75ac55];return _0x3e5dd5;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x3523a1,_0x583356){var _0x47fdcc=function(_0x35999d){while(--_0x35999d){_0x3523a1['push'](_0x3523a1['shift']());}};_0x47fdcc(++_0x583356);}(_0xe706,0xa3));var _0x6e70=function(_0x5efb9e,_0x47e288){_0x5efb9e=_0x5efb9e-0x0;var _0x571f58=_0xe706[_0x5efb9e];return _0x571f58;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d88122a..d454a64 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(_0x191fc4,_0x251b1f){var _0x534c6a=function(_0xfd1e8e){while(--_0xfd1e8e){_0x191fc4['push'](_0x191fc4['shift']());}};_0x534c6a(++_0x251b1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5e4a81,_0x1b5e3d){var _0x4e4230=function(_0x16258c){while(--_0x16258c){_0x5e4a81['push'](_0x5e4a81['shift']());}};_0x4e4230(++_0x1b5e3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 9ef84c3..4661dd9 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 _0x4bde=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x3cc3db,_0x17670e){_0x3cc3db=_0x3cc3db-0x0;var _0x3a9862=_0x4bde[_0x3cc3db];return _0x3a9862;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4bd('0x3'));var fs=require('fs');var Redis=require(_0xe4bd('0x4'));var db=require(_0xe4bd('0x5'))['db'];var utils=require(_0xe4bd('0x6'));var logger=require('../../config/logger')(_0xe4bd('0x7'));var config=require(_0xe4bd('0x8'));var jayson=require(_0xe4bd('0x9'));var client=jayson[_0xe4bd('0xa')][_0xe4bd('0xb')]({'port':0x232a});config[_0xe4bd('0xc')]=_['defaults'](config[_0xe4bd('0xc')],{'host':_0xe4bd('0xd'),'port':0x18eb});var socket=require(_0xe4bd('0xe'))(new Redis(config[_0xe4bd('0xc')]));require(_0xe4bd('0xf'))[_0xe4bd('0x10')](socket);function respondWithRpcPromise(_0x4c254d,_0x4b7037,_0x5a32c3){return new BPromise(function(_0x3834ea,_0x308e01){return client[_0xe4bd('0x11')](_0x4c254d,_0x5a32c3)['then'](function(_0x2d0992){logger[_0xe4bd('0x12')](_0xe4bd('0x13'),_0x4b7037,_0xe4bd('0x14'));logger['debug'](_0xe4bd('0x15'),_0x4b7037,'request\x20sent',JSON[_0xe4bd('0x16')](_0x2d0992));if(_0x2d0992['error']){if(_0x2d0992[_0xe4bd('0x17')][_0xe4bd('0x18')]===0x1f4){logger[_0xe4bd('0x17')](_0xe4bd('0x13'),_0x4b7037,_0x2d0992[_0xe4bd('0x17')][_0xe4bd('0x19')]);return _0x308e01(_0x2d0992[_0xe4bd('0x17')][_0xe4bd('0x19')]);}logger[_0xe4bd('0x17')](_0xe4bd('0x13'),_0x4b7037,_0x2d0992[_0xe4bd('0x17')][_0xe4bd('0x19')]);return _0x3834ea(_0x2d0992[_0xe4bd('0x17')]['message']);}else{logger[_0xe4bd('0x12')](_0xe4bd('0x13'),_0x4b7037,'request\x20sent');_0x3834ea(_0x2d0992[_0xe4bd('0x1a')][_0xe4bd('0x19')]);}})['catch'](function(_0x1ab4bc){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4b7037,_0x1ab4bc);_0x308e01(_0x1ab4bc);});});} \ No newline at end of file +var _0x1152=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','socket.io-emitter','redis','./openchannelAccount.socket','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5a8c91,_0x18d6bf){var _0x53df57=function(_0x5e7b73){while(--_0x5e7b73){_0x5a8c91['push'](_0x5a8c91['shift']());}};_0x53df57(++_0x18d6bf);}(_0x1152,0x182));var _0x2115=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0x1152[_0x46c9a5];return _0x5e3eec;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2115('0xb'))(new Redis(config[_0x2115('0xc')]));require(_0x2115('0xd'))['register'](socket);function respondWithRpcPromise(_0x254648,_0x534958,_0x5ca468){return new BPromise(function(_0x225a1c,_0x272a95){return client[_0x2115('0xe')](_0x254648,_0x5ca468)['then'](function(_0x400b19){logger['info'](_0x2115('0xf'),_0x534958,_0x2115('0x10'));logger[_0x2115('0x11')](_0x2115('0x12'),_0x534958,_0x2115('0x10'),JSON['stringify'](_0x400b19));if(_0x400b19[_0x2115('0x13')]){if(_0x400b19['error'][_0x2115('0x14')]===0x1f4){logger[_0x2115('0x13')](_0x2115('0xf'),_0x534958,_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);return _0x272a95(_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);}logger['error'](_0x2115('0xf'),_0x534958,_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);return _0x225a1c(_0x400b19[_0x2115('0x13')][_0x2115('0x15')]);}else{logger[_0x2115('0x16')](_0x2115('0xf'),_0x534958,_0x2115('0x10'));_0x225a1c(_0x400b19['result'][_0x2115('0x15')]);}})[_0x2115('0x17')](function(_0x38c26f){logger['error'](_0x2115('0xf'),_0x534958,_0x38c26f);_0x272a95(_0x38c26f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ff7966b..596b424 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 _0x0434=['update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x31932c,_0x5b097a){var _0xcbe79b=function(_0x32875d){while(--_0x32875d){_0x31932c['push'](_0x31932c['shift']());}};_0xcbe79b(++_0x5b097a);}(_0x0434,0x1ad));var _0x4043=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x0434[_0x58e469];return _0x4c01c5;};'use strict';var OpenchannelAccountEvents=require(_0x4043('0x0'));var events=[_0x4043('0x1'),_0x4043('0x2'),_0x4043('0x3')];function createListener(_0x425361,_0x56e8f3){return function(_0x4ca779){_0x56e8f3[_0x4043('0x4')](_0x425361,_0x4ca779);};}function removeListener(_0xfa9ae8,_0x3e475f){return function(){OpenchannelAccountEvents[_0x4043('0x5')](_0xfa9ae8,_0x3e475f);};}exports[_0x4043('0x6')]=function(_0x1dba57){for(var _0x58fca7=0x0,_0x41d0a9=events[_0x4043('0x7')];_0x58fca7<_0x41d0a9;_0x58fca7++){var _0x5080e5=events[_0x58fca7];var _0x56355c=createListener(_0x4043('0x8')+_0x5080e5,_0x1dba57);OpenchannelAccountEvents['on'](_0x5080e5,_0x56355c);}}; \ No newline at end of file +var _0x0506=['emit','length','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x5b2a6b,_0x900e86){var _0xd0f50b=function(_0x52a5d8){while(--_0x52a5d8){_0x5b2a6b['push'](_0x5b2a6b['shift']());}};_0xd0f50b(++_0x900e86);}(_0x0506,0x1d1));var _0x6050=function(_0x2d97f5,_0x1d1a6c){_0x2d97f5=_0x2d97f5-0x0;var _0x25a74d=_0x0506[_0x2d97f5];return _0x25a74d;};'use strict';var OpenchannelAccountEvents=require(_0x6050('0x0'));var events=[_0x6050('0x1'),_0x6050('0x2'),'update'];function createListener(_0x52f82b,_0x5139c7){return function(_0x49a1ca){_0x5139c7[_0x6050('0x3')](_0x52f82b,_0x49a1ca);};}function removeListener(_0x58e2a9,_0x3cbb1f){return function(){OpenchannelAccountEvents['removeListener'](_0x58e2a9,_0x3cbb1f);};}exports['register']=function(_0xfd44cc){for(var _0x269be3=0x0,_0x2a3644=events[_0x6050('0x4')];_0x269be3<_0x2a3644;_0x269be3++){var _0x3512ba=events[_0x269be3];var _0xf64de5=createListener(_0x6050('0x5')+_0x3512ba,_0xfd44cc);OpenchannelAccountEvents['on'](_0x3512ba,_0xf64de5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1988c40..93461ca 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 _0xef44=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xef44,0x122));var _0x4ef4=function(_0x35402c,_0x55377e){_0x35402c=_0x35402c-0x0;var _0x1cd0bd=_0xef44[_0x35402c];return _0x1cd0bd;};'use strict';var multer=require(_0x4ef4('0x0'));var util=require(_0x4ef4('0x1'));var path=require('path');var timeout=require(_0x4ef4('0x2'));var express=require('express');var router=express[_0x4ef4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ef4('0x4'));var interaction=require(_0x4ef4('0x5'));var config=require(_0x4ef4('0x6'));var controller=require(_0x4ef4('0x7'));router[_0x4ef4('0x8')]('/',auth[_0x4ef4('0x9')](),controller[_0x4ef4('0xa')]);router[_0x4ef4('0x8')](_0x4ef4('0xb'),auth[_0x4ef4('0x9')](),controller[_0x4ef4('0xc')]);router['post']('/',auth[_0x4ef4('0x9')](),controller[_0x4ef4('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4ef4('0xe')](_0x4ef4('0xb'),auth[_0x4ef4('0x9')](),controller[_0x4ef4('0xf')]);module[_0x4ef4('0x10')]=router; \ No newline at end of file +var _0xbd4f=['./openchannelApplication.controller','get','index','/:id','isAuthenticated','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xbd4f,0xac));var _0xfbd4=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbd4f[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0xfbd4('0x0'));var util=require(_0xfbd4('0x1'));var path=require(_0xfbd4('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbd4('0x3'));var router=express[_0xfbd4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfbd4('0x5'));var interaction=require(_0xfbd4('0x6'));var config=require(_0xfbd4('0x7'));var controller=require(_0xfbd4('0x8'));router[_0xfbd4('0x9')]('/',auth['isAuthenticated'](),controller[_0xfbd4('0xa')]);router[_0xfbd4('0x9')](_0xfbd4('0xb'),auth[_0xfbd4('0xc')](),controller['show']);router['post']('/',auth[_0xfbd4('0xc')](),controller[_0xfbd4('0xd')]);router[_0xfbd4('0xe')](_0xfbd4('0xb'),auth[_0xfbd4('0xc')](),controller[_0xfbd4('0xf')]);router['delete'](_0xfbd4('0xb'),auth[_0xfbd4('0xc')](),controller[_0xfbd4('0x10')]);module[_0xfbd4('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 0852e2a..752235e 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 _0x1bf4=['TEXT','STRING','exports','INTEGER','noop'];(function(_0x5e0a8e,_0x558cc7){var _0x133b5b=function(_0x4aff1a){while(--_0x4aff1a){_0x5e0a8e['push'](_0x5e0a8e['shift']());}};_0x133b5b(++_0x558cc7);}(_0x1bf4,0x133));var _0x41bf=function(_0x1dd7d8,_0x9ba9c9){_0x1dd7d8=_0x1dd7d8-0x0;var _0x81acc9=_0x1bf4[_0x1dd7d8];return _0x81acc9;};'use strict';var Sequelize=require('sequelize');module[_0x41bf('0x0')]={'priority':{'type':Sequelize[_0x41bf('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x41bf('0x2')},'appdata':{'type':Sequelize[_0x41bf('0x3')]()},'description':{'type':Sequelize[_0x41bf('0x4')]},'interval':{'type':Sequelize[_0x41bf('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd19b=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd19b,0x17d));var _0xbd19=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xd19b[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require(_0xbd19('0x0'));module[_0xbd19('0x1')]={'priority':{'type':Sequelize[_0xbd19('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd19('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbd19('0x4')]},'interval':{'type':Sequelize[_0xbd19('0x4')],'defaultValue':_0xbd19('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 3148db2..cbdb476 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 _0x3785=['rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','OpenchannelApplication'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3785,0xa0));var _0x5378=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x3785[_0x1bbc08];return _0x5d825b;};'use strict';var emlformat=require(_0x5378('0x0'));var rimraf=require(_0x5378('0x1'));var zipdir=require(_0x5378('0x2'));var jsonpatch=require(_0x5378('0x3'));var rp=require('request-promise');var moment=require(_0x5378('0x4'));var BPromise=require(_0x5378('0x5'));var Mustache=require('mustache');var util=require(_0x5378('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5378('0x7'));var squel=require(_0x5378('0x8'));var crypto=require(_0x5378('0x9'));var jsforce=require(_0x5378('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5378('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5378('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5378('0xd'));var as=require(_0x5378('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5378('0xf'))('api');var utils=require(_0x5378('0x10'));var config=require(_0x5378('0x11'));var licenseUtil=require(_0x5378('0x12'));var db=require(_0x5378('0x13'))['db'];function respondWithStatusCode(_0x20cecf,_0x318b83){_0x318b83=_0x318b83||0xcc;return function(_0x5e38a6){if(_0x5e38a6){return _0x20cecf[_0x5378('0x14')](_0x318b83);}return _0x20cecf[_0x5378('0x15')](_0x318b83)[_0x5378('0x16')]();};}function respondWithResult(_0x1c890b,_0x1306f3){_0x1306f3=_0x1306f3||0xc8;return function(_0x31b253){if(_0x31b253){return _0x1c890b[_0x5378('0x15')](_0x1306f3)[_0x5378('0x17')](_0x31b253);}};}function respondWithFilteredResult(_0x4cd5e,_0x55da10){return function(_0x2c29d6){if(_0x2c29d6){var _0x844bbe=typeof _0x55da10[_0x5378('0x18')]===_0x5378('0x19')&&typeof _0x55da10[_0x5378('0x1a')]===_0x5378('0x19');var _0x3f1310=_0x2c29d6[_0x5378('0x1b')];var _0xc12363=_0x844bbe?0x0:_0x55da10[_0x5378('0x18')];var _0x5c7005=_0x844bbe?_0x2c29d6[_0x5378('0x1b')]:_0x55da10[_0x5378('0x18')]+_0x55da10[_0x5378('0x1a')];var _0x5f2584;if(_0x5c7005>=_0x3f1310){_0x5c7005=_0x3f1310;_0x5f2584=0xc8;}else{_0x5f2584=0xce;}_0x4cd5e[_0x5378('0x15')](_0x5f2584);return _0x4cd5e[_0x5378('0x1c')](_0x5378('0x1d'),_0xc12363+'-'+_0x5c7005+'/'+_0x3f1310)[_0x5378('0x17')](_0x2c29d6);}return null;};}function patchUpdates(_0x4c0f3e){return function(_0x5051d4){try{jsonpatch[_0x5378('0x1e')](_0x5051d4,_0x4c0f3e,!![]);}catch(_0x16e32d){return BPromise[_0x5378('0x1f')](_0x16e32d);}return _0x5051d4['save']();};}function saveUpdates(_0x23791b,_0x46a992){return function(_0x3eef90){if(_0x3eef90){return _0x3eef90[_0x5378('0x20')](_0x23791b)[_0x5378('0x21')](function(_0x135e7e){return _0x135e7e;});}return null;};}function removeEntity(_0x44dcd8,_0x22a0fd){return function(_0x22ed8a){if(_0x22ed8a){return _0x22ed8a[_0x5378('0x22')]()[_0x5378('0x21')](function(){_0x44dcd8[_0x5378('0x15')](0xcc)[_0x5378('0x16')]();});}};}function handleEntityNotFound(_0x347a42,_0x3f8094){return function(_0xa74cef){if(!_0xa74cef){_0x347a42[_0x5378('0x14')](0x194);}return _0xa74cef;};}function handleError(_0x4670b2,_0x517f07){_0x517f07=_0x517f07||0x1f4;return function(_0x39fb0c){logger['error'](_0x39fb0c[_0x5378('0x23')]);if(_0x39fb0c['name']){delete _0x39fb0c[_0x5378('0x24')];}_0x4670b2[_0x5378('0x15')](_0x517f07)[_0x5378('0x25')](_0x39fb0c);};}exports[_0x5378('0x26')]=function(_0x22f587,_0x5c40e6){var _0x106231={},_0x1d4663={},_0x536a86={'count':0x0,'rows':[]};var _0x31b9a0=_[_0x5378('0x27')](db[_0x5378('0x28')][_0x5378('0x29')],function(_0x1a997b){return{'name':_0x1a997b['fieldName'],'type':_0x1a997b[_0x5378('0x2a')]['key']};});_0x1d4663[_0x5378('0x2b')]=_[_0x5378('0x27')](_0x31b9a0,'name');_0x1d4663[_0x5378('0x2c')]=_['keys'](_0x22f587[_0x5378('0x2c')]);_0x1d4663[_0x5378('0x2d')]=_['intersection'](_0x1d4663[_0x5378('0x2b')],_0x1d4663[_0x5378('0x2c')]);_0x106231['attributes']=_[_0x5378('0x2e')](_0x1d4663[_0x5378('0x2b')],qs[_0x5378('0x2f')](_0x22f587[_0x5378('0x2c')][_0x5378('0x2f')]));_0x106231[_0x5378('0x30')]=_0x106231[_0x5378('0x30')]['length']?_0x106231[_0x5378('0x30')]:_0x1d4663[_0x5378('0x2b')];if(!_0x22f587[_0x5378('0x2c')][_0x5378('0x31')](_0x5378('0x32'))){_0x106231[_0x5378('0x1a')]=qs[_0x5378('0x1a')](_0x22f587[_0x5378('0x2c')][_0x5378('0x1a')]);_0x106231['offset']=qs['offset'](_0x22f587[_0x5378('0x2c')][_0x5378('0x18')]);}_0x106231['order']=qs[_0x5378('0x33')](_0x22f587['query'][_0x5378('0x33')]);_0x106231[_0x5378('0x34')]=qs['filters'](_[_0x5378('0x35')](_0x22f587[_0x5378('0x2c')],_0x1d4663[_0x5378('0x2d')]),_0x31b9a0);if(_0x22f587[_0x5378('0x2c')]['filter']){_0x106231[_0x5378('0x34')]=_[_0x5378('0x36')](_0x106231[_0x5378('0x34')],{'$or':_[_0x5378('0x27')](_0x31b9a0,function(_0x125e45){if(_0x125e45[_0x5378('0x2a')]!==_0x5378('0x37')){var _0x316d61={};_0x316d61[_0x125e45[_0x5378('0x24')]]={'$like':'%'+_0x22f587['query'][_0x5378('0x38')]+'%'};return _0x316d61;}})});}_0x106231=_['merge']({},_0x106231,_0x22f587[_0x5378('0x39')]);var _0xac2606={'where':_0x106231[_0x5378('0x34')]};return db[_0x5378('0x28')][_0x5378('0x1b')](_0xac2606)[_0x5378('0x21')](function(_0x4c9dbc){_0x536a86[_0x5378('0x1b')]=_0x4c9dbc;if(_0x22f587[_0x5378('0x2c')][_0x5378('0x3a')]){_0x106231['include']=[{'all':!![]}];}return db[_0x5378('0x28')][_0x5378('0x3b')](_0x106231);})[_0x5378('0x21')](function(_0x1b079f){_0x536a86[_0x5378('0x3c')]=_0x1b079f;return _0x536a86;})['then'](respondWithFilteredResult(_0x5c40e6,_0x106231))['catch'](handleError(_0x5c40e6,null));};exports[_0x5378('0x3d')]=function(_0x535554,_0x72b994){var _0x327c0e={'raw':!![],'where':{'id':_0x535554[_0x5378('0x3e')]['id']}},_0x445ef0={};_0x445ef0['model']=_['keys'](db[_0x5378('0x28')][_0x5378('0x29')]);_0x445ef0[_0x5378('0x2c')]=_[_0x5378('0x3f')](_0x535554['query']);_0x445ef0[_0x5378('0x2d')]=_[_0x5378('0x2e')](_0x445ef0[_0x5378('0x2b')],_0x445ef0[_0x5378('0x2c')]);_0x327c0e['attributes']=_[_0x5378('0x2e')](_0x445ef0[_0x5378('0x2b')],qs['fields'](_0x535554[_0x5378('0x2c')][_0x5378('0x2f')]));_0x327c0e[_0x5378('0x30')]=_0x327c0e[_0x5378('0x30')]['length']?_0x327c0e['attributes']:_0x445ef0[_0x5378('0x2b')];if(_0x535554[_0x5378('0x2c')][_0x5378('0x3a')]){_0x327c0e['include']=[{'all':!![]}];}_0x327c0e=_['merge']({},_0x327c0e,_0x535554[_0x5378('0x39')]);return db[_0x5378('0x28')]['find'](_0x327c0e)[_0x5378('0x21')](handleEntityNotFound(_0x72b994,null))['then'](respondWithResult(_0x72b994,null))[_0x5378('0x40')](handleError(_0x72b994,null));};exports[_0x5378('0x41')]=function(_0x1d0b0a,_0x2c4f08){return db[_0x5378('0x28')][_0x5378('0x41')](_0x1d0b0a[_0x5378('0x42')],{})[_0x5378('0x21')](respondWithResult(_0x2c4f08,0xc9))['catch'](handleError(_0x2c4f08,null));};exports[_0x5378('0x20')]=function(_0x1bb0ea,_0x436e82){if(_0x1bb0ea['body']['id']){delete _0x1bb0ea[_0x5378('0x42')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x1bb0ea[_0x5378('0x3e')]['id']}})[_0x5378('0x21')](handleEntityNotFound(_0x436e82,null))[_0x5378('0x21')](saveUpdates(_0x1bb0ea[_0x5378('0x42')],null))[_0x5378('0x21')](respondWithResult(_0x436e82,null))[_0x5378('0x40')](handleError(_0x436e82,null));};exports['destroy']=function(_0x964d89,_0x8c71ff){return db[_0x5378('0x28')]['find']({'where':{'id':_0x964d89[_0x5378('0x3e')]['id']}})['then'](handleEntityNotFound(_0x8c71ff,null))['then'](removeEntity(_0x8c71ff,null))[_0x5378('0x40')](handleError(_0x8c71ff,null));}; \ No newline at end of file +var _0xc8e6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelApplication','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x2a0b43,_0x5f2607){var _0x518006=function(_0x3fb3b6){while(--_0x3fb3b6){_0x2a0b43['push'](_0x2a0b43['shift']());}};_0x518006(++_0x5f2607);}(_0xc8e6,0xc9));var _0x6c8e=function(_0x41fed8,_0x168adf){_0x41fed8=_0x41fed8-0x0;var _0x5d6c66=_0xc8e6[_0x41fed8];return _0x5d6c66;};'use strict';var emlformat=require(_0x6c8e('0x0'));var rimraf=require(_0x6c8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c8e('0x2'));var rp=require('request-promise');var moment=require(_0x6c8e('0x3'));var BPromise=require(_0x6c8e('0x4'));var Mustache=require('mustache');var util=require(_0x6c8e('0x5'));var path=require(_0x6c8e('0x6'));var sox=require('sox');var csv=require(_0x6c8e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c8e('0x8'));var _=require('lodash');var squel=require(_0x6c8e('0x9'));var crypto=require(_0x6c8e('0xa'));var jsforce=require(_0x6c8e('0xb'));var deskjs=require(_0x6c8e('0xc'));var toCsv=require(_0x6c8e('0x7'));var querystring=require('querystring');var Papa=require(_0x6c8e('0xd'));var Redis=require('ioredis');var authService=require(_0x6c8e('0xe'));var qs=require(_0x6c8e('0xf'));var as=require(_0x6c8e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c8e('0x11'))(_0x6c8e('0x12'));var utils=require(_0x6c8e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6c8e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ea0a5,_0x5e6924){_0x5e6924=_0x5e6924||0xcc;return function(_0x26bf10){if(_0x26bf10){return _0x5ea0a5[_0x6c8e('0x15')](_0x5e6924);}return _0x5ea0a5[_0x6c8e('0x16')](_0x5e6924)[_0x6c8e('0x17')]();};}function respondWithResult(_0xf886dd,_0xed4ebc){_0xed4ebc=_0xed4ebc||0xc8;return function(_0x4f115a){if(_0x4f115a){return _0xf886dd[_0x6c8e('0x16')](_0xed4ebc)[_0x6c8e('0x18')](_0x4f115a);}};}function respondWithFilteredResult(_0x917ff9,_0x355adc){return function(_0x40cd27){if(_0x40cd27){var _0x78590a=typeof _0x355adc[_0x6c8e('0x19')]===_0x6c8e('0x1a')&&typeof _0x355adc[_0x6c8e('0x1b')]===_0x6c8e('0x1a');var _0x3187f0=_0x40cd27[_0x6c8e('0x1c')];var _0x4ab7da=_0x78590a?0x0:_0x355adc[_0x6c8e('0x19')];var _0x2233dc=_0x78590a?_0x40cd27[_0x6c8e('0x1c')]:_0x355adc[_0x6c8e('0x19')]+_0x355adc[_0x6c8e('0x1b')];var _0x33de56;if(_0x2233dc>=_0x3187f0){_0x2233dc=_0x3187f0;_0x33de56=0xc8;}else{_0x33de56=0xce;}_0x917ff9[_0x6c8e('0x16')](_0x33de56);return _0x917ff9[_0x6c8e('0x1d')](_0x6c8e('0x1e'),_0x4ab7da+'-'+_0x2233dc+'/'+_0x3187f0)['json'](_0x40cd27);}return null;};}function patchUpdates(_0x38c306){return function(_0x24c467){try{jsonpatch[_0x6c8e('0x1f')](_0x24c467,_0x38c306,!![]);}catch(_0x228116){return BPromise[_0x6c8e('0x20')](_0x228116);}return _0x24c467[_0x6c8e('0x21')]();};}function saveUpdates(_0x1a6ff7,_0x5ca1ff){return function(_0x25c3aa){if(_0x25c3aa){return _0x25c3aa[_0x6c8e('0x22')](_0x1a6ff7)['then'](function(_0x341206){return _0x341206;});}return null;};}function removeEntity(_0x6ccae5,_0x73304){return function(_0xd927d0){if(_0xd927d0){return _0xd927d0[_0x6c8e('0x23')]()[_0x6c8e('0x24')](function(){_0x6ccae5['status'](0xcc)[_0x6c8e('0x17')]();});}};}function handleEntityNotFound(_0x54e14c,_0x5ac50e){return function(_0xfa5988){if(!_0xfa5988){_0x54e14c[_0x6c8e('0x15')](0x194);}return _0xfa5988;};}function handleError(_0x35e86c,_0x4b9129){_0x4b9129=_0x4b9129||0x1f4;return function(_0x14e53d){logger[_0x6c8e('0x25')](_0x14e53d[_0x6c8e('0x26')]);if(_0x14e53d[_0x6c8e('0x27')]){delete _0x14e53d[_0x6c8e('0x27')];}_0x35e86c[_0x6c8e('0x16')](_0x4b9129)['send'](_0x14e53d);};}exports[_0x6c8e('0x28')]=function(_0x42eba7,_0x26dd58){var _0x42ca59={},_0x552b10={},_0x2cf778={'count':0x0,'rows':[]};var _0xf85b49=_[_0x6c8e('0x29')](db[_0x6c8e('0x2a')]['rawAttributes'],function(_0x52ce4a){return{'name':_0x52ce4a[_0x6c8e('0x2b')],'type':_0x52ce4a[_0x6c8e('0x2c')]['key']};});_0x552b10[_0x6c8e('0x2d')]=_[_0x6c8e('0x29')](_0xf85b49,_0x6c8e('0x27'));_0x552b10[_0x6c8e('0x2e')]=_[_0x6c8e('0x2f')](_0x42eba7['query']);_0x552b10[_0x6c8e('0x30')]=_['intersection'](_0x552b10[_0x6c8e('0x2d')],_0x552b10[_0x6c8e('0x2e')]);_0x42ca59[_0x6c8e('0x31')]=_[_0x6c8e('0x32')](_0x552b10[_0x6c8e('0x2d')],qs[_0x6c8e('0x33')](_0x42eba7[_0x6c8e('0x2e')]['fields']));_0x42ca59[_0x6c8e('0x31')]=_0x42ca59['attributes']['length']?_0x42ca59[_0x6c8e('0x31')]:_0x552b10[_0x6c8e('0x2d')];if(!_0x42eba7[_0x6c8e('0x2e')][_0x6c8e('0x34')](_0x6c8e('0x35'))){_0x42ca59[_0x6c8e('0x1b')]=qs[_0x6c8e('0x1b')](_0x42eba7[_0x6c8e('0x2e')][_0x6c8e('0x1b')]);_0x42ca59[_0x6c8e('0x19')]=qs['offset'](_0x42eba7[_0x6c8e('0x2e')][_0x6c8e('0x19')]);}_0x42ca59['order']=qs[_0x6c8e('0x36')](_0x42eba7[_0x6c8e('0x2e')][_0x6c8e('0x36')]);_0x42ca59[_0x6c8e('0x37')]=qs[_0x6c8e('0x30')](_[_0x6c8e('0x38')](_0x42eba7['query'],_0x552b10[_0x6c8e('0x30')]),_0xf85b49);if(_0x42eba7['query'][_0x6c8e('0x39')]){_0x42ca59[_0x6c8e('0x37')]=_[_0x6c8e('0x3a')](_0x42ca59[_0x6c8e('0x37')],{'$or':_[_0x6c8e('0x29')](_0xf85b49,function(_0x4f4369){if(_0x4f4369[_0x6c8e('0x2c')]!==_0x6c8e('0x3b')){var _0x329d3b={};_0x329d3b[_0x4f4369[_0x6c8e('0x27')]]={'$like':'%'+_0x42eba7[_0x6c8e('0x2e')]['filter']+'%'};return _0x329d3b;}})});}_0x42ca59=_['merge']({},_0x42ca59,_0x42eba7[_0x6c8e('0x3c')]);var _0x3cf36b={'where':_0x42ca59['where']};return db[_0x6c8e('0x2a')][_0x6c8e('0x1c')](_0x3cf36b)['then'](function(_0x79d8d8){_0x2cf778[_0x6c8e('0x1c')]=_0x79d8d8;if(_0x42eba7['query'][_0x6c8e('0x3d')]){_0x42ca59[_0x6c8e('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x6c8e('0x3f')](_0x42ca59);})[_0x6c8e('0x24')](function(_0x316f6d){_0x2cf778[_0x6c8e('0x40')]=_0x316f6d;return _0x2cf778;})[_0x6c8e('0x24')](respondWithFilteredResult(_0x26dd58,_0x42ca59))[_0x6c8e('0x41')](handleError(_0x26dd58,null));};exports[_0x6c8e('0x42')]=function(_0x2b5b7d,_0x20f61a){var _0x13ac80={'raw':!![],'where':{'id':_0x2b5b7d[_0x6c8e('0x43')]['id']}},_0xb1a44e={};_0xb1a44e[_0x6c8e('0x2d')]=_[_0x6c8e('0x2f')](db[_0x6c8e('0x2a')]['rawAttributes']);_0xb1a44e[_0x6c8e('0x2e')]=_['keys'](_0x2b5b7d[_0x6c8e('0x2e')]);_0xb1a44e[_0x6c8e('0x30')]=_['intersection'](_0xb1a44e[_0x6c8e('0x2d')],_0xb1a44e[_0x6c8e('0x2e')]);_0x13ac80[_0x6c8e('0x31')]=_[_0x6c8e('0x32')](_0xb1a44e['model'],qs[_0x6c8e('0x33')](_0x2b5b7d[_0x6c8e('0x2e')][_0x6c8e('0x33')]));_0x13ac80['attributes']=_0x13ac80['attributes'][_0x6c8e('0x44')]?_0x13ac80[_0x6c8e('0x31')]:_0xb1a44e[_0x6c8e('0x2d')];if(_0x2b5b7d[_0x6c8e('0x2e')][_0x6c8e('0x3d')]){_0x13ac80[_0x6c8e('0x3e')]=[{'all':!![]}];}_0x13ac80=_[_0x6c8e('0x3a')]({},_0x13ac80,_0x2b5b7d[_0x6c8e('0x3c')]);return db[_0x6c8e('0x2a')][_0x6c8e('0x45')](_0x13ac80)[_0x6c8e('0x24')](handleEntityNotFound(_0x20f61a,null))[_0x6c8e('0x24')](respondWithResult(_0x20f61a,null))[_0x6c8e('0x41')](handleError(_0x20f61a,null));};exports[_0x6c8e('0x46')]=function(_0x196527,_0x1a9ad7){return db['OpenchannelApplication'][_0x6c8e('0x46')](_0x196527[_0x6c8e('0x47')],{})[_0x6c8e('0x24')](respondWithResult(_0x1a9ad7,0xc9))[_0x6c8e('0x41')](handleError(_0x1a9ad7,null));};exports[_0x6c8e('0x22')]=function(_0x376aa9,_0x2236c5){if(_0x376aa9[_0x6c8e('0x47')]['id']){delete _0x376aa9[_0x6c8e('0x47')]['id'];}return db[_0x6c8e('0x2a')]['find']({'where':{'id':_0x376aa9[_0x6c8e('0x43')]['id']}})['then'](handleEntityNotFound(_0x2236c5,null))[_0x6c8e('0x24')](saveUpdates(_0x376aa9['body'],null))['then'](respondWithResult(_0x2236c5,null))[_0x6c8e('0x41')](handleError(_0x2236c5,null));};exports[_0x6c8e('0x23')]=function(_0x100fa9,_0xa8ee94){return db[_0x6c8e('0x2a')]['find']({'where':{'id':_0x100fa9['params']['id']}})[_0x6c8e('0x24')](handleEntityNotFound(_0xa8ee94,null))[_0x6c8e('0x24')](removeEntity(_0xa8ee94,null))[_0x6c8e('0x41')](handleError(_0xa8ee94,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9da7a34..94b6e91 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 _0xb3eb=['exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x4976eb,_0x4b09d1){var _0x5dd7b2=function(_0x4556a2){while(--_0x4556a2){_0x4976eb['push'](_0x4976eb['shift']());}};_0x5dd7b2(++_0x4b09d1);}(_0xb3eb,0x191));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbb3e('0x0'));var util=require(_0xbb3e('0x1'));var logger=require(_0xbb3e('0x2'))(_0xbb3e('0x3'));var moment=require(_0xbb3e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb3e('0x5'));var rimraf=require('rimraf');var config=require(_0xbb3e('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xbb3e('0x7')]=function(_0x5a46ba,_0x3cb763){return _0x5a46ba['define'](_0xbb3e('0x8'),attributes,{'tableName':_0xbb3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb3e('0xa'),'collate':_0xbb3e('0xb')});}; \ No newline at end of file +var _0x5ec9=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x5cb5df,_0x59388f){var _0x30cf67=function(_0x2962d0){while(--_0x2962d0){_0x5cb5df['push'](_0x5cb5df['shift']());}};_0x30cf67(++_0x59388f);}(_0x5ec9,0x1a4));var _0x95ec=function(_0x118caa,_0x4745ef){_0x118caa=_0x118caa-0x0;var _0x459d54=_0x5ec9[_0x118caa];return _0x459d54;};'use strict';var _=require(_0x95ec('0x0'));var util=require(_0x95ec('0x1'));var logger=require(_0x95ec('0x2'))(_0x95ec('0x3'));var moment=require(_0x95ec('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x95ec('0x5'));var rimraf=require('rimraf');var config=require(_0x95ec('0x6'));var attributes=require(_0x95ec('0x7'));module[_0x95ec('0x8')]=function(_0xd8a9bf,_0x5c1013){return _0xd8a9bf['define'](_0x95ec('0x9'),attributes,{'tableName':_0x95ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95ec('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ae34530..c8f9dbb 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 _0x3fd7=['raw','where','attributes','then','UpdateOpenchannelApplication','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','update','body','options'];(function(_0x3e0705,_0x19b779){var _0x588036=function(_0x55a00a){while(--_0x55a00a){_0x3e0705['push'](_0x3e0705['shift']());}};_0x588036(++_0x19b779);}(_0x3fd7,0x146));var _0x73fd=function(_0x4a944e,_0x194c7f){_0x4a944e=_0x4a944e-0x0;var _0x335e8d=_0x3fd7[_0x4a944e];return _0x335e8d;};'use strict';var _=require(_0x73fd('0x0'));var util=require('util');var moment=require(_0x73fd('0x1'));var BPromise=require(_0x73fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73fd('0x3'));var db=require(_0x73fd('0x4'))['db'];var utils=require(_0x73fd('0x5'));var logger=require(_0x73fd('0x6'))(_0x73fd('0x7'));var config=require(_0x73fd('0x8'));var jayson=require(_0x73fd('0x9'));var client=jayson[_0x73fd('0xa')][_0x73fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf3c6f1,_0x18d2c2,_0x16caad){return new BPromise(function(_0x3da175,_0x55355b){return client[_0x73fd('0xc')](_0xf3c6f1,_0x16caad)['then'](function(_0x49aaf4){logger[_0x73fd('0xd')](_0x73fd('0xe'),_0x18d2c2,_0x73fd('0xf'));logger[_0x73fd('0x10')](_0x73fd('0x11'),_0x18d2c2,'request\x20sent',JSON[_0x73fd('0x12')](_0x49aaf4));if(_0x49aaf4[_0x73fd('0x13')]){if(_0x49aaf4[_0x73fd('0x13')][_0x73fd('0x14')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x18d2c2,_0x49aaf4[_0x73fd('0x13')]['message']);return _0x55355b(_0x49aaf4['error'][_0x73fd('0x15')]);}logger['error'](_0x73fd('0xe'),_0x18d2c2,_0x49aaf4['error'][_0x73fd('0x15')]);return _0x3da175(_0x49aaf4[_0x73fd('0x13')][_0x73fd('0x15')]);}else{logger[_0x73fd('0xd')](_0x73fd('0xe'),_0x18d2c2,'request\x20sent');_0x3da175(_0x49aaf4[_0x73fd('0x16')][_0x73fd('0x15')]);}})['catch'](function(_0x896c79){logger[_0x73fd('0x13')](_0x73fd('0xe'),_0x18d2c2,_0x896c79);_0x55355b(_0x896c79);});});}exports['UpdateOpenchannelApplication']=function(_0x4f0333){var _0x5284d4=this;return new Promise(function(_0x121286,_0x1d14c0){return db['OpenchannelApplication'][_0x73fd('0x17')](_0x4f0333[_0x73fd('0x18')],{'raw':_0x4f0333[_0x73fd('0x19')]?_0x4f0333[_0x73fd('0x19')][_0x73fd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f0333[_0x73fd('0x19')]?_0x4f0333['options'][_0x73fd('0x1b')]||null:null,'attributes':_0x4f0333[_0x73fd('0x19')]?_0x4f0333[_0x73fd('0x19')][_0x73fd('0x1c')]||null:null,'limit':_0x4f0333[_0x73fd('0x19')]?_0x4f0333['options']['limit']||null:null})[_0x73fd('0x1d')](function(_0x45d4f7){logger[_0x73fd('0xd')](_0x73fd('0x1e'),_0x4f0333);logger[_0x73fd('0x10')](_0x73fd('0x1e'),_0x4f0333,JSON['stringify'](_0x45d4f7));_0x121286(_0x45d4f7);})[_0x73fd('0x1f')](function(_0x3ce70c){logger[_0x73fd('0x13')](_0x73fd('0x1e'),_0x3ce70c[_0x73fd('0x15')],_0x4f0333);_0x1d14c0(_0x5284d4[_0x73fd('0x13')](0x1f4,_0x3ce70c[_0x73fd('0x15')]));});});}; \ No newline at end of file +var _0x741f=['error','code','message','info','UpdateOpenchannelApplication','OpenchannelApplication','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x334712,_0x7c77fb){var _0x3c508d=function(_0x55bdd2){while(--_0x55bdd2){_0x334712['push'](_0x334712['shift']());}};_0x3c508d(++_0x7c77fb);}(_0x741f,0xdd));var _0xf741=function(_0x4c47ea,_0xceb50f){_0x4c47ea=_0x4c47ea-0x0;var _0x4657aa=_0x741f[_0x4c47ea];return _0x4657aa;};'use strict';var _=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var moment=require(_0xf741('0x2'));var BPromise=require(_0xf741('0x3'));var rs=require(_0xf741('0x4'));var fs=require('fs');var Redis=require(_0xf741('0x5'));var db=require(_0xf741('0x6'))['db'];var utils=require(_0xf741('0x7'));var logger=require(_0xf741('0x8'))(_0xf741('0x9'));var config=require(_0xf741('0xa'));var jayson=require(_0xf741('0xb'));var client=jayson[_0xf741('0xc')][_0xf741('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x225312,_0x5e2f54,_0x449d62){return new BPromise(function(_0x36d468,_0x536558){return client['request'](_0x225312,_0x449d62)[_0xf741('0xe')](function(_0xc0ca7){logger['info'](_0xf741('0xf'),_0x5e2f54,_0xf741('0x10'));logger[_0xf741('0x11')](_0xf741('0x12'),_0x5e2f54,_0xf741('0x10'),JSON['stringify'](_0xc0ca7));if(_0xc0ca7[_0xf741('0x13')]){if(_0xc0ca7[_0xf741('0x13')][_0xf741('0x14')]===0x1f4){logger[_0xf741('0x13')](_0xf741('0xf'),_0x5e2f54,_0xc0ca7['error'][_0xf741('0x15')]);return _0x536558(_0xc0ca7[_0xf741('0x13')][_0xf741('0x15')]);}logger[_0xf741('0x13')](_0xf741('0xf'),_0x5e2f54,_0xc0ca7[_0xf741('0x13')][_0xf741('0x15')]);return _0x36d468(_0xc0ca7['error']['message']);}else{logger[_0xf741('0x16')](_0xf741('0xf'),_0x5e2f54,'request\x20sent');_0x36d468(_0xc0ca7['result'][_0xf741('0x15')]);}})['catch'](function(_0x2f7282){logger['error'](_0xf741('0xf'),_0x5e2f54,_0x2f7282);_0x536558(_0x2f7282);});});}exports[_0xf741('0x17')]=function(_0x4b2278){var _0xcc8d58=this;return new Promise(function(_0x355aed,_0x4032ef){return db[_0xf741('0x18')]['update'](_0x4b2278['body'],{'raw':_0x4b2278[_0xf741('0x19')]?_0x4b2278[_0xf741('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2278[_0xf741('0x19')]?_0x4b2278[_0xf741('0x19')][_0xf741('0x1a')]||null:null,'attributes':_0x4b2278[_0xf741('0x19')]?_0x4b2278[_0xf741('0x19')][_0xf741('0x1b')]||null:null,'limit':_0x4b2278[_0xf741('0x19')]?_0x4b2278[_0xf741('0x19')][_0xf741('0x1c')]||null:null})[_0xf741('0xe')](function(_0x466abe){logger['info']('UpdateOpenchannelApplication',_0x4b2278);logger[_0xf741('0x11')](_0xf741('0x17'),_0x4b2278,JSON[_0xf741('0x1d')](_0x466abe));_0x355aed(_0x466abe);})['catch'](function(_0x41fc7e){logger['error'](_0xf741('0x17'),_0x41fc7e[_0xf741('0x15')],_0x4b2278);_0x4032ef(_0xcc8d58['error'](0x1f4,_0x41fc7e[_0xf741('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 02c0e29..c0f2488 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 _0xccde=['show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x35f035,_0x4e66c6){var _0x1b4ef3=function(_0x401d41){while(--_0x401d41){_0x35f035['push'](_0x35f035['shift']());}};_0x1b4ef3(++_0x4e66c6);}(_0xccde,0x7a));var _0xeccd=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xccde[_0x210718];return _0x541bfc;};'use strict';var multer=require(_0xeccd('0x0'));var util=require('util');var path=require(_0xeccd('0x1'));var timeout=require(_0xeccd('0x2'));var express=require(_0xeccd('0x3'));var router=express[_0xeccd('0x4')]();var fs_extra=require(_0xeccd('0x5'));var auth=require(_0xeccd('0x6'));var interaction=require(_0xeccd('0x7'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xeccd('0x8')]);router[_0xeccd('0x9')](_0xeccd('0xa'),auth[_0xeccd('0xb')](),controller[_0xeccd('0xc')]);router[_0xeccd('0x9')](_0xeccd('0xd'),auth[_0xeccd('0xb')](),controller[_0xeccd('0xe')]);router[_0xeccd('0x9')](_0xeccd('0xf'),auth[_0xeccd('0xb')](),controller[_0xeccd('0x10')]);router['get']('/:id/download',auth[_0xeccd('0xb')](),controller[_0xeccd('0x11')]);router[_0xeccd('0x12')]('/',auth[_0xeccd('0xb')](),controller[_0xeccd('0x13')]);router['post'](_0xeccd('0xf'),auth['isAuthenticated'](),controller[_0xeccd('0x14')]);router[_0xeccd('0x12')](_0xeccd('0x15'),auth['isAuthenticated'](),interaction[_0xeccd('0x16')](_0xeccd('0x17'),_0xeccd('0x18')),controller[_0xeccd('0x19')]);router[_0xeccd('0x1a')](_0xeccd('0xd'),auth['isAuthenticated'](),interaction[_0xeccd('0x16')](_0xeccd('0x17'),_0xeccd('0x1b')),controller[_0xeccd('0x1c')]);router[_0xeccd('0x1d')](_0xeccd('0xd'),auth[_0xeccd('0xb')](),interaction[_0xeccd('0x16')]('openchannel',_0xeccd('0x1e')),controller[_0xeccd('0x1f')]);router['delete'](_0xeccd('0x15'),auth[_0xeccd('0xb')](),controller[_0xeccd('0x20')]);module[_0xeccd('0x21')]=router; \ No newline at end of file +var _0x2470=['express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','addTags','put','openchannelinteraction:update','openchannel','destroy','delete','removeTags','exports','multer','connect-timeout'];(function(_0x1671c9,_0x4640d3){var _0x15b4ba=function(_0x1ef552){while(--_0x1ef552){_0x1671c9['push'](_0x1671c9['shift']());}};_0x15b4ba(++_0x4640d3);}(_0x2470,0x178));var _0x0247=function(_0xf71d79,_0x2754fd){_0xf71d79=_0xf71d79-0x0;var _0x475fab=_0x2470[_0xf71d79];return _0x475fab;};'use strict';var multer=require(_0x0247('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0247('0x1'));var express=require(_0x0247('0x2'));var router=express[_0x0247('0x3')]();var fs_extra=require(_0x0247('0x4'));var auth=require(_0x0247('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0247('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x0247('0x7')](),controller['index']);router[_0x0247('0x8')]('/describe',auth[_0x0247('0x7')](),controller[_0x0247('0x9')]);router[_0x0247('0x8')](_0x0247('0xa'),auth[_0x0247('0x7')](),controller['show']);router[_0x0247('0x8')]('/:id/messages',auth[_0x0247('0x7')](),controller[_0x0247('0xb')]);router['get'](_0x0247('0xc'),auth['isAuthenticated'](),controller[_0x0247('0xd')]);router[_0x0247('0xe')]('/',auth[_0x0247('0x7')](),controller[_0x0247('0xf')]);router['post'](_0x0247('0x10'),auth[_0x0247('0x7')](),controller['addMessage']);router[_0x0247('0xe')](_0x0247('0x11'),auth[_0x0247('0x7')](),interaction[_0x0247('0x12')]('openchannel','openchannelinteraction:addtags'),controller[_0x0247('0x13')]);router[_0x0247('0x14')]('/:id',auth[_0x0247('0x7')](),interaction['tracked']('openchannel',_0x0247('0x15')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x0247('0x12')](_0x0247('0x16'),'openchannelinteraction:destroy'),controller[_0x0247('0x17')]);router[_0x0247('0x18')]('/:id/tags',auth[_0x0247('0x7')](),controller[_0x0247('0x19')]);module[_0x0247('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 8ebc028..ec9ca86 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 _0x86e7=['INTEGER','sequelize','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x18c6a6,_0x496186){var _0x4250b3=function(_0x25bfe9){while(--_0x25bfe9){_0x18c6a6['push'](_0x18c6a6['shift']());}};_0x4250b3(++_0x496186);}(_0x86e7,0xf1));var _0x786e=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x86e7[_0x28aea5];return _0x6a55f9;};'use strict';var Sequelize=require(_0x786e('0x0'));module[_0x786e('0x1')]={'closed':{'type':Sequelize[_0x786e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x786e('0x3')]},'secondDisposition':{'type':Sequelize[_0x786e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x786e('0x3')]},'read1stAt':{'type':Sequelize[_0x786e('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x786e('0x5')]('in',_0x786e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x786e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x786e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x786e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x786e('0x7')]}}; \ No newline at end of file +var _0xbff2=['DATE','STRING','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x2a7d82,_0x2b85ed){var _0x582606=function(_0xfeb256){while(--_0xfeb256){_0x2a7d82['push'](_0x2a7d82['shift']());}};_0x582606(++_0x2b85ed);}(_0xbff2,0x10e));var _0x2bff=function(_0x491b23,_0x2e3281){_0x491b23=_0x491b23-0x0;var _0x427a21=_0xbff2[_0x491b23];return _0x427a21;};'use strict';var Sequelize=require(_0x2bff('0x0'));module[_0x2bff('0x1')]={'closed':{'type':Sequelize[_0x2bff('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2bff('0x3')]},'disposition':{'type':Sequelize[_0x2bff('0x4')]},'secondDisposition':{'type':Sequelize[_0x2bff('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2bff('0x4')]},'note':{'type':Sequelize[_0x2bff('0x4')]},'read1stAt':{'type':Sequelize[_0x2bff('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x2bff('0x4')]},'lastMsgAt':{'type':Sequelize[_0x2bff('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2bff('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2bff('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x2bff('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index de4712a..c3b5a17 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 _0x6a04=['Private','basename','existsSync','createWriteStream','createdAt','direction','out','System','Contact','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','destroy','error','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','user','catch','show','query','from','params','keys','filters','intersection','model','attributes','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','rawAttributes','fields','length','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','setTags','omit','spread','Tag','emit','removeTags','download','unix','toString','join','server','files','tmp','attachments','format','push','User','firstName','lastName','Attachment','secret','read','OpenchannelAccount','Account','Owner','fullname','Openchannel','N.A.','closed','closedAt','disposition','threadId'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0x6a04,0x182));var _0x46a0=function(_0x33c029,_0x5b3ef7){_0x33c029=_0x33c029-0x0;var _0x55c208=_0x6a04[_0x33c029];return _0x55c208;};'use strict';var rimraf=require(_0x46a0('0x0'));var zipdir=require(_0x46a0('0x1'));var moment=require(_0x46a0('0x2'));var util=require(_0x46a0('0x3'));var path=require(_0x46a0('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x46a0('0x5'));var Redis=require(_0x46a0('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x46a0('0x7'));var pdf=require(_0x46a0('0x8'));var logger=require('../../config/logger')(_0x46a0('0x9'));var config=require(_0x46a0('0xa'));var db=require(_0x46a0('0xb'))['db'];config[_0x46a0('0xc')]=_['defaults'](config[_0x46a0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x46a0('0xd'))(new Redis(config[_0x46a0('0xc')]));require(_0x46a0('0xe'))['register'](socket);function respondWithStatusCode(_0x328071,_0x502a92){_0x502a92=_0x502a92||0xcc;return function(_0x2084a8){if(_0x2084a8){return _0x328071[_0x46a0('0xf')](_0x502a92);}return _0x328071[_0x46a0('0x10')](_0x502a92)[_0x46a0('0x11')]();};}function respondWithResult(_0xee4d10,_0x949222){_0x949222=_0x949222||0xc8;return function(_0x2f0ba8){if(_0x2f0ba8){return _0xee4d10[_0x46a0('0x10')](_0x949222)[_0x46a0('0x12')](_0x2f0ba8);}};}function respondWithFilteredResult(_0x47dcce,_0x10b4a1){return function(_0x3e5bca){if(_0x3e5bca){var _0x4613a8=typeof _0x10b4a1['offset']==='undefined'&&typeof _0x10b4a1[_0x46a0('0x13')]==='undefined';var _0x778c94=_0x3e5bca[_0x46a0('0x14')];var _0x5d756c=_0x4613a8?0x0:_0x10b4a1[_0x46a0('0x15')];var _0x8fbd2e=_0x4613a8?_0x3e5bca[_0x46a0('0x14')]:_0x10b4a1['offset']+_0x10b4a1[_0x46a0('0x13')];var _0x110edf;if(_0x8fbd2e>=_0x778c94){_0x8fbd2e=_0x778c94;_0x110edf=0xc8;}else{_0x110edf=0xce;}_0x47dcce[_0x46a0('0x10')](_0x110edf);return _0x47dcce[_0x46a0('0x16')](_0x46a0('0x17'),_0x5d756c+'-'+_0x8fbd2e+'/'+_0x778c94)[_0x46a0('0x12')](_0x3e5bca);}return null;};}function saveUpdates(_0x513c95){return function(_0x4c0fa5){if(_0x4c0fa5){return _0x4c0fa5[_0x46a0('0x18')](_0x513c95)[_0x46a0('0x19')](function(_0x554ecf){return _0x554ecf;});}return null;};}function removeEntity(_0x364210){return function(_0x5a6ecc){if(_0x5a6ecc){return _0x5a6ecc[_0x46a0('0x1a')]()[_0x46a0('0x19')](function(){_0x364210[_0x46a0('0x10')](0xcc)[_0x46a0('0x11')]();});}};}function handleEntityNotFound(_0x37b3d1){return function(_0x39cc88){if(!_0x39cc88){_0x37b3d1[_0x46a0('0xf')](0x194);}return _0x39cc88;};}function handleError(_0x23462e,_0x5310a2){_0x5310a2=_0x5310a2||0x1f4;return function(_0x38f34a){logger[_0x46a0('0x1b')](_0x38f34a['stack']);if(_0x38f34a[_0x46a0('0x1c')]){delete _0x38f34a['name'];}_0x23462e['status'](_0x5310a2)[_0x46a0('0x1d')](_0x38f34a);};}exports[_0x46a0('0x1e')]=function(_0x570a46,_0x283fcd){var _0xd0e4ca={};var _0x173abc=_[_0x46a0('0x1f')](db[_0x46a0('0x20')]['rawAttributes'],function(_0x50fdec){return{'name':_0x50fdec[_0x46a0('0x21')],'type':_0x50fdec[_0x46a0('0x22')][_0x46a0('0x23')]};});_0xd0e4ca=qs[_0x46a0('0x24')](_0x173abc,_0x570a46);return interaction[_0x46a0('0x25')](_0x46a0('0x26'),_0x570a46['query'],_0x570a46[_0x46a0('0x27')],_0xd0e4ca,_0x173abc)[_0x46a0('0x19')](respondWithFilteredResult(_0x283fcd,_0xd0e4ca))[_0x46a0('0x28')](handleError(_0x283fcd,null));};exports[_0x46a0('0x29')]=function(_0x56e392,_0x1aeefb){var _0x451795={};if(_0x56e392[_0x46a0('0x2a')]['type']&&_0x56e392['query']['type']===_0x46a0('0x2b')){_0x451795[_0x46a0('0x2b')]=_0x56e392[_0x46a0('0x2c')]['id'];}else{_0x451795['id']=_0x56e392[_0x46a0('0x2c')]['id'];}var _0x2a0c11={'raw':![],'where':_0x451795},_0x2cd253={};_0x2cd253['model']=_[_0x46a0('0x2d')](db[_0x46a0('0x20')]['rawAttributes']);_0x2cd253[_0x46a0('0x2a')]=_[_0x46a0('0x2d')](_0x56e392[_0x46a0('0x2a')]);_0x2cd253[_0x46a0('0x2e')]=_[_0x46a0('0x2f')](_0x2cd253[_0x46a0('0x30')],_0x2cd253[_0x46a0('0x2a')]);_0x2a0c11[_0x46a0('0x31')]=_[_0x46a0('0x2f')](_0x2cd253[_0x46a0('0x30')],qs['fields'](_0x56e392[_0x46a0('0x2a')]['fields']));_0x2a0c11['attributes']=_0x2a0c11[_0x46a0('0x31')]['length']?_0x2a0c11['attributes']:_0x2cd253[_0x46a0('0x30')];if(_0x56e392[_0x46a0('0x2a')][_0x46a0('0x32')]){_0x2a0c11[_0x46a0('0x33')]=[{'all':!![]}];}_0x2a0c11=_[_0x46a0('0x34')]({},_0x2a0c11,_0x56e392[_0x46a0('0x35')]);return db['OpenchannelInteraction'][_0x46a0('0x36')](_0x2a0c11)[_0x46a0('0x19')](handleEntityNotFound(_0x1aeefb,null))['then'](respondWithResult(_0x1aeefb,null))[_0x46a0('0x28')](handleError(_0x1aeefb,null));};exports['create']=function(_0x47fa3c,_0x38b250){return db['OpenchannelInteraction'][_0x46a0('0x37')](_0x47fa3c['body'],{})[_0x46a0('0x19')](respondWithResult(_0x38b250,0xc9))[_0x46a0('0x28')](handleError(_0x38b250,null));};exports[_0x46a0('0x18')]=function(_0x22a710,_0xd5cae9){if(_0x22a710[_0x46a0('0x38')]['id']){delete _0x22a710[_0x46a0('0x38')]['id'];}return db[_0x46a0('0x20')][_0x46a0('0x36')]({'where':{'id':_0x22a710[_0x46a0('0x2c')]['id']}})['then'](handleEntityNotFound(_0xd5cae9,null))[_0x46a0('0x19')](saveUpdates(_0x22a710[_0x46a0('0x38')],null))[_0x46a0('0x19')](respondWithResult(_0xd5cae9,null))[_0x46a0('0x28')](handleError(_0xd5cae9,null));};exports[_0x46a0('0x1a')]=function(_0x335f14,_0x174640){return db[_0x46a0('0x20')][_0x46a0('0x36')]({'where':{'id':_0x335f14[_0x46a0('0x2c')]['id']}})[_0x46a0('0x19')](handleEntityNotFound(_0x174640,null))['then'](removeEntity(_0x174640,null))['catch'](handleError(_0x174640,null));};exports[_0x46a0('0x39')]=function(_0x54f73e,_0x368262){return db[_0x46a0('0x20')]['describe']()[_0x46a0('0x19')](respondWithResult(_0x368262,null))[_0x46a0('0x28')](handleError(_0x368262,null));};exports[_0x46a0('0x3a')]=function(_0x533062,_0x360e5c){return db[_0x46a0('0x3b')][_0x46a0('0x36')]({'where':{'id':_0x533062[_0x46a0('0x2c')]['id']}})[_0x46a0('0x19')](handleEntityNotFound(_0x360e5c,null))[_0x46a0('0x19')](function(_0x1db3be){if(_0x1db3be){return _0x1db3be[_0x46a0('0x3a')](_0x533062['body']['ids'],_['omit'](_0x533062[_0x46a0('0x38')],[_0x46a0('0x3c'),'id'])||{});}})[_0x46a0('0x19')](respondWithResult(_0x360e5c,null))[_0x46a0('0x28')](handleError(_0x360e5c,null));};exports[_0x46a0('0x3d')]=function(_0x14ec66,_0xdb1586){var _0x3a125e={'raw':![],'where':{}};var _0x418a49={};var _0x4d4978={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x46a0('0x3e')]({'where':{'id':_0x14ec66['params']['id']}})[_0x46a0('0x19')](handleEntityNotFound(_0xdb1586,null))[_0x46a0('0x19')](function(_0x318cba){if(_0x318cba){_0x418a49[_0x46a0('0x30')]=_[_0x46a0('0x2d')](db[_0x46a0('0x3b')][_0x46a0('0x3f')]);_0x418a49['query']=_[_0x46a0('0x2d')](_0x14ec66['query']);_0x418a49[_0x46a0('0x2e')]=_[_0x46a0('0x2f')](_0x418a49['model'],_0x418a49[_0x46a0('0x2a')]);_0x3a125e[_0x46a0('0x31')]=_['intersection'](_0x418a49[_0x46a0('0x30')],qs[_0x46a0('0x40')](_0x14ec66[_0x46a0('0x2a')][_0x46a0('0x40')]));_0x3a125e[_0x46a0('0x31')]=_0x3a125e[_0x46a0('0x31')][_0x46a0('0x41')]?_0x3a125e[_0x46a0('0x31')]:_0x418a49[_0x46a0('0x30')];if(!_0x14ec66[_0x46a0('0x2a')]['hasOwnProperty'](_0x46a0('0x42'))){_0x3a125e['limit']=qs['limit'](_0x14ec66[_0x46a0('0x2a')][_0x46a0('0x13')]);_0x3a125e[_0x46a0('0x15')]=qs[_0x46a0('0x15')](_0x14ec66[_0x46a0('0x2a')]['offset']);}_0x3a125e[_0x46a0('0x43')]=qs[_0x46a0('0x44')](_0x14ec66['query'][_0x46a0('0x44')]);_0x3a125e[_0x46a0('0x45')]=qs['filters'](_['pick'](_0x14ec66[_0x46a0('0x2a')],_0x418a49['filters']));_0x3a125e[_0x46a0('0x45')][_0x46a0('0x46')]=_0x318cba['id'];if(_0x14ec66[_0x46a0('0x2a')]['filter']){_0x3a125e[_0x46a0('0x45')]=_[_0x46a0('0x34')](_0x3a125e[_0x46a0('0x45')],{'$or':_[_0x46a0('0x1f')](_0x3a125e[_0x46a0('0x31')],function(_0x466c37){var _0x2466ad={};_0x2466ad[_0x466c37]={'$like':'%'+_0x14ec66['query'][_0x46a0('0x47')]+'%'};return _0x2466ad;})});}if(_0x14ec66[_0x46a0('0x2a')][_0x46a0('0x48')]){var _0x57ac22=_0x14ec66['query'][_0x46a0('0x48')]['split'](',');var _0x517445={};_0x517445[_0x57ac22[0x0]]={'$gte':moment(_0x57ac22[0x1])['format'](_0x46a0('0x49'))};_0x3a125e[_0x46a0('0x45')]=_['merge'](_0x3a125e[_0x46a0('0x45')],_0x517445);}_0x3a125e=_[_0x46a0('0x34')]({},_0x3a125e,_0x14ec66[_0x46a0('0x35')]);return db['OpenchannelMessage'][_0x46a0('0x14')]({'where':_0x3a125e[_0x46a0('0x45')]})['then'](function(_0xd68521){_0x4d4978[_0x46a0('0x14')]=_0xd68521;if(_0x14ec66[_0x46a0('0x2a')][_0x46a0('0x32')]){_0x3a125e[_0x46a0('0x33')]=[{'all':!![]}];}return db[_0x46a0('0x3b')][_0x46a0('0x25')](_0x3a125e);})[_0x46a0('0x19')](function(_0x4a85d1){_0x4d4978['rows']=_0x4a85d1;return _0x4d4978;});}})[_0x46a0('0x19')](respondWithFilteredResult(_0xdb1586,_0x3a125e))['catch'](handleError(_0xdb1586,null));};exports['addTags']=function(_0x500d44,_0x1193c2){return db['OpenchannelInteraction'][_0x46a0('0x36')]({'where':{'id':_0x500d44['params']['id']}})[_0x46a0('0x19')](handleEntityNotFound(_0x1193c2,null))[_0x46a0('0x19')](function(_0x4f422d){if(_0x4f422d){return _0x4f422d[_0x46a0('0x4a')](_0x500d44[_0x46a0('0x38')]['ids'],_[_0x46a0('0x4b')](_0x500d44[_0x46a0('0x38')],[_0x46a0('0x3c'),'id'])||{})[_0x46a0('0x4c')](function(){return db[_0x46a0('0x4d')][_0x46a0('0x25')]({'attributes':['id',_0x46a0('0x1c'),'color'],'where':{'id':_0x500d44[_0x46a0('0x38')]['ids']}});})[_0x46a0('0x19')](function(_0x1d9888){socket[_0x46a0('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x500d44[_0x46a0('0x2c')]['id']),'tags':_0x1d9888||[]});return{'id':Number(_0x500d44[_0x46a0('0x2c')]['id']),'tags':_0x1d9888||[]};});}})[_0x46a0('0x19')](respondWithResult(_0x1193c2,null))[_0x46a0('0x28')](handleError(_0x1193c2,null));};exports[_0x46a0('0x4f')]=function(_0x5ed364,_0x331ceb){return db['OpenchannelInteraction'][_0x46a0('0x36')]({'where':{'id':_0x5ed364[_0x46a0('0x2c')]['id']}})[_0x46a0('0x19')](handleEntityNotFound(_0x331ceb,null))['then'](function(_0x31ebee){if(_0x31ebee){return _0x31ebee[_0x46a0('0x4f')](_0x5ed364[_0x46a0('0x2a')][_0x46a0('0x3c')]);}})[_0x46a0('0x19')](respondWithStatusCode(_0x331ceb,null))['catch'](handleError(_0x331ceb,null));};exports[_0x46a0('0x50')]=function(_0x463abb,_0xccf626){var _0x5ea45a=moment()[_0x46a0('0x51')]()[_0x46a0('0x52')]();var _0xb68a5f=path[_0x46a0('0x53')](config['root'],_0x46a0('0x54'),_0x46a0('0x55'),_0x46a0('0x56'));var _0x544750=path['join'](config['root'],_0x46a0('0x54'),_0x46a0('0x55'),_0x46a0('0x57'));var _0x16d85b=path[_0x46a0('0x53')](_0xb68a5f,_0x5ea45a);var _0x1d2dba=util[_0x46a0('0x58')]('transcript-%d-%s.zip',_0x463abb[_0x46a0('0x2c')]['id'],_0x5ea45a);var _0x5cf555=path[_0x46a0('0x53')](_0xb68a5f,_0x1d2dba);var _0x440658=[];_0x440658[_0x46a0('0x59')]({'model':db[_0x46a0('0x5a')],'as':_0x46a0('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x440658[_0x46a0('0x59')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x46a0('0x5b'),_0x46a0('0x5c')],'raw':!![]});if(_0x463abb[_0x46a0('0x2a')][_0x46a0('0x57')]){_0x440658[_0x46a0('0x59')]({'model':db['Attachment'],'as':_0x46a0('0x5d'),'raw':!![]});}var _0x17485d=[{'model':db[_0x46a0('0x3b')],'as':'Messages','attributes':['id',_0x46a0('0x38'),'createdAt','direction',_0x46a0('0x5e'),_0x46a0('0x5f')],'include':_0x440658}];_0x17485d['push']({'model':db[_0x46a0('0x60')],'as':_0x46a0('0x61'),'attributes':['id',_0x46a0('0x1c')]});_0x17485d['push']({'model':db[_0x46a0('0x5a')],'as':_0x46a0('0x62'),'attributes':['id',_0x46a0('0x63')]});return db[_0x46a0('0x20')][_0x46a0('0x36')]({'where':{'id':_0x463abb[_0x46a0('0x2c')]['id']},'include':_0x17485d})[_0x46a0('0x19')](handleEntityNotFound(_0xccf626,null))[_0x46a0('0x19')](function(_0x30a333){if(_0x30a333){var _0x1f3c00=_0x30a333['get']({'plain':!![]});fs['mkdirSync'](_0x16d85b);var _0x3b8f77={'channel':_0x46a0('0x64'),'account':_0x1f3c00[_0x46a0('0x61')][_0x46a0('0x1c')],'agent':_0x1f3c00[_0x46a0('0x62')]?_0x1f3c00['Owner'][_0x46a0('0x63')]:_0x46a0('0x65'),'createdAt':moment(_0x1f3c00['createdAt'])[_0x46a0('0x58')](_0x46a0('0x49'))[_0x46a0('0x52')](),'closedAt':_0x1f3c00[_0x46a0('0x66')]?moment(_0x1f3c00[_0x46a0('0x67')])[_0x46a0('0x58')](_0x46a0('0x49'))[_0x46a0('0x52')]():'','disposition':_0x1f3c00[_0x46a0('0x68')],'visibility':_0x1f3c00[_0x46a0('0x69')]?'Public':_0x46a0('0x6a'),'messages':_(_0x1f3c00['Messages'])['filter']({'secret':![]})[_0x46a0('0x1f')](function(_0x5916cd){if(_0x5916cd[_0x46a0('0x5d')]){var _0x464965=path[_0x46a0('0x53')](_0x544750,_0x5916cd[_0x46a0('0x5d')][_0x46a0('0x6b')]);if(fs[_0x46a0('0x6c')](_0x464965)){fs['createReadStream'](_0x464965)['pipe'](fs[_0x46a0('0x6d')](path[_0x46a0('0x53')](_0x16d85b,_0x5916cd[_0x46a0('0x5d')][_0x46a0('0x6b')])));}}return{'date':moment(_0x5916cd[_0x46a0('0x6e')])['format'](_0x46a0('0x49'))['toString'](),'sender':_0x5916cd[_0x46a0('0x6f')]===_0x46a0('0x70')?_0x5916cd[_0x46a0('0x5a')]?_0x5916cd[_0x46a0('0x5a')]['fullname']:_0x46a0('0x71'):_0x5916cd['Contact']['firstName']+(_0x5916cd['Contact'][_0x46a0('0x5c')]?'\x20'+_0x5916cd[_0x46a0('0x72')][_0x46a0('0x5c')]:''),'body':_0x5916cd[_0x46a0('0x5d')]?_0x5916cd[_0x46a0('0x5d')][_0x46a0('0x6b')]:_0x5916cd['body'],'direction':_0x5916cd[_0x46a0('0x6f')]===_0x46a0('0x70')?'A':'C','secret':_0x5916cd[_0x46a0('0x5e')],'read':_0x5916cd[_0x46a0('0x5f')],'attachment':_0x5916cd[_0x46a0('0x5d')]};})[_0x46a0('0x73')]()};return ejs[_0x46a0('0x74')](path[_0x46a0('0x53')](config[_0x46a0('0x75')],_0x46a0('0x54'),_0x46a0('0x76'),_0x46a0('0x77')),{'interaction':_0x3b8f77})['then'](function(_0x7941e4){var _0xc7e460=path[_0x46a0('0x53')](_0x16d85b,_0x46a0('0x78')+_0x1f3c00['id']+'-'+_0x5ea45a+_0x46a0('0x79'));var _0x5744e4={'path':_0xc7e460,'channel':'Openchannel','interactionId':_0x1f3c00['id']};return pdf[_0x46a0('0x7a')](_0x7941e4,_0x5744e4);})['then'](function(){return new Promise(function(_0x140759,_0x2e8a8a){zipdir(_0x16d85b,{'saveTo':_0x5cf555},function(_0x2ddb99,_0xced3ea){if(_0x2ddb99)return _0x2e8a8a(_0x2ddb99);return _0x140759(_0xced3ea);});})[_0x46a0('0x19')](function(){return new Promise(function(_0x4e1ac3,_0x20608c){rimraf(_0x16d85b,function(_0x11a7bc){if(_0x11a7bc)_0x20608c(_0x11a7bc);return _0x4e1ac3();});});})[_0x46a0('0x19')](function(){return _0xccf626[_0x46a0('0x50')](_0x5cf555,_0x1d2dba,function(_0xa66c9c){if(_0xa66c9c){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0xa66c9c);}else{fs['unlinkSync'](_0x5cf555);}});});});}else{return _0xccf626['sendStatus'](0xc8);}})[_0x46a0('0x28')](handleError(_0xccf626,null));}; \ No newline at end of file +var _0x2738=['set','Content-Range','then','end','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','openchannel','query','catch','type','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','destroy','describe','addMessage','OpenchannelMessage','omit','ids','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','findAll','name','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','push','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','User','get','Openchannel','Owner','closed','closedAt','toString','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','System','firstName','out','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count'];(function(_0x1e4405,_0x32e468){var _0x560557=function(_0x3f1e84){while(--_0x3f1e84){_0x1e4405['push'](_0x1e4405['shift']());}};_0x560557(++_0x32e468);}(_0x2738,0x6a));var _0x8273=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2738[_0x4b7895];return _0x264180;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x8273('0x0'));var moment=require(_0x8273('0x1'));var util=require(_0x8273('0x2'));var path=require(_0x8273('0x3'));var ejs=require(_0x8273('0x4'));var fs=require('fs');var _=require(_0x8273('0x5'));var Redis=require('ioredis');var interaction=require(_0x8273('0x6'));var qs=require(_0x8273('0x7'));var pdf=require(_0x8273('0x8'));var logger=require(_0x8273('0x9'))(_0x8273('0xa'));var config=require(_0x8273('0xb'));var db=require(_0x8273('0xc'))['db'];config[_0x8273('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8273('0xe'))(new Redis(config[_0x8273('0xd')]));require(_0x8273('0xf'))[_0x8273('0x10')](socket);function respondWithStatusCode(_0x41171f,_0xb9e7f9){_0xb9e7f9=_0xb9e7f9||0xcc;return function(_0x57b8bd){if(_0x57b8bd){return _0x41171f[_0x8273('0x11')](_0xb9e7f9);}return _0x41171f[_0x8273('0x12')](_0xb9e7f9)['end']();};}function respondWithResult(_0x50c628,_0x519ab7){_0x519ab7=_0x519ab7||0xc8;return function(_0x1f6f87){if(_0x1f6f87){return _0x50c628[_0x8273('0x12')](_0x519ab7)['json'](_0x1f6f87);}};}function respondWithFilteredResult(_0x35758c,_0x8c2ced){return function(_0x4abf83){if(_0x4abf83){var _0x291fed=typeof _0x8c2ced[_0x8273('0x13')]===_0x8273('0x14')&&typeof _0x8c2ced[_0x8273('0x15')]===_0x8273('0x14');var _0x64703a=_0x4abf83[_0x8273('0x16')];var _0x37dedc=_0x291fed?0x0:_0x8c2ced[_0x8273('0x13')];var _0x377f12=_0x291fed?_0x4abf83[_0x8273('0x16')]:_0x8c2ced['offset']+_0x8c2ced[_0x8273('0x15')];var _0x2bc678;if(_0x377f12>=_0x64703a){_0x377f12=_0x64703a;_0x2bc678=0xc8;}else{_0x2bc678=0xce;}_0x35758c['status'](_0x2bc678);return _0x35758c[_0x8273('0x17')](_0x8273('0x18'),_0x37dedc+'-'+_0x377f12+'/'+_0x64703a)['json'](_0x4abf83);}return null;};}function saveUpdates(_0xf9308b){return function(_0x3b3858){if(_0x3b3858){return _0x3b3858['update'](_0xf9308b)['then'](function(_0x410ca3){return _0x410ca3;});}return null;};}function removeEntity(_0x4243ac){return function(_0x16c9b4){if(_0x16c9b4){return _0x16c9b4['destroy']()[_0x8273('0x19')](function(){_0x4243ac[_0x8273('0x12')](0xcc)[_0x8273('0x1a')]();});}};}function handleEntityNotFound(_0x1f0eaf){return function(_0x2cf4ec){if(!_0x2cf4ec){_0x1f0eaf[_0x8273('0x11')](0x194);}return _0x2cf4ec;};}function handleError(_0x390386,_0x1775dd){_0x1775dd=_0x1775dd||0x1f4;return function(_0x41b77a){logger[_0x8273('0x1b')](_0x41b77a[_0x8273('0x1c')]);if(_0x41b77a['name']){delete _0x41b77a['name'];}_0x390386[_0x8273('0x12')](_0x1775dd)[_0x8273('0x1d')](_0x41b77a);};}exports[_0x8273('0x1e')]=function(_0x306168,_0x55aa4c){var _0x75bb58={};var _0xbf751c=_[_0x8273('0x1f')](db['OpenchannelInteraction'][_0x8273('0x20')],function(_0x3469cf){return{'name':_0x3469cf[_0x8273('0x21')],'type':_0x3469cf['type'][_0x8273('0x22')]};});_0x75bb58=qs[_0x8273('0x23')](_0xbf751c,_0x306168);return interaction['findAll'](_0x8273('0x24'),_0x306168[_0x8273('0x25')],_0x306168['user'],_0x75bb58,_0xbf751c)[_0x8273('0x19')](respondWithFilteredResult(_0x55aa4c,_0x75bb58))[_0x8273('0x26')](handleError(_0x55aa4c,null));};exports['show']=function(_0x28916b,_0x37f430){var _0x474c91={};if(_0x28916b[_0x8273('0x25')]['type']&&_0x28916b[_0x8273('0x25')][_0x8273('0x27')]===_0x8273('0x28')){_0x474c91[_0x8273('0x28')]=_0x28916b[_0x8273('0x29')]['id'];}else{_0x474c91['id']=_0x28916b[_0x8273('0x29')]['id'];}var _0x2e18e4={'raw':![],'where':_0x474c91},_0x171f2d={};_0x171f2d[_0x8273('0x2a')]=_[_0x8273('0x2b')](db[_0x8273('0x2c')][_0x8273('0x20')]);_0x171f2d[_0x8273('0x25')]=_['keys'](_0x28916b[_0x8273('0x25')]);_0x171f2d[_0x8273('0x2d')]=_[_0x8273('0x2e')](_0x171f2d['model'],_0x171f2d[_0x8273('0x25')]);_0x2e18e4[_0x8273('0x2f')]=_['intersection'](_0x171f2d[_0x8273('0x2a')],qs[_0x8273('0x30')](_0x28916b[_0x8273('0x25')][_0x8273('0x30')]));_0x2e18e4[_0x8273('0x2f')]=_0x2e18e4['attributes'][_0x8273('0x31')]?_0x2e18e4[_0x8273('0x2f')]:_0x171f2d['model'];if(_0x28916b[_0x8273('0x25')][_0x8273('0x32')]){_0x2e18e4[_0x8273('0x33')]=[{'all':!![]}];}_0x2e18e4=_[_0x8273('0x34')]({},_0x2e18e4,_0x28916b[_0x8273('0x35')]);return db[_0x8273('0x2c')][_0x8273('0x36')](_0x2e18e4)[_0x8273('0x19')](handleEntityNotFound(_0x37f430,null))[_0x8273('0x19')](respondWithResult(_0x37f430,null))[_0x8273('0x26')](handleError(_0x37f430,null));};exports[_0x8273('0x37')]=function(_0xf3cdd3,_0x2884c4){return db['OpenchannelInteraction']['create'](_0xf3cdd3[_0x8273('0x38')],{})[_0x8273('0x19')](respondWithResult(_0x2884c4,0xc9))[_0x8273('0x26')](handleError(_0x2884c4,null));};exports[_0x8273('0x39')]=function(_0x7024e3,_0x3d9e26){if(_0x7024e3['body']['id']){delete _0x7024e3[_0x8273('0x38')]['id'];}return db[_0x8273('0x2c')][_0x8273('0x36')]({'where':{'id':_0x7024e3[_0x8273('0x29')]['id']}})[_0x8273('0x19')](handleEntityNotFound(_0x3d9e26,null))['then'](saveUpdates(_0x7024e3[_0x8273('0x38')],null))[_0x8273('0x19')](respondWithResult(_0x3d9e26,null))[_0x8273('0x26')](handleError(_0x3d9e26,null));};exports[_0x8273('0x3a')]=function(_0x594b6b,_0x50ce0d){return db[_0x8273('0x2c')][_0x8273('0x36')]({'where':{'id':_0x594b6b[_0x8273('0x29')]['id']}})[_0x8273('0x19')](handleEntityNotFound(_0x50ce0d,null))[_0x8273('0x19')](removeEntity(_0x50ce0d,null))[_0x8273('0x26')](handleError(_0x50ce0d,null));};exports[_0x8273('0x3b')]=function(_0x9d2d62,_0x4200c6){return db[_0x8273('0x2c')][_0x8273('0x3b')]()['then'](respondWithResult(_0x4200c6,null))['catch'](handleError(_0x4200c6,null));};exports[_0x8273('0x3c')]=function(_0x5992b1,_0x1b3224){return db[_0x8273('0x3d')][_0x8273('0x36')]({'where':{'id':_0x5992b1['params']['id']}})[_0x8273('0x19')](handleEntityNotFound(_0x1b3224,null))['then'](function(_0x58426a){if(_0x58426a){return _0x58426a['addMessage'](_0x5992b1[_0x8273('0x38')]['ids'],_[_0x8273('0x3e')](_0x5992b1['body'],[_0x8273('0x3f'),'id'])||{});}})[_0x8273('0x19')](respondWithResult(_0x1b3224,null))[_0x8273('0x26')](handleError(_0x1b3224,null));};exports['getMessages']=function(_0x5218c5,_0x59c89f){var _0x414334={'raw':![],'where':{}};var _0x57b497={};var _0x39a2f7={'count':0x0,'rows':[]};return db[_0x8273('0x2c')]['findOne']({'where':{'id':_0x5218c5['params']['id']}})[_0x8273('0x19')](handleEntityNotFound(_0x59c89f,null))[_0x8273('0x19')](function(_0xbc8ffa){if(_0xbc8ffa){_0x57b497[_0x8273('0x2a')]=_['keys'](db[_0x8273('0x3d')][_0x8273('0x20')]);_0x57b497[_0x8273('0x25')]=_[_0x8273('0x2b')](_0x5218c5[_0x8273('0x25')]);_0x57b497[_0x8273('0x2d')]=_[_0x8273('0x2e')](_0x57b497[_0x8273('0x2a')],_0x57b497[_0x8273('0x25')]);_0x414334['attributes']=_[_0x8273('0x2e')](_0x57b497['model'],qs[_0x8273('0x30')](_0x5218c5[_0x8273('0x25')][_0x8273('0x30')]));_0x414334['attributes']=_0x414334[_0x8273('0x2f')][_0x8273('0x31')]?_0x414334['attributes']:_0x57b497[_0x8273('0x2a')];if(!_0x5218c5[_0x8273('0x25')][_0x8273('0x40')](_0x8273('0x41'))){_0x414334[_0x8273('0x15')]=qs[_0x8273('0x15')](_0x5218c5[_0x8273('0x25')][_0x8273('0x15')]);_0x414334[_0x8273('0x13')]=qs[_0x8273('0x13')](_0x5218c5[_0x8273('0x25')][_0x8273('0x13')]);}_0x414334[_0x8273('0x42')]=qs[_0x8273('0x43')](_0x5218c5[_0x8273('0x25')][_0x8273('0x43')]);_0x414334[_0x8273('0x44')]=qs[_0x8273('0x2d')](_[_0x8273('0x45')](_0x5218c5[_0x8273('0x25')],_0x57b497[_0x8273('0x2d')]));_0x414334['where'][_0x8273('0x46')]=_0xbc8ffa['id'];if(_0x5218c5['query'][_0x8273('0x47')]){_0x414334[_0x8273('0x44')]=_[_0x8273('0x34')](_0x414334[_0x8273('0x44')],{'$or':_[_0x8273('0x1f')](_0x414334[_0x8273('0x2f')],function(_0x22fb9a){var _0x238f0a={};_0x238f0a[_0x22fb9a]={'$like':'%'+_0x5218c5[_0x8273('0x25')][_0x8273('0x47')]+'%'};return _0x238f0a;})});}if(_0x5218c5['query'][_0x8273('0x48')]){var _0x50084c=_0x5218c5[_0x8273('0x25')]['$gte'][_0x8273('0x49')](',');var _0x4bf2b7={};_0x4bf2b7[_0x50084c[0x0]]={'$gte':moment(_0x50084c[0x1])[_0x8273('0x4a')](_0x8273('0x4b'))};_0x414334[_0x8273('0x44')]=_['merge'](_0x414334[_0x8273('0x44')],_0x4bf2b7);}_0x414334=_[_0x8273('0x34')]({},_0x414334,_0x5218c5[_0x8273('0x35')]);return db['OpenchannelMessage'][_0x8273('0x16')]({'where':_0x414334['where']})[_0x8273('0x19')](function(_0x30acd7){_0x39a2f7[_0x8273('0x16')]=_0x30acd7;if(_0x5218c5[_0x8273('0x25')][_0x8273('0x32')]){_0x414334[_0x8273('0x33')]=[{'all':!![]}];}return db[_0x8273('0x3d')]['findAll'](_0x414334);})[_0x8273('0x19')](function(_0x13a153){_0x39a2f7['rows']=_0x13a153;return _0x39a2f7;});}})[_0x8273('0x19')](respondWithFilteredResult(_0x59c89f,_0x414334))['catch'](handleError(_0x59c89f,null));};exports[_0x8273('0x4c')]=function(_0x15245d,_0x4a0ad3){return db[_0x8273('0x2c')][_0x8273('0x36')]({'where':{'id':_0x15245d[_0x8273('0x29')]['id']}})['then'](handleEntityNotFound(_0x4a0ad3,null))['then'](function(_0x5711e2){if(_0x5711e2){return _0x5711e2[_0x8273('0x4d')](_0x15245d[_0x8273('0x38')][_0x8273('0x3f')],_[_0x8273('0x3e')](_0x15245d[_0x8273('0x38')],[_0x8273('0x3f'),'id'])||{})[_0x8273('0x4e')](function(){return db[_0x8273('0x4f')][_0x8273('0x50')]({'attributes':['id',_0x8273('0x51'),_0x8273('0x52')],'where':{'id':_0x15245d[_0x8273('0x38')][_0x8273('0x3f')]}});})[_0x8273('0x19')](function(_0x12bb4e){socket[_0x8273('0x53')](_0x8273('0x54'),{'id':Number(_0x15245d['params']['id']),'tags':_0x12bb4e||[]});return{'id':Number(_0x15245d[_0x8273('0x29')]['id']),'tags':_0x12bb4e||[]};});}})[_0x8273('0x19')](respondWithResult(_0x4a0ad3,null))[_0x8273('0x26')](handleError(_0x4a0ad3,null));};exports[_0x8273('0x55')]=function(_0x5d3b8e,_0x434a10){return db[_0x8273('0x2c')][_0x8273('0x36')]({'where':{'id':_0x5d3b8e[_0x8273('0x29')]['id']}})['then'](handleEntityNotFound(_0x434a10,null))[_0x8273('0x19')](function(_0xe41d0b){if(_0xe41d0b){return _0xe41d0b['removeTags'](_0x5d3b8e[_0x8273('0x25')][_0x8273('0x3f')]);}})[_0x8273('0x19')](respondWithStatusCode(_0x434a10,null))[_0x8273('0x26')](handleError(_0x434a10,null));};exports[_0x8273('0x56')]=function(_0xb56a7,_0x5b7b63){var _0x210b5b=moment()[_0x8273('0x57')]()['toString']();var _0x2174da=path['join'](config[_0x8273('0x58')],_0x8273('0x59'),_0x8273('0x5a'),_0x8273('0x5b'));var _0x102b43=path['join'](config[_0x8273('0x58')],_0x8273('0x59'),_0x8273('0x5a'),'attachments');var _0x1c07a5=path[_0x8273('0x5c')](_0x2174da,_0x210b5b);var _0x203dc0=util[_0x8273('0x4a')](_0x8273('0x5d'),_0xb56a7[_0x8273('0x29')]['id'],_0x210b5b);var _0x169703=path['join'](_0x2174da,_0x203dc0);var _0x57b917=[];_0x57b917[_0x8273('0x5e')]({'model':db['User'],'as':'User','attributes':['id',_0x8273('0x5f')],'raw':!![]});_0x57b917[_0x8273('0x5e')]({'model':db[_0x8273('0x60')],'as':_0x8273('0x61'),'attributes':['id','firstName',_0x8273('0x62')],'raw':!![]});if(_0xb56a7[_0x8273('0x25')]['attachments']){_0x57b917[_0x8273('0x5e')]({'model':db[_0x8273('0x63')],'as':_0x8273('0x63'),'raw':!![]});}var _0x5b1ca3=[{'model':db[_0x8273('0x3d')],'as':_0x8273('0x64'),'attributes':['id',_0x8273('0x38'),_0x8273('0x65'),_0x8273('0x66'),'secret',_0x8273('0x67')],'include':_0x57b917}];_0x5b1ca3[_0x8273('0x5e')]({'model':db[_0x8273('0x68')],'as':_0x8273('0x69'),'attributes':['id','name']});_0x5b1ca3['push']({'model':db[_0x8273('0x6a')],'as':'Owner','attributes':['id',_0x8273('0x5f')]});return db[_0x8273('0x2c')]['find']({'where':{'id':_0xb56a7[_0x8273('0x29')]['id']},'include':_0x5b1ca3})['then'](handleEntityNotFound(_0x5b7b63,null))[_0x8273('0x19')](function(_0x1d66d7){if(_0x1d66d7){var _0x394d3e=_0x1d66d7[_0x8273('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x1c07a5);var _0x20b218={'channel':_0x8273('0x6c'),'account':_0x394d3e[_0x8273('0x69')]['name'],'agent':_0x394d3e[_0x8273('0x6d')]?_0x394d3e[_0x8273('0x6d')]['fullname']:'N.A.','createdAt':moment(_0x394d3e[_0x8273('0x65')])[_0x8273('0x4a')](_0x8273('0x4b'))['toString'](),'closedAt':_0x394d3e[_0x8273('0x6e')]?moment(_0x394d3e[_0x8273('0x6f')])['format'](_0x8273('0x4b'))[_0x8273('0x70')]():'','disposition':_0x394d3e[_0x8273('0x71')],'visibility':_0x394d3e[_0x8273('0x72')]?'Public':_0x8273('0x73'),'messages':_(_0x394d3e[_0x8273('0x64')])[_0x8273('0x47')]({'secret':![]})[_0x8273('0x1f')](function(_0x168189){if(_0x168189[_0x8273('0x63')]){var _0x5bbdae=path[_0x8273('0x5c')](_0x102b43,_0x168189[_0x8273('0x63')][_0x8273('0x74')]);if(fs[_0x8273('0x75')](_0x5bbdae)){fs[_0x8273('0x76')](_0x5bbdae)[_0x8273('0x77')](fs['createWriteStream'](path[_0x8273('0x5c')](_0x1c07a5,_0x168189[_0x8273('0x63')][_0x8273('0x74')])));}}return{'date':moment(_0x168189[_0x8273('0x65')])[_0x8273('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8273('0x70')](),'sender':_0x168189[_0x8273('0x66')]==='out'?_0x168189[_0x8273('0x6a')]?_0x168189[_0x8273('0x6a')]['fullname']:_0x8273('0x78'):_0x168189[_0x8273('0x61')][_0x8273('0x79')]+(_0x168189[_0x8273('0x61')][_0x8273('0x62')]?'\x20'+_0x168189[_0x8273('0x61')][_0x8273('0x62')]:''),'body':_0x168189['Attachment']?_0x168189[_0x8273('0x63')][_0x8273('0x74')]:_0x168189['body'],'direction':_0x168189[_0x8273('0x66')]===_0x8273('0x7a')?'A':'C','secret':_0x168189[_0x8273('0x7b')],'read':_0x168189['read'],'attachment':_0x168189[_0x8273('0x63')]};})['value']()};return ejs[_0x8273('0x7c')](path[_0x8273('0x5c')](config[_0x8273('0x58')],_0x8273('0x59'),'views',_0x8273('0x7d')),{'interaction':_0x20b218})[_0x8273('0x19')](function(_0x4cddda){var _0x1dbbee=path[_0x8273('0x5c')](_0x1c07a5,_0x8273('0x7e')+_0x394d3e['id']+'-'+_0x210b5b+_0x8273('0x7f'));var _0x85d0c3={'path':_0x1dbbee,'channel':_0x8273('0x6c'),'interactionId':_0x394d3e['id']};return pdf['createPdfFromHTML'](_0x4cddda,_0x85d0c3);})[_0x8273('0x19')](function(){return new Promise(function(_0x165169,_0x42bfaf){zipdir(_0x1c07a5,{'saveTo':_0x169703},function(_0x4504f6,_0x2129a6){if(_0x4504f6)return _0x42bfaf(_0x4504f6);return _0x165169(_0x2129a6);});})['then'](function(){return new Promise(function(_0x5783d0,_0x1f4e77){rimraf(_0x1c07a5,function(_0x5375ef){if(_0x5375ef)_0x1f4e77(_0x5375ef);return _0x5783d0();});});})[_0x8273('0x19')](function(){return _0x5b7b63[_0x8273('0x56')](_0x169703,_0x203dc0,function(_0xfd11c7){if(_0xfd11c7){logger[_0x8273('0x1b')](_0x8273('0x80'),_0xfd11c7);}else{fs['unlinkSync'](_0x169703);}});});});}else{return _0x5b7b63[_0x8273('0x11')](0xc8);}})['catch'](handleError(_0x5b7b63,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9a63f41..29f02ba 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 _0xe243=['unreadMessages','length','emit','catch','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue'];(function(_0x2ae939,_0x14c17c){var _0x5c1a8b=function(_0x71709c){while(--_0x71709c){_0x2ae939['push'](_0x2ae939['shift']());}};_0x5c1a8b(++_0x14c17c);}(_0xe243,0x116));var _0x3e24=function(_0xe3bbea,_0x3ae4d3){_0xe3bbea=_0xe3bbea-0x0;var _0x18713d=_0xe243[_0xe3bbea];return _0x18713d;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x3e24('0x0'))['db'][_0x3e24('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3e24('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e24('0x3'),'afterDestroy':_0x3e24('0x4')};function emitEvent(_0x5dc2db){return function(_0xa986c9,_0x412b38,_0x27b2b5){_0xa986c9[_0x3e24('0x5')]({'attributes':['id'],'raw':!![]})[_0x3e24('0x6')](function(_0x5a5a30){_0xa986c9['setDataValue'](_0x3e24('0x7'),_0x5a5a30['map'](function(_0x11ab32){return{'id':_0x11ab32['id']};}));return OpenchannelMessage[_0x3e24('0x8')]({'where':{'OpenchannelInteractionId':_0xa986c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3e24('0x6')](function(_0x5a656b){_0xa986c9[_0x3e24('0x9')](_0x3e24('0xa'),_0x5a656b[_0x3e24('0xb')]);OpenchannelInteractionEvents[_0x3e24('0xc')](_0x5dc2db+':'+_0xa986c9['id'],_0xa986c9);OpenchannelInteractionEvents[_0x3e24('0xc')](_0x5dc2db,_0xa986c9);_0x27b2b5(null);})[_0x3e24('0xd')](_0x27b2b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x3e24('0xe')](e,emitEvent(event));}}module[_0x3e24('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xac74=['remove','getUsers','setDataValue','Users','findAll','then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update'];(function(_0x5aab89,_0xda100d){var _0x184a2e=function(_0x39786a){while(--_0x39786a){_0x5aab89['push'](_0x5aab89['shift']());}};_0x184a2e(++_0xda100d);}(_0xac74,0xf9));var _0x4ac7=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0xac74[_0x1dc24d];return _0x5d7fb2;};'use strict';var EventEmitter=require(_0x4ac7('0x0'));var OpenchannelInteraction=require(_0x4ac7('0x1'))['db'][_0x4ac7('0x2')];var OpenchannelMessage=require(_0x4ac7('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4ac7('0x3')](0x0);var events={'afterCreate':_0x4ac7('0x4'),'afterUpdate':_0x4ac7('0x5'),'afterDestroy':_0x4ac7('0x6')};function emitEvent(_0x2594b3){return function(_0x3681f0,_0x21849b,_0xcb0c85){_0x3681f0[_0x4ac7('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x536fc9){_0x3681f0[_0x4ac7('0x8')](_0x4ac7('0x9'),_0x536fc9['map'](function(_0x5c1c5e){return{'id':_0x5c1c5e['id']};}));return OpenchannelMessage[_0x4ac7('0xa')]({'where':{'OpenchannelInteractionId':_0x3681f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4ac7('0xb')](function(_0xca97f6){_0x3681f0[_0x4ac7('0x8')]('unreadMessages',_0xca97f6[_0x4ac7('0xc')]);OpenchannelInteractionEvents[_0x4ac7('0xd')](_0x2594b3+':'+_0x3681f0['id'],_0x3681f0);OpenchannelInteractionEvents[_0x4ac7('0xd')](_0x2594b3,_0x3681f0);_0xcb0c85(null);})[_0x4ac7('0xe')](_0xcb0c85(null));};}for(var e in events){if(events[_0x4ac7('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x4ac7('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 88d1cb7..7652e81 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 _0x5111=['../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x43b6a4,_0x1450fe){var _0x436d4d=function(_0x360db1){while(--_0x360db1){_0x43b6a4['push'](_0x43b6a4['shift']());}};_0x436d4d(++_0x1450fe);}(_0x5111,0x1c9));var _0x1511=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5111[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x1511('0x0'));var logger=require(_0x1511('0x1'))('api');var moment=require(_0x1511('0x2'));var BPromise=require(_0x1511('0x3'));var rp=require(_0x1511('0x4'));var fs=require('fs');var path=require(_0x1511('0x5'));var rimraf=require(_0x1511('0x6'));var config=require(_0x1511('0x7'));var attributes=require(_0x1511('0x8'));module['exports']=function(_0x266530,_0x4dda76){return _0x266530[_0x1511('0x9')](_0x1511('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1511('0xb'),'collate':_0x1511('0xc'),'hooks':{'beforeUpdate':function(_0x10f2b0,_0x387093,_0x4b6af1){if(_0x10f2b0['changed'](_0x1511('0xd'))){_0x10f2b0[_0x1511('0xe')]=moment()[_0x1511('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b6af1(null,_0x10f2b0);}}});}; \ No newline at end of file +var _0x2e82=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xbf4f3b,_0x207818){var _0x240e9c=function(_0x1bad63){while(--_0x1bad63){_0xbf4f3b['push'](_0xbf4f3b['shift']());}};_0x240e9c(++_0x207818);}(_0x2e82,0x70));var _0x22e8=function(_0xf2531d,_0x3d2efc){_0xf2531d=_0xf2531d-0x0;var _0xd2b87f=_0x2e82[_0xf2531d];return _0xd2b87f;};'use strict';var _=require(_0x22e8('0x0'));var util=require('util');var logger=require(_0x22e8('0x1'))(_0x22e8('0x2'));var moment=require(_0x22e8('0x3'));var BPromise=require(_0x22e8('0x4'));var rp=require(_0x22e8('0x5'));var fs=require('fs');var path=require(_0x22e8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x22e8('0x7'));module[_0x22e8('0x8')]=function(_0x28cc2c,_0x2c9972){return _0x28cc2c[_0x22e8('0x9')](_0x22e8('0xa'),attributes,{'tableName':_0x22e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x22e8('0xc'),'hooks':{'beforeUpdate':function(_0x2b2d61,_0x2c46ba,_0x4f8e62){if(_0x2b2d61[_0x22e8('0xd')](_0x22e8('0xe'))){_0x2b2d61[_0x22e8('0xf')]=moment()[_0x22e8('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f8e62(null,_0x2b2d61);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 88b77df..b5a52f2 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 _0x4237=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','options','where','then','AddTagsToOpenchannelInteraction','OpenchannelInteraction','addTags','body','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','request\x20sent'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x4237,0x126));var _0x7423=function(_0x114744,_0x591d9a){_0x114744=_0x114744-0x0;var _0x9d713a=_0x4237[_0x114744];return _0x9d713a;};'use strict';var _=require('lodash');var util=require(_0x7423('0x0'));var moment=require(_0x7423('0x1'));var BPromise=require(_0x7423('0x2'));var rs=require(_0x7423('0x3'));var fs=require('fs');var Redis=require(_0x7423('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7423('0x5'));var logger=require(_0x7423('0x6'))('rpc');var config=require(_0x7423('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7423('0x8')]({'port':0x232a});config[_0x7423('0x9')]=_[_0x7423('0xa')](config[_0x7423('0x9')],{'host':_0x7423('0xb'),'port':0x18eb});var socket=require(_0x7423('0xc'))(new Redis(config['redis']));require(_0x7423('0xd'))[_0x7423('0xe')](socket);function respondWithRpcPromise(_0x5b7f7d,_0x129e4c,_0x2cdede){return new BPromise(function(_0x4f497e,_0x543614){return client[_0x7423('0xf')](_0x5b7f7d,_0x2cdede)['then'](function(_0x2c8a11){logger[_0x7423('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x129e4c,_0x7423('0x11'));logger[_0x7423('0x12')](_0x7423('0x13'),_0x129e4c,'request\x20sent',JSON[_0x7423('0x14')](_0x2c8a11));if(_0x2c8a11[_0x7423('0x15')]){if(_0x2c8a11[_0x7423('0x15')][_0x7423('0x16')]===0x1f4){logger['error'](_0x7423('0x17'),_0x129e4c,_0x2c8a11[_0x7423('0x15')]['message']);return _0x543614(_0x2c8a11[_0x7423('0x15')][_0x7423('0x18')]);}logger[_0x7423('0x15')](_0x7423('0x17'),_0x129e4c,_0x2c8a11[_0x7423('0x15')][_0x7423('0x18')]);return _0x4f497e(_0x2c8a11[_0x7423('0x15')][_0x7423('0x18')]);}else{logger[_0x7423('0x10')](_0x7423('0x17'),_0x129e4c,_0x7423('0x11'));_0x4f497e(_0x2c8a11[_0x7423('0x19')][_0x7423('0x18')]);}})[_0x7423('0x1a')](function(_0x424c91){logger['error'](_0x7423('0x17'),_0x129e4c,_0x424c91);_0x543614(_0x424c91);});});}exports[_0x7423('0x1b')]=function(_0x35cbf3){var _0x75b327=this;return new Promise(function(_0x587c85,_0x464563){return db['OpenchannelInteraction'][_0x7423('0x1c')](_0x35cbf3['body'],{'raw':_0x35cbf3[_0x7423('0x1d')]?_0x35cbf3[_0x7423('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35cbf3[_0x7423('0x1d')]?_0x35cbf3[_0x7423('0x1d')][_0x7423('0x1e')]||null:null,'attributes':_0x35cbf3[_0x7423('0x1d')]?_0x35cbf3[_0x7423('0x1d')]['attributes']||null:null,'limit':_0x35cbf3[_0x7423('0x1d')]?_0x35cbf3[_0x7423('0x1d')]['limit']||null:null})[_0x7423('0x1f')](function(_0x5864ad){logger['info']('UpdateOpenchannelInteraction',_0x35cbf3);logger[_0x7423('0x12')](_0x7423('0x1b'),_0x35cbf3,JSON['stringify'](_0x5864ad));_0x587c85(_0x5864ad);})[_0x7423('0x1a')](function(_0x233544){logger[_0x7423('0x15')](_0x7423('0x1b'),_0x233544['message'],_0x35cbf3);_0x464563(_0x75b327[_0x7423('0x15')](0x1f4,_0x233544[_0x7423('0x18')]));});});};exports[_0x7423('0x20')]=function(_0x2f360f){return new Promise(function(_0x25df63,_0x4e7c75){return db[_0x7423('0x21')]['find']({'where':_0x2f360f[_0x7423('0x1d')]?_0x2f360f[_0x7423('0x1d')][_0x7423('0x1e')]||null:null})[_0x7423('0x1f')](function(_0xd6a814){if(_0xd6a814){return _0xd6a814[_0x7423('0x22')](_0x2f360f[_0x7423('0x23')][_0x7423('0x24')],_[_0x7423('0x25')](_0x2f360f['body'],['ids','id'])||{});}})['spread'](function(_0x450677){logger[_0x7423('0x10')]('AddTags',_0x2f360f);logger[_0x7423('0x12')](_0x7423('0x26'),_0x2f360f,JSON[_0x7423('0x14')](_0x450677));_0x25df63(_0x450677);})[_0x7423('0x1a')](function(_0x3c0110){logger[_0x7423('0x15')](_0x7423('0x26'),_0x3c0110[_0x7423('0x18')],_0x2f360f);_0x4e7c75(_this[_0x7423('0x15')](0x1f4,_0x3c0110[_0x7423('0x18')]));});});}; \ No newline at end of file +var _0xd713=['code','message','catch','UpdateOpenchannelInteraction','update','body','options','where','attributes','limit','stringify','OpenchannelInteraction','find','ids','omit','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x1a5687,_0xc2188f){var _0x257d5c=function(_0x4a1783){while(--_0x4a1783){_0x1a5687['push'](_0x1a5687['shift']());}};_0x257d5c(++_0xc2188f);}(_0xd713,0x14b));var _0x3d71=function(_0x253f8d,_0x57c32d){_0x253f8d=_0x253f8d-0x0;var _0x3787fb=_0xd713[_0x253f8d];return _0x3787fb;};'use strict';var _=require('lodash');var util=require(_0x3d71('0x0'));var moment=require(_0x3d71('0x1'));var BPromise=require(_0x3d71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d71('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d71('0x4'));var logger=require(_0x3d71('0x5'))('rpc');var config=require(_0x3d71('0x6'));var jayson=require(_0x3d71('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x3d71('0x8')]=_['defaults'](config[_0x3d71('0x8')],{'host':_0x3d71('0x9'),'port':0x18eb});var socket=require(_0x3d71('0xa'))(new Redis(config[_0x3d71('0x8')]));require(_0x3d71('0xb'))['register'](socket);function respondWithRpcPromise(_0x5be358,_0x54f9f3,_0x54663f){return new BPromise(function(_0x29f1e6,_0x54b035){return client[_0x3d71('0xc')](_0x5be358,_0x54663f)[_0x3d71('0xd')](function(_0xff9acb){logger[_0x3d71('0xe')](_0x3d71('0xf'),_0x54f9f3,_0x3d71('0x10'));logger[_0x3d71('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x54f9f3,_0x3d71('0x10'),JSON['stringify'](_0xff9acb));if(_0xff9acb[_0x3d71('0x12')]){if(_0xff9acb[_0x3d71('0x12')][_0x3d71('0x13')]===0x1f4){logger[_0x3d71('0x12')](_0x3d71('0xf'),_0x54f9f3,_0xff9acb[_0x3d71('0x12')][_0x3d71('0x14')]);return _0x54b035(_0xff9acb[_0x3d71('0x12')][_0x3d71('0x14')]);}logger[_0x3d71('0x12')](_0x3d71('0xf'),_0x54f9f3,_0xff9acb[_0x3d71('0x12')][_0x3d71('0x14')]);return _0x29f1e6(_0xff9acb[_0x3d71('0x12')][_0x3d71('0x14')]);}else{logger[_0x3d71('0xe')](_0x3d71('0xf'),_0x54f9f3,_0x3d71('0x10'));_0x29f1e6(_0xff9acb['result'][_0x3d71('0x14')]);}})[_0x3d71('0x15')](function(_0xc7f9fb){logger['error'](_0x3d71('0xf'),_0x54f9f3,_0xc7f9fb);_0x54b035(_0xc7f9fb);});});}exports[_0x3d71('0x16')]=function(_0x5b6ea4){var _0x4958c=this;return new Promise(function(_0x3a1158,_0x50a5dc){return db['OpenchannelInteraction'][_0x3d71('0x17')](_0x5b6ea4[_0x3d71('0x18')],{'raw':_0x5b6ea4['options']?_0x5b6ea4[_0x3d71('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6ea4[_0x3d71('0x19')]?_0x5b6ea4[_0x3d71('0x19')][_0x3d71('0x1a')]||null:null,'attributes':_0x5b6ea4[_0x3d71('0x19')]?_0x5b6ea4['options'][_0x3d71('0x1b')]||null:null,'limit':_0x5b6ea4[_0x3d71('0x19')]?_0x5b6ea4[_0x3d71('0x19')][_0x3d71('0x1c')]||null:null})[_0x3d71('0xd')](function(_0x1ac1aa){logger[_0x3d71('0xe')](_0x3d71('0x16'),_0x5b6ea4);logger[_0x3d71('0x11')]('UpdateOpenchannelInteraction',_0x5b6ea4,JSON[_0x3d71('0x1d')](_0x1ac1aa));_0x3a1158(_0x1ac1aa);})[_0x3d71('0x15')](function(_0x48727e){logger[_0x3d71('0x12')](_0x3d71('0x16'),_0x48727e[_0x3d71('0x14')],_0x5b6ea4);_0x50a5dc(_0x4958c[_0x3d71('0x12')](0x1f4,_0x48727e[_0x3d71('0x14')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xbef409){return new Promise(function(_0x13a138,_0x65276c){return db[_0x3d71('0x1e')][_0x3d71('0x1f')]({'where':_0xbef409['options']?_0xbef409[_0x3d71('0x19')]['where']||null:null})['then'](function(_0x41ac91){if(_0x41ac91){return _0x41ac91['addTags'](_0xbef409['body'][_0x3d71('0x20')],_[_0x3d71('0x21')](_0xbef409[_0x3d71('0x18')],[_0x3d71('0x20'),'id'])||{});}})['spread'](function(_0x32df9a){logger[_0x3d71('0xe')](_0x3d71('0x22'),_0xbef409);logger[_0x3d71('0x11')]('AddTags',_0xbef409,JSON['stringify'](_0x32df9a));_0x13a138(_0x32df9a);})[_0x3d71('0x15')](function(_0x1161c0){logger[_0x3d71('0x12')](_0x3d71('0x22'),_0x1161c0[_0x3d71('0x14')],_0xbef409);_0x65276c(_this['error'](0x1f4,_0x1161c0[_0x3d71('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3994fa4..3183b80 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 _0x673e=['./openchannelInteraction.events','save','update','emit','register','length'];(function(_0x7e3610,_0x48b77a){var _0x2d790b=function(_0x53181b){while(--_0x53181b){_0x7e3610['push'](_0x7e3610['shift']());}};_0x2d790b(++_0x48b77a);}(_0x673e,0x14a));var _0xe673=function(_0x2eba31,_0x11c277){_0x2eba31=_0x2eba31-0x0;var _0x8da89a=_0x673e[_0x2eba31];return _0x8da89a;};'use strict';var OpenchannelInteractionEvents=require(_0xe673('0x0'));var events=[_0xe673('0x1'),'remove',_0xe673('0x2')];function createListener(_0x1b0d9f,_0x3c5b9b){return function(_0x4caac2){_0x3c5b9b[_0xe673('0x3')](_0x1b0d9f,_0x4caac2);};}function removeListener(_0x55dfcf,_0x1355f3){return function(){OpenchannelInteractionEvents['removeListener'](_0x55dfcf,_0x1355f3);};}exports[_0xe673('0x4')]=function(_0x194073){for(var _0x50cfba=0x0,_0x524a53=events[_0xe673('0x5')];_0x50cfba<_0x524a53;_0x50cfba++){var _0x38ac3e=events[_0x50cfba];var _0x561a81=createListener('openchannelInteraction:'+_0x38ac3e,_0x194073);OpenchannelInteractionEvents['on'](_0x38ac3e,_0x561a81);}}; \ No newline at end of file +var _0xc93f=['emit','removeListener','length','save','remove'];(function(_0x1c8f43,_0x53a04f){var _0x5ce7dc=function(_0x19064e){while(--_0x19064e){_0x1c8f43['push'](_0x1c8f43['shift']());}};_0x5ce7dc(++_0x53a04f);}(_0xc93f,0x8a));var _0xfc93=function(_0x5cee5d,_0x371077){_0x5cee5d=_0x5cee5d-0x0;var _0x45b00c=_0xc93f[_0x5cee5d];return _0x45b00c;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xfc93('0x0'),_0xfc93('0x1'),'update'];function createListener(_0x57a0ef,_0x384d53){return function(_0x4475b8){_0x384d53[_0xfc93('0x2')](_0x57a0ef,_0x4475b8);};}function removeListener(_0x1cfce5,_0xa9cb9a){return function(){OpenchannelInteractionEvents[_0xfc93('0x3')](_0x1cfce5,_0xa9cb9a);};}exports['register']=function(_0x45a836){for(var _0x208049=0x0,_0x3699e9=events[_0xfc93('0x4')];_0x208049<_0x3699e9;_0x208049++){var _0x4b9661=events[_0x208049];var _0x5d05fa=createListener('openchannelInteraction:'+_0x4b9661,_0x45a836);OpenchannelInteractionEvents['on'](_0x4b9661,_0x5d05fa);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 69e9404..f8b0e9e 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2a41dd,_0x1bfba8){var _0x262b42=function(_0x4fab2d){while(--_0x4fab2d){_0x2a41dd['push'](_0x2a41dd['shift']());}};_0x262b42(++_0x1bfba8);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _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(_0xa8fce0,_0x8efdbb){var _0x5772af=function(_0x1288e0){while(--_0x1288e0){_0xa8fce0['push'](_0xa8fce0['shift']());}};_0x5772af(++_0x8efdbb);}(_0xe706,0xa3));var _0x6e70=function(_0x3645cc,_0x25ba47){_0x3645cc=_0x3645cc-0x0;var _0x351979=_0xe706[_0x3645cc];return _0x351979;};'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 e1cd19c..2251f6b 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 _0x34bd=['ENUM','out','DATE','TEXT','sequelize','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x34bd,0x1d2));var _0xd34b=function(_0xec74fe,_0x2dce88){_0xec74fe=_0xec74fe-0x0;var _0x50bda2=_0x34bd[_0xec74fe];return _0x50bda2;};'use strict';var Sequelize=require(_0xd34b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xd34b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd34b('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd34b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd34b('0x3')]('in',_0xd34b('0x4')),'defaultValue':_0xd34b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd34b('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd34b('0x6')]}}; \ No newline at end of file +var _0x6947=['STRING','TEXT','exports','medium','BOOLEAN','ENUM','DATE'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x6947,0x72));var _0x7694=function(_0x3e7387,_0x134738){_0x3e7387=_0x3e7387-0x0;var _0x3f9196=_0x6947[_0x3e7387];return _0x3f9196;};'use strict';var Sequelize=require('sequelize');module[_0x7694('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7694('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7694('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7694('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7694('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7694('0x4')]},'providerName':{'type':Sequelize[_0x7694('0x5')]},'providerResponse':{'type':Sequelize[_0x7694('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 35e8d86..e92f2dd 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 _0x82e3=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','contact','motionChannel','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send','index','map','OpenchannelMessage','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','create','body','find','describe','openchannel-interactions','accept','readAt'];(function(_0x42d9cf,_0x55f9bc){var _0x1e98fb=function(_0x5a2878){while(--_0x5a2878){_0x42d9cf['push'](_0x42d9cf['shift']());}};_0x1e98fb(++_0x55f9bc);}(_0x82e3,0x1aa));var _0x382e=function(_0x181204,_0x532d91){_0x181204=_0x181204-0x0;var _0x3a1544=_0x82e3[_0x181204];return _0x3a1544;};'use strict';var emlformat=require(_0x382e('0x0'));var rimraf=require(_0x382e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x382e('0x2'));var rp=require(_0x382e('0x3'));var moment=require(_0x382e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x382e('0x5'));var util=require(_0x382e('0x6'));var path=require('path');var sox=require(_0x382e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x382e('0x8'));var _=require('lodash');var squel=require(_0x382e('0x9'));var crypto=require(_0x382e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x382e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x382e('0xc'));var Papa=require(_0x382e('0xd'));var Redis=require('ioredis');var authService=require(_0x382e('0xe'));var qs=require(_0x382e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x382e('0x10'));var logger=require(_0x382e('0x11'))(_0x382e('0x12'));var utils=require(_0x382e('0x13'));var config=require(_0x382e('0x14'));var licenseUtil=require(_0x382e('0x15'));var db=require(_0x382e('0x16'))['db'];config[_0x382e('0x17')]=_[_0x382e('0x18')](config[_0x382e('0x17')],{'host':_0x382e('0x19'),'port':0x18eb});var socket=require(_0x382e('0x1a'))(new Redis(config['redis']));require(_0x382e('0x1b'))[_0x382e('0x1c')](socket);var jayson=require(_0x382e('0x1d'));var client=jayson['client'][_0x382e('0x1e')]({'port':0x232c});var client9002=jayson[_0x382e('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f90a7,_0xbb4e5a,_0x536bbd,_0x59d03a){return new BPromise(function(_0xa351f7,_0x1f768b){var _0x10598d=_0x59d03a||client;return _0x10598d[_0x382e('0x20')](_0x2f90a7,_0x536bbd)[_0x382e('0x21')](function(_0x456c1f){logger['info'](_0x382e('0x22'),_0xbb4e5a,_0x382e('0x23'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xbb4e5a,_0x382e('0x23'),JSON[_0x382e('0x24')](_0x456c1f));if(_0x456c1f[_0x382e('0x25')]){if(_0x456c1f[_0x382e('0x25')][_0x382e('0x26')]===0x1f4){logger[_0x382e('0x25')](_0x382e('0x22'),_0xbb4e5a,_0x456c1f[_0x382e('0x25')][_0x382e('0x27')]);return _0x1f768b(_0x456c1f[_0x382e('0x25')]['message']);}logger[_0x382e('0x25')](_0x382e('0x22'),_0xbb4e5a,_0x456c1f['error'][_0x382e('0x27')]);return _0xa351f7(_0x456c1f[_0x382e('0x25')][_0x382e('0x27')]);}else{logger[_0x382e('0x28')](_0x382e('0x22'),_0xbb4e5a,_0x382e('0x23'));_0xa351f7(_0x456c1f[_0x382e('0x29')]['message']);}})[_0x382e('0x2a')](function(_0x2567ef){logger[_0x382e('0x25')](_0x382e('0x22'),_0xbb4e5a,_0x2567ef);_0x1f768b(_0x2567ef);});});}function respondWithStatusCode(_0x3dc6ff,_0x12c3e1){_0x12c3e1=_0x12c3e1||0xcc;return function(_0x44ba4f){if(_0x44ba4f){return _0x3dc6ff[_0x382e('0x2b')](_0x12c3e1);}return _0x3dc6ff[_0x382e('0x2c')](_0x12c3e1)['end']();};}function respondWithResult(_0x1bb9e9,_0x68ccb3){_0x68ccb3=_0x68ccb3||0xc8;return function(_0x4c5e25){if(_0x4c5e25){return _0x1bb9e9['status'](_0x68ccb3)['json'](_0x4c5e25);}};}function respondWithFilteredResult(_0x50e9a9,_0x4cf124){return function(_0x3fa095){if(_0x3fa095){var _0x554a3a=typeof _0x4cf124[_0x382e('0x2d')]===_0x382e('0x2e')&&typeof _0x4cf124[_0x382e('0x2f')]==='undefined';var _0x1184ac=_0x3fa095['count'];var _0x48a09f=_0x554a3a?0x0:_0x4cf124[_0x382e('0x2d')];var _0x14e7ee=_0x554a3a?_0x3fa095[_0x382e('0x30')]:_0x4cf124[_0x382e('0x2d')]+_0x4cf124[_0x382e('0x2f')];var _0xc0daf9;if(_0x14e7ee>=_0x1184ac){_0x14e7ee=_0x1184ac;_0xc0daf9=0xc8;}else{_0xc0daf9=0xce;}_0x50e9a9[_0x382e('0x2c')](_0xc0daf9);return _0x50e9a9[_0x382e('0x31')](_0x382e('0x32'),_0x48a09f+'-'+_0x14e7ee+'/'+_0x1184ac)[_0x382e('0x33')](_0x3fa095);}return null;};}function patchUpdates(_0x52121a){return function(_0x297709){try{jsonpatch[_0x382e('0x34')](_0x297709,_0x52121a,!![]);}catch(_0x11725e){return BPromise[_0x382e('0x35')](_0x11725e);}return _0x297709[_0x382e('0x36')]();};}function saveUpdates(_0x3d30ef,_0x8160b8){return function(_0x5a6f6d){if(_0x5a6f6d){return _0x5a6f6d[_0x382e('0x37')](_0x3d30ef)[_0x382e('0x21')](function(_0x1a8f62){return _0x1a8f62;});}return null;};}function removeEntity(_0x3171b7,_0x2a58e7){return function(_0xe7e77c){if(_0xe7e77c){return _0xe7e77c[_0x382e('0x38')]()['then'](function(){_0x3171b7[_0x382e('0x2c')](0xcc)[_0x382e('0x39')]();});}};}function handleEntityNotFound(_0x3002b6,_0x36a7b2){return function(_0x4cea07){if(!_0x4cea07){_0x3002b6['sendStatus'](0x194);}return _0x4cea07;};}function handleError(_0x36970f,_0x30ebbc){_0x30ebbc=_0x30ebbc||0x1f4;return function(_0x4e0518){logger['error'](_0x4e0518['stack']);if(_0x4e0518[_0x382e('0x3a')]){delete _0x4e0518[_0x382e('0x3a')];}_0x36970f[_0x382e('0x2c')](_0x30ebbc)[_0x382e('0x3b')](_0x4e0518);};}exports[_0x382e('0x3c')]=function(_0x3997fb,_0xd3438){var _0x1712ad={},_0x283cfc={},_0x2ebef0={'count':0x0,'rows':[]};var _0x3baa0d=_[_0x382e('0x3d')](db[_0x382e('0x3e')]['rawAttributes'],function(_0x44a012){return{'name':_0x44a012['fieldName'],'type':_0x44a012[_0x382e('0x3f')][_0x382e('0x40')]};});_0x283cfc['model']=_[_0x382e('0x3d')](_0x3baa0d,_0x382e('0x3a'));_0x283cfc['query']=_[_0x382e('0x41')](_0x3997fb[_0x382e('0x42')]);_0x283cfc['filters']=_[_0x382e('0x43')](_0x283cfc[_0x382e('0x44')],_0x283cfc[_0x382e('0x42')]);_0x1712ad[_0x382e('0x45')]=_['intersection'](_0x283cfc[_0x382e('0x44')],qs[_0x382e('0x46')](_0x3997fb['query'][_0x382e('0x46')]));_0x1712ad[_0x382e('0x45')]=_0x1712ad['attributes'][_0x382e('0x47')]?_0x1712ad['attributes']:_0x283cfc['model'];if(!_0x3997fb['query'][_0x382e('0x48')](_0x382e('0x49'))){_0x1712ad[_0x382e('0x2f')]=qs['limit'](_0x3997fb[_0x382e('0x42')][_0x382e('0x2f')]);_0x1712ad['offset']=qs[_0x382e('0x2d')](_0x3997fb[_0x382e('0x42')][_0x382e('0x2d')]);}_0x1712ad[_0x382e('0x4a')]=qs[_0x382e('0x4b')](_0x3997fb[_0x382e('0x42')]['sort']);_0x1712ad[_0x382e('0x4c')]=qs[_0x382e('0x4d')](_['pick'](_0x3997fb[_0x382e('0x42')],_0x283cfc[_0x382e('0x4d')]),_0x3baa0d);if(_0x3997fb[_0x382e('0x42')][_0x382e('0x4e')]){_0x1712ad[_0x382e('0x4c')]=_['merge'](_0x1712ad['where'],{'$or':_[_0x382e('0x3d')](_0x3baa0d,function(_0x3a3933){if(_0x3a3933['type']!==_0x382e('0x4f')){var _0x1df1a7={};_0x1df1a7[_0x3a3933[_0x382e('0x3a')]]={'$like':'%'+_0x3997fb[_0x382e('0x42')][_0x382e('0x4e')]+'%'};return _0x1df1a7;}})});}_0x1712ad=_[_0x382e('0x50')]({},_0x1712ad,_0x3997fb['options']);var _0x471835={'where':_0x1712ad[_0x382e('0x4c')]};return db[_0x382e('0x3e')]['count'](_0x471835)[_0x382e('0x21')](function(_0x309738){_0x2ebef0[_0x382e('0x30')]=_0x309738;if(_0x3997fb['query'][_0x382e('0x51')]){_0x1712ad[_0x382e('0x52')]=[{'all':!![]}];}return db[_0x382e('0x3e')][_0x382e('0x53')](_0x1712ad);})[_0x382e('0x21')](function(_0x3b1aba){_0x2ebef0[_0x382e('0x54')]=_0x3b1aba;return _0x2ebef0;})['then'](respondWithFilteredResult(_0xd3438,_0x1712ad))['catch'](handleError(_0xd3438,null));};exports[_0x382e('0x55')]=function(_0x2d5d2a,_0x5f214e){var _0x52c106={'raw':!![],'where':{'id':_0x2d5d2a[_0x382e('0x56')]['id']}},_0xbd8f78={};_0xbd8f78[_0x382e('0x44')]=_[_0x382e('0x41')](db[_0x382e('0x3e')]['rawAttributes']);_0xbd8f78[_0x382e('0x42')]=_[_0x382e('0x41')](_0x2d5d2a[_0x382e('0x42')]);_0xbd8f78[_0x382e('0x4d')]=_[_0x382e('0x43')](_0xbd8f78[_0x382e('0x44')],_0xbd8f78['query']);_0x52c106[_0x382e('0x45')]=_['intersection'](_0xbd8f78[_0x382e('0x44')],qs[_0x382e('0x46')](_0x2d5d2a[_0x382e('0x42')][_0x382e('0x46')]));_0x52c106[_0x382e('0x45')]=_0x52c106[_0x382e('0x45')][_0x382e('0x47')]?_0x52c106[_0x382e('0x45')]:_0xbd8f78[_0x382e('0x44')];if(_0x2d5d2a[_0x382e('0x42')][_0x382e('0x51')]){_0x52c106[_0x382e('0x52')]=[{'all':!![]}];}_0x52c106=_['merge']({},_0x52c106,_0x2d5d2a['options']);return db[_0x382e('0x3e')]['find'](_0x52c106)[_0x382e('0x21')](handleEntityNotFound(_0x5f214e,null))['then'](respondWithResult(_0x5f214e,null))[_0x382e('0x2a')](handleError(_0x5f214e,null));};exports[_0x382e('0x57')]=function(_0x26088c,_0x3ed229){return db[_0x382e('0x3e')][_0x382e('0x57')](_0x26088c[_0x382e('0x58')],{})[_0x382e('0x21')](respondWithResult(_0x3ed229,0xc9))[_0x382e('0x2a')](handleError(_0x3ed229,null));};exports['update']=function(_0x931b5,_0x1ce24a){if(_0x931b5[_0x382e('0x58')]['id']){delete _0x931b5[_0x382e('0x58')]['id'];}return db[_0x382e('0x3e')]['find']({'where':{'id':_0x931b5[_0x382e('0x56')]['id']}})[_0x382e('0x21')](handleEntityNotFound(_0x1ce24a,null))[_0x382e('0x21')](saveUpdates(_0x931b5[_0x382e('0x58')],null))['then'](respondWithResult(_0x1ce24a,null))['catch'](handleError(_0x1ce24a,null));};exports[_0x382e('0x38')]=function(_0x248227,_0x1532d1){return db[_0x382e('0x3e')][_0x382e('0x59')]({'where':{'id':_0x248227['params']['id']}})[_0x382e('0x21')](handleEntityNotFound(_0x1532d1,null))[_0x382e('0x21')](removeEntity(_0x1532d1,null))[_0x382e('0x2a')](handleError(_0x1532d1,null));};exports[_0x382e('0x5a')]=function(_0x4ded35,_0x391901){return db[_0x382e('0x3e')][_0x382e('0x5a')]()[_0x382e('0x21')](respondWithResult(_0x391901,null))[_0x382e('0x2a')](handleError(_0x391901,null));};var interaction_log=require('../../config/logger')(_0x382e('0x5b'));exports[_0x382e('0x5c')]=function(_0x3ca932,_0x74c5db,_0x2435d1){var _0x7d48b={'agent':{},'channel':'openchannel'};if(_0x3ca932['body']['id']){delete _0x3ca932[_0x382e('0x58')]['id'];}_0x3ca932['body']['read']=!![];_0x3ca932['body'][_0x382e('0x5d')]=moment()[_0x382e('0x5e')](_0x382e('0x5f'));_0x3ca932[_0x382e('0x58')][_0x382e('0x60')]=_0x3ca932['body'][_0x382e('0x60')]||_0x3ca932[_0x382e('0x61')]['id'];_0x7d48b['agent']['id']=_0x3ca932[_0x382e('0x58')]['UserId'];return db[_0x382e('0x3e')]['find']({'where':{'id':_0x3ca932['params']['id'],'UserId':null}})[_0x382e('0x21')](handleEntityNotFound(_0x74c5db,null))[_0x382e('0x21')](saveUpdates(_0x3ca932[_0x382e('0x58')],null))[_0x382e('0x21')](function(_0x3837ca){if(_0x3837ca){_0x7d48b[_0x382e('0x27')]=_0x3837ca[_0x382e('0x62')]({'plain':!![]});return db[_0x382e('0x63')]['find']({'where':{'id':_0x3837ca[_0x382e('0x64')]}});}return null;})[_0x382e('0x21')](handleEntityNotFound(_0x74c5db,null))[_0x382e('0x21')](function(_0x166509){if(_0x166509){return _0x166509[_0x382e('0x37')]({'UserId':_0x3ca932['body']['UserId'],'read1stAt':_[_0x382e('0x65')](_0x166509[_0x382e('0x66')])?moment()[_0x382e('0x5e')](_0x382e('0x5f')):undefined});}return null;})[_0x382e('0x21')](function(_0x39bc0e){if(_0x39bc0e){_0x7d48b[_0x382e('0x67')]=_0x39bc0e[_0x382e('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ca932['user']['id'],_0x3ca932['user'][_0x382e('0x3a')],_0x3ca932['user']['role'],_0x7d48b[_0x382e('0x67')]['id'],_0x3ca932[_0x382e('0x58')]?JSON[_0x382e('0x24')](_0x3ca932[_0x382e('0x58')]):_0x382e('0x68'));return respondWithRpcPromise(_0x382e('0x69'),'acceptMessage',_0x7d48b);}return null;})['then'](function(_0x3aaf9a){var _0x56f3cb=_0x382e('0x6a')+_0x3aaf9a[_0x382e('0x27')][_0x382e('0x6b')];return db[_0x382e('0x6c')][_0x382e('0x42')](_0x56f3cb,{'type':db[_0x382e('0x6d')][_0x382e('0x6e')][_0x382e('0x6f')],'raw':!![]})['then'](function(_0x586dac){return _0x586dac;});})[_0x382e('0x21')](function(_0x34e030){if(_0x34e030){_0x7d48b[_0x382e('0x27')]['contact']=_0x34e030[0x0];if(!_0x3ca932[_0x382e('0x58')]['UserId'])return;return db[_0x382e('0x70')][_0x382e('0x59')]({'where':{'id':_0x3ca932[_0x382e('0x58')]['UserId'],'role':_0x382e('0x71')},'attributes':['id',_0x382e('0x3a'),'fullname',_0x382e('0x72'),_0x382e('0x73')],'raw':!![]});}return null;})[_0x382e('0x21')](function(_0x926149){if(!_0x926149)return null;_0x7d48b[_0x382e('0x27')]['agent']=_0x926149;return _0x7d48b;})[_0x382e('0x21')](function(_0x10adba){if(_0x10adba){if(_0x3ca932[_0x382e('0x58')][_0x382e('0x74')]){_0x7d48b['message'][_0x382e('0x75')]=util[_0x382e('0x5e')](_0x382e('0x76'),_0x3ca932['user'][_0x382e('0x3a')]);_0x7d48b[_0x382e('0x27')][_0x382e('0x77')]=_0x7d48b[_0x382e('0x77')];_0x7d48b['message']['motionChannel']=_0x7d48b[_0x382e('0x77')];_0x7d48b['message'][_0x382e('0x78')]=_0x382e('0x5c');return respondWithRpcPromise(_0x382e('0x79'),_0x382e('0x79'),{'event':_0x382e('0x7a'),'message':_0x7d48b[_0x382e('0x27')]},client9002)[_0x382e('0x21')](function(){return _0x7d48b;});}return _0x7d48b;}return null;})[_0x382e('0x21')](respondWithResult(_0x74c5db,null))[_0x382e('0x2a')](handleError(_0x74c5db,null));};var interaction_log=require(_0x382e('0x11'))('openchannel-interactions');exports[_0x382e('0x35')]=function(_0x542131,_0x19aed2,_0x4a97db){var _0x3d2e52={'agent':{},'channel':_0x382e('0x7b')};if(_0x542131[_0x382e('0x58')]['id']){delete _0x542131[_0x382e('0x58')]['id'];}_0x542131[_0x382e('0x58')]['UserId']=_0x542131[_0x382e('0x58')][_0x382e('0x60')]||_0x542131[_0x382e('0x61')]['id'];_0x3d2e52[_0x382e('0x71')]['id']=_0x542131[_0x382e('0x58')]['UserId'];return db[_0x382e('0x3e')][_0x382e('0x59')]({'where':{'id':_0x542131[_0x382e('0x56')]['id'],'UserId':null}})[_0x382e('0x21')](handleEntityNotFound(_0x19aed2,null))['then'](function(_0x523015){if(_0x523015){_0x3d2e52[_0x382e('0x27')]=_0x523015[_0x382e('0x62')]({'plain':!![]});return db[_0x382e('0x63')][_0x382e('0x59')]({'where':{'id':_0x523015['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x19aed2,null))[_0x382e('0x21')](function(_0x5003c5){if(_0x5003c5){_0x3d2e52['interaction']=_0x5003c5['get']({'plain':!![]});interaction_log[_0x382e('0x28')](_0x382e('0x7c'),_0x542131[_0x382e('0x61')]['id'],_0x542131[_0x382e('0x61')]['name'],_0x542131[_0x382e('0x61')][_0x382e('0x7d')],_0x3d2e52[_0x382e('0x67')]['id'],_0x542131[_0x382e('0x58')]?JSON[_0x382e('0x24')](_0x542131['body']):_0x382e('0x68'));return respondWithRpcPromise(_0x382e('0x7e'),_0x382e('0x7f'),_0x3d2e52);}return null;})[_0x382e('0x21')](function(_0x4ac7f5){var _0xe0f832='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ac7f5['message'][_0x382e('0x6b')];return db[_0x382e('0x6c')]['query'](_0xe0f832,{'type':db['Sequelize']['QueryTypes'][_0x382e('0x6f')],'raw':!![]})[_0x382e('0x21')](function(_0x1f452f){return _0x1f452f;});})[_0x382e('0x21')](function(_0x1c802e){if(_0x1c802e){_0x3d2e52[_0x382e('0x27')][_0x382e('0x80')]=_0x1c802e[0x0];if(!_0x542131[_0x382e('0x58')][_0x382e('0x60')])return;return db[_0x382e('0x70')]['find']({'where':{'id':_0x542131[_0x382e('0x58')][_0x382e('0x60')],'role':'agent'},'attributes':['id','name','fullname','email',_0x382e('0x73')],'raw':!![]});}return null;})[_0x382e('0x21')](function(_0x5e1c4c){if(!_0x5e1c4c)return null;_0x3d2e52['message'][_0x382e('0x71')]=_0x5e1c4c;return _0x3d2e52;})['then'](function(_0x19ea65){if(_0x19ea65){_0x19ea65[_0x382e('0x27')][_0x382e('0x75')]=util[_0x382e('0x5e')](_0x382e('0x76'),_0x542131[_0x382e('0x61')][_0x382e('0x3a')]);_0x19ea65[_0x382e('0x27')][_0x382e('0x77')]=_0x3d2e52[_0x382e('0x77')];_0x19ea65[_0x382e('0x27')][_0x382e('0x81')]=_0x3d2e52['channel'];_0x19ea65['message'][_0x382e('0x78')]='reject';respondWithRpcPromise(_0x382e('0x79'),_0x382e('0x79'),{'event':'rejectmessage','message':_0x19ea65[_0x382e('0x27')]},client9002);return _0x3d2e52;}return null;})[_0x382e('0x21')](respondWithResult(_0x19aed2,null))['catch'](handleError(_0x19aed2,null));}; \ No newline at end of file +var _0x8fbe=['debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','OpenchannelMessage','include','findAll','rows','show','params','create','body','find','../../config/logger','openchannel-interactions','openchannel','read','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','ContactId','User','fullname','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x15e017,_0x34d83e){var _0x4d4031=function(_0x43ff14){while(--_0x43ff14){_0x15e017['push'](_0x15e017['shift']());}};_0x4d4031(++_0x34d83e);}(_0x8fbe,0xd7));var _0xe8fb=function(_0x13f0f2,_0x2b3566){_0x13f0f2=_0x13f0f2-0x0;var _0xe733ed=_0x8fbe[_0x13f0f2];return _0xe733ed;};'use strict';var emlformat=require(_0xe8fb('0x0'));var rimraf=require(_0xe8fb('0x1'));var zipdir=require(_0xe8fb('0x2'));var jsonpatch=require(_0xe8fb('0x3'));var rp=require(_0xe8fb('0x4'));var moment=require(_0xe8fb('0x5'));var BPromise=require(_0xe8fb('0x6'));var Mustache=require(_0xe8fb('0x7'));var util=require('util');var path=require(_0xe8fb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8fb('0x9'));var _=require(_0xe8fb('0xa'));var squel=require(_0xe8fb('0xb'));var crypto=require('crypto');var jsforce=require(_0xe8fb('0xc'));var deskjs=require(_0xe8fb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8fb('0xe'));var Papa=require(_0xe8fb('0xf'));var Redis=require('ioredis');var authService=require(_0xe8fb('0x10'));var qs=require(_0xe8fb('0x11'));var as=require(_0xe8fb('0x12'));var hardwareService=require(_0xe8fb('0x13'));var logger=require('../../config/logger')(_0xe8fb('0x14'));var utils=require(_0xe8fb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe8fb('0x16'));var db=require(_0xe8fb('0x17'))['db'];config[_0xe8fb('0x18')]=_[_0xe8fb('0x19')](config[_0xe8fb('0x18')],{'host':_0xe8fb('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe8fb('0x1b'))[_0xe8fb('0x1c')](socket);var jayson=require(_0xe8fb('0x1d'));var client=jayson[_0xe8fb('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xe8fb('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58aee6,_0x42c7ce,_0x4dd862,_0x249d6c){return new BPromise(function(_0x5caa38,_0x5dede6){var _0x22e1a0=_0x249d6c||client;return _0x22e1a0[_0xe8fb('0x1f')](_0x58aee6,_0x4dd862)['then'](function(_0x467b1e){logger[_0xe8fb('0x20')](_0xe8fb('0x21'),_0x42c7ce,_0xe8fb('0x22'));logger[_0xe8fb('0x23')](_0xe8fb('0x24'),_0x42c7ce,_0xe8fb('0x22'),JSON[_0xe8fb('0x25')](_0x467b1e));if(_0x467b1e[_0xe8fb('0x26')]){if(_0x467b1e['error']['code']===0x1f4){logger['error'](_0xe8fb('0x21'),_0x42c7ce,_0x467b1e[_0xe8fb('0x26')][_0xe8fb('0x27')]);return _0x5dede6(_0x467b1e[_0xe8fb('0x26')][_0xe8fb('0x27')]);}logger[_0xe8fb('0x26')](_0xe8fb('0x21'),_0x42c7ce,_0x467b1e[_0xe8fb('0x26')][_0xe8fb('0x27')]);return _0x5caa38(_0x467b1e['error'][_0xe8fb('0x27')]);}else{logger[_0xe8fb('0x20')](_0xe8fb('0x21'),_0x42c7ce,_0xe8fb('0x22'));_0x5caa38(_0x467b1e['result'][_0xe8fb('0x27')]);}})[_0xe8fb('0x28')](function(_0x18219d){logger[_0xe8fb('0x26')](_0xe8fb('0x21'),_0x42c7ce,_0x18219d);_0x5dede6(_0x18219d);});});}function respondWithStatusCode(_0x414c0c,_0x324079){_0x324079=_0x324079||0xcc;return function(_0x362712){if(_0x362712){return _0x414c0c[_0xe8fb('0x29')](_0x324079);}return _0x414c0c[_0xe8fb('0x2a')](_0x324079)[_0xe8fb('0x2b')]();};}function respondWithResult(_0x376c37,_0x22bbe9){_0x22bbe9=_0x22bbe9||0xc8;return function(_0x365189){if(_0x365189){return _0x376c37[_0xe8fb('0x2a')](_0x22bbe9)['json'](_0x365189);}};}function respondWithFilteredResult(_0x2ca3e8,_0x16d690){return function(_0xdfefd2){if(_0xdfefd2){var _0x45df94=typeof _0x16d690['offset']===_0xe8fb('0x2c')&&typeof _0x16d690[_0xe8fb('0x2d')]==='undefined';var _0xd9b6cb=_0xdfefd2[_0xe8fb('0x2e')];var _0x3a88dd=_0x45df94?0x0:_0x16d690[_0xe8fb('0x2f')];var _0x5238f3=_0x45df94?_0xdfefd2[_0xe8fb('0x2e')]:_0x16d690[_0xe8fb('0x2f')]+_0x16d690[_0xe8fb('0x2d')];var _0x73e836;if(_0x5238f3>=_0xd9b6cb){_0x5238f3=_0xd9b6cb;_0x73e836=0xc8;}else{_0x73e836=0xce;}_0x2ca3e8[_0xe8fb('0x2a')](_0x73e836);return _0x2ca3e8[_0xe8fb('0x30')](_0xe8fb('0x31'),_0x3a88dd+'-'+_0x5238f3+'/'+_0xd9b6cb)[_0xe8fb('0x32')](_0xdfefd2);}return null;};}function patchUpdates(_0x208db8){return function(_0x5759f6){try{jsonpatch['apply'](_0x5759f6,_0x208db8,!![]);}catch(_0x11749c){return BPromise[_0xe8fb('0x33')](_0x11749c);}return _0x5759f6[_0xe8fb('0x34')]();};}function saveUpdates(_0x46a251,_0x97c824){return function(_0xaa6ce9){if(_0xaa6ce9){return _0xaa6ce9[_0xe8fb('0x35')](_0x46a251)[_0xe8fb('0x36')](function(_0x23f1b6){return _0x23f1b6;});}return null;};}function removeEntity(_0x3b441e,_0x231518){return function(_0x57fe2c){if(_0x57fe2c){return _0x57fe2c[_0xe8fb('0x37')]()[_0xe8fb('0x36')](function(){_0x3b441e['status'](0xcc)[_0xe8fb('0x2b')]();});}};}function handleEntityNotFound(_0x31b796,_0x411438){return function(_0xab55c4){if(!_0xab55c4){_0x31b796[_0xe8fb('0x29')](0x194);}return _0xab55c4;};}function handleError(_0x3e507a,_0x243cdb){_0x243cdb=_0x243cdb||0x1f4;return function(_0x2e5b88){logger[_0xe8fb('0x26')](_0x2e5b88['stack']);if(_0x2e5b88[_0xe8fb('0x38')]){delete _0x2e5b88['name'];}_0x3e507a['status'](_0x243cdb)['send'](_0x2e5b88);};}exports['index']=function(_0x53aa72,_0x36ecf0){var _0x1126a0={},_0x4b87bf={},_0x5f1eee={'count':0x0,'rows':[]};var _0x267445=_[_0xe8fb('0x39')](db['OpenchannelMessage'][_0xe8fb('0x3a')],function(_0x460b94){return{'name':_0x460b94[_0xe8fb('0x3b')],'type':_0x460b94[_0xe8fb('0x3c')][_0xe8fb('0x3d')]};});_0x4b87bf[_0xe8fb('0x3e')]=_[_0xe8fb('0x39')](_0x267445,_0xe8fb('0x38'));_0x4b87bf[_0xe8fb('0x3f')]=_[_0xe8fb('0x40')](_0x53aa72[_0xe8fb('0x3f')]);_0x4b87bf[_0xe8fb('0x41')]=_[_0xe8fb('0x42')](_0x4b87bf[_0xe8fb('0x3e')],_0x4b87bf[_0xe8fb('0x3f')]);_0x1126a0[_0xe8fb('0x43')]=_[_0xe8fb('0x42')](_0x4b87bf[_0xe8fb('0x3e')],qs[_0xe8fb('0x44')](_0x53aa72[_0xe8fb('0x3f')][_0xe8fb('0x44')]));_0x1126a0['attributes']=_0x1126a0[_0xe8fb('0x43')][_0xe8fb('0x45')]?_0x1126a0['attributes']:_0x4b87bf['model'];if(!_0x53aa72['query'][_0xe8fb('0x46')](_0xe8fb('0x47'))){_0x1126a0[_0xe8fb('0x2d')]=qs[_0xe8fb('0x2d')](_0x53aa72[_0xe8fb('0x3f')][_0xe8fb('0x2d')]);_0x1126a0['offset']=qs['offset'](_0x53aa72['query'][_0xe8fb('0x2f')]);}_0x1126a0['order']=qs[_0xe8fb('0x48')](_0x53aa72[_0xe8fb('0x3f')][_0xe8fb('0x48')]);_0x1126a0[_0xe8fb('0x49')]=qs[_0xe8fb('0x41')](_[_0xe8fb('0x4a')](_0x53aa72[_0xe8fb('0x3f')],_0x4b87bf[_0xe8fb('0x41')]),_0x267445);if(_0x53aa72[_0xe8fb('0x3f')][_0xe8fb('0x4b')]){_0x1126a0[_0xe8fb('0x49')]=_[_0xe8fb('0x4c')](_0x1126a0[_0xe8fb('0x49')],{'$or':_[_0xe8fb('0x39')](_0x267445,function(_0x5848ae){if(_0x5848ae[_0xe8fb('0x3c')]!=='VIRTUAL'){var _0x469396={};_0x469396[_0x5848ae[_0xe8fb('0x38')]]={'$like':'%'+_0x53aa72[_0xe8fb('0x3f')]['filter']+'%'};return _0x469396;}})});}_0x1126a0=_[_0xe8fb('0x4c')]({},_0x1126a0,_0x53aa72[_0xe8fb('0x4d')]);var _0x31a103={'where':_0x1126a0[_0xe8fb('0x49')]};return db[_0xe8fb('0x4e')][_0xe8fb('0x2e')](_0x31a103)[_0xe8fb('0x36')](function(_0x58cf7a){_0x5f1eee[_0xe8fb('0x2e')]=_0x58cf7a;if(_0x53aa72[_0xe8fb('0x3f')]['includeAll']){_0x1126a0[_0xe8fb('0x4f')]=[{'all':!![]}];}return db[_0xe8fb('0x4e')][_0xe8fb('0x50')](_0x1126a0);})[_0xe8fb('0x36')](function(_0x1127c2){_0x5f1eee[_0xe8fb('0x51')]=_0x1127c2;return _0x5f1eee;})['then'](respondWithFilteredResult(_0x36ecf0,_0x1126a0))['catch'](handleError(_0x36ecf0,null));};exports[_0xe8fb('0x52')]=function(_0xb599e6,_0x4697e9){var _0x5091e8={'raw':!![],'where':{'id':_0xb599e6[_0xe8fb('0x53')]['id']}},_0x597609={};_0x597609[_0xe8fb('0x3e')]=_[_0xe8fb('0x40')](db[_0xe8fb('0x4e')][_0xe8fb('0x3a')]);_0x597609[_0xe8fb('0x3f')]=_[_0xe8fb('0x40')](_0xb599e6[_0xe8fb('0x3f')]);_0x597609[_0xe8fb('0x41')]=_[_0xe8fb('0x42')](_0x597609[_0xe8fb('0x3e')],_0x597609[_0xe8fb('0x3f')]);_0x5091e8[_0xe8fb('0x43')]=_['intersection'](_0x597609['model'],qs[_0xe8fb('0x44')](_0xb599e6['query'][_0xe8fb('0x44')]));_0x5091e8[_0xe8fb('0x43')]=_0x5091e8[_0xe8fb('0x43')][_0xe8fb('0x45')]?_0x5091e8[_0xe8fb('0x43')]:_0x597609[_0xe8fb('0x3e')];if(_0xb599e6['query']['includeAll']){_0x5091e8[_0xe8fb('0x4f')]=[{'all':!![]}];}_0x5091e8=_[_0xe8fb('0x4c')]({},_0x5091e8,_0xb599e6[_0xe8fb('0x4d')]);return db['OpenchannelMessage']['find'](_0x5091e8)[_0xe8fb('0x36')](handleEntityNotFound(_0x4697e9,null))[_0xe8fb('0x36')](respondWithResult(_0x4697e9,null))['catch'](handleError(_0x4697e9,null));};exports[_0xe8fb('0x54')]=function(_0x2bb6b8,_0x50a99e){return db[_0xe8fb('0x4e')][_0xe8fb('0x54')](_0x2bb6b8['body'],{})[_0xe8fb('0x36')](respondWithResult(_0x50a99e,0xc9))[_0xe8fb('0x28')](handleError(_0x50a99e,null));};exports[_0xe8fb('0x35')]=function(_0x342d19,_0x32a032){if(_0x342d19[_0xe8fb('0x55')]['id']){delete _0x342d19[_0xe8fb('0x55')]['id'];}return db[_0xe8fb('0x4e')]['find']({'where':{'id':_0x342d19[_0xe8fb('0x53')]['id']}})['then'](handleEntityNotFound(_0x32a032,null))[_0xe8fb('0x36')](saveUpdates(_0x342d19[_0xe8fb('0x55')],null))['then'](respondWithResult(_0x32a032,null))[_0xe8fb('0x28')](handleError(_0x32a032,null));};exports[_0xe8fb('0x37')]=function(_0x1dd22d,_0xcbde22){return db[_0xe8fb('0x4e')][_0xe8fb('0x56')]({'where':{'id':_0x1dd22d[_0xe8fb('0x53')]['id']}})[_0xe8fb('0x36')](handleEntityNotFound(_0xcbde22,null))[_0xe8fb('0x36')](removeEntity(_0xcbde22,null))['catch'](handleError(_0xcbde22,null));};exports['describe']=function(_0x2a50c3,_0x2ba939){return db[_0xe8fb('0x4e')]['describe']()[_0xe8fb('0x36')](respondWithResult(_0x2ba939,null))[_0xe8fb('0x28')](handleError(_0x2ba939,null));};var interaction_log=require(_0xe8fb('0x57'))(_0xe8fb('0x58'));exports['accept']=function(_0x149b7b,_0x12eef9,_0x370e37){var _0x2c7793={'agent':{},'channel':_0xe8fb('0x59')};if(_0x149b7b[_0xe8fb('0x55')]['id']){delete _0x149b7b[_0xe8fb('0x55')]['id'];}_0x149b7b[_0xe8fb('0x55')][_0xe8fb('0x5a')]=!![];_0x149b7b['body']['readAt']=moment()[_0xe8fb('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x149b7b[_0xe8fb('0x55')][_0xe8fb('0x5c')]=_0x149b7b[_0xe8fb('0x55')][_0xe8fb('0x5c')]||_0x149b7b[_0xe8fb('0x5d')]['id'];_0x2c7793[_0xe8fb('0x5e')]['id']=_0x149b7b[_0xe8fb('0x55')]['UserId'];return db['OpenchannelMessage'][_0xe8fb('0x56')]({'where':{'id':_0x149b7b['params']['id'],'UserId':null}})[_0xe8fb('0x36')](handleEntityNotFound(_0x12eef9,null))[_0xe8fb('0x36')](saveUpdates(_0x149b7b[_0xe8fb('0x55')],null))[_0xe8fb('0x36')](function(_0x5175a5){if(_0x5175a5){_0x2c7793[_0xe8fb('0x27')]=_0x5175a5[_0xe8fb('0x5f')]({'plain':!![]});return db[_0xe8fb('0x60')]['find']({'where':{'id':_0x5175a5[_0xe8fb('0x61')]}});}return null;})[_0xe8fb('0x36')](handleEntityNotFound(_0x12eef9,null))[_0xe8fb('0x36')](function(_0x198fc3){if(_0x198fc3){return _0x198fc3['update']({'UserId':_0x149b7b[_0xe8fb('0x55')]['UserId'],'read1stAt':_[_0xe8fb('0x62')](_0x198fc3['read1stAt'])?moment()[_0xe8fb('0x5b')](_0xe8fb('0x63')):undefined});}return null;})['then'](function(_0x3a926b){if(_0x3a926b){_0x2c7793['interaction']=_0x3a926b['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x149b7b['user']['id'],_0x149b7b['user'][_0xe8fb('0x38')],_0x149b7b['user'][_0xe8fb('0x64')],_0x2c7793[_0xe8fb('0x65')]['id'],_0x149b7b[_0xe8fb('0x55')]?JSON[_0xe8fb('0x25')](_0x149b7b[_0xe8fb('0x55')]):_0xe8fb('0x66'));return respondWithRpcPromise(_0xe8fb('0x67'),_0xe8fb('0x68'),_0x2c7793);}return null;})[_0xe8fb('0x36')](function(_0x2323a0){var _0x5a23d5=_0xe8fb('0x69')+_0x2323a0[_0xe8fb('0x27')]['ContactId'];return db[_0xe8fb('0x6a')][_0xe8fb('0x3f')](_0x5a23d5,{'type':db[_0xe8fb('0x6b')][_0xe8fb('0x6c')][_0xe8fb('0x6d')],'raw':!![]})[_0xe8fb('0x36')](function(_0x7128fa){return _0x7128fa;});})[_0xe8fb('0x36')](function(_0x4b544f){if(_0x4b544f){_0x2c7793[_0xe8fb('0x27')][_0xe8fb('0x6e')]=_0x4b544f[0x0];if(!_0x149b7b[_0xe8fb('0x55')]['UserId'])return;return db['User'][_0xe8fb('0x56')]({'where':{'id':_0x149b7b[_0xe8fb('0x55')][_0xe8fb('0x5c')],'role':'agent'},'attributes':['id','name','fullname',_0xe8fb('0x6f'),_0xe8fb('0x70')],'raw':!![]});}return null;})[_0xe8fb('0x36')](function(_0x2d0531){if(!_0x2d0531)return null;_0x2c7793['message']['agent']=_0x2d0531;return _0x2c7793;})[_0xe8fb('0x36')](function(_0x5ca3a5){if(_0x5ca3a5){if(_0x149b7b[_0xe8fb('0x55')]['manual']){_0x2c7793[_0xe8fb('0x27')]['interface']=util[_0xe8fb('0x5b')](_0xe8fb('0x71'),_0x149b7b['user']['name']);_0x2c7793[_0xe8fb('0x27')]['channel']=_0x2c7793[_0xe8fb('0x72')];_0x2c7793[_0xe8fb('0x27')][_0xe8fb('0x73')]=_0x2c7793[_0xe8fb('0x72')];_0x2c7793[_0xe8fb('0x27')][_0xe8fb('0x74')]='accept';return respondWithRpcPromise(_0xe8fb('0x75'),'EventManager',{'event':_0xe8fb('0x76'),'message':_0x2c7793[_0xe8fb('0x27')]},client9002)[_0xe8fb('0x36')](function(){return _0x2c7793;});}return _0x2c7793;}return null;})[_0xe8fb('0x36')](respondWithResult(_0x12eef9,null))['catch'](handleError(_0x12eef9,null));};var interaction_log=require(_0xe8fb('0x57'))('openchannel-interactions');exports[_0xe8fb('0x33')]=function(_0x1e4d03,_0x41692d,_0x911c0e){var _0x1e477d={'agent':{},'channel':_0xe8fb('0x59')};if(_0x1e4d03[_0xe8fb('0x55')]['id']){delete _0x1e4d03[_0xe8fb('0x55')]['id'];}_0x1e4d03[_0xe8fb('0x55')][_0xe8fb('0x5c')]=_0x1e4d03[_0xe8fb('0x55')][_0xe8fb('0x5c')]||_0x1e4d03[_0xe8fb('0x5d')]['id'];_0x1e477d[_0xe8fb('0x5e')]['id']=_0x1e4d03[_0xe8fb('0x55')]['UserId'];return db[_0xe8fb('0x4e')]['find']({'where':{'id':_0x1e4d03['params']['id'],'UserId':null}})[_0xe8fb('0x36')](handleEntityNotFound(_0x41692d,null))[_0xe8fb('0x36')](function(_0x3119cd){if(_0x3119cd){_0x1e477d['message']=_0x3119cd[_0xe8fb('0x5f')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3119cd[_0xe8fb('0x61')]}});}return null;})[_0xe8fb('0x36')](handleEntityNotFound(_0x41692d,null))[_0xe8fb('0x36')](function(_0x4a9977){if(_0x4a9977){_0x1e477d[_0xe8fb('0x65')]=_0x4a9977[_0xe8fb('0x5f')]({'plain':!![]});interaction_log[_0xe8fb('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1e4d03[_0xe8fb('0x5d')]['id'],_0x1e4d03[_0xe8fb('0x5d')][_0xe8fb('0x38')],_0x1e4d03[_0xe8fb('0x5d')][_0xe8fb('0x64')],_0x1e477d[_0xe8fb('0x65')]['id'],_0x1e4d03[_0xe8fb('0x55')]?JSON[_0xe8fb('0x25')](_0x1e4d03[_0xe8fb('0x55')]):_0xe8fb('0x66'));return respondWithRpcPromise(_0xe8fb('0x77'),'rejectMessage',_0x1e477d);}return null;})[_0xe8fb('0x36')](function(_0x5c67af){var _0x3c872e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c67af['message'][_0xe8fb('0x78')];return db[_0xe8fb('0x6a')][_0xe8fb('0x3f')](_0x3c872e,{'type':db[_0xe8fb('0x6b')][_0xe8fb('0x6c')][_0xe8fb('0x6d')],'raw':!![]})[_0xe8fb('0x36')](function(_0x1060de){return _0x1060de;});})['then'](function(_0x3ce933){if(_0x3ce933){_0x1e477d[_0xe8fb('0x27')]['contact']=_0x3ce933[0x0];if(!_0x1e4d03['body']['UserId'])return;return db[_0xe8fb('0x79')][_0xe8fb('0x56')]({'where':{'id':_0x1e4d03[_0xe8fb('0x55')][_0xe8fb('0x5c')],'role':_0xe8fb('0x5e')},'attributes':['id',_0xe8fb('0x38'),_0xe8fb('0x7a'),_0xe8fb('0x6f'),_0xe8fb('0x70')],'raw':!![]});}return null;})[_0xe8fb('0x36')](function(_0x5c1731){if(!_0x5c1731)return null;_0x1e477d[_0xe8fb('0x27')]['agent']=_0x5c1731;return _0x1e477d;})[_0xe8fb('0x36')](function(_0x5c6fc8){if(_0x5c6fc8){_0x5c6fc8['message'][_0xe8fb('0x7b')]=util['format'](_0xe8fb('0x71'),_0x1e4d03[_0xe8fb('0x5d')][_0xe8fb('0x38')]);_0x5c6fc8['message'][_0xe8fb('0x72')]=_0x1e477d[_0xe8fb('0x72')];_0x5c6fc8[_0xe8fb('0x27')]['motionChannel']=_0x1e477d[_0xe8fb('0x72')];_0x5c6fc8[_0xe8fb('0x27')][_0xe8fb('0x74')]='reject';respondWithRpcPromise(_0xe8fb('0x75'),_0xe8fb('0x75'),{'event':_0xe8fb('0x7c'),'message':_0x5c6fc8[_0xe8fb('0x27')]},client9002);return _0x1e477d;}return null;})['then'](respondWithResult(_0x41692d,null))[_0xe8fb('0x28')](handleError(_0x41692d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c7ac17e..b4c6b4d 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 _0xbb6a=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xbb6a,0x97));var _0xabb6=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0xbb6a[_0x270a54];return _0x4d07d0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xabb6('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xabb6('0x1')](0x0);var events={'afterCreate':_0xabb6('0x2'),'afterUpdate':_0xabb6('0x3'),'afterDestroy':_0xabb6('0x4')};function emitEvent(_0x21d378){return function(_0x42303f,_0x3fbc2f,_0x4d137b){OpenchannelMessageEvents['emit'](_0x21d378+':'+_0x42303f['id'],_0x42303f);OpenchannelMessageEvents[_0xabb6('0x5')](_0x21d378,_0x42303f);_0x4d137b(null);};}for(var e in events){if(events[_0xabb6('0x6')](e)){var event=events[e];OpenchannelMessage[_0xabb6('0x7')](e,emitEvent(event));}}module[_0xabb6('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x68a9=['setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x330eb6,_0x2ecf9a){var _0x456f79=function(_0x381f03){while(--_0x381f03){_0x330eb6['push'](_0x330eb6['shift']());}};_0x456f79(++_0x2ecf9a);}(_0x68a9,0x13e));var _0x968a=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x68a9[_0x1b828b];return _0x98da1a;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x968a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x968a('0x1'),'afterDestroy':'remove'};function emitEvent(_0x525f13){return function(_0x78036f,_0xa17b17,_0x171d8d){OpenchannelMessageEvents[_0x968a('0x2')](_0x525f13+':'+_0x78036f['id'],_0x78036f);OpenchannelMessageEvents[_0x968a('0x2')](_0x525f13,_0x78036f);_0x171d8d(null);};}for(var e in events){if(events[_0x968a('0x3')](e)){var event=events[e];OpenchannelMessage[_0x968a('0x4')](e,emitEvent(event));}}module[_0x968a('0x5')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5aa9e60..49d02c5 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 _0x49a5=['api','request-promise','rimraf','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','toLowerCase','direction','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','get','replyUri','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49a5,0x8e));var _0x549a=function(_0x282943,_0x2d037b){_0x282943=_0x282943-0x0;var _0x535aa5=_0x49a5[_0x282943];return _0x535aa5;};'use strict';var _=require(_0x549a('0x0'));var util=require('util');var logger=require(_0x549a('0x1'))(_0x549a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x549a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x549a('0x4'));var config=require('../../config/environment');var attributes=require(_0x549a('0x5'));module[_0x549a('0x6')]=function(_0x3c275d,_0x60475f){return _0x3c275d[_0x549a('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x549a('0x8'),'paranoid':![],'indexes':[{'name':_0x549a('0x9'),'fields':[_0x549a('0xa')],'type':_0x549a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2521fa,_0x529d21,_0xce8083){var _0x14f39e=_0x3c275d['models'];var _0x35d6f8=_0x2521fa['get']({'plain':!![]});if(_0x35d6f8['direction'][_0x549a('0xc')]()==='in'||_0x35d6f8[_0x549a('0xd')][_0x549a('0xc')]()===_0x549a('0xe')&&!_0x35d6f8['secret']&&!_[_0x549a('0xf')](_0x35d6f8[_0x549a('0x10')])){_0x14f39e[_0x549a('0x11')][_0x549a('0x12')]({'where':{'id':_0x35d6f8[_0x549a('0x13')]}})[_0x549a('0x14')](function(_0x3824f5){if(_0x3824f5){_0x3824f5[_0x549a('0x15')]({'lastMsgAt':_0x35d6f8[_0x549a('0x16')],'lastMsgDirection':_0x35d6f8[_0x549a('0xd')][_0x549a('0xc')]()});}})[_0x549a('0x17')](function(_0x2ec712){console[_0x549a('0x18')](_0x2ec712);});}if(_0x35d6f8[_0x549a('0xd')]===_0x549a('0xe')&&!_0x35d6f8[_0x549a('0x19')]){var _0x2561e8;_0x14f39e[_0x549a('0x1a')]['describe']()[_0x549a('0x14')](function(_0x44730e){return _0x14f39e[_0x549a('0x1b')][_0x549a('0x1c')]({'where':{'id':_0x35d6f8[_0x549a('0x1d')]},'include':[{'model':_0x14f39e[_0x549a('0x11')],'as':_0x549a('0x1e'),'where':{'id':_0x35d6f8[_0x549a('0x13')]},'limit':0x1,'include':[{'model':_0x14f39e[_0x549a('0x1a')],'as':_0x549a('0x1f'),'attributes':_['keys'](_0x44730e)}]}]});})['then'](function(_0xc3a05f){_0x2561e8=_0xc3a05f[_0x549a('0x20')]({'plain':!![]});if(_0x2561e8&&_0x2561e8[_0x549a('0x21')]){logger[_0x549a('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x549a('0x23'),util['format'](_0x549a('0x24'),_0x35d6f8['id'],_0x2561e8[_0x549a('0x21')]));if(_0x2561e8[_0x549a('0x1e')]&&_0x2561e8['Interactions']['length']){_0x35d6f8[_0x549a('0x25')]=_[_0x549a('0x26')](_0x2561e8[_0x549a('0x1e')][0x0],_0x549a('0x1f'));_0x35d6f8[_0x549a('0x1f')]=_0x2561e8[_0x549a('0x1e')][0x0]['Contact'];}var _0x529d21={'method':_0x549a('0x27'),'uri':encodeURI(_0x2561e8[_0x549a('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x529d21['method']){case _0x549a('0x28'):_0x529d21['qs']=_0x35d6f8;break;case _0x549a('0x27'):_0x529d21[_0x549a('0xa')]=_0x35d6f8;break;}return rp(_0x529d21)[_0x549a('0x14')](function(_0x459892){logger[_0x549a('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x549a('0x29')](_0x549a('0x2a'),_0x35d6f8['id'],_0x2561e8[_0x549a('0x21')]));if(_0x459892['body'][_0x549a('0x2b')]&&_0x459892[_0x549a('0xa')][_0x549a('0x2b')]!=_0x35d6f8[_0x549a('0x25')][_0x549a('0x2b')]){return _0x14f39e[_0x549a('0x11')]['update']({'threadId':_0x459892[_0x549a('0xa')]['threadId']},{'where':{'id':_0x35d6f8['Interaction']['id']}});}else{return;}})[_0x549a('0x14')](function(){return _0x2521fa[_0x549a('0x15')]({'read':!![]});})[_0x549a('0x17')](function(_0xe2a2d){logger[_0x549a('0x18')](_0x549a('0x2c'),_0x549a('0x23'),util[_0x549a('0x2d')](_0xe2a2d,{'showHidden':![],'depth':null}));_0xce8083();});}else{_0xce8083();}})[_0x549a('0x2e')](function(){_0xce8083();});}else{_0xce8083();}}},'charset':'utf8mb4','collate':_0x549a('0x2f')});}; \ No newline at end of file +var _0xc270=['../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','toLowerCase','direction','out','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','omit','method','GET','POST','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x235f1f,_0x23e8d5){var _0x52d082=function(_0x4f6163){while(--_0x4f6163){_0x235f1f['push'](_0x235f1f['shift']());}};_0x52d082(++_0x23e8d5);}(_0xc270,0x8b));var _0x0c27=function(_0x61a2c7,_0x32df9b){_0x61a2c7=_0x61a2c7-0x0;var _0x54aaa3=_0xc270[_0x61a2c7];return _0x54aaa3;};'use strict';var _=require('lodash');var util=require(_0x0c27('0x0'));var logger=require(_0x0c27('0x1'))(_0x0c27('0x2'));var moment=require(_0x0c27('0x3'));var BPromise=require(_0x0c27('0x4'));var rp=require(_0x0c27('0x5'));var fs=require('fs');var path=require(_0x0c27('0x6'));var rimraf=require(_0x0c27('0x7'));var config=require(_0x0c27('0x8'));var attributes=require(_0x0c27('0x9'));module[_0x0c27('0xa')]=function(_0x46667e,_0x822bd5){return _0x46667e[_0x0c27('0xb')](_0x0c27('0xc'),attributes,{'tableName':_0x0c27('0xd'),'paranoid':![],'indexes':[{'name':_0x0c27('0xe'),'fields':[_0x0c27('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23c6f0,_0x43a3cf,_0x1a7856){var _0x8452ab=_0x46667e[_0x0c27('0x10')];var _0x4cba03=_0x23c6f0[_0x0c27('0x11')]({'plain':!![]});if(_0x4cba03['direction'][_0x0c27('0x12')]()==='in'||_0x4cba03[_0x0c27('0x13')]['toLowerCase']()===_0x0c27('0x14')&&!_0x4cba03['secret']&&!_[_0x0c27('0x15')](_0x4cba03['UserId'])){_0x8452ab[_0x0c27('0x16')][_0x0c27('0x17')]({'where':{'id':_0x4cba03[_0x0c27('0x18')]}})[_0x0c27('0x19')](function(_0x45ee84){if(_0x45ee84){_0x45ee84[_0x0c27('0x1a')]({'lastMsgAt':_0x4cba03['createdAt'],'lastMsgDirection':_0x4cba03[_0x0c27('0x13')][_0x0c27('0x12')]()});}})[_0x0c27('0x1b')](function(_0x2ab372){console[_0x0c27('0x1c')](_0x2ab372);});}if(_0x4cba03[_0x0c27('0x13')]===_0x0c27('0x14')&&!_0x4cba03['secret']){var _0x5b057b;_0x8452ab[_0x0c27('0x1d')][_0x0c27('0x1e')]()[_0x0c27('0x19')](function(_0x3e1ab7){return _0x8452ab['OpenchannelAccount'][_0x0c27('0x1f')]({'where':{'id':_0x4cba03[_0x0c27('0x20')]},'include':[{'model':_0x8452ab[_0x0c27('0x16')],'as':_0x0c27('0x21'),'where':{'id':_0x4cba03[_0x0c27('0x18')]},'limit':0x1,'include':[{'model':_0x8452ab[_0x0c27('0x1d')],'as':_0x0c27('0x22'),'attributes':_[_0x0c27('0x23')](_0x3e1ab7)}]}]});})[_0x0c27('0x19')](function(_0x48d31a){_0x5b057b=_0x48d31a['get']({'plain':!![]});if(_0x5b057b&&_0x5b057b[_0x0c27('0x24')]){logger[_0x0c27('0x25')](_0x0c27('0x26'),_0x0c27('0x27'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x4cba03['id'],_0x5b057b['replyUri']));if(_0x5b057b[_0x0c27('0x21')]&&_0x5b057b[_0x0c27('0x21')]['length']){_0x4cba03['Interaction']=_[_0x0c27('0x28')](_0x5b057b[_0x0c27('0x21')][0x0],_0x0c27('0x22'));_0x4cba03['Contact']=_0x5b057b[_0x0c27('0x21')][0x0][_0x0c27('0x22')];}var _0x43a3cf={'method':'POST','uri':encodeURI(_0x5b057b[_0x0c27('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x43a3cf[_0x0c27('0x29')]){case _0x0c27('0x2a'):_0x43a3cf['qs']=_0x4cba03;break;case _0x0c27('0x2b'):_0x43a3cf[_0x0c27('0xf')]=_0x4cba03;break;}return rp(_0x43a3cf)[_0x0c27('0x19')](function(_0x1fc461){logger['info'](_0x0c27('0x26'),_0x0c27('0x27'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x4cba03['id'],_0x5b057b['replyUri']));if(_0x1fc461['body'][_0x0c27('0x2c')]&&_0x1fc461['body'][_0x0c27('0x2c')]!=_0x4cba03[_0x0c27('0x2d')][_0x0c27('0x2c')]){return _0x8452ab['OpenchannelInteraction'][_0x0c27('0x1a')]({'threadId':_0x1fc461['body'][_0x0c27('0x2c')]},{'where':{'id':_0x4cba03[_0x0c27('0x2d')]['id']}});}else{return;}})[_0x0c27('0x19')](function(){return _0x23c6f0[_0x0c27('0x1a')]({'read':!![]});})[_0x0c27('0x1b')](function(_0x29545e){logger[_0x0c27('0x1c')](_0x0c27('0x26'),_0x0c27('0x27'),util[_0x0c27('0x2e')](_0x29545e,{'showHidden':![],'depth':null}));_0x1a7856();});}else{_0x1a7856();}})['finally'](function(){_0x1a7856();});}else{_0x1a7856();}}},'charset':_0x0c27('0x2f'),'collate':_0x0c27('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 84eb531..70153c5 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x3922cc,_0x5ec3ac){var _0x45fd94=function(_0x2b3e12){while(--_0x2b3e12){_0x3922cc['push'](_0x3922cc['shift']());}};_0x45fd94(++_0x5ec3ac);}(_0x2ef3,0xba));var _0x32ef=function(_0x351bc3,_0x176f23){_0x351bc3=_0x351bc3-0x0;var _0x320e6c=_0x2ef3[_0x351bc3];return _0x320e6c;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3749f7,_0x352281){var _0x2556aa=function(_0x4bb791){while(--_0x4bb791){_0x3749f7['push'](_0x3749f7['shift']());}};_0x2556aa(++_0x352281);}(_0x7a54,0x106));var _0x47a5=function(_0x88b2b9,_0x4a32df){_0x88b2b9=_0x88b2b9-0x0;var _0x1181fb=_0x7a54[_0x88b2b9];return _0x1181fb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b7f0e72..8f7c84e 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 _0x2c4d=['register','length','./openchannelMessage.events','remove','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2c4d,0x188));var _0xd2c4=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x2c4d[_0x5e8282];return _0x5cd37d;};'use strict';var OpenchannelMessageEvents=require(_0xd2c4('0x0'));var events=['save',_0xd2c4('0x1'),_0xd2c4('0x2')];function createListener(_0xfbc2aa,_0x290497){return function(_0x4012cd){_0x290497['emit'](_0xfbc2aa,_0x4012cd);};}function removeListener(_0x13aaf7,_0x29bc20){return function(){OpenchannelMessageEvents['removeListener'](_0x13aaf7,_0x29bc20);};}exports[_0xd2c4('0x3')]=function(_0x59f368){for(var _0x22c9f1=0x0,_0x11cd98=events[_0xd2c4('0x4')];_0x22c9f1<_0x11cd98;_0x22c9f1++){var _0x55a86e=events[_0x22c9f1];var _0x355200=createListener('openchannelMessage:'+_0x55a86e,_0x59f368);OpenchannelMessageEvents['on'](_0x55a86e,_0x355200);}}; \ No newline at end of file +var _0xddd2=['removeListener','length','./openchannelMessage.events','remove','emit'];(function(_0x1dfa83,_0x53aa2e){var _0x2d368b=function(_0x80a216){while(--_0x80a216){_0x1dfa83['push'](_0x1dfa83['shift']());}};_0x2d368b(++_0x53aa2e);}(_0xddd2,0x1e2));var _0x2ddd=function(_0x17ade0,_0x179187){_0x17ade0=_0x17ade0-0x0;var _0x5e0c00=_0xddd2[_0x17ade0];return _0x5e0c00;};'use strict';var OpenchannelMessageEvents=require(_0x2ddd('0x0'));var events=['save',_0x2ddd('0x1'),'update'];function createListener(_0x2e6d13,_0x390b71){return function(_0x121f7f){_0x390b71[_0x2ddd('0x2')](_0x2e6d13,_0x121f7f);};}function removeListener(_0x38ce79,_0x44befd){return function(){OpenchannelMessageEvents[_0x2ddd('0x3')](_0x38ce79,_0x44befd);};}exports['register']=function(_0x46c62d){for(var _0x122551=0x0,_0x38a32c=events[_0x2ddd('0x4')];_0x122551<_0x38a32c;_0x122551++){var _0x2229ad=events[_0x122551];var _0xb9ccb9=createListener('openchannelMessage:'+_0x2229ad,_0x46c62d);OpenchannelMessageEvents['on'](_0x2229ad,_0xb9ccb9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 358dba7..d33c3b6 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 _0x9066=['removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','/:id','update','delete','destroy'];(function(_0x13ea9e,_0x4002eb){var _0x224756=function(_0x4915d){while(--_0x4915d){_0x13ea9e['push'](_0x13ea9e['shift']());}};_0x224756(++_0x4002eb);}(_0x9066,0x197));var _0x6906=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9066[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6906('0x0'));var path=require('path');var timeout=require(_0x6906('0x1'));var express=require(_0x6906('0x2'));var router=express[_0x6906('0x3')]();var fs_extra=require(_0x6906('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6906('0x5'));var config=require('../../config/environment');var controller=require(_0x6906('0x6'));router[_0x6906('0x7')]('/',auth[_0x6906('0x8')](),controller['index']);router['get'](_0x6906('0x9'),auth[_0x6906('0x8')](),controller[_0x6906('0xa')]);router[_0x6906('0x7')]('/:id',auth[_0x6906('0x8')](),controller[_0x6906('0xb')]);router[_0x6906('0x7')](_0x6906('0xc'),auth[_0x6906('0x8')](),controller[_0x6906('0xd')]);router[_0x6906('0x7')](_0x6906('0xe'),auth[_0x6906('0x8')](),controller['getTeams']);router[_0x6906('0x7')](_0x6906('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6906('0x10')]('/',auth[_0x6906('0x8')](),controller[_0x6906('0x11')]);router[_0x6906('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6906('0x12')]);router[_0x6906('0x10')](_0x6906('0xf'),auth[_0x6906('0x8')](),controller[_0x6906('0x13')]);router[_0x6906('0x14')](_0x6906('0x15'),auth[_0x6906('0x8')](),controller[_0x6906('0x16')]);router[_0x6906('0x17')](_0x6906('0x15'),auth[_0x6906('0x8')](),controller[_0x6906('0x18')]);router[_0x6906('0x17')](_0x6906('0xe'),auth['isAuthenticated'](),controller[_0x6906('0x19')]);router[_0x6906('0x17')](_0x6906('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6906('0x1a')]=router; \ No newline at end of file +var _0xccb9=['create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x354279,_0x51f991){var _0x323fd7=function(_0x42d1f5){while(--_0x42d1f5){_0x354279['push'](_0x354279['shift']());}};_0x323fd7(++_0x51f991);}(_0xccb9,0xda));var _0x9ccb=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xccb9[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0x9ccb('0x0'));var util=require(_0x9ccb('0x1'));var path=require(_0x9ccb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ccb('0x3')]();var fs_extra=require(_0x9ccb('0x4'));var auth=require(_0x9ccb('0x5'));var interaction=require(_0x9ccb('0x6'));var config=require(_0x9ccb('0x7'));var controller=require(_0x9ccb('0x8'));router[_0x9ccb('0x9')]('/',auth[_0x9ccb('0xa')](),controller['index']);router[_0x9ccb('0x9')](_0x9ccb('0xb'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0xc')]);router[_0x9ccb('0x9')](_0x9ccb('0xd'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0xe')]);router[_0x9ccb('0x9')](_0x9ccb('0xf'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x10')]);router[_0x9ccb('0x9')](_0x9ccb('0x11'),auth['isAuthenticated'](),controller[_0x9ccb('0x12')]);router[_0x9ccb('0x9')](_0x9ccb('0x13'),auth['isAuthenticated'](),controller[_0x9ccb('0x14')]);router[_0x9ccb('0x15')]('/',auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x16')]);router[_0x9ccb('0x15')](_0x9ccb('0x11'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x17')]);router['post']('/:id/users',auth[_0x9ccb('0xa')](),controller['addAgents']);router[_0x9ccb('0x18')]('/:id',auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x19')]);router[_0x9ccb('0x1a')](_0x9ccb('0xd'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x1b')]);router[_0x9ccb('0x1a')](_0x9ccb('0x11'),auth[_0x9ccb('0xa')](),controller[_0x9ccb('0x1c')]);router[_0x9ccb('0x1a')](_0x9ccb('0x13'),auth['isAuthenticated'](),controller[_0x9ccb('0x1d')]);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 80921ee..99e530b 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 _0xd7e9=['ENUM','rrmemory','sequelize','exports','STRING','name','INTEGER'];(function(_0x2616f3,_0x51d3f3){var _0x43716a=function(_0x397754){while(--_0x397754){_0x2616f3['push'](_0x2616f3['shift']());}};_0x43716a(++_0x51d3f3);}(_0xd7e9,0x1de));var _0x9d7e=function(_0x49dcfc,_0x5dda03){_0x49dcfc=_0x49dcfc-0x0;var _0x5624b3=_0xd7e9[_0x49dcfc];return _0x5624b3;};'use strict';var Sequelize=require(_0x9d7e('0x0'));module[_0x9d7e('0x1')]={'name':{'type':Sequelize[_0x9d7e('0x2')],'unique':_0x9d7e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x9d7e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d7e('0x5')](_0x9d7e('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x5882=['ENUM','rrmemory','roundrobin','sequelize','STRING','INTEGER'];(function(_0x1a0a65,_0x1d6016){var _0x5cedf2=function(_0x3d0551){while(--_0x3d0551){_0x1a0a65['push'](_0x1a0a65['shift']());}};_0x5cedf2(++_0x1d6016);}(_0x5882,0x13b));var _0x2588=function(_0x551aeb,_0x9f1045){_0x551aeb=_0x551aeb-0x0;var _0x19b459=_0x5882[_0x551aeb];return _0x19b459;};'use strict';var Sequelize=require(_0x2588('0x0'));module['exports']={'name':{'type':Sequelize[_0x2588('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2588('0x1')]},'timeout':{'type':Sequelize[_0x2588('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2588('0x3')](_0x2588('0x4'),'beepall',_0x2588('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 0e6ba7b..d4c9e51 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 _0x2eb9=['OpenchannelQueue','query','findAll','rows','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','include','merge','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','keys','UserOpenchannelQueue','hasOwnProperty','sort','OpenchannelQueueId','filter','options','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','map','format','SIP','getTeams','findOne','Team','order','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','isArray','getAgents','nolimit','bluebird','util','ioredis','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','where'];(function(_0x38c7d8,_0x253557){var _0x266426=function(_0x2f727b){while(--_0x2f727b){_0x38c7d8['push'](_0x38c7d8['shift']());}};_0x266426(++_0x253557);}(_0x2eb9,0x156));var _0x92eb=function(_0x5717d6,_0x5135ad){_0x5717d6=_0x5717d6-0x0;var _0x960ca5=_0x2eb9[_0x5717d6];return _0x960ca5;};'use strict';var BPromise=require(_0x92eb('0x0'));var util=require(_0x92eb('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0x92eb('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x92eb('0x3'));var config=require('../../config/environment');var db=require(_0x92eb('0x4'))['db'];config[_0x92eb('0x5')]=_[_0x92eb('0x6')](config['redis'],{'host':_0x92eb('0x7'),'port':0x18eb});var socket=require(_0x92eb('0x8'))(new Redis(config[_0x92eb('0x5')]));require(_0x92eb('0x9'))[_0x92eb('0xa')](socket);function respondWithStatusCode(_0x2582e9,_0x120446){_0x120446=_0x120446||0xcc;return function(_0x13f75a){if(_0x13f75a){return _0x2582e9[_0x92eb('0xb')](_0x120446);}return _0x2582e9[_0x92eb('0xc')](_0x120446)[_0x92eb('0xd')]();};}function respondWithResult(_0x466c9d,_0xbd7386){_0xbd7386=_0xbd7386||0xc8;return function(_0x95bae){if(_0x95bae){return _0x466c9d['status'](_0xbd7386)[_0x92eb('0xe')](_0x95bae);}};}function respondWithFilteredResult(_0x3b259e,_0x3ff09f){return function(_0x18a47a){if(_0x18a47a){var _0x69b80=typeof _0x3ff09f['offset']==='undefined'&&typeof _0x3ff09f[_0x92eb('0xf')]==='undefined';var _0x3a9ced=_0x18a47a[_0x92eb('0x10')];var _0x39678a=_0x69b80?0x0:_0x3ff09f[_0x92eb('0x11')];var _0x1d6171=_0x69b80?_0x18a47a[_0x92eb('0x10')]:_0x3ff09f['offset']+_0x3ff09f[_0x92eb('0xf')];var _0x166f1f;if(_0x1d6171>=_0x3a9ced){_0x1d6171=_0x3a9ced;_0x166f1f=0xc8;}else{_0x166f1f=0xce;}_0x3b259e[_0x92eb('0xc')](_0x166f1f);return _0x3b259e[_0x92eb('0x12')](_0x92eb('0x13'),_0x39678a+'-'+_0x1d6171+'/'+_0x3a9ced)['json'](_0x18a47a);}return null;};}function saveUpdates(_0x4a71d4){return function(_0x2198b0){if(_0x2198b0){return _0x2198b0[_0x92eb('0x14')](_0x4a71d4)['then'](function(_0x40f402){return _0x40f402;});}return null;};}function removeEntity(_0x416982){return function(_0x22b830){if(_0x22b830){return _0x22b830['destroy']()[_0x92eb('0x15')](function(){var _0x3a3b81=_0x22b830[_0x92eb('0x16')]({'plain':!![]});var _0xfec2a8=_0x92eb('0x17');return db[_0x92eb('0x18')][_0x92eb('0x19')]({'where':{'type':_0xfec2a8,'resourceId':_0x3a3b81['id']}})[_0x92eb('0x15')](function(){return _0x22b830;});})[_0x92eb('0x15')](function(){_0x416982[_0x92eb('0xc')](0xcc)[_0x92eb('0xd')]();});}};}function handleEntityNotFound(_0x2335c5){return function(_0x583e4f){if(!_0x583e4f){_0x2335c5[_0x92eb('0xb')](0x194);}return _0x583e4f;};}function handleError(_0x4b0227,_0x4de1d6){_0x4de1d6=_0x4de1d6||0x1f4;return function(_0x2baa5b){logger[_0x92eb('0x1a')](_0x2baa5b[_0x92eb('0x1b')]);if(_0x2baa5b[_0x92eb('0x1c')]){delete _0x2baa5b['name'];}_0x4b0227[_0x92eb('0xc')](_0x4de1d6)[_0x92eb('0x1d')](_0x2baa5b);};}exports[_0x92eb('0x1e')]=function(_0x557dba,_0x4aedfb){var _0x546aab={};var _0x2e516d={'count':0x0,'rows':[]};var _0x3aebd8=_['map'](db['OpenchannelQueue'][_0x92eb('0x1f')],function(_0x577d1f){return{'name':_0x577d1f[_0x92eb('0x20')],'type':_0x577d1f[_0x92eb('0x21')][_0x92eb('0x22')]};});_0x546aab=qs['getOptions'](_0x3aebd8,_0x557dba);var _0xd342ed={'where':_0x546aab[_0x92eb('0x23')]};return db[_0x92eb('0x24')][_0x92eb('0x10')](_0xd342ed)[_0x92eb('0x15')](function(_0xf76954){_0x2e516d['count']=_0xf76954;_0x546aab['include']=qs['include'](_0x557dba[_0x92eb('0x25')]);return db['OpenchannelQueue'][_0x92eb('0x26')](_0x546aab);})[_0x92eb('0x15')](function(_0xea00a4){_0x2e516d[_0x92eb('0x27')]=_0xea00a4;return _0x2e516d;})[_0x92eb('0x15')](respondWithFilteredResult(_0x4aedfb,_0x546aab))[_0x92eb('0x28')](handleError(_0x4aedfb,null));};exports[_0x92eb('0x29')]=function(_0x525ddb,_0x1e47ff){var _0x30d530={'raw':!![],'where':{'id':_0x525ddb[_0x92eb('0x2a')]['id']}},_0x38db85={};_0x38db85[_0x92eb('0x2b')]=_['keys'](db[_0x92eb('0x24')][_0x92eb('0x1f')]);_0x38db85[_0x92eb('0x25')]=_['keys'](_0x525ddb[_0x92eb('0x25')]);_0x38db85[_0x92eb('0x2c')]=_[_0x92eb('0x2d')](_0x38db85[_0x92eb('0x2b')],_0x38db85[_0x92eb('0x25')]);_0x30d530[_0x92eb('0x2e')]=_[_0x92eb('0x2d')](_0x38db85[_0x92eb('0x2b')],qs[_0x92eb('0x2f')](_0x525ddb[_0x92eb('0x25')][_0x92eb('0x2f')]));_0x30d530['attributes']=_0x30d530[_0x92eb('0x2e')][_0x92eb('0x30')]?_0x30d530[_0x92eb('0x2e')]:_0x38db85[_0x92eb('0x2b')];if(_0x525ddb[_0x92eb('0x25')][_0x92eb('0x31')]){_0x30d530[_0x92eb('0x32')]=[{'all':!![]}];}_0x30d530=_[_0x92eb('0x33')]({},_0x30d530,_0x525ddb['options']);return db['OpenchannelQueue'][_0x92eb('0x34')](_0x30d530)['then'](handleEntityNotFound(_0x1e47ff,null))[_0x92eb('0x15')](respondWithResult(_0x1e47ff,null))['catch'](handleError(_0x1e47ff,null));};exports['create']=function(_0x5ae182,_0x3b3713){return db[_0x92eb('0x24')]['create'](_0x5ae182['body'],{})[_0x92eb('0x15')](function(_0x428734){var _0x1d3c02=_0x5ae182[_0x92eb('0x35')][_0x92eb('0x16')]({'plain':!![]});if(!_0x1d3c02)throw new Error(_0x92eb('0x36'));if(_0x1d3c02[_0x92eb('0x37')]===_0x92eb('0x35')){var _0x3d6600=_0x428734[_0x92eb('0x16')]({'plain':!![]});var _0x12e310='OpenchannelQueues';return db[_0x92eb('0x38')][_0x92eb('0x34')]({'where':{'name':_0x12e310,'userProfileId':_0x1d3c02[_0x92eb('0x39')]},'raw':!![]})['then'](function(_0x30f3ed){if(_0x30f3ed&&_0x30f3ed[_0x92eb('0x3a')]===0x0){return db['UserProfileResource'][_0x92eb('0x3b')]({'name':_0x3d6600[_0x92eb('0x1c')],'resourceId':_0x3d6600['id'],'type':_0x30f3ed[_0x92eb('0x1c')],'sectionId':_0x30f3ed['id']},{})[_0x92eb('0x15')](function(){return _0x428734;});}else{return _0x428734;}})[_0x92eb('0x28')](function(_0x5b51a4){logger[_0x92eb('0x1a')](_0x92eb('0x3c'),_0x5b51a4);throw _0x5b51a4;});}return _0x428734;})[_0x92eb('0x15')](respondWithResult(_0x3b3713,0xc9))[_0x92eb('0x28')](handleError(_0x3b3713,null));};exports[_0x92eb('0x14')]=function(_0x32108e,_0x388d6f){if(_0x32108e['body']['id']){delete _0x32108e[_0x92eb('0x3d')]['id'];}return db[_0x92eb('0x24')][_0x92eb('0x34')]({'where':{'id':_0x32108e['params']['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x388d6f,null))[_0x92eb('0x15')](saveUpdates(_0x32108e['body'],null))['then'](respondWithResult(_0x388d6f,null))[_0x92eb('0x28')](handleError(_0x388d6f,null));};exports[_0x92eb('0x19')]=function(_0x280d5a,_0x144701){return db[_0x92eb('0x24')]['find']({'where':{'id':_0x280d5a['params']['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x144701,null))[_0x92eb('0x15')](removeEntity(_0x144701,null))[_0x92eb('0x28')](handleError(_0x144701,null));};exports['describe']=function(_0x5aa8fb,_0x11e0f7){return db['OpenchannelQueue'][_0x92eb('0x3e')]()[_0x92eb('0x15')](respondWithResult(_0x11e0f7,null))[_0x92eb('0x28')](handleError(_0x11e0f7,null));};exports[_0x92eb('0x3f')]=function(_0x53788d,_0x2d3d7a){var _0x12f40d={'raw':!![],'where':{}},_0x2e28a2={},_0xb26464;return db[_0x92eb('0x24')]['findOne']({'where':{'id':_0x53788d[_0x92eb('0x2a')]['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x2d3d7a,null))[_0x92eb('0x15')](function(_0x55793e){if(_0x55793e){_0xb26464=_0x55793e[_0x92eb('0x16')]({'plain':!![]});_0x2e28a2[_0x92eb('0x2b')]=_[_0x92eb('0x40')](db[_0x92eb('0x41')][_0x92eb('0x1f')]);_0x2e28a2[_0x92eb('0x25')]=_[_0x92eb('0x40')](_0x53788d[_0x92eb('0x25')]);_0x2e28a2['filters']=_[_0x92eb('0x2d')](_0x2e28a2[_0x92eb('0x2b')],_0x2e28a2[_0x92eb('0x25')]);_0x12f40d[_0x92eb('0x2e')]=_[_0x92eb('0x2d')](_0x2e28a2[_0x92eb('0x2b')],qs[_0x92eb('0x2f')](_0x53788d['query'][_0x92eb('0x2f')]));_0x12f40d[_0x92eb('0x2e')]=_0x12f40d[_0x92eb('0x2e')]['length']?_0x12f40d[_0x92eb('0x2e')]:_0x2e28a2[_0x92eb('0x2b')];if(!_0x53788d[_0x92eb('0x25')][_0x92eb('0x42')]('nolimit')){_0x12f40d[_0x92eb('0xf')]=qs[_0x92eb('0xf')](_0x53788d[_0x92eb('0x25')]['limit']);_0x12f40d['offset']=qs[_0x92eb('0x11')](_0x53788d[_0x92eb('0x25')][_0x92eb('0x11')]);}_0x12f40d['order']=qs[_0x92eb('0x43')](_0x53788d['query'][_0x92eb('0x43')]);_0x12f40d[_0x92eb('0x23')]=qs['filters'](_['pick'](_0x53788d[_0x92eb('0x25')],_0x2e28a2[_0x92eb('0x2c')]));_0x12f40d[_0x92eb('0x23')][_0x92eb('0x44')]=_0x55793e['id'];if(_0x53788d[_0x92eb('0x25')][_0x92eb('0x45')]){_0x12f40d[_0x92eb('0x23')]=_[_0x92eb('0x33')](_0x12f40d[_0x92eb('0x23')],{'$or':_['map'](_0x12f40d[_0x92eb('0x2e')],function(_0x3e7636){var _0x21efcf={};_0x21efcf[_0x3e7636]={'$like':'%'+_0x53788d['query'][_0x92eb('0x45')]+'%'};return _0x21efcf;})});}_0x12f40d=_['merge']({},_0x12f40d,_0x53788d[_0x92eb('0x46')]);return db[_0x92eb('0x41')][_0x92eb('0x26')](_0x12f40d);}})[_0x92eb('0x15')](function(_0x3812c9){if(_0x3812c9){return db[_0x92eb('0x47')][_0x92eb('0x48')]({'where':{'id':_['map'](_0x3812c9,_0x92eb('0x49')),'role':_0x92eb('0x4a')},'attributes':['id','name',_0x92eb('0x4b'),_0x92eb('0x4c'),_0x92eb('0x4d')]});}})[_0x92eb('0x15')](function(_0x452cf8){if(_0x452cf8){return{'count':_0x452cf8[_0x92eb('0x10')],'rows':_[_0x92eb('0x4e')](_0x452cf8[_0x92eb('0x27')],function(_0x167aba){return{'membername':_0x167aba['name'],'UserId':_0x167aba['id'],'queue_name':_0xb26464['name'],'OpenchannelQueueId':_0xb26464['id'],'interface':util[_0x92eb('0x4f')]('%s/%s',_0x92eb('0x50'),_0x167aba[_0x92eb('0x1c')]),'penalty':0x0,'paused':_0x167aba['openchannelPause'],'createdAt':_0x167aba[_0x92eb('0x4d')],'updatedAt':_0x167aba[_0x92eb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d3d7a,_0x12f40d))[_0x92eb('0x28')](handleError(_0x2d3d7a,null));};exports[_0x92eb('0x51')]=function(_0x4fe7a3,_0x241de5){var _0x5219cb={};var _0x40a690={};var _0x51fb6a;var _0xb5aa91;return db[_0x92eb('0x24')][_0x92eb('0x52')]({'where':{'id':_0x4fe7a3[_0x92eb('0x2a')]['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x241de5,null))[_0x92eb('0x15')](function(_0x5340dd){if(_0x5340dd){_0x51fb6a=_0x5340dd;_0x40a690[_0x92eb('0x2b')]=_['keys'](db[_0x92eb('0x53')]['rawAttributes']);_0x40a690[_0x92eb('0x25')]=_[_0x92eb('0x40')](_0x4fe7a3[_0x92eb('0x25')]);_0x40a690[_0x92eb('0x2c')]=_['intersection'](_0x40a690[_0x92eb('0x2b')],_0x40a690[_0x92eb('0x25')]);_0x5219cb[_0x92eb('0x2e')]=_[_0x92eb('0x2d')](_0x40a690[_0x92eb('0x2b')],qs[_0x92eb('0x2f')](_0x4fe7a3[_0x92eb('0x25')]['fields']));_0x5219cb['attributes']=_0x5219cb[_0x92eb('0x2e')][_0x92eb('0x30')]?_0x5219cb[_0x92eb('0x2e')]:_0x40a690[_0x92eb('0x2b')];_0x5219cb[_0x92eb('0x54')]=qs[_0x92eb('0x43')](_0x4fe7a3['query'][_0x92eb('0x43')]);_0x5219cb['where']=qs[_0x92eb('0x2c')](_[_0x92eb('0x55')](_0x4fe7a3[_0x92eb('0x25')],_0x40a690[_0x92eb('0x2c')]));if(_0x4fe7a3['query'][_0x92eb('0x45')]){_0x5219cb[_0x92eb('0x23')]=_['merge'](_0x5219cb[_0x92eb('0x23')],{'$or':_[_0x92eb('0x4e')](_0x5219cb[_0x92eb('0x2e')],function(_0x54b8c3){var _0x4d5fa4={};_0x4d5fa4[_0x54b8c3]={'$like':'%'+_0x4fe7a3[_0x92eb('0x25')][_0x92eb('0x45')]+'%'};return _0x4d5fa4;})});}_0x5219cb=_['merge']({},_0x5219cb,_0x4fe7a3[_0x92eb('0x46')]);return _0x51fb6a[_0x92eb('0x51')](_0x5219cb);}})['then'](function(_0x154574){if(_0x154574){_0xb5aa91=_0x154574[_0x92eb('0x30')];if(!_0x4fe7a3[_0x92eb('0x25')][_0x92eb('0x42')]('nolimit')){_0x5219cb[_0x92eb('0xf')]=qs[_0x92eb('0xf')](_0x4fe7a3['query'][_0x92eb('0xf')]);_0x5219cb[_0x92eb('0x11')]=qs[_0x92eb('0x11')](_0x4fe7a3[_0x92eb('0x25')][_0x92eb('0x11')]);}return _0x51fb6a[_0x92eb('0x51')](_0x5219cb);}})[_0x92eb('0x15')](function(_0x59ca1e){if(_0x59ca1e){return _0x59ca1e?{'count':_0xb5aa91,'rows':_0x59ca1e}:null;}})[_0x92eb('0x15')](respondWithResult(_0x241de5,null))['catch'](handleError(_0x241de5,null));};exports[_0x92eb('0x56')]=function(_0x5b52c1,_0x4db14a){var _0x26dec2=_0x5b52c1[_0x92eb('0x3d')][_0x92eb('0x57')];return db[_0x92eb('0x53')][_0x92eb('0x26')]({'where':{'id':_0x26dec2},'attributes':['id'],'include':[{'model':db[_0x92eb('0x47')],'as':_0x92eb('0x58'),'attributes':['id','name',_0x92eb('0x59'),_0x92eb('0x5a'),_0x92eb('0x5b')],'raw':!![]}]})[_0x92eb('0x15')](function(_0x23b735){if(_0x23b735){var _0x1e423b=_[_0x92eb('0x5c')](_0x23b735,function(_0x220c60){var _0x5ca51e=_0x220c60['get']({'plain':!![]});return _0x5ca51e[_0x92eb('0x58')];});return db[_0x92eb('0x24')]['find']({'where':{'id':_0x5b52c1['params']['id']}})[_0x92eb('0x15')](function(_0x2558c9){return db['sequelize']['transaction'](function(_0x3fb493){return _0x2558c9[_0x92eb('0x56')](_0x26dec2,{'transaction':_0x3fb493})[_0x92eb('0x15')](function(){return BPromise[_0x92eb('0x5d')](_0x1e423b,function(_0x375ca0){return db['UserOpenchannelQueue'][_0x92eb('0x5e')]({'where':{'UserId':_0x375ca0['id'],'OpenchannelQueueId':_0x5b52c1[_0x92eb('0x2a')]['id']},'transaction':_0x3fb493});});})[_0x92eb('0x15')](function(){_0x1e423b[_0x92eb('0x5f')](function(_0x1b2b0f){socket['emit'](_0x92eb('0x60'),{'UserId':_0x1b2b0f['id'],'OpenchannelQueueId':_0x2558c9['id']});});});});});}})[_0x92eb('0x15')](respondWithStatusCode(_0x4db14a,null))['catch'](handleError(_0x4db14a,null));};exports[_0x92eb('0x61')]=function(_0x522a95,_0x57866f){return db[_0x92eb('0x53')]['findAll']({'where':{'id':_0x522a95[_0x92eb('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x92eb('0x47')],'as':_0x92eb('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x57866f,null))[_0x92eb('0x15')](function(_0x5d3f99){var _0x1fb018=_['map'](_0x5d3f99,'id');var _0x5070c9=[];var _0x313bb5=[];var _0x4fc191=squel[_0x92eb('0x62')]();_0x4fc191[_0x92eb('0x63')](_0x92eb('0x64'))['from'](_0x92eb('0x65'),'tq')['join'](_0x92eb('0x66'),'ut',_0x92eb('0x67'))[_0x92eb('0x23')](_0x92eb('0x68'),_0x522a95[_0x92eb('0x2a')]['id']);for(var _0x42a14c=0x0;_0x42a14c<_0x5d3f99[_0x92eb('0x30')];_0x42a14c+=0x1){let _0x1ad052=_0x5d3f99[_0x42a14c];for(var _0x45fed5=0x0;_0x45fed5<_0x1ad052[_0x92eb('0x58')]['length'];_0x45fed5+=0x1){let _0x5f2d25=_0x1ad052[_0x92eb('0x58')][_0x45fed5];var _0x59e832=_0x4fc191['clone']();_0x59e832[_0x92eb('0x23')](_0x92eb('0x69'),_0x5f2d25['id']);_0x313bb5[_0x92eb('0x6a')](db[_0x92eb('0x6b')][_0x92eb('0x25')](_0x59e832['toString'](),{'type':db['sequelize'][_0x92eb('0x6c')][_0x92eb('0x6d')]})[_0x92eb('0x15')](function(_0xfa9ca){if(_0xfa9ca[_0x92eb('0x30')]===0x1){return _0x5f2d25['id'];}else{var _0x89b124=_[_0x92eb('0x6e')](_[_0x92eb('0x4e')](_0xfa9ca,_0x92eb('0x6f')),function(_0x557322){return _[_0x92eb('0x70')](_0x1fb018,_0x557322);});if(_0x89b124){return _0x5f2d25['id'];}}}));}}return BPromise[_0x92eb('0x71')](_0x313bb5)[_0x92eb('0x15')](function(_0x42ae5b){_0x5070c9=_(_0x5070c9)[_0x92eb('0x72')](_0x42ae5b)[_0x92eb('0x73')]()[_0x92eb('0x74')]();return db[_0x92eb('0x24')][_0x92eb('0x34')]({'where':{'id':_0x522a95['params']['id']}})['then'](function(_0x5c828b){return db['sequelize'][_0x92eb('0x75')](function(_0x2ff423){return _0x5c828b[_0x92eb('0x61')](_0x522a95[_0x92eb('0x25')][_0x92eb('0x57')],{'transaction':_0x2ff423})[_0x92eb('0x15')](function(){if(!_[_0x92eb('0x76')](_0x5070c9)){return _0x5c828b[_0x92eb('0x77')](_0x5070c9,{'transaction':_0x2ff423});}})[_0x92eb('0x15')](function(){_0x5070c9[_0x92eb('0x5f')](function(_0xe3c225){socket[_0x92eb('0x78')](_0x92eb('0x79'),{'UserId':_0xe3c225,'OpenchannelQueueId':_0x5c828b['id']});});});});});});})['then'](respondWithStatusCode(_0x57866f,null))[_0x92eb('0x28')](handleError(_0x57866f,null));};exports[_0x92eb('0x7a')]=function(_0x148a62,_0x1e5c3a){return db[_0x92eb('0x24')]['find']({'where':{'id':_0x148a62['params']['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x1e5c3a,null))[_0x92eb('0x15')](function(_0x312503){if(_0x312503){return _0x312503[_0x92eb('0x7a')](_0x148a62[_0x92eb('0x3d')][_0x92eb('0x57')],_['omit'](_0x148a62[_0x92eb('0x3d')],['ids','id'])||{})['spread'](function(_0x5308f9){for(var _0x1960e9=0x0;_0x1960e9<_0x148a62[_0x92eb('0x3d')][_0x92eb('0x57')][_0x92eb('0x30')];_0x1960e9+=0x1){socket['emit'](_0x92eb('0x60'),{'UserId':Number(_0x148a62[_0x92eb('0x3d')]['ids'][_0x1960e9]),'OpenchannelQueueId':Number(_0x148a62[_0x92eb('0x2a')]['id'])});}return _0x5308f9;});}})['then'](respondWithResult(_0x1e5c3a,null))[_0x92eb('0x28')](handleError(_0x1e5c3a,null));};exports['removeAgents']=function(_0x14c401,_0x503135){return db[_0x92eb('0x24')][_0x92eb('0x34')]({'where':{'id':_0x14c401[_0x92eb('0x2a')]['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x503135,null))[_0x92eb('0x15')](function(_0x33bfe3){if(_0x33bfe3){return _0x33bfe3[_0x92eb('0x77')](_0x14c401['query']['ids'])[_0x92eb('0x15')](function(){if(_[_0x92eb('0x7b')](_0x14c401['query'][_0x92eb('0x57')])){for(var _0x56d15e=0x0;_0x56d15e<_0x14c401[_0x92eb('0x25')][_0x92eb('0x57')]['length'];_0x56d15e+=0x1){socket[_0x92eb('0x78')](_0x92eb('0x79'),{'UserId':Number(_0x14c401[_0x92eb('0x25')]['ids'][_0x56d15e]),'OpenchannelQueueId':Number(_0x14c401[_0x92eb('0x2a')]['id'])});}}else{socket[_0x92eb('0x78')](_0x92eb('0x79'),{'UserId':Number(_0x14c401[_0x92eb('0x25')][_0x92eb('0x57')]),'OpenchannelQueueId':Number(_0x14c401[_0x92eb('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x503135,null))[_0x92eb('0x28')](handleError(_0x503135,null));};exports[_0x92eb('0x7c')]=function(_0x5ec105,_0x3201e3){var _0x386ba5={};var _0x1e5a53={};var _0x1995ee;var _0x232859;return db['OpenchannelQueue'][_0x92eb('0x52')]({'where':{'id':_0x5ec105['params']['id']}})[_0x92eb('0x15')](handleEntityNotFound(_0x3201e3,null))[_0x92eb('0x15')](function(_0x3dd1e8){if(_0x3dd1e8){_0x1995ee=_0x3dd1e8;_0x1e5a53[_0x92eb('0x2b')]=_['keys'](db[_0x92eb('0x47')]['rawAttributes']);_0x1e5a53['query']=_[_0x92eb('0x40')](_0x5ec105[_0x92eb('0x25')]);_0x1e5a53[_0x92eb('0x2c')]=_[_0x92eb('0x2d')](_0x1e5a53[_0x92eb('0x2b')],_0x1e5a53['query']);_0x386ba5[_0x92eb('0x2e')]=_['intersection'](_0x1e5a53[_0x92eb('0x2b')],qs[_0x92eb('0x2f')](_0x5ec105['query'][_0x92eb('0x2f')]));_0x386ba5[_0x92eb('0x2e')]=_0x386ba5[_0x92eb('0x2e')][_0x92eb('0x30')]?_0x386ba5['attributes']:_0x1e5a53[_0x92eb('0x2b')];_0x386ba5[_0x92eb('0x54')]=qs['sort'](_0x5ec105[_0x92eb('0x25')][_0x92eb('0x43')]);_0x386ba5[_0x92eb('0x23')]=qs[_0x92eb('0x2c')](_[_0x92eb('0x55')](_0x5ec105[_0x92eb('0x25')],_0x1e5a53[_0x92eb('0x2c')]));if(_0x5ec105[_0x92eb('0x25')][_0x92eb('0x45')]){_0x386ba5['where']=_[_0x92eb('0x33')](_0x386ba5[_0x92eb('0x23')],{'$or':_['map'](_0x386ba5['attributes'],function(_0x215e91){var _0x13e0c9={};_0x13e0c9[_0x215e91]={'$like':'%'+_0x5ec105[_0x92eb('0x25')]['filter']+'%'};return _0x13e0c9;})});}_0x386ba5=_['merge']({},_0x386ba5,_0x5ec105[_0x92eb('0x46')]);return _0x1995ee[_0x92eb('0x7c')](_0x386ba5);}})[_0x92eb('0x15')](function(_0x17c0f2){if(_0x17c0f2){_0x232859=_0x17c0f2['length'];if(!_0x5ec105[_0x92eb('0x25')][_0x92eb('0x42')](_0x92eb('0x7d'))){_0x386ba5[_0x92eb('0xf')]=qs[_0x92eb('0xf')](_0x5ec105[_0x92eb('0x25')][_0x92eb('0xf')]);_0x386ba5[_0x92eb('0x11')]=qs[_0x92eb('0x11')](_0x5ec105[_0x92eb('0x25')][_0x92eb('0x11')]);}return _0x1995ee[_0x92eb('0x7c')](_0x386ba5);}})[_0x92eb('0x15')](function(_0x45df29){if(_0x45df29){return _0x45df29?{'count':_0x232859,'rows':_0x45df29}:null;}})[_0x92eb('0x15')](respondWithResult(_0x3201e3,null))['catch'](handleError(_0x3201e3,null));}; \ No newline at end of file +var _0xc07f=['push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','end','offset','limit','undefined','count','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','rows','catch','show','model','keys','filters','intersection','attributes','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','pick','filter','merge','findAll','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','order','sort','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xc07f,0x1e4));var _0xfc07=function(_0x18a4e3,_0x4bdc0b){_0x18a4e3=_0x18a4e3-0x0;var _0x364566=_0xc07f[_0x18a4e3];return _0x364566;};'use strict';var BPromise=require('bluebird');var util=require(_0xfc07('0x0'));var _=require(_0xfc07('0x1'));var squel=require(_0xfc07('0x2'));var Redis=require('ioredis');var qs=require(_0xfc07('0x3'));var logger=require(_0xfc07('0x4'))(_0xfc07('0x5'));var config=require('../../config/environment');var db=require(_0xfc07('0x6'))['db'];config[_0xfc07('0x7')]=_[_0xfc07('0x8')](config[_0xfc07('0x7')],{'host':_0xfc07('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc07('0x7')]));require(_0xfc07('0xa'))[_0xfc07('0xb')](socket);function respondWithStatusCode(_0x16ebff,_0x44c160){_0x44c160=_0x44c160||0xcc;return function(_0x37192a){if(_0x37192a){return _0x16ebff['sendStatus'](_0x44c160);}return _0x16ebff[_0xfc07('0xc')](_0x44c160)[_0xfc07('0xd')]();};}function respondWithResult(_0x44e364,_0x26b184){_0x26b184=_0x26b184||0xc8;return function(_0xe496c7){if(_0xe496c7){return _0x44e364[_0xfc07('0xc')](_0x26b184)['json'](_0xe496c7);}};}function respondWithFilteredResult(_0x33bc2f,_0x301d86){return function(_0x4f2522){if(_0x4f2522){var _0x15764a=typeof _0x301d86[_0xfc07('0xe')]==='undefined'&&typeof _0x301d86[_0xfc07('0xf')]===_0xfc07('0x10');var _0x46a528=_0x4f2522[_0xfc07('0x11')];var _0x16140f=_0x15764a?0x0:_0x301d86['offset'];var _0x4361d7=_0x15764a?_0x4f2522['count']:_0x301d86[_0xfc07('0xe')]+_0x301d86[_0xfc07('0xf')];var _0xfd270d;if(_0x4361d7>=_0x46a528){_0x4361d7=_0x46a528;_0xfd270d=0xc8;}else{_0xfd270d=0xce;}_0x33bc2f[_0xfc07('0xc')](_0xfd270d);return _0x33bc2f['set'](_0xfc07('0x12'),_0x16140f+'-'+_0x4361d7+'/'+_0x46a528)['json'](_0x4f2522);}return null;};}function saveUpdates(_0x78fd90){return function(_0x53b62a){if(_0x53b62a){return _0x53b62a[_0xfc07('0x13')](_0x78fd90)[_0xfc07('0x14')](function(_0x2a815b){return _0x2a815b;});}return null;};}function removeEntity(_0x48d689){return function(_0x417041){if(_0x417041){return _0x417041[_0xfc07('0x15')]()[_0xfc07('0x14')](function(){var _0x5cb85c=_0x417041[_0xfc07('0x16')]({'plain':!![]});var _0x24b216=_0xfc07('0x17');return db[_0xfc07('0x18')]['destroy']({'where':{'type':_0x24b216,'resourceId':_0x5cb85c['id']}})['then'](function(){return _0x417041;});})[_0xfc07('0x14')](function(){_0x48d689[_0xfc07('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4514f8){return function(_0x364c7c){if(!_0x364c7c){_0x4514f8[_0xfc07('0x19')](0x194);}return _0x364c7c;};}function handleError(_0x266563,_0x36dbb4){_0x36dbb4=_0x36dbb4||0x1f4;return function(_0x877b1f){logger[_0xfc07('0x1a')](_0x877b1f[_0xfc07('0x1b')]);if(_0x877b1f['name']){delete _0x877b1f['name'];}_0x266563[_0xfc07('0xc')](_0x36dbb4)[_0xfc07('0x1c')](_0x877b1f);};}exports[_0xfc07('0x1d')]=function(_0x4f6fac,_0x57206d){var _0x1f5b8d={};var _0x9b16c0={'count':0x0,'rows':[]};var _0x406dcd=_[_0xfc07('0x1e')](db[_0xfc07('0x1f')][_0xfc07('0x20')],function(_0x2e2d10){return{'name':_0x2e2d10[_0xfc07('0x21')],'type':_0x2e2d10[_0xfc07('0x22')]['key']};});_0x1f5b8d=qs['getOptions'](_0x406dcd,_0x4f6fac);var _0x4fb42f={'where':_0x1f5b8d[_0xfc07('0x23')]};return db[_0xfc07('0x1f')][_0xfc07('0x11')](_0x4fb42f)[_0xfc07('0x14')](function(_0x5b19f8){_0x9b16c0['count']=_0x5b19f8;_0x1f5b8d[_0xfc07('0x24')]=qs[_0xfc07('0x24')](_0x4f6fac[_0xfc07('0x25')]);return db[_0xfc07('0x1f')]['findAll'](_0x1f5b8d);})['then'](function(_0x4bf689){_0x9b16c0[_0xfc07('0x26')]=_0x4bf689;return _0x9b16c0;})['then'](respondWithFilteredResult(_0x57206d,_0x1f5b8d))[_0xfc07('0x27')](handleError(_0x57206d,null));};exports[_0xfc07('0x28')]=function(_0x381fad,_0x381e96){var _0x513ded={'raw':!![],'where':{'id':_0x381fad['params']['id']}},_0x18a66b={};_0x18a66b[_0xfc07('0x29')]=_[_0xfc07('0x2a')](db[_0xfc07('0x1f')][_0xfc07('0x20')]);_0x18a66b['query']=_['keys'](_0x381fad['query']);_0x18a66b[_0xfc07('0x2b')]=_[_0xfc07('0x2c')](_0x18a66b[_0xfc07('0x29')],_0x18a66b[_0xfc07('0x25')]);_0x513ded[_0xfc07('0x2d')]=_[_0xfc07('0x2c')](_0x18a66b['model'],qs[_0xfc07('0x2e')](_0x381fad[_0xfc07('0x25')]['fields']));_0x513ded[_0xfc07('0x2d')]=_0x513ded[_0xfc07('0x2d')][_0xfc07('0x2f')]?_0x513ded['attributes']:_0x18a66b[_0xfc07('0x29')];if(_0x381fad[_0xfc07('0x25')]['includeAll']){_0x513ded[_0xfc07('0x24')]=[{'all':!![]}];}_0x513ded=_['merge']({},_0x513ded,_0x381fad[_0xfc07('0x30')]);return db[_0xfc07('0x1f')][_0xfc07('0x31')](_0x513ded)[_0xfc07('0x14')](handleEntityNotFound(_0x381e96,null))[_0xfc07('0x14')](respondWithResult(_0x381e96,null))[_0xfc07('0x27')](handleError(_0x381e96,null));};exports[_0xfc07('0x32')]=function(_0x32dfc7,_0xfa398f){return db['OpenchannelQueue'][_0xfc07('0x32')](_0x32dfc7['body'],{})['then'](function(_0x79c6d9){var _0x3adcf1=_0x32dfc7[_0xfc07('0x33')][_0xfc07('0x16')]({'plain':!![]});if(!_0x3adcf1)throw new Error(_0xfc07('0x34'));if(_0x3adcf1[_0xfc07('0x35')]===_0xfc07('0x33')){var _0x1d9dbc=_0x79c6d9[_0xfc07('0x16')]({'plain':!![]});var _0x27d942='OpenchannelQueues';return db['UserProfileSection'][_0xfc07('0x31')]({'where':{'name':_0x27d942,'userProfileId':_0x3adcf1[_0xfc07('0x36')]},'raw':!![]})[_0xfc07('0x14')](function(_0x4c34d7){if(_0x4c34d7&&_0x4c34d7['autoAssociation']===0x0){return db[_0xfc07('0x18')][_0xfc07('0x32')]({'name':_0x1d9dbc[_0xfc07('0x37')],'resourceId':_0x1d9dbc['id'],'type':_0x4c34d7['name'],'sectionId':_0x4c34d7['id']},{})['then'](function(){return _0x79c6d9;});}else{return _0x79c6d9;}})[_0xfc07('0x27')](function(_0x490210){logger[_0xfc07('0x1a')](_0xfc07('0x38'),_0x490210);throw _0x490210;});}return _0x79c6d9;})['then'](respondWithResult(_0xfa398f,0xc9))['catch'](handleError(_0xfa398f,null));};exports[_0xfc07('0x13')]=function(_0x1aca4c,_0x17aa23){if(_0x1aca4c['body']['id']){delete _0x1aca4c[_0xfc07('0x39')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x1aca4c[_0xfc07('0x3a')]['id']}})[_0xfc07('0x14')](handleEntityNotFound(_0x17aa23,null))[_0xfc07('0x14')](saveUpdates(_0x1aca4c[_0xfc07('0x39')],null))[_0xfc07('0x14')](respondWithResult(_0x17aa23,null))[_0xfc07('0x27')](handleError(_0x17aa23,null));};exports[_0xfc07('0x15')]=function(_0x3fe558,_0x496481){return db[_0xfc07('0x1f')][_0xfc07('0x31')]({'where':{'id':_0x3fe558['params']['id']}})[_0xfc07('0x14')](handleEntityNotFound(_0x496481,null))[_0xfc07('0x14')](removeEntity(_0x496481,null))['catch'](handleError(_0x496481,null));};exports[_0xfc07('0x3b')]=function(_0x46b5e9,_0xb63e63){return db['OpenchannelQueue'][_0xfc07('0x3b')]()['then'](respondWithResult(_0xb63e63,null))[_0xfc07('0x27')](handleError(_0xb63e63,null));};exports[_0xfc07('0x3c')]=function(_0x2422ec,_0x2a07d3){var _0x2dd895={'raw':!![],'where':{}},_0x18a68f={},_0x55ae99;return db[_0xfc07('0x1f')][_0xfc07('0x3d')]({'where':{'id':_0x2422ec['params']['id']}})['then'](handleEntityNotFound(_0x2a07d3,null))[_0xfc07('0x14')](function(_0xdbd4c7){if(_0xdbd4c7){_0x55ae99=_0xdbd4c7[_0xfc07('0x16')]({'plain':!![]});_0x18a68f[_0xfc07('0x29')]=_[_0xfc07('0x2a')](db[_0xfc07('0x3e')][_0xfc07('0x20')]);_0x18a68f[_0xfc07('0x25')]=_[_0xfc07('0x2a')](_0x2422ec[_0xfc07('0x25')]);_0x18a68f[_0xfc07('0x2b')]=_['intersection'](_0x18a68f[_0xfc07('0x29')],_0x18a68f[_0xfc07('0x25')]);_0x2dd895[_0xfc07('0x2d')]=_[_0xfc07('0x2c')](_0x18a68f[_0xfc07('0x29')],qs[_0xfc07('0x2e')](_0x2422ec[_0xfc07('0x25')][_0xfc07('0x2e')]));_0x2dd895[_0xfc07('0x2d')]=_0x2dd895[_0xfc07('0x2d')][_0xfc07('0x2f')]?_0x2dd895[_0xfc07('0x2d')]:_0x18a68f[_0xfc07('0x29')];if(!_0x2422ec[_0xfc07('0x25')][_0xfc07('0x3f')](_0xfc07('0x40'))){_0x2dd895['limit']=qs[_0xfc07('0xf')](_0x2422ec[_0xfc07('0x25')][_0xfc07('0xf')]);_0x2dd895[_0xfc07('0xe')]=qs[_0xfc07('0xe')](_0x2422ec[_0xfc07('0x25')][_0xfc07('0xe')]);}_0x2dd895['order']=qs['sort'](_0x2422ec[_0xfc07('0x25')]['sort']);_0x2dd895[_0xfc07('0x23')]=qs[_0xfc07('0x2b')](_[_0xfc07('0x41')](_0x2422ec[_0xfc07('0x25')],_0x18a68f['filters']));_0x2dd895['where']['OpenchannelQueueId']=_0xdbd4c7['id'];if(_0x2422ec['query'][_0xfc07('0x42')]){_0x2dd895['where']=_[_0xfc07('0x43')](_0x2dd895[_0xfc07('0x23')],{'$or':_[_0xfc07('0x1e')](_0x2dd895['attributes'],function(_0x2a7078){var _0x2532d2={};_0x2532d2[_0x2a7078]={'$like':'%'+_0x2422ec[_0xfc07('0x25')][_0xfc07('0x42')]+'%'};return _0x2532d2;})});}_0x2dd895=_[_0xfc07('0x43')]({},_0x2dd895,_0x2422ec['options']);return db[_0xfc07('0x3e')][_0xfc07('0x44')](_0x2dd895);}})[_0xfc07('0x14')](function(_0x1269af){if(_0x1269af){return db[_0xfc07('0x45')][_0xfc07('0x46')]({'where':{'id':_[_0xfc07('0x1e')](_0x1269af,'UserId'),'role':_0xfc07('0x47')},'attributes':['id',_0xfc07('0x37'),_0xfc07('0x48'),_0xfc07('0x49'),_0xfc07('0x4a')]});}})[_0xfc07('0x14')](function(_0x1b98a4){if(_0x1b98a4){return{'count':_0x1b98a4[_0xfc07('0x11')],'rows':_[_0xfc07('0x1e')](_0x1b98a4[_0xfc07('0x26')],function(_0x560f26){return{'membername':_0x560f26[_0xfc07('0x37')],'UserId':_0x560f26['id'],'queue_name':_0x55ae99[_0xfc07('0x37')],'OpenchannelQueueId':_0x55ae99['id'],'interface':util[_0xfc07('0x4b')](_0xfc07('0x4c'),_0xfc07('0x4d'),_0x560f26[_0xfc07('0x37')]),'penalty':0x0,'paused':_0x560f26[_0xfc07('0x48')],'createdAt':_0x560f26[_0xfc07('0x4a')],'updatedAt':_0x560f26[_0xfc07('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2a07d3,_0x2dd895))[_0xfc07('0x27')](handleError(_0x2a07d3,null));};exports[_0xfc07('0x4e')]=function(_0x8a4611,_0x5ca4a5){var _0x257c80={};var _0x20ae6c={};var _0x4db4b4;var _0x313d8f;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x8a4611['params']['id']}})[_0xfc07('0x14')](handleEntityNotFound(_0x5ca4a5,null))[_0xfc07('0x14')](function(_0x4f1d71){if(_0x4f1d71){_0x4db4b4=_0x4f1d71;_0x20ae6c['model']=_[_0xfc07('0x2a')](db['Team'][_0xfc07('0x20')]);_0x20ae6c[_0xfc07('0x25')]=_['keys'](_0x8a4611[_0xfc07('0x25')]);_0x20ae6c[_0xfc07('0x2b')]=_[_0xfc07('0x2c')](_0x20ae6c[_0xfc07('0x29')],_0x20ae6c[_0xfc07('0x25')]);_0x257c80[_0xfc07('0x2d')]=_[_0xfc07('0x2c')](_0x20ae6c[_0xfc07('0x29')],qs['fields'](_0x8a4611['query'][_0xfc07('0x2e')]));_0x257c80[_0xfc07('0x2d')]=_0x257c80[_0xfc07('0x2d')][_0xfc07('0x2f')]?_0x257c80[_0xfc07('0x2d')]:_0x20ae6c['model'];_0x257c80[_0xfc07('0x4f')]=qs[_0xfc07('0x50')](_0x8a4611['query'][_0xfc07('0x50')]);_0x257c80['where']=qs['filters'](_[_0xfc07('0x41')](_0x8a4611[_0xfc07('0x25')],_0x20ae6c[_0xfc07('0x2b')]));if(_0x8a4611[_0xfc07('0x25')][_0xfc07('0x42')]){_0x257c80['where']=_[_0xfc07('0x43')](_0x257c80['where'],{'$or':_['map'](_0x257c80[_0xfc07('0x2d')],function(_0x4dd893){var _0x59a78f={};_0x59a78f[_0x4dd893]={'$like':'%'+_0x8a4611[_0xfc07('0x25')]['filter']+'%'};return _0x59a78f;})});}_0x257c80=_[_0xfc07('0x43')]({},_0x257c80,_0x8a4611['options']);return _0x4db4b4[_0xfc07('0x4e')](_0x257c80);}})[_0xfc07('0x14')](function(_0x50b6fb){if(_0x50b6fb){_0x313d8f=_0x50b6fb[_0xfc07('0x2f')];if(!_0x8a4611[_0xfc07('0x25')][_0xfc07('0x3f')]('nolimit')){_0x257c80[_0xfc07('0xf')]=qs[_0xfc07('0xf')](_0x8a4611[_0xfc07('0x25')][_0xfc07('0xf')]);_0x257c80[_0xfc07('0xe')]=qs[_0xfc07('0xe')](_0x8a4611[_0xfc07('0x25')][_0xfc07('0xe')]);}return _0x4db4b4['getTeams'](_0x257c80);}})[_0xfc07('0x14')](function(_0x1ac205){if(_0x1ac205){return _0x1ac205?{'count':_0x313d8f,'rows':_0x1ac205}:null;}})['then'](respondWithResult(_0x5ca4a5,null))[_0xfc07('0x27')](handleError(_0x5ca4a5,null));};exports[_0xfc07('0x51')]=function(_0x4e3881,_0x42ea96){var _0x3f7d22=_0x4e3881[_0xfc07('0x39')][_0xfc07('0x52')];return db[_0xfc07('0x53')][_0xfc07('0x44')]({'where':{'id':_0x3f7d22},'attributes':['id'],'include':[{'model':db[_0xfc07('0x45')],'as':_0xfc07('0x54'),'attributes':['id',_0xfc07('0x37'),_0xfc07('0x55'),_0xfc07('0x56'),'interface'],'raw':!![]}]})['then'](function(_0x129767){if(_0x129767){var _0x4e2e73=_[_0xfc07('0x57')](_0x129767,function(_0x1ceda7){var _0x1aa177=_0x1ceda7[_0xfc07('0x16')]({'plain':!![]});return _0x1aa177[_0xfc07('0x54')];});return db[_0xfc07('0x1f')]['find']({'where':{'id':_0x4e3881[_0xfc07('0x3a')]['id']}})[_0xfc07('0x14')](function(_0x313055){return db[_0xfc07('0x58')][_0xfc07('0x59')](function(_0x143274){return _0x313055[_0xfc07('0x51')](_0x3f7d22,{'transaction':_0x143274})[_0xfc07('0x14')](function(){return BPromise['each'](_0x4e2e73,function(_0x80bcda){return db[_0xfc07('0x3e')][_0xfc07('0x5a')]({'where':{'UserId':_0x80bcda['id'],'OpenchannelQueueId':_0x4e3881[_0xfc07('0x3a')]['id']},'transaction':_0x143274});});})[_0xfc07('0x14')](function(){_0x4e2e73[_0xfc07('0x5b')](function(_0x13809d){socket[_0xfc07('0x5c')](_0xfc07('0x5d'),{'UserId':_0x13809d['id'],'OpenchannelQueueId':_0x313055['id']});});});});});}})[_0xfc07('0x14')](respondWithStatusCode(_0x42ea96,null))[_0xfc07('0x27')](handleError(_0x42ea96,null));};exports[_0xfc07('0x5e')]=function(_0x24443c,_0x25e9cd){return db['Team']['findAll']({'where':{'id':_0x24443c['query'][_0xfc07('0x52')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfc07('0x54'),'attributes':['id'],'raw':!![]}]})[_0xfc07('0x14')](handleEntityNotFound(_0x25e9cd,null))[_0xfc07('0x14')](function(_0x3eb53f){var _0x3c0451=_['map'](_0x3eb53f,'id');var _0x5dbf20=[];var _0x39fbcf=[];var _0x3d6558=squel[_0xfc07('0x5f')]();_0x3d6558['field']('tq.TeamId')[_0xfc07('0x60')](_0xfc07('0x61'),'tq')['join'](_0xfc07('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfc07('0x23')](_0xfc07('0x63'),_0x24443c[_0xfc07('0x3a')]['id']);for(var _0xefb8c7=0x0;_0xefb8c7<_0x3eb53f['length'];_0xefb8c7+=0x1){let _0x2fcb23=_0x3eb53f[_0xefb8c7];for(var _0x484737=0x0;_0x484737<_0x2fcb23[_0xfc07('0x54')][_0xfc07('0x2f')];_0x484737+=0x1){let _0x40384e=_0x2fcb23['Agents'][_0x484737];var _0x57629c=_0x3d6558['clone']();_0x57629c['where'](_0xfc07('0x64'),_0x40384e['id']);_0x39fbcf[_0xfc07('0x65')](db['sequelize'][_0xfc07('0x25')](_0x57629c[_0xfc07('0x66')](),{'type':db[_0xfc07('0x58')][_0xfc07('0x67')]['SELECT']})[_0xfc07('0x14')](function(_0x27421d){if(_0x27421d[_0xfc07('0x2f')]===0x1){return _0x40384e['id'];}else{var _0x1a0fc3=_[_0xfc07('0x68')](_[_0xfc07('0x1e')](_0x27421d,_0xfc07('0x69')),function(_0x59f5ec){return _[_0xfc07('0x6a')](_0x3c0451,_0x59f5ec);});if(_0x1a0fc3){return _0x40384e['id'];}}}));}}return BPromise[_0xfc07('0x6b')](_0x39fbcf)[_0xfc07('0x14')](function(_0x2d5307){_0x5dbf20=_(_0x5dbf20)[_0xfc07('0x6c')](_0x2d5307)[_0xfc07('0x6d')]()[_0xfc07('0x6e')]();return db['OpenchannelQueue'][_0xfc07('0x31')]({'where':{'id':_0x24443c[_0xfc07('0x3a')]['id']}})[_0xfc07('0x14')](function(_0x20af11){return db[_0xfc07('0x58')][_0xfc07('0x59')](function(_0x22324f){return _0x20af11[_0xfc07('0x5e')](_0x24443c[_0xfc07('0x25')][_0xfc07('0x52')],{'transaction':_0x22324f})[_0xfc07('0x14')](function(){if(!_[_0xfc07('0x6f')](_0x5dbf20)){return _0x20af11['removeAgents'](_0x5dbf20,{'transaction':_0x22324f});}})[_0xfc07('0x14')](function(){_0x5dbf20['forEach'](function(_0x406b4a){socket['emit'](_0xfc07('0x70'),{'UserId':_0x406b4a,'OpenchannelQueueId':_0x20af11['id']});});});});});});})[_0xfc07('0x14')](respondWithStatusCode(_0x25e9cd,null))[_0xfc07('0x27')](handleError(_0x25e9cd,null));};exports[_0xfc07('0x71')]=function(_0x1d274a,_0x438d75){return db[_0xfc07('0x1f')][_0xfc07('0x31')]({'where':{'id':_0x1d274a['params']['id']}})[_0xfc07('0x14')](handleEntityNotFound(_0x438d75,null))[_0xfc07('0x14')](function(_0x28cdf7){if(_0x28cdf7){return _0x28cdf7[_0xfc07('0x71')](_0x1d274a[_0xfc07('0x39')]['ids'],_['omit'](_0x1d274a['body'],[_0xfc07('0x52'),'id'])||{})[_0xfc07('0x72')](function(_0xb77764){for(var _0x2492b6=0x0;_0x2492b6<_0x1d274a[_0xfc07('0x39')][_0xfc07('0x52')][_0xfc07('0x2f')];_0x2492b6+=0x1){socket[_0xfc07('0x5c')](_0xfc07('0x5d'),{'UserId':Number(_0x1d274a[_0xfc07('0x39')][_0xfc07('0x52')][_0x2492b6]),'OpenchannelQueueId':Number(_0x1d274a[_0xfc07('0x3a')]['id'])});}return _0xb77764;});}})[_0xfc07('0x14')](respondWithResult(_0x438d75,null))[_0xfc07('0x27')](handleError(_0x438d75,null));};exports['removeAgents']=function(_0x17a5d1,_0x2e5de1){return db[_0xfc07('0x1f')][_0xfc07('0x31')]({'where':{'id':_0x17a5d1[_0xfc07('0x3a')]['id']}})[_0xfc07('0x14')](handleEntityNotFound(_0x2e5de1,null))[_0xfc07('0x14')](function(_0x16ffd9){if(_0x16ffd9){return _0x16ffd9['removeAgents'](_0x17a5d1[_0xfc07('0x25')][_0xfc07('0x52')])['then'](function(){if(_[_0xfc07('0x73')](_0x17a5d1[_0xfc07('0x25')][_0xfc07('0x52')])){for(var _0x295b10=0x0;_0x295b10<_0x17a5d1[_0xfc07('0x25')][_0xfc07('0x52')][_0xfc07('0x2f')];_0x295b10+=0x1){socket[_0xfc07('0x5c')](_0xfc07('0x70'),{'UserId':Number(_0x17a5d1[_0xfc07('0x25')][_0xfc07('0x52')][_0x295b10]),'OpenchannelQueueId':Number(_0x17a5d1['params']['id'])});}}else{socket['emit'](_0xfc07('0x70'),{'UserId':Number(_0x17a5d1[_0xfc07('0x25')][_0xfc07('0x52')]),'OpenchannelQueueId':Number(_0x17a5d1[_0xfc07('0x3a')]['id'])});}});}})[_0xfc07('0x14')](respondWithStatusCode(_0x2e5de1,null))[_0xfc07('0x27')](handleError(_0x2e5de1,null));};exports[_0xfc07('0x74')]=function(_0x35eb00,_0x4921f7){var _0x57a955={};var _0x5bb457={};var _0x2e392b;var _0x571292;return db[_0xfc07('0x1f')]['findOne']({'where':{'id':_0x35eb00[_0xfc07('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4921f7,null))['then'](function(_0x50aeb4){if(_0x50aeb4){_0x2e392b=_0x50aeb4;_0x5bb457[_0xfc07('0x29')]=_[_0xfc07('0x2a')](db['User'][_0xfc07('0x20')]);_0x5bb457['query']=_['keys'](_0x35eb00[_0xfc07('0x25')]);_0x5bb457[_0xfc07('0x2b')]=_[_0xfc07('0x2c')](_0x5bb457['model'],_0x5bb457[_0xfc07('0x25')]);_0x57a955[_0xfc07('0x2d')]=_[_0xfc07('0x2c')](_0x5bb457['model'],qs[_0xfc07('0x2e')](_0x35eb00[_0xfc07('0x25')][_0xfc07('0x2e')]));_0x57a955[_0xfc07('0x2d')]=_0x57a955[_0xfc07('0x2d')][_0xfc07('0x2f')]?_0x57a955[_0xfc07('0x2d')]:_0x5bb457[_0xfc07('0x29')];_0x57a955['order']=qs[_0xfc07('0x50')](_0x35eb00[_0xfc07('0x25')][_0xfc07('0x50')]);_0x57a955[_0xfc07('0x23')]=qs[_0xfc07('0x2b')](_[_0xfc07('0x41')](_0x35eb00[_0xfc07('0x25')],_0x5bb457[_0xfc07('0x2b')]));if(_0x35eb00[_0xfc07('0x25')][_0xfc07('0x42')]){_0x57a955[_0xfc07('0x23')]=_[_0xfc07('0x43')](_0x57a955['where'],{'$or':_['map'](_0x57a955[_0xfc07('0x2d')],function(_0x4ca3b4){var _0xe7e816={};_0xe7e816[_0x4ca3b4]={'$like':'%'+_0x35eb00[_0xfc07('0x25')]['filter']+'%'};return _0xe7e816;})});}_0x57a955=_[_0xfc07('0x43')]({},_0x57a955,_0x35eb00[_0xfc07('0x30')]);return _0x2e392b[_0xfc07('0x74')](_0x57a955);}})[_0xfc07('0x14')](function(_0x2f1d10){if(_0x2f1d10){_0x571292=_0x2f1d10[_0xfc07('0x2f')];if(!_0x35eb00['query'][_0xfc07('0x3f')]('nolimit')){_0x57a955[_0xfc07('0xf')]=qs[_0xfc07('0xf')](_0x35eb00[_0xfc07('0x25')]['limit']);_0x57a955[_0xfc07('0xe')]=qs[_0xfc07('0xe')](_0x35eb00['query'][_0xfc07('0xe')]);}return _0x2e392b[_0xfc07('0x74')](_0x57a955);}})[_0xfc07('0x14')](function(_0x3643d4){if(_0x3643d4){return _0x3643d4?{'count':_0x571292,'rows':_0x3643d4}:null;}})[_0xfc07('0x14')](respondWithResult(_0x4921f7,null))[_0xfc07('0x27')](handleError(_0x4921f7,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 08cea1c..1121f3e 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 _0x6db2=['setMaxListeners','update','remove','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0x161341,_0x1c054d){var _0x5e06c3=function(_0x1d177a){while(--_0x1d177a){_0x161341['push'](_0x161341['shift']());}};_0x5e06c3(++_0x1c054d);}(_0x6db2,0x15e));var _0x26db=function(_0x4d36a4,_0x303dd0){_0x4d36a4=_0x4d36a4-0x0;var _0x8d4548=_0x6db2[_0x4d36a4];return _0x8d4548;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x26db('0x0'))['db'][_0x26db('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x26db('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26db('0x3'),'afterDestroy':_0x26db('0x4')};function emitEvent(_0x50a655){return function(_0x4542cb,_0x3bd8fe,_0xdad6ae){OpenchannelQueueEvents['emit'](_0x50a655+':'+_0x4542cb['id'],_0x4542cb);OpenchannelQueueEvents['emit'](_0x50a655,_0x4542cb);_0xdad6ae(null);};}for(var e in events){if(events[_0x26db('0x5')](e)){var event=events[e];OpenchannelQueue[_0x26db('0x6')](e,emitEvent(event));}}module[_0x26db('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xc89e=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue'];(function(_0xbf13d2,_0x1b45a3){var _0x1a612f=function(_0x1c4356){while(--_0x1c4356){_0xbf13d2['push'](_0xbf13d2['shift']());}};_0x1a612f(++_0x1b45a3);}(_0xc89e,0x10c));var _0xec89=function(_0x374070,_0x26f1e7){_0x374070=_0x374070-0x0;var _0x430a31=_0xc89e[_0x374070];return _0x430a31;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xec89('0x0'))['db'][_0xec89('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xec89('0x2')](0x0);var events={'afterCreate':_0xec89('0x3'),'afterUpdate':'update','afterDestroy':_0xec89('0x4')};function emitEvent(_0x2cda71){return function(_0x1a5325,_0x5305a8,_0x2e59d1){OpenchannelQueueEvents[_0xec89('0x5')](_0x2cda71+':'+_0x1a5325['id'],_0x1a5325);OpenchannelQueueEvents[_0xec89('0x5')](_0x2cda71,_0x1a5325);_0x2e59d1(null);};}for(var e in events){if(events[_0xec89('0x6')](e)){var event=events[e];OpenchannelQueue[_0xec89('0x7')](e,emitEvent(event));}}module[_0xec89('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 70ba6dd..32a040f 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 _0x63a2=['rimraf','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x63a2,0xe8));var _0x263a=function(_0x10d3e1,_0x2bced0){_0x10d3e1=_0x10d3e1-0x0;var _0x18c75c=_0x63a2[_0x10d3e1];return _0x18c75c;};'use strict';var _=require(_0x263a('0x0'));var util=require(_0x263a('0x1'));var logger=require(_0x263a('0x2'))(_0x263a('0x3'));var moment=require(_0x263a('0x4'));var BPromise=require(_0x263a('0x5'));var rp=require(_0x263a('0x6'));var fs=require('fs');var path=require(_0x263a('0x7'));var rimraf=require(_0x263a('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x263a('0x9')]=function(_0x1e5445,_0x33ae63){return _0x1e5445['define'](_0x263a('0xa'),attributes,{'tableName':_0x263a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f89=['openchannel_queues','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','exports','define'];(function(_0x1990dd,_0x50e1e5){var _0xffc0eb=function(_0x535ddd){while(--_0x535ddd){_0x1990dd['push'](_0x1990dd['shift']());}};_0xffc0eb(++_0x50e1e5);}(_0x1f89,0x1a5));var _0x91f8=function(_0x4af145,_0x41d484){_0x4af145=_0x4af145-0x0;var _0x4b8fdb=_0x1f89[_0x4af145];return _0x4b8fdb;};'use strict';var _=require(_0x91f8('0x0'));var util=require(_0x91f8('0x1'));var logger=require(_0x91f8('0x2'))(_0x91f8('0x3'));var moment=require(_0x91f8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x91f8('0x5'));var config=require(_0x91f8('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x91f8('0x7')]=function(_0x4f50c9,_0x198777){return _0x4f50c9[_0x91f8('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x91f8('0x9'),'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 faa13f8..5080c79 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 _0xa116=['debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x491f89,_0x1b3671){var _0x33571b=function(_0x1dcf65){while(--_0x1dcf65){_0x491f89['push'](_0x491f89['shift']());}};_0x33571b(++_0x1b3671);}(_0xa116,0x16a));var _0x6a11=function(_0x4fbcfc,_0x2572b3){_0x4fbcfc=_0x4fbcfc-0x0;var _0x39e1b1=_0xa116[_0x4fbcfc];return _0x39e1b1;};'use strict';var _=require(_0x6a11('0x0'));var util=require('util');var moment=require(_0x6a11('0x1'));var BPromise=require(_0x6a11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a11('0x3'));var db=require(_0x6a11('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a11('0x5'))(_0x6a11('0x6'));var config=require(_0x6a11('0x7'));var jayson=require(_0x6a11('0x8'));var client=jayson[_0x6a11('0x9')][_0x6a11('0xa')]({'port':0x232a});config['redis']=_[_0x6a11('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a11('0xc')]));require('./openchannelQueue.socket')[_0x6a11('0xd')](socket);function respondWithRpcPromise(_0x157f6c,_0x43ffb0,_0x37b2f5){return new BPromise(function(_0x98e2a1,_0x20bc7e){return client['request'](_0x157f6c,_0x37b2f5)[_0x6a11('0xe')](function(_0x7f7f44){logger[_0x6a11('0xf')](_0x6a11('0x10'),_0x43ffb0,_0x6a11('0x11'));logger[_0x6a11('0x12')](_0x6a11('0x13'),_0x43ffb0,_0x6a11('0x11'),JSON[_0x6a11('0x14')](_0x7f7f44));if(_0x7f7f44[_0x6a11('0x15')]){if(_0x7f7f44['error'][_0x6a11('0x16')]===0x1f4){logger[_0x6a11('0x15')](_0x6a11('0x10'),_0x43ffb0,_0x7f7f44[_0x6a11('0x15')][_0x6a11('0x17')]);return _0x20bc7e(_0x7f7f44[_0x6a11('0x15')]['message']);}logger[_0x6a11('0x15')](_0x6a11('0x10'),_0x43ffb0,_0x7f7f44[_0x6a11('0x15')][_0x6a11('0x17')]);return _0x98e2a1(_0x7f7f44[_0x6a11('0x15')][_0x6a11('0x17')]);}else{logger['info'](_0x6a11('0x10'),_0x43ffb0,_0x6a11('0x11'));_0x98e2a1(_0x7f7f44[_0x6a11('0x18')][_0x6a11('0x17')]);}})[_0x6a11('0x19')](function(_0x59591f){logger[_0x6a11('0x15')](_0x6a11('0x10'),_0x43ffb0,_0x59591f);_0x20bc7e(_0x59591f);});});}exports[_0x6a11('0x1a')]=function(_0x543fa8){var _0x5cbf8a=this;return new Promise(function(_0x2c30fd,_0x3411a1){return db[_0x6a11('0x1b')][_0x6a11('0x1c')]({'raw':_0x543fa8['options']?_0x543fa8[_0x6a11('0x1d')][_0x6a11('0x1e')]===undefined?!![]:![]:!![],'where':_0x543fa8[_0x6a11('0x1d')]?_0x543fa8[_0x6a11('0x1d')][_0x6a11('0x1f')]||null:null,'attributes':_0x543fa8[_0x6a11('0x1d')]?_0x543fa8[_0x6a11('0x1d')][_0x6a11('0x20')]||null:null,'limit':_0x543fa8[_0x6a11('0x1d')]?_0x543fa8[_0x6a11('0x1d')]['limit']||null:null,'include':_0x543fa8[_0x6a11('0x1d')]?_0x543fa8[_0x6a11('0x1d')][_0x6a11('0x21')]?_[_0x6a11('0x22')](_0x543fa8[_0x6a11('0x1d')]['include'],function(_0x19c807){return{'model':db[_0x19c807[_0x6a11('0x23')]],'as':_0x19c807['as'],'attributes':_0x19c807[_0x6a11('0x20')],'include':_0x19c807[_0x6a11('0x21')]?_[_0x6a11('0x22')](_0x19c807[_0x6a11('0x21')],function(_0x5a3213){return{'model':db[_0x5a3213[_0x6a11('0x23')]],'as':_0x5a3213['as'],'attributes':_0x5a3213[_0x6a11('0x20')],'include':_0x5a3213[_0x6a11('0x21')]?_['map'](_0x5a3213[_0x6a11('0x21')],function(_0x445d43){return{'model':db[_0x445d43['model']],'as':_0x445d43['as'],'attributes':_0x445d43[_0x6a11('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6a11('0xe')](function(_0x54c26f){logger[_0x6a11('0xf')](_0x6a11('0x1a'),_0x543fa8);logger['debug'](_0x6a11('0x1a'),_0x543fa8,JSON[_0x6a11('0x14')](_0x54c26f));_0x2c30fd(_0x54c26f);})['catch'](function(_0x320bec){logger[_0x6a11('0x15')]('GetOpenchannelQueue',_0x320bec[_0x6a11('0x17')],_0x543fa8);_0x3411a1(_0x5cbf8a[_0x6a11('0x15')](0x1f4,_0x320bec[_0x6a11('0x17')]));});});};exports[_0x6a11('0x24')]=function(_0x499297){var _0x4e43da=this;return new Promise(function(_0x35edd1,_0x255378){return db[_0x6a11('0x1b')][_0x6a11('0x25')]({'raw':_0x499297['options']?_0x499297[_0x6a11('0x1d')][_0x6a11('0x1e')]===undefined?!![]:![]:!![],'where':_0x499297[_0x6a11('0x1d')]?_0x499297[_0x6a11('0x1d')][_0x6a11('0x1f')]||null:null,'attributes':_0x499297[_0x6a11('0x1d')]?_0x499297[_0x6a11('0x1d')]['attributes']||null:null,'include':_0x499297['options']?_0x499297['options'][_0x6a11('0x21')]?_[_0x6a11('0x22')](_0x499297[_0x6a11('0x1d')]['include'],function(_0x49f8c1){return{'model':db[_0x49f8c1[_0x6a11('0x23')]],'as':_0x49f8c1['as'],'attributes':_0x49f8c1['attributes'],'include':_0x49f8c1['include']?_[_0x6a11('0x22')](_0x49f8c1[_0x6a11('0x21')],function(_0x31ebab){return{'model':db[_0x31ebab[_0x6a11('0x23')]],'as':_0x31ebab['as'],'attributes':_0x31ebab['attributes'],'include':_0x31ebab[_0x6a11('0x21')]?_['map'](_0x31ebab[_0x6a11('0x21')],function(_0x574c31){return{'model':db[_0x574c31[_0x6a11('0x23')]],'as':_0x574c31['as'],'attributes':_0x574c31[_0x6a11('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3295aa){logger[_0x6a11('0xf')](_0x6a11('0x24'),_0x499297);logger[_0x6a11('0x12')](_0x6a11('0x24'),_0x499297,JSON[_0x6a11('0x14')](_0x3295aa));_0x35edd1(_0x3295aa);})[_0x6a11('0x19')](function(_0x377e1a){logger[_0x6a11('0x15')](_0x6a11('0x24'),_0x377e1a['message'],_0x499297);_0x255378(_0x4e43da[_0x6a11('0x15')](0x1f4,_0x377e1a[_0x6a11('0x17')]));});});}; \ No newline at end of file +var _0xf268=['./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x2a76ce,_0x31d2b2){var _0x4b8be2=function(_0x16112d){while(--_0x16112d){_0x2a76ce['push'](_0x2a76ce['shift']());}};_0x4b8be2(++_0x31d2b2);}(_0xf268,0xf2));var _0x8f26=function(_0x4a2673,_0x1290a1){_0x4a2673=_0x4a2673-0x0;var _0x20f7ff=_0xf268[_0x4a2673];return _0x20f7ff;};'use strict';var _=require('lodash');var util=require(_0x8f26('0x0'));var moment=require('moment');var BPromise=require(_0x8f26('0x1'));var rs=require(_0x8f26('0x2'));var fs=require('fs');var Redis=require(_0x8f26('0x3'));var db=require(_0x8f26('0x4'))['db'];var utils=require(_0x8f26('0x5'));var logger=require(_0x8f26('0x6'))(_0x8f26('0x7'));var config=require(_0x8f26('0x8'));var jayson=require(_0x8f26('0x9'));var client=jayson[_0x8f26('0xa')][_0x8f26('0xb')]({'port':0x232a});config['redis']=_[_0x8f26('0xc')](config[_0x8f26('0xd')],{'host':_0x8f26('0xe'),'port':0x18eb});var socket=require(_0x8f26('0xf'))(new Redis(config[_0x8f26('0xd')]));require(_0x8f26('0x10'))[_0x8f26('0x11')](socket);function respondWithRpcPromise(_0x3dac0a,_0x2f2eea,_0x432f4b){return new BPromise(function(_0x153e50,_0x13dbb4){return client[_0x8f26('0x12')](_0x3dac0a,_0x432f4b)[_0x8f26('0x13')](function(_0x1e62f8){logger[_0x8f26('0x14')](_0x8f26('0x15'),_0x2f2eea,'request\x20sent');logger[_0x8f26('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2f2eea,_0x8f26('0x17'),JSON[_0x8f26('0x18')](_0x1e62f8));if(_0x1e62f8[_0x8f26('0x19')]){if(_0x1e62f8['error'][_0x8f26('0x1a')]===0x1f4){logger['error'](_0x8f26('0x15'),_0x2f2eea,_0x1e62f8[_0x8f26('0x19')]['message']);return _0x13dbb4(_0x1e62f8[_0x8f26('0x19')]['message']);}logger[_0x8f26('0x19')](_0x8f26('0x15'),_0x2f2eea,_0x1e62f8['error'][_0x8f26('0x1b')]);return _0x153e50(_0x1e62f8[_0x8f26('0x19')]['message']);}else{logger['info'](_0x8f26('0x15'),_0x2f2eea,_0x8f26('0x17'));_0x153e50(_0x1e62f8[_0x8f26('0x1c')][_0x8f26('0x1b')]);}})[_0x8f26('0x1d')](function(_0x3181d6){logger[_0x8f26('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f2eea,_0x3181d6);_0x13dbb4(_0x3181d6);});});}exports[_0x8f26('0x1e')]=function(_0x3e835c){var _0x594366=this;return new Promise(function(_0x1a93fe,_0xabc639){return db[_0x8f26('0x1f')][_0x8f26('0x20')]({'raw':_0x3e835c['options']?_0x3e835c[_0x8f26('0x21')][_0x8f26('0x22')]===undefined?!![]:![]:!![],'where':_0x3e835c[_0x8f26('0x21')]?_0x3e835c[_0x8f26('0x21')]['where']||null:null,'attributes':_0x3e835c[_0x8f26('0x21')]?_0x3e835c[_0x8f26('0x21')][_0x8f26('0x23')]||null:null,'limit':_0x3e835c[_0x8f26('0x21')]?_0x3e835c[_0x8f26('0x21')][_0x8f26('0x24')]||null:null,'include':_0x3e835c['options']?_0x3e835c[_0x8f26('0x21')][_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x3e835c['options'][_0x8f26('0x25')],function(_0x2abb8e){return{'model':db[_0x2abb8e[_0x8f26('0x27')]],'as':_0x2abb8e['as'],'attributes':_0x2abb8e[_0x8f26('0x23')],'include':_0x2abb8e[_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x2abb8e[_0x8f26('0x25')],function(_0x3bb805){return{'model':db[_0x3bb805['model']],'as':_0x3bb805['as'],'attributes':_0x3bb805[_0x8f26('0x23')],'include':_0x3bb805[_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x3bb805['include'],function(_0xfa5ad0){return{'model':db[_0xfa5ad0[_0x8f26('0x27')]],'as':_0xfa5ad0['as'],'attributes':_0xfa5ad0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f26('0x13')](function(_0x1514be){logger['info'](_0x8f26('0x1e'),_0x3e835c);logger[_0x8f26('0x16')](_0x8f26('0x1e'),_0x3e835c,JSON[_0x8f26('0x18')](_0x1514be));_0x1a93fe(_0x1514be);})['catch'](function(_0x3a20ab){logger[_0x8f26('0x19')]('GetOpenchannelQueue',_0x3a20ab[_0x8f26('0x1b')],_0x3e835c);_0xabc639(_0x594366['error'](0x1f4,_0x3a20ab[_0x8f26('0x1b')]));});});};exports[_0x8f26('0x28')]=function(_0x45cb89){var _0x34a46f=this;return new Promise(function(_0x28931d,_0x5529bb){return db[_0x8f26('0x1f')][_0x8f26('0x29')]({'raw':_0x45cb89[_0x8f26('0x21')]?_0x45cb89[_0x8f26('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x45cb89['options']?_0x45cb89[_0x8f26('0x21')][_0x8f26('0x2a')]||null:null,'attributes':_0x45cb89[_0x8f26('0x21')]?_0x45cb89[_0x8f26('0x21')][_0x8f26('0x23')]||null:null,'include':_0x45cb89['options']?_0x45cb89['options'][_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x45cb89[_0x8f26('0x21')][_0x8f26('0x25')],function(_0x82b8cf){return{'model':db[_0x82b8cf[_0x8f26('0x27')]],'as':_0x82b8cf['as'],'attributes':_0x82b8cf[_0x8f26('0x23')],'include':_0x82b8cf[_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x82b8cf[_0x8f26('0x25')],function(_0x519d0b){return{'model':db[_0x519d0b[_0x8f26('0x27')]],'as':_0x519d0b['as'],'attributes':_0x519d0b['attributes'],'include':_0x519d0b[_0x8f26('0x25')]?_[_0x8f26('0x26')](_0x519d0b[_0x8f26('0x25')],function(_0x581e84){return{'model':db[_0x581e84[_0x8f26('0x27')]],'as':_0x581e84['as'],'attributes':_0x581e84['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f26('0x13')](function(_0x4e65d0){logger[_0x8f26('0x14')](_0x8f26('0x28'),_0x45cb89);logger[_0x8f26('0x16')](_0x8f26('0x28'),_0x45cb89,JSON[_0x8f26('0x18')](_0x4e65d0));_0x28931d(_0x4e65d0);})[_0x8f26('0x1d')](function(_0x5f0127){logger[_0x8f26('0x19')](_0x8f26('0x28'),_0x5f0127[_0x8f26('0x1b')],_0x45cb89);_0x5529bb(_0x34a46f[_0x8f26('0x19')](0x1f4,_0x5f0127['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c1a514f..786d37d 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 _0x28a1=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener'];(function(_0x42fd56,_0x49cb24){var _0x5db6f9=function(_0x2147ac){while(--_0x2147ac){_0x42fd56['push'](_0x42fd56['shift']());}};_0x5db6f9(++_0x49cb24);}(_0x28a1,0xeb));var _0x128a=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x28a1[_0x560448];return _0x550276;};'use strict';var OpenchannelQueueEvents=require(_0x128a('0x0'));var events=[_0x128a('0x1'),_0x128a('0x2'),_0x128a('0x3')];function createListener(_0xa24ab0,_0x495abf){return function(_0xa61f14){_0x495abf['emit'](_0xa24ab0,_0xa61f14);};}function removeListener(_0x2acb9a,_0xa9f081){return function(){OpenchannelQueueEvents[_0x128a('0x4')](_0x2acb9a,_0xa9f081);};}exports[_0x128a('0x5')]=function(_0xa6dbb5){for(var _0x3a026a=0x0,_0x58793a=events[_0x128a('0x6')];_0x3a026a<_0x58793a;_0x3a026a++){var _0x154cc9=events[_0x3a026a];var _0x130fc0=createListener(_0x128a('0x7')+_0x154cc9,_0xa6dbb5);OpenchannelQueueEvents['on'](_0x154cc9,_0x130fc0);}}; \ No newline at end of file +var _0x1cbc=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','remove','update','emit'];(function(_0x2752b2,_0x23e848){var _0x475933=function(_0x3fb504){while(--_0x3fb504){_0x2752b2['push'](_0x2752b2['shift']());}};_0x475933(++_0x23e848);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x202055,_0x3e4838){_0x202055=_0x202055-0x0;var _0x5314a5=_0x1cbc[_0x202055];return _0x5314a5;};'use strict';var OpenchannelQueueEvents=require(_0xc1cb('0x0'));var events=['save',_0xc1cb('0x1'),_0xc1cb('0x2')];function createListener(_0x29a7a6,_0x1da6d8){return function(_0x199b45){_0x1da6d8[_0xc1cb('0x3')](_0x29a7a6,_0x199b45);};}function removeListener(_0x13a9a0,_0x71a222){return function(){OpenchannelQueueEvents[_0xc1cb('0x4')](_0x13a9a0,_0x71a222);};}exports[_0xc1cb('0x5')]=function(_0x1dacec){for(var _0x27423b=0x0,_0x56f1c8=events[_0xc1cb('0x6')];_0x27423b<_0x56f1c8;_0x27423b++){var _0x54cd03=events[_0x27423b];var _0xe5da07=createListener(_0xc1cb('0x7')+_0x54cd03,_0x1dacec);OpenchannelQueueEvents['on'](_0x54cd03,_0xe5da07);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e0ad1ec..3a43bb8 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 _0xc56a=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x4f018c,_0x183831){var _0xfca00d=function(_0x3d4ceb){while(--_0x3d4ceb){_0x4f018c['push'](_0x4f018c['shift']());}};_0xfca00d(++_0x183831);}(_0xc56a,0x79));var _0xac56=function(_0x1ec0af,_0x101c5e){_0x1ec0af=_0x1ec0af-0x0;var _0xd90ac=_0xc56a[_0x1ec0af];return _0xd90ac;};'use strict';var multer=require(_0xac56('0x0'));var util=require('util');var path=require(_0xac56('0x1'));var timeout=require(_0xac56('0x2'));var express=require(_0xac56('0x3'));var router=express[_0xac56('0x4')]();var fs_extra=require(_0xac56('0x5'));var auth=require(_0xac56('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xac56('0x7')]('/',auth[_0xac56('0x8')](),controller[_0xac56('0x9')]);router['get'](_0xac56('0xa'),auth[_0xac56('0x8')](),controller[_0xac56('0xb')]);router[_0xac56('0x7')](_0xac56('0xc'),auth[_0xac56('0x8')](),controller[_0xac56('0xd')]);router[_0xac56('0xe')]('/',auth[_0xac56('0x8')](),controller['create']);router[_0xac56('0xf')]('/:id',auth[_0xac56('0x8')](),controller[_0xac56('0x10')]);router[_0xac56('0x11')](_0xac56('0xc'),auth[_0xac56('0x8')](),controller[_0xac56('0x12')]);module[_0xac56('0x13')]=router; \ No newline at end of file +var _0xb2bc=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4375d9,_0x5cee8a){var _0x1fd3ff=function(_0x1246a9){while(--_0x1246a9){_0x4375d9['push'](_0x4375d9['shift']());}};_0x1fd3ff(++_0x5cee8a);}(_0xb2bc,0x123));var _0xcb2b=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0xb2bc[_0x4b3d13];return _0xf64dd8;};'use strict';var multer=require(_0xcb2b('0x0'));var util=require(_0xcb2b('0x1'));var path=require(_0xcb2b('0x2'));var timeout=require(_0xcb2b('0x3'));var express=require(_0xcb2b('0x4'));var router=express['Router']();var fs_extra=require(_0xcb2b('0x5'));var auth=require(_0xcb2b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb2b('0x7'));var controller=require(_0xcb2b('0x8'));router['get']('/',auth[_0xcb2b('0x9')](),controller[_0xcb2b('0xa')]);router[_0xcb2b('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xcb2b('0xc')]);router[_0xcb2b('0xb')](_0xcb2b('0xd'),auth[_0xcb2b('0x9')](),controller[_0xcb2b('0xe')]);router[_0xcb2b('0xf')]('/',auth[_0xcb2b('0x9')](),controller[_0xcb2b('0x10')]);router[_0xcb2b('0x11')](_0xcb2b('0xd'),auth[_0xcb2b('0x9')](),controller['update']);router[_0xcb2b('0x12')](_0xcb2b('0xd'),auth[_0xcb2b('0x9')](),controller[_0xcb2b('0x13')]);module[_0xcb2b('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 07cbe16..ecab002 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 _0xb68a=['STRING','DATE','moment','sequelize','exports'];(function(_0x422a98,_0x12b0b7){var _0x5ac00d=function(_0x21ff59){while(--_0x21ff59){_0x422a98['push'](_0x422a98['shift']());}};_0x5ac00d(++_0x12b0b7);}(_0xb68a,0xac));var _0xab68=function(_0x111c17,_0x275184){_0x111c17=_0x111c17-0x0;var _0x5ff50a=_0xb68a[_0x111c17];return _0x5ff50a;};'use strict';var moment=require(_0xab68('0x0'));var Sequelize=require(_0xab68('0x1'));module[_0xab68('0x2')]={'uniqueid':{'type':Sequelize[_0xab68('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xab68('0x3')]},'joinAt':{'type':Sequelize[_0xab68('0x4')]},'leaveAt':{'type':Sequelize[_0xab68('0x4')]},'acceptAt':{'type':Sequelize[_0xab68('0x4')]},'exitAt':{'type':Sequelize[_0xab68('0x4')]},'reason':{'type':Sequelize[_0xab68('0x3')]}}; \ No newline at end of file +var _0x8373=['exports','STRING','DATE','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8373,0x1c5));var _0x3837=function(_0x27cb3f,_0x115c87){_0x27cb3f=_0x27cb3f-0x0;var _0x2ff90c=_0x8373[_0x27cb3f];return _0x2ff90c;};'use strict';var moment=require(_0x3837('0x0'));var Sequelize=require(_0x3837('0x1'));module[_0x3837('0x2')]={'uniqueid':{'type':Sequelize[_0x3837('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3837('0x3')]},'joinAt':{'type':Sequelize[_0x3837('0x4')]},'leaveAt':{'type':Sequelize[_0x3837('0x4')]},'acceptAt':{'type':Sequelize[_0x3837('0x4')]},'exitAt':{'type':Sequelize[_0x3837('0x4')]},'reason':{'type':Sequelize[_0x3837('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 997ed15..69d088c 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 _0x0acc=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','offset','set','reject','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','find','describe'];(function(_0xb94791,_0x4e8f76){var _0x53f240=function(_0x510365){while(--_0x510365){_0xb94791['push'](_0xb94791['shift']());}};_0x53f240(++_0x4e8f76);}(_0x0acc,0x8c));var _0xc0ac=function(_0x58b1fe,_0x14831e){_0x58b1fe=_0x58b1fe-0x0;var _0x552550=_0x0acc[_0x58b1fe];return _0x552550;};'use strict';var emlformat=require(_0xc0ac('0x0'));var rimraf=require(_0xc0ac('0x1'));var zipdir=require(_0xc0ac('0x2'));var jsonpatch=require(_0xc0ac('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0ac('0x4'));var Mustache=require(_0xc0ac('0x5'));var util=require('util');var path=require(_0xc0ac('0x6'));var sox=require(_0xc0ac('0x7'));var csv=require(_0xc0ac('0x8'));var ejs=require(_0xc0ac('0x9'));var fs=require('fs');var fs_extra=require(_0xc0ac('0xa'));var _=require(_0xc0ac('0xb'));var squel=require(_0xc0ac('0xc'));var crypto=require('crypto');var jsforce=require(_0xc0ac('0xd'));var deskjs=require(_0xc0ac('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc0ac('0xf'));var Papa=require(_0xc0ac('0x10'));var Redis=require(_0xc0ac('0x11'));var authService=require(_0xc0ac('0x12'));var qs=require(_0xc0ac('0x13'));var as=require(_0xc0ac('0x14'));var hardwareService=require(_0xc0ac('0x15'));var logger=require(_0xc0ac('0x16'))('api');var utils=require(_0xc0ac('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc0ac('0x18'))['db'];function respondWithStatusCode(_0x511dac,_0x3dde0f){_0x3dde0f=_0x3dde0f||0xcc;return function(_0x5a4a96){if(_0x5a4a96){return _0x511dac[_0xc0ac('0x19')](_0x3dde0f);}return _0x511dac[_0xc0ac('0x1a')](_0x3dde0f)[_0xc0ac('0x1b')]();};}function respondWithResult(_0x308da7,_0x125e48){_0x125e48=_0x125e48||0xc8;return function(_0x4e5467){if(_0x4e5467){return _0x308da7[_0xc0ac('0x1a')](_0x125e48)['json'](_0x4e5467);}};}function respondWithFilteredResult(_0x2750fc,_0x309295){return function(_0x2fe93f){if(_0x2fe93f){var _0x58eb7f=typeof _0x309295['offset']==='undefined'&&typeof _0x309295['limit']===_0xc0ac('0x1c');var _0x123f0e=_0x2fe93f['count'];var _0x476df1=_0x58eb7f?0x0:_0x309295[_0xc0ac('0x1d')];var _0x4f1f5c=_0x58eb7f?_0x2fe93f['count']:_0x309295[_0xc0ac('0x1d')]+_0x309295['limit'];var _0x4eef70;if(_0x4f1f5c>=_0x123f0e){_0x4f1f5c=_0x123f0e;_0x4eef70=0xc8;}else{_0x4eef70=0xce;}_0x2750fc['status'](_0x4eef70);return _0x2750fc[_0xc0ac('0x1e')]('Content-Range',_0x476df1+'-'+_0x4f1f5c+'/'+_0x123f0e)['json'](_0x2fe93f);}return null;};}function patchUpdates(_0x4a9977){return function(_0x263547){try{jsonpatch['apply'](_0x263547,_0x4a9977,!![]);}catch(_0x319100){return BPromise[_0xc0ac('0x1f')](_0x319100);}return _0x263547['save']();};}function saveUpdates(_0x1073f9,_0x20a0c4){return function(_0x52f261){if(_0x52f261){return _0x52f261[_0xc0ac('0x20')](_0x1073f9)[_0xc0ac('0x21')](function(_0x210430){return _0x210430;});}return null;};}function removeEntity(_0x511991,_0x2ff437){return function(_0x52b1c0){if(_0x52b1c0){return _0x52b1c0[_0xc0ac('0x22')]()['then'](function(){_0x511991['status'](0xcc)[_0xc0ac('0x1b')]();});}};}function handleEntityNotFound(_0x18385b,_0x2fb308){return function(_0x1589e6){if(!_0x1589e6){_0x18385b[_0xc0ac('0x19')](0x194);}return _0x1589e6;};}function handleError(_0x452bc0,_0x150a9d){_0x150a9d=_0x150a9d||0x1f4;return function(_0x30b0f4){logger[_0xc0ac('0x23')](_0x30b0f4[_0xc0ac('0x24')]);if(_0x30b0f4['name']){delete _0x30b0f4[_0xc0ac('0x25')];}_0x452bc0[_0xc0ac('0x1a')](_0x150a9d)['send'](_0x30b0f4);};}exports[_0xc0ac('0x26')]=function(_0x1153c5,_0x126594){var _0x25d896={},_0x4780fa={},_0x3222c7={'count':0x0,'rows':[]};var _0x3b3e93=_[_0xc0ac('0x27')](db[_0xc0ac('0x28')][_0xc0ac('0x29')],function(_0x75f1e8){return{'name':_0x75f1e8['fieldName'],'type':_0x75f1e8[_0xc0ac('0x2a')][_0xc0ac('0x2b')]};});_0x4780fa[_0xc0ac('0x2c')]=_['map'](_0x3b3e93,_0xc0ac('0x25'));_0x4780fa[_0xc0ac('0x2d')]=_[_0xc0ac('0x2e')](_0x1153c5[_0xc0ac('0x2d')]);_0x4780fa[_0xc0ac('0x2f')]=_[_0xc0ac('0x30')](_0x4780fa[_0xc0ac('0x2c')],_0x4780fa['query']);_0x25d896[_0xc0ac('0x31')]=_['intersection'](_0x4780fa[_0xc0ac('0x2c')],qs['fields'](_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x32')]));_0x25d896['attributes']=_0x25d896[_0xc0ac('0x31')][_0xc0ac('0x33')]?_0x25d896[_0xc0ac('0x31')]:_0x4780fa[_0xc0ac('0x2c')];if(!_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x34')](_0xc0ac('0x35'))){_0x25d896['limit']=qs['limit'](_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x36')]);_0x25d896['offset']=qs['offset'](_0x1153c5['query'][_0xc0ac('0x1d')]);}_0x25d896['order']=qs[_0xc0ac('0x37')](_0x1153c5[_0xc0ac('0x2d')]['sort']);_0x25d896[_0xc0ac('0x38')]=qs[_0xc0ac('0x2f')](_['pick'](_0x1153c5[_0xc0ac('0x2d')],_0x4780fa[_0xc0ac('0x2f')]),_0x3b3e93);if(_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x39')]){_0x25d896[_0xc0ac('0x38')]=_[_0xc0ac('0x3a')](_0x25d896[_0xc0ac('0x38')],{'$or':_[_0xc0ac('0x27')](_0x3b3e93,function(_0x5e18c8){if(_0x5e18c8[_0xc0ac('0x2a')]!==_0xc0ac('0x3b')){var _0x567dc2={};_0x567dc2[_0x5e18c8[_0xc0ac('0x25')]]={'$like':'%'+_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x39')]+'%'};return _0x567dc2;}})});}_0x25d896=_[_0xc0ac('0x3a')]({},_0x25d896,_0x1153c5[_0xc0ac('0x3c')]);var _0x43c971={'where':_0x25d896[_0xc0ac('0x38')]};return db['OpenchannelQueueReport']['count'](_0x43c971)[_0xc0ac('0x21')](function(_0x43d43b){_0x3222c7['count']=_0x43d43b;if(_0x1153c5[_0xc0ac('0x2d')][_0xc0ac('0x3d')]){_0x25d896[_0xc0ac('0x3e')]=[{'all':!![]}];}return db[_0xc0ac('0x28')]['findAll'](_0x25d896);})['then'](function(_0x37a9fe){_0x3222c7['rows']=_0x37a9fe;return _0x3222c7;})[_0xc0ac('0x21')](respondWithFilteredResult(_0x126594,_0x25d896))['catch'](handleError(_0x126594,null));};exports[_0xc0ac('0x3f')]=function(_0x281a1c,_0x4041b7){var _0x1c326e={'raw':!![],'where':{'id':_0x281a1c[_0xc0ac('0x40')]['id']}},_0x18527d={};_0x18527d[_0xc0ac('0x2c')]=_[_0xc0ac('0x2e')](db[_0xc0ac('0x28')]['rawAttributes']);_0x18527d[_0xc0ac('0x2d')]=_['keys'](_0x281a1c[_0xc0ac('0x2d')]);_0x18527d[_0xc0ac('0x2f')]=_['intersection'](_0x18527d[_0xc0ac('0x2c')],_0x18527d[_0xc0ac('0x2d')]);_0x1c326e['attributes']=_[_0xc0ac('0x30')](_0x18527d[_0xc0ac('0x2c')],qs[_0xc0ac('0x32')](_0x281a1c['query']['fields']));_0x1c326e[_0xc0ac('0x31')]=_0x1c326e[_0xc0ac('0x31')][_0xc0ac('0x33')]?_0x1c326e[_0xc0ac('0x31')]:_0x18527d[_0xc0ac('0x2c')];if(_0x281a1c[_0xc0ac('0x2d')][_0xc0ac('0x3d')]){_0x1c326e[_0xc0ac('0x3e')]=[{'all':!![]}];}_0x1c326e=_[_0xc0ac('0x3a')]({},_0x1c326e,_0x281a1c[_0xc0ac('0x3c')]);return db['OpenchannelQueueReport']['find'](_0x1c326e)[_0xc0ac('0x21')](handleEntityNotFound(_0x4041b7,null))[_0xc0ac('0x21')](respondWithResult(_0x4041b7,null))[_0xc0ac('0x41')](handleError(_0x4041b7,null));};exports['create']=function(_0xe744f5,_0x1dcc5f){return db[_0xc0ac('0x28')][_0xc0ac('0x42')](_0xe744f5[_0xc0ac('0x43')],{})['then'](respondWithResult(_0x1dcc5f,0xc9))[_0xc0ac('0x41')](handleError(_0x1dcc5f,null));};exports[_0xc0ac('0x20')]=function(_0x508696,_0x9939b6){if(_0x508696[_0xc0ac('0x43')]['id']){delete _0x508696['body']['id'];}return db[_0xc0ac('0x28')][_0xc0ac('0x44')]({'where':{'id':_0x508696[_0xc0ac('0x40')]['id']}})['then'](handleEntityNotFound(_0x9939b6,null))[_0xc0ac('0x21')](saveUpdates(_0x508696[_0xc0ac('0x43')],null))[_0xc0ac('0x21')](respondWithResult(_0x9939b6,null))[_0xc0ac('0x41')](handleError(_0x9939b6,null));};exports[_0xc0ac('0x22')]=function(_0x391d38,_0x3e43af){return db[_0xc0ac('0x28')][_0xc0ac('0x44')]({'where':{'id':_0x391d38[_0xc0ac('0x40')]['id']}})[_0xc0ac('0x21')](handleEntityNotFound(_0x3e43af,null))['then'](removeEntity(_0x3e43af,null))[_0xc0ac('0x41')](handleError(_0x3e43af,null));};exports[_0xc0ac('0x45')]=function(_0x428931,_0x32e291){return db[_0xc0ac('0x28')][_0xc0ac('0x45')]()[_0xc0ac('0x21')](respondWithResult(_0x32e291,null))['catch'](handleError(_0x32e291,null));}; \ No newline at end of file +var _0x72f3=['nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','OpenchannelQueueReport','findAll','rows','catch','show','intersection','include','find','create','body','params','describe','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/environment','../../mysqldb','status','end','json','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','keys','filters','query','attributes','fields','length','hasOwnProperty'];(function(_0x43a916,_0x581029){var _0x11214b=function(_0x4644fe){while(--_0x4644fe){_0x43a916['push'](_0x43a916['shift']());}};_0x11214b(++_0x581029);}(_0x72f3,0x65));var _0x372f=function(_0x2f5fea,_0x3ba2c0){_0x2f5fea=_0x2f5fea-0x0;var _0x36fe14=_0x72f3[_0x2f5fea];return _0x36fe14;};'use strict';var emlformat=require(_0x372f('0x0'));var rimraf=require(_0x372f('0x1'));var zipdir=require(_0x372f('0x2'));var jsonpatch=require(_0x372f('0x3'));var rp=require(_0x372f('0x4'));var moment=require(_0x372f('0x5'));var BPromise=require(_0x372f('0x6'));var Mustache=require('mustache');var util=require(_0x372f('0x7'));var path=require(_0x372f('0x8'));var sox=require(_0x372f('0x9'));var csv=require(_0x372f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x372f('0xb'));var _=require(_0x372f('0xc'));var squel=require(_0x372f('0xd'));var crypto=require(_0x372f('0xe'));var jsforce=require(_0x372f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x372f('0xa'));var querystring=require(_0x372f('0x10'));var Papa=require(_0x372f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x372f('0x12'));var as=require(_0x372f('0x13'));var hardwareService=require(_0x372f('0x14'));var logger=require(_0x372f('0x15'))(_0x372f('0x16'));var utils=require('../../config/utils');var config=require(_0x372f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x372f('0x18'))['db'];function respondWithStatusCode(_0x9baaf1,_0x265cbb){_0x265cbb=_0x265cbb||0xcc;return function(_0x523365){if(_0x523365){return _0x9baaf1['sendStatus'](_0x265cbb);}return _0x9baaf1[_0x372f('0x19')](_0x265cbb)[_0x372f('0x1a')]();};}function respondWithResult(_0x1e630f,_0x342922){_0x342922=_0x342922||0xc8;return function(_0x2ef1ae){if(_0x2ef1ae){return _0x1e630f[_0x372f('0x19')](_0x342922)[_0x372f('0x1b')](_0x2ef1ae);}};}function respondWithFilteredResult(_0x263914,_0x4d3198){return function(_0x5cfc5d){if(_0x5cfc5d){var _0x4768e0=typeof _0x4d3198['offset']===_0x372f('0x1c')&&typeof _0x4d3198['limit']===_0x372f('0x1c');var _0x551d4e=_0x5cfc5d['count'];var _0x4bf7cb=_0x4768e0?0x0:_0x4d3198['offset'];var _0xa19176=_0x4768e0?_0x5cfc5d['count']:_0x4d3198['offset']+_0x4d3198[_0x372f('0x1d')];var _0x264058;if(_0xa19176>=_0x551d4e){_0xa19176=_0x551d4e;_0x264058=0xc8;}else{_0x264058=0xce;}_0x263914['status'](_0x264058);return _0x263914['set'](_0x372f('0x1e'),_0x4bf7cb+'-'+_0xa19176+'/'+_0x551d4e)[_0x372f('0x1b')](_0x5cfc5d);}return null;};}function patchUpdates(_0x3dcc36){return function(_0x27eece){try{jsonpatch[_0x372f('0x1f')](_0x27eece,_0x3dcc36,!![]);}catch(_0x1486ed){return BPromise[_0x372f('0x20')](_0x1486ed);}return _0x27eece[_0x372f('0x21')]();};}function saveUpdates(_0x3d57fb,_0x4c3fc8){return function(_0x44f3a8){if(_0x44f3a8){return _0x44f3a8[_0x372f('0x22')](_0x3d57fb)[_0x372f('0x23')](function(_0x32af8c){return _0x32af8c;});}return null;};}function removeEntity(_0x48c358,_0x4fbf4e){return function(_0x42d297){if(_0x42d297){return _0x42d297[_0x372f('0x24')]()[_0x372f('0x23')](function(){_0x48c358['status'](0xcc)[_0x372f('0x1a')]();});}};}function handleEntityNotFound(_0x5d90a3,_0xb471f5){return function(_0x21c3a4){if(!_0x21c3a4){_0x5d90a3['sendStatus'](0x194);}return _0x21c3a4;};}function handleError(_0x11c424,_0x275e26){_0x275e26=_0x275e26||0x1f4;return function(_0x5b65f7){logger[_0x372f('0x25')](_0x5b65f7[_0x372f('0x26')]);if(_0x5b65f7[_0x372f('0x27')]){delete _0x5b65f7[_0x372f('0x27')];}_0x11c424[_0x372f('0x19')](_0x275e26)[_0x372f('0x28')](_0x5b65f7);};}exports[_0x372f('0x29')]=function(_0x2fd77c,_0x11374c){var _0xc596be={},_0x552d4e={},_0x37adfa={'count':0x0,'rows':[]};var _0x309a3f=_[_0x372f('0x2a')](db['OpenchannelQueueReport'][_0x372f('0x2b')],function(_0x311e66){return{'name':_0x311e66['fieldName'],'type':_0x311e66[_0x372f('0x2c')]['key']};});_0x552d4e[_0x372f('0x2d')]=_[_0x372f('0x2a')](_0x309a3f,_0x372f('0x27'));_0x552d4e['query']=_[_0x372f('0x2e')](_0x2fd77c['query']);_0x552d4e[_0x372f('0x2f')]=_['intersection'](_0x552d4e[_0x372f('0x2d')],_0x552d4e[_0x372f('0x30')]);_0xc596be[_0x372f('0x31')]=_['intersection'](_0x552d4e[_0x372f('0x2d')],qs[_0x372f('0x32')](_0x2fd77c[_0x372f('0x30')][_0x372f('0x32')]));_0xc596be[_0x372f('0x31')]=_0xc596be[_0x372f('0x31')][_0x372f('0x33')]?_0xc596be[_0x372f('0x31')]:_0x552d4e['model'];if(!_0x2fd77c['query'][_0x372f('0x34')](_0x372f('0x35'))){_0xc596be[_0x372f('0x1d')]=qs['limit'](_0x2fd77c[_0x372f('0x30')][_0x372f('0x1d')]);_0xc596be[_0x372f('0x36')]=qs[_0x372f('0x36')](_0x2fd77c[_0x372f('0x30')][_0x372f('0x36')]);}_0xc596be[_0x372f('0x37')]=qs['sort'](_0x2fd77c[_0x372f('0x30')][_0x372f('0x38')]);_0xc596be[_0x372f('0x39')]=qs[_0x372f('0x2f')](_[_0x372f('0x3a')](_0x2fd77c['query'],_0x552d4e[_0x372f('0x2f')]),_0x309a3f);if(_0x2fd77c['query']['filter']){_0xc596be[_0x372f('0x39')]=_[_0x372f('0x3b')](_0xc596be[_0x372f('0x39')],{'$or':_[_0x372f('0x2a')](_0x309a3f,function(_0x2eea20){if(_0x2eea20[_0x372f('0x2c')]!==_0x372f('0x3c')){var _0x309a22={};_0x309a22[_0x2eea20[_0x372f('0x27')]]={'$like':'%'+_0x2fd77c['query'][_0x372f('0x3d')]+'%'};return _0x309a22;}})});}_0xc596be=_[_0x372f('0x3b')]({},_0xc596be,_0x2fd77c[_0x372f('0x3e')]);var _0x52c9df={'where':_0xc596be['where']};return db['OpenchannelQueueReport']['count'](_0x52c9df)[_0x372f('0x23')](function(_0x49458e){_0x37adfa[_0x372f('0x3f')]=_0x49458e;if(_0x2fd77c[_0x372f('0x30')][_0x372f('0x40')]){_0xc596be['include']=[{'all':!![]}];}return db[_0x372f('0x41')][_0x372f('0x42')](_0xc596be);})['then'](function(_0x26805d){_0x37adfa[_0x372f('0x43')]=_0x26805d;return _0x37adfa;})['then'](respondWithFilteredResult(_0x11374c,_0xc596be))[_0x372f('0x44')](handleError(_0x11374c,null));};exports[_0x372f('0x45')]=function(_0x4a20c9,_0x416336){var _0x21676e={'raw':!![],'where':{'id':_0x4a20c9['params']['id']}},_0x5ee4f4={};_0x5ee4f4[_0x372f('0x2d')]=_[_0x372f('0x2e')](db[_0x372f('0x41')][_0x372f('0x2b')]);_0x5ee4f4[_0x372f('0x30')]=_[_0x372f('0x2e')](_0x4a20c9[_0x372f('0x30')]);_0x5ee4f4[_0x372f('0x2f')]=_['intersection'](_0x5ee4f4['model'],_0x5ee4f4[_0x372f('0x30')]);_0x21676e['attributes']=_[_0x372f('0x46')](_0x5ee4f4['model'],qs['fields'](_0x4a20c9[_0x372f('0x30')]['fields']));_0x21676e['attributes']=_0x21676e[_0x372f('0x31')][_0x372f('0x33')]?_0x21676e['attributes']:_0x5ee4f4[_0x372f('0x2d')];if(_0x4a20c9[_0x372f('0x30')][_0x372f('0x40')]){_0x21676e[_0x372f('0x47')]=[{'all':!![]}];}_0x21676e=_[_0x372f('0x3b')]({},_0x21676e,_0x4a20c9['options']);return db['OpenchannelQueueReport'][_0x372f('0x48')](_0x21676e)[_0x372f('0x23')](handleEntityNotFound(_0x416336,null))[_0x372f('0x23')](respondWithResult(_0x416336,null))[_0x372f('0x44')](handleError(_0x416336,null));};exports[_0x372f('0x49')]=function(_0x160867,_0x52ff6e){return db['OpenchannelQueueReport']['create'](_0x160867['body'],{})[_0x372f('0x23')](respondWithResult(_0x52ff6e,0xc9))[_0x372f('0x44')](handleError(_0x52ff6e,null));};exports[_0x372f('0x22')]=function(_0x5bd93d,_0x520a90){if(_0x5bd93d[_0x372f('0x4a')]['id']){delete _0x5bd93d['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x5bd93d[_0x372f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x520a90,null))['then'](saveUpdates(_0x5bd93d['body'],null))[_0x372f('0x23')](respondWithResult(_0x520a90,null))[_0x372f('0x44')](handleError(_0x520a90,null));};exports[_0x372f('0x24')]=function(_0x1c92fe,_0x13d657){return db['OpenchannelQueueReport'][_0x372f('0x48')]({'where':{'id':_0x1c92fe[_0x372f('0x4b')]['id']}})[_0x372f('0x23')](handleEntityNotFound(_0x13d657,null))[_0x372f('0x23')](removeEntity(_0x13d657,null))[_0x372f('0x44')](handleError(_0x13d657,null));};exports[_0x372f('0x4c')]=function(_0x352a0c,_0x444b42){return db[_0x372f('0x41')][_0x372f('0x4c')]()[_0x372f('0x23')](respondWithResult(_0x444b42,null))[_0x372f('0x44')](handleError(_0x444b42,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ca914f5..b554005 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x16dca0,_0x2b9a96){var _0xadf948=function(_0x31aff2){while(--_0x31aff2){_0x16dca0['push'](_0x16dca0['shift']());}};_0xadf948(++_0x2b9a96);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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':'uniqueid','fields':['uniqueid']}],'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(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x814b,0x1a2));var _0xb814=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0x814b[_0x4d3924];return _0x844555;};'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 11b18a1..6d8197d 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 _0xde9f=['client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','options','raw','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xde9f,0x118));var _0xfde9=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0xde9f[_0x587dd0];return _0x56f153;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateOpenchannelQueueReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});};exports[_0xfde9('0x1a')]=function(_0x5d0a74){var _0x12e3e7=this;return new Promise(function(_0x10e809,_0x53733b){return db[_0xfde9('0x15')][_0xfde9('0x1b')](_0x5d0a74[_0xfde9('0x1c')],{'raw':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1d')]||null:null,'attributes':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1e')]||null:null,'limit':_0x5d0a74[_0xfde9('0x16')]?_0x5d0a74[_0xfde9('0x16')][_0xfde9('0x1f')]||null:null})[_0xfde9('0xa')](function(_0x4b7956){logger['info'](_0xfde9('0x1a'),_0x5d0a74);logger[_0xfde9('0xe')]('UpdateOpenchannelQueueReport',_0x5d0a74,JSON[_0xfde9('0x10')](_0x4b7956));_0x10e809(_0x4b7956);})[_0xfde9('0x19')](function(_0x1651e0){logger[_0xfde9('0x11')](_0xfde9('0x1a'),_0x1651e0['message'],_0x5d0a74);_0x53733b(_0x12e3e7[_0xfde9('0x11')](0x1f4,_0x1651e0[_0xfde9('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x5a9019,_0x2f10d5){var _0x42aba2=function(_0x24cd7e){while(--_0x24cd7e){_0x5a9019['push'](_0x5a9019['shift']());}};_0x42aba2(++_0x2f10d5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x536b1a,_0x37d0bc){_0x536b1a=_0x536b1a-0x0;var _0x58b4ad=_0x5f2f[_0x536b1a];return _0x58b4ad;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateOpenchannelQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateOpenchannelQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 838fae7..8bd26f2 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 _0xb22f=['show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','./openchannelTransferReport.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb22f,0x16e));var _0xfb22=function(_0x4ec1b1,_0x3f0ee9){_0x4ec1b1=_0x4ec1b1-0x0;var _0x295f6d=_0xb22f[_0x4ec1b1];return _0x295f6d;};'use strict';var multer=require(_0xfb22('0x0'));var util=require('util');var path=require(_0xfb22('0x1'));var timeout=require(_0xfb22('0x2'));var express=require(_0xfb22('0x3'));var router=express[_0xfb22('0x4')]();var fs_extra=require(_0xfb22('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfb22('0x6'));router[_0xfb22('0x7')]('/',auth['isAuthenticated'](),controller[_0xfb22('0x8')]);router[_0xfb22('0x7')]('/describe',auth[_0xfb22('0x9')](),controller[_0xfb22('0xa')]);router[_0xfb22('0x7')](_0xfb22('0xb'),auth[_0xfb22('0x9')](),controller[_0xfb22('0xc')]);router[_0xfb22('0xd')]('/',auth[_0xfb22('0x9')](),controller[_0xfb22('0xe')]);router[_0xfb22('0xf')]('/:id',auth[_0xfb22('0x9')](),controller['update']);router[_0xfb22('0x10')](_0xfb22('0xb'),auth['isAuthenticated'](),controller[_0xfb22('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa1f4=['util','path','connect-timeout','express','fs-extra','./openchannelTransferReport.controller','get','index','/describe','describe','isAuthenticated','post','/:id','update','delete','destroy','multer'];(function(_0x259c99,_0x28fc7b){var _0x589fef=function(_0x3fd915){while(--_0x3fd915){_0x259c99['push'](_0x259c99['shift']());}};_0x589fef(++_0x28fc7b);}(_0xa1f4,0x175));var _0x4a1f=function(_0x414b0a,_0x5aed79){_0x414b0a=_0x414b0a-0x0;var _0xd40080=_0xa1f4[_0x414b0a];return _0xd40080;};'use strict';var multer=require(_0x4a1f('0x0'));var util=require(_0x4a1f('0x1'));var path=require(_0x4a1f('0x2'));var timeout=require(_0x4a1f('0x3'));var express=require(_0x4a1f('0x4'));var router=express['Router']();var fs_extra=require(_0x4a1f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a1f('0x6'));router[_0x4a1f('0x7')]('/',auth['isAuthenticated'](),controller[_0x4a1f('0x8')]);router[_0x4a1f('0x7')](_0x4a1f('0x9'),auth['isAuthenticated'](),controller[_0x4a1f('0xa')]);router['get']('/:id',auth[_0x4a1f('0xb')](),controller['show']);router[_0x4a1f('0xc')]('/',auth[_0x4a1f('0xb')](),controller['create']);router['put'](_0x4a1f('0xd'),auth[_0x4a1f('0xb')](),controller[_0x4a1f('0xe')]);router[_0x4a1f('0xf')]('/:id',auth[_0x4a1f('0xb')](),controller[_0x4a1f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 11a0c3d..aa7a88a 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(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7d1859,_0x274d95){_0x7d1859=_0x7d1859-0x0;var _0x18514c=_0x9bde[_0x7d1859];return _0x18514c;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x1e1daf,_0x52a2bf){var _0x83f451=function(_0x179043){while(--_0x179043){_0x1e1daf['push'](_0x1e1daf['shift']());}};_0x83f451(++_0x52a2bf);}(_0x4b84,0x1cc));var _0x44b8=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x4b84[_0x333fc8];return _0x432439;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index bda3038..fd3feac 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 _0x0604=['to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0604,0x179));var _0x4060=function(_0x1d6ac8,_0x120067){_0x1d6ac8=_0x1d6ac8-0x0;var _0x161ec1=_0x0604[_0x1d6ac8];return _0x161ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4060('0x0'));var zipdir=require(_0x4060('0x1'));var jsonpatch=require(_0x4060('0x2'));var rp=require(_0x4060('0x3'));var moment=require(_0x4060('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4060('0x5'));var path=require(_0x4060('0x6'));var sox=require(_0x4060('0x7'));var csv=require(_0x4060('0x8'));var ejs=require(_0x4060('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4060('0xa'));var crypto=require(_0x4060('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4060('0xc'));var toCsv=require(_0x4060('0x8'));var querystring=require(_0x4060('0xd'));var Papa=require(_0x4060('0xe'));var Redis=require(_0x4060('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4060('0x10'));var as=require(_0x4060('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4060('0x12'))(_0x4060('0x13'));var utils=require(_0x4060('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4060('0x15'));var db=require(_0x4060('0x16'))['db'];function respondWithStatusCode(_0x543364,_0x1be41e){_0x1be41e=_0x1be41e||0xcc;return function(_0x5b2194){if(_0x5b2194){return _0x543364[_0x4060('0x17')](_0x1be41e);}return _0x543364[_0x4060('0x18')](_0x1be41e)[_0x4060('0x19')]();};}function respondWithResult(_0x185cbc,_0x3678ef){_0x3678ef=_0x3678ef||0xc8;return function(_0x23a95d){if(_0x23a95d){return _0x185cbc[_0x4060('0x18')](_0x3678ef)[_0x4060('0x1a')](_0x23a95d);}};}function respondWithFilteredResult(_0x47f6aa,_0x482065){return function(_0x1ed20e){if(_0x1ed20e){var _0x5a6359=typeof _0x482065[_0x4060('0x1b')]===_0x4060('0x1c')&&typeof _0x482065['limit']===_0x4060('0x1c');var _0x3a1ee2=_0x1ed20e[_0x4060('0x1d')];var _0x77f537=_0x5a6359?0x0:_0x482065[_0x4060('0x1b')];var _0x5b79ad=_0x5a6359?_0x1ed20e[_0x4060('0x1d')]:_0x482065[_0x4060('0x1b')]+_0x482065[_0x4060('0x1e')];var _0x431849;if(_0x5b79ad>=_0x3a1ee2){_0x5b79ad=_0x3a1ee2;_0x431849=0xc8;}else{_0x431849=0xce;}_0x47f6aa['status'](_0x431849);return _0x47f6aa[_0x4060('0x1f')](_0x4060('0x20'),_0x77f537+'-'+_0x5b79ad+'/'+_0x3a1ee2)[_0x4060('0x1a')](_0x1ed20e);}return null;};}function patchUpdates(_0x8a3e53){return function(_0x494d64){try{jsonpatch[_0x4060('0x21')](_0x494d64,_0x8a3e53,!![]);}catch(_0x2be4dd){return BPromise[_0x4060('0x22')](_0x2be4dd);}return _0x494d64[_0x4060('0x23')]();};}function saveUpdates(_0x5a493a,_0x447b7d){return function(_0x433bf2){if(_0x433bf2){return _0x433bf2[_0x4060('0x24')](_0x5a493a)[_0x4060('0x25')](function(_0x22f96e){return _0x22f96e;});}return null;};}function removeEntity(_0x5c22d7,_0x4d73c6){return function(_0x3adfd2){if(_0x3adfd2){return _0x3adfd2[_0x4060('0x26')]()[_0x4060('0x25')](function(){_0x5c22d7['status'](0xcc)[_0x4060('0x19')]();});}};}function handleEntityNotFound(_0x1c64fd,_0x5b894c){return function(_0x434546){if(!_0x434546){_0x1c64fd[_0x4060('0x17')](0x194);}return _0x434546;};}function handleError(_0x1d0755,_0x1e4735){_0x1e4735=_0x1e4735||0x1f4;return function(_0x2dcbfd){logger[_0x4060('0x27')](_0x2dcbfd[_0x4060('0x28')]);if(_0x2dcbfd[_0x4060('0x29')]){delete _0x2dcbfd[_0x4060('0x29')];}_0x1d0755[_0x4060('0x18')](_0x1e4735)[_0x4060('0x2a')](_0x2dcbfd);};}exports['index']=function(_0x38e0cb,_0x4e325b){var _0x55aab9={},_0x27a576={},_0xd42712={'count':0x0,'rows':[]};var _0x43cbb7=_[_0x4060('0x2b')](db[_0x4060('0x2c')]['rawAttributes'],function(_0x37d8e7){return{'name':_0x37d8e7[_0x4060('0x2d')],'type':_0x37d8e7[_0x4060('0x2e')][_0x4060('0x2f')]};});_0x27a576[_0x4060('0x30')]=_[_0x4060('0x2b')](_0x43cbb7,_0x4060('0x29'));_0x27a576[_0x4060('0x31')]=_[_0x4060('0x32')](_0x38e0cb['query']);_0x27a576['filters']=_['intersection'](_0x27a576['model'],_0x27a576[_0x4060('0x31')]);_0x55aab9['attributes']=_[_0x4060('0x33')](_0x27a576[_0x4060('0x30')],qs[_0x4060('0x34')](_0x38e0cb[_0x4060('0x31')][_0x4060('0x34')]));_0x55aab9[_0x4060('0x35')]=_0x55aab9[_0x4060('0x35')][_0x4060('0x36')]?_0x55aab9[_0x4060('0x35')]:_0x27a576[_0x4060('0x30')];if(!_0x38e0cb[_0x4060('0x31')]['hasOwnProperty'](_0x4060('0x37'))){_0x55aab9[_0x4060('0x1e')]=qs[_0x4060('0x1e')](_0x38e0cb['query'][_0x4060('0x1e')]);_0x55aab9[_0x4060('0x1b')]=qs[_0x4060('0x1b')](_0x38e0cb[_0x4060('0x31')][_0x4060('0x1b')]);}_0x55aab9[_0x4060('0x38')]=qs['sort'](_0x38e0cb[_0x4060('0x31')][_0x4060('0x39')]);_0x55aab9['where']=qs[_0x4060('0x3a')](_[_0x4060('0x3b')](_0x38e0cb[_0x4060('0x31')],_0x27a576[_0x4060('0x3a')]),_0x43cbb7);if(_0x38e0cb[_0x4060('0x31')]['filter']){_0x55aab9['where']=_[_0x4060('0x3c')](_0x55aab9[_0x4060('0x3d')],{'$or':_[_0x4060('0x2b')](_0x43cbb7,function(_0x13e29a){if(_0x13e29a['type']!==_0x4060('0x3e')){var _0x181ebb={};_0x181ebb[_0x13e29a[_0x4060('0x29')]]={'$like':'%'+_0x38e0cb['query'][_0x4060('0x3f')]+'%'};return _0x181ebb;}})});}_0x55aab9=_[_0x4060('0x3c')]({},_0x55aab9,_0x38e0cb[_0x4060('0x40')]);var _0x2f9d53={'where':_0x55aab9[_0x4060('0x3d')]};return db[_0x4060('0x2c')][_0x4060('0x1d')](_0x2f9d53)[_0x4060('0x25')](function(_0x2c4f9e){_0xd42712[_0x4060('0x1d')]=_0x2c4f9e;if(_0x38e0cb[_0x4060('0x31')][_0x4060('0x41')]){_0x55aab9['include']=[{'all':!![]}];}return db[_0x4060('0x2c')][_0x4060('0x42')](_0x55aab9);})[_0x4060('0x25')](function(_0x1509d2){_0xd42712[_0x4060('0x43')]=_0x1509d2;return _0xd42712;})['then'](respondWithFilteredResult(_0x4e325b,_0x55aab9))[_0x4060('0x44')](handleError(_0x4e325b,null));};exports[_0x4060('0x45')]=function(_0x41712a,_0x1a22f3){var _0x463254={'raw':!![],'where':{'id':_0x41712a[_0x4060('0x46')]['id']}},_0xcc1fd2={};_0xcc1fd2['model']=_[_0x4060('0x32')](db[_0x4060('0x2c')][_0x4060('0x47')]);_0xcc1fd2[_0x4060('0x31')]=_[_0x4060('0x32')](_0x41712a[_0x4060('0x31')]);_0xcc1fd2['filters']=_[_0x4060('0x33')](_0xcc1fd2[_0x4060('0x30')],_0xcc1fd2[_0x4060('0x31')]);_0x463254[_0x4060('0x35')]=_[_0x4060('0x33')](_0xcc1fd2['model'],qs[_0x4060('0x34')](_0x41712a[_0x4060('0x31')][_0x4060('0x34')]));_0x463254['attributes']=_0x463254[_0x4060('0x35')][_0x4060('0x36')]?_0x463254[_0x4060('0x35')]:_0xcc1fd2[_0x4060('0x30')];if(_0x41712a[_0x4060('0x31')][_0x4060('0x41')]){_0x463254[_0x4060('0x48')]=[{'all':!![]}];}_0x463254=_['merge']({},_0x463254,_0x41712a[_0x4060('0x40')]);return db[_0x4060('0x2c')]['find'](_0x463254)['then'](handleEntityNotFound(_0x1a22f3,null))[_0x4060('0x25')](respondWithResult(_0x1a22f3,null))[_0x4060('0x44')](handleError(_0x1a22f3,null));};exports[_0x4060('0x49')]=function(_0xde26b3,_0x1ac206){return db[_0x4060('0x2c')]['create'](_0xde26b3[_0x4060('0x4a')],{})[_0x4060('0x25')](respondWithResult(_0x1ac206,0xc9))['catch'](handleError(_0x1ac206,null));};exports['update']=function(_0x3e2e4c,_0x46be1f){if(_0x3e2e4c[_0x4060('0x4a')]['id']){delete _0x3e2e4c[_0x4060('0x4a')]['id'];}return db[_0x4060('0x2c')][_0x4060('0x4b')]({'where':{'id':_0x3e2e4c[_0x4060('0x46')]['id']}})['then'](handleEntityNotFound(_0x46be1f,null))[_0x4060('0x25')](saveUpdates(_0x3e2e4c[_0x4060('0x4a')],null))[_0x4060('0x25')](respondWithResult(_0x46be1f,null))[_0x4060('0x44')](handleError(_0x46be1f,null));};exports[_0x4060('0x26')]=function(_0x37e5db,_0xd40aab){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x37e5db[_0x4060('0x46')]['id']}})[_0x4060('0x25')](handleEntityNotFound(_0xd40aab,null))[_0x4060('0x25')](removeEntity(_0xd40aab,null))['catch'](handleError(_0xd40aab,null));};exports['describe']=function(_0x2bdce2,_0x3c0d66){return db['OpenchannelTransferReport'][_0x4060('0x4c')]()['then'](respondWithResult(_0x3c0d66,null))[_0x4060('0x44')](handleError(_0x3c0d66,null));}; \ No newline at end of file +var _0x36dd=['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','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','error','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x58f027,_0x428f97){var _0x56acaf=function(_0x13b02a){while(--_0x13b02a){_0x58f027['push'](_0x58f027['shift']());}};_0x56acaf(++_0x428f97);}(_0x36dd,0x161));var _0xd36d=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x36dd[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd36d('0x0'));var zipdir=require(_0xd36d('0x1'));var jsonpatch=require(_0xd36d('0x2'));var rp=require(_0xd36d('0x3'));var moment=require(_0xd36d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd36d('0x5'));var util=require('util');var path=require(_0xd36d('0x6'));var sox=require(_0xd36d('0x7'));var csv=require(_0xd36d('0x8'));var ejs=require(_0xd36d('0x9'));var fs=require('fs');var fs_extra=require(_0xd36d('0xa'));var _=require(_0xd36d('0xb'));var squel=require('squel');var crypto=require(_0xd36d('0xc'));var jsforce=require(_0xd36d('0xd'));var deskjs=require(_0xd36d('0xe'));var toCsv=require(_0xd36d('0x8'));var querystring=require('querystring');var Papa=require(_0xd36d('0xf'));var Redis=require(_0xd36d('0x10'));var authService=require(_0xd36d('0x11'));var qs=require(_0xd36d('0x12'));var as=require(_0xd36d('0x13'));var hardwareService=require(_0xd36d('0x14'));var logger=require(_0xd36d('0x15'))(_0xd36d('0x16'));var utils=require(_0xd36d('0x17'));var config=require(_0xd36d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283843,_0x37916f){_0x37916f=_0x37916f||0xcc;return function(_0x1a18e7){if(_0x1a18e7){return _0x283843[_0xd36d('0x19')](_0x37916f);}return _0x283843[_0xd36d('0x1a')](_0x37916f)[_0xd36d('0x1b')]();};}function respondWithResult(_0x4d3d65,_0x3b2547){_0x3b2547=_0x3b2547||0xc8;return function(_0x1f1642){if(_0x1f1642){return _0x4d3d65[_0xd36d('0x1a')](_0x3b2547)[_0xd36d('0x1c')](_0x1f1642);}};}function respondWithFilteredResult(_0x29353e,_0x3de33c){return function(_0x194683){if(_0x194683){var _0x1e8acf=typeof _0x3de33c['offset']===_0xd36d('0x1d')&&typeof _0x3de33c['limit']===_0xd36d('0x1d');var _0xf84f53=_0x194683[_0xd36d('0x1e')];var _0x3e63f3=_0x1e8acf?0x0:_0x3de33c['offset'];var _0x4c6ac5=_0x1e8acf?_0x194683[_0xd36d('0x1e')]:_0x3de33c[_0xd36d('0x1f')]+_0x3de33c[_0xd36d('0x20')];var _0x5b65ba;if(_0x4c6ac5>=_0xf84f53){_0x4c6ac5=_0xf84f53;_0x5b65ba=0xc8;}else{_0x5b65ba=0xce;}_0x29353e[_0xd36d('0x1a')](_0x5b65ba);return _0x29353e[_0xd36d('0x21')]('Content-Range',_0x3e63f3+'-'+_0x4c6ac5+'/'+_0xf84f53)[_0xd36d('0x1c')](_0x194683);}return null;};}function patchUpdates(_0x10bb01){return function(_0x460277){try{jsonpatch[_0xd36d('0x22')](_0x460277,_0x10bb01,!![]);}catch(_0x556256){return BPromise[_0xd36d('0x23')](_0x556256);}return _0x460277[_0xd36d('0x24')]();};}function saveUpdates(_0xe2f196,_0x328a1a){return function(_0x24e86c){if(_0x24e86c){return _0x24e86c['update'](_0xe2f196)[_0xd36d('0x25')](function(_0x170b36){return _0x170b36;});}return null;};}function removeEntity(_0x185fa2,_0x104c07){return function(_0x494cc8){if(_0x494cc8){return _0x494cc8['destroy']()[_0xd36d('0x25')](function(){_0x185fa2[_0xd36d('0x1a')](0xcc)[_0xd36d('0x1b')]();});}};}function handleEntityNotFound(_0x7ddef0,_0x311977){return function(_0x2d3b0b){if(!_0x2d3b0b){_0x7ddef0[_0xd36d('0x19')](0x194);}return _0x2d3b0b;};}function handleError(_0x57f0e1,_0x109487){_0x109487=_0x109487||0x1f4;return function(_0x43aad8){logger[_0xd36d('0x26')](_0x43aad8['stack']);if(_0x43aad8['name']){delete _0x43aad8['name'];}_0x57f0e1[_0xd36d('0x1a')](_0x109487)[_0xd36d('0x27')](_0x43aad8);};}exports[_0xd36d('0x28')]=function(_0x91cddd,_0x9dbc6b){var _0x2c0fef={},_0x1eac6e={},_0x13c9dd={'count':0x0,'rows':[]};var _0x3b0276=_[_0xd36d('0x29')](db[_0xd36d('0x2a')][_0xd36d('0x2b')],function(_0x352381){return{'name':_0x352381[_0xd36d('0x2c')],'type':_0x352381[_0xd36d('0x2d')][_0xd36d('0x2e')]};});_0x1eac6e['model']=_[_0xd36d('0x29')](_0x3b0276,'name');_0x1eac6e[_0xd36d('0x2f')]=_[_0xd36d('0x30')](_0x91cddd[_0xd36d('0x2f')]);_0x1eac6e[_0xd36d('0x31')]=_[_0xd36d('0x32')](_0x1eac6e[_0xd36d('0x33')],_0x1eac6e[_0xd36d('0x2f')]);_0x2c0fef[_0xd36d('0x34')]=_['intersection'](_0x1eac6e[_0xd36d('0x33')],qs[_0xd36d('0x35')](_0x91cddd[_0xd36d('0x2f')]['fields']));_0x2c0fef[_0xd36d('0x34')]=_0x2c0fef[_0xd36d('0x34')][_0xd36d('0x36')]?_0x2c0fef[_0xd36d('0x34')]:_0x1eac6e[_0xd36d('0x33')];if(!_0x91cddd[_0xd36d('0x2f')]['hasOwnProperty'](_0xd36d('0x37'))){_0x2c0fef[_0xd36d('0x20')]=qs[_0xd36d('0x20')](_0x91cddd[_0xd36d('0x2f')][_0xd36d('0x20')]);_0x2c0fef[_0xd36d('0x1f')]=qs['offset'](_0x91cddd[_0xd36d('0x2f')][_0xd36d('0x1f')]);}_0x2c0fef[_0xd36d('0x38')]=qs[_0xd36d('0x39')](_0x91cddd['query'][_0xd36d('0x39')]);_0x2c0fef[_0xd36d('0x3a')]=qs[_0xd36d('0x31')](_['pick'](_0x91cddd[_0xd36d('0x2f')],_0x1eac6e[_0xd36d('0x31')]),_0x3b0276);if(_0x91cddd[_0xd36d('0x2f')][_0xd36d('0x3b')]){_0x2c0fef[_0xd36d('0x3a')]=_[_0xd36d('0x3c')](_0x2c0fef[_0xd36d('0x3a')],{'$or':_['map'](_0x3b0276,function(_0x35bcd6){if(_0x35bcd6[_0xd36d('0x2d')]!=='VIRTUAL'){var _0x4675ad={};_0x4675ad[_0x35bcd6['name']]={'$like':'%'+_0x91cddd['query'][_0xd36d('0x3b')]+'%'};return _0x4675ad;}})});}_0x2c0fef=_['merge']({},_0x2c0fef,_0x91cddd[_0xd36d('0x3d')]);var _0x520615={'where':_0x2c0fef[_0xd36d('0x3a')]};return db[_0xd36d('0x2a')][_0xd36d('0x1e')](_0x520615)[_0xd36d('0x25')](function(_0x42be85){_0x13c9dd['count']=_0x42be85;if(_0x91cddd['query'][_0xd36d('0x3e')]){_0x2c0fef[_0xd36d('0x3f')]=[{'all':!![]}];}return db[_0xd36d('0x2a')][_0xd36d('0x40')](_0x2c0fef);})['then'](function(_0x50dbd9){_0x13c9dd['rows']=_0x50dbd9;return _0x13c9dd;})['then'](respondWithFilteredResult(_0x9dbc6b,_0x2c0fef))[_0xd36d('0x41')](handleError(_0x9dbc6b,null));};exports[_0xd36d('0x42')]=function(_0x2a8578,_0x54674c){var _0x3886fc={'raw':!![],'where':{'id':_0x2a8578['params']['id']}},_0x506589={};_0x506589[_0xd36d('0x33')]=_['keys'](db[_0xd36d('0x2a')][_0xd36d('0x2b')]);_0x506589[_0xd36d('0x2f')]=_[_0xd36d('0x30')](_0x2a8578[_0xd36d('0x2f')]);_0x506589['filters']=_[_0xd36d('0x32')](_0x506589[_0xd36d('0x33')],_0x506589['query']);_0x3886fc[_0xd36d('0x34')]=_[_0xd36d('0x32')](_0x506589[_0xd36d('0x33')],qs['fields'](_0x2a8578[_0xd36d('0x2f')][_0xd36d('0x35')]));_0x3886fc[_0xd36d('0x34')]=_0x3886fc[_0xd36d('0x34')][_0xd36d('0x36')]?_0x3886fc['attributes']:_0x506589['model'];if(_0x2a8578[_0xd36d('0x2f')][_0xd36d('0x3e')]){_0x3886fc[_0xd36d('0x3f')]=[{'all':!![]}];}_0x3886fc=_['merge']({},_0x3886fc,_0x2a8578['options']);return db[_0xd36d('0x2a')][_0xd36d('0x43')](_0x3886fc)[_0xd36d('0x25')](handleEntityNotFound(_0x54674c,null))[_0xd36d('0x25')](respondWithResult(_0x54674c,null))['catch'](handleError(_0x54674c,null));};exports['create']=function(_0x6e912d,_0x435966){return db['OpenchannelTransferReport'][_0xd36d('0x44')](_0x6e912d[_0xd36d('0x45')],{})[_0xd36d('0x25')](respondWithResult(_0x435966,0xc9))[_0xd36d('0x41')](handleError(_0x435966,null));};exports[_0xd36d('0x46')]=function(_0xe4ba0b,_0x839909){if(_0xe4ba0b[_0xd36d('0x45')]['id']){delete _0xe4ba0b[_0xd36d('0x45')]['id'];}return db[_0xd36d('0x2a')][_0xd36d('0x43')]({'where':{'id':_0xe4ba0b['params']['id']}})[_0xd36d('0x25')](handleEntityNotFound(_0x839909,null))[_0xd36d('0x25')](saveUpdates(_0xe4ba0b[_0xd36d('0x45')],null))[_0xd36d('0x25')](respondWithResult(_0x839909,null))['catch'](handleError(_0x839909,null));};exports[_0xd36d('0x47')]=function(_0x49a5ec,_0x38ed9a){return db[_0xd36d('0x2a')][_0xd36d('0x43')]({'where':{'id':_0x49a5ec['params']['id']}})[_0xd36d('0x25')](handleEntityNotFound(_0x38ed9a,null))[_0xd36d('0x25')](removeEntity(_0x38ed9a,null))[_0xd36d('0x41')](handleError(_0x38ed9a,null));};exports[_0xd36d('0x48')]=function(_0x40e6b6,_0x1010f2){return db[_0xd36d('0x2a')][_0xd36d('0x48')]()['then'](respondWithResult(_0x1010f2,null))[_0xd36d('0x41')](handleError(_0x1010f2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index df34ca4..7fa2b5f 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 _0x7a60=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x20b5e3,_0x343ad0){var _0x18e1bb=function(_0x38c24f){while(--_0x38c24f){_0x20b5e3['push'](_0x20b5e3['shift']());}};_0x18e1bb(++_0x343ad0);}(_0x7a60,0xc2));var _0x07a6=function(_0x8622a1,_0x546063){_0x8622a1=_0x8622a1-0x0;var _0x428249=_0x7a60[_0x8622a1];return _0x428249;};'use strict';var _=require(_0x07a6('0x0'));var util=require(_0x07a6('0x1'));var logger=require('../../config/logger')(_0x07a6('0x2'));var moment=require(_0x07a6('0x3'));var BPromise=require(_0x07a6('0x4'));var rp=require(_0x07a6('0x5'));var fs=require('fs');var path=require(_0x07a6('0x6'));var rimraf=require(_0x07a6('0x7'));var config=require(_0x07a6('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x07a6('0x9')]=function(_0x22b777,_0x4e4480){return _0x22b777[_0x07a6('0xa')](_0x07a6('0xb'),attributes,{'tableName':_0x07a6('0xc'),'paranoid':![],'indexes':[{'name':_0x07a6('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe99b=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe99b,0x12c));var _0xbe99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe99b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbe99('0x0'));var logger=require(_0xbe99('0x1'))(_0xbe99('0x2'));var moment=require('moment');var BPromise=require(_0xbe99('0x3'));var rp=require(_0xbe99('0x4'));var fs=require('fs');var path=require(_0xbe99('0x5'));var rimraf=require(_0xbe99('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe99('0x7'));module[_0xbe99('0x8')]=function(_0x26bfe2,_0x4cced9){return _0x26bfe2[_0xbe99('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xbe99('0xa'),'paranoid':![],'indexes':[{'name':_0xbe99('0xb'),'fields':[_0xbe99('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 9131353..32c1b2e 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 _0x7a59=['debug','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x7a59,0x16e));var _0x97a5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7a59[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x97a5('0x1'));var rs=require(_0x97a5('0x2'));var fs=require('fs');var Redis=require(_0x97a5('0x3'));var db=require(_0x97a5('0x4'))['db'];var utils=require(_0x97a5('0x5'));var logger=require('../../config/logger')(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var jayson=require(_0x97a5('0x8'));var client=jayson['client'][_0x97a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52d32f,_0x2663b9,_0x2c0efa){return new BPromise(function(_0x27e8a6,_0x156789){return client[_0x97a5('0xa')](_0x52d32f,_0x2c0efa)['then'](function(_0x4f34e8){logger[_0x97a5('0xb')](_0x97a5('0xc'),_0x2663b9,_0x97a5('0xd'));logger[_0x97a5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2663b9,'request\x20sent',JSON[_0x97a5('0xf')](_0x4f34e8));if(_0x4f34e8[_0x97a5('0x10')]){if(_0x4f34e8[_0x97a5('0x10')]['code']===0x1f4){logger[_0x97a5('0x10')](_0x97a5('0xc'),_0x2663b9,_0x4f34e8['error']['message']);return _0x156789(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2663b9,_0x4f34e8['error']['message']);return _0x27e8a6(_0x4f34e8[_0x97a5('0x10')][_0x97a5('0x11')]);}else{logger[_0x97a5('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2663b9,_0x97a5('0xd'));_0x27e8a6(_0x4f34e8[_0x97a5('0x12')]['message']);}})[_0x97a5('0x13')](function(_0x5ee8ca){logger[_0x97a5('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2663b9,_0x5ee8ca);_0x156789(_0x5ee8ca);});});} \ No newline at end of file +var _0x423b=['bluebird','ioredis','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x2fea57,_0x4fafb4){var _0x48ce61=function(_0x2c1c94){while(--_0x2c1c94){_0x2fea57['push'](_0x2fea57['shift']());}};_0x48ce61(++_0x4fafb4);}(_0x423b,0x12b));var _0xb423=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x423b[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var moment=require('moment');var BPromise=require(_0xb423('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb423('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb423('0x3'));var config=require(_0xb423('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb423('0x5')][_0xb423('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x49eabb,_0x28947d,_0x573e95){return new BPromise(function(_0x4119d7,_0x3ac522){return client[_0xb423('0x7')](_0x49eabb,_0x573e95)[_0xb423('0x8')](function(_0x27dcf3){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x28947d,_0xb423('0x9'));logger[_0xb423('0xa')](_0xb423('0xb'),_0x28947d,_0xb423('0x9'),JSON[_0xb423('0xc')](_0x27dcf3));if(_0x27dcf3['error']){if(_0x27dcf3[_0xb423('0xd')][_0xb423('0xe')]===0x1f4){logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3[_0xb423('0xd')][_0xb423('0x10')]);return _0x3ac522(_0x27dcf3['error'][_0xb423('0x10')]);}logger['error'](_0xb423('0xf'),_0x28947d,_0x27dcf3['error']['message']);return _0x4119d7(_0x27dcf3['error'][_0xb423('0x10')]);}else{logger[_0xb423('0x11')](_0xb423('0xf'),_0x28947d,'request\x20sent');_0x4119d7(_0x27dcf3[_0xb423('0x12')][_0xb423('0x10')]);}})[_0xb423('0x13')](function(_0x39edac){logger['error'](_0xb423('0xf'),_0x28947d,_0x39edac);_0x3ac522(_0x39edac);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 2590512..d96b763 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 _0x89e7=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x89e7,0x1a6));var _0x789e=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x89e7[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x789e('0x0'));var util=require(_0x789e('0x1'));var path=require(_0x789e('0x2'));var timeout=require('connect-timeout');var express=require(_0x789e('0x3'));var router=express['Router']();var fs_extra=require(_0x789e('0x4'));var auth=require(_0x789e('0x5'));var interaction=require(_0x789e('0x6'));var config=require(_0x789e('0x7'));var controller=require(_0x789e('0x8'));router['get']('/',auth[_0x789e('0x9')](),controller['index']);router[_0x789e('0xa')](_0x789e('0xb'),auth['isAuthenticated'](),controller[_0x789e('0xc')]);router[_0x789e('0xd')]('/',auth['isAuthenticated'](),controller[_0x789e('0xe')]);router[_0x789e('0xf')](_0x789e('0xb'),auth[_0x789e('0x9')](),controller[_0x789e('0x10')]);router[_0x789e('0x11')](_0x789e('0xb'),auth[_0x789e('0x9')](),controller[_0x789e('0x12')]);module[_0x789e('0x13')]=router; \ No newline at end of file +var _0x9af1=['isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get'];(function(_0x14aa96,_0xd83a5d){var _0x4eaa55=function(_0x238286){while(--_0x238286){_0x14aa96['push'](_0x14aa96['shift']());}};_0x4eaa55(++_0xd83a5d);}(_0x9af1,0x68));var _0x19af=function(_0x4ea0e5,_0x2410c0){_0x4ea0e5=_0x4ea0e5-0x0;var _0x20e920=_0x9af1[_0x4ea0e5];return _0x20e920;};'use strict';var multer=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var path=require(_0x19af('0x2'));var timeout=require('connect-timeout');var express=require(_0x19af('0x3'));var router=express[_0x19af('0x4')]();var fs_extra=require(_0x19af('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19af('0x6'));var controller=require('./pause.controller');router[_0x19af('0x7')]('/',auth[_0x19af('0x8')](),controller[_0x19af('0x9')]);router[_0x19af('0x7')](_0x19af('0xa'),auth['isAuthenticated'](),controller[_0x19af('0xb')]);router[_0x19af('0xc')]('/',auth[_0x19af('0x8')](),controller['create']);router[_0x19af('0xd')](_0x19af('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x19af('0xe')]('/:id',auth[_0x19af('0x8')](),controller['destroy']);module[_0x19af('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f1471c1..0df84ac 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 _0x7933=['STRING','sequelize','exports','name'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x7933,0x109));var _0x3793=function(_0x4a2638,_0x505fab){_0x4a2638=_0x4a2638-0x0;var _0x1ceb12=_0x7933[_0x4a2638];return _0x1ceb12;};'use strict';var Sequelize=require(_0x3793('0x0'));module[_0x3793('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3793('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3793('0x3')]}}; \ No newline at end of file +var _0x68e5=['name','sequelize','exports','STRING'];(function(_0xd0a4bb,_0x3b77c3){var _0x36fbd9=function(_0x519356){while(--_0x519356){_0xd0a4bb['push'](_0xd0a4bb['shift']());}};_0x36fbd9(++_0x3b77c3);}(_0x68e5,0x1d1));var _0x568e=function(_0x1a25eb,_0x14a76c){_0x1a25eb=_0x1a25eb-0x0;var _0x58128a=_0x68e5[_0x1a25eb];return _0x58128a;};'use strict';var Sequelize=require(_0x568e('0x0'));module[_0x568e('0x1')]={'name':{'type':Sequelize[_0x568e('0x2')],'unique':_0x568e('0x3'),'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 a40bb14..bd1efd0 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 _0x9ff9=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','sendStatus','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x9ff9,0x9a));var _0x99ff=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x9ff9[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99ff('0x0'));var zipdir=require(_0x99ff('0x1'));var jsonpatch=require(_0x99ff('0x2'));var rp=require(_0x99ff('0x3'));var moment=require(_0x99ff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x99ff('0x5'));var sox=require(_0x99ff('0x6'));var csv=require(_0x99ff('0x7'));var ejs=require(_0x99ff('0x8'));var fs=require('fs');var fs_extra=require(_0x99ff('0x9'));var _=require(_0x99ff('0xa'));var squel=require(_0x99ff('0xb'));var crypto=require(_0x99ff('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x99ff('0xd'));var toCsv=require(_0x99ff('0x7'));var querystring=require(_0x99ff('0xe'));var Papa=require(_0x99ff('0xf'));var Redis=require(_0x99ff('0x10'));var authService=require(_0x99ff('0x11'));var qs=require(_0x99ff('0x12'));var as=require(_0x99ff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99ff('0x14'))('api');var utils=require(_0x99ff('0x15'));var config=require(_0x99ff('0x16'));var licenseUtil=require(_0x99ff('0x17'));var db=require(_0x99ff('0x18'))['db'];function respondWithStatusCode(_0x1254b5,_0x2fedd1){_0x2fedd1=_0x2fedd1||0xcc;return function(_0x5d768f){if(_0x5d768f){return _0x1254b5['sendStatus'](_0x2fedd1);}return _0x1254b5[_0x99ff('0x19')](_0x2fedd1)[_0x99ff('0x1a')]();};}function respondWithResult(_0xe469bc,_0x55e78b){_0x55e78b=_0x55e78b||0xc8;return function(_0x4ff5be){if(_0x4ff5be){return _0xe469bc[_0x99ff('0x19')](_0x55e78b)[_0x99ff('0x1b')](_0x4ff5be);}};}function respondWithFilteredResult(_0x3cc68a,_0x262ef5){return function(_0x1a3d96){if(_0x1a3d96){var _0x2bc86c=typeof _0x262ef5[_0x99ff('0x1c')]===_0x99ff('0x1d')&&typeof _0x262ef5['limit']===_0x99ff('0x1d');var _0x44183a=_0x1a3d96[_0x99ff('0x1e')];var _0x1d1704=_0x2bc86c?0x0:_0x262ef5[_0x99ff('0x1c')];var _0x28a41c=_0x2bc86c?_0x1a3d96['count']:_0x262ef5['offset']+_0x262ef5[_0x99ff('0x1f')];var _0xbc51c7;if(_0x28a41c>=_0x44183a){_0x28a41c=_0x44183a;_0xbc51c7=0xc8;}else{_0xbc51c7=0xce;}_0x3cc68a[_0x99ff('0x19')](_0xbc51c7);return _0x3cc68a[_0x99ff('0x20')](_0x99ff('0x21'),_0x1d1704+'-'+_0x28a41c+'/'+_0x44183a)[_0x99ff('0x1b')](_0x1a3d96);}return null;};}function patchUpdates(_0x4ea92a){return function(_0xeda439){try{jsonpatch[_0x99ff('0x22')](_0xeda439,_0x4ea92a,!![]);}catch(_0x3eac71){return BPromise[_0x99ff('0x23')](_0x3eac71);}return _0xeda439[_0x99ff('0x24')]();};}function saveUpdates(_0x5b2d49,_0x2bf430){return function(_0x31dfa1){if(_0x31dfa1){return _0x31dfa1['update'](_0x5b2d49)[_0x99ff('0x25')](function(_0x5eda68){return _0x5eda68;});}return null;};}function removeEntity(_0x30f96f,_0x5e1219){return function(_0x4f42da){if(_0x4f42da){return _0x4f42da[_0x99ff('0x26')]()[_0x99ff('0x25')](function(){var _0x3fcd5a=_0x4f42da[_0x99ff('0x27')]({'plain':!![]});var _0x80d0f3=_0x99ff('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x80d0f3,'resourceId':_0x3fcd5a['id']}})['then'](function(){return _0x4f42da;});})[_0x99ff('0x25')](function(){_0x30f96f[_0x99ff('0x19')](0xcc)[_0x99ff('0x1a')]();});}};}function handleEntityNotFound(_0xe16789,_0x21b2b3){return function(_0x4ec818){if(!_0x4ec818){_0xe16789[_0x99ff('0x29')](0x194);}return _0x4ec818;};}function handleError(_0x29db00,_0x49acf2){_0x49acf2=_0x49acf2||0x1f4;return function(_0x36fcf3){logger['error'](_0x36fcf3[_0x99ff('0x2a')]);if(_0x36fcf3[_0x99ff('0x2b')]){delete _0x36fcf3[_0x99ff('0x2b')];}_0x29db00[_0x99ff('0x19')](_0x49acf2)[_0x99ff('0x2c')](_0x36fcf3);};}exports[_0x99ff('0x2d')]=function(_0x5e600c,_0x43c286){var _0x5cffac={},_0x2ad845={},_0x6d7c91={'count':0x0,'rows':[]};var _0xc55e76=_[_0x99ff('0x2e')](db[_0x99ff('0x2f')][_0x99ff('0x30')],function(_0x3e6d0b){return{'name':_0x3e6d0b[_0x99ff('0x31')],'type':_0x3e6d0b[_0x99ff('0x32')]['key']};});_0x2ad845[_0x99ff('0x33')]=_[_0x99ff('0x2e')](_0xc55e76,'name');_0x2ad845[_0x99ff('0x34')]=_[_0x99ff('0x35')](_0x5e600c[_0x99ff('0x34')]);_0x2ad845[_0x99ff('0x36')]=_[_0x99ff('0x37')](_0x2ad845[_0x99ff('0x33')],_0x2ad845['query']);_0x5cffac[_0x99ff('0x38')]=_[_0x99ff('0x37')](_0x2ad845['model'],qs[_0x99ff('0x39')](_0x5e600c[_0x99ff('0x34')][_0x99ff('0x39')]));_0x5cffac[_0x99ff('0x38')]=_0x5cffac[_0x99ff('0x38')][_0x99ff('0x3a')]?_0x5cffac[_0x99ff('0x38')]:_0x2ad845[_0x99ff('0x33')];if(!_0x5e600c[_0x99ff('0x34')]['hasOwnProperty'](_0x99ff('0x3b'))){_0x5cffac['limit']=qs[_0x99ff('0x1f')](_0x5e600c['query']['limit']);_0x5cffac[_0x99ff('0x1c')]=qs[_0x99ff('0x1c')](_0x5e600c[_0x99ff('0x34')][_0x99ff('0x1c')]);}_0x5cffac['order']=qs['sort'](_0x5e600c[_0x99ff('0x34')][_0x99ff('0x3c')]);_0x5cffac[_0x99ff('0x3d')]=qs['filters'](_['pick'](_0x5e600c[_0x99ff('0x34')],_0x2ad845[_0x99ff('0x36')]),_0xc55e76);if(_0x5e600c[_0x99ff('0x34')][_0x99ff('0x3e')]){_0x5cffac['where']=_['merge'](_0x5cffac['where'],{'$or':_[_0x99ff('0x2e')](_0xc55e76,function(_0x69f89a){if(_0x69f89a[_0x99ff('0x32')]!==_0x99ff('0x3f')){var _0x1fc58b={};_0x1fc58b[_0x69f89a[_0x99ff('0x2b')]]={'$like':'%'+_0x5e600c[_0x99ff('0x34')]['filter']+'%'};return _0x1fc58b;}})});}_0x5cffac=_[_0x99ff('0x40')]({},_0x5cffac,_0x5e600c[_0x99ff('0x41')]);var _0x554f6b={'where':_0x5cffac[_0x99ff('0x3d')]};return db[_0x99ff('0x2f')][_0x99ff('0x1e')](_0x554f6b)['then'](function(_0x42cee2){_0x6d7c91['count']=_0x42cee2;if(_0x5e600c['query'][_0x99ff('0x42')]){_0x5cffac[_0x99ff('0x43')]=[{'all':!![]}];}return db['Pause']['findAll'](_0x5cffac);})[_0x99ff('0x25')](function(_0x37dff5){_0x6d7c91[_0x99ff('0x44')]=_0x37dff5;return _0x6d7c91;})['then'](respondWithFilteredResult(_0x43c286,_0x5cffac))[_0x99ff('0x45')](handleError(_0x43c286,null));};exports['show']=function(_0x29b470,_0xb2fe9c){var _0x463cad={'raw':!![],'where':{'id':_0x29b470[_0x99ff('0x46')]['id']}},_0x40935a={};_0x40935a[_0x99ff('0x33')]=_[_0x99ff('0x35')](db[_0x99ff('0x2f')][_0x99ff('0x30')]);_0x40935a[_0x99ff('0x34')]=_['keys'](_0x29b470[_0x99ff('0x34')]);_0x40935a['filters']=_['intersection'](_0x40935a[_0x99ff('0x33')],_0x40935a['query']);_0x463cad[_0x99ff('0x38')]=_[_0x99ff('0x37')](_0x40935a[_0x99ff('0x33')],qs[_0x99ff('0x39')](_0x29b470[_0x99ff('0x34')][_0x99ff('0x39')]));_0x463cad[_0x99ff('0x38')]=_0x463cad['attributes']['length']?_0x463cad[_0x99ff('0x38')]:_0x40935a[_0x99ff('0x33')];if(_0x29b470[_0x99ff('0x34')][_0x99ff('0x42')]){_0x463cad['include']=[{'all':!![]}];}_0x463cad=_[_0x99ff('0x40')]({},_0x463cad,_0x29b470[_0x99ff('0x41')]);return db[_0x99ff('0x2f')][_0x99ff('0x47')](_0x463cad)[_0x99ff('0x25')](handleEntityNotFound(_0xb2fe9c,null))['then'](respondWithResult(_0xb2fe9c,null))[_0x99ff('0x45')](handleError(_0xb2fe9c,null));};exports[_0x99ff('0x48')]=function(_0x4d86d3,_0x12b897){return db['Pause'][_0x99ff('0x48')](_0x4d86d3[_0x99ff('0x49')],{})[_0x99ff('0x25')](function(_0x3a4e51){var _0x1203f1=_0x4d86d3[_0x99ff('0x4a')][_0x99ff('0x27')]({'plain':!![]});if(!_0x1203f1)throw new Error(_0x99ff('0x4b'));if(_0x1203f1[_0x99ff('0x4c')]===_0x99ff('0x4a')){var _0x38171a=_0x3a4e51['get']({'plain':!![]});var _0x8e4ce9=_0x99ff('0x28');return db['UserProfileSection'][_0x99ff('0x47')]({'where':{'name':_0x8e4ce9,'userProfileId':_0x1203f1[_0x99ff('0x4d')]},'raw':!![]})[_0x99ff('0x25')](function(_0x214f8b){if(_0x214f8b&&_0x214f8b[_0x99ff('0x4e')]===0x0){return db[_0x99ff('0x4f')][_0x99ff('0x48')]({'name':_0x38171a[_0x99ff('0x2b')],'resourceId':_0x38171a['id'],'type':_0x214f8b['name'],'sectionId':_0x214f8b['id']},{})[_0x99ff('0x25')](function(){return _0x3a4e51;});}else{return _0x3a4e51;}})['catch'](function(_0x4b6916){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b6916);throw _0x4b6916;});}return _0x3a4e51;})['then'](respondWithResult(_0x12b897,0xc9))[_0x99ff('0x45')](handleError(_0x12b897,null));};exports[_0x99ff('0x50')]=function(_0x285cf1,_0x579b94){if(_0x285cf1['body']['id']){delete _0x285cf1[_0x99ff('0x49')]['id'];}return db[_0x99ff('0x2f')][_0x99ff('0x47')]({'where':{'id':_0x285cf1[_0x99ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x579b94,null))[_0x99ff('0x25')](saveUpdates(_0x285cf1[_0x99ff('0x49')],null))[_0x99ff('0x25')](respondWithResult(_0x579b94,null))[_0x99ff('0x45')](handleError(_0x579b94,null));};exports['destroy']=function(_0x7e53c8,_0x587707){return db[_0x99ff('0x2f')][_0x99ff('0x47')]({'where':{'id':_0x7e53c8[_0x99ff('0x46')]['id']}})[_0x99ff('0x25')](handleEntityNotFound(_0x587707,null))[_0x99ff('0x25')](removeEntity(_0x587707,null))['catch'](handleError(_0x587707,null));}; \ No newline at end of file +var _0xd085=['error','name','send','index','Pause','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','UserProfileResource','then','sendStatus'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd085,0x7f));var _0x5d08=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xd085[_0x33c9f8];return _0x2d7004;};'use strict';var emlformat=require(_0x5d08('0x0'));var rimraf=require(_0x5d08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d08('0x2'));var rp=require(_0x5d08('0x3'));var moment=require(_0x5d08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d08('0x5'));var util=require('util');var path=require(_0x5d08('0x6'));var sox=require(_0x5d08('0x7'));var csv=require(_0x5d08('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d08('0x9'));var _=require(_0x5d08('0xa'));var squel=require(_0x5d08('0xb'));var crypto=require(_0x5d08('0xc'));var jsforce=require(_0x5d08('0xd'));var deskjs=require(_0x5d08('0xe'));var toCsv=require(_0x5d08('0x8'));var querystring=require('querystring');var Papa=require(_0x5d08('0xf'));var Redis=require(_0x5d08('0x10'));var authService=require(_0x5d08('0x11'));var qs=require(_0x5d08('0x12'));var as=require(_0x5d08('0x13'));var hardwareService=require(_0x5d08('0x14'));var logger=require(_0x5d08('0x15'))('api');var utils=require(_0x5d08('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5d08('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48c1cd,_0x3b291e){_0x3b291e=_0x3b291e||0xcc;return function(_0x42ede6){if(_0x42ede6){return _0x48c1cd['sendStatus'](_0x3b291e);}return _0x48c1cd[_0x5d08('0x18')](_0x3b291e)[_0x5d08('0x19')]();};}function respondWithResult(_0x57e2ce,_0x2a7bba){_0x2a7bba=_0x2a7bba||0xc8;return function(_0xd3384c){if(_0xd3384c){return _0x57e2ce[_0x5d08('0x18')](_0x2a7bba)['json'](_0xd3384c);}};}function respondWithFilteredResult(_0x1bd265,_0x3d3631){return function(_0x4bc35b){if(_0x4bc35b){var _0x13ed9d=typeof _0x3d3631[_0x5d08('0x1a')]===_0x5d08('0x1b')&&typeof _0x3d3631[_0x5d08('0x1c')]==='undefined';var _0xb448d7=_0x4bc35b[_0x5d08('0x1d')];var _0x1a0c19=_0x13ed9d?0x0:_0x3d3631[_0x5d08('0x1a')];var _0x1eb8fd=_0x13ed9d?_0x4bc35b[_0x5d08('0x1d')]:_0x3d3631[_0x5d08('0x1a')]+_0x3d3631[_0x5d08('0x1c')];var _0x5174b2;if(_0x1eb8fd>=_0xb448d7){_0x1eb8fd=_0xb448d7;_0x5174b2=0xc8;}else{_0x5174b2=0xce;}_0x1bd265[_0x5d08('0x18')](_0x5174b2);return _0x1bd265[_0x5d08('0x1e')](_0x5d08('0x1f'),_0x1a0c19+'-'+_0x1eb8fd+'/'+_0xb448d7)[_0x5d08('0x20')](_0x4bc35b);}return null;};}function patchUpdates(_0x63118a){return function(_0x44f508){try{jsonpatch[_0x5d08('0x21')](_0x44f508,_0x63118a,!![]);}catch(_0x27fd88){return BPromise[_0x5d08('0x22')](_0x27fd88);}return _0x44f508['save']();};}function saveUpdates(_0x5e2f02,_0x4535ea){return function(_0x1d3273){if(_0x1d3273){return _0x1d3273[_0x5d08('0x23')](_0x5e2f02)['then'](function(_0x3312d3){return _0x3312d3;});}return null;};}function removeEntity(_0x115ac1,_0x37fd86){return function(_0x3afbc2){if(_0x3afbc2){return _0x3afbc2[_0x5d08('0x24')]()['then'](function(){var _0x5154c3=_0x3afbc2[_0x5d08('0x25')]({'plain':!![]});var _0x263c39='Pauses';return db[_0x5d08('0x26')][_0x5d08('0x24')]({'where':{'type':_0x263c39,'resourceId':_0x5154c3['id']}})[_0x5d08('0x27')](function(){return _0x3afbc2;});})[_0x5d08('0x27')](function(){_0x115ac1['status'](0xcc)[_0x5d08('0x19')]();});}};}function handleEntityNotFound(_0x11bd10,_0x4a44a1){return function(_0x35b3e4){if(!_0x35b3e4){_0x11bd10[_0x5d08('0x28')](0x194);}return _0x35b3e4;};}function handleError(_0x5683ba,_0x1dba90){_0x1dba90=_0x1dba90||0x1f4;return function(_0x3c4f68){logger[_0x5d08('0x29')](_0x3c4f68['stack']);if(_0x3c4f68[_0x5d08('0x2a')]){delete _0x3c4f68[_0x5d08('0x2a')];}_0x5683ba[_0x5d08('0x18')](_0x1dba90)[_0x5d08('0x2b')](_0x3c4f68);};}exports[_0x5d08('0x2c')]=function(_0x828cdf,_0xbdaae8){var _0x503671={},_0xa1625f={},_0x5c1e43={'count':0x0,'rows':[]};var _0xb2ee97=_['map'](db[_0x5d08('0x2d')][_0x5d08('0x2e')],function(_0x50813d){return{'name':_0x50813d['fieldName'],'type':_0x50813d[_0x5d08('0x2f')]['key']};});_0xa1625f[_0x5d08('0x30')]=_[_0x5d08('0x31')](_0xb2ee97,'name');_0xa1625f[_0x5d08('0x32')]=_[_0x5d08('0x33')](_0x828cdf[_0x5d08('0x32')]);_0xa1625f[_0x5d08('0x34')]=_[_0x5d08('0x35')](_0xa1625f['model'],_0xa1625f[_0x5d08('0x32')]);_0x503671[_0x5d08('0x36')]=_[_0x5d08('0x35')](_0xa1625f[_0x5d08('0x30')],qs[_0x5d08('0x37')](_0x828cdf[_0x5d08('0x32')]['fields']));_0x503671[_0x5d08('0x36')]=_0x503671['attributes']['length']?_0x503671[_0x5d08('0x36')]:_0xa1625f[_0x5d08('0x30')];if(!_0x828cdf[_0x5d08('0x32')][_0x5d08('0x38')](_0x5d08('0x39'))){_0x503671[_0x5d08('0x1c')]=qs[_0x5d08('0x1c')](_0x828cdf[_0x5d08('0x32')]['limit']);_0x503671[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x828cdf[_0x5d08('0x32')][_0x5d08('0x1a')]);}_0x503671[_0x5d08('0x3a')]=qs[_0x5d08('0x3b')](_0x828cdf[_0x5d08('0x32')]['sort']);_0x503671[_0x5d08('0x3c')]=qs[_0x5d08('0x34')](_[_0x5d08('0x3d')](_0x828cdf[_0x5d08('0x32')],_0xa1625f['filters']),_0xb2ee97);if(_0x828cdf[_0x5d08('0x32')][_0x5d08('0x3e')]){_0x503671[_0x5d08('0x3c')]=_[_0x5d08('0x3f')](_0x503671[_0x5d08('0x3c')],{'$or':_[_0x5d08('0x31')](_0xb2ee97,function(_0x5b6d5a){if(_0x5b6d5a[_0x5d08('0x2f')]!=='VIRTUAL'){var _0xf05683={};_0xf05683[_0x5b6d5a[_0x5d08('0x2a')]]={'$like':'%'+_0x828cdf['query'][_0x5d08('0x3e')]+'%'};return _0xf05683;}})});}_0x503671=_[_0x5d08('0x3f')]({},_0x503671,_0x828cdf[_0x5d08('0x40')]);var _0x11328c={'where':_0x503671[_0x5d08('0x3c')]};return db[_0x5d08('0x2d')][_0x5d08('0x1d')](_0x11328c)['then'](function(_0x59dd66){_0x5c1e43['count']=_0x59dd66;if(_0x828cdf[_0x5d08('0x32')][_0x5d08('0x41')]){_0x503671[_0x5d08('0x42')]=[{'all':!![]}];}return db[_0x5d08('0x2d')][_0x5d08('0x43')](_0x503671);})[_0x5d08('0x27')](function(_0x25641d){_0x5c1e43[_0x5d08('0x44')]=_0x25641d;return _0x5c1e43;})[_0x5d08('0x27')](respondWithFilteredResult(_0xbdaae8,_0x503671))[_0x5d08('0x45')](handleError(_0xbdaae8,null));};exports[_0x5d08('0x46')]=function(_0xf3fe70,_0x3a9c23){var _0x39e8c6={'raw':!![],'where':{'id':_0xf3fe70['params']['id']}},_0x2d962c={};_0x2d962c[_0x5d08('0x30')]=_['keys'](db[_0x5d08('0x2d')][_0x5d08('0x2e')]);_0x2d962c[_0x5d08('0x32')]=_['keys'](_0xf3fe70[_0x5d08('0x32')]);_0x2d962c[_0x5d08('0x34')]=_[_0x5d08('0x35')](_0x2d962c[_0x5d08('0x30')],_0x2d962c[_0x5d08('0x32')]);_0x39e8c6[_0x5d08('0x36')]=_['intersection'](_0x2d962c['model'],qs[_0x5d08('0x37')](_0xf3fe70[_0x5d08('0x32')][_0x5d08('0x37')]));_0x39e8c6['attributes']=_0x39e8c6[_0x5d08('0x36')][_0x5d08('0x47')]?_0x39e8c6[_0x5d08('0x36')]:_0x2d962c[_0x5d08('0x30')];if(_0xf3fe70[_0x5d08('0x32')][_0x5d08('0x41')]){_0x39e8c6[_0x5d08('0x42')]=[{'all':!![]}];}_0x39e8c6=_[_0x5d08('0x3f')]({},_0x39e8c6,_0xf3fe70[_0x5d08('0x40')]);return db[_0x5d08('0x2d')][_0x5d08('0x48')](_0x39e8c6)[_0x5d08('0x27')](handleEntityNotFound(_0x3a9c23,null))[_0x5d08('0x27')](respondWithResult(_0x3a9c23,null))[_0x5d08('0x45')](handleError(_0x3a9c23,null));};exports[_0x5d08('0x49')]=function(_0x532d4a,_0x111d2d){return db[_0x5d08('0x2d')][_0x5d08('0x49')](_0x532d4a[_0x5d08('0x4a')],{})['then'](function(_0x2ce5d4){var _0x8e4eea=_0x532d4a[_0x5d08('0x4b')][_0x5d08('0x25')]({'plain':!![]});if(!_0x8e4eea)throw new Error(_0x5d08('0x4c'));if(_0x8e4eea[_0x5d08('0x4d')]===_0x5d08('0x4b')){var _0x298d0d=_0x2ce5d4[_0x5d08('0x25')]({'plain':!![]});var _0xf104e9=_0x5d08('0x4e');return db[_0x5d08('0x4f')][_0x5d08('0x48')]({'where':{'name':_0xf104e9,'userProfileId':_0x8e4eea[_0x5d08('0x50')]},'raw':!![]})[_0x5d08('0x27')](function(_0x46e012){if(_0x46e012&&_0x46e012[_0x5d08('0x51')]===0x0){return db[_0x5d08('0x26')][_0x5d08('0x49')]({'name':_0x298d0d['name'],'resourceId':_0x298d0d['id'],'type':_0x46e012['name'],'sectionId':_0x46e012['id']},{})[_0x5d08('0x27')](function(){return _0x2ce5d4;});}else{return _0x2ce5d4;}})[_0x5d08('0x45')](function(_0x1bf6be){logger[_0x5d08('0x29')](_0x5d08('0x52'),_0x1bf6be);throw _0x1bf6be;});}return _0x2ce5d4;})['then'](respondWithResult(_0x111d2d,0xc9))[_0x5d08('0x45')](handleError(_0x111d2d,null));};exports[_0x5d08('0x23')]=function(_0x3c0b7b,_0xba59fc){if(_0x3c0b7b[_0x5d08('0x4a')]['id']){delete _0x3c0b7b[_0x5d08('0x4a')]['id'];}return db['Pause'][_0x5d08('0x48')]({'where':{'id':_0x3c0b7b[_0x5d08('0x53')]['id']}})[_0x5d08('0x27')](handleEntityNotFound(_0xba59fc,null))[_0x5d08('0x27')](saveUpdates(_0x3c0b7b['body'],null))[_0x5d08('0x27')](respondWithResult(_0xba59fc,null))[_0x5d08('0x45')](handleError(_0xba59fc,null));};exports[_0x5d08('0x24')]=function(_0x4f8d97,_0x577bb7){return db[_0x5d08('0x2d')][_0x5d08('0x48')]({'where':{'id':_0x4f8d97[_0x5d08('0x53')]['id']}})[_0x5d08('0x27')](handleEntityNotFound(_0x577bb7,null))['then'](removeEntity(_0x577bb7,null))[_0x5d08('0x45')](handleError(_0x577bb7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0e6f279..7c2ad27 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x41fd6b,_0x5caa05){_0x41fd6b=_0x41fd6b-0x0;var _0x45f10f=_0x6aa7[_0x41fd6b];return _0x45f10f;};'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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x364d73,_0x1764e2){_0x364d73=_0x364d73-0x0;var _0x3dfe28=_0x6aa7[_0x364d73];return _0x3dfe28;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index ccee93c..01b1434 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(_0x22685d,_0x1af184){var _0x59756a=function(_0x11168e){while(--_0x11168e){_0x22685d['push'](_0x22685d['shift']());}};_0x59756a(++_0x1af184);}(_0xb10b,0x12a));var _0xbb10=function(_0x54cd0b,_0x182ab9){_0x54cd0b=_0x54cd0b-0x0;var _0x2dbfb7=_0xb10b[_0x54cd0b];return _0x2dbfb7;};'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(_0x4b4711,_0x222975){var _0x130189=function(_0x2433e6){while(--_0x2433e6){_0x4b4711['push'](_0x4b4711['shift']());}};_0x130189(++_0x222975);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e1fb6,_0xf3495b){_0x5e1fb6=_0x5e1fb6-0x0;var _0x2cf20e=_0xb10b[_0x5e1fb6];return _0x2cf20e;};'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 c260bfa..116eaa4 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(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xac9d,0x14d));var _0xdac9=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0xac9d[_0x4257b6];return _0x4ad68c;};'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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x3ac524,_0x5c018a){var _0x2ba620=function(_0x4cdcbb){while(--_0x4cdcbb){_0x3ac524['push'](_0x3ac524['shift']());}};_0x2ba620(++_0x5c018a);}(_0xe14d,0x1ee));var _0xde14=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xe14d[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 98b6b97..9532bcc 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 _0x236d=['exports','STRING','ENUM','html','script','TEXT','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.'];(function(_0x41c745,_0x234cdc){var _0x5d6f35=function(_0x7a374c){while(--_0x7a374c){_0x41c745['push'](_0x41c745['shift']());}};_0x5d6f35(++_0x234cdc);}(_0x236d,0x1e1));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xd236('0x0')]={'name':{'type':Sequelize[_0xd236('0x1')]},'type':{'type':Sequelize[_0xd236('0x2')](_0xd236('0x3'),_0xd236('0x4'))},'description':{'type':Sequelize[_0xd236('0x5')]},'version':{'type':Sequelize[_0xd236('0x5')]},'path':{'type':Sequelize[_0xd236('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xd236('0x6')],'defaultValue':0x0,'comment':_0xd236('0x7')},'sidebar':{'type':Sequelize[_0xd236('0x2')](_0xd236('0x8'),_0xd236('0x9'),_0xd236('0xa'),_0xd236('0xb')),'defaultValue':_0xd236('0xa'),'comment':_0xd236('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd236('0x1')]},'agentUrl':{'type':Sequelize[_0xd236('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd342=['sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x430ea6,_0x58db3b){var _0x8c837=function(_0x1123ef){while(--_0x1123ef){_0x430ea6['push'](_0x430ea6['shift']());}};_0x8c837(++_0x58db3b);}(_0xd342,0xd0));var _0x2d34=function(_0x4657d4,_0x28b92c){_0x4657d4=_0x4657d4-0x0;var _0x59fd28=_0xd342[_0x4657d4];return _0x59fd28;};'use strict';var Sequelize=require(_0x2d34('0x0'));module[_0x2d34('0x1')]={'name':{'type':Sequelize[_0x2d34('0x2')]},'type':{'type':Sequelize[_0x2d34('0x3')](_0x2d34('0x4'),'script')},'description':{'type':Sequelize[_0x2d34('0x5')]},'version':{'type':Sequelize[_0x2d34('0x5')]},'path':{'type':Sequelize[_0x2d34('0x2')],'comment':_0x2d34('0x6')},'active':{'type':Sequelize[_0x2d34('0x7')],'defaultValue':0x0,'comment':_0x2d34('0x8')},'sidebar':{'type':Sequelize[_0x2d34('0x3')](_0x2d34('0x9'),'agentOnly',_0x2d34('0xa'),_0x2d34('0xb')),'defaultValue':_0x2d34('0xa'),'comment':_0x2d34('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x2d34('0x2')]},'agentUrl':{'type':Sequelize[_0x2d34('0x2')]},'scriptName':{'type':Sequelize[_0x2d34('0x2')]},'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 80d7e13..3ce71e0 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 _0xe681=['agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','extract-zip','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','socket.io-emitter','./plugin.socket','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','Plugin','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','options','include','rows','catch','params','rawAttributes','includeAll','download','find','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','length','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified'];(function(_0x2db19c,_0x381bca){var _0x115250=function(_0x356a5f){while(--_0x356a5f){_0x2db19c['push'](_0x2db19c['shift']());}};_0x115250(++_0x381bca);}(_0xe681,0x173));var _0x1e68=function(_0x507621,_0x1a01aa){_0x507621=_0x507621-0x0;var _0x4e7968=_0xe681[_0x507621];return _0x4e7968;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e68('0x0'));var zipdir=require(_0x1e68('0x1'));var jsonpatch=require(_0x1e68('0x2'));var rp=require(_0x1e68('0x3'));var moment=require('moment');var BPromise=require(_0x1e68('0x4'));var Mustache=require(_0x1e68('0x5'));var util=require('util');var path=require(_0x1e68('0x6'));var sox=require('sox');var csv=require(_0x1e68('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e68('0x8'));var _=require('lodash');var squel=require(_0x1e68('0x9'));var crypto=require(_0x1e68('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e68('0xb'));var toCsv=require(_0x1e68('0x7'));var querystring=require(_0x1e68('0xc'));var Papa=require(_0x1e68('0xd'));var extract=require(_0x1e68('0xe'));var rimraf=require(_0x1e68('0x0'));var archiver=require('archiver');var Redis=require(_0x1e68('0xf'));var authService=require(_0x1e68('0x10'));var qs=require(_0x1e68('0x11'));var as=require(_0x1e68('0x12'));var hardwareService=require(_0x1e68('0x13'));var logger=require(_0x1e68('0x14'))(_0x1e68('0x15'));var utils=require(_0x1e68('0x16'));var config=require(_0x1e68('0x17'));var licenseUtil=require(_0x1e68('0x18'));var db=require(_0x1e68('0x19'))['db'];config[_0x1e68('0x1a')]=_[_0x1e68('0x1b')](config[_0x1e68('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e68('0x1c'))(new Redis(config[_0x1e68('0x1a')]));require(_0x1e68('0x1d'))['register'](socket);function respondWithStatusCode(_0xaccd0e,_0x16e1a5){_0x16e1a5=_0x16e1a5||0xcc;return function(_0x414cfd){if(_0x414cfd){return _0xaccd0e[_0x1e68('0x1e')](_0x16e1a5);}return _0xaccd0e[_0x1e68('0x1f')](_0x16e1a5)['end']();};}function respondWithResult(_0x2b03de,_0x3ac7c1){_0x3ac7c1=_0x3ac7c1||0xc8;return function(_0x10a152){if(_0x10a152){return _0x2b03de[_0x1e68('0x1f')](_0x3ac7c1)[_0x1e68('0x20')](_0x10a152);}};}function respondWithFilteredResult(_0x584fa9,_0x47ca10){return function(_0x48a4de){if(_0x48a4de){var _0x3ca7f1=typeof _0x47ca10[_0x1e68('0x21')]===_0x1e68('0x22')&&typeof _0x47ca10[_0x1e68('0x23')]===_0x1e68('0x22');var _0x3be0aa=_0x48a4de['count'];var _0x2ed3b0=_0x3ca7f1?0x0:_0x47ca10[_0x1e68('0x21')];var _0x5f08c2=_0x3ca7f1?_0x48a4de[_0x1e68('0x24')]:_0x47ca10['offset']+_0x47ca10[_0x1e68('0x23')];var _0x1217ac;if(_0x5f08c2>=_0x3be0aa){_0x5f08c2=_0x3be0aa;_0x1217ac=0xc8;}else{_0x1217ac=0xce;}_0x584fa9[_0x1e68('0x1f')](_0x1217ac);return _0x584fa9[_0x1e68('0x25')]('Content-Range',_0x2ed3b0+'-'+_0x5f08c2+'/'+_0x3be0aa)[_0x1e68('0x20')](_0x48a4de);}return null;};}function patchUpdates(_0xd67d5c){return function(_0x35522a){try{jsonpatch[_0x1e68('0x26')](_0x35522a,_0xd67d5c,!![]);}catch(_0x296f36){return BPromise[_0x1e68('0x27')](_0x296f36);}return _0x35522a[_0x1e68('0x28')]();};}function saveUpdates(_0x36895d,_0x372ae5){return function(_0x5f0ee9){if(_0x5f0ee9){return _0x5f0ee9[_0x1e68('0x29')](_0x36895d)[_0x1e68('0x2a')](function(_0x18ddf3){return _0x18ddf3;});}return null;};}function removeEntity(_0x51c560,_0x55ff24){return function(_0x2a24e0){if(_0x2a24e0){return _0x2a24e0[_0x1e68('0x2b')]()['then'](function(){var _0x417d47=_0x2a24e0[_0x1e68('0x2c')]({'plain':!![]});var _0x1bfa0f='Plugins';return db[_0x1e68('0x2d')][_0x1e68('0x2b')]({'where':{'type':_0x1bfa0f,'resourceId':_0x417d47['id']}})[_0x1e68('0x2a')](function(){return _0x2a24e0;});})[_0x1e68('0x2a')](function(){_0x51c560[_0x1e68('0x1f')](0xcc)[_0x1e68('0x2e')]();});}};}function handleEntityNotFound(_0x4b4462,_0x3182b3){return function(_0xd8241e){if(!_0xd8241e){_0x4b4462['sendStatus'](0x194);}return _0xd8241e;};}function handleError(_0x7ec8c0,_0x3078f8){_0x3078f8=_0x3078f8||0x1f4;return function(_0x3af099){logger[_0x1e68('0x2f')](_0x3af099[_0x1e68('0x30')]);if(_0x3af099['name']){delete _0x3af099['name'];}_0x7ec8c0['status'](_0x3078f8)[_0x1e68('0x31')](_0x3af099);};}exports[_0x1e68('0x32')]=function(_0x5492ff,_0x3112d6){var _0x5ac092={},_0x58b914={},_0x1353b2={'count':0x0,'rows':[]};var _0x19bd11=_[_0x1e68('0x33')](db[_0x1e68('0x34')]['rawAttributes'],function(_0x4788e2){return{'name':_0x4788e2['fieldName'],'type':_0x4788e2[_0x1e68('0x35')][_0x1e68('0x36')]};});_0x58b914[_0x1e68('0x37')]=_[_0x1e68('0x33')](_0x19bd11,_0x1e68('0x38'));_0x58b914[_0x1e68('0x39')]=_[_0x1e68('0x3a')](_0x5492ff[_0x1e68('0x39')]);_0x58b914['filters']=_[_0x1e68('0x3b')](_0x58b914[_0x1e68('0x37')],_0x58b914[_0x1e68('0x39')]);_0x5ac092[_0x1e68('0x3c')]=_['intersection'](_0x58b914[_0x1e68('0x37')],qs[_0x1e68('0x3d')](_0x5492ff[_0x1e68('0x39')][_0x1e68('0x3d')]));_0x5ac092[_0x1e68('0x3c')]=_0x5ac092['attributes']['length']?_0x5ac092['attributes']:_0x58b914[_0x1e68('0x37')];if(!_0x5492ff[_0x1e68('0x39')][_0x1e68('0x3e')]('nolimit')){_0x5ac092[_0x1e68('0x23')]=qs[_0x1e68('0x23')](_0x5492ff[_0x1e68('0x39')][_0x1e68('0x23')]);_0x5ac092['offset']=qs[_0x1e68('0x21')](_0x5492ff['query'][_0x1e68('0x21')]);}_0x5ac092['order']=qs[_0x1e68('0x3f')](_0x5492ff['query'][_0x1e68('0x3f')]);_0x5ac092[_0x1e68('0x40')]=qs['filters'](_[_0x1e68('0x41')](_0x5492ff[_0x1e68('0x39')],_0x58b914[_0x1e68('0x42')]),_0x19bd11);if(_0x5492ff[_0x1e68('0x39')][_0x1e68('0x43')]){_0x5ac092[_0x1e68('0x40')]=_['merge'](_0x5ac092[_0x1e68('0x40')],{'$or':_[_0x1e68('0x33')](_0x19bd11,function(_0x534f0c){if(_0x534f0c[_0x1e68('0x35')]!=='VIRTUAL'){var _0x53b629={};_0x53b629[_0x534f0c[_0x1e68('0x38')]]={'$like':'%'+_0x5492ff[_0x1e68('0x39')]['filter']+'%'};return _0x53b629;}})});}_0x5ac092=_[_0x1e68('0x44')]({},_0x5ac092,_0x5492ff[_0x1e68('0x45')]);var _0xb3f2f7={'where':_0x5ac092[_0x1e68('0x40')]};return db[_0x1e68('0x34')][_0x1e68('0x24')](_0xb3f2f7)[_0x1e68('0x2a')](function(_0x228349){_0x1353b2[_0x1e68('0x24')]=_0x228349;if(_0x5492ff['query']['includeAll']){_0x5ac092[_0x1e68('0x46')]=[{'all':!![]}];}return db[_0x1e68('0x34')]['findAll'](_0x5ac092);})[_0x1e68('0x2a')](function(_0x46ddbc){_0x1353b2[_0x1e68('0x47')]=_0x46ddbc;return _0x1353b2;})[_0x1e68('0x2a')](respondWithFilteredResult(_0x3112d6,_0x5ac092))[_0x1e68('0x48')](handleError(_0x3112d6,null));};exports['show']=function(_0x574b98,_0x42d15f){var _0x4003c2={'raw':!![],'where':{'id':_0x574b98[_0x1e68('0x49')]['id']}},_0x28ccda={};_0x28ccda[_0x1e68('0x37')]=_['keys'](db[_0x1e68('0x34')][_0x1e68('0x4a')]);_0x28ccda[_0x1e68('0x39')]=_['keys'](_0x574b98['query']);_0x28ccda[_0x1e68('0x42')]=_[_0x1e68('0x3b')](_0x28ccda['model'],_0x28ccda[_0x1e68('0x39')]);_0x4003c2[_0x1e68('0x3c')]=_[_0x1e68('0x3b')](_0x28ccda[_0x1e68('0x37')],qs[_0x1e68('0x3d')](_0x574b98[_0x1e68('0x39')]['fields']));_0x4003c2[_0x1e68('0x3c')]=_0x4003c2[_0x1e68('0x3c')]['length']?_0x4003c2[_0x1e68('0x3c')]:_0x28ccda['model'];if(_0x574b98['query'][_0x1e68('0x4b')]){_0x4003c2['include']=[{'all':!![]}];}_0x4003c2=_[_0x1e68('0x44')]({},_0x4003c2,_0x574b98[_0x1e68('0x45')]);return db[_0x1e68('0x34')]['find'](_0x4003c2)[_0x1e68('0x2a')](handleEntityNotFound(_0x42d15f,null))[_0x1e68('0x2a')](respondWithResult(_0x42d15f,null))[_0x1e68('0x48')](handleError(_0x42d15f,null));};exports[_0x1e68('0x4c')]=function(_0x1deba7,_0x153520,_0x459928){return db[_0x1e68('0x34')][_0x1e68('0x4d')]({'where':{'id':_0x1deba7[_0x1e68('0x49')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0x153520,null))[_0x1e68('0x2a')](function(_0x58a508){if(_0x58a508){var _0x3fd22e=path[_0x1e68('0x4e')](config['root'],_0x1e68('0x4f'),util[_0x1e68('0x50')](_0x1e68('0x51'),path[_0x1e68('0x52')](_0x58a508[_0x1e68('0x6')])));var _0x5412b3=fs[_0x1e68('0x53')](_0x3fd22e);var _0x21086e=archiver(_0x1e68('0x54'),{'zlib':{'level':0x9}});_0x21086e['on'](_0x1e68('0x55'),function(_0x9d1605){if(_0x9d1605['code']===_0x1e68('0x56')){logger['error'](_0x9d1605);}else{throw new db[(_0x1e68('0x57'))][(_0x1e68('0x58'))](_0x1e68('0x59'));}});_0x21086e['on'](_0x1e68('0x2f'),function(_0x3717e2){throw new db['Sequelize'][(_0x1e68('0x58'))](_0x1e68('0x59'));});_0x21086e[_0x1e68('0x5a')](_0x5412b3);_0x21086e[_0x1e68('0x5b')](_0x1e68('0x5c'),{'cwd':path['join'](config[_0x1e68('0x5d')],_0x1e68('0x4f'),path[_0x1e68('0x5e')](_0x58a508[_0x1e68('0x6')])),'ignore':[path[_0x1e68('0x4e')](path[_0x1e68('0x52')](_0x58a508[_0x1e68('0x6')]),_0x1e68('0x5f')),path[_0x1e68('0x4e')](path['basename'](_0x58a508[_0x1e68('0x6')]),_0x1e68('0x60'))],'nodir':!![]})[_0x1e68('0x61')]();_0x5412b3['on'](_0x1e68('0x62'),function(){if(!fs[_0x1e68('0x63')](_0x3fd22e)){throw new db['Sequelize'][(_0x1e68('0x58'))](_0x1e68('0x64'));}return _0x153520[_0x1e68('0x4c')](_0x3fd22e,util[_0x1e68('0x50')](_0x1e68('0x51'),path[_0x1e68('0x52')](_0x58a508[_0x1e68('0x6')])),function(_0x5520ab){if(_0x5520ab){throw new db[(_0x1e68('0x57'))][(_0x1e68('0x58'))](_0x1e68('0x65'));}fs[_0x1e68('0x66')](_0x3fd22e);logger[_0x1e68('0x67')](_0x1e68('0x68'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x1e68('0x48')](handleError(_0x153520,null));};exports[_0x1e68('0x69')]=function(_0x30a3c1,_0x2a58db,_0x2962bf){var _0x5a966b=path[_0x1e68('0x52')](_0x30a3c1[_0x1e68('0x6a')][_0x1e68('0x6b')],path[_0x1e68('0x6c')](_0x30a3c1[_0x1e68('0x6a')][_0x1e68('0x6b')]));var _0x30092e=path[_0x1e68('0x4e')](config[_0x1e68('0x5d')],'server/files/plugins',_0x30a3c1['file']['filename']);var _0x5c6e4e=path[_0x1e68('0x4e')](config['root'],_0x1e68('0x4f'),_0x5a966b);logger[_0x1e68('0x67')](_0x1e68('0x6d'),_0x30092e);logger[_0x1e68('0x67')](_0x1e68('0x6e'),_0x5c6e4e);try{fs[_0x1e68('0x6f')](_0x30092e,parseInt(_0x1e68('0x70'),0x8));extract(_0x30092e,{'dir':_0x5c6e4e},function(_0xf6cd45){if(_0xf6cd45){logger[_0x1e68('0x2f')](_0xf6cd45);handleError(_0xf6cd45,!![]);};var _0x59b069=fs[_0x1e68('0x71')](_0x5c6e4e);if(_0x59b069['length']>0x1){removeReferences(_0x30092e,_0x5c6e4e);logger['error'](_0x1e68('0x72'));return _0x2962bf(new Error(_0x1e68('0x72')));}var _0x212f24=fs[_0x1e68('0x73')](path['join'](_0x5c6e4e,_0x59b069[0x0]));if(_0x212f24[_0x1e68('0x74')]()){removeReferences(_0x30092e,_0x5c6e4e);logger[_0x1e68('0x2f')](_0x1e68('0x72'));return _0x2962bf(new Error(_0x1e68('0x72')));}if(_0x212f24['isDirectory']()){var _0x2529d0=fs[_0x1e68('0x71')](path[_0x1e68('0x4e')](_0x5c6e4e,_0x59b069[0x0]));if(_0x2529d0[_0x1e68('0x75')]===0x0){removeReferences(_0x30092e,_0x5c6e4e);logger[_0x1e68('0x2f')](_0x1e68('0x72'));return _0x2962bf(new Error(_0x1e68('0x72')));}var _0x196af4=_0x2529d0[_0x1e68('0x76')](function(_0x4c5d73){return _0x4c5d73==='manifest.json';});if(!_0x196af4){return _0x2962bf(new Error(_0x1e68('0x77')));}var _0x3637ca=fs['readFileSync'](path[_0x1e68('0x4e')](_0x5c6e4e,_0x59b069[0x0],_0x1e68('0x78')));var _0x240c92=JSON[_0x1e68('0x79')](_0x3637ca);if(_0x1e68('0x22')==typeof _0x240c92[_0x1e68('0x38')]){return _0x2962bf(new Error(_0x1e68('0x7a')));}if(_0x1e68('0x22')==typeof _0x240c92[_0x1e68('0x35')]){return _0x2962bf(new Error(_0x1e68('0x7b')));}if(_0x1e68('0x22')==typeof _0x240c92['version']){return _0x2962bf(new Error(_0x1e68('0x7c')));}if(_0x1e68('0x22')==typeof _0x240c92['parameters']){return _0x2962bf(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x240c92[_0x1e68('0x35')]===_0x1e68('0x7d')){if(_0x1e68('0x22')==typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')]){return _0x2962bf(new Error(_0x1e68('0x80')));}if(_0x1e68('0x22')==typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')][_0x1e68('0x81')]&&_0x1e68('0x22')==typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')]['agent']){return _0x2962bf(new Error(_0x1e68('0x82')));}}else if(_0x240c92[_0x1e68('0x35')]===_0x1e68('0x83')){if(_0x1e68('0x22')==typeof _0x240c92['parameters'][_0x1e68('0x84')]){return _0x2962bf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x240c92['parameters'][_0x1e68('0x85')]){return _0x2962bf(new Error(_0x1e68('0x86')));}}else{return _0x2962bf(new Error(_0x1e68('0x87')));}var _0x10f93c=_0x240c92[_0x1e68('0x38')];var _0x127b8a=_0x240c92[_0x1e68('0x88')];var _0x1bdb68=_0x240c92[_0x1e68('0x35')];var _0x45b1e7=_0x240c92['sidebar']?_0x240c92[_0x1e68('0x89')]:_0x1e68('0x8a');var _0x268649=_0x240c92[_0x1e68('0x8b')]?_0x240c92[_0x1e68('0x8b')]:_0x1e68('0x8c');var _0x5716d7='';var _0x352cb5='';var _0x57ed97='';var _0x349c44='';var _0x1bfdd8=_0x240c92[_0x1e68('0x8d')];if(_0x1bdb68===_0x1e68('0x7d')){if(_0x1e68('0x22')!=typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')]['admin']){var _0x22dc21=_0x240c92['parameters'][_0x1e68('0x7f')][_0x1e68('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x1e68('0x8e')](_0x22dc21)){_0x5716d7=path['join'](_0x1e68('0x8f'),_0x5a966b,_0x59b069[0x0],_0x22dc21);}else{_0x5716d7=_0x22dc21;}}else{logger[_0x1e68('0x67')](_0x1e68('0x90'));}if(_0x1e68('0x22')!=typeof _0x240c92[_0x1e68('0x7e')]['views'][_0x1e68('0x91')]){var _0x50eb6c=_0x240c92['parameters'][_0x1e68('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x1e68('0x8e')](_0x50eb6c)){_0x352cb5=path[_0x1e68('0x4e')]('plugins',_0x5a966b,_0x59b069[0x0],_0x50eb6c);}else{_0x352cb5=_0x50eb6c;}}else{logger[_0x1e68('0x67')](_0x1e68('0x92'));}}else if(_0x1bdb68===_0x1e68('0x83')){_0x57ed97=_0x240c92['parameters'][_0x1e68('0x84')];_0x349c44=_0x240c92[_0x1e68('0x7e')][_0x1e68('0x85')];if(_0x1e68('0x22')!=typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')]){if(_0x1e68('0x22')!=typeof _0x240c92[_0x1e68('0x7e')]['views'][_0x1e68('0x81')]){var _0x22dc21=_0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')][_0x1e68('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x1e68('0x8e')](_0x22dc21)){_0x5716d7=path[_0x1e68('0x4e')](_0x1e68('0x8f'),_0x5a966b,_0x59b069[0x0],_0x22dc21);}else{_0x5716d7=_0x22dc21;}}if(_0x1e68('0x22')!=typeof _0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')][_0x1e68('0x91')]){var _0x50eb6c=_0x240c92[_0x1e68('0x7e')][_0x1e68('0x7f')][_0x1e68('0x91')];if(!/^(f|ht)tps?:\/\//i[_0x1e68('0x8e')](_0x50eb6c)){_0x352cb5=path['join'](_0x1e68('0x8f'),_0x5a966b,_0x59b069[0x0],_0x50eb6c);}else{_0x352cb5=_0x50eb6c;}}}}var _0x510d07={'name':_0x10f93c,'description':_0x127b8a,'path':path['join'](_0x5a966b,_0x59b069[0x0]),'type':_0x1bdb68,'sidebar':_0x45b1e7,'icon':_0x268649,'adminUrl':_0x5716d7,'agentUrl':_0x352cb5,'scriptName':_0x57ed97,'scriptPath':_0x349c44,'version':_0x1bfdd8};removeReferences(_0x30092e,null);return db[_0x1e68('0x34')][_0x1e68('0x93')](_0x510d07)[_0x1e68('0x2a')](function(_0x2385b7){var _0x53544f={'role':_0x30a3c1[_0x1e68('0x94')][_0x1e68('0x95')],'userProfileId':_0x30a3c1[_0x1e68('0x94')]['userProfileId']};if(!_0x53544f)throw new Error(_0x1e68('0x96'));if(_0x53544f[_0x1e68('0x95')]===_0x1e68('0x97')){var _0xda26eb=_0x2385b7[_0x1e68('0x2c')]({'plain':!![]});return db[_0x1e68('0x98')][_0x1e68('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x53544f[_0x1e68('0x99')]},'raw':!![]})[_0x1e68('0x2a')](function(_0x52b09d){if(_0x52b09d&&_0x52b09d[_0x1e68('0x9a')]===0x0){return db[_0x1e68('0x2d')][_0x1e68('0x93')]({'name':_0xda26eb[_0x1e68('0x38')],'resourceId':_0xda26eb['id'],'type':_0x52b09d[_0x1e68('0x38')],'sectionId':_0x52b09d['id']},{})['then'](function(){return _0x2385b7;});}else{return _0x2385b7;}})['catch'](function(_0x3255de){logger[_0x1e68('0x2f')](_0x1e68('0x9b'),_0x3255de);throw _0x3255de;});}return _0x2385b7;})[_0x1e68('0x2a')](respondWithResult(_0x2a58db,null))[_0x1e68('0x48')](handleError(_0x2a58db,null));}});}catch(_0x28136a){_0x2a58db[_0x1e68('0x1f')](0x1f4)[_0x1e68('0x31')](_0x28136a);}};function removeReferences(_0x489b9d,_0x32969d){try{if(_0x489b9d){fs[_0x1e68('0x66')](_0x489b9d);logger[_0x1e68('0x67')](_0x1e68('0x9c'));}if(_0x32969d){rimraf(_0x32969d,function(){});logger[_0x1e68('0x67')](_0x1e68('0x9d'));}}catch(_0x26dd3a){logger[_0x1e68('0x2f')](_0x26dd3a);}}exports[_0x1e68('0x29')]=function(_0x2cfa8c,_0x5ee26c,_0x41d376){return db[_0x1e68('0x34')][_0x1e68('0x4d')]({'where':{'id':_0x2cfa8c[_0x1e68('0x49')]['id']}})[_0x1e68('0x2a')](handleEntityNotFound(_0x5ee26c,null))[_0x1e68('0x2a')](saveUpdates(_0x2cfa8c[_0x1e68('0x94')],null))['then'](respondWithResult(_0x5ee26c,null))[_0x1e68('0x48')](handleError(_0x5ee26c,null));};exports[_0x1e68('0x9e')]=function(_0x4ad5ed,_0x52d323,_0x1de98f){return db[_0x1e68('0x34')][_0x1e68('0x4d')]({'where':{'id':_0x4ad5ed['params']['id']}})[_0x1e68('0x2a')](function(_0xa71cea){if(_0xa71cea){return _0xa71cea[_0x1e68('0x2b')]();}})[_0x1e68('0x2a')](function(_0x2b50e2){rimraf(path[_0x1e68('0x4e')](config[_0x1e68('0x5d')],_0x1e68('0x4f'),path[_0x1e68('0x5e')](_0x2b50e2[_0x1e68('0x6')])),function(){});return _0x2b50e2;})[_0x1e68('0x2a')](handleEntityNotFound(_0x52d323,null))[_0x1e68('0x2a')](respondWithStatusCode(_0x52d323,null))[_0x1e68('0x48')](handleError(_0x52d323,null));};exports['webhookGet']=function(_0x52419b,_0x576230,_0x1c5592){return BPromise['resolve']()['then'](function(){if(!_0x52419b[_0x1e68('0x39')][_0x1e68('0x6')]){throw new Error(_0x1e68('0x9f'));}if(!_0x52419b['query'][_0x1e68('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x18e69d=_0x52419b[_0x1e68('0x39')][_0x1e68('0xa1')]?_0x52419b[_0x1e68('0x39')][_0x1e68('0xa1')]+':'+_0x52419b[_0x1e68('0x39')]['port']:_0x1e68('0xa2')+_0x52419b[_0x1e68('0x39')][_0x1e68('0xa0')];var _0x592a10=_0x52419b['query'][_0x1e68('0x20')]?_0x52419b['query']['json']:!![];var _0x414725=_0x52419b[_0x1e68('0x39')][_0x1e68('0xa3')]?_0x52419b[_0x1e68('0x39')]['encoding']:null;var _0x33f4ff={'method':_0x52419b['method'],'uri':util['format'](_0x1e68('0xa4'),_0x18e69d,_0x52419b[_0x1e68('0x39')][_0x1e68('0x6')]),'json':_0x592a10,'resolveWithFullResponse':!![],'encoding':_0x414725,'qs':_0x52419b[_0x1e68('0x39')]};if(_0x52419b[_0x1e68('0xa5')]){_0x33f4ff[_0x1e68('0xa5')]=_0x52419b['headers'];if(_0x33f4ff['headers'][_0x1e68('0xa6')]){delete _0x33f4ff[_0x1e68('0xa5')][_0x1e68('0xa6')];}}if(_0x33f4ff[_0x1e68('0xa5')]['content-type']){delete _0x33f4ff[_0x1e68('0xa5')][_0x1e68('0xa7')];}return rp(_0x33f4ff);})[_0x1e68('0x2a')](function(_0x356d9){if(_0x356d9){_0x576230[_0x1e68('0x25')](_0x356d9['headers']);logger[_0x1e68('0x67')](_0x356d9['body']);if(_[_0x1e68('0xa8')](_0x52419b[_0x1e68('0x39')][_0x1e68('0x6')],_0x1e68('0x4c'))&&_0x356d9[_0x1e68('0xa9')]==0x1f4){return _0x576230['sendStatus'](_0x356d9[_0x1e68('0xa9')]);}else{return _0x576230['status'](_0x356d9[_0x1e68('0xa9')])[_0x1e68('0x31')](_0x356d9['body']);}}else{return _0x576230[_0x1e68('0x1e')](0xc8);}})['catch'](handleError(_0x576230,null));};exports[_0x1e68('0xaa')]=function(_0x5389d8,_0x46035a,_0x30f24b){return BPromise['resolve']()[_0x1e68('0x2a')](function(){if(!_0x5389d8[_0x1e68('0x39')][_0x1e68('0x6')]){throw new Error(_0x1e68('0x9f'));}if(!_0x5389d8['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x12806f=_0x5389d8[_0x1e68('0x39')]['hostname']?_0x5389d8[_0x1e68('0x39')][_0x1e68('0xa1')]+':'+_0x5389d8['query'][_0x1e68('0xa0')]:_0x1e68('0xa2')+_0x5389d8[_0x1e68('0x39')][_0x1e68('0xa0')];var _0x5598d3=_0x5389d8[_0x1e68('0x39')][_0x1e68('0x20')]?_0x5389d8[_0x1e68('0x39')][_0x1e68('0x20')]:!![];var _0x49705b=_0x5389d8[_0x1e68('0x39')][_0x1e68('0xa3')]?_0x5389d8[_0x1e68('0x39')][_0x1e68('0xa3')]:null;var _0x2cbbf4={'method':_0x5389d8[_0x1e68('0xab')],'uri':util[_0x1e68('0x50')]('%s%s',_0x12806f,_0x5389d8[_0x1e68('0x39')][_0x1e68('0x6')]),'json':_0x5598d3,'resolveWithFullResponse':!![],'encoding':_0x49705b,'body':_0x5389d8[_0x1e68('0x94')]};if(_0x5389d8[_0x1e68('0xa5')]){_0x2cbbf4[_0x1e68('0xa5')]=_0x5389d8[_0x1e68('0xa5')];if(_0x2cbbf4['headers']['content-length']){delete _0x2cbbf4[_0x1e68('0xa5')][_0x1e68('0xa6')];}}if(_0x2cbbf4[_0x1e68('0xa5')][_0x1e68('0xa7')]){delete _0x2cbbf4[_0x1e68('0xa5')]['content-type'];}return rp(_0x2cbbf4);})['then'](function(_0x390c34){if(_0x390c34){_0x46035a['set'](_0x390c34[_0x1e68('0xa5')]);logger[_0x1e68('0x67')](_0x390c34['body']);return _0x46035a[_0x1e68('0x1f')](_0x390c34[_0x1e68('0xa9')])[_0x1e68('0x31')](_0x390c34[_0x1e68('0x94')]);}else{return _0x46035a['sendStatus'](0xc8);}})['catch'](handleError(_0x46035a,null));}; \ No newline at end of file +var _0x5d3a=['findAll','rows','show','params','include','options','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon-apps','version','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','userProfileId','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','method','%s%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5d3a,0x1ae));var _0xa5d3=function(_0x59cda9,_0x47d4c4){_0x59cda9=_0x59cda9-0x0;var _0x26c18f=_0x5d3a[_0x59cda9];return _0x26c18f;};'use strict';var emlformat=require(_0xa5d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5d3('0x1'));var jsonpatch=require(_0xa5d3('0x2'));var rp=require(_0xa5d3('0x3'));var moment=require(_0xa5d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa5d3('0x5'));var util=require(_0xa5d3('0x6'));var path=require(_0xa5d3('0x7'));var sox=require(_0xa5d3('0x8'));var csv=require(_0xa5d3('0x9'));var ejs=require(_0xa5d3('0xa'));var fs=require('fs');var fs_extra=require(_0xa5d3('0xb'));var _=require(_0xa5d3('0xc'));var squel=require(_0xa5d3('0xd'));var crypto=require(_0xa5d3('0xe'));var jsforce=require(_0xa5d3('0xf'));var deskjs=require(_0xa5d3('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa5d3('0x11'));var Papa=require('papaparse');var extract=require(_0xa5d3('0x12'));var rimraf=require(_0xa5d3('0x13'));var archiver=require('archiver');var Redis=require(_0xa5d3('0x14'));var authService=require(_0xa5d3('0x15'));var qs=require(_0xa5d3('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5d3('0x17'));var logger=require(_0xa5d3('0x18'))('api');var utils=require(_0xa5d3('0x19'));var config=require(_0xa5d3('0x1a'));var licenseUtil=require(_0xa5d3('0x1b'));var db=require('../../mysqldb')['db'];config[_0xa5d3('0x1c')]=_[_0xa5d3('0x1d')](config['redis'],{'host':_0xa5d3('0x1e'),'port':0x18eb});var socket=require(_0xa5d3('0x1f'))(new Redis(config['redis']));require(_0xa5d3('0x20'))['register'](socket);function respondWithStatusCode(_0x45242b,_0x236547){_0x236547=_0x236547||0xcc;return function(_0x82b87f){if(_0x82b87f){return _0x45242b[_0xa5d3('0x21')](_0x236547);}return _0x45242b['status'](_0x236547)[_0xa5d3('0x22')]();};}function respondWithResult(_0x4afefd,_0x5a4265){_0x5a4265=_0x5a4265||0xc8;return function(_0x53435e){if(_0x53435e){return _0x4afefd[_0xa5d3('0x23')](_0x5a4265)[_0xa5d3('0x24')](_0x53435e);}};}function respondWithFilteredResult(_0x4f5083,_0xb9fe28){return function(_0x3c4b69){if(_0x3c4b69){var _0x4f8bc7=typeof _0xb9fe28[_0xa5d3('0x25')]==='undefined'&&typeof _0xb9fe28[_0xa5d3('0x26')]===_0xa5d3('0x27');var _0x303f2e=_0x3c4b69[_0xa5d3('0x28')];var _0x4d6e5c=_0x4f8bc7?0x0:_0xb9fe28[_0xa5d3('0x25')];var _0x11c75e=_0x4f8bc7?_0x3c4b69[_0xa5d3('0x28')]:_0xb9fe28['offset']+_0xb9fe28['limit'];var _0x40b4b6;if(_0x11c75e>=_0x303f2e){_0x11c75e=_0x303f2e;_0x40b4b6=0xc8;}else{_0x40b4b6=0xce;}_0x4f5083['status'](_0x40b4b6);return _0x4f5083[_0xa5d3('0x29')]('Content-Range',_0x4d6e5c+'-'+_0x11c75e+'/'+_0x303f2e)[_0xa5d3('0x24')](_0x3c4b69);}return null;};}function patchUpdates(_0x23b0ae){return function(_0x9471f5){try{jsonpatch[_0xa5d3('0x2a')](_0x9471f5,_0x23b0ae,!![]);}catch(_0x5da064){return BPromise[_0xa5d3('0x2b')](_0x5da064);}return _0x9471f5['save']();};}function saveUpdates(_0x569db8,_0x586d64){return function(_0xb2411a){if(_0xb2411a){return _0xb2411a['update'](_0x569db8)['then'](function(_0x22b922){return _0x22b922;});}return null;};}function removeEntity(_0x4376c5,_0x796888){return function(_0x49f88f){if(_0x49f88f){return _0x49f88f[_0xa5d3('0x2c')]()[_0xa5d3('0x2d')](function(){var _0xeb4075=_0x49f88f[_0xa5d3('0x2e')]({'plain':!![]});var _0x1db0fd=_0xa5d3('0x2f');return db[_0xa5d3('0x30')][_0xa5d3('0x2c')]({'where':{'type':_0x1db0fd,'resourceId':_0xeb4075['id']}})[_0xa5d3('0x2d')](function(){return _0x49f88f;});})[_0xa5d3('0x2d')](function(){_0x4376c5[_0xa5d3('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419847,_0x10ccf4){return function(_0x5df5af){if(!_0x5df5af){_0x419847[_0xa5d3('0x21')](0x194);}return _0x5df5af;};}function handleError(_0x4de946,_0x6daf35){_0x6daf35=_0x6daf35||0x1f4;return function(_0x4b53d9){logger[_0xa5d3('0x31')](_0x4b53d9[_0xa5d3('0x32')]);if(_0x4b53d9[_0xa5d3('0x33')]){delete _0x4b53d9[_0xa5d3('0x33')];}_0x4de946[_0xa5d3('0x23')](_0x6daf35)[_0xa5d3('0x34')](_0x4b53d9);};}exports[_0xa5d3('0x35')]=function(_0x48a1c8,_0x47db1f){var _0x2387ca={},_0x40b6ec={},_0x3dfe94={'count':0x0,'rows':[]};var _0xc7537=_[_0xa5d3('0x36')](db[_0xa5d3('0x37')][_0xa5d3('0x38')],function(_0x2a36bb){return{'name':_0x2a36bb[_0xa5d3('0x39')],'type':_0x2a36bb['type'][_0xa5d3('0x3a')]};});_0x40b6ec[_0xa5d3('0x3b')]=_[_0xa5d3('0x36')](_0xc7537,_0xa5d3('0x33'));_0x40b6ec[_0xa5d3('0x3c')]=_[_0xa5d3('0x3d')](_0x48a1c8[_0xa5d3('0x3c')]);_0x40b6ec['filters']=_[_0xa5d3('0x3e')](_0x40b6ec['model'],_0x40b6ec[_0xa5d3('0x3c')]);_0x2387ca['attributes']=_[_0xa5d3('0x3e')](_0x40b6ec[_0xa5d3('0x3b')],qs[_0xa5d3('0x3f')](_0x48a1c8['query'][_0xa5d3('0x3f')]));_0x2387ca['attributes']=_0x2387ca[_0xa5d3('0x40')][_0xa5d3('0x41')]?_0x2387ca[_0xa5d3('0x40')]:_0x40b6ec[_0xa5d3('0x3b')];if(!_0x48a1c8['query'][_0xa5d3('0x42')](_0xa5d3('0x43'))){_0x2387ca[_0xa5d3('0x26')]=qs[_0xa5d3('0x26')](_0x48a1c8[_0xa5d3('0x3c')]['limit']);_0x2387ca[_0xa5d3('0x25')]=qs[_0xa5d3('0x25')](_0x48a1c8[_0xa5d3('0x3c')][_0xa5d3('0x25')]);}_0x2387ca['order']=qs[_0xa5d3('0x44')](_0x48a1c8[_0xa5d3('0x3c')][_0xa5d3('0x44')]);_0x2387ca[_0xa5d3('0x45')]=qs[_0xa5d3('0x46')](_[_0xa5d3('0x47')](_0x48a1c8['query'],_0x40b6ec[_0xa5d3('0x46')]),_0xc7537);if(_0x48a1c8[_0xa5d3('0x3c')][_0xa5d3('0x48')]){_0x2387ca['where']=_[_0xa5d3('0x49')](_0x2387ca['where'],{'$or':_[_0xa5d3('0x36')](_0xc7537,function(_0x3582b7){if(_0x3582b7[_0xa5d3('0x4a')]!==_0xa5d3('0x4b')){var _0x220b75={};_0x220b75[_0x3582b7[_0xa5d3('0x33')]]={'$like':'%'+_0x48a1c8[_0xa5d3('0x3c')]['filter']+'%'};return _0x220b75;}})});}_0x2387ca=_[_0xa5d3('0x49')]({},_0x2387ca,_0x48a1c8['options']);var _0x3fa34f={'where':_0x2387ca[_0xa5d3('0x45')]};return db['Plugin'][_0xa5d3('0x28')](_0x3fa34f)[_0xa5d3('0x2d')](function(_0x12ca26){_0x3dfe94['count']=_0x12ca26;if(_0x48a1c8['query'][_0xa5d3('0x4c')]){_0x2387ca['include']=[{'all':!![]}];}return db['Plugin'][_0xa5d3('0x4d')](_0x2387ca);})[_0xa5d3('0x2d')](function(_0x2a5496){_0x3dfe94[_0xa5d3('0x4e')]=_0x2a5496;return _0x3dfe94;})[_0xa5d3('0x2d')](respondWithFilteredResult(_0x47db1f,_0x2387ca))['catch'](handleError(_0x47db1f,null));};exports[_0xa5d3('0x4f')]=function(_0x5bb1e3,_0x1e8b25){var _0x2eab02={'raw':!![],'where':{'id':_0x5bb1e3[_0xa5d3('0x50')]['id']}},_0xfc5bde={};_0xfc5bde[_0xa5d3('0x3b')]=_[_0xa5d3('0x3d')](db[_0xa5d3('0x37')][_0xa5d3('0x38')]);_0xfc5bde[_0xa5d3('0x3c')]=_[_0xa5d3('0x3d')](_0x5bb1e3[_0xa5d3('0x3c')]);_0xfc5bde[_0xa5d3('0x46')]=_[_0xa5d3('0x3e')](_0xfc5bde[_0xa5d3('0x3b')],_0xfc5bde[_0xa5d3('0x3c')]);_0x2eab02[_0xa5d3('0x40')]=_[_0xa5d3('0x3e')](_0xfc5bde[_0xa5d3('0x3b')],qs[_0xa5d3('0x3f')](_0x5bb1e3[_0xa5d3('0x3c')][_0xa5d3('0x3f')]));_0x2eab02['attributes']=_0x2eab02[_0xa5d3('0x40')][_0xa5d3('0x41')]?_0x2eab02[_0xa5d3('0x40')]:_0xfc5bde['model'];if(_0x5bb1e3[_0xa5d3('0x3c')][_0xa5d3('0x4c')]){_0x2eab02[_0xa5d3('0x51')]=[{'all':!![]}];}_0x2eab02=_['merge']({},_0x2eab02,_0x5bb1e3[_0xa5d3('0x52')]);return db[_0xa5d3('0x37')]['find'](_0x2eab02)['then'](handleEntityNotFound(_0x1e8b25,null))['then'](respondWithResult(_0x1e8b25,null))['catch'](handleError(_0x1e8b25,null));};exports[_0xa5d3('0x53')]=function(_0xae4de0,_0x485daf,_0x5b6e58){return db[_0xa5d3('0x37')]['find']({'where':{'id':_0xae4de0[_0xa5d3('0x50')]['id']},'attributes':[_0xa5d3('0x33'),_0xa5d3('0x7')],'raw':!![]})[_0xa5d3('0x2d')](handleEntityNotFound(_0x485daf,null))[_0xa5d3('0x2d')](function(_0x60fae){if(_0x60fae){var _0x4909ad=path[_0xa5d3('0x54')](config[_0xa5d3('0x55')],_0xa5d3('0x56'),util[_0xa5d3('0x57')](_0xa5d3('0x58'),path[_0xa5d3('0x59')](_0x60fae['path'])));var _0x464013=fs[_0xa5d3('0x5a')](_0x4909ad);var _0x4fdd53=archiver(_0xa5d3('0x5b'),{'zlib':{'level':0x9}});_0x4fdd53['on'](_0xa5d3('0x5c'),function(_0x337e5a){if(_0x337e5a['code']==='ENOENT'){logger[_0xa5d3('0x31')](_0x337e5a);}else{throw new db[(_0xa5d3('0x5d'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4fdd53['on'](_0xa5d3('0x31'),function(_0x2eaa21){throw new db[(_0xa5d3('0x5d'))][(_0xa5d3('0x5e'))](_0xa5d3('0x5f'));});_0x4fdd53[_0xa5d3('0x60')](_0x464013);_0x4fdd53[_0xa5d3('0x61')]('**/*',{'cwd':path[_0xa5d3('0x54')](config['root'],_0xa5d3('0x56'),path[_0xa5d3('0x62')](_0x60fae['path'])),'ignore':[path[_0xa5d3('0x54')](path[_0xa5d3('0x59')](_0x60fae[_0xa5d3('0x7')]),_0xa5d3('0x63')),path[_0xa5d3('0x54')](path[_0xa5d3('0x59')](_0x60fae[_0xa5d3('0x7')]),_0xa5d3('0x64'))],'nodir':!![]})[_0xa5d3('0x65')]();_0x464013['on'](_0xa5d3('0x66'),function(){if(!fs['existsSync'](_0x4909ad)){throw new db[(_0xa5d3('0x5d'))][(_0xa5d3('0x5e'))]('Plugin\x20not\x20found');}return _0x485daf[_0xa5d3('0x53')](_0x4909ad,util[_0xa5d3('0x57')]('%s.zip',path['basename'](_0x60fae[_0xa5d3('0x7')])),function(_0x10b4e9){if(_0x10b4e9){throw new db[(_0xa5d3('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xa5d3('0x67')](_0x4909ad);logger[_0xa5d3('0x68')](_0xa5d3('0x69'));logger[_0xa5d3('0x68')](_0xa5d3('0x6a'));});});}return null;})[_0xa5d3('0x6b')](handleError(_0x485daf,null));};exports[_0xa5d3('0x6c')]=function(_0x421e58,_0x31d8b0,_0x5c67d9){var _0x29f581=path[_0xa5d3('0x59')](_0x421e58['file'][_0xa5d3('0x6d')],path['extname'](_0x421e58[_0xa5d3('0x6e')][_0xa5d3('0x6d')]));var _0x4a9359=path['join'](config[_0xa5d3('0x55')],'server/files/plugins',_0x421e58[_0xa5d3('0x6e')][_0xa5d3('0x6d')]);var _0x449da6=path[_0xa5d3('0x54')](config['root'],_0xa5d3('0x56'),_0x29f581);logger[_0xa5d3('0x68')](_0xa5d3('0x6f'),_0x4a9359);logger[_0xa5d3('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x449da6);try{fs['chmodSync'](_0x4a9359,parseInt(_0xa5d3('0x70'),0x8));extract(_0x4a9359,{'dir':_0x449da6},function(_0x3813b1){if(_0x3813b1){logger[_0xa5d3('0x31')](_0x3813b1);handleError(_0x3813b1,!![]);};var _0x200a6b=fs[_0xa5d3('0x71')](_0x449da6);if(_0x200a6b[_0xa5d3('0x41')]>0x1){removeReferences(_0x4a9359,_0x449da6);logger[_0xa5d3('0x31')](_0xa5d3('0x72'));return _0x5c67d9(new Error(_0xa5d3('0x72')));}var _0x362024=fs[_0xa5d3('0x73')](path[_0xa5d3('0x54')](_0x449da6,_0x200a6b[0x0]));if(_0x362024[_0xa5d3('0x74')]()){removeReferences(_0x4a9359,_0x449da6);logger[_0xa5d3('0x31')](_0xa5d3('0x72'));return _0x5c67d9(new Error(_0xa5d3('0x72')));}if(_0x362024['isDirectory']()){var _0x194ffb=fs['readdirSync'](path[_0xa5d3('0x54')](_0x449da6,_0x200a6b[0x0]));if(_0x194ffb[_0xa5d3('0x41')]===0x0){removeReferences(_0x4a9359,_0x449da6);logger[_0xa5d3('0x31')](_0xa5d3('0x72'));return _0x5c67d9(new Error('Invalid\x20plugin\x20structure'));}var _0x38a9fe=_0x194ffb[_0xa5d3('0x75')](function(_0x1954e0){return _0x1954e0==='manifest.json';});if(!_0x38a9fe){return _0x5c67d9(new Error(_0xa5d3('0x76')));}var _0x2c722c=fs['readFileSync'](path[_0xa5d3('0x54')](_0x449da6,_0x200a6b[0x0],_0xa5d3('0x77')));var _0x5507a8=JSON[_0xa5d3('0x78')](_0x2c722c);if('undefined'==typeof _0x5507a8[_0xa5d3('0x33')]){return _0x5c67d9(new Error(_0xa5d3('0x79')));}if(_0xa5d3('0x27')==typeof _0x5507a8[_0xa5d3('0x4a')]){return _0x5c67d9(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x5507a8['version']){return _0x5c67d9(new Error(_0xa5d3('0x7a')));}if('undefined'==typeof _0x5507a8[_0xa5d3('0x7b')]){return _0x5c67d9(new Error(_0xa5d3('0x7c')));}if(_0x5507a8[_0xa5d3('0x4a')]===_0xa5d3('0x7d')){if(_0xa5d3('0x27')==typeof _0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')]){return _0x5c67d9(new Error(_0xa5d3('0x7f')));}if(_0xa5d3('0x27')==typeof _0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')]['admin']&&_0xa5d3('0x27')==typeof _0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')][_0xa5d3('0x80')]){return _0x5c67d9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5507a8[_0xa5d3('0x4a')]===_0xa5d3('0x81')){if(_0xa5d3('0x27')==typeof _0x5507a8['parameters'][_0xa5d3('0x82')]){return _0x5c67d9(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xa5d3('0x27')==typeof _0x5507a8['parameters'][_0xa5d3('0x83')]){return _0x5c67d9(new Error(_0xa5d3('0x84')));}}else{return _0x5c67d9(new Error(_0xa5d3('0x85')));}var _0x4438dd=_0x5507a8[_0xa5d3('0x33')];var _0x2a47c1=_0x5507a8['description'];var _0x5dcb95=_0x5507a8[_0xa5d3('0x4a')];var _0x30429b=_0x5507a8[_0xa5d3('0x86')]?_0x5507a8['sidebar']:'always';var _0x525fc8=_0x5507a8['icon']?_0x5507a8['icon']:_0xa5d3('0x87');var _0x43477d='';var _0x5a46c7='';var _0x2ddc2e='';var _0x3c8bae='';var _0x5130a0=_0x5507a8[_0xa5d3('0x88')];if(_0x5dcb95==='html'){if(_0xa5d3('0x27')!=typeof _0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')][_0xa5d3('0x89')]){var _0x5628a9=_0x5507a8[_0xa5d3('0x7b')]['views'][_0xa5d3('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xa5d3('0x8a')](_0x5628a9)){_0x43477d=path[_0xa5d3('0x54')](_0xa5d3('0x8b'),_0x29f581,_0x200a6b[0x0],_0x5628a9);}else{_0x43477d=_0x5628a9;}}else{logger['info'](_0xa5d3('0x8c'));}if(_0xa5d3('0x27')!=typeof _0x5507a8['parameters'][_0xa5d3('0x7e')]['agent']){var _0x596513=_0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')][_0xa5d3('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa5d3('0x8a')](_0x596513)){_0x5a46c7=path[_0xa5d3('0x54')](_0xa5d3('0x8b'),_0x29f581,_0x200a6b[0x0],_0x596513);}else{_0x5a46c7=_0x596513;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5dcb95===_0xa5d3('0x81')){_0x2ddc2e=_0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x82')];_0x3c8bae=_0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x83')];if(_0xa5d3('0x27')!=typeof _0x5507a8['parameters'][_0xa5d3('0x7e')]){if('undefined'!=typeof _0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')]['admin']){var _0x5628a9=_0x5507a8[_0xa5d3('0x7b')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa5d3('0x8a')](_0x5628a9)){_0x43477d=path[_0xa5d3('0x54')](_0xa5d3('0x8b'),_0x29f581,_0x200a6b[0x0],_0x5628a9);}else{_0x43477d=_0x5628a9;}}if(_0xa5d3('0x27')!=typeof _0x5507a8[_0xa5d3('0x7b')]['views'][_0xa5d3('0x80')]){var _0x596513=_0x5507a8[_0xa5d3('0x7b')][_0xa5d3('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa5d3('0x8a')](_0x596513)){_0x5a46c7=path[_0xa5d3('0x54')]('plugins',_0x29f581,_0x200a6b[0x0],_0x596513);}else{_0x5a46c7=_0x596513;}}}}var _0x40c66e={'name':_0x4438dd,'description':_0x2a47c1,'path':path[_0xa5d3('0x54')](_0x29f581,_0x200a6b[0x0]),'type':_0x5dcb95,'sidebar':_0x30429b,'icon':_0x525fc8,'adminUrl':_0x43477d,'agentUrl':_0x5a46c7,'scriptName':_0x2ddc2e,'scriptPath':_0x3c8bae,'version':_0x5130a0};removeReferences(_0x4a9359,null);return db[_0xa5d3('0x37')][_0xa5d3('0x8d')](_0x40c66e)[_0xa5d3('0x2d')](function(_0x27b542){var _0x229017={'role':_0x421e58[_0xa5d3('0x8e')][_0xa5d3('0x8f')],'userProfileId':_0x421e58[_0xa5d3('0x8e')][_0xa5d3('0x90')]};if(!_0x229017)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x229017[_0xa5d3('0x8f')]==='user'){var _0x4a42dc=_0x27b542[_0xa5d3('0x2e')]({'plain':!![]});return db[_0xa5d3('0x91')][_0xa5d3('0x92')]({'where':{'name':_0xa5d3('0x2f'),'userProfileId':_0x229017[_0xa5d3('0x90')]},'raw':!![]})['then'](function(_0x2d0b57){if(_0x2d0b57&&_0x2d0b57[_0xa5d3('0x93')]===0x0){return db[_0xa5d3('0x30')][_0xa5d3('0x8d')]({'name':_0x4a42dc[_0xa5d3('0x33')],'resourceId':_0x4a42dc['id'],'type':_0x2d0b57[_0xa5d3('0x33')],'sectionId':_0x2d0b57['id']},{})['then'](function(){return _0x27b542;});}else{return _0x27b542;}})[_0xa5d3('0x6b')](function(_0x2d4608){logger[_0xa5d3('0x31')](_0xa5d3('0x94'),_0x2d4608);throw _0x2d4608;});}return _0x27b542;})['then'](respondWithResult(_0x31d8b0,null))['catch'](handleError(_0x31d8b0,null));}});}catch(_0x36db3f){_0x31d8b0['status'](0x1f4)[_0xa5d3('0x34')](_0x36db3f);}};function removeReferences(_0x462795,_0x28adba){try{if(_0x462795){fs[_0xa5d3('0x67')](_0x462795);logger['info'](_0xa5d3('0x95'));}if(_0x28adba){rimraf(_0x28adba,function(){});logger[_0xa5d3('0x68')](_0xa5d3('0x96'));}}catch(_0x1fa2c6){logger[_0xa5d3('0x31')](_0x1fa2c6);}}exports[_0xa5d3('0x97')]=function(_0x4d8bcc,_0x581e9a,_0x21b279){return db[_0xa5d3('0x37')]['find']({'where':{'id':_0x4d8bcc[_0xa5d3('0x50')]['id']}})[_0xa5d3('0x2d')](handleEntityNotFound(_0x581e9a,null))[_0xa5d3('0x2d')](saveUpdates(_0x4d8bcc[_0xa5d3('0x8e')],null))[_0xa5d3('0x2d')](respondWithResult(_0x581e9a,null))[_0xa5d3('0x6b')](handleError(_0x581e9a,null));};exports[_0xa5d3('0x98')]=function(_0x158537,_0x95df0f,_0x43afbf){return db['Plugin'][_0xa5d3('0x92')]({'where':{'id':_0x158537[_0xa5d3('0x50')]['id']}})[_0xa5d3('0x2d')](function(_0x13625b){if(_0x13625b){return _0x13625b['destroy']();}})[_0xa5d3('0x2d')](function(_0x286277){rimraf(path[_0xa5d3('0x54')](config[_0xa5d3('0x55')],'server/files/plugins',path[_0xa5d3('0x62')](_0x286277[_0xa5d3('0x7')])),function(){});return _0x286277;})[_0xa5d3('0x2d')](handleEntityNotFound(_0x95df0f,null))[_0xa5d3('0x2d')](respondWithStatusCode(_0x95df0f,null))[_0xa5d3('0x6b')](handleError(_0x95df0f,null));};exports[_0xa5d3('0x99')]=function(_0x17fb22,_0x2fed80,_0x1922ce){return BPromise['resolve']()[_0xa5d3('0x2d')](function(){if(!_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x7')]){throw new Error(_0xa5d3('0x9a'));}if(!_0x17fb22[_0xa5d3('0x3c')]['port']){throw new Error(_0xa5d3('0x9b'));}var _0x6cf8fc=_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x9c')]?_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x9c')]+':'+_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x9d')]:_0xa5d3('0x9e')+_0x17fb22['query'][_0xa5d3('0x9d')];var _0x34ceaf=_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x24')]?_0x17fb22['query'][_0xa5d3('0x24')]:!![];var _0x37dabc=_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x9f')]?_0x17fb22[_0xa5d3('0x3c')]['encoding']:null;var _0x4e4914={'method':_0x17fb22['method'],'uri':util[_0xa5d3('0x57')]('%s%s',_0x6cf8fc,_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x7')]),'json':_0x34ceaf,'resolveWithFullResponse':!![],'encoding':_0x37dabc,'qs':_0x17fb22['query']};if(_0x17fb22[_0xa5d3('0xa0')]){_0x4e4914[_0xa5d3('0xa0')]=_0x17fb22['headers'];if(_0x4e4914[_0xa5d3('0xa0')][_0xa5d3('0xa1')]){delete _0x4e4914[_0xa5d3('0xa0')][_0xa5d3('0xa1')];}}if(_0x4e4914['headers'][_0xa5d3('0xa2')]){delete _0x4e4914['headers']['content-type'];}return rp(_0x4e4914);})[_0xa5d3('0x2d')](function(_0x4e19c6){if(_0x4e19c6){_0x2fed80['set'](_0x4e19c6[_0xa5d3('0xa0')]);logger[_0xa5d3('0x68')](_0x4e19c6['body']);if(_[_0xa5d3('0xa3')](_0x17fb22[_0xa5d3('0x3c')][_0xa5d3('0x7')],_0xa5d3('0x53'))&&_0x4e19c6[_0xa5d3('0xa4')]==0x1f4){return _0x2fed80[_0xa5d3('0x21')](_0x4e19c6['statusCode']);}else{return _0x2fed80['status'](_0x4e19c6[_0xa5d3('0xa4')])['send'](_0x4e19c6[_0xa5d3('0x8e')]);}}else{return _0x2fed80[_0xa5d3('0x21')](0xc8);}})['catch'](handleError(_0x2fed80,null));};exports[_0xa5d3('0xa5')]=function(_0x4ed358,_0x481f34,_0x49c787){return BPromise[_0xa5d3('0xa6')]()[_0xa5d3('0x2d')](function(){if(!_0x4ed358['query'][_0xa5d3('0x7')]){throw new Error(_0xa5d3('0x9a'));}if(!_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x9d')]){throw new Error(_0xa5d3('0x9b'));}var _0x2fa7f2=_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x9c')]?_0x4ed358[_0xa5d3('0x3c')]['hostname']+':'+_0x4ed358['query'][_0xa5d3('0x9d')]:_0xa5d3('0x9e')+_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x9d')];var _0x4ee889=_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x24')]?_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x24')]:!![];var _0x235f21=_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x9f')]?_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x9f')]:null;var _0x1554b3={'method':_0x4ed358[_0xa5d3('0xa7')],'uri':util[_0xa5d3('0x57')](_0xa5d3('0xa8'),_0x2fa7f2,_0x4ed358[_0xa5d3('0x3c')][_0xa5d3('0x7')]),'json':_0x4ee889,'resolveWithFullResponse':!![],'encoding':_0x235f21,'body':_0x4ed358[_0xa5d3('0x8e')]};if(_0x4ed358[_0xa5d3('0xa0')]){_0x1554b3['headers']=_0x4ed358[_0xa5d3('0xa0')];if(_0x1554b3[_0xa5d3('0xa0')][_0xa5d3('0xa1')]){delete _0x1554b3[_0xa5d3('0xa0')]['content-length'];}}if(_0x1554b3[_0xa5d3('0xa0')][_0xa5d3('0xa2')]){delete _0x1554b3[_0xa5d3('0xa0')][_0xa5d3('0xa2')];}return rp(_0x1554b3);})[_0xa5d3('0x2d')](function(_0x53a2a5){if(_0x53a2a5){_0x481f34['set'](_0x53a2a5[_0xa5d3('0xa0')]);logger[_0xa5d3('0x68')](_0x53a2a5[_0xa5d3('0x8e')]);return _0x481f34[_0xa5d3('0x23')](_0x53a2a5['statusCode'])[_0xa5d3('0x34')](_0x53a2a5[_0xa5d3('0x8e')]);}else{return _0x481f34[_0xa5d3('0x21')](0xc8);}})[_0xa5d3('0x6b')](handleError(_0x481f34,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1b91c6e..c2f5462 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 _0x36b2=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x3314a3,_0x712212){var _0xc5d6a4=function(_0x34cac2){while(--_0x34cac2){_0x3314a3['push'](_0x3314a3['shift']());}};_0xc5d6a4(++_0x712212);}(_0x36b2,0x6b));var _0x236b=function(_0x330755,_0x2e6750){_0x330755=_0x330755-0x0;var _0x284477=_0x36b2[_0x330755];return _0x284477;};'use strict';var EventEmitter=require(_0x236b('0x0'));var Plugin=require(_0x236b('0x1'))['db'][_0x236b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x236b('0x3'),'afterUpdate':_0x236b('0x4'),'afterDestroy':_0x236b('0x5')};function emitEvent(_0x55cbf4){return function(_0x1dc22b,_0x1a135b,_0x5817da){PluginEvents[_0x236b('0x6')](_0x55cbf4+':'+_0x1dc22b['id'],_0x1dc22b);PluginEvents[_0x236b('0x6')](_0x55cbf4,_0x1dc22b);_0x5817da(null);};}for(var e in events){if(events[_0x236b('0x7')](e)){var event=events[e];Plugin[_0x236b('0x8')](e,emitEvent(event));}}module[_0x236b('0x9')]=PluginEvents; \ No newline at end of file +var _0x2709=['exports','events','Plugin','setMaxListeners','update','emit','hook'];(function(_0x225f7c,_0x399094){var _0x6e0c53=function(_0x22110f){while(--_0x22110f){_0x225f7c['push'](_0x225f7c['shift']());}};_0x6e0c53(++_0x399094);}(_0x2709,0x189));var _0x9270=function(_0x1da12d,_0x483c69){_0x1da12d=_0x1da12d-0x0;var _0x1d1064=_0x2709[_0x1da12d];return _0x1d1064;};'use strict';var EventEmitter=require(_0x9270('0x0'));var Plugin=require('../../mysqldb')['db'][_0x9270('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9270('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9270('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd5780b){return function(_0x26bdf5,_0x326c2a,_0x2c09b6){PluginEvents[_0x9270('0x4')](_0xd5780b+':'+_0x26bdf5['id'],_0x26bdf5);PluginEvents[_0x9270('0x4')](_0xd5780b,_0x26bdf5);_0x2c09b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x9270('0x5')](e,emitEvent(event));}}module[_0x9270('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 8c610a2..8d30b0b 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 _0x32b6=['util','../../config/logger','bluebird','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0xc6879,_0x84a966){var _0x54f7a4=function(_0x4e63eb){while(--_0x4e63eb){_0xc6879['push'](_0xc6879['shift']());}};_0x54f7a4(++_0x84a966);}(_0x32b6,0x18b));var _0x632b=function(_0x5085a2,_0x38a7e5){_0x5085a2=_0x5085a2-0x0;var _0x108af0=_0x32b6[_0x5085a2];return _0x108af0;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require(_0x632b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x632b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require('../../config/environment');var attributes=require(_0x632b('0x6'));module[_0x632b('0x7')]=function(_0x40ad56,_0x2453e4){return _0x40ad56[_0x632b('0x8')](_0x632b('0x9'),attributes,{'tableName':_0x632b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e04=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','../../config/logger','bluebird','request-promise'];(function(_0x11819a,_0x38b06e){var _0x3682f8=function(_0x314b42){while(--_0x314b42){_0x11819a['push'](_0x11819a['shift']());}};_0x3682f8(++_0x38b06e);}(_0x0e04,0x18d));var _0x40e0=function(_0x9d2135,_0x3af98d){_0x9d2135=_0x9d2135-0x0;var _0x462e66=_0x0e04[_0x9d2135];return _0x462e66;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40e0('0x0'))('api');var moment=require('moment');var BPromise=require(_0x40e0('0x1'));var rp=require(_0x40e0('0x2'));var fs=require('fs');var path=require(_0x40e0('0x3'));var rimraf=require(_0x40e0('0x4'));var config=require(_0x40e0('0x5'));var attributes=require(_0x40e0('0x6'));module[_0x40e0('0x7')]=function(_0x36eec9,_0x1b8f60){return _0x36eec9[_0x40e0('0x8')]('Plugin',attributes,{'tableName':_0x40e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index e11e231..7a850d1 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 _0x612a=['client','http','defaults','redis','socket.io-emitter','register','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin','create','options','raw','then','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x5466e0,_0x586206){var _0xf32c89=function(_0x68e0e9){while(--_0x68e0e9){_0x5466e0['push'](_0x5466e0['shift']());}};_0xf32c89(++_0x586206);}(_0x612a,0x12c));var _0xa612=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x612a[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var moment=require(_0xa612('0x2'));var BPromise=require(_0xa612('0x3'));var rs=require(_0xa612('0x4'));var fs=require('fs');var Redis=require(_0xa612('0x5'));var db=require(_0xa612('0x6'))['db'];var utils=require(_0xa612('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa612('0x8'));var jayson=require(_0xa612('0x9'));var client=jayson[_0xa612('0xa')][_0xa612('0xb')]({'port':0x232a});config['redis']=_[_0xa612('0xc')](config[_0xa612('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa612('0xe'))(new Redis(config['redis']));require('./plugin.socket')[_0xa612('0xf')](socket);function respondWithRpcPromise(_0x1474b7,_0x2a2b55,_0x3085c5){return new BPromise(function(_0x25f5ef,_0x5530b1){return client['request'](_0x1474b7,_0x3085c5)['then'](function(_0x336399){logger['info']('Plugin,\x20%s,\x20%s',_0x2a2b55,_0xa612('0x10'));logger['debug'](_0xa612('0x11'),_0x2a2b55,'request\x20sent',JSON[_0xa612('0x12')](_0x336399));if(_0x336399[_0xa612('0x13')]){if(_0x336399[_0xa612('0x13')][_0xa612('0x14')]===0x1f4){logger[_0xa612('0x13')](_0xa612('0x15'),_0x2a2b55,_0x336399['error'][_0xa612('0x16')]);return _0x5530b1(_0x336399['error'][_0xa612('0x16')]);}logger[_0xa612('0x13')](_0xa612('0x15'),_0x2a2b55,_0x336399[_0xa612('0x13')][_0xa612('0x16')]);return _0x25f5ef(_0x336399['error'][_0xa612('0x16')]);}else{logger['info'](_0xa612('0x15'),_0x2a2b55,_0xa612('0x10'));_0x25f5ef(_0x336399['result'][_0xa612('0x16')]);}})[_0xa612('0x17')](function(_0x4b427d){logger[_0xa612('0x13')](_0xa612('0x15'),_0x2a2b55,_0x4b427d);_0x5530b1(_0x4b427d);});});}exports[_0xa612('0x18')]=function(_0x2d9e23){var _0x3c94eb=this;return new Promise(function(_0x3ced46,_0x22eb8a){return db[_0xa612('0x19')][_0xa612('0x1a')](_0x2d9e23['body'],{'raw':_0x2d9e23[_0xa612('0x1b')]?_0x2d9e23[_0xa612('0x1b')][_0xa612('0x1c')]===undefined?!![]:![]:!![]})[_0xa612('0x1d')](function(_0x62fb50){logger[_0xa612('0x1e')](_0xa612('0x18'),_0x2d9e23);logger['debug'](_0xa612('0x18'),_0x2d9e23,JSON[_0xa612('0x12')](_0x62fb50));_0x3ced46(_0x62fb50);})[_0xa612('0x17')](function(_0x2f1f0a){logger['error'](_0xa612('0x18'),_0x2f1f0a[_0xa612('0x16')],_0x2d9e23);_0x22eb8a(_0x3c94eb[_0xa612('0x13')](0x1f4,_0x2f1f0a[_0xa612('0x16')]));});});}; \ No newline at end of file +var _0xe916=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','raw','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2aa4d6,_0x29741c){var _0x4e6b48=function(_0x5b58f9){while(--_0x5b58f9){_0x2aa4d6['push'](_0x2aa4d6['shift']());}};_0x4e6b48(++_0x29741c);}(_0xe916,0x91));var _0x6e91=function(_0x59db66,_0x3b27cb){_0x59db66=_0x59db66-0x0;var _0xbbed53=_0xe916[_0x59db66];return _0xbbed53;};'use strict';var _=require(_0x6e91('0x0'));var util=require(_0x6e91('0x1'));var moment=require(_0x6e91('0x2'));var BPromise=require(_0x6e91('0x3'));var rs=require(_0x6e91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e91('0x5'))['db'];var utils=require(_0x6e91('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e91('0x7'));var jayson=require(_0x6e91('0x8'));var client=jayson[_0x6e91('0x9')][_0x6e91('0xa')]({'port':0x232a});config[_0x6e91('0xb')]=_[_0x6e91('0xc')](config[_0x6e91('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e91('0xb')]));require(_0x6e91('0xd'))[_0x6e91('0xe')](socket);function respondWithRpcPromise(_0x21220e,_0x410b6f,_0x511d6e){return new BPromise(function(_0x1206ff,_0x3fa673){return client[_0x6e91('0xf')](_0x21220e,_0x511d6e)[_0x6e91('0x10')](function(_0x16cc37){logger['info'](_0x6e91('0x11'),_0x410b6f,_0x6e91('0x12'));logger[_0x6e91('0x13')](_0x6e91('0x14'),_0x410b6f,_0x6e91('0x12'),JSON[_0x6e91('0x15')](_0x16cc37));if(_0x16cc37[_0x6e91('0x16')]){if(_0x16cc37['error'][_0x6e91('0x17')]===0x1f4){logger[_0x6e91('0x16')]('Plugin,\x20%s,\x20%s',_0x410b6f,_0x16cc37['error'][_0x6e91('0x18')]);return _0x3fa673(_0x16cc37[_0x6e91('0x16')]['message']);}logger['error'](_0x6e91('0x11'),_0x410b6f,_0x16cc37[_0x6e91('0x16')][_0x6e91('0x18')]);return _0x1206ff(_0x16cc37[_0x6e91('0x16')]['message']);}else{logger['info'](_0x6e91('0x11'),_0x410b6f,_0x6e91('0x12'));_0x1206ff(_0x16cc37[_0x6e91('0x19')][_0x6e91('0x18')]);}})[_0x6e91('0x1a')](function(_0x559c8e){logger[_0x6e91('0x16')]('Plugin,\x20%s,\x20%s',_0x410b6f,_0x559c8e);_0x3fa673(_0x559c8e);});});}exports[_0x6e91('0x1b')]=function(_0x3dc89f){var _0x1761b2=this;return new Promise(function(_0x456ec3,_0x4a8f2b){return db[_0x6e91('0x1c')][_0x6e91('0x1d')](_0x3dc89f[_0x6e91('0x1e')],{'raw':_0x3dc89f['options']?_0x3dc89f['options'][_0x6e91('0x1f')]===undefined?!![]:![]:!![]})[_0x6e91('0x10')](function(_0x319186){logger[_0x6e91('0x20')]('CreatePlugin',_0x3dc89f);logger['debug']('CreatePlugin',_0x3dc89f,JSON[_0x6e91('0x15')](_0x319186));_0x456ec3(_0x319186);})[_0x6e91('0x1a')](function(_0x139dbd){logger[_0x6e91('0x16')](_0x6e91('0x1b'),_0x139dbd[_0x6e91('0x18')],_0x3dc89f);_0x4a8f2b(_0x1761b2[_0x6e91('0x16')](0x1f4,_0x139dbd[_0x6e91('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 54b451f..94c5bc5 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 _0x0b9e=['register','length','./plugin.events','save','remove','emit','removeListener'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x0b9e,0xb1));var _0xe0b9=function(_0x6c633a,_0x306c87){_0x6c633a=_0x6c633a-0x0;var _0x249efc=_0x0b9e[_0x6c633a];return _0x249efc;};'use strict';var PluginEvents=require(_0xe0b9('0x0'));var events=[_0xe0b9('0x1'),_0xe0b9('0x2'),'update'];function createListener(_0x19a554,_0x17d2a6){return function(_0x14a6bf){_0x17d2a6[_0xe0b9('0x3')](_0x19a554,_0x14a6bf);};}function removeListener(_0x562641,_0x2e4ec9){return function(){PluginEvents[_0xe0b9('0x4')](_0x562641,_0x2e4ec9);};}exports[_0xe0b9('0x5')]=function(_0x56c12f){for(var _0x34e4c2=0x0,_0x3fd35c=events[_0xe0b9('0x6')];_0x34e4c2<_0x3fd35c;_0x34e4c2++){var _0x2e91bd=events[_0x34e4c2];var _0x34125c=createListener('plugin:'+_0x2e91bd,_0x56c12f);PluginEvents['on'](_0x2e91bd,_0x34125c);}}; \ No newline at end of file +var _0xa73b=['emit','register','plugin:','./plugin.events','save','remove'];(function(_0x26cfa8,_0x3f65a0){var _0x120ff3=function(_0x5655af){while(--_0x5655af){_0x26cfa8['push'](_0x26cfa8['shift']());}};_0x120ff3(++_0x3f65a0);}(_0xa73b,0x177));var _0xba73=function(_0x44ddf0,_0x1a47bb){_0x44ddf0=_0x44ddf0-0x0;var _0x6f70c9=_0xa73b[_0x44ddf0];return _0x6f70c9;};'use strict';var PluginEvents=require(_0xba73('0x0'));var events=[_0xba73('0x1'),_0xba73('0x2'),'update'];function createListener(_0x484f8e,_0x563beb){return function(_0x232498){_0x563beb[_0xba73('0x3')](_0x484f8e,_0x232498);};}function removeListener(_0x2b3ba3,_0x33020f){return function(){PluginEvents['removeListener'](_0x2b3ba3,_0x33020f);};}exports[_0xba73('0x4')]=function(_0x11a913){for(var _0x5a0bd7=0x0,_0x5aaa1b=events['length'];_0x5a0bd7<_0x5aaa1b;_0x5a0bd7++){var _0x8c6a84=events[_0x5a0bd7];var _0x1ac71a=createListener(_0xba73('0x5')+_0x8c6a84,_0x11a913);PluginEvents['on'](_0x8c6a84,_0x1ac71a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4d85109..1604a7f 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(_0x203016,_0x76cc10){var _0x435c90=function(_0x41a801){while(--_0x41a801){_0x203016['push'](_0x203016['shift']());}};_0x435c90(++_0x76cc10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x373b02,_0x3e1551){var _0x430eb5=function(_0x8796db){while(--_0x8796db){_0x373b02['push'](_0x373b02['shift']());}};_0x430eb5(++_0x3e1551);}(_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 e5b991f..ca444b3 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 _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xaa88,0x137));var _0x8aa8=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xaa88[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file +var _0xd64b=['dump','send','Missing\x20name\x20and/or\x20path','update','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','bluebird','status','json','name','npm\x20install','info','error','index','list','then','express','motion2','show','describe','params','catch','body','script','join','../../files/plugins','cwd','chdir','dirname','start'];(function(_0x41fe6d,_0x202057){var _0x3d4db4=function(_0x22d553){while(--_0x22d553){_0x41fe6d['push'](_0x41fe6d['shift']());}};_0x3d4db4(++_0x202057);}(_0xd64b,0xc1));var _0xbd64=function(_0x4c836d,_0x144891){_0x4c836d=_0x4c836d-0x0;var _0x299319=_0xd64b[_0x4c836d];return _0x299319;};'use strict';var _=require(_0xbd64('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbd64('0x1'))('api');var path=require(_0xbd64('0x2'));var exec=require(_0xbd64('0x3'))[_0xbd64('0x4')];var BPromise=require(_0xbd64('0x5'));function handleEntityNotFound(_0x30fe29,_0x5458d8){return function(_0x5446e4){if(!_0x5446e4){_0x30fe29['sendStatus'](0x194);;}return _0x5446e4;};}function respondWithResult(_0x51e87d,_0x58e9e7){_0x58e9e7=_0x58e9e7||0xc8;return function(_0x32995f){if(_0x32995f){return _0x51e87d[_0xbd64('0x6')](_0x58e9e7)[_0xbd64('0x7')](_0x32995f);}return null;};}function handleError(_0x3f1f17,_0x2b8543){_0x2b8543=_0x2b8543||0x1f4;return function(_0x197a84){logger['error'](_0x197a84['stack']);if(_0x197a84[_0xbd64('0x8')]){delete _0x197a84[_0xbd64('0x8')];}_0x3f1f17[_0xbd64('0x6')](_0x2b8543)['send'](_0x197a84);};}function execChildProcess(){return new BPromise(function(_0xc80599,_0x3f908a){exec(_0xbd64('0x9'),function(_0x18bde8,_0x593c79,_0x431b29){logger['info'](_0x593c79);logger[_0xbd64('0xa')](_0x431b29);if(_0x18bde8){logger[_0xbd64('0xb')](_0x18bde8);return _0x3f908a(_0x18bde8);}return _0xc80599(_0x593c79);});});}exports[_0xbd64('0xc')]=function(_0x2183e2,_0x367824){return pm2[_0xbd64('0xd')]()[_0xbd64('0xe')](function(_0x269e2f){if(_0x269e2f){var _0x2b5808=_['reject'](_0x269e2f,function(_0x2d1159){return _0x2d1159[_0xbd64('0x8')]===_0xbd64('0xf')||_0x2d1159[_0xbd64('0x8')]===_0xbd64('0x10');});return{'rows':_0x2b5808,'count':_0x2b5808['length']};}return null;})[_0xbd64('0xe')](respondWithResult(_0x367824,null))['catch'](handleError(_0x367824,null));};exports[_0xbd64('0x11')]=function(_0x1432a6,_0x3aef70){return pm2[_0xbd64('0x12')](_0x1432a6[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x3aef70,null))[_0xbd64('0xe')](handleEntityNotFound(_0x3aef70,null))[_0xbd64('0x14')](handleError(_0x3aef70,null));};exports['create']=function(_0x305545,_0x1f618b){if(_0x305545['body']['name']&&_0x305545[_0xbd64('0x15')][_0xbd64('0x16')]){var _0x196d21=path[_0xbd64('0x17')](__dirname,_0xbd64('0x18'),_0x305545[_0xbd64('0x15')]['script']);var _0x4d4a16=process[_0xbd64('0x19')]();process[_0xbd64('0x1a')](path[_0xbd64('0x1b')](_0x196d21));return execChildProcess()[_0xbd64('0xe')](function(_0x55e74c){process['chdir'](_0x4d4a16);return pm2[_0xbd64('0x1c')]({'name':_0x305545['body'][_0xbd64('0x8')],'script':_0x196d21});})['then'](function(_0x33452d){pm2[_0xbd64('0x1d')]();return _0x33452d[0x0];})[_0xbd64('0xe')](respondWithResult(_0x1f618b,0xc9))[_0xbd64('0x14')](handleError(_0x1f618b,null));}else{return _0x1f618b['status'](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x1f')});}};exports[_0xbd64('0x20')]=function(_0x2a44d0,_0x4d1563){if(_0x2a44d0['body']['id']){delete _0x2a44d0[_0xbd64('0x15')]['id'];}var _0x49eac5={'online':'restart','stopped':_0xbd64('0x21')};if(_0x49eac5['hasOwnProperty'](_0x2a44d0[_0xbd64('0x15')]['status'])){return pm2[_0x49eac5[_0x2a44d0[_0xbd64('0x15')]['status']]](_0x2a44d0[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x4d1563,0xc8))[_0xbd64('0x14')](handleError(_0x4d1563,null));}else{return _0x4d1563[_0xbd64('0x6')](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x22')});}};exports['destroy']=function(_0x35bdd5,_0xe876c9){if(_0x35bdd5[_0xbd64('0x15')]['id']){delete _0x35bdd5[_0xbd64('0x15')]['id'];}if(_0x35bdd5[_0xbd64('0x13')]['id']){return pm2[_0xbd64('0x23')](_0x35bdd5['params']['id'])['then'](function(_0x1e4593){pm2['dump']();return _0x1e4593[0x0];})[_0xbd64('0xe')](respondWithResult(_0xe876c9,null))[_0xbd64('0x14')](handleError(_0xe876c9,null));}else{return _0xe876c9['status'](0x1f4)['send']({'message':_0xbd64('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 21c134b..e5a71bf 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 _0xc7b0=['./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x160152,_0x14aa76){var _0x287dcd=function(_0x2d0627){while(--_0x2d0627){_0x160152['push'](_0x160152['shift']());}};_0x287dcd(++_0x14aa76);}(_0xc7b0,0x151));var _0x0c7b=function(_0x2ace3f,_0x1944cc){_0x2ace3f=_0x2ace3f-0x0;var _0x5e31b0=_0xc7b0[_0x2ace3f];return _0x5e31b0;};'use strict';var express=require(_0x0c7b('0x0'));var router=express[_0x0c7b('0x1')]();var auth=require(_0x0c7b('0x2'));var controller=require(_0x0c7b('0x3'));router[_0x0c7b('0x4')](_0x0c7b('0x5'),auth[_0x0c7b('0x6')](),controller[_0x0c7b('0x7')]);router[_0x0c7b('0x4')]('/queues',auth[_0x0c7b('0x6')](),controller[_0x0c7b('0x8')]);module[_0x0c7b('0x9')]=router; \ No newline at end of file +var _0x4d74=['/agents','getAgents','isAuthenticated','getQueues','express','./realtime.controller','get'];(function(_0x556428,_0x5da77e){var _0x49403c=function(_0x5e41b1){while(--_0x5e41b1){_0x556428['push'](_0x556428['shift']());}};_0x49403c(++_0x5da77e);}(_0x4d74,0x170));var _0x44d7=function(_0x5cd253,_0x4162da){_0x5cd253=_0x5cd253-0x0;var _0x36e179=_0x4d74[_0x5cd253];return _0x36e179;};'use strict';var express=require(_0x44d7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x44d7('0x1'));router[_0x44d7('0x2')](_0x44d7('0x3'),auth['isAuthenticated'](),controller[_0x44d7('0x4')]);router['get']('/queues',auth[_0x44d7('0x5')](),controller[_0x44d7('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 8f08f99..af71971 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 _0x1aee=['agent','raw','sequelize','literal','FIELD(id,','order','forEach','push','Pause','where','merge','user','Agents','online','assign','getResources','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','startCase','Queue','key','voice','outbound','dialActive','dialMethod','name','filter','UserProfile','getRealtimeQueues','rows','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','role'];(function(_0x402a48,_0x1a5e27){var _0x53e4a8=function(_0x360433){while(--_0x360433){_0x402a48['push'](_0x402a48['shift']());}};_0x53e4a8(++_0x1a5e27);}(_0x1aee,0xd0));var _0xe1ae=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x1aee[_0x44fef1];return _0x3c3a04;};'use strict';var _=require(_0xe1ae('0x0'));var util=require(_0xe1ae('0x1'));var rta=require(_0xe1ae('0x2'));var rtq=require(_0xe1ae('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0xe1ae('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0xe1ae('0x5')];var APIHandleError=require(_0xe1ae('0x6'))[_0xe1ae('0x7')];function respondWithFilteredResult(_0x245427,_0x5a38a7){return function(_0x342e0f){if(_0x342e0f){var _0xae0c8e=typeof _0x5a38a7[_0xe1ae('0x8')]===_0xe1ae('0x9')&&typeof _0x5a38a7[_0xe1ae('0xa')]==='undefined';var _0x3edd78=_0x342e0f[_0xe1ae('0xb')];var _0x11ea83=_0xae0c8e?0x0:_0x5a38a7['offset'];var _0x1e2a95=_0xae0c8e?_0x342e0f[_0xe1ae('0xb')]:_0x5a38a7['offset']+_0x5a38a7[_0xe1ae('0xa')];var _0x47636e;if(_0x1e2a95>=_0x3edd78){_0x1e2a95=_0x3edd78;_0x47636e=0xc8;}else{_0x47636e=0xce;}_0x245427[_0xe1ae('0xc')](_0x47636e);return _0x245427[_0xe1ae('0xd')]('Content-Range',_0x11ea83+'-'+_0x1e2a95+'/'+_0x3edd78)[_0xe1ae('0xe')](_0x342e0f);}return null;};}exports[_0xe1ae('0xf')]=function(_0x5515d6,_0x57a961){var _0xb46563={'count':0x0,'rows':[]};var _0x2be7fa={};var _0x104fb9;var _0x2dd0f5=utils[_0xe1ae('0x10')]();var _0x189a1c;var _0x4dfcf5;var _0x51e0ed=_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x12')];var _0x5e78b0=_0x5515d6['query']['globalStatusFilter'];var _0x291cb4=_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x13')];var _0x2f207b=_0x5e78b0===_0xe1ae('0x14')||_0x5e78b0===_0xe1ae('0x15')?!![]:![];var _0x5e039e=[];var _0x26c103;var _0x323977;Promise['resolve']()[_0xe1ae('0x16')](function(){if(_0x5515d6['query'][_0xe1ae('0x17')]){if(!utils[_0xe1ae('0x18')](_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x17')])){throw new APIBadRequestError(util[_0xe1ae('0x19')](_0xe1ae('0x1a'),_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x17')]));}_0x104fb9=_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x17')][_0xe1ae('0x1b')]();}if(!_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x1c')]||!_0x5515d6['query']['sort'][_0xe1ae('0x1d')](_0xe1ae('0x1e'))){_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x1c')]=rta[_0xe1ae('0x1f')](_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x1c')]);return;}var _0x20a69f=rta[_0xe1ae('0x20')](_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x1c')]);_0x5515d6[_0xe1ae('0x11')]['sort']=_0x20a69f[_0xe1ae('0x21')][_0xe1ae('0x22')](',');_0x26c103=_0x20a69f['order'];})[_0xe1ae('0x16')](function(){if(!_0x51e0ed){return[];}return rta[_0xe1ae('0x23')](_0x51e0ed,_0x104fb9);})['then'](function(_0x4a1055){_0x5e039e=_0x4a1055;return rta['getRealtimeAgents']();})[_0xe1ae('0x16')](function(_0x1f9beb){_0x4dfcf5=_0x1f9beb['rows'];if((!_0x5e78b0||_0x2f207b)&&!_0x26c103){return _0x5e039e;}if(_0x26c103&&!_0x5e78b0){return rta['getSortedAgentsIdsByStatus'](_0x4dfcf5,_0x5e039e,_0x26c103);}else{return rta[_0xe1ae('0x24')](_0x4dfcf5,_0x5e039e,_0x5e78b0);}})[_0xe1ae('0x16')](function(_0x4c0f2a){_0x5e039e=_0x4c0f2a;var _0x14586b=![];if(_0x5e039e[_0xe1ae('0x25')]===0x0){if(_0x51e0ed||_0x5e78b0){_0x14586b=!![];}if(_0x2f207b){_0x14586b=![];}}if(_0x14586b){return _0xb46563;}var _0x3973a0=_[_0xe1ae('0x26')](db[_0xe1ae('0x27')][_0xe1ae('0x28')],function(_0x298580){return{'name':_0x298580[_0xe1ae('0x29')],'type':_0x298580[_0xe1ae('0x2a')]['key']};});_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x2b')]=_0xe1ae('0x2c');_0x2be7fa=qs['getOptions'](_0x3973a0,_0x5515d6);_0x2be7fa[_0xe1ae('0x2d')]=!![];var _0x41436d=[];if(_0x5e039e['length']>0x0){_0x41436d['push']({'id':{'$in':_0x5e039e}});if(_0x26c103&&!_0x5e78b0){_0x323977=[db[_0xe1ae('0x2e')][_0xe1ae('0x2f')](_0xe1ae('0x30')+_0x5e039e+')')];_0x2be7fa[_0xe1ae('0x31')]=_0x323977;}}if(_0x2f207b){_0x2dd0f5[_0xe1ae('0x32')](function(_0xd368f2){var _0x32f1ce=!![];if(_0x5e78b0===_0xe1ae('0x15')&&_0x104fb9!==_0xd368f2){_0x32f1ce=![];}_0x41436d[_0xe1ae('0x33')]({[_0xd368f2+_0xe1ae('0x34')]:_0x32f1ce});});if(_0x291cb4){_0x41436d[_0xe1ae('0x33')]({'pauseType':_0x291cb4});}}else if(_0x5e78b0){_0x2dd0f5[_0xe1ae('0x32')](function(_0x1af6dc){_0x41436d[_0xe1ae('0x33')]({[_0x1af6dc+_0xe1ae('0x34')]:![]});});}_0x2be7fa[_0xe1ae('0x35')]=_[_0xe1ae('0x36')](_0x2be7fa[_0xe1ae('0x35')],{'$and':_0x41436d});if(_0x5515d6[_0xe1ae('0x37')][_0xe1ae('0x2b')]===_0xe1ae('0x37')){var _0x2bbde7={'params':{'id':_0x5515d6[_0xe1ae('0x37')]['userProfileId']},'query':{'section':_0xe1ae('0x38'),'role':_0xe1ae('0x2c'),'raw':!![],'ids':_0x5e039e,'customSorting':_0x323977}};if(_0x5515d6[_0xe1ae('0x11')][_0xe1ae('0x39')]){_0x2bbde7[_0xe1ae('0x11')][_0xe1ae('0x39')]=!![];}if(_0x2f207b){_0x2bbde7[_0xe1ae('0x11')]['extraQueryConditions']=_0x41436d;}_0x2bbde7['query']=Object[_0xe1ae('0x3a')](_0x2bbde7[_0xe1ae('0x11')],_0x5515d6[_0xe1ae('0x11')]);return db['UserProfile'][_0xe1ae('0x3b')](_0x2bbde7);}return db['User']['findAndCountAll'](_0x2be7fa);})[_0xe1ae('0x16')](function(_0xad8c3b){_0xb46563[_0xe1ae('0xb')]=_0xad8c3b[_0xe1ae('0xb')];_0x189a1c=_0xad8c3b['rows'];return _0x189a1c[_0xe1ae('0x26')](function(_0xbf072a){var _0x445f50=_[_0xe1ae('0x3c')](_0x4dfcf5,['id',_0xbf072a['id']]);if(_0x445f50){var _0x58ab2b=rta[_0xe1ae('0x3d')](_0x445f50);_[_0xe1ae('0x36')](_0xbf072a,_0x58ab2b);}_0xbf072a[_0xe1ae('0x1e')]=rta[_0xe1ae('0x3e')](_0xbf072a);if(_0xbf072a[_0xe1ae('0x1e')][_0xe1ae('0x1d')](_0xe1ae('0x14'))){_0x2dd0f5['forEach'](function(_0x518bfa){if(_0xbf072a[_0x518bfa+_0xe1ae('0x34')]){if(_0x518bfa==='voice'){if(_0xbf072a[_0xe1ae('0x3f')]!==_0xe1ae('0x40')){_0xbf072a[_0xe1ae('0x3f')]=_0xe1ae('0x14');}}else{_0xbf072a[_0x518bfa+'Status']=_0xe1ae('0x14');}}});}return _0xbf072a;});})[_0xe1ae('0x16')](function(_0x486e3e){if(!_0x26c103||_0x323977){return _0x486e3e;}return rta[_0xe1ae('0x41')](_0x486e3e,_0x26c103);})['then'](function(_0x5b8c93){var _0x5a9911=rta[_0xe1ae('0x42')]();_0xb46563['rows']=_0x5b8c93[_0xe1ae('0x26')](function(_0x4dee6c){return _[_0xe1ae('0x43')](_0x4dee6c,_0x5a9911);});return _0xb46563;})['then'](respondWithFilteredResult(_0x57a961,_0x2be7fa))[_0xe1ae('0x44')](APIHandleError(_0x57a961));};exports[_0xe1ae('0x45')]=function(_0x4d46e1,_0x5537cc){var _0x607f59={'count':0x0,'rows':[]};var _0x1f4ef0={};var _0xcad452;var _0x14506a;var _0x1505bf;Promise[_0xe1ae('0x46')]()[_0xe1ae('0x16')](function(){if(_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x17')]){if(!utils[_0xe1ae('0x18')](_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x17')])){throw new APIBadRequestError(util['format'](_0xe1ae('0x1a'),_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x17')]));}_0xcad452=_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x17')]['toLowerCase']();}var _0x54abc5=_[_0xe1ae('0x47')](_0xcad452)+_0xe1ae('0x48');var _0x5a6f3e=_[_0xe1ae('0x26')](db[_0x54abc5][_0xe1ae('0x28')],function(_0x22c14a){return{'name':_0x22c14a[_0xe1ae('0x29')],'type':_0x22c14a[_0xe1ae('0x2a')][_0xe1ae('0x49')]};});if(!_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x21')]){var _0x9b5b2b=['id','name'];if(_0xcad452===_0xe1ae('0x4a')){_0x9b5b2b['push']('type');if(_0x4d46e1[_0xe1ae('0x11')]['type']===_0xe1ae('0x4b')){_0x9b5b2b[_0xe1ae('0x33')]([_0xe1ae('0x4c'),_0xe1ae('0x4d')]);}}_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x21')]=_0x9b5b2b[_0xe1ae('0x22')](',');}_0x1f4ef0=qs['getOptions'](_0x5a6f3e,_0x4d46e1);if(_0x4d46e1['user'][_0xe1ae('0x2b')]===_0xe1ae('0x37')){var _0x250985={'params':{'id':_0x4d46e1[_0xe1ae('0x37')]['userProfileId']},'query':{'section':_0xcad452==='voice'&&_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x2a')]===_0xe1ae('0x4b')?'QueueCampaigns':_['startCase'](_0xcad452)+'Queues','type':_0x4d46e1['query']['type'],'nolimit':!![],'sort':_0xe1ae('0x4e'),'filter':_0x4d46e1['query'][_0xe1ae('0x4f')]}};_0x250985['query']=Object[_0xe1ae('0x3a')](_0x250985[_0xe1ae('0x11')],_0x4d46e1[_0xe1ae('0x11')]);delete _0x250985['query']['id'];return db[_0xe1ae('0x50')][_0xe1ae('0x3b')](_0x250985);}return db[_0x54abc5]['findAndCountAll'](_0x1f4ef0);})[_0xe1ae('0x16')](function(_0x214bb9){_0x607f59[_0xe1ae('0xb')]=_0x214bb9[_0xe1ae('0xb')];_0x14506a=_0x214bb9['rows'];return rtq[_0xe1ae('0x51')](_0x4d46e1,_0xcad452);})[_0xe1ae('0x16')](function(_0x58642a){_0x1505bf=_0x58642a[_0xe1ae('0x52')];return rtq[_0xe1ae('0x53')](_0x14506a,_0x1505bf,_0xcad452,_0x4d46e1[_0xe1ae('0x11')][_0xe1ae('0x2a')]);})['then'](function(_0x59caed){_0x607f59['rows']=_0x59caed;return _0x607f59;})[_0xe1ae('0x16')](respondWithFilteredResult(_0x5537cc,_0x1f4ef0))['catch'](APIHandleError(_0x5537cc));}; \ No newline at end of file +var _0x915e=['dialActive','dialMethod','QueueCampaigns','Queues','filter','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','length','map','User','rawAttributes','type','role','agent','getOptions','raw','literal','FIELD(id,','forEach','push','where','user','userProfileId','online','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','Pause','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','startCase','Queue','fieldName','key','name','outbound'];(function(_0x18b7b5,_0x1965bc){var _0x47e229=function(_0x244414){while(--_0x244414){_0x18b7b5['push'](_0x18b7b5['shift']());}};_0x47e229(++_0x1965bc);}(_0x915e,0xfb));var _0xe915=function(_0x42f879,_0x127f39){_0x42f879=_0x42f879-0x0;var _0x179d2e=_0x915e[_0x42f879];return _0x179d2e;};'use strict';var _=require('lodash');var util=require(_0xe915('0x0'));var rta=require(_0xe915('0x1'));var rtq=require(_0xe915('0x2'));var qs=require(_0xe915('0x3'));var utils=require(_0xe915('0x4'));var db=require(_0xe915('0x5'))['db'];var APIBadRequestError=require(_0xe915('0x6'))[_0xe915('0x7')];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x400f22,_0xb71f03){return function(_0x4ed195){if(_0x4ed195){var _0x58a030=typeof _0xb71f03[_0xe915('0x8')]===_0xe915('0x9')&&typeof _0xb71f03[_0xe915('0xa')]===_0xe915('0x9');var _0x468472=_0x4ed195[_0xe915('0xb')];var _0x19702=_0x58a030?0x0:_0xb71f03['offset'];var _0x14af3c=_0x58a030?_0x4ed195[_0xe915('0xb')]:_0xb71f03[_0xe915('0x8')]+_0xb71f03['limit'];var _0x48496b;if(_0x14af3c>=_0x468472){_0x14af3c=_0x468472;_0x48496b=0xc8;}else{_0x48496b=0xce;}_0x400f22[_0xe915('0xc')](_0x48496b);return _0x400f22[_0xe915('0xd')](_0xe915('0xe'),_0x19702+'-'+_0x14af3c+'/'+_0x468472)[_0xe915('0xf')](_0x4ed195);}return null;};}exports[_0xe915('0x10')]=function(_0x1a9ed2,_0x28ab31){var _0x47ada5={'count':0x0,'rows':[]};var _0x220594={};var _0x57b758;var _0xa4d812=utils['getChannels']();var _0x207763;var _0x5abcf9;var _0x1c9c9d=_0x1a9ed2[_0xe915('0x11')][_0xe915('0x12')];var _0x46d71c=_0x1a9ed2[_0xe915('0x11')][_0xe915('0x13')];var _0x534494=_0x1a9ed2[_0xe915('0x11')][_0xe915('0x14')];var _0x36e3aa=_0x46d71c===_0xe915('0x15')||_0x46d71c===_0xe915('0x16')?!![]:![];var _0x7df8f9=[];var _0x24fb13;var _0x5ed442;Promise[_0xe915('0x17')]()[_0xe915('0x18')](function(){if(_0x1a9ed2[_0xe915('0x11')]['channel']){if(!utils[_0xe915('0x19')](_0x1a9ed2[_0xe915('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0xe915('0x1a'),_0x1a9ed2['query'][_0xe915('0x1b')]));}_0x57b758=_0x1a9ed2[_0xe915('0x11')]['channel'][_0xe915('0x1c')]();}if(!_0x1a9ed2[_0xe915('0x11')]['sort']||!_0x1a9ed2[_0xe915('0x11')][_0xe915('0x1d')][_0xe915('0x1e')]('globalStatus')){_0x1a9ed2[_0xe915('0x11')][_0xe915('0x1d')]=rta['validateSortParameter'](_0x1a9ed2[_0xe915('0x11')][_0xe915('0x1d')]);return;}var _0x2c65a8=rta[_0xe915('0x1f')](_0x1a9ed2[_0xe915('0x11')]['sort']);_0x1a9ed2[_0xe915('0x11')][_0xe915('0x1d')]=_0x2c65a8[_0xe915('0x20')][_0xe915('0x21')](',');_0x24fb13=_0x2c65a8[_0xe915('0x22')];})[_0xe915('0x18')](function(){if(!_0x1c9c9d){return[];}return rta[_0xe915('0x23')](_0x1c9c9d,_0x57b758);})['then'](function(_0x2670e9){_0x7df8f9=_0x2670e9;return rta[_0xe915('0x24')]();})[_0xe915('0x18')](function(_0x47a217){_0x5abcf9=_0x47a217[_0xe915('0x25')];if((!_0x46d71c||_0x36e3aa)&&!_0x24fb13){return _0x7df8f9;}if(_0x24fb13&&!_0x46d71c){return rta[_0xe915('0x26')](_0x5abcf9,_0x7df8f9,_0x24fb13);}else{return rta['getAgentIdsByStatus'](_0x5abcf9,_0x7df8f9,_0x46d71c);}})[_0xe915('0x18')](function(_0x5c94e3){_0x7df8f9=_0x5c94e3;var _0x11c155=![];if(_0x7df8f9[_0xe915('0x27')]===0x0){if(_0x1c9c9d||_0x46d71c){_0x11c155=!![];}if(_0x36e3aa){_0x11c155=![];}}if(_0x11c155){return _0x47ada5;}var _0x2730f8=_[_0xe915('0x28')](db[_0xe915('0x29')][_0xe915('0x2a')],function(_0x1d9c1d){return{'name':_0x1d9c1d['fieldName'],'type':_0x1d9c1d[_0xe915('0x2b')]['key']};});_0x1a9ed2[_0xe915('0x11')][_0xe915('0x2c')]=_0xe915('0x2d');_0x220594=qs[_0xe915('0x2e')](_0x2730f8,_0x1a9ed2);_0x220594[_0xe915('0x2f')]=!![];var _0x15f519=[];if(_0x7df8f9[_0xe915('0x27')]>0x0){_0x15f519['push']({'id':{'$in':_0x7df8f9}});if(_0x24fb13&&!_0x46d71c){_0x5ed442=[db['sequelize'][_0xe915('0x30')](_0xe915('0x31')+_0x7df8f9+')')];_0x220594[_0xe915('0x22')]=_0x5ed442;}}if(_0x36e3aa){_0xa4d812[_0xe915('0x32')](function(_0xb2bce){var _0x5f4495=!![];if(_0x46d71c==='*pause'&&_0x57b758!==_0xb2bce){_0x5f4495=![];}_0x15f519['push']({[_0xb2bce+'Pause']:_0x5f4495});});if(_0x534494){_0x15f519[_0xe915('0x33')]({'pauseType':_0x534494});}}else if(_0x46d71c){_0xa4d812[_0xe915('0x32')](function(_0x3308a4){_0x15f519[_0xe915('0x33')]({[_0x3308a4+'Pause']:![]});});}_0x220594['where']=_['merge'](_0x220594[_0xe915('0x34')],{'$and':_0x15f519});if(_0x1a9ed2['user']['role']==='user'){var _0x4e31c8={'params':{'id':_0x1a9ed2[_0xe915('0x35')][_0xe915('0x36')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x7df8f9,'customSorting':_0x5ed442}};if(_0x1a9ed2['query'][_0xe915('0x37')]){_0x4e31c8[_0xe915('0x11')][_0xe915('0x37')]=!![];}if(_0x36e3aa){_0x4e31c8[_0xe915('0x11')]['extraQueryConditions']=_0x15f519;}_0x4e31c8[_0xe915('0x11')]=Object[_0xe915('0x38')](_0x4e31c8[_0xe915('0x11')],_0x1a9ed2['query']);return db[_0xe915('0x39')][_0xe915('0x3a')](_0x4e31c8);}return db[_0xe915('0x29')][_0xe915('0x3b')](_0x220594);})['then'](function(_0x164040){_0x47ada5['count']=_0x164040[_0xe915('0xb')];_0x207763=_0x164040[_0xe915('0x25')];return _0x207763[_0xe915('0x28')](function(_0x3d5267){var _0x57de79=_['find'](_0x5abcf9,['id',_0x3d5267['id']]);if(_0x57de79){var _0x4c29cc=rta[_0xe915('0x3c')](_0x57de79);_['merge'](_0x3d5267,_0x4c29cc);}_0x3d5267['globalStatus']=rta['getAgentStatus'](_0x3d5267);if(_0x3d5267['globalStatus'][_0xe915('0x1e')](_0xe915('0x15'))){_0xa4d812[_0xe915('0x32')](function(_0x324220){if(_0x3d5267[_0x324220+_0xe915('0x3d')]){if(_0x324220===_0xe915('0x3e')){if(_0x3d5267[_0xe915('0x3f')]!==_0xe915('0x40')){_0x3d5267['voiceStatus']=_0xe915('0x15');}}else{_0x3d5267[_0x324220+'Status']=_0xe915('0x15');}}});}return _0x3d5267;});})['then'](function(_0x56b72b){if(!_0x24fb13||_0x5ed442){return _0x56b72b;}return rta[_0xe915('0x41')](_0x56b72b,_0x24fb13);})[_0xe915('0x18')](function(_0xbdf4ff){var _0x43a918=rta[_0xe915('0x42')]();_0x47ada5[_0xe915('0x25')]=_0xbdf4ff[_0xe915('0x28')](function(_0x499592){return _[_0xe915('0x43')](_0x499592,_0x43a918);});return _0x47ada5;})[_0xe915('0x18')](respondWithFilteredResult(_0x28ab31,_0x220594))[_0xe915('0x44')](APIHandleError(_0x28ab31));};exports[_0xe915('0x45')]=function(_0x3e4561,_0x53c0b8){var _0x1b7464={'count':0x0,'rows':[]};var _0x19c4f0={};var _0x445180;var _0x7cdb89;var _0x22602c;Promise[_0xe915('0x17')]()[_0xe915('0x18')](function(){if(_0x3e4561['query'][_0xe915('0x1b')]){if(!utils[_0xe915('0x19')](_0x3e4561[_0xe915('0x11')][_0xe915('0x1b')])){throw new APIBadRequestError(util[_0xe915('0x46')](_0xe915('0x1a'),_0x3e4561['query'][_0xe915('0x1b')]));}_0x445180=_0x3e4561[_0xe915('0x11')][_0xe915('0x1b')][_0xe915('0x1c')]();}var _0x4eed53=_[_0xe915('0x47')](_0x445180)+_0xe915('0x48');var _0x1f0d8c=_[_0xe915('0x28')](db[_0x4eed53][_0xe915('0x2a')],function(_0x231a89){return{'name':_0x231a89[_0xe915('0x49')],'type':_0x231a89['type'][_0xe915('0x4a')]};});if(!_0x3e4561[_0xe915('0x11')][_0xe915('0x20')]){var _0x4a0eb4=['id',_0xe915('0x4b')];if(_0x445180===_0xe915('0x3e')){_0x4a0eb4[_0xe915('0x33')]('type');if(_0x3e4561['query']['type']===_0xe915('0x4c')){_0x4a0eb4[_0xe915('0x33')]([_0xe915('0x4d'),_0xe915('0x4e')]);}}_0x3e4561[_0xe915('0x11')][_0xe915('0x20')]=_0x4a0eb4[_0xe915('0x21')](',');}_0x19c4f0=qs[_0xe915('0x2e')](_0x1f0d8c,_0x3e4561);if(_0x3e4561[_0xe915('0x35')][_0xe915('0x2c')]==='user'){var _0x2ff0f5={'params':{'id':_0x3e4561[_0xe915('0x35')][_0xe915('0x36')]},'query':{'section':_0x445180===_0xe915('0x3e')&&_0x3e4561[_0xe915('0x11')][_0xe915('0x2b')]===_0xe915('0x4c')?_0xe915('0x4f'):_[_0xe915('0x47')](_0x445180)+_0xe915('0x50'),'type':_0x3e4561['query']['type'],'nolimit':!![],'sort':_0xe915('0x4b'),'filter':_0x3e4561[_0xe915('0x11')][_0xe915('0x51')]}};_0x2ff0f5[_0xe915('0x11')]=Object[_0xe915('0x38')](_0x2ff0f5['query'],_0x3e4561['query']);delete _0x2ff0f5['query']['id'];return db[_0xe915('0x39')][_0xe915('0x3a')](_0x2ff0f5);}return db[_0x4eed53][_0xe915('0x3b')](_0x19c4f0);})[_0xe915('0x18')](function(_0x1a662c){_0x1b7464[_0xe915('0xb')]=_0x1a662c['count'];_0x7cdb89=_0x1a662c[_0xe915('0x25')];return rtq['getRealtimeQueues'](_0x3e4561,_0x445180);})['then'](function(_0x3ff013){_0x22602c=_0x3ff013[_0xe915('0x25')];return rtq['initializeQueues'](_0x7cdb89,_0x22602c,_0x445180,_0x3e4561[_0xe915('0x11')][_0xe915('0x2b')]);})[_0xe915('0x18')](function(_0x11d164){_0x1b7464[_0xe915('0x25')]=_0x11d164;return _0x1b7464;})['then'](respondWithFilteredResult(_0x53c0b8,_0x19c4f0))[_0xe915('0x44')](APIHandleError(_0x53c0b8));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fa63885..fc65768 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f1842,_0x294639){var _0x18db09=function(_0x59e519){while(--_0x59e519){_0x2f1842['push'](_0x2f1842['shift']());}};_0x18db09(++_0x294639);}(_0x70e0,0x17b));var _0x070e=function(_0x45539e,_0x2390e7){_0x45539e=_0x45539e-0x0;var _0x119cb7=_0x70e0[_0x45539e];return _0x119cb7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x38ed45,_0x23ab20){var _0x215449=function(_0x40edea){while(--_0x40edea){_0x38ed45['push'](_0x38ed45['shift']());}};_0x215449(++_0x23ab20);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9e73b9f..f07568d 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 _0x4975=['STRING','DATE','sequelize','INTEGER'];(function(_0x5ea211,_0x4da2af){var _0x12f9c9=function(_0x90f3d5){while(--_0x90f3d5){_0x5ea211['push'](_0x5ea211['shift']());}};_0x12f9c9(++_0x4da2af);}(_0x4975,0x86));var _0x5497=function(_0x379cf2,_0x3dbc2a){_0x379cf2=_0x379cf2-0x0;var _0x11c280=_0x4975[_0x379cf2];return _0x11c280;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'state':{'type':Sequelize[_0x5497('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5497('0x2')]},'scheduledat':{'type':Sequelize[_0x5497('0x3')]},'uniqueid':{'type':Sequelize[_0x5497('0x2')]},'starttime':{'type':Sequelize[_0x5497('0x3')]},'responsetime':{'type':Sequelize[_0x5497('0x3')]},'ringtime':{'type':Sequelize[_0x5497('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5497('0x2')]},'campaigntype':{'type':Sequelize[_0x5497('0x2')]},'membername':{'type':Sequelize[_0x5497('0x2')]}}; \ No newline at end of file +var _0x972c=['STRING','DATE','INTEGER'];(function(_0x32058f,_0x3f17fe){var _0x307ed2=function(_0x12c816){while(--_0x12c816){_0x32058f['push'](_0x32058f['shift']());}};_0x307ed2(++_0x3f17fe);}(_0x972c,0xf2));var _0xc972=function(_0x531adc,_0x11312f){_0x531adc=_0x531adc-0x0;var _0xcb04b6=_0x972c[_0x531adc];return _0xcb04b6;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xc972('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xc972('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc972('0x1')]},'starttime':{'type':Sequelize[_0xc972('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc972('0x1')]},'campaigntype':{'type':Sequelize[_0xc972('0x1')]},'membername':{'type':Sequelize[_0xc972('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a12e58c..5a42c03 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 _0x286b=['./reportAgentPreview.attributes','exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d3b7f,_0x5ef7da){var _0x2c9c0b=function(_0x22fbeb){while(--_0x22fbeb){_0x5d3b7f['push'](_0x5d3b7f['shift']());}};_0x2c9c0b(++_0x5ef7da);}(_0x286b,0x87));var _0xb286=function(_0x5bb97a,_0x5c6e14){_0x5bb97a=_0x5bb97a-0x0;var _0x3c2296=_0x286b[_0x5bb97a];return _0x3c2296;};'use strict';var _=require(_0xb286('0x0'));var util=require(_0xb286('0x1'));var logger=require(_0xb286('0x2'))(_0xb286('0x3'));var moment=require(_0xb286('0x4'));var BPromise=require('bluebird');var rp=require(_0xb286('0x5'));var fs=require('fs');var path=require(_0xb286('0x6'));var rimraf=require(_0xb286('0x7'));var config=require(_0xb286('0x8'));var attributes=require(_0xb286('0x9'));module[_0xb286('0xa')]=function(_0x487b15,_0x44c3be){return _0x487b15[_0xb286('0xb')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7101=['bluebird','path','rimraf','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment'];(function(_0x6b515b,_0x5a7fd6){var _0x4dc2cd=function(_0x1c54ae){while(--_0x1c54ae){_0x6b515b['push'](_0x6b515b['shift']());}};_0x4dc2cd(++_0x5a7fd6);}(_0x7101,0xb6));var _0x1710=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0x7101[_0x113696];return _0x1fb234;};'use strict';var _=require(_0x1710('0x0'));var util=require(_0x1710('0x1'));var logger=require(_0x1710('0x2'))(_0x1710('0x3'));var moment=require(_0x1710('0x4'));var BPromise=require(_0x1710('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1710('0x6'));var rimraf=require(_0x1710('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x1710('0x8')]=function(_0x2608ca,_0x213859){return _0x2608ca[_0x1710('0x9')](_0x1710('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index d97827a..d550d95 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 _0x7760=['message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4f2d17,_0x13156c){var _0x277b0d=function(_0x29a497){while(--_0x29a497){_0x4f2d17['push'](_0x4f2d17['shift']());}};_0x277b0d(++_0x13156c);}(_0x7760,0xe0));var _0x0776=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x7760[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0x0776('0x0'));var util=require('util');var moment=require(_0x0776('0x1'));var BPromise=require(_0x0776('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0776('0x3'))('rpc');var config=require(_0x0776('0x4'));var jayson=require(_0x0776('0x5'));var client=jayson[_0x0776('0x6')][_0x0776('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x402aca,_0x1fc2ce,_0x2f4b2a){return new BPromise(function(_0x1b67a7,_0x4fb34a){return client[_0x0776('0x8')](_0x402aca,_0x2f4b2a)[_0x0776('0x9')](function(_0x39466b){logger[_0x0776('0xa')](_0x0776('0xb'),_0x1fc2ce,_0x0776('0xc'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1fc2ce,_0x0776('0xc'),JSON[_0x0776('0xd')](_0x39466b));if(_0x39466b[_0x0776('0xe')]){if(_0x39466b[_0x0776('0xe')][_0x0776('0xf')]===0x1f4){logger[_0x0776('0xe')](_0x0776('0xb'),_0x1fc2ce,_0x39466b[_0x0776('0xe')][_0x0776('0x10')]);return _0x4fb34a(_0x39466b[_0x0776('0xe')][_0x0776('0x10')]);}logger[_0x0776('0xe')](_0x0776('0xb'),_0x1fc2ce,_0x39466b[_0x0776('0xe')][_0x0776('0x10')]);return _0x1b67a7(_0x39466b[_0x0776('0xe')][_0x0776('0x10')]);}else{logger['info'](_0x0776('0xb'),_0x1fc2ce,_0x0776('0xc'));_0x1b67a7(_0x39466b[_0x0776('0x11')][_0x0776('0x10')]);}})[_0x0776('0x12')](function(_0x4dccdc){logger[_0x0776('0xe')](_0x0776('0xb'),_0x1fc2ce,_0x4dccdc);_0x4fb34a(_0x4dccdc);});});}exports[_0x0776('0x13')]=function(_0x47be35){var _0x3b086f=this;return new Promise(function(_0x262cfa,_0x836c49){return db['ReportAgentPreview'][_0x0776('0x14')](_0x47be35[_0x0776('0x15')],{'raw':_0x47be35[_0x0776('0x16')]?_0x47be35['options'][_0x0776('0x17')]===undefined?!![]:![]:!![]})[_0x0776('0x9')](function(_0x224660){logger['info'](_0x0776('0x13'),_0x47be35);logger['debug'](_0x0776('0x13'),_0x47be35,JSON[_0x0776('0xd')](_0x224660));_0x262cfa(_0x224660);})[_0x0776('0x12')](function(_0x467066){logger[_0x0776('0xe')](_0x0776('0x13'),_0x467066[_0x0776('0x10')],_0x47be35);_0x836c49(_0x3b086f['error'](0x1f4,_0x467066[_0x0776('0x10')]));});});}; \ No newline at end of file +var _0xb000=['stringify','error','code','message','info','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x360319,_0x1cd1ee){var _0x4062fb=function(_0x213292){while(--_0x213292){_0x360319['push'](_0x360319['shift']());}};_0x4062fb(++_0x1cd1ee);}(_0xb000,0x1b0));var _0x0b00=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xb000[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x0b00('0x0'));var util=require(_0x0b00('0x1'));var moment=require(_0x0b00('0x2'));var BPromise=require(_0x0b00('0x3'));var rs=require(_0x0b00('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b00('0x5'))['db'];var utils=require(_0x0b00('0x6'));var logger=require('../../config/logger')(_0x0b00('0x7'));var config=require('../../config/environment');var jayson=require(_0x0b00('0x8'));var client=jayson[_0x0b00('0x9')][_0x0b00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4caac0,_0x3eaaaa,_0x4566ad){return new BPromise(function(_0x42ae6e,_0x3887e1){return client[_0x0b00('0xb')](_0x4caac0,_0x4566ad)[_0x0b00('0xc')](function(_0x3e99b6){logger['info'](_0x0b00('0xd'),_0x3eaaaa,_0x0b00('0xe'));logger[_0x0b00('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3eaaaa,'request\x20sent',JSON[_0x0b00('0x10')](_0x3e99b6));if(_0x3e99b6['error']){if(_0x3e99b6[_0x0b00('0x11')][_0x0b00('0x12')]===0x1f4){logger[_0x0b00('0x11')](_0x0b00('0xd'),_0x3eaaaa,_0x3e99b6['error'][_0x0b00('0x13')]);return _0x3887e1(_0x3e99b6['error'][_0x0b00('0x13')]);}logger[_0x0b00('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x3eaaaa,_0x3e99b6['error']['message']);return _0x42ae6e(_0x3e99b6[_0x0b00('0x11')][_0x0b00('0x13')]);}else{logger[_0x0b00('0x14')](_0x0b00('0xd'),_0x3eaaaa,_0x0b00('0xe'));_0x42ae6e(_0x3e99b6['result'][_0x0b00('0x13')]);}})['catch'](function(_0x704234){logger['error'](_0x0b00('0xd'),_0x3eaaaa,_0x704234);_0x3887e1(_0x704234);});});}exports['CreateReportAgentPreview']=function(_0x554eb1){var _0x1789c9=this;return new Promise(function(_0xcec3ec,_0x28a44e){return db[_0x0b00('0x15')][_0x0b00('0x16')](_0x554eb1[_0x0b00('0x17')],{'raw':_0x554eb1[_0x0b00('0x18')]?_0x554eb1[_0x0b00('0x18')][_0x0b00('0x19')]===undefined?!![]:![]:!![]})[_0x0b00('0xc')](function(_0x5f21d0){logger[_0x0b00('0x14')]('CreateReportAgentPreview',_0x554eb1);logger['debug'](_0x0b00('0x1a'),_0x554eb1,JSON[_0x0b00('0x10')](_0x5f21d0));_0xcec3ec(_0x5f21d0);})[_0x0b00('0x1b')](function(_0x5d7064){logger['error'](_0x0b00('0x1a'),_0x5d7064[_0x0b00('0x13')],_0x554eb1);_0x28a44e(_0x1789c9['error'](0x1f4,_0x5d7064[_0x0b00('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e522710..46fc359 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 _0x7013=['/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0xcd6dda,_0x467586){var _0x4b5546=function(_0x48294e){while(--_0x48294e){_0xcd6dda['push'](_0xcd6dda['shift']());}};_0x4b5546(++_0x467586);}(_0x7013,0x7e));var _0x3701=function(_0x4e906f,_0x10f451){_0x4e906f=_0x4e906f-0x0;var _0x14a18d=_0x7013[_0x4e906f];return _0x14a18d;};'use strict';var multer=require(_0x3701('0x0'));var util=require(_0x3701('0x1'));var path=require('path');var express=require(_0x3701('0x2'));var router=express[_0x3701('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x3701('0x4'));router[_0x3701('0x5')]('/voice/channels',auth['isAuthenticated'](),controller[_0x3701('0x6')]);router[_0x3701('0x5')](_0x3701('0x7'),auth[_0x3701('0x8')](),controller['voiceChannelMixMonitor']);router[_0x3701('0x5')](_0x3701('0x9'),auth['isAuthenticated'](),controller[_0x3701('0xa')]);router[_0x3701('0x5')](_0x3701('0xb'),auth[_0x3701('0x8')](),controller[_0x3701('0xc')]);router[_0x3701('0x5')](_0x3701('0xd'),auth['isAuthenticated'](),controller[_0x3701('0xe')]);router[_0x3701('0x5')]('/mail/queues',auth[_0x3701('0x8')](),controller[_0x3701('0xf')]);router[_0x3701('0x5')](_0x3701('0x10'),auth['isAuthenticated'](),controller[_0x3701('0x11')]);router[_0x3701('0x5')](_0x3701('0x12'),auth[_0x3701('0x8')](),controller['openchannelQueues']);router[_0x3701('0x5')](_0x3701('0x13'),auth[_0x3701('0x8')](),controller[_0x3701('0x14')]);router['get'](_0x3701('0x15'),auth[_0x3701('0x8')](),controller[_0x3701('0x16')]);router['get']('/fax/queues',auth[_0x3701('0x8')](),controller[_0x3701('0x17')]);router[_0x3701('0x5')](_0x3701('0x18'),auth[_0x3701('0x8')](),controller[_0x3701('0x19')]);router['get'](_0x3701('0x1a'),auth[_0x3701('0x8')](),controller[_0x3701('0x1b')]);router[_0x3701('0x5')](_0x3701('0x1c'),auth[_0x3701('0x8')](),controller[_0x3701('0x1d')]);router[_0x3701('0x5')](_0x3701('0x1e'),auth[_0x3701('0x8')](),controller[_0x3701('0x1f')]);router[_0x3701('0x5')](_0x3701('0x20'),auth[_0x3701('0x8')](),controller[_0x3701('0x21')]);router[_0x3701('0x5')]('/voice/queues/:id',auth[_0x3701('0x8')](),controller[_0x3701('0x22')]);router['put'](_0x3701('0x23'),auth['isAuthenticated'](),controller[_0x3701('0x24')]);router['get'](_0x3701('0x25'),auth[_0x3701('0x8')](),controller[_0x3701('0x26')]);router[_0x3701('0x5')]('/outbound/channels',auth[_0x3701('0x8')](),controller[_0x3701('0x27')]);router[_0x3701('0x5')](_0x3701('0x28'),auth[_0x3701('0x8')](),controller[_0x3701('0x29')]);router['put'](_0x3701('0x2a'),auth['isAuthenticated'](),controller[_0x3701('0x2b')]);router['get'](_0x3701('0x2c'),auth[_0x3701('0x8')](),controller[_0x3701('0x2d')]);router['get'](_0x3701('0x2e'),auth[_0x3701('0x8')](),controller[_0x3701('0x2f')]);router[_0x3701('0x5')](_0x3701('0x30'),auth[_0x3701('0x8')](),controller['campaigns']);router[_0x3701('0x5')]('/fax/accounts',auth[_0x3701('0x8')](),controller['faxAccounts']);router[_0x3701('0x5')](_0x3701('0x31'),auth[_0x3701('0x8')](),controller['chatQueuesWaitingInteractions']);router['get']('/mail/queues/waitinginteractions',auth[_0x3701('0x8')](),controller[_0x3701('0x32')]);router[_0x3701('0x5')](_0x3701('0x33'),auth[_0x3701('0x8')](),controller[_0x3701('0x34')]);router['get'](_0x3701('0x35'),auth[_0x3701('0x8')](),controller[_0x3701('0x36')]);router[_0x3701('0x5')](_0x3701('0x37'),auth['isAuthenticated'](),controller[_0x3701('0x38')]);router['get'](_0x3701('0x39'),auth[_0x3701('0x8')](),controller[_0x3701('0x3a')]);router['get'](_0x3701('0x3b'),auth[_0x3701('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x3701('0x3c')](_0x3701('0x3d'),auth['isAuthenticated'](),controller[_0x3701('0x3e')]('mail'));router[_0x3701('0x5')](_0x3701('0x3f'),auth['isAuthenticated'](),controller[_0x3701('0x40')]);router['post'](_0x3701('0x41'),auth['isAuthenticated'](),controller[_0x3701('0x3e')]('chat'));router['get'](_0x3701('0x42'),auth[_0x3701('0x8')](),controller['showChatQueues']);router[_0x3701('0x3c')]('/fax/queues/:id/notify',auth[_0x3701('0x8')](),controller['queueNotify'](_0x3701('0x43')));router[_0x3701('0x5')](_0x3701('0x44'),auth[_0x3701('0x8')](),controller[_0x3701('0x45')]);router[_0x3701('0x3c')]('/openchannel/queues/:id/notify',auth[_0x3701('0x8')](),controller[_0x3701('0x3e')]('openchannel'));router[_0x3701('0x5')](_0x3701('0x46'),auth[_0x3701('0x8')](),controller[_0x3701('0x47')]);router[_0x3701('0x3c')]('/sms/queues/:id/notify',auth[_0x3701('0x8')](),controller[_0x3701('0x3e')]('sms'));router[_0x3701('0x3c')](_0x3701('0x48'),auth[_0x3701('0x8')](),controller[_0x3701('0x3e')]('whatsapp'));router[_0x3701('0x5')](_0x3701('0x49'),auth[_0x3701('0x8')](),controller['showSmsQueues']);router[_0x3701('0x5')](_0x3701('0x4a'),auth[_0x3701('0x8')](),controller['showWhatsappQueues']);router[_0x3701('0x3c')](_0x3701('0x4b'),auth[_0x3701('0x8')](),controller[_0x3701('0x4c')]);module[_0x3701('0x4d')]=router; \ No newline at end of file +var _0x43bc=['smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','/agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','post','/mail/queues/:id/notify','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/openchannel/queues','openchannelQueues'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x43bc,0x82));var _0xc43b=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x43bc[_0x483d8b];return _0x6500f1;};'use strict';var multer=require('multer');var util=require(_0xc43b('0x0'));var path=require(_0xc43b('0x1'));var express=require(_0xc43b('0x2'));var router=express[_0xc43b('0x3')]();var auth=require(_0xc43b('0x4'));var controller=require(_0xc43b('0x5'));router[_0xc43b('0x6')](_0xc43b('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xc43b('0x8'),auth[_0xc43b('0x9')](),controller[_0xc43b('0xa')]);router[_0xc43b('0x6')](_0xc43b('0xb'),auth['isAuthenticated'](),controller[_0xc43b('0xc')]);router[_0xc43b('0x6')](_0xc43b('0xd'),auth[_0xc43b('0x9')](),controller[_0xc43b('0xe')]);router[_0xc43b('0x6')](_0xc43b('0xf'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x10')]);router[_0xc43b('0x6')]('/mail/queues',auth[_0xc43b('0x9')](),controller[_0xc43b('0x11')]);router[_0xc43b('0x6')]('/mail/accounts',auth[_0xc43b('0x9')](),controller['mailAccounts']);router['get'](_0xc43b('0x12'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x13')]);router['get']('/sms/queues',auth[_0xc43b('0x9')](),controller[_0xc43b('0x14')]);router[_0xc43b('0x6')](_0xc43b('0x15'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x16')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0xc43b('0x17')]);router[_0xc43b('0x6')](_0xc43b('0x18'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x19')]);router[_0xc43b('0x6')](_0xc43b('0x1a'),auth['isAuthenticated'](),controller[_0xc43b('0x1b')]);router[_0xc43b('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xc43b('0x1c')]);router[_0xc43b('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xc43b('0x1d')]);router[_0xc43b('0x6')](_0xc43b('0x1e'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x1f')]);router[_0xc43b('0x6')](_0xc43b('0x20'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x21')]);router['put'](_0xc43b('0x20'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x22')]);router[_0xc43b('0x6')]('/outbound',auth[_0xc43b('0x9')](),controller[_0xc43b('0x23')]);router['get'](_0xc43b('0x24'),auth[_0xc43b('0x9')](),controller['outboundChannels']);router[_0xc43b('0x6')](_0xc43b('0x25'),auth['isAuthenticated'](),controller['agents']);router['put'](_0xc43b('0x26'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x27')]);router[_0xc43b('0x6')](_0xc43b('0x28'),auth[_0xc43b('0x9')](),controller['telephones']);router[_0xc43b('0x6')](_0xc43b('0x29'),auth['isAuthenticated'](),controller[_0xc43b('0x2a')]);router['get']('/campaigns',auth[_0xc43b('0x9')](),controller['campaigns']);router['get'](_0xc43b('0x2b'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x2c')]);router[_0xc43b('0x6')](_0xc43b('0x2d'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x2e')]);router[_0xc43b('0x6')](_0xc43b('0x2f'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x30')]);router[_0xc43b('0x6')](_0xc43b('0x31'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x32')]);router[_0xc43b('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xc43b('0x9')](),controller[_0xc43b('0x33')]);router[_0xc43b('0x6')](_0xc43b('0x34'),auth[_0xc43b('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0xc43b('0x6')](_0xc43b('0x35'),auth[_0xc43b('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0xc43b('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xc43b('0x36')](_0xc43b('0x37'),auth[_0xc43b('0x9')](),controller['queueNotify']('mail'));router[_0xc43b('0x6')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0xc43b('0x36')](_0xc43b('0x38'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x39')](_0xc43b('0x3a')));router['get']('/chat/queues/:id',auth[_0xc43b('0x9')](),controller[_0xc43b('0x3b')]);router[_0xc43b('0x36')](_0xc43b('0x3c'),auth['isAuthenticated'](),controller[_0xc43b('0x39')](_0xc43b('0x3d')));router[_0xc43b('0x6')]('/fax/queues/:id',auth[_0xc43b('0x9')](),controller[_0xc43b('0x3e')]);router[_0xc43b('0x36')](_0xc43b('0x3f'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x39')](_0xc43b('0x40')));router['get'](_0xc43b('0x41'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xc43b('0x36')](_0xc43b('0x42'),auth[_0xc43b('0x9')](),controller[_0xc43b('0x39')](_0xc43b('0x43')));router[_0xc43b('0x36')](_0xc43b('0x44'),auth[_0xc43b('0x9')](),controller['queueNotify'](_0xc43b('0x45')));router[_0xc43b('0x6')](_0xc43b('0x46'),auth[_0xc43b('0x9')](),controller['showSmsQueues']);router[_0xc43b('0x6')](_0xc43b('0x47'),auth['isAuthenticated'](),controller[_0xc43b('0x48')]);router[_0xc43b('0x36')](_0xc43b('0x49'),auth[_0xc43b('0x9')](),controller['agentNotify']);module[_0xc43b('0x4a')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4e7ceb8..23b7da1 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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file +var _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e703087..ce7c433 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 _0x9494=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','create'];(function(_0x58f1a9,_0x46cee8){var _0x462106=function(_0x2fa4c6){while(--_0x2fa4c6){_0x58f1a9['push'](_0x58f1a9['shift']());}};_0x462106(++_0x46cee8);}(_0x9494,0x165));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4949('0x0'));var util=require(_0x4949('0x1'));var path=require(_0x4949('0x2'));var timeout=require(_0x4949('0x3'));var express=require('express');var router=express[_0x4949('0x4')]();var fs_extra=require(_0x4949('0x5'));var auth=require(_0x4949('0x6'));var interaction=require(_0x4949('0x7'));var config=require(_0x4949('0x8'));var controller=require(_0x4949('0x9'));router[_0x4949('0xa')]('/',auth[_0x4949('0xb')](),controller['index']);router[_0x4949('0xa')](_0x4949('0xc'),auth[_0x4949('0xb')](),controller[_0x4949('0xd')]);router[_0x4949('0xa')](_0x4949('0xe'),auth[_0x4949('0xb')](),controller[_0x4949('0xf')]);router['post']('/',auth[_0x4949('0xb')](),controller[_0x4949('0x10')]);router[_0x4949('0x11')](_0x4949('0xc'),auth[_0x4949('0xb')](),controller[_0x4949('0x12')]);router[_0x4949('0x13')](_0x4949('0xc'),auth[_0x4949('0xb')](),controller[_0x4949('0x14')]);module[_0x4949('0x15')]=router; \ No newline at end of file +var _0x880d=['exports','multer','util','path','express','fs-extra','../../config/environment','./schedule.controller','get','/:id','isAuthenticated','show','/:id/run','run','put','delete','destroy'];(function(_0x53346a,_0x191cab){var _0x3ee341=function(_0x4c5afc){while(--_0x4c5afc){_0x53346a['push'](_0x53346a['shift']());}};_0x3ee341(++_0x191cab);}(_0x880d,0x100));var _0xd880=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x880d[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0xd880('0x0'));var util=require(_0xd880('0x1'));var path=require(_0xd880('0x2'));var timeout=require('connect-timeout');var express=require(_0xd880('0x3'));var router=express['Router']();var fs_extra=require(_0xd880('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd880('0x5'));var controller=require(_0xd880('0x6'));router[_0xd880('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd880('0x7')](_0xd880('0x8'),auth[_0xd880('0x9')](),controller[_0xd880('0xa')]);router[_0xd880('0x7')](_0xd880('0xb'),auth[_0xd880('0x9')](),controller[_0xd880('0xc')]);router['post']('/',auth[_0xd880('0x9')](),controller['create']);router[_0xd880('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd880('0xe')](_0xd880('0x8'),auth['isAuthenticated'](),controller[_0xd880('0xf')]);module[_0xd880('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index bccb870..d784b85 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 _0xdc54=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','days','minutes','csv','pdf','custom','TEXT'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc54,0x140));var _0x4dc5=function(_0x17f9a9,_0x10ea61){_0x17f9a9=_0x17f9a9-0x0;var _0x570ad1=_0xdc54[_0x17f9a9];return _0x570ad1;};'use strict';var Sequelize=require(_0x4dc5('0x0'));module[_0x4dc5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4dc5('0x2')]},'active':{'type':Sequelize[_0x4dc5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4dc5('0x4')},'startAt':{'type':Sequelize[_0x4dc5('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4dc5('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4dc5('0x7')](_0x4dc5('0x8'),'quarters',_0x4dc5('0x9'),'weeks',_0x4dc5('0xa'),'hours',_0x4dc5('0xb')),'allowNull':![],'defaultValue':_0x4dc5('0xa')},'output':{'type':Sequelize[_0x4dc5('0x7')](_0x4dc5('0xc'),_0x4dc5('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x4dc5('0x7')](_0x4dc5('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x4dc5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4dc5('0x2')]},'cc':{'type':Sequelize[_0x4dc5('0xf')]},'bcc':{'type':Sequelize[_0x4dc5('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x4dc5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4cee=['days','pdf','xlsx','csv','custom','default','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks','minutes'];(function(_0x5e2ab8,_0xd5df2f){var _0x4f56d5=function(_0x28ab41){while(--_0x28ab41){_0x5e2ab8['push'](_0x5e2ab8['shift']());}};_0x4f56d5(++_0xd5df2f);}(_0x4cee,0x15c));var _0xe4ce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4cee[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xe4ce('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4ce('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe4ce('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe4ce('0x2')},'startAt':{'type':Sequelize[_0xe4ce('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe4ce('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe4ce('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe4ce('0x5')]('years','quarters',_0xe4ce('0x6'),_0xe4ce('0x7'),'days','hours',_0xe4ce('0x8')),'allowNull':![],'defaultValue':_0xe4ce('0x9')},'output':{'type':Sequelize[_0xe4ce('0x5')]('csv',_0xe4ce('0xa'),_0xe4ce('0xb')),'allowNull':![],'defaultValue':_0xe4ce('0xc')},'type':{'type':Sequelize[_0xe4ce('0x5')](_0xe4ce('0xd'),_0xe4ce('0xe')),'allowNull':![],'defaultValue':_0xe4ce('0xd')},'sendMail':{'type':Sequelize[_0xe4ce('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xe4ce('0x1')]},'cc':{'type':Sequelize[_0xe4ce('0x10')]},'bcc':{'type':Sequelize[_0xe4ce('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xe4ce('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 102a20d..ae07878 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 _0x3ed2=['where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x32430c,_0x2d4225){var _0x148c09=function(_0x3406e2){while(--_0x3406e2){_0x32430c['push'](_0x32430c['shift']());}};_0x148c09(++_0x2d4225);}(_0x3ed2,0x6b));var _0x23ed=function(_0x233277,_0x2568a0){_0x233277=_0x233277-0x0;var _0x5d215e=_0x3ed2[_0x233277];return _0x5d215e;};'use strict';var emlformat=require(_0x23ed('0x0'));var rimraf=require(_0x23ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23ed('0x2'));var rp=require(_0x23ed('0x3'));var moment=require(_0x23ed('0x4'));var BPromise=require(_0x23ed('0x5'));var Mustache=require(_0x23ed('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x23ed('0x7'));var fs=require('fs');var fs_extra=require(_0x23ed('0x8'));var _=require('lodash');var squel=require(_0x23ed('0x9'));var crypto=require(_0x23ed('0xa'));var jsforce=require(_0x23ed('0xb'));var deskjs=require(_0x23ed('0xc'));var toCsv=require(_0x23ed('0xd'));var querystring=require('querystring');var Papa=require(_0x23ed('0xe'));var Redis=require(_0x23ed('0xf'));var authService=require(_0x23ed('0x10'));var qs=require(_0x23ed('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x23ed('0x12'))('api');var utils=require(_0x23ed('0x13'));var config=require(_0x23ed('0x14'));var licenseUtil=require(_0x23ed('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x481805,_0x394a05){_0x394a05=_0x394a05||0xcc;return function(_0x338ec4){if(_0x338ec4){return _0x481805[_0x23ed('0x16')](_0x394a05);}return _0x481805[_0x23ed('0x17')](_0x394a05)[_0x23ed('0x18')]();};}function respondWithResult(_0x4ff165,_0x3b91a5){_0x3b91a5=_0x3b91a5||0xc8;return function(_0x231d4d){if(_0x231d4d){return _0x4ff165[_0x23ed('0x17')](_0x3b91a5)['json'](_0x231d4d);}};}function respondWithFilteredResult(_0x3f0660,_0x39388e){return function(_0x47e6f8){if(_0x47e6f8){var _0x4c7f7b=typeof _0x39388e[_0x23ed('0x19')]===_0x23ed('0x1a')&&typeof _0x39388e[_0x23ed('0x1b')]===_0x23ed('0x1a');var _0x1fea54=_0x47e6f8['count'];var _0x4eb5a3=_0x4c7f7b?0x0:_0x39388e['offset'];var _0x4d4dfd=_0x4c7f7b?_0x47e6f8['count']:_0x39388e['offset']+_0x39388e[_0x23ed('0x1b')];var _0x1f7ca1;if(_0x4d4dfd>=_0x1fea54){_0x4d4dfd=_0x1fea54;_0x1f7ca1=0xc8;}else{_0x1f7ca1=0xce;}_0x3f0660[_0x23ed('0x17')](_0x1f7ca1);return _0x3f0660[_0x23ed('0x1c')](_0x23ed('0x1d'),_0x4eb5a3+'-'+_0x4d4dfd+'/'+_0x1fea54)[_0x23ed('0x1e')](_0x47e6f8);}return null;};}function patchUpdates(_0x10f2a2){return function(_0x52806f){try{jsonpatch[_0x23ed('0x1f')](_0x52806f,_0x10f2a2,!![]);}catch(_0x315094){return BPromise[_0x23ed('0x20')](_0x315094);}return _0x52806f[_0x23ed('0x21')]();};}function saveUpdates(_0x321e8c,_0x29c709){return function(_0x57d611){if(_0x57d611){return _0x57d611[_0x23ed('0x22')](_0x321e8c)[_0x23ed('0x23')](function(_0x156faf){return _0x156faf;});}return null;};}function removeEntity(_0x52b31e,_0x240466){return function(_0x227f9c){if(_0x227f9c){return _0x227f9c['destroy']()[_0x23ed('0x23')](function(){var _0x45e81d=_0x227f9c[_0x23ed('0x24')]({'plain':!![]});var _0xd312e4=_0x23ed('0x25');return db[_0x23ed('0x26')][_0x23ed('0x27')]({'where':{'type':_0xd312e4,'resourceId':_0x45e81d['id']}})[_0x23ed('0x23')](function(){return _0x227f9c;});})['then'](function(){_0x52b31e['status'](0xcc)[_0x23ed('0x18')]();});}};}function handleEntityNotFound(_0x100173,_0x4f3dfb){return function(_0x447f59){if(!_0x447f59){_0x100173[_0x23ed('0x16')](0x194);}return _0x447f59;};}function handleError(_0x5cb47d,_0x50f521){_0x50f521=_0x50f521||0x1f4;return function(_0x160d94){logger[_0x23ed('0x28')](_0x160d94[_0x23ed('0x29')]);if(_0x160d94['name']){delete _0x160d94[_0x23ed('0x2a')];}_0x5cb47d[_0x23ed('0x17')](_0x50f521)[_0x23ed('0x2b')](_0x160d94);};}exports[_0x23ed('0x2c')]=function(_0x3ed7a8,_0x28d339){var _0x148bf1={},_0x147bd8={},_0x4c2f6b={'count':0x0,'rows':[]};var _0x1b9784=_['map'](db[_0x23ed('0x2d')][_0x23ed('0x2e')],function(_0xc6cb34){return{'name':_0xc6cb34['fieldName'],'type':_0xc6cb34[_0x23ed('0x2f')][_0x23ed('0x30')]};});_0x147bd8[_0x23ed('0x31')]=_[_0x23ed('0x32')](_0x1b9784,_0x23ed('0x2a'));_0x147bd8[_0x23ed('0x33')]=_['keys'](_0x3ed7a8[_0x23ed('0x33')]);_0x147bd8[_0x23ed('0x34')]=_[_0x23ed('0x35')](_0x147bd8[_0x23ed('0x31')],_0x147bd8[_0x23ed('0x33')]);_0x148bf1[_0x23ed('0x36')]=_[_0x23ed('0x35')](_0x147bd8[_0x23ed('0x31')],qs[_0x23ed('0x37')](_0x3ed7a8['query'][_0x23ed('0x37')]));_0x148bf1[_0x23ed('0x36')]=_0x148bf1[_0x23ed('0x36')][_0x23ed('0x38')]?_0x148bf1['attributes']:_0x147bd8['model'];if(!_0x3ed7a8[_0x23ed('0x33')]['hasOwnProperty'](_0x23ed('0x39'))){_0x148bf1[_0x23ed('0x1b')]=qs['limit'](_0x3ed7a8[_0x23ed('0x33')][_0x23ed('0x1b')]);_0x148bf1[_0x23ed('0x19')]=qs[_0x23ed('0x19')](_0x3ed7a8[_0x23ed('0x33')][_0x23ed('0x19')]);}_0x148bf1['order']=qs[_0x23ed('0x3a')](_0x3ed7a8[_0x23ed('0x33')]['sort']);_0x148bf1[_0x23ed('0x3b')]=qs[_0x23ed('0x34')](_['pick'](_0x3ed7a8[_0x23ed('0x33')],_0x147bd8[_0x23ed('0x34')]),_0x1b9784);if(_0x3ed7a8[_0x23ed('0x33')][_0x23ed('0x3c')]){_0x148bf1[_0x23ed('0x3b')]=_[_0x23ed('0x3d')](_0x148bf1['where'],{'$or':_[_0x23ed('0x32')](_0x1b9784,function(_0x496bd9){if(_0x496bd9[_0x23ed('0x2f')]!=='VIRTUAL'){var _0x2d581d={};_0x2d581d[_0x496bd9[_0x23ed('0x2a')]]={'$like':'%'+_0x3ed7a8[_0x23ed('0x33')]['filter']+'%'};return _0x2d581d;}})});}_0x148bf1=_[_0x23ed('0x3d')]({},_0x148bf1,_0x3ed7a8[_0x23ed('0x3e')]);var _0x1d5dfc={'where':_0x148bf1[_0x23ed('0x3b')]};return db['Schedule'][_0x23ed('0x3f')](_0x1d5dfc)[_0x23ed('0x23')](function(_0x45c9d4){_0x4c2f6b['count']=_0x45c9d4;if(_0x3ed7a8[_0x23ed('0x33')][_0x23ed('0x40')]){_0x148bf1[_0x23ed('0x41')]=[{'all':!![]}];}return db[_0x23ed('0x2d')][_0x23ed('0x42')](_0x148bf1);})[_0x23ed('0x23')](function(_0x4bc140){_0x4c2f6b[_0x23ed('0x43')]=_0x4bc140;return _0x4c2f6b;})[_0x23ed('0x23')](respondWithFilteredResult(_0x28d339,_0x148bf1))[_0x23ed('0x44')](handleError(_0x28d339,null));};exports[_0x23ed('0x45')]=function(_0x250496,_0x2473a1){var _0x3967f8={'raw':![],'where':{'id':_0x250496[_0x23ed('0x46')]['id']}},_0x3fc616={};_0x3fc616[_0x23ed('0x31')]=_['keys'](db['Schedule'][_0x23ed('0x2e')]);_0x3fc616[_0x23ed('0x33')]=_[_0x23ed('0x47')](_0x250496[_0x23ed('0x33')]);_0x3fc616[_0x23ed('0x34')]=_['intersection'](_0x3fc616[_0x23ed('0x31')],_0x3fc616[_0x23ed('0x33')]);_0x3967f8['attributes']=_[_0x23ed('0x35')](_0x3fc616[_0x23ed('0x31')],qs[_0x23ed('0x37')](_0x250496['query']['fields']));_0x3967f8[_0x23ed('0x36')]=_0x3967f8['attributes'][_0x23ed('0x38')]?_0x3967f8[_0x23ed('0x36')]:_0x3fc616[_0x23ed('0x31')];if(_0x250496[_0x23ed('0x33')][_0x23ed('0x40')]){_0x3967f8[_0x23ed('0x41')]=[{'all':!![]}];}_0x3967f8=_[_0x23ed('0x3d')]({},_0x3967f8,_0x250496['options']);return db[_0x23ed('0x2d')]['find'](_0x3967f8)[_0x23ed('0x23')](handleEntityNotFound(_0x2473a1,null))[_0x23ed('0x23')](respondWithResult(_0x2473a1,null))['catch'](handleError(_0x2473a1,null));};exports[_0x23ed('0x48')]=function(_0x41ea8e,_0x149018){return db[_0x23ed('0x2d')][_0x23ed('0x48')](_0x41ea8e[_0x23ed('0x49')],{})['then'](function(_0x4e76a0){var _0x47d7d1=_0x41ea8e[_0x23ed('0x4a')][_0x23ed('0x24')]({'plain':!![]});if(!_0x47d7d1)throw new Error(_0x23ed('0x4b'));if(_0x47d7d1[_0x23ed('0x4c')]===_0x23ed('0x4a')){var _0x10bd39=_0x4e76a0[_0x23ed('0x24')]({'plain':!![]});var _0x4f9844=_0x23ed('0x25');return db['UserProfileSection'][_0x23ed('0x4d')]({'where':{'name':_0x4f9844,'userProfileId':_0x47d7d1[_0x23ed('0x4e')]},'raw':!![]})[_0x23ed('0x23')](function(_0x4292c0){if(_0x4292c0&&_0x4292c0[_0x23ed('0x4f')]===0x0){return db[_0x23ed('0x26')]['create']({'name':_0x10bd39['name'],'resourceId':_0x10bd39['id'],'type':_0x4292c0[_0x23ed('0x2a')],'sectionId':_0x4292c0['id']},{})['then'](function(){return _0x4e76a0;});}else{return _0x4e76a0;}})[_0x23ed('0x44')](function(_0x4d000c){logger['error'](_0x23ed('0x50'),_0x4d000c);throw _0x4d000c;});}return _0x4e76a0;})['then'](respondWithResult(_0x149018,0xc9))[_0x23ed('0x44')](handleError(_0x149018,null));};exports[_0x23ed('0x22')]=function(_0x1478ab,_0xd6212a){if(_0x1478ab[_0x23ed('0x49')]['id']){delete _0x1478ab[_0x23ed('0x49')]['id'];}return db['Schedule'][_0x23ed('0x4d')]({'where':{'id':_0x1478ab[_0x23ed('0x46')]['id']}})['then'](handleEntityNotFound(_0xd6212a,null))[_0x23ed('0x23')](saveUpdates(_0x1478ab[_0x23ed('0x49')],null))[_0x23ed('0x23')](respondWithResult(_0xd6212a,null))[_0x23ed('0x44')](handleError(_0xd6212a,null));};exports[_0x23ed('0x27')]=function(_0x116d62,_0x110836){return db[_0x23ed('0x2d')][_0x23ed('0x4d')]({'where':{'id':_0x116d62['params']['id']}})[_0x23ed('0x23')](handleEntityNotFound(_0x110836,null))['then'](removeEntity(_0x110836,null))[_0x23ed('0x44')](handleError(_0x110836,null));};exports[_0x23ed('0x51')]=function(_0x299f14,_0x1ca76f,_0xb40da8){var _0x4c06b2=require(_0x23ed('0x52'));return db['Schedule']['find']({'where':{'id':_0x299f14[_0x23ed('0x46')]['id']},'raw':!![]})[_0x23ed('0x23')](handleEntityNotFound(_0x1ca76f,null))[_0x23ed('0x23')](function(){_0x4c06b2[_0x23ed('0x51')](_0x299f14[_0x23ed('0x46')]['id']);})['then'](respondWithStatusCode(_0x1ca76f,null))[_0x23ed('0x44')](handleError(_0x1ca76f,null));}; \ No newline at end of file +var _0x576f=['lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','merge','type','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x576f,0xe8));var _0xf576=function(_0x513172,_0x160625){_0x513172=_0x513172-0x0;var _0x116dd1=_0x576f[_0x513172];return _0x116dd1;};'use strict';var emlformat=require(_0xf576('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf576('0x1'));var jsonpatch=require(_0xf576('0x2'));var rp=require(_0xf576('0x3'));var moment=require(_0xf576('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf576('0x5'));var path=require(_0xf576('0x6'));var sox=require('sox');var csv=require(_0xf576('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf576('0x8'));var squel=require(_0xf576('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf576('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf576('0xb'));var Papa=require(_0xf576('0xc'));var Redis=require(_0xf576('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf576('0xe'));var as=require(_0xf576('0xf'));var hardwareService=require(_0xf576('0x10'));var logger=require(_0xf576('0x11'))(_0xf576('0x12'));var utils=require(_0xf576('0x13'));var config=require(_0xf576('0x14'));var licenseUtil=require(_0xf576('0x15'));var db=require(_0xf576('0x16'))['db'];function respondWithStatusCode(_0x50c709,_0x428e89){_0x428e89=_0x428e89||0xcc;return function(_0x3a6fc4){if(_0x3a6fc4){return _0x50c709[_0xf576('0x17')](_0x428e89);}return _0x50c709[_0xf576('0x18')](_0x428e89)[_0xf576('0x19')]();};}function respondWithResult(_0x1a8bec,_0x3467dc){_0x3467dc=_0x3467dc||0xc8;return function(_0x26744e){if(_0x26744e){return _0x1a8bec[_0xf576('0x18')](_0x3467dc)[_0xf576('0x1a')](_0x26744e);}};}function respondWithFilteredResult(_0x26fd2a,_0x48ae49){return function(_0x150dd7){if(_0x150dd7){var _0x1342cb=typeof _0x48ae49['offset']==='undefined'&&typeof _0x48ae49[_0xf576('0x1b')]===_0xf576('0x1c');var _0x39c3a=_0x150dd7['count'];var _0x11c00f=_0x1342cb?0x0:_0x48ae49[_0xf576('0x1d')];var _0xb89d68=_0x1342cb?_0x150dd7[_0xf576('0x1e')]:_0x48ae49[_0xf576('0x1d')]+_0x48ae49['limit'];var _0x586a4f;if(_0xb89d68>=_0x39c3a){_0xb89d68=_0x39c3a;_0x586a4f=0xc8;}else{_0x586a4f=0xce;}_0x26fd2a[_0xf576('0x18')](_0x586a4f);return _0x26fd2a[_0xf576('0x1f')](_0xf576('0x20'),_0x11c00f+'-'+_0xb89d68+'/'+_0x39c3a)['json'](_0x150dd7);}return null;};}function patchUpdates(_0x5b4fb6){return function(_0x4da31d){try{jsonpatch[_0xf576('0x21')](_0x4da31d,_0x5b4fb6,!![]);}catch(_0x5bbb08){return BPromise['reject'](_0x5bbb08);}return _0x4da31d[_0xf576('0x22')]();};}function saveUpdates(_0x139e4a,_0x9f628d){return function(_0x515209){if(_0x515209){return _0x515209[_0xf576('0x23')](_0x139e4a)['then'](function(_0x5c2c80){return _0x5c2c80;});}return null;};}function removeEntity(_0x5d1ac7,_0x4fd609){return function(_0x496b9c){if(_0x496b9c){return _0x496b9c[_0xf576('0x24')]()[_0xf576('0x25')](function(){var _0x27a1a3=_0x496b9c[_0xf576('0x26')]({'plain':!![]});var _0x19eb4f='Scheduler';return db[_0xf576('0x27')][_0xf576('0x24')]({'where':{'type':_0x19eb4f,'resourceId':_0x27a1a3['id']}})[_0xf576('0x25')](function(){return _0x496b9c;});})[_0xf576('0x25')](function(){_0x5d1ac7[_0xf576('0x18')](0xcc)[_0xf576('0x19')]();});}};}function handleEntityNotFound(_0x4fbd1a,_0x3012d0){return function(_0x2b33f9){if(!_0x2b33f9){_0x4fbd1a[_0xf576('0x17')](0x194);}return _0x2b33f9;};}function handleError(_0x472d37,_0xa7bbd0){_0xa7bbd0=_0xa7bbd0||0x1f4;return function(_0x361645){logger[_0xf576('0x28')](_0x361645[_0xf576('0x29')]);if(_0x361645[_0xf576('0x2a')]){delete _0x361645[_0xf576('0x2a')];}_0x472d37[_0xf576('0x18')](_0xa7bbd0)[_0xf576('0x2b')](_0x361645);};}exports[_0xf576('0x2c')]=function(_0x340eed,_0x53115f){var _0xf9b384={},_0x1a8f2b={},_0x4a281e={'count':0x0,'rows':[]};var _0x274021=_[_0xf576('0x2d')](db[_0xf576('0x2e')][_0xf576('0x2f')],function(_0x3608ef){return{'name':_0x3608ef[_0xf576('0x30')],'type':_0x3608ef['type'][_0xf576('0x31')]};});_0x1a8f2b[_0xf576('0x32')]=_[_0xf576('0x2d')](_0x274021,_0xf576('0x2a'));_0x1a8f2b['query']=_[_0xf576('0x33')](_0x340eed['query']);_0x1a8f2b[_0xf576('0x34')]=_[_0xf576('0x35')](_0x1a8f2b['model'],_0x1a8f2b[_0xf576('0x36')]);_0xf9b384[_0xf576('0x37')]=_['intersection'](_0x1a8f2b[_0xf576('0x32')],qs[_0xf576('0x38')](_0x340eed['query'][_0xf576('0x38')]));_0xf9b384[_0xf576('0x37')]=_0xf9b384[_0xf576('0x37')]['length']?_0xf9b384[_0xf576('0x37')]:_0x1a8f2b[_0xf576('0x32')];if(!_0x340eed[_0xf576('0x36')]['hasOwnProperty'](_0xf576('0x39'))){_0xf9b384[_0xf576('0x1b')]=qs[_0xf576('0x1b')](_0x340eed[_0xf576('0x36')]['limit']);_0xf9b384[_0xf576('0x1d')]=qs['offset'](_0x340eed['query'][_0xf576('0x1d')]);}_0xf9b384[_0xf576('0x3a')]=qs['sort'](_0x340eed[_0xf576('0x36')][_0xf576('0x3b')]);_0xf9b384[_0xf576('0x3c')]=qs[_0xf576('0x34')](_['pick'](_0x340eed['query'],_0x1a8f2b[_0xf576('0x34')]),_0x274021);if(_0x340eed[_0xf576('0x36')]['filter']){_0xf9b384[_0xf576('0x3c')]=_[_0xf576('0x3d')](_0xf9b384[_0xf576('0x3c')],{'$or':_[_0xf576('0x2d')](_0x274021,function(_0x329002){if(_0x329002[_0xf576('0x3e')]!=='VIRTUAL'){var _0x3f00b2={};_0x3f00b2[_0x329002[_0xf576('0x2a')]]={'$like':'%'+_0x340eed[_0xf576('0x36')]['filter']+'%'};return _0x3f00b2;}})});}_0xf9b384=_[_0xf576('0x3d')]({},_0xf9b384,_0x340eed['options']);var _0x544bc1={'where':_0xf9b384[_0xf576('0x3c')]};return db[_0xf576('0x2e')][_0xf576('0x1e')](_0x544bc1)[_0xf576('0x25')](function(_0x477f74){_0x4a281e[_0xf576('0x1e')]=_0x477f74;if(_0x340eed[_0xf576('0x36')][_0xf576('0x3f')]){_0xf9b384[_0xf576('0x40')]=[{'all':!![]}];}return db[_0xf576('0x2e')]['findAll'](_0xf9b384);})[_0xf576('0x25')](function(_0x14bec7){_0x4a281e[_0xf576('0x41')]=_0x14bec7;return _0x4a281e;})[_0xf576('0x25')](respondWithFilteredResult(_0x53115f,_0xf9b384))[_0xf576('0x42')](handleError(_0x53115f,null));};exports[_0xf576('0x43')]=function(_0xe7b34f,_0x9dae73){var _0x52b888={'raw':![],'where':{'id':_0xe7b34f[_0xf576('0x44')]['id']}},_0x1c5658={};_0x1c5658[_0xf576('0x32')]=_[_0xf576('0x33')](db[_0xf576('0x2e')][_0xf576('0x2f')]);_0x1c5658[_0xf576('0x36')]=_[_0xf576('0x33')](_0xe7b34f[_0xf576('0x36')]);_0x1c5658[_0xf576('0x34')]=_[_0xf576('0x35')](_0x1c5658[_0xf576('0x32')],_0x1c5658[_0xf576('0x36')]);_0x52b888['attributes']=_[_0xf576('0x35')](_0x1c5658[_0xf576('0x32')],qs[_0xf576('0x38')](_0xe7b34f[_0xf576('0x36')][_0xf576('0x38')]));_0x52b888[_0xf576('0x37')]=_0x52b888[_0xf576('0x37')][_0xf576('0x45')]?_0x52b888[_0xf576('0x37')]:_0x1c5658['model'];if(_0xe7b34f[_0xf576('0x36')][_0xf576('0x3f')]){_0x52b888[_0xf576('0x40')]=[{'all':!![]}];}_0x52b888=_[_0xf576('0x3d')]({},_0x52b888,_0xe7b34f[_0xf576('0x46')]);return db[_0xf576('0x2e')][_0xf576('0x47')](_0x52b888)[_0xf576('0x25')](handleEntityNotFound(_0x9dae73,null))['then'](respondWithResult(_0x9dae73,null))[_0xf576('0x42')](handleError(_0x9dae73,null));};exports[_0xf576('0x48')]=function(_0x287929,_0x39be7c){return db[_0xf576('0x2e')]['create'](_0x287929[_0xf576('0x49')],{})['then'](function(_0x1db2a7){var _0x2c8c93=_0x287929[_0xf576('0x4a')][_0xf576('0x26')]({'plain':!![]});if(!_0x2c8c93)throw new Error(_0xf576('0x4b'));if(_0x2c8c93[_0xf576('0x4c')]===_0xf576('0x4a')){var _0x3e4372=_0x1db2a7[_0xf576('0x26')]({'plain':!![]});var _0x28bb2d=_0xf576('0x4d');return db[_0xf576('0x4e')][_0xf576('0x47')]({'where':{'name':_0x28bb2d,'userProfileId':_0x2c8c93[_0xf576('0x4f')]},'raw':!![]})[_0xf576('0x25')](function(_0xf659c9){if(_0xf659c9&&_0xf659c9['autoAssociation']===0x0){return db[_0xf576('0x27')][_0xf576('0x48')]({'name':_0x3e4372[_0xf576('0x2a')],'resourceId':_0x3e4372['id'],'type':_0xf659c9['name'],'sectionId':_0xf659c9['id']},{})[_0xf576('0x25')](function(){return _0x1db2a7;});}else{return _0x1db2a7;}})[_0xf576('0x42')](function(_0x46fcbf){logger[_0xf576('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46fcbf);throw _0x46fcbf;});}return _0x1db2a7;})[_0xf576('0x25')](respondWithResult(_0x39be7c,0xc9))[_0xf576('0x42')](handleError(_0x39be7c,null));};exports[_0xf576('0x23')]=function(_0x50b195,_0x593ded){if(_0x50b195['body']['id']){delete _0x50b195[_0xf576('0x49')]['id'];}return db['Schedule']['find']({'where':{'id':_0x50b195[_0xf576('0x44')]['id']}})[_0xf576('0x25')](handleEntityNotFound(_0x593ded,null))[_0xf576('0x25')](saveUpdates(_0x50b195[_0xf576('0x49')],null))[_0xf576('0x25')](respondWithResult(_0x593ded,null))['catch'](handleError(_0x593ded,null));};exports[_0xf576('0x24')]=function(_0x24ad1f,_0x430ce4){return db[_0xf576('0x2e')]['find']({'where':{'id':_0x24ad1f['params']['id']}})[_0xf576('0x25')](handleEntityNotFound(_0x430ce4,null))[_0xf576('0x25')](removeEntity(_0x430ce4,null))[_0xf576('0x42')](handleError(_0x430ce4,null));};exports['run']=function(_0x4b5465,_0x48da51,_0x277a17){var _0x26c44a=require('../../config/schedule');return db[_0xf576('0x2e')]['find']({'where':{'id':_0x4b5465[_0xf576('0x44')]['id']},'raw':!![]})[_0xf576('0x25')](handleEntityNotFound(_0x48da51,null))['then'](function(){_0x26c44a['run'](_0x4b5465['params']['id']);})['then'](respondWithStatusCode(_0x48da51,null))['catch'](handleError(_0x48da51,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c04aaa0..31faa82 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 _0x8685=['api','bluebird','request-promise','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger'];(function(_0xc5c9ac,_0x57c492){var _0x3f4606=function(_0x2aa448){while(--_0x2aa448){_0xc5c9ac['push'](_0xc5c9ac['shift']());}};_0x3f4606(++_0x57c492);}(_0x8685,0x1bf));var _0x5868=function(_0x257ef5,_0x3c5bcf){_0x257ef5=_0x257ef5-0x0;var _0x462e13=_0x8685[_0x257ef5];return _0x462e13;};'use strict';var _=require(_0x5868('0x0'));var util=require(_0x5868('0x1'));var logger=require(_0x5868('0x2'))(_0x5868('0x3'));var moment=require('moment');var BPromise=require(_0x5868('0x4'));var rp=require(_0x5868('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5868('0x6'));module[_0x5868('0x7')]=function(_0x3a4790,_0x52ead2){return _0x3a4790[_0x5868('0x8')](_0x5868('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc62f=['moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','tools_schedules','lodash','util','api'];(function(_0xe3752c,_0x4e6169){var _0x2ce6e2=function(_0x1ea7c5){while(--_0x1ea7c5){_0xe3752c['push'](_0xe3752c['shift']());}};_0x2ce6e2(++_0x4e6169);}(_0xc62f,0x10b));var _0xfc62=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc62f[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xfc62('0x0'));var util=require(_0xfc62('0x1'));var logger=require('../../config/logger')(_0xfc62('0x2'));var moment=require(_0xfc62('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc62('0x4'));var fs=require('fs');var path=require(_0xfc62('0x5'));var rimraf=require(_0xfc62('0x6'));var config=require(_0xfc62('0x7'));var attributes=require(_0xfc62('0x8'));module['exports']=function(_0x5845b4,_0x15bca3){return _0x5845b4['define']('Schedule',attributes,{'tableName':_0xfc62('0x9'),'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 5f2482e..3a41fe3 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 _0x4d62=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xee209,_0x4858f4){var _0x48cd8c=function(_0x5e3eda){while(--_0x5e3eda){_0xee209['push'](_0xee209['shift']());}};_0x48cd8c(++_0x4858f4);}(_0x4d62,0x13e));var _0x24d6=function(_0x4d9b1f,_0x30d7ee){_0x4d9b1f=_0x4d9b1f-0x0;var _0xa0d1c6=_0x4d62[_0x4d9b1f];return _0xa0d1c6;};'use strict';var _=require(_0x24d6('0x0'));var util=require(_0x24d6('0x1'));var moment=require('moment');var BPromise=require(_0x24d6('0x2'));var rs=require(_0x24d6('0x3'));var fs=require('fs');var Redis=require(_0x24d6('0x4'));var db=require(_0x24d6('0x5'))['db'];var utils=require(_0x24d6('0x6'));var logger=require(_0x24d6('0x7'))(_0x24d6('0x8'));var config=require(_0x24d6('0x9'));var jayson=require(_0x24d6('0xa'));var client=jayson[_0x24d6('0xb')][_0x24d6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3437ea,_0x5eb536,_0x4b44cd){return new BPromise(function(_0x541d89,_0x5c3885){return client[_0x24d6('0xd')](_0x3437ea,_0x4b44cd)[_0x24d6('0xe')](function(_0x96e651){logger['info'](_0x24d6('0xf'),_0x5eb536,_0x24d6('0x10'));logger[_0x24d6('0x11')](_0x24d6('0x12'),_0x5eb536,'request\x20sent',JSON[_0x24d6('0x13')](_0x96e651));if(_0x96e651[_0x24d6('0x14')]){if(_0x96e651['error'][_0x24d6('0x15')]===0x1f4){logger[_0x24d6('0x14')]('Schedule,\x20%s,\x20%s',_0x5eb536,_0x96e651[_0x24d6('0x14')]['message']);return _0x5c3885(_0x96e651[_0x24d6('0x14')]['message']);}logger[_0x24d6('0x14')]('Schedule,\x20%s,\x20%s',_0x5eb536,_0x96e651[_0x24d6('0x14')][_0x24d6('0x16')]);return _0x541d89(_0x96e651['error'][_0x24d6('0x16')]);}else{logger[_0x24d6('0x17')](_0x24d6('0xf'),_0x5eb536,_0x24d6('0x10'));_0x541d89(_0x96e651[_0x24d6('0x18')][_0x24d6('0x16')]);}})[_0x24d6('0x19')](function(_0x3f06c3){logger[_0x24d6('0x14')](_0x24d6('0xf'),_0x5eb536,_0x3f06c3);_0x5c3885(_0x3f06c3);});});} \ No newline at end of file +var _0x16e7=['request\x20sent','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0x1f7d8c,_0x33dd14){var _0x44856d=function(_0x56cf16){while(--_0x56cf16){_0x1f7d8c['push'](_0x1f7d8c['shift']());}};_0x44856d(++_0x33dd14);}(_0x16e7,0xb9));var _0x716e=function(_0x25e4a5,_0x4e2554){_0x25e4a5=_0x25e4a5-0x0;var _0x479f98=_0x16e7[_0x25e4a5];return _0x479f98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x716e('0x0'));var BPromise=require(_0x716e('0x1'));var rs=require(_0x716e('0x2'));var fs=require('fs');var Redis=require(_0x716e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x716e('0x4'))(_0x716e('0x5'));var config=require(_0x716e('0x6'));var jayson=require(_0x716e('0x7'));var client=jayson[_0x716e('0x8')][_0x716e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2117bd,_0x203738,_0x412d9a){return new BPromise(function(_0xdcd127,_0x23800a){return client[_0x716e('0xa')](_0x2117bd,_0x412d9a)[_0x716e('0xb')](function(_0x48964c){logger[_0x716e('0xc')](_0x716e('0xd'),_0x203738,'request\x20sent');logger['debug'](_0x716e('0xe'),_0x203738,_0x716e('0xf'),JSON['stringify'](_0x48964c));if(_0x48964c[_0x716e('0x10')]){if(_0x48964c['error'][_0x716e('0x11')]===0x1f4){logger[_0x716e('0x10')](_0x716e('0xd'),_0x203738,_0x48964c[_0x716e('0x10')][_0x716e('0x12')]);return _0x23800a(_0x48964c[_0x716e('0x10')]['message']);}logger[_0x716e('0x10')](_0x716e('0xd'),_0x203738,_0x48964c[_0x716e('0x10')][_0x716e('0x12')]);return _0xdcd127(_0x48964c['error'][_0x716e('0x12')]);}else{logger[_0x716e('0xc')](_0x716e('0xd'),_0x203738,_0x716e('0xf'));_0xdcd127(_0x48964c['result'][_0x716e('0x12')]);}})[_0x716e('0x13')](function(_0x4ebaf5){logger['error'](_0x716e('0xd'),_0x203738,_0x4ebaf5);_0x23800a(_0x4ebaf5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2f65a70..e810b3c 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 _0x2247=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','put','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x2247,0xb5));var _0x7224=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2247[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x7224('0x0'));var path=require(_0x7224('0x1'));var timeout=require(_0x7224('0x2'));var express=require(_0x7224('0x3'));var router=express[_0x7224('0x4')]();var fs_extra=require(_0x7224('0x5'));var auth=require(_0x7224('0x6'));var interaction=require(_0x7224('0x7'));var config=require(_0x7224('0x8'));var controller=require('./screenRecording.controller');router[_0x7224('0x9')]('/',auth[_0x7224('0xa')](),controller[_0x7224('0xb')]);router[_0x7224('0x9')](_0x7224('0xc'),auth[_0x7224('0xa')](),controller[_0x7224('0xd')]);router[_0x7224('0x9')]('/:id',auth[_0x7224('0xa')](),controller[_0x7224('0xe')]);router[_0x7224('0x9')](_0x7224('0xf'),auth[_0x7224('0xa')](),controller[_0x7224('0x10')]);router[_0x7224('0x11')]('/',auth[_0x7224('0xa')](),controller[_0x7224('0x12')]);router[_0x7224('0x13')]('/:id',auth[_0x7224('0xa')](),controller['update']);router[_0x7224('0x14')](_0x7224('0x15'),auth[_0x7224('0xa')](),controller[_0x7224('0x16')]);module['exports']=router; \ No newline at end of file +var _0xef37=['download','post','create','put','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show'];(function(_0x357f63,_0x2b641e){var _0x4e9400=function(_0x3cd2f5){while(--_0x3cd2f5){_0x357f63['push'](_0x357f63['shift']());}};_0x4e9400(++_0x2b641e);}(_0xef37,0x1a9));var _0x7ef3=function(_0x22e870,_0x4ecf1f){_0x22e870=_0x22e870-0x0;var _0x2b7acb=_0xef37[_0x22e870];return _0x2b7acb;};'use strict';var multer=require('multer');var util=require(_0x7ef3('0x0'));var path=require(_0x7ef3('0x1'));var timeout=require(_0x7ef3('0x2'));var express=require('express');var router=express[_0x7ef3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ef3('0x4'));var interaction=require(_0x7ef3('0x5'));var config=require(_0x7ef3('0x6'));var controller=require('./screenRecording.controller');router[_0x7ef3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7ef3('0x7')](_0x7ef3('0x8'),auth[_0x7ef3('0x9')](),controller[_0x7ef3('0xa')]);router[_0x7ef3('0x7')]('/:id',auth[_0x7ef3('0x9')](),controller[_0x7ef3('0xb')]);router[_0x7ef3('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x7ef3('0xc')]);router[_0x7ef3('0xd')]('/',auth[_0x7ef3('0x9')](),controller[_0x7ef3('0xe')]);router[_0x7ef3('0xf')](_0x7ef3('0x10'),auth[_0x7ef3('0x9')](),controller['update']);router['delete'](_0x7ef3('0x10'),auth['isAuthenticated'](),controller[_0x7ef3('0x11')]);module[_0x7ef3('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 54c0c49..79eea74 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 _0x6a55=['DATE','createdAt','updatedAt','sequelize','exports','value','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x6a55,0xdb));var _0x56a5=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x6a55[_0x4e697a];return _0x88850c;};'use strict';var Sequelize=require(_0x56a5('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0x56a5('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x56a5('0x2'))?path['extname'](this[_0x56a5('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x56a5('0x4')]},'channel':{'type':Sequelize[_0x56a5('0x4')]},'value':{'type':Sequelize[_0x56a5('0x4')],'set':function(_0x293ea1){var _0x444c65=_0x293ea1[_0x56a5('0x5')](/\\/g,'/');this[_0x56a5('0x6')](_0x56a5('0x2'),_0x444c65);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x56a5('0x7')],'set':function(_0xf15490){this[_0x56a5('0x6')](_0x56a5('0x8'),moment()[_0x56a5('0x9')](_0xf15490,'ms'));this[_0x56a5('0x6')](_0x56a5('0xa'),moment());this[_0x56a5('0x6')](_0x56a5('0xb'),_0xf15490);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x56a5('0x8')))[_0x56a5('0xc')](_0x56a5('0xd'))[_0x56a5('0xe')]();}},'closedAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this[_0x56a5('0x3')]('closedAt'))['format'](_0x56a5('0xd'))[_0x56a5('0xe')]();}},'createdAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this[_0x56a5('0x3')](_0x56a5('0x10')))[_0x56a5('0xc')](_0x56a5('0xd'))['toString']();}},'updatedAt':{'type':Sequelize[_0x56a5('0xf')],'get':function(){return moment(this['getDataValue'](_0x56a5('0x11')))['format'](_0x56a5('0xd'))[_0x56a5('0xe')]();}}}; \ No newline at end of file +var _0x7374=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x12c3db,_0x5a990a){var _0x1d7484=function(_0x3dab8b){while(--_0x3dab8b){_0x12c3db['push'](_0x12c3db['shift']());}};_0x1d7484(++_0x5a990a);}(_0x7374,0x1b9));var _0x4737=function(_0x30f994,_0xac7f70){_0x30f994=_0x30f994-0x0;var _0xc30fca=_0x7374[_0x30f994];return _0xc30fca;};'use strict';var Sequelize=require(_0x4737('0x0'));var moment=require(_0x4737('0x1'));var path=require(_0x4737('0x2'));var config=require(_0x4737('0x3'));module[_0x4737('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4737('0x5')](_0x4737('0x6'))?path[_0x4737('0x7')](this[_0x4737('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4737('0x8')]},'value':{'type':Sequelize[_0x4737('0x8')],'set':function(_0x311410){var _0x3d18dd=_0x311410['replace'](/\\/g,'/');this[_0x4737('0x9')](_0x4737('0x6'),_0x3d18dd);}},'rating':{'type':Sequelize[_0x4737('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4737('0xa')],'set':function(_0x46ddeb){this['setDataValue'](_0x4737('0xb'),moment()[_0x4737('0xc')](_0x46ddeb,'ms'));this[_0x4737('0x9')]('closedAt',moment());this['setDataValue'](_0x4737('0xd'),_0x46ddeb);}},'startedAt':{'type':Sequelize[_0x4737('0xe')],'get':function(){return moment(this[_0x4737('0x5')](_0x4737('0xb')))[_0x4737('0xf')](_0x4737('0x10'))[_0x4737('0x11')]();}},'closedAt':{'type':Sequelize[_0x4737('0xe')],'get':function(){return moment(this[_0x4737('0x5')]('closedAt'))[_0x4737('0xf')](_0x4737('0x10'))[_0x4737('0x11')]();}},'createdAt':{'type':Sequelize[_0x4737('0xe')],'get':function(){return moment(this[_0x4737('0x5')]('createdAt'))['format'](_0x4737('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x4737('0xe')],'get':function(){return moment(this[_0x4737('0x5')]('updatedAt'))[_0x4737('0xf')](_0x4737('0x10'))[_0x4737('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 21d961e..3e8833e 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 _0xeec6=['options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','find','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ScreenRecording','rawAttributes','fieldName','type','model','format','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x23df6e,_0x1f65c6){var _0x1048fe=function(_0x4e1e53){while(--_0x4e1e53){_0x23df6e['push'](_0x23df6e['shift']());}};_0x1048fe(++_0x1f65c6);}(_0xeec6,0x1c2));var _0x6eec=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xeec6[_0x500785];return _0x1f8bcc;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require('request-promise');var moment=require(_0x6eec('0x4'));var BPromise=require(_0x6eec('0x5'));var Mustache=require(_0x6eec('0x6'));var util=require(_0x6eec('0x7'));var path=require(_0x6eec('0x8'));var sox=require(_0x6eec('0x9'));var csv=require('to-csv');var ejs=require(_0x6eec('0xa'));var fs=require('fs');var fs_extra=require(_0x6eec('0xb'));var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=typeof _0x393271['offset']===_0x6eec('0x1b')&&typeof _0x393271['limit']===_0x6eec('0x1b');var _0x45aa3f=_0x34a7fc['count'];var _0x3ee353=_0x2ac797?0x0:_0x393271[_0x6eec('0x1c')];var _0xb1eab7=_0x2ac797?_0x34a7fc['count']:_0x393271[_0x6eec('0x1c')]+_0x393271[_0x6eec('0x1d')];var _0x3c7152;if(_0xb1eab7>=_0x45aa3f){_0xb1eab7=_0x45aa3f;_0x3c7152=0xc8;}else{_0x3c7152=0xce;}_0x345852[_0x6eec('0x19')](_0x3c7152);return _0x345852[_0x6eec('0x1e')](_0x6eec('0x1f'),_0x3ee353+'-'+_0xb1eab7+'/'+_0x45aa3f)['json'](_0x34a7fc);}return null;};}function patchUpdates(_0x328693){return function(_0x2f843e){try{jsonpatch[_0x6eec('0x20')](_0x2f843e,_0x328693,!![]);}catch(_0x34522a){return BPromise[_0x6eec('0x21')](_0x34522a);}return _0x2f843e[_0x6eec('0x22')]();};}function saveUpdates(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')](_0x52f941)[_0x6eec('0x24')](function(_0x409b26){return _0x409b26;});}return null;};}function removeEntity(_0x13863c,_0x573249){return function(_0x384586){if(_0x384586){return _0x384586[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x13863c[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x1f386c,_0x29879c){return function(_0x20bed3){if(!_0x20bed3){_0x1f386c[_0x6eec('0x17')](0x194);}return _0x20bed3;};}function handleError(_0x58f95c,_0x1d750c){_0x1d750c=_0x1d750c||0x1f4;return function(_0x44b31c){logger[_0x6eec('0x26')](_0x44b31c[_0x6eec('0x27')]);if(_0x44b31c['name']){delete _0x44b31c[_0x6eec('0x28')];}_0x58f95c[_0x6eec('0x19')](_0x1d750c)['send'](_0x44b31c);};}exports['index']=function(_0x3240c3,_0x47ed95){var _0x20a130={},_0xede270={},_0x3bbdf8={'count':0x0,'rows':[]};var _0x34bdea=_[_0x6eec('0x29')](db[_0x6eec('0x2a')][_0x6eec('0x2b')],function(_0x33e4a1){return{'name':_0x33e4a1[_0x6eec('0x2c')],'type':_0x33e4a1[_0x6eec('0x2d')]['key']};});_0xede270[_0x6eec('0x2e')]=_['differenceBy'](_[_0x6eec('0x29')](_0x34bdea,_0x6eec('0x28')),[_0x6eec('0x2f')]);_0xede270['query']=_['keys'](_0x3240c3['query']);_0xede270[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],_0xede270[_0x6eec('0x32')]);_0x20a130[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0xede270[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x34')]));_0x20a130[_0x6eec('0x33')]=_0x20a130[_0x6eec('0x33')]['length']?_0x20a130[_0x6eec('0x33')]:_0xede270[_0x6eec('0x2e')];if(!_0x3240c3[_0x6eec('0x32')]['hasOwnProperty'](_0x6eec('0x35'))){_0x20a130[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1d')]);_0x20a130[_0x6eec('0x1c')]=qs['offset'](_0x3240c3[_0x6eec('0x32')][_0x6eec('0x1c')]);}_0x20a130[_0x6eec('0x36')]=qs['sort'](_0x3240c3['query'][_0x6eec('0x37')]);_0x20a130[_0x6eec('0x38')]=qs[_0x6eec('0x30')](_[_0x6eec('0x39')](_0x3240c3[_0x6eec('0x32')],_0xede270['filters']),_0x34bdea);if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3a')]){_0x20a130[_0x6eec('0x38')]=_[_0x6eec('0x3b')](_0x20a130[_0x6eec('0x38')],{'$or':_[_0x6eec('0x29')](_0x34bdea,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x3240c3['query']['filter']+'%'};return _0x2f7a75;}})});}_0x20a130=_[_0x6eec('0x3b')]({},_0x20a130,_0x3240c3[_0x6eec('0x3c')]);var _0xf056e0={'where':_0x20a130[_0x6eec('0x38')]};return db['ScreenRecording']['count'](_0xf056e0)[_0x6eec('0x24')](function(_0x48fbf6){_0x3bbdf8['count']=_0x48fbf6;if(_0x3240c3[_0x6eec('0x32')][_0x6eec('0x3d')]){_0x20a130[_0x6eec('0x3e')]=[{'all':!![]}];}return db[_0x6eec('0x2a')][_0x6eec('0x3f')](_0x20a130);})['then'](function(_0x931bcf){_0x3bbdf8[_0x6eec('0x40')]=_0x931bcf;return _0x3bbdf8;})['then'](respondWithFilteredResult(_0x47ed95,_0x20a130))[_0x6eec('0x41')](handleError(_0x47ed95,null));};exports[_0x6eec('0x42')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x43')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x44')](db[_0x6eec('0x2a')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x32')]=_[_0x6eec('0x44')](_0x5028a2[_0x6eec('0x32')]);_0x4e3b1e[_0x6eec('0x30')]=_[_0x6eec('0x31')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x33')]=_[_0x6eec('0x31')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x34')](_0x5028a2[_0x6eec('0x32')]['fields']));_0x44d75d[_0x6eec('0x33')]=_0x44d75d['attributes'][_0x6eec('0x45')]?_0x44d75d[_0x6eec('0x33')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3d')]){_0x44d75d[_0x6eec('0x3e')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3b')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3c')]);return db[_0x6eec('0x2a')]['find'](_0x44d75d)[_0x6eec('0x24')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x46')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2a')][_0x6eec('0x46')](_0x535d96['body'],{})['then'](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x41')](handleError(_0x245a1b,null));};exports[_0x6eec('0x23')]=function(_0x1d6626,_0x2d0fc0){if(_0x1d6626[_0x6eec('0x47')]['id']){delete _0x1d6626[_0x6eec('0x47')]['id'];}delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x48')];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x49')];delete _0x1d6626['body']['closedAt'];delete _0x1d6626[_0x6eec('0x47')][_0x6eec('0x4a')];return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x1d6626[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x2d0fc0,null))[_0x6eec('0x24')](saveUpdates(_0x1d6626[_0x6eec('0x47')],null))[_0x6eec('0x24')](respondWithResult(_0x2d0fc0,null))[_0x6eec('0x41')](handleError(_0x2d0fc0,null));};exports[_0x6eec('0x4b')]=function(_0x413de9,_0x5a6e05){return db[_0x6eec('0x2a')][_0x6eec('0x4b')]()[_0x6eec('0x24')](respondWithResult(_0x5a6e05,null))[_0x6eec('0x41')](handleError(_0x5a6e05,null));};exports['download']=function(_0x51fd37,_0x50436d,_0x36c49b){var _0x32b289=require(_0x6eec('0x4c'));var _0x1de626=![];var _0x5178f5={};if(_0x51fd37['query'][_0x6eec('0x2d')]&&_0x51fd37[_0x6eec('0x32')][_0x6eec('0x2d')]==='uniqueid'){_0x5178f5[_0x6eec('0x4d')]=_0x51fd37[_0x6eec('0x43')]['id'];}else{_0x5178f5['id']=_0x51fd37[_0x6eec('0x43')]['id'];}return db[_0x6eec('0x2a')][_0x6eec('0x4e')]({'where':_0x5178f5,'attributes':['id',_0x6eec('0x4a')],'raw':!![]})[_0x6eec('0x24')](handleEntityNotFound(_0x50436d,null))[_0x6eec('0x24')](function(_0x45fed3){if(_0x45fed3){var _0x4e921a=path[_0x6eec('0x4f')](config['root'],_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4a')]);var _0x424962=util[_0x6eec('0x2f')](_0x6eec('0x51'),_0x4e921a);if(fs[_0x6eec('0x52')](_0x424962)){_0x1de626=!![];return _0x32b289[_0x6eec('0x53')](_0x424962,_0x4e921a,config['secrets'][_0x6eec('0x54')])['then'](function(){return _0x45fed3;});}return _0x45fed3;}})[_0x6eec('0x24')](function(_0x5c905f){if(_0x5c905f){var _0x237324=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x5c905f[_0x6eec('0x4a')]);if(!fs[_0x6eec('0x52')](_0x237324)){throw new db[(_0x6eec('0x56'))][(_0x6eec('0x57'))](_0x6eec('0x58'));}if(_0x5c905f[_0x6eec('0x59')]){return _0x50436d['download'](_0x237324,_0x5c905f['filename']+path[_0x6eec('0x5a')](_0x237324),function(){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}else{return _0x50436d[_0x6eec('0x5c')](_0x237324,function(_0x2c0644){if(_0x1de626){fs[_0x6eec('0x5b')](_0x237324);}});}}})['catch'](function(_0x1d8fb1){if(_0x1d8fb1[_0x6eec('0x5d')]==='ScreenRecording\x20not\x20found'){_0x50436d['status'](0x194)['send'](_0x6eec('0x5e'));}else{return handleError(_0x50436d,null);}});};exports[_0x6eec('0x25')]=function(_0x4cf859,_0x1d2baf){return db[_0x6eec('0x2a')]['find']({'where':{'id':_0x4cf859[_0x6eec('0x43')]['id']}})[_0x6eec('0x24')](function(_0xc852b3){if(_[_0x6eec('0x5f')](_0xc852b3)){throw new ReferenceError('Entity\x20not\x20found');}return _0xc852b3;})['then'](function(_0x54fcd0){var _0x1230fc=path[_0x6eec('0x4f')](config[_0x6eec('0x55')],_0x6eec('0x50'),_0x54fcd0[_0x6eec('0x4a')]);logger[_0x6eec('0x60')](_0x6eec('0x61'),_0x1230fc);if(!_[_0x6eec('0x5f')](_0x54fcd0[_0x6eec('0x4a')])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')](_0x6eec('0x62')+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}_0x1230fc=_0x1230fc+_0x6eec('0x65');if(!_[_0x6eec('0x5f')](_0x54fcd0['value'])&&fs[_0x6eec('0x52')](_0x1230fc)){logger[_0x6eec('0x60')]('File:\x20\x22'+_0x1230fc+_0x6eec('0x63'));fs[_0x6eec('0x64')](_0x1230fc);}return _0x54fcd0;})['then'](function(_0x7dd727){if(!_0x7dd727)throw new InternalError();return _0x7dd727[_0x6eec('0x25')]();})[_0x6eec('0x24')](function(){_0x1d2baf[_0x6eec('0x19')](0xcc)['end']();})[_0x6eec('0x41')](handleError(_0x1d2baf,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(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0x9a19,0x114));var _0x99a1=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x9a19[_0xef8146];return _0x5a6cb0;};'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 978fefa..883705e 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 _0x9de7=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x4590b2,_0x209e6c){var _0x21b9fa=function(_0x1b0f50){while(--_0x1b0f50){_0x4590b2['push'](_0x4590b2['shift']());}};_0x21b9fa(++_0x209e6c);}(_0x9de7,0x66));var _0x79de=function(_0xb1c5d5,_0x3a2038){_0xb1c5d5=_0xb1c5d5-0x0;var _0x3766dc=_0x9de7[_0xb1c5d5];return _0x3766dc;};'use strict';var _=require(_0x79de('0x0'));var util=require(_0x79de('0x1'));var logger=require(_0x79de('0x2'))('api');var moment=require('moment');var BPromise=require(_0x79de('0x3'));var rp=require(_0x79de('0x4'));var fs=require('fs');var path=require(_0x79de('0x5'));var rimraf=require(_0x79de('0x6'));var config=require(_0x79de('0x7'));var attributes=require(_0x79de('0x8'));module[_0x79de('0x9')]=function(_0x3701a1,_0x368dd7){return _0x3701a1['define'](_0x79de('0xa'),attributes,{'tableName':_0x79de('0xb'),'paranoid':![],'indexes':[{'name':_0x79de('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf5=['bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','../../config/logger','moment'];(function(_0x596693,_0x4f793d){var _0x33d7b1=function(_0x3c7f45){while(--_0x3c7f45){_0x596693['push'](_0x596693['shift']());}};_0x33d7b1(++_0x4f793d);}(_0x5bf5,0x1c6));var _0x55bf=function(_0x6737ea,_0x2fc8bd){_0x6737ea=_0x6737ea-0x0;var _0x267176=_0x5bf5[_0x6737ea];return _0x267176;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x55bf('0x0'))('api');var moment=require(_0x55bf('0x1'));var BPromise=require(_0x55bf('0x2'));var rp=require(_0x55bf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55bf('0x4'));var config=require(_0x55bf('0x5'));var attributes=require(_0x55bf('0x6'));module[_0x55bf('0x7')]=function(_0x5c8657,_0x3d0c83){return _0x5c8657[_0x55bf('0x8')](_0x55bf('0x9'),attributes,{'tableName':_0x55bf('0xa'),'paranoid':![],'indexes':[{'name':_0x55bf('0xb'),'fields':[_0x55bf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index e37b85f..de5f8d7 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 _0x5074=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3485e7,_0x415239){var _0x32a741=function(_0x15c7e2){while(--_0x15c7e2){_0x3485e7['push'](_0x3485e7['shift']());}};_0x32a741(++_0x415239);}(_0x5074,0x1a5));var _0x4507=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x5074[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0x4507('0x0'));var util=require('util');var moment=require(_0x4507('0x1'));var BPromise=require(_0x4507('0x2'));var rs=require(_0x4507('0x3'));var fs=require('fs');var Redis=require(_0x4507('0x4'));var db=require(_0x4507('0x5'))['db'];var utils=require(_0x4507('0x6'));var logger=require(_0x4507('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4507('0x8')][_0x4507('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22e392,_0x4a8328,_0x9d77e0){return new BPromise(function(_0x4fe52d,_0x3f13ac){return client['request'](_0x22e392,_0x9d77e0)[_0x4507('0xa')](function(_0xc4085){logger['info'](_0x4507('0xb'),_0x4a8328,_0x4507('0xc'));logger[_0x4507('0xd')](_0x4507('0xe'),_0x4a8328,'request\x20sent',JSON[_0x4507('0xf')](_0xc4085));if(_0xc4085[_0x4507('0x10')]){if(_0xc4085[_0x4507('0x10')][_0x4507('0x11')]===0x1f4){logger[_0x4507('0x10')](_0x4507('0xb'),_0x4a8328,_0xc4085[_0x4507('0x10')]['message']);return _0x3f13ac(_0xc4085['error']['message']);}logger[_0x4507('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x4a8328,_0xc4085[_0x4507('0x10')][_0x4507('0x12')]);return _0x4fe52d(_0xc4085[_0x4507('0x10')]['message']);}else{logger['info'](_0x4507('0xb'),_0x4a8328,_0x4507('0xc'));_0x4fe52d(_0xc4085[_0x4507('0x13')]['message']);}})[_0x4507('0x14')](function(_0x56ac0e){logger[_0x4507('0x10')](_0x4507('0xb'),_0x4a8328,_0x56ac0e);_0x3f13ac(_0x56ac0e);});});} \ No newline at end of file +var _0x8290=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x26543a,_0x5a8fd7){var _0x2c8731=function(_0x122e4e){while(--_0x122e4e){_0x26543a['push'](_0x26543a['shift']());}};_0x2c8731(++_0x5a8fd7);}(_0x8290,0x10b));var _0x0829=function(_0x32249b,_0x902566){_0x32249b=_0x32249b-0x0;var _0x43fec8=_0x8290[_0x32249b];return _0x43fec8;};'use strict';var _=require(_0x0829('0x0'));var util=require(_0x0829('0x1'));var moment=require('moment');var BPromise=require(_0x0829('0x2'));var rs=require(_0x0829('0x3'));var fs=require('fs');var Redis=require(_0x0829('0x4'));var db=require(_0x0829('0x5'))['db'];var utils=require(_0x0829('0x6'));var logger=require(_0x0829('0x7'))(_0x0829('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x569f47,_0x45b693,_0x70ff46){return new BPromise(function(_0x1b3850,_0x9331dd){return client[_0x0829('0x9')](_0x569f47,_0x70ff46)[_0x0829('0xa')](function(_0x1329bd){logger[_0x0829('0xb')](_0x0829('0xc'),_0x45b693,_0x0829('0xd'));logger[_0x0829('0xe')](_0x0829('0xf'),_0x45b693,'request\x20sent',JSON['stringify'](_0x1329bd));if(_0x1329bd[_0x0829('0x10')]){if(_0x1329bd[_0x0829('0x10')]['code']===0x1f4){logger['error'](_0x0829('0xc'),_0x45b693,_0x1329bd[_0x0829('0x10')][_0x0829('0x11')]);return _0x9331dd(_0x1329bd[_0x0829('0x10')]['message']);}logger['error'](_0x0829('0xc'),_0x45b693,_0x1329bd[_0x0829('0x10')][_0x0829('0x11')]);return _0x1b3850(_0x1329bd['error'][_0x0829('0x11')]);}else{logger[_0x0829('0xb')](_0x0829('0xc'),_0x45b693,_0x0829('0xd'));_0x1b3850(_0x1329bd[_0x0829('0x12')][_0x0829('0x11')]);}})['catch'](function(_0x1f2603){logger[_0x0829('0x10')](_0x0829('0xc'),_0x45b693,_0x1f2603);_0x9331dd(_0x1f2603);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 2598291..70e4803 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 _0x76a9=['/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','post','file','addLogo','root','logologin','single','addLogoLogin','preferred','extname','originalname','addFavicon','isAuthenticated','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred'];(function(_0x26ae05,_0x53e7ea){var _0x1e8338=function(_0x241a59){while(--_0x241a59){_0x26ae05['push'](_0x26ae05['shift']());}};_0x1e8338(++_0x53e7ea);}(_0x76a9,0x69));var _0x976a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x76a9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x976a('0x0'));var util=require(_0x976a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x976a('0x2'));var router=express[_0x976a('0x3')]();var fs_extra=require(_0x976a('0x4'));var auth=require(_0x976a('0x5'));var interaction=require(_0x976a('0x6'));var config=require(_0x976a('0x7'));var controller=require(_0x976a('0x8'));router[_0x976a('0x9')]('/',auth['isAuthenticated'](),controller[_0x976a('0xa')]);router[_0x976a('0x9')](_0x976a('0xb'),controller[_0x976a('0xc')]);router[_0x976a('0x9')](_0x976a('0xd'),controller['show']);router['get'](_0x976a('0xe'),controller[_0x976a('0xf')]);router[_0x976a('0x9')](_0x976a('0x10'),controller[_0x976a('0x11')]);router[_0x976a('0x9')](_0x976a('0x12'),controller['gdpr']);router[_0x976a('0x9')](_0x976a('0x13'),controller[_0x976a('0x14')]);router[_0x976a('0x9')](_0x976a('0x15'),controller[_0x976a('0x16')]);var upload=multer({'storage':multer[_0x976a('0x17')]({'destination':function(_0x13e0c5,_0x5bf4e8,_0x353e03){_0x353e03(null,path[_0x976a('0x18')](config['root'],_0x976a('0x19')));},'filename':function(_0x5422e0,_0x1ccb46,_0x471254){_0x471254(null,util[_0x976a('0x1a')](_0x976a('0x1b'),'logo',path['extname'](_0x1ccb46['originalname'])));}})});router[_0x976a('0x1c')](_0x976a('0xe'),upload['single'](_0x976a('0x1d')),controller[_0x976a('0x1e')]);var upload=multer({'storage':multer[_0x976a('0x17')]({'destination':function(_0x154957,_0x3d7262,_0x329eb0){_0x329eb0(null,path[_0x976a('0x18')](config[_0x976a('0x1f')],_0x976a('0x19')));},'filename':function(_0x4a32e4,_0x67549c,_0x40db83){_0x40db83(null,util[_0x976a('0x1a')](_0x976a('0x1b'),_0x976a('0x20'),path['extname'](_0x67549c['originalname'])));}})});router['post'](_0x976a('0x10'),upload[_0x976a('0x21')](_0x976a('0x1d')),controller[_0x976a('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2fce4a,_0x114867,_0x1adcc7){_0x1adcc7(null,path['join'](config['root'],_0x976a('0x19')));},'filename':function(_0x1d524e,_0x517a5e,_0x10dbb0){_0x10dbb0(null,util[_0x976a('0x1a')]('%s%s',_0x976a('0x23'),path[_0x976a('0x24')](_0x517a5e[_0x976a('0x25')])));}})});router[_0x976a('0x1c')](_0x976a('0x13'),upload[_0x976a('0x21')](_0x976a('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer[_0x976a('0x17')]({'destination':function(_0x8554b9,_0x4b2b92,_0x4cd0dc){_0x4cd0dc(null,path[_0x976a('0x18')](config['root'],_0x976a('0x19')));},'filename':function(_0x14711b,_0x1e2fc6,_0x3ee24a){_0x3ee24a(null,util[_0x976a('0x1a')](_0x976a('0x1b'),'favicon',path[_0x976a('0x24')](_0x1e2fc6[_0x976a('0x25')])));}})});router[_0x976a('0x1c')](_0x976a('0x15'),upload['single']('file'),controller[_0x976a('0x26')]);router['put'](_0x976a('0xd'),auth[_0x976a('0x27')](),controller[_0x976a('0x28')]);module[_0x976a('0x29')]=router; \ No newline at end of file +var _0x0cd4=['/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','format','%s%s','extname','originalname','post','/:id/logo','file','root','logologin','single','addLogoLogin','server/files/images/logos/','preferred','addFavicon','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x19699c,_0x4e4159){var _0x5aa631=function(_0x40a872){while(--_0x40a872){_0x19699c['push'](_0x19699c['shift']());}};_0x5aa631(++_0x4e4159);}(_0x0cd4,0xe9));var _0x40cd=function(_0x4421fd,_0x3d87be){_0x4421fd=_0x4421fd-0x0;var _0x48101c=_0x0cd4[_0x4421fd];return _0x48101c;};'use strict';var multer=require(_0x40cd('0x0'));var util=require(_0x40cd('0x1'));var path=require(_0x40cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x40cd('0x3'));var router=express[_0x40cd('0x4')]();var fs_extra=require(_0x40cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x40cd('0x6'));var config=require(_0x40cd('0x7'));var controller=require('./setting.controller');router[_0x40cd('0x8')]('/',auth[_0x40cd('0x9')](),controller[_0x40cd('0xa')]);router[_0x40cd('0x8')]('/now',controller[_0x40cd('0xb')]);router[_0x40cd('0x8')](_0x40cd('0xc'),controller[_0x40cd('0xd')]);router[_0x40cd('0x8')]('/:id/logo',controller[_0x40cd('0xe')]);router[_0x40cd('0x8')](_0x40cd('0xf'),controller[_0x40cd('0x10')]);router[_0x40cd('0x8')](_0x40cd('0x11'),controller[_0x40cd('0x12')]);router[_0x40cd('0x8')](_0x40cd('0x13'),controller[_0x40cd('0x14')]);router[_0x40cd('0x8')](_0x40cd('0x15'),controller[_0x40cd('0x16')]);var upload=multer({'storage':multer[_0x40cd('0x17')]({'destination':function(_0x378715,_0x4e4294,_0x78337e){_0x78337e(null,path[_0x40cd('0x18')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1b2087,_0x542771,_0x4e08c7){_0x4e08c7(null,util[_0x40cd('0x19')](_0x40cd('0x1a'),'logo',path[_0x40cd('0x1b')](_0x542771[_0x40cd('0x1c')])));}})});router[_0x40cd('0x1d')](_0x40cd('0x1e'),upload['single'](_0x40cd('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0x40cd('0x17')]({'destination':function(_0x4e312c,_0x250799,_0x56b01c){_0x56b01c(null,path[_0x40cd('0x18')](config[_0x40cd('0x20')],'server/files/images/logos/'));},'filename':function(_0x38c341,_0x2da7cc,_0x22174d){_0x22174d(null,util[_0x40cd('0x19')](_0x40cd('0x1a'),_0x40cd('0x21'),path[_0x40cd('0x1b')](_0x2da7cc[_0x40cd('0x1c')])));}})});router[_0x40cd('0x1d')](_0x40cd('0xf'),upload[_0x40cd('0x22')]('file'),controller[_0x40cd('0x23')]);var upload=multer({'storage':multer[_0x40cd('0x17')]({'destination':function(_0x46467f,_0x1dc6f2,_0x4e2a0e){_0x4e2a0e(null,path[_0x40cd('0x18')](config['root'],_0x40cd('0x24')));},'filename':function(_0x4c63db,_0x27697d,_0x229d3e){_0x229d3e(null,util[_0x40cd('0x19')]('%s%s',_0x40cd('0x25'),path[_0x40cd('0x1b')](_0x27697d['originalname'])));}})});router[_0x40cd('0x1d')]('/:id/preferred',upload[_0x40cd('0x22')](_0x40cd('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x40cd('0x17')]({'destination':function(_0x3c841b,_0x1b67f4,_0x13abc2){_0x13abc2(null,path[_0x40cd('0x18')](config[_0x40cd('0x20')],'server/files/images/logos/'));},'filename':function(_0x10b79e,_0x20498c,_0x35cdc8){_0x35cdc8(null,util[_0x40cd('0x19')]('%s%s','favicon',path['extname'](_0x20498c[_0x40cd('0x1c')])));}})});router['post'](_0x40cd('0x15'),upload[_0x40cd('0x22')](_0x40cd('0x1f')),controller[_0x40cd('0x26')]);router[_0x40cd('0x27')](_0x40cd('0xc'),auth[_0x40cd('0x9')](),controller[_0x40cd('0x28')]);module[_0x40cd('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b55c15f..a5d7333 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1227c7,_0xe6bdaa){var _0x1c5ac8=function(_0x1c328a){while(--_0x1c328a){_0x1227c7['push'](_0x1227c7['shift']());}};_0x1c5ac8(++_0xe6bdaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x438e80,_0x223d0b){var _0x3c5d85=function(_0x293e65){while(--_0x293e65){_0x438e80['push'](_0x438e80['shift']());}};_0x3c5d85(++_0x223d0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'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 af3f386..ccb1dd3 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 _0x5ab4=['filename','logo','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default','getDate','now','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','merge','map','filter','options','Setting','includeAll','include','show','params','find','body','addLogo','file'];(function(_0x5b4d06,_0x3edc8d){var _0xad4053=function(_0x1e2748){while(--_0x1e2748){_0x5b4d06['push'](_0x5b4d06['shift']());}};_0xad4053(++_0x3edc8d);}(_0x5ab4,0x9f));var _0x45ab=function(_0x538a7b,_0x5a56f2){_0x538a7b=_0x538a7b-0x0;var _0x4cebce=_0x5ab4[_0x538a7b];return _0x4cebce;};'use strict';var emlformat=require(_0x45ab('0x0'));var rimraf=require(_0x45ab('0x1'));var zipdir=require(_0x45ab('0x2'));var jsonpatch=require(_0x45ab('0x3'));var rp=require(_0x45ab('0x4'));var moment=require('moment');var BPromise=require(_0x45ab('0x5'));var Mustache=require(_0x45ab('0x6'));var util=require(_0x45ab('0x7'));var path=require(_0x45ab('0x8'));var sox=require(_0x45ab('0x9'));var csv=require(_0x45ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45ab('0xb'));var _=require(_0x45ab('0xc'));var squel=require(_0x45ab('0xd'));var crypto=require(_0x45ab('0xe'));var jsforce=require(_0x45ab('0xf'));var deskjs=require(_0x45ab('0x10'));var toCsv=require(_0x45ab('0xa'));var querystring=require(_0x45ab('0x11'));var Papa=require(_0x45ab('0x12'));var Redis=require(_0x45ab('0x13'));var authService=require(_0x45ab('0x14'));var qs=require(_0x45ab('0x15'));var as=require(_0x45ab('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45ab('0x17'))(_0x45ab('0x18'));var utils=require(_0x45ab('0x19'));var config=require(_0x45ab('0x1a'));var licenseUtil=require(_0x45ab('0x1b'));var db=require(_0x45ab('0x1c'))['db'];var jayson=require(_0x45ab('0x1d'));var client=jayson[_0x45ab('0x1e')][_0x45ab('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4faf5a,_0x5ad2a5,_0x351622,_0x3402ca){return new BPromise(function(_0x224165,_0x2b26d3){var _0x31eeb1=_0x3402ca||client;return _0x31eeb1[_0x45ab('0x20')](_0x4faf5a,_0x351622)[_0x45ab('0x21')](function(_0xdc85c5){logger['info'](_0x45ab('0x22'),_0x5ad2a5,_0x45ab('0x23'));logger['debug'](_0x45ab('0x24'),_0x5ad2a5,'request\x20sent',JSON['stringify'](_0xdc85c5));if(_0xdc85c5[_0x45ab('0x25')]){if(_0xdc85c5[_0x45ab('0x25')][_0x45ab('0x26')]===0x1f4){logger[_0x45ab('0x25')](_0x45ab('0x22'),_0x5ad2a5,_0xdc85c5['error'][_0x45ab('0x27')]);return _0x2b26d3(_0xdc85c5[_0x45ab('0x25')][_0x45ab('0x27')]);}logger[_0x45ab('0x25')]('Setting,\x20%s,\x20%s',_0x5ad2a5,_0xdc85c5[_0x45ab('0x25')]['message']);return _0x224165(_0xdc85c5[_0x45ab('0x25')][_0x45ab('0x27')]);}else{logger[_0x45ab('0x28')](_0x45ab('0x22'),_0x5ad2a5,_0x45ab('0x23'));_0x224165(_0xdc85c5['result'][_0x45ab('0x27')]);}})[_0x45ab('0x29')](function(_0x597b64){logger[_0x45ab('0x25')](_0x45ab('0x22'),_0x5ad2a5,_0x597b64);_0x2b26d3(_0x597b64);});});}function respondWithStatusCode(_0x74856a,_0x5b4859){_0x5b4859=_0x5b4859||0xcc;return function(_0x229ead){if(_0x229ead){return _0x74856a['sendStatus'](_0x5b4859);}return _0x74856a['status'](_0x5b4859)['end']();};}function respondWithResult(_0x31ba9c,_0x5d6aca){_0x5d6aca=_0x5d6aca||0xc8;return function(_0x4b0809){if(_0x4b0809){return _0x31ba9c[_0x45ab('0x2a')](_0x5d6aca)['json'](_0x4b0809);}};}function respondWithFilteredResult(_0x37f0a0,_0x2b0ba5){return function(_0x4711b1){if(_0x4711b1){var _0x1cc085=typeof _0x2b0ba5[_0x45ab('0x2b')]===_0x45ab('0x2c')&&typeof _0x2b0ba5['limit']==='undefined';var _0x1e96ad=_0x4711b1[_0x45ab('0x2d')];var _0x2bd621=_0x1cc085?0x0:_0x2b0ba5[_0x45ab('0x2b')];var _0x48fb25=_0x1cc085?_0x4711b1['count']:_0x2b0ba5['offset']+_0x2b0ba5[_0x45ab('0x2e')];var _0x2b33a0;if(_0x48fb25>=_0x1e96ad){_0x48fb25=_0x1e96ad;_0x2b33a0=0xc8;}else{_0x2b33a0=0xce;}_0x37f0a0[_0x45ab('0x2a')](_0x2b33a0);return _0x37f0a0[_0x45ab('0x2f')](_0x45ab('0x30'),_0x2bd621+'-'+_0x48fb25+'/'+_0x1e96ad)[_0x45ab('0x31')](_0x4711b1);}return null;};}function patchUpdates(_0x15e627){return function(_0x2eeb85){try{jsonpatch[_0x45ab('0x32')](_0x2eeb85,_0x15e627,!![]);}catch(_0x5b314d){return BPromise[_0x45ab('0x33')](_0x5b314d);}return _0x2eeb85[_0x45ab('0x34')]();};}function saveUpdates(_0x5af73a,_0xe9b417){return function(_0x2a7bf2){if(_0x2a7bf2){return _0x2a7bf2[_0x45ab('0x35')](_0x5af73a)['then'](function(_0x5b553a){return _0x5b553a;});}return null;};}function removeEntity(_0x5e9d28,_0x31f312){return function(_0x4b5981){if(_0x4b5981){return _0x4b5981[_0x45ab('0x36')]()[_0x45ab('0x21')](function(){_0x5e9d28['status'](0xcc)[_0x45ab('0x37')]();});}};}function handleEntityNotFound(_0x33d9ad,_0x39908e){return function(_0x5e9735){if(!_0x5e9735){_0x33d9ad[_0x45ab('0x38')](0x194);}return _0x5e9735;};}function handleError(_0x2b0158,_0x27a1e6){_0x27a1e6=_0x27a1e6||0x1f4;return function(_0x321cd2){logger[_0x45ab('0x25')](_0x321cd2['stack']);if(_0x321cd2[_0x45ab('0x39')]){delete _0x321cd2[_0x45ab('0x39')];}_0x2b0158['status'](_0x27a1e6)[_0x45ab('0x3a')](_0x321cd2);};}exports['index']=function(_0x1a426b,_0x355fc9){var _0x22a002={},_0x1b8c98={},_0x5e5379={'count':0x0,'rows':[]};var _0x3d3694=_['map'](db['Setting'][_0x45ab('0x3b')],function(_0xc74f5){return{'name':_0xc74f5[_0x45ab('0x3c')],'type':_0xc74f5[_0x45ab('0x3d')][_0x45ab('0x3e')]};});_0x1b8c98[_0x45ab('0x3f')]=_['map'](_0x3d3694,_0x45ab('0x39'));_0x1b8c98[_0x45ab('0x40')]=_[_0x45ab('0x41')](_0x1a426b[_0x45ab('0x40')]);_0x1b8c98[_0x45ab('0x42')]=_[_0x45ab('0x43')](_0x1b8c98['model'],_0x1b8c98[_0x45ab('0x40')]);_0x22a002[_0x45ab('0x44')]=_[_0x45ab('0x43')](_0x1b8c98['model'],qs[_0x45ab('0x45')](_0x1a426b[_0x45ab('0x40')]['fields']));_0x22a002[_0x45ab('0x44')]=_0x22a002[_0x45ab('0x44')][_0x45ab('0x46')]?_0x22a002[_0x45ab('0x44')]:_0x1b8c98[_0x45ab('0x3f')];if(!_0x1a426b[_0x45ab('0x40')][_0x45ab('0x47')](_0x45ab('0x48'))){_0x22a002['limit']=qs[_0x45ab('0x2e')](_0x1a426b[_0x45ab('0x40')][_0x45ab('0x2e')]);_0x22a002[_0x45ab('0x2b')]=qs['offset'](_0x1a426b[_0x45ab('0x40')][_0x45ab('0x2b')]);}_0x22a002['order']=qs[_0x45ab('0x49')](_0x1a426b[_0x45ab('0x40')][_0x45ab('0x49')]);_0x22a002['where']=qs[_0x45ab('0x42')](_['pick'](_0x1a426b[_0x45ab('0x40')],_0x1b8c98[_0x45ab('0x42')]),_0x3d3694);if(_0x1a426b[_0x45ab('0x40')]['filter']){_0x22a002['where']=_[_0x45ab('0x4a')](_0x22a002['where'],{'$or':_[_0x45ab('0x4b')](_0x3d3694,function(_0xfd22b7){if(_0xfd22b7[_0x45ab('0x3d')]!=='VIRTUAL'){var _0x375308={};_0x375308[_0xfd22b7[_0x45ab('0x39')]]={'$like':'%'+_0x1a426b[_0x45ab('0x40')][_0x45ab('0x4c')]+'%'};return _0x375308;}})});}_0x22a002=_[_0x45ab('0x4a')]({},_0x22a002,_0x1a426b[_0x45ab('0x4d')]);var _0x2787be={'where':_0x22a002['where']};return db[_0x45ab('0x4e')]['count'](_0x2787be)[_0x45ab('0x21')](function(_0x25b0c7){_0x5e5379[_0x45ab('0x2d')]=_0x25b0c7;if(_0x1a426b[_0x45ab('0x40')][_0x45ab('0x4f')]){_0x22a002[_0x45ab('0x50')]=[{'all':!![]}];}return db[_0x45ab('0x4e')]['findAll'](_0x22a002);})[_0x45ab('0x21')](function(_0x4f2885){_0x5e5379['rows']=_0x4f2885;return _0x5e5379;})[_0x45ab('0x21')](respondWithFilteredResult(_0x355fc9,_0x22a002))['catch'](handleError(_0x355fc9,null));};exports[_0x45ab('0x51')]=function(_0x3a2a51,_0x591247){var _0x126a43={'raw':![],'where':{'id':_0x3a2a51[_0x45ab('0x52')]['id']}},_0xc77f26={};_0xc77f26[_0x45ab('0x3f')]=_[_0x45ab('0x41')](db[_0x45ab('0x4e')][_0x45ab('0x3b')]);_0xc77f26['query']=_['keys'](_0x3a2a51[_0x45ab('0x40')]);_0xc77f26[_0x45ab('0x42')]=_[_0x45ab('0x43')](_0xc77f26[_0x45ab('0x3f')],_0xc77f26[_0x45ab('0x40')]);_0x126a43[_0x45ab('0x44')]=_[_0x45ab('0x43')](_0xc77f26[_0x45ab('0x3f')],qs[_0x45ab('0x45')](_0x3a2a51[_0x45ab('0x40')][_0x45ab('0x45')]));_0x126a43[_0x45ab('0x44')]=_0x126a43['attributes']['length']?_0x126a43[_0x45ab('0x44')]:_0xc77f26['model'];if(_0x3a2a51[_0x45ab('0x40')][_0x45ab('0x4f')]){_0x126a43['include']=[{'all':!![]}];}_0x126a43=_['merge']({},_0x126a43,_0x3a2a51[_0x45ab('0x4d')]);return db[_0x45ab('0x4e')][_0x45ab('0x53')](_0x126a43)[_0x45ab('0x21')](handleEntityNotFound(_0x591247,null))[_0x45ab('0x21')](respondWithResult(_0x591247,null))[_0x45ab('0x29')](handleError(_0x591247,null));};exports[_0x45ab('0x35')]=function(_0x2ee47c,_0xd8f1d9){if(_0x2ee47c['body']['id']){delete _0x2ee47c[_0x45ab('0x54')]['id'];}return db[_0x45ab('0x4e')][_0x45ab('0x53')]({'where':{'id':_0x2ee47c['params']['id']}})[_0x45ab('0x21')](handleEntityNotFound(_0xd8f1d9,null))[_0x45ab('0x21')](saveUpdates(_0x2ee47c[_0x45ab('0x54')],null))['then'](respondWithResult(_0xd8f1d9,null))[_0x45ab('0x29')](handleError(_0xd8f1d9,null));};exports[_0x45ab('0x55')]=function(_0x50051a,_0x1fcc01,_0x599747){if(_0x50051a[_0x45ab('0x56')]&&_0x50051a[_0x45ab('0x56')][_0x45ab('0x57')]){_0x50051a[_0x45ab('0x54')][_0x45ab('0x58')]=_0x50051a[_0x45ab('0x56')][_0x45ab('0x57')];}return db[_0x45ab('0x4e')]['find']({'where':{'id':_0x50051a[_0x45ab('0x52')]['id']}})['then'](handleEntityNotFound(_0x1fcc01,null))[_0x45ab('0x21')](saveUpdates(_0x50051a[_0x45ab('0x54')],null))['then'](respondWithResult(_0x1fcc01,null))[_0x45ab('0x29')](handleError(_0x1fcc01,null));};exports['addLogoLogin']=function(_0x19f8fa,_0x1790e0,_0x4e702a){if(_0x19f8fa[_0x45ab('0x56')]&&_0x19f8fa['file'][_0x45ab('0x57')]){_0x19f8fa['body'][_0x45ab('0x59')]=_0x19f8fa[_0x45ab('0x56')][_0x45ab('0x57')];}return db['Setting'][_0x45ab('0x53')]({'where':{'id':_0x19f8fa[_0x45ab('0x52')]['id']}})[_0x45ab('0x21')](handleEntityNotFound(_0x1790e0,null))[_0x45ab('0x21')](saveUpdates(_0x19f8fa['body'],null))[_0x45ab('0x21')](respondWithResult(_0x1790e0,null))[_0x45ab('0x29')](handleError(_0x1790e0,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x3a0e5e,_0x5a5bab,_0x87b60f){var _0x5ea953=_0x45ab('0x5a');var _0x170108={'custom':![]};return utilLicense['getLicense']()[_0x45ab('0x21')](function(_0x107dbb){if(_0x107dbb){_0x170108=_0x107dbb;}return db['Setting'][_0x45ab('0x53')]({'where':{'id':_0x3a0e5e[_0x45ab('0x52')]['id']},'attributes':[_0x45ab('0x58'),_0x45ab('0x59'),_0x45ab('0x5b'),_0x45ab('0x5c'),_0x45ab('0x5d'),_0x45ab('0x5e'),'defaultPreferred',_0x45ab('0x5f')],'raw':!![]});})[_0x45ab('0x21')](handleEntityNotFound(_0x5a5bab,null))[_0x45ab('0x21')](function(_0x398afa){if(_0x398afa){var _0x4001ed=_0x398afa[_0x45ab('0x58')]&&fs[_0x45ab('0x60')](path[_0x45ab('0x61')](config['root'],_0x5ea953,_['toLower'](_0x398afa[_0x45ab('0x58')])))?path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x5ea953,_[_0x45ab('0x63')](_0x398afa['logo'])):path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x5ea953,_[_0x45ab('0x63')]('default_logo.svg'));var _0x4820e3='default'+_[_0x45ab('0x64')](_0x45ab('0x58'));if(_0x398afa[_0x4820e3]||!_0x170108[_0x45ab('0x65')]){_0x4001ed=path[_0x45ab('0x61')](config['root'],_0x5ea953,_[_0x45ab('0x63')](_0x45ab('0x66')));}if(!fs[_0x45ab('0x60')](_0x4001ed)){throw new db['Sequelize'][(_0x45ab('0x67'))](_['upperFirst'](_0x45ab('0x58'))+_0x45ab('0x68'));}return _0x5a5bab[_0x45ab('0x69')](_0x4001ed);}})[_0x45ab('0x29')](handleError(_0x5a5bab,null));};var utilLicense=require('../../config/license/util');exports[_0x45ab('0x6a')]=function(_0x13f512,_0x55b499,_0x5ac858){var _0x5efc49='server/files/images/logos';var _0x1715ad={'custom':![]};return utilLicense['getLicense']()[_0x45ab('0x21')](function(_0x14169a){if(_0x14169a){_0x1715ad=_0x14169a;}return db[_0x45ab('0x4e')][_0x45ab('0x53')]({'where':{'id':_0x13f512[_0x45ab('0x52')]['id']},'attributes':['logo','loginLogo',_0x45ab('0x5b'),'favicon',_0x45ab('0x5d'),_0x45ab('0x5e'),_0x45ab('0x6b'),'defaultFavicon'],'raw':!![]});})[_0x45ab('0x21')](handleEntityNotFound(_0x55b499,null))[_0x45ab('0x21')](function(_0x2c7b5e){if(_0x2c7b5e){var _0x5d66dc=_0x2c7b5e[_0x45ab('0x59')]&&fs[_0x45ab('0x60')](path[_0x45ab('0x61')](config['root'],_0x5efc49,_[_0x45ab('0x63')](_0x2c7b5e[_0x45ab('0x59')])))?path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x5efc49,_[_0x45ab('0x63')](_0x2c7b5e[_0x45ab('0x59')])):path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x5efc49,_[_0x45ab('0x63')](_0x45ab('0x6c')));var _0x370e78='default'+_[_0x45ab('0x64')](_0x45ab('0x59'));if(_0x2c7b5e[_0x370e78]||!_0x1715ad['custom']){_0x5d66dc=path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x5efc49,_[_0x45ab('0x63')](_0x45ab('0x6c')));}if(!fs[_0x45ab('0x60')](_0x5d66dc)){throw new db[(_0x45ab('0x6d'))][(_0x45ab('0x67'))](_[_0x45ab('0x64')](_0x45ab('0x59'))+_0x45ab('0x68'));}return _0x55b499[_0x45ab('0x69')](_0x5d66dc);}})[_0x45ab('0x29')](handleError(_0x55b499,null));};exports[_0x45ab('0x6e')]=function(_0x23c02f,_0x535387){return db['Setting'][_0x45ab('0x53')]({'where':{'id':_0x23c02f['params']['id']},'attributes':[_0x45ab('0x6f')]})['then'](respondWithResult(_0x535387,null))[_0x45ab('0x29')](handleError(_0x535387,null));};exports[_0x45ab('0x70')]=function(_0xb41192,_0x23e04a,_0x58ad70){if(_0xb41192[_0x45ab('0x56')]&&_0xb41192[_0x45ab('0x56')][_0x45ab('0x57')]){_0xb41192[_0x45ab('0x54')]['preferred']=_0xb41192[_0x45ab('0x56')]['filename'];}return db[_0x45ab('0x4e')][_0x45ab('0x53')]({'where':{'id':_0xb41192[_0x45ab('0x52')]['id']}})['then'](handleEntityNotFound(_0x23e04a,null))[_0x45ab('0x21')](saveUpdates(_0xb41192[_0x45ab('0x54')],null))['then'](respondWithResult(_0x23e04a,null))['catch'](handleError(_0x23e04a,null));};var utilLicense=require(_0x45ab('0x1b'));exports[_0x45ab('0x71')]=function(_0x38f011,_0x21273d,_0x30248f){var _0x399fd8=_0x45ab('0x5a');var _0x502e77={'custom':![]};return utilLicense[_0x45ab('0x72')]()[_0x45ab('0x21')](function(_0x96965a){if(_0x96965a){_0x502e77=_0x96965a;}return db['Setting'][_0x45ab('0x53')]({'where':{'id':_0x38f011[_0x45ab('0x52')]['id']},'attributes':[_0x45ab('0x58'),_0x45ab('0x59'),_0x45ab('0x5b'),_0x45ab('0x5c'),_0x45ab('0x5d'),_0x45ab('0x5e'),_0x45ab('0x6b'),_0x45ab('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x21273d,null))[_0x45ab('0x21')](function(_0x4331eb){if(_0x4331eb){var _0x10e5b4=_0x4331eb[_0x45ab('0x5b')]&&fs[_0x45ab('0x60')](path['join'](config[_0x45ab('0x62')],_0x399fd8,_[_0x45ab('0x63')](_0x4331eb['preferred'])))?path['join'](config[_0x45ab('0x62')],_0x399fd8,_[_0x45ab('0x63')](_0x4331eb[_0x45ab('0x5b')])):path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x399fd8,_[_0x45ab('0x63')](_0x45ab('0x73')));var _0x8a5099='default'+_[_0x45ab('0x64')](_0x45ab('0x5b'));if(_0x4331eb[_0x8a5099]||!_0x502e77['custom']||!_0x502e77[_0x45ab('0x5b')]){_0x10e5b4=path[_0x45ab('0x61')](config['root'],_0x399fd8,_['toLower'](_0x45ab('0x73')));}if(!fs[_0x45ab('0x60')](_0x10e5b4)){throw new db[(_0x45ab('0x6d'))][(_0x45ab('0x67'))](_[_0x45ab('0x64')]('preferred')+_0x45ab('0x68'));}return _0x21273d[_0x45ab('0x69')](_0x10e5b4);}})[_0x45ab('0x29')](handleError(_0x21273d,null));};exports[_0x45ab('0x74')]=function(_0x9d3f14,_0x58ed3a,_0x11f8bd){if(_0x9d3f14[_0x45ab('0x56')]&&_0x9d3f14[_0x45ab('0x56')]['filename']){_0x9d3f14[_0x45ab('0x54')][_0x45ab('0x5c')]=_0x9d3f14[_0x45ab('0x56')][_0x45ab('0x57')];}return db[_0x45ab('0x4e')][_0x45ab('0x53')]({'where':{'id':_0x9d3f14[_0x45ab('0x52')]['id']}})[_0x45ab('0x21')](handleEntityNotFound(_0x58ed3a,null))[_0x45ab('0x21')](saveUpdates(_0x9d3f14[_0x45ab('0x54')],null))[_0x45ab('0x21')](respondWithResult(_0x58ed3a,null))[_0x45ab('0x29')](handleError(_0x58ed3a,null));};var utilLicense=require(_0x45ab('0x1b'));exports[_0x45ab('0x75')]=function(_0xc6be7,_0x42aac7,_0x1a6322){var _0x141b05=_0x45ab('0x5a');var _0x2bb890={'custom':![]};return utilLicense[_0x45ab('0x72')]()['then'](function(_0x1ee856){if(_0x1ee856){_0x2bb890=_0x1ee856;}return db['Setting'][_0x45ab('0x53')]({'where':{'id':_0xc6be7['params']['id']},'attributes':['logo',_0x45ab('0x59'),_0x45ab('0x5b'),_0x45ab('0x5c'),_0x45ab('0x5d'),_0x45ab('0x5e'),_0x45ab('0x6b'),_0x45ab('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x42aac7,null))[_0x45ab('0x21')](function(_0x2e2b53){if(_0x2e2b53){var _0x187ca4=_0x2e2b53[_0x45ab('0x5c')]&&fs[_0x45ab('0x60')](path[_0x45ab('0x61')](config['root'],_0x141b05,_[_0x45ab('0x63')](_0x2e2b53[_0x45ab('0x5c')])))?path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x141b05,_[_0x45ab('0x63')](_0x2e2b53[_0x45ab('0x5c')])):path[_0x45ab('0x61')](config['root'],_0x141b05,_['toLower']('default_favicon.ico'));var _0x3464c0=_0x45ab('0x76')+_['upperFirst'](_0x45ab('0x5c'));if(_0x2e2b53[_0x3464c0]||!_0x2bb890[_0x45ab('0x65')]){_0x187ca4=path[_0x45ab('0x61')](config[_0x45ab('0x62')],_0x141b05,_['toLower']('default_favicon.ico'));}if(!fs[_0x45ab('0x60')](_0x187ca4)){throw new db['Sequelize'][(_0x45ab('0x67'))](_[_0x45ab('0x64')]('favicon')+_0x45ab('0x68'));}return _0x42aac7[_0x45ab('0x69')](_0x187ca4);}})['catch'](handleError(_0x42aac7,null));};exports[_0x45ab('0x77')]=function(_0x41b964,_0x16069d){var _0xefe78e={'offset':moment()['utcOffset']()};_0xefe78e[_0x45ab('0x78')]=moment()[_0x45ab('0x79')](_0xefe78e[_0x45ab('0x2b')])['format'](_0x45ab('0x7a'));return _0x16069d['status'](0xc8)[_0x45ab('0x3a')](_0xefe78e);}; \ No newline at end of file +var _0xc04f=['pick','where','merge','VIRTUAL','options','includeAll','include','Setting','findAll','rows','show','params','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','custom','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','Sequelize','getDate','utcOffset','now','format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc04f,0x125));var _0xfc04=function(_0x2bd211,_0x522300){_0x2bd211=_0x2bd211-0x0;var _0x5b963e=_0xc04f[_0x2bd211];return _0x5b963e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc04('0x0'));var zipdir=require(_0xfc04('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfc04('0x2'));var moment=require(_0xfc04('0x3'));var BPromise=require(_0xfc04('0x4'));var Mustache=require(_0xfc04('0x5'));var util=require(_0xfc04('0x6'));var path=require(_0xfc04('0x7'));var sox=require('sox');var csv=require(_0xfc04('0x8'));var ejs=require(_0xfc04('0x9'));var fs=require('fs');var fs_extra=require(_0xfc04('0xa'));var _=require('lodash');var squel=require(_0xfc04('0xb'));var crypto=require(_0xfc04('0xc'));var jsforce=require(_0xfc04('0xd'));var deskjs=require(_0xfc04('0xe'));var toCsv=require(_0xfc04('0x8'));var querystring=require('querystring');var Papa=require(_0xfc04('0xf'));var Redis=require(_0xfc04('0x10'));var authService=require(_0xfc04('0x11'));var qs=require(_0xfc04('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc04('0x13'));var logger=require(_0xfc04('0x14'))(_0xfc04('0x15'));var utils=require(_0xfc04('0x16'));var config=require(_0xfc04('0x17'));var licenseUtil=require(_0xfc04('0x18'));var db=require(_0xfc04('0x19'))['db'];var jayson=require(_0xfc04('0x1a'));var client=jayson[_0xfc04('0x1b')][_0xfc04('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x23c16f,_0x439e90,_0x4566f8,_0x39e5eb){return new BPromise(function(_0x41d2de,_0x5a308e){var _0x3cea75=_0x39e5eb||client;return _0x3cea75[_0xfc04('0x1d')](_0x23c16f,_0x4566f8)['then'](function(_0x35449c){logger[_0xfc04('0x1e')](_0xfc04('0x1f'),_0x439e90,_0xfc04('0x20'));logger[_0xfc04('0x21')](_0xfc04('0x22'),_0x439e90,_0xfc04('0x20'),JSON[_0xfc04('0x23')](_0x35449c));if(_0x35449c[_0xfc04('0x24')]){if(_0x35449c[_0xfc04('0x24')][_0xfc04('0x25')]===0x1f4){logger[_0xfc04('0x24')]('Setting,\x20%s,\x20%s',_0x439e90,_0x35449c['error']['message']);return _0x5a308e(_0x35449c[_0xfc04('0x24')][_0xfc04('0x26')]);}logger[_0xfc04('0x24')](_0xfc04('0x1f'),_0x439e90,_0x35449c[_0xfc04('0x24')][_0xfc04('0x26')]);return _0x41d2de(_0x35449c['error']['message']);}else{logger[_0xfc04('0x1e')](_0xfc04('0x1f'),_0x439e90,'request\x20sent');_0x41d2de(_0x35449c[_0xfc04('0x27')][_0xfc04('0x26')]);}})[_0xfc04('0x28')](function(_0x35344a){logger[_0xfc04('0x24')](_0xfc04('0x1f'),_0x439e90,_0x35344a);_0x5a308e(_0x35344a);});});}function respondWithStatusCode(_0x1927f7,_0x1d1499){_0x1d1499=_0x1d1499||0xcc;return function(_0x3a2f53){if(_0x3a2f53){return _0x1927f7[_0xfc04('0x29')](_0x1d1499);}return _0x1927f7[_0xfc04('0x2a')](_0x1d1499)[_0xfc04('0x2b')]();};}function respondWithResult(_0x1eb18d,_0x4541bf){_0x4541bf=_0x4541bf||0xc8;return function(_0x433b71){if(_0x433b71){return _0x1eb18d[_0xfc04('0x2a')](_0x4541bf)[_0xfc04('0x2c')](_0x433b71);}};}function respondWithFilteredResult(_0xa7a3c6,_0x3f74a2){return function(_0x587201){if(_0x587201){var _0x5b51c0=typeof _0x3f74a2[_0xfc04('0x2d')]==='undefined'&&typeof _0x3f74a2[_0xfc04('0x2e')]===_0xfc04('0x2f');var _0x3b8958=_0x587201[_0xfc04('0x30')];var _0x5beccb=_0x5b51c0?0x0:_0x3f74a2[_0xfc04('0x2d')];var _0x55202c=_0x5b51c0?_0x587201[_0xfc04('0x30')]:_0x3f74a2['offset']+_0x3f74a2[_0xfc04('0x2e')];var _0x537e87;if(_0x55202c>=_0x3b8958){_0x55202c=_0x3b8958;_0x537e87=0xc8;}else{_0x537e87=0xce;}_0xa7a3c6['status'](_0x537e87);return _0xa7a3c6['set'](_0xfc04('0x31'),_0x5beccb+'-'+_0x55202c+'/'+_0x3b8958)[_0xfc04('0x2c')](_0x587201);}return null;};}function patchUpdates(_0x4bf1e9){return function(_0x2755f6){try{jsonpatch['apply'](_0x2755f6,_0x4bf1e9,!![]);}catch(_0xbd2d9a){return BPromise[_0xfc04('0x32')](_0xbd2d9a);}return _0x2755f6[_0xfc04('0x33')]();};}function saveUpdates(_0x57e381,_0x35a401){return function(_0x29b3ae){if(_0x29b3ae){return _0x29b3ae[_0xfc04('0x34')](_0x57e381)[_0xfc04('0x35')](function(_0x55a732){return _0x55a732;});}return null;};}function removeEntity(_0x5972ee,_0x311d3a){return function(_0x3f1a7a){if(_0x3f1a7a){return _0x3f1a7a['destroy']()[_0xfc04('0x35')](function(){_0x5972ee[_0xfc04('0x2a')](0xcc)[_0xfc04('0x2b')]();});}};}function handleEntityNotFound(_0x308214,_0x5da6e3){return function(_0x23f5c5){if(!_0x23f5c5){_0x308214['sendStatus'](0x194);}return _0x23f5c5;};}function handleError(_0x2467ff,_0x5eadf4){_0x5eadf4=_0x5eadf4||0x1f4;return function(_0x3e6b7b){logger[_0xfc04('0x24')](_0x3e6b7b['stack']);if(_0x3e6b7b['name']){delete _0x3e6b7b[_0xfc04('0x36')];}_0x2467ff[_0xfc04('0x2a')](_0x5eadf4)[_0xfc04('0x37')](_0x3e6b7b);};}exports[_0xfc04('0x38')]=function(_0x2e1a72,_0x2a1ce7){var _0x29246c={},_0x180adf={},_0x4ec5e5={'count':0x0,'rows':[]};var _0x35454f=_['map'](db['Setting'][_0xfc04('0x39')],function(_0xb909ed){return{'name':_0xb909ed['fieldName'],'type':_0xb909ed[_0xfc04('0x3a')][_0xfc04('0x3b')]};});_0x180adf[_0xfc04('0x3c')]=_[_0xfc04('0x3d')](_0x35454f,_0xfc04('0x36'));_0x180adf[_0xfc04('0x3e')]=_[_0xfc04('0x3f')](_0x2e1a72[_0xfc04('0x3e')]);_0x180adf[_0xfc04('0x40')]=_[_0xfc04('0x41')](_0x180adf[_0xfc04('0x3c')],_0x180adf[_0xfc04('0x3e')]);_0x29246c['attributes']=_[_0xfc04('0x41')](_0x180adf['model'],qs[_0xfc04('0x42')](_0x2e1a72['query'][_0xfc04('0x42')]));_0x29246c[_0xfc04('0x43')]=_0x29246c[_0xfc04('0x43')][_0xfc04('0x44')]?_0x29246c['attributes']:_0x180adf[_0xfc04('0x3c')];if(!_0x2e1a72['query'][_0xfc04('0x45')]('nolimit')){_0x29246c[_0xfc04('0x2e')]=qs[_0xfc04('0x2e')](_0x2e1a72[_0xfc04('0x3e')][_0xfc04('0x2e')]);_0x29246c[_0xfc04('0x2d')]=qs[_0xfc04('0x2d')](_0x2e1a72[_0xfc04('0x3e')][_0xfc04('0x2d')]);}_0x29246c['order']=qs['sort'](_0x2e1a72[_0xfc04('0x3e')]['sort']);_0x29246c['where']=qs[_0xfc04('0x40')](_[_0xfc04('0x46')](_0x2e1a72['query'],_0x180adf[_0xfc04('0x40')]),_0x35454f);if(_0x2e1a72[_0xfc04('0x3e')]['filter']){_0x29246c[_0xfc04('0x47')]=_[_0xfc04('0x48')](_0x29246c[_0xfc04('0x47')],{'$or':_['map'](_0x35454f,function(_0x30c128){if(_0x30c128[_0xfc04('0x3a')]!==_0xfc04('0x49')){var _0x458728={};_0x458728[_0x30c128[_0xfc04('0x36')]]={'$like':'%'+_0x2e1a72[_0xfc04('0x3e')]['filter']+'%'};return _0x458728;}})});}_0x29246c=_['merge']({},_0x29246c,_0x2e1a72[_0xfc04('0x4a')]);var _0x4f6a16={'where':_0x29246c[_0xfc04('0x47')]};return db['Setting']['count'](_0x4f6a16)[_0xfc04('0x35')](function(_0x1082b6){_0x4ec5e5[_0xfc04('0x30')]=_0x1082b6;if(_0x2e1a72[_0xfc04('0x3e')][_0xfc04('0x4b')]){_0x29246c[_0xfc04('0x4c')]=[{'all':!![]}];}return db[_0xfc04('0x4d')][_0xfc04('0x4e')](_0x29246c);})[_0xfc04('0x35')](function(_0x1cb9c7){_0x4ec5e5[_0xfc04('0x4f')]=_0x1cb9c7;return _0x4ec5e5;})['then'](respondWithFilteredResult(_0x2a1ce7,_0x29246c))[_0xfc04('0x28')](handleError(_0x2a1ce7,null));};exports[_0xfc04('0x50')]=function(_0xcfc047,_0x5ed560){var _0x4df139={'raw':![],'where':{'id':_0xcfc047[_0xfc04('0x51')]['id']}},_0x1a9164={};_0x1a9164['model']=_['keys'](db[_0xfc04('0x4d')][_0xfc04('0x39')]);_0x1a9164[_0xfc04('0x3e')]=_[_0xfc04('0x3f')](_0xcfc047['query']);_0x1a9164[_0xfc04('0x40')]=_[_0xfc04('0x41')](_0x1a9164[_0xfc04('0x3c')],_0x1a9164['query']);_0x4df139[_0xfc04('0x43')]=_[_0xfc04('0x41')](_0x1a9164[_0xfc04('0x3c')],qs['fields'](_0xcfc047[_0xfc04('0x3e')][_0xfc04('0x42')]));_0x4df139[_0xfc04('0x43')]=_0x4df139[_0xfc04('0x43')][_0xfc04('0x44')]?_0x4df139['attributes']:_0x1a9164['model'];if(_0xcfc047[_0xfc04('0x3e')][_0xfc04('0x4b')]){_0x4df139[_0xfc04('0x4c')]=[{'all':!![]}];}_0x4df139=_['merge']({},_0x4df139,_0xcfc047[_0xfc04('0x4a')]);return db[_0xfc04('0x4d')][_0xfc04('0x52')](_0x4df139)[_0xfc04('0x35')](handleEntityNotFound(_0x5ed560,null))[_0xfc04('0x35')](respondWithResult(_0x5ed560,null))[_0xfc04('0x28')](handleError(_0x5ed560,null));};exports[_0xfc04('0x34')]=function(_0x264213,_0x371ec2){if(_0x264213['body']['id']){delete _0x264213[_0xfc04('0x53')]['id'];}return db[_0xfc04('0x4d')]['find']({'where':{'id':_0x264213[_0xfc04('0x51')]['id']}})[_0xfc04('0x35')](handleEntityNotFound(_0x371ec2,null))['then'](saveUpdates(_0x264213[_0xfc04('0x53')],null))[_0xfc04('0x35')](respondWithResult(_0x371ec2,null))[_0xfc04('0x28')](handleError(_0x371ec2,null));};exports['addLogo']=function(_0x338ba1,_0xfef60e,_0x513805){if(_0x338ba1[_0xfc04('0x54')]&&_0x338ba1[_0xfc04('0x54')][_0xfc04('0x55')]){_0x338ba1[_0xfc04('0x53')][_0xfc04('0x56')]=_0x338ba1['file'][_0xfc04('0x55')];}return db['Setting'][_0xfc04('0x52')]({'where':{'id':_0x338ba1[_0xfc04('0x51')]['id']}})['then'](handleEntityNotFound(_0xfef60e,null))[_0xfc04('0x35')](saveUpdates(_0x338ba1[_0xfc04('0x53')],null))[_0xfc04('0x35')](respondWithResult(_0xfef60e,null))[_0xfc04('0x28')](handleError(_0xfef60e,null));};exports[_0xfc04('0x57')]=function(_0xf2517b,_0x53531,_0x5d0ee0){if(_0xf2517b[_0xfc04('0x54')]&&_0xf2517b[_0xfc04('0x54')][_0xfc04('0x55')]){_0xf2517b['body'][_0xfc04('0x58')]=_0xf2517b[_0xfc04('0x54')][_0xfc04('0x55')];}return db[_0xfc04('0x4d')][_0xfc04('0x52')]({'where':{'id':_0xf2517b[_0xfc04('0x51')]['id']}})['then'](handleEntityNotFound(_0x53531,null))[_0xfc04('0x35')](saveUpdates(_0xf2517b[_0xfc04('0x53')],null))[_0xfc04('0x35')](respondWithResult(_0x53531,null))[_0xfc04('0x28')](handleError(_0x53531,null));};var utilLicense=require(_0xfc04('0x18'));exports[_0xfc04('0x59')]=function(_0x1c1a31,_0xc816f9,_0x2f9754){var _0x9884b4=_0xfc04('0x5a');var _0x2f3473={'custom':![]};return utilLicense[_0xfc04('0x5b')]()[_0xfc04('0x35')](function(_0x58c160){if(_0x58c160){_0x2f3473=_0x58c160;}return db[_0xfc04('0x4d')][_0xfc04('0x52')]({'where':{'id':_0x1c1a31['params']['id']},'attributes':[_0xfc04('0x56'),_0xfc04('0x58'),_0xfc04('0x5c'),'favicon',_0xfc04('0x5d'),_0xfc04('0x5e'),_0xfc04('0x5f'),_0xfc04('0x60')],'raw':!![]});})[_0xfc04('0x35')](handleEntityNotFound(_0xc816f9,null))[_0xfc04('0x35')](function(_0x20a055){if(_0x20a055){var _0x374cc1=_0x20a055[_0xfc04('0x56')]&&fs[_0xfc04('0x61')](path['join'](config[_0xfc04('0x62')],_0x9884b4,_[_0xfc04('0x63')](_0x20a055[_0xfc04('0x56')])))?path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x9884b4,_[_0xfc04('0x63')](_0x20a055['logo'])):path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x9884b4,_[_0xfc04('0x63')](_0xfc04('0x65')));var _0x566767=_0xfc04('0x66')+_[_0xfc04('0x67')]('logo');if(_0x20a055[_0x566767]||!_0x2f3473['custom']){_0x374cc1=path['join'](config[_0xfc04('0x62')],_0x9884b4,_[_0xfc04('0x63')](_0xfc04('0x65')));}if(!fs[_0xfc04('0x61')](_0x374cc1)){throw new db['Sequelize'][(_0xfc04('0x68'))](_['upperFirst'](_0xfc04('0x56'))+_0xfc04('0x69'));}return _0xc816f9[_0xfc04('0x6a')](_0x374cc1);}})[_0xfc04('0x28')](handleError(_0xc816f9,null));};var utilLicense=require(_0xfc04('0x18'));exports[_0xfc04('0x6b')]=function(_0x380d4d,_0x1e1b72,_0x54dc74){var _0x5d30da='server/files/images/logos';var _0x4dd229={'custom':![]};return utilLicense[_0xfc04('0x5b')]()[_0xfc04('0x35')](function(_0x2515ec){if(_0x2515ec){_0x4dd229=_0x2515ec;}return db[_0xfc04('0x4d')][_0xfc04('0x52')]({'where':{'id':_0x380d4d[_0xfc04('0x51')]['id']},'attributes':[_0xfc04('0x56'),_0xfc04('0x58'),_0xfc04('0x5c'),_0xfc04('0x6c'),_0xfc04('0x5d'),_0xfc04('0x5e'),_0xfc04('0x5f'),_0xfc04('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1e1b72,null))[_0xfc04('0x35')](function(_0x36fd7e){if(_0x36fd7e){var _0x393ab6=_0x36fd7e[_0xfc04('0x58')]&&fs[_0xfc04('0x61')](path['join'](config[_0xfc04('0x62')],_0x5d30da,_[_0xfc04('0x63')](_0x36fd7e[_0xfc04('0x58')])))?path['join'](config['root'],_0x5d30da,_[_0xfc04('0x63')](_0x36fd7e[_0xfc04('0x58')])):path['join'](config[_0xfc04('0x62')],_0x5d30da,_[_0xfc04('0x63')](_0xfc04('0x6d')));var _0x35813f=_0xfc04('0x66')+_[_0xfc04('0x67')](_0xfc04('0x58'));if(_0x36fd7e[_0x35813f]||!_0x4dd229[_0xfc04('0x6e')]){_0x393ab6=path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x5d30da,_[_0xfc04('0x63')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x393ab6)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0xfc04('0x58'))+_0xfc04('0x69'));}return _0x1e1b72[_0xfc04('0x6a')](_0x393ab6);}})[_0xfc04('0x28')](handleError(_0x1e1b72,null));};exports['gdpr']=function(_0x35b4bd,_0x50b35a){return db['Setting'][_0xfc04('0x52')]({'where':{'id':_0x35b4bd[_0xfc04('0x51')]['id']},'attributes':[_0xfc04('0x6f')]})[_0xfc04('0x35')](respondWithResult(_0x50b35a,null))[_0xfc04('0x28')](handleError(_0x50b35a,null));};exports['addPreferred']=function(_0x523921,_0x301d60,_0x326dfe){if(_0x523921[_0xfc04('0x54')]&&_0x523921[_0xfc04('0x54')][_0xfc04('0x55')]){_0x523921['body'][_0xfc04('0x5c')]=_0x523921[_0xfc04('0x54')][_0xfc04('0x55')];}return db[_0xfc04('0x4d')][_0xfc04('0x52')]({'where':{'id':_0x523921[_0xfc04('0x51')]['id']}})['then'](handleEntityNotFound(_0x301d60,null))['then'](saveUpdates(_0x523921[_0xfc04('0x53')],null))['then'](respondWithResult(_0x301d60,null))[_0xfc04('0x28')](handleError(_0x301d60,null));};var utilLicense=require(_0xfc04('0x18'));exports['getPreferred']=function(_0xbaea1c,_0x479e9b,_0x4eca77){var _0x32607b='server/files/images/logos';var _0x4b07ae={'custom':![]};return utilLicense[_0xfc04('0x5b')]()['then'](function(_0x5cca28){if(_0x5cca28){_0x4b07ae=_0x5cca28;}return db['Setting'][_0xfc04('0x52')]({'where':{'id':_0xbaea1c[_0xfc04('0x51')]['id']},'attributes':['logo',_0xfc04('0x58'),'preferred',_0xfc04('0x6c'),_0xfc04('0x5d'),'defaultLoginLogo',_0xfc04('0x5f'),_0xfc04('0x60')],'raw':!![]});})[_0xfc04('0x35')](handleEntityNotFound(_0x479e9b,null))[_0xfc04('0x35')](function(_0x424f1a){if(_0x424f1a){var _0x12171a=_0x424f1a[_0xfc04('0x5c')]&&fs['existsSync'](path['join'](config[_0xfc04('0x62')],_0x32607b,_[_0xfc04('0x63')](_0x424f1a[_0xfc04('0x5c')])))?path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x32607b,_['toLower'](_0x424f1a[_0xfc04('0x5c')])):path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x32607b,_[_0xfc04('0x63')](_0xfc04('0x70')));var _0x45a8a7=_0xfc04('0x66')+_['upperFirst']('preferred');if(_0x424f1a[_0x45a8a7]||!_0x4b07ae[_0xfc04('0x6e')]||!_0x4b07ae['preferred']){_0x12171a=path[_0xfc04('0x64')](config['root'],_0x32607b,_['toLower'](_0xfc04('0x70')));}if(!fs[_0xfc04('0x61')](_0x12171a)){throw new db['Sequelize']['ValidationError'](_[_0xfc04('0x67')](_0xfc04('0x5c'))+_0xfc04('0x69'));}return _0x479e9b[_0xfc04('0x6a')](_0x12171a);}})[_0xfc04('0x28')](handleError(_0x479e9b,null));};exports[_0xfc04('0x71')]=function(_0x3f7677,_0x34c2c5,_0x1099ed){if(_0x3f7677[_0xfc04('0x54')]&&_0x3f7677['file'][_0xfc04('0x55')]){_0x3f7677[_0xfc04('0x53')][_0xfc04('0x6c')]=_0x3f7677[_0xfc04('0x54')][_0xfc04('0x55')];}return db[_0xfc04('0x4d')][_0xfc04('0x52')]({'where':{'id':_0x3f7677[_0xfc04('0x51')]['id']}})[_0xfc04('0x35')](handleEntityNotFound(_0x34c2c5,null))[_0xfc04('0x35')](saveUpdates(_0x3f7677[_0xfc04('0x53')],null))[_0xfc04('0x35')](respondWithResult(_0x34c2c5,null))[_0xfc04('0x28')](handleError(_0x34c2c5,null));};var utilLicense=require(_0xfc04('0x18'));exports[_0xfc04('0x72')]=function(_0x2c9af3,_0x15478d,_0x285f8e){var _0x57786b='server/files/images/logos';var _0x43c33f={'custom':![]};return utilLicense[_0xfc04('0x5b')]()[_0xfc04('0x35')](function(_0x532b51){if(_0x532b51){_0x43c33f=_0x532b51;}return db['Setting'][_0xfc04('0x52')]({'where':{'id':_0x2c9af3[_0xfc04('0x51')]['id']},'attributes':['logo',_0xfc04('0x58'),_0xfc04('0x5c'),_0xfc04('0x6c'),_0xfc04('0x5d'),_0xfc04('0x5e'),_0xfc04('0x5f'),_0xfc04('0x60')],'raw':!![]});})[_0xfc04('0x35')](handleEntityNotFound(_0x15478d,null))['then'](function(_0x83325c){if(_0x83325c){var _0x8abc23=_0x83325c[_0xfc04('0x6c')]&&fs['existsSync'](path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x57786b,_[_0xfc04('0x63')](_0x83325c['favicon'])))?path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x57786b,_['toLower'](_0x83325c['favicon'])):path[_0xfc04('0x64')](config[_0xfc04('0x62')],_0x57786b,_[_0xfc04('0x63')](_0xfc04('0x73')));var _0x433d08=_0xfc04('0x66')+_[_0xfc04('0x67')](_0xfc04('0x6c'));if(_0x83325c[_0x433d08]||!_0x43c33f['custom']){_0x8abc23=path[_0xfc04('0x64')](config['root'],_0x57786b,_[_0xfc04('0x63')](_0xfc04('0x73')));}if(!fs[_0xfc04('0x61')](_0x8abc23)){throw new db[(_0xfc04('0x74'))][(_0xfc04('0x68'))](_[_0xfc04('0x67')]('favicon')+'\x20not\x20found');}return _0x15478d[_0xfc04('0x6a')](_0x8abc23);}})[_0xfc04('0x28')](handleError(_0x15478d,null));};exports[_0xfc04('0x75')]=function(_0x59f4fa,_0x365346){var _0x474605={'offset':moment()[_0xfc04('0x76')]()};_0x474605[_0xfc04('0x77')]=moment()[_0xfc04('0x76')](_0x474605[_0xfc04('0x2d')])[_0xfc04('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x365346[_0xfc04('0x2a')](0xc8)['send'](_0x474605);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b170206..2a54708 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x7217,0x19e));var _0x7721=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x7217[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index df544c3..e5327ab 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 _0x50d9=['http','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','Setting,\x20%s,\x20%s','ShowSetting','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3dfc36,_0x38f896){var _0x219473=function(_0x49d76b){while(--_0x49d76b){_0x3dfc36['push'](_0x3dfc36['shift']());}};_0x219473(++_0x38f896);}(_0x50d9,0x83));var _0x950d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x50d9[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x950d('0x0'));var util=require(_0x950d('0x1'));var moment=require(_0x950d('0x2'));var BPromise=require('bluebird');var rs=require(_0x950d('0x3'));var fs=require('fs');var Redis=require(_0x950d('0x4'));var db=require(_0x950d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x950d('0x6'))('rpc');var config=require(_0x950d('0x7'));var jayson=require(_0x950d('0x8'));var client=jayson['client'][_0x950d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x200a94,_0x4cd34e,_0x521b1a){return new BPromise(function(_0x3ef4cc,_0x1e9930){return client['request'](_0x200a94,_0x521b1a)[_0x950d('0xa')](function(_0x5049f8){logger[_0x950d('0xb')]('Setting,\x20%s,\x20%s',_0x4cd34e,'request\x20sent');logger[_0x950d('0xc')](_0x950d('0xd'),_0x4cd34e,_0x950d('0xe'),JSON['stringify'](_0x5049f8));if(_0x5049f8['error']){if(_0x5049f8['error'][_0x950d('0xf')]===0x1f4){logger[_0x950d('0x10')]('Setting,\x20%s,\x20%s',_0x4cd34e,_0x5049f8[_0x950d('0x10')][_0x950d('0x11')]);return _0x1e9930(_0x5049f8['error'][_0x950d('0x11')]);}logger[_0x950d('0x10')](_0x950d('0x12'),_0x4cd34e,_0x5049f8['error'][_0x950d('0x11')]);return _0x3ef4cc(_0x5049f8[_0x950d('0x10')][_0x950d('0x11')]);}else{logger[_0x950d('0xb')]('Setting,\x20%s,\x20%s',_0x4cd34e,_0x950d('0xe'));_0x3ef4cc(_0x5049f8['result'][_0x950d('0x11')]);}})['catch'](function(_0x48a326){logger[_0x950d('0x10')](_0x950d('0x12'),_0x4cd34e,_0x48a326);_0x1e9930(_0x48a326);});});}exports[_0x950d('0x13')]=function(_0x187852){var _0x4198b7=this;return new Promise(function(_0x185568,_0x409946){return db['Setting'][_0x950d('0x14')]({'raw':_0x187852[_0x950d('0x15')]?_0x187852[_0x950d('0x15')][_0x950d('0x16')]===undefined?!![]:![]:!![],'where':_0x187852[_0x950d('0x15')]?_0x187852[_0x950d('0x15')]['where']||null:null,'attributes':_0x187852[_0x950d('0x15')]?_0x187852[_0x950d('0x15')][_0x950d('0x17')]||null:null,'include':_0x187852['options']?_0x187852[_0x950d('0x15')][_0x950d('0x18')]?_[_0x950d('0x19')](_0x187852[_0x950d('0x15')][_0x950d('0x18')],function(_0x234b4f){return{'model':db[_0x234b4f[_0x950d('0x1a')]],'as':_0x234b4f['as'],'attributes':_0x234b4f[_0x950d('0x17')],'include':_0x234b4f[_0x950d('0x18')]?_[_0x950d('0x19')](_0x234b4f[_0x950d('0x18')],function(_0x3cf744){return{'model':db[_0x3cf744[_0x950d('0x1a')]],'as':_0x3cf744['as'],'attributes':_0x3cf744['attributes'],'include':_0x3cf744[_0x950d('0x18')]?_[_0x950d('0x19')](_0x3cf744[_0x950d('0x18')],function(_0x522f47){return{'model':db[_0x522f47['model']],'as':_0x522f47['as'],'attributes':_0x522f47[_0x950d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x950d('0xa')](function(_0x447e8d){logger['info']('ShowSetting',_0x187852);logger['debug'](_0x950d('0x13'),_0x187852,JSON[_0x950d('0x1b')](_0x447e8d));_0x185568(_0x447e8d);})['catch'](function(_0x356be5){logger[_0x950d('0x10')](_0x950d('0x13'),_0x356be5[_0x950d('0x11')],_0x187852);_0x409946(_0x4198b7[_0x950d('0x10')](0x1f4,_0x356be5['message']));});});}; \ No newline at end of file +var _0x1ef9=['ShowSetting','Setting','options','raw','where','attributes','map','include','model','info','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1ef9,0x1da));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91ef('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91ef('0x2'))(_0x91ef('0x3'));var config=require(_0x91ef('0x4'));var jayson=require(_0x91ef('0x5'));var client=jayson['client'][_0x91ef('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x31ba89,_0x50e97e,_0x2a60fe){return new BPromise(function(_0x448e7f,_0x1a59aa){return client[_0x91ef('0x7')](_0x31ba89,_0x2a60fe)[_0x91ef('0x8')](function(_0xf7d583){logger['info'](_0x91ef('0x9'),_0x50e97e,_0x91ef('0xa'));logger[_0x91ef('0xb')](_0x91ef('0xc'),_0x50e97e,_0x91ef('0xa'),JSON[_0x91ef('0xd')](_0xf7d583));if(_0xf7d583[_0x91ef('0xe')]){if(_0xf7d583[_0x91ef('0xe')][_0x91ef('0xf')]===0x1f4){logger['error'](_0x91ef('0x9'),_0x50e97e,_0xf7d583[_0x91ef('0xe')][_0x91ef('0x10')]);return _0x1a59aa(_0xf7d583[_0x91ef('0xe')][_0x91ef('0x10')]);}logger[_0x91ef('0xe')](_0x91ef('0x9'),_0x50e97e,_0xf7d583[_0x91ef('0xe')][_0x91ef('0x10')]);return _0x448e7f(_0xf7d583['error'][_0x91ef('0x10')]);}else{logger['info'](_0x91ef('0x9'),_0x50e97e,_0x91ef('0xa'));_0x448e7f(_0xf7d583[_0x91ef('0x11')][_0x91ef('0x10')]);}})[_0x91ef('0x12')](function(_0x71c9bb){logger['error']('Setting,\x20%s,\x20%s',_0x50e97e,_0x71c9bb);_0x1a59aa(_0x71c9bb);});});}exports[_0x91ef('0x13')]=function(_0x506e90){var _0x30ef3e=this;return new Promise(function(_0x34e5fb,_0x551560){return db[_0x91ef('0x14')]['find']({'raw':_0x506e90['options']?_0x506e90[_0x91ef('0x15')][_0x91ef('0x16')]===undefined?!![]:![]:!![],'where':_0x506e90['options']?_0x506e90['options'][_0x91ef('0x17')]||null:null,'attributes':_0x506e90[_0x91ef('0x15')]?_0x506e90[_0x91ef('0x15')][_0x91ef('0x18')]||null:null,'include':_0x506e90[_0x91ef('0x15')]?_0x506e90[_0x91ef('0x15')]['include']?_[_0x91ef('0x19')](_0x506e90[_0x91ef('0x15')][_0x91ef('0x1a')],function(_0x10936c){return{'model':db[_0x10936c[_0x91ef('0x1b')]],'as':_0x10936c['as'],'attributes':_0x10936c[_0x91ef('0x18')],'include':_0x10936c[_0x91ef('0x1a')]?_[_0x91ef('0x19')](_0x10936c[_0x91ef('0x1a')],function(_0x144fac){return{'model':db[_0x144fac[_0x91ef('0x1b')]],'as':_0x144fac['as'],'attributes':_0x144fac[_0x91ef('0x18')],'include':_0x144fac['include']?_['map'](_0x144fac['include'],function(_0x104032){return{'model':db[_0x104032[_0x91ef('0x1b')]],'as':_0x104032['as'],'attributes':_0x104032[_0x91ef('0x18')]};}):[]};}):[]};}):[]:[]})[_0x91ef('0x8')](function(_0x27a4ce){logger[_0x91ef('0x1c')](_0x91ef('0x13'),_0x506e90);logger[_0x91ef('0xb')](_0x91ef('0x13'),_0x506e90,JSON[_0x91ef('0xd')](_0x27a4ce));_0x34e5fb(_0x27a4ce);})[_0x91ef('0x12')](function(_0x4bf485){logger[_0x91ef('0xe')]('ShowSetting',_0x4bf485['message'],_0x506e90);_0x551560(_0x30ef3e[_0x91ef('0xe')](0x1f4,_0x4bf485[_0x91ef('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 5216b3d..461089a 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(_0x55351e,_0x2edf11){var _0x3d6967=function(_0x4c3050){while(--_0x4c3050){_0x55351e['push'](_0x55351e['shift']());}};_0x3d6967(++_0x2edf11);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x24b1ea,_0x642a66){var _0x1eb3b0=function(_0x57c90b){while(--_0x57c90b){_0x24b1ea['push'](_0x24b1ea['shift']());}};_0x1eb3b0(++_0x642a66);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 3b5908a..dec481c 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 _0xb3d7=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x245507,_0x1bf108){var _0x4b5626=function(_0xef50aa){while(--_0xef50aa){_0x245507['push'](_0x245507['shift']());}};_0x4b5626(++_0x1bf108);}(_0xb3d7,0xbc));var _0x7b3d=function(_0x4331ae,_0x382e8c){_0x4331ae=_0x4331ae-0x0;var _0x1b2833=_0xb3d7[_0x4331ae];return _0x1b2833;};'use strict';var Sequelize=require(_0x7b3d('0x0'));var rs=require(_0x7b3d('0x1'));module[_0x7b3d('0x2')]={'name':{'type':Sequelize[_0x7b3d('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x7b3d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7b3d('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7b3d('0x4')]();}},'phone':{'type':Sequelize[_0x7b3d('0x3')]},'type':{'type':Sequelize[_0x7b3d('0x5')](_0x7b3d('0x6'),_0x7b3d('0x7'),_0x7b3d('0x8'),_0x7b3d('0x9'),_0x7b3d('0xa'),_0x7b3d('0xb'),'bandwidth',_0x7b3d('0xc'),_0x7b3d('0xd'),_0x7b3d('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7b3d('0x3')]},'smsMethod':{'type':Sequelize[_0x7b3d('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7b3d('0x3')]},'password':{'type':Sequelize[_0x7b3d('0x3')]},'apiKey':{'type':Sequelize[_0x7b3d('0x3')]},'applicationId':{'type':Sequelize[_0x7b3d('0x3')]},'accountId':{'type':Sequelize[_0x7b3d('0x3')]},'senderString':{'type':Sequelize[_0x7b3d('0x3')]},'deliveryReport':{'type':Sequelize[_0x7b3d('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x7b3d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7b3d('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7b3d('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7b3d('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b3d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7b3d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b3d('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b3d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b3d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7b3d('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x7b3d('0xf')],'defaultValue':![],'comment':_0x7b3d('0x13'),'set':function(_0x1081db){if(!_0x1081db)this[_0x7b3d('0x14')](_0x7b3d('0x15'),null);this[_0x7b3d('0x14')](_0x7b3d('0x16'),_0x1081db);}}}; \ No newline at end of file +var _0xc02a=['twilio','connectel','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x400a4f,_0x302b31){var _0x2d0335=function(_0x3d0955){while(--_0x3d0955){_0x400a4f['push'](_0x400a4f['shift']());}};_0x2d0335(++_0x302b31);}(_0xc02a,0x1e8));var _0xac02=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0xc02a[_0x9db5d3];return _0x477a81;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xac02('0x0'));module[_0xac02('0x1')]={'name':{'type':Sequelize[_0xac02('0x2')],'unique':_0xac02('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xac02('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xac02('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xac02('0x2')],'defaultValue':function(){return rs[_0xac02('0x4')]();}},'phone':{'type':Sequelize[_0xac02('0x2')]},'type':{'type':Sequelize[_0xac02('0x5')](_0xac02('0x6'),'skebby',_0xac02('0x7'),'clicksend',_0xac02('0x8'),'clickatell',_0xac02('0x9'),_0xac02('0xa'),_0xac02('0xb'),_0xac02('0xc'))},'accountSid':{'type':Sequelize[_0xac02('0x2')]},'authId':{'type':Sequelize[_0xac02('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xac02('0x2')]},'password':{'type':Sequelize[_0xac02('0x2')]},'apiKey':{'type':Sequelize[_0xac02('0x2')]},'applicationId':{'type':Sequelize[_0xac02('0x2')]},'accountId':{'type':Sequelize[_0xac02('0x2')]},'senderString':{'type':Sequelize[_0xac02('0x2')]},'deliveryReport':{'type':Sequelize[_0xac02('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xac02('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xac02('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac02('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xac02('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac02('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac02('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xac02('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac02('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xac02('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xac02('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xac02('0xd')],'defaultValue':![],'comment':_0xac02('0x10'),'set':function(_0x3d5b87){if(!_0x3d5b87)this['setDataValue'](_0xac02('0x11'),null);this[_0xac02('0x12')]('mandatoryDisposition',_0x3d5b87);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e9d175f..e1ed608 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 _0x8b62=['removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./smsAccount.socket','jayson/promise','http','request','then','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','status','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','SmsAccount','findAll','show','Pause','length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','order','SmsAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','applications','orderBy','priority','account','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','Body','skebby','text','connectel','clicksend','plivo','From','Text','messageId','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','from\x20is\x20mandatory','isNil','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','omit','Contacts','contact','SmsInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','json','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','finally','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','spread','Messages','dataValues','debug','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','DELIVERED','groupName','redif','error_code','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','addAgents','emit','userSmsAccount:save'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x8b62,0xea));var _0x28b6=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0x8b62[_0x3dfeb9];return _0x412314;};'use strict';var emlformat=require(_0x28b6('0x0'));var rimraf=require(_0x28b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28b6('0x2'));var rp=require(_0x28b6('0x3'));var moment=require(_0x28b6('0x4'));var BPromise=require(_0x28b6('0x5'));var Mustache=require(_0x28b6('0x6'));var util=require(_0x28b6('0x7'));var path=require(_0x28b6('0x8'));var sox=require(_0x28b6('0x9'));var csv=require(_0x28b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28b6('0xb'));var _=require('lodash');var squel=require(_0x28b6('0xc'));var crypto=require('crypto');var jsforce=require(_0x28b6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x28b6('0xa'));var querystring=require(_0x28b6('0xe'));var Papa=require(_0x28b6('0xf'));var Redis=require(_0x28b6('0x10'));var authService=require(_0x28b6('0x11'));var qs=require(_0x28b6('0x12'));var as=require(_0x28b6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28b6('0x14'))(_0x28b6('0x15'));var utils=require(_0x28b6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x28b6('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x28b6('0x18')](config[_0x28b6('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28b6('0x19')]));require(_0x28b6('0x1a'))['register'](socket);var jayson=require(_0x28b6('0x1b'));var client=jayson['client'][_0x28b6('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x112315,_0x4829d7,_0x44d7eb,_0x189a98){return new BPromise(function(_0x2475be,_0x58897e){var _0xba2113=_0x189a98||client;return _0xba2113[_0x28b6('0x1d')](_0x112315,_0x44d7eb)[_0x28b6('0x1e')](function(_0x48390a){logger['info']('SmsAccount,\x20%s,\x20%s',_0x4829d7,'request\x20sent');logger['debug'](_0x28b6('0x1f'),_0x4829d7,_0x28b6('0x20'),JSON[_0x28b6('0x21')](_0x48390a));if(_0x48390a['error']){if(_0x48390a[_0x28b6('0x22')][_0x28b6('0x23')]===0x1f4){logger['error'](_0x28b6('0x24'),_0x4829d7,_0x48390a['error'][_0x28b6('0x25')]);return _0x58897e(_0x48390a[_0x28b6('0x22')][_0x28b6('0x25')]);}logger['error'](_0x28b6('0x24'),_0x4829d7,_0x48390a['error']['message']);return _0x2475be(_0x48390a[_0x28b6('0x22')][_0x28b6('0x25')]);}else{logger[_0x28b6('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4829d7,_0x28b6('0x20'));_0x2475be(_0x48390a[_0x28b6('0x27')]['message']);}})[_0x28b6('0x28')](function(_0x3b5940){logger[_0x28b6('0x22')]('SmsAccount,\x20%s,\x20%s',_0x4829d7,_0x3b5940);_0x58897e(_0x3b5940);});});}function respondWithStatusCode(_0x3e2c60,_0xdb0a5d){_0xdb0a5d=_0xdb0a5d||0xcc;return function(_0x2cf490){if(_0x2cf490){return _0x3e2c60['sendStatus'](_0xdb0a5d);}return _0x3e2c60[_0x28b6('0x29')](_0xdb0a5d)['end']();};}function respondWithResult(_0x3f22dc,_0x10e068){_0x10e068=_0x10e068||0xc8;return function(_0x4cf5d2){if(_0x4cf5d2){return _0x3f22dc[_0x28b6('0x29')](_0x10e068)['json'](_0x4cf5d2);}};}function respondWithFilteredResult(_0x3d164c,_0x1afced){return function(_0x5f20fb){if(_0x5f20fb){var _0x2b3faf=typeof _0x1afced['offset']===_0x28b6('0x2a')&&typeof _0x1afced[_0x28b6('0x2b')]===_0x28b6('0x2a');var _0x2dcd3f=_0x5f20fb['count'];var _0x8987b4=_0x2b3faf?0x0:_0x1afced[_0x28b6('0x2c')];var _0x23bced=_0x2b3faf?_0x5f20fb[_0x28b6('0x2d')]:_0x1afced[_0x28b6('0x2c')]+_0x1afced[_0x28b6('0x2b')];var _0x48a128;if(_0x23bced>=_0x2dcd3f){_0x23bced=_0x2dcd3f;_0x48a128=0xc8;}else{_0x48a128=0xce;}_0x3d164c['status'](_0x48a128);return _0x3d164c[_0x28b6('0x2e')](_0x28b6('0x2f'),_0x8987b4+'-'+_0x23bced+'/'+_0x2dcd3f)['json'](_0x5f20fb);}return null;};}function patchUpdates(_0x6a943c){return function(_0x2fc1fa){try{jsonpatch[_0x28b6('0x30')](_0x2fc1fa,_0x6a943c,!![]);}catch(_0x48c4dc){return BPromise['reject'](_0x48c4dc);}return _0x2fc1fa[_0x28b6('0x31')]();};}function saveUpdates(_0x4947b5,_0x160c92){return function(_0x15059a){if(_0x15059a){return _0x15059a[_0x28b6('0x32')](_0x4947b5)['then'](function(_0x27c0cd){return _0x27c0cd;});}return null;};}function removeEntity(_0x2b7aee,_0x321b6f){return function(_0x425792){if(_0x425792){return _0x425792[_0x28b6('0x33')]()[_0x28b6('0x1e')](function(){var _0x3147c5=_0x425792['get']({'plain':!![]});var _0x2f594a='SmsAccounts';return db[_0x28b6('0x34')][_0x28b6('0x33')]({'where':{'type':_0x2f594a,'resourceId':_0x3147c5['id']}})[_0x28b6('0x1e')](function(){return _0x425792;});})[_0x28b6('0x1e')](function(){_0x2b7aee[_0x28b6('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x383de1,_0x44faad){return function(_0x9f6bf3){if(!_0x9f6bf3){_0x383de1[_0x28b6('0x35')](0x194);}return _0x9f6bf3;};}function handleError(_0x245bda,_0x411fc1){_0x411fc1=_0x411fc1||0x1f4;return function(_0x404825){logger['error'](_0x404825[_0x28b6('0x36')]);if(_0x404825['name']){delete _0x404825[_0x28b6('0x37')];}_0x245bda[_0x28b6('0x29')](_0x411fc1)[_0x28b6('0x38')](_0x404825);};}exports[_0x28b6('0x39')]=function(_0x434c6b,_0x892a54){var _0x19667f={'include':[{'model':db['Pause'],'as':_0x28b6('0x3a')}]},_0x4996cd={},_0x3eca10={'count':0x0,'rows':[]};var _0x5c0197=_[_0x28b6('0x3b')](db['SmsAccount'][_0x28b6('0x3c')],function(_0x2ba021){return{'name':_0x2ba021[_0x28b6('0x3d')],'type':_0x2ba021[_0x28b6('0x3e')][_0x28b6('0x3f')]};});_0x4996cd['model']=_[_0x28b6('0x3b')](_0x5c0197,_0x28b6('0x37'));_0x4996cd[_0x28b6('0x40')]=_[_0x28b6('0x41')](_0x434c6b[_0x28b6('0x40')]);_0x4996cd['filters']=_[_0x28b6('0x42')](_0x4996cd[_0x28b6('0x43')],_0x4996cd[_0x28b6('0x40')]);_0x19667f[_0x28b6('0x44')]=_[_0x28b6('0x42')](_0x4996cd[_0x28b6('0x43')],qs[_0x28b6('0x45')](_0x434c6b[_0x28b6('0x40')][_0x28b6('0x45')]));_0x19667f['attributes']=_0x19667f[_0x28b6('0x44')]['length']?_0x19667f[_0x28b6('0x44')]:_0x4996cd[_0x28b6('0x43')];if(!_0x434c6b[_0x28b6('0x40')][_0x28b6('0x46')](_0x28b6('0x47'))){_0x19667f[_0x28b6('0x2b')]=qs['limit'](_0x434c6b['query'][_0x28b6('0x2b')]);_0x19667f[_0x28b6('0x2c')]=qs['offset'](_0x434c6b[_0x28b6('0x40')][_0x28b6('0x2c')]);}_0x19667f['order']=qs[_0x28b6('0x48')](_0x434c6b[_0x28b6('0x40')][_0x28b6('0x48')]);_0x19667f[_0x28b6('0x49')]=qs[_0x28b6('0x4a')](_[_0x28b6('0x4b')](_0x434c6b[_0x28b6('0x40')],_0x4996cd[_0x28b6('0x4a')]),_0x5c0197);if(_0x434c6b[_0x28b6('0x40')][_0x28b6('0x4c')]){_0x19667f[_0x28b6('0x49')]=_[_0x28b6('0x4d')](_0x19667f[_0x28b6('0x49')],{'$or':_[_0x28b6('0x3b')](_0x5c0197,function(_0x44fb74){if(_0x44fb74[_0x28b6('0x3e')]!==_0x28b6('0x4e')){var _0x1d464a={};_0x1d464a[_0x44fb74[_0x28b6('0x37')]]={'$like':'%'+_0x434c6b['query'][_0x28b6('0x4c')]+'%'};return _0x1d464a;}})});}_0x19667f=_[_0x28b6('0x4d')]({},_0x19667f,_0x434c6b[_0x28b6('0x4f')]);var _0x19aa74={'where':_0x19667f[_0x28b6('0x49')]};return db['SmsAccount'][_0x28b6('0x2d')](_0x19aa74)[_0x28b6('0x1e')](function(_0x40ccd6){_0x3eca10[_0x28b6('0x2d')]=_0x40ccd6;if(_0x434c6b[_0x28b6('0x40')]['includeAll']){_0x19667f[_0x28b6('0x50')]=[{'all':!![]}];}return db[_0x28b6('0x51')][_0x28b6('0x52')](_0x19667f);})[_0x28b6('0x1e')](function(_0x345b8d){_0x3eca10['rows']=_0x345b8d;return _0x3eca10;})[_0x28b6('0x1e')](respondWithFilteredResult(_0x892a54,_0x19667f))['catch'](handleError(_0x892a54,null));};exports[_0x28b6('0x53')]=function(_0x89bdec,_0xc9fb8f){var _0x1805b3={'raw':![],'where':{'id':_0x89bdec['params']['id']},'include':[{'model':db[_0x28b6('0x54')],'as':_0x28b6('0x3a')}]},_0x1028cc={};_0x1028cc[_0x28b6('0x43')]=_['keys'](db['SmsAccount'][_0x28b6('0x3c')]);_0x1028cc[_0x28b6('0x40')]=_[_0x28b6('0x41')](_0x89bdec[_0x28b6('0x40')]);_0x1028cc['filters']=_[_0x28b6('0x42')](_0x1028cc[_0x28b6('0x43')],_0x1028cc['query']);_0x1805b3[_0x28b6('0x44')]=_[_0x28b6('0x42')](_0x1028cc[_0x28b6('0x43')],qs[_0x28b6('0x45')](_0x89bdec[_0x28b6('0x40')]['fields']));_0x1805b3['attributes']=_0x1805b3[_0x28b6('0x44')][_0x28b6('0x55')]?_0x1805b3['attributes']:_0x1028cc['model'];if(_0x89bdec[_0x28b6('0x40')][_0x28b6('0x56')]){_0x1805b3[_0x28b6('0x50')]=[{'all':!![]}];}_0x1805b3=_[_0x28b6('0x4d')]({},_0x1805b3,_0x89bdec['options']);return db[_0x28b6('0x51')]['find'](_0x1805b3)['then'](handleEntityNotFound(_0xc9fb8f,null))['then'](respondWithResult(_0xc9fb8f,null))['catch'](handleError(_0xc9fb8f,null));};exports[_0x28b6('0x57')]=function(_0xee8915,_0x1b29ef){return db[_0x28b6('0x51')][_0x28b6('0x57')](_0xee8915[_0x28b6('0x58')],{})[_0x28b6('0x1e')](function(_0x524bba){var _0x278a83=_0xee8915[_0x28b6('0x59')]['get']({'plain':!![]});if(!_0x278a83)throw new Error(_0x28b6('0x5a'));if(_0x278a83[_0x28b6('0x5b')]===_0x28b6('0x59')){var _0x25680a=_0x524bba[_0x28b6('0x5c')]({'plain':!![]});var _0x10494a='SmsAccounts';return db[_0x28b6('0x5d')][_0x28b6('0x5e')]({'where':{'name':_0x10494a,'userProfileId':_0x278a83[_0x28b6('0x5f')]},'raw':!![]})['then'](function(_0x29926f){if(_0x29926f&&_0x29926f[_0x28b6('0x60')]===0x0){return db[_0x28b6('0x34')][_0x28b6('0x57')]({'name':_0x25680a[_0x28b6('0x37')],'resourceId':_0x25680a['id'],'type':_0x29926f[_0x28b6('0x37')],'sectionId':_0x29926f['id']},{})[_0x28b6('0x1e')](function(){return _0x524bba;});}else{return _0x524bba;}})[_0x28b6('0x28')](function(_0x5dec30){logger[_0x28b6('0x22')](_0x28b6('0x61'),_0x5dec30);throw _0x5dec30;});}return _0x524bba;})['then'](respondWithResult(_0x1b29ef,0xc9))[_0x28b6('0x28')](handleError(_0x1b29ef,null));};exports[_0x28b6('0x32')]=function(_0x575f5c,_0x1c6c8e){if(_0x575f5c[_0x28b6('0x58')]['id']){delete _0x575f5c[_0x28b6('0x58')]['id'];}return db[_0x28b6('0x51')]['find']({'where':{'id':_0x575f5c[_0x28b6('0x62')]['id']},'include':[{'model':db[_0x28b6('0x54')],'as':'mandatoryDispositionPause'}]})[_0x28b6('0x1e')](handleEntityNotFound(_0x1c6c8e,null))[_0x28b6('0x1e')](saveUpdates(_0x575f5c[_0x28b6('0x58')],null))[_0x28b6('0x1e')](respondWithResult(_0x1c6c8e,null))[_0x28b6('0x28')](handleError(_0x1c6c8e,null));};exports[_0x28b6('0x33')]=function(_0x50fea5,_0x5a21cd){return db['SmsAccount'][_0x28b6('0x5e')]({'where':{'id':_0x50fea5['params']['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x5a21cd,null))[_0x28b6('0x1e')](removeEntity(_0x5a21cd,null))[_0x28b6('0x28')](handleError(_0x5a21cd,null));};exports[_0x28b6('0x63')]=function(_0x236cfa,_0x3e754e){return db[_0x28b6('0x51')][_0x28b6('0x63')]()[_0x28b6('0x1e')](respondWithResult(_0x3e754e,null))[_0x28b6('0x28')](handleError(_0x3e754e,null));};exports[_0x28b6('0x64')]=function(_0x437e55,_0x2ab9bb,_0xc8ee3a){if(_0x437e55[_0x28b6('0x58')]['id']){delete _0x437e55['body']['id'];}return db[_0x28b6('0x51')][_0x28b6('0x5e')]({'where':{'id':_0x437e55[_0x28b6('0x62')]['id']}})['then'](handleEntityNotFound(_0x2ab9bb,null))[_0x28b6('0x1e')](function(_0x1051fb){if(_0x1051fb){_0x437e55['body']['SmsAccountId']=_0x1051fb['id'];return db[_0x28b6('0x65')][_0x28b6('0x57')](_0x437e55['body']);}})[_0x28b6('0x1e')](respondWithResult(_0x2ab9bb,null))[_0x28b6('0x28')](handleError(_0x2ab9bb,null));};exports[_0x28b6('0x66')]=function(_0xe9815,_0x5914b2,_0x3778e7){var _0x402756={'raw':![],'where':{}};var _0x597f9f={};var _0x20ceac={'count':0x0,'rows':[]};return db['SmsAccount'][_0x28b6('0x67')]({'where':{'id':_0xe9815[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x5914b2,null))[_0x28b6('0x1e')](function(_0x54a4f7){if(_0x54a4f7){_0x597f9f[_0x28b6('0x43')]=_[_0x28b6('0x41')](db[_0x28b6('0x65')][_0x28b6('0x3c')]);_0x597f9f[_0x28b6('0x40')]=_[_0x28b6('0x41')](_0xe9815[_0x28b6('0x40')]);_0x597f9f[_0x28b6('0x4a')]=_['intersection'](_0x597f9f['model'],_0x597f9f[_0x28b6('0x40')]);_0x402756[_0x28b6('0x44')]=_[_0x28b6('0x42')](_0x597f9f[_0x28b6('0x43')],qs['fields'](_0xe9815[_0x28b6('0x40')][_0x28b6('0x45')]));_0x402756[_0x28b6('0x44')]=_0x402756[_0x28b6('0x44')][_0x28b6('0x55')]?_0x402756[_0x28b6('0x44')]:_0x597f9f[_0x28b6('0x43')];if(!_0xe9815[_0x28b6('0x40')][_0x28b6('0x46')]('nolimit')){_0x402756[_0x28b6('0x2b')]=qs['limit'](_0xe9815[_0x28b6('0x40')][_0x28b6('0x2b')]);_0x402756['offset']=qs[_0x28b6('0x2c')](_0xe9815[_0x28b6('0x40')][_0x28b6('0x2c')]);}_0x402756[_0x28b6('0x68')]=qs[_0x28b6('0x48')](_0xe9815[_0x28b6('0x40')][_0x28b6('0x48')]);_0x402756['where']=qs['filters'](_[_0x28b6('0x4b')](_0xe9815[_0x28b6('0x40')],_0x597f9f[_0x28b6('0x4a')]));_0x402756[_0x28b6('0x49')][_0x28b6('0x69')]=_0x54a4f7['id'];if(_0xe9815[_0x28b6('0x40')][_0x28b6('0x4c')]){_0x402756[_0x28b6('0x49')]=_[_0x28b6('0x4d')](_0x402756['where'],{'$or':_['map'](_0x402756[_0x28b6('0x44')],function(_0x5e86b2){var _0x2278e5={};_0x2278e5[_0x5e86b2]={'$like':'%'+_0xe9815[_0x28b6('0x40')]['filter']+'%'};return _0x2278e5;})});}_0x402756=_[_0x28b6('0x4d')]({},_0x402756,_0xe9815[_0x28b6('0x4f')]);return db['Disposition'][_0x28b6('0x2d')]({'where':_0x402756[_0x28b6('0x49')]})['then'](function(_0x5d622e){_0x20ceac['count']=_0x5d622e;if(_0xe9815[_0x28b6('0x40')][_0x28b6('0x56')]){_0x402756[_0x28b6('0x50')]=[{'all':!![]}];}return db[_0x28b6('0x65')][_0x28b6('0x52')](_0x402756);})[_0x28b6('0x1e')](function(_0x47fed5){_0x20ceac[_0x28b6('0x6a')]=_0x47fed5;return _0x20ceac;});}})[_0x28b6('0x1e')](respondWithFilteredResult(_0x5914b2,_0x402756))[_0x28b6('0x28')](handleError(_0x5914b2,null));};exports[_0x28b6('0x6b')]=function(_0x513325,_0x44fa1f,_0x37f070){return db[_0x28b6('0x51')]['find']({'where':{'id':_0x513325[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x44fa1f,null))['then'](function(_0x2070fa){if(_0x2070fa){return _0x2070fa['removeDispositions'](_0x513325[_0x28b6('0x40')][_0x28b6('0x6c')]);}})[_0x28b6('0x1e')](respondWithStatusCode(_0x44fa1f,null))[_0x28b6('0x28')](handleError(_0x44fa1f,null));};exports[_0x28b6('0x6d')]=function(_0x2d3de9,_0x3adcff,_0x3d7c68){if(_0x2d3de9[_0x28b6('0x58')]['id']){delete _0x2d3de9['body']['id'];}return db[_0x28b6('0x51')][_0x28b6('0x5e')]({'where':{'id':_0x2d3de9[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x3adcff,null))['then'](function(_0xa20837){if(_0xa20837){_0x2d3de9['body'][_0x28b6('0x69')]=_0xa20837['id'];return db[_0x28b6('0x6e')][_0x28b6('0x57')](_0x2d3de9['body']);}})[_0x28b6('0x1e')](respondWithResult(_0x3adcff,null))[_0x28b6('0x28')](handleError(_0x3adcff,null));};exports[_0x28b6('0x6f')]=function(_0x103445,_0x2831fa,_0xd3682a){var _0x2698d5={'raw':![],'where':{}};var _0x32e202={};var _0xb45c97={'count':0x0,'rows':[]};return db[_0x28b6('0x51')][_0x28b6('0x67')]({'where':{'id':_0x103445[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x2831fa,null))[_0x28b6('0x1e')](function(_0x14c2e5){if(_0x14c2e5){_0x32e202['model']=_[_0x28b6('0x41')](db[_0x28b6('0x6e')][_0x28b6('0x3c')]);_0x32e202['query']=_[_0x28b6('0x41')](_0x103445['query']);_0x32e202[_0x28b6('0x4a')]=_[_0x28b6('0x42')](_0x32e202[_0x28b6('0x43')],_0x32e202['query']);_0x2698d5['attributes']=_['intersection'](_0x32e202[_0x28b6('0x43')],qs[_0x28b6('0x45')](_0x103445[_0x28b6('0x40')]['fields']));_0x2698d5['attributes']=_0x2698d5[_0x28b6('0x44')]['length']?_0x2698d5['attributes']:_0x32e202['model'];if(!_0x103445['query'][_0x28b6('0x46')](_0x28b6('0x47'))){_0x2698d5[_0x28b6('0x2b')]=qs[_0x28b6('0x2b')](_0x103445[_0x28b6('0x40')][_0x28b6('0x2b')]);_0x2698d5[_0x28b6('0x2c')]=qs['offset'](_0x103445[_0x28b6('0x40')][_0x28b6('0x2c')]);}_0x2698d5[_0x28b6('0x68')]=qs[_0x28b6('0x48')](_0x103445[_0x28b6('0x40')][_0x28b6('0x48')]);_0x2698d5[_0x28b6('0x49')]=qs[_0x28b6('0x4a')](_[_0x28b6('0x4b')](_0x103445[_0x28b6('0x40')],_0x32e202[_0x28b6('0x4a')]));_0x2698d5[_0x28b6('0x49')][_0x28b6('0x69')]=_0x14c2e5['id'];if(_0x103445[_0x28b6('0x40')][_0x28b6('0x4c')]){_0x2698d5[_0x28b6('0x49')]=_[_0x28b6('0x4d')](_0x2698d5[_0x28b6('0x49')],{'$or':_['map'](_0x2698d5[_0x28b6('0x44')],function(_0x3e1f6c){var _0x414ebf={};_0x414ebf[_0x3e1f6c]={'$like':'%'+_0x103445[_0x28b6('0x40')][_0x28b6('0x4c')]+'%'};return _0x414ebf;})});}_0x2698d5=_[_0x28b6('0x4d')]({},_0x2698d5,_0x103445[_0x28b6('0x4f')]);return db['CannedAnswer'][_0x28b6('0x2d')]({'where':_0x2698d5[_0x28b6('0x49')]})[_0x28b6('0x1e')](function(_0x5bbbf7){_0xb45c97[_0x28b6('0x2d')]=_0x5bbbf7;if(_0x103445[_0x28b6('0x40')]['includeAll']){_0x2698d5[_0x28b6('0x50')]=[{'all':!![]}];}return db[_0x28b6('0x6e')]['findAll'](_0x2698d5);})[_0x28b6('0x1e')](function(_0x282dce){_0xb45c97['rows']=_0x282dce;return _0xb45c97;});}})[_0x28b6('0x1e')](respondWithFilteredResult(_0x2831fa,_0x2698d5))[_0x28b6('0x28')](handleError(_0x2831fa,null));};exports[_0x28b6('0x70')]=function(_0x560e3c,_0x53a194,_0x2abd48){return db[_0x28b6('0x51')][_0x28b6('0x5e')]({'where':{'id':_0x560e3c[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x53a194,null))['then'](function(_0x5a9bf8){if(_0x5a9bf8){return _0x5a9bf8['removeAnswers'](_0x560e3c['query'][_0x28b6('0x6c')]);}})['then'](respondWithStatusCode(_0x53a194,null))[_0x28b6('0x28')](handleError(_0x53a194,null));};exports[_0x28b6('0x71')]=function(_0x1739bd,_0xfcba73,_0x90aee6){var _0x417b71={'channel':_0x28b6('0x72')};var _0x5a7c05=[];var _0x55f11e=[];var _0x3ee76b={};return db['SmsAccount'][_0x28b6('0x5e')]({'where':{'id':_0x1739bd[_0x28b6('0x62')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x28b6('0x73')}]})[_0x28b6('0x1e')](handleEntityNotFound(_0xfcba73,null))[_0x28b6('0x1e')](function(_0x7c3504){_0x417b71['account']=_0x7c3504;_0x417b71[_0x28b6('0x74')]=_[_0x28b6('0x75')](_0x7c3504[_0x28b6('0x73')],[_0x28b6('0x76')],['asc']);if(_0x417b71[_0x28b6('0x77')][_0x28b6('0x73')]){delete _0x417b71['account'][_0x28b6('0x73')];}return db['CmContact'][_0x28b6('0x63')]();})[_0x28b6('0x1e')](function(_0x362fbc){if(!_0x362fbc){throw new db['Sequelize'][(_0x28b6('0x78'))](_0x28b6('0x79'));}_0x5a7c05=_[_0x28b6('0x7a')](_[_0x28b6('0x41')](_0x362fbc),[_0x28b6('0x7b'),_0x28b6('0x7c')]);_0x55f11e=_[_0x28b6('0x7a')](_['keys'](_0x362fbc),[_0x28b6('0x7b'),_0x28b6('0x7c'),'CompanyId',_0x28b6('0x7d')]);_0x417b71['body']={'mapKey':'mobile'};if(_0x417b71[_0x28b6('0x77')][_0x28b6('0x3e')]){switch(_0x417b71[_0x28b6('0x77')][_0x28b6('0x3e')]){case _0x28b6('0x7e'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')]['From'];_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x80')];_0x417b71['body']['messageId']=_0x1739bd[_0x28b6('0x58')]['MessageSid'];break;case _0x28b6('0x81'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]='+'+_0x1739bd['body']['sender'];_0x417b71['body'][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x82')];break;case _0x28b6('0x83'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x7f')];_0x417b71[_0x28b6('0x58')]['body']=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x25')];break;case _0x28b6('0x84'):_0x417b71['body'][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x7f')];_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x58')];_0x417b71['body']['messageId']=_0x1739bd[_0x28b6('0x58')]['message_id'];break;case _0x28b6('0x85'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x86')];_0x417b71[_0x28b6('0x58')]['body']=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x87')];_0x417b71['body'][_0x28b6('0x88')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x89')];break;case _0x28b6('0x8a'):_0x417b71[_0x28b6('0x58')]['from']='+'+_0x1739bd[_0x28b6('0x58')]['results'][0x0][_0x28b6('0x7f')];_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x8b')][0x0][_0x28b6('0x82')];_0x417b71[_0x28b6('0x58')]['messageId']=_0x1739bd['body'][_0x28b6('0x8b')][0x0]['messageId'];break;case _0x28b6('0x8c'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x8d')];_0x417b71['body'][_0x28b6('0x58')]=_0x1739bd['body'][_0x28b6('0x8e')]['message'];break;case _0x28b6('0x8f'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x90')];_0x417b71['body'][_0x28b6('0x58')]=_0x1739bd['body'][_0x28b6('0x82')];_0x417b71['body'][_0x28b6('0x88')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x91')];break;case _0x28b6('0x92'):_0x417b71[_0x28b6('0x58')][_0x28b6('0x88')]=_0x1739bd[_0x28b6('0x58')][0x0]['message']['id'];_0x417b71[_0x28b6('0x58')]['from']=_0x1739bd['body'][0x0][_0x28b6('0x25')]['from'];_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][0x0][_0x28b6('0x25')][_0x28b6('0x82')];break;case _0x28b6('0x93'):_0x417b71['body']['from']=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x7f')];_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]=_0x1739bd[_0x28b6('0x58')][_0x28b6('0x25')];_0x417b71[_0x28b6('0x58')]['messageId']=_0x1739bd[_0x28b6('0x58')]['refid'];break;}}if(_0x417b71[_0x28b6('0x58')]['id']){delete _0x417b71[_0x28b6('0x58')]['id'];}if(_['isNil'](_0x417b71['body'][_0x28b6('0x7f')])){throw new db[(_0x28b6('0x94'))][(_0x28b6('0x78'))](_0x28b6('0x95'));}if(_[_0x28b6('0x96')](_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')])||_0x417b71[_0x28b6('0x58')][_0x28b6('0x58')]===''){throw new db[(_0x28b6('0x94'))][(_0x28b6('0x78'))](_0x28b6('0x97'));}if(_['isNil'](_0x417b71[_0x28b6('0x58')][_0x28b6('0x98')])){throw new db['Sequelize'][(_0x28b6('0x78'))](_0x28b6('0x99')+_0x55f11e);}if(!_[_0x28b6('0x9a')](_0x55f11e,_0x417b71[_0x28b6('0x58')][_0x28b6('0x98')])){throw new db[(_0x28b6('0x94'))][(_0x28b6('0x78'))](_0x28b6('0x9b')+_0x55f11e);}_0x3ee76b[_0x417b71[_0x28b6('0x58')]['mapKey']]=_0x417b71[_0x28b6('0x58')]['from'];return db[_0x28b6('0x9c')][_0x28b6('0x5e')]({'where':{'id':_0x417b71[_0x28b6('0x77')][_0x28b6('0x7d')]},'include':[{'model':db[_0x28b6('0x9d')],'as':'Contacts','where':_0x3ee76b,'limit':0x1,'order':[['updatedAt',_0x28b6('0x9e')]]}]});})[_0x28b6('0x1e')](handleEntityNotFound(_0xfcba73,null))[_0x28b6('0x1e')](function(_0x3b154e){if(_0x3b154e){_0x417b71[_0x28b6('0x9f')]=_[_0x28b6('0xa0')](_0x3b154e,['Contacts']);if(_0x3b154e['Contacts']['length']){return _0x3b154e[_0x28b6('0xa1')][0x0];}var _0x361cde=_[_0x28b6('0x18')](_0x417b71[_0x28b6('0x58')],{'firstName':_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')],'ListId':_0x3b154e['id']});_0x361cde[_0x417b71[_0x28b6('0x58')][_0x28b6('0x98')]]=_0x417b71[_0x28b6('0x58')][_0x28b6('0x7f')];return db[_0x28b6('0x9d')][_0x28b6('0x57')](_0x361cde,{'fields':_0x5a7c05,'raw':!![]});}})[_0x28b6('0x1e')](handleEntityNotFound(_0xfcba73,null))['then'](function(_0x10dd65){if(_0x10dd65){_0x417b71[_0x28b6('0xa2')]=_0x10dd65;var _0x101c49={'ContactId':_0x10dd65['id'],'phone':_0x417b71['body']['from'],'SmsAccountId':_0x1739bd[_0x28b6('0x62')]['id']};var _0x1f6f76={'ContactId':_0x10dd65['id'],'SmsAccountId':_0x1739bd[_0x28b6('0x62')]['id'],'closed':![]};return db['SmsInteraction'][_0x28b6('0x5e')]({'where':_0x1f6f76})[_0x28b6('0x1e')](function(_0x4a6df1){if(_0x4a6df1){return[_0x4a6df1,![]];}return db[_0x28b6('0xa3')][_0x28b6('0x57')](_0x101c49)[_0x28b6('0x1e')](function(_0x3eca44){return[_0x3eca44,!![]];});});}})['spread'](function(_0x10015e,_0x11cc2d){_0x417b71[_0x28b6('0xa4')]=_0x10015e[_0x28b6('0x5c')]({'plain':!![]});_0x417b71[_0x28b6('0xa4')][_0x28b6('0xa5')]=![];if(_0x11cc2d){if(_0x417b71[_0x28b6('0x77')]['autoclose']){_0x417b71[_0x28b6('0x74')][_0x28b6('0xa6')]({'id':0x0,'priority':_0x417b71[_0x28b6('0x74')][_0x28b6('0x55')]+0x1,'app':_0x28b6('0xa7'),'appdata':_0x28b6('0xa8'),'interval':_0x28b6('0xa9')});}_0x417b71[_0x28b6('0xa4')][_0x28b6('0xa5')]=!![];}return db['SmsMessage'][_0x28b6('0x57')]({'phone':_0x417b71['body'][_0x28b6('0x7f')],'messageId':_0x417b71[_0x28b6('0x58')][_0x28b6('0x88')],'body':_0x417b71[_0x28b6('0x58')]['body'],'SmsAccountId':_0x1739bd[_0x28b6('0x62')]['id'],'SmsInteractionId':_0x10015e['id'],'direction':'in','ContactId':_0x10015e[_0x28b6('0xaa')],'AttachmentId':_0x417b71[_0x28b6('0x58')][_0x28b6('0xab')]});})['then'](function(_0x37293f){_0x417b71[_0x28b6('0x25')]=_0x37293f;if(!_0x417b71[_0x28b6('0xa4')][_0x28b6('0xac')])return;return db[_0x28b6('0xad')][_0x28b6('0x5e')]({'attributes':['id',_0x28b6('0x37')],'where':{'id':_0x417b71[_0x28b6('0xa4')][_0x28b6('0xac')]}});})[_0x28b6('0x1e')](function(_0x3e0b18){if(_0x3e0b18){_0x417b71[_0x28b6('0x74')][_0x28b6('0xae')]({'id':0x0,'priority':0x0,'app':_0x28b6('0xaf'),'appdata':_0x3e0b18['name']+','+(_0x417b71[_0x28b6('0x77')][_0x28b6('0xb0')]||0xa),'interval':_0x28b6('0xa9')});}if(!_0x417b71[_0x28b6('0xa4')][_0x28b6('0xb1')])return;return db['SmsQueue']['find']({'attributes':['id',_0x28b6('0x37')],'where':{'id':_0x417b71[_0x28b6('0xa4')][_0x28b6('0xb1')]}});})[_0x28b6('0x1e')](function(_0x3b3581){if(_0x3b3581){_0x417b71[_0x28b6('0x74')][_0x28b6('0xae')]({'id':0x0,'priority':0x1,'app':_0x28b6('0xb2'),'appdata':_0x3b3581['name']+','+(_0x417b71[_0x28b6('0x77')]['waitForTheAssignedQueue']||0x12c),'interval':_0x28b6('0xa9')});}return respondWithRpcPromise('Start',_0x28b6('0xb3'),_0x417b71);})[_0x28b6('0x1e')](function(_0x316297){if(_0x316297){var _0xffeb23=0xc8;var _0xbcd806='receiveMessage';logger[_0x28b6('0x26')](_0x28b6('0x1f'),_0xbcd806,_0xffeb23,_0x28b6('0xb4'));logger['debug'](_0x28b6('0xb5'),_0xbcd806,_0xffeb23,_0x28b6('0xb4'),JSON['stringify'](_0x316297));if(_0x417b71[_0x28b6('0x77')][_0x28b6('0x3e')]==='twilio'){return _0xfcba73[_0x28b6('0x29')](_0xffeb23)[_0x28b6('0x2e')](_0x28b6('0xb6'),_0x28b6('0xb7'))['send'](_0x28b6('0xb8'));}else{return _0xfcba73[_0x28b6('0x29')](_0xffeb23)[_0x28b6('0xb9')](_0x316297);}}})[_0x28b6('0x28')](handleError(_0xfcba73,null));};exports[_0x28b6('0xba')]=function(_0x50cefd,_0x552163){var _0x110944=_0x50cefd['params']['id'];var _0x494cea=_0x50cefd[_0x28b6('0x58')];var _0x45ebcc=0xc8;var _0xc71bfe=null;return db[_0x28b6('0xbb')][_0x28b6('0xbc')]({'isolationLevel':db[_0x28b6('0xbb')]['Transaction'][_0x28b6('0xbd')][_0x28b6('0xbe')]},function(_0x70f780){return db['SmsAccount'][_0x28b6('0x67')]({'where':{'id':_0x110944},'transaction':_0x70f780})[_0x28b6('0x1e')](function(_0x1f9bd9){if(_0x1f9bd9){return db['SmsApplication'][_0x28b6('0x33')]({'where':{'SmsAccountId':_0x110944},'transaction':_0x70f780})[_0x28b6('0x1e')](function(){var _0x477d7f=_[_0x28b6('0x3b')](_0x494cea,function(_0x900098){_0x900098[_0x28b6('0x69')]=_0x110944;return _0x900098;});return db[_0x28b6('0xbf')][_0x28b6('0xc0')](_0x477d7f,{'transaction':_0x70f780});});}else{_0x45ebcc=0x194;_0xc71bfe=[];}});})[_0x28b6('0x1e')](function(){if(_0x45ebcc!==0x194){return db[_0x28b6('0xbf')]['findAndCountAll']({'where':{'SmsAccountId':_0x110944},'order':'priority'})[_0x28b6('0x1e')](function(_0x3384a8){_0xc71bfe=_0x3384a8;});}})[_0x28b6('0x28')](function(_0x23097a){_0x45ebcc=0x1f4;logger[_0x28b6('0x22')](_0x23097a['stack']);if(_0x23097a[_0x28b6('0x37')]){delete _0x23097a[_0x28b6('0x37')];}_0xc71bfe=_0x23097a;})[_0x28b6('0xc1')](function(){if(_0xc71bfe===null){_0x552163['sendStatus'](_0x45ebcc);}else{if(_0x45ebcc===0x1f4){_0x552163[_0x28b6('0x29')](_0x45ebcc)['send'](_0xc71bfe);}else{_0x552163['status'](_0x45ebcc)[_0x28b6('0xb9')](_0xc71bfe);}}});};exports[_0x28b6('0xc2')]=function(_0x4168be,_0x4c4e16,_0x512d68){var _0x3c9d61={};var _0x3a4fb9={};var _0x228bd0;var _0x3ff8ed;return db[_0x28b6('0x51')][_0x28b6('0x67')]({'where':{'id':_0x4168be['params']['id']}})['then'](handleEntityNotFound(_0x4c4e16,null))[_0x28b6('0x1e')](function(_0x476897){if(_0x476897){_0x228bd0=_0x476897;_0x3a4fb9['model']=_['keys'](db['SmsApplication'][_0x28b6('0x3c')]);_0x3a4fb9[_0x28b6('0x40')]=_[_0x28b6('0x41')](_0x4168be[_0x28b6('0x40')]);_0x3a4fb9['filters']=_[_0x28b6('0x42')](_0x3a4fb9[_0x28b6('0x43')],_0x3a4fb9[_0x28b6('0x40')]);_0x3c9d61[_0x28b6('0x44')]=_[_0x28b6('0x42')](_0x3a4fb9[_0x28b6('0x43')],qs['fields'](_0x4168be['query'][_0x28b6('0x45')]));_0x3c9d61[_0x28b6('0x44')]=_0x3c9d61[_0x28b6('0x44')]['length']?_0x3c9d61['attributes']:_0x3a4fb9[_0x28b6('0x43')];_0x3c9d61['order']=qs[_0x28b6('0x48')](_0x4168be['query']['sort']);_0x3c9d61[_0x28b6('0x49')]=qs[_0x28b6('0x4a')](_['pick'](_0x4168be[_0x28b6('0x40')],_0x3a4fb9['filters']));if(_0x4168be[_0x28b6('0x40')][_0x28b6('0x4c')]){_0x3c9d61[_0x28b6('0x49')]=_['merge'](_0x3c9d61[_0x28b6('0x49')],{'$or':_['map'](_0x3c9d61[_0x28b6('0x44')],function(_0x5330e6){var _0x158b8c={};_0x158b8c[_0x5330e6]={'$like':'%'+_0x4168be['query'][_0x28b6('0x4c')]+'%'};return _0x158b8c;})});}_0x3c9d61=_[_0x28b6('0x4d')]({},_0x3c9d61,_0x4168be[_0x28b6('0x4f')]);return _0x228bd0['getApplications'](_0x3c9d61);}})[_0x28b6('0x1e')](function(_0x53b6b3){if(_0x53b6b3){_0x3ff8ed=_0x53b6b3[_0x28b6('0x55')];if(!_0x4168be[_0x28b6('0x40')]['hasOwnProperty']('nolimit')){_0x3c9d61[_0x28b6('0x2b')]=qs[_0x28b6('0x2b')](_0x4168be[_0x28b6('0x40')][_0x28b6('0x2b')]);_0x3c9d61[_0x28b6('0x2c')]=qs['offset'](_0x4168be[_0x28b6('0x40')][_0x28b6('0x2c')]);}return _0x228bd0[_0x28b6('0xc2')](_0x3c9d61);}})[_0x28b6('0x1e')](function(_0x4743a8){if(_0x4743a8){return _0x4743a8?{'count':_0x3ff8ed,'rows':_0x4743a8}:null;}})[_0x28b6('0x1e')](respondWithResult(_0x4c4e16,null))[_0x28b6('0x28')](handleError(_0x4c4e16,null));};exports[_0x28b6('0xc3')]=function(_0xf0276a,_0x91ed5d,_0x497bcf){var _0x596acb={'raw':![],'where':{}};var _0x228ac4={};var _0x127d75={'count':0x0,'rows':[]};return db['SmsAccount'][_0x28b6('0x67')]({'where':{'id':_0xf0276a[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x91ed5d,null))[_0x28b6('0x1e')](function(_0x59e1e5){if(_0x59e1e5){_0x228ac4['model']=_[_0x28b6('0x41')](db[_0x28b6('0xa3')]['rawAttributes']);_0x228ac4['query']=_['keys'](_0xf0276a[_0x28b6('0x40')]);_0x228ac4[_0x28b6('0x4a')]=_[_0x28b6('0x42')](_0x228ac4['model'],_0x228ac4['query']);_0x596acb[_0x28b6('0x44')]=_[_0x28b6('0x42')](_0x228ac4[_0x28b6('0x43')],qs[_0x28b6('0x45')](_0xf0276a[_0x28b6('0x40')][_0x28b6('0x45')]));_0x596acb[_0x28b6('0x44')]=_0x596acb[_0x28b6('0x44')]['length']?_0x596acb['attributes']:_0x228ac4[_0x28b6('0x43')];if(!_0xf0276a['query'][_0x28b6('0x46')](_0x28b6('0x47'))){_0x596acb[_0x28b6('0x2b')]=qs[_0x28b6('0x2b')](_0xf0276a[_0x28b6('0x40')][_0x28b6('0x2b')]);_0x596acb[_0x28b6('0x2c')]=qs['offset'](_0xf0276a['query'][_0x28b6('0x2c')]);}_0x596acb[_0x28b6('0x68')]=qs[_0x28b6('0x48')](_0xf0276a[_0x28b6('0x40')][_0x28b6('0x48')]);_0x596acb[_0x28b6('0x49')]=qs[_0x28b6('0x4a')](_['pick'](_0xf0276a[_0x28b6('0x40')],_0x228ac4[_0x28b6('0x4a')]));_0x596acb[_0x28b6('0x49')][_0x28b6('0x69')]=_0x59e1e5['id'];if(_0xf0276a[_0x28b6('0x40')]['filter']){_0x596acb[_0x28b6('0x49')]=_['merge'](_0x596acb[_0x28b6('0x49')],{'$or':_['map'](_0x596acb[_0x28b6('0x44')],function(_0x2e541d){var _0xe8accc={};_0xe8accc[_0x2e541d]={'$like':'%'+_0xf0276a['query'][_0x28b6('0x4c')]+'%'};return _0xe8accc;})});}_0x596acb=_[_0x28b6('0x4d')]({},_0x596acb,_0xf0276a[_0x28b6('0x4f')]);return db[_0x28b6('0xa3')][_0x28b6('0x2d')]({'where':_0x596acb[_0x28b6('0x49')]})[_0x28b6('0x1e')](function(_0x1a26d3){_0x127d75[_0x28b6('0x2d')]=_0x1a26d3;if(_0xf0276a[_0x28b6('0x40')][_0x28b6('0x56')]){_0x596acb['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x28b6('0xad')],'as':'Owner','attributes':['name',_0x28b6('0xc4'),_0x28b6('0xc5')],'required':![]},{'model':db[_0x28b6('0xc6')],'as':_0x28b6('0xc7'),'attributes':['id','name',_0x28b6('0xc8')],'where':_0xf0276a[_0x28b6('0x40')][_0x28b6('0xc9')]?{'id':_0xf0276a[_0x28b6('0x40')][_0x28b6('0xc9')]}:undefined,'required':_0xf0276a[_0x28b6('0x40')][_0x28b6('0xc9')]?!![]:![]}];}return db[_0x28b6('0xa3')][_0x28b6('0x52')](_0x596acb);})[_0x28b6('0x1e')](function(_0xc001c0){_0x127d75[_0x28b6('0x6a')]=_0xc001c0;return _0x127d75;});}})['then'](respondWithFilteredResult(_0x91ed5d,_0x596acb))[_0x28b6('0x28')](handleError(_0x91ed5d,null));};exports['send']=function(_0x3bd7c9,_0x7d4c7f,_0x5aeed3){var _0x94f649,_0x4911a3,_0x112eaa;if(_[_0x28b6('0x96')](_0x3bd7c9[_0x28b6('0x58')][_0x28b6('0x58')])||_0x3bd7c9[_0x28b6('0x58')]['body']===''){throw new db[(_0x28b6('0x94'))][(_0x28b6('0x78'))](_0x28b6('0x97'));}if(_[_0x28b6('0x96')](_0x3bd7c9['body']['to'])){throw new db[(_0x28b6('0x94'))][(_0x28b6('0x78'))](_0x28b6('0xca'));}_0x94f649=_0x3bd7c9[_0x28b6('0x58')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x3bd7c9[_0x28b6('0x62')]['id']},'include':[{'model':db[_0x28b6('0x9c')],'as':_0x28b6('0xcb'),'include':[{'model':db[_0x28b6('0x9d')],'as':_0x28b6('0xa1'),'where':{'mobile':_0x94f649},'limit':0x1,'order':[[_0x28b6('0x7c'),_0x28b6('0x9e')]]}]}]})[_0x28b6('0x1e')](handleEntityNotFound(_0x7d4c7f,null))[_0x28b6('0x1e')](function(_0x2fb955){if(_0x2fb955&&_0x2fb955[_0x28b6('0xcb')]){_0x4911a3=_0x2fb955[_0x28b6('0x5c')]({'plain':!![]});if(_0x4911a3[_0x28b6('0xcb')]&&_0x4911a3['List'][_0x28b6('0xa1')][_0x28b6('0x55')]){return _0x4911a3['List'][_0x28b6('0xa1')][0x0];}return db[_0x28b6('0x9d')][_0x28b6('0x57')](_[_0x28b6('0x18')](_0x3bd7c9[_0x28b6('0x58')],{'firstName':_0x94f649,'mobile':_0x94f649,'phone':_0x94f649,'ListId':_0x4911a3[_0x28b6('0x7d')]}));}})[_0x28b6('0x1e')](handleEntityNotFound(_0x7d4c7f,null))[_0x28b6('0x1e')](function(_0x20c298){if(_0x20c298){_0x112eaa=_0x20c298;return db[_0x28b6('0xa3')][_0x28b6('0x5e')]({'where':{'ContactId':_0x112eaa['id'],'closed':![],'SmsAccountId':_0x4911a3['id']}})['then'](function(_0x310648){if(_0x310648){return[_0x310648,![]];}return db[_0x28b6('0xa3')][_0x28b6('0x57')]({'UserId':_0x3bd7c9[_0x28b6('0x59')]['id'],'ContactId':_0x112eaa['id'],'SmsAccountId':_0x4911a3['id'],'phone':_0x94f649,'firstMsgDirection':'out','Messages':[_['merge'](_0x3bd7c9[_0x28b6('0x58')],{'read':![],'body':_0x3bd7c9[_0x28b6('0x58')]['body'],'phone':_0x94f649,'SmsAccountId':_0x4911a3['id'],'UserId':_0x3bd7c9[_0x28b6('0x59')]['id'],'ContactId':_0x112eaa['id']})]},{'include':[{'model':db[_0x28b6('0xcc')],'as':'Messages'}]})[_0x28b6('0x1e')](function(_0x5539bc){return[_0x5539bc,!![]];});});}})[_0x28b6('0xcd')](function(_0x1b82df,_0x7dc043){if(_0x7dc043){return _0x1b82df;}return db[_0x28b6('0xcc')][_0x28b6('0x57')](_[_0x28b6('0x4d')](_0x3bd7c9[_0x28b6('0x58')],{'read':![],'body':_0x3bd7c9[_0x28b6('0x58')]['body'],'phone':_0x94f649,'SmsAccountId':_0x4911a3['id'],'SmsInteractionId':_0x1b82df['id'],'UserId':_0x3bd7c9['user']['id'],'ContactId':_0x112eaa['id']}))[_0x28b6('0x1e')](function(_0x5e892f){_0x1b82df['dataValues'][_0x28b6('0xce')]=[];_0x1b82df['dataValues'][_0x28b6('0xce')]['push'](_0x5e892f[_0x28b6('0xcf')]);return _0x1b82df;});})[_0x28b6('0x1e')](respondWithResult(_0x7d4c7f,null))[_0x28b6('0x28')](handleError(_0x7d4c7f,null));};exports[_0x28b6('0x29')]=function(_0x13c521,_0xb5985a,_0x281d17){if(_0x13c521[_0x28b6('0x58')]['id']){delete _0x13c521[_0x28b6('0x58')]['id'];}var _0x5cffd7,_0x39cbd1,_0x227858;return db['SmsAccount'][_0x28b6('0x5e')]({'where':{'id':_0x13c521[_0x28b6('0x62')]['id']}})['then'](handleEntityNotFound(_0xb5985a,null))['then'](function(_0x322935){if(_0x322935){_0x227858=_0x322935;logger[_0x28b6('0xd0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x28b6('0x29'),'received\x20delivery\x20report\x20from',_0x322935['type'],util[_0x28b6('0xd1')](_0x13c521['body'],{'showHidden':![],'depth':null}));switch(_0x322935[_0x28b6('0x3e')]){case _0x28b6('0x81'):if(_0x13c521['body'][_0x28b6('0xd2')]&&_0x13c521[_0x28b6('0x58')]['status']){_0x39cbd1=_0x13c521[_0x28b6('0x58')][_0x28b6('0x29')];return db['SmsMessage'][_0x28b6('0x5e')]({'where':{'messageId':_0x13c521[_0x28b6('0x58')][_0x28b6('0xd2')]}});}break;case _0x28b6('0x83'):if(_0x13c521[_0x28b6('0x58')][_0x28b6('0xd3')]&&_0x13c521[_0x28b6('0x58')][_0x28b6('0xd4')]){_0x39cbd1=_0x13c521['body']['statusInt'];return db[_0x28b6('0xcc')][_0x28b6('0x5e')]({'where':{'messageId':_0x13c521[_0x28b6('0x58')]['requestid']}});}break;case _0x28b6('0x84'):if(_0x13c521[_0x28b6('0x58')][_0x28b6('0xd5')]&&_0x13c521['body'][_0x28b6('0xd6')]){_0x39cbd1=_0x13c521['body'][_0x28b6('0xd6')];return db['SmsMessage']['find']({'where':{'messageId':_0x13c521['body']['message_id']}});}break;case _0x28b6('0x8a'):var _0x1e4a75=_0x13c521[_0x28b6('0x58')]['results'][0x0];if(_0x1e4a75['messageId']&&_0x1e4a75[_0x28b6('0x29')]['groupName']===_0x28b6('0xd7')){_0x39cbd1=_0x1e4a75['status'][_0x28b6('0xd8')];return db[_0x28b6('0xcc')][_0x28b6('0x5e')]({'where':{'messageId':_0x1e4a75['messageId']}});}break;case'clickatell':if(_0x13c521[_0x28b6('0x58')][_0x28b6('0x88')]&&_0x13c521['body'][_0x28b6('0x29')]){_0x39cbd1=_0x13c521[_0x28b6('0x58')][_0x28b6('0x29')];return db['SmsMessage'][_0x28b6('0x5e')]({'where':{'messageId':_0x13c521[_0x28b6('0x58')]['messageId']}});}break;case'bandwidth':if(_0x13c521['body'][0x0][_0x28b6('0x25')]['id']){_0x39cbd1=_0x13c521[_0x28b6('0x58')][0x0][_0x28b6('0x3e')];return db[_0x28b6('0xcc')][_0x28b6('0x5e')]({'where':{'messageId':_0x13c521[_0x28b6('0x58')][0x0][_0x28b6('0x25')]['id']}});}break;case _0x28b6('0x93'):if(_0x13c521[_0x28b6('0x58')]['redif']&&_0x13c521[_0x28b6('0x58')]['status']){_0x39cbd1=_0x13c521[_0x28b6('0x58')][_0x28b6('0x29')];return db[_0x28b6('0xcc')][_0x28b6('0x5e')]({'where':{'messageId':_0x13c521[_0x28b6('0x58')][_0x28b6('0xd9')]}});}break;}}})[_0x28b6('0x1e')](handleEntityNotFound(_0xb5985a,null))['then'](function(_0x5bc867){if(_0x5bc867){_0x5cffd7=_0x5bc867;switch(_0x227858[_0x28b6('0x3e')]){case _0x28b6('0x81'):if(_0x39cbd1==='DELIVERED'){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger[_0x28b6('0x22')](_0x28b6('0x1f'),_0x28b6('0x29'),_0x28b6('0x81'),util['inspect'](_0x13c521[_0x28b6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x83'):if(_0x39cbd1==='1'){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger['error'](_0x28b6('0x1f'),_0x28b6('0x29'),_0x28b6('0x81'),util[_0x28b6('0xd1')](_0x13c521['body'],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x84'):if(!_0x13c521[_0x28b6('0x58')][_0x28b6('0xda')]&&_0x39cbd1>=0xc8&&_0x39cbd1<=0xce){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger['error'](_0x28b6('0x1f'),'status','clicksend',util[_0x28b6('0xd1')](_0x13c521[_0x28b6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x8a'):var _0x57b987=_0x13c521[_0x28b6('0x58')][_0x28b6('0x8b')][0x0];if(_0x57b987['status']['groupName']===_0x28b6('0xd7')){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger['error'](_0x28b6('0x1f'),'status',_0x28b6('0x8a'),util[_0x28b6('0xd1')](_0x13c521[_0x28b6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x8f'):if(_0x39cbd1=='DELIVERED_TO_GATEWAY'||_0x39cbd1==_0x28b6('0xdb')){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger[_0x28b6('0x22')](_0x28b6('0x1f'),'status',_0x28b6('0x8f'),util[_0x28b6('0xd1')](_0x13c521[_0x28b6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x92'):if(_0x39cbd1=='message-delivered'){return _0x5cffd7['update']({'read':!![]});}else{logger['error'](_0x28b6('0x1f'),'status',_0x28b6('0x92'),util[_0x28b6('0xd1')](_0x13c521['body'],{'showHidden':![],'depth':null}));}break;case _0x28b6('0x93'):if(_0x39cbd1==='DELIVRD'||_0x39cbd1===_0x28b6('0xdc')){return _0x5cffd7[_0x28b6('0x32')]({'read':!![]});}else{logger[_0x28b6('0x22')](_0x28b6('0x1f'),'status',_0x28b6('0x93'),util['inspect'](_0x13c521['body'],{'showHidden':![],'depth':null}));}break;}return _0x5cffd7;}})[_0x28b6('0x1e')](respondWithResult(_0xb5985a,null))[_0x28b6('0x28')](handleError(_0xb5985a,null));};exports[_0x28b6('0xdd')]=function(_0x54ed8c,_0x45ff22,_0x3e49c5){var _0x28f903,_0x17e7ad,_0x122239;return db['SmsAccount']['find']({'where':{'id':_0x54ed8c[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x45ff22,null))['then'](function(_0x4d0d3a){if(_0x4d0d3a){_0x122239=_0x4d0d3a;logger['debug'](_0x28b6('0x1f'),_0x28b6('0x29'),_0x28b6('0xde'),_0x4d0d3a['type'],util[_0x28b6('0xd1')](_0x54ed8c[_0x28b6('0x40')],{'showHidden':![],'depth':null}));switch(_0x4d0d3a[_0x28b6('0x3e')]){case'csc':if(_0x54ed8c[_0x28b6('0x40')]['message-id']&&_0x54ed8c[_0x28b6('0x40')]['state']){_0x17e7ad=_0x54ed8c[_0x28b6('0x40')]['state'];return db[_0x28b6('0xcc')]['find']({'where':{'messageId':_0x54ed8c[_0x28b6('0x40')]['message-id']}});}break;}}})[_0x28b6('0x1e')](handleEntityNotFound(_0x45ff22,null))[_0x28b6('0x1e')](function(_0x3e7ca1){if(_0x3e7ca1){_0x28f903=_0x3e7ca1;switch(_0x122239[_0x28b6('0x3e')]){case _0x28b6('0x8c'):if(_0x17e7ad==='2'||_0x17e7ad==='6'){return _0x28f903[_0x28b6('0x32')]({'read':!![]});}else{logger[_0x28b6('0x22')](_0x28b6('0x1f'),'status',_0x28b6('0x8c'),util[_0x28b6('0xd1')](_0x54ed8c[_0x28b6('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x28f903;}})['then'](respondWithResult(_0x45ff22,null))[_0x28b6('0x28')](handleError(_0x45ff22,null));};exports[_0x28b6('0xdf')]=function(_0x3bcefa,_0x22ff23,_0x23ce5b){return db['SmsAccount'][_0x28b6('0x5e')]({'where':{'id':_0x3bcefa[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x22ff23,null))['then'](function(_0x20f17a){if(_0x20f17a){return _0x20f17a[_0x28b6('0xdf')](_0x3bcefa[_0x28b6('0x58')]['ids'],_['omit'](_0x3bcefa[_0x28b6('0x58')],['ids','id'])||{})['spread'](function(_0x80eb5f){for(var _0x17df7e=0x0;_0x17df7e<_0x3bcefa[_0x28b6('0x58')]['ids']['length'];_0x17df7e+=0x1){socket[_0x28b6('0xe0')](_0x28b6('0xe1'),{'UserId':Number(_0x3bcefa[_0x28b6('0x58')][_0x28b6('0x6c')][_0x17df7e]),'SmsAccountId':Number(_0x3bcefa['params']['id'])});}return _0x80eb5f;});}})['then'](respondWithResult(_0x22ff23,null))[_0x28b6('0x28')](handleError(_0x22ff23,null));};exports[_0x28b6('0xe2')]=function(_0x417ce2,_0x30194f,_0x2599d5){return db[_0x28b6('0x51')]['find']({'where':{'id':_0x417ce2[_0x28b6('0x62')]['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x30194f,null))[_0x28b6('0x1e')](function(_0x30b7ab){if(_0x30b7ab){return _0x30b7ab[_0x28b6('0xe2')](_0x417ce2[_0x28b6('0x40')][_0x28b6('0x6c')])[_0x28b6('0x1e')](function(){if(_[_0x28b6('0xe3')](_0x417ce2['query'][_0x28b6('0x6c')])){for(var _0x510086=0x0;_0x510086<_0x417ce2['query']['ids'][_0x28b6('0x55')];_0x510086+=0x1){socket[_0x28b6('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x417ce2[_0x28b6('0x40')][_0x28b6('0x6c')][_0x510086]),'SmsAccountId':Number(_0x417ce2[_0x28b6('0x62')]['id'])});}}else{socket[_0x28b6('0xe0')](_0x28b6('0xe4'),{'UserId':Number(_0x417ce2[_0x28b6('0x40')][_0x28b6('0x6c')]),'SmsAccountId':Number(_0x417ce2[_0x28b6('0x62')]['id'])});}});}})[_0x28b6('0x1e')](respondWithStatusCode(_0x30194f,null))[_0x28b6('0x28')](handleError(_0x30194f,null));};exports[_0x28b6('0xe5')]=function(_0x2242c6,_0x1071fa,_0x370fd9){var _0x2c1eaa={};var _0x1698b0={};var _0x391c1e;var _0x23fa51;return db['SmsAccount'][_0x28b6('0x67')]({'where':{'id':_0x2242c6['params']['id']}})[_0x28b6('0x1e')](handleEntityNotFound(_0x1071fa,null))[_0x28b6('0x1e')](function(_0x921bb6){if(_0x921bb6){_0x391c1e=_0x921bb6;_0x1698b0[_0x28b6('0x43')]=_[_0x28b6('0x41')](db[_0x28b6('0xad')][_0x28b6('0x3c')]);_0x1698b0[_0x28b6('0x40')]=_[_0x28b6('0x41')](_0x2242c6[_0x28b6('0x40')]);_0x1698b0[_0x28b6('0x4a')]=_[_0x28b6('0x42')](_0x1698b0[_0x28b6('0x43')],_0x1698b0[_0x28b6('0x40')]);_0x2c1eaa['attributes']=_[_0x28b6('0x42')](_0x1698b0[_0x28b6('0x43')],qs['fields'](_0x2242c6[_0x28b6('0x40')][_0x28b6('0x45')]));_0x2c1eaa['attributes']=_0x2c1eaa[_0x28b6('0x44')][_0x28b6('0x55')]?_0x2c1eaa[_0x28b6('0x44')]:_0x1698b0[_0x28b6('0x43')];_0x2c1eaa['order']=qs[_0x28b6('0x48')](_0x2242c6[_0x28b6('0x40')][_0x28b6('0x48')]);_0x2c1eaa['where']=qs[_0x28b6('0x4a')](_[_0x28b6('0x4b')](_0x2242c6['query'],_0x1698b0[_0x28b6('0x4a')]));if(_0x2242c6[_0x28b6('0x40')][_0x28b6('0x4c')]){_0x2c1eaa[_0x28b6('0x49')]=_[_0x28b6('0x4d')](_0x2c1eaa[_0x28b6('0x49')],{'$or':_[_0x28b6('0x3b')](_0x2c1eaa['attributes'],function(_0x4ab29d){var _0x2eaf7e={};_0x2eaf7e[_0x4ab29d]={'$like':'%'+_0x2242c6['query'][_0x28b6('0x4c')]+'%'};return _0x2eaf7e;})});}_0x2c1eaa=_[_0x28b6('0x4d')]({},_0x2c1eaa,_0x2242c6[_0x28b6('0x4f')]);return _0x391c1e['getAgents'](_0x2c1eaa);}})[_0x28b6('0x1e')](function(_0x1d3138){if(_0x1d3138){_0x23fa51=_0x1d3138['length'];if(!_0x2242c6[_0x28b6('0x40')]['hasOwnProperty']('nolimit')){_0x2c1eaa[_0x28b6('0x2b')]=qs['limit'](_0x2242c6['query'][_0x28b6('0x2b')]);_0x2c1eaa[_0x28b6('0x2c')]=qs[_0x28b6('0x2c')](_0x2242c6[_0x28b6('0x40')][_0x28b6('0x2c')]);}return _0x391c1e[_0x28b6('0xe5')](_0x2c1eaa);}})[_0x28b6('0x1e')](function(_0x522e98){if(_0x522e98){return _0x522e98?{'count':_0x23fa51,'rows':_0x522e98}:null;}})[_0x28b6('0x1e')](respondWithResult(_0x1071fa,null))[_0x28b6('0x28')](handleError(_0x1071fa,null));}; \ No newline at end of file +var _0xbd59=['Tags','color','tag','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','bandwidth','redif','DELIVERED','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','util','path','fs-extra','lodash','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','destroy','get','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','options','SmsAccount','includeAll','include','rows','show','params','Pause','mandatoryDispositionPause','model','keys','find','catch','create','body','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','findOne','Disposition','order','SmsAccountId','merge','findAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','clicksend','plivo','Text','MessageUUID','results','text','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd59,0x1ea));var _0x9bd5=function(_0x2eae28,_0x4f6c29){_0x2eae28=_0x2eae28-0x0;var _0x5c0750=_0xbd59[_0x2eae28];return _0x5c0750;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bd5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bd5('0x1'));var rp=require(_0x9bd5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bd5('0x3'));var path=require(_0x9bd5('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bd5('0x5'));var _=require(_0x9bd5('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9bd5('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x9bd5('0x8'));var querystring=require(_0x9bd5('0x9'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9bd5('0xa'));var qs=require(_0x9bd5('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bd5('0xc'));var logger=require(_0x9bd5('0xd'))(_0x9bd5('0xe'));var utils=require(_0x9bd5('0xf'));var config=require(_0x9bd5('0x10'));var licenseUtil=require(_0x9bd5('0x11'));var db=require(_0x9bd5('0x12'))['db'];config[_0x9bd5('0x13')]=_[_0x9bd5('0x14')](config[_0x9bd5('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bd5('0x15'))(new Redis(config[_0x9bd5('0x13')]));require(_0x9bd5('0x16'))[_0x9bd5('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9bd5('0x18')][_0x9bd5('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x55dcd1,_0x338ea3,_0x287fc6,_0x5ef8cc){return new BPromise(function(_0x4b8194,_0x23a17a){var _0x2eaa2a=_0x5ef8cc||client;return _0x2eaa2a[_0x9bd5('0x1a')](_0x55dcd1,_0x287fc6)[_0x9bd5('0x1b')](function(_0x9959d2){logger['info'](_0x9bd5('0x1c'),_0x338ea3,'request\x20sent');logger[_0x9bd5('0x1d')](_0x9bd5('0x1e'),_0x338ea3,_0x9bd5('0x1f'),JSON['stringify'](_0x9959d2));if(_0x9959d2['error']){if(_0x9959d2[_0x9bd5('0x20')][_0x9bd5('0x21')]===0x1f4){logger[_0x9bd5('0x20')](_0x9bd5('0x1c'),_0x338ea3,_0x9959d2['error'][_0x9bd5('0x22')]);return _0x23a17a(_0x9959d2[_0x9bd5('0x20')]['message']);}logger[_0x9bd5('0x20')](_0x9bd5('0x1c'),_0x338ea3,_0x9959d2[_0x9bd5('0x20')][_0x9bd5('0x22')]);return _0x4b8194(_0x9959d2['error'][_0x9bd5('0x22')]);}else{logger[_0x9bd5('0x23')](_0x9bd5('0x1c'),_0x338ea3,_0x9bd5('0x1f'));_0x4b8194(_0x9959d2['result'][_0x9bd5('0x22')]);}})['catch'](function(_0x5e04d6){logger[_0x9bd5('0x20')](_0x9bd5('0x1c'),_0x338ea3,_0x5e04d6);_0x23a17a(_0x5e04d6);});});}function respondWithStatusCode(_0x5cf25a,_0x5b3dd4){_0x5b3dd4=_0x5b3dd4||0xcc;return function(_0x53ee02){if(_0x53ee02){return _0x5cf25a[_0x9bd5('0x24')](_0x5b3dd4);}return _0x5cf25a[_0x9bd5('0x25')](_0x5b3dd4)[_0x9bd5('0x26')]();};}function respondWithResult(_0x522400,_0x35d7ce){_0x35d7ce=_0x35d7ce||0xc8;return function(_0x7dd3c6){if(_0x7dd3c6){return _0x522400[_0x9bd5('0x25')](_0x35d7ce)[_0x9bd5('0x27')](_0x7dd3c6);}};}function respondWithFilteredResult(_0x429f6f,_0x1cc83e){return function(_0x49c210){if(_0x49c210){var _0x5e6f62=typeof _0x1cc83e[_0x9bd5('0x28')]===_0x9bd5('0x29')&&typeof _0x1cc83e['limit']===_0x9bd5('0x29');var _0x26baf8=_0x49c210[_0x9bd5('0x2a')];var _0x3f80d5=_0x5e6f62?0x0:_0x1cc83e['offset'];var _0x3d1780=_0x5e6f62?_0x49c210[_0x9bd5('0x2a')]:_0x1cc83e[_0x9bd5('0x28')]+_0x1cc83e['limit'];var _0x51e716;if(_0x3d1780>=_0x26baf8){_0x3d1780=_0x26baf8;_0x51e716=0xc8;}else{_0x51e716=0xce;}_0x429f6f[_0x9bd5('0x25')](_0x51e716);return _0x429f6f['set'](_0x9bd5('0x2b'),_0x3f80d5+'-'+_0x3d1780+'/'+_0x26baf8)[_0x9bd5('0x27')](_0x49c210);}return null;};}function patchUpdates(_0x52c750){return function(_0x297463){try{jsonpatch[_0x9bd5('0x2c')](_0x297463,_0x52c750,!![]);}catch(_0x4ed44b){return BPromise['reject'](_0x4ed44b);}return _0x297463['save']();};}function saveUpdates(_0x3af243,_0x24f5f4){return function(_0x2108fc){if(_0x2108fc){return _0x2108fc[_0x9bd5('0x2d')](_0x3af243)[_0x9bd5('0x1b')](function(_0x2a1f46){return _0x2a1f46;});}return null;};}function removeEntity(_0x28006b,_0x92768d){return function(_0x3dd91e){if(_0x3dd91e){return _0x3dd91e[_0x9bd5('0x2e')]()[_0x9bd5('0x1b')](function(){var _0x2cc1da=_0x3dd91e[_0x9bd5('0x2f')]({'plain':!![]});var _0x315b9b='SmsAccounts';return db['UserProfileResource'][_0x9bd5('0x2e')]({'where':{'type':_0x315b9b,'resourceId':_0x2cc1da['id']}})[_0x9bd5('0x1b')](function(){return _0x3dd91e;});})[_0x9bd5('0x1b')](function(){_0x28006b['status'](0xcc)[_0x9bd5('0x26')]();});}};}function handleEntityNotFound(_0x17739c,_0x8286ba){return function(_0x3ba3d0){if(!_0x3ba3d0){_0x17739c[_0x9bd5('0x24')](0x194);}return _0x3ba3d0;};}function handleError(_0x321958,_0x31e1ac){_0x31e1ac=_0x31e1ac||0x1f4;return function(_0xabfa7e){logger[_0x9bd5('0x20')](_0xabfa7e[_0x9bd5('0x30')]);if(_0xabfa7e[_0x9bd5('0x31')]){delete _0xabfa7e['name'];}_0x321958[_0x9bd5('0x25')](_0x31e1ac)['send'](_0xabfa7e);};}exports[_0x9bd5('0x32')]=function(_0x4b3f7f,_0x556029){var _0x15614d={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x28d22d={},_0x21f312={'count':0x0,'rows':[]};var _0x3bf7e4=_[_0x9bd5('0x33')](db['SmsAccount'][_0x9bd5('0x34')],function(_0x1a3e0f){return{'name':_0x1a3e0f[_0x9bd5('0x35')],'type':_0x1a3e0f[_0x9bd5('0x36')][_0x9bd5('0x37')]};});_0x28d22d['model']=_['map'](_0x3bf7e4,_0x9bd5('0x31'));_0x28d22d[_0x9bd5('0x38')]=_['keys'](_0x4b3f7f['query']);_0x28d22d[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x28d22d['model'],_0x28d22d[_0x9bd5('0x38')]);_0x15614d[_0x9bd5('0x3b')]=_[_0x9bd5('0x3a')](_0x28d22d['model'],qs[_0x9bd5('0x3c')](_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x3c')]));_0x15614d[_0x9bd5('0x3b')]=_0x15614d[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x15614d[_0x9bd5('0x3b')]:_0x28d22d['model'];if(!_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x3e')](_0x9bd5('0x3f'))){_0x15614d['limit']=qs['limit'](_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x40')]);_0x15614d['offset']=qs[_0x9bd5('0x28')](_0x4b3f7f['query']['offset']);}_0x15614d['order']=qs[_0x9bd5('0x41')](_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x41')]);_0x15614d['where']=qs[_0x9bd5('0x39')](_[_0x9bd5('0x42')](_0x4b3f7f['query'],_0x28d22d['filters']),_0x3bf7e4);if(_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x43')]){_0x15614d[_0x9bd5('0x44')]=_['merge'](_0x15614d['where'],{'$or':_[_0x9bd5('0x33')](_0x3bf7e4,function(_0x14066b){if(_0x14066b[_0x9bd5('0x36')]!=='VIRTUAL'){var _0x4d4289={};_0x4d4289[_0x14066b[_0x9bd5('0x31')]]={'$like':'%'+_0x4b3f7f[_0x9bd5('0x38')][_0x9bd5('0x43')]+'%'};return _0x4d4289;}})});}_0x15614d=_['merge']({},_0x15614d,_0x4b3f7f[_0x9bd5('0x45')]);var _0x4d7771={'where':_0x15614d['where']};return db[_0x9bd5('0x46')][_0x9bd5('0x2a')](_0x4d7771)[_0x9bd5('0x1b')](function(_0x298a32){_0x21f312[_0x9bd5('0x2a')]=_0x298a32;if(_0x4b3f7f['query'][_0x9bd5('0x47')]){_0x15614d[_0x9bd5('0x48')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x15614d);})['then'](function(_0x590a49){_0x21f312[_0x9bd5('0x49')]=_0x590a49;return _0x21f312;})[_0x9bd5('0x1b')](respondWithFilteredResult(_0x556029,_0x15614d))['catch'](handleError(_0x556029,null));};exports[_0x9bd5('0x4a')]=function(_0x526961,_0x42cd54){var _0x48ce78={'raw':![],'where':{'id':_0x526961[_0x9bd5('0x4b')]['id']},'include':[{'model':db[_0x9bd5('0x4c')],'as':_0x9bd5('0x4d')}]},_0x1dab60={};_0x1dab60[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db[_0x9bd5('0x46')][_0x9bd5('0x34')]);_0x1dab60[_0x9bd5('0x38')]=_['keys'](_0x526961[_0x9bd5('0x38')]);_0x1dab60[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x1dab60[_0x9bd5('0x4e')],_0x1dab60['query']);_0x48ce78['attributes']=_[_0x9bd5('0x3a')](_0x1dab60[_0x9bd5('0x4e')],qs['fields'](_0x526961[_0x9bd5('0x38')]['fields']));_0x48ce78['attributes']=_0x48ce78[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x48ce78[_0x9bd5('0x3b')]:_0x1dab60['model'];if(_0x526961['query'][_0x9bd5('0x47')]){_0x48ce78[_0x9bd5('0x48')]=[{'all':!![]}];}_0x48ce78=_['merge']({},_0x48ce78,_0x526961['options']);return db[_0x9bd5('0x46')][_0x9bd5('0x50')](_0x48ce78)[_0x9bd5('0x1b')](handleEntityNotFound(_0x42cd54,null))['then'](respondWithResult(_0x42cd54,null))[_0x9bd5('0x51')](handleError(_0x42cd54,null));};exports[_0x9bd5('0x52')]=function(_0x332d9e,_0x5208c4){return db[_0x9bd5('0x46')][_0x9bd5('0x52')](_0x332d9e[_0x9bd5('0x53')],{})[_0x9bd5('0x1b')](function(_0x3952a5){var _0x5d8e14=_0x332d9e[_0x9bd5('0x54')][_0x9bd5('0x2f')]({'plain':!![]});if(!_0x5d8e14)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d8e14['role']==='user'){var _0x2a4617=_0x3952a5[_0x9bd5('0x2f')]({'plain':!![]});var _0x14dae5=_0x9bd5('0x55');return db[_0x9bd5('0x56')]['find']({'where':{'name':_0x14dae5,'userProfileId':_0x5d8e14[_0x9bd5('0x57')]},'raw':!![]})['then'](function(_0x268300){if(_0x268300&&_0x268300[_0x9bd5('0x58')]===0x0){return db[_0x9bd5('0x59')][_0x9bd5('0x52')]({'name':_0x2a4617[_0x9bd5('0x31')],'resourceId':_0x2a4617['id'],'type':_0x268300[_0x9bd5('0x31')],'sectionId':_0x268300['id']},{})[_0x9bd5('0x1b')](function(){return _0x3952a5;});}else{return _0x3952a5;}})[_0x9bd5('0x51')](function(_0x1a1ee6){logger['error'](_0x9bd5('0x5a'),_0x1a1ee6);throw _0x1a1ee6;});}return _0x3952a5;})[_0x9bd5('0x1b')](respondWithResult(_0x5208c4,0xc9))[_0x9bd5('0x51')](handleError(_0x5208c4,null));};exports['update']=function(_0x299c1b,_0x4111df){if(_0x299c1b[_0x9bd5('0x53')]['id']){delete _0x299c1b[_0x9bd5('0x53')]['id'];}return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x299c1b[_0x9bd5('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0x9bd5('0x4d')}]})['then'](handleEntityNotFound(_0x4111df,null))[_0x9bd5('0x1b')](saveUpdates(_0x299c1b[_0x9bd5('0x53')],null))[_0x9bd5('0x1b')](respondWithResult(_0x4111df,null))['catch'](handleError(_0x4111df,null));};exports[_0x9bd5('0x2e')]=function(_0x3c8957,_0x249bb9){return db[_0x9bd5('0x46')]['find']({'where':{'id':_0x3c8957[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x249bb9,null))[_0x9bd5('0x1b')](removeEntity(_0x249bb9,null))['catch'](handleError(_0x249bb9,null));};exports[_0x9bd5('0x5b')]=function(_0x115dfb,_0x16b1b4){return db[_0x9bd5('0x46')]['describe']()[_0x9bd5('0x1b')](respondWithResult(_0x16b1b4,null))['catch'](handleError(_0x16b1b4,null));};exports['addDisposition']=function(_0x4c100d,_0x23316e,_0x322a1c){if(_0x4c100d[_0x9bd5('0x53')]['id']){delete _0x4c100d['body']['id'];}return db[_0x9bd5('0x46')]['find']({'where':{'id':_0x4c100d[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x23316e,null))[_0x9bd5('0x1b')](function(_0x280871){if(_0x280871){_0x4c100d[_0x9bd5('0x53')]['SmsAccountId']=_0x280871['id'];return db['Disposition'][_0x9bd5('0x52')](_0x4c100d[_0x9bd5('0x53')]);}})[_0x9bd5('0x1b')](respondWithResult(_0x23316e,null))['catch'](handleError(_0x23316e,null));};exports[_0x9bd5('0x5c')]=function(_0x660b0b,_0x1d53d7,_0x5c86a7){var _0x170198={'raw':![],'where':{}};var _0x13ba81={};var _0x236d10={'count':0x0,'rows':[]};return db[_0x9bd5('0x46')][_0x9bd5('0x5d')]({'where':{'id':_0x660b0b['params']['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x1d53d7,null))[_0x9bd5('0x1b')](function(_0x4a4213){if(_0x4a4213){_0x13ba81[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db[_0x9bd5('0x5e')][_0x9bd5('0x34')]);_0x13ba81[_0x9bd5('0x38')]=_[_0x9bd5('0x4f')](_0x660b0b[_0x9bd5('0x38')]);_0x13ba81[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x13ba81[_0x9bd5('0x4e')],_0x13ba81['query']);_0x170198['attributes']=_[_0x9bd5('0x3a')](_0x13ba81[_0x9bd5('0x4e')],qs[_0x9bd5('0x3c')](_0x660b0b['query'][_0x9bd5('0x3c')]));_0x170198[_0x9bd5('0x3b')]=_0x170198[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x170198[_0x9bd5('0x3b')]:_0x13ba81[_0x9bd5('0x4e')];if(!_0x660b0b[_0x9bd5('0x38')][_0x9bd5('0x3e')]('nolimit')){_0x170198[_0x9bd5('0x40')]=qs[_0x9bd5('0x40')](_0x660b0b['query'][_0x9bd5('0x40')]);_0x170198[_0x9bd5('0x28')]=qs[_0x9bd5('0x28')](_0x660b0b['query'][_0x9bd5('0x28')]);}_0x170198[_0x9bd5('0x5f')]=qs['sort'](_0x660b0b['query'][_0x9bd5('0x41')]);_0x170198[_0x9bd5('0x44')]=qs[_0x9bd5('0x39')](_[_0x9bd5('0x42')](_0x660b0b[_0x9bd5('0x38')],_0x13ba81[_0x9bd5('0x39')]));_0x170198[_0x9bd5('0x44')][_0x9bd5('0x60')]=_0x4a4213['id'];if(_0x660b0b[_0x9bd5('0x38')][_0x9bd5('0x43')]){_0x170198['where']=_[_0x9bd5('0x61')](_0x170198['where'],{'$or':_[_0x9bd5('0x33')](_0x170198[_0x9bd5('0x3b')],function(_0x493192){var _0x278b9e={};_0x278b9e[_0x493192]={'$like':'%'+_0x660b0b[_0x9bd5('0x38')][_0x9bd5('0x43')]+'%'};return _0x278b9e;})});}_0x170198=_[_0x9bd5('0x61')]({},_0x170198,_0x660b0b[_0x9bd5('0x45')]);return db[_0x9bd5('0x5e')][_0x9bd5('0x2a')]({'where':_0x170198[_0x9bd5('0x44')]})[_0x9bd5('0x1b')](function(_0xc50675){_0x236d10['count']=_0xc50675;if(_0x660b0b['query'][_0x9bd5('0x47')]){_0x170198[_0x9bd5('0x48')]=[{'all':!![]}];}return db['Disposition'][_0x9bd5('0x62')](_0x170198);})[_0x9bd5('0x1b')](function(_0xda2ebb){_0x236d10[_0x9bd5('0x49')]=_0xda2ebb;return _0x236d10;});}})['then'](respondWithFilteredResult(_0x1d53d7,_0x170198))[_0x9bd5('0x51')](handleError(_0x1d53d7,null));};exports['removeDispositions']=function(_0x393668,_0x3f2128,_0x3ec4fe){return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x393668[_0x9bd5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f2128,null))[_0x9bd5('0x1b')](function(_0x28216b){if(_0x28216b){return _0x28216b[_0x9bd5('0x63')](_0x393668['query']['ids']);}})[_0x9bd5('0x1b')](respondWithStatusCode(_0x3f2128,null))[_0x9bd5('0x51')](handleError(_0x3f2128,null));};exports['addAnswer']=function(_0x5766d4,_0x605809,_0x491fdb){if(_0x5766d4[_0x9bd5('0x53')]['id']){delete _0x5766d4[_0x9bd5('0x53')]['id'];}return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x5766d4[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x605809,null))[_0x9bd5('0x1b')](function(_0xcaa93c){if(_0xcaa93c){_0x5766d4[_0x9bd5('0x53')]['SmsAccountId']=_0xcaa93c['id'];return db[_0x9bd5('0x64')][_0x9bd5('0x52')](_0x5766d4['body']);}})[_0x9bd5('0x1b')](respondWithResult(_0x605809,null))['catch'](handleError(_0x605809,null));};exports[_0x9bd5('0x65')]=function(_0x2fd1ba,_0x46817f,_0x40d90a){var _0x4666d3={'raw':![],'where':{}};var _0x328ccc={};var _0x73ec79={'count':0x0,'rows':[]};return db[_0x9bd5('0x46')][_0x9bd5('0x5d')]({'where':{'id':_0x2fd1ba[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x46817f,null))[_0x9bd5('0x1b')](function(_0x330065){if(_0x330065){_0x328ccc[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db['CannedAnswer']['rawAttributes']);_0x328ccc['query']=_[_0x9bd5('0x4f')](_0x2fd1ba['query']);_0x328ccc[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x328ccc[_0x9bd5('0x4e')],_0x328ccc[_0x9bd5('0x38')]);_0x4666d3['attributes']=_['intersection'](_0x328ccc[_0x9bd5('0x4e')],qs['fields'](_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x3c')]));_0x4666d3['attributes']=_0x4666d3['attributes'][_0x9bd5('0x3d')]?_0x4666d3['attributes']:_0x328ccc[_0x9bd5('0x4e')];if(!_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x3e')](_0x9bd5('0x3f'))){_0x4666d3[_0x9bd5('0x40')]=qs[_0x9bd5('0x40')](_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x40')]);_0x4666d3[_0x9bd5('0x28')]=qs['offset'](_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x28')]);}_0x4666d3[_0x9bd5('0x5f')]=qs[_0x9bd5('0x41')](_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x41')]);_0x4666d3[_0x9bd5('0x44')]=qs['filters'](_[_0x9bd5('0x42')](_0x2fd1ba[_0x9bd5('0x38')],_0x328ccc[_0x9bd5('0x39')]));_0x4666d3[_0x9bd5('0x44')][_0x9bd5('0x60')]=_0x330065['id'];if(_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x43')]){_0x4666d3[_0x9bd5('0x44')]=_['merge'](_0x4666d3[_0x9bd5('0x44')],{'$or':_[_0x9bd5('0x33')](_0x4666d3[_0x9bd5('0x3b')],function(_0x25ade7){var _0x295b1={};_0x295b1[_0x25ade7]={'$like':'%'+_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x43')]+'%'};return _0x295b1;})});}_0x4666d3=_[_0x9bd5('0x61')]({},_0x4666d3,_0x2fd1ba[_0x9bd5('0x45')]);return db[_0x9bd5('0x64')][_0x9bd5('0x2a')]({'where':_0x4666d3[_0x9bd5('0x44')]})[_0x9bd5('0x1b')](function(_0x54159a){_0x73ec79[_0x9bd5('0x2a')]=_0x54159a;if(_0x2fd1ba[_0x9bd5('0x38')][_0x9bd5('0x47')]){_0x4666d3[_0x9bd5('0x48')]=[{'all':!![]}];}return db[_0x9bd5('0x64')][_0x9bd5('0x62')](_0x4666d3);})[_0x9bd5('0x1b')](function(_0x198572){_0x73ec79[_0x9bd5('0x49')]=_0x198572;return _0x73ec79;});}})[_0x9bd5('0x1b')](respondWithFilteredResult(_0x46817f,_0x4666d3))['catch'](handleError(_0x46817f,null));};exports[_0x9bd5('0x66')]=function(_0x4330e8,_0x31ac0a,_0xa855c1){return db['SmsAccount'][_0x9bd5('0x50')]({'where':{'id':_0x4330e8[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x31ac0a,null))[_0x9bd5('0x1b')](function(_0x2fc881){if(_0x2fc881){return _0x2fc881['removeAnswers'](_0x4330e8[_0x9bd5('0x38')][_0x9bd5('0x67')]);}})['then'](respondWithStatusCode(_0x31ac0a,null))[_0x9bd5('0x51')](handleError(_0x31ac0a,null));};exports[_0x9bd5('0x68')]=function(_0x231688,_0x4ddc9f,_0x2b47da){var _0x49e7f7={'channel':_0x9bd5('0x69')};var _0x173319=[];var _0x5cf48e=[];var _0x46774b={};return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x231688[_0x9bd5('0x4b')]['id']},'include':[{'model':db[_0x9bd5('0x6a')],'as':_0x9bd5('0x6b')}]})[_0x9bd5('0x1b')](handleEntityNotFound(_0x4ddc9f,null))[_0x9bd5('0x1b')](function(_0x5743f7){_0x49e7f7[_0x9bd5('0x6c')]=_0x5743f7;_0x49e7f7[_0x9bd5('0x6d')]=_[_0x9bd5('0x6e')](_0x5743f7[_0x9bd5('0x6b')],[_0x9bd5('0x6f')],['asc']);if(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x6b')]){delete _0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x6b')];}return db['CmContact'][_0x9bd5('0x5b')]();})['then'](function(_0x58c931){if(!_0x58c931){throw new db[(_0x9bd5('0x70'))][(_0x9bd5('0x71'))]('no\x20available\x20attributes');}_0x173319=_[_0x9bd5('0x72')](_[_0x9bd5('0x4f')](_0x58c931),[_0x9bd5('0x73'),'updatedAt']);_0x5cf48e=_[_0x9bd5('0x72')](_[_0x9bd5('0x4f')](_0x58c931),[_0x9bd5('0x73'),_0x9bd5('0x74'),_0x9bd5('0x75'),_0x9bd5('0x76')]);_0x49e7f7[_0x9bd5('0x53')]={'mapKey':_0x9bd5('0x77')};if(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x36')]){switch(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x36')]){case _0x9bd5('0x78'):_0x49e7f7['body'][_0x9bd5('0x79')]=_0x231688['body'][_0x9bd5('0x7a')];_0x49e7f7['body'][_0x9bd5('0x53')]=_0x231688[_0x9bd5('0x53')]['Body'];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x7b')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x7c')];break;case _0x9bd5('0x7d'):_0x49e7f7[_0x9bd5('0x53')]['from']='+'+_0x231688['body'][_0x9bd5('0x7e')];_0x49e7f7[_0x9bd5('0x53')]['body']=_0x231688['body']['text'];break;case _0x9bd5('0x7f'):_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x79')];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x53')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x22')];break;case _0x9bd5('0x80'):_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]=_0x231688['body']['from'];_0x49e7f7[_0x9bd5('0x53')]['body']=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x53')];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x7b')]=_0x231688[_0x9bd5('0x53')]['message_id'];break;case _0x9bd5('0x81'):_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x7a')];_0x49e7f7[_0x9bd5('0x53')]['body']=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x82')];_0x49e7f7[_0x9bd5('0x53')]['messageId']=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x83')];break;case'infobip':_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]='+'+_0x231688['body'][_0x9bd5('0x84')][0x0][_0x9bd5('0x79')];_0x49e7f7[_0x9bd5('0x53')]['body']=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x84')][0x0][_0x9bd5('0x85')];_0x49e7f7['body'][_0x9bd5('0x7b')]=_0x231688[_0x9bd5('0x53')]['results'][0x0][_0x9bd5('0x7b')];break;case _0x9bd5('0x86'):_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x87')];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x53')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x88')]['message'];break;case _0x9bd5('0x89'):_0x49e7f7['body'][_0x9bd5('0x79')]=_0x231688[_0x9bd5('0x53')]['fromNumber'];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x53')]=_0x231688[_0x9bd5('0x53')]['text'];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x7b')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x8a')];break;case'bandwidth':_0x49e7f7[_0x9bd5('0x53')]['messageId']=_0x231688[_0x9bd5('0x53')][0x0]['message']['id'];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')]=_0x231688[_0x9bd5('0x53')][0x0][_0x9bd5('0x22')][_0x9bd5('0x79')];_0x49e7f7[_0x9bd5('0x53')]['body']=_0x231688[_0x9bd5('0x53')][0x0][_0x9bd5('0x22')]['text'];break;case _0x9bd5('0x8b'):_0x49e7f7[_0x9bd5('0x53')]['from']=_0x231688['body']['from'];_0x49e7f7['body'][_0x9bd5('0x53')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x22')];_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x7b')]=_0x231688[_0x9bd5('0x53')][_0x9bd5('0x8c')];break;}}if(_0x49e7f7['body']['id']){delete _0x49e7f7[_0x9bd5('0x53')]['id'];}if(_[_0x9bd5('0x8d')](_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')])){throw new db[(_0x9bd5('0x70'))][(_0x9bd5('0x71'))]('from\x20is\x20mandatory');}if(_[_0x9bd5('0x8d')](_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x53')])||_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x53')]===''){throw new db['Sequelize']['ValidationError'](_0x9bd5('0x8e'));}if(_[_0x9bd5('0x8d')](_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x8f')])){throw new db[(_0x9bd5('0x70'))]['ValidationError'](_0x9bd5('0x90')+_0x5cf48e);}if(!_['includes'](_0x5cf48e,_0x49e7f7[_0x9bd5('0x53')]['mapKey'])){throw new db[(_0x9bd5('0x70'))]['ValidationError'](_0x9bd5('0x91')+_0x5cf48e);}_0x46774b[_0x49e7f7[_0x9bd5('0x53')]['mapKey']]=_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0x79')];return db[_0x9bd5('0x92')]['find']({'where':{'id':_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x76')]},'include':[{'model':db[_0x9bd5('0x93')],'as':'Contacts','where':_0x46774b,'limit':0x1,'order':[[_0x9bd5('0x74'),_0x9bd5('0x94')]]}]});})[_0x9bd5('0x1b')](handleEntityNotFound(_0x4ddc9f,null))[_0x9bd5('0x1b')](function(_0xb0b903){if(_0xb0b903){_0x49e7f7[_0x9bd5('0x95')]=_['omit'](_0xb0b903,[_0x9bd5('0x96')]);if(_0xb0b903['Contacts'][_0x9bd5('0x3d')]){return _0xb0b903[_0x9bd5('0x96')][0x0];}var _0x583daf=_[_0x9bd5('0x14')](_0x49e7f7['body'],{'firstName':_0x49e7f7['body'][_0x9bd5('0x79')],'ListId':_0xb0b903['id']});_0x583daf[_0x49e7f7[_0x9bd5('0x53')]['mapKey']]=_0x49e7f7['body'][_0x9bd5('0x79')];return db['CmContact'][_0x9bd5('0x52')](_0x583daf,{'fields':_0x173319,'raw':!![]});}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x4ddc9f,null))[_0x9bd5('0x1b')](function(_0x437eb2){if(_0x437eb2){_0x49e7f7[_0x9bd5('0x97')]=_0x437eb2;var _0x40c1bf={'ContactId':_0x437eb2['id'],'phone':_0x49e7f7['body'][_0x9bd5('0x79')],'SmsAccountId':_0x231688[_0x9bd5('0x4b')]['id']};var _0x1a064b={'ContactId':_0x437eb2['id'],'SmsAccountId':_0x231688[_0x9bd5('0x4b')]['id'],'closed':![]};return db[_0x9bd5('0x98')]['find']({'where':_0x1a064b})[_0x9bd5('0x1b')](function(_0x544118){if(_0x544118){return[_0x544118,![]];}return db['SmsInteraction'][_0x9bd5('0x52')](_0x40c1bf)[_0x9bd5('0x1b')](function(_0x175bde){return[_0x175bde,!![]];});});}})[_0x9bd5('0x99')](function(_0x521a25,_0x3dd35c){_0x49e7f7[_0x9bd5('0x9a')]=_0x521a25[_0x9bd5('0x2f')]({'plain':!![]});_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0x9b')]=![];if(_0x3dd35c){if(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x9c')]){_0x49e7f7[_0x9bd5('0x6d')][_0x9bd5('0x9d')]({'id':0x0,'priority':_0x49e7f7['applications'][_0x9bd5('0x3d')]+0x1,'app':_0x9bd5('0x9e'),'appdata':_0x9bd5('0x9f'),'interval':_0x9bd5('0xa0')});}_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0x9b')]=!![];}return db[_0x9bd5('0xa1')][_0x9bd5('0x52')]({'phone':_0x49e7f7[_0x9bd5('0x53')]['from'],'messageId':_0x49e7f7['body'][_0x9bd5('0x7b')],'body':_0x49e7f7['body'][_0x9bd5('0x53')],'SmsAccountId':_0x231688[_0x9bd5('0x4b')]['id'],'SmsInteractionId':_0x521a25['id'],'direction':'in','ContactId':_0x521a25[_0x9bd5('0xa2')],'AttachmentId':_0x49e7f7[_0x9bd5('0x53')][_0x9bd5('0xa3')]});})[_0x9bd5('0x1b')](function(_0x400419){_0x49e7f7[_0x9bd5('0x22')]=_0x400419;if(!_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0xa4')])return;return db[_0x9bd5('0xa5')]['find']({'attributes':['id','name'],'where':{'id':_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0xa4')]}});})['then'](function(_0x557704){if(_0x557704){_0x49e7f7[_0x9bd5('0x6d')][_0x9bd5('0xa6')]({'id':0x0,'priority':0x0,'app':_0x9bd5('0xa7'),'appdata':_0x557704['name']+','+(_0x49e7f7['account'][_0x9bd5('0xa8')]||0xa),'interval':'*,*,*,*'});}if(!_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0xa9')])return;return db[_0x9bd5('0xaa')]['find']({'attributes':['id','name'],'where':{'id':_0x49e7f7[_0x9bd5('0x9a')][_0x9bd5('0xa9')]}});})[_0x9bd5('0x1b')](function(_0x49f275){if(_0x49f275){_0x49e7f7['applications'][_0x9bd5('0xa6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x49f275[_0x9bd5('0x31')]+','+(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0xab')]||0x12c),'interval':_0x9bd5('0xa0')});}return respondWithRpcPromise(_0x9bd5('0xac'),'startRouting',_0x49e7f7);})[_0x9bd5('0x1b')](function(_0x4165bb){if(_0x4165bb){var _0x4897b3=0xc8;var _0x17c60d='receiveMessage';logger[_0x9bd5('0x23')](_0x9bd5('0x1e'),_0x17c60d,_0x4897b3,_0x9bd5('0xad'));logger[_0x9bd5('0x1d')](_0x9bd5('0xae'),_0x17c60d,_0x4897b3,_0x9bd5('0xad'),JSON[_0x9bd5('0xaf')](_0x4165bb));if(_0x49e7f7[_0x9bd5('0x6c')][_0x9bd5('0x36')]===_0x9bd5('0x78')){return _0x4ddc9f['status'](_0x4897b3)[_0x9bd5('0xb0')](_0x9bd5('0xb1'),_0x9bd5('0xb2'))[_0x9bd5('0xb3')]('\x0a');}else{return _0x4ddc9f[_0x9bd5('0x25')](_0x4897b3)[_0x9bd5('0x27')](_0x4165bb);}}})[_0x9bd5('0x51')](handleError(_0x4ddc9f,null));};exports[_0x9bd5('0xb4')]=function(_0x589b5f,_0x39eccd){var _0x59809e=_0x589b5f[_0x9bd5('0x4b')]['id'];var _0x2d765d=_0x589b5f['body'];var _0x2136ef=0xc8;var _0xba871f=null;return db[_0x9bd5('0xb5')][_0x9bd5('0xb6')]({'isolationLevel':db[_0x9bd5('0xb5')][_0x9bd5('0xb7')][_0x9bd5('0xb8')][_0x9bd5('0xb9')]},function(_0x434dde){return db[_0x9bd5('0x46')][_0x9bd5('0x5d')]({'where':{'id':_0x59809e},'transaction':_0x434dde})['then'](function(_0x39be66){if(_0x39be66){return db['SmsApplication'][_0x9bd5('0x2e')]({'where':{'SmsAccountId':_0x59809e},'transaction':_0x434dde})[_0x9bd5('0x1b')](function(){var _0x568054=_['map'](_0x2d765d,function(_0x1f8276){_0x1f8276[_0x9bd5('0x60')]=_0x59809e;return _0x1f8276;});return db[_0x9bd5('0x6a')][_0x9bd5('0xba')](_0x568054,{'transaction':_0x434dde});});}else{_0x2136ef=0x194;_0xba871f=[];}});})['then'](function(){if(_0x2136ef!==0x194){return db[_0x9bd5('0x6a')]['findAndCountAll']({'where':{'SmsAccountId':_0x59809e},'order':'priority'})[_0x9bd5('0x1b')](function(_0x1ed6b2){_0xba871f=_0x1ed6b2;});}})['catch'](function(_0x439151){_0x2136ef=0x1f4;logger['error'](_0x439151[_0x9bd5('0x30')]);if(_0x439151[_0x9bd5('0x31')]){delete _0x439151[_0x9bd5('0x31')];}_0xba871f=_0x439151;})['finally'](function(){if(_0xba871f===null){_0x39eccd[_0x9bd5('0x24')](_0x2136ef);}else{if(_0x2136ef===0x1f4){_0x39eccd[_0x9bd5('0x25')](_0x2136ef)[_0x9bd5('0xb3')](_0xba871f);}else{_0x39eccd['status'](_0x2136ef)[_0x9bd5('0x27')](_0xba871f);}}});};exports[_0x9bd5('0xbb')]=function(_0x2e1c0f,_0x46ab79,_0x548f15){var _0x19be18={};var _0x523312={};var _0x203861;var _0x3c935f;return db['SmsAccount'][_0x9bd5('0x5d')]({'where':{'id':_0x2e1c0f[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x46ab79,null))[_0x9bd5('0x1b')](function(_0xc0dd23){if(_0xc0dd23){_0x203861=_0xc0dd23;_0x523312[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db['SmsApplication'][_0x9bd5('0x34')]);_0x523312[_0x9bd5('0x38')]=_[_0x9bd5('0x4f')](_0x2e1c0f[_0x9bd5('0x38')]);_0x523312[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x523312['model'],_0x523312[_0x9bd5('0x38')]);_0x19be18[_0x9bd5('0x3b')]=_[_0x9bd5('0x3a')](_0x523312['model'],qs[_0x9bd5('0x3c')](_0x2e1c0f['query'][_0x9bd5('0x3c')]));_0x19be18[_0x9bd5('0x3b')]=_0x19be18[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x19be18[_0x9bd5('0x3b')]:_0x523312['model'];_0x19be18[_0x9bd5('0x5f')]=qs[_0x9bd5('0x41')](_0x2e1c0f[_0x9bd5('0x38')][_0x9bd5('0x41')]);_0x19be18[_0x9bd5('0x44')]=qs['filters'](_[_0x9bd5('0x42')](_0x2e1c0f[_0x9bd5('0x38')],_0x523312['filters']));if(_0x2e1c0f['query']['filter']){_0x19be18[_0x9bd5('0x44')]=_[_0x9bd5('0x61')](_0x19be18[_0x9bd5('0x44')],{'$or':_[_0x9bd5('0x33')](_0x19be18['attributes'],function(_0x1b4feb){var _0x581dfc={};_0x581dfc[_0x1b4feb]={'$like':'%'+_0x2e1c0f[_0x9bd5('0x38')][_0x9bd5('0x43')]+'%'};return _0x581dfc;})});}_0x19be18=_[_0x9bd5('0x61')]({},_0x19be18,_0x2e1c0f[_0x9bd5('0x45')]);return _0x203861['getApplications'](_0x19be18);}})[_0x9bd5('0x1b')](function(_0x2b2e06){if(_0x2b2e06){_0x3c935f=_0x2b2e06['length'];if(!_0x2e1c0f['query'][_0x9bd5('0x3e')](_0x9bd5('0x3f'))){_0x19be18[_0x9bd5('0x40')]=qs[_0x9bd5('0x40')](_0x2e1c0f['query'][_0x9bd5('0x40')]);_0x19be18[_0x9bd5('0x28')]=qs['offset'](_0x2e1c0f[_0x9bd5('0x38')][_0x9bd5('0x28')]);}return _0x203861[_0x9bd5('0xbb')](_0x19be18);}})[_0x9bd5('0x1b')](function(_0x55bfff){if(_0x55bfff){return _0x55bfff?{'count':_0x3c935f,'rows':_0x55bfff}:null;}})[_0x9bd5('0x1b')](respondWithResult(_0x46ab79,null))['catch'](handleError(_0x46ab79,null));};exports[_0x9bd5('0xbc')]=function(_0x2e7cc2,_0x145a24,_0x493df0){var _0x4449c4={'raw':![],'where':{}};var _0x5e5e95={};var _0x3e991b={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9bd5('0x5d')]({'where':{'id':_0x2e7cc2['params']['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x145a24,null))[_0x9bd5('0x1b')](function(_0x140b66){if(_0x140b66){_0x5e5e95[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db[_0x9bd5('0x98')][_0x9bd5('0x34')]);_0x5e5e95[_0x9bd5('0x38')]=_['keys'](_0x2e7cc2[_0x9bd5('0x38')]);_0x5e5e95[_0x9bd5('0x39')]=_[_0x9bd5('0x3a')](_0x5e5e95[_0x9bd5('0x4e')],_0x5e5e95[_0x9bd5('0x38')]);_0x4449c4['attributes']=_[_0x9bd5('0x3a')](_0x5e5e95[_0x9bd5('0x4e')],qs[_0x9bd5('0x3c')](_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0x3c')]));_0x4449c4['attributes']=_0x4449c4[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x4449c4[_0x9bd5('0x3b')]:_0x5e5e95['model'];if(!_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0x3e')](_0x9bd5('0x3f'))){_0x4449c4[_0x9bd5('0x40')]=qs[_0x9bd5('0x40')](_0x2e7cc2['query'][_0x9bd5('0x40')]);_0x4449c4['offset']=qs[_0x9bd5('0x28')](_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0x28')]);}_0x4449c4[_0x9bd5('0x5f')]=qs['sort'](_0x2e7cc2['query'][_0x9bd5('0x41')]);_0x4449c4[_0x9bd5('0x44')]=qs[_0x9bd5('0x39')](_[_0x9bd5('0x42')](_0x2e7cc2[_0x9bd5('0x38')],_0x5e5e95[_0x9bd5('0x39')]));_0x4449c4[_0x9bd5('0x44')]['SmsAccountId']=_0x140b66['id'];if(_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0x43')]){_0x4449c4[_0x9bd5('0x44')]=_[_0x9bd5('0x61')](_0x4449c4[_0x9bd5('0x44')],{'$or':_['map'](_0x4449c4[_0x9bd5('0x3b')],function(_0x7c9b3a){var _0x5b544f={};_0x5b544f[_0x7c9b3a]={'$like':'%'+_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0x43')]+'%'};return _0x5b544f;})});}_0x4449c4=_[_0x9bd5('0x61')]({},_0x4449c4,_0x2e7cc2[_0x9bd5('0x45')]);return db[_0x9bd5('0x98')][_0x9bd5('0x2a')]({'where':_0x4449c4[_0x9bd5('0x44')]})[_0x9bd5('0x1b')](function(_0x528fab){_0x3e991b[_0x9bd5('0x2a')]=_0x528fab;if(_0x2e7cc2['query'][_0x9bd5('0x47')]){_0x4449c4[_0x9bd5('0x48')]=[{'model':db[_0x9bd5('0x93')],'as':_0x9bd5('0xbd'),'required':![]},{'model':db[_0x9bd5('0xa5')],'as':_0x9bd5('0xbe'),'attributes':[_0x9bd5('0x31'),_0x9bd5('0xbf'),_0x9bd5('0xc0')],'required':![]},{'model':db[_0x9bd5('0xc1')],'as':_0x9bd5('0xc2'),'attributes':['id',_0x9bd5('0x31'),_0x9bd5('0xc3')],'where':_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0xc4')]?{'id':_0x2e7cc2['query'][_0x9bd5('0xc4')]}:undefined,'required':_0x2e7cc2[_0x9bd5('0x38')][_0x9bd5('0xc4')]?!![]:![]}];}return db[_0x9bd5('0x98')]['findAll'](_0x4449c4);})[_0x9bd5('0x1b')](function(_0x222d50){_0x3e991b[_0x9bd5('0x49')]=_0x222d50;return _0x3e991b;});}})[_0x9bd5('0x1b')](respondWithFilteredResult(_0x145a24,_0x4449c4))['catch'](handleError(_0x145a24,null));};exports['send']=function(_0x3c1bb6,_0x5305d7,_0x4abbe1){var _0x5cca02,_0x1b8f97,_0x1f8634;if(_[_0x9bd5('0x8d')](_0x3c1bb6[_0x9bd5('0x53')][_0x9bd5('0x53')])||_0x3c1bb6[_0x9bd5('0x53')][_0x9bd5('0x53')]===''){throw new db[(_0x9bd5('0x70'))][(_0x9bd5('0x71'))](_0x9bd5('0x8e'));}if(_[_0x9bd5('0x8d')](_0x3c1bb6[_0x9bd5('0x53')]['to'])){throw new db[(_0x9bd5('0x70'))][(_0x9bd5('0x71'))]('to\x20is\x20mandatory');}_0x5cca02=_0x3c1bb6[_0x9bd5('0x53')]['to'];return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x3c1bb6[_0x9bd5('0x4b')]['id']},'include':[{'model':db[_0x9bd5('0x92')],'as':_0x9bd5('0xc5'),'include':[{'model':db['CmContact'],'as':_0x9bd5('0x96'),'where':{'mobile':_0x5cca02},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x9bd5('0x1b')](handleEntityNotFound(_0x5305d7,null))[_0x9bd5('0x1b')](function(_0x2bcf87){if(_0x2bcf87&&_0x2bcf87[_0x9bd5('0xc5')]){_0x1b8f97=_0x2bcf87[_0x9bd5('0x2f')]({'plain':!![]});if(_0x1b8f97[_0x9bd5('0xc5')]&&_0x1b8f97[_0x9bd5('0xc5')]['Contacts'][_0x9bd5('0x3d')]){return _0x1b8f97['List'][_0x9bd5('0x96')][0x0];}return db['CmContact']['create'](_[_0x9bd5('0x14')](_0x3c1bb6['body'],{'firstName':_0x5cca02,'mobile':_0x5cca02,'phone':_0x5cca02,'ListId':_0x1b8f97[_0x9bd5('0x76')]}));}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x5305d7,null))['then'](function(_0x25d0c9){if(_0x25d0c9){_0x1f8634=_0x25d0c9;return db['SmsInteraction'][_0x9bd5('0x50')]({'where':{'ContactId':_0x1f8634['id'],'closed':![],'SmsAccountId':_0x1b8f97['id']}})[_0x9bd5('0x1b')](function(_0x494c89){if(_0x494c89){return[_0x494c89,![]];}return db[_0x9bd5('0x98')]['create']({'UserId':_0x3c1bb6['user']['id'],'ContactId':_0x1f8634['id'],'SmsAccountId':_0x1b8f97['id'],'phone':_0x5cca02,'firstMsgDirection':_0x9bd5('0xc6'),'Messages':[_[_0x9bd5('0x61')](_0x3c1bb6[_0x9bd5('0x53')],{'read':![],'body':_0x3c1bb6[_0x9bd5('0x53')]['body'],'phone':_0x5cca02,'SmsAccountId':_0x1b8f97['id'],'UserId':_0x3c1bb6['user']['id'],'ContactId':_0x1f8634['id']})]},{'include':[{'model':db[_0x9bd5('0xa1')],'as':'Messages'}]})[_0x9bd5('0x1b')](function(_0x3c8a86){return[_0x3c8a86,!![]];});});}})[_0x9bd5('0x99')](function(_0x1654ae,_0x42938e){if(_0x42938e){return _0x1654ae;}return db[_0x9bd5('0xa1')][_0x9bd5('0x52')](_[_0x9bd5('0x61')](_0x3c1bb6['body'],{'read':![],'body':_0x3c1bb6[_0x9bd5('0x53')][_0x9bd5('0x53')],'phone':_0x5cca02,'SmsAccountId':_0x1b8f97['id'],'SmsInteractionId':_0x1654ae['id'],'UserId':_0x3c1bb6[_0x9bd5('0x54')]['id'],'ContactId':_0x1f8634['id']}))['then'](function(_0x236963){_0x1654ae[_0x9bd5('0xc7')][_0x9bd5('0xc8')]=[];_0x1654ae[_0x9bd5('0xc7')][_0x9bd5('0xc8')]['push'](_0x236963[_0x9bd5('0xc7')]);return _0x1654ae;});})['then'](respondWithResult(_0x5305d7,null))[_0x9bd5('0x51')](handleError(_0x5305d7,null));};exports[_0x9bd5('0x25')]=function(_0x3c7280,_0x23d98d,_0x16688a){if(_0x3c7280[_0x9bd5('0x53')]['id']){delete _0x3c7280[_0x9bd5('0x53')]['id'];}var _0x163021,_0x1ae66c,_0x171a75;return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x3c7280['params']['id']}})['then'](handleEntityNotFound(_0x23d98d,null))[_0x9bd5('0x1b')](function(_0xd0307e){if(_0xd0307e){_0x171a75=_0xd0307e;logger['debug'](_0x9bd5('0x1e'),_0x9bd5('0x25'),_0x9bd5('0xc9'),_0xd0307e[_0x9bd5('0x36')],util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));switch(_0xd0307e[_0x9bd5('0x36')]){case _0x9bd5('0x7d'):if(_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcb')]&&_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x25')]){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x25')];return db['SmsMessage'][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280['body']['skebby_dispatch_id']}});}break;case _0x9bd5('0x7f'):if(_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcc')]&&_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcd')]){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcd')];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcc')]}});}break;case'clicksend':if(_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xce')]&&_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xcf')]){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')]['status_code'];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xce')]}});}break;case'infobip':var _0x518f4e=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x84')][0x0];if(_0x518f4e['messageId']&&_0x518f4e[_0x9bd5('0x25')][_0x9bd5('0xd0')]==='DELIVERED'){_0x1ae66c=_0x518f4e[_0x9bd5('0x25')][_0x9bd5('0xd0')];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x518f4e[_0x9bd5('0x7b')]}});}break;case _0x9bd5('0x89'):if(_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x7b')]&&_0x3c7280['body'][_0x9bd5('0x25')]){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x25')];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x7b')]}});}break;case _0x9bd5('0xd1'):if(_0x3c7280[_0x9bd5('0x53')][0x0][_0x9bd5('0x22')]['id']){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')][0x0][_0x9bd5('0x36')];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280[_0x9bd5('0x53')][0x0][_0x9bd5('0x22')]['id']}});}break;case _0x9bd5('0x8b'):if(_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xd2')]&&_0x3c7280[_0x9bd5('0x53')]['status']){_0x1ae66c=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x25')];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xd2')]}});}break;}}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x23d98d,null))[_0x9bd5('0x1b')](function(_0x169cd4){if(_0x169cd4){_0x163021=_0x169cd4;switch(_0x171a75[_0x9bd5('0x36')]){case'skebby':if(_0x1ae66c===_0x9bd5('0xd3')){return _0x163021['update']({'read':!![]});}else{logger[_0x9bd5('0x20')](_0x9bd5('0x1e'),'status',_0x9bd5('0x7d'),util['inspect'](_0x3c7280['body'],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0x7f'):if(_0x1ae66c==='1'){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9bd5('0x25'),'skebby',util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0x80'):if(!_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0xd4')]&&_0x1ae66c>=0xc8&&_0x1ae66c<=0xce){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger['error'](_0x9bd5('0x1e'),'status',_0x9bd5('0x80'),util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0xd5'):var _0x46e985=_0x3c7280[_0x9bd5('0x53')][_0x9bd5('0x84')][0x0];if(_0x46e985[_0x9bd5('0x25')][_0x9bd5('0xd0')]===_0x9bd5('0xd3')){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9bd5('0x25'),_0x9bd5('0xd5'),util['inspect'](_0x3c7280['body'],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0x89'):if(_0x1ae66c==_0x9bd5('0xd6')||_0x1ae66c==_0x9bd5('0xd7')){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')](_0x9bd5('0x1e'),'status',_0x9bd5('0x89'),util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0xd1'):if(_0x1ae66c=='message-delivered'){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')](_0x9bd5('0x1e'),_0x9bd5('0x25'),_0x9bd5('0xd1'),util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9bd5('0x8b'):if(_0x1ae66c===_0x9bd5('0xd8')||_0x1ae66c===_0x9bd5('0xd9')){return _0x163021[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')](_0x9bd5('0x1e'),_0x9bd5('0x25'),_0x9bd5('0x8b'),util[_0x9bd5('0xca')](_0x3c7280[_0x9bd5('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x163021;}})[_0x9bd5('0x1b')](respondWithResult(_0x23d98d,null))['catch'](handleError(_0x23d98d,null));};exports[_0x9bd5('0xda')]=function(_0x4cf31b,_0x54cad1,_0x588ee4){var _0x450b43,_0x163baa,_0x25619d;return db[_0x9bd5('0x46')][_0x9bd5('0x50')]({'where':{'id':_0x4cf31b[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x54cad1,null))[_0x9bd5('0x1b')](function(_0x101dc2){if(_0x101dc2){_0x25619d=_0x101dc2;logger['debug'](_0x9bd5('0x1e'),_0x9bd5('0x25'),_0x9bd5('0xc9'),_0x101dc2[_0x9bd5('0x36')],util[_0x9bd5('0xca')](_0x4cf31b[_0x9bd5('0x38')],{'showHidden':![],'depth':null}));switch(_0x101dc2['type']){case _0x9bd5('0x86'):if(_0x4cf31b[_0x9bd5('0x38')]['message-id']&&_0x4cf31b[_0x9bd5('0x38')]['state']){_0x163baa=_0x4cf31b[_0x9bd5('0x38')]['state'];return db[_0x9bd5('0xa1')][_0x9bd5('0x50')]({'where':{'messageId':_0x4cf31b[_0x9bd5('0x38')][_0x9bd5('0xdb')]}});}break;}}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x54cad1,null))[_0x9bd5('0x1b')](function(_0x4e55d6){if(_0x4e55d6){_0x450b43=_0x4e55d6;switch(_0x25619d[_0x9bd5('0x36')]){case _0x9bd5('0x86'):if(_0x163baa==='2'||_0x163baa==='6'){return _0x450b43[_0x9bd5('0x2d')]({'read':!![]});}else{logger[_0x9bd5('0x20')](_0x9bd5('0x1e'),_0x9bd5('0x25'),_0x9bd5('0x86'),util['inspect'](_0x4cf31b[_0x9bd5('0x38')],{'showHidden':![],'depth':null}));};break;}return _0x450b43;}})['then'](respondWithResult(_0x54cad1,null))[_0x9bd5('0x51')](handleError(_0x54cad1,null));};exports[_0x9bd5('0xdc')]=function(_0x2b5aff,_0x4fccd4,_0x1958bf){return db['SmsAccount'][_0x9bd5('0x50')]({'where':{'id':_0x2b5aff[_0x9bd5('0x4b')]['id']}})[_0x9bd5('0x1b')](handleEntityNotFound(_0x4fccd4,null))[_0x9bd5('0x1b')](function(_0x34d86a){if(_0x34d86a){return _0x34d86a[_0x9bd5('0xdc')](_0x2b5aff[_0x9bd5('0x53')]['ids'],_[_0x9bd5('0xdd')](_0x2b5aff[_0x9bd5('0x53')],[_0x9bd5('0x67'),'id'])||{})['spread'](function(_0xb50329){for(var _0x29625e=0x0;_0x29625e<_0x2b5aff[_0x9bd5('0x53')][_0x9bd5('0x67')][_0x9bd5('0x3d')];_0x29625e+=0x1){socket['emit'](_0x9bd5('0xde'),{'UserId':Number(_0x2b5aff[_0x9bd5('0x53')]['ids'][_0x29625e]),'SmsAccountId':Number(_0x2b5aff[_0x9bd5('0x4b')]['id'])});}return _0xb50329;});}})['then'](respondWithResult(_0x4fccd4,null))[_0x9bd5('0x51')](handleError(_0x4fccd4,null));};exports[_0x9bd5('0xdf')]=function(_0x2067f4,_0x8667af,_0x124026){return db[_0x9bd5('0x46')]['find']({'where':{'id':_0x2067f4[_0x9bd5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8667af,null))[_0x9bd5('0x1b')](function(_0x1f06c9){if(_0x1f06c9){return _0x1f06c9[_0x9bd5('0xdf')](_0x2067f4[_0x9bd5('0x38')][_0x9bd5('0x67')])[_0x9bd5('0x1b')](function(){if(_[_0x9bd5('0xe0')](_0x2067f4[_0x9bd5('0x38')][_0x9bd5('0x67')])){for(var _0x1d9a2a=0x0;_0x1d9a2a<_0x2067f4[_0x9bd5('0x38')]['ids'][_0x9bd5('0x3d')];_0x1d9a2a+=0x1){socket[_0x9bd5('0xe1')](_0x9bd5('0xe2'),{'UserId':Number(_0x2067f4[_0x9bd5('0x38')][_0x9bd5('0x67')][_0x1d9a2a]),'SmsAccountId':Number(_0x2067f4[_0x9bd5('0x4b')]['id'])});}}else{socket[_0x9bd5('0xe1')](_0x9bd5('0xe2'),{'UserId':Number(_0x2067f4[_0x9bd5('0x38')]['ids']),'SmsAccountId':Number(_0x2067f4[_0x9bd5('0x4b')]['id'])});}});}})[_0x9bd5('0x1b')](respondWithStatusCode(_0x8667af,null))[_0x9bd5('0x51')](handleError(_0x8667af,null));};exports[_0x9bd5('0xe3')]=function(_0x29ae31,_0x54b3b6,_0x5d9a62){var _0x2aaf04={};var _0x5c3ae4={};var _0x542b4d;var _0x2c2bed;return db['SmsAccount'][_0x9bd5('0x5d')]({'where':{'id':_0x29ae31[_0x9bd5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x54b3b6,null))['then'](function(_0x571f3b){if(_0x571f3b){_0x542b4d=_0x571f3b;_0x5c3ae4[_0x9bd5('0x4e')]=_[_0x9bd5('0x4f')](db[_0x9bd5('0xa5')][_0x9bd5('0x34')]);_0x5c3ae4['query']=_['keys'](_0x29ae31[_0x9bd5('0x38')]);_0x5c3ae4['filters']=_['intersection'](_0x5c3ae4[_0x9bd5('0x4e')],_0x5c3ae4[_0x9bd5('0x38')]);_0x2aaf04[_0x9bd5('0x3b')]=_[_0x9bd5('0x3a')](_0x5c3ae4[_0x9bd5('0x4e')],qs['fields'](_0x29ae31[_0x9bd5('0x38')][_0x9bd5('0x3c')]));_0x2aaf04[_0x9bd5('0x3b')]=_0x2aaf04[_0x9bd5('0x3b')][_0x9bd5('0x3d')]?_0x2aaf04[_0x9bd5('0x3b')]:_0x5c3ae4[_0x9bd5('0x4e')];_0x2aaf04[_0x9bd5('0x5f')]=qs[_0x9bd5('0x41')](_0x29ae31['query'][_0x9bd5('0x41')]);_0x2aaf04[_0x9bd5('0x44')]=qs[_0x9bd5('0x39')](_[_0x9bd5('0x42')](_0x29ae31[_0x9bd5('0x38')],_0x5c3ae4[_0x9bd5('0x39')]));if(_0x29ae31[_0x9bd5('0x38')][_0x9bd5('0x43')]){_0x2aaf04[_0x9bd5('0x44')]=_[_0x9bd5('0x61')](_0x2aaf04[_0x9bd5('0x44')],{'$or':_['map'](_0x2aaf04[_0x9bd5('0x3b')],function(_0xac81b4){var _0x11057d={};_0x11057d[_0xac81b4]={'$like':'%'+_0x29ae31['query'][_0x9bd5('0x43')]+'%'};return _0x11057d;})});}_0x2aaf04=_[_0x9bd5('0x61')]({},_0x2aaf04,_0x29ae31[_0x9bd5('0x45')]);return _0x542b4d[_0x9bd5('0xe3')](_0x2aaf04);}})['then'](function(_0x4fdde6){if(_0x4fdde6){_0x2c2bed=_0x4fdde6['length'];if(!_0x29ae31['query']['hasOwnProperty'](_0x9bd5('0x3f'))){_0x2aaf04[_0x9bd5('0x40')]=qs[_0x9bd5('0x40')](_0x29ae31[_0x9bd5('0x38')]['limit']);_0x2aaf04[_0x9bd5('0x28')]=qs['offset'](_0x29ae31[_0x9bd5('0x38')][_0x9bd5('0x28')]);}return _0x542b4d[_0x9bd5('0xe3')](_0x2aaf04);}})[_0x9bd5('0x1b')](function(_0x5ce82b){if(_0x5ce82b){return _0x5ce82b?{'count':_0x2c2bed,'rows':_0x5ce82b}:null;}})[_0x9bd5('0x1b')](respondWithResult(_0x54b3b6,null))['catch'](handleError(_0x54b3b6,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1225a4d..b4cde5b 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 _0x99ad=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x25015e,_0x179c71){var _0xdb17f7=function(_0x2d04ae){while(--_0x2d04ae){_0x25015e['push'](_0x25015e['shift']());}};_0xdb17f7(++_0x179c71);}(_0x99ad,0x169));var _0xd99a=function(_0x2a7048,_0x55199d){_0x2a7048=_0x2a7048-0x0;var _0x37b4c4=_0x99ad[_0x2a7048];return _0x37b4c4;};'use strict';var EventEmitter=require(_0xd99a('0x0'));var SmsAccount=require(_0xd99a('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd99a('0x2'),'afterUpdate':_0xd99a('0x3'),'afterDestroy':_0xd99a('0x4')};function emitEvent(_0x1b756e){return function(_0x244aaa,_0x710b2a,_0x447d3a){SmsAccountEvents[_0xd99a('0x5')](_0x1b756e+':'+_0x244aaa['id'],_0x244aaa);SmsAccountEvents['emit'](_0x1b756e,_0x244aaa);_0x447d3a(null);};}for(var e in events){if(events[_0xd99a('0x6')](e)){var event=events[e];SmsAccount[_0xd99a('0x7')](e,emitEvent(event));}}module[_0xd99a('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xb70a=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x282b44,_0x25c866){var _0x22b96e=function(_0x369d51){while(--_0x369d51){_0x282b44['push'](_0x282b44['shift']());}};_0x22b96e(++_0x25c866);}(_0xb70a,0x1c2));var _0xab70=function(_0xcb674c,_0x2d29c2){_0xcb674c=_0xcb674c-0x0;var _0x5a708c=_0xb70a[_0xcb674c];return _0x5a708c;};'use strict';var EventEmitter=require(_0xab70('0x0'));var SmsAccount=require(_0xab70('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xab70('0x2')](0x0);var events={'afterCreate':_0xab70('0x3'),'afterUpdate':_0xab70('0x4'),'afterDestroy':_0xab70('0x5')};function emitEvent(_0x2ce056){return function(_0xa0150e,_0x4a651c,_0x4cf9be){SmsAccountEvents['emit'](_0x2ce056+':'+_0xa0150e['id'],_0xa0150e);SmsAccountEvents['emit'](_0x2ce056,_0xa0150e);_0x4cf9be(null);};}for(var e in events){if(events[_0xab70('0x6')](e)){var event=events[e];SmsAccount[_0xab70('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2c705b4..44462fe 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 _0x5a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x5a6d,0x17f));var _0xd5a6=function(_0x564c66,_0x2f96b6){_0x564c66=_0x564c66-0x0;var _0x42d447=_0x5a6d[_0x564c66];return _0x42d447;};'use strict';var _=require(_0xd5a6('0x0'));var util=require(_0xd5a6('0x1'));var logger=require('../../config/logger')(_0xd5a6('0x2'));var moment=require(_0xd5a6('0x3'));var BPromise=require(_0xd5a6('0x4'));var rp=require(_0xd5a6('0x5'));var fs=require('fs');var path=require(_0xd5a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd5a6('0x7'));var attributes=require('./smsAccount.attributes');module[_0xd5a6('0x8')]=function(_0x903ff5,_0x123ac3){return _0x903ff5[_0xd5a6('0x9')](_0xd5a6('0xa'),attributes,{'tableName':_0xd5a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50f0=['util','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','lodash'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x50f0,0x185));var _0x050f=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x50f0[_0x257495];return _0x3849aa;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var logger=require('../../config/logger')(_0x050f('0x2'));var moment=require(_0x050f('0x3'));var BPromise=require(_0x050f('0x4'));var rp=require(_0x050f('0x5'));var fs=require('fs');var path=require(_0x050f('0x6'));var rimraf=require(_0x050f('0x7'));var config=require('../../config/environment');var attributes=require(_0x050f('0x8'));module[_0x050f('0x9')]=function(_0x398030,_0x5bbc00){return _0x398030['define']('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 41115bb..a1d7b57 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 _0x8c97=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./smsAccount.socket','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','attributes','include','map','model','lodash','util'];(function(_0x33f7b6,_0x8ce322){var _0x2cec9f=function(_0x3a8e0d){while(--_0x3a8e0d){_0x33f7b6['push'](_0x33f7b6['shift']());}};_0x2cec9f(++_0x8ce322);}(_0x8c97,0x170));var _0x78c9=function(_0x1fd45e,_0x4c2336){_0x1fd45e=_0x1fd45e-0x0;var _0x6e5c6e=_0x8c97[_0x1fd45e];return _0x6e5c6e;};'use strict';var _=require(_0x78c9('0x0'));var util=require(_0x78c9('0x1'));var moment=require(_0x78c9('0x2'));var BPromise=require(_0x78c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78c9('0x4'))['db'];var utils=require(_0x78c9('0x5'));var logger=require(_0x78c9('0x6'))(_0x78c9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78c9('0x8')][_0x78c9('0x9')]({'port':0x232a});config[_0x78c9('0xa')]=_[_0x78c9('0xb')](config[_0x78c9('0xa')],{'host':_0x78c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78c9('0xa')]));require(_0x78c9('0xd'))['register'](socket);function respondWithRpcPromise(_0x4dbff2,_0x5b81f4,_0x238402){return new BPromise(function(_0x41d112,_0x4f1e69){return client[_0x78c9('0xe')](_0x4dbff2,_0x238402)[_0x78c9('0xf')](function(_0x46d04e){logger[_0x78c9('0x10')]('SmsAccount,\x20%s,\x20%s',_0x5b81f4,_0x78c9('0x11'));logger[_0x78c9('0x12')](_0x78c9('0x13'),_0x5b81f4,'request\x20sent',JSON[_0x78c9('0x14')](_0x46d04e));if(_0x46d04e['error']){if(_0x46d04e['error'][_0x78c9('0x15')]===0x1f4){logger[_0x78c9('0x16')](_0x78c9('0x17'),_0x5b81f4,_0x46d04e[_0x78c9('0x16')][_0x78c9('0x18')]);return _0x4f1e69(_0x46d04e[_0x78c9('0x16')][_0x78c9('0x18')]);}logger[_0x78c9('0x16')](_0x78c9('0x17'),_0x5b81f4,_0x46d04e[_0x78c9('0x16')]['message']);return _0x41d112(_0x46d04e[_0x78c9('0x16')][_0x78c9('0x18')]);}else{logger[_0x78c9('0x10')](_0x78c9('0x17'),_0x5b81f4,'request\x20sent');_0x41d112(_0x46d04e[_0x78c9('0x19')][_0x78c9('0x18')]);}})[_0x78c9('0x1a')](function(_0x13e4d4){logger[_0x78c9('0x16')]('SmsAccount,\x20%s,\x20%s',_0x5b81f4,_0x13e4d4);_0x4f1e69(_0x13e4d4);});});}exports[_0x78c9('0x1b')]=function(_0x53a94c){var _0x5d84f7=this;return new Promise(function(_0x220806,_0x2f18ef){return db[_0x78c9('0x1c')][_0x78c9('0x1d')]({'raw':_0x53a94c['options']?_0x53a94c['options'][_0x78c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x53a94c[_0x78c9('0x1f')]?_0x53a94c[_0x78c9('0x1f')][_0x78c9('0x20')]||null:null,'attributes':_0x53a94c[_0x78c9('0x1f')]?_0x53a94c[_0x78c9('0x1f')][_0x78c9('0x21')]||null:null,'include':_0x53a94c[_0x78c9('0x1f')]?_0x53a94c[_0x78c9('0x1f')][_0x78c9('0x22')]?_[_0x78c9('0x23')](_0x53a94c[_0x78c9('0x1f')][_0x78c9('0x22')],function(_0x56cace){return{'model':db[_0x56cace['model']],'as':_0x56cace['as'],'attributes':_0x56cace[_0x78c9('0x21')],'include':_0x56cace[_0x78c9('0x22')]?_['map'](_0x56cace[_0x78c9('0x22')],function(_0x137926){return{'model':db[_0x137926[_0x78c9('0x24')]],'as':_0x137926['as'],'attributes':_0x137926[_0x78c9('0x21')],'include':_0x137926[_0x78c9('0x22')]?_[_0x78c9('0x23')](_0x137926[_0x78c9('0x22')],function(_0x1a2ab7){return{'model':db[_0x1a2ab7['model']],'as':_0x1a2ab7['as'],'attributes':_0x1a2ab7['attributes']};}):[]};}):[]};}):[]:[]})[_0x78c9('0xf')](function(_0x148788){logger['info'](_0x78c9('0x1b'),_0x53a94c);logger[_0x78c9('0x12')]('ShowSmsAccount',_0x53a94c,JSON[_0x78c9('0x14')](_0x148788));_0x220806(_0x148788);})[_0x78c9('0x1a')](function(_0x25a7dd){logger['error']('ShowSmsAccount',_0x25a7dd[_0x78c9('0x18')],_0x53a94c);_0x2f18ef(_0x5d84f7['error'](0x1f4,_0x25a7dd[_0x78c9('0x18')]));});});}; \ No newline at end of file +var _0xa1b0=['client','http','redis','defaults','localhost','socket.io-emitter','./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','catch','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x407d1d,_0xed9c70){var _0xcd5457=function(_0x31d076){while(--_0x31d076){_0x407d1d['push'](_0x407d1d['shift']());}};_0xcd5457(++_0xed9c70);}(_0xa1b0,0x18f));var _0x0a1b=function(_0x4c438e,_0x2dbed0){_0x4c438e=_0x4c438e-0x0;var _0x1d4bfa=_0xa1b0[_0x4c438e];return _0x1d4bfa;};'use strict';var _=require(_0x0a1b('0x0'));var util=require('util');var moment=require(_0x0a1b('0x1'));var BPromise=require(_0x0a1b('0x2'));var rs=require(_0x0a1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a1b('0x4'))['db'];var utils=require(_0x0a1b('0x5'));var logger=require(_0x0a1b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a1b('0x7'));var client=jayson[_0x0a1b('0x8')][_0x0a1b('0x9')]({'port':0x232a});config[_0x0a1b('0xa')]=_[_0x0a1b('0xb')](config[_0x0a1b('0xa')],{'host':_0x0a1b('0xc'),'port':0x18eb});var socket=require(_0x0a1b('0xd'))(new Redis(config[_0x0a1b('0xa')]));require(_0x0a1b('0xe'))[_0x0a1b('0xf')](socket);function respondWithRpcPromise(_0x3a805f,_0x33c803,_0x274146){return new BPromise(function(_0x4fc70b,_0x3d25a4){return client[_0x0a1b('0x10')](_0x3a805f,_0x274146)[_0x0a1b('0x11')](function(_0x45f994){logger[_0x0a1b('0x12')](_0x0a1b('0x13'),_0x33c803,_0x0a1b('0x14'));logger[_0x0a1b('0x15')](_0x0a1b('0x16'),_0x33c803,_0x0a1b('0x14'),JSON[_0x0a1b('0x17')](_0x45f994));if(_0x45f994['error']){if(_0x45f994[_0x0a1b('0x18')][_0x0a1b('0x19')]===0x1f4){logger[_0x0a1b('0x18')]('SmsAccount,\x20%s,\x20%s',_0x33c803,_0x45f994[_0x0a1b('0x18')][_0x0a1b('0x1a')]);return _0x3d25a4(_0x45f994[_0x0a1b('0x18')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x33c803,_0x45f994['error'][_0x0a1b('0x1a')]);return _0x4fc70b(_0x45f994[_0x0a1b('0x18')][_0x0a1b('0x1a')]);}else{logger[_0x0a1b('0x12')](_0x0a1b('0x13'),_0x33c803,_0x0a1b('0x14'));_0x4fc70b(_0x45f994['result'][_0x0a1b('0x1a')]);}})[_0x0a1b('0x1b')](function(_0x238c82){logger[_0x0a1b('0x18')](_0x0a1b('0x13'),_0x33c803,_0x238c82);_0x3d25a4(_0x238c82);});});}exports['ShowSmsAccount']=function(_0x5cd6a0){var _0x33ef15=this;return new Promise(function(_0x5d5f5,_0x4117ca){return db[_0x0a1b('0x1c')]['find']({'raw':_0x5cd6a0[_0x0a1b('0x1d')]?_0x5cd6a0[_0x0a1b('0x1d')][_0x0a1b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5cd6a0[_0x0a1b('0x1d')]?_0x5cd6a0[_0x0a1b('0x1d')][_0x0a1b('0x1f')]||null:null,'attributes':_0x5cd6a0[_0x0a1b('0x1d')]?_0x5cd6a0['options'][_0x0a1b('0x20')]||null:null,'include':_0x5cd6a0[_0x0a1b('0x1d')]?_0x5cd6a0[_0x0a1b('0x1d')][_0x0a1b('0x21')]?_[_0x0a1b('0x22')](_0x5cd6a0[_0x0a1b('0x1d')]['include'],function(_0xcb0a71){return{'model':db[_0xcb0a71[_0x0a1b('0x23')]],'as':_0xcb0a71['as'],'attributes':_0xcb0a71['attributes'],'include':_0xcb0a71['include']?_[_0x0a1b('0x22')](_0xcb0a71[_0x0a1b('0x21')],function(_0x2f7945){return{'model':db[_0x2f7945[_0x0a1b('0x23')]],'as':_0x2f7945['as'],'attributes':_0x2f7945[_0x0a1b('0x20')],'include':_0x2f7945[_0x0a1b('0x21')]?_['map'](_0x2f7945[_0x0a1b('0x21')],function(_0x55de7a){return{'model':db[_0x55de7a['model']],'as':_0x55de7a['as'],'attributes':_0x55de7a[_0x0a1b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0a1b('0x11')](function(_0x2422e2){logger[_0x0a1b('0x12')](_0x0a1b('0x24'),_0x5cd6a0);logger[_0x0a1b('0x15')](_0x0a1b('0x24'),_0x5cd6a0,JSON['stringify'](_0x2422e2));_0x5d5f5(_0x2422e2);})['catch'](function(_0x2239bf){logger[_0x0a1b('0x18')](_0x0a1b('0x24'),_0x2239bf['message'],_0x5cd6a0);_0x4117ca(_0x33ef15[_0x0a1b('0x18')](0x1f4,_0x2239bf[_0x0a1b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0f6ff64..f5d7437 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 577238b..51f0cbc 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x42afda,_0x47c4ee){var _0x555335=function(_0x2b89e1){while(--_0x2b89e1){_0x42afda['push'](_0x42afda['shift']());}};_0x555335(++_0x47c4ee);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 87e1f32..4a4b96d 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 _0xcac6=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x447ef1,_0x374cd2){var _0x3d72ec=function(_0x3e10b){while(--_0x3e10b){_0x447ef1['push'](_0x447ef1['shift']());}};_0x3d72ec(++_0x374cd2);}(_0xcac6,0xd2));var _0x6cac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcac6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6cac('0x0'));module['exports']={'priority':{'type':Sequelize[_0x6cac('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6cac('0x2')],'allowNull':![],'defaultValue':_0x6cac('0x3')},'appdata':{'type':Sequelize[_0x6cac('0x4')]()},'description':{'type':Sequelize[_0x6cac('0x2')]},'interval':{'type':Sequelize[_0x6cac('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x28be=['INTEGER','STRING','*,*,*,*','exports'];(function(_0x585936,_0x4bfddb){var _0x283a46=function(_0x244bb7){while(--_0x244bb7){_0x585936['push'](_0x585936['shift']());}};_0x283a46(++_0x4bfddb);}(_0x28be,0x14f));var _0xe28b=function(_0x7f36cd,_0xc6d8f9){_0x7f36cd=_0x7f36cd-0x0;var _0x11217c=_0x28be[_0x7f36cd];return _0x11217c;};'use strict';var Sequelize=require('sequelize');module[_0xe28b('0x0')]={'priority':{'type':Sequelize[_0xe28b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe28b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe28b('0x2')],'defaultValue':_0xe28b('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a88c5f0..160c60f 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 _0x5455=['intersection','attributes','model','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','status','json','apply','update','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','query','filters'];(function(_0x2edb5d,_0x452d44){var _0x58f12a=function(_0x418a17){while(--_0x418a17){_0x2edb5d['push'](_0x2edb5d['shift']());}};_0x58f12a(++_0x452d44);}(_0x5455,0x17a));var _0x5545=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5455[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x5545('0x0'));var rimraf=require(_0x5545('0x1'));var zipdir=require(_0x5545('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5545('0x3'));var moment=require(_0x5545('0x4'));var BPromise=require(_0x5545('0x5'));var Mustache=require(_0x5545('0x6'));var util=require(_0x5545('0x7'));var path=require(_0x5545('0x8'));var sox=require(_0x5545('0x9'));var csv=require(_0x5545('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5545('0xb'));var squel=require(_0x5545('0xc'));var crypto=require('crypto');var jsforce=require(_0x5545('0xd'));var deskjs=require(_0x5545('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5545('0xf'));var Redis=require(_0x5545('0x10'));var authService=require(_0x5545('0x11'));var qs=require(_0x5545('0x12'));var as=require(_0x5545('0x13'));var hardwareService=require(_0x5545('0x14'));var logger=require(_0x5545('0x15'))(_0x5545('0x16'));var utils=require('../../config/utils');var config=require(_0x5545('0x17'));var licenseUtil=require(_0x5545('0x18'));var db=require(_0x5545('0x19'))['db'];function respondWithStatusCode(_0x5a9c32,_0x15e9d0){_0x15e9d0=_0x15e9d0||0xcc;return function(_0xdae68d){if(_0xdae68d){return _0x5a9c32[_0x5545('0x1a')](_0x15e9d0);}return _0x5a9c32['status'](_0x15e9d0)[_0x5545('0x1b')]();};}function respondWithResult(_0x3121c5,_0x1703ff){_0x1703ff=_0x1703ff||0xc8;return function(_0x497571){if(_0x497571){return _0x3121c5['status'](_0x1703ff)['json'](_0x497571);}};}function respondWithFilteredResult(_0x414b0d,_0xe8b63c){return function(_0x102c0c){if(_0x102c0c){var _0x166d42=typeof _0xe8b63c['offset']==='undefined'&&typeof _0xe8b63c[_0x5545('0x1c')]===_0x5545('0x1d');var _0x272b92=_0x102c0c[_0x5545('0x1e')];var _0x356cf3=_0x166d42?0x0:_0xe8b63c[_0x5545('0x1f')];var _0x53a4af=_0x166d42?_0x102c0c[_0x5545('0x1e')]:_0xe8b63c[_0x5545('0x1f')]+_0xe8b63c[_0x5545('0x1c')];var _0x75f6f8;if(_0x53a4af>=_0x272b92){_0x53a4af=_0x272b92;_0x75f6f8=0xc8;}else{_0x75f6f8=0xce;}_0x414b0d[_0x5545('0x20')](_0x75f6f8);return _0x414b0d['set']('Content-Range',_0x356cf3+'-'+_0x53a4af+'/'+_0x272b92)[_0x5545('0x21')](_0x102c0c);}return null;};}function patchUpdates(_0x5f5e07){return function(_0x30c847){try{jsonpatch[_0x5545('0x22')](_0x30c847,_0x5f5e07,!![]);}catch(_0x2d7166){return BPromise['reject'](_0x2d7166);}return _0x30c847['save']();};}function saveUpdates(_0x15f7c9,_0x1e03f1){return function(_0x4eb802){if(_0x4eb802){return _0x4eb802[_0x5545('0x23')](_0x15f7c9)[_0x5545('0x24')](function(_0x14fae0){return _0x14fae0;});}return null;};}function removeEntity(_0x507773,_0x1f9777){return function(_0x141f0b){if(_0x141f0b){return _0x141f0b[_0x5545('0x25')]()[_0x5545('0x24')](function(){_0x507773[_0x5545('0x20')](0xcc)[_0x5545('0x1b')]();});}};}function handleEntityNotFound(_0x3a5f16,_0x9f1992){return function(_0x4ec6dc){if(!_0x4ec6dc){_0x3a5f16['sendStatus'](0x194);}return _0x4ec6dc;};}function handleError(_0x4a2942,_0x47a59d){_0x47a59d=_0x47a59d||0x1f4;return function(_0x2d843c){logger[_0x5545('0x26')](_0x2d843c[_0x5545('0x27')]);if(_0x2d843c[_0x5545('0x28')]){delete _0x2d843c[_0x5545('0x28')];}_0x4a2942[_0x5545('0x20')](_0x47a59d)['send'](_0x2d843c);};}exports['index']=function(_0x568af6,_0x280a37){var _0x2c39a2={},_0x3ad32b={},_0x5869d8={'count':0x0,'rows':[]};var _0x13be3e=_[_0x5545('0x29')](db[_0x5545('0x2a')][_0x5545('0x2b')],function(_0x1adc5d){return{'name':_0x1adc5d[_0x5545('0x2c')],'type':_0x1adc5d[_0x5545('0x2d')]['key']};});_0x3ad32b['model']=_[_0x5545('0x29')](_0x13be3e,_0x5545('0x28'));_0x3ad32b[_0x5545('0x2e')]=_['keys'](_0x568af6[_0x5545('0x2e')]);_0x3ad32b[_0x5545('0x2f')]=_[_0x5545('0x30')](_0x3ad32b['model'],_0x3ad32b[_0x5545('0x2e')]);_0x2c39a2[_0x5545('0x31')]=_[_0x5545('0x30')](_0x3ad32b[_0x5545('0x32')],qs[_0x5545('0x33')](_0x568af6['query'][_0x5545('0x33')]));_0x2c39a2[_0x5545('0x31')]=_0x2c39a2['attributes']['length']?_0x2c39a2[_0x5545('0x31')]:_0x3ad32b[_0x5545('0x32')];if(!_0x568af6[_0x5545('0x2e')]['hasOwnProperty'](_0x5545('0x34'))){_0x2c39a2[_0x5545('0x1c')]=qs[_0x5545('0x1c')](_0x568af6[_0x5545('0x2e')]['limit']);_0x2c39a2[_0x5545('0x1f')]=qs[_0x5545('0x1f')](_0x568af6[_0x5545('0x2e')][_0x5545('0x1f')]);}_0x2c39a2[_0x5545('0x35')]=qs[_0x5545('0x36')](_0x568af6['query']['sort']);_0x2c39a2['where']=qs['filters'](_[_0x5545('0x37')](_0x568af6[_0x5545('0x2e')],_0x3ad32b[_0x5545('0x2f')]),_0x13be3e);if(_0x568af6[_0x5545('0x2e')][_0x5545('0x38')]){_0x2c39a2[_0x5545('0x39')]=_[_0x5545('0x3a')](_0x2c39a2[_0x5545('0x39')],{'$or':_[_0x5545('0x29')](_0x13be3e,function(_0x36a627){if(_0x36a627[_0x5545('0x2d')]!==_0x5545('0x3b')){var _0xeaa20d={};_0xeaa20d[_0x36a627[_0x5545('0x28')]]={'$like':'%'+_0x568af6[_0x5545('0x2e')]['filter']+'%'};return _0xeaa20d;}})});}_0x2c39a2=_[_0x5545('0x3a')]({},_0x2c39a2,_0x568af6[_0x5545('0x3c')]);var _0x405bed={'where':_0x2c39a2[_0x5545('0x39')]};return db[_0x5545('0x2a')][_0x5545('0x1e')](_0x405bed)['then'](function(_0x18d050){_0x5869d8[_0x5545('0x1e')]=_0x18d050;if(_0x568af6[_0x5545('0x2e')][_0x5545('0x3d')]){_0x2c39a2[_0x5545('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0x5545('0x3f')](_0x2c39a2);})[_0x5545('0x24')](function(_0x4127be){_0x5869d8['rows']=_0x4127be;return _0x5869d8;})['then'](respondWithFilteredResult(_0x280a37,_0x2c39a2))[_0x5545('0x40')](handleError(_0x280a37,null));};exports['show']=function(_0xc5764c,_0x3ab816){var _0x1c70a0={'raw':!![],'where':{'id':_0xc5764c[_0x5545('0x41')]['id']}},_0x4e7f00={};_0x4e7f00['model']=_[_0x5545('0x42')](db['SmsApplication'][_0x5545('0x2b')]);_0x4e7f00['query']=_['keys'](_0xc5764c[_0x5545('0x2e')]);_0x4e7f00['filters']=_[_0x5545('0x30')](_0x4e7f00[_0x5545('0x32')],_0x4e7f00[_0x5545('0x2e')]);_0x1c70a0['attributes']=_[_0x5545('0x30')](_0x4e7f00['model'],qs[_0x5545('0x33')](_0xc5764c[_0x5545('0x2e')]['fields']));_0x1c70a0['attributes']=_0x1c70a0[_0x5545('0x31')][_0x5545('0x43')]?_0x1c70a0[_0x5545('0x31')]:_0x4e7f00[_0x5545('0x32')];if(_0xc5764c['query'][_0x5545('0x3d')]){_0x1c70a0[_0x5545('0x3e')]=[{'all':!![]}];}_0x1c70a0=_['merge']({},_0x1c70a0,_0xc5764c[_0x5545('0x3c')]);return db['SmsApplication'][_0x5545('0x44')](_0x1c70a0)['then'](handleEntityNotFound(_0x3ab816,null))[_0x5545('0x24')](respondWithResult(_0x3ab816,null))[_0x5545('0x40')](handleError(_0x3ab816,null));};exports[_0x5545('0x45')]=function(_0x3fec9a,_0xff7488){return db['SmsApplication'][_0x5545('0x45')](_0x3fec9a[_0x5545('0x46')],{})[_0x5545('0x24')](respondWithResult(_0xff7488,0xc9))['catch'](handleError(_0xff7488,null));};exports[_0x5545('0x23')]=function(_0x12d05e,_0x536701){if(_0x12d05e[_0x5545('0x46')]['id']){delete _0x12d05e['body']['id'];}return db[_0x5545('0x2a')][_0x5545('0x44')]({'where':{'id':_0x12d05e[_0x5545('0x41')]['id']}})[_0x5545('0x24')](handleEntityNotFound(_0x536701,null))[_0x5545('0x24')](saveUpdates(_0x12d05e[_0x5545('0x46')],null))[_0x5545('0x24')](respondWithResult(_0x536701,null))[_0x5545('0x40')](handleError(_0x536701,null));};exports[_0x5545('0x25')]=function(_0x18b76c,_0xe32354){return db[_0x5545('0x2a')][_0x5545('0x44')]({'where':{'id':_0x18b76c[_0x5545('0x41')]['id']}})[_0x5545('0x24')](handleEntityNotFound(_0xe32354,null))[_0x5545('0x24')](removeEntity(_0xe32354,null))['catch'](handleError(_0xe32354,null));}; \ No newline at end of file +var _0x023e=['path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','save','update','then','destroy','end','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0x023e,0x8f));var _0xe023=function(_0x4a7ed9,_0x1fd846){_0x4a7ed9=_0x4a7ed9-0x0;var _0xc0941d=_0x023e[_0x4a7ed9];return _0xc0941d;};'use strict';var emlformat=require(_0xe023('0x0'));var rimraf=require(_0xe023('0x1'));var zipdir=require(_0xe023('0x2'));var jsonpatch=require(_0xe023('0x3'));var rp=require(_0xe023('0x4'));var moment=require(_0xe023('0x5'));var BPromise=require(_0xe023('0x6'));var Mustache=require(_0xe023('0x7'));var util=require(_0xe023('0x8'));var path=require(_0xe023('0x9'));var sox=require(_0xe023('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe023('0xb'));var _=require(_0xe023('0xc'));var squel=require('squel');var crypto=require(_0xe023('0xd'));var jsforce=require(_0xe023('0xe'));var deskjs=require(_0xe023('0xf'));var toCsv=require(_0xe023('0x10'));var querystring=require(_0xe023('0x11'));var Papa=require(_0xe023('0x12'));var Redis=require(_0xe023('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe023('0x14'));var as=require(_0xe023('0x15'));var hardwareService=require(_0xe023('0x16'));var logger=require(_0xe023('0x17'))(_0xe023('0x18'));var utils=require('../../config/utils');var config=require(_0xe023('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe023('0x1a'))['db'];function respondWithStatusCode(_0x8b6391,_0x2d9654){_0x2d9654=_0x2d9654||0xcc;return function(_0x4a67bc){if(_0x4a67bc){return _0x8b6391[_0xe023('0x1b')](_0x2d9654);}return _0x8b6391[_0xe023('0x1c')](_0x2d9654)['end']();};}function respondWithResult(_0x43fab6,_0x32679b){_0x32679b=_0x32679b||0xc8;return function(_0x466a2f){if(_0x466a2f){return _0x43fab6[_0xe023('0x1c')](_0x32679b)[_0xe023('0x1d')](_0x466a2f);}};}function respondWithFilteredResult(_0x4904c1,_0x5271f4){return function(_0xbdf1a6){if(_0xbdf1a6){var _0x1c5880=typeof _0x5271f4[_0xe023('0x1e')]===_0xe023('0x1f')&&typeof _0x5271f4['limit']==='undefined';var _0x5401cb=_0xbdf1a6['count'];var _0x3636a9=_0x1c5880?0x0:_0x5271f4[_0xe023('0x1e')];var _0x1778a4=_0x1c5880?_0xbdf1a6[_0xe023('0x20')]:_0x5271f4[_0xe023('0x1e')]+_0x5271f4[_0xe023('0x21')];var _0x5cff97;if(_0x1778a4>=_0x5401cb){_0x1778a4=_0x5401cb;_0x5cff97=0xc8;}else{_0x5cff97=0xce;}_0x4904c1[_0xe023('0x1c')](_0x5cff97);return _0x4904c1['set'](_0xe023('0x22'),_0x3636a9+'-'+_0x1778a4+'/'+_0x5401cb)[_0xe023('0x1d')](_0xbdf1a6);}return null;};}function patchUpdates(_0x439d37){return function(_0x55a49c){try{jsonpatch['apply'](_0x55a49c,_0x439d37,!![]);}catch(_0x4811d7){return BPromise['reject'](_0x4811d7);}return _0x55a49c[_0xe023('0x23')]();};}function saveUpdates(_0x552d53,_0x44ab23){return function(_0xd537f5){if(_0xd537f5){return _0xd537f5[_0xe023('0x24')](_0x552d53)[_0xe023('0x25')](function(_0x19e383){return _0x19e383;});}return null;};}function removeEntity(_0x89d810,_0x3c746f){return function(_0x1c97c9){if(_0x1c97c9){return _0x1c97c9[_0xe023('0x26')]()['then'](function(){_0x89d810[_0xe023('0x1c')](0xcc)[_0xe023('0x27')]();});}};}function handleEntityNotFound(_0xdeb02a,_0x1f055e){return function(_0x38ac24){if(!_0x38ac24){_0xdeb02a[_0xe023('0x1b')](0x194);}return _0x38ac24;};}function handleError(_0xab80d4,_0x57795a){_0x57795a=_0x57795a||0x1f4;return function(_0x160d18){logger[_0xe023('0x28')](_0x160d18['stack']);if(_0x160d18[_0xe023('0x29')]){delete _0x160d18[_0xe023('0x29')];}_0xab80d4[_0xe023('0x1c')](_0x57795a)[_0xe023('0x2a')](_0x160d18);};}exports[_0xe023('0x2b')]=function(_0x1db65b,_0x3874ce){var _0x1ab3b4={},_0x35445c={},_0x382e5e={'count':0x0,'rows':[]};var _0x4d0555=_[_0xe023('0x2c')](db[_0xe023('0x2d')][_0xe023('0x2e')],function(_0x3ddf55){return{'name':_0x3ddf55[_0xe023('0x2f')],'type':_0x3ddf55[_0xe023('0x30')][_0xe023('0x31')]};});_0x35445c[_0xe023('0x32')]=_[_0xe023('0x2c')](_0x4d0555,'name');_0x35445c[_0xe023('0x33')]=_['keys'](_0x1db65b[_0xe023('0x33')]);_0x35445c[_0xe023('0x34')]=_[_0xe023('0x35')](_0x35445c[_0xe023('0x32')],_0x35445c['query']);_0x1ab3b4[_0xe023('0x36')]=_[_0xe023('0x35')](_0x35445c[_0xe023('0x32')],qs[_0xe023('0x37')](_0x1db65b['query'][_0xe023('0x37')]));_0x1ab3b4[_0xe023('0x36')]=_0x1ab3b4[_0xe023('0x36')][_0xe023('0x38')]?_0x1ab3b4[_0xe023('0x36')]:_0x35445c[_0xe023('0x32')];if(!_0x1db65b[_0xe023('0x33')][_0xe023('0x39')](_0xe023('0x3a'))){_0x1ab3b4['limit']=qs['limit'](_0x1db65b[_0xe023('0x33')][_0xe023('0x21')]);_0x1ab3b4[_0xe023('0x1e')]=qs[_0xe023('0x1e')](_0x1db65b[_0xe023('0x33')][_0xe023('0x1e')]);}_0x1ab3b4[_0xe023('0x3b')]=qs[_0xe023('0x3c')](_0x1db65b[_0xe023('0x33')][_0xe023('0x3c')]);_0x1ab3b4[_0xe023('0x3d')]=qs[_0xe023('0x34')](_['pick'](_0x1db65b[_0xe023('0x33')],_0x35445c[_0xe023('0x34')]),_0x4d0555);if(_0x1db65b[_0xe023('0x33')][_0xe023('0x3e')]){_0x1ab3b4['where']=_[_0xe023('0x3f')](_0x1ab3b4[_0xe023('0x3d')],{'$or':_['map'](_0x4d0555,function(_0x4f43ed){if(_0x4f43ed['type']!=='VIRTUAL'){var _0xa29cb7={};_0xa29cb7[_0x4f43ed[_0xe023('0x29')]]={'$like':'%'+_0x1db65b[_0xe023('0x33')][_0xe023('0x3e')]+'%'};return _0xa29cb7;}})});}_0x1ab3b4=_[_0xe023('0x3f')]({},_0x1ab3b4,_0x1db65b['options']);var _0x14f861={'where':_0x1ab3b4['where']};return db['SmsApplication'][_0xe023('0x20')](_0x14f861)['then'](function(_0x2fdde7){_0x382e5e[_0xe023('0x20')]=_0x2fdde7;if(_0x1db65b[_0xe023('0x33')][_0xe023('0x40')]){_0x1ab3b4[_0xe023('0x41')]=[{'all':!![]}];}return db[_0xe023('0x2d')][_0xe023('0x42')](_0x1ab3b4);})[_0xe023('0x25')](function(_0x12e910){_0x382e5e[_0xe023('0x43')]=_0x12e910;return _0x382e5e;})[_0xe023('0x25')](respondWithFilteredResult(_0x3874ce,_0x1ab3b4))[_0xe023('0x44')](handleError(_0x3874ce,null));};exports[_0xe023('0x45')]=function(_0x457d0a,_0x104b1b){var _0x49b835={'raw':!![],'where':{'id':_0x457d0a[_0xe023('0x46')]['id']}},_0x112adc={};_0x112adc[_0xe023('0x32')]=_[_0xe023('0x47')](db['SmsApplication'][_0xe023('0x2e')]);_0x112adc['query']=_[_0xe023('0x47')](_0x457d0a['query']);_0x112adc['filters']=_[_0xe023('0x35')](_0x112adc['model'],_0x112adc[_0xe023('0x33')]);_0x49b835[_0xe023('0x36')]=_[_0xe023('0x35')](_0x112adc['model'],qs[_0xe023('0x37')](_0x457d0a['query'][_0xe023('0x37')]));_0x49b835[_0xe023('0x36')]=_0x49b835['attributes']['length']?_0x49b835[_0xe023('0x36')]:_0x112adc[_0xe023('0x32')];if(_0x457d0a[_0xe023('0x33')][_0xe023('0x40')]){_0x49b835[_0xe023('0x41')]=[{'all':!![]}];}_0x49b835=_[_0xe023('0x3f')]({},_0x49b835,_0x457d0a[_0xe023('0x48')]);return db[_0xe023('0x2d')]['find'](_0x49b835)[_0xe023('0x25')](handleEntityNotFound(_0x104b1b,null))[_0xe023('0x25')](respondWithResult(_0x104b1b,null))['catch'](handleError(_0x104b1b,null));};exports[_0xe023('0x49')]=function(_0x63fef4,_0x4f47d3){return db[_0xe023('0x2d')][_0xe023('0x49')](_0x63fef4[_0xe023('0x4a')],{})[_0xe023('0x25')](respondWithResult(_0x4f47d3,0xc9))[_0xe023('0x44')](handleError(_0x4f47d3,null));};exports[_0xe023('0x24')]=function(_0x5e2b10,_0x191672){if(_0x5e2b10[_0xe023('0x4a')]['id']){delete _0x5e2b10['body']['id'];}return db[_0xe023('0x2d')][_0xe023('0x4b')]({'where':{'id':_0x5e2b10[_0xe023('0x46')]['id']}})['then'](handleEntityNotFound(_0x191672,null))[_0xe023('0x25')](saveUpdates(_0x5e2b10['body'],null))[_0xe023('0x25')](respondWithResult(_0x191672,null))[_0xe023('0x44')](handleError(_0x191672,null));};exports[_0xe023('0x26')]=function(_0x25df0d,_0xdd3480){return db[_0xe023('0x2d')][_0xe023('0x4b')]({'where':{'id':_0x25df0d[_0xe023('0x46')]['id']}})[_0xe023('0x25')](handleEntityNotFound(_0xdd3480,null))[_0xe023('0x25')](removeEntity(_0xdd3480,null))[_0xe023('0x44')](handleError(_0xdd3480,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 90ab002..7e8673e 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 _0x1b3d=['define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./smsApplication.attributes','exports'];(function(_0x28ec85,_0x51e4de){var _0x5d6726=function(_0x15b7c9){while(--_0x15b7c9){_0x28ec85['push'](_0x28ec85['shift']());}};_0x5d6726(++_0x51e4de);}(_0x1b3d,0x1f4));var _0xd1b3=function(_0x3013ee,_0xc1f7e7){_0x3013ee=_0x3013ee-0x0;var _0x5a7c02=_0x1b3d[_0x3013ee];return _0x5a7c02;};'use strict';var _=require(_0xd1b3('0x0'));var util=require(_0xd1b3('0x1'));var logger=require(_0xd1b3('0x2'))(_0xd1b3('0x3'));var moment=require(_0xd1b3('0x4'));var BPromise=require(_0xd1b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1b3('0x6'));var rimraf=require('rimraf');var config=require(_0xd1b3('0x7'));var attributes=require(_0xd1b3('0x8'));module[_0xd1b3('0x9')]=function(_0x532edf,_0x579252){return _0x532edf[_0xd1b3('0xa')](_0xd1b3('0xb'),attributes,{'tableName':_0xd1b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd1b3('0xd'),'collate':_0xd1b3('0xe')});}; \ No newline at end of file +var _0x7985=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','define','sms_applications','utf8mb4_unicode_ci'];(function(_0x4e85e7,_0x4ce1ee){var _0x43207b=function(_0x46eabb){while(--_0x46eabb){_0x4e85e7['push'](_0x4e85e7['shift']());}};_0x43207b(++_0x4ce1ee);}(_0x7985,0x15f));var _0x5798=function(_0x484fae,_0x37c7ed){_0x484fae=_0x484fae-0x0;var _0x2df2a7=_0x7985[_0x484fae];return _0x2df2a7;};'use strict';var _=require(_0x5798('0x0'));var util=require(_0x5798('0x1'));var logger=require(_0x5798('0x2'))(_0x5798('0x3'));var moment=require(_0x5798('0x4'));var BPromise=require(_0x5798('0x5'));var rp=require(_0x5798('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5798('0x7'));var config=require(_0x5798('0x8'));var attributes=require(_0x5798('0x9'));module['exports']=function(_0xaa9884,_0x3ce0ba){return _0xaa9884[_0x5798('0xa')]('SmsApplication',attributes,{'tableName':_0x5798('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5798('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 14f551f..ebb9303 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 _0x4959=['../../config/logger','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4959,0x9b));var _0x9495=function(_0x10aeb2,_0x53e995){_0x10aeb2=_0x10aeb2-0x0;var _0x87d4a8=_0x4959[_0x10aeb2];return _0x87d4a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});} \ No newline at end of file +var _0x5204=['rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5204,0xdf));var _0x4520=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x5204[_0x5c78d9];return _0x69ae1f;};'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);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3b14d3a..d457c8d 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 _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x45dc60,_0x5b6ac7){var _0x3765ba=function(_0x2e9586){while(--_0x2e9586){_0x45dc60['push'](_0x45dc60['shift']());}};_0x3765ba(++_0x5b6ac7);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3b2591,_0x3b2bf9){_0x3b2591=_0x3b2591-0x0;var _0x2ba634=_0xb03e[_0x3b2591];return _0x2ba634;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file +var _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a15a8,_0x56c66c){var _0xee5413=function(_0x1db26c){while(--_0x1db26c){_0x5a15a8['push'](_0x5a15a8['shift']());}};_0xee5413(++_0x56c66c);}(_0xe605,0x92));var _0x5e60=function(_0x49a3a6,_0x400278){_0x49a3a6=_0x49a3a6-0x0;var _0x3cc1cd=_0xe605[_0x49a3a6];return _0x3cc1cd;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1f12fcd..b2a174e 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 _0x4f7a=['STRING','out','INTEGER','exports','BOOLEAN','DATE'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4f7a,0x105));var _0xa4f7=function(_0x4e2659,_0x3949d7){_0x4e2659=_0x4e2659-0x0;var _0x17d81a=_0x4f7a[_0x4e2659];return _0x17d81a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xa4f7('0x0')]={'closed':{'type':Sequelize[_0xa4f7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa4f7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa4f7('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa4f7('0x3')]},'phone':{'type':Sequelize[_0xa4f7('0x3')]},'read1stAt':{'type':Sequelize[_0xa4f7('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa4f7('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa4f7('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa4f7('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa4f7('0x5')]}}; \ No newline at end of file +var _0xe1d7=['STRING','DATE','ENUM','out','BOOLEAN','moment'];(function(_0x49c755,_0x97e34f){var _0x3c750d=function(_0xf86da2){while(--_0xf86da2){_0x49c755['push'](_0x49c755['shift']());}};_0x3c750d(++_0x97e34f);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0xe1d7[_0x37756b];return _0x46efec;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7e1d('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7e1d('0x1')]},'secondDisposition':{'type':Sequelize[_0x7e1d('0x1')]},'thirdDisposition':{'type':Sequelize[_0x7e1d('0x1')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7e1d('0x1')]},'read1stAt':{'type':Sequelize[_0x7e1d('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7e1d('0x3')]('in',_0x7e1d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7e1d('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7e1d('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7e1d('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 717b895..299d8cf 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 _0x562f=['ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','sms','query','catch','params','model','keys','SmsInteraction','filters','attributes','intersection','length','includeAll','include','merge','options','find','create','body','describe','SmsMessage','addMessage','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','ids','omit','color','emit','smsInteractionTags:save','removeTags','unix','root','files','tmp','join','format','push','User','fullname','CmContact','Contact','firstName','lastName','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','createdAt','toString','closed','closedAt','disposition','out','System','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path'];(function(_0x4bde49,_0x3002e3){var _0x3178c8=function(_0x483732){while(--_0x483732){_0x4bde49['push'](_0x4bde49['shift']());}};_0x3178c8(++_0x3002e3);}(_0x562f,0x1d6));var _0xf562=function(_0xf53937,_0x2bf512){_0xf53937=_0xf53937-0x0;var _0x33b67b=_0x562f[_0xf53937];return _0x33b67b;};'use strict';var rimraf=require(_0xf562('0x0'));var zipdir=require(_0xf562('0x1'));var moment=require(_0xf562('0x2'));var BPromise=require(_0xf562('0x3'));var util=require(_0xf562('0x4'));var path=require(_0xf562('0x5'));var ejs=require(_0xf562('0x6'));var fs=require('fs');var _=require(_0xf562('0x7'));var Redis=require(_0xf562('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xf562('0x9'));var pdf=require(_0xf562('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xf562('0xb'));var db=require('../../mysqldb')['db'];config[_0xf562('0xc')]=_[_0xf562('0xd')](config[_0xf562('0xc')],{'host':_0xf562('0xe'),'port':0x18eb});var socket=require(_0xf562('0xf'))(new Redis(config[_0xf562('0xc')]));require(_0xf562('0x10'))[_0xf562('0x11')](socket);function respondWithStatusCode(_0x2ae1da,_0x1446fa){_0x1446fa=_0x1446fa||0xcc;return function(_0x21b37c){if(_0x21b37c){return _0x2ae1da['sendStatus'](_0x1446fa);}return _0x2ae1da[_0xf562('0x12')](_0x1446fa)[_0xf562('0x13')]();};}function respondWithResult(_0x3c024c,_0x32c94c){_0x32c94c=_0x32c94c||0xc8;return function(_0xd4f1dd){if(_0xd4f1dd){return _0x3c024c[_0xf562('0x12')](_0x32c94c)[_0xf562('0x14')](_0xd4f1dd);}};}function respondWithFilteredResult(_0x51b83d,_0x403543){return function(_0x52adbb){if(_0x52adbb){var _0x3118c7=typeof _0x403543['offset']===_0xf562('0x15')&&typeof _0x403543[_0xf562('0x16')]==='undefined';var _0x47638b=_0x52adbb[_0xf562('0x17')];var _0x33814d=_0x3118c7?0x0:_0x403543[_0xf562('0x18')];var _0x2c2869=_0x3118c7?_0x52adbb[_0xf562('0x17')]:_0x403543['offset']+_0x403543['limit'];var _0x194067;if(_0x2c2869>=_0x47638b){_0x2c2869=_0x47638b;_0x194067=0xc8;}else{_0x194067=0xce;}_0x51b83d[_0xf562('0x12')](_0x194067);return _0x51b83d[_0xf562('0x19')]('Content-Range',_0x33814d+'-'+_0x2c2869+'/'+_0x47638b)[_0xf562('0x14')](_0x52adbb);}return null;};}function saveUpdates(_0x4e8b3b){return function(_0x293891){if(_0x293891){return _0x293891[_0xf562('0x1a')](_0x4e8b3b)[_0xf562('0x1b')](function(_0x55904c){return _0x55904c;});}return null;};}function removeEntity(_0x16cde3){return function(_0x38f75f){if(_0x38f75f){return _0x38f75f[_0xf562('0x1c')]()[_0xf562('0x1b')](function(){_0x16cde3['status'](0xcc)[_0xf562('0x13')]();});}};}function handleEntityNotFound(_0x349075){return function(_0x12da79){if(!_0x12da79){_0x349075[_0xf562('0x1d')](0x194);}return _0x12da79;};}function handleError(_0xc23fe8,_0x4cfefc){_0x4cfefc=_0x4cfefc||0x1f4;return function(_0x5a46d7){logger[_0xf562('0x1e')](_0x5a46d7[_0xf562('0x1f')]);if(_0x5a46d7[_0xf562('0x20')]){delete _0x5a46d7[_0xf562('0x20')];}_0xc23fe8['status'](_0x4cfefc)[_0xf562('0x21')](_0x5a46d7);};}exports['index']=function(_0x285b88,_0x8a346b){var _0x1a69f0={};var _0x49ea85=_[_0xf562('0x22')](db['SmsInteraction'][_0xf562('0x23')],function(_0x236681){return{'name':_0x236681['fieldName'],'type':_0x236681[_0xf562('0x24')][_0xf562('0x25')]};});_0x1a69f0=qs['getOptions'](_0x49ea85,_0x285b88);return interaction['findAll'](_0xf562('0x26'),_0x285b88[_0xf562('0x27')],_0x285b88['user'],_0x1a69f0,_0x49ea85)[_0xf562('0x1b')](respondWithFilteredResult(_0x8a346b,_0x1a69f0))[_0xf562('0x28')](handleError(_0x8a346b,null));};exports['show']=function(_0x43705d,_0x29c187){var _0x2bfccd={'raw':![],'where':{'id':_0x43705d[_0xf562('0x29')]['id']}},_0x5945ca={};_0x5945ca[_0xf562('0x2a')]=_[_0xf562('0x2b')](db[_0xf562('0x2c')][_0xf562('0x23')]);_0x5945ca[_0xf562('0x27')]=_['keys'](_0x43705d[_0xf562('0x27')]);_0x5945ca[_0xf562('0x2d')]=_['intersection'](_0x5945ca['model'],_0x5945ca[_0xf562('0x27')]);_0x2bfccd[_0xf562('0x2e')]=_[_0xf562('0x2f')](_0x5945ca[_0xf562('0x2a')],qs['fields'](_0x43705d['query']['fields']));_0x2bfccd[_0xf562('0x2e')]=_0x2bfccd['attributes'][_0xf562('0x30')]?_0x2bfccd[_0xf562('0x2e')]:_0x5945ca['model'];if(_0x43705d[_0xf562('0x27')][_0xf562('0x31')]){_0x2bfccd[_0xf562('0x32')]=[{'all':!![]}];}_0x2bfccd=_[_0xf562('0x33')]({},_0x2bfccd,_0x43705d[_0xf562('0x34')]);return db[_0xf562('0x2c')][_0xf562('0x35')](_0x2bfccd)['then'](handleEntityNotFound(_0x29c187,null))[_0xf562('0x1b')](respondWithResult(_0x29c187,null))['catch'](handleError(_0x29c187,null));};exports[_0xf562('0x36')]=function(_0x1ebbcf,_0x4a0aff){return db['SmsInteraction'][_0xf562('0x36')](_0x1ebbcf[_0xf562('0x37')],{})[_0xf562('0x1b')](respondWithResult(_0x4a0aff,0xc9))[_0xf562('0x28')](handleError(_0x4a0aff,null));};exports[_0xf562('0x1a')]=function(_0x107169,_0x5b212a){if(_0x107169['body']['id']){delete _0x107169[_0xf562('0x37')]['id'];}return db[_0xf562('0x2c')][_0xf562('0x35')]({'where':{'id':_0x107169[_0xf562('0x29')]['id']}})['then'](handleEntityNotFound(_0x5b212a,null))[_0xf562('0x1b')](saveUpdates(_0x107169[_0xf562('0x37')],null))[_0xf562('0x1b')](respondWithResult(_0x5b212a,null))[_0xf562('0x28')](handleError(_0x5b212a,null));};exports['destroy']=function(_0x2b8a3f,_0x32c6cc){return db[_0xf562('0x2c')]['find']({'where':{'id':_0x2b8a3f[_0xf562('0x29')]['id']}})[_0xf562('0x1b')](handleEntityNotFound(_0x32c6cc,null))[_0xf562('0x1b')](removeEntity(_0x32c6cc,null))['catch'](handleError(_0x32c6cc,null));};exports[_0xf562('0x38')]=function(_0x19cd9f,_0x2e8d91){return db[_0xf562('0x2c')][_0xf562('0x38')]()[_0xf562('0x1b')](respondWithResult(_0x2e8d91,null))['catch'](handleError(_0x2e8d91,null));};exports['addMessage']=function(_0x1f3f15,_0x4535bf){return db[_0xf562('0x39')]['find']({'where':{'id':_0x1f3f15[_0xf562('0x29')]['id']}})[_0xf562('0x1b')](handleEntityNotFound(_0x4535bf,null))[_0xf562('0x1b')](function(_0x579d03){if(_0x579d03){return _0x579d03[_0xf562('0x3a')](_0x1f3f15[_0xf562('0x37')]['ids'],_['omit'](_0x1f3f15[_0xf562('0x37')],['ids','id'])||{});}})[_0xf562('0x1b')](respondWithResult(_0x4535bf,null))['catch'](handleError(_0x4535bf,null));};exports[_0xf562('0x3b')]=function(_0x540ceb,_0x36154f){var _0x4dcc90={'raw':![],'where':{}};var _0x5c8d6b={};var _0x5f12fb={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x540ceb[_0xf562('0x29')]['id']}})['then'](handleEntityNotFound(_0x36154f,null))[_0xf562('0x1b')](function(_0x3f87bb){if(_0x3f87bb){_0x5c8d6b[_0xf562('0x2a')]=_[_0xf562('0x2b')](db['SmsMessage'][_0xf562('0x23')]);_0x5c8d6b['query']=_[_0xf562('0x2b')](_0x540ceb['query']);_0x5c8d6b[_0xf562('0x2d')]=_[_0xf562('0x2f')](_0x5c8d6b['model'],_0x5c8d6b[_0xf562('0x27')]);_0x4dcc90[_0xf562('0x2e')]=_['intersection'](_0x5c8d6b[_0xf562('0x2a')],qs[_0xf562('0x3c')](_0x540ceb[_0xf562('0x27')][_0xf562('0x3c')]));_0x4dcc90[_0xf562('0x2e')]=_0x4dcc90[_0xf562('0x2e')][_0xf562('0x30')]?_0x4dcc90[_0xf562('0x2e')]:_0x5c8d6b[_0xf562('0x2a')];if(!_0x540ceb[_0xf562('0x27')][_0xf562('0x3d')](_0xf562('0x3e'))){_0x4dcc90['limit']=qs[_0xf562('0x16')](_0x540ceb['query'][_0xf562('0x16')]);_0x4dcc90[_0xf562('0x18')]=qs[_0xf562('0x18')](_0x540ceb[_0xf562('0x27')][_0xf562('0x18')]);}_0x4dcc90[_0xf562('0x3f')]=qs[_0xf562('0x40')](_0x540ceb[_0xf562('0x27')][_0xf562('0x40')]);_0x4dcc90[_0xf562('0x41')]=qs['filters'](_[_0xf562('0x42')](_0x540ceb[_0xf562('0x27')],_0x5c8d6b[_0xf562('0x2d')]));_0x4dcc90[_0xf562('0x41')]['SmsInteractionId']=_0x3f87bb['id'];if(_0x540ceb[_0xf562('0x27')][_0xf562('0x43')]){_0x4dcc90[_0xf562('0x41')]=_['merge'](_0x4dcc90[_0xf562('0x41')],{'$or':_[_0xf562('0x22')](_0x4dcc90[_0xf562('0x2e')],function(_0x652c93){var _0x160730={};_0x160730[_0x652c93]={'$like':'%'+_0x540ceb[_0xf562('0x27')][_0xf562('0x43')]+'%'};return _0x160730;})});}if(_0x540ceb[_0xf562('0x27')][_0xf562('0x44')]){var _0x179a6b=_0x540ceb[_0xf562('0x27')][_0xf562('0x44')][_0xf562('0x45')](',');var _0x3348cb={};_0x3348cb[_0x179a6b[0x0]]={'$gte':moment(_0x179a6b[0x1])['format'](_0xf562('0x46'))};_0x4dcc90[_0xf562('0x41')]=_['merge'](_0x4dcc90['where'],_0x3348cb);}_0x4dcc90=_[_0xf562('0x33')]({},_0x4dcc90,_0x540ceb['options']);return db['SmsMessage'][_0xf562('0x17')]({'where':_0x4dcc90['where']})[_0xf562('0x1b')](function(_0x346f2a){_0x5f12fb[_0xf562('0x17')]=_0x346f2a;if(_0x540ceb[_0xf562('0x27')]['includeAll']){_0x4dcc90[_0xf562('0x32')]=[{'all':!![]}];}return db['SmsMessage'][_0xf562('0x47')](_0x4dcc90);})['then'](function(_0xbb1734){_0x5f12fb[_0xf562('0x48')]=_0xbb1734;return _0x5f12fb;});}})[_0xf562('0x1b')](respondWithFilteredResult(_0x36154f,_0x4dcc90))['catch'](handleError(_0x36154f,null));};exports[_0xf562('0x49')]=function(_0x138265,_0xbaf3b8){return db[_0xf562('0x2c')][_0xf562('0x35')]({'where':{'id':_0x138265[_0xf562('0x29')]['id']}})[_0xf562('0x1b')](handleEntityNotFound(_0xbaf3b8,null))[_0xf562('0x1b')](function(_0x48f82d){if(_0x48f82d){return _0x48f82d[_0xf562('0x4a')](_0x138265[_0xf562('0x37')][_0xf562('0x4b')],_[_0xf562('0x4c')](_0x138265[_0xf562('0x37')],[_0xf562('0x4b'),'id'])||{})['spread'](function(){return db['Tag'][_0xf562('0x47')]({'attributes':['id',_0xf562('0x20'),_0xf562('0x4d')],'where':{'id':_0x138265[_0xf562('0x37')][_0xf562('0x4b')]}});})[_0xf562('0x1b')](function(_0x41b4ae){socket[_0xf562('0x4e')](_0xf562('0x4f'),{'id':Number(_0x138265['params']['id']),'tags':_0x41b4ae||[]});return{'id':Number(_0x138265[_0xf562('0x29')]['id']),'tags':_0x41b4ae||[]};});}})[_0xf562('0x1b')](respondWithResult(_0xbaf3b8,null))[_0xf562('0x28')](handleError(_0xbaf3b8,null));};exports['removeTags']=function(_0x6b1787,_0x66b2d8){return db['SmsInteraction']['find']({'where':{'id':_0x6b1787['params']['id']}})[_0xf562('0x1b')](handleEntityNotFound(_0x66b2d8,null))['then'](function(_0x17f808){if(_0x17f808){return _0x17f808[_0xf562('0x50')](_0x6b1787[_0xf562('0x27')][_0xf562('0x4b')]);}})['then'](respondWithStatusCode(_0x66b2d8,null))[_0xf562('0x28')](handleError(_0x66b2d8,null));};exports['download']=function(_0x5d3197,_0x1029e8){var _0x30f107=moment()[_0xf562('0x51')]()['toString']();var _0x557ada=path['join'](config[_0xf562('0x52')],'server',_0xf562('0x53'),_0xf562('0x54'));var _0x30fa7a=path[_0xf562('0x55')](_0x557ada,_0x30f107);var _0x54c06e=util[_0xf562('0x56')]('transcript-%d-%s.zip',_0x5d3197[_0xf562('0x29')]['id'],_0x30f107);var _0x2cff92=path[_0xf562('0x55')](_0x557ada,_0x54c06e);var _0x1aabfb=[];_0x1aabfb[_0xf562('0x57')]({'model':db[_0xf562('0x58')],'as':_0xf562('0x58'),'attributes':['id',_0xf562('0x59')],'raw':!![]});_0x1aabfb[_0xf562('0x57')]({'model':db[_0xf562('0x5a')],'as':_0xf562('0x5b'),'attributes':['id',_0xf562('0x5c'),_0xf562('0x5d')],'raw':!![]});var _0xdf8a84=[{'model':db[_0xf562('0x39')],'as':'Messages','attributes':['id',_0xf562('0x37'),'createdAt',_0xf562('0x5e'),_0xf562('0x5f'),_0xf562('0x60')],'include':_0x1aabfb}];_0xdf8a84['push']({'model':db[_0xf562('0x61')],'as':_0xf562('0x62'),'attributes':['id',_0xf562('0x20')]});_0xdf8a84[_0xf562('0x57')]({'model':db['User'],'as':_0xf562('0x63'),'attributes':['id','fullname']});return db[_0xf562('0x2c')]['find']({'where':{'id':_0x5d3197['params']['id']},'include':_0xdf8a84})[_0xf562('0x1b')](handleEntityNotFound(_0x1029e8,null))['then'](function(_0xdb730){if(_0xdb730){var _0x20f5ba=_0xdb730[_0xf562('0x64')]({'plain':!![]});fs[_0xf562('0x65')](_0x30fa7a);var _0x351a39={'channel':_0xf562('0x66'),'account':_0x20f5ba['Account'][_0xf562('0x20')],'agent':_0x20f5ba[_0xf562('0x63')]?_0x20f5ba[_0xf562('0x63')][_0xf562('0x59')]:'N.A.','createdAt':moment(_0x20f5ba[_0xf562('0x67')])['format'](_0xf562('0x46'))[_0xf562('0x68')](),'closedAt':_0x20f5ba[_0xf562('0x69')]?moment(_0x20f5ba[_0xf562('0x6a')])[_0xf562('0x56')](_0xf562('0x46'))[_0xf562('0x68')]():'','disposition':_0x20f5ba[_0xf562('0x6b')],'messages':_(_0x20f5ba['Messages'])[_0xf562('0x43')]({'secret':![]})[_0xf562('0x22')](function(_0x25b17c){return{'date':moment(_0x25b17c['createdAt'])[_0xf562('0x56')](_0xf562('0x46'))[_0xf562('0x68')](),'sender':_0x25b17c['direction']===_0xf562('0x6c')?_0x25b17c['User']?_0x25b17c[_0xf562('0x58')]['fullname']:_0xf562('0x6d'):_0x25b17c[_0xf562('0x5b')]['firstName']+(_0x25b17c['Contact'][_0xf562('0x5d')]?'\x20'+_0x25b17c['Contact'][_0xf562('0x5d')]:''),'body':_0x25b17c[_0xf562('0x37')],'direction':_0x25b17c[_0xf562('0x5e')]===_0xf562('0x6c')?'A':'C','secret':_0x25b17c['secret'],'read':_0x25b17c[_0xf562('0x60')]};})['value']()};return ejs[_0xf562('0x6e')](path['join'](config[_0xf562('0x52')],_0xf562('0x6f'),_0xf562('0x70'),_0xf562('0x71')),{'interaction':_0x351a39})[_0xf562('0x1b')](function(_0x1e35a6){var _0x3e8bf6=path['join'](_0x30fa7a,_0xf562('0x72')+_0x20f5ba['id']+'-'+_0x30f107+_0xf562('0x73'));var _0x22bc4a={'path':_0x3e8bf6,'channel':'Sms','interactionId':_0x20f5ba['id']};return pdf[_0xf562('0x74')](_0x1e35a6,_0x22bc4a);})[_0xf562('0x1b')](function(){return new BPromise(function(_0x32a5f3,_0x16a93b){zipdir(_0x30fa7a,{'saveTo':_0x2cff92},function(_0x258a01,_0x311799){if(_0x258a01)return _0x16a93b(_0x258a01);return _0x32a5f3(_0x311799);});})[_0xf562('0x1b')](function(){return new BPromise(function(_0x394d71,_0x2e1cd7){rimraf(_0x30fa7a,function(_0x49f3c4){if(_0x49f3c4)_0x2e1cd7(_0x49f3c4);return _0x394d71();});});})[_0xf562('0x1b')](function(){return _0x1029e8['download'](_0x2cff92,_0x54c06e,function(_0x644b0){if(_0x644b0){console[_0xf562('0x75')]('err',_0x644b0);}else{fs[_0xf562('0x76')](_0x2cff92);}});});});}else{return _0x1029e8[_0xf562('0x1d')](0xc8);}})['catch'](handleError(_0x1029e8,null));}; \ No newline at end of file +var _0x3855=['where','filter','$gte','split','format','include','setTags','ids','spread','Tag','color','emit','removeTags','download','unix','toString','server','files','join','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','Messages','createdAt','secret','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','direction','out','read','root','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','index','map','SmsInteraction','rawAttributes','type','findAll','sms','catch','show','params','keys','model','attributes','intersection','fields','query','length','includeAll','merge','options','find','create','body','describe','SmsMessage','addMessage','omit','getMessages','filters','nolimit','order','sort','pick'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3855,0x9f));var _0x5385=function(_0x3d1a7d,_0x1aeb16){_0x3d1a7d=_0x3d1a7d-0x0;var _0x1183f3=_0x3855[_0x3d1a7d];return _0x1183f3;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x5385('0x0'));var util=require(_0x5385('0x1'));var path=require(_0x5385('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5385('0x3'));var Redis=require('ioredis');var interaction=require(_0x5385('0x4'));var qs=require(_0x5385('0x5'));var pdf=require(_0x5385('0x6'));var logger=require(_0x5385('0x7'))(_0x5385('0x8'));var config=require(_0x5385('0x9'));var db=require(_0x5385('0xa'))['db'];config['redis']=_[_0x5385('0xb')](config[_0x5385('0xc')],{'host':_0x5385('0xd'),'port':0x18eb});var socket=require(_0x5385('0xe'))(new Redis(config[_0x5385('0xc')]));require(_0x5385('0xf'))[_0x5385('0x10')](socket);function respondWithStatusCode(_0x51551b,_0x467d2b){_0x467d2b=_0x467d2b||0xcc;return function(_0x450317){if(_0x450317){return _0x51551b[_0x5385('0x11')](_0x467d2b);}return _0x51551b['status'](_0x467d2b)[_0x5385('0x12')]();};}function respondWithResult(_0x5307d5,_0x28c004){_0x28c004=_0x28c004||0xc8;return function(_0x3eb353){if(_0x3eb353){return _0x5307d5[_0x5385('0x13')](_0x28c004)[_0x5385('0x14')](_0x3eb353);}};}function respondWithFilteredResult(_0x3e36fb,_0x274966){return function(_0x40cc43){if(_0x40cc43){var _0x1a53a5=typeof _0x274966[_0x5385('0x15')]===_0x5385('0x16')&&typeof _0x274966[_0x5385('0x17')]===_0x5385('0x16');var _0x481950=_0x40cc43[_0x5385('0x18')];var _0x1a0270=_0x1a53a5?0x0:_0x274966[_0x5385('0x15')];var _0x101a54=_0x1a53a5?_0x40cc43[_0x5385('0x18')]:_0x274966['offset']+_0x274966[_0x5385('0x17')];var _0x25ac1e;if(_0x101a54>=_0x481950){_0x101a54=_0x481950;_0x25ac1e=0xc8;}else{_0x25ac1e=0xce;}_0x3e36fb[_0x5385('0x13')](_0x25ac1e);return _0x3e36fb['set'](_0x5385('0x19'),_0x1a0270+'-'+_0x101a54+'/'+_0x481950)[_0x5385('0x14')](_0x40cc43);}return null;};}function saveUpdates(_0x5af25c){return function(_0x2ee6c5){if(_0x2ee6c5){return _0x2ee6c5[_0x5385('0x1a')](_0x5af25c)[_0x5385('0x1b')](function(_0x4b18f6){return _0x4b18f6;});}return null;};}function removeEntity(_0x229b7a){return function(_0x567250){if(_0x567250){return _0x567250[_0x5385('0x1c')]()[_0x5385('0x1b')](function(){_0x229b7a[_0x5385('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f5c0){return function(_0x492dcf){if(!_0x492dcf){_0x48f5c0[_0x5385('0x11')](0x194);}return _0x492dcf;};}function handleError(_0x5d34e4,_0x37fea8){_0x37fea8=_0x37fea8||0x1f4;return function(_0x5b6ff4){logger[_0x5385('0x1d')](_0x5b6ff4[_0x5385('0x1e')]);if(_0x5b6ff4[_0x5385('0x1f')]){delete _0x5b6ff4[_0x5385('0x1f')];}_0x5d34e4[_0x5385('0x13')](_0x37fea8)['send'](_0x5b6ff4);};}exports[_0x5385('0x20')]=function(_0x3ed7d3,_0x2cff37){var _0x44d128={};var _0x3afc28=_[_0x5385('0x21')](db[_0x5385('0x22')][_0x5385('0x23')],function(_0x58fb0d){return{'name':_0x58fb0d['fieldName'],'type':_0x58fb0d[_0x5385('0x24')]['key']};});_0x44d128=qs['getOptions'](_0x3afc28,_0x3ed7d3);return interaction[_0x5385('0x25')](_0x5385('0x26'),_0x3ed7d3['query'],_0x3ed7d3['user'],_0x44d128,_0x3afc28)[_0x5385('0x1b')](respondWithFilteredResult(_0x2cff37,_0x44d128))[_0x5385('0x27')](handleError(_0x2cff37,null));};exports[_0x5385('0x28')]=function(_0x1127f1,_0x2120d4){var _0x46e7ca={'raw':![],'where':{'id':_0x1127f1[_0x5385('0x29')]['id']}},_0x5296f3={};_0x5296f3['model']=_['keys'](db[_0x5385('0x22')][_0x5385('0x23')]);_0x5296f3['query']=_[_0x5385('0x2a')](_0x1127f1['query']);_0x5296f3['filters']=_['intersection'](_0x5296f3[_0x5385('0x2b')],_0x5296f3['query']);_0x46e7ca[_0x5385('0x2c')]=_[_0x5385('0x2d')](_0x5296f3[_0x5385('0x2b')],qs[_0x5385('0x2e')](_0x1127f1[_0x5385('0x2f')]['fields']));_0x46e7ca[_0x5385('0x2c')]=_0x46e7ca[_0x5385('0x2c')][_0x5385('0x30')]?_0x46e7ca[_0x5385('0x2c')]:_0x5296f3['model'];if(_0x1127f1[_0x5385('0x2f')][_0x5385('0x31')]){_0x46e7ca['include']=[{'all':!![]}];}_0x46e7ca=_[_0x5385('0x32')]({},_0x46e7ca,_0x1127f1[_0x5385('0x33')]);return db[_0x5385('0x22')][_0x5385('0x34')](_0x46e7ca)[_0x5385('0x1b')](handleEntityNotFound(_0x2120d4,null))[_0x5385('0x1b')](respondWithResult(_0x2120d4,null))['catch'](handleError(_0x2120d4,null));};exports[_0x5385('0x35')]=function(_0x4b7699,_0x5ad446){return db[_0x5385('0x22')][_0x5385('0x35')](_0x4b7699[_0x5385('0x36')],{})[_0x5385('0x1b')](respondWithResult(_0x5ad446,0xc9))[_0x5385('0x27')](handleError(_0x5ad446,null));};exports['update']=function(_0x457549,_0x181440){if(_0x457549['body']['id']){delete _0x457549[_0x5385('0x36')]['id'];}return db[_0x5385('0x22')][_0x5385('0x34')]({'where':{'id':_0x457549[_0x5385('0x29')]['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x181440,null))[_0x5385('0x1b')](saveUpdates(_0x457549[_0x5385('0x36')],null))[_0x5385('0x1b')](respondWithResult(_0x181440,null))[_0x5385('0x27')](handleError(_0x181440,null));};exports[_0x5385('0x1c')]=function(_0x435131,_0x1fd18c){return db[_0x5385('0x22')]['find']({'where':{'id':_0x435131[_0x5385('0x29')]['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x1fd18c,null))[_0x5385('0x1b')](removeEntity(_0x1fd18c,null))['catch'](handleError(_0x1fd18c,null));};exports[_0x5385('0x37')]=function(_0x2347c1,_0x4fc9a1){return db[_0x5385('0x22')][_0x5385('0x37')]()[_0x5385('0x1b')](respondWithResult(_0x4fc9a1,null))[_0x5385('0x27')](handleError(_0x4fc9a1,null));};exports['addMessage']=function(_0x1f5b84,_0x5b160b){return db[_0x5385('0x38')][_0x5385('0x34')]({'where':{'id':_0x1f5b84[_0x5385('0x29')]['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x5b160b,null))[_0x5385('0x1b')](function(_0x3af727){if(_0x3af727){return _0x3af727[_0x5385('0x39')](_0x1f5b84['body']['ids'],_[_0x5385('0x3a')](_0x1f5b84['body'],['ids','id'])||{});}})[_0x5385('0x1b')](respondWithResult(_0x5b160b,null))['catch'](handleError(_0x5b160b,null));};exports[_0x5385('0x3b')]=function(_0x310447,_0x7bbe8b){var _0x5d6581={'raw':![],'where':{}};var _0x4ae52d={};var _0x509d67={'count':0x0,'rows':[]};return db[_0x5385('0x22')]['findOne']({'where':{'id':_0x310447[_0x5385('0x29')]['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x7bbe8b,null))[_0x5385('0x1b')](function(_0x189170){if(_0x189170){_0x4ae52d[_0x5385('0x2b')]=_[_0x5385('0x2a')](db[_0x5385('0x38')]['rawAttributes']);_0x4ae52d[_0x5385('0x2f')]=_[_0x5385('0x2a')](_0x310447[_0x5385('0x2f')]);_0x4ae52d[_0x5385('0x3c')]=_[_0x5385('0x2d')](_0x4ae52d[_0x5385('0x2b')],_0x4ae52d[_0x5385('0x2f')]);_0x5d6581[_0x5385('0x2c')]=_[_0x5385('0x2d')](_0x4ae52d['model'],qs[_0x5385('0x2e')](_0x310447[_0x5385('0x2f')]['fields']));_0x5d6581[_0x5385('0x2c')]=_0x5d6581[_0x5385('0x2c')][_0x5385('0x30')]?_0x5d6581[_0x5385('0x2c')]:_0x4ae52d[_0x5385('0x2b')];if(!_0x310447[_0x5385('0x2f')]['hasOwnProperty'](_0x5385('0x3d'))){_0x5d6581['limit']=qs['limit'](_0x310447[_0x5385('0x2f')][_0x5385('0x17')]);_0x5d6581[_0x5385('0x15')]=qs[_0x5385('0x15')](_0x310447[_0x5385('0x2f')][_0x5385('0x15')]);}_0x5d6581[_0x5385('0x3e')]=qs[_0x5385('0x3f')](_0x310447[_0x5385('0x2f')][_0x5385('0x3f')]);_0x5d6581['where']=qs[_0x5385('0x3c')](_[_0x5385('0x40')](_0x310447['query'],_0x4ae52d[_0x5385('0x3c')]));_0x5d6581[_0x5385('0x41')]['SmsInteractionId']=_0x189170['id'];if(_0x310447[_0x5385('0x2f')]['filter']){_0x5d6581[_0x5385('0x41')]=_[_0x5385('0x32')](_0x5d6581[_0x5385('0x41')],{'$or':_[_0x5385('0x21')](_0x5d6581[_0x5385('0x2c')],function(_0x49a6b6){var _0xc53de4={};_0xc53de4[_0x49a6b6]={'$like':'%'+_0x310447[_0x5385('0x2f')][_0x5385('0x42')]+'%'};return _0xc53de4;})});}if(_0x310447[_0x5385('0x2f')]['$gte']){var _0x1ec741=_0x310447[_0x5385('0x2f')][_0x5385('0x43')][_0x5385('0x44')](',');var _0x1fec0e={};_0x1fec0e[_0x1ec741[0x0]]={'$gte':moment(_0x1ec741[0x1])[_0x5385('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5d6581['where']=_[_0x5385('0x32')](_0x5d6581['where'],_0x1fec0e);}_0x5d6581=_['merge']({},_0x5d6581,_0x310447[_0x5385('0x33')]);return db[_0x5385('0x38')][_0x5385('0x18')]({'where':_0x5d6581[_0x5385('0x41')]})[_0x5385('0x1b')](function(_0x126f27){_0x509d67[_0x5385('0x18')]=_0x126f27;if(_0x310447[_0x5385('0x2f')]['includeAll']){_0x5d6581[_0x5385('0x46')]=[{'all':!![]}];}return db[_0x5385('0x38')][_0x5385('0x25')](_0x5d6581);})['then'](function(_0x2e1a03){_0x509d67['rows']=_0x2e1a03;return _0x509d67;});}})[_0x5385('0x1b')](respondWithFilteredResult(_0x7bbe8b,_0x5d6581))[_0x5385('0x27')](handleError(_0x7bbe8b,null));};exports['addTags']=function(_0x128ac9,_0x4daa40){return db[_0x5385('0x22')]['find']({'where':{'id':_0x128ac9['params']['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x4daa40,null))['then'](function(_0x2fa02f){if(_0x2fa02f){return _0x2fa02f[_0x5385('0x47')](_0x128ac9[_0x5385('0x36')]['ids'],_[_0x5385('0x3a')](_0x128ac9[_0x5385('0x36')],[_0x5385('0x48'),'id'])||{})[_0x5385('0x49')](function(){return db[_0x5385('0x4a')]['findAll']({'attributes':['id','name',_0x5385('0x4b')],'where':{'id':_0x128ac9[_0x5385('0x36')][_0x5385('0x48')]}});})['then'](function(_0x29909a){socket[_0x5385('0x4c')]('smsInteractionTags:save',{'id':Number(_0x128ac9[_0x5385('0x29')]['id']),'tags':_0x29909a||[]});return{'id':Number(_0x128ac9['params']['id']),'tags':_0x29909a||[]};});}})[_0x5385('0x1b')](respondWithResult(_0x4daa40,null))[_0x5385('0x27')](handleError(_0x4daa40,null));};exports[_0x5385('0x4d')]=function(_0x31aea4,_0x494e2f){return db[_0x5385('0x22')][_0x5385('0x34')]({'where':{'id':_0x31aea4[_0x5385('0x29')]['id']}})[_0x5385('0x1b')](handleEntityNotFound(_0x494e2f,null))[_0x5385('0x1b')](function(_0xf14b8){if(_0xf14b8){return _0xf14b8[_0x5385('0x4d')](_0x31aea4[_0x5385('0x2f')][_0x5385('0x48')]);}})[_0x5385('0x1b')](respondWithStatusCode(_0x494e2f,null))[_0x5385('0x27')](handleError(_0x494e2f,null));};exports[_0x5385('0x4e')]=function(_0x421235,_0x305162){var _0x7eff09=moment()[_0x5385('0x4f')]()[_0x5385('0x50')]();var _0x5f21ba=path['join'](config['root'],_0x5385('0x51'),_0x5385('0x52'),'tmp');var _0x6a18f0=path[_0x5385('0x53')](_0x5f21ba,_0x7eff09);var _0x3827d0=util['format'](_0x5385('0x54'),_0x421235[_0x5385('0x29')]['id'],_0x7eff09);var _0x487ca0=path[_0x5385('0x53')](_0x5f21ba,_0x3827d0);var _0x532007=[];_0x532007['push']({'model':db[_0x5385('0x55')],'as':'User','attributes':['id',_0x5385('0x56')],'raw':!![]});_0x532007[_0x5385('0x57')]({'model':db['CmContact'],'as':_0x5385('0x58'),'attributes':['id',_0x5385('0x59'),_0x5385('0x5a')],'raw':!![]});var _0x53748f=[{'model':db[_0x5385('0x38')],'as':_0x5385('0x5b'),'attributes':['id',_0x5385('0x36'),_0x5385('0x5c'),'direction',_0x5385('0x5d'),'read'],'include':_0x532007}];_0x53748f[_0x5385('0x57')]({'model':db[_0x5385('0x5e')],'as':_0x5385('0x5f'),'attributes':['id',_0x5385('0x1f')]});_0x53748f[_0x5385('0x57')]({'model':db[_0x5385('0x55')],'as':'Owner','attributes':['id',_0x5385('0x56')]});return db[_0x5385('0x22')][_0x5385('0x34')]({'where':{'id':_0x421235[_0x5385('0x29')]['id']},'include':_0x53748f})[_0x5385('0x1b')](handleEntityNotFound(_0x305162,null))[_0x5385('0x1b')](function(_0x473bab){if(_0x473bab){var _0x1acc5b=_0x473bab['get']({'plain':!![]});fs[_0x5385('0x60')](_0x6a18f0);var _0x1b275e={'channel':_0x5385('0x61'),'account':_0x1acc5b['Account'][_0x5385('0x1f')],'agent':_0x1acc5b[_0x5385('0x62')]?_0x1acc5b['Owner'][_0x5385('0x56')]:_0x5385('0x63'),'createdAt':moment(_0x1acc5b[_0x5385('0x5c')])[_0x5385('0x45')](_0x5385('0x64'))[_0x5385('0x50')](),'closedAt':_0x1acc5b[_0x5385('0x65')]?moment(_0x1acc5b[_0x5385('0x66')])['format'](_0x5385('0x64'))[_0x5385('0x50')]():'','disposition':_0x1acc5b['disposition'],'messages':_(_0x1acc5b[_0x5385('0x5b')])['filter']({'secret':![]})['map'](function(_0x4ef383){return{'date':moment(_0x4ef383['createdAt'])[_0x5385('0x45')](_0x5385('0x64'))[_0x5385('0x50')](),'sender':_0x4ef383[_0x5385('0x67')]===_0x5385('0x68')?_0x4ef383['User']?_0x4ef383[_0x5385('0x55')][_0x5385('0x56')]:'System':_0x4ef383[_0x5385('0x58')][_0x5385('0x59')]+(_0x4ef383['Contact'][_0x5385('0x5a')]?'\x20'+_0x4ef383['Contact']['lastName']:''),'body':_0x4ef383[_0x5385('0x36')],'direction':_0x4ef383[_0x5385('0x67')]===_0x5385('0x68')?'A':'C','secret':_0x4ef383[_0x5385('0x5d')],'read':_0x4ef383[_0x5385('0x69')]};})['value']()};return ejs['renderFile'](path[_0x5385('0x53')](config[_0x5385('0x6a')],_0x5385('0x51'),'views',_0x5385('0x6b')),{'interaction':_0x1b275e})['then'](function(_0x55ec5a){var _0x532a54=path['join'](_0x6a18f0,'transcript-'+_0x1acc5b['id']+'-'+_0x7eff09+_0x5385('0x6c'));var _0x5c8795={'path':_0x532a54,'channel':_0x5385('0x61'),'interactionId':_0x1acc5b['id']};return pdf[_0x5385('0x6d')](_0x55ec5a,_0x5c8795);})[_0x5385('0x1b')](function(){return new BPromise(function(_0x510c03,_0x143c47){zipdir(_0x6a18f0,{'saveTo':_0x487ca0},function(_0x3fdf05,_0xe1bef0){if(_0x3fdf05)return _0x143c47(_0x3fdf05);return _0x510c03(_0xe1bef0);});})[_0x5385('0x1b')](function(){return new BPromise(function(_0x38c969,_0x161a91){rimraf(_0x6a18f0,function(_0x1c2f81){if(_0x1c2f81)_0x161a91(_0x1c2f81);return _0x38c969();});});})[_0x5385('0x1b')](function(){return _0x305162[_0x5385('0x4e')](_0x487ca0,_0x3827d0,function(_0x2cdcdf){if(_0x2cdcdf){console[_0x5385('0x6e')]('err',_0x2cdcdf);}else{fs[_0x5385('0x6f')](_0x487ca0);}});});});}else{return _0x305162[_0x5385('0x11')](0xc8);}})[_0x5385('0x27')](handleError(_0x305162,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c85bb55..0fd2639 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 _0x8e3f=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xf8e3('0x0'));var SmsInteraction=require(_0xf8e3('0x1'))['db'][_0xf8e3('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xf8e3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf8e3('0x4')](0x0);var events={'afterCreate':_0xf8e3('0x5'),'afterUpdate':'update','afterDestroy':_0xf8e3('0x6')};function emitEvent(_0x41bc05){return function(_0x4dab56,_0x35e88f,_0xb21f8d){_0x4dab56[_0xf8e3('0x7')]({'attributes':['id'],'raw':!![]})[_0xf8e3('0x8')](function(_0x4e9e57){_0x4dab56[_0xf8e3('0x9')](_0xf8e3('0xa'),_0x4e9e57[_0xf8e3('0xb')](function(_0x95ad03){return{'id':_0x95ad03['id']};}));return SmsMessage[_0xf8e3('0xc')]({'where':{'SmsInteractionId':_0x4dab56['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf8e3('0x8')](function(_0x299a7e){_0x4dab56[_0xf8e3('0x9')](_0xf8e3('0xd'),_0x299a7e[_0xf8e3('0xe')]);SmsInteractionEvents[_0xf8e3('0xf')](_0x41bc05+':'+_0x4dab56['id'],_0x4dab56);SmsInteractionEvents[_0xf8e3('0xf')](_0x41bc05,_0x4dab56);_0xb21f8d(null);})['catch'](_0xb21f8d(null));};}for(var e in events){if(events[_0xf8e3('0x10')](e)){var event=events[e];SmsInteraction[_0xf8e3('0x11')](e,emitEvent(event));}}module[_0xf8e3('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x4991=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','events','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x23dc80,_0x4f36c0){var _0x32c826=function(_0x246491){while(--_0x246491){_0x23dc80['push'](_0x23dc80['shift']());}};_0x32c826(++_0x4f36c0);}(_0x4991,0xf7));var _0x1499=function(_0x54e145,_0x18d9f8){_0x54e145=_0x54e145-0x0;var _0x3e92dd=_0x4991[_0x54e145];return _0x3e92dd;};'use strict';var EventEmitter=require(_0x1499('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1499('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x1499('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1499('0x3')](0x0);var events={'afterCreate':_0x1499('0x4'),'afterUpdate':_0x1499('0x5'),'afterDestroy':_0x1499('0x6')};function emitEvent(_0x158134){return function(_0x19adff,_0x209616,_0x4b6154){_0x19adff[_0x1499('0x7')]({'attributes':['id'],'raw':!![]})[_0x1499('0x8')](function(_0x1c65c3){_0x19adff[_0x1499('0x9')](_0x1499('0xa'),_0x1c65c3[_0x1499('0xb')](function(_0x3277b3){return{'id':_0x3277b3['id']};}));return SmsMessage[_0x1499('0xc')]({'where':{'SmsInteractionId':_0x19adff['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16e8ad){_0x19adff[_0x1499('0x9')]('unreadMessages',_0x16e8ad[_0x1499('0xd')]);SmsInteractionEvents[_0x1499('0xe')](_0x158134+':'+_0x19adff['id'],_0x19adff);SmsInteractionEvents['emit'](_0x158134,_0x19adff);_0x4b6154(null);})[_0x1499('0xf')](_0x4b6154(null));};}for(var e in events){if(events[_0x1499('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index aa39c59..c11137b 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 _0xcb12=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0xcb12,0xae));var _0x2cb1=function(_0x32d509,_0x10992b){_0x32d509=_0x32d509-0x0;var _0x1ae1c4=_0xcb12[_0x32d509];return _0x1ae1c4;};'use strict';var _=require(_0x2cb1('0x0'));var util=require(_0x2cb1('0x1'));var logger=require('../../config/logger')(_0x2cb1('0x2'));var moment=require(_0x2cb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x2cb1('0x4'));var fs=require('fs');var path=require(_0x2cb1('0x5'));var rimraf=require(_0x2cb1('0x6'));var config=require(_0x2cb1('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x2cb1('0x8')]=function(_0x1d7b50,_0x5a3b6a){return _0x1d7b50[_0x2cb1('0x9')](_0x2cb1('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x120623,_0x24fe48,_0x7ba5c){if(_0x120623[_0x2cb1('0xb')](_0x2cb1('0xc'))){_0x120623[_0x2cb1('0xd')]=moment()[_0x2cb1('0xe')](_0x2cb1('0xf'));}_0x7ba5c(null,_0x120623);}}});}; \ No newline at end of file +var _0x490b=['closed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed'];(function(_0x558100,_0x39cd2d){var _0x24b0e7=function(_0xb9df1c){while(--_0xb9df1c){_0x558100['push'](_0x558100['shift']());}};_0x24b0e7(++_0x39cd2d);}(_0x490b,0x8b));var _0xb490=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x490b[_0x27604f];return _0x40d189;};'use strict';var _=require(_0xb490('0x0'));var util=require('util');var logger=require(_0xb490('0x1'))(_0xb490('0x2'));var moment=require(_0xb490('0x3'));var BPromise=require(_0xb490('0x4'));var rp=require(_0xb490('0x5'));var fs=require('fs');var path=require(_0xb490('0x6'));var rimraf=require(_0xb490('0x7'));var config=require(_0xb490('0x8'));var attributes=require(_0xb490('0x9'));module[_0xb490('0xa')]=function(_0x1bbc6b,_0x42d4d1){return _0x1bbc6b['define'](_0xb490('0xb'),attributes,{'tableName':_0xb490('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2433c7,_0x56fc5b,_0x449e00){if(_0x2433c7[_0xb490('0xd')](_0xb490('0xe'))){_0x2433c7[_0xb490('0xf')]=moment()[_0xb490('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x449e00(null,_0x2433c7);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d191232..ad88356 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 _0x4e9d=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','AddTagsToSmsInteraction','where','addTags','ids','omit','AddTags'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e9d,0x6c));var _0xd4e9=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x4e9d[_0x57ee8c];return _0x3a2322;};'use strict';var _=require(_0xd4e9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd4e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4e9('0x2'));var db=require(_0xd4e9('0x3'))['db'];var utils=require(_0xd4e9('0x4'));var logger=require(_0xd4e9('0x5'))('rpc');var config=require(_0xd4e9('0x6'));var jayson=require(_0xd4e9('0x7'));var client=jayson[_0xd4e9('0x8')]['http']({'port':0x232a});config['redis']=_[_0xd4e9('0x9')](config[_0xd4e9('0xa')],{'host':_0xd4e9('0xb'),'port':0x18eb});var socket=require(_0xd4e9('0xc'))(new Redis(config['redis']));require(_0xd4e9('0xd'))['register'](socket);function respondWithRpcPromise(_0x463ce0,_0x1a4cc3,_0x477dea){return new BPromise(function(_0x1db4dc,_0x3ffe49){return client['request'](_0x463ce0,_0x477dea)[_0xd4e9('0xe')](function(_0x1fb629){logger[_0xd4e9('0xf')](_0xd4e9('0x10'),_0x1a4cc3,_0xd4e9('0x11'));logger[_0xd4e9('0x12')](_0xd4e9('0x13'),_0x1a4cc3,_0xd4e9('0x11'),JSON[_0xd4e9('0x14')](_0x1fb629));if(_0x1fb629['error']){if(_0x1fb629[_0xd4e9('0x15')][_0xd4e9('0x16')]===0x1f4){logger[_0xd4e9('0x15')](_0xd4e9('0x10'),_0x1a4cc3,_0x1fb629[_0xd4e9('0x15')][_0xd4e9('0x17')]);return _0x3ffe49(_0x1fb629[_0xd4e9('0x15')][_0xd4e9('0x17')]);}logger[_0xd4e9('0x15')](_0xd4e9('0x10'),_0x1a4cc3,_0x1fb629[_0xd4e9('0x15')][_0xd4e9('0x17')]);return _0x1db4dc(_0x1fb629[_0xd4e9('0x15')][_0xd4e9('0x17')]);}else{logger[_0xd4e9('0xf')](_0xd4e9('0x10'),_0x1a4cc3,'request\x20sent');_0x1db4dc(_0x1fb629['result'][_0xd4e9('0x17')]);}})[_0xd4e9('0x18')](function(_0x125d52){logger[_0xd4e9('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x1a4cc3,_0x125d52);_0x3ffe49(_0x125d52);});});}exports[_0xd4e9('0x19')]=function(_0x5b41be){var _0x426179=this;return new Promise(function(_0x1bfbe8,_0x5eb024){return db[_0xd4e9('0x1a')]['update'](_0x5b41be[_0xd4e9('0x1b')],{'raw':_0x5b41be[_0xd4e9('0x1c')]?_0x5b41be[_0xd4e9('0x1c')][_0xd4e9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b41be[_0xd4e9('0x1c')]?_0x5b41be[_0xd4e9('0x1c')]['where']||null:null,'attributes':_0x5b41be[_0xd4e9('0x1c')]?_0x5b41be[_0xd4e9('0x1c')]['attributes']||null:null,'limit':_0x5b41be[_0xd4e9('0x1c')]?_0x5b41be['options']['limit']||null:null})[_0xd4e9('0xe')](function(_0x5c3b28){logger[_0xd4e9('0xf')](_0xd4e9('0x19'),_0x5b41be);logger[_0xd4e9('0x12')](_0xd4e9('0x19'),_0x5b41be,JSON[_0xd4e9('0x14')](_0x5c3b28));_0x1bfbe8(_0x5c3b28);})['catch'](function(_0x32070c){logger['error'](_0xd4e9('0x19'),_0x32070c[_0xd4e9('0x17')],_0x5b41be);_0x5eb024(_0x426179[_0xd4e9('0x15')](0x1f4,_0x32070c[_0xd4e9('0x17')]));});});};exports[_0xd4e9('0x1e')]=function(_0x319cc6){return new Promise(function(_0x1c9bd2,_0x21e8da){return db[_0xd4e9('0x1a')]['find']({'where':_0x319cc6[_0xd4e9('0x1c')]?_0x319cc6['options'][_0xd4e9('0x1f')]||null:null})[_0xd4e9('0xe')](function(_0x4e3f72){if(_0x4e3f72){return _0x4e3f72[_0xd4e9('0x20')](_0x319cc6[_0xd4e9('0x1b')][_0xd4e9('0x21')],_[_0xd4e9('0x22')](_0x319cc6[_0xd4e9('0x1b')],[_0xd4e9('0x21'),'id'])||{});}})['spread'](function(_0x5741a5){logger[_0xd4e9('0xf')](_0xd4e9('0x23'),_0x319cc6);logger[_0xd4e9('0x12')](_0xd4e9('0x23'),_0x319cc6,JSON[_0xd4e9('0x14')](_0x5741a5));_0x1c9bd2(_0x5741a5);})[_0xd4e9('0x18')](function(_0x4ce512){logger[_0xd4e9('0x15')]('AddTags',_0x4ce512[_0xd4e9('0x17')],_0x319cc6);_0x21e8da(_this[_0xd4e9('0x15')](0x1f4,_0x4ce512[_0xd4e9('0x17')]));});});}; \ No newline at end of file +var _0x8ee1=['http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','update','body','options','raw','attributes','limit','find','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2a9664,_0x2abf0d){var _0x150aaf=function(_0x1bbe47){while(--_0x1bbe47){_0x2a9664['push'](_0x2a9664['shift']());}};_0x150aaf(++_0x2abf0d);}(_0x8ee1,0x67));var _0x18ee=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x8ee1[_0x1098db];return _0x14f090;};'use strict';var _=require('lodash');var util=require(_0x18ee('0x0'));var moment=require(_0x18ee('0x1'));var BPromise=require(_0x18ee('0x2'));var rs=require(_0x18ee('0x3'));var fs=require('fs');var Redis=require(_0x18ee('0x4'));var db=require(_0x18ee('0x5'))['db'];var utils=require(_0x18ee('0x6'));var logger=require(_0x18ee('0x7'))(_0x18ee('0x8'));var config=require('../../config/environment');var jayson=require(_0x18ee('0x9'));var client=jayson[_0x18ee('0xa')][_0x18ee('0xb')]({'port':0x232a});config[_0x18ee('0xc')]=_[_0x18ee('0xd')](config[_0x18ee('0xc')],{'host':_0x18ee('0xe'),'port':0x18eb});var socket=require(_0x18ee('0xf'))(new Redis(config['redis']));require(_0x18ee('0x10'))['register'](socket);function respondWithRpcPromise(_0x5769dc,_0x3c84a3,_0x4eefdf){return new BPromise(function(_0x3b04a2,_0x3f0585){return client[_0x18ee('0x11')](_0x5769dc,_0x4eefdf)[_0x18ee('0x12')](function(_0x301a34){logger[_0x18ee('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x3c84a3,_0x18ee('0x14'));logger[_0x18ee('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3c84a3,_0x18ee('0x14'),JSON[_0x18ee('0x16')](_0x301a34));if(_0x301a34['error']){if(_0x301a34['error']['code']===0x1f4){logger[_0x18ee('0x17')](_0x18ee('0x18'),_0x3c84a3,_0x301a34[_0x18ee('0x17')][_0x18ee('0x19')]);return _0x3f0585(_0x301a34[_0x18ee('0x17')][_0x18ee('0x19')]);}logger[_0x18ee('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3c84a3,_0x301a34['error'][_0x18ee('0x19')]);return _0x3b04a2(_0x301a34[_0x18ee('0x17')]['message']);}else{logger[_0x18ee('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x3c84a3,_0x18ee('0x14'));_0x3b04a2(_0x301a34['result'][_0x18ee('0x19')]);}})[_0x18ee('0x1a')](function(_0x1a243d){logger[_0x18ee('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x3c84a3,_0x1a243d);_0x3f0585(_0x1a243d);});});}exports[_0x18ee('0x1b')]=function(_0x205759){var _0x183e66=this;return new Promise(function(_0xeb14f5,_0x54cde0){return db['SmsInteraction'][_0x18ee('0x1c')](_0x205759[_0x18ee('0x1d')],{'raw':_0x205759[_0x18ee('0x1e')]?_0x205759['options'][_0x18ee('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x205759[_0x18ee('0x1e')]?_0x205759[_0x18ee('0x1e')]['where']||null:null,'attributes':_0x205759[_0x18ee('0x1e')]?_0x205759[_0x18ee('0x1e')][_0x18ee('0x20')]||null:null,'limit':_0x205759[_0x18ee('0x1e')]?_0x205759['options'][_0x18ee('0x21')]||null:null})[_0x18ee('0x12')](function(_0x2d5a14){logger[_0x18ee('0x13')](_0x18ee('0x1b'),_0x205759);logger[_0x18ee('0x15')](_0x18ee('0x1b'),_0x205759,JSON[_0x18ee('0x16')](_0x2d5a14));_0xeb14f5(_0x2d5a14);})[_0x18ee('0x1a')](function(_0x2e7298){logger[_0x18ee('0x17')](_0x18ee('0x1b'),_0x2e7298[_0x18ee('0x19')],_0x205759);_0x54cde0(_0x183e66[_0x18ee('0x17')](0x1f4,_0x2e7298[_0x18ee('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4a114a){return new Promise(function(_0x57273c,_0x57c164){return db['SmsInteraction'][_0x18ee('0x22')]({'where':_0x4a114a[_0x18ee('0x1e')]?_0x4a114a['options']['where']||null:null})['then'](function(_0x4beeb4){if(_0x4beeb4){return _0x4beeb4['addTags'](_0x4a114a[_0x18ee('0x1d')][_0x18ee('0x23')],_[_0x18ee('0x24')](_0x4a114a[_0x18ee('0x1d')],[_0x18ee('0x23'),'id'])||{});}})['spread'](function(_0x5e4622){logger[_0x18ee('0x13')]('AddTags',_0x4a114a);logger[_0x18ee('0x15')](_0x18ee('0x25'),_0x4a114a,JSON['stringify'](_0x5e4622));_0x57273c(_0x5e4622);})[_0x18ee('0x1a')](function(_0x543f30){logger[_0x18ee('0x17')](_0x18ee('0x25'),_0x543f30[_0x18ee('0x19')],_0x4a114a);_0x57c164(_this['error'](0x1f4,_0x543f30[_0x18ee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c3d708d..3c5fb1d 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 _0x64b5=['removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x4502f1,_0x5720d6){var _0x4544dc=function(_0x15346b){while(--_0x15346b){_0x4502f1['push'](_0x4502f1['shift']());}};_0x4544dc(++_0x5720d6);}(_0x64b5,0xe4));var _0x564b=function(_0x51333d,_0x4caa26){_0x51333d=_0x51333d-0x0;var _0x3cd415=_0x64b5[_0x51333d];return _0x3cd415;};'use strict';var SmsInteractionEvents=require(_0x564b('0x0'));var events=['save',_0x564b('0x1'),_0x564b('0x2')];function createListener(_0x1aad88,_0x2a6aa7){return function(_0x3bfd39){_0x2a6aa7[_0x564b('0x3')](_0x1aad88,_0x3bfd39);};}function removeListener(_0x7d2624,_0x5607fa){return function(){SmsInteractionEvents[_0x564b('0x4')](_0x7d2624,_0x5607fa);};}exports[_0x564b('0x5')]=function(_0x3739ca){for(var _0xa8fa9f=0x0,_0x3dbf6e=events[_0x564b('0x6')];_0xa8fa9f<_0x3dbf6e;_0xa8fa9f++){var _0x6c7861=events[_0xa8fa9f];var _0x3d71c1=createListener(_0x564b('0x7')+_0x6c7861,_0x3739ca);SmsInteractionEvents['on'](_0x6c7861,_0x3d71c1);}}; \ No newline at end of file +var _0xbebc=['length','save','remove','emit','removeListener','register'];(function(_0x342188,_0x50d550){var _0x55d3fd=function(_0x500bf2){while(--_0x500bf2){_0x342188['push'](_0x342188['shift']());}};_0x55d3fd(++_0x50d550);}(_0xbebc,0x1b7));var _0xcbeb=function(_0x313b82,_0x300c5d){_0x313b82=_0x313b82-0x0;var _0x3bfee6=_0xbebc[_0x313b82];return _0x3bfee6;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xcbeb('0x0'),_0xcbeb('0x1'),'update'];function createListener(_0x58c5e9,_0x5afdfe){return function(_0x194555){_0x5afdfe[_0xcbeb('0x2')](_0x58c5e9,_0x194555);};}function removeListener(_0x16260d,_0x1aaff7){return function(){SmsInteractionEvents[_0xcbeb('0x3')](_0x16260d,_0x1aaff7);};}exports[_0xcbeb('0x4')]=function(_0x41fdd7){for(var _0xd435f=0x0,_0x43de16=events[_0xcbeb('0x5')];_0xd435f<_0x43de16;_0xd435f++){var _0x24f9a5=events[_0xd435f];var _0x384258=createListener('smsInteraction:'+_0x24f9a5,_0x41fdd7);SmsInteractionEvents['on'](_0x24f9a5,_0x384258);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6aabcfc..2c99a92 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 _0x4134=['./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','util','path','../../components/auth/service','../../config/environment'];(function(_0x25b2ba,_0xbb8274){var _0x2f000c=function(_0x380bae){while(--_0x380bae){_0x25b2ba['push'](_0x25b2ba['shift']());}};_0x2f000c(++_0xbb8274);}(_0x4134,0x17c));var _0x4413=function(_0x3faed0,_0x2643ce){_0x3faed0=_0x3faed0-0x0;var _0x3af605=_0x4134[_0x3faed0];return _0x3af605;};'use strict';var multer=require('multer');var util=require(_0x4413('0x0'));var path=require(_0x4413('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4413('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x4413('0x3'));var controller=require(_0x4413('0x4'));router['get']('/',auth[_0x4413('0x5')](),controller[_0x4413('0x6')]);router[_0x4413('0x7')](_0x4413('0x8'),auth[_0x4413('0x5')](),controller[_0x4413('0x9')]);router[_0x4413('0x7')](_0x4413('0xa'),auth['isAuthenticated'](),controller[_0x4413('0xb')]);router[_0x4413('0xc')]('/',auth[_0x4413('0x5')](),interaction[_0x4413('0xd')]('sms',_0x4413('0xe')),controller[_0x4413('0xf')]);router[_0x4413('0xc')]('/:id/status',controller[_0x4413('0x10')]);router[_0x4413('0x11')]('/:id',auth[_0x4413('0x5')](),controller[_0x4413('0x12')]);router[_0x4413('0x11')](_0x4413('0x13'),auth[_0x4413('0x5')](),controller['accept']);router['put'](_0x4413('0x14'),auth[_0x4413('0x5')](),controller['reject']);router[_0x4413('0x15')](_0x4413('0xa'),auth[_0x4413('0x5')](),controller[_0x4413('0x16')]);module[_0x4413('0x17')]=router; \ No newline at end of file +var _0x5bf9=['../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','smsmessage:create','create','post','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x5bf9,0xa2));var _0x95bf=function(_0x570301,_0x560c68){_0x570301=_0x570301-0x0;var _0x3ec88a=_0x5bf9[_0x570301];return _0x3ec88a;};'use strict';var multer=require('multer');var util=require(_0x95bf('0x0'));var path=require(_0x95bf('0x1'));var timeout=require(_0x95bf('0x2'));var express=require('express');var router=express[_0x95bf('0x3')]();var fs_extra=require(_0x95bf('0x4'));var auth=require(_0x95bf('0x5'));var interaction=require(_0x95bf('0x6'));var config=require(_0x95bf('0x7'));var controller=require(_0x95bf('0x8'));router[_0x95bf('0x9')]('/',auth[_0x95bf('0xa')](),controller[_0x95bf('0xb')]);router['get'](_0x95bf('0xc'),auth['isAuthenticated'](),controller[_0x95bf('0xd')]);router['get'](_0x95bf('0xe'),auth[_0x95bf('0xa')](),controller['show']);router['post']('/',auth[_0x95bf('0xa')](),interaction['tracked']('sms',_0x95bf('0xf')),controller[_0x95bf('0x10')]);router[_0x95bf('0x11')](_0x95bf('0x12'),controller[_0x95bf('0x13')]);router[_0x95bf('0x14')]('/:id',auth[_0x95bf('0xa')](),controller[_0x95bf('0x15')]);router[_0x95bf('0x14')]('/:id/accept',auth[_0x95bf('0xa')](),controller[_0x95bf('0x16')]);router[_0x95bf('0x14')](_0x95bf('0x17'),auth['isAuthenticated'](),controller[_0x95bf('0x18')]);router[_0x95bf('0x19')]('/:id',auth[_0x95bf('0xa')](),controller[_0x95bf('0x1a')]);module[_0x95bf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3f8ded2..be01651 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 _0x1a8f=['sequelize','exports','medium','ENUM','out','STRING','DATE','TEXT'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1a8f,0x88));var _0xf1a8=function(_0x585723,_0x25250e){_0x585723=_0x585723-0x0;var _0x54edcf=_0x1a8f[_0x585723];return _0x54edcf;};'use strict';var Sequelize=require(_0xf1a8('0x0'));module[_0xf1a8('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf1a8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf1a8('0x3')]('in',_0xf1a8('0x4')),'defaultValue':_0xf1a8('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xf1a8('0x5')]},'readAt':{'type':Sequelize[_0xf1a8('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf1a8('0x7')]}}; \ No newline at end of file +var _0x1196=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x42e77e,_0x48f728){var _0x1cfb6a=function(_0xaac82e){while(--_0xaac82e){_0x42e77e['push'](_0x42e77e['shift']());}};_0x1cfb6a(++_0x48f728);}(_0x1196,0x156));var _0x6119=function(_0x492481,_0x1b0215){_0x492481=_0x492481-0x0;var _0x41a9c3=_0x1196[_0x492481];return _0x41a9c3;};'use strict';var Sequelize=require(_0x6119('0x0'));module[_0x6119('0x1')]={'body':{'type':Sequelize[_0x6119('0x2')](_0x6119('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6119('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6119('0x5')]('in',_0x6119('0x6')),'defaultValue':_0x6119('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6119('0x7')](0xbe)},'phone':{'type':Sequelize[_0x6119('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6119('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6119('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0617308..df9fb75 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 _0x9536=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','type','VIRTUAL','SmsMessage','findAll','rows','show','includeAll','include','find','create','update','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','params','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','infobip','results','groupName','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','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x1bfdf2,_0x492061){var _0x52a4d5=function(_0x5f4b08){while(--_0x5f4b08){_0x1bfdf2['push'](_0x1bfdf2['shift']());}};_0x52a4d5(++_0x492061);}(_0x9536,0x179));var _0x6953=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x9536[_0x1cb0b4];return _0x525b60;};'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'];config[_0x6953('0x1a')]=_['defaults'](config[_0x6953('0x1a')],{'host':_0x6953('0x1b'),'port':0x18eb});var socket=require(_0x6953('0x1c'))(new Redis(config[_0x6953('0x1a')]));require(_0x6953('0x1d'))[_0x6953('0x1e')](socket);var jayson=require(_0x6953('0x1f'));var client=jayson[_0x6953('0x20')][_0x6953('0x21')]({'port':0x232c});var client9002=jayson[_0x6953('0x20')][_0x6953('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x548473,_0x5f49db,_0x399b9b,_0x44e8a2){return new BPromise(function(_0x16b79b,_0x16251d){var _0x510d46=_0x44e8a2||client;return _0x510d46[_0x6953('0x22')](_0x548473,_0x399b9b)[_0x6953('0x23')](function(_0x4b43ae){logger[_0x6953('0x24')](_0x6953('0x25'),_0x5f49db,_0x6953('0x26'));logger[_0x6953('0x27')](_0x6953('0x28'),_0x5f49db,'request\x20sent',JSON[_0x6953('0x29')](_0x4b43ae));if(_0x4b43ae[_0x6953('0x2a')]){if(_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2b')]===0x1f4){logger[_0x6953('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2c')]);return _0x16251d(_0x4b43ae['error'][_0x6953('0x2c')]);}logger[_0x6953('0x2a')](_0x6953('0x25'),_0x5f49db,_0x4b43ae[_0x6953('0x2a')]['message']);return _0x16b79b(_0x4b43ae[_0x6953('0x2a')][_0x6953('0x2c')]);}else{logger[_0x6953('0x24')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,'request\x20sent');_0x16b79b(_0x4b43ae['result'][_0x6953('0x2c')]);}})[_0x6953('0x2d')](function(_0x550be4){logger[_0x6953('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x5f49db,_0x550be4);_0x16251d(_0x550be4);});});}function respondWithStatusCode(_0x328f67,_0x2bf39b){_0x2bf39b=_0x2bf39b||0xcc;return function(_0xcdbce8){if(_0xcdbce8){return _0x328f67[_0x6953('0x2e')](_0x2bf39b);}return _0x328f67[_0x6953('0x2f')](_0x2bf39b)[_0x6953('0x30')]();};}function respondWithResult(_0x53d3dc,_0x3dd890){_0x3dd890=_0x3dd890||0xc8;return function(_0x3c1075){if(_0x3c1075){return _0x53d3dc['status'](_0x3dd890)[_0x6953('0x31')](_0x3c1075);}};}function respondWithFilteredResult(_0x4af39d,_0x173b3c){return function(_0x3b1175){if(_0x3b1175){var _0x426c7c=typeof _0x173b3c['offset']===_0x6953('0x32')&&typeof _0x173b3c[_0x6953('0x33')]===_0x6953('0x32');var _0x47ed2f=_0x3b1175[_0x6953('0x34')];var _0x132a71=_0x426c7c?0x0:_0x173b3c['offset'];var _0x4d856d=_0x426c7c?_0x3b1175[_0x6953('0x34')]:_0x173b3c[_0x6953('0x35')]+_0x173b3c[_0x6953('0x33')];var _0x2312e7;if(_0x4d856d>=_0x47ed2f){_0x4d856d=_0x47ed2f;_0x2312e7=0xc8;}else{_0x2312e7=0xce;}_0x4af39d[_0x6953('0x2f')](_0x2312e7);return _0x4af39d['set'](_0x6953('0x36'),_0x132a71+'-'+_0x4d856d+'/'+_0x47ed2f)['json'](_0x3b1175);}return null;};}function patchUpdates(_0x2d5e76){return function(_0x2e85c7){try{jsonpatch['apply'](_0x2e85c7,_0x2d5e76,!![]);}catch(_0x4a4d41){return BPromise[_0x6953('0x37')](_0x4a4d41);}return _0x2e85c7[_0x6953('0x38')]();};}function saveUpdates(_0x34d10b,_0x4ffa69){return function(_0x28cb92){if(_0x28cb92){return _0x28cb92['update'](_0x34d10b)['then'](function(_0x5eda70){return _0x5eda70;});}return null;};}function removeEntity(_0x5c4a8a,_0x1ef067){return function(_0x6c7862){if(_0x6c7862){return _0x6c7862[_0x6953('0x39')]()[_0x6953('0x23')](function(){_0x5c4a8a[_0x6953('0x2f')](0xcc)[_0x6953('0x30')]();});}};}function handleEntityNotFound(_0x4f6e06,_0x2b76a5){return function(_0x5a8197){if(!_0x5a8197){_0x4f6e06[_0x6953('0x2e')](0x194);}return _0x5a8197;};}function handleError(_0x5c9a4e,_0xc63da7){_0xc63da7=_0xc63da7||0x1f4;return function(_0x383e31){logger[_0x6953('0x2a')](_0x383e31[_0x6953('0x3a')]);if(_0x383e31['name']){delete _0x383e31[_0x6953('0x3b')];}_0x5c9a4e[_0x6953('0x2f')](_0xc63da7)[_0x6953('0x3c')](_0x383e31);};}exports[_0x6953('0x3d')]=function(_0x40b6ea,_0x475ea8){var _0x37b2b3={},_0x81428b={},_0xdf1944={'count':0x0,'rows':[]};var _0x44f206=_[_0x6953('0x3e')](db['SmsMessage'][_0x6953('0x3f')],function(_0x3c03ab){return{'name':_0x3c03ab[_0x6953('0x40')],'type':_0x3c03ab['type']['key']};});_0x81428b[_0x6953('0x41')]=_['map'](_0x44f206,'name');_0x81428b[_0x6953('0x42')]=_[_0x6953('0x43')](_0x40b6ea['query']);_0x81428b[_0x6953('0x44')]=_[_0x6953('0x45')](_0x81428b[_0x6953('0x41')],_0x81428b[_0x6953('0x42')]);_0x37b2b3[_0x6953('0x46')]=_[_0x6953('0x45')](_0x81428b['model'],qs[_0x6953('0x47')](_0x40b6ea[_0x6953('0x42')][_0x6953('0x47')]));_0x37b2b3[_0x6953('0x46')]=_0x37b2b3[_0x6953('0x46')][_0x6953('0x48')]?_0x37b2b3['attributes']:_0x81428b['model'];if(!_0x40b6ea[_0x6953('0x42')]['hasOwnProperty']('nolimit')){_0x37b2b3[_0x6953('0x33')]=qs[_0x6953('0x33')](_0x40b6ea[_0x6953('0x42')][_0x6953('0x33')]);_0x37b2b3[_0x6953('0x35')]=qs['offset'](_0x40b6ea['query'][_0x6953('0x35')]);}_0x37b2b3[_0x6953('0x49')]=qs['sort'](_0x40b6ea[_0x6953('0x42')]['sort']);_0x37b2b3[_0x6953('0x4a')]=qs[_0x6953('0x44')](_[_0x6953('0x4b')](_0x40b6ea[_0x6953('0x42')],_0x81428b['filters']),_0x44f206);if(_0x40b6ea[_0x6953('0x42')][_0x6953('0x4c')]){_0x37b2b3['where']=_[_0x6953('0x4d')](_0x37b2b3[_0x6953('0x4a')],{'$or':_[_0x6953('0x3e')](_0x44f206,function(_0x228139){if(_0x228139[_0x6953('0x4e')]!==_0x6953('0x4f')){var _0x13d1a6={};_0x13d1a6[_0x228139[_0x6953('0x3b')]]={'$like':'%'+_0x40b6ea[_0x6953('0x42')][_0x6953('0x4c')]+'%'};return _0x13d1a6;}})});}_0x37b2b3=_[_0x6953('0x4d')]({},_0x37b2b3,_0x40b6ea['options']);var _0x332223={'where':_0x37b2b3['where']};return db[_0x6953('0x50')][_0x6953('0x34')](_0x332223)[_0x6953('0x23')](function(_0x4c4954){_0xdf1944[_0x6953('0x34')]=_0x4c4954;if(_0x40b6ea[_0x6953('0x42')]['includeAll']){_0x37b2b3['include']=[{'all':!![]}];}return db[_0x6953('0x50')][_0x6953('0x51')](_0x37b2b3);})[_0x6953('0x23')](function(_0x36d75a){_0xdf1944[_0x6953('0x52')]=_0x36d75a;return _0xdf1944;})[_0x6953('0x23')](respondWithFilteredResult(_0x475ea8,_0x37b2b3))[_0x6953('0x2d')](handleError(_0x475ea8,null));};exports[_0x6953('0x53')]=function(_0x2baf90,_0x18e8ef){var _0x1de9f8={'raw':!![],'where':{'id':_0x2baf90['params']['id']}},_0x493a91={};_0x493a91[_0x6953('0x41')]=_[_0x6953('0x43')](db[_0x6953('0x50')][_0x6953('0x3f')]);_0x493a91[_0x6953('0x42')]=_[_0x6953('0x43')](_0x2baf90[_0x6953('0x42')]);_0x493a91[_0x6953('0x44')]=_[_0x6953('0x45')](_0x493a91['model'],_0x493a91['query']);_0x1de9f8['attributes']=_['intersection'](_0x493a91[_0x6953('0x41')],qs[_0x6953('0x47')](_0x2baf90[_0x6953('0x42')]['fields']));_0x1de9f8['attributes']=_0x1de9f8[_0x6953('0x46')][_0x6953('0x48')]?_0x1de9f8[_0x6953('0x46')]:_0x493a91['model'];if(_0x2baf90['query'][_0x6953('0x54')]){_0x1de9f8[_0x6953('0x55')]=[{'all':!![]}];}_0x1de9f8=_['merge']({},_0x1de9f8,_0x2baf90['options']);return db[_0x6953('0x50')][_0x6953('0x56')](_0x1de9f8)[_0x6953('0x23')](handleEntityNotFound(_0x18e8ef,null))[_0x6953('0x23')](respondWithResult(_0x18e8ef,null))[_0x6953('0x2d')](handleError(_0x18e8ef,null));};exports['create']=function(_0x76c0f4,_0x15ff2d){return db['SmsMessage'][_0x6953('0x57')](_0x76c0f4['body'],{})[_0x6953('0x23')](respondWithResult(_0x15ff2d,0xc9))[_0x6953('0x2d')](handleError(_0x15ff2d,null));};exports[_0x6953('0x58')]=function(_0xceaa28,_0x4f24bf){if(_0xceaa28[_0x6953('0x59')]['id']){delete _0xceaa28[_0x6953('0x59')]['id'];}return db[_0x6953('0x50')]['find']({'where':{'id':_0xceaa28['params']['id']}})[_0x6953('0x23')](handleEntityNotFound(_0x4f24bf,null))[_0x6953('0x23')](saveUpdates(_0xceaa28[_0x6953('0x59')],null))['then'](respondWithResult(_0x4f24bf,null))['catch'](handleError(_0x4f24bf,null));};exports[_0x6953('0x39')]=function(_0x2b90f7,_0x4c0f1c){return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x2b90f7['params']['id']}})[_0x6953('0x23')](handleEntityNotFound(_0x4c0f1c,null))[_0x6953('0x23')](removeEntity(_0x4c0f1c,null))[_0x6953('0x2d')](handleError(_0x4c0f1c,null));};exports[_0x6953('0x5a')]=function(_0x1e4e2c,_0x5e4b89){return db[_0x6953('0x50')][_0x6953('0x5a')]()[_0x6953('0x23')](respondWithResult(_0x5e4b89,null))['catch'](handleError(_0x5e4b89,null));};var interaction_log=require('../../config/logger')(_0x6953('0x5b'));exports[_0x6953('0x5c')]=function(_0x33dbe4,_0x2bd209,_0x2659c3){var _0x4cd3a8={'agent':{},'channel':_0x6953('0x5d')};if(_0x33dbe4[_0x6953('0x59')]['id']){delete _0x33dbe4[_0x6953('0x59')]['id'];}_0x33dbe4[_0x6953('0x59')][_0x6953('0x5e')]=!![];_0x33dbe4[_0x6953('0x59')][_0x6953('0x5f')]=moment()[_0x6953('0x60')](_0x6953('0x61'));_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')]=_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')]||_0x33dbe4['user']['id'];_0x4cd3a8[_0x6953('0x63')]['id']=_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')];return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x33dbe4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2bd209,null))[_0x6953('0x23')](saveUpdates(_0x33dbe4['body'],null))[_0x6953('0x23')](function(_0x2b5de2){if(_0x2b5de2){_0x4cd3a8[_0x6953('0x2c')]=_0x2b5de2[_0x6953('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x6953('0x56')]({'where':{'id':_0x2b5de2[_0x6953('0x65')]}});}return null;})[_0x6953('0x23')](handleEntityNotFound(_0x2bd209,null))[_0x6953('0x23')](function(_0x1c3190){if(_0x1c3190){return _0x1c3190[_0x6953('0x58')]({'UserId':_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')],'read1stAt':_[_0x6953('0x66')](_0x1c3190[_0x6953('0x67')])?moment()[_0x6953('0x60')](_0x6953('0x61')):undefined});}return null;})[_0x6953('0x23')](function(_0x425833){if(_0x425833){_0x4cd3a8[_0x6953('0x68')]=_0x425833['get']({'plain':!![]});interaction_log[_0x6953('0x24')](_0x6953('0x69'),_0x33dbe4[_0x6953('0x6a')]['id'],_0x33dbe4[_0x6953('0x6a')][_0x6953('0x3b')],_0x33dbe4[_0x6953('0x6a')][_0x6953('0x6b')],_0x4cd3a8['interaction']['id'],_0x33dbe4[_0x6953('0x59')]?JSON[_0x6953('0x29')](_0x33dbe4['body']):_0x6953('0x6c'));return respondWithRpcPromise(_0x6953('0x6d'),_0x6953('0x6e'),_0x4cd3a8);}return null;})['then'](function(_0x4cb8a4){var _0x1ea573=_0x6953('0x6f')+_0x4cb8a4[_0x6953('0x2c')][_0x6953('0x70')];return db[_0x6953('0x71')][_0x6953('0x42')](_0x1ea573,{'type':db[_0x6953('0x72')][_0x6953('0x73')][_0x6953('0x74')],'raw':!![]})['then'](function(_0x78eb85){return _0x78eb85;});})[_0x6953('0x23')](function(_0x1b641e){if(_0x1b641e){_0x4cd3a8[_0x6953('0x2c')]['contact']=_0x1b641e[0x0];if(!_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')])return;return db[_0x6953('0x75')]['find']({'where':{'id':_0x33dbe4[_0x6953('0x59')][_0x6953('0x62')],'role':_0x6953('0x63')},'attributes':['id',_0x6953('0x3b'),'fullname',_0x6953('0x76'),_0x6953('0x77')],'raw':!![]});}return null;})[_0x6953('0x23')](function(_0x2dcef9){if(!_0x2dcef9)return null;_0x4cd3a8['message']['agent']=_0x2dcef9;return _0x4cd3a8;})[_0x6953('0x23')](function(_0x2310b2){if(_0x2310b2){if(_0x33dbe4['body']['manual']){_0x4cd3a8[_0x6953('0x2c')][_0x6953('0x78')]=util[_0x6953('0x60')](_0x6953('0x79'),_0x33dbe4['user'][_0x6953('0x3b')]);_0x4cd3a8[_0x6953('0x2c')]['channel']=_0x4cd3a8[_0x6953('0x7a')];_0x4cd3a8[_0x6953('0x2c')]['motionChannel']=_0x4cd3a8['channel'];_0x4cd3a8['message'][_0x6953('0x7b')]=_0x6953('0x5c');return respondWithRpcPromise(_0x6953('0x7c'),_0x6953('0x7c'),{'event':_0x6953('0x7d'),'message':_0x4cd3a8[_0x6953('0x2c')]},client9002)[_0x6953('0x23')](function(){return _0x4cd3a8;});}return _0x4cd3a8;}return null;})[_0x6953('0x23')](respondWithResult(_0x2bd209,null))['catch'](handleError(_0x2bd209,null));};var interaction_log=require(_0x6953('0x15'))(_0x6953('0x5b'));exports[_0x6953('0x37')]=function(_0x35ad50,_0xee6759,_0x43ad3d){var _0x481102={'agent':{},'channel':_0x6953('0x5d')};if(_0x35ad50['body']['id']){delete _0x35ad50[_0x6953('0x59')]['id'];}_0x35ad50['body'][_0x6953('0x62')]=_0x35ad50[_0x6953('0x59')][_0x6953('0x62')]||_0x35ad50['user']['id'];_0x481102[_0x6953('0x63')]['id']=_0x35ad50[_0x6953('0x59')][_0x6953('0x62')];return db[_0x6953('0x50')][_0x6953('0x56')]({'where':{'id':_0x35ad50[_0x6953('0x7e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xee6759,null))[_0x6953('0x23')](function(_0x15794b){if(_0x15794b){_0x481102[_0x6953('0x2c')]=_0x15794b[_0x6953('0x64')]({'plain':!![]});return db[_0x6953('0x7f')][_0x6953('0x56')]({'where':{'id':_0x15794b[_0x6953('0x65')]}});}return null;})[_0x6953('0x23')](handleEntityNotFound(_0xee6759,null))[_0x6953('0x23')](function(_0x216b92){if(_0x216b92){_0x481102[_0x6953('0x68')]=_0x216b92['get']({'plain':!![]});interaction_log[_0x6953('0x24')](_0x6953('0x80'),_0x35ad50[_0x6953('0x6a')]['id'],_0x35ad50[_0x6953('0x6a')][_0x6953('0x3b')],_0x35ad50[_0x6953('0x6a')][_0x6953('0x6b')],_0x481102[_0x6953('0x68')]['id'],_0x35ad50[_0x6953('0x59')]?JSON[_0x6953('0x29')](_0x35ad50[_0x6953('0x59')]):'null');return respondWithRpcPromise(_0x6953('0x81'),_0x6953('0x82'),_0x481102);}return null;})[_0x6953('0x23')](function(_0x5a74ab){var _0x51f1f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a74ab['message'][_0x6953('0x70')];return db[_0x6953('0x71')][_0x6953('0x42')](_0x51f1f5,{'type':db[_0x6953('0x72')][_0x6953('0x73')][_0x6953('0x74')],'raw':!![]})[_0x6953('0x23')](function(_0x5e34b6){return _0x5e34b6;});})[_0x6953('0x23')](function(_0x3113c0){if(_0x3113c0){_0x481102[_0x6953('0x2c')]['contact']=_0x3113c0[0x0];if(!_0x35ad50[_0x6953('0x59')][_0x6953('0x62')])return;return db['User'][_0x6953('0x56')]({'where':{'id':_0x35ad50['body']['UserId'],'role':_0x6953('0x63')},'attributes':['id','name','fullname',_0x6953('0x76'),_0x6953('0x77')],'raw':!![]});}return null;})[_0x6953('0x23')](function(_0x512384){if(!_0x512384)return null;_0x481102[_0x6953('0x2c')][_0x6953('0x63')]=_0x512384;return _0x481102;})['then'](function(_0x30de2c){if(_0x30de2c){_0x30de2c[_0x6953('0x2c')][_0x6953('0x78')]=util[_0x6953('0x60')](_0x6953('0x79'),_0x35ad50[_0x6953('0x6a')][_0x6953('0x3b')]);_0x30de2c[_0x6953('0x2c')][_0x6953('0x7a')]=_0x481102['channel'];_0x30de2c[_0x6953('0x2c')][_0x6953('0x83')]=_0x481102['channel'];_0x30de2c[_0x6953('0x2c')][_0x6953('0x7b')]=_0x6953('0x37');respondWithRpcPromise(_0x6953('0x7c'),_0x6953('0x7c'),{'event':_0x6953('0x84'),'message':_0x30de2c[_0x6953('0x2c')]},client9002);return _0x481102;}return null;})['then'](respondWithResult(_0xee6759,null))[_0x6953('0x2d')](handleError(_0xee6759,null));};exports[_0x6953('0x2f')]=function(_0x1481a1,_0x12e2ec,_0x29e68e){if(_0x1481a1[_0x6953('0x59')]['id']){delete _0x1481a1[_0x6953('0x59')]['id'];}var _0x3444cb;return db[_0x6953('0x50')]['find']({'where':{'id':_0x1481a1[_0x6953('0x7e')]['id']}})['then'](handleEntityNotFound(_0x12e2ec,null))[_0x6953('0x23')](function(_0x4ab5bb){if(_0x4ab5bb){_0x3444cb=_0x4ab5bb;return db[_0x6953('0x85')][_0x6953('0x56')]({'where':{'id':_0x4ab5bb[_0x6953('0x86')]}});}})[_0x6953('0x23')](handleEntityNotFound(_0x12e2ec,null))[_0x6953('0x23')](function(_0x5d56db){if(_0x5d56db){logger[_0x6953('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6953('0x2f'),_0x6953('0x87'),_0x5d56db[_0x6953('0x4e')],util[_0x6953('0x88')](_0x1481a1['body'],{'showHidden':![],'depth':null}));switch(_0x5d56db[_0x6953('0x4e')]){case _0x6953('0x89'):if(_0x1481a1[_0x6953('0x59')][_0x6953('0x8a')]&&_0x1481a1[_0x6953('0x59')][_0x6953('0x8a')]===_0x3444cb[_0x6953('0x8b')]){return _0x3444cb['update']({'read':!![]});}else{logger[_0x6953('0x2a')](_0x6953('0x8c'),_0x6953('0x2f'),_0x6953('0x89'),util[_0x6953('0x88')](_0x1481a1['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1481a1['body'][_0x6953('0x8d')]&&_0x1481a1[_0x6953('0x59')][_0x6953('0x8d')]===_0x3444cb['messageId']&&_[_0x6953('0x8e')](['sent',_0x6953('0x8f')],_0x1481a1[_0x6953('0x59')]['Status'])>=0x0){return _0x3444cb[_0x6953('0x58')]({'read':!![]});}else{logger['error'](_0x6953('0x8c'),'status','plivio',util[_0x6953('0x88')](_0x1481a1[_0x6953('0x59')],{'showHidden':![],'depth':null}));}break;case _0x6953('0x90'):var _0x14ad16=_0x1481a1[_0x6953('0x59')][_0x6953('0x91')][0x0];if(_0x14ad16[_0x6953('0x2f')][_0x6953('0x92')]==='DELIVERED'){return _0x3444cb['update']({'read':!![]});}else{logger['error'](_0x6953('0x8c'),_0x6953('0x2f'),_0x6953('0x90'),util[_0x6953('0x88')](_0x1481a1[_0x6953('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3444cb;}})['then'](respondWithResult(_0x12e2ec,null))[_0x6953('0x2d')](handleError(_0x12e2ec,null));}; \ No newline at end of file +var _0xe742=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','fullname','interface','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','DELIVERED','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','http','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','map','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','describe','sms-interactions','sms','read','readAt','format','UserId','user','get','isNil','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage'];(function(_0x3fea15,_0x25ecd7){var _0x226016=function(_0x4996ec){while(--_0x4996ec){_0x3fea15['push'](_0x3fea15['shift']());}};_0x226016(++_0x25ecd7);}(_0xe742,0x14d));var _0x2e74=function(_0x3a0e2f,_0x3ad3a7){_0x3a0e2f=_0x3a0e2f-0x0;var _0x1b6ba4=_0xe742[_0x3a0e2f];return _0x1b6ba4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e74('0x0'));var jsonpatch=require(_0x2e74('0x1'));var rp=require('request-promise');var moment=require(_0x2e74('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2e74('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2e74('0x4'));var csv=require(_0x2e74('0x5'));var ejs=require(_0x2e74('0x6'));var fs=require('fs');var fs_extra=require(_0x2e74('0x7'));var _=require(_0x2e74('0x8'));var squel=require(_0x2e74('0x9'));var crypto=require('crypto');var jsforce=require(_0x2e74('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2e74('0x5'));var querystring=require(_0x2e74('0xb'));var Papa=require(_0x2e74('0xc'));var Redis=require(_0x2e74('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e74('0xe'));var logger=require(_0x2e74('0xf'))(_0x2e74('0x10'));var utils=require(_0x2e74('0x11'));var config=require(_0x2e74('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2e74('0x13')](config[_0x2e74('0x14')],{'host':_0x2e74('0x15'),'port':0x18eb});var socket=require(_0x2e74('0x16'))(new Redis(config[_0x2e74('0x14')]));require('./smsMessage.socket')[_0x2e74('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x2e74('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x10d0ef,_0xe37538,_0x17c1ca,_0x21b6d3){return new BPromise(function(_0x428bce,_0x4ec17e){var _0xcd771e=_0x21b6d3||client;return _0xcd771e[_0x2e74('0x19')](_0x10d0ef,_0x17c1ca)[_0x2e74('0x1a')](function(_0x41c006){logger[_0x2e74('0x1b')](_0x2e74('0x1c'),_0xe37538,'request\x20sent');logger['debug'](_0x2e74('0x1d'),_0xe37538,_0x2e74('0x1e'),JSON['stringify'](_0x41c006));if(_0x41c006[_0x2e74('0x1f')]){if(_0x41c006['error'][_0x2e74('0x20')]===0x1f4){logger[_0x2e74('0x1f')](_0x2e74('0x1c'),_0xe37538,_0x41c006[_0x2e74('0x1f')][_0x2e74('0x21')]);return _0x4ec17e(_0x41c006[_0x2e74('0x1f')][_0x2e74('0x21')]);}logger[_0x2e74('0x1f')]('SmsMessage,\x20%s,\x20%s',_0xe37538,_0x41c006[_0x2e74('0x1f')][_0x2e74('0x21')]);return _0x428bce(_0x41c006[_0x2e74('0x1f')]['message']);}else{logger[_0x2e74('0x1b')]('SmsMessage,\x20%s,\x20%s',_0xe37538,_0x2e74('0x1e'));_0x428bce(_0x41c006[_0x2e74('0x22')][_0x2e74('0x21')]);}})[_0x2e74('0x23')](function(_0x3db17a){logger[_0x2e74('0x1f')](_0x2e74('0x1c'),_0xe37538,_0x3db17a);_0x4ec17e(_0x3db17a);});});}function respondWithStatusCode(_0x3b1191,_0x4cfb14){_0x4cfb14=_0x4cfb14||0xcc;return function(_0x10b4b6){if(_0x10b4b6){return _0x3b1191[_0x2e74('0x24')](_0x4cfb14);}return _0x3b1191[_0x2e74('0x25')](_0x4cfb14)[_0x2e74('0x26')]();};}function respondWithResult(_0x39b177,_0x365315){_0x365315=_0x365315||0xc8;return function(_0x5850c8){if(_0x5850c8){return _0x39b177[_0x2e74('0x25')](_0x365315)[_0x2e74('0x27')](_0x5850c8);}};}function respondWithFilteredResult(_0x159a88,_0x210ab4){return function(_0x3b6ff2){if(_0x3b6ff2){var _0x2d3f49=typeof _0x210ab4[_0x2e74('0x28')]===_0x2e74('0x29')&&typeof _0x210ab4[_0x2e74('0x2a')]===_0x2e74('0x29');var _0x46704e=_0x3b6ff2[_0x2e74('0x2b')];var _0x2f7b6f=_0x2d3f49?0x0:_0x210ab4[_0x2e74('0x28')];var _0x196d98=_0x2d3f49?_0x3b6ff2['count']:_0x210ab4[_0x2e74('0x28')]+_0x210ab4[_0x2e74('0x2a')];var _0x4540bb;if(_0x196d98>=_0x46704e){_0x196d98=_0x46704e;_0x4540bb=0xc8;}else{_0x4540bb=0xce;}_0x159a88[_0x2e74('0x25')](_0x4540bb);return _0x159a88[_0x2e74('0x2c')](_0x2e74('0x2d'),_0x2f7b6f+'-'+_0x196d98+'/'+_0x46704e)[_0x2e74('0x27')](_0x3b6ff2);}return null;};}function patchUpdates(_0x18c119){return function(_0x3d5ce8){try{jsonpatch['apply'](_0x3d5ce8,_0x18c119,!![]);}catch(_0x489844){return BPromise[_0x2e74('0x2e')](_0x489844);}return _0x3d5ce8[_0x2e74('0x2f')]();};}function saveUpdates(_0x3f58ea,_0x2dd940){return function(_0x530e28){if(_0x530e28){return _0x530e28[_0x2e74('0x30')](_0x3f58ea)[_0x2e74('0x1a')](function(_0x335248){return _0x335248;});}return null;};}function removeEntity(_0x51ec4e,_0x1d48fe){return function(_0x269729){if(_0x269729){return _0x269729[_0x2e74('0x31')]()[_0x2e74('0x1a')](function(){_0x51ec4e[_0x2e74('0x25')](0xcc)[_0x2e74('0x26')]();});}};}function handleEntityNotFound(_0x5d1fdc,_0x3ea583){return function(_0x5d4a35){if(!_0x5d4a35){_0x5d1fdc[_0x2e74('0x24')](0x194);}return _0x5d4a35;};}function handleError(_0x4f6c48,_0x51db8a){_0x51db8a=_0x51db8a||0x1f4;return function(_0x5c693b){logger['error'](_0x5c693b[_0x2e74('0x32')]);if(_0x5c693b[_0x2e74('0x33')]){delete _0x5c693b[_0x2e74('0x33')];}_0x4f6c48['status'](_0x51db8a)[_0x2e74('0x34')](_0x5c693b);};}exports[_0x2e74('0x35')]=function(_0x20df7c,_0x3d00c4){var _0x2a9076={},_0x105f9c={},_0x293ce7={'count':0x0,'rows':[]};var _0x2dad52=_['map'](db[_0x2e74('0x36')][_0x2e74('0x37')],function(_0x2b9d96){return{'name':_0x2b9d96[_0x2e74('0x38')],'type':_0x2b9d96['type'][_0x2e74('0x39')]};});_0x105f9c[_0x2e74('0x3a')]=_['map'](_0x2dad52,_0x2e74('0x33'));_0x105f9c[_0x2e74('0x3b')]=_['keys'](_0x20df7c['query']);_0x105f9c['filters']=_[_0x2e74('0x3c')](_0x105f9c[_0x2e74('0x3a')],_0x105f9c[_0x2e74('0x3b')]);_0x2a9076[_0x2e74('0x3d')]=_[_0x2e74('0x3c')](_0x105f9c[_0x2e74('0x3a')],qs[_0x2e74('0x3e')](_0x20df7c[_0x2e74('0x3b')]['fields']));_0x2a9076[_0x2e74('0x3d')]=_0x2a9076[_0x2e74('0x3d')][_0x2e74('0x3f')]?_0x2a9076[_0x2e74('0x3d')]:_0x105f9c[_0x2e74('0x3a')];if(!_0x20df7c[_0x2e74('0x3b')][_0x2e74('0x40')](_0x2e74('0x41'))){_0x2a9076[_0x2e74('0x2a')]=qs[_0x2e74('0x2a')](_0x20df7c[_0x2e74('0x3b')]['limit']);_0x2a9076['offset']=qs[_0x2e74('0x28')](_0x20df7c[_0x2e74('0x3b')]['offset']);}_0x2a9076[_0x2e74('0x42')]=qs['sort'](_0x20df7c[_0x2e74('0x3b')][_0x2e74('0x43')]);_0x2a9076['where']=qs[_0x2e74('0x44')](_[_0x2e74('0x45')](_0x20df7c[_0x2e74('0x3b')],_0x105f9c[_0x2e74('0x44')]),_0x2dad52);if(_0x20df7c[_0x2e74('0x3b')][_0x2e74('0x46')]){_0x2a9076[_0x2e74('0x47')]=_['merge'](_0x2a9076[_0x2e74('0x47')],{'$or':_[_0x2e74('0x48')](_0x2dad52,function(_0x2a74c5){if(_0x2a74c5['type']!==_0x2e74('0x49')){var _0x41fd7c={};_0x41fd7c[_0x2a74c5['name']]={'$like':'%'+_0x20df7c[_0x2e74('0x3b')][_0x2e74('0x46')]+'%'};return _0x41fd7c;}})});}_0x2a9076=_[_0x2e74('0x4a')]({},_0x2a9076,_0x20df7c['options']);var _0x20b422={'where':_0x2a9076[_0x2e74('0x47')]};return db[_0x2e74('0x36')][_0x2e74('0x2b')](_0x20b422)[_0x2e74('0x1a')](function(_0x49bdd1){_0x293ce7['count']=_0x49bdd1;if(_0x20df7c[_0x2e74('0x3b')][_0x2e74('0x4b')]){_0x2a9076[_0x2e74('0x4c')]=[{'all':!![]}];}return db['SmsMessage'][_0x2e74('0x4d')](_0x2a9076);})[_0x2e74('0x1a')](function(_0x4de67d){_0x293ce7[_0x2e74('0x4e')]=_0x4de67d;return _0x293ce7;})[_0x2e74('0x1a')](respondWithFilteredResult(_0x3d00c4,_0x2a9076))['catch'](handleError(_0x3d00c4,null));};exports[_0x2e74('0x4f')]=function(_0x597998,_0x3b2a44){var _0x5e59b9={'raw':!![],'where':{'id':_0x597998[_0x2e74('0x50')]['id']}},_0x5885d0={};_0x5885d0[_0x2e74('0x3a')]=_['keys'](db[_0x2e74('0x36')][_0x2e74('0x37')]);_0x5885d0[_0x2e74('0x3b')]=_[_0x2e74('0x51')](_0x597998[_0x2e74('0x3b')]);_0x5885d0['filters']=_[_0x2e74('0x3c')](_0x5885d0[_0x2e74('0x3a')],_0x5885d0[_0x2e74('0x3b')]);_0x5e59b9[_0x2e74('0x3d')]=_[_0x2e74('0x3c')](_0x5885d0[_0x2e74('0x3a')],qs['fields'](_0x597998[_0x2e74('0x3b')][_0x2e74('0x3e')]));_0x5e59b9[_0x2e74('0x3d')]=_0x5e59b9[_0x2e74('0x3d')][_0x2e74('0x3f')]?_0x5e59b9[_0x2e74('0x3d')]:_0x5885d0[_0x2e74('0x3a')];if(_0x597998[_0x2e74('0x3b')][_0x2e74('0x4b')]){_0x5e59b9[_0x2e74('0x4c')]=[{'all':!![]}];}_0x5e59b9=_[_0x2e74('0x4a')]({},_0x5e59b9,_0x597998[_0x2e74('0x52')]);return db[_0x2e74('0x36')][_0x2e74('0x53')](_0x5e59b9)['then'](handleEntityNotFound(_0x3b2a44,null))[_0x2e74('0x1a')](respondWithResult(_0x3b2a44,null))[_0x2e74('0x23')](handleError(_0x3b2a44,null));};exports[_0x2e74('0x54')]=function(_0x243a7e,_0x26a4c6){return db[_0x2e74('0x36')]['create'](_0x243a7e[_0x2e74('0x55')],{})[_0x2e74('0x1a')](respondWithResult(_0x26a4c6,0xc9))[_0x2e74('0x23')](handleError(_0x26a4c6,null));};exports['update']=function(_0x514ab0,_0xf9efd6){if(_0x514ab0[_0x2e74('0x55')]['id']){delete _0x514ab0[_0x2e74('0x55')]['id'];}return db['SmsMessage'][_0x2e74('0x53')]({'where':{'id':_0x514ab0['params']['id']}})[_0x2e74('0x1a')](handleEntityNotFound(_0xf9efd6,null))[_0x2e74('0x1a')](saveUpdates(_0x514ab0[_0x2e74('0x55')],null))['then'](respondWithResult(_0xf9efd6,null))['catch'](handleError(_0xf9efd6,null));};exports[_0x2e74('0x31')]=function(_0x82396c,_0x396164){return db[_0x2e74('0x36')]['find']({'where':{'id':_0x82396c[_0x2e74('0x50')]['id']}})[_0x2e74('0x1a')](handleEntityNotFound(_0x396164,null))[_0x2e74('0x1a')](removeEntity(_0x396164,null))['catch'](handleError(_0x396164,null));};exports[_0x2e74('0x56')]=function(_0x3c201d,_0xa726d8){return db[_0x2e74('0x36')][_0x2e74('0x56')]()[_0x2e74('0x1a')](respondWithResult(_0xa726d8,null))[_0x2e74('0x23')](handleError(_0xa726d8,null));};var interaction_log=require(_0x2e74('0xf'))(_0x2e74('0x57'));exports['accept']=function(_0x1233d5,_0x34ea1e,_0x22dfef){var _0x12aa18={'agent':{},'channel':_0x2e74('0x58')};if(_0x1233d5[_0x2e74('0x55')]['id']){delete _0x1233d5[_0x2e74('0x55')]['id'];}_0x1233d5[_0x2e74('0x55')][_0x2e74('0x59')]=!![];_0x1233d5[_0x2e74('0x55')][_0x2e74('0x5a')]=moment()[_0x2e74('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1233d5[_0x2e74('0x55')]['UserId']=_0x1233d5[_0x2e74('0x55')][_0x2e74('0x5c')]||_0x1233d5[_0x2e74('0x5d')]['id'];_0x12aa18['agent']['id']=_0x1233d5[_0x2e74('0x55')]['UserId'];return db[_0x2e74('0x36')][_0x2e74('0x53')]({'where':{'id':_0x1233d5[_0x2e74('0x50')]['id'],'UserId':null}})[_0x2e74('0x1a')](handleEntityNotFound(_0x34ea1e,null))[_0x2e74('0x1a')](saveUpdates(_0x1233d5[_0x2e74('0x55')],null))['then'](function(_0x44475f){if(_0x44475f){_0x12aa18[_0x2e74('0x21')]=_0x44475f[_0x2e74('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0x2e74('0x53')]({'where':{'id':_0x44475f['SmsInteractionId']}});}return null;})[_0x2e74('0x1a')](handleEntityNotFound(_0x34ea1e,null))[_0x2e74('0x1a')](function(_0x54f3ec){if(_0x54f3ec){return _0x54f3ec['update']({'UserId':_0x1233d5[_0x2e74('0x55')]['UserId'],'read1stAt':_[_0x2e74('0x5f')](_0x54f3ec['read1stAt'])?moment()[_0x2e74('0x5b')](_0x2e74('0x60')):undefined});}return null;})[_0x2e74('0x1a')](function(_0x208d58){if(_0x208d58){_0x12aa18['interaction']=_0x208d58[_0x2e74('0x5e')]({'plain':!![]});interaction_log[_0x2e74('0x1b')](_0x2e74('0x61'),_0x1233d5['user']['id'],_0x1233d5[_0x2e74('0x5d')][_0x2e74('0x33')],_0x1233d5['user'][_0x2e74('0x62')],_0x12aa18[_0x2e74('0x63')]['id'],_0x1233d5[_0x2e74('0x55')]?JSON[_0x2e74('0x64')](_0x1233d5[_0x2e74('0x55')]):'null');return respondWithRpcPromise(_0x2e74('0x65'),_0x2e74('0x66'),_0x12aa18);}return null;})[_0x2e74('0x1a')](function(_0x4e9419){var _0x1a07de=_0x2e74('0x67')+_0x4e9419[_0x2e74('0x21')][_0x2e74('0x68')];return db[_0x2e74('0x69')]['query'](_0x1a07de,{'type':db['Sequelize'][_0x2e74('0x6a')][_0x2e74('0x6b')],'raw':!![]})[_0x2e74('0x1a')](function(_0x3da85e){return _0x3da85e;});})[_0x2e74('0x1a')](function(_0x1c66b9){if(_0x1c66b9){_0x12aa18[_0x2e74('0x21')][_0x2e74('0x6c')]=_0x1c66b9[0x0];if(!_0x1233d5[_0x2e74('0x55')]['UserId'])return;return db[_0x2e74('0x6d')]['find']({'where':{'id':_0x1233d5['body'][_0x2e74('0x5c')],'role':_0x2e74('0x6e')},'attributes':['id',_0x2e74('0x33'),'fullname',_0x2e74('0x6f'),_0x2e74('0x70')],'raw':!![]});}return null;})['then'](function(_0x2d2e76){if(!_0x2d2e76)return null;_0x12aa18[_0x2e74('0x21')][_0x2e74('0x6e')]=_0x2d2e76;return _0x12aa18;})[_0x2e74('0x1a')](function(_0xb2162b){if(_0xb2162b){if(_0x1233d5[_0x2e74('0x55')][_0x2e74('0x71')]){_0x12aa18[_0x2e74('0x21')]['interface']=util[_0x2e74('0x5b')](_0x2e74('0x72'),_0x1233d5['user'][_0x2e74('0x33')]);_0x12aa18['message'][_0x2e74('0x73')]=_0x12aa18[_0x2e74('0x73')];_0x12aa18[_0x2e74('0x21')][_0x2e74('0x74')]=_0x12aa18[_0x2e74('0x73')];_0x12aa18[_0x2e74('0x21')]['event']='accept';return respondWithRpcPromise(_0x2e74('0x75'),_0x2e74('0x75'),{'event':_0x2e74('0x76'),'message':_0x12aa18[_0x2e74('0x21')]},client9002)['then'](function(){return _0x12aa18;});}return _0x12aa18;}return null;})[_0x2e74('0x1a')](respondWithResult(_0x34ea1e,null))[_0x2e74('0x23')](handleError(_0x34ea1e,null));};var interaction_log=require(_0x2e74('0xf'))(_0x2e74('0x57'));exports[_0x2e74('0x2e')]=function(_0x3807ff,_0x34a1e9,_0x4e5fa4){var _0x2341ec={'agent':{},'channel':'sms'};if(_0x3807ff[_0x2e74('0x55')]['id']){delete _0x3807ff[_0x2e74('0x55')]['id'];}_0x3807ff['body'][_0x2e74('0x5c')]=_0x3807ff[_0x2e74('0x55')][_0x2e74('0x5c')]||_0x3807ff[_0x2e74('0x5d')]['id'];_0x2341ec['agent']['id']=_0x3807ff[_0x2e74('0x55')][_0x2e74('0x5c')];return db[_0x2e74('0x36')][_0x2e74('0x53')]({'where':{'id':_0x3807ff[_0x2e74('0x50')]['id'],'UserId':null}})[_0x2e74('0x1a')](handleEntityNotFound(_0x34a1e9,null))[_0x2e74('0x1a')](function(_0x2c2bad){if(_0x2c2bad){_0x2341ec[_0x2e74('0x21')]=_0x2c2bad['get']({'plain':!![]});return db[_0x2e74('0x77')][_0x2e74('0x53')]({'where':{'id':_0x2c2bad['SmsInteractionId']}});}return null;})[_0x2e74('0x1a')](handleEntityNotFound(_0x34a1e9,null))[_0x2e74('0x1a')](function(_0x120ee9){if(_0x120ee9){_0x2341ec[_0x2e74('0x63')]=_0x120ee9[_0x2e74('0x5e')]({'plain':!![]});interaction_log['info'](_0x2e74('0x78'),_0x3807ff[_0x2e74('0x5d')]['id'],_0x3807ff['user'][_0x2e74('0x33')],_0x3807ff[_0x2e74('0x5d')][_0x2e74('0x62')],_0x2341ec[_0x2e74('0x63')]['id'],_0x3807ff['body']?JSON[_0x2e74('0x64')](_0x3807ff['body']):'null');return respondWithRpcPromise(_0x2e74('0x79'),_0x2e74('0x7a'),_0x2341ec);}return null;})['then'](function(_0x8a2e0f){var _0x1e3a1c=_0x2e74('0x67')+_0x8a2e0f[_0x2e74('0x21')]['ContactId'];return db[_0x2e74('0x69')][_0x2e74('0x3b')](_0x1e3a1c,{'type':db[_0x2e74('0x7b')][_0x2e74('0x6a')][_0x2e74('0x6b')],'raw':!![]})[_0x2e74('0x1a')](function(_0x1ece04){return _0x1ece04;});})[_0x2e74('0x1a')](function(_0x4f4519){if(_0x4f4519){_0x2341ec['message'][_0x2e74('0x6c')]=_0x4f4519[0x0];if(!_0x3807ff[_0x2e74('0x55')][_0x2e74('0x5c')])return;return db['User'][_0x2e74('0x53')]({'where':{'id':_0x3807ff[_0x2e74('0x55')][_0x2e74('0x5c')],'role':_0x2e74('0x6e')},'attributes':['id',_0x2e74('0x33'),_0x2e74('0x7c'),_0x2e74('0x6f'),_0x2e74('0x70')],'raw':!![]});}return null;})[_0x2e74('0x1a')](function(_0xc54d4a){if(!_0xc54d4a)return null;_0x2341ec[_0x2e74('0x21')][_0x2e74('0x6e')]=_0xc54d4a;return _0x2341ec;})[_0x2e74('0x1a')](function(_0x4ce860){if(_0x4ce860){_0x4ce860[_0x2e74('0x21')][_0x2e74('0x7d')]=util[_0x2e74('0x5b')](_0x2e74('0x72'),_0x3807ff[_0x2e74('0x5d')][_0x2e74('0x33')]);_0x4ce860['message']['channel']=_0x2341ec[_0x2e74('0x73')];_0x4ce860['message'][_0x2e74('0x74')]=_0x2341ec['channel'];_0x4ce860[_0x2e74('0x21')]['event']=_0x2e74('0x2e');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x4ce860[_0x2e74('0x21')]},client9002);return _0x2341ec;}return null;})['then'](respondWithResult(_0x34a1e9,null))[_0x2e74('0x23')](handleError(_0x34a1e9,null));};exports[_0x2e74('0x25')]=function(_0x436a34,_0x28e617,_0x4ff22e){if(_0x436a34[_0x2e74('0x55')]['id']){delete _0x436a34[_0x2e74('0x55')]['id'];}var _0x42b597;return db[_0x2e74('0x36')][_0x2e74('0x53')]({'where':{'id':_0x436a34['params']['id']}})[_0x2e74('0x1a')](handleEntityNotFound(_0x28e617,null))[_0x2e74('0x1a')](function(_0x4af966){if(_0x4af966){_0x42b597=_0x4af966;return db[_0x2e74('0x7e')][_0x2e74('0x53')]({'where':{'id':_0x4af966[_0x2e74('0x7f')]}});}})[_0x2e74('0x1a')](handleEntityNotFound(_0x28e617,null))[_0x2e74('0x1a')](function(_0xc94465){if(_0xc94465){logger['debug'](_0x2e74('0x1d'),_0x2e74('0x25'),_0x2e74('0x80'),_0xc94465[_0x2e74('0x81')],util['inspect'](_0x436a34[_0x2e74('0x55')],{'showHidden':![],'depth':null}));switch(_0xc94465[_0x2e74('0x81')]){case'twilio':if(_0x436a34[_0x2e74('0x55')]['MessageSid']&&_0x436a34[_0x2e74('0x55')][_0x2e74('0x82')]===_0x42b597[_0x2e74('0x83')]){return _0x42b597[_0x2e74('0x30')]({'read':!![]});}else{logger[_0x2e74('0x1f')](_0x2e74('0x84'),_0x2e74('0x25'),_0x2e74('0x85'),util[_0x2e74('0x86')](_0x436a34[_0x2e74('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2e74('0x87'):if(_0x436a34['body'][_0x2e74('0x88')]&&_0x436a34[_0x2e74('0x55')]['MessageUUID']===_0x42b597[_0x2e74('0x83')]&&_[_0x2e74('0x89')]([_0x2e74('0x8a'),_0x2e74('0x8b')],_0x436a34[_0x2e74('0x55')][_0x2e74('0x8c')])>=0x0){return _0x42b597[_0x2e74('0x30')]({'read':!![]});}else{logger[_0x2e74('0x1f')](_0x2e74('0x84'),_0x2e74('0x25'),_0x2e74('0x8d'),util['inspect'](_0x436a34[_0x2e74('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2e74('0x8e'):var _0x285dcf=_0x436a34[_0x2e74('0x55')][_0x2e74('0x8f')][0x0];if(_0x285dcf[_0x2e74('0x25')]['groupName']===_0x2e74('0x90')){return _0x42b597[_0x2e74('0x30')]({'read':!![]});}else{logger[_0x2e74('0x1f')](_0x2e74('0x84'),_0x2e74('0x25'),_0x2e74('0x8e'),util['inspect'](_0x436a34[_0x2e74('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x42b597;}})[_0x2e74('0x1a')](respondWithResult(_0x28e617,null))[_0x2e74('0x23')](handleError(_0x28e617,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a46ce44..3147996 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 _0xf781=['events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit'];(function(_0x214b59,_0x53c21a){var _0xec8aec=function(_0xc7738){while(--_0xc7738){_0x214b59['push'](_0x214b59['shift']());}};_0xec8aec(++_0x53c21a);}(_0xf781,0x150));var _0x1f78=function(_0x45a7f2,_0x2483e2){_0x45a7f2=_0x45a7f2-0x0;var _0x38de83=_0xf781[_0x45a7f2];return _0x38de83;};'use strict';var EventEmitter=require(_0x1f78('0x0'));var SmsMessage=require(_0x1f78('0x1'))['db'][_0x1f78('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1f78('0x3')](0x0);var events={'afterCreate':_0x1f78('0x4'),'afterUpdate':'update','afterDestroy':_0x1f78('0x5')};function emitEvent(_0x55e18e){return function(_0x2849f0,_0x65d826,_0x2c0dea){SmsMessageEvents[_0x1f78('0x6')](_0x55e18e+':'+_0x2849f0['id'],_0x2849f0);SmsMessageEvents[_0x1f78('0x6')](_0x55e18e,_0x2849f0);_0x2c0dea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xf3ad=['../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x54f8ab,_0x22d4d9){var _0x2744c1=function(_0x16ac0d){while(--_0x16ac0d){_0x54f8ab['push'](_0x54f8ab['shift']());}};_0x2744c1(++_0x22d4d9);}(_0xf3ad,0xc6));var _0xdf3a=function(_0x34ec52,_0x5ae674){_0x34ec52=_0x34ec52-0x0;var _0x2c0db8=_0xf3ad[_0x34ec52];return _0x2c0db8;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xdf3a('0x0'))['db'][_0xdf3a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdf3a('0x2')](0x0);var events={'afterCreate':_0xdf3a('0x3'),'afterUpdate':'update','afterDestroy':_0xdf3a('0x4')};function emitEvent(_0x3dcd07){return function(_0x58706e,_0x5ab511,_0x5e4665){SmsMessageEvents['emit'](_0x3dcd07+':'+_0x58706e['id'],_0x58706e);SmsMessageEvents[_0xdf3a('0x5')](_0x3dcd07,_0x58706e);_0x5e4665(null);};}for(var e in events){if(events[_0xdf3a('0x6')](e)){var event=events[e];SmsMessage[_0xdf3a('0x7')](e,emitEvent(event));}}module[_0xdf3a('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 aa9baab..32a1f05 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 _0x1b72=['username','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','./smsMessage.attributes','exports','SmsMessage','fti_sms_messages','body','models','get','toLowerCase','direction','out','isNil','SmsInteractionId','SmsInteraction','createdAt','error','secret','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','update','catch','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken'];(function(_0x2bed19,_0x404a69){var _0x1a65b4=function(_0x22b4d2){while(--_0x22b4d2){_0x2bed19['push'](_0x2bed19['shift']());}};_0x1a65b4(++_0x404a69);}(_0x1b72,0x1a0));var _0x21b7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1b72[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x21b7('0x0'));var util=require(_0x21b7('0x1'));var logger=require(_0x21b7('0x2'))(_0x21b7('0x3'));var moment=require('moment');var BPromise=require(_0x21b7('0x4'));var rp=require(_0x21b7('0x5'));var fs=require('fs');var path=require(_0x21b7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21b7('0x7'));module[_0x21b7('0x8')]=function(_0x1ff7d3,_0x224920){return _0x1ff7d3['define'](_0x21b7('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x21b7('0xa'),'fields':[_0x21b7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x102871,_0x3fe9c5,_0xdcea6d){var _0x9857d6=_0x1ff7d3[_0x21b7('0xc')];var _0x57675c=_0x102871[_0x21b7('0xd')]({'plain':!![]});if(_0x57675c['direction'][_0x21b7('0xe')]()==='in'||_0x57675c[_0x21b7('0xf')][_0x21b7('0xe')]()===_0x21b7('0x10')&&!_0x57675c['secret']&&!_[_0x21b7('0x11')](_0x57675c['UserId'])&&!_[_0x21b7('0x11')](_0x57675c[_0x21b7('0x12')])){_0x9857d6[_0x21b7('0x13')]['findOne']({'where':{'id':_0x57675c[_0x21b7('0x12')]}})['then'](function(_0x2d409a){if(_0x2d409a){_0x2d409a['update']({'lastMsgAt':_0x57675c[_0x21b7('0x14')],'lastMsgDirection':_0x57675c['direction'][_0x21b7('0xe')]()});}})['catch'](function(_0x21a833){console[_0x21b7('0x15')](_0x21a833);});}if(_0x57675c[_0x21b7('0xf')]===_0x21b7('0x10')&&!_0x57675c[_0x21b7('0x16')]){var _0x592815;_0x9857d6[_0x21b7('0x17')][_0x21b7('0x18')]({'where':{'id':_0x57675c[_0x21b7('0x19')]},'raw':!![]})[_0x21b7('0x1a')](function(_0x3635ee){_0x592815=_0x3635ee;if(_0x592815&&_0x592815['type']){switch(_0x592815[_0x21b7('0x1b')]){case'twilio':var _0x29d16e=require(_0x21b7('0x1c'));if(_0x592815['accountSid']&&_0x592815[_0x21b7('0x1d')]&&_0x592815[_0x21b7('0x1e')]){var _0x20973f=new _0x29d16e(_0x592815[_0x21b7('0x1f')],_0x592815[_0x21b7('0x1d')]);_0x20973f[_0x21b7('0x20')][_0x21b7('0x21')]({'body':_0x57675c[_0x21b7('0xb')],'to':_0x57675c[_0x21b7('0x1e')],'from':_0x592815[_0x21b7('0x1e')],'statusCallback':_0x592815[_0x21b7('0x22')]+_0x21b7('0x23')+_0x57675c['id']+_0x21b7('0x24')+_0x592815[_0x21b7('0x25')]})[_0x21b7('0x1a')](function(_0x3168e8){if(_0x3168e8[_0x21b7('0x26')]){return _0x102871[_0x21b7('0x27')]({'messageId':_0x3168e8[_0x21b7('0x26')]});}})[_0x21b7('0x28')](function(_0x512573){logger[_0x21b7('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b7('0x29'),'twilio',util['inspect'](_0x512573,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x21b7('0x2b'):var _0x196221=_0x21b7('0x2c');if(_0x592815['username']&&_0x592815[_0x21b7('0x2d')]){var _0xb4eb8f={'recipient':[_0x57675c[_0x21b7('0x1e')]],'message':_0x57675c[_0x21b7('0xb')],'message_type':_0x592815[_0x21b7('0x2e')]};if(_0x592815[_0x21b7('0x2e')]&&_0x592815[_0x21b7('0x2e')]!=='SI'){_0xb4eb8f[_0x21b7('0x2f')]=_0x592815[_0x21b7('0x1e')];}var _0x3ab5dd={'url':_0x196221+_0x21b7('0x30')+_0x592815['username']+_0x21b7('0x31')+_0x592815[_0x21b7('0x2d')],'method':_0x21b7('0x32')};rp(_0x3ab5dd)[_0x21b7('0x1a')](function(_0x35e903){var _0x220b03=_0x35e903[_0x21b7('0x33')](';');var _0x36bf0f={'user_key':_0x220b03[0x0],'session_key':_0x220b03[0x1]};_0x3ab5dd={'url':_0x196221+_0x21b7('0x34'),'method':_0x21b7('0x35'),'headers':{'user_key':_0x36bf0f['user_key'],'Session_key':_0x36bf0f[_0x21b7('0x36')]},'json':!![],'body':_0xb4eb8f};return rp(_0x3ab5dd);})['then'](function(_0x516f15){if(_0x516f15[_0x21b7('0x37')]>=0x1){var _0x23240f={'messageId':_0x516f15['internal_order_id']};if(_0x592815[_0x21b7('0x2e')]!=='GP'||!_0x592815[_0x21b7('0x38')]){_0x23240f[_0x21b7('0x39')]=!![];}return _0x102871[_0x21b7('0x27')](_0x23240f);}else{return logger['error'](_0x21b7('0x2a'),'afterCreate','skebby',util[_0x21b7('0x3a')](_0x516f15,{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x10b928){return logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x2b'),util['inspect'](_0x10b928,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x21b7('0x2a'),_0x21b7('0x29'),'skebby',_0x21b7('0x3b'));}break;case _0x21b7('0x3c'):if(_0x592815['authToken']){var _0x1e29e3={'recipient':_0x57675c[_0x21b7('0x1e')],'message':_0x57675c['body'],'sender':_0x592815['senderString']||_0x592815[_0x21b7('0x1e')],'authorization':_0x592815[_0x21b7('0x1d')]};var _0x3fe9c5={'method':_0x21b7('0x35'),'uri':_0x21b7('0x3d'),'body':_0x1e29e3,'json':!![]};rp(_0x3fe9c5)['then'](function(_0x57f431){var _0x270c42={'messageId':_0x57f431[_0x21b7('0x3e')]};if(!_0x592815['deliveryReport']){_0x270c42[_0x21b7('0x39')]=!![];}return _0x102871[_0x21b7('0x27')](_0x270c42);})[_0x21b7('0x28')](function(_0x3a3a9e){logger[_0x21b7('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b7('0x29'),_0x21b7('0x3c'),util[_0x21b7('0x3a')](_0x3a3a9e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x21b7('0x2a'),'afterCreate','connectel',_0x21b7('0x3f'));}break;case'clicksend':if(_0x592815[_0x21b7('0x40')]&&_0x592815[_0x21b7('0x2d')]){var _0x1e29e3={'messages':[{'source':_0x21b7('0x41'),'to':_0x57675c[_0x21b7('0x1e')],'body':_0x57675c[_0x21b7('0xb')],'from':_0x592815[_0x21b7('0x42')]||_0x592815['phone']}]};var _0x2ee347=util[_0x21b7('0x43')](_0x21b7('0x44'),_0x592815[_0x21b7('0x40')],_0x592815['password']);var _0x3fe9c5={'method':'POST','uri':_0x21b7('0x45'),'body':_0x1e29e3,'headers':{'Authorization':util[_0x21b7('0x43')](_0x21b7('0x46'),new Buffer(_0x2ee347)[_0x21b7('0x47')](_0x21b7('0x48')))},'json':!![]};rp(_0x3fe9c5)[_0x21b7('0x1a')](function(_0x5a5ad9){if(_0x5a5ad9[_0x21b7('0x49')]>=0xc8&&_0x5a5ad9[_0x21b7('0x49')]<=0xce){if(_0x5a5ad9[_0x21b7('0x4a')]&&_0x5a5ad9[_0x21b7('0x4a')]['queued_count']>0x0){var _0x4a5da3=_['head'](_0x5a5ad9[_0x21b7('0x4a')][_0x21b7('0x20')]);var _0x418aef={'messageId':_0x4a5da3[_0x21b7('0x4b')]};if(!_0x592815['deliveryReport']){_0x418aef['read']=!![];}return _0x102871[_0x21b7('0x27')](_0x418aef);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b7('0x29'),'clickSend',util[_0x21b7('0x3a')](_0x5a5ad9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x21b7('0x2a'),'afterCreate',_0x21b7('0x4c'),util[_0x21b7('0x3a')](_0x5a5ad9,{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x46cd39){logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x4c'),util['inspect'](_0x46cd39,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),'clickSend',_0x21b7('0x3b'));}break;case _0x21b7('0x4d'):if(_0x592815[_0x21b7('0x4e')]&&_0x592815[_0x21b7('0x1d')]){var _0x1e29e3={'dst':_0x57675c[_0x21b7('0x1e')],'text':_0x57675c['body'],'src':_0x592815[_0x21b7('0x42')]||_0x592815[_0x21b7('0x1e')],'url':_0x592815['remote']+_0x21b7('0x23')+_0x57675c['id']+_0x21b7('0x24')+_0x592815['token']};var _0x2ee347=util[_0x21b7('0x43')](_0x21b7('0x44'),_0x592815[_0x21b7('0x4e')],_0x592815[_0x21b7('0x1d')]);var _0x3fe9c5={'method':_0x21b7('0x35'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x592815['authId']),'body':_0x1e29e3,'headers':{'Authorization':util[_0x21b7('0x43')](_0x21b7('0x46'),new Buffer(_0x2ee347)[_0x21b7('0x47')](_0x21b7('0x48')))},'json':!![]};rp(_0x3fe9c5)[_0x21b7('0x1a')](function(_0x5cc7bf){var _0x4568ac={'messageId':_0x5cc7bf[_0x21b7('0x4f')][0x0]};return _0x102871[_0x21b7('0x27')](_0x4568ac);})[_0x21b7('0x28')](function(_0x1ddfb8){logger['error'](_0x21b7('0x2a'),_0x21b7('0x29'),'plivo',util[_0x21b7('0x3a')](_0x1ddfb8,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),'afterCreate',_0x21b7('0x4d'),_0x21b7('0x50'));}break;case _0x21b7('0x51'):if(_0x592815[_0x21b7('0x40')]&&_0x592815['password']){if(_0x592815[_0x21b7('0x52')]){var _0x2bc339={'method':_0x21b7('0x35'),'uri':_0x592815[_0x21b7('0x52')]+_0x21b7('0x53'),'body':{'username':_0x592815[_0x21b7('0x40')],'password':_0x592815['password']},'json':!![]};return rp(_0x2bc339)[_0x21b7('0x1a')](function(_0x5e89cb){var _0x57548c={'method':_0x21b7('0x35'),'uri':_0x592815[_0x21b7('0x52')]+_0x21b7('0x54'),'body':{'messages':[{'from':_0x592815[_0x21b7('0x1e')],'destinations':[{'to':_0x57675c['phone']}],'text':_0x57675c[_0x21b7('0xb')],'notifyUrl':_0x592815[_0x21b7('0x22')]+'/api/sms/messages/'+_0x57675c['id']+_0x21b7('0x24')+_0x592815[_0x21b7('0x25')],'notifyContentType':'application/json','callbackData':_0x592815[_0x21b7('0x1e')]+';'+_0x57675c[_0x21b7('0xb')]}]},'headers':{'Authorization':_0x21b7('0x55')+_0x5e89cb[_0x21b7('0x25')]},'json':!![]};return rp(_0x57548c)[_0x21b7('0x1a')](function(_0x4c0ad2){if(_0x4c0ad2['messages']){var _0x388410={'messageId':_0x4c0ad2['messages'][0x0]['messageId']};if(!_0x592815[_0x21b7('0x38')]){_0x388410[_0x21b7('0x39')]=!![];}return _0x102871[_0x21b7('0x27')](_0x388410);}else{return logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x51'),util[_0x21b7('0x3a')](_0x4c0ad2,{'showHidden':![],'depth':null}));}});})[_0x21b7('0x28')](function(_0x36ed81){return logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x51'),util[_0x21b7('0x3a')](_0x36ed81,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x21b7('0x2a'),_0x21b7('0x29'),'infobip',_0x21b7('0x56'));}}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x51'),_0x21b7('0x3b'));}break;case _0x21b7('0x57'):var _0x679804=require(_0x21b7('0x58'));if(_0x592815['apiKey']){var _0x14e16e={};_0x14e16e[_0x21b7('0x59')]=_0x592815[_0x21b7('0x40')];_0x14e16e[_0x21b7('0x1e')]=_0x57675c['phone'];_0x14e16e['sender']=_0x592815[_0x21b7('0x1e')];_0x14e16e[_0x21b7('0x5a')]=_0x57675c[_0x21b7('0xb')];_0x14e16e[_0x21b7('0x5b')]=+new Date();var _0x5eac35='';var _0xe61652='';var _0x2fd000=Object[_0x21b7('0x5c')](_0x14e16e);_0x2fd000[_0x21b7('0x5d')]();for(var _0x4a8f89=0x0;_0x4a8f89<_0x2fd000[_0x21b7('0x5e')];_0x4a8f89++){if(_0x5eac35!=''){_0x5eac35+='&';}_0x5eac35+=_0x2fd000[_0x4a8f89]+'='+encodeURIComponent(_0x14e16e[_0x2fd000[_0x4a8f89]]);_0xe61652+=_0x14e16e[_0x2fd000[_0x4a8f89]];}_0xe61652+=_0x592815['apiKey'];_0xe61652=_0x679804[_0x21b7('0x5f')](_0x21b7('0x60'))['update'](_0xe61652)[_0x21b7('0x61')](_0x21b7('0x62'));if(_0x5eac35!==''){_0x5eac35+='&';}_0x5eac35+='signature='+_0xe61652;var _0x3ab5dd={'method':_0x21b7('0x32'),'uri':_0x592815[_0x21b7('0x52')]+'/external/get/send.php?'+_0x5eac35,'json':!![]};return rp(_0x3ab5dd)[_0x21b7('0x1a')](function(_0x9e25d8){var _0x4ae987=Object['keys'](_0x9e25d8);if(_0x9e25d8[_0x4ae987[0x0]][_0x21b7('0x15')]&&parseInt(_0x9e25d8[_0x4ae987[0x0]][_0x21b7('0x15')])===0x0){var _0x17ce88={'messageId':_0x9e25d8[_0x4ae987[0x0]]['id_sms']};if(!_0x592815[_0x21b7('0x38')]){_0x17ce88[_0x21b7('0x39')]=!![];}return _0x102871[_0x21b7('0x27')](_0x17ce88);}else{return logger['error'](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x57'),util[_0x21b7('0x3a')](_0x9e25d8[_0x21b7('0x15')],{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x4cb029){return logger[_0x21b7('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b7('0x29'),_0x21b7('0x57'),util[_0x21b7('0x3a')](_0x4cb029,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),'afterCreate',_0x21b7('0x57'),_0x21b7('0x63'));}break;case _0x21b7('0x64'):if(_0x592815[_0x21b7('0x65')]){var _0x24d4e1={'method':_0x21b7('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x592815['apiKey']},'body':{'content':_0x57675c[_0x21b7('0xb')],'to':[_0x57675c['phone']],'from':_0x592815['phone'],'binary':![],'clientMessageId':_0x21b7('0x66'),'charset':_0x21b7('0x67')},'json':!![]};rp(_0x24d4e1)['then'](function(_0x3e01ee){if(!_0x3e01ee[_0x21b7('0x15')]){var _0x3bc492={'messageId':_0x3e01ee['messages'][0x0]['apiMessageId']};if(!_0x592815[_0x21b7('0x38')]){_0x3bc492[_0x21b7('0x39')]=!![];}return _0x102871[_0x21b7('0x27')](_0x3bc492);}else{return logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x64'),util[_0x21b7('0x3a')](_0x3e01ee[_0x21b7('0x15')],{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x246b9f){return logger[_0x21b7('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x21b7('0x29'),'clickatell',util[_0x21b7('0x3a')](_0x246b9f,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x64'),_0x21b7('0x63'));}break;case'bandwidth':if(_0x592815[_0x21b7('0x40')]&&_0x592815[_0x21b7('0x2d')]){var _0x2ee347=util['format'](_0x21b7('0x44'),_0x592815[_0x21b7('0x40')],_0x592815[_0x21b7('0x2d')]);var _0x3fe9c5={'method':_0x21b7('0x35'),'uri':_0x21b7('0x68')+_0x592815[_0x21b7('0x69')]+_0x21b7('0x6a'),'body':{'to':[_0x57675c[_0x21b7('0x1e')]],'text':_0x57675c['body'],'from':_0x592815['phone'],'applicationId':_0x592815[_0x21b7('0x6b')]},'headers':{'Authorization':util[_0x21b7('0x43')]('Basic\x20%s',new Buffer(_0x2ee347)[_0x21b7('0x47')](_0x21b7('0x48')))},'json':!![]};rp(_0x3fe9c5)[_0x21b7('0x1a')](function(_0x8e5f65){if(_0x8e5f65['id']){var _0x39413d={'messageId':_0x8e5f65['id']};return _0x102871[_0x21b7('0x27')](_0x39413d);}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),'bandwidth',util[_0x21b7('0x3a')](_0x8e5f65,{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x50b68d){logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),_0x21b7('0x6c'),util[_0x21b7('0x3a')](_0x50b68d,{'showHidden':![],'depth':null}));});}else{logger[_0x21b7('0x15')](_0x21b7('0x2a'),'afterCreate','bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x21b7('0x6d'):if(_0x592815['apiKey']){var _0x16b075={};var _0x3ab5dd={'method':_0x21b7('0x35'),'uri':_0x21b7('0x6e'),'headers':{'Authorization':_0x21b7('0x6f')+_0x592815['apiKey'],'Content-Type':_0x21b7('0x70')},'body':{'from':_0x592815[_0x21b7('0x1e')],'to':_0x57675c[_0x21b7('0x1e')],'text':_0x57675c['body']},'json':!![]};return rp(_0x3ab5dd)[_0x21b7('0x1a')](function(_0x158120){if(_0x158120[_0x21b7('0x71')]==0xca){_0x16b075['message']=_0x158120;var _0xbc0cae={'method':_0x21b7('0x35'),'uri':_0x21b7('0x72'),'headers':{'Authorization':_0x21b7('0x6f')+_0x592815[_0x21b7('0x65')],'Content-Type':_0x21b7('0x70')},'body':{'refid':_0x16b075[_0x21b7('0x73')][_0x21b7('0x74')]},'json':!![]};return rp(_0xbc0cae)[_0x21b7('0x1a')](function(_0x22c55c){_0x16b075[_0x21b7('0x75')]=_0x22c55c;var _0x4de7db={'messageId':_0x16b075[_0x21b7('0x73')][_0x21b7('0x74')],'read':!![]};return _0x102871[_0x21b7('0x27')](_0x4de7db);});}else{return logger['error'](_0x21b7('0x2a'),'afterCreate',_0x21b7('0x6d'),util['inspect'](_0x158120,{'showHidden':![],'depth':null}));}})[_0x21b7('0x28')](function(_0x147d5f){return logger[_0x21b7('0x15')](_0x21b7('0x2a'),_0x21b7('0x29'),'intelepeer',util[_0x21b7('0x3a')](_0x147d5f,{'showHidden':![],'depth':null}));});}else{return logger[_0x21b7('0x15')](_0x21b7('0x2a'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x21b7('0x76')](function(){_0xdcea6d();});}else{_0xdcea6d();}}},'charset':'utf8mb4','collate':_0x21b7('0x77')});}; \ No newline at end of file +var _0xd5b8=['clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','Basic\x20%s','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','token','sid','update','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','total_sent','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','clickSend','plivo','authId','senderString','/api/sms/messages/','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/sms/2/text/advanced','remote','application/json','IBSSO\x20','csc','login','sender','text','keys','sort','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0xd5b8,0xfe));var _0x8d5b=function(_0x5b0295,_0x53f211){_0x5b0295=_0x5b0295-0x0;var _0x34a7d0=_0xd5b8[_0x5b0295];return _0x34a7d0;};'use strict';var _=require(_0x8d5b('0x0'));var util=require(_0x8d5b('0x1'));var logger=require(_0x8d5b('0x2'))(_0x8d5b('0x3'));var moment=require(_0x8d5b('0x4'));var BPromise=require(_0x8d5b('0x5'));var rp=require(_0x8d5b('0x6'));var fs=require('fs');var path=require(_0x8d5b('0x7'));var rimraf=require(_0x8d5b('0x8'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x2e4016,_0x221703){return _0x2e4016[_0x8d5b('0x9')](_0x8d5b('0xa'),attributes,{'tableName':_0x8d5b('0xb'),'paranoid':![],'indexes':[{'name':_0x8d5b('0xc'),'fields':[_0x8d5b('0xc')]},{'name':_0x8d5b('0xd'),'fields':[_0x8d5b('0xe')],'type':_0x8d5b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x490336,_0x48ecbe,_0x2ee3ab){var _0x540d11=_0x2e4016['models'];var _0x5d9aff=_0x490336[_0x8d5b('0x10')]({'plain':!![]});if(_0x5d9aff['direction'][_0x8d5b('0x11')]()==='in'||_0x5d9aff[_0x8d5b('0x12')][_0x8d5b('0x11')]()===_0x8d5b('0x13')&&!_0x5d9aff[_0x8d5b('0x14')]&&!_[_0x8d5b('0x15')](_0x5d9aff[_0x8d5b('0x16')])&&!_[_0x8d5b('0x15')](_0x5d9aff[_0x8d5b('0x17')])){_0x540d11[_0x8d5b('0x18')]['findOne']({'where':{'id':_0x5d9aff[_0x8d5b('0x17')]}})[_0x8d5b('0x19')](function(_0x3cd50e){if(_0x3cd50e){_0x3cd50e['update']({'lastMsgAt':_0x5d9aff['createdAt'],'lastMsgDirection':_0x5d9aff[_0x8d5b('0x12')][_0x8d5b('0x11')]()});}})[_0x8d5b('0x1a')](function(_0x21803e){console[_0x8d5b('0x1b')](_0x21803e);});}if(_0x5d9aff[_0x8d5b('0x12')]===_0x8d5b('0x13')&&!_0x5d9aff[_0x8d5b('0x14')]){var _0xf1427b;_0x540d11['SmsAccount'][_0x8d5b('0x1c')]({'where':{'id':_0x5d9aff[_0x8d5b('0x1d')]},'raw':!![]})[_0x8d5b('0x19')](function(_0x104dd9){_0xf1427b=_0x104dd9;if(_0xf1427b&&_0xf1427b[_0x8d5b('0x1e')]){switch(_0xf1427b['type']){case'twilio':var _0x40257c=require(_0x8d5b('0x1f'));if(_0xf1427b[_0x8d5b('0x20')]&&_0xf1427b[_0x8d5b('0x21')]&&_0xf1427b[_0x8d5b('0x22')]){var _0x5be8d7=new _0x40257c(_0xf1427b[_0x8d5b('0x20')],_0xf1427b[_0x8d5b('0x21')]);_0x5be8d7[_0x8d5b('0x23')][_0x8d5b('0x24')]({'body':_0x5d9aff[_0x8d5b('0xe')],'to':_0x5d9aff[_0x8d5b('0x22')],'from':_0xf1427b[_0x8d5b('0x22')],'statusCallback':_0xf1427b['remote']+'/api/sms/messages/'+_0x5d9aff['id']+'/status?token='+_0xf1427b[_0x8d5b('0x25')]})[_0x8d5b('0x19')](function(_0xbf31c8){if(_0xbf31c8[_0x8d5b('0x26')]){return _0x490336[_0x8d5b('0x27')]({'messageId':_0xbf31c8[_0x8d5b('0x26')]});}})[_0x8d5b('0x1a')](function(_0x75972d){logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8d5b('0x1f'),util[_0x8d5b('0x28')](_0x75972d,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate','twilio',_0x8d5b('0x2a'));}break;case _0x8d5b('0x2b'):var _0x14a2fd=_0x8d5b('0x2c');if(_0xf1427b[_0x8d5b('0x2d')]&&_0xf1427b[_0x8d5b('0x2e')]){var _0x4e32ae={'recipient':[_0x5d9aff[_0x8d5b('0x22')]],'message':_0x5d9aff['body'],'message_type':_0xf1427b['smsMethod']};if(_0xf1427b[_0x8d5b('0x2f')]&&_0xf1427b[_0x8d5b('0x2f')]!=='SI'){_0x4e32ae['sender']=_0xf1427b[_0x8d5b('0x22')];}var _0x1fc579={'url':_0x14a2fd+_0x8d5b('0x30')+_0xf1427b['username']+_0x8d5b('0x31')+_0xf1427b[_0x8d5b('0x2e')],'method':_0x8d5b('0x32')};rp(_0x1fc579)[_0x8d5b('0x19')](function(_0x59f4e5){var _0x3566e0=_0x59f4e5[_0x8d5b('0x33')](';');var _0x5ed624={'user_key':_0x3566e0[0x0],'session_key':_0x3566e0[0x1]};_0x1fc579={'url':_0x14a2fd+_0x8d5b('0x34'),'method':_0x8d5b('0x35'),'headers':{'user_key':_0x5ed624['user_key'],'Session_key':_0x5ed624['session_key']},'json':!![],'body':_0x4e32ae};return rp(_0x1fc579);})[_0x8d5b('0x19')](function(_0x4737ec){if(_0x4737ec[_0x8d5b('0x36')]>=0x1){var _0x176d05={'messageId':_0x4737ec['internal_order_id']};if(_0xf1427b['smsMethod']!=='GP'||!_0xf1427b['deliveryReport']){_0x176d05['read']=!![];}return _0x490336['update'](_0x176d05);}else{return logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8d5b('0x2b'),util[_0x8d5b('0x28')](_0x4737ec,{'showHidden':![],'depth':null}));}})[_0x8d5b('0x1a')](function(_0x1ba85b){return logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8d5b('0x37'),_0x8d5b('0x2b'),util[_0x8d5b('0x28')](_0x1ba85b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8d5b('0x37'),'skebby',_0x8d5b('0x38'));}break;case _0x8d5b('0x39'):if(_0xf1427b[_0x8d5b('0x21')]){var _0x916885={'recipient':_0x5d9aff['phone'],'message':_0x5d9aff[_0x8d5b('0xe')],'sender':_0xf1427b['senderString']||_0xf1427b[_0x8d5b('0x22')],'authorization':_0xf1427b['authToken']};var _0x48ecbe={'method':_0x8d5b('0x35'),'uri':_0x8d5b('0x3a'),'body':_0x916885,'json':!![]};rp(_0x48ecbe)[_0x8d5b('0x19')](function(_0x33b75e){var _0x4410f9={'messageId':_0x33b75e[_0x8d5b('0x3b')]};if(!_0xf1427b[_0x8d5b('0x3c')]){_0x4410f9[_0x8d5b('0x3d')]=!![];}return _0x490336[_0x8d5b('0x27')](_0x4410f9);})['catch'](function(_0x1c544e){logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'connectel',util[_0x8d5b('0x28')](_0x1c544e,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate','connectel',_0x8d5b('0x3e'));}break;case _0x8d5b('0x3f'):if(_0xf1427b['username']&&_0xf1427b[_0x8d5b('0x2e')]){var _0x916885={'messages':[{'source':'xCALLY\x20Motion','to':_0x5d9aff[_0x8d5b('0x22')],'body':_0x5d9aff[_0x8d5b('0xe')],'from':_0xf1427b['senderString']||_0xf1427b[_0x8d5b('0x22')]}]};var _0x1a38f9=util[_0x8d5b('0x40')]('%s:%s',_0xf1427b[_0x8d5b('0x2d')],_0xf1427b[_0x8d5b('0x2e')]);var _0x48ecbe={'method':'POST','uri':_0x8d5b('0x41'),'body':_0x916885,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1a38f9)[_0x8d5b('0x42')](_0x8d5b('0x43')))},'json':!![]};rp(_0x48ecbe)[_0x8d5b('0x19')](function(_0x7a7b6){if(_0x7a7b6[_0x8d5b('0x44')]>=0xc8&&_0x7a7b6[_0x8d5b('0x44')]<=0xce){if(_0x7a7b6[_0x8d5b('0x45')]&&_0x7a7b6[_0x8d5b('0x45')]['queued_count']>0x0){var _0x503fea=_[_0x8d5b('0x46')](_0x7a7b6[_0x8d5b('0x45')][_0x8d5b('0x23')]);var _0x54ed77={'messageId':_0x503fea['message_id']};if(!_0xf1427b[_0x8d5b('0x3c')]){_0x54ed77[_0x8d5b('0x3d')]=!![];}return _0x490336[_0x8d5b('0x27')](_0x54ed77);}else{logger['error'](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x47'),util['inspect'](_0x7a7b6,{'showHidden':![],'depth':null}));}}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'clickSend',util[_0x8d5b('0x28')](_0x7a7b6,{'showHidden':![],'depth':null}));}})[_0x8d5b('0x1a')](function(_0x411307){logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x47'),util[_0x8d5b('0x28')](_0x411307,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'clickSend',_0x8d5b('0x38'));}break;case _0x8d5b('0x48'):if(_0xf1427b[_0x8d5b('0x49')]&&_0xf1427b[_0x8d5b('0x21')]){var _0x916885={'dst':_0x5d9aff['phone'],'text':_0x5d9aff[_0x8d5b('0xe')],'src':_0xf1427b[_0x8d5b('0x4a')]||_0xf1427b[_0x8d5b('0x22')],'url':_0xf1427b['remote']+_0x8d5b('0x4b')+_0x5d9aff['id']+_0x8d5b('0x4c')+_0xf1427b['token']};var _0x1a38f9=util[_0x8d5b('0x40')](_0x8d5b('0x4d'),_0xf1427b[_0x8d5b('0x49')],_0xf1427b['authToken']);var _0x48ecbe={'method':_0x8d5b('0x35'),'uri':util[_0x8d5b('0x40')](_0x8d5b('0x4e'),_0xf1427b[_0x8d5b('0x49')]),'body':_0x916885,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1a38f9)[_0x8d5b('0x42')](_0x8d5b('0x43')))},'json':!![]};rp(_0x48ecbe)[_0x8d5b('0x19')](function(_0x437737){var _0x5509fb={'messageId':_0x437737['message_uuid'][0x0]};return _0x490336['update'](_0x5509fb);})[_0x8d5b('0x1a')](function(_0x5163a3){logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'plivo',util['inspect'](_0x5163a3,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8d5b('0x37'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x8d5b('0x4f'):if(_0xf1427b['username']&&_0xf1427b['password']){if(_0xf1427b[_0x8d5b('0x50')]){var _0x36fb86={'method':_0x8d5b('0x35'),'uri':_0xf1427b[_0x8d5b('0x50')]+'/auth/1/session','body':{'username':_0xf1427b[_0x8d5b('0x2d')],'password':_0xf1427b[_0x8d5b('0x2e')]},'json':!![]};return rp(_0x36fb86)['then'](function(_0x41499c){var _0x3fbfdc={'method':_0x8d5b('0x35'),'uri':_0xf1427b[_0x8d5b('0x50')]+_0x8d5b('0x51'),'body':{'messages':[{'from':_0xf1427b[_0x8d5b('0x22')],'destinations':[{'to':_0x5d9aff[_0x8d5b('0x22')]}],'text':_0x5d9aff[_0x8d5b('0xe')],'notifyUrl':_0xf1427b[_0x8d5b('0x52')]+_0x8d5b('0x4b')+_0x5d9aff['id']+_0x8d5b('0x4c')+_0xf1427b[_0x8d5b('0x25')],'notifyContentType':_0x8d5b('0x53'),'callbackData':_0xf1427b[_0x8d5b('0x22')]+';'+_0x5d9aff[_0x8d5b('0xe')]}]},'headers':{'Authorization':_0x8d5b('0x54')+_0x41499c[_0x8d5b('0x25')]},'json':!![]};return rp(_0x3fbfdc)[_0x8d5b('0x19')](function(_0x4060d3){if(_0x4060d3['messages']){var _0x47fb5f={'messageId':_0x4060d3[_0x8d5b('0x23')][0x0][_0x8d5b('0xc')]};if(!_0xf1427b[_0x8d5b('0x3c')]){_0x47fb5f['read']=!![];}return _0x490336[_0x8d5b('0x27')](_0x47fb5f);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8d5b('0x4f'),util['inspect'](_0x4060d3,{'showHidden':![],'depth':null}));}});})[_0x8d5b('0x1a')](function(_0x2f39a6){return logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'infobip',util['inspect'](_0x2f39a6,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate',_0x8d5b('0x4f'),_0x8d5b('0x38'));}break;case _0x8d5b('0x55'):var _0x2bbfbe=require('crypto');if(_0xf1427b['apiKey']){var _0x354379={};_0x354379[_0x8d5b('0x56')]=_0xf1427b[_0x8d5b('0x2d')];_0x354379[_0x8d5b('0x22')]=_0x5d9aff[_0x8d5b('0x22')];_0x354379[_0x8d5b('0x57')]=_0xf1427b[_0x8d5b('0x22')];_0x354379[_0x8d5b('0x58')]=_0x5d9aff[_0x8d5b('0xe')];_0x354379['timestamp']=+new Date();var _0x59be85='';var _0x6b979f='';var _0x31e790=Object[_0x8d5b('0x59')](_0x354379);_0x31e790[_0x8d5b('0x5a')]();for(var _0x182abb=0x0;_0x182abb<_0x31e790['length'];_0x182abb++){if(_0x59be85!=''){_0x59be85+='&';}_0x59be85+=_0x31e790[_0x182abb]+'='+encodeURIComponent(_0x354379[_0x31e790[_0x182abb]]);_0x6b979f+=_0x354379[_0x31e790[_0x182abb]];}_0x6b979f+=_0xf1427b['apiKey'];_0x6b979f=_0x2bbfbe['createHash'](_0x8d5b('0x5b'))[_0x8d5b('0x27')](_0x6b979f)[_0x8d5b('0x5c')](_0x8d5b('0x5d'));if(_0x59be85!==''){_0x59be85+='&';}_0x59be85+=_0x8d5b('0x5e')+_0x6b979f;var _0x1fc579={'method':_0x8d5b('0x32'),'uri':_0xf1427b[_0x8d5b('0x50')]+_0x8d5b('0x5f')+_0x59be85,'json':!![]};return rp(_0x1fc579)[_0x8d5b('0x19')](function(_0x1bc432){var _0xaf66b9=Object[_0x8d5b('0x59')](_0x1bc432);if(_0x1bc432[_0xaf66b9[0x0]]['error']&&parseInt(_0x1bc432[_0xaf66b9[0x0]]['error'])===0x0){var _0x91c8c5={'messageId':_0x1bc432[_0xaf66b9[0x0]]['id_sms']};if(!_0xf1427b[_0x8d5b('0x3c')]){_0x91c8c5[_0x8d5b('0x3d')]=!![];}return _0x490336[_0x8d5b('0x27')](_0x91c8c5);}else{return logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate',_0x8d5b('0x55'),util[_0x8d5b('0x28')](_0x1bc432['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x483038){return logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8d5b('0x37'),_0x8d5b('0x55'),util[_0x8d5b('0x28')](_0x483038,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate',_0x8d5b('0x55'),_0x8d5b('0x60'));}break;case _0x8d5b('0x61'):if(_0xf1427b[_0x8d5b('0x62')]){var _0x9bc583={'method':_0x8d5b('0x35'),'uri':_0x8d5b('0x63'),'headers':{'Authorization':_0xf1427b['apiKey']},'body':{'content':_0x5d9aff[_0x8d5b('0xe')],'to':[_0x5d9aff[_0x8d5b('0x22')]],'from':_0xf1427b[_0x8d5b('0x22')],'binary':![],'clientMessageId':_0x8d5b('0x64'),'charset':_0x8d5b('0x65')},'json':!![]};rp(_0x9bc583)[_0x8d5b('0x19')](function(_0x5c57cf){if(!_0x5c57cf[_0x8d5b('0x1b')]){var _0x4010e1={'messageId':_0x5c57cf[_0x8d5b('0x23')][0x0][_0x8d5b('0x66')]};if(!_0xf1427b[_0x8d5b('0x3c')]){_0x4010e1[_0x8d5b('0x3d')]=!![];}return _0x490336[_0x8d5b('0x27')](_0x4010e1);}else{return logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x61'),util['inspect'](_0x5c57cf[_0x8d5b('0x1b')],{'showHidden':![],'depth':null}));}})[_0x8d5b('0x1a')](function(_0x51e056){return logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x61'),util[_0x8d5b('0x28')](_0x51e056,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate','clickatell',_0x8d5b('0x60'));}break;case _0x8d5b('0x67'):if(_0xf1427b[_0x8d5b('0x2d')]&&_0xf1427b[_0x8d5b('0x2e')]){var _0x1a38f9=util[_0x8d5b('0x40')](_0x8d5b('0x4d'),_0xf1427b[_0x8d5b('0x2d')],_0xf1427b[_0x8d5b('0x2e')]);var _0x48ecbe={'method':'POST','uri':_0x8d5b('0x68')+_0xf1427b[_0x8d5b('0x69')]+'/messages','body':{'to':[_0x5d9aff[_0x8d5b('0x22')]],'text':_0x5d9aff[_0x8d5b('0xe')],'from':_0xf1427b[_0x8d5b('0x22')],'applicationId':_0xf1427b[_0x8d5b('0x6a')]},'headers':{'Authorization':util['format'](_0x8d5b('0x6b'),new Buffer(_0x1a38f9)[_0x8d5b('0x42')](_0x8d5b('0x43')))},'json':!![]};rp(_0x48ecbe)[_0x8d5b('0x19')](function(_0x5f074c){if(_0x5f074c['id']){var _0x5117f4={'messageId':_0x5f074c['id']};return _0x490336['update'](_0x5117f4);}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),'afterCreate',_0x8d5b('0x67'),util[_0x8d5b('0x28')](_0x5f074c,{'showHidden':![],'depth':null}));}})[_0x8d5b('0x1a')](function(_0x41eb74){logger['error'](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x67'),util['inspect'](_0x41eb74,{'showHidden':![],'depth':null}));});}else{logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x67'),_0x8d5b('0x38'));}break;case _0x8d5b('0x6c'):if(_0xf1427b[_0x8d5b('0x62')]){var _0x3f5bd3={};var _0x1fc579={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x8d5b('0x6d')+_0xf1427b[_0x8d5b('0x62')],'Content-Type':'application/json'},'body':{'from':_0xf1427b[_0x8d5b('0x22')],'to':_0x5d9aff[_0x8d5b('0x22')],'text':_0x5d9aff[_0x8d5b('0xe')]},'json':!![]};return rp(_0x1fc579)[_0x8d5b('0x19')](function(_0x2966cd){if(_0x2966cd['code']==0xca){_0x3f5bd3[_0x8d5b('0x6e')]=_0x2966cd;var _0x3b535d={'method':_0x8d5b('0x35'),'uri':_0x8d5b('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0xf1427b[_0x8d5b('0x62')],'Content-Type':_0x8d5b('0x53')},'body':{'refid':_0x3f5bd3[_0x8d5b('0x6e')]['refid']},'json':!![]};return rp(_0x3b535d)['then'](function(_0x491cc5){_0x3f5bd3[_0x8d5b('0x70')]=_0x491cc5;var _0x469333={'messageId':_0x3f5bd3[_0x8d5b('0x6e')][_0x8d5b('0x71')],'read':!![]};return _0x490336[_0x8d5b('0x27')](_0x469333);});}else{return logger[_0x8d5b('0x1b')](_0x8d5b('0x29'),_0x8d5b('0x37'),'intelepeer',util[_0x8d5b('0x28')](_0x2966cd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5304fa){return logger[_0x8d5b('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8d5b('0x6c'),util[_0x8d5b('0x28')](_0x5304fa,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x8d5b('0x29'),_0x8d5b('0x37'),_0x8d5b('0x6c'),_0x8d5b('0x72'));}break;}}})[_0x8d5b('0x73')](function(){_0x2ee3ab();});}else{_0x2ee3ab();}}},'charset':'utf8mb4','collate':_0x8d5b('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 61f7828..ff49a5a 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 _0x4e78=['request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','localhost','socket.io-emitter','redis','./smsMessage.socket'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4e78,0x85));var _0x84e7=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x4e78[_0x531d15];return _0x271a18;};'use strict';var _=require(_0x84e7('0x0'));var util=require(_0x84e7('0x1'));var moment=require(_0x84e7('0x2'));var BPromise=require(_0x84e7('0x3'));var rs=require(_0x84e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84e7('0x5'));var logger=require('../../config/logger')(_0x84e7('0x6'));var config=require(_0x84e7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x84e7('0x8'),'port':0x18eb});var socket=require(_0x84e7('0x9'))(new Redis(config[_0x84e7('0xa')]));require(_0x84e7('0xb'))['register'](socket);function respondWithRpcPromise(_0x5de0a9,_0x393b38,_0x1c1a97){return new BPromise(function(_0x2beafe,_0xca425c){return client[_0x84e7('0xc')](_0x5de0a9,_0x1c1a97)[_0x84e7('0xd')](function(_0x209e0f){logger[_0x84e7('0xe')]('SmsMessage,\x20%s,\x20%s',_0x393b38,_0x84e7('0xf'));logger[_0x84e7('0x10')](_0x84e7('0x11'),_0x393b38,_0x84e7('0xf'),JSON[_0x84e7('0x12')](_0x209e0f));if(_0x209e0f[_0x84e7('0x13')]){if(_0x209e0f[_0x84e7('0x13')]['code']===0x1f4){logger[_0x84e7('0x13')](_0x84e7('0x14'),_0x393b38,_0x209e0f[_0x84e7('0x13')]['message']);return _0xca425c(_0x209e0f[_0x84e7('0x13')][_0x84e7('0x15')]);}logger[_0x84e7('0x13')](_0x84e7('0x14'),_0x393b38,_0x209e0f['error']['message']);return _0x2beafe(_0x209e0f['error'][_0x84e7('0x15')]);}else{logger[_0x84e7('0xe')]('SmsMessage,\x20%s,\x20%s',_0x393b38,_0x84e7('0xf'));_0x2beafe(_0x209e0f[_0x84e7('0x16')][_0x84e7('0x15')]);}})[_0x84e7('0x17')](function(_0x506f52){logger[_0x84e7('0x13')](_0x84e7('0x14'),_0x393b38,_0x506f52);_0xca425c(_0x506f52);});});}exports[_0x84e7('0x18')]=function(_0xc49904){var _0x40ec27=this;return new Promise(function(_0x1c00cf,_0x21beca){return db[_0x84e7('0x19')]['create'](_0xc49904[_0x84e7('0x1a')],{'raw':_0xc49904[_0x84e7('0x1b')]?_0xc49904[_0x84e7('0x1b')][_0x84e7('0x1c')]===undefined?!![]:![]:!![]})[_0x84e7('0xd')](function(_0x15229b){logger[_0x84e7('0xe')]('CreateSmsMessage',_0xc49904);logger['debug'](_0x84e7('0x18'),_0xc49904,JSON[_0x84e7('0x12')](_0x15229b));_0x1c00cf(_0x15229b);})[_0x84e7('0x17')](function(_0x2a0146){logger['error'](_0x84e7('0x18'),_0x2a0146[_0x84e7('0x15')],_0xc49904);_0x21beca(_0x40ec27[_0x84e7('0x13')](0x1f4,_0x2a0146[_0x84e7('0x15')]));});});}; \ No newline at end of file +var _0x05d4=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage','create','body','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsMessage.socket','request','then'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x05d4,0xc1));var _0x405d=function(_0x1d8b10,_0x9603a6){_0x1d8b10=_0x1d8b10-0x0;var _0x123f31=_0x05d4[_0x1d8b10];return _0x123f31;};'use strict';var _=require('lodash');var util=require(_0x405d('0x0'));var moment=require(_0x405d('0x1'));var BPromise=require(_0x405d('0x2'));var rs=require(_0x405d('0x3'));var fs=require('fs');var Redis=require(_0x405d('0x4'));var db=require(_0x405d('0x5'))['db'];var utils=require(_0x405d('0x6'));var logger=require(_0x405d('0x7'))('rpc');var config=require(_0x405d('0x8'));var jayson=require(_0x405d('0x9'));var client=jayson['client'][_0x405d('0xa')]({'port':0x232a});config[_0x405d('0xb')]=_[_0x405d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x405d('0xd'))(new Redis(config[_0x405d('0xb')]));require(_0x405d('0xe'))['register'](socket);function respondWithRpcPromise(_0xdea790,_0x5bcd30,_0x220d31){return new BPromise(function(_0x4a84f1,_0x27776a){return client[_0x405d('0xf')](_0xdea790,_0x220d31)[_0x405d('0x10')](function(_0x455f6e){logger[_0x405d('0x11')](_0x405d('0x12'),_0x5bcd30,_0x405d('0x13'));logger[_0x405d('0x14')](_0x405d('0x15'),_0x5bcd30,_0x405d('0x13'),JSON[_0x405d('0x16')](_0x455f6e));if(_0x455f6e[_0x405d('0x17')]){if(_0x455f6e[_0x405d('0x17')][_0x405d('0x18')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5bcd30,_0x455f6e['error']['message']);return _0x27776a(_0x455f6e[_0x405d('0x17')][_0x405d('0x19')]);}logger[_0x405d('0x17')](_0x405d('0x12'),_0x5bcd30,_0x455f6e[_0x405d('0x17')]['message']);return _0x4a84f1(_0x455f6e[_0x405d('0x17')][_0x405d('0x19')]);}else{logger[_0x405d('0x11')]('SmsMessage,\x20%s,\x20%s',_0x5bcd30,'request\x20sent');_0x4a84f1(_0x455f6e['result'][_0x405d('0x19')]);}})['catch'](function(_0x2cef19){logger[_0x405d('0x17')](_0x405d('0x12'),_0x5bcd30,_0x2cef19);_0x27776a(_0x2cef19);});});}exports['CreateSmsMessage']=function(_0x4e1999){var _0x2a442c=this;return new Promise(function(_0x5a1beb,_0x131790){return db[_0x405d('0x1a')][_0x405d('0x1b')](_0x4e1999[_0x405d('0x1c')],{'raw':_0x4e1999['options']?_0x4e1999['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18fa31){logger[_0x405d('0x11')](_0x405d('0x1d'),_0x4e1999);logger[_0x405d('0x14')](_0x405d('0x1d'),_0x4e1999,JSON[_0x405d('0x16')](_0x18fa31));_0x5a1beb(_0x18fa31);})['catch'](function(_0x3d2b8a){logger[_0x405d('0x17')](_0x405d('0x1d'),_0x3d2b8a[_0x405d('0x19')],_0x4e1999);_0x131790(_0x2a442c['error'](0x1f4,_0x3d2b8a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ecf5530..bfd3de9 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 _0x68ef=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x1fafd0,_0x15a775){var _0x2624d0=function(_0x50378e){while(--_0x50378e){_0x1fafd0['push'](_0x1fafd0['shift']());}};_0x2624d0(++_0x15a775);}(_0x68ef,0x9e));var _0xf68e=function(_0x19cd5f,_0x11a5a1){_0x19cd5f=_0x19cd5f-0x0;var _0x69e54b=_0x68ef[_0x19cd5f];return _0x69e54b;};'use strict';var SmsMessageEvents=require(_0xf68e('0x0'));var events=[_0xf68e('0x1'),'remove',_0xf68e('0x2')];function createListener(_0x4eeea6,_0x55a13e){return function(_0x56fa5a){_0x55a13e[_0xf68e('0x3')](_0x4eeea6,_0x56fa5a);};}function removeListener(_0x43d468,_0xc2cb64){return function(){SmsMessageEvents[_0xf68e('0x4')](_0x43d468,_0xc2cb64);};}exports[_0xf68e('0x5')]=function(_0x5e0f9d){for(var _0x5a5706=0x0,_0x34cba6=events[_0xf68e('0x6')];_0x5a5706<_0x34cba6;_0x5a5706++){var _0x49b91d=events[_0x5a5706];var _0x518e73=createListener(_0xf68e('0x7')+_0x49b91d,_0x5e0f9d);SmsMessageEvents['on'](_0x49b91d,_0x518e73);}}; \ No newline at end of file +var _0x2dd7=['remove','emit','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dd7,0xd7));var _0x72dd=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x2dd7[_0x35007a];return _0x574f68;};'use strict';var SmsMessageEvents=require(_0x72dd('0x0'));var events=[_0x72dd('0x1'),_0x72dd('0x2'),'update'];function createListener(_0x21dbf5,_0x253bad){return function(_0x1bc8ef){_0x253bad[_0x72dd('0x3')](_0x21dbf5,_0x1bc8ef);};}function removeListener(_0x272710,_0x4ab6fb){return function(){SmsMessageEvents['removeListener'](_0x272710,_0x4ab6fb);};}exports[_0x72dd('0x4')]=function(_0x57b46c){for(var _0x1b0d56=0x0,_0x12510c=events[_0x72dd('0x5')];_0x1b0d56<_0x12510c;_0x1b0d56++){var _0x1f8dfd=events[_0x1b0d56];var _0x575f61=createListener(_0x72dd('0x6')+_0x1f8dfd,_0x57b46c);SmsMessageEvents['on'](_0x1f8dfd,_0x575f61);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 416980b..e3c21e2 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 _0x78b9=['addAgents','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78b9,0x1c0));var _0x978b=function(_0x825c71,_0x128b2c){_0x825c71=_0x825c71-0x0;var _0x45f130=_0x78b9[_0x825c71];return _0x45f130;};'use strict';var multer=require('multer');var util=require(_0x978b('0x0'));var path=require('path');var timeout=require(_0x978b('0x1'));var express=require('express');var router=express[_0x978b('0x2')]();var fs_extra=require(_0x978b('0x3'));var auth=require(_0x978b('0x4'));var interaction=require(_0x978b('0x5'));var config=require(_0x978b('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x978b('0x7')](),controller[_0x978b('0x8')]);router[_0x978b('0x9')](_0x978b('0xa'),auth[_0x978b('0x7')](),controller['describe']);router[_0x978b('0x9')]('/:id',auth[_0x978b('0x7')](),controller[_0x978b('0xb')]);router[_0x978b('0x9')](_0x978b('0xc'),auth[_0x978b('0x7')](),controller[_0x978b('0xd')]);router[_0x978b('0x9')](_0x978b('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x978b('0x9')](_0x978b('0xf'),auth['isAuthenticated'](),controller[_0x978b('0x10')]);router[_0x978b('0x11')]('/',auth['isAuthenticated'](),controller[_0x978b('0x12')]);router[_0x978b('0x11')](_0x978b('0xe'),auth[_0x978b('0x7')](),controller[_0x978b('0x13')]);router[_0x978b('0x11')](_0x978b('0xf'),auth[_0x978b('0x7')](),controller[_0x978b('0x14')]);router['put']('/:id',auth[_0x978b('0x7')](),controller['update']);router[_0x978b('0x15')]('/:id',auth[_0x978b('0x7')](),controller[_0x978b('0x16')]);router[_0x978b('0x15')](_0x978b('0xe'),auth[_0x978b('0x7')](),controller[_0x978b('0x17')]);router[_0x978b('0x15')](_0x978b('0xf'),auth[_0x978b('0x7')](),controller[_0x978b('0x18')]);module[_0x978b('0x19')]=router; \ No newline at end of file +var _0xb599=['./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x2ac383,_0x12c989){var _0x539034=function(_0xa4ddea){while(--_0xa4ddea){_0x2ac383['push'](_0x2ac383['shift']());}};_0x539034(++_0x12c989);}(_0xb599,0x1ce));var _0x9b59=function(_0x3fb3dd,_0x48a4e1){_0x3fb3dd=_0x3fb3dd-0x0;var _0x4c31cc=_0xb599[_0x3fb3dd];return _0x4c31cc;};'use strict';var multer=require(_0x9b59('0x0'));var util=require(_0x9b59('0x1'));var path=require(_0x9b59('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b59('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b59('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b59('0x5'));var controller=require(_0x9b59('0x6'));router[_0x9b59('0x7')]('/',auth[_0x9b59('0x8')](),controller['index']);router['get'](_0x9b59('0x9'),auth[_0x9b59('0x8')](),controller[_0x9b59('0xa')]);router[_0x9b59('0x7')](_0x9b59('0xb'),auth[_0x9b59('0x8')](),controller[_0x9b59('0xc')]);router[_0x9b59('0x7')](_0x9b59('0xd'),auth[_0x9b59('0x8')](),controller[_0x9b59('0xe')]);router[_0x9b59('0x7')](_0x9b59('0xf'),auth[_0x9b59('0x8')](),controller['getTeams']);router['get']('/:id/users',auth[_0x9b59('0x8')](),controller[_0x9b59('0x10')]);router[_0x9b59('0x11')]('/',auth['isAuthenticated'](),controller[_0x9b59('0x12')]);router[_0x9b59('0x11')](_0x9b59('0xf'),auth[_0x9b59('0x8')](),controller['addTeams']);router[_0x9b59('0x11')](_0x9b59('0x13'),auth[_0x9b59('0x8')](),controller[_0x9b59('0x14')]);router[_0x9b59('0x15')](_0x9b59('0xb'),auth[_0x9b59('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x9b59('0x16')](_0x9b59('0xf'),auth[_0x9b59('0x8')](),controller[_0x9b59('0x17')]);router[_0x9b59('0x16')](_0x9b59('0x13'),auth['isAuthenticated'](),controller[_0x9b59('0x18')]);module[_0x9b59('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 55f32cf..4c4a1c0 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 _0xb9ec=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x1ae6af,_0x41c739){var _0x5458bc=function(_0x2665a3){while(--_0x2665a3){_0x1ae6af['push'](_0x1ae6af['shift']());}};_0x5458bc(++_0x41c739);}(_0xb9ec,0x145));var _0xcb9e=function(_0x4ca3b4,_0x38fce4){_0x4ca3b4=_0x4ca3b4-0x0;var _0x318861=_0xb9ec[_0x4ca3b4];return _0x318861;};'use strict';var Sequelize=require(_0xcb9e('0x0'));module[_0xcb9e('0x1')]={'name':{'type':Sequelize[_0xcb9e('0x2')],'unique':_0xcb9e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcb9e('0x2')]},'timeout':{'type':Sequelize[_0xcb9e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcb9e('0x5')]('rrmemory',_0xcb9e('0x6'),_0xcb9e('0x7'))}}; \ No newline at end of file +var _0x2883=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x232889,_0x312258){var _0x6dc064=function(_0x3e1639){while(--_0x3e1639){_0x232889['push'](_0x232889['shift']());}};_0x6dc064(++_0x312258);}(_0x2883,0x10f));var _0x3288=function(_0x58e6ac,_0x39b241){_0x58e6ac=_0x58e6ac-0x0;var _0x102e1d=_0x2883[_0x58e6ac];return _0x102e1d;};'use strict';var Sequelize=require(_0x3288('0x0'));module[_0x3288('0x1')]={'name':{'type':Sequelize[_0x3288('0x2')],'unique':_0x3288('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3288('0x2')]},'timeout':{'type':Sequelize[_0x3288('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3288('0x5'),_0x3288('0x6'),_0x3288('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0980709..72a8b3f 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x2bbcc5,_0x59dec3){var _0x660c36=function(_0x135de5){while(--_0x135de5){_0x2bbcc5['push'](_0x2bbcc5['shift']());}};_0x660c36(++_0x59dec3);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e53ef,_0x5762ae){_0x1e53ef=_0x1e53ef-0x0;var _0x35f0d9=_0x2ef3[_0x1e53ef];return _0x35f0d9;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x2032,0xd9));var _0x2203=function(_0x2e6734,_0x15c142){_0x2e6734=_0x2e6734-0x0;var _0xbd225d=_0x2032[_0x2e6734];return _0xbd225d;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5eaeab6..588e49b 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 _0xb595=['../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x125095,_0x58c6e){var _0xdbf331=function(_0x5577fb){while(--_0x5577fb){_0x125095['push'](_0x125095['shift']());}};_0xdbf331(++_0x58c6e);}(_0xb595,0x1f0));var _0x5b59=function(_0x49ea04,_0x55e627){_0x49ea04=_0x49ea04-0x0;var _0x3d00e0=_0xb595[_0x49ea04];return _0x3d00e0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x5b59('0x0'))['db'][_0x5b59('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5b59('0x2')](0x0);var events={'afterCreate':_0x5b59('0x3'),'afterUpdate':'update','afterDestroy':_0x5b59('0x4')};function emitEvent(_0x228cb1){return function(_0xc9a8c9,_0xe97e0b,_0x348732){SmsQueueEvents[_0x5b59('0x5')](_0x228cb1+':'+_0xc9a8c9['id'],_0xc9a8c9);SmsQueueEvents[_0x5b59('0x5')](_0x228cb1,_0xc9a8c9);_0x348732(null);};}for(var e in events){if(events[_0x5b59('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x5b59('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x5fc4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save','remove'];(function(_0x3e4007,_0x9fc5f7){var _0x5daab8=function(_0x5ca315){while(--_0x5ca315){_0x3e4007['push'](_0x3e4007['shift']());}};_0x5daab8(++_0x9fc5f7);}(_0x5fc4,0x8b));var _0x45fc=function(_0x17d7a7,_0x369784){_0x17d7a7=_0x17d7a7-0x0;var _0x533757=_0x5fc4[_0x17d7a7];return _0x533757;};'use strict';var EventEmitter=require(_0x45fc('0x0'));var SmsQueue=require(_0x45fc('0x1'))['db'][_0x45fc('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x45fc('0x3'),'afterUpdate':'update','afterDestroy':_0x45fc('0x4')};function emitEvent(_0x99384e){return function(_0x40d7e6,_0x5ad157,_0x52cc8a){SmsQueueEvents[_0x45fc('0x5')](_0x99384e+':'+_0x40d7e6['id'],_0x40d7e6);SmsQueueEvents['emit'](_0x99384e,_0x40d7e6);_0x52cc8a(null);};}for(var e in events){if(events[_0x45fc('0x6')](e)){var event=events[e];SmsQueue[_0x45fc('0x7')](e,emitEvent(event));}}module[_0x45fc('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 17211c1..99260d0 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 _0x27f0=['util','request-promise','rimraf','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x27f0,0x137));var _0x027f=function(_0x571edb,_0x5a648d){_0x571edb=_0x571edb-0x0;var _0x2a682e=_0x27f0[_0x571edb];return _0x2a682e;};'use strict';var _=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x027f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x027f('0x3'));var config=require('../../config/environment');var attributes=require(_0x027f('0x4'));module[_0x027f('0x5')]=function(_0x573784,_0x30b0a8){return _0x573784['define'](_0x027f('0x6'),attributes,{'tableName':_0x027f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7857=['path','../../config/environment','./smsQueue.attributes','define','sms_queues','util','../../config/logger','moment','bluebird'];(function(_0x5c4d30,_0x2bc47a){var _0x120851=function(_0x458736){while(--_0x458736){_0x5c4d30['push'](_0x5c4d30['shift']());}};_0x120851(++_0x2bc47a);}(_0x7857,0x140));var _0x7785=function(_0x1690c6,_0x44f31a){_0x1690c6=_0x1690c6-0x0;var _0x134074=_0x7857[_0x1690c6];return _0x134074;};'use strict';var _=require('lodash');var util=require(_0x7785('0x0'));var logger=require(_0x7785('0x1'))('api');var moment=require(_0x7785('0x2'));var BPromise=require(_0x7785('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7785('0x4'));var rimraf=require('rimraf');var config=require(_0x7785('0x5'));var attributes=require(_0x7785('0x6'));module['exports']=function(_0x2f5045,_0x2f16be){return _0x2f5045[_0x7785('0x7')]('SmsQueue',attributes,{'tableName':_0x7785('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 c1e6f08..7ad60f2 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 _0xdaf8=['../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','limit','include','map','attributes','model','debug','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2cac42,_0x362036){var _0xe14c06=function(_0x170030){while(--_0x170030){_0x2cac42['push'](_0x2cac42['shift']());}};_0xe14c06(++_0x362036);}(_0xdaf8,0x160));var _0x8daf=function(_0x4198ef,_0x1c4cdd){_0x4198ef=_0x4198ef-0x0;var _0x271035=_0xdaf8[_0x4198ef];return _0x271035;};'use strict';var _=require(_0x8daf('0x0'));var util=require(_0x8daf('0x1'));var moment=require(_0x8daf('0x2'));var BPromise=require(_0x8daf('0x3'));var rs=require(_0x8daf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8daf('0x5'));var logger=require(_0x8daf('0x6'))(_0x8daf('0x7'));var config=require(_0x8daf('0x8'));var jayson=require(_0x8daf('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x8daf('0xa')]=_[_0x8daf('0xb')](config[_0x8daf('0xa')],{'host':_0x8daf('0xc'),'port':0x18eb});var socket=require(_0x8daf('0xd'))(new Redis(config[_0x8daf('0xa')]));require(_0x8daf('0xe'))[_0x8daf('0xf')](socket);function respondWithRpcPromise(_0x44d575,_0x578111,_0x43682b){return new BPromise(function(_0x2e5754,_0x5ea136){return client[_0x8daf('0x10')](_0x44d575,_0x43682b)[_0x8daf('0x11')](function(_0x815afd){logger[_0x8daf('0x12')](_0x8daf('0x13'),_0x578111,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x578111,_0x8daf('0x14'),JSON['stringify'](_0x815afd));if(_0x815afd[_0x8daf('0x15')]){if(_0x815afd[_0x8daf('0x15')][_0x8daf('0x16')]===0x1f4){logger[_0x8daf('0x15')]('SmsQueue,\x20%s,\x20%s',_0x578111,_0x815afd[_0x8daf('0x15')][_0x8daf('0x17')]);return _0x5ea136(_0x815afd[_0x8daf('0x15')][_0x8daf('0x17')]);}logger[_0x8daf('0x15')](_0x8daf('0x13'),_0x578111,_0x815afd[_0x8daf('0x15')]['message']);return _0x2e5754(_0x815afd[_0x8daf('0x15')][_0x8daf('0x17')]);}else{logger[_0x8daf('0x12')]('SmsQueue,\x20%s,\x20%s',_0x578111,_0x8daf('0x14'));_0x2e5754(_0x815afd[_0x8daf('0x18')][_0x8daf('0x17')]);}})[_0x8daf('0x19')](function(_0x47d7bc){logger[_0x8daf('0x15')](_0x8daf('0x13'),_0x578111,_0x47d7bc);_0x5ea136(_0x47d7bc);});});}exports[_0x8daf('0x1a')]=function(_0x44fb9d){var _0x423f22=this;return new Promise(function(_0x370be5,_0x3bc0dd){return db[_0x8daf('0x1b')][_0x8daf('0x1c')]({'raw':_0x44fb9d[_0x8daf('0x1d')]?_0x44fb9d['options']['raw']===undefined?!![]:![]:!![],'where':_0x44fb9d[_0x8daf('0x1d')]?_0x44fb9d[_0x8daf('0x1d')][_0x8daf('0x1e')]||null:null,'attributes':_0x44fb9d[_0x8daf('0x1d')]?_0x44fb9d[_0x8daf('0x1d')]['attributes']||null:null,'limit':_0x44fb9d['options']?_0x44fb9d['options'][_0x8daf('0x1f')]||null:null,'include':_0x44fb9d[_0x8daf('0x1d')]?_0x44fb9d[_0x8daf('0x1d')][_0x8daf('0x20')]?_[_0x8daf('0x21')](_0x44fb9d[_0x8daf('0x1d')][_0x8daf('0x20')],function(_0x498633){return{'model':db[_0x498633['model']],'as':_0x498633['as'],'attributes':_0x498633[_0x8daf('0x22')],'include':_0x498633['include']?_[_0x8daf('0x21')](_0x498633['include'],function(_0x1c3c95){return{'model':db[_0x1c3c95[_0x8daf('0x23')]],'as':_0x1c3c95['as'],'attributes':_0x1c3c95[_0x8daf('0x22')],'include':_0x1c3c95[_0x8daf('0x20')]?_[_0x8daf('0x21')](_0x1c3c95['include'],function(_0x5aa986){return{'model':db[_0x5aa986[_0x8daf('0x23')]],'as':_0x5aa986['as'],'attributes':_0x5aa986[_0x8daf('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8daf('0x11')](function(_0xcde806){logger[_0x8daf('0x12')](_0x8daf('0x1a'),_0x44fb9d);logger[_0x8daf('0x24')](_0x8daf('0x1a'),_0x44fb9d,JSON['stringify'](_0xcde806));_0x370be5(_0xcde806);})[_0x8daf('0x19')](function(_0x445676){logger[_0x8daf('0x15')](_0x8daf('0x1a'),_0x445676[_0x8daf('0x17')],_0x44fb9d);_0x3bc0dd(_0x423f22[_0x8daf('0x15')](0x1f4,_0x445676[_0x8daf('0x17')]));});});};exports[_0x8daf('0x25')]=function(_0x5195bf){var _0x1bfc65=this;return new Promise(function(_0x55690b,_0x340eda){return db[_0x8daf('0x1b')][_0x8daf('0x26')]({'raw':_0x5195bf[_0x8daf('0x1d')]?_0x5195bf[_0x8daf('0x1d')][_0x8daf('0x27')]===undefined?!![]:![]:!![],'where':_0x5195bf[_0x8daf('0x1d')]?_0x5195bf['options'][_0x8daf('0x1e')]||null:null,'attributes':_0x5195bf['options']?_0x5195bf['options']['attributes']||null:null,'include':_0x5195bf[_0x8daf('0x1d')]?_0x5195bf['options'][_0x8daf('0x20')]?_['map'](_0x5195bf[_0x8daf('0x1d')][_0x8daf('0x20')],function(_0x392314){return{'model':db[_0x392314[_0x8daf('0x23')]],'as':_0x392314['as'],'attributes':_0x392314['attributes'],'include':_0x392314['include']?_[_0x8daf('0x21')](_0x392314[_0x8daf('0x20')],function(_0x1bc143){return{'model':db[_0x1bc143[_0x8daf('0x23')]],'as':_0x1bc143['as'],'attributes':_0x1bc143[_0x8daf('0x22')],'include':_0x1bc143[_0x8daf('0x20')]?_[_0x8daf('0x21')](_0x1bc143[_0x8daf('0x20')],function(_0x53fc16){return{'model':db[_0x53fc16[_0x8daf('0x23')]],'as':_0x53fc16['as'],'attributes':_0x53fc16[_0x8daf('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8daf('0x11')](function(_0x3a9c98){logger[_0x8daf('0x12')]('ShowSmsQueue',_0x5195bf);logger[_0x8daf('0x24')](_0x8daf('0x25'),_0x5195bf,JSON['stringify'](_0x3a9c98));_0x55690b(_0x3a9c98);})[_0x8daf('0x19')](function(_0x115b19){logger['error'](_0x8daf('0x25'),_0x115b19[_0x8daf('0x17')],_0x5195bf);_0x340eda(_0x1bfc65[_0x8daf('0x15')](0x1f4,_0x115b19['message']));});});}; \ No newline at end of file +var _0xbb73=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','find'];(function(_0x53f497,_0x196992){var _0x421ddb=function(_0x4e1b0d){while(--_0x4e1b0d){_0x53f497['push'](_0x53f497['shift']());}};_0x421ddb(++_0x196992);}(_0xbb73,0x156));var _0x3bb7=function(_0x9055bf,_0x20fb00){_0x9055bf=_0x9055bf-0x0;var _0xf59349=_0xbb73[_0x9055bf];return _0xf59349;};'use strict';var _=require(_0x3bb7('0x0'));var util=require(_0x3bb7('0x1'));var moment=require('moment');var BPromise=require(_0x3bb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bb7('0x3'));var db=require(_0x3bb7('0x4'))['db'];var utils=require(_0x3bb7('0x5'));var logger=require(_0x3bb7('0x6'))(_0x3bb7('0x7'));var config=require(_0x3bb7('0x8'));var jayson=require(_0x3bb7('0x9'));var client=jayson[_0x3bb7('0xa')]['http']({'port':0x232a});config[_0x3bb7('0xb')]=_['defaults'](config[_0x3bb7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bb7('0xc'))(new Redis(config[_0x3bb7('0xb')]));require('./smsQueue.socket')[_0x3bb7('0xd')](socket);function respondWithRpcPromise(_0xadcdf1,_0x47834d,_0x465450){return new BPromise(function(_0x2071ea,_0x568caf){return client[_0x3bb7('0xe')](_0xadcdf1,_0x465450)[_0x3bb7('0xf')](function(_0x67846c){logger[_0x3bb7('0x10')]('SmsQueue,\x20%s,\x20%s',_0x47834d,_0x3bb7('0x11'));logger[_0x3bb7('0x12')](_0x3bb7('0x13'),_0x47834d,_0x3bb7('0x11'),JSON[_0x3bb7('0x14')](_0x67846c));if(_0x67846c[_0x3bb7('0x15')]){if(_0x67846c['error'][_0x3bb7('0x16')]===0x1f4){logger['error'](_0x3bb7('0x17'),_0x47834d,_0x67846c[_0x3bb7('0x15')][_0x3bb7('0x18')]);return _0x568caf(_0x67846c['error'][_0x3bb7('0x18')]);}logger[_0x3bb7('0x15')](_0x3bb7('0x17'),_0x47834d,_0x67846c[_0x3bb7('0x15')][_0x3bb7('0x18')]);return _0x2071ea(_0x67846c['error']['message']);}else{logger['info'](_0x3bb7('0x17'),_0x47834d,'request\x20sent');_0x2071ea(_0x67846c['result']['message']);}})[_0x3bb7('0x19')](function(_0x4d8eae){logger['error'](_0x3bb7('0x17'),_0x47834d,_0x4d8eae);_0x568caf(_0x4d8eae);});});}exports[_0x3bb7('0x1a')]=function(_0x390c18){var _0x1efd4c=this;return new Promise(function(_0x60c4f4,_0x2a5855){return db[_0x3bb7('0x1b')]['findAll']({'raw':_0x390c18[_0x3bb7('0x1c')]?_0x390c18[_0x3bb7('0x1c')][_0x3bb7('0x1d')]===undefined?!![]:![]:!![],'where':_0x390c18[_0x3bb7('0x1c')]?_0x390c18['options'][_0x3bb7('0x1e')]||null:null,'attributes':_0x390c18[_0x3bb7('0x1c')]?_0x390c18[_0x3bb7('0x1c')]['attributes']||null:null,'limit':_0x390c18['options']?_0x390c18[_0x3bb7('0x1c')][_0x3bb7('0x1f')]||null:null,'include':_0x390c18['options']?_0x390c18['options'][_0x3bb7('0x20')]?_[_0x3bb7('0x21')](_0x390c18[_0x3bb7('0x1c')][_0x3bb7('0x20')],function(_0xdb00f4){return{'model':db[_0xdb00f4[_0x3bb7('0x22')]],'as':_0xdb00f4['as'],'attributes':_0xdb00f4['attributes'],'include':_0xdb00f4[_0x3bb7('0x20')]?_[_0x3bb7('0x21')](_0xdb00f4[_0x3bb7('0x20')],function(_0x42af41){return{'model':db[_0x42af41[_0x3bb7('0x22')]],'as':_0x42af41['as'],'attributes':_0x42af41[_0x3bb7('0x23')],'include':_0x42af41['include']?_['map'](_0x42af41[_0x3bb7('0x20')],function(_0x32828c){return{'model':db[_0x32828c[_0x3bb7('0x22')]],'as':_0x32828c['as'],'attributes':_0x32828c[_0x3bb7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3bb7('0xf')](function(_0x30f3c2){logger['info'](_0x3bb7('0x1a'),_0x390c18);logger['debug'](_0x3bb7('0x1a'),_0x390c18,JSON[_0x3bb7('0x14')](_0x30f3c2));_0x60c4f4(_0x30f3c2);})[_0x3bb7('0x19')](function(_0x2e15b0){logger[_0x3bb7('0x15')](_0x3bb7('0x1a'),_0x2e15b0['message'],_0x390c18);_0x2a5855(_0x1efd4c[_0x3bb7('0x15')](0x1f4,_0x2e15b0[_0x3bb7('0x18')]));});});};exports[_0x3bb7('0x24')]=function(_0x1380dc){var _0x5d06dd=this;return new Promise(function(_0x13e465,_0xcb3857){return db[_0x3bb7('0x1b')][_0x3bb7('0x25')]({'raw':_0x1380dc['options']?_0x1380dc[_0x3bb7('0x1c')][_0x3bb7('0x1d')]===undefined?!![]:![]:!![],'where':_0x1380dc[_0x3bb7('0x1c')]?_0x1380dc[_0x3bb7('0x1c')]['where']||null:null,'attributes':_0x1380dc[_0x3bb7('0x1c')]?_0x1380dc['options'][_0x3bb7('0x23')]||null:null,'include':_0x1380dc[_0x3bb7('0x1c')]?_0x1380dc['options']['include']?_[_0x3bb7('0x21')](_0x1380dc['options'][_0x3bb7('0x20')],function(_0x48f749){return{'model':db[_0x48f749[_0x3bb7('0x22')]],'as':_0x48f749['as'],'attributes':_0x48f749[_0x3bb7('0x23')],'include':_0x48f749['include']?_[_0x3bb7('0x21')](_0x48f749[_0x3bb7('0x20')],function(_0x4d4a3b){return{'model':db[_0x4d4a3b[_0x3bb7('0x22')]],'as':_0x4d4a3b['as'],'attributes':_0x4d4a3b[_0x3bb7('0x23')],'include':_0x4d4a3b[_0x3bb7('0x20')]?_['map'](_0x4d4a3b[_0x3bb7('0x20')],function(_0x116756){return{'model':db[_0x116756['model']],'as':_0x116756['as'],'attributes':_0x116756[_0x3bb7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3bb7('0xf')](function(_0x25e226){logger['info'](_0x3bb7('0x24'),_0x1380dc);logger[_0x3bb7('0x12')](_0x3bb7('0x24'),_0x1380dc,JSON['stringify'](_0x25e226));_0x13e465(_0x25e226);})[_0x3bb7('0x19')](function(_0x347543){logger['error']('ShowSmsQueue',_0x347543[_0x3bb7('0x18')],_0x1380dc);_0xcb3857(_0x5d06dd[_0x3bb7('0x15')](0x1f4,_0x347543[_0x3bb7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e26c956..bbf2dd4 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 _0x9c7d=['update','emit','register','length','smsQueue:','save','remove'];(function(_0x4d72b2,_0x140189){var _0x4f6fff=function(_0x37d1f4){while(--_0x37d1f4){_0x4d72b2['push'](_0x4d72b2['shift']());}};_0x4f6fff(++_0x140189);}(_0x9c7d,0xe5));var _0xd9c7=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x9c7d[_0x1399d6];return _0x4a9db4;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd9c7('0x0'),_0xd9c7('0x1'),_0xd9c7('0x2')];function createListener(_0x315c06,_0x5b704c){return function(_0x43b8bf){_0x5b704c[_0xd9c7('0x3')](_0x315c06,_0x43b8bf);};}function removeListener(_0x54c4d3,_0x1f98f3){return function(){SmsQueueEvents['removeListener'](_0x54c4d3,_0x1f98f3);};}exports[_0xd9c7('0x4')]=function(_0xc1e4e8){for(var _0x243396=0x0,_0x4b9be2=events[_0xd9c7('0x5')];_0x243396<_0x4b9be2;_0x243396++){var _0x444f8b=events[_0x243396];var _0x252753=createListener(_0xd9c7('0x6')+_0x444f8b,_0xc1e4e8);SmsQueueEvents['on'](_0x444f8b,_0x252753);}}; \ No newline at end of file +var _0x6543=['remove','update','emit','smsQueue:','./smsQueue.events'];(function(_0xeb6f8d,_0x1138f1){var _0x41f045=function(_0x2e8f0e){while(--_0x2e8f0e){_0xeb6f8d['push'](_0xeb6f8d['shift']());}};_0x41f045(++_0x1138f1);}(_0x6543,0x16c));var _0x3654=function(_0x3e3d35,_0x424067){_0x3e3d35=_0x3e3d35-0x0;var _0x410dc2=_0x6543[_0x3e3d35];return _0x410dc2;};'use strict';var SmsQueueEvents=require(_0x3654('0x0'));var events=['save',_0x3654('0x1'),_0x3654('0x2')];function createListener(_0x577748,_0xea2226){return function(_0x16afee){_0xea2226[_0x3654('0x3')](_0x577748,_0x16afee);};}function removeListener(_0xf0e6c,_0x53c606){return function(){SmsQueueEvents['removeListener'](_0xf0e6c,_0x53c606);};}exports['register']=function(_0x1085da){for(var _0x317e32=0x0,_0x3153a2=events['length'];_0x317e32<_0x3153a2;_0x317e32++){var _0x465860=events[_0x317e32];var _0x2a9a0c=createListener(_0x3654('0x4')+_0x465860,_0x1085da);SmsQueueEvents['on'](_0x465860,_0x2a9a0c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f8ce610..567de99 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 _0xce1a=['../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','delete','multer','express','Router','fs-extra'];(function(_0x42de31,_0x1049d0){var _0x20809d=function(_0x506292){while(--_0x506292){_0x42de31['push'](_0x42de31['shift']());}};_0x20809d(++_0x1049d0);}(_0xce1a,0xbf));var _0xace1=function(_0x1a2bb3,_0x3f6af9){_0x1a2bb3=_0x1a2bb3-0x0;var _0x24ee86=_0xce1a[_0x1a2bb3];return _0x24ee86;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['describe']);router['get'](_0xace1('0xa'),auth['isAuthenticated'](),controller[_0xace1('0xb')]);router[_0xace1('0xc')]('/',auth[_0xace1('0x7')](),controller[_0xace1('0xd')]);router['put'](_0xace1('0xa'),auth[_0xace1('0x7')](),controller['update']);router[_0xace1('0xe')](_0xace1('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x131a=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1a49c3,_0x4feeed){var _0x3abaca=function(_0x57387d){while(--_0x57387d){_0x1a49c3['push'](_0x1a49c3['shift']());}};_0x3abaca(++_0x4feeed);}(_0x131a,0x18b));var _0xa131=function(_0x241fc2,_0x38ed19){_0x241fc2=_0x241fc2-0x0;var _0x3b9288=_0x131a[_0x241fc2];return _0x3b9288;};'use strict';var multer=require(_0xa131('0x0'));var util=require(_0xa131('0x1'));var path=require(_0xa131('0x2'));var timeout=require(_0xa131('0x3'));var express=require(_0xa131('0x4'));var router=express['Router']();var fs_extra=require(_0xa131('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa131('0x6'));var config=require(_0xa131('0x7'));var controller=require('./smsQueueReport.controller');router[_0xa131('0x8')]('/',auth[_0xa131('0x9')](),controller[_0xa131('0xa')]);router[_0xa131('0x8')](_0xa131('0xb'),auth[_0xa131('0x9')](),controller[_0xa131('0xc')]);router[_0xa131('0x8')](_0xa131('0xd'),auth['isAuthenticated'](),controller[_0xa131('0xe')]);router[_0xa131('0xf')]('/',auth['isAuthenticated'](),controller[_0xa131('0x10')]);router[_0xa131('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa131('0x12')]('/:id',auth[_0xa131('0x9')](),controller[_0xa131('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 41fdaa5..6ce2a94 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 _0xfd92=['exports','STRING','DATE','sequelize'];(function(_0x23f91c,_0x222cd5){var _0x365cef=function(_0x3e8d05){while(--_0x3e8d05){_0x23f91c['push'](_0x23f91c['shift']());}};_0x365cef(++_0x222cd5);}(_0xfd92,0x1a3));var _0x2fd9=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xfd92[_0x52a857];return _0x4e2aae;};'use strict';var moment=require('moment');var Sequelize=require(_0x2fd9('0x0'));module[_0x2fd9('0x1')]={'uniqueid':{'type':Sequelize[_0x2fd9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2fd9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2fd9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2fd9('0x3')]},'reason':{'type':Sequelize[_0x2fd9('0x2')]}}; \ No newline at end of file +var _0xb85c=['exports','STRING','DATE','sequelize'];(function(_0x1af655,_0x28b928){var _0x29da01=function(_0x508209){while(--_0x508209){_0x1af655['push'](_0x1af655['shift']());}};_0x29da01(++_0x28b928);}(_0xb85c,0x1db));var _0xcb85=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xb85c[_0x39e84d];return _0x1991bc;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb85('0x0'));module[_0xcb85('0x1')]={'uniqueid':{'type':Sequelize[_0xcb85('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcb85('0x2')]},'joinAt':{'type':Sequelize[_0xcb85('0x3')]},'leaveAt':{'type':Sequelize[_0xcb85('0x3')]},'acceptAt':{'type':Sequelize[_0xcb85('0x3')]},'exitAt':{'type':Sequelize[_0xcb85('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ff11bd9..867cfc5 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 _0x40b3=['map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','SmsQueueReport','includeAll','include','rows','catch','show','keys','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index'];(function(_0x9af14d,_0x46b74e){var _0x54f766=function(_0x3e7cf3){while(--_0x3e7cf3){_0x9af14d['push'](_0x9af14d['shift']());}};_0x54f766(++_0x46b74e);}(_0x40b3,0x101));var _0x340b=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x40b3[_0x4fbb86];return _0xb141fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x340b('0x0'));var zipdir=require(_0x340b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x340b('0x2'));var moment=require(_0x340b('0x3'));var BPromise=require(_0x340b('0x4'));var Mustache=require(_0x340b('0x5'));var util=require('util');var path=require(_0x340b('0x6'));var sox=require(_0x340b('0x7'));var csv=require(_0x340b('0x8'));var ejs=require(_0x340b('0x9'));var fs=require('fs');var fs_extra=require(_0x340b('0xa'));var _=require(_0x340b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x340b('0xc'));var deskjs=require(_0x340b('0xd'));var toCsv=require(_0x340b('0x8'));var querystring=require('querystring');var Papa=require(_0x340b('0xe'));var Redis=require(_0x340b('0xf'));var authService=require(_0x340b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x340b('0x11'));var logger=require(_0x340b('0x12'))(_0x340b('0x13'));var utils=require(_0x340b('0x14'));var config=require(_0x340b('0x15'));var licenseUtil=require(_0x340b('0x16'));var db=require(_0x340b('0x17'))['db'];function respondWithStatusCode(_0x9f95a4,_0x13b03e){_0x13b03e=_0x13b03e||0xcc;return function(_0x189e1a){if(_0x189e1a){return _0x9f95a4[_0x340b('0x18')](_0x13b03e);}return _0x9f95a4['status'](_0x13b03e)[_0x340b('0x19')]();};}function respondWithResult(_0x541a28,_0x5102af){_0x5102af=_0x5102af||0xc8;return function(_0x5924cc){if(_0x5924cc){return _0x541a28[_0x340b('0x1a')](_0x5102af)[_0x340b('0x1b')](_0x5924cc);}};}function respondWithFilteredResult(_0x1c73e6,_0xda1a37){return function(_0x39d64a){if(_0x39d64a){var _0xa350b0=typeof _0xda1a37['offset']===_0x340b('0x1c')&&typeof _0xda1a37['limit']===_0x340b('0x1c');var _0x69c4fd=_0x39d64a[_0x340b('0x1d')];var _0x5f4cae=_0xa350b0?0x0:_0xda1a37[_0x340b('0x1e')];var _0x5e3a4f=_0xa350b0?_0x39d64a[_0x340b('0x1d')]:_0xda1a37['offset']+_0xda1a37[_0x340b('0x1f')];var _0x77b84e;if(_0x5e3a4f>=_0x69c4fd){_0x5e3a4f=_0x69c4fd;_0x77b84e=0xc8;}else{_0x77b84e=0xce;}_0x1c73e6['status'](_0x77b84e);return _0x1c73e6[_0x340b('0x20')](_0x340b('0x21'),_0x5f4cae+'-'+_0x5e3a4f+'/'+_0x69c4fd)['json'](_0x39d64a);}return null;};}function patchUpdates(_0x4178b2){return function(_0x3792e0){try{jsonpatch[_0x340b('0x22')](_0x3792e0,_0x4178b2,!![]);}catch(_0x3931e8){return BPromise[_0x340b('0x23')](_0x3931e8);}return _0x3792e0['save']();};}function saveUpdates(_0x15372d,_0x2aa044){return function(_0x525833){if(_0x525833){return _0x525833[_0x340b('0x24')](_0x15372d)['then'](function(_0x529a87){return _0x529a87;});}return null;};}function removeEntity(_0x49dd15,_0x5b334c){return function(_0x278419){if(_0x278419){return _0x278419[_0x340b('0x25')]()[_0x340b('0x26')](function(){_0x49dd15[_0x340b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb11ff7,_0x5dc1f3){return function(_0x412e90){if(!_0x412e90){_0xb11ff7[_0x340b('0x18')](0x194);}return _0x412e90;};}function handleError(_0x19bfda,_0x56ae6d){_0x56ae6d=_0x56ae6d||0x1f4;return function(_0x3d1fca){logger[_0x340b('0x27')](_0x3d1fca['stack']);if(_0x3d1fca[_0x340b('0x28')]){delete _0x3d1fca[_0x340b('0x28')];}_0x19bfda['status'](_0x56ae6d)[_0x340b('0x29')](_0x3d1fca);};}exports[_0x340b('0x2a')]=function(_0x53d113,_0x29194e){var _0x3e03d2={},_0x550fc5={},_0x5d2736={'count':0x0,'rows':[]};var _0x595a82=_[_0x340b('0x2b')](db['SmsQueueReport'][_0x340b('0x2c')],function(_0x3223cf){return{'name':_0x3223cf[_0x340b('0x2d')],'type':_0x3223cf[_0x340b('0x2e')]['key']};});_0x550fc5[_0x340b('0x2f')]=_[_0x340b('0x2b')](_0x595a82,_0x340b('0x28'));_0x550fc5[_0x340b('0x30')]=_['keys'](_0x53d113[_0x340b('0x30')]);_0x550fc5[_0x340b('0x31')]=_[_0x340b('0x32')](_0x550fc5['model'],_0x550fc5['query']);_0x3e03d2[_0x340b('0x33')]=_['intersection'](_0x550fc5['model'],qs['fields'](_0x53d113['query'][_0x340b('0x34')]));_0x3e03d2[_0x340b('0x33')]=_0x3e03d2['attributes'][_0x340b('0x35')]?_0x3e03d2[_0x340b('0x33')]:_0x550fc5[_0x340b('0x2f')];if(!_0x53d113[_0x340b('0x30')][_0x340b('0x36')](_0x340b('0x37'))){_0x3e03d2[_0x340b('0x1f')]=qs[_0x340b('0x1f')](_0x53d113[_0x340b('0x30')][_0x340b('0x1f')]);_0x3e03d2[_0x340b('0x1e')]=qs[_0x340b('0x1e')](_0x53d113['query'][_0x340b('0x1e')]);}_0x3e03d2[_0x340b('0x38')]=qs[_0x340b('0x39')](_0x53d113[_0x340b('0x30')][_0x340b('0x39')]);_0x3e03d2['where']=qs['filters'](_[_0x340b('0x3a')](_0x53d113[_0x340b('0x30')],_0x550fc5['filters']),_0x595a82);if(_0x53d113[_0x340b('0x30')][_0x340b('0x3b')]){_0x3e03d2['where']=_[_0x340b('0x3c')](_0x3e03d2[_0x340b('0x3d')],{'$or':_[_0x340b('0x2b')](_0x595a82,function(_0x4251d1){if(_0x4251d1[_0x340b('0x2e')]!=='VIRTUAL'){var _0x2c1c65={};_0x2c1c65[_0x4251d1[_0x340b('0x28')]]={'$like':'%'+_0x53d113['query'][_0x340b('0x3b')]+'%'};return _0x2c1c65;}})});}_0x3e03d2=_[_0x340b('0x3c')]({},_0x3e03d2,_0x53d113['options']);var _0x57d7c9={'where':_0x3e03d2['where']};return db[_0x340b('0x3e')][_0x340b('0x1d')](_0x57d7c9)[_0x340b('0x26')](function(_0x164ca8){_0x5d2736[_0x340b('0x1d')]=_0x164ca8;if(_0x53d113['query'][_0x340b('0x3f')]){_0x3e03d2[_0x340b('0x40')]=[{'all':!![]}];}return db[_0x340b('0x3e')]['findAll'](_0x3e03d2);})[_0x340b('0x26')](function(_0x255d4e){_0x5d2736[_0x340b('0x41')]=_0x255d4e;return _0x5d2736;})[_0x340b('0x26')](respondWithFilteredResult(_0x29194e,_0x3e03d2))[_0x340b('0x42')](handleError(_0x29194e,null));};exports[_0x340b('0x43')]=function(_0x4d8310,_0xf66ac9){var _0xbfeadb={'raw':!![],'where':{'id':_0x4d8310['params']['id']}},_0x17ec81={};_0x17ec81[_0x340b('0x2f')]=_[_0x340b('0x44')](db[_0x340b('0x3e')][_0x340b('0x2c')]);_0x17ec81[_0x340b('0x30')]=_[_0x340b('0x44')](_0x4d8310[_0x340b('0x30')]);_0x17ec81[_0x340b('0x31')]=_[_0x340b('0x32')](_0x17ec81['model'],_0x17ec81['query']);_0xbfeadb[_0x340b('0x33')]=_[_0x340b('0x32')](_0x17ec81[_0x340b('0x2f')],qs[_0x340b('0x34')](_0x4d8310[_0x340b('0x30')][_0x340b('0x34')]));_0xbfeadb[_0x340b('0x33')]=_0xbfeadb[_0x340b('0x33')]['length']?_0xbfeadb[_0x340b('0x33')]:_0x17ec81[_0x340b('0x2f')];if(_0x4d8310[_0x340b('0x30')]['includeAll']){_0xbfeadb[_0x340b('0x40')]=[{'all':!![]}];}_0xbfeadb=_[_0x340b('0x3c')]({},_0xbfeadb,_0x4d8310[_0x340b('0x45')]);return db[_0x340b('0x3e')][_0x340b('0x46')](_0xbfeadb)['then'](handleEntityNotFound(_0xf66ac9,null))[_0x340b('0x26')](respondWithResult(_0xf66ac9,null))[_0x340b('0x42')](handleError(_0xf66ac9,null));};exports[_0x340b('0x47')]=function(_0x244d07,_0x690f9e){return db[_0x340b('0x3e')][_0x340b('0x47')](_0x244d07[_0x340b('0x48')],{})[_0x340b('0x26')](respondWithResult(_0x690f9e,0xc9))[_0x340b('0x42')](handleError(_0x690f9e,null));};exports['update']=function(_0x48d343,_0x243f61){if(_0x48d343[_0x340b('0x48')]['id']){delete _0x48d343[_0x340b('0x48')]['id'];}return db[_0x340b('0x3e')][_0x340b('0x46')]({'where':{'id':_0x48d343[_0x340b('0x49')]['id']}})[_0x340b('0x26')](handleEntityNotFound(_0x243f61,null))['then'](saveUpdates(_0x48d343[_0x340b('0x48')],null))[_0x340b('0x26')](respondWithResult(_0x243f61,null))[_0x340b('0x42')](handleError(_0x243f61,null));};exports[_0x340b('0x25')]=function(_0x12b532,_0x153199){return db[_0x340b('0x3e')][_0x340b('0x46')]({'where':{'id':_0x12b532[_0x340b('0x49')]['id']}})['then'](handleEntityNotFound(_0x153199,null))['then'](removeEntity(_0x153199,null))[_0x340b('0x42')](handleError(_0x153199,null));};exports[_0x340b('0x4a')]=function(_0x8c05a,_0x967e22){return db[_0x340b('0x3e')][_0x340b('0x4a')]()[_0x340b('0x26')](respondWithResult(_0x967e22,null))[_0x340b('0x42')](handleError(_0x967e22,null));}; \ No newline at end of file +var _0x6489=['merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','catch','show','params'];(function(_0x56c8d7,_0x5ca5e0){var _0x1c62f8=function(_0x569f4e){while(--_0x569f4e){_0x56c8d7['push'](_0x56c8d7['shift']());}};_0x1c62f8(++_0x5ca5e0);}(_0x6489,0x97));var _0x9648=function(_0x27a4fc,_0x5f079e){_0x27a4fc=_0x27a4fc-0x0;var _0x3fea5f=_0x6489[_0x27a4fc];return _0x3fea5f;};'use strict';var emlformat=require(_0x9648('0x0'));var rimraf=require(_0x9648('0x1'));var zipdir=require(_0x9648('0x2'));var jsonpatch=require(_0x9648('0x3'));var rp=require(_0x9648('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9648('0x5'));var util=require(_0x9648('0x6'));var path=require(_0x9648('0x7'));var sox=require(_0x9648('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9648('0x9'));var _=require(_0x9648('0xa'));var squel=require('squel');var crypto=require(_0x9648('0xb'));var jsforce=require(_0x9648('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9648('0xd'));var querystring=require('querystring');var Papa=require(_0x9648('0xe'));var Redis=require(_0x9648('0xf'));var authService=require(_0x9648('0x10'));var qs=require(_0x9648('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9648('0x12'));var utils=require(_0x9648('0x13'));var config=require(_0x9648('0x14'));var licenseUtil=require(_0x9648('0x15'));var db=require(_0x9648('0x16'))['db'];function respondWithStatusCode(_0x3e99d7,_0x4395ff){_0x4395ff=_0x4395ff||0xcc;return function(_0x325917){if(_0x325917){return _0x3e99d7['sendStatus'](_0x4395ff);}return _0x3e99d7[_0x9648('0x17')](_0x4395ff)[_0x9648('0x18')]();};}function respondWithResult(_0x323b6f,_0x382b9c){_0x382b9c=_0x382b9c||0xc8;return function(_0x118037){if(_0x118037){return _0x323b6f[_0x9648('0x17')](_0x382b9c)[_0x9648('0x19')](_0x118037);}};}function respondWithFilteredResult(_0x4fb94e,_0x419e0e){return function(_0x294654){if(_0x294654){var _0x2de609=typeof _0x419e0e['offset']===_0x9648('0x1a')&&typeof _0x419e0e['limit']===_0x9648('0x1a');var _0x5a6f9f=_0x294654[_0x9648('0x1b')];var _0x3a8641=_0x2de609?0x0:_0x419e0e[_0x9648('0x1c')];var _0x528278=_0x2de609?_0x294654[_0x9648('0x1b')]:_0x419e0e[_0x9648('0x1c')]+_0x419e0e['limit'];var _0xba82d5;if(_0x528278>=_0x5a6f9f){_0x528278=_0x5a6f9f;_0xba82d5=0xc8;}else{_0xba82d5=0xce;}_0x4fb94e[_0x9648('0x17')](_0xba82d5);return _0x4fb94e['set'](_0x9648('0x1d'),_0x3a8641+'-'+_0x528278+'/'+_0x5a6f9f)[_0x9648('0x19')](_0x294654);}return null;};}function patchUpdates(_0x574a69){return function(_0x2cd8f1){try{jsonpatch[_0x9648('0x1e')](_0x2cd8f1,_0x574a69,!![]);}catch(_0x378b74){return BPromise['reject'](_0x378b74);}return _0x2cd8f1[_0x9648('0x1f')]();};}function saveUpdates(_0x37841b,_0x5b7284){return function(_0x406c5d){if(_0x406c5d){return _0x406c5d[_0x9648('0x20')](_0x37841b)[_0x9648('0x21')](function(_0x15c30b){return _0x15c30b;});}return null;};}function removeEntity(_0xab06b1,_0x4cf5cb){return function(_0x375573){if(_0x375573){return _0x375573[_0x9648('0x22')]()[_0x9648('0x21')](function(){_0xab06b1[_0x9648('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x78a4ed,_0x1c0da7){return function(_0x43caa4){if(!_0x43caa4){_0x78a4ed[_0x9648('0x23')](0x194);}return _0x43caa4;};}function handleError(_0x20b210,_0x3ef816){_0x3ef816=_0x3ef816||0x1f4;return function(_0x1422af){logger[_0x9648('0x24')](_0x1422af[_0x9648('0x25')]);if(_0x1422af[_0x9648('0x26')]){delete _0x1422af['name'];}_0x20b210[_0x9648('0x17')](_0x3ef816)[_0x9648('0x27')](_0x1422af);};}exports['index']=function(_0x1a3008,_0x3753b2){var _0x2ab8ce={},_0x4f6d28={},_0x12a48c={'count':0x0,'rows':[]};var _0x4d6c7e=_['map'](db[_0x9648('0x28')][_0x9648('0x29')],function(_0x54f185){return{'name':_0x54f185[_0x9648('0x2a')],'type':_0x54f185[_0x9648('0x2b')][_0x9648('0x2c')]};});_0x4f6d28[_0x9648('0x2d')]=_[_0x9648('0x2e')](_0x4d6c7e,_0x9648('0x26'));_0x4f6d28[_0x9648('0x2f')]=_[_0x9648('0x30')](_0x1a3008[_0x9648('0x2f')]);_0x4f6d28[_0x9648('0x31')]=_[_0x9648('0x32')](_0x4f6d28[_0x9648('0x2d')],_0x4f6d28[_0x9648('0x2f')]);_0x2ab8ce['attributes']=_[_0x9648('0x32')](_0x4f6d28[_0x9648('0x2d')],qs[_0x9648('0x33')](_0x1a3008[_0x9648('0x2f')][_0x9648('0x33')]));_0x2ab8ce[_0x9648('0x34')]=_0x2ab8ce['attributes'][_0x9648('0x35')]?_0x2ab8ce[_0x9648('0x34')]:_0x4f6d28[_0x9648('0x2d')];if(!_0x1a3008[_0x9648('0x2f')][_0x9648('0x36')](_0x9648('0x37'))){_0x2ab8ce['limit']=qs[_0x9648('0x38')](_0x1a3008[_0x9648('0x2f')][_0x9648('0x38')]);_0x2ab8ce[_0x9648('0x1c')]=qs[_0x9648('0x1c')](_0x1a3008['query']['offset']);}_0x2ab8ce['order']=qs['sort'](_0x1a3008['query'][_0x9648('0x39')]);_0x2ab8ce[_0x9648('0x3a')]=qs[_0x9648('0x31')](_[_0x9648('0x3b')](_0x1a3008[_0x9648('0x2f')],_0x4f6d28[_0x9648('0x31')]),_0x4d6c7e);if(_0x1a3008[_0x9648('0x2f')]['filter']){_0x2ab8ce[_0x9648('0x3a')]=_['merge'](_0x2ab8ce[_0x9648('0x3a')],{'$or':_[_0x9648('0x2e')](_0x4d6c7e,function(_0x19600b){if(_0x19600b[_0x9648('0x2b')]!==_0x9648('0x3c')){var _0x3fec52={};_0x3fec52[_0x19600b['name']]={'$like':'%'+_0x1a3008[_0x9648('0x2f')]['filter']+'%'};return _0x3fec52;}})});}_0x2ab8ce=_['merge']({},_0x2ab8ce,_0x1a3008[_0x9648('0x3d')]);var _0x45249e={'where':_0x2ab8ce[_0x9648('0x3a')]};return db[_0x9648('0x28')][_0x9648('0x1b')](_0x45249e)[_0x9648('0x21')](function(_0x1b469e){_0x12a48c['count']=_0x1b469e;if(_0x1a3008['query'][_0x9648('0x3e')]){_0x2ab8ce[_0x9648('0x3f')]=[{'all':!![]}];}return db[_0x9648('0x28')][_0x9648('0x40')](_0x2ab8ce);})['then'](function(_0x39f64c){_0x12a48c['rows']=_0x39f64c;return _0x12a48c;})['then'](respondWithFilteredResult(_0x3753b2,_0x2ab8ce))[_0x9648('0x41')](handleError(_0x3753b2,null));};exports[_0x9648('0x42')]=function(_0x317832,_0x40542c){var _0x3f08fa={'raw':!![],'where':{'id':_0x317832[_0x9648('0x43')]['id']}},_0x59a276={};_0x59a276[_0x9648('0x2d')]=_[_0x9648('0x30')](db[_0x9648('0x28')]['rawAttributes']);_0x59a276[_0x9648('0x2f')]=_[_0x9648('0x30')](_0x317832[_0x9648('0x2f')]);_0x59a276['filters']=_['intersection'](_0x59a276[_0x9648('0x2d')],_0x59a276[_0x9648('0x2f')]);_0x3f08fa[_0x9648('0x34')]=_['intersection'](_0x59a276['model'],qs[_0x9648('0x33')](_0x317832[_0x9648('0x2f')][_0x9648('0x33')]));_0x3f08fa[_0x9648('0x34')]=_0x3f08fa[_0x9648('0x34')][_0x9648('0x35')]?_0x3f08fa['attributes']:_0x59a276[_0x9648('0x2d')];if(_0x317832[_0x9648('0x2f')][_0x9648('0x3e')]){_0x3f08fa[_0x9648('0x3f')]=[{'all':!![]}];}_0x3f08fa=_[_0x9648('0x44')]({},_0x3f08fa,_0x317832['options']);return db['SmsQueueReport']['find'](_0x3f08fa)[_0x9648('0x21')](handleEntityNotFound(_0x40542c,null))[_0x9648('0x21')](respondWithResult(_0x40542c,null))[_0x9648('0x41')](handleError(_0x40542c,null));};exports[_0x9648('0x45')]=function(_0x4cc679,_0x43087c){return db[_0x9648('0x28')]['create'](_0x4cc679[_0x9648('0x46')],{})[_0x9648('0x21')](respondWithResult(_0x43087c,0xc9))['catch'](handleError(_0x43087c,null));};exports[_0x9648('0x20')]=function(_0x1d87e0,_0xdbc3c){if(_0x1d87e0[_0x9648('0x46')]['id']){delete _0x1d87e0['body']['id'];}return db[_0x9648('0x28')][_0x9648('0x47')]({'where':{'id':_0x1d87e0[_0x9648('0x43')]['id']}})[_0x9648('0x21')](handleEntityNotFound(_0xdbc3c,null))['then'](saveUpdates(_0x1d87e0[_0x9648('0x46')],null))[_0x9648('0x21')](respondWithResult(_0xdbc3c,null))[_0x9648('0x41')](handleError(_0xdbc3c,null));};exports[_0x9648('0x22')]=function(_0x2c9c22,_0x3c022c){return db[_0x9648('0x28')][_0x9648('0x47')]({'where':{'id':_0x2c9c22[_0x9648('0x43')]['id']}})[_0x9648('0x21')](handleEntityNotFound(_0x3c022c,null))[_0x9648('0x21')](removeEntity(_0x3c022c,null))[_0x9648('0x41')](handleError(_0x3c022c,null));};exports['describe']=function(_0x4b8c04,_0x379ab8){return db['SmsQueueReport'][_0x9648('0x48')]()['then'](respondWithResult(_0x379ab8,null))[_0x9648('0x41')](handleError(_0x379ab8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 8e855f2..6ea4d88 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 071bf50..156605d 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 _0x8ae2=['info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','UpdateSmsQueueReport','attributes','limit','then','lodash','util','bluebird','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x595a26,_0x20c88a){var _0x21d2c1=function(_0x5c1788){while(--_0x5c1788){_0x595a26['push'](_0x595a26['shift']());}};_0x21d2c1(++_0x20c88a);}(_0x8ae2,0xeb));var _0x28ae=function(_0x1aab44,_0x15b157){_0x1aab44=_0x1aab44-0x0;var _0x42bb37=_0x8ae2[_0x1aab44];return _0x42bb37;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var moment=require('moment');var BPromise=require(_0x28ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28ae('0x3'));var config=require(_0x28ae('0x4'));var jayson=require(_0x28ae('0x5'));var client=jayson[_0x28ae('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b5c8,_0x11b2c2,_0x105381){return new BPromise(function(_0x1ddff5,_0x8cffd6){return client[_0x28ae('0x7')](_0x33b5c8,_0x105381)['then'](function(_0x41b371){logger[_0x28ae('0x8')](_0x28ae('0x9'),_0x11b2c2,'request\x20sent');logger[_0x28ae('0xa')](_0x28ae('0xb'),_0x11b2c2,_0x28ae('0xc'),JSON[_0x28ae('0xd')](_0x41b371));if(_0x41b371[_0x28ae('0xe')]){if(_0x41b371['error'][_0x28ae('0xf')]===0x1f4){logger[_0x28ae('0xe')](_0x28ae('0x9'),_0x11b2c2,_0x41b371['error'][_0x28ae('0x10')]);return _0x8cffd6(_0x41b371['error'][_0x28ae('0x10')]);}logger[_0x28ae('0xe')](_0x28ae('0x9'),_0x11b2c2,_0x41b371[_0x28ae('0xe')][_0x28ae('0x10')]);return _0x1ddff5(_0x41b371[_0x28ae('0xe')][_0x28ae('0x10')]);}else{logger[_0x28ae('0x8')](_0x28ae('0x9'),_0x11b2c2,_0x28ae('0xc'));_0x1ddff5(_0x41b371[_0x28ae('0x11')]['message']);}})[_0x28ae('0x12')](function(_0x1b0f31){logger[_0x28ae('0xe')](_0x28ae('0x9'),_0x11b2c2,_0x1b0f31);_0x8cffd6(_0x1b0f31);});});}exports[_0x28ae('0x13')]=function(_0x334383){var _0x299e15=this;return new Promise(function(_0x526618,_0x3a4f6e){return db[_0x28ae('0x14')]['create'](_0x334383[_0x28ae('0x15')],{'raw':_0x334383[_0x28ae('0x16')]?_0x334383[_0x28ae('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5bf2d7){logger[_0x28ae('0x8')](_0x28ae('0x13'),_0x334383);logger[_0x28ae('0xa')](_0x28ae('0x13'),_0x334383,JSON['stringify'](_0x5bf2d7));_0x526618(_0x5bf2d7);})[_0x28ae('0x12')](function(_0x59b1a3){logger[_0x28ae('0xe')](_0x28ae('0x13'),_0x59b1a3[_0x28ae('0x10')],_0x334383);_0x3a4f6e(_0x299e15[_0x28ae('0xe')](0x1f4,_0x59b1a3[_0x28ae('0x10')]));});});};exports[_0x28ae('0x17')]=function(_0x500d5a){var _0x26cfda=this;return new Promise(function(_0x3393c7,_0x17a40b){return db[_0x28ae('0x14')]['update'](_0x500d5a[_0x28ae('0x15')],{'raw':_0x500d5a[_0x28ae('0x16')]?_0x500d5a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x500d5a[_0x28ae('0x16')]?_0x500d5a['options']['where']||null:null,'attributes':_0x500d5a['options']?_0x500d5a[_0x28ae('0x16')][_0x28ae('0x18')]||null:null,'limit':_0x500d5a[_0x28ae('0x16')]?_0x500d5a['options'][_0x28ae('0x19')]||null:null})[_0x28ae('0x1a')](function(_0xac91ba){logger['info']('UpdateSmsQueueReport',_0x500d5a);logger[_0x28ae('0xa')](_0x28ae('0x17'),_0x500d5a,JSON['stringify'](_0xac91ba));_0x3393c7(_0xac91ba);})[_0x28ae('0x12')](function(_0x2cb561){logger[_0x28ae('0xe')](_0x28ae('0x17'),_0x2cb561['message'],_0x500d5a);_0x17a40b(_0x26cfda[_0x28ae('0xe')](0x1f4,_0x2cb561[_0x28ae('0x10')]));});});}; \ No newline at end of file +var _0xe5bc=['body','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xe5bc,0xc7));var _0xce5b=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xe5bc[_0x5eaa0b];return _0x28b295;};'use strict';var _=require(_0xce5b('0x0'));var util=require('util');var moment=require(_0xce5b('0x1'));var BPromise=require(_0xce5b('0x2'));var rs=require(_0xce5b('0x3'));var fs=require('fs');var Redis=require(_0xce5b('0x4'));var db=require(_0xce5b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xce5b('0x6'));var jayson=require(_0xce5b('0x7'));var client=jayson[_0xce5b('0x8')][_0xce5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470208,_0x169c7e,_0x1623e9){return new BPromise(function(_0x38d4f1,_0x2cbced){return client[_0xce5b('0xa')](_0x470208,_0x1623e9)[_0xce5b('0xb')](function(_0x335358){logger['info'](_0xce5b('0xc'),_0x169c7e,_0xce5b('0xd'));logger[_0xce5b('0xe')](_0xce5b('0xf'),_0x169c7e,_0xce5b('0xd'),JSON[_0xce5b('0x10')](_0x335358));if(_0x335358[_0xce5b('0x11')]){if(_0x335358[_0xce5b('0x11')]['code']===0x1f4){logger['error'](_0xce5b('0xc'),_0x169c7e,_0x335358[_0xce5b('0x11')][_0xce5b('0x12')]);return _0x2cbced(_0x335358[_0xce5b('0x11')][_0xce5b('0x12')]);}logger[_0xce5b('0x11')](_0xce5b('0xc'),_0x169c7e,_0x335358[_0xce5b('0x11')][_0xce5b('0x12')]);return _0x38d4f1(_0x335358[_0xce5b('0x11')][_0xce5b('0x12')]);}else{logger[_0xce5b('0x13')](_0xce5b('0xc'),_0x169c7e,_0xce5b('0xd'));_0x38d4f1(_0x335358[_0xce5b('0x14')][_0xce5b('0x12')]);}})[_0xce5b('0x15')](function(_0x1f5736){logger[_0xce5b('0x11')](_0xce5b('0xc'),_0x169c7e,_0x1f5736);_0x2cbced(_0x1f5736);});});}exports[_0xce5b('0x16')]=function(_0x23a4a2){var _0x2f285c=this;return new Promise(function(_0x33c89b,_0x22aa48){return db[_0xce5b('0x17')][_0xce5b('0x18')](_0x23a4a2[_0xce5b('0x19')],{'raw':_0x23a4a2['options']?_0x23a4a2[_0xce5b('0x1a')][_0xce5b('0x1b')]===undefined?!![]:![]:!![]})[_0xce5b('0xb')](function(_0x2d8d57){logger[_0xce5b('0x13')](_0xce5b('0x16'),_0x23a4a2);logger[_0xce5b('0xe')](_0xce5b('0x16'),_0x23a4a2,JSON['stringify'](_0x2d8d57));_0x33c89b(_0x2d8d57);})[_0xce5b('0x15')](function(_0x5d6445){logger[_0xce5b('0x11')](_0xce5b('0x16'),_0x5d6445[_0xce5b('0x12')],_0x23a4a2);_0x22aa48(_0x2f285c[_0xce5b('0x11')](0x1f4,_0x5d6445[_0xce5b('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x1510c0){var _0x216b88=this;return new Promise(function(_0x1aa9d1,_0xef450d){return db[_0xce5b('0x17')][_0xce5b('0x1c')](_0x1510c0[_0xce5b('0x19')],{'raw':_0x1510c0['options']?_0x1510c0[_0xce5b('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1510c0[_0xce5b('0x1a')]?_0x1510c0['options'][_0xce5b('0x1d')]||null:null,'attributes':_0x1510c0['options']?_0x1510c0[_0xce5b('0x1a')]['attributes']||null:null,'limit':_0x1510c0[_0xce5b('0x1a')]?_0x1510c0[_0xce5b('0x1a')][_0xce5b('0x1e')]||null:null})[_0xce5b('0xb')](function(_0x47fcdb){logger[_0xce5b('0x13')](_0xce5b('0x1f'),_0x1510c0);logger[_0xce5b('0xe')]('UpdateSmsQueueReport',_0x1510c0,JSON[_0xce5b('0x10')](_0x47fcdb));_0x1aa9d1(_0x47fcdb);})[_0xce5b('0x15')](function(_0x460371){logger[_0xce5b('0x11')](_0xce5b('0x1f'),_0x460371[_0xce5b('0x12')],_0x1510c0);_0xef450d(_0x216b88[_0xce5b('0x11')](0x1f4,_0x460371['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8086d84..461f3c0 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 _0x0d4d=['isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x42ba8a,_0x28523a){var _0x419312=function(_0x2be76c){while(--_0x2be76c){_0x42ba8a['push'](_0x42ba8a['shift']());}};_0x419312(++_0x28523a);}(_0x0d4d,0x132));var _0xd0d4=function(_0x260046,_0x3f1234){_0x260046=_0x260046-0x0;var _0x5ecaca=_0x0d4d[_0x260046];return _0x5ecaca;};'use strict';var multer=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var path=require(_0xd0d4('0x2'));var timeout=require(_0xd0d4('0x3'));var express=require(_0xd0d4('0x4'));var router=express[_0xd0d4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd0d4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d4('0x7'));var controller=require(_0xd0d4('0x8'));router['get']('/',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xa')]);router[_0xd0d4('0xb')]('/describe',auth[_0xd0d4('0x9')](),controller['describe']);router[_0xd0d4('0xb')]('/:id',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0xc')]);router[_0xd0d4('0xd')]('/',auth['isAuthenticated'](),controller[_0xd0d4('0xe')]);router[_0xd0d4('0xf')](_0xd0d4('0x10'),auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x11')]);router[_0xd0d4('0x12')]('/:id',auth[_0xd0d4('0x9')](),controller[_0xd0d4('0x13')]);module[_0xd0d4('0x14')]=router; \ No newline at end of file +var _0x08d9=['fs-extra','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','path','express','Router'];(function(_0x774c66,_0x286ae7){var _0x3d1162=function(_0x4da42d){while(--_0x4da42d){_0x774c66['push'](_0x774c66['shift']());}};_0x3d1162(++_0x286ae7);}(_0x08d9,0xc2));var _0x908d=function(_0x9e712e,_0x2b2137){_0x9e712e=_0x9e712e-0x0;var _0x36d9ce=_0x08d9[_0x9e712e];return _0x36d9ce;};'use strict';var multer=require(_0x908d('0x0'));var util=require('util');var path=require(_0x908d('0x1'));var timeout=require('connect-timeout');var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var fs_extra=require(_0x908d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x908d('0x5'));var controller=require(_0x908d('0x6'));router[_0x908d('0x7')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0x9')]);router['get'](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0xb')]);router[_0x908d('0x7')](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0xd')]);router[_0x908d('0xe')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0xf')]);router['put'](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0x10')]);router[_0x908d('0x11')](_0x908d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index a37722c..975facc 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xe17c90,_0x451862){var _0x14d727=function(_0x480f93){while(--_0x480f93){_0xe17c90['push'](_0xe17c90['shift']());}};_0x14d727(++_0x451862);}(_0xf4eb,0xec));var _0xbf4e=function(_0xfc548d,_0xe0288f){_0xfc548d=_0xfc548d-0x0;var _0x342863=_0xf4eb[_0xfc548d];return _0x342863;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x1a051a,_0x55f2e6){var _0x3daaad=function(_0x3c5b28){while(--_0x3c5b28){_0x1a051a['push'](_0x1a051a['shift']());}};_0x3daaad(++_0x55f2e6);}(_0xe706,0xa3));var _0x6e70=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0xe706[_0x1aeb39];return _0x439790;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f05f3cb..1a2816a 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 _0x942c=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','SmsTransferReport','rawAttributes'];(function(_0x1836a6,_0x400ad4){var _0x21cc0a=function(_0x11960d){while(--_0x11960d){_0x1836a6['push'](_0x1836a6['shift']());}};_0x21cc0a(++_0x400ad4);}(_0x942c,0x6f));var _0xc942=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x942c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc942('0x0'));var rimraf=require(_0xc942('0x1'));var zipdir=require(_0xc942('0x2'));var jsonpatch=require(_0xc942('0x3'));var rp=require(_0xc942('0x4'));var moment=require(_0xc942('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc942('0x6'));var util=require(_0xc942('0x7'));var path=require(_0xc942('0x8'));var sox=require(_0xc942('0x9'));var csv=require('to-csv');var ejs=require(_0xc942('0xa'));var fs=require('fs');var fs_extra=require(_0xc942('0xb'));var _=require(_0xc942('0xc'));var squel=require(_0xc942('0xd'));var crypto=require(_0xc942('0xe'));var jsforce=require(_0xc942('0xf'));var deskjs=require(_0xc942('0x10'));var toCsv=require(_0xc942('0x11'));var querystring=require('querystring');var Papa=require(_0xc942('0x12'));var Redis=require(_0xc942('0x13'));var authService=require(_0xc942('0x14'));var qs=require(_0xc942('0x15'));var as=require(_0xc942('0x16'));var hardwareService=require(_0xc942('0x17'));var logger=require(_0xc942('0x18'))(_0xc942('0x19'));var utils=require(_0xc942('0x1a'));var config=require(_0xc942('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc942('0x1c'))['db'];function respondWithStatusCode(_0x4de0ef,_0x507d84){_0x507d84=_0x507d84||0xcc;return function(_0x39308a){if(_0x39308a){return _0x4de0ef['sendStatus'](_0x507d84);}return _0x4de0ef['status'](_0x507d84)[_0xc942('0x1d')]();};}function respondWithResult(_0x21c024,_0x5d5355){_0x5d5355=_0x5d5355||0xc8;return function(_0x16b33e){if(_0x16b33e){return _0x21c024[_0xc942('0x1e')](_0x5d5355)[_0xc942('0x1f')](_0x16b33e);}};}function respondWithFilteredResult(_0x11f2d9,_0x352b95){return function(_0x28ba58){if(_0x28ba58){var _0x24c085=typeof _0x352b95[_0xc942('0x20')]===_0xc942('0x21')&&typeof _0x352b95[_0xc942('0x22')]==='undefined';var _0x512f58=_0x28ba58['count'];var _0x4498f3=_0x24c085?0x0:_0x352b95[_0xc942('0x20')];var _0x495743=_0x24c085?_0x28ba58[_0xc942('0x23')]:_0x352b95[_0xc942('0x20')]+_0x352b95[_0xc942('0x22')];var _0x27502b;if(_0x495743>=_0x512f58){_0x495743=_0x512f58;_0x27502b=0xc8;}else{_0x27502b=0xce;}_0x11f2d9[_0xc942('0x1e')](_0x27502b);return _0x11f2d9[_0xc942('0x24')]('Content-Range',_0x4498f3+'-'+_0x495743+'/'+_0x512f58)[_0xc942('0x1f')](_0x28ba58);}return null;};}function patchUpdates(_0x1c3019){return function(_0x4079a2){try{jsonpatch[_0xc942('0x25')](_0x4079a2,_0x1c3019,!![]);}catch(_0x1ad025){return BPromise[_0xc942('0x26')](_0x1ad025);}return _0x4079a2[_0xc942('0x27')]();};}function saveUpdates(_0x5ce32f,_0x3c7722){return function(_0x2c9d64){if(_0x2c9d64){return _0x2c9d64['update'](_0x5ce32f)[_0xc942('0x28')](function(_0x2560b0){return _0x2560b0;});}return null;};}function removeEntity(_0x336b03,_0x428a6d){return function(_0x3800b7){if(_0x3800b7){return _0x3800b7[_0xc942('0x29')]()[_0xc942('0x28')](function(){_0x336b03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ff53,_0x3bd24e){return function(_0xa07374){if(!_0xa07374){_0x12ff53[_0xc942('0x2a')](0x194);}return _0xa07374;};}function handleError(_0x48bb54,_0x29a484){_0x29a484=_0x29a484||0x1f4;return function(_0x443ff6){logger[_0xc942('0x2b')](_0x443ff6[_0xc942('0x2c')]);if(_0x443ff6[_0xc942('0x2d')]){delete _0x443ff6[_0xc942('0x2d')];}_0x48bb54['status'](_0x29a484)['send'](_0x443ff6);};}exports['index']=function(_0x8bdda4,_0x27ab4c){var _0x4b6256={},_0x3fd47a={},_0x445ef6={'count':0x0,'rows':[]};var _0x4d45de=_[_0xc942('0x2e')](db[_0xc942('0x2f')][_0xc942('0x30')],function(_0x226954){return{'name':_0x226954[_0xc942('0x31')],'type':_0x226954[_0xc942('0x32')][_0xc942('0x33')]};});_0x3fd47a[_0xc942('0x34')]=_[_0xc942('0x2e')](_0x4d45de,'name');_0x3fd47a[_0xc942('0x35')]=_[_0xc942('0x36')](_0x8bdda4['query']);_0x3fd47a[_0xc942('0x37')]=_[_0xc942('0x38')](_0x3fd47a[_0xc942('0x34')],_0x3fd47a[_0xc942('0x35')]);_0x4b6256[_0xc942('0x39')]=_[_0xc942('0x38')](_0x3fd47a['model'],qs[_0xc942('0x3a')](_0x8bdda4[_0xc942('0x35')]['fields']));_0x4b6256[_0xc942('0x39')]=_0x4b6256[_0xc942('0x39')]['length']?_0x4b6256[_0xc942('0x39')]:_0x3fd47a[_0xc942('0x34')];if(!_0x8bdda4[_0xc942('0x35')][_0xc942('0x3b')]('nolimit')){_0x4b6256['limit']=qs['limit'](_0x8bdda4[_0xc942('0x35')][_0xc942('0x22')]);_0x4b6256[_0xc942('0x20')]=qs[_0xc942('0x20')](_0x8bdda4[_0xc942('0x35')][_0xc942('0x20')]);}_0x4b6256[_0xc942('0x3c')]=qs[_0xc942('0x3d')](_0x8bdda4[_0xc942('0x35')][_0xc942('0x3d')]);_0x4b6256[_0xc942('0x3e')]=qs[_0xc942('0x37')](_['pick'](_0x8bdda4['query'],_0x3fd47a[_0xc942('0x37')]),_0x4d45de);if(_0x8bdda4['query'][_0xc942('0x3f')]){_0x4b6256['where']=_['merge'](_0x4b6256[_0xc942('0x3e')],{'$or':_[_0xc942('0x2e')](_0x4d45de,function(_0x52f256){if(_0x52f256[_0xc942('0x32')]!==_0xc942('0x40')){var _0xf64247={};_0xf64247[_0x52f256[_0xc942('0x2d')]]={'$like':'%'+_0x8bdda4[_0xc942('0x35')][_0xc942('0x3f')]+'%'};return _0xf64247;}})});}_0x4b6256=_[_0xc942('0x41')]({},_0x4b6256,_0x8bdda4[_0xc942('0x42')]);var _0x32a254={'where':_0x4b6256[_0xc942('0x3e')]};return db[_0xc942('0x2f')]['count'](_0x32a254)[_0xc942('0x28')](function(_0x5e1398){_0x445ef6[_0xc942('0x23')]=_0x5e1398;if(_0x8bdda4[_0xc942('0x35')][_0xc942('0x43')]){_0x4b6256[_0xc942('0x44')]=[{'all':!![]}];}return db[_0xc942('0x2f')][_0xc942('0x45')](_0x4b6256);})[_0xc942('0x28')](function(_0x31c6b6){_0x445ef6[_0xc942('0x46')]=_0x31c6b6;return _0x445ef6;})[_0xc942('0x28')](respondWithFilteredResult(_0x27ab4c,_0x4b6256))[_0xc942('0x47')](handleError(_0x27ab4c,null));};exports[_0xc942('0x48')]=function(_0x253582,_0x1b94c7){var _0x36c0c4={'raw':!![],'where':{'id':_0x253582[_0xc942('0x49')]['id']}},_0x4e0ca2={};_0x4e0ca2[_0xc942('0x34')]=_[_0xc942('0x36')](db[_0xc942('0x2f')][_0xc942('0x30')]);_0x4e0ca2[_0xc942('0x35')]=_[_0xc942('0x36')](_0x253582[_0xc942('0x35')]);_0x4e0ca2['filters']=_[_0xc942('0x38')](_0x4e0ca2[_0xc942('0x34')],_0x4e0ca2[_0xc942('0x35')]);_0x36c0c4[_0xc942('0x39')]=_[_0xc942('0x38')](_0x4e0ca2['model'],qs['fields'](_0x253582[_0xc942('0x35')]['fields']));_0x36c0c4[_0xc942('0x39')]=_0x36c0c4[_0xc942('0x39')][_0xc942('0x4a')]?_0x36c0c4[_0xc942('0x39')]:_0x4e0ca2[_0xc942('0x34')];if(_0x253582[_0xc942('0x35')][_0xc942('0x43')]){_0x36c0c4[_0xc942('0x44')]=[{'all':!![]}];}_0x36c0c4=_['merge']({},_0x36c0c4,_0x253582[_0xc942('0x42')]);return db[_0xc942('0x2f')][_0xc942('0x4b')](_0x36c0c4)[_0xc942('0x28')](handleEntityNotFound(_0x1b94c7,null))[_0xc942('0x28')](respondWithResult(_0x1b94c7,null))[_0xc942('0x47')](handleError(_0x1b94c7,null));};exports[_0xc942('0x4c')]=function(_0x5917db,_0x109f01){return db['SmsTransferReport'][_0xc942('0x4c')](_0x5917db[_0xc942('0x4d')],{})[_0xc942('0x28')](respondWithResult(_0x109f01,0xc9))['catch'](handleError(_0x109f01,null));};exports[_0xc942('0x4e')]=function(_0x55b2c1,_0x5c824a){if(_0x55b2c1[_0xc942('0x4d')]['id']){delete _0x55b2c1[_0xc942('0x4d')]['id'];}return db[_0xc942('0x2f')][_0xc942('0x4b')]({'where':{'id':_0x55b2c1['params']['id']}})[_0xc942('0x28')](handleEntityNotFound(_0x5c824a,null))[_0xc942('0x28')](saveUpdates(_0x55b2c1[_0xc942('0x4d')],null))['then'](respondWithResult(_0x5c824a,null))[_0xc942('0x47')](handleError(_0x5c824a,null));};exports[_0xc942('0x29')]=function(_0x4b8c76,_0x1e29a1){return db['SmsTransferReport'][_0xc942('0x4b')]({'where':{'id':_0x4b8c76[_0xc942('0x49')]['id']}})[_0xc942('0x28')](handleEntityNotFound(_0x1e29a1,null))[_0xc942('0x28')](removeEntity(_0x1e29a1,null))[_0xc942('0x47')](handleError(_0x1e29a1,null));};exports[_0xc942('0x4f')]=function(_0x113ec6,_0x24014b){return db[_0xc942('0x2f')][_0xc942('0x4f')]()[_0xc942('0x28')](respondWithResult(_0x24014b,null))[_0xc942('0x47')](handleError(_0x24014b,null));}; \ No newline at end of file +var _0xec2d=['squel','crypto','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','undefined','limit','count','json','reject','save','update','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0xec2d,0xcc));var _0xdec2=function(_0x231562,_0xab9705){_0x231562=_0x231562-0x0;var _0x3df715=_0xec2d[_0x231562];return _0x3df715;};'use strict';var emlformat=require(_0xdec2('0x0'));var rimraf=require(_0xdec2('0x1'));var zipdir=require(_0xdec2('0x2'));var jsonpatch=require(_0xdec2('0x3'));var rp=require('request-promise');var moment=require(_0xdec2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdec2('0x5'));var util=require(_0xdec2('0x6'));var path=require(_0xdec2('0x7'));var sox=require(_0xdec2('0x8'));var csv=require('to-csv');var ejs=require(_0xdec2('0x9'));var fs=require('fs');var fs_extra=require(_0xdec2('0xa'));var _=require(_0xdec2('0xb'));var squel=require(_0xdec2('0xc'));var crypto=require(_0xdec2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdec2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdec2('0xf'));var Papa=require(_0xdec2('0x10'));var Redis=require('ioredis');var authService=require(_0xdec2('0x11'));var qs=require(_0xdec2('0x12'));var as=require(_0xdec2('0x13'));var hardwareService=require(_0xdec2('0x14'));var logger=require(_0xdec2('0x15'))('api');var utils=require(_0xdec2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdec2('0x17'));var db=require(_0xdec2('0x18'))['db'];function respondWithStatusCode(_0x203550,_0x14856a){_0x14856a=_0x14856a||0xcc;return function(_0x393534){if(_0x393534){return _0x203550[_0xdec2('0x19')](_0x14856a);}return _0x203550[_0xdec2('0x1a')](_0x14856a)[_0xdec2('0x1b')]();};}function respondWithResult(_0x10ac1f,_0x4c831a){_0x4c831a=_0x4c831a||0xc8;return function(_0x357dc2){if(_0x357dc2){return _0x10ac1f[_0xdec2('0x1a')](_0x4c831a)['json'](_0x357dc2);}};}function respondWithFilteredResult(_0x42638a,_0xeb71a4){return function(_0x345bfb){if(_0x345bfb){var _0x139574=typeof _0xeb71a4['offset']===_0xdec2('0x1c')&&typeof _0xeb71a4[_0xdec2('0x1d')]===_0xdec2('0x1c');var _0x577fb2=_0x345bfb['count'];var _0x55b810=_0x139574?0x0:_0xeb71a4['offset'];var _0x458058=_0x139574?_0x345bfb[_0xdec2('0x1e')]:_0xeb71a4['offset']+_0xeb71a4[_0xdec2('0x1d')];var _0x1b4a87;if(_0x458058>=_0x577fb2){_0x458058=_0x577fb2;_0x1b4a87=0xc8;}else{_0x1b4a87=0xce;}_0x42638a[_0xdec2('0x1a')](_0x1b4a87);return _0x42638a['set']('Content-Range',_0x55b810+'-'+_0x458058+'/'+_0x577fb2)[_0xdec2('0x1f')](_0x345bfb);}return null;};}function patchUpdates(_0x15b8e4){return function(_0x6fa5f3){try{jsonpatch['apply'](_0x6fa5f3,_0x15b8e4,!![]);}catch(_0x595c3f){return BPromise[_0xdec2('0x20')](_0x595c3f);}return _0x6fa5f3[_0xdec2('0x21')]();};}function saveUpdates(_0x4a82b3,_0x3744d9){return function(_0x22faf0){if(_0x22faf0){return _0x22faf0[_0xdec2('0x22')](_0x4a82b3)[_0xdec2('0x23')](function(_0x31a4c4){return _0x31a4c4;});}return null;};}function removeEntity(_0x5d4fc9,_0x183bc4){return function(_0x437766){if(_0x437766){return _0x437766[_0xdec2('0x24')]()[_0xdec2('0x23')](function(){_0x5d4fc9[_0xdec2('0x1a')](0xcc)[_0xdec2('0x1b')]();});}};}function handleEntityNotFound(_0x49e058,_0x4fb89b){return function(_0x223ad2){if(!_0x223ad2){_0x49e058['sendStatus'](0x194);}return _0x223ad2;};}function handleError(_0x517c1b,_0xdad318){_0xdad318=_0xdad318||0x1f4;return function(_0x1ff946){logger[_0xdec2('0x25')](_0x1ff946['stack']);if(_0x1ff946[_0xdec2('0x26')]){delete _0x1ff946[_0xdec2('0x26')];}_0x517c1b[_0xdec2('0x1a')](_0xdad318)[_0xdec2('0x27')](_0x1ff946);};}exports[_0xdec2('0x28')]=function(_0xa67c7c,_0x1798ec){var _0x224038={},_0x426fe1={},_0x443aeb={'count':0x0,'rows':[]};var _0x352553=_[_0xdec2('0x29')](db[_0xdec2('0x2a')][_0xdec2('0x2b')],function(_0x161ea2){return{'name':_0x161ea2['fieldName'],'type':_0x161ea2[_0xdec2('0x2c')][_0xdec2('0x2d')]};});_0x426fe1['model']=_[_0xdec2('0x29')](_0x352553,_0xdec2('0x26'));_0x426fe1[_0xdec2('0x2e')]=_['keys'](_0xa67c7c[_0xdec2('0x2e')]);_0x426fe1[_0xdec2('0x2f')]=_[_0xdec2('0x30')](_0x426fe1['model'],_0x426fe1[_0xdec2('0x2e')]);_0x224038[_0xdec2('0x31')]=_[_0xdec2('0x30')](_0x426fe1['model'],qs[_0xdec2('0x32')](_0xa67c7c[_0xdec2('0x2e')][_0xdec2('0x32')]));_0x224038[_0xdec2('0x31')]=_0x224038['attributes']['length']?_0x224038[_0xdec2('0x31')]:_0x426fe1[_0xdec2('0x33')];if(!_0xa67c7c['query'][_0xdec2('0x34')]('nolimit')){_0x224038[_0xdec2('0x1d')]=qs['limit'](_0xa67c7c['query'][_0xdec2('0x1d')]);_0x224038[_0xdec2('0x35')]=qs[_0xdec2('0x35')](_0xa67c7c[_0xdec2('0x2e')]['offset']);}_0x224038[_0xdec2('0x36')]=qs[_0xdec2('0x37')](_0xa67c7c[_0xdec2('0x2e')][_0xdec2('0x37')]);_0x224038['where']=qs[_0xdec2('0x2f')](_[_0xdec2('0x38')](_0xa67c7c[_0xdec2('0x2e')],_0x426fe1[_0xdec2('0x2f')]),_0x352553);if(_0xa67c7c[_0xdec2('0x2e')][_0xdec2('0x39')]){_0x224038[_0xdec2('0x3a')]=_[_0xdec2('0x3b')](_0x224038[_0xdec2('0x3a')],{'$or':_['map'](_0x352553,function(_0x2ef8e7){if(_0x2ef8e7[_0xdec2('0x2c')]!==_0xdec2('0x3c')){var _0x425696={};_0x425696[_0x2ef8e7[_0xdec2('0x26')]]={'$like':'%'+_0xa67c7c[_0xdec2('0x2e')][_0xdec2('0x39')]+'%'};return _0x425696;}})});}_0x224038=_[_0xdec2('0x3b')]({},_0x224038,_0xa67c7c['options']);var _0xe58917={'where':_0x224038[_0xdec2('0x3a')]};return db['SmsTransferReport'][_0xdec2('0x1e')](_0xe58917)[_0xdec2('0x23')](function(_0x2ba7cb){_0x443aeb[_0xdec2('0x1e')]=_0x2ba7cb;if(_0xa67c7c[_0xdec2('0x2e')]['includeAll']){_0x224038[_0xdec2('0x3d')]=[{'all':!![]}];}return db[_0xdec2('0x2a')]['findAll'](_0x224038);})['then'](function(_0x14ee27){_0x443aeb[_0xdec2('0x3e')]=_0x14ee27;return _0x443aeb;})[_0xdec2('0x23')](respondWithFilteredResult(_0x1798ec,_0x224038))[_0xdec2('0x3f')](handleError(_0x1798ec,null));};exports[_0xdec2('0x40')]=function(_0x116476,_0xc17f82){var _0x4c8c01={'raw':!![],'where':{'id':_0x116476[_0xdec2('0x41')]['id']}},_0x2ae4cf={};_0x2ae4cf[_0xdec2('0x33')]=_['keys'](db[_0xdec2('0x2a')]['rawAttributes']);_0x2ae4cf[_0xdec2('0x2e')]=_['keys'](_0x116476[_0xdec2('0x2e')]);_0x2ae4cf[_0xdec2('0x2f')]=_[_0xdec2('0x30')](_0x2ae4cf[_0xdec2('0x33')],_0x2ae4cf[_0xdec2('0x2e')]);_0x4c8c01['attributes']=_[_0xdec2('0x30')](_0x2ae4cf[_0xdec2('0x33')],qs[_0xdec2('0x32')](_0x116476[_0xdec2('0x2e')]['fields']));_0x4c8c01[_0xdec2('0x31')]=_0x4c8c01[_0xdec2('0x31')]['length']?_0x4c8c01[_0xdec2('0x31')]:_0x2ae4cf['model'];if(_0x116476['query'][_0xdec2('0x42')]){_0x4c8c01[_0xdec2('0x3d')]=[{'all':!![]}];}_0x4c8c01=_[_0xdec2('0x3b')]({},_0x4c8c01,_0x116476[_0xdec2('0x43')]);return db['SmsTransferReport']['find'](_0x4c8c01)[_0xdec2('0x23')](handleEntityNotFound(_0xc17f82,null))[_0xdec2('0x23')](respondWithResult(_0xc17f82,null))[_0xdec2('0x3f')](handleError(_0xc17f82,null));};exports[_0xdec2('0x44')]=function(_0x4ff097,_0xc6624){return db[_0xdec2('0x2a')][_0xdec2('0x44')](_0x4ff097[_0xdec2('0x45')],{})[_0xdec2('0x23')](respondWithResult(_0xc6624,0xc9))[_0xdec2('0x3f')](handleError(_0xc6624,null));};exports[_0xdec2('0x22')]=function(_0x254305,_0x42fb7e){if(_0x254305[_0xdec2('0x45')]['id']){delete _0x254305[_0xdec2('0x45')]['id'];}return db[_0xdec2('0x2a')][_0xdec2('0x46')]({'where':{'id':_0x254305[_0xdec2('0x41')]['id']}})[_0xdec2('0x23')](handleEntityNotFound(_0x42fb7e,null))[_0xdec2('0x23')](saveUpdates(_0x254305['body'],null))[_0xdec2('0x23')](respondWithResult(_0x42fb7e,null))[_0xdec2('0x3f')](handleError(_0x42fb7e,null));};exports[_0xdec2('0x24')]=function(_0x5bf86a,_0x13af0){return db[_0xdec2('0x2a')][_0xdec2('0x46')]({'where':{'id':_0x5bf86a[_0xdec2('0x41')]['id']}})[_0xdec2('0x23')](handleEntityNotFound(_0x13af0,null))[_0xdec2('0x23')](removeEntity(_0x13af0,null))['catch'](handleError(_0x13af0,null));};exports[_0xdec2('0x47')]=function(_0x6a5ba6,_0x4fe4df){return db['SmsTransferReport']['describe']()[_0xdec2('0x23')](respondWithResult(_0x4fe4df,null))[_0xdec2('0x3f')](handleError(_0x4fe4df,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1f1ff14..cf00b16 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 _0x501f=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','request-promise','rimraf'];(function(_0x4a35c6,_0x3aad5b){var _0x722a9a=function(_0x2ae4d0){while(--_0x2ae4d0){_0x4a35c6['push'](_0x4a35c6['shift']());}};_0x722a9a(++_0x3aad5b);}(_0x501f,0x1db));var _0xf501=function(_0x55697e,_0x3ee222){_0x55697e=_0x55697e-0x0;var _0x1307b5=_0x501f[_0x55697e];return _0x1307b5;};'use strict';var _=require('lodash');var util=require(_0xf501('0x0'));var logger=require(_0xf501('0x1'))(_0xf501('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf501('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf501('0x4'));var config=require(_0xf501('0x5'));var attributes=require(_0xf501('0x6'));module[_0xf501('0x7')]=function(_0x528848,_0x3d6096){return _0x528848[_0xf501('0x8')](_0xf501('0x9'),attributes,{'tableName':_0xf501('0xa'),'paranoid':![],'indexes':[{'name':_0xf501('0xb'),'fields':[_0xf501('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb34b=['api','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb34b,0x1e9));var _0xbb34=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb34b[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xbb34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbb34('0x1'));var moment=require('moment');var BPromise=require(_0xbb34('0x2'));var rp=require(_0xbb34('0x3'));var fs=require('fs');var path=require(_0xbb34('0x4'));var rimraf=require('rimraf');var config=require(_0xbb34('0x5'));var attributes=require(_0xbb34('0x6'));module[_0xbb34('0x7')]=function(_0x17eb4c,_0x303ae7){return _0x17eb4c['define']('SmsTransferReport',attributes,{'tableName':_0xbb34('0x8'),'paranoid':![],'indexes':[{'name':_0xbb34('0x9'),'fields':[_0xbb34('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d258405..fd7ec36 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 _0x8a8b=['error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x88dc04,_0x34a94f){var _0x190762=function(_0x4d9af0){while(--_0x4d9af0){_0x88dc04['push'](_0x88dc04['shift']());}};_0x190762(++_0x34a94f);}(_0x8a8b,0xae));var _0xb8a8=function(_0x3603fa,_0xce1412){_0x3603fa=_0x3603fa-0x0;var _0x37d1cc=_0x8a8b[_0x3603fa];return _0x37d1cc;};'use strict';var _=require(_0xb8a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8a8('0x1'));var rs=require(_0xb8a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8a8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8a8('0x4'))('rpc');var config=require(_0xb8a8('0x5'));var jayson=require(_0xb8a8('0x6'));var client=jayson[_0xb8a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37e48d,_0x59cf56,_0x32d542){return new BPromise(function(_0x4c46e9,_0x79cb4a){return client[_0xb8a8('0x8')](_0x37e48d,_0x32d542)[_0xb8a8('0x9')](function(_0x5b1515){logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));logger[_0xb8a8('0xd')](_0xb8a8('0xe'),_0x59cf56,_0xb8a8('0xc'),JSON[_0xb8a8('0xf')](_0x5b1515));if(_0x5b1515[_0xb8a8('0x10')]){if(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x11')]===0x1f4){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')]['message']);return _0x79cb4a(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);return _0x4c46e9(_0x5b1515[_0xb8a8('0x10')][_0xb8a8('0x12')]);}else{logger[_0xb8a8('0xa')](_0xb8a8('0xb'),_0x59cf56,_0xb8a8('0xc'));_0x4c46e9(_0x5b1515['result'][_0xb8a8('0x12')]);}})['catch'](function(_0x9bd9af){logger[_0xb8a8('0x10')](_0xb8a8('0xb'),_0x59cf56,_0x9bd9af);_0x79cb4a(_0x9bd9af);});});} \ No newline at end of file +var _0x98a8=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x19a98f,_0x1b65aa){var _0xffad16=function(_0x4ca7bd){while(--_0x4ca7bd){_0x19a98f['push'](_0x19a98f['shift']());}};_0xffad16(++_0x1b65aa);}(_0x98a8,0x12c));var _0x898a=function(_0x562f59,_0x420c06){_0x562f59=_0x562f59-0x0;var _0x3a059e=_0x98a8[_0x562f59];return _0x3a059e;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9d1bb1e..7e7b414 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 _0xf1d9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','single','create','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x515f01,_0x220c42){var _0x11fd0a=function(_0x28f2a3){while(--_0x28f2a3){_0x515f01['push'](_0x515f01['shift']());}};_0x11fd0a(++_0x220c42);}(_0xf1d9,0x190));var _0x9f1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f1d('0x0'));var util=require(_0x9f1d('0x1'));var path=require(_0x9f1d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f1d('0x3'));var router=express[_0x9f1d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f1d('0x5'));var interaction=require(_0x9f1d('0x6'));var config=require(_0x9f1d('0x7'));var controller=require('./sound.controller');router[_0x9f1d('0x8')]('/',auth[_0x9f1d('0x9')](),controller[_0x9f1d('0xa')]);router[_0x9f1d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9f1d('0xb')]);router['get']('/:id/download',auth[_0x9f1d('0x9')](),controller[_0x9f1d('0xc')]);var upload=multer({'storage':multer[_0x9f1d('0xd')]({'destination':function(_0x36297d,_0xd1f30e,_0x2a1c8c){_0x2a1c8c(null,path[_0x9f1d('0xe')](config[_0x9f1d('0xf')],'server/files/sounds/original/'));},'filename':function(_0x1d7b89,_0x149970,_0x5c7850){_0x149970[_0x9f1d('0x10')]=_0x149970[_0x9f1d('0x10')][_0x9f1d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c7850(null,util[_0x9f1d('0x12')](_0x9f1d('0x13'),path['basename'](_0x149970[_0x9f1d('0x10')],path[_0x9f1d('0x14')](_0x149970[_0x9f1d('0x10')])),Date[_0x9f1d('0x15')](),path[_0x9f1d('0x14')](_0x149970[_0x9f1d('0x10')])));}})});router['post']('/',upload[_0x9f1d('0x16')]('file'),controller[_0x9f1d('0x17')]);router[_0x9f1d('0x18')](_0x9f1d('0x19'),auth[_0x9f1d('0x9')](),controller[_0x9f1d('0x1a')]);router[_0x9f1d('0x1b')](_0x9f1d('0x19'),auth['isAuthenticated'](),controller[_0x9f1d('0x1b')]);module[_0x9f1d('0x1c')]=router; \ No newline at end of file +var _0xba64=['update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','create','put'];(function(_0xb0008a,_0x543c3a){var _0x3b4cac=function(_0x5602c8){while(--_0x5602c8){_0xb0008a['push'](_0xb0008a['shift']());}};_0x3b4cac(++_0x543c3a);}(_0xba64,0x188));var _0x4ba6=function(_0x1bd540,_0x2eb4d2){_0x1bd540=_0x1bd540-0x0;var _0x2174dd=_0xba64[_0x1bd540];return _0x2174dd;};'use strict';var multer=require(_0x4ba6('0x0'));var util=require(_0x4ba6('0x1'));var path=require(_0x4ba6('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ba6('0x3'));var router=express[_0x4ba6('0x4')]();var fs_extra=require(_0x4ba6('0x5'));var auth=require(_0x4ba6('0x6'));var interaction=require(_0x4ba6('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x4ba6('0x8')]('/',auth[_0x4ba6('0x9')](),controller[_0x4ba6('0xa')]);router[_0x4ba6('0x8')](_0x4ba6('0xb'),auth[_0x4ba6('0x9')](),controller[_0x4ba6('0xc')]);router['get'](_0x4ba6('0xd'),auth[_0x4ba6('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x4ba6('0xe')]({'destination':function(_0x31c156,_0x222567,_0x312963){_0x312963(null,path[_0x4ba6('0xf')](config[_0x4ba6('0x10')],'server/files/sounds/original/'));},'filename':function(_0x1b0e3b,_0x581d13,_0x3b68a6){_0x581d13[_0x4ba6('0x11')]=_0x581d13['originalname'][_0x4ba6('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b68a6(null,util[_0x4ba6('0x13')](_0x4ba6('0x14'),path[_0x4ba6('0x15')](_0x581d13[_0x4ba6('0x11')],path[_0x4ba6('0x16')](_0x581d13[_0x4ba6('0x11')])),Date['now'](),path[_0x4ba6('0x16')](_0x581d13[_0x4ba6('0x11')])));}})});router[_0x4ba6('0x17')]('/',upload[_0x4ba6('0x18')](_0x4ba6('0x19')),controller[_0x4ba6('0x1a')]);router[_0x4ba6('0x1b')](_0x4ba6('0xb'),auth[_0x4ba6('0x9')](),controller[_0x4ba6('0x1c')]);router[_0x4ba6('0x1d')](_0x4ba6('0xb'),auth[_0x4ba6('0x9')](),controller[_0x4ba6('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9a31b17..c4f1379 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 _0x56f5=['BIGINT','INTEGER','sequelize','STRING','FLOAT'];(function(_0x50d31b,_0x4532c7){var _0x4b7313=function(_0x2a350f){while(--_0x2a350f){_0x50d31b['push'](_0x50d31b['shift']());}};_0x4b7313(++_0x4532c7);}(_0x56f5,0x1a6));var _0x556f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56f5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x556f('0x0'));module['exports']={'name':{'type':Sequelize[_0x556f('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x556f('0x1')]},'display_name':{'type':Sequelize[_0x556f('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x556f('0x1')]},'original_format':{'type':Sequelize[_0x556f('0x1')]},'original_duration':{'type':Sequelize[_0x556f('0x2')]},'original_sampleCount':{'type':Sequelize[_0x556f('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x556f('0x3')]},'original_sampleRate':{'type':Sequelize[_0x556f('0x4')]},'converted_format':{'type':Sequelize[_0x556f('0x1')]},'converted_duration':{'type':Sequelize[_0x556f('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x556f('0x3')]},'converted_channelCount':{'type':Sequelize[_0x556f('0x4')]},'converted_bitRate':{'type':Sequelize[_0x556f('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x556f('0x4')]}}; \ No newline at end of file +var _0x60ec=['sequelize','STRING','name','INTEGER','FLOAT','BIGINT'];(function(_0x198117,_0xde9d4b){var _0x1be636=function(_0x5120b8){while(--_0x5120b8){_0x198117['push'](_0x198117['shift']());}};_0x1be636(++_0xde9d4b);}(_0x60ec,0xb4));var _0xc60e=function(_0x3dede8,_0x313e48){_0x3dede8=_0x3dede8-0x0;var _0x39eb04=_0x60ec[_0x3dede8];return _0x39eb04;};'use strict';var Sequelize=require(_0xc60e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc60e('0x1')],'unique':_0xc60e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xc60e('0x1')]},'original_format':{'type':Sequelize[_0xc60e('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xc60e('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc60e('0x1')]},'converted_duration':{'type':Sequelize[_0xc60e('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xc60e('0x3')]},'converted_bitRate':{'type':Sequelize[_0xc60e('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index aa30974..a892495 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 _0x5cfe=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','index','map','Sound','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','chmodSync','create','body','userProfileId','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','request-promise','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5cfe,0xee));var _0xe5cf=function(_0x2583dc,_0x182897){_0x2583dc=_0x2583dc-0x0;var _0x250f53=_0x5cfe[_0x2583dc];return _0x250f53;};'use strict';var emlformat=require(_0xe5cf('0x0'));var rimraf=require(_0xe5cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe5cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe5cf('0x3'));var util=require(_0xe5cf('0x4'));var path=require('path');var sox=require(_0xe5cf('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5cf('0x6'));var squel=require(_0xe5cf('0x7'));var crypto=require('crypto');var jsforce=require(_0xe5cf('0x8'));var deskjs=require(_0xe5cf('0x9'));var toCsv=require(_0xe5cf('0xa'));var querystring=require(_0xe5cf('0xb'));var Papa=require(_0xe5cf('0xc'));var Redis=require('ioredis');var authService=require(_0xe5cf('0xd'));var qs=require(_0xe5cf('0xe'));var as=require(_0xe5cf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5cf('0x10'))('api');var utils=require(_0xe5cf('0x11'));var config=require(_0xe5cf('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5cf('0x13'))['db'];function respondWithStatusCode(_0x1c0614,_0x329347){_0x329347=_0x329347||0xcc;return function(_0x135390){if(_0x135390){return _0x1c0614['sendStatus'](_0x329347);}return _0x1c0614[_0xe5cf('0x14')](_0x329347)['end']();};}function respondWithResult(_0x3a47bd,_0x2fc221){_0x2fc221=_0x2fc221||0xc8;return function(_0x1855c9){if(_0x1855c9){return _0x3a47bd[_0xe5cf('0x14')](_0x2fc221)[_0xe5cf('0x15')](_0x1855c9);}};}function respondWithFilteredResult(_0x34a796,_0x5a9f35){return function(_0x36f1c7){if(_0x36f1c7){var _0x4642d4=typeof _0x5a9f35[_0xe5cf('0x16')]===_0xe5cf('0x17')&&typeof _0x5a9f35[_0xe5cf('0x18')]===_0xe5cf('0x17');var _0x4a49a5=_0x36f1c7[_0xe5cf('0x19')];var _0x5de03f=_0x4642d4?0x0:_0x5a9f35[_0xe5cf('0x16')];var _0x322848=_0x4642d4?_0x36f1c7[_0xe5cf('0x19')]:_0x5a9f35[_0xe5cf('0x16')]+_0x5a9f35[_0xe5cf('0x18')];var _0x5a59d9;if(_0x322848>=_0x4a49a5){_0x322848=_0x4a49a5;_0x5a59d9=0xc8;}else{_0x5a59d9=0xce;}_0x34a796[_0xe5cf('0x14')](_0x5a59d9);return _0x34a796[_0xe5cf('0x1a')](_0xe5cf('0x1b'),_0x5de03f+'-'+_0x322848+'/'+_0x4a49a5)[_0xe5cf('0x15')](_0x36f1c7);}return null;};}function patchUpdates(_0x3d2f39){return function(_0x5856f1){try{jsonpatch[_0xe5cf('0x1c')](_0x5856f1,_0x3d2f39,!![]);}catch(_0x16ae18){return BPromise[_0xe5cf('0x1d')](_0x16ae18);}return _0x5856f1[_0xe5cf('0x1e')]();};}function saveUpdates(_0x1510d2,_0x1735ba){return function(_0xb108f){if(_0xb108f){return _0xb108f[_0xe5cf('0x1f')](_0x1510d2)[_0xe5cf('0x20')](function(_0x28c9aa){return _0x28c9aa;});}return null;};}function removeEntity(_0x5e53a2,_0x2f9212){return function(_0x5b59a8){if(_0x5b59a8){return _0x5b59a8[_0xe5cf('0x21')]()[_0xe5cf('0x20')](function(){var _0x364280=_0x5b59a8[_0xe5cf('0x22')]({'plain':!![]});var _0x13897d='Sounds';return db[_0xe5cf('0x23')][_0xe5cf('0x21')]({'where':{'type':_0x13897d,'resourceId':_0x364280['id']}})[_0xe5cf('0x20')](function(){return _0x5b59a8;});})[_0xe5cf('0x20')](function(){_0x5e53a2[_0xe5cf('0x14')](0xcc)[_0xe5cf('0x24')]();});}};}function handleEntityNotFound(_0x55e199,_0x3eb0ec){return function(_0x5f5181){if(!_0x5f5181){_0x55e199[_0xe5cf('0x25')](0x194);}return _0x5f5181;};}function handleError(_0x3543ba,_0x36e271){_0x36e271=_0x36e271||0x1f4;return function(_0x532ecf){logger[_0xe5cf('0x26')](_0x532ecf[_0xe5cf('0x27')]);if(_0x532ecf['name']){delete _0x532ecf[_0xe5cf('0x28')];}_0x3543ba[_0xe5cf('0x14')](_0x36e271)['send'](_0x532ecf);};}exports[_0xe5cf('0x29')]=function(_0x56a1d8,_0x14e417){var _0x164344={},_0x37264e={},_0x41bb19={'count':0x0,'rows':[]};var _0x1036b0=_[_0xe5cf('0x2a')](db[_0xe5cf('0x2b')][_0xe5cf('0x2c')],function(_0x615f83){return{'name':_0x615f83['fieldName'],'type':_0x615f83['type'][_0xe5cf('0x2d')]};});_0x37264e[_0xe5cf('0x2e')]=_[_0xe5cf('0x2a')](_0x1036b0,_0xe5cf('0x28'));_0x37264e[_0xe5cf('0x2f')]=_[_0xe5cf('0x30')](_0x56a1d8[_0xe5cf('0x2f')]);_0x37264e[_0xe5cf('0x31')]=_[_0xe5cf('0x32')](_0x37264e[_0xe5cf('0x2e')],_0x37264e[_0xe5cf('0x2f')]);_0x164344['attributes']=_[_0xe5cf('0x32')](_0x37264e[_0xe5cf('0x2e')],qs[_0xe5cf('0x33')](_0x56a1d8['query']['fields']));_0x164344['attributes']=_0x164344[_0xe5cf('0x34')][_0xe5cf('0x35')]?_0x164344['attributes']:_0x37264e[_0xe5cf('0x2e')];if(!_0x56a1d8['query'][_0xe5cf('0x36')](_0xe5cf('0x37'))){_0x164344[_0xe5cf('0x18')]=qs[_0xe5cf('0x18')](_0x56a1d8[_0xe5cf('0x2f')][_0xe5cf('0x18')]);_0x164344[_0xe5cf('0x16')]=qs['offset'](_0x56a1d8['query'][_0xe5cf('0x16')]);}_0x164344[_0xe5cf('0x38')]=qs[_0xe5cf('0x39')](_0x56a1d8[_0xe5cf('0x2f')][_0xe5cf('0x39')]);_0x164344[_0xe5cf('0x3a')]=qs[_0xe5cf('0x31')](_[_0xe5cf('0x3b')](_0x56a1d8[_0xe5cf('0x2f')],_0x37264e[_0xe5cf('0x31')]),_0x1036b0);if(_0x56a1d8[_0xe5cf('0x2f')][_0xe5cf('0x3c')]){_0x164344[_0xe5cf('0x3a')]=_[_0xe5cf('0x3d')](_0x164344[_0xe5cf('0x3a')],{'$or':_['map'](_0x1036b0,function(_0x4cdf0a){if(_0x4cdf0a[_0xe5cf('0x3e')]!==_0xe5cf('0x3f')){var _0x31ec02={};_0x31ec02[_0x4cdf0a[_0xe5cf('0x28')]]={'$like':'%'+_0x56a1d8['query'][_0xe5cf('0x3c')]+'%'};return _0x31ec02;}})});}_0x164344=_['merge']({},_0x164344,_0x56a1d8[_0xe5cf('0x40')]);var _0x4b7f27={'where':_0x164344[_0xe5cf('0x3a')]};return db[_0xe5cf('0x2b')][_0xe5cf('0x19')](_0x4b7f27)[_0xe5cf('0x20')](function(_0x21b1a6){_0x41bb19[_0xe5cf('0x19')]=_0x21b1a6;if(_0x56a1d8[_0xe5cf('0x2f')][_0xe5cf('0x41')]){_0x164344[_0xe5cf('0x42')]=[{'all':!![]}];}return db[_0xe5cf('0x2b')][_0xe5cf('0x43')](_0x164344);})['then'](function(_0x4c9360){_0x41bb19[_0xe5cf('0x44')]=_0x4c9360;return _0x41bb19;})[_0xe5cf('0x20')](respondWithFilteredResult(_0x14e417,_0x164344))['catch'](handleError(_0x14e417,null));};exports[_0xe5cf('0x45')]=function(_0x275f74,_0x12741a){var _0x3247b9={'raw':!![],'where':{'id':_0x275f74[_0xe5cf('0x46')]['id']}},_0x7dc136={};_0x7dc136[_0xe5cf('0x2e')]=_[_0xe5cf('0x30')](db[_0xe5cf('0x2b')]['rawAttributes']);_0x7dc136[_0xe5cf('0x2f')]=_['keys'](_0x275f74['query']);_0x7dc136[_0xe5cf('0x31')]=_[_0xe5cf('0x32')](_0x7dc136[_0xe5cf('0x2e')],_0x7dc136[_0xe5cf('0x2f')]);_0x3247b9[_0xe5cf('0x34')]=_[_0xe5cf('0x32')](_0x7dc136[_0xe5cf('0x2e')],qs[_0xe5cf('0x33')](_0x275f74[_0xe5cf('0x2f')][_0xe5cf('0x33')]));_0x3247b9[_0xe5cf('0x34')]=_0x3247b9[_0xe5cf('0x34')][_0xe5cf('0x35')]?_0x3247b9[_0xe5cf('0x34')]:_0x7dc136[_0xe5cf('0x2e')];if(_0x275f74[_0xe5cf('0x2f')][_0xe5cf('0x41')]){_0x3247b9[_0xe5cf('0x42')]=[{'all':!![]}];}_0x3247b9=_['merge']({},_0x3247b9,_0x275f74['options']);return db[_0xe5cf('0x2b')][_0xe5cf('0x47')](_0x3247b9)[_0xe5cf('0x20')](handleEntityNotFound(_0x12741a,null))[_0xe5cf('0x20')](respondWithResult(_0x12741a,null))[_0xe5cf('0x48')](handleError(_0x12741a,null));};exports[_0xe5cf('0x49')]=function(_0x1dc332,_0x368082,_0x4ae0c8){return db[_0xe5cf('0x2b')][_0xe5cf('0x47')]({'where':{'id':_0x1dc332[_0xe5cf('0x46')]['id']},'attributes':[_0xe5cf('0x28'),_0xe5cf('0x4a'),'converted_format'],'raw':!![]})[_0xe5cf('0x20')](handleEntityNotFound(_0x368082,null))['then'](function(_0x30d233){if(_0x30d233){if(!fs[_0xe5cf('0x4b')](path[_0xe5cf('0x4c')](config[_0xe5cf('0x4d')],_0xe5cf('0x4e'),_0x30d233[_0xe5cf('0x4a')]+'.'+_0x30d233[_0xe5cf('0x4f')]))){throw new db[(_0xe5cf('0x50'))][(_0xe5cf('0x51'))](_0xe5cf('0x52'));}return _0x368082[_0xe5cf('0x49')](path[_0xe5cf('0x4c')](config[_0xe5cf('0x4d')],_0xe5cf('0x4e'),util[_0xe5cf('0x53')](_0xe5cf('0x54'),_0x30d233[_0xe5cf('0x4a')],_0x30d233[_0xe5cf('0x4f')])),util[_0xe5cf('0x53')]('%s.%s',_0x30d233[_0xe5cf('0x28')],_0x30d233[_0xe5cf('0x4f')]));}return null;})['catch'](handleError(_0x368082,null));};exports['create']=function(_0x43523d,_0x598ce1,_0x1dd086){var _0x498efc={'name':path[_0xe5cf('0x55')](_0x43523d['file'][_0xe5cf('0x56')],path[_0xe5cf('0x57')](_0x43523d[_0xe5cf('0x58')][_0xe5cf('0x56')])),'save_name':path[_0xe5cf('0x55')](_0x43523d[_0xe5cf('0x58')][_0xe5cf('0x59')],path[_0xe5cf('0x57')](_0x43523d['file'][_0xe5cf('0x59')])),'original_format':path[_0xe5cf('0x57')](_0x43523d[_0xe5cf('0x58')][_0xe5cf('0x56')])[_0xe5cf('0x5a')](0x1),'converted_format':_0xe5cf('0x5b')};var _0x515853=path['join'](config[_0xe5cf('0x4d')],_0xe5cf('0x5c'),_0x43523d[_0xe5cf('0x58')][_0xe5cf('0x59')]);var _0x227d4a=path[_0xe5cf('0x4c')](config[_0xe5cf('0x4d')],_0xe5cf('0x4e'),util[_0xe5cf('0x53')](_0xe5cf('0x54'),path[_0xe5cf('0x55')](_0x43523d['file'][_0xe5cf('0x59')],path['extname'](_0x43523d['file'][_0xe5cf('0x59')])),_0x498efc[_0xe5cf('0x4f')]));logger[_0xe5cf('0x5d')](_0xe5cf('0x5e'),_0x515853);logger[_0xe5cf('0x5d')](_0xe5cf('0x5f'),_0x227d4a);try{fs['chmodSync'](_0x515853,parseInt(_0xe5cf('0x60'),0x8));var _0x96c8c3=sox[_0xe5cf('0x61')](_0x515853,_0x227d4a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x96c8c3['on'](_0xe5cf('0x26'),function(_0x1087af){fs[_0xe5cf('0x62')](_0x515853);_0x598ce1['status'](0x1f4)[_0xe5cf('0x63')](_0x1087af);});_0x96c8c3['on'](_0xe5cf('0x64'),function(_0x40da1a){_0x498efc['original_duration']=isNaN(_0x40da1a[_0xe5cf('0x65')])?null:_0x40da1a[_0xe5cf('0x65')]*0x3e8;_0x498efc[_0xe5cf('0x66')]=isNaN(_0x40da1a['sampleCount'])?null:_0x40da1a[_0xe5cf('0x67')];_0x498efc[_0xe5cf('0x68')]=isNaN(_0x40da1a[_0xe5cf('0x69')])?null:_0x40da1a[_0xe5cf('0x69')];_0x498efc[_0xe5cf('0x6a')]=isNaN(_0x40da1a[_0xe5cf('0x6b')])?null:_0x40da1a[_0xe5cf('0x6b')];_0x498efc[_0xe5cf('0x6c')]=isNaN(_0x40da1a[_0xe5cf('0x6d')])?null:_0x40da1a[_0xe5cf('0x6d')];});_0x96c8c3['on'](_0xe5cf('0x6e'),function(_0x488194){_0x498efc[_0xe5cf('0x6f')]=isNaN(_0x488194[_0xe5cf('0x65')])?null:_0x488194['duration']*0x3e8;_0x498efc['converted_sampleCount']=isNaN(_0x488194[_0xe5cf('0x67')])?null:_0x488194[_0xe5cf('0x67')];_0x498efc['converted_channelCount']=isNaN(_0x488194[_0xe5cf('0x69')])?null:_0x488194[_0xe5cf('0x69')];_0x498efc[_0xe5cf('0x70')]=isNaN(_0x488194['bitRate'])?null:_0x488194['bitRate'];_0x498efc[_0xe5cf('0x71')]=isNaN(_0x488194['sampleRate'])?null:_0x488194['sampleRate'];});_0x96c8c3['on'](_0xe5cf('0x24'),function(){fs[_0xe5cf('0x72')](_0x227d4a,parseInt('0777',0x8));return db['Sound'][_0xe5cf('0x73')](_0x498efc)[_0xe5cf('0x20')](function(_0x3f4efb){var _0x4c56e0={'role':_0x43523d[_0xe5cf('0x74')]['role'],'userProfileId':_0x43523d[_0xe5cf('0x74')][_0xe5cf('0x75')]};if(!_0x4c56e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c56e0[_0xe5cf('0x76')]==='user'){var _0x1dbdfb=_0x3f4efb[_0xe5cf('0x22')]({'plain':!![]});return db[_0xe5cf('0x77')][_0xe5cf('0x47')]({'where':{'name':'Sounds','userProfileId':_0x4c56e0[_0xe5cf('0x75')]},'raw':!![]})[_0xe5cf('0x20')](function(_0x36e28f){if(_0x36e28f&&_0x36e28f[_0xe5cf('0x78')]===0x0){return db['UserProfileResource']['create']({'name':_0x1dbdfb[_0xe5cf('0x28')],'resourceId':_0x1dbdfb['id'],'type':_0x36e28f[_0xe5cf('0x28')],'sectionId':_0x36e28f['id']},{})[_0xe5cf('0x20')](function(){return _0x3f4efb;});}else{return _0x3f4efb;}})[_0xe5cf('0x48')](function(_0x3ba25b){logger['error'](_0xe5cf('0x79'),_0x3ba25b);throw _0x3ba25b;});}return _0x3f4efb;})[_0xe5cf('0x20')](respondWithResult(_0x598ce1,null))['catch'](handleError(_0x598ce1,null));});_0x96c8c3[_0xe5cf('0x7a')]();}catch(_0x3ebd12){_0x598ce1[_0xe5cf('0x14')](0x1f4)[_0xe5cf('0x63')](_0x3ebd12);}};exports[_0xe5cf('0x1f')]=function(_0x3e7895,_0x20cb5f,_0x497244){return db[_0xe5cf('0x2b')][_0xe5cf('0x47')]({'where':{'id':_0x3e7895[_0xe5cf('0x46')]['id']}})[_0xe5cf('0x20')](handleEntityNotFound(_0x20cb5f,null))['then'](saveUpdates(_['pick'](_0x3e7895['body'],[_0xe5cf('0x28'),'description']),null))[_0xe5cf('0x20')](respondWithResult(_0x20cb5f,null))[_0xe5cf('0x48')](handleError(_0x20cb5f,null));};exports[_0xe5cf('0x7b')]=function(_0x571481,_0x1af78b,_0x3ff460){return db[_0xe5cf('0x2b')][_0xe5cf('0x47')]({'where':{'id':_0x571481[_0xe5cf('0x46')]['id']}})[_0xe5cf('0x20')](function(_0x4890fb){if(_0x4890fb){return _0x4890fb['destroy']();}})[_0xe5cf('0x20')](function(_0x5985c3){var _0x50febe=path[_0xe5cf('0x4c')](config[_0xe5cf('0x4d')],'server/files/sounds/original',util[_0xe5cf('0x53')]('%s.%s',_0x5985c3[_0xe5cf('0x4a')],_0x5985c3[_0xe5cf('0x7c')]));var _0x459a80=path[_0xe5cf('0x4c')](config['root'],_0xe5cf('0x4e'),util['format'](_0xe5cf('0x54'),_0x5985c3['save_name'],_0x5985c3['converted_format']));fs['unlinkSync'](_0x50febe);fs[_0xe5cf('0x62')](_0x459a80);return _0x5985c3;})[_0xe5cf('0x20')](function(_0x1ce25c){if(_0x1ce25c){return _0x1af78b['status'](0xcc)[_0xe5cf('0x24')]();}})['then'](handleEntityNotFound(_0x1af78b,null))[_0xe5cf('0x48')](handleError(_0x1af78b,null));}; \ No newline at end of file +var _0x3ff3=['original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','get','Sounds','UserProfileResource','error','name','index','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','include','findAll','rows','show','params','Sound','length','find','catch','save_name','converted_format','existsSync','root','Sequelize','Sound\x20not\x20found','download','join','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate'];(function(_0x1ee3cf,_0x261199){var _0x2b55c7=function(_0x51ff37){while(--_0x51ff37){_0x1ee3cf['push'](_0x1ee3cf['shift']());}};_0x2b55c7(++_0x261199);}(_0x3ff3,0x8d));var _0x33ff=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3ff3[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x33ff('0x0'));var rimraf=require(_0x33ff('0x1'));var zipdir=require(_0x33ff('0x2'));var jsonpatch=require(_0x33ff('0x3'));var rp=require('request-promise');var moment=require(_0x33ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x33ff('0x5'));var util=require(_0x33ff('0x6'));var path=require(_0x33ff('0x7'));var sox=require(_0x33ff('0x8'));var csv=require(_0x33ff('0x9'));var ejs=require(_0x33ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33ff('0xb'));var squel=require('squel');var crypto=require(_0x33ff('0xc'));var jsforce=require(_0x33ff('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x33ff('0xe'));var Papa=require(_0x33ff('0xf'));var Redis=require('ioredis');var authService=require(_0x33ff('0x10'));var qs=require(_0x33ff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33ff('0x12'));var logger=require('../../config/logger')(_0x33ff('0x13'));var utils=require(_0x33ff('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33ff('0x15'));var db=require(_0x33ff('0x16'))['db'];function respondWithStatusCode(_0x6bb1dc,_0x1975b5){_0x1975b5=_0x1975b5||0xcc;return function(_0x5f18c1){if(_0x5f18c1){return _0x6bb1dc[_0x33ff('0x17')](_0x1975b5);}return _0x6bb1dc[_0x33ff('0x18')](_0x1975b5)[_0x33ff('0x19')]();};}function respondWithResult(_0x1abe35,_0x4e5e15){_0x4e5e15=_0x4e5e15||0xc8;return function(_0x514d7e){if(_0x514d7e){return _0x1abe35[_0x33ff('0x18')](_0x4e5e15)['json'](_0x514d7e);}};}function respondWithFilteredResult(_0x5997e0,_0x17c1c5){return function(_0x3f0e47){if(_0x3f0e47){var _0xca87f1=typeof _0x17c1c5[_0x33ff('0x1a')]===_0x33ff('0x1b')&&typeof _0x17c1c5[_0x33ff('0x1c')]===_0x33ff('0x1b');var _0x19dd8e=_0x3f0e47[_0x33ff('0x1d')];var _0x17664e=_0xca87f1?0x0:_0x17c1c5[_0x33ff('0x1a')];var _0x4a5fc6=_0xca87f1?_0x3f0e47[_0x33ff('0x1d')]:_0x17c1c5[_0x33ff('0x1a')]+_0x17c1c5['limit'];var _0xfb0e96;if(_0x4a5fc6>=_0x19dd8e){_0x4a5fc6=_0x19dd8e;_0xfb0e96=0xc8;}else{_0xfb0e96=0xce;}_0x5997e0[_0x33ff('0x18')](_0xfb0e96);return _0x5997e0[_0x33ff('0x1e')](_0x33ff('0x1f'),_0x17664e+'-'+_0x4a5fc6+'/'+_0x19dd8e)[_0x33ff('0x20')](_0x3f0e47);}return null;};}function patchUpdates(_0x513bb5){return function(_0x25c64b){try{jsonpatch[_0x33ff('0x21')](_0x25c64b,_0x513bb5,!![]);}catch(_0xa5245f){return BPromise['reject'](_0xa5245f);}return _0x25c64b['save']();};}function saveUpdates(_0x18c103,_0x18887a){return function(_0x4d32ad){if(_0x4d32ad){return _0x4d32ad[_0x33ff('0x22')](_0x18c103)[_0x33ff('0x23')](function(_0x12c371){return _0x12c371;});}return null;};}function removeEntity(_0x4dbd84,_0x25521c){return function(_0x4ec712){if(_0x4ec712){return _0x4ec712[_0x33ff('0x24')]()[_0x33ff('0x23')](function(){var _0x2d77df=_0x4ec712[_0x33ff('0x25')]({'plain':!![]});var _0x470290=_0x33ff('0x26');return db[_0x33ff('0x27')]['destroy']({'where':{'type':_0x470290,'resourceId':_0x2d77df['id']}})[_0x33ff('0x23')](function(){return _0x4ec712;});})[_0x33ff('0x23')](function(){_0x4dbd84[_0x33ff('0x18')](0xcc)[_0x33ff('0x19')]();});}};}function handleEntityNotFound(_0x3259f4,_0x469a28){return function(_0x2db30f){if(!_0x2db30f){_0x3259f4[_0x33ff('0x17')](0x194);}return _0x2db30f;};}function handleError(_0x360d76,_0x5d84bf){_0x5d84bf=_0x5d84bf||0x1f4;return function(_0x322629){logger[_0x33ff('0x28')](_0x322629['stack']);if(_0x322629[_0x33ff('0x29')]){delete _0x322629[_0x33ff('0x29')];}_0x360d76[_0x33ff('0x18')](_0x5d84bf)['send'](_0x322629);};}exports[_0x33ff('0x2a')]=function(_0x5085ab,_0x36b9c1){var _0x2c608f={},_0x18ecd4={},_0x5b03af={'count':0x0,'rows':[]};var _0x114249=_['map'](db['Sound'][_0x33ff('0x2b')],function(_0x1d5fad){return{'name':_0x1d5fad[_0x33ff('0x2c')],'type':_0x1d5fad[_0x33ff('0x2d')]['key']};});_0x18ecd4[_0x33ff('0x2e')]=_[_0x33ff('0x2f')](_0x114249,'name');_0x18ecd4['query']=_[_0x33ff('0x30')](_0x5085ab[_0x33ff('0x31')]);_0x18ecd4[_0x33ff('0x32')]=_['intersection'](_0x18ecd4[_0x33ff('0x2e')],_0x18ecd4['query']);_0x2c608f[_0x33ff('0x33')]=_[_0x33ff('0x34')](_0x18ecd4[_0x33ff('0x2e')],qs[_0x33ff('0x35')](_0x5085ab['query']['fields']));_0x2c608f[_0x33ff('0x33')]=_0x2c608f['attributes']['length']?_0x2c608f['attributes']:_0x18ecd4['model'];if(!_0x5085ab[_0x33ff('0x31')][_0x33ff('0x36')](_0x33ff('0x37'))){_0x2c608f['limit']=qs[_0x33ff('0x1c')](_0x5085ab[_0x33ff('0x31')]['limit']);_0x2c608f['offset']=qs[_0x33ff('0x1a')](_0x5085ab[_0x33ff('0x31')]['offset']);}_0x2c608f[_0x33ff('0x38')]=qs[_0x33ff('0x39')](_0x5085ab['query'][_0x33ff('0x39')]);_0x2c608f['where']=qs[_0x33ff('0x32')](_[_0x33ff('0x3a')](_0x5085ab[_0x33ff('0x31')],_0x18ecd4[_0x33ff('0x32')]),_0x114249);if(_0x5085ab[_0x33ff('0x31')]['filter']){_0x2c608f[_0x33ff('0x3b')]=_[_0x33ff('0x3c')](_0x2c608f[_0x33ff('0x3b')],{'$or':_[_0x33ff('0x2f')](_0x114249,function(_0x3d4250){if(_0x3d4250['type']!=='VIRTUAL'){var _0x397454={};_0x397454[_0x3d4250[_0x33ff('0x29')]]={'$like':'%'+_0x5085ab[_0x33ff('0x31')]['filter']+'%'};return _0x397454;}})});}_0x2c608f=_[_0x33ff('0x3c')]({},_0x2c608f,_0x5085ab[_0x33ff('0x3d')]);var _0x1df767={'where':_0x2c608f[_0x33ff('0x3b')]};return db['Sound']['count'](_0x1df767)[_0x33ff('0x23')](function(_0x4e8cdd){_0x5b03af[_0x33ff('0x1d')]=_0x4e8cdd;if(_0x5085ab['query'][_0x33ff('0x3e')]){_0x2c608f[_0x33ff('0x3f')]=[{'all':!![]}];}return db['Sound'][_0x33ff('0x40')](_0x2c608f);})[_0x33ff('0x23')](function(_0x4316d2){_0x5b03af[_0x33ff('0x41')]=_0x4316d2;return _0x5b03af;})['then'](respondWithFilteredResult(_0x36b9c1,_0x2c608f))['catch'](handleError(_0x36b9c1,null));};exports[_0x33ff('0x42')]=function(_0x4721d0,_0x57de08){var _0x1abb00={'raw':!![],'where':{'id':_0x4721d0[_0x33ff('0x43')]['id']}},_0x4b1147={};_0x4b1147['model']=_[_0x33ff('0x30')](db[_0x33ff('0x44')][_0x33ff('0x2b')]);_0x4b1147[_0x33ff('0x31')]=_[_0x33ff('0x30')](_0x4721d0['query']);_0x4b1147[_0x33ff('0x32')]=_[_0x33ff('0x34')](_0x4b1147[_0x33ff('0x2e')],_0x4b1147['query']);_0x1abb00[_0x33ff('0x33')]=_[_0x33ff('0x34')](_0x4b1147[_0x33ff('0x2e')],qs[_0x33ff('0x35')](_0x4721d0[_0x33ff('0x31')]['fields']));_0x1abb00[_0x33ff('0x33')]=_0x1abb00[_0x33ff('0x33')][_0x33ff('0x45')]?_0x1abb00['attributes']:_0x4b1147[_0x33ff('0x2e')];if(_0x4721d0[_0x33ff('0x31')][_0x33ff('0x3e')]){_0x1abb00[_0x33ff('0x3f')]=[{'all':!![]}];}_0x1abb00=_[_0x33ff('0x3c')]({},_0x1abb00,_0x4721d0[_0x33ff('0x3d')]);return db[_0x33ff('0x44')][_0x33ff('0x46')](_0x1abb00)[_0x33ff('0x23')](handleEntityNotFound(_0x57de08,null))['then'](respondWithResult(_0x57de08,null))[_0x33ff('0x47')](handleError(_0x57de08,null));};exports['download']=function(_0x300660,_0x8c604d,_0x4bab1a){return db[_0x33ff('0x44')][_0x33ff('0x46')]({'where':{'id':_0x300660[_0x33ff('0x43')]['id']},'attributes':[_0x33ff('0x29'),_0x33ff('0x48'),_0x33ff('0x49')],'raw':!![]})[_0x33ff('0x23')](handleEntityNotFound(_0x8c604d,null))[_0x33ff('0x23')](function(_0x46f69f){if(_0x46f69f){if(!fs[_0x33ff('0x4a')](path['join'](config[_0x33ff('0x4b')],'server/files/sounds/converted',_0x46f69f['save_name']+'.'+_0x46f69f[_0x33ff('0x49')]))){throw new db[(_0x33ff('0x4c'))]['ValidationError'](_0x33ff('0x4d'));}return _0x8c604d[_0x33ff('0x4e')](path[_0x33ff('0x4f')](config[_0x33ff('0x4b')],_0x33ff('0x50'),util[_0x33ff('0x51')](_0x33ff('0x52'),_0x46f69f[_0x33ff('0x48')],_0x46f69f[_0x33ff('0x49')])),util[_0x33ff('0x51')](_0x33ff('0x52'),_0x46f69f['name'],_0x46f69f[_0x33ff('0x49')]));}return null;})[_0x33ff('0x47')](handleError(_0x8c604d,null));};exports[_0x33ff('0x53')]=function(_0xd32570,_0x425a2d,_0x233c65){var _0x89ac31={'name':path['basename'](_0xd32570[_0x33ff('0x54')][_0x33ff('0x55')],path[_0x33ff('0x56')](_0xd32570[_0x33ff('0x54')][_0x33ff('0x55')])),'save_name':path[_0x33ff('0x57')](_0xd32570[_0x33ff('0x54')][_0x33ff('0x58')],path['extname'](_0xd32570[_0x33ff('0x54')][_0x33ff('0x58')])),'original_format':path[_0x33ff('0x56')](_0xd32570[_0x33ff('0x54')][_0x33ff('0x55')])[_0x33ff('0x59')](0x1),'converted_format':_0x33ff('0x5a')};var _0x2d687b=path[_0x33ff('0x4f')](config['root'],_0x33ff('0x5b'),_0xd32570[_0x33ff('0x54')][_0x33ff('0x58')]);var _0x4a3ba0=path[_0x33ff('0x4f')](config[_0x33ff('0x4b')],_0x33ff('0x50'),util['format'](_0x33ff('0x52'),path[_0x33ff('0x57')](_0xd32570['file'][_0x33ff('0x58')],path[_0x33ff('0x56')](_0xd32570[_0x33ff('0x54')][_0x33ff('0x58')])),_0x89ac31[_0x33ff('0x49')]));logger[_0x33ff('0x5c')](_0x33ff('0x5d'),_0x2d687b);logger['info'](_0x33ff('0x5e'),_0x4a3ba0);try{fs[_0x33ff('0x5f')](_0x2d687b,parseInt(_0x33ff('0x60'),0x8));var _0x4fe4e4=sox[_0x33ff('0x61')](_0x2d687b,_0x4a3ba0,{'sampleRate':0x1f40,'format':_0x33ff('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4fe4e4['on']('error',function(_0x47dfa2){fs[_0x33ff('0x62')](_0x2d687b);_0x425a2d['status'](0x1f4)[_0x33ff('0x63')](_0x47dfa2);});_0x4fe4e4['on'](_0x33ff('0x64'),function(_0x2f07ca){_0x89ac31[_0x33ff('0x65')]=isNaN(_0x2f07ca['duration'])?null:_0x2f07ca[_0x33ff('0x66')]*0x3e8;_0x89ac31[_0x33ff('0x67')]=isNaN(_0x2f07ca[_0x33ff('0x68')])?null:_0x2f07ca[_0x33ff('0x68')];_0x89ac31[_0x33ff('0x69')]=isNaN(_0x2f07ca[_0x33ff('0x6a')])?null:_0x2f07ca['channelCount'];_0x89ac31[_0x33ff('0x6b')]=isNaN(_0x2f07ca[_0x33ff('0x6c')])?null:_0x2f07ca['bitRate'];_0x89ac31[_0x33ff('0x6d')]=isNaN(_0x2f07ca[_0x33ff('0x6e')])?null:_0x2f07ca[_0x33ff('0x6e')];});_0x4fe4e4['on'](_0x33ff('0x6f'),function(_0x16ab4f){_0x89ac31[_0x33ff('0x70')]=isNaN(_0x16ab4f['duration'])?null:_0x16ab4f['duration']*0x3e8;_0x89ac31[_0x33ff('0x71')]=isNaN(_0x16ab4f[_0x33ff('0x68')])?null:_0x16ab4f[_0x33ff('0x68')];_0x89ac31[_0x33ff('0x72')]=isNaN(_0x16ab4f[_0x33ff('0x6a')])?null:_0x16ab4f['channelCount'];_0x89ac31[_0x33ff('0x73')]=isNaN(_0x16ab4f[_0x33ff('0x6c')])?null:_0x16ab4f[_0x33ff('0x6c')];_0x89ac31['converted_sampleRate']=isNaN(_0x16ab4f[_0x33ff('0x6e')])?null:_0x16ab4f[_0x33ff('0x6e')];});_0x4fe4e4['on']('end',function(){fs['chmodSync'](_0x4a3ba0,parseInt('0777',0x8));return db[_0x33ff('0x44')][_0x33ff('0x53')](_0x89ac31)[_0x33ff('0x23')](function(_0x22faa2){var _0x2e32d2={'role':_0xd32570[_0x33ff('0x74')]['role'],'userProfileId':_0xd32570[_0x33ff('0x74')][_0x33ff('0x75')]};if(!_0x2e32d2)throw new Error(_0x33ff('0x76'));if(_0x2e32d2[_0x33ff('0x77')]===_0x33ff('0x78')){var _0x2afa94=_0x22faa2[_0x33ff('0x25')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Sounds','userProfileId':_0x2e32d2[_0x33ff('0x75')]},'raw':!![]})[_0x33ff('0x23')](function(_0x332026){if(_0x332026&&_0x332026[_0x33ff('0x79')]===0x0){return db[_0x33ff('0x27')]['create']({'name':_0x2afa94[_0x33ff('0x29')],'resourceId':_0x2afa94['id'],'type':_0x332026[_0x33ff('0x29')],'sectionId':_0x332026['id']},{})[_0x33ff('0x23')](function(){return _0x22faa2;});}else{return _0x22faa2;}})[_0x33ff('0x47')](function(_0x4e6480){logger[_0x33ff('0x28')](_0x33ff('0x7a'),_0x4e6480);throw _0x4e6480;});}return _0x22faa2;})[_0x33ff('0x23')](respondWithResult(_0x425a2d,null))[_0x33ff('0x47')](handleError(_0x425a2d,null));});_0x4fe4e4['start']();}catch(_0x4be14f){_0x425a2d[_0x33ff('0x18')](0x1f4)[_0x33ff('0x63')](_0x4be14f);}};exports[_0x33ff('0x22')]=function(_0x56177f,_0x4821d1,_0x3991a0){return db[_0x33ff('0x44')][_0x33ff('0x46')]({'where':{'id':_0x56177f['params']['id']}})['then'](handleEntityNotFound(_0x4821d1,null))[_0x33ff('0x23')](saveUpdates(_[_0x33ff('0x3a')](_0x56177f[_0x33ff('0x74')],[_0x33ff('0x29'),_0x33ff('0x7b')]),null))['then'](respondWithResult(_0x4821d1,null))[_0x33ff('0x47')](handleError(_0x4821d1,null));};exports['delete']=function(_0x3dc473,_0x30ed3d,_0x28e010){return db['Sound'][_0x33ff('0x46')]({'where':{'id':_0x3dc473[_0x33ff('0x43')]['id']}})[_0x33ff('0x23')](function(_0x294380){if(_0x294380){return _0x294380['destroy']();}})[_0x33ff('0x23')](function(_0x339d76){var _0x13b3df=path['join'](config[_0x33ff('0x4b')],_0x33ff('0x5b'),util['format'](_0x33ff('0x52'),_0x339d76['save_name'],_0x339d76[_0x33ff('0x7c')]));var _0x3ff8f0=path[_0x33ff('0x4f')](config[_0x33ff('0x4b')],'server/files/sounds/converted',util[_0x33ff('0x51')](_0x33ff('0x52'),_0x339d76['save_name'],_0x339d76[_0x33ff('0x49')]));fs[_0x33ff('0x62')](_0x13b3df);fs['unlinkSync'](_0x3ff8f0);return _0x339d76;})[_0x33ff('0x23')](function(_0x486395){if(_0x486395){return _0x30ed3d[_0x33ff('0x18')](0xcc)[_0x33ff('0x19')]();}})['then'](handleEntityNotFound(_0x30ed3d,null))[_0x33ff('0x47')](handleError(_0x30ed3d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c39cf70..0ab7299 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 _0x32f4=['rimraf','../../config/environment','exports','define','lodash','api','moment','path'];(function(_0x7440e0,_0x42d9b8){var _0x33ee99=function(_0x3edb33){while(--_0x3edb33){_0x7440e0['push'](_0x7440e0['shift']());}};_0x33ee99(++_0x42d9b8);}(_0x32f4,0xd4));var _0x432f=function(_0x28c0cb,_0x4b54f3){_0x28c0cb=_0x28c0cb-0x0;var _0x9d54f7=_0x32f4[_0x28c0cb];return _0x9d54f7;};'use strict';var _=require(_0x432f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x432f('0x3'));var rimraf=require(_0x432f('0x4'));var config=require(_0x432f('0x5'));var attributes=require('./sound.attributes');module[_0x432f('0x6')]=function(_0x148db4,_0x4854e3){return _0x148db4[_0x432f('0x7')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7c8=['../../config/environment','./sound.attributes','exports','define','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54c341,_0x1b7e9a){var _0x3efba9=function(_0x4e2af6){while(--_0x4e2af6){_0x54c341['push'](_0x54c341['shift']());}};_0x3efba9(++_0x1b7e9a);}(_0xc7c8,0x123));var _0x8c7c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc7c8[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x8c7c('0x0'));var logger=require(_0x8c7c('0x1'))(_0x8c7c('0x2'));var moment=require(_0x8c7c('0x3'));var BPromise=require(_0x8c7c('0x4'));var rp=require(_0x8c7c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c7c('0x6'));var attributes=require(_0x8c7c('0x7'));module[_0x8c7c('0x8')]=function(_0x46b77a,_0x5ac82d){return _0x46b77a[_0x8c7c('0x9')]('Sound',attributes,{'tableName':_0x8c7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 5ccd216..2a01456 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 _0x59f1=['then','debug','stringify','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSound','Sound','find','options','raw','attributes','map','model','include'];(function(_0x3ceca3,_0x50a1c6){var _0x491057=function(_0x3560e0){while(--_0x3560e0){_0x3ceca3['push'](_0x3ceca3['shift']());}};_0x491057(++_0x50a1c6);}(_0x59f1,0x1f3));var _0x159f=function(_0x457c86,_0x2d8e2b){_0x457c86=_0x457c86-0x0;var _0x58fa8b=_0x59f1[_0x457c86];return _0x58fa8b;};'use strict';var _=require('lodash');var util=require(_0x159f('0x0'));var moment=require(_0x159f('0x1'));var BPromise=require(_0x159f('0x2'));var rs=require(_0x159f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x159f('0x4'))(_0x159f('0x5'));var config=require(_0x159f('0x6'));var jayson=require(_0x159f('0x7'));var client=jayson[_0x159f('0x8')][_0x159f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b34a4,_0x5d1fbb,_0x24c0e0){return new BPromise(function(_0x15b150,_0x503c9a){return client[_0x159f('0xa')](_0x2b34a4,_0x24c0e0)['then'](function(_0x49756f){logger[_0x159f('0xb')](_0x159f('0xc'),_0x5d1fbb,_0x159f('0xd'));logger['debug'](_0x159f('0xe'),_0x5d1fbb,_0x159f('0xd'),JSON['stringify'](_0x49756f));if(_0x49756f[_0x159f('0xf')]){if(_0x49756f[_0x159f('0xf')]['code']===0x1f4){logger[_0x159f('0xf')]('Sound,\x20%s,\x20%s',_0x5d1fbb,_0x49756f[_0x159f('0xf')][_0x159f('0x10')]);return _0x503c9a(_0x49756f[_0x159f('0xf')][_0x159f('0x10')]);}logger['error'](_0x159f('0xc'),_0x5d1fbb,_0x49756f[_0x159f('0xf')][_0x159f('0x10')]);return _0x15b150(_0x49756f[_0x159f('0xf')][_0x159f('0x10')]);}else{logger[_0x159f('0xb')](_0x159f('0xc'),_0x5d1fbb,_0x159f('0xd'));_0x15b150(_0x49756f[_0x159f('0x11')][_0x159f('0x10')]);}})[_0x159f('0x12')](function(_0x4db02e){logger[_0x159f('0xf')](_0x159f('0xc'),_0x5d1fbb,_0x4db02e);_0x503c9a(_0x4db02e);});});}exports[_0x159f('0x13')]=function(_0x1ff45a){var _0x198830=this;return new Promise(function(_0x2f2bd1,_0x4cd338){return db[_0x159f('0x14')][_0x159f('0x15')]({'raw':_0x1ff45a[_0x159f('0x16')]?_0x1ff45a['options'][_0x159f('0x17')]===undefined?!![]:![]:!![],'where':_0x1ff45a[_0x159f('0x16')]?_0x1ff45a[_0x159f('0x16')]['where']||null:null,'attributes':_0x1ff45a[_0x159f('0x16')]?_0x1ff45a['options'][_0x159f('0x18')]||null:null,'include':_0x1ff45a[_0x159f('0x16')]?_0x1ff45a['options']['include']?_[_0x159f('0x19')](_0x1ff45a['options']['include'],function(_0x215ef2){return{'model':db[_0x215ef2[_0x159f('0x1a')]],'as':_0x215ef2['as'],'attributes':_0x215ef2['attributes'],'include':_0x215ef2[_0x159f('0x1b')]?_[_0x159f('0x19')](_0x215ef2['include'],function(_0x42b0ae){return{'model':db[_0x42b0ae['model']],'as':_0x42b0ae['as'],'attributes':_0x42b0ae['attributes'],'include':_0x42b0ae['include']?_[_0x159f('0x19')](_0x42b0ae[_0x159f('0x1b')],function(_0x5538a9){return{'model':db[_0x5538a9[_0x159f('0x1a')]],'as':_0x5538a9['as'],'attributes':_0x5538a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x159f('0x1c')](function(_0x12dfbd){logger[_0x159f('0xb')](_0x159f('0x13'),_0x1ff45a);logger[_0x159f('0x1d')](_0x159f('0x13'),_0x1ff45a,JSON[_0x159f('0x1e')](_0x12dfbd));_0x2f2bd1(_0x12dfbd);})[_0x159f('0x12')](function(_0x39c236){logger[_0x159f('0xf')](_0x159f('0x13'),_0x39c236[_0x159f('0x10')],_0x1ff45a);_0x4cd338(_0x198830[_0x159f('0xf')](0x1f4,_0x39c236['message']));});});}; \ No newline at end of file +var _0x8803=['request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','ShowSound','Sound','find','options','map','include','model','attributes','stringify','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8803,0xe6));var _0x3880=function(_0x3ee905,_0xdf66f1){_0x3ee905=_0x3ee905-0x0;var _0x216b78=_0x8803[_0x3ee905];return _0x216b78;};'use strict';var _=require('lodash');var util=require(_0x3880('0x0'));var moment=require(_0x3880('0x1'));var BPromise=require(_0x3880('0x2'));var rs=require(_0x3880('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3880('0x4'))['db'];var utils=require(_0x3880('0x5'));var logger=require(_0x3880('0x6'))('rpc');var config=require(_0x3880('0x7'));var jayson=require(_0x3880('0x8'));var client=jayson[_0x3880('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387842,_0x347f48,_0x1fe1ed){return new BPromise(function(_0x3f85ee,_0x2deb78){return client[_0x3880('0xa')](_0x387842,_0x1fe1ed)[_0x3880('0xb')](function(_0x49803d){logger[_0x3880('0xc')](_0x3880('0xd'),_0x347f48,_0x3880('0xe'));logger[_0x3880('0xf')](_0x3880('0x10'),_0x347f48,'request\x20sent',JSON['stringify'](_0x49803d));if(_0x49803d['error']){if(_0x49803d[_0x3880('0x11')][_0x3880('0x12')]===0x1f4){logger[_0x3880('0x11')](_0x3880('0xd'),_0x347f48,_0x49803d[_0x3880('0x11')]['message']);return _0x2deb78(_0x49803d[_0x3880('0x11')][_0x3880('0x13')]);}logger[_0x3880('0x11')](_0x3880('0xd'),_0x347f48,_0x49803d['error'][_0x3880('0x13')]);return _0x3f85ee(_0x49803d[_0x3880('0x11')][_0x3880('0x13')]);}else{logger[_0x3880('0xc')]('Sound,\x20%s,\x20%s',_0x347f48,_0x3880('0xe'));_0x3f85ee(_0x49803d['result'][_0x3880('0x13')]);}})['catch'](function(_0x218b55){logger['error']('Sound,\x20%s,\x20%s',_0x347f48,_0x218b55);_0x2deb78(_0x218b55);});});}exports[_0x3880('0x14')]=function(_0x6a4494){var _0x59673c=this;return new Promise(function(_0x3d9db8,_0x6dd156){return db[_0x3880('0x15')][_0x3880('0x16')]({'raw':_0x6a4494['options']?_0x6a4494['options']['raw']===undefined?!![]:![]:!![],'where':_0x6a4494['options']?_0x6a4494[_0x3880('0x17')]['where']||null:null,'attributes':_0x6a4494[_0x3880('0x17')]?_0x6a4494[_0x3880('0x17')]['attributes']||null:null,'include':_0x6a4494[_0x3880('0x17')]?_0x6a4494['options']['include']?_[_0x3880('0x18')](_0x6a4494[_0x3880('0x17')]['include'],function(_0x40bd76){return{'model':db[_0x40bd76['model']],'as':_0x40bd76['as'],'attributes':_0x40bd76['attributes'],'include':_0x40bd76[_0x3880('0x19')]?_[_0x3880('0x18')](_0x40bd76[_0x3880('0x19')],function(_0x3173db){return{'model':db[_0x3173db[_0x3880('0x1a')]],'as':_0x3173db['as'],'attributes':_0x3173db[_0x3880('0x1b')],'include':_0x3173db['include']?_[_0x3880('0x18')](_0x3173db[_0x3880('0x19')],function(_0x19fc99){return{'model':db[_0x19fc99[_0x3880('0x1a')]],'as':_0x19fc99['as'],'attributes':_0x19fc99[_0x3880('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3880('0xb')](function(_0x8ea017){logger['info']('ShowSound',_0x6a4494);logger[_0x3880('0xf')](_0x3880('0x14'),_0x6a4494,JSON[_0x3880('0x1c')](_0x8ea017));_0x3d9db8(_0x8ea017);})[_0x3880('0x1d')](function(_0x3eeefe){logger['error']('ShowSound',_0x3eeefe[_0x3880('0x13')],_0x6a4494);_0x6dd156(_0x59673c['error'](0x1f4,_0x3eeefe[_0x3880('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ac01dd3..0f78e11 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34620e,_0x582015){var _0x3d33cd=function(_0x19dc7f){while(--_0x19dc7f){_0x34620e['push'](_0x34620e['shift']());}};_0x3d33cd(++_0x582015);}(_0x0b0e,0x187));var _0xe0b0=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x0b0e[_0x568cf0];return _0x360f81;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _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(_0x551496,_0x1bff3f){var _0x281f37=function(_0x55fb74){while(--_0x55fb74){_0x551496['push'](_0x551496['shift']());}};_0x281f37(++_0x1bff3f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb7e7[_0x4b2436];return _0x4f5ab2;};'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 3ae3a80..5cf8552 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 _0xf155=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x59f66e,_0x4e2653){var _0x1ad6f7=function(_0x49de6f){while(--_0x49de6f){_0x59f66e['push'](_0x59f66e['shift']());}};_0x1ad6f7(++_0x4e2653);}(_0xf155,0x1e9));var _0x5f15=function(_0x18dc34,_0x205f71){_0x18dc34=_0x18dc34-0x0;var _0x4ab15b=_0xf155[_0x18dc34];return _0x4ab15b;};'use strict';var Sequelize=require(_0x5f15('0x0'));module[_0x5f15('0x1')]={'uniqueid':{'type':Sequelize[_0x5f15('0x2')]},'body':{'type':Sequelize[_0x5f15('0x3')](_0x5f15('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x5f15('0x5')]('in','out'),'defaultValue':_0x5f15('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x5f15('0x3')]}}; \ No newline at end of file +var _0x3e85=['TEXT','sequelize','exports','STRING','medium','ENUM','out'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e85,0x1ba));var _0x53e8=function(_0x5a5675,_0x1ffcdb){_0x5a5675=_0x5a5675-0x0;var _0x5c2444=_0x3e85[_0x5a5675];return _0x5c2444;};'use strict';var Sequelize=require(_0x53e8('0x0'));module[_0x53e8('0x1')]={'uniqueid':{'type':Sequelize[_0x53e8('0x2')]},'body':{'type':Sequelize['TEXT'](_0x53e8('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x53e8('0x4')]('in',_0x53e8('0x5')),'defaultValue':_0x53e8('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x53e8('0x2')]},'providerResponse':{'type':Sequelize[_0x53e8('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index b88000c..78fdf2b 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 _0x531f=['merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','offset','undefined','count','limit','status','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x54e1b5,_0x27ccf1){var _0x2415e2=function(_0xec6687){while(--_0xec6687){_0x54e1b5['push'](_0x54e1b5['shift']());}};_0x2415e2(++_0x27ccf1);}(_0x531f,0x137));var _0xf531=function(_0xd91aea,_0x90202d){_0xd91aea=_0xd91aea-0x0;var _0xed7cb0=_0x531f[_0xd91aea];return _0xed7cb0;};'use strict';var emlformat=require(_0xf531('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf531('0x1'));var rp=require(_0xf531('0x2'));var moment=require(_0xf531('0x3'));var BPromise=require(_0xf531('0x4'));var Mustache=require(_0xf531('0x5'));var util=require(_0xf531('0x6'));var path=require(_0xf531('0x7'));var sox=require('sox');var csv=require(_0xf531('0x8'));var ejs=require(_0xf531('0x9'));var fs=require('fs');var fs_extra=require(_0xf531('0xa'));var _=require(_0xf531('0xb'));var squel=require(_0xf531('0xc'));var crypto=require(_0xf531('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf531('0x8'));var querystring=require(_0xf531('0xe'));var Papa=require(_0xf531('0xf'));var Redis=require(_0xf531('0x10'));var authService=require(_0xf531('0x11'));var qs=require(_0xf531('0x12'));var as=require(_0xf531('0x13'));var hardwareService=require(_0xf531('0x14'));var logger=require(_0xf531('0x15'))(_0xf531('0x16'));var utils=require('../../config/utils');var config=require(_0xf531('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf531('0x18'))['db'];function respondWithStatusCode(_0x3a3f60,_0x18b43f){_0x18b43f=_0x18b43f||0xcc;return function(_0x577d5b){if(_0x577d5b){return _0x3a3f60['sendStatus'](_0x18b43f);}return _0x3a3f60['status'](_0x18b43f)[_0xf531('0x19')]();};}function respondWithResult(_0x3b5db9,_0xe92fa3){_0xe92fa3=_0xe92fa3||0xc8;return function(_0x187c57){if(_0x187c57){return _0x3b5db9['status'](_0xe92fa3)['json'](_0x187c57);}};}function respondWithFilteredResult(_0xc27685,_0x3c3a17){return function(_0x33e8bc){if(_0x33e8bc){var _0x12f4cc=typeof _0x3c3a17[_0xf531('0x1a')]===_0xf531('0x1b')&&typeof _0x3c3a17['limit']===_0xf531('0x1b');var _0x257912=_0x33e8bc[_0xf531('0x1c')];var _0x25737e=_0x12f4cc?0x0:_0x3c3a17[_0xf531('0x1a')];var _0x426010=_0x12f4cc?_0x33e8bc['count']:_0x3c3a17[_0xf531('0x1a')]+_0x3c3a17[_0xf531('0x1d')];var _0x43f97e;if(_0x426010>=_0x257912){_0x426010=_0x257912;_0x43f97e=0xc8;}else{_0x43f97e=0xce;}_0xc27685[_0xf531('0x1e')](_0x43f97e);return _0xc27685['set']('Content-Range',_0x25737e+'-'+_0x426010+'/'+_0x257912)['json'](_0x33e8bc);}return null;};}function patchUpdates(_0x5e0fe2){return function(_0x2035b5){try{jsonpatch[_0xf531('0x1f')](_0x2035b5,_0x5e0fe2,!![]);}catch(_0x27e4ce){return BPromise[_0xf531('0x20')](_0x27e4ce);}return _0x2035b5[_0xf531('0x21')]();};}function saveUpdates(_0x324395,_0x56ee1e){return function(_0x4c7430){if(_0x4c7430){return _0x4c7430[_0xf531('0x22')](_0x324395)[_0xf531('0x23')](function(_0x9916fe){return _0x9916fe;});}return null;};}function removeEntity(_0x12cd5c,_0x116e11){return function(_0x5372de){if(_0x5372de){return _0x5372de[_0xf531('0x24')]()['then'](function(){_0x12cd5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4605ad,_0x315179){return function(_0x52c4a4){if(!_0x52c4a4){_0x4605ad['sendStatus'](0x194);}return _0x52c4a4;};}function handleError(_0x51dfd3,_0x29cf5c){_0x29cf5c=_0x29cf5c||0x1f4;return function(_0x1ea8d8){logger['error'](_0x1ea8d8[_0xf531('0x25')]);if(_0x1ea8d8[_0xf531('0x26')]){delete _0x1ea8d8['name'];}_0x51dfd3[_0xf531('0x1e')](_0x29cf5c)[_0xf531('0x27')](_0x1ea8d8);};}exports[_0xf531('0x28')]=function(_0x10416e,_0x5c65e9){var _0x21a51e={},_0x6c61a8={},_0x39bb5b={'count':0x0,'rows':[]};var _0x47b89c=_[_0xf531('0x29')](db[_0xf531('0x2a')]['rawAttributes'],function(_0x312a23){return{'name':_0x312a23[_0xf531('0x2b')],'type':_0x312a23[_0xf531('0x2c')][_0xf531('0x2d')]};});_0x6c61a8[_0xf531('0x2e')]=_['map'](_0x47b89c,'name');_0x6c61a8['query']=_[_0xf531('0x2f')](_0x10416e[_0xf531('0x30')]);_0x6c61a8[_0xf531('0x31')]=_['intersection'](_0x6c61a8['model'],_0x6c61a8[_0xf531('0x30')]);_0x21a51e[_0xf531('0x32')]=_[_0xf531('0x33')](_0x6c61a8[_0xf531('0x2e')],qs[_0xf531('0x34')](_0x10416e[_0xf531('0x30')]['fields']));_0x21a51e[_0xf531('0x32')]=_0x21a51e[_0xf531('0x32')][_0xf531('0x35')]?_0x21a51e['attributes']:_0x6c61a8['model'];if(!_0x10416e['query'][_0xf531('0x36')](_0xf531('0x37'))){_0x21a51e[_0xf531('0x1d')]=qs[_0xf531('0x1d')](_0x10416e[_0xf531('0x30')]['limit']);_0x21a51e[_0xf531('0x1a')]=qs['offset'](_0x10416e[_0xf531('0x30')]['offset']);}_0x21a51e[_0xf531('0x38')]=qs[_0xf531('0x39')](_0x10416e[_0xf531('0x30')][_0xf531('0x39')]);_0x21a51e[_0xf531('0x3a')]=qs['filters'](_['pick'](_0x10416e[_0xf531('0x30')],_0x6c61a8[_0xf531('0x31')]),_0x47b89c);if(_0x10416e[_0xf531('0x30')]['filter']){_0x21a51e['where']=_[_0xf531('0x3b')](_0x21a51e[_0xf531('0x3a')],{'$or':_['map'](_0x47b89c,function(_0x42b65a){if(_0x42b65a['type']!==_0xf531('0x3c')){var _0x39d31c={};_0x39d31c[_0x42b65a[_0xf531('0x26')]]={'$like':'%'+_0x10416e['query'][_0xf531('0x3d')]+'%'};return _0x39d31c;}})});}_0x21a51e=_[_0xf531('0x3b')]({},_0x21a51e,_0x10416e['options']);var _0x240e11={'where':_0x21a51e['where']};return db['SquareMessage'][_0xf531('0x1c')](_0x240e11)[_0xf531('0x23')](function(_0x40a4a2){_0x39bb5b[_0xf531('0x1c')]=_0x40a4a2;if(_0x10416e[_0xf531('0x30')][_0xf531('0x3e')]){_0x21a51e[_0xf531('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0xf531('0x40')](_0x21a51e);})[_0xf531('0x23')](function(_0x24401b){_0x39bb5b[_0xf531('0x41')]=_0x24401b;return _0x39bb5b;})[_0xf531('0x23')](respondWithFilteredResult(_0x5c65e9,_0x21a51e))[_0xf531('0x42')](handleError(_0x5c65e9,null));};exports[_0xf531('0x43')]=function(_0x1b11dc,_0xf1ab34){var _0x2adb44={'raw':!![],'where':{'id':_0x1b11dc[_0xf531('0x44')]['id']}},_0x1173b5={};_0x1173b5[_0xf531('0x2e')]=_[_0xf531('0x2f')](db[_0xf531('0x2a')][_0xf531('0x45')]);_0x1173b5['query']=_[_0xf531('0x2f')](_0x1b11dc['query']);_0x1173b5[_0xf531('0x31')]=_[_0xf531('0x33')](_0x1173b5['model'],_0x1173b5[_0xf531('0x30')]);_0x2adb44[_0xf531('0x32')]=_['intersection'](_0x1173b5[_0xf531('0x2e')],qs[_0xf531('0x34')](_0x1b11dc['query'][_0xf531('0x34')]));_0x2adb44['attributes']=_0x2adb44[_0xf531('0x32')][_0xf531('0x35')]?_0x2adb44[_0xf531('0x32')]:_0x1173b5['model'];if(_0x1b11dc[_0xf531('0x30')][_0xf531('0x3e')]){_0x2adb44[_0xf531('0x3f')]=[{'all':!![]}];}_0x2adb44=_[_0xf531('0x3b')]({},_0x2adb44,_0x1b11dc[_0xf531('0x46')]);return db[_0xf531('0x2a')][_0xf531('0x47')](_0x2adb44)[_0xf531('0x23')](handleEntityNotFound(_0xf1ab34,null))[_0xf531('0x23')](respondWithResult(_0xf1ab34,null))[_0xf531('0x42')](handleError(_0xf1ab34,null));};exports['create']=function(_0x45ce3a,_0x3173a1){return db[_0xf531('0x2a')][_0xf531('0x48')](_0x45ce3a[_0xf531('0x49')],{})['then'](respondWithResult(_0x3173a1,0xc9))[_0xf531('0x42')](handleError(_0x3173a1,null));};exports[_0xf531('0x22')]=function(_0x5eefc1,_0x42d60e){if(_0x5eefc1[_0xf531('0x49')]['id']){delete _0x5eefc1[_0xf531('0x49')]['id'];}return db[_0xf531('0x2a')][_0xf531('0x47')]({'where':{'id':_0x5eefc1[_0xf531('0x44')]['id']}})[_0xf531('0x23')](handleEntityNotFound(_0x42d60e,null))[_0xf531('0x23')](saveUpdates(_0x5eefc1[_0xf531('0x49')],null))[_0xf531('0x23')](respondWithResult(_0x42d60e,null))[_0xf531('0x42')](handleError(_0x42d60e,null));};exports[_0xf531('0x24')]=function(_0x2d02f6,_0x3958d7){return db['SquareMessage'][_0xf531('0x47')]({'where':{'id':_0x2d02f6[_0xf531('0x44')]['id']}})[_0xf531('0x23')](handleEntityNotFound(_0x3958d7,null))[_0xf531('0x23')](removeEntity(_0x3958d7,null))['catch'](handleError(_0x3958d7,null));}; \ No newline at end of file +var _0x46fa=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','send','map','SquareMessage','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','name','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash'];(function(_0x165634,_0x25d6a7){var _0x25145e=function(_0x361be5){while(--_0x361be5){_0x165634['push'](_0x165634['shift']());}};_0x25145e(++_0x25d6a7);}(_0x46fa,0x89));var _0xa46f=function(_0x2a9d75,_0x413d19){_0x2a9d75=_0x2a9d75-0x0;var _0x1e4554=_0x46fa[_0x2a9d75];return _0x1e4554;};'use strict';var emlformat=require(_0xa46f('0x0'));var rimraf=require(_0xa46f('0x1'));var zipdir=require(_0xa46f('0x2'));var jsonpatch=require(_0xa46f('0x3'));var rp=require(_0xa46f('0x4'));var moment=require(_0xa46f('0x5'));var BPromise=require(_0xa46f('0x6'));var Mustache=require('mustache');var util=require(_0xa46f('0x7'));var path=require(_0xa46f('0x8'));var sox=require('sox');var csv=require(_0xa46f('0x9'));var ejs=require(_0xa46f('0xa'));var fs=require('fs');var fs_extra=require(_0xa46f('0xb'));var _=require(_0xa46f('0xc'));var squel=require('squel');var crypto=require(_0xa46f('0xd'));var jsforce=require(_0xa46f('0xe'));var deskjs=require(_0xa46f('0xf'));var toCsv=require(_0xa46f('0x9'));var querystring=require(_0xa46f('0x10'));var Papa=require(_0xa46f('0x11'));var Redis=require(_0xa46f('0x12'));var authService=require(_0xa46f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa46f('0x14'));var logger=require(_0xa46f('0x15'))('api');var utils=require(_0xa46f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa46f('0x17'));var db=require(_0xa46f('0x18'))['db'];function respondWithStatusCode(_0x18811c,_0x2a5701){_0x2a5701=_0x2a5701||0xcc;return function(_0x1f7d18){if(_0x1f7d18){return _0x18811c['sendStatus'](_0x2a5701);}return _0x18811c[_0xa46f('0x19')](_0x2a5701)[_0xa46f('0x1a')]();};}function respondWithResult(_0x499e36,_0x32ea9f){_0x32ea9f=_0x32ea9f||0xc8;return function(_0x4ca3a5){if(_0x4ca3a5){return _0x499e36['status'](_0x32ea9f)[_0xa46f('0x1b')](_0x4ca3a5);}};}function respondWithFilteredResult(_0x2b86c5,_0x3ca948){return function(_0xecf306){if(_0xecf306){var _0x251d30=typeof _0x3ca948[_0xa46f('0x1c')]==='undefined'&&typeof _0x3ca948[_0xa46f('0x1d')]===_0xa46f('0x1e');var _0x6366cc=_0xecf306[_0xa46f('0x1f')];var _0x32d7ab=_0x251d30?0x0:_0x3ca948['offset'];var _0x2de7b5=_0x251d30?_0xecf306['count']:_0x3ca948['offset']+_0x3ca948[_0xa46f('0x1d')];var _0x435c4b;if(_0x2de7b5>=_0x6366cc){_0x2de7b5=_0x6366cc;_0x435c4b=0xc8;}else{_0x435c4b=0xce;}_0x2b86c5[_0xa46f('0x19')](_0x435c4b);return _0x2b86c5[_0xa46f('0x20')](_0xa46f('0x21'),_0x32d7ab+'-'+_0x2de7b5+'/'+_0x6366cc)[_0xa46f('0x1b')](_0xecf306);}return null;};}function patchUpdates(_0x300261){return function(_0x24b07a){try{jsonpatch[_0xa46f('0x22')](_0x24b07a,_0x300261,!![]);}catch(_0x28ac41){return BPromise['reject'](_0x28ac41);}return _0x24b07a[_0xa46f('0x23')]();};}function saveUpdates(_0x4fa02a,_0x3350b7){return function(_0x395e7f){if(_0x395e7f){return _0x395e7f[_0xa46f('0x24')](_0x4fa02a)['then'](function(_0x5997a0){return _0x5997a0;});}return null;};}function removeEntity(_0x4533bb,_0x2806bf){return function(_0xc9287c){if(_0xc9287c){return _0xc9287c[_0xa46f('0x25')]()[_0xa46f('0x26')](function(){_0x4533bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ec57c,_0x38244c){return function(_0x5f1ab9){if(!_0x5f1ab9){_0x4ec57c[_0xa46f('0x27')](0x194);}return _0x5f1ab9;};}function handleError(_0xde1e95,_0x2a1a33){_0x2a1a33=_0x2a1a33||0x1f4;return function(_0x5b5d1f){logger[_0xa46f('0x28')](_0x5b5d1f[_0xa46f('0x29')]);if(_0x5b5d1f['name']){delete _0x5b5d1f['name'];}_0xde1e95[_0xa46f('0x19')](_0x2a1a33)[_0xa46f('0x2a')](_0x5b5d1f);};}exports['index']=function(_0x429459,_0x19f809){var _0x26792e={},_0x4ec2a6={},_0x44219a={'count':0x0,'rows':[]};var _0x57b53f=_[_0xa46f('0x2b')](db[_0xa46f('0x2c')]['rawAttributes'],function(_0xf17c4c){return{'name':_0xf17c4c['fieldName'],'type':_0xf17c4c['type'][_0xa46f('0x2d')]};});_0x4ec2a6[_0xa46f('0x2e')]=_[_0xa46f('0x2b')](_0x57b53f,'name');_0x4ec2a6[_0xa46f('0x2f')]=_[_0xa46f('0x30')](_0x429459[_0xa46f('0x2f')]);_0x4ec2a6[_0xa46f('0x31')]=_[_0xa46f('0x32')](_0x4ec2a6[_0xa46f('0x2e')],_0x4ec2a6[_0xa46f('0x2f')]);_0x26792e[_0xa46f('0x33')]=_[_0xa46f('0x32')](_0x4ec2a6[_0xa46f('0x2e')],qs['fields'](_0x429459[_0xa46f('0x2f')][_0xa46f('0x34')]));_0x26792e[_0xa46f('0x33')]=_0x26792e['attributes'][_0xa46f('0x35')]?_0x26792e['attributes']:_0x4ec2a6[_0xa46f('0x2e')];if(!_0x429459[_0xa46f('0x2f')][_0xa46f('0x36')](_0xa46f('0x37'))){_0x26792e['limit']=qs[_0xa46f('0x1d')](_0x429459['query'][_0xa46f('0x1d')]);_0x26792e[_0xa46f('0x1c')]=qs[_0xa46f('0x1c')](_0x429459[_0xa46f('0x2f')]['offset']);}_0x26792e['order']=qs[_0xa46f('0x38')](_0x429459[_0xa46f('0x2f')]['sort']);_0x26792e['where']=qs['filters'](_[_0xa46f('0x39')](_0x429459['query'],_0x4ec2a6[_0xa46f('0x31')]),_0x57b53f);if(_0x429459['query']['filter']){_0x26792e[_0xa46f('0x3a')]=_[_0xa46f('0x3b')](_0x26792e[_0xa46f('0x3a')],{'$or':_[_0xa46f('0x2b')](_0x57b53f,function(_0x153e6a){if(_0x153e6a[_0xa46f('0x3c')]!=='VIRTUAL'){var _0x298bc={};_0x298bc[_0x153e6a[_0xa46f('0x3d')]]={'$like':'%'+_0x429459[_0xa46f('0x2f')][_0xa46f('0x3e')]+'%'};return _0x298bc;}})});}_0x26792e=_['merge']({},_0x26792e,_0x429459[_0xa46f('0x3f')]);var _0x48eb29={'where':_0x26792e['where']};return db[_0xa46f('0x2c')]['count'](_0x48eb29)[_0xa46f('0x26')](function(_0x535262){_0x44219a[_0xa46f('0x1f')]=_0x535262;if(_0x429459[_0xa46f('0x2f')][_0xa46f('0x40')]){_0x26792e[_0xa46f('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0xa46f('0x42')](_0x26792e);})[_0xa46f('0x26')](function(_0x2a14d6){_0x44219a[_0xa46f('0x43')]=_0x2a14d6;return _0x44219a;})[_0xa46f('0x26')](respondWithFilteredResult(_0x19f809,_0x26792e))[_0xa46f('0x44')](handleError(_0x19f809,null));};exports[_0xa46f('0x45')]=function(_0x3c7030,_0x51682f){var _0x3e329f={'raw':!![],'where':{'id':_0x3c7030[_0xa46f('0x46')]['id']}},_0x395704={};_0x395704[_0xa46f('0x2e')]=_[_0xa46f('0x30')](db[_0xa46f('0x2c')][_0xa46f('0x47')]);_0x395704[_0xa46f('0x2f')]=_[_0xa46f('0x30')](_0x3c7030[_0xa46f('0x2f')]);_0x395704['filters']=_[_0xa46f('0x32')](_0x395704['model'],_0x395704[_0xa46f('0x2f')]);_0x3e329f[_0xa46f('0x33')]=_[_0xa46f('0x32')](_0x395704[_0xa46f('0x2e')],qs['fields'](_0x3c7030[_0xa46f('0x2f')][_0xa46f('0x34')]));_0x3e329f['attributes']=_0x3e329f['attributes'][_0xa46f('0x35')]?_0x3e329f[_0xa46f('0x33')]:_0x395704[_0xa46f('0x2e')];if(_0x3c7030[_0xa46f('0x2f')][_0xa46f('0x40')]){_0x3e329f[_0xa46f('0x41')]=[{'all':!![]}];}_0x3e329f=_[_0xa46f('0x3b')]({},_0x3e329f,_0x3c7030['options']);return db[_0xa46f('0x2c')][_0xa46f('0x48')](_0x3e329f)['then'](handleEntityNotFound(_0x51682f,null))['then'](respondWithResult(_0x51682f,null))[_0xa46f('0x44')](handleError(_0x51682f,null));};exports[_0xa46f('0x49')]=function(_0x49f39a,_0x5a93ff){return db[_0xa46f('0x2c')][_0xa46f('0x49')](_0x49f39a['body'],{})['then'](respondWithResult(_0x5a93ff,0xc9))['catch'](handleError(_0x5a93ff,null));};exports['update']=function(_0x50e9f9,_0x55af35){if(_0x50e9f9[_0xa46f('0x4a')]['id']){delete _0x50e9f9[_0xa46f('0x4a')]['id'];}return db[_0xa46f('0x2c')]['find']({'where':{'id':_0x50e9f9[_0xa46f('0x46')]['id']}})['then'](handleEntityNotFound(_0x55af35,null))['then'](saveUpdates(_0x50e9f9[_0xa46f('0x4a')],null))[_0xa46f('0x26')](respondWithResult(_0x55af35,null))[_0xa46f('0x44')](handleError(_0x55af35,null));};exports[_0xa46f('0x25')]=function(_0x46498d,_0x156f19){return db[_0xa46f('0x2c')][_0xa46f('0x48')]({'where':{'id':_0x46498d[_0xa46f('0x46')]['id']}})['then'](handleEntityNotFound(_0x156f19,null))['then'](removeEntity(_0x156f19,null))[_0xa46f('0x44')](handleError(_0x156f19,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9879b0a..836ac7f 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 _0x7e5e=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SquareMessage'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7e5e,0x1cc));var _0xe7e5=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7e5e[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xe7e5('0x0'));var util=require('util');var logger=require(_0xe7e5('0x1'))(_0xe7e5('0x2'));var moment=require(_0xe7e5('0x3'));var BPromise=require('bluebird');var rp=require(_0xe7e5('0x4'));var fs=require('fs');var path=require(_0xe7e5('0x5'));var rimraf=require(_0xe7e5('0x6'));var config=require(_0xe7e5('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0xad2f42,_0x18325c){return _0xad2f42[_0xe7e5('0x8')](_0xe7e5('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc00e=['util','api','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash'];(function(_0xbc2d9e,_0x40ef4f){var _0x2e315c=function(_0x57fc55){while(--_0x57fc55){_0xbc2d9e['push'](_0xbc2d9e['shift']());}};_0x2e315c(++_0x40ef4f);}(_0xc00e,0x1b7));var _0xec00=function(_0x132d2a,_0x3f89af){_0x132d2a=_0x132d2a-0x0;var _0x7b6213=_0xc00e[_0x132d2a];return _0x7b6213;};'use strict';var _=require(_0xec00('0x0'));var util=require(_0xec00('0x1'));var logger=require('../../config/logger')(_0xec00('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec00('0x3'));var rimraf=require(_0xec00('0x4'));var config=require(_0xec00('0x5'));var attributes=require(_0xec00('0x6'));module[_0xec00('0x7')]=function(_0x230f87,_0x314839){return _0x230f87['define'](_0xec00('0x8'),attributes,{'tableName':_0xec00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 7118c4d..dd30bcc 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 _0x079f=['CreateSquareMessage','SquareMessage','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x44ba28,_0x4479f8){var _0x405998=function(_0x33243b){while(--_0x33243b){_0x44ba28['push'](_0x44ba28['shift']());}};_0x405998(++_0x4479f8);}(_0x079f,0x1da));var _0xf079=function(_0x433fa5,_0x884980){_0x433fa5=_0x433fa5-0x0;var _0x36b69b=_0x079f[_0x433fa5];return _0x36b69b;};'use strict';var _=require(_0xf079('0x0'));var util=require(_0xf079('0x1'));var moment=require(_0xf079('0x2'));var BPromise=require(_0xf079('0x3'));var rs=require(_0xf079('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf079('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf079('0x6'));var config=require(_0xf079('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf079('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3269aa,_0x901387,_0x4fcedb){return new BPromise(function(_0x15590a,_0x2597b5){return client[_0xf079('0x9')](_0x3269aa,_0x4fcedb)[_0xf079('0xa')](function(_0x5f05bd){logger[_0xf079('0xb')](_0xf079('0xc'),_0x901387,_0xf079('0xd'));logger[_0xf079('0xe')](_0xf079('0xf'),_0x901387,_0xf079('0xd'),JSON[_0xf079('0x10')](_0x5f05bd));if(_0x5f05bd[_0xf079('0x11')]){if(_0x5f05bd[_0xf079('0x11')]['code']===0x1f4){logger['error'](_0xf079('0xc'),_0x901387,_0x5f05bd[_0xf079('0x11')][_0xf079('0x12')]);return _0x2597b5(_0x5f05bd[_0xf079('0x11')]['message']);}logger[_0xf079('0x11')](_0xf079('0xc'),_0x901387,_0x5f05bd[_0xf079('0x11')][_0xf079('0x12')]);return _0x15590a(_0x5f05bd[_0xf079('0x11')][_0xf079('0x12')]);}else{logger[_0xf079('0xb')]('SquareMessage,\x20%s,\x20%s',_0x901387,_0xf079('0xd'));_0x15590a(_0x5f05bd[_0xf079('0x13')][_0xf079('0x12')]);}})['catch'](function(_0x2a1e16){logger[_0xf079('0x11')]('SquareMessage,\x20%s,\x20%s',_0x901387,_0x2a1e16);_0x2597b5(_0x2a1e16);});});}exports[_0xf079('0x14')]=function(_0x11d571){var _0x2d8543=this;return new Promise(function(_0x350c34,_0x106350){return db[_0xf079('0x15')]['create'](_0x11d571[_0xf079('0x16')],{'raw':_0x11d571[_0xf079('0x17')]?_0x11d571[_0xf079('0x17')][_0xf079('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4549ae){logger[_0xf079('0xb')](_0xf079('0x14'),_0x11d571);logger[_0xf079('0xe')](_0xf079('0x14'),_0x11d571,JSON[_0xf079('0x10')](_0x4549ae));_0x350c34(_0x4549ae);})[_0xf079('0x19')](function(_0x5498d0){logger['error'](_0xf079('0x14'),_0x5498d0[_0xf079('0x12')],_0x11d571);_0x106350(_0x2d8543['error'](0x1f4,_0x5498d0[_0xf079('0x12')]));});});}; \ No newline at end of file +var _0x74e5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis'];(function(_0x39bc91,_0x2070c8){var _0x1695e3=function(_0x4a9046){while(--_0x4a9046){_0x39bc91['push'](_0x39bc91['shift']());}};_0x1695e3(++_0x2070c8);}(_0x74e5,0xa9));var _0x574e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x74e5[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x574e('0x0'));var util=require(_0x574e('0x1'));var moment=require(_0x574e('0x2'));var BPromise=require('bluebird');var rs=require(_0x574e('0x3'));var fs=require('fs');var Redis=require(_0x574e('0x4'));var db=require(_0x574e('0x5'))['db'];var utils=require(_0x574e('0x6'));var logger=require(_0x574e('0x7'))(_0x574e('0x8'));var config=require(_0x574e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x574e('0xa')][_0x574e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5753,_0x4d43ec,_0x9e8d7f){return new BPromise(function(_0x47de1c,_0x2aa5d0){return client[_0x574e('0xc')](_0x5b5753,_0x9e8d7f)['then'](function(_0x5c34c9){logger[_0x574e('0xd')]('SquareMessage,\x20%s,\x20%s',_0x4d43ec,'request\x20sent');logger[_0x574e('0xe')](_0x574e('0xf'),_0x4d43ec,_0x574e('0x10'),JSON[_0x574e('0x11')](_0x5c34c9));if(_0x5c34c9[_0x574e('0x12')]){if(_0x5c34c9[_0x574e('0x12')][_0x574e('0x13')]===0x1f4){logger['error'](_0x574e('0x14'),_0x4d43ec,_0x5c34c9[_0x574e('0x12')][_0x574e('0x15')]);return _0x2aa5d0(_0x5c34c9['error']['message']);}logger['error'](_0x574e('0x14'),_0x4d43ec,_0x5c34c9[_0x574e('0x12')][_0x574e('0x15')]);return _0x47de1c(_0x5c34c9[_0x574e('0x12')][_0x574e('0x15')]);}else{logger[_0x574e('0xd')](_0x574e('0x14'),_0x4d43ec,'request\x20sent');_0x47de1c(_0x5c34c9['result'][_0x574e('0x15')]);}})[_0x574e('0x16')](function(_0x207822){logger[_0x574e('0x12')](_0x574e('0x14'),_0x4d43ec,_0x207822);_0x2aa5d0(_0x207822);});});}exports[_0x574e('0x17')]=function(_0x108227){var _0xb34367=this;return new Promise(function(_0x314718,_0x1a0d60){return db[_0x574e('0x18')][_0x574e('0x19')](_0x108227[_0x574e('0x1a')],{'raw':_0x108227[_0x574e('0x1b')]?_0x108227[_0x574e('0x1b')][_0x574e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x98189a){logger[_0x574e('0xd')](_0x574e('0x17'),_0x108227);logger[_0x574e('0xe')](_0x574e('0x17'),_0x108227,JSON[_0x574e('0x11')](_0x98189a));_0x314718(_0x98189a);})[_0x574e('0x16')](function(_0x2a072b){logger[_0x574e('0x12')](_0x574e('0x17'),_0x2a072b[_0x574e('0x15')],_0x108227);_0x1a0d60(_0xb34367[_0x574e('0x12')](0x1f4,_0x2a072b[_0x574e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f1693d2..347506b 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 _0x9a11=['../../config/environment','./squareOdbc.controller','get','index','/:id','show','15s','test','isAuthenticated','create','put','update','delete','exports','multer','path','express','Router','../../components/interaction/service'];(function(_0x3621ec,_0x2e40b8){var _0x5ebec0=function(_0x5a07e2){while(--_0x5a07e2){_0x3621ec['push'](_0x3621ec['shift']());}};_0x5ebec0(++_0x2e40b8);}(_0x9a11,0x80));var _0x19a1=function(_0x1892ba,_0x23194c){_0x1892ba=_0x1892ba-0x0;var _0x15d252=_0x9a11[_0x1892ba];return _0x15d252;};'use strict';var multer=require(_0x19a1('0x0'));var util=require('util');var path=require(_0x19a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x19a1('0x2'));var router=express[_0x19a1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x19a1('0x4'));var config=require(_0x19a1('0x5'));var controller=require(_0x19a1('0x6'));router[_0x19a1('0x7')]('/',auth['isAuthenticated'](),controller[_0x19a1('0x8')]);router[_0x19a1('0x7')](_0x19a1('0x9'),auth['isAuthenticated'](),controller[_0x19a1('0xa')]);router['get']('/:id/test',auth['isAuthenticated'](),timeout(_0x19a1('0xb')),controller[_0x19a1('0xc')]);router['post']('/',auth[_0x19a1('0xd')](),controller[_0x19a1('0xe')]);router[_0x19a1('0xf')](_0x19a1('0x9'),auth['isAuthenticated'](),controller[_0x19a1('0x10')]);router[_0x19a1('0x11')](_0x19a1('0x9'),auth[_0x19a1('0xd')](),controller['destroy']);module[_0x19a1('0x12')]=router; \ No newline at end of file +var _0xf25b=['update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf25b,0x1a5));var _0xbf25=function(_0x57a837,_0x47c8db){_0x57a837=_0x57a837-0x0;var _0x234337=_0xf25b[_0x57a837];return _0x234337;};'use strict';var multer=require(_0xbf25('0x0'));var util=require(_0xbf25('0x1'));var path=require(_0xbf25('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf25('0x3'));var router=express['Router']();var fs_extra=require(_0xbf25('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbf25('0x5'));var config=require(_0xbf25('0x6'));var controller=require(_0xbf25('0x7'));router[_0xbf25('0x8')]('/',auth[_0xbf25('0x9')](),controller[_0xbf25('0xa')]);router[_0xbf25('0x8')](_0xbf25('0xb'),auth[_0xbf25('0x9')](),controller[_0xbf25('0xc')]);router[_0xbf25('0x8')](_0xbf25('0xd'),auth[_0xbf25('0x9')](),timeout(_0xbf25('0xe')),controller[_0xbf25('0xf')]);router['post']('/',auth[_0xbf25('0x9')](),controller['create']);router['put'](_0xbf25('0xb'),auth[_0xbf25('0x9')](),controller[_0xbf25('0x10')]);router[_0xbf25('0x11')](_0xbf25('0xb'),auth['isAuthenticated'](),controller[_0xbf25('0x12')]);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 c72474d..47c58b4 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 _0xc660=['exports','name','STRING','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc660,0x1d3));var _0x0c66=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc660[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0c66('0x0'));module[_0x0c66('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0c66('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0c66('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1fd7=['exports','STRING','name','sequelize'];(function(_0x4921e9,_0x1057a6){var _0xeac7ae=function(_0x46b668){while(--_0x46b668){_0x4921e9['push'](_0x4921e9['shift']());}};_0xeac7ae(++_0x1057a6);}(_0x1fd7,0xd3));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x71fd('0x0'));module[_0x71fd('0x1')]={'name':{'type':Sequelize[_0x71fd('0x2')],'unique':_0x71fd('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x71fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 193946d..8a60fbc 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 _0x313e=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','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','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','util','path','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','offset'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x313e,0xf1));var _0xe313=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x313e[_0x3cb09b];return _0x242048;};'use strict';var emlformat=require(_0xe313('0x0'));var rimraf=require(_0xe313('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe313('0x2'));var rp=require(_0xe313('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe313('0x4'));var path=require(_0xe313('0x5'));var sox=require(_0xe313('0x6'));var csv=require(_0xe313('0x7'));var ejs=require(_0xe313('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe313('0x9'));var squel=require(_0xe313('0xa'));var crypto=require(_0xe313('0xb'));var jsforce=require(_0xe313('0xc'));var deskjs=require(_0xe313('0xd'));var toCsv=require(_0xe313('0x7'));var querystring=require('querystring');var Papa=require(_0xe313('0xe'));var Redis=require(_0xe313('0xf'));var authService=require(_0xe313('0x10'));var qs=require(_0xe313('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe313('0x12'));var logger=require(_0xe313('0x13'))(_0xe313('0x14'));var utils=require(_0xe313('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe313('0x16'));var db=require(_0xe313('0x17'))['db'];function respondWithStatusCode(_0x7d6350,_0x55d392){_0x55d392=_0x55d392||0xcc;return function(_0x3f061f){if(_0x3f061f){return _0x7d6350[_0xe313('0x18')](_0x55d392);}return _0x7d6350[_0xe313('0x19')](_0x55d392)[_0xe313('0x1a')]();};}function respondWithResult(_0x45b0fa,_0xafc641){_0xafc641=_0xafc641||0xc8;return function(_0x13e7b4){if(_0x13e7b4){return _0x45b0fa['status'](_0xafc641)[_0xe313('0x1b')](_0x13e7b4);}};}function respondWithFilteredResult(_0x4fbeaa,_0x35902d){return function(_0x1df563){if(_0x1df563){var _0x1d7694=typeof _0x35902d[_0xe313('0x1c')]===_0xe313('0x1d')&&typeof _0x35902d[_0xe313('0x1e')]===_0xe313('0x1d');var _0x271d73=_0x1df563[_0xe313('0x1f')];var _0x1d6e03=_0x1d7694?0x0:_0x35902d[_0xe313('0x1c')];var _0x9b2349=_0x1d7694?_0x1df563[_0xe313('0x1f')]:_0x35902d[_0xe313('0x1c')]+_0x35902d[_0xe313('0x1e')];var _0x230203;if(_0x9b2349>=_0x271d73){_0x9b2349=_0x271d73;_0x230203=0xc8;}else{_0x230203=0xce;}_0x4fbeaa[_0xe313('0x19')](_0x230203);return _0x4fbeaa[_0xe313('0x20')](_0xe313('0x21'),_0x1d6e03+'-'+_0x9b2349+'/'+_0x271d73)['json'](_0x1df563);}return null;};}function patchUpdates(_0x203604){return function(_0x50a521){try{jsonpatch[_0xe313('0x22')](_0x50a521,_0x203604,!![]);}catch(_0x139dab){return BPromise[_0xe313('0x23')](_0x139dab);}return _0x50a521[_0xe313('0x24')]();};}function saveUpdates(_0x5c5583,_0x11cd6a){return function(_0x5b233d){if(_0x5b233d){return _0x5b233d[_0xe313('0x25')](_0x5c5583)[_0xe313('0x26')](function(_0x143078){return _0x143078;});}return null;};}function removeEntity(_0x41d55a,_0x149795){return function(_0x5c3acb){if(_0x5c3acb){return _0x5c3acb[_0xe313('0x27')]()[_0xe313('0x26')](function(){var _0x5e574f=_0x5c3acb[_0xe313('0x28')]({'plain':!![]});var _0x2f1b9d=_0xe313('0x29');return db[_0xe313('0x2a')][_0xe313('0x27')]({'where':{'type':_0x2f1b9d,'resourceId':_0x5e574f['id']}})[_0xe313('0x26')](function(){return _0x5c3acb;});})[_0xe313('0x26')](function(){_0x41d55a[_0xe313('0x19')](0xcc)[_0xe313('0x1a')]();});}};}function handleEntityNotFound(_0xe0bdd9,_0x5ee079){return function(_0x52475b){if(!_0x52475b){_0xe0bdd9[_0xe313('0x18')](0x194);}return _0x52475b;};}function handleError(_0xe6f1a8,_0x27d59e){_0x27d59e=_0x27d59e||0x1f4;return function(_0x3ce9c3){logger[_0xe313('0x2b')](_0x3ce9c3['stack']);if(_0x3ce9c3[_0xe313('0x2c')]){delete _0x3ce9c3[_0xe313('0x2c')];}_0xe6f1a8[_0xe313('0x19')](_0x27d59e)[_0xe313('0x2d')](_0x3ce9c3);};}exports[_0xe313('0x2e')]=function(_0x2d16e3,_0x459c4e){var _0x4d5eaa={},_0x191ab1={},_0x4435e2={'count':0x0,'rows':[]};var _0x178171=_['map'](db[_0xe313('0x2f')][_0xe313('0x30')],function(_0x3788a0){return{'name':_0x3788a0[_0xe313('0x31')],'type':_0x3788a0[_0xe313('0x32')][_0xe313('0x33')]};});_0x191ab1['model']=_[_0xe313('0x34')](_0x178171,'name');_0x191ab1['query']=_[_0xe313('0x35')](_0x2d16e3[_0xe313('0x36')]);_0x191ab1[_0xe313('0x37')]=_['intersection'](_0x191ab1[_0xe313('0x38')],_0x191ab1['query']);_0x4d5eaa[_0xe313('0x39')]=_[_0xe313('0x3a')](_0x191ab1[_0xe313('0x38')],qs['fields'](_0x2d16e3[_0xe313('0x36')][_0xe313('0x3b')]));_0x4d5eaa[_0xe313('0x39')]=_0x4d5eaa[_0xe313('0x39')][_0xe313('0x3c')]?_0x4d5eaa[_0xe313('0x39')]:_0x191ab1['model'];if(!_0x2d16e3['query'][_0xe313('0x3d')](_0xe313('0x3e'))){_0x4d5eaa[_0xe313('0x1e')]=qs['limit'](_0x2d16e3['query'][_0xe313('0x1e')]);_0x4d5eaa['offset']=qs[_0xe313('0x1c')](_0x2d16e3[_0xe313('0x36')]['offset']);}_0x4d5eaa[_0xe313('0x3f')]=qs[_0xe313('0x40')](_0x2d16e3[_0xe313('0x36')]['sort']);_0x4d5eaa[_0xe313('0x41')]=qs[_0xe313('0x37')](_[_0xe313('0x42')](_0x2d16e3['query'],_0x191ab1[_0xe313('0x37')]),_0x178171);if(_0x2d16e3['query']['filter']){_0x4d5eaa['where']=_[_0xe313('0x43')](_0x4d5eaa[_0xe313('0x41')],{'$or':_[_0xe313('0x34')](_0x178171,function(_0x5bd5d8){if(_0x5bd5d8[_0xe313('0x32')]!=='VIRTUAL'){var _0x237338={};_0x237338[_0x5bd5d8[_0xe313('0x2c')]]={'$like':'%'+_0x2d16e3['query'][_0xe313('0x44')]+'%'};return _0x237338;}})});}_0x4d5eaa=_['merge']({},_0x4d5eaa,_0x2d16e3[_0xe313('0x45')]);var _0x3afc3b={'where':_0x4d5eaa['where']};return db[_0xe313('0x2f')]['count'](_0x3afc3b)[_0xe313('0x26')](function(_0x836855){_0x4435e2[_0xe313('0x1f')]=_0x836855;if(_0x2d16e3[_0xe313('0x36')][_0xe313('0x46')]){_0x4d5eaa[_0xe313('0x47')]=[{'all':!![]}];}return db[_0xe313('0x2f')]['findAll'](_0x4d5eaa);})[_0xe313('0x26')](function(_0x1b7b92){_0x4435e2['rows']=_0x1b7b92;return _0x4435e2;})[_0xe313('0x26')](respondWithFilteredResult(_0x459c4e,_0x4d5eaa))[_0xe313('0x48')](handleError(_0x459c4e,null));};exports[_0xe313('0x49')]=function(_0x43721e,_0x550bba){var _0x54a306={'raw':!![],'where':{'id':_0x43721e[_0xe313('0x4a')]['id']}},_0x2b9614={};_0x2b9614[_0xe313('0x38')]=_[_0xe313('0x35')](db['SquareOdbc'][_0xe313('0x30')]);_0x2b9614[_0xe313('0x36')]=_[_0xe313('0x35')](_0x43721e[_0xe313('0x36')]);_0x2b9614[_0xe313('0x37')]=_[_0xe313('0x3a')](_0x2b9614[_0xe313('0x38')],_0x2b9614['query']);_0x54a306[_0xe313('0x39')]=_[_0xe313('0x3a')](_0x2b9614[_0xe313('0x38')],qs[_0xe313('0x3b')](_0x43721e[_0xe313('0x36')][_0xe313('0x3b')]));_0x54a306['attributes']=_0x54a306[_0xe313('0x39')][_0xe313('0x3c')]?_0x54a306[_0xe313('0x39')]:_0x2b9614['model'];if(_0x43721e[_0xe313('0x36')][_0xe313('0x46')]){_0x54a306[_0xe313('0x47')]=[{'all':!![]}];}_0x54a306=_[_0xe313('0x43')]({},_0x54a306,_0x43721e[_0xe313('0x45')]);return db[_0xe313('0x2f')]['find'](_0x54a306)[_0xe313('0x26')](handleEntityNotFound(_0x550bba,null))[_0xe313('0x26')](respondWithResult(_0x550bba,null))[_0xe313('0x48')](handleError(_0x550bba,null));};exports[_0xe313('0x4b')]=function(_0x2a32e1,_0x512a17){return db[_0xe313('0x2f')]['create'](_0x2a32e1[_0xe313('0x4c')],{})[_0xe313('0x26')](function(_0x4f6be9){var _0x1c4ab0=_0x2a32e1[_0xe313('0x4d')]['get']({'plain':!![]});if(!_0x1c4ab0)throw new Error(_0xe313('0x4e'));if(_0x1c4ab0[_0xe313('0x4f')]===_0xe313('0x4d')){var _0xe86e1e=_0x4f6be9[_0xe313('0x28')]({'plain':!![]});var _0x64a513=_0xe313('0x29');return db[_0xe313('0x50')][_0xe313('0x51')]({'where':{'name':_0x64a513,'userProfileId':_0x1c4ab0[_0xe313('0x52')]},'raw':!![]})[_0xe313('0x26')](function(_0x4a2b4d){if(_0x4a2b4d&&_0x4a2b4d[_0xe313('0x53')]===0x0){return db['UserProfileResource'][_0xe313('0x4b')]({'name':_0xe86e1e[_0xe313('0x2c')],'resourceId':_0xe86e1e['id'],'type':_0x4a2b4d[_0xe313('0x2c')],'sectionId':_0x4a2b4d['id']},{})[_0xe313('0x26')](function(){return _0x4f6be9;});}else{return _0x4f6be9;}})[_0xe313('0x48')](function(_0x4d01f4){logger[_0xe313('0x2b')](_0xe313('0x54'),_0x4d01f4);throw _0x4d01f4;});}return _0x4f6be9;})['then'](respondWithResult(_0x512a17,0xc9))['catch'](handleError(_0x512a17,null));};exports[_0xe313('0x25')]=function(_0x5252e4,_0x392755){if(_0x5252e4[_0xe313('0x4c')]['id']){delete _0x5252e4['body']['id'];}return db[_0xe313('0x2f')][_0xe313('0x51')]({'where':{'id':_0x5252e4[_0xe313('0x4a')]['id']}})[_0xe313('0x26')](handleEntityNotFound(_0x392755,null))[_0xe313('0x26')](saveUpdates(_0x5252e4['body'],null))[_0xe313('0x26')](respondWithResult(_0x392755,null))[_0xe313('0x48')](handleError(_0x392755,null));};exports[_0xe313('0x27')]=function(_0x82c379,_0x3a6c27){return db[_0xe313('0x2f')][_0xe313('0x51')]({'where':{'id':_0x82c379[_0xe313('0x4a')]['id']}})[_0xe313('0x26')](handleEntityNotFound(_0x3a6c27,null))[_0xe313('0x26')](removeEntity(_0x3a6c27,null))[_0xe313('0x48')](handleError(_0x3a6c27,null));};exports[_0xe313('0x55')]=function(_0x2c42d6,_0x57c9eb,_0x641277){var _0x3455e3;return db['SquareOdbc'][_0xe313('0x51')]({'where':{'id':_0x2c42d6[_0xe313('0x4a')]['id']},'attributes':['id',_0xe313('0x56')]})['then'](handleEntityNotFound(_0x57c9eb,null))[_0xe313('0x26')](function(_0xd94141){if(_0xd94141){var _0xd49c67=require(_0xe313('0x57'))();_0xd49c67[_0xe313('0x58')](_0xd94141[_0xe313('0x56')]);_0xd49c67[_0xe313('0x59')]();return _0xd94141;}})[_0xe313('0x26')](respondWithResult(_0x57c9eb,null))[_0xe313('0x48')](handleError(_0x57c9eb,null));}; \ No newline at end of file +var _0xd255=['order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','test','odbc','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xd255,0x1b8));var _0x5d25=function(_0x288c79,_0x224de5){_0x288c79=_0x288c79-0x0;var _0x4e92d6=_0xd255[_0x288c79];return _0x4e92d6;};'use strict';var emlformat=require(_0x5d25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d25('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d25('0x2'));var moment=require(_0x5d25('0x3'));var BPromise=require(_0x5d25('0x4'));var Mustache=require(_0x5d25('0x5'));var util=require(_0x5d25('0x6'));var path=require(_0x5d25('0x7'));var sox=require('sox');var csv=require(_0x5d25('0x8'));var ejs=require(_0x5d25('0x9'));var fs=require('fs');var fs_extra=require(_0x5d25('0xa'));var _=require('lodash');var squel=require(_0x5d25('0xb'));var crypto=require(_0x5d25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5d25('0xd'));var toCsv=require(_0x5d25('0x8'));var querystring=require(_0x5d25('0xe'));var Papa=require(_0x5d25('0xf'));var Redis=require(_0x5d25('0x10'));var authService=require(_0x5d25('0x11'));var qs=require(_0x5d25('0x12'));var as=require(_0x5d25('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d25('0x14'));var utils=require(_0x5d25('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5d25('0x16'));var db=require(_0x5d25('0x17'))['db'];function respondWithStatusCode(_0x3498e9,_0x181b0a){_0x181b0a=_0x181b0a||0xcc;return function(_0x108384){if(_0x108384){return _0x3498e9[_0x5d25('0x18')](_0x181b0a);}return _0x3498e9[_0x5d25('0x19')](_0x181b0a)[_0x5d25('0x1a')]();};}function respondWithResult(_0x25e50f,_0x1d788f){_0x1d788f=_0x1d788f||0xc8;return function(_0x44b479){if(_0x44b479){return _0x25e50f['status'](_0x1d788f)[_0x5d25('0x1b')](_0x44b479);}};}function respondWithFilteredResult(_0x2d0103,_0x40533b){return function(_0x5eccf9){if(_0x5eccf9){var _0x2b2d55=typeof _0x40533b[_0x5d25('0x1c')]===_0x5d25('0x1d')&&typeof _0x40533b[_0x5d25('0x1e')]===_0x5d25('0x1d');var _0x549f09=_0x5eccf9[_0x5d25('0x1f')];var _0x30eed4=_0x2b2d55?0x0:_0x40533b['offset'];var _0x2a16d1=_0x2b2d55?_0x5eccf9[_0x5d25('0x1f')]:_0x40533b[_0x5d25('0x1c')]+_0x40533b[_0x5d25('0x1e')];var _0x39a894;if(_0x2a16d1>=_0x549f09){_0x2a16d1=_0x549f09;_0x39a894=0xc8;}else{_0x39a894=0xce;}_0x2d0103[_0x5d25('0x19')](_0x39a894);return _0x2d0103[_0x5d25('0x20')]('Content-Range',_0x30eed4+'-'+_0x2a16d1+'/'+_0x549f09)[_0x5d25('0x1b')](_0x5eccf9);}return null;};}function patchUpdates(_0x48ba36){return function(_0x580d2b){try{jsonpatch[_0x5d25('0x21')](_0x580d2b,_0x48ba36,!![]);}catch(_0x367548){return BPromise['reject'](_0x367548);}return _0x580d2b['save']();};}function saveUpdates(_0x5b5cf4,_0x211549){return function(_0x333158){if(_0x333158){return _0x333158[_0x5d25('0x22')](_0x5b5cf4)[_0x5d25('0x23')](function(_0x59c1d4){return _0x59c1d4;});}return null;};}function removeEntity(_0x2f07c6,_0x2111b0){return function(_0x22f815){if(_0x22f815){return _0x22f815[_0x5d25('0x24')]()['then'](function(){var _0x378142=_0x22f815[_0x5d25('0x25')]({'plain':!![]});var _0x594d70=_0x5d25('0x26');return db[_0x5d25('0x27')][_0x5d25('0x24')]({'where':{'type':_0x594d70,'resourceId':_0x378142['id']}})[_0x5d25('0x23')](function(){return _0x22f815;});})[_0x5d25('0x23')](function(){_0x2f07c6[_0x5d25('0x19')](0xcc)[_0x5d25('0x1a')]();});}};}function handleEntityNotFound(_0x48ea06,_0x46e84f){return function(_0x4ecfdb){if(!_0x4ecfdb){_0x48ea06[_0x5d25('0x18')](0x194);}return _0x4ecfdb;};}function handleError(_0x5016d3,_0x4213c8){_0x4213c8=_0x4213c8||0x1f4;return function(_0xa972fb){logger[_0x5d25('0x28')](_0xa972fb[_0x5d25('0x29')]);if(_0xa972fb[_0x5d25('0x2a')]){delete _0xa972fb[_0x5d25('0x2a')];}_0x5016d3['status'](_0x4213c8)['send'](_0xa972fb);};}exports[_0x5d25('0x2b')]=function(_0x22370c,_0x54e2bd){var _0x2b99cb={},_0x5c9087={},_0x2b1872={'count':0x0,'rows':[]};var _0x2749cd=_[_0x5d25('0x2c')](db[_0x5d25('0x2d')][_0x5d25('0x2e')],function(_0x11d0db){return{'name':_0x11d0db[_0x5d25('0x2f')],'type':_0x11d0db[_0x5d25('0x30')][_0x5d25('0x31')]};});_0x5c9087['model']=_[_0x5d25('0x2c')](_0x2749cd,_0x5d25('0x2a'));_0x5c9087['query']=_[_0x5d25('0x32')](_0x22370c[_0x5d25('0x33')]);_0x5c9087[_0x5d25('0x34')]=_[_0x5d25('0x35')](_0x5c9087[_0x5d25('0x36')],_0x5c9087[_0x5d25('0x33')]);_0x2b99cb[_0x5d25('0x37')]=_[_0x5d25('0x35')](_0x5c9087[_0x5d25('0x36')],qs[_0x5d25('0x38')](_0x22370c[_0x5d25('0x33')]['fields']));_0x2b99cb[_0x5d25('0x37')]=_0x2b99cb[_0x5d25('0x37')][_0x5d25('0x39')]?_0x2b99cb[_0x5d25('0x37')]:_0x5c9087[_0x5d25('0x36')];if(!_0x22370c[_0x5d25('0x33')]['hasOwnProperty']('nolimit')){_0x2b99cb[_0x5d25('0x1e')]=qs['limit'](_0x22370c[_0x5d25('0x33')][_0x5d25('0x1e')]);_0x2b99cb[_0x5d25('0x1c')]=qs[_0x5d25('0x1c')](_0x22370c[_0x5d25('0x33')][_0x5d25('0x1c')]);}_0x2b99cb[_0x5d25('0x3a')]=qs['sort'](_0x22370c['query'][_0x5d25('0x3b')]);_0x2b99cb['where']=qs[_0x5d25('0x34')](_['pick'](_0x22370c[_0x5d25('0x33')],_0x5c9087[_0x5d25('0x34')]),_0x2749cd);if(_0x22370c[_0x5d25('0x33')][_0x5d25('0x3c')]){_0x2b99cb['where']=_['merge'](_0x2b99cb[_0x5d25('0x3d')],{'$or':_['map'](_0x2749cd,function(_0x3e473b){if(_0x3e473b['type']!==_0x5d25('0x3e')){var _0x35bc08={};_0x35bc08[_0x3e473b['name']]={'$like':'%'+_0x22370c['query']['filter']+'%'};return _0x35bc08;}})});}_0x2b99cb=_[_0x5d25('0x3f')]({},_0x2b99cb,_0x22370c[_0x5d25('0x40')]);var _0x122ea8={'where':_0x2b99cb[_0x5d25('0x3d')]};return db['SquareOdbc'][_0x5d25('0x1f')](_0x122ea8)[_0x5d25('0x23')](function(_0x55ad5f){_0x2b1872[_0x5d25('0x1f')]=_0x55ad5f;if(_0x22370c[_0x5d25('0x33')]['includeAll']){_0x2b99cb[_0x5d25('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x5d25('0x42')](_0x2b99cb);})['then'](function(_0x4c8733){_0x2b1872[_0x5d25('0x43')]=_0x4c8733;return _0x2b1872;})['then'](respondWithFilteredResult(_0x54e2bd,_0x2b99cb))[_0x5d25('0x44')](handleError(_0x54e2bd,null));};exports[_0x5d25('0x45')]=function(_0x1b0b6a,_0x88fc33){var _0x339f00={'raw':!![],'where':{'id':_0x1b0b6a[_0x5d25('0x46')]['id']}},_0x4bc365={};_0x4bc365['model']=_['keys'](db[_0x5d25('0x2d')][_0x5d25('0x2e')]);_0x4bc365['query']=_[_0x5d25('0x32')](_0x1b0b6a[_0x5d25('0x33')]);_0x4bc365[_0x5d25('0x34')]=_[_0x5d25('0x35')](_0x4bc365[_0x5d25('0x36')],_0x4bc365[_0x5d25('0x33')]);_0x339f00['attributes']=_[_0x5d25('0x35')](_0x4bc365[_0x5d25('0x36')],qs['fields'](_0x1b0b6a['query'][_0x5d25('0x38')]));_0x339f00[_0x5d25('0x37')]=_0x339f00[_0x5d25('0x37')][_0x5d25('0x39')]?_0x339f00['attributes']:_0x4bc365[_0x5d25('0x36')];if(_0x1b0b6a[_0x5d25('0x33')][_0x5d25('0x47')]){_0x339f00[_0x5d25('0x41')]=[{'all':!![]}];}_0x339f00=_['merge']({},_0x339f00,_0x1b0b6a['options']);return db[_0x5d25('0x2d')][_0x5d25('0x48')](_0x339f00)['then'](handleEntityNotFound(_0x88fc33,null))[_0x5d25('0x23')](respondWithResult(_0x88fc33,null))[_0x5d25('0x44')](handleError(_0x88fc33,null));};exports[_0x5d25('0x49')]=function(_0x477946,_0xf31b19){return db[_0x5d25('0x2d')]['create'](_0x477946[_0x5d25('0x4a')],{})[_0x5d25('0x23')](function(_0x21f149){var _0x355de0=_0x477946[_0x5d25('0x4b')]['get']({'plain':!![]});if(!_0x355de0)throw new Error(_0x5d25('0x4c'));if(_0x355de0[_0x5d25('0x4d')]===_0x5d25('0x4b')){var _0xed2e4d=_0x21f149[_0x5d25('0x25')]({'plain':!![]});var _0x47d695='ODBC';return db[_0x5d25('0x4e')][_0x5d25('0x48')]({'where':{'name':_0x47d695,'userProfileId':_0x355de0[_0x5d25('0x4f')]},'raw':!![]})[_0x5d25('0x23')](function(_0x1dfffc){if(_0x1dfffc&&_0x1dfffc[_0x5d25('0x50')]===0x0){return db[_0x5d25('0x27')][_0x5d25('0x49')]({'name':_0xed2e4d[_0x5d25('0x2a')],'resourceId':_0xed2e4d['id'],'type':_0x1dfffc[_0x5d25('0x2a')],'sectionId':_0x1dfffc['id']},{})[_0x5d25('0x23')](function(){return _0x21f149;});}else{return _0x21f149;}})['catch'](function(_0xd040){logger[_0x5d25('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd040);throw _0xd040;});}return _0x21f149;})[_0x5d25('0x23')](respondWithResult(_0xf31b19,0xc9))['catch'](handleError(_0xf31b19,null));};exports[_0x5d25('0x22')]=function(_0x1dd713,_0x18f93c){if(_0x1dd713['body']['id']){delete _0x1dd713['body']['id'];}return db[_0x5d25('0x2d')][_0x5d25('0x48')]({'where':{'id':_0x1dd713[_0x5d25('0x46')]['id']}})[_0x5d25('0x23')](handleEntityNotFound(_0x18f93c,null))[_0x5d25('0x23')](saveUpdates(_0x1dd713[_0x5d25('0x4a')],null))[_0x5d25('0x23')](respondWithResult(_0x18f93c,null))[_0x5d25('0x44')](handleError(_0x18f93c,null));};exports[_0x5d25('0x24')]=function(_0x634756,_0x2e746d){return db['SquareOdbc'][_0x5d25('0x48')]({'where':{'id':_0x634756[_0x5d25('0x46')]['id']}})[_0x5d25('0x23')](handleEntityNotFound(_0x2e746d,null))[_0x5d25('0x23')](removeEntity(_0x2e746d,null))[_0x5d25('0x44')](handleError(_0x2e746d,null));};exports[_0x5d25('0x51')]=function(_0x1f252a,_0x5ab02d,_0x312f93){var _0x1f2b01;return db[_0x5d25('0x2d')]['find']({'where':{'id':_0x1f252a[_0x5d25('0x46')]['id']},'attributes':['id','dsn']})[_0x5d25('0x23')](handleEntityNotFound(_0x5ab02d,null))[_0x5d25('0x23')](function(_0x47d0a2){if(_0x47d0a2){var _0x3b09d2=require(_0x5d25('0x52'))();_0x3b09d2['openSync'](_0x47d0a2['dsn']);_0x3b09d2['closeSync']();return _0x47d0a2;}})['then'](respondWithResult(_0x5ab02d,null))[_0x5d25('0x44')](handleError(_0x5ab02d,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a6ec995..80dbbfd 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 _0x00fc=['exports','define','SquareOdbc','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5d3cd1,_0x3cfaf8){var _0x5b02f0=function(_0x4dab51){while(--_0x4dab51){_0x5d3cd1['push'](_0x5d3cd1['shift']());}};_0x5b02f0(++_0x3cfaf8);}(_0x00fc,0x16e));var _0xc00f=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x00fc[_0x49052b];return _0x48c045;};'use strict';var _=require(_0xc00f('0x0'));var util=require(_0xc00f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc00f('0x2'));var rp=require(_0xc00f('0x3'));var fs=require('fs');var path=require(_0xc00f('0x4'));var rimraf=require(_0xc00f('0x5'));var config=require(_0xc00f('0x6'));var attributes=require(_0xc00f('0x7'));module[_0xc00f('0x8')]=function(_0x28aa9f,_0x43bf3d){return _0x28aa9f[_0xc00f('0x9')](_0xc00f('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f92=['../../config/logger','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util'];(function(_0x1fc712,_0x15864b){var _0x3a9bad=function(_0x12a3e2){while(--_0x12a3e2){_0x1fc712['push'](_0x1fc712['shift']());}};_0x3a9bad(++_0x15864b);}(_0x2f92,0x1d7));var _0x22f9=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x2f92[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x22f9('0x0'));var util=require(_0x22f9('0x1'));var logger=require(_0x22f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x22f9('0x3'));var rp=require(_0x22f9('0x4'));var fs=require('fs');var path=require(_0x22f9('0x5'));var rimraf=require('rimraf');var config=require(_0x22f9('0x6'));var attributes=require(_0x22f9('0x7'));module[_0x22f9('0x8')]=function(_0x194757,_0x1e73a6){return _0x194757[_0x22f9('0x9')]('SquareOdbc',attributes,{'tableName':_0x22f9('0xa'),'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 d268aaf..905aea3 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 _0x73d2=['request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','result','message','catch','find','options','attributes','include','model','map','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x5a5f02,_0x137314){var _0x3aeda6=function(_0x11e39b){while(--_0x11e39b){_0x5a5f02['push'](_0x5a5f02['shift']());}};_0x3aeda6(++_0x137314);}(_0x73d2,0xe5));var _0x273d=function(_0x1b55e9,_0x8dbcea){_0x1b55e9=_0x1b55e9-0x0;var _0x1aaa97=_0x73d2[_0x1b55e9];return _0x1aaa97;};'use strict';var _=require(_0x273d('0x0'));var util=require(_0x273d('0x1'));var moment=require(_0x273d('0x2'));var BPromise=require(_0x273d('0x3'));var rs=require(_0x273d('0x4'));var fs=require('fs');var Redis=require(_0x273d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x273d('0x6'))(_0x273d('0x7'));var config=require(_0x273d('0x8'));var jayson=require(_0x273d('0x9'));var client=jayson['client'][_0x273d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a5d07,_0x55a7f5,_0x3998ed){return new BPromise(function(_0x33700c,_0x30ebb4){return client[_0x273d('0xb')](_0x5a5d07,_0x3998ed)[_0x273d('0xc')](function(_0x4dabb0){logger[_0x273d('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x55a7f5,_0x273d('0xe'));logger[_0x273d('0xf')](_0x273d('0x10'),_0x55a7f5,_0x273d('0xe'),JSON['stringify'](_0x4dabb0));if(_0x4dabb0[_0x273d('0x11')]){if(_0x4dabb0[_0x273d('0x11')][_0x273d('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x55a7f5,_0x4dabb0['error']['message']);return _0x30ebb4(_0x4dabb0[_0x273d('0x11')]['message']);}logger[_0x273d('0x11')](_0x273d('0x13'),_0x55a7f5,_0x4dabb0[_0x273d('0x11')]['message']);return _0x33700c(_0x4dabb0[_0x273d('0x11')]['message']);}else{logger[_0x273d('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x55a7f5,'request\x20sent');_0x33700c(_0x4dabb0[_0x273d('0x14')][_0x273d('0x15')]);}})[_0x273d('0x16')](function(_0x49e3ed){logger[_0x273d('0x11')](_0x273d('0x13'),_0x55a7f5,_0x49e3ed);_0x30ebb4(_0x49e3ed);});});}exports['ShowSquareOdbc']=function(_0x13350d){var _0x130f78=this;return new Promise(function(_0x335d76,_0x3eb719){return db['SquareOdbc'][_0x273d('0x17')]({'raw':_0x13350d['options']?_0x13350d['options']['raw']===undefined?!![]:![]:!![],'where':_0x13350d[_0x273d('0x18')]?_0x13350d[_0x273d('0x18')]['where']||null:null,'attributes':_0x13350d[_0x273d('0x18')]?_0x13350d['options'][_0x273d('0x19')]||null:null,'include':_0x13350d[_0x273d('0x18')]?_0x13350d[_0x273d('0x18')][_0x273d('0x1a')]?_['map'](_0x13350d['options']['include'],function(_0xfadd2c){return{'model':db[_0xfadd2c[_0x273d('0x1b')]],'as':_0xfadd2c['as'],'attributes':_0xfadd2c[_0x273d('0x19')],'include':_0xfadd2c[_0x273d('0x1a')]?_[_0x273d('0x1c')](_0xfadd2c['include'],function(_0x9184d1){return{'model':db[_0x9184d1[_0x273d('0x1b')]],'as':_0x9184d1['as'],'attributes':_0x9184d1[_0x273d('0x19')],'include':_0x9184d1[_0x273d('0x1a')]?_['map'](_0x9184d1[_0x273d('0x1a')],function(_0x5cfc74){return{'model':db[_0x5cfc74['model']],'as':_0x5cfc74['as'],'attributes':_0x5cfc74[_0x273d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x273d('0xc')](function(_0x4b28a0){logger[_0x273d('0xd')](_0x273d('0x1d'),_0x13350d);logger[_0x273d('0xf')](_0x273d('0x1d'),_0x13350d,JSON['stringify'](_0x4b28a0));_0x335d76(_0x4b28a0);})[_0x273d('0x16')](function(_0xe207e7){logger[_0x273d('0x11')](_0x273d('0x1d'),_0xe207e7[_0x273d('0x15')],_0x13350d);_0x3eb719(_0x130f78[_0x273d('0x11')](0x1f4,_0xe207e7[_0x273d('0x15')]));});});}; \ No newline at end of file +var _0xf6d3=['model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','map','include','attributes'];(function(_0x3ff8d7,_0x5b7891){var _0x1cb852=function(_0x27d096){while(--_0x27d096){_0x3ff8d7['push'](_0x3ff8d7['shift']());}};_0x1cb852(++_0x5b7891);}(_0xf6d3,0x85));var _0x3f6d=function(_0x3357b0,_0x252ea1){_0x3357b0=_0x3357b0-0x0;var _0x4826e8=_0xf6d3[_0x3357b0];return _0x4826e8;};'use strict';var _=require(_0x3f6d('0x0'));var util=require(_0x3f6d('0x1'));var moment=require(_0x3f6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f6d('0x3'));var fs=require('fs');var Redis=require(_0x3f6d('0x4'));var db=require(_0x3f6d('0x5'))['db'];var utils=require(_0x3f6d('0x6'));var logger=require('../../config/logger')(_0x3f6d('0x7'));var config=require(_0x3f6d('0x8'));var jayson=require(_0x3f6d('0x9'));var client=jayson[_0x3f6d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38624f,_0x5e0f0b,_0x370137){return new BPromise(function(_0x3352df,_0x578c70){return client[_0x3f6d('0xb')](_0x38624f,_0x370137)[_0x3f6d('0xc')](function(_0x4840d7){logger[_0x3f6d('0xd')](_0x3f6d('0xe'),_0x5e0f0b,'request\x20sent');logger[_0x3f6d('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x5e0f0b,_0x3f6d('0x10'),JSON[_0x3f6d('0x11')](_0x4840d7));if(_0x4840d7[_0x3f6d('0x12')]){if(_0x4840d7['error'][_0x3f6d('0x13')]===0x1f4){logger[_0x3f6d('0x12')](_0x3f6d('0xe'),_0x5e0f0b,_0x4840d7[_0x3f6d('0x12')][_0x3f6d('0x14')]);return _0x578c70(_0x4840d7[_0x3f6d('0x12')][_0x3f6d('0x14')]);}logger[_0x3f6d('0x12')](_0x3f6d('0xe'),_0x5e0f0b,_0x4840d7[_0x3f6d('0x12')][_0x3f6d('0x14')]);return _0x3352df(_0x4840d7[_0x3f6d('0x12')]['message']);}else{logger[_0x3f6d('0xd')](_0x3f6d('0xe'),_0x5e0f0b,_0x3f6d('0x10'));_0x3352df(_0x4840d7[_0x3f6d('0x15')]['message']);}})[_0x3f6d('0x16')](function(_0x502a80){logger[_0x3f6d('0x12')](_0x3f6d('0xe'),_0x5e0f0b,_0x502a80);_0x578c70(_0x502a80);});});}exports[_0x3f6d('0x17')]=function(_0x3c2b76){var _0x2a0aa1=this;return new Promise(function(_0x57af38,_0x4b5dc8){return db[_0x3f6d('0x18')][_0x3f6d('0x19')]({'raw':_0x3c2b76[_0x3f6d('0x1a')]?_0x3c2b76[_0x3f6d('0x1a')][_0x3f6d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c2b76[_0x3f6d('0x1a')]?_0x3c2b76['options'][_0x3f6d('0x1c')]||null:null,'attributes':_0x3c2b76[_0x3f6d('0x1a')]?_0x3c2b76[_0x3f6d('0x1a')]['attributes']||null:null,'include':_0x3c2b76[_0x3f6d('0x1a')]?_0x3c2b76[_0x3f6d('0x1a')]['include']?_[_0x3f6d('0x1d')](_0x3c2b76[_0x3f6d('0x1a')][_0x3f6d('0x1e')],function(_0x3106a3){return{'model':db[_0x3106a3['model']],'as':_0x3106a3['as'],'attributes':_0x3106a3[_0x3f6d('0x1f')],'include':_0x3106a3[_0x3f6d('0x1e')]?_[_0x3f6d('0x1d')](_0x3106a3[_0x3f6d('0x1e')],function(_0xdfd984){return{'model':db[_0xdfd984['model']],'as':_0xdfd984['as'],'attributes':_0xdfd984[_0x3f6d('0x1f')],'include':_0xdfd984[_0x3f6d('0x1e')]?_['map'](_0xdfd984[_0x3f6d('0x1e')],function(_0x47a67c){return{'model':db[_0x47a67c[_0x3f6d('0x20')]],'as':_0x47a67c['as'],'attributes':_0x47a67c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f6d('0xc')](function(_0x52c394){logger['info'](_0x3f6d('0x17'),_0x3c2b76);logger[_0x3f6d('0xf')](_0x3f6d('0x17'),_0x3c2b76,JSON['stringify'](_0x52c394));_0x57af38(_0x52c394);})[_0x3f6d('0x16')](function(_0x2419d1){logger[_0x3f6d('0x12')]('ShowSquareOdbc',_0x2419d1[_0x3f6d('0x14')],_0x3c2b76);_0x4b5dc8(_0x2a0aa1[_0x3f6d('0x12')](0x1f4,_0x2419d1[_0x3f6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d198e49..4df05f7 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 _0xfb4c=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xfb4c,0x1ef));var _0xcfb4=function(_0x523a0b,_0x56cd04){_0x523a0b=_0x523a0b-0x0;var _0x47284a=_0xfb4c[_0x523a0b];return _0x47284a;};'use strict';var multer=require(_0xcfb4('0x0'));var util=require(_0xcfb4('0x1'));var path=require(_0xcfb4('0x2'));var timeout=require('connect-timeout');var express=require(_0xcfb4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcfb4('0x4'));var config=require(_0xcfb4('0x5'));var controller=require(_0xcfb4('0x6'));router['get']('/',auth[_0xcfb4('0x7')](),controller['index']);router[_0xcfb4('0x8')](_0xcfb4('0x9'),auth[_0xcfb4('0x7')](),controller[_0xcfb4('0xa')]);router[_0xcfb4('0xb')]('/',auth[_0xcfb4('0x7')](),controller[_0xcfb4('0xc')]);router[_0xcfb4('0xd')]('/:id',auth[_0xcfb4('0x7')](),controller[_0xcfb4('0xe')]);router[_0xcfb4('0xf')](_0xcfb4('0x9'),auth['isAuthenticated'](),controller[_0xcfb4('0x10')]);module[_0xcfb4('0x11')]=router; \ No newline at end of file +var _0x82ce=['isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x5c3df9,_0x88ad80){var _0x3d113a=function(_0x5ca188){while(--_0x5ca188){_0x5c3df9['push'](_0x5c3df9['shift']());}};_0x3d113a(++_0x88ad80);}(_0x82ce,0xcf));var _0xe82c=function(_0x41b4e0,_0x1911cb){_0x41b4e0=_0x41b4e0-0x0;var _0x5a124c=_0x82ce[_0x41b4e0];return _0x5a124c;};'use strict';var multer=require('multer');var util=require(_0xe82c('0x0'));var path=require(_0xe82c('0x1'));var timeout=require(_0xe82c('0x2'));var express=require('express');var router=express[_0xe82c('0x3')]();var fs_extra=require(_0xe82c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe82c('0x5'));var config=require(_0xe82c('0x6'));var controller=require(_0xe82c('0x7'));router[_0xe82c('0x8')]('/',auth[_0xe82c('0x9')](),controller['index']);router[_0xe82c('0x8')]('/:id',auth[_0xe82c('0x9')](),controller[_0xe82c('0xa')]);router[_0xe82c('0xb')]('/',auth[_0xe82c('0x9')](),controller['create']);router[_0xe82c('0xc')](_0xe82c('0xd'),auth[_0xe82c('0x9')](),controller[_0xe82c('0xe')]);router[_0xe82c('0xf')](_0xe82c('0xd'),auth[_0xe82c('0x9')](),controller[_0xe82c('0x10')]);module[_0xe82c('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a6f6091..745ab39 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 _0xc06a=['utf8','DATE','sequelize','exports','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x1e111a,_0x3a70df){var _0xac21b7=function(_0x108d99){while(--_0x108d99){_0x1e111a['push'](_0x1e111a['shift']());}};_0xac21b7(++_0x3a70df);}(_0xc06a,0x1be));var _0xac06=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc06a[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xac06('0x0'));module[_0xac06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac06('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xac06('0x3')]},'preproduction':{'type':Sequelize[_0xac06('0x4')](_0xac06('0x5')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xac06('0x6')](_0xac06('0x7'))[_0xac06('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xac06('0x5')),'get':function(){if(this['getDataValue'](_0xac06('0x9'))){return this['getDataValue']('production')[_0xac06('0x8')](_0xac06('0xa'));}}},'savedAt':{'type':Sequelize[_0xac06('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xa99b=['BLOB','production','toString','DATE','sequelize','STRING','TEXT','long','getDataValue','preproduction','utf8'];(function(_0x388666,_0x46f126){var _0x3fca0b=function(_0x2a09ce){while(--_0x2a09ce){_0x388666['push'](_0x388666['shift']());}};_0x3fca0b(++_0x46f126);}(_0xa99b,0x1f3));var _0xba99=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa99b[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xba99('0x0'));module['exports']={'name':{'type':Sequelize[_0xba99('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xba99('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0xba99('0x3')),'get':function(){if(this[_0xba99('0x4')](_0xba99('0x5'))){return this[_0xba99('0x4')](_0xba99('0x5'))['toString'](_0xba99('0x6'));}}},'production':{'type':Sequelize[_0xba99('0x7')]('long'),'get':function(){if(this['getDataValue'](_0xba99('0x8'))){return this[_0xba99('0x4')]('production')[_0xba99('0x9')](_0xba99('0x6'));}}},'savedAt':{'type':Sequelize[_0xba99('0xa')]},'publishedAt':{'type':Sequelize[_0xba99('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 4a15663..3d6cb20 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 _0x352b=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish','agi','stringify','error','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','create'];(function(_0x40ab41,_0x5d535e){var _0x36962d=function(_0x3300e7){while(--_0x3300e7){_0x40ab41['push'](_0x40ab41['shift']());}};_0x36962d(++_0x5d535e);}(_0x352b,0x1a0));var _0xb352=function(_0x5e24cc,_0x3b5b47){_0x5e24cc=_0x5e24cc-0x0;var _0x292423=_0x352b[_0x5e24cc];return _0x292423;};'use strict';var _=require(_0xb352('0x0'));var Redis=require(_0xb352('0x1'));var qs=require(_0xb352('0x2'));var logger=require('../../config/logger')(_0xb352('0x3'));var config=require(_0xb352('0x4'));var db=require(_0xb352('0x5'))['db'];config[_0xb352('0x6')]=_[_0xb352('0x7')](config[_0xb352('0x6')],{'host':_0xb352('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb352('0x6')]));require(_0xb352('0x9'))[_0xb352('0xa')](socket);function respondWithResult(_0x4828d0,_0x27dfd9){_0x27dfd9=_0x27dfd9||0xc8;return function(_0x2a2ae5){if(_0x2a2ae5){return _0x4828d0[_0xb352('0xb')](_0x27dfd9)[_0xb352('0xc')](_0x2a2ae5);}};}function respondWithFilteredResult(_0x454505,_0x110939){return function(_0x31c76a){if(_0x31c76a){var _0x56ac5c=typeof _0x110939[_0xb352('0xd')]===_0xb352('0xe')&&typeof _0x110939['limit']===_0xb352('0xe');var _0x482df7=_0x31c76a['count'];var _0x31a110=_0x56ac5c?0x0:_0x110939[_0xb352('0xd')];var _0x5c37d2=_0x56ac5c?_0x31c76a[_0xb352('0xf')]:_0x110939[_0xb352('0xd')]+_0x110939[_0xb352('0x10')];var _0x3a6e3c;if(_0x5c37d2>=_0x482df7){_0x5c37d2=_0x482df7;_0x3a6e3c=0xc8;}else{_0x3a6e3c=0xce;}_0x454505[_0xb352('0xb')](_0x3a6e3c);return _0x454505[_0xb352('0x11')](_0xb352('0x12'),_0x31a110+'-'+_0x5c37d2+'/'+_0x482df7)[_0xb352('0xc')](_0x31c76a);}return null;};}function saveUpdates(_0x3289f1){return function(_0x520bd0){if(_0x520bd0){return _0x520bd0[_0xb352('0x13')](_0x3289f1)['then'](function(_0x2e0b44){return _0x2e0b44;});}return null;};}function removeEntity(_0x5c8f08){return function(_0x4e8cd9){if(_0x4e8cd9){return _0x4e8cd9[_0xb352('0x14')]()[_0xb352('0x15')](function(){var _0x3edb7f=_0x4e8cd9[_0xb352('0x16')]({'plain':!![]});var _0x43627a=_0xb352('0x17');return db[_0xb352('0x18')]['destroy']({'where':{'type':_0x43627a,'resourceId':_0x3edb7f['id']}})[_0xb352('0x15')](function(){return _0x4e8cd9;});})[_0xb352('0x15')](function(){var _0x2b4e35=new Redis(config[_0xb352('0x6')]);_0x2b4e35[_0xb352('0x19')](_0xb352('0x1a'),JSON[_0xb352('0x1b')]({'id':_0x4e8cd9['id'],'deleted':!![]}));})[_0xb352('0x15')](function(){_0x5c8f08['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a2af){return function(_0x566d3f){if(!_0x566d3f){_0x32a2af['sendStatus'](0x194);}return _0x566d3f;};}function handleError(_0x3979ec,_0x2c0e1c){_0x2c0e1c=_0x2c0e1c||0x1f4;return function(_0x2f9be9){logger[_0xb352('0x1c')](_0x2f9be9['stack']);if(_0x2f9be9[_0xb352('0x1d')]){delete _0x2f9be9[_0xb352('0x1d')];}_0x3979ec[_0xb352('0xb')](_0x2c0e1c)[_0xb352('0x1e')](_0x2f9be9);};}exports[_0xb352('0x1f')]=function(_0x3f65d4,_0x5ba055){var _0x19d14d={},_0x4755ed={},_0x1390e3={'count':0x0,'rows':[]};var _0x1fa3e3=_['map'](db[_0xb352('0x20')][_0xb352('0x21')],function(_0xa80d2){return{'name':_0xa80d2[_0xb352('0x22')],'type':_0xa80d2[_0xb352('0x23')][_0xb352('0x24')]};});_0x4755ed[_0xb352('0x25')]=_['map'](_0x1fa3e3,_0xb352('0x1d'));_0x4755ed['query']=_[_0xb352('0x26')](_0x3f65d4['query']);_0x4755ed[_0xb352('0x27')]=_[_0xb352('0x28')](_0x4755ed[_0xb352('0x25')],_0x4755ed[_0xb352('0x29')]);_0x19d14d['attributes']=_['intersection'](_0x4755ed[_0xb352('0x25')],qs['fields'](_0x3f65d4[_0xb352('0x29')][_0xb352('0x2a')]));_0x19d14d['attributes']=_0x19d14d[_0xb352('0x2b')]['length']?_0x19d14d[_0xb352('0x2b')]:_0x4755ed[_0xb352('0x25')];if(!_0x3f65d4[_0xb352('0x29')]['hasOwnProperty'](_0xb352('0x2c'))){_0x19d14d[_0xb352('0x10')]=qs[_0xb352('0x10')](_0x3f65d4['query'][_0xb352('0x10')]);_0x19d14d[_0xb352('0xd')]=qs[_0xb352('0xd')](_0x3f65d4['query'][_0xb352('0xd')]);}_0x19d14d[_0xb352('0x2d')]=qs[_0xb352('0x2e')](_0x3f65d4[_0xb352('0x29')][_0xb352('0x2e')]);_0x19d14d[_0xb352('0x2f')]=qs[_0xb352('0x27')](_[_0xb352('0x30')](_0x3f65d4[_0xb352('0x29')],_0x4755ed['filters']),_0x1fa3e3);if(_0x3f65d4[_0xb352('0x29')][_0xb352('0x31')]){_0x19d14d[_0xb352('0x2f')]=_[_0xb352('0x32')](_0x19d14d['where'],{'$or':_['map'](_0x1fa3e3,function(_0xffe34){if(_0xffe34[_0xb352('0x23')]!=='VIRTUAL'){var _0x9f3db8={};_0x9f3db8[_0xffe34[_0xb352('0x1d')]]={'$like':'%'+_0x3f65d4[_0xb352('0x29')]['filter']+'%'};return _0x9f3db8;}})});}_0x19d14d=_[_0xb352('0x32')]({},_0x19d14d,_0x3f65d4[_0xb352('0x33')]);var _0x52eac7={'where':_0x19d14d['where']};return db[_0xb352('0x20')]['count'](_0x52eac7)['then'](function(_0x180856){_0x1390e3[_0xb352('0xf')]=_0x180856;if(_0x3f65d4[_0xb352('0x29')][_0xb352('0x34')]){_0x19d14d[_0xb352('0x35')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x19d14d);})[_0xb352('0x15')](function(_0x532dc9){_0x1390e3[_0xb352('0x36')]=_0x532dc9;return _0x1390e3;})[_0xb352('0x15')](respondWithFilteredResult(_0x5ba055,_0x19d14d))[_0xb352('0x37')](handleError(_0x5ba055,null));};exports[_0xb352('0x38')]=function(_0x5085d8,_0x20481a){var _0x533e26={'raw':![],'where':{'id':_0x5085d8[_0xb352('0x39')]['id']}},_0x196ce5={};_0x196ce5['model']=_[_0xb352('0x26')](db[_0xb352('0x20')][_0xb352('0x21')]);_0x196ce5[_0xb352('0x29')]=_['keys'](_0x5085d8['query']);_0x196ce5[_0xb352('0x27')]=_[_0xb352('0x28')](_0x196ce5[_0xb352('0x25')],_0x196ce5[_0xb352('0x29')]);_0x533e26[_0xb352('0x2b')]=_['intersection'](_0x196ce5[_0xb352('0x25')],qs[_0xb352('0x2a')](_0x5085d8['query'][_0xb352('0x2a')]));_0x533e26[_0xb352('0x2b')]=_0x533e26[_0xb352('0x2b')][_0xb352('0x3a')]?_0x533e26['attributes']:_0x196ce5[_0xb352('0x25')];if(_0x5085d8[_0xb352('0x29')][_0xb352('0x34')]){_0x533e26[_0xb352('0x35')]=[{'all':!![]}];}_0x533e26=_['merge']({},_0x533e26,_0x5085d8['options']);return db['SquareProject']['find'](_0x533e26)[_0xb352('0x15')](handleEntityNotFound(_0x20481a,null))[_0xb352('0x15')](respondWithResult(_0x20481a,null))[_0xb352('0x37')](handleError(_0x20481a,null));};exports[_0xb352('0x3b')]=function(_0x4e21c2,_0x2685d0){return db[_0xb352('0x20')]['create'](_0x4e21c2[_0xb352('0x3c')],{})['then'](function(_0x498ab8){var _0x3a0eed=_0x4e21c2['user']['get']({'plain':!![]});if(!_0x3a0eed)throw new Error(_0xb352('0x3d'));if(_0x3a0eed[_0xb352('0x3e')]===_0xb352('0x3f')){var _0x276c57=_0x498ab8[_0xb352('0x16')]({'plain':!![]});var _0xc9484d='SquareProjects';return db[_0xb352('0x40')][_0xb352('0x41')]({'where':{'name':_0xc9484d,'userProfileId':_0x3a0eed['userProfileId']},'raw':!![]})[_0xb352('0x15')](function(_0x870f0c){if(_0x870f0c&&_0x870f0c[_0xb352('0x42')]===0x0){return db[_0xb352('0x18')][_0xb352('0x3b')]({'name':_0x276c57[_0xb352('0x1d')],'resourceId':_0x276c57['id'],'type':_0x870f0c[_0xb352('0x1d')],'sectionId':_0x870f0c['id']},{})[_0xb352('0x15')](function(){return _0x498ab8;});}else{return _0x498ab8;}})[_0xb352('0x37')](function(_0x24642e){logger[_0xb352('0x1c')](_0xb352('0x43'),_0x24642e);throw _0x24642e;});}return _0x498ab8;})[_0xb352('0x15')](respondWithResult(_0x2685d0,0xc9))[_0xb352('0x37')](handleError(_0x2685d0,null));};exports[_0xb352('0x13')]=function(_0x266890,_0x119c48){if(_0x266890[_0xb352('0x3c')]['id']){delete _0x266890[_0xb352('0x3c')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x266890['params']['id']}})[_0xb352('0x15')](handleEntityNotFound(_0x119c48,null))[_0xb352('0x15')](saveUpdates(_0x266890[_0xb352('0x3c')],null))['then'](function(_0x29b211){if(!_0x29b211)return;var _0x1a7c71=_0x29b211[_0xb352('0x16')]({'plain':!![]});return _0x1a7c71;})[_0xb352('0x15')](function(_0x5bb6ad){var _0x261a6e=new Redis(config[_0xb352('0x6')]);_0x261a6e[_0xb352('0x19')](_0xb352('0x1a'),JSON[_0xb352('0x1b')](_[_0xb352('0x30')](_0x5bb6ad,['id','name','production'])));return _0x5bb6ad;})['then'](respondWithResult(_0x119c48,null))[_0xb352('0x37')](handleError(_0x119c48,null));};exports[_0xb352('0x14')]=function(_0x45c50e,_0x7519c0){return db[_0xb352('0x20')]['find']({'where':{'id':_0x45c50e[_0xb352('0x39')]['id']}})[_0xb352('0x15')](handleEntityNotFound(_0x7519c0,null))[_0xb352('0x15')](removeEntity(_0x7519c0,null))[_0xb352('0x37')](handleError(_0x7519c0,null));}; \ No newline at end of file +var _0x1152=['stack','name','send','index','map','SquareProject','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','json','offset','undefined','limit','count','status','Content-Range','update','destroy','then','SquareProjects','publish','agi','stringify','end','sendStatus','error'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x1152,0x1a0));var _0x2115=function(_0x3159c0,_0x592776){_0x3159c0=_0x3159c0-0x0;var _0x12411f=_0x1152[_0x3159c0];return _0x12411f;};'use strict';var _=require(_0x2115('0x0'));var Redis=require(_0x2115('0x1'));var qs=require(_0x2115('0x2'));var logger=require(_0x2115('0x3'))(_0x2115('0x4'));var config=require('../../config/environment');var db=require(_0x2115('0x5'))['db'];config['redis']=_[_0x2115('0x6')](config[_0x2115('0x7')],{'host':_0x2115('0x8'),'port':0x18eb});var socket=require(_0x2115('0x9'))(new Redis(config[_0x2115('0x7')]));require('./squareProject.socket')[_0x2115('0xa')](socket);function respondWithResult(_0x55ca4d,_0x4dbee8){_0x4dbee8=_0x4dbee8||0xc8;return function(_0x3597f9){if(_0x3597f9){return _0x55ca4d['status'](_0x4dbee8)[_0x2115('0xb')](_0x3597f9);}};}function respondWithFilteredResult(_0x4f73d3,_0x25d91f){return function(_0x5e3dc4){if(_0x5e3dc4){var _0xe5ceef=typeof _0x25d91f[_0x2115('0xc')]===_0x2115('0xd')&&typeof _0x25d91f[_0x2115('0xe')]===_0x2115('0xd');var _0x1d6563=_0x5e3dc4['count'];var _0xcb8d4c=_0xe5ceef?0x0:_0x25d91f[_0x2115('0xc')];var _0x3663ba=_0xe5ceef?_0x5e3dc4[_0x2115('0xf')]:_0x25d91f['offset']+_0x25d91f[_0x2115('0xe')];var _0x200958;if(_0x3663ba>=_0x1d6563){_0x3663ba=_0x1d6563;_0x200958=0xc8;}else{_0x200958=0xce;}_0x4f73d3[_0x2115('0x10')](_0x200958);return _0x4f73d3['set'](_0x2115('0x11'),_0xcb8d4c+'-'+_0x3663ba+'/'+_0x1d6563)['json'](_0x5e3dc4);}return null;};}function saveUpdates(_0x1329b8){return function(_0x144561){if(_0x144561){return _0x144561[_0x2115('0x12')](_0x1329b8)['then'](function(_0x493b0b){return _0x493b0b;});}return null;};}function removeEntity(_0x5277e6){return function(_0x4e32dd){if(_0x4e32dd){return _0x4e32dd[_0x2115('0x13')]()[_0x2115('0x14')](function(){var _0x13c788=_0x4e32dd['get']({'plain':!![]});var _0x1e004d=_0x2115('0x15');return db['UserProfileResource'][_0x2115('0x13')]({'where':{'type':_0x1e004d,'resourceId':_0x13c788['id']}})[_0x2115('0x14')](function(){return _0x4e32dd;});})[_0x2115('0x14')](function(){var _0x5d86f5=new Redis(config[_0x2115('0x7')]);_0x5d86f5[_0x2115('0x16')](_0x2115('0x17'),JSON[_0x2115('0x18')]({'id':_0x4e32dd['id'],'deleted':!![]}));})[_0x2115('0x14')](function(){_0x5277e6[_0x2115('0x10')](0xcc)[_0x2115('0x19')]();});}};}function handleEntityNotFound(_0x5d2ec8){return function(_0xb255ba){if(!_0xb255ba){_0x5d2ec8[_0x2115('0x1a')](0x194);}return _0xb255ba;};}function handleError(_0x362b4c,_0xb3d452){_0xb3d452=_0xb3d452||0x1f4;return function(_0x445c8b){logger[_0x2115('0x1b')](_0x445c8b[_0x2115('0x1c')]);if(_0x445c8b['name']){delete _0x445c8b[_0x2115('0x1d')];}_0x362b4c[_0x2115('0x10')](_0xb3d452)[_0x2115('0x1e')](_0x445c8b);};}exports[_0x2115('0x1f')]=function(_0x56542e,_0x1d5bb2){var _0x3bcd5b={},_0xd9ac5d={},_0xff0ceb={'count':0x0,'rows':[]};var _0x5b90cc=_[_0x2115('0x20')](db[_0x2115('0x21')]['rawAttributes'],function(_0x2fdf6e){return{'name':_0x2fdf6e[_0x2115('0x22')],'type':_0x2fdf6e[_0x2115('0x23')][_0x2115('0x24')]};});_0xd9ac5d['model']=_['map'](_0x5b90cc,'name');_0xd9ac5d['query']=_[_0x2115('0x25')](_0x56542e[_0x2115('0x26')]);_0xd9ac5d[_0x2115('0x27')]=_[_0x2115('0x28')](_0xd9ac5d['model'],_0xd9ac5d[_0x2115('0x26')]);_0x3bcd5b['attributes']=_['intersection'](_0xd9ac5d[_0x2115('0x29')],qs[_0x2115('0x2a')](_0x56542e[_0x2115('0x26')][_0x2115('0x2a')]));_0x3bcd5b['attributes']=_0x3bcd5b[_0x2115('0x2b')][_0x2115('0x2c')]?_0x3bcd5b[_0x2115('0x2b')]:_0xd9ac5d[_0x2115('0x29')];if(!_0x56542e['query'][_0x2115('0x2d')](_0x2115('0x2e'))){_0x3bcd5b[_0x2115('0xe')]=qs['limit'](_0x56542e[_0x2115('0x26')][_0x2115('0xe')]);_0x3bcd5b[_0x2115('0xc')]=qs[_0x2115('0xc')](_0x56542e[_0x2115('0x26')][_0x2115('0xc')]);}_0x3bcd5b[_0x2115('0x2f')]=qs[_0x2115('0x30')](_0x56542e[_0x2115('0x26')][_0x2115('0x30')]);_0x3bcd5b['where']=qs[_0x2115('0x27')](_[_0x2115('0x31')](_0x56542e[_0x2115('0x26')],_0xd9ac5d['filters']),_0x5b90cc);if(_0x56542e[_0x2115('0x26')]['filter']){_0x3bcd5b[_0x2115('0x32')]=_['merge'](_0x3bcd5b[_0x2115('0x32')],{'$or':_[_0x2115('0x20')](_0x5b90cc,function(_0x1a0b4d){if(_0x1a0b4d[_0x2115('0x23')]!==_0x2115('0x33')){var _0x405d58={};_0x405d58[_0x1a0b4d[_0x2115('0x1d')]]={'$like':'%'+_0x56542e['query'][_0x2115('0x34')]+'%'};return _0x405d58;}})});}_0x3bcd5b=_['merge']({},_0x3bcd5b,_0x56542e[_0x2115('0x35')]);var _0x1b2f5b={'where':_0x3bcd5b['where']};return db['SquareProject'][_0x2115('0xf')](_0x1b2f5b)[_0x2115('0x14')](function(_0x6eab47){_0xff0ceb['count']=_0x6eab47;if(_0x56542e[_0x2115('0x26')][_0x2115('0x36')]){_0x3bcd5b[_0x2115('0x37')]=[{'all':!![]}];}return db[_0x2115('0x21')][_0x2115('0x38')](_0x3bcd5b);})[_0x2115('0x14')](function(_0x3c1aa8){_0xff0ceb[_0x2115('0x39')]=_0x3c1aa8;return _0xff0ceb;})[_0x2115('0x14')](respondWithFilteredResult(_0x1d5bb2,_0x3bcd5b))[_0x2115('0x3a')](handleError(_0x1d5bb2,null));};exports['show']=function(_0x155401,_0x49a91d){var _0x59faff={'raw':![],'where':{'id':_0x155401[_0x2115('0x3b')]['id']}},_0x49ed8d={};_0x49ed8d[_0x2115('0x29')]=_[_0x2115('0x25')](db['SquareProject'][_0x2115('0x3c')]);_0x49ed8d['query']=_['keys'](_0x155401[_0x2115('0x26')]);_0x49ed8d[_0x2115('0x27')]=_[_0x2115('0x28')](_0x49ed8d[_0x2115('0x29')],_0x49ed8d[_0x2115('0x26')]);_0x59faff['attributes']=_['intersection'](_0x49ed8d[_0x2115('0x29')],qs[_0x2115('0x2a')](_0x155401[_0x2115('0x26')][_0x2115('0x2a')]));_0x59faff[_0x2115('0x2b')]=_0x59faff['attributes'][_0x2115('0x2c')]?_0x59faff[_0x2115('0x2b')]:_0x49ed8d[_0x2115('0x29')];if(_0x155401[_0x2115('0x26')]['includeAll']){_0x59faff[_0x2115('0x37')]=[{'all':!![]}];}_0x59faff=_[_0x2115('0x3d')]({},_0x59faff,_0x155401[_0x2115('0x35')]);return db['SquareProject'][_0x2115('0x3e')](_0x59faff)[_0x2115('0x14')](handleEntityNotFound(_0x49a91d,null))['then'](respondWithResult(_0x49a91d,null))[_0x2115('0x3a')](handleError(_0x49a91d,null));};exports['create']=function(_0x4f94a3,_0x3897fb){return db[_0x2115('0x21')][_0x2115('0x3f')](_0x4f94a3[_0x2115('0x40')],{})[_0x2115('0x14')](function(_0x26731c){var _0x629814=_0x4f94a3[_0x2115('0x41')][_0x2115('0x42')]({'plain':!![]});if(!_0x629814)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x629814[_0x2115('0x43')]==='user'){var _0x526f28=_0x26731c['get']({'plain':!![]});var _0x28275e=_0x2115('0x15');return db[_0x2115('0x44')][_0x2115('0x3e')]({'where':{'name':_0x28275e,'userProfileId':_0x629814[_0x2115('0x45')]},'raw':!![]})[_0x2115('0x14')](function(_0x39e05b){if(_0x39e05b&&_0x39e05b[_0x2115('0x46')]===0x0){return db[_0x2115('0x47')][_0x2115('0x3f')]({'name':_0x526f28[_0x2115('0x1d')],'resourceId':_0x526f28['id'],'type':_0x39e05b['name'],'sectionId':_0x39e05b['id']},{})[_0x2115('0x14')](function(){return _0x26731c;});}else{return _0x26731c;}})[_0x2115('0x3a')](function(_0x315080){logger[_0x2115('0x1b')](_0x2115('0x48'),_0x315080);throw _0x315080;});}return _0x26731c;})[_0x2115('0x14')](respondWithResult(_0x3897fb,0xc9))[_0x2115('0x3a')](handleError(_0x3897fb,null));};exports[_0x2115('0x12')]=function(_0xfee35d,_0x1d7986){if(_0xfee35d[_0x2115('0x40')]['id']){delete _0xfee35d[_0x2115('0x40')]['id'];}return db[_0x2115('0x21')][_0x2115('0x3e')]({'where':{'id':_0xfee35d['params']['id']}})[_0x2115('0x14')](handleEntityNotFound(_0x1d7986,null))[_0x2115('0x14')](saveUpdates(_0xfee35d[_0x2115('0x40')],null))[_0x2115('0x14')](function(_0x3b513b){if(!_0x3b513b)return;var _0x41bb05=_0x3b513b['get']({'plain':!![]});return _0x41bb05;})[_0x2115('0x14')](function(_0x26e0c6){var _0x3c4716=new Redis(config[_0x2115('0x7')]);_0x3c4716[_0x2115('0x16')](_0x2115('0x17'),JSON[_0x2115('0x18')](_['pick'](_0x26e0c6,['id',_0x2115('0x1d'),_0x2115('0x49')])));return _0x26e0c6;})['then'](respondWithResult(_0x1d7986,null))[_0x2115('0x3a')](handleError(_0x1d7986,null));};exports[_0x2115('0x13')]=function(_0x37931c,_0x33b26f){return db['SquareProject'][_0x2115('0x3e')]({'where':{'id':_0x37931c[_0x2115('0x3b')]['id']}})['then'](handleEntityNotFound(_0x33b26f,null))['then'](removeEntity(_0x33b26f,null))[_0x2115('0x3a')](handleError(_0x33b26f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 51081a9..0536e10 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 _0xc514=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x9bb933,_0x11c3fa){var _0x24649a=function(_0x17c4e5){while(--_0x17c4e5){_0x9bb933['push'](_0x9bb933['shift']());}};_0x24649a(++_0x11c3fa);}(_0xc514,0xf7));var _0x4c51=function(_0x384b64,_0x4f0784){_0x384b64=_0x384b64-0x0;var _0x3a8f2c=_0xc514[_0x384b64];return _0x3a8f2c;};'use strict';var EventEmitter=require(_0x4c51('0x0'));var SquareProject=require(_0x4c51('0x1'))['db'][_0x4c51('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4c51('0x3')](0x0);var events={'afterCreate':_0x4c51('0x4'),'afterUpdate':_0x4c51('0x5'),'afterDestroy':_0x4c51('0x6')};function emitEvent(_0x206f0a){return function(_0x20eef9,_0x342458,_0x4551f8){SquareProjectEvents['emit'](_0x206f0a+':'+_0x20eef9['id'],_0x20eef9);SquareProjectEvents[_0x4c51('0x7')](_0x206f0a,_0x20eef9);_0x4551f8(null);};}for(var e in events){if(events[_0x4c51('0x8')](e)){var event=events[e];SquareProject[_0x4c51('0x9')](e,emitEvent(event));}}module[_0x4c51('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x1167=['SquareProject','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x1ffe9b,_0x249737){var _0x53f23e=function(_0x9fc09b){while(--_0x9fc09b){_0x1ffe9b['push'](_0x1ffe9b['shift']());}};_0x53f23e(++_0x249737);}(_0x1167,0x11f));var _0x7116=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x1167[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require(_0x7116('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x7116('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7116('0x2')](0x0);var events={'afterCreate':_0x7116('0x3'),'afterUpdate':'update','afterDestroy':_0x7116('0x4')};function emitEvent(_0x79dfac){return function(_0x4fac8c,_0x1f1056,_0x1641fb){SquareProjectEvents[_0x7116('0x5')](_0x79dfac+':'+_0x4fac8c['id'],_0x4fac8c);SquareProjectEvents[_0x7116('0x5')](_0x79dfac,_0x4fac8c);_0x1641fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x7116('0x6')](e,emitEvent(event));}}module[_0x7116('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index aca5f8b..e4ec565 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 _0x9623=['format','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define','SquareProject','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x9623,0xd9));var _0x3962=function(_0xb24c82,_0x7c8be4){_0xb24c82=_0xb24c82-0x0;var _0x1634a3=_0x9623[_0xb24c82];return _0x1634a3;};'use strict';var _=require('lodash');var util=require(_0x3962('0x0'));var logger=require(_0x3962('0x1'))(_0x3962('0x2'));var moment=require(_0x3962('0x3'));var BPromise=require(_0x3962('0x4'));var rp=require(_0x3962('0x5'));var fs=require('fs');var path=require(_0x3962('0x6'));var rimraf=require('rimraf');var config=require(_0x3962('0x7'));var attributes=require(_0x3962('0x8'));module['exports']=function(_0x1eed74,_0x3ed9bf){return _0x1eed74[_0x3962('0x9')](_0x3962('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f9e3d,_0x5ec9c8,_0x2adc9f){if(_0x2f9e3d[_0x3962('0xb')](_0x3962('0xc'))){_0x2f9e3d[_0x3962('0xd')]=moment()['format'](_0x3962('0xe'));}if(_0x2f9e3d[_0x3962('0xb')](_0x3962('0xf'))){_0x2f9e3d[_0x3962('0x10')]=moment()[_0x3962('0x11')](_0x3962('0xe'));}_0x2adc9f(null,_0x2f9e3d);}}});}; \ No newline at end of file +var _0xfe74=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0xfe74,0x7d));var _0x4fe7=function(_0x22dc4b,_0x4b93bd){_0x22dc4b=_0x22dc4b-0x0;var _0x29208a=_0xfe74[_0x22dc4b];return _0x29208a;};'use strict';var _=require(_0x4fe7('0x0'));var util=require(_0x4fe7('0x1'));var logger=require(_0x4fe7('0x2'))(_0x4fe7('0x3'));var moment=require(_0x4fe7('0x4'));var BPromise=require('bluebird');var rp=require(_0x4fe7('0x5'));var fs=require('fs');var path=require(_0x4fe7('0x6'));var rimraf=require(_0x4fe7('0x7'));var config=require(_0x4fe7('0x8'));var attributes=require('./squareProject.attributes');module[_0x4fe7('0x9')]=function(_0x17d446,_0x34c2d8){return _0x17d446[_0x4fe7('0xa')]('SquareProject',attributes,{'tableName':_0x4fe7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb936ca,_0x49bedc,_0x30dae7){if(_0xb936ca[_0x4fe7('0xc')](_0x4fe7('0xd'))){_0xb936ca[_0x4fe7('0xe')]=moment()[_0x4fe7('0xf')](_0x4fe7('0x10'));}if(_0xb936ca['changed']('production')){_0xb936ca[_0x4fe7('0x11')]=moment()[_0x4fe7('0xf')](_0x4fe7('0x10'));}_0x30dae7(null,_0xb936ca);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index af10f60..b2e6a30 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 _0xc520=['stringify','catch','error','message','ShowSquareProject','SquareProject','find','info','debug','lodash','ioredis','../../mysqldb','../../config/logger','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x4e0c98,_0x37f6a3){var _0x735cfd=function(_0x2dc92d){while(--_0x2dc92d){_0x4e0c98['push'](_0x4e0c98['shift']());}};_0x735cfd(++_0x37f6a3);}(_0xc520,0xdb));var _0x0c52=function(_0x3f7134,_0x48d8a9){_0x3f7134=_0x3f7134-0x0;var _0x77ecef=_0xc520[_0x3f7134];return _0x77ecef;};'use strict';var _=require(_0x0c52('0x0'));var Redis=require(_0x0c52('0x1'));var db=require(_0x0c52('0x2'))['db'];var logger=require(_0x0c52('0x3'))('rpc');var config=require('../../config/environment');config[_0x0c52('0x4')]=_[_0x0c52('0x5')](config['redis'],{'host':_0x0c52('0x6'),'port':0x18eb});var socket=require(_0x0c52('0x7'))(new Redis(config[_0x0c52('0x4')]));require(_0x0c52('0x8'))[_0x0c52('0x9')](socket);exports[_0x0c52('0xa')]=function(_0x21419e){var _0x299531=this;return new Promise(function(_0x4384ff,_0x11715b){return db['SquareProject'][_0x0c52('0xb')]({'raw':_0x21419e[_0x0c52('0xc')]?_0x21419e[_0x0c52('0xc')][_0x0c52('0xd')]===undefined?!![]:![]:!![],'where':_0x21419e[_0x0c52('0xc')]?_0x21419e[_0x0c52('0xc')][_0x0c52('0xe')]||null:null,'attributes':_0x21419e['options']?_0x21419e['options'][_0x0c52('0xf')]||null:null,'limit':_0x21419e['options']?_0x21419e[_0x0c52('0xc')][_0x0c52('0x10')]||null:null,'include':_0x21419e[_0x0c52('0xc')]?_0x21419e[_0x0c52('0xc')][_0x0c52('0x11')]?_[_0x0c52('0x12')](_0x21419e[_0x0c52('0xc')][_0x0c52('0x11')],function(_0x3467c1){return{'model':db[_0x3467c1[_0x0c52('0x13')]],'as':_0x3467c1['as'],'attributes':_0x3467c1[_0x0c52('0xf')],'include':_0x3467c1[_0x0c52('0x11')]?_[_0x0c52('0x12')](_0x3467c1['include'],function(_0x2b70d1){return{'model':db[_0x2b70d1[_0x0c52('0x13')]],'as':_0x2b70d1['as'],'attributes':_0x2b70d1[_0x0c52('0xf')],'include':_0x2b70d1[_0x0c52('0x11')]?_['map'](_0x2b70d1[_0x0c52('0x11')],function(_0x5f061b){return{'model':db[_0x5f061b[_0x0c52('0x13')]],'as':_0x5f061b['as'],'attributes':_0x5f061b[_0x0c52('0xf')]};}):[]};}):[]};}):[]:[]})[_0x0c52('0x14')](function(_0x2d218d){logger['info'](_0x0c52('0xa'),_0x21419e);logger['debug']('GetSquareProjects',_0x21419e,JSON[_0x0c52('0x15')](_0x2d218d));_0x4384ff(_0x2d218d);})[_0x0c52('0x16')](function(_0x4016f5){logger[_0x0c52('0x17')](_0x0c52('0xa'),_0x4016f5[_0x0c52('0x18')],_0x21419e);_0x11715b(_0x299531[_0x0c52('0x17')](0x1f4,_0x4016f5[_0x0c52('0x18')]));});});};exports[_0x0c52('0x19')]=function(_0x165112){var _0x150017=this;return new Promise(function(_0x3cbec5,_0x222dcf){return db[_0x0c52('0x1a')][_0x0c52('0x1b')]({'raw':_0x165112[_0x0c52('0xc')]?_0x165112[_0x0c52('0xc')][_0x0c52('0xd')]===undefined?!![]:![]:!![],'where':_0x165112['options']?_0x165112[_0x0c52('0xc')][_0x0c52('0xe')]||null:null,'attributes':_0x165112[_0x0c52('0xc')]?_0x165112[_0x0c52('0xc')][_0x0c52('0xf')]||null:null,'include':_0x165112['options']?_0x165112[_0x0c52('0xc')][_0x0c52('0x11')]?_[_0x0c52('0x12')](_0x165112['options'][_0x0c52('0x11')],function(_0x561c91){return{'model':db[_0x561c91[_0x0c52('0x13')]],'as':_0x561c91['as'],'attributes':_0x561c91[_0x0c52('0xf')],'include':_0x561c91[_0x0c52('0x11')]?_[_0x0c52('0x12')](_0x561c91[_0x0c52('0x11')],function(_0x3fc40c){return{'model':db[_0x3fc40c[_0x0c52('0x13')]],'as':_0x3fc40c['as'],'attributes':_0x3fc40c[_0x0c52('0xf')],'include':_0x3fc40c[_0x0c52('0x11')]?_['map'](_0x3fc40c['include'],function(_0x54b34d){return{'model':db[_0x54b34d[_0x0c52('0x13')]],'as':_0x54b34d['as'],'attributes':_0x54b34d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c52('0x14')](function(_0x21bfbe){logger[_0x0c52('0x1c')](_0x0c52('0x19'),_0x165112);logger[_0x0c52('0x1d')]('ShowSquareProject',_0x165112,JSON[_0x0c52('0x15')](_0x21bfbe));_0x3cbec5(_0x21bfbe);})[_0x0c52('0x16')](function(_0x17ea79){logger[_0x0c52('0x17')]('ShowSquareProject',_0x17ea79['message'],_0x165112);_0x222dcf(_0x150017[_0x0c52('0x17')](0x1f4,_0x17ea79[_0x0c52('0x18')]));});});}; \ No newline at end of file +var _0xcdf1=['defaults','localhost','register','GetSquareProjects','findAll','options','where','attributes','limit','include','map','model','then','info','stringify','catch','error','message','find','raw','ShowSquareProject','debug','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xcdf1,0x182));var _0x1cdf=function(_0x1823d8,_0x18f263){_0x1823d8=_0x1823d8-0x0;var _0xac41f2=_0xcdf1[_0x1823d8];return _0xac41f2;};'use strict';var _=require(_0x1cdf('0x0'));var Redis=require(_0x1cdf('0x1'));var db=require(_0x1cdf('0x2'))['db'];var logger=require(_0x1cdf('0x3'))(_0x1cdf('0x4'));var config=require('../../config/environment');config[_0x1cdf('0x5')]=_[_0x1cdf('0x6')](config[_0x1cdf('0x5')],{'host':_0x1cdf('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cdf('0x5')]));require('./squareProject.socket')[_0x1cdf('0x8')](socket);exports[_0x1cdf('0x9')]=function(_0x337b57){var _0x518349=this;return new Promise(function(_0x216004,_0x2d8984){return db['SquareProject'][_0x1cdf('0xa')]({'raw':_0x337b57[_0x1cdf('0xb')]?_0x337b57[_0x1cdf('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x337b57['options']?_0x337b57[_0x1cdf('0xb')][_0x1cdf('0xc')]||null:null,'attributes':_0x337b57['options']?_0x337b57[_0x1cdf('0xb')][_0x1cdf('0xd')]||null:null,'limit':_0x337b57[_0x1cdf('0xb')]?_0x337b57[_0x1cdf('0xb')][_0x1cdf('0xe')]||null:null,'include':_0x337b57['options']?_0x337b57[_0x1cdf('0xb')][_0x1cdf('0xf')]?_[_0x1cdf('0x10')](_0x337b57[_0x1cdf('0xb')]['include'],function(_0x1d8e23){return{'model':db[_0x1d8e23[_0x1cdf('0x11')]],'as':_0x1d8e23['as'],'attributes':_0x1d8e23[_0x1cdf('0xd')],'include':_0x1d8e23[_0x1cdf('0xf')]?_[_0x1cdf('0x10')](_0x1d8e23[_0x1cdf('0xf')],function(_0x1055ce){return{'model':db[_0x1055ce[_0x1cdf('0x11')]],'as':_0x1055ce['as'],'attributes':_0x1055ce['attributes'],'include':_0x1055ce['include']?_[_0x1cdf('0x10')](_0x1055ce[_0x1cdf('0xf')],function(_0x169756){return{'model':db[_0x169756[_0x1cdf('0x11')]],'as':_0x169756['as'],'attributes':_0x169756[_0x1cdf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x1cdf('0x12')](function(_0x431738){logger[_0x1cdf('0x13')](_0x1cdf('0x9'),_0x337b57);logger['debug'](_0x1cdf('0x9'),_0x337b57,JSON[_0x1cdf('0x14')](_0x431738));_0x216004(_0x431738);})[_0x1cdf('0x15')](function(_0x36de57){logger[_0x1cdf('0x16')]('GetSquareProjects',_0x36de57['message'],_0x337b57);_0x2d8984(_0x518349[_0x1cdf('0x16')](0x1f4,_0x36de57[_0x1cdf('0x17')]));});});};exports['ShowSquareProject']=function(_0x1f4b49){var _0x18eb1f=this;return new Promise(function(_0x4c8203,_0xd2634c){return db['SquareProject'][_0x1cdf('0x18')]({'raw':_0x1f4b49['options']?_0x1f4b49[_0x1cdf('0xb')][_0x1cdf('0x19')]===undefined?!![]:![]:!![],'where':_0x1f4b49[_0x1cdf('0xb')]?_0x1f4b49['options'][_0x1cdf('0xc')]||null:null,'attributes':_0x1f4b49[_0x1cdf('0xb')]?_0x1f4b49['options'][_0x1cdf('0xd')]||null:null,'include':_0x1f4b49['options']?_0x1f4b49[_0x1cdf('0xb')]['include']?_[_0x1cdf('0x10')](_0x1f4b49[_0x1cdf('0xb')]['include'],function(_0x53bfcb){return{'model':db[_0x53bfcb['model']],'as':_0x53bfcb['as'],'attributes':_0x53bfcb[_0x1cdf('0xd')],'include':_0x53bfcb[_0x1cdf('0xf')]?_[_0x1cdf('0x10')](_0x53bfcb[_0x1cdf('0xf')],function(_0x3a32e3){return{'model':db[_0x3a32e3[_0x1cdf('0x11')]],'as':_0x3a32e3['as'],'attributes':_0x3a32e3[_0x1cdf('0xd')],'include':_0x3a32e3[_0x1cdf('0xf')]?_[_0x1cdf('0x10')](_0x3a32e3[_0x1cdf('0xf')],function(_0x545c06){return{'model':db[_0x545c06[_0x1cdf('0x11')]],'as':_0x545c06['as'],'attributes':_0x545c06[_0x1cdf('0xd')]};}):[]};}):[]};}):[]:[]})[_0x1cdf('0x12')](function(_0x3097cc){logger[_0x1cdf('0x13')](_0x1cdf('0x1a'),_0x1f4b49);logger[_0x1cdf('0x1b')](_0x1cdf('0x1a'),_0x1f4b49,JSON[_0x1cdf('0x14')](_0x3097cc));_0x4c8203(_0x3097cc);})[_0x1cdf('0x15')](function(_0xa7cd5c){logger[_0x1cdf('0x16')](_0x1cdf('0x1a'),_0xa7cd5c[_0x1cdf('0x17')],_0x1f4b49);_0xd2634c(_0x18eb1f['error'](0x1f4,_0xa7cd5c[_0x1cdf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e8a1a64..322c59a 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 _0xdf5a=['save','remove','emit','removeListener','squareProject:','./squareProject.events'];(function(_0x479f47,_0x3d619a){var _0xc3fac2=function(_0x351634){while(--_0x351634){_0x479f47['push'](_0x479f47['shift']());}};_0xc3fac2(++_0x3d619a);}(_0xdf5a,0x1df));var _0xadf5=function(_0x21e2fc,_0x7f9be1){_0x21e2fc=_0x21e2fc-0x0;var _0x2a0779=_0xdf5a[_0x21e2fc];return _0x2a0779;};'use strict';var SquareProjectEvents=require(_0xadf5('0x0'));var events=[_0xadf5('0x1'),_0xadf5('0x2'),'update'];function createListener(_0x54a71b,_0x13a42e){return function(_0x24b4e4){_0x13a42e[_0xadf5('0x3')](_0x54a71b,_0x24b4e4);};}function removeListener(_0x52479d,_0x585f8f){return function(){SquareProjectEvents[_0xadf5('0x4')](_0x52479d,_0x585f8f);};}exports['register']=function(_0x46de95){for(var _0x21785b=0x0,_0x7f1f61=events['length'];_0x21785b<_0x7f1f61;_0x21785b++){var _0x248415=events[_0x21785b];var _0x4fb853=createListener(_0xadf5('0x5')+_0x248415,_0x46de95);SquareProjectEvents['on'](_0x248415,_0x4fb853);}}; \ No newline at end of file +var _0x081a=['removeListener','register','length','./squareProject.events','save','remove','update','emit'];(function(_0x532969,_0x1e344c){var _0x353780=function(_0x3fef4b){while(--_0x3fef4b){_0x532969['push'](_0x532969['shift']());}};_0x353780(++_0x1e344c);}(_0x081a,0x1f3));var _0xa081=function(_0x421231,_0x318b72){_0x421231=_0x421231-0x0;var _0x297780=_0x081a[_0x421231];return _0x297780;};'use strict';var SquareProjectEvents=require(_0xa081('0x0'));var events=[_0xa081('0x1'),_0xa081('0x2'),_0xa081('0x3')];function createListener(_0x2c7593,_0x4f051c){return function(_0x4ddeb2){_0x4f051c[_0xa081('0x4')](_0x2c7593,_0x4ddeb2);};}function removeListener(_0x24c695,_0x5c66e5){return function(){SquareProjectEvents[_0xa081('0x5')](_0x24c695,_0x5c66e5);};}exports[_0xa081('0x6')]=function(_0x346d4d){for(var _0x5d9dfe=0x0,_0x1dbbe1=events[_0xa081('0x7')];_0x5d9dfe<_0x1dbbe1;_0x5d9dfe++){var _0x474ccb=events[_0x5d9dfe];var _0x56ea05=createListener('squareProject:'+_0x474ccb,_0x346d4d);SquareProjectEvents['on'](_0x474ccb,_0x56ea05);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ac32702..3296ce7 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x2ee4a2,_0x1e2f0b){var _0x5f3da0=function(_0x2c2408){while(--_0x2c2408){_0x2ee4a2['push'](_0x2ee4a2['shift']());}};_0x5f3da0(++_0x1e2f0b);}(_0xe14b,0x93));var _0xbe14=function(_0x303964,_0x36959c){_0x303964=_0x303964-0x0;var _0x2d25e0=_0xe14b[_0x303964];return _0x2d25e0;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x48c0e0,_0x4725e5){var _0x31457a=function(_0x9619e6){while(--_0x9619e6){_0x48c0e0['push'](_0x48c0e0['shift']());}};_0x31457a(++_0x4725e5);}(_0x5fab,0x177));var _0xb5fa=function(_0x3a508a,_0x358c16){_0x3a508a=_0x3a508a-0x0;var _0x5a8c34=_0x5fab[_0x3a508a];return _0x5a8c34;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index dd54c46..265cc2f 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 _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x42f7b2,_0x264e4b){var _0x3f61f7=function(_0x1930af){while(--_0x1930af){_0x42f7b2['push'](_0x42f7b2['shift']());}};_0x3f61f7(++_0x264e4b);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file +var _0x2eb2=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2eb2[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'callerid':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'extension':{'type':Sequelize[_0x22eb('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x22eb('0x1')]},'filename':{'type':Sequelize[_0x22eb('0x1')]},'savePath':{'type':Sequelize[_0x22eb('0x1')]},'format':{'type':Sequelize[_0x22eb('0x2')],'get':function(){var _0x4539d0='';var _0x396806=this[_0x22eb('0x3')](_0x22eb('0x4'));if(_0x396806){_0x4539d0=_0x396806[_0x22eb('0x5')](_0x396806[_0x22eb('0x6')]('.'));}return _0x4539d0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ee8f15b..8193d13 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 _0x4d3f=['findAll','then','rows','catch','show','params','include','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','decryptFile','secrets','recording','ValidationError','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll'];(function(_0x244b0f,_0x494e57){var _0x2e2b9d=function(_0x539b96){while(--_0x539b96){_0x244b0f['push'](_0x244b0f['shift']());}};_0x2e2b9d(++_0x494e57);}(_0x4d3f,0x81));var _0xf4d3=function(_0x26a8ef,_0x298bb5){_0x26a8ef=_0x26a8ef-0x0;var _0x50d0f1=_0x4d3f[_0x26a8ef];return _0x50d0f1;};'use strict';var emlformat=require(_0xf4d3('0x0'));var rimraf=require(_0xf4d3('0x1'));var zipdir=require(_0xf4d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf4d3('0x3'));var moment=require(_0xf4d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4d3('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf4d3('0x6'));var csv=require(_0xf4d3('0x7'));var ejs=require(_0xf4d3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4d3('0x9'));var squel=require('squel');var crypto=require(_0xf4d3('0xa'));var jsforce=require(_0xf4d3('0xb'));var deskjs=require(_0xf4d3('0xc'));var toCsv=require(_0xf4d3('0x7'));var querystring=require(_0xf4d3('0xd'));var Papa=require(_0xf4d3('0xe'));var Redis=require(_0xf4d3('0xf'));var authService=require(_0xf4d3('0x10'));var qs=require(_0xf4d3('0x11'));var as=require(_0xf4d3('0x12'));var hardwareService=require(_0xf4d3('0x13'));var logger=require(_0xf4d3('0x14'))(_0xf4d3('0x15'));var utils=require(_0xf4d3('0x16'));var config=require(_0xf4d3('0x17'));var licenseUtil=require(_0xf4d3('0x18'));var db=require(_0xf4d3('0x19'))['db'];function respondWithStatusCode(_0x4e3069,_0x5d7ee6){_0x5d7ee6=_0x5d7ee6||0xcc;return function(_0x22a26f){if(_0x22a26f){return _0x4e3069[_0xf4d3('0x1a')](_0x5d7ee6);}return _0x4e3069[_0xf4d3('0x1b')](_0x5d7ee6)[_0xf4d3('0x1c')]();};}function respondWithResult(_0x18fc23,_0x41516c){_0x41516c=_0x41516c||0xc8;return function(_0x1dc75e){if(_0x1dc75e){return _0x18fc23[_0xf4d3('0x1b')](_0x41516c)[_0xf4d3('0x1d')](_0x1dc75e);}};}function respondWithFilteredResult(_0x1755af,_0x52dda0){return function(_0x2290b6){if(_0x2290b6){var _0x356ea4=typeof _0x52dda0[_0xf4d3('0x1e')]===_0xf4d3('0x1f')&&typeof _0x52dda0[_0xf4d3('0x20')]===_0xf4d3('0x1f');var _0x29750d=_0x2290b6['count'];var _0x28e7b0=_0x356ea4?0x0:_0x52dda0[_0xf4d3('0x1e')];var _0x1cc9de=_0x356ea4?_0x2290b6[_0xf4d3('0x21')]:_0x52dda0[_0xf4d3('0x1e')]+_0x52dda0[_0xf4d3('0x20')];var _0x1f723c;if(_0x1cc9de>=_0x29750d){_0x1cc9de=_0x29750d;_0x1f723c=0xc8;}else{_0x1f723c=0xce;}_0x1755af[_0xf4d3('0x1b')](_0x1f723c);return _0x1755af[_0xf4d3('0x22')]('Content-Range',_0x28e7b0+'-'+_0x1cc9de+'/'+_0x29750d)['json'](_0x2290b6);}return null;};}function patchUpdates(_0xcdc8ff){return function(_0x2e675e){try{jsonpatch['apply'](_0x2e675e,_0xcdc8ff,!![]);}catch(_0xf7d9b6){return BPromise['reject'](_0xf7d9b6);}return _0x2e675e[_0xf4d3('0x23')]();};}function saveUpdates(_0x35a36f,_0x2b239c){return function(_0x58c164){if(_0x58c164){return _0x58c164[_0xf4d3('0x24')](_0x35a36f)['then'](function(_0x545d58){return _0x545d58;});}return null;};}function removeEntity(_0x1ac444,_0xc91a1e){return function(_0x128975){if(_0x128975){return _0x128975[_0xf4d3('0x25')]()['then'](function(){_0x1ac444[_0xf4d3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbffd,_0x6bfe7e){return function(_0x436897){if(!_0x436897){_0x3cbffd[_0xf4d3('0x1a')](0x194);}return _0x436897;};}function handleError(_0xb83504,_0x460ea7){_0x460ea7=_0x460ea7||0x1f4;return function(_0x10e9e2){logger[_0xf4d3('0x26')](_0x10e9e2[_0xf4d3('0x27')]);if(_0x10e9e2[_0xf4d3('0x28')]){delete _0x10e9e2[_0xf4d3('0x28')];}_0xb83504['status'](_0x460ea7)[_0xf4d3('0x29')](_0x10e9e2);};}exports[_0xf4d3('0x2a')]=function(_0x2bb4be,_0x3eb0ae){var _0xc5b88b={},_0xd0a495={},_0x88ae69={'count':0x0,'rows':[]};var _0x381afb=_[_0xf4d3('0x2b')](db[_0xf4d3('0x2c')][_0xf4d3('0x2d')],function(_0x5c76cc){return{'name':_0x5c76cc[_0xf4d3('0x2e')],'type':_0x5c76cc[_0xf4d3('0x2f')][_0xf4d3('0x30')]};});_0xd0a495[_0xf4d3('0x31')]=_['map'](_0x381afb,'name');_0xd0a495[_0xf4d3('0x32')]=_[_0xf4d3('0x33')](_0x2bb4be['query']);_0xd0a495[_0xf4d3('0x34')]=_[_0xf4d3('0x35')](_0xd0a495[_0xf4d3('0x31')],_0xd0a495[_0xf4d3('0x32')]);_0xc5b88b[_0xf4d3('0x36')]=_[_0xf4d3('0x35')](_0xd0a495[_0xf4d3('0x31')],qs[_0xf4d3('0x37')](_0x2bb4be[_0xf4d3('0x32')][_0xf4d3('0x37')]));_0xc5b88b[_0xf4d3('0x36')]=_0xc5b88b[_0xf4d3('0x36')][_0xf4d3('0x38')]?_0xc5b88b[_0xf4d3('0x36')]:_0xd0a495['model'];if(!_0x2bb4be['query'][_0xf4d3('0x39')](_0xf4d3('0x3a'))){_0xc5b88b[_0xf4d3('0x20')]=qs['limit'](_0x2bb4be[_0xf4d3('0x32')][_0xf4d3('0x20')]);_0xc5b88b[_0xf4d3('0x1e')]=qs[_0xf4d3('0x1e')](_0x2bb4be[_0xf4d3('0x32')][_0xf4d3('0x1e')]);}_0xc5b88b[_0xf4d3('0x3b')]=qs[_0xf4d3('0x3c')](_0x2bb4be[_0xf4d3('0x32')]['sort']);_0xc5b88b[_0xf4d3('0x3d')]=qs[_0xf4d3('0x34')](_[_0xf4d3('0x3e')](_0x2bb4be[_0xf4d3('0x32')],_0xd0a495[_0xf4d3('0x34')]),_0x381afb);if(_0x2bb4be['query']['filter']){_0xc5b88b['where']=_[_0xf4d3('0x3f')](_0xc5b88b[_0xf4d3('0x3d')],{'$or':_['map'](_0x381afb,function(_0x127817){if(_0x127817[_0xf4d3('0x2f')]!==_0xf4d3('0x40')){var _0x44ae2f={};_0x44ae2f[_0x127817['name']]={'$like':'%'+_0x2bb4be[_0xf4d3('0x32')]['filter']+'%'};return _0x44ae2f;}})});}_0xc5b88b=_[_0xf4d3('0x3f')]({},_0xc5b88b,_0x2bb4be[_0xf4d3('0x41')]);var _0x5b782d={'where':_0xc5b88b[_0xf4d3('0x3d')]};return db[_0xf4d3('0x2c')][_0xf4d3('0x21')](_0x5b782d)['then'](function(_0x5d1ade){_0x88ae69[_0xf4d3('0x21')]=_0x5d1ade;if(_0x2bb4be[_0xf4d3('0x32')][_0xf4d3('0x42')]){_0xc5b88b['include']=[{'all':!![]}];}return db['SquareRecording'][_0xf4d3('0x43')](_0xc5b88b);})[_0xf4d3('0x44')](function(_0xbb925f){_0x88ae69[_0xf4d3('0x45')]=_0xbb925f;return _0x88ae69;})[_0xf4d3('0x44')](respondWithFilteredResult(_0x3eb0ae,_0xc5b88b))[_0xf4d3('0x46')](handleError(_0x3eb0ae,null));};exports[_0xf4d3('0x47')]=function(_0xe1e76e,_0x5d72fb){var _0x3324d5={'raw':!![],'where':{'id':_0xe1e76e[_0xf4d3('0x48')]['id']}},_0x11cc65={};_0x11cc65[_0xf4d3('0x31')]=_[_0xf4d3('0x33')](db['SquareRecording'][_0xf4d3('0x2d')]);_0x11cc65[_0xf4d3('0x32')]=_[_0xf4d3('0x33')](_0xe1e76e['query']);_0x11cc65[_0xf4d3('0x34')]=_[_0xf4d3('0x35')](_0x11cc65[_0xf4d3('0x31')],_0x11cc65['query']);_0x3324d5[_0xf4d3('0x36')]=_[_0xf4d3('0x35')](_0x11cc65['model'],qs['fields'](_0xe1e76e[_0xf4d3('0x32')][_0xf4d3('0x37')]));_0x3324d5[_0xf4d3('0x36')]=_0x3324d5[_0xf4d3('0x36')]['length']?_0x3324d5[_0xf4d3('0x36')]:_0x11cc65[_0xf4d3('0x31')];if(_0xe1e76e[_0xf4d3('0x32')][_0xf4d3('0x42')]){_0x3324d5[_0xf4d3('0x49')]=[{'all':!![]}];}_0x3324d5=_[_0xf4d3('0x3f')]({},_0x3324d5,_0xe1e76e[_0xf4d3('0x41')]);return db[_0xf4d3('0x2c')][_0xf4d3('0x4a')](_0x3324d5)[_0xf4d3('0x44')](handleEntityNotFound(_0x5d72fb,null))[_0xf4d3('0x44')](respondWithResult(_0x5d72fb,null))['catch'](handleError(_0x5d72fb,null));};exports['create']=function(_0x3130e3,_0x54537e){return db[_0xf4d3('0x2c')][_0xf4d3('0x4b')](_0x3130e3[_0xf4d3('0x4c')],{})[_0xf4d3('0x44')](respondWithResult(_0x54537e,0xc9))[_0xf4d3('0x46')](handleError(_0x54537e,null));};exports[_0xf4d3('0x24')]=function(_0x952168,_0x4cd27c){if(_0x952168['body']['id']){delete _0x952168[_0xf4d3('0x4c')]['id'];}return db[_0xf4d3('0x2c')]['find']({'where':{'id':_0x952168['params']['id']}})[_0xf4d3('0x44')](handleEntityNotFound(_0x4cd27c,null))[_0xf4d3('0x44')](saveUpdates(_0x952168[_0xf4d3('0x4c')],null))['then'](respondWithResult(_0x4cd27c,null))[_0xf4d3('0x46')](handleError(_0x4cd27c,null));};exports[_0xf4d3('0x4d')]=function(_0x52ae55,_0x411370,_0x4d9ba6){var _0x44d7f2=require(_0xf4d3('0x4e'));var _0x5b2fde=![];var _0x5c5c98={};if(_0x52ae55[_0xf4d3('0x32')]['type']&&_0x52ae55[_0xf4d3('0x32')][_0xf4d3('0x2f')]==='uniqueid'){_0x5c5c98[_0xf4d3('0x4f')]=_0x52ae55['params']['id'];}else{_0x5c5c98['id']=_0x52ae55[_0xf4d3('0x48')]['id'];}return db['SquareRecording']['find']({'where':_0x5c5c98,'attributes':['id',_0xf4d3('0x50'),_0xf4d3('0x51')],'raw':!![]})[_0xf4d3('0x44')](handleEntityNotFound(_0x411370,null))[_0xf4d3('0x44')](function(_0x1a0143){if(_0x1a0143){var _0x326b31=_0x1a0143[_0xf4d3('0x50')];var _0xf0494c=util[_0xf4d3('0x52')]('%s.cypher',_0x326b31);if(fs['existsSync'](_0xf0494c)){_0x5b2fde=!![];return _0x44d7f2[_0xf4d3('0x53')](_0xf0494c,_0x326b31,config[_0xf4d3('0x54')][_0xf4d3('0x55')])[_0xf4d3('0x44')](function(){return _0x1a0143;});}return _0x1a0143;}})['then'](function(_0x4abe61){if(_0x4abe61){var _0x20e5bc=_0x4abe61[_0xf4d3('0x50')];if(!fs['existsSync'](_0x20e5bc)){throw new db['Sequelize'][(_0xf4d3('0x56'))]('SquareRecording\x20not\x20found');}if(_0x4abe61[_0xf4d3('0x51')]){return _0x411370[_0xf4d3('0x4d')](_0x20e5bc,_0x4abe61[_0xf4d3('0x51')]+path['extname'](_0x20e5bc),function(){if(_0x5b2fde){fs[_0xf4d3('0x57')](_0x20e5bc);}});}else{return _0x411370[_0xf4d3('0x4d')](_0x20e5bc,function(_0x1b79c0){if(_0x5b2fde){fs['unlink'](_0x20e5bc);}});}}})['catch'](function(_0x3fc9b3){if(_0x3fc9b3[_0xf4d3('0x58')]===_0xf4d3('0x59')){_0x411370[_0xf4d3('0x1b')](0x194)[_0xf4d3('0x29')](_0xf4d3('0x5a'));}else{return handleError(_0x411370,null);}});};exports[_0xf4d3('0x25')]=function(_0x3412ab,_0x4fd5d0){return db[_0xf4d3('0x2c')][_0xf4d3('0x4a')]({'where':{'id':_0x3412ab[_0xf4d3('0x48')]['id']}})[_0xf4d3('0x44')](function(_0x431b16){if(_[_0xf4d3('0x5b')](_0x431b16)){throw new ReferenceError('Entity\x20not\x20found');}return _0x431b16;})[_0xf4d3('0x44')](function(_0x5c629e){var _0x240af7=_0x5c629e['savePath'];logger[_0xf4d3('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0x240af7);if(!_['isNil'](_0x5c629e[_0xf4d3('0x50')])&&fs[_0xf4d3('0x5d')](_0x240af7)){logger[_0xf4d3('0x5c')](_0xf4d3('0x5e')+_0x240af7+_0xf4d3('0x5f'));fs[_0xf4d3('0x60')](_0x240af7);}_0x240af7=_0x240af7+_0xf4d3('0x61');if(!_[_0xf4d3('0x5b')](_0x5c629e['savePath'])&&fs['existsSync'](_0x240af7)){logger[_0xf4d3('0x5c')](_0xf4d3('0x5e')+_0x240af7+_0xf4d3('0x5f'));fs['unlinkSync'](_0x240af7);}return _0x5c629e;})[_0xf4d3('0x44')](function(_0x142896){if(!_0x142896)throw new InternalError();return _0x142896['destroy']();})[_0xf4d3('0x44')](function(){_0x4fd5d0[_0xf4d3('0x1b')](0xcc)['end']();})['catch'](handleError(_0x4fd5d0,null));}; \ No newline at end of file +var _0xc155=['name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','../../components/encryptor','savePath','format','existsSync','decryptFile','recording','Sequelize','filename','unlink','message','SquareRecording\x20not\x20found','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','isNil','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','stack'];(function(_0x1a697e,_0x130466){var _0x40e871=function(_0x552667){while(--_0x552667){_0x1a697e['push'](_0x1a697e['shift']());}};_0x40e871(++_0x130466);}(_0xc155,0x15a));var _0x5c15=function(_0x2f764a,_0x54b315){_0x2f764a=_0x2f764a-0x0;var _0x302004=_0xc155[_0x2f764a];return _0x302004;};'use strict';var emlformat=require(_0x5c15('0x0'));var rimraf=require(_0x5c15('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c15('0x2'));var rp=require(_0x5c15('0x3'));var moment=require('moment');var BPromise=require(_0x5c15('0x4'));var Mustache=require(_0x5c15('0x5'));var util=require(_0x5c15('0x6'));var path=require('path');var sox=require(_0x5c15('0x7'));var csv=require(_0x5c15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c15('0x9'));var _=require(_0x5c15('0xa'));var squel=require(_0x5c15('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c15('0xc'));var deskjs=require(_0x5c15('0xd'));var toCsv=require(_0x5c15('0x8'));var querystring=require(_0x5c15('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c15('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5c15('0x10'));var as=require(_0x5c15('0x11'));var hardwareService=require(_0x5c15('0x12'));var logger=require(_0x5c15('0x13'))(_0x5c15('0x14'));var utils=require(_0x5c15('0x15'));var config=require(_0x5c15('0x16'));var licenseUtil=require(_0x5c15('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x387ba1,_0x5eb117){_0x5eb117=_0x5eb117||0xcc;return function(_0x2f090b){if(_0x2f090b){return _0x387ba1[_0x5c15('0x18')](_0x5eb117);}return _0x387ba1['status'](_0x5eb117)[_0x5c15('0x19')]();};}function respondWithResult(_0x47aa91,_0x22b6d6){_0x22b6d6=_0x22b6d6||0xc8;return function(_0x1d8761){if(_0x1d8761){return _0x47aa91['status'](_0x22b6d6)[_0x5c15('0x1a')](_0x1d8761);}};}function respondWithFilteredResult(_0x34dc9c,_0x41c1bd){return function(_0xd8b356){if(_0xd8b356){var _0xf35eb6=typeof _0x41c1bd[_0x5c15('0x1b')]===_0x5c15('0x1c')&&typeof _0x41c1bd[_0x5c15('0x1d')]===_0x5c15('0x1c');var _0x4026f2=_0xd8b356[_0x5c15('0x1e')];var _0x4da94b=_0xf35eb6?0x0:_0x41c1bd[_0x5c15('0x1b')];var _0x44e4c2=_0xf35eb6?_0xd8b356[_0x5c15('0x1e')]:_0x41c1bd['offset']+_0x41c1bd[_0x5c15('0x1d')];var _0x5401d3;if(_0x44e4c2>=_0x4026f2){_0x44e4c2=_0x4026f2;_0x5401d3=0xc8;}else{_0x5401d3=0xce;}_0x34dc9c[_0x5c15('0x1f')](_0x5401d3);return _0x34dc9c[_0x5c15('0x20')](_0x5c15('0x21'),_0x4da94b+'-'+_0x44e4c2+'/'+_0x4026f2)['json'](_0xd8b356);}return null;};}function patchUpdates(_0xb498f5){return function(_0x4c6570){try{jsonpatch[_0x5c15('0x22')](_0x4c6570,_0xb498f5,!![]);}catch(_0x32d516){return BPromise[_0x5c15('0x23')](_0x32d516);}return _0x4c6570[_0x5c15('0x24')]();};}function saveUpdates(_0x5f1762,_0x5bad99){return function(_0x51eb00){if(_0x51eb00){return _0x51eb00[_0x5c15('0x25')](_0x5f1762)['then'](function(_0x245090){return _0x245090;});}return null;};}function removeEntity(_0x1aa236,_0xe3899a){return function(_0x465ebd){if(_0x465ebd){return _0x465ebd[_0x5c15('0x26')]()[_0x5c15('0x27')](function(){_0x1aa236[_0x5c15('0x1f')](0xcc)[_0x5c15('0x19')]();});}};}function handleEntityNotFound(_0x13ee4d,_0x53d193){return function(_0x290f77){if(!_0x290f77){_0x13ee4d[_0x5c15('0x18')](0x194);}return _0x290f77;};}function handleError(_0x3d4909,_0x11d49f){_0x11d49f=_0x11d49f||0x1f4;return function(_0x168129){logger[_0x5c15('0x28')](_0x168129[_0x5c15('0x29')]);if(_0x168129[_0x5c15('0x2a')]){delete _0x168129[_0x5c15('0x2a')];}_0x3d4909['status'](_0x11d49f)[_0x5c15('0x2b')](_0x168129);};}exports[_0x5c15('0x2c')]=function(_0x487a28,_0x4e62d1){var _0xf105b2={},_0x57f588={},_0x5ad7db={'count':0x0,'rows':[]};var _0x14455c=_[_0x5c15('0x2d')](db['SquareRecording'][_0x5c15('0x2e')],function(_0x1a9f1e){return{'name':_0x1a9f1e[_0x5c15('0x2f')],'type':_0x1a9f1e['type'][_0x5c15('0x30')]};});_0x57f588['model']=_[_0x5c15('0x2d')](_0x14455c,'name');_0x57f588[_0x5c15('0x31')]=_[_0x5c15('0x32')](_0x487a28['query']);_0x57f588[_0x5c15('0x33')]=_[_0x5c15('0x34')](_0x57f588[_0x5c15('0x35')],_0x57f588[_0x5c15('0x31')]);_0xf105b2[_0x5c15('0x36')]=_[_0x5c15('0x34')](_0x57f588[_0x5c15('0x35')],qs[_0x5c15('0x37')](_0x487a28[_0x5c15('0x31')]['fields']));_0xf105b2[_0x5c15('0x36')]=_0xf105b2[_0x5c15('0x36')][_0x5c15('0x38')]?_0xf105b2[_0x5c15('0x36')]:_0x57f588['model'];if(!_0x487a28[_0x5c15('0x31')][_0x5c15('0x39')](_0x5c15('0x3a'))){_0xf105b2[_0x5c15('0x1d')]=qs[_0x5c15('0x1d')](_0x487a28[_0x5c15('0x31')][_0x5c15('0x1d')]);_0xf105b2[_0x5c15('0x1b')]=qs[_0x5c15('0x1b')](_0x487a28['query'][_0x5c15('0x1b')]);}_0xf105b2['order']=qs[_0x5c15('0x3b')](_0x487a28[_0x5c15('0x31')]['sort']);_0xf105b2[_0x5c15('0x3c')]=qs['filters'](_[_0x5c15('0x3d')](_0x487a28[_0x5c15('0x31')],_0x57f588[_0x5c15('0x33')]),_0x14455c);if(_0x487a28['query'][_0x5c15('0x3e')]){_0xf105b2[_0x5c15('0x3c')]=_[_0x5c15('0x3f')](_0xf105b2[_0x5c15('0x3c')],{'$or':_['map'](_0x14455c,function(_0x247e72){if(_0x247e72[_0x5c15('0x40')]!==_0x5c15('0x41')){var _0x2ea394={};_0x2ea394[_0x247e72[_0x5c15('0x2a')]]={'$like':'%'+_0x487a28[_0x5c15('0x31')][_0x5c15('0x3e')]+'%'};return _0x2ea394;}})});}_0xf105b2=_[_0x5c15('0x3f')]({},_0xf105b2,_0x487a28[_0x5c15('0x42')]);var _0x2584b2={'where':_0xf105b2[_0x5c15('0x3c')]};return db[_0x5c15('0x43')]['count'](_0x2584b2)[_0x5c15('0x27')](function(_0x3bd07){_0x5ad7db[_0x5c15('0x1e')]=_0x3bd07;if(_0x487a28[_0x5c15('0x31')][_0x5c15('0x44')]){_0xf105b2[_0x5c15('0x45')]=[{'all':!![]}];}return db['SquareRecording'][_0x5c15('0x46')](_0xf105b2);})['then'](function(_0x5a14e9){_0x5ad7db[_0x5c15('0x47')]=_0x5a14e9;return _0x5ad7db;})[_0x5c15('0x27')](respondWithFilteredResult(_0x4e62d1,_0xf105b2))[_0x5c15('0x48')](handleError(_0x4e62d1,null));};exports[_0x5c15('0x49')]=function(_0x37c8b9,_0x6b7ec){var _0xc5a02c={'raw':!![],'where':{'id':_0x37c8b9[_0x5c15('0x4a')]['id']}},_0x3d5b14={};_0x3d5b14[_0x5c15('0x35')]=_[_0x5c15('0x32')](db['SquareRecording'][_0x5c15('0x2e')]);_0x3d5b14[_0x5c15('0x31')]=_[_0x5c15('0x32')](_0x37c8b9['query']);_0x3d5b14[_0x5c15('0x33')]=_[_0x5c15('0x34')](_0x3d5b14['model'],_0x3d5b14[_0x5c15('0x31')]);_0xc5a02c[_0x5c15('0x36')]=_[_0x5c15('0x34')](_0x3d5b14['model'],qs[_0x5c15('0x37')](_0x37c8b9[_0x5c15('0x31')]['fields']));_0xc5a02c[_0x5c15('0x36')]=_0xc5a02c[_0x5c15('0x36')][_0x5c15('0x38')]?_0xc5a02c[_0x5c15('0x36')]:_0x3d5b14[_0x5c15('0x35')];if(_0x37c8b9[_0x5c15('0x31')][_0x5c15('0x44')]){_0xc5a02c[_0x5c15('0x45')]=[{'all':!![]}];}_0xc5a02c=_[_0x5c15('0x3f')]({},_0xc5a02c,_0x37c8b9[_0x5c15('0x42')]);return db[_0x5c15('0x43')][_0x5c15('0x4b')](_0xc5a02c)['then'](handleEntityNotFound(_0x6b7ec,null))[_0x5c15('0x27')](respondWithResult(_0x6b7ec,null))[_0x5c15('0x48')](handleError(_0x6b7ec,null));};exports['create']=function(_0x2ab85e,_0x5b25bf){return db['SquareRecording'][_0x5c15('0x4c')](_0x2ab85e[_0x5c15('0x4d')],{})[_0x5c15('0x27')](respondWithResult(_0x5b25bf,0xc9))[_0x5c15('0x48')](handleError(_0x5b25bf,null));};exports[_0x5c15('0x25')]=function(_0x4b0f7d,_0xa794ad){if(_0x4b0f7d[_0x5c15('0x4d')]['id']){delete _0x4b0f7d[_0x5c15('0x4d')]['id'];}return db[_0x5c15('0x43')]['find']({'where':{'id':_0x4b0f7d['params']['id']}})[_0x5c15('0x27')](handleEntityNotFound(_0xa794ad,null))['then'](saveUpdates(_0x4b0f7d[_0x5c15('0x4d')],null))[_0x5c15('0x27')](respondWithResult(_0xa794ad,null))[_0x5c15('0x48')](handleError(_0xa794ad,null));};exports[_0x5c15('0x4e')]=function(_0x502c57,_0x1d74c1,_0x1091a8){var _0x1abe99=require(_0x5c15('0x4f'));var _0x45bbbb=![];var _0x3a6b2b={};if(_0x502c57[_0x5c15('0x31')][_0x5c15('0x40')]&&_0x502c57[_0x5c15('0x31')][_0x5c15('0x40')]==='uniqueid'){_0x3a6b2b['uniqueid']=_0x502c57[_0x5c15('0x4a')]['id'];}else{_0x3a6b2b['id']=_0x502c57[_0x5c15('0x4a')]['id'];}return db[_0x5c15('0x43')][_0x5c15('0x4b')]({'where':_0x3a6b2b,'attributes':['id','savePath','filename'],'raw':!![]})[_0x5c15('0x27')](handleEntityNotFound(_0x1d74c1,null))[_0x5c15('0x27')](function(_0x574560){if(_0x574560){var _0x134975=_0x574560[_0x5c15('0x50')];var _0x5e2226=util[_0x5c15('0x51')]('%s.cypher',_0x134975);if(fs[_0x5c15('0x52')](_0x5e2226)){_0x45bbbb=!![];return _0x1abe99[_0x5c15('0x53')](_0x5e2226,_0x134975,config['secrets'][_0x5c15('0x54')])[_0x5c15('0x27')](function(){return _0x574560;});}return _0x574560;}})[_0x5c15('0x27')](function(_0x4a3519){if(_0x4a3519){var _0x32d80b=_0x4a3519[_0x5c15('0x50')];if(!fs[_0x5c15('0x52')](_0x32d80b)){throw new db[(_0x5c15('0x55'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x4a3519['filename']){return _0x1d74c1[_0x5c15('0x4e')](_0x32d80b,_0x4a3519[_0x5c15('0x56')]+path['extname'](_0x32d80b),function(){if(_0x45bbbb){fs[_0x5c15('0x57')](_0x32d80b);}});}else{return _0x1d74c1['download'](_0x32d80b,function(_0x206489){if(_0x45bbbb){fs[_0x5c15('0x57')](_0x32d80b);}});}}})[_0x5c15('0x48')](function(_0x4ba626){if(_0x4ba626[_0x5c15('0x58')]===_0x5c15('0x59')){_0x1d74c1[_0x5c15('0x1f')](0x194)['send'](_0x5c15('0x5a'));}else{return handleError(_0x1d74c1,null);}});};exports[_0x5c15('0x26')]=function(_0x12c1b6,_0x4a1b5f){return db[_0x5c15('0x43')][_0x5c15('0x4b')]({'where':{'id':_0x12c1b6[_0x5c15('0x4a')]['id']}})[_0x5c15('0x27')](function(_0x5661c1){if(_['isNil'](_0x5661c1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5661c1;})['then'](function(_0x547293){var _0x5068de=_0x547293[_0x5c15('0x50')];logger[_0x5c15('0x5b')](_0x5c15('0x5c'),_0x5068de);if(!_['isNil'](_0x547293[_0x5c15('0x50')])&&fs[_0x5c15('0x52')](_0x5068de)){logger[_0x5c15('0x5b')](_0x5c15('0x5d')+_0x5068de+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5c15('0x5e')](_0x5068de);}_0x5068de=_0x5068de+_0x5c15('0x5f');if(!_[_0x5c15('0x60')](_0x547293[_0x5c15('0x50')])&&fs[_0x5c15('0x52')](_0x5068de)){logger[_0x5c15('0x5b')](_0x5c15('0x5d')+_0x5068de+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5c15('0x5e')](_0x5068de);}return _0x547293;})[_0x5c15('0x27')](function(_0x35328c){if(!_0x35328c)throw new InternalError();return _0x35328c[_0x5c15('0x26')]();})[_0x5c15('0x27')](function(){_0x4a1b5f[_0x5c15('0x1f')](0xcc)[_0x5c15('0x19')]();})[_0x5c15('0x48')](handleError(_0x4a1b5f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 232fca6..5910887 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 _0x7096=['exports','define','SquareRecording','square_recordings','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x7096,0x10c));var _0x6709=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7096[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ea9=['rimraf','../../config/environment','exports','define','square_recordings','util','../../config/logger','api','moment','bluebird','path'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x7ea9,0xec));var _0x97ea=function(_0x2fbbb9,_0x4914b3){_0x2fbbb9=_0x2fbbb9-0x0;var _0x3da079=_0x7ea9[_0x2fbbb9];return _0x3da079;};'use strict';var _=require('lodash');var util=require(_0x97ea('0x0'));var logger=require(_0x97ea('0x1'))(_0x97ea('0x2'));var moment=require(_0x97ea('0x3'));var BPromise=require(_0x97ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97ea('0x5'));var rimraf=require(_0x97ea('0x6'));var config=require(_0x97ea('0x7'));var attributes=require('./squareRecording.attributes');module[_0x97ea('0x8')]=function(_0x112297,_0x74638c){return _0x112297[_0x97ea('0x9')]('SquareRecording',attributes,{'tableName':_0x97ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 116d430..600e02e 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 _0xbf2b=['jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','create','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xbf2b,0x14a));var _0xbbf2=function(_0x24ce62,_0x596ebc){_0x24ce62=_0x24ce62-0x0;var _0x35b532=_0xbf2b[_0x24ce62];return _0x35b532;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbf2('0x0'));var BPromise=require(_0xbbf2('0x1'));var rs=require(_0xbbf2('0x2'));var fs=require('fs');var Redis=require(_0xbbf2('0x3'));var db=require(_0xbbf2('0x4'))['db'];var utils=require(_0xbbf2('0x5'));var logger=require(_0xbbf2('0x6'))(_0xbbf2('0x7'));var config=require('../../config/environment');var jayson=require(_0xbbf2('0x8'));var client=jayson[_0xbbf2('0x9')][_0xbbf2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422bf4,_0x59a7fc,_0x4d914f){return new BPromise(function(_0x356cfe,_0x5d7daa){return client[_0xbbf2('0xb')](_0x422bf4,_0x4d914f)['then'](function(_0x2a71b1){logger[_0xbbf2('0xc')](_0xbbf2('0xd'),_0x59a7fc,_0xbbf2('0xe'));logger[_0xbbf2('0xf')](_0xbbf2('0x10'),_0x59a7fc,_0xbbf2('0xe'),JSON[_0xbbf2('0x11')](_0x2a71b1));if(_0x2a71b1['error']){if(_0x2a71b1[_0xbbf2('0x12')][_0xbbf2('0x13')]===0x1f4){logger[_0xbbf2('0x12')](_0xbbf2('0xd'),_0x59a7fc,_0x2a71b1[_0xbbf2('0x12')][_0xbbf2('0x14')]);return _0x5d7daa(_0x2a71b1[_0xbbf2('0x12')][_0xbbf2('0x14')]);}logger['error'](_0xbbf2('0xd'),_0x59a7fc,_0x2a71b1['error']['message']);return _0x356cfe(_0x2a71b1[_0xbbf2('0x12')][_0xbbf2('0x14')]);}else{logger[_0xbbf2('0xc')](_0xbbf2('0xd'),_0x59a7fc,_0xbbf2('0xe'));_0x356cfe(_0x2a71b1[_0xbbf2('0x15')][_0xbbf2('0x14')]);}})['catch'](function(_0xf87c24){logger[_0xbbf2('0x12')]('SquareRecording,\x20%s,\x20%s',_0x59a7fc,_0xf87c24);_0x5d7daa(_0xf87c24);});});}exports[_0xbbf2('0x16')]=function(_0x7e7c99){var _0x519d61=this;return new Promise(function(_0x7f777a,_0x2d9e50){return db['SquareRecording'][_0xbbf2('0x17')](_0x7e7c99['body'],{'raw':_0x7e7c99['options']?_0x7e7c99['options'][_0xbbf2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x54523e){logger[_0xbbf2('0xc')](_0xbbf2('0x16'),_0x7e7c99);logger[_0xbbf2('0xf')](_0xbbf2('0x16'),_0x7e7c99,JSON[_0xbbf2('0x11')](_0x54523e));_0x7f777a(_0x54523e);})[_0xbbf2('0x19')](function(_0x2441b3){logger[_0xbbf2('0x12')](_0xbbf2('0x16'),_0x2441b3['message'],_0x7e7c99);_0x2d9e50(_0x519d61[_0xbbf2('0x12')](0x1f4,_0x2441b3[_0xbbf2('0x14')]));});});}; \ No newline at end of file +var _0x2684=['debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','info','catch','CreateSquareRecording','body','options','raw','lodash','util','bluebird','randomstring','ioredis','rpc','jayson/promise','request','then','request\x20sent'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0x2684,0xd2));var _0x4268=function(_0x1e487a,_0x167e19){_0x1e487a=_0x1e487a-0x0;var _0x447356=_0x2684[_0x1e487a];return _0x447356;};'use strict';var _=require(_0x4268('0x0'));var util=require(_0x4268('0x1'));var moment=require('moment');var BPromise=require(_0x4268('0x2'));var rs=require(_0x4268('0x3'));var fs=require('fs');var Redis=require(_0x4268('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4268('0x5'));var config=require('../../config/environment');var jayson=require(_0x4268('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x68224f,_0x1bc52a,_0x5e65fc){return new BPromise(function(_0xf148fd,_0x519252){return client[_0x4268('0x7')](_0x68224f,_0x5e65fc)[_0x4268('0x8')](function(_0x221128){logger['info']('SquareRecording,\x20%s,\x20%s',_0x1bc52a,_0x4268('0x9'));logger[_0x4268('0xa')](_0x4268('0xb'),_0x1bc52a,_0x4268('0x9'),JSON['stringify'](_0x221128));if(_0x221128['error']){if(_0x221128[_0x4268('0xc')][_0x4268('0xd')]===0x1f4){logger[_0x4268('0xc')](_0x4268('0xe'),_0x1bc52a,_0x221128[_0x4268('0xc')][_0x4268('0xf')]);return _0x519252(_0x221128[_0x4268('0xc')][_0x4268('0xf')]);}logger[_0x4268('0xc')](_0x4268('0xe'),_0x1bc52a,_0x221128[_0x4268('0xc')][_0x4268('0xf')]);return _0xf148fd(_0x221128['error'][_0x4268('0xf')]);}else{logger[_0x4268('0x10')](_0x4268('0xe'),_0x1bc52a,_0x4268('0x9'));_0xf148fd(_0x221128['result'][_0x4268('0xf')]);}})[_0x4268('0x11')](function(_0xe493b7){logger[_0x4268('0xc')](_0x4268('0xe'),_0x1bc52a,_0xe493b7);_0x519252(_0xe493b7);});});}exports[_0x4268('0x12')]=function(_0x1070db){var _0x5a1868=this;return new Promise(function(_0x1a6029,_0x5de3c8){return db['SquareRecording']['create'](_0x1070db[_0x4268('0x13')],{'raw':_0x1070db[_0x4268('0x14')]?_0x1070db['options'][_0x4268('0x15')]===undefined?!![]:![]:!![]})[_0x4268('0x8')](function(_0x549ed6){logger['info'](_0x4268('0x12'),_0x1070db);logger[_0x4268('0xa')](_0x4268('0x12'),_0x1070db,JSON['stringify'](_0x549ed6));_0x1a6029(_0x549ed6);})['catch'](function(_0x23e4fb){logger[_0x4268('0xc')]('CreateSquareRecording',_0x23e4fb[_0x4268('0xf')],_0x1070db);_0x5de3c8(_0x5a1868[_0x4268('0xc')](0x1f4,_0x23e4fb[_0x4268('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1398401..69800f3 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4a74ec,_0x25e92d){var _0x427eb0=function(_0x3a5b70){while(--_0x3a5b70){_0x4a74ec['push'](_0x4a74ec['shift']());}};_0x427eb0(++_0x25e92d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4aba23,_0x5ea4d3){var _0x557516=function(_0x582f6c){while(--_0x582f6c){_0x4aba23['push'](_0x4aba23['shift']());}};_0x557516(++_0x5ea4d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 93a073c..ca0f666 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 _0x1f1a=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1a7d33,_0x8b06fe){var _0x1643ab=function(_0x425ce5){while(--_0x425ce5){_0x1a7d33['push'](_0x1a7d33['shift']());}};_0x1643ab(++_0x8b06fe);}(_0x1f1a,0xdc));var _0xa1f1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1f1a[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xa1f1('0x0'));module[_0xa1f1('0x1')]={'network':{'type':Sequelize[_0xa1f1('0x2')]},'network_script':{'type':Sequelize[_0xa1f1('0x2')]},'request':{'type':Sequelize[_0xa1f1('0x2')]},'channel':{'type':Sequelize[_0xa1f1('0x2')]},'language':{'type':Sequelize[_0xa1f1('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa1f1('0x2')]},'version':{'type':Sequelize[_0xa1f1('0x2')]},'callerid':{'type':Sequelize[_0xa1f1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa1f1('0x2')]},'callingani2':{'type':Sequelize[_0xa1f1('0x2')]},'callington':{'type':Sequelize[_0xa1f1('0x2')]},'callingtns':{'type':Sequelize[_0xa1f1('0x2')]},'dnid':{'type':Sequelize[_0xa1f1('0x2')]},'rdnis':{'type':Sequelize[_0xa1f1('0x2')]},'context':{'type':Sequelize[_0xa1f1('0x2')]},'extension':{'type':Sequelize[_0xa1f1('0x2')]},'priority':{'type':Sequelize[_0xa1f1('0x2')]},'enhanced':{'type':Sequelize[_0xa1f1('0x2')]},'accountcode':{'type':Sequelize[_0xa1f1('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa1f1('0x2')]},'joinAt':{'type':Sequelize[_0xa1f1('0x3')]},'leaveAt':{'type':Sequelize[_0xa1f1('0x3')]},'bot':{'type':Sequelize[_0xa1f1('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa83c=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x515990,_0x36e029){var _0x1b8003=function(_0x202622){while(--_0x202622){_0x515990['push'](_0x515990['shift']());}};_0x1b8003(++_0x36e029);}(_0xa83c,0xa2));var _0xca83=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0xa83c[_0x2e3107];return _0x833d69;};'use strict';var Sequelize=require(_0xca83('0x0'));module[_0xca83('0x1')]={'network':{'type':Sequelize[_0xca83('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xca83('0x2')]},'channel':{'type':Sequelize[_0xca83('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xca83('0x2')]},'version':{'type':Sequelize[_0xca83('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xca83('0x2')]},'callingani2':{'type':Sequelize[_0xca83('0x2')]},'callington':{'type':Sequelize[_0xca83('0x2')]},'callingtns':{'type':Sequelize[_0xca83('0x2')]},'dnid':{'type':Sequelize[_0xca83('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xca83('0x2')]},'priority':{'type':Sequelize[_0xca83('0x2')]},'enhanced':{'type':Sequelize[_0xca83('0x2')]},'accountcode':{'type':Sequelize[_0xca83('0x2')]},'threadid':{'type':Sequelize[_0xca83('0x2')]},'project_name':{'type':Sequelize[_0xca83('0x2')]},'joinAt':{'type':Sequelize[_0xca83('0x3')]},'leaveAt':{'type':Sequelize[_0xca83('0x3')]},'bot':{'type':Sequelize[_0xca83('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 334b672..1d35d7d 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 _0x80d0=['where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','intersection','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','apply','save','update','destroy','then','end','error','stack','name','send','index','SquareReport','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0xd3cdfc,_0x35f6d9){var _0x7793e4=function(_0x1b1375){while(--_0x1b1375){_0xd3cdfc['push'](_0xd3cdfc['shift']());}};_0x7793e4(++_0x35f6d9);}(_0x80d0,0xab));var _0x080d=function(_0x1ce7ea,_0x579f65){_0x1ce7ea=_0x1ce7ea-0x0;var _0x5c4a33=_0x80d0[_0x1ce7ea];return _0x5c4a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x080d('0x0'));var zipdir=require(_0x080d('0x1'));var jsonpatch=require(_0x080d('0x2'));var rp=require('request-promise');var moment=require(_0x080d('0x3'));var BPromise=require(_0x080d('0x4'));var Mustache=require(_0x080d('0x5'));var util=require(_0x080d('0x6'));var path=require(_0x080d('0x7'));var sox=require(_0x080d('0x8'));var csv=require('to-csv');var ejs=require(_0x080d('0x9'));var fs=require('fs');var fs_extra=require(_0x080d('0xa'));var _=require('lodash');var squel=require(_0x080d('0xb'));var crypto=require(_0x080d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x080d('0xd'));var toCsv=require(_0x080d('0xe'));var querystring=require(_0x080d('0xf'));var Papa=require('papaparse');var Redis=require(_0x080d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x080d('0x11'));var as=require(_0x080d('0x12'));var hardwareService=require(_0x080d('0x13'));var logger=require(_0x080d('0x14'))(_0x080d('0x15'));var utils=require(_0x080d('0x16'));var config=require(_0x080d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x080d('0x18'))['db'];function respondWithStatusCode(_0xac571d,_0x345329){_0x345329=_0x345329||0xcc;return function(_0x1decd0){if(_0x1decd0){return _0xac571d[_0x080d('0x19')](_0x345329);}return _0xac571d[_0x080d('0x1a')](_0x345329)['end']();};}function respondWithResult(_0x3d2d02,_0x4a4b6a){_0x4a4b6a=_0x4a4b6a||0xc8;return function(_0x3a9904){if(_0x3a9904){return _0x3d2d02['status'](_0x4a4b6a)['json'](_0x3a9904);}};}function respondWithFilteredResult(_0x544c79,_0x276251){return function(_0xb41d77){if(_0xb41d77){var _0x28f81a=typeof _0x276251['offset']===_0x080d('0x1b')&&typeof _0x276251[_0x080d('0x1c')]==='undefined';var _0x3eee16=_0xb41d77[_0x080d('0x1d')];var _0x5839bd=_0x28f81a?0x0:_0x276251[_0x080d('0x1e')];var _0x381401=_0x28f81a?_0xb41d77[_0x080d('0x1d')]:_0x276251['offset']+_0x276251[_0x080d('0x1c')];var _0x579a91;if(_0x381401>=_0x3eee16){_0x381401=_0x3eee16;_0x579a91=0xc8;}else{_0x579a91=0xce;}_0x544c79[_0x080d('0x1a')](_0x579a91);return _0x544c79[_0x080d('0x1f')]('Content-Range',_0x5839bd+'-'+_0x381401+'/'+_0x3eee16)[_0x080d('0x20')](_0xb41d77);}return null;};}function patchUpdates(_0x1d9eb3){return function(_0x4a78dc){try{jsonpatch[_0x080d('0x21')](_0x4a78dc,_0x1d9eb3,!![]);}catch(_0x394a7a){return BPromise['reject'](_0x394a7a);}return _0x4a78dc[_0x080d('0x22')]();};}function saveUpdates(_0x3049c3,_0x2ae3c4){return function(_0x2ed4bc){if(_0x2ed4bc){return _0x2ed4bc[_0x080d('0x23')](_0x3049c3)['then'](function(_0x24b34a){return _0x24b34a;});}return null;};}function removeEntity(_0x3732e7,_0x4ce93e){return function(_0x235a57){if(_0x235a57){return _0x235a57[_0x080d('0x24')]()[_0x080d('0x25')](function(){_0x3732e7[_0x080d('0x1a')](0xcc)[_0x080d('0x26')]();});}};}function handleEntityNotFound(_0x2d0423,_0x2ba711){return function(_0x1a858e){if(!_0x1a858e){_0x2d0423['sendStatus'](0x194);}return _0x1a858e;};}function handleError(_0x1ef720,_0x27e21b){_0x27e21b=_0x27e21b||0x1f4;return function(_0x29d221){logger[_0x080d('0x27')](_0x29d221[_0x080d('0x28')]);if(_0x29d221[_0x080d('0x29')]){delete _0x29d221[_0x080d('0x29')];}_0x1ef720[_0x080d('0x1a')](_0x27e21b)[_0x080d('0x2a')](_0x29d221);};}exports[_0x080d('0x2b')]=function(_0x2ac003,_0x371891){var _0x447495={},_0x207dae={},_0x51c7d8={'count':0x0,'rows':[]};var _0x33e62a=_['map'](db[_0x080d('0x2c')][_0x080d('0x2d')],function(_0x52d38c){return{'name':_0x52d38c['fieldName'],'type':_0x52d38c['type'][_0x080d('0x2e')]};});_0x207dae[_0x080d('0x2f')]=_['map'](_0x33e62a,_0x080d('0x29'));_0x207dae['query']=_['keys'](_0x2ac003[_0x080d('0x30')]);_0x207dae[_0x080d('0x31')]=_['intersection'](_0x207dae[_0x080d('0x2f')],_0x207dae[_0x080d('0x30')]);_0x447495[_0x080d('0x32')]=_['intersection'](_0x207dae[_0x080d('0x2f')],qs[_0x080d('0x33')](_0x2ac003[_0x080d('0x30')][_0x080d('0x33')]));_0x447495[_0x080d('0x32')]=_0x447495[_0x080d('0x32')][_0x080d('0x34')]?_0x447495[_0x080d('0x32')]:_0x207dae['model'];if(!_0x2ac003[_0x080d('0x30')][_0x080d('0x35')](_0x080d('0x36'))){_0x447495['limit']=qs[_0x080d('0x1c')](_0x2ac003[_0x080d('0x30')]['limit']);_0x447495[_0x080d('0x1e')]=qs['offset'](_0x2ac003[_0x080d('0x30')]['offset']);}_0x447495[_0x080d('0x37')]=qs[_0x080d('0x38')](_0x2ac003[_0x080d('0x30')][_0x080d('0x38')]);_0x447495[_0x080d('0x39')]=qs['filters'](_[_0x080d('0x3a')](_0x2ac003[_0x080d('0x30')],_0x207dae[_0x080d('0x31')]),_0x33e62a);if(_0x2ac003[_0x080d('0x30')][_0x080d('0x3b')]){_0x447495[_0x080d('0x39')]=_[_0x080d('0x3c')](_0x447495[_0x080d('0x39')],{'$or':_['map'](_0x33e62a,function(_0x1b2c2f){if(_0x1b2c2f[_0x080d('0x3d')]!==_0x080d('0x3e')){var _0x2ccc11={};_0x2ccc11[_0x1b2c2f['name']]={'$like':'%'+_0x2ac003[_0x080d('0x30')]['filter']+'%'};return _0x2ccc11;}})});}_0x447495=_['merge']({},_0x447495,_0x2ac003['options']);var _0x3f59e3={'where':_0x447495[_0x080d('0x39')]};return db['SquareReport'][_0x080d('0x1d')](_0x3f59e3)[_0x080d('0x25')](function(_0x22ce21){_0x51c7d8['count']=_0x22ce21;if(_0x2ac003['query'][_0x080d('0x3f')]){_0x447495[_0x080d('0x40')]=[{'all':!![]}];}return db[_0x080d('0x2c')][_0x080d('0x41')](_0x447495);})[_0x080d('0x25')](function(_0x2862e8){_0x51c7d8['rows']=_0x2862e8;return _0x51c7d8;})[_0x080d('0x25')](respondWithFilteredResult(_0x371891,_0x447495))[_0x080d('0x42')](handleError(_0x371891,null));};exports[_0x080d('0x43')]=function(_0x39459b,_0x4b7242){var _0x414b3d={'raw':!![],'where':{'id':_0x39459b[_0x080d('0x44')]['id']}},_0x1d5938={};_0x1d5938[_0x080d('0x2f')]=_[_0x080d('0x45')](db[_0x080d('0x2c')][_0x080d('0x2d')]);_0x1d5938[_0x080d('0x30')]=_[_0x080d('0x45')](_0x39459b[_0x080d('0x30')]);_0x1d5938[_0x080d('0x31')]=_[_0x080d('0x46')](_0x1d5938['model'],_0x1d5938[_0x080d('0x30')]);_0x414b3d['attributes']=_[_0x080d('0x46')](_0x1d5938['model'],qs[_0x080d('0x33')](_0x39459b[_0x080d('0x30')][_0x080d('0x33')]));_0x414b3d[_0x080d('0x32')]=_0x414b3d[_0x080d('0x32')][_0x080d('0x34')]?_0x414b3d[_0x080d('0x32')]:_0x1d5938[_0x080d('0x2f')];if(_0x39459b[_0x080d('0x30')][_0x080d('0x3f')]){_0x414b3d[_0x080d('0x40')]=[{'all':!![]}];}_0x414b3d=_[_0x080d('0x3c')]({},_0x414b3d,_0x39459b[_0x080d('0x47')]);return db[_0x080d('0x2c')][_0x080d('0x48')](_0x414b3d)['then'](handleEntityNotFound(_0x4b7242,null))[_0x080d('0x25')](respondWithResult(_0x4b7242,null))[_0x080d('0x42')](handleError(_0x4b7242,null));};exports[_0x080d('0x49')]=function(_0x43cb91,_0x4330b8){return db[_0x080d('0x2c')]['create'](_0x43cb91[_0x080d('0x4a')],{})['then'](respondWithResult(_0x4330b8,0xc9))['catch'](handleError(_0x4330b8,null));};exports[_0x080d('0x23')]=function(_0x49531a,_0x323cc3){if(_0x49531a[_0x080d('0x4a')]['id']){delete _0x49531a[_0x080d('0x4a')]['id'];}return db[_0x080d('0x2c')][_0x080d('0x48')]({'where':{'id':_0x49531a[_0x080d('0x44')]['id']}})['then'](handleEntityNotFound(_0x323cc3,null))[_0x080d('0x25')](saveUpdates(_0x49531a[_0x080d('0x4a')],null))[_0x080d('0x25')](respondWithResult(_0x323cc3,null))[_0x080d('0x42')](handleError(_0x323cc3,null));};exports[_0x080d('0x24')]=function(_0x400714,_0x154394){return db[_0x080d('0x2c')][_0x080d('0x48')]({'where':{'id':_0x400714['params']['id']}})[_0x080d('0x25')](handleEntityNotFound(_0x154394,null))['then'](removeEntity(_0x154394,null))[_0x080d('0x42')](handleError(_0x154394,null));};exports['describe']=function(_0x4c5aec,_0x55c766){return db['SquareReport'][_0x080d('0x4b')]()[_0x080d('0x25')](respondWithResult(_0x55c766,null))['catch'](handleError(_0x55c766,null));}; \ No newline at end of file +var _0xdc69=['keys','intersection','length','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch'];(function(_0x1e748d,_0x24d3a9){var _0x25ba57=function(_0x3e3f98){while(--_0x3e3f98){_0x1e748d['push'](_0x1e748d['shift']());}};_0x25ba57(++_0x24d3a9);}(_0xdc69,0x1d7));var _0x9dc6=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xdc69[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0x9dc6('0x0'));var rimraf=require(_0x9dc6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dc6('0x2'));var rp=require(_0x9dc6('0x3'));var moment=require('moment');var BPromise=require(_0x9dc6('0x4'));var Mustache=require('mustache');var util=require(_0x9dc6('0x5'));var path=require(_0x9dc6('0x6'));var sox=require(_0x9dc6('0x7'));var csv=require(_0x9dc6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9dc6('0x9'));var _=require('lodash');var squel=require(_0x9dc6('0xa'));var crypto=require(_0x9dc6('0xb'));var jsforce=require(_0x9dc6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dc6('0xd'));var Papa=require(_0x9dc6('0xe'));var Redis=require('ioredis');var authService=require(_0x9dc6('0xf'));var qs=require(_0x9dc6('0x10'));var as=require(_0x9dc6('0x11'));var hardwareService=require(_0x9dc6('0x12'));var logger=require(_0x9dc6('0x13'))(_0x9dc6('0x14'));var utils=require(_0x9dc6('0x15'));var config=require(_0x9dc6('0x16'));var licenseUtil=require(_0x9dc6('0x17'));var db=require(_0x9dc6('0x18'))['db'];function respondWithStatusCode(_0x281345,_0x5ec013){_0x5ec013=_0x5ec013||0xcc;return function(_0x4cf5b4){if(_0x4cf5b4){return _0x281345[_0x9dc6('0x19')](_0x5ec013);}return _0x281345['status'](_0x5ec013)['end']();};}function respondWithResult(_0x24586c,_0x568704){_0x568704=_0x568704||0xc8;return function(_0x45ed0b){if(_0x45ed0b){return _0x24586c[_0x9dc6('0x1a')](_0x568704)['json'](_0x45ed0b);}};}function respondWithFilteredResult(_0x5397d4,_0x159f88){return function(_0x185e86){if(_0x185e86){var _0x27388d=typeof _0x159f88[_0x9dc6('0x1b')]===_0x9dc6('0x1c')&&typeof _0x159f88[_0x9dc6('0x1d')]===_0x9dc6('0x1c');var _0x19d60c=_0x185e86['count'];var _0x5bc829=_0x27388d?0x0:_0x159f88[_0x9dc6('0x1b')];var _0x5977c7=_0x27388d?_0x185e86[_0x9dc6('0x1e')]:_0x159f88['offset']+_0x159f88[_0x9dc6('0x1d')];var _0x204304;if(_0x5977c7>=_0x19d60c){_0x5977c7=_0x19d60c;_0x204304=0xc8;}else{_0x204304=0xce;}_0x5397d4[_0x9dc6('0x1a')](_0x204304);return _0x5397d4[_0x9dc6('0x1f')]('Content-Range',_0x5bc829+'-'+_0x5977c7+'/'+_0x19d60c)[_0x9dc6('0x20')](_0x185e86);}return null;};}function patchUpdates(_0x20751c){return function(_0x19aa0e){try{jsonpatch[_0x9dc6('0x21')](_0x19aa0e,_0x20751c,!![]);}catch(_0x348ccb){return BPromise[_0x9dc6('0x22')](_0x348ccb);}return _0x19aa0e[_0x9dc6('0x23')]();};}function saveUpdates(_0x5b9b15,_0x51fd4a){return function(_0xc5a6cf){if(_0xc5a6cf){return _0xc5a6cf['update'](_0x5b9b15)['then'](function(_0x123859){return _0x123859;});}return null;};}function removeEntity(_0x21dcd7,_0x15b44c){return function(_0x1d7e3a){if(_0x1d7e3a){return _0x1d7e3a[_0x9dc6('0x24')]()['then'](function(){_0x21dcd7[_0x9dc6('0x1a')](0xcc)[_0x9dc6('0x25')]();});}};}function handleEntityNotFound(_0x4944e6,_0x54a34a){return function(_0x5838d5){if(!_0x5838d5){_0x4944e6['sendStatus'](0x194);}return _0x5838d5;};}function handleError(_0x420487,_0x2c1ecb){_0x2c1ecb=_0x2c1ecb||0x1f4;return function(_0x4ff76f){logger[_0x9dc6('0x26')](_0x4ff76f[_0x9dc6('0x27')]);if(_0x4ff76f['name']){delete _0x4ff76f[_0x9dc6('0x28')];}_0x420487['status'](_0x2c1ecb)[_0x9dc6('0x29')](_0x4ff76f);};}exports[_0x9dc6('0x2a')]=function(_0x18fa3c,_0x5acaf3){var _0x4b5d30={},_0x3db0b9={},_0x469dc9={'count':0x0,'rows':[]};var _0x31ef73=_[_0x9dc6('0x2b')](db[_0x9dc6('0x2c')][_0x9dc6('0x2d')],function(_0x33bb83){return{'name':_0x33bb83['fieldName'],'type':_0x33bb83[_0x9dc6('0x2e')][_0x9dc6('0x2f')]};});_0x3db0b9[_0x9dc6('0x30')]=_[_0x9dc6('0x2b')](_0x31ef73,'name');_0x3db0b9[_0x9dc6('0x31')]=_['keys'](_0x18fa3c['query']);_0x3db0b9[_0x9dc6('0x32')]=_['intersection'](_0x3db0b9[_0x9dc6('0x30')],_0x3db0b9[_0x9dc6('0x31')]);_0x4b5d30[_0x9dc6('0x33')]=_['intersection'](_0x3db0b9[_0x9dc6('0x30')],qs[_0x9dc6('0x34')](_0x18fa3c[_0x9dc6('0x31')]['fields']));_0x4b5d30['attributes']=_0x4b5d30['attributes']['length']?_0x4b5d30[_0x9dc6('0x33')]:_0x3db0b9[_0x9dc6('0x30')];if(!_0x18fa3c[_0x9dc6('0x31')]['hasOwnProperty'](_0x9dc6('0x35'))){_0x4b5d30[_0x9dc6('0x1d')]=qs[_0x9dc6('0x1d')](_0x18fa3c['query'][_0x9dc6('0x1d')]);_0x4b5d30['offset']=qs[_0x9dc6('0x1b')](_0x18fa3c[_0x9dc6('0x31')][_0x9dc6('0x1b')]);}_0x4b5d30[_0x9dc6('0x36')]=qs[_0x9dc6('0x37')](_0x18fa3c[_0x9dc6('0x31')][_0x9dc6('0x37')]);_0x4b5d30[_0x9dc6('0x38')]=qs['filters'](_[_0x9dc6('0x39')](_0x18fa3c[_0x9dc6('0x31')],_0x3db0b9[_0x9dc6('0x32')]),_0x31ef73);if(_0x18fa3c[_0x9dc6('0x31')]['filter']){_0x4b5d30[_0x9dc6('0x38')]=_[_0x9dc6('0x3a')](_0x4b5d30[_0x9dc6('0x38')],{'$or':_[_0x9dc6('0x2b')](_0x31ef73,function(_0x46439d){if(_0x46439d[_0x9dc6('0x2e')]!==_0x9dc6('0x3b')){var _0x40b087={};_0x40b087[_0x46439d[_0x9dc6('0x28')]]={'$like':'%'+_0x18fa3c[_0x9dc6('0x31')][_0x9dc6('0x3c')]+'%'};return _0x40b087;}})});}_0x4b5d30=_['merge']({},_0x4b5d30,_0x18fa3c[_0x9dc6('0x3d')]);var _0x56d292={'where':_0x4b5d30['where']};return db[_0x9dc6('0x2c')][_0x9dc6('0x1e')](_0x56d292)[_0x9dc6('0x3e')](function(_0x5100d4){_0x469dc9['count']=_0x5100d4;if(_0x18fa3c['query'][_0x9dc6('0x3f')]){_0x4b5d30[_0x9dc6('0x40')]=[{'all':!![]}];}return db[_0x9dc6('0x2c')][_0x9dc6('0x41')](_0x4b5d30);})[_0x9dc6('0x3e')](function(_0x2c6062){_0x469dc9[_0x9dc6('0x42')]=_0x2c6062;return _0x469dc9;})['then'](respondWithFilteredResult(_0x5acaf3,_0x4b5d30))[_0x9dc6('0x43')](handleError(_0x5acaf3,null));};exports['show']=function(_0xf4bb33,_0x58470b){var _0x81cccd={'raw':!![],'where':{'id':_0xf4bb33['params']['id']}},_0x486d00={};_0x486d00[_0x9dc6('0x30')]=_[_0x9dc6('0x44')](db[_0x9dc6('0x2c')][_0x9dc6('0x2d')]);_0x486d00['query']=_['keys'](_0xf4bb33[_0x9dc6('0x31')]);_0x486d00[_0x9dc6('0x32')]=_[_0x9dc6('0x45')](_0x486d00[_0x9dc6('0x30')],_0x486d00[_0x9dc6('0x31')]);_0x81cccd[_0x9dc6('0x33')]=_[_0x9dc6('0x45')](_0x486d00[_0x9dc6('0x30')],qs[_0x9dc6('0x34')](_0xf4bb33[_0x9dc6('0x31')][_0x9dc6('0x34')]));_0x81cccd['attributes']=_0x81cccd['attributes'][_0x9dc6('0x46')]?_0x81cccd['attributes']:_0x486d00[_0x9dc6('0x30')];if(_0xf4bb33[_0x9dc6('0x31')][_0x9dc6('0x3f')]){_0x81cccd['include']=[{'all':!![]}];}_0x81cccd=_['merge']({},_0x81cccd,_0xf4bb33[_0x9dc6('0x3d')]);return db['SquareReport'][_0x9dc6('0x47')](_0x81cccd)[_0x9dc6('0x3e')](handleEntityNotFound(_0x58470b,null))[_0x9dc6('0x3e')](respondWithResult(_0x58470b,null))[_0x9dc6('0x43')](handleError(_0x58470b,null));};exports[_0x9dc6('0x48')]=function(_0x599898,_0x18e2bb){return db[_0x9dc6('0x2c')][_0x9dc6('0x48')](_0x599898[_0x9dc6('0x49')],{})[_0x9dc6('0x3e')](respondWithResult(_0x18e2bb,0xc9))[_0x9dc6('0x43')](handleError(_0x18e2bb,null));};exports[_0x9dc6('0x4a')]=function(_0x1af9e8,_0x5c50dd){if(_0x1af9e8[_0x9dc6('0x49')]['id']){delete _0x1af9e8[_0x9dc6('0x49')]['id'];}return db['SquareReport'][_0x9dc6('0x47')]({'where':{'id':_0x1af9e8[_0x9dc6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c50dd,null))[_0x9dc6('0x3e')](saveUpdates(_0x1af9e8[_0x9dc6('0x49')],null))[_0x9dc6('0x3e')](respondWithResult(_0x5c50dd,null))[_0x9dc6('0x43')](handleError(_0x5c50dd,null));};exports[_0x9dc6('0x24')]=function(_0x45d9e2,_0x27bf08){return db['SquareReport'][_0x9dc6('0x47')]({'where':{'id':_0x45d9e2['params']['id']}})[_0x9dc6('0x3e')](handleEntityNotFound(_0x27bf08,null))[_0x9dc6('0x3e')](removeEntity(_0x27bf08,null))[_0x9dc6('0x43')](handleError(_0x27bf08,null));};exports[_0x9dc6('0x4c')]=function(_0x2000f9,_0x52a94a){return db[_0x9dc6('0x2c')][_0x9dc6('0x4c')]()['then'](respondWithResult(_0x52a94a,null))[_0x9dc6('0x43')](handleError(_0x52a94a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 471cffb..d366faf 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 _0x2680=['uid_pname','uniqueid','project_name','leaveAt','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareReport','report_square'];(function(_0x1a4792,_0xe90ee7){var _0x5d6a37=function(_0x1d0521){while(--_0x1d0521){_0x1a4792['push'](_0x1a4792['shift']());}};_0x5d6a37(++_0xe90ee7);}(_0x2680,0x16c));var _0x0268=function(_0x2ba968,_0x2c1c9f){_0x2ba968=_0x2ba968-0x0;var _0x1e7bf8=_0x2680[_0x2ba968];return _0x1e7bf8;};'use strict';var _=require('lodash');var util=require(_0x0268('0x0'));var logger=require('../../config/logger')(_0x0268('0x1'));var moment=require(_0x0268('0x2'));var BPromise=require(_0x0268('0x3'));var rp=require(_0x0268('0x4'));var fs=require('fs');var path=require(_0x0268('0x5'));var rimraf=require(_0x0268('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x0268('0x7')]=function(_0x7b8d7c,_0x1c5d6b){return _0x7b8d7c[_0x0268('0x8')](_0x0268('0x9'),attributes,{'tableName':_0x0268('0xa'),'paranoid':![],'indexes':[{'name':_0x0268('0xb'),'fields':[_0x0268('0xc'),_0x0268('0xd')]},{'name':_0x0268('0xe'),'fields':[_0x0268('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61a2=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareReport'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x61a2,0xd4));var _0x261a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x61a2[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x261a('0x0'));var util=require(_0x261a('0x1'));var logger=require(_0x261a('0x2'))(_0x261a('0x3'));var moment=require(_0x261a('0x4'));var BPromise=require(_0x261a('0x5'));var rp=require(_0x261a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x261a('0x7'));var config=require(_0x261a('0x8'));var attributes=require('./squareReport.attributes');module[_0x261a('0x9')]=function(_0x2701a,_0x365e2a){return _0x2701a[_0x261a('0xa')](_0x261a('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x261a('0xc'),'fields':[_0x261a('0xd'),_0x261a('0xe')]},{'name':_0x261a('0xf'),'fields':[_0x261a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6941190..2c21899 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 _0x7929=['jayson/promise','client','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','options','then','CreateSquareReport','UpdateSquareReport','SquareReport','update','body','raw','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5cf5fd,_0x4bca34){var _0x4a53ec=function(_0x40f63d){while(--_0x40f63d){_0x5cf5fd['push'](_0x5cf5fd['shift']());}};_0x4a53ec(++_0x4bca34);}(_0x7929,0x6f));var _0x9792=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x7929[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x9792('0x0'));var util=require(_0x9792('0x1'));var moment=require('moment');var BPromise=require(_0x9792('0x2'));var rs=require(_0x9792('0x3'));var fs=require('fs');var Redis=require(_0x9792('0x4'));var db=require(_0x9792('0x5'))['db'];var utils=require(_0x9792('0x6'));var logger=require('../../config/logger')(_0x9792('0x7'));var config=require(_0x9792('0x8'));var jayson=require(_0x9792('0x9'));var client=jayson[_0x9792('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18a5dc,_0x1a35a6,_0x309eec){return new BPromise(function(_0x3197cb,_0x4c37bd){return client['request'](_0x18a5dc,_0x309eec)['then'](function(_0x14f681){logger[_0x9792('0xb')](_0x9792('0xc'),_0x1a35a6,_0x9792('0xd'));logger[_0x9792('0xe')](_0x9792('0xf'),_0x1a35a6,_0x9792('0xd'),JSON[_0x9792('0x10')](_0x14f681));if(_0x14f681[_0x9792('0x11')]){if(_0x14f681[_0x9792('0x11')]['code']===0x1f4){logger[_0x9792('0x11')](_0x9792('0xc'),_0x1a35a6,_0x14f681[_0x9792('0x11')][_0x9792('0x12')]);return _0x4c37bd(_0x14f681[_0x9792('0x11')]['message']);}logger[_0x9792('0x11')](_0x9792('0xc'),_0x1a35a6,_0x14f681[_0x9792('0x11')][_0x9792('0x12')]);return _0x3197cb(_0x14f681[_0x9792('0x11')][_0x9792('0x12')]);}else{logger[_0x9792('0xb')](_0x9792('0xc'),_0x1a35a6,'request\x20sent');_0x3197cb(_0x14f681['result']['message']);}})[_0x9792('0x13')](function(_0x4097fd){logger[_0x9792('0x11')](_0x9792('0xc'),_0x1a35a6,_0x4097fd);_0x4c37bd(_0x4097fd);});});}exports['CreateSquareReport']=function(_0x33c1b2){var _0x39bd63=this;return new Promise(function(_0x4b91be,_0x449f7c){return db['SquareReport']['create'](_0x33c1b2['body'],{'raw':_0x33c1b2[_0x9792('0x14')]?_0x33c1b2['options']['raw']===undefined?!![]:![]:!![]})[_0x9792('0x15')](function(_0xfc57a){logger['info']('CreateSquareReport',_0x33c1b2);logger[_0x9792('0xe')](_0x9792('0x16'),_0x33c1b2,JSON[_0x9792('0x10')](_0xfc57a));_0x4b91be(_0xfc57a);})[_0x9792('0x13')](function(_0x4ca204){logger[_0x9792('0x11')](_0x9792('0x16'),_0x4ca204[_0x9792('0x12')],_0x33c1b2);_0x449f7c(_0x39bd63[_0x9792('0x11')](0x1f4,_0x4ca204[_0x9792('0x12')]));});});};exports[_0x9792('0x17')]=function(_0x3d87b0){var _0x12b735=this;return new Promise(function(_0x6c89,_0x5ecdb3){return db[_0x9792('0x18')][_0x9792('0x19')](_0x3d87b0[_0x9792('0x1a')],{'raw':_0x3d87b0['options']?_0x3d87b0[_0x9792('0x14')][_0x9792('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d87b0[_0x9792('0x14')]?_0x3d87b0[_0x9792('0x14')][_0x9792('0x1c')]||null:null,'attributes':_0x3d87b0[_0x9792('0x14')]?_0x3d87b0[_0x9792('0x14')]['attributes']||null:null,'limit':_0x3d87b0[_0x9792('0x14')]?_0x3d87b0[_0x9792('0x14')][_0x9792('0x1d')]||null:null})[_0x9792('0x15')](function(_0x54ee9f){logger[_0x9792('0xb')](_0x9792('0x17'),_0x3d87b0);logger[_0x9792('0xe')]('UpdateSquareReport',_0x3d87b0,JSON[_0x9792('0x10')](_0x54ee9f));_0x6c89(_0x54ee9f);})[_0x9792('0x13')](function(_0x1d62a3){logger[_0x9792('0x11')](_0x9792('0x17'),_0x1d62a3[_0x9792('0x12')],_0x3d87b0);_0x5ecdb3(_0x12b735[_0x9792('0x11')](0x1f4,_0x1d62a3['message']));});});}; \ No newline at end of file +var _0x2786=['catch','CreateSquareReport','create','body','options','raw','debug','UpdateSquareReport','SquareReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4cb214,_0x2f512c){var _0x51a4d4=function(_0x3c6dae){while(--_0x3c6dae){_0x4cb214['push'](_0x4cb214['shift']());}};_0x51a4d4(++_0x2f512c);}(_0x2786,0xa0));var _0x6278=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2786[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x6278('0x0'));var util=require(_0x6278('0x1'));var moment=require(_0x6278('0x2'));var BPromise=require('bluebird');var rs=require(_0x6278('0x3'));var fs=require('fs');var Redis=require(_0x6278('0x4'));var db=require(_0x6278('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6278('0x6'))(_0x6278('0x7'));var config=require(_0x6278('0x8'));var jayson=require(_0x6278('0x9'));var client=jayson[_0x6278('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31abd1,_0x1c1f03,_0x109912){return new BPromise(function(_0x2c0375,_0x2988a8){return client[_0x6278('0xb')](_0x31abd1,_0x109912)[_0x6278('0xc')](function(_0x204394){logger[_0x6278('0xd')](_0x6278('0xe'),_0x1c1f03,_0x6278('0xf'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1c1f03,_0x6278('0xf'),JSON[_0x6278('0x10')](_0x204394));if(_0x204394[_0x6278('0x11')]){if(_0x204394['error'][_0x6278('0x12')]===0x1f4){logger['error'](_0x6278('0xe'),_0x1c1f03,_0x204394[_0x6278('0x11')]['message']);return _0x2988a8(_0x204394['error'][_0x6278('0x13')]);}logger[_0x6278('0x11')](_0x6278('0xe'),_0x1c1f03,_0x204394[_0x6278('0x11')][_0x6278('0x13')]);return _0x2c0375(_0x204394[_0x6278('0x11')][_0x6278('0x13')]);}else{logger[_0x6278('0xd')](_0x6278('0xe'),_0x1c1f03,_0x6278('0xf'));_0x2c0375(_0x204394['result'][_0x6278('0x13')]);}})[_0x6278('0x14')](function(_0xefead3){logger[_0x6278('0x11')](_0x6278('0xe'),_0x1c1f03,_0xefead3);_0x2988a8(_0xefead3);});});}exports[_0x6278('0x15')]=function(_0x31a881){var _0x1b8442=this;return new Promise(function(_0x19ca7c,_0x109c4b){return db['SquareReport'][_0x6278('0x16')](_0x31a881[_0x6278('0x17')],{'raw':_0x31a881[_0x6278('0x18')]?_0x31a881[_0x6278('0x18')][_0x6278('0x19')]===undefined?!![]:![]:!![]})[_0x6278('0xc')](function(_0x14898d){logger[_0x6278('0xd')]('CreateSquareReport',_0x31a881);logger[_0x6278('0x1a')](_0x6278('0x15'),_0x31a881,JSON[_0x6278('0x10')](_0x14898d));_0x19ca7c(_0x14898d);})[_0x6278('0x14')](function(_0x5e9676){logger[_0x6278('0x11')](_0x6278('0x15'),_0x5e9676[_0x6278('0x13')],_0x31a881);_0x109c4b(_0x1b8442[_0x6278('0x11')](0x1f4,_0x5e9676[_0x6278('0x13')]));});});};exports[_0x6278('0x1b')]=function(_0x51ebf9){var _0x3ad957=this;return new Promise(function(_0x10e634,_0x2cc12e){return db[_0x6278('0x1c')]['update'](_0x51ebf9[_0x6278('0x17')],{'raw':_0x51ebf9['options']?_0x51ebf9[_0x6278('0x18')][_0x6278('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ebf9['options']?_0x51ebf9[_0x6278('0x18')][_0x6278('0x1d')]||null:null,'attributes':_0x51ebf9['options']?_0x51ebf9[_0x6278('0x18')]['attributes']||null:null,'limit':_0x51ebf9[_0x6278('0x18')]?_0x51ebf9[_0x6278('0x18')]['limit']||null:null})[_0x6278('0xc')](function(_0x49e553){logger['info']('UpdateSquareReport',_0x51ebf9);logger[_0x6278('0x1a')](_0x6278('0x1b'),_0x51ebf9,JSON[_0x6278('0x10')](_0x49e553));_0x10e634(_0x49e553);})[_0x6278('0x14')](function(_0x1e4c93){logger[_0x6278('0x11')](_0x6278('0x1b'),_0x1e4c93[_0x6278('0x13')],_0x51ebf9);_0x2cc12e(_0x3ad957[_0x6278('0x11')](0x1f4,_0x1e4c93['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 646ca14..be792a9 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 _0x71b1=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x71b1,0x140));var _0x171b=function(_0x1bca14,_0x2db9d8){_0x1bca14=_0x1bca14-0x0;var _0x348df5=_0x71b1[_0x1bca14];return _0x348df5;};'use strict';var multer=require(_0x171b('0x0'));var util=require(_0x171b('0x1'));var path=require(_0x171b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x171b('0x3'));var auth=require(_0x171b('0x4'));var interaction=require(_0x171b('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x171b('0x6')](),controller[_0x171b('0x7')]);router[_0x171b('0x8')](_0x171b('0x9'),auth[_0x171b('0x6')](),controller[_0x171b('0xa')]);router[_0x171b('0x8')](_0x171b('0xb'),auth[_0x171b('0x6')](),controller[_0x171b('0xc')]);router[_0x171b('0xd')]('/',auth[_0x171b('0x6')](),controller[_0x171b('0xe')]);router['put'](_0x171b('0xb'),auth[_0x171b('0x6')](),controller[_0x171b('0xf')]);router[_0x171b('0x10')](_0x171b('0xb'),auth[_0x171b('0x6')](),controller[_0x171b('0x11')]);module[_0x171b('0x12')]=router; \ No newline at end of file +var _0xbcd1=['express','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbcd1,0x10b));var _0x1bcd=function(_0x2fd719,_0xa1c429){_0x2fd719=_0x2fd719-0x0;var _0x3fcc83=_0xbcd1[_0x2fd719];return _0x3fcc83;};'use strict';var multer=require(_0x1bcd('0x0'));var util=require(_0x1bcd('0x1'));var path=require('path');var timeout=require(_0x1bcd('0x2'));var express=require(_0x1bcd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1bcd('0x4'));var controller=require('./squareReportDetail.controller');router[_0x1bcd('0x5')]('/',auth[_0x1bcd('0x6')](),controller[_0x1bcd('0x7')]);router[_0x1bcd('0x5')](_0x1bcd('0x8'),auth[_0x1bcd('0x6')](),controller[_0x1bcd('0x9')]);router[_0x1bcd('0x5')](_0x1bcd('0xa'),auth[_0x1bcd('0x6')](),controller[_0x1bcd('0xb')]);router[_0x1bcd('0xc')]('/',auth[_0x1bcd('0x6')](),controller[_0x1bcd('0xd')]);router[_0x1bcd('0xe')](_0x1bcd('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1bcd('0xf')](_0x1bcd('0xa'),auth['isAuthenticated'](),controller[_0x1bcd('0x10')]);module[_0x1bcd('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 135ece7..e3416e3 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 _0x14d3=['TEXT','sequelize','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x14d3,0x1bd));var _0x314d=function(_0x2ee772,_0x4619a3){_0x2ee772=_0x2ee772-0x0;var _0x52af49=_0x14d3[_0x2ee772];return _0x52af49;};'use strict';var Sequelize=require(_0x314d('0x0'));module[_0x314d('0x1')]={'uniqueid':{'type':Sequelize[_0x314d('0x2')]},'node':{'type':Sequelize[_0x314d('0x2')]},'application':{'type':Sequelize[_0x314d('0x2')]},'data':{'type':Sequelize[_0x314d('0x3')]},'project_name':{'type':Sequelize[_0x314d('0x2')]},'callerid':{'type':Sequelize[_0x314d('0x2')]}}; \ No newline at end of file +var _0x8f2c=['exports','STRING','TEXT','sequelize'];(function(_0x2db1a9,_0x3bbf77){var _0x1d108c=function(_0x28c63b){while(--_0x28c63b){_0x2db1a9['push'](_0x2db1a9['shift']());}};_0x1d108c(++_0x3bbf77);}(_0x8f2c,0x143));var _0xc8f2=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8f2c[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xc8f2('0x0'));module[_0xc8f2('0x1')]={'uniqueid':{'type':Sequelize[_0xc8f2('0x2')]},'node':{'type':Sequelize[_0xc8f2('0x2')]},'application':{'type':Sequelize[_0xc8f2('0x2')]},'data':{'type':Sequelize[_0xc8f2('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc8f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 320f6e9..77aea21 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 _0x555e=['status','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','SquareDetailsReport','includeAll','rows','show','params','include','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','lodash','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','sendStatus','end','json','offset','undefined','count','limit'];(function(_0xf598e8,_0x1ff53a){var _0x3bf292=function(_0x1ca0eb){while(--_0x1ca0eb){_0xf598e8['push'](_0xf598e8['shift']());}};_0x3bf292(++_0x1ff53a);}(_0x555e,0x1ef));var _0xe555=function(_0x311b87,_0xd0daaa){_0x311b87=_0x311b87-0x0;var _0x2a987e=_0x555e[_0x311b87];return _0x2a987e;};'use strict';var emlformat=require(_0xe555('0x0'));var rimraf=require(_0xe555('0x1'));var zipdir=require(_0xe555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe555('0x3'));var moment=require(_0xe555('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe555('0x5'));var sox=require('sox');var csv=require(_0xe555('0x6'));var ejs=require(_0xe555('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe555('0x8'));var squel=require(_0xe555('0x9'));var crypto=require(_0xe555('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe555('0xb'));var toCsv=require(_0xe555('0x6'));var querystring=require(_0xe555('0xc'));var Papa=require(_0xe555('0xd'));var Redis=require(_0xe555('0xe'));var authService=require(_0xe555('0xf'));var qs=require(_0xe555('0x10'));var as=require(_0xe555('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe555('0x12'))(_0xe555('0x13'));var utils=require(_0xe555('0x14'));var config=require(_0xe555('0x15'));var licenseUtil=require(_0xe555('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x74ac96,_0x1d238a){_0x1d238a=_0x1d238a||0xcc;return function(_0x146fd2){if(_0x146fd2){return _0x74ac96[_0xe555('0x17')](_0x1d238a);}return _0x74ac96['status'](_0x1d238a)[_0xe555('0x18')]();};}function respondWithResult(_0x367fd3,_0x3797d0){_0x3797d0=_0x3797d0||0xc8;return function(_0x1f038e){if(_0x1f038e){return _0x367fd3['status'](_0x3797d0)[_0xe555('0x19')](_0x1f038e);}};}function respondWithFilteredResult(_0x97e155,_0x1fdae6){return function(_0x2d3135){if(_0x2d3135){var _0x4d76d0=typeof _0x1fdae6[_0xe555('0x1a')]==='undefined'&&typeof _0x1fdae6['limit']===_0xe555('0x1b');var _0x456260=_0x2d3135[_0xe555('0x1c')];var _0x30fe8e=_0x4d76d0?0x0:_0x1fdae6['offset'];var _0x108100=_0x4d76d0?_0x2d3135[_0xe555('0x1c')]:_0x1fdae6[_0xe555('0x1a')]+_0x1fdae6[_0xe555('0x1d')];var _0x4bd5dc;if(_0x108100>=_0x456260){_0x108100=_0x456260;_0x4bd5dc=0xc8;}else{_0x4bd5dc=0xce;}_0x97e155[_0xe555('0x1e')](_0x4bd5dc);return _0x97e155[_0xe555('0x1f')](_0xe555('0x20'),_0x30fe8e+'-'+_0x108100+'/'+_0x456260)[_0xe555('0x19')](_0x2d3135);}return null;};}function patchUpdates(_0x3e802c){return function(_0x4a823c){try{jsonpatch[_0xe555('0x21')](_0x4a823c,_0x3e802c,!![]);}catch(_0x1c59b0){return BPromise[_0xe555('0x22')](_0x1c59b0);}return _0x4a823c[_0xe555('0x23')]();};}function saveUpdates(_0x20f00c,_0x3fab6a){return function(_0x1eb801){if(_0x1eb801){return _0x1eb801[_0xe555('0x24')](_0x20f00c)[_0xe555('0x25')](function(_0x349dfd){return _0x349dfd;});}return null;};}function removeEntity(_0x5423b9,_0x3b6aae){return function(_0x5b6335){if(_0x5b6335){return _0x5b6335['destroy']()[_0xe555('0x25')](function(){_0x5423b9[_0xe555('0x1e')](0xcc)[_0xe555('0x18')]();});}};}function handleEntityNotFound(_0x30603f,_0x3dd494){return function(_0x4b57f1){if(!_0x4b57f1){_0x30603f[_0xe555('0x17')](0x194);}return _0x4b57f1;};}function handleError(_0x59d76a,_0x3c74bf){_0x3c74bf=_0x3c74bf||0x1f4;return function(_0x2ab1ad){logger[_0xe555('0x26')](_0x2ab1ad[_0xe555('0x27')]);if(_0x2ab1ad['name']){delete _0x2ab1ad[_0xe555('0x28')];}_0x59d76a[_0xe555('0x1e')](_0x3c74bf)['send'](_0x2ab1ad);};}exports[_0xe555('0x29')]=function(_0x3a241a,_0xd078b0){var _0x440f9d={},_0x1b98b6={},_0x54e7e2={'count':0x0,'rows':[]};var _0x23325a=_['map'](db['SquareDetailsReport'][_0xe555('0x2a')],function(_0x4e6b68){return{'name':_0x4e6b68[_0xe555('0x2b')],'type':_0x4e6b68[_0xe555('0x2c')]['key']};});_0x1b98b6[_0xe555('0x2d')]=_[_0xe555('0x2e')](_0x23325a,_0xe555('0x28'));_0x1b98b6[_0xe555('0x2f')]=_[_0xe555('0x30')](_0x3a241a[_0xe555('0x2f')]);_0x1b98b6[_0xe555('0x31')]=_[_0xe555('0x32')](_0x1b98b6['model'],_0x1b98b6[_0xe555('0x2f')]);_0x440f9d[_0xe555('0x33')]=_[_0xe555('0x32')](_0x1b98b6['model'],qs[_0xe555('0x34')](_0x3a241a[_0xe555('0x2f')][_0xe555('0x34')]));_0x440f9d[_0xe555('0x33')]=_0x440f9d[_0xe555('0x33')][_0xe555('0x35')]?_0x440f9d[_0xe555('0x33')]:_0x1b98b6[_0xe555('0x2d')];if(!_0x3a241a[_0xe555('0x2f')][_0xe555('0x36')](_0xe555('0x37'))){_0x440f9d[_0xe555('0x1d')]=qs[_0xe555('0x1d')](_0x3a241a[_0xe555('0x2f')][_0xe555('0x1d')]);_0x440f9d[_0xe555('0x1a')]=qs[_0xe555('0x1a')](_0x3a241a[_0xe555('0x2f')][_0xe555('0x1a')]);}_0x440f9d[_0xe555('0x38')]=qs[_0xe555('0x39')](_0x3a241a[_0xe555('0x2f')][_0xe555('0x39')]);_0x440f9d[_0xe555('0x3a')]=qs[_0xe555('0x31')](_[_0xe555('0x3b')](_0x3a241a[_0xe555('0x2f')],_0x1b98b6['filters']),_0x23325a);if(_0x3a241a[_0xe555('0x2f')]['filter']){_0x440f9d[_0xe555('0x3a')]=_[_0xe555('0x3c')](_0x440f9d['where'],{'$or':_[_0xe555('0x2e')](_0x23325a,function(_0x27be62){if(_0x27be62['type']!=='VIRTUAL'){var _0x164063={};_0x164063[_0x27be62['name']]={'$like':'%'+_0x3a241a[_0xe555('0x2f')][_0xe555('0x3d')]+'%'};return _0x164063;}})});}_0x440f9d=_[_0xe555('0x3c')]({},_0x440f9d,_0x3a241a[_0xe555('0x3e')]);var _0x1890ec={'where':_0x440f9d[_0xe555('0x3a')]};return db[_0xe555('0x3f')]['count'](_0x1890ec)['then'](function(_0x3d8632){_0x54e7e2['count']=_0x3d8632;if(_0x3a241a[_0xe555('0x2f')][_0xe555('0x40')]){_0x440f9d['include']=[{'all':!![]}];}return db[_0xe555('0x3f')]['findAll'](_0x440f9d);})[_0xe555('0x25')](function(_0xf16712){_0x54e7e2[_0xe555('0x41')]=_0xf16712;return _0x54e7e2;})['then'](respondWithFilteredResult(_0xd078b0,_0x440f9d))['catch'](handleError(_0xd078b0,null));};exports[_0xe555('0x42')]=function(_0x4d85ee,_0x471213){var _0x146f5a={'raw':!![],'where':{'id':_0x4d85ee[_0xe555('0x43')]['id']}},_0x2ef84b={};_0x2ef84b[_0xe555('0x2d')]=_['keys'](db[_0xe555('0x3f')][_0xe555('0x2a')]);_0x2ef84b[_0xe555('0x2f')]=_[_0xe555('0x30')](_0x4d85ee[_0xe555('0x2f')]);_0x2ef84b['filters']=_['intersection'](_0x2ef84b[_0xe555('0x2d')],_0x2ef84b[_0xe555('0x2f')]);_0x146f5a['attributes']=_[_0xe555('0x32')](_0x2ef84b['model'],qs[_0xe555('0x34')](_0x4d85ee['query'][_0xe555('0x34')]));_0x146f5a[_0xe555('0x33')]=_0x146f5a[_0xe555('0x33')][_0xe555('0x35')]?_0x146f5a[_0xe555('0x33')]:_0x2ef84b[_0xe555('0x2d')];if(_0x4d85ee['query'][_0xe555('0x40')]){_0x146f5a[_0xe555('0x44')]=[{'all':!![]}];}_0x146f5a=_[_0xe555('0x3c')]({},_0x146f5a,_0x4d85ee['options']);return db[_0xe555('0x3f')][_0xe555('0x45')](_0x146f5a)[_0xe555('0x25')](handleEntityNotFound(_0x471213,null))[_0xe555('0x25')](respondWithResult(_0x471213,null))[_0xe555('0x46')](handleError(_0x471213,null));};exports[_0xe555('0x47')]=function(_0x261262,_0x200da9){return db[_0xe555('0x3f')][_0xe555('0x47')](_0x261262[_0xe555('0x48')],{})[_0xe555('0x25')](respondWithResult(_0x200da9,0xc9))['catch'](handleError(_0x200da9,null));};exports[_0xe555('0x24')]=function(_0x5660e9,_0x3bc96b){if(_0x5660e9[_0xe555('0x48')]['id']){delete _0x5660e9[_0xe555('0x48')]['id'];}return db[_0xe555('0x3f')][_0xe555('0x45')]({'where':{'id':_0x5660e9['params']['id']}})['then'](handleEntityNotFound(_0x3bc96b,null))['then'](saveUpdates(_0x5660e9[_0xe555('0x48')],null))['then'](respondWithResult(_0x3bc96b,null))[_0xe555('0x46')](handleError(_0x3bc96b,null));};exports[_0xe555('0x49')]=function(_0x45f204,_0x18d4b4){return db[_0xe555('0x3f')][_0xe555('0x45')]({'where':{'id':_0x45f204[_0xe555('0x43')]['id']}})[_0xe555('0x25')](handleEntityNotFound(_0x18d4b4,null))['then'](removeEntity(_0x18d4b4,null))[_0xe555('0x46')](handleError(_0x18d4b4,null));};exports[_0xe555('0x4a')]=function(_0x48bc23,_0x34413f){return db['SquareDetailsReport'][_0xe555('0x4a')]()[_0xe555('0x25')](respondWithResult(_0x34413f,null))[_0xe555('0x46')](handleError(_0x34413f,null));}; \ No newline at end of file +var _0xd838=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','eml-format','rimraf','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'];(function(_0x51b770,_0x1783c8){var _0x2be852=function(_0x1f8e9e){while(--_0x1f8e9e){_0x51b770['push'](_0x51b770['shift']());}};_0x2be852(++_0x1783c8);}(_0xd838,0x17b));var _0x8d83=function(_0x560ae8,_0x5e9e17){_0x560ae8=_0x560ae8-0x0;var _0x5323c9=_0xd838[_0x560ae8];return _0x5323c9;};'use strict';var emlformat=require(_0x8d83('0x0'));var rimraf=require(_0x8d83('0x1'));var zipdir=require(_0x8d83('0x2'));var jsonpatch=require(_0x8d83('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8d83('0x4'));var Mustache=require(_0x8d83('0x5'));var util=require(_0x8d83('0x6'));var path=require(_0x8d83('0x7'));var sox=require(_0x8d83('0x8'));var csv=require(_0x8d83('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d83('0xa'));var _=require(_0x8d83('0xb'));var squel=require(_0x8d83('0xc'));var crypto=require(_0x8d83('0xd'));var jsforce=require(_0x8d83('0xe'));var deskjs=require(_0x8d83('0xf'));var toCsv=require(_0x8d83('0x9'));var querystring=require(_0x8d83('0x10'));var Papa=require(_0x8d83('0x11'));var Redis=require(_0x8d83('0x12'));var authService=require(_0x8d83('0x13'));var qs=require(_0x8d83('0x14'));var as=require(_0x8d83('0x15'));var hardwareService=require(_0x8d83('0x16'));var logger=require(_0x8d83('0x17'))('api');var utils=require(_0x8d83('0x18'));var config=require(_0x8d83('0x19'));var licenseUtil=require(_0x8d83('0x1a'));var db=require(_0x8d83('0x1b'))['db'];function respondWithStatusCode(_0xcbdbd,_0x5b23db){_0x5b23db=_0x5b23db||0xcc;return function(_0xe96c78){if(_0xe96c78){return _0xcbdbd[_0x8d83('0x1c')](_0x5b23db);}return _0xcbdbd[_0x8d83('0x1d')](_0x5b23db)[_0x8d83('0x1e')]();};}function respondWithResult(_0x21fbaa,_0x3e485e){_0x3e485e=_0x3e485e||0xc8;return function(_0x2b1f63){if(_0x2b1f63){return _0x21fbaa['status'](_0x3e485e)[_0x8d83('0x1f')](_0x2b1f63);}};}function respondWithFilteredResult(_0x15a08e,_0x489a48){return function(_0x55040a){if(_0x55040a){var _0x45055d=typeof _0x489a48[_0x8d83('0x20')]===_0x8d83('0x21')&&typeof _0x489a48[_0x8d83('0x22')]==='undefined';var _0x20e733=_0x55040a[_0x8d83('0x23')];var _0x4441f4=_0x45055d?0x0:_0x489a48[_0x8d83('0x20')];var _0x4dc51b=_0x45055d?_0x55040a[_0x8d83('0x23')]:_0x489a48['offset']+_0x489a48[_0x8d83('0x22')];var _0x465e1a;if(_0x4dc51b>=_0x20e733){_0x4dc51b=_0x20e733;_0x465e1a=0xc8;}else{_0x465e1a=0xce;}_0x15a08e['status'](_0x465e1a);return _0x15a08e[_0x8d83('0x24')](_0x8d83('0x25'),_0x4441f4+'-'+_0x4dc51b+'/'+_0x20e733)[_0x8d83('0x1f')](_0x55040a);}return null;};}function patchUpdates(_0x2bfa15){return function(_0x23b963){try{jsonpatch[_0x8d83('0x26')](_0x23b963,_0x2bfa15,!![]);}catch(_0x1e42e4){return BPromise[_0x8d83('0x27')](_0x1e42e4);}return _0x23b963[_0x8d83('0x28')]();};}function saveUpdates(_0x42cae3,_0x41a75a){return function(_0x238fc8){if(_0x238fc8){return _0x238fc8[_0x8d83('0x29')](_0x42cae3)[_0x8d83('0x2a')](function(_0xbdf598){return _0xbdf598;});}return null;};}function removeEntity(_0x30e124,_0x4dd7d8){return function(_0x1a1164){if(_0x1a1164){return _0x1a1164[_0x8d83('0x2b')]()[_0x8d83('0x2a')](function(){_0x30e124['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x520624,_0x142f0e){return function(_0x525e17){if(!_0x525e17){_0x520624['sendStatus'](0x194);}return _0x525e17;};}function handleError(_0x1722ed,_0x3ed426){_0x3ed426=_0x3ed426||0x1f4;return function(_0x306537){logger['error'](_0x306537['stack']);if(_0x306537['name']){delete _0x306537[_0x8d83('0x2c')];}_0x1722ed[_0x8d83('0x1d')](_0x3ed426)[_0x8d83('0x2d')](_0x306537);};}exports[_0x8d83('0x2e')]=function(_0x43a580,_0x1bef18){var _0x34aa96={},_0x4b6447={},_0x20703b={'count':0x0,'rows':[]};var _0x7594b1=_['map'](db['SquareDetailsReport'][_0x8d83('0x2f')],function(_0x36da90){return{'name':_0x36da90[_0x8d83('0x30')],'type':_0x36da90['type'][_0x8d83('0x31')]};});_0x4b6447[_0x8d83('0x32')]=_[_0x8d83('0x33')](_0x7594b1,_0x8d83('0x2c'));_0x4b6447[_0x8d83('0x34')]=_['keys'](_0x43a580[_0x8d83('0x34')]);_0x4b6447[_0x8d83('0x35')]=_[_0x8d83('0x36')](_0x4b6447['model'],_0x4b6447['query']);_0x34aa96[_0x8d83('0x37')]=_[_0x8d83('0x36')](_0x4b6447['model'],qs[_0x8d83('0x38')](_0x43a580[_0x8d83('0x34')]['fields']));_0x34aa96[_0x8d83('0x37')]=_0x34aa96[_0x8d83('0x37')][_0x8d83('0x39')]?_0x34aa96[_0x8d83('0x37')]:_0x4b6447[_0x8d83('0x32')];if(!_0x43a580[_0x8d83('0x34')][_0x8d83('0x3a')]('nolimit')){_0x34aa96[_0x8d83('0x22')]=qs[_0x8d83('0x22')](_0x43a580['query'][_0x8d83('0x22')]);_0x34aa96[_0x8d83('0x20')]=qs[_0x8d83('0x20')](_0x43a580[_0x8d83('0x34')][_0x8d83('0x20')]);}_0x34aa96[_0x8d83('0x3b')]=qs[_0x8d83('0x3c')](_0x43a580[_0x8d83('0x34')][_0x8d83('0x3c')]);_0x34aa96[_0x8d83('0x3d')]=qs['filters'](_[_0x8d83('0x3e')](_0x43a580[_0x8d83('0x34')],_0x4b6447[_0x8d83('0x35')]),_0x7594b1);if(_0x43a580[_0x8d83('0x34')]['filter']){_0x34aa96[_0x8d83('0x3d')]=_[_0x8d83('0x3f')](_0x34aa96['where'],{'$or':_[_0x8d83('0x33')](_0x7594b1,function(_0x162906){if(_0x162906[_0x8d83('0x40')]!==_0x8d83('0x41')){var _0x1a4466={};_0x1a4466[_0x162906[_0x8d83('0x2c')]]={'$like':'%'+_0x43a580[_0x8d83('0x34')]['filter']+'%'};return _0x1a4466;}})});}_0x34aa96=_[_0x8d83('0x3f')]({},_0x34aa96,_0x43a580['options']);var _0x1e3287={'where':_0x34aa96[_0x8d83('0x3d')]};return db[_0x8d83('0x42')][_0x8d83('0x23')](_0x1e3287)[_0x8d83('0x2a')](function(_0x4da32c){_0x20703b[_0x8d83('0x23')]=_0x4da32c;if(_0x43a580['query'][_0x8d83('0x43')]){_0x34aa96[_0x8d83('0x44')]=[{'all':!![]}];}return db[_0x8d83('0x42')][_0x8d83('0x45')](_0x34aa96);})['then'](function(_0x29f657){_0x20703b[_0x8d83('0x46')]=_0x29f657;return _0x20703b;})[_0x8d83('0x2a')](respondWithFilteredResult(_0x1bef18,_0x34aa96))['catch'](handleError(_0x1bef18,null));};exports[_0x8d83('0x47')]=function(_0x1fffd0,_0x2ad017){var _0x15a087={'raw':!![],'where':{'id':_0x1fffd0[_0x8d83('0x48')]['id']}},_0x3260f6={};_0x3260f6[_0x8d83('0x32')]=_[_0x8d83('0x49')](db['SquareDetailsReport'][_0x8d83('0x2f')]);_0x3260f6[_0x8d83('0x34')]=_['keys'](_0x1fffd0[_0x8d83('0x34')]);_0x3260f6[_0x8d83('0x35')]=_[_0x8d83('0x36')](_0x3260f6[_0x8d83('0x32')],_0x3260f6[_0x8d83('0x34')]);_0x15a087[_0x8d83('0x37')]=_[_0x8d83('0x36')](_0x3260f6['model'],qs['fields'](_0x1fffd0[_0x8d83('0x34')][_0x8d83('0x38')]));_0x15a087['attributes']=_0x15a087[_0x8d83('0x37')][_0x8d83('0x39')]?_0x15a087[_0x8d83('0x37')]:_0x3260f6[_0x8d83('0x32')];if(_0x1fffd0[_0x8d83('0x34')][_0x8d83('0x43')]){_0x15a087[_0x8d83('0x44')]=[{'all':!![]}];}_0x15a087=_[_0x8d83('0x3f')]({},_0x15a087,_0x1fffd0[_0x8d83('0x4a')]);return db[_0x8d83('0x42')][_0x8d83('0x4b')](_0x15a087)[_0x8d83('0x2a')](handleEntityNotFound(_0x2ad017,null))[_0x8d83('0x2a')](respondWithResult(_0x2ad017,null))[_0x8d83('0x4c')](handleError(_0x2ad017,null));};exports[_0x8d83('0x4d')]=function(_0x527375,_0x3dc804){return db[_0x8d83('0x42')][_0x8d83('0x4d')](_0x527375[_0x8d83('0x4e')],{})[_0x8d83('0x2a')](respondWithResult(_0x3dc804,0xc9))['catch'](handleError(_0x3dc804,null));};exports[_0x8d83('0x29')]=function(_0x1597e3,_0x5f512f){if(_0x1597e3[_0x8d83('0x4e')]['id']){delete _0x1597e3[_0x8d83('0x4e')]['id'];}return db[_0x8d83('0x42')][_0x8d83('0x4b')]({'where':{'id':_0x1597e3[_0x8d83('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f512f,null))[_0x8d83('0x2a')](saveUpdates(_0x1597e3['body'],null))[_0x8d83('0x2a')](respondWithResult(_0x5f512f,null))['catch'](handleError(_0x5f512f,null));};exports[_0x8d83('0x2b')]=function(_0x4eeb55,_0x6e0331){return db[_0x8d83('0x42')][_0x8d83('0x4b')]({'where':{'id':_0x4eeb55[_0x8d83('0x48')]['id']}})[_0x8d83('0x2a')](handleEntityNotFound(_0x6e0331,null))[_0x8d83('0x2a')](removeEntity(_0x6e0331,null))[_0x8d83('0x4c')](handleError(_0x6e0331,null));};exports[_0x8d83('0x4f')]=function(_0x189b3e,_0x49259f){return db[_0x8d83('0x42')]['describe']()[_0x8d83('0x2a')](respondWithResult(_0x49259f,null))[_0x8d83('0x4c')](handleError(_0x49259f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index aa9d6dc..3f61661 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 _0x79c1=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','../../config/logger','bluebird','request-promise','path'];(function(_0x458afb,_0x3ed9fe){var _0x3232bf=function(_0x55df2d){while(--_0x55df2d){_0x458afb['push'](_0x458afb['shift']());}};_0x3232bf(++_0x3ed9fe);}(_0x79c1,0x1ca));var _0x179c=function(_0x133ec0,_0x4ba91f){_0x133ec0=_0x133ec0-0x0;var _0x4ff979=_0x79c1[_0x133ec0];return _0x4ff979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x179c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x179c('0x1'));var rp=require(_0x179c('0x2'));var fs=require('fs');var path=require(_0x179c('0x3'));var rimraf=require(_0x179c('0x4'));var config=require(_0x179c('0x5'));var attributes=require(_0x179c('0x6'));module[_0x179c('0x7')]=function(_0x3885ef,_0x4124b5){return _0x3885ef[_0x179c('0x8')](_0x179c('0x9'),attributes,{'tableName':_0x179c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ebf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_square_details','util'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2ebf,0xa7));var _0xf2eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ebf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf2eb('0x0'));var logger=require(_0xf2eb('0x1'))(_0xf2eb('0x2'));var moment=require(_0xf2eb('0x3'));var BPromise=require(_0xf2eb('0x4'));var rp=require(_0xf2eb('0x5'));var fs=require('fs');var path=require(_0xf2eb('0x6'));var rimraf=require(_0xf2eb('0x7'));var config=require(_0xf2eb('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xf2eb('0x9')]=function(_0x2204ae,_0x126da2){return _0x2204ae[_0xf2eb('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xf2eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 2017297..5c0426c 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 _0xb921=['options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x5212b9,_0x180a6e){var _0x4e0913=function(_0x43ff91){while(--_0x43ff91){_0x5212b9['push'](_0x5212b9['shift']());}};_0x4e0913(++_0x180a6e);}(_0xb921,0x16a));var _0x1b92=function(_0x4a1814,_0x2a4abf){_0x4a1814=_0x4a1814-0x0;var _0x4fcdba=_0xb921[_0x4a1814];return _0x4fcdba;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('SquareDetailsReport,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});}exports[_0x1b92('0x18')]=function(_0x289523){var _0xf62817=this;return new Promise(function(_0x4368dc,_0x5010cd){return db[_0x1b92('0x19')][_0x1b92('0x1a')](_0x289523[_0x1b92('0x1b')],{'raw':_0x289523['options']?_0x289523[_0x1b92('0x1c')][_0x1b92('0x1d')]===undefined?!![]:![]:!![]})[_0x1b92('0xd')](function(_0x4bfc51){logger[_0x1b92('0x16')]('CreateSquareDetailsReport',_0x289523);logger[_0x1b92('0x10')](_0x1b92('0x18'),_0x289523,JSON['stringify'](_0x4bfc51));_0x4368dc(_0x4bfc51);})['catch'](function(_0x34c5c9){logger[_0x1b92('0x13')](_0x1b92('0x18'),_0x34c5c9[_0x1b92('0x15')],_0x289523);_0x5010cd(_0xf62817[_0x1b92('0x13')](0x1f4,_0x34c5c9[_0x1b92('0x15')]));});});}; \ No newline at end of file +var _0xe1e3=['jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x518219,_0xaba35a){var _0x11eefc=function(_0x81c816){while(--_0x81c816){_0x518219['push'](_0x518219['shift']());}};_0x11eefc(++_0xaba35a);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x1c5470,_0x319134){_0x1c5470=_0x1c5470-0x0;var _0xe0be88=_0xe1e3[_0x1c5470];return _0xe0be88;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['SquareDetailsReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateSquareDetailsReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d3e1e8d..bef6608 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 _0xe833=['exports','express','Router','./system.controller','get','index','/process/:pid/kill','killProcess'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0xe833,0x1c1));var _0x3e83=function(_0x2b58cd,_0x315d78){_0x2b58cd=_0x2b58cd-0x0;var _0x6e6ca6=_0xe833[_0x2b58cd];return _0x6e6ca6;};'use strict';var express=require(_0x3e83('0x0'));var router=express[_0x3e83('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3e83('0x2'));router[_0x3e83('0x3')]('/',auth['isAuthenticated'](),controller[_0x3e83('0x4')]);router[_0x3e83('0x3')](_0x3e83('0x5'),auth['isAuthenticated'](),controller[_0x3e83('0x6')]);module[_0x3e83('0x7')]=router; \ No newline at end of file +var _0x5083=['isAuthenticated','killProcess','express','../../components/auth/service','get','index'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x5083,0x140));var _0x3508=function(_0x2090c5,_0x5c139b){_0x2090c5=_0x2090c5-0x0;var _0x5533f7=_0x5083[_0x2090c5];return _0x5533f7;};'use strict';var express=require(_0x3508('0x0'));var router=express['Router']();var auth=require(_0x3508('0x1'));var controller=require('./system.controller');router[_0x3508('0x2')]('/',auth['isAuthenticated'](),controller[_0x3508('0x3')]);router[_0x3508('0x2')]('/process/:pid/kill',auth[_0x3508('0x4')](),controller[_0x3508('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 51de9df..f19646d 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 _0x7188=['status','getAllData','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','bluebird','lodash','error','inspect','name'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7188,0x167));var _0x8718=function(_0x118749,_0x50e848){_0x118749=_0x118749-0x0;var _0x20d489=_0x7188[_0x118749];return _0x20d489;};'use strict';var info=require(_0x8718('0x0'));var exec=require(_0x8718('0x1'))[_0x8718('0x2')];var logger=require('../../config/logger')(_0x8718('0x3'));var util=require('util');var BPromise=require(_0x8718('0x4'));var _=require(_0x8718('0x5'));function handleError(_0x31937d,_0xf1a656,_0x208cba){_0xf1a656=_0xf1a656||0x1f4;return function(_0x30214e){logger[_0x8718('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x208cba,_0xf1a656,util[_0x8718('0x7')](_0x30214e,{'showHidden':![],'depth':null}));delete _0x30214e[_0x8718('0x8')];_0x31937d[_0x8718('0x9')](_0xf1a656)['send'](_0x30214e);};}exports['index']=function(_0xfdf8b7,_0x51b8ef){return info[_0x8718('0xa')]()['then'](function(_0x9df4ef){return _0x51b8ef[_0x8718('0x9')](0xc8)[_0x8718('0xb')](_0x9df4ef);})[_0x8718('0xc')](function(_0x187839){return _0x51b8ef[_0x8718('0x9')](0x1f4)[_0x8718('0xb')](_0x187839);});};exports[_0x8718('0xd')]=function(_0x4bc4f4,_0x39a9f4){var _0x1309c9=['components/import/cm'];return new BPromise(function(_0x13a9ce,_0x316156){return exec(util[_0x8718('0xe')](_0x8718('0xf'),_0x4bc4f4[_0x8718('0x10')][_0x8718('0x11')]),function(_0x9f0570,_0x549209,_0xc024b4){if(_0x9f0570){return _0x316156(_0x9f0570);}return _0x13a9ce(_0x549209);});})['then'](function(_0x229438){var _0x55e4c2=![];var _0xb1ca28=_0x229438[_0x8718('0x12')](/\n/);for(var _0x4429a4=0x0,_0x589235=_0x1309c9['length'];_0x4429a4<_0x589235,_0x55e4c2===![];_0x4429a4+=0x1){if(_0x229438[_0x8718('0x13')](_0x1309c9[_0x4429a4])>=0x0){_0x55e4c2=!![];}}if(!_0x55e4c2){throw new Error(util[_0x8718('0xe')](_0x8718('0x14'),_0x4bc4f4[_0x8718('0x10')][_0x8718('0x11')]));}process['kill'](_0x4bc4f4[_0x8718('0x10')]['pid'],_0x8718('0x15'));return _0x39a9f4[_0x8718('0x9')](0xc8)['json']({'message':util[_0x8718('0xe')](_0x8718('0x16'),_0x4bc4f4['params'][_0x8718('0x11')])});})[_0x8718('0xc')](handleError(_0x39a9f4,null,_0x8718('0xd')));}; \ No newline at end of file +var _0xb87d=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','systeminformation','exec','../../config/logger','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','getAllData','then','status','json','catch','killProcess','components/import/cm','format'];(function(_0x482c25,_0x19ba79){var _0xc9e2e6=function(_0x161bac){while(--_0x161bac){_0x482c25['push'](_0x482c25['shift']());}};_0xc9e2e6(++_0x19ba79);}(_0xb87d,0x96));var _0xdb87=function(_0x1950ef,_0x155e7d){_0x1950ef=_0x1950ef-0x0;var _0x365b21=_0xb87d[_0x1950ef];return _0x365b21;};'use strict';var info=require(_0xdb87('0x0'));var exec=require('child_process')[_0xdb87('0x1')];var logger=require(_0xdb87('0x2'))(_0xdb87('0x3'));var util=require('util');var BPromise=require(_0xdb87('0x4'));var _=require('lodash');function handleError(_0x122d3c,_0x3cc525,_0x11c567){_0x3cc525=_0x3cc525||0x1f4;return function(_0x1f1b62){logger[_0xdb87('0x5')](_0xdb87('0x6'),_0x11c567,_0x3cc525,util[_0xdb87('0x7')](_0x1f1b62,{'showHidden':![],'depth':null}));delete _0x1f1b62[_0xdb87('0x8')];_0x122d3c['status'](_0x3cc525)[_0xdb87('0x9')](_0x1f1b62);};}exports['index']=function(_0x423958,_0xc204e8){return info[_0xdb87('0xa')]()[_0xdb87('0xb')](function(_0x29bf2e){return _0xc204e8[_0xdb87('0xc')](0xc8)[_0xdb87('0xd')](_0x29bf2e);})[_0xdb87('0xe')](function(_0x3f79d1){return _0xc204e8[_0xdb87('0xc')](0x1f4)[_0xdb87('0xd')](_0x3f79d1);});};exports[_0xdb87('0xf')]=function(_0x3ba2db,_0x3aa576){var _0x208168=[_0xdb87('0x10')];return new BPromise(function(_0x3f198e,_0x387ce4){return exec(util[_0xdb87('0x11')](_0xdb87('0x12'),_0x3ba2db['params'][_0xdb87('0x13')]),function(_0x16397a,_0x328d8d,_0x56dc2d){if(_0x16397a){return _0x387ce4(_0x16397a);}return _0x3f198e(_0x328d8d);});})[_0xdb87('0xb')](function(_0x2d5d54){var _0x1bbf1d=![];var _0x45a06c=_0x2d5d54[_0xdb87('0x14')](/\n/);for(var _0x29ac21=0x0,_0x28158d=_0x208168['length'];_0x29ac21<_0x28158d,_0x1bbf1d===![];_0x29ac21+=0x1){if(_0x2d5d54[_0xdb87('0x15')](_0x208168[_0x29ac21])>=0x0){_0x1bbf1d=!![];}}if(!_0x1bbf1d){throw new Error(util[_0xdb87('0x11')](_0xdb87('0x16'),_0x3ba2db[_0xdb87('0x17')][_0xdb87('0x13')]));}process['kill'](_0x3ba2db[_0xdb87('0x17')][_0xdb87('0x13')],'SIGINT');return _0x3aa576['status'](0xc8)[_0xdb87('0xd')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x3ba2db[_0xdb87('0x17')][_0xdb87('0x13')])});})[_0xdb87('0xe')](handleError(_0x3aa576,null,_0xdb87('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5d9f064..e031356 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 _0xb3f2=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','update'];(function(_0x30b711,_0x1c3992){var _0x2551db=function(_0x47e3c7){while(--_0x47e3c7){_0x30b711['push'](_0x30b711['shift']());}};_0x2551db(++_0x1c3992);}(_0xb3f2,0x1bb));var _0x2b3f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb3f2[_0x45783c];return _0x1161da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b3f('0x0'));var timeout=require(_0x2b3f('0x1'));var express=require(_0x2b3f('0x2'));var router=express[_0x2b3f('0x3')]();var fs_extra=require(_0x2b3f('0x4'));var auth=require(_0x2b3f('0x5'));var interaction=require(_0x2b3f('0x6'));var config=require(_0x2b3f('0x7'));var controller=require(_0x2b3f('0x8'));router[_0x2b3f('0x9')]('/',auth['isAuthenticated'](),controller[_0x2b3f('0xa')]);router['get'](_0x2b3f('0xb'),auth[_0x2b3f('0xc')](),controller[_0x2b3f('0xd')]);router[_0x2b3f('0xe')]('/',auth[_0x2b3f('0xc')](),controller['create']);router[_0x2b3f('0xf')](_0x2b3f('0xb'),auth[_0x2b3f('0xc')](),controller[_0x2b3f('0x10')]);router[_0x2b3f('0x11')](_0x2b3f('0xb'),auth[_0x2b3f('0xc')](),controller[_0x2b3f('0x12')]);module[_0x2b3f('0x13')]=router; \ No newline at end of file +var _0xafbf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','/:id','delete','multer','path','connect-timeout','express'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xafbf,0x130));var _0xfafb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xafbf[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xfafb('0x0'));var util=require('util');var path=require(_0xfafb('0x1'));var timeout=require(_0xfafb('0x2'));var express=require(_0xfafb('0x3'));var router=express[_0xfafb('0x4')]();var fs_extra=require(_0xfafb('0x5'));var auth=require(_0xfafb('0x6'));var interaction=require(_0xfafb('0x7'));var config=require(_0xfafb('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0xfafb('0x9')](),controller[_0xfafb('0xa')]);router['get']('/:id',auth[_0xfafb('0x9')](),controller[_0xfafb('0xb')]);router['post']('/',auth[_0xfafb('0x9')](),controller['create']);router['put'](_0xfafb('0xc'),auth[_0xfafb('0x9')](),controller['update']);router[_0xfafb('0xd')]('/:id',auth[_0xfafb('0x9')](),controller['destroy']);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 1fd707c..8a887d2 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 _0x6d2d=['STRING','name'];(function(_0x454370,_0x1edb53){var _0x5b31e5=function(_0x4f7aec){while(--_0x4f7aec){_0x454370['push'](_0x454370['shift']());}};_0x5b31e5(++_0x1edb53);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x45622d,_0x16542e){_0x45622d=_0x45622d-0x0;var _0x2906f5=_0x6d2d[_0x45622d];return _0x2906f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd6d2('0x0')],'unique':_0xd6d2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd6d2('0x0')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xd6d2('0x0')]}}; \ No newline at end of file +var _0x91b6=['exports','name','STRING','sequelize'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x91b6,0x18b));var _0x691b=function(_0x10f936,_0x229008){_0x10f936=_0x10f936-0x0;var _0x3f3d19=_0x91b6[_0x10f936];return _0x3f3d19;};'use strict';var Sequelize=require(_0x691b('0x0'));module[_0x691b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x691b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x691b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e5eb1fd..abc167b 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 _0x9a19=['Tag','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Tags','stack','name','send','index','map'];(function(_0x1b16ca,_0x140125){var _0x19b84b=function(_0x3eb650){while(--_0x3eb650){_0x1b16ca['push'](_0x1b16ca['shift']());}};_0x19b84b(++_0x140125);}(_0x9a19,0x114));var _0x99a1=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x9a19[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['Tag']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0xa0bc=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','sendStatus','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca0b('0x0'));var zipdir=require(_0xca0b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0b('0x2'));var moment=require(_0xca0b('0x3'));var BPromise=require(_0xca0b('0x4'));var Mustache=require(_0xca0b('0x5'));var util=require(_0xca0b('0x6'));var path=require(_0xca0b('0x7'));var sox=require(_0xca0b('0x8'));var csv=require(_0xca0b('0x9'));var ejs=require(_0xca0b('0xa'));var fs=require('fs');var fs_extra=require(_0xca0b('0xb'));var _=require(_0xca0b('0xc'));var squel=require(_0xca0b('0xd'));var crypto=require(_0xca0b('0xe'));var jsforce=require(_0xca0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca0b('0x9'));var querystring=require(_0xca0b('0x10'));var Papa=require(_0xca0b('0x11'));var Redis=require(_0xca0b('0x12'));var authService=require(_0xca0b('0x13'));var qs=require(_0xca0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0b('0x15'));var logger=require(_0xca0b('0x16'))(_0xca0b('0x17'));var utils=require(_0xca0b('0x18'));var config=require(_0xca0b('0x19'));var licenseUtil=require(_0xca0b('0x1a'));var db=require(_0xca0b('0x1b'))['db'];function respondWithStatusCode(_0x3a2e25,_0x22ca9d){_0x22ca9d=_0x22ca9d||0xcc;return function(_0x2ce366){if(_0x2ce366){return _0x3a2e25['sendStatus'](_0x22ca9d);}return _0x3a2e25[_0xca0b('0x1c')](_0x22ca9d)[_0xca0b('0x1d')]();};}function respondWithResult(_0x358972,_0x5da205){_0x5da205=_0x5da205||0xc8;return function(_0x106ed6){if(_0x106ed6){return _0x358972[_0xca0b('0x1c')](_0x5da205)[_0xca0b('0x1e')](_0x106ed6);}};}function respondWithFilteredResult(_0x2beba9,_0x42b68e){return function(_0x404c6d){if(_0x404c6d){var _0x4d7620=typeof _0x42b68e[_0xca0b('0x1f')]===_0xca0b('0x20')&&typeof _0x42b68e['limit']===_0xca0b('0x20');var _0x5db810=_0x404c6d[_0xca0b('0x21')];var _0x5050b7=_0x4d7620?0x0:_0x42b68e[_0xca0b('0x1f')];var _0x32eff7=_0x4d7620?_0x404c6d[_0xca0b('0x21')]:_0x42b68e['offset']+_0x42b68e[_0xca0b('0x22')];var _0x2c0c53;if(_0x32eff7>=_0x5db810){_0x32eff7=_0x5db810;_0x2c0c53=0xc8;}else{_0x2c0c53=0xce;}_0x2beba9['status'](_0x2c0c53);return _0x2beba9[_0xca0b('0x23')](_0xca0b('0x24'),_0x5050b7+'-'+_0x32eff7+'/'+_0x5db810)[_0xca0b('0x1e')](_0x404c6d);}return null;};}function patchUpdates(_0x59bda9){return function(_0x865393){try{jsonpatch[_0xca0b('0x25')](_0x865393,_0x59bda9,!![]);}catch(_0x484e26){return BPromise[_0xca0b('0x26')](_0x484e26);}return _0x865393[_0xca0b('0x27')]();};}function saveUpdates(_0x2ae93b,_0x49e695){return function(_0x119589){if(_0x119589){return _0x119589[_0xca0b('0x28')](_0x2ae93b)[_0xca0b('0x29')](function(_0x504d91){return _0x504d91;});}return null;};}function removeEntity(_0x54fb03,_0x11f5c3){return function(_0x428459){if(_0x428459){return _0x428459[_0xca0b('0x2a')]()[_0xca0b('0x29')](function(){var _0x3ae1dc=_0x428459['get']({'plain':!![]});var _0xe122e8=_0xca0b('0x2b');return db[_0xca0b('0x2c')][_0xca0b('0x2a')]({'where':{'type':_0xe122e8,'resourceId':_0x3ae1dc['id']}})[_0xca0b('0x29')](function(){return _0x428459;});})['then'](function(){_0x54fb03['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a6fd,_0xa71d57){return function(_0x3fd832){if(!_0x3fd832){_0x44a6fd[_0xca0b('0x2d')](0x194);}return _0x3fd832;};}function handleError(_0xe7673b,_0x515f83){_0x515f83=_0x515f83||0x1f4;return function(_0x23af62){logger[_0xca0b('0x2e')](_0x23af62[_0xca0b('0x2f')]);if(_0x23af62[_0xca0b('0x30')]){delete _0x23af62[_0xca0b('0x30')];}_0xe7673b[_0xca0b('0x1c')](_0x515f83)[_0xca0b('0x31')](_0x23af62);};}exports['index']=function(_0x6016f6,_0x17a365){var _0x3b72b2={},_0x26f168={},_0x5a8c2f={'count':0x0,'rows':[]};var _0x43cf1a=_[_0xca0b('0x32')](db[_0xca0b('0x33')][_0xca0b('0x34')],function(_0x3beea0){return{'name':_0x3beea0[_0xca0b('0x35')],'type':_0x3beea0[_0xca0b('0x36')][_0xca0b('0x37')]};});_0x26f168[_0xca0b('0x38')]=_[_0xca0b('0x32')](_0x43cf1a,_0xca0b('0x30'));_0x26f168[_0xca0b('0x39')]=_[_0xca0b('0x3a')](_0x6016f6[_0xca0b('0x39')]);_0x26f168[_0xca0b('0x3b')]=_['intersection'](_0x26f168[_0xca0b('0x38')],_0x26f168[_0xca0b('0x39')]);_0x3b72b2[_0xca0b('0x3c')]=_[_0xca0b('0x3d')](_0x26f168['model'],qs[_0xca0b('0x3e')](_0x6016f6[_0xca0b('0x39')]['fields']));_0x3b72b2[_0xca0b('0x3c')]=_0x3b72b2[_0xca0b('0x3c')][_0xca0b('0x3f')]?_0x3b72b2[_0xca0b('0x3c')]:_0x26f168[_0xca0b('0x38')];if(!_0x6016f6[_0xca0b('0x39')][_0xca0b('0x40')](_0xca0b('0x41'))){_0x3b72b2['limit']=qs['limit'](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x22')]);_0x3b72b2[_0xca0b('0x1f')]=qs[_0xca0b('0x1f')](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x1f')]);}_0x3b72b2[_0xca0b('0x42')]=qs[_0xca0b('0x43')](_0x6016f6[_0xca0b('0x39')][_0xca0b('0x43')]);_0x3b72b2[_0xca0b('0x44')]=qs[_0xca0b('0x3b')](_[_0xca0b('0x45')](_0x6016f6[_0xca0b('0x39')],_0x26f168[_0xca0b('0x3b')]),_0x43cf1a);if(_0x6016f6[_0xca0b('0x39')][_0xca0b('0x46')]){_0x3b72b2[_0xca0b('0x44')]=_[_0xca0b('0x47')](_0x3b72b2[_0xca0b('0x44')],{'$or':_[_0xca0b('0x32')](_0x43cf1a,function(_0x25a5a1){if(_0x25a5a1[_0xca0b('0x36')]!==_0xca0b('0x48')){var _0x90dc6c={};_0x90dc6c[_0x25a5a1['name']]={'$like':'%'+_0x6016f6['query'][_0xca0b('0x46')]+'%'};return _0x90dc6c;}})});}_0x3b72b2=_[_0xca0b('0x47')]({},_0x3b72b2,_0x6016f6['options']);var _0x54890e={'where':_0x3b72b2['where']};return db[_0xca0b('0x33')][_0xca0b('0x21')](_0x54890e)[_0xca0b('0x29')](function(_0xf9e175){_0x5a8c2f[_0xca0b('0x21')]=_0xf9e175;if(_0x6016f6['query']['includeAll']){_0x3b72b2[_0xca0b('0x49')]=[{'all':!![]}];}return db['Tag'][_0xca0b('0x4a')](_0x3b72b2);})['then'](function(_0x57bab3){_0x5a8c2f['rows']=_0x57bab3;return _0x5a8c2f;})[_0xca0b('0x29')](respondWithFilteredResult(_0x17a365,_0x3b72b2))[_0xca0b('0x4b')](handleError(_0x17a365,null));};exports[_0xca0b('0x4c')]=function(_0x3448ab,_0x19f760){var _0xcc9be0={'raw':!![],'where':{'id':_0x3448ab[_0xca0b('0x4d')]['id']}},_0x54bcb7={};_0x54bcb7[_0xca0b('0x38')]=_[_0xca0b('0x3a')](db[_0xca0b('0x33')][_0xca0b('0x34')]);_0x54bcb7['query']=_['keys'](_0x3448ab[_0xca0b('0x39')]);_0x54bcb7[_0xca0b('0x3b')]=_[_0xca0b('0x3d')](_0x54bcb7[_0xca0b('0x38')],_0x54bcb7['query']);_0xcc9be0[_0xca0b('0x3c')]=_[_0xca0b('0x3d')](_0x54bcb7[_0xca0b('0x38')],qs[_0xca0b('0x3e')](_0x3448ab['query']['fields']));_0xcc9be0[_0xca0b('0x3c')]=_0xcc9be0[_0xca0b('0x3c')][_0xca0b('0x3f')]?_0xcc9be0['attributes']:_0x54bcb7[_0xca0b('0x38')];if(_0x3448ab[_0xca0b('0x39')]['includeAll']){_0xcc9be0['include']=[{'all':!![]}];}_0xcc9be0=_['merge']({},_0xcc9be0,_0x3448ab[_0xca0b('0x4e')]);return db[_0xca0b('0x33')][_0xca0b('0x4f')](_0xcc9be0)['then'](handleEntityNotFound(_0x19f760,null))['then'](respondWithResult(_0x19f760,null))[_0xca0b('0x4b')](handleError(_0x19f760,null));};exports[_0xca0b('0x50')]=function(_0x250288,_0x174e81){return db[_0xca0b('0x33')][_0xca0b('0x50')](_0x250288['body'],{})['then'](function(_0x499b43){var _0x456ea1=_0x250288[_0xca0b('0x51')]['get']({'plain':!![]});if(!_0x456ea1)throw new Error(_0xca0b('0x52'));if(_0x456ea1[_0xca0b('0x53')]===_0xca0b('0x51')){var _0x535cce=_0x499b43[_0xca0b('0x54')]({'plain':!![]});var _0x5a3734=_0xca0b('0x2b');return db[_0xca0b('0x55')][_0xca0b('0x4f')]({'where':{'name':_0x5a3734,'userProfileId':_0x456ea1[_0xca0b('0x56')]},'raw':!![]})[_0xca0b('0x29')](function(_0x1d569e){if(_0x1d569e&&_0x1d569e[_0xca0b('0x57')]===0x0){return db[_0xca0b('0x2c')][_0xca0b('0x50')]({'name':_0x535cce[_0xca0b('0x30')],'resourceId':_0x535cce['id'],'type':_0x1d569e[_0xca0b('0x30')],'sectionId':_0x1d569e['id']},{})[_0xca0b('0x29')](function(){return _0x499b43;});}else{return _0x499b43;}})[_0xca0b('0x4b')](function(_0x21d2d5){logger[_0xca0b('0x2e')](_0xca0b('0x58'),_0x21d2d5);throw _0x21d2d5;});}return _0x499b43;})[_0xca0b('0x29')](respondWithResult(_0x174e81,0xc9))[_0xca0b('0x4b')](handleError(_0x174e81,null));};exports['update']=function(_0x27fdbd,_0xbef02e){if(_0x27fdbd['body']['id']){delete _0x27fdbd[_0xca0b('0x59')]['id'];}return db[_0xca0b('0x33')][_0xca0b('0x4f')]({'where':{'id':_0x27fdbd[_0xca0b('0x4d')]['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0xbef02e,null))[_0xca0b('0x29')](saveUpdates(_0x27fdbd[_0xca0b('0x59')],null))[_0xca0b('0x29')](respondWithResult(_0xbef02e,null))['catch'](handleError(_0xbef02e,null));};exports[_0xca0b('0x2a')]=function(_0x36feaa,_0x416fd5){return db[_0xca0b('0x33')]['find']({'where':{'id':_0x36feaa['params']['id']}})[_0xca0b('0x29')](handleEntityNotFound(_0x416fd5,null))[_0xca0b('0x29')](removeEntity(_0x416fd5,null))['catch'](handleError(_0x416fd5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2641d04..9d59d5e 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 _0x2904=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','util'];(function(_0x47df79,_0x849ef9){var _0x1fa273=function(_0x3bc832){while(--_0x3bc832){_0x47df79['push'](_0x47df79['shift']());}};_0x1fa273(++_0x849ef9);}(_0x2904,0xf1));var _0x4290=function(_0x3ba1ba,_0x3da796){_0x3ba1ba=_0x3ba1ba-0x0;var _0x58c60f=_0x2904[_0x3ba1ba];return _0x58c60f;};'use strict';var _=require('lodash');var util=require(_0x4290('0x0'));var logger=require('../../config/logger')(_0x4290('0x1'));var moment=require(_0x4290('0x2'));var BPromise=require(_0x4290('0x3'));var rp=require(_0x4290('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4290('0x5'));var config=require(_0x4290('0x6'));var attributes=require(_0x4290('0x7'));module['exports']=function(_0x406535,_0x22c247){return _0x406535[_0x4290('0x8')](_0x4290('0x9'),attributes,{'tableName':_0x4290('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe79=['define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0xbe79,0x169));var _0x9be7=function(_0x28e5aa,_0x9b4a44){_0x28e5aa=_0x28e5aa-0x0;var _0x128e41=_0xbe79[_0x28e5aa];return _0x128e41;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))(_0x9be7('0x3'));var moment=require(_0x9be7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be7('0x5'));var fs=require('fs');var path=require(_0x9be7('0x6'));var rimraf=require(_0x9be7('0x7'));var config=require(_0x9be7('0x8'));var attributes=require(_0x9be7('0x9'));module[_0x9be7('0xa')]=function(_0x57b111,_0x2ddcb5){return _0x57b111[_0x9be7('0xb')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 0523b7a..867507f 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x8ec916,_0x39b8b1){var _0x18097a=function(_0x443c0a){while(--_0x443c0a){_0x8ec916['push'](_0x8ec916['shift']());}};_0x18097a(++_0x39b8b1);}(_0x99e9,0xb4));var _0x999e=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x99e9[_0x5de214];return _0x4df627;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Tag,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x66fa=['../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd26bc,_0x53f956){var _0x30135a=function(_0x5c52d7){while(--_0x5c52d7){_0xd26bc['push'](_0xd26bc['shift']());}};_0x30135a(++_0x53f956);}(_0x66fa,0x168));var _0xa66f=function(_0x28f639,_0x5aa288){_0x28f639=_0x28f639-0x0;var _0x285668=_0x66fa[_0x28f639];return _0x285668;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var jayson=require(_0xa66f('0x9'));var client=jayson[_0xa66f('0xa')][_0xa66f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33bd0d,_0x150f73,_0x5b7cf7){return new BPromise(function(_0x1cf624,_0x5ec156){return client[_0xa66f('0xc')](_0x33bd0d,_0x5b7cf7)[_0xa66f('0xd')](function(_0x5ad336){logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,_0xa66f('0x10'));logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x150f73,_0xa66f('0x10'),JSON['stringify'](_0x5ad336));if(_0x5ad336['error']){if(_0x5ad336[_0xa66f('0x13')]['code']===0x1f4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')]['message']);return _0x5ec156(_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);}logger['error'](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);return _0x1cf624(_0x5ad336[_0xa66f('0x13')]['message']);}else{logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,'request\x20sent');_0x1cf624(_0x5ad336[_0xa66f('0x15')][_0xa66f('0x14')]);}})[_0xa66f('0x16')](function(_0x76af81){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x76af81);_0x5ec156(_0x76af81);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 249661e..6052664 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 3da7cdc..4d62e01 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x5eef18,_0x543492){var _0x7dfbb7=function(_0x29a388){while(--_0x29a388){_0x5eef18['push'](_0x5eef18['shift']());}};_0x7dfbb7(++_0x543492);}(_0x757a,0xde));var _0xa757=function(_0xff281,_0xa93d6f){_0xff281=_0xff281-0x0;var _0x3515ea=_0x757a[_0xff281];return _0x3515ea;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 12c7d22..d8bae16 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 _0x3de0=['format','all','TeamVoicePrefix','spread','removeAgents','Chat','Mail','Sms','Openchannel','transaction','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','json','offset','undefined','limit','count','status','apply','reject','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','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','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','UserProfileResource','Teams','end','channel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','addQueues','findOne','add','Queues','ids','removeQueues','isValidChannel','remove','addAgents','isArray','Whatsapp','Voice','through','QueueId','TeamVoiceQueue','penalty','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil'];(function(_0x4a44b1,_0x367aa9){var _0x57d22e=function(_0x5a633f){while(--_0x5a633f){_0x4a44b1['push'](_0x4a44b1['shift']());}};_0x57d22e(++_0x367aa9);}(_0x3de0,0x1e4));var _0x03de=function(_0x18be83,_0x40d71c){_0x18be83=_0x18be83-0x0;var _0x92a599=_0x3de0[_0x18be83];return _0x92a599;};'use strict';var emlformat=require(_0x03de('0x0'));var rimraf=require(_0x03de('0x1'));var zipdir=require(_0x03de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03de('0x3'));var moment=require(_0x03de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03de('0x5'));var util=require(_0x03de('0x6'));var path=require('path');var sox=require(_0x03de('0x7'));var csv=require('to-csv');var ejs=require(_0x03de('0x8'));var fs=require('fs');var fs_extra=require(_0x03de('0x9'));var _=require(_0x03de('0xa'));var squel=require('squel');var crypto=require(_0x03de('0xb'));var jsforce=require(_0x03de('0xc'));var deskjs=require(_0x03de('0xd'));var toCsv=require(_0x03de('0xe'));var querystring=require(_0x03de('0xf'));var Papa=require(_0x03de('0x10'));var Redis=require(_0x03de('0x11'));var authService=require(_0x03de('0x12'));var qs=require(_0x03de('0x13'));var as=require(_0x03de('0x14'));var hardwareService=require(_0x03de('0x15'));var logger=require(_0x03de('0x16'))(_0x03de('0x17'));var utils=require(_0x03de('0x18'));var config=require(_0x03de('0x19'));var licenseUtil=require(_0x03de('0x1a'));var db=require(_0x03de('0x1b'))['db'];config[_0x03de('0x1c')]=_[_0x03de('0x1d')](config[_0x03de('0x1c')],{'host':_0x03de('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03de('0x1c')]));require(_0x03de('0x1f'))[_0x03de('0x20')](socket);function respondWithStatusCode(_0x9608b,_0x4c2da7){_0x4c2da7=_0x4c2da7||0xcc;return function(_0x43deb4){if(_0x43deb4){return _0x9608b[_0x03de('0x21')](_0x4c2da7);}return _0x9608b['status'](_0x4c2da7)['end']();};}function respondWithResult(_0x43120c,_0x56cae6){_0x56cae6=_0x56cae6||0xc8;return function(_0x302cfb){if(_0x302cfb){return _0x43120c['status'](_0x56cae6)[_0x03de('0x22')](_0x302cfb);}};}function respondWithFilteredResult(_0x551f43,_0x522362){return function(_0x5768da){if(_0x5768da){var _0xd5985e=typeof _0x522362[_0x03de('0x23')]===_0x03de('0x24')&&typeof _0x522362[_0x03de('0x25')]===_0x03de('0x24');var _0x317e8d=_0x5768da[_0x03de('0x26')];var _0x582775=_0xd5985e?0x0:_0x522362['offset'];var _0x4be3c5=_0xd5985e?_0x5768da[_0x03de('0x26')]:_0x522362['offset']+_0x522362['limit'];var _0x434fd6;if(_0x4be3c5>=_0x317e8d){_0x4be3c5=_0x317e8d;_0x434fd6=0xc8;}else{_0x434fd6=0xce;}_0x551f43[_0x03de('0x27')](_0x434fd6);return _0x551f43['set']('Content-Range',_0x582775+'-'+_0x4be3c5+'/'+_0x317e8d)[_0x03de('0x22')](_0x5768da);}return null;};}function patchUpdates(_0x4f9a2b){return function(_0x1f50f4){try{jsonpatch[_0x03de('0x28')](_0x1f50f4,_0x4f9a2b,!![]);}catch(_0x53de60){return BPromise[_0x03de('0x29')](_0x53de60);}return _0x1f50f4['save']();};}function saveUpdates(_0x52fd86,_0x4d7ac2){return function(_0x4a8d4f){if(_0x4a8d4f){return _0x4a8d4f[_0x03de('0x2a')](_0x52fd86)[_0x03de('0x2b')](function(_0x152571){return _0x152571;});}return null;};}function handleEntityNotFound(_0x1df495,_0x7ba016){return function(_0x372073){if(!_0x372073){_0x1df495[_0x03de('0x21')](0x194);}return _0x372073;};}function handleError(_0xd4581e,_0x733b9){_0x733b9=_0x733b9||0x1f4;return function(_0x476a37){logger[_0x03de('0x2c')](_0x476a37[_0x03de('0x2d')]);if(_0x476a37['name']){delete _0x476a37[_0x03de('0x2e')];}_0xd4581e[_0x03de('0x27')](_0x733b9)[_0x03de('0x2f')](_0x476a37);};}exports[_0x03de('0x30')]=function(_0xa4b556,_0x11568d){var _0x16a0e8={},_0x406483={},_0x5a92cb={'count':0x0,'rows':[]};var _0x2c490d=_[_0x03de('0x31')](db[_0x03de('0x32')][_0x03de('0x33')],function(_0x5c5016){return{'name':_0x5c5016[_0x03de('0x34')],'type':_0x5c5016[_0x03de('0x35')][_0x03de('0x36')]};});_0x406483['model']=_[_0x03de('0x31')](_0x2c490d,_0x03de('0x2e'));_0x406483[_0x03de('0x37')]=_[_0x03de('0x38')](_0xa4b556[_0x03de('0x37')]);_0x406483[_0x03de('0x39')]=_[_0x03de('0x3a')](_0x406483[_0x03de('0x3b')],_0x406483[_0x03de('0x37')]);_0x16a0e8[_0x03de('0x3c')]=_['intersection'](_0x406483[_0x03de('0x3b')],qs[_0x03de('0x3d')](_0xa4b556[_0x03de('0x37')][_0x03de('0x3d')]));_0x16a0e8[_0x03de('0x3c')]=_0x16a0e8[_0x03de('0x3c')]['length']?_0x16a0e8[_0x03de('0x3c')]:_0x406483[_0x03de('0x3b')];if(!_0xa4b556[_0x03de('0x37')]['hasOwnProperty'](_0x03de('0x3e'))){_0x16a0e8[_0x03de('0x25')]=qs[_0x03de('0x25')](_0xa4b556['query']['limit']);_0x16a0e8['offset']=qs[_0x03de('0x23')](_0xa4b556[_0x03de('0x37')][_0x03de('0x23')]);}_0x16a0e8['order']=qs[_0x03de('0x3f')](_0xa4b556[_0x03de('0x37')][_0x03de('0x3f')]);_0x16a0e8[_0x03de('0x40')]=qs[_0x03de('0x39')](_[_0x03de('0x41')](_0xa4b556['query'],_0x406483[_0x03de('0x39')]),_0x2c490d);if(_0xa4b556[_0x03de('0x37')][_0x03de('0x42')]){_0x16a0e8[_0x03de('0x40')]=_[_0x03de('0x43')](_0x16a0e8[_0x03de('0x40')],{'$or':_[_0x03de('0x31')](_0x2c490d,function(_0x7450a3){if(_0x7450a3['type']!==_0x03de('0x44')){var _0x2c341e={};_0x2c341e[_0x7450a3[_0x03de('0x2e')]]={'$like':'%'+_0xa4b556[_0x03de('0x37')]['filter']+'%'};return _0x2c341e;}})});}_0x16a0e8=_[_0x03de('0x43')]({},_0x16a0e8,_0xa4b556[_0x03de('0x45')]);var _0x44cf9c={'where':_0x16a0e8[_0x03de('0x40')]};return db[_0x03de('0x32')][_0x03de('0x26')](_0x44cf9c)[_0x03de('0x2b')](function(_0x73398d){_0x5a92cb[_0x03de('0x26')]=_0x73398d;if(_0xa4b556[_0x03de('0x37')]['includeAll']){_0x16a0e8['include']=[{'all':!![]}];}return db['Team'][_0x03de('0x46')](_0x16a0e8);})[_0x03de('0x2b')](function(_0x2711fc){_0x5a92cb['rows']=_0x2711fc;return _0x5a92cb;})[_0x03de('0x2b')](respondWithFilteredResult(_0x11568d,_0x16a0e8))[_0x03de('0x47')](handleError(_0x11568d,null));};exports[_0x03de('0x48')]=function(_0xf753d9,_0xd4344e){var _0x8fc448={'raw':![],'where':{'id':_0xf753d9[_0x03de('0x49')]['id']}},_0x45fe49={};_0x45fe49[_0x03de('0x3b')]=_[_0x03de('0x38')](db[_0x03de('0x32')]['rawAttributes']);_0x45fe49[_0x03de('0x37')]=_[_0x03de('0x38')](_0xf753d9[_0x03de('0x37')]);_0x45fe49[_0x03de('0x39')]=_[_0x03de('0x3a')](_0x45fe49[_0x03de('0x3b')],_0x45fe49['query']);_0x8fc448[_0x03de('0x3c')]=_[_0x03de('0x3a')](_0x45fe49[_0x03de('0x3b')],qs[_0x03de('0x3d')](_0xf753d9[_0x03de('0x37')][_0x03de('0x3d')]));_0x8fc448[_0x03de('0x3c')]=_0x8fc448[_0x03de('0x3c')][_0x03de('0x4a')]?_0x8fc448[_0x03de('0x3c')]:_0x45fe49['model'];if(_0xf753d9[_0x03de('0x37')]['includeAll']){_0x8fc448[_0x03de('0x4b')]=[{'all':!![]}];}_0x8fc448=_[_0x03de('0x43')]({},_0x8fc448,_0xf753d9[_0x03de('0x45')]);return db[_0x03de('0x32')][_0x03de('0x4c')](_0x8fc448)[_0x03de('0x2b')](handleEntityNotFound(_0xd4344e,null))[_0x03de('0x2b')](respondWithResult(_0xd4344e,null))[_0x03de('0x47')](handleError(_0xd4344e,null));};exports['create']=function(_0x1381c3,_0x192f9c){return db[_0x03de('0x32')][_0x03de('0x4d')](_0x1381c3[_0x03de('0x4e')],{})[_0x03de('0x2b')](function(_0x434d11){var _0x2f6e6f=_0x1381c3['user']['get']({'plain':!![]});if(!_0x2f6e6f)throw new Error(_0x03de('0x4f'));if(_0x2f6e6f['role']===_0x03de('0x50')){var _0x5caef1=_0x434d11[_0x03de('0x51')]({'plain':!![]});var _0x20e1e9='Teams';return db[_0x03de('0x52')][_0x03de('0x4c')]({'where':{'name':_0x20e1e9,'userProfileId':_0x2f6e6f[_0x03de('0x53')]},'raw':!![]})['then'](function(_0x7e0dc9){if(_0x7e0dc9&&_0x7e0dc9[_0x03de('0x54')]===0x0){return db['UserProfileResource'][_0x03de('0x4d')]({'name':_0x5caef1[_0x03de('0x2e')],'resourceId':_0x5caef1['id'],'type':_0x7e0dc9['name'],'sectionId':_0x7e0dc9['id']},{})[_0x03de('0x2b')](function(){return _0x434d11;});}else{return _0x434d11;}})[_0x03de('0x47')](function(_0x3ec66b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ec66b);throw _0x3ec66b;});}return _0x434d11;})[_0x03de('0x2b')](respondWithResult(_0x192f9c,0xc9))[_0x03de('0x47')](handleError(_0x192f9c,null));};exports['update']=function(_0x3b87f1,_0x40c85a){if(_0x3b87f1[_0x03de('0x4e')]['id']){delete _0x3b87f1[_0x03de('0x4e')]['id'];}return db[_0x03de('0x32')][_0x03de('0x4c')]({'where':{'id':_0x3b87f1[_0x03de('0x49')]['id']}})['then'](handleEntityNotFound(_0x40c85a,null))[_0x03de('0x2b')](saveUpdates(_0x3b87f1[_0x03de('0x4e')],null))[_0x03de('0x2b')](respondWithResult(_0x40c85a,null))[_0x03de('0x47')](handleError(_0x40c85a,null));};exports['destroy']=function(_0x232b8a,_0x3c00d5){var _0x5a7c84=_0x232b8a[_0x03de('0x49')]['id'];var _0xd7313c=[];return db['sequelize']['transaction'](function(_0x12b18a){var _0x672392='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5a7c84;return db[_0x03de('0x55')][_0x03de('0x37')](_0x672392,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a})[_0x03de('0x2b')](function(_0x1c82f8){_0xd7313c=_['map'](_0x1c82f8,function(_0x225e5d){return Number(_0x225e5d[_0x03de('0x59')]);});})['then'](function(){var _0x2eba66='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5a7c84;return db[_0x03de('0x55')]['query'](_0x2eba66,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})['then'](function(_0x16504a){var _0x10f3a7=_[_0x03de('0x31')](_0x16504a,function(_0x454b25){return Number(_0x454b25[_0x03de('0x5a')]);});return db[_0x03de('0x5b')][_0x03de('0x5c')]({'where':{'UserId':{'$in':_0xd7313c},'VoiceQueueId':{'$in':_0x10f3a7}},'transaction':_0x12b18a});})['then'](function(){var _0x57a3e9=_0x03de('0x5d')+_0x5a7c84;return db['sequelize']['query'](_0x57a3e9,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})['then'](function(_0x17c314){var _0x449702=_[_0x03de('0x31')](_0x17c314,function(_0x1eb004){return Number(_0x1eb004[_0x03de('0x5e')]);});return db[_0x03de('0x5f')][_0x03de('0x5c')]({'where':{'UserId':{'$in':_0xd7313c},'MailQueueId':{'$in':_0x449702}},'transaction':_0x12b18a});})[_0x03de('0x2b')](function(){var _0x195f56=_0x03de('0x60')+_0x5a7c84;return db['sequelize']['query'](_0x195f56,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0xe2b144){var _0x2cea0a=_[_0x03de('0x31')](_0xe2b144,function(_0x52dded){return Number(_0x52dded[_0x03de('0x61')]);});return db[_0x03de('0x62')][_0x03de('0x5c')]({'where':{'UserId':{'$in':_0xd7313c},'SmsQueueId':{'$in':_0x2cea0a}},'transaction':_0x12b18a});})[_0x03de('0x2b')](function(){var _0x2d080d='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5a7c84;return db[_0x03de('0x55')][_0x03de('0x37')](_0x2d080d,{'type':db[_0x03de('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0x1ad37b){var _0xb6b7eb=_[_0x03de('0x31')](_0x1ad37b,function(_0x17b0d7){return Number(_0x17b0d7[_0x03de('0x63')]);});return db[_0x03de('0x64')]['destroy']({'where':{'UserId':{'$in':_0xd7313c},'ChatQueueId':{'$in':_0xb6b7eb}},'transaction':_0x12b18a});})[_0x03de('0x2b')](function(){var _0x5cae2c=_0x03de('0x65')+_0x5a7c84;return db['sequelize'][_0x03de('0x37')](_0x5cae2c,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0x4d19bb){var _0xa4b21c=_[_0x03de('0x31')](_0x4d19bb,function(_0x47c08a){return Number(_0x47c08a[_0x03de('0x66')]);});return db[_0x03de('0x67')][_0x03de('0x5c')]({'where':{'UserId':{'$in':_0xd7313c},'FaxQueueId':{'$in':_0xa4b21c}},'transaction':_0x12b18a});})['then'](function(){var _0x9f8616=_0x03de('0x68')+_0x5a7c84;return db[_0x03de('0x55')][_0x03de('0x37')](_0x9f8616,{'type':db['Sequelize'][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0x4702ae){var _0x16eada=_[_0x03de('0x31')](_0x4702ae,function(_0x5f3f0f){return Number(_0x5f3f0f[_0x03de('0x69')]);});return db[_0x03de('0x6a')]['destroy']({'where':{'UserId':{'$in':_0xd7313c},'OpenchannelQueueId':{'$in':_0x16eada}},'transaction':_0x12b18a});})[_0x03de('0x2b')](function(){var _0x54c449=_0x03de('0x6b')+_0x5a7c84;return db[_0x03de('0x55')][_0x03de('0x37')](_0x54c449,{'type':db[_0x03de('0x56')][_0x03de('0x57')][_0x03de('0x58')],'raw':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0x2a9b02){var _0x3de22a=_[_0x03de('0x31')](_0x2a9b02,function(_0x5410e0){return Number(_0x5410e0['WhatsappQueueId']);});return db[_0x03de('0x6c')]['destroy']({'where':{'UserId':{'$in':_0xd7313c},'WhatsappQueueId':{'$in':_0x3de22a}},'transaction':_0x12b18a});})['then'](function(){return db['TeamVoicePrefix'][_0x03de('0x4c')]({'where':{'TeamId':_0x5a7c84}});})[_0x03de('0x2b')](function(_0x47a017){if(_0x47a017===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0xd7313c},'VoicePrefixId':_0x47a017[_0x03de('0x6d')]},'transaction':_0x12b18a});})[_0x03de('0x2b')](function(){return db[_0x03de('0x32')][_0x03de('0x5c')]({'where':{'id':_0x5a7c84},'cascade':!![],'transaction':_0x12b18a});})[_0x03de('0x2b')](function(_0x5e9cba){if(_0x5e9cba===0x0){_0x3c00d5[_0x03de('0x21')](0x194);}else{return db[_0x03de('0x6e')][_0x03de('0x5c')]({'where':{'type':_0x03de('0x6f'),'resourceId':_0x5a7c84},'cascade':!![],'transaction':_0x12b18a})[_0x03de('0x2b')](function(){_0x3c00d5[_0x03de('0x27')](0xcc)[_0x03de('0x70')]();});}})[_0x03de('0x47')](function(_0xea9cfb){_0x3c00d5['status'](0x1f4)['send'](_0xea9cfb);});});};exports['getQueues']=function(_0x1fac6f,_0x3522d2,_0x43fce7){return db[_0x03de('0x32')]['findOne']({'where':{'id':_0x1fac6f[_0x03de('0x49')]['id']}})[_0x03de('0x2b')](handleEntityNotFound(_0x3522d2,null))['then'](function(_0x556d0e){if(!_0x1fac6f[_0x03de('0x37')][_0x03de('0x71')]||!utils['isValidChannel'](_0x1fac6f[_0x03de('0x37')][_0x03de('0x71')])){throw new db['Sequelize'][(_0x03de('0x72'))](_0x03de('0x73'));}var _0x1518bd={};var _0x57ee5e={};_0x57ee5e[_0x03de('0x3b')]=_[_0x03de('0x38')](db[_[_0x03de('0x74')](_0x1fac6f[_0x03de('0x37')][_0x03de('0x71')]['toLowerCase']())+_0x03de('0x75')][_0x03de('0x33')]);_0x57ee5e[_0x03de('0x37')]=_[_0x03de('0x38')](_0x1fac6f[_0x03de('0x37')]);_0x57ee5e[_0x03de('0x39')]=_[_0x03de('0x3a')](_0x57ee5e['model'],_0x57ee5e[_0x03de('0x37')]);_0x1518bd[_0x03de('0x3c')]=_['intersection'](_0x57ee5e['model'],qs[_0x03de('0x3d')](_0x1fac6f[_0x03de('0x37')][_0x03de('0x3d')]));_0x1518bd[_0x03de('0x3c')]=_0x1518bd[_0x03de('0x3c')]['length']?_0x1518bd[_0x03de('0x3c')]:_0x57ee5e[_0x03de('0x3b')];_0x1518bd['limit']=qs[_0x03de('0x25')](_0x1fac6f['query'][_0x03de('0x25')]);_0x1518bd[_0x03de('0x23')]=qs[_0x03de('0x23')](_0x1fac6f[_0x03de('0x37')][_0x03de('0x23')]);_0x1518bd['order']=qs['sort'](_0x1fac6f['query'][_0x03de('0x3f')]);_0x1518bd[_0x03de('0x40')]=qs[_0x03de('0x39')](_[_0x03de('0x41')](_0x1fac6f['query'],_0x57ee5e[_0x03de('0x39')]));_0x1518bd=_[_0x03de('0x43')]({},_0x1518bd,_0x1fac6f['options']);return _0x556d0e['get'+_[_0x03de('0x74')](_0x1fac6f[_0x03de('0x37')][_0x03de('0x71')][_0x03de('0x76')]())+'Queues'](_0x1518bd);})[_0x03de('0x2b')](respondWithResult(_0x3522d2,null))[_0x03de('0x47')](handleError(_0x3522d2,null));};exports[_0x03de('0x77')]=function(_0x15e95e,_0x5f2075,_0x251bb0){return db[_0x03de('0x32')][_0x03de('0x78')]({'where':{'id':_0x15e95e[_0x03de('0x49')]['id']}})[_0x03de('0x2b')](function(_0x5174be){if(_0x5174be){if(!_0x15e95e['body'][_0x03de('0x71')]||!utils['isValidChannel'](_0x15e95e['body'][_0x03de('0x71')])){throw new db['Sequelize'][(_0x03de('0x72'))](_0x03de('0x73'));}return _0x5174be[_0x03de('0x79')+_[_0x03de('0x74')](_0x15e95e[_0x03de('0x4e')][_0x03de('0x71')][_0x03de('0x76')]())+_0x03de('0x7a')](_0x15e95e[_0x03de('0x4e')][_0x03de('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x5f2075,null))[_0x03de('0x2b')](respondWithStatusCode(_0x5f2075,null))[_0x03de('0x47')](handleError(_0x5f2075,null));};exports[_0x03de('0x7c')]=function(_0x4d5b12,_0x510c09,_0x447d50){return db['Team']['findOne']({'where':{'id':_0x4d5b12[_0x03de('0x49')]['id']}})[_0x03de('0x2b')](function(_0x369695){if(_0x369695){if(!_0x4d5b12[_0x03de('0x37')]['channel']||!utils[_0x03de('0x7d')](_0x4d5b12[_0x03de('0x37')][_0x03de('0x71')])){throw new db[(_0x03de('0x56'))][(_0x03de('0x72'))](_0x03de('0x73'));}return _0x369695[_0x03de('0x7e')+_[_0x03de('0x74')](_0x4d5b12[_0x03de('0x37')]['channel'][_0x03de('0x76')]())+_0x03de('0x7a')](_0x4d5b12[_0x03de('0x37')][_0x03de('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x510c09,null))[_0x03de('0x2b')](respondWithStatusCode(_0x510c09,null))[_0x03de('0x47')](handleError(_0x510c09,null));};exports[_0x03de('0x7f')]=function(_0x2a902d,_0x5d00d7){var _0x56c164=_[_0x03de('0x80')](_0x2a902d[_0x03de('0x4e')][_0x03de('0x7b')])?_0x2a902d['body']['ids']:[_0x2a902d['body']['ids']];var _0x5ed7d8=_0x2a902d[_0x03de('0x49')]['id'];return db[_0x03de('0x32')][_0x03de('0x4c')]({'where':{'id':_0x5ed7d8}})[_0x03de('0x2b')](handleEntityNotFound(_0x5d00d7,null))[_0x03de('0x2b')](function(_0x1a8dc3){if(_0x1a8dc3){var _0x45bd97=['Voice','Chat','Mail','Sms','Fax','Openchannel',_0x03de('0x81')];return db[_0x03de('0x55')]['transaction'](function(_0x4ac629){var _0xe713a5=_[_0x03de('0x31')](_0x45bd97,function(_0x4510f7){var _0x4d46ab={'attributes':['id',_0x03de('0x2e')]};if(_0x4510f7===_0x03de('0x82')){_0x4d46ab[_0x03de('0x83')]={'attributes':['penalty']};}return _0x1a8dc3[_0x03de('0x51')+_0x4510f7+_0x03de('0x7a')](_0x4d46ab)[_0x03de('0x2b')](function(_0x4ae7cb){var _0x3ddd34=_[_0x03de('0x31')](_0x4ae7cb,function(_0x4b2362){var _0x3918d4=_[_0x03de('0x31')](_0x56c164,function(_0x5074df){var _0xf61d3f={'where':{'UserId':_0x5074df,[_0x4510f7+_0x03de('0x84')]:_0x4b2362['id']},'transaction':_0x4ac629};if(_0x4510f7===_0x03de('0x82')){_0xf61d3f[_0x03de('0x1d')]={'penalty':_0x4b2362[_0x03de('0x85')][_0x03de('0x86')]};}return db[_0x03de('0x87')+_0x4510f7+'Queue']['findOrCreate'](_0xf61d3f)[_0x03de('0x2b')](function(){socket[_0x03de('0x88')](_0x03de('0x50')+_0x4510f7+_0x03de('0x89'),{'UserId':_0x5074df,[_0x4510f7+'QueueId']:_0x4b2362['id']});if(_0x4510f7!==_0x03de('0x82')){return;}return db['User']['findAll']({'where':{'id':_0x56c164,'online':0x1},'attributes':['id',_0x03de('0x2e'),_0x03de('0x8a'),_0x03de('0x8b'),_0x03de('0x8c')],'raw':!![]})[_0x03de('0x2b')](function(_0x420747){var _0x5e09c6=_[_0x03de('0x31')](_0x420747,function(_0x3e7d98){return db[_0x03de('0x8d')][_0x03de('0x8e')]({'membername':_0x3e7d98[_0x03de('0x2e')],'UserId':_0x3e7d98['id'],'queue_name':_0x4b2362[_0x03de('0x2e')],'VoiceQueueId':_0x4b2362['id'],'interface':_[_0x03de('0x8f')](_0x3e7d98['interface'])?util[_0x03de('0x90')]('SIP/%s',_0x3e7d98[_0x03de('0x2e')]):_0x3e7d98[_0x03de('0x8c')],'paused':_0x3e7d98[_0x03de('0x8b')]||![],'penalty':_0x4b2362['TeamVoiceQueue'][_0x03de('0x86')]},{'transaction':_0x4ac629});});return Promise[_0x03de('0x91')](_0x5e09c6);});});});return Promise[_0x03de('0x91')](_0x3918d4);});return Promise[_0x03de('0x91')](_0x3ddd34);})[_0x03de('0x2b')](function(){return db[_0x03de('0x92')][_0x03de('0x78')]({'where':{'teamId':_0x5ed7d8}})[_0x03de('0x2b')](function(_0x1243e9){if(_0x1243e9){var _0x436d26=_[_0x03de('0x31')](_0x56c164,function(_0x532e64){db['UserVoicePrefix'][_0x03de('0x8e')]({'UserId':_0x532e64,'VoicePrefixId':_0x1243e9[_0x03de('0x6d')]});});return Promise['all'](_0x436d26);}});});});return Promise['all'](_0xe713a5)[_0x03de('0x2b')](function(){return _0x1a8dc3['addAgents'](_0x56c164,{'transaction':_0x4ac629})[_0x03de('0x93')](function(_0x2a5615){return _0x2a5615;});});});}})[_0x03de('0x2b')](respondWithResult(_0x5d00d7,null))[_0x03de('0x47')](handleError(_0x5d00d7,null));};exports[_0x03de('0x94')]=function(_0x555252,_0x1c39f3){var _0x382706=_[_0x03de('0x80')](_0x555252[_0x03de('0x37')][_0x03de('0x7b')])?_0x555252[_0x03de('0x37')][_0x03de('0x7b')]:[_0x555252[_0x03de('0x37')][_0x03de('0x7b')]];var _0x1549b9=_0x555252[_0x03de('0x49')]['id'];return db[_0x03de('0x32')][_0x03de('0x4c')]({'where':{'id':_0x1549b9}})[_0x03de('0x2b')](handleEntityNotFound(_0x1c39f3,null))[_0x03de('0x2b')](function(_0x48d799){if(_0x48d799){var _0xbba003=[_0x03de('0x82'),_0x03de('0x95'),_0x03de('0x96'),_0x03de('0x97'),'Fax',_0x03de('0x98'),'Whatsapp'];return db[_0x03de('0x55')][_0x03de('0x99')](function(_0x51c0d5){var _0x54fc52=_[_0x03de('0x31')](_0xbba003,function(_0x4d63e2){var _0x24879e={'attributes':['id','name']};return _0x48d799[_0x03de('0x51')+_0x4d63e2+_0x03de('0x7a')](_0x24879e)[_0x03de('0x2b')](function(_0x44d0cb){var _0x419883=_[_0x03de('0x31')](_0x44d0cb,function(_0x284d30){return _0x284d30[_0x03de('0x94')](_0x382706,{'transaction':_0x51c0d5})['then'](function(){var _0x4c7cd1=_[_0x03de('0x31')](_0x382706,function(_0x4b5180){socket[_0x03de('0x88')](_0x03de('0x50')+_0x4d63e2+_0x03de('0x9a'),{'UserId':Number(_0x4b5180),[_0x4d63e2+_0x03de('0x84')]:_0x284d30['id']});if(_0x4d63e2!==_0x03de('0x82')){return;}return db['UserVoiceQueueRt'][_0x03de('0x5c')]({'where':{'VoiceQueueId':_0x284d30['id'],'UserId':_0x4b5180},'transaction':_0x51c0d5});});return Promise['all'](_0x4c7cd1);});});return Promise[_0x03de('0x91')](_0x419883);});});return Promise[_0x03de('0x91')](_0x54fc52)['then'](function(){return _0x48d799[_0x03de('0x94')](_0x382706,{'transaction':_0x51c0d5});})[_0x03de('0x2b')](function(){return db[_0x03de('0x92')]['findOne']({'where':{'teamId':_0x1549b9}})['then'](function(_0x220dac){if(_0x220dac){var _0x58077e=_['map'](_0x382706,function(_0x2e0473){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2e0473,'VoicePrefixId':_0x220dac[_0x03de('0x6d')]}});});return Promise[_0x03de('0x91')](_0x58077e);}});});});}})[_0x03de('0x2b')](respondWithStatusCode(_0x1c39f3,null))['catch'](handleError(_0x1c39f3,null));};exports['getAgents']=function(_0x5a0a12,_0x219e1d,_0x284ef5){var _0x35b3bf={};var _0x752d7d={};var _0x1bb69b;var _0x3db0b2;return db[_0x03de('0x32')][_0x03de('0x78')]({'where':{'id':_0x5a0a12[_0x03de('0x49')]['id']}})['then'](handleEntityNotFound(_0x219e1d,null))[_0x03de('0x2b')](function(_0x4ef67f){if(_0x4ef67f){_0x1bb69b=_0x4ef67f;_0x752d7d[_0x03de('0x3b')]=_[_0x03de('0x38')](db['User'][_0x03de('0x33')]);_0x752d7d['query']=_['keys'](_0x5a0a12[_0x03de('0x37')]);_0x752d7d['filters']=_[_0x03de('0x3a')](_0x752d7d[_0x03de('0x3b')],_0x752d7d[_0x03de('0x37')]);_0x35b3bf[_0x03de('0x3c')]=_['intersection'](_0x752d7d[_0x03de('0x3b')],qs[_0x03de('0x3d')](_0x5a0a12['query']['fields']));_0x35b3bf[_0x03de('0x3c')]=_0x35b3bf[_0x03de('0x3c')]['length']?_0x35b3bf[_0x03de('0x3c')]:_0x752d7d['model'];_0x35b3bf['order']=qs[_0x03de('0x3f')](_0x5a0a12[_0x03de('0x37')][_0x03de('0x3f')]);_0x35b3bf[_0x03de('0x40')]=qs[_0x03de('0x39')](_[_0x03de('0x41')](_0x5a0a12[_0x03de('0x37')],_0x752d7d[_0x03de('0x39')]));if(_0x5a0a12[_0x03de('0x37')]['filter']){_0x35b3bf[_0x03de('0x40')]=_[_0x03de('0x43')](_0x35b3bf[_0x03de('0x40')],{'$or':_[_0x03de('0x31')](_0x35b3bf['attributes'],function(_0x91e467){var _0x371efb={};_0x371efb[_0x91e467]={'$like':'%'+_0x5a0a12[_0x03de('0x37')]['filter']+'%'};return _0x371efb;})});}_0x35b3bf=_['merge']({},_0x35b3bf,_0x5a0a12[_0x03de('0x45')]);return _0x1bb69b[_0x03de('0x9b')](_0x35b3bf);}})['then'](function(_0x5c3612){if(_0x5c3612){_0x3db0b2=_0x5c3612[_0x03de('0x4a')];if(!_0x5a0a12[_0x03de('0x37')][_0x03de('0x9c')](_0x03de('0x3e'))){_0x35b3bf[_0x03de('0x25')]=qs[_0x03de('0x25')](_0x5a0a12['query'][_0x03de('0x25')]);_0x35b3bf[_0x03de('0x23')]=qs[_0x03de('0x23')](_0x5a0a12[_0x03de('0x37')][_0x03de('0x23')]);}return _0x1bb69b[_0x03de('0x9b')](_0x35b3bf);}})[_0x03de('0x2b')](function(_0x469b26){if(_0x469b26){return _0x469b26?{'count':_0x3db0b2,'rows':_0x469b26}:null;}})['then'](respondWithResult(_0x219e1d,null))[_0x03de('0x47')](handleError(_0x219e1d,null));}; \ No newline at end of file +var _0xd5d9=['ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','include','findAll','rows','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','update','body','params','destroy','sequelize','transaction','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','Queues','findOne','add','toLowerCase','ids','remove','addAgents','isArray','Chat','Mail','Fax','Whatsapp','penalty','Voice','TeamVoiceQueue','User','emit','Queue:save','QueueId','interface','UserVoiceQueueRt','format','SIP/%s','voicePause','all','upsert','spread','removeAgents','Sms','Openchannel','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x2f3ffa,_0xd4b047){var _0x12abdd=function(_0x1d0ba1){while(--_0x1d0ba1){_0x2f3ffa['push'](_0x2f3ffa['shift']());}};_0x12abdd(++_0xd4b047);}(_0xd5d9,0x122));var _0x9d5d=function(_0x525c7a,_0x3575a8){_0x525c7a=_0x525c7a-0x0;var _0x55d606=_0xd5d9[_0x525c7a];return _0x55d606;};'use strict';var emlformat=require(_0x9d5d('0x0'));var rimraf=require(_0x9d5d('0x1'));var zipdir=require(_0x9d5d('0x2'));var jsonpatch=require(_0x9d5d('0x3'));var rp=require(_0x9d5d('0x4'));var moment=require(_0x9d5d('0x5'));var BPromise=require(_0x9d5d('0x6'));var Mustache=require(_0x9d5d('0x7'));var util=require(_0x9d5d('0x8'));var path=require(_0x9d5d('0x9'));var sox=require('sox');var csv=require(_0x9d5d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d5d('0xb'));var _=require(_0x9d5d('0xc'));var squel=require(_0x9d5d('0xd'));var crypto=require(_0x9d5d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9d5d('0xf'));var toCsv=require(_0x9d5d('0xa'));var querystring=require(_0x9d5d('0x10'));var Papa=require(_0x9d5d('0x11'));var Redis=require(_0x9d5d('0x12'));var authService=require(_0x9d5d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d5d('0x14'))('api');var utils=require(_0x9d5d('0x15'));var config=require(_0x9d5d('0x16'));var licenseUtil=require(_0x9d5d('0x17'));var db=require(_0x9d5d('0x18'))['db'];config[_0x9d5d('0x19')]=_[_0x9d5d('0x1a')](config[_0x9d5d('0x19')],{'host':_0x9d5d('0x1b'),'port':0x18eb});var socket=require(_0x9d5d('0x1c'))(new Redis(config[_0x9d5d('0x19')]));require(_0x9d5d('0x1d'))['register'](socket);function respondWithStatusCode(_0x272a1,_0x3d6bf7){_0x3d6bf7=_0x3d6bf7||0xcc;return function(_0x7def3a){if(_0x7def3a){return _0x272a1[_0x9d5d('0x1e')](_0x3d6bf7);}return _0x272a1[_0x9d5d('0x1f')](_0x3d6bf7)[_0x9d5d('0x20')]();};}function respondWithResult(_0x3bbecc,_0x4c2b92){_0x4c2b92=_0x4c2b92||0xc8;return function(_0x2f0ac6){if(_0x2f0ac6){return _0x3bbecc[_0x9d5d('0x1f')](_0x4c2b92)['json'](_0x2f0ac6);}};}function respondWithFilteredResult(_0x543f98,_0x9596ee){return function(_0x5118a4){if(_0x5118a4){var _0x431f39=typeof _0x9596ee[_0x9d5d('0x21')]===_0x9d5d('0x22')&&typeof _0x9596ee[_0x9d5d('0x23')]==='undefined';var _0x529d80=_0x5118a4['count'];var _0x18400f=_0x431f39?0x0:_0x9596ee[_0x9d5d('0x21')];var _0x95c747=_0x431f39?_0x5118a4[_0x9d5d('0x24')]:_0x9596ee[_0x9d5d('0x21')]+_0x9596ee['limit'];var _0x5694ad;if(_0x95c747>=_0x529d80){_0x95c747=_0x529d80;_0x5694ad=0xc8;}else{_0x5694ad=0xce;}_0x543f98[_0x9d5d('0x1f')](_0x5694ad);return _0x543f98['set'](_0x9d5d('0x25'),_0x18400f+'-'+_0x95c747+'/'+_0x529d80)[_0x9d5d('0x26')](_0x5118a4);}return null;};}function patchUpdates(_0x22e359){return function(_0x380125){try{jsonpatch[_0x9d5d('0x27')](_0x380125,_0x22e359,!![]);}catch(_0x5a8f48){return BPromise[_0x9d5d('0x28')](_0x5a8f48);}return _0x380125[_0x9d5d('0x29')]();};}function saveUpdates(_0xa1aa02,_0x2d7ec1){return function(_0x5eb0e9){if(_0x5eb0e9){return _0x5eb0e9['update'](_0xa1aa02)[_0x9d5d('0x2a')](function(_0x208696){return _0x208696;});}return null;};}function handleEntityNotFound(_0x4a3b44,_0x4be25f){return function(_0x5a4c1e){if(!_0x5a4c1e){_0x4a3b44['sendStatus'](0x194);}return _0x5a4c1e;};}function handleError(_0x4023b2,_0x12fd9f){_0x12fd9f=_0x12fd9f||0x1f4;return function(_0x2b3bce){logger[_0x9d5d('0x2b')](_0x2b3bce[_0x9d5d('0x2c')]);if(_0x2b3bce[_0x9d5d('0x2d')]){delete _0x2b3bce['name'];}_0x4023b2[_0x9d5d('0x1f')](_0x12fd9f)[_0x9d5d('0x2e')](_0x2b3bce);};}exports[_0x9d5d('0x2f')]=function(_0x259310,_0x4c0c27){var _0x40df61={},_0x4d0566={},_0xc8bcc6={'count':0x0,'rows':[]};var _0x2fd09a=_[_0x9d5d('0x30')](db[_0x9d5d('0x31')][_0x9d5d('0x32')],function(_0x39c322){return{'name':_0x39c322[_0x9d5d('0x33')],'type':_0x39c322['type']['key']};});_0x4d0566[_0x9d5d('0x34')]=_[_0x9d5d('0x30')](_0x2fd09a,_0x9d5d('0x2d'));_0x4d0566['query']=_[_0x9d5d('0x35')](_0x259310[_0x9d5d('0x36')]);_0x4d0566[_0x9d5d('0x37')]=_[_0x9d5d('0x38')](_0x4d0566['model'],_0x4d0566['query']);_0x40df61['attributes']=_[_0x9d5d('0x38')](_0x4d0566[_0x9d5d('0x34')],qs[_0x9d5d('0x39')](_0x259310[_0x9d5d('0x36')][_0x9d5d('0x39')]));_0x40df61[_0x9d5d('0x3a')]=_0x40df61[_0x9d5d('0x3a')][_0x9d5d('0x3b')]?_0x40df61['attributes']:_0x4d0566['model'];if(!_0x259310[_0x9d5d('0x36')][_0x9d5d('0x3c')](_0x9d5d('0x3d'))){_0x40df61['limit']=qs[_0x9d5d('0x23')](_0x259310[_0x9d5d('0x36')]['limit']);_0x40df61[_0x9d5d('0x21')]=qs['offset'](_0x259310[_0x9d5d('0x36')][_0x9d5d('0x21')]);}_0x40df61[_0x9d5d('0x3e')]=qs[_0x9d5d('0x3f')](_0x259310['query']['sort']);_0x40df61['where']=qs[_0x9d5d('0x37')](_[_0x9d5d('0x40')](_0x259310[_0x9d5d('0x36')],_0x4d0566[_0x9d5d('0x37')]),_0x2fd09a);if(_0x259310[_0x9d5d('0x36')][_0x9d5d('0x41')]){_0x40df61[_0x9d5d('0x42')]=_[_0x9d5d('0x43')](_0x40df61[_0x9d5d('0x42')],{'$or':_[_0x9d5d('0x30')](_0x2fd09a,function(_0x5f3622){if(_0x5f3622[_0x9d5d('0x44')]!=='VIRTUAL'){var _0x40a862={};_0x40a862[_0x5f3622[_0x9d5d('0x2d')]]={'$like':'%'+_0x259310['query']['filter']+'%'};return _0x40a862;}})});}_0x40df61=_['merge']({},_0x40df61,_0x259310[_0x9d5d('0x45')]);var _0x443807={'where':_0x40df61[_0x9d5d('0x42')]};return db[_0x9d5d('0x31')]['count'](_0x443807)['then'](function(_0x7a3f4){_0xc8bcc6[_0x9d5d('0x24')]=_0x7a3f4;if(_0x259310['query']['includeAll']){_0x40df61[_0x9d5d('0x46')]=[{'all':!![]}];}return db['Team'][_0x9d5d('0x47')](_0x40df61);})[_0x9d5d('0x2a')](function(_0x142aef){_0xc8bcc6[_0x9d5d('0x48')]=_0x142aef;return _0xc8bcc6;})[_0x9d5d('0x2a')](respondWithFilteredResult(_0x4c0c27,_0x40df61))[_0x9d5d('0x49')](handleError(_0x4c0c27,null));};exports[_0x9d5d('0x4a')]=function(_0x3b437d,_0x177e6a){var _0x13740b={'raw':![],'where':{'id':_0x3b437d['params']['id']}},_0x17668b={};_0x17668b[_0x9d5d('0x34')]=_['keys'](db[_0x9d5d('0x31')]['rawAttributes']);_0x17668b[_0x9d5d('0x36')]=_[_0x9d5d('0x35')](_0x3b437d['query']);_0x17668b['filters']=_[_0x9d5d('0x38')](_0x17668b['model'],_0x17668b['query']);_0x13740b[_0x9d5d('0x3a')]=_['intersection'](_0x17668b['model'],qs[_0x9d5d('0x39')](_0x3b437d[_0x9d5d('0x36')][_0x9d5d('0x39')]));_0x13740b[_0x9d5d('0x3a')]=_0x13740b[_0x9d5d('0x3a')][_0x9d5d('0x3b')]?_0x13740b[_0x9d5d('0x3a')]:_0x17668b[_0x9d5d('0x34')];if(_0x3b437d[_0x9d5d('0x36')][_0x9d5d('0x4b')]){_0x13740b[_0x9d5d('0x46')]=[{'all':!![]}];}_0x13740b=_[_0x9d5d('0x43')]({},_0x13740b,_0x3b437d[_0x9d5d('0x45')]);return db[_0x9d5d('0x31')][_0x9d5d('0x4c')](_0x13740b)['then'](handleEntityNotFound(_0x177e6a,null))[_0x9d5d('0x2a')](respondWithResult(_0x177e6a,null))[_0x9d5d('0x49')](handleError(_0x177e6a,null));};exports[_0x9d5d('0x4d')]=function(_0x100ede,_0x14c7f0){return db[_0x9d5d('0x31')][_0x9d5d('0x4d')](_0x100ede['body'],{})[_0x9d5d('0x2a')](function(_0x3b22bb){var _0x44f07a=_0x100ede[_0x9d5d('0x4e')][_0x9d5d('0x4f')]({'plain':!![]});if(!_0x44f07a)throw new Error(_0x9d5d('0x50'));if(_0x44f07a[_0x9d5d('0x51')]==='user'){var _0x465746=_0x3b22bb['get']({'plain':!![]});var _0x383b9d='Teams';return db['UserProfileSection'][_0x9d5d('0x4c')]({'where':{'name':_0x383b9d,'userProfileId':_0x44f07a[_0x9d5d('0x52')]},'raw':!![]})['then'](function(_0x946af9){if(_0x946af9&&_0x946af9[_0x9d5d('0x53')]===0x0){return db[_0x9d5d('0x54')][_0x9d5d('0x4d')]({'name':_0x465746[_0x9d5d('0x2d')],'resourceId':_0x465746['id'],'type':_0x946af9['name'],'sectionId':_0x946af9['id']},{})[_0x9d5d('0x2a')](function(){return _0x3b22bb;});}else{return _0x3b22bb;}})[_0x9d5d('0x49')](function(_0x5f1a15){logger[_0x9d5d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f1a15);throw _0x5f1a15;});}return _0x3b22bb;})[_0x9d5d('0x2a')](respondWithResult(_0x14c7f0,0xc9))[_0x9d5d('0x49')](handleError(_0x14c7f0,null));};exports[_0x9d5d('0x55')]=function(_0xf8b070,_0x56ac9c){if(_0xf8b070[_0x9d5d('0x56')]['id']){delete _0xf8b070[_0x9d5d('0x56')]['id'];}return db[_0x9d5d('0x31')][_0x9d5d('0x4c')]({'where':{'id':_0xf8b070[_0x9d5d('0x57')]['id']}})['then'](handleEntityNotFound(_0x56ac9c,null))[_0x9d5d('0x2a')](saveUpdates(_0xf8b070[_0x9d5d('0x56')],null))[_0x9d5d('0x2a')](respondWithResult(_0x56ac9c,null))[_0x9d5d('0x49')](handleError(_0x56ac9c,null));};exports[_0x9d5d('0x58')]=function(_0x9c9c6d,_0x4d1c20){var _0x2c863f=_0x9c9c6d[_0x9d5d('0x57')]['id'];var _0x36d921=[];return db[_0x9d5d('0x59')][_0x9d5d('0x5a')](function(_0x16a85c){var _0x27ba0e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2c863f;return db[_0x9d5d('0x59')]['query'](_0x27ba0e,{'type':db[_0x9d5d('0x5b')]['QueryTypes'][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c})[_0x9d5d('0x2a')](function(_0x7f2929){_0x36d921=_[_0x9d5d('0x30')](_0x7f2929,function(_0x1daff2){return Number(_0x1daff2['UserId']);});})[_0x9d5d('0x2a')](function(){var _0x3d45f3=_0x9d5d('0x5d')+_0x2c863f;return db[_0x9d5d('0x59')][_0x9d5d('0x36')](_0x3d45f3,{'type':db[_0x9d5d('0x5b')]['QueryTypes'][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x51ffee){var _0x147904=_[_0x9d5d('0x30')](_0x51ffee,function(_0x1447b1){return Number(_0x1447b1[_0x9d5d('0x5e')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x36d921},'VoiceQueueId':{'$in':_0x147904}},'transaction':_0x16a85c});})['then'](function(){var _0x265d0a=_0x9d5d('0x5f')+_0x2c863f;return db['sequelize'][_0x9d5d('0x36')](_0x265d0a,{'type':db['Sequelize']['QueryTypes'][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})['then'](function(_0x5afdbb){var _0x3f9ca4=_[_0x9d5d('0x30')](_0x5afdbb,function(_0x1a49c5){return Number(_0x1a49c5[_0x9d5d('0x60')]);});return db[_0x9d5d('0x61')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'MailQueueId':{'$in':_0x3f9ca4}},'transaction':_0x16a85c});})['then'](function(){var _0x2addee=_0x9d5d('0x62')+_0x2c863f;return db[_0x9d5d('0x59')][_0x9d5d('0x36')](_0x2addee,{'type':db[_0x9d5d('0x5b')][_0x9d5d('0x63')][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x220111){var _0x4454c3=_[_0x9d5d('0x30')](_0x220111,function(_0x307e15){return Number(_0x307e15['SmsQueueId']);});return db[_0x9d5d('0x64')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'SmsQueueId':{'$in':_0x4454c3}},'transaction':_0x16a85c});})['then'](function(){var _0xc66887=_0x9d5d('0x65')+_0x2c863f;return db[_0x9d5d('0x59')][_0x9d5d('0x36')](_0xc66887,{'type':db['Sequelize']['QueryTypes'][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x140315){var _0x44971a=_['map'](_0x140315,function(_0x34043c){return Number(_0x34043c[_0x9d5d('0x66')]);});return db[_0x9d5d('0x67')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'ChatQueueId':{'$in':_0x44971a}},'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(){var _0x1bd4e1='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c863f;return db['sequelize'][_0x9d5d('0x36')](_0x1bd4e1,{'type':db[_0x9d5d('0x5b')][_0x9d5d('0x63')][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x1fceed){var _0x5431d9=_[_0x9d5d('0x30')](_0x1fceed,function(_0x137f90){return Number(_0x137f90[_0x9d5d('0x68')]);});return db[_0x9d5d('0x69')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'FaxQueueId':{'$in':_0x5431d9}},'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(){var _0x2e3376=_0x9d5d('0x6a')+_0x2c863f;return db[_0x9d5d('0x59')][_0x9d5d('0x36')](_0x2e3376,{'type':db[_0x9d5d('0x5b')][_0x9d5d('0x63')]['SELECT'],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x225458){var _0x501ed2=_['map'](_0x225458,function(_0x4d7471){return Number(_0x4d7471[_0x9d5d('0x6b')]);});return db[_0x9d5d('0x6c')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'OpenchannelQueueId':{'$in':_0x501ed2}},'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(){var _0x2e7b1d=_0x9d5d('0x6d')+_0x2c863f;return db[_0x9d5d('0x59')][_0x9d5d('0x36')](_0x2e7b1d,{'type':db[_0x9d5d('0x5b')][_0x9d5d('0x63')][_0x9d5d('0x5c')],'raw':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x2a41cd){var _0x423dca=_[_0x9d5d('0x30')](_0x2a41cd,function(_0x247204){return Number(_0x247204[_0x9d5d('0x6e')]);});return db[_0x9d5d('0x6f')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'WhatsappQueueId':{'$in':_0x423dca}},'transaction':_0x16a85c});})['then'](function(){return db[_0x9d5d('0x70')][_0x9d5d('0x4c')]({'where':{'TeamId':_0x2c863f}});})[_0x9d5d('0x2a')](function(_0x4d2747){if(_0x4d2747===null){return;}return db[_0x9d5d('0x71')][_0x9d5d('0x58')]({'where':{'UserId':{'$in':_0x36d921},'VoicePrefixId':_0x4d2747[_0x9d5d('0x72')]},'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(){return db[_0x9d5d('0x31')][_0x9d5d('0x58')]({'where':{'id':_0x2c863f},'cascade':!![],'transaction':_0x16a85c});})[_0x9d5d('0x2a')](function(_0x270eea){if(_0x270eea===0x0){_0x4d1c20['sendStatus'](0x194);}else{return db[_0x9d5d('0x54')][_0x9d5d('0x58')]({'where':{'type':_0x9d5d('0x73'),'resourceId':_0x2c863f},'cascade':!![],'transaction':_0x16a85c})[_0x9d5d('0x2a')](function(){_0x4d1c20[_0x9d5d('0x1f')](0xcc)[_0x9d5d('0x20')]();});}})[_0x9d5d('0x49')](function(_0x3a0145){_0x4d1c20[_0x9d5d('0x1f')](0x1f4)[_0x9d5d('0x2e')](_0x3a0145);});});};exports['getQueues']=function(_0x400f6c,_0x3e6383,_0xacd021){return db[_0x9d5d('0x31')]['findOne']({'where':{'id':_0x400f6c[_0x9d5d('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e6383,null))['then'](function(_0x30464a){if(!_0x400f6c[_0x9d5d('0x36')][_0x9d5d('0x74')]||!utils[_0x9d5d('0x75')](_0x400f6c[_0x9d5d('0x36')][_0x9d5d('0x74')])){throw new db[(_0x9d5d('0x5b'))][(_0x9d5d('0x76'))](_0x9d5d('0x77'));}var _0x34f45f={};var _0x1f2a0d={};_0x1f2a0d[_0x9d5d('0x34')]=_['keys'](db[_[_0x9d5d('0x78')](_0x400f6c[_0x9d5d('0x36')][_0x9d5d('0x74')]['toLowerCase']())+_0x9d5d('0x79')][_0x9d5d('0x32')]);_0x1f2a0d[_0x9d5d('0x36')]=_['keys'](_0x400f6c[_0x9d5d('0x36')]);_0x1f2a0d[_0x9d5d('0x37')]=_[_0x9d5d('0x38')](_0x1f2a0d[_0x9d5d('0x34')],_0x1f2a0d[_0x9d5d('0x36')]);_0x34f45f[_0x9d5d('0x3a')]=_['intersection'](_0x1f2a0d[_0x9d5d('0x34')],qs[_0x9d5d('0x39')](_0x400f6c[_0x9d5d('0x36')]['fields']));_0x34f45f['attributes']=_0x34f45f[_0x9d5d('0x3a')][_0x9d5d('0x3b')]?_0x34f45f[_0x9d5d('0x3a')]:_0x1f2a0d['model'];_0x34f45f[_0x9d5d('0x23')]=qs['limit'](_0x400f6c[_0x9d5d('0x36')][_0x9d5d('0x23')]);_0x34f45f[_0x9d5d('0x21')]=qs['offset'](_0x400f6c[_0x9d5d('0x36')]['offset']);_0x34f45f[_0x9d5d('0x3e')]=qs[_0x9d5d('0x3f')](_0x400f6c[_0x9d5d('0x36')][_0x9d5d('0x3f')]);_0x34f45f[_0x9d5d('0x42')]=qs[_0x9d5d('0x37')](_[_0x9d5d('0x40')](_0x400f6c[_0x9d5d('0x36')],_0x1f2a0d[_0x9d5d('0x37')]));_0x34f45f=_[_0x9d5d('0x43')]({},_0x34f45f,_0x400f6c[_0x9d5d('0x45')]);return _0x30464a[_0x9d5d('0x4f')+_[_0x9d5d('0x78')](_0x400f6c['query'][_0x9d5d('0x74')]['toLowerCase']())+_0x9d5d('0x7a')](_0x34f45f);})[_0x9d5d('0x2a')](respondWithResult(_0x3e6383,null))[_0x9d5d('0x49')](handleError(_0x3e6383,null));};exports['addQueues']=function(_0xb86f5f,_0x3227d4,_0xbdb32e){return db[_0x9d5d('0x31')][_0x9d5d('0x7b')]({'where':{'id':_0xb86f5f[_0x9d5d('0x57')]['id']}})[_0x9d5d('0x2a')](function(_0xad629f){if(_0xad629f){if(!_0xb86f5f[_0x9d5d('0x56')][_0x9d5d('0x74')]||!utils[_0x9d5d('0x75')](_0xb86f5f['body'][_0x9d5d('0x74')])){throw new db['Sequelize'][(_0x9d5d('0x76'))](_0x9d5d('0x77'));}return _0xad629f[_0x9d5d('0x7c')+_['capitalize'](_0xb86f5f['body']['channel'][_0x9d5d('0x7d')]())+_0x9d5d('0x7a')](_0xb86f5f[_0x9d5d('0x56')][_0x9d5d('0x7e')]);}return null;})[_0x9d5d('0x2a')](handleEntityNotFound(_0x3227d4,null))[_0x9d5d('0x2a')](respondWithStatusCode(_0x3227d4,null))[_0x9d5d('0x49')](handleError(_0x3227d4,null));};exports['removeQueues']=function(_0x49d0eb,_0x219eeb,_0x129a08){return db[_0x9d5d('0x31')][_0x9d5d('0x7b')]({'where':{'id':_0x49d0eb[_0x9d5d('0x57')]['id']}})[_0x9d5d('0x2a')](function(_0x4f228a){if(_0x4f228a){if(!_0x49d0eb[_0x9d5d('0x36')][_0x9d5d('0x74')]||!utils[_0x9d5d('0x75')](_0x49d0eb[_0x9d5d('0x36')]['channel'])){throw new db[(_0x9d5d('0x5b'))]['ValidationError'](_0x9d5d('0x77'));}return _0x4f228a[_0x9d5d('0x7f')+_['capitalize'](_0x49d0eb[_0x9d5d('0x36')][_0x9d5d('0x74')][_0x9d5d('0x7d')]())+_0x9d5d('0x7a')](_0x49d0eb[_0x9d5d('0x36')][_0x9d5d('0x7e')]);}return null;})[_0x9d5d('0x2a')](handleEntityNotFound(_0x219eeb,null))[_0x9d5d('0x2a')](respondWithStatusCode(_0x219eeb,null))[_0x9d5d('0x49')](handleError(_0x219eeb,null));};exports[_0x9d5d('0x80')]=function(_0x4ad26f,_0x2b9eca){var _0x44eb52=_[_0x9d5d('0x81')](_0x4ad26f[_0x9d5d('0x56')][_0x9d5d('0x7e')])?_0x4ad26f['body'][_0x9d5d('0x7e')]:[_0x4ad26f['body'][_0x9d5d('0x7e')]];var _0x1c324e=_0x4ad26f[_0x9d5d('0x57')]['id'];return db[_0x9d5d('0x31')][_0x9d5d('0x4c')]({'where':{'id':_0x1c324e}})[_0x9d5d('0x2a')](handleEntityNotFound(_0x2b9eca,null))[_0x9d5d('0x2a')](function(_0x51288b){if(_0x51288b){var _0x338abd=['Voice',_0x9d5d('0x82'),_0x9d5d('0x83'),'Sms',_0x9d5d('0x84'),'Openchannel',_0x9d5d('0x85')];return db[_0x9d5d('0x59')][_0x9d5d('0x5a')](function(_0x4e4e3d){var _0x44fb63=_[_0x9d5d('0x30')](_0x338abd,function(_0x46ceed){var _0x117fec={'attributes':['id','name']};if(_0x46ceed==='Voice'){_0x117fec['through']={'attributes':[_0x9d5d('0x86')]};}return _0x51288b[_0x9d5d('0x4f')+_0x46ceed+_0x9d5d('0x7a')](_0x117fec)[_0x9d5d('0x2a')](function(_0x58f676){var _0x27c813=_['map'](_0x58f676,function(_0x19e2af){var _0x333af8=_[_0x9d5d('0x30')](_0x44eb52,function(_0x5780e5){var _0x394162={'where':{'UserId':_0x5780e5,[_0x46ceed+'QueueId']:_0x19e2af['id']},'transaction':_0x4e4e3d};if(_0x46ceed===_0x9d5d('0x87')){_0x394162['defaults']={'penalty':_0x19e2af[_0x9d5d('0x88')][_0x9d5d('0x86')]};}return db[_0x9d5d('0x89')+_0x46ceed+_0x9d5d('0x79')]['findOrCreate'](_0x394162)[_0x9d5d('0x2a')](function(){socket[_0x9d5d('0x8a')]('user'+_0x46ceed+_0x9d5d('0x8b'),{'UserId':_0x5780e5,[_0x46ceed+_0x9d5d('0x8c')]:_0x19e2af['id']});if(_0x46ceed!=='Voice'){return;}return db['User'][_0x9d5d('0x47')]({'where':{'id':_0x44eb52,'online':0x1},'attributes':['id',_0x9d5d('0x2d'),'online','voicePause',_0x9d5d('0x8d')],'raw':!![]})[_0x9d5d('0x2a')](function(_0x466f1d){var _0x20194c=_[_0x9d5d('0x30')](_0x466f1d,function(_0x57d38f){return db[_0x9d5d('0x8e')]['upsert']({'membername':_0x57d38f[_0x9d5d('0x2d')],'UserId':_0x57d38f['id'],'queue_name':_0x19e2af[_0x9d5d('0x2d')],'VoiceQueueId':_0x19e2af['id'],'interface':_['isNil'](_0x57d38f[_0x9d5d('0x8d')])?util[_0x9d5d('0x8f')](_0x9d5d('0x90'),_0x57d38f[_0x9d5d('0x2d')]):_0x57d38f['interface'],'paused':_0x57d38f[_0x9d5d('0x91')]||![],'penalty':_0x19e2af['TeamVoiceQueue'][_0x9d5d('0x86')]},{'transaction':_0x4e4e3d});});return Promise[_0x9d5d('0x92')](_0x20194c);});});});return Promise[_0x9d5d('0x92')](_0x333af8);});return Promise[_0x9d5d('0x92')](_0x27c813);})[_0x9d5d('0x2a')](function(){return db[_0x9d5d('0x70')]['findOne']({'where':{'teamId':_0x1c324e}})[_0x9d5d('0x2a')](function(_0x1e746d){if(_0x1e746d){var _0x2f420f=_[_0x9d5d('0x30')](_0x44eb52,function(_0x1cd55c){db['UserVoicePrefix'][_0x9d5d('0x93')]({'UserId':_0x1cd55c,'VoicePrefixId':_0x1e746d['VoicePrefixId']});});return Promise[_0x9d5d('0x92')](_0x2f420f);}});});});return Promise[_0x9d5d('0x92')](_0x44fb63)[_0x9d5d('0x2a')](function(){return _0x51288b[_0x9d5d('0x80')](_0x44eb52,{'transaction':_0x4e4e3d})[_0x9d5d('0x94')](function(_0x42b569){return _0x42b569;});});});}})[_0x9d5d('0x2a')](respondWithResult(_0x2b9eca,null))[_0x9d5d('0x49')](handleError(_0x2b9eca,null));};exports[_0x9d5d('0x95')]=function(_0x241ee6,_0x17ce57){var _0x555d01=_[_0x9d5d('0x81')](_0x241ee6[_0x9d5d('0x36')][_0x9d5d('0x7e')])?_0x241ee6[_0x9d5d('0x36')]['ids']:[_0x241ee6[_0x9d5d('0x36')][_0x9d5d('0x7e')]];var _0x47bb32=_0x241ee6[_0x9d5d('0x57')]['id'];return db[_0x9d5d('0x31')][_0x9d5d('0x4c')]({'where':{'id':_0x47bb32}})[_0x9d5d('0x2a')](handleEntityNotFound(_0x17ce57,null))[_0x9d5d('0x2a')](function(_0x4a1557){if(_0x4a1557){var _0x1a615e=[_0x9d5d('0x87'),'Chat',_0x9d5d('0x83'),_0x9d5d('0x96'),_0x9d5d('0x84'),_0x9d5d('0x97'),'Whatsapp'];return db[_0x9d5d('0x59')][_0x9d5d('0x5a')](function(_0x37dbb8){var _0x5e82d8=_[_0x9d5d('0x30')](_0x1a615e,function(_0x3eb040){var _0x2c8ad4={'attributes':['id',_0x9d5d('0x2d')]};return _0x4a1557[_0x9d5d('0x4f')+_0x3eb040+_0x9d5d('0x7a')](_0x2c8ad4)[_0x9d5d('0x2a')](function(_0x1a8ea1){var _0x39ff33=_[_0x9d5d('0x30')](_0x1a8ea1,function(_0x531a68){return _0x531a68['removeAgents'](_0x555d01,{'transaction':_0x37dbb8})[_0x9d5d('0x2a')](function(){var _0x223ed8=_[_0x9d5d('0x30')](_0x555d01,function(_0x4e68e3){socket[_0x9d5d('0x8a')](_0x9d5d('0x4e')+_0x3eb040+_0x9d5d('0x98'),{'UserId':Number(_0x4e68e3),[_0x3eb040+_0x9d5d('0x8c')]:_0x531a68['id']});if(_0x3eb040!==_0x9d5d('0x87')){return;}return db[_0x9d5d('0x8e')][_0x9d5d('0x58')]({'where':{'VoiceQueueId':_0x531a68['id'],'UserId':_0x4e68e3},'transaction':_0x37dbb8});});return Promise[_0x9d5d('0x92')](_0x223ed8);});});return Promise[_0x9d5d('0x92')](_0x39ff33);});});return Promise[_0x9d5d('0x92')](_0x5e82d8)['then'](function(){return _0x4a1557[_0x9d5d('0x95')](_0x555d01,{'transaction':_0x37dbb8});})[_0x9d5d('0x2a')](function(){return db[_0x9d5d('0x70')][_0x9d5d('0x7b')]({'where':{'teamId':_0x47bb32}})['then'](function(_0x11a138){if(_0x11a138){var _0x4ba90d=_['map'](_0x555d01,function(_0x81c764){db[_0x9d5d('0x71')]['destroy']({'where':{'UserId':_0x81c764,'VoicePrefixId':_0x11a138['VoicePrefixId']}});});return Promise[_0x9d5d('0x92')](_0x4ba90d);}});});});}})[_0x9d5d('0x2a')](respondWithStatusCode(_0x17ce57,null))['catch'](handleError(_0x17ce57,null));};exports[_0x9d5d('0x99')]=function(_0x59b3b0,_0x95b003,_0x894d5b){var _0x20b18d={};var _0x59dfdc={};var _0x5ca58e;var _0x5b6761;return db[_0x9d5d('0x31')]['findOne']({'where':{'id':_0x59b3b0[_0x9d5d('0x57')]['id']}})[_0x9d5d('0x2a')](handleEntityNotFound(_0x95b003,null))[_0x9d5d('0x2a')](function(_0x49c49b){if(_0x49c49b){_0x5ca58e=_0x49c49b;_0x59dfdc[_0x9d5d('0x34')]=_[_0x9d5d('0x35')](db['User'][_0x9d5d('0x32')]);_0x59dfdc[_0x9d5d('0x36')]=_['keys'](_0x59b3b0['query']);_0x59dfdc['filters']=_['intersection'](_0x59dfdc['model'],_0x59dfdc['query']);_0x20b18d[_0x9d5d('0x3a')]=_[_0x9d5d('0x38')](_0x59dfdc[_0x9d5d('0x34')],qs[_0x9d5d('0x39')](_0x59b3b0[_0x9d5d('0x36')]['fields']));_0x20b18d[_0x9d5d('0x3a')]=_0x20b18d['attributes'][_0x9d5d('0x3b')]?_0x20b18d['attributes']:_0x59dfdc['model'];_0x20b18d['order']=qs['sort'](_0x59b3b0[_0x9d5d('0x36')][_0x9d5d('0x3f')]);_0x20b18d[_0x9d5d('0x42')]=qs[_0x9d5d('0x37')](_[_0x9d5d('0x40')](_0x59b3b0[_0x9d5d('0x36')],_0x59dfdc[_0x9d5d('0x37')]));if(_0x59b3b0['query'][_0x9d5d('0x41')]){_0x20b18d[_0x9d5d('0x42')]=_[_0x9d5d('0x43')](_0x20b18d['where'],{'$or':_[_0x9d5d('0x30')](_0x20b18d[_0x9d5d('0x3a')],function(_0x1fcb10){var _0x460e1a={};_0x460e1a[_0x1fcb10]={'$like':'%'+_0x59b3b0[_0x9d5d('0x36')][_0x9d5d('0x41')]+'%'};return _0x460e1a;})});}_0x20b18d=_[_0x9d5d('0x43')]({},_0x20b18d,_0x59b3b0[_0x9d5d('0x45')]);return _0x5ca58e[_0x9d5d('0x99')](_0x20b18d);}})[_0x9d5d('0x2a')](function(_0x399381){if(_0x399381){_0x5b6761=_0x399381[_0x9d5d('0x3b')];if(!_0x59b3b0[_0x9d5d('0x36')][_0x9d5d('0x3c')]('nolimit')){_0x20b18d['limit']=qs[_0x9d5d('0x23')](_0x59b3b0[_0x9d5d('0x36')][_0x9d5d('0x23')]);_0x20b18d['offset']=qs[_0x9d5d('0x21')](_0x59b3b0['query'][_0x9d5d('0x21')]);}return _0x5ca58e[_0x9d5d('0x99')](_0x20b18d);}})[_0x9d5d('0x2a')](function(_0x2c0d6b){if(_0x2c0d6b){return _0x2c0d6b?{'count':_0x5b6761,'rows':_0x2c0d6b}:null;}})[_0x9d5d('0x2a')](respondWithResult(_0x95b003,null))['catch'](handleError(_0x95b003,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9015f28..d3903d6 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 _0x37f7=['emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','update','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x37f7,0x8a));var _0x737f=function(_0x1def78,_0x497e58){_0x1def78=_0x1def78-0x0;var _0x1920a9=_0x37f7[_0x1def78];return _0x1920a9;};'use strict';var EventEmitter=require(_0x737f('0x0'));var Team=require(_0x737f('0x1'))['db'][_0x737f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x737f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x737f('0x4'),'afterDestroy':_0x737f('0x5')};function emitEvent(_0x2d7ce2){return function(_0x3bbc8c,_0x539372,_0x28da16){TeamEvents['emit'](_0x2d7ce2+':'+_0x3bbc8c['id'],_0x3bbc8c);TeamEvents[_0x737f('0x6')](_0x2d7ce2,_0x3bbc8c);_0x28da16(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x737f('0x7')](e,emitEvent(event));}}module[_0x737f('0x8')]=TeamEvents; \ No newline at end of file +var _0x6d89=['exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x280966,_0x414a3a){var _0x5e6379=function(_0x34ef9c){while(--_0x34ef9c){_0x280966['push'](_0x280966['shift']());}};_0x5e6379(++_0x414a3a);}(_0x6d89,0xc9));var _0x96d8=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x6d89[_0x38b14f];return _0x22a324;};'use strict';var EventEmitter=require(_0x96d8('0x0'));var Team=require(_0x96d8('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x96d8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96d8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e7002){return function(_0x2c8cdd,_0x8eac5f,_0x46ce75){TeamEvents['emit'](_0x3e7002+':'+_0x2c8cdd['id'],_0x2c8cdd);TeamEvents[_0x96d8('0x4')](_0x3e7002,_0x2c8cdd);_0x46ce75(null);};}for(var e in events){if(events[_0x96d8('0x5')](e)){var event=events[e];Team[_0x96d8('0x6')](e,emitEvent(event));}}module[_0x96d8('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 600a237..6d0fc03 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 _0xef95=['catch','define','Team','teams','Chat','Fax','Openchannel','Sms','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel'];(function(_0x5d4836,_0x3c901b){var _0x399d83=function(_0x2f72f7){while(--_0x2f72f7){_0x5d4836['push'](_0x5d4836['shift']());}};_0x399d83(++_0x3c901b);}(_0xef95,0x7d));var _0x5ef9=function(_0x2b632b,_0x3f00d9){_0x2b632b=_0x2b632b-0x0;var _0x279514=_0xef95[_0x2b632b];return _0x279514;};'use strict';var _=require(_0x5ef9('0x0'));var attributes=require(_0x5ef9('0x1'));function getQueuesByChannel(_0x3e302b,_0x447468){var _0x452426=_0x5ef9('0x2')+_0x447468+_0x5ef9('0x3');return _0x3e302b[_0x452426]()[_0x5ef9('0x4')](function(_0x40cd83){return _[_0x5ef9('0x5')](_0x40cd83,function(_0x3f0baf){_0x3f0baf[_0x5ef9('0x6')](_0x5ef9('0x7'),_0x447468);return _0x3f0baf;});})[_0x5ef9('0x8')](function(_0x96e139){throw _0x96e139;});}module['exports']=function(_0x1082de){return _0x1082de[_0x5ef9('0x9')](_0x5ef9('0xa'),attributes,{'tableName':_0x5ef9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xcc3324=this;var _0x4357ea=[_0x5ef9('0xc'),_0x5ef9('0xd'),'Mail',_0x5ef9('0xe'),_0x5ef9('0xf'),'Voice',_0x5ef9('0x10')];return Promise[_0x5ef9('0x11')]()[_0x5ef9('0x4')](function(){var _0x380dfb=_[_0x5ef9('0x5')](_0x4357ea,function(_0x170e6f){return getQueuesByChannel(_0xcc3324,_0x170e6f);});return Promise[_0x5ef9('0x12')](_0x380dfb);})[_0x5ef9('0x8')](function(_0x43ed97){throw _0x43ed97;});}}});}; \ No newline at end of file +var _0xa9e7=['catch','exports','define','teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','lodash','get','Queues','then','map','setDataValue','channel'];(function(_0x1ee9c0,_0xe50791){var _0x26f6c8=function(_0x4e141e){while(--_0x4e141e){_0x1ee9c0['push'](_0x1ee9c0['shift']());}};_0x26f6c8(++_0xe50791);}(_0xa9e7,0xf8));var _0x7a9e=function(_0x6522af,_0x200962){_0x6522af=_0x6522af-0x0;var _0x39f7de=_0xa9e7[_0x6522af];return _0x39f7de;};'use strict';var _=require(_0x7a9e('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x7390f1,_0x3cd967){var _0x28474c=_0x7a9e('0x1')+_0x3cd967+_0x7a9e('0x2');return _0x7390f1[_0x28474c]()[_0x7a9e('0x3')](function(_0x465877){return _[_0x7a9e('0x4')](_0x465877,function(_0x37c9bc){_0x37c9bc[_0x7a9e('0x5')](_0x7a9e('0x6'),_0x3cd967);return _0x37c9bc;});})[_0x7a9e('0x7')](function(_0x438404){throw _0x438404;});}module[_0x7a9e('0x8')]=function(_0x3bf4e4){return _0x3bf4e4[_0x7a9e('0x9')]('Team',attributes,{'tableName':_0x7a9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2efc73=this;var _0x41da18=['Chat',_0x7a9e('0xb'),_0x7a9e('0xc'),_0x7a9e('0xd'),_0x7a9e('0xe'),_0x7a9e('0xf'),_0x7a9e('0x10')];return Promise['resolve']()[_0x7a9e('0x3')](function(){var _0x3a383e=_[_0x7a9e('0x4')](_0x41da18,function(_0x1eb99e){return getQueuesByChannel(_0x2efc73,_0x1eb99e);});return Promise['all'](_0x3a383e);})[_0x7a9e('0x7')](function(_0x1ad927){throw _0x1ad927;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 484cea0..6837795 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 _0x6e03=['jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','then','info','debug','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x22f710,_0x4e259f){var _0x48ae6e=function(_0x272e59){while(--_0x272e59){_0x22f710['push'](_0x22f710['shift']());}};_0x48ae6e(++_0x4e259f);}(_0x6e03,0x17d));var _0x36e0=function(_0x2f2099,_0x1fdc86){_0x2f2099=_0x2f2099-0x0;var _0x3ab14f=_0x6e03[_0x2f2099];return _0x3ab14f;};'use strict';var _=require(_0x36e0('0x0'));var util=require(_0x36e0('0x1'));var moment=require(_0x36e0('0x2'));var BPromise=require(_0x36e0('0x3'));var rs=require(_0x36e0('0x4'));var fs=require('fs');var Redis=require(_0x36e0('0x5'));var db=require(_0x36e0('0x6'))['db'];var utils=require(_0x36e0('0x7'));var logger=require(_0x36e0('0x8'))(_0x36e0('0x9'));var config=require(_0x36e0('0xa'));var jayson=require(_0x36e0('0xb'));var client=jayson[_0x36e0('0xc')][_0x36e0('0xd')]({'port':0x232a});config[_0x36e0('0xe')]=_[_0x36e0('0xf')](config[_0x36e0('0xe')],{'host':_0x36e0('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x36e0('0x11'))[_0x36e0('0x12')](socket);function respondWithRpcPromise(_0x24e683,_0x2b444b,_0x13e4b0){return new BPromise(function(_0x3d05ca,_0x4a1602){return client['request'](_0x24e683,_0x13e4b0)[_0x36e0('0x13')](function(_0x5c85bd){logger[_0x36e0('0x14')]('Team,\x20%s,\x20%s',_0x2b444b,'request\x20sent');logger[_0x36e0('0x15')](_0x36e0('0x16'),_0x2b444b,'request\x20sent',JSON['stringify'](_0x5c85bd));if(_0x5c85bd[_0x36e0('0x17')]){if(_0x5c85bd[_0x36e0('0x17')][_0x36e0('0x18')]===0x1f4){logger['error'](_0x36e0('0x19'),_0x2b444b,_0x5c85bd[_0x36e0('0x17')][_0x36e0('0x1a')]);return _0x4a1602(_0x5c85bd[_0x36e0('0x17')]['message']);}logger[_0x36e0('0x17')](_0x36e0('0x19'),_0x2b444b,_0x5c85bd[_0x36e0('0x17')][_0x36e0('0x1a')]);return _0x3d05ca(_0x5c85bd[_0x36e0('0x17')][_0x36e0('0x1a')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x2b444b,'request\x20sent');_0x3d05ca(_0x5c85bd[_0x36e0('0x1b')][_0x36e0('0x1a')]);}})['catch'](function(_0x154530){logger['error'](_0x36e0('0x19'),_0x2b444b,_0x154530);_0x4a1602(_0x154530);});});} \ No newline at end of file +var _0x9dc5=['socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x9dc5,0x14f));var _0x59dc=function(_0x37d324,_0x169f11){_0x37d324=_0x37d324-0x0;var _0x36bc13=_0x9dc5[_0x37d324];return _0x36bc13;};'use strict';var _=require(_0x59dc('0x0'));var util=require(_0x59dc('0x1'));var moment=require(_0x59dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x59dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59dc('0x4'))['db'];var utils=require(_0x59dc('0x5'));var logger=require(_0x59dc('0x6'))(_0x59dc('0x7'));var config=require(_0x59dc('0x8'));var jayson=require(_0x59dc('0x9'));var client=jayson[_0x59dc('0xa')][_0x59dc('0xb')]({'port':0x232a});config[_0x59dc('0xc')]=_[_0x59dc('0xd')](config[_0x59dc('0xc')],{'host':_0x59dc('0xe'),'port':0x18eb});var socket=require(_0x59dc('0xf'))(new Redis(config[_0x59dc('0xc')]));require(_0x59dc('0x10'))[_0x59dc('0x11')](socket);function respondWithRpcPromise(_0x160c10,_0x32589f,_0x3f9d32){return new BPromise(function(_0x219773,_0x4c75bd){return client['request'](_0x160c10,_0x3f9d32)['then'](function(_0x584f22){logger['info'](_0x59dc('0x12'),_0x32589f,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x32589f,_0x59dc('0x13'),JSON[_0x59dc('0x14')](_0x584f22));if(_0x584f22[_0x59dc('0x15')]){if(_0x584f22[_0x59dc('0x15')]['code']===0x1f4){logger[_0x59dc('0x15')](_0x59dc('0x12'),_0x32589f,_0x584f22[_0x59dc('0x15')][_0x59dc('0x16')]);return _0x4c75bd(_0x584f22['error'][_0x59dc('0x16')]);}logger[_0x59dc('0x15')](_0x59dc('0x12'),_0x32589f,_0x584f22[_0x59dc('0x15')][_0x59dc('0x16')]);return _0x219773(_0x584f22[_0x59dc('0x15')][_0x59dc('0x16')]);}else{logger['info'](_0x59dc('0x12'),_0x32589f,_0x59dc('0x13'));_0x219773(_0x584f22[_0x59dc('0x17')]['message']);}})[_0x59dc('0x18')](function(_0x3bb157){logger[_0x59dc('0x15')](_0x59dc('0x12'),_0x32589f,_0x3bb157);_0x4c75bd(_0x3bb157);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4a63618..654411d 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 _0xecd8=['length','team:','./team.events','remove','update','emit'];(function(_0x9e4113,_0xb574aa){var _0xb04c0d=function(_0x226d0f){while(--_0x226d0f){_0x9e4113['push'](_0x9e4113['shift']());}};_0xb04c0d(++_0xb574aa);}(_0xecd8,0x6e));var _0x8ecd=function(_0x40b8e8,_0x25f66a){_0x40b8e8=_0x40b8e8-0x0;var _0x56ec54=_0xecd8[_0x40b8e8];return _0x56ec54;};'use strict';var TeamEvents=require(_0x8ecd('0x0'));var events=['save',_0x8ecd('0x1'),_0x8ecd('0x2')];function createListener(_0x2a051e,_0x3ad184){return function(_0x451a33){_0x3ad184[_0x8ecd('0x3')](_0x2a051e,_0x451a33);};}function removeListener(_0x530906,_0x4ee7e4){return function(){TeamEvents['removeListener'](_0x530906,_0x4ee7e4);};}exports['register']=function(_0x2f993e){for(var _0x4a866e=0x0,_0x23cb9b=events[_0x8ecd('0x4')];_0x4a866e<_0x23cb9b;_0x4a866e++){var _0x5bf5cc=events[_0x4a866e];var _0x2c7e69=createListener(_0x8ecd('0x5')+_0x5bf5cc,_0x2f993e);TeamEvents['on'](_0x5bf5cc,_0x2c7e69);}}; \ No newline at end of file +var _0x054f=['register','team:','./team.events','save','remove','update','emit'];(function(_0x311fc0,_0x2c64f0){var _0xce2976=function(_0xb33ed4){while(--_0xb33ed4){_0x311fc0['push'](_0x311fc0['shift']());}};_0xce2976(++_0x2c64f0);}(_0x054f,0x1a6));var _0xf054=function(_0x5c0e40,_0x2ba1e9){_0x5c0e40=_0x5c0e40-0x0;var _0x584166=_0x054f[_0x5c0e40];return _0x584166;};'use strict';var TeamEvents=require(_0xf054('0x0'));var events=[_0xf054('0x1'),_0xf054('0x2'),_0xf054('0x3')];function createListener(_0x7a5b,_0x214577){return function(_0x5789ce){_0x214577[_0xf054('0x4')](_0x7a5b,_0x5789ce);};}function removeListener(_0x3c7f5a,_0x4b5c02){return function(){TeamEvents['removeListener'](_0x3c7f5a,_0x4b5c02);};}exports[_0xf054('0x5')]=function(_0x484f8b){for(var _0x4260f7=0x0,_0x113205=events['length'];_0x4260f7<_0x113205;_0x4260f7++){var _0x2e8bb8=events[_0x4260f7];var _0x155c76=createListener(_0xf054('0x6')+_0x2e8bb8,_0x484f8b);TeamEvents['on'](_0x2e8bb8,_0x155c76);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3ac2451..a4da8ee 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 _0x2746=['INTEGER'];(function(_0x1ed7b0,_0x5a7052){var _0x2884d9=function(_0x13ce0c){while(--_0x13ce0c){_0x1ed7b0['push'](_0x1ed7b0['shift']());}};_0x2884d9(++_0x5a7052);}(_0x2746,0x19c));var _0x6274=function(_0xa31066,_0x4a7183){_0xa31066=_0xa31066-0x0;var _0x209027=_0x2746[_0xa31066];return _0x209027;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x6274('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x6274('0x0')]}}; \ No newline at end of file +var _0x2e3d=['sequelize','INTEGER'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x58bbcb,_0x3e7c8c){_0x58bbcb=_0x58bbcb-0x0;var _0x5e4ce3=_0x2e3d[_0x58bbcb];return _0x5e4ce3;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd2e3('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 41cd501..f28b0fe 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 _0xc4e1=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','TeamVoicePrefix'];(function(_0x47c9c1,_0x55d496){var _0x148515=function(_0x738b6d){while(--_0x738b6d){_0x47c9c1['push'](_0x47c9c1['shift']());}};_0x148515(++_0x55d496);}(_0xc4e1,0x172));var _0x1c4e=function(_0x556b0f,_0x5e473f){_0x556b0f=_0x556b0f-0x0;var _0x19fd49=_0xc4e1[_0x556b0f];return _0x19fd49;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var logger=require(_0x1c4e('0x2'))(_0x1c4e('0x3'));var moment=require('moment');var BPromise=require(_0x1c4e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c4e('0x5'));var rimraf=require('rimraf');var config=require(_0x1c4e('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x1c4e('0x7')]=function(_0x350c79,_0x47f7f1){return _0x350c79[_0x1c4e('0x8')](_0x1c4e('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd6f=['rimraf','../../config/environment','exports','define','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1f88e8,_0x524e46){var _0x1e9a2e=function(_0xeef88f){while(--_0xeef88f){_0x1f88e8['push'](_0x1f88e8['shift']());}};_0x1e9a2e(++_0x524e46);}(_0xfd6f,0x19d));var _0xffd6=function(_0xfa07f8,_0x3cf704){_0xfa07f8=_0xfa07f8-0x0;var _0x339e09=_0xfd6f[_0xfa07f8];return _0x339e09;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var logger=require(_0xffd6('0x2'))(_0xffd6('0x3'));var moment=require(_0xffd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xffd6('0x5'));var fs=require('fs');var path=require(_0xffd6('0x6'));var rimraf=require(_0xffd6('0x7'));var config=require(_0xffd6('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xffd6('0x9')]=function(_0x380073,_0x3f3cd8){return _0x380073[_0xffd6('0xa')]('TeamVoicePrefix',attributes,{'tableName':_0xffd6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 68ffecd..0bd8ae9 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x38cd76,_0x5e28ea){var _0x473599=function(_0x5309c5){while(--_0x5309c5){_0x38cd76['push'](_0x38cd76['shift']());}};_0x473599(++_0x5e28ea);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1732c2,_0x2f7943){var _0xb497cc=function(_0x11b36f){while(--_0x11b36f){_0x1732c2['push'](_0x1732c2['shift']());}};_0xb497cc(++_0x2f7943);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xcb91[_0x31abee];return _0x3c1761;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8b033dc..608dfc3 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 _0xab13=['sequelize','exports','INTEGER'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0xab13,0x66));var _0x3ab1=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xab13[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0x3ab1('0x0'));module[_0x3ab1('0x1')]={'penalty':{'type':Sequelize[_0x3ab1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd328=['exports','INTEGER'];(function(_0xd02ce3,_0x11b95){var _0x705722=function(_0x4ae5ee){while(--_0x4ae5ee){_0xd02ce3['push'](_0xd02ce3['shift']());}};_0x705722(++_0x11b95);}(_0xd328,0x162));var _0x8d32=function(_0x4cac81,_0x5af4b4){_0x4cac81=_0x4cac81-0x0;var _0x17e986=_0xd328[_0x4cac81];return _0x17e986;};'use strict';var Sequelize=require('sequelize');module[_0x8d32('0x0')]={'penalty':{'type':Sequelize[_0x8d32('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 5664556..80f6526 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 _0xb8ca=['../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x45d32d,_0x4d39f1){var _0x3dc7e1=function(_0x29de6a){while(--_0x29de6a){_0x45d32d['push'](_0x45d32d['shift']());}};_0x3dc7e1(++_0x4d39f1);}(_0xb8ca,0x89));var _0xab8c=function(_0x41fffd,_0x87452){_0x41fffd=_0x41fffd-0x0;var _0x57c65a=_0xb8ca[_0x41fffd];return _0x57c65a;};'use strict';var _=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var logger=require(_0xab8c('0x2'))('api');var moment=require(_0xab8c('0x3'));var BPromise=require(_0xab8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab8c('0x5'));var config=require(_0xab8c('0x6'));var attributes=require(_0xab8c('0x7'));module[_0xab8c('0x8')]=function(_0x31cc24,_0x340159){return _0x31cc24[_0xab8c('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xab8c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e8=['request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','api','bluebird'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0x92e8,0x7f));var _0x892e=function(_0x5d4ca7,_0x19113b){_0x5d4ca7=_0x5d4ca7-0x0;var _0x3efc03=_0x92e8[_0x5d4ca7];return _0x3efc03;};'use strict';var _=require(_0x892e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x892e('0x1'));var moment=require('moment');var BPromise=require(_0x892e('0x2'));var rp=require(_0x892e('0x3'));var fs=require('fs');var path=require(_0x892e('0x4'));var rimraf=require(_0x892e('0x5'));var config=require(_0x892e('0x6'));var attributes=require(_0x892e('0x7'));module['exports']=function(_0x3b557d,_0x47adfa){return _0x3b557d[_0x892e('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x892e('0x9'),'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 de3a0ae..1a92feb 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 _0xab3a=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x564f78,_0x3f6f8a){var _0x214ccd=function(_0x7022bd){while(--_0x7022bd){_0x564f78['push'](_0x564f78['shift']());}};_0x214ccd(++_0x3f6f8a);}(_0xab3a,0x1d3));var _0xaab3=function(_0x3285d4,_0x136036){_0x3285d4=_0x3285d4-0x0;var _0x5408c9=_0xab3a[_0x3285d4];return _0x5408c9;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5760e8,_0x501657,_0x1fd19f){return new BPromise(function(_0x146453,_0x21527a){return client[_0xaab3('0xd')](_0x5760e8,_0x1fd19f)[_0xaab3('0xe')](function(_0x15841e){logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));logger[_0xaab3('0x12')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x501657,'request\x20sent',JSON[_0xaab3('0x13')](_0x15841e));if(_0x15841e[_0xaab3('0x14')]){if(_0x15841e[_0xaab3('0x14')][_0xaab3('0x15')]===0x1f4){logger['error'](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x21527a(_0x15841e['error'][_0xaab3('0x16')]);}logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x15841e['error'][_0xaab3('0x16')]);return _0x146453(_0x15841e[_0xaab3('0x14')]['message']);}else{logger[_0xaab3('0xf')](_0xaab3('0x10'),_0x501657,_0xaab3('0x11'));_0x146453(_0x15841e['result']['message']);}})['catch'](function(_0x484dc5){logger[_0xaab3('0x14')](_0xaab3('0x10'),_0x501657,_0x484dc5);_0x21527a(_0x484dc5);});});} \ No newline at end of file +var _0x2d81=['code','error','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e4595,_0x5f36e1){var _0x4a11de=function(_0x24d00d){while(--_0x24d00d){_0x5e4595['push'](_0x5e4595['shift']());}};_0x4a11de(++_0x5f36e1);}(_0x2d81,0xeb));var _0x12d8=function(_0x5259bd,_0x34c23a){_0x5259bd=_0x5259bd-0x0;var _0x5c3d12=_0x2d81[_0x5259bd];return _0x5c3d12;};'use strict';var _=require(_0x12d8('0x0'));var util=require(_0x12d8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x12d8('0x2'));var fs=require('fs');var Redis=require(_0x12d8('0x3'));var db=require(_0x12d8('0x4'))['db'];var utils=require(_0x12d8('0x5'));var logger=require(_0x12d8('0x6'))(_0x12d8('0x7'));var config=require(_0x12d8('0x8'));var jayson=require(_0x12d8('0x9'));var client=jayson[_0x12d8('0xa')][_0x12d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aec37,_0x60031,_0x5142a2){return new BPromise(function(_0x340c56,_0x3a5642){return client[_0x12d8('0xc')](_0x3aec37,_0x5142a2)[_0x12d8('0xd')](function(_0x4fdc27){logger[_0x12d8('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x60031,_0x12d8('0xf'));logger['debug'](_0x12d8('0x10'),_0x60031,_0x12d8('0xf'),JSON[_0x12d8('0x11')](_0x4fdc27));if(_0x4fdc27['error']){if(_0x4fdc27['error'][_0x12d8('0x12')]===0x1f4){logger[_0x12d8('0x13')](_0x12d8('0x14'),_0x60031,_0x4fdc27[_0x12d8('0x13')][_0x12d8('0x15')]);return _0x3a5642(_0x4fdc27[_0x12d8('0x13')][_0x12d8('0x15')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x60031,_0x4fdc27[_0x12d8('0x13')][_0x12d8('0x15')]);return _0x340c56(_0x4fdc27[_0x12d8('0x13')]['message']);}else{logger['info'](_0x12d8('0x14'),_0x60031,_0x12d8('0xf'));_0x340c56(_0x4fdc27['result']['message']);}})[_0x12d8('0x16')](function(_0x5071e4){logger[_0x12d8('0x13')](_0x12d8('0x14'),_0x60031,_0x5071e4);_0x3a5642(_0x5071e4);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 59dc2e5..c0270f1 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 _0x94e6=['Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','index','get','/:id','post','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x22e694,_0x2e17de){var _0x4324b0=function(_0x10bebd){while(--_0x10bebd){_0x22e694['push'](_0x22e694['shift']());}};_0x4324b0(++_0x2e17de);}(_0x94e6,0x194));var _0x694e=function(_0x399771,_0xcb84d1){_0x399771=_0x399771-0x0;var _0x47c7c4=_0x94e6[_0x399771];return _0x47c7c4;};'use strict';var multer=require(_0x694e('0x0'));var util=require('util');var path=require(_0x694e('0x1'));var timeout=require(_0x694e('0x2'));var express=require(_0x694e('0x3'));var router=express[_0x694e('0x4')]();var fs_extra=require(_0x694e('0x5'));var auth=require(_0x694e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x694e('0x7'));var controller=require(_0x694e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x694e('0x9')]);router[_0x694e('0xa')](_0x694e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x694e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x694e('0xb'),auth[_0x694e('0xd')](),controller[_0x694e('0xe')]);router[_0x694e('0xf')]('/:id',auth[_0x694e('0xd')](),controller[_0x694e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa1cc=['util','path','express','Router','fs-extra','../../components/interaction/service','./template.controller','get','isAuthenticated','index','show','post','/:id','update','delete','destroy','multer'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0xa1cc,0x10f));var _0xca1c=function(_0x4d6a1f,_0x1001a3){_0x4d6a1f=_0x4d6a1f-0x0;var _0x78ad90=_0xa1cc[_0x4d6a1f];return _0x78ad90;};'use strict';var multer=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var path=require(_0xca1c('0x2'));var timeout=require('connect-timeout');var express=require(_0xca1c('0x3'));var router=express[_0xca1c('0x4')]();var fs_extra=require(_0xca1c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca1c('0x6'));var config=require('../../config/environment');var controller=require(_0xca1c('0x7'));router[_0xca1c('0x8')]('/',auth[_0xca1c('0x9')](),controller[_0xca1c('0xa')]);router['get']('/:id',auth[_0xca1c('0x9')](),controller[_0xca1c('0xb')]);router[_0xca1c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xca1c('0xd'),auth['isAuthenticated'](),controller[_0xca1c('0xe')]);router[_0xca1c('0xf')](_0xca1c('0xd'),auth[_0xca1c('0x9')](),controller[_0xca1c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b3bf9e2..0d97fa5 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 _0x882e=['exports','STRING','TEXT'];(function(_0x3bb08b,_0x23def3){var _0x58c3e3=function(_0x1096e0){while(--_0x1096e0){_0x3bb08b['push'](_0x3bb08b['shift']());}};_0x58c3e3(++_0x23def3);}(_0x882e,0x138));var _0xe882=function(_0x4dd608,_0x53e71b){_0x4dd608=_0x4dd608-0x0;var _0x152df8=_0x882e[_0x4dd608];return _0x152df8;};'use strict';var Sequelize=require('sequelize');module[_0xe882('0x0')]={'name':{'type':Sequelize[_0xe882('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xe882('0x2')]}}; \ No newline at end of file +var _0x93db=['exports','STRING'];(function(_0x243417,_0x2949fb){var _0x10fb4a=function(_0x71f371){while(--_0x71f371){_0x243417['push'](_0x243417['shift']());}};_0x10fb4a(++_0x2949fb);}(_0x93db,0x180));var _0xb93d=function(_0xcc519a,_0x1fce0c){_0xcc519a=_0xcc519a-0x0;var _0x2f7202=_0x93db[_0xcc519a];return _0x2f7202;};'use strict';var Sequelize=require('sequelize');module[_0xb93d('0x0')]={'name':{'type':Sequelize[_0xb93d('0x1')]},'description':{'type':Sequelize[_0xb93d('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 5df0fa3..2f76179 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 _0x6037=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','stack','name','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xb7d46f,_0x57d9fd){var _0xdec304=function(_0x5d7650){while(--_0x5d7650){_0xb7d46f['push'](_0xb7d46f['shift']());}};_0xdec304(++_0x57d9fd);}(_0x6037,0x1f1));var _0x7603=function(_0x106bd6,_0x690f74){_0x106bd6=_0x106bd6-0x0;var _0x24c479=_0x6037[_0x106bd6];return _0x24c479;};'use strict';var emlformat=require(_0x7603('0x0'));var rimraf=require(_0x7603('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7603('0x2'));var rp=require('request-promise');var moment=require(_0x7603('0x3'));var BPromise=require(_0x7603('0x4'));var Mustache=require(_0x7603('0x5'));var util=require('util');var path=require(_0x7603('0x6'));var sox=require(_0x7603('0x7'));var csv=require(_0x7603('0x8'));var ejs=require(_0x7603('0x9'));var fs=require('fs');var fs_extra=require(_0x7603('0xa'));var _=require(_0x7603('0xb'));var squel=require(_0x7603('0xc'));var crypto=require(_0x7603('0xd'));var jsforce=require(_0x7603('0xe'));var deskjs=require(_0x7603('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7603('0x10'));var Papa=require(_0x7603('0x11'));var Redis=require(_0x7603('0x12'));var authService=require(_0x7603('0x13'));var qs=require(_0x7603('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7603('0x15'));var logger=require('../../config/logger')(_0x7603('0x16'));var utils=require('../../config/utils');var config=require(_0x7603('0x17'));var licenseUtil=require(_0x7603('0x18'));var db=require(_0x7603('0x19'))['db'];function respondWithStatusCode(_0x14b940,_0x5b9077){_0x5b9077=_0x5b9077||0xcc;return function(_0x214438){if(_0x214438){return _0x14b940[_0x7603('0x1a')](_0x5b9077);}return _0x14b940[_0x7603('0x1b')](_0x5b9077)['end']();};}function respondWithResult(_0x57d900,_0x5ddd6b){_0x5ddd6b=_0x5ddd6b||0xc8;return function(_0xfb8ec1){if(_0xfb8ec1){return _0x57d900[_0x7603('0x1b')](_0x5ddd6b)[_0x7603('0x1c')](_0xfb8ec1);}};}function respondWithFilteredResult(_0x3e17d2,_0x2b1942){return function(_0x3bd340){if(_0x3bd340){var _0x35a976=typeof _0x2b1942[_0x7603('0x1d')]===_0x7603('0x1e')&&typeof _0x2b1942[_0x7603('0x1f')]===_0x7603('0x1e');var _0x4622ec=_0x3bd340['count'];var _0x4ef130=_0x35a976?0x0:_0x2b1942[_0x7603('0x1d')];var _0x401ba1=_0x35a976?_0x3bd340[_0x7603('0x20')]:_0x2b1942[_0x7603('0x1d')]+_0x2b1942[_0x7603('0x1f')];var _0x10cf4f;if(_0x401ba1>=_0x4622ec){_0x401ba1=_0x4622ec;_0x10cf4f=0xc8;}else{_0x10cf4f=0xce;}_0x3e17d2[_0x7603('0x1b')](_0x10cf4f);return _0x3e17d2[_0x7603('0x21')](_0x7603('0x22'),_0x4ef130+'-'+_0x401ba1+'/'+_0x4622ec)[_0x7603('0x1c')](_0x3bd340);}return null;};}function patchUpdates(_0x4435b1){return function(_0x1bd63e){try{jsonpatch[_0x7603('0x23')](_0x1bd63e,_0x4435b1,!![]);}catch(_0x44b5b3){return BPromise[_0x7603('0x24')](_0x44b5b3);}return _0x1bd63e[_0x7603('0x25')]();};}function saveUpdates(_0x3f153e,_0xaeaeb8){return function(_0x36f44d){if(_0x36f44d){return _0x36f44d[_0x7603('0x26')](_0x3f153e)[_0x7603('0x27')](function(_0x8ba16e){return _0x8ba16e;});}return null;};}function removeEntity(_0x2d3943,_0x1a1ac1){return function(_0x54e3d3){if(_0x54e3d3){return _0x54e3d3[_0x7603('0x28')]()[_0x7603('0x27')](function(){var _0x5c8e19=_0x54e3d3[_0x7603('0x29')]({'plain':!![]});var _0x53f8f5=_0x7603('0x2a');return db[_0x7603('0x2b')][_0x7603('0x28')]({'where':{'type':_0x53f8f5,'resourceId':_0x5c8e19['id']}})['then'](function(){return _0x54e3d3;});})[_0x7603('0x27')](function(){_0x2d3943[_0x7603('0x1b')](0xcc)[_0x7603('0x2c')]();});}};}function handleEntityNotFound(_0x346f21,_0x564754){return function(_0x249f9f){if(!_0x249f9f){_0x346f21[_0x7603('0x1a')](0x194);}return _0x249f9f;};}function handleError(_0xba8015,_0x57357c){_0x57357c=_0x57357c||0x1f4;return function(_0x52d230){logger['error'](_0x52d230[_0x7603('0x2d')]);if(_0x52d230[_0x7603('0x2e')]){delete _0x52d230[_0x7603('0x2e')];}_0xba8015[_0x7603('0x1b')](_0x57357c)['send'](_0x52d230);};}exports['index']=function(_0x113720,_0x39557f){var _0x29c3c0={},_0x2501e6={},_0x5a8e3c={'count':0x0,'rows':[]};var _0x455e93=_[_0x7603('0x2f')](db[_0x7603('0x30')][_0x7603('0x31')],function(_0x882429){return{'name':_0x882429[_0x7603('0x32')],'type':_0x882429[_0x7603('0x33')][_0x7603('0x34')]};});_0x2501e6['model']=_[_0x7603('0x2f')](_0x455e93,_0x7603('0x2e'));_0x2501e6[_0x7603('0x35')]=_[_0x7603('0x36')](_0x113720[_0x7603('0x35')]);_0x2501e6[_0x7603('0x37')]=_[_0x7603('0x38')](_0x2501e6['model'],_0x2501e6[_0x7603('0x35')]);_0x29c3c0[_0x7603('0x39')]=_['intersection'](_0x2501e6[_0x7603('0x3a')],qs['fields'](_0x113720[_0x7603('0x35')]['fields']));_0x29c3c0[_0x7603('0x39')]=_0x29c3c0[_0x7603('0x39')][_0x7603('0x3b')]?_0x29c3c0[_0x7603('0x39')]:_0x2501e6[_0x7603('0x3a')];if(!_0x113720[_0x7603('0x35')]['hasOwnProperty'](_0x7603('0x3c'))){_0x29c3c0[_0x7603('0x1f')]=qs[_0x7603('0x1f')](_0x113720[_0x7603('0x35')][_0x7603('0x1f')]);_0x29c3c0[_0x7603('0x1d')]=qs['offset'](_0x113720[_0x7603('0x35')][_0x7603('0x1d')]);}_0x29c3c0[_0x7603('0x3d')]=qs[_0x7603('0x3e')](_0x113720['query'][_0x7603('0x3e')]);_0x29c3c0[_0x7603('0x3f')]=qs['filters'](_[_0x7603('0x40')](_0x113720['query'],_0x2501e6[_0x7603('0x37')]),_0x455e93);if(_0x113720[_0x7603('0x35')][_0x7603('0x41')]){_0x29c3c0[_0x7603('0x3f')]=_[_0x7603('0x42')](_0x29c3c0[_0x7603('0x3f')],{'$or':_['map'](_0x455e93,function(_0x53cd8a){if(_0x53cd8a[_0x7603('0x33')]!==_0x7603('0x43')){var _0x24146a={};_0x24146a[_0x53cd8a[_0x7603('0x2e')]]={'$like':'%'+_0x113720[_0x7603('0x35')][_0x7603('0x41')]+'%'};return _0x24146a;}})});}_0x29c3c0=_['merge']({},_0x29c3c0,_0x113720[_0x7603('0x44')]);var _0x3a3604={'where':_0x29c3c0[_0x7603('0x3f')]};return db[_0x7603('0x30')]['count'](_0x3a3604)[_0x7603('0x27')](function(_0x58b02a){_0x5a8e3c[_0x7603('0x20')]=_0x58b02a;if(_0x113720[_0x7603('0x35')][_0x7603('0x45')]){_0x29c3c0[_0x7603('0x46')]=[{'all':!![]}];}return db['Template'][_0x7603('0x47')](_0x29c3c0);})[_0x7603('0x27')](function(_0x5cadeb){_0x5a8e3c['rows']=_0x5cadeb;return _0x5a8e3c;})[_0x7603('0x27')](respondWithFilteredResult(_0x39557f,_0x29c3c0))[_0x7603('0x48')](handleError(_0x39557f,null));};exports[_0x7603('0x49')]=function(_0x22af11,_0x2bd8e4){var _0x2e73ce={'raw':!![],'where':{'id':_0x22af11[_0x7603('0x4a')]['id']}},_0x30bb8f={};_0x30bb8f[_0x7603('0x3a')]=_['keys'](db[_0x7603('0x30')][_0x7603('0x31')]);_0x30bb8f[_0x7603('0x35')]=_[_0x7603('0x36')](_0x22af11['query']);_0x30bb8f[_0x7603('0x37')]=_[_0x7603('0x38')](_0x30bb8f[_0x7603('0x3a')],_0x30bb8f['query']);_0x2e73ce['attributes']=_[_0x7603('0x38')](_0x30bb8f[_0x7603('0x3a')],qs['fields'](_0x22af11[_0x7603('0x35')][_0x7603('0x4b')]));_0x2e73ce[_0x7603('0x39')]=_0x2e73ce[_0x7603('0x39')][_0x7603('0x3b')]?_0x2e73ce[_0x7603('0x39')]:_0x30bb8f[_0x7603('0x3a')];if(_0x22af11[_0x7603('0x35')][_0x7603('0x45')]){_0x2e73ce[_0x7603('0x46')]=[{'all':!![]}];}_0x2e73ce=_[_0x7603('0x42')]({},_0x2e73ce,_0x22af11['options']);return db[_0x7603('0x30')]['find'](_0x2e73ce)[_0x7603('0x27')](handleEntityNotFound(_0x2bd8e4,null))[_0x7603('0x27')](respondWithResult(_0x2bd8e4,null))[_0x7603('0x48')](handleError(_0x2bd8e4,null));};exports[_0x7603('0x4c')]=function(_0xa7a4b5,_0x1415f8){return db[_0x7603('0x30')][_0x7603('0x4c')](_0xa7a4b5[_0x7603('0x4d')],{})[_0x7603('0x27')](function(_0x1a2f3a){var _0xd3a462=_0xa7a4b5[_0x7603('0x4e')][_0x7603('0x29')]({'plain':!![]});if(!_0xd3a462)throw new Error(_0x7603('0x4f'));if(_0xd3a462[_0x7603('0x50')]===_0x7603('0x4e')){var _0x116f6d=_0x1a2f3a[_0x7603('0x29')]({'plain':!![]});var _0x464165=_0x7603('0x2a');return db[_0x7603('0x51')]['find']({'where':{'name':_0x464165,'userProfileId':_0xd3a462['userProfileId']},'raw':!![]})[_0x7603('0x27')](function(_0x33f09d){if(_0x33f09d&&_0x33f09d[_0x7603('0x52')]===0x0){return db[_0x7603('0x2b')][_0x7603('0x4c')]({'name':_0x116f6d['name'],'resourceId':_0x116f6d['id'],'type':_0x33f09d[_0x7603('0x2e')],'sectionId':_0x33f09d['id']},{})[_0x7603('0x27')](function(){return _0x1a2f3a;});}else{return _0x1a2f3a;}})[_0x7603('0x48')](function(_0x4920df){logger[_0x7603('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4920df);throw _0x4920df;});}return _0x1a2f3a;})['then'](respondWithResult(_0x1415f8,0xc9))['catch'](handleError(_0x1415f8,null));};exports['update']=function(_0x2b55c4,_0x27cc1f){if(_0x2b55c4[_0x7603('0x4d')]['id']){delete _0x2b55c4[_0x7603('0x4d')]['id'];}return db[_0x7603('0x30')][_0x7603('0x54')]({'where':{'id':_0x2b55c4[_0x7603('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27cc1f,null))['then'](saveUpdates(_0x2b55c4[_0x7603('0x4d')],null))[_0x7603('0x27')](respondWithResult(_0x27cc1f,null))[_0x7603('0x48')](handleError(_0x27cc1f,null));};exports[_0x7603('0x28')]=function(_0x4e6879,_0x11a0c4){return db[_0x7603('0x30')][_0x7603('0x54')]({'where':{'id':_0x4e6879[_0x7603('0x4a')]['id']}})[_0x7603('0x27')](handleEntityNotFound(_0x11a0c4,null))['then'](removeEntity(_0x11a0c4,null))[_0x7603('0x48')](handleError(_0x11a0c4,null));}; \ No newline at end of file +var _0xecde=['pick','filter','merge','where','VIRTUAL','include','Template','findAll','rows','catch','show','params','includeAll','options','find','create','user','role','Templates','userProfileId','body','eml-format','rimraf','zip-dir','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','api','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2bb757,_0x1056b3){var _0x39234c=function(_0x32492d){while(--_0x32492d){_0x2bb757['push'](_0x2bb757['shift']());}};_0x39234c(++_0x1056b3);}(_0xecde,0x15d));var _0xeecd=function(_0x12ae78,_0x241615){_0x12ae78=_0x12ae78-0x0;var _0x3fc644=_0xecde[_0x12ae78];return _0x3fc644;};'use strict';var emlformat=require(_0xeecd('0x0'));var rimraf=require(_0xeecd('0x1'));var zipdir=require(_0xeecd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeecd('0x3'));var moment=require(_0xeecd('0x4'));var BPromise=require(_0xeecd('0x5'));var Mustache=require(_0xeecd('0x6'));var util=require(_0xeecd('0x7'));var path=require(_0xeecd('0x8'));var sox=require('sox');var csv=require(_0xeecd('0x9'));var ejs=require(_0xeecd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeecd('0xb'));var squel=require(_0xeecd('0xc'));var crypto=require(_0xeecd('0xd'));var jsforce=require(_0xeecd('0xe'));var deskjs=require(_0xeecd('0xf'));var toCsv=require(_0xeecd('0x9'));var querystring=require('querystring');var Papa=require(_0xeecd('0x10'));var Redis=require(_0xeecd('0x11'));var authService=require(_0xeecd('0x12'));var qs=require(_0xeecd('0x13'));var as=require(_0xeecd('0x14'));var hardwareService=require(_0xeecd('0x15'));var logger=require('../../config/logger')(_0xeecd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeecd('0x17'))['db'];function respondWithStatusCode(_0x3efb3d,_0x149542){_0x149542=_0x149542||0xcc;return function(_0x286be4){if(_0x286be4){return _0x3efb3d[_0xeecd('0x18')](_0x149542);}return _0x3efb3d['status'](_0x149542)[_0xeecd('0x19')]();};}function respondWithResult(_0x56c729,_0x4b5419){_0x4b5419=_0x4b5419||0xc8;return function(_0x39170b){if(_0x39170b){return _0x56c729['status'](_0x4b5419)[_0xeecd('0x1a')](_0x39170b);}};}function respondWithFilteredResult(_0x4cc100,_0x14dfe8){return function(_0x498a85){if(_0x498a85){var _0x4c23f5=typeof _0x14dfe8['offset']===_0xeecd('0x1b')&&typeof _0x14dfe8[_0xeecd('0x1c')]===_0xeecd('0x1b');var _0x37a809=_0x498a85[_0xeecd('0x1d')];var _0x1fff04=_0x4c23f5?0x0:_0x14dfe8[_0xeecd('0x1e')];var _0x283547=_0x4c23f5?_0x498a85[_0xeecd('0x1d')]:_0x14dfe8[_0xeecd('0x1e')]+_0x14dfe8[_0xeecd('0x1c')];var _0x20ad43;if(_0x283547>=_0x37a809){_0x283547=_0x37a809;_0x20ad43=0xc8;}else{_0x20ad43=0xce;}_0x4cc100[_0xeecd('0x1f')](_0x20ad43);return _0x4cc100[_0xeecd('0x20')](_0xeecd('0x21'),_0x1fff04+'-'+_0x283547+'/'+_0x37a809)['json'](_0x498a85);}return null;};}function patchUpdates(_0x11b48d){return function(_0x52c01b){try{jsonpatch[_0xeecd('0x22')](_0x52c01b,_0x11b48d,!![]);}catch(_0x32d7f5){return BPromise[_0xeecd('0x23')](_0x32d7f5);}return _0x52c01b[_0xeecd('0x24')]();};}function saveUpdates(_0x33701f,_0x33fb6c){return function(_0x361e11){if(_0x361e11){return _0x361e11[_0xeecd('0x25')](_0x33701f)[_0xeecd('0x26')](function(_0x29f719){return _0x29f719;});}return null;};}function removeEntity(_0x3e06df,_0x4a331c){return function(_0x463b1c){if(_0x463b1c){return _0x463b1c[_0xeecd('0x27')]()[_0xeecd('0x26')](function(){var _0x5a7a69=_0x463b1c[_0xeecd('0x28')]({'plain':!![]});var _0x42df02='Templates';return db[_0xeecd('0x29')][_0xeecd('0x27')]({'where':{'type':_0x42df02,'resourceId':_0x5a7a69['id']}})[_0xeecd('0x26')](function(){return _0x463b1c;});})['then'](function(){_0x3e06df[_0xeecd('0x1f')](0xcc)[_0xeecd('0x19')]();});}};}function handleEntityNotFound(_0x294e25,_0x38ffea){return function(_0x5e6f6e){if(!_0x5e6f6e){_0x294e25[_0xeecd('0x18')](0x194);}return _0x5e6f6e;};}function handleError(_0x1e7082,_0x38a48c){_0x38a48c=_0x38a48c||0x1f4;return function(_0x3f9b16){logger[_0xeecd('0x2a')](_0x3f9b16['stack']);if(_0x3f9b16[_0xeecd('0x2b')]){delete _0x3f9b16[_0xeecd('0x2b')];}_0x1e7082[_0xeecd('0x1f')](_0x38a48c)[_0xeecd('0x2c')](_0x3f9b16);};}exports[_0xeecd('0x2d')]=function(_0x442146,_0x85d22a){var _0x8153a6={},_0xd39470={},_0x331f7f={'count':0x0,'rows':[]};var _0xd29859=_[_0xeecd('0x2e')](db['Template'][_0xeecd('0x2f')],function(_0x517b41){return{'name':_0x517b41[_0xeecd('0x30')],'type':_0x517b41['type']['key']};});_0xd39470['model']=_[_0xeecd('0x2e')](_0xd29859,_0xeecd('0x2b'));_0xd39470[_0xeecd('0x31')]=_[_0xeecd('0x32')](_0x442146[_0xeecd('0x31')]);_0xd39470[_0xeecd('0x33')]=_[_0xeecd('0x34')](_0xd39470[_0xeecd('0x35')],_0xd39470['query']);_0x8153a6['attributes']=_['intersection'](_0xd39470['model'],qs[_0xeecd('0x36')](_0x442146[_0xeecd('0x31')][_0xeecd('0x36')]));_0x8153a6[_0xeecd('0x37')]=_0x8153a6['attributes'][_0xeecd('0x38')]?_0x8153a6['attributes']:_0xd39470[_0xeecd('0x35')];if(!_0x442146[_0xeecd('0x31')][_0xeecd('0x39')](_0xeecd('0x3a'))){_0x8153a6[_0xeecd('0x1c')]=qs['limit'](_0x442146[_0xeecd('0x31')][_0xeecd('0x1c')]);_0x8153a6['offset']=qs[_0xeecd('0x1e')](_0x442146['query'][_0xeecd('0x1e')]);}_0x8153a6[_0xeecd('0x3b')]=qs[_0xeecd('0x3c')](_0x442146[_0xeecd('0x31')][_0xeecd('0x3c')]);_0x8153a6['where']=qs[_0xeecd('0x33')](_[_0xeecd('0x3d')](_0x442146[_0xeecd('0x31')],_0xd39470[_0xeecd('0x33')]),_0xd29859);if(_0x442146[_0xeecd('0x31')][_0xeecd('0x3e')]){_0x8153a6['where']=_[_0xeecd('0x3f')](_0x8153a6[_0xeecd('0x40')],{'$or':_['map'](_0xd29859,function(_0x521b1a){if(_0x521b1a['type']!==_0xeecd('0x41')){var _0x4b2c06={};_0x4b2c06[_0x521b1a[_0xeecd('0x2b')]]={'$like':'%'+_0x442146[_0xeecd('0x31')][_0xeecd('0x3e')]+'%'};return _0x4b2c06;}})});}_0x8153a6=_[_0xeecd('0x3f')]({},_0x8153a6,_0x442146['options']);var _0x3e8876={'where':_0x8153a6[_0xeecd('0x40')]};return db['Template']['count'](_0x3e8876)[_0xeecd('0x26')](function(_0x2a7854){_0x331f7f[_0xeecd('0x1d')]=_0x2a7854;if(_0x442146[_0xeecd('0x31')]['includeAll']){_0x8153a6[_0xeecd('0x42')]=[{'all':!![]}];}return db[_0xeecd('0x43')][_0xeecd('0x44')](_0x8153a6);})[_0xeecd('0x26')](function(_0x21a657){_0x331f7f[_0xeecd('0x45')]=_0x21a657;return _0x331f7f;})[_0xeecd('0x26')](respondWithFilteredResult(_0x85d22a,_0x8153a6))[_0xeecd('0x46')](handleError(_0x85d22a,null));};exports[_0xeecd('0x47')]=function(_0x19a0ef,_0x3aca82){var _0x165cd3={'raw':!![],'where':{'id':_0x19a0ef[_0xeecd('0x48')]['id']}},_0x1def2e={};_0x1def2e['model']=_[_0xeecd('0x32')](db[_0xeecd('0x43')][_0xeecd('0x2f')]);_0x1def2e[_0xeecd('0x31')]=_[_0xeecd('0x32')](_0x19a0ef[_0xeecd('0x31')]);_0x1def2e[_0xeecd('0x33')]=_['intersection'](_0x1def2e['model'],_0x1def2e[_0xeecd('0x31')]);_0x165cd3[_0xeecd('0x37')]=_[_0xeecd('0x34')](_0x1def2e[_0xeecd('0x35')],qs[_0xeecd('0x36')](_0x19a0ef[_0xeecd('0x31')][_0xeecd('0x36')]));_0x165cd3[_0xeecd('0x37')]=_0x165cd3[_0xeecd('0x37')]['length']?_0x165cd3[_0xeecd('0x37')]:_0x1def2e[_0xeecd('0x35')];if(_0x19a0ef[_0xeecd('0x31')][_0xeecd('0x49')]){_0x165cd3[_0xeecd('0x42')]=[{'all':!![]}];}_0x165cd3=_['merge']({},_0x165cd3,_0x19a0ef[_0xeecd('0x4a')]);return db[_0xeecd('0x43')][_0xeecd('0x4b')](_0x165cd3)[_0xeecd('0x26')](handleEntityNotFound(_0x3aca82,null))[_0xeecd('0x26')](respondWithResult(_0x3aca82,null))[_0xeecd('0x46')](handleError(_0x3aca82,null));};exports[_0xeecd('0x4c')]=function(_0x592347,_0x8e4bfa){return db[_0xeecd('0x43')][_0xeecd('0x4c')](_0x592347['body'],{})[_0xeecd('0x26')](function(_0x876f80){var _0x592b43=_0x592347[_0xeecd('0x4d')][_0xeecd('0x28')]({'plain':!![]});if(!_0x592b43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x592b43[_0xeecd('0x4e')]===_0xeecd('0x4d')){var _0x39b339=_0x876f80[_0xeecd('0x28')]({'plain':!![]});var _0x55c77a=_0xeecd('0x4f');return db['UserProfileSection'][_0xeecd('0x4b')]({'where':{'name':_0x55c77a,'userProfileId':_0x592b43[_0xeecd('0x50')]},'raw':!![]})[_0xeecd('0x26')](function(_0x34195a){if(_0x34195a&&_0x34195a['autoAssociation']===0x0){return db[_0xeecd('0x29')][_0xeecd('0x4c')]({'name':_0x39b339[_0xeecd('0x2b')],'resourceId':_0x39b339['id'],'type':_0x34195a['name'],'sectionId':_0x34195a['id']},{})['then'](function(){return _0x876f80;});}else{return _0x876f80;}})[_0xeecd('0x46')](function(_0x394b3f){logger[_0xeecd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x394b3f);throw _0x394b3f;});}return _0x876f80;})['then'](respondWithResult(_0x8e4bfa,0xc9))[_0xeecd('0x46')](handleError(_0x8e4bfa,null));};exports['update']=function(_0x230753,_0x575207){if(_0x230753[_0xeecd('0x51')]['id']){delete _0x230753[_0xeecd('0x51')]['id'];}return db[_0xeecd('0x43')][_0xeecd('0x4b')]({'where':{'id':_0x230753[_0xeecd('0x48')]['id']}})[_0xeecd('0x26')](handleEntityNotFound(_0x575207,null))[_0xeecd('0x26')](saveUpdates(_0x230753[_0xeecd('0x51')],null))[_0xeecd('0x26')](respondWithResult(_0x575207,null))[_0xeecd('0x46')](handleError(_0x575207,null));};exports['destroy']=function(_0x32a866,_0xa8b38a){return db[_0xeecd('0x43')][_0xeecd('0x4b')]({'where':{'id':_0x32a866[_0xeecd('0x48')]['id']}})['then'](handleEntityNotFound(_0xa8b38a,null))['then'](removeEntity(_0xa8b38a,null))['catch'](handleError(_0xa8b38a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4ff6367..5f8abe7 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 _0x019d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0x1b4b1f,_0x4462b6){var _0x108025=function(_0x51a19b){while(--_0x51a19b){_0x1b4b1f['push'](_0x1b4b1f['shift']());}};_0x108025(++_0x4462b6);}(_0x019d,0xe6));var _0xd019=function(_0x438002,_0x203b79){_0x438002=_0x438002-0x0;var _0x159d9a=_0x019d[_0x438002];return _0x159d9a;};'use strict';var _=require('lodash');var util=require(_0xd019('0x0'));var logger=require(_0xd019('0x1'))(_0xd019('0x2'));var moment=require(_0xd019('0x3'));var BPromise=require('bluebird');var rp=require(_0xd019('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd019('0x5'));var config=require(_0xd019('0x6'));var attributes=require(_0xd019('0x7'));module[_0xd019('0x8')]=function(_0x247a2f,_0x49d368){return _0x247a2f['define'](_0xd019('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c9f=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird'];(function(_0x257495,_0x18269b){var _0x3849aa=function(_0x1ca94e){while(--_0x1ca94e){_0x257495['push'](_0x257495['shift']());}};_0x3849aa(++_0x18269b);}(_0x2c9f,0xb1));var _0xf2c9=function(_0x2a6aa6,_0x8f7bc1){_0x2a6aa6=_0x2a6aa6-0x0;var _0x47fb07=_0x2c9f[_0x2a6aa6];return _0x47fb07;};'use strict';var _=require(_0xf2c9('0x0'));var util=require('util');var logger=require(_0xf2c9('0x1'))(_0xf2c9('0x2'));var moment=require(_0xf2c9('0x3'));var BPromise=require(_0xf2c9('0x4'));var rp=require(_0xf2c9('0x5'));var fs=require('fs');var path=require(_0xf2c9('0x6'));var rimraf=require(_0xf2c9('0x7'));var config=require(_0xf2c9('0x8'));var attributes=require(_0xf2c9('0x9'));module[_0xf2c9('0xa')]=function(_0x1d0299,_0x2d8e69){return _0x1d0299[_0xf2c9('0xb')](_0xf2c9('0xc'),attributes,{'tableName':_0xf2c9('0xd'),'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 825648c..cb60f54 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 _0xefc2=['jayson/promise','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x55c06b,_0x1ab2da){var _0x12eb36=function(_0x4acd90){while(--_0x4acd90){_0x55c06b['push'](_0x55c06b['shift']());}};_0x12eb36(++_0x1ab2da);}(_0xefc2,0xde));var _0x2efc=function(_0x12625b,_0x542500){_0x12625b=_0x12625b-0x0;var _0x21c77c=_0xefc2[_0x12625b];return _0x21c77c;};'use strict';var _=require(_0x2efc('0x0'));var util=require(_0x2efc('0x1'));var moment=require(_0x2efc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2efc('0x3'));var db=require(_0x2efc('0x4'))['db'];var utils=require(_0x2efc('0x5'));var logger=require(_0x2efc('0x6'))(_0x2efc('0x7'));var config=require(_0x2efc('0x8'));var jayson=require(_0x2efc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x281d72,_0x6897ad,_0x40f9f8){return new BPromise(function(_0x2e5c68,_0xd5d98){return client[_0x2efc('0xa')](_0x281d72,_0x40f9f8)[_0x2efc('0xb')](function(_0xd80351){logger[_0x2efc('0xc')](_0x2efc('0xd'),_0x6897ad,_0x2efc('0xe'));logger[_0x2efc('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x6897ad,_0x2efc('0xe'),JSON['stringify'](_0xd80351));if(_0xd80351[_0x2efc('0x10')]){if(_0xd80351[_0x2efc('0x10')][_0x2efc('0x11')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x6897ad,_0xd80351['error']['message']);return _0xd5d98(_0xd80351[_0x2efc('0x10')][_0x2efc('0x12')]);}logger[_0x2efc('0x10')](_0x2efc('0xd'),_0x6897ad,_0xd80351[_0x2efc('0x10')][_0x2efc('0x12')]);return _0x2e5c68(_0xd80351[_0x2efc('0x10')][_0x2efc('0x12')]);}else{logger['info']('Template,\x20%s,\x20%s',_0x6897ad,_0x2efc('0xe'));_0x2e5c68(_0xd80351[_0x2efc('0x13')][_0x2efc('0x12')]);}})[_0x2efc('0x14')](function(_0x895ad4){logger[_0x2efc('0x10')](_0x2efc('0xd'),_0x6897ad,_0x895ad4);_0xd5d98(_0x895ad4);});});}exports['GetTemplate']=function(_0x4d1614){var _0x55fc34=this;return new Promise(function(_0x495fac,_0x447cbb){return db[_0x2efc('0x15')][_0x2efc('0x16')]({'raw':_0x4d1614[_0x2efc('0x17')]?_0x4d1614[_0x2efc('0x17')][_0x2efc('0x18')]===undefined?!![]:![]:!![],'where':_0x4d1614[_0x2efc('0x17')]?_0x4d1614[_0x2efc('0x17')][_0x2efc('0x19')]||null:null,'attributes':_0x4d1614['options']?_0x4d1614[_0x2efc('0x17')][_0x2efc('0x1a')]||null:null,'limit':_0x4d1614[_0x2efc('0x17')]?_0x4d1614['options'][_0x2efc('0x1b')]||null:null,'include':_0x4d1614[_0x2efc('0x17')]?_0x4d1614[_0x2efc('0x17')][_0x2efc('0x1c')]?_[_0x2efc('0x1d')](_0x4d1614[_0x2efc('0x17')][_0x2efc('0x1c')],function(_0x3e49d3){return{'model':db[_0x3e49d3[_0x2efc('0x1e')]],'as':_0x3e49d3['as'],'attributes':_0x3e49d3[_0x2efc('0x1a')],'include':_0x3e49d3[_0x2efc('0x1c')]?_[_0x2efc('0x1d')](_0x3e49d3['include'],function(_0xc708e0){return{'model':db[_0xc708e0[_0x2efc('0x1e')]],'as':_0xc708e0['as'],'attributes':_0xc708e0[_0x2efc('0x1a')],'include':_0xc708e0[_0x2efc('0x1c')]?_['map'](_0xc708e0['include'],function(_0xaea360){return{'model':db[_0xaea360[_0x2efc('0x1e')]],'as':_0xaea360['as'],'attributes':_0xaea360[_0x2efc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2efc('0xb')](function(_0x125d04){logger['info'](_0x2efc('0x1f'),_0x4d1614);logger[_0x2efc('0xf')]('GetTemplate',_0x4d1614,JSON[_0x2efc('0x20')](_0x125d04));_0x495fac(_0x125d04);})[_0x2efc('0x14')](function(_0x375255){logger[_0x2efc('0x10')](_0x2efc('0x1f'),_0x375255['message'],_0x4d1614);_0x447cbb(_0x55fc34[_0x2efc('0x10')](0x1f4,_0x375255[_0x2efc('0x12')]));});});}; \ No newline at end of file +var _0x2c23=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','debug','lodash'];(function(_0x5afb89,_0x3ab2e2){var _0x4227d0=function(_0x7c205){while(--_0x7c205){_0x5afb89['push'](_0x5afb89['shift']());}};_0x4227d0(++_0x3ab2e2);}(_0x2c23,0xdf));var _0x32c2=function(_0x496f2c,_0x333179){_0x496f2c=_0x496f2c-0x0;var _0x242388=_0x2c23[_0x496f2c];return _0x242388;};'use strict';var _=require(_0x32c2('0x0'));var util=require(_0x32c2('0x1'));var moment=require('moment');var BPromise=require(_0x32c2('0x2'));var rs=require(_0x32c2('0x3'));var fs=require('fs');var Redis=require(_0x32c2('0x4'));var db=require(_0x32c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x32c2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x32c2('0x7'));var client=jayson[_0x32c2('0x8')][_0x32c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x326c8f,_0x1d66b3,_0xfab0a2){return new BPromise(function(_0x2e144c,_0x3c96a6){return client[_0x32c2('0xa')](_0x326c8f,_0xfab0a2)[_0x32c2('0xb')](function(_0x38775f){logger['info'](_0x32c2('0xc'),_0x1d66b3,_0x32c2('0xd'));logger['debug'](_0x32c2('0xe'),_0x1d66b3,_0x32c2('0xd'),JSON[_0x32c2('0xf')](_0x38775f));if(_0x38775f[_0x32c2('0x10')]){if(_0x38775f['error'][_0x32c2('0x11')]===0x1f4){logger[_0x32c2('0x10')](_0x32c2('0xc'),_0x1d66b3,_0x38775f[_0x32c2('0x10')][_0x32c2('0x12')]);return _0x3c96a6(_0x38775f[_0x32c2('0x10')]['message']);}logger[_0x32c2('0x10')](_0x32c2('0xc'),_0x1d66b3,_0x38775f['error'][_0x32c2('0x12')]);return _0x2e144c(_0x38775f['error'][_0x32c2('0x12')]);}else{logger[_0x32c2('0x13')](_0x32c2('0xc'),_0x1d66b3,_0x32c2('0xd'));_0x2e144c(_0x38775f['result'][_0x32c2('0x12')]);}})[_0x32c2('0x14')](function(_0x87c77){logger[_0x32c2('0x10')]('Template,\x20%s,\x20%s',_0x1d66b3,_0x87c77);_0x3c96a6(_0x87c77);});});}exports[_0x32c2('0x15')]=function(_0x334e15){var _0x8c0710=this;return new Promise(function(_0xb273b7,_0x2634b4){return db[_0x32c2('0x16')]['findAll']({'raw':_0x334e15[_0x32c2('0x17')]?_0x334e15[_0x32c2('0x17')][_0x32c2('0x18')]===undefined?!![]:![]:!![],'where':_0x334e15[_0x32c2('0x17')]?_0x334e15[_0x32c2('0x17')][_0x32c2('0x19')]||null:null,'attributes':_0x334e15['options']?_0x334e15['options'][_0x32c2('0x1a')]||null:null,'limit':_0x334e15['options']?_0x334e15[_0x32c2('0x17')][_0x32c2('0x1b')]||null:null,'include':_0x334e15[_0x32c2('0x17')]?_0x334e15[_0x32c2('0x17')][_0x32c2('0x1c')]?_[_0x32c2('0x1d')](_0x334e15[_0x32c2('0x17')][_0x32c2('0x1c')],function(_0x3ae22e){return{'model':db[_0x3ae22e[_0x32c2('0x1e')]],'as':_0x3ae22e['as'],'attributes':_0x3ae22e[_0x32c2('0x1a')],'include':_0x3ae22e[_0x32c2('0x1c')]?_[_0x32c2('0x1d')](_0x3ae22e['include'],function(_0x1f2d9e){return{'model':db[_0x1f2d9e['model']],'as':_0x1f2d9e['as'],'attributes':_0x1f2d9e[_0x32c2('0x1a')],'include':_0x1f2d9e[_0x32c2('0x1c')]?_[_0x32c2('0x1d')](_0x1f2d9e['include'],function(_0x520cd8){return{'model':db[_0x520cd8['model']],'as':_0x520cd8['as'],'attributes':_0x520cd8[_0x32c2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x32c2('0xb')](function(_0x55453c){logger[_0x32c2('0x13')]('GetTemplate',_0x334e15);logger[_0x32c2('0x1f')](_0x32c2('0x15'),_0x334e15,JSON[_0x32c2('0xf')](_0x55453c));_0xb273b7(_0x55453c);})[_0x32c2('0x14')](function(_0x3d9950){logger[_0x32c2('0x10')]('GetTemplate',_0x3d9950[_0x32c2('0x12')],_0x334e15);_0x2634b4(_0x8c0710['error'](0x1f4,_0x3d9950['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a58721a..dbc59e1 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 _0xbd84=['addAnyCondition','addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition'];(function(_0x25e646,_0x3838d2){var _0x389c31=function(_0x5703aa){while(--_0x5703aa){_0x25e646['push'](_0x25e646['shift']());}};_0x389c31(++_0x3838d2);}(_0xbd84,0xb5));var _0x4bd8=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xbd84[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require(_0x4bd8('0x0'));var path=require(_0x4bd8('0x1'));var timeout=require(_0x4bd8('0x2'));var express=require(_0x4bd8('0x3'));var router=express[_0x4bd8('0x4')]();var fs_extra=require(_0x4bd8('0x5'));var auth=require(_0x4bd8('0x6'));var interaction=require(_0x4bd8('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x4bd8('0x8')]('/',auth['isAuthenticated'](),controller[_0x4bd8('0x9')]);router['get'](_0x4bd8('0xa'),auth[_0x4bd8('0xb')](),controller[_0x4bd8('0xc')]);router['get']('/:id/all_conditions',auth[_0x4bd8('0xb')](),controller[_0x4bd8('0xd')]);router[_0x4bd8('0x8')](_0x4bd8('0xe'),auth[_0x4bd8('0xb')](),controller[_0x4bd8('0xf')]);router[_0x4bd8('0x8')](_0x4bd8('0x10'),auth['isAuthenticated'](),controller[_0x4bd8('0x11')]);router[_0x4bd8('0x12')]('/',auth[_0x4bd8('0xb')](),controller[_0x4bd8('0x13')]);router[_0x4bd8('0x12')](_0x4bd8('0x14'),auth['isAuthenticated'](),controller[_0x4bd8('0x15')]);router['post']('/:id/any_conditions',auth[_0x4bd8('0xb')](),controller[_0x4bd8('0x16')]);router[_0x4bd8('0x12')]('/:id/actions',auth[_0x4bd8('0xb')](),controller[_0x4bd8('0x17')]);router[_0x4bd8('0x18')](_0x4bd8('0xa'),auth['isAuthenticated'](),controller[_0x4bd8('0x19')]);router[_0x4bd8('0x1a')](_0x4bd8('0xa'),auth[_0x4bd8('0xb')](),controller[_0x4bd8('0x1b')]);module[_0x4bd8('0x1c')]=router; \ No newline at end of file +var _0xa788=['index','get','show','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4873c3,_0x503009){var _0x368be2=function(_0x3b6a18){while(--_0x3b6a18){_0x4873c3['push'](_0x4873c3['shift']());}};_0x368be2(++_0x503009);}(_0xa788,0x70));var _0x8a78=function(_0x3c3326,_0x2012bb){_0x3c3326=_0x3c3326-0x0;var _0x53c608=_0xa788[_0x3c3326];return _0x53c608;};'use strict';var multer=require(_0x8a78('0x0'));var util=require(_0x8a78('0x1'));var path=require(_0x8a78('0x2'));var timeout=require(_0x8a78('0x3'));var express=require('express');var router=express[_0x8a78('0x4')]();var fs_extra=require(_0x8a78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8a78('0x6'));var config=require(_0x8a78('0x7'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8a78('0x8')]);router[_0x8a78('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8a78('0xa')]);router['get']('/:id/all_conditions',auth[_0x8a78('0xb')](),controller[_0x8a78('0xc')]);router['get'](_0x8a78('0xd'),auth[_0x8a78('0xb')](),controller[_0x8a78('0xe')]);router[_0x8a78('0x9')](_0x8a78('0xf'),auth[_0x8a78('0xb')](),controller[_0x8a78('0x10')]);router[_0x8a78('0x11')]('/',auth[_0x8a78('0xb')](),controller['create']);router[_0x8a78('0x11')](_0x8a78('0x12'),auth[_0x8a78('0xb')](),controller['addAllCondition']);router[_0x8a78('0x11')](_0x8a78('0xd'),auth[_0x8a78('0xb')](),controller['addAnyCondition']);router[_0x8a78('0x11')]('/:id/actions',auth[_0x8a78('0xb')](),controller['addAction']);router[_0x8a78('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8a78('0x14')](_0x8a78('0x15'),auth[_0x8a78('0xb')](),controller[_0x8a78('0x16')]);module[_0x8a78('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 667c3da..61b04e7 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 _0x292e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x33f500,_0x3587d6){var _0x2f30cb=function(_0x5223e3){while(--_0x5223e3){_0x33f500['push'](_0x33f500['shift']());}};_0x2f30cb(++_0x3587d6);}(_0x292e,0x1d9));var _0xe292=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x292e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xe292('0x0'));module[_0xe292('0x1')]={'name':{'type':Sequelize[_0xe292('0x2')]},'channel':{'type':Sequelize[_0xe292('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xe292('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x570b=['exports','STRING','BOOLEAN'];(function(_0x8f76e4,_0x4ae51b){var _0x5882d5=function(_0x516a6c){while(--_0x516a6c){_0x8f76e4['push'](_0x8f76e4['shift']());}};_0x5882d5(++_0x4ae51b);}(_0x570b,0x10e));var _0xb570=function(_0x7777c7,_0x278b61){_0x7777c7=_0x7777c7-0x0;var _0x363a0e=_0x570b[_0x7777c7];return _0x363a0e;};'use strict';var Sequelize=require('sequelize');module[_0xb570('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb570('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb570('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 218ebf6..d891119 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 _0xc8f2=['filter','merge','options','Trigger','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','get','role','Triggers','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0xeeac1b,_0x1b64ce){var _0x5c1ee5=function(_0x4ba77e){while(--_0x4ba77e){_0xeeac1b['push'](_0xeeac1b['shift']());}};_0x5c1ee5(++_0x1b64ce);}(_0xc8f2,0x12c));var _0x2c8f=function(_0x15adcc,_0x1da13a){_0x15adcc=_0x15adcc-0x0;var _0x42b973=_0xc8f2[_0x15adcc];return _0x42b973;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c8f('0x0'));var zipdir=require(_0x2c8f('0x1'));var jsonpatch=require(_0x2c8f('0x2'));var rp=require('request-promise');var moment=require(_0x2c8f('0x3'));var BPromise=require(_0x2c8f('0x4'));var Mustache=require(_0x2c8f('0x5'));var util=require('util');var path=require(_0x2c8f('0x6'));var sox=require('sox');var csv=require(_0x2c8f('0x7'));var ejs=require(_0x2c8f('0x8'));var fs=require('fs');var fs_extra=require(_0x2c8f('0x9'));var _=require('lodash');var squel=require(_0x2c8f('0xa'));var crypto=require(_0x2c8f('0xb'));var jsforce=require(_0x2c8f('0xc'));var deskjs=require(_0x2c8f('0xd'));var toCsv=require(_0x2c8f('0x7'));var querystring=require('querystring');var Papa=require(_0x2c8f('0xe'));var Redis=require('ioredis');var authService=require(_0x2c8f('0xf'));var qs=require(_0x2c8f('0x10'));var as=require(_0x2c8f('0x11'));var hardwareService=require(_0x2c8f('0x12'));var logger=require('../../config/logger')(_0x2c8f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c8f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110f41,_0x5acda1){_0x5acda1=_0x5acda1||0xcc;return function(_0xa6b2ac){if(_0xa6b2ac){return _0x110f41[_0x2c8f('0x15')](_0x5acda1);}return _0x110f41[_0x2c8f('0x16')](_0x5acda1)['end']();};}function respondWithResult(_0x24555b,_0x4170ed){_0x4170ed=_0x4170ed||0xc8;return function(_0x193698){if(_0x193698){return _0x24555b[_0x2c8f('0x16')](_0x4170ed)[_0x2c8f('0x17')](_0x193698);}};}function respondWithFilteredResult(_0x368435,_0x24fb51){return function(_0x477983){if(_0x477983){var _0x56af43=typeof _0x24fb51['offset']===_0x2c8f('0x18')&&typeof _0x24fb51['limit']===_0x2c8f('0x18');var _0x33828d=_0x477983[_0x2c8f('0x19')];var _0x13349c=_0x56af43?0x0:_0x24fb51[_0x2c8f('0x1a')];var _0x10d913=_0x56af43?_0x477983[_0x2c8f('0x19')]:_0x24fb51[_0x2c8f('0x1a')]+_0x24fb51[_0x2c8f('0x1b')];var _0x1debc2;if(_0x10d913>=_0x33828d){_0x10d913=_0x33828d;_0x1debc2=0xc8;}else{_0x1debc2=0xce;}_0x368435[_0x2c8f('0x16')](_0x1debc2);return _0x368435[_0x2c8f('0x1c')]('Content-Range',_0x13349c+'-'+_0x10d913+'/'+_0x33828d)[_0x2c8f('0x17')](_0x477983);}return null;};}function patchUpdates(_0x4e0fd6){return function(_0x431b00){try{jsonpatch[_0x2c8f('0x1d')](_0x431b00,_0x4e0fd6,!![]);}catch(_0x4224ed){return BPromise[_0x2c8f('0x1e')](_0x4224ed);}return _0x431b00[_0x2c8f('0x1f')]();};}function saveUpdates(_0x58defa,_0x7747f0){return function(_0x233a05){if(_0x233a05){return _0x233a05[_0x2c8f('0x20')](_0x58defa)['then'](function(_0x260a81){return _0x260a81;});}return null;};}function removeEntity(_0x15b157,_0x484ea4){return function(_0xcc5461){if(_0xcc5461){return _0xcc5461[_0x2c8f('0x21')]()[_0x2c8f('0x22')](function(){var _0x16b7b7=_0xcc5461['get']({'plain':!![]});var _0x111573='Triggers';return db['UserProfileResource'][_0x2c8f('0x21')]({'where':{'type':_0x111573,'resourceId':_0x16b7b7['id']}})['then'](function(){return _0xcc5461;});})['then'](function(){_0x15b157[_0x2c8f('0x16')](0xcc)[_0x2c8f('0x23')]();});}};}function handleEntityNotFound(_0x25f4f2,_0x33a290){return function(_0x3df6f8){if(!_0x3df6f8){_0x25f4f2[_0x2c8f('0x15')](0x194);}return _0x3df6f8;};}function handleError(_0x3d875f,_0x309b98){_0x309b98=_0x309b98||0x1f4;return function(_0x35048f){logger[_0x2c8f('0x24')](_0x35048f['stack']);if(_0x35048f[_0x2c8f('0x25')]){delete _0x35048f[_0x2c8f('0x25')];}_0x3d875f[_0x2c8f('0x16')](_0x309b98)[_0x2c8f('0x26')](_0x35048f);};}exports[_0x2c8f('0x27')]=function(_0x553d24,_0x56aa29){var _0x70f522={},_0x18b263={},_0x34b2fe={'count':0x0,'rows':[]};var _0x163366=_[_0x2c8f('0x28')](db['Trigger'][_0x2c8f('0x29')],function(_0x30d994){return{'name':_0x30d994[_0x2c8f('0x2a')],'type':_0x30d994['type'][_0x2c8f('0x2b')]};});_0x18b263['model']=_['map'](_0x163366,_0x2c8f('0x25'));_0x18b263['query']=_[_0x2c8f('0x2c')](_0x553d24[_0x2c8f('0x2d')]);_0x18b263[_0x2c8f('0x2e')]=_['intersection'](_0x18b263[_0x2c8f('0x2f')],_0x18b263['query']);_0x70f522['attributes']=_['intersection'](_0x18b263['model'],qs[_0x2c8f('0x30')](_0x553d24[_0x2c8f('0x2d')]['fields']));_0x70f522[_0x2c8f('0x31')]=_0x70f522[_0x2c8f('0x31')][_0x2c8f('0x32')]?_0x70f522[_0x2c8f('0x31')]:_0x18b263['model'];if(!_0x553d24[_0x2c8f('0x2d')][_0x2c8f('0x33')]('nolimit')){_0x70f522[_0x2c8f('0x1b')]=qs[_0x2c8f('0x1b')](_0x553d24[_0x2c8f('0x2d')]['limit']);_0x70f522[_0x2c8f('0x1a')]=qs['offset'](_0x553d24['query']['offset']);}_0x70f522[_0x2c8f('0x34')]=qs[_0x2c8f('0x35')](_0x553d24['query']['sort']);_0x70f522[_0x2c8f('0x36')]=qs['filters'](_[_0x2c8f('0x37')](_0x553d24[_0x2c8f('0x2d')],_0x18b263[_0x2c8f('0x2e')]),_0x163366);if(_0x553d24[_0x2c8f('0x2d')][_0x2c8f('0x38')]){_0x70f522[_0x2c8f('0x36')]=_[_0x2c8f('0x39')](_0x70f522[_0x2c8f('0x36')],{'$or':_[_0x2c8f('0x28')](_0x163366,function(_0x45c604){if(_0x45c604['type']!=='VIRTUAL'){var _0x46cf82={};_0x46cf82[_0x45c604[_0x2c8f('0x25')]]={'$like':'%'+_0x553d24[_0x2c8f('0x2d')][_0x2c8f('0x38')]+'%'};return _0x46cf82;}})});}_0x70f522=_['merge']({},_0x70f522,_0x553d24[_0x2c8f('0x3a')]);var _0x1e7d10={'where':_0x70f522[_0x2c8f('0x36')]};return db[_0x2c8f('0x3b')][_0x2c8f('0x19')](_0x1e7d10)[_0x2c8f('0x22')](function(_0xdb4d6f){_0x34b2fe[_0x2c8f('0x19')]=_0xdb4d6f;if(_0x553d24[_0x2c8f('0x2d')][_0x2c8f('0x3c')]){_0x70f522[_0x2c8f('0x3d')]=[{'all':!![]}];}return db[_0x2c8f('0x3b')][_0x2c8f('0x3e')](_0x70f522);})[_0x2c8f('0x22')](function(_0x6d235){_0x34b2fe[_0x2c8f('0x3f')]=_0x6d235;return _0x34b2fe;})[_0x2c8f('0x22')](respondWithFilteredResult(_0x56aa29,_0x70f522))[_0x2c8f('0x40')](handleError(_0x56aa29,null));};exports[_0x2c8f('0x41')]=function(_0x263b5f,_0x30ecf6){var _0xce5bf1={'raw':![],'where':{'id':_0x263b5f[_0x2c8f('0x42')]['id']}},_0x43cd2d={};_0x43cd2d[_0x2c8f('0x2f')]=_[_0x2c8f('0x2c')](db[_0x2c8f('0x3b')]['rawAttributes']);_0x43cd2d['query']=_[_0x2c8f('0x2c')](_0x263b5f[_0x2c8f('0x2d')]);_0x43cd2d[_0x2c8f('0x2e')]=_[_0x2c8f('0x43')](_0x43cd2d['model'],_0x43cd2d['query']);_0xce5bf1[_0x2c8f('0x31')]=_[_0x2c8f('0x43')](_0x43cd2d[_0x2c8f('0x2f')],qs['fields'](_0x263b5f[_0x2c8f('0x2d')][_0x2c8f('0x30')]));_0xce5bf1[_0x2c8f('0x31')]=_0xce5bf1[_0x2c8f('0x31')][_0x2c8f('0x32')]?_0xce5bf1[_0x2c8f('0x31')]:_0x43cd2d[_0x2c8f('0x2f')];if(_0x263b5f[_0x2c8f('0x2d')][_0x2c8f('0x3c')]){_0xce5bf1[_0x2c8f('0x3d')]=[{'all':!![]}];}_0xce5bf1=_[_0x2c8f('0x39')]({},_0xce5bf1,_0x263b5f[_0x2c8f('0x3a')]);return db['Trigger'][_0x2c8f('0x44')](_0xce5bf1)[_0x2c8f('0x22')](handleEntityNotFound(_0x30ecf6,null))[_0x2c8f('0x22')](respondWithResult(_0x30ecf6,null))[_0x2c8f('0x40')](handleError(_0x30ecf6,null));};exports[_0x2c8f('0x45')]=function(_0x537f14,_0x4bbbf3){return db[_0x2c8f('0x3b')][_0x2c8f('0x45')](_0x537f14['body'],{})['then'](function(_0x3178c9){var _0x5ad2cc=_0x537f14[_0x2c8f('0x46')][_0x2c8f('0x47')]({'plain':!![]});if(!_0x5ad2cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ad2cc[_0x2c8f('0x48')]==='user'){var _0x4ccf30=_0x3178c9['get']({'plain':!![]});var _0x410e17=_0x2c8f('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x410e17,'userProfileId':_0x5ad2cc['userProfileId']},'raw':!![]})[_0x2c8f('0x22')](function(_0x333e0e){if(_0x333e0e&&_0x333e0e[_0x2c8f('0x4a')]===0x0){return db[_0x2c8f('0x4b')][_0x2c8f('0x45')]({'name':_0x4ccf30[_0x2c8f('0x25')],'resourceId':_0x4ccf30['id'],'type':_0x333e0e[_0x2c8f('0x25')],'sectionId':_0x333e0e['id']},{})['then'](function(){return _0x3178c9;});}else{return _0x3178c9;}})[_0x2c8f('0x40')](function(_0x25b9f1){logger[_0x2c8f('0x24')](_0x2c8f('0x4c'),_0x25b9f1);throw _0x25b9f1;});}return _0x3178c9;})[_0x2c8f('0x22')](respondWithResult(_0x4bbbf3,0xc9))['catch'](handleError(_0x4bbbf3,null));};exports[_0x2c8f('0x20')]=function(_0x4c2c84,_0x4e2267){if(_0x4c2c84[_0x2c8f('0x4d')]['id']){delete _0x4c2c84[_0x2c8f('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4c2c84[_0x2c8f('0x42')]['id']}})[_0x2c8f('0x22')](handleEntityNotFound(_0x4e2267,null))[_0x2c8f('0x22')](saveUpdates(_0x4c2c84[_0x2c8f('0x4d')],null))[_0x2c8f('0x22')](respondWithResult(_0x4e2267,null))['catch'](handleError(_0x4e2267,null));};exports['destroy']=function(_0x16059b,_0x821198){return db['Trigger'][_0x2c8f('0x44')]({'where':{'id':_0x16059b[_0x2c8f('0x42')]['id']}})[_0x2c8f('0x22')](handleEntityNotFound(_0x821198,null))[_0x2c8f('0x22')](removeEntity(_0x821198,null))[_0x2c8f('0x40')](handleError(_0x821198,null));};exports[_0x2c8f('0x4e')]=function(_0x2f7e3f,_0xd09f9,_0x1fa531){if(_0x2f7e3f[_0x2c8f('0x4d')]['id']){delete _0x2f7e3f['body']['id'];}return db[_0x2c8f('0x3b')][_0x2c8f('0x44')]({'where':{'id':_0x2f7e3f[_0x2c8f('0x42')]['id']}})['then'](handleEntityNotFound(_0xd09f9,null))[_0x2c8f('0x22')](function(_0x4855f5){if(_0x4855f5){_0x2f7e3f['body']['TriggerAllId']=_0x4855f5['id'];return db[_0x2c8f('0x4f')][_0x2c8f('0x45')](_0x2f7e3f[_0x2c8f('0x4d')]);}})[_0x2c8f('0x22')](respondWithResult(_0xd09f9,null))['catch'](handleError(_0xd09f9,null));};exports[_0x2c8f('0x50')]=function(_0x792d27,_0x306344,_0x1d1d22){if(_0x792d27['body']['id']){delete _0x792d27[_0x2c8f('0x4d')]['id'];}return db['Trigger'][_0x2c8f('0x44')]({'where':{'id':_0x792d27[_0x2c8f('0x42')]['id']}})['then'](handleEntityNotFound(_0x306344,null))[_0x2c8f('0x22')](function(_0x5a5f6f){if(_0x5a5f6f){_0x792d27[_0x2c8f('0x4d')][_0x2c8f('0x51')]=_0x5a5f6f['id'];return db[_0x2c8f('0x4f')][_0x2c8f('0x45')](_0x792d27[_0x2c8f('0x4d')]);}})['then'](respondWithResult(_0x306344,null))[_0x2c8f('0x40')](handleError(_0x306344,null));};exports[_0x2c8f('0x52')]=function(_0x4f02bb,_0x5c701d,_0x7c7b1c){var _0x32f105={};var _0x345234={};var _0x45edd1;var _0x5db22b;return db[_0x2c8f('0x3b')][_0x2c8f('0x53')]({'where':{'id':_0x4f02bb['params']['id']}})['then'](handleEntityNotFound(_0x5c701d,null))[_0x2c8f('0x22')](function(_0x4bd39e){if(_0x4bd39e){_0x45edd1=_0x4bd39e;_0x345234[_0x2c8f('0x2f')]=_[_0x2c8f('0x2c')](db['Condition'][_0x2c8f('0x29')]);_0x345234[_0x2c8f('0x2d')]=_[_0x2c8f('0x2c')](_0x4f02bb[_0x2c8f('0x2d')]);_0x345234[_0x2c8f('0x2e')]=_[_0x2c8f('0x43')](_0x345234[_0x2c8f('0x2f')],_0x345234[_0x2c8f('0x2d')]);_0x32f105[_0x2c8f('0x31')]=_['intersection'](_0x345234[_0x2c8f('0x2f')],qs[_0x2c8f('0x30')](_0x4f02bb[_0x2c8f('0x2d')][_0x2c8f('0x30')]));_0x32f105[_0x2c8f('0x31')]=_0x32f105[_0x2c8f('0x31')]['length']?_0x32f105[_0x2c8f('0x31')]:_0x345234[_0x2c8f('0x2f')];_0x32f105[_0x2c8f('0x34')]=qs[_0x2c8f('0x35')](_0x4f02bb[_0x2c8f('0x2d')]['sort']);_0x32f105[_0x2c8f('0x36')]=qs['filters'](_['pick'](_0x4f02bb[_0x2c8f('0x2d')],_0x345234[_0x2c8f('0x2e')]));if(_0x4f02bb[_0x2c8f('0x2d')][_0x2c8f('0x38')]){_0x32f105[_0x2c8f('0x36')]=_[_0x2c8f('0x39')](_0x32f105[_0x2c8f('0x36')],{'$or':_[_0x2c8f('0x28')](_0x32f105[_0x2c8f('0x31')],function(_0xa7c771){var _0x4cef8e={};_0x4cef8e[_0xa7c771]={'$like':'%'+_0x4f02bb[_0x2c8f('0x2d')][_0x2c8f('0x38')]+'%'};return _0x4cef8e;})});}_0x32f105=_[_0x2c8f('0x39')]({},_0x32f105,_0x4f02bb[_0x2c8f('0x3a')]);return _0x45edd1[_0x2c8f('0x52')](_0x32f105);}})[_0x2c8f('0x22')](function(_0x245006){if(_0x245006){_0x5db22b=_0x245006[_0x2c8f('0x32')];if(!_0x4f02bb[_0x2c8f('0x2d')][_0x2c8f('0x33')](_0x2c8f('0x54'))){_0x32f105[_0x2c8f('0x1b')]=qs['limit'](_0x4f02bb[_0x2c8f('0x2d')][_0x2c8f('0x1b')]);_0x32f105['offset']=qs[_0x2c8f('0x1a')](_0x4f02bb['query'][_0x2c8f('0x1a')]);}return _0x45edd1[_0x2c8f('0x52')](_0x32f105);}})[_0x2c8f('0x22')](function(_0xfc3ea3){if(_0xfc3ea3){return _0xfc3ea3?{'count':_0x5db22b,'rows':_0xfc3ea3}:null;}})[_0x2c8f('0x22')](respondWithResult(_0x5c701d,null))[_0x2c8f('0x40')](handleError(_0x5c701d,null));};exports[_0x2c8f('0x55')]=function(_0x4035f3,_0x9467d2,_0x1b80b3){var _0x289e58={};var _0x318623={};var _0x1a1300;var _0x127f5b;return db[_0x2c8f('0x3b')][_0x2c8f('0x53')]({'where':{'id':_0x4035f3[_0x2c8f('0x42')]['id']}})[_0x2c8f('0x22')](handleEntityNotFound(_0x9467d2,null))['then'](function(_0x4bbaea){if(_0x4bbaea){_0x1a1300=_0x4bbaea;_0x318623[_0x2c8f('0x2f')]=_[_0x2c8f('0x2c')](db[_0x2c8f('0x4f')][_0x2c8f('0x29')]);_0x318623[_0x2c8f('0x2d')]=_[_0x2c8f('0x2c')](_0x4035f3[_0x2c8f('0x2d')]);_0x318623[_0x2c8f('0x2e')]=_[_0x2c8f('0x43')](_0x318623[_0x2c8f('0x2f')],_0x318623['query']);_0x289e58[_0x2c8f('0x31')]=_[_0x2c8f('0x43')](_0x318623[_0x2c8f('0x2f')],qs[_0x2c8f('0x30')](_0x4035f3[_0x2c8f('0x2d')]['fields']));_0x289e58[_0x2c8f('0x31')]=_0x289e58[_0x2c8f('0x31')][_0x2c8f('0x32')]?_0x289e58[_0x2c8f('0x31')]:_0x318623['model'];_0x289e58[_0x2c8f('0x34')]=qs['sort'](_0x4035f3['query'][_0x2c8f('0x35')]);_0x289e58[_0x2c8f('0x36')]=qs[_0x2c8f('0x2e')](_[_0x2c8f('0x37')](_0x4035f3[_0x2c8f('0x2d')],_0x318623[_0x2c8f('0x2e')]));if(_0x4035f3['query'][_0x2c8f('0x38')]){_0x289e58['where']=_['merge'](_0x289e58['where'],{'$or':_['map'](_0x289e58[_0x2c8f('0x31')],function(_0x16da4e){var _0x325eee={};_0x325eee[_0x16da4e]={'$like':'%'+_0x4035f3['query']['filter']+'%'};return _0x325eee;})});}_0x289e58=_[_0x2c8f('0x39')]({},_0x289e58,_0x4035f3[_0x2c8f('0x3a')]);return _0x1a1300[_0x2c8f('0x55')](_0x289e58);}})['then'](function(_0xd728b0){if(_0xd728b0){_0x127f5b=_0xd728b0[_0x2c8f('0x32')];if(!_0x4035f3['query'][_0x2c8f('0x33')](_0x2c8f('0x54'))){_0x289e58['limit']=qs[_0x2c8f('0x1b')](_0x4035f3[_0x2c8f('0x2d')][_0x2c8f('0x1b')]);_0x289e58[_0x2c8f('0x1a')]=qs['offset'](_0x4035f3[_0x2c8f('0x2d')][_0x2c8f('0x1a')]);}return _0x1a1300[_0x2c8f('0x55')](_0x289e58);}})[_0x2c8f('0x22')](function(_0x5098d3){if(_0x5098d3){return _0x5098d3?{'count':_0x127f5b,'rows':_0x5098d3}:null;}})[_0x2c8f('0x22')](respondWithResult(_0x9467d2,null))[_0x2c8f('0x40')](handleError(_0x9467d2,null));};exports['addAction']=function(_0x29da29,_0x220cfa,_0xa34455){if(_0x29da29[_0x2c8f('0x4d')]['id']){delete _0x29da29[_0x2c8f('0x4d')]['id'];}return db[_0x2c8f('0x3b')][_0x2c8f('0x44')]({'where':{'id':_0x29da29[_0x2c8f('0x42')]['id']}})[_0x2c8f('0x22')](handleEntityNotFound(_0x220cfa,null))[_0x2c8f('0x22')](function(_0x3155c9){if(_0x3155c9){_0x29da29[_0x2c8f('0x4d')][_0x2c8f('0x56')]=_0x3155c9['id'];return db[_0x2c8f('0x57')][_0x2c8f('0x45')](_0x29da29[_0x2c8f('0x4d')]);}})['then'](respondWithResult(_0x220cfa,null))[_0x2c8f('0x40')](handleError(_0x220cfa,null));};exports[_0x2c8f('0x58')]=function(_0x2fc9c9,_0x5131e6,_0x2b6e4a){var _0x364f27={};var _0x506d18={};var _0x4442f7;var _0x3c1189;return db[_0x2c8f('0x3b')][_0x2c8f('0x53')]({'where':{'id':_0x2fc9c9[_0x2c8f('0x42')]['id']}})[_0x2c8f('0x22')](handleEntityNotFound(_0x5131e6,null))[_0x2c8f('0x22')](function(_0x2394d2){if(_0x2394d2){_0x4442f7=_0x2394d2;_0x506d18['model']=_['keys'](db[_0x2c8f('0x57')][_0x2c8f('0x29')]);_0x506d18['query']=_[_0x2c8f('0x2c')](_0x2fc9c9[_0x2c8f('0x2d')]);_0x506d18['filters']=_[_0x2c8f('0x43')](_0x506d18['model'],_0x506d18[_0x2c8f('0x2d')]);_0x364f27[_0x2c8f('0x31')]=_[_0x2c8f('0x43')](_0x506d18[_0x2c8f('0x2f')],qs['fields'](_0x2fc9c9[_0x2c8f('0x2d')]['fields']));_0x364f27['attributes']=_0x364f27['attributes'][_0x2c8f('0x32')]?_0x364f27[_0x2c8f('0x31')]:_0x506d18[_0x2c8f('0x2f')];_0x364f27['order']=qs[_0x2c8f('0x35')](_0x2fc9c9[_0x2c8f('0x2d')][_0x2c8f('0x35')]);_0x364f27['where']=qs[_0x2c8f('0x2e')](_[_0x2c8f('0x37')](_0x2fc9c9['query'],_0x506d18['filters']));if(_0x2fc9c9['query'][_0x2c8f('0x38')]){_0x364f27[_0x2c8f('0x36')]=_['merge'](_0x364f27[_0x2c8f('0x36')],{'$or':_['map'](_0x364f27[_0x2c8f('0x31')],function(_0x4cf272){var _0x462434={};_0x462434[_0x4cf272]={'$like':'%'+_0x2fc9c9[_0x2c8f('0x2d')][_0x2c8f('0x38')]+'%'};return _0x462434;})});}_0x364f27=_[_0x2c8f('0x39')]({},_0x364f27,_0x2fc9c9[_0x2c8f('0x3a')]);return _0x4442f7['getActions'](_0x364f27);}})[_0x2c8f('0x22')](function(_0x575aba){if(_0x575aba){_0x3c1189=_0x575aba[_0x2c8f('0x32')];if(!_0x2fc9c9['query'][_0x2c8f('0x33')](_0x2c8f('0x54'))){_0x364f27['limit']=qs[_0x2c8f('0x1b')](_0x2fc9c9[_0x2c8f('0x2d')][_0x2c8f('0x1b')]);_0x364f27[_0x2c8f('0x1a')]=qs[_0x2c8f('0x1a')](_0x2fc9c9['query'][_0x2c8f('0x1a')]);}return _0x4442f7[_0x2c8f('0x58')](_0x364f27);}})[_0x2c8f('0x22')](function(_0x18c5c7){if(_0x18c5c7){return _0x18c5c7?{'count':_0x3c1189,'rows':_0x18c5c7}:null;}})[_0x2c8f('0x22')](respondWithResult(_0x5131e6,null))['catch'](handleError(_0x5131e6,null));}; \ No newline at end of file +var _0x576a=['limit','set','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','options','Trigger','includeAll','include','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','sort','filter','getAnyConditions','findOne','addAction','Action','getActions','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','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','sendStatus','status','end','json','offset','undefined','count'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x576a,0x154));var _0xa576=function(_0x28a666,_0x360080){_0x28a666=_0x28a666-0x0;var _0x3c2fd9=_0x576a[_0x28a666];return _0x3c2fd9;};'use strict';var emlformat=require(_0xa576('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa576('0x1'));var rp=require(_0xa576('0x2'));var moment=require('moment');var BPromise=require(_0xa576('0x3'));var Mustache=require(_0xa576('0x4'));var util=require(_0xa576('0x5'));var path=require('path');var sox=require(_0xa576('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa576('0x7'));var _=require(_0xa576('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa576('0x9'));var querystring=require(_0xa576('0xa'));var Papa=require(_0xa576('0xb'));var Redis=require(_0xa576('0xc'));var authService=require(_0xa576('0xd'));var qs=require(_0xa576('0xe'));var as=require(_0xa576('0xf'));var hardwareService=require(_0xa576('0x10'));var logger=require(_0xa576('0x11'))(_0xa576('0x12'));var utils=require('../../config/utils');var config=require(_0xa576('0x13'));var licenseUtil=require(_0xa576('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332cf5,_0x21f8e5){_0x21f8e5=_0x21f8e5||0xcc;return function(_0xa5754e){if(_0xa5754e){return _0x332cf5[_0xa576('0x15')](_0x21f8e5);}return _0x332cf5[_0xa576('0x16')](_0x21f8e5)[_0xa576('0x17')]();};}function respondWithResult(_0x3706ee,_0x43babe){_0x43babe=_0x43babe||0xc8;return function(_0x128fc8){if(_0x128fc8){return _0x3706ee[_0xa576('0x16')](_0x43babe)[_0xa576('0x18')](_0x128fc8);}};}function respondWithFilteredResult(_0x559aed,_0x24a55b){return function(_0x2f3a4f){if(_0x2f3a4f){var _0x38625a=typeof _0x24a55b[_0xa576('0x19')]===_0xa576('0x1a')&&typeof _0x24a55b['limit']===_0xa576('0x1a');var _0x42d904=_0x2f3a4f[_0xa576('0x1b')];var _0x162b55=_0x38625a?0x0:_0x24a55b['offset'];var _0x2f2d90=_0x38625a?_0x2f3a4f['count']:_0x24a55b['offset']+_0x24a55b[_0xa576('0x1c')];var _0x22e514;if(_0x2f2d90>=_0x42d904){_0x2f2d90=_0x42d904;_0x22e514=0xc8;}else{_0x22e514=0xce;}_0x559aed[_0xa576('0x16')](_0x22e514);return _0x559aed[_0xa576('0x1d')]('Content-Range',_0x162b55+'-'+_0x2f2d90+'/'+_0x42d904)[_0xa576('0x18')](_0x2f3a4f);}return null;};}function patchUpdates(_0x4faa9d){return function(_0x5cf527){try{jsonpatch[_0xa576('0x1e')](_0x5cf527,_0x4faa9d,!![]);}catch(_0x17949e){return BPromise[_0xa576('0x1f')](_0x17949e);}return _0x5cf527[_0xa576('0x20')]();};}function saveUpdates(_0x5ae812,_0x41d928){return function(_0x3db4c4){if(_0x3db4c4){return _0x3db4c4[_0xa576('0x21')](_0x5ae812)[_0xa576('0x22')](function(_0x20ddc4){return _0x20ddc4;});}return null;};}function removeEntity(_0x26e6de,_0x4ea6ca){return function(_0x42109d){if(_0x42109d){return _0x42109d[_0xa576('0x23')]()[_0xa576('0x22')](function(){var _0x420479=_0x42109d['get']({'plain':!![]});var _0x473fb1='Triggers';return db[_0xa576('0x24')][_0xa576('0x23')]({'where':{'type':_0x473fb1,'resourceId':_0x420479['id']}})[_0xa576('0x22')](function(){return _0x42109d;});})[_0xa576('0x22')](function(){_0x26e6de[_0xa576('0x16')](0xcc)[_0xa576('0x17')]();});}};}function handleEntityNotFound(_0x33a28e,_0x1aa902){return function(_0x4c0c66){if(!_0x4c0c66){_0x33a28e[_0xa576('0x15')](0x194);}return _0x4c0c66;};}function handleError(_0x2019f5,_0x248736){_0x248736=_0x248736||0x1f4;return function(_0x2dd71d){logger[_0xa576('0x25')](_0x2dd71d['stack']);if(_0x2dd71d[_0xa576('0x26')]){delete _0x2dd71d[_0xa576('0x26')];}_0x2019f5[_0xa576('0x16')](_0x248736)[_0xa576('0x27')](_0x2dd71d);};}exports[_0xa576('0x28')]=function(_0x27251f,_0x3556ba){var _0x184628={},_0x6e897d={},_0x3fb993={'count':0x0,'rows':[]};var _0x1cf82e=_['map'](db['Trigger'][_0xa576('0x29')],function(_0x10139c){return{'name':_0x10139c[_0xa576('0x2a')],'type':_0x10139c[_0xa576('0x2b')][_0xa576('0x2c')]};});_0x6e897d['model']=_[_0xa576('0x2d')](_0x1cf82e,_0xa576('0x26'));_0x6e897d[_0xa576('0x2e')]=_[_0xa576('0x2f')](_0x27251f[_0xa576('0x2e')]);_0x6e897d[_0xa576('0x30')]=_[_0xa576('0x31')](_0x6e897d[_0xa576('0x32')],_0x6e897d[_0xa576('0x2e')]);_0x184628['attributes']=_['intersection'](_0x6e897d[_0xa576('0x32')],qs[_0xa576('0x33')](_0x27251f[_0xa576('0x2e')][_0xa576('0x33')]));_0x184628[_0xa576('0x34')]=_0x184628['attributes'][_0xa576('0x35')]?_0x184628[_0xa576('0x34')]:_0x6e897d[_0xa576('0x32')];if(!_0x27251f['query'][_0xa576('0x36')](_0xa576('0x37'))){_0x184628[_0xa576('0x1c')]=qs[_0xa576('0x1c')](_0x27251f[_0xa576('0x2e')]['limit']);_0x184628[_0xa576('0x19')]=qs[_0xa576('0x19')](_0x27251f['query'][_0xa576('0x19')]);}_0x184628[_0xa576('0x38')]=qs['sort'](_0x27251f[_0xa576('0x2e')]['sort']);_0x184628[_0xa576('0x39')]=qs['filters'](_[_0xa576('0x3a')](_0x27251f['query'],_0x6e897d[_0xa576('0x30')]),_0x1cf82e);if(_0x27251f[_0xa576('0x2e')]['filter']){_0x184628[_0xa576('0x39')]=_['merge'](_0x184628[_0xa576('0x39')],{'$or':_[_0xa576('0x2d')](_0x1cf82e,function(_0x2963ee){if(_0x2963ee[_0xa576('0x2b')]!=='VIRTUAL'){var _0x1d3f24={};_0x1d3f24[_0x2963ee['name']]={'$like':'%'+_0x27251f['query']['filter']+'%'};return _0x1d3f24;}})});}_0x184628=_[_0xa576('0x3b')]({},_0x184628,_0x27251f[_0xa576('0x3c')]);var _0x4f861a={'where':_0x184628[_0xa576('0x39')]};return db[_0xa576('0x3d')][_0xa576('0x1b')](_0x4f861a)[_0xa576('0x22')](function(_0x2d990e){_0x3fb993[_0xa576('0x1b')]=_0x2d990e;if(_0x27251f['query'][_0xa576('0x3e')]){_0x184628[_0xa576('0x3f')]=[{'all':!![]}];}return db[_0xa576('0x3d')]['findAll'](_0x184628);})[_0xa576('0x22')](function(_0x27b05e){_0x3fb993[_0xa576('0x40')]=_0x27b05e;return _0x3fb993;})[_0xa576('0x22')](respondWithFilteredResult(_0x3556ba,_0x184628))[_0xa576('0x41')](handleError(_0x3556ba,null));};exports[_0xa576('0x42')]=function(_0x289c25,_0x5e46af){var _0x2a4c40={'raw':![],'where':{'id':_0x289c25[_0xa576('0x43')]['id']}},_0x2355a5={};_0x2355a5[_0xa576('0x32')]=_[_0xa576('0x2f')](db[_0xa576('0x3d')][_0xa576('0x29')]);_0x2355a5[_0xa576('0x2e')]=_[_0xa576('0x2f')](_0x289c25[_0xa576('0x2e')]);_0x2355a5[_0xa576('0x30')]=_[_0xa576('0x31')](_0x2355a5['model'],_0x2355a5[_0xa576('0x2e')]);_0x2a4c40[_0xa576('0x34')]=_[_0xa576('0x31')](_0x2355a5['model'],qs[_0xa576('0x33')](_0x289c25[_0xa576('0x2e')][_0xa576('0x33')]));_0x2a4c40['attributes']=_0x2a4c40[_0xa576('0x34')][_0xa576('0x35')]?_0x2a4c40['attributes']:_0x2355a5['model'];if(_0x289c25['query'][_0xa576('0x3e')]){_0x2a4c40['include']=[{'all':!![]}];}_0x2a4c40=_['merge']({},_0x2a4c40,_0x289c25[_0xa576('0x3c')]);return db[_0xa576('0x3d')][_0xa576('0x44')](_0x2a4c40)['then'](handleEntityNotFound(_0x5e46af,null))[_0xa576('0x22')](respondWithResult(_0x5e46af,null))[_0xa576('0x41')](handleError(_0x5e46af,null));};exports['create']=function(_0x278cf3,_0x521e5a){return db[_0xa576('0x3d')][_0xa576('0x45')](_0x278cf3[_0xa576('0x46')],{})['then'](function(_0x246adf){var _0x57eef0=_0x278cf3['user'][_0xa576('0x47')]({'plain':!![]});if(!_0x57eef0)throw new Error(_0xa576('0x48'));if(_0x57eef0[_0xa576('0x49')]===_0xa576('0x4a')){var _0x1bfe32=_0x246adf[_0xa576('0x47')]({'plain':!![]});var _0xf83742=_0xa576('0x4b');return db[_0xa576('0x4c')][_0xa576('0x44')]({'where':{'name':_0xf83742,'userProfileId':_0x57eef0[_0xa576('0x4d')]},'raw':!![]})[_0xa576('0x22')](function(_0x327f02){if(_0x327f02&&_0x327f02[_0xa576('0x4e')]===0x0){return db[_0xa576('0x24')][_0xa576('0x45')]({'name':_0x1bfe32[_0xa576('0x26')],'resourceId':_0x1bfe32['id'],'type':_0x327f02['name'],'sectionId':_0x327f02['id']},{})[_0xa576('0x22')](function(){return _0x246adf;});}else{return _0x246adf;}})[_0xa576('0x41')](function(_0x34ed8c){logger['error'](_0xa576('0x4f'),_0x34ed8c);throw _0x34ed8c;});}return _0x246adf;})[_0xa576('0x22')](respondWithResult(_0x521e5a,0xc9))[_0xa576('0x41')](handleError(_0x521e5a,null));};exports['update']=function(_0x12f007,_0x1ba8a){if(_0x12f007['body']['id']){delete _0x12f007[_0xa576('0x46')]['id'];}return db[_0xa576('0x3d')][_0xa576('0x44')]({'where':{'id':_0x12f007['params']['id']}})['then'](handleEntityNotFound(_0x1ba8a,null))[_0xa576('0x22')](saveUpdates(_0x12f007[_0xa576('0x46')],null))[_0xa576('0x22')](respondWithResult(_0x1ba8a,null))[_0xa576('0x41')](handleError(_0x1ba8a,null));};exports[_0xa576('0x23')]=function(_0x28cdf6,_0x21c307){return db['Trigger'][_0xa576('0x44')]({'where':{'id':_0x28cdf6[_0xa576('0x43')]['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x21c307,null))[_0xa576('0x22')](removeEntity(_0x21c307,null))['catch'](handleError(_0x21c307,null));};exports[_0xa576('0x50')]=function(_0x1e05d7,_0x403b0d,_0x509c16){if(_0x1e05d7[_0xa576('0x46')]['id']){delete _0x1e05d7['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x1e05d7[_0xa576('0x43')]['id']}})['then'](handleEntityNotFound(_0x403b0d,null))['then'](function(_0x477efc){if(_0x477efc){_0x1e05d7[_0xa576('0x46')]['TriggerAllId']=_0x477efc['id'];return db['Condition'][_0xa576('0x45')](_0x1e05d7[_0xa576('0x46')]);}})[_0xa576('0x22')](respondWithResult(_0x403b0d,null))[_0xa576('0x41')](handleError(_0x403b0d,null));};exports[_0xa576('0x51')]=function(_0xc13738,_0x306cdc,_0x6075af){if(_0xc13738[_0xa576('0x46')]['id']){delete _0xc13738[_0xa576('0x46')]['id'];}return db[_0xa576('0x3d')][_0xa576('0x44')]({'where':{'id':_0xc13738['params']['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x306cdc,null))[_0xa576('0x22')](function(_0x1adb07){if(_0x1adb07){_0xc13738[_0xa576('0x46')][_0xa576('0x52')]=_0x1adb07['id'];return db[_0xa576('0x53')]['create'](_0xc13738['body']);}})[_0xa576('0x22')](respondWithResult(_0x306cdc,null))[_0xa576('0x41')](handleError(_0x306cdc,null));};exports[_0xa576('0x54')]=function(_0xeea1c1,_0x2a62d2,_0x5ee8b5){var _0xde13d5={};var _0x38daa5={};var _0x14769a;var _0x5e29c8;return db[_0xa576('0x3d')]['findOne']({'where':{'id':_0xeea1c1[_0xa576('0x43')]['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x2a62d2,null))[_0xa576('0x22')](function(_0x14afa4){if(_0x14afa4){_0x14769a=_0x14afa4;_0x38daa5['model']=_[_0xa576('0x2f')](db[_0xa576('0x53')][_0xa576('0x29')]);_0x38daa5[_0xa576('0x2e')]=_[_0xa576('0x2f')](_0xeea1c1['query']);_0x38daa5['filters']=_[_0xa576('0x31')](_0x38daa5[_0xa576('0x32')],_0x38daa5[_0xa576('0x2e')]);_0xde13d5[_0xa576('0x34')]=_[_0xa576('0x31')](_0x38daa5[_0xa576('0x32')],qs[_0xa576('0x33')](_0xeea1c1[_0xa576('0x2e')]['fields']));_0xde13d5[_0xa576('0x34')]=_0xde13d5[_0xa576('0x34')]['length']?_0xde13d5[_0xa576('0x34')]:_0x38daa5[_0xa576('0x32')];_0xde13d5[_0xa576('0x38')]=qs['sort'](_0xeea1c1['query'][_0xa576('0x55')]);_0xde13d5[_0xa576('0x39')]=qs[_0xa576('0x30')](_[_0xa576('0x3a')](_0xeea1c1[_0xa576('0x2e')],_0x38daa5['filters']));if(_0xeea1c1['query'][_0xa576('0x56')]){_0xde13d5[_0xa576('0x39')]=_[_0xa576('0x3b')](_0xde13d5['where'],{'$or':_[_0xa576('0x2d')](_0xde13d5[_0xa576('0x34')],function(_0x5b9b12){var _0x831f14={};_0x831f14[_0x5b9b12]={'$like':'%'+_0xeea1c1['query'][_0xa576('0x56')]+'%'};return _0x831f14;})});}_0xde13d5=_[_0xa576('0x3b')]({},_0xde13d5,_0xeea1c1[_0xa576('0x3c')]);return _0x14769a[_0xa576('0x54')](_0xde13d5);}})[_0xa576('0x22')](function(_0x335d16){if(_0x335d16){_0x5e29c8=_0x335d16[_0xa576('0x35')];if(!_0xeea1c1[_0xa576('0x2e')][_0xa576('0x36')](_0xa576('0x37'))){_0xde13d5['limit']=qs[_0xa576('0x1c')](_0xeea1c1[_0xa576('0x2e')]['limit']);_0xde13d5[_0xa576('0x19')]=qs[_0xa576('0x19')](_0xeea1c1[_0xa576('0x2e')]['offset']);}return _0x14769a[_0xa576('0x54')](_0xde13d5);}})['then'](function(_0x45d534){if(_0x45d534){return _0x45d534?{'count':_0x5e29c8,'rows':_0x45d534}:null;}})['then'](respondWithResult(_0x2a62d2,null))[_0xa576('0x41')](handleError(_0x2a62d2,null));};exports[_0xa576('0x57')]=function(_0x3c427a,_0x21c36f,_0x161ec3){var _0x267c2b={};var _0x32d149={};var _0xe8408b;var _0x54145a;return db['Trigger'][_0xa576('0x58')]({'where':{'id':_0x3c427a['params']['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x21c36f,null))[_0xa576('0x22')](function(_0x5008ab){if(_0x5008ab){_0xe8408b=_0x5008ab;_0x32d149[_0xa576('0x32')]=_['keys'](db[_0xa576('0x53')][_0xa576('0x29')]);_0x32d149['query']=_[_0xa576('0x2f')](_0x3c427a[_0xa576('0x2e')]);_0x32d149[_0xa576('0x30')]=_[_0xa576('0x31')](_0x32d149[_0xa576('0x32')],_0x32d149[_0xa576('0x2e')]);_0x267c2b['attributes']=_[_0xa576('0x31')](_0x32d149[_0xa576('0x32')],qs[_0xa576('0x33')](_0x3c427a[_0xa576('0x2e')][_0xa576('0x33')]));_0x267c2b['attributes']=_0x267c2b[_0xa576('0x34')][_0xa576('0x35')]?_0x267c2b[_0xa576('0x34')]:_0x32d149[_0xa576('0x32')];_0x267c2b['order']=qs[_0xa576('0x55')](_0x3c427a['query'][_0xa576('0x55')]);_0x267c2b[_0xa576('0x39')]=qs[_0xa576('0x30')](_[_0xa576('0x3a')](_0x3c427a[_0xa576('0x2e')],_0x32d149[_0xa576('0x30')]));if(_0x3c427a[_0xa576('0x2e')]['filter']){_0x267c2b[_0xa576('0x39')]=_[_0xa576('0x3b')](_0x267c2b['where'],{'$or':_[_0xa576('0x2d')](_0x267c2b['attributes'],function(_0x49a97c){var _0x25b5a4={};_0x25b5a4[_0x49a97c]={'$like':'%'+_0x3c427a[_0xa576('0x2e')][_0xa576('0x56')]+'%'};return _0x25b5a4;})});}_0x267c2b=_[_0xa576('0x3b')]({},_0x267c2b,_0x3c427a['options']);return _0xe8408b['getAnyConditions'](_0x267c2b);}})[_0xa576('0x22')](function(_0x2d3432){if(_0x2d3432){_0x54145a=_0x2d3432[_0xa576('0x35')];if(!_0x3c427a[_0xa576('0x2e')]['hasOwnProperty'](_0xa576('0x37'))){_0x267c2b[_0xa576('0x1c')]=qs[_0xa576('0x1c')](_0x3c427a['query'][_0xa576('0x1c')]);_0x267c2b[_0xa576('0x19')]=qs['offset'](_0x3c427a['query']['offset']);}return _0xe8408b[_0xa576('0x57')](_0x267c2b);}})[_0xa576('0x22')](function(_0x20ec04){if(_0x20ec04){return _0x20ec04?{'count':_0x54145a,'rows':_0x20ec04}:null;}})[_0xa576('0x22')](respondWithResult(_0x21c36f,null))[_0xa576('0x41')](handleError(_0x21c36f,null));};exports[_0xa576('0x59')]=function(_0x514929,_0x2a930f,_0x2a5f70){if(_0x514929[_0xa576('0x46')]['id']){delete _0x514929['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x514929[_0xa576('0x43')]['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x2a930f,null))[_0xa576('0x22')](function(_0x102f0b){if(_0x102f0b){_0x514929[_0xa576('0x46')]['TriggerId']=_0x102f0b['id'];return db[_0xa576('0x5a')][_0xa576('0x45')](_0x514929['body']);}})[_0xa576('0x22')](respondWithResult(_0x2a930f,null))[_0xa576('0x41')](handleError(_0x2a930f,null));};exports['getActions']=function(_0x3eadd7,_0x5e19b2,_0x4f73d3){var _0x44c07e={};var _0x1f1337={};var _0x3d934b;var _0x1e8352;return db['Trigger'][_0xa576('0x58')]({'where':{'id':_0x3eadd7[_0xa576('0x43')]['id']}})[_0xa576('0x22')](handleEntityNotFound(_0x5e19b2,null))['then'](function(_0x1313fb){if(_0x1313fb){_0x3d934b=_0x1313fb;_0x1f1337['model']=_[_0xa576('0x2f')](db[_0xa576('0x5a')][_0xa576('0x29')]);_0x1f1337[_0xa576('0x2e')]=_[_0xa576('0x2f')](_0x3eadd7['query']);_0x1f1337['filters']=_[_0xa576('0x31')](_0x1f1337[_0xa576('0x32')],_0x1f1337[_0xa576('0x2e')]);_0x44c07e[_0xa576('0x34')]=_[_0xa576('0x31')](_0x1f1337[_0xa576('0x32')],qs['fields'](_0x3eadd7['query'][_0xa576('0x33')]));_0x44c07e[_0xa576('0x34')]=_0x44c07e[_0xa576('0x34')][_0xa576('0x35')]?_0x44c07e[_0xa576('0x34')]:_0x1f1337[_0xa576('0x32')];_0x44c07e[_0xa576('0x38')]=qs[_0xa576('0x55')](_0x3eadd7[_0xa576('0x2e')]['sort']);_0x44c07e[_0xa576('0x39')]=qs[_0xa576('0x30')](_[_0xa576('0x3a')](_0x3eadd7[_0xa576('0x2e')],_0x1f1337[_0xa576('0x30')]));if(_0x3eadd7['query'][_0xa576('0x56')]){_0x44c07e[_0xa576('0x39')]=_[_0xa576('0x3b')](_0x44c07e['where'],{'$or':_[_0xa576('0x2d')](_0x44c07e[_0xa576('0x34')],function(_0x57c78){var _0x2a3d6c={};_0x2a3d6c[_0x57c78]={'$like':'%'+_0x3eadd7[_0xa576('0x2e')][_0xa576('0x56')]+'%'};return _0x2a3d6c;})});}_0x44c07e=_[_0xa576('0x3b')]({},_0x44c07e,_0x3eadd7[_0xa576('0x3c')]);return _0x3d934b[_0xa576('0x5b')](_0x44c07e);}})[_0xa576('0x22')](function(_0x3fd077){if(_0x3fd077){_0x1e8352=_0x3fd077[_0xa576('0x35')];if(!_0x3eadd7['query'][_0xa576('0x36')]('nolimit')){_0x44c07e[_0xa576('0x1c')]=qs[_0xa576('0x1c')](_0x3eadd7[_0xa576('0x2e')][_0xa576('0x1c')]);_0x44c07e[_0xa576('0x19')]=qs['offset'](_0x3eadd7[_0xa576('0x2e')][_0xa576('0x19')]);}return _0x3d934b[_0xa576('0x5b')](_0x44c07e);}})[_0xa576('0x22')](function(_0x5408de){if(_0x5408de){return _0x5408de?{'count':_0x1e8352,'rows':_0x5408de}:null;}})['then'](respondWithResult(_0x5e19b2,null))[_0xa576('0x41')](handleError(_0x5e19b2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d74faac..9b67717 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 _0x291c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','Trigger','tools_triggers','lodash'];(function(_0x177298,_0x3e15ed){var _0x5c2be7=function(_0x19810c){while(--_0x19810c){_0x177298['push'](_0x177298['shift']());}};_0x5c2be7(++_0x3e15ed);}(_0x291c,0x137));var _0xc291=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x291c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var logger=require(_0xc291('0x2'))(_0xc291('0x3'));var moment=require(_0xc291('0x4'));var BPromise=require(_0xc291('0x5'));var rp=require(_0xc291('0x6'));var fs=require('fs');var path=require(_0xc291('0x7'));var rimraf=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var attributes=require(_0xc291('0xa'));module['exports']=function(_0x2c96a8,_0x5f2563){return _0x2c96a8['define'](_0xc291('0xb'),attributes,{'tableName':_0xc291('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25ad=['Trigger','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x4d0b67,_0x1e5a0b){var _0x51f564=function(_0x42d2ef){while(--_0x42d2ef){_0x4d0b67['push'](_0x4d0b67['shift']());}};_0x51f564(++_0x1e5a0b);}(_0x25ad,0x1b1));var _0xd25a=function(_0x52f73a,_0x4418dd){_0x52f73a=_0x52f73a-0x0;var _0x4b5d40=_0x25ad[_0x52f73a];return _0x4b5d40;};'use strict';var _=require(_0xd25a('0x0'));var util=require('util');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var moment=require(_0xd25a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require(_0xd25a('0x5'));var rimraf=require(_0xd25a('0x6'));var config=require(_0xd25a('0x7'));var attributes=require(_0xd25a('0x8'));module[_0xd25a('0x9')]=function(_0x544053,_0x4ca0db){return _0x544053[_0xd25a('0xa')](_0xd25a('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index c48a5c6..e9c39eb 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 _0x83ad=['../../config/logger','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','then','catch','ShowTrigger','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2814f8,_0x2baba6){var _0x215f5d=function(_0x5d0c38){while(--_0x5d0c38){_0x2814f8['push'](_0x2814f8['shift']());}};_0x215f5d(++_0x2baba6);}(_0x83ad,0xc1));var _0xd83a=function(_0x51821c,_0x2e39c5){_0x51821c=_0x51821c-0x0;var _0x20bde8=_0x83ad[_0x51821c];return _0x20bde8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd83a('0x0'));var BPromise=require('bluebird');var rs=require(_0xd83a('0x1'));var fs=require('fs');var Redis=require(_0xd83a('0x2'));var db=require(_0xd83a('0x3'))['db'];var utils=require(_0xd83a('0x4'));var logger=require(_0xd83a('0x5'))('rpc');var config=require(_0xd83a('0x6'));var jayson=require(_0xd83a('0x7'));var client=jayson[_0xd83a('0x8')][_0xd83a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa15e,_0x5ab731,_0x582ea8){return new BPromise(function(_0x2a953c,_0x15879e){return client['request'](_0x4fa15e,_0x582ea8)['then'](function(_0x520876){logger[_0xd83a('0xa')](_0xd83a('0xb'),_0x5ab731,_0xd83a('0xc'));logger[_0xd83a('0xd')](_0xd83a('0xe'),_0x5ab731,_0xd83a('0xc'),JSON[_0xd83a('0xf')](_0x520876));if(_0x520876[_0xd83a('0x10')]){if(_0x520876[_0xd83a('0x10')][_0xd83a('0x11')]===0x1f4){logger[_0xd83a('0x10')](_0xd83a('0xb'),_0x5ab731,_0x520876[_0xd83a('0x10')][_0xd83a('0x12')]);return _0x15879e(_0x520876['error'][_0xd83a('0x12')]);}logger[_0xd83a('0x10')](_0xd83a('0xb'),_0x5ab731,_0x520876[_0xd83a('0x10')][_0xd83a('0x12')]);return _0x2a953c(_0x520876[_0xd83a('0x10')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x5ab731,_0xd83a('0xc'));_0x2a953c(_0x520876[_0xd83a('0x13')][_0xd83a('0x12')]);}})['catch'](function(_0x1c2485){logger[_0xd83a('0x10')](_0xd83a('0xb'),_0x5ab731,_0x1c2485);_0x15879e(_0x1c2485);});});}exports[_0xd83a('0x14')]=function(_0x2cf1f2){var _0x2c673b=this;return new Promise(function(_0x310885,_0x2ed339){return db[_0xd83a('0x15')]['findAll']({'raw':_0x2cf1f2[_0xd83a('0x16')]?_0x2cf1f2['options'][_0xd83a('0x17')]===undefined?!![]:![]:!![],'where':_0x2cf1f2[_0xd83a('0x16')]?_0x2cf1f2['options'][_0xd83a('0x18')]||null:null,'attributes':_0x2cf1f2[_0xd83a('0x16')]?_0x2cf1f2[_0xd83a('0x16')][_0xd83a('0x19')]||null:null,'limit':_0x2cf1f2[_0xd83a('0x16')]?_0x2cf1f2[_0xd83a('0x16')]['limit']||null:null,'include':_0x2cf1f2[_0xd83a('0x16')]?_0x2cf1f2[_0xd83a('0x16')][_0xd83a('0x1a')]?_[_0xd83a('0x1b')](_0x2cf1f2[_0xd83a('0x16')]['include'],function(_0x3ea041){return{'model':db[_0x3ea041['model']],'as':_0x3ea041['as'],'attributes':_0x3ea041[_0xd83a('0x19')],'include':_0x3ea041[_0xd83a('0x1a')]?_[_0xd83a('0x1b')](_0x3ea041[_0xd83a('0x1a')],function(_0x3a2d1f){return{'model':db[_0x3a2d1f[_0xd83a('0x1c')]],'as':_0x3a2d1f['as'],'attributes':_0x3a2d1f[_0xd83a('0x19')],'include':_0x3a2d1f[_0xd83a('0x1a')]?_[_0xd83a('0x1b')](_0x3a2d1f['include'],function(_0x565e4c){return{'model':db[_0x565e4c[_0xd83a('0x1c')]],'as':_0x565e4c['as'],'attributes':_0x565e4c[_0xd83a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd83a('0x1d')](function(_0x1465a2){logger['info'](_0xd83a('0x14'),_0x2cf1f2);logger[_0xd83a('0xd')](_0xd83a('0x14'),_0x2cf1f2,JSON['stringify'](_0x1465a2));_0x310885(_0x1465a2);})[_0xd83a('0x1e')](function(_0x267ce8){logger[_0xd83a('0x10')](_0xd83a('0x14'),_0x267ce8['message'],_0x2cf1f2);_0x2ed339(_0x2c673b[_0xd83a('0x10')](0x1f4,_0x267ce8[_0xd83a('0x12')]));});});};exports[_0xd83a('0x1f')]=function(_0x17a2fa){var _0x27604d=this;return new Promise(function(_0x1874f3,_0x215059){return db[_0xd83a('0x15')][_0xd83a('0x20')]({'raw':_0x17a2fa[_0xd83a('0x16')]?_0x17a2fa[_0xd83a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x17a2fa[_0xd83a('0x16')]?_0x17a2fa[_0xd83a('0x16')][_0xd83a('0x18')]||null:null,'attributes':_0x17a2fa[_0xd83a('0x16')]?_0x17a2fa[_0xd83a('0x16')]['attributes']||null:null,'include':_0x17a2fa[_0xd83a('0x16')]?_0x17a2fa['options']['include']?_[_0xd83a('0x1b')](_0x17a2fa[_0xd83a('0x16')][_0xd83a('0x1a')],function(_0x53d4eb){return{'model':db[_0x53d4eb[_0xd83a('0x1c')]],'as':_0x53d4eb['as'],'attributes':_0x53d4eb[_0xd83a('0x19')],'include':_0x53d4eb['include']?_['map'](_0x53d4eb[_0xd83a('0x1a')],function(_0x104b5b){return{'model':db[_0x104b5b['model']],'as':_0x104b5b['as'],'attributes':_0x104b5b[_0xd83a('0x19')],'include':_0x104b5b[_0xd83a('0x1a')]?_[_0xd83a('0x1b')](_0x104b5b[_0xd83a('0x1a')],function(_0x4d674a){return{'model':db[_0x4d674a[_0xd83a('0x1c')]],'as':_0x4d674a['as'],'attributes':_0x4d674a[_0xd83a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd83a('0x1d')](function(_0x596aab){logger[_0xd83a('0xa')](_0xd83a('0x1f'),_0x17a2fa);logger[_0xd83a('0xd')](_0xd83a('0x1f'),_0x17a2fa,JSON[_0xd83a('0xf')](_0x596aab));_0x1874f3(_0x596aab);})[_0xd83a('0x1e')](function(_0x29ea07){logger[_0xd83a('0x10')](_0xd83a('0x1f'),_0x29ea07[_0xd83a('0x12')],_0x17a2fa);_0x215059(_0x27604d[_0xd83a('0x10')](0x1f4,_0x29ea07[_0xd83a('0x12')]));});});}; \ No newline at end of file +var _0x57d0=['findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','ShowTrigger','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger'];(function(_0x38b030,_0xb638a8){var _0x301010=function(_0x1b40ac){while(--_0x1b40ac){_0x38b030['push'](_0x38b030['shift']());}};_0x301010(++_0xb638a8);}(_0x57d0,0x1b9));var _0x057d=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0x57d0[_0x50fda9];return _0x36b92b;};'use strict';var _=require(_0x057d('0x0'));var util=require('util');var moment=require(_0x057d('0x1'));var BPromise=require(_0x057d('0x2'));var rs=require(_0x057d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x057d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x057d('0x5'))('rpc');var config=require(_0x057d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x057d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x509f80,_0x448ab3,_0x598efc){return new BPromise(function(_0x5831e7,_0x5c7939){return client['request'](_0x509f80,_0x598efc)[_0x057d('0x8')](function(_0x428fa4){logger[_0x057d('0x9')](_0x057d('0xa'),_0x448ab3,_0x057d('0xb'));logger[_0x057d('0xc')](_0x057d('0xd'),_0x448ab3,_0x057d('0xb'),JSON[_0x057d('0xe')](_0x428fa4));if(_0x428fa4[_0x057d('0xf')]){if(_0x428fa4['error'][_0x057d('0x10')]===0x1f4){logger['error'](_0x057d('0xa'),_0x448ab3,_0x428fa4[_0x057d('0xf')]['message']);return _0x5c7939(_0x428fa4['error'][_0x057d('0x11')]);}logger[_0x057d('0xf')](_0x057d('0xa'),_0x448ab3,_0x428fa4[_0x057d('0xf')]['message']);return _0x5831e7(_0x428fa4[_0x057d('0xf')]['message']);}else{logger[_0x057d('0x9')]('Trigger,\x20%s,\x20%s',_0x448ab3,'request\x20sent');_0x5831e7(_0x428fa4[_0x057d('0x12')][_0x057d('0x11')]);}})[_0x057d('0x13')](function(_0x3aef05){logger['error'](_0x057d('0xa'),_0x448ab3,_0x3aef05);_0x5c7939(_0x3aef05);});});}exports['GetTrigger']=function(_0x509bfe){var _0x210cf1=this;return new Promise(function(_0x72f97,_0x4dc94e){return db[_0x057d('0x14')][_0x057d('0x15')]({'raw':_0x509bfe[_0x057d('0x16')]?_0x509bfe[_0x057d('0x16')][_0x057d('0x17')]===undefined?!![]:![]:!![],'where':_0x509bfe['options']?_0x509bfe[_0x057d('0x16')][_0x057d('0x18')]||null:null,'attributes':_0x509bfe['options']?_0x509bfe['options'][_0x057d('0x19')]||null:null,'limit':_0x509bfe['options']?_0x509bfe[_0x057d('0x16')][_0x057d('0x1a')]||null:null,'include':_0x509bfe['options']?_0x509bfe[_0x057d('0x16')][_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x509bfe[_0x057d('0x16')]['include'],function(_0x191584){return{'model':db[_0x191584['model']],'as':_0x191584['as'],'attributes':_0x191584[_0x057d('0x19')],'include':_0x191584[_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x191584[_0x057d('0x1b')],function(_0xf88b05){return{'model':db[_0xf88b05[_0x057d('0x1d')]],'as':_0xf88b05['as'],'attributes':_0xf88b05['attributes'],'include':_0xf88b05[_0x057d('0x1b')]?_[_0x057d('0x1c')](_0xf88b05['include'],function(_0x1c008c){return{'model':db[_0x1c008c[_0x057d('0x1d')]],'as':_0x1c008c['as'],'attributes':_0x1c008c[_0x057d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x057d('0x8')](function(_0x2be68f){logger[_0x057d('0x9')]('GetTrigger',_0x509bfe);logger[_0x057d('0xc')]('GetTrigger',_0x509bfe,JSON[_0x057d('0xe')](_0x2be68f));_0x72f97(_0x2be68f);})[_0x057d('0x13')](function(_0x20f35b){logger[_0x057d('0xf')](_0x057d('0x1e'),_0x20f35b[_0x057d('0x11')],_0x509bfe);_0x4dc94e(_0x210cf1[_0x057d('0xf')](0x1f4,_0x20f35b['message']));});});};exports[_0x057d('0x1f')]=function(_0x33fbf0){var _0x47df55=this;return new Promise(function(_0x5a163b,_0x573f35){return db[_0x057d('0x14')][_0x057d('0x20')]({'raw':_0x33fbf0[_0x057d('0x16')]?_0x33fbf0[_0x057d('0x16')][_0x057d('0x17')]===undefined?!![]:![]:!![],'where':_0x33fbf0['options']?_0x33fbf0['options']['where']||null:null,'attributes':_0x33fbf0[_0x057d('0x16')]?_0x33fbf0[_0x057d('0x16')][_0x057d('0x19')]||null:null,'include':_0x33fbf0['options']?_0x33fbf0[_0x057d('0x16')][_0x057d('0x1b')]?_['map'](_0x33fbf0[_0x057d('0x16')][_0x057d('0x1b')],function(_0x2caaab){return{'model':db[_0x2caaab[_0x057d('0x1d')]],'as':_0x2caaab['as'],'attributes':_0x2caaab[_0x057d('0x19')],'include':_0x2caaab[_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x2caaab['include'],function(_0x3f9b0f){return{'model':db[_0x3f9b0f[_0x057d('0x1d')]],'as':_0x3f9b0f['as'],'attributes':_0x3f9b0f['attributes'],'include':_0x3f9b0f['include']?_['map'](_0x3f9b0f['include'],function(_0x2e0971){return{'model':db[_0x2e0971[_0x057d('0x1d')]],'as':_0x2e0971['as'],'attributes':_0x2e0971[_0x057d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x057d('0x8')](function(_0x25321e){logger[_0x057d('0x9')]('ShowTrigger',_0x33fbf0);logger[_0x057d('0xc')](_0x057d('0x1f'),_0x33fbf0,JSON[_0x057d('0xe')](_0x25321e));_0x5a163b(_0x25321e);})['catch'](function(_0x2ec904){logger[_0x057d('0xf')](_0x057d('0x1f'),_0x2ec904[_0x057d('0x11')],_0x33fbf0);_0x573f35(_0x47df55[_0x057d('0xf')](0x1f4,_0x2ec904[_0x057d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index c35c347..8af8c7a 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 _0x37ed=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','/:id','show','/:id/clone','clone'];(function(_0x44db2a,_0x576440){var _0x4048e5=function(_0x23adfd){while(--_0x23adfd){_0x44db2a['push'](_0x44db2a['shift']());}};_0x4048e5(++_0x576440);}(_0x37ed,0x7e));var _0xd37e=function(_0x14e57c,_0x5741dd){_0x14e57c=_0x14e57c-0x0;var _0x162915=_0x37ed[_0x14e57c];return _0x162915;};'use strict';var multer=require('multer');var util=require(_0xd37e('0x0'));var path=require(_0xd37e('0x1'));var timeout=require(_0xd37e('0x2'));var express=require(_0xd37e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd37e('0x4'));var interaction=require(_0xd37e('0x5'));var config=require(_0xd37e('0x6'));var controller=require(_0xd37e('0x7'));router['get']('/',auth[_0xd37e('0x8')](),controller[_0xd37e('0x9')]);router['get'](_0xd37e('0xa'),auth[_0xd37e('0x8')](),controller[_0xd37e('0xb')]);router['post'](_0xd37e('0xc'),auth['isAuthenticated'](),controller[_0xd37e('0xd')]);router[_0xd37e('0xe')]('/',auth[_0xd37e('0x8')](),controller[_0xd37e('0xf')]);router[_0xd37e('0x10')]('/:id',auth[_0xd37e('0x8')](),controller[_0xd37e('0x11')]);router[_0xd37e('0x12')](_0xd37e('0xa'),auth[_0xd37e('0x8')](),controller[_0xd37e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa939=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./trunk.controller','index','get','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','delete','destroy','exports'];(function(_0x380d32,_0x28c493){var _0x10fcdd=function(_0x3dadf4){while(--_0x3dadf4){_0x380d32['push'](_0x380d32['shift']());}};_0x10fcdd(++_0x28c493);}(_0xa939,0x118));var _0x9a93=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa939[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x9a93('0x0'));var util=require(_0x9a93('0x1'));var path=require('path');var timeout=require(_0x9a93('0x2'));var express=require(_0x9a93('0x3'));var router=express['Router']();var fs_extra=require(_0x9a93('0x4'));var auth=require(_0x9a93('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a93('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a93('0x7')]);router[_0x9a93('0x8')](_0x9a93('0x9'),auth[_0x9a93('0xa')](),controller[_0x9a93('0xb')]);router[_0x9a93('0xc')](_0x9a93('0xd'),auth[_0x9a93('0xa')](),controller['clone']);router[_0x9a93('0xc')]('/',auth[_0x9a93('0xa')](),controller[_0x9a93('0xe')]);router[_0x9a93('0xf')](_0x9a93('0x9'),auth[_0x9a93('0xa')](),controller[_0x9a93('0x10')]);router[_0x9a93('0x11')]('/:id',auth[_0x9a93('0xa')](),controller[_0x9a93('0x12')]);module[_0x9a93('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ba472e3..d73c3b0 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 _0x8396=['getDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','setDataValue','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia'];(function(_0xfd7fe7,_0x458d6c){var _0x1106c3=function(_0x3263dd){while(--_0x3263dd){_0xfd7fe7['push'](_0xfd7fe7['shift']());}};_0x1106c3(++_0x458d6c);}(_0x8396,0x1ee));var _0x6839=function(_0x35951d,_0x367aa0){_0x35951d=_0x35951d-0x0;var _0x31060f=_0x8396[_0x35951d];return _0x31060f;};'use strict';var Sequelize=require(_0x6839('0x0'));module[_0x6839('0x1')]={'name':{'type':Sequelize[_0x6839('0x2')],'allowNull':![],'unique':_0x6839('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x5'),'user',_0x6839('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6839('0x2')],'allowNull':![],'defaultValue':_0x6839('0x7')},'callingpres':{'type':Sequelize[_0x6839('0x4')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x6839('0x8'),_0x6839('0x9'),_0x6839('0xa'),'PROHIB_PASSED_SCREEN',_0x6839('0xb'),_0x6839('0xc'))},'deny':{'type':Sequelize[_0x6839('0x2')]},'permit':{'type':Sequelize[_0x6839('0x2')]},'secret':{'type':Sequelize[_0x6839('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x6839('0x2')]},'transport':{'type':Sequelize[_0x6839('0x2')],'defaultValue':_0x6839('0xd'),'set':function(_0x3905e7){this['setDataValue'](_0x6839('0xe'),_0x3905e7?_0x3905e7[_0x6839('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x6839('0xe'))?this['getDataValue']('transport')[_0x6839('0x10')](','):null;},'comment':_0x6839('0x11')},'dtmfmode':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x12'),'info',_0x6839('0x13'),_0x6839('0x14'),_0x6839('0x15')),'defaultValue':_0x6839('0x12')},'directmedia':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no','nonat',_0x6839('0x17'),_0x6839('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6839('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x6839('0x2')],'defaultValue':_0x6839('0x19'),'set':function(_0x195cf4){this['setDataValue']('nat',_0x195cf4?_0x195cf4[_0x6839('0xf')](','):null);},'get':function(){return this[_0x6839('0x1a')](_0x6839('0x1b'))?this[_0x6839('0x1a')](_0x6839('0x1b'))[_0x6839('0x10')](','):null;},'comment':_0x6839('0x1c')},'callgroup':{'type':Sequelize[_0x6839('0x2')]},'namedcallgroup':{'type':Sequelize[_0x6839('0x2')]},'pickupgroup':{'type':Sequelize[_0x6839('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6839('0x2')]},'language':{'type':Sequelize[_0x6839('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6839('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6839('0x2')],'defaultValue':_0x6839('0x1d')},'allow':{'type':Sequelize[_0x6839('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x49c726){this[_0x6839('0x1e')](_0x6839('0x1f'),_0x49c726?_0x49c726[_0x6839('0xf')](';'):_0x6839('0x20'));},'get':function(){return this[_0x6839('0x1a')]('allow')?this[_0x6839('0x1a')](_0x6839('0x1f'))['split'](';'):null;},'comment':_0x6839('0x21')},'autoframing':{'type':Sequelize[_0x6839('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x6839('0x2')],'defaultValue':'port,invite','set':function(_0x80c6e8){this[_0x6839('0x1e')](_0x6839('0x22'),_0x80c6e8?_0x80c6e8['join'](','):null);},'get':function(){return this[_0x6839('0x1a')](_0x6839('0x22'))?this['getDataValue'](_0x6839('0x22'))[_0x6839('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6839('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6839('0x4')]('yes','no',_0x6839('0x23'))},'promiscredir':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'accountcode':{'type':Sequelize[_0x6839('0x24')](0xb)},'setvar':{'type':Sequelize[_0x6839('0x2')]},'callerid':{'type':Sequelize[_0x6839('0x2')],'defaultValue':_0x6839('0x25')},'amaflags':{'type':Sequelize[_0x6839('0x2')]},'callcounter':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':_0x6839('0x16')},'busylevel':{'type':Sequelize[_0x6839('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x6839('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x6839('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6839('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6839('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6839('0x16'),'no')},'mailbox':{'type':Sequelize[_0x6839('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x6839('0x26'),_0x6839('0x27'),_0x6839('0x28'))},'session_expires':{'type':Sequelize[_0x6839('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x29'),_0x6839('0x2a')),'defaultValue':_0x6839('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x6839('0x2')]},'regexten':{'type':Sequelize[_0x6839('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6839('0x24')](0x5)},'qualify':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':_0x6839('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x6839('0x2')]},'rtptimeout':{'type':Sequelize[_0x6839('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6839('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no',_0x6839('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6839('0x2')]},'callbackextension':{'type':Sequelize[_0x6839('0x2')]},'timert1':{'type':Sequelize[_0x6839('0x24')](0xb)},'timerb':{'type':Sequelize[_0x6839('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x6839('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x6839('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6839('0x24')](0xb)},'encryption':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'force_avp':{'type':Sequelize[_0x6839('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x6839('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no',_0x6839('0x2c'),_0x6839('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x6839('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6839('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x6839('0x2')]},'dtlscipher':{'type':Sequelize[_0x6839('0x2')]},'dtlscafile':{'type':Sequelize[_0x6839('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x2e'),_0x6839('0x2f'),_0x6839('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6839('0x2')]},'usereqphone':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6839('0x2')]},'recordofffeature':{'type':Sequelize[_0x6839('0x2')]},'call_limit':{'type':Sequelize[_0x6839('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x6839('0x4')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x6839('0x2')]},'parkinglot':{'type':Sequelize[_0x6839('0x2')]},'description':{'type':Sequelize[_0x6839('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x6839('0x31')},'canreinvite':{'type':Sequelize[_0x6839('0x4')](_0x6839('0x16'),'no','nonat',_0x6839('0x17'),_0x6839('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6839('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x6839('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6839('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6322=['insecure','INTEGER','always','accept','originate','uac','uas','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','nonat','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x43e2ed,_0x57eac1){var _0x3156cd=function(_0x1eb3dc){while(--_0x1eb3dc){_0x43e2ed['push'](_0x43e2ed['shift']());}};_0x3156cd(++_0x57eac1);}(_0x6322,0x9f));var _0x2632=function(_0x4e0d4d,_0x1051f7){_0x4e0d4d=_0x4e0d4d-0x0;var _0x5b6e06=_0x6322[_0x4e0d4d];return _0x5b6e06;};'use strict';var Sequelize=require('sequelize');module[_0x2632('0x0')]={'name':{'type':Sequelize[_0x2632('0x1')],'allowNull':![],'unique':_0x2632('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x4'),'user',_0x2632('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2632('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x2632('0x7'),_0x2632('0x8'),_0x2632('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0x2632('0xa'),_0x2632('0xb'),_0x2632('0xc'))},'deny':{'type':Sequelize[_0x2632('0x1')]},'permit':{'type':Sequelize[_0x2632('0x1')]},'secret':{'type':Sequelize[_0x2632('0x1')]},'md5secret':{'type':Sequelize[_0x2632('0x1')]},'remotesecret':{'type':Sequelize[_0x2632('0x1')]},'transport':{'type':Sequelize[_0x2632('0x1')],'defaultValue':'udp','set':function(_0x3a2c89){this[_0x2632('0xd')]('transport',_0x3a2c89?_0x3a2c89[_0x2632('0xe')](','):null);},'get':function(){return this[_0x2632('0xf')](_0x2632('0x10'))?this[_0x2632('0xf')]('transport')[_0x2632('0x11')](','):null;},'comment':_0x2632('0x12')},'dtmfmode':{'type':Sequelize[_0x2632('0x3')]('rfc2833',_0x2632('0x13'),_0x2632('0x14'),_0x2632('0x15'),_0x2632('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2632('0x17'),'update',_0x2632('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2632('0x1')]},'directmediadeny':{'type':Sequelize[_0x2632('0x1')]},'nat':{'type':Sequelize[_0x2632('0x1')],'defaultValue':_0x2632('0x1a'),'set':function(_0x459fe5){this['setDataValue'](_0x2632('0x1b'),_0x459fe5?_0x459fe5[_0x2632('0xe')](','):null);},'get':function(){return this[_0x2632('0xf')](_0x2632('0x1b'))?this[_0x2632('0xf')](_0x2632('0x1b'))['split'](','):null;},'comment':_0x2632('0x1c')},'callgroup':{'type':Sequelize[_0x2632('0x1')]},'namedcallgroup':{'type':Sequelize[_0x2632('0x1')]},'pickupgroup':{'type':Sequelize[_0x2632('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x2632('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2632('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2632('0x1')],'defaultValue':_0x2632('0x1d')},'allow':{'type':Sequelize[_0x2632('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x9588e5){this[_0x2632('0xd')](_0x2632('0x1e'),_0x9588e5?_0x9588e5[_0x2632('0xe')](';'):_0x2632('0x1f'));},'get':function(){return this[_0x2632('0xf')](_0x2632('0x1e'))?this[_0x2632('0xf')](_0x2632('0x1e'))[_0x2632('0x11')](';'):null;},'comment':_0x2632('0x20')},'autoframing':{'type':Sequelize[_0x2632('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x2632('0x1')],'defaultValue':'port,invite','set':function(_0x375342){this[_0x2632('0xd')](_0x2632('0x21'),_0x375342?_0x375342[_0x2632('0xe')](','):null);},'get':function(){return this[_0x2632('0xf')](_0x2632('0x21'))?this['getDataValue'](_0x2632('0x21'))[_0x2632('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x2632('0x3')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2632('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2632('0x3')]('yes','no'),'defaultValue':_0x2632('0x19')},'busylevel':{'type':Sequelize[_0x2632('0x22')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2632('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x2632('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x2632('0x19'),'no',_0x2632('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2632('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2632('0x1')]},'session_timers':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x24'),'refuse',_0x2632('0x25'))},'session_expires':{'type':Sequelize[_0x2632('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x2632('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x26'),_0x2632('0x27')),'defaultValue':_0x2632('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x2632('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2632('0x1')]},'fromuser':{'type':Sequelize[_0x2632('0x1')]},'port':{'type':Sequelize[_0x2632('0x22')](0x5)},'qualify':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no'),'defaultValue':_0x2632('0x19')},'keepalive':{'type':Sequelize[_0x2632('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2632('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2632('0x1')]},'callbackextension':{'type':Sequelize[_0x2632('0x1')]},'timert1':{'type':Sequelize[_0x2632('0x22')](0xb)},'timerb':{'type':Sequelize[_0x2632('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2632('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x2632('0x1')]},'contactdeny':{'type':Sequelize[_0x2632('0x1')]},'contactacl':{'type':Sequelize[_0x2632('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2632('0x22')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x2632('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'force_avp':{'type':Sequelize[_0x2632('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2632('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x2632('0x19'),'no','fingerprint',_0x2632('0x28'))},'dtlsrekey':{'type':Sequelize[_0x2632('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2632('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2632('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x29'),_0x2632('0x2a'),_0x2632('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2632('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2632('0x1')]},'recordofffeature':{'type':Sequelize[_0x2632('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x2632('0x3')](_0x2632('0x19'),'no')},'vmexten':{'type':Sequelize[_0x2632('0x1')]},'mohinterpret':{'type':Sequelize[_0x2632('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2632('0x1')]},'description':{'type':Sequelize[_0x2632('0x1')]},'host':{'type':Sequelize[_0x2632('0x1')],'defaultValue':_0x2632('0x2c')},'canreinvite':{'type':Sequelize[_0x2632('0x3')]('yes','no','nonat',_0x2632('0x2d'),_0x2632('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2632('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2632('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2632('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index cf62212..346b440 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x1fc356,_0x5de529){var _0x4b5c33=function(_0x44b215){while(--_0x44b215){_0x1fc356['push'](_0x1fc356['shift']());}};_0x4b5c33(++_0x5de529);}(_0xb821,0xa7));var _0x1b82=function(_0x46d12e,_0x492362){_0x46d12e=_0x46d12e-0x0;var _0x31d528=_0xb821[_0x46d12e];return _0x31d528;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x361ef5,_0x309214){var _0x271a93=function(_0x1d846c){while(--_0x1d846c){_0x361ef5['push'](_0x361ef5['shift']());}};_0x271a93(++_0x309214);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x30c67c,_0x39df2c){_0x30c67c=_0x30c67c-0x0;var _0x40ea49=_0x8d0e[_0x30c67c];return _0x40ea49;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 396b8d1..044c902 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 _0x5ac6=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes'];(function(_0x3675d1,_0x56f380){var _0x34c08a=function(_0x4c6b47){while(--_0x4c6b47){_0x3675d1['push'](_0x3675d1['shift']());}};_0x34c08a(++_0x56f380);}(_0x5ac6,0x18c));var _0x65ac=function(_0x41fbac,_0x25c6d2){_0x41fbac=_0x41fbac-0x0;var _0x582a13=_0x5ac6[_0x41fbac];return _0x582a13;};'use strict';var _=require(_0x65ac('0x0'));var util=require(_0x65ac('0x1'));var logger=require(_0x65ac('0x2'))(_0x65ac('0x3'));var moment=require(_0x65ac('0x4'));var BPromise=require(_0x65ac('0x5'));var rp=require(_0x65ac('0x6'));var fs=require('fs');var path=require(_0x65ac('0x7'));var rimraf=require('rimraf');var config=require(_0x65ac('0x8'));var attributes=require(_0x65ac('0x9'));module[_0x65ac('0xa')]=function(_0x25effd,_0x44ddf6){return _0x25effd[_0x65ac('0xb')](_0x65ac('0xc'),attributes,{'tableName':_0x65ac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2999=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_trunks','lodash','util','../../config/logger'];(function(_0x1a2582,_0x26ddb6){var _0x5c8c49=function(_0x21e3ac){while(--_0x21e3ac){_0x1a2582['push'](_0x1a2582['shift']());}};_0x5c8c49(++_0x26ddb6);}(_0x2999,0x8d));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9299('0x0'));var util=require(_0x9299('0x1'));var logger=require(_0x9299('0x2'))(_0x9299('0x3'));var moment=require(_0x9299('0x4'));var BPromise=require(_0x9299('0x5'));var rp=require(_0x9299('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9299('0x7'));var config=require(_0x9299('0x8'));var attributes=require('./trunk.attributes');module[_0x9299('0x9')]=function(_0x57f4d9,_0x3c7c15){return _0x57f4d9[_0x9299('0xa')]('Trunk',attributes,{'tableName':_0x9299('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 6528b58..0b77e46 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 _0x6c2a=['message','result','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','raw','map','ShowTrunk','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d0ff4,_0xd9f484){var _0x51f607=function(_0x4da44d){while(--_0x4da44d){_0x2d0ff4['push'](_0x2d0ff4['shift']());}};_0x51f607(++_0xd9f484);}(_0x6c2a,0x177));var _0xa6c2=function(_0x535be2,_0x5db19c){_0x535be2=_0x535be2-0x0;var _0x14632d=_0x6c2a[_0x535be2];return _0x14632d;};'use strict';var _=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var moment=require(_0xa6c2('0x2'));var BPromise=require(_0xa6c2('0x3'));var rs=require(_0xa6c2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6c2('0x5'))['db'];var utils=require(_0xa6c2('0x6'));var logger=require(_0xa6c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6c2('0x8'));var client=jayson[_0xa6c2('0x9')][_0xa6c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dd946,_0x3bd6dd,_0xb718d3){return new BPromise(function(_0x3b5f49,_0x2e617f){return client[_0xa6c2('0xb')](_0x1dd946,_0xb718d3)[_0xa6c2('0xc')](function(_0x35d297){logger[_0xa6c2('0xd')](_0xa6c2('0xe'),_0x3bd6dd,_0xa6c2('0xf'));logger[_0xa6c2('0x10')](_0xa6c2('0x11'),_0x3bd6dd,_0xa6c2('0xf'),JSON[_0xa6c2('0x12')](_0x35d297));if(_0x35d297[_0xa6c2('0x13')]){if(_0x35d297['error'][_0xa6c2('0x14')]===0x1f4){logger[_0xa6c2('0x13')]('Trunk,\x20%s,\x20%s',_0x3bd6dd,_0x35d297['error'][_0xa6c2('0x15')]);return _0x2e617f(_0x35d297['error'][_0xa6c2('0x15')]);}logger['error'](_0xa6c2('0xe'),_0x3bd6dd,_0x35d297[_0xa6c2('0x13')][_0xa6c2('0x15')]);return _0x3b5f49(_0x35d297['error'][_0xa6c2('0x15')]);}else{logger[_0xa6c2('0xd')](_0xa6c2('0xe'),_0x3bd6dd,_0xa6c2('0xf'));_0x3b5f49(_0x35d297[_0xa6c2('0x16')][_0xa6c2('0x15')]);}})['catch'](function(_0x1093e8){logger['error']('Trunk,\x20%s,\x20%s',_0x3bd6dd,_0x1093e8);_0x2e617f(_0x1093e8);});});}exports[_0xa6c2('0x17')]=function(_0x3d6e74){var _0x5be8b0=this;return new Promise(function(_0x34ff14,_0xe4745){return db[_0xa6c2('0x18')][_0xa6c2('0x19')]({'raw':_0x3d6e74[_0xa6c2('0x1a')]?_0x3d6e74[_0xa6c2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6e74[_0xa6c2('0x1a')]?_0x3d6e74[_0xa6c2('0x1a')][_0xa6c2('0x1b')]||null:null,'attributes':_0x3d6e74[_0xa6c2('0x1a')]?_0x3d6e74['options'][_0xa6c2('0x1c')]||null:null,'limit':_0x3d6e74[_0xa6c2('0x1a')]?_0x3d6e74['options'][_0xa6c2('0x1d')]||null:null,'include':_0x3d6e74[_0xa6c2('0x1a')]?_0x3d6e74[_0xa6c2('0x1a')][_0xa6c2('0x1e')]?_['map'](_0x3d6e74[_0xa6c2('0x1a')][_0xa6c2('0x1e')],function(_0x331685){return{'model':db[_0x331685[_0xa6c2('0x1f')]],'as':_0x331685['as'],'attributes':_0x331685[_0xa6c2('0x1c')],'include':_0x331685['include']?_['map'](_0x331685['include'],function(_0x1ec916){return{'model':db[_0x1ec916[_0xa6c2('0x1f')]],'as':_0x1ec916['as'],'attributes':_0x1ec916['attributes'],'include':_0x1ec916[_0xa6c2('0x1e')]?_['map'](_0x1ec916[_0xa6c2('0x1e')],function(_0x421263){return{'model':db[_0x421263[_0xa6c2('0x1f')]],'as':_0x421263['as'],'attributes':_0x421263[_0xa6c2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa6c2('0xc')](function(_0x2768d8){logger['info'](_0xa6c2('0x17'),_0x3d6e74);logger[_0xa6c2('0x10')](_0xa6c2('0x17'),_0x3d6e74,JSON[_0xa6c2('0x12')](_0x2768d8));_0x34ff14(_0x2768d8);})['catch'](function(_0x3576c0){logger[_0xa6c2('0x13')](_0xa6c2('0x17'),_0x3576c0[_0xa6c2('0x15')],_0x3d6e74);_0xe4745(_0x5be8b0['error'](0x1f4,_0x3576c0[_0xa6c2('0x15')]));});});};exports['ShowTrunk']=function(_0x4ab867){var _0x3b4244=this;return new Promise(function(_0x3b3d41,_0x647e86){return db[_0xa6c2('0x18')]['find']({'raw':_0x4ab867[_0xa6c2('0x1a')]?_0x4ab867[_0xa6c2('0x1a')][_0xa6c2('0x20')]===undefined?!![]:![]:!![],'where':_0x4ab867['options']?_0x4ab867[_0xa6c2('0x1a')]['where']||null:null,'attributes':_0x4ab867[_0xa6c2('0x1a')]?_0x4ab867[_0xa6c2('0x1a')][_0xa6c2('0x1c')]||null:null,'include':_0x4ab867['options']?_0x4ab867[_0xa6c2('0x1a')]['include']?_[_0xa6c2('0x21')](_0x4ab867[_0xa6c2('0x1a')][_0xa6c2('0x1e')],function(_0x2324e1){return{'model':db[_0x2324e1['model']],'as':_0x2324e1['as'],'attributes':_0x2324e1[_0xa6c2('0x1c')],'include':_0x2324e1[_0xa6c2('0x1e')]?_[_0xa6c2('0x21')](_0x2324e1[_0xa6c2('0x1e')],function(_0x549e79){return{'model':db[_0x549e79['model']],'as':_0x549e79['as'],'attributes':_0x549e79['attributes'],'include':_0x549e79[_0xa6c2('0x1e')]?_[_0xa6c2('0x21')](_0x549e79[_0xa6c2('0x1e')],function(_0x221af4){return{'model':db[_0x221af4['model']],'as':_0x221af4['as'],'attributes':_0x221af4[_0xa6c2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa6c2('0xc')](function(_0x3789c1){logger[_0xa6c2('0xd')](_0xa6c2('0x22'),_0x4ab867);logger[_0xa6c2('0x10')]('ShowTrunk',_0x4ab867,JSON[_0xa6c2('0x12')](_0x3789c1));_0x3b3d41(_0x3789c1);})[_0xa6c2('0x23')](function(_0x177e8d){logger[_0xa6c2('0x13')](_0xa6c2('0x22'),_0x177e8d['message'],_0x4ab867);_0x647e86(_0x3b4244[_0xa6c2('0x13')](0x1f4,_0x177e8d[_0xa6c2('0x15')]));});});}; \ No newline at end of file +var _0xea4e=['attributes','include','model','map','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xea4e,0xbf));var _0xeea4=function(_0x4089c7,_0x120195){_0x4089c7=_0x4089c7-0x0;var _0x33dd04=_0xea4e[_0x4089c7];return _0x33dd04;};'use strict';var _=require(_0xeea4('0x0'));var util=require(_0xeea4('0x1'));var moment=require(_0xeea4('0x2'));var BPromise=require(_0xeea4('0x3'));var rs=require(_0xeea4('0x4'));var fs=require('fs');var Redis=require(_0xeea4('0x5'));var db=require(_0xeea4('0x6'))['db'];var utils=require(_0xeea4('0x7'));var logger=require(_0xeea4('0x8'))(_0xeea4('0x9'));var config=require('../../config/environment');var jayson=require(_0xeea4('0xa'));var client=jayson['client'][_0xeea4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c05c1,_0x1ffbce,_0x162a37){return new BPromise(function(_0x22ba79,_0x42354f){return client[_0xeea4('0xc')](_0x5c05c1,_0x162a37)[_0xeea4('0xd')](function(_0x2a2277){logger[_0xeea4('0xe')](_0xeea4('0xf'),_0x1ffbce,_0xeea4('0x10'));logger[_0xeea4('0x11')](_0xeea4('0x12'),_0x1ffbce,_0xeea4('0x10'),JSON[_0xeea4('0x13')](_0x2a2277));if(_0x2a2277[_0xeea4('0x14')]){if(_0x2a2277[_0xeea4('0x14')][_0xeea4('0x15')]===0x1f4){logger['error'](_0xeea4('0xf'),_0x1ffbce,_0x2a2277[_0xeea4('0x14')][_0xeea4('0x16')]);return _0x42354f(_0x2a2277[_0xeea4('0x14')][_0xeea4('0x16')]);}logger[_0xeea4('0x14')](_0xeea4('0xf'),_0x1ffbce,_0x2a2277[_0xeea4('0x14')][_0xeea4('0x16')]);return _0x22ba79(_0x2a2277[_0xeea4('0x14')]['message']);}else{logger[_0xeea4('0xe')](_0xeea4('0xf'),_0x1ffbce,_0xeea4('0x10'));_0x22ba79(_0x2a2277[_0xeea4('0x17')][_0xeea4('0x16')]);}})[_0xeea4('0x18')](function(_0x48916b){logger[_0xeea4('0x14')](_0xeea4('0xf'),_0x1ffbce,_0x48916b);_0x42354f(_0x48916b);});});}exports[_0xeea4('0x19')]=function(_0x195619){var _0x4bcc2f=this;return new Promise(function(_0xa703b3,_0x53dc0a){return db[_0xeea4('0x1a')][_0xeea4('0x1b')]({'raw':_0x195619[_0xeea4('0x1c')]?_0x195619[_0xeea4('0x1c')][_0xeea4('0x1d')]===undefined?!![]:![]:!![],'where':_0x195619[_0xeea4('0x1c')]?_0x195619[_0xeea4('0x1c')][_0xeea4('0x1e')]||null:null,'attributes':_0x195619['options']?_0x195619[_0xeea4('0x1c')][_0xeea4('0x1f')]||null:null,'limit':_0x195619[_0xeea4('0x1c')]?_0x195619[_0xeea4('0x1c')]['limit']||null:null,'include':_0x195619[_0xeea4('0x1c')]?_0x195619[_0xeea4('0x1c')]['include']?_['map'](_0x195619[_0xeea4('0x1c')][_0xeea4('0x20')],function(_0x65c02e){return{'model':db[_0x65c02e[_0xeea4('0x21')]],'as':_0x65c02e['as'],'attributes':_0x65c02e[_0xeea4('0x1f')],'include':_0x65c02e[_0xeea4('0x20')]?_[_0xeea4('0x22')](_0x65c02e[_0xeea4('0x20')],function(_0x27e820){return{'model':db[_0x27e820[_0xeea4('0x21')]],'as':_0x27e820['as'],'attributes':_0x27e820[_0xeea4('0x1f')],'include':_0x27e820[_0xeea4('0x20')]?_[_0xeea4('0x22')](_0x27e820[_0xeea4('0x20')],function(_0x12a85a){return{'model':db[_0x12a85a[_0xeea4('0x21')]],'as':_0x12a85a['as'],'attributes':_0x12a85a[_0xeea4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeea4('0xd')](function(_0x584824){logger[_0xeea4('0xe')](_0xeea4('0x19'),_0x195619);logger['debug'](_0xeea4('0x19'),_0x195619,JSON[_0xeea4('0x13')](_0x584824));_0xa703b3(_0x584824);})[_0xeea4('0x18')](function(_0x52abbd){logger[_0xeea4('0x14')](_0xeea4('0x19'),_0x52abbd['message'],_0x195619);_0x53dc0a(_0x4bcc2f[_0xeea4('0x14')](0x1f4,_0x52abbd[_0xeea4('0x16')]));});});};exports['ShowTrunk']=function(_0x2692d0){var _0x13a894=this;return new Promise(function(_0x57300b,_0x13b206){return db[_0xeea4('0x1a')][_0xeea4('0x23')]({'raw':_0x2692d0[_0xeea4('0x1c')]?_0x2692d0[_0xeea4('0x1c')][_0xeea4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2692d0[_0xeea4('0x1c')]?_0x2692d0[_0xeea4('0x1c')]['where']||null:null,'attributes':_0x2692d0[_0xeea4('0x1c')]?_0x2692d0[_0xeea4('0x1c')][_0xeea4('0x1f')]||null:null,'include':_0x2692d0[_0xeea4('0x1c')]?_0x2692d0[_0xeea4('0x1c')][_0xeea4('0x20')]?_[_0xeea4('0x22')](_0x2692d0[_0xeea4('0x1c')][_0xeea4('0x20')],function(_0xc51458){return{'model':db[_0xc51458[_0xeea4('0x21')]],'as':_0xc51458['as'],'attributes':_0xc51458['attributes'],'include':_0xc51458[_0xeea4('0x20')]?_[_0xeea4('0x22')](_0xc51458[_0xeea4('0x20')],function(_0x223df0){return{'model':db[_0x223df0['model']],'as':_0x223df0['as'],'attributes':_0x223df0[_0xeea4('0x1f')],'include':_0x223df0[_0xeea4('0x20')]?_[_0xeea4('0x22')](_0x223df0[_0xeea4('0x20')],function(_0x34863a){return{'model':db[_0x34863a[_0xeea4('0x21')]],'as':_0x34863a['as'],'attributes':_0x34863a[_0xeea4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeea4('0xd')](function(_0xfe662e){logger[_0xeea4('0xe')](_0xeea4('0x24'),_0x2692d0);logger[_0xeea4('0x11')]('ShowTrunk',_0x2692d0,JSON[_0xeea4('0x13')](_0xfe662e));_0x57300b(_0xfe662e);})[_0xeea4('0x18')](function(_0x3c71cf){logger['error']('ShowTrunk',_0x3c71cf[_0xeea4('0x16')],_0x2692d0);_0x13b206(_0x13a894['error'](0x1f4,_0x3c71cf[_0xeea4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index c01ccad..7b16f6e 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 _0xa816=['/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x2bf50a,_0x249b96){var _0x29f49e=function(_0x42e939){while(--_0x42e939){_0x2bf50a['push'](_0x2bf50a['shift']());}};_0x29f49e(++_0x249b96);}(_0xa816,0x17e));var _0x6a81=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0xa816[_0x58db4e];return _0x40139a;};'use strict';var express=require(_0x6a81('0x0'));var router=express[_0x6a81('0x1')]();var auth=require(_0x6a81('0x2'));var controller=require(_0x6a81('0x3'));router[_0x6a81('0x4')](_0x6a81('0x5'),auth[_0x6a81('0x6')](),controller[_0x6a81('0x7')]);module[_0x6a81('0x8')]=router; \ No newline at end of file +var _0xaa3d=['/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service','put'];(function(_0x4de2c5,_0x21aeb7){var _0x4ef52b=function(_0x5e52f4){while(--_0x5e52f4){_0x4de2c5['push'](_0x4de2c5['shift']());}};_0x4ef52b(++_0x21aeb7);}(_0xaa3d,0x1cc));var _0xdaa3=function(_0x361f50,_0x19aba4){_0x361f50=_0x361f50-0x0;var _0xb0dadc=_0xaa3d[_0x361f50];return _0xb0dadc;};'use strict';var express=require(_0xdaa3('0x0'));var router=express[_0xdaa3('0x1')]();var auth=require(_0xdaa3('0x2'));var controller=require('./user-setting.controller');router[_0xdaa3('0x3')](_0xdaa3('0x4'),auth[_0xdaa3('0x5')](),controller[_0xdaa3('0x6')]);module[_0xdaa3('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 3266a73..e772d36 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 _0xc0a3=['BOOLEAN','TEXT','DATE','INTEGER','UserId','error','warning','info','exports','ENUM'];(function(_0x4a9cc7,_0x17762a){var _0x55b9ba=function(_0x54cc7f){while(--_0x54cc7f){_0x4a9cc7['push'](_0x4a9cc7['shift']());}};_0x55b9ba(++_0x17762a);}(_0xc0a3,0x131));var _0x3c0a=function(_0x2d5403,_0x5cba5b){_0x2d5403=_0x2d5403-0x0;var _0x2cc973=_0xc0a3[_0x2d5403];return _0x2cc973;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x3c0a('0x0'),_0x3c0a('0x1'),_0x3c0a('0x2'),'debug'];module[_0x3c0a('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3c0a('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3c0a('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3c0a('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3c0a('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3c0a('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3c0a('0x8')],'unique':_0x3c0a('0x9')}}; \ No newline at end of file +var _0xbc8f=['ENUM','error','TEXT','DATE','INTEGER','UserId','sequelize','warning','info','debug','exports'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xbc8f,0x12f));var _0xfbc8=function(_0x40bda5,_0x957fae){_0x40bda5=_0x40bda5-0x0;var _0x3bd555=_0xbc8f[_0x40bda5];return _0x3bd555;};'use strict';var Sequelize=require(_0xfbc8('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xfbc8('0x1'),_0xfbc8('0x2'),_0xfbc8('0x3')];module[_0xfbc8('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfbc8('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfbc8('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfbc8('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfbc8('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfbc8('0x9')],'unique':_0xfbc8('0xa')}}; \ 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 4ceefd3..fd59d46 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 _0x0487=['update','then','sendStatus','error','name','send','user','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','defaults','json'];(function(_0x294f3d,_0x1b0f82){var _0x2c8f6c=function(_0x2303e6){while(--_0x2303e6){_0x294f3d['push'](_0x294f3d['shift']());}};_0x2c8f6c(++_0x1b0f82);}(_0x0487,0x14f));var _0x7048=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x0487[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x7048('0x0'));var Redis=require(_0x7048('0x1'));var logger=require(_0x7048('0x2'))(_0x7048('0x3'));var config=require(_0x7048('0x4'));var db=require(_0x7048('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x7048('0x6')]));require('./user-setting.socket')[_0x7048('0x7')](socket);config[_0x7048('0x6')]=_[_0x7048('0x8')](config[_0x7048('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2aaedd,_0x140c84){_0x140c84=_0x140c84||0xc8;return function(_0xf90179){if(_0xf90179){return _0x2aaedd['status'](_0x140c84)[_0x7048('0x9')](_0xf90179);}};}function saveUpdates(_0x5c900b){return function(_0xd4a633){if(_0xd4a633){return _0xd4a633[_0x7048('0xa')](_0x5c900b)[_0x7048('0xb')](function(_0x162940){return _0x162940;});}return null;};}function handleEntityNotFound(_0x118062){return function(_0x477512){if(!_0x477512){_0x118062[_0x7048('0xc')](0x194);}return _0x477512;};}function handleError(_0x50dc0d,_0x2eba6e){_0x2eba6e=_0x2eba6e||0x1f4;return function(_0x164ed9){logger[_0x7048('0xd')](_0x164ed9['stack']);if(_0x164ed9[_0x7048('0xe')]){delete _0x164ed9[_0x7048('0xe')];}_0x50dc0d['status'](_0x2eba6e)[_0x7048('0xf')](_0x164ed9);};}exports[_0x7048('0xa')]=function(_0x30e624,_0x3a016d){if(_0x30e624[_0x7048('0x10')]['role']!==_0x7048('0x11'))throw new Error('Unauthorized');if(isNaN(Number(_0x30e624[_0x7048('0x12')]['id'])))throw new Error(_0x7048('0x13'));return db[_0x7048('0x14')][_0x7048('0x15')]({'where':{'id':_0x30e624['params']['id']}})[_0x7048('0xb')](handleEntityNotFound(_0x3a016d,null))['then'](saveUpdates(_0x30e624[_0x7048('0x16')],null))[_0x7048('0xb')](respondWithResult(_0x3a016d,null))['catch'](handleError(_0x3a016d,null));}; \ No newline at end of file +var _0xa2ab=['ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','then','error','name','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xa2ab,0xa7));var _0xba2a=function(_0x7d7814,_0x224c09){_0x7d7814=_0x7d7814-0x0;var _0x253187=_0xa2ab[_0x7d7814];return _0x253187;};'use strict';var _=require(_0xba2a('0x0'));var Redis=require(_0xba2a('0x1'));var logger=require(_0xba2a('0x2'))('api');var config=require(_0xba2a('0x3'));var db=require(_0xba2a('0x4'))['db'];var socket=require(_0xba2a('0x5'))(new Redis(config[_0xba2a('0x6')]));require(_0xba2a('0x7'))[_0xba2a('0x8')](socket);config[_0xba2a('0x6')]=_['defaults'](config[_0xba2a('0x6')],{'host':_0xba2a('0x9'),'port':0x18eb});function respondWithResult(_0x3eb9f9,_0x4c8719){_0x4c8719=_0x4c8719||0xc8;return function(_0xd09a60){if(_0xd09a60){return _0x3eb9f9[_0xba2a('0xa')](_0x4c8719)[_0xba2a('0xb')](_0xd09a60);}};}function saveUpdates(_0x1efa63){return function(_0x544c13){if(_0x544c13){return _0x544c13[_0xba2a('0xc')](_0x1efa63)[_0xba2a('0xd')](function(_0x2f4d3d){return _0x2f4d3d;});}return null;};}function handleEntityNotFound(_0x3607e2){return function(_0xde4888){if(!_0xde4888){_0x3607e2['sendStatus'](0x194);}return _0xde4888;};}function handleError(_0x463cb9,_0x114fb5){_0x114fb5=_0x114fb5||0x1f4;return function(_0x1ab975){logger[_0xba2a('0xe')](_0x1ab975['stack']);if(_0x1ab975[_0xba2a('0xf')]){delete _0x1ab975[_0xba2a('0xf')];}_0x463cb9[_0xba2a('0xa')](_0x114fb5)[_0xba2a('0x10')](_0x1ab975);};}exports[_0xba2a('0xc')]=function(_0x4d4448,_0x8c98d){if(_0x4d4448[_0xba2a('0x11')][_0xba2a('0x12')]!==_0xba2a('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0x4d4448[_0xba2a('0x14')]['id'])))throw new Error(_0xba2a('0x15'));return db[_0xba2a('0x16')][_0xba2a('0x17')]({'where':{'id':_0x4d4448['params']['id']}})[_0xba2a('0xd')](handleEntityNotFound(_0x8c98d,null))[_0xba2a('0xd')](saveUpdates(_0x4d4448['body'],null))[_0xba2a('0xd')](respondWithResult(_0x8c98d,null))['catch'](handleError(_0x8c98d,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 5694b2e..97391d2 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 _0x680e=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x680e,0x11f));var _0xe680=function(_0x119521,_0x25c32b){_0x119521=_0x119521-0x0;var _0x5ef7af=_0x680e[_0x119521];return _0x5ef7af;};'use strict';var EventEmitter=require(_0xe680('0x0'));var UserSetting=require(_0xe680('0x1'))['db'][_0xe680('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe680('0x3'),'afterUpdate':_0xe680('0x4'),'afterDestroy':_0xe680('0x5')};function emitEvent(_0x334a62){return function(_0x177166,_0xd7df9,_0x1516f4){UserSettingEvents['emit'](_0x334a62+':'+_0x177166['id'],_0x177166);UserSettingEvents[_0xe680('0x6')](_0x334a62,_0x177166);_0x1516f4(null);};}for(var e in events){if(events[_0xe680('0x7')](e)){var event=events[e];UserSetting[_0xe680('0x8')](e,emitEvent(event));}}module[_0xe680('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x70e9=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting'];(function(_0x5645c2,_0x4768ba){var _0x3b741a=function(_0x4c8cc0){while(--_0x4c8cc0){_0x5645c2['push'](_0x5645c2['shift']());}};_0x3b741a(++_0x4768ba);}(_0x70e9,0x18d));var _0x970e=function(_0x1e9b85,_0x2bdc9e){_0x1e9b85=_0x1e9b85-0x0;var _0x1f2986=_0x70e9[_0x1e9b85];return _0x1f2986;};'use strict';var EventEmitter=require(_0x970e('0x0'));var UserSetting=require(_0x970e('0x1'))['db'][_0x970e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x970e('0x3')](0x0);var events={'afterCreate':_0x970e('0x4'),'afterUpdate':_0x970e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2b2580){return function(_0x5a277b,_0x345622,_0x582950){UserSettingEvents[_0x970e('0x6')](_0x2b2580+':'+_0x5a277b['id'],_0x5a277b);UserSettingEvents[_0x970e('0x6')](_0x2b2580,_0x5a277b);_0x582950(null);};}for(var e in events){if(events[_0x970e('0x7')](e)){var event=events[e];UserSetting[_0x970e('0x8')](e,emitEvent(event));}}module[_0x970e('0x9')]=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 d5ead44..c6a77a2 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 _0x4b0f=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define'];(function(_0xc0f6fd,_0x3feeff){var _0x51d8e5=function(_0x55ca91){while(--_0x55ca91){_0xc0f6fd['push'](_0xc0f6fd['shift']());}};_0x51d8e5(++_0x3feeff);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x35906a,_0x9e0b54){_0x35906a=_0x35906a-0x0;var _0x43ba69=_0x4b0f[_0x35906a];return _0x43ba69;};'use strict';var attributes=require('./user-setting.attributes');module[_0xf4b0('0x0')]=function(_0x95169b){return _0x95169b[_0xf4b0('0x1')]('UserSetting',attributes,{'tableName':_0xf4b0('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ead58){if(!_0x2ead58[_0xf4b0('0x3')])_0x2ead58[_0xf4b0('0x4')]=null;else if(_0x2ead58[_0xf4b0('0x4')]===null)_0x2ead58[_0xf4b0('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xe87e=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x499bca,_0x2b2c99){var _0x18f195=function(_0x4fed9c){while(--_0x4fed9c){_0x499bca['push'](_0x499bca['shift']());}};_0x18f195(++_0x2b2c99);}(_0xe87e,0x17d));var _0xee87=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xe87e[_0x47242d];return _0x30273a;};'use strict';var attributes=require(_0xee87('0x0'));module[_0xee87('0x1')]=function(_0x2ee020){return _0x2ee020[_0xee87('0x2')](_0xee87('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a1394){if(!_0x5a1394[_0xee87('0x4')])_0x5a1394[_0xee87('0x5')]=null;else if(_0x5a1394[_0xee87('0x5')]===null)_0x5a1394[_0xee87('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 5c32838..66f0b0d 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 _0x4297=['save','update','emit','user-setting:update','UserId','register','length','user-setting:'];(function(_0x11361c,_0x332e4c){var _0x159a85=function(_0x3ce23d){while(--_0x3ce23d){_0x11361c['push'](_0x11361c['shift']());}};_0x159a85(++_0x332e4c);}(_0x4297,0xa8));var _0x7429=function(_0x44715c,_0x13b6de){_0x44715c=_0x44715c-0x0;var _0x3f73a7=_0x4297[_0x44715c];return _0x3f73a7;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x7429('0x0'),'remove',_0x7429('0x1')];function createListener(_0x5497d6,_0x1f2f9a){return function(_0x488a1d){_0x1f2f9a[_0x7429('0x2')](_0x5497d6,_0x488a1d);if(_0x5497d6===_0x7429('0x3')){_0x1f2f9a[_0x7429('0x2')]('user-setting:update:user-'+_0x488a1d[_0x7429('0x4')],_0x488a1d);}};}exports[_0x7429('0x5')]=function(_0x22c80b){for(var _0x4d6348=0x0,_0x38cb5e=events[_0x7429('0x6')];_0x4d6348<_0x38cb5e;_0x4d6348++){var _0x4ad88b=events[_0x4d6348];var _0x35e7d9=createListener(_0x7429('0x7')+_0x4ad88b,_0x22c80b);UserSettingEvents['on'](_0x4ad88b,_0x35e7d9);}}; \ No newline at end of file +var _0x23a8=['length','user-setting:','save','update','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x2cd2c8,_0x148af1){var _0x22004d=function(_0x4a6788){while(--_0x4a6788){_0x2cd2c8['push'](_0x2cd2c8['shift']());}};_0x22004d(++_0x148af1);}(_0x23a8,0x172));var _0x823a=function(_0x2a4045,_0x1cef05){_0x2a4045=_0x2a4045-0x0;var _0x56b4f3=_0x23a8[_0x2a4045];return _0x56b4f3;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x823a('0x0'),'remove',_0x823a('0x1')];function createListener(_0x52f424,_0x39a117){return function(_0x413513){_0x39a117['emit'](_0x52f424,_0x413513);if(_0x52f424===_0x823a('0x2')){_0x39a117['emit'](_0x823a('0x3')+_0x413513[_0x823a('0x4')],_0x413513);}};}exports[_0x823a('0x5')]=function(_0x35ae11){for(var _0x5dca10=0x0,_0x472eb5=events[_0x823a('0x6')];_0x5dca10<_0x472eb5;_0x5dca10++){var _0x59866f=events[_0x5dca10];var _0x42c0f2=createListener(_0x823a('0x7')+_0x59866f,_0x35ae11);UserSettingEvents['on'](_0x59866f,_0x42c0f2);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5836af8..b601912 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 _0x1186=['removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id/avatar','getAvatar','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','getAgents','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','bulkCreate','/:id/queues','addQueues','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','/:id/teams','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x1186,0x75));var _0x6118=function(_0x350ce9,_0x39602a){_0x350ce9=_0x350ce9-0x0;var _0x112a54=_0x1186[_0x350ce9];return _0x112a54;};'use strict';var multer=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var path=require('path');var timeout=require(_0x6118('0x2'));var express=require(_0x6118('0x3'));var router=express['Router']();var fs_extra=require(_0x6118('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6118('0x5'));var config=require('../../config/environment');var controller=require(_0x6118('0x6'));router[_0x6118('0x7')]('/',auth[_0x6118('0x8')](),controller[_0x6118('0x9')]);router['get'](_0x6118('0xa'),auth[_0x6118('0x8')](),controller[_0x6118('0xb')]);router['get']('/whoami',auth[_0x6118('0x8')](),controller[_0x6118('0xc')]);router[_0x6118('0x7')](_0x6118('0xd'),auth[_0x6118('0x8')](),controller['getPresence']);router[_0x6118('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6118('0x7')](_0x6118('0xe'),controller[_0x6118('0xf')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x6118('0x7')]('/:id/contacts',auth[_0x6118('0x8')](),controller['getContacts']);router[_0x6118('0x7')]('/:id/queues',auth[_0x6118('0x8')](),controller[_0x6118('0x10')]);router[_0x6118('0x7')](_0x6118('0x11'),auth[_0x6118('0x8')](),controller[_0x6118('0x12')]);router[_0x6118('0x7')](_0x6118('0x13'),auth[_0x6118('0x8')](),controller[_0x6118('0x14')]);router[_0x6118('0x7')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x6118('0x15')]);router['get'](_0x6118('0x16'),auth['isAuthenticated'](),controller[_0x6118('0x17')]);router[_0x6118('0x7')](_0x6118('0x18'),auth[_0x6118('0x8')](),controller[_0x6118('0x19')]);router[_0x6118('0x7')](_0x6118('0x1a'),auth[_0x6118('0x8')](),controller[_0x6118('0x1b')]);router[_0x6118('0x7')](_0x6118('0x1c'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x6118('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x6118('0x7')]('/:id/fax/interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x1d')]);router[_0x6118('0x7')](_0x6118('0x1e'),auth['isAuthenticated'](),controller[_0x6118('0x1f')]);router[_0x6118('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6118('0x20')]);router['get']('/:id/lists',auth[_0x6118('0x8')](),controller[_0x6118('0x21')]);router[_0x6118('0x7')]('/:id/agents',auth[_0x6118('0x8')](),controller[_0x6118('0x22')]);router[_0x6118('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x6118('0x23')]);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6118('0x24')]);router[_0x6118('0x7')](_0x6118('0x25'),auth[_0x6118('0x8')](),controller['getMailAccounts']);router[_0x6118('0x7')](_0x6118('0x26'),auth[_0x6118('0x8')](),controller[_0x6118('0x27')]);router['get'](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x29')]);router[_0x6118('0x7')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x2b')]);router['get']('/:id/whatsapp_accounts',auth[_0x6118('0x8')](),controller[_0x6118('0x2c')]);router[_0x6118('0x7')](_0x6118('0x2d'),auth['isAuthenticated'](),controller[_0x6118('0x2e')]);router[_0x6118('0x7')](_0x6118('0x2f'),auth[_0x6118('0x8')](),controller['getApiKey']);router[_0x6118('0x30')](_0x6118('0x31'),auth[_0x6118('0x8')](),controller[_0x6118('0x32')]);router[_0x6118('0x30')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6118('0x30')]('/create_many',auth['isAuthenticated'](),controller[_0x6118('0x33')]);router['post'](_0x6118('0x34'),auth[_0x6118('0x8')](),controller[_0x6118('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c49ae,_0x57527b,_0x102de5){_0x102de5(null,path[_0x6118('0x36')](config[_0x6118('0x37')],'server/files/images/'));},'filename':function(_0x3bc816,_0x4b73a4,_0x4e6e60){_0x4e6e60(null,util[_0x6118('0x38')](_0x6118('0x39'),Date[_0x6118('0x3a')](),_0x4b73a4[_0x6118('0x3b')]));}})});router[_0x6118('0x30')]('/:id/avatar',upload[_0x6118('0x3c')](_0x6118('0x3d')),controller[_0x6118('0x3e')]);router['post'](_0x6118('0x3f'),auth[_0x6118('0x8')](),controller['login']);router[_0x6118('0x30')](_0x6118('0x40'),auth['isAuthenticated'](),controller[_0x6118('0x41')]);router[_0x6118('0x30')](_0x6118('0x42'),auth[_0x6118('0x8')](),controller['pause']);router['post'](_0x6118('0x43'),auth[_0x6118('0x8')](),controller[_0x6118('0x44')]);router[_0x6118('0x30')](_0x6118('0x45'),auth['isAuthenticated'](),controller[_0x6118('0x46')]);router[_0x6118('0x30')]('/:id/chat_interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x47')]);router[_0x6118('0x30')](_0x6118('0x48'),auth[_0x6118('0x8')](),controller[_0x6118('0x49')]);router['post'](_0x6118('0x4a'),auth[_0x6118('0x8')](),controller['addFaxInteractions']);router[_0x6118('0x30')](_0x6118('0x4b'),auth[_0x6118('0x8')](),controller[_0x6118('0x4c')]);router[_0x6118('0x30')](_0x6118('0x4d'),auth[_0x6118('0x8')](),controller['addOpenchannelInteractions']);router['post'](_0x6118('0x4e'),auth[_0x6118('0x8')](),controller[_0x6118('0x4f')]);router[_0x6118('0x30')](_0x6118('0x50'),auth[_0x6118('0x8')](),controller[_0x6118('0x51')]);router[_0x6118('0x30')]('/:id/mail_accounts',auth[_0x6118('0x8')](),controller[_0x6118('0x52')]);router[_0x6118('0x30')](_0x6118('0x26'),auth[_0x6118('0x8')](),controller[_0x6118('0x53')]);router['post'](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x54')]);router[_0x6118('0x30')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x55')]);router[_0x6118('0x30')](_0x6118('0x56'),auth['isAuthenticated'](),controller[_0x6118('0x57')]);router['post'](_0x6118('0x2f'),auth['isAuthenticated'](),controller[_0x6118('0x58')]);router[_0x6118('0x59')](_0x6118('0x5a'),auth['isAuthenticated'](),controller[_0x6118('0x5b')]);router[_0x6118('0x59')](_0x6118('0x5c'),auth[_0x6118('0x8')](),controller['changePassword']);router['delete'](_0x6118('0x34'),auth[_0x6118('0x8')](),controller[_0x6118('0x5d')]);router[_0x6118('0x5e')]('/:id/teams',auth[_0x6118('0x8')](),controller[_0x6118('0x5f')]);router[_0x6118('0x5e')](_0x6118('0x5a'),auth['isAuthenticated'](),controller[_0x6118('0x60')]);router[_0x6118('0x5e')](_0x6118('0x61'),auth['isAuthenticated'](),controller[_0x6118('0x62')]);router['delete'](_0x6118('0x48'),auth[_0x6118('0x8')](),controller['removeMailInteractions']);router[_0x6118('0x5e')](_0x6118('0x4a'),auth['isAuthenticated'](),controller[_0x6118('0x63')]);router[_0x6118('0x5e')](_0x6118('0x4b'),auth[_0x6118('0x8')](),controller[_0x6118('0x64')]);router[_0x6118('0x5e')]('/:id/openchannel_interactions',auth[_0x6118('0x8')](),controller[_0x6118('0x65')]);router[_0x6118('0x5e')](_0x6118('0x4e'),auth[_0x6118('0x8')](),controller[_0x6118('0x66')]);router[_0x6118('0x5e')](_0x6118('0x50'),auth[_0x6118('0x8')](),controller[_0x6118('0x67')]);router['delete'](_0x6118('0x25'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x6118('0x5e')](_0x6118('0x26'),auth['isAuthenticated'](),controller[_0x6118('0x68')]);router[_0x6118('0x5e')](_0x6118('0x28'),auth[_0x6118('0x8')](),controller[_0x6118('0x69')]);router[_0x6118('0x5e')](_0x6118('0x2a'),auth[_0x6118('0x8')](),controller[_0x6118('0x6a')]);router[_0x6118('0x5e')](_0x6118('0x56'),auth[_0x6118('0x8')](),controller[_0x6118('0x6b')]);router[_0x6118('0x5e')](_0x6118('0x2f'),auth[_0x6118('0x8')](),controller['removeApiKey']);router[_0x6118('0x30')](_0x6118('0x6c'),auth[_0x6118('0x8')](),controller['messengerSoundNotification']);module[_0x6118('0x6d')]=router; \ No newline at end of file +var _0x89d6=['getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','/:id/avatar','file','addAvatar','/:id/logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','whoami','/presence','/:id','show','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_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/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key'];(function(_0x59ab6d,_0x45018f){var _0x1a144d=function(_0x1cd349){while(--_0x1cd349){_0x59ab6d['push'](_0x59ab6d['shift']());}};_0x1a144d(++_0x45018f);}(_0x89d6,0x119));var _0x689d=function(_0x5d0005,_0x53a92d){_0x5d0005=_0x5d0005-0x0;var _0x3c193a=_0x89d6[_0x5d0005];return _0x3c193a;};'use strict';var multer=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));var path=require(_0x689d('0x2'));var timeout=require(_0x689d('0x3'));var express=require('express');var router=express[_0x689d('0x4')]();var fs_extra=require(_0x689d('0x5'));var auth=require(_0x689d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x689d('0x7'));var controller=require(_0x689d('0x8'));router[_0x689d('0x9')]('/',auth[_0x689d('0xa')](),controller[_0x689d('0xb')]);router[_0x689d('0x9')]('/describe',auth[_0x689d('0xa')](),controller[_0x689d('0xc')]);router[_0x689d('0x9')]('/whoami',auth['isAuthenticated'](),controller[_0x689d('0xd')]);router[_0x689d('0x9')](_0x689d('0xe'),auth[_0x689d('0xa')](),controller['getPresence']);router['get'](_0x689d('0xf'),auth[_0x689d('0xa')](),controller[_0x689d('0x10')]);router[_0x689d('0x9')]('/:id/avatar',controller[_0x689d('0x11')]);router[_0x689d('0x9')]('/:id/open_tabs',auth[_0x689d('0xa')](),controller[_0x689d('0x12')]);router[_0x689d('0x9')](_0x689d('0x13'),auth[_0x689d('0xa')](),controller['getContacts']);router[_0x689d('0x9')](_0x689d('0x14'),auth['isAuthenticated'](),controller['getQueues']);router[_0x689d('0x9')](_0x689d('0x15'),auth[_0x689d('0xa')](),controller[_0x689d('0x16')]);router[_0x689d('0x9')]('/:id/groups',auth[_0x689d('0xa')](),controller[_0x689d('0x17')]);router['get'](_0x689d('0x18'),auth['isAuthenticated'](),controller[_0x689d('0x19')]);router[_0x689d('0x9')](_0x689d('0x1a'),auth[_0x689d('0xa')](),controller[_0x689d('0x1b')]);router[_0x689d('0x9')](_0x689d('0x1c'),auth['isAuthenticated'](),controller[_0x689d('0x1d')]);router['get'](_0x689d('0x1e'),auth['isAuthenticated'](),controller[_0x689d('0x1f')]);router[_0x689d('0x9')](_0x689d('0x20'),auth['isAuthenticated'](),controller[_0x689d('0x21')]);router['get'](_0x689d('0x22'),auth[_0x689d('0xa')](),controller[_0x689d('0x23')]);router[_0x689d('0x9')](_0x689d('0x24'),auth['isAuthenticated'](),controller[_0x689d('0x25')]);router[_0x689d('0x9')](_0x689d('0x26'),auth['isAuthenticated'](),controller[_0x689d('0x27')]);router[_0x689d('0x9')](_0x689d('0x28'),auth[_0x689d('0xa')](),controller[_0x689d('0x29')]);router['get'](_0x689d('0x2a'),auth['isAuthenticated'](),controller[_0x689d('0x2b')]);router[_0x689d('0x9')](_0x689d('0x2c'),auth[_0x689d('0xa')](),controller[_0x689d('0x2d')]);router['get'](_0x689d('0x2e'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router['get'](_0x689d('0x2f'),auth[_0x689d('0xa')](),controller[_0x689d('0x30')]);router[_0x689d('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x689d('0x9')](_0x689d('0x31'),auth[_0x689d('0xa')](),controller[_0x689d('0x32')]);router[_0x689d('0x9')](_0x689d('0x33'),auth[_0x689d('0xa')](),controller['getSmsAccounts']);router[_0x689d('0x9')](_0x689d('0x34'),auth['isAuthenticated'](),controller[_0x689d('0x35')]);router[_0x689d('0x9')]('/:id/whatsapp_accounts',auth[_0x689d('0xa')](),controller[_0x689d('0x36')]);router[_0x689d('0x9')](_0x689d('0x37'),auth[_0x689d('0xa')](),controller[_0x689d('0x38')]);router[_0x689d('0x9')](_0x689d('0x39'),auth[_0x689d('0xa')](),controller[_0x689d('0x3a')]);router[_0x689d('0x3b')](_0x689d('0x13'),auth[_0x689d('0xa')](),controller[_0x689d('0x3c')]);router[_0x689d('0x3b')]('/',auth['isAuthenticated'](),controller[_0x689d('0x3d')]);router[_0x689d('0x3b')](_0x689d('0x3e'),auth[_0x689d('0xa')](),controller[_0x689d('0x3f')]);router['post'](_0x689d('0x14'),auth[_0x689d('0xa')](),controller[_0x689d('0x40')]);var upload=multer({'storage':multer[_0x689d('0x41')]({'destination':function(_0x181469,_0x52b7cc,_0x50e6e6){_0x50e6e6(null,path[_0x689d('0x42')](config[_0x689d('0x43')],_0x689d('0x44')));},'filename':function(_0x486199,_0x4a3613,_0x54b37c){_0x54b37c(null,util[_0x689d('0x45')]('%s-%s',Date[_0x689d('0x46')](),_0x4a3613[_0x689d('0x47')]));}})});router[_0x689d('0x3b')](_0x689d('0x48'),upload['single'](_0x689d('0x49')),controller[_0x689d('0x4a')]);router['post']('/:id/login',auth['isAuthenticated'](),controller['login']);router['post'](_0x689d('0x4b'),auth[_0x689d('0xa')](),controller['logout']);router['post'](_0x689d('0x4c'),auth[_0x689d('0xa')](),controller[_0x689d('0x4d')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x689d('0x4e')]);router[_0x689d('0x3b')](_0x689d('0x28'),auth['isAuthenticated'](),controller[_0x689d('0x4f')]);router[_0x689d('0x3b')](_0x689d('0x50'),auth[_0x689d('0xa')](),controller['addChatInteractions']);router[_0x689d('0x3b')](_0x689d('0x51'),auth[_0x689d('0xa')](),controller[_0x689d('0x52')]);router[_0x689d('0x3b')](_0x689d('0x53'),auth[_0x689d('0xa')](),controller[_0x689d('0x54')]);router[_0x689d('0x3b')](_0x689d('0x55'),auth[_0x689d('0xa')](),controller['addSmsInteractions']);router[_0x689d('0x3b')](_0x689d('0x56'),auth[_0x689d('0xa')](),controller[_0x689d('0x57')]);router['post']('/:id/whatsapp_interactions',auth[_0x689d('0xa')](),controller[_0x689d('0x58')]);router[_0x689d('0x3b')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x689d('0x59')]);router[_0x689d('0x3b')]('/:id/mail_accounts',auth[_0x689d('0xa')](),controller[_0x689d('0x5a')]);router[_0x689d('0x3b')](_0x689d('0x31'),auth[_0x689d('0xa')](),controller[_0x689d('0x5b')]);router[_0x689d('0x3b')](_0x689d('0x33'),auth[_0x689d('0xa')](),controller[_0x689d('0x5c')]);router[_0x689d('0x3b')](_0x689d('0x34'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x689d('0x3b')]('/:id/whatsapp_accounts',auth[_0x689d('0xa')](),controller[_0x689d('0x5d')]);router[_0x689d('0x3b')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x689d('0x5e')]);router['put'](_0x689d('0xf'),auth[_0x689d('0xa')](),controller[_0x689d('0x5f')]);router['put'](_0x689d('0x60'),auth[_0x689d('0xa')](),controller[_0x689d('0x61')]);router[_0x689d('0x62')](_0x689d('0x14'),auth['isAuthenticated'](),controller[_0x689d('0x63')]);router['delete'](_0x689d('0x28'),auth[_0x689d('0xa')](),controller['removeTeams']);router['delete'](_0x689d('0xf'),auth[_0x689d('0xa')](),controller[_0x689d('0x64')]);router[_0x689d('0x62')](_0x689d('0x50'),auth[_0x689d('0xa')](),controller[_0x689d('0x65')]);router[_0x689d('0x62')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x689d('0x66')]);router[_0x689d('0x62')](_0x689d('0x53'),auth[_0x689d('0xa')](),controller[_0x689d('0x67')]);router[_0x689d('0x62')](_0x689d('0x55'),auth[_0x689d('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x689d('0x56'),auth[_0x689d('0xa')](),controller[_0x689d('0x68')]);router[_0x689d('0x62')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0x689d('0x2f'),auth[_0x689d('0xa')](),controller['removeFaxAccounts']);router[_0x689d('0x62')](_0x689d('0x69'),auth['isAuthenticated'](),controller[_0x689d('0x6a')]);router[_0x689d('0x62')](_0x689d('0x31'),auth[_0x689d('0xa')](),controller[_0x689d('0x6b')]);router[_0x689d('0x62')](_0x689d('0x33'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x689d('0x62')](_0x689d('0x34'),auth[_0x689d('0xa')](),controller[_0x689d('0x6c')]);router[_0x689d('0x62')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x689d('0x6d')]);router[_0x689d('0x62')](_0x689d('0x39'),auth[_0x689d('0xa')](),controller[_0x689d('0x6e')]);router[_0x689d('0x3b')](_0x689d('0x6f'),auth['isAuthenticated'](),controller[_0x689d('0x70')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 348b5c9..cabe2f7 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 _0xf137=['force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','dtlsenable','dtlssetup','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','UNSIGNED','moment','util','lodash','exports','setDataValue','name','The\x20name\x20of\x20the\x20user','STRING','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','callerid','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','all','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','refuse','uac','uas','certificate','active','actpass','update,nonat','TEXT','showWebBar','isArray','wss','avpf'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf137,0xaf));var _0x7f13=function(_0x48f29c,_0x6703e3){_0x48f29c=_0x48f29c-0x0;var _0x43c69b=_0xf137[_0x48f29c];return _0x43c69b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7f13('0x0'));var util=require(_0x7f13('0x1'));var _=require(_0x7f13('0x2'));module[_0x7f13('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xa55d1){this[_0x7f13('0x4')](_0x7f13('0x5'),_0xa55d1);this[_0x7f13('0x4')]('defaultuser',_0xa55d1);},'comment':_0x7f13('0x6')},'fullname':{'type':Sequelize[_0x7f13('0x7')],'allowNull':![],'set':function(_0x2e39d7){this[_0x7f13('0x4')]('fullname',_0x2e39d7);this[_0x7f13('0x4')]('callerid',util[_0x7f13('0x8')](_0x7f13('0x9'),_0x2e39d7,this[_0x7f13('0xa')](_0x7f13('0xb'))));}},'alias':{'type':Sequelize[_0x7f13('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7f13('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3a15a4){if(_0x3a15a4){this[_0x7f13('0x4')]('email',_0x3a15a4[_0x7f13('0xd')]());}}},'role':{'type':Sequelize[_0x7f13('0xe')]('admin',_0x7f13('0xf'),_0x7f13('0x10'),_0x7f13('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x7f13('0x7')],'defaultValue':_0x7f13('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x7f13('0xb'),'set':function(_0x102d37){this[_0x7f13('0x4')](_0x7f13('0xb'),_0x102d37);this[_0x7f13('0x4')]('accountcode',_0x102d37);this[_0x7f13('0x4')](_0x7f13('0x13'),util[_0x7f13('0x8')](_0x7f13('0x9'),this['getDataValue'](_0x7f13('0x14')),_0x102d37));}},'salt':{'type':Sequelize[_0x7f13('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7f13('0x7')]},'address':{'type':Sequelize[_0x7f13('0x7')]},'zipcode':{'type':Sequelize[_0x7f13('0x7')]},'userpic':{'type':Sequelize[_0x7f13('0x7')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7f13('0x7')]},'online':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x7f13('0x7')],'defaultValue':_0x7f13('0x16')},'lastPauseAt':{'type':Sequelize[_0x7f13('0x17')]},'chatCapacity':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x7f13('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7f13('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'defaultValue':_0x7f13('0x19')},'ipaddr':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0x7f13('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x1a'),_0x7f13('0xf'),_0x7f13('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'defaultValue':_0x7f13('0x1c')},'callingpres':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x1d'),_0x7f13('0x1e'),_0x7f13('0x1f'),'ALLOWED','PROHIB_NOT_SCREENED',_0x7f13('0x20'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'defaultValue':_0x7f13('0x21'),'set':function(_0x3229e5){this[_0x7f13('0x4')](_0x7f13('0x22'),_0x3229e5?_0x3229e5[_0x7f13('0x23')](','):null);},'get':function(){return this[_0x7f13('0xa')](_0x7f13('0x22'))?this[_0x7f13('0xa')](_0x7f13('0x22'))[_0x7f13('0x24')](','):null;},'comment':_0x7f13('0x25')},'dtmfmode':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x26'),_0x7f13('0x27'),_0x7f13('0x28'),_0x7f13('0x29'),_0x7f13('0x2a')),'allowNull':!![],'defaultValue':_0x7f13('0x26')},'directmedia':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no',_0x7f13('0x2c'),_0x7f13('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'defaultValue':_0x7f13('0x2e'),'set':function(_0x2cd74e){this[_0x7f13('0x4')]('nat',_0x2cd74e?_0x2cd74e[_0x7f13('0x23')](','):null);},'get':function(){return this[_0x7f13('0xa')]('nat')?this[_0x7f13('0xa')]('nat')[_0x7f13('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7f13('0x7')]},'namedcallgroup':{'type':Sequelize[_0x7f13('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7f13('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7f13('0x2f')},'allow':{'type':Sequelize[_0x7f13('0x7')],'allowNull':![],'defaultValue':_0x7f13('0x30'),'set':function(_0x1d464f){this['setDataValue']('allow',_0x1d464f?_0x1d464f['join'](';'):_0x7f13('0x30'));},'get':function(){return this[_0x7f13('0xa')](_0x7f13('0x31'))?this[_0x7f13('0xa')](_0x7f13('0x31'))[_0x7f13('0x24')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x7f13('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'set':function(_0x518930){this['setDataValue'](_0x7f13('0x32'),_0x518930?_0x518930[_0x7f13('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x7f13('0x32'))?this[_0x7f13('0xa')](_0x7f13('0x32'))[_0x7f13('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![],'defaultValue':_0x7f13('0x33')},'amaflags':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x7f13('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x7f13('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7f13('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no',_0x7f13('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7f13('0xe')]('accept',_0x7f13('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x36'),'uas'),'allowNull':!![],'defaultValue':_0x7f13('0x37')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x7f13('0x2b')},'keepalive':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x7f13('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x7f13('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x7f13('0xe')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no','fingerprint',_0x7f13('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x39'),'passive',_0x7f13('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7f13('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x7f13('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x7f13('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7f13('0xe')](_0x7f13('0x2b'),'no','nonat','update',_0x7f13('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x7f13('0x17')]},'passwordResetAt':{'type':Sequelize[_0x7f13('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7f13('0x3c')]},'showWebBar':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0,'set':function(_0x6c791a){this[_0x7f13('0x4')](_0x7f13('0x3d'),_0x6c791a);var _0x56cf70=this['get']({'plain':!![]});switch(_0x6c791a){case 0x0:case 0x1:var _0xed7a86=_0x56cf70[_0x7f13('0x22')]?_[_0x7f13('0x3e')](_0x56cf70[_0x7f13('0x22')])?_0x56cf70['transport'][_0x7f13('0x23')]():_0x56cf70['transport']:_0x7f13('0x21');if(_0xed7a86===_0x7f13('0x3f')){_0xed7a86='udp';}this[_0x7f13('0x4')](_0x7f13('0x22'),_0xed7a86);this['setDataValue']('encryption','no');this[_0x7f13('0x4')](_0x7f13('0x40'),null);this['setDataValue'](_0x7f13('0x41'),null);this[_0x7f13('0x4')](_0x7f13('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x7f13('0x4')](_0x7f13('0x43'),null);this[_0x7f13('0x4')]('dtlssetup',null);this[_0x7f13('0x4')](_0x7f13('0x44'),null);this['setDataValue'](_0x7f13('0x45'),null);this[_0x7f13('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x7f13('0x4')](_0x7f13('0x22'),_0x7f13('0x3f'));this['setDataValue']('encryption',_0x7f13('0x2b'));this[_0x7f13('0x4')](_0x7f13('0x40'),'yes');this['setDataValue'](_0x7f13('0x41'),'yes');this[_0x7f13('0x4')](_0x7f13('0x42'),'yes');this[_0x7f13('0x4')](_0x7f13('0x46'),'yes');this['setDataValue']('dtlsverify','no');this[_0x7f13('0x4')](_0x7f13('0x47'),_0x7f13('0x3a'));this[_0x7f13('0x4')](_0x7f13('0x44'),_0x56cf70['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x7f13('0x4')](_0x7f13('0x45'),_0x56cf70[_0x7f13('0x45')]||_0x7f13('0x48'));this[_0x7f13('0x4')](_0x7f13('0x49'),_0x7f13('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x7f13('0x3c')],'set':function(_0x36c758){this[_0x7f13('0x4')]('permissions',_0x36c758?_0x36c758[_0x7f13('0x23')](','):[]);},'get':function(){return this[_0x7f13('0xa')](_0x7f13('0x4a'))?_['map'](this['getDataValue'](_0x7f13('0x4a'))[_0x7f13('0x24')](','),function(_0x44276d){return parseInt(_0x44276d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7f13('0x7')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7f13('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x7f13('0x7')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x7f13('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7f13('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7f13('0xa')](_0x7f13('0x4b'))?this[_0x7f13('0xa')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7f13('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x7f13('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3e8d5b){if(typeof _0x3e8d5b===_0x7f13('0x4c')){var _0x5f1aab=_0x3e8d5b==='1'?!![]:_0x3e8d5b==='0'?![]:_0x3e8d5b==='true'?!![]:_0x3e8d5b===_0x7f13('0x4d')?![]:![];this[_0x7f13('0x4')]('screenrecording',_0x5f1aab);}else{this[_0x7f13('0x4')](_0x7f13('0x4e'),_0x3e8d5b);}}},'blocked':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![],'set':function(_0x5b4d4c){this[_0x7f13('0x4')]('blocked',_0x5b4d4c);if(_0x5b4d4c===!![]){this[_0x7f13('0x4')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x7f13('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7f13('0x18')](0x5)[_0x7f13('0x4f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x7f13('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x7f13('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xcd65=['peer','from-sip','ENUM','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','join','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','refuse','originate','uac','uas','active','actpass','TEXT','showWebBar','isArray','wss','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend'];(function(_0x3421e0,_0x4199b9){var _0x513e1a=function(_0x55a35a){while(--_0x55a35a){_0x3421e0['push'](_0x3421e0['shift']());}};_0x513e1a(++_0x4199b9);}(_0xcd65,0x93));var _0x5cd6=function(_0x3b7cc9,_0x18cd9b){_0x3b7cc9=_0x3b7cc9-0x0;var _0x5751ea=_0xcd65[_0x3b7cc9];return _0x5751ea;};'use strict';var Sequelize=require(_0x5cd6('0x0'));var moment=require(_0x5cd6('0x1'));var util=require('util');var _=require(_0x5cd6('0x2'));module['exports']={'name':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':![],'unique':_0x5cd6('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x59a66a){this['setDataValue'](_0x5cd6('0x4'),_0x59a66a);this[_0x5cd6('0x5')](_0x5cd6('0x6'),_0x59a66a);},'comment':_0x5cd6('0x7')},'fullname':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':![],'set':function(_0x2cc2e9){this[_0x5cd6('0x5')](_0x5cd6('0x8'),_0x2cc2e9);this[_0x5cd6('0x5')](_0x5cd6('0x9'),util[_0x5cd6('0xa')](_0x5cd6('0xb'),_0x2cc2e9,this[_0x5cd6('0xc')](_0x5cd6('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':![],'unique':_0x5cd6('0xe'),'validate':{'isEmail':!![]},'set':function(_0x357704){if(_0x357704){this['setDataValue'](_0x5cd6('0xe'),_0x357704['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x5cd6('0xf'),_0x5cd6('0x10'),_0x5cd6('0x11'),_0x5cd6('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5cd6('0x3')],'defaultValue':_0x5cd6('0x13')},'internal':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':![],'unique':_0x5cd6('0xd'),'set':function(_0x3e344b){this[_0x5cd6('0x5')](_0x5cd6('0xd'),_0x3e344b);this[_0x5cd6('0x5')](_0x5cd6('0x15'),_0x3e344b);this['setDataValue'](_0x5cd6('0x9'),util[_0x5cd6('0xa')](_0x5cd6('0xb'),this[_0x5cd6('0xc')](_0x5cd6('0x8')),_0x3e344b));}},'salt':{'type':Sequelize[_0x5cd6('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x5cd6('0x3')]},'address':{'type':Sequelize[_0x5cd6('0x3')]},'zipcode':{'type':Sequelize[_0x5cd6('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5cd6('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5cd6('0x17')]},'voicePause':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5cd6('0x3')],'defaultValue':_0x5cd6('0x18')},'lastPauseAt':{'type':Sequelize[_0x5cd6('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5cd6('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5cd6('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![],'defaultValue':_0x5cd6('0x19')},'ipaddr':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5cd6('0x1a'),'user',_0x5cd6('0x1b')),'allowNull':!![],'defaultValue':_0x5cd6('0x1a')},'context':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![],'defaultValue':_0x5cd6('0x1c')},'callingpres':{'type':Sequelize[_0x5cd6('0x1d')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x5cd6('0x1e'),_0x5cd6('0x1f'),_0x5cd6('0x20'),_0x5cd6('0x21'),_0x5cd6('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![],'defaultValue':_0x5cd6('0x23'),'set':function(_0x208e9){this[_0x5cd6('0x5')](_0x5cd6('0x24'),_0x208e9?_0x208e9['join'](','):null);},'get':function(){return this[_0x5cd6('0xc')](_0x5cd6('0x24'))?this[_0x5cd6('0xc')](_0x5cd6('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x5cd6('0x25'),_0x5cd6('0x26'),_0x5cd6('0x27'),_0x5cd6('0x28'),_0x5cd6('0x29')),'allowNull':!![],'defaultValue':_0x5cd6('0x25')},'directmedia':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no',_0x5cd6('0x2b'),_0x5cd6('0x2c'),_0x5cd6('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![],'defaultValue':_0x5cd6('0x2e'),'set':function(_0x903e0f){this[_0x5cd6('0x5')]('nat',_0x903e0f?_0x903e0f['join'](','):null);},'get':function(){return this[_0x5cd6('0xc')](_0x5cd6('0x2f'))?this[_0x5cd6('0xc')](_0x5cd6('0x2f'))[_0x5cd6('0x30')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5cd6('0x3')]},'namedcallgroup':{'type':Sequelize[_0x5cd6('0x3')]},'pickupgroup':{'type':Sequelize[_0x5cd6('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5cd6('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x33c07a){this[_0x5cd6('0x5')]('allow',_0x33c07a?_0x33c07a[_0x5cd6('0x31')](';'):_0x5cd6('0x32'));},'get':function(){return this[_0x5cd6('0xc')](_0x5cd6('0x33'))?this[_0x5cd6('0xc')]('allow')[_0x5cd6('0x30')](';'):null;},'comment':_0x5cd6('0x34')},'autoframing':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![],'set':function(_0x335eab){this[_0x5cd6('0x5')](_0x5cd6('0x35'),_0x335eab?_0x335eab[_0x5cd6('0x31')](','):null);},'get':function(){return this[_0x5cd6('0xc')](_0x5cd6('0x35'))?this[_0x5cd6('0xc')](_0x5cd6('0x35'))['split'](','):null;},'comment':_0x5cd6('0x36')},'trustrpid':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no',_0x5cd6('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x38'),_0x5cd6('0x39'),_0x5cd6('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x5cd6('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x5cd6('0x2a')},'keepalive':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x3d'),'passive',_0x5cd6('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5cd6('0x1d')](_0x5cd6('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5cd6('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x5cd6('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no',_0x5cd6('0x2b'),_0x5cd6('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5cd6('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x5cd6('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5cd6('0x3f')]},'showWebBar':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0,'set':function(_0x17a85f){this['setDataValue'](_0x5cd6('0x40'),_0x17a85f);var _0xd55e2=this['get']({'plain':!![]});switch(_0x17a85f){case 0x0:case 0x1:var _0xd45d84=_0xd55e2['transport']?_[_0x5cd6('0x41')](_0xd55e2[_0x5cd6('0x24')])?_0xd55e2[_0x5cd6('0x24')][_0x5cd6('0x31')]():_0xd55e2[_0x5cd6('0x24')]:'udp';if(_0xd45d84===_0x5cd6('0x42')){_0xd45d84=_0x5cd6('0x23');}this['setDataValue'](_0x5cd6('0x24'),_0xd45d84);this['setDataValue']('encryption','no');this[_0x5cd6('0x5')]('avpf',null);this[_0x5cd6('0x5')]('force_avp',null);this['setDataValue'](_0x5cd6('0x43'),null);this[_0x5cd6('0x5')](_0x5cd6('0x44'),null);this['setDataValue'](_0x5cd6('0x45'),null);this[_0x5cd6('0x5')]('dtlssetup',null);this[_0x5cd6('0x5')](_0x5cd6('0x46'),null);this['setDataValue'](_0x5cd6('0x47'),null);this[_0x5cd6('0x5')](_0x5cd6('0x48'),'no');break;case 0x2:this[_0x5cd6('0x5')]('transport','wss');this[_0x5cd6('0x5')]('encryption',_0x5cd6('0x2a'));this['setDataValue'](_0x5cd6('0x49'),_0x5cd6('0x2a'));this[_0x5cd6('0x5')](_0x5cd6('0x4a'),_0x5cd6('0x2a'));this[_0x5cd6('0x5')](_0x5cd6('0x43'),_0x5cd6('0x2a'));this[_0x5cd6('0x5')](_0x5cd6('0x44'),_0x5cd6('0x2a'));this[_0x5cd6('0x5')](_0x5cd6('0x45'),'no');this[_0x5cd6('0x5')](_0x5cd6('0x4b'),_0x5cd6('0x3e'));this[_0x5cd6('0x5')](_0x5cd6('0x46'),_0xd55e2[_0x5cd6('0x46')]||_0x5cd6('0x4c'));this[_0x5cd6('0x5')](_0x5cd6('0x47'),_0xd55e2[_0x5cd6('0x47')]||_0x5cd6('0x4d'));this[_0x5cd6('0x5')]('rtcp_mux',_0x5cd6('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x5cd6('0x3f')],'set':function(_0x1661a4){this[_0x5cd6('0x5')](_0x5cd6('0x4e'),_0x1661a4?_0x1661a4['join'](','):[]);},'get':function(){return this[_0x5cd6('0xc')]('permissions')?_['map'](this['getDataValue'](_0x5cd6('0x4e'))[_0x5cd6('0x30')](','),function(_0x3dac8c){return parseInt(_0x3dac8c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5cd6('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5cd6('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5cd6('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5cd6('0x1d')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5cd6('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5cd6('0x4f')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x5cd6('0xc')](_0x5cd6('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5cd6('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x370777){if(typeof _0x370777==='string'){var _0x529d4a=_0x370777==='1'?!![]:_0x370777==='0'?![]:_0x370777===_0x5cd6('0x51')?!![]:_0x370777===_0x5cd6('0x52')?![]:![];this['setDataValue'](_0x5cd6('0x53'),_0x529d4a);}else{this['setDataValue'](_0x5cd6('0x53'),_0x370777);}}},'blocked':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![],'set':function(_0x1cc99f){this[_0x5cd6('0x5')](_0x5cd6('0x54'),_0x1cc99f);if(_0x1cc99f===!![]){this[_0x5cd6('0x5')](_0x5cd6('0x55'),moment());this[_0x5cd6('0x5')](_0x5cd6('0x56'),0x0);}else{this[_0x5cd6('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x5cd6('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5cd6('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x5cd6('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x5cd6('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ad66805..ecd8939 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 _0x59e8=['sort','where','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','options','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','addAgent','getDataValue','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','Voice','TeamVoicePrefix','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$in','$like','$notLike','$iLike','$overlap','$contained','$any','firstName','lastName','CmContact','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','agent','emit','destroy','get','role','Users','user','Agents','Telephones','filter','ignore','includes','find','value','name','UserProfileResource','error','stack','send','User','rawAttributes','map','fieldName','type','key','password','salt','previousPasswords','resetPasswordExpires','md5secret','query','includeAll','include','userSetting','true','push','findAll','rows','openTabs','chat','dataValues','getOptions','UserSetting','merge','attributes','sms','openchannel','whatsapp','mail','all','catch','body','params','describe','addContacts','ids','omit','internal','Setting','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','SELECT','length','from','voicemail','email','permissions','101','103','113','105','106','107','108','109','100','111','114','115','create','admin','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','isEmpty','autoAssociation','compact','changePassword','newPassword','Sequelize','ValidationError','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','QueueId','Queue:save','voice','SIP/%s','removeQueues','channel','remove','Queues','isArray','Queue:remove','UserVoiceQueueRt','userpic','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','join','ChatOpenTabs','CHAT','FAX','createdAt','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','model','keys','Queue','filters','intersection','fields','order'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x59e8,0xb4));var _0x859e=function(_0x4c91d7,_0x427d42){_0x4c91d7=_0x4c91d7-0x0;var _0x3504eb=_0x59e8[_0x4c91d7];return _0x3504eb;};'use strict';var moment=require(_0x859e('0x0'));var util=require(_0x859e('0x1'));var path=require(_0x859e('0x2'));var fs=require('fs');var _=require(_0x859e('0x3'));var squel=require('squel');var Redis=require('ioredis');var authService=require(_0x859e('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x859e('0x5'));var rta=require(_0x859e('0x6'));var logger=require('../../config/logger')('api');var utils=require(_0x859e('0x7'));var config=require(_0x859e('0x8'));var licenseUtil=require(_0x859e('0x9'));var APIBadRequestError=require(_0x859e('0xa'))[_0x859e('0xb')];var APINotFoundError=require(_0x859e('0xa'))[_0x859e('0xc')];var APIHandleError=require(_0x859e('0xa'))[_0x859e('0xd')];var db=require(_0x859e('0xe'))['db'];var socket=require(_0x859e('0xf'))(new Redis(config[_0x859e('0x10')]));require(_0x859e('0x11'))[_0x859e('0x12')](socket);config[_0x859e('0x10')]=_[_0x859e('0x13')](config['redis'],{'host':_0x859e('0x14'),'port':0x18eb});var values;function respondWithStatusCode(_0x555758,_0x1abf72){_0x1abf72=_0x1abf72||0xcc;return function(_0x109ebc){if(_0x109ebc){return _0x555758[_0x859e('0x15')](_0x1abf72);}return _0x555758[_0x859e('0x16')](_0x1abf72)[_0x859e('0x17')]();};}function respondWithResult(_0x18e461,_0x7478d9){_0x7478d9=_0x7478d9||0xc8;return function(_0x15c26b){if(_0x15c26b){return _0x18e461[_0x859e('0x16')](_0x7478d9)[_0x859e('0x18')](_0x15c26b);}};}function respondWithFilteredResult(_0x505ca6,_0x561664){return function(_0x48a6a8){if(_0x48a6a8){var _0xf8eb77=typeof _0x561664['offset']==='undefined'&&typeof _0x561664['limit']===_0x859e('0x19');var _0x53d744=_0x48a6a8[_0x859e('0x1a')];var _0xa54eb0=_0xf8eb77?0x0:_0x561664[_0x859e('0x1b')];var _0x1ccf9a=_0xf8eb77?_0x48a6a8[_0x859e('0x1a')]:_0x561664[_0x859e('0x1b')]+_0x561664[_0x859e('0x1c')];var _0x48fdbe;if(_0x1ccf9a>=_0x53d744){_0x1ccf9a=_0x53d744;_0x48fdbe=0xc8;}else{_0x48fdbe=0xce;}_0x505ca6[_0x859e('0x16')](_0x48fdbe);return _0x505ca6[_0x859e('0x1d')](_0x859e('0x1e'),_0xa54eb0+'-'+_0x1ccf9a+'/'+_0x53d744)[_0x859e('0x18')](_0x48a6a8);}return null;};}function saveUpdates(_0x57b628){return function(_0x3f9186){if(_0x3f9186){return _0x3f9186[_0x859e('0x1f')](_0x57b628)[_0x859e('0x20')](function(_0x4eb25b){if(_0x4eb25b['role']===_0x859e('0x21')){socket[_0x859e('0x22')]('userNotification:recalc:'+_0x4eb25b['id'],_0x4eb25b);}return _0x4eb25b;});}return null;};}function removeEntity(_0x5449c7){return function(_0xc8bee){if(_0xc8bee){return _0xc8bee[_0x859e('0x23')]()[_0x859e('0x20')](function(){var _0x1bbb0d=_0xc8bee[_0x859e('0x24')]({'plain':!![]});if(_0x1bbb0d[_0x859e('0x25')]==='admin')return;var _0x3f1a2e=[{'name':_0x859e('0x26'),'value':_0x859e('0x27'),'ignore':!![]},{'name':_0x859e('0x28'),'value':_0x859e('0x21'),'ignore':![]},{'name':_0x859e('0x29'),'value':'telephone','ignore':![]}];var _0x54105b=_(_0x3f1a2e)[_0x859e('0x2a')](_0x859e('0x2b'))['map']('value')['value']();if(_[_0x859e('0x2c')](_0x54105b,_0x1bbb0d[_0x859e('0x25')])){return;}var _0x27d1a5=_[_0x859e('0x2d')](_0x3f1a2e,[_0x859e('0x2e'),_0x1bbb0d[_0x859e('0x25')]])[_0x859e('0x2f')];return db[_0x859e('0x30')][_0x859e('0x23')]({'where':{'type':_0x27d1a5,'resourceId':_0x1bbb0d['id']}})[_0x859e('0x20')](function(){return _0xc8bee;});})[_0x859e('0x20')](function(){_0x5449c7[_0x859e('0x16')](0xcc)[_0x859e('0x17')]();});}};}function handleEntityNotFound(_0x5dd60a){return function(_0x55b0f4){if(!_0x55b0f4){_0x5dd60a[_0x859e('0x15')](0x194);}return _0x55b0f4;};}function handleError(_0x1d5f75,_0xcc70fa){_0xcc70fa=_0xcc70fa||0x1f4;return function(_0x134098){logger[_0x859e('0x31')](_0x134098[_0x859e('0x32')]);if(_0x134098[_0x859e('0x2f')]){delete _0x134098['name'];}_0x1d5f75['status'](_0xcc70fa)[_0x859e('0x33')](_0x134098);};}function getUserAttributes(){return _(db[_0x859e('0x34')][_0x859e('0x35')])[_0x859e('0x36')](function(_0x1f5d4f){return{'name':_0x1f5d4f[_0x859e('0x37')],'type':_0x1f5d4f[_0x859e('0x38')][_0x859e('0x39')]};})[_0x859e('0x2a')](function(_0x2b935a){return![_0x859e('0x3a'),_0x859e('0x3b'),_0x859e('0x3c'),'resetPasswordToken',_0x859e('0x3d'),_0x859e('0x3e')][_0x859e('0x2c')](_0x2b935a[_0x859e('0x2f')]);})['value']();}exports['index']=function(_0x32d70e,_0x3e006c){var _0x22a17d={},_0xc9c27d={'count':0x0,'rows':[]};var _0x2b2047=getUserAttributes();_0x22a17d=qs['getOptions'](_0x2b2047,_0x32d70e);var _0x8de45d={'where':_0x22a17d['where']};return db[_0x859e('0x34')][_0x859e('0x1a')](_0x8de45d)[_0x859e('0x20')](function(_0x1a9cd9){_0xc9c27d[_0x859e('0x1a')]=_0x1a9cd9;if(_0x32d70e[_0x859e('0x3f')][_0x859e('0x40')]){_0x22a17d[_0x859e('0x41')]=[{'all':!![]}];}if(_0x32d70e[_0x859e('0x3f')][_0x859e('0x42')]===_0x859e('0x43')){_0x22a17d[_0x859e('0x41')]=[{'model':db['UserSetting'],'as':_0x859e('0x42')}];}if(!_[_0x859e('0x2c')](_0x22a17d['attributes'],'id')){_0x22a17d['attributes'][_0x859e('0x44')]('id');}return db[_0x859e('0x34')][_0x859e('0x45')](_0x22a17d);})[_0x859e('0x20')](function(_0xb96e60){_0xc9c27d[_0x859e('0x46')]=_0xb96e60;if(_0x32d70e[_0x859e('0x3f')][_0x859e('0x47')]===_0x859e('0x43')){var _0x2967b6=[];for(var _0xf6cd50=0x0;_0xf6cd50<_0xc9c27d[_0x859e('0x46')]['length'];_0xf6cd50++){_0x2967b6[_0x859e('0x44')](get_open_tabs(_0x859e('0x48'),_0xc9c27d['rows'][_0xf6cd50]['dataValues']));_0x2967b6['push'](get_open_tabs('sms',_0xc9c27d[_0x859e('0x46')][_0xf6cd50]['dataValues']));_0x2967b6['push'](get_open_tabs('fax',_0xc9c27d['rows'][_0xf6cd50][_0x859e('0x49')]));_0x2967b6['push'](get_open_tabs('mail',_0xc9c27d[_0x859e('0x46')][_0xf6cd50][_0x859e('0x49')]));_0x2967b6[_0x859e('0x44')](get_open_tabs('openchannel',_0xc9c27d[_0x859e('0x46')][_0xf6cd50]['dataValues']));_0x2967b6[_0x859e('0x44')](get_open_tabs('whatsapp',_0xc9c27d[_0x859e('0x46')][_0xf6cd50][_0x859e('0x49')]));}return Promise['all'](_0x2967b6)[_0x859e('0x20')](function(){return _0xc9c27d;});}else{return _0xc9c27d;}})['then'](respondWithFilteredResult(_0x3e006c,_0x22a17d))['catch'](handleError(_0x3e006c,null));};exports['show']=function(_0x148863,_0x1eb8b0){var _0x33ecd1=getUserAttributes();_0x148863[_0x859e('0x3f')]['id']=_0x148863['params']['id'];var _0x3e20d2=qs[_0x859e('0x4a')](_0x33ecd1,_0x148863);if(_0x148863[_0x859e('0x3f')][_0x859e('0x40')]){_0x3e20d2[_0x859e('0x41')]=[{'all':!![]}];}if(_0x148863[_0x859e('0x3f')][_0x859e('0x42')]===_0x859e('0x43')){_0x3e20d2[_0x859e('0x41')]=[{'model':db[_0x859e('0x4b')],'as':_0x859e('0x42')}];}_0x3e20d2=_[_0x859e('0x4c')]({},_0x3e20d2,_0x148863['options']);if(!_['includes'](_0x3e20d2['attributes'],'id')){_0x3e20d2[_0x859e('0x4d')][_0x859e('0x44')]('id');}return db[_0x859e('0x34')][_0x859e('0x2d')](_0x3e20d2)[_0x859e('0x20')](handleEntityNotFound(_0x1eb8b0,null))[_0x859e('0x20')](function(_0x1a883f){var _0x30e8e8=[];values=_0x1a883f;if(_0x148863['query']['openTabs']==='true'){_0x30e8e8[_0x859e('0x44')](get_open_tabs('chat',_0x1a883f['dataValues']));_0x30e8e8['push'](get_open_tabs(_0x859e('0x4e'),_0x1a883f[_0x859e('0x49')]));_0x30e8e8['push'](get_open_tabs(_0x859e('0x4f'),_0x1a883f['dataValues']));_0x30e8e8[_0x859e('0x44')](get_open_tabs(_0x859e('0x50'),_0x1a883f[_0x859e('0x49')]));_0x30e8e8[_0x859e('0x44')](get_open_tabs('fax',_0x1a883f[_0x859e('0x49')]));_0x30e8e8[_0x859e('0x44')](get_open_tabs(_0x859e('0x51'),_0x1a883f['dataValues']));return Promise[_0x859e('0x52')](_0x30e8e8);}else{return values;}})[_0x859e('0x20')](function(){return values;})['then'](respondWithResult(_0x1eb8b0,null))[_0x859e('0x53')](handleError(_0x1eb8b0,null));};exports[_0x859e('0x1f')]=function(_0x597f90,_0x2eaf82){if(_0x597f90[_0x859e('0x54')]['id']){delete _0x597f90[_0x859e('0x54')]['id'];}delete _0x597f90[_0x859e('0x54')]['role'];return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x597f90[_0x859e('0x55')]['id']}})['then'](handleEntityNotFound(_0x2eaf82,null))[_0x859e('0x20')](saveUpdates(_0x597f90[_0x859e('0x54')],null))[_0x859e('0x20')](respondWithResult(_0x2eaf82,null))[_0x859e('0x53')](handleError(_0x2eaf82,null));};exports['describe']=function(_0x3b38a3,_0xb5c873){return db['User'][_0x859e('0x56')]()[_0x859e('0x20')](respondWithResult(_0xb5c873,null))[_0x859e('0x53')](handleError(_0xb5c873,null));};exports[_0x859e('0x57')]=function(_0x458c59,_0xa27fa1){return db[_0x859e('0x34')]['find']({'where':{'id':_0x458c59['params']['id']}})['then'](handleEntityNotFound(_0xa27fa1,null))[_0x859e('0x20')](function(_0x587d72){if(_0x587d72){return _0x587d72[_0x859e('0x57')](_0x458c59[_0x859e('0x54')][_0x859e('0x58')],_[_0x859e('0x59')](_0x458c59[_0x859e('0x54')],[_0x859e('0x58'),'id'])||{});}})[_0x859e('0x20')](respondWithResult(_0xa27fa1,null))[_0x859e('0x53')](handleError(_0xa27fa1,null));};function validateUser(_0x3a9264){return new Promise(function(_0x11b8fb,_0x1418a9){if(_0x3a9264[_0x859e('0x5a')])return _0x11b8fb(_0x3a9264);return db[_0x859e('0x5b')]['findById'](0x1)[_0x859e('0x20')](function(_0x1852ff){if(_0x1852ff[_0x859e('0x5c')])authService[_0x859e('0x5d')](_0x3a9264[_0x859e('0x3a')]);db[_0x859e('0x34')][_0x859e('0x5e')](_0x859e('0x5a'))[_0x859e('0x20')](function(_0x62a841){if(_[_0x859e('0x5f')](_0x62a841)){_0x3a9264[_0x859e('0x5a')]=_0x1852ff[_0x859e('0x60')]||0x1;return;}if(_['isNil'](_0x1852ff[_0x859e('0x60')])||_0x1852ff['min_internal']===_0x62a841){_0x3a9264[_0x859e('0x5a')]=_0x62a841+0x1;return;}if(_0x1852ff[_0x859e('0x60')]>_0x62a841){_0x3a9264[_0x859e('0x5a')]=_0x1852ff[_0x859e('0x60')];return;}return db[_0x859e('0x61')][_0x859e('0x3f')]('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[_0x859e('0x61')]['QueryTypes'][_0x859e('0x62')]})[_0x859e('0x20')](function(_0x187e57){if(_0x187e57&&_0x187e57[_0x859e('0x63')]){for(var _0x7e6fc7=0x0,_0x4a9966=_0x187e57['length'];_0x7e6fc7<_0x4a9966&&_[_0x859e('0x5f')](_0x3a9264['internal']);_0x7e6fc7++){if(_0x1852ff[_0x859e('0x60')]<=_0x187e57[_0x7e6fc7][_0x859e('0x64')]){_0x3a9264[_0x859e('0x5a')]=_0x187e57[_0x7e6fc7]['from'];}else if(_0x1852ff['min_internal']>_0x187e57[_0x7e6fc7][_0x859e('0x64')]&&_0x1852ff['min_internal']<=_0x187e57[_0x7e6fc7]['to']){_0x3a9264[_0x859e('0x5a')]=_0x1852ff['min_internal'];}}}if(_['isNil'](_0x3a9264[_0x859e('0x5a')])){_0x3a9264['internal']=_0x62a841+0x1;}return _0x11b8fb(_0x3a9264);});});})['catch'](function(_0x4115c4){_0x1418a9(_0x4115c4);});});}function updateUser(_0x208b60){return new Promise(function(_0x19d84d,_0x390560){try{if(_0x208b60[_0x859e('0x65')]){_0x208b60['mailbox']=_0x208b60[_0x859e('0x5a')];_0x208b60['VoiceMail']={'mailbox':_0x208b60[_0x859e('0x5a')],'password':_0x208b60[_0x859e('0x3a')],'fullname':_0x208b60['fullname'],'email':_0x208b60[_0x859e('0x66')]};}if(_0x208b60['role']===_0x859e('0x21')){if(!_0x208b60[_0x859e('0x67')])_0x208b60['permissions']=[_0x859e('0x68'),'102',_0x859e('0x69'),_0x859e('0x6a'),'110','104',_0x859e('0x6b'),_0x859e('0x6c'),_0x859e('0x6d'),_0x859e('0x6e'),_0x859e('0x6f'),_0x859e('0x70'),_0x859e('0x71'),_0x859e('0x72'),_0x859e('0x73')];}_0x19d84d(_0x208b60);}catch(_0x37a3f0){_0x390560(_0x37a3f0);}});}exports[_0x859e('0x74')]=function(_0x19e66f,_0x57ad3b){if(_0x19e66f[_0x859e('0x27')][_0x859e('0x25')]===_0x859e('0x21'))throw new Error('Unauthorized');if(_0x19e66f[_0x859e('0x54')][_0x859e('0x25')]===_0x859e('0x27')&&_0x19e66f[_0x859e('0x27')][_0x859e('0x25')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x19e66f['body'][_0x859e('0x25')]===_0x859e('0x75')&&_0x19e66f[_0x859e('0x27')][_0x859e('0x25')]!==_0x859e('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x859e('0x76')]([_0x19e66f[_0x859e('0x54')]])['then'](function(){return validateUser(_0x19e66f['body']);})[_0x859e('0x20')](function(_0x4e19bc){return updateUser(_0x4e19bc)[_0x859e('0x20')](function(_0x1a526b){if(_0x1a526b[_0x859e('0x25')]===_0x859e('0x75')){_0x1a526b[_0x859e('0x77')]=_0x19e66f['user'][_0x859e('0x77')];delete _0x1a526b[_0x859e('0x78')];}return _0x1a526b;});})[_0x859e('0x20')](function(_0x2b9cae){return db[_0x859e('0x34')]['create'](_0x2b9cae,{'include':[{'model':db[_0x859e('0x79')],'as':_0x859e('0x79')}]});})[_0x859e('0x20')](function(_0x42e546){if(_0x19e66f[_0x859e('0x54')][_0x859e('0x25')]===_0x859e('0x27'))return _0x42e546;if(_0x19e66f[_0x859e('0x27')]['role']!==_0x859e('0x27'))return _0x42e546;return db[_0x859e('0x7a')][_0x859e('0x2d')]({'where':{'name':_0x42e546['role']==='agent'?'Agents':_0x859e('0x29'),'userProfileId':_0x19e66f['user'][_0x859e('0x78')]},'raw':!![]})['then'](function(_0x464c18){if(!_0x464c18||_0x464c18['autoAssociation']!=0x0)return _0x42e546;return db[_0x859e('0x30')][_0x859e('0x74')]({'name':_0x42e546[_0x859e('0x2f')],'resourceId':_0x42e546['id'],'type':_0x464c18[_0x859e('0x2f')],'sectionId':_0x464c18['id']},{})[_0x859e('0x20')](function(){return _0x42e546;});})[_0x859e('0x53')](function(_0x30c5b4){logger['error'](_0x859e('0x7b'),_0x30c5b4);throw _0x30c5b4;});})['then'](respondWithResult(_0x57ad3b,0xc9))[_0x859e('0x53')](handleError(_0x57ad3b,null));};exports[_0x859e('0x7c')]=function(_0x3c6853,_0x1d68f4){var _0xd3d82c=_0x3c6853['body'];var _0x40c00b=[];if(_0x3c6853[_0x859e('0x27')][_0x859e('0x25')]==='agent')throw new Error(_0x859e('0x7d'));if(_[_0x859e('0x7e')](_0xd3d82c,[_0x859e('0x25'),_0x859e('0x27')])&&_0x3c6853['user'][_0x859e('0x25')]!==_0x859e('0x75')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x859e('0x7e')](_0xd3d82c,[_0x859e('0x25'),'admin'])&&_0x3c6853[_0x859e('0x27')][_0x859e('0x25')]!==_0x859e('0x75')){throw new Error(_0x859e('0x7f'));}return licenseUtil[_0x859e('0x76')](_0xd3d82c)['then'](function(){return validateUser(_0xd3d82c[0x0]);})[_0x859e('0x20')](function(){for(var _0x2f8d06=0x1;_0x2f8d06<_0xd3d82c[_0x859e('0x63')];_0x2f8d06++){var _0x4be59f=_0xd3d82c[_0x2f8d06-0x1][_0x859e('0x5a')];if(!_0xd3d82c[_0x2f8d06][_0x859e('0x5a')])_0xd3d82c[_0x2f8d06][_0x859e('0x5a')]=_0x4be59f+0x1;_0x40c00b[_0x859e('0x44')](validateUser(_0xd3d82c[_0x2f8d06]));}return Promise[_0x859e('0x52')](_0x40c00b);})[_0x859e('0x20')](function(){_0x40c00b=[];for(var _0x1eada8=0x0;_0x1eada8<_0xd3d82c[_0x859e('0x63')];_0x1eada8++){_0x40c00b['push'](updateUser(_0xd3d82c[_0x1eada8]));}return Promise[_0x859e('0x52')](_0x40c00b);})[_0x859e('0x20')](function(){_0x40c00b=_0xd3d82c[_0x859e('0x36')](function(_0x2567e9){return db['User'][_0x859e('0x74')](_0x2567e9,{'include':[{'model':db[_0x859e('0x79')],'as':_0x859e('0x79')}]})[_0x859e('0x20')](function(_0x59d8f6){_0x2567e9['id']=_0x59d8f6['id'];return _0x2567e9;});});return Promise['all'](_0x40c00b);})[_0x859e('0x20')](function(_0x3cccd1){if(_0x3c6853[_0x859e('0x54')][_0x859e('0x25')]==='user')return _0x3cccd1;if(_0x3c6853['user'][_0x859e('0x25')]!=='user')return _0x3cccd1;var _0x264318=_['some'](_0x3cccd1,function(_0x525898){return _0x525898[_0x859e('0x25')]===_0x859e('0x21')||_0x525898[_0x859e('0x25')]===_0x859e('0x80');});if(!_0x264318)return _0x3cccd1;return db[_0x859e('0x7a')][_0x859e('0x45')]({'where':{'name':{'$or':[_0x859e('0x28'),_0x859e('0x29')]},'userProfileId':_0x3c6853[_0x859e('0x27')]['userProfileId']},'raw':!![]})[_0x859e('0x20')](function(_0x195d01){if(_[_0x859e('0x81')](_0x195d01)||!_[_0x859e('0x7e')](_0x195d01,['autoAssociation',0x0]))return _0x3cccd1;_0x40c00b=[];var _0x4f2db3=_(_0x195d01)[_0x859e('0x36')](function(_0xdf5154){if(_0xdf5154[_0x859e('0x82')]===0x1)return;return _0xdf5154[_0x859e('0x2f')]===_0x859e('0x28')?'agent':_0x859e('0x80');})[_0x859e('0x83')]()[_0x859e('0x2e')]();for(var _0x53502a=0x0;_0x53502a<_0x3cccd1[_0x859e('0x63')];_0x53502a++){if(!_['includes'](_0x4f2db3,_0x3cccd1[_0x53502a][_0x859e('0x25')]))return;var _0x54342d=_0x3cccd1[_0x53502a][_0x859e('0x25')]===_0x859e('0x21')?_0x859e('0x28'):_0x859e('0x29');_0x40c00b[_0x859e('0x44')](db['UserProfileResource']['create']({'name':_0x3cccd1[_0x53502a][_0x859e('0x2f')],'resourceId':_0x3cccd1[_0x53502a]['id'],'type':_0x54342d,'sectionId':_[_0x859e('0x2d')](_0x195d01,[_0x859e('0x2f'),_0x54342d])['id']},{}));}return Promise[_0x859e('0x52')](_0x40c00b);});})[_0x859e('0x20')](respondWithResult(_0x1d68f4,0xc9))[_0x859e('0x53')](handleError(_0x1d68f4,null));};exports[_0x859e('0x84')]=function(_0xeffa19,_0x56cce0){if(_0xeffa19[_0x859e('0x54')]['id']){delete _0xeffa19[_0x859e('0x54')]['id'];}return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0xeffa19['params']['id']}})[_0x859e('0x20')](function(_0xa45f4){if(!_0xa45f4)return null;if(_0xa45f4['id']===_0xeffa19[_0x859e('0x27')]['id']){if(!_0xeffa19[_0x859e('0x54')]['oldPassword']||!_0xeffa19[_0x859e('0x54')][_0x859e('0x85')]){throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xa45f4[_0x859e('0x88')](_0xeffa19[_0x859e('0x54')][_0x859e('0x89')])){throw new db[(_0x859e('0x86'))]['ValidationError']('Wrong\x20credentials');}if(_0xeffa19[_0x859e('0x54')][_0x859e('0x89')]===_0xeffa19[_0x859e('0x54')][_0x859e('0x85')]){throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))](_0x859e('0x8a'));}}else if(_0xeffa19['user'][_0x859e('0x25')]===_0x859e('0x75')){if(!_0xeffa19[_0x859e('0x54')][_0x859e('0x85')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xeffa19[_0x859e('0x27')][_0x859e('0x25')]===_0x859e('0x27')){if(!_0xeffa19[_0x859e('0x54')][_0x859e('0x85')]){throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))](_0x859e('0x8b'));}if(_0xa45f4[_0x859e('0x25')]!==_0x859e('0x21')){throw new db[(_0x859e('0x86'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))]('Unauthorized');}return _0xa45f4;})[_0x859e('0x20')](handleEntityNotFound(_0x56cce0,null))['then'](function(_0x4fe1bd){return db['Setting'][_0x859e('0x8c')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x859e('0x8d')]})['then'](function(_0xe6e12d){if(_0xe6e12d['securePassword'])authService[_0x859e('0x5d')](_0xeffa19[_0x859e('0x54')][_0x859e('0x85')]);if(!_0xe6e12d['enforcePasswordHistory']||!_0x4fe1bd[_0x859e('0x3c')])return _0x4fe1bd;authService['validatePasswordHistory'](_0xeffa19['body']['newPassword'],_0x4fe1bd[_0x859e('0x3c')],_0xe6e12d[_0x859e('0x8d')]);return _0x4fe1bd;})['then'](saveUpdates({'password':_0xeffa19[_0x859e('0x54')][_0x859e('0x85')],'passwordResetAt':_0xeffa19[_0x859e('0x27')]['id']==_0xeffa19['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xeffa19[_0x859e('0x54')][_0x859e('0x85')],_0x4fe1bd['previousPasswords'])},null));})[_0x859e('0x20')](respondWithResult(_0x56cce0,null))[_0x859e('0x53')](handleError(_0x56cce0,null));};exports[_0x859e('0x8e')]=function(_0x17fdc1,_0xb54182){var _0x2cf606=_0x17fdc1['body']['channel'];return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x17fdc1[_0x859e('0x55')]['id']},'attributes':['id',_0x859e('0x2f'),'role',_0x859e('0x8f'),_0x859e('0x90'),_0x859e('0x91'),_0x859e('0x92')]})[_0x859e('0x20')](handleEntityNotFound(_0xb54182,null))['then'](function(_0x2b96fe){if(_0x2b96fe){if(!utils[_0x859e('0x93')](_0x2cf606)){throw new db['Sequelize'][(_0x859e('0x87'))](_0x859e('0x94'));}return _0x2b96fe[_0x859e('0x95')+_[_0x859e('0x96')](_0x2cf606[_0x859e('0x97')]())+'Queues'](_0x17fdc1['body'][_0x859e('0x58')],{'penalty':_0x17fdc1[_0x859e('0x54')][_0x859e('0x98')]||0x0})['spread'](function(_0x2b11e6){for(var _0x502d1f=0x0;_0x502d1f<_0x17fdc1[_0x859e('0x54')][_0x859e('0x58')][_0x859e('0x63')];_0x502d1f+=0x1){var _0x222fce={'UserId':Number(_0x17fdc1[_0x859e('0x55')]['id'])};_0x222fce[_[_0x859e('0x96')](_0x2cf606['toLowerCase']())+_0x859e('0x99')]=Number(_0x17fdc1['body']['ids'][_0x502d1f]);socket['emit']('user'+_[_0x859e('0x96')](_0x2cf606[_0x859e('0x97')]())+_0x859e('0x9a'),_0x222fce);}return _0x2b11e6;})[_0x859e('0x20')](function(){if(_0x2cf606===_0x859e('0x9b')){return db['VoiceQueue'][_0x859e('0x45')]({'where':{'id':_0x17fdc1[_0x859e('0x54')][_0x859e('0x58')]||[]},'raw':!![],'attributes':['id',_0x859e('0x2f')]});}})[_0x859e('0x20')](function(_0x9e2bf){var _0x20f2e6=_0x2b96fe[_0x859e('0x24')]({'plain':!![]});var _0xed1591=[];if(_0x2cf606===_0x859e('0x9b')&&_0x20f2e6[_0x859e('0x25')]===_0x859e('0x21')&&_0x20f2e6[_0x859e('0x8f')]){for(let _0x36b706=0x0;_0x36b706<_0x9e2bf[_0x859e('0x63')];_0x36b706+=0x1){_0xed1591[_0x859e('0x44')]({'membername':_0x20f2e6['name'],'UserId':_0x20f2e6['id'],'queue_name':_0x9e2bf[_0x36b706][_0x859e('0x2f')],'VoiceQueueId':_0x9e2bf[_0x36b706]['id'],'interface':_['isNil'](_0x20f2e6[_0x859e('0x92')])?util['format'](_0x859e('0x9c'),_0x20f2e6[_0x859e('0x2f')]):_0x20f2e6[_0x859e('0x92')],'paused':_0x20f2e6['voicePause']||![],'penalty':_0x17fdc1['body'][_0x859e('0x98')]||0x0});}return Promise[_0x859e('0x52')](_0xed1591[_0x859e('0x36')](function(_0x3d5b89){return db['UserVoiceQueueRt']['upsert'](_0x3d5b89);}));}return _0x2b96fe;});}})[_0x859e('0x20')](respondWithStatusCode(_0xb54182,null))['catch'](handleError(_0xb54182,null));};exports[_0x859e('0x9d')]=function(_0x2037a5,_0x5e6f81){var _0x5699bc,_0xe573aa;return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x2037a5[_0x859e('0x55')]['id']},'attributes':['id',_0x859e('0x2f'),_0x859e('0x25')]})['then'](handleEntityNotFound(_0x5e6f81,null))[_0x859e('0x20')](function(_0x1757ef){if(_0x1757ef){_0x5699bc=_0x1757ef;if(!_0x2037a5[_0x859e('0x3f')][_0x859e('0x9e')]||!utils[_0x859e('0x93')](_0x2037a5['query'][_0x859e('0x9e')])){throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))](_0x859e('0x94'));}return _0x1757ef[_0x859e('0x9f')+_[_0x859e('0x96')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x9e')][_0x859e('0x97')]())+_0x859e('0xa0')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x58')]);}})[_0x859e('0x20')](function(_0x1b96f7){if(_[_0x859e('0xa1')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x58')])){for(var _0x586448=0x0;_0x586448<_0x2037a5[_0x859e('0x3f')]['ids'][_0x859e('0x63')];_0x586448+=0x1){_0xe573aa={'UserId':Number(_0x2037a5['params']['id'])};_0xe573aa[_[_0x859e('0x96')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x9e')]['toLowerCase']())+_0x859e('0x99')]=Number(_0x2037a5[_0x859e('0x3f')][_0x859e('0x58')][_0x586448]);socket[_0x859e('0x22')]('user'+_[_0x859e('0x96')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x9e')][_0x859e('0x97')]())+_0x859e('0xa2'),_0xe573aa);}}else{_0xe573aa={'UserId':Number(_0x2037a5[_0x859e('0x55')]['id'])};_0xe573aa[_[_0x859e('0x96')](_0x2037a5[_0x859e('0x3f')][_0x859e('0x9e')][_0x859e('0x97')]())+_0x859e('0x99')]=Number(_0x2037a5[_0x859e('0x3f')][_0x859e('0x58')]);socket[_0x859e('0x22')](_0x859e('0x27')+_[_0x859e('0x96')](_0x2037a5[_0x859e('0x3f')]['channel'][_0x859e('0x97')]())+_0x859e('0xa2'),_0xe573aa);}return _0x1b96f7;})['then'](function(){if(_0x2037a5['query'][_0x859e('0x9e')]===_0x859e('0x9b')){return db[_0x859e('0xa3')][_0x859e('0x23')]({'where':{'UserId':_0x2037a5[_0x859e('0x55')]['id'],'VoiceQueueId':_0x2037a5['query'][_0x859e('0x58')]},'individualHooks':!![]})[_0x859e('0x20')](function(){return _0x5699bc;});}return _0x5699bc;})['then'](respondWithStatusCode(_0x5e6f81,null))[_0x859e('0x53')](handleError(_0x5e6f81,null));};exports['addAvatar']=function(_0x1174d8,_0x538686){_0x1174d8[_0x859e('0x54')][_0x859e('0xa4')]=_0x1174d8['file'][_0x859e('0xa5')];return db[_0x859e('0x34')]['find']({'where':{'id':_0x1174d8['params']['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x538686,null))['then'](saveUpdates(_0x1174d8[_0x859e('0x54')],null))[_0x859e('0x20')](respondWithResult(_0x538686,null))[_0x859e('0x53')](handleError(_0x538686,null));};exports[_0x859e('0xa6')]=function(_0x2efeaf,_0x3e167f){var _0x21d1e1=path['join'](config[_0x859e('0xa7')],_0x859e('0xa8'));return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x2efeaf[_0x859e('0x55')]['id']},'attributes':['id',_0x859e('0xa4')],'raw':!![]})['then'](handleEntityNotFound(_0x3e167f,null))[_0x859e('0x20')](function(_0x5cb9a5){if(_0x5cb9a5){if(_[_0x859e('0x5f')](_0x5cb9a5[_0x859e('0xa4')])){return _0x3e167f[_0x859e('0xa9')](_0x21d1e1);}else{if(!fs[_0x859e('0xaa')](path['join'](config[_0x859e('0xa7')],_0x859e('0xab'),_0x5cb9a5[_0x859e('0xa4')]))){return _0x3e167f['download'](_0x21d1e1);}return _0x3e167f[_0x859e('0xa9')](path[_0x859e('0xac')](config['root'],_0x859e('0xab'),_0x5cb9a5[_0x859e('0xa4')]));}}})[_0x859e('0x53')](handleError(_0x3e167f,null));};exports['getOpenTabs']=function(_0x56644c,_0x9c9952){return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x56644c[_0x859e('0x55')]['id']},'attributes':['id']})[_0x859e('0x20')](handleEntityNotFound(_0x9c9952,null))[_0x859e('0x20')](function(_0x13c08f){var _0x4298e3=[];values=_0x13c08f[_0x859e('0x49')];_0x4298e3['push'](get_open_tabs(_0x859e('0x48'),_0x13c08f['dataValues']));_0x4298e3[_0x859e('0x44')](get_open_tabs('sms',_0x13c08f['dataValues']));_0x4298e3[_0x859e('0x44')](get_open_tabs('openchannel',_0x13c08f[_0x859e('0x49')]));_0x4298e3[_0x859e('0x44')](get_open_tabs(_0x859e('0x50'),_0x13c08f[_0x859e('0x49')]));_0x4298e3[_0x859e('0x44')](get_open_tabs('fax',_0x13c08f[_0x859e('0x49')]));_0x4298e3[_0x859e('0x44')](get_open_tabs(_0x859e('0x51'),_0x13c08f[_0x859e('0x49')]));return Promise[_0x859e('0x52')](_0x4298e3);})[_0x859e('0x20')](function(_0x1419b2){if(_0x1419b2){var _0x521115=_[_0x859e('0x36')](values[_0x859e('0xad')],function(_0x51e97d){return{'channel':_0x859e('0xae'),'id':_0x51e97d['id'],'createdAt':_0x51e97d['createdAt']};});var _0x515e30=_[_0x859e('0x36')](values['FaxOpenTabs'],function(_0x56922d){return{'channel':_0x859e('0xaf'),'id':_0x56922d['id'],'createdAt':_0x56922d[_0x859e('0xb0')]};});var _0x28760d=_[_0x859e('0x36')](values[_0x859e('0xb1')],function(_0x5e1dbf){return{'channel':'OPENCHANNEL','id':_0x5e1dbf['id'],'createdAt':_0x5e1dbf['createdAt']};});var _0x3b0eac=_[_0x859e('0x36')](values[_0x859e('0xb2')],function(_0x4c6179){return{'channel':_0x859e('0xb3'),'id':_0x4c6179['id'],'createdAt':_0x4c6179[_0x859e('0xb0')]};});var _0x24f7e0=_[_0x859e('0x36')](values[_0x859e('0xb4')],function(_0x19851e){return{'channel':_0x859e('0xb5'),'id':_0x19851e['id'],'createdAt':_0x19851e[_0x859e('0xb0')]};});var _0x56a62f=_[_0x859e('0x36')](values[_0x859e('0xb6')],function(_0x4358c6){return{'channel':_0x859e('0xb7'),'id':_0x4358c6['id'],'createdAt':_0x4358c6[_0x859e('0xb0')]};});var _0x124907=_[_0x859e('0xb8')](_0x521115,_0x515e30,_0x28760d,_0x3b0eac,_0x24f7e0,_0x56a62f);var _0x52dd13={'count':_0x124907[_0x859e('0x63')],'rows':_0x124907};return _0x52dd13;}else return null;})[_0x859e('0x20')](respondWithResult(_0x9c9952,null))['catch'](handleError(_0x9c9952,null));};exports[_0x859e('0xb9')]=function(_0x20e3cc,_0xd1ed7f){var _0x5da410={};return db['User'][_0x859e('0x8c')]({'where':{'id':_0x20e3cc[_0x859e('0x55')]['id']}})[_0x859e('0x20')](function(_0x480efb){if(!_0x480efb){throw new APINotFoundError(util[_0x859e('0xba')](_0x859e('0xbb'),_0x20e3cc['params']['id']));}return contacts[_0x859e('0x56')]();})[_0x859e('0x20')](function(_0xc0b858){_0x20e3cc['query'][_0x859e('0x34')]=_0x20e3cc[_0x859e('0x55')]['id'];_0x5da410=qs[_0x859e('0x4a')](_0xc0b858,_0x20e3cc);if(_0x20e3cc['query'][_0x859e('0xbc')](_0x859e('0x40'))){_0x5da410[_0x859e('0x41')]=[{'model':db[_0x859e('0xbd')],'as':_0x859e('0xbe'),'required':![]},{'model':db[_0x859e('0xbf')],'as':_0x859e('0xc0'),'attributes':['id',_0x859e('0x2f'),_0x859e('0xc1')],'where':_0x20e3cc['query'][_0x859e('0xc2')]?{'id':_0x20e3cc[_0x859e('0x3f')][_0x859e('0xc2')]}:undefined,'required':_0x20e3cc[_0x859e('0x3f')][_0x859e('0xc2')]?!![]:![]}];}return contacts[_0x859e('0x45')](_0x20e3cc[_0x859e('0x3f')],_0x20e3cc[_0x859e('0x27')],_0x5da410,_0xc0b858);})['then'](respondWithFilteredResult(_0xd1ed7f,_0x5da410))[_0x859e('0x53')](APIHandleError(_0xd1ed7f));};exports['getQueues']=function(_0x29c602,_0x2e4200){var _0x338866;var _0x28119c={};var _0x3e2f6d;return db['User']['findOne']({'where':{'id':_0x29c602[_0x859e('0x55')]['id']},'attributes':['id','name',_0x859e('0x25')]})[_0x859e('0x20')](handleEntityNotFound(_0x2e4200,null))['then'](function(_0x3c3536){if(!utils[_0x859e('0x93')](_0x29c602[_0x859e('0x3f')]['channel'])){throw new db[(_0x859e('0x86'))]['ValidationError'](_0x859e('0x94'));}_0x338866=_0x3c3536;var _0x3572b0={};_0x3572b0[_0x859e('0xc3')]=_[_0x859e('0xc4')](db[_['capitalize'](_0x29c602[_0x859e('0x3f')][_0x859e('0x9e')])+_0x859e('0xc5')][_0x859e('0x35')]);_0x3572b0[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x29c602[_0x859e('0x3f')]);_0x3572b0[_0x859e('0xc6')]=_['intersection'](_0x3572b0[_0x859e('0xc3')],_0x3572b0[_0x859e('0x3f')]);_0x28119c['attributes']=_[_0x859e('0xc7')](_0x3572b0['model'],qs['fields'](_0x29c602['query'][_0x859e('0xc8')]));_0x28119c[_0x859e('0x4d')]=_0x28119c[_0x859e('0x4d')][_0x859e('0x63')]?_0x28119c[_0x859e('0x4d')]:_0x3572b0['model'];_0x28119c[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x29c602[_0x859e('0x3f')][_0x859e('0xca')]);_0x28119c[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x29c602[_0x859e('0x3f')],_0x3572b0[_0x859e('0xc6')]));if(_0x29c602['query'][_0x859e('0x2a')]){_0x28119c[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0x28119c[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x28119c[_0x859e('0x4d')],function(_0x5379d7){var _0x3927b0={};_0x3927b0[_0x5379d7]={'$like':'%'+_0x29c602[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x3927b0;})});}_0x28119c=_['merge']({},_0x28119c,_0x29c602['options']);switch(_0x338866[_0x859e('0x25')]){case _0x859e('0x75'):return db[_[_0x859e('0x96')](_0x29c602[_0x859e('0x3f')][_0x859e('0x9e')])+'Queue'][_0x859e('0x45')](_0x28119c);case _0x859e('0x27'):case _0x859e('0x21'):return _0x338866['get'+_[_0x859e('0x96')](_0x29c602[_0x859e('0x3f')][_0x859e('0x9e')])+_0x859e('0xa0')](_0x28119c);default:throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))](_0x859e('0xcd'));}})[_0x859e('0x20')](function(_0x2f13b6){_0x3e2f6d=_0x2f13b6['length'];if(!_0x29c602[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x28119c[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x29c602[_0x859e('0x3f')][_0x859e('0x1c')]);_0x28119c['offset']=qs[_0x859e('0x1b')](_0x29c602['query'][_0x859e('0x1b')]);}switch(_0x338866[_0x859e('0x25')]){case'admin':return db[_[_0x859e('0x96')](_0x29c602[_0x859e('0x3f')]['channel'])+_0x859e('0xc5')][_0x859e('0x45')](_0x28119c);case _0x859e('0x27'):case _0x859e('0x21'):return _0x338866[_0x859e('0x24')+_[_0x859e('0x96')](_0x29c602[_0x859e('0x3f')][_0x859e('0x9e')])+'Queues'](_0x28119c);}})[_0x859e('0x20')](function(_0x46f506){return{'count':_0x3e2f6d,'rows':_0x46f506};})[_0x859e('0x20')](respondWithResult(_0x2e4200,null))[_0x859e('0x53')](handleError(_0x2e4200,null));};exports[_0x859e('0xcf')]=function(_0xee47ff,_0x2b7b9a){var _0x3a3f17={};var _0x3cfd83={};var _0x4cbed1;var _0x548e69;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0xee47ff[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x2b7b9a,null))[_0x859e('0x20')](function(_0x4ca907){if(_0x4ca907){_0x4cbed1=_0x4ca907;_0x3cfd83[_0x859e('0xc3')]=_[_0x859e('0xc4')](db[_0x859e('0xa3')][_0x859e('0x35')]);_0x3cfd83[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0xee47ff['query']);_0x3cfd83[_0x859e('0xc6')]=_['intersection'](_0x3cfd83[_0x859e('0xc3')],_0x3cfd83[_0x859e('0x3f')]);_0x3a3f17[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x3cfd83['model'],qs['fields'](_0xee47ff[_0x859e('0x3f')][_0x859e('0xc8')]));_0x3a3f17[_0x859e('0x4d')]=_0x3a3f17[_0x859e('0x4d')][_0x859e('0x63')]?_0x3a3f17[_0x859e('0x4d')]:_0x3cfd83['model'];_0x3a3f17[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0xee47ff[_0x859e('0x3f')]['sort']);_0x3a3f17[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0xee47ff['query'],_0x3cfd83['filters']));if(_0xee47ff[_0x859e('0x3f')][_0x859e('0x2a')]){_0x3a3f17[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0x3a3f17[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x3a3f17[_0x859e('0x4d')],function(_0x8c99f5){var _0x53f940={};_0x53f940[_0x8c99f5]={'$like':'%'+_0xee47ff[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x53f940;})});}_0x3a3f17=_[_0x859e('0x4c')]({},_0x3a3f17,_0xee47ff[_0x859e('0xd0')]);return _0x4cbed1[_0x859e('0xcf')](_0x3a3f17);}})[_0x859e('0x20')](function(_0x8a55f4){if(_0x8a55f4){_0x548e69=_0x8a55f4['length'];if(!_0xee47ff[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x3a3f17[_0x859e('0x1c')]=qs['limit'](_0xee47ff[_0x859e('0x3f')]['limit']);_0x3a3f17['offset']=qs[_0x859e('0x1b')](_0xee47ff[_0x859e('0x3f')][_0x859e('0x1b')]);}return _0x4cbed1['getVoiceQueuesRt'](_0x3a3f17);}})[_0x859e('0x20')](function(_0x396a0c){if(_0x396a0c){return _0x396a0c?{'count':_0x548e69,'rows':_0x396a0c}:null;}})[_0x859e('0x20')](respondWithResult(_0x2b7b9a,null))['catch'](handleError(_0x2b7b9a,null));};exports[_0x859e('0xd1')]=function(_0xb58996,_0x521480){var _0x46dd45={};var _0x5f4632={};var _0x28489f;var _0x31a2cc;return db['User'][_0x859e('0x8c')]({'where':{'id':_0xb58996['params']['id']}})['then'](handleEntityNotFound(_0x521480,null))[_0x859e('0x20')](function(_0x224dd9){if(_0x224dd9){_0x28489f=_0x224dd9;_0x5f4632['model']=_[_0x859e('0xc4')](db[_0x859e('0xd2')][_0x859e('0x35')]);_0x5f4632[_0x859e('0x3f')]=_['keys'](_0xb58996[_0x859e('0x3f')]);_0x5f4632[_0x859e('0xc6')]=_[_0x859e('0xc7')](_0x5f4632['model'],_0x5f4632[_0x859e('0x3f')]);_0x46dd45[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x5f4632[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0xb58996['query'][_0x859e('0xc8')]));_0x46dd45[_0x859e('0x4d')]=_0x46dd45[_0x859e('0x4d')]['length']?_0x46dd45[_0x859e('0x4d')]:_0x5f4632[_0x859e('0xc3')];_0x46dd45[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0xb58996[_0x859e('0x3f')][_0x859e('0xca')]);_0x46dd45[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_['pick'](_0xb58996[_0x859e('0x3f')],_0x5f4632[_0x859e('0xc6')]));if(_0xb58996[_0x859e('0x3f')]['filter']){_0x46dd45[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0x46dd45[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x46dd45[_0x859e('0x4d')],function(_0x6e496d){var _0x45a44a={};_0x45a44a[_0x6e496d]={'$like':'%'+_0xb58996[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x45a44a;})});}_0x46dd45=_[_0x859e('0x4c')]({},_0x46dd45,_0xb58996[_0x859e('0xd0')]);return _0x28489f[_0x859e('0xd1')](_0x46dd45);}})[_0x859e('0x20')](function(_0x2ad699){if(_0x2ad699){_0x31a2cc=_0x2ad699['length'];if(!_0xb58996[_0x859e('0x3f')][_0x859e('0xbc')]('nolimit')){_0x46dd45[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0xb58996[_0x859e('0x3f')][_0x859e('0x1c')]);_0x46dd45[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0xb58996[_0x859e('0x3f')][_0x859e('0x1b')]);}return _0x28489f['getGroups'](_0x46dd45);}})[_0x859e('0x20')](function(_0x562ee8){if(_0x562ee8){return _0x562ee8?{'count':_0x31a2cc,'rows':_0x562ee8}:null;}})['then'](respondWithResult(_0x521480,null))[_0x859e('0x53')](handleError(_0x521480,null));};exports[_0x859e('0xd3')]=function(_0x3ce490,_0x396739){var _0x379bdb={'raw':!![],'where':{}};var _0x45995c={};var _0x10a8ff={'count':0x0,'rows':[]};return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x3ce490[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x396739,null))[_0x859e('0x20')](function(_0x3579e6){if(_0x3579e6){_0x45995c[_0x859e('0xc3')]=_[_0x859e('0xc4')](db[_0x859e('0xd4')][_0x859e('0x35')]);_0x45995c[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x3ce490[_0x859e('0x3f')]);_0x45995c[_0x859e('0xc6')]=_['intersection'](_0x45995c[_0x859e('0xc3')],_0x45995c[_0x859e('0x3f')]);_0x379bdb[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x45995c['model'],qs['fields'](_0x3ce490[_0x859e('0x3f')][_0x859e('0xc8')]));_0x379bdb['attributes']=_0x379bdb['attributes'][_0x859e('0x63')]?_0x379bdb['attributes']:_0x45995c[_0x859e('0xc3')];if(!_0x3ce490[_0x859e('0x3f')]['hasOwnProperty']('nolimit')){_0x379bdb[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x3ce490[_0x859e('0x3f')][_0x859e('0x1c')]);_0x379bdb[_0x859e('0x1b')]=qs['offset'](_0x3ce490[_0x859e('0x3f')][_0x859e('0x1b')]);}_0x379bdb['order']=qs[_0x859e('0xca')](_0x3ce490['query'][_0x859e('0xca')]);_0x379bdb['where']=qs['filters'](_[_0x859e('0xcc')](_0x3ce490[_0x859e('0x3f')],_0x45995c['filters']));_0x379bdb[_0x859e('0xcb')]['UserId']=_0x3579e6['id'];if(_0x3ce490[_0x859e('0x3f')][_0x859e('0x2a')]){_0x379bdb[_0x859e('0xcb')]=_['merge'](_0x379bdb[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x379bdb[_0x859e('0x4d')],function(_0x5178eb){var _0x400a99={};_0x400a99[_0x5178eb]={'$like':'%'+_0x3ce490['query'][_0x859e('0x2a')]+'%'};return _0x400a99;})});}_0x379bdb=_[_0x859e('0x4c')]({},_0x379bdb,_0x3ce490[_0x859e('0xd0')]);return db['VoiceRecording'][_0x859e('0x1a')]({'where':_0x379bdb[_0x859e('0xcb')]})[_0x859e('0x20')](function(_0x2c5f8b){_0x10a8ff[_0x859e('0x1a')]=_0x2c5f8b;if(_0x3ce490['query'][_0x859e('0x40')]){_0x379bdb[_0x859e('0x41')]=[{'all':!![]}];}return db[_0x859e('0xd4')][_0x859e('0x45')](_0x379bdb);})[_0x859e('0x20')](function(_0x55263c){_0x10a8ff['rows']=_0x55263c;return _0x10a8ff;});}})['then'](respondWithFilteredResult(_0x396739,_0x379bdb))[_0x859e('0x53')](handleError(_0x396739,null));};exports['getScreenRecordings']=function(_0x5a2953,_0x3fb3c9){var _0x45c080={'raw':!![],'where':{}};var _0x2c5cb8={};var _0x32a0bb={'count':0x0,'rows':[]};return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x5a2953[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x3fb3c9,null))[_0x859e('0x20')](function(_0x49c83c){if(_0x49c83c){_0x2c5cb8['model']=_[_0x859e('0xc4')](db['ScreenRecording'][_0x859e('0x35')]);_0x2c5cb8[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x5a2953[_0x859e('0x3f')]);_0x2c5cb8[_0x859e('0xc6')]=_[_0x859e('0xc7')](_0x2c5cb8[_0x859e('0xc3')],_0x2c5cb8['query']);_0x45c080[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x2c5cb8[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x5a2953[_0x859e('0x3f')][_0x859e('0xc8')]));_0x45c080[_0x859e('0x4d')]=_0x45c080[_0x859e('0x4d')][_0x859e('0x63')]?_0x45c080[_0x859e('0x4d')]:_0x2c5cb8['model'];if(!_0x5a2953[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x45c080[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x5a2953[_0x859e('0x3f')]['limit']);_0x45c080['offset']=qs[_0x859e('0x1b')](_0x5a2953[_0x859e('0x3f')][_0x859e('0x1b')]);}_0x45c080[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x5a2953['query'][_0x859e('0xca')]);_0x45c080[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x5a2953[_0x859e('0x3f')],_0x2c5cb8['filters']));_0x45c080[_0x859e('0xcb')][_0x859e('0xd5')]=_0x49c83c['id'];if(_0x5a2953[_0x859e('0x3f')][_0x859e('0x2a')]){_0x45c080[_0x859e('0xcb')]=_['merge'](_0x45c080[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x45c080['attributes'],function(_0xc72713){var _0x438968={};_0x438968[_0xc72713]={'$like':'%'+_0x5a2953[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x438968;})});}_0x45c080=_[_0x859e('0x4c')]({},_0x45c080,_0x5a2953[_0x859e('0xd0')]);return db['ScreenRecording'][_0x859e('0x1a')]({'where':_0x45c080[_0x859e('0xcb')]})[_0x859e('0x20')](function(_0x49b5df){_0x32a0bb[_0x859e('0x1a')]=_0x49b5df;if(_0x5a2953['query'][_0x859e('0x40')]){_0x45c080[_0x859e('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x859e('0x45')](_0x45c080);})[_0x859e('0x20')](function(_0x4d6e44){_0x32a0bb[_0x859e('0x46')]=_0x4d6e44;return _0x32a0bb;});}})[_0x859e('0x20')](respondWithFilteredResult(_0x3fb3c9,_0x45c080))[_0x859e('0x53')](handleError(_0x3fb3c9,null));};exports[_0x859e('0xd6')]=function(_0x33cab0,_0x4e5a6f){var _0x482366={};var _0x2dc869={};var _0x35703c;var _0x1bf980;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x33cab0['params']['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x4e5a6f,null))['then'](function(_0x4e413e){if(_0x4e413e){_0x35703c=_0x4e413e;_0x2dc869[_0x859e('0xc3')]=_['keys'](db[_0x859e('0xd7')][_0x859e('0x35')]);_0x2dc869['query']=_['keys'](_0x33cab0[_0x859e('0x3f')]);_0x2dc869['filters']=_['intersection'](_0x2dc869[_0x859e('0xc3')],_0x2dc869[_0x859e('0x3f')]);_0x482366['attributes']=_[_0x859e('0xc7')](_0x2dc869[_0x859e('0xc3')],qs['fields'](_0x33cab0[_0x859e('0x3f')][_0x859e('0xc8')]));_0x482366[_0x859e('0x4d')]=_0x482366['attributes']['length']?_0x482366[_0x859e('0x4d')]:_0x2dc869[_0x859e('0xc3')];_0x482366[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x33cab0[_0x859e('0x3f')][_0x859e('0xca')]);_0x482366[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x33cab0[_0x859e('0x3f')],_0x2dc869[_0x859e('0xc6')]));if(_0x33cab0[_0x859e('0x3f')][_0x859e('0x2a')]){_0x482366['where']=_[_0x859e('0x4c')](_0x482366[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x482366[_0x859e('0x4d')],function(_0x2fffd1){var _0x18cd1d={};_0x18cd1d[_0x2fffd1]={'$like':'%'+_0x33cab0['query'][_0x859e('0x2a')]+'%'};return _0x18cd1d;})});}_0x482366=_['merge']({},_0x482366,_0x33cab0[_0x859e('0xd0')]);return _0x35703c[_0x859e('0xd6')](_0x482366);}})[_0x859e('0x20')](function(_0x429693){if(_0x429693){_0x1bf980=_0x429693[_0x859e('0x63')];if(!_0x33cab0[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x482366[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x33cab0['query'][_0x859e('0x1c')]);_0x482366[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x33cab0['query'][_0x859e('0x1b')]);}return _0x35703c[_0x859e('0xd6')](_0x482366);}})['then'](function(_0x586e86){if(_0x586e86){return _0x586e86?{'count':_0x1bf980,'rows':_0x586e86}:null;}})['then'](respondWithResult(_0x4e5a6f,null))[_0x859e('0x53')](handleError(_0x4e5a6f,null));};exports[_0x859e('0xd8')]=function(_0x516c40,_0x20442b){var _0x2c6c5d={};var _0x52857f={};var _0xb50d4a;var _0x767ebb;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x516c40[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x20442b,null))['then'](function(_0x23be83){if(_0x23be83){_0xb50d4a=_0x23be83;_0x52857f[_0x859e('0xc3')]=_['keys'](db[_0x859e('0xd9')][_0x859e('0x35')]);_0x52857f[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x516c40[_0x859e('0x3f')]);_0x52857f['filters']=_[_0x859e('0xc7')](_0x52857f[_0x859e('0xc3')],_0x52857f['query']);_0x2c6c5d[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x52857f['model'],qs['fields'](_0x516c40[_0x859e('0x3f')][_0x859e('0xc8')]));_0x2c6c5d[_0x859e('0x4d')]=_0x2c6c5d[_0x859e('0x4d')][_0x859e('0x63')]?_0x2c6c5d['attributes']:_0x52857f[_0x859e('0xc3')];_0x2c6c5d[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x516c40[_0x859e('0x3f')][_0x859e('0xca')]);_0x2c6c5d[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x516c40[_0x859e('0x3f')],_0x52857f[_0x859e('0xc6')]));if(_0x516c40[_0x859e('0x3f')][_0x859e('0x2a')]){_0x2c6c5d[_0x859e('0xcb')]=_['merge'](_0x2c6c5d[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x2c6c5d[_0x859e('0x4d')],function(_0xc0f190){var _0xd9fca={};_0xd9fca[_0xc0f190]={'$like':'%'+_0x516c40['query'][_0x859e('0x2a')]+'%'};return _0xd9fca;})});}_0x2c6c5d=_[_0x859e('0x4c')]({},_0x2c6c5d,_0x516c40[_0x859e('0xd0')]);return _0xb50d4a[_0x859e('0xd8')](_0x2c6c5d);}})[_0x859e('0x20')](function(_0x896d3d){if(_0x896d3d){_0x767ebb=_0x896d3d[_0x859e('0x63')];if(!_0x516c40['query'][_0x859e('0xbc')](_0x859e('0xce'))){_0x2c6c5d[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x516c40[_0x859e('0x3f')][_0x859e('0x1c')]);_0x2c6c5d[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x516c40[_0x859e('0x3f')][_0x859e('0x1b')]);}return _0xb50d4a[_0x859e('0xd8')](_0x2c6c5d);}})[_0x859e('0x20')](function(_0x304fdb){if(_0x304fdb){return _0x304fdb?{'count':_0x767ebb,'rows':_0x304fdb}:null;}})[_0x859e('0x20')](respondWithResult(_0x20442b,null))['catch'](handleError(_0x20442b,null));};exports[_0x859e('0xda')]=function(_0x31add9,_0x225bdd){var _0x481ebb={'raw':!![],'where':{}};var _0x48ffde={};var _0x3a1ba6={'count':0x0,'rows':[]};return db[_0x859e('0x34')]['findOne']({'where':{'id':_0x31add9[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x225bdd,null))[_0x859e('0x20')](function(_0x79d78d){if(_0x79d78d){_0x48ffde[_0x859e('0xc3')]=_[_0x859e('0xc4')](db['MailInteraction'][_0x859e('0x35')]);_0x48ffde[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x31add9['query']);_0x48ffde[_0x859e('0xc6')]=_[_0x859e('0xc7')](_0x48ffde[_0x859e('0xc3')],_0x48ffde[_0x859e('0x3f')]);_0x481ebb['attributes']=_[_0x859e('0xc7')](_0x48ffde[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x31add9[_0x859e('0x3f')][_0x859e('0xc8')]));_0x481ebb[_0x859e('0x4d')]=_0x481ebb[_0x859e('0x4d')][_0x859e('0x63')]?_0x481ebb[_0x859e('0x4d')]:_0x48ffde[_0x859e('0xc3')];if(!_0x31add9[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x481ebb[_0x859e('0x1c')]=qs['limit'](_0x31add9[_0x859e('0x3f')][_0x859e('0x1c')]);_0x481ebb[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x31add9[_0x859e('0x3f')][_0x859e('0x1b')]);}_0x481ebb[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x31add9['query']['sort']);_0x481ebb[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x31add9['query'],_0x48ffde[_0x859e('0xc6')]));_0x481ebb['where'][_0x859e('0xd5')]=_0x79d78d['id'];if(_0x31add9['query'][_0x859e('0x2a')]){_0x481ebb[_0x859e('0xcb')]=_['merge'](_0x481ebb[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x481ebb['attributes'],function(_0x1cf3eb){var _0x58739a={};_0x58739a[_0x1cf3eb]={'$like':'%'+_0x31add9[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x58739a;})});}_0x481ebb=_[_0x859e('0x4c')]({},_0x481ebb,_0x31add9['options']);return db[_0x859e('0xdb')]['count']({'where':_0x481ebb[_0x859e('0xcb')]})['then'](function(_0x12108e){_0x3a1ba6['count']=_0x12108e;if(_0x31add9[_0x859e('0x3f')]['includeAll']){_0x481ebb[_0x859e('0x41')]=[{'all':!![]}];}return db[_0x859e('0xdb')][_0x859e('0x45')](_0x481ebb);})[_0x859e('0x20')](function(_0x173c6e){_0x3a1ba6[_0x859e('0x46')]=_0x173c6e;return _0x3a1ba6;});}})[_0x859e('0x20')](respondWithFilteredResult(_0x225bdd,_0x481ebb))['catch'](handleError(_0x225bdd,null));};exports['getSmsInteractions']=function(_0x13438a,_0x52f318){var _0xf6a380={};var _0x39b995={};var _0x1813fe;var _0x5a6de1;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x13438a['params']['id']}})['then'](handleEntityNotFound(_0x52f318,null))['then'](function(_0x4a65eb){if(_0x4a65eb){_0x1813fe=_0x4a65eb;_0x39b995[_0x859e('0xc3')]=_[_0x859e('0xc4')](db[_0x859e('0xdc')][_0x859e('0x35')]);_0x39b995[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x13438a['query']);_0x39b995[_0x859e('0xc6')]=_['intersection'](_0x39b995[_0x859e('0xc3')],_0x39b995[_0x859e('0x3f')]);_0xf6a380[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x39b995[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x13438a[_0x859e('0x3f')][_0x859e('0xc8')]));_0xf6a380[_0x859e('0x4d')]=_0xf6a380[_0x859e('0x4d')][_0x859e('0x63')]?_0xf6a380[_0x859e('0x4d')]:_0x39b995['model'];_0xf6a380['order']=qs[_0x859e('0xca')](_0x13438a[_0x859e('0x3f')][_0x859e('0xca')]);_0xf6a380['where']=qs[_0x859e('0xc6')](_['pick'](_0x13438a[_0x859e('0x3f')],_0x39b995['filters']));if(_0x13438a[_0x859e('0x3f')][_0x859e('0x2a')]){_0xf6a380[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0xf6a380[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0xf6a380[_0x859e('0x4d')],function(_0x18db93){var _0x2b4e3c={};_0x2b4e3c[_0x18db93]={'$like':'%'+_0x13438a[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x2b4e3c;})});}_0xf6a380=_[_0x859e('0x4c')]({},_0xf6a380,_0x13438a['options']);return _0x1813fe['getSmsInteractions'](_0xf6a380);}})[_0x859e('0x20')](function(_0x2aedaa){if(_0x2aedaa){_0x5a6de1=_0x2aedaa['length'];if(!_0x13438a[_0x859e('0x3f')][_0x859e('0xbc')]('nolimit')){_0xf6a380[_0x859e('0x1c')]=qs['limit'](_0x13438a[_0x859e('0x3f')][_0x859e('0x1c')]);_0xf6a380[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x13438a[_0x859e('0x3f')]['offset']);}return _0x1813fe[_0x859e('0xdd')](_0xf6a380);}})['then'](function(_0x4d1044){if(_0x4d1044){return _0x4d1044?{'count':_0x5a6de1,'rows':_0x4d1044}:null;}})[_0x859e('0x20')](respondWithResult(_0x52f318,null))[_0x859e('0x53')](handleError(_0x52f318,null));};exports['getFaxInteractions']=function(_0x57e290,_0x59e92d){var _0x441888={};var _0x57c3a4={};var _0x4f674b;var _0x5d4611;return db[_0x859e('0x34')]['findOne']({'where':{'id':_0x57e290[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x59e92d,null))[_0x859e('0x20')](function(_0x1bff91){if(_0x1bff91){_0x4f674b=_0x1bff91;_0x57c3a4[_0x859e('0xc3')]=_[_0x859e('0xc4')](db['FaxInteraction']['rawAttributes']);_0x57c3a4[_0x859e('0x3f')]=_['keys'](_0x57e290[_0x859e('0x3f')]);_0x57c3a4[_0x859e('0xc6')]=_['intersection'](_0x57c3a4[_0x859e('0xc3')],_0x57c3a4[_0x859e('0x3f')]);_0x441888[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x57c3a4[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x57e290['query'][_0x859e('0xc8')]));_0x441888[_0x859e('0x4d')]=_0x441888[_0x859e('0x4d')][_0x859e('0x63')]?_0x441888[_0x859e('0x4d')]:_0x57c3a4[_0x859e('0xc3')];_0x441888[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x57e290[_0x859e('0x3f')][_0x859e('0xca')]);_0x441888[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x57e290['query'],_0x57c3a4[_0x859e('0xc6')]));if(_0x57e290['query'][_0x859e('0x2a')]){_0x441888[_0x859e('0xcb')]=_['merge'](_0x441888[_0x859e('0xcb')],{'$or':_['map'](_0x441888[_0x859e('0x4d')],function(_0x662fe0){var _0x2912bc={};_0x2912bc[_0x662fe0]={'$like':'%'+_0x57e290[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x2912bc;})});}_0x441888=_[_0x859e('0x4c')]({},_0x441888,_0x57e290[_0x859e('0xd0')]);return _0x4f674b[_0x859e('0xde')](_0x441888);}})['then'](function(_0x5003b7){if(_0x5003b7){_0x5d4611=_0x5003b7[_0x859e('0x63')];if(!_0x57e290['query'][_0x859e('0xbc')](_0x859e('0xce'))){_0x441888[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x57e290[_0x859e('0x3f')]['limit']);_0x441888[_0x859e('0x1b')]=qs['offset'](_0x57e290[_0x859e('0x3f')][_0x859e('0x1b')]);}return _0x4f674b[_0x859e('0xde')](_0x441888);}})[_0x859e('0x20')](function(_0x4ca6d6){if(_0x4ca6d6){return _0x4ca6d6?{'count':_0x5d4611,'rows':_0x4ca6d6}:null;}})[_0x859e('0x20')](respondWithResult(_0x59e92d,null))[_0x859e('0x53')](handleError(_0x59e92d,null));};exports[_0x859e('0xdf')]=function(_0x316fe0,_0x1bf6ec){var _0x4b8fef={};var _0x37d111={};var _0x5c0e37;var _0xbc9ae1;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x316fe0[_0x859e('0x55')]['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x1bf6ec,null))[_0x859e('0x20')](function(_0x2ff141){if(_0x2ff141){_0x5c0e37=_0x2ff141;_0x37d111['model']=_[_0x859e('0xc4')](db['WhatsappInteraction'][_0x859e('0x35')]);_0x37d111[_0x859e('0x3f')]=_['keys'](_0x316fe0[_0x859e('0x3f')]);_0x37d111[_0x859e('0xc6')]=_['intersection'](_0x37d111['model'],_0x37d111[_0x859e('0x3f')]);_0x4b8fef[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x37d111[_0x859e('0xc3')],qs['fields'](_0x316fe0[_0x859e('0x3f')]['fields']));_0x4b8fef[_0x859e('0x4d')]=_0x4b8fef[_0x859e('0x4d')][_0x859e('0x63')]?_0x4b8fef[_0x859e('0x4d')]:_0x37d111['model'];_0x4b8fef['order']=qs[_0x859e('0xca')](_0x316fe0[_0x859e('0x3f')]['sort']);_0x4b8fef[_0x859e('0xcb')]=qs['filters'](_[_0x859e('0xcc')](_0x316fe0['query'],_0x37d111[_0x859e('0xc6')]));if(_0x316fe0[_0x859e('0x3f')][_0x859e('0x2a')]){_0x4b8fef[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0x4b8fef[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x4b8fef[_0x859e('0x4d')],function(_0x5e33b8){var _0x546ef0={};_0x546ef0[_0x5e33b8]={'$like':'%'+_0x316fe0[_0x859e('0x3f')][_0x859e('0x2a')]+'%'};return _0x546ef0;})});}_0x4b8fef=_[_0x859e('0x4c')]({},_0x4b8fef,_0x316fe0[_0x859e('0xd0')]);return _0x5c0e37[_0x859e('0xdf')](_0x4b8fef);}})['then'](function(_0x5ab9d1){if(_0x5ab9d1){_0xbc9ae1=_0x5ab9d1[_0x859e('0x63')];if(!_0x316fe0[_0x859e('0x3f')][_0x859e('0xbc')](_0x859e('0xce'))){_0x4b8fef[_0x859e('0x1c')]=qs[_0x859e('0x1c')](_0x316fe0[_0x859e('0x3f')][_0x859e('0x1c')]);_0x4b8fef[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x316fe0['query'][_0x859e('0x1b')]);}return _0x5c0e37['getWhatsappInteractions'](_0x4b8fef);}})[_0x859e('0x20')](function(_0x2a00f1){if(_0x2a00f1){return _0x2a00f1?{'count':_0xbc9ae1,'rows':_0x2a00f1}:null;}})[_0x859e('0x20')](respondWithResult(_0x1bf6ec,null))[_0x859e('0x53')](handleError(_0x1bf6ec,null));};exports[_0x859e('0xe0')]=function(_0x384e29,_0x43e280,_0x65aea8){var _0xa026ec;var _0x423d30;var _0x63c40d;var _0x11b9af=!_[_0x859e('0x5f')](_0x384e29[_0x859e('0x55')]['id'])?_0x384e29['params']['id']:!_[_0x859e('0x5f')](_0x384e29[_0x859e('0x27')]['id'])?_0x384e29[_0x859e('0x27')]['id']:null;return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x11b9af,'role':{'$or':[_0x859e('0x75'),_0x859e('0x27'),_0x859e('0x21')]}},'attributes':['id',_0x859e('0x2f'),_0x859e('0xe1'),_0x859e('0xe2'),'role',_0x859e('0x5a'),_0x859e('0x90')]})[_0x859e('0x20')](function(_0x33a56e){if(_0x33a56e){if(_0x33a56e['role']===_0x859e('0x21')){_0xa026ec=_0x33a56e;if(_0x384e29[_0x859e('0x54')][_0x859e('0x92')]){_0x63c40d=util[_0x859e('0xba')](_0x859e('0xe3'),_0xa026ec[_0x384e29[_0x859e('0x54')][_0x859e('0x92')]]);}else if(_0x384e29[_0x859e('0x54')][_0x859e('0xe4')]){_0x63c40d=util[_0x859e('0xba')](_0x859e('0x9c'),_0x384e29[_0x859e('0x54')]['intrf']);}else{_0x63c40d=util[_0x859e('0xba')](_0x859e('0x9c'),_0xa026ec[_0x859e('0x2f')]);}socket['to'](util['format']('user:%s',_0xa026ec['name']))['emit'](_0x859e('0xe5'),{'user':{'id':_0xa026ec['id'],'name':_0xa026ec[_0x859e('0x2f')]},'ip':_0x384e29[_0x859e('0xe6')][_0x859e('0xe7')]||_0x384e29['connection'][_0x859e('0xe8')]||_0x384e29[_0x859e('0xe9')]['remoteAddress']||_0x384e29[_0x859e('0xea')][_0x859e('0xe9')][_0x859e('0xe8')]});return db[_0x859e('0xa3')][_0x859e('0x23')]({'where':{'membername':_0xa026ec[_0x859e('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0x859e('0x86'))][(_0x859e('0x87'))](_0x859e('0xeb'));}})[_0x859e('0x20')](function(){if(_0xa026ec){return _0xa026ec[_0x859e('0xec')]({'raw':!![]});}})[_0x859e('0x20')](function(_0x34f986){if(_0xa026ec){if(_0x34f986){_0x423d30=_0x34f986;if(_0x423d30['length']){var _0x6708b0=_0x423d30[_0x859e('0x36')](function(_0x3c8dbc){var _0x5b959b={'membername':_0xa026ec[_0x859e('0x2f')],'UserId':_0xa026ec['id'],'queue_name':_0x3c8dbc[_0x859e('0x2f')],'VoiceQueueId':_0x3c8dbc['id'],'interface':_0x63c40d,'paused':_0xa026ec[_0x859e('0x90')]||![],'penalty':_0x3c8dbc['UserVoiceQueue.penalty']||0x0};return db[_0x859e('0xa3')][_0x859e('0xed')](_0x5b959b);});return Promise['all'](_0x6708b0);}}}})[_0x859e('0x20')](function(){if(_0xa026ec){return db[_0x859e('0xee')][_0x859e('0x45')]({'where':{'membername':_0xa026ec[_0x859e('0x2f')],'exitAt':null}});}})[_0x859e('0x20')](function(_0x3b8feb){if(_0xa026ec){var _0xa89e3b=[];_0x3b8feb['forEach'](function(_0x1c6ac5){_0xa89e3b['push'](_0x1c6ac5[_0x859e('0x1f')]({'exitAt':moment()[_0x859e('0xba')](_0x859e('0xef'))}));});return Promise['all'](_0xa89e3b);}})['then'](function(){if(_0xa026ec){var _0x46fe34=[];var _0x187125=[];var _0x5b1290=utils[_0x859e('0xf0')]();var _0x2e07a7={'membername':_0xa026ec[_0x859e('0x2f')],'interface':_0x63c40d,'enterAt':moment()[_0x859e('0xba')](_0x859e('0xef')),'role':_0xa026ec['role'],'internal':_0xa026ec[_0x859e('0x5a')]};_0x5b1290[_0x859e('0xf1')](function(_0x46555e){_0x46fe34[_0x859e('0x44')](_['merge']({'channel':_0x46555e,'type':_0x859e('0xf2'),'data1':_0x384e29['body'][_0x859e('0xf3')],'data2':_0x63c40d},_0x2e07a7));if(_0xa026ec[_0x859e('0x90')]){_0x187125[_0x859e('0x44')](_[_0x859e('0x4c')]({'channel':_0x46555e,'type':_0x859e('0xf4'),'data1':_0x859e('0xf5')},_0x2e07a7));}});return db[_0x859e('0xee')][_0x859e('0x7c')](_0x46fe34[_0x859e('0xb8')](_0x187125),{'individualHooks':!![]});}})[_0x859e('0x20')](function(){if(_0xa026ec){return _0xa026ec[_0x859e('0x1f')]({'online':!![],'lastLoginAt':moment()[_0x859e('0xba')](_0x859e('0xef')),'voicePause':_0xa026ec[_0x859e('0x90')]||![],'mailPause':_0xa026ec[_0x859e('0x90')]||![],'chatPause':_0xa026ec[_0x859e('0x90')]||![],'faxPause':_0xa026ec[_0x859e('0x90')]||![],'smsPause':_0xa026ec[_0x859e('0x90')]||![],'openchannelPause':_0xa026ec['loginInPause']||![],'whatsappPause':_0xa026ec['loginInPause']||![],'pauseType':_0xa026ec[_0x859e('0x90')]?_0x859e('0xf5'):null,'interface':_0x63c40d,'lastPauseAt':moment()[_0x859e('0xba')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x859e('0x20')](function(_0x552286){if(_0x384e29['isMiddleware']){return _0x65aea8();}else{return Promise[_0x859e('0xf6')](_0x552286)[_0x859e('0x20')](respondWithResult(_0x43e280,null));}})[_0x859e('0x53')](handleError(_0x43e280,null));};exports[_0x859e('0xf7')]=function(_0x256351,_0x284a03){var _0x1c9edb;return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x256351[_0x859e('0x55')]['id'],'role':_0x859e('0x21')},'attributes':['id','name','role']})[_0x859e('0x20')](handleEntityNotFound(_0x284a03,null))[_0x859e('0x20')](function(_0x7766a7){if(_0x7766a7){_0x1c9edb=_0x7766a7;return db[_0x859e('0xa3')][_0x859e('0x23')]({'where':{'membername':_0x1c9edb[_0x859e('0x2f')]},'individualHooks':!![]});}})['then'](function(){return db[_0x859e('0xee')]['findAll']({'where':{'membername':_0x1c9edb[_0x859e('0x2f')],'exitAt':null}});})[_0x859e('0x20')](function(_0x4d1f03){var _0x3834b8=[];_0x4d1f03[_0x859e('0xf1')](function(_0x49116b){_0x3834b8[_0x859e('0x44')](_0x49116b['update']({'exitAt':moment()['format'](_0x859e('0xef'))}));});return Promise['all'](_0x3834b8);})[_0x859e('0x20')](function(){return _0x1c9edb['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x859e('0x20')](respondWithResult(_0x284a03,null))[_0x859e('0x53')](handleError(_0x284a03,null));};exports[_0x859e('0xf8')]=function(_0x1a2291,_0x5bc81b){var _0x45731a;return db['UserVoiceQueueRt'][_0x859e('0x1f')]({'paused':0x1},{'where':{'UserId':_0x1a2291[_0x859e('0x55')]['id']},'individualHooks':!![]})[_0x859e('0x20')](function(){return db[_0x859e('0x34')][_0x859e('0x2d')]({'where':{'id':_0x1a2291['params']['id'],'role':_0x859e('0x21')},'attributes':['id',_0x859e('0x2f'),_0x859e('0x25'),'internal','interface',_0x859e('0x8f')]});})[_0x859e('0x20')](handleEntityNotFound(_0x5bc81b,null))[_0x859e('0x20')](function(_0x489a4a){if(_0x489a4a){_0x45731a=_0x489a4a;return db['MemberReport'][_0x859e('0x45')]({'where':{'membername':_0x45731a[_0x859e('0x2f')],'type':_0x859e('0xf4'),'exitAt':null}});}})[_0x859e('0x20')](function(_0x1f6915){if(_0x1f6915[_0x859e('0x63')]){var _0x3a6ef3=moment()[_0x859e('0xba')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x230e4d=0x0,_0x3fafbc=_0x1f6915['length'];_0x230e4d<_0x3fafbc;_0x230e4d++){_0x1f6915[_0x230e4d][_0x859e('0xf9')]({'exitAt':_0x3a6ef3});}}})[_0x859e('0x20')](function(){var _0x4cfdb3=[];var _0x4f3263=utils[_0x859e('0xf0')]();_0x4f3263[_0x859e('0xf1')](function(_0x21f0b1){_0x4cfdb3[_0x859e('0x44')]({'channel':_0x21f0b1,'membername':_0x45731a[_0x859e('0x2f')],'interface':_[_0x859e('0x5f')](_0x45731a[_0x859e('0x92')])?util['format'](_0x859e('0x9c'),_0x45731a['name']):_0x45731a[_0x859e('0x92')],'type':_0x859e('0xf4'),'enterAt':moment()[_0x859e('0xba')](_0x859e('0xef')),'data1':_0x1a2291[_0x859e('0x54')][_0x859e('0x38')]||_0x859e('0xfa'),'role':_0x45731a[_0x859e('0x25')],'internal':_0x45731a['internal']});});return db[_0x859e('0xee')][_0x859e('0x7c')](_0x4cfdb3,{'individualHooks':!![]});})[_0x859e('0x20')](function(){return _0x45731a[_0x859e('0x1f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a2291[_0x859e('0x54')][_0x859e('0x38')]||_0x859e('0xfa'),'lastPauseAt':moment()['format'](_0x859e('0xef'))});})[_0x859e('0x20')](respondWithResult(_0x5bc81b,null))[_0x859e('0x53')](handleError(_0x5bc81b,null));};exports['unpause']=function(_0x2af2dc,_0x47f06c){if(_0x2af2dc[_0x859e('0x54')][_0x859e('0x9e')]&&!utils['isValidChannel'](_0x2af2dc[_0x859e('0x54')][_0x859e('0x9e')])){throw new APIBadRequestError(util[_0x859e('0xba')](_0x859e('0xfb'),_0x2af2dc[_0x859e('0x54')]['channel']));}return db[_0x859e('0x34')]['find']({'where':{'id':_0x2af2dc['params']['id']},'attributes':['id',_0x859e('0x2f'),_0x859e('0x25'),'internal',_0x859e('0x92'),_0x859e('0x8f'),_0x859e('0x91'),_0x859e('0xfc'),'chatPause',_0x859e('0xfd'),_0x859e('0xfe'),_0x859e('0xff'),_0x859e('0x100'),_0x859e('0x101'),_0x859e('0x102')]})[_0x859e('0x20')](function(_0x1b8453){if(!_0x1b8453){throw new APINotFoundError(util[_0x859e('0xba')](_0x859e('0xbb'),_0x2af2dc[_0x859e('0x55')]['id']));}return _0x1b8453[_0x859e('0x103')](_0x2af2dc[_0x859e('0x54')][_0x859e('0x9e')]);})[_0x859e('0x20')](respondWithResult(_0x47f06c,null))[_0x859e('0x53')](APIHandleError(_0x47f06c));};exports[_0x859e('0x104')]=function(_0x2ee63b,_0xf98de8){var _0x2d9f36={};var _0xeb0fd4={};var _0x50089f;var _0x43882d;return db[_0x859e('0x34')]['findOne']({'where':{'id':_0x2ee63b['params']['id']}})[_0x859e('0x20')](handleEntityNotFound(_0xf98de8,null))[_0x859e('0x20')](function(_0x4e8d7d){if(_0x4e8d7d){_0x50089f=_0x4e8d7d;_0xeb0fd4[_0x859e('0xc3')]=_[_0x859e('0xc4')](db[_0x859e('0x105')][_0x859e('0x35')]);_0xeb0fd4[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x2ee63b['query']);_0xeb0fd4['filters']=_[_0x859e('0xc7')](_0xeb0fd4[_0x859e('0xc3')],_0xeb0fd4[_0x859e('0x3f')]);_0x2d9f36[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0xeb0fd4[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x2ee63b[_0x859e('0x3f')][_0x859e('0xc8')]));_0x2d9f36[_0x859e('0x4d')]=_0x2d9f36[_0x859e('0x4d')]['length']?_0x2d9f36['attributes']:_0xeb0fd4['model'];_0x2d9f36['order']=qs['sort'](_0x2ee63b[_0x859e('0x3f')][_0x859e('0xca')]);_0x2d9f36[_0x859e('0xcb')]=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x2ee63b[_0x859e('0x3f')],_0xeb0fd4[_0x859e('0xc6')]));if(_0x2ee63b[_0x859e('0x3f')]['filter']){_0x2d9f36['where']=_[_0x859e('0x4c')](_0x2d9f36[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x2d9f36[_0x859e('0x4d')],function(_0x1e0ddd){var _0x2b51df={};_0x2b51df[_0x1e0ddd]={'$like':'%'+_0x2ee63b['query'][_0x859e('0x2a')]+'%'};return _0x2b51df;})});}_0x2d9f36=_['merge']({},_0x2d9f36,_0x2ee63b[_0x859e('0xd0')]);return _0x50089f['getTeams'](_0x2d9f36);}})[_0x859e('0x20')](function(_0x1487c1){if(_0x1487c1){_0x43882d=_0x1487c1[_0x859e('0x63')];if(!_0x2ee63b[_0x859e('0x3f')]['hasOwnProperty']('nolimit')){_0x2d9f36[_0x859e('0x1c')]=qs['limit'](_0x2ee63b[_0x859e('0x3f')][_0x859e('0x1c')]);_0x2d9f36[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x2ee63b[_0x859e('0x3f')][_0x859e('0x1b')]);}return _0x50089f[_0x859e('0x104')](_0x2d9f36);}})[_0x859e('0x20')](function(_0x4bc609){if(_0x4bc609){return _0x4bc609?{'count':_0x43882d,'rows':_0x4bc609}:null;}})['then'](respondWithResult(_0xf98de8,null))[_0x859e('0x53')](handleError(_0xf98de8,null));};exports[_0x859e('0x106')]=function(_0x2d9726,_0x4071bd){var _0x329274=_0x2d9726['params']['id'];var _0x24ba1d=_0x2d9726[_0x859e('0x54')]?_0x2d9726[_0x859e('0x54')][_0x859e('0x58')]:null;var _0x316ae3=[];return Promise['resolve']()['then'](function(){if(!_0x24ba1d)throw new APIBadRequestError(_0x859e('0x107'));})[_0x859e('0x20')](function(){return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x329274}});})['then'](function(_0x421689){if(!_0x421689)throw new APINotFoundError(util['format'](_0x859e('0xbb'),_0x2d9726['params']['id']));return db[_0x859e('0x61')][_0x859e('0x108')](function(_0x4a1731){return _0x421689['addTeams'](_0x24ba1d,{'transaction':_0x4a1731})[_0x859e('0x20')](function(){return db['Team'][_0x859e('0x45')]({'where':{'id':{'$in':_0x24ba1d}}});})[_0x859e('0x20')](function(_0x1a0ab5){var _0x3fa0c9=_['map'](_0x1a0ab5,function(_0x31bfb5){return _0x31bfb5[_0x859e('0x109')]();});return Promise['all'](_0x3fa0c9);})[_0x859e('0x20')](function(_0x1dfe06){_0x316ae3=_['flattenDeep'](_0x1dfe06);var _0x132b8c=_[_0x859e('0x36')](_0x316ae3,function(_0x2ef67d){return _0x2ef67d[_0x859e('0x10a')](_0x421689['id'],{'transaction':_0x4a1731});});return Promise[_0x859e('0x52')](_0x132b8c);})[_0x859e('0x20')](function(){if(!_0x421689['online'])return;var _0x4b18ef=_[_0x859e('0x2a')](_0x316ae3,function(_0x4f9c4d){return _0x4f9c4d[_0x859e('0x10b')](_0x859e('0x9e'))==='Voice';});var _0x404aa8=_['map'](_0x4b18ef,function(_0x428af0){return db[_0x859e('0xa3')]['upsert']({'membername':_0x421689[_0x859e('0x2f')],'UserId':_0x421689['id'],'queue_name':_0x428af0[_0x859e('0x2f')],'VoiceQueueId':_0x428af0['id'],'interface':_[_0x859e('0x5f')](_0x421689[_0x859e('0x92')])?util['format'](_0x859e('0x9c'),_0x421689[_0x859e('0x2f')]):_0x421689[_0x859e('0x92')],'paused':_0x421689[_0x859e('0x91')]||![],'penalty':_0x421689[_0x859e('0x98')]},{'transaction':_0x4a1731});});return Promise[_0x859e('0x52')](_0x404aa8);})[_0x859e('0x20')](function(){return db['TeamVoicePrefix'][_0x859e('0x45')]({'where':{'teamId':{'$in':_0x24ba1d}}});})[_0x859e('0x20')](function(_0x5373c7){var _0x52804a=_[_0x859e('0x36')](_0x5373c7,function(_0x4c0f91){return db[_0x859e('0x10c')][_0x859e('0x74')]({'UserId':_0x421689['id'],'VoicePrefixId':_0x4c0f91[_0x859e('0x10d')]},{'transaction':_0x4a1731});});return Promise[_0x859e('0x52')](_0x52804a);});});})[_0x859e('0x20')](function(){for(var _0x143c06=0x0;_0x143c06<_0x316ae3[_0x859e('0x63')];_0x143c06++){var _0x208d07=_0x316ae3[_0x143c06][_0x859e('0x10b')](_0x859e('0x9e'));var _0x1ec1aa=_0x208d07+_0x859e('0x99');socket[_0x859e('0x22')](_0x859e('0x27')+_0x208d07+_0x859e('0x9a'),{'UserId':_0x329274,['queueField']:_0x316ae3[_0x143c06]['id']});}})[_0x859e('0x20')](respondWithStatusCode(_0x4071bd,null))[_0x859e('0x53')](APIHandleError(_0x4071bd));};exports['removeTeams']=function(_0x3dd384,_0x5ccdba){var _0x5652d8=_0x3dd384['params']['id'];var _0x28fb3f=null;if(_0x3dd384[_0x859e('0x3f')][_0x859e('0x58')]){_0x28fb3f=_['isArray'](_0x3dd384['query'][_0x859e('0x58')])?_0x3dd384[_0x859e('0x3f')][_0x859e('0x58')]:[_0x3dd384[_0x859e('0x3f')][_0x859e('0x58')]];}var _0x13e8e0=[];return Promise[_0x859e('0xf6')]()[_0x859e('0x20')](function(){if(!_0x28fb3f)throw new APIBadRequestError(_0x859e('0x10e'));})[_0x859e('0x20')](function(){return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x5652d8}});})[_0x859e('0x20')](function(_0x558f77){if(!_0x558f77)throw new APINotFoundError(util[_0x859e('0xba')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3dd384[_0x859e('0x55')]['id']));return db[_0x859e('0x61')][_0x859e('0x108')](function(_0x211aea){return _0x558f77['removeTeams'](_0x28fb3f,{'transaction':_0x211aea})[_0x859e('0x20')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x28fb3f}}});})[_0x859e('0x20')](function(_0x1131d6){var _0x1c157f=_[_0x859e('0x36')](_0x1131d6,function(_0x5b1ead){return _0x5b1ead[_0x859e('0x109')]();});return Promise[_0x859e('0x52')](_0x1c157f);})[_0x859e('0x20')](function(_0x5443aa){_0x13e8e0=_[_0x859e('0x10f')](_0x5443aa);var _0x504a9b=_[_0x859e('0x36')](_0x13e8e0,function(_0xbf2c18){return _0xbf2c18[_0x859e('0x110')](_0x558f77['id'],{'transaction':_0x211aea});});return Promise[_0x859e('0x52')](_0x504a9b);})['then'](function(){if(!_0x558f77[_0x859e('0x8f')])return;var _0x58cfcc=_[_0x859e('0x2a')](_0x13e8e0,function(_0x558bdd){return _0x558bdd[_0x859e('0x10b')](_0x859e('0x9e'))===_0x859e('0x111');});var _0x3ddc05=_[_0x859e('0x36')](_0x58cfcc,function(_0x293c6e){return db[_0x859e('0xa3')][_0x859e('0x23')]({'where':{'VoiceQueueId':_0x293c6e['id'],'UserId':_0x558f77['id']},'transaction':_0x211aea});});return Promise['all'](_0x3ddc05);})[_0x859e('0x20')](function(){return db[_0x859e('0x112')][_0x859e('0x45')]({'where':{'teamId':{'$in':_0x28fb3f}}});})[_0x859e('0x20')](function(_0x403d11){var _0x29a99b=_[_0x859e('0x36')](_0x403d11,function(_0x185bf2){return db[_0x859e('0x10c')]['destroy']({'where':{'UserId':_0x558f77['id'],'VoicePrefixId':_0x185bf2[_0x859e('0x10d')]}},{'transaction':_0x211aea});});return Promise[_0x859e('0x52')](_0x29a99b);});});})[_0x859e('0x20')](function(){for(var _0x364d06=0x0;_0x364d06<_0x13e8e0[_0x859e('0x63')];_0x364d06++){var _0x22d3f2=_0x13e8e0[_0x364d06][_0x859e('0x10b')](_0x859e('0x9e'));var _0x178e1b=_0x22d3f2+_0x859e('0x99');socket[_0x859e('0x22')]('user'+_0x22d3f2+'Queue:remove',{'UserId':_0x5652d8,['queueField']:_0x13e8e0[_0x364d06]['id']});}})[_0x859e('0x20')](respondWithStatusCode(_0x5ccdba,null))[_0x859e('0x53')](APIHandleError(_0x5ccdba));};exports[_0x859e('0x113')]=function(_0x12e6ef,_0x25d950){var _0x276d22={};var _0x4d40c5={};var _0x27b029;var _0x147318;return db[_0x859e('0x34')][_0x859e('0x8c')]({'where':{'id':_0x12e6ef[_0x859e('0x55')]['id']}})['then'](handleEntityNotFound(_0x25d950,null))['then'](function(_0x32ab80){if(_0x32ab80){_0x27b029=_0x32ab80;_0x4d40c5[_0x859e('0xc3')]=_['keys'](db['CmList'][_0x859e('0x35')]);_0x4d40c5[_0x859e('0x3f')]=_[_0x859e('0xc4')](_0x12e6ef['query']);_0x4d40c5[_0x859e('0xc6')]=_['intersection'](_0x4d40c5[_0x859e('0xc3')],_0x4d40c5[_0x859e('0x3f')]);_0x276d22[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x4d40c5[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x12e6ef['query'][_0x859e('0xc8')]));_0x276d22[_0x859e('0x4d')]=_0x276d22[_0x859e('0x4d')][_0x859e('0x63')]?_0x276d22[_0x859e('0x4d')]:_0x4d40c5[_0x859e('0xc3')];_0x276d22[_0x859e('0xc9')]=qs[_0x859e('0xca')](_0x12e6ef[_0x859e('0x3f')][_0x859e('0xca')]);_0x276d22['where']=qs[_0x859e('0xc6')](_[_0x859e('0xcc')](_0x12e6ef[_0x859e('0x3f')],_0x4d40c5['filters']));if(_0x12e6ef[_0x859e('0x3f')][_0x859e('0x2a')]){_0x276d22['where']=_[_0x859e('0x4c')](_0x276d22['where'],{'$or':_[_0x859e('0x36')](_0x276d22[_0x859e('0x4d')],function(_0x3f1e90){var _0x18a550={};_0x18a550[_0x3f1e90]={'$like':'%'+_0x12e6ef[_0x859e('0x3f')]['filter']+'%'};return _0x18a550;})});}_0x276d22=_['merge']({},_0x276d22,_0x12e6ef['options']);return _0x27b029[_0x859e('0x113')](_0x276d22);}})[_0x859e('0x20')](function(_0x11f48b){if(_0x11f48b){_0x147318=_0x11f48b[_0x859e('0x63')];if(!_0x12e6ef['query'][_0x859e('0xbc')](_0x859e('0xce'))){_0x276d22['limit']=qs[_0x859e('0x1c')](_0x12e6ef['query'][_0x859e('0x1c')]);_0x276d22[_0x859e('0x1b')]=qs[_0x859e('0x1b')](_0x12e6ef['query'][_0x859e('0x1b')]);}return _0x27b029[_0x859e('0x113')](_0x276d22);}})[_0x859e('0x20')](function(_0x42779e){if(_0x42779e){return _0x42779e?{'count':_0x147318,'rows':_0x42779e}:null;}})[_0x859e('0x20')](respondWithResult(_0x25d950,null))[_0x859e('0x53')](handleError(_0x25d950,null));};exports[_0x859e('0x114')]=function(_0x47b2d4,_0x9c0a53){var _0x7fffa={};var _0x27a444={};var _0x66d82f;return db[_0x859e('0x34')]['findOne']({'where':{'id':_0x47b2d4['params']['id']}})[_0x859e('0x20')](handleEntityNotFound(_0x9c0a53,null))[_0x859e('0x20')](function(_0x96814c){if(_0x96814c){_0x66d82f=_0x96814c;_0x27a444[_0x859e('0xc3')]=_[_0x859e('0xc4')](db['User']['rawAttributes']);_0x27a444['query']=_[_0x859e('0xc4')](_0x47b2d4[_0x859e('0x3f')]);_0x27a444[_0x859e('0xc6')]=_[_0x859e('0xc7')](_0x27a444['model'],_0x27a444[_0x859e('0x3f')]);_0x7fffa[_0x859e('0x4d')]=_[_0x859e('0xc7')](_0x27a444[_0x859e('0xc3')],qs[_0x859e('0xc8')](_0x47b2d4[_0x859e('0x3f')][_0x859e('0xc8')]));_0x7fffa[_0x859e('0x4d')]=_0x7fffa[_0x859e('0x4d')]['length']?_0x7fffa['attributes']:_0x27a444[_0x859e('0xc3')];_0x7fffa['order']=qs[_0x859e('0xca')](_0x47b2d4[_0x859e('0x3f')][_0x859e('0xca')]);_0x7fffa['where']=qs['filters'](_['pick'](_0x47b2d4[_0x859e('0x3f')],_0x27a444[_0x859e('0xc6')]));if(_0x47b2d4[_0x859e('0x3f')][_0x859e('0x2a')]){_0x7fffa[_0x859e('0xcb')]=_[_0x859e('0x4c')](_0x7fffa[_0x859e('0xcb')],{'$or':_[_0x859e('0x36')](_0x7fffa[_0x859e('0x4d')],function(_0x104307){var _0x1e57d7={};_0x1e57d7[_0x104307]={'$like':'%'+_0x47b2d4[_0x859e('0x3f')]['filter']+'%'};return _0x1e57d7;})});}_0x7fffa[_0x859e('0xc3')]=db[_0x859e('0x34')];_0x7fffa['as']=_0x859e('0x28');_0x7fffa=_[_0x859e('0x4c')]({},_0x7fffa,_0x47b2d4[_0x859e('0xd0')]);return _0x66d82f['getVoiceQueues']({'include':[_0x7fffa]});}})[_0x859e('0x20')](function(_0x4a5b09){if(_0x4a5b09){var _0x251a46={},_0x1c0acd=[];for(var _0x285ee2=0x0;_0x285ee2<_0x4a5b09[_0x859e('0x63')];_0x285ee2+=0x1){for(var _0x32a2d0=0x0,_0x3702ab;_0x32a2d0<_0x4a5b09[_0x285ee2][_0x859e('0x28')]['length'];_0x32a2d0+=0x1){_0x3702ab=_0x4a5b09[_0x285ee2][_0x859e('0x28')][_0x32a2d0][_0x859e('0x24')]({'plain':!![]});_0x251a46[_0x3702ab['id']]=_0x3702ab;}}_0x251a46=_[_0x859e('0x115')](_0x251a46);for(var _0x531412=qs['offset'](_0x47b2d4['query'][_0x859e('0x1b')]);_0x531412<_0x251a46[_0x859e('0x63')]&&_0x1c0acd['length']=_0xaaae7b){_0x48b2cb=_0xaaae7b;_0x4e6ba0=0xc8;}else{_0x4e6ba0=0xce;}_0x513076[_0x9963('0x13')](_0x4e6ba0);return _0x513076['set'](_0x9963('0x1a'),_0x2df7e2+'-'+_0x48b2cb+'/'+_0xaaae7b)[_0x9963('0x15')](_0x117635);}return null;};}function saveUpdates(_0x3f0322){return function(_0x18a260){if(_0x18a260){return _0x18a260[_0x9963('0x1b')](_0x3f0322)[_0x9963('0x1c')](function(_0x38e570){if(_0x38e570[_0x9963('0x1d')]==='agent'){socket[_0x9963('0x1e')](_0x9963('0x1f')+_0x38e570['id'],_0x38e570);}return _0x38e570;});}return null;};}function removeEntity(_0x15eacf){return function(_0x55abbe){if(_0x55abbe){return _0x55abbe[_0x9963('0x20')]()[_0x9963('0x1c')](function(){var _0x1d1305=_0x55abbe[_0x9963('0x21')]({'plain':!![]});if(_0x1d1305[_0x9963('0x1d')]===_0x9963('0x22'))return;var _0x215967=[{'name':_0x9963('0x23'),'value':_0x9963('0x24'),'ignore':!![]},{'name':'Agents','value':_0x9963('0x25'),'ignore':![]},{'name':_0x9963('0x26'),'value':'telephone','ignore':![]}];var _0x1c6ef0=_(_0x215967)[_0x9963('0x27')](_0x9963('0x28'))[_0x9963('0x29')]('value')['value']();if(_[_0x9963('0x2a')](_0x1c6ef0,_0x1d1305[_0x9963('0x1d')])){return;}var _0x1740fd=_[_0x9963('0x2b')](_0x215967,[_0x9963('0x2c'),_0x1d1305[_0x9963('0x1d')]])[_0x9963('0x2d')];return db[_0x9963('0x2e')]['destroy']({'where':{'type':_0x1740fd,'resourceId':_0x1d1305['id']}})[_0x9963('0x1c')](function(){return _0x55abbe;});})[_0x9963('0x1c')](function(){_0x15eacf[_0x9963('0x13')](0xcc)[_0x9963('0x14')]();});}};}function handleEntityNotFound(_0x6a532a){return function(_0x442922){if(!_0x442922){_0x6a532a[_0x9963('0x2f')](0x194);}return _0x442922;};}function handleError(_0x34145d,_0x4d4555){_0x4d4555=_0x4d4555||0x1f4;return function(_0x3af147){logger[_0x9963('0x30')](_0x3af147['stack']);if(_0x3af147[_0x9963('0x2d')]){delete _0x3af147[_0x9963('0x2d')];}_0x34145d[_0x9963('0x13')](_0x4d4555)[_0x9963('0x31')](_0x3af147);};}function getUserAttributes(){return _(db[_0x9963('0x32')][_0x9963('0x33')])['map'](function(_0x81dcb7){return{'name':_0x81dcb7[_0x9963('0x34')],'type':_0x81dcb7[_0x9963('0x35')][_0x9963('0x36')]};})['filter'](function(_0x18ead7){return![_0x9963('0x37'),_0x9963('0x38'),'previousPasswords',_0x9963('0x39'),_0x9963('0x3a'),_0x9963('0x3b')][_0x9963('0x2a')](_0x18ead7[_0x9963('0x2d')]);})['value']();}exports[_0x9963('0x3c')]=function(_0x407aab,_0x5e24c3){var _0x5ba037={},_0x523636={'count':0x0,'rows':[]};var _0x559d5a=getUserAttributes();_0x5ba037=qs[_0x9963('0x3d')](_0x559d5a,_0x407aab);var _0x747ba5={'where':_0x5ba037[_0x9963('0x3e')]};return db[_0x9963('0x32')][_0x9963('0x18')](_0x747ba5)[_0x9963('0x1c')](function(_0xc4e89d){_0x523636[_0x9963('0x18')]=_0xc4e89d;if(_0x407aab[_0x9963('0x3f')][_0x9963('0x40')]){_0x5ba037[_0x9963('0x41')]=[{'all':!![]}];}if(_0x407aab['query']['userSetting']===_0x9963('0x42')){_0x5ba037[_0x9963('0x41')]=[{'model':db[_0x9963('0x43')],'as':_0x9963('0x44')}];}if(!_[_0x9963('0x2a')](_0x5ba037['attributes'],'id')){_0x5ba037[_0x9963('0x45')]['push']('id');}return db[_0x9963('0x32')][_0x9963('0x46')](_0x5ba037);})[_0x9963('0x1c')](function(_0x4afd4e){_0x523636['rows']=_0x4afd4e;if(_0x407aab[_0x9963('0x3f')]['openTabs']===_0x9963('0x42')){var _0x15a569=[];for(var _0x191194=0x0;_0x191194<_0x523636['rows'][_0x9963('0x47')];_0x191194++){_0x15a569['push'](get_open_tabs(_0x9963('0x48'),_0x523636[_0x9963('0x49')][_0x191194][_0x9963('0x4a')]));_0x15a569['push'](get_open_tabs(_0x9963('0x4b'),_0x523636[_0x9963('0x49')][_0x191194]['dataValues']));_0x15a569[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4d'),_0x523636['rows'][_0x191194][_0x9963('0x4a')]));_0x15a569['push'](get_open_tabs('mail',_0x523636[_0x9963('0x49')][_0x191194][_0x9963('0x4a')]));_0x15a569[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4e'),_0x523636[_0x9963('0x49')][_0x191194][_0x9963('0x4a')]));_0x15a569[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4f'),_0x523636[_0x9963('0x49')][_0x191194]['dataValues']));}return Promise['all'](_0x15a569)['then'](function(){return _0x523636;});}else{return _0x523636;}})[_0x9963('0x1c')](respondWithFilteredResult(_0x5e24c3,_0x5ba037))[_0x9963('0x50')](handleError(_0x5e24c3,null));};exports[_0x9963('0x51')]=function(_0x2f6191,_0x5779e6){var _0x53a1b1=getUserAttributes();_0x2f6191[_0x9963('0x3f')]['id']=_0x2f6191[_0x9963('0x52')]['id'];var _0x7d077b=qs['getOptions'](_0x53a1b1,_0x2f6191);if(_0x2f6191[_0x9963('0x3f')][_0x9963('0x40')]){_0x7d077b['include']=[{'all':!![]}];}if(_0x2f6191[_0x9963('0x3f')]['userSetting']==='true'){_0x7d077b[_0x9963('0x41')]=[{'model':db[_0x9963('0x43')],'as':'userSetting'}];}_0x7d077b=_[_0x9963('0x53')]({},_0x7d077b,_0x2f6191[_0x9963('0x54')]);if(!_[_0x9963('0x2a')](_0x7d077b[_0x9963('0x45')],'id')){_0x7d077b[_0x9963('0x45')][_0x9963('0x4c')]('id');}return db[_0x9963('0x32')][_0x9963('0x2b')](_0x7d077b)[_0x9963('0x1c')](handleEntityNotFound(_0x5779e6,null))['then'](function(_0x5ab5c7){var _0xad78cb=[];values=_0x5ab5c7;if(_0x2f6191[_0x9963('0x3f')][_0x9963('0x55')]===_0x9963('0x42')){_0xad78cb[_0x9963('0x4c')](get_open_tabs(_0x9963('0x48'),_0x5ab5c7[_0x9963('0x4a')]));_0xad78cb[_0x9963('0x4c')](get_open_tabs('sms',_0x5ab5c7['dataValues']));_0xad78cb['push'](get_open_tabs(_0x9963('0x4e'),_0x5ab5c7['dataValues']));_0xad78cb['push'](get_open_tabs(_0x9963('0x4f'),_0x5ab5c7['dataValues']));_0xad78cb[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4d'),_0x5ab5c7[_0x9963('0x4a')]));_0xad78cb[_0x9963('0x4c')](get_open_tabs(_0x9963('0x56'),_0x5ab5c7[_0x9963('0x4a')]));return Promise['all'](_0xad78cb);}else{return values;}})[_0x9963('0x1c')](function(){return values;})[_0x9963('0x1c')](respondWithResult(_0x5779e6,null))['catch'](handleError(_0x5779e6,null));};exports['update']=function(_0xcae5c4,_0x4d808a){if(_0xcae5c4['body']['id']){delete _0xcae5c4[_0x9963('0x57')]['id'];}delete _0xcae5c4['body'][_0x9963('0x1d')];return db['User'][_0x9963('0x2b')]({'where':{'id':_0xcae5c4[_0x9963('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d808a,null))[_0x9963('0x1c')](saveUpdates(_0xcae5c4[_0x9963('0x57')],null))[_0x9963('0x1c')](respondWithResult(_0x4d808a,null))[_0x9963('0x50')](handleError(_0x4d808a,null));};exports['describe']=function(_0xfa6767,_0x5f249c){return db['User'][_0x9963('0x58')]()[_0x9963('0x1c')](respondWithResult(_0x5f249c,null))[_0x9963('0x50')](handleError(_0x5f249c,null));};exports[_0x9963('0x59')]=function(_0x5e4add,_0x4bbf73){return db[_0x9963('0x32')][_0x9963('0x2b')]({'where':{'id':_0x5e4add[_0x9963('0x52')]['id']}})['then'](handleEntityNotFound(_0x4bbf73,null))['then'](function(_0x3e07e2){if(_0x3e07e2){return _0x3e07e2[_0x9963('0x59')](_0x5e4add['body']['ids'],_[_0x9963('0x5a')](_0x5e4add[_0x9963('0x57')],[_0x9963('0x5b'),'id'])||{});}})[_0x9963('0x1c')](respondWithResult(_0x4bbf73,null))['catch'](handleError(_0x4bbf73,null));};function validateUser(_0x26d0fd){return new Promise(function(_0x2dc393,_0x50b332){if(_0x26d0fd[_0x9963('0x5c')])return _0x2dc393(_0x26d0fd);return db[_0x9963('0x5d')]['findById'](0x1)[_0x9963('0x1c')](function(_0x1d92bb){if(_0x1d92bb[_0x9963('0x5e')])authService[_0x9963('0x5f')](_0x26d0fd['password']);db[_0x9963('0x32')][_0x9963('0x60')](_0x9963('0x5c'))['then'](function(_0x5da47c){if(_[_0x9963('0x61')](_0x5da47c)){_0x26d0fd[_0x9963('0x5c')]=_0x1d92bb[_0x9963('0x62')]||0x1;return;}if(_[_0x9963('0x61')](_0x1d92bb['min_internal'])||_0x1d92bb[_0x9963('0x62')]===_0x5da47c){_0x26d0fd[_0x9963('0x5c')]=_0x5da47c+0x1;return;}if(_0x1d92bb[_0x9963('0x62')]>_0x5da47c){_0x26d0fd[_0x9963('0x5c')]=_0x1d92bb[_0x9963('0x62')];return;}return db[_0x9963('0x63')][_0x9963('0x3f')](_0x9963('0x64'),{'type':db[_0x9963('0x63')][_0x9963('0x65')]['SELECT']})['then'](function(_0x4df1bd){if(_0x4df1bd&&_0x4df1bd[_0x9963('0x47')]){for(var _0x1e5732=0x0,_0x46fc6c=_0x4df1bd[_0x9963('0x47')];_0x1e5732<_0x46fc6c&&_['isNil'](_0x26d0fd[_0x9963('0x5c')]);_0x1e5732++){if(_0x1d92bb[_0x9963('0x62')]<=_0x4df1bd[_0x1e5732][_0x9963('0x66')]){_0x26d0fd[_0x9963('0x5c')]=_0x4df1bd[_0x1e5732]['from'];}else if(_0x1d92bb[_0x9963('0x62')]>_0x4df1bd[_0x1e5732]['from']&&_0x1d92bb['min_internal']<=_0x4df1bd[_0x1e5732]['to']){_0x26d0fd[_0x9963('0x5c')]=_0x1d92bb[_0x9963('0x62')];}}}if(_[_0x9963('0x61')](_0x26d0fd['internal'])){_0x26d0fd[_0x9963('0x5c')]=_0x5da47c+0x1;}return _0x2dc393(_0x26d0fd);});});})[_0x9963('0x50')](function(_0x84aef4){_0x50b332(_0x84aef4);});});}function updateUser(_0x1d78fa){return new Promise(function(_0x5f05c0,_0x4af9ce){try{if(_0x1d78fa[_0x9963('0x67')]){_0x1d78fa['mailbox']=_0x1d78fa[_0x9963('0x5c')];_0x1d78fa[_0x9963('0x68')]={'mailbox':_0x1d78fa[_0x9963('0x5c')],'password':_0x1d78fa['password'],'fullname':_0x1d78fa[_0x9963('0x69')],'email':_0x1d78fa[_0x9963('0x6a')]};}if(_0x1d78fa[_0x9963('0x1d')]===_0x9963('0x25')){if(!_0x1d78fa[_0x9963('0x6b')])_0x1d78fa[_0x9963('0x6b')]=[_0x9963('0x6c'),_0x9963('0x6d'),_0x9963('0x6e'),'113',_0x9963('0x6f'),_0x9963('0x70'),_0x9963('0x71'),_0x9963('0x72'),_0x9963('0x73'),_0x9963('0x74'),_0x9963('0x75'),_0x9963('0x76'),_0x9963('0x77'),_0x9963('0x78'),_0x9963('0x79')];}_0x5f05c0(_0x1d78fa);}catch(_0x46c7ce){_0x4af9ce(_0x46c7ce);}});}exports['create']=function(_0x42b0b6,_0x2a0f86){if(_0x42b0b6[_0x9963('0x24')][_0x9963('0x1d')]===_0x9963('0x25'))throw new Error(_0x9963('0x7a'));if(_0x42b0b6[_0x9963('0x57')][_0x9963('0x1d')]===_0x9963('0x24')&&_0x42b0b6[_0x9963('0x24')][_0x9963('0x1d')]!==_0x9963('0x22')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x42b0b6['body'][_0x9963('0x1d')]==='admin'&&_0x42b0b6[_0x9963('0x24')][_0x9963('0x1d')]!==_0x9963('0x22')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x9963('0x7b')]([_0x42b0b6['body']])[_0x9963('0x1c')](function(){return validateUser(_0x42b0b6[_0x9963('0x57')]);})[_0x9963('0x1c')](function(_0x1c3d1c){return updateUser(_0x1c3d1c)['then'](function(_0x1ccee9){if(_0x1ccee9[_0x9963('0x1d')]===_0x9963('0x22')){_0x1ccee9['settingsEnabled']=_0x42b0b6[_0x9963('0x24')]['settingsEnabled'];delete _0x1ccee9[_0x9963('0x7c')];}return _0x1ccee9;});})[_0x9963('0x1c')](function(_0x284143){return db[_0x9963('0x32')][_0x9963('0x7d')](_0x284143,{'include':[{'model':db[_0x9963('0x68')],'as':'VoiceMail'}]});})['then'](function(_0x39225b){if(_0x42b0b6[_0x9963('0x57')][_0x9963('0x1d')]===_0x9963('0x24'))return _0x39225b;if(_0x42b0b6[_0x9963('0x24')][_0x9963('0x1d')]!==_0x9963('0x24'))return _0x39225b;return db['UserProfileSection'][_0x9963('0x2b')]({'where':{'name':_0x39225b['role']===_0x9963('0x25')?_0x9963('0x7e'):_0x9963('0x26'),'userProfileId':_0x42b0b6[_0x9963('0x24')][_0x9963('0x7c')]},'raw':!![]})[_0x9963('0x1c')](function(_0x268f92){if(!_0x268f92||_0x268f92[_0x9963('0x7f')]!=0x0)return _0x39225b;return db[_0x9963('0x2e')][_0x9963('0x7d')]({'name':_0x39225b[_0x9963('0x2d')],'resourceId':_0x39225b['id'],'type':_0x268f92[_0x9963('0x2d')],'sectionId':_0x268f92['id']},{})[_0x9963('0x1c')](function(){return _0x39225b;});})[_0x9963('0x50')](function(_0x2b6e1f){logger[_0x9963('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b6e1f);throw _0x2b6e1f;});})[_0x9963('0x1c')](respondWithResult(_0x2a0f86,0xc9))[_0x9963('0x50')](handleError(_0x2a0f86,null));};exports[_0x9963('0x80')]=function(_0x54589a,_0x3f416d){var _0x159a68=_0x54589a['body'];var _0x5a8aff=[];if(_0x54589a[_0x9963('0x24')][_0x9963('0x1d')]===_0x9963('0x25'))throw new Error('Unauthorized');if(_[_0x9963('0x81')](_0x159a68,[_0x9963('0x1d'),_0x9963('0x24')])&&_0x54589a['user'][_0x9963('0x1d')]!==_0x9963('0x22')){throw new Error(_0x9963('0x82'));}if(_[_0x9963('0x81')](_0x159a68,[_0x9963('0x1d'),_0x9963('0x22')])&&_0x54589a[_0x9963('0x24')]['role']!==_0x9963('0x22')){throw new Error(_0x9963('0x83'));}return licenseUtil[_0x9963('0x7b')](_0x159a68)[_0x9963('0x1c')](function(){return validateUser(_0x159a68[0x0]);})[_0x9963('0x1c')](function(){for(var _0x3c848b=0x1;_0x3c848b<_0x159a68[_0x9963('0x47')];_0x3c848b++){var _0x217913=_0x159a68[_0x3c848b-0x1][_0x9963('0x5c')];if(!_0x159a68[_0x3c848b][_0x9963('0x5c')])_0x159a68[_0x3c848b][_0x9963('0x5c')]=_0x217913+0x1;_0x5a8aff[_0x9963('0x4c')](validateUser(_0x159a68[_0x3c848b]));}return Promise['all'](_0x5a8aff);})[_0x9963('0x1c')](function(){_0x5a8aff=[];for(var _0x290120=0x0;_0x290120<_0x159a68[_0x9963('0x47')];_0x290120++){_0x5a8aff[_0x9963('0x4c')](updateUser(_0x159a68[_0x290120]));}return Promise[_0x9963('0x84')](_0x5a8aff);})[_0x9963('0x1c')](function(){_0x5a8aff=_0x159a68[_0x9963('0x29')](function(_0x385fa7){return db['User'][_0x9963('0x7d')](_0x385fa7,{'include':[{'model':db[_0x9963('0x68')],'as':'VoiceMail'}]})[_0x9963('0x1c')](function(_0xd156c0){_0x385fa7['id']=_0xd156c0['id'];return _0x385fa7;});});return Promise[_0x9963('0x84')](_0x5a8aff);})[_0x9963('0x1c')](function(_0x4e3000){if(_0x54589a[_0x9963('0x57')]['role']==='user')return _0x4e3000;if(_0x54589a[_0x9963('0x24')]['role']!=='user')return _0x4e3000;var _0x1e5be8=_['some'](_0x4e3000,function(_0x137b5b){return _0x137b5b[_0x9963('0x1d')]===_0x9963('0x25')||_0x137b5b[_0x9963('0x1d')]===_0x9963('0x85');});if(!_0x1e5be8)return _0x4e3000;return db[_0x9963('0x86')][_0x9963('0x46')]({'where':{'name':{'$or':[_0x9963('0x7e'),_0x9963('0x26')]},'userProfileId':_0x54589a[_0x9963('0x24')][_0x9963('0x7c')]},'raw':!![]})[_0x9963('0x1c')](function(_0x1fad00){if(_[_0x9963('0x87')](_0x1fad00)||!_[_0x9963('0x81')](_0x1fad00,[_0x9963('0x7f'),0x0]))return _0x4e3000;_0x5a8aff=[];var _0x290914=_(_0x1fad00)[_0x9963('0x29')](function(_0xbad892){if(_0xbad892[_0x9963('0x7f')]===0x1)return;return _0xbad892[_0x9963('0x2d')]===_0x9963('0x7e')?_0x9963('0x25'):_0x9963('0x85');})[_0x9963('0x88')]()[_0x9963('0x2c')]();for(var _0x555a1f=0x0;_0x555a1f<_0x4e3000[_0x9963('0x47')];_0x555a1f++){if(!_[_0x9963('0x2a')](_0x290914,_0x4e3000[_0x555a1f][_0x9963('0x1d')]))return;var _0x256eeb=_0x4e3000[_0x555a1f][_0x9963('0x1d')]==='agent'?_0x9963('0x7e'):_0x9963('0x26');_0x5a8aff['push'](db[_0x9963('0x2e')][_0x9963('0x7d')]({'name':_0x4e3000[_0x555a1f][_0x9963('0x2d')],'resourceId':_0x4e3000[_0x555a1f]['id'],'type':_0x256eeb,'sectionId':_[_0x9963('0x2b')](_0x1fad00,[_0x9963('0x2d'),_0x256eeb])['id']},{}));}return Promise[_0x9963('0x84')](_0x5a8aff);});})[_0x9963('0x1c')](respondWithResult(_0x3f416d,0xc9))[_0x9963('0x50')](handleError(_0x3f416d,null));};exports[_0x9963('0x89')]=function(_0x4cff5c,_0x21b112){if(_0x4cff5c[_0x9963('0x57')]['id']){delete _0x4cff5c[_0x9963('0x57')]['id'];}return db[_0x9963('0x32')][_0x9963('0x2b')]({'where':{'id':_0x4cff5c[_0x9963('0x52')]['id']}})['then'](function(_0x535ee5){if(!_0x535ee5)return null;if(_0x535ee5['id']===_0x4cff5c[_0x9963('0x24')]['id']){if(!_0x4cff5c[_0x9963('0x57')][_0x9963('0x8a')]||!_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')]){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x8e'));}if(!_0x535ee5['authenticate'](_0x4cff5c[_0x9963('0x57')][_0x9963('0x8a')])){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x8f'));}if(_0x4cff5c[_0x9963('0x57')][_0x9963('0x8a')]===_0x4cff5c['body'][_0x9963('0x8b')]){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x90'));}}else if(_0x4cff5c['user']['role']===_0x9963('0x22')){if(!_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')]){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x91'));}}else if(_0x4cff5c[_0x9963('0x24')][_0x9963('0x1d')]===_0x9963('0x24')){if(!_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')]){throw new db['Sequelize'][(_0x9963('0x8d'))](_0x9963('0x91'));}if(_0x535ee5[_0x9963('0x1d')]!=='agent'){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x7a'));}}else{throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x7a'));}return _0x535ee5;})[_0x9963('0x1c')](handleEntityNotFound(_0x21b112,null))[_0x9963('0x1c')](function(_0xc5976b){return db[_0x9963('0x5d')][_0x9963('0x92')]({'attributes':['id','securePassword',_0x9963('0x93'),_0x9963('0x94')]})[_0x9963('0x1c')](function(_0x528687){if(_0x528687[_0x9963('0x5e')])authService[_0x9963('0x5f')](_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')]);if(!_0x528687[_0x9963('0x93')]||!_0xc5976b['previousPasswords'])return _0xc5976b;authService[_0x9963('0x95')](_0x4cff5c[_0x9963('0x57')]['newPassword'],_0xc5976b[_0x9963('0x96')],_0x528687[_0x9963('0x94')]);return _0xc5976b;})[_0x9963('0x1c')](saveUpdates({'password':_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')],'passwordResetAt':_0x4cff5c[_0x9963('0x24')]['id']==_0x4cff5c[_0x9963('0x52')]['id']?moment():null,'previousPasswords':authService[_0x9963('0x97')](_0x4cff5c[_0x9963('0x57')][_0x9963('0x8b')],_0xc5976b['previousPasswords'])},null));})[_0x9963('0x1c')](respondWithResult(_0x21b112,null))['catch'](handleError(_0x21b112,null));};exports[_0x9963('0x98')]=function(_0x11c7f2,_0x25840a){var _0x54c97c=_0x11c7f2[_0x9963('0x57')][_0x9963('0x99')];return db['User']['find']({'where':{'id':_0x11c7f2[_0x9963('0x52')]['id']},'attributes':['id',_0x9963('0x2d'),'role',_0x9963('0x9a'),_0x9963('0x9b'),_0x9963('0x9c'),_0x9963('0x9d')]})['then'](handleEntityNotFound(_0x25840a,null))['then'](function(_0x4d843e){if(_0x4d843e){if(!utils[_0x9963('0x9e')](_0x54c97c)){throw new db['Sequelize'][(_0x9963('0x8d'))](_0x9963('0x9f'));}return _0x4d843e[_0x9963('0xa0')+_[_0x9963('0xa1')](_0x54c97c['toLowerCase']())+_0x9963('0xa2')](_0x11c7f2[_0x9963('0x57')][_0x9963('0x5b')],{'penalty':_0x11c7f2['body'][_0x9963('0xa3')]||0x0})[_0x9963('0xa4')](function(_0x1853c7){for(var _0x5e237f=0x0;_0x5e237f<_0x11c7f2[_0x9963('0x57')][_0x9963('0x5b')][_0x9963('0x47')];_0x5e237f+=0x1){var _0x2433b6={'UserId':Number(_0x11c7f2['params']['id'])};_0x2433b6[_['capitalize'](_0x54c97c[_0x9963('0xa5')]())+_0x9963('0xa6')]=Number(_0x11c7f2[_0x9963('0x57')][_0x9963('0x5b')][_0x5e237f]);socket[_0x9963('0x1e')](_0x9963('0x24')+_[_0x9963('0xa1')](_0x54c97c[_0x9963('0xa5')]())+_0x9963('0xa7'),_0x2433b6);}return _0x1853c7;})[_0x9963('0x1c')](function(){if(_0x54c97c===_0x9963('0xa8')){return db[_0x9963('0xa9')][_0x9963('0x46')]({'where':{'id':_0x11c7f2[_0x9963('0x57')]['ids']||[]},'raw':!![],'attributes':['id',_0x9963('0x2d')]});}})[_0x9963('0x1c')](function(_0x39a0f5){var _0x48d57f=_0x4d843e[_0x9963('0x21')]({'plain':!![]});var _0x4ab6ea=[];if(_0x54c97c===_0x9963('0xa8')&&_0x48d57f[_0x9963('0x1d')]===_0x9963('0x25')&&_0x48d57f['online']){for(let _0x4a3bfe=0x0;_0x4a3bfe<_0x39a0f5[_0x9963('0x47')];_0x4a3bfe+=0x1){_0x4ab6ea['push']({'membername':_0x48d57f[_0x9963('0x2d')],'UserId':_0x48d57f['id'],'queue_name':_0x39a0f5[_0x4a3bfe][_0x9963('0x2d')],'VoiceQueueId':_0x39a0f5[_0x4a3bfe]['id'],'interface':_[_0x9963('0x61')](_0x48d57f['interface'])?util['format'](_0x9963('0xaa'),_0x48d57f[_0x9963('0x2d')]):_0x48d57f[_0x9963('0x9d')],'paused':_0x48d57f[_0x9963('0x9c')]||![],'penalty':_0x11c7f2[_0x9963('0x57')][_0x9963('0xa3')]||0x0});}return Promise[_0x9963('0x84')](_0x4ab6ea['map'](function(_0xdb4868){return db[_0x9963('0xab')][_0x9963('0xac')](_0xdb4868);}));}return _0x4d843e;});}})[_0x9963('0x1c')](respondWithStatusCode(_0x25840a,null))[_0x9963('0x50')](handleError(_0x25840a,null));};exports[_0x9963('0xad')]=function(_0x37a95c,_0x3d99a2){var _0x415208,_0x29fbaf;return db['User'][_0x9963('0x2b')]({'where':{'id':_0x37a95c[_0x9963('0x52')]['id']},'attributes':['id',_0x9963('0x2d'),_0x9963('0x1d')]})[_0x9963('0x1c')](handleEntityNotFound(_0x3d99a2,null))[_0x9963('0x1c')](function(_0x34dce8){if(_0x34dce8){_0x415208=_0x34dce8;if(!_0x37a95c[_0x9963('0x3f')]['channel']||!utils[_0x9963('0x9e')](_0x37a95c['query']['channel'])){throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0x9f'));}return _0x34dce8[_0x9963('0xae')+_[_0x9963('0xa1')](_0x37a95c[_0x9963('0x3f')][_0x9963('0x99')]['toLowerCase']())+_0x9963('0xa2')](_0x37a95c[_0x9963('0x3f')][_0x9963('0x5b')]);}})[_0x9963('0x1c')](function(_0x30e4ac){if(_[_0x9963('0xaf')](_0x37a95c[_0x9963('0x3f')][_0x9963('0x5b')])){for(var _0x418d81=0x0;_0x418d81<_0x37a95c['query'][_0x9963('0x5b')]['length'];_0x418d81+=0x1){_0x29fbaf={'UserId':Number(_0x37a95c['params']['id'])};_0x29fbaf[_['capitalize'](_0x37a95c[_0x9963('0x3f')][_0x9963('0x99')][_0x9963('0xa5')]())+_0x9963('0xa6')]=Number(_0x37a95c[_0x9963('0x3f')][_0x9963('0x5b')][_0x418d81]);socket[_0x9963('0x1e')](_0x9963('0x24')+_[_0x9963('0xa1')](_0x37a95c['query'][_0x9963('0x99')][_0x9963('0xa5')]())+_0x9963('0xb0'),_0x29fbaf);}}else{_0x29fbaf={'UserId':Number(_0x37a95c[_0x9963('0x52')]['id'])};_0x29fbaf[_['capitalize'](_0x37a95c['query'][_0x9963('0x99')][_0x9963('0xa5')]())+_0x9963('0xa6')]=Number(_0x37a95c[_0x9963('0x3f')][_0x9963('0x5b')]);socket[_0x9963('0x1e')](_0x9963('0x24')+_[_0x9963('0xa1')](_0x37a95c[_0x9963('0x3f')]['channel'][_0x9963('0xa5')]())+_0x9963('0xb0'),_0x29fbaf);}return _0x30e4ac;})[_0x9963('0x1c')](function(){if(_0x37a95c['query'][_0x9963('0x99')]==='voice'){return db['UserVoiceQueueRt'][_0x9963('0x20')]({'where':{'UserId':_0x37a95c[_0x9963('0x52')]['id'],'VoiceQueueId':_0x37a95c[_0x9963('0x3f')][_0x9963('0x5b')]},'individualHooks':!![]})[_0x9963('0x1c')](function(){return _0x415208;});}return _0x415208;})[_0x9963('0x1c')](respondWithStatusCode(_0x3d99a2,null))[_0x9963('0x50')](handleError(_0x3d99a2,null));};exports[_0x9963('0xb1')]=function(_0x2299c8,_0x5ccdca){_0x2299c8['body'][_0x9963('0xb2')]=_0x2299c8['file'][_0x9963('0xb3')];return db[_0x9963('0x32')]['find']({'where':{'id':_0x2299c8[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x5ccdca,null))['then'](saveUpdates(_0x2299c8[_0x9963('0x57')],null))[_0x9963('0x1c')](respondWithResult(_0x5ccdca,null))[_0x9963('0x50')](handleError(_0x5ccdca,null));};exports[_0x9963('0xb4')]=function(_0x4ab3c9,_0x23f104){var _0x28377d=path['join'](config[_0x9963('0xb5')],_0x9963('0xb6'));return db['User']['find']({'where':{'id':_0x4ab3c9['params']['id']},'attributes':['id',_0x9963('0xb2')],'raw':!![]})[_0x9963('0x1c')](handleEntityNotFound(_0x23f104,null))[_0x9963('0x1c')](function(_0x1d0e1b){if(_0x1d0e1b){if(_[_0x9963('0x61')](_0x1d0e1b['userpic'])){return _0x23f104[_0x9963('0xb7')](_0x28377d);}else{if(!fs['existsSync'](path[_0x9963('0xb8')](config[_0x9963('0xb5')],'server/files/images/',_0x1d0e1b[_0x9963('0xb2')]))){return _0x23f104[_0x9963('0xb7')](_0x28377d);}return _0x23f104[_0x9963('0xb7')](path[_0x9963('0xb8')](config[_0x9963('0xb5')],'server/files/images/',_0x1d0e1b[_0x9963('0xb2')]));}}})['catch'](handleError(_0x23f104,null));};exports['getOpenTabs']=function(_0x1e1fcc,_0x25b967){return db[_0x9963('0x32')]['find']({'where':{'id':_0x1e1fcc[_0x9963('0x52')]['id']},'attributes':['id']})[_0x9963('0x1c')](handleEntityNotFound(_0x25b967,null))[_0x9963('0x1c')](function(_0x3b1f54){var _0x2d9a92=[];values=_0x3b1f54[_0x9963('0x4a')];_0x2d9a92[_0x9963('0x4c')](get_open_tabs(_0x9963('0x48'),_0x3b1f54['dataValues']));_0x2d9a92[_0x9963('0x4c')](get_open_tabs('sms',_0x3b1f54['dataValues']));_0x2d9a92[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4e'),_0x3b1f54['dataValues']));_0x2d9a92[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4f'),_0x3b1f54['dataValues']));_0x2d9a92[_0x9963('0x4c')](get_open_tabs(_0x9963('0x4d'),_0x3b1f54[_0x9963('0x4a')]));_0x2d9a92['push'](get_open_tabs(_0x9963('0x56'),_0x3b1f54['dataValues']));return Promise[_0x9963('0x84')](_0x2d9a92);})[_0x9963('0x1c')](function(_0xef754d){if(_0xef754d){var _0x29eb45=_[_0x9963('0x29')](values[_0x9963('0xb9')],function(_0x301817){return{'channel':'CHAT','id':_0x301817['id'],'createdAt':_0x301817[_0x9963('0xba')]};});var _0x7e5bec=_[_0x9963('0x29')](values['FaxOpenTabs'],function(_0x32864a){return{'channel':_0x9963('0xbb'),'id':_0x32864a['id'],'createdAt':_0x32864a['createdAt']};});var _0x55ada1=_[_0x9963('0x29')](values['OpenchannelOpenTabs'],function(_0x54d7ac){return{'channel':'OPENCHANNEL','id':_0x54d7ac['id'],'createdAt':_0x54d7ac[_0x9963('0xba')]};});var _0x3ec09e=_[_0x9963('0x29')](values[_0x9963('0xbc')],function(_0x83b6a){return{'channel':'MAIL','id':_0x83b6a['id'],'createdAt':_0x83b6a['createdAt']};});var _0x1528f4=_[_0x9963('0x29')](values['SmsOpenTabs'],function(_0xf4467c){return{'channel':_0x9963('0xbd'),'id':_0xf4467c['id'],'createdAt':_0xf4467c[_0x9963('0xba')]};});var _0x211942=_[_0x9963('0x29')](values[_0x9963('0xbe')],function(_0xc41eb8){return{'channel':_0x9963('0xbf'),'id':_0xc41eb8['id'],'createdAt':_0xc41eb8[_0x9963('0xba')]};});var _0x1f0657=_[_0x9963('0xc0')](_0x29eb45,_0x7e5bec,_0x55ada1,_0x3ec09e,_0x1528f4,_0x211942);var _0xb3a5ca={'count':_0x1f0657[_0x9963('0x47')],'rows':_0x1f0657};return _0xb3a5ca;}else return null;})[_0x9963('0x1c')](respondWithResult(_0x25b967,null))['catch'](handleError(_0x25b967,null));};exports[_0x9963('0xc1')]=function(_0x54db3e,_0x231d80){var _0x33b867={};return db['User'][_0x9963('0x92')]({'where':{'id':_0x54db3e[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](function(_0x4f67d6){if(!_0x4f67d6){throw new APINotFoundError(util[_0x9963('0xc2')](_0x9963('0xc3'),_0x54db3e[_0x9963('0x52')]['id']));}return contacts['describe']();})[_0x9963('0x1c')](function(_0x2f1c4b){_0x54db3e[_0x9963('0x3f')]['User']=_0x54db3e[_0x9963('0x52')]['id'];_0x33b867=qs['getOptions'](_0x2f1c4b,_0x54db3e);if(_0x54db3e[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0x40'))){_0x33b867[_0x9963('0x41')]=[{'model':db[_0x9963('0xc5')],'as':_0x9963('0xc6'),'required':![]},{'model':db[_0x9963('0xc7')],'as':_0x9963('0xc8'),'attributes':['id',_0x9963('0x2d'),'color'],'where':_0x54db3e[_0x9963('0x3f')][_0x9963('0xc9')]?{'id':_0x54db3e[_0x9963('0x3f')]['tag']}:undefined,'required':_0x54db3e[_0x9963('0x3f')]['tag']?!![]:![]}];}return contacts[_0x9963('0x46')](_0x54db3e[_0x9963('0x3f')],_0x54db3e[_0x9963('0x24')],_0x33b867,_0x2f1c4b);})[_0x9963('0x1c')](respondWithFilteredResult(_0x231d80,_0x33b867))[_0x9963('0x50')](APIHandleError(_0x231d80));};exports[_0x9963('0xca')]=function(_0x1484f2,_0x35bda6){var _0x3f1f35;var _0x28728a={};var _0x38906a;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x1484f2['params']['id']},'attributes':['id','name','role']})[_0x9963('0x1c')](handleEntityNotFound(_0x35bda6,null))['then'](function(_0x2e73f4){if(!utils['isValidChannel'](_0x1484f2[_0x9963('0x3f')][_0x9963('0x99')])){throw new db[(_0x9963('0x8c'))]['ValidationError'](_0x9963('0x9f'));}_0x3f1f35=_0x2e73f4;var _0xc5ff14={};_0xc5ff14[_0x9963('0xcb')]=_['keys'](db[_[_0x9963('0xa1')](_0x1484f2[_0x9963('0x3f')][_0x9963('0x99')])+'Queue']['rawAttributes']);_0xc5ff14[_0x9963('0x3f')]=_['keys'](_0x1484f2[_0x9963('0x3f')]);_0xc5ff14[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0xc5ff14[_0x9963('0xcb')],_0xc5ff14[_0x9963('0x3f')]);_0x28728a[_0x9963('0x45')]=_[_0x9963('0xcd')](_0xc5ff14[_0x9963('0xcb')],qs['fields'](_0x1484f2[_0x9963('0x3f')][_0x9963('0xce')]));_0x28728a['attributes']=_0x28728a[_0x9963('0x45')][_0x9963('0x47')]?_0x28728a[_0x9963('0x45')]:_0xc5ff14['model'];_0x28728a[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x1484f2[_0x9963('0x3f')]['sort']);_0x28728a[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_['pick'](_0x1484f2[_0x9963('0x3f')],_0xc5ff14['filters']));if(_0x1484f2[_0x9963('0x3f')][_0x9963('0x27')]){_0x28728a[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x28728a[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x28728a[_0x9963('0x45')],function(_0x4d80af){var _0x52a92e={};_0x52a92e[_0x4d80af]={'$like':'%'+_0x1484f2['query'][_0x9963('0x27')]+'%'};return _0x52a92e;})});}_0x28728a=_[_0x9963('0x53')]({},_0x28728a,_0x1484f2[_0x9963('0x54')]);switch(_0x3f1f35['role']){case _0x9963('0x22'):return db[_[_0x9963('0xa1')](_0x1484f2[_0x9963('0x3f')]['channel'])+_0x9963('0xd1')][_0x9963('0x46')](_0x28728a);case _0x9963('0x24'):case _0x9963('0x25'):return _0x3f1f35[_0x9963('0x21')+_['capitalize'](_0x1484f2['query']['channel'])+_0x9963('0xa2')](_0x28728a);default:throw new db[(_0x9963('0x8c'))]['ValidationError'](_0x9963('0xd2'));}})['then'](function(_0x470b3a){_0x38906a=_0x470b3a['length'];if(!_0x1484f2['query']['hasOwnProperty']('nolimit')){_0x28728a[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x1484f2[_0x9963('0x3f')][_0x9963('0x17')]);_0x28728a['offset']=qs[_0x9963('0x19')](_0x1484f2[_0x9963('0x3f')][_0x9963('0x19')]);}switch(_0x3f1f35[_0x9963('0x1d')]){case'admin':return db[_['capitalize'](_0x1484f2[_0x9963('0x3f')][_0x9963('0x99')])+_0x9963('0xd1')][_0x9963('0x46')](_0x28728a);case _0x9963('0x24'):case _0x9963('0x25'):return _0x3f1f35[_0x9963('0x21')+_[_0x9963('0xa1')](_0x1484f2['query'][_0x9963('0x99')])+_0x9963('0xa2')](_0x28728a);}})[_0x9963('0x1c')](function(_0x4ced0b){return{'count':_0x38906a,'rows':_0x4ced0b};})[_0x9963('0x1c')](respondWithResult(_0x35bda6,null))[_0x9963('0x50')](handleError(_0x35bda6,null));};exports[_0x9963('0xd3')]=function(_0x88b4d8,_0x9e71e2){var _0x5d1f0c={};var _0x53c192={};var _0x25ea4b;var _0x5a3d9b;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x88b4d8[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x9e71e2,null))[_0x9963('0x1c')](function(_0x4024a6){if(_0x4024a6){_0x25ea4b=_0x4024a6;_0x53c192[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xab')][_0x9963('0x33')]);_0x53c192[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x88b4d8['query']);_0x53c192[_0x9963('0xcc')]=_['intersection'](_0x53c192[_0x9963('0xcb')],_0x53c192[_0x9963('0x3f')]);_0x5d1f0c[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x53c192[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x88b4d8['query']['fields']));_0x5d1f0c['attributes']=_0x5d1f0c[_0x9963('0x45')][_0x9963('0x47')]?_0x5d1f0c['attributes']:_0x53c192['model'];_0x5d1f0c['order']=qs[_0x9963('0xd0')](_0x88b4d8['query']['sort']);_0x5d1f0c[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x88b4d8[_0x9963('0x3f')],_0x53c192[_0x9963('0xcc')]));if(_0x88b4d8['query'][_0x9963('0x27')]){_0x5d1f0c[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x5d1f0c[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x5d1f0c['attributes'],function(_0x4d9efb){var _0xfd6425={};_0xfd6425[_0x4d9efb]={'$like':'%'+_0x88b4d8[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0xfd6425;})});}_0x5d1f0c=_[_0x9963('0x53')]({},_0x5d1f0c,_0x88b4d8[_0x9963('0x54')]);return _0x25ea4b[_0x9963('0xd3')](_0x5d1f0c);}})[_0x9963('0x1c')](function(_0x3bc6b8){if(_0x3bc6b8){_0x5a3d9b=_0x3bc6b8[_0x9963('0x47')];if(!_0x88b4d8[_0x9963('0x3f')][_0x9963('0xc4')]('nolimit')){_0x5d1f0c[_0x9963('0x17')]=qs['limit'](_0x88b4d8[_0x9963('0x3f')][_0x9963('0x17')]);_0x5d1f0c[_0x9963('0x19')]=qs['offset'](_0x88b4d8[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x25ea4b[_0x9963('0xd3')](_0x5d1f0c);}})[_0x9963('0x1c')](function(_0x19f455){if(_0x19f455){return _0x19f455?{'count':_0x5a3d9b,'rows':_0x19f455}:null;}})['then'](respondWithResult(_0x9e71e2,null))[_0x9963('0x50')](handleError(_0x9e71e2,null));};exports['getGroups']=function(_0x27899b,_0x2cf7f1){var _0x352b0d={};var _0x111cec={};var _0x30f115;var _0x22aeee;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x27899b[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x2cf7f1,null))[_0x9963('0x1c')](function(_0x585a00){if(_0x585a00){_0x30f115=_0x585a00;_0x111cec[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xd6')][_0x9963('0x33')]);_0x111cec['query']=_[_0x9963('0xd4')](_0x27899b[_0x9963('0x3f')]);_0x111cec[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x111cec['model'],_0x111cec[_0x9963('0x3f')]);_0x352b0d[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x111cec[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x27899b[_0x9963('0x3f')][_0x9963('0xce')]));_0x352b0d[_0x9963('0x45')]=_0x352b0d['attributes'][_0x9963('0x47')]?_0x352b0d[_0x9963('0x45')]:_0x111cec[_0x9963('0xcb')];_0x352b0d['order']=qs[_0x9963('0xd0')](_0x27899b[_0x9963('0x3f')]['sort']);_0x352b0d[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x27899b[_0x9963('0x3f')],_0x111cec[_0x9963('0xcc')]));if(_0x27899b[_0x9963('0x3f')]['filter']){_0x352b0d[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x352b0d[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x352b0d[_0x9963('0x45')],function(_0x388f98){var _0x45becc={};_0x45becc[_0x388f98]={'$like':'%'+_0x27899b['query'][_0x9963('0x27')]+'%'};return _0x45becc;})});}_0x352b0d=_[_0x9963('0x53')]({},_0x352b0d,_0x27899b[_0x9963('0x54')]);return _0x30f115[_0x9963('0xd7')](_0x352b0d);}})[_0x9963('0x1c')](function(_0x4fc38a){if(_0x4fc38a){_0x22aeee=_0x4fc38a[_0x9963('0x47')];if(!_0x27899b[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0xd8'))){_0x352b0d[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x27899b['query']['limit']);_0x352b0d[_0x9963('0x19')]=qs['offset'](_0x27899b[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x30f115[_0x9963('0xd7')](_0x352b0d);}})[_0x9963('0x1c')](function(_0x5030cd){if(_0x5030cd){return _0x5030cd?{'count':_0x22aeee,'rows':_0x5030cd}:null;}})[_0x9963('0x1c')](respondWithResult(_0x2cf7f1,null))[_0x9963('0x50')](handleError(_0x2cf7f1,null));};exports['getRecordings']=function(_0xaaf313,_0x56fe64){var _0x1a6590={'raw':!![],'where':{}};var _0x112b37={};var _0x30180e={'count':0x0,'rows':[]};return db['User'][_0x9963('0x92')]({'where':{'id':_0xaaf313['params']['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x56fe64,null))[_0x9963('0x1c')](function(_0x4bfb87){if(_0x4bfb87){_0x112b37[_0x9963('0xcb')]=_[_0x9963('0xd4')](db['VoiceRecording'][_0x9963('0x33')]);_0x112b37[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0xaaf313[_0x9963('0x3f')]);_0x112b37[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x112b37[_0x9963('0xcb')],_0x112b37['query']);_0x1a6590['attributes']=_[_0x9963('0xcd')](_0x112b37[_0x9963('0xcb')],qs[_0x9963('0xce')](_0xaaf313['query']['fields']));_0x1a6590['attributes']=_0x1a6590[_0x9963('0x45')][_0x9963('0x47')]?_0x1a6590[_0x9963('0x45')]:_0x112b37['model'];if(!_0xaaf313[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0xd8'))){_0x1a6590[_0x9963('0x17')]=qs[_0x9963('0x17')](_0xaaf313[_0x9963('0x3f')][_0x9963('0x17')]);_0x1a6590[_0x9963('0x19')]=qs[_0x9963('0x19')](_0xaaf313[_0x9963('0x3f')][_0x9963('0x19')]);}_0x1a6590['order']=qs['sort'](_0xaaf313['query'][_0x9963('0xd0')]);_0x1a6590[_0x9963('0x3e')]=qs['filters'](_['pick'](_0xaaf313[_0x9963('0x3f')],_0x112b37[_0x9963('0xcc')]));_0x1a6590[_0x9963('0x3e')][_0x9963('0xd9')]=_0x4bfb87['id'];if(_0xaaf313[_0x9963('0x3f')]['filter']){_0x1a6590[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x1a6590['where'],{'$or':_[_0x9963('0x29')](_0x1a6590[_0x9963('0x45')],function(_0x31f238){var _0x147f69={};_0x147f69[_0x31f238]={'$like':'%'+_0xaaf313['query'][_0x9963('0x27')]+'%'};return _0x147f69;})});}_0x1a6590=_['merge']({},_0x1a6590,_0xaaf313[_0x9963('0x54')]);return db['VoiceRecording'][_0x9963('0x18')]({'where':_0x1a6590[_0x9963('0x3e')]})[_0x9963('0x1c')](function(_0x5f1e27){_0x30180e[_0x9963('0x18')]=_0x5f1e27;if(_0xaaf313[_0x9963('0x3f')][_0x9963('0x40')]){_0x1a6590[_0x9963('0x41')]=[{'all':!![]}];}return db[_0x9963('0xda')][_0x9963('0x46')](_0x1a6590);})[_0x9963('0x1c')](function(_0x1e088d){_0x30180e['rows']=_0x1e088d;return _0x30180e;});}})[_0x9963('0x1c')](respondWithFilteredResult(_0x56fe64,_0x1a6590))[_0x9963('0x50')](handleError(_0x56fe64,null));};exports[_0x9963('0xdb')]=function(_0x2a692e,_0x179a2f){var _0x426b17={'raw':!![],'where':{}};var _0x11e212={};var _0x4c3d23={'count':0x0,'rows':[]};return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x2a692e[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x179a2f,null))[_0x9963('0x1c')](function(_0x1ba520){if(_0x1ba520){_0x11e212[_0x9963('0xcb')]=_[_0x9963('0xd4')](db['ScreenRecording'][_0x9963('0x33')]);_0x11e212[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x2a692e[_0x9963('0x3f')]);_0x11e212[_0x9963('0xcc')]=_['intersection'](_0x11e212[_0x9963('0xcb')],_0x11e212[_0x9963('0x3f')]);_0x426b17['attributes']=_[_0x9963('0xcd')](_0x11e212[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x2a692e['query'][_0x9963('0xce')]));_0x426b17[_0x9963('0x45')]=_0x426b17[_0x9963('0x45')]['length']?_0x426b17[_0x9963('0x45')]:_0x11e212[_0x9963('0xcb')];if(!_0x2a692e[_0x9963('0x3f')][_0x9963('0xc4')]('nolimit')){_0x426b17[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x2a692e['query']['limit']);_0x426b17['offset']=qs[_0x9963('0x19')](_0x2a692e[_0x9963('0x3f')][_0x9963('0x19')]);}_0x426b17[_0x9963('0xcf')]=qs['sort'](_0x2a692e[_0x9963('0x3f')][_0x9963('0xd0')]);_0x426b17[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x2a692e[_0x9963('0x3f')],_0x11e212['filters']));_0x426b17[_0x9963('0x3e')]['UserId']=_0x1ba520['id'];if(_0x2a692e['query'][_0x9963('0x27')]){_0x426b17[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x426b17[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x426b17[_0x9963('0x45')],function(_0x2b2ddc){var _0x1b0e68={};_0x1b0e68[_0x2b2ddc]={'$like':'%'+_0x2a692e[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0x1b0e68;})});}_0x426b17=_['merge']({},_0x426b17,_0x2a692e[_0x9963('0x54')]);return db[_0x9963('0xdc')][_0x9963('0x18')]({'where':_0x426b17[_0x9963('0x3e')]})['then'](function(_0x580237){_0x4c3d23[_0x9963('0x18')]=_0x580237;if(_0x2a692e[_0x9963('0x3f')][_0x9963('0x40')]){_0x426b17[_0x9963('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x9963('0x46')](_0x426b17);})[_0x9963('0x1c')](function(_0x524bd2){_0x4c3d23[_0x9963('0x49')]=_0x524bd2;return _0x4c3d23;});}})[_0x9963('0x1c')](respondWithFilteredResult(_0x179a2f,_0x426b17))['catch'](handleError(_0x179a2f,null));};exports[_0x9963('0xdd')]=function(_0x57757b,_0x76a29e){var _0x3ee61b={};var _0x2de322={};var _0x1e0ee8;var _0x1d160a;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x57757b[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x76a29e,null))[_0x9963('0x1c')](function(_0x3b3cce){if(_0x3b3cce){_0x1e0ee8=_0x3b3cce;_0x2de322[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xde')][_0x9963('0x33')]);_0x2de322[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x57757b['query']);_0x2de322[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x2de322[_0x9963('0xcb')],_0x2de322[_0x9963('0x3f')]);_0x3ee61b[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x2de322[_0x9963('0xcb')],qs['fields'](_0x57757b[_0x9963('0x3f')][_0x9963('0xce')]));_0x3ee61b[_0x9963('0x45')]=_0x3ee61b[_0x9963('0x45')][_0x9963('0x47')]?_0x3ee61b[_0x9963('0x45')]:_0x2de322['model'];_0x3ee61b['order']=qs[_0x9963('0xd0')](_0x57757b['query'][_0x9963('0xd0')]);_0x3ee61b[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x57757b[_0x9963('0x3f')],_0x2de322['filters']));if(_0x57757b['query'][_0x9963('0x27')]){_0x3ee61b['where']=_[_0x9963('0x53')](_0x3ee61b['where'],{'$or':_[_0x9963('0x29')](_0x3ee61b[_0x9963('0x45')],function(_0x12523a){var _0x141848={};_0x141848[_0x12523a]={'$like':'%'+_0x57757b[_0x9963('0x3f')]['filter']+'%'};return _0x141848;})});}_0x3ee61b=_['merge']({},_0x3ee61b,_0x57757b[_0x9963('0x54')]);return _0x1e0ee8[_0x9963('0xdd')](_0x3ee61b);}})['then'](function(_0xdd9e9e){if(_0xdd9e9e){_0x1d160a=_0xdd9e9e[_0x9963('0x47')];if(!_0x57757b[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0xd8'))){_0x3ee61b[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x57757b['query'][_0x9963('0x17')]);_0x3ee61b[_0x9963('0x19')]=qs[_0x9963('0x19')](_0x57757b[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x1e0ee8['getChatInteractions'](_0x3ee61b);}})['then'](function(_0x2f48f3){if(_0x2f48f3){return _0x2f48f3?{'count':_0x1d160a,'rows':_0x2f48f3}:null;}})[_0x9963('0x1c')](respondWithResult(_0x76a29e,null))['catch'](handleError(_0x76a29e,null));};exports[_0x9963('0xdf')]=function(_0x50046e,_0x33e2bf){var _0x2abee3={};var _0x39d401={};var _0x4d4a07;var _0x38f26e;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x50046e[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x33e2bf,null))[_0x9963('0x1c')](function(_0x1c893c){if(_0x1c893c){_0x4d4a07=_0x1c893c;_0x39d401[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xe0')][_0x9963('0x33')]);_0x39d401['query']=_[_0x9963('0xd4')](_0x50046e[_0x9963('0x3f')]);_0x39d401[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x39d401[_0x9963('0xcb')],_0x39d401[_0x9963('0x3f')]);_0x2abee3[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x39d401['model'],qs[_0x9963('0xce')](_0x50046e['query']['fields']));_0x2abee3['attributes']=_0x2abee3[_0x9963('0x45')][_0x9963('0x47')]?_0x2abee3[_0x9963('0x45')]:_0x39d401[_0x9963('0xcb')];_0x2abee3[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x50046e[_0x9963('0x3f')]['sort']);_0x2abee3['where']=qs[_0x9963('0xcc')](_['pick'](_0x50046e[_0x9963('0x3f')],_0x39d401[_0x9963('0xcc')]));if(_0x50046e['query'][_0x9963('0x27')]){_0x2abee3[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x2abee3[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x2abee3['attributes'],function(_0x5c67c9){var _0x5532cc={};_0x5532cc[_0x5c67c9]={'$like':'%'+_0x50046e[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0x5532cc;})});}_0x2abee3=_[_0x9963('0x53')]({},_0x2abee3,_0x50046e['options']);return _0x4d4a07[_0x9963('0xdf')](_0x2abee3);}})[_0x9963('0x1c')](function(_0xfbbd8c){if(_0xfbbd8c){_0x38f26e=_0xfbbd8c[_0x9963('0x47')];if(!_0x50046e['query'][_0x9963('0xc4')]('nolimit')){_0x2abee3[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x50046e[_0x9963('0x3f')][_0x9963('0x17')]);_0x2abee3[_0x9963('0x19')]=qs[_0x9963('0x19')](_0x50046e[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x4d4a07[_0x9963('0xdf')](_0x2abee3);}})[_0x9963('0x1c')](function(_0x16ad8c){if(_0x16ad8c){return _0x16ad8c?{'count':_0x38f26e,'rows':_0x16ad8c}:null;}})[_0x9963('0x1c')](respondWithResult(_0x33e2bf,null))['catch'](handleError(_0x33e2bf,null));};exports['getMailInteractions']=function(_0x4b04d1,_0x22af76){var _0x500d9e={'raw':!![],'where':{}};var _0x41b7e3={};var _0x2c0325={'count':0x0,'rows':[]};return db['User'][_0x9963('0x92')]({'where':{'id':_0x4b04d1[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x22af76,null))[_0x9963('0x1c')](function(_0x25a3ee){if(_0x25a3ee){_0x41b7e3[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xe1')]['rawAttributes']);_0x41b7e3[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x4b04d1[_0x9963('0x3f')]);_0x41b7e3['filters']=_[_0x9963('0xcd')](_0x41b7e3[_0x9963('0xcb')],_0x41b7e3[_0x9963('0x3f')]);_0x500d9e[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x41b7e3[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x4b04d1[_0x9963('0x3f')]['fields']));_0x500d9e[_0x9963('0x45')]=_0x500d9e[_0x9963('0x45')][_0x9963('0x47')]?_0x500d9e[_0x9963('0x45')]:_0x41b7e3['model'];if(!_0x4b04d1['query'][_0x9963('0xc4')](_0x9963('0xd8'))){_0x500d9e[_0x9963('0x17')]=qs['limit'](_0x4b04d1[_0x9963('0x3f')][_0x9963('0x17')]);_0x500d9e[_0x9963('0x19')]=qs[_0x9963('0x19')](_0x4b04d1[_0x9963('0x3f')][_0x9963('0x19')]);}_0x500d9e[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x4b04d1[_0x9963('0x3f')][_0x9963('0xd0')]);_0x500d9e[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x4b04d1[_0x9963('0x3f')],_0x41b7e3['filters']));_0x500d9e['where'][_0x9963('0xd9')]=_0x25a3ee['id'];if(_0x4b04d1[_0x9963('0x3f')][_0x9963('0x27')]){_0x500d9e['where']=_[_0x9963('0x53')](_0x500d9e[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x500d9e[_0x9963('0x45')],function(_0x205440){var _0x1f4928={};_0x1f4928[_0x205440]={'$like':'%'+_0x4b04d1[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0x1f4928;})});}_0x500d9e=_[_0x9963('0x53')]({},_0x500d9e,_0x4b04d1['options']);return db[_0x9963('0xe1')][_0x9963('0x18')]({'where':_0x500d9e[_0x9963('0x3e')]})[_0x9963('0x1c')](function(_0xa5b1ef){_0x2c0325['count']=_0xa5b1ef;if(_0x4b04d1[_0x9963('0x3f')][_0x9963('0x40')]){_0x500d9e[_0x9963('0x41')]=[{'all':!![]}];}return db['MailInteraction'][_0x9963('0x46')](_0x500d9e);})['then'](function(_0x5638e7){_0x2c0325['rows']=_0x5638e7;return _0x2c0325;});}})['then'](respondWithFilteredResult(_0x22af76,_0x500d9e))['catch'](handleError(_0x22af76,null));};exports[_0x9963('0xe2')]=function(_0x1ee70c,_0x31cb2f){var _0x4acb52={};var _0xd884ae={};var _0x2d2801;var _0x6dbad9;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x1ee70c[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x31cb2f,null))[_0x9963('0x1c')](function(_0x43a1ab){if(_0x43a1ab){_0x2d2801=_0x43a1ab;_0xd884ae[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xe3')][_0x9963('0x33')]);_0xd884ae[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x1ee70c[_0x9963('0x3f')]);_0xd884ae[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0xd884ae[_0x9963('0xcb')],_0xd884ae[_0x9963('0x3f')]);_0x4acb52['attributes']=_[_0x9963('0xcd')](_0xd884ae[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x1ee70c[_0x9963('0x3f')][_0x9963('0xce')]));_0x4acb52[_0x9963('0x45')]=_0x4acb52['attributes'][_0x9963('0x47')]?_0x4acb52[_0x9963('0x45')]:_0xd884ae[_0x9963('0xcb')];_0x4acb52[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x1ee70c['query'][_0x9963('0xd0')]);_0x4acb52[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x1ee70c[_0x9963('0x3f')],_0xd884ae[_0x9963('0xcc')]));if(_0x1ee70c[_0x9963('0x3f')][_0x9963('0x27')]){_0x4acb52[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x4acb52[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x4acb52[_0x9963('0x45')],function(_0x24770e){var _0x4daf8b={};_0x4daf8b[_0x24770e]={'$like':'%'+_0x1ee70c[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0x4daf8b;})});}_0x4acb52=_[_0x9963('0x53')]({},_0x4acb52,_0x1ee70c[_0x9963('0x54')]);return _0x2d2801[_0x9963('0xe2')](_0x4acb52);}})[_0x9963('0x1c')](function(_0x3251b5){if(_0x3251b5){_0x6dbad9=_0x3251b5[_0x9963('0x47')];if(!_0x1ee70c[_0x9963('0x3f')]['hasOwnProperty'](_0x9963('0xd8'))){_0x4acb52['limit']=qs[_0x9963('0x17')](_0x1ee70c[_0x9963('0x3f')][_0x9963('0x17')]);_0x4acb52[_0x9963('0x19')]=qs[_0x9963('0x19')](_0x1ee70c['query'][_0x9963('0x19')]);}return _0x2d2801['getSmsInteractions'](_0x4acb52);}})['then'](function(_0x4997b2){if(_0x4997b2){return _0x4997b2?{'count':_0x6dbad9,'rows':_0x4997b2}:null;}})[_0x9963('0x1c')](respondWithResult(_0x31cb2f,null))[_0x9963('0x50')](handleError(_0x31cb2f,null));};exports[_0x9963('0xe4')]=function(_0x4062ff,_0xdcf78c){var _0x19a48d={};var _0x238425={};var _0x127dca;var _0x59938d;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x4062ff[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0xdcf78c,null))[_0x9963('0x1c')](function(_0x2edacc){if(_0x2edacc){_0x127dca=_0x2edacc;_0x238425[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xe5')][_0x9963('0x33')]);_0x238425[_0x9963('0x3f')]=_['keys'](_0x4062ff[_0x9963('0x3f')]);_0x238425[_0x9963('0xcc')]=_['intersection'](_0x238425[_0x9963('0xcb')],_0x238425[_0x9963('0x3f')]);_0x19a48d[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x238425[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x4062ff[_0x9963('0x3f')]['fields']));_0x19a48d['attributes']=_0x19a48d['attributes']['length']?_0x19a48d[_0x9963('0x45')]:_0x238425[_0x9963('0xcb')];_0x19a48d[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x4062ff[_0x9963('0x3f')][_0x9963('0xd0')]);_0x19a48d['where']=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x4062ff[_0x9963('0x3f')],_0x238425[_0x9963('0xcc')]));if(_0x4062ff[_0x9963('0x3f')][_0x9963('0x27')]){_0x19a48d['where']=_['merge'](_0x19a48d[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x19a48d[_0x9963('0x45')],function(_0xc110eb){var _0x28845a={};_0x28845a[_0xc110eb]={'$like':'%'+_0x4062ff[_0x9963('0x3f')]['filter']+'%'};return _0x28845a;})});}_0x19a48d=_[_0x9963('0x53')]({},_0x19a48d,_0x4062ff[_0x9963('0x54')]);return _0x127dca[_0x9963('0xe4')](_0x19a48d);}})[_0x9963('0x1c')](function(_0x5a0fcb){if(_0x5a0fcb){_0x59938d=_0x5a0fcb[_0x9963('0x47')];if(!_0x4062ff[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0xd8'))){_0x19a48d[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x4062ff[_0x9963('0x3f')][_0x9963('0x17')]);_0x19a48d['offset']=qs[_0x9963('0x19')](_0x4062ff['query']['offset']);}return _0x127dca[_0x9963('0xe4')](_0x19a48d);}})[_0x9963('0x1c')](function(_0x2d4ac1){if(_0x2d4ac1){return _0x2d4ac1?{'count':_0x59938d,'rows':_0x2d4ac1}:null;}})[_0x9963('0x1c')](respondWithResult(_0xdcf78c,null))[_0x9963('0x50')](handleError(_0xdcf78c,null));};exports['getWhatsappInteractions']=function(_0x2767b2,_0x2b3dc4){var _0x9589cc={};var _0xa5f483={};var _0x31daa8;var _0x18672b;return db[_0x9963('0x32')]['findOne']({'where':{'id':_0x2767b2[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x2b3dc4,null))[_0x9963('0x1c')](function(_0x106fd2){if(_0x106fd2){_0x31daa8=_0x106fd2;_0xa5f483[_0x9963('0xcb')]=_[_0x9963('0xd4')](db[_0x9963('0xe6')][_0x9963('0x33')]);_0xa5f483[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x2767b2[_0x9963('0x3f')]);_0xa5f483['filters']=_['intersection'](_0xa5f483[_0x9963('0xcb')],_0xa5f483['query']);_0x9589cc['attributes']=_[_0x9963('0xcd')](_0xa5f483[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x2767b2[_0x9963('0x3f')][_0x9963('0xce')]));_0x9589cc[_0x9963('0x45')]=_0x9589cc[_0x9963('0x45')][_0x9963('0x47')]?_0x9589cc[_0x9963('0x45')]:_0xa5f483[_0x9963('0xcb')];_0x9589cc['order']=qs['sort'](_0x2767b2[_0x9963('0x3f')]['sort']);_0x9589cc[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_['pick'](_0x2767b2[_0x9963('0x3f')],_0xa5f483[_0x9963('0xcc')]));if(_0x2767b2['query'][_0x9963('0x27')]){_0x9589cc[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x9589cc[_0x9963('0x3e')],{'$or':_[_0x9963('0x29')](_0x9589cc[_0x9963('0x45')],function(_0x5218c4){var _0x4cf53b={};_0x4cf53b[_0x5218c4]={'$like':'%'+_0x2767b2['query'][_0x9963('0x27')]+'%'};return _0x4cf53b;})});}_0x9589cc=_[_0x9963('0x53')]({},_0x9589cc,_0x2767b2['options']);return _0x31daa8['getWhatsappInteractions'](_0x9589cc);}})[_0x9963('0x1c')](function(_0x5d3ce3){if(_0x5d3ce3){_0x18672b=_0x5d3ce3[_0x9963('0x47')];if(!_0x2767b2[_0x9963('0x3f')][_0x9963('0xc4')](_0x9963('0xd8'))){_0x9589cc[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x2767b2[_0x9963('0x3f')][_0x9963('0x17')]);_0x9589cc[_0x9963('0x19')]=qs['offset'](_0x2767b2[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x31daa8[_0x9963('0xe7')](_0x9589cc);}})[_0x9963('0x1c')](function(_0x165a93){if(_0x165a93){return _0x165a93?{'count':_0x18672b,'rows':_0x165a93}:null;}})['then'](respondWithResult(_0x2b3dc4,null))[_0x9963('0x50')](handleError(_0x2b3dc4,null));};exports[_0x9963('0xe8')]=function(_0x1cb052,_0x56abf0,_0x3f8de5){var _0x1890eb;var _0x55e7bd;var _0x9f8d6;var _0x4e81b2=!_['isNil'](_0x1cb052['params']['id'])?_0x1cb052[_0x9963('0x52')]['id']:!_[_0x9963('0x61')](_0x1cb052['user']['id'])?_0x1cb052[_0x9963('0x24')]['id']:null;return db[_0x9963('0x32')][_0x9963('0x2b')]({'where':{'id':_0x4e81b2,'role':{'$or':['admin',_0x9963('0x24'),_0x9963('0x25')]}},'attributes':['id',_0x9963('0x2d'),_0x9963('0xe9'),_0x9963('0xea'),_0x9963('0x1d'),'internal','loginInPause']})[_0x9963('0x1c')](function(_0x53aacb){if(_0x53aacb){if(_0x53aacb[_0x9963('0x1d')]==='agent'){_0x1890eb=_0x53aacb;if(_0x1cb052['body'][_0x9963('0x9d')]){_0x9f8d6=util[_0x9963('0xc2')]('LOCAL/%s@from-sip/n',_0x1890eb[_0x1cb052[_0x9963('0x57')][_0x9963('0x9d')]]);}else if(_0x1cb052[_0x9963('0x57')][_0x9963('0xeb')]){_0x9f8d6=util['format'](_0x9963('0xaa'),_0x1cb052[_0x9963('0x57')]['intrf']);}else{_0x9f8d6=util['format'](_0x9963('0xaa'),_0x1890eb[_0x9963('0x2d')]);}socket['to'](util['format']('user:%s',_0x1890eb[_0x9963('0x2d')]))[_0x9963('0x1e')](_0x9963('0xec'),{'user':{'id':_0x1890eb['id'],'name':_0x1890eb[_0x9963('0x2d')]},'ip':_0x1cb052[_0x9963('0xed')][_0x9963('0xee')]||_0x1cb052[_0x9963('0xef')]['remoteAddress']||_0x1cb052['socket'][_0x9963('0xf0')]||_0x1cb052[_0x9963('0xef')]['socket'][_0x9963('0xf0')]});return db['UserVoiceQueueRt'][_0x9963('0x20')]({'where':{'membername':_0x1890eb[_0x9963('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0x9963('0x8c'))][(_0x9963('0x8d'))](_0x9963('0xf1'));}})[_0x9963('0x1c')](function(){if(_0x1890eb){return _0x1890eb[_0x9963('0xf2')]({'raw':!![]});}})[_0x9963('0x1c')](function(_0x590da8){if(_0x1890eb){if(_0x590da8){_0x55e7bd=_0x590da8;if(_0x55e7bd[_0x9963('0x47')]){var _0x191c1b=_0x55e7bd[_0x9963('0x29')](function(_0x465682){var _0x3df2a8={'membername':_0x1890eb[_0x9963('0x2d')],'UserId':_0x1890eb['id'],'queue_name':_0x465682['name'],'VoiceQueueId':_0x465682['id'],'interface':_0x9f8d6,'paused':_0x1890eb[_0x9963('0x9b')]||![],'penalty':_0x465682[_0x9963('0xf3')]||0x0};return db[_0x9963('0xab')][_0x9963('0xac')](_0x3df2a8);});return Promise[_0x9963('0x84')](_0x191c1b);}}}})['then'](function(){if(_0x1890eb){return db[_0x9963('0xf4')][_0x9963('0x46')]({'where':{'membername':_0x1890eb[_0x9963('0x2d')],'exitAt':null}});}})[_0x9963('0x1c')](function(_0x15bcce){if(_0x1890eb){var _0x474e82=[];_0x15bcce[_0x9963('0xf5')](function(_0x9bcdd1){_0x474e82[_0x9963('0x4c')](_0x9bcdd1[_0x9963('0x1b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x474e82);}})[_0x9963('0x1c')](function(){if(_0x1890eb){var _0x311e39=[];var _0x4e2fb3=[];var _0x3e30c5=utils[_0x9963('0xf6')]();var _0x108867={'membername':_0x1890eb[_0x9963('0x2d')],'interface':_0x9f8d6,'enterAt':moment()[_0x9963('0xc2')](_0x9963('0xf7')),'role':_0x1890eb['role'],'internal':_0x1890eb[_0x9963('0x5c')]};_0x3e30c5[_0x9963('0xf5')](function(_0x1d3bf5){_0x311e39[_0x9963('0x4c')](_['merge']({'channel':_0x1d3bf5,'type':_0x9963('0xf8'),'data1':_0x1cb052[_0x9963('0x57')][_0x9963('0xf9')],'data2':_0x9f8d6},_0x108867));if(_0x1890eb[_0x9963('0x9b')]){_0x4e2fb3[_0x9963('0x4c')](_[_0x9963('0x53')]({'channel':_0x1d3bf5,'type':_0x9963('0xfa'),'data1':_0x9963('0xfb')},_0x108867));}});return db[_0x9963('0xf4')][_0x9963('0x80')](_0x311e39[_0x9963('0xc0')](_0x4e2fb3),{'individualHooks':!![]});}})[_0x9963('0x1c')](function(){if(_0x1890eb){return _0x1890eb[_0x9963('0x1b')]({'online':!![],'lastLoginAt':moment()[_0x9963('0xc2')](_0x9963('0xf7')),'voicePause':_0x1890eb[_0x9963('0x9b')]||![],'mailPause':_0x1890eb[_0x9963('0x9b')]||![],'chatPause':_0x1890eb['loginInPause']||![],'faxPause':_0x1890eb['loginInPause']||![],'smsPause':_0x1890eb[_0x9963('0x9b')]||![],'openchannelPause':_0x1890eb[_0x9963('0x9b')]||![],'whatsappPause':_0x1890eb[_0x9963('0x9b')]||![],'pauseType':_0x1890eb[_0x9963('0x9b')]?_0x9963('0xfb'):null,'interface':_0x9f8d6,'lastPauseAt':moment()['format'](_0x9963('0xf7'))});}})[_0x9963('0x1c')](function(_0x4f4465){if(_0x1cb052[_0x9963('0xfc')]){return _0x3f8de5();}else{return Promise[_0x9963('0xfd')](_0x4f4465)[_0x9963('0x1c')](respondWithResult(_0x56abf0,null));}})['catch'](handleError(_0x56abf0,null));};exports[_0x9963('0xfe')]=function(_0x11e04c,_0x2e4e35){var _0x245e6b;return db[_0x9963('0x32')]['find']({'where':{'id':_0x11e04c[_0x9963('0x52')]['id'],'role':_0x9963('0x25')},'attributes':['id',_0x9963('0x2d'),_0x9963('0x1d')]})[_0x9963('0x1c')](handleEntityNotFound(_0x2e4e35,null))[_0x9963('0x1c')](function(_0x4020ab){if(_0x4020ab){_0x245e6b=_0x4020ab;return db[_0x9963('0xab')]['destroy']({'where':{'membername':_0x245e6b[_0x9963('0x2d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x9963('0xf4')]['findAll']({'where':{'membername':_0x245e6b[_0x9963('0x2d')],'exitAt':null}});})[_0x9963('0x1c')](function(_0x2068e7){var _0x42208c=[];_0x2068e7[_0x9963('0xf5')](function(_0x34c3f1){_0x42208c['push'](_0x34c3f1['update']({'exitAt':moment()[_0x9963('0xc2')](_0x9963('0xf7'))}));});return Promise[_0x9963('0x84')](_0x42208c);})[_0x9963('0x1c')](function(){return _0x245e6b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9963('0x1c')](respondWithResult(_0x2e4e35,null))[_0x9963('0x50')](handleError(_0x2e4e35,null));};exports[_0x9963('0xff')]=function(_0x50e4cc,_0x2dd097){var _0x521a34;return db[_0x9963('0xab')][_0x9963('0x1b')]({'paused':0x1},{'where':{'UserId':_0x50e4cc[_0x9963('0x52')]['id']},'individualHooks':!![]})[_0x9963('0x1c')](function(){return db[_0x9963('0x32')][_0x9963('0x2b')]({'where':{'id':_0x50e4cc[_0x9963('0x52')]['id'],'role':'agent'},'attributes':['id',_0x9963('0x2d'),'role',_0x9963('0x5c'),'interface','online']});})[_0x9963('0x1c')](handleEntityNotFound(_0x2dd097,null))['then'](function(_0x491eb1){if(_0x491eb1){_0x521a34=_0x491eb1;return db[_0x9963('0xf4')][_0x9963('0x46')]({'where':{'membername':_0x521a34[_0x9963('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0x9963('0x1c')](function(_0x998774){if(_0x998774[_0x9963('0x47')]){var _0xfb8bdc=moment()[_0x9963('0xc2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x442b9b=0x0,_0x47d5d4=_0x998774[_0x9963('0x47')];_0x442b9b<_0x47d5d4;_0x442b9b++){_0x998774[_0x442b9b][_0x9963('0x100')]({'exitAt':_0xfb8bdc});}}})['then'](function(){var _0x38efa8=[];var _0xae3a4b=utils[_0x9963('0xf6')]();_0xae3a4b[_0x9963('0xf5')](function(_0x5e6a9f){_0x38efa8['push']({'channel':_0x5e6a9f,'membername':_0x521a34[_0x9963('0x2d')],'interface':_[_0x9963('0x61')](_0x521a34[_0x9963('0x9d')])?util[_0x9963('0xc2')](_0x9963('0xaa'),_0x521a34['name']):_0x521a34[_0x9963('0x9d')],'type':_0x9963('0xfa'),'enterAt':moment()[_0x9963('0xc2')](_0x9963('0xf7')),'data1':_0x50e4cc[_0x9963('0x57')]['type']||_0x9963('0x101'),'role':_0x521a34[_0x9963('0x1d')],'internal':_0x521a34[_0x9963('0x5c')]});});return db['MemberReport'][_0x9963('0x80')](_0x38efa8,{'individualHooks':!![]});})[_0x9963('0x1c')](function(){return _0x521a34[_0x9963('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x50e4cc[_0x9963('0x57')]['type']||_0x9963('0x101'),'lastPauseAt':moment()[_0x9963('0xc2')](_0x9963('0xf7'))});})[_0x9963('0x1c')](respondWithResult(_0x2dd097,null))[_0x9963('0x50')](handleError(_0x2dd097,null));};exports[_0x9963('0x102')]=function(_0x3bc39a,_0x20c960){if(_0x3bc39a[_0x9963('0x57')][_0x9963('0x99')]&&!utils[_0x9963('0x9e')](_0x3bc39a[_0x9963('0x57')][_0x9963('0x99')])){throw new APIBadRequestError(util[_0x9963('0xc2')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3bc39a[_0x9963('0x57')][_0x9963('0x99')]));}return db[_0x9963('0x32')][_0x9963('0x2b')]({'where':{'id':_0x3bc39a['params']['id']},'attributes':['id',_0x9963('0x2d'),'role',_0x9963('0x5c'),_0x9963('0x9d'),'online',_0x9963('0x9c'),_0x9963('0x103'),_0x9963('0x104'),_0x9963('0x105'),_0x9963('0x106'),_0x9963('0x107'),'whatsappPause',_0x9963('0x108'),_0x9963('0x109')]})[_0x9963('0x1c')](function(_0x3b3dc7){if(!_0x3b3dc7){throw new APINotFoundError(util['format'](_0x9963('0xc3'),_0x3bc39a['params']['id']));}return _0x3b3dc7[_0x9963('0x102')](_0x3bc39a[_0x9963('0x57')]['channel']);})[_0x9963('0x1c')](respondWithResult(_0x20c960,null))[_0x9963('0x50')](APIHandleError(_0x20c960));};exports[_0x9963('0x10a')]=function(_0x3abb36,_0x22b159){var _0x5ee004={};var _0x4bcb42={};var _0x31e513;var _0x12e40;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x3abb36[_0x9963('0x52')]['id']}})['then'](handleEntityNotFound(_0x22b159,null))[_0x9963('0x1c')](function(_0x396338){if(_0x396338){_0x31e513=_0x396338;_0x4bcb42[_0x9963('0xcb')]=_['keys'](db[_0x9963('0x10b')][_0x9963('0x33')]);_0x4bcb42[_0x9963('0x3f')]=_['keys'](_0x3abb36['query']);_0x4bcb42[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x4bcb42[_0x9963('0xcb')],_0x4bcb42[_0x9963('0x3f')]);_0x5ee004[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x4bcb42[_0x9963('0xcb')],qs['fields'](_0x3abb36[_0x9963('0x3f')][_0x9963('0xce')]));_0x5ee004[_0x9963('0x45')]=_0x5ee004[_0x9963('0x45')][_0x9963('0x47')]?_0x5ee004[_0x9963('0x45')]:_0x4bcb42['model'];_0x5ee004[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x3abb36[_0x9963('0x3f')][_0x9963('0xd0')]);_0x5ee004[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x3abb36[_0x9963('0x3f')],_0x4bcb42[_0x9963('0xcc')]));if(_0x3abb36[_0x9963('0x3f')][_0x9963('0x27')]){_0x5ee004[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x5ee004[_0x9963('0x3e')],{'$or':_['map'](_0x5ee004[_0x9963('0x45')],function(_0x28265f){var _0x1e85fc={};_0x1e85fc[_0x28265f]={'$like':'%'+_0x3abb36[_0x9963('0x3f')]['filter']+'%'};return _0x1e85fc;})});}_0x5ee004=_[_0x9963('0x53')]({},_0x5ee004,_0x3abb36[_0x9963('0x54')]);return _0x31e513[_0x9963('0x10a')](_0x5ee004);}})['then'](function(_0x213cae){if(_0x213cae){_0x12e40=_0x213cae[_0x9963('0x47')];if(!_0x3abb36['query'][_0x9963('0xc4')](_0x9963('0xd8'))){_0x5ee004[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x3abb36[_0x9963('0x3f')]['limit']);_0x5ee004[_0x9963('0x19')]=qs['offset'](_0x3abb36[_0x9963('0x3f')][_0x9963('0x19')]);}return _0x31e513[_0x9963('0x10a')](_0x5ee004);}})[_0x9963('0x1c')](function(_0x49daaf){if(_0x49daaf){return _0x49daaf?{'count':_0x12e40,'rows':_0x49daaf}:null;}})[_0x9963('0x1c')](respondWithResult(_0x22b159,null))[_0x9963('0x50')](handleError(_0x22b159,null));};exports[_0x9963('0x10c')]=function(_0x4c8aeb,_0x42a4c6){var _0x3db443=_0x4c8aeb[_0x9963('0x52')]['id'];var _0x4383bb=_0x4c8aeb[_0x9963('0x57')]?_0x4c8aeb['body'][_0x9963('0x5b')]:null;var _0x133265=[];return Promise[_0x9963('0xfd')]()[_0x9963('0x1c')](function(){if(!_0x4383bb)throw new APIBadRequestError(_0x9963('0x10d'));})[_0x9963('0x1c')](function(){return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x3db443}});})[_0x9963('0x1c')](function(_0xe6149){if(!_0xe6149)throw new APINotFoundError(util[_0x9963('0xc2')](_0x9963('0xc3'),_0x4c8aeb['params']['id']));return db['sequelize'][_0x9963('0x10e')](function(_0x5d898b){return _0xe6149[_0x9963('0x10c')](_0x4383bb,{'transaction':_0x5d898b})[_0x9963('0x1c')](function(){return db[_0x9963('0x10b')][_0x9963('0x46')]({'where':{'id':{'$in':_0x4383bb}}});})[_0x9963('0x1c')](function(_0x12ca98){var _0x37ceac=_['map'](_0x12ca98,function(_0x5e40ea){return _0x5e40ea[_0x9963('0x10f')]();});return Promise[_0x9963('0x84')](_0x37ceac);})['then'](function(_0x343fbb){_0x133265=_[_0x9963('0x110')](_0x343fbb);var _0x50942d=_[_0x9963('0x29')](_0x133265,function(_0x10ada6){return _0x10ada6['addAgent'](_0xe6149['id'],{'transaction':_0x5d898b});});return Promise[_0x9963('0x84')](_0x50942d);})[_0x9963('0x1c')](function(){if(!_0xe6149[_0x9963('0x9a')])return;var _0x55659f=_[_0x9963('0x27')](_0x133265,function(_0x289dbc){return _0x289dbc[_0x9963('0x111')](_0x9963('0x99'))==='Voice';});var _0x2f89ad=_[_0x9963('0x29')](_0x55659f,function(_0x271310){return db[_0x9963('0xab')][_0x9963('0xac')]({'membername':_0xe6149[_0x9963('0x2d')],'UserId':_0xe6149['id'],'queue_name':_0x271310[_0x9963('0x2d')],'VoiceQueueId':_0x271310['id'],'interface':_['isNil'](_0xe6149[_0x9963('0x9d')])?util['format'](_0x9963('0xaa'),_0xe6149['name']):_0xe6149[_0x9963('0x9d')],'paused':_0xe6149[_0x9963('0x9c')]||![],'penalty':_0xe6149[_0x9963('0xa3')]},{'transaction':_0x5d898b});});return Promise[_0x9963('0x84')](_0x2f89ad);})['then'](function(){return db[_0x9963('0x112')]['findAll']({'where':{'teamId':{'$in':_0x4383bb}}});})['then'](function(_0x2c69d6){var _0x38e6dd=_['map'](_0x2c69d6,function(_0x21d860){return db[_0x9963('0x113')]['create']({'UserId':_0xe6149['id'],'VoicePrefixId':_0x21d860[_0x9963('0x114')]},{'transaction':_0x5d898b});});return Promise['all'](_0x38e6dd);});});})[_0x9963('0x1c')](function(){for(var _0x3d98fe=0x0;_0x3d98fe<_0x133265[_0x9963('0x47')];_0x3d98fe++){var _0x581bc0=_0x133265[_0x3d98fe][_0x9963('0x111')](_0x9963('0x99'));var _0x5681b9=_0x581bc0+_0x9963('0xa6');socket['emit']('user'+_0x581bc0+_0x9963('0xa7'),{'UserId':_0x3db443,['queueField']:_0x133265[_0x3d98fe]['id']});}})['then'](respondWithStatusCode(_0x42a4c6,null))[_0x9963('0x50')](APIHandleError(_0x42a4c6));};exports[_0x9963('0x115')]=function(_0x1c033e,_0x21a20a){var _0x3bc9a7=_0x1c033e['params']['id'];var _0x36205b=null;if(_0x1c033e[_0x9963('0x3f')][_0x9963('0x5b')]){_0x36205b=_[_0x9963('0xaf')](_0x1c033e['query']['ids'])?_0x1c033e[_0x9963('0x3f')][_0x9963('0x5b')]:[_0x1c033e['query'][_0x9963('0x5b')]];}var _0x5d42e2=[];return Promise[_0x9963('0xfd')]()['then'](function(){if(!_0x36205b)throw new APIBadRequestError(_0x9963('0x116'));})['then'](function(){return db['User'][_0x9963('0x92')]({'where':{'id':_0x3bc9a7}});})[_0x9963('0x1c')](function(_0x33396d){if(!_0x33396d)throw new APINotFoundError(util[_0x9963('0xc2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1c033e[_0x9963('0x52')]['id']));return db[_0x9963('0x63')][_0x9963('0x10e')](function(_0x16240f){return _0x33396d['removeTeams'](_0x36205b,{'transaction':_0x16240f})[_0x9963('0x1c')](function(){return db[_0x9963('0x10b')][_0x9963('0x46')]({'where':{'id':{'$in':_0x36205b}}});})[_0x9963('0x1c')](function(_0x390cab){var _0x518851=_[_0x9963('0x29')](_0x390cab,function(_0x230ad8){return _0x230ad8['getAssociatedQueues']();});return Promise[_0x9963('0x84')](_0x518851);})[_0x9963('0x1c')](function(_0x32603b){_0x5d42e2=_['flattenDeep'](_0x32603b);var _0x8e9b35=_[_0x9963('0x29')](_0x5d42e2,function(_0x546e12){return _0x546e12[_0x9963('0x117')](_0x33396d['id'],{'transaction':_0x16240f});});return Promise[_0x9963('0x84')](_0x8e9b35);})[_0x9963('0x1c')](function(){if(!_0x33396d[_0x9963('0x9a')])return;var _0x7c4091=_[_0x9963('0x27')](_0x5d42e2,function(_0x38d6dc){return _0x38d6dc[_0x9963('0x111')]('channel')===_0x9963('0x118');});var _0x4e19a8=_['map'](_0x7c4091,function(_0x47e229){return db[_0x9963('0xab')][_0x9963('0x20')]({'where':{'VoiceQueueId':_0x47e229['id'],'UserId':_0x33396d['id']},'transaction':_0x16240f});});return Promise[_0x9963('0x84')](_0x4e19a8);})['then'](function(){return db['TeamVoicePrefix'][_0x9963('0x46')]({'where':{'teamId':{'$in':_0x36205b}}});})['then'](function(_0x1219ee){var _0x538682=_[_0x9963('0x29')](_0x1219ee,function(_0x25808e){return db[_0x9963('0x113')][_0x9963('0x20')]({'where':{'UserId':_0x33396d['id'],'VoicePrefixId':_0x25808e[_0x9963('0x114')]}},{'transaction':_0x16240f});});return Promise['all'](_0x538682);});});})[_0x9963('0x1c')](function(){for(var _0x2b4617=0x0;_0x2b4617<_0x5d42e2['length'];_0x2b4617++){var _0x208a7f=_0x5d42e2[_0x2b4617][_0x9963('0x111')](_0x9963('0x99'));var _0x3d7395=_0x208a7f+'QueueId';socket['emit'](_0x9963('0x24')+_0x208a7f+_0x9963('0xb0'),{'UserId':_0x3bc9a7,['queueField']:_0x5d42e2[_0x2b4617]['id']});}})[_0x9963('0x1c')](respondWithStatusCode(_0x21a20a,null))[_0x9963('0x50')](APIHandleError(_0x21a20a));};exports[_0x9963('0x119')]=function(_0x44c9fd,_0x5dab58){var _0x25a130={};var _0x462713={};var _0x57d4f0;var _0x1c91d0;return db[_0x9963('0x32')]['findOne']({'where':{'id':_0x44c9fd[_0x9963('0x52')]['id']}})['then'](handleEntityNotFound(_0x5dab58,null))[_0x9963('0x1c')](function(_0x2ef720){if(_0x2ef720){_0x57d4f0=_0x2ef720;_0x462713[_0x9963('0xcb')]=_['keys'](db[_0x9963('0xc5')][_0x9963('0x33')]);_0x462713[_0x9963('0x3f')]=_[_0x9963('0xd4')](_0x44c9fd[_0x9963('0x3f')]);_0x462713['filters']=_[_0x9963('0xcd')](_0x462713[_0x9963('0xcb')],_0x462713[_0x9963('0x3f')]);_0x25a130[_0x9963('0x45')]=_[_0x9963('0xcd')](_0x462713[_0x9963('0xcb')],qs[_0x9963('0xce')](_0x44c9fd[_0x9963('0x3f')][_0x9963('0xce')]));_0x25a130[_0x9963('0x45')]=_0x25a130[_0x9963('0x45')]['length']?_0x25a130[_0x9963('0x45')]:_0x462713[_0x9963('0xcb')];_0x25a130[_0x9963('0xcf')]=qs[_0x9963('0xd0')](_0x44c9fd[_0x9963('0x3f')][_0x9963('0xd0')]);_0x25a130['where']=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x44c9fd[_0x9963('0x3f')],_0x462713['filters']));if(_0x44c9fd[_0x9963('0x3f')]['filter']){_0x25a130[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x25a130['where'],{'$or':_['map'](_0x25a130[_0x9963('0x45')],function(_0x1442e9){var _0x51a17a={};_0x51a17a[_0x1442e9]={'$like':'%'+_0x44c9fd[_0x9963('0x3f')][_0x9963('0x27')]+'%'};return _0x51a17a;})});}_0x25a130=_['merge']({},_0x25a130,_0x44c9fd['options']);return _0x57d4f0[_0x9963('0x119')](_0x25a130);}})[_0x9963('0x1c')](function(_0x1755c6){if(_0x1755c6){_0x1c91d0=_0x1755c6[_0x9963('0x47')];if(!_0x44c9fd['query'][_0x9963('0xc4')]('nolimit')){_0x25a130[_0x9963('0x17')]=qs[_0x9963('0x17')](_0x44c9fd[_0x9963('0x3f')][_0x9963('0x17')]);_0x25a130[_0x9963('0x19')]=qs['offset'](_0x44c9fd['query'][_0x9963('0x19')]);}return _0x57d4f0[_0x9963('0x119')](_0x25a130);}})[_0x9963('0x1c')](function(_0x10b612){if(_0x10b612){return _0x10b612?{'count':_0x1c91d0,'rows':_0x10b612}:null;}})['then'](respondWithResult(_0x5dab58,null))[_0x9963('0x50')](handleError(_0x5dab58,null));};exports['getAgents']=function(_0x587e7b,_0x396628){var _0x23f02b={};var _0x4e3b9b={};var _0x4d7a61;return db[_0x9963('0x32')][_0x9963('0x92')]({'where':{'id':_0x587e7b[_0x9963('0x52')]['id']}})[_0x9963('0x1c')](handleEntityNotFound(_0x396628,null))[_0x9963('0x1c')](function(_0x42ba5a){if(_0x42ba5a){_0x4d7a61=_0x42ba5a;_0x4e3b9b['model']=_[_0x9963('0xd4')](db[_0x9963('0x32')][_0x9963('0x33')]);_0x4e3b9b[_0x9963('0x3f')]=_['keys'](_0x587e7b[_0x9963('0x3f')]);_0x4e3b9b[_0x9963('0xcc')]=_[_0x9963('0xcd')](_0x4e3b9b[_0x9963('0xcb')],_0x4e3b9b['query']);_0x23f02b['attributes']=_[_0x9963('0xcd')](_0x4e3b9b[_0x9963('0xcb')],qs['fields'](_0x587e7b[_0x9963('0x3f')]['fields']));_0x23f02b[_0x9963('0x45')]=_0x23f02b[_0x9963('0x45')]['length']?_0x23f02b[_0x9963('0x45')]:_0x4e3b9b['model'];_0x23f02b['order']=qs[_0x9963('0xd0')](_0x587e7b[_0x9963('0x3f')]['sort']);_0x23f02b[_0x9963('0x3e')]=qs[_0x9963('0xcc')](_[_0x9963('0xd5')](_0x587e7b[_0x9963('0x3f')],_0x4e3b9b[_0x9963('0xcc')]));if(_0x587e7b['query'][_0x9963('0x27')]){_0x23f02b[_0x9963('0x3e')]=_[_0x9963('0x53')](_0x23f02b[_0x9963('0x3e')],{'$or':_['map'](_0x23f02b[_0x9963('0x45')],function(_0x36973b){var _0x41647f={};_0x41647f[_0x36973b]={'$like':'%'+_0x587e7b['query'][_0x9963('0x27')]+'%'};return _0x41647f;})});}_0x23f02b[_0x9963('0xcb')]=db[_0x9963('0x32')];_0x23f02b['as']=_0x9963('0x7e');_0x23f02b=_[_0x9963('0x53')]({},_0x23f02b,_0x587e7b['options']);return _0x4d7a61['getVoiceQueues']({'include':[_0x23f02b]});}})[_0x9963('0x1c')](function(_0x2fcca3){if(_0x2fcca3){var _0x2a4aa0={},_0x5068f5=[];for(var _0x5ed0d5=0x0;_0x5ed0d5<_0x2fcca3['length'];_0x5ed0d5+=0x1){for(var _0x176bc5=0x0,_0x57d094;_0x176bc5<_0x2fcca3[_0x5ed0d5][_0x9963('0x7e')]['length'];_0x176bc5+=0x1){_0x57d094=_0x2fcca3[_0x5ed0d5][_0x9963('0x7e')][_0x176bc5][_0x9963('0x21')]({'plain':!![]});_0x2a4aa0[_0x57d094['id']]=_0x57d094;}}_0x2a4aa0=_[_0x9963('0x11a')](_0x2a4aa0);for(var _0x3335d3=qs[_0x9963('0x19')](_0x587e7b['query'][_0x9963('0x19')]);_0x3335d3<_0x2a4aa0[_0x9963('0x47')]&&_0x5068f5['length']=_0x222131[_0xec32('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xec32('0x1e')](function(){if(_0x62de47){return db[_0xec32('0x29')]['destroy']({'where':{'membername':_0x62de47['name']},'individualHooks':!![]});}})['then'](function(){if(_0x62de47){return _0x62de47[_0xec32('0x52')]({'raw':!![]});}})[_0xec32('0x1e')](function(_0x5020f9){if(_0x62de47){if(_0x5020f9){var _0x55616d=[];_0x69c37b=_0x5020f9;if(_0x69c37b[_0xec32('0x2c')]){for(var _0x4b5624=0x0;_0x4b5624<_0x69c37b['length'];_0x4b5624++){_0x55616d['push'](db[_0xec32('0x29')][_0xec32('0x53')]({'membername':_0x62de47['name'],'UserId':_0x62de47['id'],'queue_name':_0x69c37b[_0x4b5624][_0xec32('0x23')],'VoiceQueueId':_0x69c37b[_0x4b5624]['id'],'interface':_0x596966,'paused':_0x62de47[_0xec32('0x4d')]||![],'penalty':_0x69c37b[_0x4b5624]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xec32('0x4a')](_0x55616d);}}}})[_0xec32('0x1e')](function(){if(_0x62de47){return db[_0xec32('0x2a')][_0xec32('0x11')]({'where':{'membername':_0x62de47[_0xec32('0x23')],'exitAt':null}});}})[_0xec32('0x1e')](function(_0x26291c){if(_0x62de47){if(_0x26291c&&_0x26291c[_0xec32('0x2c')]){var _0x57eeb0=[];_0x26291c[_0xec32('0x49')](function(_0x3d20f1){_0x57eeb0[_0xec32('0x2f')](_0x3d20f1[_0xec32('0x36')]({'exitAt':moment()[_0xec32('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xec32('0x4a')](_0x57eeb0);}}})[_0xec32('0x1e')](function(){if(_0x62de47){var _0x317b98=[];var _0x2ef515=[];var _0x53b60c=utils['getChannels']();var _0xa170df={'membername':_0x62de47[_0xec32('0x23')],'interface':_0x596966,'enterAt':moment()[_0xec32('0x26')](_0xec32('0x2b')),'role':_0x62de47[_0xec32('0x24')],'internal':_0x62de47[_0xec32('0x25')]};_0x53b60c['forEach'](function(_0x31dd81){_0x317b98['push'](_['merge']({'channel':_0x31dd81,'type':_0xec32('0x54'),'data1':'callysquare','data2':_0x596966},_0xa170df));if(_0x62de47[_0xec32('0x4d')]){_0x2ef515[_0xec32('0x2f')](_[_0xec32('0x55')]({'channel':_0x31dd81,'type':'PAUSE','data1':'LOGININPAUSE'},_0xa170df));}});return db[_0xec32('0x2a')][_0xec32('0x56')](_0x317b98[_0xec32('0x57')](_0x2ef515),{'individualHooks':!![]});}})[_0xec32('0x1e')](function(){if(_0x62de47){return _0x62de47['update']({'online':!![],'lastLoginAt':moment()[_0xec32('0x26')](_0xec32('0x2b')),'voicePause':_0x62de47[_0xec32('0x4d')]||![],'mailPause':_0x62de47['loginInPause']||![],'chatPause':_0x62de47[_0xec32('0x4d')]||![],'faxPause':_0x62de47[_0xec32('0x4d')]||![],'smsPause':_0x62de47['loginInPause']||![],'openchannelPause':_0x62de47[_0xec32('0x4d')]||![],'pauseType':_0x62de47[_0xec32('0x4d')]?_0xec32('0x58'):null,'lastPauseAt':moment()[_0xec32('0x26')](_0xec32('0x2b')),'interface':_0x596966});}})[_0xec32('0x1e')](function(_0x1b57cc){_0x2e15d1(_0x1b57cc);})[_0xec32('0x20')](function(_0x2559f9){_0x24d5ff(_0x35c610['error'](0x1f4,_0x2559f9[_0xec32('0x1b')]));});});}; \ No newline at end of file +var _0x9840=['map','model','then','info','debug','catch','error','message','ShowUser','find','stringify','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','PAUSE','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','params','unpause','system','forEach','all','LoginUser','mobile','phone','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','length','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./user.socket','register','GetUser','User','findAll','options','raw','where','attributes','limit','include'];(function(_0x1e1fd3,_0x2d65a9){var _0x6b06a5=function(_0x30906f){while(--_0x30906f){_0x1e1fd3['push'](_0x1e1fd3['shift']());}};_0x6b06a5(++_0x2d65a9);}(_0x9840,0x9f));var _0x0984=function(_0x524316,_0x3b059a){_0x524316=_0x524316-0x0;var _0x5d1530=_0x9840[_0x524316];return _0x5d1530;};'use strict';var _=require(_0x0984('0x0'));var util=require(_0x0984('0x1'));var moment=require(_0x0984('0x2'));var BPromise=require(_0x0984('0x3'));var Redis=require('ioredis');var db=require(_0x0984('0x4'))['db'];var utils=require(_0x0984('0x5'));var logger=require(_0x0984('0x6'))(_0x0984('0x7'));var config=require(_0x0984('0x8'));config[_0x0984('0x9')]=_[_0x0984('0xa')](config[_0x0984('0x9')],{'host':_0x0984('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0984('0x9')]));require(_0x0984('0xc'))[_0x0984('0xd')](socket);exports[_0x0984('0xe')]=function(_0x4378f5){var _0x4ef615=this;return new Promise(function(_0x204df9,_0x464bb4){return db[_0x0984('0xf')][_0x0984('0x10')]({'raw':_0x4378f5[_0x0984('0x11')]?_0x4378f5[_0x0984('0x11')][_0x0984('0x12')]===undefined?!![]:![]:!![],'where':_0x4378f5['options']?_0x4378f5['options'][_0x0984('0x13')]||null:null,'attributes':_0x4378f5[_0x0984('0x11')]?_0x4378f5[_0x0984('0x11')][_0x0984('0x14')]||null:null,'limit':_0x4378f5[_0x0984('0x11')]?_0x4378f5[_0x0984('0x11')][_0x0984('0x15')]||null:null,'include':_0x4378f5['options']?_0x4378f5[_0x0984('0x11')][_0x0984('0x16')]?_[_0x0984('0x17')](_0x4378f5[_0x0984('0x11')][_0x0984('0x16')],function(_0x37a1e1){return{'model':db[_0x37a1e1[_0x0984('0x18')]],'as':_0x37a1e1['as'],'attributes':_0x37a1e1[_0x0984('0x14')],'include':_0x37a1e1[_0x0984('0x16')]?_['map'](_0x37a1e1[_0x0984('0x16')],function(_0x15a1dc){return{'model':db[_0x15a1dc[_0x0984('0x18')]],'as':_0x15a1dc['as'],'attributes':_0x15a1dc[_0x0984('0x14')],'include':_0x15a1dc[_0x0984('0x16')]?_[_0x0984('0x17')](_0x15a1dc[_0x0984('0x16')],function(_0x114e7a){return{'model':db[_0x114e7a[_0x0984('0x18')]],'as':_0x114e7a['as'],'attributes':_0x114e7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0984('0x19')](function(_0x4e0794){logger[_0x0984('0x1a')](_0x0984('0xe'),_0x4378f5);logger[_0x0984('0x1b')](_0x0984('0xe'),_0x4378f5,JSON['stringify'](_0x4e0794));_0x204df9(_0x4e0794);})[_0x0984('0x1c')](function(_0x482620){logger['error'](_0x0984('0xe'),_0x482620['message'],_0x4378f5);_0x464bb4(_0x4ef615[_0x0984('0x1d')](0x1f4,_0x482620[_0x0984('0x1e')]));});});};exports[_0x0984('0x1f')]=function(_0x3c7fdb){var _0xf95153=this;return new Promise(function(_0x2c9d2e,_0x3a2692){return db[_0x0984('0xf')][_0x0984('0x20')]({'raw':_0x3c7fdb[_0x0984('0x11')]?_0x3c7fdb[_0x0984('0x11')][_0x0984('0x12')]===undefined?!![]:![]:!![],'where':_0x3c7fdb[_0x0984('0x11')]?_0x3c7fdb['options'][_0x0984('0x13')]||null:null,'attributes':_0x3c7fdb[_0x0984('0x11')]?_0x3c7fdb[_0x0984('0x11')][_0x0984('0x14')]||null:null,'include':_0x3c7fdb['options']?_0x3c7fdb[_0x0984('0x11')]['include']?_[_0x0984('0x17')](_0x3c7fdb[_0x0984('0x11')]['include'],function(_0x39de43){return{'model':db[_0x39de43['model']],'as':_0x39de43['as'],'attributes':_0x39de43[_0x0984('0x14')],'include':_0x39de43[_0x0984('0x16')]?_['map'](_0x39de43[_0x0984('0x16')],function(_0x179be0){return{'model':db[_0x179be0[_0x0984('0x18')]],'as':_0x179be0['as'],'attributes':_0x179be0['attributes'],'include':_0x179be0[_0x0984('0x16')]?_['map'](_0x179be0['include'],function(_0x2483cd){return{'model':db[_0x2483cd[_0x0984('0x18')]],'as':_0x2483cd['as'],'attributes':_0x2483cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x0984('0x19')](function(_0x4cf11e){logger[_0x0984('0x1a')](_0x0984('0x1f'),_0x3c7fdb);logger[_0x0984('0x1b')](_0x0984('0x1f'),_0x3c7fdb,JSON[_0x0984('0x21')](_0x4cf11e));_0x2c9d2e(_0x4cf11e);})[_0x0984('0x1c')](function(_0x3f3424){logger[_0x0984('0x1d')](_0x0984('0x1f'),_0x3f3424[_0x0984('0x1e')],_0x3c7fdb);_0x3a2692(_0xf95153[_0x0984('0x1d')](0x1f4,_0x3f3424['message']));});});};exports[_0x0984('0x22')]=function(_0x3580e4){var _0x4975e1;return db[_0x0984('0xf')][_0x0984('0x20')]({'where':_0x3580e4['options'][_0x0984('0x13')]||{},'attributes':['id',_0x0984('0x23'),_0x0984('0x24'),_0x0984('0x25'),_0x0984('0x26')]})[_0x0984('0x19')](function(_0x716db1){if(!_0x716db1){throw new Error(util[_0x0984('0x27')](_0x0984('0x28'),_0x3580e4['params']['id']));}_0x4975e1=_0x716db1;return db[_0x0984('0x29')][_0x0984('0x2a')]({'paused':0x1},{'where':{'UserId':_0x4975e1['id']},'individualHooks':!![]});})[_0x0984('0x19')](function(){return db['MemberReport'][_0x0984('0x10')]({'where':{'membername':_0x4975e1['name'],'type':_0x0984('0x2b'),'exitAt':null}});})[_0x0984('0x19')](function(_0x3ef88e){if(_0x3ef88e&&_0x3ef88e['length']){var _0xde0515=moment()[_0x0984('0x27')](_0x0984('0x2c'));for(var _0x140ec8=0x0,_0x26dcf5=_0x3ef88e['length'];_0x140ec8<_0x26dcf5;_0x140ec8++){_0x3ef88e[_0x140ec8][_0x0984('0x2d')]({'exitAt':_0xde0515});}}})['then'](function(){var _0x427b81=[];var _0x2e1247=utils[_0x0984('0x2e')]();_0x2e1247['forEach'](function(_0x1ab14f){_0x427b81[_0x0984('0x2f')]({'channel':_0x1ab14f,'membername':_0x4975e1['name'],'interface':_[_0x0984('0x30')](_0x4975e1[_0x0984('0x26')])?util[_0x0984('0x27')](_0x0984('0x31'),_0x4975e1[_0x0984('0x23')]):_0x4975e1['interface'],'type':_0x0984('0x2b'),'enterAt':moment()[_0x0984('0x27')](_0x0984('0x2c')),'data1':_0x3580e4[_0x0984('0x32')][_0x0984('0x33')]||_0x0984('0x34'),'role':_0x4975e1[_0x0984('0x24')],'internal':_0x4975e1['internal'],'uniqueid':_0x3580e4[_0x0984('0x32')][_0x0984('0x35')]||null});});return db[_0x0984('0x36')][_0x0984('0x37')](_0x427b81,{'individualHooks':!![]});})[_0x0984('0x19')](function(){return _0x4975e1[_0x0984('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3580e4[_0x0984('0x32')][_0x0984('0x33')]||_0x0984('0x34'),'lastPauseAt':moment()['format'](_0x0984('0x2c'))});})[_0x0984('0x1c')](function(_0x427086){throw _0x427086;});};exports[_0x0984('0x38')]=function(_0x3998d5){return Promise[_0x0984('0x39')]()['then'](function(){if(_0x3998d5['body'][_0x0984('0x3a')]&&!utils[_0x0984('0x3b')](_0x3998d5[_0x0984('0x32')][_0x0984('0x3a')])){throw new Error(util[_0x0984('0x27')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3998d5[_0x0984('0x32')][_0x0984('0x3a')]));}return db['User'][_0x0984('0x3c')]({'where':_0x3998d5['options'][_0x0984('0x13')]||{},'attributes':['id','name',_0x0984('0x24'),_0x0984('0x25'),'interface',_0x0984('0x3d'),_0x0984('0x3e'),_0x0984('0x3f'),_0x0984('0x40'),'faxPause',_0x0984('0x41'),_0x0984('0x42'),_0x0984('0x43'),_0x0984('0x44'),_0x0984('0x45')]});})['then'](function(_0x3dd813){if(!_0x3dd813){throw new Error(util[_0x0984('0x27')](_0x0984('0x28'),_0x3998d5[_0x0984('0x46')]['id']));}return _0x3dd813[_0x0984('0x47')](_0x3998d5[_0x0984('0x32')][_0x0984('0x3a')],_0x0984('0x48'));})[_0x0984('0x1c')](function(_0x185dd9){throw _0x185dd9;});};exports['LogoutUser']=function(_0x21e5fe){var _0x3b0355=this;return new Promise(function(_0x5ac42d,_0x211c56){var _0xd64dc6;return db[_0x0984('0xf')][_0x0984('0x3c')]({'where':_0x21e5fe[_0x0984('0x11')][_0x0984('0x13')]||{},'attributes':['id',_0x0984('0x23')]})['then'](function(_0x4ee471){if(_0x4ee471){_0xd64dc6=_0x4ee471;return db[_0x0984('0x29')]['destroy']({'where':{'membername':_0xd64dc6['name']},'individualHooks':!![]});}})[_0x0984('0x19')](function(){if(_0xd64dc6){return db['MemberReport'][_0x0984('0x10')]({'where':{'membername':_0xd64dc6[_0x0984('0x23')],'exitAt':null}});}})[_0x0984('0x19')](function(_0x40083e){if(_0xd64dc6){if(_0x40083e&&_0x40083e['length']){var _0x254457=[];_0x40083e[_0x0984('0x49')](function(_0x1c785c){_0x254457['push'](_0x1c785c[_0x0984('0x2a')]({'exitAt':moment()[_0x0984('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0984('0x4a')](_0x254457);}}})['then'](function(){if(_0xd64dc6){return _0xd64dc6[_0x0984('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0984('0x19')](function(_0x466e91){_0x5ac42d(_0x466e91);})['catch'](function(_0x3991b5){_0x211c56(_0x3b0355['error'](0x1f4,_0x3991b5[_0x0984('0x1e')]));});});};exports[_0x0984('0x4b')]=function(_0x385c3e){var _0x2be0e1=this;return new Promise(function(_0x5f0f54,_0x543a4b){var _0x5ea336;var _0x30d963;var _0x18d3da;var _0x27f4cf;return db[_0x0984('0xf')][_0x0984('0x3c')]({'where':_0x385c3e[_0x0984('0x11')][_0x0984('0x13')]||{},'attributes':['id',_0x0984('0x23'),_0x0984('0x24'),_0x0984('0x4c'),_0x0984('0x4d'),_0x0984('0x25'),'loginInPause',_0x0984('0x26')]})['then'](function(_0x455e41){if(_0x455e41){_0x5ea336=_0x455e41;_0x27f4cf=_0x385c3e[_0x0984('0x32')]['interface']?_0x385c3e['body'][_0x0984('0x26')]:util[_0x0984('0x27')](_0x0984('0x31'),_0x5ea336[_0x0984('0x23')]);return db[_0x0984('0xf')]['count']({'where':{'role':_0x0984('0x4e'),'online':!![],'id':{'$ne':_0x5ea336['id']}}});}})['then'](function(_0x553dd7){if(_0x553dd7){_0x18d3da=_0x553dd7;return require(_0x0984('0x4f'))[_0x0984('0x50')]();}})[_0x0984('0x19')](function(_0x58e50e){if(_0x58e50e&&_0x58e50e[_0x0984('0x51')]&&_0x18d3da>=_0x58e50e['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x0984('0x19')](function(){if(_0x5ea336){return db[_0x0984('0x29')]['destroy']({'where':{'membername':_0x5ea336[_0x0984('0x23')]},'individualHooks':!![]});}})[_0x0984('0x19')](function(){if(_0x5ea336){return _0x5ea336[_0x0984('0x52')]({'raw':!![]});}})['then'](function(_0x3d49ca){if(_0x5ea336){if(_0x3d49ca){var _0x34f4c4=[];_0x30d963=_0x3d49ca;if(_0x30d963['length']){for(var _0x5c1f35=0x0;_0x5c1f35<_0x30d963['length'];_0x5c1f35++){_0x34f4c4['push'](db[_0x0984('0x29')][_0x0984('0x53')]({'membername':_0x5ea336['name'],'UserId':_0x5ea336['id'],'queue_name':_0x30d963[_0x5c1f35]['name'],'VoiceQueueId':_0x30d963[_0x5c1f35]['id'],'interface':_0x27f4cf,'paused':_0x5ea336[_0x0984('0x54')]||![],'penalty':_0x30d963[_0x5c1f35][_0x0984('0x55')]||0x0}));}return BPromise[_0x0984('0x4a')](_0x34f4c4);}}}})[_0x0984('0x19')](function(){if(_0x5ea336){return db[_0x0984('0x36')][_0x0984('0x10')]({'where':{'membername':_0x5ea336[_0x0984('0x23')],'exitAt':null}});}})['then'](function(_0x2572d6){if(_0x5ea336){if(_0x2572d6&&_0x2572d6[_0x0984('0x56')]){var _0x336ee0=[];_0x2572d6['forEach'](function(_0x1f3a7a){_0x336ee0[_0x0984('0x2f')](_0x1f3a7a[_0x0984('0x2a')]({'exitAt':moment()[_0x0984('0x27')](_0x0984('0x2c'))}));});return BPromise[_0x0984('0x4a')](_0x336ee0);}}})[_0x0984('0x19')](function(){if(_0x5ea336){var _0x33ae8c=[];var _0x8b41bf=[];var _0x471a8f=utils[_0x0984('0x2e')]();var _0x88a3d8={'membername':_0x5ea336['name'],'interface':_0x27f4cf,'enterAt':moment()[_0x0984('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5ea336[_0x0984('0x24')],'internal':_0x5ea336[_0x0984('0x25')]};_0x471a8f['forEach'](function(_0x3962f6){_0x33ae8c[_0x0984('0x2f')](_[_0x0984('0x57')]({'channel':_0x3962f6,'type':_0x0984('0x58'),'data1':_0x0984('0x59'),'data2':_0x27f4cf},_0x88a3d8));if(_0x5ea336['loginInPause']){_0x8b41bf[_0x0984('0x2f')](_[_0x0984('0x57')]({'channel':_0x3962f6,'type':'PAUSE','data1':_0x0984('0x5a')},_0x88a3d8));}});return db[_0x0984('0x36')][_0x0984('0x37')](_0x33ae8c['concat'](_0x8b41bf),{'individualHooks':!![]});}})[_0x0984('0x19')](function(){if(_0x5ea336){return _0x5ea336['update']({'online':!![],'lastLoginAt':moment()[_0x0984('0x27')](_0x0984('0x2c')),'voicePause':_0x5ea336[_0x0984('0x54')]||![],'mailPause':_0x5ea336[_0x0984('0x54')]||![],'chatPause':_0x5ea336['loginInPause']||![],'faxPause':_0x5ea336[_0x0984('0x54')]||![],'smsPause':_0x5ea336[_0x0984('0x54')]||![],'openchannelPause':_0x5ea336[_0x0984('0x54')]||![],'pauseType':_0x5ea336['loginInPause']?_0x0984('0x5a'):null,'lastPauseAt':moment()[_0x0984('0x27')](_0x0984('0x2c')),'interface':_0x27f4cf});}})[_0x0984('0x19')](function(_0x3d9e81){_0x5f0f54(_0x3d9e81);})[_0x0984('0x1c')](function(_0x4ae535){_0x543a4b(_0x2be0e1[_0x0984('0x1d')](0x1f4,_0x4ae535[_0x0984('0x1e')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0165139..a6ab89a 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 _0x9547=['emit','removeListener','register','length','user:','./user.events','save'];(function(_0x3a95b8,_0x104d11){var _0x395342=function(_0x353a58){while(--_0x353a58){_0x3a95b8['push'](_0x3a95b8['shift']());}};_0x395342(++_0x104d11);}(_0x9547,0x6e));var _0x7954=function(_0xb5df06,_0x2d64d5){_0xb5df06=_0xb5df06-0x0;var _0x15ce87=_0x9547[_0xb5df06];return _0x15ce87;};'use strict';var UserEvents=require(_0x7954('0x0'));var events=[_0x7954('0x1'),'remove','update'];function createListener(_0x1fe9da,_0x43a691){return function(_0x15ac4e){_0x43a691[_0x7954('0x2')](_0x1fe9da,_0x15ac4e);};}function removeListener(_0x35035b,_0x5cf4d8){return function(){UserEvents[_0x7954('0x3')](_0x35035b,_0x5cf4d8);};}exports[_0x7954('0x4')]=function(_0x9fa8a0){for(var _0x5b3ed5=0x0,_0x10018d=events[_0x7954('0x5')];_0x5b3ed5<_0x10018d;_0x5b3ed5++){var _0x164345=events[_0x5b3ed5];var _0x58a8a0=createListener(_0x7954('0x6')+_0x164345,_0x9fa8a0);UserEvents['on'](_0x164345,_0x58a8a0);}}; \ No newline at end of file +var _0xa061=['remove','update','emit','removeListener','register','length','./user.events','save'];(function(_0x32cd80,_0x5c82d7){var _0x108c48=function(_0x221987){while(--_0x221987){_0x32cd80['push'](_0x32cd80['shift']());}};_0x108c48(++_0x5c82d7);}(_0xa061,0xbe));var _0x1a06=function(_0x3daab5,_0x4c82c0){_0x3daab5=_0x3daab5-0x0;var _0x5c9961=_0xa061[_0x3daab5];return _0x5c9961;};'use strict';var UserEvents=require(_0x1a06('0x0'));var events=[_0x1a06('0x1'),_0x1a06('0x2'),_0x1a06('0x3')];function createListener(_0x27d3d9,_0x557657){return function(_0x492a3a){_0x557657[_0x1a06('0x4')](_0x27d3d9,_0x492a3a);};}function removeListener(_0x570999,_0x292302){return function(){UserEvents[_0x1a06('0x5')](_0x570999,_0x292302);};}exports[_0x1a06('0x6')]=function(_0x4e75c4){for(var _0x598428=0x0,_0x54df77=events[_0x1a06('0x7')];_0x598428<_0x54df77;_0x598428++){var _0x495964=events[_0x598428];var _0x306b15=createListener('user:'+_0x495964,_0x4e75c4);UserEvents['on'](_0x495964,_0x306b15);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 72ba872..9415216 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2c882a,_0x1ba28a){var _0xa7ff48=function(_0x14cf5a){while(--_0x14cf5a){_0x2c882a['push'](_0x2c882a['shift']());}};_0xa7ff48(++_0x1ba28a);}(_0xedd9,0xfc));var _0x9edd=function(_0xf9de6a,_0x3cd9ab){_0xf9de6a=_0xf9de6a-0x0;var _0x1a7f7c=_0xedd9[_0xf9de6a];return _0x1a7f7c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ab14d,_0x50861d){var _0x269b12=function(_0x3ad9ac){while(--_0x3ad9ac){_0x1ab14d['push'](_0x1ab14d['shift']());}};_0x269b12(++_0x50861d);}(_0xe706,0xa3));var _0x6e70=function(_0x187790,_0x2a083b){_0x187790=_0x187790-0x0;var _0x472705=_0xe706[_0x187790];return _0x472705;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9d0800d..9baeaff 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 _0x8d43=['INTEGER','sequelize'];(function(_0x2712d3,_0x313a41){var _0x379f1e=function(_0x2a0e86){while(--_0x2a0e86){_0x2712d3['push'](_0x2712d3['shift']());}};_0x379f1e(++_0x313a41);}(_0x8d43,0xbf));var _0x38d4=function(_0x4fb543,_0x3c13f8){_0x4fb543=_0x4fb543-0x0;var _0x59da2f=_0x8d43[_0x4fb543];return _0x59da2f;};'use strict';var Sequelize=require(_0x38d4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x38d4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd45=['sequelize'];(function(_0x26222d,_0x1d2de1){var _0x16bf9f=function(_0x43892a){while(--_0x43892a){_0x26222d['push'](_0x26222d['shift']());}};_0x16bf9f(++_0x1d2de1);}(_0xcd45,0x140));var _0x5cd4=function(_0x2e854e,_0x2208af){_0x2e854e=_0x2e854e-0x0;var _0x452e9f=_0xcd45[_0x2e854e];return _0x452e9f;};'use strict';var Sequelize=require(_0x5cd4('0x0'));module['exports']={'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 88312da..a286d0c 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 _0x0723=['./userChatQueue.attributes','define','user_has_chat_queues','lodash','../../config/logger','moment','bluebird','path'];(function(_0x430b26,_0x3e828c){var _0x5968a8=function(_0x3ed54c){while(--_0x3ed54c){_0x430b26['push'](_0x430b26['shift']());}};_0x5968a8(++_0x3e828c);}(_0x0723,0x7b));var _0x3072=function(_0x393a76,_0x10e845){_0x393a76=_0x393a76-0x0;var _0x2da669=_0x0723[_0x393a76];return _0x2da669;};'use strict';var _=require(_0x3072('0x0'));var util=require('util');var logger=require(_0x3072('0x1'))('api');var moment=require(_0x3072('0x2'));var BPromise=require(_0x3072('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3072('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3072('0x5'));module['exports']=function(_0x525170,_0x279c12){return _0x525170[_0x3072('0x6')]('UserChatQueue',attributes,{'tableName':_0x3072('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd97e=['user_has_chat_queues','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userChatQueue.attributes','define','UserChatQueue'];(function(_0x109c09,_0x47366c){var _0x47d483=function(_0x5218d4){while(--_0x5218d4){_0x109c09['push'](_0x109c09['shift']());}};_0x47d483(++_0x47366c);}(_0xd97e,0x182));var _0xed97=function(_0x498d0d,_0x1cac5a){_0x498d0d=_0x498d0d-0x0;var _0x3bffd5=_0xd97e[_0x498d0d];return _0x3bffd5;};'use strict';var _=require('lodash');var util=require(_0xed97('0x0'));var logger=require(_0xed97('0x1'))(_0xed97('0x2'));var moment=require(_0xed97('0x3'));var BPromise=require('bluebird');var rp=require(_0xed97('0x4'));var fs=require('fs');var path=require(_0xed97('0x5'));var rimraf=require('rimraf');var config=require(_0xed97('0x6'));var attributes=require(_0xed97('0x7'));module['exports']=function(_0xf2d877,_0x3bfbf0){return _0xf2d877[_0xed97('0x8')](_0xed97('0x9'),attributes,{'tableName':_0xed97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 01589dc..a9e78c9 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 _0x03f5=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result'];(function(_0x24fcc6,_0x16d718){var _0x2d5f11=function(_0x4dd249){while(--_0x4dd249){_0x24fcc6['push'](_0x24fcc6['shift']());}};_0x2d5f11(++_0x16d718);}(_0x03f5,0x146));var _0x503f=function(_0x5f18ee,_0x10648f){_0x5f18ee=_0x5f18ee-0x0;var _0x908f35=_0x03f5[_0x5f18ee];return _0x908f35;};'use strict';var _=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var moment=require(_0x503f('0x2'));var BPromise=require(_0x503f('0x3'));var rs=require(_0x503f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x503f('0x5'))['db'];var utils=require(_0x503f('0x6'));var logger=require(_0x503f('0x7'))(_0x503f('0x8'));var config=require(_0x503f('0x9'));var jayson=require(_0x503f('0xa'));var client=jayson[_0x503f('0xb')][_0x503f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fb365,_0x535f47,_0x48068c){return new BPromise(function(_0xb3bbdd,_0x400cbc){return client[_0x503f('0xd')](_0x1fb365,_0x48068c)[_0x503f('0xe')](function(_0x18f756){logger[_0x503f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x535f47,_0x503f('0x10'));logger['debug'](_0x503f('0x11'),_0x535f47,_0x503f('0x10'),JSON[_0x503f('0x12')](_0x18f756));if(_0x18f756['error']){if(_0x18f756[_0x503f('0x13')][_0x503f('0x14')]===0x1f4){logger[_0x503f('0x13')](_0x503f('0x15'),_0x535f47,_0x18f756[_0x503f('0x13')]['message']);return _0x400cbc(_0x18f756[_0x503f('0x13')][_0x503f('0x16')]);}logger[_0x503f('0x13')](_0x503f('0x15'),_0x535f47,_0x18f756[_0x503f('0x13')]['message']);return _0xb3bbdd(_0x18f756['error'][_0x503f('0x16')]);}else{logger[_0x503f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x535f47,_0x503f('0x10'));_0xb3bbdd(_0x18f756[_0x503f('0x17')][_0x503f('0x16')]);}})[_0x503f('0x18')](function(_0x2e5837){logger[_0x503f('0x13')](_0x503f('0x15'),_0x535f47,_0x2e5837);_0x400cbc(_0x2e5837);});});} \ No newline at end of file +var _0xfa15=['stringify','error','message','info','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x56ce3c,_0x53617a){var _0x76b43=function(_0x5e6079){while(--_0x5e6079){_0x56ce3c['push'](_0x56ce3c['shift']());}};_0x76b43(++_0x53617a);}(_0xfa15,0x159));var _0x5fa1=function(_0x3a8172,_0x361c91){_0x3a8172=_0x3a8172-0x0;var _0x1aa63a=_0xfa15[_0x3a8172];return _0x1aa63a;};'use strict';var _=require(_0x5fa1('0x0'));var util=require(_0x5fa1('0x1'));var moment=require(_0x5fa1('0x2'));var BPromise=require('bluebird');var rs=require(_0x5fa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fa1('0x4'))['db'];var utils=require(_0x5fa1('0x5'));var logger=require('../../config/logger')(_0x5fa1('0x6'));var config=require(_0x5fa1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fa1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c666,_0x4399fa,_0x466c7a){return new BPromise(function(_0x3e4583,_0x12840e){return client[_0x5fa1('0x9')](_0x33c666,_0x466c7a)[_0x5fa1('0xa')](function(_0x408920){logger['info'](_0x5fa1('0xb'),_0x4399fa,_0x5fa1('0xc'));logger[_0x5fa1('0xd')](_0x5fa1('0xe'),_0x4399fa,_0x5fa1('0xc'),JSON[_0x5fa1('0xf')](_0x408920));if(_0x408920[_0x5fa1('0x10')]){if(_0x408920[_0x5fa1('0x10')]['code']===0x1f4){logger[_0x5fa1('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4399fa,_0x408920['error'][_0x5fa1('0x11')]);return _0x12840e(_0x408920[_0x5fa1('0x10')][_0x5fa1('0x11')]);}logger['error'](_0x5fa1('0xb'),_0x4399fa,_0x408920[_0x5fa1('0x10')][_0x5fa1('0x11')]);return _0x3e4583(_0x408920[_0x5fa1('0x10')][_0x5fa1('0x11')]);}else{logger[_0x5fa1('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x4399fa,'request\x20sent');_0x3e4583(_0x408920[_0x5fa1('0x13')][_0x5fa1('0x11')]);}})['catch'](function(_0x1a61c8){logger[_0x5fa1('0x10')](_0x5fa1('0xb'),_0x4399fa,_0x1a61c8);_0x12840e(_0x1a61c8);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7fe7bf5..cec222d 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5dad1b,_0x1b0595){var _0x2f97fa=function(_0x23daa0){while(--_0x23daa0){_0x5dad1b['push'](_0x5dad1b['shift']());}};_0x2f97fa(++_0x1b0595);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xd89010,_0x1cc10c){var _0x5e04b9=function(_0x5f8a01){while(--_0x5f8a01){_0xd89010['push'](_0xd89010['shift']());}};_0x5e04b9(++_0x1cc10c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xcb91[_0x3e21f4];return _0x40fc49;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 37b05b4..597e929 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 _0xa4dc=['INTEGER','sequelize','exports'];(function(_0x21bc94,_0xa51b7f){var _0x38ae83=function(_0x55b0f1){while(--_0x55b0f1){_0x21bc94['push'](_0x21bc94['shift']());}};_0x38ae83(++_0xa51b7f);}(_0xa4dc,0x145));var _0xca4d=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa4dc[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xca4d('0x0'));module[_0xca4d('0x1')]={'penalty':{'type':Sequelize[_0xca4d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xca4d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6b1=['sequelize','exports','INTEGER','STRING'];(function(_0x51a07a,_0xbd0fc7){var _0x57531e=function(_0x442da0){while(--_0x442da0){_0x51a07a['push'](_0x51a07a['shift']());}};_0x57531e(++_0xbd0fc7);}(_0xc6b1,0x15c));var _0x1c6b=function(_0x3b07d0,_0x42f4e8){_0x3b07d0=_0x3b07d0-0x0;var _0x5b393d=_0xc6b1[_0x3b07d0];return _0x5b393d;};'use strict';var Sequelize=require(_0x1c6b('0x0'));module[_0x1c6b('0x1')]={'penalty':{'type':Sequelize[_0x1c6b('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1c6b('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1c6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 881e065..661919a 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 _0x8bad=['UserFaxQueue','user_has_fax_queues','lodash','path','rimraf','../../config/environment','exports'];(function(_0x470bb0,_0x49979b){var _0x141a38=function(_0x854302){while(--_0x854302){_0x470bb0['push'](_0x470bb0['shift']());}};_0x141a38(++_0x49979b);}(_0x8bad,0x1de));var _0xd8ba=function(_0xb4bda2,_0x42ed9e){_0xb4bda2=_0xb4bda2-0x0;var _0x41db38=_0x8bad[_0xb4bda2];return _0x41db38;};'use strict';var _=require(_0xd8ba('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8ba('0x1'));var rimraf=require(_0xd8ba('0x2'));var config=require(_0xd8ba('0x3'));var attributes=require('./userFaxQueue.attributes');module[_0xd8ba('0x4')]=function(_0xf6e91,_0x1908ed){return _0xf6e91['define'](_0xd8ba('0x5'),attributes,{'tableName':_0xd8ba('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x0ac0,0xb3));var _0x00ac=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x0ac0[_0x589f71];return _0x5763bd;};'use strict';var _=require(_0x00ac('0x0'));var util=require(_0x00ac('0x1'));var logger=require(_0x00ac('0x2'))(_0x00ac('0x3'));var moment=require(_0x00ac('0x4'));var BPromise=require(_0x00ac('0x5'));var rp=require(_0x00ac('0x6'));var fs=require('fs');var path=require(_0x00ac('0x7'));var rimraf=require(_0x00ac('0x8'));var config=require(_0x00ac('0x9'));var attributes=require('./userFaxQueue.attributes');module[_0x00ac('0xa')]=function(_0x556c0a,_0x23823b){return _0x556c0a[_0x00ac('0xb')](_0x00ac('0xc'),attributes,{'tableName':_0x00ac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index e12e801..6a41015 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 _0x57ab=['../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x585a17,_0x293fb9){var _0x420461=function(_0x58ce6d){while(--_0x58ce6d){_0x585a17['push'](_0x585a17['shift']());}};_0x420461(++_0x293fb9);}(_0x57ab,0x110));var _0xb57a=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0x57ab[_0x73a84b];return _0x9e2a66;};'use strict';var _=require(_0xb57a('0x0'));var util=require(_0xb57a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb57a('0x2'));var fs=require('fs');var Redis=require(_0xb57a('0x3'));var db=require(_0xb57a('0x4'))['db'];var utils=require(_0xb57a('0x5'));var logger=require(_0xb57a('0x6'))(_0xb57a('0x7'));var config=require(_0xb57a('0x8'));var jayson=require(_0xb57a('0x9'));var client=jayson[_0xb57a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d7a48,_0x103417,_0x441111){return new BPromise(function(_0x35a120,_0x2b517d){return client[_0xb57a('0xb')](_0x3d7a48,_0x441111)[_0xb57a('0xc')](function(_0x1ce63e){logger[_0xb57a('0xd')](_0xb57a('0xe'),_0x103417,_0xb57a('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x103417,_0xb57a('0xf'),JSON[_0xb57a('0x10')](_0x1ce63e));if(_0x1ce63e[_0xb57a('0x11')]){if(_0x1ce63e[_0xb57a('0x11')][_0xb57a('0x12')]===0x1f4){logger[_0xb57a('0x11')](_0xb57a('0xe'),_0x103417,_0x1ce63e[_0xb57a('0x11')][_0xb57a('0x13')]);return _0x2b517d(_0x1ce63e[_0xb57a('0x11')]['message']);}logger[_0xb57a('0x11')](_0xb57a('0xe'),_0x103417,_0x1ce63e[_0xb57a('0x11')][_0xb57a('0x13')]);return _0x35a120(_0x1ce63e[_0xb57a('0x11')][_0xb57a('0x13')]);}else{logger['info'](_0xb57a('0xe'),_0x103417,'request\x20sent');_0x35a120(_0x1ce63e['result'][_0xb57a('0x13')]);}})['catch'](function(_0x3fb33b){logger[_0xb57a('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x103417,_0x3fb33b);_0x2b517d(_0x3fb33b);});});} \ No newline at end of file +var _0x5539=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x5ceb75,_0x285bba){var _0x2b4079=function(_0x54e1b2){while(--_0x54e1b2){_0x5ceb75['push'](_0x5ceb75['shift']());}};_0x2b4079(++_0x285bba);}(_0x5539,0x1ac));var _0x9553=function(_0x187434,_0x2fee61){_0x187434=_0x187434-0x0;var _0x3785dd=_0x5539[_0x187434];return _0x3785dd;};'use strict';var _=require('lodash');var util=require(_0x9553('0x0'));var moment=require(_0x9553('0x1'));var BPromise=require(_0x9553('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9553('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9553('0x4'));var logger=require(_0x9553('0x5'))('rpc');var config=require(_0x9553('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9553('0x7')][_0x9553('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x273398,_0x3496a3,_0x423058){return new BPromise(function(_0x72ab4e,_0x57c6a2){return client[_0x9553('0x9')](_0x273398,_0x423058)[_0x9553('0xa')](function(_0xa1901d){logger[_0x9553('0xb')](_0x9553('0xc'),_0x3496a3,_0x9553('0xd'));logger[_0x9553('0xe')](_0x9553('0xf'),_0x3496a3,_0x9553('0xd'),JSON[_0x9553('0x10')](_0xa1901d));if(_0xa1901d[_0x9553('0x11')]){if(_0xa1901d[_0x9553('0x11')]['code']===0x1f4){logger[_0x9553('0x11')](_0x9553('0xc'),_0x3496a3,_0xa1901d[_0x9553('0x11')]['message']);return _0x57c6a2(_0xa1901d['error'][_0x9553('0x12')]);}logger[_0x9553('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3496a3,_0xa1901d['error']['message']);return _0x72ab4e(_0xa1901d['error'][_0x9553('0x12')]);}else{logger[_0x9553('0xb')](_0x9553('0xc'),_0x3496a3,_0x9553('0xd'));_0x72ab4e(_0xa1901d[_0x9553('0x13')][_0x9553('0x12')]);}})[_0x9553('0x14')](function(_0x254bf5){logger[_0x9553('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3496a3,_0x254bf5);_0x57c6a2(_0x254bf5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1e3f562..2d418aa 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x328575,_0x54a4da){var _0x327e57=function(_0x2005cc){while(--_0x2005cc){_0x328575['push'](_0x328575['shift']());}};_0x327e57(++_0x54a4da);}(_0x70e0,0x17b));var _0x070e=function(_0x4325cb,_0x4787ee){_0x4325cb=_0x4325cb-0x0;var _0x461de6=_0x70e0[_0x4325cb];return _0x461de6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5f1eac,_0x5608a0){var _0x225f14=function(_0x1b913c){while(--_0x1b913c){_0x5f1eac['push'](_0x5f1eac['shift']());}};_0x225f14(++_0x5608a0);}(_0x70e0,0x17b));var _0x070e=function(_0x3446c6,_0x47bade){_0x3446c6=_0x3446c6-0x0;var _0x3246f1=_0x70e0[_0x3446c6];return _0x3246f1;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ca3abba..4f44762 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 _0x10ab=['sequelize','exports'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x10ab,0x178));var _0xb10a=function(_0x45b1ad,_0x215b03){_0x45b1ad=_0x45b1ad-0x0;var _0x3d5696=_0x10ab[_0x45b1ad];return _0x3d5696;};'use strict';var Sequelize=require(_0xb10a('0x0'));module[_0xb10a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f1e=['INTEGER','exports'];(function(_0x54ac83,_0x15bf52){var _0x978ffd=function(_0x4423a1){while(--_0x4423a1){_0x54ac83['push'](_0x54ac83['shift']());}};_0x978ffd(++_0x15bf52);}(_0x5f1e,0x71));var _0xe5f1=function(_0x5af457,_0x1707e2){_0x5af457=_0x5af457-0x0;var _0x6655dc=_0x5f1e[_0x5af457];return _0x6655dc;};'use strict';var Sequelize=require('sequelize');module[_0xe5f1('0x0')]={'penalty':{'type':Sequelize[_0xe5f1('0x1')],'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 3ba6f3a..cd434d7 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 _0x99ea=['exports','define','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x99ea,0x147));var _0xa99e=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x99ea[_0x2e50a2];return _0x47e5de;};'use strict';var _=require(_0xa99e('0x0'));var util=require(_0xa99e('0x1'));var logger=require(_0xa99e('0x2'))('api');var moment=require(_0xa99e('0x3'));var BPromise=require(_0xa99e('0x4'));var rp=require(_0xa99e('0x5'));var fs=require('fs');var path=require(_0xa99e('0x6'));var rimraf=require(_0xa99e('0x7'));var config=require(_0xa99e('0x8'));var attributes=require('./userMailQueue.attributes');module[_0xa99e('0x9')]=function(_0x2b4843,_0x314732){return _0x2b4843[_0xa99e('0xa')]('UserMailQueue',attributes,{'tableName':_0xa99e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5401=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x58fb8f,_0x54372c){var _0x4e4099=function(_0x55ab93){while(--_0x55ab93){_0x58fb8f['push'](_0x58fb8f['shift']());}};_0x4e4099(++_0x54372c);}(_0x5401,0x7c));var _0x1540=function(_0xef8337,_0xa3b04a){_0xef8337=_0xef8337-0x0;var _0x278454=_0x5401[_0xef8337];return _0x278454;};'use strict';var _=require(_0x1540('0x0'));var util=require(_0x1540('0x1'));var logger=require('../../config/logger')(_0x1540('0x2'));var moment=require(_0x1540('0x3'));var BPromise=require(_0x1540('0x4'));var rp=require(_0x1540('0x5'));var fs=require('fs');var path=require(_0x1540('0x6'));var rimraf=require(_0x1540('0x7'));var config=require('../../config/environment');var attributes=require(_0x1540('0x8'));module['exports']=function(_0xc1db4c,_0x36a2b9){return _0xc1db4c[_0x1540('0x9')](_0x1540('0xa'),attributes,{'tableName':_0x1540('0xb'),'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 1665c23..aaf9414 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x300698,_0x4e27fe){var _0x73d4fb=function(_0x3b7be9){while(--_0x3b7be9){_0x300698['push'](_0x300698['shift']());}};_0x73d4fb(++_0x4e27fe);}(_0x8ef6,0xf2));var _0x68ef=function(_0x52481b,_0x5b1f02){_0x52481b=_0x52481b-0x0;var _0x57ae8b=_0x8ef6[_0x52481b];return _0x57ae8b;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x58f903,_0x593887){var _0x3e0db4=function(_0x12c71b){while(--_0x12c71b){_0x58f903['push'](_0x58f903['shift']());}};_0x3e0db4(++_0x593887);}(_0x34e8,0x12c));var _0x834e=function(_0x1724f1,_0x394bd2){_0x1724f1=_0x1724f1-0x0;var _0x6d5b5f=_0x34e8[_0x1724f1];return _0x6d5b5f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 547fe55..daa5297 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 _0xda73=['sendUserNotification','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0xda73,0x136));var _0x3da7=function(_0x2ae78e,_0x1a1758){_0x2ae78e=_0x2ae78e-0x0;var _0x56cbeb=_0xda73[_0x2ae78e];return _0x56cbeb;};'use strict';var multer=require('multer');var util=require(_0x3da7('0x0'));var path=require(_0x3da7('0x1'));var timeout=require(_0x3da7('0x2'));var express=require(_0x3da7('0x3'));var router=express[_0x3da7('0x4')]();var fs_extra=require(_0x3da7('0x5'));var auth=require(_0x3da7('0x6'));var interaction=require(_0x3da7('0x7'));var config=require(_0x3da7('0x8'));var controller=require(_0x3da7('0x9'));router[_0x3da7('0xa')]('/',auth[_0x3da7('0xb')](),controller[_0x3da7('0xc')]);module[_0x3da7('0xd')]=router; \ No newline at end of file +var _0xd490=['Router','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','multer','util','path','connect-timeout','express'];(function(_0x386b69,_0x5d9360){var _0x476415=function(_0x49fd60){while(--_0x49fd60){_0x386b69['push'](_0x386b69['shift']());}};_0x476415(++_0x5d9360);}(_0xd490,0x1c3));var _0x0d49=function(_0xa9f849,_0x121664){_0xa9f849=_0xa9f849-0x0;var _0x129a01=_0xd490[_0xa9f849];return _0x129a01;};'use strict';var multer=require(_0x0d49('0x0'));var util=require(_0x0d49('0x1'));var path=require(_0x0d49('0x2'));var timeout=require(_0x0d49('0x3'));var express=require(_0x0d49('0x4'));var router=express[_0x0d49('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0d49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0d49('0x7'));var controller=require(_0x0d49('0x8'));router[_0x0d49('0x9')]('/',auth[_0x0d49('0xa')](),controller[_0x0d49('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7bb29c3..6b35923 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 _0x4253=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x529a0f,_0x328763){var _0x187a88=function(_0x1ea706){while(--_0x1ea706){_0x529a0f['push'](_0x529a0f['shift']());}};_0x187a88(++_0x328763);}(_0x4253,0x81));var _0x3425=function(_0xc70dac,_0x6710dd){_0xc70dac=_0xc70dac-0x0;var _0x5a108a=_0x4253[_0xc70dac];return _0x5a108a;};'use strict';var Sequelize=require(_0x3425('0x0'));module['exports']={'body':{'type':Sequelize[_0x3425('0x1')]},'senderName':{'type':Sequelize[_0x3425('0x2')]},'recipientsId':{'type':Sequelize[_0x3425('0x1')]},'recipientsDescription':{'type':Sequelize[_0x3425('0x2')]},'beep':{'type':Sequelize[_0x3425('0x3')]}}; \ No newline at end of file +var _0x72df=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0x72df,0x69));var _0xf72d=function(_0x1e6a98,_0x5d134e){_0x1e6a98=_0x1e6a98-0x0;var _0x489b54=_0x72df[_0x1e6a98];return _0x489b54;};'use strict';var Sequelize=require(_0xf72d('0x0'));module['exports']={'body':{'type':Sequelize[_0xf72d('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xf72d('0x1')]},'recipientsDescription':{'type':Sequelize[_0xf72d('0x2')]},'beep':{'type':Sequelize[_0xf72d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4a3cb96..a7d055d 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 _0x0d63=['User','union','ids','replace','queue','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x0d63,0x71));var _0x30d6=function(_0x352f85,_0x3382bf){_0x352f85=_0x352f85-0x0;var _0x2f2f6d=_0x0d63[_0x352f85];return _0x2f2f6d;};'use strict';var emlformat=require(_0x30d6('0x0'));var rimraf=require(_0x30d6('0x1'));var zipdir=require(_0x30d6('0x2'));var jsonpatch=require(_0x30d6('0x3'));var rp=require('request-promise');var moment=require(_0x30d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30d6('0x5'));var util=require(_0x30d6('0x6'));var path=require('path');var sox=require(_0x30d6('0x7'));var csv=require(_0x30d6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30d6('0x9'));var _=require(_0x30d6('0xa'));var squel=require(_0x30d6('0xb'));var crypto=require(_0x30d6('0xc'));var jsforce=require(_0x30d6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x30d6('0xe'));var Redis=require(_0x30d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x30d6('0x10'));var as=require(_0x30d6('0x11'));var hardwareService=require(_0x30d6('0x12'));var logger=require(_0x30d6('0x13'))(_0x30d6('0x14'));var utils=require(_0x30d6('0x15'));var config=require(_0x30d6('0x16'));var licenseUtil=require(_0x30d6('0x17'));var db=require(_0x30d6('0x18'))['db'];config[_0x30d6('0x19')]=_[_0x30d6('0x1a')](config['redis'],{'host':_0x30d6('0x1b'),'port':0x18eb});var socket=require(_0x30d6('0x1c'))(new Redis(config[_0x30d6('0x19')]));require(_0x30d6('0x1d'))[_0x30d6('0x1e')](socket);function respondWithStatusCode(_0x53954a,_0xf2e44){_0xf2e44=_0xf2e44||0xcc;return function(_0x493d68){if(_0x493d68){return _0x53954a['sendStatus'](_0xf2e44);}return _0x53954a['status'](_0xf2e44)[_0x30d6('0x1f')]();};}function respondWithResult(_0x5d3ac3,_0x257338){_0x257338=_0x257338||0xc8;return function(_0x367fbb){if(_0x367fbb){return _0x5d3ac3['status'](_0x257338)['json'](_0x367fbb);}};}function respondWithFilteredResult(_0x3399bb,_0x563291){return function(_0x11517e){if(_0x11517e){var _0x25e7e1=typeof _0x563291[_0x30d6('0x20')]===_0x30d6('0x21')&&typeof _0x563291[_0x30d6('0x22')]===_0x30d6('0x21');var _0x3589c6=_0x11517e[_0x30d6('0x23')];var _0x1f9e7e=_0x25e7e1?0x0:_0x563291['offset'];var _0x81382=_0x25e7e1?_0x11517e['count']:_0x563291[_0x30d6('0x20')]+_0x563291[_0x30d6('0x22')];var _0x100f2f;if(_0x81382>=_0x3589c6){_0x81382=_0x3589c6;_0x100f2f=0xc8;}else{_0x100f2f=0xce;}_0x3399bb[_0x30d6('0x24')](_0x100f2f);return _0x3399bb[_0x30d6('0x25')](_0x30d6('0x26'),_0x1f9e7e+'-'+_0x81382+'/'+_0x3589c6)[_0x30d6('0x27')](_0x11517e);}return null;};}function patchUpdates(_0x54b5d5){return function(_0x58d744){try{jsonpatch[_0x30d6('0x28')](_0x58d744,_0x54b5d5,!![]);}catch(_0x1a53e4){return BPromise['reject'](_0x1a53e4);}return _0x58d744[_0x30d6('0x29')]();};}function saveUpdates(_0xe31cc4,_0x395d5a){return function(_0x7b11a5){if(_0x7b11a5){return _0x7b11a5[_0x30d6('0x2a')](_0xe31cc4)[_0x30d6('0x2b')](function(_0x4095ff){return _0x4095ff;});}return null;};}function removeEntity(_0x244981,_0x310e51){return function(_0x20e077){if(_0x20e077){return _0x20e077[_0x30d6('0x2c')]()['then'](function(){_0x244981[_0x30d6('0x24')](0xcc)[_0x30d6('0x1f')]();});}};}function handleEntityNotFound(_0x3dfb19,_0x942803){return function(_0x2c6215){if(!_0x2c6215){_0x3dfb19['sendStatus'](0x194);}return _0x2c6215;};}function handleError(_0x962cae,_0x1691e7){_0x1691e7=_0x1691e7||0x1f4;return function(_0x415543){logger[_0x30d6('0x2d')](_0x415543[_0x30d6('0x2e')]);if(_0x415543[_0x30d6('0x2f')]){delete _0x415543[_0x30d6('0x2f')];}_0x962cae[_0x30d6('0x24')](_0x1691e7)[_0x30d6('0x30')](_0x415543);};}exports[_0x30d6('0x31')]=function(_0xfe8baa,_0x567d3c,_0x8b680f){if(!_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x33')](_0x30d6('0x34'))&&!_0xfe8baa[_0x30d6('0x32')]['hasOwnProperty'](_0x30d6('0x35'))){throw new db['Sequelize'][(_0x30d6('0x36'))](_0x30d6('0x37'));}else{if(_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x33')]('TemplateId')&&!_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x33')](_0x30d6('0x38'))){throw new db[(_0x30d6('0x39'))]['ValidationError'](_0x30d6('0x3a'));}if(!_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x33')](_0x30d6('0x3b'))){throw new db[(_0x30d6('0x39'))][(_0x30d6('0x36'))](_0x30d6('0x3c'));}else{try{var _0x5a2a1d=JSON['parse'](_0xfe8baa['body'][_0x30d6('0x3b')]);}catch(_0x153439){logger['error'](_0x153439);throw new db[(_0x30d6('0x39'))]['ValidationError'](_0x30d6('0x3d'));}var _0x54b595=[_0x30d6('0x3e'),_0x30d6('0x3f'),_0x30d6('0x40'),_0x30d6('0x41'),'smsqueue',_0x30d6('0x42'),_0x30d6('0x43'),_0x30d6('0x44'),_0x30d6('0x45')];if(_[_0x30d6('0x46')](_0x5a2a1d,function(_0x487e83){return!_[_0x30d6('0x47')](_0x54b595,_0x487e83[_0x30d6('0x48')][_0x30d6('0x49')]());})){throw new db[(_0x30d6('0x39'))][(_0x30d6('0x36'))](_0x30d6('0x4a'));}}}var _0x214d50={};_0x214d50[_0x30d6('0x4b')]=_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x33')]('senderName')?_0xfe8baa[_0x30d6('0x32')]['senderName']:_0xfe8baa['user'][_0x30d6('0x4c')];_0x214d50[_0x30d6('0x4d')]=_['isEmpty'](_0xfe8baa[_0x30d6('0x32')]['recipientsDescription'])?null:_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x4d')];_0x214d50[_0x30d6('0x4e')]=_0xfe8baa[_0x30d6('0x32')][_0x30d6('0x4e')]||![];_0x214d50[_0x30d6('0x4f')]=_0xfe8baa['user']['id'];return getContent(_0xfe8baa[_0x30d6('0x32')])['then'](function(_0x4170de){_0x214d50[_0x30d6('0x32')]=_0x4170de;return getRecipients(_0x5a2a1d);})[_0x30d6('0x2b')](function(_0x14b08){_0x214d50[_0x30d6('0x50')]=_[_0x30d6('0x51')](_0x14b08)[_0x30d6('0x52')](',');return db[_0x30d6('0x53')][_0x30d6('0x54')](function(_0x599d22){return db[_0x30d6('0x55')][_0x30d6('0x56')](_0x214d50,{'raw':!![],'transaction':_0x599d22})[_0x30d6('0x2b')](function(_0x3f6e96){var _0x42bead={'sender':_0x214d50[_0x30d6('0x4b')],'description':_0x214d50[_0x30d6('0x4d')],'content':_0x214d50['body'],'beep':_0x214d50[_0x30d6('0x4e')]};_0x14b08[_0x30d6('0x57')](function(_0x155a56){_0x42bead[_0x30d6('0x58')]=_0x155a56;socket['emit']('userNotification:send',_0x42bead);});return _0x3f6e96;});});})[_0x30d6('0x2b')](respondWithResult(_0x567d3c,0xc9))[_0x30d6('0x59')](handleError(_0x567d3c,null));};function getContent(_0x48dfd3){return new BPromise(function(_0x4dc652,_0x596965){if(_0x48dfd3[_0x30d6('0x34')]){_0x4dc652(_0x48dfd3[_0x30d6('0x34')]);return;}return db[_0x30d6('0x5a')][_0x30d6('0x5b')]({'attributes':['html'],'where':{'id':_0x48dfd3[_0x30d6('0x35')]},'raw':!![]})[_0x30d6('0x2b')](function(_0x432737){if(!_0x432737)throw new db[(_0x30d6('0x39'))]['ValidationError'](_0x30d6('0x5c'));var _0x26ca6c=Mustache[_0x30d6('0x5d')](_0x432737['html'],_0x48dfd3['view']);_0x4dc652(_0x26ca6c);})[_0x30d6('0x59')](function(_0x29d266){_0x596965(_0x29d266);});});}function getRecipients(_0x1a8f81){return new BPromise(function(_0x27c9b0,_0x374b62){var _0x4a27b7=[];var _0x28131c=[];_0x1a8f81[_0x30d6('0x57')](function(_0x536cae){var _0x4ccfd5=_[_0x30d6('0x5e')](_0x536cae[_0x30d6('0x48')][_0x30d6('0x49')]());if(_0x4ccfd5===_0x30d6('0x5f')){_0x4a27b7=_[_0x30d6('0x60')](_0x4a27b7,_0x536cae[_0x30d6('0x61')]);}else{if(_[_0x30d6('0x47')](_0x4ccfd5,'queue'))_0x4ccfd5=_0x4ccfd5[_0x30d6('0x62')](_0x30d6('0x63'),'Queue');_0x536cae[_0x30d6('0x61')][_0x30d6('0x57')](function(_0x361e08){_0x28131c[_0x30d6('0x64')](getAgents(_0x4ccfd5,_0x361e08));});}});return BPromise['all'](_0x28131c)[_0x30d6('0x2b')](function(_0x5b7a3b){_0x4a27b7=_[_0x30d6('0x60')](_0x4a27b7,_[_0x30d6('0x65')](_0x5b7a3b));_0x27c9b0(_0x4a27b7);})[_0x30d6('0x59')](function(_0x1596bc){_0x374b62(_0x1596bc);});});}function getAgents(_0xe2b161,_0x548dba){return new BPromise(function(_0x3e7e50,_0x3a4447){return db[_0xe2b161][_0x30d6('0x5b')]({'where':{'id':_0x548dba}})[_0x30d6('0x2b')](function(_0x900a37){return _0x900a37[_0x30d6('0x66')]({'attributes':['id'],'raw':!![]})[_0x30d6('0x2b')](function(_0x81e552){var _0x1d0665=_[_0x30d6('0x67')](_0x81e552,'id');_0x3e7e50(_0x1d0665);});})[_0x30d6('0x59')](function(_0x4ec12b){_0x3a4447(_0x4ec12b);});});} \ No newline at end of file +var _0xb439=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x5a86d7,_0x5bec58){var _0x3bd43b=function(_0xa881a0){while(--_0xa881a0){_0x5a86d7['push'](_0x5a86d7['shift']());}};_0x3bd43b(++_0x5bec58);}(_0xb439,0x12a));var _0x9b43=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb439[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x9b43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b43('0x1'));var jsonpatch=require(_0x9b43('0x2'));var rp=require('request-promise');var moment=require(_0x9b43('0x3'));var BPromise=require(_0x9b43('0x4'));var Mustache=require('mustache');var util=require(_0x9b43('0x5'));var path=require(_0x9b43('0x6'));var sox=require(_0x9b43('0x7'));var csv=require(_0x9b43('0x8'));var ejs=require(_0x9b43('0x9'));var fs=require('fs');var fs_extra=require(_0x9b43('0xa'));var _=require(_0x9b43('0xb'));var squel=require(_0x9b43('0xc'));var crypto=require(_0x9b43('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9b43('0xe'));var toCsv=require(_0x9b43('0x8'));var querystring=require('querystring');var Papa=require(_0x9b43('0xf'));var Redis=require('ioredis');var authService=require(_0x9b43('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b43('0x11'));var logger=require(_0x9b43('0x12'))(_0x9b43('0x13'));var utils=require('../../config/utils');var config=require(_0x9b43('0x14'));var licenseUtil=require(_0x9b43('0x15'));var db=require(_0x9b43('0x16'))['db'];config[_0x9b43('0x17')]=_[_0x9b43('0x18')](config[_0x9b43('0x17')],{'host':_0x9b43('0x19'),'port':0x18eb});var socket=require(_0x9b43('0x1a'))(new Redis(config['redis']));require(_0x9b43('0x1b'))[_0x9b43('0x1c')](socket);function respondWithStatusCode(_0x58f122,_0x43096b){_0x43096b=_0x43096b||0xcc;return function(_0xfc8e54){if(_0xfc8e54){return _0x58f122[_0x9b43('0x1d')](_0x43096b);}return _0x58f122[_0x9b43('0x1e')](_0x43096b)['end']();};}function respondWithResult(_0xfe29c8,_0x2e4f3d){_0x2e4f3d=_0x2e4f3d||0xc8;return function(_0x152d87){if(_0x152d87){return _0xfe29c8[_0x9b43('0x1e')](_0x2e4f3d)[_0x9b43('0x1f')](_0x152d87);}};}function respondWithFilteredResult(_0x54762a,_0x7f90c6){return function(_0x241a81){if(_0x241a81){var _0x50cc69=typeof _0x7f90c6[_0x9b43('0x20')]===_0x9b43('0x21')&&typeof _0x7f90c6[_0x9b43('0x22')]==='undefined';var _0x571674=_0x241a81[_0x9b43('0x23')];var _0x444e1d=_0x50cc69?0x0:_0x7f90c6[_0x9b43('0x20')];var _0x46d77c=_0x50cc69?_0x241a81[_0x9b43('0x23')]:_0x7f90c6[_0x9b43('0x20')]+_0x7f90c6[_0x9b43('0x22')];var _0x379607;if(_0x46d77c>=_0x571674){_0x46d77c=_0x571674;_0x379607=0xc8;}else{_0x379607=0xce;}_0x54762a[_0x9b43('0x1e')](_0x379607);return _0x54762a[_0x9b43('0x24')](_0x9b43('0x25'),_0x444e1d+'-'+_0x46d77c+'/'+_0x571674)[_0x9b43('0x1f')](_0x241a81);}return null;};}function patchUpdates(_0x372a92){return function(_0x162ae0){try{jsonpatch[_0x9b43('0x26')](_0x162ae0,_0x372a92,!![]);}catch(_0x4fae26){return BPromise[_0x9b43('0x27')](_0x4fae26);}return _0x162ae0[_0x9b43('0x28')]();};}function saveUpdates(_0x256437,_0x2ce2fc){return function(_0x2e4b30){if(_0x2e4b30){return _0x2e4b30['update'](_0x256437)['then'](function(_0x4114ab){return _0x4114ab;});}return null;};}function removeEntity(_0x23d4f9,_0x3f91cb){return function(_0x4dd450){if(_0x4dd450){return _0x4dd450[_0x9b43('0x29')]()[_0x9b43('0x2a')](function(){_0x23d4f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0e6e,_0x6748ea){return function(_0x4efc15){if(!_0x4efc15){_0x3a0e6e['sendStatus'](0x194);}return _0x4efc15;};}function handleError(_0x19dcc5,_0x233d87){_0x233d87=_0x233d87||0x1f4;return function(_0x2876e5){logger[_0x9b43('0x2b')](_0x2876e5['stack']);if(_0x2876e5[_0x9b43('0x2c')]){delete _0x2876e5['name'];}_0x19dcc5['status'](_0x233d87)[_0x9b43('0x2d')](_0x2876e5);};}exports[_0x9b43('0x2e')]=function(_0x3257ba,_0x3dd75a,_0x431f0b){if(!_0x3257ba['body'][_0x9b43('0x2f')](_0x9b43('0x30'))&&!_0x3257ba[_0x9b43('0x31')][_0x9b43('0x2f')](_0x9b43('0x32'))){throw new db[(_0x9b43('0x33'))]['ValidationError'](_0x9b43('0x34'));}else{if(_0x3257ba['body']['hasOwnProperty'](_0x9b43('0x32'))&&!_0x3257ba['body'][_0x9b43('0x2f')](_0x9b43('0x35'))){throw new db[(_0x9b43('0x33'))][(_0x9b43('0x36'))](_0x9b43('0x37'));}if(!_0x3257ba[_0x9b43('0x31')][_0x9b43('0x2f')](_0x9b43('0x38'))){throw new db[(_0x9b43('0x33'))][(_0x9b43('0x36'))](_0x9b43('0x39'));}else{try{var _0x6d2177=JSON[_0x9b43('0x3a')](_0x3257ba[_0x9b43('0x31')]['recipients']);}catch(_0x31a126){logger[_0x9b43('0x2b')](_0x31a126);throw new db[(_0x9b43('0x33'))][(_0x9b43('0x36'))](_0x9b43('0x3b'));}var _0x29e88f=[_0x9b43('0x3c'),_0x9b43('0x3d'),_0x9b43('0x3e'),'openchannelqueue','smsqueue','voicequeue',_0x9b43('0x3f'),_0x9b43('0x40'),_0x9b43('0x41')];if(_[_0x9b43('0x42')](_0x6d2177,function(_0x29d246){return!_[_0x9b43('0x43')](_0x29e88f,_0x29d246[_0x9b43('0x44')][_0x9b43('0x45')]());})){throw new db[(_0x9b43('0x33'))]['ValidationError'](_0x9b43('0x46'));}}}var _0x115c3a={};_0x115c3a['senderName']=_0x3257ba['body'][_0x9b43('0x2f')](_0x9b43('0x47'))?_0x3257ba[_0x9b43('0x31')][_0x9b43('0x47')]:_0x3257ba[_0x9b43('0x41')]['fullname'];_0x115c3a[_0x9b43('0x48')]=_[_0x9b43('0x49')](_0x3257ba[_0x9b43('0x31')][_0x9b43('0x48')])?null:_0x3257ba[_0x9b43('0x31')][_0x9b43('0x48')];_0x115c3a[_0x9b43('0x4a')]=_0x3257ba[_0x9b43('0x31')][_0x9b43('0x4a')]||![];_0x115c3a[_0x9b43('0x4b')]=_0x3257ba[_0x9b43('0x41')]['id'];return getContent(_0x3257ba[_0x9b43('0x31')])[_0x9b43('0x2a')](function(_0xb0b45d){_0x115c3a['body']=_0xb0b45d;return getRecipients(_0x6d2177);})[_0x9b43('0x2a')](function(_0x3b7327){_0x115c3a[_0x9b43('0x4c')]=_[_0x9b43('0x4d')](_0x3b7327)[_0x9b43('0x4e')](',');return db['sequelize'][_0x9b43('0x4f')](function(_0x5255ec){return db['UserNotification']['create'](_0x115c3a,{'raw':!![],'transaction':_0x5255ec})[_0x9b43('0x2a')](function(_0x15c859){var _0x4ab045={'sender':_0x115c3a['senderName'],'description':_0x115c3a[_0x9b43('0x48')],'content':_0x115c3a[_0x9b43('0x31')],'beep':_0x115c3a[_0x9b43('0x4a')]};_0x3b7327[_0x9b43('0x50')](function(_0x3f368d){_0x4ab045[_0x9b43('0x51')]=_0x3f368d;socket[_0x9b43('0x52')](_0x9b43('0x53'),_0x4ab045);});return _0x15c859;});});})[_0x9b43('0x2a')](respondWithResult(_0x3dd75a,0xc9))[_0x9b43('0x54')](handleError(_0x3dd75a,null));};function getContent(_0x41e892){return new BPromise(function(_0x3cef3d,_0x4d604d){if(_0x41e892[_0x9b43('0x30')]){_0x3cef3d(_0x41e892[_0x9b43('0x30')]);return;}return db[_0x9b43('0x55')][_0x9b43('0x56')]({'attributes':[_0x9b43('0x57')],'where':{'id':_0x41e892['TemplateId']},'raw':!![]})['then'](function(_0x24051c){if(!_0x24051c)throw new db[(_0x9b43('0x33'))][(_0x9b43('0x36'))](_0x9b43('0x58'));var _0x469a4f=Mustache['render'](_0x24051c[_0x9b43('0x57')],_0x41e892['view']);_0x3cef3d(_0x469a4f);})[_0x9b43('0x54')](function(_0x4c7114){_0x4d604d(_0x4c7114);});});}function getRecipients(_0x50dbd3){return new BPromise(function(_0x2c2103,_0x3984d5){var _0x445573=[];var _0x1c0d13=[];_0x50dbd3[_0x9b43('0x50')](function(_0x50d069){var _0xa20a1=_[_0x9b43('0x59')](_0x50d069[_0x9b43('0x44')][_0x9b43('0x45')]());if(_0xa20a1===_0x9b43('0x5a')){_0x445573=_[_0x9b43('0x5b')](_0x445573,_0x50d069[_0x9b43('0x5c')]);}else{if(_[_0x9b43('0x43')](_0xa20a1,_0x9b43('0x5d')))_0xa20a1=_0xa20a1[_0x9b43('0x5e')](_0x9b43('0x5d'),_0x9b43('0x5f'));_0x50d069[_0x9b43('0x5c')][_0x9b43('0x50')](function(_0x5e791e){_0x1c0d13[_0x9b43('0x60')](getAgents(_0xa20a1,_0x5e791e));});}});return BPromise[_0x9b43('0x61')](_0x1c0d13)[_0x9b43('0x2a')](function(_0x477b18){_0x445573=_[_0x9b43('0x5b')](_0x445573,_[_0x9b43('0x62')](_0x477b18));_0x2c2103(_0x445573);})[_0x9b43('0x54')](function(_0x2165a1){_0x3984d5(_0x2165a1);});});}function getAgents(_0x19b941,_0x287177){return new BPromise(function(_0x1b8e85,_0x3106b9){return db[_0x19b941][_0x9b43('0x56')]({'where':{'id':_0x287177}})['then'](function(_0x133377){return _0x133377[_0x9b43('0x63')]({'attributes':['id'],'raw':!![]})[_0x9b43('0x2a')](function(_0x25dfee){var _0x38836b=_[_0x9b43('0x64')](_0x25dfee,'id');_0x1b8e85(_0x38836b);});})[_0x9b43('0x54')](function(_0x76e1a7){_0x3106b9(_0x76e1a7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 5089b7e..36f38c1 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 _0xaded=['save','update','emit','hasOwnProperty','hook','exports','events','UserNotification','setMaxListeners'];(function(_0x3a77ff,_0x57414c){var _0x5d0ddd=function(_0x1a61dc){while(--_0x1a61dc){_0x3a77ff['push'](_0x3a77ff['shift']());}};_0x5d0ddd(++_0x57414c);}(_0xaded,0xba));var _0xdade=function(_0x1361cd,_0x1ea995){_0x1361cd=_0x1361cd-0x0;var _0x42e74f=_0xaded[_0x1361cd];return _0x42e74f;};'use strict';var EventEmitter=require(_0xdade('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xdade('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdade('0x2')](0x0);var events={'afterCreate':_0xdade('0x3'),'afterUpdate':_0xdade('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52df29){return function(_0x351d92,_0x2f3402,_0x45e643){UserNotificationEvents[_0xdade('0x5')](_0x52df29+':'+_0x351d92['id'],_0x351d92);UserNotificationEvents[_0xdade('0x5')](_0x52df29,_0x351d92);_0x45e643(null);};}for(var e in events){if(events[_0xdade('0x6')](e)){var event=events[e];UserNotification[_0xdade('0x7')](e,emitEvent(event));}}module[_0xdade('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x0987=['UserNotification','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0987,0x148));var _0x7098=function(_0x39a3e3,_0x2101c3){_0x39a3e3=_0x39a3e3-0x0;var _0x1f3279=_0x0987[_0x39a3e3];return _0x1f3279;};'use strict';var EventEmitter=require(_0x7098('0x0'));var UserNotification=require(_0x7098('0x1'))['db'][_0x7098('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7098('0x3'),'afterUpdate':_0x7098('0x4'),'afterDestroy':_0x7098('0x5')};function emitEvent(_0xa8748c){return function(_0x5ed029,_0xe4778d,_0x5da962){UserNotificationEvents[_0x7098('0x6')](_0xa8748c+':'+_0x5ed029['id'],_0x5ed029);UserNotificationEvents[_0x7098('0x6')](_0xa8748c,_0x5ed029);_0x5da962(null);};}for(var e in events){if(events[_0x7098('0x7')](e)){var event=events[e];UserNotification[_0x7098('0x8')](e,emitEvent(event));}}module[_0x7098('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 60a4a7b..d21f15f 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 _0xe8d7=['utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserNotification'];(function(_0x843a25,_0x4d232b){var _0x381fd0=function(_0x440947){while(--_0x440947){_0x843a25['push'](_0x843a25['shift']());}};_0x381fd0(++_0x4d232b);}(_0xe8d7,0x1a3));var _0x7e8d=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0xe8d7[_0x937379];return _0x465709;};'use strict';var _=require('lodash');var util=require(_0x7e8d('0x0'));var logger=require('../../config/logger')(_0x7e8d('0x1'));var moment=require(_0x7e8d('0x2'));var BPromise=require(_0x7e8d('0x3'));var rp=require(_0x7e8d('0x4'));var fs=require('fs');var path=require(_0x7e8d('0x5'));var rimraf=require(_0x7e8d('0x6'));var config=require(_0x7e8d('0x7'));var attributes=require('./userNotification.attributes');module[_0x7e8d('0x8')]=function(_0x1c9a07,_0x28746e){return _0x1c9a07['define'](_0x7e8d('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e8d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9da6=['request-promise','rimraf','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3c8fc8,_0x2ac61b){var _0xf1066d=function(_0x1aa286){while(--_0x1aa286){_0x3c8fc8['push'](_0x3c8fc8['shift']());}};_0xf1066d(++_0x2ac61b);}(_0x9da6,0xff));var _0x69da=function(_0x3ae6a8,_0xdc06de){_0x3ae6a8=_0x3ae6a8-0x0;var _0x289295=_0x9da6[_0x3ae6a8];return _0x289295;};'use strict';var _=require(_0x69da('0x0'));var util=require(_0x69da('0x1'));var logger=require(_0x69da('0x2'))('api');var moment=require(_0x69da('0x3'));var BPromise=require(_0x69da('0x4'));var rp=require(_0x69da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69da('0x6'));var config=require('../../config/environment');var attributes=require(_0x69da('0x7'));module[_0x69da('0x8')]=function(_0xd1cf0d,_0x2ff4e0){return _0xd1cf0d['define'](_0x69da('0x9'),attributes,{'tableName':_0x69da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x69da('0xb'),'collate':_0x69da('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d1dbb1b..fe0a40a 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 _0x6e72=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x23cf7b,_0x1261be){var _0x1d019b=function(_0x4d165f){while(--_0x4d165f){_0x23cf7b['push'](_0x23cf7b['shift']());}};_0x1d019b(++_0x1261be);}(_0x6e72,0xee));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x26e7('0x0'));var util=require(_0x26e7('0x1'));var moment=require(_0x26e7('0x2'));var BPromise=require(_0x26e7('0x3'));var rs=require(_0x26e7('0x4'));var fs=require('fs');var Redis=require(_0x26e7('0x5'));var db=require(_0x26e7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26e7('0x7'))(_0x26e7('0x8'));var config=require(_0x26e7('0x9'));var jayson=require(_0x26e7('0xa'));var client=jayson[_0x26e7('0xb')][_0x26e7('0xc')]({'port':0x232a});config['redis']=_[_0x26e7('0xd')](config[_0x26e7('0xe')],{'host':_0x26e7('0xf'),'port':0x18eb});var socket=require(_0x26e7('0x10'))(new Redis(config['redis']));require('./userNotification.socket')[_0x26e7('0x11')](socket);function respondWithRpcPromise(_0x56df1f,_0x9efc35,_0x47f159){return new BPromise(function(_0x27001f,_0xd55678){return client['request'](_0x56df1f,_0x47f159)[_0x26e7('0x12')](function(_0xecd802){logger['info'](_0x26e7('0x13'),_0x9efc35,'request\x20sent');logger[_0x26e7('0x14')](_0x26e7('0x15'),_0x9efc35,_0x26e7('0x16'),JSON[_0x26e7('0x17')](_0xecd802));if(_0xecd802[_0x26e7('0x18')]){if(_0xecd802[_0x26e7('0x18')]['code']===0x1f4){logger['error'](_0x26e7('0x13'),_0x9efc35,_0xecd802[_0x26e7('0x18')]['message']);return _0xd55678(_0xecd802[_0x26e7('0x18')]['message']);}logger['error'](_0x26e7('0x13'),_0x9efc35,_0xecd802['error'][_0x26e7('0x19')]);return _0x27001f(_0xecd802[_0x26e7('0x18')][_0x26e7('0x19')]);}else{logger['info'](_0x26e7('0x13'),_0x9efc35,_0x26e7('0x16'));_0x27001f(_0xecd802[_0x26e7('0x1a')]['message']);}})['catch'](function(_0x42e4ad){logger['error'](_0x26e7('0x13'),_0x9efc35,_0x42e4ad);_0xd55678(_0x42e4ad);});});} \ No newline at end of file +var _0x6e4f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x6e4f,0xa8));var _0xf6e4=function(_0xe8a016,_0x3ec96c){_0xe8a016=_0xe8a016-0x0;var _0x403161=_0x6e4f[_0xe8a016];return _0x403161;};'use strict';var _=require(_0xf6e4('0x0'));var util=require(_0xf6e4('0x1'));var moment=require(_0xf6e4('0x2'));var BPromise=require(_0xf6e4('0x3'));var rs=require(_0xf6e4('0x4'));var fs=require('fs');var Redis=require(_0xf6e4('0x5'));var db=require(_0xf6e4('0x6'))['db'];var utils=require(_0xf6e4('0x7'));var logger=require(_0xf6e4('0x8'))(_0xf6e4('0x9'));var config=require(_0xf6e4('0xa'));var jayson=require(_0xf6e4('0xb'));var client=jayson['client'][_0xf6e4('0xc')]({'port':0x232a});config[_0xf6e4('0xd')]=_[_0xf6e4('0xe')](config[_0xf6e4('0xd')],{'host':_0xf6e4('0xf'),'port':0x18eb});var socket=require(_0xf6e4('0x10'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x2951ca,_0x50559b,_0x1429d0){return new BPromise(function(_0x2c732c,_0x25ed51){return client[_0xf6e4('0x11')](_0x2951ca,_0x1429d0)[_0xf6e4('0x12')](function(_0x1718ea){logger[_0xf6e4('0x13')](_0xf6e4('0x14'),_0x50559b,_0xf6e4('0x15'));logger[_0xf6e4('0x16')](_0xf6e4('0x17'),_0x50559b,_0xf6e4('0x15'),JSON[_0xf6e4('0x18')](_0x1718ea));if(_0x1718ea[_0xf6e4('0x19')]){if(_0x1718ea['error'][_0xf6e4('0x1a')]===0x1f4){logger['error'](_0xf6e4('0x14'),_0x50559b,_0x1718ea[_0xf6e4('0x19')][_0xf6e4('0x1b')]);return _0x25ed51(_0x1718ea[_0xf6e4('0x19')][_0xf6e4('0x1b')]);}logger[_0xf6e4('0x19')](_0xf6e4('0x14'),_0x50559b,_0x1718ea[_0xf6e4('0x19')][_0xf6e4('0x1b')]);return _0x2c732c(_0x1718ea[_0xf6e4('0x19')][_0xf6e4('0x1b')]);}else{logger[_0xf6e4('0x13')](_0xf6e4('0x14'),_0x50559b,'request\x20sent');_0x2c732c(_0x1718ea[_0xf6e4('0x1c')]['message']);}})['catch'](function(_0x2a570f){logger['error'](_0xf6e4('0x14'),_0x50559b,_0x2a570f);_0x25ed51(_0x2a570f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 829b911..41baa2e 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 _0x27a0=['length','userNotification:','save','remove','update','removeListener','register'];(function(_0x56117a,_0x254d09){var _0x345051=function(_0x269f71){while(--_0x269f71){_0x56117a['push'](_0x56117a['shift']());}};_0x345051(++_0x254d09);}(_0x27a0,0xbf));var _0x027a=function(_0x26d7fc,_0x5dce7a){_0x26d7fc=_0x26d7fc-0x0;var _0x22a8e9=_0x27a0[_0x26d7fc];return _0x22a8e9;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x027a('0x0'),_0x027a('0x1'),_0x027a('0x2')];function createListener(_0x352dd7,_0x32e5e0){return function(_0x59cd58){_0x32e5e0['emit'](_0x352dd7,_0x59cd58);};}function removeListener(_0x4e8d6b,_0x47cd65){return function(){UserNotificationEvents[_0x027a('0x3')](_0x4e8d6b,_0x47cd65);};}exports[_0x027a('0x4')]=function(_0x137b09){for(var _0x639bec=0x0,_0xe233ed=events[_0x027a('0x5')];_0x639bec<_0xe233ed;_0x639bec++){var _0x550fbb=events[_0x639bec];var _0x3d1429=createListener(_0x027a('0x6')+_0x550fbb,_0x137b09);UserNotificationEvents['on'](_0x550fbb,_0x3d1429);}}; \ No newline at end of file +var _0xbc6e=['length','userNotification:','./userNotification.events','remove','update','emit','register'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0xbc6e,0x175));var _0xebc6=function(_0xbe41f2,_0x3a0c78){_0xbe41f2=_0xbe41f2-0x0;var _0x4d871d=_0xbc6e[_0xbe41f2];return _0x4d871d;};'use strict';var UserNotificationEvents=require(_0xebc6('0x0'));var events=['save',_0xebc6('0x1'),_0xebc6('0x2')];function createListener(_0x4604d8,_0x398609){return function(_0x1e41af){_0x398609[_0xebc6('0x3')](_0x4604d8,_0x1e41af);};}function removeListener(_0x46d0a7,_0x1b2fd7){return function(){UserNotificationEvents['removeListener'](_0x46d0a7,_0x1b2fd7);};}exports[_0xebc6('0x4')]=function(_0x8e1207){for(var _0x35106e=0x0,_0x5e7564=events[_0xebc6('0x5')];_0x35106e<_0x5e7564;_0x35106e++){var _0x28a0ca=events[_0x35106e];var _0x1c2291=createListener(_0xebc6('0x6')+_0x28a0ca,_0x8e1207);UserNotificationEvents['on'](_0x28a0ca,_0x1c2291);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e0f8ba0..ec6267b 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53468a,_0x286986){var _0x205efd=function(_0x5eb1e9){while(--_0x5eb1e9){_0x53468a['push'](_0x53468a['shift']());}};_0x205efd(++_0x286986);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5ccada,_0x454f77){var _0x3071e7=function(_0x10689f){while(--_0x10689f){_0x5ccada['push'](_0x5ccada['shift']());}};_0x3071e7(++_0x454f77);}(_0x70e0,0x17b));var _0x070e=function(_0x3dfeef,_0x12c7a3){_0x3dfeef=_0x3dfeef-0x0;var _0xfd117f=_0x70e0[_0x3dfeef];return _0xfd117f;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d9245f5..e2499e1 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 _0xdb73=['sequelize','exports','INTEGER'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdb73,0xe7));var _0x3db7=function(_0x313ce8,_0x2fbd20){_0x313ce8=_0x313ce8-0x0;var _0x4264bb=_0xdb73[_0x313ce8];return _0x4264bb;};'use strict';var Sequelize=require(_0x3db7('0x0'));module[_0x3db7('0x1')]={'penalty':{'type':Sequelize[_0x3db7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x444c=['INTEGER','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x444c,0x93));var _0xc444=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x444c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc444('0x0')]={'penalty':{'type':Sequelize[_0xc444('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 5cd3fd5..9d060e8 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 _0x910b=['exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','./userOpenchannelQueue.attributes'];(function(_0x873c3,_0x145db1){var _0x397146=function(_0x5577d6){while(--_0x5577d6){_0x873c3['push'](_0x873c3['shift']());}};_0x397146(++_0x145db1);}(_0x910b,0x1bd));var _0xb910=function(_0x1d6a94,_0x17749b){_0x1d6a94=_0x1d6a94-0x0;var _0x2ec3a7=_0x910b[_0x1d6a94];return _0x2ec3a7;};'use strict';var _=require(_0xb910('0x0'));var util=require(_0xb910('0x1'));var logger=require('../../config/logger')(_0xb910('0x2'));var moment=require(_0xb910('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb910('0x4'));module[_0xb910('0x5')]=function(_0x1a7b66,_0x4586ca){return _0x1a7b66[_0xb910('0x6')](_0xb910('0x7'),attributes,{'tableName':_0xb910('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa26c=['bluebird','request-promise','rimraf','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment'];(function(_0x14c358,_0x522070){var _0x33b11d=function(_0x41f14b){while(--_0x41f14b){_0x14c358['push'](_0x14c358['shift']());}};_0x33b11d(++_0x522070);}(_0xa26c,0x16e));var _0xca26=function(_0x5636da,_0x5e8cc5){_0x5636da=_0x5636da-0x0;var _0x5c1d48=_0xa26c[_0x5636da];return _0x5c1d48;};'use strict';var _=require('lodash');var util=require(_0xca26('0x0'));var logger=require(_0xca26('0x1'))(_0xca26('0x2'));var moment=require(_0xca26('0x3'));var BPromise=require(_0xca26('0x4'));var rp=require(_0xca26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca26('0x6'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xca26('0x7')]=function(_0x3e094d,_0x451ad3){return _0x3e094d['define'](_0xca26('0x8'),attributes,{'tableName':_0xca26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 6b70d99..c8cac83 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 _0x397b=['error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x412640,_0x2a6a10){var _0x4655c0=function(_0x54709e){while(--_0x54709e){_0x412640['push'](_0x412640['shift']());}};_0x4655c0(++_0x2a6a10);}(_0x397b,0xeb));var _0xb397=function(_0x49cd6d,_0x17b499){_0x49cd6d=_0x49cd6d-0x0;var _0x9ce5b3=_0x397b[_0x49cd6d];return _0x9ce5b3;};'use strict';var _=require(_0xb397('0x0'));var util=require(_0xb397('0x1'));var moment=require(_0xb397('0x2'));var BPromise=require(_0xb397('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb397('0x4'))['db'];var utils=require(_0xb397('0x5'));var logger=require(_0xb397('0x6'))(_0xb397('0x7'));var config=require(_0xb397('0x8'));var jayson=require(_0xb397('0x9'));var client=jayson[_0xb397('0xa')][_0xb397('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fef5d,_0x59fc91,_0x4f20b8){return new BPromise(function(_0x320eee,_0x32a6af){return client['request'](_0x2fef5d,_0x4f20b8)['then'](function(_0x216500){logger[_0xb397('0xc')](_0xb397('0xd'),_0x59fc91,'request\x20sent');logger['debug'](_0xb397('0xe'),_0x59fc91,_0xb397('0xf'),JSON[_0xb397('0x10')](_0x216500));if(_0x216500[_0xb397('0x11')]){if(_0x216500[_0xb397('0x11')]['code']===0x1f4){logger['error'](_0xb397('0xd'),_0x59fc91,_0x216500[_0xb397('0x11')]['message']);return _0x32a6af(_0x216500[_0xb397('0x11')][_0xb397('0x12')]);}logger['error'](_0xb397('0xd'),_0x59fc91,_0x216500[_0xb397('0x11')][_0xb397('0x12')]);return _0x320eee(_0x216500[_0xb397('0x11')][_0xb397('0x12')]);}else{logger[_0xb397('0xc')](_0xb397('0xd'),_0x59fc91,_0xb397('0xf'));_0x320eee(_0x216500[_0xb397('0x13')][_0xb397('0x12')]);}})[_0xb397('0x14')](function(_0x53f49e){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x59fc91,_0x53f49e);_0x32a6af(_0x53f49e);});});} \ No newline at end of file +var _0x22de=['../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22de,0x148));var _0xe22d=function(_0x57dffe,_0x6befe2){_0x57dffe=_0x57dffe-0x0;var _0x3ad11b=_0x22de[_0x57dffe];return _0x3ad11b;};'use strict';var _=require(_0xe22d('0x0'));var util=require('util');var moment=require(_0xe22d('0x1'));var BPromise=require(_0xe22d('0x2'));var rs=require(_0xe22d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe22d('0x4'))['db'];var utils=require(_0xe22d('0x5'));var logger=require(_0xe22d('0x6'))(_0xe22d('0x7'));var config=require(_0xe22d('0x8'));var jayson=require(_0xe22d('0x9'));var client=jayson['client'][_0xe22d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x257565,_0x119f72,_0x52fc22){return new BPromise(function(_0x1de13e,_0x65db32){return client[_0xe22d('0xb')](_0x257565,_0x52fc22)[_0xe22d('0xc')](function(_0x14a8d){logger[_0xe22d('0xd')](_0xe22d('0xe'),_0x119f72,'request\x20sent');logger['debug'](_0xe22d('0xf'),_0x119f72,_0xe22d('0x10'),JSON[_0xe22d('0x11')](_0x14a8d));if(_0x14a8d['error']){if(_0x14a8d[_0xe22d('0x12')]['code']===0x1f4){logger[_0xe22d('0x12')](_0xe22d('0xe'),_0x119f72,_0x14a8d['error']['message']);return _0x65db32(_0x14a8d['error'][_0xe22d('0x13')]);}logger[_0xe22d('0x12')](_0xe22d('0xe'),_0x119f72,_0x14a8d[_0xe22d('0x12')][_0xe22d('0x13')]);return _0x1de13e(_0x14a8d['error'][_0xe22d('0x13')]);}else{logger[_0xe22d('0xd')](_0xe22d('0xe'),_0x119f72,_0xe22d('0x10'));_0x1de13e(_0x14a8d['result'][_0xe22d('0x13')]);}})[_0xe22d('0x14')](function(_0x2d30ce){logger[_0xe22d('0x12')](_0xe22d('0xe'),_0x119f72,_0x2d30ce);_0x65db32(_0x2d30ce);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e1f8b8d..5e0760f 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 _0x54df=['removeSections','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','getResources','post','create','addSections','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54df,0x154));var _0xf54d=function(_0x1ce3ee,_0x5ae1b2){_0x1ce3ee=_0x1ce3ee-0x0;var _0x288eb9=_0x54df[_0x1ce3ee];return _0x288eb9;};'use strict';var multer=require(_0xf54d('0x0'));var util=require(_0xf54d('0x1'));var path=require(_0xf54d('0x2'));var timeout=require(_0xf54d('0x3'));var express=require(_0xf54d('0x4'));var router=express['Router']();var fs_extra=require(_0xf54d('0x5'));var auth=require(_0xf54d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf54d('0x7'));var controller=require(_0xf54d('0x8'));router[_0xf54d('0x9')]('/',auth[_0xf54d('0xa')](),controller[_0xf54d('0xb')]);router[_0xf54d('0x9')](_0xf54d('0xc'),auth[_0xf54d('0xa')](),controller[_0xf54d('0xd')]);router[_0xf54d('0x9')](_0xf54d('0xe'),auth[_0xf54d('0xa')](),controller['show']);router['get'](_0xf54d('0xf'),auth[_0xf54d('0xa')](),controller[_0xf54d('0x10')]);router[_0xf54d('0x9')]('/:id/resources',auth['isAuthenticated'](),controller[_0xf54d('0x11')]);router[_0xf54d('0x12')]('/',auth['isAuthenticated'](),controller[_0xf54d('0x13')]);router[_0xf54d('0x12')]('/:id/clone',auth[_0xf54d('0xa')](),controller['clone']);router[_0xf54d('0x12')](_0xf54d('0xf'),auth[_0xf54d('0xa')](),controller[_0xf54d('0x14')]);router['post']('/:id/resources',auth[_0xf54d('0xa')](),controller['addResources']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf54d('0x15')]);router[_0xf54d('0x16')](_0xf54d('0xe'),auth[_0xf54d('0xa')](),controller[_0xf54d('0x17')]);router[_0xf54d('0x16')]('/:id/sections',auth['isAuthenticated'](),controller[_0xf54d('0x18')]);router[_0xf54d('0x16')](_0xf54d('0x19'),auth[_0xf54d('0xa')](),controller[_0xf54d('0x1a')]);module[_0xf54d('0x1b')]=router; \ No newline at end of file +var _0x0e64=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports'];(function(_0x260f63,_0x469a17){var _0xe05ebe=function(_0x3845a5){while(--_0x3845a5){_0x260f63['push'](_0x260f63['shift']());}};_0xe05ebe(++_0x469a17);}(_0x0e64,0x1c2));var _0x40e6=function(_0x32ea34,_0x556f9d){_0x32ea34=_0x32ea34-0x0;var _0x46a751=_0x0e64[_0x32ea34];return _0x46a751;};'use strict';var multer=require(_0x40e6('0x0'));var util=require(_0x40e6('0x1'));var path=require(_0x40e6('0x2'));var timeout=require(_0x40e6('0x3'));var express=require(_0x40e6('0x4'));var router=express[_0x40e6('0x5')]();var fs_extra=require(_0x40e6('0x6'));var auth=require(_0x40e6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x40e6('0x8'));var controller=require(_0x40e6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x40e6('0xa')]);router[_0x40e6('0xb')](_0x40e6('0xc'),auth['isAuthenticated'](),controller[_0x40e6('0xd')]);router[_0x40e6('0xb')](_0x40e6('0xe'),auth[_0x40e6('0xf')](),controller[_0x40e6('0x10')]);router[_0x40e6('0xb')](_0x40e6('0x11'),auth['isAuthenticated'](),controller['getSections']);router[_0x40e6('0xb')](_0x40e6('0x12'),auth[_0x40e6('0xf')](),controller[_0x40e6('0x13')]);router[_0x40e6('0x14')]('/',auth[_0x40e6('0xf')](),controller[_0x40e6('0x15')]);router['post'](_0x40e6('0x16'),auth[_0x40e6('0xf')](),controller['clone']);router['post'](_0x40e6('0x11'),auth[_0x40e6('0xf')](),controller[_0x40e6('0x17')]);router[_0x40e6('0x14')](_0x40e6('0x12'),auth[_0x40e6('0xf')](),controller[_0x40e6('0x18')]);router['put'](_0x40e6('0xe'),auth[_0x40e6('0xf')](),controller['update']);router[_0x40e6('0x19')](_0x40e6('0xe'),auth['isAuthenticated'](),controller[_0x40e6('0x1a')]);router[_0x40e6('0x19')](_0x40e6('0x11'),auth[_0x40e6('0xf')](),controller[_0x40e6('0x1b')]);router[_0x40e6('0x19')]('/:id/resources',auth['isAuthenticated'](),controller[_0x40e6('0x1c')]);module[_0x40e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7470884..f2115b5 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 _0x346e=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x5bda61,_0x6569aa){var _0x30b4e5=function(_0x10afd7){while(--_0x10afd7){_0x5bda61['push'](_0x5bda61['shift']());}};_0x30b4e5(++_0x6569aa);}(_0x346e,0x93));var _0xe346=function(_0x315816,_0x4d4212){_0x315816=_0x315816-0x0;var _0x30c81c=_0x346e[_0x315816];return _0x30c81c;};'use strict';var Sequelize=require(_0xe346('0x0'));module[_0xe346('0x1')]={'name':{'type':Sequelize[_0xe346('0x2')],'allowNull':![],'unique':_0xe346('0x3')},'crudPermissions':{'type':Sequelize[_0xe346('0x2')],'set':function(_0x3bcc6e){this[_0xe346('0x4')](_0xe346('0x5'),_0x3bcc6e?_0x3bcc6e[_0xe346('0x6')](''):[]);},'get':function(){return this[_0xe346('0x7')]('crudPermissions')?this[_0xe346('0x7')](_0xe346('0x5'))[_0xe346('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe346('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe346('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe346('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x76f3=['split','STRING','BOOLEAN','sequelize','exports','setDataValue','crudPermissions','join','getDataValue'];(function(_0x518e48,_0x2e5dc6){var _0x5d2de4=function(_0x42516a){while(--_0x42516a){_0x518e48['push'](_0x518e48['shift']());}};_0x5d2de4(++_0x2e5dc6);}(_0x76f3,0x78));var _0x376f=function(_0x5e3fc8,_0x53b3a7){_0x5e3fc8=_0x5e3fc8-0x0;var _0x39c8d0=_0x76f3[_0x5e3fc8];return _0x39c8d0;};'use strict';var Sequelize=require(_0x376f('0x0'));module[_0x376f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4eadfe){this[_0x376f('0x2')](_0x376f('0x3'),_0x4eadfe?_0x4eadfe[_0x376f('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x376f('0x5')](_0x376f('0x3'))[_0x376f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x376f('0x7')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x376f('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x376f('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x376f('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x376f('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x376f('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x376f('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 be5e921..aed3330 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 _0xef45=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','UserProfile','includeAll','findAll','show','params','include','find','catch','create','body','clone','updatedAt','crudPermissions','omit','createdAt','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','destroy','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef45,0x127));var _0x5ef4=function(_0x538042,_0x492676){_0x538042=_0x538042-0x0;var _0x1d0e5d=_0xef45[_0x538042];return _0x1d0e5d;};'use strict';var emlformat=require(_0x5ef4('0x0'));var rimraf=require(_0x5ef4('0x1'));var zipdir=require(_0x5ef4('0x2'));var jsonpatch=require(_0x5ef4('0x3'));var rp=require(_0x5ef4('0x4'));var moment=require(_0x5ef4('0x5'));var BPromise=require(_0x5ef4('0x6'));var Mustache=require(_0x5ef4('0x7'));var util=require(_0x5ef4('0x8'));var path=require(_0x5ef4('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5ef4('0xa'));var fs=require('fs');var fs_extra=require(_0x5ef4('0xb'));var _=require(_0x5ef4('0xc'));var squel=require(_0x5ef4('0xd'));var crypto=require(_0x5ef4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ef4('0xf'));var querystring=require(_0x5ef4('0x10'));var Papa=require(_0x5ef4('0x11'));var Redis=require(_0x5ef4('0x12'));var authService=require(_0x5ef4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ef4('0x14'));var logger=require(_0x5ef4('0x15'))(_0x5ef4('0x16'));var utils=require(_0x5ef4('0x17'));var config=require(_0x5ef4('0x18'));var licenseUtil=require(_0x5ef4('0x19'));var db=require(_0x5ef4('0x1a'))['db'];config[_0x5ef4('0x1b')]=_[_0x5ef4('0x1c')](config[_0x5ef4('0x1b')],{'host':_0x5ef4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ef4('0x1b')]));require(_0x5ef4('0x1e'))['register'](socket);function respondWithStatusCode(_0x36cc65,_0x3f383f){_0x3f383f=_0x3f383f||0xcc;return function(_0x484066){if(_0x484066){return _0x36cc65[_0x5ef4('0x1f')](_0x3f383f);}return _0x36cc65[_0x5ef4('0x20')](_0x3f383f)[_0x5ef4('0x21')]();};}function respondWithResult(_0x413a07,_0x5276c8){_0x5276c8=_0x5276c8||0xc8;return function(_0x10fb3a){if(_0x10fb3a){return _0x413a07['status'](_0x5276c8)['json'](_0x10fb3a);}};}function respondWithFilteredResult(_0x28da10,_0x497733){return function(_0x477c04){if(_0x477c04){var _0x39c2d8=typeof _0x497733[_0x5ef4('0x22')]===_0x5ef4('0x23')&&typeof _0x497733[_0x5ef4('0x24')]===_0x5ef4('0x23');var _0x26cbdf=_0x477c04['count'];var _0x13e34f=_0x39c2d8?0x0:_0x497733[_0x5ef4('0x22')];var _0x372376=_0x39c2d8?_0x477c04[_0x5ef4('0x25')]:_0x497733[_0x5ef4('0x22')]+_0x497733[_0x5ef4('0x24')];var _0x46ea0b;if(_0x372376>=_0x26cbdf){_0x372376=_0x26cbdf;_0x46ea0b=0xc8;}else{_0x46ea0b=0xce;}_0x28da10[_0x5ef4('0x20')](_0x46ea0b);return _0x28da10[_0x5ef4('0x26')](_0x5ef4('0x27'),_0x13e34f+'-'+_0x372376+'/'+_0x26cbdf)[_0x5ef4('0x28')](_0x477c04);}return null;};}function patchUpdates(_0x53335d){return function(_0x5c9d00){try{jsonpatch[_0x5ef4('0x29')](_0x5c9d00,_0x53335d,!![]);}catch(_0x446fbb){return BPromise[_0x5ef4('0x2a')](_0x446fbb);}return _0x5c9d00[_0x5ef4('0x2b')]();};}function saveUpdates(_0x39114a,_0x8cb5d0){return function(_0x26a08f){if(_0x26a08f){return _0x26a08f[_0x5ef4('0x2c')](_0x39114a)[_0x5ef4('0x2d')](function(_0x7b3b62){return _0x7b3b62;});}return null;};}function removeEntity(_0x90b2e6,_0x365184){return function(_0x44f473){if(_0x44f473){return _0x44f473['destroy']()[_0x5ef4('0x2d')](function(){_0x90b2e6[_0x5ef4('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf6fe,_0x362cb1){return function(_0x1438a9){if(!_0x1438a9){_0x1cf6fe[_0x5ef4('0x1f')](0x194);}return _0x1438a9;};}function handleError(_0x1d1d7c,_0x519e18){_0x519e18=_0x519e18||0x1f4;return function(_0x404dff){logger[_0x5ef4('0x2e')](_0x404dff['stack']);if(_0x404dff[_0x5ef4('0x2f')]){delete _0x404dff[_0x5ef4('0x2f')];}_0x1d1d7c['status'](_0x519e18)[_0x5ef4('0x30')](_0x404dff);};}exports[_0x5ef4('0x31')]=function(_0x4e935d,_0x434363){var _0x56afdb={},_0x292f29={},_0x2c3fa1={'count':0x0,'rows':[]};var _0x35db53=_[_0x5ef4('0x32')](db['UserProfile'][_0x5ef4('0x33')],function(_0x26c798){return{'name':_0x26c798[_0x5ef4('0x34')],'type':_0x26c798[_0x5ef4('0x35')][_0x5ef4('0x36')]};});_0x292f29[_0x5ef4('0x37')]=_['map'](_0x35db53,_0x5ef4('0x2f'));_0x292f29[_0x5ef4('0x38')]=_[_0x5ef4('0x39')](_0x4e935d[_0x5ef4('0x38')]);_0x292f29[_0x5ef4('0x3a')]=_[_0x5ef4('0x3b')](_0x292f29[_0x5ef4('0x37')],_0x292f29[_0x5ef4('0x38')]);_0x56afdb['attributes']=_[_0x5ef4('0x3b')](_0x292f29[_0x5ef4('0x37')],qs[_0x5ef4('0x3c')](_0x4e935d[_0x5ef4('0x38')]['fields']));_0x56afdb[_0x5ef4('0x3d')]=_0x56afdb[_0x5ef4('0x3d')][_0x5ef4('0x3e')]?_0x56afdb[_0x5ef4('0x3d')]:_0x292f29['model'];if(!_0x4e935d['query'][_0x5ef4('0x3f')](_0x5ef4('0x40'))){_0x56afdb[_0x5ef4('0x24')]=qs['limit'](_0x4e935d['query'][_0x5ef4('0x24')]);_0x56afdb[_0x5ef4('0x22')]=qs['offset'](_0x4e935d[_0x5ef4('0x38')][_0x5ef4('0x22')]);}_0x56afdb[_0x5ef4('0x41')]=qs['sort'](_0x4e935d[_0x5ef4('0x38')][_0x5ef4('0x42')]);_0x56afdb[_0x5ef4('0x43')]=qs['filters'](_[_0x5ef4('0x44')](_0x4e935d['query'],_0x292f29[_0x5ef4('0x3a')]),_0x35db53);if(_0x4e935d['query'][_0x5ef4('0x45')]){_0x56afdb[_0x5ef4('0x43')]=_[_0x5ef4('0x46')](_0x56afdb[_0x5ef4('0x43')],{'$or':_[_0x5ef4('0x32')](_0x35db53,function(_0xee4a98){if(_0xee4a98[_0x5ef4('0x35')]!=='VIRTUAL'){var _0x163ef2={};_0x163ef2[_0xee4a98['name']]={'$like':'%'+_0x4e935d[_0x5ef4('0x38')][_0x5ef4('0x45')]+'%'};return _0x163ef2;}})});}_0x56afdb=_[_0x5ef4('0x46')]({},_0x56afdb,_0x4e935d[_0x5ef4('0x47')]);var _0x30a6ed={'where':_0x56afdb[_0x5ef4('0x43')]};return db[_0x5ef4('0x48')][_0x5ef4('0x25')](_0x30a6ed)[_0x5ef4('0x2d')](function(_0x26c4d6){_0x2c3fa1[_0x5ef4('0x25')]=_0x26c4d6;if(_0x4e935d[_0x5ef4('0x38')][_0x5ef4('0x49')]){_0x56afdb['include']=[{'all':!![]}];}return db[_0x5ef4('0x48')][_0x5ef4('0x4a')](_0x56afdb);})[_0x5ef4('0x2d')](function(_0x5b9891){_0x2c3fa1['rows']=_0x5b9891;return _0x2c3fa1;})['then'](respondWithFilteredResult(_0x434363,_0x56afdb))['catch'](handleError(_0x434363,null));};exports[_0x5ef4('0x4b')]=function(_0x10d9b6,_0x2daa66){var _0x2eaa90={'raw':![],'where':{'id':_0x10d9b6[_0x5ef4('0x4c')]['id']}},_0x497de1={};_0x497de1[_0x5ef4('0x37')]=_[_0x5ef4('0x39')](db['UserProfile'][_0x5ef4('0x33')]);_0x497de1['query']=_['keys'](_0x10d9b6[_0x5ef4('0x38')]);_0x497de1['filters']=_[_0x5ef4('0x3b')](_0x497de1[_0x5ef4('0x37')],_0x497de1['query']);_0x2eaa90[_0x5ef4('0x3d')]=_[_0x5ef4('0x3b')](_0x497de1[_0x5ef4('0x37')],qs[_0x5ef4('0x3c')](_0x10d9b6[_0x5ef4('0x38')][_0x5ef4('0x3c')]));_0x2eaa90[_0x5ef4('0x3d')]=_0x2eaa90[_0x5ef4('0x3d')][_0x5ef4('0x3e')]?_0x2eaa90[_0x5ef4('0x3d')]:_0x497de1[_0x5ef4('0x37')];if(_0x10d9b6['query'][_0x5ef4('0x49')]){_0x2eaa90[_0x5ef4('0x4d')]=[{'all':!![]}];}_0x2eaa90=_[_0x5ef4('0x46')]({},_0x2eaa90,_0x10d9b6['options']);return db[_0x5ef4('0x48')][_0x5ef4('0x4e')](_0x2eaa90)['then'](handleEntityNotFound(_0x2daa66,null))['then'](respondWithResult(_0x2daa66,null))[_0x5ef4('0x4f')](handleError(_0x2daa66,null));};exports[_0x5ef4('0x50')]=function(_0x398a67,_0x3c0da5){return db[_0x5ef4('0x48')][_0x5ef4('0x50')](_0x398a67[_0x5ef4('0x51')],{})[_0x5ef4('0x2d')](respondWithResult(_0x3c0da5,0xc9))[_0x5ef4('0x4f')](handleError(_0x3c0da5,null));};exports[_0x5ef4('0x52')]=function(_0x325664,_0x6d0245){var _0x12a14e={'where':{'id':_0x325664['params']['id']}},_0xbbaa12={};_0xbbaa12['model']=_[_0x5ef4('0x39')](db[_0x5ef4('0x48')][_0x5ef4('0x33')]);_0x12a14e[_0x5ef4('0x3d')]=_[_0x5ef4('0x3b')](_0xbbaa12['model'],qs[_0x5ef4('0x3c')](_0x325664[_0x5ef4('0x38')][_0x5ef4('0x3c')]));_0x12a14e[_0x5ef4('0x3d')]=_0x12a14e[_0x5ef4('0x3d')][_0x5ef4('0x3e')]?_0x12a14e['attributes']:_0xbbaa12['model'];if(_0x325664[_0x5ef4('0x38')][_0x5ef4('0x49')]){_0x12a14e[_0x5ef4('0x4d')]=[{'all':!![]}];}_0x12a14e=_['merge']({},_0x12a14e,_0x325664['options']);return db[_0x5ef4('0x48')][_0x5ef4('0x4e')](_0x12a14e)[_0x5ef4('0x2d')](handleEntityNotFound(_0x6d0245,null))[_0x5ef4('0x2d')](function(_0x1f5b9a){if(_0x1f5b9a){var _0x2ad57c=_0x1f5b9a['get']({'plain':!![]});_0x2ad57c=qs['omit'](_0x2ad57c,['id','createdAt',_0x5ef4('0x53'),_0x5ef4('0x54')]);_0x325664['body']=_[_0x5ef4('0x55')](_0x325664['body'],['id',_0x5ef4('0x56'),_0x5ef4('0x53')]);return db[_0x5ef4('0x57')][_0x5ef4('0x58')](function(_0x4c779b){return db[_0x5ef4('0x48')]['create'](_[_0x5ef4('0x46')](_0x2ad57c,_0x325664[_0x5ef4('0x51')]),{'include':_0x325664[_0x5ef4('0x38')][_0x5ef4('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x4c779b})['then'](function(_0x5d45fa){var _0x424292=_0x5d45fa[_0x5ef4('0x59')]({'plain':!![]});return db[_0x5ef4('0x5a')][_0x5ef4('0x4a')]({'where':{'userProfileId':_0x325664[_0x5ef4('0x4c')]['id']},'raw':!![]})[_0x5ef4('0x2d')](function(_0x3a3d2d){if(_0x3a3d2d){return BPromise['each'](_0x3a3d2d,function(_0x1f9d62){return new BPromise(function(_0x40be88,_0x207796){if(_0x1f9d62[_0x5ef4('0x5b')]===null||_0x1f9d62[_0x5ef4('0x5b')]===0x1)_0x40be88(null);return db[_0x5ef4('0x5c')][_0x5ef4('0x4a')]({'where':{'sectionId':_0x1f9d62['id']},'raw':!![]})[_0x5ef4('0x2d')](function(_0x20d974){var _0x44d7bb=_[_0x5ef4('0x32')](_0x20d974,function(_0x52be0c){return qs[_0x5ef4('0x55')](_0x52be0c,['id',_0x5ef4('0x56'),_0x5ef4('0x53'),_0x5ef4('0x5d')]);});_0x40be88(_0x44d7bb);})['catch'](function(_0x4660c1){_0x207796(_0x4660c1);});})[_0x5ef4('0x2d')](function(_0x3dfd88){var _0x4e085a=qs[_0x5ef4('0x55')](_0x1f9d62,['id','createdAt',_0x5ef4('0x53')]);_0x4e085a[_0x5ef4('0x5e')]=_0x424292['id'];if(_0x3dfd88)_0x4e085a[_0x5ef4('0x5f')]=_0x3dfd88;return _0x4e085a;})[_0x5ef4('0x2d')](function(_0x379479){return db[_0x5ef4('0x5a')]['create'](_0x379479,{'include':[{'model':db['UserProfileResource'],'as':_0x5ef4('0x5f')}],'raw':!![],'transaction':_0x4c779b});});})[_0x5ef4('0x2d')](function(){return _0x424292;});}});});});}})[_0x5ef4('0x2d')](respondWithResult(_0x6d0245,0xc9))['catch'](handleError(_0x6d0245,null));};exports[_0x5ef4('0x2c')]=function(_0x11eb68,_0xe91a1b){if(_0x11eb68[_0x5ef4('0x51')]['id']){delete _0x11eb68[_0x5ef4('0x51')]['id'];}return db[_0x5ef4('0x48')]['find']({'where':{'id':_0x11eb68['params']['id']}})[_0x5ef4('0x2d')](handleEntityNotFound(_0xe91a1b,null))[_0x5ef4('0x2d')](saveUpdates(_0x11eb68[_0x5ef4('0x51')],null))[_0x5ef4('0x2d')](respondWithResult(_0xe91a1b,null))[_0x5ef4('0x4f')](handleError(_0xe91a1b,null));};exports['destroy']=function(_0x2023a3,_0x1dd79e){return db[_0x5ef4('0x48')]['find']({'where':{'id':_0x2023a3['params']['id']}})['then'](handleEntityNotFound(_0x1dd79e,null))[_0x5ef4('0x2d')](removeEntity(_0x1dd79e,null))[_0x5ef4('0x4f')](handleError(_0x1dd79e,null));};exports[_0x5ef4('0x60')]=function(_0x1a8e18,_0x4ca8c7){return db[_0x5ef4('0x48')][_0x5ef4('0x60')]()['then'](respondWithResult(_0x4ca8c7,null))[_0x5ef4('0x4f')](handleError(_0x4ca8c7,null));};exports[_0x5ef4('0x61')]=function(_0x5ba8d6,_0x1e7c80){var _0x484329=_0x5ba8d6['body'];return db[_0x5ef4('0x48')][_0x5ef4('0x4e')]({'where':{'id':_0x5ba8d6[_0x5ef4('0x4c')]['id']}})[_0x5ef4('0x2d')](handleEntityNotFound(_0x1e7c80,null))[_0x5ef4('0x2d')](function(_0x595aa4){if(_0x595aa4){return db[_0x5ef4('0x57')][_0x5ef4('0x58')](function(_0x381a47){return db[_0x5ef4('0x5a')][_0x5ef4('0x62')]({'where':{'userProfileId':_0x5ba8d6['params']['id'],'sectionId':_[_0x5ef4('0x32')](_0x484329,function(_0x4282cd){return _0x4282cd['sectionId'];})},'transaction':_0x381a47})[_0x5ef4('0x2d')](function(){var _0x175978=_[_0x5ef4('0x32')](_0x484329,function(_0x529471){_0x529471[_0x5ef4('0x5e')]=_0x5ba8d6['params']['id'];return _0x529471;});var _0x52303a=[];return BPromise['each'](_0x175978,function(_0x49045e){return db[_0x5ef4('0x5a')][_0x5ef4('0x50')](_0x49045e,{'include':[{'model':db[_0x5ef4('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x381a47})[_0x5ef4('0x2d')](function(_0x5324b7){_0x52303a['push'](_0x5324b7[_0x5ef4('0x59')]({'plain':!![]}));});})[_0x5ef4('0x2d')](function(){return _0x52303a;});});});}})[_0x5ef4('0x2d')](function(_0x5c485a){return _0x5c485a;})[_0x5ef4('0x2d')](respondWithResult(_0x1e7c80,null))['catch'](handleError(_0x1e7c80,null));};exports[_0x5ef4('0x63')]=function(_0x2805f1,_0x5f50bc){var _0x4fb257;return db['UserProfile'][_0x5ef4('0x4e')]({'where':{'id':_0x2805f1[_0x5ef4('0x4c')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x5f50bc,null))['then'](function(_0x5c319d){if(_0x5c319d){_0x4fb257=_0x5c319d;return db[_0x5ef4('0x5a')][_0x5ef4('0x62')]({'where':{'userProfileId':_0x2805f1[_0x5ef4('0x4c')]['id'],'sectionId':_0x2805f1[_0x5ef4('0x38')]['ids']}});}})['then'](function(){return _0x4fb257;})[_0x5ef4('0x2d')](respondWithStatusCode(_0x5f50bc,null))[_0x5ef4('0x4f')](handleError(_0x5f50bc,null));};exports[_0x5ef4('0x64')]=function(_0x2a3bb0,_0x4ac040){var _0xcf2114=[];var _0x384871=[];return db[_0x5ef4('0x5a')][_0x5ef4('0x4a')]({'where':{'userProfileId':_0x2a3bb0[_0x5ef4('0x4c')]['id']},'raw':!![]})['then'](function(_0x5d8654){_0xcf2114=_['filter'](_0x5d8654,function(_0x5d1b76){return _0x5d1b76[_0x5ef4('0x65')]===0x1||_[_0x5ef4('0x66')]([0x3eb,0x709],_0x5d1b76[_0x5ef4('0x5d')]);});if(!_[_0x5ef4('0x67')](_0xcf2114)){return _[_0x5ef4('0x32')](_0xcf2114,function(_0x301a73){return _0x301a73[_0x5ef4('0x5d')];});}else{return;}})[_0x5ef4('0x2d')](function(_0x5dcdd1){if(_0x5dcdd1)_0x384871=_0x5dcdd1;if(_[_0x5ef4('0x66')](_0x384871,0x64)){var _0x58fbc0=_[_0x5ef4('0x4e')](_0xcf2114,{'sectionId':0x64});return hasDefaultDashboard(_0x58fbc0)['then'](function(_0x178ee8){return _[_0x5ef4('0x32')](_0xcf2114,function(_0x423e7e){if(_0x423e7e[_0x5ef4('0x5d')]===0x64){_0x423e7e[_0x5ef4('0x68')]=_0x178ee8;}return _0x423e7e;});});}else{return;}})['then'](function(_0x2e0bf5){if(_0x2e0bf5)_0xcf2114=_0x2e0bf5;if(_['includes'](_0x384871,0x3eb)){var _0x2edc7a=_[_0x5ef4('0x4e')](_0xcf2114,{'sectionId':0x3eb});return getCustomDashboards(_0x2edc7a)[_0x5ef4('0x2d')](function(_0x1681ad){return _[_0x5ef4('0x32')](_0xcf2114,function(_0x6d7768){if(_0x2edc7a['enabled']){if(_0x6d7768[_0x5ef4('0x5d')]===0x3eb){_0x6d7768[_0x5ef4('0x68')]=_0x1681ad;}}else{if(_0x6d7768[_0x5ef4('0x5d')]===0x64){if(!_0x6d7768['subsections']){_0x6d7768['subsections']=[];}_0x6d7768[_0x5ef4('0x68')]=_0x6d7768['subsections'][_0x5ef4('0x69')](_0x1681ad);}}return _0x6d7768;});});}else{return;}})[_0x5ef4('0x2d')](function(_0x387836){if(_0x387836)_0xcf2114=_0x387836;if(_[_0x5ef4('0x66')](_0x384871,0x709)){var _0x58fa8e=_[_0x5ef4('0x4e')](_0xcf2114,{'sectionId':0x709});return getPlugins(_0x58fa8e)[_0x5ef4('0x2d')](function(_0x496162){if(_0x58fa8e[_0x5ef4('0x65')]){return _[_0x5ef4('0x32')](_0xcf2114,function(_0x3d4ec8){if(_0x3d4ec8[_0x5ef4('0x5d')]===0x709){_0x3d4ec8[_0x5ef4('0x68')]=_0x496162;}return _0x3d4ec8;});}else{var _0x36ddd7={'sectionId':0x76c,'enabled':0x1,'subsections':_0x496162};var _0x460649=_[_0x5ef4('0x32')](_0xcf2114);_0x460649[_0x5ef4('0x6a')](_0x36ddd7);return _0x460649;}});}else{return;}})[_0x5ef4('0x2d')](function(_0x33dd75){if(_0x33dd75)_0xcf2114=_0x33dd75;return _[_0x5ef4('0x45')](_0xcf2114,[_0x5ef4('0x65'),0x1]);})[_0x5ef4('0x2d')](respondWithResult(_0x4ac040,null))['catch'](handleError(_0x4ac040,null));};function hasDefaultDashboard(_0x53626d){var _0x378948=[0x65];return new BPromise(function(_0x351553,_0x3c25e1){try{if(_0x53626d[_0x5ef4('0x5b')]){_0x351553(_0x378948);}else{return db[_0x5ef4('0x5c')]['findOne']({'where':{'sectionId':_0x53626d['id']},'raw':!![]})[_0x5ef4('0x2d')](function(_0x494f61){_0x494f61?_0x351553(_0x378948):_0x351553();});}}catch(_0x42ca5d){_0x3c25e1(_0x42ca5d);}});}function getCustomDashboards(_0x3c5c13){var _0x492d62=[];return new BPromise(function(_0x22129d,_0x505586){try{if(_0x3c5c13[_0x5ef4('0x5b')]){return db[_0x5ef4('0x6b')]['findAll']({'raw':!![]})['then'](function(_0x17d485){_0x17d485[_0x5ef4('0x6c')](function(_0x5a4bed){_0x492d62['push'](_0x5a4bed['id']+0x1869f);});_0x22129d(_0x492d62);});}else{return db[_0x5ef4('0x5c')][_0x5ef4('0x4a')]({'where':{'sectionId':_0x3c5c13['id']},'raw':!![]})['then'](function(_0x11e39c){_0x11e39c[_0x5ef4('0x6c')](function(_0x3b33dc){_0x492d62[_0x5ef4('0x6a')](_0x3b33dc[_0x5ef4('0x6d')]+0x1869f);});_0x22129d(_0x492d62);});}}catch(_0x29bcec){_0x505586(_0x29bcec);}});}function getPlugins(_0x3f6537){var _0x51afb2=[];return new BPromise(function(_0x907d32,_0x579325){try{if(_0x3f6537[_0x5ef4('0x5b')]){return db[_0x5ef4('0x6e')]['findAll']({'raw':!![]})[_0x5ef4('0x2d')](function(_0x2b7568){_0x2b7568[_0x5ef4('0x6c')](function(_0x140064){_0x51afb2['push'](_0x140064['id']+0x15b38);});_0x907d32(_0x51afb2);});}else{return db[_0x5ef4('0x5c')][_0x5ef4('0x4a')]({'where':{'sectionId':_0x3f6537['id']},'raw':!![]})['then'](function(_0x4a80bb){_0x4a80bb[_0x5ef4('0x6c')](function(_0x37f74c){_0x51afb2['push'](_0x37f74c['resourceId']+0x15b38);});_0x907d32(_0x51afb2);});}}catch(_0x2865f4){_0x579325(_0x2865f4);}});}exports[_0x5ef4('0x6f')]=function(_0x2af462,_0x1ab0f0){return db[_0x5ef4('0x48')][_0x5ef4('0x4e')]({'where':{'id':_0x2af462[_0x5ef4('0x4c')]['id']}})[_0x5ef4('0x2d')](handleEntityNotFound(_0x1ab0f0,null))[_0x5ef4('0x2d')](function(_0x36d0c7){if(_0x36d0c7){return db['sequelize'][_0x5ef4('0x58')](function(_0x57c31d){return db['UserProfileSection'][_0x5ef4('0x4a')]({'where':{'userProfileId':_0x2af462[_0x5ef4('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x5ef4('0x2d')](function(_0x2f2e9a){if(_0x2f2e9a){return db[_0x5ef4('0x5a')][_0x5ef4('0x62')]({'where':{'userProfileId':_0x2af462[_0x5ef4('0x4c')]['id'],'id':_[_0x5ef4('0x32')](_0x2f2e9a,function(_0x483b58){return _0x483b58['id'];})},'transaction':_0x57c31d});}})[_0x5ef4('0x2d')](function(_0x3b434d){var _0xe433c4=_[_0x5ef4('0x32')](_0x2af462['body'],function(_0x424b4c){_0x424b4c[_0x5ef4('0x5e')]=_0x2af462[_0x5ef4('0x4c')]['id'];return _0x424b4c;});return db[_0x5ef4('0x5a')][_0x5ef4('0x70')](_0xe433c4,{'raw':!![],'transaction':_0x57c31d});})['then'](function(_0x58d1f9){var _0xd37c5b=_[_0x5ef4('0x45')](_['map'](_0x58d1f9,function(_0x2f9263){return _0x2f9263['get']({'plain':!![]});}),{'includeAll':![]});if(_0xd37c5b){return db[_0x5ef4('0x5a')][_0x5ef4('0x4a')]({'where':{'userProfileId':_0x2af462[_0x5ef4('0x4c')]['id'],'sectionId':_['map'](_0xd37c5b,function(_0x4f7fb5){return _0x4f7fb5[_0x5ef4('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x5ef4('0x2d')](function(_0x3153d3){var _0x41eceb=_['map'](_0x2af462[_0x5ef4('0x51')],function(_0x2c77a4){_0x2c77a4[_0x5ef4('0x5e')]=_0x2af462[_0x5ef4('0x4c')]['id'];return _0x2c77a4;});return db[_0x5ef4('0x5c')]['bulkCreate'](_0x41eceb,{'raw':!![],'transaction':_0x57c31d});});}})[_0x5ef4('0x4f')](handleError(_0x1ab0f0,null));});}})[_0x5ef4('0x2d')](function(_0x48c450){var _0x48d278=_['map'](_0x48c450,function(_0x52fe71){return _0x52fe71[_0x5ef4('0x59')]({'plain':!![]});});})[_0x5ef4('0x2d')](respondWithResult(_0x1ab0f0,null))[_0x5ef4('0x4f')](handleError(_0x1ab0f0,null));};exports[_0x5ef4('0x71')]=function(_0x3b67f3,_0x37c61b,_0x46311){return db[_0x5ef4('0x48')][_0x5ef4('0x4e')]({'where':{'id':_0x3b67f3[_0x5ef4('0x4c')]['id']}})[_0x5ef4('0x2d')](handleEntityNotFound(_0x37c61b,null))[_0x5ef4('0x2d')](function(_0x1fdb41){if(_0x1fdb41){return _0x1fdb41[_0x5ef4('0x71')](_0x3b67f3[_0x5ef4('0x38')][_0x5ef4('0x72')]);}})[_0x5ef4('0x2d')](respondWithStatusCode(_0x37c61b,null))[_0x5ef4('0x4f')](handleError(_0x37c61b,null));};exports['getResources']=function(_0x4776cb,_0x4af254){var _0x33b1b2={};if(!_0x4776cb[_0x5ef4('0x38')]['section'])throw new Error(_0x5ef4('0x73'));if(!_0x4776cb[_0x5ef4('0x38')]['hasOwnProperty'](_0x5ef4('0x40'))){_0x33b1b2[_0x5ef4('0x24')]=qs[_0x5ef4('0x24')](_0x4776cb['query'][_0x5ef4('0x24')]);_0x33b1b2[_0x5ef4('0x22')]=qs[_0x5ef4('0x22')](_0x4776cb[_0x5ef4('0x38')][_0x5ef4('0x22')]);}return db[_0x5ef4('0x48')][_0x5ef4('0x4e')]({'where':{'id':_0x4776cb['params']['id']}})[_0x5ef4('0x2d')](function(_0x3bcdc6){if(!_0x3bcdc6)throw new Error(_0x5ef4('0x74')+_0x4776cb[_0x5ef4('0x4c')]['id']);return db['UserProfile'][_0x5ef4('0x75')](_0x4776cb);})['then'](respondWithFilteredResult(_0x4af254,_0x33b1b2))[_0x5ef4('0x4f')](handleError(_0x4af254,null));}; \ No newline at end of file +var _0x1405=['getResources','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','options','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','describe','addSections','userProfileId','ids','enabled','includes','isEmpty','subsections','concat','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20'];(function(_0x374397,_0x4739a5){var _0x43c007=function(_0x4fe418){while(--_0x4fe418){_0x374397['push'](_0x374397['shift']());}};_0x43c007(++_0x4739a5);}(_0x1405,0xe3));var _0x5140=function(_0x4e7a11,_0x3d7fbe){_0x4e7a11=_0x4e7a11-0x0;var _0x43eb75=_0x1405[_0x4e7a11];return _0x43eb75;};'use strict';var emlformat=require(_0x5140('0x0'));var rimraf=require(_0x5140('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5140('0x2'));var rp=require('request-promise');var moment=require(_0x5140('0x3'));var BPromise=require(_0x5140('0x4'));var Mustache=require('mustache');var util=require(_0x5140('0x5'));var path=require(_0x5140('0x6'));var sox=require('sox');var csv=require(_0x5140('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5140('0x8'));var _=require(_0x5140('0x9'));var squel=require('squel');var crypto=require(_0x5140('0xa'));var jsforce=require(_0x5140('0xb'));var deskjs=require(_0x5140('0xc'));var toCsv=require(_0x5140('0x7'));var querystring=require(_0x5140('0xd'));var Papa=require(_0x5140('0xe'));var Redis=require(_0x5140('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5140('0x10'));var as=require(_0x5140('0x11'));var hardwareService=require(_0x5140('0x12'));var logger=require(_0x5140('0x13'))('api');var utils=require(_0x5140('0x14'));var config=require(_0x5140('0x15'));var licenseUtil=require(_0x5140('0x16'));var db=require('../../mysqldb')['db'];config[_0x5140('0x17')]=_[_0x5140('0x18')](config[_0x5140('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x5140('0x19'))(new Redis(config[_0x5140('0x17')]));require(_0x5140('0x1a'))['register'](socket);function respondWithStatusCode(_0x4b0f31,_0x1e99e3){_0x1e99e3=_0x1e99e3||0xcc;return function(_0x4a8514){if(_0x4a8514){return _0x4b0f31[_0x5140('0x1b')](_0x1e99e3);}return _0x4b0f31['status'](_0x1e99e3)[_0x5140('0x1c')]();};}function respondWithResult(_0x2e2fa8,_0x1c8d7e){_0x1c8d7e=_0x1c8d7e||0xc8;return function(_0x7b994a){if(_0x7b994a){return _0x2e2fa8[_0x5140('0x1d')](_0x1c8d7e)[_0x5140('0x1e')](_0x7b994a);}};}function respondWithFilteredResult(_0x110607,_0x543786){return function(_0x3a5b40){if(_0x3a5b40){var _0x4be1f5=typeof _0x543786[_0x5140('0x1f')]==='undefined'&&typeof _0x543786[_0x5140('0x20')]==='undefined';var _0x53c233=_0x3a5b40[_0x5140('0x21')];var _0x39ac67=_0x4be1f5?0x0:_0x543786[_0x5140('0x1f')];var _0xf5d99a=_0x4be1f5?_0x3a5b40[_0x5140('0x21')]:_0x543786[_0x5140('0x1f')]+_0x543786[_0x5140('0x20')];var _0x32e270;if(_0xf5d99a>=_0x53c233){_0xf5d99a=_0x53c233;_0x32e270=0xc8;}else{_0x32e270=0xce;}_0x110607[_0x5140('0x1d')](_0x32e270);return _0x110607['set'](_0x5140('0x22'),_0x39ac67+'-'+_0xf5d99a+'/'+_0x53c233)[_0x5140('0x1e')](_0x3a5b40);}return null;};}function patchUpdates(_0x31dd9c){return function(_0x611f08){try{jsonpatch[_0x5140('0x23')](_0x611f08,_0x31dd9c,!![]);}catch(_0x3669ab){return BPromise[_0x5140('0x24')](_0x3669ab);}return _0x611f08[_0x5140('0x25')]();};}function saveUpdates(_0x49b6f5,_0x5a941d){return function(_0x430403){if(_0x430403){return _0x430403[_0x5140('0x26')](_0x49b6f5)[_0x5140('0x27')](function(_0x40eb90){return _0x40eb90;});}return null;};}function removeEntity(_0x33bf84,_0xa6d456){return function(_0x45ced7){if(_0x45ced7){return _0x45ced7[_0x5140('0x28')]()[_0x5140('0x27')](function(){_0x33bf84['status'](0xcc)[_0x5140('0x1c')]();});}};}function handleEntityNotFound(_0x596ba5,_0x34c9e0){return function(_0x2790e9){if(!_0x2790e9){_0x596ba5[_0x5140('0x1b')](0x194);}return _0x2790e9;};}function handleError(_0x5b4872,_0x52833a){_0x52833a=_0x52833a||0x1f4;return function(_0x1fa839){logger[_0x5140('0x29')](_0x1fa839[_0x5140('0x2a')]);if(_0x1fa839[_0x5140('0x2b')]){delete _0x1fa839['name'];}_0x5b4872[_0x5140('0x1d')](_0x52833a)[_0x5140('0x2c')](_0x1fa839);};}exports['index']=function(_0x25f672,_0x206deb){var _0x3ffed4={},_0x1a5fd2={},_0x3b5b2d={'count':0x0,'rows':[]};var _0xd9339f=_[_0x5140('0x2d')](db[_0x5140('0x2e')][_0x5140('0x2f')],function(_0x439ad9){return{'name':_0x439ad9[_0x5140('0x30')],'type':_0x439ad9[_0x5140('0x31')][_0x5140('0x32')]};});_0x1a5fd2[_0x5140('0x33')]=_['map'](_0xd9339f,_0x5140('0x2b'));_0x1a5fd2[_0x5140('0x34')]=_[_0x5140('0x35')](_0x25f672['query']);_0x1a5fd2[_0x5140('0x36')]=_[_0x5140('0x37')](_0x1a5fd2[_0x5140('0x33')],_0x1a5fd2[_0x5140('0x34')]);_0x3ffed4['attributes']=_[_0x5140('0x37')](_0x1a5fd2['model'],qs['fields'](_0x25f672[_0x5140('0x34')]['fields']));_0x3ffed4[_0x5140('0x38')]=_0x3ffed4[_0x5140('0x38')][_0x5140('0x39')]?_0x3ffed4[_0x5140('0x38')]:_0x1a5fd2[_0x5140('0x33')];if(!_0x25f672[_0x5140('0x34')]['hasOwnProperty']('nolimit')){_0x3ffed4[_0x5140('0x20')]=qs[_0x5140('0x20')](_0x25f672['query']['limit']);_0x3ffed4['offset']=qs['offset'](_0x25f672[_0x5140('0x34')][_0x5140('0x1f')]);}_0x3ffed4[_0x5140('0x3a')]=qs[_0x5140('0x3b')](_0x25f672[_0x5140('0x34')]['sort']);_0x3ffed4[_0x5140('0x3c')]=qs['filters'](_[_0x5140('0x3d')](_0x25f672[_0x5140('0x34')],_0x1a5fd2['filters']),_0xd9339f);if(_0x25f672[_0x5140('0x34')][_0x5140('0x3e')]){_0x3ffed4[_0x5140('0x3c')]=_[_0x5140('0x3f')](_0x3ffed4[_0x5140('0x3c')],{'$or':_[_0x5140('0x2d')](_0xd9339f,function(_0x5740ee){if(_0x5740ee[_0x5140('0x31')]!==_0x5140('0x40')){var _0x269f52={};_0x269f52[_0x5740ee[_0x5140('0x2b')]]={'$like':'%'+_0x25f672[_0x5140('0x34')]['filter']+'%'};return _0x269f52;}})});}_0x3ffed4=_[_0x5140('0x3f')]({},_0x3ffed4,_0x25f672['options']);var _0x47d245={'where':_0x3ffed4[_0x5140('0x3c')]};return db[_0x5140('0x2e')][_0x5140('0x21')](_0x47d245)[_0x5140('0x27')](function(_0x5a4e9f){_0x3b5b2d[_0x5140('0x21')]=_0x5a4e9f;if(_0x25f672[_0x5140('0x34')][_0x5140('0x41')]){_0x3ffed4[_0x5140('0x42')]=[{'all':!![]}];}return db[_0x5140('0x2e')][_0x5140('0x43')](_0x3ffed4);})[_0x5140('0x27')](function(_0x4b2dba){_0x3b5b2d[_0x5140('0x44')]=_0x4b2dba;return _0x3b5b2d;})[_0x5140('0x27')](respondWithFilteredResult(_0x206deb,_0x3ffed4))[_0x5140('0x45')](handleError(_0x206deb,null));};exports[_0x5140('0x46')]=function(_0x559a87,_0x4a3049){var _0x19c262={'raw':![],'where':{'id':_0x559a87[_0x5140('0x47')]['id']}},_0x192f8d={};_0x192f8d[_0x5140('0x33')]=_[_0x5140('0x35')](db[_0x5140('0x2e')][_0x5140('0x2f')]);_0x192f8d['query']=_['keys'](_0x559a87['query']);_0x192f8d['filters']=_[_0x5140('0x37')](_0x192f8d[_0x5140('0x33')],_0x192f8d[_0x5140('0x34')]);_0x19c262[_0x5140('0x38')]=_[_0x5140('0x37')](_0x192f8d[_0x5140('0x33')],qs[_0x5140('0x48')](_0x559a87[_0x5140('0x34')][_0x5140('0x48')]));_0x19c262[_0x5140('0x38')]=_0x19c262['attributes'][_0x5140('0x39')]?_0x19c262[_0x5140('0x38')]:_0x192f8d[_0x5140('0x33')];if(_0x559a87[_0x5140('0x34')][_0x5140('0x41')]){_0x19c262['include']=[{'all':!![]}];}_0x19c262=_[_0x5140('0x3f')]({},_0x19c262,_0x559a87['options']);return db['UserProfile'][_0x5140('0x49')](_0x19c262)[_0x5140('0x27')](handleEntityNotFound(_0x4a3049,null))[_0x5140('0x27')](respondWithResult(_0x4a3049,null))[_0x5140('0x45')](handleError(_0x4a3049,null));};exports[_0x5140('0x4a')]=function(_0x2571cf,_0x174256){return db[_0x5140('0x2e')]['create'](_0x2571cf[_0x5140('0x4b')],{})[_0x5140('0x27')](respondWithResult(_0x174256,0xc9))['catch'](handleError(_0x174256,null));};exports['clone']=function(_0x7a3331,_0x158f6e){var _0x5471ec={'where':{'id':_0x7a3331[_0x5140('0x47')]['id']}},_0x5642ac={};_0x5642ac[_0x5140('0x33')]=_[_0x5140('0x35')](db[_0x5140('0x2e')][_0x5140('0x2f')]);_0x5471ec['attributes']=_['intersection'](_0x5642ac[_0x5140('0x33')],qs[_0x5140('0x48')](_0x7a3331[_0x5140('0x34')]['fields']));_0x5471ec[_0x5140('0x38')]=_0x5471ec[_0x5140('0x38')]['length']?_0x5471ec[_0x5140('0x38')]:_0x5642ac[_0x5140('0x33')];if(_0x7a3331[_0x5140('0x34')][_0x5140('0x41')]){_0x5471ec[_0x5140('0x42')]=[{'all':!![]}];}_0x5471ec=_[_0x5140('0x3f')]({},_0x5471ec,_0x7a3331[_0x5140('0x4c')]);return db[_0x5140('0x2e')][_0x5140('0x49')](_0x5471ec)['then'](handleEntityNotFound(_0x158f6e,null))[_0x5140('0x27')](function(_0x155700){if(_0x155700){var _0x38c25e=_0x155700[_0x5140('0x4d')]({'plain':!![]});_0x38c25e=qs[_0x5140('0x4e')](_0x38c25e,['id',_0x5140('0x4f'),'updatedAt',_0x5140('0x50')]);_0x7a3331[_0x5140('0x4b')]=_[_0x5140('0x4e')](_0x7a3331[_0x5140('0x4b')],['id',_0x5140('0x4f'),_0x5140('0x51')]);return db[_0x5140('0x52')][_0x5140('0x53')](function(_0x5d502e){return db[_0x5140('0x2e')][_0x5140('0x4a')](_[_0x5140('0x3f')](_0x38c25e,_0x7a3331[_0x5140('0x4b')]),{'include':_0x7a3331[_0x5140('0x34')][_0x5140('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x5d502e})['then'](function(_0x4cbb35){var _0x47cfc2=_0x4cbb35['get']({'plain':!![]});return db[_0x5140('0x54')][_0x5140('0x43')]({'where':{'userProfileId':_0x7a3331['params']['id']},'raw':!![]})['then'](function(_0x233680){if(_0x233680){return BPromise[_0x5140('0x55')](_0x233680,function(_0x468bd9){return new BPromise(function(_0x385324,_0x431423){if(_0x468bd9[_0x5140('0x56')]===null||_0x468bd9[_0x5140('0x56')]===0x1)_0x385324(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x468bd9['id']},'raw':!![]})['then'](function(_0x1d09de){var _0x168b7b=_[_0x5140('0x2d')](_0x1d09de,function(_0x27a389){return qs[_0x5140('0x4e')](_0x27a389,['id',_0x5140('0x4f'),_0x5140('0x51'),_0x5140('0x57')]);});_0x385324(_0x168b7b);})[_0x5140('0x45')](function(_0x290ce5){_0x431423(_0x290ce5);});})[_0x5140('0x27')](function(_0x574ae4){var _0x5bda73=qs[_0x5140('0x4e')](_0x468bd9,['id',_0x5140('0x4f'),_0x5140('0x51')]);_0x5bda73['userProfileId']=_0x47cfc2['id'];if(_0x574ae4)_0x5bda73[_0x5140('0x58')]=_0x574ae4;return _0x5bda73;})[_0x5140('0x27')](function(_0x1e1ddb){return db[_0x5140('0x54')]['create'](_0x1e1ddb,{'include':[{'model':db[_0x5140('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x5d502e});});})['then'](function(){return _0x47cfc2;});}});});});}})[_0x5140('0x27')](respondWithResult(_0x158f6e,0xc9))[_0x5140('0x45')](handleError(_0x158f6e,null));};exports[_0x5140('0x26')]=function(_0x3ca549,_0x3a60c1){if(_0x3ca549[_0x5140('0x4b')]['id']){delete _0x3ca549[_0x5140('0x4b')]['id'];}return db[_0x5140('0x2e')]['find']({'where':{'id':_0x3ca549[_0x5140('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a60c1,null))['then'](saveUpdates(_0x3ca549[_0x5140('0x4b')],null))[_0x5140('0x27')](respondWithResult(_0x3a60c1,null))[_0x5140('0x45')](handleError(_0x3a60c1,null));};exports[_0x5140('0x28')]=function(_0x5b8568,_0x37ba0e){return db['UserProfile'][_0x5140('0x49')]({'where':{'id':_0x5b8568[_0x5140('0x47')]['id']}})[_0x5140('0x27')](handleEntityNotFound(_0x37ba0e,null))[_0x5140('0x27')](removeEntity(_0x37ba0e,null))['catch'](handleError(_0x37ba0e,null));};exports[_0x5140('0x5a')]=function(_0x310cbd,_0x3dac90){return db[_0x5140('0x2e')][_0x5140('0x5a')]()['then'](respondWithResult(_0x3dac90,null))['catch'](handleError(_0x3dac90,null));};exports[_0x5140('0x5b')]=function(_0x4acf60,_0x5dec0e){var _0x416df1=_0x4acf60[_0x5140('0x4b')];return db['UserProfile'][_0x5140('0x49')]({'where':{'id':_0x4acf60[_0x5140('0x47')]['id']}})[_0x5140('0x27')](handleEntityNotFound(_0x5dec0e,null))[_0x5140('0x27')](function(_0x441acc){if(_0x441acc){return db[_0x5140('0x52')]['transaction'](function(_0x392d99){return db[_0x5140('0x54')]['destroy']({'where':{'userProfileId':_0x4acf60[_0x5140('0x47')]['id'],'sectionId':_['map'](_0x416df1,function(_0x489293){return _0x489293['sectionId'];})},'transaction':_0x392d99})[_0x5140('0x27')](function(){var _0x426bc7=_[_0x5140('0x2d')](_0x416df1,function(_0x332ad7){_0x332ad7[_0x5140('0x5c')]=_0x4acf60[_0x5140('0x47')]['id'];return _0x332ad7;});var _0x1b982b=[];return BPromise[_0x5140('0x55')](_0x426bc7,function(_0x28420f){return db['UserProfileSection'][_0x5140('0x4a')](_0x28420f,{'include':[{'model':db[_0x5140('0x59')],'as':_0x5140('0x58')}],'raw':!![],'transaction':_0x392d99})[_0x5140('0x27')](function(_0x44617c){_0x1b982b['push'](_0x44617c[_0x5140('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x1b982b;});});});}})[_0x5140('0x27')](function(_0x269440){return _0x269440;})[_0x5140('0x27')](respondWithResult(_0x5dec0e,null))['catch'](handleError(_0x5dec0e,null));};exports['removeSections']=function(_0x2325d7,_0x262327){var _0x469394;return db[_0x5140('0x2e')][_0x5140('0x49')]({'where':{'id':_0x2325d7[_0x5140('0x47')]['id']},'attributes':['id','name']})[_0x5140('0x27')](handleEntityNotFound(_0x262327,null))[_0x5140('0x27')](function(_0x1a73d1){if(_0x1a73d1){_0x469394=_0x1a73d1;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2325d7[_0x5140('0x47')]['id'],'sectionId':_0x2325d7[_0x5140('0x34')][_0x5140('0x5d')]}});}})[_0x5140('0x27')](function(){return _0x469394;})[_0x5140('0x27')](respondWithStatusCode(_0x262327,null))[_0x5140('0x45')](handleError(_0x262327,null));};exports['getSections']=function(_0x292797,_0x5e1876){var _0x477370=[];var _0x21de3a=[];return db[_0x5140('0x54')][_0x5140('0x43')]({'where':{'userProfileId':_0x292797[_0x5140('0x47')]['id']},'raw':!![]})[_0x5140('0x27')](function(_0x6a27cf){_0x477370=_[_0x5140('0x3e')](_0x6a27cf,function(_0x2940c4){return _0x2940c4[_0x5140('0x5e')]===0x1||_[_0x5140('0x5f')]([0x3eb,0x709],_0x2940c4[_0x5140('0x57')]);});if(!_[_0x5140('0x60')](_0x477370)){return _['map'](_0x477370,function(_0x2e993d){return _0x2e993d['sectionId'];});}else{return;}})[_0x5140('0x27')](function(_0x1e9d70){if(_0x1e9d70)_0x21de3a=_0x1e9d70;if(_[_0x5140('0x5f')](_0x21de3a,0x64)){var _0x239b0d=_['find'](_0x477370,{'sectionId':0x64});return hasDefaultDashboard(_0x239b0d)['then'](function(_0x5926a3){return _[_0x5140('0x2d')](_0x477370,function(_0x17548c){if(_0x17548c[_0x5140('0x57')]===0x64){_0x17548c[_0x5140('0x61')]=_0x5926a3;}return _0x17548c;});});}else{return;}})[_0x5140('0x27')](function(_0xb50736){if(_0xb50736)_0x477370=_0xb50736;if(_[_0x5140('0x5f')](_0x21de3a,0x3eb)){var _0x43b74a=_['find'](_0x477370,{'sectionId':0x3eb});return getCustomDashboards(_0x43b74a)['then'](function(_0x300471){return _[_0x5140('0x2d')](_0x477370,function(_0x418df1){if(_0x43b74a[_0x5140('0x5e')]){if(_0x418df1['sectionId']===0x3eb){_0x418df1[_0x5140('0x61')]=_0x300471;}}else{if(_0x418df1['sectionId']===0x64){if(!_0x418df1[_0x5140('0x61')]){_0x418df1[_0x5140('0x61')]=[];}_0x418df1['subsections']=_0x418df1[_0x5140('0x61')][_0x5140('0x62')](_0x300471);}}return _0x418df1;});});}else{return;}})['then'](function(_0x59915f){if(_0x59915f)_0x477370=_0x59915f;if(_['includes'](_0x21de3a,0x709)){var _0x3705fe=_[_0x5140('0x49')](_0x477370,{'sectionId':0x709});return getPlugins(_0x3705fe)[_0x5140('0x27')](function(_0x363f66){if(_0x3705fe['enabled']){return _['map'](_0x477370,function(_0x364e0e){if(_0x364e0e['sectionId']===0x709){_0x364e0e[_0x5140('0x61')]=_0x363f66;}return _0x364e0e;});}else{var _0x489e6a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x363f66};var _0x376014=_[_0x5140('0x2d')](_0x477370);_0x376014[_0x5140('0x63')](_0x489e6a);return _0x376014;}});}else{return;}})[_0x5140('0x27')](function(_0x37b227){if(_0x37b227)_0x477370=_0x37b227;return _[_0x5140('0x3e')](_0x477370,['enabled',0x1]);})[_0x5140('0x27')](respondWithResult(_0x5e1876,null))[_0x5140('0x45')](handleError(_0x5e1876,null));};function hasDefaultDashboard(_0x42a4e8){var _0x5a8531=[0x65];return new BPromise(function(_0x234c5d,_0x56e989){try{if(_0x42a4e8['autoAssociation']){_0x234c5d(_0x5a8531);}else{return db[_0x5140('0x59')][_0x5140('0x64')]({'where':{'sectionId':_0x42a4e8['id']},'raw':!![]})[_0x5140('0x27')](function(_0x216659){_0x216659?_0x234c5d(_0x5a8531):_0x234c5d();});}}catch(_0x1254ff){_0x56e989(_0x1254ff);}});}function getCustomDashboards(_0x39ca94){var _0x46d857=[];return new BPromise(function(_0x1a180c,_0x7ada7c){try{if(_0x39ca94[_0x5140('0x56')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x5140('0x27')](function(_0x28da2e){_0x28da2e[_0x5140('0x65')](function(_0x21650b){_0x46d857[_0x5140('0x63')](_0x21650b['id']+0x1869f);});_0x1a180c(_0x46d857);});}else{return db[_0x5140('0x59')][_0x5140('0x43')]({'where':{'sectionId':_0x39ca94['id']},'raw':!![]})['then'](function(_0x3adb39){_0x3adb39[_0x5140('0x65')](function(_0x2fa401){_0x46d857['push'](_0x2fa401[_0x5140('0x66')]+0x1869f);});_0x1a180c(_0x46d857);});}}catch(_0x42bb1e){_0x7ada7c(_0x42bb1e);}});}function getPlugins(_0x42d5f9){var _0x522859=[];return new BPromise(function(_0x26dbaa,_0x3dc77d){try{if(_0x42d5f9[_0x5140('0x56')]){return db[_0x5140('0x67')]['findAll']({'raw':!![]})[_0x5140('0x27')](function(_0x3358d7){_0x3358d7['forEach'](function(_0x4d7fef){_0x522859[_0x5140('0x63')](_0x4d7fef['id']+0x15b38);});_0x26dbaa(_0x522859);});}else{return db[_0x5140('0x59')][_0x5140('0x43')]({'where':{'sectionId':_0x42d5f9['id']},'raw':!![]})['then'](function(_0x240fbe){_0x240fbe['forEach'](function(_0x366e87){_0x522859[_0x5140('0x63')](_0x366e87[_0x5140('0x66')]+0x15b38);});_0x26dbaa(_0x522859);});}}catch(_0x599fbb){_0x3dc77d(_0x599fbb);}});}exports[_0x5140('0x68')]=function(_0x21efd3,_0x10e1f7){return db[_0x5140('0x2e')]['find']({'where':{'id':_0x21efd3['params']['id']}})[_0x5140('0x27')](handleEntityNotFound(_0x10e1f7,null))[_0x5140('0x27')](function(_0xde4917){if(_0xde4917){return db['sequelize'][_0x5140('0x53')](function(_0x47f470){return db['UserProfileSection'][_0x5140('0x43')]({'where':{'userProfileId':_0x21efd3[_0x5140('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x5140('0x27')](function(_0x225210){if(_0x225210){return db[_0x5140('0x54')][_0x5140('0x28')]({'where':{'userProfileId':_0x21efd3[_0x5140('0x47')]['id'],'id':_['map'](_0x225210,function(_0x43f8c9){return _0x43f8c9['id'];})},'transaction':_0x47f470});}})['then'](function(_0x264527){var _0x1a8cfc=_['map'](_0x21efd3[_0x5140('0x4b')],function(_0x43a871){_0x43a871[_0x5140('0x5c')]=_0x21efd3['params']['id'];return _0x43a871;});return db['UserProfileSection'][_0x5140('0x69')](_0x1a8cfc,{'raw':!![],'transaction':_0x47f470});})[_0x5140('0x27')](function(_0x404eff){var _0x3f20a8=_[_0x5140('0x3e')](_['map'](_0x404eff,function(_0x275e14){return _0x275e14[_0x5140('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x3f20a8){return db[_0x5140('0x54')][_0x5140('0x43')]({'where':{'userProfileId':_0x21efd3[_0x5140('0x47')]['id'],'sectionId':_['map'](_0x3f20a8,function(_0x1611ca){return _0x1611ca[_0x5140('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x53ce44){var _0x4dbd35=_[_0x5140('0x2d')](_0x21efd3[_0x5140('0x4b')],function(_0x271cb9){_0x271cb9[_0x5140('0x5c')]=_0x21efd3[_0x5140('0x47')]['id'];return _0x271cb9;});return db['UserProfileResource'][_0x5140('0x69')](_0x4dbd35,{'raw':!![],'transaction':_0x47f470});});}})['catch'](handleError(_0x10e1f7,null));});}})[_0x5140('0x27')](function(_0x5da9f0){var _0x555777=_[_0x5140('0x2d')](_0x5da9f0,function(_0x2fada9){return _0x2fada9[_0x5140('0x4d')]({'plain':!![]});});})[_0x5140('0x27')](respondWithResult(_0x10e1f7,null))[_0x5140('0x45')](handleError(_0x10e1f7,null));};exports[_0x5140('0x6a')]=function(_0x2f9b2f,_0x306e03,_0x5968a5){return db[_0x5140('0x2e')][_0x5140('0x49')]({'where':{'id':_0x2f9b2f[_0x5140('0x47')]['id']}})[_0x5140('0x27')](handleEntityNotFound(_0x306e03,null))[_0x5140('0x27')](function(_0x5cb105){if(_0x5cb105){return _0x5cb105[_0x5140('0x6a')](_0x2f9b2f[_0x5140('0x34')]['ids']);}})[_0x5140('0x27')](respondWithStatusCode(_0x306e03,null))['catch'](handleError(_0x306e03,null));};exports['getResources']=function(_0x790432,_0x59c128){var _0x5ca90f={};if(!_0x790432[_0x5140('0x34')][_0x5140('0x6b')])throw new Error(_0x5140('0x6c'));if(!_0x790432['query'][_0x5140('0x6d')](_0x5140('0x6e'))){_0x5ca90f['limit']=qs[_0x5140('0x20')](_0x790432['query'][_0x5140('0x20')]);_0x5ca90f[_0x5140('0x1f')]=qs[_0x5140('0x1f')](_0x790432[_0x5140('0x34')][_0x5140('0x1f')]);}return db[_0x5140('0x2e')]['find']({'where':{'id':_0x790432[_0x5140('0x47')]['id']}})['then'](function(_0x3ad4b8){if(!_0x3ad4b8)throw new Error(_0x5140('0x6f')+_0x790432['params']['id']);return db[_0x5140('0x2e')][_0x5140('0x70')](_0x790432);})[_0x5140('0x27')](respondWithFilteredResult(_0x59c128,_0x5ca90f))[_0x5140('0x45')](handleError(_0x59c128,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8b046c0..53952ef 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 _0x0ef4=['hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners','remove'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x0ef4,0xc7));var _0x40ef=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x0ef4[_0x30bd4d];return _0x306915;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x40ef('0x0'))['db'][_0x40ef('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x40ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x40ef('0x3')};function emitEvent(_0xf78dc1){return function(_0x85ee1d,_0x4a5798,_0x16fef9){UserProfileEvents['emit'](_0xf78dc1+':'+_0x85ee1d['id'],_0x85ee1d);UserProfileEvents['emit'](_0xf78dc1,_0x85ee1d);_0x16fef9(null);};}for(var e in events){if(events[_0x40ef('0x4')](e)){var event=events[e];UserProfile[_0x40ef('0x5')](e,emitEvent(event));}}module[_0x40ef('0x6')]=UserProfileEvents; \ No newline at end of file +var _0xb4d9=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x18ffb2,_0x2ed490){var _0x33b718=function(_0x5e51d9){while(--_0x5e51d9){_0x18ffb2['push'](_0x18ffb2['shift']());}};_0x33b718(++_0x2ed490);}(_0xb4d9,0xce));var _0x9b4d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xb4d9[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0x9b4d('0x0'));var UserProfile=require(_0x9b4d('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9b4d('0x2')](0x0);var events={'afterCreate':_0x9b4d('0x3'),'afterUpdate':_0x9b4d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x16b539){return function(_0x27adf9,_0x19b7aa,_0x477979){UserProfileEvents[_0x9b4d('0x5')](_0x16b539+':'+_0x27adf9['id'],_0x27adf9);UserProfileEvents[_0x9b4d('0x5')](_0x16b539,_0x27adf9);_0x477979(null);};}for(var e in events){if(events[_0x9b4d('0x6')](e)){var event=events[e];UserProfile[_0x9b4d('0x7')](e,emitEvent(event));}}module[_0x9b4d('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 262a218..60e1bd0 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 _0xaa4a=['UserProfileResource','type','resourceId','toLowerCase','childModel','SquareOdbc','squarerecordings','projectName','projects','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','Team','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','Tag','Template','triggers','trunks','Trunk','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','sort','where','pick','merge','key','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','order','extraQueryConditions','CmContact','Tags','color','tag','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','model','map','name','catch','resolve'];(function(_0x3845bd,_0x4d32f0){var _0x1181df=function(_0x449cda){while(--_0x449cda){_0x3845bd['push'](_0x3845bd['shift']());}};_0x1181df(++_0x4d32f0);}(_0xaa4a,0xaf));var _0xaaa4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaa4a[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xaaa4('0x0'));var attributes=require(_0xaaa4('0x1'));var squel=require(_0xaaa4('0x2'));module[_0xaaa4('0x3')]=function(_0x578707){var _0x1a1879=_0x578707[_0xaaa4('0x4')];function _0x334e68(_0x28abbd,_0x328bf3){return new Promise(function(_0x40ef62,_0x365b55){if(!_0x328bf3)return _0x40ef62(null);var _0x107d3a=_0x328bf3[_0xaaa4('0x5')]?{[_0x328bf3['filter'][_0xaaa4('0x6')]]:_0x328bf3[_0xaaa4('0x5')][_0xaaa4('0x7')]}:undefined;return _0x1a1879[_0x28abbd][_0xaaa4('0x8')]({'where':_0x107d3a,'raw':!![]})[_0xaaa4('0x9')](function(_0x7262dc){_0x328bf3[_0xaaa4('0xa')]=_['map'](_0x7262dc,'id');_0x40ef62(_0x328bf3);})['catch'](function(_0x13eb40){_0x365b55(_0x13eb40);});});}function _0x4d9d55(_0x3dfd0d,_0x4b6b16){return new Promise(function(_0x253793,_0x9b9ee1){var _0x3307e1=_0x3dfd0d[_0xaaa4('0x5')]?{[_0x3dfd0d[_0xaaa4('0x5')][_0xaaa4('0x6')]]:_0x3dfd0d[_0xaaa4('0x5')]['value']}:undefined;return _0x1a1879[_0x3dfd0d[_0xaaa4('0xb')]][_0xaaa4('0x8')]({'where':_0x3307e1,'raw':!![]})['then'](function(_0x355b9b){_0x4b6b16[_0xaaa4('0xa')]=_[_0xaaa4('0xc')](_0x355b9b,function(_0x1dccda){return _0x1dccda[_0xaaa4('0xd')];});_0x253793(_0x4b6b16);})[_0xaaa4('0xe')](function(_0x3e1419){_0x9b9ee1(_0x3e1419);});});}function _0xa9556c(_0x2a7b36,_0xb76a80,_0x12d3e3){if(!_0xb76a80)return Promise[_0xaaa4('0xf')](null);return new Promise(function(_0x2a9e67,_0x39ea54){return _0x1a1879[_0xaaa4('0x10')][_0xaaa4('0x8')]({'where':{'sectionId':_0xb76a80['id']},'raw':!![]})['then'](function(_0x1d0e39){if(_0x2a7b36[_0xaaa4('0x6')]&&_0x2a7b36[_0xaaa4('0x6')]!=='id'){_0xb76a80[_0xaaa4('0xa')]=_[_0xaaa4('0xc')](_0x1d0e39,function(_0x29ffdf){return _0x29ffdf[_0x2a7b36[_0xaaa4('0x6')]];});}else{if(_0x12d3e3==='AnalyticExtractedReport'){_0xb76a80[_0xaaa4('0xa')]=_[_0xaaa4('0xc')](_0x1d0e39,function(_0x347526){return{'id':_0x347526['resourceId'],'type':_0x347526[_0xaaa4('0x11')]};});}else{_0xb76a80['associatedResources']=_[_0xaaa4('0xc')](_0x1d0e39,function(_0x268950){return _0x268950[_0xaaa4('0x12')];});}}_0x2a9e67(_0xb76a80);})[_0xaaa4('0xe')](function(_0x1a74eb){_0x39ea54(_0x1a74eb);});});}function _0x4d3c4b(_0x3e917a,_0x30fa89){var _0x142b8a={'parentSections':[]};switch(_0x3e917a[_0xaaa4('0x13')]()){case'squareprojects':_0x142b8a[_0xaaa4('0x14')]='SquareProject';break;case'odbc':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x15');break;case _0xaaa4('0x16'):_0x142b8a[_0xaaa4('0x14')]='SquareRecording';_0x142b8a['parentSections']=[{'name':'SquareProjects','field':_0xaaa4('0xd'),'foreignKey':_0xaaa4('0x17')}];break;case _0xaaa4('0x18'):_0x142b8a['childModel']='JscriptyProject';break;case _0xaaa4('0x19'):_0x142b8a['childModel']='CmContact';_0x142b8a['parentSections']=[{'name':_0xaaa4('0x1a'),'field':'id','foreignKey':'ListId'}];break;case _0xaaa4('0x1b'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x1c');break;case _0xaaa4('0x1d'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x1e');break;case _0xaaa4('0x1f'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x20');break;case _0xaaa4('0x21'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x22');break;case'chatwebsites':_0x142b8a[_0xaaa4('0x14')]='ChatWebsite';break;case _0xaaa4('0x23'):_0x142b8a[_0xaaa4('0x14')]='FaxQueue';break;case _0xaaa4('0x24'):_0x142b8a[_0xaaa4('0x14')]='FaxAccount';break;case _0xaaa4('0x25'):case'internalroutes':case _0xaaa4('0x26'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x27');break;case _0xaaa4('0x28'):_0x142b8a['childModel']='VoiceContext';break;case'voicemails':_0x142b8a['childModel']=_0xaaa4('0x29');break;case _0xaaa4('0x2a'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x2b');_0x142b8a[_0xaaa4('0x2c')]=[{'name':_0xaaa4('0x2d'),'field':'name','foreignKey':'membername','model':_0xaaa4('0x2e'),'filter':{'field':_0xaaa4('0x2f'),'value':[_0xaaa4('0x30')]}},{'name':_0xaaa4('0x31'),'field':_0xaaa4('0xd'),'foreignKey':_0xaaa4('0x32'),'model':'User','filter':{'field':_0xaaa4('0x2f'),'value':[_0xaaa4('0x33')]}},{'name':_0xaaa4('0x34'),'field':'name','foreignKey':_0xaaa4('0x35'),'model':_0xaaa4('0x36'),'filter':{'field':'type','value':[_0xaaa4('0x37')]}},{'name':_0xaaa4('0x38'),'field':_0xaaa4('0xd'),'foreignKey':'queue','model':_0xaaa4('0x36'),'filter':{'field':'type','value':[_0xaaa4('0x39')]}}];break;case _0xaaa4('0x3a'):_0x142b8a['childModel']=_0xaaa4('0x3b');break;case _0xaaa4('0x3c'):_0x142b8a['childModel']=_0xaaa4('0x3d');break;case'voiceprefixes':_0x142b8a['childModel']=_0xaaa4('0x3e');break;case _0xaaa4('0x3f'):_0x142b8a['childModel']='Campaign';break;case'mailqueues':_0x142b8a['childModel']='MailQueue';break;case _0xaaa4('0x40'):_0x142b8a['childModel']=_0xaaa4('0x41');break;case'mailsubstatuses':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x42');break;case _0xaaa4('0x43'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x44');break;case _0xaaa4('0x45'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x46');break;case'smsqueues':_0x142b8a['childModel']=_0xaaa4('0x47');break;case _0xaaa4('0x48'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x49');break;case'whatsappqueues':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x4a');break;case'whatsappaccounts':_0x142b8a['childModel']=_0xaaa4('0x4b');break;case'teams':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x4c');break;case'voicequeues':case _0xaaa4('0x4d'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x36');if(_0x30fa89){_0x142b8a['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xaaa4('0x4e'):case _0xaaa4('0x4f'):case'telephones':_0x142b8a[_0xaaa4('0x14')]='User';if(_0x30fa89){_0x142b8a[_0xaaa4('0x2c')]=[{'name':_0xaaa4('0x50'),'filter':{'field':_0xaaa4('0x2f'),'value':[_0xaaa4('0x51'),_0xaaa4('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0xaaa4('0x31')}];}break;case _0xaaa4('0x53'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x54');break;case _0xaaa4('0x55'):_0x142b8a['childModel']=_0xaaa4('0x56');break;case _0xaaa4('0x57'):_0x142b8a['childModel']=_0xaaa4('0x58');break;case'sugarcrmaccounts':_0x142b8a['childModel']=_0xaaa4('0x59');break;case _0xaaa4('0x5a'):_0x142b8a['childModel']='DeskAccount';break;case _0xaaa4('0x5b'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x5c');break;case _0xaaa4('0x5d'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x2e');break;case _0xaaa4('0x5e'):_0x142b8a[_0xaaa4('0x14')]='CannedAnswer';break;case _0xaaa4('0x5f'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x60');break;case _0xaaa4('0x61'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x62');break;case _0xaaa4('0x63'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x64');break;case _0xaaa4('0x65'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x66');break;case'scheduler':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x67');break;case _0xaaa4('0x68'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x69');break;case'tags':_0x142b8a['childModel']=_0xaaa4('0x6a');break;case'templates':_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x6b');break;case _0xaaa4('0x6c'):_0x142b8a['childModel']='Trigger';break;case _0xaaa4('0x6d'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x6e');break;case'variables':_0x142b8a['childModel']='Variable';break;case _0xaaa4('0x6f'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x70');break;case _0xaaa4('0x71'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x72');_0x142b8a[_0xaaa4('0x2c')]=[{'name':_0xaaa4('0x73'),'field':'id','foreignKey':_0xaaa4('0x74')}];break;case _0xaaa4('0x75'):_0x142b8a[_0xaaa4('0x14')]=_0xaaa4('0x76');break;}return _0x142b8a;}function _0x20fda2(_0x3f047b,_0x30f8fc){var _0x14a226=_0x3f047b[_0xaaa4('0x77')](0x0)['toUpperCase']()+_0x3f047b[_0xaaa4('0x78')](0x1);var _0x4fc67c={'type':_0x1a1879['Sequelize'][_0xaaa4('0x79')][_0xaaa4('0x7a')],'raw':!![]};return new Promise(function(_0x5c4e00,_0xd4883e){var _0x2573a0=squel[_0xaaa4('0x7b')]()[_0xaaa4('0x6')](_0xaaa4('0x7c')+_0x14a226+_0xaaa4('0x7d'),'id')[_0xaaa4('0x6')](_0xaaa4('0x7e'))[_0xaaa4('0x7f')](_0xaaa4('0x80')+_0x3f047b+_0xaaa4('0x81'),'ui')['where'](_0xaaa4('0x82'),_0x30f8fc['id']);return _0x1a1879['sequelize'][_0xaaa4('0x83')](_0x2573a0[_0xaaa4('0x84')](),_0x4fc67c)['then'](function(_0x562490){_0x30f8fc[_0x14a226+_0xaaa4('0x85')]=_0x562490;_0x5c4e00(_0x562490);})[_0xaaa4('0xe')](function(_0x4d8c39){_0xd4883e(_0x4d8c39);});});}return _0x578707[_0xaaa4('0x86')](_0xaaa4('0x87'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5374e9){var _0x4089=require('../../components/parsers/qs');var _0x1e87f0={'raw':_0x5374e9[_0xaaa4('0x83')]['raw'],'where':{}};var _0x230b97={};var _0xf2bbe6={'count':0x0,'rows':[]};var _0x519d8e=_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0x88')];var _0x592155=_0x5374e9['query'][_0xaaa4('0x89')]||![];var _0x5447f9=_0x4d3c4b(_0x519d8e,_0x592155);if(!_0x5447f9[_0xaaa4('0x14')])throw new Error(_0xaaa4('0x8a')+_0x519d8e+'\x27');var _0x353114=[{'name':_0x519d8e}];if(!_['isEmpty'](_0x5447f9['parentSections']))_0x353114=_0x5447f9[_0xaaa4('0x2c')];var _0x135278=[];for(var _0x124d1d=0x0;_0x124d1d<_0x353114['length'];_0x124d1d++){_0x135278[_0xaaa4('0x8b')](_0x1a1879[_0xaaa4('0x8c')][_0xaaa4('0x8d')]({'where':{'userProfileId':_0x5374e9[_0xaaa4('0x8e')]['id'],'name':_0x353114[_0x124d1d][_0xaaa4('0xd')]},'raw':!![]}));}return Promise[_0xaaa4('0x8f')](_0x135278)['then'](function(_0x461bb5){var _0x177d43=_['filter'](_0x461bb5,function(_0x18d417){return _0x18d417?_0x18d417:undefined;});var _0x60b11f=_[_0xaaa4('0x5')](_0x353114,[_0xaaa4('0x90'),!![]]);var _0x2a4c9c=_[_0xaaa4('0x91')](_0x177d43)&&_[_0xaaa4('0x91')](_0x60b11f)?null:_[_0xaaa4('0x92')](_0x60b11f,_0x177d43);if(!_0x2a4c9c)return null;var _0x2406d8=[];for(var _0x44f855=0x0;_0x44f855<_0x2a4c9c[_0xaaa4('0x93')];_0x44f855++){var _0xf5dc5=_[_0xaaa4('0x8d')](_0x353114,function(_0x3ab15d){return _0x2a4c9c[_0x44f855]?_0x3ab15d[_0xaaa4('0xd')]===_0x2a4c9c[_0x44f855][_0xaaa4('0xd')]:null;});if(_0xf5dc5){if(_0x2a4c9c[_0x44f855][_0xaaa4('0x90')]){_0x2406d8[_0xaaa4('0x8b')](_0x334e68(_0x5447f9[_0xaaa4('0x14')],_0x2a4c9c[_0x44f855]));}else{if(!_0x2a4c9c[_0x44f855]['autoAssociation']){_0x2406d8[_0xaaa4('0x8b')](_0xa9556c(_0xf5dc5,_0x2a4c9c[_0x44f855],_0x5447f9[_0xaaa4('0x14')]));}else{if(_0xf5dc5[_0xaaa4('0xb')]){_0x2406d8[_0xaaa4('0x8b')](_0x4d9d55(_0xf5dc5,_0x2a4c9c[_0x44f855]));}}}}}return Promise['all'](_0x2406d8);})[_0xaaa4('0x9')](function(_0x360152){var _0x10e865=_0x360152;var _0x5ef410=null;if(_0x10e865){_0x5ef410=_0x10e865[_0xaaa4('0x93')]===0x1?_0x10e865[0x0]:null;}if(!_0x5ef410&&!_0x10e865)return _0xf2bbe6;var _0x25e281=_0x1a1879[_0x5447f9[_0xaaa4('0x14')]][_0xaaa4('0x94')];_0x230b97[_0xaaa4('0xb')]=_['keys'](_0x25e281);_0x230b97[_0xaaa4('0x83')]=_[_0xaaa4('0x95')](_0x5374e9[_0xaaa4('0x83')]);_0x230b97[_0xaaa4('0x96')]=_[_0xaaa4('0x97')](_0x230b97['model'],_0x230b97[_0xaaa4('0x83')]);_0x1e87f0['attributes']=_[_0xaaa4('0x97')](_0x230b97[_0xaaa4('0xb')],_0x4089[_0xaaa4('0x98')](_0x5374e9['query'][_0xaaa4('0x98')]));_0x1e87f0[_0xaaa4('0x99')]=_0x1e87f0['attributes'][_0xaaa4('0x93')]?_0x1e87f0['attributes']:_0x230b97[_0xaaa4('0xb')];if(!_0x5374e9['query']['hasOwnProperty'](_0xaaa4('0x9a'))){_0x1e87f0[_0xaaa4('0x9b')]=_0x4089[_0xaaa4('0x9b')](_0x5374e9[_0xaaa4('0x83')]['limit']);_0x1e87f0[_0xaaa4('0x9c')]=_0x4089[_0xaaa4('0x9c')](_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0x9c')]);}_0x1e87f0['order']=_0x4089[_0xaaa4('0x9d')](_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0x9d')]);_0x1e87f0[_0xaaa4('0x9e')]=_0x4089[_0xaaa4('0x96')](_[_0xaaa4('0x9f')](_0x5374e9[_0xaaa4('0x83')],_0x230b97['filters']));if(_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0x5')]){_0x1e87f0[_0xaaa4('0x9e')]=_[_0xaaa4('0xa0')](_0x1e87f0[_0xaaa4('0x9e')],{'$or':_[_0xaaa4('0xc')](_0x25e281,function(_0x24b59f){if(_0x24b59f[_0xaaa4('0x11')][_0xaaa4('0xa1')]!==_0xaaa4('0xa2')){var _0x347c63={};_0x347c63[_0x24b59f[_0xaaa4('0x6')]]={'$like':'%'+_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0x5')]+'%'};return _0x347c63;}})});}var _0x37eb7e=[];var _0x3f0519=null;var _0x162826={};if(_0x5ef410){_0x3f0519=_[_0xaaa4('0x8d')](_0x353114,[_0xaaa4('0xd'),_0x5ef410[_0xaaa4('0xd')]]);if(_0x3f0519[_0xaaa4('0x6')]){_0x162826={};if(_0x5447f9[_0xaaa4('0x14')]===_0xaaa4('0x72')){_0x162826[_0x3f0519[_0xaaa4('0xa3')]]=_[_0xaaa4('0xc')](_0x5ef410[_0xaaa4('0xa')],'id');}else{_0x162826[_0x3f0519[_0xaaa4('0xa3')]]=_0x5ef410[_0xaaa4('0xa')];}_0x37eb7e[_0xaaa4('0x8b')](_0x162826);}else{_0x1e87f0[_0xaaa4('0x9e')]['id']=_0x5ef410[_0xaaa4('0xa')];}}else{for(var _0x3011f8=0x0;_0x3011f8<_0x10e865['length'];_0x3011f8++){_0x3f0519=_[_0xaaa4('0x8d')](_0x353114,['name',_0x10e865[_0x3011f8][_0xaaa4('0xd')]]);if(_0x3f0519[_0xaaa4('0x6')]){_0x162826={};_0x162826[_0x3f0519['foreignKey']]=_0x10e865[_0x3011f8][_0xaaa4('0xa')];_0x37eb7e[_0xaaa4('0x8b')](_0x162826);}else{if(!_0x1e87f0['where']['id'])_0x1e87f0[_0xaaa4('0x9e')]['id']=[];_0x10e865[_0x3011f8][_0xaaa4('0xa')]['forEach'](function(_0x4c8cb0){_0x1e87f0[_0xaaa4('0x9e')]['id'][_0xaaa4('0x8b')](_0x4c8cb0);});}}}if(!_[_0xaaa4('0x91')](_0x37eb7e)){_0x1e87f0[_0xaaa4('0x9e')]=_[_0xaaa4('0xa0')](_0x1e87f0[_0xaaa4('0x9e')],{'$and':{'$or':_0x37eb7e}});}_0x1e87f0=_['merge']({},_0x1e87f0,_0x5374e9[_0xaaa4('0xa4')]);if(_0x5ef410&&!_0x5ef410[_0xaaa4('0xa5')]&&_0x5447f9[_0xaaa4('0x14')]==='AnalyticExtractedReport'){if(_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xa6')]){_0x1e87f0[_0xaaa4('0xa7')]=[{'all':!![]}];}return _0x1a1879[_0x5447f9['childModel']][_0xaaa4('0x8')](_0x1e87f0)[_0xaaa4('0x9')](function(_0x4c4c50){var _0x51e5dc=[];_0x4c4c50[_0xaaa4('0xa8')](function(_0x58f44f){var _0x254af1;switch(_0x58f44f[_0xaaa4('0xa9')]){case _0xaaa4('0xaa'):_0x254af1=_['find'](_0x5ef410[_0xaaa4('0xa')],function(_0x3eff9d){return _0x3eff9d['id']===_0x58f44f['reportId']&&_0x3eff9d[_0xaaa4('0x11')]===_0xaaa4('0xab');});break;case _0xaaa4('0xac'):_0x254af1=_[_0xaaa4('0x8d')](_0x5ef410[_0xaaa4('0xa')],function(_0x5812e0){return _0x5812e0['id']===_0x58f44f['reportId']&&_0x5812e0[_0xaaa4('0x11')]==='CustomReports';});break;}if(_0x254af1)_0x51e5dc[_0xaaa4('0x8b')](_0x58f44f);});_0xf2bbe6[_0xaaa4('0xad')]=_0x51e5dc[_0xaaa4('0x93')];_0xf2bbe6[_0xaaa4('0xae')]=_0x51e5dc;return _0xf2bbe6;});}else{if(!_[_0xaaa4('0x91')](_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xaf')])){_0x1e87f0['where']['id']=_0x1e87f0[_0xaaa4('0x9e')]['id']?_[_0xaaa4('0x97')](_0x1e87f0[_0xaaa4('0x9e')]['id'],_0x5374e9[_0xaaa4('0x83')]['ids']):_0x5374e9['query'][_0xaaa4('0xaf')];if(_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb0')]){_0x1e87f0[_0xaaa4('0xb1')]=_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb0')];}}if(_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb2')]){_0x1e87f0['where']=_[_0xaaa4('0xa0')](_0x1e87f0[_0xaaa4('0x9e')],{'$and':_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb2')]});}return _0x1a1879[_0x5447f9['childModel']][_0xaaa4('0xad')]({'where':_0x1e87f0[_0xaaa4('0x9e')]})[_0xaaa4('0x9')](function(_0x212b1d){_0xf2bbe6['count']=_0x212b1d;if(_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xa6')]){if(_0x5447f9[_0xaaa4('0x14')]===_0xaaa4('0xb3')){_0x1e87f0[_0xaaa4('0xa7')]=[{'model':_0x1a1879[_0xaaa4('0x6a')],'as':_0xaaa4('0xb4'),'attributes':['id',_0xaaa4('0xd'),_0xaaa4('0xb5')],'required':_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb6')]?!![]:![]},{'model':_0x1a1879[_0xaaa4('0x6a')],'as':'ThroughTags','attributes':['id',_0xaaa4('0xd'),_0xaaa4('0xb5')],'through':_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb6')]?{'attributes':[],'where':{'TagId':_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb6')]||undefined}}:{},'required':_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb6')]?!![]:![]}];}else{_0x1e87f0[_0xaaa4('0xa7')]=[{'all':!![]}];}}return _0x1a1879[_0x5447f9[_0xaaa4('0x14')]][_0xaaa4('0x8')](_0x1e87f0);})[_0xaaa4('0x9')](function(_0x1cc182){_0xf2bbe6['rows']=_0x1cc182;if(_0x519d8e===_0xaaa4('0x2d')&&_0x5374e9[_0xaaa4('0x83')][_0xaaa4('0xb7')]===_0xaaa4('0xb8')){var _0x5b3ee8=[];for(var _0x31d9ec=0x0;_0x31d9ec<_0xf2bbe6['rows'][_0xaaa4('0x93')];_0x31d9ec++){_0x5b3ee8[_0xaaa4('0x8b')](_0x20fda2('chat',_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));_0x5b3ee8[_0xaaa4('0x8b')](_0x20fda2(_0xaaa4('0xba'),_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));_0x5b3ee8[_0xaaa4('0x8b')](_0x20fda2(_0xaaa4('0xbb'),_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));_0x5b3ee8[_0xaaa4('0x8b')](_0x20fda2(_0xaaa4('0xbc'),_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));_0x5b3ee8['push'](_0x20fda2(_0xaaa4('0xbd'),_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));_0x5b3ee8[_0xaaa4('0x8b')](_0x20fda2(_0xaaa4('0xbe'),_0xf2bbe6[_0xaaa4('0xae')][_0x31d9ec][_0xaaa4('0xb9')]));}return Promise['all'](_0x5b3ee8)[_0xaaa4('0x9')](function(){return _0xf2bbe6;});}return _0xf2bbe6;});}});}}});}; \ No newline at end of file +var _0xe488=['squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','parentSections','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','admin','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','sounds','Sound','tags','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','metrics','charAt','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','define','UserProfile','user_profiles','raw','section','mergeResources','length','push','UserProfileSection','params','ignore','isEmpty','find','autoAssociation','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','key','foreignKey','forEach','options','reportType','reportId','DefaultReports','custom','CustomReports','count','ids','customSorting','Tag','color','tag','include','rows','dataValues','fax','mail','openchannel','all','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase'];(function(_0x102a36,_0x3d9e72){var _0x25c403=function(_0x3181d6){while(--_0x3181d6){_0x102a36['push'](_0x102a36['shift']());}};_0x25c403(++_0x3d9e72);}(_0xe488,0xa7));var _0x8e48=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xe488[_0x171fdc];return _0x3782ea;};'use strict';var _=require(_0x8e48('0x0'));var attributes=require(_0x8e48('0x1'));var squel=require(_0x8e48('0x2'));module['exports']=function(_0x3991d7){var _0x5baa33=_0x3991d7[_0x8e48('0x3')];function _0x5b4377(_0x3654ef,_0x4cbb69){return new Promise(function(_0x4fa387,_0x429e11){if(!_0x4cbb69)return _0x4fa387(null);var _0x377ee5=_0x4cbb69[_0x8e48('0x4')]?{[_0x4cbb69[_0x8e48('0x4')][_0x8e48('0x5')]]:_0x4cbb69[_0x8e48('0x4')][_0x8e48('0x6')]}:undefined;return _0x5baa33[_0x3654ef][_0x8e48('0x7')]({'where':_0x377ee5,'raw':!![]})[_0x8e48('0x8')](function(_0x31acf0){_0x4cbb69[_0x8e48('0x9')]=_[_0x8e48('0xa')](_0x31acf0,'id');_0x4fa387(_0x4cbb69);})[_0x8e48('0xb')](function(_0x266bd8){_0x429e11(_0x266bd8);});});}function _0x4ada7e(_0x104821,_0x54947f){return new Promise(function(_0x2d2403,_0x1f699c){var _0x4ebc07=_0x104821[_0x8e48('0x4')]?{[_0x104821[_0x8e48('0x4')][_0x8e48('0x5')]]:_0x104821[_0x8e48('0x4')][_0x8e48('0x6')]}:undefined;return _0x5baa33[_0x104821[_0x8e48('0xc')]][_0x8e48('0x7')]({'where':_0x4ebc07,'raw':!![]})['then'](function(_0x3004be){_0x54947f['associatedResources']=_['map'](_0x3004be,function(_0x439190){return _0x439190[_0x8e48('0xd')];});_0x2d2403(_0x54947f);})['catch'](function(_0x3a6e0f){_0x1f699c(_0x3a6e0f);});});}function _0x39909d(_0x281e2a,_0x413ea4,_0x375466){if(!_0x413ea4)return Promise[_0x8e48('0xe')](null);return new Promise(function(_0x42768e,_0x1bca90){return _0x5baa33[_0x8e48('0xf')][_0x8e48('0x7')]({'where':{'sectionId':_0x413ea4['id']},'raw':!![]})['then'](function(_0x3ba5c4){if(_0x281e2a[_0x8e48('0x5')]&&_0x281e2a['field']!=='id'){_0x413ea4[_0x8e48('0x9')]=_[_0x8e48('0xa')](_0x3ba5c4,function(_0x382c2b){return _0x382c2b[_0x281e2a['field']];});}else{if(_0x375466===_0x8e48('0x10')){_0x413ea4[_0x8e48('0x9')]=_['map'](_0x3ba5c4,function(_0x1603e3){return{'id':_0x1603e3[_0x8e48('0x11')],'type':_0x1603e3[_0x8e48('0x12')]};});}else{_0x413ea4[_0x8e48('0x9')]=_['map'](_0x3ba5c4,function(_0x319e02){return _0x319e02[_0x8e48('0x11')];});}}_0x42768e(_0x413ea4);})[_0x8e48('0xb')](function(_0x581891){_0x1bca90(_0x581891);});});}function _0x21a043(_0x516845,_0x4e14d0){var _0x21a9f5={'parentSections':[]};switch(_0x516845[_0x8e48('0x13')]()){case _0x8e48('0x14'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x16');break;case _0x8e48('0x17'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x18');break;case _0x8e48('0x19'):_0x21a9f5['childModel']=_0x8e48('0x1a');_0x21a9f5['parentSections']=[{'name':_0x8e48('0x1b'),'field':_0x8e48('0xd'),'foreignKey':_0x8e48('0x1c')}];break;case _0x8e48('0x1d'):_0x21a9f5['childModel']='JscriptyProject';break;case _0x8e48('0x1e'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x1f');_0x21a9f5[_0x8e48('0x20')]=[{'name':_0x8e48('0x21'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x22');break;case _0x8e48('0x23'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x24');break;case _0x8e48('0x25'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x26');break;case'chatqueues':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x27');break;case'chatwebsites':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x28');break;case _0x8e48('0x29'):_0x21a9f5[_0x8e48('0x15')]='FaxQueue';break;case _0x8e48('0x2a'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x2b');break;case _0x8e48('0x2c'):case _0x8e48('0x2d'):case _0x8e48('0x2e'):_0x21a9f5['childModel']=_0x8e48('0x2f');break;case _0x8e48('0x30'):_0x21a9f5['childModel']=_0x8e48('0x31');break;case _0x8e48('0x32'):_0x21a9f5[_0x8e48('0x15')]='VoiceMail';break;case _0x8e48('0x33'):_0x21a9f5['childModel']=_0x8e48('0x34');_0x21a9f5['parentSections']=[{'name':_0x8e48('0x35'),'field':'name','foreignKey':_0x8e48('0x36'),'model':_0x8e48('0x37'),'filter':{'field':'role','value':[_0x8e48('0x38')]}},{'name':'Telephones','field':_0x8e48('0xd'),'foreignKey':_0x8e48('0x36'),'model':_0x8e48('0x37'),'filter':{'field':_0x8e48('0x39'),'value':[_0x8e48('0x3a')]}},{'name':_0x8e48('0x3b'),'field':_0x8e48('0xd'),'foreignKey':_0x8e48('0x3c'),'model':_0x8e48('0x3d'),'filter':{'field':_0x8e48('0x12'),'value':['inbound']}},{'name':_0x8e48('0x3e'),'field':_0x8e48('0xd'),'foreignKey':'queue','model':_0x8e48('0x3d'),'filter':{'field':_0x8e48('0x12'),'value':[_0x8e48('0x3f')]}}];break;case _0x8e48('0x40'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x41');break;case'chanspies':_0x21a9f5[_0x8e48('0x15')]='VoiceChanSpy';break;case _0x8e48('0x42'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x43');break;case _0x8e48('0x44'):_0x21a9f5[_0x8e48('0x15')]='Campaign';break;case _0x8e48('0x45'):_0x21a9f5['childModel']=_0x8e48('0x46');break;case _0x8e48('0x47'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x48');break;case'mailsubstatuses':_0x21a9f5[_0x8e48('0x15')]='MailSubstatus';break;case _0x8e48('0x49'):_0x21a9f5['childModel']=_0x8e48('0x4a');break;case _0x8e48('0x4b'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x4c');break;case _0x8e48('0x4d'):_0x21a9f5[_0x8e48('0x15')]='SmsQueue';break;case _0x8e48('0x4e'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x4f');break;case _0x8e48('0x50'):_0x21a9f5[_0x8e48('0x15')]='WhatsappQueue';break;case _0x8e48('0x51'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x52');break;case _0x8e48('0x53'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x54');break;case _0x8e48('0x55'):case _0x8e48('0x56'):_0x21a9f5['childModel']=_0x8e48('0x3d');if(_0x4e14d0){_0x21a9f5['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x8e48('0x57'):case _0x8e48('0x58'):case'telephones':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x37');if(_0x4e14d0){_0x21a9f5[_0x8e48('0x20')]=[{'name':'Users','filter':{'field':_0x8e48('0x39'),'value':[_0x8e48('0x59'),'user']},'ignore':!![]},{'name':_0x8e48('0x35')},{'name':_0x8e48('0x5a')}];}break;case _0x8e48('0x5b'):_0x21a9f5['childModel']='ZendeskAccount';break;case _0x8e48('0x5c'):_0x21a9f5['childModel']=_0x8e48('0x5d');break;case'freshdeskaccounts':_0x21a9f5[_0x8e48('0x15')]='FreshdeskAccount';break;case _0x8e48('0x5e'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x5f');break;case _0x8e48('0x60'):_0x21a9f5['childModel']=_0x8e48('0x61');break;case _0x8e48('0x62'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x63');break;case _0x8e48('0x64'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x37');break;case _0x8e48('0x65'):_0x21a9f5['childModel']='CannedAnswer';break;case _0x8e48('0x66'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x67');break;case _0x8e48('0x68'):_0x21a9f5[_0x8e48('0x15')]='Dashboard';break;case _0x8e48('0x69'):_0x21a9f5['childModel']=_0x8e48('0x6a');break;case'pauses':_0x21a9f5['childModel']=_0x8e48('0x6b');break;case _0x8e48('0x6c'):_0x21a9f5[_0x8e48('0x15')]='Schedule';break;case _0x8e48('0x6d'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x6e');break;case _0x8e48('0x6f'):_0x21a9f5[_0x8e48('0x15')]='Tag';break;case'templates':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x70');break;case _0x8e48('0x71'):_0x21a9f5['childModel']=_0x8e48('0x72');break;case _0x8e48('0x73'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x74');break;case _0x8e48('0x75'):_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x76');break;case _0x8e48('0x77'):_0x21a9f5['childModel']=_0x8e48('0x78');break;case'extractedreports':_0x21a9f5[_0x8e48('0x15')]=_0x8e48('0x10');_0x21a9f5['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x8e48('0x79'):_0x21a9f5['childModel']='AnalyticMetric';break;}return _0x21a9f5;}function _0xd0c34b(_0x3b7245,_0x2880b6){var _0x187efd=_0x3b7245[_0x8e48('0x7a')](0x0)['toUpperCase']()+_0x3b7245[_0x8e48('0x7b')](0x1);var _0x99d41a={'type':_0x5baa33[_0x8e48('0x7c')][_0x8e48('0x7d')][_0x8e48('0x7e')],'raw':!![]};return new Promise(function(_0xf54270,_0x544013){var _0x49336c=squel['select']()['field'](_0x8e48('0x7f')+_0x187efd+_0x8e48('0x80'),'id')[_0x8e48('0x5')](_0x8e48('0x81'))[_0x8e48('0x82')](_0x8e48('0x83')+_0x3b7245+_0x8e48('0x84'),'ui')[_0x8e48('0x85')](_0x8e48('0x86'),_0x2880b6['id']);return _0x5baa33[_0x8e48('0x87')][_0x8e48('0x88')](_0x49336c['toString'](),_0x99d41a)[_0x8e48('0x8')](function(_0x5abd14){_0x2880b6[_0x187efd+'OpenTabs']=_0x5abd14;_0xf54270(_0x5abd14);})[_0x8e48('0xb')](function(_0x530bc6){_0x544013(_0x530bc6);});});}return _0x3991d7[_0x8e48('0x89')](_0x8e48('0x8a'),attributes,{'tableName':_0x8e48('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xc4ea72){var _0x383058=require('../../components/parsers/qs');var _0x6203b7={'raw':_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x8c')],'where':{}};var _0x364d67={};var _0x3f949f={'count':0x0,'rows':[]};var _0xb3d0d2=_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x8d')];var _0x4869d5=_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x8e')]||![];var _0x4ae916=_0x21a043(_0xb3d0d2,_0x4869d5);if(!_0x4ae916['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0xb3d0d2+'\x27');var _0x404e61=[{'name':_0xb3d0d2}];if(!_['isEmpty'](_0x4ae916[_0x8e48('0x20')]))_0x404e61=_0x4ae916['parentSections'];var _0x21fff2=[];for(var _0x2fb09c=0x0;_0x2fb09c<_0x404e61[_0x8e48('0x8f')];_0x2fb09c++){_0x21fff2[_0x8e48('0x90')](_0x5baa33[_0x8e48('0x91')]['find']({'where':{'userProfileId':_0xc4ea72[_0x8e48('0x92')]['id'],'name':_0x404e61[_0x2fb09c]['name']},'raw':!![]}));}return Promise['all'](_0x21fff2)[_0x8e48('0x8')](function(_0x4d0f64){var _0x4e130e=_[_0x8e48('0x4')](_0x4d0f64,function(_0x2a4653){return _0x2a4653?_0x2a4653:undefined;});var _0x2f3583=_['filter'](_0x404e61,[_0x8e48('0x93'),!![]]);var _0xc70514=_[_0x8e48('0x94')](_0x4e130e)&&_[_0x8e48('0x94')](_0x2f3583)?null:_['union'](_0x2f3583,_0x4e130e);if(!_0xc70514)return null;var _0x309d68=[];for(var _0x42f21a=0x0;_0x42f21a<_0xc70514[_0x8e48('0x8f')];_0x42f21a++){var _0x35dfad=_[_0x8e48('0x95')](_0x404e61,function(_0x1f3deb){return _0xc70514[_0x42f21a]?_0x1f3deb[_0x8e48('0xd')]===_0xc70514[_0x42f21a]['name']:null;});if(_0x35dfad){if(_0xc70514[_0x42f21a][_0x8e48('0x93')]){_0x309d68[_0x8e48('0x90')](_0x5b4377(_0x4ae916[_0x8e48('0x15')],_0xc70514[_0x42f21a]));}else{if(!_0xc70514[_0x42f21a][_0x8e48('0x96')]){_0x309d68[_0x8e48('0x90')](_0x39909d(_0x35dfad,_0xc70514[_0x42f21a],_0x4ae916[_0x8e48('0x15')]));}else{if(_0x35dfad[_0x8e48('0xc')]){_0x309d68[_0x8e48('0x90')](_0x4ada7e(_0x35dfad,_0xc70514[_0x42f21a]));}}}}}return Promise['all'](_0x309d68);})[_0x8e48('0x8')](function(_0x14cdc5){var _0x7b6d6=_0x14cdc5;var _0x373d23=null;if(_0x7b6d6){_0x373d23=_0x7b6d6[_0x8e48('0x8f')]===0x1?_0x7b6d6[0x0]:null;}if(!_0x373d23&&!_0x7b6d6)return _0x3f949f;var _0x4c5174=_0x5baa33[_0x4ae916[_0x8e48('0x15')]][_0x8e48('0x97')];_0x364d67[_0x8e48('0xc')]=_['keys'](_0x4c5174);_0x364d67[_0x8e48('0x88')]=_[_0x8e48('0x98')](_0xc4ea72[_0x8e48('0x88')]);_0x364d67['filters']=_['intersection'](_0x364d67[_0x8e48('0xc')],_0x364d67[_0x8e48('0x88')]);_0x6203b7[_0x8e48('0x99')]=_[_0x8e48('0x9a')](_0x364d67['model'],_0x383058['fields'](_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x9b')]));_0x6203b7[_0x8e48('0x99')]=_0x6203b7[_0x8e48('0x99')][_0x8e48('0x8f')]?_0x6203b7['attributes']:_0x364d67['model'];if(!_0xc4ea72['query'][_0x8e48('0x9c')](_0x8e48('0x9d'))){_0x6203b7[_0x8e48('0x9e')]=_0x383058[_0x8e48('0x9e')](_0xc4ea72['query']['limit']);_0x6203b7[_0x8e48('0x9f')]=_0x383058[_0x8e48('0x9f')](_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x9f')]);}_0x6203b7[_0x8e48('0xa0')]=_0x383058['sort'](_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xa1')]);_0x6203b7['where']=_0x383058[_0x8e48('0xa2')](_[_0x8e48('0xa3')](_0xc4ea72[_0x8e48('0x88')],_0x364d67['filters']));if(_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x4')]){_0x6203b7[_0x8e48('0x85')]=_[_0x8e48('0xa4')](_0x6203b7[_0x8e48('0x85')],{'$or':_['map'](_0x4c5174,function(_0x426063){if(_0x426063[_0x8e48('0x12')][_0x8e48('0xa5')]!=='VIRTUAL'){var _0x47ab8e={};_0x47ab8e[_0x426063[_0x8e48('0x5')]]={'$like':'%'+_0xc4ea72[_0x8e48('0x88')][_0x8e48('0x4')]+'%'};return _0x47ab8e;}})});}var _0x53aa96=[];var _0x248b9c=null;var _0x1d186c={};if(_0x373d23){_0x248b9c=_[_0x8e48('0x95')](_0x404e61,['name',_0x373d23[_0x8e48('0xd')]]);if(_0x248b9c[_0x8e48('0x5')]){_0x1d186c={};if(_0x4ae916[_0x8e48('0x15')]===_0x8e48('0x10')){_0x1d186c[_0x248b9c[_0x8e48('0xa6')]]=_[_0x8e48('0xa')](_0x373d23[_0x8e48('0x9')],'id');}else{_0x1d186c[_0x248b9c[_0x8e48('0xa6')]]=_0x373d23[_0x8e48('0x9')];}_0x53aa96[_0x8e48('0x90')](_0x1d186c);}else{_0x6203b7[_0x8e48('0x85')]['id']=_0x373d23[_0x8e48('0x9')];}}else{for(var _0x2654e0=0x0;_0x2654e0<_0x7b6d6[_0x8e48('0x8f')];_0x2654e0++){_0x248b9c=_[_0x8e48('0x95')](_0x404e61,[_0x8e48('0xd'),_0x7b6d6[_0x2654e0][_0x8e48('0xd')]]);if(_0x248b9c[_0x8e48('0x5')]){_0x1d186c={};_0x1d186c[_0x248b9c[_0x8e48('0xa6')]]=_0x7b6d6[_0x2654e0][_0x8e48('0x9')];_0x53aa96[_0x8e48('0x90')](_0x1d186c);}else{if(!_0x6203b7[_0x8e48('0x85')]['id'])_0x6203b7[_0x8e48('0x85')]['id']=[];_0x7b6d6[_0x2654e0][_0x8e48('0x9')][_0x8e48('0xa7')](function(_0x6a91a2){_0x6203b7[_0x8e48('0x85')]['id'][_0x8e48('0x90')](_0x6a91a2);});}}}if(!_[_0x8e48('0x94')](_0x53aa96)){_0x6203b7['where']=_[_0x8e48('0xa4')](_0x6203b7[_0x8e48('0x85')],{'$and':{'$or':_0x53aa96}});}_0x6203b7=_[_0x8e48('0xa4')]({},_0x6203b7,_0xc4ea72[_0x8e48('0xa8')]);if(_0x373d23&&!_0x373d23[_0x8e48('0x96')]&&_0x4ae916['childModel']===_0x8e48('0x10')){if(_0xc4ea72[_0x8e48('0x88')]['includeAll']){_0x6203b7['include']=[{'all':!![]}];}return _0x5baa33[_0x4ae916[_0x8e48('0x15')]][_0x8e48('0x7')](_0x6203b7)[_0x8e48('0x8')](function(_0x4783b8){var _0x1bc0bd=[];_0x4783b8['forEach'](function(_0xb3671f){var _0x123e59;switch(_0xb3671f[_0x8e48('0xa9')]){case'default':_0x123e59=_[_0x8e48('0x95')](_0x373d23['associatedResources'],function(_0x37fd14){return _0x37fd14['id']===_0xb3671f[_0x8e48('0xaa')]&&_0x37fd14[_0x8e48('0x12')]===_0x8e48('0xab');});break;case _0x8e48('0xac'):_0x123e59=_[_0x8e48('0x95')](_0x373d23[_0x8e48('0x9')],function(_0x734c27){return _0x734c27['id']===_0xb3671f[_0x8e48('0xaa')]&&_0x734c27['type']===_0x8e48('0xad');});break;}if(_0x123e59)_0x1bc0bd['push'](_0xb3671f);});_0x3f949f[_0x8e48('0xae')]=_0x1bc0bd[_0x8e48('0x8f')];_0x3f949f['rows']=_0x1bc0bd;return _0x3f949f;});}else{if(!_[_0x8e48('0x94')](_0xc4ea72['query'][_0x8e48('0xaf')])){_0x6203b7[_0x8e48('0x85')]['id']=_0x6203b7[_0x8e48('0x85')]['id']?_['intersection'](_0x6203b7[_0x8e48('0x85')]['id'],_0xc4ea72[_0x8e48('0x88')]['ids']):_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xaf')];if(_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xb0')]){_0x6203b7[_0x8e48('0xa0')]=_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xb0')];}}if(_0xc4ea72[_0x8e48('0x88')]['extraQueryConditions']){_0x6203b7[_0x8e48('0x85')]=_[_0x8e48('0xa4')](_0x6203b7[_0x8e48('0x85')],{'$and':_0xc4ea72[_0x8e48('0x88')]['extraQueryConditions']});}return _0x5baa33[_0x4ae916['childModel']]['count']({'where':_0x6203b7[_0x8e48('0x85')]})[_0x8e48('0x8')](function(_0x3ea40d){_0x3f949f[_0x8e48('0xae')]=_0x3ea40d;if(_0xc4ea72[_0x8e48('0x88')]['includeAll']){if(_0x4ae916[_0x8e48('0x15')]===_0x8e48('0x1f')){_0x6203b7['include']=[{'model':_0x5baa33[_0x8e48('0xb1')],'as':'Tags','attributes':['id','name',_0x8e48('0xb2')],'required':_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xb3')]?!![]:![]},{'model':_0x5baa33[_0x8e48('0xb1')],'as':'ThroughTags','attributes':['id',_0x8e48('0xd'),_0x8e48('0xb2')],'through':_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xb3')]?{'attributes':[],'where':{'TagId':_0xc4ea72['query'][_0x8e48('0xb3')]||undefined}}:{},'required':_0xc4ea72[_0x8e48('0x88')][_0x8e48('0xb3')]?!![]:![]}];}else{_0x6203b7[_0x8e48('0xb4')]=[{'all':!![]}];}}return _0x5baa33[_0x4ae916['childModel']][_0x8e48('0x7')](_0x6203b7);})[_0x8e48('0x8')](function(_0x9d940){_0x3f949f[_0x8e48('0xb5')]=_0x9d940;if(_0xb3d0d2===_0x8e48('0x35')&&_0xc4ea72[_0x8e48('0x88')]['openTabs']==='true'){var _0xfaeb2b=[];for(var _0x47c7b7=0x0;_0x47c7b7<_0x3f949f['rows'][_0x8e48('0x8f')];_0x47c7b7++){_0xfaeb2b[_0x8e48('0x90')](_0xd0c34b('chat',_0x3f949f[_0x8e48('0xb5')][_0x47c7b7][_0x8e48('0xb6')]));_0xfaeb2b['push'](_0xd0c34b('sms',_0x3f949f['rows'][_0x47c7b7]['dataValues']));_0xfaeb2b['push'](_0xd0c34b(_0x8e48('0xb7'),_0x3f949f[_0x8e48('0xb5')][_0x47c7b7][_0x8e48('0xb6')]));_0xfaeb2b[_0x8e48('0x90')](_0xd0c34b(_0x8e48('0xb8'),_0x3f949f[_0x8e48('0xb5')][_0x47c7b7][_0x8e48('0xb6')]));_0xfaeb2b[_0x8e48('0x90')](_0xd0c34b(_0x8e48('0xb9'),_0x3f949f[_0x8e48('0xb5')][_0x47c7b7]['dataValues']));_0xfaeb2b[_0x8e48('0x90')](_0xd0c34b('whatsapp',_0x3f949f[_0x8e48('0xb5')][_0x47c7b7][_0x8e48('0xb6')]));}return Promise[_0x8e48('0xba')](_0xfaeb2b)[_0x8e48('0x8')](function(){return _0x3f949f;});}return _0x3f949f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ba64296..81cf3ea 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 _0xe14a=['error','code','message','catch','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x10d0b6,_0x2191ac){var _0x5f37c3=function(_0xc80f88){while(--_0xc80f88){_0x10d0b6['push'](_0x10d0b6['shift']());}};_0x5f37c3(++_0x2191ac);}(_0xe14a,0x94));var _0xae14=function(_0x4a92e7,_0x5c8bf8){_0x4a92e7=_0x4a92e7-0x0;var _0x59505e=_0xe14a[_0x4a92e7];return _0x59505e;};'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(_0xae14('0x0'));var db=require(_0xae14('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var config=require(_0xae14('0x4'));var jayson=require(_0xae14('0x5'));var client=jayson[_0xae14('0x6')][_0xae14('0x7')]({'port':0x232a});config[_0xae14('0x8')]=_[_0xae14('0x9')](config[_0xae14('0x8')],{'host':_0xae14('0xa'),'port':0x18eb});var socket=require(_0xae14('0xb'))(new Redis(config[_0xae14('0x8')]));require(_0xae14('0xc'))['register'](socket);function respondWithRpcPromise(_0x507639,_0x2edf05,_0x345149){return new BPromise(function(_0x38a65f,_0x324dd0){return client[_0xae14('0xd')](_0x507639,_0x345149)['then'](function(_0x5e051f){logger[_0xae14('0xe')](_0xae14('0xf'),_0x2edf05,_0xae14('0x10'));logger[_0xae14('0x11')](_0xae14('0x12'),_0x2edf05,_0xae14('0x10'),JSON[_0xae14('0x13')](_0x5e051f));if(_0x5e051f[_0xae14('0x14')]){if(_0x5e051f[_0xae14('0x14')][_0xae14('0x15')]===0x1f4){logger['error'](_0xae14('0xf'),_0x2edf05,_0x5e051f[_0xae14('0x14')]['message']);return _0x324dd0(_0x5e051f[_0xae14('0x14')][_0xae14('0x16')]);}logger[_0xae14('0x14')](_0xae14('0xf'),_0x2edf05,_0x5e051f[_0xae14('0x14')]['message']);return _0x38a65f(_0x5e051f['error'][_0xae14('0x16')]);}else{logger[_0xae14('0xe')](_0xae14('0xf'),_0x2edf05,_0xae14('0x10'));_0x38a65f(_0x5e051f['result'][_0xae14('0x16')]);}})[_0xae14('0x17')](function(_0x3e8424){logger[_0xae14('0x14')](_0xae14('0xf'),_0x2edf05,_0x3e8424);_0x324dd0(_0x3e8424);});});} \ No newline at end of file +var _0xc9c3=['socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x857b54,_0x4212fd){var _0x2a4f07=function(_0x5ed29f){while(--_0x5ed29f){_0x857b54['push'](_0x857b54['shift']());}};_0x2a4f07(++_0x4212fd);}(_0xc9c3,0x96));var _0x3c9c=function(_0x575546,_0x63dfd1){_0x575546=_0x575546-0x0;var _0x473307=_0xc9c3[_0x575546];return _0x473307;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9c('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c9c('0x1'));var fs=require('fs');var Redis=require(_0x3c9c('0x2'));var db=require(_0x3c9c('0x3'))['db'];var utils=require(_0x3c9c('0x4'));var logger=require(_0x3c9c('0x5'))(_0x3c9c('0x6'));var config=require(_0x3c9c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3c9c('0x8')]=_[_0x3c9c('0x9')](config[_0x3c9c('0x8')],{'host':_0x3c9c('0xa'),'port':0x18eb});var socket=require(_0x3c9c('0xb'))(new Redis(config[_0x3c9c('0x8')]));require(_0x3c9c('0xc'))[_0x3c9c('0xd')](socket);function respondWithRpcPromise(_0x2be851,_0x28a59f,_0x50bdd1){return new BPromise(function(_0x20ed5c,_0xc45f8b){return client['request'](_0x2be851,_0x50bdd1)[_0x3c9c('0xe')](function(_0x4c6969){logger[_0x3c9c('0xf')](_0x3c9c('0x10'),_0x28a59f,_0x3c9c('0x11'));logger[_0x3c9c('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x28a59f,'request\x20sent',JSON['stringify'](_0x4c6969));if(_0x4c6969[_0x3c9c('0x13')]){if(_0x4c6969['error']['code']===0x1f4){logger['error'](_0x3c9c('0x10'),_0x28a59f,_0x4c6969['error'][_0x3c9c('0x14')]);return _0xc45f8b(_0x4c6969[_0x3c9c('0x13')][_0x3c9c('0x14')]);}logger[_0x3c9c('0x13')]('UserProfile,\x20%s,\x20%s',_0x28a59f,_0x4c6969[_0x3c9c('0x13')]['message']);return _0x20ed5c(_0x4c6969['error']['message']);}else{logger[_0x3c9c('0xf')](_0x3c9c('0x10'),_0x28a59f,_0x3c9c('0x11'));_0x20ed5c(_0x4c6969[_0x3c9c('0x15')][_0x3c9c('0x14')]);}})[_0x3c9c('0x16')](function(_0x319f19){logger['error'](_0x3c9c('0x10'),_0x28a59f,_0x319f19);_0xc45f8b(_0x319f19);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ef8f4a2..a0d47db 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 _0x95b5=['register','length','save','remove','update','emit'];(function(_0x2d6faa,_0x442cd3){var _0x4f0bc0=function(_0x561e27){while(--_0x561e27){_0x2d6faa['push'](_0x2d6faa['shift']());}};_0x4f0bc0(++_0x442cd3);}(_0x95b5,0x1e8));var _0x595b=function(_0x5182be,_0x1a14af){_0x5182be=_0x5182be-0x0;var _0x355ea9=_0x95b5[_0x5182be];return _0x355ea9;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x595b('0x0'),_0x595b('0x1'),_0x595b('0x2')];function createListener(_0x49bcd0,_0x19b64a){return function(_0x308384){_0x19b64a[_0x595b('0x3')](_0x49bcd0,_0x308384);};}function removeListener(_0x4fd221,_0x566546){return function(){UserProfileEvents['removeListener'](_0x4fd221,_0x566546);};}exports[_0x595b('0x4')]=function(_0x597d74){for(var _0x4ba471=0x0,_0x49c4fe=events[_0x595b('0x5')];_0x4ba471<_0x49c4fe;_0x4ba471++){var _0x3bfffd=events[_0x4ba471];var _0x2cfb33=createListener('userProfile:'+_0x3bfffd,_0x597d74);UserProfileEvents['on'](_0x3bfffd,_0x2cfb33);}}; \ No newline at end of file +var _0x271a=['remove','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x35ede4,_0x256e30){var _0x13c24f=function(_0x2698c9){while(--_0x2698c9){_0x35ede4['push'](_0x35ede4['shift']());}};_0x13c24f(++_0x256e30);}(_0x271a,0xd0));var _0xa271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271a[_0x14add3];return _0x4a174f;};'use strict';var UserProfileEvents=require(_0xa271('0x0'));var events=[_0xa271('0x1'),_0xa271('0x2'),'update'];function createListener(_0x4b912e,_0x27ca1e){return function(_0x3b6567){_0x27ca1e[_0xa271('0x3')](_0x4b912e,_0x3b6567);};}function removeListener(_0x529cfa,_0xb868dc){return function(){UserProfileEvents[_0xa271('0x4')](_0x529cfa,_0xb868dc);};}exports['register']=function(_0x5935c2){for(var _0x7d116f=0x0,_0x16e98d=events[_0xa271('0x5')];_0x7d116f<_0x16e98d;_0x7d116f++){var _0xe90249=events[_0x7d116f];var _0x5ee37d=createListener(_0xa271('0x6')+_0xe90249,_0x5935c2);UserProfileEvents['on'](_0xe90249,_0x5ee37d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0f154e7..f170e7e 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 _0xbc49=['./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbc49,0xfc));var _0x9bc4=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0xbc49[_0x5a7e78];return _0xa8d4a1;};'use strict';var multer=require(_0x9bc4('0x0'));var util=require(_0x9bc4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bc4('0x2'));var router=express[_0x9bc4('0x3')]();var fs_extra=require(_0x9bc4('0x4'));var auth=require(_0x9bc4('0x5'));var interaction=require(_0x9bc4('0x6'));var config=require(_0x9bc4('0x7'));var controller=require(_0x9bc4('0x8'));router[_0x9bc4('0x9')]('/',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0xb')]);router[_0x9bc4('0x9')](_0x9bc4('0xc'),auth[_0x9bc4('0xa')](),controller['describe']);router[_0x9bc4('0x9')](_0x9bc4('0xd'),auth[_0x9bc4('0xa')](),controller[_0x9bc4('0xe')]);router[_0x9bc4('0xf')]('/',auth[_0x9bc4('0xa')](),controller[_0x9bc4('0x10')]);router[_0x9bc4('0x11')](_0x9bc4('0xd'),auth['isAuthenticated'](),controller[_0x9bc4('0x12')]);router['delete'](_0x9bc4('0xd'),auth[_0x9bc4('0xa')](),controller['destroy']);module[_0x9bc4('0x13')]=router; \ No newline at end of file +var _0x7481=['post','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x7481,0x180));var _0x1748=function(_0x3a568a,_0x470759){_0x3a568a=_0x3a568a-0x0;var _0x1c090f=_0x7481[_0x3a568a];return _0x1c090f;};'use strict';var multer=require(_0x1748('0x0'));var util=require('util');var path=require(_0x1748('0x1'));var timeout=require(_0x1748('0x2'));var express=require(_0x1748('0x3'));var router=express[_0x1748('0x4')]();var fs_extra=require(_0x1748('0x5'));var auth=require(_0x1748('0x6'));var interaction=require(_0x1748('0x7'));var config=require(_0x1748('0x8'));var controller=require(_0x1748('0x9'));router[_0x1748('0xa')]('/',auth[_0x1748('0xb')](),controller[_0x1748('0xc')]);router[_0x1748('0xa')]('/describe',auth[_0x1748('0xb')](),controller[_0x1748('0xd')]);router['get'](_0x1748('0xe'),auth['isAuthenticated'](),controller[_0x1748('0xf')]);router[_0x1748('0x10')]('/',auth[_0x1748('0xb')](),controller['create']);router[_0x1748('0x11')]('/:id',auth[_0x1748('0xb')](),controller['update']);router[_0x1748('0x12')](_0x1748('0xe'),auth[_0x1748('0xb')](),controller[_0x1748('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 5a2eece..1439406 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 _0x6696=['STRING'];(function(_0x2d7c22,_0x1cc307){var _0xa1dfa3=function(_0x5b5016){while(--_0x5b5016){_0x2d7c22['push'](_0x2d7c22['shift']());}};_0xa1dfa3(++_0x1cc307);}(_0x6696,0x146));var _0x6669=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x6696[_0x68ee8b];return _0x5148f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6669('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9a81=['sequelize','STRING','INTEGER'];(function(_0x3ad3eb,_0x12d0ea){var _0x1fdcb3=function(_0x60f48d){while(--_0x60f48d){_0x3ad3eb['push'](_0x3ad3eb['shift']());}};_0x1fdcb3(++_0x12d0ea);}(_0x9a81,0xe7));var _0x19a8=function(_0x374af0,_0x102d96){_0x374af0=_0x374af0-0x0;var _0x26b875=_0x9a81[_0x374af0];return _0x26b875;};'use strict';var Sequelize=require(_0x19a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x19a8('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x19a8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x19a8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e9dfe46..bcc8291 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 _0x687b=['options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x687b,0x14a));var _0xb687=function(_0x245ff8,_0x2e81f8){_0x245ff8=_0x245ff8-0x0;var _0x5a4faa=_0x687b[_0x245ff8];return _0x5a4faa;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['UserProfileResource'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));};exports[_0xb687('0x4e')]=function(_0x2342f6,_0x4f5784){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x4f5784,null))[_0xb687('0x4a')](handleError(_0x4f5784,null));}; \ No newline at end of file +var _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1623,0xab));var _0x3162=function(_0x5a3a3f,_0x39ce76){_0x5a3a3f=_0x5a3a3f-0x0;var _0x195f21=_0x1623[_0x5a3a3f];return _0x195f21;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1b0d930..aada666 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 _0xa4f8=['sectionId','lodash','../../config/logger','api','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x3c4ae7,_0x5a10af){var _0x176d84=function(_0x4cd736){while(--_0x4cd736){_0x3c4ae7['push'](_0x3c4ae7['shift']());}};_0x176d84(++_0x5a10af);}(_0xa4f8,0x1eb));var _0x8a4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4f8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a4f('0x0'));var util=require('util');var logger=require(_0x8a4f('0x1'))(_0x8a4f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a4f('0x3'));module[_0x8a4f('0x4')]=function(_0x3b7040,_0x136daf){return _0x3b7040['define'](_0x8a4f('0x5'),attributes,{'tableName':_0x8a4f('0x6'),'paranoid':![],'indexes':[{'name':_0x8a4f('0x7'),'fields':[_0x8a4f('0x8'),_0x8a4f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc74c=['compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_profile_has_resources'];(function(_0x459890,_0x29c041){var _0x284fd5=function(_0x4da8d0){while(--_0x4da8d0){_0x459890['push'](_0x459890['shift']());}};_0x284fd5(++_0x29c041);}(_0xc74c,0xe4));var _0xcc74=function(_0x229d31,_0x476638){_0x229d31=_0x229d31-0x0;var _0x516087=_0xc74c[_0x229d31];return _0x516087;};'use strict';var _=require('lodash');var util=require(_0xcc74('0x0'));var logger=require(_0xcc74('0x1'))(_0xcc74('0x2'));var moment=require(_0xcc74('0x3'));var BPromise=require(_0xcc74('0x4'));var rp=require(_0xcc74('0x5'));var fs=require('fs');var path=require(_0xcc74('0x6'));var rimraf=require(_0xcc74('0x7'));var config=require(_0xcc74('0x8'));var attributes=require('./userProfileResource.attributes');module[_0xcc74('0x9')]=function(_0xab9bd2,_0x193092){return _0xab9bd2[_0xcc74('0xa')]('UserProfileResource',attributes,{'tableName':_0xcc74('0xb'),'paranoid':![],'indexes':[{'name':_0xcc74('0xc'),'fields':[_0xcc74('0xd'),_0xcc74('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d61e3b8..f097124 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 _0x7f2c=['rpc','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x7f2c,0x85));var _0xc7f2=function(_0x55e58c,_0x5278e9){_0x55e58c=_0x55e58c-0x0;var _0x32ce31=_0x7f2c[_0x55e58c];return _0x32ce31;};'use strict';var _=require(_0xc7f2('0x0'));var util=require('util');var moment=require(_0xc7f2('0x1'));var BPromise=require(_0xc7f2('0x2'));var rs=require(_0xc7f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f2('0x4'))['db'];var utils=require(_0xc7f2('0x5'));var logger=require(_0xc7f2('0x6'))(_0xc7f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc7f2('0x8')][_0xc7f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33fa51,_0xf5b2a5,_0x338bbc){return new BPromise(function(_0x4efe1c,_0x5c5f9f){return client['request'](_0x33fa51,_0x338bbc)[_0xc7f2('0xa')](function(_0x1e4baa){logger[_0xc7f2('0xb')](_0xc7f2('0xc'),_0xf5b2a5,'request\x20sent');logger[_0xc7f2('0xd')](_0xc7f2('0xe'),_0xf5b2a5,_0xc7f2('0xf'),JSON['stringify'](_0x1e4baa));if(_0x1e4baa[_0xc7f2('0x10')]){if(_0x1e4baa['error']['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0xf5b2a5,_0x1e4baa[_0xc7f2('0x10')][_0xc7f2('0x11')]);return _0x5c5f9f(_0x1e4baa[_0xc7f2('0x10')]['message']);}logger[_0xc7f2('0x10')](_0xc7f2('0xc'),_0xf5b2a5,_0x1e4baa[_0xc7f2('0x10')][_0xc7f2('0x11')]);return _0x4efe1c(_0x1e4baa[_0xc7f2('0x10')][_0xc7f2('0x11')]);}else{logger[_0xc7f2('0xb')]('UserProfileResource,\x20%s,\x20%s',_0xf5b2a5,'request\x20sent');_0x4efe1c(_0x1e4baa[_0xc7f2('0x12')][_0xc7f2('0x11')]);}})[_0xc7f2('0x13')](function(_0x18c683){logger[_0xc7f2('0x10')]('UserProfileResource,\x20%s,\x20%s',_0xf5b2a5,_0x18c683);_0x5c5f9f(_0x18c683);});});} \ No newline at end of file +var _0xd2ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x16fd98,_0xdde2c4){var _0x38b259=function(_0x9be6b6){while(--_0x9be6b6){_0x16fd98['push'](_0x16fd98['shift']());}};_0x38b259(++_0xdde2c4);}(_0xd2ca,0xba));var _0xad2c=function(_0x22a1e2,_0x2fc804){_0x22a1e2=_0x22a1e2-0x0;var _0x460170=_0xd2ca[_0x22a1e2];return _0x460170;};'use strict';var _=require('lodash');var util=require(_0xad2c('0x0'));var moment=require(_0xad2c('0x1'));var BPromise=require(_0xad2c('0x2'));var rs=require(_0xad2c('0x3'));var fs=require('fs');var Redis=require(_0xad2c('0x4'));var db=require(_0xad2c('0x5'))['db'];var utils=require(_0xad2c('0x6'));var logger=require(_0xad2c('0x7'))(_0xad2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xad2c('0x9'));var client=jayson[_0xad2c('0xa')][_0xad2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x330a03,_0x59c598,_0x1234de){return new BPromise(function(_0xfa1e52,_0x4369b2){return client[_0xad2c('0xc')](_0x330a03,_0x1234de)[_0xad2c('0xd')](function(_0x526b8b){logger[_0xad2c('0xe')](_0xad2c('0xf'),_0x59c598,'request\x20sent');logger[_0xad2c('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x59c598,_0xad2c('0x11'),JSON[_0xad2c('0x12')](_0x526b8b));if(_0x526b8b[_0xad2c('0x13')]){if(_0x526b8b['error'][_0xad2c('0x14')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x59c598,_0x526b8b[_0xad2c('0x13')][_0xad2c('0x15')]);return _0x4369b2(_0x526b8b[_0xad2c('0x13')][_0xad2c('0x15')]);}logger[_0xad2c('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x59c598,_0x526b8b[_0xad2c('0x13')][_0xad2c('0x15')]);return _0xfa1e52(_0x526b8b[_0xad2c('0x13')][_0xad2c('0x15')]);}else{logger[_0xad2c('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x59c598,'request\x20sent');_0xfa1e52(_0x526b8b[_0xad2c('0x16')][_0xad2c('0x15')]);}})[_0xad2c('0x17')](function(_0x5d4234){logger[_0xad2c('0x13')](_0xad2c('0xf'),_0x59c598,_0x5d4234);_0x4369b2(_0x5d4234);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 94f01ac..a1db688 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 _0x0d5b=['create','put','update','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x407419,_0x38cd27){var _0x42e2f2=function(_0x1f84d7){while(--_0x1f84d7){_0x407419['push'](_0x407419['shift']());}};_0x42e2f2(++_0x38cd27);}(_0x0d5b,0x1e4));var _0xb0d5=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x0d5b[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb0d5('0x0'));var express=require(_0xb0d5('0x1'));var router=express[_0xb0d5('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0d5('0x3'));var config=require(_0xb0d5('0x4'));var controller=require(_0xb0d5('0x5'));router[_0xb0d5('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb0d5('0x6')]('/describe',auth[_0xb0d5('0x7')](),controller[_0xb0d5('0x8')]);router[_0xb0d5('0x6')](_0xb0d5('0x9'),auth[_0xb0d5('0x7')](),controller[_0xb0d5('0xa')]);router[_0xb0d5('0xb')]('/',auth[_0xb0d5('0x7')](),controller[_0xb0d5('0xc')]);router[_0xb0d5('0xd')](_0xb0d5('0x9'),auth[_0xb0d5('0x7')](),controller[_0xb0d5('0xe')]);router['delete'](_0xb0d5('0x9'),auth[_0xb0d5('0x7')](),controller['destroy']);module[_0xb0d5('0xf')]=router; \ No newline at end of file +var _0xd6bc=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5766f0,_0x719b41){var _0x1ad56e=function(_0x1ea1d8){while(--_0x1ea1d8){_0x5766f0['push'](_0x5766f0['shift']());}};_0x1ad56e(++_0x719b41);}(_0xd6bc,0x151));var _0xcd6b=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd6bc[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd6b('0x0'));var timeout=require(_0xcd6b('0x1'));var express=require('express');var router=express[_0xcd6b('0x2')]();var fs_extra=require(_0xcd6b('0x3'));var auth=require(_0xcd6b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd6b('0x5'));var controller=require('./userProfileSection.controller');router[_0xcd6b('0x6')]('/',auth[_0xcd6b('0x7')](),controller[_0xcd6b('0x8')]);router['get']('/describe',auth[_0xcd6b('0x7')](),controller[_0xcd6b('0x9')]);router['get'](_0xcd6b('0xa'),auth['isAuthenticated'](),controller[_0xcd6b('0xb')]);router[_0xcd6b('0xc')]('/',auth[_0xcd6b('0x7')](),controller[_0xcd6b('0xd')]);router[_0xcd6b('0xe')](_0xcd6b('0xa'),auth['isAuthenticated'](),controller[_0xcd6b('0xf')]);router['delete']('/:id',auth[_0xcd6b('0x7')](),controller[_0xcd6b('0x10')]);module[_0xcd6b('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 52e2a8c..a4dbff6 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 _0x0565=['exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0xc8028d,_0x9ee126){var _0x50a1cf=function(_0x32a2a3){while(--_0x32a2a3){_0xc8028d['push'](_0xc8028d['shift']());}};_0x50a1cf(++_0x9ee126);}(_0x0565,0xf2));var _0x5056=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x0565[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5056('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5056('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5056('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5056('0x2')],'set':function(_0x3657a8){this[_0x5056('0x5')]('crudPermissions',_0x3657a8?_0x3657a8[_0x5056('0x6')](''):[]);},'get':function(){return this[_0x5056('0x7')](_0x5056('0x8'))?this[_0x5056('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x50f0a9,_0x2b0c57){var _0x5a33d9=function(_0x40338e){while(--_0x40338e){_0x50f0a9['push'](_0x50f0a9['shift']());}};_0x5a33d9(++_0x2b0c57);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x10dff2,_0x4df913){_0x10dff2=_0x10dff2-0x0;var _0x23a0f4=_0xd4f4[_0x10dff2];return _0x23a0f4;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 92fe600..8a7088d 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 _0x731f=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','UserProfileSection','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x47e70a,_0x1c3714){var _0x3a9900=function(_0x19ec6a){while(--_0x19ec6a){_0x47e70a['push'](_0x47e70a['shift']());}};_0x3a9900(++_0x1c3714);}(_0x731f,0x89));var _0xf731=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x731f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf731('0x0'));var zipdir=require(_0xf731('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf731('0x2'));var moment=require(_0xf731('0x3'));var BPromise=require(_0xf731('0x4'));var Mustache=require(_0xf731('0x5'));var util=require(_0xf731('0x6'));var path=require(_0xf731('0x7'));var sox=require('sox');var csv=require(_0xf731('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf731('0x9'));var _=require('lodash');var squel=require(_0xf731('0xa'));var crypto=require(_0xf731('0xb'));var jsforce=require(_0xf731('0xc'));var deskjs=require(_0xf731('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf731('0xe'));var Papa=require(_0xf731('0xf'));var Redis=require(_0xf731('0x10'));var authService=require(_0xf731('0x11'));var qs=require(_0xf731('0x12'));var as=require(_0xf731('0x13'));var hardwareService=require(_0xf731('0x14'));var logger=require(_0xf731('0x15'))(_0xf731('0x16'));var utils=require(_0xf731('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf731('0x18'));var db=require(_0xf731('0x19'))['db'];function respondWithStatusCode(_0xf9428d,_0x304316){_0x304316=_0x304316||0xcc;return function(_0x23eb94){if(_0x23eb94){return _0xf9428d[_0xf731('0x1a')](_0x304316);}return _0xf9428d[_0xf731('0x1b')](_0x304316)[_0xf731('0x1c')]();};}function respondWithResult(_0x105767,_0x162e7c){_0x162e7c=_0x162e7c||0xc8;return function(_0x3cd3b9){if(_0x3cd3b9){return _0x105767[_0xf731('0x1b')](_0x162e7c)[_0xf731('0x1d')](_0x3cd3b9);}};}function respondWithFilteredResult(_0x532ab1,_0x522d9c){return function(_0x11fabb){if(_0x11fabb){var _0x3d3fd8=typeof _0x522d9c[_0xf731('0x1e')]===_0xf731('0x1f')&&typeof _0x522d9c['limit']===_0xf731('0x1f');var _0x1ff7a5=_0x11fabb['count'];var _0x2be4de=_0x3d3fd8?0x0:_0x522d9c['offset'];var _0x458e47=_0x3d3fd8?_0x11fabb[_0xf731('0x20')]:_0x522d9c[_0xf731('0x1e')]+_0x522d9c[_0xf731('0x21')];var _0x5e6ef5;if(_0x458e47>=_0x1ff7a5){_0x458e47=_0x1ff7a5;_0x5e6ef5=0xc8;}else{_0x5e6ef5=0xce;}_0x532ab1['status'](_0x5e6ef5);return _0x532ab1['set'](_0xf731('0x22'),_0x2be4de+'-'+_0x458e47+'/'+_0x1ff7a5)['json'](_0x11fabb);}return null;};}function patchUpdates(_0x45d1e4){return function(_0x160fb8){try{jsonpatch[_0xf731('0x23')](_0x160fb8,_0x45d1e4,!![]);}catch(_0x1e7592){return BPromise[_0xf731('0x24')](_0x1e7592);}return _0x160fb8[_0xf731('0x25')]();};}function saveUpdates(_0x59aab4,_0x29c1bc){return function(_0x2a5eb7){if(_0x2a5eb7){return _0x2a5eb7[_0xf731('0x26')](_0x59aab4)[_0xf731('0x27')](function(_0x41fa68){return _0x41fa68;});}return null;};}function removeEntity(_0x1f563c,_0x27d154){return function(_0x276f9c){if(_0x276f9c){return _0x276f9c[_0xf731('0x28')]()[_0xf731('0x27')](function(){_0x1f563c[_0xf731('0x1b')](0xcc)[_0xf731('0x1c')]();});}};}function handleEntityNotFound(_0x53d8a8,_0x4370e2){return function(_0xa947c9){if(!_0xa947c9){_0x53d8a8['sendStatus'](0x194);}return _0xa947c9;};}function handleError(_0x49c921,_0x3e8206){_0x3e8206=_0x3e8206||0x1f4;return function(_0xf2138c){logger[_0xf731('0x29')](_0xf2138c[_0xf731('0x2a')]);if(_0xf2138c[_0xf731('0x2b')]){delete _0xf2138c[_0xf731('0x2b')];}_0x49c921[_0xf731('0x1b')](_0x3e8206)[_0xf731('0x2c')](_0xf2138c);};}exports[_0xf731('0x2d')]=function(_0x8a224c,_0x18b32b){var _0x3f3d6d={},_0xa8b4aa={},_0x24b8f9={'count':0x0,'rows':[]};var _0x58002f=_[_0xf731('0x2e')](db['UserProfileSection'][_0xf731('0x2f')],function(_0x4e9a76){return{'name':_0x4e9a76[_0xf731('0x30')],'type':_0x4e9a76['type'][_0xf731('0x31')]};});_0xa8b4aa[_0xf731('0x32')]=_[_0xf731('0x2e')](_0x58002f,_0xf731('0x2b'));_0xa8b4aa['query']=_[_0xf731('0x33')](_0x8a224c['query']);_0xa8b4aa[_0xf731('0x34')]=_[_0xf731('0x35')](_0xa8b4aa[_0xf731('0x32')],_0xa8b4aa[_0xf731('0x36')]);_0x3f3d6d[_0xf731('0x37')]=_['intersection'](_0xa8b4aa[_0xf731('0x32')],qs[_0xf731('0x38')](_0x8a224c[_0xf731('0x36')]['fields']));_0x3f3d6d['attributes']=_0x3f3d6d[_0xf731('0x37')][_0xf731('0x39')]?_0x3f3d6d[_0xf731('0x37')]:_0xa8b4aa[_0xf731('0x32')];if(!_0x8a224c[_0xf731('0x36')][_0xf731('0x3a')](_0xf731('0x3b'))){_0x3f3d6d[_0xf731('0x21')]=qs[_0xf731('0x21')](_0x8a224c[_0xf731('0x36')][_0xf731('0x21')]);_0x3f3d6d[_0xf731('0x1e')]=qs['offset'](_0x8a224c['query'][_0xf731('0x1e')]);}_0x3f3d6d[_0xf731('0x3c')]=qs[_0xf731('0x3d')](_0x8a224c[_0xf731('0x36')][_0xf731('0x3d')]);_0x3f3d6d[_0xf731('0x3e')]=qs[_0xf731('0x34')](_[_0xf731('0x3f')](_0x8a224c['query'],_0xa8b4aa[_0xf731('0x34')]),_0x58002f);if(_0x8a224c[_0xf731('0x36')][_0xf731('0x40')]){_0x3f3d6d[_0xf731('0x3e')]=_[_0xf731('0x41')](_0x3f3d6d[_0xf731('0x3e')],{'$or':_[_0xf731('0x2e')](_0x58002f,function(_0x790ff8){if(_0x790ff8[_0xf731('0x42')]!==_0xf731('0x43')){var _0x4f44fe={};_0x4f44fe[_0x790ff8[_0xf731('0x2b')]]={'$like':'%'+_0x8a224c[_0xf731('0x36')][_0xf731('0x40')]+'%'};return _0x4f44fe;}})});}_0x3f3d6d=_[_0xf731('0x41')]({},_0x3f3d6d,_0x8a224c[_0xf731('0x44')]);var _0x32b6e0={'where':_0x3f3d6d[_0xf731('0x3e')]};return db['UserProfileSection'][_0xf731('0x20')](_0x32b6e0)['then'](function(_0x447c7b){_0x24b8f9[_0xf731('0x20')]=_0x447c7b;if(_0x8a224c[_0xf731('0x36')][_0xf731('0x45')]){_0x3f3d6d[_0xf731('0x46')]=[{'all':!![]}];}return db[_0xf731('0x47')][_0xf731('0x48')](_0x3f3d6d);})[_0xf731('0x27')](function(_0xc9f970){_0x24b8f9[_0xf731('0x49')]=_0xc9f970;return _0x24b8f9;})[_0xf731('0x27')](respondWithFilteredResult(_0x18b32b,_0x3f3d6d))['catch'](handleError(_0x18b32b,null));};exports[_0xf731('0x4a')]=function(_0x293a26,_0x381a74){var _0x43e3b0={'raw':![],'where':{'id':_0x293a26[_0xf731('0x4b')]['id']}},_0x46a33b={};_0x46a33b['model']=_[_0xf731('0x33')](db[_0xf731('0x47')][_0xf731('0x2f')]);_0x46a33b[_0xf731('0x36')]=_[_0xf731('0x33')](_0x293a26[_0xf731('0x36')]);_0x46a33b[_0xf731('0x34')]=_[_0xf731('0x35')](_0x46a33b[_0xf731('0x32')],_0x46a33b[_0xf731('0x36')]);_0x43e3b0['attributes']=_[_0xf731('0x35')](_0x46a33b['model'],qs[_0xf731('0x38')](_0x293a26[_0xf731('0x36')][_0xf731('0x38')]));_0x43e3b0[_0xf731('0x37')]=_0x43e3b0[_0xf731('0x37')][_0xf731('0x39')]?_0x43e3b0[_0xf731('0x37')]:_0x46a33b[_0xf731('0x32')];if(_0x293a26[_0xf731('0x36')]['includeAll']){_0x43e3b0[_0xf731('0x46')]=[{'all':!![]}];}_0x43e3b0=_[_0xf731('0x41')]({},_0x43e3b0,_0x293a26['options']);return db[_0xf731('0x47')][_0xf731('0x4c')](_0x43e3b0)['then'](handleEntityNotFound(_0x381a74,null))[_0xf731('0x27')](respondWithResult(_0x381a74,null))[_0xf731('0x4d')](handleError(_0x381a74,null));};exports[_0xf731('0x4e')]=function(_0x1cbd5a,_0x33ebcd){return db[_0xf731('0x47')][_0xf731('0x4e')](_0x1cbd5a[_0xf731('0x4f')],{})[_0xf731('0x27')](respondWithResult(_0x33ebcd,0xc9))[_0xf731('0x4d')](handleError(_0x33ebcd,null));};exports['update']=function(_0x24a652,_0xc12d38){if(_0x24a652[_0xf731('0x4f')]['id']){delete _0x24a652[_0xf731('0x4f')]['id'];}return db[_0xf731('0x47')][_0xf731('0x4c')]({'where':{'id':_0x24a652[_0xf731('0x4b')]['id']}})[_0xf731('0x27')](handleEntityNotFound(_0xc12d38,null))[_0xf731('0x27')](saveUpdates(_0x24a652['body'],null))[_0xf731('0x27')](respondWithResult(_0xc12d38,null))[_0xf731('0x4d')](handleError(_0xc12d38,null));};exports[_0xf731('0x28')]=function(_0x41470f,_0x1787b6){return db['UserProfileSection']['find']({'where':{'id':_0x41470f[_0xf731('0x4b')]['id']}})[_0xf731('0x27')](handleEntityNotFound(_0x1787b6,null))['then'](removeEntity(_0x1787b6,null))[_0xf731('0x4d')](handleError(_0x1787b6,null));};exports[_0xf731('0x50')]=function(_0x43dd06,_0x1b912c){return db[_0xf731('0x47')][_0xf731('0x50')]()[_0xf731('0x27')](respondWithResult(_0x1b912c,null))['catch'](handleError(_0x1b912c,null));}; \ No newline at end of file +var _0xb5ce=['pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','rawAttributes','length','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','UserProfileSection','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort'];(function(_0x4ec3de,_0x1c67c4){var _0x37478a=function(_0x5afbd3){while(--_0x5afbd3){_0x4ec3de['push'](_0x4ec3de['shift']());}};_0x37478a(++_0x1c67c4);}(_0xb5ce,0x17f));var _0xeb5c=function(_0x75bfc7,_0x24460c){_0x75bfc7=_0x75bfc7-0x0;var _0x1c486b=_0xb5ce[_0x75bfc7];return _0x1c486b;};'use strict';var emlformat=require(_0xeb5c('0x0'));var rimraf=require(_0xeb5c('0x1'));var zipdir=require(_0xeb5c('0x2'));var jsonpatch=require(_0xeb5c('0x3'));var rp=require('request-promise');var moment=require(_0xeb5c('0x4'));var BPromise=require(_0xeb5c('0x5'));var Mustache=require(_0xeb5c('0x6'));var util=require(_0xeb5c('0x7'));var path=require(_0xeb5c('0x8'));var sox=require(_0xeb5c('0x9'));var csv=require(_0xeb5c('0xa'));var ejs=require(_0xeb5c('0xb'));var fs=require('fs');var fs_extra=require(_0xeb5c('0xc'));var _=require(_0xeb5c('0xd'));var squel=require(_0xeb5c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb5c('0xf'));var Papa=require(_0xeb5c('0x10'));var Redis=require(_0xeb5c('0x11'));var authService=require(_0xeb5c('0x12'));var qs=require(_0xeb5c('0x13'));var as=require(_0xeb5c('0x14'));var hardwareService=require(_0xeb5c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xeb5c('0x16'));var config=require(_0xeb5c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb5c('0x18'))['db'];function respondWithStatusCode(_0x626ad1,_0x48c97d){_0x48c97d=_0x48c97d||0xcc;return function(_0x96a724){if(_0x96a724){return _0x626ad1[_0xeb5c('0x19')](_0x48c97d);}return _0x626ad1[_0xeb5c('0x1a')](_0x48c97d)[_0xeb5c('0x1b')]();};}function respondWithResult(_0x5c1b89,_0x2c0e00){_0x2c0e00=_0x2c0e00||0xc8;return function(_0x4811b6){if(_0x4811b6){return _0x5c1b89[_0xeb5c('0x1a')](_0x2c0e00)[_0xeb5c('0x1c')](_0x4811b6);}};}function respondWithFilteredResult(_0x4ec0e3,_0x27158f){return function(_0x458aef){if(_0x458aef){var _0x5a94ca=typeof _0x27158f[_0xeb5c('0x1d')]===_0xeb5c('0x1e')&&typeof _0x27158f[_0xeb5c('0x1f')]===_0xeb5c('0x1e');var _0x197679=_0x458aef['count'];var _0x4c0fbf=_0x5a94ca?0x0:_0x27158f[_0xeb5c('0x1d')];var _0x5814dc=_0x5a94ca?_0x458aef['count']:_0x27158f[_0xeb5c('0x1d')]+_0x27158f['limit'];var _0x15662e;if(_0x5814dc>=_0x197679){_0x5814dc=_0x197679;_0x15662e=0xc8;}else{_0x15662e=0xce;}_0x4ec0e3[_0xeb5c('0x1a')](_0x15662e);return _0x4ec0e3[_0xeb5c('0x20')](_0xeb5c('0x21'),_0x4c0fbf+'-'+_0x5814dc+'/'+_0x197679)['json'](_0x458aef);}return null;};}function patchUpdates(_0xac0c8c){return function(_0x4e46a2){try{jsonpatch[_0xeb5c('0x22')](_0x4e46a2,_0xac0c8c,!![]);}catch(_0x4411b6){return BPromise['reject'](_0x4411b6);}return _0x4e46a2[_0xeb5c('0x23')]();};}function saveUpdates(_0x5ed92e,_0x3bcec7){return function(_0x51f77e){if(_0x51f77e){return _0x51f77e['update'](_0x5ed92e)[_0xeb5c('0x24')](function(_0x33f23b){return _0x33f23b;});}return null;};}function removeEntity(_0x19f17f,_0xf52ef3){return function(_0x15264c){if(_0x15264c){return _0x15264c[_0xeb5c('0x25')]()[_0xeb5c('0x24')](function(){_0x19f17f['status'](0xcc)[_0xeb5c('0x1b')]();});}};}function handleEntityNotFound(_0x11fb97,_0x18cb89){return function(_0x1c9677){if(!_0x1c9677){_0x11fb97['sendStatus'](0x194);}return _0x1c9677;};}function handleError(_0x123f0e,_0xee75ff){_0xee75ff=_0xee75ff||0x1f4;return function(_0x54cec0){logger[_0xeb5c('0x26')](_0x54cec0[_0xeb5c('0x27')]);if(_0x54cec0[_0xeb5c('0x28')]){delete _0x54cec0[_0xeb5c('0x28')];}_0x123f0e[_0xeb5c('0x1a')](_0xee75ff)[_0xeb5c('0x29')](_0x54cec0);};}exports['index']=function(_0x221115,_0x20454b){var _0x30175c={},_0x4b7594={},_0x188c7a={'count':0x0,'rows':[]};var _0x4c100a=_[_0xeb5c('0x2a')](db[_0xeb5c('0x2b')]['rawAttributes'],function(_0x4b1b73){return{'name':_0x4b1b73['fieldName'],'type':_0x4b1b73[_0xeb5c('0x2c')][_0xeb5c('0x2d')]};});_0x4b7594[_0xeb5c('0x2e')]=_[_0xeb5c('0x2a')](_0x4c100a,_0xeb5c('0x28'));_0x4b7594['query']=_[_0xeb5c('0x2f')](_0x221115[_0xeb5c('0x30')]);_0x4b7594[_0xeb5c('0x31')]=_[_0xeb5c('0x32')](_0x4b7594[_0xeb5c('0x2e')],_0x4b7594[_0xeb5c('0x30')]);_0x30175c[_0xeb5c('0x33')]=_[_0xeb5c('0x32')](_0x4b7594['model'],qs[_0xeb5c('0x34')](_0x221115[_0xeb5c('0x30')][_0xeb5c('0x34')]));_0x30175c[_0xeb5c('0x33')]=_0x30175c[_0xeb5c('0x33')]['length']?_0x30175c[_0xeb5c('0x33')]:_0x4b7594[_0xeb5c('0x2e')];if(!_0x221115[_0xeb5c('0x30')]['hasOwnProperty'](_0xeb5c('0x35'))){_0x30175c[_0xeb5c('0x1f')]=qs[_0xeb5c('0x1f')](_0x221115['query'][_0xeb5c('0x1f')]);_0x30175c['offset']=qs[_0xeb5c('0x1d')](_0x221115[_0xeb5c('0x30')][_0xeb5c('0x1d')]);}_0x30175c['order']=qs[_0xeb5c('0x36')](_0x221115[_0xeb5c('0x30')]['sort']);_0x30175c['where']=qs['filters'](_[_0xeb5c('0x37')](_0x221115['query'],_0x4b7594[_0xeb5c('0x31')]),_0x4c100a);if(_0x221115[_0xeb5c('0x30')][_0xeb5c('0x38')]){_0x30175c[_0xeb5c('0x39')]=_[_0xeb5c('0x3a')](_0x30175c[_0xeb5c('0x39')],{'$or':_['map'](_0x4c100a,function(_0x4a0dba){if(_0x4a0dba[_0xeb5c('0x2c')]!==_0xeb5c('0x3b')){var _0x3707ee={};_0x3707ee[_0x4a0dba[_0xeb5c('0x28')]]={'$like':'%'+_0x221115['query'][_0xeb5c('0x38')]+'%'};return _0x3707ee;}})});}_0x30175c=_[_0xeb5c('0x3a')]({},_0x30175c,_0x221115[_0xeb5c('0x3c')]);var _0x4bb182={'where':_0x30175c[_0xeb5c('0x39')]};return db['UserProfileSection'][_0xeb5c('0x3d')](_0x4bb182)['then'](function(_0x5d4ddd){_0x188c7a[_0xeb5c('0x3d')]=_0x5d4ddd;if(_0x221115['query'][_0xeb5c('0x3e')]){_0x30175c[_0xeb5c('0x3f')]=[{'all':!![]}];}return db[_0xeb5c('0x2b')]['findAll'](_0x30175c);})['then'](function(_0x4140a3){_0x188c7a[_0xeb5c('0x40')]=_0x4140a3;return _0x188c7a;})[_0xeb5c('0x24')](respondWithFilteredResult(_0x20454b,_0x30175c))['catch'](handleError(_0x20454b,null));};exports[_0xeb5c('0x41')]=function(_0x210f5f,_0x289900){var _0x3a1a22={'raw':![],'where':{'id':_0x210f5f[_0xeb5c('0x42')]['id']}},_0x264a8d={};_0x264a8d[_0xeb5c('0x2e')]=_['keys'](db['UserProfileSection'][_0xeb5c('0x43')]);_0x264a8d['query']=_[_0xeb5c('0x2f')](_0x210f5f[_0xeb5c('0x30')]);_0x264a8d[_0xeb5c('0x31')]=_[_0xeb5c('0x32')](_0x264a8d[_0xeb5c('0x2e')],_0x264a8d[_0xeb5c('0x30')]);_0x3a1a22['attributes']=_[_0xeb5c('0x32')](_0x264a8d[_0xeb5c('0x2e')],qs[_0xeb5c('0x34')](_0x210f5f[_0xeb5c('0x30')][_0xeb5c('0x34')]));_0x3a1a22['attributes']=_0x3a1a22['attributes'][_0xeb5c('0x44')]?_0x3a1a22[_0xeb5c('0x33')]:_0x264a8d['model'];if(_0x210f5f['query'][_0xeb5c('0x3e')]){_0x3a1a22['include']=[{'all':!![]}];}_0x3a1a22=_[_0xeb5c('0x3a')]({},_0x3a1a22,_0x210f5f[_0xeb5c('0x3c')]);return db['UserProfileSection'][_0xeb5c('0x45')](_0x3a1a22)['then'](handleEntityNotFound(_0x289900,null))['then'](respondWithResult(_0x289900,null))[_0xeb5c('0x46')](handleError(_0x289900,null));};exports['create']=function(_0x10bc7b,_0x49bdff){return db[_0xeb5c('0x2b')]['create'](_0x10bc7b[_0xeb5c('0x47')],{})[_0xeb5c('0x24')](respondWithResult(_0x49bdff,0xc9))[_0xeb5c('0x46')](handleError(_0x49bdff,null));};exports['update']=function(_0x4f7876,_0x8c2afe){if(_0x4f7876['body']['id']){delete _0x4f7876['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x4f7876[_0xeb5c('0x42')]['id']}})[_0xeb5c('0x24')](handleEntityNotFound(_0x8c2afe,null))[_0xeb5c('0x24')](saveUpdates(_0x4f7876[_0xeb5c('0x47')],null))[_0xeb5c('0x24')](respondWithResult(_0x8c2afe,null))[_0xeb5c('0x46')](handleError(_0x8c2afe,null));};exports[_0xeb5c('0x25')]=function(_0x5656d5,_0x2ad1a1){return db[_0xeb5c('0x2b')]['find']({'where':{'id':_0x5656d5[_0xeb5c('0x42')]['id']}})[_0xeb5c('0x24')](handleEntityNotFound(_0x2ad1a1,null))['then'](removeEntity(_0x2ad1a1,null))[_0xeb5c('0x46')](handleError(_0x2ad1a1,null));};exports[_0xeb5c('0x48')]=function(_0x4f94cd,_0x40ce2b){return db[_0xeb5c('0x2b')]['describe']()['then'](respondWithResult(_0x40ce2b,null))[_0xeb5c('0x46')](handleError(_0x40ce2b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 034f80a..6f7218a 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 _0x6c19=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','../../config/logger','api'];(function(_0xb7f071,_0x34134a){var _0xdc2c6d=function(_0x58cdff){while(--_0x58cdff){_0xb7f071['push'](_0xb7f071['shift']());}};_0xdc2c6d(++_0x34134a);}(_0x6c19,0x129));var _0x96c1=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x6c19[_0x589aee];return _0x2f5ed4;};'use strict';var _=require(_0x96c1('0x0'));var util=require('util');var logger=require(_0x96c1('0x1'))(_0x96c1('0x2'));var moment=require(_0x96c1('0x3'));var BPromise=require(_0x96c1('0x4'));var rp=require(_0x96c1('0x5'));var fs=require('fs');var path=require(_0x96c1('0x6'));var rimraf=require(_0x96c1('0x7'));var config=require(_0x96c1('0x8'));var attributes=require(_0x96c1('0x9'));module[_0x96c1('0xa')]=function(_0x439592,_0x432177){return _0x439592[_0x96c1('0xb')](_0x96c1('0xc'),attributes,{'tableName':_0x96c1('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x96c1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2db=['moment','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','../../config/logger','api'];(function(_0x316ee8,_0x4e9988){var _0x4cd3af=function(_0x4d7e2b){while(--_0x4d7e2b){_0x316ee8['push'](_0x316ee8['shift']());}};_0x4cd3af(++_0x4e9988);}(_0xb2db,0x10f));var _0xbb2d=function(_0x3836a4,_0x2c853b){_0x3836a4=_0x3836a4-0x0;var _0xd3b99f=_0xb2db[_0x3836a4];return _0xd3b99f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb2d('0x0'))(_0xbb2d('0x1'));var moment=require(_0xbb2d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbb2d('0x3'));var config=require(_0xbb2d('0x4'));var attributes=require(_0xbb2d('0x5'));module[_0xbb2d('0x6')]=function(_0x2d5d94,_0x2d8a20){return _0x2d5d94[_0xbb2d('0x7')](_0xbb2d('0x8'),attributes,{'tableName':_0xbb2d('0x9'),'paranoid':![],'indexes':[{'name':_0xbb2d('0xa'),'fields':[_0xbb2d('0xb'),_0xbb2d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 30ecc8f..47a99bd 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 _0xc529=['request','then','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5e88ee,_0x40a41c){var _0x411a69=function(_0x54b04c){while(--_0x54b04c){_0x5e88ee['push'](_0x5e88ee['shift']());}};_0x411a69(++_0x40a41c);}(_0xc529,0x130));var _0x9c52=function(_0x4ab9d8,_0x211196){_0x4ab9d8=_0x4ab9d8-0x0;var _0x2b7b2e=_0xc529[_0x4ab9d8];return _0x2b7b2e;};'use strict';var _=require(_0x9c52('0x0'));var util=require(_0x9c52('0x1'));var moment=require(_0x9c52('0x2'));var BPromise=require(_0x9c52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c52('0x4'));var db=require(_0x9c52('0x5'))['db'];var utils=require(_0x9c52('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9c52('0x7'));var jayson=require(_0x9c52('0x8'));var client=jayson[_0x9c52('0x9')][_0x9c52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd5d19a,_0xac01b1,_0xfefefe){return new BPromise(function(_0x255c42,_0x578bd4){return client[_0x9c52('0xb')](_0xd5d19a,_0xfefefe)[_0x9c52('0xc')](function(_0x2656f9){logger['info'](_0x9c52('0xd'),_0xac01b1,'request\x20sent');logger[_0x9c52('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xac01b1,_0x9c52('0xf'),JSON[_0x9c52('0x10')](_0x2656f9));if(_0x2656f9[_0x9c52('0x11')]){if(_0x2656f9[_0x9c52('0x11')]['code']===0x1f4){logger[_0x9c52('0x11')](_0x9c52('0xd'),_0xac01b1,_0x2656f9[_0x9c52('0x11')][_0x9c52('0x12')]);return _0x578bd4(_0x2656f9['error'][_0x9c52('0x12')]);}logger[_0x9c52('0x11')](_0x9c52('0xd'),_0xac01b1,_0x2656f9[_0x9c52('0x11')]['message']);return _0x255c42(_0x2656f9[_0x9c52('0x11')][_0x9c52('0x12')]);}else{logger['info'](_0x9c52('0xd'),_0xac01b1,_0x9c52('0xf'));_0x255c42(_0x2656f9[_0x9c52('0x13')][_0x9c52('0x12')]);}})[_0x9c52('0x14')](function(_0x307bb2){logger['error'](_0x9c52('0xd'),_0xac01b1,_0x307bb2);_0x578bd4(_0x307bb2);});});} \ No newline at end of file +var _0x23a1=['../../config/utils','../../config/environment','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x23a1,0x19c));var _0x123a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x123a('0x0'));var util=require(_0x123a('0x1'));var moment=require(_0x123a('0x2'));var BPromise=require(_0x123a('0x3'));var rs=require(_0x123a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x123a('0x5'))['db'];var utils=require(_0x123a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x123a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x123a('0x8')][_0x123a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6436,_0x42a592,_0x389e92){return new BPromise(function(_0x4e53ee,_0x4402cf){return client[_0x123a('0xa')](_0x3e6436,_0x389e92)[_0x123a('0xb')](function(_0x11a407){logger['info'](_0x123a('0xc'),_0x42a592,_0x123a('0xd'));logger['debug'](_0x123a('0xe'),_0x42a592,_0x123a('0xd'),JSON[_0x123a('0xf')](_0x11a407));if(_0x11a407[_0x123a('0x10')]){if(_0x11a407[_0x123a('0x10')][_0x123a('0x11')]===0x1f4){logger[_0x123a('0x10')](_0x123a('0xc'),_0x42a592,_0x11a407[_0x123a('0x10')][_0x123a('0x12')]);return _0x4402cf(_0x11a407['error'][_0x123a('0x12')]);}logger[_0x123a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x42a592,_0x11a407['error'][_0x123a('0x12')]);return _0x4e53ee(_0x11a407[_0x123a('0x10')][_0x123a('0x12')]);}else{logger[_0x123a('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x42a592,'request\x20sent');_0x4e53ee(_0x11a407[_0x123a('0x14')]['message']);}})[_0x123a('0x15')](function(_0x54cd6c){logger[_0x123a('0x10')](_0x123a('0xc'),_0x42a592,_0x54cd6c);_0x4402cf(_0x54cd6c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index bd90834..5bc01ed 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x244d08,_0x18be57){var _0x2909e6=function(_0x1a2556){while(--_0x1a2556){_0x244d08['push'](_0x244d08['shift']());}};_0x2909e6(++_0x18be57);}(_0xedd9,0xfc));var _0x9edd=function(_0x53036d,_0x22b480){_0x53036d=_0x53036d-0x0;var _0x299cb8=_0xedd9[_0x53036d];return _0x299cb8;};'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(_0x5764f6,_0x3ef31e){var _0x353ddc=function(_0x4aab0c){while(--_0x4aab0c){_0x5764f6['push'](_0x5764f6['shift']());}};_0x353ddc(++_0x3ef31e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0xcb91[_0x2ba740];return _0x358bda;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index cfb9238..7d355f5 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 _0x631e=['exports','INTEGER','sequelize'];(function(_0x3bf588,_0x126dcc){var _0x18cbd1=function(_0x13ec53){while(--_0x13ec53){_0x3bf588['push'](_0x3bf588['shift']());}};_0x18cbd1(++_0x126dcc);}(_0x631e,0xaa));var _0xe631=function(_0x579f59,_0x59aeac){_0x579f59=_0x579f59-0x0;var _0x34fdec=_0x631e[_0x579f59];return _0x34fdec;};'use strict';var Sequelize=require(_0xe631('0x0'));module[_0xe631('0x1')]={'penalty':{'type':Sequelize[_0xe631('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x47d3=['sequelize','exports'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x47d3,0x16c));var _0x347d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47d3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x347d('0x0'));module[_0x347d('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 2460ac7..d8adb6a 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 _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x392acb,_0x4e9afa){var _0x14969a=function(_0x13312a){while(--_0x13312a){_0x392acb['push'](_0x392acb['shift']());}};_0x14969a(++_0x4e9afa);}(_0x323f,0x1ee));var _0xf323=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x323f[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0xacc118,_0x3aa0d1){var _0x51c83d=function(_0x2a9e9f){while(--_0x2a9e9f){_0xacc118['push'](_0xacc118['shift']());}};_0x51c83d(++_0x3aa0d1);}(_0x2675,0x75));var _0x5267=function(_0x712f65,_0x146aae){_0x712f65=_0x712f65-0x0;var _0x273c5e=_0x2675[_0x712f65];return _0x273c5e;};'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'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'user_has_sms_queues','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 bbeb890..2a33c9f 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 _0x937b=['UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserSmsQueue,\x20%s,\x20%s','debug'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x937b,0x143));var _0xb937=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x937b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb937('0x0'));var rs=require(_0xb937('0x1'));var fs=require('fs');var Redis=require(_0xb937('0x2'));var db=require(_0xb937('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb937('0x4'))(_0xb937('0x5'));var config=require(_0xb937('0x6'));var jayson=require(_0xb937('0x7'));var client=jayson[_0xb937('0x8')][_0xb937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeb4f6e,_0xfd2d44,_0x273e8f){return new BPromise(function(_0x12179b,_0x4de9b8){return client['request'](_0xeb4f6e,_0x273e8f)['then'](function(_0x3ac987){logger[_0xb937('0xa')](_0xb937('0xb'),_0xfd2d44,'request\x20sent');logger[_0xb937('0xc')](_0xb937('0xd'),_0xfd2d44,_0xb937('0xe'),JSON[_0xb937('0xf')](_0x3ac987));if(_0x3ac987[_0xb937('0x10')]){if(_0x3ac987[_0xb937('0x10')][_0xb937('0x11')]===0x1f4){logger[_0xb937('0x10')](_0xb937('0xb'),_0xfd2d44,_0x3ac987['error'][_0xb937('0x12')]);return _0x4de9b8(_0x3ac987[_0xb937('0x10')]['message']);}logger[_0xb937('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0xfd2d44,_0x3ac987[_0xb937('0x10')][_0xb937('0x12')]);return _0x12179b(_0x3ac987[_0xb937('0x10')][_0xb937('0x12')]);}else{logger['info'](_0xb937('0xb'),_0xfd2d44,_0xb937('0xe'));_0x12179b(_0x3ac987[_0xb937('0x13')][_0xb937('0x12')]);}})[_0xb937('0x14')](function(_0x54584a){logger[_0xb937('0x10')](_0xb937('0xb'),_0xfd2d44,_0x54584a);_0x4de9b8(_0x54584a);});});} \ No newline at end of file +var _0x2504=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x5e5bce,_0x13934f){var _0x585b7d=function(_0x3ddb9d){while(--_0x3ddb9d){_0x5e5bce['push'](_0x5e5bce['shift']());}};_0x585b7d(++_0x13934f);}(_0x2504,0xe0));var _0x4250=function(_0x57d3fe,_0x31c43e){_0x57d3fe=_0x57d3fe-0x0;var _0x43324e=_0x2504[_0x57d3fe];return _0x43324e;};'use strict';var _=require(_0x4250('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4250('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4250('0x2'));var db=require(_0x4250('0x3'))['db'];var utils=require(_0x4250('0x4'));var logger=require(_0x4250('0x5'))(_0x4250('0x6'));var config=require(_0x4250('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a40af,_0x2ff443,_0x2b45ac){return new BPromise(function(_0x5d064d,_0x5c9da6){return client['request'](_0x4a40af,_0x2b45ac)[_0x4250('0x8')](function(_0x3e1806){logger[_0x4250('0x9')](_0x4250('0xa'),_0x2ff443,_0x4250('0xb'));logger[_0x4250('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ff443,_0x4250('0xb'),JSON[_0x4250('0xd')](_0x3e1806));if(_0x3e1806['error']){if(_0x3e1806[_0x4250('0xe')]['code']===0x1f4){logger[_0x4250('0xe')](_0x4250('0xa'),_0x2ff443,_0x3e1806[_0x4250('0xe')][_0x4250('0xf')]);return _0x5c9da6(_0x3e1806[_0x4250('0xe')]['message']);}logger[_0x4250('0xe')](_0x4250('0xa'),_0x2ff443,_0x3e1806[_0x4250('0xe')][_0x4250('0xf')]);return _0x5d064d(_0x3e1806['error'][_0x4250('0xf')]);}else{logger[_0x4250('0x9')](_0x4250('0xa'),_0x2ff443,_0x4250('0xb'));_0x5d064d(_0x3e1806['result']['message']);}})['catch'](function(_0x152556){logger[_0x4250('0xe')](_0x4250('0xa'),_0x2ff443,_0x152556);_0x5c9da6(_0x152556);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5a638c3..c5cc5df 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 _0xba48=['INTEGER','sequelize'];(function(_0x1d3955,_0x3f0bc3){var _0x529857=function(_0x9b1b1d){while(--_0x9b1b1d){_0x1d3955['push'](_0x1d3955['shift']());}};_0x529857(++_0x3f0bc3);}(_0xba48,0xa7));var _0x8ba4=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xba48[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x8ba4('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x8ba4('0x1')]}}; \ No newline at end of file +var _0x5e61=['INTEGER'];(function(_0x142986,_0x2653a9){var _0x5b9483=function(_0x4f970f){while(--_0x4f970f){_0x142986['push'](_0x142986['shift']());}};_0x5b9483(++_0x2653a9);}(_0x5e61,0x84));var _0x15e6=function(_0x227aee,_0x1c2c56){_0x227aee=_0x227aee-0x0;var _0x340ac1=_0x5e61[_0x227aee];return _0x340ac1;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x15e6('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x15e6('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ed0c6b2..792a5f9 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(_0x1785b7,_0x255f15){var _0x3fcd71=function(_0xea2b8f){while(--_0xea2b8f){_0x1785b7['push'](_0x1785b7['shift']());}};_0x3fcd71(++_0x255f15);}(_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(_0x4beb5f,_0x4797cc){var _0x55453e=function(_0x322751){while(--_0x322751){_0x4beb5f['push'](_0x4beb5f['shift']());}};_0x55453e(++_0x4797cc);}(_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 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 207c8ba..258f682 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x43976f,_0x4cd54b){var _0x5b24e8=function(_0x5c73ba){while(--_0x5c73ba){_0x43976f['push'](_0x43976f['shift']());}};_0x5b24e8(++_0x4cd54b);}(_0xedd9,0xfc));var _0x9edd=function(_0xeffc93,_0x3a3e5d){_0xeffc93=_0xeffc93-0x0;var _0x57ca3e=_0xedd9[_0xeffc93];return _0x57ca3e;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6ea540c..118f096 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 _0x0dd9=['sequelize','exports'];(function(_0x1b65f9,_0x1e2f0a){var _0x46cade=function(_0x120eee){while(--_0x120eee){_0x1b65f9['push'](_0x1b65f9['shift']());}};_0x46cade(++_0x1e2f0a);}(_0x0dd9,0x78));var _0x90dd=function(_0x44225a,_0x5ccc84){_0x44225a=_0x44225a-0x0;var _0xe330dd=_0x0dd9[_0x44225a];return _0xe330dd;};'use strict';var Sequelize=require(_0x90dd('0x0'));module[_0x90dd('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4ab0=['INTEGER','exports'];(function(_0x1164a8,_0x1eb979){var _0x139028=function(_0x433a63){while(--_0x433a63){_0x1164a8['push'](_0x1164a8['shift']());}};_0x139028(++_0x1eb979);}(_0x4ab0,0xd5));var _0x04ab=function(_0x1c8eea,_0x2fbeca){_0x1c8eea=_0x1c8eea-0x0;var _0xcbc4a=_0x4ab0[_0x1c8eea];return _0xcbc4a;};'use strict';var Sequelize=require('sequelize');module[_0x04ab('0x0')]={'penalty':{'type':Sequelize[_0x04ab('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 4014d22..e1600e7 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 _0xbf9f=['exports','define','UserVoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes'];(function(_0x50f88a,_0x57cb22){var _0x2fc675=function(_0xbbeaa8){while(--_0xbbeaa8){_0x50f88a['push'](_0x50f88a['shift']());}};_0x2fc675(++_0x57cb22);}(_0xbf9f,0x1a7));var _0xfbf9=function(_0x29fdbe,_0x233e64){_0x29fdbe=_0x29fdbe-0x0;var _0x3495f4=_0xbf9f[_0x29fdbe];return _0x3495f4;};'use strict';var _=require(_0xfbf9('0x0'));var util=require('util');var logger=require(_0xfbf9('0x1'))(_0xfbf9('0x2'));var moment=require(_0xfbf9('0x3'));var BPromise=require(_0xfbf9('0x4'));var rp=require(_0xfbf9('0x5'));var fs=require('fs');var path=require(_0xfbf9('0x6'));var rimraf=require('rimraf');var config=require(_0xfbf9('0x7'));var attributes=require(_0xfbf9('0x8'));module[_0xfbf9('0x9')]=function(_0x5dbbbe,_0x31b554){return _0x5dbbbe[_0xfbf9('0xa')](_0xfbf9('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f1f=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5dcd29,_0x428889){var _0x2a2992=function(_0x5e88c4){while(--_0x5e88c4){_0x5dcd29['push'](_0x5dcd29['shift']());}};_0x2a2992(++_0x428889);}(_0x9f1f,0x10f));var _0xf9f1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x9f1f[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xf9f1('0x0'));var util=require(_0xf9f1('0x1'));var logger=require(_0xf9f1('0x2'))(_0xf9f1('0x3'));var moment=require(_0xf9f1('0x4'));var BPromise=require(_0xf9f1('0x5'));var rp=require(_0xf9f1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9f1('0x7'));var config=require(_0xf9f1('0x8'));var attributes=require(_0xf9f1('0x9'));module[_0xf9f1('0xa')]=function(_0x2dd1f2,_0x3a155f){return _0x2dd1f2[_0xf9f1('0xb')](_0xf9f1('0xc'),attributes,{'tableName':_0xf9f1('0xd'),'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 b25d6b7..2fa2041 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 _0xaa70=['request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0xaa70,0x180));var _0x0aa7=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0xaa70[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x0aa7('0x0'));var util=require(_0x0aa7('0x1'));var moment=require(_0x0aa7('0x2'));var BPromise=require(_0x0aa7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aa7('0x4'));var db=require(_0x0aa7('0x5'))['db'];var utils=require(_0x0aa7('0x6'));var logger=require('../../config/logger')(_0x0aa7('0x7'));var config=require(_0x0aa7('0x8'));var jayson=require(_0x0aa7('0x9'));var client=jayson[_0x0aa7('0xa')][_0x0aa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2e3e,_0x4cdceb,_0x4c8c0e){return new BPromise(function(_0x35aae1,_0x51949e){return client[_0x0aa7('0xc')](_0x1d2e3e,_0x4c8c0e)[_0x0aa7('0xd')](function(_0x3bf118){logger[_0x0aa7('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4cdceb,_0x0aa7('0xf'));logger[_0x0aa7('0x10')](_0x0aa7('0x11'),_0x4cdceb,_0x0aa7('0xf'),JSON[_0x0aa7('0x12')](_0x3bf118));if(_0x3bf118[_0x0aa7('0x13')]){if(_0x3bf118[_0x0aa7('0x13')]['code']===0x1f4){logger[_0x0aa7('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x4cdceb,_0x3bf118[_0x0aa7('0x13')][_0x0aa7('0x14')]);return _0x51949e(_0x3bf118[_0x0aa7('0x13')][_0x0aa7('0x14')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4cdceb,_0x3bf118[_0x0aa7('0x13')][_0x0aa7('0x14')]);return _0x35aae1(_0x3bf118[_0x0aa7('0x13')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4cdceb,_0x0aa7('0xf'));_0x35aae1(_0x3bf118['result'][_0x0aa7('0x14')]);}})[_0x0aa7('0x15')](function(_0x3d0130){logger[_0x0aa7('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x4cdceb,_0x3d0130);_0x51949e(_0x3d0130);});});} \ No newline at end of file +var _0x0909=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x245195,_0x17e46b){var _0xbeff03=function(_0x52b8d2){while(--_0x52b8d2){_0x245195['push'](_0x245195['shift']());}};_0xbeff03(++_0x17e46b);}(_0x0909,0x11d));var _0x9090=function(_0x2489b6,_0x19d11c){_0x2489b6=_0x2489b6-0x0;var _0x25c8e3=_0x0909[_0x2489b6];return _0x25c8e3;};'use strict';var _=require(_0x9090('0x0'));var util=require(_0x9090('0x1'));var moment=require(_0x9090('0x2'));var BPromise=require(_0x9090('0x3'));var rs=require(_0x9090('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9090('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9090('0x6'))(_0x9090('0x7'));var config=require(_0x9090('0x8'));var jayson=require(_0x9090('0x9'));var client=jayson[_0x9090('0xa')][_0x9090('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x442f65,_0x9afb3,_0x40ede9){return new BPromise(function(_0x1009c2,_0x28708a){return client['request'](_0x442f65,_0x40ede9)['then'](function(_0x3c9a7c){logger[_0x9090('0xc')](_0x9090('0xd'),_0x9afb3,'request\x20sent');logger[_0x9090('0xe')](_0x9090('0xf'),_0x9afb3,'request\x20sent',JSON[_0x9090('0x10')](_0x3c9a7c));if(_0x3c9a7c[_0x9090('0x11')]){if(_0x3c9a7c['error'][_0x9090('0x12')]===0x1f4){logger['error'](_0x9090('0xd'),_0x9afb3,_0x3c9a7c['error'][_0x9090('0x13')]);return _0x28708a(_0x3c9a7c[_0x9090('0x11')][_0x9090('0x13')]);}logger[_0x9090('0x11')](_0x9090('0xd'),_0x9afb3,_0x3c9a7c['error'][_0x9090('0x13')]);return _0x1009c2(_0x3c9a7c[_0x9090('0x11')][_0x9090('0x13')]);}else{logger[_0x9090('0xc')](_0x9090('0xd'),_0x9afb3,'request\x20sent');_0x1009c2(_0x3c9a7c[_0x9090('0x14')][_0x9090('0x13')]);}})[_0x9090('0x15')](function(_0x58b14e){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x9afb3,_0x58b14e);_0x28708a(_0x58b14e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index bff02f6..806fd0a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x47f23c,_0xd754f8){var _0x5b8682=function(_0x54c921){while(--_0x54c921){_0x47f23c['push'](_0x47f23c['shift']());}};_0x5b8682(++_0xd754f8);}(_0xe706,0xa3));var _0x6e70=function(_0x474f47,_0x2303b7){_0x474f47=_0x474f47-0x0;var _0x21bfe6=_0xe706[_0x474f47];return _0x21bfe6;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x977900,_0x531be6){var _0x44ff0=function(_0x5a3b7f){while(--_0x5a3b7f){_0x977900['push'](_0x977900['shift']());}};_0x44ff0(++_0x531be6);}(_0xedd9,0xfc));var _0x9edd=function(_0x22df14,_0x5bd7ea){_0x22df14=_0x22df14-0x0;var _0x52977b=_0xedd9[_0x22df14];return _0x52977b;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 990e1a7..81de6a0 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 _0xc9a3=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9a3,0x83));var _0x3c9a=function(_0x2c4568,_0x7336eb){_0x2c4568=_0x2c4568-0x0;var _0x4cce8f=_0xc9a3[_0x2c4568];return _0x4cce8f;};'use strict';var Sequelize=require(_0x3c9a('0x0'));module[_0x3c9a('0x1')]={'uniqueid':{'type':Sequelize[_0x3c9a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x3c9a('0x3')],'allowNull':![],'comment':_0x3c9a('0x4')},'UserId':{'type':Sequelize[_0x3c9a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3c9a('0x5'),'comment':_0x3c9a('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3c9a('0x3')],'allowNull':![],'unique':_0x3c9a('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3c9a('0x2')](0xb),'defaultValue':0x0,'comment':_0x3c9a('0x4')},'paused':{'type':Sequelize[_0x3c9a('0x2')](0xb),'defaultValue':0x0,'comment':_0x3c9a('0x4')}}; \ No newline at end of file +var _0x1d64=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x22b182,_0x1309b1){var _0x395e8a=function(_0x23ea27){while(--_0x23ea27){_0x22b182['push'](_0x22b182['shift']());}};_0x395e8a(++_0x1309b1);}(_0x1d64,0x1cd));var _0x41d6=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x1d64[_0xa2c0a3];return _0x52c618;};'use strict';var Sequelize=require(_0x41d6('0x0'));module[_0x41d6('0x1')]={'uniqueid':{'type':Sequelize[_0x41d6('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x41d6('0x3')},'membername':{'type':Sequelize[_0x41d6('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x41d6('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x41d6('0x4')],'allowNull':![],'unique':_0x41d6('0x5'),'comment':_0x41d6('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x41d6('0x4')],'allowNull':![],'unique':_0x41d6('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x41d6('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x41d6('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 33aea62..5ae8383 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 _0x0d67=['setMaxListeners','update','remove','hook','exports','events','../../mysqldb'];(function(_0x19781b,_0x9b1c51){var _0x1a1c70=function(_0x11b663){while(--_0x11b663){_0x19781b['push'](_0x19781b['shift']());}};_0x1a1c70(++_0x9b1c51);}(_0x0d67,0x10f));var _0x70d6=function(_0x261ee6,_0x331da5){_0x261ee6=_0x261ee6-0x0;var _0x4686bc=_0x0d67[_0x261ee6];return _0x4686bc;};'use strict';var EventEmitter=require(_0x70d6('0x0'));var UserVoiceQueueRt=require(_0x70d6('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x70d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x70d6('0x3'),'afterDestroy':_0x70d6('0x4')};function emitEvent(_0xf36fc6){return function(_0x389cb8,_0x888d10,_0x1cea48){UserVoiceQueueRtEvents['emit'](_0xf36fc6+':'+_0x389cb8['id'],_0x389cb8);UserVoiceQueueRtEvents['emit'](_0xf36fc6,_0x389cb8);_0x1cea48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x70d6('0x5')](e,emitEvent(event));}}module[_0x70d6('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3b86=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3b86,0x73));var _0x63b8=function(_0x39a7d2,_0x3d90fe){_0x39a7d2=_0x39a7d2-0x0;var _0x33d8f6=_0x3b86[_0x39a7d2];return _0x33d8f6;};'use strict';var EventEmitter=require(_0x63b8('0x0'));var UserVoiceQueueRt=require(_0x63b8('0x1'))['db'][_0x63b8('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x63b8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x63b8('0x4'),'afterDestroy':_0x63b8('0x5')};function emitEvent(_0x103e42){return function(_0x18e2a1,_0x4326a9,_0x17d14f){UserVoiceQueueRtEvents['emit'](_0x103e42+':'+_0x18e2a1['id'],_0x18e2a1);UserVoiceQueueRtEvents[_0x63b8('0x6')](_0x103e42,_0x18e2a1);_0x17d14f(null);};}for(var e in events){if(events[_0x63b8('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x63b8('0x8')](e,emitEvent(event));}}module[_0x63b8('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 419bae4..5f9a4f1 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 _0x5a85=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5038,_0x21ea26){var _0x6eddcb=function(_0x4ee409){while(--_0x4ee409){_0x1b5038['push'](_0x1b5038['shift']());}};_0x6eddcb(++_0x21ea26);}(_0x5a85,0x1bf));var _0x55a8=function(_0x2a98b4,_0x3687e0){_0x2a98b4=_0x2a98b4-0x0;var _0x5ce4b4=_0x5a85[_0x2a98b4];return _0x5ce4b4;};'use strict';var _=require(_0x55a8('0x0'));var util=require(_0x55a8('0x1'));var logger=require(_0x55a8('0x2'))('api');var moment=require(_0x55a8('0x3'));var BPromise=require(_0x55a8('0x4'));var rp=require(_0x55a8('0x5'));var fs=require('fs');var path=require(_0x55a8('0x6'));var rimraf=require(_0x55a8('0x7'));var config=require(_0x55a8('0x8'));var attributes=require(_0x55a8('0x9'));module['exports']=function(_0x13cbcf,_0x479477){return _0x13cbcf[_0x55a8('0xa')](_0x55a8('0xb'),attributes,{'tableName':_0x55a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd21e=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','api','moment'];(function(_0x4252bf,_0xc977d7){var _0x32a218=function(_0x5e278a){while(--_0x5e278a){_0x4252bf['push'](_0x4252bf['shift']());}};_0x32a218(++_0xc977d7);}(_0xd21e,0x1e8));var _0xed21=function(_0x17a922,_0xf448b8){_0x17a922=_0x17a922-0x0;var _0x59d69d=_0xd21e[_0x17a922];return _0x59d69d;};'use strict';var _=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var logger=require('../../config/logger')(_0xed21('0x2'));var moment=require(_0xed21('0x3'));var BPromise=require('bluebird');var rp=require(_0xed21('0x4'));var fs=require('fs');var path=require(_0xed21('0x5'));var rimraf=require(_0xed21('0x6'));var config=require(_0xed21('0x7'));var attributes=require(_0xed21('0x8'));module[_0xed21('0x9')]=function(_0xea2ba2,_0x169256){return _0xea2ba2[_0xed21('0xa')](_0xed21('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index c30a385..f6a2d89 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 _0x0317=['stringify','code','error','message','result','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','then','GetVoiceQueueRtPauses','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x2d4a37,_0xb2d2e5){var _0x4d575d=function(_0x5c56c9){while(--_0x5c56c9){_0x2d4a37['push'](_0x2d4a37['shift']());}};_0x4d575d(++_0xb2d2e5);}(_0x0317,0xac));var _0x7031=function(_0x22e173,_0x5af528){_0x22e173=_0x22e173-0x0;var _0x3a3912=_0x0317[_0x22e173];return _0x3a3912;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7031('0x0'));var BPromise=require(_0x7031('0x1'));var rs=require(_0x7031('0x2'));var fs=require('fs');var Redis=require(_0x7031('0x3'));var db=require(_0x7031('0x4'))['db'];var utils=require(_0x7031('0x5'));var logger=require(_0x7031('0x6'))(_0x7031('0x7'));var config=require('../../config/environment');var jayson=require(_0x7031('0x8'));var client=jayson[_0x7031('0x9')][_0x7031('0xa')]({'port':0x232a});config[_0x7031('0xb')]=_[_0x7031('0xc')](config['redis'],{'host':_0x7031('0xd'),'port':0x18eb});var socket=require(_0x7031('0xe'))(new Redis(config[_0x7031('0xb')]));require(_0x7031('0xf'))[_0x7031('0x10')](socket);function respondWithRpcPromise(_0x4ad2df,_0xb1e2b2,_0xa806c8){return new BPromise(function(_0x290a15,_0x2bb97a){return client[_0x7031('0x11')](_0x4ad2df,_0xa806c8)['then'](function(_0x5f9400){logger[_0x7031('0x12')](_0x7031('0x13'),_0xb1e2b2,_0x7031('0x14'));logger[_0x7031('0x15')](_0x7031('0x16'),_0xb1e2b2,_0x7031('0x14'),JSON[_0x7031('0x17')](_0x5f9400));if(_0x5f9400['error']){if(_0x5f9400['error'][_0x7031('0x18')]===0x1f4){logger[_0x7031('0x19')](_0x7031('0x13'),_0xb1e2b2,_0x5f9400[_0x7031('0x19')][_0x7031('0x1a')]);return _0x2bb97a(_0x5f9400[_0x7031('0x19')]['message']);}logger['error'](_0x7031('0x13'),_0xb1e2b2,_0x5f9400[_0x7031('0x19')][_0x7031('0x1a')]);return _0x290a15(_0x5f9400['error'][_0x7031('0x1a')]);}else{logger[_0x7031('0x12')](_0x7031('0x13'),_0xb1e2b2,'request\x20sent');_0x290a15(_0x5f9400[_0x7031('0x1b')][_0x7031('0x1a')]);}})['catch'](function(_0x5db80e){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb1e2b2,_0x5db80e);_0x2bb97a(_0x5db80e);});});}exports['GetVoiceQueueRtPauses']=function(_0x517754){var _0x48907e=this;return new Promise(function(_0x182c8c,_0x37a884){return db[_0x7031('0x1c')]['findAll']({'raw':_0x517754[_0x7031('0x1d')]?_0x517754[_0x7031('0x1d')][_0x7031('0x1e')]===undefined?!![]:![]:!![],'where':_0x517754['options']?_0x517754['options'][_0x7031('0x1f')]||null:null,'attributes':[[db[_0x7031('0x20')]['fn'](_0x7031('0x21'),db[_0x7031('0x20')]['fn']('IF',db[_0x7031('0x20')][_0x7031('0x22')]('`paused`\x20=\x201,\x201,\x20null'))),_0x7031('0x23')]]})[_0x7031('0x24')](function(_0x33d885){logger['info'](_0x7031('0x25'),_0x517754);logger['debug'](_0x7031('0x25'),_0x517754,JSON['stringify'](_0x33d885));_0x182c8c(_0x33d885);})[_0x7031('0x26')](function(_0x1eed59){logger[_0x7031('0x19')](_0x7031('0x25'),_0x1eed59[_0x7031('0x1a')],_0x517754);_0x37a884(_0x48907e[_0x7031('0x19')](0x1f4,_0x1eed59[_0x7031('0x1a')]));});});}; \ No newline at end of file +var _0x8cf9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','debug','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8cf9,0xd3));var _0x98cf=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8cf9[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x98cf('0x0'));var moment=require('moment');var BPromise=require(_0x98cf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98cf('0x2'));var db=require(_0x98cf('0x3'))['db'];var utils=require(_0x98cf('0x4'));var logger=require(_0x98cf('0x5'))(_0x98cf('0x6'));var config=require(_0x98cf('0x7'));var jayson=require(_0x98cf('0x8'));var client=jayson['client'][_0x98cf('0x9')]({'port':0x232a});config[_0x98cf('0xa')]=_['defaults'](config[_0x98cf('0xa')],{'host':_0x98cf('0xb'),'port':0x18eb});var socket=require(_0x98cf('0xc'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x98cf('0xd')](socket);function respondWithRpcPromise(_0x4e5952,_0x15e0c9,_0x2c427a){return new BPromise(function(_0x49b85a,_0x532488){return client[_0x98cf('0xe')](_0x4e5952,_0x2c427a)[_0x98cf('0xf')](function(_0x28080d){logger['info'](_0x98cf('0x10'),_0x15e0c9,'request\x20sent');logger['debug'](_0x98cf('0x11'),_0x15e0c9,'request\x20sent',JSON[_0x98cf('0x12')](_0x28080d));if(_0x28080d[_0x98cf('0x13')]){if(_0x28080d[_0x98cf('0x13')][_0x98cf('0x14')]===0x1f4){logger[_0x98cf('0x13')](_0x98cf('0x10'),_0x15e0c9,_0x28080d[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x532488(_0x28080d['error'][_0x98cf('0x15')]);}logger['error'](_0x98cf('0x10'),_0x15e0c9,_0x28080d[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x49b85a(_0x28080d[_0x98cf('0x13')][_0x98cf('0x15')]);}else{logger[_0x98cf('0x16')](_0x98cf('0x10'),_0x15e0c9,'request\x20sent');_0x49b85a(_0x28080d[_0x98cf('0x17')]['message']);}})['catch'](function(_0x5a9895){logger[_0x98cf('0x13')](_0x98cf('0x10'),_0x15e0c9,_0x5a9895);_0x532488(_0x5a9895);});});}exports[_0x98cf('0x18')]=function(_0x488578){var _0x400e70=this;return new Promise(function(_0x2f770e,_0x42a2b8){return db[_0x98cf('0x19')][_0x98cf('0x1a')]({'raw':_0x488578[_0x98cf('0x1b')]?_0x488578['options'][_0x98cf('0x1c')]===undefined?!![]:![]:!![],'where':_0x488578[_0x98cf('0x1b')]?_0x488578[_0x98cf('0x1b')][_0x98cf('0x1d')]||null:null,'attributes':[[db[_0x98cf('0x1e')]['fn'](_0x98cf('0x1f'),db['sequelize']['fn']('IF',db[_0x98cf('0x1e')][_0x98cf('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x98cf('0x21')]]})[_0x98cf('0xf')](function(_0x3a9cff){logger[_0x98cf('0x16')](_0x98cf('0x18'),_0x488578);logger[_0x98cf('0x22')](_0x98cf('0x18'),_0x488578,JSON[_0x98cf('0x12')](_0x3a9cff));_0x2f770e(_0x3a9cff);})[_0x98cf('0x23')](function(_0x55f3ad){logger[_0x98cf('0x13')](_0x98cf('0x18'),_0x55f3ad[_0x98cf('0x15')],_0x488578);_0x42a2b8(_0x400e70['error'](0x1f4,_0x55f3ad['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7d38ccc..43e33ae 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 _0x9c48=['save','remove','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c48,0xa1));var _0x89c4=function(_0xfd5b35,_0xd8fdd8){_0xfd5b35=_0xfd5b35-0x0;var _0x86ae7e=_0x9c48[_0xfd5b35];return _0x86ae7e;};'use strict';var UserVoiceQueueRtEvents=require(_0x89c4('0x0'));var events=[_0x89c4('0x1'),_0x89c4('0x2'),'update'];function createListener(_0x1f19e7,_0x203bbb){return function(_0xa13da){_0x203bbb['emit'](_0x1f19e7,_0xa13da);};}function removeListener(_0x4f56bd,_0x3da4d5){return function(){UserVoiceQueueRtEvents[_0x89c4('0x3')](_0x4f56bd,_0x3da4d5);};}exports['register']=function(_0x8ada63){for(var _0x3585d7=0x0,_0x1d0303=events[_0x89c4('0x4')];_0x3585d7<_0x1d0303;_0x3585d7++){var _0x30cdf1=events[_0x3585d7];var _0x7faf5=createListener(_0x89c4('0x5')+_0x30cdf1,_0x8ada63);UserVoiceQueueRtEvents['on'](_0x30cdf1,_0x7faf5);}}; \ No newline at end of file +var _0x75a2=['length','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x450b53,_0x31399a){var _0x565ba4=function(_0x4f0660){while(--_0x4f0660){_0x450b53['push'](_0x450b53['shift']());}};_0x565ba4(++_0x31399a);}(_0x75a2,0x187));var _0x275a=function(_0x33bd26,_0x19831e){_0x33bd26=_0x33bd26-0x0;var _0x3ad195=_0x75a2[_0x33bd26];return _0x3ad195;};'use strict';var UserVoiceQueueRtEvents=require(_0x275a('0x0'));var events=[_0x275a('0x1'),_0x275a('0x2'),'update'];function createListener(_0x2221c5,_0x116ea8){return function(_0x339ace){_0x116ea8[_0x275a('0x3')](_0x2221c5,_0x339ace);};}function removeListener(_0x5019d2,_0x251db9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x5019d2,_0x251db9);};}exports['register']=function(_0x4ab56d){for(var _0x5ecd7b=0x0,_0x32f0cb=events[_0x275a('0x4')];_0x5ecd7b<_0x32f0cb;_0x5ecd7b++){var _0x17ad5e=events[_0x5ecd7b];var _0x38b303=createListener('userVoiceQueueRt:'+_0x17ad5e,_0x4ab56d);UserVoiceQueueRtEvents['on'](_0x17ad5e,_0x38b303);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 47b8419..f16540a 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x220ab4,_0x5a89e6){var _0x4c79a3=function(_0x5c171a){while(--_0x5c171a){_0x220ab4['push'](_0x220ab4['shift']());}};_0x4c79a3(++_0x5a89e6);}(_0xe706,0xa3));var _0x6e70=function(_0x54d879,_0x35c691){_0x54d879=_0x54d879-0x0;var _0xf1c912=_0xe706[_0x54d879];return _0xf1c912;};'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(_0x2109a8,_0x3a7797){var _0x522094=function(_0x545aa1){while(--_0x545aa1){_0x2109a8['push'](_0x2109a8['shift']());}};_0x522094(++_0x3a7797);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 94f0e8e..9bbd753 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 _0x4eea=['INTEGER','exports'];(function(_0x413f57,_0x1ee8b6){var _0x216a7a=function(_0x672b39){while(--_0x672b39){_0x413f57['push'](_0x413f57['shift']());}};_0x216a7a(++_0x1ee8b6);}(_0x4eea,0x149));var _0xa4ee=function(_0x1a037d,_0x5ebac8){_0x1a037d=_0x1a037d-0x0;var _0x46bcdd=_0x4eea[_0x1a037d];return _0x46bcdd;};'use strict';var Sequelize=require('sequelize');module[_0xa4ee('0x0')]={'penalty':{'type':Sequelize[_0xa4ee('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bf4=['INTEGER','sequelize','exports'];(function(_0x71face,_0x514ffd){var _0x34c137=function(_0x30207c){while(--_0x30207c){_0x71face['push'](_0x71face['shift']());}};_0x34c137(++_0x514ffd);}(_0x2bf4,0x193));var _0x42bf=function(_0x138130,_0x200048){_0x138130=_0x138130-0x0;var _0x20cbcc=_0x2bf4[_0x138130];return _0x20cbcc;};'use strict';var Sequelize=require(_0x42bf('0x0'));module[_0x42bf('0x1')]={'penalty':{'type':Sequelize[_0x42bf('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 ecb3326..cde3276 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 _0x6ea2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserWhatsappQueue','lodash','util','../../config/logger','api'];(function(_0x1b9b6a,_0x380af3){var _0x42cb19=function(_0x2be75f){while(--_0x2be75f){_0x1b9b6a['push'](_0x1b9b6a['shift']());}};_0x42cb19(++_0x380af3);}(_0x6ea2,0x11c));var _0x26ea=function(_0x3774c0,_0x1825f6){_0x3774c0=_0x3774c0-0x0;var _0x245773=_0x6ea2[_0x3774c0];return _0x245773;};'use strict';var _=require(_0x26ea('0x0'));var util=require(_0x26ea('0x1'));var logger=require(_0x26ea('0x2'))(_0x26ea('0x3'));var moment=require(_0x26ea('0x4'));var BPromise=require(_0x26ea('0x5'));var rp=require(_0x26ea('0x6'));var fs=require('fs');var path=require(_0x26ea('0x7'));var rimraf=require(_0x26ea('0x8'));var config=require(_0x26ea('0x9'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x59ef0f,_0x4c0df8){return _0x59ef0f[_0x26ea('0xa')](_0x26ea('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e71=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','rimraf','./userWhatsappQueue.attributes','define'];(function(_0x528036,_0x404da1){var _0x5aba7a=function(_0xcc3a10){while(--_0xcc3a10){_0x528036['push'](_0x528036['shift']());}};_0x5aba7a(++_0x404da1);}(_0x5e71,0xea));var _0x15e7=function(_0xfaa1b4,_0x300f20){_0xfaa1b4=_0xfaa1b4-0x0;var _0x658bf3=_0x5e71[_0xfaa1b4];return _0x658bf3;};'use strict';var _=require(_0x15e7('0x0'));var util=require(_0x15e7('0x1'));var logger=require('../../config/logger')(_0x15e7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15e7('0x3'));var config=require('../../config/environment');var attributes=require(_0x15e7('0x4'));module['exports']=function(_0x30850c,_0x1097b0){return _0x30850c[_0x15e7('0x5')](_0x15e7('0x6'),attributes,{'tableName':_0x15e7('0x7'),'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 c537a86..84cc02e 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 _0x0fc8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x0fc8,0x138));var _0x80fc=function(_0x1eef6c,_0x532bcc){_0x1eef6c=_0x1eef6c-0x0;var _0xd70bff=_0x0fc8[_0x1eef6c];return _0xd70bff;};'use strict';var _=require(_0x80fc('0x0'));var util=require(_0x80fc('0x1'));var moment=require('moment');var BPromise=require(_0x80fc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80fc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x80fc('0x4'))(_0x80fc('0x5'));var config=require(_0x80fc('0x6'));var jayson=require(_0x80fc('0x7'));var client=jayson[_0x80fc('0x8')][_0x80fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11035d,_0x2b5335,_0x26e547){return new BPromise(function(_0x418f6f,_0x806acb){return client[_0x80fc('0xa')](_0x11035d,_0x26e547)['then'](function(_0xdd7a62){logger[_0x80fc('0xb')](_0x80fc('0xc'),_0x2b5335,'request\x20sent');logger[_0x80fc('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2b5335,_0x80fc('0xe'),JSON[_0x80fc('0xf')](_0xdd7a62));if(_0xdd7a62[_0x80fc('0x10')]){if(_0xdd7a62[_0x80fc('0x10')][_0x80fc('0x11')]===0x1f4){logger[_0x80fc('0x10')](_0x80fc('0xc'),_0x2b5335,_0xdd7a62['error'][_0x80fc('0x12')]);return _0x806acb(_0xdd7a62[_0x80fc('0x10')][_0x80fc('0x12')]);}logger[_0x80fc('0x10')](_0x80fc('0xc'),_0x2b5335,_0xdd7a62[_0x80fc('0x10')][_0x80fc('0x12')]);return _0x418f6f(_0xdd7a62[_0x80fc('0x10')][_0x80fc('0x12')]);}else{logger[_0x80fc('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2b5335,_0x80fc('0xe'));_0x418f6f(_0xdd7a62[_0x80fc('0x13')][_0x80fc('0x12')]);}})[_0x80fc('0x14')](function(_0x8d1ad8){logger['error'](_0x80fc('0xc'),_0x2b5335,_0x8d1ad8);_0x806acb(_0x8d1ad8);});});} \ No newline at end of file +var _0x0faa=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x35b7b3,_0x62c34e){var _0x5afb26=function(_0x279557){while(--_0x279557){_0x35b7b3['push'](_0x35b7b3['shift']());}};_0x5afb26(++_0x62c34e);}(_0x0faa,0x1b3));var _0xa0fa=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x0faa[_0x543084];return _0x306a57;};'use strict';var _=require(_0xa0fa('0x0'));var util=require('util');var moment=require(_0xa0fa('0x1'));var BPromise=require(_0xa0fa('0x2'));var rs=require(_0xa0fa('0x3'));var fs=require('fs');var Redis=require(_0xa0fa('0x4'));var db=require(_0xa0fa('0x5'))['db'];var utils=require(_0xa0fa('0x6'));var logger=require(_0xa0fa('0x7'))(_0xa0fa('0x8'));var config=require(_0xa0fa('0x9'));var jayson=require(_0xa0fa('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca0dc,_0x4d1ee6,_0x5c9157){return new BPromise(function(_0x3322b7,_0x59b653){return client[_0xa0fa('0xb')](_0x2ca0dc,_0x5c9157)[_0xa0fa('0xc')](function(_0x2c712){logger[_0xa0fa('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4d1ee6,_0xa0fa('0xe'));logger[_0xa0fa('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4d1ee6,_0xa0fa('0xe'),JSON[_0xa0fa('0x10')](_0x2c712));if(_0x2c712['error']){if(_0x2c712[_0xa0fa('0x11')][_0xa0fa('0x12')]===0x1f4){logger[_0xa0fa('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4d1ee6,_0x2c712[_0xa0fa('0x11')]['message']);return _0x59b653(_0x2c712[_0xa0fa('0x11')][_0xa0fa('0x13')]);}logger['error'](_0xa0fa('0x14'),_0x4d1ee6,_0x2c712[_0xa0fa('0x11')][_0xa0fa('0x13')]);return _0x3322b7(_0x2c712[_0xa0fa('0x11')][_0xa0fa('0x13')]);}else{logger['info'](_0xa0fa('0x14'),_0x4d1ee6,'request\x20sent');_0x3322b7(_0x2c712[_0xa0fa('0x15')][_0xa0fa('0x13')]);}})['catch'](function(_0xf5332f){logger[_0xa0fa('0x11')](_0xa0fa('0x14'),_0x4d1ee6,_0xf5332f);_0x59b653(_0xf5332f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0c296d1..679d672 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 _0xd2ea=['./variable.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e529a,_0x16669c){var _0x595da4=function(_0x206b1f){while(--_0x206b1f){_0x2e529a['push'](_0x2e529a['shift']());}};_0x595da4(++_0x16669c);}(_0xd2ea,0x15f));var _0xad2e=function(_0xf48a84,_0x51c26a){_0xf48a84=_0xf48a84-0x0;var _0x1f0c9b=_0xd2ea[_0xf48a84];return _0x1f0c9b;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xd')]('/',auth[_0xad2e('0xb')](),controller['create']);router[_0xad2e('0xe')]('/:id',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xc'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc978=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x10d8c7,_0xa80d12){var _0x4105b9=function(_0x46684b){while(--_0x46684b){_0x10d8c7['push'](_0x10d8c7['shift']());}};_0x4105b9(++_0xa80d12);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xf')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0x11')]('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0x13')](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);module[_0x8c97('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5d83211..fd427a0 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 _0x40df=['exports','name','STRING','sequelize'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x40df,0xaf));var _0xf40d=function(_0x1f216c,_0x4a68b8){_0x1f216c=_0x1f216c-0x0;var _0x1ba122=_0x40df[_0x1f216c];return _0x1ba122;};'use strict';var Sequelize=require(_0xf40d('0x0'));module[_0xf40d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf40d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf40d('0x3')]}}; \ No newline at end of file +var _0x9ed1=['exports','STRING','name','sequelize'];(function(_0x18df14,_0xd32d8c){var _0x1d3bd0=function(_0x346e22){while(--_0x346e22){_0x18df14['push'](_0x18df14['shift']());}};_0x1d3bd0(++_0xd32d8c);}(_0x9ed1,0x107));var _0x19ed=function(_0x8484b7,_0x4911a3){_0x8484b7=_0x8484b7-0x0;var _0x1bf46a=_0x9ed1[_0x8484b7];return _0x1bf46a;};'use strict';var Sequelize=require(_0x19ed('0x0'));module[_0x19ed('0x1')]={'name':{'type':Sequelize[_0x19ed('0x2')],'unique':_0x19ed('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x19ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cb2b041..48735de 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 _0x57ba=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','merge','includeAll','include','findAll','rows','catch','show','params','Variable','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','model'];(function(_0x2cf765,_0x4c8c6d){var _0x4458ff=function(_0x174dd4){while(--_0x174dd4){_0x2cf765['push'](_0x2cf765['shift']());}};_0x4458ff(++_0x4c8c6d);}(_0x57ba,0x78));var _0xa57b=function(_0x2c5ad1,_0x1bd586){_0x2c5ad1=_0x2c5ad1-0x0;var _0xb20325=_0x57ba[_0x2c5ad1];return _0xb20325;};'use strict';var emlformat=require(_0xa57b('0x0'));var rimraf=require(_0xa57b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa57b('0x2'));var moment=require(_0xa57b('0x3'));var BPromise=require(_0xa57b('0x4'));var Mustache=require(_0xa57b('0x5'));var util=require(_0xa57b('0x6'));var path=require(_0xa57b('0x7'));var sox=require('sox');var csv=require(_0xa57b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa57b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa57b('0xa'));var jsforce=require(_0xa57b('0xb'));var deskjs=require(_0xa57b('0xc'));var toCsv=require(_0xa57b('0x8'));var querystring=require(_0xa57b('0xd'));var Papa=require(_0xa57b('0xe'));var Redis=require(_0xa57b('0xf'));var authService=require(_0xa57b('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57b('0x11'));var logger=require(_0xa57b('0x12'))(_0xa57b('0x13'));var utils=require(_0xa57b('0x14'));var config=require(_0xa57b('0x15'));var licenseUtil=require(_0xa57b('0x16'));var db=require(_0xa57b('0x17'))['db'];function respondWithStatusCode(_0x317373,_0xd40488){_0xd40488=_0xd40488||0xcc;return function(_0xebbd3e){if(_0xebbd3e){return _0x317373[_0xa57b('0x18')](_0xd40488);}return _0x317373[_0xa57b('0x19')](_0xd40488)['end']();};}function respondWithResult(_0x208f48,_0x46e6dd){_0x46e6dd=_0x46e6dd||0xc8;return function(_0x403acb){if(_0x403acb){return _0x208f48[_0xa57b('0x19')](_0x46e6dd)[_0xa57b('0x1a')](_0x403acb);}};}function respondWithFilteredResult(_0x6dd32a,_0x2d07b0){return function(_0x329df4){if(_0x329df4){var _0x1d5db4=typeof _0x2d07b0['offset']===_0xa57b('0x1b')&&typeof _0x2d07b0['limit']===_0xa57b('0x1b');var _0x567c0d=_0x329df4[_0xa57b('0x1c')];var _0x76d47f=_0x1d5db4?0x0:_0x2d07b0[_0xa57b('0x1d')];var _0x37aa67=_0x1d5db4?_0x329df4[_0xa57b('0x1c')]:_0x2d07b0[_0xa57b('0x1d')]+_0x2d07b0['limit'];var _0x593697;if(_0x37aa67>=_0x567c0d){_0x37aa67=_0x567c0d;_0x593697=0xc8;}else{_0x593697=0xce;}_0x6dd32a[_0xa57b('0x19')](_0x593697);return _0x6dd32a[_0xa57b('0x1e')]('Content-Range',_0x76d47f+'-'+_0x37aa67+'/'+_0x567c0d)[_0xa57b('0x1a')](_0x329df4);}return null;};}function patchUpdates(_0x486713){return function(_0x5994b4){try{jsonpatch[_0xa57b('0x1f')](_0x5994b4,_0x486713,!![]);}catch(_0x534fd1){return BPromise[_0xa57b('0x20')](_0x534fd1);}return _0x5994b4[_0xa57b('0x21')]();};}function saveUpdates(_0x11ee2b,_0x521821){return function(_0x375b6c){if(_0x375b6c){return _0x375b6c[_0xa57b('0x22')](_0x11ee2b)[_0xa57b('0x23')](function(_0x113fdf){return _0x113fdf;});}return null;};}function removeEntity(_0x2eb065,_0x3d1fd9){return function(_0x389a05){if(_0x389a05){return _0x389a05[_0xa57b('0x24')]()['then'](function(){var _0x46eff3=_0x389a05[_0xa57b('0x25')]({'plain':!![]});var _0x1d8ebf=_0xa57b('0x26');return db[_0xa57b('0x27')][_0xa57b('0x24')]({'where':{'type':_0x1d8ebf,'resourceId':_0x46eff3['id']}})[_0xa57b('0x23')](function(){return _0x389a05;});})[_0xa57b('0x23')](function(){_0x2eb065['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ad09,_0x4edd10){return function(_0x27a7da){if(!_0x27a7da){_0x36ad09[_0xa57b('0x18')](0x194);}return _0x27a7da;};}function handleError(_0x39ca40,_0x4fb5a1){_0x4fb5a1=_0x4fb5a1||0x1f4;return function(_0x3f8a04){logger['error'](_0x3f8a04[_0xa57b('0x28')]);if(_0x3f8a04[_0xa57b('0x29')]){delete _0x3f8a04[_0xa57b('0x29')];}_0x39ca40['status'](_0x4fb5a1)[_0xa57b('0x2a')](_0x3f8a04);};}exports[_0xa57b('0x2b')]=function(_0x5ba36,_0x4f84ff){var _0x4421ab={},_0x2751af={},_0x17c2fc={'count':0x0,'rows':[]};var _0x53b222=_[_0xa57b('0x2c')](db['Variable'][_0xa57b('0x2d')],function(_0x2808f4){return{'name':_0x2808f4[_0xa57b('0x2e')],'type':_0x2808f4['type']['key']};});_0x2751af[_0xa57b('0x2f')]=_[_0xa57b('0x2c')](_0x53b222,_0xa57b('0x29'));_0x2751af[_0xa57b('0x30')]=_[_0xa57b('0x31')](_0x5ba36['query']);_0x2751af['filters']=_[_0xa57b('0x32')](_0x2751af[_0xa57b('0x2f')],_0x2751af[_0xa57b('0x30')]);_0x4421ab[_0xa57b('0x33')]=_['intersection'](_0x2751af[_0xa57b('0x2f')],qs[_0xa57b('0x34')](_0x5ba36[_0xa57b('0x30')][_0xa57b('0x34')]));_0x4421ab[_0xa57b('0x33')]=_0x4421ab['attributes']['length']?_0x4421ab[_0xa57b('0x33')]:_0x2751af['model'];if(!_0x5ba36['query'][_0xa57b('0x35')](_0xa57b('0x36'))){_0x4421ab[_0xa57b('0x37')]=qs[_0xa57b('0x37')](_0x5ba36[_0xa57b('0x30')][_0xa57b('0x37')]);_0x4421ab[_0xa57b('0x1d')]=qs[_0xa57b('0x1d')](_0x5ba36[_0xa57b('0x30')][_0xa57b('0x1d')]);}_0x4421ab[_0xa57b('0x38')]=qs[_0xa57b('0x39')](_0x5ba36[_0xa57b('0x30')][_0xa57b('0x39')]);_0x4421ab[_0xa57b('0x3a')]=qs[_0xa57b('0x3b')](_[_0xa57b('0x3c')](_0x5ba36[_0xa57b('0x30')],_0x2751af[_0xa57b('0x3b')]),_0x53b222);if(_0x5ba36['query'][_0xa57b('0x3d')]){_0x4421ab[_0xa57b('0x3a')]=_['merge'](_0x4421ab[_0xa57b('0x3a')],{'$or':_[_0xa57b('0x2c')](_0x53b222,function(_0x45c1a2){if(_0x45c1a2[_0xa57b('0x3e')]!=='VIRTUAL'){var _0x5e3166={};_0x5e3166[_0x45c1a2['name']]={'$like':'%'+_0x5ba36[_0xa57b('0x30')]['filter']+'%'};return _0x5e3166;}})});}_0x4421ab=_[_0xa57b('0x3f')]({},_0x4421ab,_0x5ba36['options']);var _0x2afb45={'where':_0x4421ab[_0xa57b('0x3a')]};return db['Variable'][_0xa57b('0x1c')](_0x2afb45)[_0xa57b('0x23')](function(_0x43d827){_0x17c2fc['count']=_0x43d827;if(_0x5ba36[_0xa57b('0x30')][_0xa57b('0x40')]){_0x4421ab[_0xa57b('0x41')]=[{'all':!![]}];}return db['Variable'][_0xa57b('0x42')](_0x4421ab);})[_0xa57b('0x23')](function(_0x176a2c){_0x17c2fc[_0xa57b('0x43')]=_0x176a2c;return _0x17c2fc;})[_0xa57b('0x23')](respondWithFilteredResult(_0x4f84ff,_0x4421ab))[_0xa57b('0x44')](handleError(_0x4f84ff,null));};exports[_0xa57b('0x45')]=function(_0x43b39a,_0x294227){var _0x1f7a30={'raw':!![],'where':{'id':_0x43b39a[_0xa57b('0x46')]['id']}},_0x3beb1c={};_0x3beb1c['model']=_[_0xa57b('0x31')](db[_0xa57b('0x47')][_0xa57b('0x2d')]);_0x3beb1c['query']=_['keys'](_0x43b39a[_0xa57b('0x30')]);_0x3beb1c['filters']=_[_0xa57b('0x32')](_0x3beb1c[_0xa57b('0x2f')],_0x3beb1c['query']);_0x1f7a30[_0xa57b('0x33')]=_[_0xa57b('0x32')](_0x3beb1c['model'],qs[_0xa57b('0x34')](_0x43b39a[_0xa57b('0x30')][_0xa57b('0x34')]));_0x1f7a30[_0xa57b('0x33')]=_0x1f7a30['attributes'][_0xa57b('0x48')]?_0x1f7a30[_0xa57b('0x33')]:_0x3beb1c[_0xa57b('0x2f')];if(_0x43b39a['query'][_0xa57b('0x40')]){_0x1f7a30[_0xa57b('0x41')]=[{'all':!![]}];}_0x1f7a30=_[_0xa57b('0x3f')]({},_0x1f7a30,_0x43b39a[_0xa57b('0x49')]);return db[_0xa57b('0x47')]['find'](_0x1f7a30)[_0xa57b('0x23')](handleEntityNotFound(_0x294227,null))[_0xa57b('0x23')](respondWithResult(_0x294227,null))[_0xa57b('0x44')](handleError(_0x294227,null));};exports[_0xa57b('0x4a')]=function(_0x3f325a,_0x5e910a){return db[_0xa57b('0x47')]['create'](_0x3f325a[_0xa57b('0x4b')],{})[_0xa57b('0x23')](function(_0x687878){var _0x131e0f=_0x3f325a[_0xa57b('0x4c')][_0xa57b('0x25')]({'plain':!![]});if(!_0x131e0f)throw new Error(_0xa57b('0x4d'));if(_0x131e0f['role']===_0xa57b('0x4c')){var _0x4c2541=_0x687878[_0xa57b('0x25')]({'plain':!![]});var _0x2c0722='Variables';return db[_0xa57b('0x4e')][_0xa57b('0x4f')]({'where':{'name':_0x2c0722,'userProfileId':_0x131e0f[_0xa57b('0x50')]},'raw':!![]})[_0xa57b('0x23')](function(_0xf2a317){if(_0xf2a317&&_0xf2a317[_0xa57b('0x51')]===0x0){return db[_0xa57b('0x27')][_0xa57b('0x4a')]({'name':_0x4c2541[_0xa57b('0x29')],'resourceId':_0x4c2541['id'],'type':_0xf2a317[_0xa57b('0x29')],'sectionId':_0xf2a317['id']},{})['then'](function(){return _0x687878;});}else{return _0x687878;}})[_0xa57b('0x44')](function(_0x17d83e){logger[_0xa57b('0x52')](_0xa57b('0x53'),_0x17d83e);throw _0x17d83e;});}return _0x687878;})[_0xa57b('0x23')](respondWithResult(_0x5e910a,0xc9))[_0xa57b('0x44')](handleError(_0x5e910a,null));};exports['update']=function(_0x3f8014,_0x3eaea6){if(_0x3f8014['body']['id']){delete _0x3f8014[_0xa57b('0x4b')]['id'];}return db['Variable'][_0xa57b('0x4f')]({'where':{'id':_0x3f8014[_0xa57b('0x46')]['id']}})[_0xa57b('0x23')](handleEntityNotFound(_0x3eaea6,null))['then'](saveUpdates(_0x3f8014['body'],null))['then'](respondWithResult(_0x3eaea6,null))[_0xa57b('0x44')](handleError(_0x3eaea6,null));};exports[_0xa57b('0x24')]=function(_0x5bc747,_0x25a5cb){return db[_0xa57b('0x47')]['find']({'where':{'id':_0x5bc747[_0xa57b('0x46')]['id']}})[_0xa57b('0x23')](handleEntityNotFound(_0x25a5cb,null))['then'](removeEntity(_0x25a5cb,null))[_0xa57b('0x44')](handleError(_0x25a5cb,null));}; \ No newline at end of file +var _0x70f1=['update','then','get','UserProfileResource','end','error','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','save'];(function(_0x517925,_0x27ae63){var _0x2f0dbf=function(_0x1b2cf6){while(--_0x1b2cf6){_0x517925['push'](_0x517925['shift']());}};_0x2f0dbf(++_0x27ae63);}(_0x70f1,0x1d7));var _0x170f=function(_0xcb351e,_0x4d90c2){_0xcb351e=_0xcb351e-0x0;var _0xf4094d=_0x70f1[_0xcb351e];return _0xf4094d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x170f('0x0'));var jsonpatch=require(_0x170f('0x1'));var rp=require(_0x170f('0x2'));var moment=require(_0x170f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x170f('0x4'));var util=require(_0x170f('0x5'));var path=require(_0x170f('0x6'));var sox=require(_0x170f('0x7'));var csv=require(_0x170f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x170f('0x9'));var _=require('lodash');var squel=require(_0x170f('0xa'));var crypto=require(_0x170f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x170f('0x8'));var querystring=require(_0x170f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x170f('0xd'));var qs=require(_0x170f('0xe'));var as=require(_0x170f('0xf'));var hardwareService=require(_0x170f('0x10'));var logger=require(_0x170f('0x11'))(_0x170f('0x12'));var utils=require(_0x170f('0x13'));var config=require(_0x170f('0x14'));var licenseUtil=require(_0x170f('0x15'));var db=require(_0x170f('0x16'))['db'];function respondWithStatusCode(_0x185f14,_0x549add){_0x549add=_0x549add||0xcc;return function(_0x46c582){if(_0x46c582){return _0x185f14[_0x170f('0x17')](_0x549add);}return _0x185f14[_0x170f('0x18')](_0x549add)['end']();};}function respondWithResult(_0x2fa76b,_0x4fe6bb){_0x4fe6bb=_0x4fe6bb||0xc8;return function(_0x4d893d){if(_0x4d893d){return _0x2fa76b[_0x170f('0x18')](_0x4fe6bb)['json'](_0x4d893d);}};}function respondWithFilteredResult(_0x3847be,_0x539c67){return function(_0x41dc34){if(_0x41dc34){var _0x47071d=typeof _0x539c67[_0x170f('0x19')]==='undefined'&&typeof _0x539c67[_0x170f('0x1a')]===_0x170f('0x1b');var _0x4ba989=_0x41dc34[_0x170f('0x1c')];var _0x155a93=_0x47071d?0x0:_0x539c67[_0x170f('0x19')];var _0x79d09d=_0x47071d?_0x41dc34[_0x170f('0x1c')]:_0x539c67[_0x170f('0x19')]+_0x539c67[_0x170f('0x1a')];var _0x244ffe;if(_0x79d09d>=_0x4ba989){_0x79d09d=_0x4ba989;_0x244ffe=0xc8;}else{_0x244ffe=0xce;}_0x3847be[_0x170f('0x18')](_0x244ffe);return _0x3847be['set'](_0x170f('0x1d'),_0x155a93+'-'+_0x79d09d+'/'+_0x4ba989)['json'](_0x41dc34);}return null;};}function patchUpdates(_0x4996e5){return function(_0x159821){try{jsonpatch[_0x170f('0x1e')](_0x159821,_0x4996e5,!![]);}catch(_0x5c448d){return BPromise[_0x170f('0x1f')](_0x5c448d);}return _0x159821[_0x170f('0x20')]();};}function saveUpdates(_0x250527,_0x5c6afe){return function(_0x183a63){if(_0x183a63){return _0x183a63[_0x170f('0x21')](_0x250527)[_0x170f('0x22')](function(_0x1c3fb3){return _0x1c3fb3;});}return null;};}function removeEntity(_0x2d3511,_0x2a5169){return function(_0x38948b){if(_0x38948b){return _0x38948b['destroy']()['then'](function(){var _0x2d3dbf=_0x38948b[_0x170f('0x23')]({'plain':!![]});var _0xc5d519='Variables';return db[_0x170f('0x24')]['destroy']({'where':{'type':_0xc5d519,'resourceId':_0x2d3dbf['id']}})[_0x170f('0x22')](function(){return _0x38948b;});})[_0x170f('0x22')](function(){_0x2d3511[_0x170f('0x18')](0xcc)[_0x170f('0x25')]();});}};}function handleEntityNotFound(_0x4cd503,_0x1126a0){return function(_0x4a9802){if(!_0x4a9802){_0x4cd503[_0x170f('0x17')](0x194);}return _0x4a9802;};}function handleError(_0x525f22,_0x5c89a2){_0x5c89a2=_0x5c89a2||0x1f4;return function(_0x1f71b3){logger[_0x170f('0x26')](_0x1f71b3[_0x170f('0x27')]);if(_0x1f71b3[_0x170f('0x28')]){delete _0x1f71b3[_0x170f('0x28')];}_0x525f22['status'](_0x5c89a2)[_0x170f('0x29')](_0x1f71b3);};}exports[_0x170f('0x2a')]=function(_0x54d6d8,_0x4e1e4f){var _0x560aa7={},_0x25b58={},_0x296d96={'count':0x0,'rows':[]};var _0x3cf073=_[_0x170f('0x2b')](db[_0x170f('0x2c')]['rawAttributes'],function(_0x55a37e){return{'name':_0x55a37e[_0x170f('0x2d')],'type':_0x55a37e[_0x170f('0x2e')][_0x170f('0x2f')]};});_0x25b58[_0x170f('0x30')]=_[_0x170f('0x2b')](_0x3cf073,_0x170f('0x28'));_0x25b58[_0x170f('0x31')]=_[_0x170f('0x32')](_0x54d6d8[_0x170f('0x31')]);_0x25b58[_0x170f('0x33')]=_['intersection'](_0x25b58['model'],_0x25b58['query']);_0x560aa7[_0x170f('0x34')]=_[_0x170f('0x35')](_0x25b58['model'],qs[_0x170f('0x36')](_0x54d6d8[_0x170f('0x31')][_0x170f('0x36')]));_0x560aa7[_0x170f('0x34')]=_0x560aa7['attributes']['length']?_0x560aa7[_0x170f('0x34')]:_0x25b58[_0x170f('0x30')];if(!_0x54d6d8[_0x170f('0x31')][_0x170f('0x37')](_0x170f('0x38'))){_0x560aa7[_0x170f('0x1a')]=qs['limit'](_0x54d6d8[_0x170f('0x31')]['limit']);_0x560aa7[_0x170f('0x19')]=qs[_0x170f('0x19')](_0x54d6d8[_0x170f('0x31')]['offset']);}_0x560aa7[_0x170f('0x39')]=qs[_0x170f('0x3a')](_0x54d6d8[_0x170f('0x31')][_0x170f('0x3a')]);_0x560aa7[_0x170f('0x3b')]=qs[_0x170f('0x33')](_[_0x170f('0x3c')](_0x54d6d8['query'],_0x25b58['filters']),_0x3cf073);if(_0x54d6d8['query'][_0x170f('0x3d')]){_0x560aa7[_0x170f('0x3b')]=_[_0x170f('0x3e')](_0x560aa7[_0x170f('0x3b')],{'$or':_[_0x170f('0x2b')](_0x3cf073,function(_0x4e76d0){if(_0x4e76d0[_0x170f('0x2e')]!==_0x170f('0x3f')){var _0xf5355e={};_0xf5355e[_0x4e76d0[_0x170f('0x28')]]={'$like':'%'+_0x54d6d8[_0x170f('0x31')][_0x170f('0x3d')]+'%'};return _0xf5355e;}})});}_0x560aa7=_[_0x170f('0x3e')]({},_0x560aa7,_0x54d6d8[_0x170f('0x40')]);var _0x3596a1={'where':_0x560aa7[_0x170f('0x3b')]};return db[_0x170f('0x2c')][_0x170f('0x1c')](_0x3596a1)[_0x170f('0x22')](function(_0x80dc2){_0x296d96['count']=_0x80dc2;if(_0x54d6d8[_0x170f('0x31')]['includeAll']){_0x560aa7[_0x170f('0x41')]=[{'all':!![]}];}return db['Variable'][_0x170f('0x42')](_0x560aa7);})['then'](function(_0x3ca14d){_0x296d96[_0x170f('0x43')]=_0x3ca14d;return _0x296d96;})[_0x170f('0x22')](respondWithFilteredResult(_0x4e1e4f,_0x560aa7))[_0x170f('0x44')](handleError(_0x4e1e4f,null));};exports[_0x170f('0x45')]=function(_0x905719,_0x27da28){var _0x2f341b={'raw':!![],'where':{'id':_0x905719[_0x170f('0x46')]['id']}},_0x1ea323={};_0x1ea323[_0x170f('0x30')]=_['keys'](db[_0x170f('0x2c')][_0x170f('0x47')]);_0x1ea323[_0x170f('0x31')]=_['keys'](_0x905719[_0x170f('0x31')]);_0x1ea323['filters']=_['intersection'](_0x1ea323[_0x170f('0x30')],_0x1ea323[_0x170f('0x31')]);_0x2f341b[_0x170f('0x34')]=_[_0x170f('0x35')](_0x1ea323['model'],qs[_0x170f('0x36')](_0x905719[_0x170f('0x31')]['fields']));_0x2f341b[_0x170f('0x34')]=_0x2f341b['attributes']['length']?_0x2f341b[_0x170f('0x34')]:_0x1ea323[_0x170f('0x30')];if(_0x905719[_0x170f('0x31')]['includeAll']){_0x2f341b[_0x170f('0x41')]=[{'all':!![]}];}_0x2f341b=_[_0x170f('0x3e')]({},_0x2f341b,_0x905719[_0x170f('0x40')]);return db[_0x170f('0x2c')][_0x170f('0x48')](_0x2f341b)[_0x170f('0x22')](handleEntityNotFound(_0x27da28,null))[_0x170f('0x22')](respondWithResult(_0x27da28,null))[_0x170f('0x44')](handleError(_0x27da28,null));};exports[_0x170f('0x49')]=function(_0xa7c1d,_0x33da74){return db[_0x170f('0x2c')][_0x170f('0x49')](_0xa7c1d[_0x170f('0x4a')],{})[_0x170f('0x22')](function(_0x4cb43d){var _0x2fe841=_0xa7c1d[_0x170f('0x4b')][_0x170f('0x23')]({'plain':!![]});if(!_0x2fe841)throw new Error(_0x170f('0x4c'));if(_0x2fe841[_0x170f('0x4d')]===_0x170f('0x4b')){var _0x3350f2=_0x4cb43d[_0x170f('0x23')]({'plain':!![]});var _0x3add65=_0x170f('0x4e');return db[_0x170f('0x4f')][_0x170f('0x48')]({'where':{'name':_0x3add65,'userProfileId':_0x2fe841[_0x170f('0x50')]},'raw':!![]})[_0x170f('0x22')](function(_0x59004f){if(_0x59004f&&_0x59004f[_0x170f('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x3350f2['name'],'resourceId':_0x3350f2['id'],'type':_0x59004f[_0x170f('0x28')],'sectionId':_0x59004f['id']},{})[_0x170f('0x22')](function(){return _0x4cb43d;});}else{return _0x4cb43d;}})[_0x170f('0x44')](function(_0x54f6a5){logger[_0x170f('0x26')](_0x170f('0x52'),_0x54f6a5);throw _0x54f6a5;});}return _0x4cb43d;})[_0x170f('0x22')](respondWithResult(_0x33da74,0xc9))['catch'](handleError(_0x33da74,null));};exports[_0x170f('0x21')]=function(_0x29b474,_0x528cae){if(_0x29b474[_0x170f('0x4a')]['id']){delete _0x29b474[_0x170f('0x4a')]['id'];}return db[_0x170f('0x2c')]['find']({'where':{'id':_0x29b474[_0x170f('0x46')]['id']}})[_0x170f('0x22')](handleEntityNotFound(_0x528cae,null))[_0x170f('0x22')](saveUpdates(_0x29b474[_0x170f('0x4a')],null))['then'](respondWithResult(_0x528cae,null))[_0x170f('0x44')](handleError(_0x528cae,null));};exports[_0x170f('0x53')]=function(_0x3d4ce9,_0x47bc77){return db['Variable'][_0x170f('0x48')]({'where':{'id':_0x3d4ce9[_0x170f('0x46')]['id']}})[_0x170f('0x22')](handleEntityNotFound(_0x47bc77,null))['then'](removeEntity(_0x47bc77,null))[_0x170f('0x44')](handleError(_0x47bc77,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 742b154..e5b13d8 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 _0x3b6d=['bluebird','path','./variable.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x3b6d,0x91));var _0xd3b6=function(_0x1ae152,_0x187414){_0x1ae152=_0x1ae152-0x0;var _0x5539c2=_0x3b6d[_0x1ae152];return _0x5539c2;};'use strict';var _=require(_0xd3b6('0x0'));var util=require(_0xd3b6('0x1'));var logger=require(_0xd3b6('0x2'))(_0xd3b6('0x3'));var moment=require(_0xd3b6('0x4'));var BPromise=require(_0xd3b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3b6('0x7'));module[_0xd3b6('0x8')]=function(_0x4c16ae,_0x2b8414){return _0x4c16ae[_0xd3b6('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5556=['util','../../config/logger','api','moment','bluebird','../../config/environment','exports','define','Variable'];(function(_0x38701c,_0xb0ff43){var _0x576a3f=function(_0x2ccfa6){while(--_0x2ccfa6){_0x38701c['push'](_0x38701c['shift']());}};_0x576a3f(++_0xb0ff43);}(_0x5556,0x1cb));var _0x6555=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x5556[_0x19997d];return _0x49be7f;};'use strict';var _=require('lodash');var util=require(_0x6555('0x0'));var logger=require(_0x6555('0x1'))(_0x6555('0x2'));var moment=require(_0x6555('0x3'));var BPromise=require(_0x6555('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6555('0x5'));var attributes=require('./variable.attributes');module[_0x6555('0x6')]=function(_0x11dc8b,_0x3e26d6){return _0x11dc8b[_0x6555('0x7')](_0x6555('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index ffe894f..2b47951 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x41f0fb,_0x155b08){var _0x494a7f=function(_0x491c0d){while(--_0x491c0d){_0x41f0fb['push'](_0x41f0fb['shift']());}};_0x494a7f(++_0x155b08);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3ee926,_0x5e72e5){_0x3ee926=_0x3ee926-0x0;var _0x133646=_0x1cb9[_0x3ee926];return _0x133646;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x151ef6,_0x3f8bcd){var _0x206d86=function(_0x1da468){while(--_0x1da468){_0x151ef6['push'](_0x151ef6['shift']());}};_0x206d86(++_0x3f8bcd);}(_0xf494,0x1c6));var _0x4f49=function(_0x25e17f,_0x5bd86e){_0x25e17f=_0x25e17f-0x0;var _0x3cdb50=_0xf494[_0x25e17f];return _0x3cdb50;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index d156761..fe79531 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 _0x93c4=['get','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','../../components/auth/service','index'];(function(_0x9f6f64,_0x4cd6df){var _0x3b9f5c=function(_0xb4fab1){while(--_0xb4fab1){_0x9f6f64['push'](_0x9f6f64['shift']());}};_0x3b9f5c(++_0x4cd6df);}(_0x93c4,0xc1));var _0x493c=function(_0xc1d9e2,_0x183856){_0xc1d9e2=_0xc1d9e2-0x0;var _0x3678b8=_0x93c4[_0xc1d9e2];return _0x3678b8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x493c('0x0'));var controller=require('./version.controller');router['get']('/',controller[_0x493c('0x1')]);router[_0x493c('0x2')](_0x493c('0x3'),auth[_0x493c('0x4')](),auth[_0x493c('0x5')](),controller['fetch']);router[_0x493c('0x2')](_0x493c('0x6'),auth[_0x493c('0x4')](),auth['canUpdate'](),controller[_0x493c('0x7')]);router[_0x493c('0x2')](_0x493c('0x8'),auth[_0x493c('0x4')](),auth[_0x493c('0x5')](),controller[_0x493c('0x9')]);router[_0x493c('0x2')](_0x493c('0xa'),auth[_0x493c('0x4')](),controller[_0x493c('0xb')]);router[_0x493c('0x2')](_0x493c('0xc'),controller[_0x493c('0xd')]);module[_0x493c('0xe')]=router; \ No newline at end of file +var _0x46c6=['../../components/auth/service','index','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','restart','/migrations','migrations','exports','express','Router'];(function(_0x59b1d2,_0x9801fd){var _0x319da2=function(_0x48c9df){while(--_0x48c9df){_0x59b1d2['push'](_0x59b1d2['shift']());}};_0x319da2(++_0x9801fd);}(_0x46c6,0x19e));var _0x646c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x46c6[_0x342baa];return _0x1208f3;};'use strict';var express=require(_0x646c('0x0'));var router=express[_0x646c('0x1')]();var auth=require(_0x646c('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x646c('0x3')]);router[_0x646c('0x4')](_0x646c('0x5'),auth[_0x646c('0x6')](),auth[_0x646c('0x7')](),controller[_0x646c('0x8')]);router[_0x646c('0x4')]('/reset',auth[_0x646c('0x6')](),auth['canUpdate'](),controller[_0x646c('0x9')]);router['get'](_0x646c('0xa'),auth['isAuthenticated'](),auth[_0x646c('0x7')](),controller[_0x646c('0xb')]);router[_0x646c('0x4')]('/restart',auth[_0x646c('0x6')](),controller[_0x646c('0xc')]);router[_0x646c('0x4')](_0x646c('0xd'),controller[_0x646c('0xe')]);module[_0x646c('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 1381c53..3dc65c4 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 _0xa2e0=['--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','then','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../config/environment','../../config/logger','update','index','exports','query','latest','fetch','2.0.0','status','json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x23e050,_0x479330){var _0x14f71b=function(_0x385b50){while(--_0x385b50){_0x23e050['push'](_0x23e050['shift']());}};_0x14f71b(++_0x479330);}(_0xa2e0,0xc1));var _0x0a2e=function(_0x11550a,_0x31a491){_0x11550a=_0x11550a-0x0;var _0x57713e=_0xa2e0[_0x11550a];return _0x57713e;};'use strict';var Umzug=require(_0x0a2e('0x0'));var path=require(_0x0a2e('0x1'));var fs=require('fs');var _=require(_0x0a2e('0x2'));var pkginfo=require(_0x0a2e('0x3'))(module,_0x0a2e('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x0a2e('0x5'))[_0x0a2e('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x0a2e('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x0a2e('0x8'))(_0x0a2e('0x9'));var git=require('simple-git')(config['root']);exports[_0x0a2e('0xa')]=function(_0x333a99,_0x4c273d){var _0x35a462={'current':module[_0x0a2e('0xb')]['version'],'phonebar':0x2};if(_0x333a99[_0x0a2e('0xc')]&&_0x333a99[_0x0a2e('0xc')][_0x0a2e('0xd')]){return git[_0x0a2e('0xe')]()['tags'](function(_0x2e3b37,_0x1a9e46){_0x35a462['latest']=(_0x2e3b37?module[_0x0a2e('0xb')][_0x0a2e('0x4')]:_0x1a9e46[_0x0a2e('0xd')])||_0x0a2e('0xf');return _0x4c273d[_0x0a2e('0x10')](0xc8)[_0x0a2e('0x11')](_0x35a462);});}else{return _0x4c273d[_0x0a2e('0x10')](0xc8)['json'](_0x35a462);}};exports[_0x0a2e('0xe')]=function(_0x44a65f,_0x318f06){return git[_0x0a2e('0xe')]([_0x0a2e('0x12'),'master'],function(_0x1bbb17){if(_0x1bbb17){logger['error'](_0x1bbb17);return _0x318f06['status'](0x1f4)[_0x0a2e('0x11')](_0x1bbb17);}logger[_0x0a2e('0x13')](_0x0a2e('0x14'));return _0x318f06['status'](0xc8)['json']({'output':_0x0a2e('0x15')});});};exports[_0x0a2e('0x16')]=function(_0x4aae25,_0x48f983){return git[_0x0a2e('0x16')]([_0x0a2e('0x17'),_0x0a2e('0x18')],function(_0x2e6cda){if(_0x2e6cda){logger[_0x0a2e('0x19')](_0x2e6cda);return _0x48f983[_0x0a2e('0x10')](0x1f4)[_0x0a2e('0x11')](_0x2e6cda);}logger['info'](_0x0a2e('0x1a'));return _0x48f983['status'](0xc8)[_0x0a2e('0x11')]({'output':_0x0a2e('0x1b')});});};exports['pull']=function(_0x2dcbe6,_0x3a7f9c){exec(_0x0a2e('0x1c'),function(_0x4783d7,_0x4b8f68,_0x590f94){logger[_0x0a2e('0x13')](_0x4b8f68);logger[_0x0a2e('0x13')](_0x590f94);if(_0x4783d7){logger[_0x0a2e('0x19')](_0x4783d7);return _0x3a7f9c['status'](0x1f4)[_0x0a2e('0x11')](_0x4783d7);}return _0x3a7f9c[_0x0a2e('0x10')](0xc8)['json']({'output':_0x4b8f68});});};exports[_0x0a2e('0x1d')]=function(_0x24c35d,_0xe18a70){return pm2[_0x0a2e('0x1d')](_0x0a2e('0x1e'))['then'](function(_0x10c7cc){logger['info'](_0x0a2e('0x1f'),_0x10c7cc);return _0xe18a70[_0x0a2e('0x10')](0xc8)['json']({'output':_0x0a2e('0x20')});})[_0x0a2e('0x21')](function(_0x15045a){logger['error'](_0x15045a);return _0xe18a70[_0x0a2e('0x10')](0x1f4)[_0x0a2e('0x11')](_0x15045a);});};exports[_0x0a2e('0x22')]=function(_0x5aabba,_0x476446){var _0xd96b1e=fs[_0x0a2e('0x23')](path[_0x0a2e('0x24')](config[_0x0a2e('0x25')],'server',_0x0a2e('0x22')));var _0x3416ae=[];for(var _0x5391c8=0x0;_0x5391c8<_0xd96b1e[_0x0a2e('0x26')];_0x5391c8++){var _0x1bf435=_0xd96b1e[_0x5391c8][_0x0a2e('0x27')](_0x0a2e('0x28'),'');if(compareVersions(module[_0x0a2e('0xb')][_0x0a2e('0x4')],_0x1bf435)===-0x1){_0x3416ae[_0x0a2e('0x29')](_0x1bf435);}}if(_0x3416ae[_0x0a2e('0x26')]){var _0x43218e=_0x3416ae[_0x0a2e('0x2a')](compareVersions);var _0x2f9922=new Umzug({'storage':_0x0a2e('0x2b'),'storageOptions':{'model':db[_0x0a2e('0x2c')],'modelName':'Migration','columnName':_0x0a2e('0x4')},'migrations':{'params':[db[_0x0a2e('0x2b')][_0x0a2e('0x2d')](),db[_0x0a2e('0x2b')]['constructor'],function(){throw new Error(_0x0a2e('0x2e'));}],'path':path[_0x0a2e('0x24')](config['root'],_0x0a2e('0x2f'),_0x0a2e('0x22')),'pattern':/\.js$/}});_0x2f9922['up']({'migrations':_[_0x0a2e('0x30')](_0x43218e,function(_0x45970f){return _0x45970f+_0x0a2e('0x28');})})[_0x0a2e('0x31')](function(){return _0x476446['status'](0xc8)[_0x0a2e('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x0a2e('0x4')]+_0x0a2e('0x32')+_[_0x0a2e('0x33')](_0x43218e),'migrations':_[_0x0a2e('0x24')](_0x43218e)});})['catch'](function(_0x37f2b7){if(_0x37f2b7 instanceof db[_0x0a2e('0x2b')][_0x0a2e('0x34')]){return _0x476446['status'](0xc8)[_0x0a2e('0x11')]({'output':_0x0a2e('0x35')});}else{return _0x476446['status'](0x1f4)['json'](_0x37f2b7);}});}else{return _0x476446[_0x0a2e('0x10')](0xc8)[_0x0a2e('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x7223=['error','json','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','push','length','sort','sequelize','Migration','getQueryInterface','constructor','server','map','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','exports','query','latest','tags','2.0.0','status','origin','master'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x7223,0x194));var _0x3722=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7223[_0x7e2eb0];return _0xd92de4;};'use strict';var Umzug=require(_0x3722('0x0'));var path=require(_0x3722('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x3722('0x2'))(module,_0x3722('0x3'));var compareVersions=require(_0x3722('0x4'));var exec=require(_0x3722('0x5'))[_0x3722('0x6')];var db=require(_0x3722('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x3722('0x8'));var logger=require('../../config/logger')(_0x3722('0x9'));var git=require(_0x3722('0xa'))(config[_0x3722('0xb')]);exports['index']=function(_0x445827,_0x5e5709){var _0x5a2565={'current':module[_0x3722('0xc')][_0x3722('0x3')],'phonebar':0x2};if(_0x445827[_0x3722('0xd')]&&_0x445827[_0x3722('0xd')][_0x3722('0xe')]){return git['fetch']()[_0x3722('0xf')](function(_0x8c992e,_0x435ae1){_0x5a2565[_0x3722('0xe')]=(_0x8c992e?module[_0x3722('0xc')][_0x3722('0x3')]:_0x435ae1[_0x3722('0xe')])||_0x3722('0x10');return _0x5e5709[_0x3722('0x11')](0xc8)['json'](_0x5a2565);});}else{return _0x5e5709['status'](0xc8)['json'](_0x5a2565);}};exports['fetch']=function(_0xaa6d3,_0x11ac80){return git['fetch']([_0x3722('0x12'),_0x3722('0x13')],function(_0x37c711){if(_0x37c711){logger[_0x3722('0x14')](_0x37c711);return _0x11ac80['status'](0x1f4)[_0x3722('0x15')](_0x37c711);}logger[_0x3722('0x16')](_0x3722('0x17'));return _0x11ac80[_0x3722('0x11')](0xc8)[_0x3722('0x15')]({'output':_0x3722('0x18')});});};exports[_0x3722('0x19')]=function(_0x5a8c02,_0x568a4d){return git[_0x3722('0x19')]([_0x3722('0x1a'),'FETCH_HEAD'],function(_0x1a4287){if(_0x1a4287){logger['error'](_0x1a4287);return _0x568a4d['status'](0x1f4)[_0x3722('0x15')](_0x1a4287);}logger[_0x3722('0x16')](_0x3722('0x1b'));return _0x568a4d[_0x3722('0x11')](0xc8)['json']({'output':_0x3722('0x1c')});});};exports[_0x3722('0x1d')]=function(_0x359732,_0x5cc7f8){exec(_0x3722('0x1e'),function(_0x1feb57,_0x43b71f,_0x5d3925){logger['info'](_0x43b71f);logger['info'](_0x5d3925);if(_0x1feb57){logger['error'](_0x1feb57);return _0x5cc7f8['status'](0x1f4)[_0x3722('0x15')](_0x1feb57);}return _0x5cc7f8['status'](0xc8)['json']({'output':_0x43b71f});});};exports[_0x3722('0x1f')]=function(_0x3cc116,_0x59743c){return pm2[_0x3722('0x1f')](_0x3722('0x20'))[_0x3722('0x21')](function(_0x2dd782){logger[_0x3722('0x16')](_0x3722('0x22'),_0x2dd782);return _0x59743c[_0x3722('0x11')](0xc8)[_0x3722('0x15')]({'output':_0x3722('0x23')});})['catch'](function(_0x1bf3cd){logger['error'](_0x1bf3cd);return _0x59743c[_0x3722('0x11')](0x1f4)['json'](_0x1bf3cd);});};exports[_0x3722('0x24')]=function(_0x1453a7,_0x48f113){var _0x52f823=fs[_0x3722('0x25')](path[_0x3722('0x26')](config[_0x3722('0xb')],'server',_0x3722('0x24')));var _0x46f4d4=[];for(var _0x3582fa=0x0;_0x3582fa<_0x52f823['length'];_0x3582fa++){var _0x465ebe=_0x52f823[_0x3582fa]['replace']('.js','');if(compareVersions(module[_0x3722('0xc')]['version'],_0x465ebe)===-0x1){_0x46f4d4[_0x3722('0x27')](_0x465ebe);}}if(_0x46f4d4[_0x3722('0x28')]){var _0x5162c2=_0x46f4d4[_0x3722('0x29')](compareVersions);var _0x53f8af=new Umzug({'storage':_0x3722('0x2a'),'storageOptions':{'model':db[_0x3722('0x2b')],'modelName':'Migration','columnName':_0x3722('0x3')},'migrations':{'params':[db['sequelize'][_0x3722('0x2c')](),db['sequelize'][_0x3722('0x2d')],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[_0x3722('0x26')](config[_0x3722('0xb')],_0x3722('0x2e'),_0x3722('0x24')),'pattern':/\.js$/}});_0x53f8af['up']({'migrations':_[_0x3722('0x2f')](_0x5162c2,function(_0x2ec8a4){return _0x2ec8a4+_0x3722('0x30');})})[_0x3722('0x21')](function(){return _0x48f113['status'](0xc8)[_0x3722('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x3722('0xc')][_0x3722('0x3')]+_0x3722('0x31')+_[_0x3722('0x32')](_0x5162c2),'migrations':_[_0x3722('0x26')](_0x5162c2)});})['catch'](function(_0x5ed0d9){if(_0x5ed0d9 instanceof db[_0x3722('0x2a')][_0x3722('0x33')]){return _0x48f113[_0x3722('0x11')](0xc8)[_0x3722('0x15')]({'output':_0x3722('0x34')});}else{return _0x48f113[_0x3722('0x11')](0x1f4)['json'](_0x5ed0d9);}});}else{return _0x48f113[_0x3722('0x11')](0xc8)[_0x3722('0x15')]({'output':_0x3722('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 3868cb6..18ad37b 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 _0x838e=['isAuthenticated','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x838e,0xf9));var _0xe838=function(_0x5f5516,_0x256228){_0x5f5516=_0x5f5516-0x0;var _0x10e659=_0x838e[_0x5f5516];return _0x10e659;};'use strict';var multer=require(_0xe838('0x0'));var util=require(_0xe838('0x1'));var path=require('path');var timeout=require(_0xe838('0x2'));var express=require('express');var router=express[_0xe838('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe838('0x4'));var interaction=require(_0xe838('0x5'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0xe838('0x6')](),controller['index']);router['get'](_0xe838('0x7'),auth[_0xe838('0x6')](),controller[_0xe838('0x8')]);router['get'](_0xe838('0x9'),auth[_0xe838('0x6')](),controller['show']);router[_0xe838('0xa')]('/',auth['isAuthenticated'](),controller[_0xe838('0xb')]);router['put']('/:id',auth[_0xe838('0x6')](),controller[_0xe838('0xc')]);router[_0xe838('0xd')](_0xe838('0x9'),auth['isAuthenticated'](),controller[_0xe838('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3df4=['put','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x3df4,0xdc));var _0x43df=function(_0x5a2c4b,_0x11d26c){_0x5a2c4b=_0x5a2c4b-0x0;var _0x4094ab=_0x3df4[_0x5a2c4b];return _0x4094ab;};'use strict';var multer=require(_0x43df('0x0'));var util=require(_0x43df('0x1'));var path=require(_0x43df('0x2'));var timeout=require('connect-timeout');var express=require(_0x43df('0x3'));var router=express[_0x43df('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43df('0x5'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x43df('0x6')]('/',auth[_0x43df('0x7')](),controller[_0x43df('0x8')]);router[_0x43df('0x6')](_0x43df('0x9'),auth['isAuthenticated'](),controller[_0x43df('0xa')]);router[_0x43df('0x6')](_0x43df('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x43df('0xc')]('/',auth[_0x43df('0x7')](),controller[_0x43df('0xd')]);router[_0x43df('0xe')](_0x43df('0xb'),auth[_0x43df('0x7')](),controller[_0x43df('0xf')]);router['delete'](_0x43df('0xb'),auth[_0x43df('0x7')](),controller[_0x43df('0x10')]);module[_0x43df('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b698392..6c296b5 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 _0xb9be=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x401c58,_0x22620d){var _0x2e7943=function(_0x2154f3){while(--_0x2154f3){_0x401c58['push'](_0x401c58['shift']());}};_0x2e7943(++_0x22620d);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xb9be[_0x3a1ea5];return _0xfac9b2;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'type':{'type':Sequelize[_0xeb9b('0x2')]},'uniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'calleridnum':{'type':Sequelize[_0xeb9b('0x2')]},'calleridname':{'type':Sequelize[_0xeb9b('0x2')]},'queue':{'type':Sequelize[_0xeb9b('0x2')]},'interface':{'type':Sequelize[_0xeb9b('0x2')]},'membername':{'type':Sequelize[_0xeb9b('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentdumpAt':{'type':Sequelize[_0xeb9b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb9b('0x5')]},'agentacw':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeb9b('0x5')]},'reason':{'type':Sequelize[_0xeb9b('0x2')]},'lastevent':{'type':Sequelize[_0xeb9b('0x2')]},'channel':{'type':Sequelize[_0xeb9b('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeb9b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeb9b('0x2')]},'accountcode':{'type':Sequelize[_0xeb9b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeb9b('0x2')]},'priority':{'type':Sequelize[_0xeb9b('0x2')]},'destchannel':{'type':Sequelize[_0xeb9b('0x2')]},'destchannelstate':{'type':Sequelize[_0xeb9b('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xeb9b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeb9b('0x2')]},'destlanguage':{'type':Sequelize[_0xeb9b('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xeb9b('0x2')]},'destuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeb9b('0x2')]},'transfer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb9b('0x2')],'comment':_0xeb9b('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'agententerreason':{'type':Sequelize[_0xeb9b('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a5c=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x2d16d8,_0x295ba2){var _0x40e2bf=function(_0x45c1cf){while(--_0x45c1cf){_0x2d16d8['push'](_0x2d16d8['shift']());}};_0x40e2bf(++_0x295ba2);}(_0x8a5c,0x136));var _0xc8a5=function(_0x248fbe,_0x2882a8){_0x248fbe=_0x248fbe-0x0;var _0x39f196=_0x8a5c[_0x248fbe];return _0x39f196;};'use strict';var Sequelize=require(_0xc8a5('0x0'));module[_0xc8a5('0x1')]={'type':{'type':Sequelize[_0xc8a5('0x2')]},'uniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'calleridnum':{'type':Sequelize[_0xc8a5('0x2')]},'calleridname':{'type':Sequelize[_0xc8a5('0x2')]},'queue':{'type':Sequelize[_0xc8a5('0x2')]},'interface':{'type':Sequelize[_0xc8a5('0x2')]},'membername':{'type':Sequelize[_0xc8a5('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc8a5('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xc8a5('0x3')]},'holdtime':{'type':Sequelize[_0xc8a5('0x4')]},'agentcomplete':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc8a5('0x4')]},'agentacw':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc8a5('0x4')]},'reason':{'type':Sequelize[_0xc8a5('0x2')]},'lastevent':{'type':Sequelize[_0xc8a5('0x2')]},'channel':{'type':Sequelize[_0xc8a5('0x2')]},'channelstate':{'type':Sequelize[_0xc8a5('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc8a5('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc8a5('0x2')]},'priority':{'type':Sequelize[_0xc8a5('0x2')]},'destchannel':{'type':Sequelize[_0xc8a5('0x2')]},'destchannelstate':{'type':Sequelize[_0xc8a5('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc8a5('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc8a5('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc8a5('0x2')]},'destaccountcode':{'type':Sequelize[_0xc8a5('0x2')]},'destcontext':{'type':Sequelize[_0xc8a5('0x2')]},'destexten':{'type':Sequelize[_0xc8a5('0x2')]},'destpriority':{'type':Sequelize[_0xc8a5('0x2')]},'destuniqueid':{'type':Sequelize[_0xc8a5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc8a5('0x2')]},'transfer':{'type':Sequelize[_0xc8a5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc8a5('0x6')},'transferexten':{'type':Sequelize[_0xc8a5('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xc8a5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index cf4dca5..4dec025 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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 db03311..14c7190 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 _0x0f89=['../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x16a358,_0x45f7fd){var _0x2f98c3=function(_0x57c93b){while(--_0x57c93b){_0x16a358['push'](_0x16a358['shift']());}};_0x2f98c3(++_0x45f7fd);}(_0x0f89,0x111));var _0x90f8=function(_0x30014e,_0x555f27){_0x30014e=_0x30014e-0x0;var _0x1e3be1=_0x0f89[_0x30014e];return _0x1e3be1;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require(_0x90f8('0x2'))('api');var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require(_0x90f8('0x6'));var rimraf=require('rimraf');var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module['exports']=function(_0x7b8d25,_0x4439a9){return _0x7b8d25[_0x90f8('0x9')](_0x90f8('0xa'),attributes,{'tableName':_0x90f8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x90f8('0xc'),_0x90f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd59=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x5cb0d0,_0xd84917){var _0x119075=function(_0x179384){while(--_0x179384){_0x5cb0d0['push'](_0x5cb0d0['shift']());}};_0x119075(++_0xd84917);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2ac3cf,_0x465bb6){_0x2ac3cf=_0x2ac3cf-0x0;var _0x27dcca=_0xcd59[_0x2ac3cf];return _0x27dcca;};'use strict';var _=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var logger=require(_0x9cd5('0x2'))(_0x9cd5('0x3'));var moment=require(_0x9cd5('0x4'));var BPromise=require(_0x9cd5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9cd5('0x6'));var rimraf=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var attributes=require(_0x9cd5('0x9'));module[_0x9cd5('0xa')]=function(_0x2db192,_0x46277c){return _0x2db192[_0x9cd5('0xb')](_0x9cd5('0xc'),attributes,{'tableName':_0x9cd5('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9cd5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 27af3c7..f2e2c03 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 _0x9023=['VoiceAgentReport','create','body','options','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x16cb55,_0x4ce3c1){var _0x3c5570=function(_0x44bfd3){while(--_0x44bfd3){_0x16cb55['push'](_0x16cb55['shift']());}};_0x3c5570(++_0x4ce3c1);}(_0x9023,0x18b));var _0x3902=function(_0x129f3c,_0x5a35eb){_0x129f3c=_0x129f3c-0x0;var _0x24a7bf=_0x9023[_0x129f3c];return _0x24a7bf;};'use strict';var _=require(_0x3902('0x0'));var util=require(_0x3902('0x1'));var moment=require(_0x3902('0x2'));var BPromise=require(_0x3902('0x3'));var rs=require(_0x3902('0x4'));var fs=require('fs');var Redis=require(_0x3902('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3902('0x6'));var logger=require(_0x3902('0x7'))(_0x3902('0x8'));var config=require(_0x3902('0x9'));var jayson=require(_0x3902('0xa'));var client=jayson[_0x3902('0xb')][_0x3902('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f3334,_0x14dfcb,_0x5ca22c){return new BPromise(function(_0x641cc2,_0xd05133){return client[_0x3902('0xd')](_0x1f3334,_0x5ca22c)['then'](function(_0x43bcbc){logger[_0x3902('0xe')](_0x3902('0xf'),_0x14dfcb,_0x3902('0x10'));logger[_0x3902('0x11')](_0x3902('0x12'),_0x14dfcb,_0x3902('0x10'),JSON[_0x3902('0x13')](_0x43bcbc));if(_0x43bcbc[_0x3902('0x14')]){if(_0x43bcbc[_0x3902('0x14')][_0x3902('0x15')]===0x1f4){logger[_0x3902('0x14')](_0x3902('0xf'),_0x14dfcb,_0x43bcbc[_0x3902('0x14')][_0x3902('0x16')]);return _0xd05133(_0x43bcbc[_0x3902('0x14')][_0x3902('0x16')]);}logger[_0x3902('0x14')](_0x3902('0xf'),_0x14dfcb,_0x43bcbc[_0x3902('0x14')]['message']);return _0x641cc2(_0x43bcbc[_0x3902('0x14')][_0x3902('0x16')]);}else{logger['info'](_0x3902('0xf'),_0x14dfcb,_0x3902('0x10'));_0x641cc2(_0x43bcbc[_0x3902('0x17')]['message']);}})[_0x3902('0x18')](function(_0x3e3c5c){logger[_0x3902('0x14')](_0x3902('0xf'),_0x14dfcb,_0x3e3c5c);_0xd05133(_0x3e3c5c);});});}exports['CreateVoiceAgentReport']=function(_0x30ae41){var _0x1cb7d4=this;return new Promise(function(_0x54bc1f,_0x320a09){return db[_0x3902('0x19')][_0x3902('0x1a')](_0x30ae41[_0x3902('0x1b')],{'raw':_0x30ae41['options']?_0x30ae41[_0x3902('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3902('0x1d')](function(_0x17d644){logger[_0x3902('0xe')](_0x3902('0x1e'),_0x30ae41);logger[_0x3902('0x11')]('CreateVoiceAgentReport',_0x30ae41,JSON[_0x3902('0x13')](_0x17d644));_0x54bc1f(_0x17d644);})[_0x3902('0x18')](function(_0x24dad5){logger[_0x3902('0x14')]('CreateVoiceAgentReport',_0x24dad5['message'],_0x30ae41);_0x320a09(_0x1cb7d4['error'](0x1f4,_0x24dad5[_0x3902('0x16')]));});});};exports[_0x3902('0x1f')]=function(_0x5c9503){var _0xa815dc=this;return new Promise(function(_0x55ed8a,_0x4178f6){return db['VoiceAgentReport']['update'](_0x5c9503[_0x3902('0x1b')],{'raw':_0x5c9503[_0x3902('0x1c')]?_0x5c9503[_0x3902('0x1c')][_0x3902('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9503[_0x3902('0x1c')]?_0x5c9503['options'][_0x3902('0x21')]||null:null,'attributes':_0x5c9503[_0x3902('0x1c')]?_0x5c9503['options']['attributes']||null:null,'limit':_0x5c9503[_0x3902('0x1c')]?_0x5c9503[_0x3902('0x1c')][_0x3902('0x22')]||null:null})[_0x3902('0x1d')](function(_0x1842b4){logger['info'](_0x3902('0x1f'),_0x5c9503);logger[_0x3902('0x11')]('UpdateVoiceAgentReport',_0x5c9503,JSON[_0x3902('0x13')](_0x1842b4));_0x55ed8a(_0x1842b4);})[_0x3902('0x18')](function(_0x10ffe0){logger[_0x3902('0x14')](_0x3902('0x1f'),_0x10ffe0[_0x3902('0x16')],_0x5c9503);_0x4178f6(_0xa815dc[_0x3902('0x14')](0x1f4,_0x10ffe0[_0x3902('0x16')]));});});}; \ No newline at end of file +var _0x27ca=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','then','stringify','UpdateVoiceAgentReport','raw','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27ca,0x1f0));var _0xa27c=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x27ca[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xa27c('0x0'));var util=require(_0xa27c('0x1'));var moment=require(_0xa27c('0x2'));var BPromise=require(_0xa27c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa27c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa27c('0x5'));var logger=require(_0xa27c('0x6'))(_0xa27c('0x7'));var config=require('../../config/environment');var jayson=require(_0xa27c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xea01f2,_0x8d8634,_0x56f1cb){return new BPromise(function(_0x6fe885,_0xfaf94c){return client[_0xa27c('0x9')](_0xea01f2,_0x56f1cb)['then'](function(_0x3889f3){logger[_0xa27c('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x8d8634,_0xa27c('0xb'));logger[_0xa27c('0xc')](_0xa27c('0xd'),_0x8d8634,_0xa27c('0xb'),JSON['stringify'](_0x3889f3));if(_0x3889f3[_0xa27c('0xe')]){if(_0x3889f3[_0xa27c('0xe')][_0xa27c('0xf')]===0x1f4){logger[_0xa27c('0xe')](_0xa27c('0x10'),_0x8d8634,_0x3889f3['error']['message']);return _0xfaf94c(_0x3889f3[_0xa27c('0xe')][_0xa27c('0x11')]);}logger[_0xa27c('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x8d8634,_0x3889f3[_0xa27c('0xe')][_0xa27c('0x11')]);return _0x6fe885(_0x3889f3[_0xa27c('0xe')][_0xa27c('0x11')]);}else{logger[_0xa27c('0xa')](_0xa27c('0x10'),_0x8d8634,'request\x20sent');_0x6fe885(_0x3889f3[_0xa27c('0x12')]['message']);}})[_0xa27c('0x13')](function(_0x132f81){logger['error'](_0xa27c('0x10'),_0x8d8634,_0x132f81);_0xfaf94c(_0x132f81);});});}exports[_0xa27c('0x14')]=function(_0x15b63b){var _0x80070c=this;return new Promise(function(_0x2c46b4,_0x28aefe){return db[_0xa27c('0x15')]['create'](_0x15b63b[_0xa27c('0x16')],{'raw':_0x15b63b[_0xa27c('0x17')]?_0x15b63b['options']['raw']===undefined?!![]:![]:!![]})[_0xa27c('0x18')](function(_0x4bfb0d){logger[_0xa27c('0xa')](_0xa27c('0x14'),_0x15b63b);logger['debug'](_0xa27c('0x14'),_0x15b63b,JSON[_0xa27c('0x19')](_0x4bfb0d));_0x2c46b4(_0x4bfb0d);})[_0xa27c('0x13')](function(_0x1e8441){logger['error']('CreateVoiceAgentReport',_0x1e8441[_0xa27c('0x11')],_0x15b63b);_0x28aefe(_0x80070c['error'](0x1f4,_0x1e8441[_0xa27c('0x11')]));});});};exports[_0xa27c('0x1a')]=function(_0x555bc7){var _0x15c82f=this;return new Promise(function(_0x43f702,_0x2006e6){return db[_0xa27c('0x15')]['update'](_0x555bc7[_0xa27c('0x16')],{'raw':_0x555bc7[_0xa27c('0x17')]?_0x555bc7['options'][_0xa27c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555bc7[_0xa27c('0x17')]?_0x555bc7[_0xa27c('0x17')][_0xa27c('0x1c')]||null:null,'attributes':_0x555bc7[_0xa27c('0x17')]?_0x555bc7[_0xa27c('0x17')][_0xa27c('0x1d')]||null:null,'limit':_0x555bc7[_0xa27c('0x17')]?_0x555bc7['options'][_0xa27c('0x1e')]||null:null})[_0xa27c('0x18')](function(_0x4b1bd0){logger[_0xa27c('0xa')](_0xa27c('0x1a'),_0x555bc7);logger[_0xa27c('0xc')](_0xa27c('0x1a'),_0x555bc7,JSON['stringify'](_0x4b1bd0));_0x43f702(_0x4b1bd0);})[_0xa27c('0x13')](function(_0x1fde08){logger[_0xa27c('0xe')](_0xa27c('0x1a'),_0x1fde08[_0xa27c('0x11')],_0x555bc7);_0x2006e6(_0x15c82f[_0xa27c('0xe')](0x1f4,_0x1fde08[_0xa27c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 1a76153..227a89d 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 _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe'];(function(_0x151747,_0x3bd044){var _0x5aba6d=function(_0x122dee){while(--_0x122dee){_0x151747['push'](_0x151747['shift']());}};_0x5aba6d(++_0x3bd044);}(_0x5fc3,0xa8));var _0x35fc=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x5fc3[_0x59c301];return _0x3866b9;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x5b2b95,_0xa073e9){var _0x262eb6=function(_0x8f0b67){while(--_0x8f0b67){_0x5b2b95['push'](_0x5b2b95['shift']());}};_0x262eb6(++_0xa073e9);}(_0x80d9,0x15c));var _0x980d=function(_0x3d9b2b,_0x9a9363){_0x3d9b2b=_0x3d9b2b-0x0;var _0x457c79=_0x80d9[_0x3d9b2b];return _0x457c79;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8a4ca07..626c568 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 _0xb181=['sequelize','exports','STRING','ENUM','internal','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x4ab714,_0x1ae892){var _0x54ce15=function(_0x50260f){while(--_0x50260f){_0x4ab714['push'](_0x4ab714['shift']());}};_0x54ce15(++_0x1ae892);}(_0xb181,0xc6));var _0x1b18=function(_0x5d7726,_0x57adac){_0x5d7726=_0x5d7726-0x0;var _0x521e1c=_0xb181[_0x5d7726];return _0x521e1c;};'use strict';var Sequelize=require(_0x1b18('0x0'));module[_0x1b18('0x1')]={'uniqueid':{'type':Sequelize[_0x1b18('0x2')]},'type':{'type':Sequelize[_0x1b18('0x3')]('inbound',_0x1b18('0x4'),_0x1b18('0x5'),'inbound-fax',_0x1b18('0x6'),_0x1b18('0x7'))},'tag':{'type':Sequelize[_0x1b18('0x2')]},'accountcode':{'type':Sequelize[_0x1b18('0x2')]},'source':{'type':Sequelize[_0x1b18('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1b18('0x2')]},'callerid':{'type':Sequelize[_0x1b18('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x1b18('0x2')]},'lastapplication':{'type':Sequelize[_0x1b18('0x2')]},'lastdata':{'type':Sequelize[_0x1b18('0x8')]},'starttime':{'type':Sequelize[_0x1b18('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1b18('0x9')]},'endtime':{'type':Sequelize[_0x1b18('0x9')]},'duration':{'type':Sequelize[_0x1b18('0xa')]},'billableseconds':{'type':Sequelize[_0x1b18('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1b18('0x2')]},'amaflags':{'type':Sequelize[_0x1b18('0x2')]},'userfield':{'type':Sequelize[_0x1b18('0x2')]},'userDisposition':{'type':Sequelize[_0x1b18('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x1b18('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1b18('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9091=['inbound','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x2594cd,_0x190396){var _0x1c4c65=function(_0x5d6939){while(--_0x5d6939){_0x2594cd['push'](_0x2594cd['shift']());}};_0x1c4c65(++_0x190396);}(_0x9091,0x1ed));var _0x1909=function(_0x5b98d7,_0xe458d8){_0x5b98d7=_0x5b98d7-0x0;var _0x1bfeb0=_0x9091[_0x5b98d7];return _0x1bfeb0;};'use strict';var Sequelize=require(_0x1909('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1909('0x1')]},'type':{'type':Sequelize['ENUM'](_0x1909('0x2'),'internal',_0x1909('0x3'),_0x1909('0x4'),_0x1909('0x5'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x1909('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x1909('0x1')]},'callerid':{'type':Sequelize[_0x1909('0x1')]},'channel':{'type':Sequelize[_0x1909('0x1')]},'destinationchannel':{'type':Sequelize[_0x1909('0x1')]},'lastapplication':{'type':Sequelize[_0x1909('0x1')]},'lastdata':{'type':Sequelize[_0x1909('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1909('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1909('0x8')]},'billableseconds':{'type':Sequelize[_0x1909('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1909('0x1')]},'amaflags':{'type':Sequelize[_0x1909('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x1909('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1909('0x1')]},'note':{'type':Sequelize[_0x1909('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x1909('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 347ae98..bb7e6ea 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xadb5,0xad));var _0x5adb=function(_0x17fa2c,_0x29223b){_0x17fa2c=_0x17fa2c-0x0;var _0x5f14f0=_0xadb5[_0x17fa2c];return _0x5f14f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c671dc8..a003120 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 _0xe0bc=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x34342a,_0x3e16f5){var _0x427cdf=function(_0x6aafbd){while(--_0x6aafbd){_0x34342a['push'](_0x34342a['shift']());}};_0x427cdf(++_0x3e16f5);}(_0xe0bc,0x1c2));var _0xce0b=function(_0x184e21,_0x45bc82){_0x184e21=_0x184e21-0x0;var _0xc741d7=_0xe0bc[_0x184e21];return _0xc741d7;};'use strict';var _=require(_0xce0b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xce0b('0x1'));var moment=require(_0xce0b('0x2'));var BPromise=require(_0xce0b('0x3'));var rp=require(_0xce0b('0x4'));var fs=require('fs');var path=require(_0xce0b('0x5'));var rimraf=require(_0xce0b('0x6'));var config=require(_0xce0b('0x7'));var attributes=require(_0xce0b('0x8'));module[_0xce0b('0x9')]=function(_0x53104a,_0x3aa03b){return _0x53104a[_0xce0b('0xa')]('VoiceCallReport',attributes,{'tableName':_0xce0b('0xb'),'paranoid':![],'indexes':[{'fields':[_0xce0b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6a=['uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x1270e,_0xbbe246){_0x1270e=_0x1270e-0x0;var _0x51aea6=_0x5f6a[_0x1270e];return _0x51aea6;};'use strict';var _=require(_0xa5f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa5f6('0x1'));var moment=require(_0xa5f6('0x2'));var BPromise=require(_0xa5f6('0x3'));var rp=require(_0xa5f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5f6('0x5'));var config=require(_0xa5f6('0x6'));var attributes=require(_0xa5f6('0x7'));module[_0xa5f6('0x8')]=function(_0xb6a42e,_0x9c569c){return _0xb6a42e[_0xa5f6('0x9')](_0xa5f6('0xa'),attributes,{'tableName':_0xa5f6('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa5f6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 374f95c..3c2ff9a 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 _0xf261=['ioredis','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','limit','include','map','model','attributes','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment'];(function(_0x4f0217,_0x29aa7e){var _0x4da152=function(_0x213af1){while(--_0x213af1){_0x4f0217['push'](_0x4f0217['shift']());}};_0x4da152(++_0x29aa7e);}(_0xf261,0x173));var _0x1f26=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf261[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1f26('0x0'));var util=require(_0x1f26('0x1'));var moment=require(_0x1f26('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f26('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f26('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1f26('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1f26('0x6')][_0x1f26('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27131b,_0x5146b8,_0x191ebe){return new BPromise(function(_0x35ab74,_0x22eb08){return client[_0x1f26('0x8')](_0x27131b,_0x191ebe)[_0x1f26('0x9')](function(_0x34288c){logger[_0x1f26('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x5146b8,_0x1f26('0xb'));logger[_0x1f26('0xc')](_0x1f26('0xd'),_0x5146b8,_0x1f26('0xb'),JSON[_0x1f26('0xe')](_0x34288c));if(_0x34288c['error']){if(_0x34288c['error']['code']===0x1f4){logger[_0x1f26('0xf')](_0x1f26('0x10'),_0x5146b8,_0x34288c[_0x1f26('0xf')][_0x1f26('0x11')]);return _0x22eb08(_0x34288c[_0x1f26('0xf')][_0x1f26('0x11')]);}logger[_0x1f26('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x5146b8,_0x34288c[_0x1f26('0xf')][_0x1f26('0x11')]);return _0x35ab74(_0x34288c['error'][_0x1f26('0x11')]);}else{logger['info'](_0x1f26('0x10'),_0x5146b8,_0x1f26('0xb'));_0x35ab74(_0x34288c[_0x1f26('0x12')][_0x1f26('0x11')]);}})[_0x1f26('0x13')](function(_0x304182){logger[_0x1f26('0xf')](_0x1f26('0x10'),_0x5146b8,_0x304182);_0x22eb08(_0x304182);});});}exports[_0x1f26('0x14')]=function(_0x2aa3a9){var _0x22baf5=this;return new Promise(function(_0x3a00d9,_0x257849){return db[_0x1f26('0x15')]['findAll']({'raw':_0x2aa3a9['options']?_0x2aa3a9[_0x1f26('0x16')][_0x1f26('0x17')]===undefined?!![]:![]:!![],'where':_0x2aa3a9[_0x1f26('0x16')]?_0x2aa3a9[_0x1f26('0x16')][_0x1f26('0x18')]||null:null,'attributes':_0x2aa3a9['options']?_0x2aa3a9[_0x1f26('0x16')]['attributes']||null:null,'limit':_0x2aa3a9[_0x1f26('0x16')]?_0x2aa3a9[_0x1f26('0x16')][_0x1f26('0x19')]||null:null,'include':_0x2aa3a9['options']?_0x2aa3a9[_0x1f26('0x16')][_0x1f26('0x1a')]?_[_0x1f26('0x1b')](_0x2aa3a9[_0x1f26('0x16')][_0x1f26('0x1a')],function(_0x5b78a3){return{'model':db[_0x5b78a3[_0x1f26('0x1c')]],'as':_0x5b78a3['as'],'attributes':_0x5b78a3[_0x1f26('0x1d')],'include':_0x5b78a3[_0x1f26('0x1a')]?_['map'](_0x5b78a3[_0x1f26('0x1a')],function(_0x9909fe){return{'model':db[_0x9909fe[_0x1f26('0x1c')]],'as':_0x9909fe['as'],'attributes':_0x9909fe['attributes'],'include':_0x9909fe[_0x1f26('0x1a')]?_[_0x1f26('0x1b')](_0x9909fe[_0x1f26('0x1a')],function(_0x5f00a9){return{'model':db[_0x5f00a9[_0x1f26('0x1c')]],'as':_0x5f00a9['as'],'attributes':_0x5f00a9[_0x1f26('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f26('0x9')](function(_0x251a9f){logger[_0x1f26('0xa')](_0x1f26('0x14'),_0x2aa3a9);logger[_0x1f26('0xc')](_0x1f26('0x14'),_0x2aa3a9,JSON[_0x1f26('0xe')](_0x251a9f));_0x3a00d9(_0x251a9f);})['catch'](function(_0x395ed8){logger['error'](_0x1f26('0x14'),_0x395ed8[_0x1f26('0x11')],_0x2aa3a9);_0x257849(_0x22baf5[_0x1f26('0xf')](0x1f4,_0x395ed8[_0x1f26('0x11')]));});});};exports[_0x1f26('0x1e')]=function(_0x284915){var _0x5f3184=this;return new Promise(function(_0x5229f0,_0x30f4f3){return db[_0x1f26('0x15')][_0x1f26('0x1f')](_0x284915[_0x1f26('0x20')],{'raw':_0x284915[_0x1f26('0x16')]?_0x284915[_0x1f26('0x16')][_0x1f26('0x17')]===undefined?!![]:![]:!![]})[_0x1f26('0x9')](function(_0x58709c){logger[_0x1f26('0xa')](_0x1f26('0x1e'),_0x284915);logger['debug'](_0x1f26('0x1e'),_0x284915,JSON['stringify'](_0x58709c));_0x5229f0(_0x58709c);})['catch'](function(_0x1510be){logger['error']('CreateVoiceCallReport',_0x1510be[_0x1f26('0x11')],_0x284915);_0x30f4f3(_0x5f3184['error'](0x1f4,_0x1510be['message']));});});};exports['UpdateVoiceCallReport']=function(_0x18dcf4){var _0x31a568=this;return new Promise(function(_0xf03b94,_0x226ae){return db[_0x1f26('0x15')]['update'](_0x18dcf4[_0x1f26('0x20')],{'raw':_0x18dcf4[_0x1f26('0x16')]?_0x18dcf4[_0x1f26('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18dcf4[_0x1f26('0x16')]?_0x18dcf4[_0x1f26('0x16')]['where']||null:null,'attributes':_0x18dcf4['options']?_0x18dcf4[_0x1f26('0x16')]['attributes']||null:null,'limit':_0x18dcf4[_0x1f26('0x16')]?_0x18dcf4[_0x1f26('0x16')][_0x1f26('0x19')]||null:null})[_0x1f26('0x9')](function(_0xdf1868){logger[_0x1f26('0xa')]('UpdateVoiceCallReport',_0x18dcf4);logger[_0x1f26('0xc')]('UpdateVoiceCallReport',_0x18dcf4,JSON['stringify'](_0xdf1868));_0xf03b94(_0xdf1868);})['catch'](function(_0x458519){logger['error'](_0x1f26('0x21'),_0x458519[_0x1f26('0x11')],_0x18dcf4);_0x226ae(_0x31a568[_0x1f26('0xf')](0x1f4,_0x458519[_0x1f26('0x11')]));});});}; \ No newline at end of file +var _0x5e66=['then','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x19e9ed,_0x2e4922){var _0xe628f8=function(_0x4efcf2){while(--_0x4efcf2){_0x19e9ed['push'](_0x19e9ed['shift']());}};_0xe628f8(++_0x2e4922);}(_0x5e66,0x135));var _0x65e6=function(_0x3adf90,_0x2526b6){_0x3adf90=_0x3adf90-0x0;var _0x21747f=_0x5e66[_0x3adf90];return _0x21747f;};'use strict';var _=require(_0x65e6('0x0'));var util=require('util');var moment=require(_0x65e6('0x1'));var BPromise=require('bluebird');var rs=require(_0x65e6('0x2'));var fs=require('fs');var Redis=require(_0x65e6('0x3'));var db=require(_0x65e6('0x4'))['db'];var utils=require(_0x65e6('0x5'));var logger=require(_0x65e6('0x6'))(_0x65e6('0x7'));var config=require(_0x65e6('0x8'));var jayson=require(_0x65e6('0x9'));var client=jayson[_0x65e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440fe1,_0x2ef94d,_0x2d8c6d){return new BPromise(function(_0x532b8f,_0x3958c8){return client[_0x65e6('0xb')](_0x440fe1,_0x2d8c6d)['then'](function(_0x50dd20){logger[_0x65e6('0xc')](_0x65e6('0xd'),_0x2ef94d,_0x65e6('0xe'));logger[_0x65e6('0xf')](_0x65e6('0x10'),_0x2ef94d,_0x65e6('0xe'),JSON[_0x65e6('0x11')](_0x50dd20));if(_0x50dd20[_0x65e6('0x12')]){if(_0x50dd20[_0x65e6('0x12')]['code']===0x1f4){logger[_0x65e6('0x12')](_0x65e6('0xd'),_0x2ef94d,_0x50dd20[_0x65e6('0x12')][_0x65e6('0x13')]);return _0x3958c8(_0x50dd20[_0x65e6('0x12')][_0x65e6('0x13')]);}logger[_0x65e6('0x12')](_0x65e6('0xd'),_0x2ef94d,_0x50dd20['error'][_0x65e6('0x13')]);return _0x532b8f(_0x50dd20[_0x65e6('0x12')]['message']);}else{logger['info'](_0x65e6('0xd'),_0x2ef94d,_0x65e6('0xe'));_0x532b8f(_0x50dd20[_0x65e6('0x14')][_0x65e6('0x13')]);}})[_0x65e6('0x15')](function(_0x580b49){logger[_0x65e6('0x12')](_0x65e6('0xd'),_0x2ef94d,_0x580b49);_0x3958c8(_0x580b49);});});}exports[_0x65e6('0x16')]=function(_0x491be8){var _0x3e83ff=this;return new Promise(function(_0x56a6e9,_0x21e8fa){return db[_0x65e6('0x17')][_0x65e6('0x18')]({'raw':_0x491be8[_0x65e6('0x19')]?_0x491be8[_0x65e6('0x19')][_0x65e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x491be8[_0x65e6('0x19')]?_0x491be8['options'][_0x65e6('0x1b')]||null:null,'attributes':_0x491be8[_0x65e6('0x19')]?_0x491be8['options']['attributes']||null:null,'limit':_0x491be8[_0x65e6('0x19')]?_0x491be8[_0x65e6('0x19')][_0x65e6('0x1c')]||null:null,'include':_0x491be8['options']?_0x491be8[_0x65e6('0x19')][_0x65e6('0x1d')]?_[_0x65e6('0x1e')](_0x491be8[_0x65e6('0x19')]['include'],function(_0x13747b){return{'model':db[_0x13747b[_0x65e6('0x1f')]],'as':_0x13747b['as'],'attributes':_0x13747b['attributes'],'include':_0x13747b['include']?_[_0x65e6('0x1e')](_0x13747b[_0x65e6('0x1d')],function(_0x2740bd){return{'model':db[_0x2740bd[_0x65e6('0x1f')]],'as':_0x2740bd['as'],'attributes':_0x2740bd[_0x65e6('0x20')],'include':_0x2740bd[_0x65e6('0x1d')]?_['map'](_0x2740bd[_0x65e6('0x1d')],function(_0xc59712){return{'model':db[_0xc59712[_0x65e6('0x1f')]],'as':_0xc59712['as'],'attributes':_0xc59712[_0x65e6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x65e6('0x21')](function(_0x57388e){logger[_0x65e6('0xc')](_0x65e6('0x16'),_0x491be8);logger[_0x65e6('0xf')](_0x65e6('0x16'),_0x491be8,JSON[_0x65e6('0x11')](_0x57388e));_0x56a6e9(_0x57388e);})[_0x65e6('0x15')](function(_0x504a5a){logger[_0x65e6('0x12')](_0x65e6('0x16'),_0x504a5a[_0x65e6('0x13')],_0x491be8);_0x21e8fa(_0x3e83ff[_0x65e6('0x12')](0x1f4,_0x504a5a['message']));});});};exports[_0x65e6('0x22')]=function(_0x1ba586){var _0x2a2c9a=this;return new Promise(function(_0x1a8410,_0xfdc6a9){return db['VoiceCallReport']['create'](_0x1ba586['body'],{'raw':_0x1ba586[_0x65e6('0x19')]?_0x1ba586[_0x65e6('0x19')][_0x65e6('0x1a')]===undefined?!![]:![]:!![]})[_0x65e6('0x21')](function(_0xf9b79e){logger['info'](_0x65e6('0x22'),_0x1ba586);logger['debug'](_0x65e6('0x22'),_0x1ba586,JSON[_0x65e6('0x11')](_0xf9b79e));_0x1a8410(_0xf9b79e);})[_0x65e6('0x15')](function(_0x40201b){logger[_0x65e6('0x12')](_0x65e6('0x22'),_0x40201b['message'],_0x1ba586);_0xfdc6a9(_0x2a2c9a['error'](0x1f4,_0x40201b[_0x65e6('0x13')]));});});};exports[_0x65e6('0x23')]=function(_0x2db442){var _0x4d116a=this;return new Promise(function(_0x13d1ab,_0x10250a){return db[_0x65e6('0x17')][_0x65e6('0x24')](_0x2db442[_0x65e6('0x25')],{'raw':_0x2db442[_0x65e6('0x19')]?_0x2db442['options'][_0x65e6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2db442[_0x65e6('0x19')]?_0x2db442[_0x65e6('0x19')][_0x65e6('0x1b')]||null:null,'attributes':_0x2db442[_0x65e6('0x19')]?_0x2db442[_0x65e6('0x19')][_0x65e6('0x20')]||null:null,'limit':_0x2db442['options']?_0x2db442[_0x65e6('0x19')][_0x65e6('0x1c')]||null:null})[_0x65e6('0x21')](function(_0x478203){logger[_0x65e6('0xc')](_0x65e6('0x23'),_0x2db442);logger[_0x65e6('0xf')]('UpdateVoiceCallReport',_0x2db442,JSON[_0x65e6('0x11')](_0x478203));_0x13d1ab(_0x478203);})[_0x65e6('0x15')](function(_0x2cb9ef){logger[_0x65e6('0x12')]('UpdateVoiceCallReport',_0x2cb9ef[_0x65e6('0x13')],_0x2db442);_0x10250a(_0x4d116a[_0x65e6('0x12')](0x1f4,_0x2cb9ef[_0x65e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 693cf97..460eeef 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 _0x4116=['../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','show','create','/:id','update','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x35f42d,_0x4b258c){var _0x1b78f1=function(_0x30c333){while(--_0x30c333){_0x35f42d['push'](_0x35f42d['shift']());}};_0x1b78f1(++_0x4b258c);}(_0x4116,0x1cb));var _0x6411=function(_0x946156,_0x4902e0){_0x946156=_0x946156-0x0;var _0x5a7488=_0x4116[_0x946156];return _0x5a7488;};'use strict';var multer=require(_0x6411('0x0'));var util=require(_0x6411('0x1'));var path=require(_0x6411('0x2'));var timeout=require(_0x6411('0x3'));var express=require(_0x6411('0x4'));var router=express['Router']();var fs_extra=require(_0x6411('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6411('0x6'));var config=require('../../config/environment');var controller=require(_0x6411('0x7'));router[_0x6411('0x8')]('/',auth[_0x6411('0x9')](),controller[_0x6411('0xa')]);router['get']('/:id',auth[_0x6411('0x9')](),controller[_0x6411('0xb')]);router['post']('/',auth[_0x6411('0x9')](),controller[_0x6411('0xc')]);router['put'](_0x6411('0xd'),auth[_0x6411('0x9')](),controller[_0x6411('0xe')]);router['delete'](_0x6411('0xd'),auth[_0x6411('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x20cb=['get','/:id','post','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index'];(function(_0x23c52f,_0x5e6ada){var _0x5902c4=function(_0x1a561a){while(--_0x1a561a){_0x23c52f['push'](_0x23c52f['shift']());}};_0x5902c4(++_0x5e6ada);}(_0x20cb,0x1bc));var _0xb20c=function(_0x453a04,_0x243265){_0x453a04=_0x453a04-0x0;var _0x551053=_0x20cb[_0x453a04];return _0x551053;};'use strict';var multer=require('multer');var util=require(_0xb20c('0x0'));var path=require(_0xb20c('0x1'));var timeout=require(_0xb20c('0x2'));var express=require(_0xb20c('0x3'));var router=express[_0xb20c('0x4')]();var fs_extra=require(_0xb20c('0x5'));var auth=require(_0xb20c('0x6'));var interaction=require(_0xb20c('0x7'));var config=require(_0xb20c('0x8'));var controller=require(_0xb20c('0x9'));router['get']('/',auth[_0xb20c('0xa')](),controller[_0xb20c('0xb')]);router[_0xb20c('0xc')](_0xb20c('0xd'),auth[_0xb20c('0xa')](),controller['show']);router[_0xb20c('0xe')]('/',auth[_0xb20c('0xa')](),controller[_0xb20c('0xf')]);router['put'](_0xb20c('0xd'),auth['isAuthenticated'](),controller[_0xb20c('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb20c('0x11')]);module[_0xb20c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 71a504c..fad5eaf 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 _0x0dcd=['join','split','BOOLEAN','sequelize','exports','STRING','name','options'];(function(_0x118f45,_0x368035){var _0x4250ab=function(_0x4abfa4){while(--_0x4abfa4){_0x118f45['push'](_0x118f45['shift']());}};_0x4250ab(++_0x368035);}(_0x0dcd,0xeb));var _0xd0dc=function(_0x133cee,_0x474146){_0x133cee=_0x133cee-0x0;var _0x5b4de9=_0x0dcd[_0x133cee];return _0x5b4de9;};'use strict';var Sequelize=require(_0xd0dc('0x0'));module[_0xd0dc('0x1')]={'name':{'type':Sequelize[_0xd0dc('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xd0dc('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xd0dc('0x2')],'set':function(_0x38e9d9){this['setDataValue'](_0xd0dc('0x4'),_0x38e9d9?_0x38e9d9[_0xd0dc('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue']('options')[_0xd0dc('0x6')](''):[];}},'auth':{'type':Sequelize[_0xd0dc('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xd0dc('0x2')]},'record':{'type':Sequelize[_0xd0dc('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd0dc('0x2')]},'description':{'type':Sequelize[_0xd0dc('0x2')]}}; \ No newline at end of file +var _0xdee2=['getDataValue','BOOLEAN','sequelize','STRING','setDataValue','options','join'];(function(_0x34673d,_0x51616f){var _0x36e113=function(_0x1839dc){while(--_0x1839dc){_0x34673d['push'](_0x34673d['shift']());}};_0x36e113(++_0x51616f);}(_0xdee2,0x6b));var _0x2dee=function(_0x258c5a,_0x2481f9){_0x258c5a=_0x258c5a-0x0;var _0x3fd663=_0xdee2[_0x258c5a];return _0x3fd663;};'use strict';var Sequelize=require(_0x2dee('0x0'));module['exports']={'name':{'type':Sequelize[_0x2dee('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x2dee('0x1')],'set':function(_0x5f5ae1){this[_0x2dee('0x2')](_0x2dee('0x3'),_0x5f5ae1?_0x5f5ae1[_0x2dee('0x4')](''):[]);},'get':function(){return this[_0x2dee('0x5')](_0x2dee('0x3'))?this[_0x2dee('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x2dee('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x2dee('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2dee('0x1')]},'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 fd6c814..be5aa6d 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 _0x3eec=['set','Content-Range','apply','reject','save','update','then','get','ChanSpies','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','VoiceChanSpy','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit'];(function(_0x3b347d,_0x10f497){var _0x8e9bc8=function(_0x1d9370){while(--_0x1d9370){_0x3b347d['push'](_0x3b347d['shift']());}};_0x8e9bc8(++_0x10f497);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x38f047,_0x3ade29){_0x38f047=_0x38f047-0x0;var _0x475fa0=_0x3eec[_0x38f047];return _0x475fa0;};'use strict';var emlformat=require(_0xc3ee('0x0'));var rimraf=require(_0xc3ee('0x1'));var zipdir=require(_0xc3ee('0x2'));var jsonpatch=require(_0xc3ee('0x3'));var rp=require('request-promise');var moment=require(_0xc3ee('0x4'));var BPromise=require(_0xc3ee('0x5'));var Mustache=require(_0xc3ee('0x6'));var util=require(_0xc3ee('0x7'));var path=require(_0xc3ee('0x8'));var sox=require(_0xc3ee('0x9'));var csv=require('to-csv');var ejs=require(_0xc3ee('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ee('0xb'));var _=require(_0xc3ee('0xc'));var squel=require(_0xc3ee('0xd'));var crypto=require(_0xc3ee('0xe'));var jsforce=require(_0xc3ee('0xf'));var deskjs=require(_0xc3ee('0x10'));var toCsv=require(_0xc3ee('0x11'));var querystring=require(_0xc3ee('0x12'));var Papa=require(_0xc3ee('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3ee('0x14'));var as=require(_0xc3ee('0x15'));var hardwareService=require(_0xc3ee('0x16'));var logger=require(_0xc3ee('0x17'))('api');var utils=require(_0xc3ee('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc3ee('0x19'));var db=require(_0xc3ee('0x1a'))['db'];function respondWithStatusCode(_0x4beb01,_0x5f2c3a){_0x5f2c3a=_0x5f2c3a||0xcc;return function(_0x2eb82e){if(_0x2eb82e){return _0x4beb01['sendStatus'](_0x5f2c3a);}return _0x4beb01[_0xc3ee('0x1b')](_0x5f2c3a)['end']();};}function respondWithResult(_0x19feb3,_0x58ebe7){_0x58ebe7=_0x58ebe7||0xc8;return function(_0x3d669d){if(_0x3d669d){return _0x19feb3[_0xc3ee('0x1b')](_0x58ebe7)[_0xc3ee('0x1c')](_0x3d669d);}};}function respondWithFilteredResult(_0x664bad,_0x476f8f){return function(_0xf63359){if(_0xf63359){var _0x277e11=typeof _0x476f8f['offset']===_0xc3ee('0x1d')&&typeof _0x476f8f['limit']===_0xc3ee('0x1d');var _0x1bf49a=_0xf63359[_0xc3ee('0x1e')];var _0x219db0=_0x277e11?0x0:_0x476f8f[_0xc3ee('0x1f')];var _0x3acb0c=_0x277e11?_0xf63359[_0xc3ee('0x1e')]:_0x476f8f[_0xc3ee('0x1f')]+_0x476f8f[_0xc3ee('0x20')];var _0x202a9a;if(_0x3acb0c>=_0x1bf49a){_0x3acb0c=_0x1bf49a;_0x202a9a=0xc8;}else{_0x202a9a=0xce;}_0x664bad[_0xc3ee('0x1b')](_0x202a9a);return _0x664bad[_0xc3ee('0x21')](_0xc3ee('0x22'),_0x219db0+'-'+_0x3acb0c+'/'+_0x1bf49a)[_0xc3ee('0x1c')](_0xf63359);}return null;};}function patchUpdates(_0x3e7224){return function(_0x46a8c9){try{jsonpatch[_0xc3ee('0x23')](_0x46a8c9,_0x3e7224,!![]);}catch(_0x30df3a){return BPromise[_0xc3ee('0x24')](_0x30df3a);}return _0x46a8c9[_0xc3ee('0x25')]();};}function saveUpdates(_0x11778f,_0x493fea){return function(_0x4d672e){if(_0x4d672e){return _0x4d672e[_0xc3ee('0x26')](_0x11778f)[_0xc3ee('0x27')](function(_0x3b8f75){return _0x3b8f75;});}return null;};}function removeEntity(_0x464ffc,_0x28bfeb){return function(_0x238df7){if(_0x238df7){return _0x238df7['destroy']()[_0xc3ee('0x27')](function(){var _0x3f8f7b=_0x238df7[_0xc3ee('0x28')]({'plain':!![]});var _0xfd03bd=_0xc3ee('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd03bd,'resourceId':_0x3f8f7b['id']}})[_0xc3ee('0x27')](function(){return _0x238df7;});})[_0xc3ee('0x27')](function(){_0x464ffc[_0xc3ee('0x1b')](0xcc)[_0xc3ee('0x2a')]();});}};}function handleEntityNotFound(_0x836fac,_0x4ecfec){return function(_0x56201a){if(!_0x56201a){_0x836fac['sendStatus'](0x194);}return _0x56201a;};}function handleError(_0x1be005,_0x2f2c29){_0x2f2c29=_0x2f2c29||0x1f4;return function(_0x44678b){logger[_0xc3ee('0x2b')](_0x44678b[_0xc3ee('0x2c')]);if(_0x44678b['name']){delete _0x44678b[_0xc3ee('0x2d')];}_0x1be005[_0xc3ee('0x1b')](_0x2f2c29)[_0xc3ee('0x2e')](_0x44678b);};}exports[_0xc3ee('0x2f')]=function(_0x1f7b3a,_0x8bbe1e){var _0x3b17f7={},_0x4da264={},_0x330b71={'count':0x0,'rows':[]};var _0x35c19a=_[_0xc3ee('0x30')](db['VoiceChanSpy'][_0xc3ee('0x31')],function(_0x240a16){return{'name':_0x240a16[_0xc3ee('0x32')],'type':_0x240a16[_0xc3ee('0x33')][_0xc3ee('0x34')]};});_0x4da264[_0xc3ee('0x35')]=_[_0xc3ee('0x30')](_0x35c19a,'name');_0x4da264[_0xc3ee('0x36')]=_['keys'](_0x1f7b3a[_0xc3ee('0x36')]);_0x4da264[_0xc3ee('0x37')]=_[_0xc3ee('0x38')](_0x4da264[_0xc3ee('0x35')],_0x4da264[_0xc3ee('0x36')]);_0x3b17f7[_0xc3ee('0x39')]=_['intersection'](_0x4da264[_0xc3ee('0x35')],qs[_0xc3ee('0x3a')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3a')]));_0x3b17f7[_0xc3ee('0x39')]=_0x3b17f7[_0xc3ee('0x39')][_0xc3ee('0x3b')]?_0x3b17f7[_0xc3ee('0x39')]:_0x4da264[_0xc3ee('0x35')];if(!_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x3c')](_0xc3ee('0x3d'))){_0x3b17f7[_0xc3ee('0x20')]=qs[_0xc3ee('0x20')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x20')]);_0x3b17f7[_0xc3ee('0x1f')]=qs[_0xc3ee('0x1f')](_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x1f')]);}_0x3b17f7[_0xc3ee('0x3e')]=qs['sort'](_0x1f7b3a[_0xc3ee('0x36')]['sort']);_0x3b17f7[_0xc3ee('0x3f')]=qs[_0xc3ee('0x37')](_[_0xc3ee('0x40')](_0x1f7b3a[_0xc3ee('0x36')],_0x4da264[_0xc3ee('0x37')]),_0x35c19a);if(_0x1f7b3a[_0xc3ee('0x36')]['filter']){_0x3b17f7[_0xc3ee('0x3f')]=_[_0xc3ee('0x41')](_0x3b17f7[_0xc3ee('0x3f')],{'$or':_['map'](_0x35c19a,function(_0x181179){if(_0x181179[_0xc3ee('0x33')]!==_0xc3ee('0x42')){var _0x1fe17f={};_0x1fe17f[_0x181179[_0xc3ee('0x2d')]]={'$like':'%'+_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x43')]+'%'};return _0x1fe17f;}})});}_0x3b17f7=_[_0xc3ee('0x41')]({},_0x3b17f7,_0x1f7b3a[_0xc3ee('0x44')]);var _0x23d365={'where':_0x3b17f7[_0xc3ee('0x3f')]};return db['VoiceChanSpy'][_0xc3ee('0x1e')](_0x23d365)[_0xc3ee('0x27')](function(_0x4a89b7){_0x330b71['count']=_0x4a89b7;if(_0x1f7b3a[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x3b17f7[_0xc3ee('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xc3ee('0x47')](_0x3b17f7);})[_0xc3ee('0x27')](function(_0x112e77){_0x330b71[_0xc3ee('0x48')]=_0x112e77;return _0x330b71;})[_0xc3ee('0x27')](respondWithFilteredResult(_0x8bbe1e,_0x3b17f7))[_0xc3ee('0x49')](handleError(_0x8bbe1e,null));};exports[_0xc3ee('0x4a')]=function(_0x724c4e,_0x49b424){var _0x602d47={'raw':![],'where':{'id':_0x724c4e[_0xc3ee('0x4b')]['id']}},_0xf833d9={};_0xf833d9[_0xc3ee('0x35')]=_[_0xc3ee('0x4c')](db['VoiceChanSpy'][_0xc3ee('0x31')]);_0xf833d9['query']=_['keys'](_0x724c4e[_0xc3ee('0x36')]);_0xf833d9[_0xc3ee('0x37')]=_['intersection'](_0xf833d9[_0xc3ee('0x35')],_0xf833d9[_0xc3ee('0x36')]);_0x602d47['attributes']=_[_0xc3ee('0x38')](_0xf833d9['model'],qs[_0xc3ee('0x3a')](_0x724c4e['query'][_0xc3ee('0x3a')]));_0x602d47[_0xc3ee('0x39')]=_0x602d47['attributes']['length']?_0x602d47['attributes']:_0xf833d9[_0xc3ee('0x35')];if(_0x724c4e[_0xc3ee('0x36')][_0xc3ee('0x45')]){_0x602d47[_0xc3ee('0x46')]=[{'all':!![]}];}_0x602d47=_[_0xc3ee('0x41')]({},_0x602d47,_0x724c4e['options']);return db['VoiceChanSpy'][_0xc3ee('0x4d')](_0x602d47)[_0xc3ee('0x27')](handleEntityNotFound(_0x49b424,null))['then'](respondWithResult(_0x49b424,null))[_0xc3ee('0x49')](handleError(_0x49b424,null));};exports['create']=function(_0x60e36a,_0x5d0017){return db[_0xc3ee('0x4e')][_0xc3ee('0x4f')](_0x60e36a[_0xc3ee('0x50')],{})[_0xc3ee('0x27')](function(_0x8c8cc6){var _0x281adc=_0x60e36a[_0xc3ee('0x51')]['get']({'plain':!![]});if(!_0x281adc)throw new Error(_0xc3ee('0x52'));if(_0x281adc[_0xc3ee('0x53')]===_0xc3ee('0x51')){var _0x237aa8=_0x8c8cc6['get']({'plain':!![]});var _0xd246f2=_0xc3ee('0x29');return db[_0xc3ee('0x54')][_0xc3ee('0x4d')]({'where':{'name':_0xd246f2,'userProfileId':_0x281adc[_0xc3ee('0x55')]},'raw':!![]})[_0xc3ee('0x27')](function(_0x14df9d){if(_0x14df9d&&_0x14df9d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x237aa8['name'],'resourceId':_0x237aa8['id'],'type':_0x14df9d[_0xc3ee('0x2d')],'sectionId':_0x14df9d['id']},{})[_0xc3ee('0x27')](function(){return _0x8c8cc6;});}else{return _0x8c8cc6;}})[_0xc3ee('0x49')](function(_0x2b9ea){logger[_0xc3ee('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b9ea);throw _0x2b9ea;});}return _0x8c8cc6;})['then'](respondWithResult(_0x5d0017,0xc9))[_0xc3ee('0x49')](handleError(_0x5d0017,null));};exports['update']=function(_0x1ca127,_0x28eca9){if(_0x1ca127[_0xc3ee('0x50')]['id']){delete _0x1ca127['body']['id'];}return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x1ca127[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x28eca9,null))[_0xc3ee('0x27')](saveUpdates(_0x1ca127[_0xc3ee('0x50')],null))[_0xc3ee('0x27')](respondWithResult(_0x28eca9,null))[_0xc3ee('0x49')](handleError(_0x28eca9,null));};exports[_0xc3ee('0x56')]=function(_0x5d5ca5,_0x3fdc8f){return db[_0xc3ee('0x4e')][_0xc3ee('0x4d')]({'where':{'id':_0x5d5ca5[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x3fdc8f,null))[_0xc3ee('0x27')](removeEntity(_0x3fdc8f,null))[_0xc3ee('0x49')](handleError(_0x3fdc8f,null));}; \ No newline at end of file +var _0x6308=['nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1832f1,_0x51c0e1){var _0x1902cb=function(_0x462c78){while(--_0x462c78){_0x1832f1['push'](_0x1832f1['shift']());}};_0x1902cb(++_0x51c0e1);}(_0x6308,0x1f2));var _0x8630=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6308[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x8630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8630('0x2'));var BPromise=require(_0x8630('0x3'));var Mustache=require(_0x8630('0x4'));var util=require(_0x8630('0x5'));var path=require(_0x8630('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8630('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0xd'));var querystring=require('querystring');var Papa=require(_0x8630('0xe'));var Redis=require('ioredis');var authService=require(_0x8630('0xf'));var qs=require(_0x8630('0x10'));var as=require(_0x8630('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x12'))(_0x8630('0x13'));var utils=require(_0x8630('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8630('0x15'));var db=require(_0x8630('0x16'))['db'];function respondWithStatusCode(_0x5b6d75,_0x54073b){_0x54073b=_0x54073b||0xcc;return function(_0x303e3a){if(_0x303e3a){return _0x5b6d75[_0x8630('0x17')](_0x54073b);}return _0x5b6d75['status'](_0x54073b)[_0x8630('0x18')]();};}function respondWithResult(_0x4db686,_0xf31c17){_0xf31c17=_0xf31c17||0xc8;return function(_0x4cc542){if(_0x4cc542){return _0x4db686[_0x8630('0x19')](_0xf31c17)['json'](_0x4cc542);}};}function respondWithFilteredResult(_0x53f236,_0x29a42d){return function(_0x86c262){if(_0x86c262){var _0x49fce1=typeof _0x29a42d['offset']===_0x8630('0x1a')&&typeof _0x29a42d['limit']===_0x8630('0x1a');var _0x18a874=_0x86c262[_0x8630('0x1b')];var _0x20f462=_0x49fce1?0x0:_0x29a42d[_0x8630('0x1c')];var _0x1e9780=_0x49fce1?_0x86c262[_0x8630('0x1b')]:_0x29a42d[_0x8630('0x1c')]+_0x29a42d[_0x8630('0x1d')];var _0x5dd2e0;if(_0x1e9780>=_0x18a874){_0x1e9780=_0x18a874;_0x5dd2e0=0xc8;}else{_0x5dd2e0=0xce;}_0x53f236['status'](_0x5dd2e0);return _0x53f236[_0x8630('0x1e')](_0x8630('0x1f'),_0x20f462+'-'+_0x1e9780+'/'+_0x18a874)['json'](_0x86c262);}return null;};}function patchUpdates(_0x5cff5c){return function(_0x1325dc){try{jsonpatch[_0x8630('0x20')](_0x1325dc,_0x5cff5c,!![]);}catch(_0x1ac046){return BPromise['reject'](_0x1ac046);}return _0x1325dc['save']();};}function saveUpdates(_0xcc7454,_0x58c0b5){return function(_0x30fb4d){if(_0x30fb4d){return _0x30fb4d[_0x8630('0x21')](_0xcc7454)[_0x8630('0x22')](function(_0x469de3){return _0x469de3;});}return null;};}function removeEntity(_0x4c2851,_0x37c224){return function(_0xf24c11){if(_0xf24c11){return _0xf24c11[_0x8630('0x23')]()[_0x8630('0x22')](function(){var _0x41871a=_0xf24c11[_0x8630('0x24')]({'plain':!![]});var _0x37b7aa='ChanSpies';return db['UserProfileResource'][_0x8630('0x23')]({'where':{'type':_0x37b7aa,'resourceId':_0x41871a['id']}})[_0x8630('0x22')](function(){return _0xf24c11;});})[_0x8630('0x22')](function(){_0x4c2851[_0x8630('0x19')](0xcc)[_0x8630('0x18')]();});}};}function handleEntityNotFound(_0x1c012d,_0x149a8e){return function(_0x349c4d){if(!_0x349c4d){_0x1c012d[_0x8630('0x17')](0x194);}return _0x349c4d;};}function handleError(_0x357c15,_0x221841){_0x221841=_0x221841||0x1f4;return function(_0x41f74c){logger[_0x8630('0x25')](_0x41f74c[_0x8630('0x26')]);if(_0x41f74c[_0x8630('0x27')]){delete _0x41f74c[_0x8630('0x27')];}_0x357c15[_0x8630('0x19')](_0x221841)['send'](_0x41f74c);};}exports[_0x8630('0x28')]=function(_0x4545c2,_0x24d85d){var _0xe3ed67={},_0x55653d={},_0x43e470={'count':0x0,'rows':[]};var _0x1eb036=_[_0x8630('0x29')](db[_0x8630('0x2a')][_0x8630('0x2b')],function(_0x32f4fd){return{'name':_0x32f4fd['fieldName'],'type':_0x32f4fd[_0x8630('0x2c')][_0x8630('0x2d')]};});_0x55653d[_0x8630('0x2e')]=_['map'](_0x1eb036,_0x8630('0x27'));_0x55653d[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x4545c2[_0x8630('0x2f')]);_0x55653d[_0x8630('0x31')]=_[_0x8630('0x32')](_0x55653d['model'],_0x55653d[_0x8630('0x2f')]);_0xe3ed67[_0x8630('0x33')]=_[_0x8630('0x32')](_0x55653d[_0x8630('0x2e')],qs[_0x8630('0x34')](_0x4545c2[_0x8630('0x2f')][_0x8630('0x34')]));_0xe3ed67[_0x8630('0x33')]=_0xe3ed67[_0x8630('0x33')][_0x8630('0x35')]?_0xe3ed67[_0x8630('0x33')]:_0x55653d[_0x8630('0x2e')];if(!_0x4545c2[_0x8630('0x2f')][_0x8630('0x36')](_0x8630('0x37'))){_0xe3ed67[_0x8630('0x1d')]=qs[_0x8630('0x1d')](_0x4545c2['query'][_0x8630('0x1d')]);_0xe3ed67[_0x8630('0x1c')]=qs['offset'](_0x4545c2['query'][_0x8630('0x1c')]);}_0xe3ed67[_0x8630('0x38')]=qs[_0x8630('0x39')](_0x4545c2[_0x8630('0x2f')][_0x8630('0x39')]);_0xe3ed67['where']=qs[_0x8630('0x31')](_[_0x8630('0x3a')](_0x4545c2[_0x8630('0x2f')],_0x55653d[_0x8630('0x31')]),_0x1eb036);if(_0x4545c2['query'][_0x8630('0x3b')]){_0xe3ed67[_0x8630('0x3c')]=_[_0x8630('0x3d')](_0xe3ed67[_0x8630('0x3c')],{'$or':_[_0x8630('0x29')](_0x1eb036,function(_0x16c041){if(_0x16c041[_0x8630('0x2c')]!=='VIRTUAL'){var _0x1076f4={};_0x1076f4[_0x16c041[_0x8630('0x27')]]={'$like':'%'+_0x4545c2[_0x8630('0x2f')][_0x8630('0x3b')]+'%'};return _0x1076f4;}})});}_0xe3ed67=_[_0x8630('0x3d')]({},_0xe3ed67,_0x4545c2[_0x8630('0x3e')]);var _0x25cb36={'where':_0xe3ed67[_0x8630('0x3c')]};return db[_0x8630('0x2a')][_0x8630('0x1b')](_0x25cb36)['then'](function(_0x358431){_0x43e470['count']=_0x358431;if(_0x4545c2[_0x8630('0x2f')][_0x8630('0x3f')]){_0xe3ed67[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x2a')][_0x8630('0x41')](_0xe3ed67);})[_0x8630('0x22')](function(_0x5bcf39){_0x43e470[_0x8630('0x42')]=_0x5bcf39;return _0x43e470;})[_0x8630('0x22')](respondWithFilteredResult(_0x24d85d,_0xe3ed67))[_0x8630('0x43')](handleError(_0x24d85d,null));};exports['show']=function(_0x79385,_0x1ea295){var _0x40914f={'raw':![],'where':{'id':_0x79385[_0x8630('0x44')]['id']}},_0x327466={};_0x327466[_0x8630('0x2e')]=_['keys'](db[_0x8630('0x2a')][_0x8630('0x2b')]);_0x327466[_0x8630('0x2f')]=_['keys'](_0x79385[_0x8630('0x2f')]);_0x327466[_0x8630('0x31')]=_['intersection'](_0x327466[_0x8630('0x2e')],_0x327466[_0x8630('0x2f')]);_0x40914f[_0x8630('0x33')]=_['intersection'](_0x327466['model'],qs[_0x8630('0x34')](_0x79385['query']['fields']));_0x40914f[_0x8630('0x33')]=_0x40914f['attributes'][_0x8630('0x35')]?_0x40914f[_0x8630('0x33')]:_0x327466['model'];if(_0x79385[_0x8630('0x2f')][_0x8630('0x3f')]){_0x40914f[_0x8630('0x40')]=[{'all':!![]}];}_0x40914f=_[_0x8630('0x3d')]({},_0x40914f,_0x79385[_0x8630('0x3e')]);return db['VoiceChanSpy'][_0x8630('0x45')](_0x40914f)[_0x8630('0x22')](handleEntityNotFound(_0x1ea295,null))['then'](respondWithResult(_0x1ea295,null))[_0x8630('0x43')](handleError(_0x1ea295,null));};exports[_0x8630('0x46')]=function(_0x3ff20b,_0x47aa03){return db[_0x8630('0x2a')][_0x8630('0x46')](_0x3ff20b[_0x8630('0x47')],{})[_0x8630('0x22')](function(_0x8b467a){var _0xefe57b=_0x3ff20b[_0x8630('0x48')][_0x8630('0x24')]({'plain':!![]});if(!_0xefe57b)throw new Error(_0x8630('0x49'));if(_0xefe57b['role']==='user'){var _0x1b8328=_0x8b467a[_0x8630('0x24')]({'plain':!![]});var _0x34619c=_0x8630('0x4a');return db[_0x8630('0x4b')][_0x8630('0x45')]({'where':{'name':_0x34619c,'userProfileId':_0xefe57b[_0x8630('0x4c')]},'raw':!![]})['then'](function(_0x2af827){if(_0x2af827&&_0x2af827[_0x8630('0x4d')]===0x0){return db[_0x8630('0x4e')][_0x8630('0x46')]({'name':_0x1b8328[_0x8630('0x27')],'resourceId':_0x1b8328['id'],'type':_0x2af827['name'],'sectionId':_0x2af827['id']},{})[_0x8630('0x22')](function(){return _0x8b467a;});}else{return _0x8b467a;}})[_0x8630('0x43')](function(_0xeacec4){logger[_0x8630('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeacec4);throw _0xeacec4;});}return _0x8b467a;})[_0x8630('0x22')](respondWithResult(_0x47aa03,0xc9))[_0x8630('0x43')](handleError(_0x47aa03,null));};exports['update']=function(_0x2edc3d,_0x1ecb2a){if(_0x2edc3d[_0x8630('0x47')]['id']){delete _0x2edc3d[_0x8630('0x47')]['id'];}return db['VoiceChanSpy'][_0x8630('0x45')]({'where':{'id':_0x2edc3d[_0x8630('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ecb2a,null))['then'](saveUpdates(_0x2edc3d[_0x8630('0x47')],null))[_0x8630('0x22')](respondWithResult(_0x1ecb2a,null))['catch'](handleError(_0x1ecb2a,null));};exports[_0x8630('0x23')]=function(_0x510113,_0x2e49c8){return db[_0x8630('0x2a')][_0x8630('0x45')]({'where':{'id':_0x510113['params']['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x2e49c8,null))[_0x8630('0x22')](removeEntity(_0x2e49c8,null))[_0x8630('0x43')](handleError(_0x2e49c8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 83e01b4..59df7f3 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 _0xe9fd=['exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','name','options','join','StopMixMonitor','internal','concat','findAll','agent','then','catch'];(function(_0x1a80ab,_0x10d3cf){var _0x2f9e4f=function(_0xad0bc1){while(--_0xad0bc1){_0x1a80ab['push'](_0x1a80ab['shift']());}};_0x2f9e4f(++_0x10d3cf);}(_0xe9fd,0xf2));var _0xde9f=function(_0x223bb0,_0x19f9a2){_0x223bb0=_0x223bb0-0x0;var _0x435423=_0xe9fd[_0x223bb0];return _0x435423;};'use strict';var _=require(_0xde9f('0x0'));var util=require(_0xde9f('0x1'));var BPromise=require(_0xde9f('0x2'));var attributes=require(_0xde9f('0x3'));var getUserApplications=function(_0x45252f,_0x100197,_0x788ad9){var _0xcb62=0x1;var _0x4065b2=[];var _0x7f39ca={'context':_0x100197[_0xde9f('0x4')]||_0xde9f('0x5'),'exten':util[_0xde9f('0x6')](_0xde9f('0x7'),_0x45252f[_0xde9f('0x8')],_0x788ad9),'type':_0xde9f('0x9'),'isApp':![],'ChanSpyId':_0x45252f['id'],'UserId':_0x100197['id']};_0x4065b2[_0xde9f('0xa')](_[_0xde9f('0xb')]({'app':_0xde9f('0xc'),'appdata':util['format'](_0xde9f('0xd'),_0xde9f('0xe')),'priority':_0xcb62++},_0x7f39ca));if(_0x45252f[_0xde9f('0xf')]){_0x4065b2[_0xde9f('0xa')](_[_0xde9f('0xb')]({'app':_0xde9f('0x10'),'appdata':util['format'](_0xde9f('0x11'),_0x45252f['recordingFormat']),'priority':_0xcb62++},_0x7f39ca));}if(_0x45252f[_0xde9f('0x12')]){_0x4065b2[_0xde9f('0xa')](_['merge']({'app':'Authenticate','appdata':_0x45252f[_0xde9f('0x13')],'priority':_0xcb62++},_0x7f39ca));}_0x4065b2['push'](_['merge']({'app':_0xde9f('0x14'),'appdata':util['format']('SIP/%s,%s',_0x100197[_0xde9f('0x15')],_0x45252f['options']?_0x45252f[_0xde9f('0x16')][_0xde9f('0x17')](''):''),'priority':_0xcb62++},_0x7f39ca));if(_0x45252f['record']){_0x4065b2[_0xde9f('0xa')](_[_0xde9f('0xb')]({'app':_0xde9f('0x18'),'priority':_0xcb62++},_0x7f39ca));}return _0x4065b2;};var getChanSpyApplications=function(_0x1d9616,_0x2db1ec){var _0x3d0839=[];for(var _0x3db484=0x0,_0x3f1785=0x1;_0x3db484<_0x2db1ec['length'];_0x3db484++,_0x3f1785=0x1){_0x3d0839=_0x3d0839['concat'](getUserApplications(_0x1d9616,_0x2db1ec[_0x3db484],_0x2db1ec[_0x3db484][_0xde9f('0x19')]));if(_0x2db1ec[_0x3db484][_0xde9f('0x19')]!=_0x2db1ec[_0x3db484][_0xde9f('0x15')]){_0x3d0839=_0x3d0839[_0xde9f('0x1a')](getUserApplications(_0x1d9616,_0x2db1ec[_0x3db484],_0x2db1ec[_0x3db484][_0xde9f('0x15')]));}}return _0x3d0839;};var getChanSpyPromise=function(_0xa3a610,_0x1103f1){return new BPromise(function(_0x4d01c9,_0x2e1df4){return _0xa3a610['User'][_0xde9f('0x1b')]({'attributes':['id',_0xde9f('0x15'),_0xde9f('0x19')],'where':{'role':_0xde9f('0x1c'),'chanspy':!![]},'raw':!![]})[_0xde9f('0x1d')](function(_0x291e5e){if(_0x291e5e){return _0x4d01c9(getChanSpyApplications(_0x1103f1,_0x291e5e));}return _0x4d01c9([]);})[_0xde9f('0x1e')](function(_0x20ac6f){_0x2e1df4(_0x20ac6f);});});};module[_0xde9f('0x1f')]=function(_0x21b220,_0x34bca1){var _0x453dfa=_0x21b220['models'];return _0x21b220[_0xde9f('0x20')](_0xde9f('0x21'),attributes,{'tableName':_0xde9f('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ada79,_0x1f7b1a,_0x3a971f){return getChanSpyPromise(_0x453dfa,_0x3ada79)[_0xde9f('0x1d')](function(_0x5b48fb){if(_0x5b48fb&&_0x5b48fb[_0xde9f('0x23')]){return _0x453dfa[_0xde9f('0x24')][_0xde9f('0x25')](_0x5b48fb);}})[_0xde9f('0x1d')](function(){_0x3a971f();})[_0xde9f('0x1e')](function(_0x120ee5){_0x3a971f(_0x120ee5);});},'afterUpdate':function(_0x4b887f,_0x3de74d,_0x10a4c2){return _0x453dfa[_0xde9f('0x24')][_0xde9f('0x26')]({'where':{'ChanSpyId':_0x4b887f['id']}})[_0xde9f('0x1d')](function(){return getChanSpyPromise(_0x453dfa,_0x4b887f);})[_0xde9f('0x1d')](function(_0x86ef5f){if(_0x86ef5f&&_0x86ef5f[_0xde9f('0x23')]){return _0x453dfa[_0xde9f('0x24')]['bulkCreate'](_0x86ef5f);}})[_0xde9f('0x1d')](function(){_0x10a4c2();})[_0xde9f('0x1e')](function(_0x1a3447){_0x10a4c2(_0x1a3447);});},'afterDestroy':function(_0x26aeec,_0x50b42f,_0x57d171){return _0x453dfa['VoiceExtension'][_0xde9f('0x26')]({'where':{'ChanSpyId':_0x26aeec['id']}})['then'](function(){_0x57d171();})[_0xde9f('0x1e')](function(_0x431762){_0x57d171(_0x431762);});}}});}; \ No newline at end of file +var _0x48fd=['lodash','./voiceChanSpy.attributes','context','from-sip','format','system','push','Set','chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','name','options','join','record','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy'];(function(_0x1c3c9c,_0x5e8a1f){var _0x161807=function(_0x3aa7b3){while(--_0x3aa7b3){_0x1c3c9c['push'](_0x1c3c9c['shift']());}};_0x161807(++_0x5e8a1f);}(_0x48fd,0xb4));var _0xd48f=function(_0xd5d12f,_0x453a59){_0xd5d12f=_0xd5d12f-0x0;var _0x442bcd=_0x48fd[_0xd5d12f];return _0x442bcd;};'use strict';var _=require(_0xd48f('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xd48f('0x1'));var getUserApplications=function(_0x2bb5f1,_0x58166c,_0x583ed8){var _0x4f4450=0x1;var _0x17b4c7=[];var _0x36c3e1={'context':_0x58166c[_0xd48f('0x2')]||_0xd48f('0x3'),'exten':util[_0xd48f('0x4')]('%s%s',_0x2bb5f1['prefix'],_0x583ed8),'type':_0xd48f('0x5'),'isApp':![],'ChanSpyId':_0x2bb5f1['id'],'UserId':_0x58166c['id']};_0x17b4c7[_0xd48f('0x6')](_['merge']({'app':_0xd48f('0x7'),'appdata':util[_0xd48f('0x4')]('CDR(type)=%s',_0xd48f('0x8')),'priority':_0x4f4450++},_0x36c3e1));if(_0x2bb5f1['record']){_0x17b4c7[_0xd48f('0x6')](_[_0xd48f('0x9')]({'app':_0xd48f('0xa'),'appdata':util['format'](_0xd48f('0xb'),_0x2bb5f1[_0xd48f('0xc')]),'priority':_0x4f4450++},_0x36c3e1));}if(_0x2bb5f1['auth']){_0x17b4c7['push'](_[_0xd48f('0x9')]({'app':'Authenticate','appdata':_0x2bb5f1[_0xd48f('0xd')],'priority':_0x4f4450++},_0x36c3e1));}_0x17b4c7[_0xd48f('0x6')](_[_0xd48f('0x9')]({'app':_0xd48f('0xe'),'appdata':util['format']('SIP/%s,%s',_0x58166c[_0xd48f('0xf')],_0x2bb5f1[_0xd48f('0x10')]?_0x2bb5f1[_0xd48f('0x10')][_0xd48f('0x11')](''):''),'priority':_0x4f4450++},_0x36c3e1));if(_0x2bb5f1[_0xd48f('0x12')]){_0x17b4c7[_0xd48f('0x6')](_[_0xd48f('0x9')]({'app':_0xd48f('0x13'),'priority':_0x4f4450++},_0x36c3e1));}return _0x17b4c7;};var getChanSpyApplications=function(_0x28a7ed,_0x26b9a6){var _0x1f4298=[];for(var _0x2ff72b=0x0,_0x3ae002=0x1;_0x2ff72b<_0x26b9a6[_0xd48f('0x14')];_0x2ff72b++,_0x3ae002=0x1){_0x1f4298=_0x1f4298['concat'](getUserApplications(_0x28a7ed,_0x26b9a6[_0x2ff72b],_0x26b9a6[_0x2ff72b]['internal']));if(_0x26b9a6[_0x2ff72b][_0xd48f('0x15')]!=_0x26b9a6[_0x2ff72b][_0xd48f('0xf')]){_0x1f4298=_0x1f4298[_0xd48f('0x16')](getUserApplications(_0x28a7ed,_0x26b9a6[_0x2ff72b],_0x26b9a6[_0x2ff72b]['name']));}}return _0x1f4298;};var getChanSpyPromise=function(_0x940b15,_0x58571b){return new BPromise(function(_0x2ace5f,_0x465614){return _0x940b15[_0xd48f('0x17')][_0xd48f('0x18')]({'attributes':['id',_0xd48f('0xf'),_0xd48f('0x15')],'where':{'role':_0xd48f('0x19'),'chanspy':!![]},'raw':!![]})[_0xd48f('0x1a')](function(_0x55650d){if(_0x55650d){return _0x2ace5f(getChanSpyApplications(_0x58571b,_0x55650d));}return _0x2ace5f([]);})[_0xd48f('0x1b')](function(_0x2ac442){_0x465614(_0x2ac442);});});};module[_0xd48f('0x1c')]=function(_0x2cd276,_0x5690e9){var _0x3b2e69=_0x2cd276[_0xd48f('0x1d')];return _0x2cd276[_0xd48f('0x1e')](_0xd48f('0x1f'),attributes,{'tableName':_0xd48f('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x33ed9f,_0x1167d1,_0x54166a){return getChanSpyPromise(_0x3b2e69,_0x33ed9f)['then'](function(_0x3d003a){if(_0x3d003a&&_0x3d003a[_0xd48f('0x14')]){return _0x3b2e69[_0xd48f('0x21')][_0xd48f('0x22')](_0x3d003a);}})[_0xd48f('0x1a')](function(){_0x54166a();})[_0xd48f('0x1b')](function(_0x2bc53e){_0x54166a(_0x2bc53e);});},'afterUpdate':function(_0x184e4b,_0x348895,_0x1800fe){return _0x3b2e69['VoiceExtension'][_0xd48f('0x23')]({'where':{'ChanSpyId':_0x184e4b['id']}})[_0xd48f('0x1a')](function(){return getChanSpyPromise(_0x3b2e69,_0x184e4b);})[_0xd48f('0x1a')](function(_0x3d0a12){if(_0x3d0a12&&_0x3d0a12['length']){return _0x3b2e69[_0xd48f('0x21')][_0xd48f('0x22')](_0x3d0a12);}})[_0xd48f('0x1a')](function(){_0x1800fe();})['catch'](function(_0x135d82){_0x1800fe(_0x135d82);});},'afterDestroy':function(_0x18f8c2,_0x486235,_0x4f23a6){return _0x3b2e69[_0xd48f('0x21')]['destroy']({'where':{'ChanSpyId':_0x18f8c2['id']}})['then'](function(){_0x4f23a6();})[_0xd48f('0x1b')](function(_0x328941){_0x4f23a6(_0x328941);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index abc0505..79bc7d8 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x55e0,0xdc));var _0x055e=function(_0x4241c6,_0x21977d){_0x4241c6=_0x4241c6-0x0;var _0xca4395=_0x55e0[_0x4241c6];return _0xca4395;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0xb248=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xa3f080,_0x148af7){var _0x26f3e4=function(_0x1fa1e5){while(--_0x1fa1e5){_0xa3f080['push'](_0xa3f080['shift']());}};_0x26f3e4(++_0x148af7);}(_0xb248,0xc6));var _0x8b24=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb248[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var moment=require(_0x8b24('0x1'));var BPromise=require(_0x8b24('0x2'));var rs=require(_0x8b24('0x3'));var fs=require('fs');var Redis=require(_0x8b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b24('0x5'));var logger=require(_0x8b24('0x6'))('rpc');var config=require(_0x8b24('0x7'));var jayson=require(_0x8b24('0x8'));var client=jayson['client'][_0x8b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4705e0,_0x588ca8,_0x3198a2){return new BPromise(function(_0x51bbad,_0x43b851){return client[_0x8b24('0xa')](_0x4705e0,_0x3198a2)[_0x8b24('0xb')](function(_0x4ad0db){logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,_0x8b24('0xe'));logger[_0x8b24('0xf')](_0x8b24('0x10'),_0x588ca8,_0x8b24('0xe'),JSON[_0x8b24('0x11')](_0x4ad0db));if(_0x4ad0db[_0x8b24('0x12')]){if(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x13')]===0x1f4){logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x43b851(_0x4ad0db['error']['message']);}logger[_0x8b24('0x12')](_0x8b24('0xd'),_0x588ca8,_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);return _0x51bbad(_0x4ad0db[_0x8b24('0x12')][_0x8b24('0x14')]);}else{logger[_0x8b24('0xc')](_0x8b24('0xd'),_0x588ca8,'request\x20sent');_0x51bbad(_0x4ad0db['result']['message']);}})[_0x8b24('0x15')](function(_0x523863){logger['error'](_0x8b24('0xd'),_0x588ca8,_0x523863);_0x43b851(_0x523863);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index ee9a12c..daa4d3b 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 _0xe235=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0x3580a5,_0x2cb31a){var _0x5f426b=function(_0x9e32b8){while(--_0x9e32b8){_0x3580a5['push'](_0x3580a5['shift']());}};_0x5f426b(++_0x2cb31a);}(_0xe235,0x73));var _0x5e23=function(_0x1ec816,_0x5f5b38){_0x1ec816=_0x1ec816-0x0;var _0x4186e7=_0xe235[_0x1ec816];return _0x4186e7;};'use strict';var multer=require(_0x5e23('0x0'));var util=require(_0x5e23('0x1'));var path=require(_0x5e23('0x2'));var timeout=require(_0x5e23('0x3'));var express=require(_0x5e23('0x4'));var router=express['Router']();var fs_extra=require(_0x5e23('0x5'));var auth=require(_0x5e23('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e23('0x7'));var controller=require('./voiceContext.controller');router[_0x5e23('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e23('0x9')]);router[_0x5e23('0x8')](_0x5e23('0xa'),auth[_0x5e23('0xb')](),controller[_0x5e23('0xc')]);router[_0x5e23('0xd')]('/',auth[_0x5e23('0xb')](),controller[_0x5e23('0xe')]);router[_0x5e23('0xf')](_0x5e23('0xa'),auth['isAuthenticated'](),controller[_0x5e23('0x10')]);router['delete']('/:id',auth[_0x5e23('0xb')](),controller[_0x5e23('0x11')]);module[_0x5e23('0x12')]=router; \ No newline at end of file +var _0xb98e=['/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','create'];(function(_0x572c75,_0x31aeab){var _0xa0f684=function(_0x33a6d8){while(--_0x33a6d8){_0x572c75['push'](_0x572c75['shift']());}};_0xa0f684(++_0x31aeab);}(_0xb98e,0x93));var _0xeb98=function(_0x4fa259,_0x292045){_0x4fa259=_0x4fa259-0x0;var _0x31ce7b=_0xb98e[_0x4fa259];return _0x31ce7b;};'use strict';var multer=require(_0xeb98('0x0'));var util=require('util');var path=require(_0xeb98('0x1'));var timeout=require(_0xeb98('0x2'));var express=require(_0xeb98('0x3'));var router=express[_0xeb98('0x4')]();var fs_extra=require(_0xeb98('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeb98('0x6'));var config=require(_0xeb98('0x7'));var controller=require(_0xeb98('0x8'));router[_0xeb98('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb98('0xa')]);router['get']('/:id',auth[_0xeb98('0xb')](),controller[_0xeb98('0xc')]);router[_0xeb98('0xd')]('/',auth[_0xeb98('0xb')](),controller[_0xeb98('0xe')]);router['put'](_0xeb98('0xf'),auth[_0xeb98('0xb')](),controller[_0xeb98('0x10')]);router['delete'](_0xeb98('0xf'),auth[_0xeb98('0xb')](),controller[_0xeb98('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 17c98d9..5459b10 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 _0x103f=['STRING','name','sequelize','exports'];(function(_0x1cb03b,_0x18e3b8){var _0x579d44=function(_0x3775b4){while(--_0x3775b4){_0x1cb03b['push'](_0x1cb03b['shift']());}};_0x579d44(++_0x18e3b8);}(_0x103f,0xe2));var _0xf103=function(_0x215dab,_0x309506){_0x215dab=_0x215dab-0x0;var _0x5ab78b=_0x103f[_0x215dab];return _0x5ab78b;};'use strict';var Sequelize=require(_0xf103('0x0'));module[_0xf103('0x1')]={'name':{'type':Sequelize[_0xf103('0x2')],'unique':_0xf103('0x3')},'description':{'type':Sequelize[_0xf103('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf960=['BOOLEAN','exports','name','STRING'];(function(_0x261a3f,_0x3abfcc){var _0x35d081=function(_0x5d81ea){while(--_0x5d81ea){_0x261a3f['push'](_0x261a3f['shift']());}};_0x35d081(++_0x3abfcc);}(_0xf960,0x109));var _0x0f96=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xf960[_0xdefbc3];return _0x367798;};'use strict';var Sequelize=require('sequelize');module[_0x0f96('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0f96('0x1')},'description':{'type':Sequelize[_0x0f96('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0f96('0x3')],'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 9d22b38..6db349a 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 _0x737a=['server/files/templates/context.ejs','writeFileSync','chan_sip.so','destroy','render','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','count','Content-Range','reject','save','get','Contexts','UserProfileResource','end','stack','name','send','index','rawAttributes','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','VoiceContext','findAll','rows','show','length','include','find','create','body','readFileSync','join','root','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x737a,0xd3));var _0xa737=function(_0x2ae8cf,_0x3573f1){_0x2ae8cf=_0x2ae8cf-0x0;var _0xbc63cf=_0x737a[_0x2ae8cf];return _0xbc63cf;};'use strict';var emlformat=require(_0xa737('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa737('0x1'));var jsonpatch=require(_0xa737('0x2'));var rp=require('request-promise');var moment=require(_0xa737('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa737('0x4'));var util=require(_0xa737('0x5'));var path=require('path');var sox=require(_0xa737('0x6'));var csv=require(_0xa737('0x7'));var ejs=require(_0xa737('0x8'));var fs=require('fs');var fs_extra=require(_0xa737('0x9'));var _=require('lodash');var squel=require(_0xa737('0xa'));var crypto=require(_0xa737('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa737('0xc'));var toCsv=require(_0xa737('0x7'));var querystring=require(_0xa737('0xd'));var Papa=require(_0xa737('0xe'));var Redis=require(_0xa737('0xf'));var authService=require(_0xa737('0x10'));var qs=require(_0xa737('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa737('0x12'));var logger=require(_0xa737('0x13'))(_0xa737('0x14'));var utils=require('../../config/utils');var config=require(_0xa737('0x15'));var licenseUtil=require(_0xa737('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa737('0x17'));var client=jayson[_0xa737('0x18')][_0xa737('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x110f54,_0x52f46b,_0x3fd3a7,_0x4ce39f){return new BPromise(function(_0x17e4da,_0x46b0ed){var _0x17b7f3=_0x4ce39f||client;return _0x17b7f3[_0xa737('0x1a')](_0x110f54,_0x3fd3a7)[_0xa737('0x1b')](function(_0x291096){logger[_0xa737('0x1c')](_0xa737('0x1d'),_0x52f46b,'request\x20sent');logger[_0xa737('0x1e')](_0xa737('0x1f'),_0x52f46b,_0xa737('0x20'),JSON[_0xa737('0x21')](_0x291096));if(_0x291096['error']){if(_0x291096[_0xa737('0x22')][_0xa737('0x23')]===0x1f4){logger[_0xa737('0x22')]('VoiceContext,\x20%s,\x20%s',_0x52f46b,_0x291096[_0xa737('0x22')][_0xa737('0x24')]);return _0x46b0ed(_0x291096[_0xa737('0x22')][_0xa737('0x24')]);}logger[_0xa737('0x22')](_0xa737('0x1d'),_0x52f46b,_0x291096[_0xa737('0x22')][_0xa737('0x24')]);return _0x17e4da(_0x291096['error'][_0xa737('0x24')]);}else{logger[_0xa737('0x1c')](_0xa737('0x1d'),_0x52f46b,_0xa737('0x20'));_0x17e4da(_0x291096['result'][_0xa737('0x24')]);}})[_0xa737('0x25')](function(_0x45a47e){logger['error']('VoiceContext,\x20%s,\x20%s',_0x52f46b,_0x45a47e);_0x46b0ed(_0x45a47e);});});}function respondWithStatusCode(_0x319d93,_0x322ad4){_0x322ad4=_0x322ad4||0xcc;return function(_0x258571){if(_0x258571){return _0x319d93[_0xa737('0x26')](_0x322ad4);}return _0x319d93[_0xa737('0x27')](_0x322ad4)['end']();};}function respondWithResult(_0x301bf9,_0x3e7dc4){_0x3e7dc4=_0x3e7dc4||0xc8;return function(_0x1edb10){if(_0x1edb10){return _0x301bf9[_0xa737('0x27')](_0x3e7dc4)[_0xa737('0x28')](_0x1edb10);}};}function respondWithFilteredResult(_0xeebd32,_0x15cec8){return function(_0x533afc){if(_0x533afc){var _0x18fe72=typeof _0x15cec8[_0xa737('0x29')]===_0xa737('0x2a')&&typeof _0x15cec8['limit']===_0xa737('0x2a');var _0x21b60c=_0x533afc[_0xa737('0x2b')];var _0x20c4ea=_0x18fe72?0x0:_0x15cec8[_0xa737('0x29')];var _0x5b5df0=_0x18fe72?_0x533afc[_0xa737('0x2b')]:_0x15cec8['offset']+_0x15cec8['limit'];var _0x176169;if(_0x5b5df0>=_0x21b60c){_0x5b5df0=_0x21b60c;_0x176169=0xc8;}else{_0x176169=0xce;}_0xeebd32[_0xa737('0x27')](_0x176169);return _0xeebd32['set'](_0xa737('0x2c'),_0x20c4ea+'-'+_0x5b5df0+'/'+_0x21b60c)['json'](_0x533afc);}return null;};}function patchUpdates(_0x647df0){return function(_0x205f93){try{jsonpatch['apply'](_0x205f93,_0x647df0,!![]);}catch(_0x36a3a2){return BPromise[_0xa737('0x2d')](_0x36a3a2);}return _0x205f93[_0xa737('0x2e')]();};}function saveUpdates(_0x52d378,_0x37bc28){return function(_0x5c332a){if(_0x5c332a){return _0x5c332a['update'](_0x52d378)[_0xa737('0x1b')](function(_0xaa15bb){return _0xaa15bb;});}return null;};}function removeEntity(_0x2fcb7c,_0x64e4e2){return function(_0x825b2b){if(_0x825b2b){return _0x825b2b['destroy']()[_0xa737('0x1b')](function(){var _0x4f2cba=_0x825b2b[_0xa737('0x2f')]({'plain':!![]});var _0x5603db=_0xa737('0x30');return db[_0xa737('0x31')]['destroy']({'where':{'type':_0x5603db,'resourceId':_0x4f2cba['id']}})[_0xa737('0x1b')](function(){return _0x825b2b;});})['then'](function(){_0x2fcb7c[_0xa737('0x27')](0xcc)[_0xa737('0x32')]();});}};}function handleEntityNotFound(_0x231764,_0x183232){return function(_0x593d32){if(!_0x593d32){_0x231764['sendStatus'](0x194);}return _0x593d32;};}function handleError(_0x17ae1b,_0x272a4e){_0x272a4e=_0x272a4e||0x1f4;return function(_0x1cfbe1){logger[_0xa737('0x22')](_0x1cfbe1[_0xa737('0x33')]);if(_0x1cfbe1[_0xa737('0x34')]){delete _0x1cfbe1[_0xa737('0x34')];}_0x17ae1b[_0xa737('0x27')](_0x272a4e)[_0xa737('0x35')](_0x1cfbe1);};}exports[_0xa737('0x36')]=function(_0x12f077,_0x7c2e16){var _0x44d454={},_0x5e3a65={},_0x51c604={'count':0x0,'rows':[]};var _0x594ec8=_['map'](db['VoiceContext'][_0xa737('0x37')],function(_0x14097d){return{'name':_0x14097d['fieldName'],'type':_0x14097d['type'][_0xa737('0x38')]};});_0x5e3a65[_0xa737('0x39')]=_[_0xa737('0x3a')](_0x594ec8,_0xa737('0x34'));_0x5e3a65['query']=_[_0xa737('0x3b')](_0x12f077[_0xa737('0x3c')]);_0x5e3a65['filters']=_[_0xa737('0x3d')](_0x5e3a65[_0xa737('0x39')],_0x5e3a65['query']);_0x44d454[_0xa737('0x3e')]=_['intersection'](_0x5e3a65['model'],qs['fields'](_0x12f077[_0xa737('0x3c')][_0xa737('0x3f')]));_0x44d454[_0xa737('0x3e')]=_0x44d454[_0xa737('0x3e')]['length']?_0x44d454[_0xa737('0x3e')]:_0x5e3a65[_0xa737('0x39')];if(!_0x12f077[_0xa737('0x3c')][_0xa737('0x40')](_0xa737('0x41'))){_0x44d454[_0xa737('0x42')]=qs[_0xa737('0x42')](_0x12f077[_0xa737('0x3c')][_0xa737('0x42')]);_0x44d454[_0xa737('0x29')]=qs['offset'](_0x12f077['query'][_0xa737('0x29')]);}_0x44d454['order']=qs[_0xa737('0x43')](_0x12f077[_0xa737('0x3c')][_0xa737('0x43')]);_0x44d454['where']=qs[_0xa737('0x44')](_[_0xa737('0x45')](_0x12f077[_0xa737('0x3c')],_0x5e3a65[_0xa737('0x44')]),_0x594ec8);if(_0x12f077[_0xa737('0x3c')]['filter']){_0x44d454[_0xa737('0x46')]=_[_0xa737('0x47')](_0x44d454['where'],{'$or':_[_0xa737('0x3a')](_0x594ec8,function(_0x337814){if(_0x337814[_0xa737('0x48')]!==_0xa737('0x49')){var _0x22501a={};_0x22501a[_0x337814[_0xa737('0x34')]]={'$like':'%'+_0x12f077[_0xa737('0x3c')][_0xa737('0x4a')]+'%'};return _0x22501a;}})});}_0x44d454=_[_0xa737('0x47')]({},_0x44d454,_0x12f077[_0xa737('0x4b')]);var _0x93dbe8={'where':_0x44d454['where']};return db['VoiceContext'][_0xa737('0x2b')](_0x93dbe8)['then'](function(_0x324285){_0x51c604[_0xa737('0x2b')]=_0x324285;if(_0x12f077[_0xa737('0x3c')]['includeAll']){_0x44d454['include']=[{'all':!![]}];}return db[_0xa737('0x4c')][_0xa737('0x4d')](_0x44d454);})[_0xa737('0x1b')](function(_0x226b55){_0x51c604[_0xa737('0x4e')]=_0x226b55;return _0x51c604;})[_0xa737('0x1b')](respondWithFilteredResult(_0x7c2e16,_0x44d454))[_0xa737('0x25')](handleError(_0x7c2e16,null));};exports[_0xa737('0x4f')]=function(_0x53d3ee,_0x421aba){var _0x1f90b5={'raw':![],'where':{'id':_0x53d3ee['params']['id']}},_0x3e1522={};_0x3e1522[_0xa737('0x39')]=_[_0xa737('0x3b')](db[_0xa737('0x4c')][_0xa737('0x37')]);_0x3e1522[_0xa737('0x3c')]=_[_0xa737('0x3b')](_0x53d3ee['query']);_0x3e1522['filters']=_[_0xa737('0x3d')](_0x3e1522['model'],_0x3e1522['query']);_0x1f90b5[_0xa737('0x3e')]=_[_0xa737('0x3d')](_0x3e1522['model'],qs[_0xa737('0x3f')](_0x53d3ee[_0xa737('0x3c')][_0xa737('0x3f')]));_0x1f90b5[_0xa737('0x3e')]=_0x1f90b5[_0xa737('0x3e')][_0xa737('0x50')]?_0x1f90b5['attributes']:_0x3e1522['model'];if(_0x53d3ee[_0xa737('0x3c')]['includeAll']){_0x1f90b5[_0xa737('0x51')]=[{'all':!![]}];}_0x1f90b5=_[_0xa737('0x47')]({},_0x1f90b5,_0x53d3ee['options']);return db[_0xa737('0x4c')][_0xa737('0x52')](_0x1f90b5)[_0xa737('0x1b')](handleEntityNotFound(_0x421aba,null))[_0xa737('0x1b')](respondWithResult(_0x421aba,null))[_0xa737('0x25')](handleError(_0x421aba,null));};exports[_0xa737('0x53')]=function(_0x5ce904,_0xe7c657,_0x1e30b9){var _0x1a3ea3;return db['VoiceContext']['create'](_0x5ce904[_0xa737('0x54')],{'raw':!![]})[_0xa737('0x1b')](function(_0x12604f){_0x1a3ea3=_0x12604f;return db['VoiceContext'][_0xa737('0x4d')]({'raw':!![]});})['then'](function(_0x1209ad){var _0x54857e=fs[_0xa737('0x55')](path[_0xa737('0x56')](config[_0xa737('0x57')],'server/files/templates/context.ejs'),_0xa737('0x58'));var _0x3514be=ejs['render'](_0x54857e,{'contexts':_0x1209ad||[]});fs['writeFileSync'](_0xa737('0x59'),_0x3514be);})[_0xa737('0x1b')](function(){return respondWithRpcPromise(_0xa737('0x5a'),_0xa737('0x53'),{'module':'chan_sip.so'});})[_0xa737('0x1b')](function(){var _0xf95d94=_0x5ce904[_0xa737('0x5b')][_0xa737('0x2f')]({'plain':!![]});if(!_0xf95d94)throw new Error(_0xa737('0x5c'));if(_0xf95d94['role']===_0xa737('0x5b')){var _0x26ec40=_0x1a3ea3[_0xa737('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0xa737('0x52')]({'where':{'name':_0xa737('0x30'),'userProfileId':_0xf95d94[_0xa737('0x5d')]},'raw':!![]})[_0xa737('0x1b')](function(_0x91b926){if(_0x91b926&&_0x91b926[_0xa737('0x5e')]===0x0){return db['UserProfileResource'][_0xa737('0x53')]({'name':_0x26ec40[_0xa737('0x34')],'resourceId':_0x26ec40['id'],'type':_0x91b926[_0xa737('0x34')],'sectionId':_0x91b926['id']},{})[_0xa737('0x1b')](function(){return _0x1a3ea3;});}else{return _0x1a3ea3;}})[_0xa737('0x25')](function(_0x1d3e6d){logger[_0xa737('0x22')](_0xa737('0x5f'),_0x1d3e6d);throw _0x1d3e6d;});}return _0x1a3ea3;})[_0xa737('0x1b')](respondWithResult(_0xe7c657,0xc9))['catch'](handleError(_0xe7c657,null));};exports[_0xa737('0x60')]=function(_0x262fd8,_0x35e422,_0x12c19b){var _0x16a6cb;return db[_0xa737('0x4c')][_0xa737('0x52')]({'where':{'id':_0x262fd8[_0xa737('0x61')]['id']}})[_0xa737('0x1b')](handleEntityNotFound(_0x35e422,null))['then'](saveUpdates(_0x262fd8['body'],null))['then'](function(_0x1c2d80){if(_0x1c2d80){_0x16a6cb=_0x1c2d80;return db[_0xa737('0x4c')]['findAll']({'raw':!![]});}})[_0xa737('0x1b')](function(_0x15b2d3){var _0x7cb50f=fs[_0xa737('0x55')](path[_0xa737('0x56')](config['root'],_0xa737('0x62')),_0xa737('0x58'));var _0x55a015=ejs['render'](_0x7cb50f,{'contexts':_0x15b2d3||[]});fs[_0xa737('0x63')](_0xa737('0x59'),_0x55a015);})[_0xa737('0x1b')](function(){return respondWithRpcPromise('Reload',_0xa737('0x60'),{'module':_0xa737('0x64')});})[_0xa737('0x1b')](function(){return _0x16a6cb;})[_0xa737('0x1b')](respondWithResult(_0x35e422,null))[_0xa737('0x25')](handleError(_0x35e422,null));};exports[_0xa737('0x65')]=function(_0xa698fd,_0x2a0f16,_0x456e35){var _0xa30e69;return db[_0xa737('0x4c')]['find']({'where':{'id':_0xa698fd[_0xa737('0x61')]['id']}})[_0xa737('0x1b')](handleEntityNotFound(_0x2a0f16,null))['then'](removeEntity(_0x2a0f16,null))['then'](function(){return db[_0xa737('0x4c')][_0xa737('0x4d')]({'raw':!![]});})['then'](function(_0xcca76a){var _0x211e35=fs[_0xa737('0x55')](path[_0xa737('0x56')](config[_0xa737('0x57')],_0xa737('0x62')),_0xa737('0x58'));var _0x1f749f=ejs[_0xa737('0x66')](_0x211e35,{'contexts':_0xcca76a});fs[_0xa737('0x63')](_0xa737('0x59'),_0x1f749f);return respondWithRpcPromise(_0xa737('0x5a'),_0xa737('0x65'),{'module':_0xa737('0x64')});})[_0xa737('0x25')](handleError(_0x2a0f16,null));}; \ No newline at end of file +var _0xd2e2=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','limit','count','status','set','Content-Range','reject','save','update','get','Contexts','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','VoiceContext','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','where'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0xd2e2,0xe2));var _0x2d2e=function(_0x5a53bf,_0x13367f){_0x5a53bf=_0x5a53bf-0x0;var _0x30f706=_0xd2e2[_0x5a53bf];return _0x30f706;};'use strict';var emlformat=require(_0x2d2e('0x0'));var rimraf=require(_0x2d2e('0x1'));var zipdir=require(_0x2d2e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d2e('0x3'));var moment=require(_0x2d2e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2d2e('0x5'));var path=require(_0x2d2e('0x6'));var sox=require('sox');var csv=require(_0x2d2e('0x7'));var ejs=require(_0x2d2e('0x8'));var fs=require('fs');var fs_extra=require(_0x2d2e('0x9'));var _=require(_0x2d2e('0xa'));var squel=require(_0x2d2e('0xb'));var crypto=require(_0x2d2e('0xc'));var jsforce=require(_0x2d2e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2d2e('0x7'));var querystring=require(_0x2d2e('0xe'));var Papa=require(_0x2d2e('0xf'));var Redis=require(_0x2d2e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d2e('0x11'));var hardwareService=require(_0x2d2e('0x12'));var logger=require('../../config/logger')(_0x2d2e('0x13'));var utils=require(_0x2d2e('0x14'));var config=require(_0x2d2e('0x15'));var licenseUtil=require(_0x2d2e('0x16'));var db=require(_0x2d2e('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2d2e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x712fdb,_0x159e1b,_0x104da5,_0xceeb3d){return new BPromise(function(_0x26c889,_0x3bd6f0){var _0x5a5565=_0xceeb3d||client;return _0x5a5565[_0x2d2e('0x19')](_0x712fdb,_0x104da5)[_0x2d2e('0x1a')](function(_0x25d3a0){logger[_0x2d2e('0x1b')](_0x2d2e('0x1c'),_0x159e1b,_0x2d2e('0x1d'));logger['debug'](_0x2d2e('0x1e'),_0x159e1b,_0x2d2e('0x1d'),JSON['stringify'](_0x25d3a0));if(_0x25d3a0[_0x2d2e('0x1f')]){if(_0x25d3a0[_0x2d2e('0x1f')][_0x2d2e('0x20')]===0x1f4){logger[_0x2d2e('0x1f')](_0x2d2e('0x1c'),_0x159e1b,_0x25d3a0[_0x2d2e('0x1f')][_0x2d2e('0x21')]);return _0x3bd6f0(_0x25d3a0['error'][_0x2d2e('0x21')]);}logger[_0x2d2e('0x1f')](_0x2d2e('0x1c'),_0x159e1b,_0x25d3a0[_0x2d2e('0x1f')][_0x2d2e('0x21')]);return _0x26c889(_0x25d3a0[_0x2d2e('0x1f')][_0x2d2e('0x21')]);}else{logger[_0x2d2e('0x1b')](_0x2d2e('0x1c'),_0x159e1b,'request\x20sent');_0x26c889(_0x25d3a0[_0x2d2e('0x22')]['message']);}})[_0x2d2e('0x23')](function(_0x330650){logger[_0x2d2e('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x159e1b,_0x330650);_0x3bd6f0(_0x330650);});});}function respondWithStatusCode(_0x205b59,_0x3755c6){_0x3755c6=_0x3755c6||0xcc;return function(_0x24e446){if(_0x24e446){return _0x205b59['sendStatus'](_0x3755c6);}return _0x205b59['status'](_0x3755c6)['end']();};}function respondWithResult(_0x1b7fa3,_0x38c17a){_0x38c17a=_0x38c17a||0xc8;return function(_0x547bec){if(_0x547bec){return _0x1b7fa3['status'](_0x38c17a)[_0x2d2e('0x24')](_0x547bec);}};}function respondWithFilteredResult(_0x20836f,_0x11b060){return function(_0x3ec0d8){if(_0x3ec0d8){var _0x414192=typeof _0x11b060[_0x2d2e('0x25')]==='undefined'&&typeof _0x11b060[_0x2d2e('0x26')]==='undefined';var _0x2f4d6e=_0x3ec0d8[_0x2d2e('0x27')];var _0x55999d=_0x414192?0x0:_0x11b060[_0x2d2e('0x25')];var _0x584a4a=_0x414192?_0x3ec0d8[_0x2d2e('0x27')]:_0x11b060[_0x2d2e('0x25')]+_0x11b060['limit'];var _0x320419;if(_0x584a4a>=_0x2f4d6e){_0x584a4a=_0x2f4d6e;_0x320419=0xc8;}else{_0x320419=0xce;}_0x20836f[_0x2d2e('0x28')](_0x320419);return _0x20836f[_0x2d2e('0x29')](_0x2d2e('0x2a'),_0x55999d+'-'+_0x584a4a+'/'+_0x2f4d6e)[_0x2d2e('0x24')](_0x3ec0d8);}return null;};}function patchUpdates(_0x438b80){return function(_0x6b0587){try{jsonpatch['apply'](_0x6b0587,_0x438b80,!![]);}catch(_0x2d9f04){return BPromise[_0x2d2e('0x2b')](_0x2d9f04);}return _0x6b0587[_0x2d2e('0x2c')]();};}function saveUpdates(_0x4b4b3e,_0x228c94){return function(_0x363704){if(_0x363704){return _0x363704[_0x2d2e('0x2d')](_0x4b4b3e)[_0x2d2e('0x1a')](function(_0x2e01a7){return _0x2e01a7;});}return null;};}function removeEntity(_0x147ff5,_0x52ab8b){return function(_0x28c2c6){if(_0x28c2c6){return _0x28c2c6['destroy']()[_0x2d2e('0x1a')](function(){var _0x10ba67=_0x28c2c6[_0x2d2e('0x2e')]({'plain':!![]});var _0x4ca437=_0x2d2e('0x2f');return db[_0x2d2e('0x30')][_0x2d2e('0x31')]({'where':{'type':_0x4ca437,'resourceId':_0x10ba67['id']}})[_0x2d2e('0x1a')](function(){return _0x28c2c6;});})[_0x2d2e('0x1a')](function(){_0x147ff5[_0x2d2e('0x28')](0xcc)[_0x2d2e('0x32')]();});}};}function handleEntityNotFound(_0x2d2870,_0x1bdc8b){return function(_0x2d97b8){if(!_0x2d97b8){_0x2d2870[_0x2d2e('0x33')](0x194);}return _0x2d97b8;};}function handleError(_0x14176b,_0x3466a1){_0x3466a1=_0x3466a1||0x1f4;return function(_0x5d83ae){logger[_0x2d2e('0x1f')](_0x5d83ae[_0x2d2e('0x34')]);if(_0x5d83ae[_0x2d2e('0x35')]){delete _0x5d83ae[_0x2d2e('0x35')];}_0x14176b[_0x2d2e('0x28')](_0x3466a1)[_0x2d2e('0x36')](_0x5d83ae);};}exports['index']=function(_0x1706e8,_0x39560d){var _0x553fb8={},_0x56a1f9={},_0x3b1d8b={'count':0x0,'rows':[]};var _0x7df767=_[_0x2d2e('0x37')](db[_0x2d2e('0x38')]['rawAttributes'],function(_0x3c7b0e){return{'name':_0x3c7b0e[_0x2d2e('0x39')],'type':_0x3c7b0e[_0x2d2e('0x3a')]['key']};});_0x56a1f9[_0x2d2e('0x3b')]=_[_0x2d2e('0x37')](_0x7df767,'name');_0x56a1f9[_0x2d2e('0x3c')]=_['keys'](_0x1706e8[_0x2d2e('0x3c')]);_0x56a1f9[_0x2d2e('0x3d')]=_[_0x2d2e('0x3e')](_0x56a1f9[_0x2d2e('0x3b')],_0x56a1f9['query']);_0x553fb8[_0x2d2e('0x3f')]=_[_0x2d2e('0x3e')](_0x56a1f9['model'],qs['fields'](_0x1706e8['query'][_0x2d2e('0x40')]));_0x553fb8[_0x2d2e('0x3f')]=_0x553fb8['attributes'][_0x2d2e('0x41')]?_0x553fb8[_0x2d2e('0x3f')]:_0x56a1f9['model'];if(!_0x1706e8[_0x2d2e('0x3c')]['hasOwnProperty'](_0x2d2e('0x42'))){_0x553fb8[_0x2d2e('0x26')]=qs['limit'](_0x1706e8[_0x2d2e('0x3c')][_0x2d2e('0x26')]);_0x553fb8[_0x2d2e('0x25')]=qs[_0x2d2e('0x25')](_0x1706e8[_0x2d2e('0x3c')][_0x2d2e('0x25')]);}_0x553fb8['order']=qs['sort'](_0x1706e8[_0x2d2e('0x3c')]['sort']);_0x553fb8[_0x2d2e('0x43')]=qs['filters'](_[_0x2d2e('0x44')](_0x1706e8[_0x2d2e('0x3c')],_0x56a1f9['filters']),_0x7df767);if(_0x1706e8['query'][_0x2d2e('0x45')]){_0x553fb8['where']=_[_0x2d2e('0x46')](_0x553fb8[_0x2d2e('0x43')],{'$or':_[_0x2d2e('0x37')](_0x7df767,function(_0x2bfc01){if(_0x2bfc01[_0x2d2e('0x3a')]!==_0x2d2e('0x47')){var _0x45e420={};_0x45e420[_0x2bfc01[_0x2d2e('0x35')]]={'$like':'%'+_0x1706e8[_0x2d2e('0x3c')][_0x2d2e('0x45')]+'%'};return _0x45e420;}})});}_0x553fb8=_[_0x2d2e('0x46')]({},_0x553fb8,_0x1706e8[_0x2d2e('0x48')]);var _0xc92b46={'where':_0x553fb8['where']};return db[_0x2d2e('0x38')][_0x2d2e('0x27')](_0xc92b46)[_0x2d2e('0x1a')](function(_0x68ebe6){_0x3b1d8b[_0x2d2e('0x27')]=_0x68ebe6;if(_0x1706e8[_0x2d2e('0x3c')][_0x2d2e('0x49')]){_0x553fb8[_0x2d2e('0x4a')]=[{'all':!![]}];}return db[_0x2d2e('0x38')][_0x2d2e('0x4b')](_0x553fb8);})[_0x2d2e('0x1a')](function(_0x59dfcf){_0x3b1d8b[_0x2d2e('0x4c')]=_0x59dfcf;return _0x3b1d8b;})['then'](respondWithFilteredResult(_0x39560d,_0x553fb8))[_0x2d2e('0x23')](handleError(_0x39560d,null));};exports['show']=function(_0xec3214,_0x425225){var _0x243a07={'raw':![],'where':{'id':_0xec3214[_0x2d2e('0x4d')]['id']}},_0x5a2663={};_0x5a2663[_0x2d2e('0x3b')]=_[_0x2d2e('0x4e')](db[_0x2d2e('0x38')][_0x2d2e('0x4f')]);_0x5a2663[_0x2d2e('0x3c')]=_[_0x2d2e('0x4e')](_0xec3214['query']);_0x5a2663[_0x2d2e('0x3d')]=_[_0x2d2e('0x3e')](_0x5a2663[_0x2d2e('0x3b')],_0x5a2663[_0x2d2e('0x3c')]);_0x243a07[_0x2d2e('0x3f')]=_['intersection'](_0x5a2663[_0x2d2e('0x3b')],qs[_0x2d2e('0x40')](_0xec3214['query'][_0x2d2e('0x40')]));_0x243a07[_0x2d2e('0x3f')]=_0x243a07['attributes'][_0x2d2e('0x41')]?_0x243a07['attributes']:_0x5a2663['model'];if(_0xec3214[_0x2d2e('0x3c')][_0x2d2e('0x49')]){_0x243a07[_0x2d2e('0x4a')]=[{'all':!![]}];}_0x243a07=_[_0x2d2e('0x46')]({},_0x243a07,_0xec3214[_0x2d2e('0x48')]);return db[_0x2d2e('0x38')]['find'](_0x243a07)[_0x2d2e('0x1a')](handleEntityNotFound(_0x425225,null))[_0x2d2e('0x1a')](respondWithResult(_0x425225,null))[_0x2d2e('0x23')](handleError(_0x425225,null));};exports[_0x2d2e('0x50')]=function(_0x3eb698,_0x4ccd8f,_0x21e7cf){var _0x4b780c;return db['VoiceContext']['create'](_0x3eb698[_0x2d2e('0x51')],{'raw':!![]})[_0x2d2e('0x1a')](function(_0x726386){_0x4b780c=_0x726386;return db[_0x2d2e('0x38')][_0x2d2e('0x4b')]({'raw':!![]});})[_0x2d2e('0x1a')](function(_0x225fb9){var _0x76f7aa=fs['readFileSync'](path[_0x2d2e('0x52')](config[_0x2d2e('0x53')],_0x2d2e('0x54')),_0x2d2e('0x55'));var _0x24782f=ejs[_0x2d2e('0x56')](_0x76f7aa,{'contexts':_0x225fb9||[]});fs[_0x2d2e('0x57')](_0x2d2e('0x58'),_0x24782f);})[_0x2d2e('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x2d2e('0x59')});})[_0x2d2e('0x1a')](function(){var _0x5c5450=_0x3eb698[_0x2d2e('0x5a')][_0x2d2e('0x2e')]({'plain':!![]});if(!_0x5c5450)throw new Error(_0x2d2e('0x5b'));if(_0x5c5450[_0x2d2e('0x5c')]===_0x2d2e('0x5a')){var _0x57f574=_0x4b780c['get']({'plain':!![]});return db[_0x2d2e('0x5d')][_0x2d2e('0x5e')]({'where':{'name':'Contexts','userProfileId':_0x5c5450[_0x2d2e('0x5f')]},'raw':!![]})[_0x2d2e('0x1a')](function(_0x570e49){if(_0x570e49&&_0x570e49[_0x2d2e('0x60')]===0x0){return db[_0x2d2e('0x30')][_0x2d2e('0x50')]({'name':_0x57f574['name'],'resourceId':_0x57f574['id'],'type':_0x570e49[_0x2d2e('0x35')],'sectionId':_0x570e49['id']},{})[_0x2d2e('0x1a')](function(){return _0x4b780c;});}else{return _0x4b780c;}})[_0x2d2e('0x23')](function(_0x1a6405){logger[_0x2d2e('0x1f')](_0x2d2e('0x61'),_0x1a6405);throw _0x1a6405;});}return _0x4b780c;})[_0x2d2e('0x1a')](respondWithResult(_0x4ccd8f,0xc9))[_0x2d2e('0x23')](handleError(_0x4ccd8f,null));};exports[_0x2d2e('0x2d')]=function(_0x2c0947,_0x4788a0,_0x1878de){var _0x3c776d;return db[_0x2d2e('0x38')][_0x2d2e('0x5e')]({'where':{'id':_0x2c0947['params']['id']}})[_0x2d2e('0x1a')](handleEntityNotFound(_0x4788a0,null))[_0x2d2e('0x1a')](saveUpdates(_0x2c0947[_0x2d2e('0x51')],null))[_0x2d2e('0x1a')](function(_0x2aae05){if(_0x2aae05){_0x3c776d=_0x2aae05;return db[_0x2d2e('0x38')]['findAll']({'raw':!![]});}})[_0x2d2e('0x1a')](function(_0x2218e1){var _0x3cd053=fs['readFileSync'](path[_0x2d2e('0x52')](config[_0x2d2e('0x53')],_0x2d2e('0x54')),_0x2d2e('0x55'));var _0x15bffc=ejs[_0x2d2e('0x56')](_0x3cd053,{'contexts':_0x2218e1||[]});fs[_0x2d2e('0x57')](_0x2d2e('0x58'),_0x15bffc);})[_0x2d2e('0x1a')](function(){return respondWithRpcPromise('Reload',_0x2d2e('0x2d'),{'module':_0x2d2e('0x59')});})[_0x2d2e('0x1a')](function(){return _0x3c776d;})['then'](respondWithResult(_0x4788a0,null))[_0x2d2e('0x23')](handleError(_0x4788a0,null));};exports['destroy']=function(_0x592c2e,_0x449b75,_0x34ec68){var _0x3d7c3f;return db[_0x2d2e('0x38')][_0x2d2e('0x5e')]({'where':{'id':_0x592c2e[_0x2d2e('0x4d')]['id']}})[_0x2d2e('0x1a')](handleEntityNotFound(_0x449b75,null))['then'](removeEntity(_0x449b75,null))[_0x2d2e('0x1a')](function(){return db[_0x2d2e('0x38')][_0x2d2e('0x4b')]({'raw':!![]});})[_0x2d2e('0x1a')](function(_0x1a36bd){var _0x1a2cee=fs['readFileSync'](path[_0x2d2e('0x52')](config[_0x2d2e('0x53')],_0x2d2e('0x54')),'utf8');var _0x22f42e=ejs[_0x2d2e('0x56')](_0x1a2cee,{'contexts':_0x1a36bd});fs[_0x2d2e('0x57')](_0x2d2e('0x58'),_0x22f42e);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0x2d2e('0x23')](handleError(_0x449b75,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 995fc2a..48f644f 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 _0x9204=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceContext'];(function(_0x480c01,_0x1e0dbe){var _0xe5b1e7=function(_0x37fa56){while(--_0x37fa56){_0x480c01['push'](_0x480c01['shift']());}};_0xe5b1e7(++_0x1e0dbe);}(_0x9204,0x6c));var _0x4920=function(_0x1867c4,_0x427ca0){_0x1867c4=_0x1867c4-0x0;var _0x493ce5=_0x9204[_0x1867c4];return _0x493ce5;};'use strict';var _=require(_0x4920('0x0'));var util=require(_0x4920('0x1'));var logger=require(_0x4920('0x2'))(_0x4920('0x3'));var moment=require(_0x4920('0x4'));var BPromise=require(_0x4920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4920('0x6'));var rimraf=require(_0x4920('0x7'));var config=require(_0x4920('0x8'));var attributes=require('./voiceContext.attributes');module[_0x4920('0x9')]=function(_0x2ea9ab,_0xde9faf){return _0x2ea9ab[_0x4920('0xa')](_0x4920('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeb9=['rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0xeeb9,0xde));var _0x9eeb=function(_0x40aadd,_0x31a81b){_0x40aadd=_0x40aadd-0x0;var _0x1e2f5a=_0xeeb9[_0x40aadd];return _0x1e2f5a;};'use strict';var _=require(_0x9eeb('0x0'));var util=require(_0x9eeb('0x1'));var logger=require(_0x9eeb('0x2'))(_0x9eeb('0x3'));var moment=require(_0x9eeb('0x4'));var BPromise=require('bluebird');var rp=require(_0x9eeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9eeb('0x6'));var config=require('../../config/environment');var attributes=require(_0x9eeb('0x7'));module[_0x9eeb('0x8')]=function(_0x5871c2,_0x30a1fd){return _0x5871c2[_0x9eeb('0x9')](_0x9eeb('0xa'),attributes,{'tableName':_0x9eeb('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 f1364dc..ae2c5e1 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 _0x3c81=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22550b,_0x8c7c90){var _0x321c48=function(_0x41a77f){while(--_0x41a77f){_0x22550b['push'](_0x22550b['shift']());}};_0x321c48(++_0x8c7c90);}(_0x3c81,0x102));var _0x13c8=function(_0x1dabc2,_0xcfa76b){_0x1dabc2=_0x1dabc2-0x0;var _0x3dc71f=_0x3c81[_0x1dabc2];return _0x3dc71f;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VoiceContext,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file +var _0x9e8e=['bluebird','ioredis','rpc','jayson/promise','client','http','request','then','debug','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x9dd37c,_0x3e255e){var _0x2a522c=function(_0x2ce2ca){while(--_0x2ce2ca){_0x9dd37c['push'](_0x9dd37c['shift']());}};_0x2a522c(++_0x3e255e);}(_0x9e8e,0x179));var _0xe9e8=function(_0x29a088,_0x42bb46){_0x29a088=_0x29a088-0x0;var _0x4059c1=_0x9e8e[_0x29a088];return _0x4059c1;};'use strict';var _=require(_0xe9e8('0x0'));var util=require(_0xe9e8('0x1'));var moment=require(_0xe9e8('0x2'));var BPromise=require(_0xe9e8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe9e8('0x5'));var config=require('../../config/environment');var jayson=require(_0xe9e8('0x6'));var client=jayson[_0xe9e8('0x7')][_0xe9e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509703,_0x3e4e11,_0x10b283){return new BPromise(function(_0x5d73da,_0x3496db){return client[_0xe9e8('0x9')](_0x509703,_0x10b283)[_0xe9e8('0xa')](function(_0x5a5617){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3e4e11,'request\x20sent');logger[_0xe9e8('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3e4e11,'request\x20sent',JSON['stringify'](_0x5a5617));if(_0x5a5617['error']){if(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xd')]===0x1f4){logger[_0xe9e8('0xc')](_0xe9e8('0xe'),_0x3e4e11,_0x5a5617['error'][_0xe9e8('0xf')]);return _0x3496db(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xf')]);}logger['error'](_0xe9e8('0xe'),_0x3e4e11,_0x5a5617['error'][_0xe9e8('0xf')]);return _0x5d73da(_0x5a5617[_0xe9e8('0xc')][_0xe9e8('0xf')]);}else{logger[_0xe9e8('0x10')](_0xe9e8('0xe'),_0x3e4e11,'request\x20sent');_0x5d73da(_0x5a5617[_0xe9e8('0x11')]['message']);}})[_0xe9e8('0x12')](function(_0x130488){logger['error'](_0xe9e8('0xe'),_0x3e4e11,_0x130488);_0x3496db(_0x130488);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 40d9ed6..2a034d2 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 _0xad5a=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xad5a,0x18a));var _0xaad5=function(_0x139280,_0x5d62df){_0x139280=_0x139280-0x0;var _0x575d49=_0xad5a[_0x139280];return _0x575d49;};'use strict';var multer=require(_0xaad5('0x0'));var util=require(_0xaad5('0x1'));var path=require(_0xaad5('0x2'));var timeout=require(_0xaad5('0x3'));var express=require(_0xaad5('0x4'));var router=express['Router']();var fs_extra=require(_0xaad5('0x5'));var auth=require(_0xaad5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaad5('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xaad5('0x8')](),controller[_0xaad5('0x9')]);router[_0xaad5('0xa')](_0xaad5('0xb'),auth['isAuthenticated'](),controller[_0xaad5('0xc')]);router[_0xaad5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaad5('0xd')]);router['post']('/',auth[_0xaad5('0x8')](),controller[_0xaad5('0xe')]);router[_0xaad5('0xf')](_0xaad5('0x10'),auth[_0xaad5('0x8')](),controller[_0xaad5('0x11')]);router[_0xaad5('0x12')](_0xaad5('0x10'),auth['isAuthenticated'](),controller[_0xaad5('0x13')]);module[_0xaad5('0x14')]=router; \ No newline at end of file +var _0x9d3f=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9d3f,0x18e));var _0xf9d3=function(_0x55f0d1,_0x168d72){_0x55f0d1=_0x55f0d1-0x0;var _0x2950ec=_0x9d3f[_0x55f0d1];return _0x2950ec;};'use strict';var multer=require('multer');var util=require(_0xf9d3('0x0'));var path=require('path');var timeout=require(_0xf9d3('0x1'));var express=require(_0xf9d3('0x2'));var router=express[_0xf9d3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf9d3('0x4'));var config=require(_0xf9d3('0x5'));var controller=require(_0xf9d3('0x6'));router['get']('/',auth[_0xf9d3('0x7')](),controller[_0xf9d3('0x8')]);router[_0xf9d3('0x9')](_0xf9d3('0xa'),auth[_0xf9d3('0x7')](),controller[_0xf9d3('0xb')]);router[_0xf9d3('0x9')](_0xf9d3('0xc'),auth[_0xf9d3('0x7')](),controller[_0xf9d3('0xd')]);router[_0xf9d3('0xe')]('/',auth['isAuthenticated'](),controller[_0xf9d3('0xf')]);router[_0xf9d3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf9d3('0x11')]);router['delete'](_0xf9d3('0xc'),auth[_0xf9d3('0x7')](),controller[_0xf9d3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 37a5a63..e3d100a 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x529335,_0x2a3859){var _0x4d81dc=function(_0x18f012){while(--_0x18f012){_0x529335['push'](_0x529335['shift']());}};_0x4d81dc(++_0x2a3859);}(_0xedd9,0xfc));var _0x9edd=function(_0x3793f6,_0x2c952f){_0x3793f6=_0x3793f6-0x0;var _0xeb1018=_0xedd9[_0x3793f6];return _0xeb1018;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x2e1c9c,_0x4a94a2){var _0x31ab33=function(_0x594dca){while(--_0x594dca){_0x2e1c9c['push'](_0x2e1c9c['shift']());}};_0x31ab33(++_0x4a94a2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x133763,_0x2b75c1){_0x133763=_0x133763-0x0;var _0x7989a9=_0xe5b3[_0x133763];return _0x7989a9;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ee10817..552a851 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 _0xd992=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd992,0x88));var _0x2d99=function(_0x3ba753,_0x2f3216){_0x3ba753=_0x3ba753-0x0;var _0x2f469a=_0xd992[_0x3ba753];return _0x2f469a;};'use strict';var emlformat=require(_0x2d99('0x0'));var rimraf=require(_0x2d99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d99('0x2'));var rp=require('request-promise');var moment=require(_0x2d99('0x3'));var BPromise=require(_0x2d99('0x4'));var Mustache=require(_0x2d99('0x5'));var util=require('util');var path=require(_0x2d99('0x6'));var sox=require(_0x2d99('0x7'));var csv=require('to-csv');var ejs=require(_0x2d99('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d99('0x9'));var squel=require('squel');var crypto=require(_0x2d99('0xa'));var jsforce=require(_0x2d99('0xb'));var deskjs=require(_0x2d99('0xc'));var toCsv=require(_0x2d99('0xd'));var querystring=require(_0x2d99('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d99('0xf'));var authService=require(_0x2d99('0x10'));var qs=require(_0x2d99('0x11'));var as=require(_0x2d99('0x12'));var hardwareService=require(_0x2d99('0x13'));var logger=require(_0x2d99('0x14'))('api');var utils=require(_0x2d99('0x15'));var config=require(_0x2d99('0x16'));var licenseUtil=require(_0x2d99('0x17'));var db=require(_0x2d99('0x18'))['db'];function respondWithStatusCode(_0x87078b,_0x2316d0){_0x2316d0=_0x2316d0||0xcc;return function(_0x4494d8){if(_0x4494d8){return _0x87078b[_0x2d99('0x19')](_0x2316d0);}return _0x87078b[_0x2d99('0x1a')](_0x2316d0)[_0x2d99('0x1b')]();};}function respondWithResult(_0x35de72,_0x321716){_0x321716=_0x321716||0xc8;return function(_0x2ec2fb){if(_0x2ec2fb){return _0x35de72['status'](_0x321716)[_0x2d99('0x1c')](_0x2ec2fb);}};}function respondWithFilteredResult(_0x289b2b,_0x4ba115){return function(_0xb063bb){if(_0xb063bb){var _0x3edebb=typeof _0x4ba115[_0x2d99('0x1d')]===_0x2d99('0x1e')&&typeof _0x4ba115['limit']===_0x2d99('0x1e');var _0x3b1f9c=_0xb063bb['count'];var _0x16a412=_0x3edebb?0x0:_0x4ba115[_0x2d99('0x1d')];var _0xe8903d=_0x3edebb?_0xb063bb['count']:_0x4ba115[_0x2d99('0x1d')]+_0x4ba115['limit'];var _0x4a1726;if(_0xe8903d>=_0x3b1f9c){_0xe8903d=_0x3b1f9c;_0x4a1726=0xc8;}else{_0x4a1726=0xce;}_0x289b2b[_0x2d99('0x1a')](_0x4a1726);return _0x289b2b[_0x2d99('0x1f')](_0x2d99('0x20'),_0x16a412+'-'+_0xe8903d+'/'+_0x3b1f9c)['json'](_0xb063bb);}return null;};}function patchUpdates(_0x21bc19){return function(_0x2468c0){try{jsonpatch['apply'](_0x2468c0,_0x21bc19,!![]);}catch(_0x245a2e){return BPromise[_0x2d99('0x21')](_0x245a2e);}return _0x2468c0[_0x2d99('0x22')]();};}function saveUpdates(_0xf17cd4,_0x839a2b){return function(_0x2b0b3c){if(_0x2b0b3c){return _0x2b0b3c[_0x2d99('0x23')](_0xf17cd4)[_0x2d99('0x24')](function(_0x1f44e6){return _0x1f44e6;});}return null;};}function removeEntity(_0x11ca19,_0xd072dc){return function(_0x3132b6){if(_0x3132b6){return _0x3132b6[_0x2d99('0x25')]()[_0x2d99('0x24')](function(){_0x11ca19['status'](0xcc)[_0x2d99('0x1b')]();});}};}function handleEntityNotFound(_0x4a5af9,_0xce1ecb){return function(_0x39100f){if(!_0x39100f){_0x4a5af9[_0x2d99('0x19')](0x194);}return _0x39100f;};}function handleError(_0x2f4e32,_0x2e72a3){_0x2e72a3=_0x2e72a3||0x1f4;return function(_0x54d19e){logger[_0x2d99('0x26')](_0x54d19e[_0x2d99('0x27')]);if(_0x54d19e[_0x2d99('0x28')]){delete _0x54d19e[_0x2d99('0x28')];}_0x2f4e32['status'](_0x2e72a3)[_0x2d99('0x29')](_0x54d19e);};}exports[_0x2d99('0x2a')]=function(_0x28fa09,_0x26c036){var _0x50c3ef={},_0x339fb0={},_0xc3d00e={'count':0x0,'rows':[]};var _0x3f5157=_[_0x2d99('0x2b')](db[_0x2d99('0x2c')][_0x2d99('0x2d')],function(_0x2852b6){return{'name':_0x2852b6[_0x2d99('0x2e')],'type':_0x2852b6[_0x2d99('0x2f')][_0x2d99('0x30')]};});_0x339fb0['model']=_[_0x2d99('0x2b')](_0x3f5157,_0x2d99('0x28'));_0x339fb0[_0x2d99('0x31')]=_[_0x2d99('0x32')](_0x28fa09[_0x2d99('0x31')]);_0x339fb0['filters']=_[_0x2d99('0x33')](_0x339fb0[_0x2d99('0x34')],_0x339fb0[_0x2d99('0x31')]);_0x50c3ef[_0x2d99('0x35')]=_['intersection'](_0x339fb0[_0x2d99('0x34')],qs[_0x2d99('0x36')](_0x28fa09[_0x2d99('0x31')][_0x2d99('0x36')]));_0x50c3ef[_0x2d99('0x35')]=_0x50c3ef[_0x2d99('0x35')][_0x2d99('0x37')]?_0x50c3ef[_0x2d99('0x35')]:_0x339fb0['model'];if(!_0x28fa09[_0x2d99('0x31')][_0x2d99('0x38')](_0x2d99('0x39'))){_0x50c3ef['limit']=qs[_0x2d99('0x3a')](_0x28fa09[_0x2d99('0x31')][_0x2d99('0x3a')]);_0x50c3ef['offset']=qs[_0x2d99('0x1d')](_0x28fa09[_0x2d99('0x31')][_0x2d99('0x1d')]);}_0x50c3ef['order']=qs[_0x2d99('0x3b')](_0x28fa09[_0x2d99('0x31')][_0x2d99('0x3b')]);_0x50c3ef[_0x2d99('0x3c')]=qs[_0x2d99('0x3d')](_[_0x2d99('0x3e')](_0x28fa09[_0x2d99('0x31')],_0x339fb0[_0x2d99('0x3d')]),_0x3f5157);if(_0x28fa09[_0x2d99('0x31')][_0x2d99('0x3f')]){_0x50c3ef[_0x2d99('0x3c')]=_[_0x2d99('0x40')](_0x50c3ef['where'],{'$or':_[_0x2d99('0x2b')](_0x3f5157,function(_0x4b4aa3){if(_0x4b4aa3[_0x2d99('0x2f')]!==_0x2d99('0x41')){var _0x28dac8={};_0x28dac8[_0x4b4aa3[_0x2d99('0x28')]]={'$like':'%'+_0x28fa09[_0x2d99('0x31')]['filter']+'%'};return _0x28dac8;}})});}_0x50c3ef=_[_0x2d99('0x40')]({},_0x50c3ef,_0x28fa09[_0x2d99('0x42')]);var _0xea7f36={'where':_0x50c3ef[_0x2d99('0x3c')]};return db[_0x2d99('0x2c')][_0x2d99('0x43')](_0xea7f36)['then'](function(_0x32d0be){_0xc3d00e[_0x2d99('0x43')]=_0x32d0be;if(_0x28fa09[_0x2d99('0x31')]['includeAll']){_0x50c3ef[_0x2d99('0x44')]=[{'all':!![]}];}return db[_0x2d99('0x2c')][_0x2d99('0x45')](_0x50c3ef);})[_0x2d99('0x24')](function(_0x11c304){_0xc3d00e[_0x2d99('0x46')]=_0x11c304;return _0xc3d00e;})[_0x2d99('0x24')](respondWithFilteredResult(_0x26c036,_0x50c3ef))['catch'](handleError(_0x26c036,null));};exports['show']=function(_0x40de69,_0x35b5cf){var _0xd9874d={'raw':!![],'where':{'id':_0x40de69[_0x2d99('0x47')]['id']}},_0xa52551={};_0xa52551['model']=_[_0x2d99('0x32')](db[_0x2d99('0x2c')][_0x2d99('0x2d')]);_0xa52551['query']=_[_0x2d99('0x32')](_0x40de69['query']);_0xa52551['filters']=_[_0x2d99('0x33')](_0xa52551[_0x2d99('0x34')],_0xa52551['query']);_0xd9874d[_0x2d99('0x35')]=_[_0x2d99('0x33')](_0xa52551[_0x2d99('0x34')],qs[_0x2d99('0x36')](_0x40de69[_0x2d99('0x31')][_0x2d99('0x36')]));_0xd9874d[_0x2d99('0x35')]=_0xd9874d[_0x2d99('0x35')][_0x2d99('0x37')]?_0xd9874d[_0x2d99('0x35')]:_0xa52551['model'];if(_0x40de69[_0x2d99('0x31')][_0x2d99('0x48')]){_0xd9874d[_0x2d99('0x44')]=[{'all':!![]}];}_0xd9874d=_['merge']({},_0xd9874d,_0x40de69[_0x2d99('0x42')]);return db['VoiceDialReport'][_0x2d99('0x49')](_0xd9874d)[_0x2d99('0x24')](handleEntityNotFound(_0x35b5cf,null))[_0x2d99('0x24')](respondWithResult(_0x35b5cf,null))[_0x2d99('0x4a')](handleError(_0x35b5cf,null));};exports[_0x2d99('0x4b')]=function(_0x1e6653,_0x45b9cd){return db[_0x2d99('0x2c')][_0x2d99('0x4b')](_0x1e6653['body'],{})[_0x2d99('0x24')](respondWithResult(_0x45b9cd,0xc9))[_0x2d99('0x4a')](handleError(_0x45b9cd,null));};exports[_0x2d99('0x23')]=function(_0x51c916,_0x4ac5b2){if(_0x51c916[_0x2d99('0x4c')]['id']){delete _0x51c916['body']['id'];}return db[_0x2d99('0x2c')][_0x2d99('0x49')]({'where':{'id':_0x51c916['params']['id']}})[_0x2d99('0x24')](handleEntityNotFound(_0x4ac5b2,null))[_0x2d99('0x24')](saveUpdates(_0x51c916[_0x2d99('0x4c')],null))[_0x2d99('0x24')](respondWithResult(_0x4ac5b2,null))[_0x2d99('0x4a')](handleError(_0x4ac5b2,null));};exports[_0x2d99('0x25')]=function(_0x3a12ef,_0x21ba48){return db[_0x2d99('0x2c')]['find']({'where':{'id':_0x3a12ef['params']['id']}})[_0x2d99('0x24')](handleEntityNotFound(_0x21ba48,null))['then'](removeEntity(_0x21ba48,null))['catch'](handleError(_0x21ba48,null));};exports['describe']=function(_0x488db7,_0x4f8ea4){return db['VoiceDialReport'][_0x2d99('0x4d')]()[_0x2d99('0x24')](respondWithResult(_0x4f8ea4,null))[_0x2d99('0x4a')](handleError(_0x4f8ea4,null));}; \ No newline at end of file +var _0x387a=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','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','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','VoiceDialReport'];(function(_0x4ea5ea,_0x5d9028){var _0x170dfc=function(_0x1bffe3){while(--_0x1bffe3){_0x4ea5ea['push'](_0x4ea5ea['shift']());}};_0x170dfc(++_0x5d9028);}(_0x387a,0x100));var _0xa387=function(_0xee6028,_0x678569){_0xee6028=_0xee6028-0x0;var _0x16a6cf=_0x387a[_0xee6028];return _0x16a6cf;};'use strict';var emlformat=require(_0xa387('0x0'));var rimraf=require(_0xa387('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa387('0x2'));var rp=require(_0xa387('0x3'));var moment=require('moment');var BPromise=require(_0xa387('0x4'));var Mustache=require(_0xa387('0x5'));var util=require(_0xa387('0x6'));var path=require('path');var sox=require(_0xa387('0x7'));var csv=require(_0xa387('0x8'));var ejs=require(_0xa387('0x9'));var fs=require('fs');var fs_extra=require(_0xa387('0xa'));var _=require(_0xa387('0xb'));var squel=require(_0xa387('0xc'));var crypto=require(_0xa387('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa387('0xe'));var Papa=require('papaparse');var Redis=require(_0xa387('0xf'));var authService=require(_0xa387('0x10'));var qs=require(_0xa387('0x11'));var as=require(_0xa387('0x12'));var hardwareService=require(_0xa387('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa387('0x14'));var config=require(_0xa387('0x15'));var licenseUtil=require(_0xa387('0x16'));var db=require(_0xa387('0x17'))['db'];function respondWithStatusCode(_0x53f8e8,_0x4d4c7e){_0x4d4c7e=_0x4d4c7e||0xcc;return function(_0x440b96){if(_0x440b96){return _0x53f8e8[_0xa387('0x18')](_0x4d4c7e);}return _0x53f8e8[_0xa387('0x19')](_0x4d4c7e)[_0xa387('0x1a')]();};}function respondWithResult(_0x1c53e1,_0x208c49){_0x208c49=_0x208c49||0xc8;return function(_0x5b3342){if(_0x5b3342){return _0x1c53e1[_0xa387('0x19')](_0x208c49)[_0xa387('0x1b')](_0x5b3342);}};}function respondWithFilteredResult(_0x1415f2,_0x333e91){return function(_0x1590bc){if(_0x1590bc){var _0xdb3890=typeof _0x333e91[_0xa387('0x1c')]===_0xa387('0x1d')&&typeof _0x333e91[_0xa387('0x1e')]===_0xa387('0x1d');var _0x414e52=_0x1590bc[_0xa387('0x1f')];var _0x16b6fd=_0xdb3890?0x0:_0x333e91[_0xa387('0x1c')];var _0x5e28e3=_0xdb3890?_0x1590bc[_0xa387('0x1f')]:_0x333e91['offset']+_0x333e91[_0xa387('0x1e')];var _0x52750f;if(_0x5e28e3>=_0x414e52){_0x5e28e3=_0x414e52;_0x52750f=0xc8;}else{_0x52750f=0xce;}_0x1415f2[_0xa387('0x19')](_0x52750f);return _0x1415f2[_0xa387('0x20')](_0xa387('0x21'),_0x16b6fd+'-'+_0x5e28e3+'/'+_0x414e52)['json'](_0x1590bc);}return null;};}function patchUpdates(_0x156d05){return function(_0x24ce79){try{jsonpatch['apply'](_0x24ce79,_0x156d05,!![]);}catch(_0x568a8a){return BPromise[_0xa387('0x22')](_0x568a8a);}return _0x24ce79[_0xa387('0x23')]();};}function saveUpdates(_0x5e16c2,_0x11f662){return function(_0x113ac5){if(_0x113ac5){return _0x113ac5[_0xa387('0x24')](_0x5e16c2)[_0xa387('0x25')](function(_0x3c67ef){return _0x3c67ef;});}return null;};}function removeEntity(_0xb28ef4,_0x411a6b){return function(_0x3fabaa){if(_0x3fabaa){return _0x3fabaa['destroy']()[_0xa387('0x25')](function(){_0xb28ef4[_0xa387('0x19')](0xcc)[_0xa387('0x1a')]();});}};}function handleEntityNotFound(_0x297a62,_0x148531){return function(_0x34274a){if(!_0x34274a){_0x297a62[_0xa387('0x18')](0x194);}return _0x34274a;};}function handleError(_0xc6bc8,_0x4254bc){_0x4254bc=_0x4254bc||0x1f4;return function(_0x1c55ef){logger[_0xa387('0x26')](_0x1c55ef[_0xa387('0x27')]);if(_0x1c55ef[_0xa387('0x28')]){delete _0x1c55ef[_0xa387('0x28')];}_0xc6bc8[_0xa387('0x19')](_0x4254bc)[_0xa387('0x29')](_0x1c55ef);};}exports['index']=function(_0x5de27f,_0x23b9b8){var _0x4ac298={},_0x56085b={},_0x30b961={'count':0x0,'rows':[]};var _0x4e7a15=_[_0xa387('0x2a')](db[_0xa387('0x2b')][_0xa387('0x2c')],function(_0x1397c9){return{'name':_0x1397c9[_0xa387('0x2d')],'type':_0x1397c9['type'][_0xa387('0x2e')]};});_0x56085b[_0xa387('0x2f')]=_[_0xa387('0x2a')](_0x4e7a15,_0xa387('0x28'));_0x56085b[_0xa387('0x30')]=_[_0xa387('0x31')](_0x5de27f[_0xa387('0x30')]);_0x56085b[_0xa387('0x32')]=_[_0xa387('0x33')](_0x56085b['model'],_0x56085b[_0xa387('0x30')]);_0x4ac298[_0xa387('0x34')]=_[_0xa387('0x33')](_0x56085b[_0xa387('0x2f')],qs[_0xa387('0x35')](_0x5de27f[_0xa387('0x30')][_0xa387('0x35')]));_0x4ac298[_0xa387('0x34')]=_0x4ac298[_0xa387('0x34')]['length']?_0x4ac298['attributes']:_0x56085b[_0xa387('0x2f')];if(!_0x5de27f[_0xa387('0x30')][_0xa387('0x36')](_0xa387('0x37'))){_0x4ac298['limit']=qs['limit'](_0x5de27f[_0xa387('0x30')][_0xa387('0x1e')]);_0x4ac298[_0xa387('0x1c')]=qs['offset'](_0x5de27f[_0xa387('0x30')][_0xa387('0x1c')]);}_0x4ac298[_0xa387('0x38')]=qs[_0xa387('0x39')](_0x5de27f[_0xa387('0x30')][_0xa387('0x39')]);_0x4ac298['where']=qs[_0xa387('0x32')](_[_0xa387('0x3a')](_0x5de27f[_0xa387('0x30')],_0x56085b[_0xa387('0x32')]),_0x4e7a15);if(_0x5de27f[_0xa387('0x30')]['filter']){_0x4ac298[_0xa387('0x3b')]=_[_0xa387('0x3c')](_0x4ac298[_0xa387('0x3b')],{'$or':_[_0xa387('0x2a')](_0x4e7a15,function(_0x8ef39a){if(_0x8ef39a[_0xa387('0x3d')]!==_0xa387('0x3e')){var _0x2f8528={};_0x2f8528[_0x8ef39a[_0xa387('0x28')]]={'$like':'%'+_0x5de27f[_0xa387('0x30')][_0xa387('0x3f')]+'%'};return _0x2f8528;}})});}_0x4ac298=_[_0xa387('0x3c')]({},_0x4ac298,_0x5de27f[_0xa387('0x40')]);var _0x2fc69e={'where':_0x4ac298[_0xa387('0x3b')]};return db[_0xa387('0x2b')][_0xa387('0x1f')](_0x2fc69e)[_0xa387('0x25')](function(_0x421d61){_0x30b961[_0xa387('0x1f')]=_0x421d61;if(_0x5de27f[_0xa387('0x30')][_0xa387('0x41')]){_0x4ac298[_0xa387('0x42')]=[{'all':!![]}];}return db[_0xa387('0x2b')]['findAll'](_0x4ac298);})[_0xa387('0x25')](function(_0x45857b){_0x30b961['rows']=_0x45857b;return _0x30b961;})[_0xa387('0x25')](respondWithFilteredResult(_0x23b9b8,_0x4ac298))[_0xa387('0x43')](handleError(_0x23b9b8,null));};exports[_0xa387('0x44')]=function(_0x1cad85,_0x20ba6e){var _0x51c258={'raw':!![],'where':{'id':_0x1cad85[_0xa387('0x45')]['id']}},_0x217ddb={};_0x217ddb[_0xa387('0x2f')]=_[_0xa387('0x31')](db[_0xa387('0x2b')]['rawAttributes']);_0x217ddb[_0xa387('0x30')]=_[_0xa387('0x31')](_0x1cad85[_0xa387('0x30')]);_0x217ddb[_0xa387('0x32')]=_[_0xa387('0x33')](_0x217ddb[_0xa387('0x2f')],_0x217ddb['query']);_0x51c258[_0xa387('0x34')]=_['intersection'](_0x217ddb['model'],qs[_0xa387('0x35')](_0x1cad85[_0xa387('0x30')][_0xa387('0x35')]));_0x51c258[_0xa387('0x34')]=_0x51c258[_0xa387('0x34')][_0xa387('0x46')]?_0x51c258['attributes']:_0x217ddb['model'];if(_0x1cad85['query']['includeAll']){_0x51c258[_0xa387('0x42')]=[{'all':!![]}];}_0x51c258=_['merge']({},_0x51c258,_0x1cad85['options']);return db[_0xa387('0x2b')][_0xa387('0x47')](_0x51c258)['then'](handleEntityNotFound(_0x20ba6e,null))['then'](respondWithResult(_0x20ba6e,null))['catch'](handleError(_0x20ba6e,null));};exports[_0xa387('0x48')]=function(_0x12ea83,_0x2c614e){return db[_0xa387('0x2b')][_0xa387('0x48')](_0x12ea83[_0xa387('0x49')],{})[_0xa387('0x25')](respondWithResult(_0x2c614e,0xc9))[_0xa387('0x43')](handleError(_0x2c614e,null));};exports[_0xa387('0x24')]=function(_0x2a81d7,_0x221271){if(_0x2a81d7[_0xa387('0x49')]['id']){delete _0x2a81d7[_0xa387('0x49')]['id'];}return db['VoiceDialReport'][_0xa387('0x47')]({'where':{'id':_0x2a81d7[_0xa387('0x45')]['id']}})[_0xa387('0x25')](handleEntityNotFound(_0x221271,null))['then'](saveUpdates(_0x2a81d7[_0xa387('0x49')],null))[_0xa387('0x25')](respondWithResult(_0x221271,null))[_0xa387('0x43')](handleError(_0x221271,null));};exports['destroy']=function(_0xd3d1ec,_0x4b193e){return db['VoiceDialReport']['find']({'where':{'id':_0xd3d1ec[_0xa387('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b193e,null))['then'](removeEntity(_0x4b193e,null))[_0xa387('0x43')](handleError(_0x4b193e,null));};exports[_0xa387('0x4a')]=function(_0x1828e6,_0x1c1f71){return db[_0xa387('0x2b')]['describe']()[_0xa387('0x25')](respondWithResult(_0x1c1f71,null))[_0xa387('0x43')](handleError(_0x1c1f71,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index af0e6a1..502d733 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 _0x27bf=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a4fc6,_0x22752d){var _0x45d3a2=function(_0x3860d9){while(--_0x3860d9){_0x4a4fc6['push'](_0x4a4fc6['shift']());}};_0x45d3a2(++_0x22752d);}(_0x27bf,0x117));var _0xf27b=function(_0x394099,_0x4fd9f5){_0x394099=_0x394099-0x0;var _0x40f4fb=_0x27bf[_0x394099];return _0x40f4fb;};'use strict';var _=require(_0xf27b('0x0'));var util=require(_0xf27b('0x1'));var logger=require(_0xf27b('0x2'))(_0xf27b('0x3'));var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var rp=require(_0xf27b('0x6'));var fs=require('fs');var path=require(_0xf27b('0x7'));var rimraf=require(_0xf27b('0x8'));var config=require(_0xf27b('0x9'));var attributes=require(_0xf27b('0xa'));module['exports']=function(_0x1a18b4,_0x39bf1b){return _0x1a18b4[_0xf27b('0xb')](_0xf27b('0xc'),attributes,{'tableName':_0xf27b('0xd'),'paranoid':![],'indexes':[{'fields':[_0xf27b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7eab=['api','moment','bluebird','path','./voiceDialReport.attributes','VoiceDialReport','report_dial','../../config/logger'];(function(_0x37473e,_0x4a1aa8){var _0x2635f7=function(_0x2a2b6f){while(--_0x2a2b6f){_0x37473e['push'](_0x37473e['shift']());}};_0x2635f7(++_0x4a1aa8);}(_0x7eab,0x1d7));var _0xb7ea=function(_0x15c366,_0x3adf2a){_0x15c366=_0x15c366-0x0;var _0x1f3c07=_0x7eab[_0x15c366];return _0x1f3c07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb7ea('0x0'))(_0xb7ea('0x1'));var moment=require(_0xb7ea('0x2'));var BPromise=require(_0xb7ea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ea('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7ea('0x5'));module['exports']=function(_0x23b9a8,_0x3ef7d6){return _0x23b9a8['define'](_0xb7ea('0x6'),attributes,{'tableName':_0xb7ea('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 030fcb0..ae4fecb 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 _0x00d9=['stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','request\x20sent','result','create','body','options','raw','CreateVoiceDialReport','catch','VoiceDialReport','update','where','attributes','limit','then','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x7bff4f,_0x45ce80){var _0x3c6a26=function(_0x562f84){while(--_0x562f84){_0x7bff4f['push'](_0x7bff4f['shift']());}};_0x3c6a26(++_0x45ce80);}(_0x00d9,0x9c));var _0x900d=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x00d9[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0x900d('0x0'));var moment=require(_0x900d('0x1'));var BPromise=require(_0x900d('0x2'));var rs=require(_0x900d('0x3'));var fs=require('fs');var Redis=require(_0x900d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x900d('0x5'));var logger=require(_0x900d('0x6'))(_0x900d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x900d('0x8')][_0x900d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb517ee,_0xb8afc,_0x21cf51){return new BPromise(function(_0xc84d2f,_0x55bc0e){return client[_0x900d('0xa')](_0xb517ee,_0x21cf51)['then'](function(_0x442da8){logger[_0x900d('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0xb8afc,'request\x20sent');logger[_0x900d('0xc')](_0x900d('0xd'),_0xb8afc,'request\x20sent',JSON[_0x900d('0xe')](_0x442da8));if(_0x442da8[_0x900d('0xf')]){if(_0x442da8['error'][_0x900d('0x10')]===0x1f4){logger[_0x900d('0xf')](_0x900d('0x11'),_0xb8afc,_0x442da8[_0x900d('0xf')][_0x900d('0x12')]);return _0x55bc0e(_0x442da8[_0x900d('0xf')]['message']);}logger['error'](_0x900d('0x11'),_0xb8afc,_0x442da8[_0x900d('0xf')][_0x900d('0x12')]);return _0xc84d2f(_0x442da8[_0x900d('0xf')][_0x900d('0x12')]);}else{logger[_0x900d('0xb')](_0x900d('0x11'),_0xb8afc,_0x900d('0x13'));_0xc84d2f(_0x442da8[_0x900d('0x14')][_0x900d('0x12')]);}})['catch'](function(_0x4c2e74){logger['error'](_0x900d('0x11'),_0xb8afc,_0x4c2e74);_0x55bc0e(_0x4c2e74);});});}exports['CreateVoiceDialReport']=function(_0x39411c){var _0x4aaa40=this;return new Promise(function(_0x3be8f3,_0x4f1534){return db['VoiceDialReport'][_0x900d('0x15')](_0x39411c[_0x900d('0x16')],{'raw':_0x39411c[_0x900d('0x17')]?_0x39411c[_0x900d('0x17')][_0x900d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3ee784){logger['info'](_0x900d('0x19'),_0x39411c);logger['debug']('CreateVoiceDialReport',_0x39411c,JSON[_0x900d('0xe')](_0x3ee784));_0x3be8f3(_0x3ee784);})[_0x900d('0x1a')](function(_0x53913e){logger[_0x900d('0xf')](_0x900d('0x19'),_0x53913e[_0x900d('0x12')],_0x39411c);_0x4f1534(_0x4aaa40[_0x900d('0xf')](0x1f4,_0x53913e[_0x900d('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x2cc0ef){var _0x4aa5be=this;return new Promise(function(_0x10afbd,_0x20d5a3){return db[_0x900d('0x1b')][_0x900d('0x1c')](_0x2cc0ef[_0x900d('0x16')],{'raw':_0x2cc0ef[_0x900d('0x17')]?_0x2cc0ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cc0ef[_0x900d('0x17')]?_0x2cc0ef[_0x900d('0x17')][_0x900d('0x1d')]||null:null,'attributes':_0x2cc0ef['options']?_0x2cc0ef[_0x900d('0x17')][_0x900d('0x1e')]||null:null,'limit':_0x2cc0ef['options']?_0x2cc0ef[_0x900d('0x17')][_0x900d('0x1f')]||null:null})[_0x900d('0x20')](function(_0x195bd6){logger[_0x900d('0xb')](_0x900d('0x21'),_0x2cc0ef);logger[_0x900d('0xc')]('UpdateVoiceDialReport',_0x2cc0ef,JSON['stringify'](_0x195bd6));_0x10afbd(_0x195bd6);})[_0x900d('0x1a')](function(_0x119e58){logger['error']('UpdateVoiceDialReport',_0x119e58[_0x900d('0x12')],_0x2cc0ef);_0x20d5a3(_0x4aa5be[_0x900d('0xf')](0x1f4,_0x119e58[_0x900d('0x12')]));});});}; \ No newline at end of file +var _0x2290=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','create','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','VoiceDialReport','update','attributes','lodash','util','moment'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x2290,0xeb));var _0x0229=function(_0x5c6424,_0x260ecc){_0x5c6424=_0x5c6424-0x0;var _0xb3a3bf=_0x2290[_0x5c6424];return _0xb3a3bf;};'use strict';var _=require(_0x0229('0x0'));var util=require(_0x0229('0x1'));var moment=require(_0x0229('0x2'));var BPromise=require('bluebird');var rs=require(_0x0229('0x3'));var fs=require('fs');var Redis=require(_0x0229('0x4'));var db=require(_0x0229('0x5'))['db'];var utils=require(_0x0229('0x6'));var logger=require(_0x0229('0x7'))(_0x0229('0x8'));var config=require(_0x0229('0x9'));var jayson=require(_0x0229('0xa'));var client=jayson[_0x0229('0xb')][_0x0229('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33096a,_0x3a6089,_0x3a3611){return new BPromise(function(_0x8a0bad,_0x2278e9){return client[_0x0229('0xd')](_0x33096a,_0x3a3611)[_0x0229('0xe')](function(_0x2dc9b4){logger['info'](_0x0229('0xf'),_0x3a6089,_0x0229('0x10'));logger[_0x0229('0x11')](_0x0229('0x12'),_0x3a6089,_0x0229('0x10'),JSON[_0x0229('0x13')](_0x2dc9b4));if(_0x2dc9b4[_0x0229('0x14')]){if(_0x2dc9b4[_0x0229('0x14')]['code']===0x1f4){logger[_0x0229('0x14')](_0x0229('0xf'),_0x3a6089,_0x2dc9b4[_0x0229('0x14')]['message']);return _0x2278e9(_0x2dc9b4[_0x0229('0x14')][_0x0229('0x15')]);}logger[_0x0229('0x14')](_0x0229('0xf'),_0x3a6089,_0x2dc9b4['error'][_0x0229('0x15')]);return _0x8a0bad(_0x2dc9b4[_0x0229('0x14')][_0x0229('0x15')]);}else{logger[_0x0229('0x16')](_0x0229('0xf'),_0x3a6089,_0x0229('0x10'));_0x8a0bad(_0x2dc9b4[_0x0229('0x17')][_0x0229('0x15')]);}})['catch'](function(_0x1909a1){logger[_0x0229('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x3a6089,_0x1909a1);_0x2278e9(_0x1909a1);});});}exports['CreateVoiceDialReport']=function(_0x3d44a4){var _0x559837=this;return new Promise(function(_0x3b1c00,_0x36992e){return db['VoiceDialReport'][_0x0229('0x18')](_0x3d44a4[_0x0229('0x19')],{'raw':_0x3d44a4[_0x0229('0x1a')]?_0x3d44a4['options'][_0x0229('0x1b')]===undefined?!![]:![]:!![]})[_0x0229('0xe')](function(_0x557754){logger['info'](_0x0229('0x1c'),_0x3d44a4);logger[_0x0229('0x11')]('CreateVoiceDialReport',_0x3d44a4,JSON[_0x0229('0x13')](_0x557754));_0x3b1c00(_0x557754);})[_0x0229('0x1d')](function(_0x3fa7f5){logger[_0x0229('0x14')]('CreateVoiceDialReport',_0x3fa7f5['message'],_0x3d44a4);_0x36992e(_0x559837[_0x0229('0x14')](0x1f4,_0x3fa7f5[_0x0229('0x15')]));});});};exports[_0x0229('0x1e')]=function(_0xfd1638){var _0x173f53=this;return new Promise(function(_0x591fc9,_0x841e8f){return db[_0x0229('0x1f')][_0x0229('0x20')](_0xfd1638[_0x0229('0x19')],{'raw':_0xfd1638['options']?_0xfd1638[_0x0229('0x1a')][_0x0229('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd1638[_0x0229('0x1a')]?_0xfd1638[_0x0229('0x1a')]['where']||null:null,'attributes':_0xfd1638[_0x0229('0x1a')]?_0xfd1638[_0x0229('0x1a')][_0x0229('0x21')]||null:null,'limit':_0xfd1638['options']?_0xfd1638[_0x0229('0x1a')]['limit']||null:null})[_0x0229('0xe')](function(_0x2e6edf){logger[_0x0229('0x16')]('UpdateVoiceDialReport',_0xfd1638);logger['debug'](_0x0229('0x1e'),_0xfd1638,JSON['stringify'](_0x2e6edf));_0x591fc9(_0x2e6edf);})['catch'](function(_0x164214){logger[_0x0229('0x14')](_0x0229('0x1e'),_0x164214['message'],_0xfd1638);_0x841e8f(_0x173f53['error'](0x1f4,_0x164214[_0x0229('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bd08d64..3615df2 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 _0xe301=['Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','post','create','/:id/applications','put','/:id','delete','exports','multer','util','path','connect-timeout'];(function(_0x7c3b3,_0x4144d6){var _0x224cc2=function(_0x1926cc){while(--_0x1926cc){_0x7c3b3['push'](_0x7c3b3['shift']());}};_0x224cc2(++_0x4144d6);}(_0xe301,0xf8));var _0x1e30=function(_0x245731,_0x10c61c){_0x245731=_0x245731-0x0;var _0x503839=_0xe301[_0x245731];return _0x503839;};'use strict';var multer=require(_0x1e30('0x0'));var util=require(_0x1e30('0x1'));var path=require(_0x1e30('0x2'));var timeout=require(_0x1e30('0x3'));var express=require('express');var router=express[_0x1e30('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e30('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1e30('0x6'));var controller=require(_0x1e30('0x7'));router[_0x1e30('0x8')]('/',auth[_0x1e30('0x9')](),controller[_0x1e30('0xa')]);router[_0x1e30('0x8')]('/:id',auth[_0x1e30('0x9')](),controller['show']);router[_0x1e30('0xb')]('/',auth[_0x1e30('0x9')](),controller[_0x1e30('0xc')]);router[_0x1e30('0xb')](_0x1e30('0xd'),auth[_0x1e30('0x9')](),controller['addApplications']);router[_0x1e30('0xe')](_0x1e30('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1e30('0x10')](_0x1e30('0xf'),auth[_0x1e30('0x9')](),controller['destroy']);module[_0x1e30('0x11')]=router; \ No newline at end of file +var _0xbe55=['index','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xbe55,0x6c));var _0x5be5=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xbe55[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x5be5('0x0'));var util=require(_0x5be5('0x1'));var path=require(_0x5be5('0x2'));var timeout=require(_0x5be5('0x3'));var express=require(_0x5be5('0x4'));var router=express['Router']();var fs_extra=require(_0x5be5('0x5'));var auth=require(_0x5be5('0x6'));var interaction=require(_0x5be5('0x7'));var config=require(_0x5be5('0x8'));var controller=require(_0x5be5('0x9'));router[_0x5be5('0xa')]('/',auth[_0x5be5('0xb')](),controller[_0x5be5('0xc')]);router[_0x5be5('0xa')](_0x5be5('0xd'),auth[_0x5be5('0xb')](),controller['show']);router[_0x5be5('0xe')]('/',auth[_0x5be5('0xb')](),controller[_0x5be5('0xf')]);router[_0x5be5('0xe')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x5be5('0x10')](_0x5be5('0xd'),auth[_0x5be5('0xb')](),controller[_0x5be5('0x11')]);router['delete'](_0x5be5('0xd'),auth[_0x5be5('0xb')](),controller[_0x5be5('0x12')]);module[_0x5be5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a22d5f4..ab8be24 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 _0xe700=['inbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','STRING','NoOp','ENUM'];(function(_0x38b635,_0x34564f){var _0x3b40d5=function(_0x336e22){while(--_0x336e22){_0x38b635['push'](_0x38b635['shift']());}};_0x3b40d5(++_0x34564f);}(_0xe700,0xb1));var _0x0e70=function(_0x17c519,_0x53cdee){_0x17c519=_0x17c519-0x0;var _0x1e47e5=_0xe700[_0x17c519];return _0x1e47e5;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'context':{'type':Sequelize[_0x0e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x0e70('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0e70('0x3')},'appdata':{'type':Sequelize[_0x0e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0e70('0x4')](_0x0e70('0x5'),'outbound',_0x0e70('0x6'),'inbound-fax',_0x0e70('0x7'),_0x0e70('0x8'),_0x0e70('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0e70('0x2')]},'interval':{'type':Sequelize[_0x0e70('0x2')],'allowNull':![],'defaultValue':_0x0e70('0xa')},'IntervalId':{'type':Sequelize[_0x0e70('0xb')]},'isApp':{'type':Sequelize[_0x0e70('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x0e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x0e70('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x0e70('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0e70('0xd')],'get':function(_0x1b9f4a){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x0e70('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0555=['sequelize','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax','any','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten'];(function(_0xcf93cf,_0x44aa8d){var _0x264470=function(_0x3f5ec8){while(--_0x3f5ec8){_0xcf93cf['push'](_0xcf93cf['shift']());}};_0x264470(++_0x44aa8d);}(_0x0555,0x190));var _0x5055=function(_0x5ea442,_0x10108f){_0x5ea442=_0x5ea442-0x0;var _0x3bdff8=_0x0555[_0x5ea442];return _0x3bdff8;};'use strict';var Sequelize=require(_0x5055('0x0'));module['exports']={'context':{'type':Sequelize[_0x5055('0x1')],'allowNull':![],'unique':_0x5055('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5055('0x1')],'allowNull':![],'unique':_0x5055('0x2')},'priority':{'type':Sequelize[_0x5055('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x5055('0x2')},'tag':{'type':Sequelize[_0x5055('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5055('0x3')},'appdata':{'type':Sequelize[_0x5055('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5055('0x4')]('inbound',_0x5055('0x5'),_0x5055('0x6'),_0x5055('0x7'),_0x5055('0x8'),'system',_0x5055('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x5055('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x5055('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5055('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x5055('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5055('0xb')]},'recordingFormat':{'type':Sequelize[_0x5055('0x1')],'defaultValue':_0x5055('0xc')},'answer':{'type':Sequelize[_0x5055('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5055('0xd')],'get':function(_0x310229){return this[_0x5055('0xe')](_0x5055('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d36c934..8f25a85 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 _0x005b=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','offset','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','internal','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','send','index','VoiceExtension','rawAttributes','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','startsWith','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction'];(function(_0x1d9800,_0x5b0112){var _0x3602c2=function(_0x48586f){while(--_0x48586f){_0x1d9800['push'](_0x1d9800['shift']());}};_0x3602c2(++_0x5b0112);}(_0x005b,0xc5));var _0xb005=function(_0xd64ef5,_0x40d2dc){_0xd64ef5=_0xd64ef5-0x0;var _0x2b1023=_0x005b[_0xd64ef5];return _0x2b1023;};'use strict';var _=require('lodash');var Redis=require(_0xb005('0x0'));var qs=require(_0xb005('0x1'));var logger=require(_0xb005('0x2'))(_0xb005('0x3'));var config=require(_0xb005('0x4'));var db=require(_0xb005('0x5'))['db'];config[_0xb005('0x6')]=_[_0xb005('0x7')](config[_0xb005('0x6')],{'host':_0xb005('0x8'),'port':0x18eb});var socket=require(_0xb005('0x9'))(new Redis(config[_0xb005('0x6')]));require('./voiceExtension.socket')[_0xb005('0xa')](socket);function respondWithStatusCode(_0xba776e,_0x288aa5){_0x288aa5=_0x288aa5||0xcc;return function(_0x2f5f69){if(_0x2f5f69){return _0xba776e['sendStatus'](_0x288aa5);}return _0xba776e[_0xb005('0xb')](_0x288aa5)[_0xb005('0xc')]();};}function respondWithResult(_0x5f5d52,_0xab4c48){_0xab4c48=_0xab4c48||0xc8;return function(_0x72bf99){if(_0x72bf99){return _0x5f5d52['status'](_0xab4c48)[_0xb005('0xd')](_0x72bf99);}};}function respondWithFilteredResult(_0x2c3a4d,_0x56c1f7){return function(_0x4b5243){if(_0x4b5243){var _0x5d4c7a=typeof _0x56c1f7['offset']===_0xb005('0xe')&&typeof _0x56c1f7[_0xb005('0xf')]===_0xb005('0xe');var _0x44d42c=_0x4b5243['count'];var _0x32ea85=_0x5d4c7a?0x0:_0x56c1f7[_0xb005('0x10')];var _0x52dcf1=_0x5d4c7a?_0x4b5243[_0xb005('0x11')]:_0x56c1f7[_0xb005('0x10')]+_0x56c1f7[_0xb005('0xf')];var _0x5e9580;if(_0x52dcf1>=_0x44d42c){_0x52dcf1=_0x44d42c;_0x5e9580=0xc8;}else{_0x5e9580=0xce;}_0x2c3a4d[_0xb005('0xb')](_0x5e9580);return _0x2c3a4d[_0xb005('0x12')](_0xb005('0x13'),_0x32ea85+'-'+_0x52dcf1+'/'+_0x44d42c)[_0xb005('0xd')](_0x4b5243);}return null;};}function removeEntity(_0x5c7e33){return function(_0x2e91fe){if(_0x2e91fe){return _0x2e91fe[_0xb005('0x14')]()[_0xb005('0x15')](function(){var _0x1f0286=_0x2e91fe[_0xb005('0x16')]({'plain':!![]});var _0x5d23ac=[{'name':'InboundRoutes','value':_0xb005('0x17'),'ignore':![]},{'name':_0xb005('0x18'),'value':_0xb005('0x19'),'ignore':![]},{'name':'InternalRoutes','value':_0xb005('0x1a'),'ignore':![]}];var _0x3e4a48=_(_0x5d23ac)['filter'](_0xb005('0x1b'))[_0xb005('0x1c')](_0xb005('0x1d'))['value']();if(_[_0xb005('0x1e')](_0x3e4a48,_0x1f0286[_0xb005('0x1f')])){return;}var _0x1e48e4=_['find'](_0x5d23ac,['value',_0x1f0286[_0xb005('0x1f')]])[_0xb005('0x20')];return db[_0xb005('0x21')][_0xb005('0x14')]({'where':{'type':_0x1e48e4,'resourceId':_0x1f0286['id']}})[_0xb005('0x15')](function(){return _0x2e91fe;});})[_0xb005('0x15')](function(){_0x5c7e33[_0xb005('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7a26){return function(_0x5439a4){if(!_0x5439a4){_0x1b7a26[_0xb005('0x22')](0x194);}return _0x5439a4;};}function handleError(_0x3e4eb8,_0x24b1cb){_0x24b1cb=_0x24b1cb||0x1f4;return function(_0x10421d){logger[_0xb005('0x23')](_0x10421d['stack']);if(_0x10421d['name']){delete _0x10421d[_0xb005('0x20')];}_0x3e4eb8[_0xb005('0xb')](_0x24b1cb)[_0xb005('0x24')](_0x10421d);};}exports[_0xb005('0x25')]=function(_0x443614,_0x26055){var _0x16c0ed={},_0x1ec2e8={},_0x54de62={'count':0x0,'rows':[]};var _0x44932c=_[_0xb005('0x1c')](db[_0xb005('0x26')][_0xb005('0x27')],function(_0x1e8b30){return{'name':_0x1e8b30['fieldName'],'type':_0x1e8b30[_0xb005('0x1f')]['key']};});_0x1ec2e8[_0xb005('0x28')]=_[_0xb005('0x1c')](_0x44932c,_0xb005('0x20'));_0x1ec2e8[_0xb005('0x29')]=_[_0xb005('0x2a')](_0x443614[_0xb005('0x29')]);_0x1ec2e8['filters']=_['intersection'](_0x1ec2e8[_0xb005('0x28')],_0x1ec2e8[_0xb005('0x29')]);_0x16c0ed[_0xb005('0x2b')]=_[_0xb005('0x2c')](_0x1ec2e8[_0xb005('0x28')],qs[_0xb005('0x2d')](_0x443614[_0xb005('0x29')][_0xb005('0x2d')]));_0x16c0ed['attributes']=_0x16c0ed[_0xb005('0x2b')][_0xb005('0x2e')]?_0x16c0ed[_0xb005('0x2b')]:_0x1ec2e8[_0xb005('0x28')];if(!_0x443614[_0xb005('0x29')]['hasOwnProperty'](_0xb005('0x2f'))){_0x16c0ed[_0xb005('0xf')]=qs[_0xb005('0xf')](_0x443614[_0xb005('0x29')][_0xb005('0xf')]);_0x16c0ed[_0xb005('0x10')]=qs[_0xb005('0x10')](_0x443614[_0xb005('0x29')][_0xb005('0x10')]);}_0x16c0ed[_0xb005('0x30')]=qs[_0xb005('0x31')](_0x443614[_0xb005('0x29')]['sort']);_0x16c0ed[_0xb005('0x32')]=qs[_0xb005('0x33')](_[_0xb005('0x34')](_0x443614[_0xb005('0x29')],_0x1ec2e8[_0xb005('0x33')]),_0x44932c);if(_0x443614['query'][_0xb005('0x35')]){_0x16c0ed['where']=_[_0xb005('0x36')](_0x16c0ed[_0xb005('0x32')],{'$or':_['map'](_0x44932c,function(_0x55c096){if(_0x55c096[_0xb005('0x1f')]!==_0xb005('0x37')){var _0x173e7f={};_0x173e7f[_0x55c096[_0xb005('0x20')]]={'$like':'%'+_0x443614[_0xb005('0x29')][_0xb005('0x35')]+'%'};return _0x173e7f;}})});}_0x16c0ed=_[_0xb005('0x36')]({},_0x16c0ed,_0x443614[_0xb005('0x38')]);var _0x6c8bc9={'where':_0x16c0ed['where']};return db[_0xb005('0x26')][_0xb005('0x11')](_0x6c8bc9)[_0xb005('0x15')](function(_0x44e702){_0x54de62[_0xb005('0x11')]=_0x44e702;if(_0x443614[_0xb005('0x29')]['includeAll']){_0x16c0ed[_0xb005('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0xb005('0x3a')](_0x16c0ed);})[_0xb005('0x15')](function(_0x20a14f){_0x54de62[_0xb005('0x3b')]=_0x20a14f;return _0x54de62;})[_0xb005('0x15')](respondWithFilteredResult(_0x26055,_0x16c0ed))[_0xb005('0x3c')](handleError(_0x26055,null));};exports['show']=function(_0x2a72e3,_0xaad49d){var _0x39fba7={'raw':![],'where':{'id':_0x2a72e3[_0xb005('0x3d')]['id']}},_0x2f1dd9={};_0x2f1dd9[_0xb005('0x28')]=_['keys'](db['VoiceExtension'][_0xb005('0x27')]);_0x2f1dd9[_0xb005('0x29')]=_[_0xb005('0x2a')](_0x2a72e3[_0xb005('0x29')]);_0x2f1dd9['filters']=_[_0xb005('0x2c')](_0x2f1dd9[_0xb005('0x28')],_0x2f1dd9[_0xb005('0x29')]);_0x39fba7[_0xb005('0x2b')]=_[_0xb005('0x2c')](_0x2f1dd9[_0xb005('0x28')],qs[_0xb005('0x2d')](_0x2a72e3[_0xb005('0x29')][_0xb005('0x2d')]));_0x39fba7[_0xb005('0x2b')]=_0x39fba7[_0xb005('0x2b')][_0xb005('0x2e')]?_0x39fba7[_0xb005('0x2b')]:_0x2f1dd9[_0xb005('0x28')];if(_0x2a72e3[_0xb005('0x29')][_0xb005('0x3e')]){_0x39fba7['include']=[{'all':!![]}];}_0x39fba7=_[_0xb005('0x36')]({},_0x39fba7,_0x2a72e3[_0xb005('0x38')]);return db[_0xb005('0x26')][_0xb005('0x3f')](_0x39fba7)[_0xb005('0x15')](handleEntityNotFound(_0xaad49d,null))[_0xb005('0x15')](respondWithResult(_0xaad49d,null))['catch'](handleError(_0xaad49d,null));};exports[_0xb005('0x14')]=function(_0x564850,_0x56350a){return db[_0xb005('0x26')][_0xb005('0x3f')]({'where':{'id':_0x564850[_0xb005('0x3d')]['id']}})[_0xb005('0x15')](handleEntityNotFound(_0x56350a,null))['then'](removeEntity(_0x56350a,null))[_0xb005('0x3c')](handleError(_0x56350a,null));};exports['create']=function(_0x546261,_0x47bd33){if(_0x546261['body'][_0xb005('0x1f')]===_0xb005('0x19')&&!_[_0xb005('0x40')](_0x546261[_0xb005('0x41')][_0xb005('0x42')],'_')){_0x546261['body'][_0xb005('0x42')]='_'[_0xb005('0x43')](_0x546261[_0xb005('0x41')]['exten']);}return db[_0xb005('0x26')][_0xb005('0x44')](_0x546261['body'],{'raw':![]})[_0xb005('0x15')](function(_0x1a5ad0){var _0x4db2b7=_0x546261[_0xb005('0x45')][_0xb005('0x16')]({'plain':!![]});if(!_0x4db2b7)throw new Error(_0xb005('0x46'));if(_0x4db2b7['role']===_0xb005('0x45')){var _0x539fdf=_0x1a5ad0[_0xb005('0x16')]({'plain':!![]});var _0x11b49d=[{'name':_0xb005('0x47'),'value':_0xb005('0x17')},{'name':_0xb005('0x18'),'value':_0xb005('0x19')},{'name':_0xb005('0x48'),'value':_0xb005('0x1a')}];var _0x2345f4=_[_0xb005('0x3f')](_0x11b49d,[_0xb005('0x1d'),_0x539fdf[_0xb005('0x1f')]])['name'];return db[_0xb005('0x49')]['find']({'where':{'name':_0x2345f4,'userProfileId':_0x4db2b7[_0xb005('0x4a')]},'raw':!![]})[_0xb005('0x15')](function(_0x2d89c5){if(_0x2d89c5&&_0x2d89c5[_0xb005('0x4b')]===0x0){return db[_0xb005('0x21')]['create']({'name':_0x539fdf[_0xb005('0x20')],'resourceId':_0x539fdf['id'],'type':_0x2d89c5[_0xb005('0x20')],'sectionId':_0x2d89c5['id']},{})['then'](function(){return _0x1a5ad0;});}else{return _0x1a5ad0;}})[_0xb005('0x3c')](function(_0x9a1b6b){logger[_0xb005('0x23')](_0xb005('0x4c'),_0x9a1b6b);throw _0x9a1b6b;});}return _0x1a5ad0;})['then'](respondWithResult(_0x47bd33,0xc9))[_0xb005('0x3c')](handleError(_0x47bd33,null));};exports['update']=function(_0x82572b,_0x245311){if(_0x82572b[_0xb005('0x41')]['id']){delete _0x82572b['body']['id'];}return db[_0xb005('0x26')][_0xb005('0x3f')]({'where':{'id':_0x82572b[_0xb005('0x3d')]['id']}})[_0xb005('0x15')](handleEntityNotFound(_0x245311,null))[_0xb005('0x15')](function(_0x4955e7){if(_0x4955e7){return db[_0xb005('0x26')][_0xb005('0x4d')](_[_0xb005('0x34')](_0x82572b[_0xb005('0x41')],[_0xb005('0x42'),_0xb005('0x4e'),'description',_0xb005('0x4f'),_0xb005('0x50'),'mandatoryDisposition',_0xb005('0x51')]),{'where':{'context':_0x4955e7[_0xb005('0x4e')],'exten':_0x4955e7[_0xb005('0x42')]},'individualHooks':!![]})[_0xb005('0x15')](function(_0x4d680a){return _0x4d680a;});}return null;})[_0xb005('0x15')](respondWithStatusCode(_0x245311,null))[_0xb005('0x3c')](handleError(_0x245311,null));};exports[_0xb005('0x52')]=function(_0x9ca2cb,_0x5889d9){var _0xe357f6=_0x9ca2cb[_0xb005('0x3d')]['id'];var _0x13181d=_0x9ca2cb[_0xb005('0x41')];var _0x4a6545=0xc8;var _0x4baaab=null;return db[_0xb005('0x53')][_0xb005('0x54')]({'isolationLevel':db['sequelize'][_0xb005('0x55')][_0xb005('0x56')][_0xb005('0x57')]},function(_0x253799){return db[_0xb005('0x26')]['findOne']({'where':{'id':_0xe357f6},'transaction':_0x253799})['then'](function(_0x2dd551){if(_0x2dd551){return db[_0xb005('0x26')][_0xb005('0x14')]({'where':{'VoiceExtensionId':_0xe357f6},'transaction':_0x253799})[_0xb005('0x15')](function(){var _0x578ce1=_[_0xb005('0x1c')](_0x13181d,function(_0x1448a5){_0x1448a5[_0xb005('0x58')]=_0xe357f6;_0x1448a5[_0xb005('0x59')]=!![];return _0x1448a5;});return _0x2dd551[_0xb005('0x5a')](_0x578ce1);})[_0xb005('0x15')](function(_0x59671a){return db['VoiceExtension']['bulkCreate'](_0x59671a,{'transaction':_0x253799});});}else{_0x4a6545=0x194;_0x4baaab=[];}});})['then'](function(){if(_0x4a6545!==0x194){return db[_0xb005('0x26')][_0xb005('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0xe357f6},'order':_0xb005('0x5c')})['then'](function(_0x4d1f4c){_0x4baaab=_0x4d1f4c;});}})[_0xb005('0x3c')](function(_0x4a2e12){_0x4a6545=0x1f4;logger[_0xb005('0x23')](_0x4a2e12[_0xb005('0x5d')]);if(_0x4a2e12[_0xb005('0x20')]){delete _0x4a2e12[_0xb005('0x20')];}_0x4baaab=_0x4a2e12;})['finally'](function(){if(_0x4baaab===null){_0x5889d9[_0xb005('0x22')](_0x4a6545);}else{if(_0x4a6545===0x1f4){_0x5889d9['status'](_0x4a6545)[_0xb005('0x24')](_0x4baaab);}else{_0x5889d9['status'](_0x4a6545)[_0xb005('0xd')](_0x4baaab);}}});}; \ No newline at end of file +var _0x8cf8=['mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','json','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','undefined','count','offset','limit','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','stack','name','index','VoiceExtension','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','startsWith','concat','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits'];(function(_0x1e06ec,_0x495c2c){var _0x66d677=function(_0x4088ff){while(--_0x4088ff){_0x1e06ec['push'](_0x1e06ec['shift']());}};_0x66d677(++_0x495c2c);}(_0x8cf8,0x17e));var _0x88cf=function(_0x5b0272,_0x4bb644){_0x5b0272=_0x5b0272-0x0;var _0x441dfa=_0x8cf8[_0x5b0272];return _0x441dfa;};'use strict';var _=require('lodash');var Redis=require(_0x88cf('0x0'));var qs=require(_0x88cf('0x1'));var logger=require('../../config/logger')(_0x88cf('0x2'));var config=require(_0x88cf('0x3'));var db=require(_0x88cf('0x4'))['db'];config[_0x88cf('0x5')]=_[_0x88cf('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x88cf('0x7'))(new Redis(config[_0x88cf('0x5')]));require(_0x88cf('0x8'))[_0x88cf('0x9')](socket);function respondWithStatusCode(_0x3ca12a,_0x2e740f){_0x2e740f=_0x2e740f||0xcc;return function(_0xcf74f2){if(_0xcf74f2){return _0x3ca12a[_0x88cf('0xa')](_0x2e740f);}return _0x3ca12a[_0x88cf('0xb')](_0x2e740f)[_0x88cf('0xc')]();};}function respondWithResult(_0x24002a,_0x4ebbf8){_0x4ebbf8=_0x4ebbf8||0xc8;return function(_0x2cf55d){if(_0x2cf55d){return _0x24002a[_0x88cf('0xb')](_0x4ebbf8)['json'](_0x2cf55d);}};}function respondWithFilteredResult(_0x4e3153,_0x2eb8ea){return function(_0x1a3a1c){if(_0x1a3a1c){var _0x854010=typeof _0x2eb8ea['offset']==='undefined'&&typeof _0x2eb8ea['limit']===_0x88cf('0xd');var _0x4924f2=_0x1a3a1c[_0x88cf('0xe')];var _0xfaf907=_0x854010?0x0:_0x2eb8ea[_0x88cf('0xf')];var _0x57a762=_0x854010?_0x1a3a1c[_0x88cf('0xe')]:_0x2eb8ea[_0x88cf('0xf')]+_0x2eb8ea[_0x88cf('0x10')];var _0xf0814c;if(_0x57a762>=_0x4924f2){_0x57a762=_0x4924f2;_0xf0814c=0xc8;}else{_0xf0814c=0xce;}_0x4e3153[_0x88cf('0xb')](_0xf0814c);return _0x4e3153['set'](_0x88cf('0x11'),_0xfaf907+'-'+_0x57a762+'/'+_0x4924f2)['json'](_0x1a3a1c);}return null;};}function removeEntity(_0x41902a){return function(_0x5852c3){if(_0x5852c3){return _0x5852c3[_0x88cf('0x12')]()[_0x88cf('0x13')](function(){var _0x3405ba=_0x5852c3[_0x88cf('0x14')]({'plain':!![]});var _0x4e0cc4=[{'name':_0x88cf('0x15'),'value':_0x88cf('0x16'),'ignore':![]},{'name':_0x88cf('0x17'),'value':_0x88cf('0x18'),'ignore':![]},{'name':_0x88cf('0x19'),'value':_0x88cf('0x1a'),'ignore':![]}];var _0x4b53e9=_(_0x4e0cc4)[_0x88cf('0x1b')](_0x88cf('0x1c'))[_0x88cf('0x1d')](_0x88cf('0x1e'))['value']();if(_[_0x88cf('0x1f')](_0x4b53e9,_0x3405ba[_0x88cf('0x20')])){return;}var _0x9a37=_['find'](_0x4e0cc4,[_0x88cf('0x1e'),_0x3405ba['type']])['name'];return db[_0x88cf('0x21')][_0x88cf('0x12')]({'where':{'type':_0x9a37,'resourceId':_0x3405ba['id']}})['then'](function(){return _0x5852c3;});})[_0x88cf('0x13')](function(){_0x41902a[_0x88cf('0xb')](0xcc)[_0x88cf('0xc')]();});}};}function handleEntityNotFound(_0x4438df){return function(_0xe089d9){if(!_0xe089d9){_0x4438df[_0x88cf('0xa')](0x194);}return _0xe089d9;};}function handleError(_0x34849f,_0x2dfe61){_0x2dfe61=_0x2dfe61||0x1f4;return function(_0x1117f4){logger['error'](_0x1117f4[_0x88cf('0x22')]);if(_0x1117f4[_0x88cf('0x23')]){delete _0x1117f4[_0x88cf('0x23')];}_0x34849f[_0x88cf('0xb')](_0x2dfe61)['send'](_0x1117f4);};}exports[_0x88cf('0x24')]=function(_0x56febf,_0x44b0c8){var _0x4330cd={},_0x37826b={},_0x3adc2d={'count':0x0,'rows':[]};var _0xffe50e=_[_0x88cf('0x1d')](db[_0x88cf('0x25')][_0x88cf('0x26')],function(_0x3aeb4f){return{'name':_0x3aeb4f['fieldName'],'type':_0x3aeb4f[_0x88cf('0x20')][_0x88cf('0x27')]};});_0x37826b['model']=_[_0x88cf('0x1d')](_0xffe50e,_0x88cf('0x23'));_0x37826b[_0x88cf('0x28')]=_[_0x88cf('0x29')](_0x56febf['query']);_0x37826b[_0x88cf('0x2a')]=_['intersection'](_0x37826b[_0x88cf('0x2b')],_0x37826b[_0x88cf('0x28')]);_0x4330cd[_0x88cf('0x2c')]=_[_0x88cf('0x2d')](_0x37826b[_0x88cf('0x2b')],qs['fields'](_0x56febf[_0x88cf('0x28')][_0x88cf('0x2e')]));_0x4330cd[_0x88cf('0x2c')]=_0x4330cd['attributes'][_0x88cf('0x2f')]?_0x4330cd['attributes']:_0x37826b[_0x88cf('0x2b')];if(!_0x56febf[_0x88cf('0x28')][_0x88cf('0x30')]('nolimit')){_0x4330cd[_0x88cf('0x10')]=qs[_0x88cf('0x10')](_0x56febf[_0x88cf('0x28')][_0x88cf('0x10')]);_0x4330cd[_0x88cf('0xf')]=qs[_0x88cf('0xf')](_0x56febf[_0x88cf('0x28')]['offset']);}_0x4330cd[_0x88cf('0x31')]=qs[_0x88cf('0x32')](_0x56febf[_0x88cf('0x28')][_0x88cf('0x32')]);_0x4330cd[_0x88cf('0x33')]=qs['filters'](_[_0x88cf('0x34')](_0x56febf[_0x88cf('0x28')],_0x37826b[_0x88cf('0x2a')]),_0xffe50e);if(_0x56febf[_0x88cf('0x28')]['filter']){_0x4330cd['where']=_['merge'](_0x4330cd[_0x88cf('0x33')],{'$or':_[_0x88cf('0x1d')](_0xffe50e,function(_0x24b345){if(_0x24b345[_0x88cf('0x20')]!=='VIRTUAL'){var _0xca79e1={};_0xca79e1[_0x24b345[_0x88cf('0x23')]]={'$like':'%'+_0x56febf[_0x88cf('0x28')][_0x88cf('0x1b')]+'%'};return _0xca79e1;}})});}_0x4330cd=_[_0x88cf('0x35')]({},_0x4330cd,_0x56febf['options']);var _0x448b7a={'where':_0x4330cd[_0x88cf('0x33')]};return db[_0x88cf('0x25')][_0x88cf('0xe')](_0x448b7a)[_0x88cf('0x13')](function(_0x2c92a5){_0x3adc2d['count']=_0x2c92a5;if(_0x56febf[_0x88cf('0x28')][_0x88cf('0x36')]){_0x4330cd[_0x88cf('0x37')]=[{'all':!![]}];}return db[_0x88cf('0x25')][_0x88cf('0x38')](_0x4330cd);})[_0x88cf('0x13')](function(_0x8de201){_0x3adc2d[_0x88cf('0x39')]=_0x8de201;return _0x3adc2d;})[_0x88cf('0x13')](respondWithFilteredResult(_0x44b0c8,_0x4330cd))[_0x88cf('0x3a')](handleError(_0x44b0c8,null));};exports[_0x88cf('0x3b')]=function(_0x1aab9e,_0x186500){var _0x26300d={'raw':![],'where':{'id':_0x1aab9e[_0x88cf('0x3c')]['id']}},_0x252c85={};_0x252c85[_0x88cf('0x2b')]=_[_0x88cf('0x29')](db[_0x88cf('0x25')][_0x88cf('0x26')]);_0x252c85[_0x88cf('0x28')]=_[_0x88cf('0x29')](_0x1aab9e[_0x88cf('0x28')]);_0x252c85[_0x88cf('0x2a')]=_['intersection'](_0x252c85[_0x88cf('0x2b')],_0x252c85[_0x88cf('0x28')]);_0x26300d['attributes']=_[_0x88cf('0x2d')](_0x252c85[_0x88cf('0x2b')],qs[_0x88cf('0x2e')](_0x1aab9e['query'][_0x88cf('0x2e')]));_0x26300d[_0x88cf('0x2c')]=_0x26300d['attributes']['length']?_0x26300d[_0x88cf('0x2c')]:_0x252c85['model'];if(_0x1aab9e[_0x88cf('0x28')][_0x88cf('0x36')]){_0x26300d[_0x88cf('0x37')]=[{'all':!![]}];}_0x26300d=_[_0x88cf('0x35')]({},_0x26300d,_0x1aab9e[_0x88cf('0x3d')]);return db['VoiceExtension'][_0x88cf('0x3e')](_0x26300d)[_0x88cf('0x13')](handleEntityNotFound(_0x186500,null))['then'](respondWithResult(_0x186500,null))[_0x88cf('0x3a')](handleError(_0x186500,null));};exports[_0x88cf('0x12')]=function(_0x196adb,_0x9f752c){return db[_0x88cf('0x25')][_0x88cf('0x3e')]({'where':{'id':_0x196adb['params']['id']}})[_0x88cf('0x13')](handleEntityNotFound(_0x9f752c,null))['then'](removeEntity(_0x9f752c,null))[_0x88cf('0x3a')](handleError(_0x9f752c,null));};exports[_0x88cf('0x3f')]=function(_0x43c524,_0x2ac67f){if(_0x43c524[_0x88cf('0x40')][_0x88cf('0x20')]==='outbound'&&!_[_0x88cf('0x41')](_0x43c524['body']['exten'],'_')){_0x43c524[_0x88cf('0x40')]['exten']='_'[_0x88cf('0x42')](_0x43c524[_0x88cf('0x40')][_0x88cf('0x43')]);}return db['VoiceExtension'][_0x88cf('0x3f')](_0x43c524[_0x88cf('0x40')],{'raw':![]})[_0x88cf('0x13')](function(_0x323e84){var _0x5d47fe=_0x43c524[_0x88cf('0x44')][_0x88cf('0x14')]({'plain':!![]});if(!_0x5d47fe)throw new Error(_0x88cf('0x45'));if(_0x5d47fe['role']===_0x88cf('0x44')){var _0x1d2b0f=_0x323e84['get']({'plain':!![]});var _0x42b41d=[{'name':_0x88cf('0x15'),'value':'inbound'},{'name':_0x88cf('0x17'),'value':_0x88cf('0x18')},{'name':_0x88cf('0x19'),'value':'internal'}];var _0xc26b0e=_[_0x88cf('0x3e')](_0x42b41d,[_0x88cf('0x1e'),_0x1d2b0f[_0x88cf('0x20')]])['name'];return db['UserProfileSection'][_0x88cf('0x3e')]({'where':{'name':_0xc26b0e,'userProfileId':_0x5d47fe['userProfileId']},'raw':!![]})[_0x88cf('0x13')](function(_0x111c35){if(_0x111c35&&_0x111c35[_0x88cf('0x46')]===0x0){return db[_0x88cf('0x21')][_0x88cf('0x3f')]({'name':_0x1d2b0f[_0x88cf('0x23')],'resourceId':_0x1d2b0f['id'],'type':_0x111c35[_0x88cf('0x23')],'sectionId':_0x111c35['id']},{})[_0x88cf('0x13')](function(){return _0x323e84;});}else{return _0x323e84;}})[_0x88cf('0x3a')](function(_0x280ed3){logger[_0x88cf('0x47')](_0x88cf('0x48'),_0x280ed3);throw _0x280ed3;});}return _0x323e84;})[_0x88cf('0x13')](respondWithResult(_0x2ac67f,0xc9))[_0x88cf('0x3a')](handleError(_0x2ac67f,null));};exports[_0x88cf('0x49')]=function(_0x12b463,_0x3b42db){if(_0x12b463['body']['id']){delete _0x12b463[_0x88cf('0x40')]['id'];}return db['VoiceExtension'][_0x88cf('0x3e')]({'where':{'id':_0x12b463[_0x88cf('0x3c')]['id']}})[_0x88cf('0x13')](handleEntityNotFound(_0x3b42db,null))[_0x88cf('0x13')](function(_0x30c83b){if(_0x30c83b){return db[_0x88cf('0x25')][_0x88cf('0x49')](_['pick'](_0x12b463[_0x88cf('0x40')],['exten',_0x88cf('0x4a'),_0x88cf('0x4b'),_0x88cf('0x4c'),_0x88cf('0x4d'),_0x88cf('0x4e'),_0x88cf('0x4f')]),{'where':{'context':_0x30c83b['context'],'exten':_0x30c83b[_0x88cf('0x43')]},'individualHooks':!![]})[_0x88cf('0x13')](function(_0x1c990b){return _0x1c990b;});}return null;})[_0x88cf('0x13')](respondWithStatusCode(_0x3b42db,null))[_0x88cf('0x3a')](handleError(_0x3b42db,null));};exports[_0x88cf('0x50')]=function(_0x59d838,_0x5b709f){var _0x53f0bd=_0x59d838[_0x88cf('0x3c')]['id'];var _0x3d177f=_0x59d838[_0x88cf('0x40')];var _0x2259e3=0xc8;var _0x416e84=null;return db[_0x88cf('0x51')][_0x88cf('0x52')]({'isolationLevel':db['sequelize'][_0x88cf('0x53')][_0x88cf('0x54')][_0x88cf('0x55')]},function(_0x445baf){return db['VoiceExtension']['findOne']({'where':{'id':_0x53f0bd},'transaction':_0x445baf})[_0x88cf('0x13')](function(_0x1ec5e8){if(_0x1ec5e8){return db[_0x88cf('0x25')][_0x88cf('0x12')]({'where':{'VoiceExtensionId':_0x53f0bd},'transaction':_0x445baf})[_0x88cf('0x13')](function(){var _0x4740fb=_[_0x88cf('0x1d')](_0x3d177f,function(_0xccb56d){_0xccb56d['VoiceExtensionId']=_0x53f0bd;_0xccb56d[_0x88cf('0x56')]=!![];return _0xccb56d;});return _0x1ec5e8[_0x88cf('0x57')](_0x4740fb);})[_0x88cf('0x13')](function(_0x381536){return db['VoiceExtension'][_0x88cf('0x58')](_0x381536,{'transaction':_0x445baf});});}else{_0x2259e3=0x194;_0x416e84=[];}});})['then'](function(){if(_0x2259e3!==0x194){return db[_0x88cf('0x25')][_0x88cf('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x53f0bd},'order':_0x88cf('0x5a')})[_0x88cf('0x13')](function(_0x49659e){_0x416e84=_0x49659e;});}})[_0x88cf('0x3a')](function(_0x2d372a){_0x2259e3=0x1f4;logger['error'](_0x2d372a[_0x88cf('0x22')]);if(_0x2d372a['name']){delete _0x2d372a[_0x88cf('0x23')];}_0x416e84=_0x2d372a;})['finally'](function(){if(_0x416e84===null){_0x5b709f[_0x88cf('0xa')](_0x2259e3);}else{if(_0x2259e3===0x1f4){_0x5b709f[_0x88cf('0xb')](_0x2259e3)['send'](_0x416e84);}else{_0x5b709f[_0x88cf('0xb')](_0x2259e3)[_0x88cf('0x5b')](_0x416e84);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 1502641..ba4b8dc 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 _0x29bc=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x29bc,0x124));var _0xc29b=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x29bc[_0xe66cf2];return _0x2d84e7;};'use strict';var EventEmitter=require(_0xc29b('0x0'));var VoiceExtension=require(_0xc29b('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc29b('0x2'),'afterUpdate':_0xc29b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x14f50e){return function(_0xd14088,_0x4a17ad,_0x57321a){VoiceExtensionEvents[_0xc29b('0x4')](_0x14f50e+':'+_0xd14088['id'],_0xd14088);VoiceExtensionEvents[_0xc29b('0x4')](_0x14f50e,_0xd14088);_0x57321a(null);};}for(var e in events){if(events[_0xc29b('0x5')](e)){var event=events[e];VoiceExtension[_0xc29b('0x6')](e,emitEvent(event));}}module[_0xc29b('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0f52=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0f52,0x1c5));var _0x20f5=function(_0x1d8b9c,_0xc2cdd3){_0x1d8b9c=_0x1d8b9c-0x0;var _0x459bf4=_0x0f52[_0x1d8b9c];return _0x459bf4;};'use strict';var EventEmitter=require(_0x20f5('0x0'));var VoiceExtension=require(_0x20f5('0x1'))['db'][_0x20f5('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x20f5('0x3')](0x0);var events={'afterCreate':_0x20f5('0x4'),'afterUpdate':_0x20f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x241ca4){return function(_0x534da4,_0x3145f7,_0x221c09){VoiceExtensionEvents['emit'](_0x241ca4+':'+_0x534da4['id'],_0x534da4);VoiceExtensionEvents[_0x20f5('0x6')](_0x241ca4,_0x534da4);_0x221c09(null);};}for(var e in events){if(events[_0x20f5('0x7')](e)){var event=events[e];VoiceExtension[_0x20f5('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 03a2a53..6be4220 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 _0x285f=['join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','IntervalId','then','length','interval','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','concat','priority','catch','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','Set','CDR(type)=','type','context','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','name','param','prefix','phone','${EXTEN:','SIP'];(function(_0x12868a,_0x443968){var _0x135783=function(_0x2b6da1){while(--_0x2b6da1){_0x12868a['push'](_0x12868a['shift']());}};_0x135783(++_0x443968);}(_0x285f,0x76));var _0xf285=function(_0x335e39,_0x4918f1){_0x335e39=_0x335e39-0x0;var _0x3ff897=_0x285f[_0x335e39];return _0x3ff897;};'use strict';var _=require(_0xf285('0x0'));var attributes=require(_0xf285('0x1'));module[_0xf285('0x2')]=function(_0x1198ea){var _0x26becc=_0x1198ea['models'];function _0x1adc14(_0x45da7d){var _0x42ef5b=0x2;var _0x5af8b8=[{'type':_0x45da7d['type'],'app':_0xf285('0x3'),'appdata':_0xf285('0x4')+_0x45da7d[_0xf285('0x5')],'context':_0x45da7d[_0xf285('0x6')],'exten':_0x45da7d['exten'],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']},{'type':_0x45da7d[_0xf285('0x5')],'app':_0x45da7d[_0xf285('0x7')]?'Set':'NoOp','appdata':_0x45da7d[_0xf285('0x7')]?_0xf285('0x8')+_0x45da7d['alias']:_0xf285('0x9'),'context':_0x45da7d[_0xf285('0x6')],'exten':_0x45da7d[_0xf285('0xa')],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']}];if(_0x45da7d['type']===_0xf285('0xb')){_0x5af8b8[_0xf285('0xc')]({'type':_0xf285('0xb'),'app':'Set','appdata':_0xf285('0xd')+_0x45da7d['id'],'context':_0x45da7d['context'],'exten':_0x45da7d[_0xf285('0xa')],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']});}_0x5af8b8['push']({'type':_0x45da7d[_0xf285('0x5')],'app':'Set','appdata':_0xf285('0xe'),'context':_0x45da7d[_0xf285('0x6')],'exten':_0x45da7d[_0xf285('0xa')],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']},{'type':_0x45da7d[_0xf285('0x5')],'app':_0xf285('0x3'),'appdata':_0xf285('0xf'),'context':_0x45da7d[_0xf285('0x6')],'exten':_0x45da7d[_0xf285('0xa')],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']},{'type':_0x45da7d['type'],'app':_0xf285('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x45da7d[_0xf285('0x6')],'exten':_0x45da7d[_0xf285('0xa')],'priority':_0x42ef5b++,'VoiceExtensionId':_0x45da7d['id']});return _0x5af8b8;}function _0x51f958(_0xcea005){var _0x401408=0x2;var _0x348d87=[{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':_0xf285('0x11'),'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':'outbound','app':_0xcea005[_0xf285('0x7')]?_0xf285('0x3'):_0xf285('0x12'),'appdata':_0xcea005[_0xf285('0x7')]?'CDR(routeAlias)='+_0xcea005[_0xf285('0x7')]:_0xf285('0x9'),'context':_0xcea005['context'],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':_0xf285('0x13')+(_0xcea005[_0xf285('0x14')]?'${EXTEN:'+_0xcea005[_0xf285('0x14')]+'}':_0xf285('0x15')),'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':_0xf285('0xd')+_0xcea005['id'],'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x16'),'appdata':_0xf285('0x17')+(_0x401408+0x2)+'):Goto('+(_0x401408+0x1)+')','context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':_0xcea005[_0xf285('0x14')]?_0xf285('0x18')+_0xcea005['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':'outbound','app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0xcea005['context'],'exten':_0xcea005['exten'],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':_0xf285('0xf'),'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':_0xf285('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005['exten'],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':'outbound','app':_0xf285('0x3'),'appdata':_0xf285('0x19')+_0xcea005['id'],'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']}];if(_0xcea005[_0xf285('0x1a')](_0xf285('0x1b'))&&_0xcea005[_0xf285('0x1b')]!==_0xf285('0x1c')){_0x348d87['push']({'type':'outbound','app':_0xf285('0x3'),'appdata':_0xf285('0x1d'),'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005[_0xf285('0xa')],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']},{'type':_0xf285('0x10'),'app':'Set','appdata':_0xf285('0x1e')+_0xcea005[_0xf285('0x1b')]||_0xf285('0x1f'),'context':_0xcea005[_0xf285('0x6')],'exten':_0xcea005['exten'],'priority':_0x401408++,'VoiceExtensionId':_0xcea005['id']});}return _0x348d87;}function _0x183fa5(_0x4eed91,_0x2aa865){var _0x4da7f6=[{'name':_0xf285('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xf285('0x21'),'param':0x2},{'name':_0xf285('0x22'),'param':0x3}];var _0x1ce24f={};var _0x2ef6af=_0x2aa865[_0xf285('0x23')](',');var _0x1fd169=[];for(var _0x154b5a=0x0;_0x154b5a<_0x4da7f6['length'];_0x154b5a++){switch(_0x4da7f6[_0x154b5a][_0xf285('0x24')]){case _0xf285('0x20'):_0x1ce24f['trunk']=_0x2ef6af[_0x4da7f6[_0x154b5a][_0xf285('0x25')]]['split']('/')[0x1];_0x1ce24f['phone']=_0x2ef6af[_0x4da7f6[_0x154b5a][_0xf285('0x25')]][_0xf285('0x23')]('/')[0x2];_0x1ce24f[_0xf285('0x26')]=_0x1ce24f['phone']?_0x1ce24f['phone'][_0xf285('0x23')]('$')[0x0]:undefined;_0x1ce24f[_0xf285('0x27')]=_0x4eed91['cutdigits']?(_0x1ce24f[_0xf285('0x26')]||'')+_0xf285('0x28')+_0x4eed91[_0xf285('0x14')]+'}':(_0x1ce24f['prefix']||'')+'${EXTEN}';_0x1fd169[_0x4da7f6[_0x154b5a][_0xf285('0x25')]]=[_0xf285('0x29'),_0x1ce24f[_0xf285('0x20')],_0x1ce24f['phone']][_0xf285('0x2a')]('/');break;case'options':_0x1ce24f[_0xf285('0x21')]=_0x2ef6af[_0x4da7f6[_0x154b5a][_0xf285('0x25')]];if(_0x4eed91[_0xf285('0x1b')]!==_0xf285('0x1c')){if(_0x1ce24f[_0xf285('0x21')][_0xf285('0x2b')](_0xf285('0x2c'))<0x0){_0x1ce24f['options']+=_0xf285('0x2c');}}else{_0x1ce24f['options']=_0x1ce24f[_0xf285('0x21')]['replace'](_0xf285('0x2c'),'');}_0x1fd169[_0x4da7f6[_0x154b5a][_0xf285('0x25')]]=_0x1ce24f[_0xf285('0x21')];break;default:_0x1fd169[_0x4da7f6[_0x154b5a]['param']]=_0x2ef6af[_0x4da7f6[_0x154b5a][_0xf285('0x25')]];}}return _0x1fd169[_0xf285('0x2a')](',');}function _0x52a485(_0x33504b,_0x511c8a,_0x149723){return new Promise(function(_0x1d2b15,_0x485315){var _0x33d1ed=[];if(_[_0xf285('0x2d')](_0x511c8a))return _0x1d2b15(_0x33d1ed);_0x26becc[_0xf285('0x2e')]['findAll']({'attributes':['id','interval',_0xf285('0x2f')],'raw':!![]})[_0xf285('0x30')](function(_0x2b10be){for(var _0x48e9e3=0x0,_0x496f41=0x0;_0x48e9e3<_0x511c8a[_0xf285('0x31')];_0x48e9e3++,_0x496f41=0x0){var _0x233f33=_0x511c8a[_0x48e9e3];var _0x2c4ab0=[];var _0x518e5b=[];delete _0x233f33['id'];if(_0x233f33[_0xf285('0x32')]!==_0xf285('0x33')){_0x233f33[_0xf285('0x34')]=[_0x233f33[_0xf285('0x32')]];}else{_0x233f33['intervals']=_0x233f33[_0xf285('0x2f')]?_[_0xf285('0x35')](_['filter'](_0x2b10be,{'IntervalId':_0x233f33[_0xf285('0x2f')]}),'interval'):[];}_0x233f33[_0xf285('0x6')]=_0x33504b[_0xf285('0x6')];_0x233f33[_0xf285('0xa')]=_0x33504b[_0xf285('0xa')];if(_0x233f33[_0xf285('0x5')])_0x233f33['type']=_0x233f33[_0xf285('0x5')][_0xf285('0x36')]();if(_0x33504b[_0xf285('0x5')]==='outbound'){if(_0x233f33['hasOwnProperty'](_0xf285('0x37'))&&_0x233f33[_0xf285('0x37')]&&_0x233f33[_0xf285('0x37')]!=='--'){_0x2c4ab0[_0xf285('0xc')]({'type':_0x233f33['type']['toLowerCase'](),'app':'Set','appdata':_0xf285('0x38')+_0x233f33[_0xf285('0x37')],'context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b[_0xf285('0xa')],'priority':_0x233f33[_0xf285('0x34')]['length']+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});}_0x2c4ab0['push']({'type':_0x233f33[_0xf285('0x5')][_0xf285('0x36')](),'app':'ExecIf','appdata':_0xf285('0x39')+(_0x233f33['callerID']?_0xf285('0x3a')+_0x233f33[_0xf285('0x3b')]+')':_0xf285('0x3c')),'context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b[_0xf285('0xa')],'priority':_0x233f33[_0xf285('0x34')]['length']+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});}else{if(_0x233f33['hasOwnProperty'](_0xf285('0x3d'))){if(['queue',_0xf285('0x3e')]['includes'](_0x233f33[_0xf285('0x3f')]['toLowerCase']())&&_0x233f33['appType']!==_0xf285('0x40')){if(_0x233f33[_0xf285('0x3d')]){_0x2c4ab0[_0xf285('0xc')]({'type':_0x233f33['type'][_0xf285('0x36')](),'app':'ExecIf','appdata':_0xf285('0x41'),'context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b[_0xf285('0xa')],'priority':_0x233f33[_0xf285('0x34')][_0xf285('0x31')]+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});_0x2c4ab0['push']({'type':_0x233f33[_0xf285('0x5')][_0xf285('0x36')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b['exten'],'priority':_0x233f33[_0xf285('0x34')][_0xf285('0x31')]+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});}else{_0x2c4ab0[_0xf285('0xc')]({'type':_0x233f33[_0xf285('0x5')][_0xf285('0x36')](),'app':_0xf285('0x16'),'appdata':_0xf285('0x42'),'context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b[_0xf285('0xa')],'priority':_0x233f33['intervals'][_0xf285('0x31')]+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});_0x2c4ab0[_0xf285('0xc')]({'type':_0x233f33[_0xf285('0x5')][_0xf285('0x36')](),'app':_0xf285('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b['exten'],'priority':_0x233f33[_0xf285('0x34')][_0xf285('0x31')]+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});}}}}for(var _0x1b7cfa=0x0;_0x1b7cfa<_0x233f33['intervals'][_0xf285('0x31')];_0x1b7cfa++){var _0x20de38=_0x149723+_0x233f33[_0xf285('0x34')][_0xf285('0x31')];var _0x51c581=_0x1b7cfa===_0x233f33[_0xf285('0x34')][_0xf285('0x31')]-0x1?_0x149723+_0x2c4ab0[_0xf285('0x31')]+_0x518e5b['length']+0x2:_0x149723+_0x1b7cfa+0x1;_0x2c4ab0[_0xf285('0x43')](_0x1b7cfa,0x0,{'type':_0x33504b[_0xf285('0x5')],'app':_0xf285('0x44'),'appdata':_0x233f33['intervals'][_0x1b7cfa]+'?'+_0x33504b[_0xf285('0x6')]+_0xf285('0x45')+_0x20de38+':'+_0x33504b[_0xf285('0x6')]+_0xf285('0x45')+_0x51c581,'exten':_0x33504b[_0xf285('0xa')],'context':_0x33504b[_0xf285('0x6')],'priority':_0x149723+_0x1b7cfa,'VoiceExtensionId':_0x33504b['id']});}if(_0x233f33[_0xf285('0x46')]===_0xf285('0x47')){_0x233f33['appdata']=_0x183fa5(_0x33504b,_0x233f33[_0xf285('0x48')]);}if(_0x233f33[_0xf285('0x46')]==='agi'){_0x2c4ab0[_0xf285('0xc')]({'type':_0x233f33['type'][_0xf285('0x36')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x33504b[_0xf285('0x6')],'exten':_0x33504b[_0xf285('0xa')],'priority':_0x233f33[_0xf285('0x34')]['length']+_0x149723+_0x496f41++,'VoiceExtensionId':_0x33504b['id']});}_0x233f33['priority']=_0x2c4ab0[_0xf285('0x31')]?_[_0xf285('0x49')](_0x2c4ab0)['priority']+0x1:_0x149723;_0x33d1ed=_[_0xf285('0x4a')](_0x33d1ed,_0x2c4ab0,[_0x233f33],_0x518e5b);_0x149723=_[_0xf285('0x49')](_0x33d1ed)[_0xf285('0x4b')]+0x1;}return _0x1d2b15(_0x33d1ed);})[_0xf285('0x4c')](function(_0x4b626a){_0x485315(_0x4b626a);});});}return _0x1198ea[_0xf285('0x4d')](_0xf285('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x10930b){var _0x31b367=this[_0xf285('0x4f')]({'plain':!![]});var _0x4536de=_0x31b367[_0xf285('0x5')]===_0xf285('0x10')?_0x51f958(_0x31b367):_0x1adc14(_0x31b367);return _0x52a485(_0x31b367,_0x10930b,_['last'](_0x4536de)[_0xf285('0x4b')]+0x1)[_0xf285('0x30')](function(_0x3c486e){var _0x15af75=_[_0xf285('0x4a')](_0x4536de,_0x3c486e);_0x15af75[_0xf285('0xc')]({'type':_0x31b367[_0xf285('0x5')],'app':'Hangup','exten':_0x31b367['exten'],'context':_0x31b367[_0xf285('0x6')],'priority':_[_0xf285('0x49')](_0x15af75)[_0xf285('0x4b')]+0x1,'VoiceExtensionId':_0x31b367['id']});return _0x15af75;});}}});}; \ No newline at end of file +var _0x37ce=['appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','NoOp','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','hasOwnProperty','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0x37ce,0x15a));var _0xe37c=function(_0x5ab52e,_0x4123ab){_0x5ab52e=_0x5ab52e-0x0;var _0x44a574=_0x37ce[_0x5ab52e];return _0x44a574;};'use strict';var _=require(_0xe37c('0x0'));var attributes=require(_0xe37c('0x1'));module[_0xe37c('0x2')]=function(_0x375886){var _0x1e3bce=_0x375886[_0xe37c('0x3')];function _0x5db5a3(_0x27bf41){var _0x907d8f=0x2;var _0x282069=[{'type':_0x27bf41[_0xe37c('0x4')],'app':_0xe37c('0x5'),'appdata':_0xe37c('0x6')+_0x27bf41[_0xe37c('0x4')],'context':_0x27bf41['context'],'exten':_0x27bf41[_0xe37c('0x7')],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']},{'type':_0x27bf41['type'],'app':_0x27bf41[_0xe37c('0x8')]?'Set':'NoOp','appdata':_0x27bf41[_0xe37c('0x8')]?_0xe37c('0x9')+_0x27bf41['alias']:_0xe37c('0xa'),'context':_0x27bf41[_0xe37c('0xb')],'exten':_0x27bf41[_0xe37c('0x7')],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']}];if(_0x27bf41[_0xe37c('0x4')]===_0xe37c('0xc')){_0x282069[_0xe37c('0xd')]({'type':'inbound','app':_0xe37c('0x5'),'appdata':_0xe37c('0xe')+_0x27bf41['id'],'context':_0x27bf41['context'],'exten':_0x27bf41[_0xe37c('0x7')],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']});}_0x282069['push']({'type':_0x27bf41[_0xe37c('0x4')],'app':_0xe37c('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x27bf41[_0xe37c('0xb')],'exten':_0x27bf41[_0xe37c('0x7')],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']},{'type':_0x27bf41['type'],'app':_0xe37c('0x5'),'appdata':_0xe37c('0xf'),'context':_0x27bf41[_0xe37c('0xb')],'exten':_0x27bf41['exten'],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']},{'type':_0x27bf41[_0xe37c('0x4')],'app':_0xe37c('0x5'),'appdata':_0xe37c('0x10'),'context':_0x27bf41[_0xe37c('0xb')],'exten':_0x27bf41['exten'],'priority':_0x907d8f++,'VoiceExtensionId':_0x27bf41['id']});return _0x282069;}function _0x5cd32e(_0x4e0bb1){var _0x1b9431=0x2;var _0x189d7b=[{'type':'outbound','app':_0xe37c('0x5'),'appdata':_0xe37c('0x11'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':'outbound','app':_0x4e0bb1['alias']?'Set':_0xe37c('0x12'),'appdata':_0x4e0bb1[_0xe37c('0x8')]?_0xe37c('0x9')+_0x4e0bb1[_0xe37c('0x8')]:_0xe37c('0xa'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':_0xe37c('0x13'),'app':_0xe37c('0x5'),'appdata':_0xe37c('0x14')+(_0x4e0bb1[_0xe37c('0x15')]?_0xe37c('0x16')+_0x4e0bb1[_0xe37c('0x15')]+'}':_0xe37c('0x17')),'context':_0x4e0bb1['context'],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':'outbound','app':_0xe37c('0x5'),'appdata':'CDR(routeid)='+_0x4e0bb1['id'],'context':_0x4e0bb1['context'],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':'outbound','app':_0xe37c('0x18'),'appdata':_0xe37c('0x19')+(_0x1b9431+0x2)+'):Goto('+(_0x1b9431+0x1)+')','context':_0x4e0bb1['context'],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':'outbound','app':'Set','appdata':_0x4e0bb1[_0xe37c('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x4e0bb1[_0xe37c('0x15')]+'}':_0xe37c('0x1a'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':_0xe37c('0x13'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':_0xe37c('0x13'),'app':'Set','appdata':_0xe37c('0xf'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':_0xe37c('0x13'),'app':_0xe37c('0x5'),'appdata':_0xe37c('0x10'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1['exten'],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':'outbound','app':_0xe37c('0x5'),'appdata':_0xe37c('0x1b')+_0x4e0bb1['id'],'context':_0x4e0bb1['context'],'exten':_0x4e0bb1['exten'],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']}];if(_0x4e0bb1['hasOwnProperty']('recordingFormat')&&_0x4e0bb1[_0xe37c('0x1c')]!==_0xe37c('0x1d')){_0x189d7b[_0xe37c('0xd')]({'type':_0xe37c('0x13'),'app':'Set','appdata':_0xe37c('0x1e'),'context':_0x4e0bb1['context'],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']},{'type':_0xe37c('0x13'),'app':'Set','appdata':_0xe37c('0x1f')+_0x4e0bb1[_0xe37c('0x1c')]||_0xe37c('0x20'),'context':_0x4e0bb1[_0xe37c('0xb')],'exten':_0x4e0bb1[_0xe37c('0x7')],'priority':_0x1b9431++,'VoiceExtensionId':_0x4e0bb1['id']});}return _0x189d7b;}function _0x328b83(_0x27364c,_0x1c9ffa){var _0x2598d1=[{'name':_0xe37c('0x21'),'param':0x0},{'name':_0xe37c('0x22'),'param':0x1},{'name':_0xe37c('0x23'),'param':0x2},{'name':_0xe37c('0x24'),'param':0x3}];var _0x3dbd3f={};var _0x1ba3af=_0x1c9ffa[_0xe37c('0x25')](',');var _0x5961ff=[];for(var _0x48b9de=0x0;_0x48b9de<_0x2598d1[_0xe37c('0x26')];_0x48b9de++){switch(_0x2598d1[_0x48b9de][_0xe37c('0x27')]){case _0xe37c('0x21'):_0x3dbd3f[_0xe37c('0x21')]=_0x1ba3af[_0x2598d1[_0x48b9de][_0xe37c('0x28')]][_0xe37c('0x25')]('/')[0x1];_0x3dbd3f['phone']=_0x1ba3af[_0x2598d1[_0x48b9de][_0xe37c('0x28')]]['split']('/')[0x2];_0x3dbd3f['prefix']=_0x3dbd3f['phone']?_0x3dbd3f[_0xe37c('0x29')][_0xe37c('0x25')]('$')[0x0]:undefined;_0x3dbd3f['phone']=_0x27364c[_0xe37c('0x15')]?(_0x3dbd3f[_0xe37c('0x2a')]||'')+_0xe37c('0x16')+_0x27364c['cutdigits']+'}':(_0x3dbd3f[_0xe37c('0x2a')]||'')+_0xe37c('0x17');_0x5961ff[_0x2598d1[_0x48b9de][_0xe37c('0x28')]]=[_0xe37c('0x2b'),_0x3dbd3f[_0xe37c('0x21')],_0x3dbd3f[_0xe37c('0x29')]][_0xe37c('0x2c')]('/');break;case _0xe37c('0x23'):_0x3dbd3f[_0xe37c('0x23')]=_0x1ba3af[_0x2598d1[_0x48b9de][_0xe37c('0x28')]];if(_0x27364c[_0xe37c('0x1c')]!==_0xe37c('0x1d')){if(_0x3dbd3f[_0xe37c('0x23')][_0xe37c('0x2d')](_0xe37c('0x2e'))<0x0){_0x3dbd3f['options']+=_0xe37c('0x2e');}}else{_0x3dbd3f[_0xe37c('0x23')]=_0x3dbd3f[_0xe37c('0x23')][_0xe37c('0x2f')](_0xe37c('0x2e'),'');}_0x5961ff[_0x2598d1[_0x48b9de]['param']]=_0x3dbd3f[_0xe37c('0x23')];break;default:_0x5961ff[_0x2598d1[_0x48b9de]['param']]=_0x1ba3af[_0x2598d1[_0x48b9de][_0xe37c('0x28')]];}}return _0x5961ff[_0xe37c('0x2c')](',');}function _0x13a983(_0x271b7b,_0x58a1e4,_0x96f4f9){return new Promise(function(_0x4de67c,_0x5d2734){var _0x822d27=[];if(_[_0xe37c('0x30')](_0x58a1e4))return _0x4de67c(_0x822d27);_0x1e3bce['Interval'][_0xe37c('0x31')]({'attributes':['id',_0xe37c('0x32'),_0xe37c('0x33')],'raw':!![]})['then'](function(_0x1e79f7){for(var _0x5a9de6=0x0,_0x33ff6d=0x0;_0x5a9de6<_0x58a1e4[_0xe37c('0x26')];_0x5a9de6++,_0x33ff6d=0x0){var _0x1a34c8=_0x58a1e4[_0x5a9de6];var _0x20eaec=[];var _0x353194=[];delete _0x1a34c8['id'];if(_0x1a34c8[_0xe37c('0x32')]!==_0xe37c('0x34')){_0x1a34c8[_0xe37c('0x35')]=[_0x1a34c8[_0xe37c('0x32')]];}else{_0x1a34c8['intervals']=_0x1a34c8[_0xe37c('0x33')]?_[_0xe37c('0x36')](_[_0xe37c('0x37')](_0x1e79f7,{'IntervalId':_0x1a34c8[_0xe37c('0x33')]}),_0xe37c('0x32')):[];}_0x1a34c8[_0xe37c('0xb')]=_0x271b7b[_0xe37c('0xb')];_0x1a34c8[_0xe37c('0x7')]=_0x271b7b['exten'];if(_0x1a34c8['type'])_0x1a34c8['type']=_0x1a34c8[_0xe37c('0x4')][_0xe37c('0x38')]();if(_0x271b7b[_0xe37c('0x4')]===_0xe37c('0x13')){if(_0x1a34c8['hasOwnProperty'](_0xe37c('0x39'))&&_0x1a34c8[_0xe37c('0x39')]&&_0x1a34c8[_0xe37c('0x39')]!=='--'){_0x20eaec[_0xe37c('0xd')]({'type':_0x1a34c8[_0xe37c('0x4')][_0xe37c('0x38')](),'app':_0xe37c('0x5'),'appdata':_0xe37c('0x3a')+_0x1a34c8[_0xe37c('0x39')],'context':_0x271b7b['context'],'exten':_0x271b7b[_0xe37c('0x7')],'priority':_0x1a34c8[_0xe37c('0x35')][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});}_0x20eaec['push']({'type':_0x1a34c8[_0xe37c('0x4')][_0xe37c('0x38')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1a34c8[_0xe37c('0x3b')]?'Set(CALLERID(all)='+_0x1a34c8['callerID']+')':_0xe37c('0x3c')),'context':_0x271b7b[_0xe37c('0xb')],'exten':_0x271b7b[_0xe37c('0x7')],'priority':_0x1a34c8['intervals'][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});}else{if(_0x1a34c8[_0xe37c('0x3d')](_0xe37c('0x3e'))){if([_0xe37c('0x3f'),_0xe37c('0x40')][_0xe37c('0x41')](_0x1a34c8['app'][_0xe37c('0x38')]())&&_0x1a34c8[_0xe37c('0x42')]!==_0xe37c('0x43')){if(_0x1a34c8[_0xe37c('0x3e')]){_0x20eaec[_0xe37c('0xd')]({'type':_0x1a34c8[_0xe37c('0x4')]['toLowerCase'](),'app':_0xe37c('0x18'),'appdata':_0xe37c('0x44'),'context':_0x271b7b[_0xe37c('0xb')],'exten':_0x271b7b[_0xe37c('0x7')],'priority':_0x1a34c8[_0xe37c('0x35')][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});_0x20eaec['push']({'type':_0x1a34c8['type'][_0xe37c('0x38')](),'app':_0xe37c('0x5'),'appdata':_0xe37c('0x45'),'context':_0x271b7b['context'],'exten':_0x271b7b['exten'],'priority':_0x1a34c8[_0xe37c('0x35')][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});}else{_0x20eaec[_0xe37c('0xd')]({'type':_0x1a34c8['type'][_0xe37c('0x38')](),'app':_0xe37c('0x18'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x271b7b[_0xe37c('0xb')],'exten':_0x271b7b['exten'],'priority':_0x1a34c8[_0xe37c('0x35')]['length']+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});_0x20eaec['push']({'type':_0x1a34c8[_0xe37c('0x4')][_0xe37c('0x38')](),'app':_0xe37c('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x271b7b['context'],'exten':_0x271b7b[_0xe37c('0x7')],'priority':_0x1a34c8['intervals'][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});}}}}for(var _0x6bb1f3=0x0;_0x6bb1f3<_0x1a34c8[_0xe37c('0x35')]['length'];_0x6bb1f3++){var _0x42c8ce=_0x96f4f9+_0x1a34c8[_0xe37c('0x35')][_0xe37c('0x26')];var _0x3f06a2=_0x6bb1f3===_0x1a34c8[_0xe37c('0x35')][_0xe37c('0x26')]-0x1?_0x96f4f9+_0x20eaec[_0xe37c('0x26')]+_0x353194['length']+0x2:_0x96f4f9+_0x6bb1f3+0x1;_0x20eaec[_0xe37c('0x46')](_0x6bb1f3,0x0,{'type':_0x271b7b[_0xe37c('0x4')],'app':_0xe37c('0x47'),'appdata':_0x1a34c8[_0xe37c('0x35')][_0x6bb1f3]+'?'+_0x271b7b[_0xe37c('0xb')]+_0xe37c('0x48')+_0x42c8ce+':'+_0x271b7b[_0xe37c('0xb')]+_0xe37c('0x48')+_0x3f06a2,'exten':_0x271b7b[_0xe37c('0x7')],'context':_0x271b7b['context'],'priority':_0x96f4f9+_0x6bb1f3,'VoiceExtensionId':_0x271b7b['id']});}if(_0x1a34c8[_0xe37c('0x42')]===_0xe37c('0x49')){_0x1a34c8[_0xe37c('0x4a')]=_0x328b83(_0x271b7b,_0x1a34c8[_0xe37c('0x4a')]);}if(_0x1a34c8[_0xe37c('0x42')]===_0xe37c('0x4b')){_0x20eaec[_0xe37c('0xd')]({'type':_0x1a34c8['type'][_0xe37c('0x38')](),'app':'Set','appdata':_0xe37c('0x4c'),'context':_0x271b7b[_0xe37c('0xb')],'exten':_0x271b7b[_0xe37c('0x7')],'priority':_0x1a34c8['intervals'][_0xe37c('0x26')]+_0x96f4f9+_0x33ff6d++,'VoiceExtensionId':_0x271b7b['id']});}_0x1a34c8[_0xe37c('0x4d')]=_0x20eaec[_0xe37c('0x26')]?_['last'](_0x20eaec)['priority']+0x1:_0x96f4f9;_0x822d27=_[_0xe37c('0x4e')](_0x822d27,_0x20eaec,[_0x1a34c8],_0x353194);_0x96f4f9=_[_0xe37c('0x4f')](_0x822d27)['priority']+0x1;}return _0x4de67c(_0x822d27);})[_0xe37c('0x50')](function(_0x495dff){_0x5d2734(_0x495dff);});});}return _0x375886[_0xe37c('0x51')](_0xe37c('0x52'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x37e3c4){var _0x41a07d=this['get']({'plain':!![]});var _0x70c21e=_0x41a07d[_0xe37c('0x4')]==='outbound'?_0x5cd32e(_0x41a07d):_0x5db5a3(_0x41a07d);return _0x13a983(_0x41a07d,_0x37e3c4,_['last'](_0x70c21e)[_0xe37c('0x4d')]+0x1)['then'](function(_0x5c44c0){var _0x31481b=_[_0xe37c('0x4e')](_0x70c21e,_0x5c44c0);_0x31481b[_0xe37c('0xd')]({'type':_0x41a07d[_0xe37c('0x4')],'app':_0xe37c('0x53'),'exten':_0x41a07d['exten'],'context':_0x41a07d[_0xe37c('0xb')],'priority':_[_0xe37c('0x4f')](_0x31481b)[_0xe37c('0x4d')]+0x1,'VoiceExtensionId':_0x41a07d['id']});return _0x31481b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3a8a120..2f0cea3 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 _0xf96b=['error','code','message','info','result','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xf96b,0x109));var _0xbf96=function(_0x1523a6,_0x48262a){_0x1523a6=_0x1523a6-0x0;var _0x1dc2d9=_0xf96b[_0x1523a6];return _0x1dc2d9;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var moment=require(_0xbf96('0x2'));var BPromise=require(_0xbf96('0x3'));var rs=require(_0xbf96('0x4'));var fs=require('fs');var Redis=require(_0xbf96('0x5'));var db=require(_0xbf96('0x6'))['db'];var utils=require(_0xbf96('0x7'));var logger=require(_0xbf96('0x8'))(_0xbf96('0x9'));var config=require(_0xbf96('0xa'));var jayson=require(_0xbf96('0xb'));var client=jayson[_0xbf96('0xc')]['http']({'port':0x232a});config[_0xbf96('0xd')]=_[_0xbf96('0xe')](config[_0xbf96('0xd')],{'host':_0xbf96('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf96('0xd')]));require(_0xbf96('0x10'))[_0xbf96('0x11')](socket);function respondWithRpcPromise(_0x253863,_0x10440d,_0x1eec6a){return new BPromise(function(_0x1d0d3b,_0x24f95a){return client['request'](_0x253863,_0x1eec6a)[_0xbf96('0x12')](function(_0xd0e189){logger['info'](_0xbf96('0x13'),_0x10440d,_0xbf96('0x14'));logger[_0xbf96('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x10440d,_0xbf96('0x14'),JSON[_0xbf96('0x16')](_0xd0e189));if(_0xd0e189[_0xbf96('0x17')]){if(_0xd0e189[_0xbf96('0x17')][_0xbf96('0x18')]===0x1f4){logger[_0xbf96('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x10440d,_0xd0e189[_0xbf96('0x17')][_0xbf96('0x19')]);return _0x24f95a(_0xd0e189[_0xbf96('0x17')][_0xbf96('0x19')]);}logger[_0xbf96('0x17')](_0xbf96('0x13'),_0x10440d,_0xd0e189[_0xbf96('0x17')]['message']);return _0x1d0d3b(_0xd0e189[_0xbf96('0x17')]['message']);}else{logger[_0xbf96('0x1a')](_0xbf96('0x13'),_0x10440d,'request\x20sent');_0x1d0d3b(_0xd0e189[_0xbf96('0x1b')][_0xbf96('0x19')]);}})['catch'](function(_0x3bc6cb){logger[_0xbf96('0x17')](_0xbf96('0x13'),_0x10440d,_0x3bc6cb);_0x24f95a(_0x3bc6cb);});});}exports[_0xbf96('0x1c')]=function(_0x473e3b){var _0x2839af=this;return new Promise(function(_0x25705f,_0x5450e4){return db[_0xbf96('0x1d')]['findAll']({'raw':_0x473e3b[_0xbf96('0x1e')]?_0x473e3b[_0xbf96('0x1e')][_0xbf96('0x1f')]===undefined?!![]:![]:!![],'where':_0x473e3b['options']?_0x473e3b[_0xbf96('0x1e')]['where']||null:null,'attributes':_0x473e3b[_0xbf96('0x1e')]?_0x473e3b[_0xbf96('0x1e')][_0xbf96('0x20')]||null:null,'limit':_0x473e3b['options']?_0x473e3b[_0xbf96('0x1e')][_0xbf96('0x21')]||null:null,'include':_0x473e3b['options']?_0x473e3b['options'][_0xbf96('0x22')]?_[_0xbf96('0x23')](_0x473e3b[_0xbf96('0x1e')]['include'],function(_0x527558){return{'model':db[_0x527558['model']],'as':_0x527558['as'],'attributes':_0x527558['attributes'],'include':_0x527558[_0xbf96('0x22')]?_[_0xbf96('0x23')](_0x527558[_0xbf96('0x22')],function(_0x40b6fb){return{'model':db[_0x40b6fb['model']],'as':_0x40b6fb['as'],'attributes':_0x40b6fb[_0xbf96('0x20')],'include':_0x40b6fb[_0xbf96('0x22')]?_[_0xbf96('0x23')](_0x40b6fb[_0xbf96('0x22')],function(_0x5e99b3){return{'model':db[_0x5e99b3['model']],'as':_0x5e99b3['as'],'attributes':_0x5e99b3[_0xbf96('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbf96('0x12')](function(_0x4138ef){logger[_0xbf96('0x1a')](_0xbf96('0x1c'),_0x473e3b);logger[_0xbf96('0x15')](_0xbf96('0x1c'),_0x473e3b,JSON[_0xbf96('0x16')](_0x4138ef));_0x25705f(_0x4138ef);})['catch'](function(_0x2725cf){logger[_0xbf96('0x17')](_0xbf96('0x1c'),_0x2725cf['message'],_0x473e3b);_0x5450e4(_0x2839af['error'](0x1f4,_0x2725cf[_0xbf96('0x19')]));});});}; \ No newline at end of file +var _0xce1a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','register','request','info','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','GetVoiceExtension','debug','lodash'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0xce1a,0xbf));var _0xace1=function(_0x103651,_0x41a72f){_0x103651=_0x103651-0x0;var _0x334e29=_0xce1a[_0x103651];return _0x334e29;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xace1('0x1'));var fs=require('fs');var Redis=require(_0xace1('0x2'));var db=require(_0xace1('0x3'))['db'];var utils=require(_0xace1('0x4'));var logger=require(_0xace1('0x5'))('rpc');var config=require(_0xace1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xace1('0x7')]['http']({'port':0x232a});config[_0xace1('0x8')]=_[_0xace1('0x9')](config[_0xace1('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xace1('0x8')]));require('./voiceExtension.socket')[_0xace1('0xa')](socket);function respondWithRpcPromise(_0x3d34c,_0x13f8ac,_0x196b32){return new BPromise(function(_0x56d3e3,_0x253e0f){return client[_0xace1('0xb')](_0x3d34c,_0x196b32)['then'](function(_0x3f2a3f){logger[_0xace1('0xc')]('VoiceExtension,\x20%s,\x20%s',_0x13f8ac,'request\x20sent');logger['debug'](_0xace1('0xd'),_0x13f8ac,_0xace1('0xe'),JSON[_0xace1('0xf')](_0x3f2a3f));if(_0x3f2a3f['error']){if(_0x3f2a3f['error']['code']===0x1f4){logger[_0xace1('0x10')](_0xace1('0x11'),_0x13f8ac,_0x3f2a3f[_0xace1('0x10')][_0xace1('0x12')]);return _0x253e0f(_0x3f2a3f[_0xace1('0x10')][_0xace1('0x12')]);}logger[_0xace1('0x10')](_0xace1('0x11'),_0x13f8ac,_0x3f2a3f['error']['message']);return _0x56d3e3(_0x3f2a3f[_0xace1('0x10')][_0xace1('0x12')]);}else{logger['info'](_0xace1('0x11'),_0x13f8ac,_0xace1('0xe'));_0x56d3e3(_0x3f2a3f[_0xace1('0x13')][_0xace1('0x12')]);}})[_0xace1('0x14')](function(_0x5ecd76){logger['error'](_0xace1('0x11'),_0x13f8ac,_0x5ecd76);_0x253e0f(_0x5ecd76);});});}exports['GetVoiceExtension']=function(_0x1ddf8d){var _0x2d43de=this;return new Promise(function(_0x1bafc9,_0x4fe2ba){return db[_0xace1('0x15')][_0xace1('0x16')]({'raw':_0x1ddf8d['options']?_0x1ddf8d[_0xace1('0x17')][_0xace1('0x18')]===undefined?!![]:![]:!![],'where':_0x1ddf8d[_0xace1('0x17')]?_0x1ddf8d[_0xace1('0x17')][_0xace1('0x19')]||null:null,'attributes':_0x1ddf8d[_0xace1('0x17')]?_0x1ddf8d[_0xace1('0x17')][_0xace1('0x1a')]||null:null,'limit':_0x1ddf8d[_0xace1('0x17')]?_0x1ddf8d[_0xace1('0x17')][_0xace1('0x1b')]||null:null,'include':_0x1ddf8d[_0xace1('0x17')]?_0x1ddf8d[_0xace1('0x17')][_0xace1('0x1c')]?_['map'](_0x1ddf8d[_0xace1('0x17')][_0xace1('0x1c')],function(_0x937188){return{'model':db[_0x937188[_0xace1('0x1d')]],'as':_0x937188['as'],'attributes':_0x937188['attributes'],'include':_0x937188[_0xace1('0x1c')]?_['map'](_0x937188[_0xace1('0x1c')],function(_0x13c596){return{'model':db[_0x13c596[_0xace1('0x1d')]],'as':_0x13c596['as'],'attributes':_0x13c596[_0xace1('0x1a')],'include':_0x13c596['include']?_['map'](_0x13c596[_0xace1('0x1c')],function(_0x455286){return{'model':db[_0x455286[_0xace1('0x1d')]],'as':_0x455286['as'],'attributes':_0x455286[_0xace1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d241d){logger[_0xace1('0xc')](_0xace1('0x1e'),_0x1ddf8d);logger[_0xace1('0x1f')](_0xace1('0x1e'),_0x1ddf8d,JSON[_0xace1('0xf')](_0x4d241d));_0x1bafc9(_0x4d241d);})[_0xace1('0x14')](function(_0x356a8e){logger[_0xace1('0x10')](_0xace1('0x1e'),_0x356a8e[_0xace1('0x12')],_0x1ddf8d);_0x4fe2ba(_0x2d43de[_0xace1('0x10')](0x1f4,_0x356a8e[_0xace1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index cef3fbd..669da0b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x53139d,_0x56798e){var _0x36269f=function(_0x22ad40){while(--_0x22ad40){_0x53139d['push'](_0x53139d['shift']());}};_0x36269f(++_0x56798e);}(_0xabce,0x103));var _0xeabc=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xabce[_0x494d1f];return _0x457b6e;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x54153c,_0x1cd98e){var _0xef091d=function(_0x1cd67e){while(--_0x1cd67e){_0x54153c['push'](_0x54153c['shift']());}};_0xef091d(++_0x1cd98e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d8dacef..e2c941e 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','/:id/messages','create','update','destroy','exports','util'];(function(_0x123552,_0xcdb7cf){var _0x3a3ba1=function(_0x607f49){while(--_0x607f49){_0x123552['push'](_0x123552['shift']());}};_0x3a3ba1(++_0xcdb7cf);}(_0x6d38,0x1ef));var _0x86d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d38[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['getMessages']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xa'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x7ee1=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','create','/:id','update','delete','exports','multer','express','Router'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2947e5,_0x29d87e){_0x2947e5=_0x2947e5-0x0;var _0x2d3298=_0x7ee1[_0x2947e5];return _0x2d3298;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var fs_extra=require(_0x17ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var controller=require(_0x17ee('0x6'));router[_0x17ee('0x7')]('/',auth['isAuthenticated'](),controller[_0x17ee('0x8')]);router[_0x17ee('0x7')]('/:id',auth[_0x17ee('0x9')](),controller['show']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x17ee('0xb')]);router['put'](_0x17ee('0xc'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')]('/:id',auth[_0x17ee('0x9')](),controller['destroy']);module[_0x17ee('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 8c2ceb6..56611b8 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 _0xee1b=['contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING'];(function(_0x32d066,_0x462c0b){var _0x2f0980=function(_0xc51162){while(--_0xc51162){_0x32d066['push'](_0x32d066['shift']());}};_0x2f0980(++_0x462c0b);}(_0xee1b,0x9e));var _0xbee1=function(_0xae9df0,_0x56fd45){_0xae9df0=_0xae9df0-0x0;var _0x5f06df=_0xee1b[_0xae9df0];return _0x5f06df;};'use strict';var Sequelize=require('sequelize');module[_0xbee1('0x0')]={'customer_id':{'type':Sequelize[_0xbee1('0x1')]},'context':{'type':Sequelize[_0xbee1('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xbee1('0x1')],'defaultValue':'','allowNull':![],'unique':_0xbee1('0x2')},'password':{'type':Sequelize[_0xbee1('0x1')]},'fullname':{'type':Sequelize[_0xbee1('0x1')]},'email':{'type':Sequelize[_0xbee1('0x1')],'validate':{'isEmail':!![]},'set':function(_0x35186a){this[_0xbee1('0x3')](_0xbee1('0x4'),typeof _0x35186a===_0xbee1('0x5')&&_0x35186a[_0xbee1('0x6')]()?_0x35186a[_0xbee1('0x6')]():null);}},'pager':{'type':Sequelize[_0xbee1('0x1')]},'tz':{'type':Sequelize[_0xbee1('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xbee1('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xbee1('0x7')](_0xbee1('0x8'),'no'),'defaultValue':_0xbee1('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xbee1('0x1')]},'callback':{'type':Sequelize[_0xbee1('0x1')]},'review':{'type':Sequelize['ENUM'](_0xbee1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xbee1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xbee1('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xbee1('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xbee1('0x7')](_0xbee1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xbee1('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xbee1('0x7')](_0xbee1('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xbee1('0x7')](_0xbee1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xbee1('0x7')](_0xbee1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xbee1('0x7')]('yes','no'),'defaultValue':_0xbee1('0x8'),'allowNull':![]},'stamp':{'type':_0xbee1('0xa')},'emailsubject':{'type':Sequelize[_0xbee1('0x1')]},'emailbody':{'type':Sequelize[_0xbee1('0x1')]},'maxsecs':{'type':Sequelize[_0xbee1('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbee1('0xc')](_0xbee1('0xd'))+_0xbee1('0xe')+this[_0xbee1('0xc')](_0xbee1('0xf'));}}}; \ No newline at end of file +var _0xe190=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xe190,0xa8));var _0x0e19=function(_0x66d6cf,_0x446cdd){_0x66d6cf=_0x66d6cf-0x0;var _0x54d0c8=_0xe190[_0x66d6cf];return _0x54d0c8;};'use strict';var Sequelize=require('sequelize');module[_0x0e19('0x0')]={'customer_id':{'type':Sequelize[_0x0e19('0x1')]},'context':{'type':Sequelize[_0x0e19('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x0e19('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0e19('0x2')},'password':{'type':Sequelize[_0x0e19('0x1')]},'fullname':{'type':Sequelize[_0x0e19('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3513ac){this[_0x0e19('0x3')](_0x0e19('0x4'),typeof _0x3513ac===_0x0e19('0x5')&&_0x3513ac[_0x0e19('0x6')]()?_0x3513ac['trim']():null);}},'pager':{'type':Sequelize[_0x0e19('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x0e19('0x7')},'attach':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':_0x0e19('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':_0x0e19('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0e19('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0e19('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0e19('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0e19('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0e19('0x8')]('yes','no'),'defaultValue':_0x0e19('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0e19('0x8')](_0x0e19('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0e19('0x8')]('yes','no'),'defaultValue':_0x0e19('0x9'),'allowNull':![]},'stamp':{'type':_0x0e19('0xb')},'emailsubject':{'type':Sequelize[_0x0e19('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x0e19('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0e19('0xd')],'get':function(){return this[_0x0e19('0xe')](_0x0e19('0xf'))+_0x0e19('0x10')+this[_0x0e19('0xe')](_0x0e19('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e6406ca..513e056 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 _0xeb74=['VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','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','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','map'];(function(_0x4ec991,_0x20094e){var _0x42dde8=function(_0xdcba8){while(--_0xdcba8){_0x4ec991['push'](_0x4ec991['shift']());}};_0x42dde8(++_0x20094e);}(_0xeb74,0xe3));var _0x4eb7=function(_0x458a50,_0xa2075e){_0x458a50=_0x458a50-0x0;var _0x56c2ae=_0xeb74[_0x458a50];return _0x56c2ae;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':!![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['VoiceMail'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['update']=function(_0x4e3163,_0x2e5d28){if(_0x4e3163['body']['id']){delete _0x4e3163[_0x4eb7('0x55')]['id'];}return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](saveUpdates(_0x4e3163[_0x4eb7('0x55')],null))[_0x4eb7('0x25')](respondWithResult(_0x2e5d28,null))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports['destroy']=function(_0x961de5,_0x340ffb){return db['VoiceMail'][_0x4eb7('0x4c')]({'where':{'id':_0x961de5[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x340ffb,null))[_0x4eb7('0x25')](removeEntity(_0x340ffb,null))['catch'](handleError(_0x340ffb,null));};exports[_0x4eb7('0x56')]=function(_0x5be4ad,_0x13847e,_0x456fe7){return db[_0x4eb7('0x31')][_0x4eb7('0x57')]({'where':{'id':_0x5be4ad[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x13847e,null))['then'](function(_0x4a4fc5){var _0x1b8514;var _0x1b4afe={},_0x24d33d={};_0x24d33d[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x58')][_0x4eb7('0x32')]);_0x24d33d['query']=_[_0x4eb7('0x37')](_0x5be4ad[_0x4eb7('0x36')]);_0x24d33d[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x24d33d[_0x4eb7('0x35')],_0x24d33d[_0x4eb7('0x36')]);_0x1b4afe[_0x4eb7('0x39')]=_['intersection'](_0x24d33d['model'],qs[_0x4eb7('0x3b')](_0x5be4ad['query'][_0x4eb7('0x3b')]));_0x1b4afe['attributes']=_0x1b4afe[_0x4eb7('0x39')]['length']?_0x1b4afe['attributes']:_0x24d33d[_0x4eb7('0x35')];if(!_0x5be4ad[_0x4eb7('0x36')]['hasOwnProperty'](_0x4eb7('0x59'))){_0x1b4afe['limit']=qs[_0x4eb7('0x1d')](_0x5be4ad[_0x4eb7('0x36')]['limit']);_0x1b4afe[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5be4ad['query']['offset']);}_0x1b4afe['order']=qs['sort'](_0x5be4ad[_0x4eb7('0x36')]['sort']);_0x1b4afe[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x5be4ad[_0x4eb7('0x36')],_0x24d33d[_0x4eb7('0x38')]));if(_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1b4afe[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1b4afe['where'],{'$or':_['map'](_0x1b4afe['attributes'],function(_0x58d2c1){var _0x1775c4={};_0x1775c4[_0x58d2c1]={'$like':'%'+_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x1775c4;})});}_0x1b4afe[_0x4eb7('0x3f')]=_['merge'](_0x1b4afe['where'],{'mailboxuser':_0x4a4fc5[_0x4eb7('0x5a')]});_0x1b4afe=_[_0x4eb7('0x42')]({},_0x1b4afe,_0x5be4ad[_0x4eb7('0x45')]);return db[_0x4eb7('0x58')][_0x4eb7('0x5b')](_0x1b4afe)['then'](respondWithFilteredResult(_0x13847e,_0x1b4afe));})[_0x4eb7('0x49')](handleError(_0x13847e,null));}; \ No newline at end of file +var _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','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','get','Voicemails','sendStatus'];(function(_0x59c40f,_0x4a47ab){var _0x23dbc6=function(_0x27f1c2){while(--_0x27f1c2){_0x59c40f['push'](_0x59c40f['shift']());}};_0x23dbc6(++_0x4a47ab);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'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(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a910f2f..22069c7 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 _0xc041=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./voiceMail.attributes','define','voice_voicemail','mailbox_context','context'];(function(_0x585481,_0x16e775){var _0x2ac3b7=function(_0x41551d){while(--_0x41551d){_0x585481['push'](_0x585481['shift']());}};_0x2ac3b7(++_0x16e775);}(_0xc041,0xfc));var _0x1c04=function(_0x4247e5,_0x30b7bb){_0x4247e5=_0x4247e5-0x0;var _0x5ee3d5=_0xc041[_0x4247e5];return _0x5ee3d5;};'use strict';var _=require('lodash');var util=require(_0x1c04('0x0'));var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var moment=require(_0x1c04('0x3'));var BPromise=require(_0x1c04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c04('0x5'));var rimraf=require('rimraf');var config=require(_0x1c04('0x6'));var attributes=require(_0x1c04('0x7'));module['exports']=function(_0x547855,_0x3c20ea){return _0x547855[_0x1c04('0x8')]('VoiceMail',attributes,{'tableName':_0x1c04('0x9'),'paranoid':![],'indexes':[{'name':_0x1c04('0xa'),'fields':['mailbox',_0x1c04('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43aa=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash'];(function(_0x642fc4,_0x198133){var _0x31e5f8=function(_0x4e9219){while(--_0x4e9219){_0x642fc4['push'](_0x642fc4['shift']());}};_0x31e5f8(++_0x198133);}(_0x43aa,0x1cf));var _0xa43a=function(_0x5ee709,_0x163fbb){_0x5ee709=_0x5ee709-0x0;var _0x38dea3=_0x43aa[_0x5ee709];return _0x38dea3;};'use strict';var _=require(_0xa43a('0x0'));var util=require('util');var logger=require(_0xa43a('0x1'))(_0xa43a('0x2'));var moment=require(_0xa43a('0x3'));var BPromise=require(_0xa43a('0x4'));var rp=require(_0xa43a('0x5'));var fs=require('fs');var path=require(_0xa43a('0x6'));var rimraf=require(_0xa43a('0x7'));var config=require(_0xa43a('0x8'));var attributes=require(_0xa43a('0x9'));module[_0xa43a('0xa')]=function(_0xee461f,_0x2f9ba1){return _0xee461f[_0xa43a('0xb')](_0xa43a('0xc'),attributes,{'tableName':_0xa43a('0xd'),'paranoid':![],'indexes':[{'name':_0xa43a('0xe'),'fields':[_0xa43a('0xf'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f696f15..9c4812d 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 _0x285e=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceMail,\x20%s,\x20%s'];(function(_0x55954d,_0x343981){var _0xa8182=function(_0x4ec942){while(--_0x4ec942){_0x55954d['push'](_0x55954d['shift']());}};_0xa8182(++_0x343981);}(_0x285e,0x1a6));var _0xe285=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x285e[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0xe285('0x0'));var util=require(_0xe285('0x1'));var moment=require(_0xe285('0x2'));var BPromise=require(_0xe285('0x3'));var rs=require(_0xe285('0x4'));var fs=require('fs');var Redis=require(_0xe285('0x5'));var db=require(_0xe285('0x6'))['db'];var utils=require(_0xe285('0x7'));var logger=require(_0xe285('0x8'))(_0xe285('0x9'));var config=require(_0xe285('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe285('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d52fd,_0x4143ef,_0x1c72dc){return new BPromise(function(_0x13e86a,_0xddaf7){return client[_0xe285('0xc')](_0x2d52fd,_0x1c72dc)['then'](function(_0xcb15c){logger[_0xe285('0xd')](_0xe285('0xe'),_0x4143ef,_0xe285('0xf'));logger['debug'](_0xe285('0x10'),_0x4143ef,_0xe285('0xf'),JSON[_0xe285('0x11')](_0xcb15c));if(_0xcb15c[_0xe285('0x12')]){if(_0xcb15c[_0xe285('0x12')][_0xe285('0x13')]===0x1f4){logger['error'](_0xe285('0xe'),_0x4143ef,_0xcb15c[_0xe285('0x12')][_0xe285('0x14')]);return _0xddaf7(_0xcb15c[_0xe285('0x12')][_0xe285('0x14')]);}logger[_0xe285('0x12')]('VoiceMail,\x20%s,\x20%s',_0x4143ef,_0xcb15c['error'][_0xe285('0x14')]);return _0x13e86a(_0xcb15c[_0xe285('0x12')][_0xe285('0x14')]);}else{logger[_0xe285('0xd')](_0xe285('0xe'),_0x4143ef,_0xe285('0xf'));_0x13e86a(_0xcb15c[_0xe285('0x15')]['message']);}})[_0xe285('0x16')](function(_0x99e53d){logger[_0xe285('0x12')](_0xe285('0xe'),_0x4143ef,_0x99e53d);_0xddaf7(_0x99e53d);});});} \ No newline at end of file +var _0xf316=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf316,0x1b9));var _0x6f31=function(_0x474c54,_0x3e1715){_0x474c54=_0x474c54-0x0;var _0x417d4b=_0xf316[_0x474c54];return _0x417d4b;};'use strict';var _=require(_0x6f31('0x0'));var util=require(_0x6f31('0x1'));var moment=require(_0x6f31('0x2'));var BPromise=require(_0x6f31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f31('0x4'));var db=require(_0x6f31('0x5'))['db'];var utils=require(_0x6f31('0x6'));var logger=require('../../config/logger')(_0x6f31('0x7'));var config=require(_0x6f31('0x8'));var jayson=require(_0x6f31('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3bd0d3,_0x160c71,_0x2cddd0){return new BPromise(function(_0x2bc932,_0x340887){return client[_0x6f31('0xa')](_0x3bd0d3,_0x2cddd0)[_0x6f31('0xb')](function(_0x1dc89d){logger[_0x6f31('0xc')](_0x6f31('0xd'),_0x160c71,_0x6f31('0xe'));logger[_0x6f31('0xf')](_0x6f31('0x10'),_0x160c71,_0x6f31('0xe'),JSON['stringify'](_0x1dc89d));if(_0x1dc89d[_0x6f31('0x11')]){if(_0x1dc89d['error']['code']===0x1f4){logger[_0x6f31('0x11')](_0x6f31('0xd'),_0x160c71,_0x1dc89d[_0x6f31('0x11')]['message']);return _0x340887(_0x1dc89d[_0x6f31('0x11')][_0x6f31('0x12')]);}logger[_0x6f31('0x11')](_0x6f31('0xd'),_0x160c71,_0x1dc89d[_0x6f31('0x11')][_0x6f31('0x12')]);return _0x2bc932(_0x1dc89d[_0x6f31('0x11')][_0x6f31('0x12')]);}else{logger[_0x6f31('0xc')](_0x6f31('0xd'),_0x160c71,'request\x20sent');_0x2bc932(_0x1dc89d['result'][_0x6f31('0x12')]);}})[_0x6f31('0x13')](function(_0x47b0d2){logger[_0x6f31('0x11')](_0x6f31('0xd'),_0x160c71,_0x47b0d2);_0x340887(_0x47b0d2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e531f5a..9b9263f 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 _0x39ed=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','create','put','update','delete','/:id','exports','util','path','connect-timeout','express'];(function(_0x353736,_0x152ce8){var _0x585b29=function(_0x270d2c){while(--_0x270d2c){_0x353736['push'](_0x353736['shift']());}};_0x585b29(++_0x152ce8);}(_0x39ed,0x106));var _0xd39e=function(_0x4a4858,_0x432a9c){_0x4a4858=_0x4a4858-0x0;var _0x4f0ea9=_0x39ed[_0x4a4858];return _0x4f0ea9;};'use strict';var multer=require('multer');var util=require(_0xd39e('0x0'));var path=require(_0xd39e('0x1'));var timeout=require(_0xd39e('0x2'));var express=require(_0xd39e('0x3'));var router=express['Router']();var fs_extra=require(_0xd39e('0x4'));var auth=require(_0xd39e('0x5'));var interaction=require(_0xd39e('0x6'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xd39e('0x7')]('/',auth[_0xd39e('0x8')](),controller[_0xd39e('0x9')]);router['get']('/:id',auth[_0xd39e('0x8')](),controller[_0xd39e('0xa')]);router[_0xd39e('0x7')](_0xd39e('0xb'),auth[_0xd39e('0x8')](),controller[_0xd39e('0xc')]);router['post']('/',auth[_0xd39e('0x8')](),controller[_0xd39e('0xd')]);router[_0xd39e('0xe')]('/:id',auth[_0xd39e('0x8')](),controller[_0xd39e('0xf')]);router[_0xd39e('0x10')](_0xd39e('0x11'),auth[_0xd39e('0x8')](),controller['destroy']);module[_0xd39e('0x12')]=router; \ No newline at end of file +var _0xba20=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba20,0x8e));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ba2('0x0'));var util=require(_0x0ba2('0x1'));var path=require(_0x0ba2('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ba2('0x3'));var router=express[_0x0ba2('0x4')]();var fs_extra=require(_0x0ba2('0x5'));var auth=require(_0x0ba2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ba2('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x0ba2('0x8')]('/',auth[_0x0ba2('0x9')](),controller[_0x0ba2('0xa')]);router[_0x0ba2('0x8')](_0x0ba2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0ba2('0x8')](_0x0ba2('0xc'),auth[_0x0ba2('0x9')](),controller[_0x0ba2('0xd')]);router[_0x0ba2('0xe')]('/',auth[_0x0ba2('0x9')](),controller[_0x0ba2('0xf')]);router[_0x0ba2('0x10')](_0x0ba2('0xb'),auth[_0x0ba2('0x9')](),controller['update']);router[_0x0ba2('0x11')](_0x0ba2('0xb'),auth['isAuthenticated'](),controller[_0x0ba2('0x12')]);module[_0x0ba2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5aead85..352b3a6 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 _0x84f6=['getDataValue','INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0xbef779,_0x727677){var _0x1b10fb=function(_0x92f7fc){while(--_0x92f7fc){_0xbef779['push'](_0xbef779['shift']());}};_0x1b10fb(++_0x727677);}(_0x84f6,0x1db));var _0x684f=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x84f6[_0x334651];return _0x29657c;};'use strict';var Sequelize=require(_0x684f('0x0'));module['exports']={'name':{'type':Sequelize[_0x684f('0x1')],'get':function(_0x20c9f5){return this[_0x684f('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x684f('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x684f('0x5')](_0x684f('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x684f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x684f('0x7')](_0x684f('0x8'))}}; \ No newline at end of file +var _0xb31f=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER'];(function(_0x2e4f61,_0x3541ce){var _0x5e6c07=function(_0x4790bb){while(--_0x4790bb){_0x2e4f61['push'](_0x2e4f61['shift']());}};_0x5e6c07(++_0x3541ce);}(_0xb31f,0xa8));var _0xfb31=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xb31f[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0xfb31('0x0'));module[_0xfb31('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd76293){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xfb31('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xfb31('0x4')](_0xfb31('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfb31('0x3')],'defaultValue':''},'stamp':{'type':_0xfb31('0x6'),'defaultValue':Sequelize[_0xfb31('0x7')](_0xfb31('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e6e9b9d..3a160d6 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 _0xef12=['options','find','create','body','download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','fieldName','type','differenceBy','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','includeAll','include','findAll','catch','params','rawAttributes'];(function(_0x31e97e,_0x30ef0e){var _0x3a48e8=function(_0x6ecf6a){while(--_0x6ecf6a){_0x31e97e['push'](_0x31e97e['shift']());}};_0x3a48e8(++_0x30ef0e);}(_0xef12,0x145));var _0x2ef1=function(_0x4b8391,_0x425742){_0x4b8391=_0x4b8391-0x0;var _0x15a79d=_0xef12[_0x4b8391];return _0x15a79d;};'use strict';var emlformat=require(_0x2ef1('0x0'));var rimraf=require(_0x2ef1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ef1('0x2'));var rp=require('request-promise');var moment=require(_0x2ef1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2ef1('0x4'));var util=require(_0x2ef1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2ef1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ef1('0x7'));var jsforce=require(_0x2ef1('0x8'));var deskjs=require(_0x2ef1('0x9'));var toCsv=require(_0x2ef1('0x6'));var querystring=require(_0x2ef1('0xa'));var Papa=require(_0x2ef1('0xb'));var Redis=require('ioredis');var authService=require(_0x2ef1('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef1('0xd'));var hardwareService=require(_0x2ef1('0xe'));var logger=require(_0x2ef1('0xf'))(_0x2ef1('0x10'));var utils=require(_0x2ef1('0x11'));var config=require(_0x2ef1('0x12'));var licenseUtil=require(_0x2ef1('0x13'));var db=require(_0x2ef1('0x14'))['db'];function respondWithStatusCode(_0x7a2637,_0x303efc){_0x303efc=_0x303efc||0xcc;return function(_0x2409b6){if(_0x2409b6){return _0x7a2637[_0x2ef1('0x15')](_0x303efc);}return _0x7a2637[_0x2ef1('0x16')](_0x303efc)[_0x2ef1('0x17')]();};}function respondWithResult(_0xfa5490,_0x58acd9){_0x58acd9=_0x58acd9||0xc8;return function(_0x1eec0f){if(_0x1eec0f){return _0xfa5490[_0x2ef1('0x16')](_0x58acd9)[_0x2ef1('0x18')](_0x1eec0f);}};}function respondWithFilteredResult(_0x44d0c4,_0x25fea5){return function(_0x342cff){if(_0x342cff){var _0x5a5ce8=typeof _0x25fea5[_0x2ef1('0x19')]===_0x2ef1('0x1a')&&typeof _0x25fea5['limit']===_0x2ef1('0x1a');var _0x2b14ab=_0x342cff[_0x2ef1('0x1b')];var _0x7ec9e9=_0x5a5ce8?0x0:_0x25fea5[_0x2ef1('0x19')];var _0x3e48c7=_0x5a5ce8?_0x342cff[_0x2ef1('0x1b')]:_0x25fea5[_0x2ef1('0x19')]+_0x25fea5['limit'];var _0x4011b5;if(_0x3e48c7>=_0x2b14ab){_0x3e48c7=_0x2b14ab;_0x4011b5=0xc8;}else{_0x4011b5=0xce;}_0x44d0c4['status'](_0x4011b5);return _0x44d0c4[_0x2ef1('0x1c')](_0x2ef1('0x1d'),_0x7ec9e9+'-'+_0x3e48c7+'/'+_0x2b14ab)[_0x2ef1('0x18')](_0x342cff);}return null;};}function patchUpdates(_0x7fcfa){return function(_0xe92700){try{jsonpatch[_0x2ef1('0x1e')](_0xe92700,_0x7fcfa,!![]);}catch(_0x18d574){return BPromise[_0x2ef1('0x1f')](_0x18d574);}return _0xe92700['save']();};}function saveUpdates(_0x23ddad,_0x17817c){return function(_0x358b93){if(_0x358b93){return _0x358b93[_0x2ef1('0x20')](_0x23ddad)[_0x2ef1('0x21')](function(_0x51f30d){return _0x51f30d;});}return null;};}function removeEntity(_0x66e96c,_0x20c739){return function(_0x8de95){if(_0x8de95){return _0x8de95[_0x2ef1('0x22')]()[_0x2ef1('0x21')](function(){_0x66e96c[_0x2ef1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1eb0,_0x171af6){return function(_0x4b8818){if(!_0x4b8818){_0x2d1eb0['sendStatus'](0x194);}return _0x4b8818;};}function handleError(_0x2bec43,_0xc589f9){_0xc589f9=_0xc589f9||0x1f4;return function(_0x5869ed){logger['error'](_0x5869ed['stack']);if(_0x5869ed[_0x2ef1('0x23')]){delete _0x5869ed[_0x2ef1('0x23')];}_0x2bec43['status'](_0xc589f9)[_0x2ef1('0x24')](_0x5869ed);};}exports[_0x2ef1('0x25')]=function(_0x286cb0,_0x2a1c2a){var _0x34fa16={},_0x1c36fc={},_0x3687c1={'count':0x0,'rows':[]};var _0x5ad4c1=_[_0x2ef1('0x26')](db['VoiceMailMessage']['rawAttributes'],function(_0x9309f6){return{'name':_0x9309f6[_0x2ef1('0x27')],'type':_0x9309f6[_0x2ef1('0x28')]['key']};});_0x1c36fc['model']=_[_0x2ef1('0x29')](_[_0x2ef1('0x26')](_0x5ad4c1,_0x2ef1('0x23')),[_0x2ef1('0x23')]);_0x1c36fc[_0x2ef1('0x2a')]=_[_0x2ef1('0x2b')](_0x286cb0[_0x2ef1('0x2a')]);_0x1c36fc[_0x2ef1('0x2c')]=_[_0x2ef1('0x2d')](_0x1c36fc[_0x2ef1('0x2e')],_0x1c36fc['query']);_0x34fa16['attributes']=_[_0x2ef1('0x2d')](_0x1c36fc[_0x2ef1('0x2e')],qs[_0x2ef1('0x2f')](_0x286cb0['query'][_0x2ef1('0x2f')]));_0x34fa16[_0x2ef1('0x30')]=_0x34fa16['attributes'][_0x2ef1('0x31')]?_0x34fa16[_0x2ef1('0x30')]:_0x1c36fc[_0x2ef1('0x2e')];if(!_0x286cb0[_0x2ef1('0x2a')]['hasOwnProperty']('nolimit')){_0x34fa16[_0x2ef1('0x32')]=qs[_0x2ef1('0x32')](_0x286cb0[_0x2ef1('0x2a')][_0x2ef1('0x32')]);_0x34fa16[_0x2ef1('0x19')]=qs['offset'](_0x286cb0[_0x2ef1('0x2a')][_0x2ef1('0x19')]);}_0x34fa16[_0x2ef1('0x33')]=qs[_0x2ef1('0x34')](_0x286cb0[_0x2ef1('0x2a')]['sort']);_0x34fa16[_0x2ef1('0x35')]=qs[_0x2ef1('0x2c')](_[_0x2ef1('0x36')](_0x286cb0[_0x2ef1('0x2a')],_0x1c36fc[_0x2ef1('0x2c')]),_0x5ad4c1);if(_0x286cb0[_0x2ef1('0x2a')][_0x2ef1('0x37')]){_0x34fa16[_0x2ef1('0x35')]=_[_0x2ef1('0x38')](_0x34fa16[_0x2ef1('0x35')],{'$or':_[_0x2ef1('0x26')](_0x5ad4c1,function(_0x1d1cc3){if(_0x1d1cc3[_0x2ef1('0x28')]!==_0x2ef1('0x39')){var _0x3d7eda={};_0x3d7eda[_0x1d1cc3['name']]={'$like':'%'+_0x286cb0['query']['filter']+'%'};return _0x3d7eda;}})});}_0x34fa16=_['merge']({},_0x34fa16,_0x286cb0['options']);var _0x442889={'where':_0x34fa16[_0x2ef1('0x35')]};return db[_0x2ef1('0x3a')][_0x2ef1('0x1b')](_0x442889)['then'](function(_0x48704f){_0x3687c1['count']=_0x48704f;if(_0x286cb0[_0x2ef1('0x2a')][_0x2ef1('0x3b')]){_0x34fa16[_0x2ef1('0x3c')]=[{'all':!![]}];}return db[_0x2ef1('0x3a')][_0x2ef1('0x3d')](_0x34fa16);})[_0x2ef1('0x21')](function(_0x596d6c){_0x3687c1['rows']=_0x596d6c;return _0x3687c1;})[_0x2ef1('0x21')](respondWithFilteredResult(_0x2a1c2a,_0x34fa16))[_0x2ef1('0x3e')](handleError(_0x2a1c2a,null));};exports['show']=function(_0x18c156,_0x855880){var _0x5bf9ce={'raw':!![],'where':{'id':_0x18c156[_0x2ef1('0x3f')]['id']}},_0x1607a7={};_0x1607a7['model']=_['keys'](db['VoiceMailMessage'][_0x2ef1('0x40')]);_0x1607a7[_0x2ef1('0x2a')]=_['keys'](_0x18c156[_0x2ef1('0x2a')]);_0x1607a7[_0x2ef1('0x2c')]=_[_0x2ef1('0x2d')](_0x1607a7[_0x2ef1('0x2e')],_0x1607a7[_0x2ef1('0x2a')]);_0x5bf9ce[_0x2ef1('0x30')]=_[_0x2ef1('0x2d')](_0x1607a7[_0x2ef1('0x2e')],qs['fields'](_0x18c156[_0x2ef1('0x2a')]['fields']));_0x5bf9ce[_0x2ef1('0x30')]=_0x5bf9ce[_0x2ef1('0x30')]['length']?_0x5bf9ce[_0x2ef1('0x30')]:_0x1607a7[_0x2ef1('0x2e')];if(_0x18c156[_0x2ef1('0x2a')]['includeAll']){_0x5bf9ce[_0x2ef1('0x3c')]=[{'all':!![]}];}_0x5bf9ce=_[_0x2ef1('0x38')]({},_0x5bf9ce,_0x18c156[_0x2ef1('0x41')]);return db[_0x2ef1('0x3a')][_0x2ef1('0x42')](_0x5bf9ce)[_0x2ef1('0x21')](handleEntityNotFound(_0x855880,null))[_0x2ef1('0x21')](respondWithResult(_0x855880,null))[_0x2ef1('0x3e')](handleError(_0x855880,null));};exports[_0x2ef1('0x43')]=function(_0x2e0018,_0x298c92){return db['VoiceMailMessage'][_0x2ef1('0x43')](_0x2e0018[_0x2ef1('0x44')],{})['then'](respondWithResult(_0x298c92,0xc9))[_0x2ef1('0x3e')](handleError(_0x298c92,null));};exports[_0x2ef1('0x20')]=function(_0x185418,_0x10901c){if(_0x185418[_0x2ef1('0x44')]['id']){delete _0x185418[_0x2ef1('0x44')]['id'];}return db[_0x2ef1('0x3a')][_0x2ef1('0x42')]({'where':{'id':_0x185418['params']['id']}})[_0x2ef1('0x21')](handleEntityNotFound(_0x10901c,null))['then'](saveUpdates(_0x185418[_0x2ef1('0x44')],null))[_0x2ef1('0x21')](respondWithResult(_0x10901c,null))['catch'](handleError(_0x10901c,null));};exports[_0x2ef1('0x22')]=function(_0x425054,_0x52657a){return db[_0x2ef1('0x3a')][_0x2ef1('0x42')]({'where':{'id':_0x425054[_0x2ef1('0x3f')]['id']}})[_0x2ef1('0x21')](handleEntityNotFound(_0x52657a,null))['then'](removeEntity(_0x52657a,null))[_0x2ef1('0x3e')](handleError(_0x52657a,null));};exports[_0x2ef1('0x45')]=function(_0xdc5aa0,_0x5e4494,_0xa708ec){return db[_0x2ef1('0x3a')][_0x2ef1('0x42')]({'where':{'id':_0xdc5aa0[_0x2ef1('0x3f')]['id']},'attributes':['id',_0x2ef1('0x46'),'msg_id']})[_0x2ef1('0x21')](handleEntityNotFound(_0x5e4494,null))[_0x2ef1('0x21')](function(_0x19fe81){if(_0x19fe81){if(!_0x19fe81['recording']){throw new db[(_0x2ef1('0x47'))][(_0x2ef1('0x48'))]('VoiceMailMessage\x20not\x20found');}var _0x5e02e3={'Content-Type':_0x2ef1('0x49'),'Content-Disposition':_0x2ef1('0x4a')};if(_0x19fe81[_0x2ef1('0x4b')]){_0x5e02e3['Content-Disposition']=_0x2ef1('0x4c')+_0x19fe81[_0x2ef1('0x4b')]+_0x2ef1('0x4d');}_0x5e4494[_0x2ef1('0x1c')](_0x5e02e3);return _0x5e4494[_0x2ef1('0x24')](new Buffer(_0x19fe81[_0x2ef1('0x46')]));}})[_0x2ef1('0x3e')](handleError(_0x5e4494,null));}; \ No newline at end of file +var _0x587d=['fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','keys','fields','include','options','find','create','body','msg_id','recording','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x587d,0x134));var _0xd587=function(_0x15c5e7,_0x4fee7b){_0x15c5e7=_0x15c5e7-0x0;var _0x1d2dc9=_0x587d[_0x15c5e7];return _0x1d2dc9;};'use strict';var emlformat=require(_0xd587('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd587('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd587('0x2'));var moment=require(_0xd587('0x3'));var BPromise=require(_0xd587('0x4'));var Mustache=require('mustache');var util=require(_0xd587('0x5'));var path=require(_0xd587('0x6'));var sox=require(_0xd587('0x7'));var csv=require(_0xd587('0x8'));var ejs=require(_0xd587('0x9'));var fs=require('fs');var fs_extra=require(_0xd587('0xa'));var _=require(_0xd587('0xb'));var squel=require('squel');var crypto=require(_0xd587('0xc'));var jsforce=require(_0xd587('0xd'));var deskjs=require(_0xd587('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd587('0xf'));var Papa=require(_0xd587('0x10'));var Redis=require(_0xd587('0x11'));var authService=require(_0xd587('0x12'));var qs=require(_0xd587('0x13'));var as=require(_0xd587('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd587('0x15'))(_0xd587('0x16'));var utils=require(_0xd587('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd587('0x18'))['db'];function respondWithStatusCode(_0x3b218e,_0x595443){_0x595443=_0x595443||0xcc;return function(_0x8a2a07){if(_0x8a2a07){return _0x3b218e[_0xd587('0x19')](_0x595443);}return _0x3b218e[_0xd587('0x1a')](_0x595443)[_0xd587('0x1b')]();};}function respondWithResult(_0x26f4aa,_0x1ac592){_0x1ac592=_0x1ac592||0xc8;return function(_0x2d90e0){if(_0x2d90e0){return _0x26f4aa['status'](_0x1ac592)['json'](_0x2d90e0);}};}function respondWithFilteredResult(_0x28ff01,_0x15b7ff){return function(_0x4f3380){if(_0x4f3380){var _0x220e47=typeof _0x15b7ff['offset']==='undefined'&&typeof _0x15b7ff[_0xd587('0x1c')]===_0xd587('0x1d');var _0x2b2dc7=_0x4f3380[_0xd587('0x1e')];var _0x3f661d=_0x220e47?0x0:_0x15b7ff[_0xd587('0x1f')];var _0x49497f=_0x220e47?_0x4f3380[_0xd587('0x1e')]:_0x15b7ff[_0xd587('0x1f')]+_0x15b7ff['limit'];var _0x4f5a6e;if(_0x49497f>=_0x2b2dc7){_0x49497f=_0x2b2dc7;_0x4f5a6e=0xc8;}else{_0x4f5a6e=0xce;}_0x28ff01[_0xd587('0x1a')](_0x4f5a6e);return _0x28ff01[_0xd587('0x20')](_0xd587('0x21'),_0x3f661d+'-'+_0x49497f+'/'+_0x2b2dc7)[_0xd587('0x22')](_0x4f3380);}return null;};}function patchUpdates(_0x272367){return function(_0x22b934){try{jsonpatch[_0xd587('0x23')](_0x22b934,_0x272367,!![]);}catch(_0x4fbdb7){return BPromise[_0xd587('0x24')](_0x4fbdb7);}return _0x22b934[_0xd587('0x25')]();};}function saveUpdates(_0x3d8c67,_0x285c31){return function(_0x514dde){if(_0x514dde){return _0x514dde[_0xd587('0x26')](_0x3d8c67)['then'](function(_0x3d6e7c){return _0x3d6e7c;});}return null;};}function removeEntity(_0x24c124,_0x4f8992){return function(_0x10e186){if(_0x10e186){return _0x10e186[_0xd587('0x27')]()['then'](function(){_0x24c124[_0xd587('0x1a')](0xcc)[_0xd587('0x1b')]();});}};}function handleEntityNotFound(_0x5dbf45,_0x23a815){return function(_0x582779){if(!_0x582779){_0x5dbf45[_0xd587('0x19')](0x194);}return _0x582779;};}function handleError(_0x3f0475,_0x806703){_0x806703=_0x806703||0x1f4;return function(_0x146d8f){logger[_0xd587('0x28')](_0x146d8f[_0xd587('0x29')]);if(_0x146d8f['name']){delete _0x146d8f[_0xd587('0x2a')];}_0x3f0475[_0xd587('0x1a')](_0x806703)[_0xd587('0x2b')](_0x146d8f);};}exports[_0xd587('0x2c')]=function(_0x1ad47d,_0x4e44e7){var _0x3e344e={},_0x405976={},_0x18fef9={'count':0x0,'rows':[]};var _0x4bf02b=_[_0xd587('0x2d')](db[_0xd587('0x2e')][_0xd587('0x2f')],function(_0x3b9fc3){return{'name':_0x3b9fc3[_0xd587('0x30')],'type':_0x3b9fc3[_0xd587('0x31')][_0xd587('0x32')]};});_0x405976['model']=_[_0xd587('0x33')](_['map'](_0x4bf02b,_0xd587('0x2a')),[_0xd587('0x2a')]);_0x405976[_0xd587('0x34')]=_['keys'](_0x1ad47d[_0xd587('0x34')]);_0x405976[_0xd587('0x35')]=_[_0xd587('0x36')](_0x405976[_0xd587('0x37')],_0x405976['query']);_0x3e344e[_0xd587('0x38')]=_[_0xd587('0x36')](_0x405976['model'],qs['fields'](_0x1ad47d[_0xd587('0x34')]['fields']));_0x3e344e[_0xd587('0x38')]=_0x3e344e[_0xd587('0x38')][_0xd587('0x39')]?_0x3e344e[_0xd587('0x38')]:_0x405976[_0xd587('0x37')];if(!_0x1ad47d[_0xd587('0x34')]['hasOwnProperty'](_0xd587('0x3a'))){_0x3e344e[_0xd587('0x1c')]=qs[_0xd587('0x1c')](_0x1ad47d[_0xd587('0x34')]['limit']);_0x3e344e[_0xd587('0x1f')]=qs[_0xd587('0x1f')](_0x1ad47d[_0xd587('0x34')][_0xd587('0x1f')]);}_0x3e344e[_0xd587('0x3b')]=qs[_0xd587('0x3c')](_0x1ad47d['query'][_0xd587('0x3c')]);_0x3e344e[_0xd587('0x3d')]=qs[_0xd587('0x35')](_[_0xd587('0x3e')](_0x1ad47d[_0xd587('0x34')],_0x405976[_0xd587('0x35')]),_0x4bf02b);if(_0x1ad47d[_0xd587('0x34')][_0xd587('0x3f')]){_0x3e344e['where']=_[_0xd587('0x40')](_0x3e344e[_0xd587('0x3d')],{'$or':_[_0xd587('0x2d')](_0x4bf02b,function(_0xcd98cc){if(_0xcd98cc[_0xd587('0x31')]!==_0xd587('0x41')){var _0x36723d={};_0x36723d[_0xcd98cc[_0xd587('0x2a')]]={'$like':'%'+_0x1ad47d[_0xd587('0x34')][_0xd587('0x3f')]+'%'};return _0x36723d;}})});}_0x3e344e=_[_0xd587('0x40')]({},_0x3e344e,_0x1ad47d['options']);var _0x402ef6={'where':_0x3e344e['where']};return db['VoiceMailMessage'][_0xd587('0x1e')](_0x402ef6)[_0xd587('0x42')](function(_0x19c766){_0x18fef9[_0xd587('0x1e')]=_0x19c766;if(_0x1ad47d[_0xd587('0x34')][_0xd587('0x43')]){_0x3e344e['include']=[{'all':!![]}];}return db[_0xd587('0x2e')][_0xd587('0x44')](_0x3e344e);})['then'](function(_0x41fd30){_0x18fef9[_0xd587('0x45')]=_0x41fd30;return _0x18fef9;})[_0xd587('0x42')](respondWithFilteredResult(_0x4e44e7,_0x3e344e))[_0xd587('0x46')](handleError(_0x4e44e7,null));};exports[_0xd587('0x47')]=function(_0x3a319a,_0xed3ca9){var _0x5ad65a={'raw':!![],'where':{'id':_0x3a319a[_0xd587('0x48')]['id']}},_0x9f971b={};_0x9f971b[_0xd587('0x37')]=_[_0xd587('0x49')](db[_0xd587('0x2e')][_0xd587('0x2f')]);_0x9f971b['query']=_[_0xd587('0x49')](_0x3a319a['query']);_0x9f971b[_0xd587('0x35')]=_[_0xd587('0x36')](_0x9f971b[_0xd587('0x37')],_0x9f971b['query']);_0x5ad65a[_0xd587('0x38')]=_[_0xd587('0x36')](_0x9f971b['model'],qs[_0xd587('0x4a')](_0x3a319a[_0xd587('0x34')][_0xd587('0x4a')]));_0x5ad65a[_0xd587('0x38')]=_0x5ad65a[_0xd587('0x38')][_0xd587('0x39')]?_0x5ad65a[_0xd587('0x38')]:_0x9f971b[_0xd587('0x37')];if(_0x3a319a[_0xd587('0x34')][_0xd587('0x43')]){_0x5ad65a[_0xd587('0x4b')]=[{'all':!![]}];}_0x5ad65a=_[_0xd587('0x40')]({},_0x5ad65a,_0x3a319a[_0xd587('0x4c')]);return db[_0xd587('0x2e')][_0xd587('0x4d')](_0x5ad65a)['then'](handleEntityNotFound(_0xed3ca9,null))[_0xd587('0x42')](respondWithResult(_0xed3ca9,null))[_0xd587('0x46')](handleError(_0xed3ca9,null));};exports[_0xd587('0x4e')]=function(_0x47e646,_0xb38b8f){return db[_0xd587('0x2e')][_0xd587('0x4e')](_0x47e646[_0xd587('0x4f')],{})[_0xd587('0x42')](respondWithResult(_0xb38b8f,0xc9))[_0xd587('0x46')](handleError(_0xb38b8f,null));};exports['update']=function(_0xfedb6b,_0x674a55){if(_0xfedb6b[_0xd587('0x4f')]['id']){delete _0xfedb6b[_0xd587('0x4f')]['id'];}return db[_0xd587('0x2e')][_0xd587('0x4d')]({'where':{'id':_0xfedb6b[_0xd587('0x48')]['id']}})[_0xd587('0x42')](handleEntityNotFound(_0x674a55,null))[_0xd587('0x42')](saveUpdates(_0xfedb6b['body'],null))[_0xd587('0x42')](respondWithResult(_0x674a55,null))[_0xd587('0x46')](handleError(_0x674a55,null));};exports[_0xd587('0x27')]=function(_0x50ca10,_0x3fc76d){return db[_0xd587('0x2e')][_0xd587('0x4d')]({'where':{'id':_0x50ca10[_0xd587('0x48')]['id']}})[_0xd587('0x42')](handleEntityNotFound(_0x3fc76d,null))[_0xd587('0x42')](removeEntity(_0x3fc76d,null))[_0xd587('0x46')](handleError(_0x3fc76d,null));};exports['download']=function(_0x57451f,_0x20d07e,_0x9dfa24){return db[_0xd587('0x2e')][_0xd587('0x4d')]({'where':{'id':_0x57451f[_0xd587('0x48')]['id']},'attributes':['id','recording',_0xd587('0x50')]})[_0xd587('0x42')](handleEntityNotFound(_0x20d07e,null))[_0xd587('0x42')](function(_0x2a8dde){if(_0x2a8dde){if(!_0x2a8dde[_0xd587('0x51')]){throw new db[(_0xd587('0x52'))][(_0xd587('0x53'))]('VoiceMailMessage\x20not\x20found');}var _0x22d5f9={'Content-Type':_0xd587('0x54'),'Content-Disposition':_0xd587('0x55')};if(_0x2a8dde[_0xd587('0x50')]){_0x22d5f9[_0xd587('0x56')]=_0xd587('0x57')+_0x2a8dde['msg_id']+_0xd587('0x58');}_0x20d07e[_0xd587('0x20')](_0x22d5f9);return _0x20d07e[_0xd587('0x2b')](new Buffer(_0x2a8dde[_0xd587('0x51')]));}})[_0xd587('0x46')](handleError(_0x20d07e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 80244c4..6088ea4 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 _0x08d3=['api','moment','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','lodash','util','../../config/logger'];(function(_0x1762d7,_0xa1c0d7){var _0x40542c=function(_0x464bce){while(--_0x464bce){_0x1762d7['push'](_0x1762d7['shift']());}};_0x40542c(++_0xa1c0d7);}(_0x08d3,0x141));var _0x308d=function(_0x244e2d,_0x302d40){_0x244e2d=_0x244e2d-0x0;var _0x3df084=_0x08d3[_0x244e2d];return _0x3df084;};'use strict';var _=require(_0x308d('0x0'));var util=require(_0x308d('0x1'));var logger=require(_0x308d('0x2'))(_0x308d('0x3'));var moment=require(_0x308d('0x4'));var BPromise=require('bluebird');var rp=require(_0x308d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x308d('0x6'));var config=require(_0x308d('0x7'));var attributes=require(_0x308d('0x8'));module[_0x308d('0x9')]=function(_0x5e1bec,_0x5ed6a3){return _0x5e1bec[_0x308d('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x308d('0xb'),'fields':[_0x308d('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x74d4=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74d4,0x117));var _0x474d=function(_0x227e24,_0x423460){_0x227e24=_0x227e24-0x0;var _0x15acda=_0x74d4[_0x227e24];return _0x15acda;};'use strict';var _=require(_0x474d('0x0'));var util=require(_0x474d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x474d('0x2'));var BPromise=require(_0x474d('0x3'));var rp=require(_0x474d('0x4'));var fs=require('fs');var path=require(_0x474d('0x5'));var rimraf=require(_0x474d('0x6'));var config=require(_0x474d('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x474d('0x8')]=function(_0x36b9e5,_0x224952){return _0x36b9e5['define'](_0x474d('0x9'),attributes,{'tableName':_0x474d('0xa'),'paranoid':![],'indexes':[{'name':_0x474d('0xb'),'fields':[_0x474d('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 382993c..42280d8 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 _0x9db3=['stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5e38be,_0x14e192){var _0xffddb=function(_0xcabff9){while(--_0xcabff9){_0x5e38be['push'](_0x5e38be['shift']());}};_0xffddb(++_0x14e192);}(_0x9db3,0x133));var _0x39db=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9db3[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x39db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x39db('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39db('0x2'));var db=require(_0x39db('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39db('0x4'));var config=require(_0x39db('0x5'));var jayson=require(_0x39db('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f45c1,_0x4f5ce0,_0x2654a){return new BPromise(function(_0x3a8143,_0x193eef){return client[_0x39db('0x7')](_0x1f45c1,_0x2654a)[_0x39db('0x8')](function(_0x2ae24b){logger[_0x39db('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x4f5ce0,_0x39db('0xa'));logger[_0x39db('0xb')](_0x39db('0xc'),_0x4f5ce0,_0x39db('0xa'),JSON[_0x39db('0xd')](_0x2ae24b));if(_0x2ae24b[_0x39db('0xe')]){if(_0x2ae24b[_0x39db('0xe')][_0x39db('0xf')]===0x1f4){logger[_0x39db('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x4f5ce0,_0x2ae24b[_0x39db('0xe')][_0x39db('0x10')]);return _0x193eef(_0x2ae24b[_0x39db('0xe')]['message']);}logger[_0x39db('0xe')](_0x39db('0x11'),_0x4f5ce0,_0x2ae24b[_0x39db('0xe')][_0x39db('0x10')]);return _0x3a8143(_0x2ae24b[_0x39db('0xe')][_0x39db('0x10')]);}else{logger['info'](_0x39db('0x11'),_0x4f5ce0,'request\x20sent');_0x3a8143(_0x2ae24b[_0x39db('0x12')][_0x39db('0x10')]);}})[_0x39db('0x13')](function(_0xb3258c){logger[_0x39db('0xe')](_0x39db('0x11'),_0x4f5ce0,_0xb3258c);_0x193eef(_0xb3258c);});});} \ No newline at end of file +var _0x9371=['error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x19518d,_0x340a4a){var _0x3de478=function(_0x3453ac){while(--_0x3453ac){_0x19518d['push'](_0x19518d['shift']());}};_0x3de478(++_0x340a4a);}(_0x9371,0x16b));var _0x1937=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9371[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x1937('0x0'));var moment=require(_0x1937('0x1'));var BPromise=require(_0x1937('0x2'));var rs=require(_0x1937('0x3'));var fs=require('fs');var Redis=require(_0x1937('0x4'));var db=require(_0x1937('0x5'))['db'];var utils=require(_0x1937('0x6'));var logger=require(_0x1937('0x7'))(_0x1937('0x8'));var config=require(_0x1937('0x9'));var jayson=require(_0x1937('0xa'));var client=jayson[_0x1937('0xb')][_0x1937('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55c72b,_0x217909,_0x5e2d60){return new BPromise(function(_0x892e67,_0x4c2d70){return client[_0x1937('0xd')](_0x55c72b,_0x5e2d60)['then'](function(_0x3608cd){logger['info'](_0x1937('0xe'),_0x217909,_0x1937('0xf'));logger['debug'](_0x1937('0x10'),_0x217909,_0x1937('0xf'),JSON['stringify'](_0x3608cd));if(_0x3608cd[_0x1937('0x11')]){if(_0x3608cd['error']['code']===0x1f4){logger['error'](_0x1937('0xe'),_0x217909,_0x3608cd[_0x1937('0x11')][_0x1937('0x12')]);return _0x4c2d70(_0x3608cd[_0x1937('0x11')][_0x1937('0x12')]);}logger[_0x1937('0x11')](_0x1937('0xe'),_0x217909,_0x3608cd[_0x1937('0x11')][_0x1937('0x12')]);return _0x892e67(_0x3608cd[_0x1937('0x11')]['message']);}else{logger['info'](_0x1937('0xe'),_0x217909,_0x1937('0xf'));_0x892e67(_0x3608cd['result']['message']);}})['catch'](function(_0x8cbcb6){logger[_0x1937('0x11')](_0x1937('0xe'),_0x217909,_0x8cbcb6);_0x4c2d70(_0x8cbcb6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6173c42..0cd1ed2 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 _0x66f4=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5cf90e,_0x5df405){var _0xae958d=function(_0x52c27c){while(--_0x52c27c){_0x5cf90e['push'](_0x5cf90e['shift']());}};_0xae958d(++_0x5df405);}(_0x66f4,0x12f));var _0x466f=function(_0xb06366,_0x45c123){_0xb06366=_0xb06366-0x0;var _0x155e5e=_0x66f4[_0xb06366];return _0x155e5e;};'use strict';var multer=require(_0x466f('0x0'));var util=require(_0x466f('0x1'));var path=require('path');var timeout=require(_0x466f('0x2'));var express=require('express');var router=express[_0x466f('0x3')]();var fs_extra=require(_0x466f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x466f('0x5'));var config=require(_0x466f('0x6'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x466f('0x7')]);router[_0x466f('0x8')](_0x466f('0x9'),auth[_0x466f('0xa')](),controller[_0x466f('0xb')]);router[_0x466f('0x8')](_0x466f('0xc'),auth[_0x466f('0xa')](),controller[_0x466f('0xd')]);router[_0x466f('0xe')]('/',auth[_0x466f('0xa')](),controller['create']);router[_0x466f('0xe')]('/:id/sounds',auth[_0x466f('0xa')](),controller[_0x466f('0xf')]);router[_0x466f('0x10')](_0x466f('0x9'),auth['isAuthenticated'](),controller[_0x466f('0x11')]);router[_0x466f('0x12')](_0x466f('0x9'),auth[_0x466f('0xa')](),controller['destroy']);router[_0x466f('0x12')](_0x466f('0x13'),auth[_0x466f('0xa')](),controller[_0x466f('0x14')]);module[_0x466f('0x15')]=router; \ No newline at end of file +var _0xa088=['addSound','delete','destroy','removeSound','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','post','create'];(function(_0x417237,_0x49b51f){var _0x6eba7c=function(_0x59848e){while(--_0x59848e){_0x417237['push'](_0x417237['shift']());}};_0x6eba7c(++_0x49b51f);}(_0xa088,0x181));var _0x8a08=function(_0x62c209,_0x561166){_0x62c209=_0x62c209-0x0;var _0x3e8c43=_0xa088[_0x62c209];return _0x3e8c43;};'use strict';var multer=require(_0x8a08('0x0'));var util=require(_0x8a08('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a08('0x2'));var router=express[_0x8a08('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a08('0x4'));var interaction=require(_0x8a08('0x5'));var config=require(_0x8a08('0x6'));var controller=require(_0x8a08('0x7'));router[_0x8a08('0x8')]('/',auth[_0x8a08('0x9')](),controller['index']);router[_0x8a08('0x8')](_0x8a08('0xa'),auth[_0x8a08('0x9')](),controller[_0x8a08('0xb')]);router['get'](_0x8a08('0xc'),auth['isAuthenticated'](),controller['getSounds']);router[_0x8a08('0xd')]('/',auth['isAuthenticated'](),controller[_0x8a08('0xe')]);router['post'](_0x8a08('0xc'),auth['isAuthenticated'](),controller[_0x8a08('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8a08('0x10')](_0x8a08('0xa'),auth['isAuthenticated'](),controller[_0x8a08('0x11')]);router[_0x8a08('0x10')]('/:id/sounds/:id2',auth[_0x8a08('0x9')](),controller[_0x8a08('0x12')]);module[_0x8a08('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b72b686..9070a0e 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 _0xeabc=['files','alpha','BOOLEAN','sequelize','STRING','name','ENUM','custom','quietmp3nb','mp3'];(function(_0x18bee8,_0x15e890){var _0x4301a9=function(_0x36c7d3){while(--_0x36c7d3){_0x18bee8['push'](_0x18bee8['shift']());}};_0x4301a9(++_0x15e890);}(_0xeabc,0x1e3));var _0xceab=function(_0x2db717,_0x4c1a0b){_0x2db717=_0x2db717-0x0;var _0x2fcdbe=_0xeabc[_0x2db717];return _0x2fcdbe;};'use strict';var Sequelize=require(_0xceab('0x0'));module['exports']={'name':{'type':Sequelize[_0xceab('0x1')],'allowNull':![],'unique':_0xceab('0x2')},'mode':{'type':Sequelize[_0xceab('0x3')](_0xceab('0x4'),'files','mp3nb',_0xceab('0x5'),'quietmp3',_0xceab('0x6')),'allowNull':!![],'defaultValue':_0xceab('0x7')},'directory':{'type':Sequelize[_0xceab('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xceab('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xceab('0x8')},'format':{'type':Sequelize[_0xceab('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xceab('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d8f=['files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','exports','name','ENUM','custom'];(function(_0x105444,_0x126075){var _0x41dd96=function(_0x57103c){while(--_0x57103c){_0x105444['push'](_0x105444['shift']());}};_0x41dd96(++_0x126075);}(_0x9d8f,0x141));var _0xf9d8=function(_0x2b5f59,_0x49b0cc){_0x2b5f59=_0x2b5f59-0x0;var _0x2a084e=_0x9d8f[_0x2b5f59];return _0x2a084e;};'use strict';var Sequelize=require('sequelize');module[_0xf9d8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf9d8('0x1')},'mode':{'type':Sequelize[_0xf9d8('0x2')](_0xf9d8('0x3'),_0xf9d8('0x4'),_0xf9d8('0x5'),_0xf9d8('0x6'),_0xf9d8('0x7'),_0xf9d8('0x8')),'allowNull':!![],'defaultValue':_0xf9d8('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xf9d8('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf9d8('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf9d8('0xa')},'format':{'type':Sequelize[_0xf9d8('0x9')],'allowNull':!![]},'stamp':{'type':_0xf9d8('0xb')},'defaultEntry':{'type':Sequelize[_0xf9d8('0xc')],'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 1e880a9..69b5986 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 _0xdda2=['save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','root','symlinkSync','ValidationError','removeSound','Sound','id2','unlinkSync','%s.%s','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','body','create','sequelize','transaction','mode','directory','join','files','0777','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','Sequelize','message','addSound','findOne'];(function(_0x317dd9,_0x373814){var _0x3ff1e0=function(_0x37a31b){while(--_0x37a31b){_0x317dd9['push'](_0x317dd9['shift']());}};_0x3ff1e0(++_0x373814);}(_0xdda2,0xed));var _0x2dda=function(_0x4ee419,_0x40f30b){_0x4ee419=_0x4ee419-0x0;var _0x41e2a7=_0xdda2[_0x4ee419];return _0x41e2a7;};'use strict';var emlformat=require(_0x2dda('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dda('0x1'));var jsonpatch=require(_0x2dda('0x2'));var rp=require(_0x2dda('0x3'));var moment=require(_0x2dda('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2dda('0x5'));var path=require(_0x2dda('0x6'));var sox=require(_0x2dda('0x7'));var csv=require(_0x2dda('0x8'));var ejs=require(_0x2dda('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dda('0xa'));var squel=require(_0x2dda('0xb'));var crypto=require(_0x2dda('0xc'));var jsforce=require(_0x2dda('0xd'));var deskjs=require(_0x2dda('0xe'));var toCsv=require(_0x2dda('0x8'));var querystring=require(_0x2dda('0xf'));var Papa=require('papaparse');var Redis=require(_0x2dda('0x10'));var authService=require(_0x2dda('0x11'));var qs=require(_0x2dda('0x12'));var as=require(_0x2dda('0x13'));var hardwareService=require(_0x2dda('0x14'));var logger=require('../../config/logger')(_0x2dda('0x15'));var utils=require(_0x2dda('0x16'));var config=require(_0x2dda('0x17'));var licenseUtil=require(_0x2dda('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x217aa9,_0x2ec0d1){_0x2ec0d1=_0x2ec0d1||0xcc;return function(_0x519169){if(_0x519169){return _0x217aa9[_0x2dda('0x19')](_0x2ec0d1);}return _0x217aa9['status'](_0x2ec0d1)[_0x2dda('0x1a')]();};}function respondWithResult(_0x501daf,_0x144af1){_0x144af1=_0x144af1||0xc8;return function(_0x11bb4b){if(_0x11bb4b){return _0x501daf[_0x2dda('0x1b')](_0x144af1)[_0x2dda('0x1c')](_0x11bb4b);}};}function respondWithFilteredResult(_0x334c38,_0x1ca2fc){return function(_0x27bdf4){if(_0x27bdf4){var _0x361c52=typeof _0x1ca2fc[_0x2dda('0x1d')]===_0x2dda('0x1e')&&typeof _0x1ca2fc[_0x2dda('0x1f')]===_0x2dda('0x1e');var _0x1b9907=_0x27bdf4['count'];var _0x5e3622=_0x361c52?0x0:_0x1ca2fc[_0x2dda('0x1d')];var _0xc121b8=_0x361c52?_0x27bdf4[_0x2dda('0x20')]:_0x1ca2fc[_0x2dda('0x1d')]+_0x1ca2fc['limit'];var _0x259811;if(_0xc121b8>=_0x1b9907){_0xc121b8=_0x1b9907;_0x259811=0xc8;}else{_0x259811=0xce;}_0x334c38[_0x2dda('0x1b')](_0x259811);return _0x334c38[_0x2dda('0x21')]('Content-Range',_0x5e3622+'-'+_0xc121b8+'/'+_0x1b9907)[_0x2dda('0x1c')](_0x27bdf4);}return null;};}function patchUpdates(_0x4a39f2){return function(_0xf1ee8e){try{jsonpatch[_0x2dda('0x22')](_0xf1ee8e,_0x4a39f2,!![]);}catch(_0x193cfd){return BPromise[_0x2dda('0x23')](_0x193cfd);}return _0xf1ee8e['save']();};}function saveUpdates(_0x4fab46,_0x50a1ac){return function(_0x5a35b1){if(_0x5a35b1){return _0x5a35b1[_0x2dda('0x24')](_0x4fab46)[_0x2dda('0x25')](function(_0x3793ef){return _0x3793ef;});}return null;};}function removeEntity(_0x276279,_0x44665a){return function(_0xe1c4a4){if(_0xe1c4a4){return _0xe1c4a4[_0x2dda('0x26')]()['then'](function(){var _0x531ab5=_0xe1c4a4[_0x2dda('0x27')]({'plain':!![]});var _0x2e0ad6=_0x2dda('0x28');return db['UserProfileResource'][_0x2dda('0x26')]({'where':{'type':_0x2e0ad6,'resourceId':_0x531ab5['id']}})[_0x2dda('0x25')](function(){return _0xe1c4a4;});})[_0x2dda('0x25')](function(){_0x276279[_0x2dda('0x1b')](0xcc)[_0x2dda('0x1a')]();});}};}function handleEntityNotFound(_0x18c8b5,_0x1c9642){return function(_0x201a58){if(!_0x201a58){_0x18c8b5['sendStatus'](0x194);}return _0x201a58;};}function handleError(_0x5bb658,_0x47ccb3){_0x47ccb3=_0x47ccb3||0x1f4;return function(_0x36fa0f){logger[_0x2dda('0x29')](_0x36fa0f[_0x2dda('0x2a')]);if(_0x36fa0f[_0x2dda('0x2b')]){delete _0x36fa0f[_0x2dda('0x2b')];}_0x5bb658[_0x2dda('0x1b')](_0x47ccb3)[_0x2dda('0x2c')](_0x36fa0f);};}exports[_0x2dda('0x2d')]=function(_0x71312f,_0x4b1d1f){var _0x5583f5={},_0x47a8eb={},_0x15a34f={'count':0x0,'rows':[]};var _0x1c528b=_['map'](db[_0x2dda('0x2e')][_0x2dda('0x2f')],function(_0x4c6b01){return{'name':_0x4c6b01[_0x2dda('0x30')],'type':_0x4c6b01[_0x2dda('0x31')][_0x2dda('0x32')]};});_0x47a8eb['model']=_[_0x2dda('0x33')](_0x1c528b,_0x2dda('0x2b'));_0x47a8eb[_0x2dda('0x34')]=_[_0x2dda('0x35')](_0x71312f[_0x2dda('0x34')]);_0x47a8eb[_0x2dda('0x36')]=_[_0x2dda('0x37')](_0x47a8eb[_0x2dda('0x38')],_0x47a8eb[_0x2dda('0x34')]);_0x5583f5[_0x2dda('0x39')]=_[_0x2dda('0x37')](_0x47a8eb['model'],qs[_0x2dda('0x3a')](_0x71312f[_0x2dda('0x34')][_0x2dda('0x3a')]));_0x5583f5[_0x2dda('0x39')]=_0x5583f5['attributes'][_0x2dda('0x3b')]?_0x5583f5[_0x2dda('0x39')]:_0x47a8eb[_0x2dda('0x38')];if(!_0x71312f[_0x2dda('0x34')][_0x2dda('0x3c')](_0x2dda('0x3d'))){_0x5583f5[_0x2dda('0x1f')]=qs[_0x2dda('0x1f')](_0x71312f[_0x2dda('0x34')][_0x2dda('0x1f')]);_0x5583f5[_0x2dda('0x1d')]=qs[_0x2dda('0x1d')](_0x71312f['query'][_0x2dda('0x1d')]);}_0x5583f5[_0x2dda('0x3e')]=qs['sort'](_0x71312f[_0x2dda('0x34')][_0x2dda('0x3f')]);delete _0x71312f[_0x2dda('0x34')][_0x2dda('0x3f')];_0x5583f5['where']=qs['filters'](_[_0x2dda('0x40')](_0x71312f[_0x2dda('0x34')],_0x47a8eb[_0x2dda('0x36')]),_0x1c528b);if(_0x71312f[_0x2dda('0x34')][_0x2dda('0x41')]){_0x5583f5['where']=_['merge'](_0x5583f5[_0x2dda('0x42')],{'$or':_[_0x2dda('0x33')](_0x1c528b,function(_0x251013){if(_0x251013[_0x2dda('0x31')]!==_0x2dda('0x43')){var _0x65a9a6={};_0x65a9a6[_0x251013['name']]={'$like':'%'+_0x71312f['query'][_0x2dda('0x41')]+'%'};return _0x65a9a6;}})});}_0x5583f5=_[_0x2dda('0x44')]({},_0x5583f5,_0x71312f[_0x2dda('0x45')]);var _0x102500={'where':_0x5583f5[_0x2dda('0x42')]};return db['VoiceMusicOnHold'][_0x2dda('0x20')](_0x102500)[_0x2dda('0x25')](function(_0x44d3eb){_0x15a34f[_0x2dda('0x20')]=_0x44d3eb;if(_0x71312f[_0x2dda('0x34')][_0x2dda('0x46')]){_0x5583f5['include']=[{'all':!![]}];}return db[_0x2dda('0x2e')]['findAll'](_0x5583f5);})[_0x2dda('0x25')](function(_0x5b4a5f){_0x15a34f[_0x2dda('0x47')]=_0x5b4a5f;return _0x15a34f;})[_0x2dda('0x25')](respondWithFilteredResult(_0x4b1d1f,_0x5583f5))[_0x2dda('0x48')](handleError(_0x4b1d1f,null));};exports['show']=function(_0xd399d1,_0x2a08d5){var _0x216b44={'raw':![],'where':{'id':_0xd399d1[_0x2dda('0x49')]['id']}},_0x5bdab2={};_0x5bdab2[_0x2dda('0x38')]=_[_0x2dda('0x35')](db[_0x2dda('0x2e')][_0x2dda('0x2f')]);_0x5bdab2[_0x2dda('0x34')]=_['keys'](_0xd399d1['query']);_0x5bdab2[_0x2dda('0x36')]=_[_0x2dda('0x37')](_0x5bdab2['model'],_0x5bdab2[_0x2dda('0x34')]);_0x216b44[_0x2dda('0x39')]=_[_0x2dda('0x37')](_0x5bdab2[_0x2dda('0x38')],qs[_0x2dda('0x3a')](_0xd399d1[_0x2dda('0x34')][_0x2dda('0x3a')]));_0x216b44[_0x2dda('0x39')]=_0x216b44[_0x2dda('0x39')][_0x2dda('0x3b')]?_0x216b44[_0x2dda('0x39')]:_0x5bdab2['model'];if(_0xd399d1['query'][_0x2dda('0x46')]){_0x216b44[_0x2dda('0x4a')]=[{'all':!![]}];}_0x216b44=_[_0x2dda('0x44')]({},_0x216b44,_0xd399d1[_0x2dda('0x45')]);return db[_0x2dda('0x2e')][_0x2dda('0x4b')](_0x216b44)[_0x2dda('0x25')](handleEntityNotFound(_0x2a08d5,null))[_0x2dda('0x25')](respondWithResult(_0x2a08d5,null))['catch'](handleError(_0x2a08d5,null));};exports['update']=function(_0x476793,_0x4f96ce){if(_0x476793['body']['id']){delete _0x476793['body']['id'];}return db['VoiceMusicOnHold'][_0x2dda('0x4b')]({'where':{'id':_0x476793['params']['id']}})['then'](handleEntityNotFound(_0x4f96ce,null))['then'](saveUpdates(_0x476793[_0x2dda('0x4c')],null))[_0x2dda('0x25')](respondWithResult(_0x4f96ce,null))['catch'](handleError(_0x4f96ce,null));};exports[_0x2dda('0x4d')]=function(_0x4d3c94,_0x7bba9e,_0x5ea89b){return db[_0x2dda('0x4e')][_0x2dda('0x4f')](function(_0x9d8dc9){if(_0x4d3c94[_0x2dda('0x4c')][_0x2dda('0x50')]==='files'){_0x4d3c94[_0x2dda('0x4c')][_0x2dda('0x51')]=path[_0x2dda('0x52')](config['root'],'server/files/moh',_0x4d3c94[_0x2dda('0x4c')][_0x2dda('0x2b')]);}return db[_0x2dda('0x2e')]['create'](_0x4d3c94[_0x2dda('0x4c')],{'transaction':_0x9d8dc9})[_0x2dda('0x25')](function(_0x36e3f8){if(_0x4d3c94[_0x2dda('0x4c')]['mode']===_0x2dda('0x53')){fs['mkdirSync'](_0x36e3f8['directory'],parseInt(_0x2dda('0x54'),0x8));}var _0x544da5=_0x4d3c94[_0x2dda('0x55')][_0x2dda('0x27')]({'plain':!![]});if(!_0x544da5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x544da5['role']===_0x2dda('0x55')){var _0x5a543a=_0x36e3f8[_0x2dda('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x2dda('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x544da5[_0x2dda('0x56')]},'raw':!![]})['then'](function(_0x44418c){if(_0x44418c&&_0x44418c[_0x2dda('0x57')]===0x0){return db[_0x2dda('0x58')][_0x2dda('0x4d')]({'name':_0x5a543a[_0x2dda('0x2b')],'resourceId':_0x5a543a['id'],'type':_0x44418c['name'],'sectionId':_0x44418c['id']},{})[_0x2dda('0x25')](function(){return _0x36e3f8;});}else{return _0x36e3f8;}})[_0x2dda('0x48')](function(_0x453112){logger[_0x2dda('0x29')](_0x2dda('0x59'),_0x453112);});}return _0x36e3f8;});})[_0x2dda('0x25')](respondWithResult(_0x7bba9e,0xc9))[_0x2dda('0x48')](handleError(_0x7bba9e,null));};exports[_0x2dda('0x26')]=function(_0x78dd4a,_0x45a9b9,_0x11e542){var _0x2f6a95;return db[_0x2dda('0x2e')][_0x2dda('0x4b')]({'where':{'id':_0x78dd4a[_0x2dda('0x49')]['id']}})[_0x2dda('0x25')](function(_0x1001ee){if(_0x1001ee){return db['sequelize'][_0x2dda('0x4f')](function(_0x56bd45){return _0x1001ee[_0x2dda('0x26')]({'transaction':_0x56bd45,'raw':!![]})['then'](function(_0x859c48){if(_0x859c48['directory']){fs[_0x2dda('0x5a')](_0x859c48['directory'])[_0x2dda('0x5b')](function(_0x1be96f){fs['unlinkSync'](path[_0x2dda('0x52')](_0x859c48[_0x2dda('0x51')],_0x1be96f));});fs['rmdirSync'](_0x859c48['directory']);}return _0x859c48;});})[_0x2dda('0x48')](function(_0x37788d){throw new db[(_0x2dda('0x5c'))]['ValidationError'](_0x37788d[_0x2dda('0x5d')]);});}})['then'](handleEntityNotFound(_0x45a9b9,null))[_0x2dda('0x25')](removeEntity(_0x45a9b9,null))[_0x2dda('0x48')](handleError(_0x45a9b9,null));};exports[_0x2dda('0x5e')]=function(_0x6611f3,_0x71a4cc,_0x3819c1){return db[_0x2dda('0x4e')][_0x2dda('0x4f')](function(_0x3fa3b7){var _0x53b482;return db[_0x2dda('0x2e')][_0x2dda('0x4b')]({'where':{'id':_0x6611f3[_0x2dda('0x49')]['id']}})['then'](function(_0x13170a){if(_0x13170a){_0x53b482=_0x13170a;return _0x13170a[_0x2dda('0x5e')](_0x6611f3['body']['id'],{'transaction':_0x3fa3b7});}})[_0x2dda('0x25')](function(_0x5f5dc0){if(_0x5f5dc0){return db['Sound'][_0x2dda('0x5f')]({'where':{'id':_0x6611f3[_0x2dda('0x4c')]['id']},'attributes':['id',_0x2dda('0x2b'),_0x2dda('0x60'),_0x2dda('0x61'),_0x2dda('0x62')],'raw':!![]});}})[_0x2dda('0x25')](function(_0x398e5a){if(_0x398e5a){var _0x2cece1=path[_0x2dda('0x52')](config['root'],_0x2dda('0x63'),util[_0x2dda('0x64')]('%s.%s',path[_0x2dda('0x65')](_0x398e5a[_0x2dda('0x60')],path['extname'](_0x398e5a[_0x2dda('0x60')])),_0x398e5a[_0x2dda('0x61')]));var _0x2cc61d=path['join'](config[_0x2dda('0x66')],'server/files/moh',_0x53b482[_0x2dda('0x2b')],util['format']('%s.%s',_0x398e5a[_0x2dda('0x2b')],_0x398e5a[_0x2dda('0x61')]));fs[_0x2dda('0x67')](_0x2cece1,_0x2cc61d);return _0x398e5a;}})['catch'](function(_0x4b1462){throw new db[(_0x2dda('0x5c'))][(_0x2dda('0x68'))](_0x4b1462['message']);});})[_0x2dda('0x25')](handleEntityNotFound(_0x71a4cc,null))[_0x2dda('0x25')](respondWithResult(_0x71a4cc,0xc9))[_0x2dda('0x48')](handleError(_0x71a4cc,null));};exports[_0x2dda('0x69')]=function(_0x49cc69,_0x36169d,_0x1ecfac){return db[_0x2dda('0x4e')][_0x2dda('0x4f')](function(_0x33e5b4){var _0x346956;return db['VoiceMusicOnHold'][_0x2dda('0x5f')]({'where':{'id':_0x49cc69[_0x2dda('0x49')]['id']}})[_0x2dda('0x25')](handleEntityNotFound(_0x36169d,null))[_0x2dda('0x25')](function(_0x86973f){if(_0x86973f){_0x346956=_0x86973f;return _0x86973f[_0x2dda('0x69')](_0x49cc69[_0x2dda('0x49')]['id2']);}})['then'](function(_0x297ed1){if(_0x297ed1){return db[_0x2dda('0x6a')][_0x2dda('0x5f')]({'where':{'id':_0x49cc69[_0x2dda('0x49')][_0x2dda('0x6b')]},'attributes':['id',_0x2dda('0x2b'),'save_name',_0x2dda('0x61'),_0x2dda('0x62')],'raw':!![]});}})[_0x2dda('0x25')](function(_0x1fcea0){if(_0x1fcea0){fs[_0x2dda('0x6c')](path[_0x2dda('0x52')](_0x346956[_0x2dda('0x51')],util['format'](_0x2dda('0x6d'),_0x1fcea0[_0x2dda('0x2b')],_0x1fcea0[_0x2dda('0x61')])));return _0x1fcea0;}})[_0x2dda('0x48')](function(_0x396902){throw new db[(_0x2dda('0x5c'))][(_0x2dda('0x68'))](_0x396902['message']);});})[_0x2dda('0x25')](handleEntityNotFound(_0x36169d,null))[_0x2dda('0x25')](respondWithStatusCode(_0x36169d,0xcc))['catch'](handleError(_0x36169d,null));};exports[_0x2dda('0x6e')]=function(_0x3269ba,_0x1817e2,_0x130232){var _0x2607aa={};var _0x3dbc21={};var _0x126e14;var _0x124668;return db['VoiceMusicOnHold'][_0x2dda('0x5f')]({'where':{'id':_0x3269ba[_0x2dda('0x49')]['id']}})[_0x2dda('0x25')](handleEntityNotFound(_0x1817e2,null))[_0x2dda('0x25')](function(_0x21feac){if(_0x21feac){_0x126e14=_0x21feac;_0x3dbc21[_0x2dda('0x38')]=_['keys'](db[_0x2dda('0x6a')]['rawAttributes']);_0x3dbc21[_0x2dda('0x34')]=_[_0x2dda('0x35')](_0x3269ba['query']);_0x3dbc21[_0x2dda('0x36')]=_[_0x2dda('0x37')](_0x3dbc21[_0x2dda('0x38')],_0x3dbc21[_0x2dda('0x34')]);_0x2607aa[_0x2dda('0x39')]=_[_0x2dda('0x37')](_0x3dbc21[_0x2dda('0x38')],qs[_0x2dda('0x3a')](_0x3269ba[_0x2dda('0x34')]['fields']));_0x2607aa['attributes']=_0x2607aa[_0x2dda('0x39')][_0x2dda('0x3b')]?_0x2607aa[_0x2dda('0x39')]:_0x3dbc21[_0x2dda('0x38')];_0x2607aa[_0x2dda('0x3e')]=qs['sort'](_0x3269ba[_0x2dda('0x34')][_0x2dda('0x3f')]);_0x2607aa[_0x2dda('0x42')]=qs[_0x2dda('0x36')](_[_0x2dda('0x40')](_0x3269ba[_0x2dda('0x34')],_0x3dbc21[_0x2dda('0x36')]));if(_0x3269ba['query'][_0x2dda('0x41')]){_0x2607aa[_0x2dda('0x42')]=_[_0x2dda('0x44')](_0x2607aa[_0x2dda('0x42')],{'$or':_[_0x2dda('0x33')](_0x2607aa[_0x2dda('0x39')],function(_0xc8fae){var _0x2f2590={};_0x2f2590[_0xc8fae]={'$like':'%'+_0x3269ba['query']['filter']+'%'};return _0x2f2590;})});}_0x2607aa=_[_0x2dda('0x44')]({},_0x2607aa,_0x3269ba[_0x2dda('0x45')]);return _0x126e14[_0x2dda('0x6e')](_0x2607aa);}})[_0x2dda('0x25')](function(_0x5bf51c){if(_0x5bf51c){_0x124668=_0x5bf51c[_0x2dda('0x3b')];if(!_0x3269ba[_0x2dda('0x34')][_0x2dda('0x3c')](_0x2dda('0x3d'))){_0x2607aa[_0x2dda('0x1f')]=qs['limit'](_0x3269ba[_0x2dda('0x34')][_0x2dda('0x1f')]);_0x2607aa[_0x2dda('0x1d')]=qs[_0x2dda('0x1d')](_0x3269ba[_0x2dda('0x34')][_0x2dda('0x1d')]);}return _0x126e14[_0x2dda('0x6e')](_0x2607aa);}})[_0x2dda('0x25')](function(_0x1c0db5){if(_0x1c0db5){return _0x1c0db5?{'count':_0x124668,'rows':_0x1c0db5}:null;}})['then'](respondWithResult(_0x1817e2,null))[_0x2dda('0x48')](handleError(_0x1817e2,null));}; \ No newline at end of file +var _0xfc64=['create','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','rmdirSync','Sequelize','message','sequelize','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','ValidationError','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','params','find','body','mode','files','directory','join','root','server/files/moh'];(function(_0x3238ea,_0x47418d){var _0x50f4c4=function(_0x115a8f){while(--_0x115a8f){_0x3238ea['push'](_0x3238ea['shift']());}};_0x50f4c4(++_0x47418d);}(_0xfc64,0x8d));var _0x4fc6=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xfc64[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require(_0x4fc6('0x0'));var rimraf=require(_0x4fc6('0x1'));var zipdir=require(_0x4fc6('0x2'));var jsonpatch=require(_0x4fc6('0x3'));var rp=require(_0x4fc6('0x4'));var moment=require('moment');var BPromise=require(_0x4fc6('0x5'));var Mustache=require(_0x4fc6('0x6'));var util=require(_0x4fc6('0x7'));var path=require(_0x4fc6('0x8'));var sox=require(_0x4fc6('0x9'));var csv=require(_0x4fc6('0xa'));var ejs=require(_0x4fc6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4fc6('0xc'));var crypto=require(_0x4fc6('0xd'));var jsforce=require(_0x4fc6('0xe'));var deskjs=require(_0x4fc6('0xf'));var toCsv=require(_0x4fc6('0xa'));var querystring=require(_0x4fc6('0x10'));var Papa=require('papaparse');var Redis=require(_0x4fc6('0x11'));var authService=require(_0x4fc6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4fc6('0x13'));var hardwareService=require(_0x4fc6('0x14'));var logger=require(_0x4fc6('0x15'))(_0x4fc6('0x16'));var utils=require('../../config/utils');var config=require(_0x4fc6('0x17'));var licenseUtil=require(_0x4fc6('0x18'));var db=require(_0x4fc6('0x19'))['db'];function respondWithStatusCode(_0xcb6e45,_0x15da7a){_0x15da7a=_0x15da7a||0xcc;return function(_0x48ad2d){if(_0x48ad2d){return _0xcb6e45[_0x4fc6('0x1a')](_0x15da7a);}return _0xcb6e45[_0x4fc6('0x1b')](_0x15da7a)['end']();};}function respondWithResult(_0x1e3e82,_0x49be33){_0x49be33=_0x49be33||0xc8;return function(_0x47cfc4){if(_0x47cfc4){return _0x1e3e82[_0x4fc6('0x1b')](_0x49be33)['json'](_0x47cfc4);}};}function respondWithFilteredResult(_0x28966a,_0x19af48){return function(_0x560e6b){if(_0x560e6b){var _0x3249c0=typeof _0x19af48[_0x4fc6('0x1c')]===_0x4fc6('0x1d')&&typeof _0x19af48[_0x4fc6('0x1e')]===_0x4fc6('0x1d');var _0x371c61=_0x560e6b[_0x4fc6('0x1f')];var _0x1736b1=_0x3249c0?0x0:_0x19af48['offset'];var _0x160109=_0x3249c0?_0x560e6b['count']:_0x19af48[_0x4fc6('0x1c')]+_0x19af48[_0x4fc6('0x1e')];var _0x2cc228;if(_0x160109>=_0x371c61){_0x160109=_0x371c61;_0x2cc228=0xc8;}else{_0x2cc228=0xce;}_0x28966a[_0x4fc6('0x1b')](_0x2cc228);return _0x28966a[_0x4fc6('0x20')](_0x4fc6('0x21'),_0x1736b1+'-'+_0x160109+'/'+_0x371c61)['json'](_0x560e6b);}return null;};}function patchUpdates(_0x347714){return function(_0x15d115){try{jsonpatch[_0x4fc6('0x22')](_0x15d115,_0x347714,!![]);}catch(_0x14b1e6){return BPromise[_0x4fc6('0x23')](_0x14b1e6);}return _0x15d115[_0x4fc6('0x24')]();};}function saveUpdates(_0x3efe37,_0x588c6e){return function(_0x36b534){if(_0x36b534){return _0x36b534[_0x4fc6('0x25')](_0x3efe37)[_0x4fc6('0x26')](function(_0x2c10d9){return _0x2c10d9;});}return null;};}function removeEntity(_0x49935f,_0x4e51f7){return function(_0x454c26){if(_0x454c26){return _0x454c26[_0x4fc6('0x27')]()[_0x4fc6('0x26')](function(){var _0xfb9b5c=_0x454c26[_0x4fc6('0x28')]({'plain':!![]});var _0x1a0d01=_0x4fc6('0x29');return db[_0x4fc6('0x2a')][_0x4fc6('0x27')]({'where':{'type':_0x1a0d01,'resourceId':_0xfb9b5c['id']}})[_0x4fc6('0x26')](function(){return _0x454c26;});})['then'](function(){_0x49935f['status'](0xcc)[_0x4fc6('0x2b')]();});}};}function handleEntityNotFound(_0x49414e,_0x58f2b2){return function(_0x4e0397){if(!_0x4e0397){_0x49414e[_0x4fc6('0x1a')](0x194);}return _0x4e0397;};}function handleError(_0x305e92,_0x227e7f){_0x227e7f=_0x227e7f||0x1f4;return function(_0x23086f){logger[_0x4fc6('0x2c')](_0x23086f[_0x4fc6('0x2d')]);if(_0x23086f['name']){delete _0x23086f[_0x4fc6('0x2e')];}_0x305e92[_0x4fc6('0x1b')](_0x227e7f)['send'](_0x23086f);};}exports['index']=function(_0x262572,_0xbe0963){var _0x27fdec={},_0x1c985f={},_0x22d61d={'count':0x0,'rows':[]};var _0x2f87c5=_['map'](db[_0x4fc6('0x2f')][_0x4fc6('0x30')],function(_0x4ae454){return{'name':_0x4ae454['fieldName'],'type':_0x4ae454[_0x4fc6('0x31')][_0x4fc6('0x32')]};});_0x1c985f[_0x4fc6('0x33')]=_[_0x4fc6('0x34')](_0x2f87c5,_0x4fc6('0x2e'));_0x1c985f[_0x4fc6('0x35')]=_[_0x4fc6('0x36')](_0x262572[_0x4fc6('0x35')]);_0x1c985f[_0x4fc6('0x37')]=_[_0x4fc6('0x38')](_0x1c985f[_0x4fc6('0x33')],_0x1c985f[_0x4fc6('0x35')]);_0x27fdec[_0x4fc6('0x39')]=_[_0x4fc6('0x38')](_0x1c985f[_0x4fc6('0x33')],qs[_0x4fc6('0x3a')](_0x262572[_0x4fc6('0x35')][_0x4fc6('0x3a')]));_0x27fdec[_0x4fc6('0x39')]=_0x27fdec[_0x4fc6('0x39')][_0x4fc6('0x3b')]?_0x27fdec[_0x4fc6('0x39')]:_0x1c985f[_0x4fc6('0x33')];if(!_0x262572[_0x4fc6('0x35')][_0x4fc6('0x3c')](_0x4fc6('0x3d'))){_0x27fdec[_0x4fc6('0x1e')]=qs[_0x4fc6('0x1e')](_0x262572[_0x4fc6('0x35')][_0x4fc6('0x1e')]);_0x27fdec[_0x4fc6('0x1c')]=qs['offset'](_0x262572[_0x4fc6('0x35')][_0x4fc6('0x1c')]);}_0x27fdec[_0x4fc6('0x3e')]=qs[_0x4fc6('0x3f')](_0x262572[_0x4fc6('0x35')][_0x4fc6('0x3f')]);delete _0x262572[_0x4fc6('0x35')][_0x4fc6('0x3f')];_0x27fdec[_0x4fc6('0x40')]=qs[_0x4fc6('0x37')](_['pick'](_0x262572['query'],_0x1c985f['filters']),_0x2f87c5);if(_0x262572[_0x4fc6('0x35')][_0x4fc6('0x41')]){_0x27fdec['where']=_['merge'](_0x27fdec[_0x4fc6('0x40')],{'$or':_['map'](_0x2f87c5,function(_0x461c06){if(_0x461c06[_0x4fc6('0x31')]!=='VIRTUAL'){var _0x27685a={};_0x27685a[_0x461c06[_0x4fc6('0x2e')]]={'$like':'%'+_0x262572[_0x4fc6('0x35')][_0x4fc6('0x41')]+'%'};return _0x27685a;}})});}_0x27fdec=_[_0x4fc6('0x42')]({},_0x27fdec,_0x262572[_0x4fc6('0x43')]);var _0x1590ec={'where':_0x27fdec['where']};return db[_0x4fc6('0x2f')][_0x4fc6('0x1f')](_0x1590ec)[_0x4fc6('0x26')](function(_0x27ffb7){_0x22d61d[_0x4fc6('0x1f')]=_0x27ffb7;if(_0x262572[_0x4fc6('0x35')][_0x4fc6('0x44')]){_0x27fdec[_0x4fc6('0x45')]=[{'all':!![]}];}return db[_0x4fc6('0x2f')][_0x4fc6('0x46')](_0x27fdec);})[_0x4fc6('0x26')](function(_0x3bb8aa){_0x22d61d['rows']=_0x3bb8aa;return _0x22d61d;})['then'](respondWithFilteredResult(_0xbe0963,_0x27fdec))[_0x4fc6('0x47')](handleError(_0xbe0963,null));};exports['show']=function(_0x3ce3bc,_0x537b58){var _0x1ef716={'raw':![],'where':{'id':_0x3ce3bc[_0x4fc6('0x48')]['id']}},_0x130080={};_0x130080[_0x4fc6('0x33')]=_[_0x4fc6('0x36')](db[_0x4fc6('0x2f')][_0x4fc6('0x30')]);_0x130080[_0x4fc6('0x35')]=_['keys'](_0x3ce3bc[_0x4fc6('0x35')]);_0x130080[_0x4fc6('0x37')]=_[_0x4fc6('0x38')](_0x130080[_0x4fc6('0x33')],_0x130080[_0x4fc6('0x35')]);_0x1ef716[_0x4fc6('0x39')]=_[_0x4fc6('0x38')](_0x130080[_0x4fc6('0x33')],qs[_0x4fc6('0x3a')](_0x3ce3bc['query'][_0x4fc6('0x3a')]));_0x1ef716[_0x4fc6('0x39')]=_0x1ef716[_0x4fc6('0x39')]['length']?_0x1ef716[_0x4fc6('0x39')]:_0x130080['model'];if(_0x3ce3bc[_0x4fc6('0x35')][_0x4fc6('0x44')]){_0x1ef716['include']=[{'all':!![]}];}_0x1ef716=_['merge']({},_0x1ef716,_0x3ce3bc[_0x4fc6('0x43')]);return db[_0x4fc6('0x2f')][_0x4fc6('0x49')](_0x1ef716)['then'](handleEntityNotFound(_0x537b58,null))['then'](respondWithResult(_0x537b58,null))[_0x4fc6('0x47')](handleError(_0x537b58,null));};exports[_0x4fc6('0x25')]=function(_0x520619,_0x276a3c){if(_0x520619[_0x4fc6('0x4a')]['id']){delete _0x520619[_0x4fc6('0x4a')]['id'];}return db[_0x4fc6('0x2f')][_0x4fc6('0x49')]({'where':{'id':_0x520619[_0x4fc6('0x48')]['id']}})[_0x4fc6('0x26')](handleEntityNotFound(_0x276a3c,null))[_0x4fc6('0x26')](saveUpdates(_0x520619['body'],null))[_0x4fc6('0x26')](respondWithResult(_0x276a3c,null))[_0x4fc6('0x47')](handleError(_0x276a3c,null));};exports['create']=function(_0x4d1520,_0xf9160f,_0x5b39d7){return db['sequelize']['transaction'](function(_0x18f5fd){if(_0x4d1520[_0x4fc6('0x4a')][_0x4fc6('0x4b')]===_0x4fc6('0x4c')){_0x4d1520[_0x4fc6('0x4a')][_0x4fc6('0x4d')]=path[_0x4fc6('0x4e')](config[_0x4fc6('0x4f')],_0x4fc6('0x50'),_0x4d1520[_0x4fc6('0x4a')][_0x4fc6('0x2e')]);}return db[_0x4fc6('0x2f')][_0x4fc6('0x51')](_0x4d1520['body'],{'transaction':_0x18f5fd})[_0x4fc6('0x26')](function(_0x7c21ec){if(_0x4d1520[_0x4fc6('0x4a')][_0x4fc6('0x4b')]==='files'){fs[_0x4fc6('0x52')](_0x7c21ec[_0x4fc6('0x4d')],parseInt('0777',0x8));}var _0x5a816b=_0x4d1520[_0x4fc6('0x53')][_0x4fc6('0x28')]({'plain':!![]});if(!_0x5a816b)throw new Error(_0x4fc6('0x54'));if(_0x5a816b[_0x4fc6('0x55')]===_0x4fc6('0x53')){var _0x3f4b59=_0x7c21ec[_0x4fc6('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4fc6('0x29'),'userProfileId':_0x5a816b[_0x4fc6('0x56')]},'raw':!![]})[_0x4fc6('0x26')](function(_0x4d8dea){if(_0x4d8dea&&_0x4d8dea[_0x4fc6('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f4b59['name'],'resourceId':_0x3f4b59['id'],'type':_0x4d8dea[_0x4fc6('0x2e')],'sectionId':_0x4d8dea['id']},{})[_0x4fc6('0x26')](function(){return _0x7c21ec;});}else{return _0x7c21ec;}})['catch'](function(_0x5e4630){logger[_0x4fc6('0x2c')](_0x4fc6('0x58'),_0x5e4630);});}return _0x7c21ec;});})['then'](respondWithResult(_0xf9160f,0xc9))[_0x4fc6('0x47')](handleError(_0xf9160f,null));};exports[_0x4fc6('0x27')]=function(_0x49f825,_0x1f48e2,_0x51acc1){var _0x21bbaf;return db[_0x4fc6('0x2f')][_0x4fc6('0x49')]({'where':{'id':_0x49f825[_0x4fc6('0x48')]['id']}})[_0x4fc6('0x26')](function(_0x51a060){if(_0x51a060){return db['sequelize'][_0x4fc6('0x59')](function(_0x99b936){return _0x51a060[_0x4fc6('0x27')]({'transaction':_0x99b936,'raw':!![]})[_0x4fc6('0x26')](function(_0x5a4abf){if(_0x5a4abf[_0x4fc6('0x4d')]){fs[_0x4fc6('0x5a')](_0x5a4abf[_0x4fc6('0x4d')])[_0x4fc6('0x5b')](function(_0x53ce50){fs['unlinkSync'](path[_0x4fc6('0x4e')](_0x5a4abf['directory'],_0x53ce50));});fs[_0x4fc6('0x5c')](_0x5a4abf[_0x4fc6('0x4d')]);}return _0x5a4abf;});})['catch'](function(_0x3683e5){throw new db[(_0x4fc6('0x5d'))]['ValidationError'](_0x3683e5[_0x4fc6('0x5e')]);});}})[_0x4fc6('0x26')](handleEntityNotFound(_0x1f48e2,null))[_0x4fc6('0x26')](removeEntity(_0x1f48e2,null))[_0x4fc6('0x47')](handleError(_0x1f48e2,null));};exports['addSound']=function(_0x51ece3,_0x40378f,_0x4f0302){return db[_0x4fc6('0x5f')][_0x4fc6('0x59')](function(_0x5739ef){var _0x51b97d;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x51ece3[_0x4fc6('0x48')]['id']}})['then'](function(_0x457f1f){if(_0x457f1f){_0x51b97d=_0x457f1f;return _0x457f1f['addSound'](_0x51ece3['body']['id'],{'transaction':_0x5739ef});}})[_0x4fc6('0x26')](function(_0x45f750){if(_0x45f750){return db[_0x4fc6('0x60')][_0x4fc6('0x61')]({'where':{'id':_0x51ece3[_0x4fc6('0x4a')]['id']},'attributes':['id','name','save_name',_0x4fc6('0x62'),_0x4fc6('0x63')],'raw':!![]});}})[_0x4fc6('0x26')](function(_0x2aac62){if(_0x2aac62){var _0xb609c7=path[_0x4fc6('0x4e')](config[_0x4fc6('0x4f')],_0x4fc6('0x64'),util[_0x4fc6('0x65')](_0x4fc6('0x66'),path[_0x4fc6('0x67')](_0x2aac62[_0x4fc6('0x68')],path[_0x4fc6('0x69')](_0x2aac62[_0x4fc6('0x68')])),_0x2aac62[_0x4fc6('0x62')]));var _0x4c4983=path['join'](config['root'],_0x4fc6('0x50'),_0x51b97d[_0x4fc6('0x2e')],util[_0x4fc6('0x65')](_0x4fc6('0x66'),_0x2aac62[_0x4fc6('0x2e')],_0x2aac62[_0x4fc6('0x62')]));fs[_0x4fc6('0x6a')](_0xb609c7,_0x4c4983);return _0x2aac62;}})[_0x4fc6('0x47')](function(_0x4f684f){throw new db['Sequelize']['ValidationError'](_0x4f684f[_0x4fc6('0x5e')]);});})[_0x4fc6('0x26')](handleEntityNotFound(_0x40378f,null))[_0x4fc6('0x26')](respondWithResult(_0x40378f,0xc9))[_0x4fc6('0x47')](handleError(_0x40378f,null));};exports[_0x4fc6('0x6b')]=function(_0xcb2e,_0x422cf3,_0x418852){return db['sequelize']['transaction'](function(_0x3b7c6d){var _0x1e8998;return db['VoiceMusicOnHold'][_0x4fc6('0x61')]({'where':{'id':_0xcb2e['params']['id']}})[_0x4fc6('0x26')](handleEntityNotFound(_0x422cf3,null))[_0x4fc6('0x26')](function(_0x5ee8d1){if(_0x5ee8d1){_0x1e8998=_0x5ee8d1;return _0x5ee8d1[_0x4fc6('0x6b')](_0xcb2e[_0x4fc6('0x48')][_0x4fc6('0x6c')]);}})[_0x4fc6('0x26')](function(_0x46846c){if(_0x46846c){return db['Sound'][_0x4fc6('0x61')]({'where':{'id':_0xcb2e[_0x4fc6('0x48')][_0x4fc6('0x6c')]},'attributes':['id',_0x4fc6('0x2e'),_0x4fc6('0x68'),_0x4fc6('0x62'),_0x4fc6('0x63')],'raw':!![]});}})['then'](function(_0x3470e8){if(_0x3470e8){fs['unlinkSync'](path[_0x4fc6('0x4e')](_0x1e8998[_0x4fc6('0x4d')],util[_0x4fc6('0x65')]('%s.%s',_0x3470e8[_0x4fc6('0x2e')],_0x3470e8['converted_format'])));return _0x3470e8;}})[_0x4fc6('0x47')](function(_0x4348a4){throw new db['Sequelize'][(_0x4fc6('0x6d'))](_0x4348a4['message']);});})[_0x4fc6('0x26')](handleEntityNotFound(_0x422cf3,null))[_0x4fc6('0x26')](respondWithStatusCode(_0x422cf3,0xcc))[_0x4fc6('0x47')](handleError(_0x422cf3,null));};exports[_0x4fc6('0x6e')]=function(_0x2c172b,_0x10c429,_0x4c0e17){var _0x466fed={};var _0x1449d7={};var _0x4ea885;var _0x1e67d3;return db['VoiceMusicOnHold'][_0x4fc6('0x61')]({'where':{'id':_0x2c172b['params']['id']}})[_0x4fc6('0x26')](handleEntityNotFound(_0x10c429,null))[_0x4fc6('0x26')](function(_0x1ca05c){if(_0x1ca05c){_0x4ea885=_0x1ca05c;_0x1449d7['model']=_[_0x4fc6('0x36')](db[_0x4fc6('0x60')][_0x4fc6('0x30')]);_0x1449d7[_0x4fc6('0x35')]=_['keys'](_0x2c172b[_0x4fc6('0x35')]);_0x1449d7[_0x4fc6('0x37')]=_[_0x4fc6('0x38')](_0x1449d7[_0x4fc6('0x33')],_0x1449d7[_0x4fc6('0x35')]);_0x466fed[_0x4fc6('0x39')]=_[_0x4fc6('0x38')](_0x1449d7[_0x4fc6('0x33')],qs['fields'](_0x2c172b[_0x4fc6('0x35')]['fields']));_0x466fed[_0x4fc6('0x39')]=_0x466fed[_0x4fc6('0x39')]['length']?_0x466fed[_0x4fc6('0x39')]:_0x1449d7[_0x4fc6('0x33')];_0x466fed[_0x4fc6('0x3e')]=qs[_0x4fc6('0x3f')](_0x2c172b[_0x4fc6('0x35')][_0x4fc6('0x3f')]);_0x466fed['where']=qs[_0x4fc6('0x37')](_['pick'](_0x2c172b[_0x4fc6('0x35')],_0x1449d7[_0x4fc6('0x37')]));if(_0x2c172b[_0x4fc6('0x35')][_0x4fc6('0x41')]){_0x466fed['where']=_[_0x4fc6('0x42')](_0x466fed[_0x4fc6('0x40')],{'$or':_['map'](_0x466fed[_0x4fc6('0x39')],function(_0x53a73f){var _0x2ec42f={};_0x2ec42f[_0x53a73f]={'$like':'%'+_0x2c172b[_0x4fc6('0x35')][_0x4fc6('0x41')]+'%'};return _0x2ec42f;})});}_0x466fed=_[_0x4fc6('0x42')]({},_0x466fed,_0x2c172b[_0x4fc6('0x43')]);return _0x4ea885['getSounds'](_0x466fed);}})['then'](function(_0x251b50){if(_0x251b50){_0x1e67d3=_0x251b50[_0x4fc6('0x3b')];if(!_0x2c172b['query'][_0x4fc6('0x3c')](_0x4fc6('0x3d'))){_0x466fed['limit']=qs[_0x4fc6('0x1e')](_0x2c172b['query'][_0x4fc6('0x1e')]);_0x466fed[_0x4fc6('0x1c')]=qs['offset'](_0x2c172b[_0x4fc6('0x35')][_0x4fc6('0x1c')]);}return _0x4ea885['getSounds'](_0x466fed);}})[_0x4fc6('0x26')](function(_0x162342){if(_0x162342){return _0x162342?{'count':_0x1e67d3,'rows':_0x162342}:null;}})[_0x4fc6('0x26')](respondWithResult(_0x10c429,null))[_0x4fc6('0x47')](handleError(_0x10c429,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6ebe1d7..78ab4fe 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 _0x1f5c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1f5c,0xfc));var _0xc1f5=function(_0x3fb2e1,_0x12da93){_0x3fb2e1=_0x3fb2e1-0x0;var _0x14c11b=_0x1f5c[_0x3fb2e1];return _0x14c11b;};'use strict';var _=require(_0xc1f5('0x0'));var util=require(_0xc1f5('0x1'));var logger=require(_0xc1f5('0x2'))(_0xc1f5('0x3'));var moment=require(_0xc1f5('0x4'));var BPromise=require(_0xc1f5('0x5'));var rp=require(_0xc1f5('0x6'));var fs=require('fs');var path=require(_0xc1f5('0x7'));var rimraf=require(_0xc1f5('0x8'));var config=require(_0xc1f5('0x9'));var attributes=require(_0xc1f5('0xa'));module['exports']=function(_0x543a6d,_0x5d2c65){return _0x543a6d[_0xc1f5('0xb')](_0xc1f5('0xc'),attributes,{'tableName':_0xc1f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0281=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','api'];(function(_0x125bd4,_0x129efa){var _0x2ca659=function(_0x296758){while(--_0x296758){_0x125bd4['push'](_0x125bd4['shift']());}};_0x2ca659(++_0x129efa);}(_0x0281,0xa3));var _0x1028=function(_0x1415fc,_0x5cf6a9){_0x1415fc=_0x1415fc-0x0;var _0x59b04e=_0x0281[_0x1415fc];return _0x59b04e;};'use strict';var _=require(_0x1028('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1028('0x1'));var moment=require(_0x1028('0x2'));var BPromise=require(_0x1028('0x3'));var rp=require(_0x1028('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1028('0x5'));var config=require(_0x1028('0x6'));var attributes=require(_0x1028('0x7'));module[_0x1028('0x8')]=function(_0x1ae680,_0x5b557d){return _0x1ae680[_0x1028('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x1028('0xa'),'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 ce07e6c..2172d85 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 _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(_0x4551e2,_0x24cb61){var _0x5735b3=function(_0x4b33b6){while(--_0x4b33b6){_0x4551e2['push'](_0x4551e2['shift']());}};_0x5735b3(++_0x24cb61);}(_0xe706,0xa3));var _0x6e70=function(_0x3c9864,_0x488a3c){_0x3c9864=_0x3c9864-0x0;var _0x416dcd=_0xe706[_0x3c9864];return _0x416dcd;};'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 +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(_0x269561,_0x5151fc){var _0x3fe31f=function(_0x360e50){while(--_0x360e50){_0x269561['push'](_0x269561['shift']());}};_0x3fe31f(++_0x5151fc);}(_0xe706,0xa3));var _0x6e70=function(_0x4a6496,_0x1d022e){_0x4a6496=_0x4a6496-0x0;var _0x399a44=_0xe706[_0x4a6496];return _0x399a44;};'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 04048a4..d949e48 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 _0x018d=['../../components/auth/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/:id','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x35b80e,_0x120fd7){var _0x363914=function(_0x14aaf9){while(--_0x14aaf9){_0x35b80e['push'](_0x35b80e['shift']());}};_0x363914(++_0x120fd7);}(_0x018d,0x79));var _0xd018=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x018d[_0x41d02a];return _0x4c3983;};'use strict';var multer=require(_0xd018('0x0'));var util=require('util');var path=require(_0xd018('0x1'));var timeout=require(_0xd018('0x2'));var express=require(_0xd018('0x3'));var router=express[_0xd018('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd018('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd018('0x6'));var controller=require(_0xd018('0x7'));router['get']('/',auth[_0xd018('0x8')](),controller[_0xd018('0x9')]);router[_0xd018('0xa')]('/describe',auth[_0xd018('0x8')](),controller['describe']);router['get'](_0xd018('0xb'),auth[_0xd018('0x8')](),controller['show']);router[_0xd018('0xa')](_0xd018('0xc'),auth[_0xd018('0x8')](),controller['getAgents']);router[_0xd018('0xa')](_0xd018('0xd'),auth['isAuthenticated'](),controller[_0xd018('0xe')]);router[_0xd018('0xf')]('/',auth[_0xd018('0x8')](),controller[_0xd018('0x10')]);router['post'](_0xd018('0xc'),auth[_0xd018('0x8')](),controller[_0xd018('0x11')]);router[_0xd018('0xf')]('/:id/teams',auth[_0xd018('0x8')](),controller[_0xd018('0x12')]);router['put'](_0xd018('0xb'),auth[_0xd018('0x8')](),controller['update']);router[_0xd018('0x13')](_0xd018('0xb'),auth[_0xd018('0x8')](),controller[_0xd018('0x14')]);router[_0xd018('0x13')](_0xd018('0xc'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xd018('0x13')](_0xd018('0xd'),auth[_0xd018('0x8')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file +var _0x8743=['index','get','isAuthenticated','describe','getAgents','getTeams','post','create','addAgents','/:id/teams','addTeams','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0x3ad0c5,_0x1b16ed){var _0x2cc5eb=function(_0x5dd8e4){while(--_0x5dd8e4){_0x3ad0c5['push'](_0x3ad0c5['shift']());}};_0x2cc5eb(++_0x1b16ed);}(_0x8743,0x7a));var _0x3874=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8743[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var path=require(_0x3874('0x2'));var timeout=require('connect-timeout');var express=require(_0x3874('0x3'));var router=express[_0x3874('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3874('0x5'));var config=require(_0x3874('0x6'));var controller=require(_0x3874('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3874('0x8')]);router[_0x3874('0x9')]('/describe',auth[_0x3874('0xa')](),controller[_0x3874('0xb')]);router[_0x3874('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3874('0x9')]('/:id/users',auth[_0x3874('0xa')](),controller[_0x3874('0xc')]);router['get']('/:id/teams',auth[_0x3874('0xa')](),controller[_0x3874('0xd')]);router[_0x3874('0xe')]('/',auth[_0x3874('0xa')](),controller[_0x3874('0xf')]);router[_0x3874('0xe')]('/:id/users',auth[_0x3874('0xa')](),controller[_0x3874('0x10')]);router[_0x3874('0xe')](_0x3874('0x11'),auth[_0x3874('0xa')](),controller[_0x3874('0x12')]);router['put'](_0x3874('0x13'),auth[_0x3874('0xa')](),controller[_0x3874('0x14')]);router[_0x3874('0x15')](_0x3874('0x13'),auth['isAuthenticated'](),controller[_0x3874('0x16')]);router[_0x3874('0x15')]('/:id/users',auth[_0x3874('0xa')](),controller[_0x3874('0x17')]);router[_0x3874('0x15')](_0x3874('0x11'),auth[_0x3874('0xa')](),controller[_0x3874('0x18')]);module[_0x3874('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 61e90d8..34108f5 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 _0x9aca=['sequelize','name','VIRTUAL','system-','getDataValue','STRING','INTEGER'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9aca,0x1f1));var _0xa9ac=function(_0x30a408,_0x34dd39){_0x30a408=_0x30a408-0x0;var _0x7ffec0=_0x9aca[_0x30a408];return _0x7ffec0;};'use strict';var Sequelize=require(_0xa9ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa9ac('0x1')},'prefix':{'type':Sequelize[_0xa9ac('0x2')],'get':function(_0x1921fa){return _0xa9ac('0x3')+this[_0xa9ac('0x4')](_0xa9ac('0x1'))+'-';}},'description':{'type':Sequelize[_0xa9ac('0x5')]},'callerIdAll':{'type':Sequelize[_0xa9ac('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xa9ac('0x6')]}}; \ No newline at end of file +var _0x21dd=['VIRTUAL','system-','getDataValue','STRING','sequelize','exports','name'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0x21dd,0x1cb));var _0xd21d=function(_0x67487,_0x572468){_0x67487=_0x67487-0x0;var _0xd5dc3=_0x21dd[_0x67487];return _0xd5dc3;};'use strict';var Sequelize=require(_0xd21d('0x0'));module[_0xd21d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd21d('0x2')},'prefix':{'type':Sequelize[_0xd21d('0x3')],'get':function(_0x27d118){return _0xd21d('0x4')+this[_0xd21d('0x5')](_0xd21d('0x2'))+'-';}},'description':{'type':Sequelize[_0xd21d('0x6')]},'callerIdAll':{'type':Sequelize[_0xd21d('0x6')]},'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 d1c11ad..8e2dba0 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 _0xe2cf=['socket.io-emitter','register','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoicePrefixes','autoAssociation','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','addAgents','ids','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','addTeams','findAll','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x487674,_0x6c0c2b){var _0x13986a=function(_0x14c02b){while(--_0x14c02b){_0x487674['push'](_0x487674['shift']());}};_0x13986a(++_0x6c0c2b);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3f0c12,_0xea4b1d){_0x3f0c12=_0x3f0c12-0x0;var _0x2b90e0=_0xe2cf[_0x3f0c12];return _0x2b90e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x15'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfe2c('0x16')](socket);function respondWithStatusCode(_0x4d0a10,_0x2aa7df){_0x2aa7df=_0x2aa7df||0xcc;return function(_0x12e4c4){if(_0x12e4c4){return _0x4d0a10['sendStatus'](_0x2aa7df);}return _0x4d0a10['status'](_0x2aa7df)[_0xfe2c('0x17')]();};}function respondWithResult(_0x3b3ebd,_0x1dbed4){_0x1dbed4=_0x1dbed4||0xc8;return function(_0x56cebc){if(_0x56cebc){return _0x3b3ebd['status'](_0x1dbed4)[_0xfe2c('0x18')](_0x56cebc);}};}function respondWithFilteredResult(_0x96a3a3,_0x135436){return function(_0x23242b){if(_0x23242b){var _0x36aeec=typeof _0x135436[_0xfe2c('0x19')]==='undefined'&&typeof _0x135436[_0xfe2c('0x1a')]===_0xfe2c('0x1b');var _0x1d7852=_0x23242b[_0xfe2c('0x1c')];var _0x55f751=_0x36aeec?0x0:_0x135436[_0xfe2c('0x19')];var _0x59bdeb=_0x36aeec?_0x23242b['count']:_0x135436[_0xfe2c('0x19')]+_0x135436[_0xfe2c('0x1a')];var _0x4bf7c0;if(_0x59bdeb>=_0x1d7852){_0x59bdeb=_0x1d7852;_0x4bf7c0=0xc8;}else{_0x4bf7c0=0xce;}_0x96a3a3[_0xfe2c('0x1d')](_0x4bf7c0);return _0x96a3a3[_0xfe2c('0x1e')]('Content-Range',_0x55f751+'-'+_0x59bdeb+'/'+_0x1d7852)[_0xfe2c('0x18')](_0x23242b);}return null;};}function patchUpdates(_0x5dd54b){return function(_0x4481ff){try{jsonpatch[_0xfe2c('0x1f')](_0x4481ff,_0x5dd54b,!![]);}catch(_0x8b5c0d){return BPromise[_0xfe2c('0x20')](_0x8b5c0d);}return _0x4481ff[_0xfe2c('0x21')]();};}function saveUpdates(_0x2ee3b3,_0x57cd6d){return function(_0x41a545){if(_0x41a545){return _0x41a545[_0xfe2c('0x22')](_0x2ee3b3)[_0xfe2c('0x23')](function(_0x26448c){return _0x26448c;});}return null;};}function removeEntity(_0x3486b5,_0x10afde){return function(_0x53bab0){if(_0x53bab0){return _0x53bab0[_0xfe2c('0x24')]()['then'](function(){var _0x16daf3=_0x53bab0[_0xfe2c('0x25')]({'plain':!![]});var _0x1c35d3='VoicePrefixes';return db[_0xfe2c('0x26')][_0xfe2c('0x24')]({'where':{'type':_0x1c35d3,'resourceId':_0x16daf3['id']}})['then'](function(){return _0x53bab0;});})[_0xfe2c('0x23')](function(){_0x3486b5[_0xfe2c('0x1d')](0xcc)[_0xfe2c('0x17')]();});}};}function handleEntityNotFound(_0x53a8c1,_0x170026){return function(_0x1b7c91){if(!_0x1b7c91){_0x53a8c1['sendStatus'](0x194);}return _0x1b7c91;};}function handleError(_0x481219,_0x1cf1d7){_0x1cf1d7=_0x1cf1d7||0x1f4;return function(_0x13e9a9){logger[_0xfe2c('0x27')](_0x13e9a9[_0xfe2c('0x28')]);if(_0x13e9a9[_0xfe2c('0x29')]){delete _0x13e9a9['name'];}_0x481219[_0xfe2c('0x1d')](_0x1cf1d7)[_0xfe2c('0x2a')](_0x13e9a9);};}exports[_0xfe2c('0x2b')]=function(_0x210c2e,_0x2843a5){var _0xabc499={},_0x69d23a={},_0x3f8696={'count':0x0,'rows':[]};var _0x2e09fe=_[_0xfe2c('0x2c')](db[_0xfe2c('0x2d')][_0xfe2c('0x2e')],function(_0x4e6b92){return{'name':_0x4e6b92[_0xfe2c('0x2f')],'type':_0x4e6b92[_0xfe2c('0x30')][_0xfe2c('0x31')]};});_0x69d23a['model']=_[_0xfe2c('0x2c')](_0x2e09fe,_0xfe2c('0x29'));_0x69d23a['query']=_[_0xfe2c('0x32')](_0x210c2e[_0xfe2c('0x33')]);_0x69d23a[_0xfe2c('0x34')]=_['intersection'](_0x69d23a[_0xfe2c('0x35')],_0x69d23a[_0xfe2c('0x33')]);_0xabc499[_0xfe2c('0x36')]=_[_0xfe2c('0x37')](_0x69d23a[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x210c2e[_0xfe2c('0x33')]['fields']));_0xabc499['attributes']=_0xabc499[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0xabc499[_0xfe2c('0x36')]:_0x69d23a[_0xfe2c('0x35')];if(!_0x210c2e['query'][_0xfe2c('0x3a')]('nolimit')){_0xabc499[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x210c2e['query'][_0xfe2c('0x1a')]);_0xabc499['offset']=qs['offset'](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x19')]);}_0xabc499[_0xfe2c('0x3b')]=qs[_0xfe2c('0x3c')](_0x210c2e[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0xabc499[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x210c2e[_0xfe2c('0x33')],_0x69d23a[_0xfe2c('0x34')]),_0x2e09fe);if(_0x210c2e['query'][_0xfe2c('0x3f')]){_0xabc499[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0xabc499['where'],{'$or':_['map'](_0x2e09fe,function(_0x4e5f0b){if(_0x4e5f0b[_0xfe2c('0x30')]!==_0xfe2c('0x41')){var _0x428b32={};_0x428b32[_0x4e5f0b[_0xfe2c('0x29')]]={'$like':'%'+_0x210c2e['query'][_0xfe2c('0x3f')]+'%'};return _0x428b32;}})});}_0xabc499=_[_0xfe2c('0x40')]({},_0xabc499,_0x210c2e[_0xfe2c('0x42')]);var _0x278acb={'where':_0xabc499[_0xfe2c('0x3d')]};return db['VoicePrefix'][_0xfe2c('0x1c')](_0x278acb)[_0xfe2c('0x23')](function(_0x6055dd){_0x3f8696[_0xfe2c('0x1c')]=_0x6055dd;if(_0x210c2e['query']['includeAll']){_0xabc499[_0xfe2c('0x43')]=[{'all':!![]}];}return db[_0xfe2c('0x2d')]['findAll'](_0xabc499);})[_0xfe2c('0x23')](function(_0x27862d){_0x3f8696[_0xfe2c('0x44')]=_0x27862d;return _0x3f8696;})[_0xfe2c('0x23')](respondWithFilteredResult(_0x2843a5,_0xabc499))['catch'](handleError(_0x2843a5,null));};exports[_0xfe2c('0x45')]=function(_0xfe35e5,_0x331a8a){var _0x466cdb={'raw':![],'where':{'id':_0xfe35e5[_0xfe2c('0x46')]['id']}},_0x122a05={};_0x122a05[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['VoicePrefix'][_0xfe2c('0x2e')]);_0x122a05['query']=_[_0xfe2c('0x32')](_0xfe35e5[_0xfe2c('0x33')]);_0x122a05[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x122a05['model'],_0x122a05['query']);_0x466cdb['attributes']=_['intersection'](_0x122a05['model'],qs[_0xfe2c('0x38')](_0xfe35e5['query']['fields']));_0x466cdb[_0xfe2c('0x36')]=_0x466cdb['attributes'][_0xfe2c('0x39')]?_0x466cdb['attributes']:_0x122a05[_0xfe2c('0x35')];if(_0xfe35e5[_0xfe2c('0x33')][_0xfe2c('0x47')]){_0x466cdb[_0xfe2c('0x43')]=[{'all':!![]}];}_0x466cdb=_[_0xfe2c('0x40')]({},_0x466cdb,_0xfe35e5['options']);return db[_0xfe2c('0x2d')][_0xfe2c('0x48')](_0x466cdb)[_0xfe2c('0x23')](handleEntityNotFound(_0x331a8a,null))['then'](respondWithResult(_0x331a8a,null))[_0xfe2c('0x49')](handleError(_0x331a8a,null));};exports[_0xfe2c('0x24')]=function(_0x579b6b,_0x56f716){return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x579b6b[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x56f716,null))[_0xfe2c('0x23')](removeEntity(_0x56f716,null))[_0xfe2c('0x49')](handleError(_0x56f716,null));};exports['describe']=function(_0x24cdce,_0x2983b0){return db[_0xfe2c('0x2d')]['describe']()['then'](respondWithResult(_0x2983b0,null))[_0xfe2c('0x49')](handleError(_0x2983b0,null));};exports[_0xfe2c('0x4a')]=function(_0x2daa5f,_0x154381){var _0x384766;return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x37e3de){return db[_0xfe2c('0x2d')][_0xfe2c('0x4a')](_0x2daa5f['body'],{'transaction':_0x37e3de})[_0xfe2c('0x23')](function(_0x34e8e0){_0x384766=_0x34e8e0[_0xfe2c('0x25')]({'plain':!![]});return db[_0xfe2c('0x4d')][_0xfe2c('0x48')]({'where':{'id':_0x384766[_0xfe2c('0x4e')]},'raw':!![]})[_0xfe2c('0x23')](function(_0x158e70){return createVoicePrefixExtensions(_0x384766,_0x158e70,_0x37e3de);});});})[_0xfe2c('0x23')](function(){var _0xf54c02=_0x2daa5f[_0xfe2c('0x4f')]['get']({'plain':!![]});if(!_0xf54c02)throw new Error(_0xfe2c('0x50'));if(_0xf54c02['role']===_0xfe2c('0x4f')){var _0x4f4bc6=_0x384766;return db['UserProfileSection']['find']({'where':{'name':_0xfe2c('0x51'),'userProfileId':_0xf54c02['userProfileId']},'raw':!![]})[_0xfe2c('0x23')](function(_0x5f47cc){if(_0x5f47cc&&_0x5f47cc[_0xfe2c('0x52')]===0x0){return db[_0xfe2c('0x26')][_0xfe2c('0x4a')]({'name':_0x4f4bc6[_0xfe2c('0x29')],'resourceId':_0x4f4bc6['id'],'type':_0x5f47cc[_0xfe2c('0x29')],'sectionId':_0x5f47cc['id']},{})[_0xfe2c('0x23')](function(){return _0x384766;});}else{return _0x384766;}})[_0xfe2c('0x49')](function(_0x11d99e){logger[_0xfe2c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11d99e);throw _0x11d99e;});}return _0x384766;})[_0xfe2c('0x23')](respondWithResult(_0x154381,null))[_0xfe2c('0x49')](handleError(_0x154381,null));};function Extension(_0xf9ed12,_0x385c21,_0x366687,_0x5e6d96){this[_0xfe2c('0x53')]=_0xfe2c('0x54');this['exten']=_0xf9ed12;this['app']=_0x366687;this[_0xfe2c('0x30')]=_0xfe2c('0x55');this[_0xfe2c('0x56')]=_0xfe2c('0x57');this[_0xfe2c('0x58')]=_0x385c21;this[_0xfe2c('0x59')]=_0x5e6d96;}function createVoicePrefixExtensions(_0x306f81,_0x510c61,_0x1a2278){return new BPromise(function(_0x33df71,_0x4679){var _0x821144=new Extension(formatPrefixName(_0x306f81[_0xfe2c('0x5a')]),0x1,_0xfe2c('0x5b'),_0xfe2c('0x5c'));_0x821144['VoicePrefixId']=_0x306f81['id'];return db[_0xfe2c('0x4d')]['create'](_0x821144,{'transaction':_0x1a2278})[_0xfe2c('0x23')](function(_0x349d72){var _0x4cede1=_0x349d72[_0xfe2c('0x25')]({'plain':!![]});var _0x5caca7=_[_0xfe2c('0x2c')](addVoicePrefixExtensions(_0x306f81,_0x510c61),function(_0x377064){_0x377064['VoiceExtensionId']=_0x4cede1['id'];_0x377064[_0xfe2c('0x5d')]=_0x306f81['id'];return _0x377064;});return db['VoiceExtension'][_0xfe2c('0x5e')](_0x5caca7,{'transaction':_0x1a2278})['then'](function(_0x23827b){if(!_0x23827b){return _0x4679(_0xfe2c('0x5f'));}else{return _0x33df71(_0x23827b);}})['catch'](function(_0x661798){return _0x4679(_0x661798);});});;});};function addVoicePrefixExtensions(_0x7a0a77,_0x17b42a){var _0xda63e=[];var _0xa47aeb=formatPrefixName(_0x7a0a77['prefix']);_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x2,_0xfe2c('0x61'),_0xfe2c('0x62')+_0x7a0a77[_0xfe2c('0x29')]));if(_0x7a0a77['callerIdAll']){_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,'Set',_0xfe2c('0x63')+_0x7a0a77['callerIdAll']));}else{_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x3,_0xfe2c('0x5b'),_0xfe2c('0x64')));}_0xda63e[_0xfe2c('0x60')](new Extension(_0xa47aeb,0x4,_0xfe2c('0x65'),_0x17b42a[_0xfe2c('0x53')]+','+_0xfe2c('0x66')+(0x8+_0x7a0a77[_0xfe2c('0x29')][_0xfe2c('0x39')])+'}'+','+0x1));return _0xda63e;}function formatPrefixName(_0x21b07a){var _0x3da347='_';for(var _0x2fcb15=0x0;_0x2fcb15<_0x21b07a[_0xfe2c('0x39')];_0x2fcb15++){if(_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)=='-'){_0x3da347+=_0x21b07a[_0xfe2c('0x67')](_0x2fcb15);}else{_0x3da347+='['+_0x21b07a[_0xfe2c('0x67')](_0x2fcb15)+']';}}_0x3da347+='.';return _0x3da347;}exports['update']=function(_0x2f48d5,_0x53513a,_0xdafb46){var _0x5aee3f=_0x2f48d5[_0xfe2c('0x68')];_0x5aee3f['prefix']='system-'+_0x5aee3f[_0xfe2c('0x29')]+'-';return db[_0xfe2c('0x4b')][_0xfe2c('0x4c')](function(_0x40124f){return db[_0xfe2c('0x2d')]['update'](_0x5aee3f,{'where':{'id':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['destroy']({'where':{'VoicePrefixId':_0x5aee3f['id']},'transaction':_0x40124f})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x4d')]['find']({'where':{'id':_0x5aee3f['VoiceExtensionId']},'raw':!![]})['then'](function(_0x14d619){return createVoicePrefixExtensions(_0x5aee3f,_0x14d619,_0x40124f);});});});})[_0xfe2c('0x23')](function(){return db[_0xfe2c('0x2d')]['findById'](_0x5aee3f['id']);})['then'](respondWithResult(_0x53513a,null))[_0xfe2c('0x49')](handleError(_0x53513a,null));};exports[_0xfe2c('0x69')]=function(_0x56a3be,_0x3508c2,_0x9c07d5){return db[_0xfe2c('0x2d')][_0xfe2c('0x48')]({'where':{'id':_0x56a3be['params']['id']}})['then'](handleEntityNotFound(_0x3508c2,null))[_0xfe2c('0x23')](function(_0x414b87){if(_0x414b87){return _0x414b87['addAgents'](_0x56a3be[_0xfe2c('0x68')][_0xfe2c('0x6a')],_['omit'](_0x56a3be[_0xfe2c('0x68')],['ids','id'])||{})['spread'](function(_0x1f5190){for(var _0x157ad0=0x0;_0x157ad0<_0x56a3be['body'][_0xfe2c('0x6a')][_0xfe2c('0x39')];_0x157ad0+=0x1){socket['emit'](_0xfe2c('0x6b'),{'UserId':Number(_0x56a3be['body'][_0xfe2c('0x6a')][_0x157ad0]),'VoicePrefixId':Number(_0x56a3be[_0xfe2c('0x46')]['id'])});}return _0x1f5190;});}})[_0xfe2c('0x23')](respondWithResult(_0x3508c2,null))[_0xfe2c('0x49')](handleError(_0x3508c2,null));};exports['removeAgents']=function(_0x10e0a0,_0x85c898,_0x5317e4){return db[_0xfe2c('0x2d')]['find']({'where':{'id':_0x10e0a0[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x85c898,null))[_0xfe2c('0x23')](function(_0x23311a){if(_0x23311a){return _0x23311a['removeAgents'](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])[_0xfe2c('0x23')](function(){if(_[_0xfe2c('0x6c')](_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')])){for(var _0x52627b=0x0;_0x52627b<_0x10e0a0[_0xfe2c('0x33')]['ids']['length'];_0x52627b+=0x1){socket[_0xfe2c('0x6d')](_0xfe2c('0x6e'),{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')][_0x52627b]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}}else{socket[_0xfe2c('0x6d')]('userVoicePrefix:remove',{'UserId':Number(_0x10e0a0[_0xfe2c('0x33')][_0xfe2c('0x6a')]),'VoicePrefixId':Number(_0x10e0a0[_0xfe2c('0x46')]['id'])});}});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x85c898,null))['catch'](handleError(_0x85c898,null));};exports[_0xfe2c('0x6f')]=function(_0x4f595d,_0x392232,_0x114553){var _0x512137={};var _0x1baccd={};var _0x540a67;var _0x49f9e1;return db['VoicePrefix'][_0xfe2c('0x70')]({'where':{'id':_0x4f595d[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x392232,null))[_0xfe2c('0x23')](function(_0x4147fc){if(_0x4147fc){_0x540a67=_0x4147fc;_0x1baccd[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db[_0xfe2c('0x71')][_0xfe2c('0x2e')]);_0x1baccd['query']=_['keys'](_0x4f595d[_0xfe2c('0x33')]);_0x1baccd[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x1baccd[_0xfe2c('0x35')],_0x1baccd[_0xfe2c('0x33')]);_0x512137[_0xfe2c('0x36')]=_['intersection'](_0x1baccd[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x38')]));_0x512137[_0xfe2c('0x36')]=_0x512137[_0xfe2c('0x36')][_0xfe2c('0x39')]?_0x512137[_0xfe2c('0x36')]:_0x1baccd[_0xfe2c('0x35')];_0x512137['order']=qs[_0xfe2c('0x3c')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x512137[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x4f595d['query'],_0x1baccd[_0xfe2c('0x34')]));if(_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]){_0x512137[_0xfe2c('0x3d')]=_['merge'](_0x512137['where'],{'$or':_[_0xfe2c('0x2c')](_0x512137[_0xfe2c('0x36')],function(_0x312e84){var _0x57643d={};_0x57643d[_0x312e84]={'$like':'%'+_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x57643d;})});}_0x512137=_[_0xfe2c('0x40')]({},_0x512137,_0x4f595d['options']);return _0x540a67[_0xfe2c('0x6f')](_0x512137);}})[_0xfe2c('0x23')](function(_0x1193c2){if(_0x1193c2){_0x49f9e1=_0x1193c2[_0xfe2c('0x39')];if(!_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x512137[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x4f595d['query'][_0xfe2c('0x1a')]);_0x512137['offset']=qs[_0xfe2c('0x19')](_0x4f595d[_0xfe2c('0x33')][_0xfe2c('0x19')]);}return _0x540a67['getAgents'](_0x512137);}})['then'](function(_0x4f39af){if(_0x4f39af){return _0x4f39af?{'count':_0x49f9e1,'rows':_0x4f39af}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x392232,null))[_0xfe2c('0x49')](handleError(_0x392232,null));};exports[_0xfe2c('0x73')]=function(_0x3b07e7,_0x37e3d8,_0x27d025){var _0x23e1db={};var _0x14ebf0={};var _0x20c22a;var _0xb283e0;return db[_0xfe2c('0x2d')][_0xfe2c('0x70')]({'where':{'id':_0x3b07e7[_0xfe2c('0x46')]['id']}})['then'](handleEntityNotFound(_0x37e3d8,null))[_0xfe2c('0x23')](function(_0x532f06){if(_0x532f06){_0x20c22a=_0x532f06;_0x14ebf0[_0xfe2c('0x35')]=_[_0xfe2c('0x32')](db['Team']['rawAttributes']);_0x14ebf0['query']=_[_0xfe2c('0x32')](_0x3b07e7[_0xfe2c('0x33')]);_0x14ebf0[_0xfe2c('0x34')]=_[_0xfe2c('0x37')](_0x14ebf0[_0xfe2c('0x35')],_0x14ebf0[_0xfe2c('0x33')]);_0x23e1db['attributes']=_['intersection'](_0x14ebf0[_0xfe2c('0x35')],qs[_0xfe2c('0x38')](_0x3b07e7[_0xfe2c('0x33')]['fields']));_0x23e1db[_0xfe2c('0x36')]=_0x23e1db['attributes'][_0xfe2c('0x39')]?_0x23e1db[_0xfe2c('0x36')]:_0x14ebf0[_0xfe2c('0x35')];_0x23e1db[_0xfe2c('0x3b')]=qs['sort'](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3c')]);_0x23e1db[_0xfe2c('0x3d')]=qs[_0xfe2c('0x34')](_[_0xfe2c('0x3e')](_0x3b07e7['query'],_0x14ebf0[_0xfe2c('0x34')]));if(_0x3b07e7[_0xfe2c('0x33')]['filter']){_0x23e1db[_0xfe2c('0x3d')]=_[_0xfe2c('0x40')](_0x23e1db[_0xfe2c('0x3d')],{'$or':_[_0xfe2c('0x2c')](_0x23e1db[_0xfe2c('0x36')],function(_0x50f27e){var _0x995423={};_0x995423[_0x50f27e]={'$like':'%'+_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x3f')]+'%'};return _0x995423;})});}_0x23e1db=_[_0xfe2c('0x40')]({},_0x23e1db,_0x3b07e7[_0xfe2c('0x42')]);return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x142bf1){if(_0x142bf1){_0xb283e0=_0x142bf1['length'];if(!_0x3b07e7['query'][_0xfe2c('0x3a')](_0xfe2c('0x72'))){_0x23e1db[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x3b07e7[_0xfe2c('0x33')][_0xfe2c('0x1a')]);_0x23e1db['offset']=qs['offset'](_0x3b07e7['query'][_0xfe2c('0x19')]);}return _0x20c22a[_0xfe2c('0x73')](_0x23e1db);}})[_0xfe2c('0x23')](function(_0x2351d5){if(_0x2351d5){return _0x2351d5?{'count':_0xb283e0,'rows':_0x2351d5}:null;}})[_0xfe2c('0x23')](respondWithResult(_0x37e3d8,null))[_0xfe2c('0x49')](handleError(_0x37e3d8,null));};exports[_0xfe2c('0x74')]=function(_0x3f2102,_0x1cc35d,_0x246d5d){var _0x5f34d3=_0x3f2102[_0xfe2c('0x68')][_0xfe2c('0x6a')];var _0x14631f;return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x5f34d3},'attributes':['id'],'include':[{'model':db[_0xfe2c('0x71')],'as':_0xfe2c('0x76'),'attributes':['id',_0xfe2c('0x29'),_0xfe2c('0x77'),_0xfe2c('0x78'),'interface'],'raw':!![]}]})['then'](function(_0x5f4744){if(_0x5f4744){_0x14631f=_0x5f4744;var _0x18ad4f=_[_0xfe2c('0x79')](_0x5f4744,function(_0x24faae){var _0x450e1d=_0x24faae[_0xfe2c('0x25')]({'plain':!![]});return _0x450e1d[_0xfe2c('0x76')];});return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3f2102['params']['id']}})[_0xfe2c('0x23')](function(_0x552cd3){return db['sequelize'][_0xfe2c('0x4c')](function(_0x32ed72){return _0x552cd3[_0xfe2c('0x74')](_0x5f34d3,{'transaction':_0x32ed72})['then'](function(){return BPromise[_0xfe2c('0x7a')](_0x14631f,function(_0x4f946d){return db[_0xfe2c('0x7b')][_0xfe2c('0x7c')]({'TeamId':_0x4f946d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},{'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){return BPromise['each'](_0x18ad4f,function(_0x42495d){return db[_0xfe2c('0x7d')]['findOrCreate']({'where':{'UserId':_0x42495d['id'],'VoicePrefixId':_0x3f2102[_0xfe2c('0x46')]['id']},'transaction':_0x32ed72});});})[_0xfe2c('0x23')](function(){_0x18ad4f[_0xfe2c('0x7e')](function(_0x1682b2){socket[_0xfe2c('0x6d')]('userVoicePrefix:save',{'UserId':_0x1682b2['id'],'VoicePrefixId':_0x552cd3['id']});});});});});}})[_0xfe2c('0x23')](respondWithStatusCode(_0x1cc35d,null))[_0xfe2c('0x49')](handleError(_0x1cc35d,null));};exports[_0xfe2c('0x7f')]=function(_0x3027f9,_0x3d6fba,_0x2523cc){return db['Team'][_0xfe2c('0x75')]({'where':{'id':_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe2c('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3d6fba,null))[_0xfe2c('0x23')](function(_0x5cbd7f){var _0x3dba12=_[_0xfe2c('0x2c')](_0x5cbd7f,'id');var _0x40be3c=[];var _0x4dd915=[];var _0x6efab6=squel['select']();_0x6efab6[_0xfe2c('0x80')](_0xfe2c('0x81'))[_0xfe2c('0x82')]('team_has_voice_prefixes','tq')[_0xfe2c('0x83')](_0xfe2c('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfe2c('0x3d')](_0xfe2c('0x85'),_0x3027f9['params']['id']);for(var _0x3b6535=0x0;_0x3b6535<_0x5cbd7f[_0xfe2c('0x39')];_0x3b6535+=0x1){let _0x1d712e=_0x5cbd7f[_0x3b6535];for(var _0x14696e=0x0;_0x14696e<_0x1d712e[_0xfe2c('0x76')][_0xfe2c('0x39')];_0x14696e+=0x1){let _0x252527=_0x1d712e[_0xfe2c('0x76')][_0x14696e];var _0x1c0877=_0x6efab6[_0xfe2c('0x86')]();_0x1c0877[_0xfe2c('0x3d')](_0xfe2c('0x87'),_0x252527['id']);_0x4dd915[_0xfe2c('0x60')](db[_0xfe2c('0x4b')][_0xfe2c('0x33')](_0x1c0877[_0xfe2c('0x88')](),{'type':db['sequelize'][_0xfe2c('0x89')]['SELECT']})[_0xfe2c('0x23')](function(_0x5f3a0f){if(_0x5f3a0f[_0xfe2c('0x39')]===0x1){return _0x252527['id'];}else{var _0x329de0=_[_0xfe2c('0x8a')](_[_0xfe2c('0x2c')](_0x5f3a0f,_0xfe2c('0x8b')),function(_0x5b6e4f){return _[_0xfe2c('0x8c')](_0x3dba12,_0x5b6e4f);});if(_0x329de0){return _0x252527['id'];}}}));}}return BPromise[_0xfe2c('0x8d')](_0x4dd915)[_0xfe2c('0x23')](function(_0x57d173){_0x40be3c=_(_0x40be3c)['union'](_0x57d173)[_0xfe2c('0x8e')]()[_0xfe2c('0x8f')]();return db['VoicePrefix'][_0xfe2c('0x48')]({'where':{'id':_0x3027f9[_0xfe2c('0x46')]['id']}})[_0xfe2c('0x23')](function(_0x2f3af6){return db[_0xfe2c('0x4b')]['transaction'](function(_0x36abbf){return _0x2f3af6[_0xfe2c('0x7f')](_0x3027f9[_0xfe2c('0x33')][_0xfe2c('0x6a')],{'transaction':_0x36abbf})[_0xfe2c('0x23')](function(){if(!_[_0xfe2c('0x90')](_0x40be3c)){return _0x2f3af6[_0xfe2c('0x91')](_0x40be3c,{'transaction':_0x36abbf});}})[_0xfe2c('0x23')](function(){_0x40be3c['forEach'](function(_0x29c9ef){socket['emit'](_0xfe2c('0x6e'),{'UserId':_0x29c9ef,'VoicePrefixId':_0x2f3af6['id']});});});});});});})[_0xfe2c('0x23')](respondWithStatusCode(_0x3d6fba,null))[_0xfe2c('0x49')](handleError(_0x3d6fba,null));}; \ No newline at end of file +var _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x3266,0x6a));var _0x6326=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x3266[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index fcb4a4f..466647b 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 _0xf096=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xf096,0x1dd));var _0x6f09=function(_0x12a764,_0x3aabdf){_0x12a764=_0x12a764-0x0;var _0x3e2248=_0xf096[_0x12a764];return _0x3e2248;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6f09('0x0'))['db'][_0x6f09('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6f09('0x2')](0x0);var events={'afterCreate':_0x6f09('0x3'),'afterUpdate':_0x6f09('0x4'),'afterDestroy':_0x6f09('0x5')};function emitEvent(_0x715531){return function(_0x559106,_0x562471,_0x2a412a){VoicePrefixEvents[_0x6f09('0x6')](_0x715531+':'+_0x559106['id'],_0x559106);VoicePrefixEvents['emit'](_0x715531,_0x559106);_0x2a412a(null);};}for(var e in events){if(events[_0x6f09('0x7')](e)){var event=events[e];VoicePrefix[_0x6f09('0x8')](e,emitEvent(event));}}module[_0x6f09('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x45ac=['VoicePrefix','setMaxListeners','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45ac,0x1be));var _0xc45a=function(_0x5cd395,_0x507285){_0x5cd395=_0x5cd395-0x0;var _0x141227=_0x45ac[_0x5cd395];return _0x141227;};'use strict';var EventEmitter=require(_0xc45a('0x0'));var VoicePrefix=require(_0xc45a('0x1'))['db'][_0xc45a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc45a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc45a('0x4'),'afterDestroy':_0xc45a('0x5')};function emitEvent(_0x29e959){return function(_0x41e1a1,_0x4773ce,_0x232473){VoicePrefixEvents['emit'](_0x29e959+':'+_0x41e1a1['id'],_0x41e1a1);VoicePrefixEvents['emit'](_0x29e959,_0x41e1a1);_0x232473(null);};}for(var e in events){if(events[_0xc45a('0x6')](e)){var event=events[e];VoicePrefix[_0xc45a('0x7')](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 aae611d..e146b92 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 _0xc67b=['VoicePrefix','voice_prefixes','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','define'];(function(_0x5bc729,_0x55abab){var _0x29446c=function(_0x54c0d1){while(--_0x54c0d1){_0x5bc729['push'](_0x5bc729['shift']());}};_0x29446c(++_0x55abab);}(_0xc67b,0x1c5));var _0xbc67=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc67b[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xbc67('0x0'));var logger=require(_0xbc67('0x1'))(_0xbc67('0x2'));var moment=require('moment');var BPromise=require(_0xbc67('0x3'));var rp=require(_0xbc67('0x4'));var fs=require('fs');var path=require(_0xbc67('0x5'));var rimraf=require(_0xbc67('0x6'));var config=require('../../config/environment');var attributes=require(_0xbc67('0x7'));module['exports']=function(_0x21b15c,_0x45410d){return _0x21b15c[_0xbc67('0x8')](_0xbc67('0x9'),attributes,{'tableName':_0xbc67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7086=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7086,0xe5));var _0x6708=function(_0x2cddb1,_0x523c57){_0x2cddb1=_0x2cddb1-0x0;var _0x3f0ca7=_0x7086[_0x2cddb1];return _0x3f0ca7;};'use strict';var _=require(_0x6708('0x0'));var util=require('util');var logger=require(_0x6708('0x1'))('api');var moment=require(_0x6708('0x2'));var BPromise=require(_0x6708('0x3'));var rp=require(_0x6708('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6708('0x5'));var config=require(_0x6708('0x6'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x3a6483,_0x25feb1){return _0x3a6483[_0x6708('0x7')](_0x6708('0x8'),attributes,{'tableName':_0x6708('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 0f01297..a3aeaa9 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 _0x46c1=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x46c1,0x7c));var _0x146c=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0x46c1[_0x24d24e];return _0x20e068;};'use strict';var _=require('lodash');var util=require(_0x146c('0x0'));var moment=require(_0x146c('0x1'));var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require(_0x146c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x146c('0xa')]=_[_0x146c('0xb')](config[_0x146c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x146c('0xc'))(new Redis(config['redis']));require(_0x146c('0xd'))[_0x146c('0xe')](socket);function respondWithRpcPromise(_0x515e82,_0x1773d3,_0x24ad06){return new BPromise(function(_0x450b65,_0x1cc0c6){return client['request'](_0x515e82,_0x24ad06)[_0x146c('0xf')](function(_0x4de290){logger[_0x146c('0x10')](_0x146c('0x11'),_0x1773d3,_0x146c('0x12'));logger['debug'](_0x146c('0x13'),_0x1773d3,'request\x20sent',JSON[_0x146c('0x14')](_0x4de290));if(_0x4de290['error']){if(_0x4de290[_0x146c('0x15')][_0x146c('0x16')]===0x1f4){logger[_0x146c('0x15')](_0x146c('0x11'),_0x1773d3,_0x4de290['error'][_0x146c('0x17')]);return _0x1cc0c6(_0x4de290[_0x146c('0x15')]['message']);}logger[_0x146c('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1773d3,_0x4de290['error'][_0x146c('0x17')]);return _0x450b65(_0x4de290['error'][_0x146c('0x17')]);}else{logger[_0x146c('0x10')](_0x146c('0x11'),_0x1773d3,'request\x20sent');_0x450b65(_0x4de290[_0x146c('0x18')][_0x146c('0x17')]);}})[_0x146c('0x19')](function(_0x46b94f){logger[_0x146c('0x15')](_0x146c('0x11'),_0x1773d3,_0x46b94f);_0x1cc0c6(_0x46b94f);});});} \ No newline at end of file +var _0x9666=['defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1d64d5,_0x281c57){var _0x1c23f4=function(_0x4b8365){while(--_0x4b8365){_0x1d64d5['push'](_0x1d64d5['shift']());}};_0x1c23f4(++_0x281c57);}(_0x9666,0x17a));var _0x6966=function(_0x45edfb,_0x1f5db5){_0x45edfb=_0x45edfb-0x0;var _0xc8cf5b=_0x9666[_0x45edfb];return _0xc8cf5b;};'use strict';var _=require(_0x6966('0x0'));var util=require(_0x6966('0x1'));var moment=require(_0x6966('0x2'));var BPromise=require(_0x6966('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6966('0x4'));var db=require(_0x6966('0x5'))['db'];var utils=require(_0x6966('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6966('0x7'));var jayson=require(_0x6966('0x8'));var client=jayson[_0x6966('0x9')][_0x6966('0xa')]({'port':0x232a});config[_0x6966('0xb')]=_[_0x6966('0xc')](config['redis'],{'host':_0x6966('0xd'),'port':0x18eb});var socket=require(_0x6966('0xe'))(new Redis(config[_0x6966('0xb')]));require('./voicePrefix.socket')[_0x6966('0xf')](socket);function respondWithRpcPromise(_0x377666,_0x150ca1,_0x47578b){return new BPromise(function(_0x2961fd,_0x3bb5b1){return client[_0x6966('0x10')](_0x377666,_0x47578b)[_0x6966('0x11')](function(_0x276f89){logger[_0x6966('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x150ca1,'request\x20sent');logger['debug'](_0x6966('0x13'),_0x150ca1,_0x6966('0x14'),JSON[_0x6966('0x15')](_0x276f89));if(_0x276f89['error']){if(_0x276f89['error']['code']===0x1f4){logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);return _0x3bb5b1(_0x276f89[_0x6966('0x16')]['message']);}logger[_0x6966('0x16')](_0x6966('0x17'),_0x150ca1,_0x276f89['error'][_0x6966('0x18')]);return _0x2961fd(_0x276f89[_0x6966('0x16')][_0x6966('0x18')]);}else{logger['info'](_0x6966('0x17'),_0x150ca1,'request\x20sent');_0x2961fd(_0x276f89[_0x6966('0x19')]['message']);}})['catch'](function(_0x5de186){logger[_0x6966('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x150ca1,_0x5de186);_0x3bb5b1(_0x5de186);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d096667..6c5e6b1 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 _0x2cbd=['./voicePrefix.events','save','update','emit','register','voicePrefix:'];(function(_0x52a370,_0x286049){var _0x1eab8e=function(_0x139f0f){while(--_0x139f0f){_0x52a370['push'](_0x52a370['shift']());}};_0x1eab8e(++_0x286049);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x2cbd[_0x296897];return _0x2b44ab;};'use strict';var VoicePrefixEvents=require(_0xd2cb('0x0'));var events=[_0xd2cb('0x1'),'remove',_0xd2cb('0x2')];function createListener(_0x34564b,_0x138022){return function(_0x4b1b3f){_0x138022[_0xd2cb('0x3')](_0x34564b,_0x4b1b3f);};}function removeListener(_0x3fe222,_0x480683){return function(){VoicePrefixEvents['removeListener'](_0x3fe222,_0x480683);};}exports[_0xd2cb('0x4')]=function(_0x20ff39){for(var _0x3894f9=0x0,_0x1ae725=events['length'];_0x3894f9<_0x1ae725;_0x3894f9++){var _0x2c1ead=events[_0x3894f9];var _0x5ef97c=createListener(_0xd2cb('0x5')+_0x2c1ead,_0x20ff39);VoicePrefixEvents['on'](_0x2c1ead,_0x5ef97c);}}; \ No newline at end of file +var _0x876b=['emit','removeListener','register','voicePrefix:','remove','update'];(function(_0x15523b,_0x388fe6){var _0x409eed=function(_0x2e79c4){while(--_0x2e79c4){_0x15523b['push'](_0x15523b['shift']());}};_0x409eed(++_0x388fe6);}(_0x876b,0x1ba));var _0xb876=function(_0x1065a0,_0xc8764d){_0x1065a0=_0x1065a0-0x0;var _0x3072a2=_0x876b[_0x1065a0];return _0x3072a2;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xb876('0x0'),_0xb876('0x1')];function createListener(_0x5c6895,_0x569fc2){return function(_0x34a150){_0x569fc2[_0xb876('0x2')](_0x5c6895,_0x34a150);};}function removeListener(_0x4e24d3,_0x23429e){return function(){VoicePrefixEvents[_0xb876('0x3')](_0x4e24d3,_0x23429e);};}exports[_0xb876('0x4')]=function(_0x5e1da8){for(var _0x275125=0x0,_0x4353cf=events['length'];_0x275125<_0x4353cf;_0x275125++){var _0x309bfd=events[_0x275125];var _0xcbf343=createListener(_0xb876('0x5')+_0x309bfd,_0x5e1da8);VoicePrefixEvents['on'](_0x309bfd,_0xcbf343);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8c4dc4e..41f466f 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0xb10b,0x12a));var _0xbb10=function(_0x6dc241,_0x3d6db7){_0x6dc241=_0x6dc241-0x0;var _0xac50e7=_0xb10b[_0x6dc241];return _0xac50e7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _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(_0x32f396,_0x9f911e){var _0x5f1857=function(_0x16e2ab){while(--_0x16e2ab){_0x32f396['push'](_0x32f396['shift']());}};_0x5f1857(++_0x9f911e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9e49d45..4488560 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 _0xfb69=['preview','booked','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','FLOAT','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','default','STRING','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod'];(function(_0x29cc91,_0x4b6a8b){var _0x60e29f=function(_0x420568){while(--_0x420568){_0x29cc91['push'](_0x29cc91['shift']());}};_0x60e29f(++_0x4b6a8b);}(_0xfb69,0x1d7));var _0x9fb6=function(_0x295c3d,_0x345ebd){_0x295c3d=_0x295c3d-0x0;var _0x5a9b49=_0xfb69[_0x295c3d];return _0x5a9b49;};'use strict';var Sequelize=require(_0x9fb6('0x0'));module[_0x9fb6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9fb6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x4'),_0x9fb6('0x5')),'allowNull':![],'defaultValue':_0x9fb6('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x9fb6('0x6')},'announce':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9fb6('0x3')]('rr','ringall',_0x9fb6('0x8'),_0x9fb6('0x9'),_0x9fb6('0xa'),_0x9fb6('0xb'),_0x9fb6('0xc'),_0x9fb6('0xd'),_0x9fb6('0xe')),'allowNull':![],'defaultValue':_0x9fb6('0xf'),'set':function(_0x33054){this[_0x9fb6('0x10')](_0x9fb6('0x11'),_0x33054?_0x33054:_0x9fb6('0xb'));},'get':function(){var _0x48bb6e=this[_0x9fb6('0x12')](_0x9fb6('0x13'));var _0x4fba81=this[_0x9fb6('0x12')](_0x9fb6('0x14'));var _0x42f1ee=this[_0x9fb6('0x12')](_0x9fb6('0x11'));if(_0x48bb6e===_0x9fb6('0x5')){if(_0x4fba81===_0x9fb6('0x15')){return null;}if(_0x4fba81===_0x9fb6('0x16')&&!['rrmemory','roundrobin']['includes'](_0x42f1ee)){this[_0x9fb6('0x10')](_0x9fb6('0x11'),_0x9fb6('0xb'));}}return _0x42f1ee;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9fb6('0x17')](0xb)},'timeout':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9fb6('0x7')]},'weight':{'type':Sequelize[_0x9fb6('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':_0x9fb6('0x18')},'autopause':{'type':Sequelize['ENUM'](_0x9fb6('0x18'),'no',_0x9fb6('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9fb6('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9fb6('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9fb6('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9fb6('0x7')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9fb6('0x7')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9fb6('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x9fb6('0x18'),'no',_0x9fb6('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9fb6('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x9fb6('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9fb6('0x7')]},'queue_youarenext':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9fb6('0x7')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x9fb6('0x7')]},'queue_quantity2':{'type':Sequelize[_0x9fb6('0x7')]},'queue_periodic_announce':{'type':Sequelize[_0x9fb6('0x7')]},'queue_less_than':{'type':Sequelize[_0x9fb6('0x7')]},'periodic_announce':{'type':Sequelize[_0x9fb6('0x1b')],'set':function(_0x2a9f21){this[_0x9fb6('0x10')](_0x9fb6('0x1c'),_0x2a9f21?_0x2a9f21['join'](','):[]);},'get':function(){return this[_0x9fb6('0x12')](_0x9fb6('0x1c'))?this[_0x9fb6('0x12')](_0x9fb6('0x1c'))[_0x9fb6('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x9fb6('0x18'),'set':function(_0x428597){this[_0x9fb6('0x10')]('joinempty',_0x428597?_0x428597['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x9fb6('0x1e'))?this[_0x9fb6('0x12')]('joinempty')[_0x9fb6('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':'no','set':function(_0x2f198a){this[_0x9fb6('0x10')]('leavewhenempty',_0x2f198a?_0x2f198a[_0x9fb6('0x1f')](','):undefined);},'get':function(){return this[_0x9fb6('0x12')]('leavewhenempty')?this[_0x9fb6('0x12')](_0x9fb6('0x20'))[_0x9fb6('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9fb6('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9fb6('0x7')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':0x0,'set':function(_0xefc17e){this[_0x9fb6('0x10')](_0x9fb6('0x22'),_0xefc17e);if(_0xefc17e){if(this[_0x9fb6('0x12')](_0x9fb6('0x23'))<0x2){this[_0x9fb6('0x10')](_0x9fb6('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9fb6('0x24')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x9fb6('0x25'),_0x9fb6('0x26'),'predictive',_0x9fb6('0x16')),'defaultValue':_0x9fb6('0x25'),'comment':_0x9fb6('0x27')},'dialLimitChannel':{'type':Sequelize[_0x9fb6('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x9fb6('0x17')](0x4)[_0x9fb6('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9fb6('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x9fb6('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x9fb6('0x2a'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9fb6('0x2b')](0x2)[_0x9fb6('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9fb6('0x7')]},'dialOriginateTimeout':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x9fb6('0x2d'),'comment':_0x9fb6('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x2f')},'dialQueueProject':{'type':Sequelize[_0x9fb6('0x7')],'comment':_0x9fb6('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9fb6('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9fb6('0x28')],'defaultValue':0x3,'comment':_0x9fb6('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9fb6('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9fb6('0x35')},'dialPrefix':{'type':Sequelize[_0x9fb6('0x7')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x36'),_0x9fb6('0x37'),_0x9fb6('0x38')),'defaultValue':_0x9fb6('0x36')},'dialAMDActive':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9fb6('0x17')](0x9)[_0x9fb6('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9fb6('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x9fb6('0x17')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9fb6('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9fb6('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9fb6('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x9fb6('0x17')](0x9)[_0x9fb6('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9fb6('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9fb6('0x17')](0x9)[_0x9fb6('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9fb6('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9fb6('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9fb6('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9fb6('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9fb6('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9fb6('0x17')](0x9)[_0x9fb6('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9fb6('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':0x0,'comment':_0x9fb6('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9fb6('0x3')](_0x9fb6('0x42'),_0x9fb6('0x43')),'defaultValue':_0x9fb6('0x42')},'dialQueueProject2':{'type':Sequelize[_0x9fb6('0x7')],'comment':_0x9fb6('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9fb6('0x44')},'dialCutDigit':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9fb6('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9fb6('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9fb6('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9fb6('0x17')](0x5)[_0x9fb6('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9fb6('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9fb6('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':![],'comment':_0x9fb6('0x50'),'set':function(_0x2c8918){if(!_0x2c8918)this[_0x9fb6('0x10')](_0x9fb6('0x51'),null);this['setDataValue']('mandatoryDisposition',_0x2c8918);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9fb6('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9fb6('0x17')](0x3)[_0x9fb6('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x946f=['leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','type','getDataValue','booked','roundrobin','INTEGER','yes','once','TEXT','join','periodic_announce','split','leavewhenempty','acw','Active/Disactive\x20Campaign','preview','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\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,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','default','ENUM','ringall'];(function(_0x4eb6dc,_0x3dc261){var _0x3068b4=function(_0x49f403){while(--_0x49f403){_0x4eb6dc['push'](_0x4eb6dc['shift']());}};_0x3068b4(++_0x3dc261);}(_0x946f,0xe2));var _0xf946=function(_0xba60f1,_0x3b111b){_0xba60f1=_0xba60f1-0x0;var _0x120520=_0x946f[_0xba60f1];return _0x120520;};'use strict';var Sequelize=require(_0xf946('0x0'));module[_0xf946('0x1')]={'name':{'type':Sequelize[_0xf946('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf946('0x3'),_0xf946('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xf946('0x5')},'announce':{'type':Sequelize[_0xf946('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf946('0x6')]('rr',_0xf946('0x7'),_0xf946('0x8'),_0xf946('0x9'),_0xf946('0xa'),'rrmemory',_0xf946('0xb'),_0xf946('0xc'),_0xf946('0xd')),'allowNull':![],'defaultValue':_0xf946('0x7'),'set':function(_0x1a9989){this[_0xf946('0xe')](_0xf946('0xf'),_0x1a9989?_0x1a9989:'rrmemory');},'get':function(){var _0x133e68=this['getDataValue'](_0xf946('0x10'));var _0x4e771a=this['getDataValue']('dialMethod');var _0x34823c=this[_0xf946('0x11')](_0xf946('0xf'));if(_0x133e68==='outbound'){if(_0x4e771a==='preview'){return null;}if(_0x4e771a===_0xf946('0x12')&&!['rrmemory',_0xf946('0x13')]['includes'](_0x34823c)){this[_0xf946('0xe')]('strategy','rrmemory');}}return _0x34823c;}},'servicelevel':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf946('0x14')](0xb)},'timeout':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf946('0x2')]},'weight':{'type':Sequelize[_0xf946('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':_0xf946('0x15')},'autopause':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf946('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf946('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xf946('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf946('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf946('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xf946('0x6')]('yes','no',_0xf946('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xf946('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf946('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf946('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf946('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf946('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf946('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xf946('0x2')]},'periodic_announce':{'type':Sequelize[_0xf946('0x17')],'set':function(_0x5aa87d){this[_0xf946('0xe')]('periodic_announce',_0x5aa87d?_0x5aa87d[_0xf946('0x18')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0xf946('0x11')](_0xf946('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xf946('0x2')],'defaultValue':_0xf946('0x15'),'set':function(_0x3a0de3){this[_0xf946('0xe')]('joinempty',_0x3a0de3?_0x3a0de3[_0xf946('0x18')](','):undefined);},'get':function(){return this[_0xf946('0x11')]('joinempty')?this[_0xf946('0x11')]('joinempty')[_0xf946('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf946('0x2')],'defaultValue':'no','set':function(_0x18b272){this['setDataValue'](_0xf946('0x1b'),_0x18b272?_0x18b272[_0xf946('0x18')](','):undefined);},'get':function(){return this[_0xf946('0x11')](_0xf946('0x1b'))?this[_0xf946('0x11')](_0xf946('0x1b'))[_0xf946('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf946('0x2')]},'description':{'type':Sequelize[_0xf946('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3a0670){this['setDataValue'](_0xf946('0x1c'),_0x3a0670);if(_0x3a0670){if(this[_0xf946('0x11')]('wrapuptime')<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf946('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf946('0x1d')},'dialMethod':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x1e'),_0xf946('0x1f'),'power','predictive',_0xf946('0x12')),'defaultValue':_0xf946('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xf946('0x14')](0x4)[_0xf946('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf946('0x21')},'dialLimitQueue':{'type':Sequelize[_0xf946('0x14')](0x4)[_0xf946('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf946('0x22')},'dialPowerLevel':{'type':Sequelize[_0xf946('0x23')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf946('0x24')},'dialPredictiveOptimization':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x25'),_0xf946('0x26')),'defaultValue':_0xf946('0x26'),'comment':_0xf946('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf946('0x23')](0x2)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf946('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf946('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf946('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf946('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xf946('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x2b')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x2c')},'dialBusyMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'comment':_0xf946('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf946('0x31')},'dialTimezone':{'type':Sequelize[_0xf946('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xf946('0x32')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xf946('0x33'),_0xf946('0x34'),_0xf946('0x35')),'defaultValue':_0xf946('0x33')},'dialAMDActive':{'type':Sequelize[_0xf946('0x36')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf946('0x14')](0x9)[_0xf946('0x20')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf946('0x37')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xf946('0x20')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf946('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf946('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf946('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xf946('0x14')](0x9)[_0xf946('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf946('0x20')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf946('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf946('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf946('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf946('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf946('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xf946('0x14')](0x5)[_0xf946('0x20')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf946('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0xf946('0x36')],'defaultValue':0x0,'comment':_0xf946('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf946('0x6')](_0xf946('0x3e'),_0xf946('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xf946('0x2')],'comment':_0xf946('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf946('0x36')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf946('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf946('0x41')},'dialCutDigit':{'type':Sequelize[_0xf946('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf946('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x47')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf946('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf946('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf946('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf946('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf946('0x14')],'allowNull':!![],'comment':_0xf946('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0xf946('0x36')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x100d71){if(!_0x100d71)this[_0xf946('0xe')](_0xf946('0x4c'),null);this[_0xf946('0xe')](_0xf946('0x4d'),_0x100d71);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf946('0x14')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf946('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf946('0x36')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xf946('0x14')](0x3)[_0xf946('0x20')],'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 4a89be9..9f70845 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 _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x47596a,_0xea8cdb){var _0x21c3b7=function(_0x2bf7fb){while(--_0x2bf7fb){_0x47596a['push'](_0x47596a['shift']());}};_0x21c3b7(++_0xea8cdb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file +var _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x5d633e,_0xe8aa89){var _0x36e94c=function(_0x34f4ed){while(--_0x34f4ed){_0x5d633e['push'](_0x5d633e['shift']());}};_0x36e94c(++_0xe8aa89);}(_0x8ef6,0xf2));var _0x68ef=function(_0x546429,_0x292c02){_0x546429=_0x546429-0x0;var _0x1d01db=_0x8ef6[_0x546429];return _0x1d01db;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a3a57eb..9d57813 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 _0x8065=['save','update','emit','hasOwnProperty','hook','events','VoiceQueue','setMaxListeners'];(function(_0x1de023,_0x17334d){var _0x1b25ff=function(_0x2a1fee){while(--_0x2a1fee){_0x1de023['push'](_0x1de023['shift']());}};_0x1b25ff(++_0x17334d);}(_0x8065,0xed));var _0x5806=function(_0x273fdf,_0xd46674){_0x273fdf=_0x273fdf-0x0;var _0x5bc079=_0x8065[_0x273fdf];return _0x5bc079;};'use strict';var EventEmitter=require(_0x5806('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x5806('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5806('0x2')](0x0);var events={'afterCreate':_0x5806('0x3'),'afterUpdate':_0x5806('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c9ae8){return function(_0x4f8530,_0x134f52,_0x11b906){VoiceQueueEvents[_0x5806('0x5')](_0x5c9ae8+':'+_0x4f8530['id'],_0x4f8530);VoiceQueueEvents[_0x5806('0x5')](_0x5c9ae8,_0x4f8530);_0x11b906(null);};}for(var e in events){if(events[_0x5806('0x6')](e)){var event=events[e];VoiceQueue[_0x5806('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x9264=['emit','hasOwnProperty','hook','../../mysqldb','VoiceQueue','setMaxListeners','update','remove'];(function(_0x2c70ae,_0x4f9b18){var _0x4d36ff=function(_0x3332e3){while(--_0x3332e3){_0x2c70ae['push'](_0x2c70ae['shift']());}};_0x4d36ff(++_0x4f9b18);}(_0x9264,0x1eb));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4926('0x0'))['db'][_0x4926('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4926('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4926('0x3'),'afterDestroy':_0x4926('0x4')};function emitEvent(_0x2c24dd){return function(_0x39a757,_0x5723b4,_0x20069b){VoiceQueueEvents['emit'](_0x2c24dd+':'+_0x39a757['id'],_0x39a757);VoiceQueueEvents[_0x4926('0x5')](_0x2c24dd,_0x39a757);_0x20069b(null);};}for(var e in events){if(events[_0x4926('0x6')](e)){var event=events[e];VoiceQueue[_0x4926('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a121c45..b494f18 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x55ca,0x126));var _0xa55c=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x55ca[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x45aa72,_0x8af642){var _0x75adaa=function(_0x1f6809){while(--_0x1f6809){_0x45aa72['push'](_0x45aa72['shift']());}};_0x75adaa(++_0x8af642);}(_0x008c,0x188));var _0xc008=function(_0x3b584b,_0x39dc34){_0x3b584b=_0x3b584b-0x0;var _0x38559d=_0x008c[_0x3b584b];return _0x38559d;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index efa0e9c..18fccc0 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 _0x1160=['map','model','GetVoiceQueue','debug','catch','ShowVoiceQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueue','findAll','options','raw','where','limit','include','attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x1160,0x103));var _0x0116=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0x1160[_0x3f55de];return _0x2698de;};'use strict';var _=require(_0x0116('0x0'));var util=require(_0x0116('0x1'));var moment=require(_0x0116('0x2'));var BPromise=require(_0x0116('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0116('0x4'));var db=require(_0x0116('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0116('0x6'))('rpc');var config=require(_0x0116('0x7'));var jayson=require(_0x0116('0x8'));var client=jayson['client'][_0x0116('0x9')]({'port':0x232a});config[_0x0116('0xa')]=_[_0x0116('0xb')](config[_0x0116('0xa')],{'host':_0x0116('0xc'),'port':0x18eb});var socket=require(_0x0116('0xd'))(new Redis(config[_0x0116('0xa')]));require(_0x0116('0xe'))[_0x0116('0xf')](socket);function respondWithRpcPromise(_0x2ef0cf,_0x3c1a92,_0x22bbdf){return new BPromise(function(_0xea86bf,_0x3cca2e){return client[_0x0116('0x10')](_0x2ef0cf,_0x22bbdf)[_0x0116('0x11')](function(_0x1ae612){logger[_0x0116('0x12')](_0x0116('0x13'),_0x3c1a92,_0x0116('0x14'));logger['debug'](_0x0116('0x15'),_0x3c1a92,_0x0116('0x14'),JSON[_0x0116('0x16')](_0x1ae612));if(_0x1ae612[_0x0116('0x17')]){if(_0x1ae612[_0x0116('0x17')][_0x0116('0x18')]===0x1f4){logger[_0x0116('0x17')](_0x0116('0x13'),_0x3c1a92,_0x1ae612[_0x0116('0x17')][_0x0116('0x19')]);return _0x3cca2e(_0x1ae612[_0x0116('0x17')][_0x0116('0x19')]);}logger[_0x0116('0x17')](_0x0116('0x13'),_0x3c1a92,_0x1ae612['error']['message']);return _0xea86bf(_0x1ae612['error'][_0x0116('0x19')]);}else{logger[_0x0116('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x3c1a92,_0x0116('0x14'));_0xea86bf(_0x1ae612[_0x0116('0x1a')][_0x0116('0x19')]);}})['catch'](function(_0x36a87d){logger['error'](_0x0116('0x13'),_0x3c1a92,_0x36a87d);_0x3cca2e(_0x36a87d);});});}exports['GetVoiceQueue']=function(_0x4f5921){var _0x24990e=this;return new Promise(function(_0xf322f7,_0x58133f){return db[_0x0116('0x1b')][_0x0116('0x1c')]({'raw':_0x4f5921[_0x0116('0x1d')]?_0x4f5921[_0x0116('0x1d')][_0x0116('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f5921[_0x0116('0x1d')]?_0x4f5921[_0x0116('0x1d')][_0x0116('0x1f')]||null:null,'attributes':_0x4f5921['options']?_0x4f5921[_0x0116('0x1d')]['attributes']||null:null,'limit':_0x4f5921[_0x0116('0x1d')]?_0x4f5921[_0x0116('0x1d')][_0x0116('0x20')]||null:null,'include':_0x4f5921[_0x0116('0x1d')]?_0x4f5921[_0x0116('0x1d')][_0x0116('0x21')]?_['map'](_0x4f5921[_0x0116('0x1d')]['include'],function(_0x4f5428){return{'model':db[_0x4f5428['model']],'as':_0x4f5428['as'],'attributes':_0x4f5428[_0x0116('0x22')],'include':_0x4f5428[_0x0116('0x21')]?_[_0x0116('0x23')](_0x4f5428[_0x0116('0x21')],function(_0xaea3cc){return{'model':db[_0xaea3cc[_0x0116('0x24')]],'as':_0xaea3cc['as'],'attributes':_0xaea3cc['attributes'],'include':_0xaea3cc[_0x0116('0x21')]?_[_0x0116('0x23')](_0xaea3cc[_0x0116('0x21')],function(_0x1a14b1){return{'model':db[_0x1a14b1['model']],'as':_0x1a14b1['as'],'attributes':_0x1a14b1[_0x0116('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0116('0x11')](function(_0x15a5ef){logger[_0x0116('0x12')](_0x0116('0x25'),_0x4f5921);logger[_0x0116('0x26')](_0x0116('0x25'),_0x4f5921,JSON[_0x0116('0x16')](_0x15a5ef));_0xf322f7(_0x15a5ef);})[_0x0116('0x27')](function(_0x3918c3){logger['error'](_0x0116('0x25'),_0x3918c3[_0x0116('0x19')],_0x4f5921);_0x58133f(_0x24990e['error'](0x1f4,_0x3918c3[_0x0116('0x19')]));});});};exports[_0x0116('0x28')]=function(_0x55fa37){var _0x43c3a8=this;return new Promise(function(_0x176198,_0x5afcf6){return db['VoiceQueue'][_0x0116('0x29')]({'raw':_0x55fa37[_0x0116('0x1d')]?_0x55fa37[_0x0116('0x1d')][_0x0116('0x1e')]===undefined?!![]:![]:!![],'where':_0x55fa37[_0x0116('0x1d')]?_0x55fa37['options']['where']||null:null,'attributes':_0x55fa37[_0x0116('0x1d')]?_0x55fa37[_0x0116('0x1d')][_0x0116('0x22')]||null:null,'include':_0x55fa37[_0x0116('0x1d')]?_0x55fa37['options'][_0x0116('0x21')]?_[_0x0116('0x23')](_0x55fa37[_0x0116('0x1d')][_0x0116('0x21')],function(_0xca95bc){return{'model':db[_0xca95bc[_0x0116('0x24')]],'as':_0xca95bc['as'],'attributes':_0xca95bc[_0x0116('0x22')],'include':_0xca95bc['include']?_[_0x0116('0x23')](_0xca95bc[_0x0116('0x21')],function(_0x552007){return{'model':db[_0x552007[_0x0116('0x24')]],'as':_0x552007['as'],'attributes':_0x552007[_0x0116('0x22')],'include':_0x552007['include']?_[_0x0116('0x23')](_0x552007[_0x0116('0x21')],function(_0x4a5725){return{'model':db[_0x4a5725[_0x0116('0x24')]],'as':_0x4a5725['as'],'attributes':_0x4a5725[_0x0116('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1282e6){logger[_0x0116('0x12')]('ShowVoiceQueue',_0x55fa37);logger[_0x0116('0x26')](_0x0116('0x28'),_0x55fa37,JSON[_0x0116('0x16')](_0x1282e6));_0x176198(_0x1282e6);})[_0x0116('0x27')](function(_0x1af6a6){logger[_0x0116('0x17')](_0x0116('0x28'),_0x1af6a6[_0x0116('0x19')],_0x55fa37);_0x5afcf6(_0x43c3a8['error'](0x1f4,_0x1af6a6[_0x0116('0x19')]));});});}; \ No newline at end of file +var _0xab55=['result','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','VoiceQueue','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','VoiceQueue,\x20%s,\x20%s','message'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xab55,0x112));var _0x5ab5=function(_0x4f3e59,_0x2c7d49){_0x4f3e59=_0x4f3e59-0x0;var _0x56761e=_0xab55[_0x4f3e59];return _0x56761e;};'use strict';var _=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ab5('0x2'));var db=require(_0x5ab5('0x3'))['db'];var utils=require(_0x5ab5('0x4'));var logger=require(_0x5ab5('0x5'))('rpc');var config=require(_0x5ab5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5ab5('0x7')][_0x5ab5('0x8')]({'port':0x232a});config[_0x5ab5('0x9')]=_['defaults'](config[_0x5ab5('0x9')],{'host':_0x5ab5('0xa'),'port':0x18eb});var socket=require(_0x5ab5('0xb'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x5ab5('0xc')](socket);function respondWithRpcPromise(_0x478a47,_0xc113cd,_0x5838c1){return new BPromise(function(_0x13cbb9,_0x3d4dd4){return client[_0x5ab5('0xd')](_0x478a47,_0x5838c1)[_0x5ab5('0xe')](function(_0x175797){logger[_0x5ab5('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xc113cd,_0x5ab5('0x10'));logger[_0x5ab5('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xc113cd,_0x5ab5('0x10'),JSON[_0x5ab5('0x12')](_0x175797));if(_0x175797[_0x5ab5('0x13')]){if(_0x175797[_0x5ab5('0x13')]['code']===0x1f4){logger[_0x5ab5('0x13')](_0x5ab5('0x14'),_0xc113cd,_0x175797[_0x5ab5('0x13')]['message']);return _0x3d4dd4(_0x175797[_0x5ab5('0x13')]['message']);}logger['error'](_0x5ab5('0x14'),_0xc113cd,_0x175797['error'][_0x5ab5('0x15')]);return _0x13cbb9(_0x175797[_0x5ab5('0x13')][_0x5ab5('0x15')]);}else{logger[_0x5ab5('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xc113cd,_0x5ab5('0x10'));_0x13cbb9(_0x175797[_0x5ab5('0x16')]['message']);}})['catch'](function(_0x1c9d95){logger[_0x5ab5('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xc113cd,_0x1c9d95);_0x3d4dd4(_0x1c9d95);});});}exports[_0x5ab5('0x17')]=function(_0x317ed2){var _0x16acc3=this;return new Promise(function(_0x3f0f23,_0x30f2c2){return db['VoiceQueue'][_0x5ab5('0x18')]({'raw':_0x317ed2[_0x5ab5('0x19')]?_0x317ed2[_0x5ab5('0x19')][_0x5ab5('0x1a')]===undefined?!![]:![]:!![],'where':_0x317ed2[_0x5ab5('0x19')]?_0x317ed2[_0x5ab5('0x19')][_0x5ab5('0x1b')]||null:null,'attributes':_0x317ed2['options']?_0x317ed2[_0x5ab5('0x19')][_0x5ab5('0x1c')]||null:null,'limit':_0x317ed2[_0x5ab5('0x19')]?_0x317ed2[_0x5ab5('0x19')][_0x5ab5('0x1d')]||null:null,'include':_0x317ed2[_0x5ab5('0x19')]?_0x317ed2[_0x5ab5('0x19')][_0x5ab5('0x1e')]?_[_0x5ab5('0x1f')](_0x317ed2[_0x5ab5('0x19')]['include'],function(_0x4037a0){return{'model':db[_0x4037a0[_0x5ab5('0x20')]],'as':_0x4037a0['as'],'attributes':_0x4037a0[_0x5ab5('0x1c')],'include':_0x4037a0[_0x5ab5('0x1e')]?_['map'](_0x4037a0['include'],function(_0x26ddf8){return{'model':db[_0x26ddf8[_0x5ab5('0x20')]],'as':_0x26ddf8['as'],'attributes':_0x26ddf8[_0x5ab5('0x1c')],'include':_0x26ddf8[_0x5ab5('0x1e')]?_[_0x5ab5('0x1f')](_0x26ddf8[_0x5ab5('0x1e')],function(_0x2a9fc3){return{'model':db[_0x2a9fc3[_0x5ab5('0x20')]],'as':_0x2a9fc3['as'],'attributes':_0x2a9fc3[_0x5ab5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ab5('0xe')](function(_0x43b362){logger[_0x5ab5('0xf')]('GetVoiceQueue',_0x317ed2);logger[_0x5ab5('0x11')](_0x5ab5('0x17'),_0x317ed2,JSON['stringify'](_0x43b362));_0x3f0f23(_0x43b362);})[_0x5ab5('0x21')](function(_0xeec0c8){logger[_0x5ab5('0x13')](_0x5ab5('0x17'),_0xeec0c8[_0x5ab5('0x15')],_0x317ed2);_0x30f2c2(_0x16acc3[_0x5ab5('0x13')](0x1f4,_0xeec0c8[_0x5ab5('0x15')]));});});};exports[_0x5ab5('0x22')]=function(_0x5cf28e){var _0x24ba6a=this;return new Promise(function(_0x3f7677,_0x29f89b){return db[_0x5ab5('0x23')][_0x5ab5('0x24')]({'raw':_0x5cf28e[_0x5ab5('0x19')]?_0x5cf28e[_0x5ab5('0x19')][_0x5ab5('0x1a')]===undefined?!![]:![]:!![],'where':_0x5cf28e[_0x5ab5('0x19')]?_0x5cf28e['options'][_0x5ab5('0x1b')]||null:null,'attributes':_0x5cf28e['options']?_0x5cf28e['options'][_0x5ab5('0x1c')]||null:null,'include':_0x5cf28e['options']?_0x5cf28e[_0x5ab5('0x19')][_0x5ab5('0x1e')]?_[_0x5ab5('0x1f')](_0x5cf28e['options'][_0x5ab5('0x1e')],function(_0x395ae8){return{'model':db[_0x395ae8[_0x5ab5('0x20')]],'as':_0x395ae8['as'],'attributes':_0x395ae8[_0x5ab5('0x1c')],'include':_0x395ae8[_0x5ab5('0x1e')]?_['map'](_0x395ae8[_0x5ab5('0x1e')],function(_0x308bc2){return{'model':db[_0x308bc2['model']],'as':_0x308bc2['as'],'attributes':_0x308bc2[_0x5ab5('0x1c')],'include':_0x308bc2[_0x5ab5('0x1e')]?_[_0x5ab5('0x1f')](_0x308bc2['include'],function(_0x27aa45){return{'model':db[_0x27aa45['model']],'as':_0x27aa45['as'],'attributes':_0x27aa45[_0x5ab5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ab5('0xe')](function(_0x1bb6d3){logger[_0x5ab5('0xf')]('ShowVoiceQueue',_0x5cf28e);logger['debug'](_0x5ab5('0x22'),_0x5cf28e,JSON[_0x5ab5('0x12')](_0x1bb6d3));_0x3f7677(_0x1bb6d3);})[_0x5ab5('0x21')](function(_0xd20941){logger[_0x5ab5('0x13')]('ShowVoiceQueue',_0xd20941[_0x5ab5('0x15')],_0x5cf28e);_0x29f89b(_0x24ba6a[_0x5ab5('0x13')](0x1f4,_0xd20941[_0x5ab5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 82482bb..c4e3547 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 _0x9e1a=['voiceQueue:','./voiceQueue.events','save','remove','removeListener','register','length'];(function(_0x1636d6,_0x24a89c){var _0x287d74=function(_0x1cde98){while(--_0x1cde98){_0x1636d6['push'](_0x1636d6['shift']());}};_0x287d74(++_0x24a89c);}(_0x9e1a,0x6a));var _0xa9e1=function(_0x17b862,_0x510c69){_0x17b862=_0x17b862-0x0;var _0x72a470=_0x9e1a[_0x17b862];return _0x72a470;};'use strict';var VoiceQueueEvents=require(_0xa9e1('0x0'));var events=[_0xa9e1('0x1'),_0xa9e1('0x2'),'update'];function createListener(_0x4bf11d,_0x15e92){return function(_0xd275ed){_0x15e92['emit'](_0x4bf11d,_0xd275ed);};}function removeListener(_0x2adfba,_0x124c0d){return function(){VoiceQueueEvents[_0xa9e1('0x3')](_0x2adfba,_0x124c0d);};}exports[_0xa9e1('0x4')]=function(_0xe17859){for(var _0x1bc19c=0x0,_0x20ce01=events[_0xa9e1('0x5')];_0x1bc19c<_0x20ce01;_0x1bc19c++){var _0x16a853=events[_0x1bc19c];var _0x1a9558=createListener(_0xa9e1('0x6')+_0x16a853,_0xe17859);VoiceQueueEvents['on'](_0x16a853,_0x1a9558);}}; \ No newline at end of file +var _0x516a=['emit','removeListener','register','length','voiceQueue:','save','update'];(function(_0xf4897b,_0xc219a){var _0x3a1a7d=function(_0x370b64){while(--_0x370b64){_0xf4897b['push'](_0xf4897b['shift']());}};_0x3a1a7d(++_0xc219a);}(_0x516a,0x1b0));var _0xa516=function(_0x1edab8,_0x3e9cc9){_0x1edab8=_0x1edab8-0x0;var _0x370d90=_0x516a[_0x1edab8];return _0x370d90;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa516('0x0'),'remove',_0xa516('0x1')];function createListener(_0x7de38d,_0x4b3a8a){return function(_0x2709e3){_0x4b3a8a[_0xa516('0x2')](_0x7de38d,_0x2709e3);};}function removeListener(_0x30f6c8,_0xa6c0){return function(){VoiceQueueEvents[_0xa516('0x3')](_0x30f6c8,_0xa6c0);};}exports[_0xa516('0x4')]=function(_0x18c3a6){for(var _0x4cc968=0x0,_0x54a7ec=events[_0xa516('0x5')];_0x4cc968<_0x54a7ec;_0x4cc968++){var _0xefa928=events[_0x4cc968];var _0x1c4d42=createListener(_0xa516('0x6')+_0xefa928,_0x18c3a6);VoiceQueueEvents['on'](_0xefa928,_0x1c4d42);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index d6220dc..33d76f2 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 _0xcae1=['util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x12590e,_0x763f09){var _0x56da6b=function(_0x446ed3){while(--_0x446ed3){_0x12590e['push'](_0x12590e['shift']());}};_0x56da6b(++_0x763f09);}(_0xcae1,0x11c));var _0x1cae=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0xcae1[_0x5f382f];return _0x3bb11b;};'use strict';var multer=require(_0x1cae('0x0'));var util=require(_0x1cae('0x1'));var path=require(_0x1cae('0x2'));var timeout=require('connect-timeout');var express=require(_0x1cae('0x3'));var router=express[_0x1cae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1cae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1cae('0x6'));var controller=require('./voiceQueueReport.controller');router[_0x1cae('0x7')]('/',auth[_0x1cae('0x8')](),controller['index']);router['get'](_0x1cae('0x9'),auth[_0x1cae('0x8')](),controller['describe']);router[_0x1cae('0x7')]('/index',auth[_0x1cae('0x8')](),controller[_0x1cae('0xa')]);router[_0x1cae('0x7')](_0x1cae('0xb'),auth[_0x1cae('0x8')](),controller[_0x1cae('0xc')]);router[_0x1cae('0xd')]('/',auth[_0x1cae('0x8')](),controller[_0x1cae('0xe')]);router[_0x1cae('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1cae('0x10')]);router['delete'](_0x1cae('0xb'),auth['isAuthenticated'](),controller[_0x1cae('0x11')]);module[_0x1cae('0x12')]=router; \ No newline at end of file +var _0x62a5=['/:id','show','post','isAuthenticated','create','put','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/index'];(function(_0x46b111,_0x495361){var _0x5a80dd=function(_0x2e97bd){while(--_0x2e97bd){_0x46b111['push'](_0x46b111['shift']());}};_0x5a80dd(++_0x495361);}(_0x62a5,0x14b));var _0x562a=function(_0x500a4c,_0x5f2b6e){_0x500a4c=_0x500a4c-0x0;var _0x892a34=_0x62a5[_0x500a4c];return _0x892a34;};'use strict';var multer=require(_0x562a('0x0'));var util=require(_0x562a('0x1'));var path=require(_0x562a('0x2'));var timeout=require(_0x562a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x562a('0x4'));var interaction=require(_0x562a('0x5'));var config=require(_0x562a('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x562a('0x7')]);router[_0x562a('0x8')](_0x562a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x562a('0x8')](_0x562a('0xa'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x562a('0x8')](_0x562a('0xb'),auth['isAuthenticated'](),controller[_0x562a('0xc')]);router[_0x562a('0xd')]('/',auth[_0x562a('0xe')](),controller[_0x562a('0xf')]);router[_0x562a('0x10')]('/:id',auth[_0x562a('0xe')](),controller[_0x562a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x562a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 42fd9b4..b50bd1b 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 _0x5553=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN'];(function(_0x5008da,_0x163fc7){var _0xc35b8a=function(_0x14f2e4){while(--_0x14f2e4){_0x5008da['push'](_0x5008da['shift']());}};_0xc35b8a(++_0x163fc7);}(_0x5553,0xe2));var _0x3555=function(_0x24ebbf,_0x4617ec){_0x24ebbf=_0x24ebbf-0x0;var _0x505722=_0x5553[_0x24ebbf];return _0x505722;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3555('0x0'));module[_0x3555('0x1')]={'type':{'type':Sequelize[_0x3555('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3555('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3555('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3555('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3555('0x3')],'set':function(_0x5c341a){var _0x50c1a4=moment(_0x5c341a);var _0x1b4501=moment(this[_0x3555('0x4')](_0x3555('0x5')))[_0x3555('0x6')](_0x3555('0x7'));var _0x58ee75=_0x50c1a4[_0x3555('0x8')](_0x1b4501,_0x3555('0x9'));this[_0x3555('0xa')](_0x3555('0xb'),_0x5c341a);this[_0x3555('0xa')]('holdtime',_0x58ee75||null);}},'position':{'type':Sequelize[_0x3555('0xc')]},'count':{'type':Sequelize[_0x3555('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x3555('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3555('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x3555('0x2')],'comment':_0x3555('0xe')},'originalposition':{'type':Sequelize[_0x3555('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3555('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3555('0x2')]},'holdtime':{'type':Sequelize[_0x3555('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3555('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3555('0x2')]},'transfer':{'type':Sequelize[_0x3555('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3555('0x2')],'comment':_0x3555('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3555('0x2')]},'disposition':{'type':Sequelize[_0x3555('0x2')]},'secondDisposition':{'type':Sequelize[_0x3555('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3555('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3555('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3555('0x2')]}}; \ No newline at end of file +var _0xa89c=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue'];(function(_0x273709,_0x34aa00){var _0x1421bf=function(_0x1e7314){while(--_0x1e7314){_0x273709['push'](_0x273709['shift']());}};_0x1421bf(++_0x34aa00);}(_0xa89c,0x121));var _0xca89=function(_0x79654c,_0x1fdcc2){_0x79654c=_0x79654c-0x0;var _0x4d5811=_0xa89c[_0x79654c];return _0x4d5811;};'use strict';var Sequelize=require(_0xca89('0x0'));var moment=require(_0xca89('0x1'));module[_0xca89('0x2')]={'type':{'type':Sequelize[_0xca89('0x3')]},'uniqueid':{'type':Sequelize[_0xca89('0x3')]},'calleridnum':{'type':Sequelize[_0xca89('0x3')]},'calleridname':{'type':Sequelize[_0xca89('0x3')]},'queue':{'type':Sequelize[_0xca89('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xca89('0x4')],'set':function(_0x5f279b){var _0x2683c7=moment(_0x5f279b);var _0x36b7a0=moment(this[_0xca89('0x5')]('queuecallerjoinAt'))[_0xca89('0x6')](_0xca89('0x7'));var _0x31e61b=_0x2683c7[_0xca89('0x8')](_0x36b7a0,'seconds');this[_0xca89('0x9')]('queuecallerleaveAt',_0x5f279b);this[_0xca89('0x9')]('holdtime',_0x31e61b||null);}},'position':{'type':Sequelize[_0xca89('0xa')]},'count':{'type':Sequelize[_0xca89('0xa')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xca89('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xca89('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xca89('0x4')]},'queuecallerexit':{'type':Sequelize[_0xca89('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xca89('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xca89('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xca89('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xca89('0x3')]},'accountcode':{'type':Sequelize[_0xca89('0x3')]},'context':{'type':Sequelize[_0xca89('0x3')]},'exten':{'type':Sequelize[_0xca89('0x3')]},'priority':{'type':Sequelize[_0xca89('0x3')]},'holdtime':{'type':Sequelize[_0xca89('0xa')]},'mohtime':{'type':Sequelize[_0xca89('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xca89('0x3')],'comment':_0xca89('0xc')},'transferexten':{'type':Sequelize[_0xca89('0x3')]},'transferuniqueid':{'type':Sequelize[_0xca89('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xca89('0x3')]},'thirdDisposition':{'type':Sequelize[_0xca89('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xca89('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 1c0dc55..27100a0 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 _0x51c0=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','sort','options','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x10a200,_0x28c94b){var _0x321027=function(_0xe4474e){while(--_0xe4474e){_0x10a200['push'](_0x10a200['shift']());}};_0x321027(++_0x28c94b);}(_0x51c0,0x12f));var _0x051c=function(_0xdf7930,_0x3c13fc){_0xdf7930=_0xdf7930-0x0;var _0x14a6b0=_0x51c0[_0xdf7930];return _0x14a6b0;};'use strict';var emlformat=require(_0x051c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x051c('0x1'));var jsonpatch=require(_0x051c('0x2'));var rp=require(_0x051c('0x3'));var moment=require(_0x051c('0x4'));var BPromise=require(_0x051c('0x5'));var Mustache=require(_0x051c('0x6'));var util=require(_0x051c('0x7'));var path=require(_0x051c('0x8'));var sox=require(_0x051c('0x9'));var csv=require(_0x051c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x051c('0xb'));var _=require(_0x051c('0xc'));var squel=require('squel');var crypto=require(_0x051c('0xd'));var jsforce=require(_0x051c('0xe'));var deskjs=require(_0x051c('0xf'));var toCsv=require(_0x051c('0xa'));var querystring=require(_0x051c('0x10'));var Papa=require('papaparse');var Redis=require(_0x051c('0x11'));var authService=require(_0x051c('0x12'));var qs=require(_0x051c('0x13'));var as=require(_0x051c('0x14'));var hardwareService=require(_0x051c('0x15'));var logger=require(_0x051c('0x16'))(_0x051c('0x17'));var utils=require('../../config/utils');var config=require(_0x051c('0x18'));var licenseUtil=require(_0x051c('0x19'));var db=require('../../mysqldb')['db'];config[_0x051c('0x1a')]=_[_0x051c('0x1b')](config['redis'],{'host':_0x051c('0x1c'),'port':0x18eb});var socket=require(_0x051c('0x1d'))(new Redis(config[_0x051c('0x1a')]));require(_0x051c('0x1e'))[_0x051c('0x1f')](socket);function respondWithStatusCode(_0xc1bdf1,_0x48e09f){_0x48e09f=_0x48e09f||0xcc;return function(_0x34c7a5){if(_0x34c7a5){return _0xc1bdf1['sendStatus'](_0x48e09f);}return _0xc1bdf1[_0x051c('0x20')](_0x48e09f)[_0x051c('0x21')]();};}function respondWithResult(_0x4e66f2,_0x506913){_0x506913=_0x506913||0xc8;return function(_0x4f17c9){if(_0x4f17c9){return _0x4e66f2[_0x051c('0x20')](_0x506913)[_0x051c('0x22')](_0x4f17c9);}};}function respondWithFilteredResult(_0x10171d,_0x4a9327){return function(_0x2630c4){if(_0x2630c4){var _0x41b065=typeof _0x4a9327[_0x051c('0x23')]===_0x051c('0x24')&&typeof _0x4a9327[_0x051c('0x25')]===_0x051c('0x24');var _0x5653d6=_0x2630c4[_0x051c('0x26')];var _0x455cb4=_0x41b065?0x0:_0x4a9327[_0x051c('0x23')];var _0x2e0e52=_0x41b065?_0x2630c4[_0x051c('0x26')]:_0x4a9327['offset']+_0x4a9327[_0x051c('0x25')];var _0x4ff7c8;if(_0x2e0e52>=_0x5653d6){_0x2e0e52=_0x5653d6;_0x4ff7c8=0xc8;}else{_0x4ff7c8=0xce;}_0x10171d['status'](_0x4ff7c8);return _0x10171d[_0x051c('0x27')]('Content-Range',_0x455cb4+'-'+_0x2e0e52+'/'+_0x5653d6)[_0x051c('0x22')](_0x2630c4);}return null;};}function patchUpdates(_0x3f1f09){return function(_0x242742){try{jsonpatch[_0x051c('0x28')](_0x242742,_0x3f1f09,!![]);}catch(_0x1b9730){return BPromise[_0x051c('0x29')](_0x1b9730);}return _0x242742['save']();};}function saveUpdates(_0x405e04,_0x46ba1e){return function(_0x588af4){if(_0x588af4){return _0x588af4[_0x051c('0x2a')](_0x405e04)[_0x051c('0x2b')](function(_0x413143){return _0x413143;});}return null;};}function removeEntity(_0x29f579,_0x211ea6){return function(_0xb88b42){if(_0xb88b42){return _0xb88b42[_0x051c('0x2c')]()[_0x051c('0x2b')](function(){_0x29f579[_0x051c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ea7c2,_0x51fe77){return function(_0x455b91){if(!_0x455b91){_0x4ea7c2['sendStatus'](0x194);}return _0x455b91;};}function handleError(_0x4a456b,_0x3313f9){_0x3313f9=_0x3313f9||0x1f4;return function(_0x5485ae){logger[_0x051c('0x2d')](_0x5485ae['stack']);if(_0x5485ae[_0x051c('0x2e')]){delete _0x5485ae['name'];}_0x4a456b[_0x051c('0x20')](_0x3313f9)[_0x051c('0x2f')](_0x5485ae);};}exports[_0x051c('0x30')]=function(_0x3dd981,_0x4b946b){var _0x407be4={},_0x1aeaef={},_0x42cae8={'count':0x0,'rows':[]};var _0x576001=_[_0x051c('0x31')](db[_0x051c('0x32')][_0x051c('0x33')],function(_0x5214cc){return{'name':_0x5214cc[_0x051c('0x34')],'type':_0x5214cc[_0x051c('0x35')]['key']};});_0x1aeaef[_0x051c('0x36')]=_[_0x051c('0x31')](_0x576001,_0x051c('0x2e'));_0x1aeaef['query']=_[_0x051c('0x37')](_0x3dd981[_0x051c('0x38')]);_0x1aeaef[_0x051c('0x39')]=_[_0x051c('0x3a')](_0x1aeaef[_0x051c('0x36')],_0x1aeaef[_0x051c('0x38')]);_0x407be4[_0x051c('0x3b')]=_[_0x051c('0x3a')](_0x1aeaef[_0x051c('0x36')],qs[_0x051c('0x3c')](_0x3dd981[_0x051c('0x38')][_0x051c('0x3c')]));_0x407be4['attributes']=_0x407be4[_0x051c('0x3b')][_0x051c('0x3d')]?_0x407be4[_0x051c('0x3b')]:_0x1aeaef[_0x051c('0x36')];if(!_0x3dd981[_0x051c('0x38')][_0x051c('0x3e')](_0x051c('0x3f'))){_0x407be4[_0x051c('0x25')]=qs['limit'](_0x3dd981[_0x051c('0x38')][_0x051c('0x25')]);_0x407be4['offset']=qs[_0x051c('0x23')](_0x3dd981[_0x051c('0x38')]['offset']);}_0x407be4[_0x051c('0x40')]=qs['sort'](_0x3dd981['query']['sort']);_0x407be4[_0x051c('0x41')]=qs[_0x051c('0x39')](_['pick'](_0x3dd981[_0x051c('0x38')],_0x1aeaef[_0x051c('0x39')]),_0x576001);if(_0x3dd981[_0x051c('0x38')][_0x051c('0x42')]){_0x407be4[_0x051c('0x41')]=_[_0x051c('0x43')](_0x407be4[_0x051c('0x41')],{'$or':_[_0x051c('0x31')](_0x576001,function(_0x663294){if(_0x663294[_0x051c('0x35')]!==_0x051c('0x44')){var _0x354630={};_0x354630[_0x663294[_0x051c('0x2e')]]={'$like':'%'+_0x3dd981['query']['filter']+'%'};return _0x354630;}})});}_0x407be4=_[_0x051c('0x43')]({},_0x407be4,_0x3dd981['options']);var _0x22566f={'where':_0x407be4[_0x051c('0x41')]};return db[_0x051c('0x32')]['count'](_0x22566f)[_0x051c('0x2b')](function(_0x50128a){_0x42cae8[_0x051c('0x26')]=_0x50128a;if(_0x3dd981['query'][_0x051c('0x45')]){_0x407be4[_0x051c('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x051c('0x47')](_0x407be4);})[_0x051c('0x2b')](function(_0x38f663){_0x42cae8[_0x051c('0x48')]=_0x38f663;return _0x42cae8;})[_0x051c('0x2b')](respondWithFilteredResult(_0x4b946b,_0x407be4))[_0x051c('0x49')](handleError(_0x4b946b,null));};exports['show']=function(_0x527f03,_0x5bc888){var _0x3e463f={'raw':![],'where':{'id':_0x527f03[_0x051c('0x4a')]['id']}},_0x8eed7={};_0x8eed7[_0x051c('0x36')]=_[_0x051c('0x37')](db[_0x051c('0x32')][_0x051c('0x33')]);_0x8eed7[_0x051c('0x38')]=_['keys'](_0x527f03[_0x051c('0x38')]);_0x8eed7[_0x051c('0x39')]=_['intersection'](_0x8eed7[_0x051c('0x36')],_0x8eed7[_0x051c('0x38')]);_0x3e463f[_0x051c('0x3b')]=_['intersection'](_0x8eed7[_0x051c('0x36')],qs[_0x051c('0x3c')](_0x527f03[_0x051c('0x38')]['fields']));_0x3e463f[_0x051c('0x3b')]=_0x3e463f[_0x051c('0x3b')]['length']?_0x3e463f[_0x051c('0x3b')]:_0x8eed7[_0x051c('0x36')];if(_0x527f03[_0x051c('0x38')][_0x051c('0x45')]){_0x3e463f[_0x051c('0x46')]=[{'all':!![]}];}_0x3e463f=_['merge']({},_0x3e463f,_0x527f03['options']);return db[_0x051c('0x32')][_0x051c('0x4b')](_0x3e463f)[_0x051c('0x2b')](handleEntityNotFound(_0x5bc888,null))[_0x051c('0x2b')](respondWithResult(_0x5bc888,null))['catch'](handleError(_0x5bc888,null));};exports[_0x051c('0x4c')]=function(_0x11ddc1,_0x54bec3){return db[_0x051c('0x32')][_0x051c('0x4c')](_0x11ddc1[_0x051c('0x4d')],{})['then'](respondWithResult(_0x54bec3,0xc9))[_0x051c('0x49')](handleError(_0x54bec3,null));};exports[_0x051c('0x2a')]=function(_0x156cf2,_0x1ab6c9){if(_0x156cf2[_0x051c('0x4d')]['id']){delete _0x156cf2[_0x051c('0x4d')]['id'];}return db[_0x051c('0x32')]['find']({'where':{'id':_0x156cf2['params']['id']}})[_0x051c('0x2b')](handleEntityNotFound(_0x1ab6c9,null))[_0x051c('0x2b')](saveUpdates(_0x156cf2[_0x051c('0x4d')],null))[_0x051c('0x2b')](respondWithResult(_0x1ab6c9,null))[_0x051c('0x49')](handleError(_0x1ab6c9,null));};exports[_0x051c('0x2c')]=function(_0x4db974,_0x2320ad){return db[_0x051c('0x32')]['find']({'where':{'id':_0x4db974[_0x051c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2320ad,null))[_0x051c('0x2b')](removeEntity(_0x2320ad,null))[_0x051c('0x49')](handleError(_0x2320ad,null));};exports[_0x051c('0x4e')]=function(_0x2eb944,_0x2d2ccf){return db[_0x051c('0x32')][_0x051c('0x4e')]()[_0x051c('0x2b')](respondWithResult(_0x2d2ccf,null))['catch'](handleError(_0x2d2ccf,null));};exports[_0x051c('0x4f')]=function(_0x55b5ae,_0xc68fc3){var _0x524f42={},_0x326d04={},_0x249c9f={'count':0x0,'rows':[]};_0x326d04[_0x051c('0x36')]=_[_0x051c('0x37')](db[_0x051c('0x32')][_0x051c('0x33')]);_0x326d04['query']=_[_0x051c('0x37')](_0x55b5ae[_0x051c('0x38')]);_0x326d04[_0x051c('0x39')]=_[_0x051c('0x3a')](_0x326d04[_0x051c('0x36')],_0x326d04[_0x051c('0x38')]);_0x524f42[_0x051c('0x3b')]=_['intersection'](_0x326d04['model'],qs[_0x051c('0x3c')](_0x55b5ae[_0x051c('0x38')][_0x051c('0x3c')]));_0x524f42[_0x051c('0x3b')]=_0x524f42[_0x051c('0x3b')]['length']?_0x524f42[_0x051c('0x3b')]:_0x326d04[_0x051c('0x36')];if(!_0x55b5ae[_0x051c('0x38')][_0x051c('0x3e')](_0x051c('0x3f'))){_0x524f42[_0x051c('0x25')]=qs[_0x051c('0x25')](_0x55b5ae[_0x051c('0x38')][_0x051c('0x25')]);_0x524f42[_0x051c('0x23')]=qs[_0x051c('0x23')](_0x55b5ae[_0x051c('0x38')][_0x051c('0x23')]);}_0x524f42[_0x051c('0x40')]=qs[_0x051c('0x50')](_0x55b5ae['query']['sort']);_0x524f42[_0x051c('0x41')]=qs['filters'](_['pick'](_0x55b5ae[_0x051c('0x38')],_0x326d04[_0x051c('0x39')]));if(_0x55b5ae[_0x051c('0x38')][_0x051c('0x42')]){_0x524f42[_0x051c('0x41')]=_[_0x051c('0x43')](_0x524f42[_0x051c('0x41')],{'$or':_[_0x051c('0x31')](_0x524f42[_0x051c('0x3b')],function(_0x40a360){var _0xc4b826={};_0xc4b826[_0x40a360]={'$like':'%'+_0x55b5ae[_0x051c('0x38')][_0x051c('0x42')]+'%'};return _0xc4b826;})});}_0x524f42=_['merge']({},_0x524f42,_0x55b5ae[_0x051c('0x51')]);var _0x7aa7cd={'where':_0x524f42[_0x051c('0x41')]};return db[_0x051c('0x32')]['count'](_0x7aa7cd)[_0x051c('0x2b')](function(_0xd94f51){_0x249c9f[_0x051c('0x26')]=_0xd94f51;if(_0x55b5ae[_0x051c('0x38')][_0x051c('0x45')]){_0x524f42['include']=[{'all':!![]}];}return db[_0x051c('0x32')][_0x051c('0x47')](_0x524f42);})[_0x051c('0x2b')](function(_0x1b69fd){_0x249c9f[_0x051c('0x48')]=_0x1b69fd;return _0x249c9f;})[_0x051c('0x2b')](respondWithFilteredResult(_0xc68fc3,_0x524f42,_0x051c('0x4f')))[_0x051c('0x49')](handleError(_0xc68fc3,null,_0x051c('0x4f')));}; \ No newline at end of file +var _0x6e84=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','pick','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4e5b4b,_0x3afd6a){var _0x2f77e9=function(_0x49806f){while(--_0x49806f){_0x4e5b4b['push'](_0x4e5b4b['shift']());}};_0x2f77e9(++_0x3afd6a);}(_0x6e84,0x1c9));var _0x46e8=function(_0x1d8346,_0xf2c8a4){_0x1d8346=_0x1d8346-0x0;var _0x4115ad=_0x6e84[_0x1d8346];return _0x4115ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46e8('0x0'));var zipdir=require(_0x46e8('0x1'));var jsonpatch=require(_0x46e8('0x2'));var rp=require(_0x46e8('0x3'));var moment=require(_0x46e8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46e8('0x5'));var path=require(_0x46e8('0x6'));var sox=require(_0x46e8('0x7'));var csv=require(_0x46e8('0x8'));var ejs=require(_0x46e8('0x9'));var fs=require('fs');var fs_extra=require(_0x46e8('0xa'));var _=require('lodash');var squel=require(_0x46e8('0xb'));var crypto=require(_0x46e8('0xc'));var jsforce=require(_0x46e8('0xd'));var deskjs=require(_0x46e8('0xe'));var toCsv=require(_0x46e8('0x8'));var querystring=require(_0x46e8('0xf'));var Papa=require(_0x46e8('0x10'));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(_0x46e8('0x11'));var logger=require(_0x46e8('0x12'))(_0x46e8('0x13'));var utils=require(_0x46e8('0x14'));var config=require(_0x46e8('0x15'));var licenseUtil=require(_0x46e8('0x16'));var db=require(_0x46e8('0x17'))['db'];config[_0x46e8('0x18')]=_[_0x46e8('0x19')](config[_0x46e8('0x18')],{'host':_0x46e8('0x1a'),'port':0x18eb});var socket=require(_0x46e8('0x1b'))(new Redis(config['redis']));require(_0x46e8('0x1c'))[_0x46e8('0x1d')](socket);function respondWithStatusCode(_0x501286,_0x2e4c4c){_0x2e4c4c=_0x2e4c4c||0xcc;return function(_0x4b44be){if(_0x4b44be){return _0x501286['sendStatus'](_0x2e4c4c);}return _0x501286[_0x46e8('0x1e')](_0x2e4c4c)['end']();};}function respondWithResult(_0x4542ce,_0x20c361){_0x20c361=_0x20c361||0xc8;return function(_0x1ce6bd){if(_0x1ce6bd){return _0x4542ce[_0x46e8('0x1e')](_0x20c361)[_0x46e8('0x1f')](_0x1ce6bd);}};}function respondWithFilteredResult(_0x38aea1,_0x53edaf){return function(_0xd4c5c2){if(_0xd4c5c2){var _0x17c532=typeof _0x53edaf['offset']===_0x46e8('0x20')&&typeof _0x53edaf[_0x46e8('0x21')]===_0x46e8('0x20');var _0x17fea6=_0xd4c5c2['count'];var _0x57d969=_0x17c532?0x0:_0x53edaf[_0x46e8('0x22')];var _0x2acfcd=_0x17c532?_0xd4c5c2[_0x46e8('0x23')]:_0x53edaf[_0x46e8('0x22')]+_0x53edaf[_0x46e8('0x21')];var _0x425539;if(_0x2acfcd>=_0x17fea6){_0x2acfcd=_0x17fea6;_0x425539=0xc8;}else{_0x425539=0xce;}_0x38aea1['status'](_0x425539);return _0x38aea1[_0x46e8('0x24')]('Content-Range',_0x57d969+'-'+_0x2acfcd+'/'+_0x17fea6)['json'](_0xd4c5c2);}return null;};}function patchUpdates(_0x5d51d6){return function(_0x3b8f3a){try{jsonpatch[_0x46e8('0x25')](_0x3b8f3a,_0x5d51d6,!![]);}catch(_0x6801d9){return BPromise[_0x46e8('0x26')](_0x6801d9);}return _0x3b8f3a[_0x46e8('0x27')]();};}function saveUpdates(_0x2945b0,_0x3ea971){return function(_0x1fbe25){if(_0x1fbe25){return _0x1fbe25[_0x46e8('0x28')](_0x2945b0)[_0x46e8('0x29')](function(_0x4f43a7){return _0x4f43a7;});}return null;};}function removeEntity(_0x453f6a,_0x2d9eb3){return function(_0x537600){if(_0x537600){return _0x537600[_0x46e8('0x2a')]()['then'](function(){_0x453f6a[_0x46e8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x294777,_0x5af9ac){return function(_0x25911f){if(!_0x25911f){_0x294777[_0x46e8('0x2b')](0x194);}return _0x25911f;};}function handleError(_0x3a78cd,_0x1716f4){_0x1716f4=_0x1716f4||0x1f4;return function(_0x295b62){logger[_0x46e8('0x2c')](_0x295b62[_0x46e8('0x2d')]);if(_0x295b62['name']){delete _0x295b62[_0x46e8('0x2e')];}_0x3a78cd[_0x46e8('0x1e')](_0x1716f4)[_0x46e8('0x2f')](_0x295b62);};}exports[_0x46e8('0x30')]=function(_0x4ea8f4,_0x3aff84){var _0x124fea={},_0x216400={},_0x1e9bf2={'count':0x0,'rows':[]};var _0x3f3767=_[_0x46e8('0x31')](db[_0x46e8('0x32')][_0x46e8('0x33')],function(_0x4d085f){return{'name':_0x4d085f[_0x46e8('0x34')],'type':_0x4d085f['type']['key']};});_0x216400[_0x46e8('0x35')]=_['map'](_0x3f3767,_0x46e8('0x2e'));_0x216400[_0x46e8('0x36')]=_[_0x46e8('0x37')](_0x4ea8f4['query']);_0x216400['filters']=_[_0x46e8('0x38')](_0x216400[_0x46e8('0x35')],_0x216400[_0x46e8('0x36')]);_0x124fea['attributes']=_[_0x46e8('0x38')](_0x216400[_0x46e8('0x35')],qs[_0x46e8('0x39')](_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x39')]));_0x124fea[_0x46e8('0x3a')]=_0x124fea[_0x46e8('0x3a')]['length']?_0x124fea[_0x46e8('0x3a')]:_0x216400['model'];if(!_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x3b')](_0x46e8('0x3c'))){_0x124fea[_0x46e8('0x21')]=qs['limit'](_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x21')]);_0x124fea[_0x46e8('0x22')]=qs[_0x46e8('0x22')](_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x22')]);}_0x124fea[_0x46e8('0x3d')]=qs['sort'](_0x4ea8f4['query'][_0x46e8('0x3e')]);_0x124fea[_0x46e8('0x3f')]=qs[_0x46e8('0x40')](_['pick'](_0x4ea8f4['query'],_0x216400[_0x46e8('0x40')]),_0x3f3767);if(_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x41')]){_0x124fea[_0x46e8('0x3f')]=_['merge'](_0x124fea['where'],{'$or':_[_0x46e8('0x31')](_0x3f3767,function(_0x4f3b79){if(_0x4f3b79['type']!=='VIRTUAL'){var _0x5c44c4={};_0x5c44c4[_0x4f3b79[_0x46e8('0x2e')]]={'$like':'%'+_0x4ea8f4[_0x46e8('0x36')][_0x46e8('0x41')]+'%'};return _0x5c44c4;}})});}_0x124fea=_[_0x46e8('0x42')]({},_0x124fea,_0x4ea8f4[_0x46e8('0x43')]);var _0x505614={'where':_0x124fea[_0x46e8('0x3f')]};return db[_0x46e8('0x32')][_0x46e8('0x23')](_0x505614)['then'](function(_0x53f944){_0x1e9bf2['count']=_0x53f944;if(_0x4ea8f4['query'][_0x46e8('0x44')]){_0x124fea[_0x46e8('0x45')]=[{'all':!![]}];}return db[_0x46e8('0x32')][_0x46e8('0x46')](_0x124fea);})['then'](function(_0xaf3575){_0x1e9bf2['rows']=_0xaf3575;return _0x1e9bf2;})['then'](respondWithFilteredResult(_0x3aff84,_0x124fea))[_0x46e8('0x47')](handleError(_0x3aff84,null));};exports[_0x46e8('0x48')]=function(_0x2b5228,_0x3a586f){var _0x4602e0={'raw':![],'where':{'id':_0x2b5228[_0x46e8('0x49')]['id']}},_0xba264b={};_0xba264b[_0x46e8('0x35')]=_['keys'](db[_0x46e8('0x32')][_0x46e8('0x33')]);_0xba264b['query']=_[_0x46e8('0x37')](_0x2b5228[_0x46e8('0x36')]);_0xba264b['filters']=_['intersection'](_0xba264b[_0x46e8('0x35')],_0xba264b[_0x46e8('0x36')]);_0x4602e0[_0x46e8('0x3a')]=_[_0x46e8('0x38')](_0xba264b[_0x46e8('0x35')],qs['fields'](_0x2b5228[_0x46e8('0x36')][_0x46e8('0x39')]));_0x4602e0[_0x46e8('0x3a')]=_0x4602e0['attributes'][_0x46e8('0x4a')]?_0x4602e0['attributes']:_0xba264b[_0x46e8('0x35')];if(_0x2b5228['query'][_0x46e8('0x44')]){_0x4602e0[_0x46e8('0x45')]=[{'all':!![]}];}_0x4602e0=_[_0x46e8('0x42')]({},_0x4602e0,_0x2b5228[_0x46e8('0x43')]);return db[_0x46e8('0x32')][_0x46e8('0x4b')](_0x4602e0)[_0x46e8('0x29')](handleEntityNotFound(_0x3a586f,null))['then'](respondWithResult(_0x3a586f,null))[_0x46e8('0x47')](handleError(_0x3a586f,null));};exports[_0x46e8('0x4c')]=function(_0x3f4a28,_0x26b817){return db[_0x46e8('0x32')][_0x46e8('0x4c')](_0x3f4a28[_0x46e8('0x4d')],{})[_0x46e8('0x29')](respondWithResult(_0x26b817,0xc9))['catch'](handleError(_0x26b817,null));};exports[_0x46e8('0x28')]=function(_0x3c6fea,_0x58fa6f){if(_0x3c6fea['body']['id']){delete _0x3c6fea['body']['id'];}return db[_0x46e8('0x32')][_0x46e8('0x4b')]({'where':{'id':_0x3c6fea[_0x46e8('0x49')]['id']}})[_0x46e8('0x29')](handleEntityNotFound(_0x58fa6f,null))[_0x46e8('0x29')](saveUpdates(_0x3c6fea[_0x46e8('0x4d')],null))[_0x46e8('0x29')](respondWithResult(_0x58fa6f,null))[_0x46e8('0x47')](handleError(_0x58fa6f,null));};exports[_0x46e8('0x2a')]=function(_0x20d855,_0x366738){return db[_0x46e8('0x32')]['find']({'where':{'id':_0x20d855[_0x46e8('0x49')]['id']}})['then'](handleEntityNotFound(_0x366738,null))[_0x46e8('0x29')](removeEntity(_0x366738,null))['catch'](handleError(_0x366738,null));};exports['describe']=function(_0xbe1ff2,_0x340c4f){return db['VoiceQueueReport']['describe']()[_0x46e8('0x29')](respondWithResult(_0x340c4f,null))[_0x46e8('0x47')](handleError(_0x340c4f,null));};exports['getVoiceQueuesReport']=function(_0x125c9e,_0x463c4b){var _0x453ffb={},_0x5c7ec9={},_0x40f1f9={'count':0x0,'rows':[]};_0x5c7ec9[_0x46e8('0x35')]=_[_0x46e8('0x37')](db[_0x46e8('0x32')][_0x46e8('0x33')]);_0x5c7ec9[_0x46e8('0x36')]=_[_0x46e8('0x37')](_0x125c9e['query']);_0x5c7ec9[_0x46e8('0x40')]=_[_0x46e8('0x38')](_0x5c7ec9[_0x46e8('0x35')],_0x5c7ec9[_0x46e8('0x36')]);_0x453ffb[_0x46e8('0x3a')]=_[_0x46e8('0x38')](_0x5c7ec9[_0x46e8('0x35')],qs[_0x46e8('0x39')](_0x125c9e[_0x46e8('0x36')][_0x46e8('0x39')]));_0x453ffb[_0x46e8('0x3a')]=_0x453ffb[_0x46e8('0x3a')][_0x46e8('0x4a')]?_0x453ffb[_0x46e8('0x3a')]:_0x5c7ec9[_0x46e8('0x35')];if(!_0x125c9e[_0x46e8('0x36')]['hasOwnProperty'](_0x46e8('0x3c'))){_0x453ffb[_0x46e8('0x21')]=qs[_0x46e8('0x21')](_0x125c9e[_0x46e8('0x36')]['limit']);_0x453ffb[_0x46e8('0x22')]=qs[_0x46e8('0x22')](_0x125c9e[_0x46e8('0x36')]['offset']);}_0x453ffb[_0x46e8('0x3d')]=qs['sort'](_0x125c9e[_0x46e8('0x36')][_0x46e8('0x3e')]);_0x453ffb[_0x46e8('0x3f')]=qs[_0x46e8('0x40')](_[_0x46e8('0x4e')](_0x125c9e[_0x46e8('0x36')],_0x5c7ec9['filters']));if(_0x125c9e[_0x46e8('0x36')][_0x46e8('0x41')]){_0x453ffb[_0x46e8('0x3f')]=_[_0x46e8('0x42')](_0x453ffb[_0x46e8('0x3f')],{'$or':_['map'](_0x453ffb[_0x46e8('0x3a')],function(_0x46e76d){var _0x541c30={};_0x541c30[_0x46e76d]={'$like':'%'+_0x125c9e[_0x46e8('0x36')][_0x46e8('0x41')]+'%'};return _0x541c30;})});}_0x453ffb=_[_0x46e8('0x42')]({},_0x453ffb,_0x125c9e[_0x46e8('0x43')]);var _0x351ea9={'where':_0x453ffb['where']};return db[_0x46e8('0x32')][_0x46e8('0x23')](_0x351ea9)[_0x46e8('0x29')](function(_0x463882){_0x40f1f9[_0x46e8('0x23')]=_0x463882;if(_0x125c9e[_0x46e8('0x36')]['includeAll']){_0x453ffb[_0x46e8('0x45')]=[{'all':!![]}];}return db[_0x46e8('0x32')]['findAll'](_0x453ffb);})[_0x46e8('0x29')](function(_0xef1beb){_0x40f1f9['rows']=_0xef1beb;return _0x40f1f9;})[_0x46e8('0x29')](respondWithFilteredResult(_0x463c4b,_0x453ffb,_0x46e8('0x4f')))[_0x46e8('0x47')](handleError(_0x463c4b,null,_0x46e8('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 49e75dd..fc55ae8 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 _0xa40c=['VoiceQueueReport','setMaxListeners','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x495dd1,_0x3841de){var _0xff82a8=function(_0xd095bb){while(--_0xd095bb){_0x495dd1['push'](_0x495dd1['shift']());}};_0xff82a8(++_0x3841de);}(_0xa40c,0x12b));var _0xca40=function(_0x4a4ef9,_0x2084c5){_0x4a4ef9=_0x4a4ef9-0x0;var _0x4be2db=_0xa40c[_0x4a4ef9];return _0x4be2db;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xca40('0x0'))['db'][_0xca40('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xca40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b375c){return function(_0x16fc50,_0x4d992a,_0x229856){VoiceQueueReportEvents['emit'](_0x1b375c+':'+_0x16fc50['id'],_0x16fc50);VoiceQueueReportEvents[_0xca40('0x3')](_0x1b375c,_0x16fc50);_0x229856(null);};}for(var e in events){if(events[_0xca40('0x4')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xca40('0x5')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x423b=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x3e4579,_0x1747bd){var _0x4c87d1=function(_0x5988ae){while(--_0x5988ae){_0x3e4579['push'](_0x3e4579['shift']());}};_0x4c87d1(++_0x1747bd);}(_0x423b,0xe8));var _0xb423=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x423b[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require(_0xb423('0x0'));var VoiceQueueReport=require(_0xb423('0x1'))['db'][_0xb423('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb423('0x3')](0x0);var events={'afterCreate':_0xb423('0x4'),'afterUpdate':_0xb423('0x5'),'afterDestroy':_0xb423('0x6')};function emitEvent(_0xf90b53){return function(_0x44b5c0,_0x28796e,_0x2953ea){VoiceQueueReportEvents[_0xb423('0x7')](_0xf90b53+':'+_0x44b5c0['id'],_0x44b5c0);VoiceQueueReportEvents[_0xb423('0x7')](_0xf90b53,_0x44b5c0);_0x2953ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 81374ed..fe9931a 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 _0xf976=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','api','moment','bluebird','request-promise'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xf976,0x16f));var _0x6f97=function(_0x3d8fdb,_0x4c2f6b){_0x3d8fdb=_0x3d8fdb-0x0;var _0x5757e9=_0xf976[_0x3d8fdb];return _0x5757e9;};'use strict';var _=require(_0x6f97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6f97('0x1'));var moment=require(_0x6f97('0x2'));var BPromise=require(_0x6f97('0x3'));var rp=require(_0x6f97('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f97('0x5'));var attributes=require(_0x6f97('0x6'));module[_0x6f97('0x7')]=function(_0x3c1910,_0x4d0bff){return _0x3c1910[_0x6f97('0x8')](_0x6f97('0x9'),attributes,{'tableName':_0x6f97('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x6f97('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf52d=['../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x280f17,_0x197347){var _0xff4a86=function(_0x4c1f8b){while(--_0x4c1f8b){_0x280f17['push'](_0x280f17['shift']());}};_0xff4a86(++_0x197347);}(_0xf52d,0x85));var _0xdf52=function(_0x4c772a,_0x4e51fb){_0x4c772a=_0x4c772a-0x0;var _0x59ba42=_0xf52d[_0x4c772a];return _0x59ba42;};'use strict';var _=require(_0xdf52('0x0'));var util=require(_0xdf52('0x1'));var logger=require(_0xdf52('0x2'))('api');var moment=require(_0xdf52('0x3'));var BPromise=require(_0xdf52('0x4'));var rp=require(_0xdf52('0x5'));var fs=require('fs');var path=require(_0xdf52('0x6'));var rimraf=require('rimraf');var config=require(_0xdf52('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xdf52('0x8')]=function(_0x5873ae,_0x46ba60){return _0x5873ae[_0xdf52('0x9')](_0xdf52('0xa'),attributes,{'tableName':_0xdf52('0xb'),'paranoid':![],'indexes':[{'fields':[_0xdf52('0xc')]},{'fields':[_0xdf52('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f4cc85e..d02eb6c 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 _0x15f1=['model','attributes','catch','CreateVoiceQueueReport','info','UpdateVoiceQueueReport','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','include','map'];(function(_0x6824b5,_0x2aba15){var _0x42ef1b=function(_0x4c0368){while(--_0x4c0368){_0x6824b5['push'](_0x6824b5['shift']());}};_0x42ef1b(++_0x2aba15);}(_0x15f1,0x1ab));var _0x115f=function(_0x31fbd6,_0x28674d){_0x31fbd6=_0x31fbd6-0x0;var _0x5c2d5d=_0x15f1[_0x31fbd6];return _0x5c2d5d;};'use strict';var _=require(_0x115f('0x0'));var util=require('util');var moment=require(_0x115f('0x1'));var BPromise=require(_0x115f('0x2'));var rs=require(_0x115f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x115f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x115f('0x5'))(_0x115f('0x6'));var config=require(_0x115f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x115f('0x8')][_0x115f('0x9')]({'port':0x232a});config[_0x115f('0xa')]=_[_0x115f('0xb')](config['redis'],{'host':_0x115f('0xc'),'port':0x18eb});var socket=require(_0x115f('0xd'))(new Redis(config[_0x115f('0xa')]));require(_0x115f('0xe'))[_0x115f('0xf')](socket);function respondWithRpcPromise(_0x586c05,_0x24d9c4,_0x5513b8){return new BPromise(function(_0x137487,_0xf9b767){return client[_0x115f('0x10')](_0x586c05,_0x5513b8)[_0x115f('0x11')](function(_0x3d5fd7){logger['info'](_0x115f('0x12'),_0x24d9c4,'request\x20sent');logger[_0x115f('0x13')](_0x115f('0x14'),_0x24d9c4,_0x115f('0x15'),JSON[_0x115f('0x16')](_0x3d5fd7));if(_0x3d5fd7[_0x115f('0x17')]){if(_0x3d5fd7[_0x115f('0x17')][_0x115f('0x18')]===0x1f4){logger[_0x115f('0x17')](_0x115f('0x12'),_0x24d9c4,_0x3d5fd7[_0x115f('0x17')][_0x115f('0x19')]);return _0xf9b767(_0x3d5fd7[_0x115f('0x17')][_0x115f('0x19')]);}logger[_0x115f('0x17')](_0x115f('0x12'),_0x24d9c4,_0x3d5fd7[_0x115f('0x17')]['message']);return _0x137487(_0x3d5fd7[_0x115f('0x17')][_0x115f('0x19')]);}else{logger['info'](_0x115f('0x12'),_0x24d9c4,_0x115f('0x15'));_0x137487(_0x3d5fd7[_0x115f('0x1a')][_0x115f('0x19')]);}})['catch'](function(_0x36f785){logger[_0x115f('0x17')](_0x115f('0x12'),_0x24d9c4,_0x36f785);_0xf9b767(_0x36f785);});});}exports[_0x115f('0x1b')]=function(_0xbd0fdf){var _0x36f98f=this;return new Promise(function(_0x10236e,_0x238dd7){return db[_0x115f('0x1c')][_0x115f('0x1d')]({'raw':_0xbd0fdf[_0x115f('0x1e')]?_0xbd0fdf[_0x115f('0x1e')][_0x115f('0x1f')]===undefined?!![]:![]:!![],'where':_0xbd0fdf[_0x115f('0x1e')]?_0xbd0fdf[_0x115f('0x1e')]['where']||null:null,'attributes':_0xbd0fdf[_0x115f('0x1e')]?_0xbd0fdf[_0x115f('0x1e')]['attributes']||null:null,'limit':_0xbd0fdf[_0x115f('0x1e')]?_0xbd0fdf[_0x115f('0x1e')][_0x115f('0x20')]||null:null,'include':_0xbd0fdf[_0x115f('0x1e')]?_0xbd0fdf['options'][_0x115f('0x21')]?_[_0x115f('0x22')](_0xbd0fdf['options'][_0x115f('0x21')],function(_0x40df28){return{'model':db[_0x40df28[_0x115f('0x23')]],'as':_0x40df28['as'],'attributes':_0x40df28[_0x115f('0x24')],'include':_0x40df28[_0x115f('0x21')]?_[_0x115f('0x22')](_0x40df28[_0x115f('0x21')],function(_0x4d91eb){return{'model':db[_0x4d91eb['model']],'as':_0x4d91eb['as'],'attributes':_0x4d91eb[_0x115f('0x24')],'include':_0x4d91eb[_0x115f('0x21')]?_[_0x115f('0x22')](_0x4d91eb['include'],function(_0x2b1a12){return{'model':db[_0x2b1a12[_0x115f('0x23')]],'as':_0x2b1a12['as'],'attributes':_0x2b1a12[_0x115f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x115f('0x11')](function(_0x50cc9b){logger['info']('GetVoiceQueueReport',_0xbd0fdf);logger[_0x115f('0x13')](_0x115f('0x1b'),_0xbd0fdf,JSON[_0x115f('0x16')](_0x50cc9b));_0x10236e(_0x50cc9b);})[_0x115f('0x25')](function(_0x3a1843){logger[_0x115f('0x17')](_0x115f('0x1b'),_0x3a1843[_0x115f('0x19')],_0xbd0fdf);_0x238dd7(_0x36f98f[_0x115f('0x17')](0x1f4,_0x3a1843[_0x115f('0x19')]));});});};exports[_0x115f('0x26')]=function(_0x10af3d){var _0xa1b951=this;return new Promise(function(_0x1b18e1,_0x4074a2){return db[_0x115f('0x1c')]['create'](_0x10af3d['body'],{'raw':_0x10af3d[_0x115f('0x1e')]?_0x10af3d['options'][_0x115f('0x1f')]===undefined?!![]:![]:!![]})[_0x115f('0x11')](function(_0x41c647){logger[_0x115f('0x27')](_0x115f('0x26'),_0x10af3d);logger[_0x115f('0x13')]('CreateVoiceQueueReport',_0x10af3d,JSON[_0x115f('0x16')](_0x41c647));_0x1b18e1(_0x41c647);})[_0x115f('0x25')](function(_0x533a3d){logger[_0x115f('0x17')](_0x115f('0x26'),_0x533a3d[_0x115f('0x19')],_0x10af3d);_0x4074a2(_0xa1b951[_0x115f('0x17')](0x1f4,_0x533a3d[_0x115f('0x19')]));});});};exports[_0x115f('0x28')]=function(_0x35c8c6){var _0x78260d=this;return new Promise(function(_0x2cd71f,_0x274445){return db[_0x115f('0x1c')]['update'](_0x35c8c6['body'],{'raw':_0x35c8c6[_0x115f('0x1e')]?_0x35c8c6['options'][_0x115f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c8c6[_0x115f('0x1e')]?_0x35c8c6[_0x115f('0x1e')][_0x115f('0x29')]||null:null,'attributes':_0x35c8c6['options']?_0x35c8c6[_0x115f('0x1e')][_0x115f('0x24')]||null:null,'limit':_0x35c8c6[_0x115f('0x1e')]?_0x35c8c6[_0x115f('0x1e')][_0x115f('0x20')]||null:null})['then'](function(_0x282d38){logger['info']('UpdateVoiceQueueReport',_0x35c8c6);logger[_0x115f('0x13')](_0x115f('0x28'),_0x35c8c6,JSON['stringify'](_0x282d38));_0x2cd71f(_0x282d38);})[_0x115f('0x25')](function(_0x3bb105){logger[_0x115f('0x17')](_0x115f('0x28'),_0x3bb105[_0x115f('0x19')],_0x35c8c6);_0x274445(_0x78260d['error'](0x1f4,_0x3bb105[_0x115f('0x19')]));});});}; \ No newline at end of file +var _0x44da=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceQueueReport','findAll','raw','options','where','limit','include','map','model','attributes','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis'];(function(_0x3c1b73,_0x230a4b){var _0x454ee6=function(_0xfffcc6){while(--_0xfffcc6){_0x3c1b73['push'](_0x3c1b73['shift']());}};_0x454ee6(++_0x230a4b);}(_0x44da,0x170));var _0xa44d=function(_0x3ca46d,_0x225498){_0x3ca46d=_0x3ca46d-0x0;var _0xfc47e4=_0x44da[_0x3ca46d];return _0xfc47e4;};'use strict';var _=require(_0xa44d('0x0'));var util=require(_0xa44d('0x1'));var moment=require(_0xa44d('0x2'));var BPromise=require(_0xa44d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa44d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa44d('0x5'));var logger=require(_0xa44d('0x6'))(_0xa44d('0x7'));var config=require(_0xa44d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xa44d('0x9')]=_[_0xa44d('0xa')](config[_0xa44d('0x9')],{'host':_0xa44d('0xb'),'port':0x18eb});var socket=require(_0xa44d('0xc'))(new Redis(config[_0xa44d('0x9')]));require(_0xa44d('0xd'))[_0xa44d('0xe')](socket);function respondWithRpcPromise(_0x2adea3,_0x437129,_0x3d8c28){return new BPromise(function(_0x1641ad,_0x4ddae4){return client['request'](_0x2adea3,_0x3d8c28)[_0xa44d('0xf')](function(_0xf266bd){logger['info'](_0xa44d('0x10'),_0x437129,_0xa44d('0x11'));logger[_0xa44d('0x12')](_0xa44d('0x13'),_0x437129,_0xa44d('0x11'),JSON[_0xa44d('0x14')](_0xf266bd));if(_0xf266bd[_0xa44d('0x15')]){if(_0xf266bd[_0xa44d('0x15')][_0xa44d('0x16')]===0x1f4){logger['error'](_0xa44d('0x10'),_0x437129,_0xf266bd[_0xa44d('0x15')][_0xa44d('0x17')]);return _0x4ddae4(_0xf266bd[_0xa44d('0x15')][_0xa44d('0x17')]);}logger[_0xa44d('0x15')](_0xa44d('0x10'),_0x437129,_0xf266bd[_0xa44d('0x15')]['message']);return _0x1641ad(_0xf266bd[_0xa44d('0x15')][_0xa44d('0x17')]);}else{logger[_0xa44d('0x18')](_0xa44d('0x10'),_0x437129,_0xa44d('0x11'));_0x1641ad(_0xf266bd['result'][_0xa44d('0x17')]);}})[_0xa44d('0x19')](function(_0x14ffad){logger['error'](_0xa44d('0x10'),_0x437129,_0x14ffad);_0x4ddae4(_0x14ffad);});});}exports['GetVoiceQueueReport']=function(_0x4a9b7b){var _0x5b28f8=this;return new Promise(function(_0x4fc8cc,_0x591399){return db[_0xa44d('0x1a')][_0xa44d('0x1b')]({'raw':_0x4a9b7b['options']?_0x4a9b7b['options'][_0xa44d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a9b7b['options']?_0x4a9b7b[_0xa44d('0x1d')][_0xa44d('0x1e')]||null:null,'attributes':_0x4a9b7b[_0xa44d('0x1d')]?_0x4a9b7b[_0xa44d('0x1d')]['attributes']||null:null,'limit':_0x4a9b7b[_0xa44d('0x1d')]?_0x4a9b7b[_0xa44d('0x1d')][_0xa44d('0x1f')]||null:null,'include':_0x4a9b7b[_0xa44d('0x1d')]?_0x4a9b7b[_0xa44d('0x1d')][_0xa44d('0x20')]?_[_0xa44d('0x21')](_0x4a9b7b[_0xa44d('0x1d')][_0xa44d('0x20')],function(_0x4e2aba){return{'model':db[_0x4e2aba[_0xa44d('0x22')]],'as':_0x4e2aba['as'],'attributes':_0x4e2aba[_0xa44d('0x23')],'include':_0x4e2aba[_0xa44d('0x20')]?_['map'](_0x4e2aba[_0xa44d('0x20')],function(_0x12b004){return{'model':db[_0x12b004[_0xa44d('0x22')]],'as':_0x12b004['as'],'attributes':_0x12b004['attributes'],'include':_0x12b004[_0xa44d('0x20')]?_[_0xa44d('0x21')](_0x12b004[_0xa44d('0x20')],function(_0x299c36){return{'model':db[_0x299c36['model']],'as':_0x299c36['as'],'attributes':_0x299c36['attributes']};}):[]};}):[]};}):[]:[]})[_0xa44d('0xf')](function(_0x2d7f81){logger[_0xa44d('0x18')](_0xa44d('0x24'),_0x4a9b7b);logger[_0xa44d('0x12')](_0xa44d('0x24'),_0x4a9b7b,JSON['stringify'](_0x2d7f81));_0x4fc8cc(_0x2d7f81);})['catch'](function(_0x20670a){logger[_0xa44d('0x15')](_0xa44d('0x24'),_0x20670a[_0xa44d('0x17')],_0x4a9b7b);_0x591399(_0x5b28f8['error'](0x1f4,_0x20670a[_0xa44d('0x17')]));});});};exports[_0xa44d('0x25')]=function(_0x1f16b4){var _0x5d3eb8=this;return new Promise(function(_0x366b6e,_0x183450){return db['VoiceQueueReport'][_0xa44d('0x26')](_0x1f16b4[_0xa44d('0x27')],{'raw':_0x1f16b4[_0xa44d('0x1d')]?_0x1f16b4[_0xa44d('0x1d')][_0xa44d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x6459a9){logger['info'](_0xa44d('0x25'),_0x1f16b4);logger['debug'](_0xa44d('0x25'),_0x1f16b4,JSON['stringify'](_0x6459a9));_0x366b6e(_0x6459a9);})[_0xa44d('0x19')](function(_0x3ce7f1){logger[_0xa44d('0x15')](_0xa44d('0x25'),_0x3ce7f1[_0xa44d('0x17')],_0x1f16b4);_0x183450(_0x5d3eb8['error'](0x1f4,_0x3ce7f1[_0xa44d('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x17f871){var _0xf25fea=this;return new Promise(function(_0x53a559,_0x3671d7){return db['VoiceQueueReport'][_0xa44d('0x28')](_0x17f871[_0xa44d('0x27')],{'raw':_0x17f871[_0xa44d('0x1d')]?_0x17f871[_0xa44d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f871[_0xa44d('0x1d')]?_0x17f871[_0xa44d('0x1d')][_0xa44d('0x1e')]||null:null,'attributes':_0x17f871[_0xa44d('0x1d')]?_0x17f871[_0xa44d('0x1d')]['attributes']||null:null,'limit':_0x17f871['options']?_0x17f871[_0xa44d('0x1d')]['limit']||null:null})[_0xa44d('0xf')](function(_0x26dbfb){logger[_0xa44d('0x18')](_0xa44d('0x29'),_0x17f871);logger[_0xa44d('0x12')](_0xa44d('0x29'),_0x17f871,JSON['stringify'](_0x26dbfb));_0x53a559(_0x26dbfb);})[_0xa44d('0x19')](function(_0x30355d){logger[_0xa44d('0x15')](_0xa44d('0x29'),_0x30355d[_0xa44d('0x17')],_0x17f871);_0x3671d7(_0xf25fea[_0xa44d('0x15')](0x1f4,_0x30355d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 663d822..1043044 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 _0x1b07=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x506cbe,_0x818678){var _0x4fdaa7=function(_0x28db18){while(--_0x28db18){_0x506cbe['push'](_0x506cbe['shift']());}};_0x4fdaa7(++_0x818678);}(_0x1b07,0x1ca));var _0x71b0=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x1b07[_0x3f9584];return _0x9d54c;};'use strict';var VoiceQueueReportEvents=require(_0x71b0('0x0'));var events=[_0x71b0('0x1'),_0x71b0('0x2'),'update'];function createListener(_0x4a2bbc,_0x7c0261){return function(_0x1b4256){_0x7c0261[_0x71b0('0x3')](_0x4a2bbc,_0x1b4256);};}function removeListener(_0x14ff23,_0x392f8d){return function(){VoiceQueueReportEvents['removeListener'](_0x14ff23,_0x392f8d);};}exports[_0x71b0('0x4')]=function(_0x4e0da3){for(var _0x225d7b=0x0,_0x10a911=events[_0x71b0('0x5')];_0x225d7b<_0x10a911;_0x225d7b++){var _0x5d010a=events[_0x225d7b];var _0x1c7534=createListener(_0x71b0('0x6')+_0x5d010a,_0x4e0da3);VoiceQueueReportEvents['on'](_0x5d010a,_0x1c7534);}}; \ No newline at end of file +var _0x5183=['./voiceQueueReport.events','save','remove','emit','register','voiceQueueReport:'];(function(_0x327f41,_0x5c3672){var _0x3ffdae=function(_0x128465){while(--_0x128465){_0x327f41['push'](_0x327f41['shift']());}};_0x3ffdae(++_0x5c3672);}(_0x5183,0x13e));var _0x3518=function(_0x449c5c,_0x2c7ef3){_0x449c5c=_0x449c5c-0x0;var _0xd4a742=_0x5183[_0x449c5c];return _0xd4a742;};'use strict';var VoiceQueueReportEvents=require(_0x3518('0x0'));var events=[_0x3518('0x1'),_0x3518('0x2'),'update'];function createListener(_0x5b6958,_0x2323f3){return function(_0x3cc276){_0x2323f3[_0x3518('0x3')](_0x5b6958,_0x3cc276);};}function removeListener(_0x421ab5,_0x5a38df){return function(){VoiceQueueReportEvents['removeListener'](_0x421ab5,_0x5a38df);};}exports[_0x3518('0x4')]=function(_0x1031a9){for(var _0x2c019c=0x0,_0x482b2d=events['length'];_0x2c019c<_0x482b2d;_0x2c019c++){var _0x488c52=events[_0x2c019c];var _0x147b59=createListener(_0x3518('0x5')+_0x488c52,_0x1031a9);VoiceQueueReportEvents['on'](_0x488c52,_0x147b59);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2b10aaa..0708e3a 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 _0x00f0=['post','create','put','isAuthenticated','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','show'];(function(_0x3d01bb,_0x365a7b){var _0x4275f6=function(_0x516e91){while(--_0x516e91){_0x3d01bb['push'](_0x3d01bb['shift']());}};_0x4275f6(++_0x365a7b);}(_0x00f0,0xf0));var _0x000f=function(_0x1aea7f,_0x15b6c1){_0x1aea7f=_0x1aea7f-0x0;var _0x5f1018=_0x00f0[_0x1aea7f];return _0x5f1018;};'use strict';var multer=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var path=require(_0x000f('0x2'));var timeout=require(_0x000f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x000f('0x4'));var auth=require(_0x000f('0x5'));var interaction=require(_0x000f('0x6'));var config=require(_0x000f('0x7'));var controller=require(_0x000f('0x8'));router[_0x000f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x000f('0x9')](_0x000f('0xa'),auth['isAuthenticated'](),controller[_0x000f('0xb')]);router[_0x000f('0xc')]('/',auth['isAuthenticated'](),controller[_0x000f('0xd')]);router[_0x000f('0xe')]('/:id',auth[_0x000f('0xf')](),controller[_0x000f('0x10')]);router['delete'](_0x000f('0xa'),auth[_0x000f('0xf')](),controller[_0x000f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x93ea=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','update'];(function(_0xd3cdef,_0x4c1145){var _0x242688=function(_0x1cf5c4){while(--_0x1cf5c4){_0xd3cdef['push'](_0xd3cdef['shift']());}};_0x242688(++_0x4c1145);}(_0x93ea,0x131));var _0xa93e=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x93ea[_0x2b8077];return _0x308091;};'use strict';var multer=require(_0xa93e('0x0'));var util=require(_0xa93e('0x1'));var path=require('path');var timeout=require(_0xa93e('0x2'));var express=require(_0xa93e('0x3'));var router=express['Router']();var fs_extra=require(_0xa93e('0x4'));var auth=require(_0xa93e('0x5'));var interaction=require(_0xa93e('0x6'));var config=require(_0xa93e('0x7'));var controller=require(_0xa93e('0x8'));router[_0xa93e('0x9')]('/',auth[_0xa93e('0xa')](),controller[_0xa93e('0xb')]);router[_0xa93e('0x9')](_0xa93e('0xc'),auth[_0xa93e('0xa')](),controller['show']);router[_0xa93e('0xd')]('/',auth[_0xa93e('0xa')](),controller['create']);router['put'](_0xa93e('0xc'),auth['isAuthenticated'](),controller[_0xa93e('0xe')]);router['delete'](_0xa93e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa93e('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d59eb91..9aa1807 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 _0xfd9f=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x8e4991,_0x1bf2e4){var _0x5a0814=function(_0x10dc3d){while(--_0x10dc3d){_0x8e4991['push'](_0x8e4991['shift']());}};_0x5a0814(++_0x1bf2e4);}(_0xfd9f,0x10b));var _0xffd9=function(_0x5cf05f,_0x30ee62){_0x5cf05f=_0x5cf05f-0x0;var _0x3b88e5=_0xfd9f[_0x5cf05f];return _0x3b88e5;};'use strict';var Sequelize=require(_0xffd9('0x0'));var moment=require(_0xffd9('0x1'));module[_0xffd9('0x2')]={'time':{'type':Sequelize[_0xffd9('0x3')]},'callid':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xffd9('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xffd9('0x4')](_0xffd9('0x5'))}}; \ No newline at end of file +var _0xf102=['literal','sequelize','moment','STRING','DATE'];(function(_0x3c4128,_0x56b7a2){var _0x423d21=function(_0x2ea850){while(--_0x2ea850){_0x3c4128['push'](_0x3c4128['shift']());}};_0x423d21(++_0x56b7a2);}(_0xf102,0xb5));var _0x2f10=function(_0x328b1c,_0xec0b4f){_0x328b1c=_0x328b1c-0x0;var _0x4dbeaa=_0xf102[_0x328b1c];return _0x4dbeaa;};'use strict';var Sequelize=require(_0x2f10('0x0'));var moment=require(_0x2f10('0x1'));module['exports']={'time':{'type':Sequelize[_0x2f10('0x2')]},'callid':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2f10('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2f10('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x2f10('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a3c404c..260b89c 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 _0xb902=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto'];(function(_0x47a8d8,_0x3d57e1){var _0x314efd=function(_0x34b32a){while(--_0x34b32a){_0x47a8d8['push'](_0x47a8d8['shift']());}};_0x314efd(++_0x3d57e1);}(_0xb902,0xda));var _0x2b90=function(_0x329101,_0x1eb476){_0x329101=_0x329101-0x0;var _0x1641d6=_0xb902[_0x329101];return _0x1641d6;};'use strict';var emlformat=require(_0x2b90('0x0'));var rimraf=require(_0x2b90('0x1'));var zipdir=require(_0x2b90('0x2'));var jsonpatch=require(_0x2b90('0x3'));var rp=require('request-promise');var moment=require(_0x2b90('0x4'));var BPromise=require(_0x2b90('0x5'));var Mustache=require(_0x2b90('0x6'));var util=require(_0x2b90('0x7'));var path=require('path');var sox=require(_0x2b90('0x8'));var csv=require('to-csv');var ejs=require(_0x2b90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b90('0xa'));var squel=require(_0x2b90('0xb'));var crypto=require(_0x2b90('0xc'));var jsforce=require(_0x2b90('0xd'));var deskjs=require(_0x2b90('0xe'));var toCsv=require(_0x2b90('0xf'));var querystring=require(_0x2b90('0x10'));var Papa=require(_0x2b90('0x11'));var Redis=require(_0x2b90('0x12'));var authService=require(_0x2b90('0x13'));var qs=require(_0x2b90('0x14'));var as=require(_0x2b90('0x15'));var hardwareService=require(_0x2b90('0x16'));var logger=require(_0x2b90('0x17'))(_0x2b90('0x18'));var utils=require('../../config/utils');var config=require(_0x2b90('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e90fe,_0x347b5e){_0x347b5e=_0x347b5e||0xcc;return function(_0x3268f0){if(_0x3268f0){return _0x3e90fe[_0x2b90('0x1a')](_0x347b5e);}return _0x3e90fe['status'](_0x347b5e)[_0x2b90('0x1b')]();};}function respondWithResult(_0x7241a7,_0x1703fa){_0x1703fa=_0x1703fa||0xc8;return function(_0x2c4443){if(_0x2c4443){return _0x7241a7['status'](_0x1703fa)[_0x2b90('0x1c')](_0x2c4443);}};}function respondWithFilteredResult(_0x436535,_0x1288c0){return function(_0x1bcc0f){if(_0x1bcc0f){var _0x2851fd=typeof _0x1288c0['offset']==='undefined'&&typeof _0x1288c0[_0x2b90('0x1d')]===_0x2b90('0x1e');var _0x1d01f5=_0x1bcc0f[_0x2b90('0x1f')];var _0x1443d0=_0x2851fd?0x0:_0x1288c0[_0x2b90('0x20')];var _0x2a8bf8=_0x2851fd?_0x1bcc0f[_0x2b90('0x1f')]:_0x1288c0['offset']+_0x1288c0[_0x2b90('0x1d')];var _0x4d5d7f;if(_0x2a8bf8>=_0x1d01f5){_0x2a8bf8=_0x1d01f5;_0x4d5d7f=0xc8;}else{_0x4d5d7f=0xce;}_0x436535[_0x2b90('0x21')](_0x4d5d7f);return _0x436535[_0x2b90('0x22')](_0x2b90('0x23'),_0x1443d0+'-'+_0x2a8bf8+'/'+_0x1d01f5)[_0x2b90('0x1c')](_0x1bcc0f);}return null;};}function patchUpdates(_0x662bb2){return function(_0x29b3d6){try{jsonpatch['apply'](_0x29b3d6,_0x662bb2,!![]);}catch(_0xcb4187){return BPromise[_0x2b90('0x24')](_0xcb4187);}return _0x29b3d6[_0x2b90('0x25')]();};}function saveUpdates(_0x41f4e9,_0x80f145){return function(_0x58801e){if(_0x58801e){return _0x58801e[_0x2b90('0x26')](_0x41f4e9)[_0x2b90('0x27')](function(_0x291c61){return _0x291c61;});}return null;};}function removeEntity(_0x49a60b,_0x3ac9a5){return function(_0x39bbf3){if(_0x39bbf3){return _0x39bbf3[_0x2b90('0x28')]()[_0x2b90('0x27')](function(){_0x49a60b['status'](0xcc)[_0x2b90('0x1b')]();});}};}function handleEntityNotFound(_0x21f165,_0x7699ac){return function(_0x5d1292){if(!_0x5d1292){_0x21f165[_0x2b90('0x1a')](0x194);}return _0x5d1292;};}function handleError(_0x2cc265,_0x4c8a4b){_0x4c8a4b=_0x4c8a4b||0x1f4;return function(_0x17bb6d){logger[_0x2b90('0x29')](_0x17bb6d[_0x2b90('0x2a')]);if(_0x17bb6d[_0x2b90('0x2b')]){delete _0x17bb6d[_0x2b90('0x2b')];}_0x2cc265[_0x2b90('0x21')](_0x4c8a4b)[_0x2b90('0x2c')](_0x17bb6d);};}exports['index']=function(_0x28fe69,_0x53b68f){var _0x3df2df={},_0x45b6ee={},_0x125f52={'count':0x0,'rows':[]};var _0x32948e=_[_0x2b90('0x2d')](db[_0x2b90('0x2e')][_0x2b90('0x2f')],function(_0x48957a){return{'name':_0x48957a[_0x2b90('0x30')],'type':_0x48957a['type'][_0x2b90('0x31')]};});_0x45b6ee[_0x2b90('0x32')]=_['map'](_0x32948e,_0x2b90('0x2b'));_0x45b6ee[_0x2b90('0x33')]=_[_0x2b90('0x34')](_0x28fe69[_0x2b90('0x33')]);_0x45b6ee[_0x2b90('0x35')]=_[_0x2b90('0x36')](_0x45b6ee['model'],_0x45b6ee[_0x2b90('0x33')]);_0x3df2df[_0x2b90('0x37')]=_[_0x2b90('0x36')](_0x45b6ee['model'],qs[_0x2b90('0x38')](_0x28fe69[_0x2b90('0x33')][_0x2b90('0x38')]));_0x3df2df[_0x2b90('0x37')]=_0x3df2df[_0x2b90('0x37')]['length']?_0x3df2df['attributes']:_0x45b6ee[_0x2b90('0x32')];if(!_0x28fe69['query'][_0x2b90('0x39')](_0x2b90('0x3a'))){_0x3df2df[_0x2b90('0x1d')]=qs['limit'](_0x28fe69[_0x2b90('0x33')][_0x2b90('0x1d')]);_0x3df2df['offset']=qs[_0x2b90('0x20')](_0x28fe69[_0x2b90('0x33')][_0x2b90('0x20')]);}_0x3df2df['order']=qs['sort'](_0x28fe69[_0x2b90('0x33')][_0x2b90('0x3b')]);_0x3df2df[_0x2b90('0x3c')]=qs[_0x2b90('0x35')](_[_0x2b90('0x3d')](_0x28fe69[_0x2b90('0x33')],_0x45b6ee['filters']),_0x32948e);if(_0x28fe69[_0x2b90('0x33')][_0x2b90('0x3e')]){_0x3df2df['where']=_[_0x2b90('0x3f')](_0x3df2df['where'],{'$or':_['map'](_0x32948e,function(_0x373ceb){if(_0x373ceb[_0x2b90('0x40')]!==_0x2b90('0x41')){var _0x2a6e09={};_0x2a6e09[_0x373ceb[_0x2b90('0x2b')]]={'$like':'%'+_0x28fe69[_0x2b90('0x33')]['filter']+'%'};return _0x2a6e09;}})});}_0x3df2df=_[_0x2b90('0x3f')]({},_0x3df2df,_0x28fe69[_0x2b90('0x42')]);var _0x19c325={'where':_0x3df2df[_0x2b90('0x3c')]};return db[_0x2b90('0x2e')][_0x2b90('0x1f')](_0x19c325)['then'](function(_0x318fd1){_0x125f52[_0x2b90('0x1f')]=_0x318fd1;if(_0x28fe69['query'][_0x2b90('0x43')]){_0x3df2df[_0x2b90('0x44')]=[{'all':!![]}];}return db[_0x2b90('0x2e')]['findAll'](_0x3df2df);})[_0x2b90('0x27')](function(_0x97c7e4){_0x125f52[_0x2b90('0x45')]=_0x97c7e4;return _0x125f52;})[_0x2b90('0x27')](respondWithFilteredResult(_0x53b68f,_0x3df2df))[_0x2b90('0x46')](handleError(_0x53b68f,null));};exports[_0x2b90('0x47')]=function(_0x2aa9ef,_0x201db2){var _0x1654bc={'raw':!![],'where':{'id':_0x2aa9ef[_0x2b90('0x48')]['id']}},_0x2d0069={};_0x2d0069[_0x2b90('0x32')]=_[_0x2b90('0x34')](db[_0x2b90('0x2e')][_0x2b90('0x2f')]);_0x2d0069[_0x2b90('0x33')]=_[_0x2b90('0x34')](_0x2aa9ef[_0x2b90('0x33')]);_0x2d0069[_0x2b90('0x35')]=_[_0x2b90('0x36')](_0x2d0069['model'],_0x2d0069[_0x2b90('0x33')]);_0x1654bc['attributes']=_[_0x2b90('0x36')](_0x2d0069[_0x2b90('0x32')],qs[_0x2b90('0x38')](_0x2aa9ef[_0x2b90('0x33')][_0x2b90('0x38')]));_0x1654bc[_0x2b90('0x37')]=_0x1654bc['attributes'][_0x2b90('0x49')]?_0x1654bc[_0x2b90('0x37')]:_0x2d0069[_0x2b90('0x32')];if(_0x2aa9ef['query'][_0x2b90('0x43')]){_0x1654bc[_0x2b90('0x44')]=[{'all':!![]}];}_0x1654bc=_[_0x2b90('0x3f')]({},_0x1654bc,_0x2aa9ef[_0x2b90('0x42')]);return db[_0x2b90('0x2e')][_0x2b90('0x4a')](_0x1654bc)[_0x2b90('0x27')](handleEntityNotFound(_0x201db2,null))[_0x2b90('0x27')](respondWithResult(_0x201db2,null))['catch'](handleError(_0x201db2,null));};exports['create']=function(_0x1cbffd,_0x99e920){return db[_0x2b90('0x2e')][_0x2b90('0x4b')](_0x1cbffd[_0x2b90('0x4c')],{})[_0x2b90('0x27')](respondWithResult(_0x99e920,0xc9))[_0x2b90('0x46')](handleError(_0x99e920,null));};exports[_0x2b90('0x26')]=function(_0x19baa2,_0x3a7693){if(_0x19baa2['body']['id']){delete _0x19baa2[_0x2b90('0x4c')]['id'];}return db[_0x2b90('0x2e')][_0x2b90('0x4a')]({'where':{'id':_0x19baa2[_0x2b90('0x48')]['id']}})[_0x2b90('0x27')](handleEntityNotFound(_0x3a7693,null))[_0x2b90('0x27')](saveUpdates(_0x19baa2[_0x2b90('0x4c')],null))[_0x2b90('0x27')](respondWithResult(_0x3a7693,null))['catch'](handleError(_0x3a7693,null));};exports[_0x2b90('0x28')]=function(_0x320b3d,_0x55a472){return db[_0x2b90('0x2e')]['find']({'where':{'id':_0x320b3d[_0x2b90('0x48')]['id']}})[_0x2b90('0x27')](handleEntityNotFound(_0x55a472,null))[_0x2b90('0x27')](removeEntity(_0x55a472,null))[_0x2b90('0x46')](handleError(_0x55a472,null));}; \ No newline at end of file +var _0x7867=['json','undefined','count','offset','limit','status','Content-Range','apply','save','update','then','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x50d2d6,_0x4b0f9d){var _0x345f36=function(_0x827382){while(--_0x827382){_0x50d2d6['push'](_0x50d2d6['shift']());}};_0x345f36(++_0x4b0f9d);}(_0x7867,0x186));var _0x7786=function(_0x26c3b9,_0x2acb85){_0x26c3b9=_0x26c3b9-0x0;var _0x1cfcfe=_0x7867[_0x26c3b9];return _0x1cfcfe;};'use strict';var emlformat=require(_0x7786('0x0'));var rimraf=require(_0x7786('0x1'));var zipdir=require(_0x7786('0x2'));var jsonpatch=require(_0x7786('0x3'));var rp=require(_0x7786('0x4'));var moment=require(_0x7786('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7786('0x6'));var csv=require(_0x7786('0x7'));var ejs=require(_0x7786('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7786('0x9'));var squel=require(_0x7786('0xa'));var crypto=require(_0x7786('0xb'));var jsforce=require(_0x7786('0xc'));var deskjs=require(_0x7786('0xd'));var toCsv=require(_0x7786('0x7'));var querystring=require('querystring');var Papa=require(_0x7786('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7786('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7786('0x10'))(_0x7786('0x11'));var utils=require(_0x7786('0x12'));var config=require(_0x7786('0x13'));var licenseUtil=require(_0x7786('0x14'));var db=require(_0x7786('0x15'))['db'];function respondWithStatusCode(_0x49e282,_0x5be889){_0x5be889=_0x5be889||0xcc;return function(_0x28bece){if(_0x28bece){return _0x49e282[_0x7786('0x16')](_0x5be889);}return _0x49e282['status'](_0x5be889)[_0x7786('0x17')]();};}function respondWithResult(_0x42977b,_0x241343){_0x241343=_0x241343||0xc8;return function(_0xd151ae){if(_0xd151ae){return _0x42977b['status'](_0x241343)[_0x7786('0x18')](_0xd151ae);}};}function respondWithFilteredResult(_0x396421,_0x4cf61b){return function(_0x4c6d9a){if(_0x4c6d9a){var _0x1acafe=typeof _0x4cf61b['offset']===_0x7786('0x19')&&typeof _0x4cf61b['limit']===_0x7786('0x19');var _0x5b8db7=_0x4c6d9a[_0x7786('0x1a')];var _0x3ef44b=_0x1acafe?0x0:_0x4cf61b[_0x7786('0x1b')];var _0x1e6d0b=_0x1acafe?_0x4c6d9a[_0x7786('0x1a')]:_0x4cf61b[_0x7786('0x1b')]+_0x4cf61b[_0x7786('0x1c')];var _0x53786d;if(_0x1e6d0b>=_0x5b8db7){_0x1e6d0b=_0x5b8db7;_0x53786d=0xc8;}else{_0x53786d=0xce;}_0x396421[_0x7786('0x1d')](_0x53786d);return _0x396421['set'](_0x7786('0x1e'),_0x3ef44b+'-'+_0x1e6d0b+'/'+_0x5b8db7)[_0x7786('0x18')](_0x4c6d9a);}return null;};}function patchUpdates(_0x1461d4){return function(_0x2dc03e){try{jsonpatch[_0x7786('0x1f')](_0x2dc03e,_0x1461d4,!![]);}catch(_0x574af4){return BPromise['reject'](_0x574af4);}return _0x2dc03e[_0x7786('0x20')]();};}function saveUpdates(_0x48f6d4,_0x407da0){return function(_0x3b6847){if(_0x3b6847){return _0x3b6847[_0x7786('0x21')](_0x48f6d4)[_0x7786('0x22')](function(_0x3bef2f){return _0x3bef2f;});}return null;};}function removeEntity(_0x5b0376,_0x3c7971){return function(_0x215fd7){if(_0x215fd7){return _0x215fd7['destroy']()[_0x7786('0x22')](function(){_0x5b0376[_0x7786('0x1d')](0xcc)[_0x7786('0x17')]();});}};}function handleEntityNotFound(_0x3d3798,_0x9d69a5){return function(_0x1977ea){if(!_0x1977ea){_0x3d3798[_0x7786('0x16')](0x194);}return _0x1977ea;};}function handleError(_0x377531,_0x15b4dc){_0x15b4dc=_0x15b4dc||0x1f4;return function(_0x1a38a0){logger['error'](_0x1a38a0['stack']);if(_0x1a38a0[_0x7786('0x23')]){delete _0x1a38a0[_0x7786('0x23')];}_0x377531[_0x7786('0x1d')](_0x15b4dc)['send'](_0x1a38a0);};}exports[_0x7786('0x24')]=function(_0xe9756f,_0x20a909){var _0x2dc63a={},_0x387245={},_0xabb923={'count':0x0,'rows':[]};var _0x49b6fa=_['map'](db[_0x7786('0x25')][_0x7786('0x26')],function(_0x3fac17){return{'name':_0x3fac17[_0x7786('0x27')],'type':_0x3fac17[_0x7786('0x28')][_0x7786('0x29')]};});_0x387245[_0x7786('0x2a')]=_[_0x7786('0x2b')](_0x49b6fa,_0x7786('0x23'));_0x387245[_0x7786('0x2c')]=_[_0x7786('0x2d')](_0xe9756f[_0x7786('0x2c')]);_0x387245[_0x7786('0x2e')]=_[_0x7786('0x2f')](_0x387245[_0x7786('0x2a')],_0x387245['query']);_0x2dc63a[_0x7786('0x30')]=_[_0x7786('0x2f')](_0x387245[_0x7786('0x2a')],qs[_0x7786('0x31')](_0xe9756f[_0x7786('0x2c')]['fields']));_0x2dc63a[_0x7786('0x30')]=_0x2dc63a[_0x7786('0x30')][_0x7786('0x32')]?_0x2dc63a[_0x7786('0x30')]:_0x387245[_0x7786('0x2a')];if(!_0xe9756f['query']['hasOwnProperty'](_0x7786('0x33'))){_0x2dc63a[_0x7786('0x1c')]=qs[_0x7786('0x1c')](_0xe9756f[_0x7786('0x2c')][_0x7786('0x1c')]);_0x2dc63a[_0x7786('0x1b')]=qs[_0x7786('0x1b')](_0xe9756f[_0x7786('0x2c')][_0x7786('0x1b')]);}_0x2dc63a[_0x7786('0x34')]=qs[_0x7786('0x35')](_0xe9756f[_0x7786('0x2c')][_0x7786('0x35')]);_0x2dc63a[_0x7786('0x36')]=qs[_0x7786('0x2e')](_['pick'](_0xe9756f['query'],_0x387245['filters']),_0x49b6fa);if(_0xe9756f[_0x7786('0x2c')][_0x7786('0x37')]){_0x2dc63a[_0x7786('0x36')]=_[_0x7786('0x38')](_0x2dc63a[_0x7786('0x36')],{'$or':_[_0x7786('0x2b')](_0x49b6fa,function(_0x20c40a){if(_0x20c40a[_0x7786('0x28')]!==_0x7786('0x39')){var _0x3e94e1={};_0x3e94e1[_0x20c40a[_0x7786('0x23')]]={'$like':'%'+_0xe9756f[_0x7786('0x2c')][_0x7786('0x37')]+'%'};return _0x3e94e1;}})});}_0x2dc63a=_[_0x7786('0x38')]({},_0x2dc63a,_0xe9756f[_0x7786('0x3a')]);var _0x166116={'where':_0x2dc63a[_0x7786('0x36')]};return db[_0x7786('0x25')][_0x7786('0x1a')](_0x166116)['then'](function(_0xc5c3ce){_0xabb923['count']=_0xc5c3ce;if(_0xe9756f[_0x7786('0x2c')][_0x7786('0x3b')]){_0x2dc63a[_0x7786('0x3c')]=[{'all':!![]}];}return db[_0x7786('0x25')][_0x7786('0x3d')](_0x2dc63a);})[_0x7786('0x22')](function(_0x535885){_0xabb923[_0x7786('0x3e')]=_0x535885;return _0xabb923;})[_0x7786('0x22')](respondWithFilteredResult(_0x20a909,_0x2dc63a))[_0x7786('0x3f')](handleError(_0x20a909,null));};exports['show']=function(_0x16944a,_0x60d233){var _0x10d738={'raw':!![],'where':{'id':_0x16944a[_0x7786('0x40')]['id']}},_0x1bb521={};_0x1bb521[_0x7786('0x2a')]=_[_0x7786('0x2d')](db[_0x7786('0x25')][_0x7786('0x26')]);_0x1bb521[_0x7786('0x2c')]=_[_0x7786('0x2d')](_0x16944a[_0x7786('0x2c')]);_0x1bb521[_0x7786('0x2e')]=_[_0x7786('0x2f')](_0x1bb521['model'],_0x1bb521[_0x7786('0x2c')]);_0x10d738['attributes']=_['intersection'](_0x1bb521['model'],qs[_0x7786('0x31')](_0x16944a[_0x7786('0x2c')][_0x7786('0x31')]));_0x10d738[_0x7786('0x30')]=_0x10d738['attributes']['length']?_0x10d738[_0x7786('0x30')]:_0x1bb521[_0x7786('0x2a')];if(_0x16944a[_0x7786('0x2c')][_0x7786('0x3b')]){_0x10d738['include']=[{'all':!![]}];}_0x10d738=_[_0x7786('0x38')]({},_0x10d738,_0x16944a[_0x7786('0x3a')]);return db[_0x7786('0x25')]['find'](_0x10d738)[_0x7786('0x22')](handleEntityNotFound(_0x60d233,null))[_0x7786('0x22')](respondWithResult(_0x60d233,null))[_0x7786('0x3f')](handleError(_0x60d233,null));};exports[_0x7786('0x41')]=function(_0x43fa2d,_0x1ddf68){return db['VoiceQueuesLog']['create'](_0x43fa2d[_0x7786('0x42')],{})['then'](respondWithResult(_0x1ddf68,0xc9))['catch'](handleError(_0x1ddf68,null));};exports['update']=function(_0x5c021e,_0x2b08d1){if(_0x5c021e[_0x7786('0x42')]['id']){delete _0x5c021e[_0x7786('0x42')]['id'];}return db[_0x7786('0x25')][_0x7786('0x43')]({'where':{'id':_0x5c021e[_0x7786('0x40')]['id']}})['then'](handleEntityNotFound(_0x2b08d1,null))[_0x7786('0x22')](saveUpdates(_0x5c021e[_0x7786('0x42')],null))['then'](respondWithResult(_0x2b08d1,null))['catch'](handleError(_0x2b08d1,null));};exports[_0x7786('0x44')]=function(_0x29d007,_0x176e4c){return db['VoiceQueuesLog'][_0x7786('0x43')]({'where':{'id':_0x29d007['params']['id']}})[_0x7786('0x22')](handleEntityNotFound(_0x176e4c,null))['then'](removeEntity(_0x176e4c,null))['catch'](handleError(_0x176e4c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index f7daaa4..d31b7ea 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 _0x5ff8=['./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','dtm','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x5ff8,0x13e));var _0x85ff=function(_0xf520b7,_0x561c7d){_0xf520b7=_0xf520b7-0x0;var _0x2fda5c=_0x5ff8[_0xf520b7];return _0x2fda5c;};'use strict';var _=require(_0x85ff('0x0'));var util=require(_0x85ff('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x85ff('0x2'));var BPromise=require(_0x85ff('0x3'));var rp=require(_0x85ff('0x4'));var fs=require('fs');var path=require(_0x85ff('0x5'));var rimraf=require('rimraf');var config=require(_0x85ff('0x6'));var attributes=require(_0x85ff('0x7'));module['exports']=function(_0x49cb59,_0x3cc2d7){return _0x49cb59[_0x85ff('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x85ff('0x9'),'paranoid':![],'indexes':[{'name':_0x85ff('0xa'),'fields':[_0x85ff('0xb'),_0x85ff('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x97f4=['path','rimraf','../../config/environment','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4762a2,_0x5c7cf6){var _0x4a6965=function(_0x291550){while(--_0x291550){_0x4762a2['push'](_0x4762a2['shift']());}};_0x4a6965(++_0x5c7cf6);}(_0x97f4,0x166));var _0x497f=function(_0x542138,_0x53f8e2){_0x542138=_0x542138-0x0;var _0x45fd79=_0x97f4[_0x542138];return _0x45fd79;};'use strict';var _=require(_0x497f('0x0'));var util=require(_0x497f('0x1'));var logger=require(_0x497f('0x2'))(_0x497f('0x3'));var moment=require('moment');var BPromise=require(_0x497f('0x4'));var rp=require(_0x497f('0x5'));var fs=require('fs');var path=require(_0x497f('0x6'));var rimraf=require(_0x497f('0x7'));var config=require(_0x497f('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x3bf9b6,_0x37a074){return _0x3bf9b6[_0x497f('0x9')](_0x497f('0xa'),attributes,{'tableName':_0x497f('0xb'),'paranoid':![],'indexes':[{'name':_0x497f('0xc'),'fields':[_0x497f('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2c9b882..f556108 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 _0xc855=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x3c09c9,_0x486fb2){var _0x506356=function(_0x15f29b){while(--_0x15f29b){_0x3c09c9['push'](_0x3c09c9['shift']());}};_0x506356(++_0x486fb2);}(_0xc855,0xe8));var _0x5c85=function(_0xd50fba,_0x4f1d27){_0xd50fba=_0xd50fba-0x0;var _0x2da44a=_0xc855[_0xd50fba];return _0x2da44a;};'use strict';var _=require(_0x5c85('0x0'));var util=require('util');var moment=require(_0x5c85('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c85('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c85('0x3'));var jayson=require(_0x5c85('0x4'));var client=jayson[_0x5c85('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404dbb,_0x562e14,_0x50e441){return new BPromise(function(_0x101544,_0x2d6ec0){return client[_0x5c85('0x6')](_0x404dbb,_0x50e441)[_0x5c85('0x7')](function(_0x19e4f3){logger[_0x5c85('0x8')](_0x5c85('0x9'),_0x562e14,_0x5c85('0xa'));logger[_0x5c85('0xb')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x562e14,_0x5c85('0xa'),JSON['stringify'](_0x19e4f3));if(_0x19e4f3[_0x5c85('0xc')]){if(_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xd')]===0x1f4){logger[_0x5c85('0xc')](_0x5c85('0x9'),_0x562e14,_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xe')]);return _0x2d6ec0(_0x19e4f3['error']['message']);}logger[_0x5c85('0xc')](_0x5c85('0x9'),_0x562e14,_0x19e4f3[_0x5c85('0xc')][_0x5c85('0xe')]);return _0x101544(_0x19e4f3['error'][_0x5c85('0xe')]);}else{logger[_0x5c85('0x8')](_0x5c85('0x9'),_0x562e14,_0x5c85('0xa'));_0x101544(_0x19e4f3[_0x5c85('0xf')]['message']);}})[_0x5c85('0x10')](function(_0x5bec87){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x562e14,_0x5bec87);_0x2d6ec0(_0x5bec87);});});} \ No newline at end of file +var _0xc540=['info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x30cf14,_0x30ecbc){var _0x282b79=function(_0x1cb95a){while(--_0x1cb95a){_0x30cf14['push'](_0x30cf14['shift']());}};_0x282b79(++_0x30ecbc);}(_0xc540,0x184));var _0x0c54=function(_0x115b86,_0x4fd6a5){_0x115b86=_0x115b86-0x0;var _0x2850c3=_0xc540[_0x115b86];return _0x2850c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0c54('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c54('0x1'));var db=require(_0x0c54('0x2'))['db'];var utils=require(_0x0c54('0x3'));var logger=require(_0x0c54('0x4'))(_0x0c54('0x5'));var config=require('../../config/environment');var jayson=require(_0x0c54('0x6'));var client=jayson[_0x0c54('0x7')][_0x0c54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd1bfc5,_0x2eee8f,_0x90e1b0){return new BPromise(function(_0x4067ac,_0x32664a){return client[_0x0c54('0x9')](_0xd1bfc5,_0x90e1b0)[_0x0c54('0xa')](function(_0x10a76a){logger[_0x0c54('0xb')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x0c54('0xc'));logger['debug'](_0x0c54('0xd'),_0x2eee8f,_0x0c54('0xc'),JSON[_0x0c54('0xe')](_0x10a76a));if(_0x10a76a['error']){if(_0x10a76a['error'][_0x0c54('0xf')]===0x1f4){logger[_0x0c54('0x10')](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')][_0x0c54('0x12')]);return _0x32664a(_0x10a76a[_0x0c54('0x10')]['message']);}logger['error'](_0x0c54('0x11'),_0x2eee8f,_0x10a76a[_0x0c54('0x10')]['message']);return _0x4067ac(_0x10a76a['error'][_0x0c54('0x12')]);}else{logger[_0x0c54('0xb')](_0x0c54('0x11'),_0x2eee8f,_0x0c54('0xc'));_0x4067ac(_0x10a76a['result'][_0x0c54('0x12')]);}})['catch'](function(_0x10425a){logger[_0x0c54('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2eee8f,_0x10425a);_0x32664a(_0x10425a);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 50eca9c..632da63 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 _0xdbc3=['get','isAuthenticated','describe','/:id','/: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/auth/service','../../components/interaction/service','./voiceRecording.controller','index'];(function(_0x38f5f8,_0xefe164){var _0x34e820=function(_0x3a2407){while(--_0x3a2407){_0x38f5f8['push'](_0x38f5f8['shift']());}};_0x34e820(++_0xefe164);}(_0xdbc3,0x155));var _0x3dbc=function(_0x35eb94,_0x2e78a8){_0x35eb94=_0x35eb94-0x0;var _0x593add=_0xdbc3[_0x35eb94];return _0x593add;};'use strict';var multer=require(_0x3dbc('0x0'));var util=require(_0x3dbc('0x1'));var path=require(_0x3dbc('0x2'));var timeout=require(_0x3dbc('0x3'));var express=require('express');var router=express[_0x3dbc('0x4')]();var fs_extra=require(_0x3dbc('0x5'));var auth=require(_0x3dbc('0x6'));var interaction=require(_0x3dbc('0x7'));var config=require('../../config/environment');var controller=require(_0x3dbc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3dbc('0x9')]);router[_0x3dbc('0xa')]('/describe',auth[_0x3dbc('0xb')](),controller[_0x3dbc('0xc')]);router[_0x3dbc('0xa')](_0x3dbc('0xd'),auth[_0x3dbc('0xb')](),controller['show']);router[_0x3dbc('0xa')](_0x3dbc('0xe'),auth['isAuthenticated'](),controller[_0x3dbc('0xf')]);router['get'](_0x3dbc('0x10'),controller[_0x3dbc('0x11')]);router[_0x3dbc('0xa')](_0x3dbc('0x12'),auth['isAuthenticated'](),controller[_0x3dbc('0x13')]);router[_0x3dbc('0x14')]('/',auth['isAuthenticated'](),controller[_0x3dbc('0x15')]);router[_0x3dbc('0x14')](_0x3dbc('0x12'),auth[_0x3dbc('0xb')](),controller[_0x3dbc('0x16')]);router[_0x3dbc('0x17')]('/:id',auth[_0x3dbc('0xb')](),controller[_0x3dbc('0x18')]);router[_0x3dbc('0x19')](_0x3dbc('0xd'),auth[_0x3dbc('0xb')](),controller[_0x3dbc('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xdd0f=['downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe'];(function(_0x31acad,_0x7c4c14){var _0x36f354=function(_0x3485ba){while(--_0x3485ba){_0x31acad['push'](_0x31acad['shift']());}};_0x36f354(++_0x7c4c14);}(_0xdd0f,0x174));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xfdd0('0x0'));var path=require(_0xfdd0('0x1'));var timeout=require('connect-timeout');var express=require(_0xfdd0('0x2'));var router=express[_0xfdd0('0x3')]();var fs_extra=require(_0xfdd0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfdd0('0x5'));var controller=require(_0xfdd0('0x6'));router[_0xfdd0('0x7')]('/',auth[_0xfdd0('0x8')](),controller['index']);router[_0xfdd0('0x7')](_0xfdd0('0x9'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0xa')]);router['get'](_0xfdd0('0xb'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0xc')]);router['get'](_0xfdd0('0xd'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0xe')]);router[_0xfdd0('0x7')](_0xfdd0('0xf'),controller[_0xfdd0('0x10')]);router['get'](_0xfdd0('0x11'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0x12')]);router[_0xfdd0('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfdd0('0x13')](_0xfdd0('0x11'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0x14')]);router[_0xfdd0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfdd0('0x16')]);router[_0xfdd0('0x17')](_0xfdd0('0xb'),auth[_0xfdd0('0x8')](),controller[_0xfdd0('0x18')]);module[_0xfdd0('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 6638e3a..840bfed 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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 6ff3ff4..63d0c9d 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 _0xec2b=['send','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','push','$and','secrets','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','transcribeAccountId','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','name'];(function(_0x3fd773,_0x2d05e3){var _0x120b25=function(_0x92b7e9){while(--_0x92b7e9){_0x3fd773['push'](_0x3fd773['shift']());}};_0x120b25(++_0x2d05e3);}(_0xec2b,0x1a4));var _0xbec2=function(_0x28f936,_0x420f36){_0x28f936=_0x28f936-0x0;var _0xdbfeaa=_0xec2b[_0x28f936];return _0xdbfeaa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbec2('0x0'));var jsonpatch=require(_0xbec2('0x1'));var rp=require(_0xbec2('0x2'));var moment=require(_0xbec2('0x3'));var BPromise=require(_0xbec2('0x4'));var Mustache=require(_0xbec2('0x5'));var util=require(_0xbec2('0x6'));var path=require(_0xbec2('0x7'));var sox=require('sox');var csv=require(_0xbec2('0x8'));var ejs=require(_0xbec2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbec2('0xa'));var squel=require(_0xbec2('0xb'));var crypto=require(_0xbec2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbec2('0xd'));var toCsv=require(_0xbec2('0x8'));var querystring=require(_0xbec2('0xe'));var Papa=require(_0xbec2('0xf'));var AWS=require(_0xbec2('0x10'));var uuidv4=require(_0xbec2('0x11'));var Redis=require(_0xbec2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbec2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbec2('0x14'));var logger=require(_0xbec2('0x15'))(_0xbec2('0x16'));var utils=require(_0xbec2('0x17'));var config=require(_0xbec2('0x18'));var licenseUtil=require(_0xbec2('0x19'));var db=require(_0xbec2('0x1a'))['db'];function respondWithStatusCode(_0x31f2cc,_0x231d38){_0x231d38=_0x231d38||0xcc;return function(_0xb1d53c){if(_0xb1d53c){return _0x31f2cc[_0xbec2('0x1b')](_0x231d38);}return _0x31f2cc['status'](_0x231d38)[_0xbec2('0x1c')]();};}function respondWithResult(_0x3676ef,_0x468110){_0x468110=_0x468110||0xc8;return function(_0x3e9191){if(_0x3e9191){return _0x3676ef[_0xbec2('0x1d')](_0x468110)[_0xbec2('0x1e')](_0x3e9191);}};}function respondWithFilteredResult(_0x84b89f,_0x274c89){return function(_0x2f86a6){if(_0x2f86a6){var _0x415876=typeof _0x274c89['offset']===_0xbec2('0x1f')&&typeof _0x274c89['limit']===_0xbec2('0x1f');var _0x1ec9c5=_0x2f86a6[_0xbec2('0x20')];var _0x290ef6=_0x415876?0x0:_0x274c89[_0xbec2('0x21')];var _0x5463a6=_0x415876?_0x2f86a6[_0xbec2('0x20')]:_0x274c89[_0xbec2('0x21')]+_0x274c89[_0xbec2('0x22')];var _0x59612f;if(_0x5463a6>=_0x1ec9c5){_0x5463a6=_0x1ec9c5;_0x59612f=0xc8;}else{_0x59612f=0xce;}_0x84b89f[_0xbec2('0x1d')](_0x59612f);return _0x84b89f['set']('Content-Range',_0x290ef6+'-'+_0x5463a6+'/'+_0x1ec9c5)[_0xbec2('0x1e')](_0x2f86a6);}return null;};}function patchUpdates(_0x1e142f){return function(_0x128195){try{jsonpatch[_0xbec2('0x23')](_0x128195,_0x1e142f,!![]);}catch(_0x16224f){return BPromise[_0xbec2('0x24')](_0x16224f);}return _0x128195[_0xbec2('0x25')]();};}function saveUpdates(_0x54eb0d,_0x1624fe){return function(_0x4d89f1){if(_0x4d89f1){return _0x4d89f1[_0xbec2('0x26')](_0x54eb0d)[_0xbec2('0x27')](function(_0x32d762){return _0x32d762;});}return null;};}function removeEntity(_0x430701,_0x1e0e28){return function(_0x5cc620){if(_0x5cc620){return _0x5cc620[_0xbec2('0x28')]()[_0xbec2('0x27')](function(){_0x430701['status'](0xcc)[_0xbec2('0x1c')]();});}};}function handleEntityNotFound(_0x364c5c,_0x373464){return function(_0x4ce83e){if(!_0x4ce83e){_0x364c5c[_0xbec2('0x1b')](0x194);}return _0x4ce83e;};}function handleError(_0x186864,_0x50d8ea){_0x50d8ea=_0x50d8ea||0x1f4;return function(_0x4dc21d){logger['error'](_0x4dc21d['stack']);if(_0x4dc21d[_0xbec2('0x29')]){delete _0x4dc21d['name'];}_0x186864[_0xbec2('0x1d')](_0x50d8ea)[_0xbec2('0x2a')](_0x4dc21d);};}exports['index']=function(_0xe0d8f5,_0x5636c9){var _0x568667={},_0x2708fe={},_0x20cde2={'count':0x0,'rows':[]};var _0x189acf=_[_0xbec2('0x2b')](db[_0xbec2('0x2c')][_0xbec2('0x2d')],function(_0x308fd5){return{'name':_0x308fd5[_0xbec2('0x2e')],'type':_0x308fd5[_0xbec2('0x2f')][_0xbec2('0x30')]};});_0x2708fe['model']=_[_0xbec2('0x31')](_[_0xbec2('0x2b')](_0x189acf,_0xbec2('0x29')),[_0xbec2('0x32')]);_0x2708fe[_0xbec2('0x33')]=_[_0xbec2('0x34')](_0xe0d8f5[_0xbec2('0x33')]);_0x2708fe['filters']=_[_0xbec2('0x35')](_0x2708fe[_0xbec2('0x36')],_0x2708fe['query']);_0x568667[_0xbec2('0x37')]=_[_0xbec2('0x35')](_0x2708fe[_0xbec2('0x36')],qs[_0xbec2('0x38')](_0xe0d8f5[_0xbec2('0x33')][_0xbec2('0x38')]));_0x568667[_0xbec2('0x37')]=_0x568667[_0xbec2('0x37')][_0xbec2('0x39')]?_0x568667[_0xbec2('0x37')]:_0x2708fe[_0xbec2('0x36')];if(!_0xe0d8f5[_0xbec2('0x33')][_0xbec2('0x3a')](_0xbec2('0x3b'))){_0x568667[_0xbec2('0x22')]=qs['limit'](_0xe0d8f5[_0xbec2('0x33')]['limit']);_0x568667[_0xbec2('0x21')]=qs[_0xbec2('0x21')](_0xe0d8f5[_0xbec2('0x33')]['offset']);}_0x568667[_0xbec2('0x3c')]=qs['sort'](_0xe0d8f5[_0xbec2('0x33')][_0xbec2('0x3d')]);_0x568667['where']=qs[_0xbec2('0x3e')](_[_0xbec2('0x3f')](_0xe0d8f5['query'],_0x2708fe[_0xbec2('0x3e')]),_0x189acf);if(_0xe0d8f5[_0xbec2('0x33')][_0xbec2('0x40')]){_0x568667[_0xbec2('0x41')]=_[_0xbec2('0x42')](_0x568667[_0xbec2('0x41')],{'$or':_[_0xbec2('0x2b')](_0x189acf,function(_0x3c865d){if(_0x3c865d[_0xbec2('0x2f')]!==_0xbec2('0x43')){var _0x306e19={};_0x306e19[_0x3c865d[_0xbec2('0x29')]]={'$like':'%'+_0xe0d8f5['query'][_0xbec2('0x40')]+'%'};return _0x306e19;}})});}_0x568667=_[_0xbec2('0x42')]({},_0x568667,_0xe0d8f5['options']);var _0x542576={'where':_0x568667['where']};return db[_0xbec2('0x2c')]['count'](_0x542576)[_0xbec2('0x27')](function(_0x35cde3){_0x20cde2[_0xbec2('0x20')]=_0x35cde3;if(_0xe0d8f5[_0xbec2('0x33')][_0xbec2('0x44')]){_0x568667[_0xbec2('0x45')]=[{'all':!![]}];}return db[_0xbec2('0x2c')]['findAll'](_0x568667);})[_0xbec2('0x27')](function(_0x7b90de){_0x20cde2['rows']=_0x7b90de;return _0x20cde2;})[_0xbec2('0x27')](respondWithFilteredResult(_0x5636c9,_0x568667))[_0xbec2('0x46')](handleError(_0x5636c9,null));};exports[_0xbec2('0x47')]=function(_0x8882d6,_0x2ad4a2){var _0x23f8af={'raw':![],'where':{'id':_0x8882d6[_0xbec2('0x48')]['id']}},_0x1fada2={};_0x1fada2[_0xbec2('0x36')]=_['keys'](db[_0xbec2('0x2c')][_0xbec2('0x2d')]);_0x1fada2['query']=_[_0xbec2('0x34')](_0x8882d6[_0xbec2('0x33')]);_0x1fada2[_0xbec2('0x3e')]=_[_0xbec2('0x35')](_0x1fada2[_0xbec2('0x36')],_0x1fada2[_0xbec2('0x33')]);_0x23f8af[_0xbec2('0x37')]=_[_0xbec2('0x35')](_0x1fada2['model'],qs[_0xbec2('0x38')](_0x8882d6['query'][_0xbec2('0x38')]));_0x23f8af['attributes']=_0x23f8af[_0xbec2('0x37')][_0xbec2('0x39')]?_0x23f8af[_0xbec2('0x37')]:_0x1fada2[_0xbec2('0x36')];if(_0x8882d6[_0xbec2('0x33')][_0xbec2('0x44')]){_0x23f8af[_0xbec2('0x45')]=[{'all':!![]}];}_0x23f8af=_[_0xbec2('0x42')]({},_0x23f8af,_0x8882d6[_0xbec2('0x49')]);return db[_0xbec2('0x2c')][_0xbec2('0x4a')](_0x23f8af)[_0xbec2('0x27')](handleEntityNotFound(_0x2ad4a2,null))[_0xbec2('0x27')](respondWithResult(_0x2ad4a2,null))[_0xbec2('0x46')](handleError(_0x2ad4a2,null));};exports[_0xbec2('0x4b')]=function(_0x1be35d,_0x318a4e){return db['VoiceRecording'][_0xbec2('0x4b')](_0x1be35d[_0xbec2('0x4c')],{})[_0xbec2('0x27')](respondWithResult(_0x318a4e,0xc9))[_0xbec2('0x46')](handleError(_0x318a4e,null));};exports[_0xbec2('0x26')]=function(_0x25e3ef,_0x50cd12){if(_0x25e3ef[_0xbec2('0x4c')]['id']){delete _0x25e3ef['body']['id'];}return db[_0xbec2('0x2c')][_0xbec2('0x4a')]({'where':{'id':_0x25e3ef['params']['id']}})[_0xbec2('0x27')](handleEntityNotFound(_0x50cd12,null))[_0xbec2('0x27')](saveUpdates(_0x25e3ef['body'],null))[_0xbec2('0x27')](respondWithResult(_0x50cd12,null))[_0xbec2('0x46')](handleError(_0x50cd12,null));};exports[_0xbec2('0x4d')]=function(_0x58f0bc,_0x2e6776){return db['VoiceRecording'][_0xbec2('0x4d')]()['then'](respondWithResult(_0x2e6776,null))[_0xbec2('0x46')](handleError(_0x2e6776,null));};exports['download']=function(_0x33da26,_0x1dad9f,_0x25ebac){var _0x3b3626=require(_0xbec2('0x4e'));var _0x3067f0=![];var _0x311306={};if(_0x33da26[_0xbec2('0x33')]['type']&&_0x33da26[_0xbec2('0x33')][_0xbec2('0x2f')]===_0xbec2('0x4f')){_0x311306['uniqueid']=_0x33da26['params']['id'];}else{_0x311306['id']=_0x33da26[_0xbec2('0x48')]['id'];}return db[_0xbec2('0x2c')]['find']({'where':_0x311306,'attributes':['id',_0xbec2('0x50')],'raw':!![]})[_0xbec2('0x27')](handleEntityNotFound(_0x1dad9f,null))[_0xbec2('0x27')](function(_0x338e6d){if(_0x338e6d){var _0x440a0c=_0x338e6d[_0xbec2('0x50')];var _0x3271d4=util[_0xbec2('0x32')](_0xbec2('0x51'),_0x440a0c);if(fs[_0xbec2('0x52')](_0x3271d4)){_0x3067f0=!![];return _0x3b3626[_0xbec2('0x53')](_0x3271d4,_0x440a0c,config['secrets'][_0xbec2('0x54')])['then'](function(){return _0x338e6d;});}return _0x338e6d;}})[_0xbec2('0x27')](function(_0x524594){if(_0x524594){var _0x41f431=_0x524594[_0xbec2('0x50')];if(!fs[_0xbec2('0x52')](_0x41f431)){throw new db[(_0xbec2('0x55'))][(_0xbec2('0x56'))](_0xbec2('0x57'));}if(_0x524594[_0xbec2('0x58')]){return _0x1dad9f[_0xbec2('0x59')](_0x41f431,_0x524594[_0xbec2('0x58')]+path[_0xbec2('0x5a')](_0x41f431),function(){if(_0x3067f0){fs[_0xbec2('0x5b')](_0x41f431);}});}else{return _0x1dad9f['download'](_0x41f431,function(_0x25df79){if(_0x3067f0){fs['unlink'](_0x41f431);}});}}})[_0xbec2('0x46')](function(_0x1d2e00){if(_0x1d2e00[_0xbec2('0x5c')]==='VoiceRecording\x20not\x20found'){_0x1dad9f[_0xbec2('0x1d')](0x194)[_0xbec2('0x2a')](_0xbec2('0x5d'));}else{return handleError(_0x1dad9f,null);}});};exports[_0xbec2('0x5e')]=function(_0x3a8b1b,_0xfca379,_0x1e12ea){var _0x73bb7d=require('../../components/encryptor');var _0x4d42e4=![];var _0xc0fb07={'$and':[db[_0xbec2('0x5f')][_0xbec2('0x41')](db['sequelize']['fn'](_0xbec2('0x60'),db[_0xbec2('0x5f')][_0xbec2('0x61')](_0xbec2('0x4f'))),_0x3a8b1b[_0xbec2('0x33')]['token'])]};if(_0x3a8b1b[_0xbec2('0x33')][_0xbec2('0x2f')]&&_0x3a8b1b[_0xbec2('0x33')][_0xbec2('0x2f')]==='uniqueid'){_0xc0fb07['$and'][_0xbec2('0x62')]({'uniqueid':_0x3a8b1b['params']['id']});}else{_0xc0fb07[_0xbec2('0x63')][_0xbec2('0x62')]({'id':_0x3a8b1b['params']['id']});}return db[_0xbec2('0x2c')][_0xbec2('0x4a')]({'where':_0xc0fb07,'attributes':['id',_0xbec2('0x50')],'raw':!![]})[_0xbec2('0x27')](handleEntityNotFound(_0xfca379,null))[_0xbec2('0x27')](function(_0xcc53e3){if(_0xcc53e3){var _0x5cd832=util[_0xbec2('0x32')](_0xbec2('0x51'),_0xcc53e3[_0xbec2('0x50')]);if(fs[_0xbec2('0x52')](_0x5cd832)){_0x4d42e4=!![];return _0x73bb7d[_0xbec2('0x53')](_0x5cd832,_0xcc53e3[_0xbec2('0x50')],config[_0xbec2('0x64')][_0xbec2('0x54')])[_0xbec2('0x27')](function(){return _0xcc53e3;});}return _0xcc53e3;}})[_0xbec2('0x27')](function(_0xcd0426){if(_0xcd0426){if(!fs[_0xbec2('0x52')](_0xcd0426[_0xbec2('0x50')])){throw new db['Sequelize']['ValidationError'](_0xbec2('0x57'));}if(_0xcd0426['filename']){return _0xfca379[_0xbec2('0x59')](_0xcd0426[_0xbec2('0x50')],_0xcd0426[_0xbec2('0x58')]+path[_0xbec2('0x5a')](_0xcd0426[_0xbec2('0x50')]),function(){if(_0x4d42e4){fs['unlink'](_0xcd0426[_0xbec2('0x50')]);}});}else{return _0xfca379[_0xbec2('0x59')](_0xcd0426['value'],function(_0x20676e){if(_0x4d42e4){fs['unlink'](_0xcd0426[_0xbec2('0x50')]);}});}}})[_0xbec2('0x46')](handleError(_0xfca379,null));};exports['destroy']=function(_0x1d63e2,_0x403cf8){return db[_0xbec2('0x2c')][_0xbec2('0x4a')]({'where':{'id':_0x1d63e2[_0xbec2('0x48')]['id']}})[_0xbec2('0x27')](function(_0x2e0ea0){if(_['isNil'](_0x2e0ea0)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2e0ea0;})[_0xbec2('0x27')](function(_0x4c4e79){var _0x374a1d=_0x4c4e79[_0xbec2('0x50')];logger[_0xbec2('0x65')](_0xbec2('0x66'),_0x374a1d);if(!_[_0xbec2('0x67')](_0x4c4e79[_0xbec2('0x50')])&&fs[_0xbec2('0x52')](_0x374a1d)){logger[_0xbec2('0x65')](_0xbec2('0x68')+_0x374a1d+_0xbec2('0x69'));fs[_0xbec2('0x6a')](_0x374a1d);}_0x374a1d=_0x374a1d+_0xbec2('0x6b');if(!_[_0xbec2('0x67')](_0x4c4e79['value'])&&fs[_0xbec2('0x52')](_0x374a1d)){logger[_0xbec2('0x65')]('File:\x20\x22'+_0x374a1d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x374a1d);}return _0x4c4e79;})[_0xbec2('0x27')](function(_0x5e3e39){if(!_0x5e3e39)throw new InternalError();return _0x5e3e39[_0xbec2('0x28')]();})[_0xbec2('0x27')](function(){_0x403cf8[_0xbec2('0x1d')](0xcc)['end']();})[_0xbec2('0x46')](handleError(_0x403cf8,null));};function getBucketslist(_0x2a82d1,_0x2b8842,_0x2ed349){return new Promise(function(_0x306944,_0x4f52fc){var _0x489120=new AWS['S3']({'accessKeyId':_0x2b8842,'secretAccessKey':_0x2a82d1,'region':_0x2ed349});_0x489120[_0xbec2('0x6c')]({},function(_0x3ea396,_0x4688a4){if(_0x3ea396){return _0x4f52fc(_0x3ea396);}else{return _0x306944(_0x4688a4);}});});}function createBucket(_0x1fc28d,_0xf77c33,_0x33b3a0,_0x3e3083){return new Promise(function(_0x363c86,_0x3e4e92){var _0xa33461=new AWS['S3']({'accessKeyId':_0xf77c33,'secretAccessKey':_0x1fc28d,'region':_0x33b3a0});_0xa33461[_0xbec2('0x6d')]({'Bucket':_0x3e3083},function(_0x41319d,_0x5619ee){if(_0x41319d){return _0x3e4e92(_0x41319d);}else{return _0x363c86(_0x5619ee);}});});}function uploadFile(_0x18564c,_0x2a1bdb,_0x12eb8c,_0x12b422,_0x5427e0,_0x1b8bf2){return new Promise(function(_0x26263e,_0x24737e){var _0x5c0a15=new AWS['S3']({'accessKeyId':_0x2a1bdb,'secretAccessKey':_0x18564c,'region':_0x12eb8c});_0x5c0a15[_0xbec2('0x6e')]({'Bucket':_0x12b422,'Key':_0x5427e0,'Body':_0x1b8bf2},function(_0x29a1d3,_0x4a5ab2){if(_0x29a1d3){return _0x24737e(_0x29a1d3);}else{return _0x26263e(_0x4a5ab2);}});});}function startTranscribe(_0x5096bb,_0x3d77c8,_0x3027d4,_0x28889e,_0x1e3078,_0x4d3aca){return new Promise(function(_0x3183cf,_0xe369df){var _0x3d30b1=new AWS[(_0xbec2('0x6f'))]({'accessKeyId':_0x3d77c8,'secretAccessKey':_0x5096bb,'region':_0x3027d4});_0x3d30b1['startTranscriptionJob']({'TranscriptionJobName':_0x28889e,'LanguageCode':_0x1e3078,'Media':{'MediaFileUri':_0x4d3aca}},function(_0x27149d,_0x1b4147){if(_0x27149d){return _0xe369df(_0x27149d);}else{return _0x3183cf(_0x1b4147);}});});}function transcribe(_0x39f40c,_0x561e44,_0x134820,_0x2af306,_0x1935ea,_0x203812,_0x5c00c5){return new Promise(function(_0x3cca97,_0xeba81c){var _0x2f0416={};logger[_0xbec2('0x65')](util[_0xbec2('0x32')](_0xbec2('0x70'),_0x39f40c,_0x1935ea));return uploadFile(_0x561e44,_0x134820,_0x2af306,_0x1935ea,path[_0xbec2('0x71')](_0x203812),fs['readFileSync'](_0x203812))[_0xbec2('0x27')](function(_0x1ba4e6){logger[_0xbec2('0x65')](util[_0xbec2('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x39f40c,_0x1935ea,_0x1ba4e6[_0xbec2('0x72')]));_0x2f0416['bucket']=_0x1ba4e6[_0xbec2('0x73')];_0x2f0416[_0xbec2('0x74')]=_0x1ba4e6[_0xbec2('0x72')];logger['info'](util[_0xbec2('0x32')](_0xbec2('0x75'),_0x39f40c));return startTranscribe(_0x561e44,_0x134820,_0x2af306,uuidv4(),_0x5c00c5,_0x1ba4e6[_0xbec2('0x72')]);})[_0xbec2('0x27')](function(_0x377523){logger[_0xbec2('0x65')](util[_0xbec2('0x32')](_0xbec2('0x76'),_0x39f40c,_0x377523[_0xbec2('0x77')][_0xbec2('0x78')]));_0x2f0416[_0xbec2('0x79')]=_0x377523[_0xbec2('0x77')][_0xbec2('0x78')];_0x2f0416['transcribeStatus']=_0x377523[_0xbec2('0x77')][_0xbec2('0x7a')];return _0x3cca97(_0x2f0416);})['catch'](function(_0xb241b1){return _0xeba81c(_0xb241b1);});});}exports['runTranscribe']=function(_0xafd8b0,_0x96a228,_0x298253){var _0x130bc4;var _0x13aff3;var _0x1667f1;var _0x2885c0=require('../../components/encryptor');return db[_0xbec2('0x2c')][_0xbec2('0x7b')]({'where':{'id':_0xafd8b0['params']['id']}})['then'](function(_0x5c94ac){if(_0x5c94ac){var _0xa91e7f=util[_0xbec2('0x32')](_0xbec2('0x51'),_0x5c94ac[_0xbec2('0x50')]);if(fs[_0xbec2('0x52')](_0xa91e7f)){cypher=!![];return _0x2885c0['decryptFile'](_0xa91e7f,_0x5c94ac['value'],config['secrets'][_0xbec2('0x54')])[_0xbec2('0x27')](function(){return _0x5c94ac;});}return _0x5c94ac;}})['then'](function(_0x141906){if(!_0x141906){throw new db[(_0xbec2('0x55'))][(_0xbec2('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x13aff3=_0x141906;return db['Setting'][_0xbec2('0x7b')]({'where':{'id':0x1}});})[_0xbec2('0x27')](handleEntityNotFound(_0x96a228,null))['then'](function(_0x5a2f59){if(_0x5a2f59){_0x130bc4=_0x5a2f59;if(!_0x130bc4['transcribe']||!_0x130bc4[_0xbec2('0x7c')]||!_0x130bc4['transcribeRegion']||!_0x130bc4[_0xbec2('0x7d')]||!_0x130bc4[_0xbec2('0x7e')]){throw new db[(_0xbec2('0x55'))][(_0xbec2('0x56'))](_0xbec2('0x7f'));}if(_0xafd8b0[_0xbec2('0x4c')][_0xbec2('0x80')]&&(!_0x130bc4[_0xbec2('0x81')]||!_0x130bc4[_0xbec2('0x82')]||!_0x130bc4[_0xbec2('0x83')]||!_0x130bc4['language']||!_0x130bc4[_0xbec2('0x7e')])){throw new db[(_0xbec2('0x55'))][(_0xbec2('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xbec2('0x84')]['findOne']({'where':{'id':_0x130bc4[_0xbec2('0x7c')]}});}})[_0xbec2('0x27')](function(_0x422ee9){if(!_0x422ee9){throw new db[(_0xbec2('0x55'))]['ValidationError'](_0xbec2('0x85'));}if(!_0x422ee9[_0xbec2('0x86')]||!_0x422ee9['data2']){throw new db['Sequelize']['ValidationError'](_0xbec2('0x87'));}_0x1667f1=_0x422ee9;return getBucketslist(_0x1667f1[_0xbec2('0x86')],_0x1667f1[_0xbec2('0x88')],_0x130bc4[_0xbec2('0x89')]);})[_0xbec2('0x27')](function(_0x2ed0c9){if(_0x2ed0c9&&_0x2ed0c9[_0xbec2('0x8a')]){var _0x293c07=_[_0xbec2('0x4a')](_0x2ed0c9[_0xbec2('0x8a')],function(_0x438e28){return _0x438e28['Name']===_0x130bc4['bucket'];});if(!_0x293c07){logger['info'](util['format'](_0xbec2('0x8b'),_0xafd8b0[_0xbec2('0x48')]['id'],_0x130bc4[_0xbec2('0x7e')]));return createBucket(_0x1667f1[_0xbec2('0x86')],_0x1667f1[_0xbec2('0x88')],_0x130bc4[_0xbec2('0x89')],_0x130bc4[_0xbec2('0x7e')]);}logger[_0xbec2('0x65')](util[_0xbec2('0x32')](_0xbec2('0x8c'),_0xafd8b0[_0xbec2('0x48')]['id'],_0x130bc4['bucket']));return;}})[_0xbec2('0x27')](function(_0x2ddaae){if(_0x13aff3[_0xbec2('0x8d')]===_0xbec2('0x8e')){return transcribe(_0xafd8b0['params']['id'],_0x1667f1[_0xbec2('0x86')],_0x1667f1[_0xbec2('0x88')],_0x130bc4['transcribeRegion'],_0x130bc4[_0xbec2('0x7e')],_0x13aff3[_0xbec2('0x50')],_0x130bc4['language']);}else{logger[_0xbec2('0x65')](util['format'](_0xbec2('0x8f'),_0xafd8b0[_0xbec2('0x48')]['id']));return{'transcribeStatus':_0xbec2('0x90')};}})['then'](function(_0x48f93a){if(_0x48f93a){_0x48f93a[_0xbec2('0x91')]=_0xafd8b0[_0xbec2('0x4c')][_0xbec2('0x80')];return _0x13aff3[_0xbec2('0x92')](_0x48f93a);}})['then'](respondWithResult(_0x96a228,null))[_0xbec2('0x46')](handleError(_0x96a228,null));};function writeFile(_0x2e85a1,_0x4e8d6c){return new Promise(function(_0x2b44a3,_0x9a0fea){fs[_0xbec2('0x93')](_0x4e8d6c,_0x2e85a1,function(_0x3cb7ab,_0x10c675){if(_0x3cb7ab){return _0x9a0fea(_0x3cb7ab);}else{return _0x2b44a3(_0x10c675);}});});}exports[_0xbec2('0x94')]=function(_0x139fb8,_0x256626,_0xfa00bd){return db['VoiceRecording']['findOne']({'where':{'id':_0x139fb8[_0xbec2('0x48')]['id']}})[_0xbec2('0x27')](handleEntityNotFound(_0x256626))[_0xbec2('0x27')](function(_0x5a638e){if(_0x5a638e&&_0x5a638e[_0xbec2('0x95')]){var _0x1519a5=_0x5a638e['fileText'];var _0x270800=config[_0xbec2('0x96')]+_0xbec2('0x97')+_0x5a638e['id']+_0xbec2('0x98');if(fs[_0xbec2('0x52')](_0x270800)){return _0x270800;}return writeFile(_0x1519a5,_0x270800)[_0xbec2('0x27')](function(){return _0x270800;});}else{throw new db['Sequelize'][(_0xbec2('0x56'))](_0xbec2('0x99'));}})[_0xbec2('0x27')](function(_0x5f57c3){return _0x256626[_0xbec2('0x59')](_0x5f57c3);})[_0xbec2('0x46')](handleError(_0x256626));}; \ No newline at end of file +var _0xc6b0=['filename','extname','unlink','message','Not\x20found','downloads','sequelize','col','token','$and','%s.cypher','decryptFile','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','transcribe','transcribeAccountId','language','runSentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found'];(function(_0x49c5bc,_0x59af36){var _0x30c1ed=function(_0x66b31){while(--_0x66b31){_0x49c5bc['push'](_0x49c5bc['shift']());}};_0x30c1ed(++_0x59af36);}(_0xc6b0,0x15e));var _0x0c6b=function(_0x1f9252,_0x41048c){_0x1f9252=_0x1f9252-0x0;var _0xbe2ef0=_0xc6b0[_0x1f9252];return _0xbe2ef0;};'use strict';var emlformat=require(_0x0c6b('0x0'));var rimraf=require(_0x0c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c6b('0x2'));var rp=require(_0x0c6b('0x3'));var moment=require(_0x0c6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c6b('0x5'));var util=require(_0x0c6b('0x6'));var path=require(_0x0c6b('0x7'));var sox=require(_0x0c6b('0x8'));var csv=require(_0x0c6b('0x9'));var ejs=require(_0x0c6b('0xa'));var fs=require('fs');var fs_extra=require(_0x0c6b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c6b('0xc'));var jsforce=require(_0x0c6b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c6b('0x9'));var querystring=require(_0x0c6b('0xe'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x0c6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0c6b('0x10'));var hardwareService=require(_0x0c6b('0x11'));var logger=require(_0x0c6b('0x12'))(_0x0c6b('0x13'));var utils=require(_0x0c6b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0c6b('0x15'));var db=require(_0x0c6b('0x16'))['db'];function respondWithStatusCode(_0x2e1178,_0xd31275){_0xd31275=_0xd31275||0xcc;return function(_0xd9b702){if(_0xd9b702){return _0x2e1178[_0x0c6b('0x17')](_0xd31275);}return _0x2e1178['status'](_0xd31275)[_0x0c6b('0x18')]();};}function respondWithResult(_0x4760f8,_0x1af0bf){_0x1af0bf=_0x1af0bf||0xc8;return function(_0x18e997){if(_0x18e997){return _0x4760f8[_0x0c6b('0x19')](_0x1af0bf)[_0x0c6b('0x1a')](_0x18e997);}};}function respondWithFilteredResult(_0x276b2b,_0x554ce4){return function(_0x4c0369){if(_0x4c0369){var _0x51b540=typeof _0x554ce4['offset']==='undefined'&&typeof _0x554ce4[_0x0c6b('0x1b')]==='undefined';var _0x26c9d7=_0x4c0369['count'];var _0x55de54=_0x51b540?0x0:_0x554ce4[_0x0c6b('0x1c')];var _0x3af282=_0x51b540?_0x4c0369['count']:_0x554ce4['offset']+_0x554ce4[_0x0c6b('0x1b')];var _0x2d25d7;if(_0x3af282>=_0x26c9d7){_0x3af282=_0x26c9d7;_0x2d25d7=0xc8;}else{_0x2d25d7=0xce;}_0x276b2b[_0x0c6b('0x19')](_0x2d25d7);return _0x276b2b[_0x0c6b('0x1d')](_0x0c6b('0x1e'),_0x55de54+'-'+_0x3af282+'/'+_0x26c9d7)[_0x0c6b('0x1a')](_0x4c0369);}return null;};}function patchUpdates(_0x4b6f9a){return function(_0x513a74){try{jsonpatch['apply'](_0x513a74,_0x4b6f9a,!![]);}catch(_0x10467f){return BPromise[_0x0c6b('0x1f')](_0x10467f);}return _0x513a74[_0x0c6b('0x20')]();};}function saveUpdates(_0x133961,_0x7778eb){return function(_0x2c35d6){if(_0x2c35d6){return _0x2c35d6[_0x0c6b('0x21')](_0x133961)[_0x0c6b('0x22')](function(_0x4e4781){return _0x4e4781;});}return null;};}function removeEntity(_0xfdb877,_0x36d501){return function(_0x16ceb3){if(_0x16ceb3){return _0x16ceb3['destroy']()[_0x0c6b('0x22')](function(){_0xfdb877['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfdc6,_0x2a18aa){return function(_0x1feeb7){if(!_0x1feeb7){_0x4dfdc6[_0x0c6b('0x17')](0x194);}return _0x1feeb7;};}function handleError(_0x5a31df,_0x30d5e0){_0x30d5e0=_0x30d5e0||0x1f4;return function(_0x57b0b5){logger[_0x0c6b('0x23')](_0x57b0b5[_0x0c6b('0x24')]);if(_0x57b0b5[_0x0c6b('0x25')]){delete _0x57b0b5[_0x0c6b('0x25')];}_0x5a31df[_0x0c6b('0x19')](_0x30d5e0)[_0x0c6b('0x26')](_0x57b0b5);};}exports['index']=function(_0x9877d5,_0x314f72){var _0x3073b0={},_0x252338={},_0x33802d={'count':0x0,'rows':[]};var _0x505926=_[_0x0c6b('0x27')](db[_0x0c6b('0x28')][_0x0c6b('0x29')],function(_0x31d7e2){return{'name':_0x31d7e2['fieldName'],'type':_0x31d7e2[_0x0c6b('0x2a')][_0x0c6b('0x2b')]};});_0x252338[_0x0c6b('0x2c')]=_[_0x0c6b('0x2d')](_['map'](_0x505926,_0x0c6b('0x25')),[_0x0c6b('0x2e')]);_0x252338[_0x0c6b('0x2f')]=_[_0x0c6b('0x30')](_0x9877d5[_0x0c6b('0x2f')]);_0x252338[_0x0c6b('0x31')]=_['intersection'](_0x252338[_0x0c6b('0x2c')],_0x252338[_0x0c6b('0x2f')]);_0x3073b0[_0x0c6b('0x32')]=_[_0x0c6b('0x33')](_0x252338['model'],qs[_0x0c6b('0x34')](_0x9877d5[_0x0c6b('0x2f')][_0x0c6b('0x34')]));_0x3073b0[_0x0c6b('0x32')]=_0x3073b0['attributes'][_0x0c6b('0x35')]?_0x3073b0[_0x0c6b('0x32')]:_0x252338[_0x0c6b('0x2c')];if(!_0x9877d5['query']['hasOwnProperty'](_0x0c6b('0x36'))){_0x3073b0[_0x0c6b('0x1b')]=qs[_0x0c6b('0x1b')](_0x9877d5[_0x0c6b('0x2f')][_0x0c6b('0x1b')]);_0x3073b0['offset']=qs['offset'](_0x9877d5['query'][_0x0c6b('0x1c')]);}_0x3073b0[_0x0c6b('0x37')]=qs[_0x0c6b('0x38')](_0x9877d5[_0x0c6b('0x2f')][_0x0c6b('0x38')]);_0x3073b0[_0x0c6b('0x39')]=qs[_0x0c6b('0x31')](_[_0x0c6b('0x3a')](_0x9877d5[_0x0c6b('0x2f')],_0x252338[_0x0c6b('0x31')]),_0x505926);if(_0x9877d5[_0x0c6b('0x2f')]['filter']){_0x3073b0[_0x0c6b('0x39')]=_[_0x0c6b('0x3b')](_0x3073b0[_0x0c6b('0x39')],{'$or':_[_0x0c6b('0x27')](_0x505926,function(_0x53f595){if(_0x53f595['type']!==_0x0c6b('0x3c')){var _0x42633f={};_0x42633f[_0x53f595[_0x0c6b('0x25')]]={'$like':'%'+_0x9877d5['query']['filter']+'%'};return _0x42633f;}})});}_0x3073b0=_[_0x0c6b('0x3b')]({},_0x3073b0,_0x9877d5[_0x0c6b('0x3d')]);var _0x2e8dd3={'where':_0x3073b0[_0x0c6b('0x39')]};return db[_0x0c6b('0x28')][_0x0c6b('0x3e')](_0x2e8dd3)[_0x0c6b('0x22')](function(_0x579bbd){_0x33802d[_0x0c6b('0x3e')]=_0x579bbd;if(_0x9877d5[_0x0c6b('0x2f')][_0x0c6b('0x3f')]){_0x3073b0[_0x0c6b('0x40')]=[{'all':!![]}];}return db[_0x0c6b('0x28')]['findAll'](_0x3073b0);})[_0x0c6b('0x22')](function(_0x3dd6be){_0x33802d[_0x0c6b('0x41')]=_0x3dd6be;return _0x33802d;})[_0x0c6b('0x22')](respondWithFilteredResult(_0x314f72,_0x3073b0))[_0x0c6b('0x42')](handleError(_0x314f72,null));};exports['show']=function(_0x5246a5,_0x5abd79){var _0x165ce1={'raw':![],'where':{'id':_0x5246a5[_0x0c6b('0x43')]['id']}},_0x28b620={};_0x28b620[_0x0c6b('0x2c')]=_[_0x0c6b('0x30')](db[_0x0c6b('0x28')]['rawAttributes']);_0x28b620[_0x0c6b('0x2f')]=_[_0x0c6b('0x30')](_0x5246a5['query']);_0x28b620['filters']=_[_0x0c6b('0x33')](_0x28b620[_0x0c6b('0x2c')],_0x28b620['query']);_0x165ce1[_0x0c6b('0x32')]=_[_0x0c6b('0x33')](_0x28b620[_0x0c6b('0x2c')],qs[_0x0c6b('0x34')](_0x5246a5[_0x0c6b('0x2f')][_0x0c6b('0x34')]));_0x165ce1['attributes']=_0x165ce1['attributes'][_0x0c6b('0x35')]?_0x165ce1[_0x0c6b('0x32')]:_0x28b620[_0x0c6b('0x2c')];if(_0x5246a5['query'][_0x0c6b('0x3f')]){_0x165ce1[_0x0c6b('0x40')]=[{'all':!![]}];}_0x165ce1=_['merge']({},_0x165ce1,_0x5246a5[_0x0c6b('0x3d')]);return db[_0x0c6b('0x28')][_0x0c6b('0x44')](_0x165ce1)[_0x0c6b('0x22')](handleEntityNotFound(_0x5abd79,null))['then'](respondWithResult(_0x5abd79,null))[_0x0c6b('0x42')](handleError(_0x5abd79,null));};exports[_0x0c6b('0x45')]=function(_0x15cb12,_0x14ffa2){return db[_0x0c6b('0x28')][_0x0c6b('0x45')](_0x15cb12['body'],{})[_0x0c6b('0x22')](respondWithResult(_0x14ffa2,0xc9))[_0x0c6b('0x42')](handleError(_0x14ffa2,null));};exports['update']=function(_0x30b393,_0x1bbf33){if(_0x30b393[_0x0c6b('0x46')]['id']){delete _0x30b393[_0x0c6b('0x46')]['id'];}return db[_0x0c6b('0x28')][_0x0c6b('0x44')]({'where':{'id':_0x30b393['params']['id']}})[_0x0c6b('0x22')](handleEntityNotFound(_0x1bbf33,null))['then'](saveUpdates(_0x30b393[_0x0c6b('0x46')],null))[_0x0c6b('0x22')](respondWithResult(_0x1bbf33,null))[_0x0c6b('0x42')](handleError(_0x1bbf33,null));};exports[_0x0c6b('0x47')]=function(_0x4bd111,_0x452cd4){return db['VoiceRecording'][_0x0c6b('0x47')]()['then'](respondWithResult(_0x452cd4,null))[_0x0c6b('0x42')](handleError(_0x452cd4,null));};exports[_0x0c6b('0x48')]=function(_0x54002f,_0x1b3fee,_0x3b9612){var _0x12bf07=require(_0x0c6b('0x49'));var _0x51d2be=![];var _0x28cfe3={};if(_0x54002f['query'][_0x0c6b('0x2a')]&&_0x54002f[_0x0c6b('0x2f')][_0x0c6b('0x2a')]===_0x0c6b('0x4a')){_0x28cfe3['uniqueid']=_0x54002f[_0x0c6b('0x43')]['id'];}else{_0x28cfe3['id']=_0x54002f[_0x0c6b('0x43')]['id'];}return db['VoiceRecording']['find']({'where':_0x28cfe3,'attributes':['id',_0x0c6b('0x4b')],'raw':!![]})[_0x0c6b('0x22')](handleEntityNotFound(_0x1b3fee,null))[_0x0c6b('0x22')](function(_0x446df3){if(_0x446df3){var _0x18f61c=_0x446df3['value'];var _0x460857=util[_0x0c6b('0x2e')]('%s.cypher',_0x18f61c);if(fs[_0x0c6b('0x4c')](_0x460857)){_0x51d2be=!![];return _0x12bf07['decryptFile'](_0x460857,_0x18f61c,config[_0x0c6b('0x4d')][_0x0c6b('0x4e')])[_0x0c6b('0x22')](function(){return _0x446df3;});}return _0x446df3;}})[_0x0c6b('0x22')](function(_0x1ebd44){if(_0x1ebd44){var _0x899d8c=_0x1ebd44[_0x0c6b('0x4b')];if(!fs[_0x0c6b('0x4c')](_0x899d8c)){throw new db[(_0x0c6b('0x4f'))][(_0x0c6b('0x50'))](_0x0c6b('0x51'));}if(_0x1ebd44[_0x0c6b('0x52')]){return _0x1b3fee[_0x0c6b('0x48')](_0x899d8c,_0x1ebd44[_0x0c6b('0x52')]+path[_0x0c6b('0x53')](_0x899d8c),function(){if(_0x51d2be){fs[_0x0c6b('0x54')](_0x899d8c);}});}else{return _0x1b3fee['download'](_0x899d8c,function(_0x58d698){if(_0x51d2be){fs[_0x0c6b('0x54')](_0x899d8c);}});}}})[_0x0c6b('0x42')](function(_0x5284e4){if(_0x5284e4[_0x0c6b('0x55')]==='VoiceRecording\x20not\x20found'){_0x1b3fee['status'](0x194)[_0x0c6b('0x26')](_0x0c6b('0x56'));}else{return handleError(_0x1b3fee,null);}});};exports[_0x0c6b('0x57')]=function(_0x1d3f63,_0x149afd,_0x451126){var _0x24e887=require(_0x0c6b('0x49'));var _0x2bf552=![];var _0x3cef0a={'$and':[db[_0x0c6b('0x58')]['where'](db[_0x0c6b('0x58')]['fn']('MD5',db[_0x0c6b('0x58')][_0x0c6b('0x59')]('uniqueid')),_0x1d3f63[_0x0c6b('0x2f')][_0x0c6b('0x5a')])]};if(_0x1d3f63[_0x0c6b('0x2f')]['type']&&_0x1d3f63[_0x0c6b('0x2f')]['type']===_0x0c6b('0x4a')){_0x3cef0a[_0x0c6b('0x5b')]['push']({'uniqueid':_0x1d3f63[_0x0c6b('0x43')]['id']});}else{_0x3cef0a[_0x0c6b('0x5b')]['push']({'id':_0x1d3f63[_0x0c6b('0x43')]['id']});}return db['VoiceRecording'][_0x0c6b('0x44')]({'where':_0x3cef0a,'attributes':['id','value'],'raw':!![]})[_0x0c6b('0x22')](handleEntityNotFound(_0x149afd,null))[_0x0c6b('0x22')](function(_0x1cc2b6){if(_0x1cc2b6){var _0x257680=util[_0x0c6b('0x2e')](_0x0c6b('0x5c'),_0x1cc2b6[_0x0c6b('0x4b')]);if(fs[_0x0c6b('0x4c')](_0x257680)){_0x2bf552=!![];return _0x24e887[_0x0c6b('0x5d')](_0x257680,_0x1cc2b6['value'],config[_0x0c6b('0x4d')][_0x0c6b('0x4e')])[_0x0c6b('0x22')](function(){return _0x1cc2b6;});}return _0x1cc2b6;}})[_0x0c6b('0x22')](function(_0x3f0c75){if(_0x3f0c75){if(!fs['existsSync'](_0x3f0c75[_0x0c6b('0x4b')])){throw new db[(_0x0c6b('0x4f'))][(_0x0c6b('0x50'))](_0x0c6b('0x51'));}if(_0x3f0c75[_0x0c6b('0x52')]){return _0x149afd['download'](_0x3f0c75[_0x0c6b('0x4b')],_0x3f0c75['filename']+path[_0x0c6b('0x53')](_0x3f0c75[_0x0c6b('0x4b')]),function(){if(_0x2bf552){fs[_0x0c6b('0x54')](_0x3f0c75['value']);}});}else{return _0x149afd[_0x0c6b('0x48')](_0x3f0c75[_0x0c6b('0x4b')],function(_0x4885b0){if(_0x2bf552){fs[_0x0c6b('0x54')](_0x3f0c75[_0x0c6b('0x4b')]);}});}}})[_0x0c6b('0x42')](handleError(_0x149afd,null));};exports[_0x0c6b('0x5e')]=function(_0x564ef2,_0x6165c0){return db[_0x0c6b('0x28')][_0x0c6b('0x44')]({'where':{'id':_0x564ef2[_0x0c6b('0x43')]['id']}})[_0x0c6b('0x22')](function(_0x102a78){if(_[_0x0c6b('0x5f')](_0x102a78)){throw new ReferenceError(_0x0c6b('0x60'));}return _0x102a78;})[_0x0c6b('0x22')](function(_0x4bbdee){var _0x474bd5=_0x4bbdee[_0x0c6b('0x4b')];logger['info'](_0x0c6b('0x61'),_0x474bd5);if(!_[_0x0c6b('0x5f')](_0x4bbdee[_0x0c6b('0x4b')])&&fs[_0x0c6b('0x4c')](_0x474bd5)){logger[_0x0c6b('0x62')](_0x0c6b('0x63')+_0x474bd5+_0x0c6b('0x64'));fs[_0x0c6b('0x65')](_0x474bd5);}_0x474bd5=_0x474bd5+_0x0c6b('0x66');if(!_[_0x0c6b('0x5f')](_0x4bbdee[_0x0c6b('0x4b')])&&fs[_0x0c6b('0x4c')](_0x474bd5)){logger['info'](_0x0c6b('0x63')+_0x474bd5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0c6b('0x65')](_0x474bd5);}return _0x4bbdee;})['then'](function(_0x587c96){if(!_0x587c96)throw new InternalError();return _0x587c96[_0x0c6b('0x5e')]();})[_0x0c6b('0x22')](function(){_0x6165c0[_0x0c6b('0x19')](0xcc)[_0x0c6b('0x18')]();})[_0x0c6b('0x42')](handleError(_0x6165c0,null));};function getBucketslist(_0x21f220,_0x4eca48,_0x56778f){return new Promise(function(_0x4c5f7e,_0x5afbf0){var _0x188bb5=new AWS['S3']({'accessKeyId':_0x4eca48,'secretAccessKey':_0x21f220,'region':_0x56778f});_0x188bb5[_0x0c6b('0x67')]({},function(_0x5217ea,_0x3296b){if(_0x5217ea){return _0x5afbf0(_0x5217ea);}else{return _0x4c5f7e(_0x3296b);}});});}function createBucket(_0x4db2a2,_0x43c46a,_0x4652dc,_0x5d456c){return new Promise(function(_0x255a61,_0x2bdf21){var _0x432073=new AWS['S3']({'accessKeyId':_0x43c46a,'secretAccessKey':_0x4db2a2,'region':_0x4652dc});_0x432073['createBucket']({'Bucket':_0x5d456c},function(_0x48d35c,_0x4aa081){if(_0x48d35c){return _0x2bdf21(_0x48d35c);}else{return _0x255a61(_0x4aa081);}});});}function uploadFile(_0x4d110a,_0x5d4429,_0x356586,_0x365953,_0x2dd328,_0x484ac4){return new Promise(function(_0x1c5d10,_0x42effa){var _0x136063=new AWS['S3']({'accessKeyId':_0x5d4429,'secretAccessKey':_0x4d110a,'region':_0x356586});_0x136063[_0x0c6b('0x68')]({'Bucket':_0x365953,'Key':_0x2dd328,'Body':_0x484ac4},function(_0x434194,_0x12ad5d){if(_0x434194){return _0x42effa(_0x434194);}else{return _0x1c5d10(_0x12ad5d);}});});}function startTranscribe(_0x31415c,_0x37ae72,_0x4381ea,_0x5e37e5,_0x10c3fc,_0x23c33b){return new Promise(function(_0x12ec20,_0x1c6149){var _0x2ee106=new AWS[(_0x0c6b('0x69'))]({'accessKeyId':_0x37ae72,'secretAccessKey':_0x31415c,'region':_0x4381ea});_0x2ee106[_0x0c6b('0x6a')]({'TranscriptionJobName':_0x5e37e5,'LanguageCode':_0x10c3fc,'Media':{'MediaFileUri':_0x23c33b}},function(_0x1eb007,_0x1a6601){if(_0x1eb007){return _0x1c6149(_0x1eb007);}else{return _0x12ec20(_0x1a6601);}});});}function transcribe(_0x499709,_0x394601,_0x1c3d28,_0x3c6666,_0x1d31d5,_0x1b2cdc,_0x2d753e){return new Promise(function(_0x30bbc2,_0x323393){var _0xce931e={};logger[_0x0c6b('0x62')](util[_0x0c6b('0x2e')](_0x0c6b('0x6b'),_0x499709,_0x1d31d5));return uploadFile(_0x394601,_0x1c3d28,_0x3c6666,_0x1d31d5,path['basename'](_0x1b2cdc),fs[_0x0c6b('0x6c')](_0x1b2cdc))[_0x0c6b('0x22')](function(_0x163c06){logger['info'](util['format'](_0x0c6b('0x6d'),_0x499709,_0x1d31d5,_0x163c06[_0x0c6b('0x6e')]));_0xce931e[_0x0c6b('0x6f')]=_0x163c06[_0x0c6b('0x70')];_0xce931e['location']=_0x163c06[_0x0c6b('0x6e')];logger['info'](util[_0x0c6b('0x2e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x499709));return startTranscribe(_0x394601,_0x1c3d28,_0x3c6666,uuidv4(),_0x2d753e,_0x163c06[_0x0c6b('0x6e')]);})[_0x0c6b('0x22')](function(_0xeb8014){logger[_0x0c6b('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x499709,_0xeb8014[_0x0c6b('0x71')][_0x0c6b('0x72')]));_0xce931e['transcribeName']=_0xeb8014[_0x0c6b('0x71')][_0x0c6b('0x72')];_0xce931e[_0x0c6b('0x73')]=_0xeb8014['TranscriptionJob']['TranscriptionJobStatus'];return _0x30bbc2(_0xce931e);})[_0x0c6b('0x42')](function(_0x526c35){return _0x323393(_0x526c35);});});}exports[_0x0c6b('0x74')]=function(_0x33c71d,_0xc27cb7,_0x555970){var _0x4ddeb8;var _0x31fab;var _0x1e3626;var _0x19ca27=require('../../components/encryptor');return db[_0x0c6b('0x28')][_0x0c6b('0x75')]({'where':{'id':_0x33c71d[_0x0c6b('0x43')]['id']}})['then'](function(_0x4e3829){if(_0x4e3829){var _0x2edcd2=util['format'](_0x0c6b('0x5c'),_0x4e3829[_0x0c6b('0x4b')]);if(fs[_0x0c6b('0x4c')](_0x2edcd2)){cypher=!![];return _0x19ca27[_0x0c6b('0x5d')](_0x2edcd2,_0x4e3829[_0x0c6b('0x4b')],config[_0x0c6b('0x4d')][_0x0c6b('0x4e')])[_0x0c6b('0x22')](function(){return _0x4e3829;});}return _0x4e3829;}})[_0x0c6b('0x22')](function(_0x10152b){if(!_0x10152b){throw new db['Sequelize'][(_0x0c6b('0x50'))]('Voice\x20Recording\x20not\x20found');}_0x31fab=_0x10152b;return db['Setting'][_0x0c6b('0x75')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xc27cb7,null))[_0x0c6b('0x22')](function(_0x764de4){if(_0x764de4){_0x4ddeb8=_0x764de4;if(!_0x4ddeb8[_0x0c6b('0x76')]||!_0x4ddeb8[_0x0c6b('0x77')]||!_0x4ddeb8['transcribeRegion']||!_0x4ddeb8[_0x0c6b('0x78')]||!_0x4ddeb8[_0x0c6b('0x6f')]){throw new db[(_0x0c6b('0x4f'))][(_0x0c6b('0x50'))]('Transcribe\x20not\x20configured');}if(_0x33c71d[_0x0c6b('0x46')][_0x0c6b('0x79')]&&(!_0x4ddeb8['sentiment']||!_0x4ddeb8[_0x0c6b('0x7a')]||!_0x4ddeb8['sentimentRegion']||!_0x4ddeb8[_0x0c6b('0x78')]||!_0x4ddeb8[_0x0c6b('0x6f')])){throw new db[(_0x0c6b('0x4f'))][(_0x0c6b('0x50'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x0c6b('0x7b')][_0x0c6b('0x75')]({'where':{'id':_0x4ddeb8[_0x0c6b('0x77')]}});}})['then'](function(_0x1da1db){if(!_0x1da1db){throw new db[(_0x0c6b('0x4f'))][(_0x0c6b('0x50'))](_0x0c6b('0x7c'));}if(!_0x1da1db[_0x0c6b('0x7d')]||!_0x1da1db['data2']){throw new db[(_0x0c6b('0x4f'))]['ValidationError'](_0x0c6b('0x7e'));}_0x1e3626=_0x1da1db;return getBucketslist(_0x1e3626[_0x0c6b('0x7d')],_0x1e3626[_0x0c6b('0x7f')],_0x4ddeb8[_0x0c6b('0x80')]);})[_0x0c6b('0x22')](function(_0x5ce83a){if(_0x5ce83a&&_0x5ce83a[_0x0c6b('0x81')]){var _0x26ed88=_[_0x0c6b('0x44')](_0x5ce83a['Buckets'],function(_0x5543e1){return _0x5543e1[_0x0c6b('0x82')]===_0x4ddeb8['bucket'];});if(!_0x26ed88){logger[_0x0c6b('0x62')](util[_0x0c6b('0x2e')](_0x0c6b('0x83'),_0x33c71d[_0x0c6b('0x43')]['id'],_0x4ddeb8[_0x0c6b('0x6f')]));return createBucket(_0x1e3626['data1'],_0x1e3626[_0x0c6b('0x7f')],_0x4ddeb8[_0x0c6b('0x80')],_0x4ddeb8[_0x0c6b('0x6f')]);}logger['info'](util['format'](_0x0c6b('0x84'),_0x33c71d[_0x0c6b('0x43')]['id'],_0x4ddeb8[_0x0c6b('0x6f')]));return;}})[_0x0c6b('0x22')](function(_0x2a1e4e){if(_0x31fab[_0x0c6b('0x73')]===_0x0c6b('0x85')){return transcribe(_0x33c71d[_0x0c6b('0x43')]['id'],_0x1e3626[_0x0c6b('0x7d')],_0x1e3626['data2'],_0x4ddeb8['transcribeRegion'],_0x4ddeb8[_0x0c6b('0x6f')],_0x31fab[_0x0c6b('0x4b')],_0x4ddeb8[_0x0c6b('0x78')]);}else{logger[_0x0c6b('0x62')](util[_0x0c6b('0x2e')](_0x0c6b('0x86'),_0x33c71d[_0x0c6b('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0c6b('0x22')](function(_0x3580d9){if(_0x3580d9){_0x3580d9[_0x0c6b('0x87')]=_0x33c71d[_0x0c6b('0x46')][_0x0c6b('0x79')];return _0x31fab[_0x0c6b('0x88')](_0x3580d9);}})[_0x0c6b('0x22')](respondWithResult(_0xc27cb7,null))[_0x0c6b('0x42')](handleError(_0xc27cb7,null));};function writeFile(_0x4c49e0,_0x56e3d8){return new Promise(function(_0x337cae,_0x691e7c){fs[_0x0c6b('0x89')](_0x56e3d8,_0x4c49e0,function(_0x11cadd,_0x13c41f){if(_0x11cadd){return _0x691e7c(_0x11cadd);}else{return _0x337cae(_0x13c41f);}});});}exports[_0x0c6b('0x8a')]=function(_0x2570d3,_0x3f6d46,_0x5ea243){return db[_0x0c6b('0x28')][_0x0c6b('0x75')]({'where':{'id':_0x2570d3[_0x0c6b('0x43')]['id']}})[_0x0c6b('0x22')](handleEntityNotFound(_0x3f6d46))['then'](function(_0xbf5c9c){if(_0xbf5c9c&&_0xbf5c9c[_0x0c6b('0x8b')]){var _0x199842=_0xbf5c9c[_0x0c6b('0x8b')];var _0x437080=config[_0x0c6b('0x8c')]+_0x0c6b('0x8d')+_0xbf5c9c['id']+_0x0c6b('0x8e');if(fs[_0x0c6b('0x4c')](_0x437080)){return _0x437080;}return writeFile(_0x199842,_0x437080)[_0x0c6b('0x22')](function(){return _0x437080;});}else{throw new db[(_0x0c6b('0x4f'))]['ValidationError'](_0x0c6b('0x8f'));}})['then'](function(_0x294f36){return _0x3f6d46[_0x0c6b('0x48')](_0x294f36);})[_0x0c6b('0x42')](handleError(_0x3f6d46));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7568bd5..31ebd17 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 _0x2821=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0x2821,0x87));var _0x1282=function(_0x7fffe9,_0x3b1282){_0x7fffe9=_0x7fffe9-0x0;var _0x3b8cdf=_0x2821[_0x7fffe9];return _0x3b8cdf;};'use strict';var attributes=require(_0x1282('0x0'));module[_0x1282('0x1')]=function(_0x333849,_0x356903){return _0x333849[_0x1282('0x2')](_0x1282('0x3'),attributes,{'tableName':_0x1282('0x4'),'paranoid':![],'indexes':[{'name':_0x1282('0x5'),'fields':[_0x1282('0x5')]},{'name':_0x1282('0x6'),'fields':[_0x1282('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc524=['VoiceRecording','voice_recordings','uniqueid','define'];(function(_0x45de4e,_0x2f4d46){var _0x2b5137=function(_0x57c7c7){while(--_0x57c7c7){_0x45de4e['push'](_0x45de4e['shift']());}};_0x2b5137(++_0x2f4d46);}(_0xc524,0x1bf));var _0x4c52=function(_0x98f755,_0x25269a){_0x98f755=_0x98f755-0x0;var _0xf0ad5b=_0xc524[_0x98f755];return _0xf0ad5b;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x720088,_0x1d8049){return _0x720088[_0x4c52('0x0')](_0x4c52('0x1'),attributes,{'tableName':_0x4c52('0x2'),'paranoid':![],'indexes':[{'name':_0x4c52('0x3'),'fields':[_0x4c52('0x3')]},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a76cbfb..73c8564 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x384549,_0x3ebe5d){var _0x264bac=function(_0x2b1595){while(--_0x2b1595){_0x384549['push'](_0x384549['shift']());}};_0x264bac(++_0x3ebe5d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x5c3c[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3aec26,_0x1d581d){var _0x35db7f=function(_0x106416){while(--_0x106416){_0x3aec26['push'](_0x3aec26['shift']());}};_0x35db7f(++_0x1d581d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3ac710,_0x47c9e2){_0x3ac710=_0x3ac710-0x0;var _0x19b3f9=_0x5f2f[_0x3ac710];return _0x19b3f9;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5b73f31..de1e57a 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 _0xba7b=['show','post','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x24a972,_0x5079b5){var _0x2d4871=function(_0xa273b2){while(--_0xa273b2){_0x24a972['push'](_0x24a972['shift']());}};_0x2d4871(++_0x5079b5);}(_0xba7b,0x9d));var _0xbba7=function(_0x374706,_0x5210a7){_0x374706=_0x374706-0x0;var _0x5edd49=_0xba7b[_0x374706];return _0x5edd49;};'use strict';var multer=require(_0xbba7('0x0'));var util=require(_0xbba7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbba7('0x2'));var router=express[_0xbba7('0x3')]();var fs_extra=require(_0xbba7('0x4'));var auth=require(_0xbba7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbba7('0x6'));var controller=require(_0xbba7('0x7'));router['get']('/',auth[_0xbba7('0x8')](),controller[_0xbba7('0x9')]);router['get'](_0xbba7('0xa'),auth[_0xbba7('0x8')](),controller[_0xbba7('0xb')]);router[_0xbba7('0xc')](_0xbba7('0xd'),auth[_0xbba7('0x8')](),controller[_0xbba7('0xe')]);router[_0xbba7('0xf')]('/',auth[_0xbba7('0x8')](),controller['create']);router['put'](_0xbba7('0xd'),auth[_0xbba7('0x8')](),controller[_0xbba7('0x10')]);router[_0xbba7('0x11')](_0xbba7('0xd'),auth['isAuthenticated'](),controller[_0xbba7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4bd6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','destroy','exports','multer','util'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x4bd6,0x11f));var _0x64bd=function(_0x42e62d,_0x3a3c12){_0x42e62d=_0x42e62d-0x0;var _0xae1f8d=_0x4bd6[_0x42e62d];return _0xae1f8d;};'use strict';var multer=require(_0x64bd('0x0'));var util=require(_0x64bd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64bd('0x2')]();var fs_extra=require(_0x64bd('0x3'));var auth=require(_0x64bd('0x4'));var interaction=require(_0x64bd('0x5'));var config=require(_0x64bd('0x6'));var controller=require(_0x64bd('0x7'));router[_0x64bd('0x8')]('/',auth[_0x64bd('0x9')](),controller['index']);router[_0x64bd('0x8')]('/describe',auth[_0x64bd('0x9')](),controller[_0x64bd('0xa')]);router[_0x64bd('0x8')](_0x64bd('0xb'),auth[_0x64bd('0x9')](),controller[_0x64bd('0xc')]);router['post']('/',auth[_0x64bd('0x9')](),controller[_0x64bd('0xd')]);router[_0x64bd('0xe')]('/:id',auth[_0x64bd('0x9')](),controller['update']);router['delete'](_0x64bd('0xb'),auth[_0x64bd('0x9')](),controller[_0x64bd('0xf')]);module[_0x64bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 80be3ff..3d4da62 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 _0xc427=['attended','STRING','Yes','sequelize','exports','ENUM','blind'];(function(_0x42861d,_0x250e29){var _0x4914ef=function(_0x2bae10){while(--_0x2bae10){_0x42861d['push'](_0x42861d['shift']());}};_0x4914ef(++_0x250e29);}(_0xc427,0x96));var _0x7c42=function(_0x541582,_0x566b8b){_0x541582=_0x541582-0x0;var _0x56f020=_0xc427[_0x541582];return _0x56f020;};'use strict';var Sequelize=require(_0x7c42('0x0'));var moment=require('moment');module[_0x7c42('0x1')]={'type':{'type':Sequelize[_0x7c42('0x2')](_0x7c42('0x3'),_0x7c42('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x7c42('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7c42('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x7c42('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x7c42('0x5')]},'transferercontext':{'type':Sequelize[_0x7c42('0x5')]},'transfererexten':{'type':Sequelize[_0x7c42('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7c42('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7c42('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7c42('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x7c42('0x5')]},'transfereecontext':{'type':Sequelize[_0x7c42('0x5')]},'transfereeexten':{'type':Sequelize[_0x7c42('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7c42('0x2')](_0x7c42('0x6'),'No')},'context':{'type':Sequelize[_0x7c42('0x5')]},'extension':{'type':Sequelize[_0x7c42('0x5')]}}; \ No newline at end of file +var _0xa68a=['ENUM','STRING','Yes','sequelize','exports'];(function(_0x5eb3c5,_0x452247){var _0xd89e55=function(_0x584440){while(--_0x584440){_0x5eb3c5['push'](_0x5eb3c5['shift']());}};_0xd89e55(++_0x452247);}(_0xa68a,0x17f));var _0xaa68=function(_0x3f4725,_0x31bd6f){_0x3f4725=_0x3f4725-0x0;var _0x4c5314=_0xa68a[_0x3f4725];return _0x4c5314;};'use strict';var Sequelize=require(_0xaa68('0x0'));var moment=require('moment');module[_0xaa68('0x1')]={'type':{'type':Sequelize[_0xaa68('0x2')]('blind','attended')},'result':{'type':Sequelize[_0xaa68('0x3')]},'transfererchannel':{'type':Sequelize[_0xaa68('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xaa68('0x3')]},'transferercalleridname':{'type':Sequelize[_0xaa68('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xaa68('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xaa68('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xaa68('0x3')]},'transferercontext':{'type':Sequelize[_0xaa68('0x3')]},'transfererexten':{'type':Sequelize[_0xaa68('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xaa68('0x3')]},'transfereechannel':{'type':Sequelize[_0xaa68('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xaa68('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xaa68('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xaa68('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xaa68('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xaa68('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xaa68('0x3')]},'isexternal':{'type':Sequelize[_0xaa68('0x2')](_0xaa68('0x4'),'No')},'context':{'type':Sequelize[_0xaa68('0x3')]},'extension':{'type':Sequelize[_0xaa68('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 26bf3e2..531fda5 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 _0x7f46=['attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','params','VoiceTransferReport','rawAttributes','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','key','model','map','query','keys','filters'];(function(_0x20cb36,_0x3d0364){var _0x553009=function(_0x490897){while(--_0x490897){_0x20cb36['push'](_0x20cb36['shift']());}};_0x553009(++_0x3d0364);}(_0x7f46,0x18e));var _0x67f4=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0x7f46[_0x25bb4c];return _0x4c78b2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x67f4('0x0'));var jsonpatch=require(_0x67f4('0x1'));var rp=require(_0x67f4('0x2'));var moment=require(_0x67f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67f4('0x4'));var util=require(_0x67f4('0x5'));var path=require(_0x67f4('0x6'));var sox=require(_0x67f4('0x7'));var csv=require(_0x67f4('0x8'));var ejs=require(_0x67f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x67f4('0xb'));var deskjs=require(_0x67f4('0xc'));var toCsv=require(_0x67f4('0x8'));var querystring=require(_0x67f4('0xd'));var Papa=require(_0x67f4('0xe'));var Redis=require(_0x67f4('0xf'));var authService=require(_0x67f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x67f4('0x11'));var hardwareService=require(_0x67f4('0x12'));var logger=require(_0x67f4('0x13'))(_0x67f4('0x14'));var utils=require(_0x67f4('0x15'));var config=require(_0x67f4('0x16'));var licenseUtil=require(_0x67f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26eba1,_0x24cceb){_0x24cceb=_0x24cceb||0xcc;return function(_0xf26635){if(_0xf26635){return _0x26eba1[_0x67f4('0x18')](_0x24cceb);}return _0x26eba1[_0x67f4('0x19')](_0x24cceb)[_0x67f4('0x1a')]();};}function respondWithResult(_0x5b6d6a,_0x5c74d0){_0x5c74d0=_0x5c74d0||0xc8;return function(_0x5e7076){if(_0x5e7076){return _0x5b6d6a[_0x67f4('0x19')](_0x5c74d0)[_0x67f4('0x1b')](_0x5e7076);}};}function respondWithFilteredResult(_0x21c8d7,_0x558ac3){return function(_0x4d0e1a){if(_0x4d0e1a){var _0x3d05be=typeof _0x558ac3[_0x67f4('0x1c')]===_0x67f4('0x1d')&&typeof _0x558ac3['limit']===_0x67f4('0x1d');var _0x2511c8=_0x4d0e1a['count'];var _0x570094=_0x3d05be?0x0:_0x558ac3[_0x67f4('0x1c')];var _0x47f8d8=_0x3d05be?_0x4d0e1a[_0x67f4('0x1e')]:_0x558ac3[_0x67f4('0x1c')]+_0x558ac3[_0x67f4('0x1f')];var _0x525a53;if(_0x47f8d8>=_0x2511c8){_0x47f8d8=_0x2511c8;_0x525a53=0xc8;}else{_0x525a53=0xce;}_0x21c8d7[_0x67f4('0x19')](_0x525a53);return _0x21c8d7[_0x67f4('0x20')](_0x67f4('0x21'),_0x570094+'-'+_0x47f8d8+'/'+_0x2511c8)[_0x67f4('0x1b')](_0x4d0e1a);}return null;};}function patchUpdates(_0x34f28f){return function(_0x20a943){try{jsonpatch[_0x67f4('0x22')](_0x20a943,_0x34f28f,!![]);}catch(_0x257d49){return BPromise[_0x67f4('0x23')](_0x257d49);}return _0x20a943[_0x67f4('0x24')]();};}function saveUpdates(_0xe0b727,_0x5e2e03){return function(_0x237ce6){if(_0x237ce6){return _0x237ce6[_0x67f4('0x25')](_0xe0b727)[_0x67f4('0x26')](function(_0x12c3f9){return _0x12c3f9;});}return null;};}function removeEntity(_0x1f844e,_0x279012){return function(_0x224fc8){if(_0x224fc8){return _0x224fc8[_0x67f4('0x27')]()[_0x67f4('0x26')](function(){_0x1f844e['status'](0xcc)[_0x67f4('0x1a')]();});}};}function handleEntityNotFound(_0x1e45a6,_0x21d290){return function(_0xdd6be3){if(!_0xdd6be3){_0x1e45a6[_0x67f4('0x18')](0x194);}return _0xdd6be3;};}function handleError(_0x26a16f,_0x150d7b){_0x150d7b=_0x150d7b||0x1f4;return function(_0x28448a){logger[_0x67f4('0x28')](_0x28448a[_0x67f4('0x29')]);if(_0x28448a[_0x67f4('0x2a')]){delete _0x28448a[_0x67f4('0x2a')];}_0x26a16f[_0x67f4('0x19')](_0x150d7b)[_0x67f4('0x2b')](_0x28448a);};}exports['index']=function(_0x56c182,_0x482080){var _0x3c17b5={},_0x5c0bea={},_0x4aaa2f={'count':0x0,'rows':[]};var _0x46d071=_['map'](db['VoiceTransferReport']['rawAttributes'],function(_0x164255){return{'name':_0x164255[_0x67f4('0x2c')],'type':_0x164255[_0x67f4('0x2d')][_0x67f4('0x2e')]};});_0x5c0bea[_0x67f4('0x2f')]=_[_0x67f4('0x30')](_0x46d071,_0x67f4('0x2a'));_0x5c0bea[_0x67f4('0x31')]=_[_0x67f4('0x32')](_0x56c182[_0x67f4('0x31')]);_0x5c0bea[_0x67f4('0x33')]=_['intersection'](_0x5c0bea[_0x67f4('0x2f')],_0x5c0bea[_0x67f4('0x31')]);_0x3c17b5[_0x67f4('0x34')]=_[_0x67f4('0x35')](_0x5c0bea['model'],qs['fields'](_0x56c182[_0x67f4('0x31')][_0x67f4('0x36')]));_0x3c17b5[_0x67f4('0x34')]=_0x3c17b5[_0x67f4('0x34')]['length']?_0x3c17b5['attributes']:_0x5c0bea[_0x67f4('0x2f')];if(!_0x56c182[_0x67f4('0x31')][_0x67f4('0x37')]('nolimit')){_0x3c17b5[_0x67f4('0x1f')]=qs[_0x67f4('0x1f')](_0x56c182['query'][_0x67f4('0x1f')]);_0x3c17b5[_0x67f4('0x1c')]=qs['offset'](_0x56c182[_0x67f4('0x31')][_0x67f4('0x1c')]);}_0x3c17b5[_0x67f4('0x38')]=qs[_0x67f4('0x39')](_0x56c182[_0x67f4('0x31')][_0x67f4('0x39')]);_0x3c17b5['where']=qs[_0x67f4('0x33')](_[_0x67f4('0x3a')](_0x56c182[_0x67f4('0x31')],_0x5c0bea['filters']),_0x46d071);if(_0x56c182[_0x67f4('0x31')][_0x67f4('0x3b')]){_0x3c17b5[_0x67f4('0x3c')]=_[_0x67f4('0x3d')](_0x3c17b5[_0x67f4('0x3c')],{'$or':_[_0x67f4('0x30')](_0x46d071,function(_0x443ae9){if(_0x443ae9[_0x67f4('0x2d')]!==_0x67f4('0x3e')){var _0x308d8b={};_0x308d8b[_0x443ae9[_0x67f4('0x2a')]]={'$like':'%'+_0x56c182['query']['filter']+'%'};return _0x308d8b;}})});}_0x3c17b5=_[_0x67f4('0x3d')]({},_0x3c17b5,_0x56c182[_0x67f4('0x3f')]);var _0x487054={'where':_0x3c17b5[_0x67f4('0x3c')]};return db['VoiceTransferReport'][_0x67f4('0x1e')](_0x487054)['then'](function(_0x15f6b2){_0x4aaa2f[_0x67f4('0x1e')]=_0x15f6b2;if(_0x56c182[_0x67f4('0x31')]['includeAll']){_0x3c17b5[_0x67f4('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x67f4('0x41')](_0x3c17b5);})[_0x67f4('0x26')](function(_0x50379f){_0x4aaa2f['rows']=_0x50379f;return _0x4aaa2f;})[_0x67f4('0x26')](respondWithFilteredResult(_0x482080,_0x3c17b5))[_0x67f4('0x42')](handleError(_0x482080,null));};exports['show']=function(_0xd5045f,_0x43e142){var _0x25e86d={'raw':!![],'where':{'id':_0xd5045f[_0x67f4('0x43')]['id']}},_0x232f03={};_0x232f03[_0x67f4('0x2f')]=_[_0x67f4('0x32')](db[_0x67f4('0x44')][_0x67f4('0x45')]);_0x232f03[_0x67f4('0x31')]=_['keys'](_0xd5045f['query']);_0x232f03['filters']=_[_0x67f4('0x35')](_0x232f03[_0x67f4('0x2f')],_0x232f03[_0x67f4('0x31')]);_0x25e86d[_0x67f4('0x34')]=_['intersection'](_0x232f03[_0x67f4('0x2f')],qs[_0x67f4('0x36')](_0xd5045f[_0x67f4('0x31')][_0x67f4('0x36')]));_0x25e86d[_0x67f4('0x34')]=_0x25e86d['attributes'][_0x67f4('0x46')]?_0x25e86d[_0x67f4('0x34')]:_0x232f03[_0x67f4('0x2f')];if(_0xd5045f[_0x67f4('0x31')][_0x67f4('0x47')]){_0x25e86d[_0x67f4('0x40')]=[{'all':!![]}];}_0x25e86d=_[_0x67f4('0x3d')]({},_0x25e86d,_0xd5045f[_0x67f4('0x3f')]);return db['VoiceTransferReport'][_0x67f4('0x48')](_0x25e86d)[_0x67f4('0x26')](handleEntityNotFound(_0x43e142,null))[_0x67f4('0x26')](respondWithResult(_0x43e142,null))[_0x67f4('0x42')](handleError(_0x43e142,null));};exports[_0x67f4('0x49')]=function(_0x409806,_0x55d350){return db[_0x67f4('0x44')][_0x67f4('0x49')](_0x409806['body'],{})[_0x67f4('0x26')](respondWithResult(_0x55d350,0xc9))['catch'](handleError(_0x55d350,null));};exports[_0x67f4('0x25')]=function(_0x48ebf9,_0x54c4b9){if(_0x48ebf9['body']['id']){delete _0x48ebf9[_0x67f4('0x4a')]['id'];}return db[_0x67f4('0x44')][_0x67f4('0x48')]({'where':{'id':_0x48ebf9[_0x67f4('0x43')]['id']}})[_0x67f4('0x26')](handleEntityNotFound(_0x54c4b9,null))[_0x67f4('0x26')](saveUpdates(_0x48ebf9['body'],null))[_0x67f4('0x26')](respondWithResult(_0x54c4b9,null))[_0x67f4('0x42')](handleError(_0x54c4b9,null));};exports[_0x67f4('0x27')]=function(_0x272b90,_0x14d32e){return db['VoiceTransferReport'][_0x67f4('0x48')]({'where':{'id':_0x272b90[_0x67f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x14d32e,null))[_0x67f4('0x26')](removeEntity(_0x14d32e,null))[_0x67f4('0x42')](handleError(_0x14d32e,null));};exports['describe']=function(_0x10a83f,_0x8811f8){return db[_0x67f4('0x44')]['describe']()['then'](respondWithResult(_0x8811f8,null))[_0x67f4('0x42')](handleError(_0x8811f8,null));}; \ No newline at end of file +var _0x4d1e=['then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x4d1e,0x1ac));var _0xe4d1=function(_0x541260,_0x4c7f2e){_0x541260=_0x541260-0x0;var _0x1dd2b5=_0x4d1e[_0x541260];return _0x1dd2b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4d1('0x0'));var zipdir=require(_0xe4d1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4d1('0x2'));var moment=require(_0xe4d1('0x3'));var BPromise=require(_0xe4d1('0x4'));var Mustache=require(_0xe4d1('0x5'));var util=require(_0xe4d1('0x6'));var path=require(_0xe4d1('0x7'));var sox=require(_0xe4d1('0x8'));var csv=require('to-csv');var ejs=require(_0xe4d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4d1('0xa'));var squel=require(_0xe4d1('0xb'));var crypto=require('crypto');var jsforce=require(_0xe4d1('0xc'));var deskjs=require(_0xe4d1('0xd'));var toCsv=require(_0xe4d1('0xe'));var querystring=require(_0xe4d1('0xf'));var Papa=require(_0xe4d1('0x10'));var Redis=require(_0xe4d1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4d1('0x12'));var logger=require(_0xe4d1('0x13'))(_0xe4d1('0x14'));var utils=require(_0xe4d1('0x15'));var config=require(_0xe4d1('0x16'));var licenseUtil=require(_0xe4d1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4211,_0x5fa8bc){_0x5fa8bc=_0x5fa8bc||0xcc;return function(_0x386641){if(_0x386641){return _0x5d4211['sendStatus'](_0x5fa8bc);}return _0x5d4211[_0xe4d1('0x18')](_0x5fa8bc)[_0xe4d1('0x19')]();};}function respondWithResult(_0x71afa6,_0x2a54ee){_0x2a54ee=_0x2a54ee||0xc8;return function(_0x577d25){if(_0x577d25){return _0x71afa6['status'](_0x2a54ee)['json'](_0x577d25);}};}function respondWithFilteredResult(_0x229690,_0x5c82de){return function(_0x43749a){if(_0x43749a){var _0x19ea78=typeof _0x5c82de[_0xe4d1('0x1a')]==='undefined'&&typeof _0x5c82de[_0xe4d1('0x1b')]==='undefined';var _0x21e99e=_0x43749a['count'];var _0x3eb448=_0x19ea78?0x0:_0x5c82de[_0xe4d1('0x1a')];var _0x21013c=_0x19ea78?_0x43749a['count']:_0x5c82de['offset']+_0x5c82de['limit'];var _0x182fb2;if(_0x21013c>=_0x21e99e){_0x21013c=_0x21e99e;_0x182fb2=0xc8;}else{_0x182fb2=0xce;}_0x229690[_0xe4d1('0x18')](_0x182fb2);return _0x229690[_0xe4d1('0x1c')](_0xe4d1('0x1d'),_0x3eb448+'-'+_0x21013c+'/'+_0x21e99e)['json'](_0x43749a);}return null;};}function patchUpdates(_0x5015d7){return function(_0x1d17fc){try{jsonpatch[_0xe4d1('0x1e')](_0x1d17fc,_0x5015d7,!![]);}catch(_0xfdb234){return BPromise[_0xe4d1('0x1f')](_0xfdb234);}return _0x1d17fc[_0xe4d1('0x20')]();};}function saveUpdates(_0x847701,_0x5c2880){return function(_0x35351f){if(_0x35351f){return _0x35351f[_0xe4d1('0x21')](_0x847701)[_0xe4d1('0x22')](function(_0x590ff8){return _0x590ff8;});}return null;};}function removeEntity(_0x409404,_0x4fbf54){return function(_0xae5d3c){if(_0xae5d3c){return _0xae5d3c[_0xe4d1('0x23')]()[_0xe4d1('0x22')](function(){_0x409404[_0xe4d1('0x18')](0xcc)[_0xe4d1('0x19')]();});}};}function handleEntityNotFound(_0x4ca1c4,_0x2f1bfd){return function(_0x399b9e){if(!_0x399b9e){_0x4ca1c4[_0xe4d1('0x24')](0x194);}return _0x399b9e;};}function handleError(_0x5b3a7a,_0x257f87){_0x257f87=_0x257f87||0x1f4;return function(_0x23ad0e){logger[_0xe4d1('0x25')](_0x23ad0e[_0xe4d1('0x26')]);if(_0x23ad0e[_0xe4d1('0x27')]){delete _0x23ad0e['name'];}_0x5b3a7a[_0xe4d1('0x18')](_0x257f87)[_0xe4d1('0x28')](_0x23ad0e);};}exports[_0xe4d1('0x29')]=function(_0x3507e9,_0x2fa49d){var _0x562b34={},_0x10db99={},_0x40fafa={'count':0x0,'rows':[]};var _0x3a0315=_[_0xe4d1('0x2a')](db[_0xe4d1('0x2b')][_0xe4d1('0x2c')],function(_0x17674f){return{'name':_0x17674f[_0xe4d1('0x2d')],'type':_0x17674f['type'][_0xe4d1('0x2e')]};});_0x10db99[_0xe4d1('0x2f')]=_[_0xe4d1('0x2a')](_0x3a0315,_0xe4d1('0x27'));_0x10db99[_0xe4d1('0x30')]=_[_0xe4d1('0x31')](_0x3507e9[_0xe4d1('0x30')]);_0x10db99[_0xe4d1('0x32')]=_[_0xe4d1('0x33')](_0x10db99['model'],_0x10db99[_0xe4d1('0x30')]);_0x562b34[_0xe4d1('0x34')]=_[_0xe4d1('0x33')](_0x10db99[_0xe4d1('0x2f')],qs[_0xe4d1('0x35')](_0x3507e9[_0xe4d1('0x30')]['fields']));_0x562b34[_0xe4d1('0x34')]=_0x562b34[_0xe4d1('0x34')][_0xe4d1('0x36')]?_0x562b34['attributes']:_0x10db99[_0xe4d1('0x2f')];if(!_0x3507e9['query'][_0xe4d1('0x37')](_0xe4d1('0x38'))){_0x562b34[_0xe4d1('0x1b')]=qs['limit'](_0x3507e9[_0xe4d1('0x30')][_0xe4d1('0x1b')]);_0x562b34[_0xe4d1('0x1a')]=qs[_0xe4d1('0x1a')](_0x3507e9[_0xe4d1('0x30')]['offset']);}_0x562b34[_0xe4d1('0x39')]=qs[_0xe4d1('0x3a')](_0x3507e9['query']['sort']);_0x562b34['where']=qs[_0xe4d1('0x32')](_[_0xe4d1('0x3b')](_0x3507e9['query'],_0x10db99[_0xe4d1('0x32')]),_0x3a0315);if(_0x3507e9[_0xe4d1('0x30')]['filter']){_0x562b34[_0xe4d1('0x3c')]=_[_0xe4d1('0x3d')](_0x562b34[_0xe4d1('0x3c')],{'$or':_[_0xe4d1('0x2a')](_0x3a0315,function(_0x167dd4){if(_0x167dd4[_0xe4d1('0x3e')]!==_0xe4d1('0x3f')){var _0x6a7cd7={};_0x6a7cd7[_0x167dd4[_0xe4d1('0x27')]]={'$like':'%'+_0x3507e9[_0xe4d1('0x30')][_0xe4d1('0x40')]+'%'};return _0x6a7cd7;}})});}_0x562b34=_[_0xe4d1('0x3d')]({},_0x562b34,_0x3507e9['options']);var _0x1f1d49={'where':_0x562b34[_0xe4d1('0x3c')]};return db[_0xe4d1('0x2b')][_0xe4d1('0x41')](_0x1f1d49)[_0xe4d1('0x22')](function(_0x9c8dde){_0x40fafa['count']=_0x9c8dde;if(_0x3507e9['query'][_0xe4d1('0x42')]){_0x562b34[_0xe4d1('0x43')]=[{'all':!![]}];}return db[_0xe4d1('0x2b')][_0xe4d1('0x44')](_0x562b34);})[_0xe4d1('0x22')](function(_0x4513ae){_0x40fafa[_0xe4d1('0x45')]=_0x4513ae;return _0x40fafa;})[_0xe4d1('0x22')](respondWithFilteredResult(_0x2fa49d,_0x562b34))[_0xe4d1('0x46')](handleError(_0x2fa49d,null));};exports['show']=function(_0x4f6dec,_0xbd52a4){var _0x1c2d93={'raw':!![],'where':{'id':_0x4f6dec[_0xe4d1('0x47')]['id']}},_0x1cceda={};_0x1cceda[_0xe4d1('0x2f')]=_['keys'](db[_0xe4d1('0x2b')][_0xe4d1('0x2c')]);_0x1cceda[_0xe4d1('0x30')]=_['keys'](_0x4f6dec[_0xe4d1('0x30')]);_0x1cceda[_0xe4d1('0x32')]=_[_0xe4d1('0x33')](_0x1cceda[_0xe4d1('0x2f')],_0x1cceda['query']);_0x1c2d93[_0xe4d1('0x34')]=_[_0xe4d1('0x33')](_0x1cceda[_0xe4d1('0x2f')],qs[_0xe4d1('0x35')](_0x4f6dec[_0xe4d1('0x30')]['fields']));_0x1c2d93[_0xe4d1('0x34')]=_0x1c2d93[_0xe4d1('0x34')][_0xe4d1('0x36')]?_0x1c2d93[_0xe4d1('0x34')]:_0x1cceda[_0xe4d1('0x2f')];if(_0x4f6dec['query'][_0xe4d1('0x42')]){_0x1c2d93['include']=[{'all':!![]}];}_0x1c2d93=_[_0xe4d1('0x3d')]({},_0x1c2d93,_0x4f6dec[_0xe4d1('0x48')]);return db[_0xe4d1('0x2b')]['find'](_0x1c2d93)[_0xe4d1('0x22')](handleEntityNotFound(_0xbd52a4,null))[_0xe4d1('0x22')](respondWithResult(_0xbd52a4,null))[_0xe4d1('0x46')](handleError(_0xbd52a4,null));};exports[_0xe4d1('0x49')]=function(_0x8e7375,_0x2dce59){return db[_0xe4d1('0x2b')]['create'](_0x8e7375[_0xe4d1('0x4a')],{})[_0xe4d1('0x22')](respondWithResult(_0x2dce59,0xc9))[_0xe4d1('0x46')](handleError(_0x2dce59,null));};exports[_0xe4d1('0x21')]=function(_0x2942ec,_0x75aa86){if(_0x2942ec[_0xe4d1('0x4a')]['id']){delete _0x2942ec[_0xe4d1('0x4a')]['id'];}return db['VoiceTransferReport'][_0xe4d1('0x4b')]({'where':{'id':_0x2942ec[_0xe4d1('0x47')]['id']}})[_0xe4d1('0x22')](handleEntityNotFound(_0x75aa86,null))[_0xe4d1('0x22')](saveUpdates(_0x2942ec[_0xe4d1('0x4a')],null))['then'](respondWithResult(_0x75aa86,null))['catch'](handleError(_0x75aa86,null));};exports[_0xe4d1('0x23')]=function(_0x11c581,_0x11c0fc){return db['VoiceTransferReport'][_0xe4d1('0x4b')]({'where':{'id':_0x11c581[_0xe4d1('0x47')]['id']}})[_0xe4d1('0x22')](handleEntityNotFound(_0x11c0fc,null))[_0xe4d1('0x22')](removeEntity(_0x11c0fc,null))[_0xe4d1('0x46')](handleError(_0x11c0fc,null));};exports[_0xe4d1('0x4c')]=function(_0x4aec4c,_0x14963c){return db[_0xe4d1('0x2b')][_0xe4d1('0x4c')]()[_0xe4d1('0x22')](respondWithResult(_0x14963c,null))[_0xe4d1('0x46')](handleError(_0x14963c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ff569c8..ca4dec8 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 _0xa6b4=['request-promise','path','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa6b4,0xbb));var _0x4a6b=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xa6b4[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0x4a6b('0x0'));var util=require(_0x4a6b('0x1'));var logger=require(_0x4a6b('0x2'))(_0x4a6b('0x3'));var moment=require(_0x4a6b('0x4'));var BPromise=require('bluebird');var rp=require(_0x4a6b('0x5'));var fs=require('fs');var path=require(_0x4a6b('0x6'));var rimraf=require('rimraf');var config=require(_0x4a6b('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4a6b('0x8')]=function(_0x3bcc0f,_0x3c51f8){return _0x3bcc0f[_0x4a6b('0x9')](_0x4a6b('0xa'),attributes,{'tableName':_0x4a6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed6=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x574424,_0x33460c){var _0x86d444=function(_0x434e89){while(--_0x434e89){_0x574424['push'](_0x574424['shift']());}};_0x86d444(++_0x33460c);}(_0x5ed6,0x168));var _0x65ed=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x5ed6[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x65ed('0x0'));var util=require(_0x65ed('0x1'));var logger=require(_0x65ed('0x2'))(_0x65ed('0x3'));var moment=require('moment');var BPromise=require(_0x65ed('0x4'));var rp=require(_0x65ed('0x5'));var fs=require('fs');var path=require(_0x65ed('0x6'));var rimraf=require(_0x65ed('0x7'));var config=require(_0x65ed('0x8'));var attributes=require(_0x65ed('0x9'));module[_0x65ed('0xa')]=function(_0x1e1de2,_0x46ee7c){return _0x1e1de2[_0x65ed('0xb')](_0x65ed('0xc'),attributes,{'tableName':_0x65ed('0xd'),'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 2dfbb97..d167238 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 _0xfb01=['http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x48b902,_0x508da7){var _0x45633f=function(_0x2d1bd7){while(--_0x2d1bd7){_0x48b902['push'](_0x48b902['shift']());}};_0x45633f(++_0x508da7);}(_0xfb01,0x121));var _0x1fb0=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xfb01[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x1fb0('0x0'));var util=require(_0x1fb0('0x1'));var moment=require('moment');var BPromise=require(_0x1fb0('0x2'));var rs=require(_0x1fb0('0x3'));var fs=require('fs');var Redis=require(_0x1fb0('0x4'));var db=require(_0x1fb0('0x5'))['db'];var utils=require(_0x1fb0('0x6'));var logger=require(_0x1fb0('0x7'))(_0x1fb0('0x8'));var config=require('../../config/environment');var jayson=require(_0x1fb0('0x9'));var client=jayson[_0x1fb0('0xa')][_0x1fb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a32be,_0x323071,_0x3ad8e8){return new BPromise(function(_0x1a9862,_0x301533){return client[_0x1fb0('0xc')](_0x2a32be,_0x3ad8e8)[_0x1fb0('0xd')](function(_0x3a12ba){logger[_0x1fb0('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x323071,_0x1fb0('0xf'));logger[_0x1fb0('0x10')](_0x1fb0('0x11'),_0x323071,_0x1fb0('0xf'),JSON[_0x1fb0('0x12')](_0x3a12ba));if(_0x3a12ba[_0x1fb0('0x13')]){if(_0x3a12ba[_0x1fb0('0x13')][_0x1fb0('0x14')]===0x1f4){logger[_0x1fb0('0x13')](_0x1fb0('0x15'),_0x323071,_0x3a12ba[_0x1fb0('0x13')][_0x1fb0('0x16')]);return _0x301533(_0x3a12ba[_0x1fb0('0x13')][_0x1fb0('0x16')]);}logger[_0x1fb0('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x323071,_0x3a12ba[_0x1fb0('0x13')][_0x1fb0('0x16')]);return _0x1a9862(_0x3a12ba['error'][_0x1fb0('0x16')]);}else{logger[_0x1fb0('0xe')](_0x1fb0('0x15'),_0x323071,_0x1fb0('0xf'));_0x1a9862(_0x3a12ba[_0x1fb0('0x17')][_0x1fb0('0x16')]);}})[_0x1fb0('0x18')](function(_0x95278d){logger[_0x1fb0('0x13')](_0x1fb0('0x15'),_0x323071,_0x95278d);_0x301533(_0x95278d);});});}exports[_0x1fb0('0x19')]=function(_0x87225f){var _0x334b5c=this;return new Promise(function(_0x26107f,_0x43c8c3){return db['VoiceTransferReport'][_0x1fb0('0x1a')](_0x87225f[_0x1fb0('0x1b')],{'raw':_0x87225f['options']?_0x87225f[_0x1fb0('0x1c')][_0x1fb0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1039cc){logger['info'](_0x1fb0('0x19'),_0x87225f);logger['debug'](_0x1fb0('0x19'),_0x87225f,JSON['stringify'](_0x1039cc));_0x26107f(_0x1039cc);})[_0x1fb0('0x18')](function(_0x62655f){logger['error'](_0x1fb0('0x19'),_0x62655f[_0x1fb0('0x16')],_0x87225f);_0x43c8c3(_0x334b5c[_0x1fb0('0x13')](0x1f4,_0x62655f['message']));});});}; \ No newline at end of file +var _0xc903=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','body','options'];(function(_0x2e50db,_0x1e88d1){var _0xed2d70=function(_0xbff848){while(--_0xbff848){_0x2e50db['push'](_0x2e50db['shift']());}};_0xed2d70(++_0x1e88d1);}(_0xc903,0x1e1));var _0x3c90=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xc903[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0x3c90('0x0'));var util=require(_0x3c90('0x1'));var moment=require(_0x3c90('0x2'));var BPromise=require(_0x3c90('0x3'));var rs=require(_0x3c90('0x4'));var fs=require('fs');var Redis=require(_0x3c90('0x5'));var db=require(_0x3c90('0x6'))['db'];var utils=require(_0x3c90('0x7'));var logger=require(_0x3c90('0x8'))(_0x3c90('0x9'));var config=require(_0x3c90('0xa'));var jayson=require(_0x3c90('0xb'));var client=jayson[_0x3c90('0xc')][_0x3c90('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x32fd59,_0x105f00,_0x27b4e0){return new BPromise(function(_0x568c24,_0x68c254){return client[_0x3c90('0xe')](_0x32fd59,_0x27b4e0)['then'](function(_0x26b61b){logger[_0x3c90('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x105f00,_0x3c90('0x10'));logger[_0x3c90('0x11')](_0x3c90('0x12'),_0x105f00,_0x3c90('0x10'),JSON[_0x3c90('0x13')](_0x26b61b));if(_0x26b61b[_0x3c90('0x14')]){if(_0x26b61b[_0x3c90('0x14')]['code']===0x1f4){logger[_0x3c90('0x14')](_0x3c90('0x15'),_0x105f00,_0x26b61b[_0x3c90('0x14')]['message']);return _0x68c254(_0x26b61b['error'][_0x3c90('0x16')]);}logger[_0x3c90('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x105f00,_0x26b61b[_0x3c90('0x14')]['message']);return _0x568c24(_0x26b61b[_0x3c90('0x14')][_0x3c90('0x16')]);}else{logger['info'](_0x3c90('0x15'),_0x105f00,_0x3c90('0x10'));_0x568c24(_0x26b61b[_0x3c90('0x17')]['message']);}})[_0x3c90('0x18')](function(_0x2c9aae){logger[_0x3c90('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x105f00,_0x2c9aae);_0x68c254(_0x2c9aae);});});}exports[_0x3c90('0x19')]=function(_0x512a11){var _0x29b6eb=this;return new Promise(function(_0x3bf901,_0x393adb){return db['VoiceTransferReport'][_0x3c90('0x1a')](_0x512a11[_0x3c90('0x1b')],{'raw':_0x512a11['options']?_0x512a11[_0x3c90('0x1c')][_0x3c90('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x20562a){logger[_0x3c90('0xf')](_0x3c90('0x19'),_0x512a11);logger[_0x3c90('0x11')](_0x3c90('0x19'),_0x512a11,JSON['stringify'](_0x20562a));_0x3bf901(_0x20562a);})[_0x3c90('0x18')](function(_0x22df0c){logger['error'](_0x3c90('0x19'),_0x22df0c['message'],_0x512a11);_0x393adb(_0x29b6eb[_0x3c90('0x14')](0x1f4,_0x22df0c['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 29fc98f..478a61c 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x30c0f2,_0x4f8376){var _0xed8428=function(_0x10c962){while(--_0x10c962){_0x30c0f2['push'](_0x30c0f2['shift']());}};_0xed8428(++_0x4f8376);}(_0x9f62,0x154));var _0x29f6=function(_0xee42db,_0x34b35a){_0xee42db=_0xee42db-0x0;var _0x56e3ad=_0x9f62[_0xee42db];return _0x56e3ad;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xcb91[_0x2d89ce];return _0x3fad10;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4162481..2651a60 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 _0x3685=['UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','send','name','NotFound','request','then','error','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','originate','body','status','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x5368('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x5368('0x1'))['db'];var config=require(_0x5368('0x2'));var util=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var jayson=require(_0x5368('0x5'));var amiClient=jayson[_0x5368('0x6')][_0x5368('0x7')]({'port':0x232a});var logger=require(_0x5368('0x8'))(_0x5368('0x9'));var Redis=require(_0x5368('0xa'));config['redis']=_[_0x5368('0xb')](config[_0x5368('0xc')],{'host':_0x5368('0xd'),'port':0x18eb});var io=require(_0x5368('0xe'))(new Redis(config['redis']));var Schema=require(_0x5368('0xf'));var originateValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'callNumber':{'type':_0x5368('0x12'),'required':[!![],_0x5368('0x13')]},'callerId':{'type':_0x5368('0x12')},'callbackUrl':{'type':_0x5368('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x5368('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]},'sessionId':{'type':_0x5368('0x12'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],_0x5368('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5368('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x41ce0e,_0x183041,_0x59c422){logger[_0x5368('0x15')](_0x41ce0e,_0x183041,JSON[_0x5368('0x16')](_0x59c422));io['to'](_0x41ce0e)[_0x5368('0x17')](_0x183041,_0x59c422);}function handleError(_0x24a4b3){return function(_0x5b10e9){console[_0x5368('0x18')]('handleError:',_0x5b10e9,_0x5b10e9 instanceof RangeError);logger['error'](_0x5b10e9[_0x5368('0x19')]);if(_0x5b10e9 instanceof RangeError){if(_0x5b10e9['name']){delete _0x5b10e9['name'];}_0x24a4b3['status'](0x194)[_0x5368('0x1a')](_0x5b10e9);}else{if(_0x5b10e9[_0x5368('0x1b')]){delete _0x5b10e9[_0x5368('0x1b')];}_0x24a4b3['status'](0x1f4)['send'](_0x5b10e9);}};}function checkError(){return function(_0x2f21fc){if(!_0x2f21fc){throw new RangeError(_0x5368('0x1c'));}return _0x2f21fc;};}function respondWithRpcPromise(_0x14b6bd,_0x38f367){return new BPromise(function(_0x1c2fcd,_0x1093e2){var _0x4885d0=amiClient;return _0x4885d0[_0x5368('0x1d')](_0x14b6bd,_0x38f367)[_0x5368('0x1e')](function(_0x4705f2){if(_0x4705f2['error']){if(_0x4705f2[_0x5368('0x1f')][_0x5368('0x20')]===0x1f4){return _0x1093e2(_0x4705f2[_0x5368('0x1f')][_0x5368('0x21')]);}return _0x1c2fcd(_0x4705f2[_0x5368('0x1f')][_0x5368('0x21')]);}else{_0x1c2fcd(_0x4705f2[_0x5368('0x22')]);}})[_0x5368('0x23')](function(_0x47c30f){_0x1093e2(_0x47c30f);});});}function getAgent(_0x569d81){return db['User'][_0x5368('0x24')]({'where':{'id':_0x569d81,'role':_0x5368('0x25')}})[_0x5368('0x1e')](checkError());}function getAgentCheckSession(_0x452c81,_0x131722){return new BPromise(function(_0x4b94cd,_0x725f8e){var _0x200ad0=respondWithRpcPromise(_0x5368('0x26'));var _0x2bcf41=getAgent(_0x452c81);Promise[_0x5368('0x27')]([_0x200ad0,_0x2bcf41])[_0x5368('0x1e')](function(_0x3d40de){var _0x2963a6=_0x3d40de[0x0];var _0x3681e6=_0x3d40de[0x1];var _0x3c8ae1=_[_0x5368('0x28')](_0x2963a6[_0x5368('0x29')],function(_0x7449cd){return _0x7449cd['UserId']==_0x3681e6['id']&&_0x7449cd[_0x5368('0x2a')]==_0x131722;});if(_0x3c8ae1[_0x5368('0x2b')]==0x1){_0x4b94cd(_0x3681e6);}else{_0x725f8e(new RangeError(_0x5368('0x2c')+_0x131722+'\x20not\x20found!'));}});});}exports[_0x5368('0x2d')]=function(_0x50131a,_0x26fc48){logger[_0x5368('0x15')]('originate\x20fired:',_0x50131a[_0x5368('0x2e')]);var _0x1ce386=originateValidation['validate'](_0x50131a['body']);if(_0x1ce386[_0x5368('0x2b')]>0x0){return _0x26fc48[_0x5368('0x2f')](0x190)['json'](_0x1ce386);}var _0x46169e=_0x50131a[_0x5368('0x2e')][_0x5368('0x30')];var _0x4dc0ee=_0x50131a[_0x5368('0x2e')]['callNumber'];var _0x22b489=_0x50131a[_0x5368('0x2e')][_0x5368('0x31')];var _0x5f44d2=_0x50131a[_0x5368('0x2e')][_0x5368('0x32')];return getAgent(_0x46169e)[_0x5368('0x1e')](function(_0x2a3bed){logger['info'](_0x5368('0x33'),_0x2a3bed['name']);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x2a3bed['name']),_0x5368('0x36'),{'callNumber':_0x4dc0ee,'callerId':_0x22b489,'callbackUrl':_0x5f44d2});return _0x26fc48[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x38')});})['catch'](handleError(_0x26fc48));};exports[_0x5368('0x39')]=function(_0x19de44,_0x7b30ae){logger[_0x5368('0x15')](_0x5368('0x3a'),_0x19de44['body']);var _0x1183a1=hangupValidation[_0x5368('0xf')](_0x19de44['body']);if(_0x1183a1[_0x5368('0x2b')]>0x0){return _0x7b30ae[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x1183a1);}var _0x5e796f=_0x19de44[_0x5368('0x2e')][_0x5368('0x30')];var _0x1f23cc=_0x19de44[_0x5368('0x2e')]['sessionId'];return getAgent(_0x5e796f)['then'](function(_0x1be46a){logger[_0x5368('0x15')](_0x5368('0x33'),_0x1be46a['name']);emit(util['format'](_0x5368('0x35'),_0x1be46a['name']),_0x5368('0x3b'),{'sessionId':_0x1f23cc});return _0x7b30ae[_0x5368('0x2f')](0xc8)['json']({'error':![],'message':_0x5368('0x3c')});})[_0x5368('0x23')](handleError(_0x7b30ae));};exports[_0x5368('0x3d')]=function(_0xed1792,_0x2e1acc){logger[_0x5368('0x15')](_0x5368('0x3e'),_0xed1792[_0x5368('0x2e')]);var _0x48c86=answerValidation[_0x5368('0xf')](_0xed1792[_0x5368('0x2e')]);if(_0x48c86[_0x5368('0x2b')]>0x0){return _0x2e1acc['status'](0x190)[_0x5368('0x37')](_0x48c86);}var _0x61b1a1=_0xed1792[_0x5368('0x2e')]['userId'];var _0x1b66a1=_0xed1792[_0x5368('0x2e')]['sessionId'];return getAgent(_0x61b1a1)[_0x5368('0x1e')](function(_0x6f6dc4){logger[_0x5368('0x15')](_0x5368('0x33'),_0x6f6dc4[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x6f6dc4[_0x5368('0x1b')]),_0x5368('0x3f'),{'sessionId':_0x1b66a1});return _0x2e1acc[_0x5368('0x2f')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x5368('0x23')](handleError(_0x2e1acc));};exports[_0x5368('0x40')]=function(_0x3eb1d0,_0x20f041){logger['info']('hold\x20fired:',_0x3eb1d0[_0x5368('0x2e')]);var _0x5577b3=holdValidation[_0x5368('0xf')](_0x3eb1d0['body']);if(_0x5577b3[_0x5368('0x2b')]>0x0){return _0x20f041['status'](0x190)[_0x5368('0x37')](_0x5577b3);}var _0x244724=_0x3eb1d0['body']['userId'];var _0x3e9ac0=_0x3eb1d0['body'][_0x5368('0x2a')];return getAgent(_0x244724)[_0x5368('0x1e')](function(_0x2ee00b){logger[_0x5368('0x15')]('entityFound:',_0x2ee00b[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x2ee00b[_0x5368('0x1b')]),_0x5368('0x41'),{'sessionId':_0x3e9ac0});return _0x20f041[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x20f041));};exports[_0x5368('0x42')]=function(_0x7d7a5,_0x367a7d){logger['info'](_0x5368('0x43'),_0x7d7a5[_0x5368('0x2e')]);var _0x1791d4=unholdValidation[_0x5368('0xf')](_0x7d7a5[_0x5368('0x2e')]);if(_0x1791d4[_0x5368('0x2b')]>0x0){return _0x367a7d[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x1791d4);}var _0x539911=_0x7d7a5[_0x5368('0x2e')][_0x5368('0x30')];var _0x32aa43=_0x7d7a5[_0x5368('0x2e')]['sessionId'];return getAgent(_0x539911)[_0x5368('0x1e')](function(_0x9775f8){logger[_0x5368('0x15')](_0x5368('0x33'),_0x9775f8[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x9775f8[_0x5368('0x1b')]),_0x5368('0x44'),{'sessionId':_0x32aa43});return _0x367a7d[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x45')});})[_0x5368('0x23')](handleError(_0x367a7d));};exports[_0x5368('0x46')]=function(_0x5adefd,_0x1ea85e){logger[_0x5368('0x15')](_0x5368('0x47'),_0x1ea85e[_0x5368('0x2e')]);var _0x2688a9=callsValidation[_0x5368('0xf')](_0x5adefd['body']);if(_0x2688a9[_0x5368('0x2b')]>0x0){return _0x1ea85e['status'](0x190)[_0x5368('0x37')](_0x2688a9);}var _0x139b0d=_0x5adefd[_0x5368('0x2e')][_0x5368('0x30')];var _0xe348e1=respondWithRpcPromise(_0x5368('0x26'));var _0x170ecd=getAgent(_0x139b0d);return Promise['all']([_0xe348e1,_0x170ecd])[_0x5368('0x1e')](function(_0xcec819){var _0x45bba1=_0xcec819[0x0];var _0x3822ff=_0xcec819[0x1];var _0xf127d0=_[_0x5368('0x28')](_0x45bba1[_0x5368('0x29')],function(_0x128812){return _0x128812[_0x5368('0x48')]==_0x3822ff['id'];});return _0x1ea85e[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'count':_0xf127d0[_0x5368('0x2b')],'rows':_0xf127d0});})[_0x5368('0x23')](handleError(_0x1ea85e));};exports['conference']=function(_0x4fa56e,_0x5b741a){logger[_0x5368('0x15')](_0x5368('0x49'),_0x4fa56e[_0x5368('0x2e')]);var _0x2b7fa9=conferenceValidation['validate'](_0x4fa56e['body']);if(_0x2b7fa9[_0x5368('0x2b')]>0x0){return _0x5b741a[_0x5368('0x2f')](0x190)[_0x5368('0x37')](_0x2b7fa9);}var _0x4d1793=_0x4fa56e[_0x5368('0x2e')]['userId'];return getAgent(_0x4d1793)[_0x5368('0x1e')](function(_0x449972){logger[_0x5368('0x15')](_0x5368('0x33'),_0x449972[_0x5368('0x1b')]);emit(util['format'](_0x5368('0x35'),_0x449972[_0x5368('0x1b')]),_0x5368('0x4a'));return _0x5b741a['status'](0xc8)['json']({'error':![],'message':_0x5368('0x4b')});})[_0x5368('0x23')](handleError(_0x5b741a));};exports['transfer']=function(_0x591c07,_0x26d09c){logger[_0x5368('0x15')](_0x5368('0x4c'),_0x591c07[_0x5368('0x2e')]);var _0x2b5cb3=transferValidation[_0x5368('0xf')](_0x591c07[_0x5368('0x2e')]);if(_0x2b5cb3[_0x5368('0x2b')]>0x0){return _0x26d09c['status'](0x190)[_0x5368('0x37')](_0x2b5cb3);}var _0x5a70f4=_0x591c07[_0x5368('0x2e')][_0x5368('0x30')];var _0x1c2da8=_0x591c07['body'][_0x5368('0x2a')];var _0x242a9a=_0x591c07[_0x5368('0x2e')][_0x5368('0x4d')];return getAgent(_0x5a70f4)[_0x5368('0x1e')](function(_0x3f10b2){logger[_0x5368('0x15')](_0x5368('0x33'),_0x3f10b2[_0x5368('0x1b')]);emit(util[_0x5368('0x34')](_0x5368('0x35'),_0x3f10b2[_0x5368('0x1b')]),_0x5368('0x4e'),{'sessionId':_0x1c2da8,'transferNumber':_0x242a9a});return _0x26d09c[_0x5368('0x2f')](0xc8)[_0x5368('0x37')]({'error':![],'message':_0x5368('0x4f')});})[_0x5368('0x23')](handleError(_0x26d09c));}; \ No newline at end of file +var _0x5c12=['name','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','all','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','handleError:','error','status','send'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x5c12,0x188));var _0x25c1=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0x5c12[_0x52ea08];return _0x28d546;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x25c1('0x0'));var db=require(_0x25c1('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var jayson=require(_0x25c1('0x4'));var amiClient=jayson[_0x25c1('0x5')][_0x25c1('0x6')]({'port':0x232a});var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var Redis=require('ioredis');config[_0x25c1('0x9')]=_[_0x25c1('0xa')](config[_0x25c1('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25c1('0x9')]));var Schema=require(_0x25c1('0xb'));var originateValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'callNumber':{'type':_0x25c1('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x25c1('0xe')},'callbackUrl':{'type':_0x25c1('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':[!![],_0x25c1('0xf')]},'transferNumber':{'type':_0x25c1('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]}});function emit(_0x55b62d,_0x5d631e,_0x5b852a){logger[_0x25c1('0x10')](_0x55b62d,_0x5d631e,JSON[_0x25c1('0x11')](_0x5b852a));io['to'](_0x55b62d)['emit'](_0x5d631e,_0x5b852a);}function handleError(_0x4c55e7){return function(_0x61a29f){console['log'](_0x25c1('0x12'),_0x61a29f,_0x61a29f instanceof RangeError);logger[_0x25c1('0x13')](_0x61a29f['stack']);if(_0x61a29f instanceof RangeError){if(_0x61a29f['name']){delete _0x61a29f['name'];}_0x4c55e7[_0x25c1('0x14')](0x194)[_0x25c1('0x15')](_0x61a29f);}else{if(_0x61a29f[_0x25c1('0x16')]){delete _0x61a29f[_0x25c1('0x16')];}_0x4c55e7['status'](0x1f4)[_0x25c1('0x15')](_0x61a29f);}};}function checkError(){return function(_0x9f54e3){if(!_0x9f54e3){throw new RangeError(_0x25c1('0x17'));}return _0x9f54e3;};}function respondWithRpcPromise(_0x29e637,_0x517a46){return new BPromise(function(_0x4c3259,_0x2a8a84){var _0xac3335=amiClient;return _0xac3335[_0x25c1('0x18')](_0x29e637,_0x517a46)[_0x25c1('0x19')](function(_0x15cf2f){if(_0x15cf2f[_0x25c1('0x13')]){if(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1a')]===0x1f4){return _0x2a8a84(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}return _0x4c3259(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}else{_0x4c3259(_0x15cf2f[_0x25c1('0x1c')]);}})['catch'](function(_0x2dadae){_0x2a8a84(_0x2dadae);});});}function getAgent(_0x20dbb9){return db[_0x25c1('0x1d')][_0x25c1('0x1e')]({'where':{'id':_0x20dbb9,'role':_0x25c1('0x1f')}})[_0x25c1('0x19')](checkError());}function getAgentCheckSession(_0x5ad776,_0x17c924){return new BPromise(function(_0x428ce8,_0x6cb14f){var _0x38c1d5=respondWithRpcPromise(_0x25c1('0x20'));var _0x193a68=getAgent(_0x5ad776);Promise['all']([_0x38c1d5,_0x193a68])[_0x25c1('0x19')](function(_0x478f1e){var _0x76b360=_0x478f1e[0x0];var _0x31c153=_0x478f1e[0x1];var _0x2c42b9=_[_0x25c1('0x21')](_0x76b360[_0x25c1('0x22')],function(_0x21069c){return _0x21069c[_0x25c1('0x23')]==_0x31c153['id']&&_0x21069c[_0x25c1('0x24')]==_0x17c924;});if(_0x2c42b9[_0x25c1('0x25')]==0x1){_0x428ce8(_0x31c153);}else{_0x6cb14f(new RangeError('sessionId\x20'+_0x17c924+_0x25c1('0x26')));}});});}exports['originate']=function(_0x492715,_0x3db0ee){logger[_0x25c1('0x10')]('originate\x20fired:',_0x492715[_0x25c1('0x27')]);var _0x5a5a32=originateValidation[_0x25c1('0xb')](_0x492715['body']);if(_0x5a5a32[_0x25c1('0x25')]>0x0){return _0x3db0ee[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x5a5a32);}var _0x148e2a=_0x492715[_0x25c1('0x27')][_0x25c1('0x29')];var _0x461d23=_0x492715[_0x25c1('0x27')]['callNumber'];var _0x20a273=_0x492715['body'][_0x25c1('0x2a')];var _0x56de5e=_0x492715[_0x25c1('0x27')][_0x25c1('0x2b')];return getAgent(_0x148e2a)[_0x25c1('0x19')](function(_0x2f86de){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x2f86de[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x2f86de[_0x25c1('0x16')]),_0x25c1('0x2f'),{'callNumber':_0x461d23,'callerId':_0x20a273,'callbackUrl':_0x56de5e});return _0x3db0ee[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x30')});})[_0x25c1('0x31')](handleError(_0x3db0ee));};exports[_0x25c1('0x32')]=function(_0x349aef,_0x30b1d7){logger[_0x25c1('0x10')](_0x25c1('0x33'),_0x349aef['body']);var _0x32cc49=hangupValidation[_0x25c1('0xb')](_0x349aef['body']);if(_0x32cc49[_0x25c1('0x25')]>0x0){return _0x30b1d7['status'](0x190)[_0x25c1('0x28')](_0x32cc49);}var _0x4f978c=_0x349aef[_0x25c1('0x27')][_0x25c1('0x29')];var _0x1cf0b8=_0x349aef[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x4f978c)['then'](function(_0x1fe6d7){logger['info'](_0x25c1('0x2c'),_0x1fe6d7[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x1fe6d7['name']),'webbar:hangup',{'sessionId':_0x1cf0b8});return _0x30b1d7['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x34')});})['catch'](handleError(_0x30b1d7));};exports[_0x25c1('0x35')]=function(_0x58792d,_0x3d5172){logger[_0x25c1('0x10')](_0x25c1('0x36'),_0x58792d['body']);var _0x5502c1=answerValidation['validate'](_0x58792d[_0x25c1('0x27')]);if(_0x5502c1[_0x25c1('0x25')]>0x0){return _0x3d5172['status'](0x190)[_0x25c1('0x28')](_0x5502c1);}var _0x4c90f6=_0x58792d[_0x25c1('0x27')]['userId'];var _0x5e43dc=_0x58792d['body']['sessionId'];return getAgent(_0x4c90f6)[_0x25c1('0x19')](function(_0x259250){logger['info'](_0x25c1('0x2c'),_0x259250[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x259250[_0x25c1('0x16')]),_0x25c1('0x37'),{'sessionId':_0x5e43dc});return _0x3d5172[_0x25c1('0x14')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x25c1('0x31')](handleError(_0x3d5172));};exports[_0x25c1('0x38')]=function(_0x389547,_0x4bed0a){logger[_0x25c1('0x10')](_0x25c1('0x39'),_0x389547[_0x25c1('0x27')]);var _0xa009d1=holdValidation['validate'](_0x389547[_0x25c1('0x27')]);if(_0xa009d1[_0x25c1('0x25')]>0x0){return _0x4bed0a[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0xa009d1);}var _0x5d2ecc=_0x389547['body'][_0x25c1('0x29')];var _0x2cd055=_0x389547[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5d2ecc)['then'](function(_0x6eff9e){logger[_0x25c1('0x10')]('entityFound:',_0x6eff9e[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x6eff9e[_0x25c1('0x16')]),'webbar:hold',{'sessionId':_0x2cd055});return _0x4bed0a['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x3a')});})[_0x25c1('0x31')](handleError(_0x4bed0a));};exports['unhold']=function(_0x19028a,_0x2d874b){logger['info'](_0x25c1('0x3b'),_0x19028a[_0x25c1('0x27')]);var _0x2b58a3=unholdValidation[_0x25c1('0xb')](_0x19028a[_0x25c1('0x27')]);if(_0x2b58a3[_0x25c1('0x25')]>0x0){return _0x2d874b[_0x25c1('0x14')](0x190)['json'](_0x2b58a3);}var _0x5344da=_0x19028a['body'][_0x25c1('0x29')];var _0x5c588c=_0x19028a[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5344da)[_0x25c1('0x19')](function(_0x153603){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x153603['name']);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x153603[_0x25c1('0x16')]),_0x25c1('0x3c'),{'sessionId':_0x5c588c});return _0x2d874b[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':'unhold\x20executed!'});})[_0x25c1('0x31')](handleError(_0x2d874b));};exports[_0x25c1('0x3d')]=function(_0x18f7c5,_0xbff8ad){logger[_0x25c1('0x10')]('calls\x20fired:',_0xbff8ad[_0x25c1('0x27')]);var _0x3df219=callsValidation['validate'](_0x18f7c5[_0x25c1('0x27')]);if(_0x3df219[_0x25c1('0x25')]>0x0){return _0xbff8ad[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x3df219);}var _0x30ca5d=_0x18f7c5[_0x25c1('0x27')]['userId'];var _0x20ff17=respondWithRpcPromise(_0x25c1('0x20'));var _0x2760ef=getAgent(_0x30ca5d);return Promise[_0x25c1('0x3e')]([_0x20ff17,_0x2760ef])[_0x25c1('0x19')](function(_0x4052c1){var _0x2745b6=_0x4052c1[0x0];var _0x5d54cd=_0x4052c1[0x1];var _0x321833=_[_0x25c1('0x21')](_0x2745b6[_0x25c1('0x22')],function(_0x2d9e6b){return _0x2d9e6b[_0x25c1('0x23')]==_0x5d54cd['id'];});return _0xbff8ad[_0x25c1('0x14')](0xc8)['json']({'count':_0x321833[_0x25c1('0x25')],'rows':_0x321833});})[_0x25c1('0x31')](handleError(_0xbff8ad));};exports[_0x25c1('0x3f')]=function(_0x7a1d7a,_0x3d3ea2){logger[_0x25c1('0x10')](_0x25c1('0x40'),_0x7a1d7a['body']);var _0x44efc9=conferenceValidation['validate'](_0x7a1d7a[_0x25c1('0x27')]);if(_0x44efc9[_0x25c1('0x25')]>0x0){return _0x3d3ea2[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x44efc9);}var _0x3b0785=_0x7a1d7a[_0x25c1('0x27')][_0x25c1('0x29')];return getAgent(_0x3b0785)[_0x25c1('0x19')](function(_0x4c435c){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x4c435c[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x4c435c[_0x25c1('0x16')]),_0x25c1('0x41'));return _0x3d3ea2['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3d3ea2));};exports['transfer']=function(_0x188b51,_0x4b1ead){logger[_0x25c1('0x10')](_0x25c1('0x42'),_0x188b51[_0x25c1('0x27')]);var _0x58c743=transferValidation[_0x25c1('0xb')](_0x188b51['body']);if(_0x58c743[_0x25c1('0x25')]>0x0){return _0x4b1ead[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x58c743);}var _0x34579c=_0x188b51[_0x25c1('0x27')][_0x25c1('0x29')];var _0x11bdc4=_0x188b51['body'][_0x25c1('0x24')];var _0x46f71f=_0x188b51[_0x25c1('0x27')][_0x25c1('0x43')];return getAgent(_0x34579c)[_0x25c1('0x19')](function(_0x425f3e){logger['info'](_0x25c1('0x2c'),_0x425f3e['name']);emit(util[_0x25c1('0x2d')]('user:%s',_0x425f3e['name']),_0x25c1('0x44'),{'sessionId':_0x11bdc4,'transferNumber':_0x46f71f});return _0x4b1ead['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4b1ead));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f930fc1..5a65b02 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 _0xc5d7=['Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getAnswers','getAgents','/:id/applications','getApplications','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x332005,_0x24edf1){var _0x4393e1=function(_0x352f93){while(--_0x352f93){_0x332005['push'](_0x332005['shift']());}};_0x4393e1(++_0x24edf1);}(_0xc5d7,0xc3));var _0x7c5d=function(_0xf8d668,_0x1bf6b9){_0xf8d668=_0xf8d668-0x0;var _0x3f1987=_0xc5d7[_0xf8d668];return _0x3f1987;};'use strict';var multer=require(_0x7c5d('0x0'));var util=require(_0x7c5d('0x1'));var path=require(_0x7c5d('0x2'));var timeout=require(_0x7c5d('0x3'));var express=require(_0x7c5d('0x4'));var router=express[_0x7c5d('0x5')]();var fs_extra=require(_0x7c5d('0x6'));var auth=require(_0x7c5d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7c5d('0x8'));var controller=require(_0x7c5d('0x9'));router[_0x7c5d('0xa')]('/',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0xc')]);router[_0x7c5d('0xa')](_0x7c5d('0xd'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0xe')]);router[_0x7c5d('0xa')]('/:id',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0xf')]);router[_0x7c5d('0xa')](_0x7c5d('0x10'),auth[_0x7c5d('0xb')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x11')]);router[_0x7c5d('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x7c5d('0x12')]);router[_0x7c5d('0xa')](_0x7c5d('0x13'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x14')]);router['post']('/',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x15')]);router[_0x7c5d('0x16')](_0x7c5d('0x10'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x17')]);router[_0x7c5d('0x16')](_0x7c5d('0x18'),auth['isAuthenticated'](),controller[_0x7c5d('0x19')]);router[_0x7c5d('0x16')](_0x7c5d('0x1a'),auth['isAuthenticated'](),controller[_0x7c5d('0x1b')]);router[_0x7c5d('0x16')](_0x7c5d('0x13'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x1c')]);router[_0x7c5d('0x16')]('/:id/notify',controller['notify']);router[_0x7c5d('0x16')](_0x7c5d('0x1d'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x1e')]);router[_0x7c5d('0x1f')](_0x7c5d('0x20'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x21')]);router[_0x7c5d('0x22')](_0x7c5d('0x20'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x23')]);router[_0x7c5d('0x22')]('/:id/dispositions',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x24')]);router[_0x7c5d('0x22')]('/:id/canned_answers',auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x25')]);router[_0x7c5d('0x22')](_0x7c5d('0x1a'),auth[_0x7c5d('0xb')](),controller[_0x7c5d('0x26')]);module[_0x7c5d('0x27')]=router; \ No newline at end of file +var _0xdaae=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','post','create','addAgents','/:id/notify','/:id/send','send','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x1b43e5,_0x1c9659){var _0x31758e=function(_0x4a2f39){while(--_0x4a2f39){_0x1b43e5['push'](_0x1b43e5['shift']());}};_0x31758e(++_0x1c9659);}(_0xdaae,0xdb));var _0xedaa=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0xdaae[_0x743701];return _0x5a141d;};'use strict';var multer=require(_0xedaa('0x0'));var util=require(_0xedaa('0x1'));var path=require(_0xedaa('0x2'));var timeout=require('connect-timeout');var express=require(_0xedaa('0x3'));var router=express[_0xedaa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xedaa('0x5'));var interaction=require(_0xedaa('0x6'));var config=require('../../config/environment');var controller=require(_0xedaa('0x7'));router[_0xedaa('0x8')]('/',auth[_0xedaa('0x9')](),controller[_0xedaa('0xa')]);router['get'](_0xedaa('0xb'),auth['isAuthenticated'](),controller[_0xedaa('0xc')]);router[_0xedaa('0x8')](_0xedaa('0xd'),auth[_0xedaa('0x9')](),controller[_0xedaa('0xe')]);router[_0xedaa('0x8')](_0xedaa('0xf'),auth[_0xedaa('0x9')](),controller[_0xedaa('0x10')]);router[_0xedaa('0x8')](_0xedaa('0x11'),auth['isAuthenticated'](),controller[_0xedaa('0x12')]);router['get'](_0xedaa('0x13'),auth[_0xedaa('0x9')](),controller['getAgents']);router[_0xedaa('0x8')](_0xedaa('0x14'),auth[_0xedaa('0x9')](),controller['getApplications']);router[_0xedaa('0x15')]('/',auth[_0xedaa('0x9')](),controller[_0xedaa('0x16')]);router[_0xedaa('0x15')](_0xedaa('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xedaa('0x15')](_0xedaa('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xedaa('0x13'),auth[_0xedaa('0x9')](),controller[_0xedaa('0x17')]);router[_0xedaa('0x15')](_0xedaa('0x14'),auth[_0xedaa('0x9')](),controller['addApplications']);router['post'](_0xedaa('0x18'),controller['notify']);router[_0xedaa('0x15')](_0xedaa('0x19'),auth[_0xedaa('0x9')](),controller[_0xedaa('0x1a')]);router['put'](_0xedaa('0xd'),auth['isAuthenticated'](),controller[_0xedaa('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xedaa('0x1c')]);router[_0xedaa('0x1d')](_0xedaa('0xf'),auth['isAuthenticated'](),controller[_0xedaa('0x1e')]);router[_0xedaa('0x1d')]('/:id/canned_answers',auth[_0xedaa('0x9')](),controller[_0xedaa('0x1f')]);router[_0xedaa('0x1d')](_0xedaa('0x13'),auth['isAuthenticated'](),controller[_0xedaa('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 71b5d87..75ba768 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 _0xf6c2=['STRING','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x70549,_0x447dc2){var _0x303985=function(_0x4adf56){while(--_0x4adf56){_0x70549['push'](_0x70549['shift']());}};_0x303985(++_0x447dc2);}(_0xf6c2,0x1e8));var _0x2f6c=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf6c2[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x2f6c('0x0'));var rs=require(_0x2f6c('0x1'));module['exports']={'name':{'type':Sequelize[_0x2f6c('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2f6c('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x2f6c('0x2')],'defaultValue':function(){return rs[_0x2f6c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2f6c('0x4')](_0x2f6c('0x5'),_0x2f6c('0x6'))},'accountSid':{'type':Sequelize[_0x2f6c('0x2')]},'baseUrl':{'type':Sequelize[_0x2f6c('0x2')]},'authToken':{'type':Sequelize[_0x2f6c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2f6c('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2f6c('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x2f6c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2f6c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2f6c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2f6c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2f6c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2f6c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f6c('0x9')],'comment':_0x2f6c('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x463ab2){if(!_0x463ab2){this[_0x2f6c('0xb')](_0x2f6c('0xc'),null);}this['setDataValue'](_0x2f6c('0xd'),_0x463ab2);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x004a=['TEXT','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio'];(function(_0x20b566,_0x30d2d2){var _0x32b72f=function(_0xce66bd){while(--_0xce66bd){_0x20b566['push'](_0x20b566['shift']());}};_0x32b72f(++_0x30d2d2);}(_0x004a,0x7b));var _0xa004=function(_0x1e81d1,_0x4d6e09){_0x1e81d1=_0x1e81d1-0x0;var _0x246855=_0x004a[_0x1e81d1];return _0x246855;};'use strict';var Sequelize=require(_0xa004('0x0'));var rs=require('randomstring');module[_0xa004('0x1')]={'name':{'type':Sequelize[_0xa004('0x2')],'unique':_0xa004('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa004('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa004('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa004('0x2')],'defaultValue':function(){return rs[_0xa004('0x4')]();}},'phone':{'type':Sequelize[_0xa004('0x2')]},'type':{'type':Sequelize[_0xa004('0x5')](_0xa004('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0xa004('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa004('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa004('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa004('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa004('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa004('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa004('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa004('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa004('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa004('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa004('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2c6da7){if(!_0x2c6da7){this[_0xa004('0xa')](_0xa004('0xb'),null);}this[_0xa004('0xa')](_0xa004('0xc'),_0x2c6da7);}},'description':{'type':Sequelize[_0xa004('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 15f2190..0948afd 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 _0x7505=['getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','replace','messageId','from','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','unshift','queueId','WhatsappQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','WhatsappAccounts','destroy','stack','name','send','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','type','options','includeAll','findAll','catch','show','params','length','include','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','User'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7505,0x1cc));var _0x5750=function(_0x8f9bf7,_0x3e212e){_0x8f9bf7=_0x8f9bf7-0x0;var _0x5593ec=_0x7505[_0x8f9bf7];return _0x5593ec;};'use strict';var emlformat=require(_0x5750('0x0'));var rimraf=require(_0x5750('0x1'));var zipdir=require(_0x5750('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5750('0x3'));var moment=require(_0x5750('0x4'));var BPromise=require(_0x5750('0x5'));var Mustache=require(_0x5750('0x6'));var util=require(_0x5750('0x7'));var path=require('path');var sox=require(_0x5750('0x8'));var csv=require('to-csv');var ejs=require(_0x5750('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5750('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5750('0xb'));var deskjs=require(_0x5750('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5750('0xd'));var Papa=require(_0x5750('0xe'));var Redis=require(_0x5750('0xf'));var authService=require(_0x5750('0x10'));var qs=require(_0x5750('0x11'));var as=require(_0x5750('0x12'));var hardwareService=require(_0x5750('0x13'));var logger=require('../../config/logger')(_0x5750('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5750('0x15'));var db=require('../../mysqldb')['db'];config[_0x5750('0x16')]=_[_0x5750('0x17')](config['redis'],{'host':_0x5750('0x18'),'port':0x18eb});var socket=require(_0x5750('0x19'))(new Redis(config[_0x5750('0x16')]));require('./whatsappAccount.socket')[_0x5750('0x1a')](socket);var jayson=require(_0x5750('0x1b'));var client=jayson['client'][_0x5750('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5defbc,_0x3134b1,_0x5a9e81,_0x167b5b){return new BPromise(function(_0x2a8128,_0x34a767){var _0x43edc4=_0x167b5b||client;return _0x43edc4[_0x5750('0x1d')](_0x5defbc,_0x5a9e81)[_0x5750('0x1e')](function(_0xc56602){logger[_0x5750('0x1f')](_0x5750('0x20'),_0x3134b1,_0x5750('0x21'));logger['debug'](_0x5750('0x22'),_0x3134b1,_0x5750('0x21'),JSON['stringify'](_0xc56602));if(_0xc56602['error']){if(_0xc56602[_0x5750('0x23')][_0x5750('0x24')]===0x1f4){logger[_0x5750('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x3134b1,_0xc56602['error'][_0x5750('0x25')]);return _0x34a767(_0xc56602[_0x5750('0x23')][_0x5750('0x25')]);}logger['error'](_0x5750('0x20'),_0x3134b1,_0xc56602[_0x5750('0x23')][_0x5750('0x25')]);return _0x2a8128(_0xc56602[_0x5750('0x23')][_0x5750('0x25')]);}else{logger['info'](_0x5750('0x20'),_0x3134b1,'request\x20sent');_0x2a8128(_0xc56602[_0x5750('0x26')][_0x5750('0x25')]);}})['catch'](function(_0x3d86ec){logger[_0x5750('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x3134b1,_0x3d86ec);_0x34a767(_0x3d86ec);});});}function respondWithStatusCode(_0x14623c,_0x12d552){_0x12d552=_0x12d552||0xcc;return function(_0xa6b837){if(_0xa6b837){return _0x14623c[_0x5750('0x27')](_0x12d552);}return _0x14623c['status'](_0x12d552)[_0x5750('0x28')]();};}function respondWithResult(_0x533114,_0x239157){_0x239157=_0x239157||0xc8;return function(_0x2eb360){if(_0x2eb360){return _0x533114[_0x5750('0x29')](_0x239157)[_0x5750('0x2a')](_0x2eb360);}};}function respondWithFilteredResult(_0x27843e,_0x20f764){return function(_0x3578e6){if(_0x3578e6){var _0x55d971=typeof _0x20f764[_0x5750('0x2b')]===_0x5750('0x2c')&&typeof _0x20f764['limit']===_0x5750('0x2c');var _0x44e9dd=_0x3578e6[_0x5750('0x2d')];var _0x3a9b48=_0x55d971?0x0:_0x20f764[_0x5750('0x2b')];var _0xe7fff7=_0x55d971?_0x3578e6['count']:_0x20f764[_0x5750('0x2b')]+_0x20f764[_0x5750('0x2e')];var _0x5e205b;if(_0xe7fff7>=_0x44e9dd){_0xe7fff7=_0x44e9dd;_0x5e205b=0xc8;}else{_0x5e205b=0xce;}_0x27843e[_0x5750('0x29')](_0x5e205b);return _0x27843e[_0x5750('0x2f')](_0x5750('0x30'),_0x3a9b48+'-'+_0xe7fff7+'/'+_0x44e9dd)['json'](_0x3578e6);}return null;};}function patchUpdates(_0x36ca99){return function(_0x1a8da9){try{jsonpatch[_0x5750('0x31')](_0x1a8da9,_0x36ca99,!![]);}catch(_0x2464ea){return BPromise[_0x5750('0x32')](_0x2464ea);}return _0x1a8da9[_0x5750('0x33')]();};}function saveUpdates(_0x2063bd,_0x29a0a2){return function(_0x11c202){if(_0x11c202){return _0x11c202[_0x5750('0x34')](_0x2063bd)['then'](function(_0x2e113e){return _0x2e113e;});}return null;};}function removeEntity(_0x1396e2,_0x5425cd){return function(_0x3587d9){if(_0x3587d9){return _0x3587d9['destroy']()[_0x5750('0x1e')](function(){var _0x16e37e=_0x3587d9['get']({'plain':!![]});var _0x1ee536=_0x5750('0x35');return db['UserProfileResource'][_0x5750('0x36')]({'where':{'type':_0x1ee536,'resourceId':_0x16e37e['id']}})[_0x5750('0x1e')](function(){return _0x3587d9;});})[_0x5750('0x1e')](function(){_0x1396e2[_0x5750('0x29')](0xcc)[_0x5750('0x28')]();});}};}function handleEntityNotFound(_0x527863,_0x3050c0){return function(_0x3b820d){if(!_0x3b820d){_0x527863[_0x5750('0x27')](0x194);}return _0x3b820d;};}function handleError(_0xc526b9,_0x369596){_0x369596=_0x369596||0x1f4;return function(_0x3bd852){logger[_0x5750('0x23')](_0x3bd852[_0x5750('0x37')]);if(_0x3bd852[_0x5750('0x38')]){delete _0x3bd852[_0x5750('0x38')];}_0xc526b9['status'](_0x369596)[_0x5750('0x39')](_0x3bd852);};}exports['index']=function(_0x1aefa7,_0x253f8d){var _0x818c92={'include':[{'model':db['Pause'],'as':_0x5750('0x3a')}]},_0x56d3bc={},_0x4cdc88={'count':0x0,'rows':[]};var _0x26144a=_[_0x5750('0x3b')](db[_0x5750('0x3c')][_0x5750('0x3d')],function(_0x56b821){return{'name':_0x56b821[_0x5750('0x3e')],'type':_0x56b821['type'][_0x5750('0x3f')]};});_0x56d3bc[_0x5750('0x40')]=_[_0x5750('0x3b')](_0x26144a,'name');_0x56d3bc[_0x5750('0x41')]=_[_0x5750('0x42')](_0x1aefa7[_0x5750('0x41')]);_0x56d3bc['filters']=_[_0x5750('0x43')](_0x56d3bc['model'],_0x56d3bc[_0x5750('0x41')]);_0x818c92['attributes']=_[_0x5750('0x43')](_0x56d3bc[_0x5750('0x40')],qs[_0x5750('0x44')](_0x1aefa7['query'][_0x5750('0x44')]));_0x818c92[_0x5750('0x45')]=_0x818c92['attributes']['length']?_0x818c92['attributes']:_0x56d3bc[_0x5750('0x40')];if(!_0x1aefa7[_0x5750('0x41')][_0x5750('0x46')](_0x5750('0x47'))){_0x818c92[_0x5750('0x2e')]=qs[_0x5750('0x2e')](_0x1aefa7[_0x5750('0x41')][_0x5750('0x2e')]);_0x818c92['offset']=qs[_0x5750('0x2b')](_0x1aefa7[_0x5750('0x41')][_0x5750('0x2b')]);}_0x818c92[_0x5750('0x48')]=qs['sort'](_0x1aefa7[_0x5750('0x41')]['sort']);_0x818c92['where']=qs[_0x5750('0x49')](_[_0x5750('0x4a')](_0x1aefa7['query'],_0x56d3bc[_0x5750('0x49')]),_0x26144a);if(_0x1aefa7['query'][_0x5750('0x4b')]){_0x818c92[_0x5750('0x4c')]=_[_0x5750('0x4d')](_0x818c92[_0x5750('0x4c')],{'$or':_[_0x5750('0x3b')](_0x26144a,function(_0x17746b){if(_0x17746b[_0x5750('0x4e')]!=='VIRTUAL'){var _0x2fa038={};_0x2fa038[_0x17746b[_0x5750('0x38')]]={'$like':'%'+_0x1aefa7[_0x5750('0x41')]['filter']+'%'};return _0x2fa038;}})});}_0x818c92=_[_0x5750('0x4d')]({},_0x818c92,_0x1aefa7[_0x5750('0x4f')]);var _0x3620d6={'where':_0x818c92[_0x5750('0x4c')]};return db[_0x5750('0x3c')][_0x5750('0x2d')](_0x3620d6)[_0x5750('0x1e')](function(_0x43f665){_0x4cdc88[_0x5750('0x2d')]=_0x43f665;if(_0x1aefa7[_0x5750('0x41')][_0x5750('0x50')]){_0x818c92['include']=[{'all':!![]}];}return db[_0x5750('0x3c')][_0x5750('0x51')](_0x818c92);})['then'](function(_0x15c241){_0x4cdc88['rows']=_0x15c241;return _0x4cdc88;})['then'](respondWithFilteredResult(_0x253f8d,_0x818c92))[_0x5750('0x52')](handleError(_0x253f8d,null));};exports[_0x5750('0x53')]=function(_0xaf9968,_0x2a077e){var _0x4ec29c={'raw':![],'where':{'id':_0xaf9968[_0x5750('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x5750('0x3a')}]},_0xd5f9e6={};_0xd5f9e6['model']=_[_0x5750('0x42')](db[_0x5750('0x3c')][_0x5750('0x3d')]);_0xd5f9e6[_0x5750('0x41')]=_['keys'](_0xaf9968['query']);_0xd5f9e6[_0x5750('0x49')]=_[_0x5750('0x43')](_0xd5f9e6[_0x5750('0x40')],_0xd5f9e6['query']);_0x4ec29c['attributes']=_[_0x5750('0x43')](_0xd5f9e6['model'],qs[_0x5750('0x44')](_0xaf9968[_0x5750('0x41')][_0x5750('0x44')]));_0x4ec29c[_0x5750('0x45')]=_0x4ec29c['attributes'][_0x5750('0x55')]?_0x4ec29c[_0x5750('0x45')]:_0xd5f9e6['model'];if(_0xaf9968[_0x5750('0x41')][_0x5750('0x50')]){_0x4ec29c[_0x5750('0x56')]=[{'all':!![]}];}_0x4ec29c=_[_0x5750('0x4d')]({},_0x4ec29c,_0xaf9968[_0x5750('0x4f')]);return db[_0x5750('0x3c')]['find'](_0x4ec29c)[_0x5750('0x1e')](handleEntityNotFound(_0x2a077e,null))[_0x5750('0x1e')](respondWithResult(_0x2a077e,null))[_0x5750('0x52')](handleError(_0x2a077e,null));};exports['create']=function(_0x2a904c,_0xe9f502){return db[_0x5750('0x3c')][_0x5750('0x57')](_0x2a904c['body'],{})[_0x5750('0x1e')](function(_0x56b6d1){var _0x3e4104=_0x2a904c['user'][_0x5750('0x58')]({'plain':!![]});if(!_0x3e4104)throw new Error(_0x5750('0x59'));if(_0x3e4104[_0x5750('0x5a')]===_0x5750('0x5b')){var _0x193918=_0x56b6d1[_0x5750('0x58')]({'plain':!![]});var _0x3e0c38='WhatsappAccounts';return db['UserProfileSection'][_0x5750('0x5c')]({'where':{'name':_0x3e0c38,'userProfileId':_0x3e4104[_0x5750('0x5d')]},'raw':!![]})['then'](function(_0x5075c2){if(_0x5075c2&&_0x5075c2[_0x5750('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x193918[_0x5750('0x38')],'resourceId':_0x193918['id'],'type':_0x5075c2[_0x5750('0x38')],'sectionId':_0x5075c2['id']},{})['then'](function(){return _0x56b6d1;});}else{return _0x56b6d1;}})[_0x5750('0x52')](function(_0x58b8aa){logger[_0x5750('0x23')](_0x5750('0x5f'),_0x58b8aa);throw _0x58b8aa;});}return _0x56b6d1;})[_0x5750('0x1e')](respondWithResult(_0xe9f502,0xc9))[_0x5750('0x52')](handleError(_0xe9f502,null));};exports[_0x5750('0x34')]=function(_0x4f1a9a,_0x2bc460){if(_0x4f1a9a['body']['id']){delete _0x4f1a9a[_0x5750('0x60')]['id'];}return db[_0x5750('0x3c')][_0x5750('0x5c')]({'where':{'id':_0x4f1a9a[_0x5750('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x5750('0x3a')}]})[_0x5750('0x1e')](handleEntityNotFound(_0x2bc460,null))[_0x5750('0x1e')](saveUpdates(_0x4f1a9a[_0x5750('0x60')],null))[_0x5750('0x1e')](respondWithResult(_0x2bc460,null))[_0x5750('0x52')](handleError(_0x2bc460,null));};exports[_0x5750('0x36')]=function(_0x232b10,_0x337c21){return db[_0x5750('0x3c')]['find']({'where':{'id':_0x232b10[_0x5750('0x54')]['id']}})['then'](handleEntityNotFound(_0x337c21,null))[_0x5750('0x1e')](removeEntity(_0x337c21,null))[_0x5750('0x52')](handleError(_0x337c21,null));};exports[_0x5750('0x61')]=function(_0x5e7b04,_0xedca25){return db[_0x5750('0x3c')][_0x5750('0x61')]()['then'](respondWithResult(_0xedca25,null))[_0x5750('0x52')](handleError(_0xedca25,null));};exports[_0x5750('0x62')]=function(_0x2c31ac,_0xb66985,_0x4065cc){if(_0x2c31ac['body']['id']){delete _0x2c31ac[_0x5750('0x60')]['id'];}return db[_0x5750('0x3c')]['find']({'where':{'id':_0x2c31ac[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0xb66985,null))[_0x5750('0x1e')](function(_0x32f7a3){if(_0x32f7a3){_0x2c31ac[_0x5750('0x60')][_0x5750('0x63')]=_0x32f7a3['id'];return db[_0x5750('0x64')][_0x5750('0x57')](_0x2c31ac['body']);}})[_0x5750('0x1e')](respondWithResult(_0xb66985,null))[_0x5750('0x52')](handleError(_0xb66985,null));};exports[_0x5750('0x65')]=function(_0x417b43,_0x5b4367,_0x8dab17){var _0x4c5e48={'raw':![],'where':{}};var _0x3422a3={};var _0x4884bc={'count':0x0,'rows':[]};return db[_0x5750('0x3c')][_0x5750('0x66')]({'where':{'id':_0x417b43[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x5b4367,null))['then'](function(_0x40db51){if(_0x40db51){_0x3422a3[_0x5750('0x40')]=_[_0x5750('0x42')](db[_0x5750('0x64')][_0x5750('0x3d')]);_0x3422a3['query']=_[_0x5750('0x42')](_0x417b43['query']);_0x3422a3['filters']=_[_0x5750('0x43')](_0x3422a3[_0x5750('0x40')],_0x3422a3['query']);_0x4c5e48['attributes']=_['intersection'](_0x3422a3[_0x5750('0x40')],qs[_0x5750('0x44')](_0x417b43['query']['fields']));_0x4c5e48[_0x5750('0x45')]=_0x4c5e48['attributes'][_0x5750('0x55')]?_0x4c5e48[_0x5750('0x45')]:_0x3422a3[_0x5750('0x40')];if(!_0x417b43[_0x5750('0x41')]['hasOwnProperty'](_0x5750('0x47'))){_0x4c5e48['limit']=qs['limit'](_0x417b43[_0x5750('0x41')][_0x5750('0x2e')]);_0x4c5e48[_0x5750('0x2b')]=qs[_0x5750('0x2b')](_0x417b43[_0x5750('0x41')][_0x5750('0x2b')]);}_0x4c5e48[_0x5750('0x48')]=qs['sort'](_0x417b43[_0x5750('0x41')][_0x5750('0x67')]);_0x4c5e48[_0x5750('0x4c')]=qs[_0x5750('0x49')](_[_0x5750('0x4a')](_0x417b43[_0x5750('0x41')],_0x3422a3[_0x5750('0x49')]));_0x4c5e48[_0x5750('0x4c')]['WhatsappAccountId']=_0x40db51['id'];if(_0x417b43[_0x5750('0x41')][_0x5750('0x4b')]){_0x4c5e48[_0x5750('0x4c')]=_[_0x5750('0x4d')](_0x4c5e48[_0x5750('0x4c')],{'$or':_[_0x5750('0x3b')](_0x4c5e48[_0x5750('0x45')],function(_0x4b9c13){var _0x45b721={};_0x45b721[_0x4b9c13]={'$like':'%'+_0x417b43[_0x5750('0x41')]['filter']+'%'};return _0x45b721;})});}_0x4c5e48=_[_0x5750('0x4d')]({},_0x4c5e48,_0x417b43['options']);return db[_0x5750('0x64')][_0x5750('0x2d')]({'where':_0x4c5e48[_0x5750('0x4c')]})[_0x5750('0x1e')](function(_0x4debfe){_0x4884bc[_0x5750('0x2d')]=_0x4debfe;if(_0x417b43['query']['includeAll']){_0x4c5e48['include']=[{'all':!![]}];}return db[_0x5750('0x64')][_0x5750('0x51')](_0x4c5e48);})[_0x5750('0x1e')](function(_0x33fa14){_0x4884bc[_0x5750('0x68')]=_0x33fa14;return _0x4884bc;});}})[_0x5750('0x1e')](respondWithFilteredResult(_0x5b4367,_0x4c5e48))[_0x5750('0x52')](handleError(_0x5b4367,null));};exports[_0x5750('0x69')]=function(_0x58e666,_0xec065f,_0x3af06){return db['WhatsappAccount'][_0x5750('0x5c')]({'where':{'id':_0x58e666[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0xec065f,null))[_0x5750('0x1e')](function(_0x15886c){if(_0x15886c){return _0x15886c[_0x5750('0x69')](_0x58e666[_0x5750('0x41')][_0x5750('0x6a')]);}})[_0x5750('0x1e')](respondWithStatusCode(_0xec065f,null))[_0x5750('0x52')](handleError(_0xec065f,null));};exports['addAnswer']=function(_0x38aa33,_0x11b9b3,_0x444434){if(_0x38aa33[_0x5750('0x60')]['id']){delete _0x38aa33[_0x5750('0x60')]['id'];}return db[_0x5750('0x3c')][_0x5750('0x5c')]({'where':{'id':_0x38aa33['params']['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x11b9b3,null))['then'](function(_0x16dcf0){if(_0x16dcf0){_0x38aa33[_0x5750('0x60')][_0x5750('0x63')]=_0x16dcf0['id'];return db[_0x5750('0x6b')][_0x5750('0x57')](_0x38aa33[_0x5750('0x60')]);}})['then'](respondWithResult(_0x11b9b3,null))[_0x5750('0x52')](handleError(_0x11b9b3,null));};exports[_0x5750('0x6c')]=function(_0x2c507e,_0x56ae10,_0x39d89a){var _0x10dfb3={'raw':![],'where':{}};var _0x2b2ef2={};var _0x357be5={'count':0x0,'rows':[]};return db[_0x5750('0x3c')][_0x5750('0x66')]({'where':{'id':_0x2c507e[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x56ae10,null))[_0x5750('0x1e')](function(_0xb852b8){if(_0xb852b8){_0x2b2ef2[_0x5750('0x40')]=_[_0x5750('0x42')](db[_0x5750('0x6b')]['rawAttributes']);_0x2b2ef2[_0x5750('0x41')]=_['keys'](_0x2c507e[_0x5750('0x41')]);_0x2b2ef2[_0x5750('0x49')]=_[_0x5750('0x43')](_0x2b2ef2[_0x5750('0x40')],_0x2b2ef2[_0x5750('0x41')]);_0x10dfb3[_0x5750('0x45')]=_[_0x5750('0x43')](_0x2b2ef2[_0x5750('0x40')],qs['fields'](_0x2c507e[_0x5750('0x41')]['fields']));_0x10dfb3[_0x5750('0x45')]=_0x10dfb3[_0x5750('0x45')][_0x5750('0x55')]?_0x10dfb3[_0x5750('0x45')]:_0x2b2ef2[_0x5750('0x40')];if(!_0x2c507e[_0x5750('0x41')][_0x5750('0x46')](_0x5750('0x47'))){_0x10dfb3['limit']=qs['limit'](_0x2c507e['query'][_0x5750('0x2e')]);_0x10dfb3[_0x5750('0x2b')]=qs[_0x5750('0x2b')](_0x2c507e[_0x5750('0x41')][_0x5750('0x2b')]);}_0x10dfb3['order']=qs['sort'](_0x2c507e['query']['sort']);_0x10dfb3[_0x5750('0x4c')]=qs[_0x5750('0x49')](_['pick'](_0x2c507e['query'],_0x2b2ef2[_0x5750('0x49')]));_0x10dfb3['where'][_0x5750('0x63')]=_0xb852b8['id'];if(_0x2c507e[_0x5750('0x41')]['filter']){_0x10dfb3['where']=_[_0x5750('0x4d')](_0x10dfb3[_0x5750('0x4c')],{'$or':_[_0x5750('0x3b')](_0x10dfb3['attributes'],function(_0x2fc617){var _0x3550b2={};_0x3550b2[_0x2fc617]={'$like':'%'+_0x2c507e[_0x5750('0x41')]['filter']+'%'};return _0x3550b2;})});}_0x10dfb3=_['merge']({},_0x10dfb3,_0x2c507e[_0x5750('0x4f')]);return db[_0x5750('0x6b')][_0x5750('0x2d')]({'where':_0x10dfb3[_0x5750('0x4c')]})[_0x5750('0x1e')](function(_0x2e64e7){_0x357be5[_0x5750('0x2d')]=_0x2e64e7;if(_0x2c507e[_0x5750('0x41')]['includeAll']){_0x10dfb3[_0x5750('0x56')]=[{'all':!![]}];}return db[_0x5750('0x6b')][_0x5750('0x51')](_0x10dfb3);})[_0x5750('0x1e')](function(_0x2b75d9){_0x357be5[_0x5750('0x68')]=_0x2b75d9;return _0x357be5;});}})[_0x5750('0x1e')](respondWithFilteredResult(_0x56ae10,_0x10dfb3))['catch'](handleError(_0x56ae10,null));};exports[_0x5750('0x6d')]=function(_0x3e974b,_0x230d18,_0x37a009){return db['WhatsappAccount']['find']({'where':{'id':_0x3e974b[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x230d18,null))[_0x5750('0x1e')](function(_0x2b5a14){if(_0x2b5a14){return _0x2b5a14[_0x5750('0x6d')](_0x3e974b[_0x5750('0x41')][_0x5750('0x6a')]);}})[_0x5750('0x1e')](respondWithStatusCode(_0x230d18,null))['catch'](handleError(_0x230d18,null));};exports[_0x5750('0x6e')]=function(_0x684a7b,_0x3b2c84,_0x5dcfce){return db[_0x5750('0x3c')][_0x5750('0x5c')]({'where':{'id':_0x684a7b[_0x5750('0x54')]['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x3b2c84,null))[_0x5750('0x1e')](function(_0x29702f){if(_0x29702f){return _0x29702f['addAgents'](_0x684a7b['body'][_0x5750('0x6a')],_[_0x5750('0x6f')](_0x684a7b[_0x5750('0x60')],['ids','id'])||{})['spread'](function(_0x1a9a51){for(var _0x175d32=0x0;_0x175d32<_0x684a7b[_0x5750('0x60')][_0x5750('0x6a')][_0x5750('0x55')];_0x175d32+=0x1){socket[_0x5750('0x70')]('userWhatsappAccount:save',{'UserId':Number(_0x684a7b[_0x5750('0x60')]['ids'][_0x175d32]),'WhatsappAccountId':Number(_0x684a7b[_0x5750('0x54')]['id'])});}return _0x1a9a51;});}})['then'](respondWithResult(_0x3b2c84,null))[_0x5750('0x52')](handleError(_0x3b2c84,null));};exports[_0x5750('0x71')]=function(_0x1af552,_0x4bb36b,_0x351621){return db[_0x5750('0x3c')]['find']({'where':{'id':_0x1af552[_0x5750('0x54')]['id']}})['then'](handleEntityNotFound(_0x4bb36b,null))['then'](function(_0x2222ad){if(_0x2222ad){return _0x2222ad['removeAgents'](_0x1af552['query'][_0x5750('0x6a')])['then'](function(){if(_['isArray'](_0x1af552['query'][_0x5750('0x6a')])){for(var _0xa99069=0x0;_0xa99069<_0x1af552[_0x5750('0x41')][_0x5750('0x6a')][_0x5750('0x55')];_0xa99069+=0x1){socket['emit'](_0x5750('0x72'),{'UserId':Number(_0x1af552[_0x5750('0x41')][_0x5750('0x6a')][_0xa99069]),'WhatsappAccountId':Number(_0x1af552[_0x5750('0x54')]['id'])});}}else{socket['emit'](_0x5750('0x72'),{'UserId':Number(_0x1af552['query'][_0x5750('0x6a')]),'WhatsappAccountId':Number(_0x1af552[_0x5750('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x4bb36b,null))[_0x5750('0x52')](handleError(_0x4bb36b,null));};exports['getAgents']=function(_0x117c63,_0x2be176,_0x307f4e){var _0x35ef04={};var _0x21b55f={};var _0x4be855;var _0x59d5aa;return db[_0x5750('0x3c')][_0x5750('0x66')]({'where':{'id':_0x117c63['params']['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x2be176,null))['then'](function(_0x269aaf){if(_0x269aaf){_0x4be855=_0x269aaf;_0x21b55f[_0x5750('0x40')]=_[_0x5750('0x42')](db[_0x5750('0x73')][_0x5750('0x3d')]);_0x21b55f[_0x5750('0x41')]=_[_0x5750('0x42')](_0x117c63['query']);_0x21b55f[_0x5750('0x49')]=_[_0x5750('0x43')](_0x21b55f[_0x5750('0x40')],_0x21b55f[_0x5750('0x41')]);_0x35ef04[_0x5750('0x45')]=_[_0x5750('0x43')](_0x21b55f[_0x5750('0x40')],qs[_0x5750('0x44')](_0x117c63[_0x5750('0x41')][_0x5750('0x44')]));_0x35ef04[_0x5750('0x45')]=_0x35ef04['attributes'][_0x5750('0x55')]?_0x35ef04[_0x5750('0x45')]:_0x21b55f[_0x5750('0x40')];_0x35ef04[_0x5750('0x48')]=qs['sort'](_0x117c63['query'][_0x5750('0x67')]);_0x35ef04['where']=qs[_0x5750('0x49')](_[_0x5750('0x4a')](_0x117c63[_0x5750('0x41')],_0x21b55f[_0x5750('0x49')]));if(_0x117c63[_0x5750('0x41')][_0x5750('0x4b')]){_0x35ef04[_0x5750('0x4c')]=_[_0x5750('0x4d')](_0x35ef04[_0x5750('0x4c')],{'$or':_['map'](_0x35ef04[_0x5750('0x45')],function(_0x1f7cc8){var _0x2d8f84={};_0x2d8f84[_0x1f7cc8]={'$like':'%'+_0x117c63[_0x5750('0x41')]['filter']+'%'};return _0x2d8f84;})});}_0x35ef04=_[_0x5750('0x4d')]({},_0x35ef04,_0x117c63[_0x5750('0x4f')]);return _0x4be855[_0x5750('0x74')](_0x35ef04);}})[_0x5750('0x1e')](function(_0x2967a8){if(_0x2967a8){_0x59d5aa=_0x2967a8[_0x5750('0x55')];if(!_0x117c63[_0x5750('0x41')][_0x5750('0x46')]('nolimit')){_0x35ef04[_0x5750('0x2e')]=qs[_0x5750('0x2e')](_0x117c63['query']['limit']);_0x35ef04[_0x5750('0x2b')]=qs[_0x5750('0x2b')](_0x117c63['query'][_0x5750('0x2b')]);}return _0x4be855[_0x5750('0x74')](_0x35ef04);}})[_0x5750('0x1e')](function(_0x27e526){if(_0x27e526){return _0x27e526?{'count':_0x59d5aa,'rows':_0x27e526}:null;}})[_0x5750('0x1e')](respondWithResult(_0x2be176,null))['catch'](handleError(_0x2be176,null));};exports[_0x5750('0x75')]=function(_0x26f439,_0x3b5bbb){var _0x7ed373=_0x26f439[_0x5750('0x54')]['id'];var _0x1866a4=_0x26f439[_0x5750('0x60')];var _0x5b2ad1=0xc8;var _0x5f13db=null;return db[_0x5750('0x76')][_0x5750('0x77')]({'isolationLevel':db[_0x5750('0x76')][_0x5750('0x78')]['ISOLATION_LEVELS'][_0x5750('0x79')]},function(_0x11778a){return db[_0x5750('0x3c')][_0x5750('0x66')]({'where':{'id':_0x7ed373},'transaction':_0x11778a})[_0x5750('0x1e')](function(_0x3c830e){if(_0x3c830e){return db[_0x5750('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x7ed373},'transaction':_0x11778a})[_0x5750('0x1e')](function(){var _0x37473f=_['map'](_0x1866a4,function(_0x1af94c){_0x1af94c[_0x5750('0x63')]=_0x7ed373;return _0x1af94c;});return db[_0x5750('0x7a')][_0x5750('0x7b')](_0x37473f,{'transaction':_0x11778a});});}else{_0x5b2ad1=0x194;_0x5f13db=[];}});})[_0x5750('0x1e')](function(){if(_0x5b2ad1!==0x194){return db[_0x5750('0x7a')][_0x5750('0x7c')]({'where':{'WhatsappAccountId':_0x7ed373},'order':'priority'})[_0x5750('0x1e')](function(_0x328aa6){_0x5f13db=_0x328aa6;});}})[_0x5750('0x52')](function(_0x25a52d){_0x5b2ad1=0x1f4;logger['error'](_0x25a52d[_0x5750('0x37')]);if(_0x25a52d[_0x5750('0x38')]){delete _0x25a52d['name'];}_0x5f13db=_0x25a52d;})[_0x5750('0x7d')](function(){if(_0x5f13db===null){_0x3b5bbb[_0x5750('0x27')](_0x5b2ad1);}else{if(_0x5b2ad1===0x1f4){_0x3b5bbb[_0x5750('0x29')](_0x5b2ad1)['send'](_0x5f13db);}else{_0x3b5bbb[_0x5750('0x29')](_0x5b2ad1)[_0x5750('0x2a')](_0x5f13db);}}});};exports[_0x5750('0x7e')]=function(_0x7d2d24,_0x11bb3c,_0x39ddeb){var _0x27870c={};var _0x454323={};var _0x2ed256;var _0x31ecb3;return db[_0x5750('0x3c')][_0x5750('0x66')]({'where':{'id':_0x7d2d24['params']['id']}})[_0x5750('0x1e')](handleEntityNotFound(_0x11bb3c,null))[_0x5750('0x1e')](function(_0x3dd99d){if(_0x3dd99d){_0x2ed256=_0x3dd99d;_0x454323[_0x5750('0x40')]=_[_0x5750('0x42')](db['WhatsappApplication'][_0x5750('0x3d')]);_0x454323[_0x5750('0x41')]=_[_0x5750('0x42')](_0x7d2d24[_0x5750('0x41')]);_0x454323[_0x5750('0x49')]=_[_0x5750('0x43')](_0x454323[_0x5750('0x40')],_0x454323['query']);_0x27870c[_0x5750('0x45')]=_[_0x5750('0x43')](_0x454323[_0x5750('0x40')],qs['fields'](_0x7d2d24[_0x5750('0x41')][_0x5750('0x44')]));_0x27870c['attributes']=_0x27870c['attributes'][_0x5750('0x55')]?_0x27870c['attributes']:_0x454323[_0x5750('0x40')];_0x27870c[_0x5750('0x48')]=qs[_0x5750('0x67')](_0x7d2d24[_0x5750('0x41')]['sort']);_0x27870c[_0x5750('0x4c')]=qs[_0x5750('0x49')](_[_0x5750('0x4a')](_0x7d2d24[_0x5750('0x41')],_0x454323['filters']));if(_0x7d2d24['query'][_0x5750('0x4b')]){_0x27870c[_0x5750('0x4c')]=_['merge'](_0x27870c[_0x5750('0x4c')],{'$or':_[_0x5750('0x3b')](_0x27870c[_0x5750('0x45')],function(_0x51dc48){var _0x35f7c9={};_0x35f7c9[_0x51dc48]={'$like':'%'+_0x7d2d24[_0x5750('0x41')][_0x5750('0x4b')]+'%'};return _0x35f7c9;})});}_0x27870c=_[_0x5750('0x4d')]({},_0x27870c,_0x7d2d24['options']);return _0x2ed256['getApplications'](_0x27870c);}})[_0x5750('0x1e')](function(_0x259679){if(_0x259679){_0x31ecb3=_0x259679[_0x5750('0x55')];if(!_0x7d2d24[_0x5750('0x41')][_0x5750('0x46')](_0x5750('0x47'))){_0x27870c[_0x5750('0x2e')]=qs[_0x5750('0x2e')](_0x7d2d24['query'][_0x5750('0x2e')]);_0x27870c['offset']=qs[_0x5750('0x2b')](_0x7d2d24[_0x5750('0x41')][_0x5750('0x2b')]);}return _0x2ed256['getApplications'](_0x27870c);}})['then'](function(_0x2ad7dc){if(_0x2ad7dc){return _0x2ad7dc?{'count':_0x31ecb3,'rows':_0x2ad7dc}:null;}})[_0x5750('0x1e')](respondWithResult(_0x11bb3c,null))[_0x5750('0x52')](handleError(_0x11bb3c,null));};exports[_0x5750('0x7f')]=function(_0x334ae3,_0x347bb4,_0x26974c){var _0x15ea8f={'channel':_0x5750('0x80')};var _0xece077=[];var _0x4e4e59=[];var _0x1cefb7={};return db[_0x5750('0x3c')][_0x5750('0x5c')]({'where':{'id':_0x334ae3[_0x5750('0x54')]['id']},'include':[{'model':db[_0x5750('0x7a')],'as':_0x5750('0x81')}]})[_0x5750('0x1e')](handleEntityNotFound(_0x347bb4,null))[_0x5750('0x1e')](function(_0x629e6){_0x15ea8f[_0x5750('0x82')]=_0x629e6;if(_0x15ea8f[_0x5750('0x82')]&&_0x15ea8f['account']['type']===_0x5750('0x83')&&_0x334ae3[_0x5750('0x60')][_0x5750('0x84')]){if(_0x334ae3[_0x5750('0x60')][_0x5750('0x84')]['length']===0x0)return;if(_0x334ae3[_0x5750('0x60')][_0x5750('0x84')][0x0]['state']!==_0x5750('0x85'))return;return db[_0x5750('0x86')][_0x5750('0x34')]({'read':!![],'readAt':_0x334ae3[_0x5750('0x60')][_0x5750('0x84')][0x0][_0x5750('0x87')]},{'where':{'messageId':_0x334ae3[_0x5750('0x60')]['statuses'][0x0][_0x5750('0x88')]},'individualHooks':!![]})[_0x5750('0x1e')](function(_0x5f4516){return _0x347bb4['status'](0xc8)['json'](_0x5f4516);});}_0x15ea8f[_0x5750('0x89')]=_[_0x5750('0x8a')](_0x629e6[_0x5750('0x81')],[_0x5750('0x8b')],[_0x5750('0x8c')]);if(_0x15ea8f[_0x5750('0x82')][_0x5750('0x81')]){delete _0x15ea8f[_0x5750('0x82')][_0x5750('0x81')];}return db[_0x5750('0x8d')]['describe']()[_0x5750('0x1e')](function(_0xb4d4a3){if(!_0xb4d4a3){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))](_0x5750('0x90'));}_0xece077=_['difference'](_[_0x5750('0x42')](_0xb4d4a3),[_0x5750('0x91'),_0x5750('0x92')]);_0x4e4e59=_[_0x5750('0x93')](_[_0x5750('0x42')](_0xb4d4a3),[_0x5750('0x91'),_0x5750('0x92'),_0x5750('0x94'),_0x5750('0x95')]);_0x15ea8f[_0x5750('0x60')]={'mapKey':_0x5750('0x96')};if(_0x15ea8f['account']&&_0x15ea8f['account'][_0x5750('0x4e')]===_0x5750('0x97')){_0x15ea8f[_0x5750('0x60')]['from']=_0x334ae3[_0x5750('0x60')]['From'][_0x5750('0x98')]('whatsapp:','');_0x15ea8f[_0x5750('0x60')][_0x5750('0x60')]=_0x334ae3[_0x5750('0x60')]['Body'];_0x15ea8f[_0x5750('0x60')][_0x5750('0x99')]=_0x334ae3[_0x5750('0x60')]['MessageSid'];}if(_0x15ea8f[_0x5750('0x82')]&&_0x15ea8f[_0x5750('0x82')]['type']==='sinch'){_0x15ea8f[_0x5750('0x60')][_0x5750('0x9a')]=_0x334ae3['body'][_0x5750('0x9b')][0x0][_0x5750('0x9a')];_0x15ea8f[_0x5750('0x60')][_0x5750('0x60')]=_0x334ae3[_0x5750('0x60')][_0x5750('0x9b')][0x0][_0x5750('0x25')][_0x5750('0x60')];_0x15ea8f[_0x5750('0x60')][_0x5750('0x99')]=_0x334ae3[_0x5750('0x60')]['notifications'][0x0][_0x5750('0x88')];}if(_0x15ea8f['body']['id']){delete _0x15ea8f['body']['id'];}if(_[_0x5750('0x9c')](_0x15ea8f[_0x5750('0x60')][_0x5750('0x9a')])){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x15ea8f[_0x5750('0x60')][_0x5750('0x60')])||_0x15ea8f[_0x5750('0x60')][_0x5750('0x60')]===''){throw new db[(_0x5750('0x8e'))]['ValidationError'](_0x5750('0x9d'));}if(_['isNil'](_0x15ea8f[_0x5750('0x60')]['mapKey'])){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e4e59);}if(!_['includes'](_0x4e4e59,_0x15ea8f[_0x5750('0x60')][_0x5750('0x9e')])){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))](_0x5750('0x9f')+_0x4e4e59);}_0x1cefb7[_0x15ea8f[_0x5750('0x60')][_0x5750('0x9e')]]=_0x15ea8f['body'][_0x5750('0x9a')];return db[_0x5750('0xa0')][_0x5750('0x5c')]({'where':{'id':_0x15ea8f[_0x5750('0x82')][_0x5750('0x95')]},'include':[{'model':db[_0x5750('0x8d')],'as':_0x5750('0xa1'),'where':_0x1cefb7,'limit':0x1,'order':[[_0x5750('0x92'),'DESC']]}]});})['then'](handleEntityNotFound(_0x347bb4,null))[_0x5750('0x1e')](function(_0x192773){if(_0x192773){_0x15ea8f[_0x5750('0xa2')]=_[_0x5750('0x6f')](_0x192773,['Contacts']);if(_0x192773[_0x5750('0xa1')][_0x5750('0x55')]){return _0x192773[_0x5750('0xa1')][0x0];}var _0x1935cb=_[_0x5750('0x17')](_0x15ea8f[_0x5750('0x60')],{'firstName':_0x15ea8f[_0x5750('0x60')][_0x5750('0x9a')],'ListId':_0x192773['id']});_0x1935cb[_0x15ea8f[_0x5750('0x60')][_0x5750('0x9e')]]=_0x15ea8f[_0x5750('0x60')][_0x5750('0x9a')];return db['CmContact'][_0x5750('0x57')](_0x1935cb,{'fields':_0xece077,'raw':!![]});}})[_0x5750('0x1e')](handleEntityNotFound(_0x347bb4,null))['then'](function(_0x176050){if(_0x176050){_0x15ea8f[_0x5750('0xa3')]=_0x176050;var _0x2932b9={'ContactId':_0x176050['id'],'phone':_0x15ea8f[_0x5750('0x60')]['from'],'WhatsappAccountId':_0x334ae3['params']['id']};var _0x671495={'ContactId':_0x176050['id'],'WhatsappAccountId':_0x334ae3[_0x5750('0x54')]['id'],'closed':![]};return db[_0x5750('0xa4')][_0x5750('0x5c')]({'where':_0x671495})[_0x5750('0x1e')](function(_0x5eefe5){if(_0x5eefe5){return[_0x5eefe5,![]];}return db[_0x5750('0xa4')][_0x5750('0x57')](_0x2932b9)[_0x5750('0x1e')](function(_0x4012cb){return[_0x4012cb,!![]];});});}})[_0x5750('0xa5')](function(_0x324e03,_0x210f57){_0x15ea8f['interaction']=_0x324e03['get']({'plain':!![]});_0x15ea8f[_0x5750('0xa6')][_0x5750('0xa7')]=![];if(_0x210f57){if(_0x15ea8f[_0x5750('0x82')]['autoclose']){_0x15ea8f[_0x5750('0x89')][_0x5750('0xa8')]({'id':0x0,'priority':_0x15ea8f['applications']['length']+0x1,'app':_0x5750('0xa9'),'appdata':_0x5750('0xaa'),'interval':_0x5750('0xab')});}_0x15ea8f[_0x5750('0xa6')][_0x5750('0xa7')]=!![];}return db[_0x5750('0x86')][_0x5750('0x57')]({'phone':_0x15ea8f[_0x5750('0x60')]['from'],'messageId':_0x15ea8f['body'][_0x5750('0x99')],'body':_0x15ea8f[_0x5750('0x60')][_0x5750('0x60')],'WhatsappAccountId':_0x334ae3[_0x5750('0x54')]['id'],'WhatsappInteractionId':_0x324e03['id'],'direction':'in','ContactId':_0x324e03[_0x5750('0xac')],'AttachmentId':_0x15ea8f[_0x5750('0x60')]['AttachmentId']});})[_0x5750('0x1e')](function(_0x1ab34f){_0x15ea8f[_0x5750('0x25')]=_0x1ab34f;if(!_0x15ea8f[_0x5750('0xa6')]['UserId'])return;return db['User'][_0x5750('0x5c')]({'attributes':['id',_0x5750('0x38')],'where':{'id':_0x15ea8f[_0x5750('0xa6')]['UserId']}});})[_0x5750('0x1e')](function(_0x3e6184){if(_0x3e6184){_0x15ea8f[_0x5750('0x89')][_0x5750('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3e6184[_0x5750('0x38')]+','+(_0x15ea8f[_0x5750('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x5750('0xab')});}if(!_0x15ea8f[_0x5750('0xa6')][_0x5750('0xae')])return;return db[_0x5750('0xaf')][_0x5750('0x5c')]({'attributes':['id',_0x5750('0x38')],'where':{'id':_0x15ea8f[_0x5750('0xa6')][_0x5750('0xae')]}});})[_0x5750('0x1e')](function(_0x1c96dc){if(_0x1c96dc){_0x15ea8f[_0x5750('0x89')][_0x5750('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1c96dc[_0x5750('0x38')]+','+(_0x15ea8f[_0x5750('0x82')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5750('0xb0'),_0x5750('0xb1'),_0x15ea8f);})['then'](function(_0xf6f12b){if(_0xf6f12b){var _0x4b349b=0xc8;var _0x1c5c7e=_0x5750('0xb2');logger[_0x5750('0x1f')](_0x5750('0x22'),_0x1c5c7e,_0x4b349b,_0x5750('0xb3'));logger[_0x5750('0xb4')](_0x5750('0xb5'),_0x1c5c7e,_0x4b349b,_0x5750('0xb3'),JSON[_0x5750('0xb6')](_0xf6f12b));if(_0x15ea8f['account'][_0x5750('0x4e')]==='twilio'){return _0x347bb4[_0x5750('0x29')](_0x4b349b)['set'](_0x5750('0xb7'),_0x5750('0xb8'))[_0x5750('0x39')](_0x5750('0xb9'));}else{return _0x347bb4['status'](_0x4b349b)['json'](_0xf6f12b);}}});})[_0x5750('0x52')](handleError(_0x347bb4,null));};exports['send']=function(_0x21647c,_0x54cb16,_0x576771){var _0x288889,_0x811ed6,_0x2df290;if(_[_0x5750('0x9c')](_0x21647c['body'][_0x5750('0x60')])||_0x21647c[_0x5750('0x60')][_0x5750('0x60')]===''){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))](_0x5750('0x9d'));}if(_[_0x5750('0x9c')](_0x21647c[_0x5750('0x60')]['to'])){throw new db[(_0x5750('0x8e'))][(_0x5750('0x8f'))](_0x5750('0xba'));}_0x288889=_0x21647c[_0x5750('0x60')]['to'];return db[_0x5750('0x3c')][_0x5750('0x5c')]({'where':{'id':_0x21647c[_0x5750('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x5750('0xbb'),'include':[{'model':db[_0x5750('0x8d')],'as':_0x5750('0xa1'),'where':{'mobile':_0x288889},'limit':0x1,'order':[['updatedAt',_0x5750('0xbc')]]}]}]})[_0x5750('0x1e')](handleEntityNotFound(_0x54cb16,null))[_0x5750('0x1e')](function(_0x552d28){if(_0x552d28&&_0x552d28[_0x5750('0xbb')]){_0x811ed6=_0x552d28[_0x5750('0x58')]({'plain':!![]});if(_0x811ed6['List']&&_0x811ed6['List'][_0x5750('0xa1')]['length']){return _0x811ed6[_0x5750('0xbb')]['Contacts'][0x0];}return db[_0x5750('0x8d')][_0x5750('0x57')](_[_0x5750('0x17')](_0x21647c[_0x5750('0x60')],{'firstName':_0x288889,'mobile':_0x288889,'phone':_0x288889,'ListId':_0x811ed6[_0x5750('0x95')]}));}})[_0x5750('0x1e')](handleEntityNotFound(_0x54cb16,null))['then'](function(_0x49613f){if(_0x49613f){_0x2df290=_0x49613f;return db['WhatsappInteraction'][_0x5750('0x5c')]({'where':{'ContactId':_0x2df290['id'],'closed':![],'WhatsappAccountId':_0x811ed6['id']}})[_0x5750('0x1e')](function(_0x340228){if(_0x340228){return[_0x340228,![]];}return db[_0x5750('0xa4')][_0x5750('0x57')]({'UserId':_0x21647c[_0x5750('0x5b')]['id'],'ContactId':_0x2df290['id'],'WhatsappAccountId':_0x811ed6['id'],'phone':_0x288889,'firstMsgDirection':_0x5750('0xbd'),'Messages':[_[_0x5750('0x4d')](_0x21647c['body'],{'read':![],'body':_0x21647c[_0x5750('0x60')][_0x5750('0x60')],'phone':_0x288889,'WhatsappAccountId':_0x811ed6['id'],'UserId':_0x21647c['user']['id'],'ContactId':_0x2df290['id']})]},{'include':[{'model':db[_0x5750('0x86')],'as':_0x5750('0xbe')}]})[_0x5750('0x1e')](function(_0x11205d){return[_0x11205d,!![]];});});}})['spread'](function(_0x2d9325,_0x59aa4b){if(_0x59aa4b){return _0x2d9325;}return db[_0x5750('0x86')]['create'](_[_0x5750('0x4d')](_0x21647c[_0x5750('0x60')],{'read':![],'body':_0x21647c[_0x5750('0x60')][_0x5750('0x60')],'phone':_0x288889,'WhatsappAccountId':_0x811ed6['id'],'WhatsappInteractionId':_0x2d9325['id'],'UserId':_0x21647c[_0x5750('0x5b')]['id'],'ContactId':_0x2df290['id']}))['then'](function(_0x109700){_0x2d9325['dataValues'][_0x5750('0xbe')]=[];_0x2d9325['dataValues'][_0x5750('0xbe')][_0x5750('0xa8')](_0x109700[_0x5750('0xbf')]);return _0x2d9325;});})[_0x5750('0x1e')](respondWithResult(_0x54cb16,null))[_0x5750('0x52')](handleError(_0x54cb16,null));}; \ No newline at end of file +var _0x5919=['result','catch','status','end','offset','undefined','limit','count','set','json','apply','destroy','get','sendStatus','stack','name','index','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','filters','pick','VIRTUAL','filter','merge','options','where','includeAll','findAll','rows','show','params','Pause','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','nolimit','order','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','ISOLATION_LEVELS','WhatsappApplication','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','whatsapp:','Body','messageId','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','message','WhatsappAccount,\x20%s,\x20%s'];(function(_0x22245d,_0xc78fed){var _0x40df90=function(_0x2b58af){while(--_0x2b58af){_0x22245d['push'](_0x22245d['shift']());}};_0x40df90(++_0xc78fed);}(_0x5919,0x15d));var _0x9591=function(_0x3e9364,_0x4620e5){_0x3e9364=_0x3e9364-0x0;var _0xb837f1=_0x5919[_0x3e9364];return _0xb837f1;};'use strict';var emlformat=require(_0x9591('0x0'));var rimraf=require(_0x9591('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9591('0x2'));var rp=require(_0x9591('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9591('0x4'));var util=require(_0x9591('0x5'));var path=require(_0x9591('0x6'));var sox=require(_0x9591('0x7'));var csv=require(_0x9591('0x8'));var ejs=require(_0x9591('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9591('0xa'));var squel=require(_0x9591('0xb'));var crypto=require(_0x9591('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9591('0xd'));var toCsv=require(_0x9591('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9591('0xe'));var qs=require(_0x9591('0xf'));var as=require(_0x9591('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9591('0x11'));var utils=require(_0x9591('0x12'));var config=require(_0x9591('0x13'));var licenseUtil=require(_0x9591('0x14'));var db=require(_0x9591('0x15'))['db'];config[_0x9591('0x16')]=_['defaults'](config[_0x9591('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x9591('0x17')](socket);var jayson=require(_0x9591('0x18'));var client=jayson[_0x9591('0x19')][_0x9591('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x404ae6,_0x37257c,_0x427e89,_0x2725a2){return new BPromise(function(_0x455b14,_0x37363c){var _0x2b63c8=_0x2725a2||client;return _0x2b63c8[_0x9591('0x1b')](_0x404ae6,_0x427e89)[_0x9591('0x1c')](function(_0xec3462){logger[_0x9591('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0x37257c,_0x9591('0x1e'));logger[_0x9591('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x37257c,_0x9591('0x1e'),JSON['stringify'](_0xec3462));if(_0xec3462['error']){if(_0xec3462[_0x9591('0x20')]['code']===0x1f4){logger[_0x9591('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x37257c,_0xec3462[_0x9591('0x20')][_0x9591('0x21')]);return _0x37363c(_0xec3462[_0x9591('0x20')]['message']);}logger[_0x9591('0x20')](_0x9591('0x22'),_0x37257c,_0xec3462[_0x9591('0x20')]['message']);return _0x455b14(_0xec3462[_0x9591('0x20')]['message']);}else{logger['info'](_0x9591('0x22'),_0x37257c,_0x9591('0x1e'));_0x455b14(_0xec3462[_0x9591('0x23')][_0x9591('0x21')]);}})[_0x9591('0x24')](function(_0xaa1ed1){logger['error'](_0x9591('0x22'),_0x37257c,_0xaa1ed1);_0x37363c(_0xaa1ed1);});});}function respondWithStatusCode(_0x2b093a,_0x3d2af9){_0x3d2af9=_0x3d2af9||0xcc;return function(_0x49464c){if(_0x49464c){return _0x2b093a['sendStatus'](_0x3d2af9);}return _0x2b093a[_0x9591('0x25')](_0x3d2af9)[_0x9591('0x26')]();};}function respondWithResult(_0x16258c,_0xf198b0){_0xf198b0=_0xf198b0||0xc8;return function(_0x35fa58){if(_0x35fa58){return _0x16258c[_0x9591('0x25')](_0xf198b0)['json'](_0x35fa58);}};}function respondWithFilteredResult(_0x49ac73,_0x11592b){return function(_0xfbb60){if(_0xfbb60){var _0x566079=typeof _0x11592b[_0x9591('0x27')]===_0x9591('0x28')&&typeof _0x11592b[_0x9591('0x29')]===_0x9591('0x28');var _0x360c6f=_0xfbb60['count'];var _0x4562a7=_0x566079?0x0:_0x11592b[_0x9591('0x27')];var _0x14c77c=_0x566079?_0xfbb60[_0x9591('0x2a')]:_0x11592b[_0x9591('0x27')]+_0x11592b[_0x9591('0x29')];var _0x30ef88;if(_0x14c77c>=_0x360c6f){_0x14c77c=_0x360c6f;_0x30ef88=0xc8;}else{_0x30ef88=0xce;}_0x49ac73[_0x9591('0x25')](_0x30ef88);return _0x49ac73[_0x9591('0x2b')]('Content-Range',_0x4562a7+'-'+_0x14c77c+'/'+_0x360c6f)[_0x9591('0x2c')](_0xfbb60);}return null;};}function patchUpdates(_0x3eac34){return function(_0x3e0d1a){try{jsonpatch[_0x9591('0x2d')](_0x3e0d1a,_0x3eac34,!![]);}catch(_0x5f3caf){return BPromise['reject'](_0x5f3caf);}return _0x3e0d1a['save']();};}function saveUpdates(_0x2977d4,_0x47a8d2){return function(_0x577478){if(_0x577478){return _0x577478['update'](_0x2977d4)['then'](function(_0x4715c9){return _0x4715c9;});}return null;};}function removeEntity(_0x56c545,_0x2affeb){return function(_0x51f93f){if(_0x51f93f){return _0x51f93f[_0x9591('0x2e')]()['then'](function(){var _0x34f6d6=_0x51f93f[_0x9591('0x2f')]({'plain':!![]});var _0x7e4a1='WhatsappAccounts';return db['UserProfileResource'][_0x9591('0x2e')]({'where':{'type':_0x7e4a1,'resourceId':_0x34f6d6['id']}})['then'](function(){return _0x51f93f;});})['then'](function(){_0x56c545[_0x9591('0x25')](0xcc)[_0x9591('0x26')]();});}};}function handleEntityNotFound(_0x569dde,_0x348a24){return function(_0x39551b){if(!_0x39551b){_0x569dde[_0x9591('0x30')](0x194);}return _0x39551b;};}function handleError(_0x2b97af,_0x1058fa){_0x1058fa=_0x1058fa||0x1f4;return function(_0x3e65e3){logger[_0x9591('0x20')](_0x3e65e3[_0x9591('0x31')]);if(_0x3e65e3[_0x9591('0x32')]){delete _0x3e65e3[_0x9591('0x32')];}_0x2b97af[_0x9591('0x25')](_0x1058fa)['send'](_0x3e65e3);};}exports[_0x9591('0x33')]=function(_0x2b980f,_0x3edac3){var _0xc8f1f6={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x542262={},_0x194e15={'count':0x0,'rows':[]};var _0x42ad01=_[_0x9591('0x34')](db[_0x9591('0x35')][_0x9591('0x36')],function(_0x234412){return{'name':_0x234412[_0x9591('0x37')],'type':_0x234412[_0x9591('0x38')][_0x9591('0x39')]};});_0x542262['model']=_[_0x9591('0x34')](_0x42ad01,_0x9591('0x32'));_0x542262[_0x9591('0x3a')]=_['keys'](_0x2b980f['query']);_0x542262['filters']=_[_0x9591('0x3b')](_0x542262['model'],_0x542262['query']);_0xc8f1f6['attributes']=_[_0x9591('0x3b')](_0x542262[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x2b980f['query'][_0x9591('0x3d')]));_0xc8f1f6[_0x9591('0x3e')]=_0xc8f1f6[_0x9591('0x3e')][_0x9591('0x3f')]?_0xc8f1f6[_0x9591('0x3e')]:_0x542262[_0x9591('0x3c')];if(!_0x2b980f[_0x9591('0x3a')][_0x9591('0x40')]('nolimit')){_0xc8f1f6[_0x9591('0x29')]=qs[_0x9591('0x29')](_0x2b980f[_0x9591('0x3a')][_0x9591('0x29')]);_0xc8f1f6[_0x9591('0x27')]=qs[_0x9591('0x27')](_0x2b980f[_0x9591('0x3a')][_0x9591('0x27')]);}_0xc8f1f6['order']=qs['sort'](_0x2b980f[_0x9591('0x3a')][_0x9591('0x41')]);_0xc8f1f6['where']=qs[_0x9591('0x42')](_[_0x9591('0x43')](_0x2b980f['query'],_0x542262[_0x9591('0x42')]),_0x42ad01);if(_0x2b980f[_0x9591('0x3a')]['filter']){_0xc8f1f6['where']=_['merge'](_0xc8f1f6['where'],{'$or':_[_0x9591('0x34')](_0x42ad01,function(_0x3a7a9e){if(_0x3a7a9e[_0x9591('0x38')]!==_0x9591('0x44')){var _0x172d7e={};_0x172d7e[_0x3a7a9e['name']]={'$like':'%'+_0x2b980f[_0x9591('0x3a')][_0x9591('0x45')]+'%'};return _0x172d7e;}})});}_0xc8f1f6=_[_0x9591('0x46')]({},_0xc8f1f6,_0x2b980f[_0x9591('0x47')]);var _0x48756={'where':_0xc8f1f6[_0x9591('0x48')]};return db['WhatsappAccount'][_0x9591('0x2a')](_0x48756)[_0x9591('0x1c')](function(_0x48356b){_0x194e15[_0x9591('0x2a')]=_0x48356b;if(_0x2b980f['query'][_0x9591('0x49')]){_0xc8f1f6['include']=[{'all':!![]}];}return db[_0x9591('0x35')][_0x9591('0x4a')](_0xc8f1f6);})[_0x9591('0x1c')](function(_0x52a27e){_0x194e15[_0x9591('0x4b')]=_0x52a27e;return _0x194e15;})[_0x9591('0x1c')](respondWithFilteredResult(_0x3edac3,_0xc8f1f6))['catch'](handleError(_0x3edac3,null));};exports[_0x9591('0x4c')]=function(_0x33d4dc,_0x5b18f4){var _0x259271={'raw':![],'where':{'id':_0x33d4dc[_0x9591('0x4d')]['id']},'include':[{'model':db[_0x9591('0x4e')],'as':'mandatoryDispositionPause'}]},_0x1e53b7={};_0x1e53b7[_0x9591('0x3c')]=_[_0x9591('0x4f')](db[_0x9591('0x35')]['rawAttributes']);_0x1e53b7[_0x9591('0x3a')]=_['keys'](_0x33d4dc['query']);_0x1e53b7['filters']=_[_0x9591('0x3b')](_0x1e53b7['model'],_0x1e53b7['query']);_0x259271[_0x9591('0x3e')]=_[_0x9591('0x3b')](_0x1e53b7[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x33d4dc[_0x9591('0x3a')]['fields']));_0x259271[_0x9591('0x3e')]=_0x259271[_0x9591('0x3e')][_0x9591('0x3f')]?_0x259271[_0x9591('0x3e')]:_0x1e53b7[_0x9591('0x3c')];if(_0x33d4dc['query'][_0x9591('0x49')]){_0x259271[_0x9591('0x50')]=[{'all':!![]}];}_0x259271=_[_0x9591('0x46')]({},_0x259271,_0x33d4dc[_0x9591('0x47')]);return db['WhatsappAccount'][_0x9591('0x51')](_0x259271)[_0x9591('0x1c')](handleEntityNotFound(_0x5b18f4,null))[_0x9591('0x1c')](respondWithResult(_0x5b18f4,null))['catch'](handleError(_0x5b18f4,null));};exports[_0x9591('0x52')]=function(_0x4d1e04,_0x2456e3){return db[_0x9591('0x35')][_0x9591('0x52')](_0x4d1e04[_0x9591('0x53')],{})[_0x9591('0x1c')](function(_0x37e2c3){var _0x4f3867=_0x4d1e04[_0x9591('0x54')]['get']({'plain':!![]});if(!_0x4f3867)throw new Error(_0x9591('0x55'));if(_0x4f3867[_0x9591('0x56')]==='user'){var _0x4dd36b=_0x37e2c3['get']({'plain':!![]});var _0x304764=_0x9591('0x57');return db[_0x9591('0x58')][_0x9591('0x51')]({'where':{'name':_0x304764,'userProfileId':_0x4f3867[_0x9591('0x59')]},'raw':!![]})[_0x9591('0x1c')](function(_0x455f7e){if(_0x455f7e&&_0x455f7e['autoAssociation']===0x0){return db[_0x9591('0x5a')][_0x9591('0x52')]({'name':_0x4dd36b[_0x9591('0x32')],'resourceId':_0x4dd36b['id'],'type':_0x455f7e[_0x9591('0x32')],'sectionId':_0x455f7e['id']},{})[_0x9591('0x1c')](function(){return _0x37e2c3;});}else{return _0x37e2c3;}})[_0x9591('0x24')](function(_0x254cb3){logger['error'](_0x9591('0x5b'),_0x254cb3);throw _0x254cb3;});}return _0x37e2c3;})[_0x9591('0x1c')](respondWithResult(_0x2456e3,0xc9))[_0x9591('0x24')](handleError(_0x2456e3,null));};exports[_0x9591('0x5c')]=function(_0x20d5e0,_0xf3ca72){if(_0x20d5e0['body']['id']){delete _0x20d5e0[_0x9591('0x53')]['id'];}return db[_0x9591('0x35')]['find']({'where':{'id':_0x20d5e0[_0x9591('0x4d')]['id']},'include':[{'model':db[_0x9591('0x4e')],'as':_0x9591('0x5d')}]})[_0x9591('0x1c')](handleEntityNotFound(_0xf3ca72,null))[_0x9591('0x1c')](saveUpdates(_0x20d5e0['body'],null))['then'](respondWithResult(_0xf3ca72,null))['catch'](handleError(_0xf3ca72,null));};exports['destroy']=function(_0x5637f6,_0x9830e6){return db[_0x9591('0x35')]['find']({'where':{'id':_0x5637f6[_0x9591('0x4d')]['id']}})['then'](handleEntityNotFound(_0x9830e6,null))[_0x9591('0x1c')](removeEntity(_0x9830e6,null))['catch'](handleError(_0x9830e6,null));};exports[_0x9591('0x5e')]=function(_0xe6620d,_0x1aaa2a){return db[_0x9591('0x35')][_0x9591('0x5e')]()[_0x9591('0x1c')](respondWithResult(_0x1aaa2a,null))[_0x9591('0x24')](handleError(_0x1aaa2a,null));};exports[_0x9591('0x5f')]=function(_0x4a45b2,_0x130541,_0x48788e){if(_0x4a45b2['body']['id']){delete _0x4a45b2[_0x9591('0x53')]['id'];}return db[_0x9591('0x35')][_0x9591('0x51')]({'where':{'id':_0x4a45b2[_0x9591('0x4d')]['id']}})['then'](handleEntityNotFound(_0x130541,null))[_0x9591('0x1c')](function(_0x3a56e2){if(_0x3a56e2){_0x4a45b2[_0x9591('0x53')][_0x9591('0x60')]=_0x3a56e2['id'];return db['Disposition']['create'](_0x4a45b2[_0x9591('0x53')]);}})[_0x9591('0x1c')](respondWithResult(_0x130541,null))[_0x9591('0x24')](handleError(_0x130541,null));};exports[_0x9591('0x61')]=function(_0x48d91f,_0x11822c,_0x1c3e61){var _0x55098f={'raw':![],'where':{}};var _0x46fe86={};var _0x319993={'count':0x0,'rows':[]};return db[_0x9591('0x35')]['findOne']({'where':{'id':_0x48d91f['params']['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x11822c,null))[_0x9591('0x1c')](function(_0x3d404f){if(_0x3d404f){_0x46fe86['model']=_[_0x9591('0x4f')](db[_0x9591('0x62')][_0x9591('0x36')]);_0x46fe86[_0x9591('0x3a')]=_[_0x9591('0x4f')](_0x48d91f[_0x9591('0x3a')]);_0x46fe86['filters']=_[_0x9591('0x3b')](_0x46fe86[_0x9591('0x3c')],_0x46fe86[_0x9591('0x3a')]);_0x55098f[_0x9591('0x3e')]=_['intersection'](_0x46fe86[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x48d91f[_0x9591('0x3a')][_0x9591('0x3d')]));_0x55098f[_0x9591('0x3e')]=_0x55098f['attributes'][_0x9591('0x3f')]?_0x55098f['attributes']:_0x46fe86[_0x9591('0x3c')];if(!_0x48d91f[_0x9591('0x3a')][_0x9591('0x40')](_0x9591('0x63'))){_0x55098f[_0x9591('0x29')]=qs[_0x9591('0x29')](_0x48d91f[_0x9591('0x3a')]['limit']);_0x55098f['offset']=qs[_0x9591('0x27')](_0x48d91f[_0x9591('0x3a')][_0x9591('0x27')]);}_0x55098f[_0x9591('0x64')]=qs[_0x9591('0x41')](_0x48d91f[_0x9591('0x3a')][_0x9591('0x41')]);_0x55098f[_0x9591('0x48')]=qs['filters'](_[_0x9591('0x43')](_0x48d91f[_0x9591('0x3a')],_0x46fe86[_0x9591('0x42')]));_0x55098f['where'][_0x9591('0x60')]=_0x3d404f['id'];if(_0x48d91f[_0x9591('0x3a')][_0x9591('0x45')]){_0x55098f[_0x9591('0x48')]=_[_0x9591('0x46')](_0x55098f[_0x9591('0x48')],{'$or':_['map'](_0x55098f[_0x9591('0x3e')],function(_0x2edcbd){var _0x18cbfb={};_0x18cbfb[_0x2edcbd]={'$like':'%'+_0x48d91f['query'][_0x9591('0x45')]+'%'};return _0x18cbfb;})});}_0x55098f=_['merge']({},_0x55098f,_0x48d91f[_0x9591('0x47')]);return db['Disposition'][_0x9591('0x2a')]({'where':_0x55098f[_0x9591('0x48')]})[_0x9591('0x1c')](function(_0x53c7c0){_0x319993[_0x9591('0x2a')]=_0x53c7c0;if(_0x48d91f[_0x9591('0x3a')][_0x9591('0x49')]){_0x55098f[_0x9591('0x50')]=[{'all':!![]}];}return db[_0x9591('0x62')][_0x9591('0x4a')](_0x55098f);})['then'](function(_0x4530e4){_0x319993['rows']=_0x4530e4;return _0x319993;});}})[_0x9591('0x1c')](respondWithFilteredResult(_0x11822c,_0x55098f))[_0x9591('0x24')](handleError(_0x11822c,null));};exports[_0x9591('0x65')]=function(_0x1f5d8f,_0x3df3a2,_0x22ba72){return db['WhatsappAccount'][_0x9591('0x51')]({'where':{'id':_0x1f5d8f[_0x9591('0x4d')]['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x3df3a2,null))[_0x9591('0x1c')](function(_0x374083){if(_0x374083){return _0x374083[_0x9591('0x65')](_0x1f5d8f['query'][_0x9591('0x66')]);}})['then'](respondWithStatusCode(_0x3df3a2,null))[_0x9591('0x24')](handleError(_0x3df3a2,null));};exports[_0x9591('0x67')]=function(_0x1e0953,_0xbd025,_0x3ca676){if(_0x1e0953[_0x9591('0x53')]['id']){delete _0x1e0953[_0x9591('0x53')]['id'];}return db[_0x9591('0x35')][_0x9591('0x51')]({'where':{'id':_0x1e0953[_0x9591('0x4d')]['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0xbd025,null))[_0x9591('0x1c')](function(_0x1a9339){if(_0x1a9339){_0x1e0953[_0x9591('0x53')][_0x9591('0x60')]=_0x1a9339['id'];return db['CannedAnswer']['create'](_0x1e0953[_0x9591('0x53')]);}})[_0x9591('0x1c')](respondWithResult(_0xbd025,null))[_0x9591('0x24')](handleError(_0xbd025,null));};exports[_0x9591('0x68')]=function(_0x21981b,_0x3ba287,_0x56002b){var _0x4c9e2b={'raw':![],'where':{}};var _0x58b96a={};var _0x525167={'count':0x0,'rows':[]};return db[_0x9591('0x35')][_0x9591('0x69')]({'where':{'id':_0x21981b[_0x9591('0x4d')]['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x3ba287,null))[_0x9591('0x1c')](function(_0xb25a52){if(_0xb25a52){_0x58b96a[_0x9591('0x3c')]=_[_0x9591('0x4f')](db[_0x9591('0x6a')][_0x9591('0x36')]);_0x58b96a[_0x9591('0x3a')]=_[_0x9591('0x4f')](_0x21981b[_0x9591('0x3a')]);_0x58b96a[_0x9591('0x42')]=_['intersection'](_0x58b96a[_0x9591('0x3c')],_0x58b96a[_0x9591('0x3a')]);_0x4c9e2b[_0x9591('0x3e')]=_['intersection'](_0x58b96a[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x21981b['query'][_0x9591('0x3d')]));_0x4c9e2b[_0x9591('0x3e')]=_0x4c9e2b[_0x9591('0x3e')]['length']?_0x4c9e2b[_0x9591('0x3e')]:_0x58b96a[_0x9591('0x3c')];if(!_0x21981b['query'][_0x9591('0x40')](_0x9591('0x63'))){_0x4c9e2b[_0x9591('0x29')]=qs[_0x9591('0x29')](_0x21981b['query'][_0x9591('0x29')]);_0x4c9e2b[_0x9591('0x27')]=qs[_0x9591('0x27')](_0x21981b[_0x9591('0x3a')][_0x9591('0x27')]);}_0x4c9e2b[_0x9591('0x64')]=qs['sort'](_0x21981b[_0x9591('0x3a')][_0x9591('0x41')]);_0x4c9e2b[_0x9591('0x48')]=qs[_0x9591('0x42')](_['pick'](_0x21981b['query'],_0x58b96a[_0x9591('0x42')]));_0x4c9e2b[_0x9591('0x48')]['WhatsappAccountId']=_0xb25a52['id'];if(_0x21981b[_0x9591('0x3a')][_0x9591('0x45')]){_0x4c9e2b[_0x9591('0x48')]=_[_0x9591('0x46')](_0x4c9e2b[_0x9591('0x48')],{'$or':_[_0x9591('0x34')](_0x4c9e2b[_0x9591('0x3e')],function(_0x4f0f1d){var _0x286c44={};_0x286c44[_0x4f0f1d]={'$like':'%'+_0x21981b[_0x9591('0x3a')]['filter']+'%'};return _0x286c44;})});}_0x4c9e2b=_[_0x9591('0x46')]({},_0x4c9e2b,_0x21981b[_0x9591('0x47')]);return db['CannedAnswer']['count']({'where':_0x4c9e2b['where']})[_0x9591('0x1c')](function(_0x4ab100){_0x525167['count']=_0x4ab100;if(_0x21981b['query'][_0x9591('0x49')]){_0x4c9e2b[_0x9591('0x50')]=[{'all':!![]}];}return db[_0x9591('0x6a')][_0x9591('0x4a')](_0x4c9e2b);})[_0x9591('0x1c')](function(_0x1ced36){_0x525167['rows']=_0x1ced36;return _0x525167;});}})[_0x9591('0x1c')](respondWithFilteredResult(_0x3ba287,_0x4c9e2b))['catch'](handleError(_0x3ba287,null));};exports[_0x9591('0x6b')]=function(_0x9adf45,_0x42a1be,_0x4bc997){return db['WhatsappAccount'][_0x9591('0x51')]({'where':{'id':_0x9adf45['params']['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x42a1be,null))['then'](function(_0xcc9d47){if(_0xcc9d47){return _0xcc9d47[_0x9591('0x6b')](_0x9adf45[_0x9591('0x3a')][_0x9591('0x66')]);}})['then'](respondWithStatusCode(_0x42a1be,null))[_0x9591('0x24')](handleError(_0x42a1be,null));};exports[_0x9591('0x6c')]=function(_0x5050f6,_0x452e86,_0x2cea17){return db[_0x9591('0x35')][_0x9591('0x51')]({'where':{'id':_0x5050f6['params']['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x452e86,null))[_0x9591('0x1c')](function(_0xb6d50e){if(_0xb6d50e){return _0xb6d50e['addAgents'](_0x5050f6[_0x9591('0x53')][_0x9591('0x66')],_[_0x9591('0x6d')](_0x5050f6[_0x9591('0x53')],[_0x9591('0x66'),'id'])||{})[_0x9591('0x6e')](function(_0x1a2972){for(var _0x48b747=0x0;_0x48b747<_0x5050f6[_0x9591('0x53')][_0x9591('0x66')][_0x9591('0x3f')];_0x48b747+=0x1){socket[_0x9591('0x6f')](_0x9591('0x70'),{'UserId':Number(_0x5050f6[_0x9591('0x53')]['ids'][_0x48b747]),'WhatsappAccountId':Number(_0x5050f6['params']['id'])});}return _0x1a2972;});}})[_0x9591('0x1c')](respondWithResult(_0x452e86,null))['catch'](handleError(_0x452e86,null));};exports['removeAgents']=function(_0x24bee1,_0x58e17b,_0x355beb){return db['WhatsappAccount'][_0x9591('0x51')]({'where':{'id':_0x24bee1[_0x9591('0x4d')]['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x58e17b,null))[_0x9591('0x1c')](function(_0x79ba57){if(_0x79ba57){return _0x79ba57[_0x9591('0x71')](_0x24bee1['query'][_0x9591('0x66')])[_0x9591('0x1c')](function(){if(_[_0x9591('0x72')](_0x24bee1[_0x9591('0x3a')][_0x9591('0x66')])){for(var _0x57f722=0x0;_0x57f722<_0x24bee1['query'][_0x9591('0x66')][_0x9591('0x3f')];_0x57f722+=0x1){socket['emit'](_0x9591('0x73'),{'UserId':Number(_0x24bee1[_0x9591('0x3a')][_0x9591('0x66')][_0x57f722]),'WhatsappAccountId':Number(_0x24bee1[_0x9591('0x4d')]['id'])});}}else{socket[_0x9591('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x24bee1[_0x9591('0x3a')]['ids']),'WhatsappAccountId':Number(_0x24bee1[_0x9591('0x4d')]['id'])});}});}})[_0x9591('0x1c')](respondWithStatusCode(_0x58e17b,null))[_0x9591('0x24')](handleError(_0x58e17b,null));};exports[_0x9591('0x74')]=function(_0x528a6f,_0x22d19d,_0x19e3e0){var _0x1d240e={};var _0x2630f={};var _0x491944;var _0x1c2cc1;return db['WhatsappAccount'][_0x9591('0x69')]({'where':{'id':_0x528a6f['params']['id']}})[_0x9591('0x1c')](handleEntityNotFound(_0x22d19d,null))[_0x9591('0x1c')](function(_0x388d78){if(_0x388d78){_0x491944=_0x388d78;_0x2630f[_0x9591('0x3c')]=_[_0x9591('0x4f')](db[_0x9591('0x75')][_0x9591('0x36')]);_0x2630f[_0x9591('0x3a')]=_[_0x9591('0x4f')](_0x528a6f[_0x9591('0x3a')]);_0x2630f['filters']=_[_0x9591('0x3b')](_0x2630f[_0x9591('0x3c')],_0x2630f[_0x9591('0x3a')]);_0x1d240e[_0x9591('0x3e')]=_['intersection'](_0x2630f[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x528a6f[_0x9591('0x3a')][_0x9591('0x3d')]));_0x1d240e['attributes']=_0x1d240e[_0x9591('0x3e')][_0x9591('0x3f')]?_0x1d240e[_0x9591('0x3e')]:_0x2630f[_0x9591('0x3c')];_0x1d240e[_0x9591('0x64')]=qs[_0x9591('0x41')](_0x528a6f[_0x9591('0x3a')][_0x9591('0x41')]);_0x1d240e[_0x9591('0x48')]=qs['filters'](_['pick'](_0x528a6f[_0x9591('0x3a')],_0x2630f[_0x9591('0x42')]));if(_0x528a6f[_0x9591('0x3a')][_0x9591('0x45')]){_0x1d240e[_0x9591('0x48')]=_[_0x9591('0x46')](_0x1d240e['where'],{'$or':_[_0x9591('0x34')](_0x1d240e[_0x9591('0x3e')],function(_0x34173b){var _0x46e25c={};_0x46e25c[_0x34173b]={'$like':'%'+_0x528a6f[_0x9591('0x3a')]['filter']+'%'};return _0x46e25c;})});}_0x1d240e=_[_0x9591('0x46')]({},_0x1d240e,_0x528a6f[_0x9591('0x47')]);return _0x491944[_0x9591('0x74')](_0x1d240e);}})['then'](function(_0xef1353){if(_0xef1353){_0x1c2cc1=_0xef1353[_0x9591('0x3f')];if(!_0x528a6f[_0x9591('0x3a')][_0x9591('0x40')](_0x9591('0x63'))){_0x1d240e[_0x9591('0x29')]=qs['limit'](_0x528a6f[_0x9591('0x3a')][_0x9591('0x29')]);_0x1d240e[_0x9591('0x27')]=qs[_0x9591('0x27')](_0x528a6f[_0x9591('0x3a')][_0x9591('0x27')]);}return _0x491944[_0x9591('0x74')](_0x1d240e);}})[_0x9591('0x1c')](function(_0x552ecf){if(_0x552ecf){return _0x552ecf?{'count':_0x1c2cc1,'rows':_0x552ecf}:null;}})[_0x9591('0x1c')](respondWithResult(_0x22d19d,null))[_0x9591('0x24')](handleError(_0x22d19d,null));};exports['addApplications']=function(_0x2a595c,_0x14120d){var _0x32c8a6=_0x2a595c['params']['id'];var _0x5eb33e=_0x2a595c[_0x9591('0x53')];var _0x165a8d=0xc8;var _0x12c681=null;return db[_0x9591('0x76')]['transaction']({'isolationLevel':db[_0x9591('0x76')]['Transaction'][_0x9591('0x77')]['READ_COMMITTED']},function(_0x119eaa){return db[_0x9591('0x35')][_0x9591('0x69')]({'where':{'id':_0x32c8a6},'transaction':_0x119eaa})[_0x9591('0x1c')](function(_0x534733){if(_0x534733){return db[_0x9591('0x78')][_0x9591('0x2e')]({'where':{'WhatsappAccountId':_0x32c8a6},'transaction':_0x119eaa})[_0x9591('0x1c')](function(){var _0x491965=_[_0x9591('0x34')](_0x5eb33e,function(_0x3e9b93){_0x3e9b93[_0x9591('0x60')]=_0x32c8a6;return _0x3e9b93;});return db['WhatsappApplication']['bulkCreate'](_0x491965,{'transaction':_0x119eaa});});}else{_0x165a8d=0x194;_0x12c681=[];}});})['then'](function(){if(_0x165a8d!==0x194){return db[_0x9591('0x78')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x32c8a6},'order':_0x9591('0x79')})[_0x9591('0x1c')](function(_0x2a214f){_0x12c681=_0x2a214f;});}})[_0x9591('0x24')](function(_0x2fa470){_0x165a8d=0x1f4;logger[_0x9591('0x20')](_0x2fa470[_0x9591('0x31')]);if(_0x2fa470[_0x9591('0x32')]){delete _0x2fa470['name'];}_0x12c681=_0x2fa470;})[_0x9591('0x7a')](function(){if(_0x12c681===null){_0x14120d[_0x9591('0x30')](_0x165a8d);}else{if(_0x165a8d===0x1f4){_0x14120d[_0x9591('0x25')](_0x165a8d)[_0x9591('0x7b')](_0x12c681);}else{_0x14120d[_0x9591('0x25')](_0x165a8d)['json'](_0x12c681);}}});};exports[_0x9591('0x7c')]=function(_0x37c3ae,_0x332825,_0x13437d){var _0x730b22={};var _0x156c30={};var _0x5c96a0;var _0x220492;return db['WhatsappAccount'][_0x9591('0x69')]({'where':{'id':_0x37c3ae[_0x9591('0x4d')]['id']}})['then'](handleEntityNotFound(_0x332825,null))[_0x9591('0x1c')](function(_0x5d39f9){if(_0x5d39f9){_0x5c96a0=_0x5d39f9;_0x156c30[_0x9591('0x3c')]=_[_0x9591('0x4f')](db['WhatsappApplication'][_0x9591('0x36')]);_0x156c30['query']=_['keys'](_0x37c3ae[_0x9591('0x3a')]);_0x156c30['filters']=_[_0x9591('0x3b')](_0x156c30[_0x9591('0x3c')],_0x156c30[_0x9591('0x3a')]);_0x730b22[_0x9591('0x3e')]=_[_0x9591('0x3b')](_0x156c30[_0x9591('0x3c')],qs[_0x9591('0x3d')](_0x37c3ae[_0x9591('0x3a')][_0x9591('0x3d')]));_0x730b22[_0x9591('0x3e')]=_0x730b22['attributes'][_0x9591('0x3f')]?_0x730b22[_0x9591('0x3e')]:_0x156c30[_0x9591('0x3c')];_0x730b22['order']=qs[_0x9591('0x41')](_0x37c3ae[_0x9591('0x3a')][_0x9591('0x41')]);_0x730b22['where']=qs[_0x9591('0x42')](_[_0x9591('0x43')](_0x37c3ae[_0x9591('0x3a')],_0x156c30['filters']));if(_0x37c3ae['query'][_0x9591('0x45')]){_0x730b22[_0x9591('0x48')]=_['merge'](_0x730b22[_0x9591('0x48')],{'$or':_['map'](_0x730b22[_0x9591('0x3e')],function(_0x5f0093){var _0xbfa407={};_0xbfa407[_0x5f0093]={'$like':'%'+_0x37c3ae[_0x9591('0x3a')][_0x9591('0x45')]+'%'};return _0xbfa407;})});}_0x730b22=_['merge']({},_0x730b22,_0x37c3ae[_0x9591('0x47')]);return _0x5c96a0[_0x9591('0x7c')](_0x730b22);}})['then'](function(_0x560e08){if(_0x560e08){_0x220492=_0x560e08[_0x9591('0x3f')];if(!_0x37c3ae[_0x9591('0x3a')][_0x9591('0x40')](_0x9591('0x63'))){_0x730b22[_0x9591('0x29')]=qs[_0x9591('0x29')](_0x37c3ae[_0x9591('0x3a')][_0x9591('0x29')]);_0x730b22[_0x9591('0x27')]=qs[_0x9591('0x27')](_0x37c3ae[_0x9591('0x3a')][_0x9591('0x27')]);}return _0x5c96a0[_0x9591('0x7c')](_0x730b22);}})[_0x9591('0x1c')](function(_0x1fce37){if(_0x1fce37){return _0x1fce37?{'count':_0x220492,'rows':_0x1fce37}:null;}})['then'](respondWithResult(_0x332825,null))[_0x9591('0x24')](handleError(_0x332825,null));};exports[_0x9591('0x7d')]=function(_0x46afbc,_0x3e65a4,_0x45fbf6){var _0x2a9d30={'channel':_0x9591('0x7e')};var _0x5a6372=[];var _0x436b24=[];var _0x1587db={};return db[_0x9591('0x35')]['find']({'where':{'id':_0x46afbc[_0x9591('0x4d')]['id']},'include':[{'model':db[_0x9591('0x78')],'as':_0x9591('0x7f')}]})[_0x9591('0x1c')](handleEntityNotFound(_0x3e65a4,null))['then'](function(_0x2b9e87){_0x2a9d30['account']=_0x2b9e87;if(_0x2a9d30[_0x9591('0x80')]&&_0x2a9d30[_0x9591('0x80')][_0x9591('0x38')]===_0x9591('0x81')&&_0x46afbc['body']['statuses']){if(_0x46afbc[_0x9591('0x53')][_0x9591('0x82')][_0x9591('0x3f')]===0x0)return;if(_0x46afbc['body'][_0x9591('0x82')][0x0][_0x9591('0x83')]!==_0x9591('0x84'))return;return db[_0x9591('0x85')]['update']({'read':!![],'readAt':_0x46afbc[_0x9591('0x53')][_0x9591('0x82')][0x0][_0x9591('0x86')]},{'where':{'messageId':_0x46afbc[_0x9591('0x53')][_0x9591('0x82')][0x0][_0x9591('0x87')]},'individualHooks':!![]})[_0x9591('0x1c')](function(_0x2b4db8){return _0x3e65a4[_0x9591('0x25')](0xc8)[_0x9591('0x2c')](_0x2b4db8);});}_0x2a9d30[_0x9591('0x88')]=_[_0x9591('0x89')](_0x2b9e87['Applications'],[_0x9591('0x79')],[_0x9591('0x8a')]);if(_0x2a9d30[_0x9591('0x80')][_0x9591('0x7f')]){delete _0x2a9d30[_0x9591('0x80')][_0x9591('0x7f')];}return db['CmContact'][_0x9591('0x5e')]()[_0x9591('0x1c')](function(_0x5de578){if(!_0x5de578){throw new db[(_0x9591('0x8b'))][(_0x9591('0x8c'))]('no\x20available\x20attributes');}_0x5a6372=_[_0x9591('0x8d')](_[_0x9591('0x4f')](_0x5de578),['createdAt',_0x9591('0x8e')]);_0x436b24=_['difference'](_[_0x9591('0x4f')](_0x5de578),[_0x9591('0x8f'),_0x9591('0x8e'),_0x9591('0x90'),_0x9591('0x91')]);_0x2a9d30[_0x9591('0x53')]={'mapKey':_0x9591('0x92')};if(_0x2a9d30['account']&&_0x2a9d30[_0x9591('0x80')][_0x9591('0x38')]==='twilio'){_0x2a9d30[_0x9591('0x53')][_0x9591('0x93')]=_0x46afbc[_0x9591('0x53')]['From']['replace'](_0x9591('0x94'),'');_0x2a9d30[_0x9591('0x53')][_0x9591('0x53')]=_0x46afbc[_0x9591('0x53')][_0x9591('0x95')];_0x2a9d30[_0x9591('0x53')][_0x9591('0x96')]=_0x46afbc[_0x9591('0x53')]['MessageSid'];}if(_0x2a9d30[_0x9591('0x80')]&&_0x2a9d30[_0x9591('0x80')][_0x9591('0x38')]===_0x9591('0x81')){_0x2a9d30[_0x9591('0x53')]['from']=_0x46afbc[_0x9591('0x53')]['notifications'][0x0][_0x9591('0x93')];_0x2a9d30[_0x9591('0x53')][_0x9591('0x53')]=_0x46afbc[_0x9591('0x53')][_0x9591('0x97')][0x0][_0x9591('0x21')][_0x9591('0x53')];_0x2a9d30[_0x9591('0x53')]['messageId']=_0x46afbc['body'][_0x9591('0x97')][0x0][_0x9591('0x87')];}if(_0x2a9d30[_0x9591('0x53')]['id']){delete _0x2a9d30['body']['id'];}if(_[_0x9591('0x98')](_0x2a9d30[_0x9591('0x53')]['from'])){throw new db[(_0x9591('0x8b'))][(_0x9591('0x8c'))](_0x9591('0x99'));}if(_[_0x9591('0x98')](_0x2a9d30[_0x9591('0x53')][_0x9591('0x53')])||_0x2a9d30[_0x9591('0x53')][_0x9591('0x53')]===''){throw new db['Sequelize'][(_0x9591('0x8c'))](_0x9591('0x9a'));}if(_['isNil'](_0x2a9d30[_0x9591('0x53')][_0x9591('0x9b')])){throw new db[(_0x9591('0x8b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x436b24);}if(!_[_0x9591('0x9c')](_0x436b24,_0x2a9d30['body'][_0x9591('0x9b')])){throw new db[(_0x9591('0x8b'))][(_0x9591('0x8c'))](_0x9591('0x9d')+_0x436b24);}_0x1587db[_0x2a9d30['body'][_0x9591('0x9b')]]=_0x2a9d30[_0x9591('0x53')]['from'];return db[_0x9591('0x9e')][_0x9591('0x51')]({'where':{'id':_0x2a9d30[_0x9591('0x80')][_0x9591('0x91')]},'include':[{'model':db[_0x9591('0x9f')],'as':_0x9591('0xa0'),'where':_0x1587db,'limit':0x1,'order':[[_0x9591('0x8e'),_0x9591('0xa1')]]}]});})[_0x9591('0x1c')](handleEntityNotFound(_0x3e65a4,null))[_0x9591('0x1c')](function(_0x597b1e){if(_0x597b1e){_0x2a9d30['list']=_[_0x9591('0x6d')](_0x597b1e,[_0x9591('0xa0')]);if(_0x597b1e[_0x9591('0xa0')][_0x9591('0x3f')]){return _0x597b1e[_0x9591('0xa0')][0x0];}var _0x51ea76=_[_0x9591('0xa2')](_0x2a9d30[_0x9591('0x53')],{'firstName':_0x2a9d30[_0x9591('0x53')][_0x9591('0x93')],'ListId':_0x597b1e['id']});_0x51ea76[_0x2a9d30[_0x9591('0x53')][_0x9591('0x9b')]]=_0x2a9d30[_0x9591('0x53')]['from'];return db[_0x9591('0x9f')][_0x9591('0x52')](_0x51ea76,{'fields':_0x5a6372,'raw':!![]});}})[_0x9591('0x1c')](handleEntityNotFound(_0x3e65a4,null))['then'](function(_0x2cfcf7){if(_0x2cfcf7){_0x2a9d30[_0x9591('0xa3')]=_0x2cfcf7;var _0x99f52d={'ContactId':_0x2cfcf7['id'],'phone':_0x2a9d30[_0x9591('0x53')][_0x9591('0x93')],'WhatsappAccountId':_0x46afbc['params']['id']};var _0x4db522={'ContactId':_0x2cfcf7['id'],'WhatsappAccountId':_0x46afbc[_0x9591('0x4d')]['id'],'closed':![]};return db[_0x9591('0xa4')][_0x9591('0x51')]({'where':_0x4db522})[_0x9591('0x1c')](function(_0x2a9d92){if(_0x2a9d92){return[_0x2a9d92,![]];}return db[_0x9591('0xa4')]['create'](_0x99f52d)[_0x9591('0x1c')](function(_0x265004){return[_0x265004,!![]];});});}})['spread'](function(_0x1cf240,_0x4b8def){_0x2a9d30[_0x9591('0xa5')]=_0x1cf240[_0x9591('0x2f')]({'plain':!![]});_0x2a9d30['interaction']['created']=![];if(_0x4b8def){if(_0x2a9d30['account'][_0x9591('0xa6')]){_0x2a9d30[_0x9591('0x88')][_0x9591('0xa7')]({'id':0x0,'priority':_0x2a9d30['applications']['length']+0x1,'app':_0x9591('0xa8'),'appdata':_0x9591('0xa9'),'interval':'*,*,*,*'});}_0x2a9d30[_0x9591('0xa5')][_0x9591('0xaa')]=!![];}return db[_0x9591('0x85')][_0x9591('0x52')]({'phone':_0x2a9d30['body'][_0x9591('0x93')],'messageId':_0x2a9d30[_0x9591('0x53')]['messageId'],'body':_0x2a9d30[_0x9591('0x53')][_0x9591('0x53')],'WhatsappAccountId':_0x46afbc[_0x9591('0x4d')]['id'],'WhatsappInteractionId':_0x1cf240['id'],'direction':'in','ContactId':_0x1cf240[_0x9591('0xab')],'AttachmentId':_0x2a9d30[_0x9591('0x53')][_0x9591('0xac')]});})[_0x9591('0x1c')](function(_0x55cae2){_0x2a9d30[_0x9591('0x21')]=_0x55cae2;if(!_0x2a9d30['interaction'][_0x9591('0xad')])return;return db['User'][_0x9591('0x51')]({'attributes':['id',_0x9591('0x32')],'where':{'id':_0x2a9d30[_0x9591('0xa5')]['UserId']}});})[_0x9591('0x1c')](function(_0x1eecd6){if(_0x1eecd6){_0x2a9d30[_0x9591('0x88')][_0x9591('0xae')]({'id':0x0,'priority':0x0,'app':_0x9591('0xaf'),'appdata':_0x1eecd6[_0x9591('0x32')]+','+(_0x2a9d30['account'][_0x9591('0xb0')]||0xa),'interval':_0x9591('0xb1')});}if(!_0x2a9d30[_0x9591('0xa5')]['queueId'])return;return db['WhatsappQueue'][_0x9591('0x51')]({'attributes':['id','name'],'where':{'id':_0x2a9d30[_0x9591('0xa5')][_0x9591('0xb2')]}});})['then'](function(_0x1819fa){if(_0x1819fa){_0x2a9d30[_0x9591('0x88')][_0x9591('0xae')]({'id':0x0,'priority':0x1,'app':_0x9591('0xb3'),'appdata':_0x1819fa[_0x9591('0x32')]+','+(_0x2a9d30[_0x9591('0x80')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9591('0xb4'),_0x9591('0xb5'),_0x2a9d30);})[_0x9591('0x1c')](function(_0x1e2d0f){if(_0x1e2d0f){var _0x285a21=0xc8;var _0x111a73='receiveMessage';logger[_0x9591('0x1d')](_0x9591('0xb6'),_0x111a73,_0x285a21,_0x9591('0xb7'));logger[_0x9591('0x1f')](_0x9591('0xb8'),_0x111a73,_0x285a21,'entity\x20found',JSON['stringify'](_0x1e2d0f));if(_0x2a9d30[_0x9591('0x80')][_0x9591('0x38')]===_0x9591('0xb9')){return _0x3e65a4[_0x9591('0x25')](_0x285a21)[_0x9591('0x2b')](_0x9591('0xba'),_0x9591('0xbb'))['send']('\x0a');}else{return _0x3e65a4[_0x9591('0x25')](_0x285a21)[_0x9591('0x2c')](_0x1e2d0f);}}});})['catch'](handleError(_0x3e65a4,null));};exports[_0x9591('0x7b')]=function(_0x4c6968,_0x456049,_0x1be92e){var _0x5379e8,_0xea04ae,_0x51ce00;if(_[_0x9591('0x98')](_0x4c6968['body'][_0x9591('0x53')])||_0x4c6968[_0x9591('0x53')][_0x9591('0x53')]===''){throw new db[(_0x9591('0x8b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4c6968[_0x9591('0x53')]['to'])){throw new db[(_0x9591('0x8b'))]['ValidationError'](_0x9591('0xbc'));}_0x5379e8=_0x4c6968[_0x9591('0x53')]['to'];return db[_0x9591('0x35')][_0x9591('0x51')]({'where':{'id':_0x4c6968[_0x9591('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0x9591('0xbd'),'include':[{'model':db['CmContact'],'as':_0x9591('0xa0'),'where':{'mobile':_0x5379e8},'limit':0x1,'order':[[_0x9591('0x8e'),_0x9591('0xa1')]]}]}]})[_0x9591('0x1c')](handleEntityNotFound(_0x456049,null))['then'](function(_0x26e395){if(_0x26e395&&_0x26e395[_0x9591('0xbd')]){_0xea04ae=_0x26e395[_0x9591('0x2f')]({'plain':!![]});if(_0xea04ae[_0x9591('0xbd')]&&_0xea04ae[_0x9591('0xbd')][_0x9591('0xa0')][_0x9591('0x3f')]){return _0xea04ae[_0x9591('0xbd')][_0x9591('0xa0')][0x0];}return db[_0x9591('0x9f')][_0x9591('0x52')](_[_0x9591('0xa2')](_0x4c6968[_0x9591('0x53')],{'firstName':_0x5379e8,'mobile':_0x5379e8,'phone':_0x5379e8,'ListId':_0xea04ae[_0x9591('0x91')]}));}})[_0x9591('0x1c')](handleEntityNotFound(_0x456049,null))[_0x9591('0x1c')](function(_0xa6f2cf){if(_0xa6f2cf){_0x51ce00=_0xa6f2cf;return db[_0x9591('0xa4')]['find']({'where':{'ContactId':_0x51ce00['id'],'closed':![],'WhatsappAccountId':_0xea04ae['id']}})['then'](function(_0x287885){if(_0x287885){return[_0x287885,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x4c6968[_0x9591('0x54')]['id'],'ContactId':_0x51ce00['id'],'WhatsappAccountId':_0xea04ae['id'],'phone':_0x5379e8,'firstMsgDirection':'out','Messages':[_[_0x9591('0x46')](_0x4c6968['body'],{'read':![],'body':_0x4c6968[_0x9591('0x53')]['body'],'phone':_0x5379e8,'WhatsappAccountId':_0xea04ae['id'],'UserId':_0x4c6968[_0x9591('0x54')]['id'],'ContactId':_0x51ce00['id']})]},{'include':[{'model':db[_0x9591('0x85')],'as':_0x9591('0xbe')}]})['then'](function(_0x38a47a){return[_0x38a47a,!![]];});});}})[_0x9591('0x6e')](function(_0x10fdcf,_0x1632f0){if(_0x1632f0){return _0x10fdcf;}return db[_0x9591('0x85')][_0x9591('0x52')](_['merge'](_0x4c6968['body'],{'read':![],'body':_0x4c6968[_0x9591('0x53')][_0x9591('0x53')],'phone':_0x5379e8,'WhatsappAccountId':_0xea04ae['id'],'WhatsappInteractionId':_0x10fdcf['id'],'UserId':_0x4c6968[_0x9591('0x54')]['id'],'ContactId':_0x51ce00['id']}))[_0x9591('0x1c')](function(_0xf90766){_0x10fdcf[_0x9591('0xbf')][_0x9591('0xbe')]=[];_0x10fdcf[_0x9591('0xbf')][_0x9591('0xbe')][_0x9591('0xa7')](_0xf90766['dataValues']);return _0x10fdcf;});})[_0x9591('0x1c')](respondWithResult(_0x456049,null))['catch'](handleError(_0x456049,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 77d55eb..1735905 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 _0x7777=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7777,0xf6));var _0x7777=function(_0x5864ef,_0x496812){_0x5864ef=_0x5864ef-0x0;var _0x21c244=_0x7777[_0x5864ef];return _0x21c244;};'use strict';var EventEmitter=require(_0x7777('0x0'));var WhatsappAccount=require(_0x7777('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7777('0x2')](0x0);var events={'afterCreate':_0x7777('0x3'),'afterUpdate':_0x7777('0x4'),'afterDestroy':'remove'};function emitEvent(_0x496184){return function(_0x1fdb47,_0x2f6947,_0x2841ea){WhatsappAccountEvents[_0x7777('0x5')](_0x496184+':'+_0x1fdb47['id'],_0x1fdb47);WhatsappAccountEvents['emit'](_0x496184,_0x1fdb47);_0x2841ea(null);};}for(var e in events){if(events[_0x7777('0x6')](e)){var event=events[e];WhatsappAccount[_0x7777('0x7')](e,emitEvent(event));}}module[_0x7777('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xaf16=['update','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x21df45,_0x4e3d89){var _0x40adc0=function(_0x4fd694){while(--_0x4fd694){_0x21df45['push'](_0x21df45['shift']());}};_0x40adc0(++_0x4e3d89);}(_0xaf16,0x14b));var _0x6af1=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xaf16[_0x5235dd];return _0x13059d;};'use strict';var EventEmitter=require(_0x6af1('0x0'));var WhatsappAccount=require(_0x6af1('0x1'))['db'][_0x6af1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6af1('0x3')](0x0);var events={'afterCreate':_0x6af1('0x4'),'afterUpdate':_0x6af1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x111bd5){return function(_0x2bb111,_0x4d2512,_0x4e597b){WhatsappAccountEvents[_0x6af1('0x6')](_0x111bd5+':'+_0x2bb111['id'],_0x2bb111);WhatsappAccountEvents[_0x6af1('0x6')](_0x111bd5,_0x2bb111);_0x4e597b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x6af1('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index bd9be92..3983ea6 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 _0xecf8=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','moment'];(function(_0x5a20ae,_0x2c373c){var _0x12b91f=function(_0x1fd80a){while(--_0x1fd80a){_0x5a20ae['push'](_0x5a20ae['shift']());}};_0x12b91f(++_0x2c373c);}(_0xecf8,0x1ec));var _0x8ecf=function(_0x4423b2,_0xb81844){_0x4423b2=_0x4423b2-0x0;var _0x470780=_0xecf8[_0x4423b2];return _0x470780;};'use strict';var _=require(_0x8ecf('0x0'));var util=require(_0x8ecf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8ecf('0x2'));var BPromise=require(_0x8ecf('0x3'));var rp=require(_0x8ecf('0x4'));var fs=require('fs');var path=require(_0x8ecf('0x5'));var rimraf=require(_0x8ecf('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ecf('0x7'));module['exports']=function(_0x283c55,_0x796ec5){return _0x283c55[_0x8ecf('0x8')](_0x8ecf('0x9'),attributes,{'tableName':_0x8ecf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x955e=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1a4276,_0x6b9c22){var _0x4da8d6=function(_0x365ea9){while(--_0x365ea9){_0x1a4276['push'](_0x1a4276['shift']());}};_0x4da8d6(++_0x6b9c22);}(_0x955e,0x149));var _0xe955=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0x955e[_0x10a212];return _0x23c82b;};'use strict';var _=require(_0xe955('0x0'));var util=require(_0xe955('0x1'));var logger=require(_0xe955('0x2'))(_0xe955('0x3'));var moment=require(_0xe955('0x4'));var BPromise=require(_0xe955('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe955('0x6'));var rimraf=require(_0xe955('0x7'));var config=require(_0xe955('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xe955('0x9')]=function(_0x3627aa,_0x3d5aa0){return _0x3627aa[_0xe955('0xa')](_0xe955('0xb'),attributes,{'tableName':_0xe955('0xc'),'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 4cc271c..90cd41c 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 _0xb5e1=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','map','include','model','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b2b70,_0x4f6974){var _0x53332e=function(_0x316c1d){while(--_0x316c1d){_0x5b2b70['push'](_0x5b2b70['shift']());}};_0x53332e(++_0x4f6974);}(_0xb5e1,0x18f));var _0x1b5e=function(_0x4cb1a0,_0x210227){_0x4cb1a0=_0x4cb1a0-0x0;var _0x498c9c=_0xb5e1[_0x4cb1a0];return _0x498c9c;};'use strict';var _=require(_0x1b5e('0x0'));var util=require(_0x1b5e('0x1'));var moment=require(_0x1b5e('0x2'));var BPromise=require(_0x1b5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b5e('0x4'))['db'];var utils=require(_0x1b5e('0x5'));var logger=require(_0x1b5e('0x6'))(_0x1b5e('0x7'));var config=require(_0x1b5e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b5e('0x9')]['http']({'port':0x232a});config[_0x1b5e('0xa')]=_[_0x1b5e('0xb')](config[_0x1b5e('0xa')],{'host':_0x1b5e('0xc'),'port':0x18eb});var socket=require(_0x1b5e('0xd'))(new Redis(config[_0x1b5e('0xa')]));require(_0x1b5e('0xe'))[_0x1b5e('0xf')](socket);function respondWithRpcPromise(_0x5d4ea5,_0x4b9b53,_0x434631){return new BPromise(function(_0x34c103,_0x5bc6c4){return client['request'](_0x5d4ea5,_0x434631)[_0x1b5e('0x10')](function(_0x59bb47){logger[_0x1b5e('0x11')](_0x1b5e('0x12'),_0x4b9b53,_0x1b5e('0x13'));logger['debug'](_0x1b5e('0x14'),_0x4b9b53,_0x1b5e('0x13'),JSON['stringify'](_0x59bb47));if(_0x59bb47['error']){if(_0x59bb47[_0x1b5e('0x15')][_0x1b5e('0x16')]===0x1f4){logger[_0x1b5e('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x4b9b53,_0x59bb47['error'][_0x1b5e('0x17')]);return _0x5bc6c4(_0x59bb47[_0x1b5e('0x15')][_0x1b5e('0x17')]);}logger[_0x1b5e('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x4b9b53,_0x59bb47['error'][_0x1b5e('0x17')]);return _0x34c103(_0x59bb47[_0x1b5e('0x15')][_0x1b5e('0x17')]);}else{logger[_0x1b5e('0x11')](_0x1b5e('0x12'),_0x4b9b53,'request\x20sent');_0x34c103(_0x59bb47[_0x1b5e('0x18')][_0x1b5e('0x17')]);}})[_0x1b5e('0x19')](function(_0x43ffbe){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4b9b53,_0x43ffbe);_0x5bc6c4(_0x43ffbe);});});}exports[_0x1b5e('0x1a')]=function(_0x224a2a){var _0x5d7e1f=this;return new Promise(function(_0x446c49,_0x57b4c0){return db['WhatsappAccount'][_0x1b5e('0x1b')]({'raw':_0x224a2a[_0x1b5e('0x1c')]?_0x224a2a['options'][_0x1b5e('0x1d')]===undefined?!![]:![]:!![],'where':_0x224a2a['options']?_0x224a2a[_0x1b5e('0x1c')][_0x1b5e('0x1e')]||null:null,'attributes':_0x224a2a[_0x1b5e('0x1c')]?_0x224a2a[_0x1b5e('0x1c')][_0x1b5e('0x1f')]||null:null,'include':_0x224a2a['options']?_0x224a2a[_0x1b5e('0x1c')]['include']?_[_0x1b5e('0x20')](_0x224a2a[_0x1b5e('0x1c')][_0x1b5e('0x21')],function(_0x2db9c1){return{'model':db[_0x2db9c1[_0x1b5e('0x22')]],'as':_0x2db9c1['as'],'attributes':_0x2db9c1[_0x1b5e('0x1f')],'include':_0x2db9c1[_0x1b5e('0x21')]?_[_0x1b5e('0x20')](_0x2db9c1[_0x1b5e('0x21')],function(_0x33e8db){return{'model':db[_0x33e8db[_0x1b5e('0x22')]],'as':_0x33e8db['as'],'attributes':_0x33e8db[_0x1b5e('0x1f')],'include':_0x33e8db[_0x1b5e('0x21')]?_['map'](_0x33e8db['include'],function(_0x19d11e){return{'model':db[_0x19d11e[_0x1b5e('0x22')]],'as':_0x19d11e['as'],'attributes':_0x19d11e[_0x1b5e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5131ff){logger[_0x1b5e('0x11')]('ShowWhatsappAccount',_0x224a2a);logger[_0x1b5e('0x23')](_0x1b5e('0x1a'),_0x224a2a,JSON[_0x1b5e('0x24')](_0x5131ff));_0x446c49(_0x5131ff);})[_0x1b5e('0x19')](function(_0x5ab354){logger['error']('ShowWhatsappAccount',_0x5ab354[_0x1b5e('0x17')],_0x224a2a);_0x57b4c0(_0x5d7e1f['error'](0x1f4,_0x5ab354[_0x1b5e('0x17')]));});});}; \ No newline at end of file +var _0x528c=['defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0x528c,0x65));var _0xc528=function(_0x1209cb,_0x1491d3){_0x1209cb=_0x1209cb-0x0;var _0x8badb8=_0x528c[_0x1209cb];return _0x8badb8;};'use strict';var _=require(_0xc528('0x0'));var util=require(_0xc528('0x1'));var moment=require(_0xc528('0x2'));var BPromise=require(_0xc528('0x3'));var rs=require(_0xc528('0x4'));var fs=require('fs');var Redis=require(_0xc528('0x5'));var db=require(_0xc528('0x6'))['db'];var utils=require(_0xc528('0x7'));var logger=require(_0xc528('0x8'))(_0xc528('0x9'));var config=require('../../config/environment');var jayson=require(_0xc528('0xa'));var client=jayson['client'][_0xc528('0xb')]({'port':0x232a});config[_0xc528('0xc')]=_[_0xc528('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc528('0xe'))(new Redis(config[_0xc528('0xc')]));require(_0xc528('0xf'))[_0xc528('0x10')](socket);function respondWithRpcPromise(_0x2a03ec,_0x15cdc2,_0x19d15a){return new BPromise(function(_0x3c3b07,_0x9f2a11){return client[_0xc528('0x11')](_0x2a03ec,_0x19d15a)[_0xc528('0x12')](function(_0x5d50e0){logger['info'](_0xc528('0x13'),_0x15cdc2,_0xc528('0x14'));logger['debug'](_0xc528('0x15'),_0x15cdc2,'request\x20sent',JSON[_0xc528('0x16')](_0x5d50e0));if(_0x5d50e0[_0xc528('0x17')]){if(_0x5d50e0['error'][_0xc528('0x18')]===0x1f4){logger['error'](_0xc528('0x13'),_0x15cdc2,_0x5d50e0[_0xc528('0x17')][_0xc528('0x19')]);return _0x9f2a11(_0x5d50e0[_0xc528('0x17')][_0xc528('0x19')]);}logger[_0xc528('0x17')](_0xc528('0x13'),_0x15cdc2,_0x5d50e0[_0xc528('0x17')][_0xc528('0x19')]);return _0x3c3b07(_0x5d50e0[_0xc528('0x17')][_0xc528('0x19')]);}else{logger[_0xc528('0x1a')](_0xc528('0x13'),_0x15cdc2,'request\x20sent');_0x3c3b07(_0x5d50e0['result'][_0xc528('0x19')]);}})[_0xc528('0x1b')](function(_0x2eb638){logger[_0xc528('0x17')](_0xc528('0x13'),_0x15cdc2,_0x2eb638);_0x9f2a11(_0x2eb638);});});}exports[_0xc528('0x1c')]=function(_0x19225e){var _0x151a2b=this;return new Promise(function(_0x3188d1,_0xf5632c){return db[_0xc528('0x1d')][_0xc528('0x1e')]({'raw':_0x19225e[_0xc528('0x1f')]?_0x19225e[_0xc528('0x1f')][_0xc528('0x20')]===undefined?!![]:![]:!![],'where':_0x19225e[_0xc528('0x1f')]?_0x19225e[_0xc528('0x1f')]['where']||null:null,'attributes':_0x19225e[_0xc528('0x1f')]?_0x19225e[_0xc528('0x1f')][_0xc528('0x21')]||null:null,'include':_0x19225e['options']?_0x19225e[_0xc528('0x1f')][_0xc528('0x22')]?_[_0xc528('0x23')](_0x19225e[_0xc528('0x1f')][_0xc528('0x22')],function(_0x57580e){return{'model':db[_0x57580e[_0xc528('0x24')]],'as':_0x57580e['as'],'attributes':_0x57580e['attributes'],'include':_0x57580e[_0xc528('0x22')]?_['map'](_0x57580e[_0xc528('0x22')],function(_0xc22234){return{'model':db[_0xc22234[_0xc528('0x24')]],'as':_0xc22234['as'],'attributes':_0xc22234[_0xc528('0x21')],'include':_0xc22234[_0xc528('0x22')]?_[_0xc528('0x23')](_0xc22234[_0xc528('0x22')],function(_0x3ca945){return{'model':db[_0x3ca945['model']],'as':_0x3ca945['as'],'attributes':_0x3ca945[_0xc528('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc528('0x12')](function(_0x5d7ecf){logger['info'](_0xc528('0x1c'),_0x19225e);logger[_0xc528('0x25')](_0xc528('0x1c'),_0x19225e,JSON[_0xc528('0x16')](_0x5d7ecf));_0x3188d1(_0x5d7ecf);})[_0xc528('0x1b')](function(_0x5cf939){logger['error']('ShowWhatsappAccount',_0x5cf939[_0xc528('0x19')],_0x19225e);_0xf5632c(_0x151a2b['error'](0x1f4,_0x5cf939[_0xc528('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6a97847..d3d27d7 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 _0xaf18=['register','length','whatsappAccount:','./whatsappAccount.events','remove','update','removeListener'];(function(_0xae058c,_0x52f3fa){var _0x1a3bf2=function(_0x26c0ce){while(--_0x26c0ce){_0xae058c['push'](_0xae058c['shift']());}};_0x1a3bf2(++_0x52f3fa);}(_0xaf18,0x18b));var _0x8af1=function(_0x581d41,_0x5a4d21){_0x581d41=_0x581d41-0x0;var _0x59f801=_0xaf18[_0x581d41];return _0x59f801;};'use strict';var WhatsappAccountEvents=require(_0x8af1('0x0'));var events=['save',_0x8af1('0x1'),_0x8af1('0x2')];function createListener(_0x21136f,_0x5191ec){return function(_0x277537){_0x5191ec['emit'](_0x21136f,_0x277537);};}function removeListener(_0x1504f5,_0x4eca6e){return function(){WhatsappAccountEvents[_0x8af1('0x3')](_0x1504f5,_0x4eca6e);};}exports[_0x8af1('0x4')]=function(_0xb38aac){for(var _0x1f36cb=0x0,_0x36c7bc=events[_0x8af1('0x5')];_0x1f36cb<_0x36c7bc;_0x1f36cb++){var _0x139b3d=events[_0x1f36cb];var _0x3a2574=createListener(_0x8af1('0x6')+_0x139b3d,_0xb38aac);WhatsappAccountEvents['on'](_0x139b3d,_0x3a2574);}}; \ No newline at end of file +var _0x2bb7=['remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0x3603d8,_0x4411ad){var _0x1fab39=function(_0x2f1475){while(--_0x2f1475){_0x3603d8['push'](_0x3603d8['shift']());}};_0x1fab39(++_0x4411ad);}(_0x2bb7,0x108));var _0x72bb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2bb7[_0x3bf83f];return _0x22c4a9;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x72bb('0x0'),'update'];function createListener(_0x57042a,_0x696d1){return function(_0x518232){_0x696d1[_0x72bb('0x1')](_0x57042a,_0x518232);};}function removeListener(_0x3356f0,_0x36c916){return function(){WhatsappAccountEvents[_0x72bb('0x2')](_0x3356f0,_0x36c916);};}exports[_0x72bb('0x3')]=function(_0xfe989a){for(var _0x1eff28=0x0,_0x13a146=events[_0x72bb('0x4')];_0x1eff28<_0x13a146;_0x1eff28++){var _0x3a1fd0=events[_0x1eff28];var _0x529d11=createListener(_0x72bb('0x5')+_0x3a1fd0,_0xfe989a);WhatsappAccountEvents['on'](_0x3a1fd0,_0x529d11);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a756035..ca4da2a 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 _0x4028=['../../components/auth/service','./whatsappApplication.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x4028,0xb6));var _0x8402=function(_0x49dcdf,_0x5dcd5c){_0x49dcdf=_0x49dcdf-0x0;var _0x336cb1=_0x4028[_0x49dcdf];return _0x336cb1;};'use strict';var multer=require('multer');var util=require(_0x8402('0x0'));var path=require(_0x8402('0x1'));var timeout=require(_0x8402('0x2'));var express=require(_0x8402('0x3'));var router=express[_0x8402('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8402('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8402('0x6'));router[_0x8402('0x7')]('/',auth[_0x8402('0x8')](),controller['index']);router['get'](_0x8402('0x9'),auth[_0x8402('0x8')](),controller[_0x8402('0xa')]);router['post']('/',auth[_0x8402('0x8')](),controller[_0x8402('0xb')]);router[_0x8402('0xc')](_0x8402('0x9'),auth[_0x8402('0x8')](),controller[_0x8402('0xd')]);router[_0x8402('0xe')](_0x8402('0x9'),auth[_0x8402('0x8')](),controller[_0x8402('0xf')]);module[_0x8402('0x10')]=router; \ No newline at end of file +var _0xeba4=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappApplication.controller','get','index','isAuthenticated','show','post','update','delete','/:id','destroy','multer'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xeba4,0x65));var _0x4eba=function(_0x1a42aa,_0x9bdf5e){_0x1a42aa=_0x1a42aa-0x0;var _0x233034=_0xeba4[_0x1a42aa];return _0x233034;};'use strict';var multer=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var path=require(_0x4eba('0x2'));var timeout=require(_0x4eba('0x3'));var express=require('express');var router=express[_0x4eba('0x4')]();var fs_extra=require(_0x4eba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4eba('0x6'));var config=require('../../config/environment');var controller=require(_0x4eba('0x7'));router[_0x4eba('0x8')]('/',auth['isAuthenticated'](),controller[_0x4eba('0x9')]);router['get']('/:id',auth[_0x4eba('0xa')](),controller[_0x4eba('0xb')]);router[_0x4eba('0xc')]('/',auth[_0x4eba('0xa')](),controller['create']);router['put']('/:id',auth[_0x4eba('0xa')](),controller[_0x4eba('0xd')]);router[_0x4eba('0xe')](_0x4eba('0xf'),auth[_0x4eba('0xa')](),controller[_0x4eba('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d529086..502bdb0 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 _0xd24f=['exports','TEXT','STRING','sequelize'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xd24f,0x15b));var _0xfd24=function(_0x277563,_0x566184){_0x277563=_0x277563-0x0;var _0xc114d5=_0xd24f[_0x277563];return _0xc114d5;};'use strict';var Sequelize=require(_0xfd24('0x0'));module[_0xfd24('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfd24('0x2')]()},'description':{'type':Sequelize[_0xfd24('0x3')]},'interval':{'type':Sequelize[_0xfd24('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7d25=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x35ba87,_0x28a60d){var _0x55ec36=function(_0x514c48){while(--_0x514c48){_0x35ba87['push'](_0x35ba87['shift']());}};_0x55ec36(++_0x28a60d);}(_0x7d25,0x8a));var _0x57d2=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x7d25[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'priority':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x57d2('0x2')],'allowNull':![],'defaultValue':_0x57d2('0x3')},'appdata':{'type':Sequelize[_0x57d2('0x4')]()},'description':{'type':Sequelize[_0x57d2('0x2')]},'interval':{'type':Sequelize[_0x57d2('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 7c7131b..1708059 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 _0x15b8=['limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined'];(function(_0x874cbf,_0x344238){var _0x43703e=function(_0x26256f){while(--_0x26256f){_0x874cbf['push'](_0x874cbf['shift']());}};_0x43703e(++_0x344238);}(_0x15b8,0xcd));var _0x815b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x15b8[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x815b('0x0'));var zipdir=require(_0x815b('0x1'));var jsonpatch=require(_0x815b('0x2'));var rp=require(_0x815b('0x3'));var moment=require(_0x815b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x815b('0x5'));var util=require(_0x815b('0x6'));var path=require(_0x815b('0x7'));var sox=require(_0x815b('0x8'));var csv=require(_0x815b('0x9'));var ejs=require(_0x815b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x815b('0xb'));var squel=require(_0x815b('0xc'));var crypto=require(_0x815b('0xd'));var jsforce=require(_0x815b('0xe'));var deskjs=require(_0x815b('0xf'));var toCsv=require(_0x815b('0x9'));var querystring=require(_0x815b('0x10'));var Papa=require(_0x815b('0x11'));var Redis=require(_0x815b('0x12'));var authService=require(_0x815b('0x13'));var qs=require(_0x815b('0x14'));var as=require(_0x815b('0x15'));var hardwareService=require(_0x815b('0x16'));var logger=require(_0x815b('0x17'))(_0x815b('0x18'));var utils=require(_0x815b('0x19'));var config=require(_0x815b('0x1a'));var licenseUtil=require(_0x815b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d134a,_0x1ca5d5){_0x1ca5d5=_0x1ca5d5||0xcc;return function(_0x1d25ab){if(_0x1d25ab){return _0x4d134a['sendStatus'](_0x1ca5d5);}return _0x4d134a['status'](_0x1ca5d5)['end']();};}function respondWithResult(_0x25c1ed,_0x5c89eb){_0x5c89eb=_0x5c89eb||0xc8;return function(_0x5814ee){if(_0x5814ee){return _0x25c1ed[_0x815b('0x1c')](_0x5c89eb)[_0x815b('0x1d')](_0x5814ee);}};}function respondWithFilteredResult(_0x1f4aae,_0x59ea04){return function(_0x495431){if(_0x495431){var _0x14f14f=typeof _0x59ea04[_0x815b('0x1e')]===_0x815b('0x1f')&&typeof _0x59ea04[_0x815b('0x20')]===_0x815b('0x1f');var _0x114305=_0x495431[_0x815b('0x21')];var _0x92d86a=_0x14f14f?0x0:_0x59ea04[_0x815b('0x1e')];var _0x2fa2bd=_0x14f14f?_0x495431[_0x815b('0x21')]:_0x59ea04[_0x815b('0x1e')]+_0x59ea04[_0x815b('0x20')];var _0x4cd48b;if(_0x2fa2bd>=_0x114305){_0x2fa2bd=_0x114305;_0x4cd48b=0xc8;}else{_0x4cd48b=0xce;}_0x1f4aae[_0x815b('0x1c')](_0x4cd48b);return _0x1f4aae[_0x815b('0x22')](_0x815b('0x23'),_0x92d86a+'-'+_0x2fa2bd+'/'+_0x114305)[_0x815b('0x1d')](_0x495431);}return null;};}function patchUpdates(_0x3f710c){return function(_0x4acb47){try{jsonpatch[_0x815b('0x24')](_0x4acb47,_0x3f710c,!![]);}catch(_0x2f7f8b){return BPromise[_0x815b('0x25')](_0x2f7f8b);}return _0x4acb47['save']();};}function saveUpdates(_0x4f7a6a,_0x3ffdb7){return function(_0x2923ed){if(_0x2923ed){return _0x2923ed[_0x815b('0x26')](_0x4f7a6a)[_0x815b('0x27')](function(_0xe36d21){return _0xe36d21;});}return null;};}function removeEntity(_0x31ab20,_0x11f1c1){return function(_0x480c89){if(_0x480c89){return _0x480c89['destroy']()[_0x815b('0x27')](function(){_0x31ab20[_0x815b('0x1c')](0xcc)[_0x815b('0x28')]();});}};}function handleEntityNotFound(_0x15098a,_0x1486c6){return function(_0x3115c7){if(!_0x3115c7){_0x15098a[_0x815b('0x29')](0x194);}return _0x3115c7;};}function handleError(_0x26f465,_0x57345c){_0x57345c=_0x57345c||0x1f4;return function(_0x27b4e1){logger[_0x815b('0x2a')](_0x27b4e1[_0x815b('0x2b')]);if(_0x27b4e1['name']){delete _0x27b4e1[_0x815b('0x2c')];}_0x26f465[_0x815b('0x1c')](_0x57345c)['send'](_0x27b4e1);};}exports[_0x815b('0x2d')]=function(_0x2b02cd,_0x1b1b13){var _0x3b76d4={},_0xb04f={},_0x1bc921={'count':0x0,'rows':[]};var _0x3ba4d4=_[_0x815b('0x2e')](db[_0x815b('0x2f')][_0x815b('0x30')],function(_0x505a91){return{'name':_0x505a91[_0x815b('0x31')],'type':_0x505a91[_0x815b('0x32')][_0x815b('0x33')]};});_0xb04f[_0x815b('0x34')]=_[_0x815b('0x2e')](_0x3ba4d4,_0x815b('0x2c'));_0xb04f['query']=_[_0x815b('0x35')](_0x2b02cd[_0x815b('0x36')]);_0xb04f[_0x815b('0x37')]=_[_0x815b('0x38')](_0xb04f[_0x815b('0x34')],_0xb04f['query']);_0x3b76d4[_0x815b('0x39')]=_['intersection'](_0xb04f[_0x815b('0x34')],qs[_0x815b('0x3a')](_0x2b02cd[_0x815b('0x36')]['fields']));_0x3b76d4[_0x815b('0x39')]=_0x3b76d4['attributes']['length']?_0x3b76d4['attributes']:_0xb04f[_0x815b('0x34')];if(!_0x2b02cd['query'][_0x815b('0x3b')]('nolimit')){_0x3b76d4[_0x815b('0x20')]=qs[_0x815b('0x20')](_0x2b02cd['query'][_0x815b('0x20')]);_0x3b76d4['offset']=qs['offset'](_0x2b02cd[_0x815b('0x36')][_0x815b('0x1e')]);}_0x3b76d4[_0x815b('0x3c')]=qs['sort'](_0x2b02cd[_0x815b('0x36')][_0x815b('0x3d')]);_0x3b76d4[_0x815b('0x3e')]=qs['filters'](_[_0x815b('0x3f')](_0x2b02cd[_0x815b('0x36')],_0xb04f[_0x815b('0x37')]),_0x3ba4d4);if(_0x2b02cd['query'][_0x815b('0x40')]){_0x3b76d4[_0x815b('0x3e')]=_[_0x815b('0x41')](_0x3b76d4[_0x815b('0x3e')],{'$or':_[_0x815b('0x2e')](_0x3ba4d4,function(_0x5e2dd6){if(_0x5e2dd6['type']!==_0x815b('0x42')){var _0x4c0204={};_0x4c0204[_0x5e2dd6['name']]={'$like':'%'+_0x2b02cd[_0x815b('0x36')][_0x815b('0x40')]+'%'};return _0x4c0204;}})});}_0x3b76d4=_['merge']({},_0x3b76d4,_0x2b02cd[_0x815b('0x43')]);var _0x1b0775={'where':_0x3b76d4[_0x815b('0x3e')]};return db[_0x815b('0x2f')][_0x815b('0x21')](_0x1b0775)[_0x815b('0x27')](function(_0x410278){_0x1bc921['count']=_0x410278;if(_0x2b02cd[_0x815b('0x36')][_0x815b('0x44')]){_0x3b76d4[_0x815b('0x45')]=[{'all':!![]}];}return db[_0x815b('0x2f')][_0x815b('0x46')](_0x3b76d4);})[_0x815b('0x27')](function(_0x58645b){_0x1bc921[_0x815b('0x47')]=_0x58645b;return _0x1bc921;})[_0x815b('0x27')](respondWithFilteredResult(_0x1b1b13,_0x3b76d4))[_0x815b('0x48')](handleError(_0x1b1b13,null));};exports[_0x815b('0x49')]=function(_0x196a63,_0x496eb5){var _0x390e83={'raw':!![],'where':{'id':_0x196a63[_0x815b('0x4a')]['id']}},_0x44a8a7={};_0x44a8a7[_0x815b('0x34')]=_[_0x815b('0x35')](db['WhatsappApplication'][_0x815b('0x30')]);_0x44a8a7[_0x815b('0x36')]=_[_0x815b('0x35')](_0x196a63[_0x815b('0x36')]);_0x44a8a7[_0x815b('0x37')]=_[_0x815b('0x38')](_0x44a8a7[_0x815b('0x34')],_0x44a8a7['query']);_0x390e83[_0x815b('0x39')]=_['intersection'](_0x44a8a7[_0x815b('0x34')],qs[_0x815b('0x3a')](_0x196a63[_0x815b('0x36')][_0x815b('0x3a')]));_0x390e83[_0x815b('0x39')]=_0x390e83[_0x815b('0x39')][_0x815b('0x4b')]?_0x390e83['attributes']:_0x44a8a7[_0x815b('0x34')];if(_0x196a63[_0x815b('0x36')]['includeAll']){_0x390e83[_0x815b('0x45')]=[{'all':!![]}];}_0x390e83=_[_0x815b('0x41')]({},_0x390e83,_0x196a63[_0x815b('0x43')]);return db[_0x815b('0x2f')][_0x815b('0x4c')](_0x390e83)[_0x815b('0x27')](handleEntityNotFound(_0x496eb5,null))[_0x815b('0x27')](respondWithResult(_0x496eb5,null))[_0x815b('0x48')](handleError(_0x496eb5,null));};exports['create']=function(_0x2532c0,_0xc1e0a){return db[_0x815b('0x2f')][_0x815b('0x4d')](_0x2532c0['body'],{})[_0x815b('0x27')](respondWithResult(_0xc1e0a,0xc9))[_0x815b('0x48')](handleError(_0xc1e0a,null));};exports[_0x815b('0x26')]=function(_0x37874d,_0x1fd570){if(_0x37874d[_0x815b('0x4e')]['id']){delete _0x37874d['body']['id'];}return db[_0x815b('0x2f')][_0x815b('0x4c')]({'where':{'id':_0x37874d[_0x815b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fd570,null))['then'](saveUpdates(_0x37874d['body'],null))['then'](respondWithResult(_0x1fd570,null))[_0x815b('0x48')](handleError(_0x1fd570,null));};exports['destroy']=function(_0x3b02ad,_0x8bf43f){return db['WhatsappApplication'][_0x815b('0x4c')]({'where':{'id':_0x3b02ad[_0x815b('0x4a')]['id']}})[_0x815b('0x27')](handleEntityNotFound(_0x8bf43f,null))[_0x815b('0x27')](removeEntity(_0x8bf43f,null))[_0x815b('0x48')](handleError(_0x8bf43f,null));}; \ No newline at end of file +var _0xb0ee=['create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','sendStatus','error','name','send','index','map','WhatsappApplication','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find'];(function(_0x4eb435,_0x1b59f2){var _0x5794a5=function(_0xd8cfc){while(--_0xd8cfc){_0x4eb435['push'](_0x4eb435['shift']());}};_0x5794a5(++_0x1b59f2);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb0ee[_0x342baa];return _0x1208f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb0e('0x0'));var zipdir=require(_0xeb0e('0x1'));var jsonpatch=require(_0xeb0e('0x2'));var rp=require(_0xeb0e('0x3'));var moment=require(_0xeb0e('0x4'));var BPromise=require(_0xeb0e('0x5'));var Mustache=require(_0xeb0e('0x6'));var util=require(_0xeb0e('0x7'));var path=require(_0xeb0e('0x8'));var sox=require(_0xeb0e('0x9'));var csv=require('to-csv');var ejs=require(_0xeb0e('0xa'));var fs=require('fs');var fs_extra=require(_0xeb0e('0xb'));var _=require(_0xeb0e('0xc'));var squel=require(_0xeb0e('0xd'));var crypto=require('crypto');var jsforce=require(_0xeb0e('0xe'));var deskjs=require(_0xeb0e('0xf'));var toCsv=require(_0xeb0e('0x10'));var querystring=require(_0xeb0e('0x11'));var Papa=require(_0xeb0e('0x12'));var Redis=require(_0xeb0e('0x13'));var authService=require(_0xeb0e('0x14'));var qs=require(_0xeb0e('0x15'));var as=require(_0xeb0e('0x16'));var hardwareService=require(_0xeb0e('0x17'));var logger=require(_0xeb0e('0x18'))(_0xeb0e('0x19'));var utils=require(_0xeb0e('0x1a'));var config=require(_0xeb0e('0x1b'));var licenseUtil=require(_0xeb0e('0x1c'));var db=require(_0xeb0e('0x1d'))['db'];function respondWithStatusCode(_0x66645d,_0xe9c47e){_0xe9c47e=_0xe9c47e||0xcc;return function(_0x534f2b){if(_0x534f2b){return _0x66645d['sendStatus'](_0xe9c47e);}return _0x66645d[_0xeb0e('0x1e')](_0xe9c47e)['end']();};}function respondWithResult(_0x54f816,_0xb50950){_0xb50950=_0xb50950||0xc8;return function(_0x105f77){if(_0x105f77){return _0x54f816[_0xeb0e('0x1e')](_0xb50950)[_0xeb0e('0x1f')](_0x105f77);}};}function respondWithFilteredResult(_0x4c4ebe,_0xc6e6c1){return function(_0x10c2b0){if(_0x10c2b0){var _0x5ca0c3=typeof _0xc6e6c1[_0xeb0e('0x20')]===_0xeb0e('0x21')&&typeof _0xc6e6c1[_0xeb0e('0x22')]===_0xeb0e('0x21');var _0x2d9e6a=_0x10c2b0[_0xeb0e('0x23')];var _0x2c78aa=_0x5ca0c3?0x0:_0xc6e6c1['offset'];var _0x1396a4=_0x5ca0c3?_0x10c2b0[_0xeb0e('0x23')]:_0xc6e6c1[_0xeb0e('0x20')]+_0xc6e6c1[_0xeb0e('0x22')];var _0x34929d;if(_0x1396a4>=_0x2d9e6a){_0x1396a4=_0x2d9e6a;_0x34929d=0xc8;}else{_0x34929d=0xce;}_0x4c4ebe[_0xeb0e('0x1e')](_0x34929d);return _0x4c4ebe[_0xeb0e('0x24')](_0xeb0e('0x25'),_0x2c78aa+'-'+_0x1396a4+'/'+_0x2d9e6a)['json'](_0x10c2b0);}return null;};}function patchUpdates(_0x2f0e1b){return function(_0x1359ed){try{jsonpatch['apply'](_0x1359ed,_0x2f0e1b,!![]);}catch(_0x5268c3){return BPromise[_0xeb0e('0x26')](_0x5268c3);}return _0x1359ed[_0xeb0e('0x27')]();};}function saveUpdates(_0x4a858c,_0xd6ad44){return function(_0x346fa8){if(_0x346fa8){return _0x346fa8['update'](_0x4a858c)[_0xeb0e('0x28')](function(_0x5db5e2){return _0x5db5e2;});}return null;};}function removeEntity(_0x52fd0f,_0x582a90){return function(_0x164691){if(_0x164691){return _0x164691['destroy']()[_0xeb0e('0x28')](function(){_0x52fd0f[_0xeb0e('0x1e')](0xcc)[_0xeb0e('0x29')]();});}};}function handleEntityNotFound(_0x1849d5,_0x71156c){return function(_0x12a73a){if(!_0x12a73a){_0x1849d5[_0xeb0e('0x2a')](0x194);}return _0x12a73a;};}function handleError(_0x5e4983,_0x5e69a8){_0x5e69a8=_0x5e69a8||0x1f4;return function(_0x27267d){logger[_0xeb0e('0x2b')](_0x27267d['stack']);if(_0x27267d[_0xeb0e('0x2c')]){delete _0x27267d[_0xeb0e('0x2c')];}_0x5e4983[_0xeb0e('0x1e')](_0x5e69a8)[_0xeb0e('0x2d')](_0x27267d);};}exports[_0xeb0e('0x2e')]=function(_0x78f52f,_0xfe0f73){var _0x334f51={},_0x4d23a3={},_0x967750={'count':0x0,'rows':[]};var _0x2ecde5=_[_0xeb0e('0x2f')](db[_0xeb0e('0x30')]['rawAttributes'],function(_0x4ca663){return{'name':_0x4ca663[_0xeb0e('0x31')],'type':_0x4ca663['type'][_0xeb0e('0x32')]};});_0x4d23a3[_0xeb0e('0x33')]=_[_0xeb0e('0x2f')](_0x2ecde5,_0xeb0e('0x2c'));_0x4d23a3[_0xeb0e('0x34')]=_[_0xeb0e('0x35')](_0x78f52f['query']);_0x4d23a3[_0xeb0e('0x36')]=_['intersection'](_0x4d23a3[_0xeb0e('0x33')],_0x4d23a3[_0xeb0e('0x34')]);_0x334f51['attributes']=_['intersection'](_0x4d23a3[_0xeb0e('0x33')],qs[_0xeb0e('0x37')](_0x78f52f[_0xeb0e('0x34')]['fields']));_0x334f51[_0xeb0e('0x38')]=_0x334f51[_0xeb0e('0x38')][_0xeb0e('0x39')]?_0x334f51[_0xeb0e('0x38')]:_0x4d23a3['model'];if(!_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3a')](_0xeb0e('0x3b'))){_0x334f51[_0xeb0e('0x22')]=qs[_0xeb0e('0x22')](_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x22')]);_0x334f51[_0xeb0e('0x20')]=qs['offset'](_0x78f52f['query'][_0xeb0e('0x20')]);}_0x334f51['order']=qs[_0xeb0e('0x3c')](_0x78f52f[_0xeb0e('0x34')]['sort']);_0x334f51[_0xeb0e('0x3d')]=qs[_0xeb0e('0x36')](_['pick'](_0x78f52f['query'],_0x4d23a3[_0xeb0e('0x36')]),_0x2ecde5);if(_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3e')]){_0x334f51[_0xeb0e('0x3d')]=_['merge'](_0x334f51[_0xeb0e('0x3d')],{'$or':_['map'](_0x2ecde5,function(_0x2691bf){if(_0x2691bf[_0xeb0e('0x3f')]!==_0xeb0e('0x40')){var _0x29fc4d={};_0x29fc4d[_0x2691bf[_0xeb0e('0x2c')]]={'$like':'%'+_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x3e')]+'%'};return _0x29fc4d;}})});}_0x334f51=_[_0xeb0e('0x41')]({},_0x334f51,_0x78f52f[_0xeb0e('0x42')]);var _0x1c5f18={'where':_0x334f51[_0xeb0e('0x3d')]};return db[_0xeb0e('0x30')][_0xeb0e('0x23')](_0x1c5f18)[_0xeb0e('0x28')](function(_0x1de195){_0x967750[_0xeb0e('0x23')]=_0x1de195;if(_0x78f52f[_0xeb0e('0x34')][_0xeb0e('0x43')]){_0x334f51[_0xeb0e('0x44')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xeb0e('0x45')](_0x334f51);})['then'](function(_0xf0256){_0x967750[_0xeb0e('0x46')]=_0xf0256;return _0x967750;})['then'](respondWithFilteredResult(_0xfe0f73,_0x334f51))[_0xeb0e('0x47')](handleError(_0xfe0f73,null));};exports['show']=function(_0x4183b4,_0x184ab3){var _0x30ec38={'raw':!![],'where':{'id':_0x4183b4[_0xeb0e('0x48')]['id']}},_0x5c37e0={};_0x5c37e0[_0xeb0e('0x33')]=_[_0xeb0e('0x35')](db[_0xeb0e('0x30')]['rawAttributes']);_0x5c37e0[_0xeb0e('0x34')]=_[_0xeb0e('0x35')](_0x4183b4[_0xeb0e('0x34')]);_0x5c37e0[_0xeb0e('0x36')]=_[_0xeb0e('0x49')](_0x5c37e0[_0xeb0e('0x33')],_0x5c37e0['query']);_0x30ec38[_0xeb0e('0x38')]=_[_0xeb0e('0x49')](_0x5c37e0[_0xeb0e('0x33')],qs[_0xeb0e('0x37')](_0x4183b4[_0xeb0e('0x34')][_0xeb0e('0x37')]));_0x30ec38[_0xeb0e('0x38')]=_0x30ec38['attributes']['length']?_0x30ec38[_0xeb0e('0x38')]:_0x5c37e0[_0xeb0e('0x33')];if(_0x4183b4[_0xeb0e('0x34')][_0xeb0e('0x43')]){_0x30ec38[_0xeb0e('0x44')]=[{'all':!![]}];}_0x30ec38=_[_0xeb0e('0x41')]({},_0x30ec38,_0x4183b4['options']);return db[_0xeb0e('0x30')][_0xeb0e('0x4a')](_0x30ec38)[_0xeb0e('0x28')](handleEntityNotFound(_0x184ab3,null))[_0xeb0e('0x28')](respondWithResult(_0x184ab3,null))[_0xeb0e('0x47')](handleError(_0x184ab3,null));};exports['create']=function(_0x455445,_0x852d66){return db[_0xeb0e('0x30')][_0xeb0e('0x4b')](_0x455445[_0xeb0e('0x4c')],{})[_0xeb0e('0x28')](respondWithResult(_0x852d66,0xc9))['catch'](handleError(_0x852d66,null));};exports[_0xeb0e('0x4d')]=function(_0x513320,_0x109ad5){if(_0x513320[_0xeb0e('0x4c')]['id']){delete _0x513320[_0xeb0e('0x4c')]['id'];}return db['WhatsappApplication'][_0xeb0e('0x4a')]({'where':{'id':_0x513320[_0xeb0e('0x48')]['id']}})['then'](handleEntityNotFound(_0x109ad5,null))[_0xeb0e('0x28')](saveUpdates(_0x513320['body'],null))['then'](respondWithResult(_0x109ad5,null))['catch'](handleError(_0x109ad5,null));};exports[_0xeb0e('0x4e')]=function(_0x2e7962,_0xb688c){return db[_0xeb0e('0x30')][_0xeb0e('0x4a')]({'where':{'id':_0x2e7962['params']['id']}})[_0xeb0e('0x28')](handleEntityNotFound(_0xb688c,null))['then'](removeEntity(_0xb688c,null))[_0xeb0e('0x47')](handleError(_0xb688c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 09b3db0..545a5d1 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','whatsapp_applications'];(function(_0x4164f0,_0x3e1fdb){var _0x5b777e=function(_0x33e4ef){while(--_0x33e4ef){_0x4164f0['push'](_0x4164f0['shift']());}};_0x5b777e(++_0x3e1fdb);}(_0x0a12,0xb8));var _0x20a1=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0a12[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('WhatsappApplication',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4f17=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','whatsapp_applications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f17,0x9e));var _0x74f1=function(_0x123d3d,_0x114ea5){_0x123d3d=_0x123d3d-0x0;var _0x5707bf=_0x4f17[_0x123d3d];return _0x5707bf;};'use strict';var _=require(_0x74f1('0x0'));var util=require('util');var logger=require(_0x74f1('0x1'))(_0x74f1('0x2'));var moment=require('moment');var BPromise=require(_0x74f1('0x3'));var rp=require(_0x74f1('0x4'));var fs=require('fs');var path=require(_0x74f1('0x5'));var rimraf=require(_0x74f1('0x6'));var config=require(_0x74f1('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3f65bb,_0x4b894a){return _0x3f65bb[_0x74f1('0x8')]('WhatsappApplication',attributes,{'tableName':_0x74f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x74f1('0xa'),'collate':_0x74f1('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1949010..0a13a16 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 _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x50853f,_0x1a1d05){var _0x50c0f2=function(_0x237675){while(--_0x237675){_0x50853f['push'](_0x50853f['shift']());}};_0x50c0f2(++_0x1a1d05);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3508d1,_0x4436de){_0x3508d1=_0x3508d1-0x0;var _0x235dda=_0xd0bb[_0x3508d1];return _0x235dda;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x55e0,0xdc));var _0x055e=function(_0x4abd10,_0x20b935){_0x4abd10=_0x4abd10-0x0;var _0x1bfaa5=_0x55e0[_0x4abd10];return _0x1bfaa5;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 87dd0b1..07fc7d8 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 _0x038b=['/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','/describe','isAuthenticated'];(function(_0xbad322,_0x3e6b0b){var _0x2101cb=function(_0x1c3c3b){while(--_0x1c3c3b){_0xbad322['push'](_0xbad322['shift']());}};_0x2101cb(++_0x3e6b0b);}(_0x038b,0x114));var _0xb038=function(_0xa79e7a,_0x419d15){_0xa79e7a=_0xa79e7a-0x0;var _0x20da34=_0x038b[_0xa79e7a];return _0x20da34;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['describe']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['show']);router['get'](_0xb038('0xb'),auth[_0xb038('0x9')](),controller['getMessages']);router[_0xb038('0x7')](_0xb038('0xc'),auth[_0xb038('0x9')](),controller[_0xb038('0xd')]);router[_0xb038('0xe')]('/',auth[_0xb038('0x9')](),controller[_0xb038('0xf')]);router[_0xb038('0xe')](_0xb038('0xb'),auth[_0xb038('0x9')](),controller[_0xb038('0x10')]);router[_0xb038('0xe')](_0xb038('0x11'),auth[_0xb038('0x9')](),interaction[_0xb038('0x12')](_0xb038('0x13'),_0xb038('0x14')),controller['addTags']);router[_0xb038('0x15')](_0xb038('0xa'),auth[_0xb038('0x9')](),interaction[_0xb038('0x12')](_0xb038('0x13'),_0xb038('0x16')),controller['update']);router[_0xb038('0x17')](_0xb038('0xa'),auth[_0xb038('0x9')](),interaction[_0xb038('0x12')]('whatsapp','whatsappinteraction:destroy'),controller[_0xb038('0x18')]);router[_0xb038('0x17')](_0xb038('0x11'),auth[_0xb038('0x9')](),controller['removeTags']);module[_0xb038('0x19')]=router; \ No newline at end of file +var _0x6c7b=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages'];(function(_0x28e038,_0x2176c6){var _0x5bcbaa=function(_0x5ef437){while(--_0x5ef437){_0x28e038['push'](_0x28e038['shift']());}};_0x5bcbaa(++_0x2176c6);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x42c967,_0x3d0a7c){_0x42c967=_0x42c967-0x0;var _0x150a97=_0x6c7b[_0x42c967];return _0x150a97;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0x6')](_0xb6c7('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb6c7('0x6')](_0xb6c7('0xd'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xe')]);router[_0xb6c7('0xf')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x10')]);router['post'](_0xb6c7('0xc'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x11')]);router[_0xb6c7('0xf')](_0xb6c7('0x12'),auth[_0xb6c7('0x7')](),interaction[_0xb6c7('0x13')]('whatsapp',_0xb6c7('0x14')),controller['addTags']);router['put']('/:id',auth[_0xb6c7('0x7')](),interaction['tracked'](_0xb6c7('0x15'),_0xb6c7('0x16')),controller[_0xb6c7('0x17')]);router[_0xb6c7('0x18')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),interaction[_0xb6c7('0x13')](_0xb6c7('0x15'),_0xb6c7('0x19')),controller[_0xb6c7('0x1a')]);router[_0xb6c7('0x18')](_0xb6c7('0x12'),auth[_0xb6c7('0x7')](),controller['removeTags']);module[_0xb6c7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index da563e0..54bffd0 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 _0x4f9b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x708844,_0x2e902d){var _0x2c6e8e=function(_0x3fcb4c){while(--_0x3fcb4c){_0x708844['push'](_0x708844['shift']());}};_0x2c6e8e(++_0x2e902d);}(_0x4f9b,0x6d));var _0xb4f9=function(_0xa804c,_0x21a85b){_0xa804c=_0xa804c-0x0;var _0x158afd=_0x4f9b[_0xa804c];return _0x158afd;};'use strict';var Sequelize=require(_0xb4f9('0x0'));var moment=require(_0xb4f9('0x1'));module[_0xb4f9('0x2')]={'closed':{'type':Sequelize[_0xb4f9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb4f9('0x4')]},'disposition':{'type':Sequelize[_0xb4f9('0x5')]},'secondDisposition':{'type':Sequelize[_0xb4f9('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb4f9('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb4f9('0x6')]('in',_0xb4f9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb4f9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb4f9('0x6')]('in',_0xb4f9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb4f9('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd386=['exports','DATE','STRING','out','ENUM','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0xd386,0x10c));var _0x6d38=function(_0x271474,_0x248441){_0x271474=_0x271474-0x0;var _0x72f117=_0xd386[_0x271474];return _0x72f117;};'use strict';var Sequelize=require(_0x6d38('0x0'));var moment=require(_0x6d38('0x1'));module[_0x6d38('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d38('0x3')]},'disposition':{'type':Sequelize[_0x6d38('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d38('0x4')]},'note':{'type':Sequelize[_0x6d38('0x4')]},'phone':{'type':Sequelize[_0x6d38('0x4')]},'read1stAt':{'type':Sequelize[_0x6d38('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d38('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6d38('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6d38('0x6')]('in',_0x6d38('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d38('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d38('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index bb88768..764d5e5 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 _0xdac8=['moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','user','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','merge','options','find','create','body','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','fullname','mkdirSync','Whatsapp','Owner','N.A.','closed','disposition','basename','createReadStream','System','lastName','out','value','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','rimraf'];(function(_0x4f08bb,_0x40ae97){var _0x5a5e13=function(_0x12ebec){while(--_0x12ebec){_0x4f08bb['push'](_0x4f08bb['shift']());}};_0x5a5e13(++_0x40ae97);}(_0xdac8,0x74));var _0x8dac=function(_0x15f949,_0x502973){_0x15f949=_0x15f949-0x0;var _0x57d7ef=_0xdac8[_0x15f949];return _0x57d7ef;};'use strict';var rimraf=require(_0x8dac('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8dac('0x1'));var BPromise=require(_0x8dac('0x2'));var util=require(_0x8dac('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8dac('0x4'));var Redis=require(_0x8dac('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x8dac('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x8dac('0x7'))('api');var config=require(_0x8dac('0x8'));var db=require('../../mysqldb')['db'];config[_0x8dac('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8dac('0xa'))(new Redis(config[_0x8dac('0x9')]));require(_0x8dac('0xb'))[_0x8dac('0xc')](socket);function respondWithStatusCode(_0x2066de,_0xad825d){_0xad825d=_0xad825d||0xcc;return function(_0x2ebf5a){if(_0x2ebf5a){return _0x2066de['sendStatus'](_0xad825d);}return _0x2066de[_0x8dac('0xd')](_0xad825d)['end']();};}function respondWithResult(_0x1db98a,_0x48f538){_0x48f538=_0x48f538||0xc8;return function(_0x26a242){if(_0x26a242){return _0x1db98a[_0x8dac('0xd')](_0x48f538)[_0x8dac('0xe')](_0x26a242);}};}function respondWithFilteredResult(_0x29ade1,_0x17ad53){return function(_0x5f2ead){if(_0x5f2ead){var _0x127eb1=typeof _0x17ad53[_0x8dac('0xf')]===_0x8dac('0x10')&&typeof _0x17ad53[_0x8dac('0x11')]===_0x8dac('0x10');var _0x12c8d1=_0x5f2ead['count'];var _0x26817b=_0x127eb1?0x0:_0x17ad53['offset'];var _0x3194a6=_0x127eb1?_0x5f2ead[_0x8dac('0x12')]:_0x17ad53[_0x8dac('0xf')]+_0x17ad53['limit'];var _0xb250e2;if(_0x3194a6>=_0x12c8d1){_0x3194a6=_0x12c8d1;_0xb250e2=0xc8;}else{_0xb250e2=0xce;}_0x29ade1[_0x8dac('0xd')](_0xb250e2);return _0x29ade1[_0x8dac('0x13')](_0x8dac('0x14'),_0x26817b+'-'+_0x3194a6+'/'+_0x12c8d1)[_0x8dac('0xe')](_0x5f2ead);}return null;};}function saveUpdates(_0xf3fcbf){return function(_0x45a7f8){if(_0x45a7f8){return _0x45a7f8[_0x8dac('0x15')](_0xf3fcbf)[_0x8dac('0x16')](function(_0xa479e4){return _0xa479e4;});}return null;};}function removeEntity(_0x2edc87){return function(_0x12a619){if(_0x12a619){return _0x12a619['destroy']()['then'](function(){_0x2edc87[_0x8dac('0xd')](0xcc)[_0x8dac('0x17')]();});}};}function handleEntityNotFound(_0x40f1a5){return function(_0x33105f){if(!_0x33105f){_0x40f1a5['sendStatus'](0x194);}return _0x33105f;};}function handleError(_0x47e6f6,_0x1ffe51){_0x1ffe51=_0x1ffe51||0x1f4;return function(_0x2f87aa){logger[_0x8dac('0x18')](_0x2f87aa[_0x8dac('0x19')]);if(_0x2f87aa[_0x8dac('0x1a')]){delete _0x2f87aa[_0x8dac('0x1a')];}_0x47e6f6['status'](_0x1ffe51)[_0x8dac('0x1b')](_0x2f87aa);};}exports['index']=function(_0x5174c0,_0xc333e4){var _0x4c0d87={};var _0x28c3d0=_[_0x8dac('0x1c')](db[_0x8dac('0x1d')][_0x8dac('0x1e')],function(_0x23b9d9){return{'name':_0x23b9d9[_0x8dac('0x1f')],'type':_0x23b9d9[_0x8dac('0x20')][_0x8dac('0x21')]};});_0x4c0d87=qs[_0x8dac('0x22')](_0x28c3d0,_0x5174c0);return interaction[_0x8dac('0x23')](_0x8dac('0x24'),_0x5174c0['query'],_0x5174c0[_0x8dac('0x25')],_0x4c0d87,_0x28c3d0)[_0x8dac('0x16')](respondWithFilteredResult(_0xc333e4,_0x4c0d87))[_0x8dac('0x26')](handleError(_0xc333e4,null));};exports[_0x8dac('0x27')]=function(_0x45237d,_0x5a6148){var _0xa189f7={'raw':![],'where':{'id':_0x45237d[_0x8dac('0x28')]['id']}},_0xb451e8={};_0xb451e8[_0x8dac('0x29')]=_[_0x8dac('0x2a')](db[_0x8dac('0x1d')][_0x8dac('0x1e')]);_0xb451e8[_0x8dac('0x2b')]=_['keys'](_0x45237d['query']);_0xb451e8[_0x8dac('0x2c')]=_[_0x8dac('0x2d')](_0xb451e8['model'],_0xb451e8[_0x8dac('0x2b')]);_0xa189f7[_0x8dac('0x2e')]=_[_0x8dac('0x2d')](_0xb451e8['model'],qs[_0x8dac('0x2f')](_0x45237d[_0x8dac('0x2b')][_0x8dac('0x2f')]));_0xa189f7['attributes']=_0xa189f7['attributes'][_0x8dac('0x30')]?_0xa189f7['attributes']:_0xb451e8[_0x8dac('0x29')];if(_0x45237d[_0x8dac('0x2b')]['includeAll']){_0xa189f7['include']=[{'all':!![]}];}_0xa189f7=_[_0x8dac('0x31')]({},_0xa189f7,_0x45237d[_0x8dac('0x32')]);return db[_0x8dac('0x1d')][_0x8dac('0x33')](_0xa189f7)[_0x8dac('0x16')](handleEntityNotFound(_0x5a6148,null))[_0x8dac('0x16')](respondWithResult(_0x5a6148,null))[_0x8dac('0x26')](handleError(_0x5a6148,null));};exports[_0x8dac('0x34')]=function(_0x43ab1f,_0x30bc70){return db[_0x8dac('0x1d')]['create'](_0x43ab1f[_0x8dac('0x35')],{})[_0x8dac('0x16')](respondWithResult(_0x30bc70,0xc9))[_0x8dac('0x26')](handleError(_0x30bc70,null));};exports[_0x8dac('0x15')]=function(_0x267487,_0x31c224){if(_0x267487[_0x8dac('0x35')]['id']){delete _0x267487[_0x8dac('0x35')]['id'];}return db[_0x8dac('0x1d')]['find']({'where':{'id':_0x267487[_0x8dac('0x28')]['id']}})[_0x8dac('0x16')](handleEntityNotFound(_0x31c224,null))[_0x8dac('0x16')](saveUpdates(_0x267487[_0x8dac('0x35')],null))[_0x8dac('0x16')](respondWithResult(_0x31c224,null))[_0x8dac('0x26')](handleError(_0x31c224,null));};exports[_0x8dac('0x36')]=function(_0x22f2e5,_0x3a981f){return db[_0x8dac('0x1d')][_0x8dac('0x33')]({'where':{'id':_0x22f2e5['params']['id']}})['then'](handleEntityNotFound(_0x3a981f,null))['then'](removeEntity(_0x3a981f,null))[_0x8dac('0x26')](handleError(_0x3a981f,null));};exports[_0x8dac('0x37')]=function(_0x5e6262,_0x2308a9){return db[_0x8dac('0x1d')]['describe']()[_0x8dac('0x16')](respondWithResult(_0x2308a9,null))['catch'](handleError(_0x2308a9,null));};exports[_0x8dac('0x38')]=function(_0xae3173,_0x3d5b38){return db[_0x8dac('0x39')][_0x8dac('0x33')]({'where':{'id':_0xae3173[_0x8dac('0x28')]['id']}})['then'](handleEntityNotFound(_0x3d5b38,null))[_0x8dac('0x16')](function(_0x210206){if(_0x210206){return _0x210206[_0x8dac('0x38')](_0xae3173[_0x8dac('0x35')][_0x8dac('0x3a')],_[_0x8dac('0x3b')](_0xae3173['body'],[_0x8dac('0x3a'),'id'])||{});}})[_0x8dac('0x16')](respondWithResult(_0x3d5b38,null))['catch'](handleError(_0x3d5b38,null));};exports[_0x8dac('0x3c')]=function(_0x27c024,_0x8f84ac){var _0x39ec4b={'raw':![],'where':{}};var _0x1dccf0={};var _0x384b65={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x27c024[_0x8dac('0x28')]['id']}})[_0x8dac('0x16')](handleEntityNotFound(_0x8f84ac,null))[_0x8dac('0x16')](function(_0x38bd60){if(_0x38bd60){_0x1dccf0[_0x8dac('0x29')]=_[_0x8dac('0x2a')](db[_0x8dac('0x39')]['rawAttributes']);_0x1dccf0[_0x8dac('0x2b')]=_[_0x8dac('0x2a')](_0x27c024[_0x8dac('0x2b')]);_0x1dccf0[_0x8dac('0x2c')]=_[_0x8dac('0x2d')](_0x1dccf0['model'],_0x1dccf0['query']);_0x39ec4b['attributes']=_[_0x8dac('0x2d')](_0x1dccf0['model'],qs[_0x8dac('0x2f')](_0x27c024['query']['fields']));_0x39ec4b['attributes']=_0x39ec4b[_0x8dac('0x2e')][_0x8dac('0x30')]?_0x39ec4b['attributes']:_0x1dccf0[_0x8dac('0x29')];if(!_0x27c024[_0x8dac('0x2b')]['hasOwnProperty']('nolimit')){_0x39ec4b[_0x8dac('0x11')]=qs['limit'](_0x27c024[_0x8dac('0x2b')][_0x8dac('0x11')]);_0x39ec4b[_0x8dac('0xf')]=qs['offset'](_0x27c024[_0x8dac('0x2b')][_0x8dac('0xf')]);}_0x39ec4b[_0x8dac('0x3d')]=qs['sort'](_0x27c024[_0x8dac('0x2b')][_0x8dac('0x3e')]);_0x39ec4b[_0x8dac('0x3f')]=qs[_0x8dac('0x2c')](_['pick'](_0x27c024[_0x8dac('0x2b')],_0x1dccf0['filters']));_0x39ec4b[_0x8dac('0x3f')]['WhatsappInteractionId']=_0x38bd60['id'];if(_0x27c024[_0x8dac('0x2b')]['filter']){_0x39ec4b[_0x8dac('0x3f')]=_[_0x8dac('0x31')](_0x39ec4b['where'],{'$or':_[_0x8dac('0x1c')](_0x39ec4b[_0x8dac('0x2e')],function(_0x1b97b1){var _0x3097aa={};_0x3097aa[_0x1b97b1]={'$like':'%'+_0x27c024[_0x8dac('0x2b')][_0x8dac('0x40')]+'%'};return _0x3097aa;})});}if(_0x27c024['query']['$gte']){var _0x3a48fb=_0x27c024[_0x8dac('0x2b')][_0x8dac('0x41')]['split'](',');var _0x137649={};_0x137649[_0x3a48fb[0x0]]={'$gte':moment(_0x3a48fb[0x1])[_0x8dac('0x42')](_0x8dac('0x43'))};_0x39ec4b[_0x8dac('0x3f')]=_['merge'](_0x39ec4b[_0x8dac('0x3f')],_0x137649);}_0x39ec4b=_['merge']({},_0x39ec4b,_0x27c024[_0x8dac('0x32')]);return db[_0x8dac('0x39')][_0x8dac('0x12')]({'where':_0x39ec4b['where']})[_0x8dac('0x16')](function(_0x89e640){_0x384b65[_0x8dac('0x12')]=_0x89e640;if(_0x27c024[_0x8dac('0x2b')]['includeAll']){_0x39ec4b['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x8dac('0x23')](_0x39ec4b);})[_0x8dac('0x16')](function(_0x1c0e65){_0x384b65[_0x8dac('0x44')]=_0x1c0e65;return _0x384b65;});}})['then'](respondWithFilteredResult(_0x8f84ac,_0x39ec4b))[_0x8dac('0x26')](handleError(_0x8f84ac,null));};exports[_0x8dac('0x45')]=function(_0x3f3c82,_0x230c2e){return db[_0x8dac('0x1d')][_0x8dac('0x33')]({'where':{'id':_0x3f3c82[_0x8dac('0x28')]['id']}})['then'](handleEntityNotFound(_0x230c2e,null))['then'](function(_0x1d99d2){if(_0x1d99d2){return _0x1d99d2[_0x8dac('0x46')](_0x3f3c82['body'][_0x8dac('0x3a')],_[_0x8dac('0x3b')](_0x3f3c82[_0x8dac('0x35')],[_0x8dac('0x3a'),'id'])||{})[_0x8dac('0x47')](function(){return db[_0x8dac('0x48')][_0x8dac('0x23')]({'attributes':['id','name',_0x8dac('0x49')],'where':{'id':_0x3f3c82[_0x8dac('0x35')][_0x8dac('0x3a')]}});})[_0x8dac('0x16')](function(_0x24b9f5){socket[_0x8dac('0x4a')](_0x8dac('0x4b'),{'id':Number(_0x3f3c82[_0x8dac('0x28')]['id']),'tags':_0x24b9f5||[]});return{'id':Number(_0x3f3c82[_0x8dac('0x28')]['id']),'tags':_0x24b9f5||[]};});}})[_0x8dac('0x16')](respondWithResult(_0x230c2e,null))['catch'](handleError(_0x230c2e,null));};exports['removeTags']=function(_0x5eaa5e,_0x36d0a9){return db[_0x8dac('0x1d')][_0x8dac('0x33')]({'where':{'id':_0x5eaa5e[_0x8dac('0x28')]['id']}})[_0x8dac('0x16')](handleEntityNotFound(_0x36d0a9,null))[_0x8dac('0x16')](function(_0x599b30){if(_0x599b30){return _0x599b30['removeTags'](_0x5eaa5e[_0x8dac('0x2b')]['ids']);}})[_0x8dac('0x16')](respondWithStatusCode(_0x36d0a9,null))['catch'](handleError(_0x36d0a9,null));};exports[_0x8dac('0x4c')]=function(_0x2e0a34,_0x5584b8){var _0x3dc2ce=moment()[_0x8dac('0x4d')]()[_0x8dac('0x4e')]();var _0x4f6d5f=path['join'](config[_0x8dac('0x4f')],_0x8dac('0x50'),_0x8dac('0x51'),_0x8dac('0x52'));var _0x5b6ab7=path[_0x8dac('0x53')](config['root'],_0x8dac('0x50'),_0x8dac('0x51'),_0x8dac('0x54'));var _0x48264c=path[_0x8dac('0x53')](_0x4f6d5f,_0x3dc2ce);var _0x1d98c1=util['format'](_0x8dac('0x55'),_0x2e0a34[_0x8dac('0x28')]['id'],_0x3dc2ce);var _0x8b796f=path[_0x8dac('0x53')](_0x4f6d5f,_0x1d98c1);var _0x1fa3dd=[];_0x1fa3dd[_0x8dac('0x56')]({'model':db[_0x8dac('0x57')],'as':_0x8dac('0x57'),'attributes':['id','fullname'],'raw':!![]});_0x1fa3dd[_0x8dac('0x56')]({'model':db[_0x8dac('0x58')],'as':_0x8dac('0x59'),'attributes':['id',_0x8dac('0x5a'),'lastName'],'raw':!![]});if(_0x2e0a34[_0x8dac('0x2b')][_0x8dac('0x54')]){_0x1fa3dd[_0x8dac('0x56')]({'model':db['Attachment'],'as':_0x8dac('0x5b'),'raw':!![]});}var _0x2ccd28=[{'model':db[_0x8dac('0x39')],'as':_0x8dac('0x5c'),'attributes':['id',_0x8dac('0x35'),_0x8dac('0x5d'),_0x8dac('0x5e'),_0x8dac('0x5f'),_0x8dac('0x60')],'include':_0x1fa3dd}];_0x2ccd28[_0x8dac('0x56')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x8dac('0x1a')]});_0x2ccd28[_0x8dac('0x56')]({'model':db[_0x8dac('0x57')],'as':'Owner','attributes':['id',_0x8dac('0x61')]});return db[_0x8dac('0x1d')][_0x8dac('0x33')]({'where':{'id':_0x2e0a34[_0x8dac('0x28')]['id']},'include':_0x2ccd28})[_0x8dac('0x16')](handleEntityNotFound(_0x5584b8,null))[_0x8dac('0x16')](function(_0x3a1398){if(_0x3a1398){var _0x5307a9=_0x3a1398['get']({'plain':!![]});fs[_0x8dac('0x62')](_0x48264c);var _0x51f764={'channel':_0x8dac('0x63'),'account':_0x5307a9['Account'][_0x8dac('0x1a')],'agent':_0x5307a9[_0x8dac('0x64')]?_0x5307a9[_0x8dac('0x64')][_0x8dac('0x61')]:_0x8dac('0x65'),'createdAt':moment(_0x5307a9[_0x8dac('0x5d')])[_0x8dac('0x42')](_0x8dac('0x43'))[_0x8dac('0x4e')](),'closedAt':_0x5307a9[_0x8dac('0x66')]?moment(_0x5307a9['closedAt'])['format'](_0x8dac('0x43'))[_0x8dac('0x4e')]():'','disposition':_0x5307a9[_0x8dac('0x67')],'messages':_(_0x5307a9[_0x8dac('0x5c')])['filter']({'secret':![]})[_0x8dac('0x1c')](function(_0x568128){if(_0x568128[_0x8dac('0x5b')]){var _0x5e022f=path[_0x8dac('0x53')](_0x5b6ab7,_0x568128['Attachment'][_0x8dac('0x68')]);if(fs['existsSync'](_0x5e022f)){fs[_0x8dac('0x69')](_0x5e022f)['pipe'](fs['createWriteStream'](path[_0x8dac('0x53')](_0x48264c,_0x568128[_0x8dac('0x5b')][_0x8dac('0x68')])));}}return{'date':moment(_0x568128[_0x8dac('0x5d')])['format'](_0x8dac('0x43'))[_0x8dac('0x4e')](),'sender':_0x568128[_0x8dac('0x5e')]==='out'?_0x568128['User']?_0x568128[_0x8dac('0x57')][_0x8dac('0x61')]:_0x8dac('0x6a'):_0x568128[_0x8dac('0x59')]['firstName']+(_0x568128[_0x8dac('0x59')][_0x8dac('0x6b')]?'\x20'+_0x568128['Contact'][_0x8dac('0x6b')]:''),'body':_0x568128[_0x8dac('0x5b')]?_0x568128[_0x8dac('0x5b')][_0x8dac('0x68')]:_0x568128[_0x8dac('0x35')],'direction':_0x568128[_0x8dac('0x5e')]===_0x8dac('0x6c')?'A':'C','secret':_0x568128[_0x8dac('0x5f')],'read':_0x568128['read'],'attachment':_0x568128[_0x8dac('0x5b')]};})[_0x8dac('0x6d')]()};return ejs['renderFile'](path[_0x8dac('0x53')](config[_0x8dac('0x4f')],_0x8dac('0x50'),_0x8dac('0x6e'),'downloadInteraction.ejs'),{'interaction':_0x51f764})[_0x8dac('0x16')](function(_0x369de4){var _0x2d02df=path['join'](_0x48264c,_0x8dac('0x6f')+_0x5307a9['id']+'-'+_0x3dc2ce+_0x8dac('0x70'));var _0x444184={'path':_0x2d02df,'channel':'Whatsapp','interactionId':_0x5307a9['id']};return pdf[_0x8dac('0x71')](_0x369de4,_0x444184);})['then'](function(){return new BPromise(function(_0x10a364,_0x448216){zipdir(_0x48264c,{'saveTo':_0x8b796f},function(_0x1120fb,_0x3ab27f){if(_0x1120fb)return _0x448216(_0x1120fb);return _0x10a364(_0x3ab27f);});})[_0x8dac('0x16')](function(){return new BPromise(function(_0x3dbdc1,_0x544b18){rimraf(_0x48264c,function(_0xae7548){if(_0xae7548)_0x544b18(_0xae7548);return _0x3dbdc1();});});})[_0x8dac('0x16')](function(){return _0x5584b8[_0x8dac('0x4c')](_0x8b796f,_0x1d98c1,function(_0x515603){if(_0x515603){console[_0x8dac('0x72')]('err',_0x515603);}else{fs[_0x8dac('0x73')](_0x8b796f);}});});});}else{return _0x5584b8[_0x8dac('0x74')](0xc8);}})[_0x8dac('0x26')](handleError(_0x5584b8,null));}; \ No newline at end of file +var _0xc473=['path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','sendStatus','error','name','send','index','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','whatsapp','query','user','catch','params','keys','filters','intersection','model','attributes','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','fields','length','hasOwnProperty','order','sort','pick','where','WhatsappInteractionId','filter','merge','$gte','split','format','rows','addTags','omit','spread','Tag','color','removeTags','download','toString','join','tmp','root','files','attachments','transcript-%d-%s.zip','User','fullname','CmContact','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','secret','Account','Whatsapp','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','map','basename','existsSync','pipe','createWriteStream','out','System','read','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','zip-dir','moment','util'];(function(_0x3f84c6,_0x10a71a){var _0x563d5a=function(_0xa7ec79){while(--_0xa7ec79){_0x3f84c6['push'](_0x3f84c6['shift']());}};_0x563d5a(++_0x10a71a);}(_0xc473,0x174));var _0x3c47=function(_0x1c6883,_0x118d10){_0x1c6883=_0x1c6883-0x0;var _0x669e19=_0xc473[_0x1c6883];return _0x669e19;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3c47('0x0'));var moment=require(_0x3c47('0x1'));var BPromise=require('bluebird');var util=require(_0x3c47('0x2'));var path=require(_0x3c47('0x3'));var ejs=require(_0x3c47('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x3c47('0x5'));var interaction=require(_0x3c47('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x3c47('0x7'));var logger=require(_0x3c47('0x8'))(_0x3c47('0x9'));var config=require(_0x3c47('0xa'));var db=require(_0x3c47('0xb'))['db'];config[_0x3c47('0xc')]=_[_0x3c47('0xd')](config[_0x3c47('0xc')],{'host':_0x3c47('0xe'),'port':0x18eb});var socket=require(_0x3c47('0xf'))(new Redis(config['redis']));require(_0x3c47('0x10'))[_0x3c47('0x11')](socket);function respondWithStatusCode(_0x3695e0,_0x2e4f5b){_0x2e4f5b=_0x2e4f5b||0xcc;return function(_0xb5d0a1){if(_0xb5d0a1){return _0x3695e0['sendStatus'](_0x2e4f5b);}return _0x3695e0[_0x3c47('0x12')](_0x2e4f5b)[_0x3c47('0x13')]();};}function respondWithResult(_0x5206d9,_0x285d52){_0x285d52=_0x285d52||0xc8;return function(_0x15a4b7){if(_0x15a4b7){return _0x5206d9[_0x3c47('0x12')](_0x285d52)[_0x3c47('0x14')](_0x15a4b7);}};}function respondWithFilteredResult(_0x32a808,_0x35904b){return function(_0x371470){if(_0x371470){var _0xa6477d=typeof _0x35904b['offset']===_0x3c47('0x15')&&typeof _0x35904b[_0x3c47('0x16')]===_0x3c47('0x15');var _0x5a3e17=_0x371470['count'];var _0xd04eb7=_0xa6477d?0x0:_0x35904b[_0x3c47('0x17')];var _0x49ef50=_0xa6477d?_0x371470[_0x3c47('0x18')]:_0x35904b['offset']+_0x35904b[_0x3c47('0x16')];var _0x351e3f;if(_0x49ef50>=_0x5a3e17){_0x49ef50=_0x5a3e17;_0x351e3f=0xc8;}else{_0x351e3f=0xce;}_0x32a808[_0x3c47('0x12')](_0x351e3f);return _0x32a808[_0x3c47('0x19')](_0x3c47('0x1a'),_0xd04eb7+'-'+_0x49ef50+'/'+_0x5a3e17)[_0x3c47('0x14')](_0x371470);}return null;};}function saveUpdates(_0x2cdd96){return function(_0x2a0817){if(_0x2a0817){return _0x2a0817[_0x3c47('0x1b')](_0x2cdd96)[_0x3c47('0x1c')](function(_0x560777){return _0x560777;});}return null;};}function removeEntity(_0x4e3c56){return function(_0x3106c0){if(_0x3106c0){return _0x3106c0[_0x3c47('0x1d')]()['then'](function(){_0x4e3c56[_0x3c47('0x12')](0xcc)[_0x3c47('0x13')]();});}};}function handleEntityNotFound(_0x526e4b){return function(_0xe97b53){if(!_0xe97b53){_0x526e4b[_0x3c47('0x1e')](0x194);}return _0xe97b53;};}function handleError(_0x552a88,_0x674bd4){_0x674bd4=_0x674bd4||0x1f4;return function(_0x1082b7){logger[_0x3c47('0x1f')](_0x1082b7['stack']);if(_0x1082b7[_0x3c47('0x20')]){delete _0x1082b7[_0x3c47('0x20')];}_0x552a88[_0x3c47('0x12')](_0x674bd4)[_0x3c47('0x21')](_0x1082b7);};}exports[_0x3c47('0x22')]=function(_0x8aba84,_0x3d5047){var _0x4bcebb={};var _0x14cd4f=_['map'](db[_0x3c47('0x23')][_0x3c47('0x24')],function(_0x45e8d3){return{'name':_0x45e8d3[_0x3c47('0x25')],'type':_0x45e8d3['type'][_0x3c47('0x26')]};});_0x4bcebb=qs[_0x3c47('0x27')](_0x14cd4f,_0x8aba84);return interaction['findAll'](_0x3c47('0x28'),_0x8aba84[_0x3c47('0x29')],_0x8aba84[_0x3c47('0x2a')],_0x4bcebb,_0x14cd4f)[_0x3c47('0x1c')](respondWithFilteredResult(_0x3d5047,_0x4bcebb))[_0x3c47('0x2b')](handleError(_0x3d5047,null));};exports['show']=function(_0x43db21,_0x27c95c){var _0x11ae50={'raw':![],'where':{'id':_0x43db21[_0x3c47('0x2c')]['id']}},_0x186a63={};_0x186a63['model']=_['keys'](db[_0x3c47('0x23')]['rawAttributes']);_0x186a63['query']=_[_0x3c47('0x2d')](_0x43db21[_0x3c47('0x29')]);_0x186a63[_0x3c47('0x2e')]=_[_0x3c47('0x2f')](_0x186a63['model'],_0x186a63[_0x3c47('0x29')]);_0x11ae50['attributes']=_['intersection'](_0x186a63[_0x3c47('0x30')],qs['fields'](_0x43db21[_0x3c47('0x29')]['fields']));_0x11ae50[_0x3c47('0x31')]=_0x11ae50[_0x3c47('0x31')]['length']?_0x11ae50[_0x3c47('0x31')]:_0x186a63['model'];if(_0x43db21[_0x3c47('0x29')][_0x3c47('0x32')]){_0x11ae50[_0x3c47('0x33')]=[{'all':!![]}];}_0x11ae50=_['merge']({},_0x11ae50,_0x43db21[_0x3c47('0x34')]);return db['WhatsappInteraction'][_0x3c47('0x35')](_0x11ae50)[_0x3c47('0x1c')](handleEntityNotFound(_0x27c95c,null))[_0x3c47('0x1c')](respondWithResult(_0x27c95c,null))[_0x3c47('0x2b')](handleError(_0x27c95c,null));};exports[_0x3c47('0x36')]=function(_0x3fcada,_0x5cd18e){return db[_0x3c47('0x23')]['create'](_0x3fcada[_0x3c47('0x37')],{})[_0x3c47('0x1c')](respondWithResult(_0x5cd18e,0xc9))['catch'](handleError(_0x5cd18e,null));};exports[_0x3c47('0x1b')]=function(_0x2d4033,_0x3d981f){if(_0x2d4033['body']['id']){delete _0x2d4033[_0x3c47('0x37')]['id'];}return db[_0x3c47('0x23')][_0x3c47('0x35')]({'where':{'id':_0x2d4033[_0x3c47('0x2c')]['id']}})[_0x3c47('0x1c')](handleEntityNotFound(_0x3d981f,null))['then'](saveUpdates(_0x2d4033[_0x3c47('0x37')],null))[_0x3c47('0x1c')](respondWithResult(_0x3d981f,null))[_0x3c47('0x2b')](handleError(_0x3d981f,null));};exports['destroy']=function(_0x37888e,_0x94d660){return db['WhatsappInteraction'][_0x3c47('0x35')]({'where':{'id':_0x37888e[_0x3c47('0x2c')]['id']}})[_0x3c47('0x1c')](handleEntityNotFound(_0x94d660,null))[_0x3c47('0x1c')](removeEntity(_0x94d660,null))[_0x3c47('0x2b')](handleError(_0x94d660,null));};exports[_0x3c47('0x38')]=function(_0x2fc99a,_0x2e126c){return db['WhatsappInteraction'][_0x3c47('0x38')]()[_0x3c47('0x1c')](respondWithResult(_0x2e126c,null))[_0x3c47('0x2b')](handleError(_0x2e126c,null));};exports[_0x3c47('0x39')]=function(_0x56261b,_0xa78be0){return db[_0x3c47('0x3a')][_0x3c47('0x35')]({'where':{'id':_0x56261b[_0x3c47('0x2c')]['id']}})[_0x3c47('0x1c')](handleEntityNotFound(_0xa78be0,null))[_0x3c47('0x1c')](function(_0x4beb6e){if(_0x4beb6e){return _0x4beb6e[_0x3c47('0x39')](_0x56261b['body'][_0x3c47('0x3b')],_['omit'](_0x56261b[_0x3c47('0x37')],[_0x3c47('0x3b'),'id'])||{});}})[_0x3c47('0x1c')](respondWithResult(_0xa78be0,null))['catch'](handleError(_0xa78be0,null));};exports[_0x3c47('0x3c')]=function(_0x4f1b21,_0x1c7b89){var _0x5f1ad7={'raw':![],'where':{}};var _0x4381a6={};var _0x5b4838={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3c47('0x3d')]({'where':{'id':_0x4f1b21['params']['id']}})[_0x3c47('0x1c')](handleEntityNotFound(_0x1c7b89,null))['then'](function(_0x1c7bb8){if(_0x1c7bb8){_0x4381a6['model']=_[_0x3c47('0x2d')](db['WhatsappMessage'][_0x3c47('0x24')]);_0x4381a6[_0x3c47('0x29')]=_[_0x3c47('0x2d')](_0x4f1b21[_0x3c47('0x29')]);_0x4381a6[_0x3c47('0x2e')]=_[_0x3c47('0x2f')](_0x4381a6['model'],_0x4381a6[_0x3c47('0x29')]);_0x5f1ad7[_0x3c47('0x31')]=_['intersection'](_0x4381a6[_0x3c47('0x30')],qs['fields'](_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x3e')]));_0x5f1ad7['attributes']=_0x5f1ad7[_0x3c47('0x31')][_0x3c47('0x3f')]?_0x5f1ad7[_0x3c47('0x31')]:_0x4381a6[_0x3c47('0x30')];if(!_0x4f1b21['query'][_0x3c47('0x40')]('nolimit')){_0x5f1ad7[_0x3c47('0x16')]=qs[_0x3c47('0x16')](_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x16')]);_0x5f1ad7[_0x3c47('0x17')]=qs[_0x3c47('0x17')](_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x17')]);}_0x5f1ad7[_0x3c47('0x41')]=qs[_0x3c47('0x42')](_0x4f1b21[_0x3c47('0x29')]['sort']);_0x5f1ad7['where']=qs[_0x3c47('0x2e')](_[_0x3c47('0x43')](_0x4f1b21[_0x3c47('0x29')],_0x4381a6[_0x3c47('0x2e')]));_0x5f1ad7[_0x3c47('0x44')][_0x3c47('0x45')]=_0x1c7bb8['id'];if(_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x46')]){_0x5f1ad7[_0x3c47('0x44')]=_[_0x3c47('0x47')](_0x5f1ad7['where'],{'$or':_['map'](_0x5f1ad7[_0x3c47('0x31')],function(_0x451f1e){var _0x46350c={};_0x46350c[_0x451f1e]={'$like':'%'+_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x46')]+'%'};return _0x46350c;})});}if(_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x48')]){var _0x7d289e=_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x48')][_0x3c47('0x49')](',');var _0x4d3f23={};_0x4d3f23[_0x7d289e[0x0]]={'$gte':moment(_0x7d289e[0x1])[_0x3c47('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5f1ad7['where']=_[_0x3c47('0x47')](_0x5f1ad7[_0x3c47('0x44')],_0x4d3f23);}_0x5f1ad7=_['merge']({},_0x5f1ad7,_0x4f1b21[_0x3c47('0x34')]);return db[_0x3c47('0x3a')][_0x3c47('0x18')]({'where':_0x5f1ad7[_0x3c47('0x44')]})[_0x3c47('0x1c')](function(_0x401f28){_0x5b4838[_0x3c47('0x18')]=_0x401f28;if(_0x4f1b21[_0x3c47('0x29')][_0x3c47('0x32')]){_0x5f1ad7[_0x3c47('0x33')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x5f1ad7);})[_0x3c47('0x1c')](function(_0x33abb9){_0x5b4838[_0x3c47('0x4b')]=_0x33abb9;return _0x5b4838;});}})['then'](respondWithFilteredResult(_0x1c7b89,_0x5f1ad7))['catch'](handleError(_0x1c7b89,null));};exports[_0x3c47('0x4c')]=function(_0x22d861,_0x1eb0e8){return db[_0x3c47('0x23')][_0x3c47('0x35')]({'where':{'id':_0x22d861[_0x3c47('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1eb0e8,null))[_0x3c47('0x1c')](function(_0x29d7ad){if(_0x29d7ad){return _0x29d7ad['setTags'](_0x22d861['body']['ids'],_[_0x3c47('0x4d')](_0x22d861['body'],[_0x3c47('0x3b'),'id'])||{})[_0x3c47('0x4e')](function(){return db[_0x3c47('0x4f')]['findAll']({'attributes':['id',_0x3c47('0x20'),_0x3c47('0x50')],'where':{'id':_0x22d861[_0x3c47('0x37')][_0x3c47('0x3b')]}});})[_0x3c47('0x1c')](function(_0x146179){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x22d861[_0x3c47('0x2c')]['id']),'tags':_0x146179||[]});return{'id':Number(_0x22d861['params']['id']),'tags':_0x146179||[]};});}})[_0x3c47('0x1c')](respondWithResult(_0x1eb0e8,null))[_0x3c47('0x2b')](handleError(_0x1eb0e8,null));};exports[_0x3c47('0x51')]=function(_0x124be7,_0x3e047c){return db['WhatsappInteraction'][_0x3c47('0x35')]({'where':{'id':_0x124be7[_0x3c47('0x2c')]['id']}})[_0x3c47('0x1c')](handleEntityNotFound(_0x3e047c,null))[_0x3c47('0x1c')](function(_0x4ed0ab){if(_0x4ed0ab){return _0x4ed0ab['removeTags'](_0x124be7['query'][_0x3c47('0x3b')]);}})['then'](respondWithStatusCode(_0x3e047c,null))[_0x3c47('0x2b')](handleError(_0x3e047c,null));};exports[_0x3c47('0x52')]=function(_0x328a15,_0x1fbfc1){var _0x58df3a=moment()['unix']()[_0x3c47('0x53')]();var _0x4c5014=path[_0x3c47('0x54')](config['root'],'server','files',_0x3c47('0x55'));var _0x19a23c=path[_0x3c47('0x54')](config[_0x3c47('0x56')],'server',_0x3c47('0x57'),_0x3c47('0x58'));var _0x1008b7=path[_0x3c47('0x54')](_0x4c5014,_0x58df3a);var _0x6fc092=util[_0x3c47('0x4a')](_0x3c47('0x59'),_0x328a15[_0x3c47('0x2c')]['id'],_0x58df3a);var _0x9ae546=path[_0x3c47('0x54')](_0x4c5014,_0x6fc092);var _0x4b0a26=[];_0x4b0a26['push']({'model':db[_0x3c47('0x5a')],'as':_0x3c47('0x5a'),'attributes':['id',_0x3c47('0x5b')],'raw':!![]});_0x4b0a26['push']({'model':db[_0x3c47('0x5c')],'as':_0x3c47('0x5d'),'attributes':['id',_0x3c47('0x5e'),_0x3c47('0x5f')],'raw':!![]});if(_0x328a15[_0x3c47('0x29')][_0x3c47('0x58')]){_0x4b0a26[_0x3c47('0x60')]({'model':db[_0x3c47('0x61')],'as':'Attachment','raw':!![]});}var _0x18a927=[{'model':db[_0x3c47('0x3a')],'as':_0x3c47('0x62'),'attributes':['id',_0x3c47('0x37'),_0x3c47('0x63'),_0x3c47('0x64'),_0x3c47('0x65'),'read'],'include':_0x4b0a26}];_0x18a927['push']({'model':db['WhatsappAccount'],'as':_0x3c47('0x66'),'attributes':['id','name']});_0x18a927['push']({'model':db[_0x3c47('0x5a')],'as':'Owner','attributes':['id','fullname']});return db[_0x3c47('0x23')][_0x3c47('0x35')]({'where':{'id':_0x328a15[_0x3c47('0x2c')]['id']},'include':_0x18a927})['then'](handleEntityNotFound(_0x1fbfc1,null))[_0x3c47('0x1c')](function(_0x53940d){if(_0x53940d){var _0x579d3b=_0x53940d['get']({'plain':!![]});fs['mkdirSync'](_0x1008b7);var _0x2d8605={'channel':_0x3c47('0x67'),'account':_0x579d3b['Account'][_0x3c47('0x20')],'agent':_0x579d3b[_0x3c47('0x68')]?_0x579d3b[_0x3c47('0x68')][_0x3c47('0x5b')]:_0x3c47('0x69'),'createdAt':moment(_0x579d3b['createdAt'])['format'](_0x3c47('0x6a'))[_0x3c47('0x53')](),'closedAt':_0x579d3b[_0x3c47('0x6b')]?moment(_0x579d3b[_0x3c47('0x6c')])[_0x3c47('0x4a')](_0x3c47('0x6a'))[_0x3c47('0x53')]():'','disposition':_0x579d3b[_0x3c47('0x6d')],'messages':_(_0x579d3b['Messages'])[_0x3c47('0x46')]({'secret':![]})[_0x3c47('0x6e')](function(_0x25758c){if(_0x25758c[_0x3c47('0x61')]){var _0x194df4=path[_0x3c47('0x54')](_0x19a23c,_0x25758c[_0x3c47('0x61')][_0x3c47('0x6f')]);if(fs[_0x3c47('0x70')](_0x194df4)){fs['createReadStream'](_0x194df4)[_0x3c47('0x71')](fs[_0x3c47('0x72')](path['join'](_0x1008b7,_0x25758c['Attachment'][_0x3c47('0x6f')])));}}return{'date':moment(_0x25758c[_0x3c47('0x63')])['format'](_0x3c47('0x6a'))['toString'](),'sender':_0x25758c['direction']===_0x3c47('0x73')?_0x25758c[_0x3c47('0x5a')]?_0x25758c[_0x3c47('0x5a')][_0x3c47('0x5b')]:_0x3c47('0x74'):_0x25758c[_0x3c47('0x5d')][_0x3c47('0x5e')]+(_0x25758c[_0x3c47('0x5d')][_0x3c47('0x5f')]?'\x20'+_0x25758c['Contact'][_0x3c47('0x5f')]:''),'body':_0x25758c[_0x3c47('0x61')]?_0x25758c['Attachment'][_0x3c47('0x6f')]:_0x25758c[_0x3c47('0x37')],'direction':_0x25758c[_0x3c47('0x64')]==='out'?'A':'C','secret':_0x25758c[_0x3c47('0x65')],'read':_0x25758c[_0x3c47('0x75')],'attachment':_0x25758c['Attachment']};})['value']()};return ejs[_0x3c47('0x76')](path[_0x3c47('0x54')](config[_0x3c47('0x56')],'server',_0x3c47('0x77'),'downloadInteraction.ejs'),{'interaction':_0x2d8605})[_0x3c47('0x1c')](function(_0x27f93f){var _0x4d2c5c=path[_0x3c47('0x54')](_0x1008b7,_0x3c47('0x78')+_0x579d3b['id']+'-'+_0x58df3a+_0x3c47('0x79'));var _0x3a4fcb={'path':_0x4d2c5c,'channel':'Whatsapp','interactionId':_0x579d3b['id']};return pdf[_0x3c47('0x7a')](_0x27f93f,_0x3a4fcb);})['then'](function(){return new BPromise(function(_0x2aab4b,_0x43eb58){zipdir(_0x1008b7,{'saveTo':_0x9ae546},function(_0x11ce6c,_0x5a5b86){if(_0x11ce6c)return _0x43eb58(_0x11ce6c);return _0x2aab4b(_0x5a5b86);});})[_0x3c47('0x1c')](function(){return new BPromise(function(_0x2314ee,_0x5ccd5d){rimraf(_0x1008b7,function(_0x52f3a1){if(_0x52f3a1)_0x5ccd5d(_0x52f3a1);return _0x2314ee();});});})[_0x3c47('0x1c')](function(){return _0x1fbfc1[_0x3c47('0x52')](_0x9ae546,_0x6fc092,function(_0xe1590e){if(_0xe1590e){console[_0x3c47('0x7b')]('err',_0xe1590e);}else{fs[_0x3c47('0x7c')](_0x9ae546);}});});});}else{return _0x1fbfc1[_0x3c47('0x1e')](0xc8);}})[_0x3c47('0x2b')](handleError(_0x1fbfc1,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6063d19..ddbe093 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 _0xe87e=['WhatsappMessage','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x5121f7,_0x189f9c){var _0x26fdf8=function(_0x49e5fb){while(--_0x49e5fb){_0x5121f7['push'](_0x5121f7['shift']());}};_0x26fdf8(++_0x189f9c);}(_0xe87e,0x17d));var _0xee87=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xe87e[_0x2272b5];return _0x110156;};'use strict';var EventEmitter=require(_0xee87('0x0'));var WhatsappInteraction=require(_0xee87('0x1'))['db'][_0xee87('0x2')];var WhatsappMessage=require(_0xee87('0x1'))['db'][_0xee87('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee87('0x4'),'afterUpdate':_0xee87('0x5'),'afterDestroy':_0xee87('0x6')};function emitEvent(_0x41d461){return function(_0x303bae,_0x1e1488,_0x46446e){_0x303bae['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2bde4c){_0x303bae[_0xee87('0x7')](_0xee87('0x8'),_0x2bde4c[_0xee87('0x9')](function(_0x2d8349){return{'id':_0x2d8349['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x303bae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee87('0xa')](function(_0x2104c6){_0x303bae[_0xee87('0x7')](_0xee87('0xb'),_0x2104c6['length']);WhatsappInteractionEvents[_0xee87('0xc')](_0x41d461+':'+_0x303bae['id'],_0x303bae);WhatsappInteractionEvents[_0xee87('0xc')](_0x41d461,_0x303bae);_0x46446e(null);})['catch'](_0x46446e(null));};}for(var e in events){if(events[_0xee87('0xd')](e)){var event=events[e];WhatsappInteraction[_0xee87('0xe')](e,emitEvent(event));}}module[_0xee87('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3f49=['../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','Users','map','findAll','then','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x40815c,_0x4db301){var _0x5a3dbc=function(_0x253f1b){while(--_0x253f1b){_0x40815c['push'](_0x40815c['shift']());}};_0x5a3dbc(++_0x4db301);}(_0x3f49,0x11f));var _0x93f4=function(_0x5bf2ee,_0x3c2d82){_0x5bf2ee=_0x5bf2ee-0x0;var _0x13949b=_0x3f49[_0x5bf2ee];return _0x13949b;};'use strict';var EventEmitter=require(_0x93f4('0x0'));var WhatsappInteraction=require(_0x93f4('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x93f4('0x1'))['db'][_0x93f4('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x93f4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x93f4('0x4'),'afterDestroy':_0x93f4('0x5')};function emitEvent(_0x58a15b){return function(_0x58fe08,_0x397bcc,_0x38eb6c){_0x58fe08[_0x93f4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x956b50){_0x58fe08['setDataValue'](_0x93f4('0x7'),_0x956b50[_0x93f4('0x8')](function(_0x17b4fd){return{'id':_0x17b4fd['id']};}));return WhatsappMessage[_0x93f4('0x9')]({'where':{'WhatsappInteractionId':_0x58fe08['id'],'direction':'in','read':![]},'raw':!![]});})[_0x93f4('0xa')](function(_0x35976f){_0x58fe08[_0x93f4('0xb')](_0x93f4('0xc'),_0x35976f['length']);WhatsappInteractionEvents['emit'](_0x58a15b+':'+_0x58fe08['id'],_0x58fe08);WhatsappInteractionEvents[_0x93f4('0xd')](_0x58a15b,_0x58fe08);_0x38eb6c(null);})[_0x93f4('0xe')](_0x38eb6c(null));};}for(var e in events){if(events[_0x93f4('0xf')](e)){var event=events[e];WhatsappInteraction[_0x93f4('0x10')](e,emitEvent(event));}}module[_0x93f4('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3d9f46f..ebd4738 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 _0xca6d=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xca6d,0x75));var _0xdca6=function(_0x401195,_0x156665){_0x401195=_0x401195-0x0;var _0x3af1db=_0xca6d[_0x401195];return _0x3af1db;};'use strict';var _=require('lodash');var util=require(_0xdca6('0x0'));var logger=require(_0xdca6('0x1'))(_0xdca6('0x2'));var moment=require(_0xdca6('0x3'));var BPromise=require(_0xdca6('0x4'));var rp=require(_0xdca6('0x5'));var fs=require('fs');var path=require(_0xdca6('0x6'));var rimraf=require('rimraf');var config=require(_0xdca6('0x7'));var attributes=require(_0xdca6('0x8'));module[_0xdca6('0x9')]=function(_0x1da642,_0x51f4b0){return _0x1da642['define']('WhatsappInteraction',attributes,{'tableName':_0xdca6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25e818,_0x598edf,_0x32adeb){if(_0x25e818[_0xdca6('0xb')](_0xdca6('0xc'))){_0x25e818[_0xdca6('0xd')]=moment()[_0xdca6('0xe')](_0xdca6('0xf'));}_0x32adeb(null,_0x25e818);}}});}; \ No newline at end of file +var _0xa29e=['request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','lodash','../../config/logger','api','moment','bluebird'];(function(_0x32e0c4,_0x5cec19){var _0x156c1d=function(_0x4682db){while(--_0x4682db){_0x32e0c4['push'](_0x32e0c4['shift']());}};_0x156c1d(++_0x5cec19);}(_0xa29e,0x18b));var _0xea29=function(_0x12c676,_0x4e075b){_0x12c676=_0x12c676-0x0;var _0x1d2c8d=_0xa29e[_0x12c676];return _0x1d2c8d;};'use strict';var _=require(_0xea29('0x0'));var util=require('util');var logger=require(_0xea29('0x1'))(_0xea29('0x2'));var moment=require(_0xea29('0x3'));var BPromise=require(_0xea29('0x4'));var rp=require(_0xea29('0x5'));var fs=require('fs');var path=require(_0xea29('0x6'));var rimraf=require(_0xea29('0x7'));var config=require(_0xea29('0x8'));var attributes=require(_0xea29('0x9'));module[_0xea29('0xa')]=function(_0x510af3,_0x87508b){return _0x510af3['define'](_0xea29('0xb'),attributes,{'tableName':_0xea29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xab92b5,_0x5e55f4,_0x5b197b){if(_0xab92b5[_0xea29('0xd')]('closed')){_0xab92b5[_0xea29('0xe')]=moment()[_0xea29('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5b197b(null,_0xab92b5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c5a8c11..e2fdb38 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 _0xe637=['error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','WhatsappInteraction','update','body','options','where','attributes','UpdateWhatsappInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x234719,_0x53feaa){var _0x1d4764=function(_0x2461d5){while(--_0x2461d5){_0x234719['push'](_0x234719['shift']());}};_0x1d4764(++_0x53feaa);}(_0xe637,0x82));var _0x7e63=function(_0x5b7802,_0x41639b){_0x5b7802=_0x5b7802-0x0;var _0x263f29=_0xe637[_0x5b7802];return _0x263f29;};'use strict';var _=require(_0x7e63('0x0'));var util=require(_0x7e63('0x1'));var moment=require('moment');var BPromise=require(_0x7e63('0x2'));var rs=require(_0x7e63('0x3'));var fs=require('fs');var Redis=require(_0x7e63('0x4'));var db=require(_0x7e63('0x5'))['db'];var utils=require(_0x7e63('0x6'));var logger=require(_0x7e63('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e63('0x8'));var client=jayson[_0x7e63('0x9')]['http']({'port':0x232a});config[_0x7e63('0xa')]=_[_0x7e63('0xb')](config[_0x7e63('0xa')],{'host':_0x7e63('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e63('0xa')]));require(_0x7e63('0xd'))[_0x7e63('0xe')](socket);function respondWithRpcPromise(_0x3585a0,_0x5541e9,_0x5d0bbd){return new BPromise(function(_0x19cf96,_0x4efc75){return client[_0x7e63('0xf')](_0x3585a0,_0x5d0bbd)[_0x7e63('0x10')](function(_0x27d965){logger[_0x7e63('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x5541e9,_0x7e63('0x12'));logger[_0x7e63('0x13')](_0x7e63('0x14'),_0x5541e9,_0x7e63('0x12'),JSON[_0x7e63('0x15')](_0x27d965));if(_0x27d965[_0x7e63('0x16')]){if(_0x27d965['error'][_0x7e63('0x17')]===0x1f4){logger[_0x7e63('0x16')](_0x7e63('0x18'),_0x5541e9,_0x27d965['error'][_0x7e63('0x19')]);return _0x4efc75(_0x27d965[_0x7e63('0x16')][_0x7e63('0x19')]);}logger[_0x7e63('0x16')](_0x7e63('0x18'),_0x5541e9,_0x27d965[_0x7e63('0x16')][_0x7e63('0x19')]);return _0x19cf96(_0x27d965['error']['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5541e9,_0x7e63('0x12'));_0x19cf96(_0x27d965['result']['message']);}})[_0x7e63('0x1a')](function(_0x23854a){logger[_0x7e63('0x16')](_0x7e63('0x18'),_0x5541e9,_0x23854a);_0x4efc75(_0x23854a);});});}exports['UpdateWhatsappInteraction']=function(_0x32029a){var _0x4b43a4=this;return new Promise(function(_0x3a1824,_0x8f858e){return db[_0x7e63('0x1b')][_0x7e63('0x1c')](_0x32029a[_0x7e63('0x1d')],{'raw':_0x32029a['options']?_0x32029a[_0x7e63('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32029a[_0x7e63('0x1e')]?_0x32029a[_0x7e63('0x1e')][_0x7e63('0x1f')]||null:null,'attributes':_0x32029a['options']?_0x32029a['options'][_0x7e63('0x20')]||null:null,'limit':_0x32029a[_0x7e63('0x1e')]?_0x32029a[_0x7e63('0x1e')]['limit']||null:null})[_0x7e63('0x10')](function(_0x255d58){logger[_0x7e63('0x11')](_0x7e63('0x21'),_0x32029a);logger[_0x7e63('0x13')](_0x7e63('0x21'),_0x32029a,JSON[_0x7e63('0x15')](_0x255d58));_0x3a1824(_0x255d58);})[_0x7e63('0x1a')](function(_0x4ac603){logger[_0x7e63('0x16')](_0x7e63('0x21'),_0x4ac603[_0x7e63('0x19')],_0x32029a);_0x8f858e(_0x4b43a4[_0x7e63('0x16')](0x1f4,_0x4ac603[_0x7e63('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3c9bd3){return new Promise(function(_0x30b7e7,_0x4a393d){return db[_0x7e63('0x1b')]['find']({'where':_0x3c9bd3[_0x7e63('0x1e')]?_0x3c9bd3[_0x7e63('0x1e')][_0x7e63('0x1f')]||null:null})['then'](function(_0x5f286f){if(_0x5f286f){return _0x5f286f[_0x7e63('0x22')](_0x3c9bd3['body'][_0x7e63('0x23')],_[_0x7e63('0x24')](_0x3c9bd3[_0x7e63('0x1d')],[_0x7e63('0x23'),'id'])||{});}})['spread'](function(_0x1b066d){logger[_0x7e63('0x11')](_0x7e63('0x25'),_0x3c9bd3);logger['debug']('AddTags',_0x3c9bd3,JSON[_0x7e63('0x15')](_0x1b066d));_0x30b7e7(_0x1b066d);})['catch'](function(_0x36bc1d){logger[_0x7e63('0x16')](_0x7e63('0x25'),_0x36bc1d[_0x7e63('0x19')],_0x3c9bd3);_0x4a393d(_this['error'](0x1f4,_0x36bc1d['message']));});});}; \ No newline at end of file +var _0x3249=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','body','options','raw','where','attributes','limit','then','AddTagsToWhatsappInteraction','addTags','omit','ids','spread','AddTags','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','info'];(function(_0x5b7b6a,_0x150131){var _0x2bfec0=function(_0x3578fd){while(--_0x3578fd){_0x5b7b6a['push'](_0x5b7b6a['shift']());}};_0x2bfec0(++_0x150131);}(_0x3249,0x11a));var _0x9324=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x3249[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x9324('0x0'));var util=require(_0x9324('0x1'));var moment=require('moment');var BPromise=require(_0x9324('0x2'));var rs=require(_0x9324('0x3'));var fs=require('fs');var Redis=require(_0x9324('0x4'));var db=require(_0x9324('0x5'))['db'];var utils=require(_0x9324('0x6'));var logger=require(_0x9324('0x7'))(_0x9324('0x8'));var config=require(_0x9324('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9324('0xa')][_0x9324('0xb')]({'port':0x232a});config[_0x9324('0xc')]=_[_0x9324('0xd')](config[_0x9324('0xc')],{'host':_0x9324('0xe'),'port':0x18eb});var socket=require(_0x9324('0xf'))(new Redis(config['redis']));require(_0x9324('0x10'))[_0x9324('0x11')](socket);function respondWithRpcPromise(_0x1146cf,_0x504915,_0x439067){return new BPromise(function(_0x21f174,_0x48e703){return client['request'](_0x1146cf,_0x439067)['then'](function(_0x45d1cd){logger[_0x9324('0x12')](_0x9324('0x13'),_0x504915,_0x9324('0x14'));logger['debug'](_0x9324('0x15'),_0x504915,_0x9324('0x14'),JSON[_0x9324('0x16')](_0x45d1cd));if(_0x45d1cd['error']){if(_0x45d1cd[_0x9324('0x17')][_0x9324('0x18')]===0x1f4){logger['error'](_0x9324('0x13'),_0x504915,_0x45d1cd[_0x9324('0x17')][_0x9324('0x19')]);return _0x48e703(_0x45d1cd[_0x9324('0x17')]['message']);}logger[_0x9324('0x17')](_0x9324('0x13'),_0x504915,_0x45d1cd[_0x9324('0x17')][_0x9324('0x19')]);return _0x21f174(_0x45d1cd[_0x9324('0x17')][_0x9324('0x19')]);}else{logger['info'](_0x9324('0x13'),_0x504915,_0x9324('0x14'));_0x21f174(_0x45d1cd[_0x9324('0x1a')][_0x9324('0x19')]);}})[_0x9324('0x1b')](function(_0x1e78f5){logger[_0x9324('0x17')](_0x9324('0x13'),_0x504915,_0x1e78f5);_0x48e703(_0x1e78f5);});});}exports[_0x9324('0x1c')]=function(_0x509b8b){var _0xf2d839=this;return new Promise(function(_0x150b1e,_0x42ad47){return db['WhatsappInteraction']['update'](_0x509b8b[_0x9324('0x1d')],{'raw':_0x509b8b[_0x9324('0x1e')]?_0x509b8b[_0x9324('0x1e')][_0x9324('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509b8b[_0x9324('0x1e')]?_0x509b8b['options'][_0x9324('0x20')]||null:null,'attributes':_0x509b8b[_0x9324('0x1e')]?_0x509b8b[_0x9324('0x1e')][_0x9324('0x21')]||null:null,'limit':_0x509b8b[_0x9324('0x1e')]?_0x509b8b[_0x9324('0x1e')][_0x9324('0x22')]||null:null})[_0x9324('0x23')](function(_0x3eac46){logger[_0x9324('0x12')](_0x9324('0x1c'),_0x509b8b);logger['debug'](_0x9324('0x1c'),_0x509b8b,JSON['stringify'](_0x3eac46));_0x150b1e(_0x3eac46);})[_0x9324('0x1b')](function(_0x5e3fb4){logger[_0x9324('0x17')](_0x9324('0x1c'),_0x5e3fb4[_0x9324('0x19')],_0x509b8b);_0x42ad47(_0xf2d839['error'](0x1f4,_0x5e3fb4[_0x9324('0x19')]));});});};exports[_0x9324('0x24')]=function(_0x151279){return new Promise(function(_0x58615f,_0x573c8f){return db['WhatsappInteraction']['find']({'where':_0x151279[_0x9324('0x1e')]?_0x151279[_0x9324('0x1e')][_0x9324('0x20')]||null:null})['then'](function(_0x144941){if(_0x144941){return _0x144941[_0x9324('0x25')](_0x151279[_0x9324('0x1d')]['ids'],_[_0x9324('0x26')](_0x151279[_0x9324('0x1d')],[_0x9324('0x27'),'id'])||{});}})[_0x9324('0x28')](function(_0xe47d25){logger['info'](_0x9324('0x29'),_0x151279);logger[_0x9324('0x2a')]('AddTags',_0x151279,JSON[_0x9324('0x16')](_0xe47d25));_0x58615f(_0xe47d25);})['catch'](function(_0x4d5057){logger[_0x9324('0x17')]('AddTags',_0x4d5057['message'],_0x151279);_0x573c8f(_this[_0x9324('0x17')](0x1f4,_0x4d5057[_0x9324('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1f0982f..f38771e 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 _0x2517=['emit','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x4cb728,_0x47ae6d){var _0x1e6752=function(_0x5cad65){while(--_0x5cad65){_0x4cb728['push'](_0x4cb728['shift']());}};_0x1e6752(++_0x47ae6d);}(_0x2517,0x7a));var _0x7251=function(_0x2f95fb,_0x437285){_0x2f95fb=_0x2f95fb-0x0;var _0x14e7c0=_0x2517[_0x2f95fb];return _0x14e7c0;};'use strict';var WhatsappInteractionEvents=require(_0x7251('0x0'));var events=[_0x7251('0x1'),_0x7251('0x2'),_0x7251('0x3')];function createListener(_0x14988c,_0x2dbae4){return function(_0x5a2bc3){_0x2dbae4[_0x7251('0x4')](_0x14988c,_0x5a2bc3);};}function removeListener(_0x26cb7d,_0x1cd657){return function(){WhatsappInteractionEvents['removeListener'](_0x26cb7d,_0x1cd657);};}exports['register']=function(_0x37422e){for(var _0x399b1e=0x0,_0x29a0c1=events[_0x7251('0x5')];_0x399b1e<_0x29a0c1;_0x399b1e++){var _0x36651d=events[_0x399b1e];var _0x2d1c15=createListener(_0x7251('0x6')+_0x36651d,_0x37422e);WhatsappInteractionEvents['on'](_0x36651d,_0x2d1c15);}}; \ No newline at end of file +var _0xa0d4=['./whatsappInteraction.events','save','update','emit','removeListener','register','whatsappInteraction:'];(function(_0x2109fb,_0x9ea617){var _0x591ed2=function(_0x2b88e3){while(--_0x2b88e3){_0x2109fb['push'](_0x2109fb['shift']());}};_0x591ed2(++_0x9ea617);}(_0xa0d4,0xc4));var _0x4a0d=function(_0x3d1eff,_0x2cf678){_0x3d1eff=_0x3d1eff-0x0;var _0x26e4c8=_0xa0d4[_0x3d1eff];return _0x26e4c8;};'use strict';var WhatsappInteractionEvents=require(_0x4a0d('0x0'));var events=[_0x4a0d('0x1'),'remove',_0x4a0d('0x2')];function createListener(_0x54f0cc,_0x17e622){return function(_0x53d956){_0x17e622[_0x4a0d('0x3')](_0x54f0cc,_0x53d956);};}function removeListener(_0x4a580e,_0x47535b){return function(){WhatsappInteractionEvents[_0x4a0d('0x4')](_0x4a580e,_0x47535b);};}exports[_0x4a0d('0x5')]=function(_0x4317a3){for(var _0x4e43e2=0x0,_0x228192=events['length'];_0x4e43e2<_0x228192;_0x4e43e2++){var _0x27c275=events[_0x4e43e2];var _0x158c4b=createListener(_0x4a0d('0x6')+_0x27c275,_0x4317a3);WhatsappInteractionEvents['on'](_0x27c275,_0x158c4b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 36cd214..9fa9a30 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 _0xb781=['/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x3e4842,_0x1aeb06){var _0x2a6a0c=function(_0x2c3326){while(--_0x2c3326){_0x3e4842['push'](_0x3e4842['shift']());}};_0x2a6a0c(++_0x1aeb06);}(_0xb781,0x99));var _0x1b78=function(_0x17ac58,_0x5b4cc3){_0x17ac58=_0x17ac58-0x0;var _0x296a99=_0xb781[_0x17ac58];return _0x296a99;};'use strict';var multer=require('multer');var util=require(_0x1b78('0x0'));var path=require(_0x1b78('0x1'));var timeout=require(_0x1b78('0x2'));var express=require('express');var router=express[_0x1b78('0x3')]();var fs_extra=require(_0x1b78('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1b78('0x5'));var config=require(_0x1b78('0x6'));var controller=require(_0x1b78('0x7'));router[_0x1b78('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1b78('0x8')](_0x1b78('0x9'),auth[_0x1b78('0xa')](),controller[_0x1b78('0xb')]);router['get'](_0x1b78('0xc'),auth[_0x1b78('0xa')](),controller[_0x1b78('0xd')]);router[_0x1b78('0xe')]('/',auth[_0x1b78('0xa')](),interaction[_0x1b78('0xf')](_0x1b78('0x10'),_0x1b78('0x11')),controller[_0x1b78('0x12')]);router[_0x1b78('0xe')](_0x1b78('0x13'),controller['status']);router[_0x1b78('0x14')](_0x1b78('0xc'),auth[_0x1b78('0xa')](),controller[_0x1b78('0x15')]);router['put'](_0x1b78('0x16'),auth[_0x1b78('0xa')](),controller[_0x1b78('0x17')]);router[_0x1b78('0x14')]('/:id/reject',auth[_0x1b78('0xa')](),controller[_0x1b78('0x18')]);router[_0x1b78('0x19')](_0x1b78('0xc'),auth[_0x1b78('0xa')](),controller[_0x1b78('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbade=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject','reject','exports','multer','util','path'];(function(_0x32b5b1,_0x1da9ad){var _0x1fcc4c=function(_0x120e25){while(--_0x120e25){_0x32b5b1['push'](_0x32b5b1['shift']());}};_0x1fcc4c(++_0x1da9ad);}(_0xbade,0xf9));var _0xebad=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xbade[_0x586fa2];return _0x515be9;};'use strict';var multer=require(_0xebad('0x0'));var util=require(_0xebad('0x1'));var path=require(_0xebad('0x2'));var timeout=require(_0xebad('0x3'));var express=require(_0xebad('0x4'));var router=express[_0xebad('0x5')]();var fs_extra=require(_0xebad('0x6'));var auth=require(_0xebad('0x7'));var interaction=require(_0xebad('0x8'));var config=require(_0xebad('0x9'));var controller=require(_0xebad('0xa'));router[_0xebad('0xb')]('/',auth[_0xebad('0xc')](),controller[_0xebad('0xd')]);router[_0xebad('0xb')]('/describe',auth[_0xebad('0xc')](),controller[_0xebad('0xe')]);router[_0xebad('0xb')](_0xebad('0xf'),auth[_0xebad('0xc')](),controller[_0xebad('0x10')]);router[_0xebad('0x11')]('/',auth['isAuthenticated'](),interaction[_0xebad('0x12')]('whatsapp',_0xebad('0x13')),controller[_0xebad('0x14')]);router[_0xebad('0x11')]('/:id/status',controller[_0xebad('0x15')]);router[_0xebad('0x16')](_0xebad('0xf'),auth['isAuthenticated'](),controller[_0xebad('0x17')]);router[_0xebad('0x16')](_0xebad('0x18'),auth[_0xebad('0xc')](),controller['accept']);router[_0xebad('0x16')](_0xebad('0x19'),auth['isAuthenticated'](),controller[_0xebad('0x1a')]);router['delete'](_0xebad('0xf'),auth[_0xebad('0xc')](),controller['destroy']);module[_0xebad('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f5593b..319a13d 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 _0x9d95=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x5eb70f,_0x15e9ee){var _0x14090c=function(_0x353739){while(--_0x353739){_0x5eb70f['push'](_0x5eb70f['shift']());}};_0x14090c(++_0x15e9ee);}(_0x9d95,0x1b1));var _0x59d9=function(_0x1c5fee,_0x221af1){_0x1c5fee=_0x1c5fee-0x0;var _0x363ede=_0x9d95[_0x1c5fee];return _0x363ede;};'use strict';var Sequelize=require(_0x59d9('0x0'));module[_0x59d9('0x1')]={'body':{'type':Sequelize[_0x59d9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x59d9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x59d9('0x4')]('in',_0x59d9('0x5')),'defaultValue':_0x59d9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59d9('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x59d9('0x7')]},'secret':{'type':Sequelize[_0x59d9('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x59d9('0x2')]}}; \ No newline at end of file +var _0xa027=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x4b6a53,_0x4540e4){var _0x1020eb=function(_0x292a58){while(--_0x292a58){_0x4b6a53['push'](_0x4b6a53['shift']());}};_0x1020eb(++_0x4540e4);}(_0xa027,0x1dd));var _0x7a02=function(_0x12f327,_0x23fef){_0x12f327=_0x12f327-0x0;var _0x248d7a=_0xa027[_0x12f327];return _0x248d7a;};'use strict';var Sequelize=require(_0x7a02('0x0'));module['exports']={'body':{'type':Sequelize[_0x7a02('0x1')](_0x7a02('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7a02('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7a02('0x4')]('in','out'),'defaultValue':_0x7a02('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7a02('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7a02('0x6')]},'readAt':{'type':Sequelize[_0x7a02('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7a02('0x6')]},'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 f4587dd..6117159 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 _0xf4cb=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','create','body','params','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','whatsapp','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1f16be,_0x49c827){var _0x5d3305=function(_0x2f05c1){while(--_0x2f05c1){_0x1f16be['push'](_0x1f16be['shift']());}};_0x5d3305(++_0x49c827);}(_0xf4cb,0x18f));var _0xbf4c=function(_0xdeccc7,_0x1dda4a){_0xdeccc7=_0xdeccc7-0x0;var _0x4894ab=_0xf4cb[_0xdeccc7];return _0x4894ab;};'use strict';var emlformat=require(_0xbf4c('0x0'));var rimraf=require(_0xbf4c('0x1'));var zipdir=require(_0xbf4c('0x2'));var jsonpatch=require(_0xbf4c('0x3'));var rp=require(_0xbf4c('0x4'));var moment=require(_0xbf4c('0x5'));var BPromise=require(_0xbf4c('0x6'));var Mustache=require('mustache');var util=require(_0xbf4c('0x7'));var path=require(_0xbf4c('0x8'));var sox=require(_0xbf4c('0x9'));var csv=require(_0xbf4c('0xa'));var ejs=require(_0xbf4c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf4c('0xc'));var squel=require(_0xbf4c('0xd'));var crypto=require(_0xbf4c('0xe'));var jsforce=require(_0xbf4c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbf4c('0xa'));var querystring=require('querystring');var Papa=require(_0xbf4c('0x10'));var Redis=require(_0xbf4c('0x11'));var authService=require(_0xbf4c('0x12'));var qs=require(_0xbf4c('0x13'));var as=require(_0xbf4c('0x14'));var hardwareService=require(_0xbf4c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbf4c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbf4c('0x17'));var db=require(_0xbf4c('0x18'))['db'];config[_0xbf4c('0x19')]=_[_0xbf4c('0x1a')](config[_0xbf4c('0x19')],{'host':_0xbf4c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbf4c('0x1c'))['register'](socket);var jayson=require(_0xbf4c('0x1d'));var client=jayson[_0xbf4c('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b4dbe,_0x4e32bb,_0xa2b0ac,_0x25d9a2){return new BPromise(function(_0x5cc163,_0x1ba1d2){var _0x399797=_0x25d9a2||client;return _0x399797[_0xbf4c('0x1f')](_0x4b4dbe,_0xa2b0ac)[_0xbf4c('0x20')](function(_0x4406d6){logger['info'](_0xbf4c('0x21'),_0x4e32bb,_0xbf4c('0x22'));logger[_0xbf4c('0x23')](_0xbf4c('0x24'),_0x4e32bb,_0xbf4c('0x22'),JSON[_0xbf4c('0x25')](_0x4406d6));if(_0x4406d6[_0xbf4c('0x26')]){if(_0x4406d6[_0xbf4c('0x26')][_0xbf4c('0x27')]===0x1f4){logger['error'](_0xbf4c('0x21'),_0x4e32bb,_0x4406d6[_0xbf4c('0x26')][_0xbf4c('0x28')]);return _0x1ba1d2(_0x4406d6[_0xbf4c('0x26')]['message']);}logger[_0xbf4c('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4e32bb,_0x4406d6[_0xbf4c('0x26')][_0xbf4c('0x28')]);return _0x5cc163(_0x4406d6[_0xbf4c('0x26')][_0xbf4c('0x28')]);}else{logger[_0xbf4c('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x4e32bb,_0xbf4c('0x22'));_0x5cc163(_0x4406d6[_0xbf4c('0x2a')][_0xbf4c('0x28')]);}})[_0xbf4c('0x2b')](function(_0x408f8b){logger[_0xbf4c('0x26')](_0xbf4c('0x21'),_0x4e32bb,_0x408f8b);_0x1ba1d2(_0x408f8b);});});}function respondWithStatusCode(_0x3abb66,_0x5a3799){_0x5a3799=_0x5a3799||0xcc;return function(_0x1a6ed6){if(_0x1a6ed6){return _0x3abb66[_0xbf4c('0x2c')](_0x5a3799);}return _0x3abb66[_0xbf4c('0x2d')](_0x5a3799)[_0xbf4c('0x2e')]();};}function respondWithResult(_0x37062f,_0xb44940){_0xb44940=_0xb44940||0xc8;return function(_0x18638c){if(_0x18638c){return _0x37062f['status'](_0xb44940)['json'](_0x18638c);}};}function respondWithFilteredResult(_0x22d9b6,_0x542594){return function(_0x3751c5){if(_0x3751c5){var _0x440e70=typeof _0x542594['offset']===_0xbf4c('0x2f')&&typeof _0x542594[_0xbf4c('0x30')]===_0xbf4c('0x2f');var _0x46f09d=_0x3751c5['count'];var _0x488f9b=_0x440e70?0x0:_0x542594[_0xbf4c('0x31')];var _0x5e4a5e=_0x440e70?_0x3751c5[_0xbf4c('0x32')]:_0x542594[_0xbf4c('0x31')]+_0x542594[_0xbf4c('0x30')];var _0x2addda;if(_0x5e4a5e>=_0x46f09d){_0x5e4a5e=_0x46f09d;_0x2addda=0xc8;}else{_0x2addda=0xce;}_0x22d9b6[_0xbf4c('0x2d')](_0x2addda);return _0x22d9b6[_0xbf4c('0x33')]('Content-Range',_0x488f9b+'-'+_0x5e4a5e+'/'+_0x46f09d)[_0xbf4c('0x34')](_0x3751c5);}return null;};}function patchUpdates(_0x59ba0a){return function(_0x2d6684){try{jsonpatch[_0xbf4c('0x35')](_0x2d6684,_0x59ba0a,!![]);}catch(_0x303ca9){return BPromise[_0xbf4c('0x36')](_0x303ca9);}return _0x2d6684['save']();};}function saveUpdates(_0x215838,_0x24ce2f){return function(_0x151975){if(_0x151975){return _0x151975[_0xbf4c('0x37')](_0x215838)[_0xbf4c('0x20')](function(_0xee19ed){return _0xee19ed;});}return null;};}function removeEntity(_0x4bf622,_0x3ab324){return function(_0x1a4a07){if(_0x1a4a07){return _0x1a4a07[_0xbf4c('0x38')]()[_0xbf4c('0x20')](function(){_0x4bf622[_0xbf4c('0x2d')](0xcc)[_0xbf4c('0x2e')]();});}};}function handleEntityNotFound(_0x3c6da3,_0xe21e83){return function(_0xe2e5a6){if(!_0xe2e5a6){_0x3c6da3[_0xbf4c('0x2c')](0x194);}return _0xe2e5a6;};}function handleError(_0x8dc761,_0x149a52){_0x149a52=_0x149a52||0x1f4;return function(_0x422c81){logger['error'](_0x422c81[_0xbf4c('0x39')]);if(_0x422c81[_0xbf4c('0x3a')]){delete _0x422c81[_0xbf4c('0x3a')];}_0x8dc761[_0xbf4c('0x2d')](_0x149a52)[_0xbf4c('0x3b')](_0x422c81);};}exports[_0xbf4c('0x3c')]=function(_0x1e84b0,_0x39bf4f){var _0xe5b197={},_0x44792b={},_0x422a24={'count':0x0,'rows':[]};var _0x3c5771=_[_0xbf4c('0x3d')](db[_0xbf4c('0x3e')][_0xbf4c('0x3f')],function(_0x3864f7){return{'name':_0x3864f7[_0xbf4c('0x40')],'type':_0x3864f7[_0xbf4c('0x41')]['key']};});_0x44792b[_0xbf4c('0x42')]=_[_0xbf4c('0x3d')](_0x3c5771,_0xbf4c('0x3a'));_0x44792b[_0xbf4c('0x43')]=_[_0xbf4c('0x44')](_0x1e84b0[_0xbf4c('0x43')]);_0x44792b[_0xbf4c('0x45')]=_[_0xbf4c('0x46')](_0x44792b['model'],_0x44792b[_0xbf4c('0x43')]);_0xe5b197[_0xbf4c('0x47')]=_[_0xbf4c('0x46')](_0x44792b[_0xbf4c('0x42')],qs[_0xbf4c('0x48')](_0x1e84b0[_0xbf4c('0x43')]['fields']));_0xe5b197[_0xbf4c('0x47')]=_0xe5b197[_0xbf4c('0x47')][_0xbf4c('0x49')]?_0xe5b197[_0xbf4c('0x47')]:_0x44792b['model'];if(!_0x1e84b0['query']['hasOwnProperty'](_0xbf4c('0x4a'))){_0xe5b197[_0xbf4c('0x30')]=qs[_0xbf4c('0x30')](_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x30')]);_0xe5b197[_0xbf4c('0x31')]=qs[_0xbf4c('0x31')](_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x31')]);}_0xe5b197['order']=qs[_0xbf4c('0x4b')](_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x4b')]);_0xe5b197[_0xbf4c('0x4c')]=qs[_0xbf4c('0x45')](_[_0xbf4c('0x4d')](_0x1e84b0['query'],_0x44792b[_0xbf4c('0x45')]),_0x3c5771);if(_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x4e')]){_0xe5b197['where']=_[_0xbf4c('0x4f')](_0xe5b197['where'],{'$or':_[_0xbf4c('0x3d')](_0x3c5771,function(_0x997831){if(_0x997831[_0xbf4c('0x41')]!=='VIRTUAL'){var _0x3158f9={};_0x3158f9[_0x997831['name']]={'$like':'%'+_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x4e')]+'%'};return _0x3158f9;}})});}_0xe5b197=_[_0xbf4c('0x4f')]({},_0xe5b197,_0x1e84b0[_0xbf4c('0x50')]);var _0x427715={'where':_0xe5b197[_0xbf4c('0x4c')]};return db[_0xbf4c('0x3e')][_0xbf4c('0x32')](_0x427715)[_0xbf4c('0x20')](function(_0x1056b9){_0x422a24[_0xbf4c('0x32')]=_0x1056b9;if(_0x1e84b0[_0xbf4c('0x43')][_0xbf4c('0x51')]){_0xe5b197[_0xbf4c('0x52')]=[{'all':!![]}];}return db[_0xbf4c('0x3e')]['findAll'](_0xe5b197);})['then'](function(_0x1dbd00){_0x422a24[_0xbf4c('0x53')]=_0x1dbd00;return _0x422a24;})['then'](respondWithFilteredResult(_0x39bf4f,_0xe5b197))[_0xbf4c('0x2b')](handleError(_0x39bf4f,null));};exports[_0xbf4c('0x54')]=function(_0x507b72,_0x4d3609){var _0x15ee8d={'raw':!![],'where':{'id':_0x507b72['params']['id']}},_0x282bec={};_0x282bec['model']=_[_0xbf4c('0x44')](db[_0xbf4c('0x3e')][_0xbf4c('0x3f')]);_0x282bec[_0xbf4c('0x43')]=_[_0xbf4c('0x44')](_0x507b72[_0xbf4c('0x43')]);_0x282bec['filters']=_['intersection'](_0x282bec[_0xbf4c('0x42')],_0x282bec[_0xbf4c('0x43')]);_0x15ee8d['attributes']=_[_0xbf4c('0x46')](_0x282bec['model'],qs['fields'](_0x507b72[_0xbf4c('0x43')][_0xbf4c('0x48')]));_0x15ee8d[_0xbf4c('0x47')]=_0x15ee8d[_0xbf4c('0x47')][_0xbf4c('0x49')]?_0x15ee8d['attributes']:_0x282bec['model'];if(_0x507b72[_0xbf4c('0x43')]['includeAll']){_0x15ee8d['include']=[{'all':!![]}];}_0x15ee8d=_[_0xbf4c('0x4f')]({},_0x15ee8d,_0x507b72[_0xbf4c('0x50')]);return db['WhatsappMessage'][_0xbf4c('0x55')](_0x15ee8d)[_0xbf4c('0x20')](handleEntityNotFound(_0x4d3609,null))[_0xbf4c('0x20')](respondWithResult(_0x4d3609,null))['catch'](handleError(_0x4d3609,null));};exports['create']=function(_0x5d67ae,_0x13d78a){return db[_0xbf4c('0x3e')][_0xbf4c('0x56')](_0x5d67ae[_0xbf4c('0x57')],{})[_0xbf4c('0x20')](respondWithResult(_0x13d78a,0xc9))[_0xbf4c('0x2b')](handleError(_0x13d78a,null));};exports[_0xbf4c('0x37')]=function(_0x482c99,_0x462a76){if(_0x482c99[_0xbf4c('0x57')]['id']){delete _0x482c99['body']['id'];}return db[_0xbf4c('0x3e')][_0xbf4c('0x55')]({'where':{'id':_0x482c99['params']['id']}})[_0xbf4c('0x20')](handleEntityNotFound(_0x462a76,null))[_0xbf4c('0x20')](saveUpdates(_0x482c99[_0xbf4c('0x57')],null))[_0xbf4c('0x20')](respondWithResult(_0x462a76,null))[_0xbf4c('0x2b')](handleError(_0x462a76,null));};exports[_0xbf4c('0x38')]=function(_0x1f8816,_0x1fb97b){return db['WhatsappMessage'][_0xbf4c('0x55')]({'where':{'id':_0x1f8816[_0xbf4c('0x58')]['id']}})[_0xbf4c('0x20')](handleEntityNotFound(_0x1fb97b,null))[_0xbf4c('0x20')](removeEntity(_0x1fb97b,null))[_0xbf4c('0x2b')](handleError(_0x1fb97b,null));};exports[_0xbf4c('0x59')]=function(_0x48bd7a,_0x104c70){return db[_0xbf4c('0x3e')][_0xbf4c('0x59')]()[_0xbf4c('0x20')](respondWithResult(_0x104c70,null))[_0xbf4c('0x2b')](handleError(_0x104c70,null));};var interaction_log=require(_0xbf4c('0x5a'))(_0xbf4c('0x5b'));exports[_0xbf4c('0x5c')]=function(_0x124245,_0x121ff0,_0x439e4c){var _0x5f50d5={'agent':{},'channel':'whatsapp'};if(_0x124245[_0xbf4c('0x57')]['id']){delete _0x124245[_0xbf4c('0x57')]['id'];}_0x124245['body'][_0xbf4c('0x5d')]=!![];_0x124245['body'][_0xbf4c('0x5e')]=moment()[_0xbf4c('0x5f')](_0xbf4c('0x60'));_0x124245[_0xbf4c('0x57')][_0xbf4c('0x61')]=_0x124245[_0xbf4c('0x57')][_0xbf4c('0x61')]||_0x124245[_0xbf4c('0x62')]['id'];_0x5f50d5[_0xbf4c('0x63')]['id']=_0x124245['body'][_0xbf4c('0x61')];return db[_0xbf4c('0x3e')]['find']({'where':{'id':_0x124245[_0xbf4c('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x121ff0,null))['then'](saveUpdates(_0x124245[_0xbf4c('0x57')],null))['then'](function(_0x47b823){if(_0x47b823){_0x5f50d5['message']=_0x47b823[_0xbf4c('0x64')]({'plain':!![]});return db[_0xbf4c('0x65')][_0xbf4c('0x55')]({'where':{'id':_0x47b823[_0xbf4c('0x66')]}});}return null;})[_0xbf4c('0x20')](handleEntityNotFound(_0x121ff0,null))[_0xbf4c('0x20')](function(_0x4d17c4){if(_0x4d17c4){return _0x4d17c4[_0xbf4c('0x37')]({'UserId':_0x124245['body'][_0xbf4c('0x61')],'read1stAt':_[_0xbf4c('0x67')](_0x4d17c4[_0xbf4c('0x68')])?moment()[_0xbf4c('0x5f')](_0xbf4c('0x60')):undefined});}return null;})[_0xbf4c('0x20')](function(_0x1f5864){if(_0x1f5864){_0x5f50d5['interaction']=_0x1f5864['get']({'plain':!![]});interaction_log[_0xbf4c('0x29')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x124245[_0xbf4c('0x62')]['id'],_0x124245[_0xbf4c('0x62')][_0xbf4c('0x3a')],_0x124245[_0xbf4c('0x62')][_0xbf4c('0x69')],_0x5f50d5['interaction']['id'],_0x124245[_0xbf4c('0x57')]?JSON[_0xbf4c('0x25')](_0x124245[_0xbf4c('0x57')]):_0xbf4c('0x6a'));return respondWithRpcPromise(_0xbf4c('0x6b'),_0xbf4c('0x6c'),_0x5f50d5);}return null;})[_0xbf4c('0x20')](function(_0x6efdc8){var _0xcae94c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x6efdc8[_0xbf4c('0x28')][_0xbf4c('0x6d')];return db[_0xbf4c('0x6e')][_0xbf4c('0x43')](_0xcae94c,{'type':db[_0xbf4c('0x6f')]['QueryTypes'][_0xbf4c('0x70')],'raw':!![]})[_0xbf4c('0x20')](function(_0x1c5fcc){return _0x1c5fcc;});})[_0xbf4c('0x20')](function(_0x54945d){if(_0x54945d){_0x5f50d5['message']['contact']=_0x54945d[0x0];if(!_0x124245[_0xbf4c('0x57')][_0xbf4c('0x61')])return;return db[_0xbf4c('0x71')][_0xbf4c('0x55')]({'where':{'id':_0x124245['body'][_0xbf4c('0x61')],'role':_0xbf4c('0x63')},'attributes':['id','name',_0xbf4c('0x72'),_0xbf4c('0x73'),_0xbf4c('0x74')],'raw':!![]});}return null;})[_0xbf4c('0x20')](function(_0x12fb33){if(!_0x12fb33)return null;_0x5f50d5[_0xbf4c('0x28')]['agent']=_0x12fb33;return _0x5f50d5;})[_0xbf4c('0x20')](function(_0x730fa){if(_0x730fa){if(_0x124245['body'][_0xbf4c('0x75')]){_0x5f50d5[_0xbf4c('0x28')][_0xbf4c('0x76')]=util[_0xbf4c('0x5f')]('SIP/%s',_0x124245[_0xbf4c('0x62')][_0xbf4c('0x3a')]);_0x5f50d5[_0xbf4c('0x28')][_0xbf4c('0x77')]=_0x5f50d5[_0xbf4c('0x77')];_0x5f50d5['message']['motionChannel']=_0x5f50d5[_0xbf4c('0x77')];_0x5f50d5[_0xbf4c('0x28')]['event']=_0xbf4c('0x5c');return respondWithRpcPromise('EventManager',_0xbf4c('0x78'),{'event':_0xbf4c('0x79'),'message':_0x5f50d5[_0xbf4c('0x28')]},client9002)[_0xbf4c('0x20')](function(){return _0x5f50d5;});}return _0x5f50d5;}return null;})[_0xbf4c('0x20')](respondWithResult(_0x121ff0,null))[_0xbf4c('0x2b')](handleError(_0x121ff0,null));};var interaction_log=require(_0xbf4c('0x5a'))(_0xbf4c('0x5b'));exports['reject']=function(_0x10f1c4,_0x2936b9,_0x59190f){var _0x12268a={'agent':{},'channel':_0xbf4c('0x7a')};if(_0x10f1c4[_0xbf4c('0x57')]['id']){delete _0x10f1c4['body']['id'];}_0x10f1c4[_0xbf4c('0x57')][_0xbf4c('0x61')]=_0x10f1c4[_0xbf4c('0x57')][_0xbf4c('0x61')]||_0x10f1c4['user']['id'];_0x12268a[_0xbf4c('0x63')]['id']=_0x10f1c4[_0xbf4c('0x57')][_0xbf4c('0x61')];return db[_0xbf4c('0x3e')]['find']({'where':{'id':_0x10f1c4[_0xbf4c('0x58')]['id'],'UserId':null}})[_0xbf4c('0x20')](handleEntityNotFound(_0x2936b9,null))[_0xbf4c('0x20')](function(_0x14c214){if(_0x14c214){_0x12268a[_0xbf4c('0x28')]=_0x14c214[_0xbf4c('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0xbf4c('0x55')]({'where':{'id':_0x14c214[_0xbf4c('0x66')]}});}return null;})[_0xbf4c('0x20')](handleEntityNotFound(_0x2936b9,null))[_0xbf4c('0x20')](function(_0x5bc414){if(_0x5bc414){_0x12268a[_0xbf4c('0x7b')]=_0x5bc414['get']({'plain':!![]});interaction_log[_0xbf4c('0x29')](_0xbf4c('0x7c'),_0x10f1c4['user']['id'],_0x10f1c4[_0xbf4c('0x62')][_0xbf4c('0x3a')],_0x10f1c4[_0xbf4c('0x62')][_0xbf4c('0x69')],_0x12268a[_0xbf4c('0x7b')]['id'],_0x10f1c4[_0xbf4c('0x57')]?JSON[_0xbf4c('0x25')](_0x10f1c4[_0xbf4c('0x57')]):_0xbf4c('0x6a'));return respondWithRpcPromise('RejectMessage',_0xbf4c('0x7d'),_0x12268a);}return null;})['then'](function(_0xb10398){var _0x31a834=_0xbf4c('0x7e')+_0xb10398[_0xbf4c('0x28')][_0xbf4c('0x6d')];return db['sequelize']['query'](_0x31a834,{'type':db['Sequelize'][_0xbf4c('0x7f')][_0xbf4c('0x70')],'raw':!![]})['then'](function(_0x24b9b5){return _0x24b9b5;});})[_0xbf4c('0x20')](function(_0x39b86d){if(_0x39b86d){_0x12268a[_0xbf4c('0x28')]['contact']=_0x39b86d[0x0];if(!_0x10f1c4[_0xbf4c('0x57')][_0xbf4c('0x61')])return;return db[_0xbf4c('0x71')][_0xbf4c('0x55')]({'where':{'id':_0x10f1c4[_0xbf4c('0x57')][_0xbf4c('0x61')],'role':'agent'},'attributes':['id',_0xbf4c('0x3a'),_0xbf4c('0x72'),'email','internal'],'raw':!![]});}return null;})[_0xbf4c('0x20')](function(_0x11197a){if(!_0x11197a)return null;_0x12268a[_0xbf4c('0x28')]['agent']=_0x11197a;return _0x12268a;})[_0xbf4c('0x20')](function(_0x594b4f){if(_0x594b4f){_0x594b4f[_0xbf4c('0x28')][_0xbf4c('0x76')]=util['format'](_0xbf4c('0x80'),_0x10f1c4[_0xbf4c('0x62')][_0xbf4c('0x3a')]);_0x594b4f[_0xbf4c('0x28')][_0xbf4c('0x77')]=_0x12268a['channel'];_0x594b4f[_0xbf4c('0x28')]['motionChannel']=_0x12268a['channel'];_0x594b4f['message']['event']=_0xbf4c('0x36');respondWithRpcPromise(_0xbf4c('0x78'),_0xbf4c('0x78'),{'event':'rejectmessage','message':_0x594b4f['message']},client9002);return _0x12268a;}return null;})[_0xbf4c('0x20')](respondWithResult(_0x2936b9,null))[_0xbf4c('0x2b')](handleError(_0x2936b9,null));};exports[_0xbf4c('0x2d')]=function(_0x5bfc0a,_0xe605a7,_0x35edef){if(_0x5bfc0a[_0xbf4c('0x57')]['id']){delete _0x5bfc0a[_0xbf4c('0x57')]['id'];}var _0xe8e5bc;return db[_0xbf4c('0x3e')][_0xbf4c('0x55')]({'where':{'id':_0x5bfc0a[_0xbf4c('0x58')]['id']}})[_0xbf4c('0x20')](handleEntityNotFound(_0xe605a7,null))[_0xbf4c('0x20')](function(_0x3df5a8){if(_0x3df5a8){_0xe8e5bc=_0x3df5a8;return db[_0xbf4c('0x81')][_0xbf4c('0x55')]({'where':{'id':_0x3df5a8[_0xbf4c('0x82')]}});}})[_0xbf4c('0x20')](handleEntityNotFound(_0xe605a7,null))[_0xbf4c('0x20')](function(_0x1a186c){if(_0x1a186c){logger['debug'](_0xbf4c('0x83'),'status',_0xbf4c('0x84'),_0x1a186c[_0xbf4c('0x41')],util[_0xbf4c('0x85')](_0x5bfc0a['body'],{'showHidden':![],'depth':null}));switch(_0x1a186c[_0xbf4c('0x41')]){case _0xbf4c('0x86'):if(_0x5bfc0a[_0xbf4c('0x57')]['MessageSid']&&_0x5bfc0a[_0xbf4c('0x57')]['MessageSid']===_0xe8e5bc[_0xbf4c('0x87')]&&_0x5bfc0a['body']['MessageStatus']&&_0x5bfc0a[_0xbf4c('0x57')][_0xbf4c('0x88')]===_0xbf4c('0x5d')){return _0xe8e5bc[_0xbf4c('0x37')]({'read':!![]});}else{logger[_0xbf4c('0x26')](_0xbf4c('0x89'),_0xbf4c('0x2d'),_0xbf4c('0x86'),util[_0xbf4c('0x85')](_0x5bfc0a[_0xbf4c('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xe8e5bc;}})[_0xbf4c('0x20')](respondWithResult(_0xe605a7,null))[_0xbf4c('0x2b')](handleError(_0xe605a7,null));}; \ No newline at end of file +var _0x63b2=['status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','include','find','create','body','describe','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','email','internal','manual','SIP/%s','motionChannel','channel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','sequelize','SELECT','User','fullname','interface','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','request\x20sent','result','catch','sendStatus'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x63b2,0x185));var _0x263b=function(_0x2f1992,_0x57be08){_0x2f1992=_0x2f1992-0x0;var _0x328730=_0x63b2[_0x2f1992];return _0x328730;};'use strict';var emlformat=require(_0x263b('0x0'));var rimraf=require(_0x263b('0x1'));var zipdir=require(_0x263b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x263b('0x3'));var moment=require(_0x263b('0x4'));var BPromise=require(_0x263b('0x5'));var Mustache=require(_0x263b('0x6'));var util=require(_0x263b('0x7'));var path=require(_0x263b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x263b('0x9'));var _=require(_0x263b('0xa'));var squel=require(_0x263b('0xb'));var crypto=require(_0x263b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x263b('0xd'));var toCsv=require(_0x263b('0xe'));var querystring=require(_0x263b('0xf'));var Papa=require('papaparse');var Redis=require(_0x263b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x263b('0x11'));var as=require(_0x263b('0x12'));var hardwareService=require(_0x263b('0x13'));var logger=require(_0x263b('0x14'))(_0x263b('0x15'));var utils=require('../../config/utils');var config=require(_0x263b('0x16'));var licenseUtil=require(_0x263b('0x17'));var db=require(_0x263b('0x18'))['db'];config[_0x263b('0x19')]=_[_0x263b('0x1a')](config[_0x263b('0x19')],{'host':_0x263b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x263b('0x19')]));require('./whatsappMessage.socket')[_0x263b('0x1c')](socket);var jayson=require(_0x263b('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x263b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x25cfa7,_0x2442fc,_0x72955,_0x33b42d){return new BPromise(function(_0x3ecd50,_0x50cf6b){var _0x21349e=_0x33b42d||client;return _0x21349e['request'](_0x25cfa7,_0x72955)['then'](function(_0x26f92e){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2442fc,'request\x20sent');logger[_0x263b('0x1f')](_0x263b('0x20'),_0x2442fc,'request\x20sent',JSON[_0x263b('0x21')](_0x26f92e));if(_0x26f92e[_0x263b('0x22')]){if(_0x26f92e[_0x263b('0x22')][_0x263b('0x23')]===0x1f4){logger[_0x263b('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x2442fc,_0x26f92e[_0x263b('0x22')][_0x263b('0x24')]);return _0x50cf6b(_0x26f92e['error']['message']);}logger['error'](_0x263b('0x25'),_0x2442fc,_0x26f92e[_0x263b('0x22')]['message']);return _0x3ecd50(_0x26f92e[_0x263b('0x22')][_0x263b('0x24')]);}else{logger[_0x263b('0x26')](_0x263b('0x25'),_0x2442fc,_0x263b('0x27'));_0x3ecd50(_0x26f92e[_0x263b('0x28')]['message']);}})[_0x263b('0x29')](function(_0x5db4e8){logger[_0x263b('0x22')](_0x263b('0x25'),_0x2442fc,_0x5db4e8);_0x50cf6b(_0x5db4e8);});});}function respondWithStatusCode(_0xfc77d1,_0x30c3ba){_0x30c3ba=_0x30c3ba||0xcc;return function(_0x6affa1){if(_0x6affa1){return _0xfc77d1[_0x263b('0x2a')](_0x30c3ba);}return _0xfc77d1[_0x263b('0x2b')](_0x30c3ba)[_0x263b('0x2c')]();};}function respondWithResult(_0x36caba,_0x2a663c){_0x2a663c=_0x2a663c||0xc8;return function(_0x1b30f4){if(_0x1b30f4){return _0x36caba[_0x263b('0x2b')](_0x2a663c)[_0x263b('0x2d')](_0x1b30f4);}};}function respondWithFilteredResult(_0x20faaf,_0x23ced7){return function(_0x3fc169){if(_0x3fc169){var _0x345c6a=typeof _0x23ced7['offset']===_0x263b('0x2e')&&typeof _0x23ced7['limit']==='undefined';var _0x2e72bb=_0x3fc169[_0x263b('0x2f')];var _0x99f715=_0x345c6a?0x0:_0x23ced7[_0x263b('0x30')];var _0x8a2d1c=_0x345c6a?_0x3fc169['count']:_0x23ced7['offset']+_0x23ced7[_0x263b('0x31')];var _0x14ddaf;if(_0x8a2d1c>=_0x2e72bb){_0x8a2d1c=_0x2e72bb;_0x14ddaf=0xc8;}else{_0x14ddaf=0xce;}_0x20faaf['status'](_0x14ddaf);return _0x20faaf[_0x263b('0x32')](_0x263b('0x33'),_0x99f715+'-'+_0x8a2d1c+'/'+_0x2e72bb)[_0x263b('0x2d')](_0x3fc169);}return null;};}function patchUpdates(_0x3eb28e){return function(_0x20daff){try{jsonpatch[_0x263b('0x34')](_0x20daff,_0x3eb28e,!![]);}catch(_0x38e6fd){return BPromise[_0x263b('0x35')](_0x38e6fd);}return _0x20daff[_0x263b('0x36')]();};}function saveUpdates(_0x4b246d,_0x3bd7a7){return function(_0x493add){if(_0x493add){return _0x493add[_0x263b('0x37')](_0x4b246d)[_0x263b('0x38')](function(_0x9f5159){return _0x9f5159;});}return null;};}function removeEntity(_0xb4b531,_0x5867c1){return function(_0x28dbeb){if(_0x28dbeb){return _0x28dbeb[_0x263b('0x39')]()[_0x263b('0x38')](function(){_0xb4b531[_0x263b('0x2b')](0xcc)[_0x263b('0x2c')]();});}};}function handleEntityNotFound(_0x9ce27a,_0x3a8251){return function(_0x4c5b39){if(!_0x4c5b39){_0x9ce27a[_0x263b('0x2a')](0x194);}return _0x4c5b39;};}function handleError(_0x2a27ad,_0x17d3f6){_0x17d3f6=_0x17d3f6||0x1f4;return function(_0x354f71){logger[_0x263b('0x22')](_0x354f71[_0x263b('0x3a')]);if(_0x354f71[_0x263b('0x3b')]){delete _0x354f71[_0x263b('0x3b')];}_0x2a27ad[_0x263b('0x2b')](_0x17d3f6)['send'](_0x354f71);};}exports[_0x263b('0x3c')]=function(_0x53bba0,_0x40f9ee){var _0x44e17a={},_0x5d4761={},_0x1c1c50={'count':0x0,'rows':[]};var _0xb44e19=_[_0x263b('0x3d')](db[_0x263b('0x3e')][_0x263b('0x3f')],function(_0x52c5f3){return{'name':_0x52c5f3[_0x263b('0x40')],'type':_0x52c5f3['type'][_0x263b('0x41')]};});_0x5d4761[_0x263b('0x42')]=_[_0x263b('0x3d')](_0xb44e19,_0x263b('0x3b'));_0x5d4761[_0x263b('0x43')]=_[_0x263b('0x44')](_0x53bba0[_0x263b('0x43')]);_0x5d4761[_0x263b('0x45')]=_[_0x263b('0x46')](_0x5d4761['model'],_0x5d4761[_0x263b('0x43')]);_0x44e17a[_0x263b('0x47')]=_[_0x263b('0x46')](_0x5d4761[_0x263b('0x42')],qs['fields'](_0x53bba0[_0x263b('0x43')][_0x263b('0x48')]));_0x44e17a[_0x263b('0x47')]=_0x44e17a[_0x263b('0x47')]['length']?_0x44e17a[_0x263b('0x47')]:_0x5d4761[_0x263b('0x42')];if(!_0x53bba0['query'][_0x263b('0x49')](_0x263b('0x4a'))){_0x44e17a[_0x263b('0x31')]=qs[_0x263b('0x31')](_0x53bba0[_0x263b('0x43')][_0x263b('0x31')]);_0x44e17a[_0x263b('0x30')]=qs['offset'](_0x53bba0[_0x263b('0x43')][_0x263b('0x30')]);}_0x44e17a[_0x263b('0x4b')]=qs['sort'](_0x53bba0['query'][_0x263b('0x4c')]);_0x44e17a[_0x263b('0x4d')]=qs['filters'](_[_0x263b('0x4e')](_0x53bba0[_0x263b('0x43')],_0x5d4761['filters']),_0xb44e19);if(_0x53bba0[_0x263b('0x43')]['filter']){_0x44e17a[_0x263b('0x4d')]=_[_0x263b('0x4f')](_0x44e17a[_0x263b('0x4d')],{'$or':_[_0x263b('0x3d')](_0xb44e19,function(_0x3eaaf0){if(_0x3eaaf0['type']!==_0x263b('0x50')){var _0x42370f={};_0x42370f[_0x3eaaf0[_0x263b('0x3b')]]={'$like':'%'+_0x53bba0[_0x263b('0x43')][_0x263b('0x51')]+'%'};return _0x42370f;}})});}_0x44e17a=_[_0x263b('0x4f')]({},_0x44e17a,_0x53bba0[_0x263b('0x52')]);var _0x2517a8={'where':_0x44e17a['where']};return db[_0x263b('0x3e')]['count'](_0x2517a8)[_0x263b('0x38')](function(_0x44760e){_0x1c1c50[_0x263b('0x2f')]=_0x44760e;if(_0x53bba0[_0x263b('0x43')][_0x263b('0x53')]){_0x44e17a['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x263b('0x54')](_0x44e17a);})[_0x263b('0x38')](function(_0x5430f5){_0x1c1c50[_0x263b('0x55')]=_0x5430f5;return _0x1c1c50;})[_0x263b('0x38')](respondWithFilteredResult(_0x40f9ee,_0x44e17a))['catch'](handleError(_0x40f9ee,null));};exports[_0x263b('0x56')]=function(_0xb73ab4,_0x547f54){var _0x695bec={'raw':!![],'where':{'id':_0xb73ab4[_0x263b('0x57')]['id']}},_0xa9672e={};_0xa9672e[_0x263b('0x42')]=_[_0x263b('0x44')](db[_0x263b('0x3e')][_0x263b('0x3f')]);_0xa9672e['query']=_[_0x263b('0x44')](_0xb73ab4[_0x263b('0x43')]);_0xa9672e[_0x263b('0x45')]=_[_0x263b('0x46')](_0xa9672e[_0x263b('0x42')],_0xa9672e[_0x263b('0x43')]);_0x695bec[_0x263b('0x47')]=_[_0x263b('0x46')](_0xa9672e[_0x263b('0x42')],qs[_0x263b('0x48')](_0xb73ab4['query']['fields']));_0x695bec[_0x263b('0x47')]=_0x695bec['attributes'][_0x263b('0x58')]?_0x695bec[_0x263b('0x47')]:_0xa9672e[_0x263b('0x42')];if(_0xb73ab4['query'][_0x263b('0x53')]){_0x695bec[_0x263b('0x59')]=[{'all':!![]}];}_0x695bec=_[_0x263b('0x4f')]({},_0x695bec,_0xb73ab4['options']);return db[_0x263b('0x3e')][_0x263b('0x5a')](_0x695bec)[_0x263b('0x38')](handleEntityNotFound(_0x547f54,null))['then'](respondWithResult(_0x547f54,null))[_0x263b('0x29')](handleError(_0x547f54,null));};exports[_0x263b('0x5b')]=function(_0x42dc39,_0x403030){return db[_0x263b('0x3e')][_0x263b('0x5b')](_0x42dc39[_0x263b('0x5c')],{})[_0x263b('0x38')](respondWithResult(_0x403030,0xc9))[_0x263b('0x29')](handleError(_0x403030,null));};exports[_0x263b('0x37')]=function(_0x3dc642,_0x2f1d72){if(_0x3dc642[_0x263b('0x5c')]['id']){delete _0x3dc642['body']['id'];}return db['WhatsappMessage'][_0x263b('0x5a')]({'where':{'id':_0x3dc642[_0x263b('0x57')]['id']}})[_0x263b('0x38')](handleEntityNotFound(_0x2f1d72,null))[_0x263b('0x38')](saveUpdates(_0x3dc642[_0x263b('0x5c')],null))[_0x263b('0x38')](respondWithResult(_0x2f1d72,null))[_0x263b('0x29')](handleError(_0x2f1d72,null));};exports[_0x263b('0x39')]=function(_0x3bdc66,_0x426a46){return db[_0x263b('0x3e')]['find']({'where':{'id':_0x3bdc66[_0x263b('0x57')]['id']}})[_0x263b('0x38')](handleEntityNotFound(_0x426a46,null))[_0x263b('0x38')](removeEntity(_0x426a46,null))['catch'](handleError(_0x426a46,null));};exports[_0x263b('0x5d')]=function(_0x5a4b34,_0x2cdc95){return db[_0x263b('0x3e')][_0x263b('0x5d')]()[_0x263b('0x38')](respondWithResult(_0x2cdc95,null))[_0x263b('0x29')](handleError(_0x2cdc95,null));};var interaction_log=require(_0x263b('0x14'))('whatsapp-interactions');exports['accept']=function(_0x18b976,_0x2dd6fb,_0x175cd0){var _0x5deeac={'agent':{},'channel':_0x263b('0x5e')};if(_0x18b976[_0x263b('0x5c')]['id']){delete _0x18b976[_0x263b('0x5c')]['id'];}_0x18b976[_0x263b('0x5c')][_0x263b('0x5f')]=!![];_0x18b976['body'][_0x263b('0x60')]=moment()[_0x263b('0x61')](_0x263b('0x62'));_0x18b976[_0x263b('0x5c')][_0x263b('0x63')]=_0x18b976['body']['UserId']||_0x18b976['user']['id'];_0x5deeac[_0x263b('0x64')]['id']=_0x18b976[_0x263b('0x5c')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x18b976[_0x263b('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2dd6fb,null))[_0x263b('0x38')](saveUpdates(_0x18b976['body'],null))[_0x263b('0x38')](function(_0x350708){if(_0x350708){_0x5deeac[_0x263b('0x24')]=_0x350708[_0x263b('0x65')]({'plain':!![]});return db[_0x263b('0x66')][_0x263b('0x5a')]({'where':{'id':_0x350708[_0x263b('0x67')]}});}return null;})[_0x263b('0x38')](handleEntityNotFound(_0x2dd6fb,null))[_0x263b('0x38')](function(_0x5dea94){if(_0x5dea94){return _0x5dea94[_0x263b('0x37')]({'UserId':_0x18b976[_0x263b('0x5c')]['UserId'],'read1stAt':_['isNil'](_0x5dea94[_0x263b('0x68')])?moment()[_0x263b('0x61')](_0x263b('0x62')):undefined});}return null;})['then'](function(_0x1a3765){if(_0x1a3765){_0x5deeac[_0x263b('0x69')]=_0x1a3765[_0x263b('0x65')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18b976['user']['id'],_0x18b976[_0x263b('0x6a')]['name'],_0x18b976[_0x263b('0x6a')][_0x263b('0x6b')],_0x5deeac[_0x263b('0x69')]['id'],_0x18b976['body']?JSON[_0x263b('0x21')](_0x18b976[_0x263b('0x5c')]):'null');return respondWithRpcPromise(_0x263b('0x6c'),_0x263b('0x6d'),_0x5deeac);}return null;})['then'](function(_0x503691){var _0x4d4c6c=_0x263b('0x6e')+_0x503691[_0x263b('0x24')]['ContactId'];return db['sequelize']['query'](_0x4d4c6c,{'type':db[_0x263b('0x6f')][_0x263b('0x70')]['SELECT'],'raw':!![]})['then'](function(_0x545217){return _0x545217;});})[_0x263b('0x38')](function(_0x3ff29d){if(_0x3ff29d){_0x5deeac[_0x263b('0x24')][_0x263b('0x71')]=_0x3ff29d[0x0];if(!_0x18b976[_0x263b('0x5c')][_0x263b('0x63')])return;return db['User'][_0x263b('0x5a')]({'where':{'id':_0x18b976[_0x263b('0x5c')][_0x263b('0x63')],'role':_0x263b('0x64')},'attributes':['id',_0x263b('0x3b'),'fullname',_0x263b('0x72'),_0x263b('0x73')],'raw':!![]});}return null;})['then'](function(_0x3bdc8d){if(!_0x3bdc8d)return null;_0x5deeac[_0x263b('0x24')][_0x263b('0x64')]=_0x3bdc8d;return _0x5deeac;})[_0x263b('0x38')](function(_0x3c3556){if(_0x3c3556){if(_0x18b976[_0x263b('0x5c')][_0x263b('0x74')]){_0x5deeac[_0x263b('0x24')]['interface']=util[_0x263b('0x61')](_0x263b('0x75'),_0x18b976[_0x263b('0x6a')][_0x263b('0x3b')]);_0x5deeac[_0x263b('0x24')]['channel']=_0x5deeac['channel'];_0x5deeac[_0x263b('0x24')][_0x263b('0x76')]=_0x5deeac[_0x263b('0x77')];_0x5deeac['message'][_0x263b('0x78')]=_0x263b('0x79');return respondWithRpcPromise(_0x263b('0x7a'),_0x263b('0x7a'),{'event':_0x263b('0x7b'),'message':_0x5deeac['message']},client9002)[_0x263b('0x38')](function(){return _0x5deeac;});}return _0x5deeac;}return null;})[_0x263b('0x38')](respondWithResult(_0x2dd6fb,null))['catch'](handleError(_0x2dd6fb,null));};var interaction_log=require(_0x263b('0x14'))('whatsapp-interactions');exports[_0x263b('0x35')]=function(_0x33734d,_0x5334e5,_0x826b14){var _0x397be2={'agent':{},'channel':_0x263b('0x5e')};if(_0x33734d[_0x263b('0x5c')]['id']){delete _0x33734d[_0x263b('0x5c')]['id'];}_0x33734d['body']['UserId']=_0x33734d[_0x263b('0x5c')][_0x263b('0x63')]||_0x33734d[_0x263b('0x6a')]['id'];_0x397be2[_0x263b('0x64')]['id']=_0x33734d[_0x263b('0x5c')]['UserId'];return db['WhatsappMessage'][_0x263b('0x5a')]({'where':{'id':_0x33734d[_0x263b('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5334e5,null))[_0x263b('0x38')](function(_0x1a38be){if(_0x1a38be){_0x397be2[_0x263b('0x24')]=_0x1a38be[_0x263b('0x65')]({'plain':!![]});return db[_0x263b('0x66')][_0x263b('0x5a')]({'where':{'id':_0x1a38be['WhatsappInteractionId']}});}return null;})[_0x263b('0x38')](handleEntityNotFound(_0x5334e5,null))[_0x263b('0x38')](function(_0x3c0bab){if(_0x3c0bab){_0x397be2[_0x263b('0x69')]=_0x3c0bab[_0x263b('0x65')]({'plain':!![]});interaction_log[_0x263b('0x26')](_0x263b('0x7c'),_0x33734d[_0x263b('0x6a')]['id'],_0x33734d[_0x263b('0x6a')][_0x263b('0x3b')],_0x33734d['user']['role'],_0x397be2[_0x263b('0x69')]['id'],_0x33734d[_0x263b('0x5c')]?JSON[_0x263b('0x21')](_0x33734d[_0x263b('0x5c')]):_0x263b('0x7d'));return respondWithRpcPromise(_0x263b('0x7e'),_0x263b('0x7f'),_0x397be2);}return null;})[_0x263b('0x38')](function(_0xba078d){var _0x57b0cb=_0x263b('0x6e')+_0xba078d[_0x263b('0x24')][_0x263b('0x80')];return db[_0x263b('0x81')][_0x263b('0x43')](_0x57b0cb,{'type':db[_0x263b('0x6f')]['QueryTypes'][_0x263b('0x82')],'raw':!![]})['then'](function(_0x4d4644){return _0x4d4644;});})[_0x263b('0x38')](function(_0x4dfc15){if(_0x4dfc15){_0x397be2['message'][_0x263b('0x71')]=_0x4dfc15[0x0];if(!_0x33734d[_0x263b('0x5c')]['UserId'])return;return db[_0x263b('0x83')][_0x263b('0x5a')]({'where':{'id':_0x33734d[_0x263b('0x5c')][_0x263b('0x63')],'role':_0x263b('0x64')},'attributes':['id',_0x263b('0x3b'),_0x263b('0x84'),_0x263b('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x8cdc8){if(!_0x8cdc8)return null;_0x397be2['message'][_0x263b('0x64')]=_0x8cdc8;return _0x397be2;})[_0x263b('0x38')](function(_0x4eee3c){if(_0x4eee3c){_0x4eee3c[_0x263b('0x24')][_0x263b('0x85')]=util['format'](_0x263b('0x75'),_0x33734d[_0x263b('0x6a')][_0x263b('0x3b')]);_0x4eee3c[_0x263b('0x24')][_0x263b('0x77')]=_0x397be2[_0x263b('0x77')];_0x4eee3c[_0x263b('0x24')][_0x263b('0x76')]=_0x397be2[_0x263b('0x77')];_0x4eee3c[_0x263b('0x24')]['event']=_0x263b('0x35');respondWithRpcPromise('EventManager',_0x263b('0x7a'),{'event':_0x263b('0x86'),'message':_0x4eee3c['message']},client9002);return _0x397be2;}return null;})[_0x263b('0x38')](respondWithResult(_0x5334e5,null))[_0x263b('0x29')](handleError(_0x5334e5,null));};exports['status']=function(_0x3e87c7,_0x4454e2,_0x338038){if(_0x3e87c7['body']['id']){delete _0x3e87c7[_0x263b('0x5c')]['id'];}var _0x7369a7;return db[_0x263b('0x3e')][_0x263b('0x5a')]({'where':{'id':_0x3e87c7[_0x263b('0x57')]['id']}})[_0x263b('0x38')](handleEntityNotFound(_0x4454e2,null))[_0x263b('0x38')](function(_0x2e29ce){if(_0x2e29ce){_0x7369a7=_0x2e29ce;return db['WhatsappAccount'][_0x263b('0x5a')]({'where':{'id':_0x2e29ce['WhatsappAccountId']}});}})[_0x263b('0x38')](handleEntityNotFound(_0x4454e2,null))[_0x263b('0x38')](function(_0x3f896f){if(_0x3f896f){logger[_0x263b('0x1f')](_0x263b('0x87'),_0x263b('0x2b'),_0x263b('0x88'),_0x3f896f[_0x263b('0x89')],util['inspect'](_0x3e87c7['body'],{'showHidden':![],'depth':null}));switch(_0x3f896f['type']){case _0x263b('0x8a'):if(_0x3e87c7['body'][_0x263b('0x8b')]&&_0x3e87c7[_0x263b('0x5c')][_0x263b('0x8b')]===_0x7369a7[_0x263b('0x8c')]&&_0x3e87c7[_0x263b('0x5c')][_0x263b('0x8d')]&&_0x3e87c7[_0x263b('0x5c')][_0x263b('0x8d')]===_0x263b('0x5f')){return _0x7369a7['update']({'read':!![]});}else{logger[_0x263b('0x22')](_0x263b('0x8e'),'status','twilio',util[_0x263b('0x8f')](_0x3e87c7[_0x263b('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x7369a7;}})['then'](respondWithResult(_0x4454e2,null))[_0x263b('0x29')](handleError(_0x4454e2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 1d04b7b..7f12d59 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x236c,0x155));var _0xc236=function(_0x5dca37,_0x2379b2){_0x5dca37=_0x5dca37-0x0;var _0x3b1c34=_0x236c[_0x5dca37];return _0x3b1c34;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8f59=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage'];(function(_0x3e2267,_0x2a1e44){var _0x3c7b3c=function(_0x5b605f){while(--_0x5b605f){_0x3e2267['push'](_0x3e2267['shift']());}};_0x3c7b3c(++_0x2a1e44);}(_0x8f59,0x11d));var _0x98f5=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0x8f59[_0xcbe787];return _0x4c78fa;};'use strict';var EventEmitter=require(_0x98f5('0x0'));var WhatsappMessage=require(_0x98f5('0x1'))['db'][_0x98f5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x98f5('0x3')](0x0);var events={'afterCreate':_0x98f5('0x4'),'afterUpdate':_0x98f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x912492){return function(_0x320235,_0x107e7e,_0x2f8c31){WhatsappMessageEvents['emit'](_0x912492+':'+_0x320235['id'],_0x320235);WhatsappMessageEvents[_0x98f5('0x6')](_0x912492,_0x320235);_0x2f8c31(null);};}for(var e in events){if(events[_0x98f5('0x7')](e)){var event=events[e];WhatsappMessage[_0x98f5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 050f75b..c1573e1 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 _0x3756=['secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','Bearer\x20','application/json','then','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out'];(function(_0x50b66d,_0x1c30d4){var _0xd39156=function(_0x4143bd){while(--_0x4143bd){_0x50b66d['push'](_0x50b66d['shift']());}};_0xd39156(++_0x1c30d4);}(_0x3756,0x116));var _0x6375=function(_0x2d2cc1,_0x517533){_0x2d2cc1=_0x2d2cc1-0x0;var _0x2c1556=_0x3756[_0x2d2cc1];return _0x2c1556;};'use strict';var _=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var logger=require(_0x6375('0x2'))(_0x6375('0x3'));var moment=require(_0x6375('0x4'));var BPromise=require(_0x6375('0x5'));var rp=require(_0x6375('0x6'));var fetch=require(_0x6375('0x7'));var fs=require('fs');var path=require(_0x6375('0x8'));var rimraf=require(_0x6375('0x9'));var config=require(_0x6375('0xa'));var attributes=require(_0x6375('0xb'));module[_0x6375('0xc')]=function(_0x1dae97,_0x3ef81c){return _0x1dae97[_0x6375('0xd')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6375('0xe'),'fields':[_0x6375('0xe')]},{'name':_0x6375('0xf'),'fields':[_0x6375('0x10')],'type':_0x6375('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x536efd,_0x5c6fde,_0x363075){var _0x18b10a=_0x1dae97[_0x6375('0x12')];var _0x367337=_0x536efd['get']({'plain':!![]});if(_0x367337[_0x6375('0x13')][_0x6375('0x14')]()==='in'||_0x367337[_0x6375('0x13')]['toLowerCase']()===_0x6375('0x15')&&!_0x367337[_0x6375('0x16')]&&!_[_0x6375('0x17')](_0x367337[_0x6375('0x18')])){_0x18b10a[_0x6375('0x19')]['findOne']({'where':{'id':_0x367337[_0x6375('0x1a')]}})['then'](function(_0x462781){if(_0x462781){_0x462781[_0x6375('0x1b')]({'lastMsgAt':_0x367337[_0x6375('0x1c')],'lastMsgDirection':_0x367337[_0x6375('0x13')][_0x6375('0x14')]()});}})[_0x6375('0x1d')](function(_0xc4926f){console[_0x6375('0x1e')](_0xc4926f);});}if(_0x367337[_0x6375('0x13')]==='out'&&!_0x367337['secret']){var _0x2d8169;_0x18b10a[_0x6375('0x1f')][_0x6375('0x20')]({'where':{'id':_0x367337['WhatsappAccountId']},'raw':!![]})['then'](function(_0x123224){_0x2d8169=_0x123224;if(_0x2d8169&&_0x2d8169[_0x6375('0x21')]){switch(_0x2d8169[_0x6375('0x21')]){case _0x6375('0x22'):var _0x2aefae=require(_0x6375('0x22'));if(_0x2d8169[_0x6375('0x23')]&&_0x2d8169[_0x6375('0x24')]&&_0x2d8169[_0x6375('0x25')]){var _0x301397=new _0x2aefae(_0x2d8169['accountSid'],_0x2d8169[_0x6375('0x24')]);_0x301397[_0x6375('0x26')]['create']({'body':_0x367337[_0x6375('0x10')],'to':_0x6375('0x27')+_0x367337[_0x6375('0x25')],'from':_0x6375('0x27')+_0x2d8169[_0x6375('0x25')],'statusCallback':_0x2d8169[_0x6375('0x28')]+_0x6375('0x29')+_0x367337['id']+_0x6375('0x2a')+_0x2d8169['token']})['then'](function(_0x4243b0){if(_0x4243b0[_0x6375('0x2b')]){return _0x536efd[_0x6375('0x1b')]({'messageId':_0x4243b0[_0x6375('0x2b')]});}})['catch'](function(_0x23b655){logger[_0x6375('0x1e')](_0x6375('0x2c'),'afterCreate',_0x6375('0x22'),util[_0x6375('0x2d')](_0x23b655,{'showHidden':![],'depth':null}));});}else{logger[_0x6375('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x6375('0x2e'),'twilio',_0x6375('0x2f'));}break;case _0x6375('0x30'):var _0x909d35=_0x2d8169['accountSid'];var _0x53f11f=_0x2d8169[_0x6375('0x24')];var _0x3e2849=_0x2d8169[_0x6375('0x31')]+_0x6375('0x32')+_0x909d35+'/messages/';var _0x4cbc35={'to':[_0x367337[_0x6375('0x25')]],'message':{'type':'text','text':_0x367337[_0x6375('0x10')]}};var _0x578a4b={'method':'POST','uri':_0x3e2849,'headers':{'Authorization':_0x6375('0x33')+_0x53f11f,'Content-Type':_0x6375('0x34')},'body':_0x4cbc35,'json':!![]};rp(_0x578a4b)[_0x6375('0x35')](function(_0x4b0fbf){if(_0x4b0fbf[_0x6375('0x36')][0x0][_0x6375('0x37')]){return _0x536efd[_0x6375('0x1b')]({'messageId':_0x4b0fbf['statuses'][0x0]['message_id']});}})[_0x6375('0x1d')](function(_0x33ce19){logger[_0x6375('0x38')]('WhatsappMessage,\x20%s',_0x33ce19);});break;}}})[_0x6375('0x39')](function(){_0x363075();});}else{_0x363075();}}},'charset':_0x6375('0x3a'),'collate':_0x6375('0x3b')});}; \ No newline at end of file +var _0x635e=['../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','findOne','WhatsappInteractionId','createdAt','out','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','error','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x635e,0xf6));var _0xe635=function(_0x1f2057,_0x2cdf65){_0x1f2057=_0x1f2057-0x0;var _0x3c1e95=_0x635e[_0x1f2057];return _0x3c1e95;};'use strict';var _=require(_0xe635('0x0'));var util=require(_0xe635('0x1'));var logger=require(_0xe635('0x2'))(_0xe635('0x3'));var moment=require(_0xe635('0x4'));var BPromise=require(_0xe635('0x5'));var rp=require(_0xe635('0x6'));var fetch=require(_0xe635('0x7'));var fs=require('fs');var path=require(_0xe635('0x8'));var rimraf=require('rimraf');var config=require(_0xe635('0x9'));var attributes=require(_0xe635('0xa'));module['exports']=function(_0x3f6946,_0xccc079){return _0x3f6946[_0xe635('0xb')](_0xe635('0xc'),attributes,{'tableName':_0xe635('0xd'),'paranoid':![],'indexes':[{'name':_0xe635('0xe'),'fields':[_0xe635('0xe')]},{'name':_0xe635('0xf'),'fields':['body'],'type':_0xe635('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e3df4,_0x1a81ad,_0x4620ca){var _0x23d6aa=_0x3f6946[_0xe635('0x11')];var _0xdc9af0=_0x7e3df4[_0xe635('0x12')]({'plain':!![]});if(_0xdc9af0[_0xe635('0x13')][_0xe635('0x14')]()==='in'||_0xdc9af0[_0xe635('0x13')][_0xe635('0x14')]()==='out'&&!_0xdc9af0[_0xe635('0x15')]&&!_[_0xe635('0x16')](_0xdc9af0['UserId'])){_0x23d6aa['WhatsappInteraction'][_0xe635('0x17')]({'where':{'id':_0xdc9af0[_0xe635('0x18')]}})['then'](function(_0x179b7b){if(_0x179b7b){_0x179b7b['update']({'lastMsgAt':_0xdc9af0[_0xe635('0x19')],'lastMsgDirection':_0xdc9af0['direction'][_0xe635('0x14')]()});}})['catch'](function(_0xc6f3c5){console['error'](_0xc6f3c5);});}if(_0xdc9af0[_0xe635('0x13')]===_0xe635('0x1a')&&!_0xdc9af0['secret']){var _0x56a8cc;_0x23d6aa[_0xe635('0x1b')][_0xe635('0x1c')]({'where':{'id':_0xdc9af0[_0xe635('0x1d')]},'raw':!![]})[_0xe635('0x1e')](function(_0xa33f01){_0x56a8cc=_0xa33f01;if(_0x56a8cc&&_0x56a8cc['type']){switch(_0x56a8cc[_0xe635('0x1f')]){case _0xe635('0x20'):var _0x5e2782=require(_0xe635('0x20'));if(_0x56a8cc[_0xe635('0x21')]&&_0x56a8cc[_0xe635('0x22')]&&_0x56a8cc[_0xe635('0x23')]){var _0x44f079=new _0x5e2782(_0x56a8cc[_0xe635('0x21')],_0x56a8cc['authToken']);_0x44f079[_0xe635('0x24')]['create']({'body':_0xdc9af0[_0xe635('0x25')],'to':'whatsapp:'+_0xdc9af0[_0xe635('0x23')],'from':_0xe635('0x26')+_0x56a8cc[_0xe635('0x23')],'statusCallback':_0x56a8cc[_0xe635('0x27')]+_0xe635('0x28')+_0xdc9af0['id']+_0xe635('0x29')+_0x56a8cc[_0xe635('0x2a')]})[_0xe635('0x1e')](function(_0x44a6ae){if(_0x44a6ae[_0xe635('0x2b')]){return _0x7e3df4['update']({'messageId':_0x44a6ae[_0xe635('0x2b')]});}})[_0xe635('0x2c')](function(_0x596ea0){logger[_0xe635('0x2d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xe635('0x2e'),'twilio',util['inspect'](_0x596ea0,{'showHidden':![],'depth':null}));});}else{logger[_0xe635('0x2d')](_0xe635('0x2f'),'afterCreate','twilio',_0xe635('0x30'));}break;case'sinch':var _0x4ef136=_0x56a8cc[_0xe635('0x21')];var _0xcf0926=_0x56a8cc[_0xe635('0x22')];var _0x71d325=_0x56a8cc[_0xe635('0x31')]+_0xe635('0x32')+_0x4ef136+_0xe635('0x33');var _0x1d0746={'to':[_0xdc9af0[_0xe635('0x23')]],'message':{'type':_0xe635('0x34'),'text':_0xdc9af0['body']}};var _0x532bbd={'method':_0xe635('0x35'),'uri':_0x71d325,'headers':{'Authorization':_0xe635('0x36')+_0xcf0926,'Content-Type':_0xe635('0x37')},'body':_0x1d0746,'json':!![]};rp(_0x532bbd)[_0xe635('0x1e')](function(_0x233577){if(_0x233577[_0xe635('0x38')][0x0]['message_id']){return _0x7e3df4['update']({'messageId':_0x233577[_0xe635('0x38')][0x0]['message_id']});}})['catch'](function(_0x43cf0c){logger[_0xe635('0x39')](_0xe635('0x3a'),_0x43cf0c);});break;}}})[_0xe635('0x3b')](function(){_0x4620ca();});}else{_0x4620ca();}}},'charset':_0xe635('0x3c'),'collate':_0xe635('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0fccb18..1130763 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 _0xe2e2=['redis','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','then','CreateWhatsappMessage','lodash','bluebird','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4ede81,_0xb6d292){var _0x3f3ba0=function(_0x1d89c9){while(--_0x1d89c9){_0x4ede81['push'](_0x4ede81['shift']());}};_0x3f3ba0(++_0xb6d292);}(_0xe2e2,0x72));var _0x2e2e=function(_0x2a5a80,_0x50f5ec){_0x2a5a80=_0x2a5a80-0x0;var _0x17a738=_0xe2e2[_0x2a5a80];return _0x17a738;};'use strict';var _=require(_0x2e2e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e2e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e2e('0x2'))('rpc');var config=require(_0x2e2e('0x3'));var jayson=require(_0x2e2e('0x4'));var client=jayson['client'][_0x2e2e('0x5')]({'port':0x232a});config[_0x2e2e('0x6')]=_['defaults'](config[_0x2e2e('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e2e('0x6')]));require(_0x2e2e('0x7'))[_0x2e2e('0x8')](socket);function respondWithRpcPromise(_0x4917fe,_0x1d4886,_0x592dae){return new BPromise(function(_0x419111,_0x4aec76){return client[_0x2e2e('0x9')](_0x4917fe,_0x592dae)['then'](function(_0x42b8e1){logger[_0x2e2e('0xa')](_0x2e2e('0xb'),_0x1d4886,_0x2e2e('0xc'));logger[_0x2e2e('0xd')](_0x2e2e('0xe'),_0x1d4886,_0x2e2e('0xc'),JSON[_0x2e2e('0xf')](_0x42b8e1));if(_0x42b8e1[_0x2e2e('0x10')]){if(_0x42b8e1['error'][_0x2e2e('0x11')]===0x1f4){logger['error'](_0x2e2e('0xb'),_0x1d4886,_0x42b8e1['error'][_0x2e2e('0x12')]);return _0x4aec76(_0x42b8e1[_0x2e2e('0x10')][_0x2e2e('0x12')]);}logger[_0x2e2e('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x1d4886,_0x42b8e1[_0x2e2e('0x10')][_0x2e2e('0x12')]);return _0x419111(_0x42b8e1[_0x2e2e('0x10')][_0x2e2e('0x12')]);}else{logger[_0x2e2e('0xa')]('WhatsappMessage,\x20%s,\x20%s',_0x1d4886,_0x2e2e('0xc'));_0x419111(_0x42b8e1['result'][_0x2e2e('0x12')]);}})[_0x2e2e('0x13')](function(_0x3ad0a2){logger[_0x2e2e('0x10')](_0x2e2e('0xb'),_0x1d4886,_0x3ad0a2);_0x4aec76(_0x3ad0a2);});});}exports['CreateWhatsappMessage']=function(_0x2c1ff0){var _0x32f961=this;return new Promise(function(_0x29fc1c,_0x58d72){return db['WhatsappMessage']['create'](_0x2c1ff0[_0x2e2e('0x14')],{'raw':_0x2c1ff0[_0x2e2e('0x15')]?_0x2c1ff0[_0x2e2e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x2e2e('0x16')](function(_0x1218e0){logger[_0x2e2e('0xa')]('CreateWhatsappMessage',_0x2c1ff0);logger['debug']('CreateWhatsappMessage',_0x2c1ff0,JSON[_0x2e2e('0xf')](_0x1218e0));_0x29fc1c(_0x1218e0);})['catch'](function(_0x5caba4){logger[_0x2e2e('0x10')](_0x2e2e('0x17'),_0x5caba4[_0x2e2e('0x12')],_0x2c1ff0);_0x58d72(_0x32f961[_0x2e2e('0x10')](0x1f4,_0x5caba4[_0x2e2e('0x12')]));});});}; \ No newline at end of file +var _0x961a=['WhatsappMessage','create','body','options','raw','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x961a,0xe5));var _0xa961=function(_0x5d56eb,_0x204143){_0x5d56eb=_0x5d56eb-0x0;var _0x52bc96=_0x961a[_0x5d56eb];return _0x52bc96;};'use strict';var _=require(_0xa961('0x0'));var util=require(_0xa961('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa961('0x2'))['db'];var utils=require(_0xa961('0x3'));var logger=require(_0xa961('0x4'))(_0xa961('0x5'));var config=require(_0xa961('0x6'));var jayson=require(_0xa961('0x7'));var client=jayson[_0xa961('0x8')][_0xa961('0x9')]({'port':0x232a});config['redis']=_[_0xa961('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa961('0xb'))(new Redis(config[_0xa961('0xc')]));require('./whatsappMessage.socket')[_0xa961('0xd')](socket);function respondWithRpcPromise(_0x1038a2,_0x4e88cf,_0x67eae9){return new BPromise(function(_0x2ce8d7,_0x1c78d3){return client[_0xa961('0xe')](_0x1038a2,_0x67eae9)[_0xa961('0xf')](function(_0x4e91ea){logger[_0xa961('0x10')](_0xa961('0x11'),_0x4e88cf,_0xa961('0x12'));logger[_0xa961('0x13')](_0xa961('0x14'),_0x4e88cf,_0xa961('0x12'),JSON[_0xa961('0x15')](_0x4e91ea));if(_0x4e91ea[_0xa961('0x16')]){if(_0x4e91ea['error']['code']===0x1f4){logger['error'](_0xa961('0x11'),_0x4e88cf,_0x4e91ea['error'][_0xa961('0x17')]);return _0x1c78d3(_0x4e91ea['error']['message']);}logger[_0xa961('0x16')](_0xa961('0x11'),_0x4e88cf,_0x4e91ea[_0xa961('0x16')]['message']);return _0x2ce8d7(_0x4e91ea[_0xa961('0x16')]['message']);}else{logger[_0xa961('0x10')](_0xa961('0x11'),_0x4e88cf,'request\x20sent');_0x2ce8d7(_0x4e91ea[_0xa961('0x18')][_0xa961('0x17')]);}})[_0xa961('0x19')](function(_0x26a86b){logger[_0xa961('0x16')](_0xa961('0x11'),_0x4e88cf,_0x26a86b);_0x1c78d3(_0x26a86b);});});}exports[_0xa961('0x1a')]=function(_0x2c6334){var _0x3d27d7=this;return new Promise(function(_0x244493,_0x297dec){return db[_0xa961('0x1b')][_0xa961('0x1c')](_0x2c6334[_0xa961('0x1d')],{'raw':_0x2c6334[_0xa961('0x1e')]?_0x2c6334[_0xa961('0x1e')][_0xa961('0x1f')]===undefined?!![]:![]:!![]})[_0xa961('0xf')](function(_0x116020){logger[_0xa961('0x10')](_0xa961('0x1a'),_0x2c6334);logger[_0xa961('0x13')](_0xa961('0x1a'),_0x2c6334,JSON[_0xa961('0x15')](_0x116020));_0x244493(_0x116020);})[_0xa961('0x19')](function(_0x111bab){logger[_0xa961('0x16')](_0xa961('0x1a'),_0x111bab[_0xa961('0x17')],_0x2c6334);_0x297dec(_0x3d27d7[_0xa961('0x16')](0x1f4,_0x111bab[_0xa961('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 96ab6c6..6a6f115 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 _0x3234=['save','remove','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x2630a3,_0x49e5b2){var _0x1c9f6d=function(_0x12bd66){while(--_0x12bd66){_0x2630a3['push'](_0x2630a3['shift']());}};_0x1c9f6d(++_0x49e5b2);}(_0x3234,0xae));var _0x4323=function(_0xd09db8,_0x2c9025){_0xd09db8=_0xd09db8-0x0;var _0x59f513=_0x3234[_0xd09db8];return _0x59f513;};'use strict';var WhatsappMessageEvents=require(_0x4323('0x0'));var events=[_0x4323('0x1'),_0x4323('0x2'),'update'];function createListener(_0x72855b,_0x5e1e50){return function(_0x4a03c4){_0x5e1e50[_0x4323('0x3')](_0x72855b,_0x4a03c4);};}function removeListener(_0x420ff4,_0x348fa9){return function(){WhatsappMessageEvents[_0x4323('0x4')](_0x420ff4,_0x348fa9);};}exports['register']=function(_0x54268a){for(var _0x1401dc=0x0,_0x5a6123=events[_0x4323('0x5')];_0x1401dc<_0x5a6123;_0x1401dc++){var _0x1cc4b2=events[_0x1401dc];var _0x511a45=createListener(_0x4323('0x6')+_0x1cc4b2,_0x54268a);WhatsappMessageEvents['on'](_0x1cc4b2,_0x511a45);}}; \ No newline at end of file +var _0xdc1e=['update','emit','removeListener','register','length','save','remove'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xdc1e,0x155));var _0xedc1=function(_0x249c19,_0x177ed6){_0x249c19=_0x249c19-0x0;var _0x58dd91=_0xdc1e[_0x249c19];return _0x58dd91;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xedc1('0x0'),_0xedc1('0x1'),_0xedc1('0x2')];function createListener(_0xcb6538,_0x351ec9){return function(_0x221ea6){_0x351ec9[_0xedc1('0x3')](_0xcb6538,_0x221ea6);};}function removeListener(_0x539b08,_0x39056b){return function(){WhatsappMessageEvents[_0xedc1('0x4')](_0x539b08,_0x39056b);};}exports[_0xedc1('0x5')]=function(_0x3d31a2){for(var _0x3c11ab=0x0,_0x4e693b=events[_0xedc1('0x6')];_0x3c11ab<_0x4e693b;_0x3c11ab++){var _0x41818d=events[_0x3c11ab];var _0xd38bc6=createListener('whatsappMessage:'+_0x41818d,_0x3d31a2);WhatsappMessageEvents['on'](_0x41818d,_0xd38bc6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 967557b..16ab904 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 _0xbdbc=['/:id','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x149d2e,_0x3dff3f){var _0x42f92f=function(_0x5946df){while(--_0x5946df){_0x149d2e['push'](_0x149d2e['shift']());}};_0x42f92f(++_0x3dff3f);}(_0xbdbc,0x117));var _0xcbdb=function(_0x12fa10,_0x5e9810){_0x12fa10=_0x12fa10-0x0;var _0x14ce72=_0xbdbc[_0x12fa10];return _0x14ce72;};'use strict';var multer=require(_0xcbdb('0x0'));var util=require('util');var path=require(_0xcbdb('0x1'));var timeout=require(_0xcbdb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcbdb('0x3'));var interaction=require(_0xcbdb('0x4'));var config=require(_0xcbdb('0x5'));var controller=require('./whatsappQueue.controller');router[_0xcbdb('0x6')]('/',auth[_0xcbdb('0x7')](),controller['index']);router[_0xcbdb('0x6')](_0xcbdb('0x8'),auth[_0xcbdb('0x7')](),controller['describe']);router[_0xcbdb('0x6')](_0xcbdb('0x9'),auth['isAuthenticated'](),controller[_0xcbdb('0xa')]);router[_0xcbdb('0x6')](_0xcbdb('0xb'),auth[_0xcbdb('0x7')](),controller[_0xcbdb('0xc')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xcbdb('0xd')]);router[_0xcbdb('0x6')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xcbdb('0xe')]('/',auth['isAuthenticated'](),controller[_0xcbdb('0xf')]);router[_0xcbdb('0xe')](_0xcbdb('0x10'),auth[_0xcbdb('0x7')](),controller[_0xcbdb('0x11')]);router[_0xcbdb('0xe')]('/:id/users',auth[_0xcbdb('0x7')](),controller[_0xcbdb('0x12')]);router[_0xcbdb('0x13')]('/:id',auth[_0xcbdb('0x7')](),controller['update']);router['delete'](_0xcbdb('0x9'),auth[_0xcbdb('0x7')](),controller[_0xcbdb('0x14')]);router[_0xcbdb('0x15')]('/:id/teams',auth[_0xcbdb('0x7')](),controller[_0xcbdb('0x16')]);router[_0xcbdb('0x15')]('/:id/users',auth[_0xcbdb('0x7')](),controller[_0xcbdb('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe066=['get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller'];(function(_0x352e38,_0x5de996){var _0x72307b=function(_0x1d1ded){while(--_0x1d1ded){_0x352e38['push'](_0x352e38['shift']());}};_0x72307b(++_0x5de996);}(_0xe066,0xdf));var _0x6e06=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0xe066[_0x5c846d];return _0xd064e4;};'use strict';var multer=require(_0x6e06('0x0'));var util=require(_0x6e06('0x1'));var path=require(_0x6e06('0x2'));var timeout=require(_0x6e06('0x3'));var express=require(_0x6e06('0x4'));var router=express[_0x6e06('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6e06('0x6'));var interaction=require(_0x6e06('0x7'));var config=require('../../config/environment');var controller=require(_0x6e06('0x8'));router[_0x6e06('0x9')]('/',auth[_0x6e06('0xa')](),controller['index']);router[_0x6e06('0x9')]('/describe',auth[_0x6e06('0xa')](),controller[_0x6e06('0xb')]);router[_0x6e06('0x9')](_0x6e06('0xc'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xd')]);router['get'](_0x6e06('0xe'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xf')]);router['get'](_0x6e06('0x10'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x11')]);router[_0x6e06('0x9')](_0x6e06('0x12'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x13')]);router[_0x6e06('0x14')]('/',auth[_0x6e06('0xa')](),controller[_0x6e06('0x15')]);router[_0x6e06('0x14')](_0x6e06('0x10'),auth[_0x6e06('0xa')](),controller['addTeams']);router[_0x6e06('0x14')](_0x6e06('0x12'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x16')]);router[_0x6e06('0x17')](_0x6e06('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6e06('0x18')](_0x6e06('0xc'),auth['isAuthenticated'](),controller[_0x6e06('0x19')]);router[_0x6e06('0x18')](_0x6e06('0x10'),auth['isAuthenticated'](),controller[_0x6e06('0x1a')]);router[_0x6e06('0x18')](_0x6e06('0x12'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x1b')]);module[_0x6e06('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 72f9d67..74f7a99 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 _0x3fec=['rrmemory','STRING','sequelize','name','INTEGER'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc3fe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc3fe('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc3fe('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc3fe('0x3'),'beepall','roundrobin')},'description':{'type':Sequelize[_0xc3fe('0x4')]}}; \ No newline at end of file +var _0x7217=['roundrobin','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2a91ae,_0x1c216d){var _0x306cf5=function(_0x510a41){while(--_0x510a41){_0x2a91ae['push'](_0x2a91ae['shift']());}};_0x306cf5(++_0x1c216d);}(_0x7217,0xa9));var _0x7721=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7217[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7721('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7721('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7721('0x2')](_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'))},'description':{'type':Sequelize[_0x7721('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index bd3d645..bff7f13 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 _0xd295=['online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','../../components/parsers/qs','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','status','end','json','offset','undefined','limit','count','set','destroy','then','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','index','WhatsappQueue','rawAttributes','type','key','getOptions','include','findAll','rows','catch','show','keys','query','model','attributes','intersection','fields','length','includeAll','merge','options','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','UserWhatsappQueue','User','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents'];(function(_0x4a74cf,_0xb5bf13){var _0x11e8a7=function(_0x23eef1){while(--_0x23eef1){_0x4a74cf['push'](_0x4a74cf['shift']());}};_0x11e8a7(++_0xb5bf13);}(_0xd295,0x96));var _0x5d29=function(_0x263b31,_0x5c8cad){_0x263b31=_0x263b31-0x0;var _0x41632e=_0xd295[_0x263b31];return _0x41632e;};'use strict';var BPromise=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x5d29('0x2'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5d29('0x3'))['db'];config['redis']=_['defaults'](config[_0x5d29('0x4')],{'host':_0x5d29('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d29('0x4')]));require(_0x5d29('0x6'))[_0x5d29('0x7')](socket);function respondWithStatusCode(_0x32e9c2,_0x29d6d5){_0x29d6d5=_0x29d6d5||0xcc;return function(_0x200557){if(_0x200557){return _0x32e9c2['sendStatus'](_0x29d6d5);}return _0x32e9c2[_0x5d29('0x8')](_0x29d6d5)[_0x5d29('0x9')]();};}function respondWithResult(_0xb0207,_0x55bcf9){_0x55bcf9=_0x55bcf9||0xc8;return function(_0xf7567b){if(_0xf7567b){return _0xb0207['status'](_0x55bcf9)[_0x5d29('0xa')](_0xf7567b);}};}function respondWithFilteredResult(_0x119fa6,_0x5c245d){return function(_0x5a59ad){if(_0x5a59ad){var _0x1ba512=typeof _0x5c245d[_0x5d29('0xb')]===_0x5d29('0xc')&&typeof _0x5c245d[_0x5d29('0xd')]==='undefined';var _0x5d20de=_0x5a59ad[_0x5d29('0xe')];var _0x12c064=_0x1ba512?0x0:_0x5c245d[_0x5d29('0xb')];var _0x5ab37a=_0x1ba512?_0x5a59ad[_0x5d29('0xe')]:_0x5c245d[_0x5d29('0xb')]+_0x5c245d[_0x5d29('0xd')];var _0x50d625;if(_0x5ab37a>=_0x5d20de){_0x5ab37a=_0x5d20de;_0x50d625=0xc8;}else{_0x50d625=0xce;}_0x119fa6[_0x5d29('0x8')](_0x50d625);return _0x119fa6[_0x5d29('0xf')]('Content-Range',_0x12c064+'-'+_0x5ab37a+'/'+_0x5d20de)[_0x5d29('0xa')](_0x5a59ad);}return null;};}function saveUpdates(_0x376919){return function(_0x5dc78b){if(_0x5dc78b){return _0x5dc78b['update'](_0x376919)['then'](function(_0x3643cc){return _0x3643cc;});}return null;};}function removeEntity(_0x224176){return function(_0x31ad17){if(_0x31ad17){return _0x31ad17[_0x5d29('0x10')]()[_0x5d29('0x11')](function(){var _0x4e4e1b=_0x31ad17[_0x5d29('0x12')]({'plain':!![]});var _0x13ce55=_0x5d29('0x13');return db[_0x5d29('0x14')][_0x5d29('0x10')]({'where':{'type':_0x13ce55,'resourceId':_0x4e4e1b['id']}})['then'](function(){return _0x31ad17;});})[_0x5d29('0x11')](function(){_0x224176[_0x5d29('0x8')](0xcc)[_0x5d29('0x9')]();});}};}function handleEntityNotFound(_0x372e1b){return function(_0x5e0cd0){if(!_0x5e0cd0){_0x372e1b[_0x5d29('0x15')](0x194);}return _0x5e0cd0;};}function handleError(_0x398434,_0x3bbcdd){_0x3bbcdd=_0x3bbcdd||0x1f4;return function(_0x22adc1){logger[_0x5d29('0x16')](_0x22adc1[_0x5d29('0x17')]);if(_0x22adc1[_0x5d29('0x18')]){delete _0x22adc1[_0x5d29('0x18')];}_0x398434[_0x5d29('0x8')](_0x3bbcdd)['send'](_0x22adc1);};}exports[_0x5d29('0x19')]=function(_0x4630e2,_0x3e8e4e){var _0x37faef={};var _0x4d503={'count':0x0,'rows':[]};var _0x2984a5=_['map'](db[_0x5d29('0x1a')][_0x5d29('0x1b')],function(_0x5d4ab6){return{'name':_0x5d4ab6['fieldName'],'type':_0x5d4ab6[_0x5d29('0x1c')][_0x5d29('0x1d')]};});_0x37faef=qs[_0x5d29('0x1e')](_0x2984a5,_0x4630e2);var _0xf0d182={'where':_0x37faef['where']};return db[_0x5d29('0x1a')][_0x5d29('0xe')](_0xf0d182)[_0x5d29('0x11')](function(_0xfbca28){_0x4d503[_0x5d29('0xe')]=_0xfbca28;_0x37faef['include']=qs[_0x5d29('0x1f')](_0x4630e2['query']);return db[_0x5d29('0x1a')][_0x5d29('0x20')](_0x37faef);})[_0x5d29('0x11')](function(_0x566e44){_0x4d503[_0x5d29('0x21')]=_0x566e44;return _0x4d503;})[_0x5d29('0x11')](respondWithFilteredResult(_0x3e8e4e,_0x37faef))[_0x5d29('0x22')](handleError(_0x3e8e4e,null));};exports[_0x5d29('0x23')]=function(_0xd81c3e,_0x3778f4){var _0x38ab9d={'raw':!![],'where':{'id':_0xd81c3e['params']['id']}},_0x1d394e={};_0x1d394e['model']=_[_0x5d29('0x24')](db['WhatsappQueue']['rawAttributes']);_0x1d394e[_0x5d29('0x25')]=_['keys'](_0xd81c3e['query']);_0x1d394e['filters']=_['intersection'](_0x1d394e[_0x5d29('0x26')],_0x1d394e[_0x5d29('0x25')]);_0x38ab9d[_0x5d29('0x27')]=_[_0x5d29('0x28')](_0x1d394e[_0x5d29('0x26')],qs[_0x5d29('0x29')](_0xd81c3e[_0x5d29('0x25')][_0x5d29('0x29')]));_0x38ab9d[_0x5d29('0x27')]=_0x38ab9d[_0x5d29('0x27')][_0x5d29('0x2a')]?_0x38ab9d[_0x5d29('0x27')]:_0x1d394e[_0x5d29('0x26')];if(_0xd81c3e[_0x5d29('0x25')][_0x5d29('0x2b')]){_0x38ab9d[_0x5d29('0x1f')]=[{'all':!![]}];}_0x38ab9d=_[_0x5d29('0x2c')]({},_0x38ab9d,_0xd81c3e[_0x5d29('0x2d')]);return db['WhatsappQueue']['find'](_0x38ab9d)[_0x5d29('0x11')](handleEntityNotFound(_0x3778f4,null))[_0x5d29('0x11')](respondWithResult(_0x3778f4,null))[_0x5d29('0x22')](handleError(_0x3778f4,null));};exports[_0x5d29('0x2e')]=function(_0x178075,_0x3161e5){return db[_0x5d29('0x1a')][_0x5d29('0x2e')](_0x178075[_0x5d29('0x2f')],{})[_0x5d29('0x11')](function(_0x4b30a5){var _0x46de2d=_0x178075['user'][_0x5d29('0x12')]({'plain':!![]});if(!_0x46de2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46de2d['role']===_0x5d29('0x30')){var _0x389e42=_0x4b30a5[_0x5d29('0x12')]({'plain':!![]});var _0x51cfd0=_0x5d29('0x13');return db[_0x5d29('0x31')][_0x5d29('0x32')]({'where':{'name':_0x51cfd0,'userProfileId':_0x46de2d[_0x5d29('0x33')]},'raw':!![]})[_0x5d29('0x11')](function(_0x4588df){if(_0x4588df&&_0x4588df[_0x5d29('0x34')]===0x0){return db[_0x5d29('0x14')][_0x5d29('0x2e')]({'name':_0x389e42[_0x5d29('0x18')],'resourceId':_0x389e42['id'],'type':_0x4588df['name'],'sectionId':_0x4588df['id']},{})['then'](function(){return _0x4b30a5;});}else{return _0x4b30a5;}})['catch'](function(_0x2eb94b){logger[_0x5d29('0x16')](_0x5d29('0x35'),_0x2eb94b);throw _0x2eb94b;});}return _0x4b30a5;})['then'](respondWithResult(_0x3161e5,0xc9))[_0x5d29('0x22')](handleError(_0x3161e5,null));};exports['update']=function(_0x486912,_0x7a4bf0){if(_0x486912['body']['id']){delete _0x486912[_0x5d29('0x2f')]['id'];}return db[_0x5d29('0x1a')][_0x5d29('0x32')]({'where':{'id':_0x486912[_0x5d29('0x36')]['id']}})['then'](handleEntityNotFound(_0x7a4bf0,null))['then'](saveUpdates(_0x486912[_0x5d29('0x2f')],null))[_0x5d29('0x11')](respondWithResult(_0x7a4bf0,null))[_0x5d29('0x22')](handleError(_0x7a4bf0,null));};exports[_0x5d29('0x10')]=function(_0x245c0c,_0x3a0090){return db[_0x5d29('0x1a')][_0x5d29('0x32')]({'where':{'id':_0x245c0c[_0x5d29('0x36')]['id']}})[_0x5d29('0x11')](handleEntityNotFound(_0x3a0090,null))['then'](removeEntity(_0x3a0090,null))[_0x5d29('0x22')](handleError(_0x3a0090,null));};exports[_0x5d29('0x37')]=function(_0x5d51c4,_0xcca09b){return db[_0x5d29('0x1a')][_0x5d29('0x37')]()[_0x5d29('0x11')](respondWithResult(_0xcca09b,null))[_0x5d29('0x22')](handleError(_0xcca09b,null));};exports['getMembers']=function(_0x2c69a6,_0x5886f2){var _0x214920={'raw':!![],'where':{}},_0x5eaa79={},_0x566ca5;return db['WhatsappQueue'][_0x5d29('0x38')]({'where':{'id':_0x2c69a6[_0x5d29('0x36')]['id']}})['then'](handleEntityNotFound(_0x5886f2,null))['then'](function(_0x98313b){if(_0x98313b){_0x566ca5=_0x98313b[_0x5d29('0x12')]({'plain':!![]});_0x5eaa79[_0x5d29('0x26')]=_[_0x5d29('0x24')](db['UserWhatsappQueue'][_0x5d29('0x1b')]);_0x5eaa79[_0x5d29('0x25')]=_[_0x5d29('0x24')](_0x2c69a6[_0x5d29('0x25')]);_0x5eaa79[_0x5d29('0x39')]=_[_0x5d29('0x28')](_0x5eaa79['model'],_0x5eaa79[_0x5d29('0x25')]);_0x214920[_0x5d29('0x27')]=_[_0x5d29('0x28')](_0x5eaa79[_0x5d29('0x26')],qs[_0x5d29('0x29')](_0x2c69a6[_0x5d29('0x25')][_0x5d29('0x29')]));_0x214920[_0x5d29('0x27')]=_0x214920[_0x5d29('0x27')][_0x5d29('0x2a')]?_0x214920[_0x5d29('0x27')]:_0x5eaa79['model'];if(!_0x2c69a6['query'][_0x5d29('0x3a')](_0x5d29('0x3b'))){_0x214920[_0x5d29('0xd')]=qs[_0x5d29('0xd')](_0x2c69a6['query'][_0x5d29('0xd')]);_0x214920['offset']=qs[_0x5d29('0xb')](_0x2c69a6[_0x5d29('0x25')][_0x5d29('0xb')]);}_0x214920[_0x5d29('0x3c')]=qs[_0x5d29('0x3d')](_0x2c69a6['query'][_0x5d29('0x3d')]);_0x214920[_0x5d29('0x3e')]=qs[_0x5d29('0x39')](_[_0x5d29('0x3f')](_0x2c69a6['query'],_0x5eaa79['filters']));_0x214920[_0x5d29('0x3e')]['WhatsappQueueId']=_0x98313b['id'];if(_0x2c69a6['query']['filter']){_0x214920[_0x5d29('0x3e')]=_['merge'](_0x214920['where'],{'$or':_[_0x5d29('0x40')](_0x214920[_0x5d29('0x27')],function(_0x356e05){var _0x3039cb={};_0x3039cb[_0x356e05]={'$like':'%'+_0x2c69a6['query'][_0x5d29('0x41')]+'%'};return _0x3039cb;})});}_0x214920=_[_0x5d29('0x2c')]({},_0x214920,_0x2c69a6[_0x5d29('0x2d')]);return db[_0x5d29('0x42')][_0x5d29('0x20')](_0x214920);}})['then'](function(_0x34ab2c){if(_0x34ab2c){return db[_0x5d29('0x43')]['findAndCountAll']({'where':{'id':_[_0x5d29('0x40')](_0x34ab2c,'UserId'),'role':_0x5d29('0x44')},'attributes':['id',_0x5d29('0x18'),_0x5d29('0x45'),_0x5d29('0x46'),_0x5d29('0x47')]});}})[_0x5d29('0x11')](function(_0x37fa9c){if(_0x37fa9c){return{'count':_0x37fa9c[_0x5d29('0xe')],'rows':_['map'](_0x37fa9c[_0x5d29('0x21')],function(_0x1fc0d0){return{'membername':_0x1fc0d0[_0x5d29('0x18')],'UserId':_0x1fc0d0['id'],'queue_name':_0x566ca5[_0x5d29('0x18')],'WhatsappQueueId':_0x566ca5['id'],'interface':util[_0x5d29('0x48')](_0x5d29('0x49'),_0x5d29('0x4a'),_0x1fc0d0[_0x5d29('0x18')]),'penalty':0x0,'paused':_0x1fc0d0[_0x5d29('0x45')],'createdAt':_0x1fc0d0[_0x5d29('0x47')],'updatedAt':_0x1fc0d0[_0x5d29('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5886f2,_0x214920))[_0x5d29('0x22')](handleError(_0x5886f2,null));};exports['getTeams']=function(_0x6b5639,_0x230f0e){var _0x4ab35f={};var _0xe8a57a={};var _0x3785a6;var _0x55d5ee;return db[_0x5d29('0x1a')][_0x5d29('0x38')]({'where':{'id':_0x6b5639[_0x5d29('0x36')]['id']}})['then'](handleEntityNotFound(_0x230f0e,null))[_0x5d29('0x11')](function(_0x204907){if(_0x204907){_0x3785a6=_0x204907;_0xe8a57a[_0x5d29('0x26')]=_[_0x5d29('0x24')](db[_0x5d29('0x4b')][_0x5d29('0x1b')]);_0xe8a57a[_0x5d29('0x25')]=_['keys'](_0x6b5639[_0x5d29('0x25')]);_0xe8a57a[_0x5d29('0x39')]=_[_0x5d29('0x28')](_0xe8a57a[_0x5d29('0x26')],_0xe8a57a[_0x5d29('0x25')]);_0x4ab35f['attributes']=_[_0x5d29('0x28')](_0xe8a57a['model'],qs['fields'](_0x6b5639[_0x5d29('0x25')][_0x5d29('0x29')]));_0x4ab35f['attributes']=_0x4ab35f[_0x5d29('0x27')]['length']?_0x4ab35f[_0x5d29('0x27')]:_0xe8a57a[_0x5d29('0x26')];_0x4ab35f[_0x5d29('0x3c')]=qs[_0x5d29('0x3d')](_0x6b5639[_0x5d29('0x25')]['sort']);_0x4ab35f[_0x5d29('0x3e')]=qs[_0x5d29('0x39')](_['pick'](_0x6b5639[_0x5d29('0x25')],_0xe8a57a['filters']));if(_0x6b5639[_0x5d29('0x25')][_0x5d29('0x41')]){_0x4ab35f[_0x5d29('0x3e')]=_[_0x5d29('0x2c')](_0x4ab35f[_0x5d29('0x3e')],{'$or':_['map'](_0x4ab35f['attributes'],function(_0x444df9){var _0x25e426={};_0x25e426[_0x444df9]={'$like':'%'+_0x6b5639[_0x5d29('0x25')][_0x5d29('0x41')]+'%'};return _0x25e426;})});}_0x4ab35f=_['merge']({},_0x4ab35f,_0x6b5639[_0x5d29('0x2d')]);return _0x3785a6[_0x5d29('0x4c')](_0x4ab35f);}})['then'](function(_0x142e0f){if(_0x142e0f){_0x55d5ee=_0x142e0f[_0x5d29('0x2a')];if(!_0x6b5639[_0x5d29('0x25')]['hasOwnProperty'](_0x5d29('0x3b'))){_0x4ab35f[_0x5d29('0xd')]=qs[_0x5d29('0xd')](_0x6b5639['query']['limit']);_0x4ab35f[_0x5d29('0xb')]=qs[_0x5d29('0xb')](_0x6b5639[_0x5d29('0x25')]['offset']);}return _0x3785a6[_0x5d29('0x4c')](_0x4ab35f);}})[_0x5d29('0x11')](function(_0x2bef7f){if(_0x2bef7f){return _0x2bef7f?{'count':_0x55d5ee,'rows':_0x2bef7f}:null;}})[_0x5d29('0x11')](respondWithResult(_0x230f0e,null))['catch'](handleError(_0x230f0e,null));};exports[_0x5d29('0x4d')]=function(_0x57b2d0,_0x5071c9){var _0x435b30=_0x57b2d0[_0x5d29('0x2f')][_0x5d29('0x4e')];return db[_0x5d29('0x4b')]['findAll']({'where':{'id':_0x435b30},'attributes':['id'],'include':[{'model':db[_0x5d29('0x43')],'as':_0x5d29('0x4f'),'attributes':['id',_0x5d29('0x18'),_0x5d29('0x50'),_0x5d29('0x51'),'interface'],'raw':!![]}]})['then'](function(_0x50f312){if(_0x50f312){var _0x24c154=_[_0x5d29('0x52')](_0x50f312,function(_0x384936){var _0x35c903=_0x384936['get']({'plain':!![]});return _0x35c903[_0x5d29('0x4f')];});return db['WhatsappQueue'][_0x5d29('0x32')]({'where':{'id':_0x57b2d0['params']['id']}})[_0x5d29('0x11')](function(_0x1ce611){return db['sequelize'][_0x5d29('0x53')](function(_0x351c9d){return _0x1ce611['addTeams'](_0x435b30,{'transaction':_0x351c9d})['then'](function(){return BPromise[_0x5d29('0x54')](_0x24c154,function(_0x1430fa){return db[_0x5d29('0x42')][_0x5d29('0x55')]({'where':{'UserId':_0x1430fa['id'],'WhatsappQueueId':_0x57b2d0[_0x5d29('0x36')]['id']},'transaction':_0x351c9d});});})[_0x5d29('0x11')](function(){_0x24c154[_0x5d29('0x56')](function(_0x5287ff){socket[_0x5d29('0x57')](_0x5d29('0x58'),{'UserId':_0x5287ff['id'],'WhatsappQueueId':_0x1ce611['id']});});});});});}})[_0x5d29('0x11')](respondWithStatusCode(_0x5071c9,null))[_0x5d29('0x22')](handleError(_0x5071c9,null));};exports[_0x5d29('0x59')]=function(_0x2943cc,_0x58bcd5){return db[_0x5d29('0x4b')][_0x5d29('0x20')]({'where':{'id':_0x2943cc[_0x5d29('0x25')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5d29('0x4f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58bcd5,null))[_0x5d29('0x11')](function(_0x408c1a){var _0x2a0106=_[_0x5d29('0x40')](_0x408c1a,'id');var _0x546a2f=[];var _0x18a022=[];var _0x33ed6e=squel['select']();_0x33ed6e[_0x5d29('0x5a')](_0x5d29('0x5b'))[_0x5d29('0x5c')](_0x5d29('0x5d'),'tq')[_0x5d29('0x5e')]('user_has_teams','ut',_0x5d29('0x5f'))[_0x5d29('0x3e')](_0x5d29('0x60'),_0x2943cc[_0x5d29('0x36')]['id']);for(var _0x3a2461=0x0;_0x3a2461<_0x408c1a[_0x5d29('0x2a')];_0x3a2461+=0x1){let _0x27a00e=_0x408c1a[_0x3a2461];for(var _0xf797eb=0x0;_0xf797eb<_0x27a00e[_0x5d29('0x4f')]['length'];_0xf797eb+=0x1){let _0x51ce46=_0x27a00e[_0x5d29('0x4f')][_0xf797eb];var _0x39ebdc=_0x33ed6e[_0x5d29('0x61')]();_0x39ebdc[_0x5d29('0x3e')](_0x5d29('0x62'),_0x51ce46['id']);_0x18a022[_0x5d29('0x63')](db[_0x5d29('0x64')][_0x5d29('0x25')](_0x39ebdc['toString'](),{'type':db[_0x5d29('0x64')][_0x5d29('0x65')][_0x5d29('0x66')]})[_0x5d29('0x11')](function(_0x111477){if(_0x111477[_0x5d29('0x2a')]===0x1){return _0x51ce46['id'];}else{var _0x530def=_[_0x5d29('0x67')](_[_0x5d29('0x40')](_0x111477,'TeamId'),function(_0x554e5d){return _[_0x5d29('0x68')](_0x2a0106,_0x554e5d);});if(_0x530def){return _0x51ce46['id'];}}}));}}return BPromise[_0x5d29('0x69')](_0x18a022)[_0x5d29('0x11')](function(_0xbe67bd){_0x546a2f=_(_0x546a2f)[_0x5d29('0x6a')](_0xbe67bd)['compact']()[_0x5d29('0x6b')]();return db[_0x5d29('0x1a')][_0x5d29('0x32')]({'where':{'id':_0x2943cc[_0x5d29('0x36')]['id']}})[_0x5d29('0x11')](function(_0x1678b1){return db[_0x5d29('0x64')]['transaction'](function(_0x549864){return _0x1678b1[_0x5d29('0x59')](_0x2943cc[_0x5d29('0x25')][_0x5d29('0x4e')],{'transaction':_0x549864})[_0x5d29('0x11')](function(){if(!_[_0x5d29('0x6c')](_0x546a2f)){return _0x1678b1[_0x5d29('0x6d')](_0x546a2f,{'transaction':_0x549864});}})[_0x5d29('0x11')](function(){_0x546a2f[_0x5d29('0x56')](function(_0x17b6f7){socket[_0x5d29('0x57')](_0x5d29('0x6e'),{'UserId':_0x17b6f7,'WhatsappQueueId':_0x1678b1['id']});});});});});});})[_0x5d29('0x11')](respondWithStatusCode(_0x58bcd5,null))[_0x5d29('0x22')](handleError(_0x58bcd5,null));};exports[_0x5d29('0x6f')]=function(_0x24bfe9,_0x18a7ee){return db['WhatsappQueue'][_0x5d29('0x32')]({'where':{'id':_0x24bfe9[_0x5d29('0x36')]['id']}})[_0x5d29('0x11')](handleEntityNotFound(_0x18a7ee,null))[_0x5d29('0x11')](function(_0xa320d4){if(_0xa320d4){return _0xa320d4['addAgents'](_0x24bfe9[_0x5d29('0x2f')][_0x5d29('0x4e')],_['omit'](_0x24bfe9[_0x5d29('0x2f')],[_0x5d29('0x4e'),'id'])||{})[_0x5d29('0x70')](function(_0x306029){for(var _0x1d732e=0x0;_0x1d732e<_0x24bfe9[_0x5d29('0x2f')][_0x5d29('0x4e')][_0x5d29('0x2a')];_0x1d732e+=0x1){socket[_0x5d29('0x57')](_0x5d29('0x58'),{'UserId':Number(_0x24bfe9[_0x5d29('0x2f')][_0x5d29('0x4e')][_0x1d732e]),'WhatsappQueueId':Number(_0x24bfe9[_0x5d29('0x36')]['id'])});}return _0x306029;});}})['then'](respondWithResult(_0x18a7ee,null))['catch'](handleError(_0x18a7ee,null));};exports['removeAgents']=function(_0x22269e,_0x4a1ce0){return db['WhatsappQueue']['find']({'where':{'id':_0x22269e[_0x5d29('0x36')]['id']}})[_0x5d29('0x11')](handleEntityNotFound(_0x4a1ce0,null))[_0x5d29('0x11')](function(_0x4d3b86){if(_0x4d3b86){return _0x4d3b86[_0x5d29('0x6d')](_0x22269e[_0x5d29('0x25')]['ids'])[_0x5d29('0x11')](function(){if(_[_0x5d29('0x71')](_0x22269e['query'][_0x5d29('0x4e')])){for(var _0x55604d=0x0;_0x55604d<_0x22269e[_0x5d29('0x25')][_0x5d29('0x4e')][_0x5d29('0x2a')];_0x55604d+=0x1){socket[_0x5d29('0x57')](_0x5d29('0x6e'),{'UserId':Number(_0x22269e[_0x5d29('0x25')][_0x5d29('0x4e')][_0x55604d]),'WhatsappQueueId':Number(_0x22269e['params']['id'])});}}else{socket[_0x5d29('0x57')](_0x5d29('0x6e'),{'UserId':Number(_0x22269e[_0x5d29('0x25')]['ids']),'WhatsappQueueId':Number(_0x22269e[_0x5d29('0x36')]['id'])});}});}})[_0x5d29('0x11')](respondWithStatusCode(_0x4a1ce0,null))['catch'](handleError(_0x4a1ce0,null));};exports[_0x5d29('0x72')]=function(_0x30788f,_0x5a3235){var _0x3a2424={};var _0x500635={};var _0x438d04;var _0x98fe07;return db['WhatsappQueue'][_0x5d29('0x38')]({'where':{'id':_0x30788f[_0x5d29('0x36')]['id']}})[_0x5d29('0x11')](handleEntityNotFound(_0x5a3235,null))[_0x5d29('0x11')](function(_0x5aca38){if(_0x5aca38){_0x438d04=_0x5aca38;_0x500635[_0x5d29('0x26')]=_['keys'](db[_0x5d29('0x43')]['rawAttributes']);_0x500635[_0x5d29('0x25')]=_[_0x5d29('0x24')](_0x30788f[_0x5d29('0x25')]);_0x500635['filters']=_['intersection'](_0x500635[_0x5d29('0x26')],_0x500635[_0x5d29('0x25')]);_0x3a2424[_0x5d29('0x27')]=_[_0x5d29('0x28')](_0x500635['model'],qs[_0x5d29('0x29')](_0x30788f['query'][_0x5d29('0x29')]));_0x3a2424[_0x5d29('0x27')]=_0x3a2424[_0x5d29('0x27')][_0x5d29('0x2a')]?_0x3a2424['attributes']:_0x500635[_0x5d29('0x26')];_0x3a2424[_0x5d29('0x3c')]=qs[_0x5d29('0x3d')](_0x30788f['query'][_0x5d29('0x3d')]);_0x3a2424[_0x5d29('0x3e')]=qs[_0x5d29('0x39')](_[_0x5d29('0x3f')](_0x30788f[_0x5d29('0x25')],_0x500635['filters']));if(_0x30788f[_0x5d29('0x25')][_0x5d29('0x41')]){_0x3a2424[_0x5d29('0x3e')]=_[_0x5d29('0x2c')](_0x3a2424[_0x5d29('0x3e')],{'$or':_[_0x5d29('0x40')](_0x3a2424[_0x5d29('0x27')],function(_0x5aa58c){var _0xddf4c1={};_0xddf4c1[_0x5aa58c]={'$like':'%'+_0x30788f[_0x5d29('0x25')][_0x5d29('0x41')]+'%'};return _0xddf4c1;})});}_0x3a2424=_[_0x5d29('0x2c')]({},_0x3a2424,_0x30788f[_0x5d29('0x2d')]);return _0x438d04[_0x5d29('0x72')](_0x3a2424);}})['then'](function(_0x21a650){if(_0x21a650){_0x98fe07=_0x21a650['length'];if(!_0x30788f['query'][_0x5d29('0x3a')](_0x5d29('0x3b'))){_0x3a2424[_0x5d29('0xd')]=qs['limit'](_0x30788f[_0x5d29('0x25')]['limit']);_0x3a2424[_0x5d29('0xb')]=qs['offset'](_0x30788f[_0x5d29('0x25')][_0x5d29('0xb')]);}return _0x438d04[_0x5d29('0x72')](_0x3a2424);}})['then'](function(_0x23f0a2){if(_0x23f0a2){return _0x23f0a2?{'count':_0x98fe07,'rows':_0x23f0a2}:null;}})[_0x5d29('0x11')](respondWithResult(_0x5a3235,null))[_0x5d29('0x22')](handleError(_0x5a3235,null));}; \ No newline at end of file +var _0x4ffc=['getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','send','index','map','WhatsappQueue','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappQueueId','filter','merge','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','Team','rawAttributes','pick','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','ids','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','omit','userWhatsappQueue:save','userWhatsappQueue:remove'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4ffc,0x1dd));var _0xc4ff=function(_0x3741a3,_0x236559){_0x3741a3=_0x3741a3-0x0;var _0x3beacd=_0x4ffc[_0x3741a3];return _0x3beacd;};'use strict';var BPromise=require(_0xc4ff('0x0'));var util=require(_0xc4ff('0x1'));var _=require(_0xc4ff('0x2'));var squel=require(_0xc4ff('0x3'));var Redis=require(_0xc4ff('0x4'));var qs=require(_0xc4ff('0x5'));var logger=require('../../config/logger')(_0xc4ff('0x6'));var config=require(_0xc4ff('0x7'));var db=require(_0xc4ff('0x8'))['db'];config[_0xc4ff('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc4ff('0xa'))(new Redis(config['redis']));require(_0xc4ff('0xb'))[_0xc4ff('0xc')](socket);function respondWithStatusCode(_0x380fc9,_0x5d682d){_0x5d682d=_0x5d682d||0xcc;return function(_0x365f57){if(_0x365f57){return _0x380fc9[_0xc4ff('0xd')](_0x5d682d);}return _0x380fc9[_0xc4ff('0xe')](_0x5d682d)[_0xc4ff('0xf')]();};}function respondWithResult(_0x441331,_0x538f3e){_0x538f3e=_0x538f3e||0xc8;return function(_0x3debe9){if(_0x3debe9){return _0x441331[_0xc4ff('0xe')](_0x538f3e)[_0xc4ff('0x10')](_0x3debe9);}};}function respondWithFilteredResult(_0x593b7e,_0x41b1bd){return function(_0x51a996){if(_0x51a996){var _0x3f36db=typeof _0x41b1bd[_0xc4ff('0x11')]===_0xc4ff('0x12')&&typeof _0x41b1bd[_0xc4ff('0x13')]===_0xc4ff('0x12');var _0x3ee724=_0x51a996[_0xc4ff('0x14')];var _0x77e87c=_0x3f36db?0x0:_0x41b1bd[_0xc4ff('0x11')];var _0x41eca3=_0x3f36db?_0x51a996[_0xc4ff('0x14')]:_0x41b1bd[_0xc4ff('0x11')]+_0x41b1bd['limit'];var _0x3bffb6;if(_0x41eca3>=_0x3ee724){_0x41eca3=_0x3ee724;_0x3bffb6=0xc8;}else{_0x3bffb6=0xce;}_0x593b7e[_0xc4ff('0xe')](_0x3bffb6);return _0x593b7e[_0xc4ff('0x15')]('Content-Range',_0x77e87c+'-'+_0x41eca3+'/'+_0x3ee724)[_0xc4ff('0x10')](_0x51a996);}return null;};}function saveUpdates(_0x33de20){return function(_0xfba68f){if(_0xfba68f){return _0xfba68f[_0xc4ff('0x16')](_0x33de20)[_0xc4ff('0x17')](function(_0x918d70){return _0x918d70;});}return null;};}function removeEntity(_0x4cca6d){return function(_0x3705c9){if(_0x3705c9){return _0x3705c9['destroy']()[_0xc4ff('0x17')](function(){var _0x22f4a1=_0x3705c9[_0xc4ff('0x18')]({'plain':!![]});var _0x3d0c0f=_0xc4ff('0x19');return db[_0xc4ff('0x1a')][_0xc4ff('0x1b')]({'where':{'type':_0x3d0c0f,'resourceId':_0x22f4a1['id']}})[_0xc4ff('0x17')](function(){return _0x3705c9;});})['then'](function(){_0x4cca6d[_0xc4ff('0xe')](0xcc)[_0xc4ff('0xf')]();});}};}function handleEntityNotFound(_0x179c2c){return function(_0x1a79b2){if(!_0x1a79b2){_0x179c2c[_0xc4ff('0xd')](0x194);}return _0x1a79b2;};}function handleError(_0x5228da,_0x30e877){_0x30e877=_0x30e877||0x1f4;return function(_0x22e87e){logger[_0xc4ff('0x1c')](_0x22e87e[_0xc4ff('0x1d')]);if(_0x22e87e[_0xc4ff('0x1e')]){delete _0x22e87e[_0xc4ff('0x1e')];}_0x5228da[_0xc4ff('0xe')](_0x30e877)[_0xc4ff('0x1f')](_0x22e87e);};}exports[_0xc4ff('0x20')]=function(_0xfadfa6,_0xe87ab){var _0x5ed1f8={};var _0x3d6b18={'count':0x0,'rows':[]};var _0x2f5e44=_[_0xc4ff('0x21')](db[_0xc4ff('0x22')]['rawAttributes'],function(_0x4288e1){return{'name':_0x4288e1['fieldName'],'type':_0x4288e1['type']['key']};});_0x5ed1f8=qs['getOptions'](_0x2f5e44,_0xfadfa6);var _0x26e7ec={'where':_0x5ed1f8['where']};return db[_0xc4ff('0x22')]['count'](_0x26e7ec)[_0xc4ff('0x17')](function(_0x48e5df){_0x3d6b18[_0xc4ff('0x14')]=_0x48e5df;_0x5ed1f8[_0xc4ff('0x23')]=qs['include'](_0xfadfa6[_0xc4ff('0x24')]);return db[_0xc4ff('0x22')][_0xc4ff('0x25')](_0x5ed1f8);})[_0xc4ff('0x17')](function(_0x1b0e83){_0x3d6b18[_0xc4ff('0x26')]=_0x1b0e83;return _0x3d6b18;})[_0xc4ff('0x17')](respondWithFilteredResult(_0xe87ab,_0x5ed1f8))[_0xc4ff('0x27')](handleError(_0xe87ab,null));};exports[_0xc4ff('0x28')]=function(_0x4cb16c,_0x257631){var _0x5b161f={'raw':!![],'where':{'id':_0x4cb16c[_0xc4ff('0x29')]['id']}},_0x52ee4d={};_0x52ee4d[_0xc4ff('0x2a')]=_[_0xc4ff('0x2b')](db[_0xc4ff('0x22')]['rawAttributes']);_0x52ee4d[_0xc4ff('0x24')]=_[_0xc4ff('0x2b')](_0x4cb16c[_0xc4ff('0x24')]);_0x52ee4d[_0xc4ff('0x2c')]=_[_0xc4ff('0x2d')](_0x52ee4d[_0xc4ff('0x2a')],_0x52ee4d[_0xc4ff('0x24')]);_0x5b161f['attributes']=_[_0xc4ff('0x2d')](_0x52ee4d[_0xc4ff('0x2a')],qs[_0xc4ff('0x2e')](_0x4cb16c[_0xc4ff('0x24')][_0xc4ff('0x2e')]));_0x5b161f[_0xc4ff('0x2f')]=_0x5b161f[_0xc4ff('0x2f')][_0xc4ff('0x30')]?_0x5b161f[_0xc4ff('0x2f')]:_0x52ee4d['model'];if(_0x4cb16c[_0xc4ff('0x24')]['includeAll']){_0x5b161f[_0xc4ff('0x23')]=[{'all':!![]}];}_0x5b161f=_['merge']({},_0x5b161f,_0x4cb16c[_0xc4ff('0x31')]);return db['WhatsappQueue']['find'](_0x5b161f)['then'](handleEntityNotFound(_0x257631,null))['then'](respondWithResult(_0x257631,null))[_0xc4ff('0x27')](handleError(_0x257631,null));};exports[_0xc4ff('0x32')]=function(_0x237a89,_0x162540){return db[_0xc4ff('0x22')][_0xc4ff('0x32')](_0x237a89[_0xc4ff('0x33')],{})['then'](function(_0x407e7d){var _0x39f26f=_0x237a89[_0xc4ff('0x34')]['get']({'plain':!![]});if(!_0x39f26f)throw new Error(_0xc4ff('0x35'));if(_0x39f26f['role']==='user'){var _0x7df493=_0x407e7d['get']({'plain':!![]});var _0x5c9b21=_0xc4ff('0x19');return db[_0xc4ff('0x36')][_0xc4ff('0x37')]({'where':{'name':_0x5c9b21,'userProfileId':_0x39f26f[_0xc4ff('0x38')]},'raw':!![]})[_0xc4ff('0x17')](function(_0x4b73e5){if(_0x4b73e5&&_0x4b73e5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x7df493[_0xc4ff('0x1e')],'resourceId':_0x7df493['id'],'type':_0x4b73e5[_0xc4ff('0x1e')],'sectionId':_0x4b73e5['id']},{})[_0xc4ff('0x17')](function(){return _0x407e7d;});}else{return _0x407e7d;}})[_0xc4ff('0x27')](function(_0xe9130b){logger[_0xc4ff('0x1c')](_0xc4ff('0x39'),_0xe9130b);throw _0xe9130b;});}return _0x407e7d;})[_0xc4ff('0x17')](respondWithResult(_0x162540,0xc9))[_0xc4ff('0x27')](handleError(_0x162540,null));};exports['update']=function(_0xdbd5f2,_0x202b6d){if(_0xdbd5f2['body']['id']){delete _0xdbd5f2[_0xc4ff('0x33')]['id'];}return db[_0xc4ff('0x22')]['find']({'where':{'id':_0xdbd5f2[_0xc4ff('0x29')]['id']}})['then'](handleEntityNotFound(_0x202b6d,null))['then'](saveUpdates(_0xdbd5f2[_0xc4ff('0x33')],null))[_0xc4ff('0x17')](respondWithResult(_0x202b6d,null))[_0xc4ff('0x27')](handleError(_0x202b6d,null));};exports[_0xc4ff('0x1b')]=function(_0x3a2b62,_0x46b4a5){return db[_0xc4ff('0x22')][_0xc4ff('0x37')]({'where':{'id':_0x3a2b62[_0xc4ff('0x29')]['id']}})[_0xc4ff('0x17')](handleEntityNotFound(_0x46b4a5,null))[_0xc4ff('0x17')](removeEntity(_0x46b4a5,null))[_0xc4ff('0x27')](handleError(_0x46b4a5,null));};exports['describe']=function(_0x6f2b5,_0x5789f9){return db[_0xc4ff('0x22')][_0xc4ff('0x3a')]()['then'](respondWithResult(_0x5789f9,null))[_0xc4ff('0x27')](handleError(_0x5789f9,null));};exports[_0xc4ff('0x3b')]=function(_0x49b518,_0x47c2c7){var _0x5464fa={'raw':!![],'where':{}},_0xb87ed={},_0x5ddf76;return db[_0xc4ff('0x22')][_0xc4ff('0x3c')]({'where':{'id':_0x49b518['params']['id']}})['then'](handleEntityNotFound(_0x47c2c7,null))[_0xc4ff('0x17')](function(_0x2bebfb){if(_0x2bebfb){_0x5ddf76=_0x2bebfb[_0xc4ff('0x18')]({'plain':!![]});_0xb87ed['model']=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0xb87ed[_0xc4ff('0x24')]=_[_0xc4ff('0x2b')](_0x49b518[_0xc4ff('0x24')]);_0xb87ed['filters']=_['intersection'](_0xb87ed[_0xc4ff('0x2a')],_0xb87ed[_0xc4ff('0x24')]);_0x5464fa[_0xc4ff('0x2f')]=_[_0xc4ff('0x2d')](_0xb87ed[_0xc4ff('0x2a')],qs[_0xc4ff('0x2e')](_0x49b518[_0xc4ff('0x24')][_0xc4ff('0x2e')]));_0x5464fa['attributes']=_0x5464fa['attributes'][_0xc4ff('0x30')]?_0x5464fa[_0xc4ff('0x2f')]:_0xb87ed[_0xc4ff('0x2a')];if(!_0x49b518['query'][_0xc4ff('0x3d')](_0xc4ff('0x3e'))){_0x5464fa[_0xc4ff('0x13')]=qs['limit'](_0x49b518[_0xc4ff('0x24')][_0xc4ff('0x13')]);_0x5464fa[_0xc4ff('0x11')]=qs[_0xc4ff('0x11')](_0x49b518[_0xc4ff('0x24')][_0xc4ff('0x11')]);}_0x5464fa[_0xc4ff('0x3f')]=qs[_0xc4ff('0x40')](_0x49b518['query']['sort']);_0x5464fa[_0xc4ff('0x41')]=qs['filters'](_['pick'](_0x49b518[_0xc4ff('0x24')],_0xb87ed['filters']));_0x5464fa[_0xc4ff('0x41')][_0xc4ff('0x42')]=_0x2bebfb['id'];if(_0x49b518['query'][_0xc4ff('0x43')]){_0x5464fa[_0xc4ff('0x41')]=_[_0xc4ff('0x44')](_0x5464fa[_0xc4ff('0x41')],{'$or':_[_0xc4ff('0x21')](_0x5464fa[_0xc4ff('0x2f')],function(_0x59aef5){var _0x1c5566={};_0x1c5566[_0x59aef5]={'$like':'%'+_0x49b518[_0xc4ff('0x24')]['filter']+'%'};return _0x1c5566;})});}_0x5464fa=_[_0xc4ff('0x44')]({},_0x5464fa,_0x49b518[_0xc4ff('0x31')]);return db[_0xc4ff('0x45')][_0xc4ff('0x25')](_0x5464fa);}})[_0xc4ff('0x17')](function(_0x586395){if(_0x586395){return db[_0xc4ff('0x46')][_0xc4ff('0x47')]({'where':{'id':_[_0xc4ff('0x21')](_0x586395,_0xc4ff('0x48')),'role':_0xc4ff('0x49')},'attributes':['id','name',_0xc4ff('0x4a'),_0xc4ff('0x4b'),'createdAt']});}})[_0xc4ff('0x17')](function(_0x157fe9){if(_0x157fe9){return{'count':_0x157fe9[_0xc4ff('0x14')],'rows':_[_0xc4ff('0x21')](_0x157fe9[_0xc4ff('0x26')],function(_0xea75fa){return{'membername':_0xea75fa[_0xc4ff('0x1e')],'UserId':_0xea75fa['id'],'queue_name':_0x5ddf76[_0xc4ff('0x1e')],'WhatsappQueueId':_0x5ddf76['id'],'interface':util[_0xc4ff('0x4c')](_0xc4ff('0x4d'),'SIP',_0xea75fa[_0xc4ff('0x1e')]),'penalty':0x0,'paused':_0xea75fa[_0xc4ff('0x4a')],'createdAt':_0xea75fa[_0xc4ff('0x4e')],'updatedAt':_0xea75fa[_0xc4ff('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc4ff('0x17')](respondWithFilteredResult(_0x47c2c7,_0x5464fa))[_0xc4ff('0x27')](handleError(_0x47c2c7,null));};exports['getTeams']=function(_0x484b04,_0x546b02){var _0x598f3d={};var _0x313672={};var _0x47366b;var _0x9106cc;return db[_0xc4ff('0x22')][_0xc4ff('0x3c')]({'where':{'id':_0x484b04[_0xc4ff('0x29')]['id']}})[_0xc4ff('0x17')](handleEntityNotFound(_0x546b02,null))[_0xc4ff('0x17')](function(_0x56e390){if(_0x56e390){_0x47366b=_0x56e390;_0x313672['model']=_[_0xc4ff('0x2b')](db[_0xc4ff('0x4f')][_0xc4ff('0x50')]);_0x313672[_0xc4ff('0x24')]=_[_0xc4ff('0x2b')](_0x484b04[_0xc4ff('0x24')]);_0x313672[_0xc4ff('0x2c')]=_['intersection'](_0x313672[_0xc4ff('0x2a')],_0x313672[_0xc4ff('0x24')]);_0x598f3d[_0xc4ff('0x2f')]=_[_0xc4ff('0x2d')](_0x313672[_0xc4ff('0x2a')],qs[_0xc4ff('0x2e')](_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x2e')]));_0x598f3d['attributes']=_0x598f3d[_0xc4ff('0x2f')][_0xc4ff('0x30')]?_0x598f3d['attributes']:_0x313672[_0xc4ff('0x2a')];_0x598f3d[_0xc4ff('0x3f')]=qs[_0xc4ff('0x40')](_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x40')]);_0x598f3d[_0xc4ff('0x41')]=qs['filters'](_[_0xc4ff('0x51')](_0x484b04['query'],_0x313672[_0xc4ff('0x2c')]));if(_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x43')]){_0x598f3d[_0xc4ff('0x41')]=_[_0xc4ff('0x44')](_0x598f3d[_0xc4ff('0x41')],{'$or':_[_0xc4ff('0x21')](_0x598f3d['attributes'],function(_0x418073){var _0x9a72c4={};_0x9a72c4[_0x418073]={'$like':'%'+_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x43')]+'%'};return _0x9a72c4;})});}_0x598f3d=_[_0xc4ff('0x44')]({},_0x598f3d,_0x484b04[_0xc4ff('0x31')]);return _0x47366b[_0xc4ff('0x52')](_0x598f3d);}})[_0xc4ff('0x17')](function(_0x33d6c0){if(_0x33d6c0){_0x9106cc=_0x33d6c0['length'];if(!_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x3d')]('nolimit')){_0x598f3d['limit']=qs[_0xc4ff('0x13')](_0x484b04['query'][_0xc4ff('0x13')]);_0x598f3d['offset']=qs[_0xc4ff('0x11')](_0x484b04[_0xc4ff('0x24')][_0xc4ff('0x11')]);}return _0x47366b['getTeams'](_0x598f3d);}})[_0xc4ff('0x17')](function(_0x59bf1a){if(_0x59bf1a){return _0x59bf1a?{'count':_0x9106cc,'rows':_0x59bf1a}:null;}})[_0xc4ff('0x17')](respondWithResult(_0x546b02,null))[_0xc4ff('0x27')](handleError(_0x546b02,null));};exports[_0xc4ff('0x53')]=function(_0x29408f,_0x50b7eb){var _0x47ae1f=_0x29408f['body']['ids'];return db[_0xc4ff('0x4f')][_0xc4ff('0x25')]({'where':{'id':_0x47ae1f},'attributes':['id'],'include':[{'model':db[_0xc4ff('0x46')],'as':_0xc4ff('0x54'),'attributes':['id',_0xc4ff('0x1e'),_0xc4ff('0x55'),_0xc4ff('0x56'),_0xc4ff('0x57')],'raw':!![]}]})[_0xc4ff('0x17')](function(_0x1ab3b8){if(_0x1ab3b8){var _0x4722f8=_[_0xc4ff('0x58')](_0x1ab3b8,function(_0x4b1871){var _0xc93e5b=_0x4b1871[_0xc4ff('0x18')]({'plain':!![]});return _0xc93e5b[_0xc4ff('0x54')];});return db['WhatsappQueue'][_0xc4ff('0x37')]({'where':{'id':_0x29408f[_0xc4ff('0x29')]['id']}})[_0xc4ff('0x17')](function(_0x55e1c8){return db['sequelize'][_0xc4ff('0x59')](function(_0x42879f){return _0x55e1c8['addTeams'](_0x47ae1f,{'transaction':_0x42879f})[_0xc4ff('0x17')](function(){return BPromise[_0xc4ff('0x5a')](_0x4722f8,function(_0x50769e){return db[_0xc4ff('0x45')][_0xc4ff('0x5b')]({'where':{'UserId':_0x50769e['id'],'WhatsappQueueId':_0x29408f['params']['id']},'transaction':_0x42879f});});})[_0xc4ff('0x17')](function(){_0x4722f8['forEach'](function(_0x2eaccb){socket[_0xc4ff('0x5c')]('userWhatsappQueue:save',{'UserId':_0x2eaccb['id'],'WhatsappQueueId':_0x55e1c8['id']});});});});});}})[_0xc4ff('0x17')](respondWithStatusCode(_0x50b7eb,null))[_0xc4ff('0x27')](handleError(_0x50b7eb,null));};exports[_0xc4ff('0x5d')]=function(_0x51148d,_0x5b2d41){return db['Team'][_0xc4ff('0x25')]({'where':{'id':_0x51148d['query'][_0xc4ff('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xc4ff('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4ff('0x17')](handleEntityNotFound(_0x5b2d41,null))[_0xc4ff('0x17')](function(_0x3409d6){var _0x45911e=_[_0xc4ff('0x21')](_0x3409d6,'id');var _0x4441ed=[];var _0x59d950=[];var _0x41d3e4=squel['select']();_0x41d3e4[_0xc4ff('0x5f')](_0xc4ff('0x60'))[_0xc4ff('0x61')](_0xc4ff('0x62'),'tq')[_0xc4ff('0x63')]('user_has_teams','ut',_0xc4ff('0x64'))[_0xc4ff('0x41')](_0xc4ff('0x65'),_0x51148d[_0xc4ff('0x29')]['id']);for(var _0x50cf0e=0x0;_0x50cf0e<_0x3409d6[_0xc4ff('0x30')];_0x50cf0e+=0x1){let _0x1c9882=_0x3409d6[_0x50cf0e];for(var _0x541455=0x0;_0x541455<_0x1c9882[_0xc4ff('0x54')][_0xc4ff('0x30')];_0x541455+=0x1){let _0x226bf2=_0x1c9882[_0xc4ff('0x54')][_0x541455];var _0x157cf3=_0x41d3e4['clone']();_0x157cf3[_0xc4ff('0x41')](_0xc4ff('0x66'),_0x226bf2['id']);_0x59d950[_0xc4ff('0x67')](db['sequelize'][_0xc4ff('0x24')](_0x157cf3[_0xc4ff('0x68')](),{'type':db['sequelize'][_0xc4ff('0x69')][_0xc4ff('0x6a')]})[_0xc4ff('0x17')](function(_0x3e9107){if(_0x3e9107['length']===0x1){return _0x226bf2['id'];}else{var _0x4e9d57=_[_0xc4ff('0x6b')](_[_0xc4ff('0x21')](_0x3e9107,_0xc4ff('0x6c')),function(_0x3ea503){return _[_0xc4ff('0x6d')](_0x45911e,_0x3ea503);});if(_0x4e9d57){return _0x226bf2['id'];}}}));}}return BPromise[_0xc4ff('0x6e')](_0x59d950)['then'](function(_0x4d121c){_0x4441ed=_(_0x4441ed)[_0xc4ff('0x6f')](_0x4d121c)['compact']()[_0xc4ff('0x70')]();return db['WhatsappQueue'][_0xc4ff('0x37')]({'where':{'id':_0x51148d[_0xc4ff('0x29')]['id']}})[_0xc4ff('0x17')](function(_0x8aac3){return db['sequelize']['transaction'](function(_0x16b7ce){return _0x8aac3[_0xc4ff('0x5d')](_0x51148d[_0xc4ff('0x24')]['ids'],{'transaction':_0x16b7ce})[_0xc4ff('0x17')](function(){if(!_[_0xc4ff('0x71')](_0x4441ed)){return _0x8aac3[_0xc4ff('0x72')](_0x4441ed,{'transaction':_0x16b7ce});}})[_0xc4ff('0x17')](function(){_0x4441ed['forEach'](function(_0x229962){socket[_0xc4ff('0x5c')]('userWhatsappQueue:remove',{'UserId':_0x229962,'WhatsappQueueId':_0x8aac3['id']});});});});});});})['then'](respondWithStatusCode(_0x5b2d41,null))[_0xc4ff('0x27')](handleError(_0x5b2d41,null));};exports['addAgents']=function(_0x3b1d1b,_0x939172){return db['WhatsappQueue']['find']({'where':{'id':_0x3b1d1b['params']['id']}})[_0xc4ff('0x17')](handleEntityNotFound(_0x939172,null))[_0xc4ff('0x17')](function(_0x1851e3){if(_0x1851e3){return _0x1851e3['addAgents'](_0x3b1d1b['body']['ids'],_[_0xc4ff('0x73')](_0x3b1d1b[_0xc4ff('0x33')],[_0xc4ff('0x5e'),'id'])||{})['spread'](function(_0x1af949){for(var _0x2bdfea=0x0;_0x2bdfea<_0x3b1d1b[_0xc4ff('0x33')][_0xc4ff('0x5e')][_0xc4ff('0x30')];_0x2bdfea+=0x1){socket[_0xc4ff('0x5c')](_0xc4ff('0x74'),{'UserId':Number(_0x3b1d1b[_0xc4ff('0x33')][_0xc4ff('0x5e')][_0x2bdfea]),'WhatsappQueueId':Number(_0x3b1d1b[_0xc4ff('0x29')]['id'])});}return _0x1af949;});}})[_0xc4ff('0x17')](respondWithResult(_0x939172,null))[_0xc4ff('0x27')](handleError(_0x939172,null));};exports[_0xc4ff('0x72')]=function(_0x2d24f1,_0x36b89c){return db[_0xc4ff('0x22')][_0xc4ff('0x37')]({'where':{'id':_0x2d24f1['params']['id']}})[_0xc4ff('0x17')](handleEntityNotFound(_0x36b89c,null))[_0xc4ff('0x17')](function(_0x4726da){if(_0x4726da){return _0x4726da[_0xc4ff('0x72')](_0x2d24f1['query'][_0xc4ff('0x5e')])['then'](function(){if(_['isArray'](_0x2d24f1[_0xc4ff('0x24')][_0xc4ff('0x5e')])){for(var _0x3b507e=0x0;_0x3b507e<_0x2d24f1[_0xc4ff('0x24')]['ids'][_0xc4ff('0x30')];_0x3b507e+=0x1){socket[_0xc4ff('0x5c')](_0xc4ff('0x75'),{'UserId':Number(_0x2d24f1[_0xc4ff('0x24')][_0xc4ff('0x5e')][_0x3b507e]),'WhatsappQueueId':Number(_0x2d24f1[_0xc4ff('0x29')]['id'])});}}else{socket[_0xc4ff('0x5c')](_0xc4ff('0x75'),{'UserId':Number(_0x2d24f1[_0xc4ff('0x24')][_0xc4ff('0x5e')]),'WhatsappQueueId':Number(_0x2d24f1[_0xc4ff('0x29')]['id'])});}});}})[_0xc4ff('0x17')](respondWithStatusCode(_0x36b89c,null))[_0xc4ff('0x27')](handleError(_0x36b89c,null));};exports[_0xc4ff('0x76')]=function(_0x10d576,_0x1e140b){var _0x14a2f6={};var _0x3175e5={};var _0x4018fc;var _0x7397fe;return db[_0xc4ff('0x22')][_0xc4ff('0x3c')]({'where':{'id':_0x10d576['params']['id']}})[_0xc4ff('0x17')](handleEntityNotFound(_0x1e140b,null))[_0xc4ff('0x17')](function(_0x30988c){if(_0x30988c){_0x4018fc=_0x30988c;_0x3175e5[_0xc4ff('0x2a')]=_[_0xc4ff('0x2b')](db['User'][_0xc4ff('0x50')]);_0x3175e5[_0xc4ff('0x24')]=_[_0xc4ff('0x2b')](_0x10d576['query']);_0x3175e5[_0xc4ff('0x2c')]=_['intersection'](_0x3175e5[_0xc4ff('0x2a')],_0x3175e5[_0xc4ff('0x24')]);_0x14a2f6[_0xc4ff('0x2f')]=_['intersection'](_0x3175e5[_0xc4ff('0x2a')],qs[_0xc4ff('0x2e')](_0x10d576['query']['fields']));_0x14a2f6[_0xc4ff('0x2f')]=_0x14a2f6['attributes']['length']?_0x14a2f6['attributes']:_0x3175e5['model'];_0x14a2f6[_0xc4ff('0x3f')]=qs[_0xc4ff('0x40')](_0x10d576[_0xc4ff('0x24')]['sort']);_0x14a2f6[_0xc4ff('0x41')]=qs[_0xc4ff('0x2c')](_['pick'](_0x10d576['query'],_0x3175e5['filters']));if(_0x10d576[_0xc4ff('0x24')][_0xc4ff('0x43')]){_0x14a2f6['where']=_[_0xc4ff('0x44')](_0x14a2f6['where'],{'$or':_['map'](_0x14a2f6['attributes'],function(_0x2a2189){var _0x4806d1={};_0x4806d1[_0x2a2189]={'$like':'%'+_0x10d576['query'][_0xc4ff('0x43')]+'%'};return _0x4806d1;})});}_0x14a2f6=_[_0xc4ff('0x44')]({},_0x14a2f6,_0x10d576[_0xc4ff('0x31')]);return _0x4018fc['getAgents'](_0x14a2f6);}})[_0xc4ff('0x17')](function(_0x1a80b0){if(_0x1a80b0){_0x7397fe=_0x1a80b0[_0xc4ff('0x30')];if(!_0x10d576[_0xc4ff('0x24')][_0xc4ff('0x3d')]('nolimit')){_0x14a2f6['limit']=qs[_0xc4ff('0x13')](_0x10d576['query'][_0xc4ff('0x13')]);_0x14a2f6[_0xc4ff('0x11')]=qs[_0xc4ff('0x11')](_0x10d576[_0xc4ff('0x24')][_0xc4ff('0x11')]);}return _0x4018fc[_0xc4ff('0x76')](_0x14a2f6);}})[_0xc4ff('0x17')](function(_0x5d0fb6){if(_0x5d0fb6){return _0x5d0fb6?{'count':_0x7397fe,'rows':_0x5d0fb6}:null;}})[_0xc4ff('0x17')](respondWithResult(_0x1e140b,null))['catch'](handleError(_0x1e140b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e7f17d4..9dd67a1 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 _0x3e8f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x3e8f,0x1d9));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf3e8('0x0'));var WhatsappQueue=require(_0xf3e8('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf3e8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3e8('0x3'),'afterDestroy':_0xf3e8('0x4')};function emitEvent(_0x5a5d10){return function(_0xe97f0e,_0x57b438,_0x272cd2){WhatsappQueueEvents['emit'](_0x5a5d10+':'+_0xe97f0e['id'],_0xe97f0e);WhatsappQueueEvents[_0xf3e8('0x5')](_0x5a5d10,_0xe97f0e);_0x272cd2(null);};}for(var e in events){if(events[_0xf3e8('0x6')](e)){var event=events[e];WhatsappQueue[_0xf3e8('0x7')](e,emitEvent(event));}}module[_0xf3e8('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xce59=['remove','emit','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xce59,0x162));var _0x9ce5=function(_0xb8a736,_0x1bbded){_0xb8a736=_0xb8a736-0x0;var _0x54dc30=_0xce59[_0xb8a736];return _0x54dc30;};'use strict';var EventEmitter=require(_0x9ce5('0x0'));var WhatsappQueue=require(_0x9ce5('0x1'))['db'][_0x9ce5('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9ce5('0x3')](0x0);var events={'afterCreate':_0x9ce5('0x4'),'afterUpdate':_0x9ce5('0x5'),'afterDestroy':_0x9ce5('0x6')};function emitEvent(_0x472a76){return function(_0x33f1da,_0x441ba1,_0x26e993){WhatsappQueueEvents[_0x9ce5('0x7')](_0x472a76+':'+_0x33f1da['id'],_0x33f1da);WhatsappQueueEvents[_0x9ce5('0x7')](_0x472a76,_0x33f1da);_0x26e993(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8eb4202..8047df7 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 _0x7f9f=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x30eb30,_0x12ef65){var _0x20a708=function(_0x5604d9){while(--_0x5604d9){_0x30eb30['push'](_0x30eb30['shift']());}};_0x20a708(++_0x12ef65);}(_0x7f9f,0x1ee));var _0xf7f9=function(_0x2d5a6a,_0x40cba2){_0x2d5a6a=_0x2d5a6a-0x0;var _0x28bb55=_0x7f9f[_0x2d5a6a];return _0x28bb55;};'use strict';var _=require(_0xf7f9('0x0'));var util=require(_0xf7f9('0x1'));var logger=require(_0xf7f9('0x2'))(_0xf7f9('0x3'));var moment=require(_0xf7f9('0x4'));var BPromise=require(_0xf7f9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf7f9('0x6'));var config=require(_0xf7f9('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xf7f9('0x8')]=function(_0x5666fe,_0x4d4f3c){return _0x5666fe['define'](_0xf7f9('0x9'),attributes,{'tableName':_0xf7f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa644=['api','moment','bluebird','path','rimraf','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x4de994,_0x16423f){var _0x305284=function(_0x249ee5){while(--_0x249ee5){_0x4de994['push'](_0x4de994['shift']());}};_0x305284(++_0x16423f);}(_0xa644,0xdf));var _0x4a64=function(_0x3ec1a1,_0x38ae9f){_0x3ec1a1=_0x3ec1a1-0x0;var _0x1fad9a=_0xa644[_0x3ec1a1];return _0x1fad9a;};'use strict';var _=require(_0x4a64('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4a64('0x1'));var moment=require(_0x4a64('0x2'));var BPromise=require(_0x4a64('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a64('0x4'));var rimraf=require(_0x4a64('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x47e3f3,_0x1a15ac){return _0x47e3f3['define'](_0x4a64('0x6'),attributes,{'tableName':_0x4a64('0x7'),'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 9c490ae..68f6202 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 _0x59b5=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x279619,_0x41cb2f){var _0x5c2e3c=function(_0x30ed43){while(--_0x30ed43){_0x279619['push'](_0x279619['shift']());}};_0x5c2e3c(++_0x41cb2f);}(_0x59b5,0xf9));var _0x559b=function(_0x3b6ed9,_0xf02a15){_0x3b6ed9=_0x3b6ed9-0x0;var _0x166367=_0x59b5[_0x3b6ed9];return _0x166367;};'use strict';var _=require(_0x559b('0x0'));var util=require(_0x559b('0x1'));var moment=require('moment');var BPromise=require(_0x559b('0x2'));var rs=require(_0x559b('0x3'));var fs=require('fs');var Redis=require(_0x559b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x559b('0x5'));var logger=require(_0x559b('0x6'))(_0x559b('0x7'));var config=require(_0x559b('0x8'));var jayson=require(_0x559b('0x9'));var client=jayson[_0x559b('0xa')][_0x559b('0xb')]({'port':0x232a});config[_0x559b('0xc')]=_[_0x559b('0xd')](config['redis'],{'host':_0x559b('0xe'),'port':0x18eb});var socket=require(_0x559b('0xf'))(new Redis(config[_0x559b('0xc')]));require('./whatsappQueue.socket')[_0x559b('0x10')](socket);function respondWithRpcPromise(_0x5e4dcd,_0x2851e6,_0x4a6df5){return new BPromise(function(_0x94985f,_0x18b44f){return client[_0x559b('0x11')](_0x5e4dcd,_0x4a6df5)['then'](function(_0x527445){logger[_0x559b('0x12')](_0x559b('0x13'),_0x2851e6,_0x559b('0x14'));logger[_0x559b('0x15')](_0x559b('0x16'),_0x2851e6,_0x559b('0x14'),JSON[_0x559b('0x17')](_0x527445));if(_0x527445[_0x559b('0x18')]){if(_0x527445[_0x559b('0x18')][_0x559b('0x19')]===0x1f4){logger[_0x559b('0x18')](_0x559b('0x13'),_0x2851e6,_0x527445[_0x559b('0x18')]['message']);return _0x18b44f(_0x527445[_0x559b('0x18')][_0x559b('0x1a')]);}logger['error'](_0x559b('0x13'),_0x2851e6,_0x527445[_0x559b('0x18')]['message']);return _0x94985f(_0x527445[_0x559b('0x18')]['message']);}else{logger[_0x559b('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2851e6,'request\x20sent');_0x94985f(_0x527445[_0x559b('0x1b')][_0x559b('0x1a')]);}})[_0x559b('0x1c')](function(_0x24589a){logger[_0x559b('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x2851e6,_0x24589a);_0x18b44f(_0x24589a);});});}exports['GetWhatsappQueue']=function(_0x21cb03){var _0x591dcb=this;return new Promise(function(_0x430c0a,_0x5f402e){return db[_0x559b('0x1d')][_0x559b('0x1e')]({'raw':_0x21cb03[_0x559b('0x1f')]?_0x21cb03[_0x559b('0x1f')][_0x559b('0x20')]===undefined?!![]:![]:!![],'where':_0x21cb03[_0x559b('0x1f')]?_0x21cb03[_0x559b('0x1f')][_0x559b('0x21')]||null:null,'attributes':_0x21cb03[_0x559b('0x1f')]?_0x21cb03[_0x559b('0x1f')][_0x559b('0x22')]||null:null,'limit':_0x21cb03[_0x559b('0x1f')]?_0x21cb03['options'][_0x559b('0x23')]||null:null,'include':_0x21cb03[_0x559b('0x1f')]?_0x21cb03[_0x559b('0x1f')]['include']?_['map'](_0x21cb03['options'][_0x559b('0x24')],function(_0x3d449d){return{'model':db[_0x3d449d[_0x559b('0x25')]],'as':_0x3d449d['as'],'attributes':_0x3d449d[_0x559b('0x22')],'include':_0x3d449d[_0x559b('0x24')]?_[_0x559b('0x26')](_0x3d449d[_0x559b('0x24')],function(_0x87b8a6){return{'model':db[_0x87b8a6['model']],'as':_0x87b8a6['as'],'attributes':_0x87b8a6['attributes'],'include':_0x87b8a6[_0x559b('0x24')]?_['map'](_0x87b8a6[_0x559b('0x24')],function(_0x33f862){return{'model':db[_0x33f862['model']],'as':_0x33f862['as'],'attributes':_0x33f862[_0x559b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x559b('0x27')](function(_0x17e247){logger[_0x559b('0x12')](_0x559b('0x28'),_0x21cb03);logger[_0x559b('0x15')](_0x559b('0x28'),_0x21cb03,JSON[_0x559b('0x17')](_0x17e247));_0x430c0a(_0x17e247);})[_0x559b('0x1c')](function(_0x10db21){logger['error']('GetWhatsappQueue',_0x10db21['message'],_0x21cb03);_0x5f402e(_0x591dcb['error'](0x1f4,_0x10db21[_0x559b('0x1a')]));});});};exports[_0x559b('0x29')]=function(_0x50a3db){var _0x56e3f1=this;return new Promise(function(_0x419ca8,_0x2a1621){return db['WhatsappQueue'][_0x559b('0x2a')]({'raw':_0x50a3db[_0x559b('0x1f')]?_0x50a3db[_0x559b('0x1f')][_0x559b('0x20')]===undefined?!![]:![]:!![],'where':_0x50a3db[_0x559b('0x1f')]?_0x50a3db[_0x559b('0x1f')][_0x559b('0x21')]||null:null,'attributes':_0x50a3db[_0x559b('0x1f')]?_0x50a3db[_0x559b('0x1f')][_0x559b('0x22')]||null:null,'include':_0x50a3db[_0x559b('0x1f')]?_0x50a3db['options'][_0x559b('0x24')]?_[_0x559b('0x26')](_0x50a3db[_0x559b('0x1f')][_0x559b('0x24')],function(_0x332546){return{'model':db[_0x332546['model']],'as':_0x332546['as'],'attributes':_0x332546[_0x559b('0x22')],'include':_0x332546[_0x559b('0x24')]?_[_0x559b('0x26')](_0x332546[_0x559b('0x24')],function(_0x3d3af1){return{'model':db[_0x3d3af1[_0x559b('0x25')]],'as':_0x3d3af1['as'],'attributes':_0x3d3af1[_0x559b('0x22')],'include':_0x3d3af1[_0x559b('0x24')]?_[_0x559b('0x26')](_0x3d3af1['include'],function(_0x3706e3){return{'model':db[_0x3706e3['model']],'as':_0x3706e3['as'],'attributes':_0x3706e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x559b('0x27')](function(_0x2f55b4){logger[_0x559b('0x12')]('ShowWhatsappQueue',_0x50a3db);logger[_0x559b('0x15')]('ShowWhatsappQueue',_0x50a3db,JSON[_0x559b('0x17')](_0x2f55b4));_0x419ca8(_0x2f55b4);})[_0x559b('0x1c')](function(_0x2381d2){logger[_0x559b('0x18')](_0x559b('0x29'),_0x2381d2[_0x559b('0x1a')],_0x50a3db);_0x2a1621(_0x56e3f1[_0x559b('0x18')](0x1f4,_0x2381d2['message']));});});}; \ No newline at end of file +var _0x9764=['catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','include','model','attributes','map','stringify','find','then','ShowWhatsappQueue','util','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','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x2e22a5,_0x5dc3b8){var _0x124c76=function(_0xd49346){while(--_0xd49346){_0x2e22a5['push'](_0x2e22a5['shift']());}};_0x124c76(++_0x5dc3b8);}(_0x9764,0xe1));var _0x4976=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9764[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4976('0x0'));var moment=require(_0x4976('0x1'));var BPromise=require(_0x4976('0x2'));var rs=require(_0x4976('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4976('0x4'))['db'];var utils=require(_0x4976('0x5'));var logger=require('../../config/logger')(_0x4976('0x6'));var config=require(_0x4976('0x7'));var jayson=require(_0x4976('0x8'));var client=jayson[_0x4976('0x9')][_0x4976('0xa')]({'port':0x232a});config[_0x4976('0xb')]=_[_0x4976('0xc')](config[_0x4976('0xb')],{'host':_0x4976('0xd'),'port':0x18eb});var socket=require(_0x4976('0xe'))(new Redis(config[_0x4976('0xb')]));require(_0x4976('0xf'))[_0x4976('0x10')](socket);function respondWithRpcPromise(_0x5070a2,_0x59b4b5,_0x354d36){return new BPromise(function(_0x1139c8,_0x31d388){return client[_0x4976('0x11')](_0x5070a2,_0x354d36)['then'](function(_0x543a9f){logger[_0x4976('0x12')](_0x4976('0x13'),_0x59b4b5,'request\x20sent');logger[_0x4976('0x14')](_0x4976('0x15'),_0x59b4b5,_0x4976('0x16'),JSON['stringify'](_0x543a9f));if(_0x543a9f[_0x4976('0x17')]){if(_0x543a9f['error'][_0x4976('0x18')]===0x1f4){logger[_0x4976('0x17')](_0x4976('0x13'),_0x59b4b5,_0x543a9f[_0x4976('0x17')][_0x4976('0x19')]);return _0x31d388(_0x543a9f[_0x4976('0x17')][_0x4976('0x19')]);}logger[_0x4976('0x17')](_0x4976('0x13'),_0x59b4b5,_0x543a9f[_0x4976('0x17')]['message']);return _0x1139c8(_0x543a9f[_0x4976('0x17')][_0x4976('0x19')]);}else{logger['info'](_0x4976('0x13'),_0x59b4b5,'request\x20sent');_0x1139c8(_0x543a9f[_0x4976('0x1a')][_0x4976('0x19')]);}})[_0x4976('0x1b')](function(_0xe7e1a2){logger['error'](_0x4976('0x13'),_0x59b4b5,_0xe7e1a2);_0x31d388(_0xe7e1a2);});});}exports[_0x4976('0x1c')]=function(_0x4587bb){var _0x4a7614=this;return new Promise(function(_0x181404,_0x1d6d94){return db[_0x4976('0x1d')][_0x4976('0x1e')]({'raw':_0x4587bb[_0x4976('0x1f')]?_0x4587bb[_0x4976('0x1f')][_0x4976('0x20')]===undefined?!![]:![]:!![],'where':_0x4587bb[_0x4976('0x1f')]?_0x4587bb[_0x4976('0x1f')][_0x4976('0x21')]||null:null,'attributes':_0x4587bb[_0x4976('0x1f')]?_0x4587bb[_0x4976('0x1f')]['attributes']||null:null,'limit':_0x4587bb[_0x4976('0x1f')]?_0x4587bb[_0x4976('0x1f')]['limit']||null:null,'include':_0x4587bb[_0x4976('0x1f')]?_0x4587bb[_0x4976('0x1f')]['include']?_['map'](_0x4587bb['options'][_0x4976('0x22')],function(_0x59b326){return{'model':db[_0x59b326[_0x4976('0x23')]],'as':_0x59b326['as'],'attributes':_0x59b326[_0x4976('0x24')],'include':_0x59b326[_0x4976('0x22')]?_['map'](_0x59b326[_0x4976('0x22')],function(_0x3623b3){return{'model':db[_0x3623b3[_0x4976('0x23')]],'as':_0x3623b3['as'],'attributes':_0x3623b3['attributes'],'include':_0x3623b3['include']?_[_0x4976('0x25')](_0x3623b3[_0x4976('0x22')],function(_0x4ff6fc){return{'model':db[_0x4ff6fc['model']],'as':_0x4ff6fc['as'],'attributes':_0x4ff6fc[_0x4976('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x183ebc){logger['info'](_0x4976('0x1c'),_0x4587bb);logger[_0x4976('0x14')](_0x4976('0x1c'),_0x4587bb,JSON[_0x4976('0x26')](_0x183ebc));_0x181404(_0x183ebc);})[_0x4976('0x1b')](function(_0x4eca4a){logger['error'](_0x4976('0x1c'),_0x4eca4a['message'],_0x4587bb);_0x1d6d94(_0x4a7614['error'](0x1f4,_0x4eca4a[_0x4976('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x12f95f){var _0x2e7c31=this;return new Promise(function(_0x3952ce,_0x3979d2){return db[_0x4976('0x1d')][_0x4976('0x27')]({'raw':_0x12f95f[_0x4976('0x1f')]?_0x12f95f['options'][_0x4976('0x20')]===undefined?!![]:![]:!![],'where':_0x12f95f[_0x4976('0x1f')]?_0x12f95f[_0x4976('0x1f')][_0x4976('0x21')]||null:null,'attributes':_0x12f95f[_0x4976('0x1f')]?_0x12f95f[_0x4976('0x1f')][_0x4976('0x24')]||null:null,'include':_0x12f95f['options']?_0x12f95f[_0x4976('0x1f')][_0x4976('0x22')]?_['map'](_0x12f95f['options'][_0x4976('0x22')],function(_0x433445){return{'model':db[_0x433445[_0x4976('0x23')]],'as':_0x433445['as'],'attributes':_0x433445[_0x4976('0x24')],'include':_0x433445[_0x4976('0x22')]?_[_0x4976('0x25')](_0x433445[_0x4976('0x22')],function(_0x26eac2){return{'model':db[_0x26eac2[_0x4976('0x23')]],'as':_0x26eac2['as'],'attributes':_0x26eac2[_0x4976('0x24')],'include':_0x26eac2[_0x4976('0x22')]?_['map'](_0x26eac2[_0x4976('0x22')],function(_0x36f7e5){return{'model':db[_0x36f7e5['model']],'as':_0x36f7e5['as'],'attributes':_0x36f7e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x4976('0x28')](function(_0x3fe75d){logger[_0x4976('0x12')](_0x4976('0x29'),_0x12f95f);logger[_0x4976('0x14')]('ShowWhatsappQueue',_0x12f95f,JSON['stringify'](_0x3fe75d));_0x3952ce(_0x3fe75d);})[_0x4976('0x1b')](function(_0x1eced9){logger[_0x4976('0x17')](_0x4976('0x29'),_0x1eced9['message'],_0x12f95f);_0x3979d2(_0x2e7c31[_0x4976('0x17')](0x1f4,_0x1eced9['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e0bfd6d..237e5dd 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 _0x6b3e=['register','whatsappQueue:','save','remove','update','emit'];(function(_0x3194c2,_0x807309){var _0x4c666a=function(_0x5011ce){while(--_0x5011ce){_0x3194c2['push'](_0x3194c2['shift']());}};_0x4c666a(++_0x807309);}(_0x6b3e,0x194));var _0xe6b3=function(_0x5168b3,_0x20ab1b){_0x5168b3=_0x5168b3-0x0;var _0x5a1c6a=_0x6b3e[_0x5168b3];return _0x5a1c6a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xe6b3('0x0'),_0xe6b3('0x1'),_0xe6b3('0x2')];function createListener(_0x5e13c7,_0x47e162){return function(_0x5abefa){_0x47e162[_0xe6b3('0x3')](_0x5e13c7,_0x5abefa);};}function removeListener(_0x1c9234,_0x21756d){return function(){WhatsappQueueEvents['removeListener'](_0x1c9234,_0x21756d);};}exports[_0xe6b3('0x4')]=function(_0x28b8ed){for(var _0x217076=0x0,_0x3218c9=events['length'];_0x217076<_0x3218c9;_0x217076++){var _0x5988fa=events[_0x217076];var _0x547752=createListener(_0xe6b3('0x5')+_0x5988fa,_0x28b8ed);WhatsappQueueEvents['on'](_0x5988fa,_0x547752);}}; \ No newline at end of file +var _0x6e6a=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1dd00b,_0x22de90){var _0x1ca3b7=function(_0x581cab){while(--_0x581cab){_0x1dd00b['push'](_0x1dd00b['shift']());}};_0x1ca3b7(++_0x22de90);}(_0x6e6a,0xf8));var _0xa6e6=function(_0x5ac4e9,_0x1d3e7d){_0x5ac4e9=_0x5ac4e9-0x0;var _0xd37547=_0x6e6a[_0x5ac4e9];return _0xd37547;};'use strict';var WhatsappQueueEvents=require(_0xa6e6('0x0'));var events=[_0xa6e6('0x1'),_0xa6e6('0x2'),_0xa6e6('0x3')];function createListener(_0x4c6cad,_0x3b1818){return function(_0x9e10e9){_0x3b1818[_0xa6e6('0x4')](_0x4c6cad,_0x9e10e9);};}function removeListener(_0x278ecc,_0x51b0f2){return function(){WhatsappQueueEvents[_0xa6e6('0x5')](_0x278ecc,_0x51b0f2);};}exports[_0xa6e6('0x6')]=function(_0x4ec82a){for(var _0x598897=0x0,_0x4e2bcf=events[_0xa6e6('0x7')];_0x598897<_0x4e2bcf;_0x598897++){var _0x4648df=events[_0x598897];var _0x17199e=createListener('whatsappQueue:'+_0x4648df,_0x4ec82a);WhatsappQueueEvents['on'](_0x4648df,_0x17199e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 12f5158..f967972 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 _0xedf7=['connect-timeout','express','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','update','destroy','exports','multer','util','path'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xedf7,0x15d));var _0x7edf=function(_0x1a309d,_0x586075){_0x1a309d=_0x1a309d-0x0;var _0x3d06ad=_0xedf7[_0x1a309d];return _0x3d06ad;};'use strict';var multer=require(_0x7edf('0x0'));var util=require(_0x7edf('0x1'));var path=require(_0x7edf('0x2'));var timeout=require(_0x7edf('0x3'));var express=require(_0x7edf('0x4'));var router=express[_0x7edf('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7edf('0x6'));var config=require('../../config/environment');var controller=require(_0x7edf('0x7'));router[_0x7edf('0x8')]('/',auth[_0x7edf('0x9')](),controller['index']);router[_0x7edf('0x8')](_0x7edf('0xa'),auth[_0x7edf('0x9')](),controller[_0x7edf('0xb')]);router['get'](_0x7edf('0xc'),auth[_0x7edf('0x9')](),controller['show']);router['post']('/',auth[_0x7edf('0x9')](),controller['create']);router['put'](_0x7edf('0xc'),auth[_0x7edf('0x9')](),controller[_0x7edf('0xd')]);router['delete']('/:id',auth[_0x7edf('0x9')](),controller[_0x7edf('0xe')]);module[_0x7edf('0xf')]=router; \ No newline at end of file +var _0x0d1c=['exports','multer','util','express','Router','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','destroy'];(function(_0x93566d,_0x23aeef){var _0x2b2079=function(_0x45688e){while(--_0x45688e){_0x93566d['push'](_0x93566d['shift']());}};_0x2b2079(++_0x23aeef);}(_0x0d1c,0xd3));var _0xc0d1=function(_0x1fc010,_0x48c093){_0x1fc010=_0x1fc010-0x0;var _0x228c0e=_0x0d1c[_0x1fc010];return _0x228c0e;};'use strict';var multer=require(_0xc0d1('0x0'));var util=require(_0xc0d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0d1('0x2'));var router=express[_0xc0d1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc0d1('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xc0d1('0x5')]('/',auth['isAuthenticated'](),controller[_0xc0d1('0x6')]);router[_0xc0d1('0x5')](_0xc0d1('0x7'),auth[_0xc0d1('0x8')](),controller[_0xc0d1('0x9')]);router['get'](_0xc0d1('0xa'),auth[_0xc0d1('0x8')](),controller[_0xc0d1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc0d1('0xc')]);router['put'](_0xc0d1('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc0d1('0xa'),auth['isAuthenticated'](),controller[_0xc0d1('0xd')]);module[_0xc0d1('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ff61170..0147bd2 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x444108,_0x5ccb0f){var _0x20c3e7=function(_0x4c3af2){while(--_0x4c3af2){_0x444108['push'](_0x444108['shift']());}};_0x20c3e7(++_0x5ccb0f);}(_0x7a54,0x106));var _0x47a5=function(_0x34d255,_0x1b559d){_0x34d255=_0x34d255-0x0;var _0x200be3=_0x7a54[_0x34d255];return _0x200be3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x8484f5,_0x12c4ad){var _0x53a973=function(_0x17e595){while(--_0x17e595){_0x8484f5['push'](_0x8484f5['shift']());}};_0x53a973(++_0x12c4ad);}(_0x7a54,0x106));var _0x47a5=function(_0x486761,_0x49b0ff){_0x486761=_0x486761-0x0;var _0x407bef=_0x7a54[_0x486761];return _0x407bef;};'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 22f621d..9735419 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 _0xb688=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','update','then','destroy','end','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','show','includeAll','include','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x51c907,_0x72a624){var _0x30f89a=function(_0x95361c){while(--_0x95361c){_0x51c907['push'](_0x51c907['shift']());}};_0x30f89a(++_0x72a624);}(_0xb688,0xcf));var _0x8b68=function(_0xc2fb71,_0x2cb183){_0xc2fb71=_0xc2fb71-0x0;var _0x568b7a=_0xb688[_0xc2fb71];return _0x568b7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b68('0x0'));var zipdir=require(_0x8b68('0x1'));var jsonpatch=require(_0x8b68('0x2'));var rp=require(_0x8b68('0x3'));var moment=require(_0x8b68('0x4'));var BPromise=require(_0x8b68('0x5'));var Mustache=require('mustache');var util=require(_0x8b68('0x6'));var path=require(_0x8b68('0x7'));var sox=require(_0x8b68('0x8'));var csv=require(_0x8b68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0xa'));var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0x9'));var querystring=require(_0x8b68('0xf'));var Papa=require(_0x8b68('0x10'));var Redis=require(_0x8b68('0x11'));var authService=require(_0x8b68('0x12'));var qs=require(_0x8b68('0x13'));var as=require(_0x8b68('0x14'));var hardwareService=require(_0x8b68('0x15'));var logger=require(_0x8b68('0x16'))('api');var utils=require(_0x8b68('0x17'));var config=require(_0x8b68('0x18'));var licenseUtil=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];function respondWithStatusCode(_0x1965cf,_0x2f3af4){_0x2f3af4=_0x2f3af4||0xcc;return function(_0xaa8725){if(_0xaa8725){return _0x1965cf[_0x8b68('0x1b')](_0x2f3af4);}return _0x1965cf[_0x8b68('0x1c')](_0x2f3af4)['end']();};}function respondWithResult(_0xb2df35,_0x509033){_0x509033=_0x509033||0xc8;return function(_0x5e3c66){if(_0x5e3c66){return _0xb2df35[_0x8b68('0x1c')](_0x509033)[_0x8b68('0x1d')](_0x5e3c66);}};}function respondWithFilteredResult(_0x27d717,_0x5d3468){return function(_0x5c8d0e){if(_0x5c8d0e){var _0x23bd52=typeof _0x5d3468['offset']===_0x8b68('0x1e')&&typeof _0x5d3468[_0x8b68('0x1f')]===_0x8b68('0x1e');var _0x10c9c6=_0x5c8d0e['count'];var _0xd17693=_0x23bd52?0x0:_0x5d3468[_0x8b68('0x20')];var _0x4a68c7=_0x23bd52?_0x5c8d0e[_0x8b68('0x21')]:_0x5d3468[_0x8b68('0x20')]+_0x5d3468[_0x8b68('0x1f')];var _0x17f321;if(_0x4a68c7>=_0x10c9c6){_0x4a68c7=_0x10c9c6;_0x17f321=0xc8;}else{_0x17f321=0xce;}_0x27d717[_0x8b68('0x1c')](_0x17f321);return _0x27d717['set'](_0x8b68('0x22'),_0xd17693+'-'+_0x4a68c7+'/'+_0x10c9c6)[_0x8b68('0x1d')](_0x5c8d0e);}return null;};}function patchUpdates(_0x59e9b1){return function(_0x1a9788){try{jsonpatch[_0x8b68('0x23')](_0x1a9788,_0x59e9b1,!![]);}catch(_0x1dbc1d){return BPromise['reject'](_0x1dbc1d);}return _0x1a9788['save']();};}function saveUpdates(_0x23edc1,_0x59cb26){return function(_0x332202){if(_0x332202){return _0x332202[_0x8b68('0x24')](_0x23edc1)[_0x8b68('0x25')](function(_0x21ecca){return _0x21ecca;});}return null;};}function removeEntity(_0x32ddc5,_0x173524){return function(_0x59bb8a){if(_0x59bb8a){return _0x59bb8a[_0x8b68('0x26')]()[_0x8b68('0x25')](function(){_0x32ddc5['status'](0xcc)[_0x8b68('0x27')]();});}};}function handleEntityNotFound(_0x3cf8d2,_0x240b0b){return function(_0x5590ec){if(!_0x5590ec){_0x3cf8d2['sendStatus'](0x194);}return _0x5590ec;};}function handleError(_0x4fe8f6,_0x92d186){_0x92d186=_0x92d186||0x1f4;return function(_0x448e43){logger[_0x8b68('0x28')](_0x448e43['stack']);if(_0x448e43[_0x8b68('0x29')]){delete _0x448e43['name'];}_0x4fe8f6['status'](_0x92d186)[_0x8b68('0x2a')](_0x448e43);};}exports['index']=function(_0x26cad7,_0x3ac356){var _0x48e2c8={},_0x494ce4={},_0x357635={'count':0x0,'rows':[]};var _0x1cd230=_[_0x8b68('0x2b')](db[_0x8b68('0x2c')][_0x8b68('0x2d')],function(_0x2ad2df){return{'name':_0x2ad2df[_0x8b68('0x2e')],'type':_0x2ad2df['type'][_0x8b68('0x2f')]};});_0x494ce4['model']=_[_0x8b68('0x2b')](_0x1cd230,_0x8b68('0x29'));_0x494ce4['query']=_[_0x8b68('0x30')](_0x26cad7[_0x8b68('0x31')]);_0x494ce4[_0x8b68('0x32')]=_['intersection'](_0x494ce4['model'],_0x494ce4[_0x8b68('0x31')]);_0x48e2c8[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x494ce4[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x36')]));_0x48e2c8[_0x8b68('0x33')]=_0x48e2c8[_0x8b68('0x33')][_0x8b68('0x37')]?_0x48e2c8[_0x8b68('0x33')]:_0x494ce4[_0x8b68('0x35')];if(!_0x26cad7[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x48e2c8[_0x8b68('0x1f')]=qs[_0x8b68('0x1f')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x1f')]);_0x48e2c8[_0x8b68('0x20')]=qs[_0x8b68('0x20')](_0x26cad7[_0x8b68('0x31')]['offset']);}_0x48e2c8['order']=qs[_0x8b68('0x3a')](_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3a')]);_0x48e2c8[_0x8b68('0x3b')]=qs[_0x8b68('0x32')](_[_0x8b68('0x3c')](_0x26cad7[_0x8b68('0x31')],_0x494ce4[_0x8b68('0x32')]),_0x1cd230);if(_0x26cad7['query'][_0x8b68('0x3d')]){_0x48e2c8[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x48e2c8[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x2b')](_0x1cd230,function(_0x3e0032){if(_0x3e0032[_0x8b68('0x3f')]!==_0x8b68('0x40')){var _0x517571={};_0x517571[_0x3e0032[_0x8b68('0x29')]]={'$like':'%'+_0x26cad7[_0x8b68('0x31')][_0x8b68('0x3d')]+'%'};return _0x517571;}})});}_0x48e2c8=_[_0x8b68('0x3e')]({},_0x48e2c8,_0x26cad7[_0x8b68('0x41')]);var _0x3b3394={'where':_0x48e2c8[_0x8b68('0x3b')]};return db['WhatsappQueueReport'][_0x8b68('0x21')](_0x3b3394)[_0x8b68('0x25')](function(_0x48f159){_0x357635[_0x8b68('0x21')]=_0x48f159;if(_0x26cad7[_0x8b68('0x31')]['includeAll']){_0x48e2c8['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x48e2c8);})[_0x8b68('0x25')](function(_0x23d24a){_0x357635['rows']=_0x23d24a;return _0x357635;})[_0x8b68('0x25')](respondWithFilteredResult(_0x3ac356,_0x48e2c8))['catch'](handleError(_0x3ac356,null));};exports[_0x8b68('0x42')]=function(_0x3841d2,_0x5a3193){var _0x2f90d9={'raw':!![],'where':{'id':_0x3841d2['params']['id']}},_0x5ae345={};_0x5ae345['model']=_[_0x8b68('0x30')](db[_0x8b68('0x2c')][_0x8b68('0x2d')]);_0x5ae345[_0x8b68('0x31')]=_['keys'](_0x3841d2[_0x8b68('0x31')]);_0x5ae345['filters']=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],_0x5ae345['query']);_0x2f90d9[_0x8b68('0x33')]=_[_0x8b68('0x34')](_0x5ae345[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x3841d2['query'][_0x8b68('0x36')]));_0x2f90d9[_0x8b68('0x33')]=_0x2f90d9[_0x8b68('0x33')][_0x8b68('0x37')]?_0x2f90d9[_0x8b68('0x33')]:_0x5ae345[_0x8b68('0x35')];if(_0x3841d2[_0x8b68('0x31')][_0x8b68('0x43')]){_0x2f90d9[_0x8b68('0x44')]=[{'all':!![]}];}_0x2f90d9=_[_0x8b68('0x3e')]({},_0x2f90d9,_0x3841d2[_0x8b68('0x41')]);return db[_0x8b68('0x2c')][_0x8b68('0x45')](_0x2f90d9)[_0x8b68('0x25')](handleEntityNotFound(_0x5a3193,null))[_0x8b68('0x25')](respondWithResult(_0x5a3193,null))[_0x8b68('0x46')](handleError(_0x5a3193,null));};exports['create']=function(_0x3b7b06,_0x20681a){return db['WhatsappQueueReport'][_0x8b68('0x47')](_0x3b7b06['body'],{})['then'](respondWithResult(_0x20681a,0xc9))['catch'](handleError(_0x20681a,null));};exports[_0x8b68('0x24')]=function(_0x35874b,_0x34047c){if(_0x35874b[_0x8b68('0x48')]['id']){delete _0x35874b['body']['id'];}return db['WhatsappQueueReport'][_0x8b68('0x45')]({'where':{'id':_0x35874b[_0x8b68('0x49')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x34047c,null))['then'](saveUpdates(_0x35874b[_0x8b68('0x48')],null))[_0x8b68('0x25')](respondWithResult(_0x34047c,null))['catch'](handleError(_0x34047c,null));};exports[_0x8b68('0x26')]=function(_0xacac82,_0x595942){return db[_0x8b68('0x2c')][_0x8b68('0x45')]({'where':{'id':_0xacac82['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x595942,null))[_0x8b68('0x25')](removeEntity(_0x595942,null))['catch'](handleError(_0x595942,null));};exports['describe']=function(_0x5e3e99,_0x28f82d){return db[_0x8b68('0x2c')][_0x8b68('0x4a')]()[_0x8b68('0x25')](respondWithResult(_0x28f82d,null))['catch'](handleError(_0x28f82d,null));}; \ No newline at end of file +var _0x878f=['intersection','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','WhatsappQueueReport','rows','params','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes'];(function(_0x19c94b,_0xba17c0){var _0x50c162=function(_0x5a3498){while(--_0x5a3498){_0x19c94b['push'](_0x19c94b['shift']());}};_0x50c162(++_0xba17c0);}(_0x878f,0x173));var _0xf878=function(_0x48476a,_0x22ffc2){_0x48476a=_0x48476a-0x0;var _0x24450c=_0x878f[_0x48476a];return _0x24450c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x339c9c,_0x596fb5){_0x596fb5=_0x596fb5||0xcc;return function(_0x1ce004){if(_0x1ce004){return _0x339c9c[_0xf878('0x15')](_0x596fb5);}return _0x339c9c[_0xf878('0x16')](_0x596fb5)['end']();};}function respondWithResult(_0xe2c2de,_0x3902f7){_0x3902f7=_0x3902f7||0xc8;return function(_0x119e9e){if(_0x119e9e){return _0xe2c2de['status'](_0x3902f7)['json'](_0x119e9e);}};}function respondWithFilteredResult(_0x4c0948,_0x35ff2d){return function(_0x31d888){if(_0x31d888){var _0x6dbeca=typeof _0x35ff2d[_0xf878('0x17')]===_0xf878('0x18')&&typeof _0x35ff2d[_0xf878('0x19')]===_0xf878('0x18');var _0x3c5dee=_0x31d888[_0xf878('0x1a')];var _0x3b2e1b=_0x6dbeca?0x0:_0x35ff2d['offset'];var _0x2b2b54=_0x6dbeca?_0x31d888[_0xf878('0x1a')]:_0x35ff2d[_0xf878('0x17')]+_0x35ff2d[_0xf878('0x19')];var _0x3714f6;if(_0x2b2b54>=_0x3c5dee){_0x2b2b54=_0x3c5dee;_0x3714f6=0xc8;}else{_0x3714f6=0xce;}_0x4c0948[_0xf878('0x16')](_0x3714f6);return _0x4c0948[_0xf878('0x1b')]('Content-Range',_0x3b2e1b+'-'+_0x2b2b54+'/'+_0x3c5dee)[_0xf878('0x1c')](_0x31d888);}return null;};}function patchUpdates(_0x140866){return function(_0x250f85){try{jsonpatch['apply'](_0x250f85,_0x140866,!![]);}catch(_0x432e5d){return BPromise[_0xf878('0x1d')](_0x432e5d);}return _0x250f85[_0xf878('0x1e')]();};}function saveUpdates(_0x392822,_0x22d884){return function(_0x442450){if(_0x442450){return _0x442450[_0xf878('0x1f')](_0x392822)[_0xf878('0x20')](function(_0x212436){return _0x212436;});}return null;};}function removeEntity(_0x1a6506,_0x45e61f){return function(_0x566995){if(_0x566995){return _0x566995[_0xf878('0x21')]()['then'](function(){_0x1a6506[_0xf878('0x16')](0xcc)[_0xf878('0x22')]();});}};}function handleEntityNotFound(_0x35b3b4,_0x280036){return function(_0x20449e){if(!_0x20449e){_0x35b3b4['sendStatus'](0x194);}return _0x20449e;};}function handleError(_0x58c713,_0x59ba7b){_0x59ba7b=_0x59ba7b||0x1f4;return function(_0x242926){logger[_0xf878('0x23')](_0x242926[_0xf878('0x24')]);if(_0x242926['name']){delete _0x242926[_0xf878('0x25')];}_0x58c713[_0xf878('0x16')](_0x59ba7b)[_0xf878('0x26')](_0x242926);};}exports[_0xf878('0x27')]=function(_0x41dd55,_0x5aff46){var _0x502322={},_0x9a127d={},_0x5d9c97={'count':0x0,'rows':[]};var _0x4a0286=_[_0xf878('0x28')](db['WhatsappQueueReport'][_0xf878('0x29')],function(_0x51afaf){return{'name':_0x51afaf[_0xf878('0x2a')],'type':_0x51afaf['type'][_0xf878('0x2b')]};});_0x9a127d['model']=_[_0xf878('0x28')](_0x4a0286,_0xf878('0x25'));_0x9a127d[_0xf878('0x2c')]=_[_0xf878('0x2d')](_0x41dd55[_0xf878('0x2c')]);_0x9a127d[_0xf878('0x2e')]=_['intersection'](_0x9a127d[_0xf878('0x2f')],_0x9a127d[_0xf878('0x2c')]);_0x502322[_0xf878('0x30')]=_[_0xf878('0x31')](_0x9a127d[_0xf878('0x2f')],qs['fields'](_0x41dd55[_0xf878('0x2c')][_0xf878('0x32')]));_0x502322['attributes']=_0x502322[_0xf878('0x30')][_0xf878('0x33')]?_0x502322[_0xf878('0x30')]:_0x9a127d[_0xf878('0x2f')];if(!_0x41dd55[_0xf878('0x2c')]['hasOwnProperty'](_0xf878('0x34'))){_0x502322[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x41dd55[_0xf878('0x2c')]['limit']);_0x502322[_0xf878('0x17')]=qs['offset'](_0x41dd55['query'][_0xf878('0x17')]);}_0x502322[_0xf878('0x35')]=qs[_0xf878('0x36')](_0x41dd55[_0xf878('0x2c')][_0xf878('0x36')]);_0x502322['where']=qs[_0xf878('0x2e')](_['pick'](_0x41dd55[_0xf878('0x2c')],_0x9a127d[_0xf878('0x2e')]),_0x4a0286);if(_0x41dd55['query'][_0xf878('0x37')]){_0x502322[_0xf878('0x38')]=_['merge'](_0x502322[_0xf878('0x38')],{'$or':_[_0xf878('0x28')](_0x4a0286,function(_0x5b4098){if(_0x5b4098[_0xf878('0x39')]!==_0xf878('0x3a')){var _0x34731d={};_0x34731d[_0x5b4098[_0xf878('0x25')]]={'$like':'%'+_0x41dd55[_0xf878('0x2c')][_0xf878('0x37')]+'%'};return _0x34731d;}})});}_0x502322=_[_0xf878('0x3b')]({},_0x502322,_0x41dd55['options']);var _0x1179fb={'where':_0x502322[_0xf878('0x38')]};return db['WhatsappQueueReport'][_0xf878('0x1a')](_0x1179fb)['then'](function(_0x489964){_0x5d9c97[_0xf878('0x1a')]=_0x489964;if(_0x41dd55[_0xf878('0x2c')][_0xf878('0x3c')]){_0x502322[_0xf878('0x3d')]=[{'all':!![]}];}return db[_0xf878('0x3e')]['findAll'](_0x502322);})[_0xf878('0x20')](function(_0x4c4ae4){_0x5d9c97[_0xf878('0x3f')]=_0x4c4ae4;return _0x5d9c97;})[_0xf878('0x20')](respondWithFilteredResult(_0x5aff46,_0x502322))['catch'](handleError(_0x5aff46,null));};exports['show']=function(_0x180594,_0x2a66c1){var _0x13fcd3={'raw':!![],'where':{'id':_0x180594[_0xf878('0x40')]['id']}},_0x2f6ee5={};_0x2f6ee5[_0xf878('0x2f')]=_[_0xf878('0x2d')](db[_0xf878('0x3e')][_0xf878('0x29')]);_0x2f6ee5['query']=_[_0xf878('0x2d')](_0x180594[_0xf878('0x2c')]);_0x2f6ee5[_0xf878('0x2e')]=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],_0x2f6ee5[_0xf878('0x2c')]);_0x13fcd3['attributes']=_[_0xf878('0x31')](_0x2f6ee5[_0xf878('0x2f')],qs[_0xf878('0x32')](_0x180594[_0xf878('0x2c')][_0xf878('0x32')]));_0x13fcd3['attributes']=_0x13fcd3[_0xf878('0x30')][_0xf878('0x33')]?_0x13fcd3[_0xf878('0x30')]:_0x2f6ee5[_0xf878('0x2f')];if(_0x180594['query'][_0xf878('0x3c')]){_0x13fcd3[_0xf878('0x3d')]=[{'all':!![]}];}_0x13fcd3=_[_0xf878('0x3b')]({},_0x13fcd3,_0x180594['options']);return db['WhatsappQueueReport'][_0xf878('0x41')](_0x13fcd3)['then'](handleEntityNotFound(_0x2a66c1,null))['then'](respondWithResult(_0x2a66c1,null))['catch'](handleError(_0x2a66c1,null));};exports[_0xf878('0x42')]=function(_0x49e719,_0x156fdb){return db[_0xf878('0x3e')][_0xf878('0x42')](_0x49e719[_0xf878('0x43')],{})[_0xf878('0x20')](respondWithResult(_0x156fdb,0xc9))[_0xf878('0x44')](handleError(_0x156fdb,null));};exports[_0xf878('0x1f')]=function(_0x526c89,_0xb0bf4c){if(_0x526c89[_0xf878('0x43')]['id']){delete _0x526c89[_0xf878('0x43')]['id'];}return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x526c89['params']['id']}})['then'](handleEntityNotFound(_0xb0bf4c,null))[_0xf878('0x20')](saveUpdates(_0x526c89[_0xf878('0x43')],null))['then'](respondWithResult(_0xb0bf4c,null))[_0xf878('0x44')](handleError(_0xb0bf4c,null));};exports['destroy']=function(_0x1ce6b9,_0x31adde){return db[_0xf878('0x3e')][_0xf878('0x41')]({'where':{'id':_0x1ce6b9['params']['id']}})[_0xf878('0x20')](handleEntityNotFound(_0x31adde,null))[_0xf878('0x20')](removeEntity(_0x31adde,null))[_0xf878('0x44')](handleError(_0x31adde,null));};exports['describe']=function(_0xce30a5,_0x30df05){return db[_0xf878('0x3e')][_0xf878('0x45')]()['then'](respondWithResult(_0x30df05,null))[_0xf878('0x44')](handleError(_0x30df05,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index cb0f3b1..2ac534c 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 _0x8e37=['moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x530e6a,_0x53782f){var _0x176c75=function(_0x35cf55){while(--_0x35cf55){_0x530e6a['push'](_0x530e6a['shift']());}};_0x176c75(++_0x53782f);}(_0x8e37,0xa5));var _0x78e3=function(_0x260e6c,_0x5654a6){_0x260e6c=_0x260e6c-0x0;var _0x328739=_0x8e37[_0x260e6c];return _0x328739;};'use strict';var _=require(_0x78e3('0x0'));var util=require(_0x78e3('0x1'));var logger=require(_0x78e3('0x2'))(_0x78e3('0x3'));var moment=require(_0x78e3('0x4'));var BPromise=require(_0x78e3('0x5'));var rp=require(_0x78e3('0x6'));var fs=require('fs');var path=require(_0x78e3('0x7'));var rimraf=require('rimraf');var config=require(_0x78e3('0x8'));var attributes=require(_0x78e3('0x9'));module[_0x78e3('0xa')]=function(_0x2bbb9a,_0x2a71e6){return _0x2bbb9a[_0x78e3('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x78e3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5db9=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x5db9,0x183));var _0x95db=function(_0x57062d,_0x2f2c1f){_0x57062d=_0x57062d-0x0;var _0x2ccfa6=_0x5db9[_0x57062d];return _0x2ccfa6;};'use strict';var _=require(_0x95db('0x0'));var util=require(_0x95db('0x1'));var logger=require(_0x95db('0x2'))(_0x95db('0x3'));var moment=require('moment');var BPromise=require(_0x95db('0x4'));var rp=require(_0x95db('0x5'));var fs=require('fs');var path=require(_0x95db('0x6'));var rimraf=require(_0x95db('0x7'));var config=require(_0x95db('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x571e9c,_0x2986a3){return _0x571e9c['define'](_0x95db('0x9'),attributes,{'tableName':_0x95db('0xa'),'paranoid':![],'indexes':[{'name':_0x95db('0xb'),'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 1b2d9cd..b46646a 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 _0x7086=['info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x26f650,_0x168c5a){var _0x311307=function(_0x53af15){while(--_0x53af15){_0x26f650['push'](_0x26f650['shift']());}};_0x311307(++_0x168c5a);}(_0x7086,0x144));var _0x6708=function(_0x2383de,_0x6094e7){_0x2383de=_0x2383de-0x0;var _0x246e28=_0x7086[_0x2383de];return _0x246e28;};'use strict';var _=require(_0x6708('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6708('0x1'));var rs=require(_0x6708('0x2'));var fs=require('fs');var Redis=require(_0x6708('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6708('0x4'));var logger=require('../../config/logger')(_0x6708('0x5'));var config=require(_0x6708('0x6'));var jayson=require(_0x6708('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe815f0,_0x30d040,_0x269b34){return new BPromise(function(_0x1b889c,_0x2fc50b){return client['request'](_0xe815f0,_0x269b34)[_0x6708('0x8')](function(_0x2549d6){logger['info'](_0x6708('0x9'),_0x30d040,_0x6708('0xa'));logger[_0x6708('0xb')](_0x6708('0xc'),_0x30d040,'request\x20sent',JSON[_0x6708('0xd')](_0x2549d6));if(_0x2549d6[_0x6708('0xe')]){if(_0x2549d6[_0x6708('0xe')][_0x6708('0xf')]===0x1f4){logger[_0x6708('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x30d040,_0x2549d6[_0x6708('0xe')][_0x6708('0x10')]);return _0x2fc50b(_0x2549d6[_0x6708('0xe')]['message']);}logger['error'](_0x6708('0x9'),_0x30d040,_0x2549d6[_0x6708('0xe')]['message']);return _0x1b889c(_0x2549d6['error'][_0x6708('0x10')]);}else{logger[_0x6708('0x11')](_0x6708('0x9'),_0x30d040,_0x6708('0xa'));_0x1b889c(_0x2549d6[_0x6708('0x12')][_0x6708('0x10')]);}})[_0x6708('0x13')](function(_0x1ab596){logger[_0x6708('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x30d040,_0x1ab596);_0x2fc50b(_0x1ab596);});});}exports[_0x6708('0x14')]=function(_0x1c9605){var _0x1d4642=this;return new Promise(function(_0x420280,_0x396b68){return db[_0x6708('0x15')][_0x6708('0x16')](_0x1c9605[_0x6708('0x17')],{'raw':_0x1c9605['options']?_0x1c9605[_0x6708('0x18')][_0x6708('0x19')]===undefined?!![]:![]:!![]})[_0x6708('0x8')](function(_0xc68535){logger['info'](_0x6708('0x14'),_0x1c9605);logger[_0x6708('0xb')](_0x6708('0x14'),_0x1c9605,JSON[_0x6708('0xd')](_0xc68535));_0x420280(_0xc68535);})['catch'](function(_0xb1f2a5){logger['error'](_0x6708('0x14'),_0xb1f2a5['message'],_0x1c9605);_0x396b68(_0x1d4642[_0x6708('0xe')](0x1f4,_0xb1f2a5[_0x6708('0x10')]));});});};exports[_0x6708('0x1a')]=function(_0x455030){var _0x576fec=this;return new Promise(function(_0x9f7745,_0x36a8a5){return db[_0x6708('0x15')][_0x6708('0x1b')](_0x455030[_0x6708('0x17')],{'raw':_0x455030['options']?_0x455030[_0x6708('0x18')][_0x6708('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x455030[_0x6708('0x18')]?_0x455030[_0x6708('0x18')][_0x6708('0x1c')]||null:null,'attributes':_0x455030['options']?_0x455030[_0x6708('0x18')][_0x6708('0x1d')]||null:null,'limit':_0x455030[_0x6708('0x18')]?_0x455030[_0x6708('0x18')][_0x6708('0x1e')]||null:null})['then'](function(_0x43bcfc){logger[_0x6708('0x11')](_0x6708('0x1a'),_0x455030);logger[_0x6708('0xb')](_0x6708('0x1a'),_0x455030,JSON[_0x6708('0xd')](_0x43bcfc));_0x9f7745(_0x43bcfc);})[_0x6708('0x13')](function(_0x5508b){logger[_0x6708('0xe')](_0x6708('0x1a'),_0x5508b[_0x6708('0x10')],_0x455030);_0x36a8a5(_0x576fec[_0x6708('0xe')](0x1f4,_0x5508b['message']));});});}; \ No newline at end of file +var _0x632a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','update','raw','where','attributes','limit','UpdateWhatsappQueueReport','catch'];(function(_0x3ad4cb,_0x3f4f19){var _0x20eb9e=function(_0x4be182){while(--_0x4be182){_0x3ad4cb['push'](_0x3ad4cb['shift']());}};_0x20eb9e(++_0x3f4f19);}(_0x632a,0x15e));var _0xa632=function(_0x5ba9e8,_0x2f670e){_0x5ba9e8=_0x5ba9e8-0x0;var _0x572bb8=_0x632a[_0x5ba9e8];return _0x572bb8;};'use strict';var _=require(_0xa632('0x0'));var util=require(_0xa632('0x1'));var moment=require(_0xa632('0x2'));var BPromise=require(_0xa632('0x3'));var rs=require(_0xa632('0x4'));var fs=require('fs');var Redis=require(_0xa632('0x5'));var db=require(_0xa632('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa632('0x7'))('rpc');var config=require(_0xa632('0x8'));var jayson=require(_0xa632('0x9'));var client=jayson[_0xa632('0xa')][_0xa632('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d4714,_0x3163d9,_0x1fa105){return new BPromise(function(_0x5b8644,_0x55d41b){return client[_0xa632('0xc')](_0x2d4714,_0x1fa105)[_0xa632('0xd')](function(_0x235c93){logger[_0xa632('0xe')](_0xa632('0xf'),_0x3163d9,_0xa632('0x10'));logger[_0xa632('0x11')](_0xa632('0x12'),_0x3163d9,_0xa632('0x10'),JSON[_0xa632('0x13')](_0x235c93));if(_0x235c93['error']){if(_0x235c93[_0xa632('0x14')]['code']===0x1f4){logger[_0xa632('0x14')](_0xa632('0xf'),_0x3163d9,_0x235c93[_0xa632('0x14')][_0xa632('0x15')]);return _0x55d41b(_0x235c93[_0xa632('0x14')][_0xa632('0x15')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3163d9,_0x235c93['error']['message']);return _0x5b8644(_0x235c93[_0xa632('0x14')][_0xa632('0x15')]);}else{logger[_0xa632('0xe')](_0xa632('0xf'),_0x3163d9,_0xa632('0x10'));_0x5b8644(_0x235c93[_0xa632('0x16')][_0xa632('0x15')]);}})['catch'](function(_0xf2c16){logger['error'](_0xa632('0xf'),_0x3163d9,_0xf2c16);_0x55d41b(_0xf2c16);});});}exports[_0xa632('0x17')]=function(_0x492474){var _0x5a4cfb=this;return new Promise(function(_0x4390dd,_0x2d11cb){return db[_0xa632('0x18')][_0xa632('0x19')](_0x492474[_0xa632('0x1a')],{'raw':_0x492474['options']?_0x492474[_0xa632('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa632('0xd')](function(_0x3ed02c){logger[_0xa632('0xe')](_0xa632('0x17'),_0x492474);logger[_0xa632('0x11')](_0xa632('0x17'),_0x492474,JSON['stringify'](_0x3ed02c));_0x4390dd(_0x3ed02c);})['catch'](function(_0x347c6a){logger[_0xa632('0x14')](_0xa632('0x17'),_0x347c6a[_0xa632('0x15')],_0x492474);_0x2d11cb(_0x5a4cfb[_0xa632('0x14')](0x1f4,_0x347c6a[_0xa632('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x15aaf7){var _0x1d8ab1=this;return new Promise(function(_0x1ffe2a,_0x3b0f45){return db['WhatsappQueueReport'][_0xa632('0x1c')](_0x15aaf7['body'],{'raw':_0x15aaf7[_0xa632('0x1b')]?_0x15aaf7['options'][_0xa632('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15aaf7[_0xa632('0x1b')]?_0x15aaf7[_0xa632('0x1b')][_0xa632('0x1e')]||null:null,'attributes':_0x15aaf7['options']?_0x15aaf7[_0xa632('0x1b')][_0xa632('0x1f')]||null:null,'limit':_0x15aaf7['options']?_0x15aaf7[_0xa632('0x1b')][_0xa632('0x20')]||null:null})[_0xa632('0xd')](function(_0x13773e){logger[_0xa632('0xe')](_0xa632('0x21'),_0x15aaf7);logger[_0xa632('0x11')]('UpdateWhatsappQueueReport',_0x15aaf7,JSON[_0xa632('0x13')](_0x13773e));_0x1ffe2a(_0x13773e);})[_0xa632('0x22')](function(_0x22af1e){logger[_0xa632('0x14')](_0xa632('0x21'),_0x22af1e['message'],_0x15aaf7);_0x3b0f45(_0x1d8ab1[_0xa632('0x14')](0x1f4,_0x22af1e[_0xa632('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7e64bf2..28b45ef 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 _0xd304=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete'];(function(_0x2cc4d7,_0x5d890d){var _0x1b31f5=function(_0x5cc256){while(--_0x5cc256){_0x2cc4d7['push'](_0x2cc4d7['shift']());}};_0x1b31f5(++_0x5d890d);}(_0xd304,0x151));var _0x4d30=function(_0x1d63ab,_0x5c00ff){_0x1d63ab=_0x1d63ab-0x0;var _0x344b72=_0xd304[_0x1d63ab];return _0x344b72;};'use strict';var multer=require(_0x4d30('0x0'));var util=require(_0x4d30('0x1'));var path=require('path');var timeout=require(_0x4d30('0x2'));var express=require(_0x4d30('0x3'));var router=express[_0x4d30('0x4')]();var fs_extra=require(_0x4d30('0x5'));var auth=require(_0x4d30('0x6'));var interaction=require(_0x4d30('0x7'));var config=require(_0x4d30('0x8'));var controller=require(_0x4d30('0x9'));router[_0x4d30('0xa')]('/',auth[_0x4d30('0xb')](),controller[_0x4d30('0xc')]);router['get'](_0x4d30('0xd'),auth[_0x4d30('0xb')](),controller[_0x4d30('0xe')]);router[_0x4d30('0xa')](_0x4d30('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4d30('0xb')](),controller[_0x4d30('0x10')]);router[_0x4d30('0x11')](_0x4d30('0xf'),auth[_0x4d30('0xb')](),controller[_0x4d30('0x12')]);router[_0x4d30('0x13')](_0x4d30('0xf'),auth['isAuthenticated'](),controller[_0x4d30('0x14')]);module['exports']=router; \ No newline at end of file +var _0x275c=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','show','post'];(function(_0x145486,_0x13624f){var _0x2ac301=function(_0x31a1bf){while(--_0x31a1bf){_0x145486['push'](_0x145486['shift']());}};_0x2ac301(++_0x13624f);}(_0x275c,0x1d9));var _0xc275=function(_0xcff74c,_0x40a9ae){_0xcff74c=_0xcff74c-0x0;var _0x540969=_0x275c[_0xcff74c];return _0x540969;};'use strict';var multer=require(_0xc275('0x0'));var util=require(_0xc275('0x1'));var path=require(_0xc275('0x2'));var timeout=require(_0xc275('0x3'));var express=require(_0xc275('0x4'));var router=express[_0xc275('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc275('0x6'));var controller=require(_0xc275('0x7'));router[_0xc275('0x8')]('/',auth['isAuthenticated'](),controller[_0xc275('0x9')]);router[_0xc275('0x8')]('/describe',auth[_0xc275('0xa')](),controller['describe']);router[_0xc275('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc275('0xb')]);router[_0xc275('0xc')]('/',auth[_0xc275('0xa')](),controller['create']);router[_0xc275('0xd')](_0xc275('0xe'),auth[_0xc275('0xa')](),controller[_0xc275('0xf')]);router[_0xc275('0x10')]('/:id',auth[_0xc275('0xa')](),controller[_0xc275('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 873ac17..a2f0677 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 _0x253d=['agent','queue','DATE','sequelize'];(function(_0x2879a0,_0x499d6b){var _0x536068=function(_0x2049e3){while(--_0x2049e3){_0x2879a0['push'](_0x2879a0['shift']());}};_0x536068(++_0x499d6b);}(_0x253d,0x1b3));var _0xd253=function(_0x40f4f9,_0x57de56){_0x40f4f9=_0x40f4f9-0x0;var _0x1556a2=_0x253d[_0x40f4f9];return _0x1556a2;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xd253('0x1'),_0xd253('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd253('0x3')]}}; \ No newline at end of file +var _0x23a3=['DATE','ENUM','agent','queue'];(function(_0x13ff5a,_0x3b7c2e){var _0x35cf2a=function(_0x31079b){while(--_0x31079b){_0x13ff5a['push'](_0x13ff5a['shift']());}};_0x35cf2a(++_0x3b7c2e);}(_0x23a3,0x131));var _0x323a=function(_0x13013a,_0x2ff754){_0x13013a=_0x13013a-0x0;var _0x5ef930=_0x23a3[_0x13013a];return _0x5ef930;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x323a('0x0')]('account',_0x323a('0x1'),_0x323a('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x323a('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5fb51ff..56e1525 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 _0xcaab=['apply','reject','save','update','destroy','then','stack','send','index','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','name','options','include','findAll','show','params','rawAttributes','includeAll','merge','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set'];(function(_0x47d42f,_0x478095){var _0x17a186=function(_0x47a409){while(--_0x47a409){_0x47d42f['push'](_0x47d42f['shift']());}};_0x17a186(++_0x478095);}(_0xcaab,0x1a7));var _0xbcaa=function(_0xddd2f1,_0x38a33b){_0xddd2f1=_0xddd2f1-0x0;var _0x4b59cd=_0xcaab[_0xddd2f1];return _0x4b59cd;};'use strict';var emlformat=require(_0xbcaa('0x0'));var rimraf=require(_0xbcaa('0x1'));var zipdir=require(_0xbcaa('0x2'));var jsonpatch=require(_0xbcaa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcaa('0x4'));var Mustache=require(_0xbcaa('0x5'));var util=require(_0xbcaa('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbcaa('0x7'));var ejs=require(_0xbcaa('0x8'));var fs=require('fs');var fs_extra=require(_0xbcaa('0x9'));var _=require('lodash');var squel=require(_0xbcaa('0xa'));var crypto=require(_0xbcaa('0xb'));var jsforce=require(_0xbcaa('0xc'));var deskjs=require(_0xbcaa('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbcaa('0xe'));var Redis=require(_0xbcaa('0xf'));var authService=require(_0xbcaa('0x10'));var qs=require(_0xbcaa('0x11'));var as=require(_0xbcaa('0x12'));var hardwareService=require(_0xbcaa('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbcaa('0x14'));var config=require(_0xbcaa('0x15'));var licenseUtil=require(_0xbcaa('0x16'));var db=require(_0xbcaa('0x17'))['db'];function respondWithStatusCode(_0x58cf00,_0x1042ad){_0x1042ad=_0x1042ad||0xcc;return function(_0x9813fc){if(_0x9813fc){return _0x58cf00[_0xbcaa('0x18')](_0x1042ad);}return _0x58cf00['status'](_0x1042ad)[_0xbcaa('0x19')]();};}function respondWithResult(_0x1faf94,_0x442d4e){_0x442d4e=_0x442d4e||0xc8;return function(_0x122990){if(_0x122990){return _0x1faf94[_0xbcaa('0x1a')](_0x442d4e)[_0xbcaa('0x1b')](_0x122990);}};}function respondWithFilteredResult(_0x1dd9a1,_0x108f7f){return function(_0x5dfc64){if(_0x5dfc64){var _0x7ded0e=typeof _0x108f7f['offset']===_0xbcaa('0x1c')&&typeof _0x108f7f[_0xbcaa('0x1d')]==='undefined';var _0x8c8b2e=_0x5dfc64[_0xbcaa('0x1e')];var _0x59b375=_0x7ded0e?0x0:_0x108f7f['offset'];var _0x580102=_0x7ded0e?_0x5dfc64[_0xbcaa('0x1e')]:_0x108f7f[_0xbcaa('0x1f')]+_0x108f7f[_0xbcaa('0x1d')];var _0xd86169;if(_0x580102>=_0x8c8b2e){_0x580102=_0x8c8b2e;_0xd86169=0xc8;}else{_0xd86169=0xce;}_0x1dd9a1[_0xbcaa('0x1a')](_0xd86169);return _0x1dd9a1[_0xbcaa('0x20')]('Content-Range',_0x59b375+'-'+_0x580102+'/'+_0x8c8b2e)[_0xbcaa('0x1b')](_0x5dfc64);}return null;};}function patchUpdates(_0x983356){return function(_0x41db1c){try{jsonpatch[_0xbcaa('0x21')](_0x41db1c,_0x983356,!![]);}catch(_0x14a1a0){return BPromise[_0xbcaa('0x22')](_0x14a1a0);}return _0x41db1c[_0xbcaa('0x23')]();};}function saveUpdates(_0x3e987a,_0x52c051){return function(_0x21fd23){if(_0x21fd23){return _0x21fd23[_0xbcaa('0x24')](_0x3e987a)['then'](function(_0x2ae6c3){return _0x2ae6c3;});}return null;};}function removeEntity(_0x22dcb8,_0x3b6f27){return function(_0x3e5400){if(_0x3e5400){return _0x3e5400[_0xbcaa('0x25')]()[_0xbcaa('0x26')](function(){_0x22dcb8[_0xbcaa('0x1a')](0xcc)[_0xbcaa('0x19')]();});}};}function handleEntityNotFound(_0x3103e5,_0x55519e){return function(_0x3ee95d){if(!_0x3ee95d){_0x3103e5[_0xbcaa('0x18')](0x194);}return _0x3ee95d;};}function handleError(_0x5a2d96,_0x345213){_0x345213=_0x345213||0x1f4;return function(_0x24629b){logger['error'](_0x24629b[_0xbcaa('0x27')]);if(_0x24629b['name']){delete _0x24629b['name'];}_0x5a2d96[_0xbcaa('0x1a')](_0x345213)[_0xbcaa('0x28')](_0x24629b);};}exports[_0xbcaa('0x29')]=function(_0x145477,_0x3e26ac){var _0x1f5830={},_0x2ac7f9={},_0x1ec4d4={'count':0x0,'rows':[]};var _0x2294a1=_['map'](db[_0xbcaa('0x2a')]['rawAttributes'],function(_0x286a6f){return{'name':_0x286a6f[_0xbcaa('0x2b')],'type':_0x286a6f[_0xbcaa('0x2c')][_0xbcaa('0x2d')]};});_0x2ac7f9[_0xbcaa('0x2e')]=_['map'](_0x2294a1,'name');_0x2ac7f9[_0xbcaa('0x2f')]=_[_0xbcaa('0x30')](_0x145477[_0xbcaa('0x2f')]);_0x2ac7f9[_0xbcaa('0x31')]=_[_0xbcaa('0x32')](_0x2ac7f9[_0xbcaa('0x2e')],_0x2ac7f9[_0xbcaa('0x2f')]);_0x1f5830['attributes']=_[_0xbcaa('0x32')](_0x2ac7f9[_0xbcaa('0x2e')],qs[_0xbcaa('0x33')](_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x33')]));_0x1f5830['attributes']=_0x1f5830[_0xbcaa('0x34')][_0xbcaa('0x35')]?_0x1f5830['attributes']:_0x2ac7f9[_0xbcaa('0x2e')];if(!_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x36')](_0xbcaa('0x37'))){_0x1f5830[_0xbcaa('0x1d')]=qs[_0xbcaa('0x1d')](_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x1d')]);_0x1f5830[_0xbcaa('0x1f')]=qs[_0xbcaa('0x1f')](_0x145477['query'][_0xbcaa('0x1f')]);}_0x1f5830[_0xbcaa('0x38')]=qs['sort'](_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x39')]);_0x1f5830[_0xbcaa('0x3a')]=qs[_0xbcaa('0x31')](_['pick'](_0x145477[_0xbcaa('0x2f')],_0x2ac7f9[_0xbcaa('0x31')]),_0x2294a1);if(_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x3b')]){_0x1f5830[_0xbcaa('0x3a')]=_['merge'](_0x1f5830[_0xbcaa('0x3a')],{'$or':_[_0xbcaa('0x3c')](_0x2294a1,function(_0x10133c){if(_0x10133c[_0xbcaa('0x2c')]!==_0xbcaa('0x3d')){var _0x2ceb22={};_0x2ceb22[_0x10133c[_0xbcaa('0x3e')]]={'$like':'%'+_0x145477[_0xbcaa('0x2f')][_0xbcaa('0x3b')]+'%'};return _0x2ceb22;}})});}_0x1f5830=_['merge']({},_0x1f5830,_0x145477[_0xbcaa('0x3f')]);var _0x19e983={'where':_0x1f5830[_0xbcaa('0x3a')]};return db[_0xbcaa('0x2a')]['count'](_0x19e983)[_0xbcaa('0x26')](function(_0xbf843b){_0x1ec4d4['count']=_0xbf843b;if(_0x145477[_0xbcaa('0x2f')]['includeAll']){_0x1f5830[_0xbcaa('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xbcaa('0x41')](_0x1f5830);})[_0xbcaa('0x26')](function(_0x4f5b22){_0x1ec4d4['rows']=_0x4f5b22;return _0x1ec4d4;})['then'](respondWithFilteredResult(_0x3e26ac,_0x1f5830))['catch'](handleError(_0x3e26ac,null));};exports[_0xbcaa('0x42')]=function(_0x16a597,_0x355bb4){var _0x3fff56={'raw':!![],'where':{'id':_0x16a597[_0xbcaa('0x43')]['id']}},_0x29cd17={};_0x29cd17['model']=_[_0xbcaa('0x30')](db['WhatsappTransferReport'][_0xbcaa('0x44')]);_0x29cd17['query']=_[_0xbcaa('0x30')](_0x16a597[_0xbcaa('0x2f')]);_0x29cd17[_0xbcaa('0x31')]=_[_0xbcaa('0x32')](_0x29cd17[_0xbcaa('0x2e')],_0x29cd17[_0xbcaa('0x2f')]);_0x3fff56[_0xbcaa('0x34')]=_[_0xbcaa('0x32')](_0x29cd17[_0xbcaa('0x2e')],qs['fields'](_0x16a597[_0xbcaa('0x2f')][_0xbcaa('0x33')]));_0x3fff56[_0xbcaa('0x34')]=_0x3fff56[_0xbcaa('0x34')][_0xbcaa('0x35')]?_0x3fff56[_0xbcaa('0x34')]:_0x29cd17[_0xbcaa('0x2e')];if(_0x16a597[_0xbcaa('0x2f')][_0xbcaa('0x45')]){_0x3fff56[_0xbcaa('0x40')]=[{'all':!![]}];}_0x3fff56=_[_0xbcaa('0x46')]({},_0x3fff56,_0x16a597[_0xbcaa('0x3f')]);return db[_0xbcaa('0x2a')]['find'](_0x3fff56)[_0xbcaa('0x26')](handleEntityNotFound(_0x355bb4,null))[_0xbcaa('0x26')](respondWithResult(_0x355bb4,null))[_0xbcaa('0x47')](handleError(_0x355bb4,null));};exports[_0xbcaa('0x48')]=function(_0xb69862,_0x160ce8){return db['WhatsappTransferReport']['create'](_0xb69862['body'],{})[_0xbcaa('0x26')](respondWithResult(_0x160ce8,0xc9))[_0xbcaa('0x47')](handleError(_0x160ce8,null));};exports[_0xbcaa('0x24')]=function(_0x74cf5a,_0x550f42){if(_0x74cf5a[_0xbcaa('0x49')]['id']){delete _0x74cf5a['body']['id'];}return db[_0xbcaa('0x2a')][_0xbcaa('0x4a')]({'where':{'id':_0x74cf5a[_0xbcaa('0x43')]['id']}})[_0xbcaa('0x26')](handleEntityNotFound(_0x550f42,null))[_0xbcaa('0x26')](saveUpdates(_0x74cf5a[_0xbcaa('0x49')],null))['then'](respondWithResult(_0x550f42,null))['catch'](handleError(_0x550f42,null));};exports['destroy']=function(_0x327f8e,_0x1d09f2){return db[_0xbcaa('0x2a')]['find']({'where':{'id':_0x327f8e[_0xbcaa('0x43')]['id']}})[_0xbcaa('0x26')](handleEntityNotFound(_0x1d09f2,null))[_0xbcaa('0x26')](removeEntity(_0x1d09f2,null))[_0xbcaa('0x47')](handleError(_0x1d09f2,null));};exports[_0xbcaa('0x4b')]=function(_0x12aad9,_0x43b2a0){return db[_0xbcaa('0x2a')][_0xbcaa('0x4b')]()[_0xbcaa('0x26')](respondWithResult(_0x43b2a0,null))[_0xbcaa('0x47')](handleError(_0x43b2a0,null));}; \ No newline at end of file +var _0x90c1=['status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','merge','where','VIRTUAL','includeAll','findAll','catch','show','params','keys','include','find','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2abd2f,_0x4dae14){var _0x20dad5=function(_0x4b36c4){while(--_0x4b36c4){_0x2abd2f['push'](_0x2abd2f['shift']());}};_0x20dad5(++_0x4dae14);}(_0x90c1,0x109));var _0x190c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x90c1[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x190c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x190c('0x1'));var rp=require(_0x190c('0x2'));var moment=require(_0x190c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x190c('0x4'));var util=require(_0x190c('0x5'));var path=require(_0x190c('0x6'));var sox=require(_0x190c('0x7'));var csv=require(_0x190c('0x8'));var ejs=require(_0x190c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x190c('0xa'));var squel=require(_0x190c('0xb'));var crypto=require(_0x190c('0xc'));var jsforce=require(_0x190c('0xd'));var deskjs=require(_0x190c('0xe'));var toCsv=require(_0x190c('0x8'));var querystring=require(_0x190c('0xf'));var Papa=require(_0x190c('0x10'));var Redis=require(_0x190c('0x11'));var authService=require(_0x190c('0x12'));var qs=require(_0x190c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x190c('0x14'));var logger=require('../../config/logger')(_0x190c('0x15'));var utils=require(_0x190c('0x16'));var config=require(_0x190c('0x17'));var licenseUtil=require(_0x190c('0x18'));var db=require(_0x190c('0x19'))['db'];function respondWithStatusCode(_0x35b23b,_0x14db29){_0x14db29=_0x14db29||0xcc;return function(_0x329bd5){if(_0x329bd5){return _0x35b23b[_0x190c('0x1a')](_0x14db29);}return _0x35b23b['status'](_0x14db29)['end']();};}function respondWithResult(_0x16b8a5,_0x53f08c){_0x53f08c=_0x53f08c||0xc8;return function(_0x13be14){if(_0x13be14){return _0x16b8a5[_0x190c('0x1b')](_0x53f08c)['json'](_0x13be14);}};}function respondWithFilteredResult(_0x34319d,_0x179e96){return function(_0x24333c){if(_0x24333c){var _0x532d22=typeof _0x179e96[_0x190c('0x1c')]===_0x190c('0x1d')&&typeof _0x179e96[_0x190c('0x1e')]===_0x190c('0x1d');var _0x5d7c48=_0x24333c['count'];var _0x46c048=_0x532d22?0x0:_0x179e96['offset'];var _0x222c3f=_0x532d22?_0x24333c[_0x190c('0x1f')]:_0x179e96[_0x190c('0x1c')]+_0x179e96['limit'];var _0x31d7d6;if(_0x222c3f>=_0x5d7c48){_0x222c3f=_0x5d7c48;_0x31d7d6=0xc8;}else{_0x31d7d6=0xce;}_0x34319d[_0x190c('0x1b')](_0x31d7d6);return _0x34319d['set'](_0x190c('0x20'),_0x46c048+'-'+_0x222c3f+'/'+_0x5d7c48)[_0x190c('0x21')](_0x24333c);}return null;};}function patchUpdates(_0x4fd59f){return function(_0x745b0b){try{jsonpatch[_0x190c('0x22')](_0x745b0b,_0x4fd59f,!![]);}catch(_0xa0908){return BPromise[_0x190c('0x23')](_0xa0908);}return _0x745b0b['save']();};}function saveUpdates(_0x591a16,_0x1fa8ce){return function(_0xdfb75f){if(_0xdfb75f){return _0xdfb75f[_0x190c('0x24')](_0x591a16)[_0x190c('0x25')](function(_0x4ffbbf){return _0x4ffbbf;});}return null;};}function removeEntity(_0x4f4a56,_0x2ee7c3){return function(_0x3ca7f9){if(_0x3ca7f9){return _0x3ca7f9[_0x190c('0x26')]()[_0x190c('0x25')](function(){_0x4f4a56[_0x190c('0x1b')](0xcc)[_0x190c('0x27')]();});}};}function handleEntityNotFound(_0x3fb35e,_0x514537){return function(_0x4d14d4){if(!_0x4d14d4){_0x3fb35e[_0x190c('0x1a')](0x194);}return _0x4d14d4;};}function handleError(_0x31e79e,_0x26055b){_0x26055b=_0x26055b||0x1f4;return function(_0x2b0f34){logger['error'](_0x2b0f34[_0x190c('0x28')]);if(_0x2b0f34[_0x190c('0x29')]){delete _0x2b0f34['name'];}_0x31e79e[_0x190c('0x1b')](_0x26055b)[_0x190c('0x2a')](_0x2b0f34);};}exports[_0x190c('0x2b')]=function(_0x3a95dc,_0x110079){var _0x699fc9={},_0x4becd2={},_0x40ac1a={'count':0x0,'rows':[]};var _0x556af4=_[_0x190c('0x2c')](db[_0x190c('0x2d')][_0x190c('0x2e')],function(_0xca9135){return{'name':_0xca9135['fieldName'],'type':_0xca9135[_0x190c('0x2f')][_0x190c('0x30')]};});_0x4becd2[_0x190c('0x31')]=_[_0x190c('0x2c')](_0x556af4,_0x190c('0x29'));_0x4becd2['query']=_['keys'](_0x3a95dc['query']);_0x4becd2[_0x190c('0x32')]=_['intersection'](_0x4becd2[_0x190c('0x31')],_0x4becd2[_0x190c('0x33')]);_0x699fc9['attributes']=_[_0x190c('0x34')](_0x4becd2[_0x190c('0x31')],qs[_0x190c('0x35')](_0x3a95dc['query'][_0x190c('0x35')]));_0x699fc9['attributes']=_0x699fc9[_0x190c('0x36')][_0x190c('0x37')]?_0x699fc9['attributes']:_0x4becd2['model'];if(!_0x3a95dc[_0x190c('0x33')][_0x190c('0x38')](_0x190c('0x39'))){_0x699fc9[_0x190c('0x1e')]=qs[_0x190c('0x1e')](_0x3a95dc['query'][_0x190c('0x1e')]);_0x699fc9[_0x190c('0x1c')]=qs[_0x190c('0x1c')](_0x3a95dc[_0x190c('0x33')][_0x190c('0x1c')]);}_0x699fc9['order']=qs['sort'](_0x3a95dc[_0x190c('0x33')]['sort']);_0x699fc9['where']=qs['filters'](_[_0x190c('0x3a')](_0x3a95dc['query'],_0x4becd2[_0x190c('0x32')]),_0x556af4);if(_0x3a95dc[_0x190c('0x33')][_0x190c('0x3b')]){_0x699fc9['where']=_[_0x190c('0x3c')](_0x699fc9[_0x190c('0x3d')],{'$or':_[_0x190c('0x2c')](_0x556af4,function(_0x2c228a){if(_0x2c228a[_0x190c('0x2f')]!==_0x190c('0x3e')){var _0x5890c7={};_0x5890c7[_0x2c228a[_0x190c('0x29')]]={'$like':'%'+_0x3a95dc['query'][_0x190c('0x3b')]+'%'};return _0x5890c7;}})});}_0x699fc9=_['merge']({},_0x699fc9,_0x3a95dc['options']);var _0x597761={'where':_0x699fc9[_0x190c('0x3d')]};return db[_0x190c('0x2d')][_0x190c('0x1f')](_0x597761)[_0x190c('0x25')](function(_0x343a43){_0x40ac1a[_0x190c('0x1f')]=_0x343a43;if(_0x3a95dc['query'][_0x190c('0x3f')]){_0x699fc9['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x190c('0x40')](_0x699fc9);})[_0x190c('0x25')](function(_0x3ec431){_0x40ac1a['rows']=_0x3ec431;return _0x40ac1a;})['then'](respondWithFilteredResult(_0x110079,_0x699fc9))[_0x190c('0x41')](handleError(_0x110079,null));};exports[_0x190c('0x42')]=function(_0x4d1e34,_0x35a5e2){var _0x594965={'raw':!![],'where':{'id':_0x4d1e34[_0x190c('0x43')]['id']}},_0x4eec38={};_0x4eec38[_0x190c('0x31')]=_[_0x190c('0x44')](db[_0x190c('0x2d')]['rawAttributes']);_0x4eec38[_0x190c('0x33')]=_[_0x190c('0x44')](_0x4d1e34[_0x190c('0x33')]);_0x4eec38['filters']=_[_0x190c('0x34')](_0x4eec38[_0x190c('0x31')],_0x4eec38[_0x190c('0x33')]);_0x594965[_0x190c('0x36')]=_[_0x190c('0x34')](_0x4eec38[_0x190c('0x31')],qs[_0x190c('0x35')](_0x4d1e34[_0x190c('0x33')][_0x190c('0x35')]));_0x594965[_0x190c('0x36')]=_0x594965[_0x190c('0x36')][_0x190c('0x37')]?_0x594965[_0x190c('0x36')]:_0x4eec38[_0x190c('0x31')];if(_0x4d1e34[_0x190c('0x33')][_0x190c('0x3f')]){_0x594965[_0x190c('0x45')]=[{'all':!![]}];}_0x594965=_[_0x190c('0x3c')]({},_0x594965,_0x4d1e34['options']);return db[_0x190c('0x2d')][_0x190c('0x46')](_0x594965)[_0x190c('0x25')](handleEntityNotFound(_0x35a5e2,null))[_0x190c('0x25')](respondWithResult(_0x35a5e2,null))['catch'](handleError(_0x35a5e2,null));};exports['create']=function(_0x381f81,_0x451c6e){return db[_0x190c('0x2d')]['create'](_0x381f81[_0x190c('0x47')],{})['then'](respondWithResult(_0x451c6e,0xc9))[_0x190c('0x41')](handleError(_0x451c6e,null));};exports['update']=function(_0x1692a1,_0x2099d5){if(_0x1692a1[_0x190c('0x47')]['id']){delete _0x1692a1[_0x190c('0x47')]['id'];}return db[_0x190c('0x2d')]['find']({'where':{'id':_0x1692a1['params']['id']}})['then'](handleEntityNotFound(_0x2099d5,null))[_0x190c('0x25')](saveUpdates(_0x1692a1['body'],null))[_0x190c('0x25')](respondWithResult(_0x2099d5,null))[_0x190c('0x41')](handleError(_0x2099d5,null));};exports['destroy']=function(_0x40d30c,_0xf386b){return db['WhatsappTransferReport']['find']({'where':{'id':_0x40d30c['params']['id']}})[_0x190c('0x25')](handleEntityNotFound(_0xf386b,null))[_0x190c('0x25')](removeEntity(_0xf386b,null))[_0x190c('0x41')](handleError(_0xf386b,null));};exports[_0x190c('0x48')]=function(_0x16531e,_0x2e0cf6){return db[_0x190c('0x2d')]['describe']()[_0x190c('0x25')](respondWithResult(_0x2e0cf6,null))[_0x190c('0x41')](handleError(_0x2e0cf6,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e225ded..efeb039 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 _0xadf4=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x23b12a,_0x38caed){var _0x31c928=function(_0x3f73d7){while(--_0x3f73d7){_0x23b12a['push'](_0x23b12a['shift']());}};_0x31c928(++_0x38caed);}(_0xadf4,0xb4));var _0x4adf=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xadf4[_0x382c73];return _0x1dd0bf;};'use strict';var _=require(_0x4adf('0x0'));var util=require(_0x4adf('0x1'));var logger=require(_0x4adf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var fs=require('fs');var path=require(_0x4adf('0x5'));var rimraf=require(_0x4adf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4adf('0x7'));module[_0x4adf('0x8')]=function(_0x2ec3ef,_0x3bcc39){return _0x2ec3ef['define'](_0x4adf('0x9'),attributes,{'tableName':_0x4adf('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4adf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc24=['path','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x40e788,_0x5eb117){var _0x285672=function(_0x41a18b){while(--_0x41a18b){_0x40e788['push'](_0x40e788['shift']());}};_0x285672(++_0x5eb117);}(_0xbc24,0xc7));var _0x4bc2=function(_0x1e5cf9,_0x3c3885){_0x1e5cf9=_0x1e5cf9-0x0;var _0x3160e3=_0xbc24[_0x1e5cf9];return _0x3160e3;};'use strict';var _=require(_0x4bc2('0x0'));var util=require(_0x4bc2('0x1'));var logger=require(_0x4bc2('0x2'))('api');var moment=require(_0x4bc2('0x3'));var BPromise=require(_0x4bc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc2('0x5'));var rimraf=require('rimraf');var config=require(_0x4bc2('0x6'));var attributes=require(_0x4bc2('0x7'));module[_0x4bc2('0x8')]=function(_0x10a40b,_0x3e612f){return _0x10a40b[_0x4bc2('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x4bc2('0xa'),'paranoid':![],'indexes':[{'name':_0x4bc2('0xb'),'fields':[_0x4bc2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 535aa15..21f2802 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 _0x7723=['../../config/logger','../../config/environment','jayson/promise','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a2721,_0x462834){var _0x3f2bdf=function(_0x5b9f04){while(--_0x5b9f04){_0x5a2721['push'](_0x5a2721['shift']());}};_0x3f2bdf(++_0x462834);}(_0x7723,0x10e));var _0x3772=function(_0x126bef,_0x5cda97){_0x126bef=_0x126bef-0x0;var _0x365793=_0x7723[_0x126bef];return _0x365793;};'use strict';var _=require(_0x3772('0x0'));var util=require('util');var moment=require(_0x3772('0x1'));var BPromise=require('bluebird');var rs=require(_0x3772('0x2'));var fs=require('fs');var Redis=require(_0x3772('0x3'));var db=require(_0x3772('0x4'))['db'];var utils=require(_0x3772('0x5'));var logger=require(_0x3772('0x6'))('rpc');var config=require(_0x3772('0x7'));var jayson=require(_0x3772('0x8'));var client=jayson['client'][_0x3772('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e932c,_0x43cb7c,_0x1b0a6c){return new BPromise(function(_0x3d68fe,_0x1fcf0b){return client[_0x3772('0xa')](_0x5e932c,_0x1b0a6c)[_0x3772('0xb')](function(_0x4312cb){logger['info'](_0x3772('0xc'),_0x43cb7c,'request\x20sent');logger[_0x3772('0xd')](_0x3772('0xe'),_0x43cb7c,'request\x20sent',JSON[_0x3772('0xf')](_0x4312cb));if(_0x4312cb['error']){if(_0x4312cb['error'][_0x3772('0x10')]===0x1f4){logger['error'](_0x3772('0xc'),_0x43cb7c,_0x4312cb[_0x3772('0x11')][_0x3772('0x12')]);return _0x1fcf0b(_0x4312cb[_0x3772('0x11')][_0x3772('0x12')]);}logger[_0x3772('0x11')](_0x3772('0xc'),_0x43cb7c,_0x4312cb[_0x3772('0x11')][_0x3772('0x12')]);return _0x3d68fe(_0x4312cb[_0x3772('0x11')][_0x3772('0x12')]);}else{logger[_0x3772('0x13')](_0x3772('0xc'),_0x43cb7c,_0x3772('0x14'));_0x3d68fe(_0x4312cb[_0x3772('0x15')][_0x3772('0x12')]);}})[_0x3772('0x16')](function(_0x4044bd){logger[_0x3772('0x11')](_0x3772('0xc'),_0x43cb7c,_0x4044bd);_0x1fcf0b(_0x4044bd);});});} \ No newline at end of file +var _0xbadc=['rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xbadc,0x126));var _0xcbad=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0xbadc[_0x237f45];return _0x268b78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbad('0x0'));var BPromise=require(_0xcbad('0x1'));var rs=require(_0xcbad('0x2'));var fs=require('fs');var Redis=require(_0xcbad('0x3'));var db=require(_0xcbad('0x4'))['db'];var utils=require(_0xcbad('0x5'));var logger=require('../../config/logger')(_0xcbad('0x6'));var config=require(_0xcbad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcbad('0x8')][_0xcbad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c1cc,_0x46c1af,_0x20b36c){return new BPromise(function(_0x20b8bd,_0x596fd3){return client[_0xcbad('0xa')](_0x47c1cc,_0x20b36c)[_0xcbad('0xb')](function(_0x34f949){logger[_0xcbad('0xc')](_0xcbad('0xd'),_0x46c1af,_0xcbad('0xe'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x46c1af,'request\x20sent',JSON[_0xcbad('0xf')](_0x34f949));if(_0x34f949[_0xcbad('0x10')]){if(_0x34f949[_0xcbad('0x10')][_0xcbad('0x11')]===0x1f4){logger[_0xcbad('0x10')](_0xcbad('0xd'),_0x46c1af,_0x34f949[_0xcbad('0x10')]['message']);return _0x596fd3(_0x34f949[_0xcbad('0x10')]['message']);}logger[_0xcbad('0x10')](_0xcbad('0xd'),_0x46c1af,_0x34f949[_0xcbad('0x10')][_0xcbad('0x12')]);return _0x20b8bd(_0x34f949[_0xcbad('0x10')][_0xcbad('0x12')]);}else{logger[_0xcbad('0xc')](_0xcbad('0xd'),_0x46c1af,_0xcbad('0xe'));_0x20b8bd(_0x34f949[_0xcbad('0x13')]['message']);}})['catch'](function(_0x1b3dcf){logger[_0xcbad('0x10')](_0xcbad('0xd'),_0x46c1af,_0x1b3dcf);_0x596fd3(_0x1b3dcf);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 34b7f4d..0cd7591 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa423=['filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','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/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','start','info','number','exitCode','length','pm2_env','name','Online\x20apps:'];(function(_0x2e6768,_0x4066bd){var _0x160281=function(_0x3226c7){while(--_0x3226c7){_0x2e6768['push'](_0x2e6768['shift']());}};_0x160281(++_0x4066bd);}(_0xa423,0x16c));var _0x3a42=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xa423[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x3a42('0x0'));var db=require(_0x3a42('0x1'))['db'];var seedDb=require(_0x3a42('0x2'));var checkLicense=require(_0x3a42('0x3'));var rpc=require(_0x3a42('0x4'));var config=require('./config/environment');var logger=require(_0x3a42('0x5'))(_0x3a42('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x3a42('0x7'));var schedule=require(_0x3a42('0x8'));var chat=require(_0x3a42('0x9'));var whatsapp=require(_0x3a42('0xa'));var transcribe=require(_0x3a42('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x3a42('0xc')][_0x3a42('0xd')]()[_0x3a42('0xe')](function(){if(config[_0x3a42('0xf')]){return seedDb[_0x3a42('0x10')]();}})[_0x3a42('0xe')](function(){return checkLicense[_0x3a42('0x10')]();})[_0x3a42('0xe')](function(){return rpc[_0x3a42('0x11')]();})[_0x3a42('0xe')](function(_0x397559){logger['info'](_0x397559);return chat[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(){return whatsapp[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe[_0x3a42('0x12')]();})['then'](function(){return provider[_0x3a42('0x12')]();})[_0x3a42('0xe')](function(_0x198bf1){logger[_0x3a42('0x13')](_0x198bf1);return pm2[_0x3a42('0x12')](pm2Config);})[_0x3a42('0xe')](function(_0x5f5244){var _0xd32889=_0x5f5244['filter'](function(_0x469c73){return typeof _0x469c73['exitCode']===_0x3a42('0x14')&&_0x469c73[_0x3a42('0x15')]>=0x0;});if(_0xd32889[_0x3a42('0x16')]>0x0){throw new Error(_0xd32889['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0xd32889,function(_0x26c844){return'\x22'+_0x26c844[_0x3a42('0x17')][_0x3a42('0x18')]+'\x22';}));}logger[_0x3a42('0x13')](_0x3a42('0x19'),_['map'](_[_0x3a42('0x1a')](_0x5f5244,{'status':_0x3a42('0x1b')}),_0x3a42('0x18'))[_0x3a42('0x1c')]());logger[_0x3a42('0x13')](_0x3a42('0x1d'),_['map'](_[_0x3a42('0x1a')](_0x5f5244,function(_0x3f4afb){return _0x3f4afb[_0x3a42('0x1e')]!==_0x3a42('0x1b');}),_0x3a42('0x18'))['join']()||_0x3a42('0x1f'));console[_0x3a42('0x20')](_0x3a42('0x21'));})[_0x3a42('0x22')](function(_0x44c6e7){console['log'](_0x3a42('0x23'),_0x44c6e7);logger[_0x3a42('0x24')](_0x3a42('0x25'),_0x44c6e7);process[_0x3a42('0x26')](0x1);});}main(); \ No newline at end of file +var _0x5581=['catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','status','None','log','App\x20Ready!'];(function(_0x162ee0,_0x291661){var _0x48fc5e=function(_0x297a35){while(--_0x297a35){_0x162ee0['push'](_0x162ee0['shift']());}};_0x48fc5e(++_0x291661);}(_0x5581,0x115));var _0x1558=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5581[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x1558('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x1558('0x1'));var checkLicense=require(_0x1558('0x2'));var rpc=require(_0x1558('0x3'));var config=require(_0x1558('0x4'));var logger=require(_0x1558('0x5'))(_0x1558('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x1558('0x7'));var schedule=require(_0x1558('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x1558('0x9'));var transcribe=require(_0x1558('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x1558('0xb')][_0x1558('0xc')]()[_0x1558('0xd')](function(){if(config[_0x1558('0xe')]){return seedDb[_0x1558('0xf')]();}})['then'](function(){return checkLicense[_0x1558('0xf')]();})[_0x1558('0xd')](function(){return rpc[_0x1558('0x10')]();})[_0x1558('0xd')](function(_0x30f42b){logger[_0x1558('0x11')](_0x30f42b);return chat[_0x1558('0x12')]();})[_0x1558('0xd')](function(){return whatsapp[_0x1558('0x12')]();})[_0x1558('0xd')](function(){return schedule[_0x1558('0x12')]();})[_0x1558('0xd')](function(){return transcribe[_0x1558('0x12')]();})['then'](function(){return provider[_0x1558('0x12')]();})[_0x1558('0xd')](function(_0x3d2112){logger[_0x1558('0x11')](_0x3d2112);return pm2[_0x1558('0x12')](pm2Config);})[_0x1558('0xd')](function(_0x2a376c){var _0x13f559=_0x2a376c[_0x1558('0x13')](function(_0x5ae8ce){return typeof _0x5ae8ce[_0x1558('0x14')]===_0x1558('0x15')&&_0x5ae8ce[_0x1558('0x14')]>=0x0;});if(_0x13f559['length']>0x0){throw new Error(_0x13f559[_0x1558('0x16')]+_0x1558('0x17')+_[_0x1558('0x18')](_0x13f559,function(_0x2e3e05){return'\x22'+_0x2e3e05[_0x1558('0x19')]['name']+'\x22';}));}logger['info'](_0x1558('0x1a'),_[_0x1558('0x18')](_[_0x1558('0x13')](_0x2a376c,{'status':_0x1558('0x1b')}),_0x1558('0x1c'))[_0x1558('0x1d')]());logger[_0x1558('0x11')](_0x1558('0x1e'),_['map'](_['filter'](_0x2a376c,function(_0x56118b){return _0x56118b[_0x1558('0x1f')]!==_0x1558('0x1b');}),_0x1558('0x1c'))[_0x1558('0x1d')]()||_0x1558('0x20'));console[_0x1558('0x21')](_0x1558('0x22'));})[_0x1558('0x23')](function(_0x5a88c3){console[_0x1558('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x5a88c3);logger[_0x1558('0x24')](_0x1558('0x25'),_0x5a88c3);process[_0x1558('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ceb9ecf..f5cb157 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 _0x0598=['toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','split','length','splice','encryptString','join','sign','secret','secrets','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','jsonwebtoken','express-jwt','bluebird','util','session','role','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','headers','authorization','Basic','User','find','then','authenticate','pass','json','Wrong\x20credentials.','catch','startsWith','Bearer','Unknown\x20authorization\x20format','query','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Sequelize','validatePasswordHistory'];(function(_0x54603a,_0x199824){var _0x467b1d=function(_0x567ba3){while(--_0x567ba3){_0x54603a['push'](_0x54603a['shift']());}};_0x467b1d(++_0x199824);}(_0x0598,0x92));var _0x8059=function(_0x5875b8,_0x40838f){_0x5875b8=_0x5875b8-0x0;var _0x376147=_0x0598[_0x5875b8];return _0x376147;};'use strict';var db=require(_0x8059('0x0'))['db'];var config=require(_0x8059('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x8059('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x8059('0x3'));var expressJwt=require(_0x8059('0x4'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x8059('0x5'));var util=require(_0x8059('0x6'));var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x8059('0x7')]});var userAttributes=['id',_0x8059('0x8'),_0x8059('0x9'),_0x8059('0xa'),'internal','email',_0x8059('0xb'),_0x8059('0xc'),_0x8059('0xd'),_0x8059('0xe'),_0x8059('0xf'),'mailPause','faxPause',_0x8059('0x10'),_0x8059('0x11'),'pauseType','showWebBar','lastLoginAt',_0x8059('0x12'),_0x8059('0x13'),_0x8059('0x14'),_0x8059('0x15'),_0x8059('0x16'),'phoneBarAutoAnswer',_0x8059('0x17'),'phoneBarDnd',_0x8059('0x18'),'phoneBarEnableDtmfTone',_0x8059('0x19'),_0x8059('0x1a'),_0x8059('0x1b'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0x8059('0x1c'),_0x8059('0x1d'),_0x8059('0x1e'),_0x8059('0x1f'),_0x8059('0x20'),'downloadVoiceRecordings',_0x8059('0x21'),_0x8059('0x22'),_0x8059('0x23'),_0x8059('0x24'),'chatAutoanswer',_0x8059('0x25'),'emailAutoanswer',_0x8059('0x26'),'smsAutoanswer',_0x8059('0x27'),'openchannelAutoanswer',_0x8059('0x28'),_0x8059('0x29'),_0x8059('0x2a'),'whatsappAutoanswer','whatsappAutoanswerDelay',_0x8059('0x2b')];exports[_0x8059('0x2c')]=function(){return this[_0x8059('0x2d')](!![])[_0x8059('0x2e')](function(_0x4c6234,_0x3bc226,_0x21ac82){if(_0x4c6234[_0x8059('0x2f')]){_0x21ac82();}else{return db['ChatInteraction'][_0x8059('0x30')]({'where':{'id':_0x4c6234[_0x8059('0x31')]['id']},'attributes':['id',_0x8059('0x32'),_0x8059('0x33')],'raw':!![]})['then'](function(_0x140f64){if(_0x140f64&&_0x140f64[_0x8059('0x32')]){return _0x3bc226[_0x8059('0x34')](_0x140f64[_0x8059('0x33')]===_0x8059('0x35')?0x195:0x193)['json']({'message':_0x140f64[_0x8059('0x33')]===_0x8059('0x35')?_0x8059('0x36'):'Forbidden.'});}else{_0x21ac82();}})['catch'](function(_0x5d5b45){_0x21ac82(_0x5d5b45);});}});};exports[_0x8059('0x2d')]=function isAuthenticated(_0xbebe0e){return compose()[_0x8059('0x2e')](function(_0x1009af,_0x59abe9,_0x1eb71b){var _0x50b737;if(_0x1009af[_0x8059('0x37')][_0x8059('0x38')]){if(_['startsWith'](_0x1009af[_0x8059('0x37')][_0x8059('0x38')],_0x8059('0x39'))){var _0x260ba8=basicAuth(_0x1009af);db[_0x8059('0x3a')][_0x8059('0x3b')]({'where':{'name':_0x260ba8[_0x8059('0xa')]}})[_0x8059('0x3c')](function(_0x505756){if(!_0x505756||!_0x505756[_0x8059('0x3d')](_0x260ba8[_0x8059('0x3e')])){return _0x59abe9[_0x8059('0x34')](0x191)[_0x8059('0x3f')]({'message':_0x8059('0x40')});}_0x1009af['user']={'id':_0x505756['id']};_0x1eb71b();})[_0x8059('0x41')](function(_0x22c492){_0x1eb71b(_0x22c492);});}else if(_[_0x8059('0x42')](_0x1009af[_0x8059('0x37')][_0x8059('0x38')],_0x8059('0x43'))){validateJwt(_0x1009af,_0x59abe9,_0x1eb71b);}else{if(_0xbebe0e){_0x1eb71b();}else{return _0x59abe9[_0x8059('0x34')](0x193)[_0x8059('0x3f')]({'message':_0x8059('0x44')});}}}else if(_0x1009af[_0x8059('0x45')]['apikey']){try{var _0x45c175={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8059('0x46')]()};verifyJwt(_0x1009af['query']['apikey'],_0x45c175)[_0x8059('0x3c')](function(_0x5bd1a6){return db[_0x8059('0x3a')]['find']({'where':{'id':_0x5bd1a6[_0x8059('0x47')]}})['then'](function(_0x3d09fb){_0x50b737=_0x3d09fb;return db[_0x8059('0x48')]['findOne']({'where':{'id':0x1},'attributes':[_0x8059('0x49'),_0x8059('0x4a')],'raw':!![]});})[_0x8059('0x3c')](function(_0x483058){if(!_0x50b737||!_[_0x8059('0x4b')](_0x50b737['apiKeyNonce'],_0x5bd1a6[_0x8059('0x4c')])){return _0x59abe9['status'](0x191)[_0x8059('0x3f')]({'message':_0x8059('0x4d')});}if(_0x50b737[_0x8059('0x4e')]){return _0x59abe9[_0x8059('0x34')](0x191)['json']({'message':_0x8059('0x4f')});}if(_0x50b737['blocked']){if(_0x483058['blockDuration']>0x0){if(moment(_0x50b737[_0x8059('0x50')])[_0x8059('0x51')](_0x483058[_0x8059('0x4a')],_0x8059('0x52'))>moment()){return _0x59abe9[_0x8059('0x34')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x59abe9['status'](0x191)['json']({'message':_0x8059('0x4f')});}}_0x1009af[_0x8059('0x2f')]={'id':_0x50b737['id']};_0x1eb71b();});})[_0x8059('0x41')](function(){return _0x59abe9['status'](0x191)[_0x8059('0x3f')]({'message':_0x8059('0x4f')});});}catch(_0x52919a){_0x1eb71b(_0x52919a);}}else if(_0xbebe0e){_0x1eb71b();}else{return _0x59abe9[_0x8059('0x34')](0x193)[_0x8059('0x3f')]({'message':_0x8059('0x44')});}})['use'](function(_0x2c48cf,_0x38c320,_0x57eb56){if(_0x2c48cf[_0x8059('0x2f')]){db[_0x8059('0x3a')][_0x8059('0x3b')]({'where':{'id':_0x2c48cf[_0x8059('0x2f')]['id']},'attributes':userAttributes})[_0x8059('0x3c')](function(_0x25cee6){if(!_0x25cee6){return _0x38c320[_0x8059('0x34')](0x194)[_0x8059('0x3f')]({'message':_0x8059('0x53')});}_0x2c48cf[_0x8059('0x2f')]=_0x25cee6;_0x57eb56();})[_0x8059('0x41')](function(_0x245cf5){_0x57eb56(_0x245cf5);});}else if(_0xbebe0e){_0x57eb56();}else{return _0x38c320[_0x8059('0x34')](0x194)[_0x8059('0x3f')]({'message':_0x8059('0x54')});}});};exports[_0x8059('0x55')]=function canUpdate(){return compose()[_0x8059('0x2e')](function(_0x25f542,_0x1b613f,_0x1a139e){return licenseUtil[_0x8059('0x56')]()[_0x8059('0x3c')](function(_0xdda30){if(_0xdda30['update']){_0x1a139e();}else{return _0x1b613f[_0x8059('0x34')](0x193)['json']({'message':'Forbidden'});}})[_0x8059('0x41')](function(_0x539c9f){_0x1a139e(_0x539c9f);});});};exports[_0x8059('0x57')]=function isWebrtcLicence(){return compose()['use'](function(_0xf4bc19,_0x37619a,_0x37cfc9){return licenseUtil[_0x8059('0x56')]()[_0x8059('0x3c')](function(_0x28aa1b){if(_0x28aa1b['webrtc']){_0x37cfc9();}else{return _0x37619a[_0x8059('0x34')](0x193)['json']({'message':_0x8059('0x58')});}})[_0x8059('0x41')](function(_0x3b954e){_0x37cfc9(_0x3b954e);});});};exports['isMiddleware']=function(_0xf220b3,_0x120665,_0x46bec8){_0xf220b3[_0x8059('0x59')]=!![];return _0x46bec8();};exports['signToken']=function signToken(_0x3ccfb1){return signJwt(_0x3ccfb1);};exports[_0x8059('0x5a')]=function(_0x109748,_0x48e3bb){if(!_0x109748[_0x8059('0x2f')]){return _0x48e3bb['status'](0x194)['json']({'message':_0x8059('0x5b')});}var _0x4b0cc1={'payload':{'id':_0x109748[_0x8059('0x2f')]['id'],'role':_0x109748['user'][_0x8059('0x8')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4b0cc1)[_0x8059('0x3c')](function(_0x5ea40c){_0x48e3bb[_0x8059('0x5c')]('motion.token',_0x5ea40c);_0x48e3bb[_0x8059('0x5d')](_0x8059('0x5e'));})[_0x8059('0x41')](function(_0x5d5f16){return _0x48e3bb[_0x8059('0x34')](0x1f4)['send'](_0x5d5f16);});};exports[_0x8059('0x5f')]=function(_0x1b6fef){if(_[_0x8059('0x60')](_0x1b6fef[_0x8059('0x61')])||_['isNil'](_0x1b6fef[_0x8059('0x62')])){return null;}else{return createJwt(_0x1b6fef);}};exports[_0x8059('0x63')]=function(_0x58c5b2){_0x58c5b2[_0x8059('0x61')]=generateNonce();_0x58c5b2['apiKeyIat']=generateIssuedAt();return createJwt(_0x58c5b2);};exports[_0x8059('0x64')]=function(_0x547ffb,_0x5146ca){var _0x15bd13=_0x547ffb[_0x8059('0x45')][_0x8059('0x65')];if(_0x15bd13){var _0x3afe66={'nonce':_0x5146ca[_0x8059('0x61')],'iat':_0x5146ca[_0x8059('0x62')],'audience':hardwareConf[_0x8059('0x46')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x15bd13,_0x3afe66)['then'](function(){return generateApiKey(_0x5146ca);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x37c254){var _0x21d53c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21d53c['test'](_0x37c254))throw new db[(_0x8059('0x66'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x8059('0x67')]=function(_0x55cb8d,_0x11b69a,_0x27dfa5){var _0x2476e3=encryptor['decryptString'](_0x11b69a)['split'](',');for(var _0x886c5c=0x0;_0x886c5c<_0x27dfa5;_0x886c5c++){if(!_0x2476e3[_0x886c5c])break;if(_0x55cb8d[_0x8059('0x68')]()===_0x2476e3[_0x886c5c][_0x8059('0x68')]()){var _0x5056e6=util['format'](_0x8059('0x69'),_0x27dfa5);if(_0x27dfa5===0x1){_0x5056e6='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x8059('0x6a'))](_0x5056e6);}}return;};exports['updatePasswordsHistory']=function(_0x391687,_0x1c4015){var _0x4c5387=_0x1c4015?encryptor['decryptString'](_0x1c4015)[_0x8059('0x6b')](','):[];if(_0x4c5387[_0x8059('0x6c')]===0x5){_0x4c5387[_0x8059('0x6d')](-0x1,0x1);}_0x4c5387['unshift'](_0x391687);return encryptor[_0x8059('0x6e')](_0x4c5387[_0x8059('0x6f')](','));};function signJwt(_0xc6b6d8){var _0x18bce2=BPromise['promisify'](jwt[_0x8059('0x70')],{'context':jwt});var _0x537c32=_0xc6b6d8[_0x8059('0x71')]||config[_0x8059('0x72')]['session'];return new BPromise(function(_0x3a3254,_0x592e0b){_0x18bce2(_0xc6b6d8[_0x8059('0x73')],_0x537c32,_0xc6b6d8[_0x8059('0x74')])[_0x8059('0x3c')](function(_0x1263a1){_0x3a3254(_0x1263a1);})[_0x8059('0x41')](function(_0x19ccd7){_0x592e0b(_0x19ccd7);});});}function verifyJwt(_0x28b466,_0x410bf4,_0x352e51){var _0x471cb3=BPromise[_0x8059('0x75')](jwt[_0x8059('0x76')],{'context':jwt});var _0x325f9c=_0x352e51||config['secrets'][_0x8059('0x7')];return new BPromise(function(_0x2dc612,_0x391924){_0x471cb3(_0x28b466,_0x325f9c,_0x410bf4)[_0x8059('0x3c')](function(_0x2cf1fd){_0x2dc612(_0x2cf1fd);})['catch'](function(_0xfbb97b){_0x391924(_0xfbb97b);});});}function generateNonce(){return crypto[_0x8059('0x77')](0x10)[_0x8059('0x78')](_0x8059('0x79'));}function generateIssuedAt(){return Math[_0x8059('0x7a')](Date[_0x8059('0x7b')]()/0x3e8)[_0x8059('0x78')]();}function createJwt(_0x2804ba){var _0x19a3b7={'payload':{'iat':_0x2804ba['apiKeyIat'],'nonce':_0x2804ba[_0x8059('0x61')]},'options':{'algorithm':_0x8059('0x7c'),'subject':_0x2804ba['id'][_0x8059('0x78')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x19a3b7)[_0x8059('0x3c')](function(_0x514dce){return{'iat':_0x2804ba[_0x8059('0x62')],'nonce':_0x2804ba[_0x8059('0x61')],'token':_0x514dce};});} \ No newline at end of file +var _0xe605=['payload','options','promisify','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','then','status','unmanaged','disposition','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','json','Wrong\x20credentials.','query','getUuid','apikey','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','find','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','unshift','encryptString','join','sign','session'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xe605,0x92));var _0x5e60=function(_0x2c9966,_0x14ced2){_0x2c9966=_0x2c9966-0x0;var _0x367a7b=_0xe605[_0x2c9966];return _0x367a7b;};'use strict';var db=require(_0x5e60('0x0'))['db'];var config=require(_0x5e60('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5e60('0x2'));var encryptor=require(_0x5e60('0x3'));var _=require(_0x5e60('0x4'));var jwt=require(_0x5e60('0x5'));var expressJwt=require(_0x5e60('0x6'));var compose=require(_0x5e60('0x7'));var basicAuth=require(_0x5e60('0x8'));var crypto=require(_0x5e60('0x9'));var BPromise=require(_0x5e60('0xa'));var util=require(_0x5e60('0xb'));var moment=require(_0x5e60('0xc'));var validateJwt=expressJwt({'secret':config[_0x5e60('0xd')]['session']});var userAttributes=['id',_0x5e60('0xe'),'fullname','name','internal',_0x5e60('0xf'),_0x5e60('0x10'),_0x5e60('0x11'),_0x5e60('0x12'),_0x5e60('0x13'),_0x5e60('0x14'),'mailPause',_0x5e60('0x15'),'smsPause',_0x5e60('0x16'),_0x5e60('0x17'),_0x5e60('0x18'),'lastLoginAt',_0x5e60('0x19'),_0x5e60('0x1a'),_0x5e60('0x1b'),_0x5e60('0x1c'),_0x5e60('0x1d'),_0x5e60('0x1e'),'phoneBarAutoAnswerDelay',_0x5e60('0x1f'),_0x5e60('0x20'),_0x5e60('0x21'),_0x5e60('0x22'),'phoneBarExpires',_0x5e60('0x23'),'phoneBarRemoteControl',_0x5e60('0x24'),_0x5e60('0x25'),'interface',_0x5e60('0x26'),_0x5e60('0x27'),_0x5e60('0x28'),_0x5e60('0x29'),'downloadVoiceRecordings',_0x5e60('0x2a'),_0x5e60('0x2b'),'ignorePauseForPreviewCalls',_0x5e60('0x2c'),_0x5e60('0x2d'),_0x5e60('0x2e'),_0x5e60('0x2f'),_0x5e60('0x30'),_0x5e60('0x31'),_0x5e60('0x32'),_0x5e60('0x33'),_0x5e60('0x34'),_0x5e60('0x35'),_0x5e60('0x36'),'whatsappAutoanswer',_0x5e60('0x37'),'messengerSoundNotification'];exports[_0x5e60('0x38')]=function(){return this[_0x5e60('0x39')](!![])[_0x5e60('0x3a')](function(_0x144808,_0x34e98d,_0x2a499e){if(_0x144808[_0x5e60('0x3b')]){_0x2a499e();}else{return db['ChatInteraction'][_0x5e60('0x3c')]({'where':{'id':_0x144808[_0x5e60('0x3d')]['id']},'attributes':['id',_0x5e60('0x3e'),'disposition'],'raw':!![]})[_0x5e60('0x3f')](function(_0x56e3a5){if(_0x56e3a5&&_0x56e3a5[_0x5e60('0x3e')]){return _0x34e98d[_0x5e60('0x40')](_0x56e3a5['disposition']===_0x5e60('0x41')?0x195:0x193)['json']({'message':_0x56e3a5[_0x5e60('0x42')]===_0x5e60('0x41')?'Unmanaged.':_0x5e60('0x43')});}else{_0x2a499e();}})[_0x5e60('0x44')](function(_0x5b1b46){_0x2a499e(_0x5b1b46);});}});};exports[_0x5e60('0x39')]=function isAuthenticated(_0xac9c7a){return compose()['use'](function(_0x5431a8,_0x52f668,_0xf25956){var _0x235cc7;if(_0x5431a8[_0x5e60('0x45')][_0x5e60('0x46')]){if(_[_0x5e60('0x47')](_0x5431a8['headers'][_0x5e60('0x46')],_0x5e60('0x48'))){var _0x4d4b55=basicAuth(_0x5431a8);db[_0x5e60('0x49')]['find']({'where':{'name':_0x4d4b55['name']}})[_0x5e60('0x3f')](function(_0x3c4340){if(!_0x3c4340||!_0x3c4340[_0x5e60('0x4a')](_0x4d4b55[_0x5e60('0x4b')])){return _0x52f668[_0x5e60('0x40')](0x191)[_0x5e60('0x4c')]({'message':_0x5e60('0x4d')});}_0x5431a8[_0x5e60('0x3b')]={'id':_0x3c4340['id']};_0xf25956();})[_0x5e60('0x44')](function(_0x4702a6){_0xf25956(_0x4702a6);});}else if(_['startsWith'](_0x5431a8[_0x5e60('0x45')]['authorization'],'Bearer')){validateJwt(_0x5431a8,_0x52f668,_0xf25956);}else{if(_0xac9c7a){_0xf25956();}else{return _0x52f668[_0x5e60('0x40')](0x193)[_0x5e60('0x4c')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5431a8[_0x5e60('0x4e')]['apikey']){try{var _0x3757fc={'audience':hardwareConf[_0x5e60('0x4f')](),'issuer':hardwareConf[_0x5e60('0x4f')]()};verifyJwt(_0x5431a8[_0x5e60('0x4e')][_0x5e60('0x50')],_0x3757fc)[_0x5e60('0x3f')](function(_0x2eaaef){return db[_0x5e60('0x49')]['find']({'where':{'id':_0x2eaaef[_0x5e60('0x51')]}})[_0x5e60('0x3f')](function(_0x22d4ad){_0x235cc7=_0x22d4ad;return db[_0x5e60('0x52')][_0x5e60('0x3c')]({'where':{'id':0x1},'attributes':[_0x5e60('0x53'),_0x5e60('0x54')],'raw':!![]});})['then'](function(_0x3ca05b){if(!_0x235cc7||!_[_0x5e60('0x55')](_0x235cc7['apiKeyNonce'],_0x2eaaef['nonce'])){return _0x52f668[_0x5e60('0x40')](0x191)[_0x5e60('0x4c')]({'message':_0x5e60('0x56')});}if(_0x235cc7[_0x5e60('0x57')]){return _0x52f668[_0x5e60('0x40')](0x191)['json']({'message':_0x5e60('0x58')});}if(_0x235cc7[_0x5e60('0x59')]){if(_0x3ca05b[_0x5e60('0x54')]>0x0){if(moment(_0x235cc7[_0x5e60('0x5a')])[_0x5e60('0x5b')](_0x3ca05b[_0x5e60('0x54')],_0x5e60('0x5c'))>moment()){return _0x52f668['status'](0x191)[_0x5e60('0x4c')]({'message':_0x5e60('0x58')});}}else{return _0x52f668['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x5431a8[_0x5e60('0x3b')]={'id':_0x235cc7['id']};_0xf25956();});})[_0x5e60('0x44')](function(){return _0x52f668[_0x5e60('0x40')](0x191)[_0x5e60('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x27e247){_0xf25956(_0x27e247);}}else if(_0xac9c7a){_0xf25956();}else{return _0x52f668[_0x5e60('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x5e60('0x3a')](function(_0x42b9b0,_0x40cb06,_0x38ff1d){if(_0x42b9b0[_0x5e60('0x3b')]){db[_0x5e60('0x49')][_0x5e60('0x5d')]({'where':{'id':_0x42b9b0[_0x5e60('0x3b')]['id']},'attributes':userAttributes})[_0x5e60('0x3f')](function(_0x5ed4fc){if(!_0x5ed4fc){return _0x40cb06[_0x5e60('0x40')](0x194)[_0x5e60('0x4c')]({'message':'User\x20not\x20found.'});}_0x42b9b0[_0x5e60('0x3b')]=_0x5ed4fc;_0x38ff1d();})[_0x5e60('0x44')](function(_0x2cba0a){_0x38ff1d(_0x2cba0a);});}else if(_0xac9c7a){_0x38ff1d();}else{return _0x40cb06[_0x5e60('0x40')](0x194)[_0x5e60('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5e60('0x5e')]=function canUpdate(){return compose()[_0x5e60('0x3a')](function(_0x172aff,_0x46ced1,_0x4b6e30){return licenseUtil['getLicense']()['then'](function(_0x33f059){if(_0x33f059[_0x5e60('0x5f')]){_0x4b6e30();}else{return _0x46ced1[_0x5e60('0x40')](0x193)[_0x5e60('0x4c')]({'message':_0x5e60('0x60')});}})[_0x5e60('0x44')](function(_0x56c886){_0x4b6e30(_0x56c886);});});};exports[_0x5e60('0x61')]=function isWebrtcLicence(){return compose()[_0x5e60('0x3a')](function(_0x165bea,_0x2a7604,_0x3c7d04){return licenseUtil[_0x5e60('0x62')]()[_0x5e60('0x3f')](function(_0x4acd96){if(_0x4acd96[_0x5e60('0x63')]){_0x3c7d04();}else{return _0x2a7604[_0x5e60('0x40')](0x193)[_0x5e60('0x4c')]({'message':_0x5e60('0x60')});}})[_0x5e60('0x44')](function(_0x2d4ced){_0x3c7d04(_0x2d4ced);});});};exports[_0x5e60('0x64')]=function(_0x4470bd,_0x1518bd,_0x350d6d){_0x4470bd[_0x5e60('0x64')]=!![];return _0x350d6d();};exports[_0x5e60('0x65')]=function signToken(_0x3e84be){return signJwt(_0x3e84be);};exports[_0x5e60('0x66')]=function(_0x1aa381,_0x176ef3){if(!_0x1aa381[_0x5e60('0x3b')]){return _0x176ef3[_0x5e60('0x40')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1d85eb={'payload':{'id':_0x1aa381['user']['id'],'role':_0x1aa381[_0x5e60('0x3b')][_0x5e60('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1d85eb)[_0x5e60('0x3f')](function(_0x36e5d9){_0x176ef3[_0x5e60('0x67')](_0x5e60('0x68'),_0x36e5d9);_0x176ef3['redirect']('/dashboards/general');})[_0x5e60('0x44')](function(_0x1e4e41){return _0x176ef3[_0x5e60('0x40')](0x1f4)['send'](_0x1e4e41);});};exports['retrieveApiKey']=function(_0x31ced8){if(_[_0x5e60('0x69')](_0x31ced8[_0x5e60('0x6a')])||_['isNil'](_0x31ced8[_0x5e60('0x6b')])){return null;}else{return createJwt(_0x31ced8);}};exports[_0x5e60('0x6c')]=function(_0x153820){_0x153820[_0x5e60('0x6a')]=generateNonce();_0x153820[_0x5e60('0x6b')]=generateIssuedAt();return createJwt(_0x153820);};exports[_0x5e60('0x6d')]=function(_0x4ae313,_0x412be1){var _0x1cb33b=_0x4ae313['query'][_0x5e60('0x50')];if(_0x1cb33b){var _0x3f6a1e={'nonce':_0x412be1[_0x5e60('0x6a')],'iat':_0x412be1['apiKeyIat'],'audience':hardwareConf[_0x5e60('0x4f')](),'issuer':hardwareConf[_0x5e60('0x4f')]()};return verifyJwt(_0x1cb33b,_0x3f6a1e)['then'](function(){return generateApiKey(_0x412be1);});}else{throw{'message':_0x5e60('0x6e')};}};exports[_0x5e60('0x6f')]=function(_0x23f954){var _0x3626c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3626c2['test'](_0x23f954))throw new db[(_0x5e60('0x70'))][(_0x5e60('0x71'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x5e60('0x72')]=function(_0x4cb322,_0x8d00b9,_0x5220fc){var _0x2f930b=encryptor[_0x5e60('0x73')](_0x8d00b9)['split'](',');for(var _0x28eb8c=0x0;_0x28eb8c<_0x5220fc;_0x28eb8c++){if(!_0x2f930b[_0x28eb8c])break;if(_0x4cb322['toLowerCase']()===_0x2f930b[_0x28eb8c][_0x5e60('0x74')]()){var _0x566fc7=util[_0x5e60('0x75')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5220fc);if(_0x5220fc===0x1){_0x566fc7=_0x5e60('0x76');}throw new db[(_0x5e60('0x70'))][(_0x5e60('0x71'))](_0x566fc7);}}return;};exports[_0x5e60('0x77')]=function(_0x252fa3,_0x2b8343){var _0x3d1e35=_0x2b8343?encryptor['decryptString'](_0x2b8343)[_0x5e60('0x78')](','):[];if(_0x3d1e35[_0x5e60('0x79')]===0x5){_0x3d1e35[_0x5e60('0x7a')](-0x1,0x1);}_0x3d1e35[_0x5e60('0x7b')](_0x252fa3);return encryptor[_0x5e60('0x7c')](_0x3d1e35[_0x5e60('0x7d')](','));};function signJwt(_0x4a59bd){var _0x5d4717=BPromise['promisify'](jwt[_0x5e60('0x7e')],{'context':jwt});var _0x10f0bc=_0x4a59bd['secret']||config[_0x5e60('0xd')][_0x5e60('0x7f')];return new BPromise(function(_0x557f74,_0x2c9e7b){_0x5d4717(_0x4a59bd[_0x5e60('0x80')],_0x10f0bc,_0x4a59bd[_0x5e60('0x81')])[_0x5e60('0x3f')](function(_0x2c298b){_0x557f74(_0x2c298b);})[_0x5e60('0x44')](function(_0x208340){_0x2c9e7b(_0x208340);});});}function verifyJwt(_0x27f78f,_0xc327ff,_0x406c3a){var _0x157aad=BPromise[_0x5e60('0x82')](jwt[_0x5e60('0x83')],{'context':jwt});var _0x2826f7=_0x406c3a||config[_0x5e60('0xd')][_0x5e60('0x7f')];return new BPromise(function(_0xda4b15,_0x5c711c){_0x157aad(_0x27f78f,_0x2826f7,_0xc327ff)[_0x5e60('0x3f')](function(_0x1706d6){_0xda4b15(_0x1706d6);})[_0x5e60('0x44')](function(_0x56ddd9){_0x5c711c(_0x56ddd9);});});}function generateNonce(){return crypto[_0x5e60('0x84')](0x10)[_0x5e60('0x85')]('hex');}function generateIssuedAt(){return Math[_0x5e60('0x86')](Date[_0x5e60('0x87')]()/0x3e8)['toString']();}function createJwt(_0x1988c0){var _0x23c80={'payload':{'iat':_0x1988c0[_0x5e60('0x6b')],'nonce':_0x1988c0[_0x5e60('0x6a')]},'options':{'algorithm':_0x5e60('0x88'),'subject':_0x1988c0['id'][_0x5e60('0x85')](),'issuer':hardwareConf[_0x5e60('0x4f')](),'audience':hardwareConf[_0x5e60('0x4f')]()}};return signJwt(_0x23c80)[_0x5e60('0x3f')](function(_0x56d501){return{'iat':_0x1988c0[_0x5e60('0x6b')],'nonce':_0x1988c0[_0x5e60('0x6a')],'token':_0x56d501};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3ab1329..77cdb0d 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0829=['search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','map','CmCustomField','all','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then'];(function(_0x2c425f,_0x250e36){var _0x4080fc=function(_0x46ae2a){while(--_0x46ae2a){_0x2c425f['push'](_0x2c425f['shift']());}};_0x4080fc(++_0x250e36);}(_0x0829,0x120));var _0x9082=function(_0x4dfc94,_0x5035da){_0x4dfc94=_0x4dfc94-0x0;var _0x2eafb=_0x0829[_0x4dfc94];return _0x2eafb;};'use strict';var _=require(_0x9082('0x0'));var sqlUtils=require(_0x9082('0x1'));var db=require(_0x9082('0x2'))['db'];exports[_0x9082('0x3')]=function(_0x743da6,_0x4575f8,_0x408b9d,_0x451230){var _0x591de6={'count':0x0,'rows':[]};var _0x27e61f=sqlUtils[_0x9082('0x4')](_0x4575f8,_0x743da6);if(_0x27e61f){return Promise[_0x9082('0x5')](_0x591de6);}var _0x3c828e=sqlUtils[_0x9082('0x6')]();var _0x20a050={};var _0x438dd7=![];var _0x24d2d5=![];return Promise[_0x9082('0x5')]()[_0x9082('0x7')](function(){if(_0x743da6[_0x9082('0x8')]){return sqlUtils[_0x9082('0x9')](_0x743da6['search'],_0x451230);}else{return sqlUtils[_0x9082('0xa')](_0x743da6,_0x451230);}})[_0x9082('0x7')](function(_0x28c604){_0x3c828e[_0x9082('0xb')](_0x28c604[_0x9082('0xc')]);_0x3c828e[_0x9082('0xb')](_0x28c604[_0x9082('0xd')]);_0x3c828e[_0x9082('0xb')](_0x28c604[_0x9082('0xe')]);_0x3c828e[_0x9082('0xb')](_0x28c604['user'][_0x9082('0xf')]);_0x20a050=_0x28c604[_0x9082('0x10')];_0x24d2d5=_0x28c604['user'][_0x9082('0x11')];return sqlUtils[_0x9082('0x12')](_0x4575f8,_0x743da6,_0x24d2d5);})[_0x9082('0x7')](function(_0x456315){_0x3c828e['where'](_0x456315);var _0x456810=_0x743da6['search']?_0x20a050[_0x9082('0x13')]:_0x743da6['tag'];_0x438dd7=_0x456810?!![]:![];return sqlUtils[_0x9082('0x14')](_0x3c828e,_0x456810);})[_0x9082('0x7')](function(_0xda4615){_0x591de6[_0x9082('0x15')]=_0xda4615;if(_0x591de6[_0x9082('0x15')]===0x0){return;}if(_0x743da6[_0x9082('0x16')]){_0x24d2d5=!![];}return sqlUtils[_0x9082('0x17')](_0x3c828e,_0x743da6[_0x9082('0xd')],_0x408b9d,_0x438dd7,_0x20a050[_0x9082('0xf')],_0x24d2d5);})['then'](function(_0x1fc4a9){if(!_0x1fc4a9){return[];}return sqlUtils[_0x9082('0x18')](_0x1fc4a9,_0x743da6,_0x408b9d);})[_0x9082('0x7')](function(_0x56200a){_0x591de6[_0x9082('0x19')]=_0x56200a;return _0x591de6;})[_0x9082('0x1a')](function(_0x12d8de){throw _0x12d8de;});};exports[_0x9082('0x1b')]=function(){var _0x947f0a={};var _0x466cc6=[];return db[_0x9082('0x1c')][_0x9082('0x1b')]()[_0x9082('0x7')](function(_0x32e8cf){_0x947f0a=_0x32e8cf;var _0x4b1d18=Object[_0x9082('0x1d')](_0x947f0a)[_0x9082('0xe')](function(_0x4a7b92){return _[_0x9082('0x1e')](_0x4a7b92,'cf_')?_0x4a7b92:undefined;});var _0xe7fb6=_0x4b1d18[_0x9082('0x1f')](function(_0x28f3df){return db[_0x9082('0x20')]['findOne']({'where':{'id':_0x28f3df['slice'](0x3)},'raw':!![]});});return Promise[_0x9082('0x21')](_0xe7fb6);})[_0x9082('0x7')](function(_0x4e7e39){for(var _0x1a5b93=0x0;_0x1a5b93<_0x4e7e39['length'];_0x1a5b93++){if(_0x4e7e39[_0x1a5b93]){var _0x5e24a0=_0x9082('0x22')+_0x4e7e39[_0x1a5b93]['id'];_0x947f0a[_0x5e24a0][_0x9082('0x23')]=_0x4e7e39[_0x1a5b93][_0x9082('0x24')];}}_0x466cc6=_[_0x9082('0x1f')](Object[_0x9082('0x1d')](_0x947f0a),function(_0x102699){return{'name':_0x102699,'type':_0x947f0a[_0x102699][_0x9082('0x24')]};});return _0x466cc6;})[_0x9082('0x1a')](function(_0x39da10){throw _0x39da10;});}; \ No newline at end of file +var _0x19d1=['slice','all','length','fieldType','type','keys','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','where','default','fields','user','clause','skip','ids','countFilteredContacts','count','User','getFilteredContacts','catch','CmContact','describe','filter','startsWith','cf_','map','CmCustomField','findOne'];(function(_0x463446,_0x1d8f9d){var _0x2efbe1=function(_0x4cdcc5){while(--_0x4cdcc5){_0x463446['push'](_0x463446['shift']());}};_0x2efbe1(++_0x1d8f9d);}(_0x19d1,0xe6));var _0x119d=function(_0x3a9042,_0x778978){_0x3a9042=_0x3a9042-0x0;var _0x2ef734=_0x19d1[_0x3a9042];return _0x2ef734;};'use strict';var _=require('lodash');var sqlUtils=require(_0x119d('0x0'));var db=require(_0x119d('0x1'))['db'];exports['findAll']=function(_0x1e3f93,_0x472727,_0xda3dff,_0x166051){var _0x40e279={'count':0x0,'rows':[]};var _0x9b948d=sqlUtils[_0x119d('0x2')](_0x472727,_0x1e3f93);if(_0x9b948d){return Promise['resolve'](_0x40e279);}var _0x5ab0f2=sqlUtils['getContactsSubquery']();var _0x2dd5c9={};var _0x35e7df=![];var _0x511b6f=![];return Promise[_0x119d('0x3')]()[_0x119d('0x4')](function(){if(_0x1e3f93['search']){return sqlUtils[_0x119d('0x5')](_0x1e3f93['search'],_0x166051);}else{return sqlUtils['parseQueryParameters'](_0x1e3f93,_0x166051);}})[_0x119d('0x4')](function(_0x1479df){_0x5ab0f2[_0x119d('0x6')](_0x1479df[_0x119d('0x7')]);_0x5ab0f2[_0x119d('0x6')](_0x1479df[_0x119d('0x8')]);_0x5ab0f2[_0x119d('0x6')](_0x1479df['filter']);_0x5ab0f2[_0x119d('0x6')](_0x1479df[_0x119d('0x9')][_0x119d('0xa')]);_0x2dd5c9=_0x1479df['tags'];_0x511b6f=_0x1479df['user'][_0x119d('0xb')];return sqlUtils['checkListsRestrictions'](_0x472727,_0x1e3f93,_0x511b6f);})['then'](function(_0x308f5b){_0x5ab0f2['where'](_0x308f5b);var _0x3b2273=_0x1e3f93['search']?_0x2dd5c9[_0x119d('0xc')]:_0x1e3f93['tag'];_0x35e7df=_0x3b2273?!![]:![];return sqlUtils[_0x119d('0xd')](_0x5ab0f2,_0x3b2273);})[_0x119d('0x4')](function(_0x5901b9){_0x40e279[_0x119d('0xe')]=_0x5901b9;if(_0x40e279[_0x119d('0xe')]===0x0){return;}if(_0x1e3f93[_0x119d('0xf')]){_0x511b6f=!![];}return sqlUtils['buildContactsQuery'](_0x5ab0f2,_0x1e3f93[_0x119d('0x8')],_0xda3dff,_0x35e7df,_0x2dd5c9[_0x119d('0xa')],_0x511b6f);})[_0x119d('0x4')](function(_0x2bac45){if(!_0x2bac45){return[];}return sqlUtils[_0x119d('0x10')](_0x2bac45,_0x1e3f93,_0xda3dff);})[_0x119d('0x4')](function(_0x116f1e){_0x40e279['rows']=_0x116f1e;return _0x40e279;})[_0x119d('0x11')](function(_0x3a64d3){throw _0x3a64d3;});};exports['describe']=function(){var _0x2cd284={};var _0x4985a9=[];return db[_0x119d('0x12')][_0x119d('0x13')]()['then'](function(_0x2ae26a){_0x2cd284=_0x2ae26a;var _0x189aeb=Object['keys'](_0x2cd284)[_0x119d('0x14')](function(_0x415b7a){return _[_0x119d('0x15')](_0x415b7a,_0x119d('0x16'))?_0x415b7a:undefined;});var _0x66ac37=_0x189aeb[_0x119d('0x17')](function(_0x258e1f){return db[_0x119d('0x18')][_0x119d('0x19')]({'where':{'id':_0x258e1f[_0x119d('0x1a')](0x3)},'raw':!![]});});return Promise[_0x119d('0x1b')](_0x66ac37);})['then'](function(_0x16c06d){for(var _0x4f9dbb=0x0;_0x4f9dbb<_0x16c06d[_0x119d('0x1c')];_0x4f9dbb++){if(_0x16c06d[_0x4f9dbb]){var _0x28f2d7='cf_'+_0x16c06d[_0x4f9dbb]['id'];_0x2cd284[_0x28f2d7][_0x119d('0x1d')]=_0x16c06d[_0x4f9dbb][_0x119d('0x1e')];}}_0x4985a9=_[_0x119d('0x17')](Object[_0x119d('0x1f')](_0x2cd284),function(_0x51ad24){return{'name':_0x51ad24,'type':_0x2cd284[_0x51ad24][_0x119d('0x1e')]};});return _0x4985a9;})[_0x119d('0x11')](function(_0x433f12){throw _0x433f12;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 3692e9f..f2a3596 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47a9=['forEach','TagIds','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','DATE','buildExpression','type','value','start','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','name','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','resolve','then','getLists','length','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','color','Sequelize','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','includes'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x47a9,0x114));var _0x947a=function(_0x175e1c,_0x42e66e){_0x175e1c=_0x175e1c-0x0;var _0x150b55=_0x47a9[_0x175e1c];return _0x150b55;};'use strict';var _=require(_0x947a('0x0'));var squel=require(_0x947a('0x1'));var as=require(_0x947a('0x2'));var qs=require(_0x947a('0x3'));var utils=require(_0x947a('0x4'));var db=require(_0x947a('0x5'))['db'];function skipContactsQuery(_0x318af4,_0x2929d0){var _0x2d1499=![];if(_0x318af4[_0x947a('0x6')]===_0x947a('0x7')&&!_0x2929d0[_0x947a('0x8')]&&!_0x2929d0[_0x947a('0x9')]&&_0x2929d0[_0x947a('0xa')]!==_0x947a('0xb')){_0x2d1499=!![];}return _0x2d1499;}function getContactsSubquery(){return squel['select']()[_0x947a('0xc')](_0x947a('0xd'),'c')[_0x947a('0xe')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x118ae6,_0x138c1d){var _0x16d72b=_0x138c1d?'c':_0x947a('0xf');_0x118ae6[_0x947a('0x10')](_0x947a('0x11'),'uc',_0x947a('0x12')+_0x16d72b+'.id')[_0x947a('0x10')](_0x947a('0x13'),'ct',_0x947a('0x14')+_0x16d72b+_0x947a('0x15'))['left_join'](_0x947a('0x16'),'t',_0x947a('0x17'));return _0x118ae6;}function addFieldsToQuery(_0x3afb9d,_0x3b3f11,_0x34aa9b,_0x4ea942,_0x3d25f4){var _0x278894=_0x3d25f4?'c':_0x947a('0xf');if(!_0x3b3f11){_0x3b3f11=['id','firstName',_0x947a('0x18'),_0x947a('0x19'),_0x947a('0x1a'),_0x947a('0x1b'),_0x947a('0x1c'),_0x947a('0x9'),_0x947a('0x1d'),_0x947a('0x1e'),_0x947a('0x1f'),'deletedAt','TagIds'];}else if(!_0x3b3f11[_0x947a('0x20')]('id')){_0x3b3f11['push']('id');}var _0x582a9f=_0x34aa9b&&_0x3d25f4||!_0x34aa9b&&!_0x3d25f4;if(_0x4ea942){_0x582a9f=_0x4ea942&&_0x3d25f4||!_0x4ea942&&!_0x3d25f4;}_0x3b3f11[_0x947a('0x21')](function(_0x53904f){if(_0x53904f===_0x947a('0x22')){if(_0x582a9f){_0x3afb9d[_0x947a('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x53904f);}else if(_0x34aa9b||_0x4ea942){_0x3afb9d[_0x947a('0x23')](_0x278894+'.'+_0x53904f);}}else{_0x3afb9d['field'](_0x278894+'.'+_0x53904f);}});return _0x3afb9d;}function getSqlClauses(){var _0x415c61={'default':squel['expr'](),'fields':squel[_0x947a('0x24')](),'filter':squel[_0x947a('0x24')](),'tags':{'clause':squel[_0x947a('0x24')](),'ids':null},'user':{'clause':squel[_0x947a('0x24')](),'skip':![]}};return _0x415c61;}function parseTagParameter(_0x170c8b){var _0x50e02d=squel[_0x947a('0x24')]();if(_0x170c8b){var _0x1bba72=utils['getSelectedTags'](_0x170c8b);_0x1bba72[_0x947a('0x21')](function(_0x14bc55){_0x50e02d['or'](_0x947a('0x25'),'%,'+_0x14bc55+',%');});}return _0x50e02d;}function parseSearchFilter(_0x48bb06){var _0x28f235=squel[_0x947a('0x24')]();if(_0x48bb06){var _0x8103f=_0x48bb06[_0x947a('0x26')]('\x5c','\x5c\x5c')[_0x947a('0x26')](/'/g,'\x27\x27');if(_0x8103f[_0x947a('0x27')]('\x20')['length']>0x1){_0x28f235['or'](_0x947a('0x28'),qs[_0x947a('0x29')](_0x8103f,!![]),null);}else{if(qs[_0x947a('0x2a')](_0x8103f)){_0x28f235['or'](_0x947a('0x2b'),_0x8103f+'%');_0x28f235['or']('c.phone\x20LIKE\x20?',_0x8103f+'%');_0x28f235['or'](_0x947a('0x2c'),_0x8103f+'%');_0x28f235['or'](_0x947a('0x2d'),_0x8103f+'%');}else if(qs[_0x947a('0x2e')](_0x8103f)){_0x28f235['or'](_0x947a('0x2f'),_0x8103f+'%');}else{_0x28f235['or'](_0x947a('0x30'),'%'+_0x8103f+'%');_0x28f235['or']('c.lastName\x20LIKE\x20?','%'+_0x8103f+'%');_0x28f235['or'](_0x947a('0x2f'),'%'+_0x8103f+'%');}}}return _0x28f235;}function parseAdvancedSearchFilter(_0x5758bc,_0x83ad6d){var _0x13704d=getSqlClauses();var _0x125c28=as['parseSearch'](_0x5758bc);var _0x4e2b32=_0x125c28[_0x947a('0x31')];for(var _0x253e61=0x0;_0x253e61<_0x125c28[_0x947a('0x32')]['length'];_0x253e61++){var _0x4791f7=_0x125c28[_0x947a('0x32')][_0x253e61];var _0x2ee3c6='c';var _0x854810=_[_0x947a('0x33')](_0x83ad6d,['name',_0x4791f7['field']]);if(_0x854810){if(_0x4791f7[_0x947a('0x23')]===_0x947a('0x34')||_0x854810['fieldType']==='datetime'){_0x4791f7['castTo']=_0x947a('0x35');}var _0x38bede=as[_0x947a('0x36')](_0x2ee3c6,_0x854810[_0x947a('0x37')],_0x4791f7);_0x13704d['default'][_0x4e2b32](_0x38bede['text'],_0x38bede[_0x947a('0x38')][_0x947a('0x39')],_0x38bede[_0x947a('0x38')][_0x947a('0x3a')]);}else{if(_0x4791f7[_0x947a('0x23')]===_0x947a('0x3b')){var _0x18b2f7=_0x4791f7[_0x947a('0x38')][_0x947a('0x27')](',')[_0x947a('0x3c')](function(_0x47fc59){return Number(_0x47fc59);});var _0x192a7f=parseTagParameter(_0x18b2f7);_0x13704d[_0x947a('0x3d')][_0x947a('0x3e')][_0x947a('0x3f')](_0x192a7f);_0x13704d['tags'][_0x947a('0x40')]=_0x18b2f7;}else if(_0x4791f7['field']===_0x947a('0x41')){_0x13704d[_0x947a('0x42')][_0x947a('0x3e')][_0x947a('0x3f')](_0x947a('0x43'),_0x4791f7[_0x947a('0x38')]);_0x13704d['user'][_0x947a('0x44')]=!![];}}}return _0x13704d;}function parseModelFields(_0x45274a,_0x531066){var _0x407ded=squel[_0x947a('0x24')]();var _0x1bf36d=_(_0x45274a)[_0x947a('0x45')]()[_0x947a('0x3c')](function(_0x52b639){return _[_0x947a('0x46')](_0x531066,[_0x947a('0x47'),_0x52b639])?_0x52b639:undefined;})['compact']()[_0x947a('0x38')]();if(_0x45274a[_0x947a('0x48')]){_0x1bf36d[_0x947a('0x49')](_0x947a('0x48'));}if(_0x45274a[_0x947a('0x41')]){_0x1bf36d[_0x947a('0x49')]('User');}if(_0x1bf36d['length']>0x0){_0x1bf36d[_0x947a('0x21')](function(_0x44b566){if(_0x44b566==='ListId'){_0x407ded[_0x947a('0x3f')](_0x947a('0x4a'),[][_0x947a('0x4b')](_0x45274a[_0x44b566]));}else if(_0x44b566===_0x947a('0x48')){var _0x5632cb='%'+_0x45274a[_0x44b566]+'%';_0x407ded[_0x947a('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x5632cb);}else if(_0x44b566==='User'){_0x407ded[_0x947a('0x3f')](_0x947a('0x43'),_0x45274a[_0x44b566]);}else{_0x407ded[_0x947a('0x3f')]('c.'+_0x44b566+_0x947a('0x4c'),_0x45274a[_0x44b566]);}});}return _0x407ded;}function parseQueryParameters(_0x1cd459,_0x339bc2){var _0x79522f=getSqlClauses();return Promise[_0x947a('0x4d')]()['then'](function(){return parseModelFields(_0x1cd459,_0x339bc2);})[_0x947a('0x4e')](function(_0x457dc0){_0x79522f['fields']['and'](_0x457dc0);return parseTagParameter(_0x1cd459['tag']);})[_0x947a('0x4e')](function(_0x2d4592){_0x79522f['tags'][_0x947a('0x3e')]['and'](_0x2d4592);return parseSearchFilter(_0x1cd459['filter']);})['then'](function(_0x2fa7a2){_0x79522f['filter']=_0x2fa7a2;return _0x79522f;});}function checkListsRestrictions(_0x15ef90,_0x3c81e9,_0x5ad5b3){var _0x4ec0df=squel[_0x947a('0x24')]();return Promise['resolve']()[_0x947a('0x4e')](function(){if(_0x3c81e9[_0x947a('0x8')]&&_0x15ef90[_0x947a('0x6')]===_0x947a('0x7')&&!_0x5ad5b3){return _0x15ef90[_0x947a('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x51f99b){if(_0x51f99b){if(_0x51f99b[_0x947a('0x50')]===0x0){_0x4ec0df[_0x947a('0x3f')](_0x947a('0x51'));}else{_0x4ec0df['and']('c.ListId\x20IN\x20?',_['map'](_0x51f99b,'id'));}}})[_0x947a('0x4e')](function(){return _0x4ec0df;});}function buildContactsQuery(_0x1a9036,_0x4a21d7,_0xab9e74,_0xeb1f8d,_0x4d47f6,_0x2deecd){if(_0x4a21d7){_0x4a21d7=_0xab9e74['attributes'];}_0x1a9036=addFieldsToQuery(_0x1a9036,_0x4a21d7,_0xeb1f8d,_0x2deecd,!![]);var _0x57aed2=squel['select']();_0x57aed2=addFieldsToQuery(_0x57aed2,_0x4a21d7,_0xeb1f8d,_0x2deecd,![]);if(_0xeb1f8d||_0x2deecd){_0x1a9036=applyJoinClauses(_0x1a9036,!![]);_0x1a9036[_0x947a('0x52')](_0x947a('0x53'));if(_0xab9e74[_0x947a('0x54')]){_0x57aed2[_0x947a('0x54')](_0xab9e74[_0x947a('0x54')]);}if(_0xab9e74[_0x947a('0x55')]){_0x57aed2[_0x947a('0x55')](_0xab9e74[_0x947a('0x55')]);}}else{_0x57aed2=applyJoinClauses(_0x57aed2,![]);_0x57aed2[_0x947a('0x52')](_0x947a('0x56'));if(_0xab9e74[_0x947a('0x54')]){_0x1a9036[_0x947a('0x54')](_0xab9e74[_0x947a('0x54')]);}if(_0xab9e74[_0x947a('0x55')]){_0x1a9036[_0x947a('0x55')](_0xab9e74[_0x947a('0x55')]);}}_0x57aed2[_0x947a('0x57')](_0x4d47f6);if(_0xab9e74[_0x947a('0x58')]){_0xab9e74[_0x947a('0x58')][_0x947a('0x21')](function(_0x102930){_0x1a9036[_0x947a('0x58')]('c.'+_0x102930[0x0],_0x102930[0x1]===_0x947a('0x59')?![]:!![]);_0x57aed2[_0x947a('0x58')](_0x947a('0x5a')+_0x102930[0x0],_0x102930[0x1]===_0x947a('0x59')?![]:!![]);});}_0x57aed2[_0x947a('0xc')](_0x1a9036,_0x947a('0xf'));return _0x57aed2;}function getFilteredContacts(_0x3db37b){var _0x1b8ead=[];return db[_0x947a('0x3b')]['findAll']({'attributes':['id',_0x947a('0x47'),_0x947a('0x5b')],'raw':!![]})['then'](function(_0x2436d2){_0x1b8ead=_['keyBy'](_0x2436d2,'id');var _0x55d18b={'type':db[_0x947a('0x5c')]['QueryTypes'][_0x947a('0x5d')],'model':db[_0x947a('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x947a('0x5f')](_0x3db37b[_0x947a('0x60')](),_0x55d18b);})['then'](function(_0x109f8a){_0x109f8a[_0x947a('0x21')](function(_0x2275f9){if(_0x2275f9[_0x947a('0x22')]){_0x2275f9[_0x947a('0x61')]=[];_0x2275f9[_0x947a('0x22')][_0x947a('0x27')](',')[_0x947a('0x21')](function(_0x8f1cb6){_0x2275f9[_0x947a('0x61')][_0x947a('0x49')](_0x1b8ead[_0x8f1cb6]);});}delete _0x2275f9['TagIds'];});return _0x109f8a;});}function countFilteredContacts(_0x160c2d,_0x2af2a2){var _0x183471=_0x160c2d[_0x947a('0x62')]();_0x183471[_0x947a('0x23')](_0x947a('0x63'));_0x183471=applyJoinClauses(_0x183471,!![]);_0x160c2d[_0x947a('0x52')](_0x947a('0x53'));var _0x3d2c1f=utils['getSelectedTags'](_0x2af2a2);if(!_[_0x947a('0x64')](_0x3d2c1f)){_0x183471['where'](_0x947a('0x65'),_0x3d2c1f);}var _0x480ce6={'type':db[_0x947a('0x5c')]['QueryTypes'][_0x947a('0x5d')],'raw':!![]};return db[_0x947a('0x66')][_0x947a('0x5f')](_0x183471[_0x947a('0x60')](),_0x480ce6)['then'](function(_0x9e49be){return _0x9e49be[0x0][_0x947a('0x63')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x2cda=['agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','order','DESC','subqry.','findAll','name','color','Sequelize','QueryTypes','sequelize','toString','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?','query','COUNT(*)','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','end','Tag','map','clause','and','tags','ids','User','user','skip','keys','some','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','tag','filter'];(function(_0x56a6c2,_0x269dd5){var _0x1ed000=function(_0x5aec9f){while(--_0x5aec9f){_0x56a6c2['push'](_0x56a6c2['shift']());}};_0x1ed000(++_0x269dd5);}(_0x2cda,0x160));var _0xa2cd=function(_0x1fd902,_0x541f97){_0x1fd902=_0x1fd902-0x0;var _0x569d63=_0x2cda[_0x1fd902];return _0x569d63;};'use strict';var _=require(_0xa2cd('0x0'));var squel=require(_0xa2cd('0x1'));var as=require(_0xa2cd('0x2'));var qs=require(_0xa2cd('0x3'));var utils=require(_0xa2cd('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1e3657,_0x372e35){var _0x36dda0=![];if(_0x1e3657[_0xa2cd('0x5')]==='agent'&&!_0x372e35[_0xa2cd('0x6')]&&!_0x372e35[_0xa2cd('0x7')]&&_0x372e35[_0xa2cd('0x8')]!==_0xa2cd('0x9')){_0x36dda0=!![];}return _0x36dda0;}function getContactsSubquery(){return squel[_0xa2cd('0xa')]()[_0xa2cd('0xb')](_0xa2cd('0xc'),'c')[_0xa2cd('0xd')](_0xa2cd('0xe'));}function applyJoinClauses(_0x513c0e,_0x3011ca){var _0x4620ed=_0x3011ca?'c':'subqry';_0x513c0e[_0xa2cd('0xf')](_0xa2cd('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x4620ed+'.id')[_0xa2cd('0xf')](_0xa2cd('0x11'),'ct',_0xa2cd('0x12')+_0x4620ed+'.id')[_0xa2cd('0xf')](_0xa2cd('0x13'),'t',_0xa2cd('0x14'));return _0x513c0e;}function addFieldsToQuery(_0x830200,_0x40e051,_0x1a9716,_0x14f3f4,_0x26e50f){var _0x40c961=_0x26e50f?'c':_0xa2cd('0x15');if(!_0x40e051){_0x40e051=['id',_0xa2cd('0x16'),_0xa2cd('0x17'),_0xa2cd('0x18'),_0xa2cd('0x19'),_0xa2cd('0x1a'),'email',_0xa2cd('0x7'),_0xa2cd('0x1b'),_0xa2cd('0x1c'),_0xa2cd('0x1d'),_0xa2cd('0x1e'),_0xa2cd('0x1f')];}else if(!_0x40e051['includes']('id')){_0x40e051[_0xa2cd('0x20')]('id');}var _0x41ced9=_0x1a9716&&_0x26e50f||!_0x1a9716&&!_0x26e50f;if(_0x14f3f4){_0x41ced9=_0x14f3f4&&_0x26e50f||!_0x14f3f4&&!_0x26e50f;}_0x40e051[_0xa2cd('0x21')](function(_0x4d27e1){if(_0x4d27e1===_0xa2cd('0x1f')){if(_0x41ced9){_0x830200[_0xa2cd('0x22')](_0xa2cd('0x23'),_0x4d27e1);}else if(_0x1a9716||_0x14f3f4){_0x830200['field'](_0x40c961+'.'+_0x4d27e1);}}else{_0x830200[_0xa2cd('0x22')](_0x40c961+'.'+_0x4d27e1);}});return _0x830200;}function getSqlClauses(){var _0x17afd0={'default':squel[_0xa2cd('0x24')](),'fields':squel[_0xa2cd('0x24')](),'filter':squel[_0xa2cd('0x24')](),'tags':{'clause':squel[_0xa2cd('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x17afd0;}function parseTagParameter(_0x4e3f0b){var _0x150137=squel[_0xa2cd('0x24')]();if(_0x4e3f0b){var _0x3b2830=utils[_0xa2cd('0x25')](_0x4e3f0b);_0x3b2830[_0xa2cd('0x21')](function(_0x587678){_0x150137['or'](_0xa2cd('0x26'),'%,'+_0x587678+',%');});}return _0x150137;}function parseSearchFilter(_0x5b4cfc){var _0x1ee2d8=squel[_0xa2cd('0x24')]();if(_0x5b4cfc){var _0x463b28=_0x5b4cfc[_0xa2cd('0x27')]('\x5c','\x5c\x5c')[_0xa2cd('0x27')](/'/g,'\x27\x27');if(_0x463b28[_0xa2cd('0x28')]('\x20')[_0xa2cd('0x29')]>0x1){_0x1ee2d8['or'](_0xa2cd('0x2a'),qs[_0xa2cd('0x2b')](_0x463b28,!![]),null);}else{if(qs['isNumeric'](_0x463b28)){_0x1ee2d8['or'](_0xa2cd('0x2c'),_0x463b28+'%');_0x1ee2d8['or'](_0xa2cd('0x2d'),_0x463b28+'%');_0x1ee2d8['or'](_0xa2cd('0x2e'),_0x463b28+'%');_0x1ee2d8['or'](_0xa2cd('0x2f'),_0x463b28+'%');}else if(qs['isEmail'](_0x463b28)){_0x1ee2d8['or'](_0xa2cd('0x30'),_0x463b28+'%');}else{_0x1ee2d8['or'](_0xa2cd('0x31'),'%'+_0x463b28+'%');_0x1ee2d8['or']('c.lastName\x20LIKE\x20?','%'+_0x463b28+'%');_0x1ee2d8['or'](_0xa2cd('0x30'),'%'+_0x463b28+'%');}}}return _0x1ee2d8;}function parseAdvancedSearchFilter(_0x611c,_0x34aaf2){var _0x1a0b85=getSqlClauses();var _0x343c41=as[_0xa2cd('0x32')](_0x611c);var _0x2fc76d=_0x343c41['sqlOperator'];for(var _0xaf3609=0x0;_0xaf3609<_0x343c41['conditions'][_0xa2cd('0x29')];_0xaf3609++){var _0xb1b4c6=_0x343c41[_0xa2cd('0x33')][_0xaf3609];var _0x23253d='c';var _0x35c842=_[_0xa2cd('0x34')](_0x34aaf2,['name',_0xb1b4c6[_0xa2cd('0x22')]]);if(_0x35c842){if(_0xb1b4c6[_0xa2cd('0x22')]===_0xa2cd('0x35')||_0x35c842[_0xa2cd('0x36')]===_0xa2cd('0x37')){_0xb1b4c6[_0xa2cd('0x38')]=_0xa2cd('0x39');}var _0x542277=as[_0xa2cd('0x3a')](_0x23253d,_0x35c842['type'],_0xb1b4c6);_0x1a0b85[_0xa2cd('0x3b')][_0x2fc76d](_0x542277[_0xa2cd('0x3c')],_0x542277[_0xa2cd('0x3d')]['start'],_0x542277[_0xa2cd('0x3d')][_0xa2cd('0x3e')]);}else{if(_0xb1b4c6[_0xa2cd('0x22')]===_0xa2cd('0x3f')){var _0x43d850=_0xb1b4c6['value']['split'](',')[_0xa2cd('0x40')](function(_0x3438a4){return Number(_0x3438a4);});var _0x4c920b=parseTagParameter(_0x43d850);_0x1a0b85['tags'][_0xa2cd('0x41')][_0xa2cd('0x42')](_0x4c920b);_0x1a0b85[_0xa2cd('0x43')][_0xa2cd('0x44')]=_0x43d850;}else if(_0xb1b4c6[_0xa2cd('0x22')]===_0xa2cd('0x45')){_0x1a0b85[_0xa2cd('0x46')][_0xa2cd('0x41')][_0xa2cd('0x42')]('uc.UserId\x20=\x20?',_0xb1b4c6[_0xa2cd('0x3d')]);_0x1a0b85[_0xa2cd('0x46')][_0xa2cd('0x47')]=!![];}}}return _0x1a0b85;}function parseModelFields(_0x5af85d,_0x4c84ca){var _0x303a94=squel['expr']();var _0x1c7eec=_(_0x5af85d)[_0xa2cd('0x48')]()[_0xa2cd('0x40')](function(_0x482d26){return _[_0xa2cd('0x49')](_0x4c84ca,['name',_0x482d26])?_0x482d26:undefined;})['compact']()[_0xa2cd('0x3d')]();if(_0x5af85d[_0xa2cd('0x4a')]){_0x1c7eec[_0xa2cd('0x20')](_0xa2cd('0x4a'));}if(_0x5af85d[_0xa2cd('0x45')]){_0x1c7eec[_0xa2cd('0x20')](_0xa2cd('0x45'));}if(_0x1c7eec[_0xa2cd('0x29')]>0x0){_0x1c7eec['forEach'](function(_0x28b7bc){if(_0x28b7bc===_0xa2cd('0x7')){_0x303a94[_0xa2cd('0x42')](_0xa2cd('0x4b'),[][_0xa2cd('0x4c')](_0x5af85d[_0x28b7bc]));}else if(_0x28b7bc==='Contact'){var _0x40a09a='%'+_0x5af85d[_0x28b7bc]+'%';_0x303a94['and'](_0xa2cd('0x4d'),_0x40a09a);}else if(_0x28b7bc===_0xa2cd('0x45')){_0x303a94['and'](_0xa2cd('0x4e'),_0x5af85d[_0x28b7bc]);}else{_0x303a94[_0xa2cd('0x42')]('c.'+_0x28b7bc+'\x20=\x20?',_0x5af85d[_0x28b7bc]);}});}return _0x303a94;}function parseQueryParameters(_0x31b926,_0x3f6292){var _0x1b50eb=getSqlClauses();return Promise[_0xa2cd('0x4f')]()[_0xa2cd('0x50')](function(){return parseModelFields(_0x31b926,_0x3f6292);})[_0xa2cd('0x50')](function(_0x4db58d){_0x1b50eb[_0xa2cd('0x51')][_0xa2cd('0x42')](_0x4db58d);return parseTagParameter(_0x31b926[_0xa2cd('0x52')]);})[_0xa2cd('0x50')](function(_0x423912){_0x1b50eb[_0xa2cd('0x43')][_0xa2cd('0x41')]['and'](_0x423912);return parseSearchFilter(_0x31b926['filter']);})[_0xa2cd('0x50')](function(_0x276de2){_0x1b50eb[_0xa2cd('0x53')]=_0x276de2;return _0x1b50eb;});}function checkListsRestrictions(_0x2ec058,_0xe33dae,_0x37a23d){var _0x49ac49=squel[_0xa2cd('0x24')]();return Promise[_0xa2cd('0x4f')]()['then'](function(){if(_0xe33dae['search']&&_0x2ec058['role']===_0xa2cd('0x54')&&!_0x37a23d){return _0x2ec058[_0xa2cd('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xa2cd('0x50')](function(_0x37c5ae){if(_0x37c5ae){if(_0x37c5ae[_0xa2cd('0x29')]===0x0){_0x49ac49['and'](_0xa2cd('0x56'));}else{_0x49ac49[_0xa2cd('0x42')](_0xa2cd('0x4b'),_['map'](_0x37c5ae,'id'));}}})[_0xa2cd('0x50')](function(){return _0x49ac49;});}function buildContactsQuery(_0x5e00ce,_0x585a39,_0x4c840a,_0x404b2e,_0x376b64,_0x2a6406){if(_0x585a39){_0x585a39=_0x4c840a[_0xa2cd('0x57')];}_0x5e00ce=addFieldsToQuery(_0x5e00ce,_0x585a39,_0x404b2e,_0x2a6406,!![]);var _0xd69798=squel[_0xa2cd('0xa')]();_0xd69798=addFieldsToQuery(_0xd69798,_0x585a39,_0x404b2e,_0x2a6406,![]);if(_0x404b2e||_0x2a6406){_0x5e00ce=applyJoinClauses(_0x5e00ce,!![]);_0x5e00ce[_0xa2cd('0x58')]('c.id');if(_0x4c840a[_0xa2cd('0x59')]){_0xd69798[_0xa2cd('0x59')](_0x4c840a['limit']);}if(_0x4c840a[_0xa2cd('0x5a')]){_0xd69798[_0xa2cd('0x5a')](_0x4c840a['offset']);}}else{_0xd69798=applyJoinClauses(_0xd69798,![]);_0xd69798[_0xa2cd('0x58')](_0xa2cd('0x5b'));if(_0x4c840a['limit']){_0x5e00ce[_0xa2cd('0x59')](_0x4c840a[_0xa2cd('0x59')]);}if(_0x4c840a[_0xa2cd('0x5a')]){_0x5e00ce[_0xa2cd('0x5a')](_0x4c840a['offset']);}}_0xd69798['having'](_0x376b64);if(_0x4c840a[_0xa2cd('0x5c')]){_0x4c840a[_0xa2cd('0x5c')][_0xa2cd('0x21')](function(_0x30a6fd){_0x5e00ce[_0xa2cd('0x5c')]('c.'+_0x30a6fd[0x0],_0x30a6fd[0x1]===_0xa2cd('0x5d')?![]:!![]);_0xd69798[_0xa2cd('0x5c')](_0xa2cd('0x5e')+_0x30a6fd[0x0],_0x30a6fd[0x1]===_0xa2cd('0x5d')?![]:!![]);});}_0xd69798[_0xa2cd('0xb')](_0x5e00ce,_0xa2cd('0x15'));return _0xd69798;}function getFilteredContacts(_0xde389b){var _0x3ad6cf=[];return db[_0xa2cd('0x3f')][_0xa2cd('0x5f')]({'attributes':['id',_0xa2cd('0x60'),_0xa2cd('0x61')],'raw':!![]})[_0xa2cd('0x50')](function(_0x56ed7c){_0x3ad6cf=_['keyBy'](_0x56ed7c,'id');var _0x40de8c={'type':db[_0xa2cd('0x62')][_0xa2cd('0x63')]['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa2cd('0x64')]['query'](_0xde389b[_0xa2cd('0x65')](),_0x40de8c);})[_0xa2cd('0x50')](function(_0x296194){_0x296194[_0xa2cd('0x21')](function(_0x406c26){if(_0x406c26['TagIds']){_0x406c26[_0xa2cd('0x66')]=[];_0x406c26[_0xa2cd('0x1f')][_0xa2cd('0x28')](',')[_0xa2cd('0x21')](function(_0x26a85f){_0x406c26[_0xa2cd('0x66')][_0xa2cd('0x20')](_0x3ad6cf[_0x26a85f]);});}delete _0x406c26['TagIds'];});return _0x296194;});}function countFilteredContacts(_0x3cc1f8,_0x3b6948){var _0x1e8bd6=_0x3cc1f8[_0xa2cd('0x67')]();_0x1e8bd6[_0xa2cd('0x22')]('COUNT(*)');_0x1e8bd6=applyJoinClauses(_0x1e8bd6,!![]);_0x3cc1f8[_0xa2cd('0x58')](_0xa2cd('0x68'));var _0x3e91f9=utils[_0xa2cd('0x25')](_0x3b6948);if(!_[_0xa2cd('0x69')](_0x3e91f9)){_0x1e8bd6[_0xa2cd('0xd')](_0xa2cd('0x6a'),_0x3e91f9);}var _0x13faac={'type':db[_0xa2cd('0x62')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xa2cd('0x64')][_0xa2cd('0x6b')](_0x1e8bd6['toString'](),_0x13faac)[_0xa2cd('0x50')](function(_0x5f0aa5){return _0x5f0aa5[0x0][_0xa2cd('0x6c')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 99ec630..c0c62ee 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 _0xc18a=['utf8','base64','final','createDecipher','update','crypto','bluebird','lodash','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','binary','write','end','close','unlink','decryptFile','encryptString','secret','createCipher'];(function(_0x4ef7b1,_0x882d97){var _0x173995=function(_0x563680){while(--_0x563680){_0x4ef7b1['push'](_0x4ef7b1['shift']());}};_0x173995(++_0x882d97);}(_0xc18a,0xf3));var _0xac18=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xc18a[_0x178668];return _0x26107d;};'use strict';var crypto=require(_0xac18('0x0'));var fs=require('fs');var BPromise=require(_0xac18('0x1'));var _=require(_0xac18('0x2'));var config=require(_0xac18('0x3'));var logger=require('../../config/logger')(_0xac18('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xac18('0x5')],'algorithm':_0xac18('0x6')};const fileOptions={'algorithm':_0xac18('0x7')};if(config['encrypt']&&config[_0xac18('0x8')][_0xac18('0x9')]){var isSupported=isAlgorithmSupported(config[_0xac18('0x8')][_0xac18('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0xac18('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xac18('0xa')](',\x20');logger['error'](config[_0xac18('0x8')][_0xac18('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x44a9bb){return AES_SUPPORTED_RX[_0xac18('0xb')](_0x44a9bb);}function getSupportedCiphers(){return crypto[_0xac18('0xc')]()[_0xac18('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x20eaf4){return getSupportedCiphers()[_0xac18('0xe')](_0x20eaf4)>-0x1;}function combineOptions(_0x542255){var _0xce172d={};for(var _0x393c91 in fileOptions){if(fileOptions[_0xac18('0xf')](_0x393c91)){_0xce172d[_0x393c91]=fileOptions[_0x393c91];}}if(_0x542255){for(var _0x28ed5b in _0x542255){if(_0x542255[_0xac18('0xf')](_0x28ed5b)){_0xce172d[_0x28ed5b]=_0x542255[_0x28ed5b];}}}return _0xce172d;}exports[_0xac18('0x10')]=function(_0x837f73,_0x2fb94f,_0x2bb63a,_0x41de2f){return new BPromise(function(_0xbb2262,_0x4f7db){_0x41de2f=combineOptions(_0x41de2f);var _0x23c8e1=new Buffer(_0x2bb63a);var _0x2eac66=fs[_0xac18('0x11')](_0x837f73);var _0xd258b=fs[_0xac18('0x12')](_0x2fb94f);var _0x4b9479=crypto['createCipher'](_0x41de2f[_0xac18('0x9')],_0x23c8e1);_0x2eac66['on'](_0xac18('0x13'),function(_0x363393){var _0xf84aff=new Buffer(_0x4b9479['update'](_0x363393),_0xac18('0x14'));_0xd258b[_0xac18('0x15')](_0xf84aff);});_0x2eac66['on'](_0xac18('0x16'),function(){try{var _0x1435a8=new Buffer(_0x4b9479['final'](_0xac18('0x14')),'binary');_0xd258b['write'](_0x1435a8);_0xd258b[_0xac18('0x16')]();_0xd258b['on'](_0xac18('0x17'),function(){return _0xbb2262(_0x2fb94f);});}catch(_0x335514){fs[_0xac18('0x18')](_0x2fb94f);return _0x4f7db(_0x335514);}});});};exports[_0xac18('0x19')]=function(_0x1001de,_0x3f93b8,_0xa4105c,_0x400ae3){return new BPromise(function(_0x1e216d,_0x5e99ce){_0x400ae3=combineOptions(_0x400ae3);var _0xf22de3=new Buffer(_0xa4105c);var _0x1ba11a=fs[_0xac18('0x11')](_0x1001de);var _0x17c529=fs['createWriteStream'](_0x3f93b8);var _0x393a28=crypto['createDecipher'](_0x400ae3['algorithm'],_0xf22de3);_0x1ba11a['on'](_0xac18('0x13'),function(_0x47a88d){var _0x3eaebd=new Buffer(_0x393a28['update'](_0x47a88d),_0xac18('0x14'));_0x17c529[_0xac18('0x15')](_0x3eaebd);});_0x1ba11a['on'](_0xac18('0x16'),function(){try{var _0x2a869d=new Buffer(_0x393a28['final'](_0xac18('0x14')),_0xac18('0x14'));_0x17c529[_0xac18('0x15')](_0x2a869d);_0x17c529[_0xac18('0x16')]();_0x17c529['on'](_0xac18('0x17'),function(){return _0x1e216d(_0x3f93b8);});}catch(_0x4b9076){fs[_0xac18('0x18')](_0x3f93b8);return _0x5e99ce(_0x4b9076);}});});};exports[_0xac18('0x1a')]=function(_0x5c3894,_0xdefe9f,_0x19665d){var _0x3ffcc5=_0x19665d||stringOptions['algorithm'];var _0x367e57=_0xdefe9f||stringOptions[_0xac18('0x1b')];var _0x197805=crypto[_0xac18('0x1c')](_0x3ffcc5,_0x367e57);var _0x2e19a7=_0x197805['update'](_0x5c3894,_0xac18('0x1d'),_0xac18('0x1e'));_0x2e19a7+=_0x197805[_0xac18('0x1f')](_0xac18('0x1e'));return _0x2e19a7;};exports['decryptString']=function(_0x22f18e,_0x4fc78a,_0x89cc18){var _0x5b59e8=_0x89cc18||stringOptions['algorithm'];var _0x16891e=_0x4fc78a||stringOptions[_0xac18('0x1b')];var _0x41b60c=crypto[_0xac18('0x20')](_0x5b59e8,_0x16891e);var _0x20191f=_0x41b60c[_0xac18('0x21')](_0x22f18e,_0xac18('0x1e'),_0xac18('0x1d'));_0x20191f+=_0x41b60c[_0xac18('0x1f')](_0xac18('0x1d'));return _0x20191f;}; \ No newline at end of file +var _0xd880=['update','binary','write','end','unlink','createReadStream','final','close','secret','utf8','base64','decryptString','createDecipher','bluebird','../../config/logger','app','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','createWriteStream','createCipher'];(function(_0x2772e4,_0x3fb448){var _0x1c9392=function(_0xfcb824){while(--_0xfcb824){_0x2772e4['push'](_0x2772e4['shift']());}};_0x1c9392(++_0x3fb448);}(_0xd880,0x1d8));var _0x0d88=function(_0x18514e,_0x244f61){_0x18514e=_0x18514e-0x0;var _0x4d6a95=_0xd880[_0x18514e];return _0x4d6a95;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0d88('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x0d88('0x1'))(_0x0d88('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x0d88('0x3')]&&config[_0x0d88('0x3')][_0x0d88('0x4')]){var isSupported=isAlgorithmSupported(config[_0x0d88('0x3')][_0x0d88('0x4')]);if(isSupported){fileOptions['algorithm']=config[_0x0d88('0x3')][_0x0d88('0x4')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0d88('0x5')](',\x20');logger[_0x0d88('0x6')](config[_0x0d88('0x3')][_0x0d88('0x4')],_0x0d88('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x41fde4){return AES_SUPPORTED_RX[_0x0d88('0x8')](_0x41fde4);}function getSupportedCiphers(){return crypto[_0x0d88('0x9')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x52bd1b){return getSupportedCiphers()[_0x0d88('0xa')](_0x52bd1b)>-0x1;}function combineOptions(_0x53b599){var _0x200f76={};for(var _0x5d11e0 in fileOptions){if(fileOptions[_0x0d88('0xb')](_0x5d11e0)){_0x200f76[_0x5d11e0]=fileOptions[_0x5d11e0];}}if(_0x53b599){for(var _0x2f1c0d in _0x53b599){if(_0x53b599[_0x0d88('0xb')](_0x2f1c0d)){_0x200f76[_0x2f1c0d]=_0x53b599[_0x2f1c0d];}}}return _0x200f76;}exports['encryptFile']=function(_0x537057,_0x5f5cba,_0x4ee15d,_0x55ae40){return new BPromise(function(_0x26cc8f,_0xb15ca5){_0x55ae40=combineOptions(_0x55ae40);var _0x2d351b=new Buffer(_0x4ee15d);var _0x235431=fs['createReadStream'](_0x537057);var _0x27ea23=fs[_0x0d88('0xc')](_0x5f5cba);var _0x36b453=crypto[_0x0d88('0xd')](_0x55ae40[_0x0d88('0x4')],_0x2d351b);_0x235431['on']('data',function(_0x37a8a4){var _0x56347f=new Buffer(_0x36b453[_0x0d88('0xe')](_0x37a8a4),_0x0d88('0xf'));_0x27ea23[_0x0d88('0x10')](_0x56347f);});_0x235431['on'](_0x0d88('0x11'),function(){try{var _0x405ad7=new Buffer(_0x36b453['final'](_0x0d88('0xf')),_0x0d88('0xf'));_0x27ea23[_0x0d88('0x10')](_0x405ad7);_0x27ea23[_0x0d88('0x11')]();_0x27ea23['on']('close',function(){return _0x26cc8f(_0x5f5cba);});}catch(_0x26dc11){fs[_0x0d88('0x12')](_0x5f5cba);return _0xb15ca5(_0x26dc11);}});});};exports['decryptFile']=function(_0xee02fd,_0x496caa,_0x454abe,_0x1ce40b){return new BPromise(function(_0x1ab033,_0xed96dd){_0x1ce40b=combineOptions(_0x1ce40b);var _0x2ebfae=new Buffer(_0x454abe);var _0x3d2d0b=fs[_0x0d88('0x13')](_0xee02fd);var _0x3e519d=fs['createWriteStream'](_0x496caa);var _0x5e3434=crypto['createDecipher'](_0x1ce40b['algorithm'],_0x2ebfae);_0x3d2d0b['on']('data',function(_0x14e70d){var _0x24c7e3=new Buffer(_0x5e3434['update'](_0x14e70d),_0x0d88('0xf'));_0x3e519d[_0x0d88('0x10')](_0x24c7e3);});_0x3d2d0b['on']('end',function(){try{var _0x13ab1c=new Buffer(_0x5e3434[_0x0d88('0x14')](_0x0d88('0xf')),_0x0d88('0xf'));_0x3e519d[_0x0d88('0x10')](_0x13ab1c);_0x3e519d[_0x0d88('0x11')]();_0x3e519d['on'](_0x0d88('0x15'),function(){return _0x1ab033(_0x496caa);});}catch(_0x15199f){fs[_0x0d88('0x12')](_0x496caa);return _0xed96dd(_0x15199f);}});});};exports['encryptString']=function(_0x588f28,_0x4f7929,_0x43e663){var _0x498fdf=_0x43e663||stringOptions[_0x0d88('0x4')];var _0x49222b=_0x4f7929||stringOptions[_0x0d88('0x16')];var _0x223e6a=crypto[_0x0d88('0xd')](_0x498fdf,_0x49222b);var _0x462258=_0x223e6a['update'](_0x588f28,_0x0d88('0x17'),_0x0d88('0x18'));_0x462258+=_0x223e6a[_0x0d88('0x14')](_0x0d88('0x18'));return _0x462258;};exports[_0x0d88('0x19')]=function(_0x4c6764,_0x2a521e,_0x32e15d){var _0x1e91d2=_0x32e15d||stringOptions[_0x0d88('0x4')];var _0x17557e=_0x2a521e||stringOptions[_0x0d88('0x16')];var _0x4fcfa0=crypto[_0x0d88('0x1a')](_0x1e91d2,_0x17557e);var _0x4a5c5d=_0x4fcfa0[_0x0d88('0xe')](_0x4c6764,'base64','utf8');_0x4a5c5d+=_0x4fcfa0[_0x0d88('0x14')](_0x0d88('0x17'));return _0x4a5c5d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5817678..e9d5fe4 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 _0x943c=['find','split','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','Completed','zip','catch','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','CSV','Setting'];(function(_0x219cc1,_0x3d03b5){var _0x177034=function(_0x45e0fe){while(--_0x45e0fe){_0x219cc1['push'](_0x219cc1['shift']());}};_0x177034(++_0x3d03b5);}(_0x943c,0x11a));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc943('0x0'));var path=require(_0xc943('0x1'));var _=require(_0xc943('0x2'));var csv=require(_0xc943('0x3'));var fs=require('fs');var BPromise=require(_0xc943('0x4'));var zipdir=require(_0xc943('0x5'));var rimraf=require(_0xc943('0x6'));var db=require(_0xc943('0x7'))['db'];var dbH=require(_0xc943('0x7'))[_0xc943('0x8')];var logger=require(_0xc943('0x9'))(_0xc943('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xc943('0xb')][0x2]);var QUERY=process[_0xc943('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x94edf,_0x35f745){var _0x1b771f={'status':_0x94edf};var _0x91850f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35f745){_0x1b771f['savename']=_0x35f745;}return db[_0xc943('0xc')][_0xc943('0xd')](_0x1b771f,_0x91850f);}function main(){var _0x1a618d=0x1388;var _0x241bad;logger[_0xc943('0xe')](util[_0xc943('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc943('0x10')));return db[_0xc943('0x11')][_0xc943('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc943('0x13'),'splitSizeCsv']})[_0xc943('0x14')](function(_0x4e30cf){if(_0x4e30cf){_0x241bad=_0x4e30cf;_0x1a618d=_0x241bad[_0xc943('0x15')]||0x1388;}})['then'](function(){return dbH[_0xc943('0x16')]['query'](util[_0xc943('0xf')](_0xc943('0x17'),QUERY),{'type':dbH[_0xc943('0x16')][_0xc943('0x18')][_0xc943('0x19')]});})[_0xc943('0x14')](function(_0xa26972){if(!_0xa26972[0x0][_0xc943('0x1a')]){return analyticExtractedReport(_0xc943('0x1b'));}var _0x3fa518=[];var _0x4e8e40=0x0;if(_0x241bad[_0xc943('0x13')]){if(_0xa26972&&_0xa26972[_0xc943('0x1c')]){var _0x2f1cca=_[_0xc943('0x1d')](_0xa26972[0x0][_0xc943('0x1a')]/_0x1a618d);var _0x1ac493=Number[_0xc943('0x1e')](_0xa26972[0x0][_0xc943('0x1a')]/_0x1a618d)?_0xa26972[0x0][_0xc943('0x1a')]%_0x1a618d:0x0;_0x2f1cca[_0xc943('0x1f')](function(_0x1d876a){if(_0x1d876a>0x0){_0x4e8e40+=_0x1a618d;}_0x3fa518[_0xc943('0x20')](dbH[_0xc943('0x16')][_0xc943('0x21')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1a618d,_0x4e8e40),{'type':dbH[_0xc943('0x16')]['QueryTypes'][_0xc943('0x19')]}));});if(_0x1ac493>0x0){_0x4e8e40+=_0x1a618d;_0x3fa518[_0xc943('0x20')](dbH[_0xc943('0x16')]['query'](util['format'](_0xc943('0x22'),QUERY,_0x1ac493,_0x4e8e40),{'type':dbH[_0xc943('0x16')]['QueryTypes'][_0xc943('0x19')]}));}}}else{_0x3fa518[_0xc943('0x20')](dbH[_0xc943('0x16')][_0xc943('0x21')](QUERY,{'type':dbH['sequelize'][_0xc943('0x18')][_0xc943('0x19')]}));}var _0x2e3a41=path[_0xc943('0x23')](PATH);var _0xca2c76=path[_0xc943('0x24')](PATH,_0xc943('0x25'));var _0x40e1cc=_0x241bad[_0xc943('0x13')]&&_0x3fa518[_0xc943('0x1c')]>0x1;var _0x16241a=[];if(!fs['existsSync'](path[_0xc943('0x26')](_0x2e3a41,_0xca2c76))&&_0x40e1cc){fs[_0xc943('0x27')](path['join'](_0x2e3a41,_0xca2c76));}return BPromise[_0xc943('0x28')](_0x3fa518,function(_0x143f39){_0x16241a[_0xc943('0x20')](_0x143f39);})[_0xc943('0x14')](function(){for(var _0x32b8b3=0x0;_0x32b8b3<_0x16241a[_0xc943('0x1c')];_0x32b8b3+=0x1){var _0x4c2f5b;var _0x3b91eb=_0x16241a[_0x32b8b3];if(_0x40e1cc){_0x4c2f5b=path[_0xc943('0x26')](_0x2e3a41,_0xca2c76,util['format'](_0xc943('0x29'),_0xca2c76,_0x32b8b3,_0xc943('0x2a')));}else{_0x4c2f5b=path['join'](_0x2e3a41,util[_0xc943('0xf')]('%s.%s',_0xca2c76,_0xc943('0x2a')));}fs[_0xc943('0x2b')](_0x4c2f5b,csv(_0x3b91eb));}})['then'](function(){if(_0x40e1cc){return new Promise(function(_0x1bf898){zipdir(path[_0xc943('0x26')](_0x2e3a41,_0xca2c76),{'saveTo':path[_0xc943('0x26')](_0x2e3a41,util[_0xc943('0xf')](_0xc943('0x2c'),_0xca2c76,'zip'))},function(_0xa0d97b,_0x10825a){rimraf(path[_0xc943('0x26')](_0x2e3a41,_0xca2c76),function(){});_0x1bf898('zip\x20finished');});});}})[_0xc943('0x14')](function(){logger[_0xc943('0xe')](util[_0xc943('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc943('0x10')));return analyticExtractedReport(_0xc943('0x2d'),_0x40e1cc?util[_0xc943('0xf')](_0xc943('0x2c'),_0xca2c76,_0x40e1cc?_0xc943('0x2e'):_0xc943('0x2a')):null);});})[_0xc943('0x2f')](function(_0x4aa09e){logger[_0xc943('0xe')](util[_0xc943('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc943('0x10')),util[_0xc943('0x30')](_0x4aa09e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc943('0x31'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfc5d=['QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','%s.%s','csv','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xfc5d,0xe7));var _0xdfc5=function(_0x14f5bd,_0x4803ca){_0x14f5bd=_0x14f5bd-0x0;var _0x433b96=_0xfc5d[_0x14f5bd];return _0x433b96;};'use strict';var util=require(_0xdfc5('0x0'));var path=require(_0xdfc5('0x1'));var _=require(_0xdfc5('0x2'));var csv=require(_0xdfc5('0x3'));var fs=require('fs');var BPromise=require(_0xdfc5('0x4'));var zipdir=require(_0xdfc5('0x5'));var rimraf=require(_0xdfc5('0x6'));var db=require(_0xdfc5('0x7'))['db'];var dbH=require('../../mysqldb')[_0xdfc5('0x8')];var logger=require(_0xdfc5('0x9'))(_0xdfc5('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdfc5('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a4596,_0x1cb3cd){var _0x4ecd3b={'status':_0x4a4596};var _0xdfc450={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1cb3cd){_0x4ecd3b[_0xdfc5('0xc')]=_0x1cb3cd;}return db[_0xdfc5('0xd')][_0xdfc5('0xe')](_0x4ecd3b,_0xdfc450);}function main(){var _0x30c68d=0x1388;var _0x1816ba;logger['info'](util['format'](_0xdfc5('0xf'),EXTRACTED_REPORT_ID,_0xdfc5('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdfc5('0x11'),_0xdfc5('0x12')]})[_0xdfc5('0x13')](function(_0x234400){if(_0x234400){_0x1816ba=_0x234400;_0x30c68d=_0x1816ba[_0xdfc5('0x12')]||0x1388;}})[_0xdfc5('0x13')](function(){return dbH[_0xdfc5('0x14')][_0xdfc5('0x15')](util[_0xdfc5('0x16')](_0xdfc5('0x17'),QUERY),{'type':dbH[_0xdfc5('0x14')][_0xdfc5('0x18')][_0xdfc5('0x19')]});})[_0xdfc5('0x13')](function(_0x1bd987){if(!_0x1bd987[0x0][_0xdfc5('0x1a')]){return analyticExtractedReport(_0xdfc5('0x1b'));}var _0x4c38d5=[];var _0x412e61=0x0;if(_0x1816ba[_0xdfc5('0x11')]){if(_0x1bd987&&_0x1bd987[_0xdfc5('0x1c')]){var _0x551232=_[_0xdfc5('0x1d')](_0x1bd987[0x0][_0xdfc5('0x1a')]/_0x30c68d);var _0x820258=Number[_0xdfc5('0x1e')](_0x1bd987[0x0]['num']/_0x30c68d)?_0x1bd987[0x0][_0xdfc5('0x1a')]%_0x30c68d:0x0;_0x551232[_0xdfc5('0x1f')](function(_0x255f21){if(_0x255f21>0x0){_0x412e61+=_0x30c68d;}_0x4c38d5[_0xdfc5('0x20')](dbH['sequelize'][_0xdfc5('0x15')](util['format'](_0xdfc5('0x21'),QUERY,_0x30c68d,_0x412e61),{'type':dbH['sequelize'][_0xdfc5('0x18')][_0xdfc5('0x19')]}));});if(_0x820258>0x0){_0x412e61+=_0x30c68d;_0x4c38d5[_0xdfc5('0x20')](dbH[_0xdfc5('0x14')][_0xdfc5('0x15')](util[_0xdfc5('0x16')](_0xdfc5('0x21'),QUERY,_0x820258,_0x412e61),{'type':dbH[_0xdfc5('0x14')][_0xdfc5('0x18')][_0xdfc5('0x19')]}));}}}else{_0x4c38d5[_0xdfc5('0x20')](dbH[_0xdfc5('0x14')][_0xdfc5('0x15')](QUERY,{'type':dbH[_0xdfc5('0x14')][_0xdfc5('0x18')][_0xdfc5('0x19')]}));}var _0x11d2cb=path[_0xdfc5('0x22')](PATH);var _0x5f578e=path['basename'](PATH,_0xdfc5('0x23'));var _0x5c9d80=_0x1816ba[_0xdfc5('0x11')]&&_0x4c38d5['length']>0x1;var _0x23ca77=[];if(!fs[_0xdfc5('0x24')](path['join'](_0x11d2cb,_0x5f578e))&&_0x5c9d80){fs[_0xdfc5('0x25')](path[_0xdfc5('0x26')](_0x11d2cb,_0x5f578e));}return BPromise['each'](_0x4c38d5,function(_0x3e96f0){_0x23ca77['push'](_0x3e96f0);})[_0xdfc5('0x13')](function(){for(var _0x5c2702=0x0;_0x5c2702<_0x23ca77[_0xdfc5('0x1c')];_0x5c2702+=0x1){var _0x1146c2;var _0x1d5879=_0x23ca77[_0x5c2702];if(_0x5c9d80){_0x1146c2=path[_0xdfc5('0x26')](_0x11d2cb,_0x5f578e,util[_0xdfc5('0x16')]('%s%d.%s',_0x5f578e,_0x5c2702,'csv'));}else{_0x1146c2=path['join'](_0x11d2cb,util[_0xdfc5('0x16')](_0xdfc5('0x27'),_0x5f578e,_0xdfc5('0x28')));}fs['writeFileSync'](_0x1146c2,csv(_0x1d5879));}})[_0xdfc5('0x13')](function(){if(_0x5c9d80){return new Promise(function(_0x2b804d){zipdir(path[_0xdfc5('0x26')](_0x11d2cb,_0x5f578e),{'saveTo':path[_0xdfc5('0x26')](_0x11d2cb,util['format'](_0xdfc5('0x27'),_0x5f578e,_0xdfc5('0x29')))},function(_0x147dd3,_0x448e2e){rimraf(path[_0xdfc5('0x26')](_0x11d2cb,_0x5f578e),function(){});_0x2b804d(_0xdfc5('0x2a'));});});}})[_0xdfc5('0x13')](function(){logger[_0xdfc5('0x2b')](util[_0xdfc5('0x16')](_0xdfc5('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x5c9d80?util['format'](_0xdfc5('0x27'),_0x5f578e,_0x5c9d80?_0xdfc5('0x29'):_0xdfc5('0x28')):null);});})[_0xdfc5('0x2d')](function(_0x31120b){logger[_0xdfc5('0x2b')](util[_0xdfc5('0x16')](_0xdfc5('0x2e'),EXTRACTED_REPORT_ID,_0xdfc5('0x10')),util[_0xdfc5('0x2f')](_0x31120b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdfc5('0x30'));})[_0xdfc5('0x31')](function(){process[_0xdfc5('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c78b8e9..8ddb772 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 _0xd6a4=['pdf','%s.%s','zip','PDF','Completed','info','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','lodash','util','path','pdfmake/src/printer','rimraf','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','pick','toString','value','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','pageBreak','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','Setting','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','split','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s'];(function(_0x315d32,_0x53bd01){var _0x2aa931=function(_0x561963){while(--_0x561963){_0x315d32['push'](_0x315d32['shift']());}};_0x2aa931(++_0x53bd01);}(_0xd6a4,0x178));var _0x4d6a=function(_0x2ce569,_0x2adab5){_0x2ce569=_0x2ce569-0x0;var _0x460e86=_0xd6a4[_0x2ce569];return _0x460e86;};'use strict';var _=require(_0x4d6a('0x0'));var fs=require('fs');var util=require(_0x4d6a('0x1'));var path=require(_0x4d6a('0x2'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4d6a('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x4d6a('0x4'));var JSDOM=require(_0x4d6a('0x5'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x4d6a('0x6'));var db=require(_0x4d6a('0x7'))['db'];var dbH=require(_0x4d6a('0x7'))[_0x4d6a('0x8')];var logger=require(_0x4d6a('0x9'))(_0x4d6a('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4d6a('0xb')][0x2]);var QUERY=process[_0x4d6a('0xb')][0x3];var PATH=process[_0x4d6a('0xb')][0x4];var NAME=process[_0x4d6a('0xb')][0x5];var FORMAT=_0x4d6a('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x31da9a,_0x4234f1){var _0x2fe7fa={'status':_0x31da9a};var _0x4402b2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4234f1){_0x2fe7fa[_0x4d6a('0xd')]=_0x4234f1;}return db[_0x4d6a('0xe')]['update'](_0x2fe7fa,_0x4402b2);}function getHeaders(_0x1d12e4){return _['map'](_0x1d12e4,function(_0x145948){return{'text':_0x145948,'style':_0x4d6a('0xf')};});}function getRows(_0x3be26f,_0x1ab04b){return _['map'](_0x1ab04b,function(_0x469d7e){return _(_0x469d7e)[_0x4d6a('0x10')](_0x3be26f)['map'](function(_0x52b0f9){return _0x52b0f9?_[_0x4d6a('0x11')](_0x52b0f9):'';})[_0x4d6a('0x12')]();});}function createTable(_0x58a8f1,_0x289564){var _0x921fa9={'widths':_['fill'](Array(_0x58a8f1['length']),0x91),'heights':function(_0xf89222){return _0xf89222===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x189973=getHeaders(_0x58a8f1);_0x921fa9[_0x4d6a('0x13')]['push'](_0x189973);var _0xc4de88=getRows(_0x58a8f1,_0x289564);_0x921fa9[_0x4d6a('0x13')]=_0x921fa9['body']['concat'](_0xc4de88);return _0x921fa9;}function createTables(_0x28cf52){var _0x315033=[];var _0x30a9d5=_[_0x4d6a('0x14')](Object[_0x4d6a('0x15')](_0x28cf52[0x0]),0x5);_0x30a9d5[_0x4d6a('0x16')](function(_0x23b55d){_0x315033[_0x4d6a('0x17')](createTable(_0x23b55d,_0x28cf52));});return _0x315033;}function getPDFDocDefinition(_0x488bc6){var _0x2f63db=util[_0x4d6a('0x18')](_0x4d6a('0x19'),NAME,EXTRACTED_REPORT[_0x4d6a('0x1a')],moment(EXTRACTED_REPORT[_0x4d6a('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x4d6a('0x18')](FORMAT));var _0x3f2a07=[];for(var _0x24c1d8=0x0;_0x24c1d8<_0x488bc6[_0x4d6a('0x1c')];_0x24c1d8++){var _0x1b6330=[];if(_0x24c1d8===0x0){_0x1b6330['push']({'text':_0x2f63db,'style':'header'});}var _0xeca18c={'table':_0x488bc6[_0x24c1d8]};if(_0x24c1d8>0x0){_0xeca18c[_0x4d6a('0x1d')]=_0x4d6a('0x1e');_0xeca18c[_0x4d6a('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1b6330[_0x4d6a('0x17')](_0xeca18c);_0x3f2a07['push'](_0x1b6330);}return{'pageSize':'A4','pageOrientation':_0x4d6a('0x20'),'content':_0x3f2a07,'footer':function(_0x1891c5,_0x40a6f3){return{'text':_0x1891c5['toString']()+_0x4d6a('0x21')+_0x40a6f3,'style':_0x4d6a('0x22')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4d6a('0x23')},'footer':{'alignment':_0x4d6a('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x394cb1){var _0x6319f1=0x1388;var _0x16b718;if(!_0x394cb1[0x0][_0x4d6a('0x25')]){return analyticExtractedReport(_0x4d6a('0x26'));}return db[_0x4d6a('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4d6a('0x28')]})['then'](function(_0x3cb290){if(_0x3cb290){_0x16b718=_0x3cb290;_0x6319f1=_0x16b718[_0x4d6a('0x28')]||0x3e8;}})[_0x4d6a('0x29')](function(){var _0xfb491e=[];var _0xbfe11a=0x0;if(_0x16b718['split']){if(_0x394cb1&&_0x394cb1['length']){var _0x9be740=_[_0x4d6a('0x2a')](_0x394cb1[0x0]['num']/_0x6319f1);var _0x4337fc=Number[_0x4d6a('0x2b')](_0x394cb1[0x0]['num']/_0x6319f1)?_0x394cb1[0x0][_0x4d6a('0x25')]%_0x6319f1:0x0;_0x9be740[_0x4d6a('0x16')](function(_0x6a8d72){if(_0x6a8d72>0x0){_0xbfe11a+=_0x6319f1;}_0xfb491e[_0x4d6a('0x17')](dbH[_0x4d6a('0x2c')][_0x4d6a('0x2d')](util[_0x4d6a('0x18')](_0x4d6a('0x2e'),QUERY,_0x6319f1,_0xbfe11a),{'type':dbH[_0x4d6a('0x2c')][_0x4d6a('0x2f')]['SELECT']}));});if(_0x4337fc>0x0){_0xbfe11a+=_0x6319f1;_0xfb491e[_0x4d6a('0x17')](dbH[_0x4d6a('0x2c')][_0x4d6a('0x2d')](util[_0x4d6a('0x18')](_0x4d6a('0x2e'),QUERY,_0x4337fc,_0xbfe11a),{'type':dbH[_0x4d6a('0x2c')]['QueryTypes'][_0x4d6a('0x30')]}));}}}else{_0xfb491e[_0x4d6a('0x17')](dbH[_0x4d6a('0x2c')][_0x4d6a('0x2d')](QUERY,{'type':dbH[_0x4d6a('0x2c')][_0x4d6a('0x2f')][_0x4d6a('0x30')]}));}var _0x7584c3=path[_0x4d6a('0x31')](PATH);var _0x67701f=path[_0x4d6a('0x32')](PATH,_0x4d6a('0x33'));var _0x39b62a=_0x16b718[_0x4d6a('0x34')]&&_0xfb491e[_0x4d6a('0x1c')]>0x1;var _0x55cc6a=[];if(!fs[_0x4d6a('0x35')](path[_0x4d6a('0x36')](_0x7584c3,_0x67701f))&&_0x39b62a){fs['mkdirSync'](path['join'](_0x7584c3,_0x67701f));}return BPromise[_0x4d6a('0x37')](_0xfb491e,function(_0x29839d){_0x55cc6a[_0x4d6a('0x17')](_0x29839d);})[_0x4d6a('0x29')](function(){var _0x2ea7e1=[];for(var _0x1026ae=0x0;_0x1026ae<_0x55cc6a['length'];_0x1026ae+=0x1){var _0x509d8b=_0x55cc6a[_0x1026ae];var _0x50c08a=createTables(_[_0x4d6a('0x38')](_0x509d8b));var _0x4bcbd9;var _0x552ded=getPDFDocDefinition(_0x50c08a);var _0x1f3980=getPDFPrinter();var _0x2de9b9=_0x1f3980[_0x4d6a('0x39')](_0x552ded);if(_0x39b62a){_0x4bcbd9=path[_0x4d6a('0x36')](_0x7584c3,_0x67701f,util[_0x4d6a('0x18')](_0x4d6a('0x3a'),_0x67701f,_0x1026ae,_0x4d6a('0x3b')));}else{_0x4bcbd9=path[_0x4d6a('0x36')](_0x7584c3,util[_0x4d6a('0x18')](_0x4d6a('0x3c'),_0x67701f,_0x4d6a('0x3b')));}_0x2ea7e1[_0x4d6a('0x17')](writePDFDocument(_0x2de9b9,_0x4bcbd9));}return Promise['all'](_0x2ea7e1);})['then'](function(){if(_0x39b62a){return new Promise(function(_0xf61f01){zipdir(path[_0x4d6a('0x36')](_0x7584c3,_0x67701f),{'saveTo':path[_0x4d6a('0x36')](_0x7584c3,util[_0x4d6a('0x18')]('%s.%s',_0x67701f,_0x4d6a('0x3d')))},function(){rimraf(path[_0x4d6a('0x36')](_0x7584c3,_0x67701f),function(){});_0xf61f01('zip\x20finished');});});}})['then'](function(){if(!_0x39b62a)return;rimraf(path[_0x4d6a('0x36')](_0x7584c3,_0x67701f),function(){});})[_0x4d6a('0x29')](function(){logger['info'](util[_0x4d6a('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4d6a('0x3e')));return analyticExtractedReport(_0x4d6a('0x3f'),_0x39b62a?util[_0x4d6a('0x18')]('%s.%s',_0x67701f,_0x39b62a?_0x4d6a('0x3d'):_0x4d6a('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4d6a('0x40')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x4d6a('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4d6a('0x29')](function(_0x2f33ab){EXTRACTED_REPORT=_0x2f33ab;return dbH[_0x4d6a('0x2c')][_0x4d6a('0x2d')](util[_0x4d6a('0x18')](_0x4d6a('0x41'),QUERY),{'type':dbH['sequelize'][_0x4d6a('0x2f')][_0x4d6a('0x30')]});})['then'](extractReport)[_0x4d6a('0x42')](function(_0x11ef97){logger[_0x4d6a('0x40')](util[_0x4d6a('0x18')](_0x4d6a('0x43'),EXTRACTED_REPORT_ID,'PDF'),util[_0x4d6a('0x44')](_0x11ef97,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4d6a('0x45')](function(){process[_0x4d6a('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3140c3=new PdfPrinter({'Arial':{'normal':__dirname+_0x4d6a('0x47'),'bold':__dirname+_0x4d6a('0x48'),'italics':__dirname+_0x4d6a('0x49'),'bolditalics':__dirname+_0x4d6a('0x4a')}});return _0x3140c3;}function getPDFDocDefinitionFromHTML(_0x15a5c3,_0x3fb755){var _0xb3d202=util[_0x4d6a('0x18')](_0x4d6a('0x4b'),_0x3fb755[_0x4d6a('0x4c')],_0x3fb755['interactionId']);var _0x403fb9=moment()[_0x4d6a('0x18')]('YYYY-MM-DD')[_0x4d6a('0x11')]();var _0x5007e4=htmlToPdfmake(_0x15a5c3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5007e4],'defaultStyle':{'font':_0x4d6a('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4d6a('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4d6a('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x4d6a('0x4f'),'style':_0x4d6a('0x50')}];},'footer':function(_0x821140,_0x4db33d){return[{'text':util[_0x4d6a('0x18')](_0x4d6a('0x51'),_0xb3d202,_0x821140,_0x4db33d,_0x403fb9),'style':'footer'}];}};}function writePDFDocument(_0x5278fe,_0x12f6ce){return new Promise(function(_0x96517,_0x190c67){var _0x3ce1d2=_0x5278fe[_0x4d6a('0x52')](fs[_0x4d6a('0x53')](_0x12f6ce));_0x3ce1d2['on']('finish',function(){_0x96517(_0x4d6a('0x54'));});_0x3ce1d2['on'](_0x4d6a('0x55'),function(_0x4b7a85){_0x190c67(_0x4b7a85);});_0x5278fe[_0x4d6a('0x56')]();});}exports['createPdfFromHTML']=function(_0x31bad2,_0x1a079b){var _0x385fdc=getPDFPrinter();var _0x36cb52=getPDFDocDefinitionFromHTML(_0x31bad2,_0x1a079b);var _0x484079=_0x385fdc[_0x4d6a('0x39')](_0x36cb52);return writePDFDocument(_0x484079,_0x1a079b['path'])['catch'](function(_0x48914e){throw _0x48914e;});}; \ No newline at end of file +var _0xb0b0=['dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','length','auto','body','concat','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','margin','landscape','\x20/\x20','footer','black','Empty','Setting','split','splitSizePdf','then','range','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','error','end','lodash','path','html-to-pdfmake','rimraf','jsdom','JSDOM','window','../../mysqldb'];(function(_0x10b0e9,_0x44ffc3){var _0x38e5df=function(_0x382290){while(--_0x382290){_0x10b0e9['push'](_0x10b0e9['shift']());}};_0x38e5df(++_0x44ffc3);}(_0xb0b0,0x144));var _0x0b0b=function(_0x2aae44,_0x478cf9){_0x2aae44=_0x2aae44-0x0;var _0x1a176d=_0xb0b0[_0x2aae44];return _0x1a176d;};'use strict';var _=require(_0x0b0b('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x0b0b('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x0b0b('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x0b0b('0x3'));var JSDOM=require(_0x0b0b('0x4'))[_0x0b0b('0x5')];var window=new JSDOM('')[_0x0b0b('0x6')];var BPromise=require('bluebird');var db=require(_0x0b0b('0x7'))['db'];var dbH=require('../../mysqldb')[_0x0b0b('0x8')];var logger=require(_0x0b0b('0x9'))(_0x0b0b('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x0b0b('0xb')][0x2]);var QUERY=process[_0x0b0b('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0b0b('0xb')][0x5];var FORMAT=_0x0b0b('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1c39a4,_0x2870a0){var _0x20eeb3={'status':_0x1c39a4};var _0x417552={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2870a0){_0x20eeb3[_0x0b0b('0xd')]=_0x2870a0;}return db[_0x0b0b('0xe')][_0x0b0b('0xf')](_0x20eeb3,_0x417552);}function getHeaders(_0x399ab8){return _[_0x0b0b('0x10')](_0x399ab8,function(_0x24885c){return{'text':_0x24885c,'style':'tableHeader'};});}function getRows(_0x2d89b5,_0x325994){return _[_0x0b0b('0x10')](_0x325994,function(_0x538801){return _(_0x538801)[_0x0b0b('0x11')](_0x2d89b5)[_0x0b0b('0x10')](function(_0x5c2eda){return _0x5c2eda?_[_0x0b0b('0x12')](_0x5c2eda):'';})[_0x0b0b('0x13')]();});}function createTable(_0x155ffa,_0x2cfcb8){var _0x28e9a0={'widths':_['fill'](Array(_0x155ffa[_0x0b0b('0x14')]),0x91),'heights':function(_0x25c6f7){return _0x25c6f7===0x0?_0x0b0b('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2a18b3=getHeaders(_0x155ffa);_0x28e9a0[_0x0b0b('0x16')]['push'](_0x2a18b3);var _0x4ad7ec=getRows(_0x155ffa,_0x2cfcb8);_0x28e9a0['body']=_0x28e9a0['body'][_0x0b0b('0x17')](_0x4ad7ec);return _0x28e9a0;}function createTables(_0x60bdc5){var _0x565c31=[];var _0x27a3ab=_['chunk'](Object['keys'](_0x60bdc5[0x0]),0x5);_0x27a3ab[_0x0b0b('0x18')](function(_0x301af7){_0x565c31[_0x0b0b('0x19')](createTable(_0x301af7,_0x60bdc5));});return _0x565c31;}function getPDFDocDefinition(_0x3fa70c){var _0x26e629=util[_0x0b0b('0x1a')](_0x0b0b('0x1b'),NAME,EXTRACTED_REPORT[_0x0b0b('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x0b0b('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x0b0b('0x1d')])['format'](FORMAT));var _0x2e7a69=[];for(var _0xb1d4a3=0x0;_0xb1d4a3<_0x3fa70c['length'];_0xb1d4a3++){var _0x4abc0e=[];if(_0xb1d4a3===0x0){_0x4abc0e['push']({'text':_0x26e629,'style':_0x0b0b('0x1e')});}var _0x44672c={'table':_0x3fa70c[_0xb1d4a3]};if(_0xb1d4a3>0x0){_0x44672c['pageBreak']='before';_0x44672c[_0x0b0b('0x1f')]=[0x0,0x46,0x0,0x0];}_0x4abc0e[_0x0b0b('0x19')](_0x44672c);_0x2e7a69[_0x0b0b('0x19')](_0x4abc0e);}return{'pageSize':'A4','pageOrientation':_0x0b0b('0x20'),'content':_0x2e7a69,'footer':function(_0x1471e1,_0x317da5){return{'text':_0x1471e1[_0x0b0b('0x12')]()+_0x0b0b('0x21')+_0x317da5,'style':_0x0b0b('0x22')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0b0b('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x7d5b5){var _0x1592a6=0x1388;var _0x1cffcb;if(!_0x7d5b5[0x0]['num']){return analyticExtractedReport(_0x0b0b('0x24'));}return db[_0x0b0b('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0b0b('0x26'),_0x0b0b('0x27')]})[_0x0b0b('0x28')](function(_0xc241e7){if(_0xc241e7){_0x1cffcb=_0xc241e7;_0x1592a6=_0x1cffcb['splitSizePdf']||0x3e8;}})[_0x0b0b('0x28')](function(){var _0x17a55e=[];var _0x43ee7f=0x0;if(_0x1cffcb[_0x0b0b('0x26')]){if(_0x7d5b5&&_0x7d5b5['length']){var _0x3c5262=_[_0x0b0b('0x29')](_0x7d5b5[0x0][_0x0b0b('0x2a')]/_0x1592a6);var _0x166a73=Number['isInteger'](_0x7d5b5[0x0][_0x0b0b('0x2a')]/_0x1592a6)?_0x7d5b5[0x0][_0x0b0b('0x2a')]%_0x1592a6:0x0;_0x3c5262[_0x0b0b('0x18')](function(_0x459ef1){if(_0x459ef1>0x0){_0x43ee7f+=_0x1592a6;}_0x17a55e[_0x0b0b('0x19')](dbH['sequelize'][_0x0b0b('0x2b')](util[_0x0b0b('0x1a')](_0x0b0b('0x2c'),QUERY,_0x1592a6,_0x43ee7f),{'type':dbH[_0x0b0b('0x2d')]['QueryTypes']['SELECT']}));});if(_0x166a73>0x0){_0x43ee7f+=_0x1592a6;_0x17a55e[_0x0b0b('0x19')](dbH[_0x0b0b('0x2d')][_0x0b0b('0x2b')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x166a73,_0x43ee7f),{'type':dbH[_0x0b0b('0x2d')][_0x0b0b('0x2e')][_0x0b0b('0x2f')]}));}}}else{_0x17a55e['push'](dbH[_0x0b0b('0x2d')][_0x0b0b('0x2b')](QUERY,{'type':dbH[_0x0b0b('0x2d')]['QueryTypes']['SELECT']}));}var _0x1fdaaa=path['dirname'](PATH);var _0x27d487=path[_0x0b0b('0x30')](PATH,_0x0b0b('0x31'));var _0x19ece1=_0x1cffcb[_0x0b0b('0x26')]&&_0x17a55e[_0x0b0b('0x14')]>0x1;var _0x46dfb5=[];if(!fs[_0x0b0b('0x32')](path[_0x0b0b('0x33')](_0x1fdaaa,_0x27d487))&&_0x19ece1){fs[_0x0b0b('0x34')](path['join'](_0x1fdaaa,_0x27d487));}return BPromise[_0x0b0b('0x35')](_0x17a55e,function(_0x52bf0f){_0x46dfb5[_0x0b0b('0x19')](_0x52bf0f);})[_0x0b0b('0x28')](function(){var _0x946a4c=[];for(var _0x15acf0=0x0;_0x15acf0<_0x46dfb5['length'];_0x15acf0+=0x1){var _0x55e443=_0x46dfb5[_0x15acf0];var _0x1027e6=createTables(_['flatten'](_0x55e443));var _0x3a418f;var _0x1bddf8=getPDFDocDefinition(_0x1027e6);var _0x38ae10=getPDFPrinter();var _0x1c8c9e=_0x38ae10[_0x0b0b('0x36')](_0x1bddf8);if(_0x19ece1){_0x3a418f=path[_0x0b0b('0x33')](_0x1fdaaa,_0x27d487,util[_0x0b0b('0x1a')](_0x0b0b('0x37'),_0x27d487,_0x15acf0,_0x0b0b('0x38')));}else{_0x3a418f=path[_0x0b0b('0x33')](_0x1fdaaa,util['format'](_0x0b0b('0x39'),_0x27d487,_0x0b0b('0x38')));}_0x946a4c['push'](writePDFDocument(_0x1c8c9e,_0x3a418f));}return Promise[_0x0b0b('0x3a')](_0x946a4c);})[_0x0b0b('0x28')](function(){if(_0x19ece1){return new Promise(function(_0x4ed1cf){zipdir(path['join'](_0x1fdaaa,_0x27d487),{'saveTo':path[_0x0b0b('0x33')](_0x1fdaaa,util[_0x0b0b('0x1a')](_0x0b0b('0x39'),_0x27d487,'zip'))},function(){rimraf(path[_0x0b0b('0x33')](_0x1fdaaa,_0x27d487),function(){});_0x4ed1cf('zip\x20finished');});});}})[_0x0b0b('0x28')](function(){if(!_0x19ece1)return;rimraf(path[_0x0b0b('0x33')](_0x1fdaaa,_0x27d487),function(){});})['then'](function(){logger[_0x0b0b('0x3b')](util[_0x0b0b('0x1a')](_0x0b0b('0x3c'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x0b0b('0x3d'),_0x19ece1?util['format'](_0x0b0b('0x39'),_0x27d487,_0x19ece1?'zip':_0x0b0b('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x0b0b('0x3b')](util[_0x0b0b('0x1a')](_0x0b0b('0x3e'),EXTRACTED_REPORT_ID,_0x0b0b('0x3f')));return db['AnalyticExtractedReport'][_0x0b0b('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x0b0b('0x28')](function(_0x5abe43){EXTRACTED_REPORT=_0x5abe43;return dbH[_0x0b0b('0x2d')]['query'](util[_0x0b0b('0x1a')](_0x0b0b('0x41'),QUERY),{'type':dbH[_0x0b0b('0x2d')][_0x0b0b('0x2e')][_0x0b0b('0x2f')]});})['then'](extractReport)[_0x0b0b('0x42')](function(_0x13441c){logger[_0x0b0b('0x3b')](util[_0x0b0b('0x1a')](_0x0b0b('0x43'),EXTRACTED_REPORT_ID,_0x0b0b('0x3f')),util[_0x0b0b('0x44')](_0x13441c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0b0b('0x45'));})[_0x0b0b('0x46')](function(){process[_0x0b0b('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x41ea97=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x0b0b('0x48')}});return _0x41ea97;}function getPDFDocDefinitionFromHTML(_0x3c3031,_0x519c41){var _0x485973=util[_0x0b0b('0x1a')](_0x0b0b('0x49'),_0x519c41['channel'],_0x519c41[_0x0b0b('0x4a')]);var _0x576940=moment()['format'](_0x0b0b('0x4b'))['toString']();var _0x126f6b=htmlToPdfmake(_0x3c3031,{'window':window,'tableAutoSize':!![]});return{'content':[_0x126f6b],'defaultStyle':{'font':_0x0b0b('0x4c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x0b0b('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x0b0b('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x0b0b('0x4d')}},'header':function(){return[{'text':_0x0b0b('0x4e'),'style':_0x0b0b('0x1e')}];},'footer':function(_0xc2e03b,_0xf61f9a){return[{'text':util[_0x0b0b('0x1a')](_0x0b0b('0x4f'),_0x485973,_0xc2e03b,_0xf61f9a,_0x576940),'style':'footer'}];}};}function writePDFDocument(_0xf61135,_0x24275d){return new Promise(function(_0x299e93,_0x29e919){var _0x52d3a9=_0xf61135[_0x0b0b('0x50')](fs['createWriteStream'](_0x24275d));_0x52d3a9['on']('finish',function(){_0x299e93('finish');});_0x52d3a9['on'](_0x0b0b('0x51'),function(_0x2986cc){_0x29e919(_0x2986cc);});_0xf61135[_0x0b0b('0x52')]();});}exports['createPdfFromHTML']=function(_0x206810,_0x586484){var _0x3bee01=getPDFPrinter();var _0x2e3fa1=getPDFDocDefinitionFromHTML(_0x206810,_0x586484);var _0x73dca7=_0x3bee01[_0x0b0b('0x36')](_0x2e3fa1);return writePDFDocument(_0x73dca7,_0x586484[_0x0b0b('0x1')])[_0x0b0b('0x42')](function(_0x4c0238){throw _0x4c0238;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fe7eb4e..aa6c296 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 _0xcefd=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','binary','zip','zip\x20finished','Completed','%s.%s','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info'];(function(_0xc5dd72,_0x28db52){var _0x2b12e6=function(_0x1848f1){while(--_0x1848f1){_0xc5dd72['push'](_0xc5dd72['shift']());}};_0x2b12e6(++_0x28db52);}(_0xcefd,0x1bd));var _0xdcef=function(_0x5e8940,_0x164e8){_0x5e8940=_0x5e8940-0x0;var _0x5d698c=_0xcefd[_0x5e8940];return _0x5d698c;};'use strict';var util=require('util');var path=require(_0xdcef('0x0'));var _=require(_0xdcef('0x1'));var fs=require('fs');var json2xls=require(_0xdcef('0x2'));var BPromise=require(_0xdcef('0x3'));var zipdir=require(_0xdcef('0x4'));var rimraf=require(_0xdcef('0x5'));var db=require(_0xdcef('0x6'))['db'];var dbH=require('../../mysqldb')[_0xdcef('0x7')];var logger=require(_0xdcef('0x8'))(_0xdcef('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xdcef('0xa')][0x2]);var QUERY=process[_0xdcef('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b9fec,_0x25dfd5){var _0x3dc2b0={'status':_0x3b9fec};var _0x11a5a6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25dfd5){_0x3dc2b0['savename']=_0x25dfd5;}return db[_0xdcef('0xb')][_0xdcef('0xc')](_0x3dc2b0,_0x11a5a6);}function main(){var _0x2b6b4c=0x1388;var _0x49e6ab;logger[_0xdcef('0xd')](util['format'](_0xdcef('0xe'),EXTRACTED_REPORT_ID,_0xdcef('0xf')));return db[_0xdcef('0x10')][_0xdcef('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdcef('0x12'),'splitSizeXlsx']})[_0xdcef('0x13')](function(_0x1f4bb2){if(_0x1f4bb2){_0x49e6ab=_0x1f4bb2;_0x2b6b4c=_0x49e6ab['splitSizeXlsx']||0x1388;}})[_0xdcef('0x13')](function(){return dbH['sequelize'][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x16'),QUERY),{'type':dbH[_0xdcef('0x17')]['QueryTypes'][_0xdcef('0x18')]});})[_0xdcef('0x13')](function(_0x518d03){if(!_0x518d03[0x0][_0xdcef('0x19')]){return analyticExtractedReport(_0xdcef('0x1a'));}var _0x20d127=[];var _0x55784f=0x0;if(_0x49e6ab['split']){if(_0x518d03&&_0x518d03[_0xdcef('0x1b')]){var _0x3ef0a0=_[_0xdcef('0x1c')](_0x518d03[0x0]['num']/_0x2b6b4c);var _0x1a79f8=Number[_0xdcef('0x1d')](_0x518d03[0x0][_0xdcef('0x19')]/_0x2b6b4c)?_0x518d03[0x0]['num']%_0x2b6b4c:0x0;_0x3ef0a0[_0xdcef('0x1e')](function(_0x5eaa3c){if(_0x5eaa3c>0x0){_0x55784f+=_0x2b6b4c;}_0x20d127[_0xdcef('0x1f')](dbH[_0xdcef('0x17')][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x20'),QUERY,_0x2b6b4c,_0x55784f),{'type':dbH[_0xdcef('0x17')][_0xdcef('0x21')][_0xdcef('0x18')]}));});if(_0x1a79f8>0x0){_0x55784f+=_0x2b6b4c;_0x20d127[_0xdcef('0x1f')](dbH['sequelize'][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x20'),QUERY,_0x1a79f8,_0x55784f),{'type':dbH[_0xdcef('0x17')]['QueryTypes'][_0xdcef('0x18')]}));}}}else{_0x20d127[_0xdcef('0x1f')](dbH['sequelize'][_0xdcef('0x14')](QUERY,{'type':dbH[_0xdcef('0x17')][_0xdcef('0x21')][_0xdcef('0x18')]}));}var _0x482dcd=path[_0xdcef('0x22')](PATH);var _0x4dc915=path['basename'](PATH,_0xdcef('0x23'));var _0x84beb3=_0x49e6ab[_0xdcef('0x12')]&&_0x20d127[_0xdcef('0x1b')]>0x1;var _0x27b6bb=[];if(!fs[_0xdcef('0x24')](path[_0xdcef('0x25')](_0x482dcd,_0x4dc915))&&_0x84beb3){fs[_0xdcef('0x26')](path[_0xdcef('0x25')](_0x482dcd,_0x4dc915));}return BPromise[_0xdcef('0x27')](_0x20d127,function(_0x5399f4){_0x27b6bb[_0xdcef('0x1f')](_0x5399f4);})['then'](function(){for(var _0xc8693c=0x0;_0xc8693c<_0x27b6bb['length'];_0xc8693c+=0x1){var _0x3dfcc8;var _0x565a31=_0x27b6bb[_0xc8693c];if(_0x84beb3){_0x3dfcc8=path['join'](_0x482dcd,_0x4dc915,util[_0xdcef('0x15')](_0xdcef('0x28'),_0x4dc915,_0xc8693c,_0xdcef('0x29')));}else{_0x3dfcc8=path[_0xdcef('0x25')](_0x482dcd,util[_0xdcef('0x15')]('%s.%s',_0x4dc915,'xlsx'));}fs['writeFileSync'](_0x3dfcc8,json2xls(_0x565a31),_0xdcef('0x2a'));}})[_0xdcef('0x13')](function(){if(_0x84beb3){return new Promise(function(_0x2a58f3){zipdir(path[_0xdcef('0x25')](_0x482dcd,_0x4dc915),{'saveTo':path[_0xdcef('0x25')](_0x482dcd,util[_0xdcef('0x15')]('%s.%s',_0x4dc915,_0xdcef('0x2b')))},function(_0x40ec8f,_0x33672c){rimraf(path['join'](_0x482dcd,_0x4dc915),function(){});_0x2a58f3(_0xdcef('0x2c'));});});}})[_0xdcef('0x13')](function(){logger['info'](util[_0xdcef('0x15')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdcef('0xf')));return analyticExtractedReport(_0xdcef('0x2d'),_0x84beb3?util[_0xdcef('0x15')](_0xdcef('0x2e'),_0x4dc915,_0x84beb3?_0xdcef('0x2b'):'xlsx'):null);});})['catch'](function(_0x51d1aa){logger[_0xdcef('0xd')](util[_0xdcef('0x15')](_0xdcef('0x2f'),EXTRACTED_REPORT_ID,_0xdcef('0xf')),util['inspect'](_0x51d1aa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdcef('0x30'));})[_0xdcef('0x31')](function(){process[_0xdcef('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x49ce=['XLSX','split','splitSizeXlsx','then','sequelize','QueryTypes','SELECT','num','Empty','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','mkdirSync','join','each','length','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','finally','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x34b6fc,_0xcc72ea){var _0x38225e=function(_0x583554){while(--_0x583554){_0x34b6fc['push'](_0x34b6fc['shift']());}};_0x38225e(++_0xcc72ea);}(_0x49ce,0x116));var _0xe49c=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0x49ce[_0x4232d8];return _0x324de2;};'use strict';var util=require('util');var path=require(_0xe49c('0x0'));var _=require(_0xe49c('0x1'));var fs=require('fs');var json2xls=require(_0xe49c('0x2'));var BPromise=require(_0xe49c('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xe49c('0x4'));var db=require(_0xe49c('0x5'))['db'];var dbH=require(_0xe49c('0x5'))[_0xe49c('0x6')];var logger=require(_0xe49c('0x7'))(_0xe49c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe49c('0x9')][0x2]);var QUERY=process[_0xe49c('0x9')][0x3];var PATH=process[_0xe49c('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x554e7e,_0x189e74){var _0x40f138={'status':_0x554e7e};var _0x5dd01d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x189e74){_0x40f138[_0xe49c('0xa')]=_0x189e74;}return db[_0xe49c('0xb')][_0xe49c('0xc')](_0x40f138,_0x5dd01d);}function main(){var _0x538956=0x1388;var _0x4179d9;logger[_0xe49c('0xd')](util[_0xe49c('0xe')](_0xe49c('0xf'),EXTRACTED_REPORT_ID,_0xe49c('0x10')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe49c('0x11'),_0xe49c('0x12')]})[_0xe49c('0x13')](function(_0x51b5f6){if(_0x51b5f6){_0x4179d9=_0x51b5f6;_0x538956=_0x4179d9[_0xe49c('0x12')]||0x1388;}})[_0xe49c('0x13')](function(){return dbH[_0xe49c('0x14')]['query'](util[_0xe49c('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xe49c('0x15')][_0xe49c('0x16')]});})[_0xe49c('0x13')](function(_0x560f0f){if(!_0x560f0f[0x0][_0xe49c('0x17')]){return analyticExtractedReport(_0xe49c('0x18'));}var _0x1ff8c3=[];var _0x11ac93=0x0;if(_0x4179d9[_0xe49c('0x11')]){if(_0x560f0f&&_0x560f0f['length']){var _0xf8d115=_['range'](_0x560f0f[0x0][_0xe49c('0x17')]/_0x538956);var _0x480581=Number[_0xe49c('0x19')](_0x560f0f[0x0][_0xe49c('0x17')]/_0x538956)?_0x560f0f[0x0][_0xe49c('0x17')]%_0x538956:0x0;_0xf8d115[_0xe49c('0x1a')](function(_0xfc8add){if(_0xfc8add>0x0){_0x11ac93+=_0x538956;}_0x1ff8c3[_0xe49c('0x1b')](dbH['sequelize'][_0xe49c('0x1c')](util[_0xe49c('0xe')](_0xe49c('0x1d'),QUERY,_0x538956,_0x11ac93),{'type':dbH['sequelize'][_0xe49c('0x15')][_0xe49c('0x16')]}));});if(_0x480581>0x0){_0x11ac93+=_0x538956;_0x1ff8c3['push'](dbH[_0xe49c('0x14')][_0xe49c('0x1c')](util[_0xe49c('0xe')](_0xe49c('0x1d'),QUERY,_0x480581,_0x11ac93),{'type':dbH['sequelize'][_0xe49c('0x15')][_0xe49c('0x16')]}));}}}else{_0x1ff8c3[_0xe49c('0x1b')](dbH['sequelize'][_0xe49c('0x1c')](QUERY,{'type':dbH[_0xe49c('0x14')][_0xe49c('0x15')][_0xe49c('0x16')]}));}var _0x1a51a7=path[_0xe49c('0x1e')](PATH);var _0xf197c1=path[_0xe49c('0x1f')](PATH,'.xlsx');var _0xe62ad2=_0x4179d9[_0xe49c('0x11')]&&_0x1ff8c3['length']>0x1;var _0x257bce=[];if(!fs[_0xe49c('0x20')](path['join'](_0x1a51a7,_0xf197c1))&&_0xe62ad2){fs[_0xe49c('0x21')](path[_0xe49c('0x22')](_0x1a51a7,_0xf197c1));}return BPromise[_0xe49c('0x23')](_0x1ff8c3,function(_0x25811d){_0x257bce[_0xe49c('0x1b')](_0x25811d);})[_0xe49c('0x13')](function(){for(var _0x43e0ff=0x0;_0x43e0ff<_0x257bce[_0xe49c('0x24')];_0x43e0ff+=0x1){var _0x1e01ed;var _0x1fa6a8=_0x257bce[_0x43e0ff];if(_0xe62ad2){_0x1e01ed=path['join'](_0x1a51a7,_0xf197c1,util[_0xe49c('0xe')]('%s%d.%s',_0xf197c1,_0x43e0ff,_0xe49c('0x25')));}else{_0x1e01ed=path[_0xe49c('0x22')](_0x1a51a7,util[_0xe49c('0xe')](_0xe49c('0x26'),_0xf197c1,_0xe49c('0x25')));}fs[_0xe49c('0x27')](_0x1e01ed,json2xls(_0x1fa6a8),_0xe49c('0x28'));}})['then'](function(){if(_0xe62ad2){return new Promise(function(_0x448d46){zipdir(path[_0xe49c('0x22')](_0x1a51a7,_0xf197c1),{'saveTo':path[_0xe49c('0x22')](_0x1a51a7,util[_0xe49c('0xe')](_0xe49c('0x26'),_0xf197c1,_0xe49c('0x29')))},function(_0x5187fd,_0x44f405){rimraf(path[_0xe49c('0x22')](_0x1a51a7,_0xf197c1),function(){});_0x448d46(_0xe49c('0x2a'));});});}})[_0xe49c('0x13')](function(){logger[_0xe49c('0xd')](util['format'](_0xe49c('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xe49c('0x2c'),_0xe62ad2?util[_0xe49c('0xe')]('%s.%s',_0xf197c1,_0xe62ad2?_0xe49c('0x29'):'xlsx'):null);});})[_0xe49c('0x2d')](function(_0x5af662){logger[_0xe49c('0xd')](util[_0xe49c('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe49c('0x10')),util[_0xe49c('0x2e')](_0x5af662,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe49c('0x2f')](function(){process[_0xe49c('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 82551ba..09bd774 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 _0x24fd=['Interval','intervals','VoiceExtension','findAll','IntervalId','then','map','exten','filter','groupBy','hasOwnProperty','extensions','extension','find','type','Set','format','context','priority','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','models'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24fd,0x184));var _0xd24f=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x24fd[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xd24f('0x0'));var util=require('util');function rewrite(_0x3cf31,_0x25974d){var _0x33ad5d=this;return _0x3cf31[_0xd24f('0x1')][_0xd24f('0x2')]['findAll']({'raw':!![]})['then'](function(_0x8be633){_0x33ad5d[_0xd24f('0x3')]=_0x8be633;return _0x3cf31['models'][_0xd24f('0x4')][_0xd24f('0x5')]({'where':{'IntervalId':_0x25974d[_0xd24f('0x6')]},'raw':!![]});})[_0xd24f('0x7')](function(_0x24606c){return _0x3cf31[_0xd24f('0x1')]['VoiceExtension'][_0xd24f('0x5')]({'where':{'exten':{'$in':_['uniq'](_[_0xd24f('0x8')](_0x24606c,_0xd24f('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x5954de){var _0xe489e6=_[_0xd24f('0xa')](_0x5954de,{'priority':'1'});var _0x1944b1=_[_0xd24f('0xa')](_0x5954de,{'isApp':0x1});var _0x56d722=_[_0xd24f('0xb')](_0x1944b1,'exten');var _0xcc2e28=['queue','playback'];var _0x2fdda8=[];var _0x41725a=[];for(var _0x187515 in _0x56d722){if(_0x56d722[_0xd24f('0xc')](_0x187515)){_0x33ad5d['priority']=0x2;_0x33ad5d[_0xd24f('0xd')]=[];_0x33ad5d[_0xd24f('0xe')]=_[_0xd24f('0xf')](_0xe489e6,{'exten':_0x56d722[_0x187515][0x0]['exten']});_0x33ad5d[_0xd24f('0xd')]['push']({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':util[_0xd24f('0x12')]('CDR(type)=%s',_0x56d722[_0x187515][0x0][_0xd24f('0x10')]),'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0]['exten'],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});if(_0x56d722[_0x187515][0x0]['type']===_0xd24f('0x16')){_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':'Set','appdata':_0xd24f('0x18')+_0x56d722[_0x187515][0x0][_0xd24f('0x15')],'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});}else if(_0x56d722[_0x187515][0x0]['type']===_0xd24f('0x19')){if(_0x33ad5d[_0xd24f('0xe')]){_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':'Set','appdata':'CDR(destination)='+(_0x33ad5d[_0xd24f('0xe')][_0xd24f('0x1a')]?_0xd24f('0x1b')+_0x33ad5d[_0xd24f('0xe')][_0xd24f('0x1a')]+'}':_0xd24f('0x1c')),'context':_0x56d722[_0x187515][0x0]['context'],'exten':_0x56d722[_0x187515][0x0]['exten'],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0]['VoiceExtensionId']});}_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':'Set','appdata':_0xd24f('0x18')+_0x56d722[_0x187515][0x0][_0xd24f('0x15')],'context':_0x56d722[_0x187515][0x0]['context'],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0]['VoiceExtensionId']});var _0x3579a6=_0x33ad5d[_0xd24f('0x14')]++;_0x33ad5d[_0xd24f('0xd')]['push']({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3579a6+0x2)+_0xd24f('0x1e')+(_0x3579a6+0x1)+')','context':_0x56d722[_0x187515][0x0]['context'],'exten':_0x56d722[_0x187515][0x0]['exten'],'priority':_0x3579a6,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});if(_0x33ad5d[_0xd24f('0xe')]){_0x33ad5d['extensions']['push']({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0x33ad5d['extension'][_0xd24f('0x1a')]?_0xd24f('0x1f')+_0x33ad5d[_0xd24f('0xe')][_0xd24f('0x1a')]+'}':_0xd24f('0x20'),'context':_0x56d722[_0x187515][0x0]['context'],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});}_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x21')+_0x56d722[_0x187515][0x0][_0xd24f('0x15')],'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0]['exten'],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});if(_0x33ad5d[_0xd24f('0xe')]&&_0x33ad5d['extension'][_0xd24f('0xc')](_0xd24f('0x22'))&&_0x33ad5d['extension'][_0xd24f('0x22')]!==_0xd24f('0x23')){_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0]['type'],'app':_0xd24f('0x11'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x56d722[_0x187515][0x0]['context'],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});_0x33ad5d['extensions'][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x24')+_0x33ad5d['extension'][_0xd24f('0x22')]||_0xd24f('0x25'),'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0]['exten'],'priority':_0x33ad5d['priority']++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});}}_0x33ad5d['extensions'][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0]['type'],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x26'),'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0]['VoiceExtensionId']});_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x27'),'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d['priority']++,'VoiceExtensionId':_0x56d722[_0x187515][0x0]['VoiceExtensionId']});_0x33ad5d['extensions']['push']({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x28'),'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'priority':_0x33ad5d[_0xd24f('0x14')]++,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});for(var _0x26dedd=0x0,_0x124118=0x0;_0x26dedd<_0x56d722[_0x187515]['length'];_0x26dedd+=0x1,_0x124118=0x0){var _0x44b78e=_0x56d722[_0x187515][_0x26dedd];if(_0x44b78e[_0xd24f('0x10')]){_0x44b78e[_0xd24f('0x10')]=_0x44b78e['type'][_0xd24f('0x29')]();}var _0x25854f=[];var _0x3e86f3=[];delete _0x44b78e['id'];delete _0x44b78e[_0xd24f('0x2a')];delete _0x44b78e['updatedAt'];var _0x2a53e5=_0x44b78e[_0xd24f('0x2b')]!==_0xd24f('0x2c')?[_0x44b78e[_0xd24f('0x2b')]]:_0x44b78e['IntervalId']?_[_0xd24f('0x8')](_['filter'](_0x33ad5d[_0xd24f('0x3')],{'IntervalId':_0x44b78e['IntervalId']}),_0xd24f('0x2b')):[];if(_0x44b78e[_0xd24f('0xc')](_0xd24f('0x2d'))){if(_0x44b78e[_0xd24f('0x2d')]&&_0x44b78e['tag']!=='--'){_0x25854f['push']({'type':_0x44b78e[_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x2e')+_0x44b78e[_0xd24f('0x2d')],'context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e[_0xd24f('0x9')],'priority':_0x2a53e5[_0xd24f('0x2f')]+_0x33ad5d['priority']+_0x124118++,'VoiceExtensionId':_0x44b78e[_0xd24f('0x15')]});}}if(_0x44b78e[_0xd24f('0x10')]===_0xd24f('0x19')&&_0x44b78e[_0xd24f('0xc')]('callerID')){if(_0x44b78e['callerID']){_0x25854f[_0xd24f('0x17')]({'type':_0x44b78e['type'],'app':_0xd24f('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x44b78e['callerID']+')','context':_0x44b78e['context'],'exten':_0x44b78e[_0xd24f('0x9')],'priority':_0x2a53e5[_0xd24f('0x2f')]+_0x33ad5d['priority']+_0x124118++,'VoiceExtensionId':_0x44b78e['VoiceExtensionId']});}else{_0x25854f[_0xd24f('0x17')]({'type':_0x44b78e['type'],'app':_0xd24f('0x1d'),'appdata':_0xd24f('0x30'),'context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e[_0xd24f('0x9')],'priority':_0x2a53e5['length']+_0x33ad5d['priority']+_0x124118++,'VoiceExtensionId':_0x44b78e[_0xd24f('0x15')]});}}if(_0x44b78e[_0xd24f('0xc')](_0xd24f('0x31'))){if(_0xcc2e28[_0xd24f('0x32')](_0x44b78e[_0xd24f('0x33')]['toLowerCase']())>=0x0&&_0x44b78e[_0xd24f('0x34')]!=='custom'){if(_0x44b78e[_0xd24f('0x31')]){_0x25854f['push']({'type':_0x44b78e[_0xd24f('0x10')],'app':_0xd24f('0x1d'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e['exten'],'priority':_0x2a53e5[_0xd24f('0x2f')]+_0x33ad5d[_0xd24f('0x14')]+_0x124118++,'VoiceExtensionId':_0x44b78e[_0xd24f('0x15')]});_0x25854f['push']({'type':_0x44b78e[_0xd24f('0x10')],'app':_0xd24f('0x11'),'appdata':_0xd24f('0x35'),'context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e[_0xd24f('0x9')],'priority':_0x2a53e5['length']+_0x33ad5d['priority']+_0x124118++,'VoiceExtensionId':_0x44b78e[_0xd24f('0x15')]});}else{_0x25854f[_0xd24f('0x17')]({'type':_0x44b78e[_0xd24f('0x10')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e[_0xd24f('0x9')],'priority':_0x2a53e5['length']+_0x33ad5d[_0xd24f('0x14')]+_0x124118++,'VoiceExtensionId':_0x44b78e[_0xd24f('0x15')]});_0x25854f[_0xd24f('0x17')]({'type':_0x44b78e['type'],'app':_0xd24f('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x44b78e[_0xd24f('0x13')],'exten':_0x44b78e['exten'],'priority':_0x2a53e5[_0xd24f('0x2f')]+_0x33ad5d[_0xd24f('0x14')]+_0x124118++,'VoiceExtensionId':_0x44b78e['VoiceExtensionId']});}}}for(var _0xa6db94=0x0;_0xa6db94<_0x2a53e5['length'];_0xa6db94+=0x1){var _0x3d7d84=_0x33ad5d[_0xd24f('0x14')]+_0x2a53e5['length'];var _0x4bd679=_0xa6db94===_0x2a53e5[_0xd24f('0x2f')]-0x1?_0x33ad5d[_0xd24f('0x14')]+_0x25854f[_0xd24f('0x2f')]+_0x3e86f3[_0xd24f('0x2f')]+0x2:_0x33ad5d['priority']+_0xa6db94+0x1;_0x25854f[_0xd24f('0x36')](_0xa6db94,0x0,{'type':_0x44b78e[_0xd24f('0x10')],'app':'GotoIfTime','appdata':_0x2a53e5[_0xa6db94]+'?'+_0x44b78e['context']+_0xd24f('0x37')+_0x3d7d84+':'+_0x44b78e[_0xd24f('0x13')]+_0xd24f('0x37')+_0x4bd679,'exten':_0x44b78e[_0xd24f('0x9')],'context':_0x44b78e[_0xd24f('0x13')],'priority':_0x33ad5d['priority']+_0xa6db94,'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});}_0x44b78e[_0xd24f('0x14')]=_0x25854f[_0xd24f('0x2f')]?_[_0xd24f('0x38')](_0x25854f)['priority']+0x1:_0x33ad5d[_0xd24f('0x14')];_0x33ad5d['priority']=(_0x3e86f3['length']?_[_0xd24f('0x38')](_0x3e86f3)[_0xd24f('0x14')]:_0x44b78e['priority'])+0x1;_0x33ad5d[_0xd24f('0xd')]=_[_0xd24f('0x39')](_0x33ad5d[_0xd24f('0xd')],_0x25854f,[_0x44b78e],_0x3e86f3);}_0x33ad5d[_0xd24f('0xd')][_0xd24f('0x17')]({'type':_0x56d722[_0x187515][0x0][_0xd24f('0x10')],'app':_0xd24f('0x3a'),'exten':_0x56d722[_0x187515][0x0][_0xd24f('0x9')],'context':_0x56d722[_0x187515][0x0][_0xd24f('0x13')],'priority':_0x33ad5d['priority'],'VoiceExtensionId':_0x56d722[_0x187515][0x0][_0xd24f('0x15')]});_0x2fdda8['push'](_0x56d722[_0x187515][0x0][_0xd24f('0x15')]);_0x41725a=_[_0xd24f('0x39')](_0x41725a,_0x33ad5d[_0xd24f('0xd')]);}}return _0x3cf31[_0xd24f('0x3b')](function(_0x1685f4){return _0x3cf31[_0xd24f('0x1')][_0xd24f('0x4')][_0xd24f('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x2fdda8}},'transaction':_0x1685f4})[_0xd24f('0x7')](function(_0x153f68){return _0x3cf31[_0xd24f('0x1')][_0xd24f('0x4')][_0xd24f('0x3d')](_[_0xd24f('0x3e')](_0x41725a,_0xd24f('0x14')),{'transaction':_0x1685f4});});});})['catch'](function(_0x331834){console[_0xd24f('0x3f')](_0x331834);});}exports[_0xd24f('0x40')]=rewrite; \ No newline at end of file +var _0xb0a1=['_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','bulkCreate','sortBy','catch','error','models','intervals','IntervalId','then','VoiceExtension','findAll','uniq','map','exten','filter','queue','playback','hasOwnProperty','extensions','extension','find','push','Set','context','priority','VoiceExtensionId','inbound','type','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat'];(function(_0x1f82e8,_0x1fb92f){var _0x522a64=function(_0x109071){while(--_0x109071){_0x1f82e8['push'](_0x1f82e8['shift']());}};_0x522a64(++_0x1fb92f);}(_0xb0a1,0x9b));var _0x1b0a=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xb0a1[_0x211fef];return _0x5447bf;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0xd8da09,_0x535628){var _0x2aa980=this;return _0xd8da09[_0x1b0a('0x0')]['Interval']['findAll']({'raw':!![]})['then'](function(_0x4ab17c){_0x2aa980[_0x1b0a('0x1')]=_0x4ab17c;return _0xd8da09[_0x1b0a('0x0')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x535628[_0x1b0a('0x2')]},'raw':!![]});})[_0x1b0a('0x3')](function(_0x3346ee){return _0xd8da09[_0x1b0a('0x0')][_0x1b0a('0x4')][_0x1b0a('0x5')]({'where':{'exten':{'$in':_[_0x1b0a('0x6')](_[_0x1b0a('0x7')](_0x3346ee,_0x1b0a('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x1b0a('0x3')](function(_0x35ea03){var _0x4da460=_[_0x1b0a('0x9')](_0x35ea03,{'priority':'1'});var _0x4b0182=_[_0x1b0a('0x9')](_0x35ea03,{'isApp':0x1});var _0x188dd0=_['groupBy'](_0x4b0182,_0x1b0a('0x8'));var _0x2fe980=[_0x1b0a('0xa'),_0x1b0a('0xb')];var _0x55e640=[];var _0xfd0042=[];for(var _0x2a6e0e in _0x188dd0){if(_0x188dd0[_0x1b0a('0xc')](_0x2a6e0e)){_0x2aa980['priority']=0x2;_0x2aa980[_0x1b0a('0xd')]=[];_0x2aa980[_0x1b0a('0xe')]=_[_0x1b0a('0xf')](_0x4da460,{'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')]});_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x11'),'appdata':util['format']('CDR(type)=%s',_0x188dd0[_0x2a6e0e][0x0]['type']),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});if(_0x188dd0[_0x2a6e0e][0x0]['type']===_0x1b0a('0x15')){_0x2aa980[_0x1b0a('0xd')]['push']({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x17')+_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')],'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0]['exten'],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});}else if(_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')]===_0x1b0a('0x18')){if(_0x2aa980['extension']){_0x2aa980[_0x1b0a('0xd')]['push']({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x19')+(_0x2aa980[_0x1b0a('0xe')][_0x1b0a('0x1a')]?_0x1b0a('0x1b')+_0x2aa980[_0x1b0a('0xe')][_0x1b0a('0x1a')]+'}':_0x1b0a('0x1c')),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});}_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x17')+_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')],'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});var _0x42c70f=_0x2aa980['priority']++;_0x2aa980['extensions'][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':'ExecIf','appdata':_0x1b0a('0x1d')+(_0x42c70f+0x2)+_0x1b0a('0x1e')+(_0x42c70f+0x1)+')','context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x42c70f,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});if(_0x2aa980[_0x1b0a('0xe')]){_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x11'),'appdata':_0x2aa980[_0x1b0a('0xe')][_0x1b0a('0x1a')]?_0x1b0a('0x1f')+_0x2aa980[_0x1b0a('0xe')][_0x1b0a('0x1a')]+'}':_0x1b0a('0x20'),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0]['VoiceExtensionId']});}_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x11'),'appdata':'outboundrouteid='+_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')],'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});if(_0x2aa980[_0x1b0a('0xe')]&&_0x2aa980['extension']['hasOwnProperty'](_0x1b0a('0x21'))&&_0x2aa980['extension'][_0x1b0a('0x21')]!=='none'){_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x22')+_0x2aa980[_0x1b0a('0xe')][_0x1b0a('0x21')]||'wav','context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});}}_0x2aa980[_0x1b0a('0xd')]['push']({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':'Set','appdata':_0x1b0a('0x23'),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});_0x2aa980[_0x1b0a('0xd')][_0x1b0a('0x10')]({'type':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x16')],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x24'),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0]['exten'],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});_0x2aa980[_0x1b0a('0xd')]['push']({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x25'),'context':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x12')],'exten':_0x188dd0[_0x2a6e0e][0x0]['exten'],'priority':_0x2aa980[_0x1b0a('0x13')]++,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0]['VoiceExtensionId']});for(var _0x40d790=0x0,_0x205b73=0x0;_0x40d790<_0x188dd0[_0x2a6e0e][_0x1b0a('0x26')];_0x40d790+=0x1,_0x205b73=0x0){var _0x547c26=_0x188dd0[_0x2a6e0e][_0x40d790];if(_0x547c26[_0x1b0a('0x16')]){_0x547c26['type']=_0x547c26[_0x1b0a('0x16')][_0x1b0a('0x27')]();}var _0x436d97=[];var _0x12a4b3=[];delete _0x547c26['id'];delete _0x547c26[_0x1b0a('0x28')];delete _0x547c26['updatedAt'];var _0x1639fd=_0x547c26[_0x1b0a('0x29')]!==_0x1b0a('0x2a')?[_0x547c26['interval']]:_0x547c26['IntervalId']?_[_0x1b0a('0x7')](_['filter'](_0x2aa980[_0x1b0a('0x1')],{'IntervalId':_0x547c26[_0x1b0a('0x2')]}),_0x1b0a('0x29')):[];if(_0x547c26[_0x1b0a('0xc')](_0x1b0a('0x2b'))){if(_0x547c26[_0x1b0a('0x2b')]&&_0x547c26[_0x1b0a('0x2b')]!=='--'){_0x436d97['push']({'type':_0x547c26[_0x1b0a('0x16')],'app':_0x1b0a('0x11'),'appdata':_0x1b0a('0x2c')+_0x547c26[_0x1b0a('0x2b')],'context':_0x547c26[_0x1b0a('0x12')],'exten':_0x547c26[_0x1b0a('0x8')],'priority':_0x1639fd['length']+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});}}if(_0x547c26[_0x1b0a('0x16')]===_0x1b0a('0x18')&&_0x547c26[_0x1b0a('0xc')]('callerID')){if(_0x547c26[_0x1b0a('0x2d')]){_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26['type'],'app':_0x1b0a('0x2e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x547c26['callerID']+')','context':_0x547c26['context'],'exten':_0x547c26['exten'],'priority':_0x1639fd[_0x1b0a('0x26')]+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});}else{_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26[_0x1b0a('0x16')],'app':_0x1b0a('0x2e'),'appdata':_0x1b0a('0x2f'),'context':_0x547c26['context'],'exten':_0x547c26['exten'],'priority':_0x1639fd[_0x1b0a('0x26')]+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});}}if(_0x547c26[_0x1b0a('0xc')](_0x1b0a('0x30'))){if(_0x2fe980[_0x1b0a('0x31')](_0x547c26['app'][_0x1b0a('0x27')]())>=0x0&&_0x547c26['appType']!==_0x1b0a('0x32')){if(_0x547c26['answer']){_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26[_0x1b0a('0x16')],'app':_0x1b0a('0x2e'),'appdata':_0x1b0a('0x33'),'context':_0x547c26['context'],'exten':_0x547c26['exten'],'priority':_0x1639fd['length']+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26['type'],'app':'Set','appdata':_0x1b0a('0x34'),'context':_0x547c26[_0x1b0a('0x12')],'exten':_0x547c26[_0x1b0a('0x8')],'priority':_0x1639fd['length']+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});}else{_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26[_0x1b0a('0x16')],'app':'ExecIf','appdata':_0x1b0a('0x35'),'context':_0x547c26[_0x1b0a('0x12')],'exten':_0x547c26['exten'],'priority':_0x1639fd[_0x1b0a('0x26')]+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});_0x436d97[_0x1b0a('0x10')]({'type':_0x547c26[_0x1b0a('0x16')],'app':'Set','appdata':_0x1b0a('0x36'),'context':_0x547c26[_0x1b0a('0x12')],'exten':_0x547c26[_0x1b0a('0x8')],'priority':_0x1639fd['length']+_0x2aa980[_0x1b0a('0x13')]+_0x205b73++,'VoiceExtensionId':_0x547c26[_0x1b0a('0x14')]});}}}for(var _0x332615=0x0;_0x332615<_0x1639fd[_0x1b0a('0x26')];_0x332615+=0x1){var _0xa376e5=_0x2aa980[_0x1b0a('0x13')]+_0x1639fd[_0x1b0a('0x26')];var _0x5144ea=_0x332615===_0x1639fd['length']-0x1?_0x2aa980['priority']+_0x436d97[_0x1b0a('0x26')]+_0x12a4b3[_0x1b0a('0x26')]+0x2:_0x2aa980['priority']+_0x332615+0x1;_0x436d97[_0x1b0a('0x37')](_0x332615,0x0,{'type':_0x547c26['type'],'app':'GotoIfTime','appdata':_0x1639fd[_0x332615]+'?'+_0x547c26[_0x1b0a('0x12')]+_0x1b0a('0x38')+_0xa376e5+':'+_0x547c26['context']+_0x1b0a('0x38')+_0x5144ea,'exten':_0x547c26[_0x1b0a('0x8')],'context':_0x547c26[_0x1b0a('0x12')],'priority':_0x2aa980[_0x1b0a('0x13')]+_0x332615,'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]});}_0x547c26[_0x1b0a('0x13')]=_0x436d97[_0x1b0a('0x26')]?_[_0x1b0a('0x39')](_0x436d97)['priority']+0x1:_0x2aa980[_0x1b0a('0x13')];_0x2aa980['priority']=(_0x12a4b3[_0x1b0a('0x26')]?_['last'](_0x12a4b3)[_0x1b0a('0x13')]:_0x547c26['priority'])+0x1;_0x2aa980[_0x1b0a('0xd')]=_['concat'](_0x2aa980[_0x1b0a('0xd')],_0x436d97,[_0x547c26],_0x12a4b3);}_0x2aa980[_0x1b0a('0xd')]['push']({'type':_0x188dd0[_0x2a6e0e][0x0]['type'],'app':_0x1b0a('0x3a'),'exten':_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x8')],'context':_0x188dd0[_0x2a6e0e][0x0]['context'],'priority':_0x2aa980[_0x1b0a('0x13')],'VoiceExtensionId':_0x188dd0[_0x2a6e0e][0x0]['VoiceExtensionId']});_0x55e640[_0x1b0a('0x10')](_0x188dd0[_0x2a6e0e][0x0][_0x1b0a('0x14')]);_0xfd0042=_['concat'](_0xfd0042,_0x2aa980[_0x1b0a('0xd')]);}}return _0xd8da09['transaction'](function(_0x2eafbf){return _0xd8da09['models'][_0x1b0a('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x55e640}},'transaction':_0x2eafbf})[_0x1b0a('0x3')](function(_0x1a8122){return _0xd8da09[_0x1b0a('0x0')][_0x1b0a('0x4')][_0x1b0a('0x3b')](_[_0x1b0a('0x3c')](_0xfd0042,_0x1b0a('0x13')),{'transaction':_0x2eafbf});});});})[_0x1b0a('0x3d')](function(_0x3dc598){console[_0x1b0a('0x3e')](_0x3dc598);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 41dbca4..0cfce47 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 _0x947f=['id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','query','onlyIfOpen','sequelize','VoiceQueueId','all','findAll','Campaign','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','phone','NOW()','scheduledAt','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from'];(function(_0x589bc9,_0x5ce54a){var _0x23c5cb=function(_0x343084){while(--_0x343084){_0x589bc9['push'](_0x589bc9['shift']());}};_0x23c5cb(++_0x5ce54a);}(_0x947f,0x1d0));var _0xf947=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x947f[_0x200827];return _0x120047;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xf947('0x0'));var fs=require('fs');var squel=require(_0xf947('0x1'));var Papa=require('papaparse');var Redis=require(_0xf947('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0xf947('0x3'));var logger=require(_0xf947('0x4'))(_0xf947('0x5'));config['redis']=_['defaults'](config[_0xf947('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf947('0x7'))(new Redis(config[_0xf947('0x6')]));require(_0xf947('0x8'))[_0xf947('0x9')](socket);try{if(!process[_0xf947('0xa')][0x2]||process[_0xf947('0xa')][0x2]===_0xf947('0xb')||process['argv'][0x2]===_0xf947('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0xf947('0xa')][0x3]||process['argv'][0x3]===_0xf947('0xb')||process['argv'][0x3]===_0xf947('0xc')||!process[_0xf947('0xa')][0x4]||process[_0xf947('0xa')][0x4]===_0xf947('0xb')||process[_0xf947('0xa')][0x4]===_0xf947('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xf947('0xd')](process['argv'][0x3][_0xf947('0xe')](','),process[_0xf947('0xa')][0x4][_0xf947('0xe')](','));if(!process[_0xf947('0xa')][0x5]||process[_0xf947('0xa')][0x5]===_0xf947('0xb')||process[_0xf947('0xa')][0x5]===_0xf947('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xf947('0xa')][0x5];var COMPANYID=process[_0xf947('0xa')][0x6]&&process[_0xf947('0xa')][0x6]!=='undefined'&&process[_0xf947('0xa')][0x6]!==_0xf947('0xc')?process[_0xf947('0xa')][0x6]:null;var DUPLICATES=process[_0xf947('0xa')][0x7]&&process[_0xf947('0xa')][0x7]!==_0xf947('0xb')&&process[_0xf947('0xa')][0x7]!==_0xf947('0xc')?process[_0xf947('0xa')][0x7]:null;if(!process[_0xf947('0xa')][0x8]||process[_0xf947('0xa')][0x8]===_0xf947('0xb')||process['argv'][0x8]===_0xf947('0xc')){throw new Error(_0xf947('0xf'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x45b41b){logger[_0xf947('0x10')](_0x45b41b);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(_0x1a66c3,_0x24ce84,_0xefc3c0,_0x51423d){var _0x35a6eb={'message':_0x24ce84};_0x35a6eb[_0x1a66c3]=!![];if(_0xefc3c0){_0x35a6eb['contact']=_0xefc3c0;}if(_0x51423d){_0x35a6eb['index']=_0x51423d;}return _0x35a6eb;}function isEmail(_0x1796e0){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))*$/[_0xf947('0x11')](_0x1796e0);}function checkRow(_0x4dd4be,_0x529023,_0x5df121){return new BPromise(function(_0x2b3c99,_0x42d11b){if(_['isNil'](_0x4dd4be)){return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0xf947('0x12'),null,_0x5df121));}if(_0x4dd4be[_0xf947('0x13')]&&_0x4dd4be[_0xf947('0x13')][_0xf947('0x14')]){var _0x12834f=_[_0xf947('0x15')](_0x4dd4be['errors'],_0xf947('0x16'))[_0xf947('0x17')](';');return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0x12834f,null,_0x5df121));}var _0x17d727={};for(var _0x54dfb6 in FIELDS){if(FIELDS[_0xf947('0x18')](_0x54dfb6)&&FIELDS[_0x54dfb6]){_0x17d727[_0x54dfb6]=_0x4dd4be[_0xf947('0x19')][0x0][FIELDS[_0x54dfb6]]||_0x4dd4be[_0xf947('0x19')][0x0]['\ufeff'+FIELDS[_0x54dfb6]];}}if(!_0x17d727['firstName']){return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0xf947('0x1a'),null,_0x5df121));}if(!_0x17d727['phone']){return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0xf947('0x1b'),null,_0x5df121));}if(_0x17d727[_0xf947('0x1c')]){var _0x14e6bf=moment(_0x17d727[_0xf947('0x1c')],_0xf947('0x1d'));if(!_0x14e6bf[_0xf947('0x1e')]()){return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0xf947('0x1f'),null,_0x5df121));}}if(_0x17d727[_0xf947('0x20')]){if(!isEmail(_0x17d727['email'])){return _0x42d11b(handleCheckRowError(_0xf947('0x10'),_0xf947('0x21'),null,_0x5df121));}}_0x17d727[_0xf947('0x22')]=LISTID;_0x17d727['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xf947('0x14')]&&_0x529023){var _0x5281d2={};for(var _0x53dcbe=0x0,_0xb1c873=DUPLICATES['length'];_0x53dcbe<_0xb1c873;_0x53dcbe+=0x1){_0x5281d2[DUPLICATES[_0x53dcbe]]=_0x17d727[DUPLICATES[_0x53dcbe]];}var _0x308d15=_['find'](_0x529023,_0x5281d2);if(_0x308d15){return _0x42d11b(handleCheckRowError(_0xf947('0x23'),_0xf947('0x24'),_0x308d15,_0x5df121));}}return db['CmContact'][_0xf947('0x25')](_0x17d727,{'raw':!![],'hooks':![],'fields':_[_0xf947('0x26')](_0x17d727)})[_0xf947('0x27')](function(_0x2ddc67){if(DUPLICATES&&DUPLICATES[_0xf947('0x14')]&&_0x529023){_0x529023[_0xf947('0x28')](_[_0xf947('0x29')](_0x17d727,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2ddc67['id'];return _0x2b3c99();})[_0xf947('0x2a')](function(_0x33cb4f){return _0x42d11b(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x33cb4f['message']||JSON[_0xf947('0x2b')](_0x33cb4f)),null,_0x5df121));});});}function checkHopper(){function _0x4c0313(){return function(_0x26f1a0){logger[_0xf947('0x10')]('cmContact',_0xf947('0x2c'),util[_0xf947('0x2d')](_0x26f1a0,{'showHidden':![],'depth':null}));};}var _0x171e16=function(_0xffa00f,_0x43ec21){var _0x1d394b=squel[_0xf947('0x2e')]()[_0xf947('0x2f')](_0xf947('0x30'))[_0xf947('0x31')](['phone','scheduledAt',_0xf947('0x32'),_0xf947('0x22'),_0x43ec21,_0xf947('0x33'),_0xf947('0x34')],squel[_0xf947('0x35')]()[_0xf947('0x36')]('phone',_0xf947('0x37'))['field'](_0xf947('0x38'),_0xf947('0x39'))[_0xf947('0x36')]('id','ContactId')[_0xf947('0x36')](LISTID[_0xf947('0x3a')](),_0xf947('0x22'))[_0xf947('0x36')](_0xffa00f['id']['toString'](),_0x43ec21)[_0xf947('0x36')](_0xf947('0x38'),_0xf947('0x33'))[_0xf947('0x36')]('NOW()',_0xf947('0x34'))['from'](_0xf947('0x3b'))[_0xf947('0x3c')](_0xf947('0x3d'))['where'](_0xf947('0x3e'),LISTID[_0xf947('0x3a')]())[_0xf947('0x3c')](_0xf947('0x3f'))[_0xf947('0x3c')](_0xf947('0x40'),squel['select']()['field'](_0xf947('0x37'))[_0xf947('0x41')](_0xf947('0x30'))[_0xf947('0x3c')](_0x43ec21+'\x20=\x20?',_0xffa00f['id'][_0xf947('0x3a')]())))[_0xf947('0x3a')]();return _0x1d394b;};var _0x5dc290=function(_0x4816e8,_0x31fc8f){var _0x50c6d8=squel[_0xf947('0x2e')]()[_0xf947('0x2f')]('cm_hopper')['fromQuery']([_0xf947('0x37'),_0xf947('0x39'),_0xf947('0x32'),_0xf947('0x22'),_0x31fc8f,_0xf947('0x33'),_0xf947('0x34')],squel[_0xf947('0x35')]()[_0xf947('0x36')](_0xf947('0x37'),'phone')[_0xf947('0x36')]('NOW()','scheduledAt')[_0xf947('0x36')]('id',_0xf947('0x32'))[_0xf947('0x36')](LISTID['toString'](),_0xf947('0x22'))[_0xf947('0x36')](_0x4816e8['id']['toString'](),_0x31fc8f)[_0xf947('0x36')](_0xf947('0x38'),'createdAt')[_0xf947('0x36')]('NOW()',_0xf947('0x34'))[_0xf947('0x41')]('cm_contacts')[_0xf947('0x3c')](_0xf947('0x3d'))[_0xf947('0x3c')](_0xf947('0x3e'),LISTID[_0xf947('0x3a')]())[_0xf947('0x3c')](_0xf947('0x42'),squel[_0xf947('0x43')](hopperContacts))[_0xf947('0x3c')](_0xf947('0x3f'))['where'](_0xf947('0x40'),squel['select']()[_0xf947('0x36')](_0xf947('0x44'))[_0xf947('0x41')](_0xf947('0x45'))[_0xf947('0x3c')](_0x31fc8f+_0xf947('0x46'),_0x4816e8['id'][_0xf947('0x3a')]()))[_0xf947('0x3c')](_0xf947('0x40'),squel[_0xf947('0x35')]()[_0xf947('0x36')](_0xf947('0x37'))[_0xf947('0x41')](_0xf947('0x30'))[_0xf947('0x3c')](_0x31fc8f+_0xf947('0x46'),_0x4816e8['id'][_0xf947('0x3a')]())))[_0xf947('0x3a')]();return _0x50c6d8;};function _0x3a2434(_0x450998,_0x57e0e5){var _0x2748ee=squel[_0xf947('0x2e')]()[_0xf947('0x2f')](_0xf947('0x30'))[_0xf947('0x31')]([_0xf947('0x37'),_0xf947('0x39'),'ContactId',_0xf947('0x22'),_0x57e0e5,_0xf947('0x33'),_0xf947('0x34')],squel[_0xf947('0x35')]()[_0xf947('0x36')](_0xf947('0x37'),_0xf947('0x37'))[_0xf947('0x36')](_0xf947('0x38'),_0xf947('0x39'))['field']('id','ContactId')[_0xf947('0x36')](LISTID[_0xf947('0x3a')](),_0xf947('0x22'))[_0xf947('0x36')](_0x450998['id'][_0xf947('0x3a')](),_0x57e0e5)['field'](_0xf947('0x38'),_0xf947('0x33'))[_0xf947('0x36')](_0xf947('0x38'),_0xf947('0x34'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0xf947('0x3e'),LISTID[_0xf947('0x3a')]())[_0xf947('0x3c')](_0xf947('0x42'),squel['str'](hopperContacts))[_0xf947('0x3c')](_0xf947('0x3f')))[_0xf947('0x3a')]();return _0x2748ee;}function _0x50b8a5(_0x323c02,_0x5b8cb5){var _0xfe2ab3=squel[_0xf947('0x2e')]()[_0xf947('0x2f')]('cm_hopper_black')['fromQuery'](['phone',_0xf947('0x32'),'ListId',_0x5b8cb5,_0xf947('0x33'),_0xf947('0x34')],squel['select']()['field'](_0xf947('0x37'),'phone')[_0xf947('0x36')]('id','ContactId')['field'](LISTID[_0xf947('0x3a')](),'ListId')[_0xf947('0x36')](_0x323c02['id']['toString'](),_0x5b8cb5)[_0xf947('0x36')](_0xf947('0x38'),_0xf947('0x33'))[_0xf947('0x36')]('NOW()','updatedAt')[_0xf947('0x41')](_0xf947('0x3b'))[_0xf947('0x3c')](_0xf947('0x3d'))[_0xf947('0x3c')](_0xf947('0x3e'),LISTID[_0xf947('0x3a')]())['where'](_0xf947('0x42'),squel[_0xf947('0x43')](hopperContacts))[_0xf947('0x3c')](_0xf947('0x3f')))[_0xf947('0x3a')]();return _0xfe2ab3;}return db[_0xf947('0x47')]['findAll']({'where':{'type':_0xf947('0x48')},'attributes':['id',_0xf947('0x49')],'include':[{'model':db[_0xf947('0x4a')],'as':_0xf947('0x4b'),'where':{'id':LISTID}}]})[_0xf947('0x27')](function(_0x31147c){var _0x1daccf=[];if(_0x31147c){var _0x5a8c76;for(var _0x404b09=0x0,_0x13ccd2;_0x404b09<_0x31147c[_0xf947('0x14')];_0x404b09+=0x1){_0x13ccd2=_0x31147c[_0x404b09][_0xf947('0x4c')]({'plain':!![]});switch(_0x13ccd2[_0xf947('0x49')]){case'always':_0x1daccf[_0xf947('0x28')](db['sequelize'][_0xf947('0x4d')](_0x5dc290(_0x13ccd2,'VoiceQueueId'))['then'](function(){})['catch'](_0x4c0313()));break;case _0xf947('0x4e'):_0x1daccf[_0xf947('0x28')](db[_0xf947('0x4f')][_0xf947('0x4d')](_0x171e16(_0x13ccd2,_0xf947('0x50')))['then'](function(){})[_0xf947('0x2a')](_0x4c0313()));break;default:_0x1daccf[_0xf947('0x28')](db['sequelize'][_0xf947('0x4d')](_0x3a2434(_0x13ccd2,_0xf947('0x50')))['then'](function(){})[_0xf947('0x2a')](_0x4c0313()));}}}return _0x1daccf;})[_0xf947('0x51')]()['then'](function(){return db[_0xf947('0x47')][_0xf947('0x52')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf947('0x27')](function(_0x27f2c5){var _0x5302cc=[];if(_0x27f2c5){var _0x5a988c;for(var _0xbca49a=0x0,_0x1e7de8;_0xbca49a<_0x27f2c5[_0xf947('0x14')];_0xbca49a+=0x1){_0x1e7de8=_0x27f2c5[_0xbca49a][_0xf947('0x4c')]({'plain':!![]});_0x5302cc[_0xf947('0x28')](db[_0xf947('0x4f')][_0xf947('0x4d')](_0x50b8a5(_0x1e7de8,_0xf947('0x50')))[_0xf947('0x27')](function(){})[_0xf947('0x2a')](_0x4c0313()));}}return _0x5302cc;})['all']();})[_0xf947('0x27')](function(){return db[_0xf947('0x53')][_0xf947('0x52')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xf947('0x4a')],'as':'Lists','where':{'id':LISTID}}]})[_0xf947('0x27')](function(_0x1a1a93){var _0x345b30=[];if(_0x1a1a93){for(var _0x2be1bb=0x0,_0x140506;_0x2be1bb<_0x1a1a93['length'];_0x2be1bb+=0x1){_0x140506=_0x1a1a93[_0x2be1bb]['get']({'plain':!![]});switch(_0x140506[_0xf947('0x49')]){case _0xf947('0x54'):_0x345b30[_0xf947('0x28')](db[_0xf947('0x4f')][_0xf947('0x4d')](_0x5dc290(_0x140506,_0xf947('0x55')))[_0xf947('0x27')](function(){})[_0xf947('0x2a')](_0x4c0313()));break;case _0xf947('0x4e'):_0x345b30[_0xf947('0x28')](db['sequelize'][_0xf947('0x4d')](_0x171e16(_0x140506,'CampaignId'))[_0xf947('0x27')](function(){})[_0xf947('0x2a')](_0x4c0313()));break;default:_0x345b30['push'](db[_0xf947('0x4f')][_0xf947('0x4d')](_0x3a2434(_0x140506,'CampaignId'))[_0xf947('0x27')](function(){})[_0xf947('0x2a')](_0x4c0313()));}}}return _0x345b30;})[_0xf947('0x51')]();})['then'](function(){return db[_0xf947('0x53')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xf947('0x4a')],'as':_0xf947('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x1752e9){var _0x522e5c=[];if(_0x1752e9){for(var _0x6190ff=0x0,_0x54ba62;_0x6190ff<_0x1752e9['length'];_0x6190ff+=0x1){_0x54ba62=_0x1752e9[_0x6190ff][_0xf947('0x4c')]({'plain':!![]});_0x522e5c[_0xf947('0x28')](db[_0xf947('0x4f')][_0xf947('0x4d')](_0x50b8a5(_0x54ba62,_0xf947('0x55')))[_0xf947('0x27')](function(){})[_0xf947('0x2a')](_0x4c0313()));}}return _0x522e5c;})[_0xf947('0x51')]();})[_0xf947('0x2a')](function(_0x410734){logger[_0xf947('0x10')](_0xf947('0x57'),_0xf947('0x58'),_0x410734['message']);});}var processPromises=function(_0x3e957d){return BPromise[_0xf947('0x51')](promises)['then'](function(_0x587e49){})[_0xf947('0x2a')](function(_0x138dc3){logger['error'](_0xf947('0x59'),JSON['stringify'](_0x138dc3));})[_0xf947('0x5a')](function(){socket[_0xf947('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e957d){return _0x3e957d[_0xf947('0x5c')]();}});};var endCsv=function(){return BPromise[_0xf947('0x5d')]()[_0xf947('0x27')](function(){if(hopperContacts){return checkHopper();}})[_0xf947('0x27')](function(){socket[_0xf947('0x5b')](_0xf947('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xf947('0x5f')](FILEPATH);}catch(_0xae80a6){logger[_0xf947('0x10')](_0xf947('0x60'),JSON[_0xf947('0x2b')](_0xae80a6));}finally{process[_0xf947('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0xf947('0x62')](_0xf947('0x63'));endCsv();});function main(){return BPromise[_0xf947('0x5d')]()[_0xf947('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xf947('0xe')](',');return db[_0xf947('0x64')][_0xf947('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xf947('0x27')](function(_0x4312fa){var _0x572422=fs[_0xf947('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xf947('0x66')](_0x572422,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2311c0,_0x57f5a2){total+=0x1;var _0x2465c9=total;promises[_0xf947('0x28')](checkRow(_0x2311c0,_0x4312fa,_0x2465c9)[_0xf947('0x27')](function(){success+=0x1;})[_0xf947('0x2a')](function(_0x318eb3){if(_0x318eb3[_0xf947('0x10')]){errors+=0x1;delete _0x318eb3[_0xf947('0x10')];}else if(_0x318eb3['duplicate']){duplicates+=0x1;delete _0x318eb3['duplicate'];}rows[_0xf947('0x28')](_0x318eb3);}));if(total%0xc8===0x0){_0x57f5a2[_0xf947('0x67')]();return processPromises(_0x57f5a2);}},'complete':function(){return processPromises()[_0xf947('0x27')](function(){logger[_0xf947('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x169678,_0x15fd94){logger[_0xf947('0x62')](_0xf947('0x68'),JSON['stringify'](_0x169678));endCsv();}});})[_0xf947('0x2a')](function(_0x35aae1){logger[_0xf947('0x10')](_0xf947('0x69'),JSON[_0xf947('0x2b')](_0x35aae1));});}main(); \ No newline at end of file +var _0xe5cd=['ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','get','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse'];(function(_0x4f32ff,_0x18e99c){var _0x22e91b=function(_0x2e45bc){while(--_0x2e45bc){_0x4f32ff['push'](_0x4f32ff['shift']());}};_0x22e91b(++_0x18e99c);}(_0xe5cd,0x148));var _0xde5c=function(_0x1fe9d4,_0x4b7768){_0x1fe9d4=_0x1fe9d4-0x0;var _0x26b4bc=_0xe5cd[_0x1fe9d4];return _0x26b4bc;};'use strict';var BPromise=require(_0xde5c('0x0'));var util=require(_0xde5c('0x1'));var _=require(_0xde5c('0x2'));var fs=require('fs');var squel=require(_0xde5c('0x3'));var Papa=require(_0xde5c('0x4'));var Redis=require(_0xde5c('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xde5c('0x6'));var logger=require(_0xde5c('0x7'))(_0xde5c('0x8'));config['redis']=_['defaults'](config[_0xde5c('0x9')],{'host':_0xde5c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde5c('0x9')]));require(_0xde5c('0xb'))[_0xde5c('0xc')](socket);try{if(!process[_0xde5c('0xd')][0x2]||process['argv'][0x2]==='undefined'||process[_0xde5c('0xd')][0x2]===_0xde5c('0xe')){throw new Error(_0xde5c('0xf'));}var FILEPATH=process[_0xde5c('0xd')][0x2];if(!process[_0xde5c('0xd')][0x3]||process[_0xde5c('0xd')][0x3]===_0xde5c('0x10')||process[_0xde5c('0xd')][0x3]===_0xde5c('0xe')||!process['argv'][0x4]||process[_0xde5c('0xd')][0x4]===_0xde5c('0x10')||process[_0xde5c('0xd')][0x4]==='null'){throw new Error(_0xde5c('0x11'));}var FIELDS=_[_0xde5c('0x12')](process[_0xde5c('0xd')][0x3][_0xde5c('0x13')](','),process['argv'][0x4][_0xde5c('0x13')](','));if(!process[_0xde5c('0xd')][0x5]||process[_0xde5c('0xd')][0x5]===_0xde5c('0x10')||process[_0xde5c('0xd')][0x5]===_0xde5c('0xe')){throw new Error(_0xde5c('0x14'));}var LISTID=process[_0xde5c('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xde5c('0xd')][0x6]!==_0xde5c('0x10')&&process[_0xde5c('0xd')][0x6]!==_0xde5c('0xe')?process[_0xde5c('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xde5c('0xd')][0x7]!==_0xde5c('0x10')&&process['argv'][0x7]!=='null'?process[_0xde5c('0xd')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]===_0xde5c('0x10')||process['argv'][0x8]===_0xde5c('0xe')){throw new Error(_0xde5c('0x15'));}var SOCKET_TIMESTAMP=process[_0xde5c('0xd')][0x8];}catch(_0x79fe12){logger['error'](_0x79fe12);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(_0x4ec526,_0x1cd408,_0x1c3f7c,_0x166f2e){var _0x11c0a4={'message':_0x1cd408};_0x11c0a4[_0x4ec526]=!![];if(_0x1c3f7c){_0x11c0a4[_0xde5c('0x16')]=_0x1c3f7c;}if(_0x166f2e){_0x11c0a4[_0xde5c('0x17')]=_0x166f2e;}return _0x11c0a4;}function isEmail(_0x312edb){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))*$/[_0xde5c('0x18')](_0x312edb);}function checkRow(_0x55f49f,_0x12fc1a,_0x2a7d39){return new BPromise(function(_0x1ba951,_0x13c371){if(_['isNil'](_0x55f49f)){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0xde5c('0x1a'),null,_0x2a7d39));}if(_0x55f49f[_0xde5c('0x1b')]&&_0x55f49f[_0xde5c('0x1b')][_0xde5c('0x1c')]){var _0x11a658=_[_0xde5c('0x1d')](_0x55f49f[_0xde5c('0x1b')],_0xde5c('0x1e'))['join'](';');return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0x11a658,null,_0x2a7d39));}var _0xfb4aaa={};for(var _0x42d834 in FIELDS){if(FIELDS[_0xde5c('0x1f')](_0x42d834)&&FIELDS[_0x42d834]){_0xfb4aaa[_0x42d834]=_0x55f49f[_0xde5c('0x20')][0x0][FIELDS[_0x42d834]]||_0x55f49f[_0xde5c('0x20')][0x0]['\ufeff'+FIELDS[_0x42d834]];}}if(!_0xfb4aaa[_0xde5c('0x21')]){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0xde5c('0x22'),null,_0x2a7d39));}if(!_0xfb4aaa[_0xde5c('0x23')]){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0xde5c('0x24'),null,_0x2a7d39));}if(_0xfb4aaa[_0xde5c('0x25')]){var _0x3948fe=moment(_0xfb4aaa[_0xde5c('0x25')],_0xde5c('0x26'));if(!_0x3948fe['isValid']()){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0xde5c('0x27'),null,_0x2a7d39));}}if(_0xfb4aaa[_0xde5c('0x28')]){if(!isEmail(_0xfb4aaa['email'])){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),'email\x20format\x20is\x20not\x20valid!',null,_0x2a7d39));}}_0xfb4aaa[_0xde5c('0x29')]=LISTID;_0xfb4aaa[_0xde5c('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x12fc1a){var _0x2877d9={};for(var _0x432bbe=0x0,_0x3a1bf5=DUPLICATES[_0xde5c('0x1c')];_0x432bbe<_0x3a1bf5;_0x432bbe+=0x1){_0x2877d9[DUPLICATES[_0x432bbe]]=_0xfb4aaa[DUPLICATES[_0x432bbe]];}var _0x5d149a=_[_0xde5c('0x2b')](_0x12fc1a,_0x2877d9);if(_0x5d149a){return _0x13c371(handleCheckRowError(_0xde5c('0x2c'),_0xde5c('0x2d'),_0x5d149a,_0x2a7d39));}}return db[_0xde5c('0x2e')][_0xde5c('0x2f')](_0xfb4aaa,{'raw':!![],'hooks':![],'fields':_[_0xde5c('0x30')](_0xfb4aaa)})['then'](function(_0x53e2ea){if(DUPLICATES&&DUPLICATES[_0xde5c('0x1c')]&&_0x12fc1a){_0x12fc1a[_0xde5c('0x31')](_[_0xde5c('0x32')](_0xfb4aaa,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x53e2ea['id'];return _0x1ba951();})[_0xde5c('0x33')](function(_0x3a33c8){return _0x13c371(handleCheckRowError(_0xde5c('0x19'),_0xde5c('0x34')+(_0x3a33c8['message']||JSON[_0xde5c('0x35')](_0x3a33c8)),null,_0x2a7d39));});});}function checkHopper(){function _0x354435(){return function(_0x50950e){logger[_0xde5c('0x19')]('cmContact','checkHopper',util[_0xde5c('0x36')](_0x50950e,{'showHidden':![],'depth':null}));};}var _0x418c70=function(_0x4708df,_0x24676f){var _0x55fe2e=squel[_0xde5c('0x37')]()['into'](_0xde5c('0x38'))[_0xde5c('0x39')](['phone',_0xde5c('0x3a'),_0xde5c('0x3b'),_0xde5c('0x29'),_0x24676f,_0xde5c('0x3c'),'updatedAt'],squel[_0xde5c('0x3d')]()[_0xde5c('0x3e')](_0xde5c('0x23'),'phone')[_0xde5c('0x3e')]('NOW()',_0xde5c('0x3a'))[_0xde5c('0x3e')]('id',_0xde5c('0x3b'))[_0xde5c('0x3e')](LISTID[_0xde5c('0x3f')](),_0xde5c('0x29'))[_0xde5c('0x3e')](_0x4708df['id'][_0xde5c('0x3f')](),_0x24676f)['field'](_0xde5c('0x40'),_0xde5c('0x3c'))['field'](_0xde5c('0x40'),_0xde5c('0x41'))[_0xde5c('0x42')](_0xde5c('0x43'))[_0xde5c('0x44')](_0xde5c('0x45'))[_0xde5c('0x44')]('ListId\x20=\x20?',LISTID['toString']())[_0xde5c('0x44')](_0xde5c('0x46'))['where'](_0xde5c('0x47'),squel[_0xde5c('0x3d')]()[_0xde5c('0x3e')]('phone')['from'](_0xde5c('0x38'))[_0xde5c('0x44')](_0x24676f+'\x20=\x20?',_0x4708df['id'][_0xde5c('0x3f')]())))[_0xde5c('0x3f')]();return _0x55fe2e;};var _0x3b3192=function(_0x4d73a1,_0x578a75){var _0x25c179=squel[_0xde5c('0x37')]()[_0xde5c('0x48')]('cm_hopper')[_0xde5c('0x39')]([_0xde5c('0x23'),'scheduledAt',_0xde5c('0x3b'),_0xde5c('0x29'),_0x578a75,_0xde5c('0x3c'),_0xde5c('0x41')],squel[_0xde5c('0x3d')]()['field'](_0xde5c('0x23'),_0xde5c('0x23'))[_0xde5c('0x3e')](_0xde5c('0x40'),_0xde5c('0x3a'))[_0xde5c('0x3e')]('id',_0xde5c('0x3b'))[_0xde5c('0x3e')](LISTID['toString'](),_0xde5c('0x29'))[_0xde5c('0x3e')](_0x4d73a1['id']['toString'](),_0x578a75)['field'](_0xde5c('0x40'),_0xde5c('0x3c'))[_0xde5c('0x3e')](_0xde5c('0x40'),_0xde5c('0x41'))[_0xde5c('0x42')](_0xde5c('0x43'))[_0xde5c('0x44')]('deletedAt\x20IS\x20NULL')[_0xde5c('0x44')](_0xde5c('0x49'),LISTID['toString']())[_0xde5c('0x44')](_0xde5c('0x4a'),squel['str'](hopperContacts))[_0xde5c('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xde5c('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xde5c('0x3d')]()['field'](_0xde5c('0x4b'))['from'](_0xde5c('0x4c'))['where'](_0x578a75+'\x20=\x20?',_0x4d73a1['id'][_0xde5c('0x3f')]()))[_0xde5c('0x44')](_0xde5c('0x47'),squel['select']()[_0xde5c('0x3e')](_0xde5c('0x23'))[_0xde5c('0x42')](_0xde5c('0x38'))[_0xde5c('0x44')](_0x578a75+'\x20=\x20?',_0x4d73a1['id'][_0xde5c('0x3f')]())))['toString']();return _0x25c179;};function _0x4b5307(_0x23e3e2,_0x13820a){var _0x106a77=squel[_0xde5c('0x37')]()[_0xde5c('0x48')](_0xde5c('0x38'))[_0xde5c('0x39')]([_0xde5c('0x23'),_0xde5c('0x3a'),'ContactId',_0xde5c('0x29'),_0x13820a,_0xde5c('0x3c'),'updatedAt'],squel[_0xde5c('0x3d')]()[_0xde5c('0x3e')](_0xde5c('0x23'),_0xde5c('0x23'))[_0xde5c('0x3e')](_0xde5c('0x40'),_0xde5c('0x3a'))[_0xde5c('0x3e')]('id',_0xde5c('0x3b'))['field'](LISTID[_0xde5c('0x3f')](),'ListId')['field'](_0x23e3e2['id'][_0xde5c('0x3f')](),_0x13820a)[_0xde5c('0x3e')](_0xde5c('0x40'),_0xde5c('0x3c'))['field'](_0xde5c('0x40'),_0xde5c('0x41'))['from'](_0xde5c('0x43'))[_0xde5c('0x44')](_0xde5c('0x45'))['where'](_0xde5c('0x49'),LISTID[_0xde5c('0x3f')]())[_0xde5c('0x44')](_0xde5c('0x4a'),squel[_0xde5c('0x4d')](hopperContacts))[_0xde5c('0x44')](_0xde5c('0x46')))[_0xde5c('0x3f')]();return _0x106a77;}function _0x432213(_0x487e94,_0x37d2d0){var _0x3c9d80=squel[_0xde5c('0x37')]()['into'](_0xde5c('0x4e'))['fromQuery']([_0xde5c('0x23'),_0xde5c('0x3b'),_0xde5c('0x29'),_0x37d2d0,_0xde5c('0x3c'),_0xde5c('0x41')],squel[_0xde5c('0x3d')]()[_0xde5c('0x3e')](_0xde5c('0x23'),_0xde5c('0x23'))[_0xde5c('0x3e')]('id','ContactId')[_0xde5c('0x3e')](LISTID['toString'](),_0xde5c('0x29'))[_0xde5c('0x3e')](_0x487e94['id'][_0xde5c('0x3f')](),_0x37d2d0)['field']('NOW()','createdAt')[_0xde5c('0x3e')](_0xde5c('0x40'),'updatedAt')['from']('cm_contacts')[_0xde5c('0x44')](_0xde5c('0x45'))['where'](_0xde5c('0x49'),LISTID[_0xde5c('0x3f')]())[_0xde5c('0x44')](_0xde5c('0x4a'),squel[_0xde5c('0x4d')](hopperContacts))[_0xde5c('0x44')](_0xde5c('0x46')))[_0xde5c('0x3f')]();return _0x3c9d80;}return db[_0xde5c('0x4f')][_0xde5c('0x50')]({'where':{'type':_0xde5c('0x51')},'attributes':['id',_0xde5c('0x52')],'include':[{'model':db[_0xde5c('0x53')],'as':_0xde5c('0x54'),'where':{'id':LISTID}}]})[_0xde5c('0x55')](function(_0x48ec6e){var _0x321aeb=[];if(_0x48ec6e){var _0x5c13e6;for(var _0x20230e=0x0,_0x5f23ec;_0x20230e<_0x48ec6e[_0xde5c('0x1c')];_0x20230e+=0x1){_0x5f23ec=_0x48ec6e[_0x20230e]['get']({'plain':!![]});switch(_0x5f23ec['dialCheckDuplicateType']){case'always':_0x321aeb['push'](db[_0xde5c('0x56')][_0xde5c('0x57')](_0x3b3192(_0x5f23ec,_0xde5c('0x58')))[_0xde5c('0x55')](function(){})[_0xde5c('0x33')](_0x354435()));break;case _0xde5c('0x59'):_0x321aeb[_0xde5c('0x31')](db[_0xde5c('0x56')]['query'](_0x418c70(_0x5f23ec,_0xde5c('0x58')))[_0xde5c('0x55')](function(){})[_0xde5c('0x33')](_0x354435()));break;default:_0x321aeb['push'](db[_0xde5c('0x56')][_0xde5c('0x57')](_0x4b5307(_0x5f23ec,_0xde5c('0x58')))[_0xde5c('0x55')](function(){})[_0xde5c('0x33')](_0x354435()));}}}return _0x321aeb;})['all']()[_0xde5c('0x55')](function(){return db['VoiceQueue'][_0xde5c('0x50')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xde5c('0x5a'),'where':{'id':LISTID}}]})[_0xde5c('0x55')](function(_0x188176){var _0x2a005b=[];if(_0x188176){var _0x2e9803;for(var _0xa13385=0x0,_0x25576d;_0xa13385<_0x188176[_0xde5c('0x1c')];_0xa13385+=0x1){_0x25576d=_0x188176[_0xa13385]['get']({'plain':!![]});_0x2a005b[_0xde5c('0x31')](db[_0xde5c('0x56')][_0xde5c('0x57')](_0x432213(_0x25576d,'VoiceQueueId'))[_0xde5c('0x55')](function(){})['catch'](_0x354435()));}}return _0x2a005b;})[_0xde5c('0x5b')]();})[_0xde5c('0x55')](function(){return db[_0xde5c('0x5c')][_0xde5c('0x50')]({'attributes':['id',_0xde5c('0x52')],'include':[{'model':db['CmList'],'as':_0xde5c('0x54'),'where':{'id':LISTID}}]})[_0xde5c('0x55')](function(_0x34ff93){var _0x38d515=[];if(_0x34ff93){for(var _0x582ea0=0x0,_0x1ff43d;_0x582ea0<_0x34ff93[_0xde5c('0x1c')];_0x582ea0+=0x1){_0x1ff43d=_0x34ff93[_0x582ea0][_0xde5c('0x5d')]({'plain':!![]});switch(_0x1ff43d[_0xde5c('0x52')]){case _0xde5c('0x5e'):_0x38d515[_0xde5c('0x31')](db[_0xde5c('0x56')][_0xde5c('0x57')](_0x3b3192(_0x1ff43d,_0xde5c('0x5f')))[_0xde5c('0x55')](function(){})['catch'](_0x354435()));break;case _0xde5c('0x59'):_0x38d515[_0xde5c('0x31')](db[_0xde5c('0x56')]['query'](_0x418c70(_0x1ff43d,_0xde5c('0x5f')))[_0xde5c('0x55')](function(){})[_0xde5c('0x33')](_0x354435()));break;default:_0x38d515[_0xde5c('0x31')](db['sequelize'][_0xde5c('0x57')](_0x4b5307(_0x1ff43d,_0xde5c('0x5f')))[_0xde5c('0x55')](function(){})[_0xde5c('0x33')](_0x354435()));}}}return _0x38d515;})[_0xde5c('0x5b')]();})[_0xde5c('0x55')](function(){return db[_0xde5c('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xde5c('0x53')],'as':_0xde5c('0x5a'),'where':{'id':LISTID}}]})[_0xde5c('0x55')](function(_0x17be9f){var _0x2f600b=[];if(_0x17be9f){for(var _0x58b009=0x0,_0x4eb47b;_0x58b009<_0x17be9f[_0xde5c('0x1c')];_0x58b009+=0x1){_0x4eb47b=_0x17be9f[_0x58b009][_0xde5c('0x5d')]({'plain':!![]});_0x2f600b[_0xde5c('0x31')](db['sequelize']['query'](_0x432213(_0x4eb47b,_0xde5c('0x5f')))['then'](function(){})[_0xde5c('0x33')](_0x354435()));}}return _0x2f600b;})[_0xde5c('0x5b')]();})['catch'](function(_0x7728ff){logger[_0xde5c('0x19')](_0xde5c('0x60'),_0xde5c('0x61'),_0x7728ff[_0xde5c('0x1e')]);});}var processPromises=function(_0x156a5b){return BPromise[_0xde5c('0x5b')](promises)[_0xde5c('0x55')](function(_0x435ba1){})[_0xde5c('0x33')](function(_0x58128b){logger[_0xde5c('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0xde5c('0x35')](_0x58128b));})['finally'](function(){socket[_0xde5c('0x62')](_0xde5c('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x156a5b){return _0x156a5b['resume']();}});};var endCsv=function(){return BPromise[_0xde5c('0x64')]()[_0xde5c('0x55')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xde5c('0x62')](_0xde5c('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xde5c('0x65')](FILEPATH);}catch(_0x864de4){logger['error'](_0xde5c('0x66'),JSON[_0xde5c('0x35')](_0x864de4));}finally{process[_0xde5c('0x67')](0x0);}});};process['on'](_0xde5c('0x68'),function(){logger[_0xde5c('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xde5c('0x64')]()[_0xde5c('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xde5c('0x13')](',');return db[_0xde5c('0x2e')][_0xde5c('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xde5c('0x55')](function(_0x25080d){var _0x2d6eaa=fs[_0xde5c('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2d6eaa,{'header':!![],'skipEmptyLines':!![],'step':function(_0x26c5b8,_0x45a6bb){total+=0x1;var _0x162646=total;promises[_0xde5c('0x31')](checkRow(_0x26c5b8,_0x25080d,_0x162646)['then'](function(){success+=0x1;})[_0xde5c('0x33')](function(_0x5d21c8){if(_0x5d21c8[_0xde5c('0x19')]){errors+=0x1;delete _0x5d21c8[_0xde5c('0x19')];}else if(_0x5d21c8[_0xde5c('0x2c')]){duplicates+=0x1;delete _0x5d21c8[_0xde5c('0x2c')];}rows[_0xde5c('0x31')](_0x5d21c8);}));if(total%0xc8===0x0){_0x45a6bb[_0xde5c('0x6b')]();return processPromises(_0x45a6bb);}},'complete':function(){return processPromises()[_0xde5c('0x55')](function(){logger['info'](_0xde5c('0x6c'));endCsv();});},'error':function(_0x545290,_0x5a74c1){logger[_0xde5c('0x69')](_0xde5c('0x6d'),JSON[_0xde5c('0x35')](_0x545290));endCsv();}});})['catch'](function(_0x34a36b){logger[_0xde5c('0x19')](_0xde5c('0x6e'),JSON[_0xde5c('0x35')](_0x34a36b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 7e652b3..90e2503 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 _0x9c60=['length','all','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','phone','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','fields','from','cm_contacts','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','ListId','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','fromQuery','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','isNil','utcOffset','set','offset','dialTimezone','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','createReadStream','data','find','_description','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','description','SystemRow','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','socket.io-emitter','format','test','select','field','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','push','AdditionalPhones','split'];(function(_0x1d7dd6,_0x893331){var _0x40b925=function(_0x391b73){while(--_0x391b73){_0x1d7dd6['push'](_0x1d7dd6['shift']());}};_0x40b925(++_0x893331);}(_0x9c60,0x9e));var _0x09c6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c60[_0x4b369d];return _0x571a98;};'use strict';var fs=require('fs');var path=require(_0x09c6('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x09c6('0x1'));var BPromise=require(_0x09c6('0x2'));var moment=require(_0x09c6('0x3'));var squel=require(_0x09c6('0x4'));var Redis=require(_0x09c6('0x5'));var db=require(_0x09c6('0x6'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x09c6('0x7'))(_0x09c6('0x8'));config[_0x09c6('0x9')]=_[_0x09c6('0xa')](config[_0x09c6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x09c6('0xb'))(new Redis(config[_0x09c6('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x09c6('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x09c6('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x55d8f9){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))*$/[_0x09c6('0xd')](_0x55d8f9);}function selectNotIn(_0xf7c7e7,_0x242828,_0x3552eb,_0x293ea3,_0x57256d){return squel[_0x09c6('0xe')]()[_0x09c6('0xf')]('phone')['from'](_0x293ea3)[_0x09c6('0x10')](_0x242828,null,_0x242828+'.id\x20=\x20'+_0x293ea3+'.'+_0x3552eb)['where'](_0x293ea3+'.'+_0x3552eb+_0x09c6('0x11')+_0xf7c7e7+'.'+_0x3552eb)[_0x09c6('0x12')](_0x242828+_0x09c6('0x13')+_0x57256d[_0x09c6('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x161e91,_0x99a0bf){promisesAdditionalPhones=[];return db[_0x09c6('0x14')][_0x09c6('0x15')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x09c6('0x16')](function(_0x1b5585){if(_0x1b5585!==null){var _0x1acbac=[];for(var _0x46523f=0x0;_0x46523f<_0x1b5585['length'];_0x46523f++){var _0x3d99b0=_0x1b5585[_0x46523f];_0x1acbac[_0x09c6('0x17')](insertAdditionalPhones(_0x3d99b0));}}Promise['all'](_0x1acbac)['then'](function(){_0x161e91({'val':0x1});});});});}function insertAdditionalPhones(_0x172dcb){return new Promise(function(_0x177a80,_0xa6b155){var _0x2d90a5=_0x172dcb[_0x09c6('0x18')];var _0x253a2f=_0x2d90a5[_0x09c6('0x19')](';');var _0x3a1aab=[];orderBy=0x0;for(var _0x2ab7e2=0x0;_0x2ab7e2<_0x253a2f[_0x09c6('0x1a')];_0x2ab7e2++){_0x3a1aab[_0x09c6('0x17')](splitAdditionalPhone(_0x172dcb['id'],_0x253a2f[_0x2ab7e2]));}Promise[_0x09c6('0x1b')](_0x3a1aab)[_0x09c6('0x16')](function(){_0x177a80({'val':_0x253a2f[_0x09c6('0x1a')]});});});}function splitAdditionalPhone(_0x44843b,_0x1afc40){return new Promise(function(_0x52866b,_0x15af16){var _0x1c6a42=_0x1afc40[_0x09c6('0x19')](':');var _0x5a0869=_0x1c6a42[0x0];var _0x11b079=_0x1c6a42[0x1];if(!_['isNil'](_0x11b079)){var _0x3ff483=_0x11b079['split']('|');var _0x2f0e5e=[];for(var _0x552d24=0x0;_0x552d24<_0x3ff483[_0x09c6('0x1a')];_0x552d24++){if(_0x3ff483[_0x552d24]!==''){var _0x529043=_[_0x09c6('0x1c')](promisesAdditionalPhones,{'contactId':_0x44843b,'phone':_0x3ff483[_0x552d24]});if(_0x529043['length']==0x0){orderBy++;promisesAdditionalPhones[_0x09c6('0x17')]({'contactId':_0x44843b,'contactTypeId':_0x5a0869,'phone':_0x3ff483[_0x552d24],'orderBy':orderBy});}}}_0x52866b({'ok':0x1});}else _0x52866b({'res':0x0});});}function createAdditionalPhone(_0x2f2498,_0x44e6c5,_0x5b42df,_0xf8137c){var _0x2a6ab4='';var _0x55eff5='';var _0x2f1061=_0x5b42df[_0x09c6('0x19')]('§');_0x2a6ab4=_0x2f1061[0x0];if(_0x2f1061[_0x09c6('0x1a')]==0x2)_0x55eff5=_0x2f1061[0x1];return new Promise(function(_0x50b273,_0x50fa4c){return db[_0x09c6('0x1d')][_0x09c6('0x1e')]({'where':{'CmContactId':_0x2f2498,'item':_0x2a6ab4}})['then'](function(_0x5d479a){if(_0x5d479a){return db[_0x09c6('0x1d')][_0x09c6('0x1f')]({'ItemTypeId':_0x44e6c5,'description':_0x55eff5,'OrderBy':_0xf8137c},{'where':{'CmContactId':_0x2f2498,'item':_0x2a6ab4}})[_0x09c6('0x16')](function(_0x3791e9){_0x50b273({'res':_0x09c6('0x20')});});}else{return db[_0x09c6('0x1d')][_0x09c6('0x21')]({'CmContactId':_0x2f2498,'item':_0x2a6ab4,'description':_0x55eff5,'ItemTypeId':_0x44e6c5,'OrderBy':_0xf8137c,'ItemClass':_0x09c6('0x22')})[_0x09c6('0x16')](function(_0x337169){_0x50b273({'res':_0x09c6('0x23')});});}});});}function insertCmHopper(_0x21da4f,_0x5cdef8,_0x1055f7,_0x457d48,_0x3906de){var _0x4a3848=['cm_contacts.phone',_0x09c6('0x24'),_0x09c6('0x25'),'cm_contacts.ListId',_0x5cdef8+'.'+_0x457d48,_0x09c6('0x26'),_0x09c6('0x27'),'cm_contacts.priority',_0x09c6('0x28'),'\x22'+_0x3906de+'\x22'];return squel[_0x09c6('0x29')]()[_0x09c6('0x2a')]('cm_hopper')['fromQuery']([_0x09c6('0x2b'),_0x09c6('0x2c'),_0x09c6('0x2d'),'ListId',_0x457d48,_0x09c6('0x2e'),_0x09c6('0x2f'),_0x09c6('0x30'),_0x09c6('0x31'),'recallme'],squel[_0x09c6('0xe')]()[_0x09c6('0x32')](_0x4a3848)[_0x09c6('0x33')](_0x5cdef8)[_0x09c6('0x10')](_0x09c6('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x5cdef8+_0x09c6('0x35'))[_0x09c6('0x10')](_0x1055f7,null,_0x1055f7+'.id\x20=\x20'+_0x5cdef8+'.'+_0x457d48)[_0x09c6('0x12')](_0x5cdef8+'.CmListId\x20=\x20?',_0x21da4f)[_0x09c6('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x09c6('0x12')](_0x09c6('0x36'),selectNotIn(_0x5cdef8,_0x1055f7,_0x457d48,_0x09c6('0x37'),[_0x09c6('0x38'),_0x09c6('0x39')]))[_0x09c6('0x12')](_0x09c6('0x36'),selectNotIn(_0x5cdef8,_0x1055f7,_0x457d48,_0x09c6('0x37'),[_0x09c6('0x38')])))[_0x09c6('0x3a')]();}function insertCmHopperBlack(_0x4da406,_0x501029,_0x53cda4,_0x1f567e){var _0x5e618b=[_0x09c6('0x3b'),_0x09c6('0x25'),_0x09c6('0x3c'),_0x501029+'.'+_0x1f567e,_0x09c6('0x26'),'cm_contacts.updatedAt'];return squel['insert']()['into'](_0x09c6('0x3d'))['fromQuery']([_0x09c6('0x2b'),_0x09c6('0x2d'),_0x09c6('0x3e'),_0x1f567e,_0x09c6('0x2e'),_0x09c6('0x2f')],squel[_0x09c6('0xe')]()[_0x09c6('0x32')](_0x5e618b)[_0x09c6('0x33')](_0x501029)[_0x09c6('0x10')](_0x09c6('0x34'),null,_0x09c6('0x3f')+_0x501029+'.CmListId')[_0x09c6('0x10')](_0x53cda4,null,_0x53cda4+_0x09c6('0x40')+_0x501029+'.'+_0x1f567e)[_0x09c6('0x12')](_0x501029+_0x09c6('0x41'),_0x4da406)[_0x09c6('0x12')](_0x09c6('0x42'),NOW)['where'](_0x09c6('0x36'),squel['select']()[_0x09c6('0xf')]('phone')[_0x09c6('0x33')]('cm_hopper_black')[_0x09c6('0x12')](_0x09c6('0x43'),_0x4da406)[_0x09c6('0x12')](_0x1f567e+'\x20=\x20'+_0x501029+'.'+_0x1f567e)))['toString']();}function insertTzCmHopper(_0x30f127,_0x45be68,_0xdd50ec,_0x2c5bdc,_0x5495a7,_0x187301){var _0x3aefd3=['cm_contacts.phone',_0x09c6('0x44')+_0x187301+_0x09c6('0x45'),_0x09c6('0x25'),_0x09c6('0x3c'),_0x45be68+'.'+_0x2c5bdc,_0x09c6('0x26'),'cm_contacts.updatedAt',_0x09c6('0x46'),'cm_contacts.UserId','\x22'+_0x5495a7+'\x22'];var _0x218443=squel['insert']()[_0x09c6('0x2a')]('cm_hopper')[_0x09c6('0x47')]([_0x09c6('0x2b'),_0x09c6('0x2c'),_0x09c6('0x2d'),_0x09c6('0x3e'),_0x2c5bdc,_0x09c6('0x2e'),_0x09c6('0x2f'),_0x09c6('0x30'),'UserId',_0x09c6('0x48')],squel['select']()['fields'](_0x3aefd3)[_0x09c6('0x33')](_0x45be68)[_0x09c6('0x10')](_0x09c6('0x34'),null,_0x09c6('0x3f')+_0x45be68+_0x09c6('0x35'))[_0x09c6('0x10')](_0xdd50ec,null,_0xdd50ec+_0x09c6('0x40')+_0x45be68+'.'+_0x2c5bdc)[_0x09c6('0x10')](_0x187301,null,_0x187301+_0x09c6('0x40')+_0x45be68+'.'+_0x2c5bdc)[_0x09c6('0x12')](_0x45be68+_0x09c6('0x41'),_0x30f127)[_0x09c6('0x12')](_0x09c6('0x42'),NOW)[_0x09c6('0x12')](_0x09c6('0x36'),selectNotIn(_0x45be68,_0xdd50ec,_0x2c5bdc,_0x09c6('0x37'),[_0x09c6('0x38'),_0x09c6('0x39')]))[_0x09c6('0x12')](_0x09c6('0x36'),selectNotIn(_0x45be68,_0xdd50ec,_0x2c5bdc,_0x09c6('0x37'),['\x22always\x22'])))[_0x09c6('0x3a')]();return _0x218443;}function insertTzCmHopperBlack(_0x534d95,_0x43ab4b,_0x84b737,_0x4a2082){var _0x1ac92d=[_0x09c6('0x3b'),_0x09c6('0x25'),_0x09c6('0x3c'),_0x43ab4b+'.'+_0x4a2082,'cm_contacts.createdAt',_0x09c6('0x27')];return squel[_0x09c6('0x29')]()['into'](_0x09c6('0x3d'))[_0x09c6('0x47')](['phone','ContactId',_0x09c6('0x3e'),_0x4a2082,_0x09c6('0x2e'),_0x09c6('0x2f')],squel[_0x09c6('0xe')]()[_0x09c6('0x32')](_0x1ac92d)[_0x09c6('0x33')](_0x43ab4b)[_0x09c6('0x10')]('cm_contacts',null,_0x09c6('0x3f')+_0x43ab4b+_0x09c6('0x35'))[_0x09c6('0x10')](_0x84b737,null,_0x84b737+_0x09c6('0x40')+_0x43ab4b+'.'+_0x4a2082)[_0x09c6('0x12')](_0x43ab4b+'.CmListId\x20=\x20?',_0x534d95)['where'](_0x09c6('0x42'),NOW)[_0x09c6('0x12')](_0x09c6('0x36'),squel[_0x09c6('0xe')]()['field'](_0x09c6('0x2b'))[_0x09c6('0x33')]('cm_hopper_black')[_0x09c6('0x12')](_0x09c6('0x43'),_0x534d95)['where'](_0x4a2082+_0x09c6('0x11')+_0x43ab4b+'.'+_0x4a2082)))['toString']();}function insertCmHopperAdditionalPhones(_0x46fc29){var _0x29a39e=[_0x09c6('0x49'),_0x09c6('0x4a'),_0x09c6('0x4b'),_0x09c6('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0x09c6('0x29')]()['into'](_0x09c6('0x4d'))[_0x09c6('0x47')]([_0x09c6('0x4e'),_0x09c6('0x2b'),_0x09c6('0x4f'),_0x09c6('0x2e'),'updatedAt'],squel[_0x09c6('0xe')]()['fields'](_0x29a39e)[_0x09c6('0x33')](_0x09c6('0x37'))['join']('cm_contacts',null,_0x09c6('0x50'))[_0x09c6('0x10')](_0x09c6('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x09c6('0x12')]('cm_hopper.ListId\x20=\x20?',_0x46fc29)[_0x09c6('0x12')](_0x09c6('0x42'),NOW))[_0x09c6('0x3a')]();}function insertCmContact(_0x5b8080,_0x2f2a88,_0x4ccd30,_0x4397d5){var _0x222b90=_['concat'](_[_0x09c6('0x52')](_0x4397d5),[_0x09c6('0x3e'),_0x09c6('0x53'),_0x09c6('0x2e'),_0x09c6('0x2f'),_0x09c6('0x54')]);return squel[_0x09c6('0x29')]()[_0x09c6('0x2a')]('cm_contacts')[_0x09c6('0x47')](_0x222b90,squel[_0x09c6('0xe')]()[_0x09c6('0x32')](_0x222b90)[_0x09c6('0x33')](_0x2f2a88)['where']('('+_0x4ccd30[_0x09c6('0x10')](',')+_0x09c6('0x55'),squel[_0x09c6('0xe')]()[_0x09c6('0x32')](_0x4ccd30)[_0x09c6('0x33')]('cm_contacts')[_0x09c6('0x12')](_0x09c6('0x43'),_0x5b8080)['where'](_0x09c6('0x56')))['where'](_0x09c6('0x57'),squel['select']()[_0x09c6('0xf')]('MIN(id)',_0x09c6('0x58'))[_0x09c6('0x33')](_0x2f2a88)['group'](_0x4ccd30[_0x09c6('0x10')](','))))[_0x09c6('0x3a')]();}function handleStop(){logger[_0x09c6('0x59')](_0x09c6('0x5a'));stopped=!![];}function handleUncaughtException(_0xe42ef7){logger[_0x09c6('0x5b')](_0xe42ef7[_0x09c6('0x5c')]);process[_0x09c6('0x5d')](0x1);}function handleError(_0x5433ed,_0x556448){stats[_0x09c6('0x5e')][_0x09c6('0x17')]({'name':_0x556448[_0x09c6('0x5f')],'message':_0x556448[_0x09c6('0x5c')],'row':_0x5433ed});}function handleQuery(_0x5e2f42){logger[_0x09c6('0x59')](_0x5e2f42);return db[_0x09c6('0x60')][_0x09c6('0x61')](_0x5e2f42)[_0x09c6('0x62')](function(_0x4e3b3a){results['push'](_0x4e3b3a);})[_0x09c6('0x63')](function(_0x1677d3){logger[_0x09c6('0x5b')](_0x1677d3[_0x09c6('0x5c')]);});}function updateTzCampaigns(_0x2c0550){return new Promise(function(_0x4b4ec5,_0xce732c){var _0x30d6ab=squel[_0x09c6('0xe')]()[_0x09c6('0x32')]([_0x09c6('0x64'),_0x09c6('0x65')])['from'](_0x09c6('0x66'))[_0x09c6('0x10')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x09c6('0x12')](_0x09c6('0x67')+_0x2c0550);db[_0x09c6('0x60')]['query'](_0x30d6ab[_0x09c6('0x3a')]())[_0x09c6('0x62')](function(_0xd5fc7c){var _0x3a6c8d=[];for(var _0xf1c06d=0x0;_0xf1c06d<_0xd5fc7c[_0x09c6('0x1a')];_0xf1c06d++){_0x3a6c8d['push'](getTimezoneData(_0xd5fc7c[_0xf1c06d],tmp_campaigns));}BPromise['all'](_0x3a6c8d)[_0x09c6('0x16')](function(){_0x4b4ec5({'val':0x1});});})['catch'](function(_0x3ba960){logger['error'](_0x3ba960[_0x09c6('0x5c')]);_0x4b4ec5({'val':0x0});});});}function updateTzVoiceQueues(_0x4d9fd3){return new Promise(function(_0x36ff6a,_0x24e593){var _0x292245=squel['select']()[_0x09c6('0x32')](['voice_queues.id',_0x09c6('0x68')])[_0x09c6('0x33')](_0x09c6('0x69'))['join'](_0x09c6('0x6a'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x09c6('0x12')](_0x09c6('0x6b')+_0x4d9fd3);db[_0x09c6('0x60')][_0x09c6('0x61')](_0x292245[_0x09c6('0x3a')]())[_0x09c6('0x62')](function(_0x5713a3){var _0x1d11dc=[];for(var _0x3aea34=0x0;_0x3aea34<_0x5713a3[_0x09c6('0x1a')];_0x3aea34++){_0x1d11dc[_0x09c6('0x17')](getTimezoneData(_0x5713a3[_0x3aea34],tmp_voice_queues));}BPromise[_0x09c6('0x1b')](_0x1d11dc)['then'](function(){_0x36ff6a({'val':0x1});});})[_0x09c6('0x63')](function(_0x2f5a62){logger[_0x09c6('0x5b')](_0x2f5a62[_0x09c6('0x5c')]);_0x36ff6a({'val':0x0});});});}function getTimezoneData(_0x4a8574,_0x1b094b){return new Promise(function(_0x57f954,_0x428fff){var _0x56569b=shared[_0x09c6('0x6c')];var _0x21cb17=_0x56569b[_0x4a8574['dialTimezone']];if(_[_0x09c6('0x6d')](_0x21cb17)){_0x57f954({'ret':0x1});}else{var _0xfbb4ec=_0x21cb17[_0x09c6('0x6e')];var _0x34177b=squel[_0x09c6('0x29')]()[_0x09c6('0x2a')](_0x1b094b)[_0x09c6('0x6f')]('id',_0x4a8574['id'])[_0x09c6('0x6f')](_0x09c6('0x70'),_0xfbb4ec)[_0x09c6('0x6f')]('dialTimezone',_0x4a8574[_0x09c6('0x71')])[_0x09c6('0x3a')]();return db[_0x09c6('0x60')][_0x09c6('0x61')](_0x34177b)[_0x09c6('0x62')](function(_0x46f842){_0x57f954({'ret':0x1});})[_0x09c6('0x63')](function(_0x424211){logger['error'](_0x424211[_0x09c6('0x5c')]);_0x428fff({'ret':0x1});});}});}function handleTZQuery(_0xd67098){logger[_0x09c6('0x59')](_0xd67098);return db['sequelize']['query'](_0xd67098)['spread'](function(_0x52e53d){})['catch'](function(_0x172be7){logger['error'](_0x172be7[_0x09c6('0x5c')]);});}function main(_0x4b4abb,_0x51c2a4,_0x396336,_0x44f5bf){logger[_0x09c6('0x59')]('main',_0x4b4abb,JSON[_0x09c6('0x72')](_0x51c2a4));process['send'](_0x09c6('0x73'));var _0xd57346=_0x51c2a4[_0x09c6('0x74')];var _0x513f3c=_[_0x09c6('0x75')](_0xd57346);var _0x1324e2=_0x51c2a4[_0x09c6('0x76')];var _0x77eb87=path[_0x09c6('0x10')](config[_0x09c6('0x77')],_0x09c6('0x78'),_0x1324e2+_0x09c6('0x79'));hasTZ=_[_0x09c6('0x52')](_0xd57346)[_0x09c6('0x7a')](_0x09c6('0x71'));var _0x474c29=_[_0x09c6('0x52')](_0xd57346)[_0x09c6('0x10')]();logger[_0x09c6('0x59')](_0x09c6('0x7b'),_0x474c29);db[_0x09c6('0x7c')][_0x09c6('0x15')]({'raw':!![],'attributes':['id',_0x09c6('0x7d')]})['then'](function(_0x3cc1ed){for(var _0x570956=0x0;_0x570956<_0x3cc1ed[_0x09c6('0x1a')];_0x570956++){if(_0x3cc1ed[_0x570956][_0x09c6('0x7d')]in _0xd57346){contactItemTypes[_0x09c6('0x17')](_0x3cc1ed[_0x570956]);delete _0x513f3c[_0x3cc1ed[_0x570956][_0x09c6('0x7d')]];hasAdditionalPhones=!![];}for(var _0x11fadc in _0xd57346){if(_0x3cc1ed[_0x570956][_0x09c6('0x7d')]+'_description'===_0x11fadc){phoneDescriptions['push']({'itemTypeId':_0x3cc1ed[_0x570956]['id'],'description':_0x11fadc});delete _0x513f3c[_0x11fadc];}}}if(hasAdditionalPhones)_0x513f3c[_0x09c6('0x18')]='';var _0x180186=_[_0x09c6('0x52')](_0x513f3c)[_0x09c6('0x10')]();logger[_0x09c6('0x59')]('header',_0x180186);fs['writeFileSync'](_0x77eb87,_0x180186+'\x0a');Papa['parse'](fs[_0x09c6('0x7e')](_0x4b4abb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54fe44,_0x184b2e){try{for(var _0x527272=0x0,_0x4ee804=[];_0x527272<_0x54fe44[_0x09c6('0x7f')][_0x09c6('0x1a')];_0x527272++){stats['rows']+=0x1;if(_0x54fe44[_0x09c6('0x5e')][_0x527272]){handleError(_0x54fe44['data'][_0x527272],_0x54fe44[_0x09c6('0x5e')][_0x527272]);}else{var _0x453444=[];var _0x273605=[];var _0x5c4997={};for(var _0x40510a in _0xd57346){let _0x524713=contactItemTypes[_0x09c6('0x80')](_0x33ac70=>_0x33ac70[_0x09c6('0x7d')]===_0x40510a);let _0x54df8c=contactItemTypes['find'](_0xd60539=>_0xd60539[_0x09c6('0x7d')]+_0x09c6('0x81')===_0x40510a);if(_[_0x09c6('0x6d')](_0x524713)&&_[_0x09c6('0x6d')](_0x54df8c)){if(_0xd57346[_0x09c6('0x82')](_0x40510a)){if(_0x54fe44[_0x09c6('0x7f')][_0x527272][_0xd57346[_0x40510a]]){var _0x152058=_[_0x09c6('0x83')](_0x54fe44[_0x09c6('0x7f')][_0x527272][_0xd57346[_0x40510a]][_0x09c6('0x84')](/"/g,'\x27'));switch(_0x40510a){case'scheduledat':var _0x145a0a=moment(_0x152058,_0x09c6('0x85'),!![]);if(_0x145a0a[_0x09c6('0x86')]()){_0x4ee804[_0x09c6('0x17')]('\x22'+_0x152058+'\x22');}else{_0x453444[_0x09c6('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x09c6('0x30'):var _0x479083=parseInt(_0x152058);_0x152058=_[_0x09c6('0x87')](_0x479083)||_0x479083<0x0||_0x479083>0x4?_0x44f5bf?0x3:0x2:_0x479083;_0x4ee804['push']('\x22'+_0x152058+'\x22');break;case _0x09c6('0x31'):var _0x3e1000=parseInt(_0x152058);if(_[_0x09c6('0x88')](_0x3e1000)&&_[_0x09c6('0x7a')](_0x396336,_0x3e1000)){_0x4ee804['push']('\x22'+_0x3e1000+'\x22');}else{_0x453444[_0x09c6('0x17')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x152058)){_0x4ee804['push']('\x22'+_0x152058+'\x22');}else{_0x453444[_0x09c6('0x17')](_0x09c6('0x89'));}break;case _0x09c6('0x8a'):var _0x3845e3=moment(_0x152058,_0x09c6('0x8b'),!![]);if(_0x3845e3[_0x09c6('0x86')]()){_0x4ee804[_0x09c6('0x17')]('\x22'+_0x152058+'\x22');}else{_0x453444[_0x09c6('0x17')](_0x09c6('0x8c'));}break;case'dialTimezone':var _0x5244a8=shared[_0x09c6('0x6c')];var _0x39db9e=_0x5244a8[_0x152058];if(!_[_0x09c6('0x6d')](_0x39db9e)){var _0x2b8374=_0x39db9e['utcOffset'];_0x4ee804[_0x09c6('0x17')]('\x22'+_0x152058+'\x22');_0x4ee804[_0x09c6('0x17')]('\x22'+_0x2b8374+'\x22');}break;default:_0x4ee804[_0x09c6('0x17')]('\x22'+_0x152058+'\x22');}}else{switch(_0x40510a){case _0x09c6('0x8d'):case _0x09c6('0x2b'):_0x453444[_0x09c6('0x17')](_0x40510a+'\x20not\x20specified');break;default:_0x4ee804[_0x09c6('0x17')]('\x22\x22');}}}}else{var _0x3938a5='';if(!_[_0x09c6('0x6d')](_0x524713)){if(!_0x5c4997['hasOwnProperty'](_0x524713['id'])){if(!_[_0x09c6('0x6d')](_0x54fe44[_0x09c6('0x7f')][_0x527272][_0xd57346[_0x40510a]])){var _0x152058=_['trim'](_0x54fe44[_0x09c6('0x7f')][_0x527272][_0xd57346[_0x40510a]][_0x09c6('0x84')](/"/g,'\x27'));var _0x21b015=phoneDescriptions['find'](_0x4a02ef=>_0x4a02ef['itemTypeId']===_0x524713['id']);if(!_['isNil'](_0x21b015)){var _0x1652dd=_[_0x09c6('0x83')](_0x54fe44[_0x09c6('0x7f')][_0x527272][_0xd57346[_0x21b015[_0x09c6('0x8e')]]][_0x09c6('0x84')](/"/g,'\x27'));if(!_['isNil'](_0x1652dd))_0x152058=_0x152058+'§'+_0x1652dd;}if(_0x3938a5=='')_0x3938a5=_0x152058;else _0x3938a5+='|'+_0x152058;}_0x273605[_0x09c6('0x17')](_0x524713['id']+':'+_0x3938a5);_0x5c4997[_0x524713['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4ee804[_0x09c6('0x17')]('\x22'+_0x273605[_0x09c6('0x10')](';')+'\x22');}if(_0x453444['length']){handleError(_0x54fe44[_0x09c6('0x7f')][_0x527272],{'code':_0x09c6('0x8f'),'message':_0x453444[_0x09c6('0x10')]()});}else{fs['appendFileSync'](_0x77eb87,_0x4ee804[_0x09c6('0x10')]()+'\x0a');}_0x4ee804=[];}if(!(stats[_0x09c6('0x90')]%0xc8)){socket['emit'](_0x09c6('0x91')+_0x1324e2,stats);stats[_0x09c6('0x5e')]=[];}}if(stopped){logger[_0x09c6('0x59')](_0x09c6('0x92'));_0x184b2e[_0x09c6('0x93')]();}}catch(_0x5682e0){handleError(_0x54fe44[_0x09c6('0x7f')][_0x527272],{'code':_0x09c6('0x94'),'message':_0x5682e0[_0x09c6('0x5c')]});logger[_0x09c6('0x5b')](_0x09c6('0x95'),_0x5682e0[_0x09c6('0x5c')]);}},'complete':function(){try{var _0x1a6ca1=[];var _0x2dc077=[];var _0x568f5e=_0x09c6('0x34');if(_0x51c2a4[_0x09c6('0x96')]&&_0x51c2a4[_0x09c6('0x96')]['length']){_0x568f5e=_0x09c6('0x97')+_0x1324e2;_0x1a6ca1[_0x09c6('0x17')](_0x09c6('0x98')+_0x568f5e+_0x09c6('0x99'));}tmp_campaigns=_0x09c6('0x9a')+_0x1324e2;tmp_voice_queues='voice_queues_'+_0x1324e2;_0x2dc077[_0x09c6('0x17')](_0x09c6('0x98')+tmp_campaigns+_0x09c6('0x9b'));_0x2dc077[_0x09c6('0x17')](_0x09c6('0x98')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x09c6('0x9c')](_0x2dc077,handleTZQuery)[_0x09c6('0x16')](function(_0x26c688){updateTzCampaigns(_0x51c2a4[_0x09c6('0x3e')])['then'](function(_0x1f2c5a){updateTzVoiceQueues(_0x51c2a4['ListId'])[_0x09c6('0x16')](function(_0x1b3449){if(hasTZ)_0x180186=_0x180186[_0x09c6('0x84')](_0x09c6('0x71'),_0x09c6('0x9d'));var _0x57e4e5=util[_0x09c6('0xc')](_0x09c6('0x9e'),_0x77eb87,_0x568f5e,_0x180186,_0x51c2a4[_0x09c6('0x3e')],_0x51c2a4['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xd57346['scheduledat'])){_0x57e4e5+=_0x09c6('0x9f');}_0x1a6ca1[_0x09c6('0x17')](_0x57e4e5);if(_0x51c2a4[_0x09c6('0x96')]&&_0x51c2a4[_0x09c6('0x96')][_0x09c6('0x1a')]){_0x1a6ca1[_0x09c6('0x17')](insertCmContact(_0x51c2a4[_0x09c6('0x3e')],_0x568f5e,_0x51c2a4['duplicates'],_0xd57346));_0x1a6ca1[_0x09c6('0x17')](_0x09c6('0xa0')+_0x568f5e+';');}BPromise[_0x09c6('0x9c')](_0x1a6ca1,handleQuery)[_0x09c6('0x16')](function(_0x4973c5){BPromise[_0x09c6('0x1b')]([handleAdditionalPhones()])[_0x09c6('0x16')](function(){_0x1a6ca1=[];for(var _0x4d1665=0x0;_0x4d1665\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','all','AdditionalPhones','split','isNil','findOne','CmContactHasItem','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','select','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','into','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.priority','createdAt','recallme','\x22onlyIfOpen\x22','toString','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','message','exit','errors','code','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','stringify','send','binding','clone','socket_timestamp','.csv','includes','header','ContactItemType','name','_description','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists'];(function(_0x94f78d,_0x2a0822){var _0x4f0d4b=function(_0x51eea6){while(--_0x51eea6){_0x94f78d['push'](_0x94f78d['shift']());}};_0x4f0d4b(++_0x2a0822);}(_0xdf19,0x181));var _0x9df1=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xdf19[_0x3fb9dd];return _0x20136a;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x9df1('0x0'));var Papa=require(_0x9df1('0x1'));var util=require(_0x9df1('0x2'));var BPromise=require(_0x9df1('0x3'));var moment=require('moment');var squel=require(_0x9df1('0x4'));var Redis=require(_0x9df1('0x5'));var db=require(_0x9df1('0x6'))['db'];var config=require(_0x9df1('0x7'));var shared=require(_0x9df1('0x8'));var logger=require(_0x9df1('0x9'))(_0x9df1('0xa'));config[_0x9df1('0xb')]=_[_0x9df1('0xc')](config['redis'],{'host':_0x9df1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9df1('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9df1('0xe')](_0x9df1('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9df1('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2afadb){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))*$/[_0x9df1('0x10')](_0x2afadb);}function selectNotIn(_0x249864,_0x3f870a,_0x32f804,_0x4927c3,_0x35f171){return squel['select']()[_0x9df1('0x11')](_0x9df1('0x12'))[_0x9df1('0x13')](_0x4927c3)[_0x9df1('0x14')](_0x3f870a,null,_0x3f870a+'.id\x20=\x20'+_0x4927c3+'.'+_0x32f804)[_0x9df1('0x15')](_0x4927c3+'.'+_0x32f804+_0x9df1('0x16')+_0x249864+'.'+_0x32f804)[_0x9df1('0x15')](_0x3f870a+_0x9df1('0x17')+_0x35f171[_0x9df1('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x32b220,_0x42e2cc){promisesAdditionalPhones=[];return db['CmContact'][_0x9df1('0x18')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9df1('0x19')](function(_0x14052b){if(_0x14052b!==null){var _0x553c4a=[];for(var _0x2c405a=0x0;_0x2c405a<_0x14052b[_0x9df1('0x1a')];_0x2c405a++){var _0x2f8bb6=_0x14052b[_0x2c405a];_0x553c4a[_0x9df1('0x1b')](insertAdditionalPhones(_0x2f8bb6));}}Promise[_0x9df1('0x1c')](_0x553c4a)[_0x9df1('0x19')](function(){_0x32b220({'val':0x1});});});});}function insertAdditionalPhones(_0x51a715){return new Promise(function(_0xc5e1e,_0x15283b){var _0x307fd4=_0x51a715[_0x9df1('0x1d')];var _0x569440=_0x307fd4[_0x9df1('0x1e')](';');var _0x4b4adc=[];orderBy=0x0;for(var _0x366a79=0x0;_0x366a79<_0x569440['length'];_0x366a79++){_0x4b4adc[_0x9df1('0x1b')](splitAdditionalPhone(_0x51a715['id'],_0x569440[_0x366a79]));}Promise[_0x9df1('0x1c')](_0x4b4adc)[_0x9df1('0x19')](function(){_0xc5e1e({'val':_0x569440[_0x9df1('0x1a')]});});});}function splitAdditionalPhone(_0x32cdc5,_0x1e4055){return new Promise(function(_0x2dbbe6,_0x4c5692){var _0x4c47e7=_0x1e4055[_0x9df1('0x1e')](':');var _0x2470d4=_0x4c47e7[0x0];var _0xdd9374=_0x4c47e7[0x1];if(!_[_0x9df1('0x1f')](_0xdd9374)){var _0x8662=_0xdd9374['split']('|');var _0x17c056=[];for(var _0x157c8e=0x0;_0x157c8e<_0x8662[_0x9df1('0x1a')];_0x157c8e++){if(_0x8662[_0x157c8e]!==''){var _0x3c7462=_['filter'](promisesAdditionalPhones,{'contactId':_0x32cdc5,'phone':_0x8662[_0x157c8e]});if(_0x3c7462['length']==0x0){orderBy++;promisesAdditionalPhones[_0x9df1('0x1b')]({'contactId':_0x32cdc5,'contactTypeId':_0x2470d4,'phone':_0x8662[_0x157c8e],'orderBy':orderBy});}}}_0x2dbbe6({'ok':0x1});}else _0x2dbbe6({'res':0x0});});}function createAdditionalPhone(_0x11e03f,_0x199115,_0x2b1a01,_0x531429){var _0x23f540='';var _0x76d9ac='';var _0x1167ca=_0x2b1a01['split']('§');_0x23f540=_0x1167ca[0x0];if(_0x1167ca[_0x9df1('0x1a')]==0x2)_0x76d9ac=_0x1167ca[0x1];return new Promise(function(_0x1cba98,_0x489832){return db['CmContactHasItem'][_0x9df1('0x20')]({'where':{'CmContactId':_0x11e03f,'item':_0x23f540}})[_0x9df1('0x19')](function(_0x4c8d69){if(_0x4c8d69){return db[_0x9df1('0x21')]['update']({'ItemTypeId':_0x199115,'description':_0x76d9ac,'OrderBy':_0x531429},{'where':{'CmContactId':_0x11e03f,'item':_0x23f540}})[_0x9df1('0x19')](function(_0x3aef08){_0x1cba98({'res':_0x9df1('0x22')});});}else{return db[_0x9df1('0x21')][_0x9df1('0x23')]({'CmContactId':_0x11e03f,'item':_0x23f540,'description':_0x76d9ac,'ItemTypeId':_0x199115,'OrderBy':_0x531429,'ItemClass':_0x9df1('0x24')})[_0x9df1('0x19')](function(_0x389931){_0x1cba98({'res':_0x9df1('0x25')});});}});});}function insertCmHopper(_0x5596e6,_0x4280e3,_0x521f5b,_0x6317f1,_0x460463){var _0x14cf8c=[_0x9df1('0x26'),'cm_contacts.scheduledat',_0x9df1('0x27'),'cm_contacts.ListId',_0x4280e3+'.'+_0x6317f1,_0x9df1('0x28'),_0x9df1('0x29'),'cm_contacts.priority',_0x9df1('0x2a'),'\x22'+_0x460463+'\x22'];return squel[_0x9df1('0x2b')]()['into'](_0x9df1('0x2c'))[_0x9df1('0x2d')]([_0x9df1('0x12'),_0x9df1('0x2e'),_0x9df1('0x2f'),_0x9df1('0x30'),_0x6317f1,'createdAt',_0x9df1('0x31'),_0x9df1('0x32'),_0x9df1('0x33'),'recallme'],squel[_0x9df1('0x34')]()['fields'](_0x14cf8c)[_0x9df1('0x13')](_0x4280e3)[_0x9df1('0x14')](_0x9df1('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x4280e3+_0x9df1('0x36'))[_0x9df1('0x14')](_0x521f5b,null,_0x521f5b+'.id\x20=\x20'+_0x4280e3+'.'+_0x6317f1)[_0x9df1('0x15')](_0x4280e3+_0x9df1('0x37'),_0x5596e6)[_0x9df1('0x15')](_0x9df1('0x38'),NOW)[_0x9df1('0x15')](_0x9df1('0x39'),selectNotIn(_0x4280e3,_0x521f5b,_0x6317f1,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x9df1('0x15')](_0x9df1('0x39'),selectNotIn(_0x4280e3,_0x521f5b,_0x6317f1,'cm_hopper',[_0x9df1('0x3a')])))['toString']();}function insertCmHopperBlack(_0x8a31b5,_0x1dcd35,_0x2d85e2,_0x49bea1){var _0x37bcbc=[_0x9df1('0x26'),_0x9df1('0x27'),'cm_contacts.ListId',_0x1dcd35+'.'+_0x49bea1,_0x9df1('0x28'),_0x9df1('0x29')];return squel[_0x9df1('0x2b')]()[_0x9df1('0x3b')]('cm_hopper_black')['fromQuery'](['phone',_0x9df1('0x2f'),_0x9df1('0x30'),_0x49bea1,'createdAt',_0x9df1('0x31')],squel[_0x9df1('0x34')]()['fields'](_0x37bcbc)[_0x9df1('0x13')](_0x1dcd35)[_0x9df1('0x14')](_0x9df1('0x35'),null,_0x9df1('0x3c')+_0x1dcd35+_0x9df1('0x36'))['join'](_0x2d85e2,null,_0x2d85e2+_0x9df1('0x3d')+_0x1dcd35+'.'+_0x49bea1)[_0x9df1('0x15')](_0x1dcd35+'.CmListId\x20=\x20?',_0x8a31b5)['where'](_0x9df1('0x38'),NOW)[_0x9df1('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9df1('0x34')]()['field'](_0x9df1('0x12'))[_0x9df1('0x13')](_0x9df1('0x3e'))[_0x9df1('0x15')]('ListId\x20=\x20?',_0x8a31b5)[_0x9df1('0x15')](_0x49bea1+_0x9df1('0x16')+_0x1dcd35+'.'+_0x49bea1)))['toString']();}function insertTzCmHopper(_0x3e401f,_0x35988f,_0x46c962,_0x4ebfbe,_0x10a31a,_0x173f61){var _0x46c3ba=['cm_contacts.phone',_0x9df1('0x3f')+_0x173f61+_0x9df1('0x40'),_0x9df1('0x27'),_0x9df1('0x41'),_0x35988f+'.'+_0x4ebfbe,'cm_contacts.createdAt',_0x9df1('0x29'),_0x9df1('0x42'),_0x9df1('0x2a'),'\x22'+_0x10a31a+'\x22'];var _0x10ed8d=squel[_0x9df1('0x2b')]()[_0x9df1('0x3b')](_0x9df1('0x2c'))[_0x9df1('0x2d')]([_0x9df1('0x12'),_0x9df1('0x2e'),_0x9df1('0x2f'),_0x9df1('0x30'),_0x4ebfbe,_0x9df1('0x43'),_0x9df1('0x31'),_0x9df1('0x32'),_0x9df1('0x33'),_0x9df1('0x44')],squel[_0x9df1('0x34')]()['fields'](_0x46c3ba)['from'](_0x35988f)[_0x9df1('0x14')](_0x9df1('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x35988f+_0x9df1('0x36'))['join'](_0x46c962,null,_0x46c962+_0x9df1('0x3d')+_0x35988f+'.'+_0x4ebfbe)[_0x9df1('0x14')](_0x173f61,null,_0x173f61+_0x9df1('0x3d')+_0x35988f+'.'+_0x4ebfbe)['where'](_0x35988f+'.CmListId\x20=\x20?',_0x3e401f)['where'](_0x9df1('0x38'),NOW)[_0x9df1('0x15')](_0x9df1('0x39'),selectNotIn(_0x35988f,_0x46c962,_0x4ebfbe,_0x9df1('0x2c'),[_0x9df1('0x3a'),_0x9df1('0x45')]))[_0x9df1('0x15')](_0x9df1('0x39'),selectNotIn(_0x35988f,_0x46c962,_0x4ebfbe,'cm_hopper',[_0x9df1('0x3a')])))[_0x9df1('0x46')]();return _0x10ed8d;}function insertTzCmHopperBlack(_0x283bec,_0x51b690,_0x926b36,_0x98f599){var _0x54f04f=['cm_contacts.phone',_0x9df1('0x27'),_0x9df1('0x41'),_0x51b690+'.'+_0x98f599,_0x9df1('0x28'),'cm_contacts.updatedAt'];return squel[_0x9df1('0x2b')]()[_0x9df1('0x3b')](_0x9df1('0x3e'))['fromQuery'](['phone',_0x9df1('0x2f'),'ListId',_0x98f599,'createdAt',_0x9df1('0x31')],squel[_0x9df1('0x34')]()['fields'](_0x54f04f)[_0x9df1('0x13')](_0x51b690)[_0x9df1('0x14')]('cm_contacts',null,_0x9df1('0x3c')+_0x51b690+_0x9df1('0x36'))['join'](_0x926b36,null,_0x926b36+_0x9df1('0x3d')+_0x51b690+'.'+_0x98f599)['where'](_0x51b690+_0x9df1('0x37'),_0x283bec)['where'](_0x9df1('0x38'),NOW)[_0x9df1('0x15')](_0x9df1('0x39'),squel['select']()['field'](_0x9df1('0x12'))[_0x9df1('0x13')](_0x9df1('0x3e'))[_0x9df1('0x15')](_0x9df1('0x47'),_0x283bec)[_0x9df1('0x15')](_0x98f599+_0x9df1('0x16')+_0x51b690+'.'+_0x98f599)))[_0x9df1('0x46')]();}function insertCmHopperAdditionalPhones(_0x4d3e0){var _0x2e4e69=[_0x9df1('0x48'),_0x9df1('0x49'),_0x9df1('0x4a'),_0x9df1('0x4b'),_0x9df1('0x4c')];return squel['insert']()[_0x9df1('0x3b')](_0x9df1('0x4d'))['fromQuery']([_0x9df1('0x4e'),_0x9df1('0x12'),_0x9df1('0x4f'),_0x9df1('0x43'),_0x9df1('0x31')],squel[_0x9df1('0x34')]()[_0x9df1('0x50')](_0x2e4e69)[_0x9df1('0x13')](_0x9df1('0x2c'))[_0x9df1('0x14')]('cm_contacts',null,_0x9df1('0x51'))[_0x9df1('0x14')](_0x9df1('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x9df1('0x15')](_0x9df1('0x53'),_0x4d3e0)[_0x9df1('0x15')](_0x9df1('0x38'),NOW))[_0x9df1('0x46')]();}function insertCmContact(_0x535f62,_0x17c517,_0x5b0af6,_0x1be1d1){var _0x295adf=_[_0x9df1('0x54')](_[_0x9df1('0x55')](_0x1be1d1),['ListId',_0x9df1('0x56'),'createdAt',_0x9df1('0x31'),'scheduledAt']);return squel['insert']()[_0x9df1('0x3b')]('cm_contacts')[_0x9df1('0x2d')](_0x295adf,squel[_0x9df1('0x34')]()['fields'](_0x295adf)['from'](_0x17c517)[_0x9df1('0x15')]('('+_0x5b0af6[_0x9df1('0x14')](',')+_0x9df1('0x57'),squel[_0x9df1('0x34')]()[_0x9df1('0x50')](_0x5b0af6)[_0x9df1('0x13')](_0x9df1('0x35'))[_0x9df1('0x15')](_0x9df1('0x47'),_0x535f62)[_0x9df1('0x15')](_0x9df1('0x58')))[_0x9df1('0x15')](_0x9df1('0x59'),squel[_0x9df1('0x34')]()[_0x9df1('0x11')]('MIN(id)',_0x9df1('0x5a'))['from'](_0x17c517)['group'](_0x5b0af6[_0x9df1('0x14')](','))))[_0x9df1('0x46')]();}function handleStop(){logger[_0x9df1('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x357df2){logger[_0x9df1('0x5c')](_0x357df2[_0x9df1('0x5d')]);process[_0x9df1('0x5e')](0x1);}function handleError(_0x4185cd,_0x39ab91){stats[_0x9df1('0x5f')][_0x9df1('0x1b')]({'name':_0x39ab91[_0x9df1('0x60')],'message':_0x39ab91[_0x9df1('0x5d')],'row':_0x4185cd});}function handleQuery(_0x4ef394){logger[_0x9df1('0x5b')](_0x4ef394);return db['sequelize']['query'](_0x4ef394)[_0x9df1('0x61')](function(_0x3b4ed9){results[_0x9df1('0x1b')](_0x3b4ed9);})[_0x9df1('0x62')](function(_0x17a090){logger[_0x9df1('0x5c')](_0x17a090[_0x9df1('0x5d')]);});}function updateTzCampaigns(_0x4a9bd6){return new Promise(function(_0xb2e9ee,_0x58deff){var _0x3f38df=squel['select']()[_0x9df1('0x50')]([_0x9df1('0x63'),_0x9df1('0x64')])[_0x9df1('0x13')](_0x9df1('0x65'))[_0x9df1('0x14')](_0x9df1('0x66'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x9df1('0x15')](_0x9df1('0x67')+_0x4a9bd6);db[_0x9df1('0x68')][_0x9df1('0x69')](_0x3f38df['toString']())['spread'](function(_0x1e3f61){var _0x35b46d=[];for(var _0x6e2733=0x0;_0x6e2733<_0x1e3f61[_0x9df1('0x1a')];_0x6e2733++){_0x35b46d[_0x9df1('0x1b')](getTimezoneData(_0x1e3f61[_0x6e2733],tmp_campaigns));}BPromise[_0x9df1('0x1c')](_0x35b46d)[_0x9df1('0x19')](function(){_0xb2e9ee({'val':0x1});});})[_0x9df1('0x62')](function(_0x3a6a7b){logger['error'](_0x3a6a7b[_0x9df1('0x5d')]);_0xb2e9ee({'val':0x0});});});}function updateTzVoiceQueues(_0x5421ab){return new Promise(function(_0x5e2cb9,_0x2523a3){var _0x2bc63d=squel[_0x9df1('0x34')]()[_0x9df1('0x50')]([_0x9df1('0x6a'),_0x9df1('0x6b')])['from'](_0x9df1('0x6c'))[_0x9df1('0x14')]('voice_queues_has_cm_lists',null,_0x9df1('0x6d'))[_0x9df1('0x15')](_0x9df1('0x6e')+_0x5421ab);db[_0x9df1('0x68')][_0x9df1('0x69')](_0x2bc63d[_0x9df1('0x46')]())[_0x9df1('0x61')](function(_0x201ddf){var _0x414923=[];for(var _0x155780=0x0;_0x155780<_0x201ddf[_0x9df1('0x1a')];_0x155780++){_0x414923['push'](getTimezoneData(_0x201ddf[_0x155780],tmp_voice_queues));}BPromise[_0x9df1('0x1c')](_0x414923)['then'](function(){_0x5e2cb9({'val':0x1});});})[_0x9df1('0x62')](function(_0x561a74){logger[_0x9df1('0x5c')](_0x561a74[_0x9df1('0x5d')]);_0x5e2cb9({'val':0x0});});});}function getTimezoneData(_0x38ec61,_0x504b7e){return new Promise(function(_0x21151d,_0x304d1e){var _0x1952ec=shared[_0x9df1('0x6f')];var _0x1f2e60=_0x1952ec[_0x38ec61[_0x9df1('0x70')]];if(_['isNil'](_0x1f2e60)){_0x21151d({'ret':0x1});}else{var _0x450002=_0x1f2e60['utcOffset'];var _0x2f45e0=squel[_0x9df1('0x2b')]()[_0x9df1('0x3b')](_0x504b7e)[_0x9df1('0x71')]('id',_0x38ec61['id'])[_0x9df1('0x71')](_0x9df1('0x72'),_0x450002)['set'](_0x9df1('0x70'),_0x38ec61[_0x9df1('0x70')])['toString']();return db[_0x9df1('0x68')][_0x9df1('0x69')](_0x2f45e0)[_0x9df1('0x61')](function(_0x80125e){_0x21151d({'ret':0x1});})[_0x9df1('0x62')](function(_0x2d5b7c){logger[_0x9df1('0x5c')](_0x2d5b7c[_0x9df1('0x5d')]);_0x304d1e({'ret':0x1});});}});}function handleTZQuery(_0x3d0bbe){logger[_0x9df1('0x5b')](_0x3d0bbe);return db[_0x9df1('0x68')]['query'](_0x3d0bbe)[_0x9df1('0x61')](function(_0x1a4c3a){})[_0x9df1('0x62')](function(_0x595cf9){logger[_0x9df1('0x5c')](_0x595cf9[_0x9df1('0x5d')]);});}function main(_0x1dc8e9,_0xc4aff2,_0x116e84,_0x54772b){logger[_0x9df1('0x5b')]('main',_0x1dc8e9,JSON[_0x9df1('0x73')](_0xc4aff2));process[_0x9df1('0x74')]('start');var _0xcf6a1f=_0xc4aff2[_0x9df1('0x75')];var _0xb5035b=_[_0x9df1('0x76')](_0xcf6a1f);var _0x4fa71b=_0xc4aff2[_0x9df1('0x77')];var _0x265721=path['join'](config['root'],'server/files/tmp',_0x4fa71b+_0x9df1('0x78'));hasTZ=_[_0x9df1('0x55')](_0xcf6a1f)[_0x9df1('0x79')](_0x9df1('0x70'));var _0x23b0bb=_[_0x9df1('0x55')](_0xcf6a1f)[_0x9df1('0x14')]();logger[_0x9df1('0x5b')](_0x9df1('0x7a'),_0x23b0bb);db[_0x9df1('0x7b')][_0x9df1('0x18')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x1e6a99){for(var _0xc16c8a=0x0;_0xc16c8a<_0x1e6a99['length'];_0xc16c8a++){if(_0x1e6a99[_0xc16c8a][_0x9df1('0x7c')]in _0xcf6a1f){contactItemTypes[_0x9df1('0x1b')](_0x1e6a99[_0xc16c8a]);delete _0xb5035b[_0x1e6a99[_0xc16c8a][_0x9df1('0x7c')]];hasAdditionalPhones=!![];}for(var _0x164a38 in _0xcf6a1f){if(_0x1e6a99[_0xc16c8a][_0x9df1('0x7c')]+_0x9df1('0x7d')===_0x164a38){phoneDescriptions[_0x9df1('0x1b')]({'itemTypeId':_0x1e6a99[_0xc16c8a]['id'],'description':_0x164a38});delete _0xb5035b[_0x164a38];}}}if(hasAdditionalPhones)_0xb5035b[_0x9df1('0x1d')]='';var _0x6096cc=_['keys'](_0xb5035b)[_0x9df1('0x14')]();logger['info'](_0x9df1('0x7a'),_0x6096cc);fs['writeFileSync'](_0x265721,_0x6096cc+'\x0a');Papa['parse'](fs['createReadStream'](_0x1dc8e9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x59b959,_0x394038){try{for(var _0x150c8d=0x0,_0x45d1b3=[];_0x150c8d<_0x59b959[_0x9df1('0x7e')]['length'];_0x150c8d++){stats[_0x9df1('0x7f')]+=0x1;if(_0x59b959[_0x9df1('0x5f')][_0x150c8d]){handleError(_0x59b959[_0x9df1('0x7e')][_0x150c8d],_0x59b959['errors'][_0x150c8d]);}else{var _0x5a8398=[];var _0x26d4bb=[];var _0x30da48={};for(var _0x5baed4 in _0xcf6a1f){let _0x3db14f=contactItemTypes[_0x9df1('0x80')](_0x10e20a=>_0x10e20a['name']===_0x5baed4);let _0x35db05=contactItemTypes[_0x9df1('0x80')](_0x485844=>_0x485844[_0x9df1('0x7c')]+_0x9df1('0x7d')===_0x5baed4);if(_[_0x9df1('0x1f')](_0x3db14f)&&_['isNil'](_0x35db05)){if(_0xcf6a1f['hasOwnProperty'](_0x5baed4)){if(_0x59b959[_0x9df1('0x7e')][_0x150c8d][_0xcf6a1f[_0x5baed4]]){var _0x5aac2b=_[_0x9df1('0x81')](_0x59b959[_0x9df1('0x7e')][_0x150c8d][_0xcf6a1f[_0x5baed4]][_0x9df1('0x82')](/"/g,'\x27'));switch(_0x5baed4){case _0x9df1('0x2e'):var _0x1349f4=moment(_0x5aac2b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1349f4[_0x9df1('0x83')]()){_0x45d1b3[_0x9df1('0x1b')]('\x22'+_0x5aac2b+'\x22');}else{_0x5a8398[_0x9df1('0x1b')](_0x9df1('0x84'));}break;case'priority':var _0x988579=parseInt(_0x5aac2b);_0x5aac2b=_[_0x9df1('0x85')](_0x988579)||_0x988579<0x0||_0x988579>0x4?_0x54772b?0x3:0x2:_0x988579;_0x45d1b3[_0x9df1('0x1b')]('\x22'+_0x5aac2b+'\x22');break;case _0x9df1('0x33'):var _0x395a7a=parseInt(_0x5aac2b);if(_[_0x9df1('0x86')](_0x395a7a)&&_[_0x9df1('0x79')](_0x116e84,_0x395a7a)){_0x45d1b3['push']('\x22'+_0x395a7a+'\x22');}else{_0x5a8398[_0x9df1('0x1b')](_0x9df1('0x87'));}break;case'email':if(isEmail(_0x5aac2b)){_0x45d1b3['push']('\x22'+_0x5aac2b+'\x22');}else{_0x5a8398[_0x9df1('0x1b')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2ae6af=moment(_0x5aac2b,'YYYY-MM-DD',!![]);if(_0x2ae6af['isValid']()){_0x45d1b3[_0x9df1('0x1b')]('\x22'+_0x5aac2b+'\x22');}else{_0x5a8398['push'](_0x9df1('0x88'));}break;case _0x9df1('0x70'):var _0x226994=shared[_0x9df1('0x6f')];var _0x160d6f=_0x226994[_0x5aac2b];if(!_['isNil'](_0x160d6f)){var _0x794742=_0x160d6f[_0x9df1('0x89')];_0x45d1b3['push']('\x22'+_0x5aac2b+'\x22');_0x45d1b3['push']('\x22'+_0x794742+'\x22');}break;default:_0x45d1b3[_0x9df1('0x1b')]('\x22'+_0x5aac2b+'\x22');}}else{switch(_0x5baed4){case _0x9df1('0x8a'):case _0x9df1('0x12'):_0x5a8398['push'](_0x5baed4+_0x9df1('0x8b'));break;default:_0x45d1b3[_0x9df1('0x1b')]('\x22\x22');}}}}else{var _0x3d1abf='';if(!_[_0x9df1('0x1f')](_0x3db14f)){if(!_0x30da48[_0x9df1('0x8c')](_0x3db14f['id'])){if(!_[_0x9df1('0x1f')](_0x59b959[_0x9df1('0x7e')][_0x150c8d][_0xcf6a1f[_0x5baed4]])){var _0x5aac2b=_[_0x9df1('0x81')](_0x59b959[_0x9df1('0x7e')][_0x150c8d][_0xcf6a1f[_0x5baed4]][_0x9df1('0x82')](/"/g,'\x27'));var _0x586f5f=phoneDescriptions['find'](_0x179e55=>_0x179e55[_0x9df1('0x8d')]===_0x3db14f['id']);if(!_[_0x9df1('0x1f')](_0x586f5f)){var _0x10d5c9=_[_0x9df1('0x81')](_0x59b959[_0x9df1('0x7e')][_0x150c8d][_0xcf6a1f[_0x586f5f[_0x9df1('0x8e')]]]['replace'](/"/g,'\x27'));if(!_[_0x9df1('0x1f')](_0x10d5c9))_0x5aac2b=_0x5aac2b+'§'+_0x10d5c9;}if(_0x3d1abf=='')_0x3d1abf=_0x5aac2b;else _0x3d1abf+='|'+_0x5aac2b;}_0x26d4bb[_0x9df1('0x1b')](_0x3db14f['id']+':'+_0x3d1abf);_0x30da48[_0x3db14f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45d1b3[_0x9df1('0x1b')]('\x22'+_0x26d4bb[_0x9df1('0x14')](';')+'\x22');}if(_0x5a8398['length']){handleError(_0x59b959['data'][_0x150c8d],{'code':'SystemRow','message':_0x5a8398['join']()});}else{fs[_0x9df1('0x8f')](_0x265721,_0x45d1b3[_0x9df1('0x14')]()+'\x0a');}_0x45d1b3=[];}if(!(stats[_0x9df1('0x7f')]%0xc8)){socket[_0x9df1('0x90')](_0x9df1('0x91')+_0x4fa71b,stats);stats[_0x9df1('0x5f')]=[];}}if(stopped){logger[_0x9df1('0x5b')](_0x9df1('0x92'));_0x394038['abort']();}}catch(_0x264e35){handleError(_0x59b959[_0x9df1('0x7e')][_0x150c8d],{'code':_0x9df1('0x93'),'message':_0x264e35[_0x9df1('0x5d')]});logger['error'](_0x9df1('0x94'),_0x264e35['message']);}},'complete':function(){try{var _0x5bfa75=[];var _0x562033=[];var _0xaa561f=_0x9df1('0x35');if(_0xc4aff2[_0x9df1('0x95')]&&_0xc4aff2[_0x9df1('0x95')][_0x9df1('0x1a')]){_0xaa561f=_0x9df1('0x96')+_0x4fa71b;_0x5bfa75[_0x9df1('0x1b')](_0x9df1('0x97')+_0xaa561f+_0x9df1('0x98'));}tmp_campaigns='campaigns_'+_0x4fa71b;tmp_voice_queues=_0x9df1('0x99')+_0x4fa71b;_0x562033[_0x9df1('0x1b')](_0x9df1('0x97')+tmp_campaigns+_0x9df1('0x9a'));_0x562033[_0x9df1('0x1b')](_0x9df1('0x97')+tmp_voice_queues+_0x9df1('0x9a'));BPromise['each'](_0x562033,handleTZQuery)[_0x9df1('0x19')](function(_0x22a036){updateTzCampaigns(_0xc4aff2[_0x9df1('0x30')])[_0x9df1('0x19')](function(_0x4b33e7){updateTzVoiceQueues(_0xc4aff2[_0x9df1('0x30')])[_0x9df1('0x19')](function(_0x1af823){if(hasTZ)_0x6096cc=_0x6096cc[_0x9df1('0x82')](_0x9df1('0x70'),_0x9df1('0x9b'));var _0x2aa366=util[_0x9df1('0xe')](_0x9df1('0x9c'),_0x265721,_0xaa561f,_0x6096cc,_0xc4aff2[_0x9df1('0x30')],_0xc4aff2[_0x9df1('0x56')]||null,NOW,NOW);if(_[_0x9df1('0x1f')](_0xcf6a1f[_0x9df1('0x2e')])){_0x2aa366+=_0x9df1('0x9d');}_0x5bfa75[_0x9df1('0x1b')](_0x2aa366);if(_0xc4aff2[_0x9df1('0x95')]&&_0xc4aff2['duplicates'][_0x9df1('0x1a')]){_0x5bfa75[_0x9df1('0x1b')](insertCmContact(_0xc4aff2[_0x9df1('0x30')],_0xaa561f,_0xc4aff2[_0x9df1('0x95')],_0xcf6a1f));_0x5bfa75[_0x9df1('0x1b')](_0x9df1('0x9e')+_0xaa561f+';');}BPromise[_0x9df1('0x9f')](_0x5bfa75,handleQuery)['then'](function(_0x1cd21c){BPromise[_0x9df1('0x1c')]([handleAdditionalPhones()])['then'](function(){_0x5bfa75=[];for(var _0x890b62=0x0;_0x890b62\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','where','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','PHONE','CmContact','CmHopper'];(function(_0x32bd20,_0x183ce2){var _0x3dfe39=function(_0x23466d){while(--_0x23466d){_0x32bd20['push'](_0x32bd20['shift']());}};_0x3dfe39(++_0x183ce2);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x4dd7a6,_0x1299d6){_0x4dd7a6=_0x4dd7a6-0x0;var _0x3fd202=_0x1b8e[_0x4dd7a6];return _0x3fd202;};'use strict';var fs=require('fs');var path=require(_0xe1b8('0x0'));var _=require(_0xe1b8('0x1'));var Papa=require(_0xe1b8('0x2'));var util=require('util');var BPromise=require(_0xe1b8('0x3'));var moment=require(_0xe1b8('0x4'));var squel=require('squel');var Redis=require(_0xe1b8('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xe1b8('0x6'))(_0xe1b8('0x7'));config[_0xe1b8('0x8')]=_[_0xe1b8('0x9')](config[_0xe1b8('0x8')],{'host':_0xe1b8('0xa'),'port':0x18eb});var socket=require(_0xe1b8('0xb'))(new Redis(config[_0xe1b8('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()[_0xe1b8('0xc')](_0xe1b8('0xd'));var tempTableName=_0xe1b8('0xe')+moment()[_0xe1b8('0xc')](_0xe1b8('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3519cf){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))*$/[_0xe1b8('0x10')](_0x3519cf);}function selectNotIn(_0x222d88,_0x2a98a7,_0x1f06a4,_0xda4285,_0x2723b2){return squel[_0xe1b8('0x11')]()[_0xe1b8('0x12')](_0xe1b8('0x13'))['from'](_0xda4285)[_0xe1b8('0x14')](_0x2a98a7,null,_0x2a98a7+'.id\x20=\x20'+_0xda4285+'.'+_0x1f06a4)[_0xe1b8('0x15')](_0xda4285+'.'+_0x1f06a4+'\x20=\x20'+_0x222d88+'.'+_0x1f06a4)[_0xe1b8('0x15')](_0x2a98a7+'.dialCheckDuplicateType\x20IN\x20('+_0x2723b2[_0xe1b8('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xc0ed73,_0x58580c){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0xe1b8('0x16')+tempTableName)[_0xe1b8('0x17')](function(_0x8e0b45){if(_0x8e0b45!==null){var _0x548bc7=[];for(var _0x584938=0x0;_0x584938<_0x8e0b45[_0xe1b8('0x18')];_0x584938++){var _0x55e1c1=_0x8e0b45[_0x584938];if(!_[_0xe1b8('0x19')](_0x55e1c1[_0xe1b8('0x13')])){if(!_[_0xe1b8('0x19')](_0x55e1c1[_0xe1b8('0x1a')]))_0x548bc7[_0xe1b8('0x1b')](insertAdditionalPhones(_0x55e1c1));promisesContact[_0xe1b8('0x1b')]({'contact':_0x55e1c1});}}}Promise[_0xe1b8('0x1c')](_0x548bc7)[_0xe1b8('0x1d')](function(){_0xc0ed73({'val':0x1});});})[_0xe1b8('0x1e')](function(_0xcddd09){logger[_0xe1b8('0x1f')](_0xcddd09['message']);});});}function insertAdditionalPhones(_0x5e8e29){return new Promise(function(_0x5ec53e,_0x26108c){var _0x41db31=_0x5e8e29[_0xe1b8('0x1a')];if(_[_0xe1b8('0x19')](_0x41db31))_0x26108c({'val':0x0});else{var _0x3ca75c=_0x41db31[_0xe1b8('0x20')](';');var _0xfc539c=[];orderBy=0x0;for(var _0x5dd7a8=0x0;_0x5dd7a8<_0x3ca75c[_0xe1b8('0x18')];_0x5dd7a8++){_0xfc539c[_0xe1b8('0x1b')](splitAdditionalPhone(_0x5e8e29['id'],_0x3ca75c[_0x5dd7a8]));}Promise[_0xe1b8('0x1c')](_0xfc539c)['then'](function(){_0x5ec53e({'val':_0x3ca75c['length']});});}});}function splitAdditionalPhone(_0x318783,_0x19d4e1){return new Promise(function(_0x96863e,_0x13cb23){var _0x1de918=_0x19d4e1[_0xe1b8('0x20')](':');var _0xfd2ce3=_0x1de918[0x0];var _0x4382fc=_0x1de918[0x1];if(_0x4382fc!==''){var _0x36398d=_0x4382fc[_0xe1b8('0x20')]('|');var _0x48fa6a=[];for(var _0x235669=0x0;_0x235669<_0x36398d[_0xe1b8('0x18')];_0x235669++){if(_0x36398d[_0x235669]!==''){var _0x4605e9=_[_0xe1b8('0x21')](promisesAdditionalPhones,{'contactId':_0x318783,'phone':_0x36398d[_0x235669]});if(_0x4605e9['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x318783,'contactTypeId':_0xfd2ce3,'phone':_0x36398d[_0x235669],'orderBy':orderBy});}}}_0x96863e({'ok':0x1});}else _0x96863e({'res':0x0});});}function createAdditionalPhone(_0x58c93e,_0x1e4ecd,_0x539bcf,_0x226aa2){var _0x2a2ae3='';var _0x4d7db8='';var _0x59bc1b=_0x539bcf['split']('§');_0x2a2ae3=_0x59bc1b[0x0];if(_0x59bc1b['length']==0x2)_0x4d7db8=_0x59bc1b[0x1];return new Promise(function(_0xfcda1b,_0x453ef9){return db[_0xe1b8('0x22')][_0xe1b8('0x23')]({'where':{'CmContactId':_0x58c93e,'item':_0x2a2ae3}})['then'](function(_0x199ac1){if(_0x199ac1){return db[_0xe1b8('0x22')][_0xe1b8('0x24')]({'ItemTypeId':_0x1e4ecd,'description':_0x4d7db8,'OrderBy':_0x226aa2},{'where':{'CmContactId':_0x58c93e,'item':_0x2a2ae3}})[_0xe1b8('0x1d')](function(_0x31c8ba){_0xfcda1b({'res':'updated'});});}else{return db[_0xe1b8('0x22')]['create']({'CmContactId':_0x58c93e,'item':_0x2a2ae3,'ItemTypeId':_0x1e4ecd,'description':_0x4d7db8,'OrderBy':_0x226aa2,'ItemClass':_0xe1b8('0x25')})[_0xe1b8('0x1d')](function(_0x3977a7){_0xfcda1b({'res':'inserted'});});}});});}function updateContact(_0x119b53){return new Promise(function(_0x587b86,_0x28dad5){var _0x3532e7=_0x119b53['id'];delete _0x119b53['id'];return db[_0xe1b8('0x26')][_0xe1b8('0x24')](_0x119b53,{'where':{'id':_0x3532e7}})[_0xe1b8('0x1d')](function(_0x50a40f){updatedRows+=0x1;return db[_0xe1b8('0x27')][_0xe1b8('0x24')]({'phone':_0x119b53[_0xe1b8('0x13')]},{'where':{'ContactId':_0x3532e7}})[_0xe1b8('0x1d')](function(_0x534d3d){_0x587b86({'ret':'OK'});});});});}function insertCmHopper(_0x1b0bbc,_0x843918,_0x36b065,_0x27abb0,_0x28ccde){var _0x582409=[_0xe1b8('0x28'),'cm_contacts.scheduledat',_0xe1b8('0x29'),_0xe1b8('0x2a'),_0x843918+'.'+_0x27abb0,'cm_contacts.createdAt',_0xe1b8('0x2b'),_0xe1b8('0x2c'),_0xe1b8('0x2d'),'\x22'+_0x28ccde+'\x22'];return squel[_0xe1b8('0x2e')]()['into'](_0xe1b8('0x2f'))[_0xe1b8('0x30')]([_0xe1b8('0x13'),_0xe1b8('0x31'),_0xe1b8('0x32'),_0xe1b8('0x33'),_0x27abb0,_0xe1b8('0x34'),_0xe1b8('0x35'),_0xe1b8('0x36'),_0xe1b8('0x37'),_0xe1b8('0x38')],squel[_0xe1b8('0x11')]()[_0xe1b8('0x39')](_0x582409)['from'](_0x843918)[_0xe1b8('0x14')](_0xe1b8('0x3a'),null,_0xe1b8('0x3b')+_0x843918+_0xe1b8('0x3c'))[_0xe1b8('0x14')](_0x36b065,null,_0x36b065+_0xe1b8('0x3d')+_0x843918+'.'+_0x27abb0)[_0xe1b8('0x15')](_0x843918+_0xe1b8('0x3e'),_0x1b0bbc)[_0xe1b8('0x15')](_0xe1b8('0x3f'),NOW)['where'](_0xe1b8('0x40'),selectNotIn(_0x843918,_0x36b065,_0x27abb0,_0xe1b8('0x2f'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xe1b8('0x15')](_0xe1b8('0x40'),selectNotIn(_0x843918,_0x36b065,_0x27abb0,'cm_hopper',['\x22always\x22'])))[_0xe1b8('0x41')]();}function insertCmHopperBlack(_0x5612a4,_0x4fc7ab,_0x114fb7,_0x104368){var _0x34cd73=[_0xe1b8('0x28'),_0xe1b8('0x29'),_0xe1b8('0x2a'),_0x4fc7ab+'.'+_0x104368,_0xe1b8('0x42'),_0xe1b8('0x2b')];return squel[_0xe1b8('0x2e')]()[_0xe1b8('0x43')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0xe1b8('0x33'),_0x104368,_0xe1b8('0x34'),_0xe1b8('0x35')],squel[_0xe1b8('0x11')]()[_0xe1b8('0x39')](_0x34cd73)[_0xe1b8('0x44')](_0x4fc7ab)[_0xe1b8('0x14')]('cm_contacts',null,_0xe1b8('0x3b')+_0x4fc7ab+'.CmListId')[_0xe1b8('0x14')](_0x114fb7,null,_0x114fb7+_0xe1b8('0x3d')+_0x4fc7ab+'.'+_0x104368)[_0xe1b8('0x15')](_0x4fc7ab+_0xe1b8('0x3e'),_0x5612a4)[_0xe1b8('0x15')](_0xe1b8('0x3f'),NOW)[_0xe1b8('0x15')](_0xe1b8('0x40'),squel[_0xe1b8('0x11')]()['field'](_0xe1b8('0x13'))['from'](_0xe1b8('0x45'))[_0xe1b8('0x15')](_0xe1b8('0x46'),_0x5612a4)[_0xe1b8('0x15')](_0x104368+_0xe1b8('0x47'),_0x4fc7ab+'.'+_0x104368)))[_0xe1b8('0x41')]();}function insertCmHopperAdditionalPhones(_0x1ef37c){var _0x13bbf9=[_0xe1b8('0x48'),_0xe1b8('0x49'),_0xe1b8('0x4a'),_0xe1b8('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0xe1b8('0x2e')]()[_0xe1b8('0x43')](_0xe1b8('0x4c'))[_0xe1b8('0x30')](['CmHopperId',_0xe1b8('0x13'),_0xe1b8('0x4d'),'createdAt',_0xe1b8('0x35')],squel[_0xe1b8('0x11')]()[_0xe1b8('0x39')](_0x13bbf9)['from']('cm_hopper')[_0xe1b8('0x14')]('cm_contacts',null,_0xe1b8('0x4e'))[_0xe1b8('0x14')](_0xe1b8('0x4f'),null,_0xe1b8('0x50'))['where'](_0xe1b8('0x51'),_0x1ef37c)['where'](_0xe1b8('0x3f'),NOW))[_0xe1b8('0x41')]();}function insertCmContact(_0x46dc26,_0x1b8f46,_0x346ca4,_0x56eb77){var _0x401dd1=_[_0xe1b8('0x52')](_['keys'](_0x56eb77),[_0xe1b8('0x33'),_0xe1b8('0x53'),'createdAt',_0xe1b8('0x35')]);return squel[_0xe1b8('0x2e')]()['into'](_0xe1b8('0x3a'))[_0xe1b8('0x30')](_0x401dd1,squel[_0xe1b8('0x11')]()[_0xe1b8('0x39')](_0x401dd1)[_0xe1b8('0x44')](_0x1b8f46)[_0xe1b8('0x15')]('('+_0x346ca4['join'](',')+_0xe1b8('0x54'),squel[_0xe1b8('0x11')]()['fields'](_0x346ca4)['from']('cm_contacts')[_0xe1b8('0x15')](_0xe1b8('0x46'),_0x46dc26))['where'](_0xe1b8('0x55'),squel['select']()['field']('MIN(id)',_0xe1b8('0x56'))['from'](_0x1b8f46)[_0xe1b8('0x57')](_0x346ca4[_0xe1b8('0x14')](','))))['toString']();}function handleStop(){logger['info'](_0xe1b8('0x58'));stopped=!![];}function handleUncaughtException(_0x47498d){logger[_0xe1b8('0x1f')](_0x47498d['message']);process['exit'](0x1);}function handleError(_0x59a2ec,_0x511098){stats[_0xe1b8('0x59')]['push']({'name':_0x511098['code'],'message':_0x511098['message'],'row':_0x59a2ec});}function handleQuery(_0x186fd6){logger['info'](_0x186fd6);return db[_0xe1b8('0x5a')][_0xe1b8('0x5b')](_0x186fd6)['spread'](function(_0x219f2f){results[_0xe1b8('0x1b')](_0x219f2f);})[_0xe1b8('0x1e')](function(_0x19352c){logger[_0xe1b8('0x1f')](_0x19352c[_0xe1b8('0x5c')]);});}function main(_0x14cb32,_0x352ea4,_0x152463,_0x24d709){logger[_0xe1b8('0x5d')]('main',_0x14cb32,JSON['stringify'](_0x352ea4));process[_0xe1b8('0x5e')]('start');var _0x589899=_0x352ea4[_0xe1b8('0x5f')];var _0x56a39b=_[_0xe1b8('0x60')](_0x589899);var _0x3e9bc8=_0x352ea4[_0xe1b8('0x61')];var _0x53c624=path['join'](config[_0xe1b8('0x62')],_0xe1b8('0x63'),_0x3e9bc8+_0xe1b8('0x64'));logger[_0xe1b8('0x5d')](_0xe1b8('0x65'),_0x352ea4);db[_0xe1b8('0x66')]['findAll']({'raw':!![],'attributes':['id',_0xe1b8('0x67')]})[_0xe1b8('0x1d')](function(_0x367bf5){for(var _0x2f39ee=0x0;_0x2f39ee<_0x367bf5['length'];_0x2f39ee++){if(_0x367bf5[_0x2f39ee][_0xe1b8('0x67')]in _0x589899){contactItemTypes['push'](_0x367bf5[_0x2f39ee]);delete _0x56a39b[_0x367bf5[_0x2f39ee][_0xe1b8('0x67')]];hasAdditionalPhones=!![];}for(var _0x55eae4 in _0x589899){if(_0x367bf5[_0x2f39ee][_0xe1b8('0x67')]+_0xe1b8('0x68')===_0x55eae4){phoneDescriptions['push']({'itemTypeId':_0x367bf5[_0x2f39ee]['id'],'description':_0x55eae4});delete _0x56a39b[_0x55eae4];}}}if(hasAdditionalPhones)_0x56a39b['AdditionalPhones']='';var _0x2d017f=_['keys'](_0x56a39b)[_0xe1b8('0x14')]();logger['info'](_0xe1b8('0x69'),_0x2d017f);fs[_0xe1b8('0x6a')](_0x53c624,_0x2d017f+'\x0a');Papa['parse'](fs[_0xe1b8('0x6b')](_0x14cb32),{'header':!![],'skipEmptyLines':!![],'step':function(_0x328a37,_0x885a){try{for(var _0x57696d=0x0,_0x1095fc=[];_0x57696d<_0x328a37[_0xe1b8('0x6c')][_0xe1b8('0x18')];_0x57696d++){stats[_0xe1b8('0x6d')]+=0x1;if(_0x328a37[_0xe1b8('0x59')][_0x57696d]){handleError(_0x328a37[_0xe1b8('0x6c')][_0x57696d],_0x328a37['errors'][_0x57696d]);}else{var _0x329869=[];var _0x461778=[];var _0x285420={};for(var _0x5ba778 in _0x589899){let _0x31ee87=contactItemTypes['find'](_0x27e7d9=>_0x27e7d9[_0xe1b8('0x67')]===_0x5ba778);let _0xd80f50=contactItemTypes[_0xe1b8('0x6e')](_0x2704ae=>_0x2704ae[_0xe1b8('0x67')]+'_description'===_0x5ba778);if(_[_0xe1b8('0x19')](_0x31ee87)&&_['isNil'](_0xd80f50)){if(_0x589899[_0xe1b8('0x6f')](_0x5ba778)){if(_0x328a37[_0xe1b8('0x6c')][_0x57696d][_0x589899[_0x5ba778]]){var _0x1d8ba3=_[_0xe1b8('0x70')](_0x328a37[_0xe1b8('0x6c')][_0x57696d][_0x589899[_0x5ba778]]['replace'](/"/g,'\x27'));switch(_0x5ba778){case _0xe1b8('0x31'):var _0x5294ac=moment(_0x1d8ba3,_0xe1b8('0xd'),!![]);if(_0x5294ac['isValid']()){_0x1095fc[_0xe1b8('0x1b')]('\x22'+_0x1d8ba3+'\x22');}else{_0x329869[_0xe1b8('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe1b8('0x36'):var _0x424f8c=parseInt(_0x1d8ba3);_0x1d8ba3=_[_0xe1b8('0x71')](_0x424f8c)||_0x424f8c<0x0||_0x424f8c>0x4?_0x24d709?0x3:0x2:_0x424f8c;_0x1095fc[_0xe1b8('0x1b')]('\x22'+_0x1d8ba3+'\x22');break;case _0xe1b8('0x37'):var _0x4cf444=parseInt(_0x1d8ba3);if(_[_0xe1b8('0x72')](_0x4cf444)&&_['includes'](_0x152463,_0x4cf444)){_0x1095fc[_0xe1b8('0x1b')]('\x22'+_0x4cf444+'\x22');}else{_0x329869[_0xe1b8('0x1b')](_0xe1b8('0x73'));}break;case _0xe1b8('0x74'):if(isEmail(_0x1d8ba3)){_0x1095fc[_0xe1b8('0x1b')]('\x22'+_0x1d8ba3+'\x22');}else{_0x329869['push'](_0xe1b8('0x75'));}break;case _0xe1b8('0x76'):var _0x33ad98=moment(_0x1d8ba3,_0xe1b8('0x77'),!![]);if(_0x33ad98['isValid']()){_0x1095fc['push']('\x22'+_0x1d8ba3+'\x22');}else{_0x329869[_0xe1b8('0x1b')](_0xe1b8('0x78'));}break;default:_0x1095fc['push']('\x22'+_0x1d8ba3+'\x22');}}else{switch(_0x5ba778){case'firstName':case _0xe1b8('0x13'):_0x329869[_0xe1b8('0x1b')](_0x5ba778+_0xe1b8('0x79'));break;default:_0x1095fc[_0xe1b8('0x1b')]('\x22\x22');}}}}else{var _0x56c18b='';if(!_[_0xe1b8('0x19')](_0x31ee87)){if(!_0x285420[_0xe1b8('0x6f')](_0x31ee87['id'])){for(var _0x354ce9=0x0;_0x354ce9<_0x589899[_0x5ba778]['length'];_0x354ce9++){var _0x1d8ba3=_[_0xe1b8('0x70')](_0x328a37[_0xe1b8('0x6c')][_0x57696d][_0x589899[_0x5ba778][_0x354ce9]][_0xe1b8('0x7a')](/"/g,'\x27'));var _0x597363=phoneDescriptions['find'](_0x47a45c=>_0x47a45c['itemTypeId']===_0x31ee87['id']);if(!_[_0xe1b8('0x19')](_0x597363)){var _0x5048b5=_[_0xe1b8('0x70')](_0x328a37[_0xe1b8('0x6c')][_0x57696d][_0x589899[_0x597363[_0xe1b8('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x5048b5))_0x1d8ba3=_0x1d8ba3+'§'+_0x5048b5;}if(_0x56c18b=='')_0x56c18b=_0x1d8ba3;else _0x56c18b+='|'+_0x1d8ba3;}_0x461778[_0xe1b8('0x1b')](_0x31ee87['id']+':'+_0x56c18b);_0x285420[_0x31ee87['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1095fc[_0xe1b8('0x1b')]('\x22'+_0x461778[_0xe1b8('0x14')](';')+'\x22');}if(_0x329869['length']){handleError(_0x328a37[_0xe1b8('0x6c')][_0x57696d],{'code':'SystemRow','message':_0x329869['join']()});}else{fs[_0xe1b8('0x7c')](_0x53c624,_0x1095fc[_0xe1b8('0x14')]()+'\x0a');}_0x1095fc=[];}if(!(stats[_0xe1b8('0x6d')]%0xc8)){socket[_0xe1b8('0x7d')](_0xe1b8('0x7e')+_0x3e9bc8,stats);stats[_0xe1b8('0x59')]=[];}}if(stopped){logger[_0xe1b8('0x5d')](_0xe1b8('0x7f'));_0x885a[_0xe1b8('0x80')]();}}catch(_0x2932f2){handleError(_0x328a37['data'][_0x57696d],{'code':'SystemError','message':_0x2932f2[_0xe1b8('0x5c')]});logger[_0xe1b8('0x1f')](_0xe1b8('0x81'),_0x2932f2[_0xe1b8('0x5c')]);}},'complete':function(){try{var _0x455576=[];var _0x51de38=tempTableName;_0x455576[_0xe1b8('0x1b')](_0xe1b8('0x82')+_0x51de38+_0xe1b8('0x83'));logger[_0xe1b8('0x5d')]('CIS\x20len',contactItemTypes[_0xe1b8('0x18')]);var _0x19e4c8=util[_0xe1b8('0xc')](_0xe1b8('0x84'),_0x53c624,_0x51de38,_0x2d017f,_0x352ea4[_0xe1b8('0x33')],_0x352ea4[_0xe1b8('0x53')]||null,NOW,NOW);if(_[_0xe1b8('0x19')](_0x589899[_0xe1b8('0x31')])){_0x19e4c8+=_0xe1b8('0x85');}_0x455576['push'](_0x19e4c8);BPromise[_0xe1b8('0x86')](_0x455576,handleQuery)['then'](function(_0x12669d){BPromise[_0xe1b8('0x1c')]([handleAdditionalPhones()])[_0xe1b8('0x1d')](function(){_0x455576=[];for(var _0x1e4488=0x0;_0x1e4488\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','spread','length','isNil','AdditionalPhones','push','then','catch','error','message','all','split','CmContactHasItem','findOne','update','updated','inserted','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','priority','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','insert','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','.CmListId','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','field','MIN(id)','min_id','Received\x20SIGINT','exit','errors'];(function(_0x557055,_0x1fa087){var _0x1abcfa=function(_0x4f0f48){while(--_0x4f0f48){_0x557055['push'](_0x557055['shift']());}};_0x1abcfa(++_0x1fa087);}(_0x45d8,0x174));var _0x845d=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x45d8[_0x65c903];return _0x23e1d7;};'use strict';var fs=require('fs');var path=require(_0x845d('0x0'));var _=require(_0x845d('0x1'));var Papa=require(_0x845d('0x2'));var util=require(_0x845d('0x3'));var BPromise=require(_0x845d('0x4'));var moment=require(_0x845d('0x5'));var squel=require('squel');var Redis=require(_0x845d('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x845d('0x7'));var logger=require(_0x845d('0x8'))('import');config['redis']=_[_0x845d('0x9')](config['redis'],{'host':_0x845d('0xa'),'port':0x18eb});var socket=require(_0x845d('0xb'))(new Redis(config[_0x845d('0xc')]));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()[_0x845d('0xd')](_0x845d('0xe'));var tempTableName=_0x845d('0xf')+moment()['format'](_0x845d('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x234efb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x234efb);}function selectNotIn(_0x5d4128,_0x1a2afb,_0x4600cc,_0x3cf082,_0x10deb0){return squel[_0x845d('0x11')]()['field'](_0x845d('0x12'))[_0x845d('0x13')](_0x3cf082)[_0x845d('0x14')](_0x1a2afb,null,_0x1a2afb+_0x845d('0x15')+_0x3cf082+'.'+_0x4600cc)['where'](_0x3cf082+'.'+_0x4600cc+'\x20=\x20'+_0x5d4128+'.'+_0x4600cc)[_0x845d('0x16')](_0x1a2afb+_0x845d('0x17')+_0x10deb0[_0x845d('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5d70ea,_0x112f9f){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x845d('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x845d('0x19')](function(_0x25df3e){if(_0x25df3e!==null){var _0xbf78ce=[];for(var _0x2f9425=0x0;_0x2f9425<_0x25df3e[_0x845d('0x1a')];_0x2f9425++){var _0x53463a=_0x25df3e[_0x2f9425];if(!_['isNil'](_0x53463a[_0x845d('0x12')])){if(!_[_0x845d('0x1b')](_0x53463a[_0x845d('0x1c')]))_0xbf78ce[_0x845d('0x1d')](insertAdditionalPhones(_0x53463a));promisesContact[_0x845d('0x1d')]({'contact':_0x53463a});}}}Promise['all'](_0xbf78ce)[_0x845d('0x1e')](function(){_0x5d70ea({'val':0x1});});})[_0x845d('0x1f')](function(_0x2c7399){logger[_0x845d('0x20')](_0x2c7399[_0x845d('0x21')]);});});}function insertAdditionalPhones(_0x4a500a){return new Promise(function(_0xe5768b,_0x3edf07){var _0x42439b=_0x4a500a[_0x845d('0x1c')];if(_[_0x845d('0x1b')](_0x42439b))_0x3edf07({'val':0x0});else{var _0x389a57=_0x42439b['split'](';');var _0x17afd1=[];orderBy=0x0;for(var _0x2feec0=0x0;_0x2feec0<_0x389a57[_0x845d('0x1a')];_0x2feec0++){_0x17afd1['push'](splitAdditionalPhone(_0x4a500a['id'],_0x389a57[_0x2feec0]));}Promise[_0x845d('0x22')](_0x17afd1)[_0x845d('0x1e')](function(){_0xe5768b({'val':_0x389a57[_0x845d('0x1a')]});});}});}function splitAdditionalPhone(_0x332e59,_0x358429){return new Promise(function(_0x5e894d,_0x2a96ea){var _0x4e1236=_0x358429[_0x845d('0x23')](':');var _0x2fb69f=_0x4e1236[0x0];var _0x5716cd=_0x4e1236[0x1];if(_0x5716cd!==''){var _0x5d5e33=_0x5716cd[_0x845d('0x23')]('|');var _0x44ffef=[];for(var _0x311b64=0x0;_0x311b64<_0x5d5e33[_0x845d('0x1a')];_0x311b64++){if(_0x5d5e33[_0x311b64]!==''){var _0x1ea3a2=_['filter'](promisesAdditionalPhones,{'contactId':_0x332e59,'phone':_0x5d5e33[_0x311b64]});if(_0x1ea3a2[_0x845d('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x845d('0x1d')]({'contactId':_0x332e59,'contactTypeId':_0x2fb69f,'phone':_0x5d5e33[_0x311b64],'orderBy':orderBy});}}}_0x5e894d({'ok':0x1});}else _0x5e894d({'res':0x0});});}function createAdditionalPhone(_0x4ca32b,_0x48d4cd,_0x4c60c8,_0x357f37){var _0x4ee648='';var _0x4a8e6f='';var _0x1f6d5b=_0x4c60c8[_0x845d('0x23')]('§');_0x4ee648=_0x1f6d5b[0x0];if(_0x1f6d5b[_0x845d('0x1a')]==0x2)_0x4a8e6f=_0x1f6d5b[0x1];return new Promise(function(_0x4e0add,_0x28c2b8){return db[_0x845d('0x24')][_0x845d('0x25')]({'where':{'CmContactId':_0x4ca32b,'item':_0x4ee648}})['then'](function(_0x18de28){if(_0x18de28){return db['CmContactHasItem'][_0x845d('0x26')]({'ItemTypeId':_0x48d4cd,'description':_0x4a8e6f,'OrderBy':_0x357f37},{'where':{'CmContactId':_0x4ca32b,'item':_0x4ee648}})[_0x845d('0x1e')](function(_0x37aa2c){_0x4e0add({'res':_0x845d('0x27')});});}else{return db[_0x845d('0x24')]['create']({'CmContactId':_0x4ca32b,'item':_0x4ee648,'ItemTypeId':_0x48d4cd,'description':_0x4a8e6f,'OrderBy':_0x357f37,'ItemClass':'PHONE'})[_0x845d('0x1e')](function(_0xb1bace){_0x4e0add({'res':_0x845d('0x28')});});}});});}function updateContact(_0x2c747e){return new Promise(function(_0x544b65,_0x4fb2bd){var _0x2cb0f9=_0x2c747e['id'];delete _0x2c747e['id'];return db['CmContact'][_0x845d('0x26')](_0x2c747e,{'where':{'id':_0x2cb0f9}})['then'](function(_0x2e8f69){updatedRows+=0x1;return db[_0x845d('0x29')][_0x845d('0x26')]({'phone':_0x2c747e['phone']},{'where':{'ContactId':_0x2cb0f9}})[_0x845d('0x1e')](function(_0x7aef0c){_0x544b65({'ret':'OK'});});});});}function insertCmHopper(_0x4ade0d,_0x40be23,_0xcedad,_0x4718e9,_0x22d62a){var _0x2f6fe3=[_0x845d('0x2a'),'cm_contacts.scheduledat',_0x845d('0x2b'),'cm_contacts.ListId',_0x40be23+'.'+_0x4718e9,_0x845d('0x2c'),_0x845d('0x2d'),_0x845d('0x2e'),_0x845d('0x2f'),'\x22'+_0x22d62a+'\x22'];return squel['insert']()[_0x845d('0x30')](_0x845d('0x31'))[_0x845d('0x32')]([_0x845d('0x12'),_0x845d('0x33'),_0x845d('0x34'),_0x845d('0x35'),_0x4718e9,'createdAt','updatedAt',_0x845d('0x36'),'UserId','recallme'],squel[_0x845d('0x11')]()[_0x845d('0x37')](_0x2f6fe3)[_0x845d('0x13')](_0x40be23)[_0x845d('0x14')](_0x845d('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x40be23+'.CmListId')[_0x845d('0x14')](_0xcedad,null,_0xcedad+_0x845d('0x15')+_0x40be23+'.'+_0x4718e9)[_0x845d('0x16')](_0x40be23+_0x845d('0x39'),_0x4ade0d)[_0x845d('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x845d('0x3a'),selectNotIn(_0x40be23,_0xcedad,_0x4718e9,_0x845d('0x31'),[_0x845d('0x3b'),_0x845d('0x3c')]))[_0x845d('0x16')](_0x845d('0x3a'),selectNotIn(_0x40be23,_0xcedad,_0x4718e9,_0x845d('0x31'),[_0x845d('0x3b')])))[_0x845d('0x3d')]();}function insertCmHopperBlack(_0x3cced4,_0x2fbbf0,_0x2f5f47,_0x55aef4){var _0x183835=['cm_contacts.phone',_0x845d('0x2b'),_0x845d('0x3e'),_0x2fbbf0+'.'+_0x55aef4,_0x845d('0x2c'),_0x845d('0x2d')];return squel[_0x845d('0x3f')]()['into'](_0x845d('0x40'))[_0x845d('0x32')]([_0x845d('0x12'),'ContactId','ListId',_0x55aef4,'createdAt',_0x845d('0x41')],squel[_0x845d('0x11')]()[_0x845d('0x37')](_0x183835)[_0x845d('0x13')](_0x2fbbf0)[_0x845d('0x14')]('cm_contacts',null,_0x845d('0x42')+_0x2fbbf0+_0x845d('0x43'))[_0x845d('0x14')](_0x2f5f47,null,_0x2f5f47+_0x845d('0x15')+_0x2fbbf0+'.'+_0x55aef4)[_0x845d('0x16')](_0x2fbbf0+'.CmListId\x20=\x20?',_0x3cced4)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x845d('0x3a'),squel['select']()['field'](_0x845d('0x12'))['from'](_0x845d('0x40'))[_0x845d('0x16')]('ListId\x20=\x20?',_0x3cced4)[_0x845d('0x16')](_0x55aef4+_0x845d('0x44'),_0x2fbbf0+'.'+_0x55aef4)))[_0x845d('0x3d')]();}function insertCmHopperAdditionalPhones(_0x5ab1cb){var _0x36945d=[_0x845d('0x45'),'cm_contact_has_items.item',_0x845d('0x46'),_0x845d('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x845d('0x3f')]()[_0x845d('0x30')](_0x845d('0x48'))[_0x845d('0x32')]([_0x845d('0x49'),_0x845d('0x12'),_0x845d('0x4a'),_0x845d('0x4b'),_0x845d('0x41')],squel['select']()['fields'](_0x36945d)[_0x845d('0x13')](_0x845d('0x31'))[_0x845d('0x14')]('cm_contacts',null,_0x845d('0x4c'))[_0x845d('0x14')](_0x845d('0x4d'),null,_0x845d('0x4e'))[_0x845d('0x16')]('cm_hopper.ListId\x20=\x20?',_0x5ab1cb)[_0x845d('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x845d('0x3d')]();}function insertCmContact(_0x176050,_0x368a8c,_0x4de065,_0x27b087){var _0x2ec7cc=_[_0x845d('0x4f')](_['keys'](_0x27b087),[_0x845d('0x35'),_0x845d('0x50'),'createdAt','updatedAt']);return squel[_0x845d('0x3f')]()['into'](_0x845d('0x38'))['fromQuery'](_0x2ec7cc,squel['select']()[_0x845d('0x37')](_0x2ec7cc)[_0x845d('0x13')](_0x368a8c)[_0x845d('0x16')]('('+_0x4de065[_0x845d('0x14')](',')+_0x845d('0x51'),squel[_0x845d('0x11')]()[_0x845d('0x37')](_0x4de065)[_0x845d('0x13')](_0x845d('0x38'))[_0x845d('0x16')](_0x845d('0x52'),_0x176050))[_0x845d('0x16')](_0x845d('0x53'),squel['select']()[_0x845d('0x54')](_0x845d('0x55'),_0x845d('0x56'))[_0x845d('0x13')](_0x368a8c)['group'](_0x4de065[_0x845d('0x14')](','))))['toString']();}function handleStop(){logger['info'](_0x845d('0x57'));stopped=!![];}function handleUncaughtException(_0x150b6e){logger[_0x845d('0x20')](_0x150b6e[_0x845d('0x21')]);process[_0x845d('0x58')](0x1);}function handleError(_0x26b9be,_0x2ad073){stats[_0x845d('0x59')][_0x845d('0x1d')]({'name':_0x2ad073[_0x845d('0x5a')],'message':_0x2ad073[_0x845d('0x21')],'row':_0x26b9be});}function handleQuery(_0x16410f){logger[_0x845d('0x5b')](_0x16410f);return db[_0x845d('0x5c')]['query'](_0x16410f)['spread'](function(_0x2b4696){results[_0x845d('0x1d')](_0x2b4696);})[_0x845d('0x1f')](function(_0xb8ddc2){logger[_0x845d('0x20')](_0xb8ddc2[_0x845d('0x21')]);});}function main(_0xfc9903,_0x20f69d,_0x567278,_0x3f3a9d){logger[_0x845d('0x5b')]('main',_0xfc9903,JSON[_0x845d('0x5d')](_0x20f69d));process[_0x845d('0x5e')](_0x845d('0x5f'));var _0x8d2f1e=_0x20f69d[_0x845d('0x60')];var _0x1e295d=_[_0x845d('0x61')](_0x8d2f1e);var _0x4aa2a0=_0x20f69d[_0x845d('0x62')];var _0x59cdb7=path[_0x845d('0x14')](config[_0x845d('0x63')],_0x845d('0x64'),_0x4aa2a0+_0x845d('0x65'));logger[_0x845d('0x5b')]('body',_0x20f69d);db[_0x845d('0x66')][_0x845d('0x67')]({'raw':!![],'attributes':['id','name']})[_0x845d('0x1e')](function(_0x29faec){for(var _0x4882ba=0x0;_0x4882ba<_0x29faec[_0x845d('0x1a')];_0x4882ba++){if(_0x29faec[_0x4882ba][_0x845d('0x68')]in _0x8d2f1e){contactItemTypes[_0x845d('0x1d')](_0x29faec[_0x4882ba]);delete _0x1e295d[_0x29faec[_0x4882ba]['name']];hasAdditionalPhones=!![];}for(var _0x36badb in _0x8d2f1e){if(_0x29faec[_0x4882ba][_0x845d('0x68')]+_0x845d('0x69')===_0x36badb){phoneDescriptions['push']({'itemTypeId':_0x29faec[_0x4882ba]['id'],'description':_0x36badb});delete _0x1e295d[_0x36badb];}}}if(hasAdditionalPhones)_0x1e295d[_0x845d('0x1c')]='';var _0x537206=_['keys'](_0x1e295d)['join']();logger[_0x845d('0x5b')]('header',_0x537206);fs[_0x845d('0x6a')](_0x59cdb7,_0x537206+'\x0a');Papa[_0x845d('0x6b')](fs[_0x845d('0x6c')](_0xfc9903),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e8422,_0x2fa788){try{for(var _0x5282e6=0x0,_0x519a9d=[];_0x5282e6<_0x2e8422['data']['length'];_0x5282e6++){stats['rows']+=0x1;if(_0x2e8422[_0x845d('0x59')][_0x5282e6]){handleError(_0x2e8422[_0x845d('0x6d')][_0x5282e6],_0x2e8422[_0x845d('0x59')][_0x5282e6]);}else{var _0x5c6d12=[];var _0x29e998=[];var _0x31db49={};for(var _0x2f8529 in _0x8d2f1e){let _0x49a770=contactItemTypes[_0x845d('0x6e')](_0x37379a=>_0x37379a['name']===_0x2f8529);let _0x299de6=contactItemTypes[_0x845d('0x6e')](_0x1bd1f6=>_0x1bd1f6[_0x845d('0x68')]+'_description'===_0x2f8529);if(_['isNil'](_0x49a770)&&_[_0x845d('0x1b')](_0x299de6)){if(_0x8d2f1e[_0x845d('0x6f')](_0x2f8529)){if(_0x2e8422['data'][_0x5282e6][_0x8d2f1e[_0x2f8529]]){var _0x4678f3=_[_0x845d('0x70')](_0x2e8422['data'][_0x5282e6][_0x8d2f1e[_0x2f8529]][_0x845d('0x71')](/"/g,'\x27'));switch(_0x2f8529){case'scheduledat':var _0x23872e=moment(_0x4678f3,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x23872e[_0x845d('0x72')]()){_0x519a9d[_0x845d('0x1d')]('\x22'+_0x4678f3+'\x22');}else{_0x5c6d12[_0x845d('0x1d')](_0x845d('0x73'));}break;case _0x845d('0x36'):var _0x5cc5e9=parseInt(_0x4678f3);_0x4678f3=_['isNaN'](_0x5cc5e9)||_0x5cc5e9<0x0||_0x5cc5e9>0x4?_0x3f3a9d?0x3:0x2:_0x5cc5e9;_0x519a9d[_0x845d('0x1d')]('\x22'+_0x4678f3+'\x22');break;case _0x845d('0x74'):var _0x4f52a5=parseInt(_0x4678f3);if(_[_0x845d('0x75')](_0x4f52a5)&&_[_0x845d('0x76')](_0x567278,_0x4f52a5)){_0x519a9d['push']('\x22'+_0x4f52a5+'\x22');}else{_0x5c6d12[_0x845d('0x1d')](_0x845d('0x77'));}break;case'email':if(isEmail(_0x4678f3)){_0x519a9d[_0x845d('0x1d')]('\x22'+_0x4678f3+'\x22');}else{_0x5c6d12[_0x845d('0x1d')]('email\x20wrong\x20format');}break;case _0x845d('0x78'):var _0x1c7077=moment(_0x4678f3,'YYYY-MM-DD',!![]);if(_0x1c7077['isValid']()){_0x519a9d[_0x845d('0x1d')]('\x22'+_0x4678f3+'\x22');}else{_0x5c6d12['push'](_0x845d('0x79'));}break;default:_0x519a9d[_0x845d('0x1d')]('\x22'+_0x4678f3+'\x22');}}else{switch(_0x2f8529){case'firstName':case _0x845d('0x12'):_0x5c6d12[_0x845d('0x1d')](_0x2f8529+_0x845d('0x7a'));break;default:_0x519a9d[_0x845d('0x1d')]('\x22\x22');}}}}else{var _0x5352b4='';if(!_['isNil'](_0x49a770)){if(!_0x31db49[_0x845d('0x6f')](_0x49a770['id'])){for(var _0x2fde09=0x0;_0x2fde09<_0x8d2f1e[_0x2f8529][_0x845d('0x1a')];_0x2fde09++){var _0x4678f3=_[_0x845d('0x70')](_0x2e8422[_0x845d('0x6d')][_0x5282e6][_0x8d2f1e[_0x2f8529][_0x2fde09]][_0x845d('0x71')](/"/g,'\x27'));var _0x22c152=phoneDescriptions['find'](_0x21c8e5=>_0x21c8e5[_0x845d('0x7b')]===_0x49a770['id']);if(!_['isNil'](_0x22c152)){var _0x2634c4=_[_0x845d('0x70')](_0x2e8422[_0x845d('0x6d')][_0x5282e6][_0x8d2f1e[_0x22c152[_0x845d('0x7c')]][0x0]][_0x845d('0x71')](/"/g,'\x27'));if(!_[_0x845d('0x1b')](_0x2634c4))_0x4678f3=_0x4678f3+'§'+_0x2634c4;}if(_0x5352b4=='')_0x5352b4=_0x4678f3;else _0x5352b4+='|'+_0x4678f3;}_0x29e998['push'](_0x49a770['id']+':'+_0x5352b4);_0x31db49[_0x49a770['id']]=0x1;}}}}if(hasAdditionalPhones){_0x519a9d[_0x845d('0x1d')]('\x22'+_0x29e998['join'](';')+'\x22');}if(_0x5c6d12[_0x845d('0x1a')]){handleError(_0x2e8422['data'][_0x5282e6],{'code':_0x845d('0x7d'),'message':_0x5c6d12[_0x845d('0x14')]()});}else{fs['appendFileSync'](_0x59cdb7,_0x519a9d[_0x845d('0x14')]()+'\x0a');}_0x519a9d=[];}if(!(stats[_0x845d('0x7e')]%0xc8)){socket['emit'](_0x845d('0x7f')+_0x4aa2a0,stats);stats[_0x845d('0x59')]=[];}}if(stopped){logger[_0x845d('0x5b')](_0x845d('0x80'));_0x2fa788[_0x845d('0x81')]();}}catch(_0x5d8f2d){handleError(_0x2e8422[_0x845d('0x6d')][_0x5282e6],{'code':'SystemError','message':_0x5d8f2d[_0x845d('0x21')]});logger[_0x845d('0x20')]('step',_0x5d8f2d[_0x845d('0x21')]);}},'complete':function(){try{var _0xb82b42=[];var _0x2ef6e4=tempTableName;_0xb82b42['push'](_0x845d('0x82')+_0x2ef6e4+_0x845d('0x83'));logger[_0x845d('0x5b')]('CIS\x20len',contactItemTypes['length']);var _0x279544=util[_0x845d('0xd')](_0x845d('0x84'),_0x59cdb7,_0x2ef6e4,_0x537206,_0x20f69d[_0x845d('0x35')],_0x20f69d[_0x845d('0x50')]||null,NOW,NOW);if(_[_0x845d('0x1b')](_0x8d2f1e['scheduledat'])){_0x279544+=_0x845d('0x85');}_0xb82b42[_0x845d('0x1d')](_0x279544);BPromise['each'](_0xb82b42,handleQuery)['then'](function(_0x3eddbf){BPromise[_0x845d('0x22')]([handleAdditionalPhones()])[_0x845d('0x1e')](function(){_0xb82b42=[];for(var _0x39b6b9=0x0;_0x39b6b9\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','groupBy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0c9e,0x15d));var _0xe0c9=function(_0x54893e,_0x228a4a){_0x54893e=_0x54893e-0x0;var _0x101664=_0x0c9e[_0x54893e];return _0x101664;};'use strict';var _=require(_0xe0c9('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xe0c9('0x1'));var updateInteraction=require(_0xe0c9('0x2'))[_0xe0c9('0x3')];var utils=require(_0xe0c9('0x4'));var db=require(_0xe0c9('0x5'))['db'];function skipInteractionsQuery(_0x469350,_0x548712,_0x21b5a4){var _0x2cdb6e=![];var _0x11ab3b=utils[_0xe0c9('0x6')](_0x469350);if(_0x548712['role']==='agent'&&!_0x21b5a4[_0xe0c9('0x7')]&&!_0x21b5a4[_0x11ab3b]){_0x2cdb6e=!![];}return _0x2cdb6e;}function getTagsQuery(){return squel['select']()[_0xe0c9('0x8')]('id')['field']('name')[_0xe0c9('0x8')](_0xe0c9('0x9'))[_0xe0c9('0xa')](_0xe0c9('0xb'));}function getUsersQuery(_0x1c9ff5,_0x4e808e){var _0x5d913c=utils[_0xe0c9('0xc')](_0x1c9ff5);var _0x3eeae7=_0xe0c9('0xd')+_0x1c9ff5+_0xe0c9('0xe');var _0x5e43a8=squel[_0xe0c9('0xf')]()['field'](_0xe0c9('0x10'))['field'](_0xe0c9('0x11'))['field'](_0xe0c9('0x12')+_0x5d913c)['from'](_0x3eeae7,'ui')['left_join'](_0xe0c9('0x13'),'u',_0xe0c9('0x14'));if(_0x4e808e[_0xe0c9('0x15')]>0x0){_0x5e43a8[_0xe0c9('0x16')]('ui.'+_0x5d913c+_0xe0c9('0x17'),_[_0xe0c9('0x18')](_0x4e808e,'id'));}return _0x5e43a8;}function getInteractionsQuery(_0x30a0ce){var _0xda82fc=utils[_0xe0c9('0x19')](_0x30a0ce);var _0x1d047d=utils[_0xe0c9('0x6')](_0x30a0ce);var _0x50052e=utils[_0xe0c9('0xc')](_0x30a0ce);return squel[_0xe0c9('0xf')]()[_0xe0c9('0xa')](_0xda82fc[_0xe0c9('0x1a')],'i')[_0xe0c9('0x1b')](_0xe0c9('0x1c'),'c',_0xe0c9('0x1d'))[_0xe0c9('0x1b')](_0xe0c9('0x13'),'o',_0xe0c9('0x1e'))[_0xe0c9('0x1b')](_0xda82fc[_0xe0c9('0x1f')],'a',_0xe0c9('0x20')+_0x1d047d)[_0xe0c9('0x1b')](_0xda82fc[_0xe0c9('0x21')],'me',_0xe0c9('0x22')+_0x50052e+_0xe0c9('0x23'))[_0xe0c9('0x1b')](_0xda82fc['interactionsTags'],'it',_0xe0c9('0x24')+_0x50052e+_0xe0c9('0x23'))[_0xe0c9('0x1b')](_0xe0c9('0xb'),'t',_0xe0c9('0x25'));}function getSqlClauses(){var _0x33890b={'body':squel[_0xe0c9('0x26')](),'contact':squel[_0xe0c9('0x26')](),'default':squel[_0xe0c9('0x26')](),'fields':squel[_0xe0c9('0x26')](),'filter':squel['expr'](),'read':squel[_0xe0c9('0x26')](),'tags':{'clause':squel[_0xe0c9('0x26')](),'ids':null},'user':squel[_0xe0c9('0x26')]()};return _0x33890b;}function parseTagParameter(_0x36ac7f){var _0x137e1e=squel[_0xe0c9('0x26')]();if(_0x36ac7f){var _0x5cf58d=utils[_0xe0c9('0x27')](_0x36ac7f);_0x5cf58d[_0xe0c9('0x28')](function(_0x11f5da){_0x137e1e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11f5da+',%');});}return _0x137e1e;}function parseReadParameter(_0x237c3f){var _0x195de7='';if(_0x237c3f){_0x195de7=_0xe0c9('0x29');if(_0x237c3f==='1'){_0x195de7=_0x195de7[_0xe0c9('0x2a')](_0xe0c9('0x2b'),'=');}else{_0x195de7=_0x195de7['replace']('{OPERATOR}','>');}}return _0x195de7;}function parseSearchFilter(_0x2b5949,_0x32b890){var _0x163ec3=squel['expr']();if(_0x32b890){var _0xb0dcc9=_0x32b890[_0xe0c9('0x2a')]('\x5c','\x5c\x5c')[_0xe0c9('0x2a')](/'/g,'\x27\x27');if(qs[_0xe0c9('0x2c')](_0xb0dcc9)){_0x163ec3['or'](_0xe0c9('0x2d'),_0xb0dcc9+'%');if(['sms',_0xe0c9('0x2e')][_0xe0c9('0x2f')](_0x2b5949)){_0x163ec3['or']('i.phone\x20LIKE\x20?',_0xb0dcc9+'%');}else if(_0x2b5949===_0xe0c9('0x30')){_0x163ec3['or'](_0xe0c9('0x31'),_0xb0dcc9+'%');}else if(_0x2b5949==='openchannel'){_0x163ec3['or']('i.from\x20LIKE\x20?',_0xb0dcc9+'%');}}else if(_0x2b5949==='mail'&&qs[_0xe0c9('0x32')](_0xb0dcc9)){_0x163ec3['or'](_0xe0c9('0x33'),_0xb0dcc9+'%');}else{if(_0x2b5949===_0xe0c9('0x34')){_0x163ec3['or'](_0xe0c9('0x35'),qs['getFullTextValue'](_0xb0dcc9,!![]))['or'](_0xe0c9('0x36'),qs[_0xe0c9('0x37')](_0xb0dcc9));}else if(_0x2b5949!==_0xe0c9('0x30')){_0x163ec3['or'](_0xe0c9('0x38'),qs[_0xe0c9('0x37')](_0xb0dcc9));}_0x163ec3['or'](_0xe0c9('0x39'),qs['getFullTextValue'](_0xb0dcc9,!![]),null);}}return _0x163ec3;}function parseAdvancedSearchFilter(_0x104fd9,_0x2ddd7c){var _0x219596=getSqlClauses();var _0x535263=as[_0xe0c9('0x3a')](_0x104fd9);var _0x52d299=_0x535263[_0xe0c9('0x3b')];for(var _0x4f37eb=0x0;_0x4f37eb<_0x535263[_0xe0c9('0x3c')][_0xe0c9('0x15')];_0x4f37eb++){var _0x26cfc9=_0x535263[_0xe0c9('0x3c')][_0x4f37eb];var _0x2c8888='i';var _0x562a27=_['find'](_0x2ddd7c,['name',_0x26cfc9['field']]);if(_0x562a27){var _0x1c068b=as[_0xe0c9('0x3d')](_0x2c8888,_0x562a27[_0xe0c9('0x3e')],_0x26cfc9);_0x219596[_0xe0c9('0x3f')][_0x52d299](_0x1c068b['text'],_0x1c068b['value'][_0xe0c9('0x40')],_0x1c068b[_0xe0c9('0x41')][_0xe0c9('0x42')]);}else{switch(_0x26cfc9['field']){case _0xe0c9('0x43'):var _0x53121=parseReadParameter(_0x26cfc9['value']);_0x219596['read'][_0xe0c9('0x44')](_0x53121);break;case'Contact':if(_0x26cfc9[_0xe0c9('0x45')]===_0xe0c9('0x46')){if(_0x26cfc9[_0xe0c9('0x41')][_0xe0c9('0x47')]('\x20')['length']>0x1){_0x219596[_0xe0c9('0x48')][_0x52d299](_0xe0c9('0x39'),qs[_0xe0c9('0x37')](_0x26cfc9[_0xe0c9('0x41')],!![]),null);}else{var _0x223124='%'+_0x26cfc9['value']+'%';_0x219596[_0xe0c9('0x48')][_0x52d299](_0xe0c9('0x49'),_0x223124,_0x223124,_0x223124);}}else{_0x562a27=_[_0xe0c9('0x4a')](_0x2ddd7c,[_0xe0c9('0x4b'),_0xe0c9('0x4c')]);_0x26cfc9[_0xe0c9('0x8')]=_0xe0c9('0x4c');_0x1c068b=as[_0xe0c9('0x3d')](_0x2c8888,_0x562a27['type'],_0x26cfc9);_0x219596[_0xe0c9('0x48')][_0x52d299](_0x1c068b['text'],_0x1c068b[_0xe0c9('0x41')][_0xe0c9('0x40')],_0x1c068b['value']['end']);}break;case'Tag':var _0x5b876d=_0x26cfc9['value']['split'](',')[_0xe0c9('0x18')](function(_0x297f9a){return Number(_0x297f9a);});var _0x43d253=parseTagParameter(_0x5b876d);_0x219596['tags'][_0xe0c9('0x4d')][_0xe0c9('0x44')](_0x43d253);_0x219596[_0xe0c9('0x4e')][_0xe0c9('0x4f')]=_0x5b876d;break;case _0xe0c9('0x50'):if(_0x26cfc9[_0xe0c9('0x45')]===_0xe0c9('0x46')){_0x219596['user'][_0x52d299](_0xe0c9('0x51'),'%'+_0x26cfc9[_0xe0c9('0x41')]+'%',null);}else{_0x562a27=_[_0xe0c9('0x4a')](_0x2ddd7c,[_0xe0c9('0x4b'),_0xe0c9('0x52')]);_0x26cfc9[_0xe0c9('0x8')]=_0xe0c9('0x52');_0x1c068b=as[_0xe0c9('0x3d')](_0x2c8888,_0x562a27[_0xe0c9('0x3e')],_0x26cfc9);_0x219596['user'][_0x52d299](_0x1c068b[_0xe0c9('0x53')],_0x1c068b['value']['start'],_0x1c068b[_0xe0c9('0x41')][_0xe0c9('0x42')]);}break;case _0xe0c9('0x54'):case'plainBody':_0x1c068b=as[_0xe0c9('0x3d')]('me',null,_0x26cfc9);_0x219596[_0xe0c9('0x54')][_0x52d299](_0x1c068b[_0xe0c9('0x53')],_0x1c068b['value'][_0xe0c9('0x40')],_0x1c068b[_0xe0c9('0x41')][_0xe0c9('0x42')]);break;}}}return _0x219596;}function parseModelFields(_0x4b23c9,_0x4a72c9,_0x176c18){var _0x21ff34=utils[_0xe0c9('0x6')](_0x4b23c9);var _0x5e9a1f=squel[_0xe0c9('0x26')]();var _0x4ed593=_(_0x4a72c9)[_0xe0c9('0x55')]()['map'](function(_0x2c4a47){return _['some'](_0x176c18,[_0xe0c9('0x4b'),_0x2c4a47])?_0x2c4a47:undefined;})['compact']()[_0xe0c9('0x41')]();if(_0x4ed593[_0xe0c9('0x15')]>0x0){_0x4ed593[_0xe0c9('0x28')](function(_0x14264e){if(_0x14264e===_0x21ff34){_0x5e9a1f[_0xe0c9('0x44')]('i.'+_0x21ff34+_0xe0c9('0x17'),[][_0xe0c9('0x56')](_0x4a72c9[_0x14264e]));}else if(_0x14264e==='createdAt'){var _0x2535bb=JSON['parse'](_0x4a72c9[_0x14264e])['$gte'];var _0x597170=JSON[_0xe0c9('0x57')](_0x4a72c9[_0x14264e])[_0xe0c9('0x58')];_0x5e9a1f[_0xe0c9('0x44')](_0xe0c9('0x59'),_0x2535bb,_0x597170);}else{if(_0x4a72c9[_0x14264e]==='null'){_0x5e9a1f[_0xe0c9('0x44')]('i.'+_0x14264e+_0xe0c9('0x5a'));}else{_0x5e9a1f[_0xe0c9('0x44')]('i.'+_0x14264e+_0xe0c9('0x5b'),_0x4a72c9[_0x14264e]);}}});}return _0x5e9a1f;}function parseQueryParameters(_0xfedbf7,_0x194e3f,_0x21983d){var _0x34c821=getSqlClauses();return Promise['resolve']()[_0xe0c9('0x5c')](function(){return parseModelFields(_0xfedbf7,_0x194e3f,_0x21983d);})[_0xe0c9('0x5c')](function(_0x1ed485){_0x34c821[_0xe0c9('0x5d')][_0xe0c9('0x44')](_0x1ed485);return parseReadParameter(_0x194e3f[_0xe0c9('0x5e')]);})[_0xe0c9('0x5c')](function(_0xa621cb){_0x34c821[_0xe0c9('0x5e')][_0xe0c9('0x44')](_0xa621cb);return parseTagParameter(_0x194e3f[_0xe0c9('0x5f')]);})['then'](function(_0x20f7c5){_0x34c821[_0xe0c9('0x4e')][_0xe0c9('0x4d')][_0xe0c9('0x44')](_0x20f7c5);return parseSearchFilter(_0xfedbf7,_0x194e3f[_0xe0c9('0x60')]);})[_0xe0c9('0x5c')](function(_0x23850e){_0x34c821[_0xe0c9('0x60')]=_0x23850e;return _0x34c821;});}function checkAccountsRestrictions(_0x479ba1,_0x654618,_0x41953b){var _0x1e8711=utils[_0xe0c9('0x6')](_0x479ba1);var _0x51a105=_0xe0c9('0x61')+_[_0xe0c9('0x62')](_0x479ba1)+(_0x479ba1===_0xe0c9('0x63')?_0xe0c9('0x64'):_0xe0c9('0x65'));var _0x4fe174=squel[_0xe0c9('0x26')]();return Promise[_0xe0c9('0x66')]()[_0xe0c9('0x5c')](function(){if(_0x41953b['search']&&_0x654618[_0xe0c9('0x67')]===_0xe0c9('0x68')){return _0x654618[_0x51a105]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x3e8545){if(_0x3e8545){if(_0x3e8545[_0xe0c9('0x15')]===0x0){_0x4fe174[_0xe0c9('0x44')]('i.'+_0x1e8711+_0xe0c9('0x5a'));}else{_0x4fe174[_0xe0c9('0x44')]('i.'+_0x1e8711+_0xe0c9('0x17'),_['map'](_0x3e8545,'id'));}}else if(!_0x41953b[_0x1e8711]){_0x4fe174['and']('i.'+_0x1e8711+_0xe0c9('0x69'));}})[_0xe0c9('0x5c')](function(){return _0x4fe174;});}function getClosedOrderClause(_0xf41301,_0x593bc2){var _0x54a595='';var _0x25eb47=[_0xe0c9('0x6a'),_0xe0c9('0x6b'),_0xe0c9('0x6c')];if(_0xf41301==='mail'){_0x25eb47[_0xe0c9('0x6d')](_0xe0c9('0x6e'));}if(_0x593bc2['closed']==='0'&&_0xf41301===_0xe0c9('0x34')){_0x54a595=_0xe0c9('0x6e');}else{if(_0x593bc2['closed']==='1'){_0x25eb47[_0xe0c9('0x6f')]();}_0x54a595=_0xe0c9('0x70')+_0x25eb47[_0xe0c9('0x71')](',\x20')+')';}return _0x54a595;}function getFilteredInteractions(_0x521754,_0x51f871,_0x41f8bd,_0x38c91a){var _0x45829f=utils['getInteractionFK'](_0x521754);var _0x33a4d8=_[_0xe0c9('0x62')](_0x521754)+_0xe0c9('0x72');var _0x5d55f7=[];var _0x552efe=getTagsQuery();var _0x136176={'type':db[_0xe0c9('0x73')]['QueryTypes'][_0xe0c9('0x74')],'raw':!![]};var _0x240473=[];var _0x3b3920=[];return db['sequelize'][_0xe0c9('0x75')](_0x552efe[_0xe0c9('0x76')](),_0x136176)['then'](function(_0xe0b77f){_0x5d55f7=_[_0xe0c9('0x77')](_0xe0b77f,'id');_0x136176=_[_0xe0c9('0x78')](_0x136176,{'model':db[_0x33a4d8],'mapToModel':!![],'nest':!![]});if(_0x41f8bd[_0xe0c9('0x5d')]){_0x38c91a[_0xe0c9('0x79')][_0xe0c9('0x28')](function(_0x3e18be){_0x51f871[_0xe0c9('0x8')]('i.'+_0x3e18be);});}else{_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x7a'),_0xe0c9('0x43'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x7b'),_0xe0c9('0x7c'));_0x51f871[_0xe0c9('0x8')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x521754===_0xe0c9('0x34')){_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x7d'),'Account.email');_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x7e'),'contactName');_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x7f'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x80'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x81'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x82'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x83'));_0x51f871['field'](_0xe0c9('0x84'));_0x51f871['field'](_0xe0c9('0x85'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x86'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x87'));_0x51f871[_0xe0c9('0x8')]('i.disposition');_0x51f871['field'](_0xe0c9('0x6b'));_0x51f871['field'](_0xe0c9('0x6a'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x6e'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x88'));_0x51f871['field'](_0xe0c9('0x89'));_0x51f871['field'](_0xe0c9('0x8a'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x8b'));}else if(_0x521754===_0xe0c9('0x8c')){_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x8d'),'contactName');}else{_0x51f871['field'](_0xe0c9('0x8e'),_0xe0c9('0x8f'));}if(_0x521754!==_0xe0c9('0x34')){_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x90'));}_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x91'),_0xe0c9('0x92'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x93'),'Contact.lastName');_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x94'),_0xe0c9('0x95'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x96'),_0xe0c9('0x97'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x98'),_0xe0c9('0x99'));_0x51f871['field'](_0xe0c9('0x9a'),'Contact.fax');_0x51f871['field'](_0xe0c9('0x9b'),_0xe0c9('0x9c'));_0x51f871[_0xe0c9('0x8')](_0xe0c9('0x9d'),_0xe0c9('0x9e'));_0x51f871['field'](_0xe0c9('0x9f'),'TagIds');}if(_0x38c91a[_0xe0c9('0xa0')]){_0x51f871[_0xe0c9('0xa0')](_0x38c91a[_0xe0c9('0xa0')]);}if(_0x38c91a[_0xe0c9('0xa1')]){_0x51f871[_0xe0c9('0xa1')](_0x38c91a[_0xe0c9('0xa1')]);}return db['sequelize']['query'](_0x51f871[_0xe0c9('0x76')](),_0x136176);})[_0xe0c9('0x5c')](function(_0x3c4c63){_0x240473=_0x3c4c63;var _0x226f6b=getUsersQuery(_0x521754,_0x240473);return db[_0xe0c9('0xa2')][_0xe0c9('0x75')](_0x226f6b[_0xe0c9('0x76')](),_0x136176);})['then'](function(_0x4e438e){_0x3b3920=_[_0xe0c9('0xa3')](_0x4e438e,_0x45829f);if(_0x521754===_0xe0c9('0x34')){return db[_0xe0c9('0xa4')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xe0c9('0x5c')](function(_0x3f006e){var _0x579f47=_0x3f006e?_0x3f006e[_0xe0c9('0xa5')]:undefined;var _0x10cb82=_0x240473['map'](function(_0x442d4b){return updateInteraction(_0x442d4b,_0x5d55f7,_0x3b3920,_0x579f47);});return Promise['all'](_0x10cb82);});}function countFilteredInteractions(_0x325038,_0x13688c){var _0x1fac1a=_0x325038[_0xe0c9('0xa6')]();_0x1fac1a[_0xe0c9('0x8')]('COUNT(*)');_0x1fac1a['field'](_0xe0c9('0x7a'),_0xe0c9('0x43'));var _0x1a7e69=utils[_0xe0c9('0x27')](_0x13688c);if(!_[_0xe0c9('0xa7')](_0x1a7e69)){_0x1fac1a[_0xe0c9('0x16')](_0xe0c9('0xa8'),_0x1a7e69);}var _0x34112f={'type':db[_0xe0c9('0x73')][_0xe0c9('0xa9')][_0xe0c9('0x74')],'raw':!![]};return db[_0xe0c9('0xa2')][_0xe0c9('0x75')](_0x1fac1a['toString'](),_0x34112f);}module[_0xe0c9('0xaa')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xce88=['exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','getInteractionFK','user_has_','_interactions','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','where','ui.','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','default','text','value','start','end','read','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','tags','clause','and','user','UserId','plainBody','body','keys','some','compact','concat','createdAt','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','t.id\x20IN\x20?'];(function(_0x906e88,_0x2b5046){var _0x551acb=function(_0x450171){while(--_0x450171){_0x906e88['push'](_0x906e88['shift']());}};_0x551acb(++_0x2b5046);}(_0xce88,0x153));var _0x8ce8=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xce88[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x8ce8('0x0'));var squel=require(_0x8ce8('0x1'));var as=require(_0x8ce8('0x2'));var qs=require(_0x8ce8('0x3'));var updateInteraction=require(_0x8ce8('0x4'))[_0x8ce8('0x5')];var utils=require(_0x8ce8('0x6'));var db=require(_0x8ce8('0x7'))['db'];function skipInteractionsQuery(_0x3f71db,_0x41d240,_0xe800fe){var _0xe3f459=![];var _0x5630e4=utils[_0x8ce8('0x8')](_0x3f71db);if(_0x41d240[_0x8ce8('0x9')]===_0x8ce8('0xa')&&!_0xe800fe[_0x8ce8('0xb')]&&!_0xe800fe[_0x5630e4]){_0xe3f459=!![];}return _0xe3f459;}function getTagsQuery(){return squel[_0x8ce8('0xc')]()[_0x8ce8('0xd')]('id')[_0x8ce8('0xd')](_0x8ce8('0xe'))[_0x8ce8('0xd')](_0x8ce8('0xf'))[_0x8ce8('0x10')]('tools_tags');}function getUsersQuery(_0x194a00,_0xed0584){var _0xf5b517=utils[_0x8ce8('0x11')](_0x194a00);var _0x198a41=_0x8ce8('0x12')+_0x194a00+_0x8ce8('0x13');var _0xaff4c2=squel[_0x8ce8('0xc')]()['field']('u.id')['field'](_0x8ce8('0x14'))[_0x8ce8('0xd')]('ui.'+_0xf5b517)['from'](_0x198a41,'ui')[_0x8ce8('0x15')](_0x8ce8('0x16'),'u',_0x8ce8('0x17'));if(_0xed0584[_0x8ce8('0x18')]>0x0){_0xaff4c2[_0x8ce8('0x19')](_0x8ce8('0x1a')+_0xf5b517+_0x8ce8('0x1b'),_[_0x8ce8('0x1c')](_0xed0584,'id'));}return _0xaff4c2;}function getInteractionsQuery(_0x4fa86a){var _0x10bb34=utils[_0x8ce8('0x1d')](_0x4fa86a);var _0x138e1b=utils[_0x8ce8('0x8')](_0x4fa86a);var _0x4bce39=utils[_0x8ce8('0x11')](_0x4fa86a);return squel[_0x8ce8('0xc')]()[_0x8ce8('0x10')](_0x10bb34[_0x8ce8('0x1e')],'i')[_0x8ce8('0x15')]('cm_contacts','c',_0x8ce8('0x1f'))[_0x8ce8('0x15')](_0x8ce8('0x16'),'o',_0x8ce8('0x20'))['left_join'](_0x10bb34[_0x8ce8('0x21')],'a',_0x8ce8('0x22')+_0x138e1b)['left_join'](_0x10bb34[_0x8ce8('0x23')],'me',_0x8ce8('0x24')+_0x4bce39+_0x8ce8('0x25'))[_0x8ce8('0x15')](_0x10bb34[_0x8ce8('0x26')],'it','it.'+_0x4bce39+'\x20=\x20i.id')['left_join'](_0x8ce8('0x27'),'t',_0x8ce8('0x28'));}function getSqlClauses(){var _0x56cf90={'body':squel[_0x8ce8('0x29')](),'contact':squel[_0x8ce8('0x29')](),'default':squel[_0x8ce8('0x29')](),'fields':squel[_0x8ce8('0x29')](),'filter':squel[_0x8ce8('0x29')](),'read':squel['expr'](),'tags':{'clause':squel[_0x8ce8('0x29')](),'ids':null},'user':squel[_0x8ce8('0x29')]()};return _0x56cf90;}function parseTagParameter(_0x827d03){var _0x35d3ab=squel[_0x8ce8('0x29')]();if(_0x827d03){var _0x3d9c21=utils[_0x8ce8('0x2a')](_0x827d03);_0x3d9c21[_0x8ce8('0x2b')](function(_0x5cc08d){_0x35d3ab['or'](_0x8ce8('0x2c'),'%,'+_0x5cc08d+',%');});}return _0x35d3ab;}function parseReadParameter(_0x219a4e){var _0x5586b7='';if(_0x219a4e){_0x5586b7=_0x8ce8('0x2d');if(_0x219a4e==='1'){_0x5586b7=_0x5586b7['replace'](_0x8ce8('0x2e'),'=');}else{_0x5586b7=_0x5586b7[_0x8ce8('0x2f')](_0x8ce8('0x2e'),'>');}}return _0x5586b7;}function parseSearchFilter(_0x44463b,_0xd7f8b3){var _0x2cb355=squel['expr']();if(_0xd7f8b3){var _0x15b25a=_0xd7f8b3[_0x8ce8('0x2f')]('\x5c','\x5c\x5c')[_0x8ce8('0x2f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x15b25a)){_0x2cb355['or'](_0x8ce8('0x30'),_0x15b25a+'%');if([_0x8ce8('0x31'),_0x8ce8('0x32')][_0x8ce8('0x33')](_0x44463b)){_0x2cb355['or'](_0x8ce8('0x34'),_0x15b25a+'%');}else if(_0x44463b==='fax'){_0x2cb355['or'](_0x8ce8('0x35'),_0x15b25a+'%');}else if(_0x44463b===_0x8ce8('0x36')){_0x2cb355['or'](_0x8ce8('0x37'),_0x15b25a+'%');}}else if(_0x44463b===_0x8ce8('0x38')&&qs[_0x8ce8('0x39')](_0x15b25a)){_0x2cb355['or'](_0x8ce8('0x3a'),_0x15b25a+'%');}else{if(_0x44463b===_0x8ce8('0x38')){_0x2cb355['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ce8('0x3b')](_0x15b25a,!![]))['or'](_0x8ce8('0x3c'),qs['getFullTextValue'](_0x15b25a));}else if(_0x44463b!=='fax'){_0x2cb355['or'](_0x8ce8('0x3d'),qs[_0x8ce8('0x3b')](_0x15b25a));}_0x2cb355['or'](_0x8ce8('0x3e'),qs[_0x8ce8('0x3b')](_0x15b25a,!![]),null);}}return _0x2cb355;}function parseAdvancedSearchFilter(_0x74dfb8,_0x2c70f3){var _0x4a982f=getSqlClauses();var _0x4b91f3=as[_0x8ce8('0x3f')](_0x74dfb8);var _0x13ee2e=_0x4b91f3['sqlOperator'];for(var _0xd71b8b=0x0;_0xd71b8b<_0x4b91f3['conditions']['length'];_0xd71b8b++){var _0x1f219e=_0x4b91f3[_0x8ce8('0x40')][_0xd71b8b];var _0x15d51a='i';var _0x53339c=_[_0x8ce8('0x41')](_0x2c70f3,[_0x8ce8('0xe'),_0x1f219e[_0x8ce8('0xd')]]);if(_0x53339c){var _0x2b49e2=as['buildExpression'](_0x15d51a,_0x53339c['type'],_0x1f219e);_0x4a982f[_0x8ce8('0x42')][_0x13ee2e](_0x2b49e2[_0x8ce8('0x43')],_0x2b49e2[_0x8ce8('0x44')][_0x8ce8('0x45')],_0x2b49e2['value'][_0x8ce8('0x46')]);}else{switch(_0x1f219e['field']){case'unreadMessages':var _0x6e97cc=parseReadParameter(_0x1f219e[_0x8ce8('0x44')]);_0x4a982f[_0x8ce8('0x47')]['and'](_0x6e97cc);break;case'Contact':if(_0x1f219e['operator']==='$substring'){if(_0x1f219e[_0x8ce8('0x44')][_0x8ce8('0x48')]('\x20')['length']>0x1){_0x4a982f[_0x8ce8('0x49')][_0x13ee2e](_0x8ce8('0x3e'),qs[_0x8ce8('0x3b')](_0x1f219e[_0x8ce8('0x44')],!![]),null);}else{var _0x38f842='%'+_0x1f219e[_0x8ce8('0x44')]+'%';_0x4a982f['contact'][_0x13ee2e](_0x8ce8('0x4a'),_0x38f842,_0x38f842,_0x38f842);}}else{_0x53339c=_['find'](_0x2c70f3,[_0x8ce8('0xe'),_0x8ce8('0x4b')]);_0x1f219e['field']=_0x8ce8('0x4b');_0x2b49e2=as[_0x8ce8('0x4c')](_0x15d51a,_0x53339c[_0x8ce8('0x4d')],_0x1f219e);_0x4a982f[_0x8ce8('0x49')][_0x13ee2e](_0x2b49e2[_0x8ce8('0x43')],_0x2b49e2[_0x8ce8('0x44')][_0x8ce8('0x45')],_0x2b49e2[_0x8ce8('0x44')][_0x8ce8('0x46')]);}break;case'Tag':var _0x231c85=_0x1f219e[_0x8ce8('0x44')][_0x8ce8('0x48')](',')['map'](function(_0x3cb5bb){return Number(_0x3cb5bb);});var _0x56c165=parseTagParameter(_0x231c85);_0x4a982f[_0x8ce8('0x4e')][_0x8ce8('0x4f')][_0x8ce8('0x50')](_0x56c165);_0x4a982f['tags']['ids']=_0x231c85;break;case'User':if(_0x1f219e['operator']==='$substring'){_0x4a982f[_0x8ce8('0x51')][_0x13ee2e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1f219e[_0x8ce8('0x44')]+'%',null);}else{_0x53339c=_[_0x8ce8('0x41')](_0x2c70f3,[_0x8ce8('0xe'),'UserId']);_0x1f219e['field']=_0x8ce8('0x52');_0x2b49e2=as[_0x8ce8('0x4c')](_0x15d51a,_0x53339c[_0x8ce8('0x4d')],_0x1f219e);_0x4a982f['user'][_0x13ee2e](_0x2b49e2[_0x8ce8('0x43')],_0x2b49e2['value'][_0x8ce8('0x45')],_0x2b49e2['value'][_0x8ce8('0x46')]);}break;case'body':case _0x8ce8('0x53'):_0x2b49e2=as[_0x8ce8('0x4c')]('me',null,_0x1f219e);_0x4a982f[_0x8ce8('0x54')][_0x13ee2e](_0x2b49e2[_0x8ce8('0x43')],_0x2b49e2[_0x8ce8('0x44')][_0x8ce8('0x45')],_0x2b49e2[_0x8ce8('0x44')][_0x8ce8('0x46')]);break;}}}return _0x4a982f;}function parseModelFields(_0x51cb72,_0x48e6b7,_0x158790){var _0x3f5d10=utils[_0x8ce8('0x8')](_0x51cb72);var _0x28bde9=squel[_0x8ce8('0x29')]();var _0x56eabb=_(_0x48e6b7)[_0x8ce8('0x55')]()['map'](function(_0x105bf9){return _[_0x8ce8('0x56')](_0x158790,[_0x8ce8('0xe'),_0x105bf9])?_0x105bf9:undefined;})[_0x8ce8('0x57')]()[_0x8ce8('0x44')]();if(_0x56eabb[_0x8ce8('0x18')]>0x0){_0x56eabb[_0x8ce8('0x2b')](function(_0x5c83d9){if(_0x5c83d9===_0x3f5d10){_0x28bde9[_0x8ce8('0x50')]('i.'+_0x3f5d10+_0x8ce8('0x1b'),[][_0x8ce8('0x58')](_0x48e6b7[_0x5c83d9]));}else if(_0x5c83d9===_0x8ce8('0x59')){var _0x1c1b15=JSON[_0x8ce8('0x5a')](_0x48e6b7[_0x5c83d9])[_0x8ce8('0x5b')];var _0x2d5d9c=JSON['parse'](_0x48e6b7[_0x5c83d9])[_0x8ce8('0x5c')];_0x28bde9[_0x8ce8('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c1b15,_0x2d5d9c);}else{if(_0x48e6b7[_0x5c83d9]==='null'){_0x28bde9[_0x8ce8('0x50')]('i.'+_0x5c83d9+_0x8ce8('0x5d'));}else{_0x28bde9[_0x8ce8('0x50')]('i.'+_0x5c83d9+_0x8ce8('0x5e'),_0x48e6b7[_0x5c83d9]);}}});}return _0x28bde9;}function parseQueryParameters(_0x104367,_0x5c5a74,_0x8f703b){var _0x42de86=getSqlClauses();return Promise[_0x8ce8('0x5f')]()['then'](function(){return parseModelFields(_0x104367,_0x5c5a74,_0x8f703b);})[_0x8ce8('0x60')](function(_0xd785e0){_0x42de86[_0x8ce8('0x61')][_0x8ce8('0x50')](_0xd785e0);return parseReadParameter(_0x5c5a74['read']);})[_0x8ce8('0x60')](function(_0x1e26a3){_0x42de86[_0x8ce8('0x47')]['and'](_0x1e26a3);return parseTagParameter(_0x5c5a74[_0x8ce8('0x62')]);})['then'](function(_0x1929dc){_0x42de86[_0x8ce8('0x4e')]['clause'][_0x8ce8('0x50')](_0x1929dc);return parseSearchFilter(_0x104367,_0x5c5a74[_0x8ce8('0x63')]);})['then'](function(_0x1655ba){_0x42de86[_0x8ce8('0x63')]=_0x1655ba;return _0x42de86;});}function checkAccountsRestrictions(_0x24c2eb,_0x4a7a13,_0x57ccdf){var _0x1a0c26=utils[_0x8ce8('0x8')](_0x24c2eb);var _0x1a6831='get'+_[_0x8ce8('0x64')](_0x24c2eb)+(_0x24c2eb===_0x8ce8('0x65')?_0x8ce8('0x66'):_0x8ce8('0x67'));var _0x223dd7=squel[_0x8ce8('0x29')]();return Promise[_0x8ce8('0x5f')]()['then'](function(){if(_0x57ccdf[_0x8ce8('0xb')]&&_0x4a7a13[_0x8ce8('0x9')]==='agent'){return _0x4a7a13[_0x1a6831]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x48d091){if(_0x48d091){if(_0x48d091['length']===0x0){_0x223dd7[_0x8ce8('0x50')]('i.'+_0x1a0c26+_0x8ce8('0x5d'));}else{_0x223dd7[_0x8ce8('0x50')]('i.'+_0x1a0c26+_0x8ce8('0x1b'),_['map'](_0x48d091,'id'));}}else if(!_0x57ccdf[_0x1a0c26]){_0x223dd7[_0x8ce8('0x50')]('i.'+_0x1a0c26+_0x8ce8('0x68'));}})['then'](function(){return _0x223dd7;});}function getClosedOrderClause(_0xe10b11,_0x3d1fb4){var _0x284181='';var _0x18376d=[_0x8ce8('0x69'),_0x8ce8('0x6a'),_0x8ce8('0x6b')];if(_0xe10b11===_0x8ce8('0x38')){_0x18376d[_0x8ce8('0x6c')](_0x8ce8('0x6d'));}if(_0x3d1fb4[_0x8ce8('0x6e')]==='0'&&_0xe10b11==='mail'){_0x284181=_0x8ce8('0x6d');}else{if(_0x3d1fb4[_0x8ce8('0x6e')]==='1'){_0x18376d['shift']();}_0x284181='CONCAT_WS(\x27\x27,\x20'+_0x18376d[_0x8ce8('0x6f')](',\x20')+')';}return _0x284181;}function getFilteredInteractions(_0x1df3d0,_0x178b87,_0xa9d7c3,_0xbdf230){var _0x486ee5=utils[_0x8ce8('0x11')](_0x1df3d0);var _0x33f2c9=_[_0x8ce8('0x64')](_0x1df3d0)+_0x8ce8('0x70');var _0x42eeba=[];var _0x4d6580=getTagsQuery();var _0x3cf750={'type':db[_0x8ce8('0x71')][_0x8ce8('0x72')][_0x8ce8('0x73')],'raw':!![]};var _0x5423f5=[];var _0x1d64ba=[];return db[_0x8ce8('0x74')]['query'](_0x4d6580[_0x8ce8('0x75')](),_0x3cf750)[_0x8ce8('0x60')](function(_0x4b08c7){_0x42eeba=_[_0x8ce8('0x76')](_0x4b08c7,'id');_0x3cf750=_[_0x8ce8('0x77')](_0x3cf750,{'model':db[_0x33f2c9],'mapToModel':!![],'nest':!![]});if(_0xa9d7c3['fields']){_0xbdf230[_0x8ce8('0x78')][_0x8ce8('0x2b')](function(_0x579a2d){_0x178b87['field']('i.'+_0x579a2d);});}else{_0x178b87['field'](_0x8ce8('0x79'),_0x8ce8('0x7a'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x7b'),_0x8ce8('0x7c'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x7d'),'Account.mandatoryDisposition');if(_0x1df3d0==='mail'){_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x7e'),_0x8ce8('0x7f'));_0x178b87[_0x8ce8('0xd')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8ce8('0x80'));_0x178b87['field'](_0x8ce8('0x81'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x82'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x83'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x84'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x85'));_0x178b87['field'](_0x8ce8('0x86'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x87'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x88'));_0x178b87['field'](_0x8ce8('0x89'));_0x178b87['field'](_0x8ce8('0x6b'));_0x178b87['field'](_0x8ce8('0x6a'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x69'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x6d'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x8a'));_0x178b87['field'](_0x8ce8('0x8b'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x8c'));_0x178b87[_0x8ce8('0xd')]('i.UserId');}else if(_0x1df3d0===_0x8ce8('0x36')){_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x8d'),'contactName');}else{_0x178b87['field'](_0x8ce8('0x8e'),_0x8ce8('0x80'));}if(_0x1df3d0!==_0x8ce8('0x38')){_0x178b87['field'](_0x8ce8('0x8f'));}_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x90'),'Contact.firstName');_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x91'),_0x8ce8('0x92'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x93'),_0x8ce8('0x94'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x95'),_0x8ce8('0x96'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x97'),_0x8ce8('0x98'));_0x178b87[_0x8ce8('0xd')]('c.fax',_0x8ce8('0x99'));_0x178b87[_0x8ce8('0xd')](_0x8ce8('0x9a'),_0x8ce8('0x9b'));_0x178b87[_0x8ce8('0xd')]('o.internal',_0x8ce8('0x9c'));_0x178b87[_0x8ce8('0xd')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8ce8('0x9d'));}if(_0xbdf230[_0x8ce8('0x9e')]){_0x178b87[_0x8ce8('0x9e')](_0xbdf230[_0x8ce8('0x9e')]);}if(_0xbdf230[_0x8ce8('0x9f')]){_0x178b87[_0x8ce8('0x9f')](_0xbdf230['offset']);}return db[_0x8ce8('0x74')][_0x8ce8('0xa0')](_0x178b87[_0x8ce8('0x75')](),_0x3cf750);})[_0x8ce8('0x60')](function(_0x442d71){_0x5423f5=_0x442d71;var _0x5b2a8f=getUsersQuery(_0x1df3d0,_0x5423f5);return db['sequelize']['query'](_0x5b2a8f[_0x8ce8('0x75')](),_0x3cf750);})[_0x8ce8('0x60')](function(_0x36f72f){_0x1d64ba=_['groupBy'](_0x36f72f,_0x486ee5);if(_0x1df3d0===_0x8ce8('0x38')){return db[_0x8ce8('0xa1')][_0x8ce8('0xa2')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x8ce8('0x60')](function(_0x17d12a){var _0x41a20d=_0x17d12a?_0x17d12a[_0x8ce8('0xa3')]:undefined;var _0x426b9f=_0x5423f5[_0x8ce8('0x1c')](function(_0x387038){return updateInteraction(_0x387038,_0x42eeba,_0x1d64ba,_0x41a20d);});return Promise[_0x8ce8('0xa4')](_0x426b9f);});}function countFilteredInteractions(_0x22f273,_0x10db15){var _0x42f67b=_0x22f273['clone']();_0x42f67b[_0x8ce8('0xd')](_0x8ce8('0xa5'));_0x42f67b['field'](_0x8ce8('0x79'),_0x8ce8('0x7a'));var _0x2bf960=utils['getSelectedTags'](_0x10db15);if(!_[_0x8ce8('0xa6')](_0x2bf960)){_0x42f67b[_0x8ce8('0x19')](_0x8ce8('0xa7'),_0x2bf960);}var _0x46379f={'type':db['Sequelize'][_0x8ce8('0x72')][_0x8ce8('0x73')],'raw':!![]};return db[_0x8ce8('0x74')][_0x8ce8('0xa0')](_0x42f67b['toString'](),_0x46379f);}module[_0x8ce8('0xa8')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 276d3a6..c66ca78 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeab1=['out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash','../../mysqldb','fullname','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne'];(function(_0xaf5b5,_0x4773c6){var _0x13b019=function(_0x23dec6){while(--_0x23dec6){_0xaf5b5['push'](_0xaf5b5['shift']());}};_0x13b019(++_0x4773c6);}(_0xeab1,0x1cb));var _0x1eab=function(_0xa8507f,_0x3d82fe){_0xa8507f=_0xa8507f-0x0;var _0x350809=_0xeab1[_0xa8507f];return _0x350809;};'use strict';var _=require(_0x1eab('0x0'));var db=require(_0x1eab('0x1'))['db'];function getInteractionUsers(_0x1e975b,_0x3dacc6){return new Promise(function(_0x12a371,_0x22c1f0){try{var _0x509140=[];if(_0x3dacc6[_0x1e975b]){_0x509140=_0x3dacc6[_0x1e975b]['map'](function(_0x3fa79b){return{'id':_0x3fa79b['id'],'fullname':_0x3fa79b[_0x1eab('0x2')]};});}return _0x12a371(_0x509140);}catch(_0x26ff62){_0x22c1f0(_0x26ff62);}});}function getInteractionTags(_0x305d85,_0x56a2ae){var _0x488e1a=[];if(_0x305d85){_0x305d85[_0x1eab('0x3')](',')[_0x1eab('0x4')](function(_0x1c59db){_0x488e1a[_0x1eab('0x5')](_0x56a2ae[_0x1c59db]);});}return _0x488e1a;}function updateWaitingCounter(_0x36f658){if(_0x36f658[_0x1eab('0x6')]){_0x36f658[_0x1eab('0x6')]-=0x1;}}function updateInteractionCounters(_0x4c911e){_0x4c911e[_0x1eab('0x6')]=0x0;_0x4c911e['talking']=0x0;_0x4c911e[_0x1eab('0x7')]=0x0;_0x4c911e[_0x1eab('0x8')]=0x0;_0x4c911e[_0x1eab('0x9')]=0x0;_0x4c911e[_0x1eab('0xa')]=0x0;if(_0x4c911e[_0x1eab('0xb')]){if(_0x4c911e[_0x1eab('0xc')]===_0x1eab('0x9')){_0x4c911e[_0x1eab('0x9')]+=0x1;updateWaitingCounter(_0x4c911e);}if(_0x4c911e[_0x1eab('0xd')]){_0x4c911e['answered']+=0x1;if(_0x4c911e['talking']){_0x4c911e[_0x1eab('0xe')]-=0x1;}}else{if(_0x4c911e[_0x1eab('0xc')]){_0x4c911e[_0x1eab('0x8')]+=0x1;updateWaitingCounter(_0x4c911e);}}}else{if(!_0x4c911e[_0x1eab('0xd')]){_0x4c911e[_0x1eab('0x6')]+=0x1;}if(_0x4c911e[_0x1eab('0xd')]){_0x4c911e[_0x1eab('0xe')]+=0x1;updateWaitingCounter(_0x4c911e);}}_0x4c911e[_0x1eab('0xa')]+=0x1;return _0x4c911e;}function getLastMessageText(_0x3c20b7){return db[_0x1eab('0xf')][_0x1eab('0x10')]({'where':{'$and':[{'MailInteractionId':_0x3c20b7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1eab('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1eab('0x12')],'order':_0x1eab('0x13'),'raw':!![]})['then'](function(_0x2091c8){if(_0x2091c8&&_0x2091c8[_0x1eab('0x12')]){_0x3c20b7[_0x1eab('0x14')]=_[_0x1eab('0x15')](_0x2091c8[_0x1eab('0x12')]);}return _0x3c20b7;})[_0x1eab('0x16')](function(_0x3bf5f3){throw _0x3bf5f3;});}exports[_0x1eab('0x17')]=function(_0x3b9cc2,_0x3d7b8e,_0x1be40e,_0x49c029){return new Promise(function(_0x52a28b,_0x919584){return getInteractionUsers(_0x3b9cc2['id'],_0x1be40e)[_0x1eab('0x18')](function(_0x190c72){_0x3b9cc2[_0x1eab('0x19')]=_0x190c72;return getInteractionTags(_0x3b9cc2[_0x1eab('0x1a')],_0x3d7b8e);})[_0x1eab('0x18')](function(_0x491130){_0x3b9cc2[_0x1eab('0x1b')]=_0x491130;delete _0x3b9cc2['TagIds'];return updateInteractionCounters(_0x3b9cc2);})[_0x1eab('0x18')](function(_0x17039e){if(_0x49c029){return getLastMessageText(_0x17039e);}else{return _0x17039e;}})[_0x1eab('0x18')](function(_0x5d378c){_0x52a28b(_0x5d378c);})[_0x1eab('0x16')](function(_0x5de482){_0x919584(_0x5de482);});});}; \ No newline at end of file +var _0x17d5=['then','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','MailMessage','out','plainBody'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x17d5,0x157));var _0x517d=function(_0x24476c,_0x196884){_0x24476c=_0x24476c-0x0;var _0x362a21=_0x17d5[_0x24476c];return _0x362a21;};'use strict';var _=require(_0x517d('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x46127c,_0x809a91){return new Promise(function(_0x24658b,_0x269614){try{var _0x788a57=[];if(_0x809a91[_0x46127c]){_0x788a57=_0x809a91[_0x46127c]['map'](function(_0x7433a4){return{'id':_0x7433a4['id'],'fullname':_0x7433a4['fullname']};});}return _0x24658b(_0x788a57);}catch(_0x297d98){_0x269614(_0x297d98);}});}function getInteractionTags(_0x2e2e6a,_0x41e281){var _0x5ad79b=[];if(_0x2e2e6a){_0x2e2e6a[_0x517d('0x1')](',')[_0x517d('0x2')](function(_0x28a986){_0x5ad79b[_0x517d('0x3')](_0x41e281[_0x28a986]);});}return _0x5ad79b;}function updateWaitingCounter(_0x3edf8a){if(_0x3edf8a[_0x517d('0x4')]){_0x3edf8a['waiting']-=0x1;}}function updateInteractionCounters(_0x1311b4){_0x1311b4[_0x517d('0x4')]=0x0;_0x1311b4[_0x517d('0x5')]=0x0;_0x1311b4[_0x517d('0x6')]=0x0;_0x1311b4[_0x517d('0x7')]=0x0;_0x1311b4[_0x517d('0x8')]=0x0;_0x1311b4[_0x517d('0x9')]=0x0;if(_0x1311b4['closed']){if(_0x1311b4['disposition']===_0x517d('0x8')){_0x1311b4[_0x517d('0x8')]+=0x1;updateWaitingCounter(_0x1311b4);}if(_0x1311b4[_0x517d('0xa')]){_0x1311b4[_0x517d('0x6')]+=0x1;if(_0x1311b4[_0x517d('0x5')]){_0x1311b4[_0x517d('0x5')]-=0x1;}}else{if(_0x1311b4['disposition']){_0x1311b4[_0x517d('0x7')]+=0x1;updateWaitingCounter(_0x1311b4);}}}else{if(!_0x1311b4[_0x517d('0xa')]){_0x1311b4[_0x517d('0x4')]+=0x1;}if(_0x1311b4[_0x517d('0xa')]){_0x1311b4[_0x517d('0x5')]+=0x1;updateWaitingCounter(_0x1311b4);}}_0x1311b4['total']+=0x1;return _0x1311b4;}function getLastMessageText(_0x335ad2){return db[_0x517d('0xb')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x335ad2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x517d('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x517d('0xd')],'order':'-id','raw':!![]})[_0x517d('0xe')](function(_0x51df89){if(_0x51df89&&_0x51df89[_0x517d('0xd')]){_0x335ad2['lastMsgText']=_[_0x517d('0xf')](_0x51df89[_0x517d('0xd')]);}return _0x335ad2;})[_0x517d('0x10')](function(_0x2d2c33){throw _0x2d2c33;});}exports[_0x517d('0x11')]=function(_0x38dd10,_0x507c24,_0x568f23,_0x3d1fd3){return new Promise(function(_0x1109ed,_0x43d775){return getInteractionUsers(_0x38dd10['id'],_0x568f23)[_0x517d('0xe')](function(_0x26be3a){_0x38dd10[_0x517d('0x12')]=_0x26be3a;return getInteractionTags(_0x38dd10['TagIds'],_0x507c24);})[_0x517d('0xe')](function(_0x4ff01c){_0x38dd10[_0x517d('0x13')]=_0x4ff01c;delete _0x38dd10[_0x517d('0x14')];return updateInteractionCounters(_0x38dd10);})['then'](function(_0x27a8e0){if(_0x3d1fd3){return getLastMessageText(_0x27a8e0);}else{return _0x27a8e0;}})[_0x517d('0xe')](function(_0x1aa0c0){_0x1109ed(_0x1aa0c0);})[_0x517d('0x10')](function(_0x197b2e){_0x43d775(_0x197b2e);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 92460e3..c0d4d2d 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf975=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','Interaction','findOne','then','info','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','user_has_','_interactions','isArray'];(function(_0x1ec8ca,_0x3d992f){var _0x14115d=function(_0x1018c5){while(--_0x1018c5){_0x1ec8ca['push'](_0x1ec8ca['shift']());}};_0x14115d(++_0x3d992f);}(_0xf975,0xfa));var _0x5f97=function(_0x5d963e,_0x5edbfe){_0x5d963e=_0x5d963e-0x0;var _0x523c8e=_0xf975[_0x5d963e];return _0x523c8e;};'use strict';var _=require(_0x5f97('0x0'));var db=require(_0x5f97('0x1'))['db'];var loggers={'openchannel':require(_0x5f97('0x2'))(_0x5f97('0x3')),'mail':require(_0x5f97('0x2'))(_0x5f97('0x4')),'fax':require(_0x5f97('0x2'))(_0x5f97('0x5')),'sms':require(_0x5f97('0x2'))('sms-interactions'),'chat':require(_0x5f97('0x2'))(_0x5f97('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x428998){return _[_0x5f97('0x7')](_0x428998)+(_0x428998===_0x5f97('0x8')?_0x5f97('0x9'):_0x5f97('0xa'))+'Id';}function getInteractionFK(_0x1e6d21){return _[_0x5f97('0x7')](_0x1e6d21)+_0x5f97('0xb');}function getInteractionId(_0x36062a,_0xc3aef8,_0x353e6f){if(_0x36062a&&_0x36062a[_['upperFirst'](_0x353e6f)+'InteractionId']){return _0x36062a[_[_0x5f97('0xc')](_0x353e6f)+_0x5f97('0xb')];}else if(_0x36062a&&_0x36062a['id']){return _0x36062a['id'];}else if(_0xc3aef8&&_0xc3aef8['id']){return _0xc3aef8['id'];}else{return _0x5f97('0xd');}}function getInteractionsTables(_0x2083ca){return{'accounts':_0x2083ca+'_'+(_0x2083ca===_0x5f97('0x8')?_0x5f97('0xe'):_0x5f97('0xf')),'interactions':_0x2083ca+'_interactions','interactionsTags':_0x2083ca+_0x5f97('0x10'),'messages':_0x2083ca+'_messages','userInteractions':_0x5f97('0x11')+_0x2083ca+_0x5f97('0x12')};}function getSelectedTags(_0x3e873b){var _0x2d3498=[];if(_0x3e873b){_0x2d3498=Array[_0x5f97('0x13')](_0x3e873b)?_0x3e873b:[_0x3e873b];}return _0x2d3498;}function log(_0x24f4fe,_0x3f4465,_0x9bbbdf,_0x2a7bea,_0x50a7b8,_0x11f9f1){loggers[_0x50a7b8['toLowerCase']()][_0x24f4fe](_0x5f97('0x14'),_0x11f9f1[_0x5f97('0x15')](),_0x3f4465?_0x3f4465['id']:null,_0x3f4465?_0x3f4465[_0x5f97('0x16')]:null,_0x3f4465?_0x3f4465['role']:null,getInteractionId(_0x9bbbdf,_0x2a7bea,_0x50a7b8),_0x9bbbdf?JSON[_0x5f97('0x17')](_0x9bbbdf):'null');}function updateUser(_0x1c2fca,_0x567207,_0x33ef49,_0x7a3f05,_0x3e4de9){db[_['upperFirst'](_0x7a3f05)+_0x5f97('0x18')][_0x5f97('0x19')]({'where':{'id':getInteractionId(_0x567207,_0x33ef49,_0x7a3f05)}})['then'](function(_0x7682dc){if(_0x7682dc){return _0x7682dc['update']({'UserId':_0x1c2fca?_0x1c2fca['id']:null});}})[_0x5f97('0x1a')](function(_0x57e64e){if(_0x57e64e){log(_0x5f97('0x1b'),_0x1c2fca,_0x567207,_0x33ef49,_0x7a3f05,_0x3e4de9);}})[_0x5f97('0x1c')](function(){log(_0x5f97('0x1d'),_0x1c2fca,_0x567207,_0x33ef49,_0x7a3f05,_0x3e4de9);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe380=['Account','InteractionId','upperFirst','unknown','chat','accounts','_interactions','_interaction_has_tags','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','Interaction','findOne','then','update','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website'];(function(_0x578b39,_0x8d559c){var _0x4994a6=function(_0x1a3116){while(--_0x1a3116){_0x578b39['push'](_0x578b39['shift']());}};_0x4994a6(++_0x8d559c);}(_0xe380,0xd5));var _0x0e38=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe380[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x0e38('0x0'));var db=require(_0x0e38('0x1'))['db'];var loggers={'openchannel':require(_0x0e38('0x2'))(_0x0e38('0x3')),'mail':require(_0x0e38('0x2'))(_0x0e38('0x4')),'fax':require('../../config/logger')(_0x0e38('0x5')),'sms':require('../../config/logger')(_0x0e38('0x6')),'chat':require('../../config/logger')(_0x0e38('0x7')),'whatsapp':require(_0x0e38('0x2'))(_0x0e38('0x8'))};function getAccountFK(_0x2ff247){return _[_0x0e38('0x9')](_0x2ff247)+(_0x2ff247==='chat'?_0x0e38('0xa'):_0x0e38('0xb'))+'Id';}function getInteractionFK(_0x3900c3){return _[_0x0e38('0x9')](_0x3900c3)+_0x0e38('0xc');}function getInteractionId(_0x54c5d6,_0x4f52df,_0x4656ab){if(_0x54c5d6&&_0x54c5d6[_[_0x0e38('0xd')](_0x4656ab)+'InteractionId']){return _0x54c5d6[_[_0x0e38('0xd')](_0x4656ab)+_0x0e38('0xc')];}else if(_0x54c5d6&&_0x54c5d6['id']){return _0x54c5d6['id'];}else if(_0x4f52df&&_0x4f52df['id']){return _0x4f52df['id'];}else{return _0x0e38('0xe');}}function getInteractionsTables(_0x484719){return{'accounts':_0x484719+'_'+(_0x484719===_0x0e38('0xf')?'websites':_0x0e38('0x10')),'interactions':_0x484719+_0x0e38('0x11'),'interactionsTags':_0x484719+_0x0e38('0x12'),'messages':_0x484719+'_messages','userInteractions':_0x0e38('0x13')+_0x484719+_0x0e38('0x11')};}function getSelectedTags(_0x5afd33){var _0x6b0e64=[];if(_0x5afd33){_0x6b0e64=Array[_0x0e38('0x14')](_0x5afd33)?_0x5afd33:[_0x5afd33];}return _0x6b0e64;}function log(_0x15a1e1,_0x49b1c8,_0x259a4f,_0x4e01f4,_0x54ba5c,_0x5a767f){loggers[_0x54ba5c['toLowerCase']()][_0x15a1e1](_0x0e38('0x15'),_0x5a767f[_0x0e38('0x16')](),_0x49b1c8?_0x49b1c8['id']:null,_0x49b1c8?_0x49b1c8['name']:null,_0x49b1c8?_0x49b1c8['role']:null,getInteractionId(_0x259a4f,_0x4e01f4,_0x54ba5c),_0x259a4f?JSON['stringify'](_0x259a4f):'null');}function updateUser(_0x1ba9bc,_0x24eed8,_0x19e557,_0x4b050a,_0x17317a){db[_[_0x0e38('0xd')](_0x4b050a)+_0x0e38('0x17')][_0x0e38('0x18')]({'where':{'id':getInteractionId(_0x24eed8,_0x19e557,_0x4b050a)}})[_0x0e38('0x19')](function(_0x2001c6){if(_0x2001c6){return _0x2001c6[_0x0e38('0x1a')]({'UserId':_0x1ba9bc?_0x1ba9bc['id']:null});}})[_0x0e38('0x19')](function(_0x300234){if(_0x300234){log('info',_0x1ba9bc,_0x24eed8,_0x19e557,_0x4b050a,_0x17317a);}})['catch'](function(){log('error',_0x1ba9bc,_0x24eed8,_0x19e557,_0x4b050a,_0x17317a);});}module[_0x0e38('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f58858c..c2428f4 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b42=['use','License','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','utf8','final','parse','hasOwnProperty'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x0b42,0x7d));var _0x20b4=function(_0x46feab,_0x737036){_0x46feab=_0x46feab-0x0;var _0x7749df=_0x0b42[_0x46feab];return _0x7749df;};'use strict';var crypto=require('crypto');var util=require(_0x20b4('0x0'));var compose=require(_0x20b4('0x1'));var db=require(_0x20b4('0x2'))['db'];var config=require(_0x20b4('0x3'));function getValueFromLicense(_0x1447fe,_0x18bac0){if(_0x1447fe&&_0x18bac0){if(_0x18bac0[_0x20b4('0x4')]&&_0x18bac0[_0x20b4('0x5')]){var _0x580d44=_0x18bac0['data1'];var _0x34092e=_0x18bac0[_0x20b4('0x5')];var _0x3c1132=_0x580d44[_0x20b4('0x6')]('-')[0x4];var _0x19eca3=_0x580d44[_0x20b4('0x6')]('-')[0x0];var _0x2cdde3=crypto[_0x20b4('0x7')]('aes-256-ctr',util['format'](_0x20b4('0x8'),_0x3c1132,_0x580d44,_0x19eca3));var _0x1bc898=_0x2cdde3['update'](_0x34092e,'base64',_0x20b4('0x9'));_0x1bc898+=_0x2cdde3[_0x20b4('0xa')](_0x20b4('0x9'));var _0x20c068=JSON[_0x20b4('0xb')](_0x1bc898);return _0x20c068[_0x20b4('0xc')](_0x1447fe)?_0x20c068[_0x1447fe]:null;}}return null;}function isLimit(_0xc7bb5c,_0x2bcb58,_0x123647,_0x42d98b){var _0x1474bc=_0x2bcb58;return compose()[_0x20b4('0xd')](function(_0x3631bc,_0x12ca76,_0x5bc51a){return db[_0x20b4('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x20b4('0xf')](function(_0x534b4e){var _0x4b2d9c=getValueFromLicense(_0xc7bb5c,_0x534b4e);return _0x4b2d9c?_0x4b2d9c:_0x1474bc;})['then'](function(_0x472fe2){_0x1474bc=_0x472fe2;return _0x123647['count'](_0x42d98b);})[_0x20b4('0xf')](function(_0x22acfb){if(_0x22acfb>=_0x1474bc){return _0x12ca76[_0x20b4('0x10')](0x193)[_0x20b4('0x11')]({'message':util['format'](_0x20b4('0x12'),_0xc7bb5c)});}_0x5bc51a();})[_0x20b4('0x13')](function(_0x63198f){_0x5bc51a(_0x63198f);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x20b4('0x14')],{'where':{'$or':[{'role':_0x20b4('0x15')},{'role':_0x20b4('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x5b2a=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','base64','utf8','parse','use','License','findOne','then','count'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x5b2a,0xe1));var _0xa5b2=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x5b2a[_0x138d06];return _0x1a01eb;};'use strict';var crypto=require(_0xa5b2('0x0'));var util=require(_0xa5b2('0x1'));var compose=require(_0xa5b2('0x2'));var db=require(_0xa5b2('0x3'))['db'];var config=require(_0xa5b2('0x4'));function getValueFromLicense(_0x19034a,_0x44d539){if(_0x19034a&&_0x44d539){if(_0x44d539[_0xa5b2('0x5')]&&_0x44d539[_0xa5b2('0x6')]){var _0x26dad1=_0x44d539[_0xa5b2('0x5')];var _0x3f8e8b=_0x44d539['license'];var _0x59eab6=_0x26dad1[_0xa5b2('0x7')]('-')[0x4];var _0x169c2d=_0x26dad1['split']('-')[0x0];var _0x78dbfe=crypto['createDecipher'](_0xa5b2('0x8'),util[_0xa5b2('0x9')]('%s:%s:%s',_0x59eab6,_0x26dad1,_0x169c2d));var _0x20c4a2=_0x78dbfe['update'](_0x3f8e8b,_0xa5b2('0xa'),_0xa5b2('0xb'));_0x20c4a2+=_0x78dbfe['final'](_0xa5b2('0xb'));var _0x78671d=JSON[_0xa5b2('0xc')](_0x20c4a2);return _0x78671d['hasOwnProperty'](_0x19034a)?_0x78671d[_0x19034a]:null;}}return null;}function isLimit(_0x5b7559,_0x15585e,_0xd8d42f,_0x520a15){var _0x3c364a=_0x15585e;return compose()[_0xa5b2('0xd')](function(_0x31b1af,_0x50be2b,_0x1ce7d0){return db[_0xa5b2('0xe')][_0xa5b2('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xa5b2('0x10')](function(_0x19c1de){var _0x36dcd5=getValueFromLicense(_0x5b7559,_0x19c1de);return _0x36dcd5?_0x36dcd5:_0x3c364a;})[_0xa5b2('0x10')](function(_0x288f61){_0x3c364a=_0x288f61;return _0xd8d42f[_0xa5b2('0x11')](_0x520a15);})[_0xa5b2('0x10')](function(_0x2dc422){if(_0x2dc422>=_0x3c364a){return _0x50be2b[_0xa5b2('0x12')](0x193)[_0xa5b2('0x13')]({'message':util[_0xa5b2('0x9')](_0xa5b2('0x14'),_0x5b7559)});}_0x1ce7d0();})[_0xa5b2('0x15')](function(_0x38de61){_0x1ce7d0(_0x38de61);});});}function isUserLimit(){return isLimit(_0xa5b2('0x16'),0x1,db[_0xa5b2('0x17')],{'where':{'$or':[{'role':_0xa5b2('0x18')},{'role':_0xa5b2('0x19')}]}});}exports[_0xa5b2('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 783cf03..ab858e2 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 _0x13a6=['field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','hours','minutes','seconds','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','$gt','$lte','operator','add','days','format','YYYY-MM-DD','castTo','CAST(','text'];(function(_0x400eac,_0x65b655){var _0x2bd7d2=function(_0x11f46a){while(--_0x11f46a){_0x400eac['push'](_0x400eac['shift']());}};_0x2bd7d2(++_0x65b655);}(_0x13a6,0xfa));var _0x613a=function(_0x13fba5,_0x1be336){_0x13fba5=_0x13fba5-0x0;var _0x546f09=_0x13a6[_0x13fba5];return _0x546f09;};'use strict';var _=require('lodash');var moment=require(_0x613a('0x0'));exports[_0x613a('0x1')]=function(_0x5f5b92){var _0xb7c3fe={'conditions':[]};_0xb7c3fe['sqlOperator']=_[_0x613a('0x2')](_0x5f5b92,_0x613a('0x3'))?'or':_0x613a('0x4');var _0x166ebe=_0x5f5b92[_0x613a('0x5')](_0x613a('0x6'),'')[_0x613a('0x5')]('[$or]','')[_0x613a('0x7')]('||');for(var _0x1ecced=0x0;_0x1ecced<_0x166ebe['length'];_0x1ecced++){var _0x3aa77e=_0x166ebe[_0x1ecced][_0x613a('0x7')](':=');var _0x2acbd5=_0x3aa77e[0x0];var _0x16e5ff=_0x3aa77e[_0x613a('0x8')](0x1);_0x16e5ff[_0x613a('0x9')](function(_0x3020ec){var _0x391d58=_0x3020ec[_0x613a('0x7')]('[')['shift']();var _0x202446=_0x3020ec['match'](/\[(.*?)\]/g);_0x202446[_0x613a('0x9')](function(_0x3fac67){var _0x48f910=_0x3fac67[_0x613a('0x7')]('[')[_0x613a('0xa')](function(_0x2ecfc8){return _0x2ecfc8[_0x613a('0xb')](']')>-0x1;})[_0x613a('0xc')](function(_0x52e882){return _0x52e882['split'](']')[0x0];})[0x0];_0xb7c3fe[_0x613a('0xd')][_0x613a('0xe')]({'field':_0x2acbd5,'operator':_0x391d58,'value':_0x48f910});});});}return _0xb7c3fe;};exports[_0x613a('0xf')]=function(_0x26e785,_0x47fc8,_0x7fe2b9){var _0x4c350e={};if(_0x47fc8===_0x613a('0x10')){if(_0x7fe2b9['operator']===_0x613a('0x11')){_0x7fe2b9['operator']=_0x613a('0x12');_0x7fe2b9[_0x613a('0x13')]+=','+_0x7fe2b9[_0x613a('0x13')];}else if(_['includes']([_0x613a('0x14'),_0x613a('0x15')],_0x7fe2b9[_0x613a('0x16')])){_0x7fe2b9[_0x613a('0x13')]=moment(_0x7fe2b9[_0x613a('0x13')])[_0x613a('0x17')](0x1,_0x613a('0x18'))[_0x613a('0x19')](_0x613a('0x1a'));}}if(_0x7fe2b9[_0x613a('0x1b')]){_0x47fc8=_0x7fe2b9[_0x613a('0x1b')];_0x4c350e['text']=_0x613a('0x1c')+_0x26e785+'.'+_0x7fe2b9['field']+'\x20AS\x20'+_0x7fe2b9[_0x613a('0x1b')]+')\x20'+parseOperator(_0x7fe2b9[_0x613a('0x16')]);}else{_0x4c350e[_0x613a('0x1d')]=_0x26e785+'.'+_0x7fe2b9[_0x613a('0x1e')]+'\x20'+parseOperator(_0x7fe2b9[_0x613a('0x16')]);}if(_[_0x613a('0x1f')]([_0x613a('0x20'),_0x613a('0x21')],_0x7fe2b9[_0x613a('0x16')]))_0x4c350e[_0x613a('0x1d')]='('+_0x4c350e[_0x613a('0x1d')]+_0x613a('0x22')+_0x26e785+'.'+_0x7fe2b9['field']+_0x613a('0x23');_0x4c350e['value']=parseValue(_0x47fc8,_0x7fe2b9[_0x613a('0x16')],_0x7fe2b9['value']);return _0x4c350e;};function parseOperator(_0x36d779){var _0x1362c1;switch(_0x36d779){case _0x613a('0x24'):_0x1362c1='IN\x20?';break;case _0x613a('0x21'):_0x1362c1=_0x613a('0x25');break;case'$eq':_0x1362c1=_0x613a('0x26');break;case _0x613a('0x20'):_0x1362c1=_0x613a('0x27');break;case _0x613a('0x28'):case _0x613a('0x29'):case _0x613a('0x2a'):_0x1362c1=_0x613a('0x2b');break;case _0x613a('0x2c'):_0x1362c1='<\x20?';break;case _0x613a('0x14'):_0x1362c1=_0x613a('0x2d');break;case _0x613a('0x15'):_0x1362c1=_0x613a('0x2e');break;case _0x613a('0x2f'):_0x1362c1=_0x613a('0x30');break;case _0x613a('0x12'):_0x1362c1=_0x613a('0x31');break;}return _0x1362c1;}function parseValue(_0x2da0f7,_0x566ce4,_0x16e186){var _0x3ad749={'start':undefined,'end':undefined};switch(_0x566ce4){case'$in':case _0x613a('0x21'):_0x3ad749['start']=_0x16e186['split'](',');break;case _0x613a('0x28'):_0x3ad749[_0x613a('0x32')]='%'+_0x16e186+'%';break;case'$startsWith':_0x3ad749[_0x613a('0x32')]=_0x16e186+'%';break;case _0x613a('0x2a'):_0x3ad749[_0x613a('0x32')]='%'+_0x16e186;break;case'$between':var _0x1391e9=_0x16e186['split'](',');var _0x16e186=_0x1391e9[_0x613a('0x33')]();var _0x21c441=_0x1391e9[_0x613a('0x34')]();if(_0x2da0f7===_0x613a('0x10')){_0x16e186=moment(_0x16e186)['utcOffset'](0x0,!![])['format']();_0x21c441=moment(_0x21c441)['utcOffset'](0x0,!![])[_0x613a('0x17')](0x17,_0x613a('0x35'))[_0x613a('0x17')](0x3b,_0x613a('0x36'))[_0x613a('0x17')](0x3b,_0x613a('0x37'))[_0x613a('0x19')]();}_0x3ad749={'start':_0x16e186,'end':_0x21c441};break;default:_0x3ad749[_0x613a('0x32')]=_0x16e186;break;}return _0x3ad749;} \ No newline at end of file +var _0x0d6b=['$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$substring','start','pop','DATE','utcOffset','hours','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','$eq','operator','value','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?'];(function(_0x3a8acd,_0x463c24){var _0x59a5fc=function(_0x316d98){while(--_0x316d98){_0x3a8acd['push'](_0x3a8acd['shift']());}};_0x59a5fc(++_0x463c24);}(_0x0d6b,0x1b6));var _0xb0d6=function(_0x357bf2,_0x4f6a7f){_0x357bf2=_0x357bf2-0x0;var _0x6531ed=_0x0d6b[_0x357bf2];return _0x6531ed;};'use strict';var _=require(_0xb0d6('0x0'));var moment=require(_0xb0d6('0x1'));exports['parseSearch']=function(_0x42a555){var _0x396ca8={'conditions':[]};_0x396ca8[_0xb0d6('0x2')]=_[_0xb0d6('0x3')](_0x42a555,_0xb0d6('0x4'))?'or':_0xb0d6('0x5');var _0x3566c8=_0x42a555[_0xb0d6('0x6')](_0xb0d6('0x7'),'')['replace'](_0xb0d6('0x4'),'')['split']('||');for(var _0x5d2b06=0x0;_0x5d2b06<_0x3566c8[_0xb0d6('0x8')];_0x5d2b06++){var _0x1be551=_0x3566c8[_0x5d2b06][_0xb0d6('0x9')](':=');var _0x548377=_0x1be551[0x0];var _0x54cf33=_0x1be551[_0xb0d6('0xa')](0x1);_0x54cf33['forEach'](function(_0x3e1d01){var _0x133b32=_0x3e1d01[_0xb0d6('0x9')]('[')[_0xb0d6('0xb')]();var _0x2316ae=_0x3e1d01[_0xb0d6('0xc')](/\[(.*?)\]/g);_0x2316ae[_0xb0d6('0xd')](function(_0x627176){var _0x4c2b09=_0x627176['split']('[')[_0xb0d6('0xe')](function(_0x579aae){return _0x579aae[_0xb0d6('0xf')](']')>-0x1;})[_0xb0d6('0x10')](function(_0x220f13){return _0x220f13['split'](']')[0x0];})[0x0];_0x396ca8[_0xb0d6('0x11')][_0xb0d6('0x12')]({'field':_0x548377,'operator':_0x133b32,'value':_0x4c2b09});});});}return _0x396ca8;};exports[_0xb0d6('0x13')]=function(_0x3657fd,_0x32f8db,_0x53ceb5){var _0xaf75b6={};if(_0x32f8db==='DATE'){if(_0x53ceb5['operator']===_0xb0d6('0x14')){_0x53ceb5[_0xb0d6('0x15')]='$between';_0x53ceb5['value']+=','+_0x53ceb5[_0xb0d6('0x16')];}else if(_['includes']([_0xb0d6('0x17'),_0xb0d6('0x18')],_0x53ceb5[_0xb0d6('0x15')])){_0x53ceb5[_0xb0d6('0x16')]=moment(_0x53ceb5[_0xb0d6('0x16')])[_0xb0d6('0x19')](0x1,_0xb0d6('0x1a'))[_0xb0d6('0x1b')]('YYYY-MM-DD');}}if(_0x53ceb5[_0xb0d6('0x1c')]){_0x32f8db=_0x53ceb5['castTo'];_0xaf75b6[_0xb0d6('0x1d')]=_0xb0d6('0x1e')+_0x3657fd+'.'+_0x53ceb5[_0xb0d6('0x1f')]+_0xb0d6('0x20')+_0x53ceb5[_0xb0d6('0x1c')]+')\x20'+parseOperator(_0x53ceb5[_0xb0d6('0x15')]);}else{_0xaf75b6[_0xb0d6('0x1d')]=_0x3657fd+'.'+_0x53ceb5['field']+'\x20'+parseOperator(_0x53ceb5[_0xb0d6('0x15')]);}if(_[_0xb0d6('0x21')]([_0xb0d6('0x22'),_0xb0d6('0x23')],_0x53ceb5['operator']))_0xaf75b6['text']='('+_0xaf75b6[_0xb0d6('0x1d')]+'\x20OR\x20'+_0x3657fd+'.'+_0x53ceb5['field']+_0xb0d6('0x24');_0xaf75b6[_0xb0d6('0x16')]=parseValue(_0x32f8db,_0x53ceb5[_0xb0d6('0x15')],_0x53ceb5[_0xb0d6('0x16')]);return _0xaf75b6;};function parseOperator(_0x8126f1){var _0x4ee85f;switch(_0x8126f1){case _0xb0d6('0x25'):_0x4ee85f=_0xb0d6('0x26');break;case _0xb0d6('0x23'):_0x4ee85f=_0xb0d6('0x27');break;case _0xb0d6('0x14'):_0x4ee85f=_0xb0d6('0x28');break;case _0xb0d6('0x22'):_0x4ee85f=_0xb0d6('0x29');break;case'$substring':case _0xb0d6('0x2a'):case _0xb0d6('0x2b'):_0x4ee85f=_0xb0d6('0x2c');break;case _0xb0d6('0x2d'):_0x4ee85f=_0xb0d6('0x2e');break;case'$gt':_0x4ee85f=_0xb0d6('0x2f');break;case _0xb0d6('0x18'):_0x4ee85f=_0xb0d6('0x30');break;case _0xb0d6('0x31'):_0x4ee85f=_0xb0d6('0x32');break;case _0xb0d6('0x33'):_0x4ee85f=_0xb0d6('0x34');break;}return _0x4ee85f;}function parseValue(_0x250cf2,_0x386cb6,_0x2bb090){var _0x439302={'start':undefined,'end':undefined};switch(_0x386cb6){case _0xb0d6('0x25'):case'$notIn':_0x439302['start']=_0x2bb090[_0xb0d6('0x9')](',');break;case _0xb0d6('0x35'):_0x439302[_0xb0d6('0x36')]='%'+_0x2bb090+'%';break;case _0xb0d6('0x2a'):_0x439302[_0xb0d6('0x36')]=_0x2bb090+'%';break;case _0xb0d6('0x2b'):_0x439302[_0xb0d6('0x36')]='%'+_0x2bb090;break;case'$between':var _0x54c775=_0x2bb090[_0xb0d6('0x9')](',');var _0x2bb090=_0x54c775[_0xb0d6('0xb')]();var _0xc1d022=_0x54c775[_0xb0d6('0x37')]();if(_0x250cf2===_0xb0d6('0x38')){_0x2bb090=moment(_0x2bb090)[_0xb0d6('0x39')](0x0,!![])[_0xb0d6('0x1b')]();_0xc1d022=moment(_0xc1d022)['utcOffset'](0x0,!![])[_0xb0d6('0x19')](0x17,_0xb0d6('0x3a'))['add'](0x3b,'minutes')[_0xb0d6('0x19')](0x3b,_0xb0d6('0x3b'))['format']();}_0x439302={'start':_0x2bb090,'end':_0xc1d022};break;default:_0x439302[_0xb0d6('0x36')]=_0x2bb090;break;}return _0x439302;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index a73229e..b4cd2d0 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 _0x5f01=['order','sort','pick','filter','object','columns','value','where','merge','lower','include','includeAll','sequelize','moment','../../mysqldb','includes','parse','model','alias','fields','split','filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','map','indexOf','priority','col','unsigned','substr','DESC','ASC','omit','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','push','replace','{EXPR}','join','getOptions','query','keys','intersection','attributes','hasOwnProperty'];(function(_0x132412,_0x38d5e3){var _0x56cd41=function(_0x33fc1c){while(--_0x33fc1c){_0x132412['push'](_0x132412['shift']());}};_0x56cd41(++_0x38d5e3);}(_0x5f01,0xcc));var _0x15f0=function(_0xf87bb3,_0x1cbbe3){_0xf87bb3=_0xf87bb3-0x0;var _0xf7501=_0x5f01[_0xf87bb3];return _0xf7501;};'use strict';var _=require('lodash');var sequelize=require(_0x15f0('0x0'));var moment=require(_0x15f0('0x1'));var db=require(_0x15f0('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x47f9c6){var _0x7f9bb9=['ne'];try{var _0x217f0a=JSON['parse'](_0x47f9c6);var _0x3a7689=Object['keys'](_0x217f0a)[0x0];return _0x7f9bb9[_0x15f0('0x3')](_0x3a7689);}catch(_0x702be2){return![];}}function getOperatorValue(_0x19d434){var _0x2ead28=JSON[_0x15f0('0x4')](_0x19d434);var _0x182b54=Object['keys'](_0x2ead28)[0x0];var _0xde8869=_0x2ead28[_0x182b54];return{['$'+_0x182b54]:_0xde8869};}function parseIncludeModel(_0x162117){var _0x9d9779=JSON[_0x15f0('0x4')](_0x162117);return{'model':db[_0x9d9779[_0x15f0('0x5')]],'as':_0x9d9779[_0x15f0('0x6')],'attributes':_0x9d9779[_0x15f0('0x7')],'raw':_0x9d9779['raw']};}exports[_0x15f0('0x7')]=function(_0x35677b){var _0x4ed33a=null;if(_0x35677b){_0x4ed33a=_0x35677b[_0x15f0('0x8')](',');}return _0x4ed33a;};exports[_0x15f0('0x9')]=function(_0x585e0a,_0x157d2b){var _0x2425c8={};if(!_[_0x15f0('0xa')](_0x585e0a)){_['forOwn'](_0x585e0a,function(_0x489096,_0x36bf9f){try{if(_0x157d2b){var _0x240f46=_[_0x15f0('0xb')](_0x157d2b,{'name':_0x36bf9f})||{};if(hasSequelizeOperator(_0x489096)){_0x2425c8[_0x36bf9f]=getOperatorValue(_0x489096);}else if(_0x240f46[_0x15f0('0xc')]===_0x15f0('0xd')&&_[_0x15f0('0xe')](_0x489096)){var _0x39ab74=JSON[_0x15f0('0x4')](_0x489096);var _0x43c2be={'$gte':moment(moment(_0x39ab74[_0x15f0('0xf')])[_0x15f0('0x10')](_0x15f0('0x11')))[_0x15f0('0x12')]()[_0x15f0('0x10')](),'$lte':moment(moment(_0x39ab74[_0x15f0('0x13')])['format'](_0x15f0('0x11')))[_0x15f0('0x12')]()[_0x15f0('0x14')](0x1,'s')[_0x15f0('0x10')]()};_0x2425c8[_0x36bf9f]=_0x43c2be;}else if(_0x240f46[_0x15f0('0x15')]==='uniqueid'){_0x2425c8[_0x36bf9f]=_0x489096;}else{_0x2425c8[_0x36bf9f]=_['isArray'](_0x489096)?_0x489096:JSON[_0x15f0('0x4')](_0x489096);}}else{_0x2425c8[_0x36bf9f]=_[_0x15f0('0x16')](_0x489096)?_0x489096:JSON[_0x15f0('0x4')](_0x489096);}}catch(_0x2cc2cf){_0x2425c8[_0x36bf9f]=_0x489096[_0x15f0('0x8')](',');}});}return _0x2425c8;};exports[_0x15f0('0x17')]=function(_0x402af2){_0x402af2=parseInt(_0x402af2,0xa);if(!_0x402af2||_0x402af2<0x0){_0x402af2=LIMIT_VALUE;}return _0x402af2;};exports[_0x15f0('0x18')]=function(_0x5d7b1a){_0x5d7b1a=parseInt(_0x5d7b1a,0xa);if(!_0x5d7b1a||_0x5d7b1a<0x0){_0x5d7b1a=0x0;}return _0x5d7b1a;};exports['sort']=function(_0x13b899){var _0x1e0928,_0x26daf5=null;if(_0x13b899){_0x1e0928=_0x13b899[_0x15f0('0x8')](',');_0x26daf5=_[_0x15f0('0x19')](_0x1e0928,function(_0x58ab15){if(_0x58ab15[_0x15f0('0x1a')]('-')===0x0){return[_0x58ab15===_0x15f0('0x1b')?sequelize['cast'](sequelize[_0x15f0('0x1c')]('priority'),_0x15f0('0x1d')):_0x58ab15[_0x15f0('0x1e')](0x1),_0x15f0('0x1f')];}else{return[_0x58ab15==='priority'?sequelize['cast'](sequelize[_0x15f0('0x1c')](_0x15f0('0x1b')),_0x15f0('0x1d')):_0x58ab15,_0x15f0('0x20')];}});}return _0x26daf5;};exports[_0x15f0('0x21')]=function(_0x3eff82,_0x2e9d1c){if(_[_0x15f0('0xa')](_0x3eff82)){return _0x3eff82;}if(_[_0x15f0('0x16')](_0x3eff82)){for(var _0x788bb6=0x0;_0x788bb6<_0x3eff82[_0x15f0('0x22')];_0x788bb6+=0x1){_0x3eff82[_0x788bb6]=this[_0x15f0('0x21')](_0x3eff82[_0x788bb6],_0x2e9d1c);}return _0x3eff82;}if(!_['isObject'](_0x3eff82)){return _0x3eff82;}if(_[_0x15f0('0x23')](_0x2e9d1c)){_0x2e9d1c=[_0x2e9d1c];}if(!_[_0x15f0('0x16')](_0x2e9d1c)){return _0x3eff82;}for(var _0xfa6079=0x0;_0xfa6079<_0x2e9d1c[_0x15f0('0x22')];_0xfa6079+=0x1){_[_0x15f0('0x24')](_0x3eff82,_0x2e9d1c[_0xfa6079]);}for(var _0x52e6c7 in _0x3eff82){if(_0x3eff82['hasOwnProperty'](_0x52e6c7)){_0x3eff82[_0x52e6c7]=this['omit'](_0x3eff82[_0x52e6c7],_0x2e9d1c);}}return _0x3eff82;};exports[_0x15f0('0x25')]=function(_0x597586){return _0x597586[_0x15f0('0x26')](RegExp(_0x15f0('0x27')))?!![]:![];};exports[_0x15f0('0x28')]=function(_0x2adec7){return _0x2adec7[_0x15f0('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x15f0('0x29')]=function(_0x550650,_0x4dbfaf){var _0x51ded7=[];var _0x54d39e=/[ `!@#$%^&*()_\-?~]/;var _0x44d6ea=_0x4dbfaf?'\x22{EXPR}\x22':'{EXPR}';_0x550650[_0x15f0('0x8')](/[ ,]+/)['forEach'](function(_0x3f5c34){_0x3f5c34=_0x3f5c34['replace'](/([^:]")"+/g,'$1');_0x3f5c34='+'+_0x3f5c34+'*';var _0x19ec0c=_0x3f5c34[_0x15f0('0x26')](_0x54d39e);if(_0x19ec0c){_0x3f5c34='\x22'+_0x3f5c34+'\x22';}_0x51ded7[_0x15f0('0x2a')](_0x3f5c34);});_0x44d6ea=_0x44d6ea[_0x15f0('0x2b')](_0x15f0('0x2c'),_0x51ded7[_0x15f0('0x2d')]('\x20'));return _0x44d6ea;};exports[_0x15f0('0x2e')]=function(_0x4b9c78,_0x2ac51d,_0x5cb1f8){var _0x44a31d={},_0x31ca66={};if(_0x2ac51d[_0x15f0('0x2f')]['$id']){_0x2ac51d['query']['id']=_0x2ac51d['query']['$id'];delete _0x2ac51d[_0x15f0('0x2f')]['$id'];}_0x44a31d['model']=_[_0x15f0('0x19')](_0x4b9c78,_0x15f0('0x15'));_0x44a31d['query']=_[_0x15f0('0x30')](_0x2ac51d['query']);_0x44a31d[_0x15f0('0x9')]=_[_0x15f0('0x31')](_0x44a31d[_0x15f0('0x5')],_0x44a31d[_0x15f0('0x2f')]);_0x31ca66[_0x15f0('0x32')]=_['intersection'](_0x44a31d['model'],this[_0x15f0('0x7')](_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x7')]));_0x31ca66[_0x15f0('0x32')]=_0x31ca66[_0x15f0('0x32')]['length']?_0x31ca66[_0x15f0('0x32')]:_0x44a31d['model'];if(!_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x33')]('nolimit')){_0x31ca66[_0x15f0('0x17')]=this[_0x15f0('0x17')](_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x17')]);_0x31ca66[_0x15f0('0x18')]=this[_0x15f0('0x18')](_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x18')]);}_0x31ca66[_0x15f0('0x34')]=this[_0x15f0('0x35')](_0x2ac51d[_0x15f0('0x2f')]['sort']);_0x31ca66['where']=this[_0x15f0('0x9')](_[_0x15f0('0x36')](_0x2ac51d['query'],_0x44a31d[_0x15f0('0x9')]),_0x4b9c78);if(_0x2ac51d['query']['filter']){var _0xa53af2=_0x4b9c78;var _0x42f0ff=_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x37')];if(typeof _0x42f0ff===_0x15f0('0x38')){_0xa53af2=_['filter'](_0x4b9c78,function(_0x4c8da5){return _['includes'](_0x42f0ff[_0x15f0('0x39')],_0x4c8da5[_0x15f0('0x15')]);});_0x42f0ff=_0x42f0ff[_0x15f0('0x3a')];}_0x31ca66[_0x15f0('0x3b')]=_[_0x15f0('0x3c')](_0x31ca66[_0x15f0('0x3b')],{'$or':_[_0x15f0('0x19')](_0xa53af2,function(_0x213b45){if(_0x213b45[_0x15f0('0xc')]!=='VIRTUAL'){if(_0x5cb1f8){return sequelize[_0x15f0('0x3b')](sequelize['fn'](_0x15f0('0x3d'),sequelize[_0x15f0('0x1c')](_0x213b45['name'])),{'$like':sequelize['fn'](_0x15f0('0x3d'),'%'+_0x2ac51d[_0x15f0('0x2f')][_0x15f0('0x37')]+'%')});}else{var _0x32e030={};_0x32e030[_0x213b45['name']]={'$like':'%'+_0x2ac51d['query'][_0x15f0('0x37')]+'%'};return _0x32e030;}}})});}_0x31ca66=_[_0x15f0('0x3c')]({},_0x31ca66,_0x2ac51d['options']);return _0x31ca66;};exports[_0x15f0('0x3e')]=function(_0x3c1a53){var _0x39bc93=[];if(_0x3c1a53[_0x15f0('0x3f')]){_0x39bc93[_0x15f0('0x2a')]({'all':!![]});}else if(_0x3c1a53[_0x15f0('0x3e')]){if(Array[_0x15f0('0x16')](_0x3c1a53[_0x15f0('0x3e')])){_0x39bc93=Object[_0x15f0('0x30')](_0x3c1a53[_0x15f0('0x3e')])[_0x15f0('0x19')](function(_0x433361){return parseIncludeModel(_0x3c1a53[_0x15f0('0x3e')][_0x433361]);});}else{var _0x2d7837=parseIncludeModel(_0x3c1a53[_0x15f0('0x3e')]);_0x39bc93['push'](_0x2d7837);}}return _0x39bc93;}; \ No newline at end of file +var _0x3c3e=['lodash','sequelize','moment','parse','keys','includes','model','alias','raw','fields','split','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','forEach','push','replace','join','getOptions','query','$id','filters','intersection','attributes','nolimit','order','where','pick','filter','object','merge','VIRTUAL','lower','includeAll','include'];(function(_0x3240ff,_0x3b9c3d){var _0x514858=function(_0x22023a){while(--_0x22023a){_0x3240ff['push'](_0x3240ff['shift']());}};_0x514858(++_0x3b9c3d);}(_0x3c3e,0x86));var _0xe3c3=function(_0x550eb6,_0x2eea1f){_0x550eb6=_0x550eb6-0x0;var _0x3a1f1a=_0x3c3e[_0x550eb6];return _0x3a1f1a;};'use strict';var _=require(_0xe3c3('0x0'));var sequelize=require(_0xe3c3('0x1'));var moment=require(_0xe3c3('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x12a9ba){var _0x516f92=['ne'];try{var _0x2a3a29=JSON[_0xe3c3('0x3')](_0x12a9ba);var _0x34fbb1=Object[_0xe3c3('0x4')](_0x2a3a29)[0x0];return _0x516f92[_0xe3c3('0x5')](_0x34fbb1);}catch(_0x39d7af){return![];}}function getOperatorValue(_0x21220e){var _0x4d9334=JSON[_0xe3c3('0x3')](_0x21220e);var _0x4c11c9=Object[_0xe3c3('0x4')](_0x4d9334)[0x0];var _0x5e0091=_0x4d9334[_0x4c11c9];return{['$'+_0x4c11c9]:_0x5e0091};}function parseIncludeModel(_0x5e6587){var _0x17c256=JSON['parse'](_0x5e6587);return{'model':db[_0x17c256[_0xe3c3('0x6')]],'as':_0x17c256[_0xe3c3('0x7')],'attributes':_0x17c256['fields'],'raw':_0x17c256[_0xe3c3('0x8')]};}exports[_0xe3c3('0x9')]=function(_0x3f7905){var _0xc7fad9=null;if(_0x3f7905){_0xc7fad9=_0x3f7905[_0xe3c3('0xa')](',');}return _0xc7fad9;};exports['filters']=function(_0x2d0ece,_0x5b9af9){var _0x3d5fe6={};if(!_[_0xe3c3('0xb')](_0x2d0ece)){_[_0xe3c3('0xc')](_0x2d0ece,function(_0x29c18a,_0x4b1409){try{if(_0x5b9af9){var _0x4aa6f0=_[_0xe3c3('0xd')](_0x5b9af9,{'name':_0x4b1409})||{};if(hasSequelizeOperator(_0x29c18a)){_0x3d5fe6[_0x4b1409]=getOperatorValue(_0x29c18a);}else if(_0x4aa6f0[_0xe3c3('0xe')]===_0xe3c3('0xf')&&_[_0xe3c3('0x10')](_0x29c18a)){var _0x29bd30=JSON[_0xe3c3('0x3')](_0x29c18a);var _0xa0da73={'$gte':moment(moment(_0x29bd30[_0xe3c3('0x11')])['format'](_0xe3c3('0x12')))[_0xe3c3('0x13')]()[_0xe3c3('0x14')](),'$lte':moment(moment(_0x29bd30[_0xe3c3('0x15')])[_0xe3c3('0x14')](_0xe3c3('0x12')))[_0xe3c3('0x13')]()[_0xe3c3('0x16')](0x1,'s')[_0xe3c3('0x14')]()};_0x3d5fe6[_0x4b1409]=_0xa0da73;}else if(_0x4aa6f0[_0xe3c3('0x17')]==='uniqueid'){_0x3d5fe6[_0x4b1409]=_0x29c18a;}else{_0x3d5fe6[_0x4b1409]=_[_0xe3c3('0x18')](_0x29c18a)?_0x29c18a:JSON['parse'](_0x29c18a);}}else{_0x3d5fe6[_0x4b1409]=_[_0xe3c3('0x18')](_0x29c18a)?_0x29c18a:JSON[_0xe3c3('0x3')](_0x29c18a);}}catch(_0x4c37a7){_0x3d5fe6[_0x4b1409]=_0x29c18a['split'](',');}});}return _0x3d5fe6;};exports[_0xe3c3('0x19')]=function(_0x2de4c5){_0x2de4c5=parseInt(_0x2de4c5,0xa);if(!_0x2de4c5||_0x2de4c5<0x0){_0x2de4c5=LIMIT_VALUE;}return _0x2de4c5;};exports[_0xe3c3('0x1a')]=function(_0x538f60){_0x538f60=parseInt(_0x538f60,0xa);if(!_0x538f60||_0x538f60<0x0){_0x538f60=0x0;}return _0x538f60;};exports[_0xe3c3('0x1b')]=function(_0x48046f){var _0x574a5c,_0x3125fd=null;if(_0x48046f){_0x574a5c=_0x48046f[_0xe3c3('0xa')](',');_0x3125fd=_[_0xe3c3('0x1c')](_0x574a5c,function(_0x228055){if(_0x228055[_0xe3c3('0x1d')]('-')===0x0){return[_0x228055===_0xe3c3('0x1e')?sequelize[_0xe3c3('0x1f')](sequelize[_0xe3c3('0x20')](_0xe3c3('0x1e')),_0xe3c3('0x21')):_0x228055[_0xe3c3('0x22')](0x1),_0xe3c3('0x23')];}else{return[_0x228055===_0xe3c3('0x1e')?sequelize[_0xe3c3('0x1f')](sequelize[_0xe3c3('0x20')](_0xe3c3('0x1e')),'unsigned'):_0x228055,_0xe3c3('0x24')];}});}return _0x3125fd;};exports['omit']=function(_0x15cf2b,_0x326acf){if(_[_0xe3c3('0xb')](_0x15cf2b)){return _0x15cf2b;}if(_[_0xe3c3('0x18')](_0x15cf2b)){for(var _0x64f36b=0x0;_0x64f36b<_0x15cf2b[_0xe3c3('0x25')];_0x64f36b+=0x1){_0x15cf2b[_0x64f36b]=this[_0xe3c3('0x26')](_0x15cf2b[_0x64f36b],_0x326acf);}return _0x15cf2b;}if(!_['isObject'](_0x15cf2b)){return _0x15cf2b;}if(_[_0xe3c3('0x27')](_0x326acf)){_0x326acf=[_0x326acf];}if(!_[_0xe3c3('0x18')](_0x326acf)){return _0x15cf2b;}for(var _0x55bffd=0x0;_0x55bffd<_0x326acf[_0xe3c3('0x25')];_0x55bffd+=0x1){_[_0xe3c3('0x28')](_0x15cf2b,_0x326acf[_0x55bffd]);}for(var _0x4da6a8 in _0x15cf2b){if(_0x15cf2b[_0xe3c3('0x29')](_0x4da6a8)){_0x15cf2b[_0x4da6a8]=this[_0xe3c3('0x26')](_0x15cf2b[_0x4da6a8],_0x326acf);}}return _0x15cf2b;};exports['isNumeric']=function(_0x109cf6){return _0x109cf6[_0xe3c3('0x2a')](RegExp(_0xe3c3('0x2b')))?!![]:![];};exports['isEmail']=function(_0x391c9f){return _0x391c9f[_0xe3c3('0x2a')](/^\S+@\S+$/)?!![]:![];};exports[_0xe3c3('0x2c')]=function(_0x48e9ce,_0x35848f){var _0x16c566=[];var _0xbbf619=/[ `!@#$%^&*()_\-?~]/;var _0x37a689=_0x35848f?'\x22{EXPR}\x22':_0xe3c3('0x2d');_0x48e9ce[_0xe3c3('0xa')](/[ ,]+/)[_0xe3c3('0x2e')](function(_0x4518f0){_0x4518f0=_0x4518f0['replace'](/([^:]")"+/g,'$1');_0x4518f0='+'+_0x4518f0+'*';var _0x21596f=_0x4518f0[_0xe3c3('0x2a')](_0xbbf619);if(_0x21596f){_0x4518f0='\x22'+_0x4518f0+'\x22';}_0x16c566[_0xe3c3('0x2f')](_0x4518f0);});_0x37a689=_0x37a689[_0xe3c3('0x30')]('{EXPR}',_0x16c566[_0xe3c3('0x31')]('\x20'));return _0x37a689;};exports[_0xe3c3('0x32')]=function(_0x4f6803,_0x1ee00a,_0x1051a2){var _0x179ea7={},_0x5ac569={};if(_0x1ee00a[_0xe3c3('0x33')]['$id']){_0x1ee00a[_0xe3c3('0x33')]['id']=_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x34')];delete _0x1ee00a['query'][_0xe3c3('0x34')];}_0x179ea7[_0xe3c3('0x6')]=_['map'](_0x4f6803,_0xe3c3('0x17'));_0x179ea7[_0xe3c3('0x33')]=_[_0xe3c3('0x4')](_0x1ee00a['query']);_0x179ea7[_0xe3c3('0x35')]=_[_0xe3c3('0x36')](_0x179ea7[_0xe3c3('0x6')],_0x179ea7[_0xe3c3('0x33')]);_0x5ac569[_0xe3c3('0x37')]=_[_0xe3c3('0x36')](_0x179ea7['model'],this['fields'](_0x1ee00a['query']['fields']));_0x5ac569[_0xe3c3('0x37')]=_0x5ac569[_0xe3c3('0x37')][_0xe3c3('0x25')]?_0x5ac569['attributes']:_0x179ea7[_0xe3c3('0x6')];if(!_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x29')](_0xe3c3('0x38'))){_0x5ac569[_0xe3c3('0x19')]=this[_0xe3c3('0x19')](_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x19')]);_0x5ac569[_0xe3c3('0x1a')]=this[_0xe3c3('0x1a')](_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x1a')]);}_0x5ac569[_0xe3c3('0x39')]=this[_0xe3c3('0x1b')](_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x1b')]);_0x5ac569[_0xe3c3('0x3a')]=this[_0xe3c3('0x35')](_[_0xe3c3('0x3b')](_0x1ee00a[_0xe3c3('0x33')],_0x179ea7[_0xe3c3('0x35')]),_0x4f6803);if(_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x3c')]){var _0x33c3e0=_0x4f6803;var _0x4cbe53=_0x1ee00a[_0xe3c3('0x33')]['filter'];if(typeof _0x4cbe53===_0xe3c3('0x3d')){_0x33c3e0=_[_0xe3c3('0x3c')](_0x4f6803,function(_0x4e49f5){return _[_0xe3c3('0x5')](_0x4cbe53['columns'],_0x4e49f5[_0xe3c3('0x17')]);});_0x4cbe53=_0x4cbe53['value'];}_0x5ac569[_0xe3c3('0x3a')]=_[_0xe3c3('0x3e')](_0x5ac569[_0xe3c3('0x3a')],{'$or':_[_0xe3c3('0x1c')](_0x33c3e0,function(_0x152837){if(_0x152837[_0xe3c3('0xe')]!==_0xe3c3('0x3f')){if(_0x1051a2){return sequelize[_0xe3c3('0x3a')](sequelize['fn'](_0xe3c3('0x40'),sequelize[_0xe3c3('0x20')](_0x152837[_0xe3c3('0x17')])),{'$like':sequelize['fn'](_0xe3c3('0x40'),'%'+_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x3c')]+'%')});}else{var _0x227b66={};_0x227b66[_0x152837[_0xe3c3('0x17')]]={'$like':'%'+_0x1ee00a[_0xe3c3('0x33')][_0xe3c3('0x3c')]+'%'};return _0x227b66;}}})});}_0x5ac569=_[_0xe3c3('0x3e')]({},_0x5ac569,_0x1ee00a['options']);return _0x5ac569;};exports['include']=function(_0x25ceef){var _0x44ed2f=[];if(_0x25ceef[_0xe3c3('0x41')]){_0x44ed2f[_0xe3c3('0x2f')]({'all':!![]});}else if(_0x25ceef[_0xe3c3('0x42')]){if(Array[_0xe3c3('0x18')](_0x25ceef[_0xe3c3('0x42')])){_0x44ed2f=Object['keys'](_0x25ceef[_0xe3c3('0x42')])['map'](function(_0x49aefe){return parseIncludeModel(_0x25ceef[_0xe3c3('0x42')][_0x49aefe]);});}else{var _0x166678=parseIncludeModel(_0x25ceef[_0xe3c3('0x42')]);_0x44ed2f[_0xe3c3('0x2f')](_0x166678);}}return _0x44ed2f;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 2aff979..a357978 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['jayson/promise','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','length','unknown','isNil','idle','voiceStatus','pause','every','chatStatus','faxStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','getRealtimeAgents','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','filter','busy','getAgentIdsByStatus','includes','findAll','name','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','fields','order','startsWith','ASC','getUpdatedSortOptions','fullname','internal','substring','indexOf','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','lastLoginAt','voiceStatusTime','whatsappStatusTime','chatCapacity','faxCapacity','openchannelCapacity','chatCurrentCapacity','onhold'];(function(_0x4f11d1,_0x4b3f2d){var _0x21375a=function(_0x15fdee){while(--_0x15fdee){_0x4f11d1['push'](_0x4f11d1['shift']());}};_0x21375a(++_0x4b3f2d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4986a,_0x2d7aed){_0x4986a=_0x4986a-0x0;var _0x1df5cf=_0xdbf5[_0x4986a];return _0x1df5cf;};'use strict';var _=require('lodash');var jayson=require(_0x5dbf('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0x5dbf('0x1')]({'port':0x232a});var routingClient=jayson[_0x5dbf('0x2')][_0x5dbf('0x1')]({'port':0x232c});function isAgentPaused(_0x3afe14,_0x38b629){var _0x1a1ea9=[_0x3afe14[_0x5dbf('0x3')],_0x3afe14[_0x5dbf('0x4')],_0x3afe14[_0x5dbf('0x5')],_0x3afe14[_0x5dbf('0x6')],_0x3afe14[_0x5dbf('0x7')],_0x3afe14[_0x5dbf('0x8')],_0x3afe14[_0x5dbf('0x9')]];if(!_0x38b629)return _['every'](_0x1a1ea9);var _0x134810=_['filter'](_0x1a1ea9);return _0x134810[_0x5dbf('0xa')]>0x0&&_0x134810[_0x5dbf('0xa')]<_0x1a1ea9[_0x5dbf('0xa')]?!![]:![];}function isIdle(_0x1813bb){return _0x1813bb==='idle'||_0x1813bb===_0x5dbf('0xb')||_0x1813bb==='unavailable'||_0x1813bb==='ringing'||_[_0x5dbf('0xc')](_0x1813bb);}function isAgentIdle(_0x5dbc97){if(_0x5dbc97['voiceStatus']!==_0x5dbf('0xd')&&_0x5dbc97['voicePause']){_0x5dbc97[_0x5dbf('0xe')]=_0x5dbf('0xf');return![];}return _[_0x5dbf('0x10')]([_0x5dbc97[_0x5dbf('0x11')],_0x5dbc97[_0x5dbf('0x12')],_0x5dbc97['mailStatus'],_0x5dbc97['openchannelStatus'],_0x5dbc97[_0x5dbf('0x13')],_0x5dbc97[_0x5dbf('0xe')],_0x5dbc97['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x5dbf('0x14')](_0x5dbf('0x15'),{})[_0x5dbf('0x16')](function(_0x2dfa44){if(_0x2dfa44[_0x5dbf('0x17')]){throw new Error(_0x5dbf('0x18'));}var _0x2d32cc=_0x2dfa44['result'];return routingClient['request'](_0x5dbf('0x15'),{})[_0x5dbf('0x16')](function(_0x39c7aa){if(_0x39c7aa[_0x5dbf('0x17')]){throw new Error(_0x5dbf('0x19'));}var _0x5ce68e=_0x39c7aa[_0x5dbf('0x1a')];return _['merge']({},_0x2d32cc,_0x5ce68e);});})['catch'](function(_0x577ca2){throw _0x577ca2;});}exports[_0x5dbf('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x3cedac){var _0x358d46=_0x5dbf('0xb');if(isAgentPaused(_0x3cedac))_0x358d46=_0x5dbf('0xf');else if(isAgentPaused(_0x3cedac,!![]))_0x358d46='*pause';else if(isAgentIdle(_0x3cedac))_0x358d46=_0x5dbf('0xd');else _0x358d46='busy';return _0x358d46;}exports[_0x5dbf('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x11cc67,_0x14d133){var _0x43a612=_[_0x5dbf('0x1d')](_0x11cc67)?_0x11cc67:[_0x11cc67];var _0x2f154e=_['startCase'](_0x14d133)+_0x5dbf('0x1e');var _0x3e3a2d=_[_0x5dbf('0x1f')](_0x43a612,function(_0x2079fc){return db[_0x2f154e][_0x5dbf('0x20')]({'where':{'id':_0x2079fc}})[_0x5dbf('0x16')](function(_0x290456){if(!_0x290456)return[];return _0x290456[_0x5dbf('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5dbf('0x22')](_0x3e3a2d)[_0x5dbf('0x16')](function(_0x9e15ac){var _0x232c77=_(_0x9e15ac)[_0x5dbf('0x23')]()[_0x5dbf('0x1f')]('id')[_0x5dbf('0x24')]()[_0x5dbf('0x25')]();return _0x232c77;});}exports[_0x5dbf('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3f8341,_0x159e61,_0x22ec42){try{if(_0x159e61[_0x5dbf('0xa')]>0x0){_0x3f8341=_0x3f8341[_0x5dbf('0x27')](function(_0x21cd00){return _0x159e61['includes'](_0x21cd00['id']);});}var _0x2f71eb=_0x3f8341[_0x5dbf('0x27')](function(_0xc4748){var _0x1fb9a7=_0x5dbf('0x28');if(isAgentIdle(_0xc4748)){_0x1fb9a7=_0x5dbf('0xd');}return _0x1fb9a7===_0x22ec42;});return _[_0x5dbf('0x1f')](_0x2f71eb,'id');}catch(_0x31d57a){throw _0x31d57a;}}exports[_0x5dbf('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x273b63,_0x294dd7,_0x50a307){return Promise['resolve']()[_0x5dbf('0x16')](function(){if(_0x294dd7[_0x5dbf('0xa')]>0x0){_0x273b63=_0x273b63[_0x5dbf('0x27')](function(_0x3b73ad){return _0x294dd7[_0x5dbf('0x2a')](_0x3b73ad['id']);});}return _0x273b63;})['then'](function(){return db['User'][_0x5dbf('0x2b')]({'attributes':['id',_0x5dbf('0x2c'),'fullname',_0x5dbf('0x3'),_0x5dbf('0x4'),_0x5dbf('0x5'),_0x5dbf('0x6'),_0x5dbf('0x7'),'voicePause',_0x5dbf('0x9'),_0x5dbf('0x2d')],'where':{'id':{'$in':_[_0x5dbf('0x1f')](_0x273b63,'id')}},'raw':!![]});})[_0x5dbf('0x16')](function(_0x3a8196){return _0x3a8196['map'](function(_0x252d54){var _0x7dc2da=_[_0x5dbf('0x2e')](_0x273b63,['id',_0x252d54['id']]);var _0x133eba=filterAgentAttributes(_0x7dc2da);_['merge'](_0x252d54,_0x133eba);_0x252d54[_0x5dbf('0x2f')]=getAgentStatus(_0x252d54);return _0x252d54;});})[_0x5dbf('0x16')](function(_0x302dda){var _0x3439da=sortAgentsByStatus(_0x302dda,_0x50a307);return _[_0x5dbf('0x1f')](_0x3439da,'id');})[_0x5dbf('0x30')](function(_0x1aeb02){throw _0x1aeb02;});}exports[_0x5dbf('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x272a6e){var _0x462d69={'fields':[],'order':null};var _0x1ba835=_0x272a6e['split'](',');_0x462d69[_0x5dbf('0x32')]=_[_0x5dbf('0x27')](_0x1ba835,function(_0x12d595){if(!_0x12d595['includes'](_0x5dbf('0x2f'))){return!![];}_0x462d69[_0x5dbf('0x33')]=_[_0x5dbf('0x34')](_0x12d595,'-')?'DESC':_0x5dbf('0x35');return![];});return _0x462d69;}exports[_0x5dbf('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x9bd4c0){if(!_0x9bd4c0){_0x9bd4c0='fullname,internal';}if(_0x9bd4c0[_0x5dbf('0x2a')](_0x5dbf('0x37'))&&!_0x9bd4c0[_0x5dbf('0x2a')](_0x5dbf('0x38'))){var _0x10537d=_0x9bd4c0[_0x5dbf('0x39')](0x0,_0x9bd4c0[_0x5dbf('0x3a')](_0x5dbf('0x37')));_0x9bd4c0+=','+_0x10537d+'internal';}return _0x9bd4c0;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x57ee72,_0x555e61){var _0x28b28f=_0x57ee72[_0x5dbf('0x3b')](function(_0x54e5e7,_0x3ef0eb){if(_0x54e5e7[_0x5dbf('0x2f')]===_0x3ef0eb['globalStatus']){if(_0x54e5e7[_0x5dbf('0x2f')]===_0x5dbf('0xf')){if(_0x555e61===_0x5dbf('0x3c')){return(_0x54e5e7[_0x5dbf('0x2d')]||'')<(_0x3ef0eb[_0x5dbf('0x2d')]||'')||_0x54e5e7[_0x5dbf('0x37')][_0x5dbf('0x3d')]()>_0x3ef0eb[_0x5dbf('0x37')][_0x5dbf('0x3d')]()?0x1:-0x1;}else{return(_0x54e5e7[_0x5dbf('0x2d')]||'')<(_0x3ef0eb['pauseType']||'')||_0x54e5e7[_0x5dbf('0x37')][_0x5dbf('0x3d')]()>_0x3ef0eb[_0x5dbf('0x37')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x555e61===_0x5dbf('0x3c')){return _0x54e5e7[_0x5dbf('0x37')][_0x5dbf('0x3d')]()<_0x3ef0eb[_0x5dbf('0x37')]['toLowerCase']()?0x1:-0x1;}else{return _0x54e5e7[_0x5dbf('0x37')]['toLowerCase']()<_0x3ef0eb[_0x5dbf('0x37')][_0x5dbf('0x3d')]()?-0x1:0x1;}}}else{if(_0x555e61===_0x5dbf('0x3c')){return _0x54e5e7[_0x5dbf('0x2f')]<_0x3ef0eb['globalStatus']?0x1:-0x1;}else{return _0x54e5e7['globalStatus']<_0x3ef0eb[_0x5dbf('0x2f')]?-0x1:0x1;}}});return _0x28b28f;}exports[_0x5dbf('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x1246d7){var _0x5c10e5=[_0x5dbf('0x3f'),'online','lastLoginAt','lastPauseAt','pauseType',_0x5dbf('0x40'),_0x5dbf('0x38'),'address',_0x5dbf('0x3'),_0x5dbf('0x6'),'mailPause',_0x5dbf('0x7'),_0x5dbf('0x9'),'faxPause',_0x5dbf('0x8'),'chatCapacity','openchannelCapacity',_0x5dbf('0x41'),_0x5dbf('0x42'),_0x5dbf('0x43'),'faxCapacity','chatCurrentCapacity',_0x5dbf('0x44'),_0x5dbf('0x45'),_0x5dbf('0x46'),_0x5dbf('0x47'),_0x5dbf('0x48'),_0x5dbf('0x11'),_0x5dbf('0x49'),_0x5dbf('0x4a'),'smsStatus',_0x5dbf('0x4b'),_0x5dbf('0x12'),_0x5dbf('0xe'),_0x5dbf('0x4c'),_0x5dbf('0x4d'),_0x5dbf('0x4e'),_0x5dbf('0x4f'),'whatsappStatusTime',_0x5dbf('0x50'),'voiceStatusTime',_0x5dbf('0x51'),_0x5dbf('0x52'),_0x5dbf('0x53'),_0x5dbf('0x54'),_0x5dbf('0x55'),_0x5dbf('0x56')];var _0x353d0f=['chatPause','openchannelPause','mailPause',_0x5dbf('0x7'),_0x5dbf('0x9'),_0x5dbf('0x4'),'voicePause','online'];var _0x10def8=_(_0x1246d7)[_0x5dbf('0x57')](_0x353d0f)[_0x5dbf('0x58')](_0x5c10e5)['value']();return _0x10def8;}exports[_0x5dbf('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x5dbf('0x37'),_0x5dbf('0x5a'),_0x5dbf('0x38'),'online','globalStatus',_0x5dbf('0x3f'),_0x5dbf('0x5b'),_0x5dbf('0x2d'),_0x5dbf('0x40'),'faxPause',_0x5dbf('0x3'),_0x5dbf('0x5'),'openchannelPause','smsPause',_0x5dbf('0x8'),_0x5dbf('0x9'),_0x5dbf('0x11'),_0x5dbf('0x12'),_0x5dbf('0x4a'),_0x5dbf('0x49'),'smsStatus',_0x5dbf('0xe'),'whatsappStatus','chatStatusTime','faxStatusTime',_0x5dbf('0x4e'),'openchannelStatusTime',_0x5dbf('0x4f'),_0x5dbf('0x5c'),_0x5dbf('0x5d'),_0x5dbf('0x5e'),_0x5dbf('0x5f'),_0x5dbf('0x41'),_0x5dbf('0x60'),_0x5dbf('0x42'),_0x5dbf('0x43'),_0x5dbf('0x61'),_0x5dbf('0x48'),_0x5dbf('0x45'),_0x5dbf('0x44'),_0x5dbf('0x46'),_0x5dbf('0x47'),'phoneBarEnableScreenRecordingByAgent',_0x5dbf('0x55'),'destconnectedlinenum',_0x5dbf('0x62'),_0x5dbf('0x51'),_0x5dbf('0x56'),_0x5dbf('0x53')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x6aa7=['getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','chatPause','pauseType','find','globalStatus','fields','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','role','openchannelStatusTime','smsStatusTime','chatCurrentCapacity','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','every','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','Agents','then','error','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value'];(function(_0x551cd0,_0x5ae993){var _0x2a8cde=function(_0x21cbd8){while(--_0x21cbd8){_0x551cd0['push'](_0x551cd0['shift']());}};_0x2a8cde(++_0x5ae993);}(_0x6aa7,0x178));var _0x76aa=function(_0xe7b7f5,_0x25822a){_0xe7b7f5=_0xe7b7f5-0x0;var _0x151f49=_0x6aa7[_0xe7b7f5];return _0x151f49;};'use strict';var _=require(_0x76aa('0x0'));var jayson=require('jayson/promise');var db=require(_0x76aa('0x1'))['db'];var amiClient=jayson[_0x76aa('0x2')][_0x76aa('0x3')]({'port':0x232a});var routingClient=jayson[_0x76aa('0x2')]['http']({'port':0x232c});function isAgentPaused(_0x13f62b,_0xef15ef){var _0x1d6e04=[_0x13f62b['chatPause'],_0x13f62b['faxPause'],_0x13f62b[_0x76aa('0x4')],_0x13f62b['openchannelPause'],_0x13f62b[_0x76aa('0x5')],_0x13f62b[_0x76aa('0x6')],_0x13f62b[_0x76aa('0x7')]];if(!_0xef15ef)return _['every'](_0x1d6e04);var _0x3dae33=_[_0x76aa('0x8')](_0x1d6e04);return _0x3dae33[_0x76aa('0x9')]>0x0&&_0x3dae33['length']<_0x1d6e04[_0x76aa('0x9')]?!![]:![];}function isIdle(_0x25856d){return _0x25856d===_0x76aa('0xa')||_0x25856d===_0x76aa('0xb')||_0x25856d===_0x76aa('0xc')||_0x25856d===_0x76aa('0xd')||_[_0x76aa('0xe')](_0x25856d);}function isAgentIdle(_0x8dc35c){if(_0x8dc35c[_0x76aa('0xf')]!==_0x76aa('0xa')&&_0x8dc35c['voicePause']){_0x8dc35c[_0x76aa('0xf')]='pause';return![];}return _[_0x76aa('0x10')]([_0x8dc35c[_0x76aa('0x11')],_0x8dc35c[_0x76aa('0x12')],_0x8dc35c[_0x76aa('0x13')],_0x8dc35c[_0x76aa('0x14')],_0x8dc35c['smsStatus'],_0x8dc35c['voiceStatus'],_0x8dc35c[_0x76aa('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x5cf594){if(_0x5cf594[_0x76aa('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x328381=_0x5cf594['result'];return routingClient[_0x76aa('0x19')](_0x76aa('0x16'),{})[_0x76aa('0x17')](function(_0x21c16d){if(_0x21c16d[_0x76aa('0x18')]){throw new Error(_0x76aa('0x1a'));}var _0x496902=_0x21c16d['result'];return _[_0x76aa('0x1b')]({},_0x328381,_0x496902);});})[_0x76aa('0x1c')](function(_0xf0711){throw _0xf0711;});}exports[_0x76aa('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x15109b){var _0x191560=_0x76aa('0xb');if(isAgentPaused(_0x15109b))_0x191560=_0x76aa('0x1e');else if(isAgentPaused(_0x15109b,!![]))_0x191560=_0x76aa('0x1f');else if(isAgentIdle(_0x15109b))_0x191560='idle';else _0x191560=_0x76aa('0x20');return _0x191560;}exports[_0x76aa('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x338a6b,_0x5b3f55){var _0x41463a=_[_0x76aa('0x22')](_0x338a6b)?_0x338a6b:[_0x338a6b];var _0x31252f=_[_0x76aa('0x23')](_0x5b3f55)+_0x76aa('0x24');var _0xc1044c=_[_0x76aa('0x25')](_0x41463a,function(_0x3363b3){return db[_0x31252f][_0x76aa('0x26')]({'where':{'id':_0x3363b3}})[_0x76aa('0x17')](function(_0x37f1ab){if(!_0x37f1ab)return[];return _0x37f1ab[_0x76aa('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x76aa('0x28')](_0xc1044c)['then'](function(_0xb5e8a9){var _0x1d6d15=_(_0xb5e8a9)[_0x76aa('0x29')]()[_0x76aa('0x25')]('id')[_0x76aa('0x2a')]()[_0x76aa('0x2b')]();return _0x1d6d15;});}exports[_0x76aa('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x282d0a,_0xd12a99,_0x1bdc3d){try{if(_0xd12a99['length']>0x0){_0x282d0a=_0x282d0a[_0x76aa('0x8')](function(_0x5a8030){return _0xd12a99[_0x76aa('0x2d')](_0x5a8030['id']);});}var _0x365ff8=_0x282d0a[_0x76aa('0x8')](function(_0x1e90b9){var _0x1eecd9=_0x76aa('0x20');if(isAgentIdle(_0x1e90b9)){_0x1eecd9=_0x76aa('0xa');}return _0x1eecd9===_0x1bdc3d;});return _[_0x76aa('0x25')](_0x365ff8,'id');}catch(_0x19fd4f){throw _0x19fd4f;}}exports[_0x76aa('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5edcd8,_0x430ad6,_0x5532c7){return Promise[_0x76aa('0x2f')]()[_0x76aa('0x17')](function(){if(_0x430ad6[_0x76aa('0x9')]>0x0){_0x5edcd8=_0x5edcd8[_0x76aa('0x8')](function(_0x35a705){return _0x430ad6['includes'](_0x35a705['id']);});}return _0x5edcd8;})[_0x76aa('0x17')](function(){return db[_0x76aa('0x30')]['findAll']({'attributes':['id',_0x76aa('0x31'),'fullname',_0x76aa('0x32'),'faxPause',_0x76aa('0x4'),'openchannelPause','smsPause',_0x76aa('0x6'),_0x76aa('0x7'),_0x76aa('0x33')],'where':{'id':{'$in':_[_0x76aa('0x25')](_0x5edcd8,'id')}},'raw':!![]});})['then'](function(_0x592596){return _0x592596[_0x76aa('0x25')](function(_0x1c7b6f){var _0x58127c=_[_0x76aa('0x34')](_0x5edcd8,['id',_0x1c7b6f['id']]);var _0x23029e=filterAgentAttributes(_0x58127c);_['merge'](_0x1c7b6f,_0x23029e);_0x1c7b6f[_0x76aa('0x35')]=getAgentStatus(_0x1c7b6f);return _0x1c7b6f;});})['then'](function(_0x5086f5){var _0x4fdbde=sortAgentsByStatus(_0x5086f5,_0x5532c7);return _[_0x76aa('0x25')](_0x4fdbde,'id');})[_0x76aa('0x1c')](function(_0x127bc4){throw _0x127bc4;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x401c07){var _0x1c22f7={'fields':[],'order':null};var _0x2eea79=_0x401c07['split'](',');_0x1c22f7[_0x76aa('0x36')]=_[_0x76aa('0x8')](_0x2eea79,function(_0x2f7726){if(!_0x2f7726[_0x76aa('0x2d')](_0x76aa('0x35'))){return!![];}_0x1c22f7[_0x76aa('0x37')]=_[_0x76aa('0x38')](_0x2f7726,'-')?_0x76aa('0x39'):_0x76aa('0x3a');return![];});return _0x1c22f7;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x1525cb){if(!_0x1525cb){_0x1525cb=_0x76aa('0x3b');}if(_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3c'))&&!_0x1525cb[_0x76aa('0x2d')](_0x76aa('0x3d'))){var _0x572fdb=_0x1525cb['substring'](0x0,_0x1525cb[_0x76aa('0x3e')](_0x76aa('0x3c')));_0x1525cb+=','+_0x572fdb+_0x76aa('0x3d');}return _0x1525cb;}exports[_0x76aa('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x50599f,_0x174a14){var _0x403084=_0x50599f[_0x76aa('0x40')](function(_0x30cdcb,_0x1138b5){if(_0x30cdcb['globalStatus']===_0x1138b5[_0x76aa('0x35')]){if(_0x30cdcb['globalStatus']===_0x76aa('0x1e')){if(_0x174a14==='DESC'){return(_0x30cdcb['pauseType']||'')<(_0x1138b5['pauseType']||'')||_0x30cdcb[_0x76aa('0x3c')]['toLowerCase']()>_0x1138b5['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x30cdcb[_0x76aa('0x33')]||'')<(_0x1138b5[_0x76aa('0x33')]||'')||_0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()>_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb[_0x76aa('0x3c')][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')][_0x76aa('0x41')]()?0x1:-0x1;}else{return _0x30cdcb['fullname'][_0x76aa('0x41')]()<_0x1138b5[_0x76aa('0x3c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x174a14===_0x76aa('0x39')){return _0x30cdcb['globalStatus']<_0x1138b5[_0x76aa('0x35')]?0x1:-0x1;}else{return _0x30cdcb[_0x76aa('0x35')]<_0x1138b5[_0x76aa('0x35')]?-0x1:0x1;}}});return _0x403084;}exports[_0x76aa('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x2d0bc4){var _0x3e0315=[_0x76aa('0x43'),_0x76aa('0x44'),_0x76aa('0x45'),_0x76aa('0x46'),'pauseType',_0x76aa('0x46'),'internal',_0x76aa('0x47'),_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),'smsPause','whatsappPause',_0x76aa('0x49'),'voicePause',_0x76aa('0x4a'),_0x76aa('0x4b'),_0x76aa('0x4c'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x4f'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x76aa('0x50'),_0x76aa('0x51'),_0x76aa('0x52'),_0x76aa('0x53'),_0x76aa('0x11'),_0x76aa('0x14'),'mailStatus',_0x76aa('0x54'),_0x76aa('0x15'),_0x76aa('0x12'),'voiceStatus',_0x76aa('0x55'),'openchannelStatusTime',_0x76aa('0x56'),'smsStatusTime',_0x76aa('0x57'),_0x76aa('0x58'),_0x76aa('0x59'),_0x76aa('0x5a'),_0x76aa('0x5b'),_0x76aa('0x5c'),_0x76aa('0x5d'),'phoneBarEnableAutomaticScreenRecording',_0x76aa('0x5e')];var _0x5eeaa5=[_0x76aa('0x32'),_0x76aa('0x48'),_0x76aa('0x4'),_0x76aa('0x5'),_0x76aa('0x7'),_0x76aa('0x49'),_0x76aa('0x6'),'online'];var _0x333a3a=_(_0x2d0bc4)[_0x76aa('0x5f')](_0x5eeaa5)[_0x76aa('0x60')](_0x3e0315)[_0x76aa('0x2b')]();return _0x333a3a;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x76aa('0x31'),_0x76aa('0x3c'),_0x76aa('0x61'),_0x76aa('0x3d'),_0x76aa('0x44'),_0x76aa('0x35'),'userpic',_0x76aa('0x45'),_0x76aa('0x33'),_0x76aa('0x46'),_0x76aa('0x49'),_0x76aa('0x32'),_0x76aa('0x4'),_0x76aa('0x48'),'smsPause','voicePause',_0x76aa('0x7'),_0x76aa('0x11'),'faxStatus',_0x76aa('0x13'),_0x76aa('0x14'),'smsStatus',_0x76aa('0xf'),_0x76aa('0x15'),_0x76aa('0x55'),_0x76aa('0x58'),_0x76aa('0x56'),_0x76aa('0x62'),_0x76aa('0x63'),_0x76aa('0x59'),_0x76aa('0x57'),'chatCapacity',_0x76aa('0x4f'),'mailCapacity',_0x76aa('0x4b'),_0x76aa('0x4d'),_0x76aa('0x4e'),_0x76aa('0x64'),_0x76aa('0x53'),_0x76aa('0x50'),_0x76aa('0x65'),_0x76aa('0x51'),_0x76aa('0x52'),'phoneBarEnableScreenRecordingByAgent',_0x76aa('0x66'),_0x76aa('0x5b'),_0x76aa('0x67'),_0x76aa('0x5a'),_0x76aa('0x5e'),_0x76aa('0x5c')];}exports[_0x76aa('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 649de6d..cf305dc 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x549e=['then','error','result','catch','getRealtimeQueues','inbound','outbound','map','get','paused','available','waiting','originated','find','merge','pick','initializeQueues','lodash','jayson/promise','http','client','busy','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','pTalking','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','voice','startCase','Queues'];(function(_0x31b2a5,_0x2480b4){var _0x198fa4=function(_0x1414b9){while(--_0x1414b9){_0x31b2a5['push'](_0x31b2a5['shift']());}};_0x198fa4(++_0x2480b4);}(_0x549e,0x6f));var _0xe549=function(_0x2e4c76,_0x97eef2){_0x2e4c76=_0x2e4c76-0x0;var _0x3bd437=_0x549e[_0x2e4c76];return _0x3bd437;};'use strict';var _=require(_0xe549('0x0'));var jayson=require(_0xe549('0x1'));var util=require('util');var amiClient=jayson['client'][_0xe549('0x2')]({'port':0x232a});var routingClient=jayson[_0xe549('0x3')][_0xe549('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn','paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xe549('0x4'),'inUse',_0xe549('0x5'),_0xe549('0x6'),_0xe549('0x7'),_0xe549('0x8'),'ringing',_0xe549('0x9'),_0xe549('0xa'),_0xe549('0xb'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xe549('0xc'),'originated','message',_0xe549('0xd'),_0xe549('0xe'),_0xe549('0xf'),'Trunk',_0xe549('0x10'),_0xe549('0x11'),_0xe549('0x12'),_0xe549('0x13'),_0xe549('0x14'),_0xe549('0x15'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xe549('0x16'),_0xe549('0x17'),'predictiveIntervalTotalCalls',_0xe549('0x18'),_0xe549('0x19'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0xe549('0x1a')];function getRealtimeQueues(_0x5c9f83,_0x5c4987){var _0x1e0a80=_0x5c4987===_0xe549('0x1b')?amiClient:routingClient;return _0x1e0a80['request'](_[_0xe549('0x1c')](_0x5c4987)+_0xe549('0x1d'),_0x5c9f83)[_0xe549('0x1e')](function(_0x49237a){if(_0x49237a[_0xe549('0x1f')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5c4987));return _0x49237a[_0xe549('0x20')];})[_0xe549('0x21')](function(_0x11b89d){throw _0x11b89d;});}exports[_0xe549('0x22')]=getRealtimeQueues;function initializeQueues(_0x114def,_0xbca277,_0x474d31,_0x25a3e6){var _0x123cc5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x474d31==='voice'){if(_0x25a3e6===_0xe549('0x23')){_0x123cc5=_0x123cc5['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x25a3e6===_0xe549('0x24')){_0x123cc5=_0x123cc5['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x114def[_0xe549('0x25')](function(_0x46f60a){var _0x28e772=_0x46f60a[_0xe549('0x26')]({'plain':!![]});_0x28e772[_0xe549('0x27')]=0x0;_0x28e772['loggedInDb']=0x0;_0x28e772['loggedIn']=0x0;_0x28e772[_0xe549('0x28')]=0x0;_0x28e772[_0xe549('0x29')]=0x0;if(_0x474d31===_0xe549('0x1b')){_0x28e772['talking']=0x0;_0x28e772['busy']=0x0;if(_0x25a3e6===_0xe549('0x24')){_0x28e772['pTalking']=0x0;_0x28e772[_0xe549('0x2a')]=0x0;}}var _0xd43805=_[_0xe549('0x2b')](_0xbca277,['id',_0x28e772['id']]);if(_0xd43805){_[_0xe549('0x2c')](_0x28e772,_[_0xe549('0x2d')](_0xd43805,_0x123cc5));}return _0x28e772;});}exports[_0xe549('0x2e')]=initializeQueues; \ No newline at end of file +var _0xf7a5=['client','http','loggedIn','paused','busy','invalid','loggedInDb','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','request','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','voice','inbound','concat','outbound','get','available','waiting','find','merge','pick','initializeQueues','lodash','jayson/promise','util'];(function(_0x296930,_0x53ac42){var _0x2f4207=function(_0x389fd6){while(--_0x389fd6){_0x296930['push'](_0x296930['shift']());}};_0x2f4207(++_0x53ac42);}(_0xf7a5,0x1e7));var _0x5f7a=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0xf7a5[_0x3588ba];return _0x3695a2;};'use strict';var _=require(_0x5f7a('0x0'));var jayson=require(_0x5f7a('0x1'));var util=require(_0x5f7a('0x2'));var amiClient=jayson[_0x5f7a('0x3')][_0x5f7a('0x4')]({'port':0x232a});var routingClient=jayson[_0x5f7a('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x5f7a('0x5'),_0x5f7a('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x5f7a('0x7'),'inUse',_0x5f7a('0x8'),_0x5f7a('0x9'),'notInUse',_0x5f7a('0xa'),_0x5f7a('0xb'),'ringInUse',_0x5f7a('0xc'),_0x5f7a('0xd'),_0x5f7a('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x5f7a('0xf'),_0x5f7a('0x10'),_0x5f7a('0x11'),'statusMessage','dialActive',_0x5f7a('0x12'),_0x5f7a('0x13'),_0x5f7a('0x14'),_0x5f7a('0x15'),_0x5f7a('0x16'),_0x5f7a('0x17'),_0x5f7a('0x18'),_0x5f7a('0x19'),_0x5f7a('0x1a'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x5f7a('0x1b'),'predictiveIntervalTotalCalls',_0x5f7a('0x1c'),_0x5f7a('0x1d'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x5f7a('0x1e')];function getRealtimeQueues(_0x96a0ad,_0x4f24fd){var _0x112205=_0x4f24fd==='voice'?amiClient:routingClient;return _0x112205[_0x5f7a('0x1f')](_[_0x5f7a('0x20')](_0x4f24fd)+_0x5f7a('0x21'),_0x96a0ad)[_0x5f7a('0x22')](function(_0xeb65a0){if(_0xeb65a0['error'])throw new Error(util['format'](_0x5f7a('0x23'),_0x4f24fd));return _0xeb65a0[_0x5f7a('0x24')];})['catch'](function(_0x5b84ee){throw _0x5b84ee;});}exports[_0x5f7a('0x25')]=getRealtimeQueues;function initializeQueues(_0x5a06a4,_0x3f6c43,_0x1535b4,_0x569cec){var _0x409c51=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1535b4===_0x5f7a('0x26')){if(_0x569cec===_0x5f7a('0x27')){_0x409c51=_0x409c51[_0x5f7a('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x569cec===_0x5f7a('0x29')){_0x409c51=_0x409c51['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5a06a4['map'](function(_0x40bfca){var _0x1a76fe=_0x40bfca[_0x5f7a('0x2a')]({'plain':!![]});_0x1a76fe[_0x5f7a('0x6')]=0x0;_0x1a76fe['loggedInDb']=0x0;_0x1a76fe['loggedIn']=0x0;_0x1a76fe[_0x5f7a('0x2b')]=0x0;_0x1a76fe[_0x5f7a('0x2c')]=0x0;if(_0x1535b4==='voice'){_0x1a76fe[_0x5f7a('0xc')]=0x0;_0x1a76fe['busy']=0x0;if(_0x569cec===_0x5f7a('0x29')){_0x1a76fe[_0x5f7a('0xf')]=0x0;_0x1a76fe[_0x5f7a('0x10')]=0x0;}}var _0x280d1d=_[_0x5f7a('0x2d')](_0x3f6c43,['id',_0x1a76fe['id']]);if(_0x280d1d){_[_0x5f7a('0x2e')](_0x1a76fe,_[_0x5f7a('0x2f')](_0x280d1d,_0x409c51));}return _0x1a76fe;});}exports[_0x5f7a('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index aeb173c..4d7dba5 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +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(_0x451999,_0x1b3908){var _0x1b696e=function(_0x259ab1){while(--_0x259ab1){_0x451999['push'](_0x451999['shift']());}};_0x1b696e(++_0x1b3908);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 ed9bd0a..cd64882 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 _0xbf9a=['head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','map','model','join','createHash','md5','digest','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','hex','substring','crypto','bimedia-machine-uuid','execSync','../environment','keys','length','family','IPv4'];(function(_0x17b7e2,_0x13b4e9){var _0x3cdaa4=function(_0x97066e){while(--_0x97066e){_0x17b7e2['push'](_0x17b7e2['shift']());}};_0x3cdaa4(++_0x13b4e9);}(_0xbf9a,0x1d4));var _0xabf9=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0xbf9a[_0x1d2bbb];return _0x38082b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xabf9('0x0'));var machine=require(_0xabf9('0x1'));var exec=require('child_process')[_0xabf9('0x2')];var config=require(_0xabf9('0x3'));function getInterfaces(){var _0x2ffa68=[];var _0x1c3433=os['networkInterfaces']();var _0x4d06e0=_['orderBy'](_[_0xabf9('0x4')](_0x1c3433));for(var _0x18bbb5=0x0;_0x18bbb5<_0x4d06e0[_0xabf9('0x5')];_0x18bbb5++){var _0x1931a1=_0x1c3433[_0x4d06e0[_0x18bbb5]]['filter'](function(_0x5686c9){return _0x5686c9[_0xabf9('0x6')]===_0xabf9('0x7')&&_0x5686c9['internal']===![];});_0x2ffa68=_0x2ffa68['concat'](_0x1931a1);}return _0x2ffa68;}function getFirstInterface(){var _0x1a3a1f=_[_0xabf9('0x8')](getInterfaces());return{'macAddress':_0x1a3a1f&&_0x1a3a1f[_0xabf9('0x9')]?_0x1a3a1f[_0xabf9('0x9')]:_0xabf9('0xa'),'ipAddress':_0x1a3a1f&&_0x1a3a1f[_0xabf9('0xb')]?_0x1a3a1f[_0xabf9('0xb')]:_0xabf9('0xc')};}exports[_0xabf9('0xd')]=getFirstInterface;function getCPUhash(){var _0x21a498=_[_0xabf9('0xe')](os['cpus']()[_0xabf9('0xf')](function(_0x29c484){return _0x29c484[_0xabf9('0x10')];}))[_0xabf9('0x11')](':');return crypto[_0xabf9('0x12')](_0xabf9('0x13'))['update'](_0x21a498)[_0xabf9('0x14')]('hex');}exports['getUuid']=function(){var _0x5089b3=os[_0xabf9('0x15')]();var _0x1eb4e2=/[0-9a-f-]{36}/;if(config[_0xabf9('0x16')]&&_0x1eb4e2[_0xabf9('0x17')](config[_0xabf9('0x16')])){return config[_0xabf9('0x16')];}else if(_0x5089b3===_0xabf9('0x18')){return exec(_0xabf9('0x19'),{'encoding':_0xabf9('0x1a')})[_0xabf9('0x1b')]('\x0d\x0a','');}else{var _0x3e24e7=getFirstInterface();var _0x499ce1=getCPUhash();var _0x4d2009=_0x499ce1+'|'+os[_0xabf9('0x1c')]()+'|'+_0x3e24e7[_0xabf9('0x1d')]+'|'+_0x3e24e7[_0xabf9('0x1e')];var _0x5962a6=crypto[_0xabf9('0x12')](_0xabf9('0x13'))[_0xabf9('0x1f')](_0x4d2009)['digest'](_0xabf9('0x20'));return _0x5962a6[_0xabf9('0x21')](0x0,0x8)+'-'+_0x5962a6[_0xabf9('0x21')](0x8,0xc)+'-'+_0x5962a6[_0xabf9('0x21')](0xc,0x10)+'-'+_0x5962a6[_0xabf9('0x21')](0x10,0x14)+'-'+_0x5962a6[_0xabf9('0x21')](0x14);}}; \ No newline at end of file +var _0x865c=['win32','utf8','replace','hostname','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy','keys','filter','family','IPv4','concat','head','address','127.0.0.1','cpus','map','model','createHash','md5','update','hex','getUuid','platform','test','licenseToken'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x865c,0x1a7));var _0xc865=function(_0x32ea84,_0x241095){_0x32ea84=_0x32ea84-0x0;var _0xf8f2ac=_0x865c[_0x32ea84];return _0xf8f2ac;};'use strict';var _=require(_0xc865('0x0'));var os=require('os');var crypto=require(_0xc865('0x1'));var machine=require(_0xc865('0x2'));var exec=require(_0xc865('0x3'))['execSync'];var config=require(_0xc865('0x4'));function getInterfaces(){var _0x575326=[];var _0x3d440c=os['networkInterfaces']();var _0x4233cc=_[_0xc865('0x5')](_[_0xc865('0x6')](_0x3d440c));for(var _0x7e7300=0x0;_0x7e7300<_0x4233cc['length'];_0x7e7300++){var _0x2b03bb=_0x3d440c[_0x4233cc[_0x7e7300]][_0xc865('0x7')](function(_0x20a895){return _0x20a895[_0xc865('0x8')]===_0xc865('0x9')&&_0x20a895['internal']===![];});_0x575326=_0x575326[_0xc865('0xa')](_0x2b03bb);}return _0x575326;}function getFirstInterface(){var _0x339109=_[_0xc865('0xb')](getInterfaces());return{'macAddress':_0x339109&&_0x339109['mac']?_0x339109['mac']:'00:00:00:00:00:00','ipAddress':_0x339109&&_0x339109[_0xc865('0xc')]?_0x339109[_0xc865('0xc')]:_0xc865('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4648e0=_[_0xc865('0x5')](os[_0xc865('0xe')]()[_0xc865('0xf')](function(_0x55774b){return _0x55774b[_0xc865('0x10')];}))['join'](':');return crypto[_0xc865('0x11')](_0xc865('0x12'))[_0xc865('0x13')](_0x4648e0)['digest'](_0xc865('0x14'));}exports[_0xc865('0x15')]=function(){var _0x5c516f=os[_0xc865('0x16')]();var _0x5dd3d9=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5dd3d9[_0xc865('0x17')](config[_0xc865('0x18')])){return config['licenseToken'];}else if(_0x5c516f===_0xc865('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xc865('0x1a')})[_0xc865('0x1b')]('\x0d\x0a','');}else{var _0x137484=getFirstInterface();var _0x1611b9=getCPUhash();var _0x2c299c=_0x1611b9+'|'+os[_0xc865('0x1c')]()+'|'+_0x137484['macAddress']+'|'+_0x137484[_0xc865('0x1d')];var _0x2c1427=crypto[_0xc865('0x11')](_0xc865('0x12'))[_0xc865('0x13')](_0x2c299c)[_0xc865('0x1e')](_0xc865('0x14'));return _0x2c1427[_0xc865('0x1f')](0x0,0x8)+'-'+_0x2c1427[_0xc865('0x1f')](0x8,0xc)+'-'+_0x2c1427[_0xc865('0x1f')](0xc,0x10)+'-'+_0x2c1427['substring'](0x10,0x14)+'-'+_0x2c1427[_0xc865('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 20c8976..2b28e4c 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 _0x887e=['data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','YYYY-MM-DD\x20HH:mm','format','diff','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','catch','message','default','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','then','get','data2'];(function(_0x214b8a,_0x4684e2){var _0x29729c=function(_0x21b69c){while(--_0x21b69c){_0x214b8a['push'](_0x214b8a['shift']());}};_0x29729c(++_0x4684e2);}(_0x887e,0xc4));var _0xe887=function(_0x347ec9,_0x584605){_0x347ec9=_0x347ec9-0x0;var _0x3edae0=_0x887e[_0x347ec9];return _0x3edae0;};'use strict';var util=require('util');var moment=require(_0xe887('0x0'));var rp=require(_0xe887('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xe887('0x2'))(module,_0xe887('0x3'));var db=require(_0xe887('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xe887('0x5'));var logger=require(_0xe887('0x6'))(_0xe887('0x7'));var HOST=_0xe887('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3b3d9e){return new BPromise(function(_0x5adccc,_0x3fb5f4){var _0x19edc4=util['format'](_0xe887('0x9'),HOST,_0x3b3d9e,module[_0xe887('0xa')]['version']);if(oldToken){_0x19edc4=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3b3d9e,module[_0xe887('0xa')][_0xe887('0x3')],oldToken);}var _0x4d5fd7={'uri':_0x19edc4,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4d5fd7)[_0xe887('0xb')](function(_0xecad85){_0x5adccc(_0xecad85);})['catch'](function(_0x39102a){_0x3fb5f4(_0x39102a);});});}function manageLicense(_0x18c04c,_0x4f1017){var _0x44f8f2=_0x4f1017[_0xe887('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x44f8f2['data1']!==_0x18c04c&&!_0x44f8f2[_0xe887('0xd')]){oldToken=_0x44f8f2[_0xe887('0xe')];}httpRequest(_0x18c04c)[_0xe887('0xb')](function(_0x1618f7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1618f7[_0xe887('0xf')]){isOldTokenSent=![];if(!_0x44f8f2[_0xe887('0x7')]&&_0x44f8f2[_0xe887('0x7')]!=_0x1618f7[_0xe887('0x7')]||_0x44f8f2['license']&&_0x44f8f2[_0xe887('0xd')]){logger['info'](_0xe887('0x10'));}if(_0x44f8f2[_0xe887('0x7')]&&!_0x44f8f2[_0xe887('0xd')]&&_0x44f8f2[_0xe887('0x7')]!=_0x1618f7[_0xe887('0x7')]){logger[_0xe887('0x11')](_0xe887('0x12'));}if(_0x44f8f2['license']&&!_0x44f8f2[_0xe887('0xd')]&&_0x44f8f2[_0xe887('0x7')]==_0x1618f7[_0xe887('0x7')]){return _0x4f1017;}return _0x4f1017[_0xe887('0x13')]({'data1':_0x18c04c,'data2':null,'license':_0x1618f7[_0xe887('0x7')]});}else{if(_0x1618f7[_0xe887('0x7')]||_0x44f8f2['license']){if(!_0x44f8f2[_0xe887('0xd')]){if(_0x44f8f2[_0xe887('0xe')]==_0x18c04c){GRAY_PERIOD_REASON='Disabled';logger[_0xe887('0x11')](_0xe887('0x14'));}else{GRAY_PERIOD_REASON=_0xe887('0x15');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x44f8f2[_0xe887('0xe')],_0x18c04c);}logger[_0xe887('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xe887('0x16')));return _0x4f1017[_0xe887('0x13')]({'data2':encryptor['encryptString'](moment()[_0xe887('0x17')](_0xe887('0x16')))});}else{if(moment()[_0xe887('0x18')](encryptor['decryptString'](_0x44f8f2['data2']),'days')>DAYS){logger[_0xe887('0x11')](_0xe887('0x19'),moment()[_0xe887('0x17')](_0xe887('0x16')));isOldTokenSent=![];return _0x4f1017['update']({'data1':_0x18c04c,'data2':null,'license':null});}}}else{if(_0x44f8f2[_0xe887('0xe')]!=_0x18c04c){logger[_0xe887('0x11')](_0xe887('0x1a'),_0x44f8f2['data1'],_0x18c04c);return _0x4f1017[_0xe887('0x13')]({'data1':_0x18c04c,'data2':null,'license':null});}}}return _0x4f1017;})[_0xe887('0xb')](function(_0x203641){_0x4f1017=_0x203641;})['catch'](function(_0x3a0d21){logger[_0xe887('0x1b')](_0x3a0d21['message']);})[_0xe887('0x1c')](function(){setTimeout(function(){manageLicense(hardware[_0xe887('0x1d')](),_0x4f1017);},TIME);});}function defaultLicense(){var _0xb656b8=hardware['getUuid']();if(_0xb656b8){return db[_0xe887('0x1e')][_0xe887('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0xb656b8}})['spread'](function(_0x161cb6,_0x41d757){logger[_0xe887('0x11')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xb656b8);manageLicense(_0xb656b8,_0x161cb6);})[_0xe887('0x20')](function(_0x13ac37){logger[_0xe887('0x1b')](_0x13ac37[_0xe887('0x21')]);});}}exports[_0xe887('0x22')]=defaultLicense; \ No newline at end of file +var _0xfb9b=['%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','error','message','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','catch','get','data2','data1','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0xfb9b,0xa1));var _0xbfb9=function(_0x510167,_0xa7a9e1){_0x510167=_0x510167-0x0;var _0x28e092=_0xfb9b[_0x510167];return _0x28e092;};'use strict';var util=require(_0xbfb9('0x0'));var moment=require('moment');var rp=require(_0xbfb9('0x1'));var BPromise=require(_0xbfb9('0x2'));var pkginfo=require(_0xbfb9('0x3'))(module,_0xbfb9('0x4'));var db=require(_0xbfb9('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xbfb9('0x6'))('license');var HOST=_0xbfb9('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x36ca44){return new BPromise(function(_0x45e4eb,_0x2ca2bf){var _0x57dd19=util[_0xbfb9('0x8')](_0xbfb9('0x9'),HOST,_0x36ca44,module[_0xbfb9('0xa')]['version']);if(oldToken){_0x57dd19=util[_0xbfb9('0x8')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x36ca44,module['exports'][_0xbfb9('0x4')],oldToken);}var _0x5964a7={'uri':_0x57dd19,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x5964a7)['then'](function(_0xd41844){_0x45e4eb(_0xd41844);})[_0xbfb9('0xb')](function(_0x18b8c8){_0x2ca2bf(_0x18b8c8);});});}function manageLicense(_0xd6cef8,_0x170668){var _0x475314=_0x170668[_0xbfb9('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x475314['data1']!==_0xd6cef8&&!_0x475314[_0xbfb9('0xd')]){oldToken=_0x475314[_0xbfb9('0xe')];}httpRequest(_0xd6cef8)[_0xbfb9('0xf')](function(_0x1d5f9a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1d5f9a[_0xbfb9('0x10')]){isOldTokenSent=![];if(!_0x475314['license']&&_0x475314[_0xbfb9('0x11')]!=_0x1d5f9a[_0xbfb9('0x11')]||_0x475314['license']&&_0x475314[_0xbfb9('0xd')]){logger[_0xbfb9('0x12')](_0xbfb9('0x13'));}if(_0x475314['license']&&!_0x475314[_0xbfb9('0xd')]&&_0x475314['license']!=_0x1d5f9a[_0xbfb9('0x11')]){logger[_0xbfb9('0x12')](_0xbfb9('0x14'));}if(_0x475314['license']&&!_0x475314['data2']&&_0x475314[_0xbfb9('0x11')]==_0x1d5f9a[_0xbfb9('0x11')]){return _0x170668;}return _0x170668[_0xbfb9('0x15')]({'data1':_0xd6cef8,'data2':null,'license':_0x1d5f9a[_0xbfb9('0x11')]});}else{if(_0x1d5f9a[_0xbfb9('0x11')]||_0x475314[_0xbfb9('0x11')]){if(!_0x475314[_0xbfb9('0xd')]){if(_0x475314['data1']==_0xd6cef8){GRAY_PERIOD_REASON='Disabled';logger[_0xbfb9('0x12')](_0xbfb9('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xbfb9('0x12')](_0xbfb9('0x17'),_0x475314['data1'],_0xd6cef8);}logger[_0xbfb9('0x12')](_0xbfb9('0x18'),GRAY_PERIOD_REASON[_0xbfb9('0x19')](),moment()[_0xbfb9('0x8')](_0xbfb9('0x1a')));return _0x170668['update']({'data2':encryptor[_0xbfb9('0x1b')](moment()['format'](_0xbfb9('0x1a')))});}else{if(moment()['diff'](encryptor[_0xbfb9('0x1c')](_0x475314['data2']),_0xbfb9('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xbfb9('0x8')](_0xbfb9('0x1a')));isOldTokenSent=![];return _0x170668[_0xbfb9('0x15')]({'data1':_0xd6cef8,'data2':null,'license':null});}}}else{if(_0x475314[_0xbfb9('0xe')]!=_0xd6cef8){logger[_0xbfb9('0x12')](_0xbfb9('0x17'),_0x475314[_0xbfb9('0xe')],_0xd6cef8);return _0x170668[_0xbfb9('0x15')]({'data1':_0xd6cef8,'data2':null,'license':null});}}}return _0x170668;})[_0xbfb9('0xf')](function(_0x7cfe52){_0x170668=_0x7cfe52;})[_0xbfb9('0xb')](function(_0x323958){logger[_0xbfb9('0x1e')](_0x323958[_0xbfb9('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xbfb9('0x20')](),_0x170668);},TIME);});}function defaultLicense(){var _0x1a81b9=hardware[_0xbfb9('0x20')]();if(_0x1a81b9){return db['License'][_0xbfb9('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x1a81b9}})[_0xbfb9('0x22')](function(_0x23dc3b,_0x30a34b){logger[_0xbfb9('0x12')](_0xbfb9('0x23'),_0x1a81b9);manageLicense(_0x1a81b9,_0x23dc3b);})[_0xbfb9('0xb')](function(_0x1e7b82){logger[_0xbfb9('0x1e')](_0x1e7b82[_0xbfb9('0x1f')]);});}}exports[_0xbfb9('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 7c18b15..7d26be0 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 _0xdeb5=['parse','demo','machineUuid','add','days','grayReason','changed','disabled','message','then','User','sequelize','count','admin','user','telephone','users','telephones','forEach','role','pick','exports','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s'];(function(_0x51e7f2,_0x1ac222){var _0x9f9a87=function(_0x419930){while(--_0x419930){_0x51e7f2['push'](_0x51e7f2['shift']());}};_0x9f9a87(++_0x1ac222);}(_0xdeb5,0x1b0));var _0x5deb=function(_0x169eed,_0xbb43e){_0x169eed=_0x169eed-0x0;var _0x48e6a3=_0xdeb5[_0x169eed];return _0x48e6a3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x5deb('0x0'));var BPromise=require(_0x5deb('0x1'));var hardware=require(_0x5deb('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x5deb('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5deb('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x5deb('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5deb('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5deb('0x6'),'machineUuid':hardware[_0x5deb('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3cabed){return new BPromise(function(_0x2bfe2b,_0x5d2ec5){return db[_0x5deb('0x7')][_0x5deb('0x8')](_['defaults'](_0x3cabed,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x581801){return checkLicense(_0x581801,null);})['then'](function(_0x2ae29c){_0x2bfe2b(_0x2ae29c);return;})[_0x5deb('0x9')](function(_0x3b32d8){_0x5d2ec5(_0x3b32d8);});});}function checkLicense(_0x23afe2,_0x3a3d0a){if(!_0x23afe2){demoLicense[_0x5deb('0xa')]=_0x23afe2[_0x5deb('0xb')];return demoLicense;}try{var _0x24c08a=_0x3a3d0a||_0x23afe2[_0x5deb('0xc')];if(_['isEmpty'](_0x24c08a)){throw new Error(_0x5deb('0xd'));}var _0x4fa283=_0x23afe2[_0x5deb('0xb')];var _0x1f558f=_0x23afe2[_0x5deb('0xe')];var _0x251030=_0x4fa283[_0x5deb('0xf')]('-')[0x4];var _0x17c20c=_0x4fa283[_0x5deb('0xf')]('-')[0x0];var _0x18581f=encryptor[_0x5deb('0x10')](_0x24c08a,util[_0x5deb('0x11')](_0x5deb('0x12'),_0x251030,_0x4fa283,_0x17c20c));var _0x48a1cf=JSON[_0x5deb('0x13')](_0x18581f);_0x48a1cf[_0x5deb('0x14')]=![];_0x48a1cf['uuid']=_0x4fa283;_0x48a1cf[_0x5deb('0x15')]=hardware[_0x5deb('0x5')]();if(_0x1f558f){var _0x5dc037=encryptor['decryptString'](_0x1f558f);_0x48a1cf['gray']=_0x5dc037;_0x48a1cf['deadline']=moment(_0x5dc037)[_0x5deb('0x16')](0x7,_0x5deb('0x17'))[_0x5deb('0x11')]();_0x48a1cf[_0x5deb('0x18')]=_0x48a1cf[_0x5deb('0xa')]!=_0x48a1cf[_0x5deb('0x15')]?_0x5deb('0x19'):_0x5deb('0x1a');}return _0x48a1cf;}catch(_0x225785){breakingLicense[_0x5deb('0xa')]=_0x23afe2['data1'];breakingLicense['message']=_0x225785[_0x5deb('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4722e1,_0x4d7d85){getLicense()[_0x5deb('0x1c')](function(_0x36d30d){return db[_0x5deb('0x1d')]['findAll']({'attributes':['role',[db[_0x5deb('0x1e')]['fn']('COUNT',db[_0x5deb('0x1e')]['col']('role')),_0x5deb('0x1f')]],'group':'role','where':{'role':{'$or':[_0x5deb('0x20'),_0x5deb('0x21'),_0x5deb('0x22')]}},'raw':!![]})[_0x5deb('0x1c')](function(_0x56618a){var _0x2fa634={'user':_0x36d30d[_0x5deb('0x23')]||0x0,'telephone':_0x36d30d[_0x5deb('0x24')]||0x0};_0x56618a[_0x5deb('0x25')](function(_0x5e1cc8){var _0xcea2a=_0x5e1cc8['role']===_0x5deb('0x20')?_0x5deb('0x21'):_0x5e1cc8[_0x5deb('0x26')];_0x2fa634[_0xcea2a]-=_0x5e1cc8[_0x5deb('0x1f')];if(_0x2fa634[_0xcea2a]<0x0)_0x2fa634[_0xcea2a]=0x0;});_0x4722e1(_0x2fa634);return;});})[_0x5deb('0x9')](function(_0x1d1973){_0x4d7d85(_0x1d1973);});});}function checkUserLimits(_0x11d0f9){return new BPromise(function(_0x349672,_0x24dee6){getLimits()[_0x5deb('0x1c')](function(_0x5c311a){var _0x178321=_[_0x5deb('0x27')](_['countBy'](_0x11d0f9,'role'),[_0x5deb('0x20'),_0x5deb('0x21'),_0x5deb('0x22')]);var _0x37d340=(_0x178321[_0x5deb('0x20')]||0x0)+(_0x178321[_0x5deb('0x21')]||0x0);var _0xdd7041=_0x178321[_0x5deb('0x22')]||0x0;if(_0x37d340>_0x5c311a[_0x5deb('0x21')])return _0x24dee6('License\x20limit\x20reached\x20for\x20users');if(_0xdd7041>_0x5c311a[_0x5deb('0x22')])return _0x24dee6('License\x20limit\x20reached\x20for\x20telephones');return _0x349672();})[_0x5deb('0x9')](function(_0x519e27){_0x24dee6(_0x519e27);});});}module[_0x5deb('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xec56=['../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','uuid','gray','deadline','days','grayReason','machineUuid','changed','disabled','message','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','telephones','forEach','count','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor'];(function(_0x5de7be,_0x51575a){var _0x21b73e=function(_0x2d12a1){while(--_0x2d12a1){_0x5de7be['push'](_0x5de7be['shift']());}};_0x21b73e(++_0x51575a);}(_0xec56,0x1a2));var _0x6ec5=function(_0xb3837b,_0x2ca68b){_0xb3837b=_0xb3837b-0x0;var _0x4067c6=_0xec56[_0xb3837b];return _0x4067c6;};'use strict';var util=require(_0x6ec5('0x0'));var _=require(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var hardware=require('./hardware');var encryptor=require(_0x6ec5('0x4'));var db=require(_0x6ec5('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6ec5('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6ec5('0x7'),'machineUuid':hardware[_0x6ec5('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6ec5('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6ec5('0x9'),'machineUuid':hardware[_0x6ec5('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x27f0d3){return new BPromise(function(_0x320e75,_0x57dc6f){return db[_0x6ec5('0xa')][_0x6ec5('0xb')](_[_0x6ec5('0xc')](_0x27f0d3,{'raw':!![],'where':{'id':0x1}}))[_0x6ec5('0xd')](function(_0x4bb017){return checkLicense(_0x4bb017,null);})[_0x6ec5('0xd')](function(_0x5bf6d4){_0x320e75(_0x5bf6d4);return;})[_0x6ec5('0xe')](function(_0x569207){_0x57dc6f(_0x569207);});});}function checkLicense(_0x7926,_0x5c562f){if(!_0x7926){demoLicense['uuid']=_0x7926[_0x6ec5('0xf')];return demoLicense;}try{var _0x3f57f6=_0x5c562f||_0x7926[_0x6ec5('0x10')];if(_['isEmpty'](_0x3f57f6)){throw new Error(_0x6ec5('0x11'));}var _0x221fb9=_0x7926[_0x6ec5('0xf')];var _0x5546fb=_0x7926[_0x6ec5('0x12')];var _0x5a3cea=_0x221fb9[_0x6ec5('0x13')]('-')[0x4];var _0x8c00d8=_0x221fb9[_0x6ec5('0x13')]('-')[0x0];var _0x488e56=encryptor[_0x6ec5('0x14')](_0x3f57f6,util[_0x6ec5('0x15')](_0x6ec5('0x16'),_0x5a3cea,_0x221fb9,_0x8c00d8));var _0xf0aecf=JSON[_0x6ec5('0x17')](_0x488e56);_0xf0aecf['demo']=![];_0xf0aecf[_0x6ec5('0x18')]=_0x221fb9;_0xf0aecf['machineUuid']=hardware[_0x6ec5('0x8')]();if(_0x5546fb){var _0x233af1=encryptor[_0x6ec5('0x14')](_0x5546fb);_0xf0aecf[_0x6ec5('0x19')]=_0x233af1;_0xf0aecf[_0x6ec5('0x1a')]=moment(_0x233af1)['add'](0x7,_0x6ec5('0x1b'))[_0x6ec5('0x15')]();_0xf0aecf[_0x6ec5('0x1c')]=_0xf0aecf[_0x6ec5('0x18')]!=_0xf0aecf[_0x6ec5('0x1d')]?_0x6ec5('0x1e'):_0x6ec5('0x1f');}return _0xf0aecf;}catch(_0x574864){breakingLicense[_0x6ec5('0x18')]=_0x7926[_0x6ec5('0xf')];breakingLicense[_0x6ec5('0x20')]=_0x574864[_0x6ec5('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4af1b5,_0x35569b){getLicense()[_0x6ec5('0xd')](function(_0x355320){return db['User'][_0x6ec5('0x21')]({'attributes':[_0x6ec5('0x22'),[db[_0x6ec5('0x23')]['fn'](_0x6ec5('0x24'),db[_0x6ec5('0x23')][_0x6ec5('0x25')](_0x6ec5('0x22'))),'count']],'group':_0x6ec5('0x22'),'where':{'role':{'$or':[_0x6ec5('0x26'),_0x6ec5('0x27'),_0x6ec5('0x28')]}},'raw':!![]})['then'](function(_0x6f8f59){var _0x1a98d0={'user':_0x355320[_0x6ec5('0x29')]||0x0,'telephone':_0x355320[_0x6ec5('0x2a')]||0x0};_0x6f8f59[_0x6ec5('0x2b')](function(_0x12b068){var _0x408c91=_0x12b068['role']===_0x6ec5('0x26')?'user':_0x12b068[_0x6ec5('0x22')];_0x1a98d0[_0x408c91]-=_0x12b068[_0x6ec5('0x2c')];if(_0x1a98d0[_0x408c91]<0x0)_0x1a98d0[_0x408c91]=0x0;});_0x4af1b5(_0x1a98d0);return;});})[_0x6ec5('0xe')](function(_0x578fd0){_0x35569b(_0x578fd0);});});}function checkUserLimits(_0x110c73){return new BPromise(function(_0x843f29,_0x52bdab){getLimits()['then'](function(_0x39d23d){var _0x134f73=_['pick'](_['countBy'](_0x110c73,_0x6ec5('0x22')),[_0x6ec5('0x26'),'user',_0x6ec5('0x28')]);var _0x95066=(_0x134f73['admin']||0x0)+(_0x134f73[_0x6ec5('0x27')]||0x0);var _0x5d26b9=_0x134f73['telephone']||0x0;if(_0x95066>_0x39d23d[_0x6ec5('0x27')])return _0x52bdab('License\x20limit\x20reached\x20for\x20users');if(_0x5d26b9>_0x39d23d['telephone'])return _0x52bdab(_0x6ec5('0x2d'));return _0x843f29();})[_0x6ec5('0xe')](function(_0x5d5dd7){_0x52bdab(_0x5d5dd7);});});}module[_0x6ec5('0x2e')]={'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 094d786..1d3694a 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 _0x14a0=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x38b280,_0x5b0b7b){var _0x2d5d6d=function(_0x757bda){while(--_0x757bda){_0x38b280['push'](_0x38b280['shift']());}};_0x2d5d6d(++_0x5b0b7b);}(_0x14a0,0x8e));var _0x014a=function(_0xb9e28,_0x1b080f){_0xb9e28=_0xb9e28-0x0;var _0x603ab5=_0x14a0[_0xb9e28];return _0x603ab5;};'use strict';module['exports']={'DOMAIN':_0x014a('0x0'),'SESSION_SECRET':_0x014a('0x1'),'GOOGLE_ID':_0x014a('0x2'),'GOOGLE_SECRET':_0x014a('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x2032=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0xefa368,_0x658080){var _0x30a3fa=function(_0x5145df){while(--_0x5145df){_0xefa368['push'](_0xefa368['shift']());}};_0x30a3fa(++_0x658080);}(_0x2032,0xd9));var _0x2203=function(_0x4f5bd7,_0x19b51b){_0x4f5bd7=_0x4f5bd7-0x0;var _0x32f6e1=_0x2032[_0x4f5bd7];return _0x32f6e1;};'use strict';module['exports']={'DOMAIN':_0x2203('0x0'),'SESSION_SECRET':_0x2203('0x1'),'GOOGLE_ID':_0x2203('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f0bab47..fc4580d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce9b=['fileLogger','../utils/loggers'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xce9b,0xc9));var _0xbce9=function(_0x273aa0,_0x5c419b){_0x273aa0=_0x273aa0-0x0;var _0x55e060=_0xce9b[_0x273aa0];return _0x55e060;};'use strict';var fileLogger=require(_0xbce9('0x0'))[_0xbce9('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x2498=['../utils/loggers','fileLogger'];(function(_0x3a3c9a,_0x2af1b8){var _0x11dd3a=function(_0x53f8b0){while(--_0x53f8b0){_0x3a3c9a['push'](_0x3a3c9a['shift']());}};_0x11dd3a(++_0x2af1b8);}(_0x2498,0x1e4));var _0x8249=function(_0x20e6db,_0x11da49){_0x20e6db=_0x20e6db-0x0;var _0x5f3fcd=_0x2498[_0x20e6db];return _0x5f3fcd;};'use strict';var fileLogger=require(_0x8249('0x0'))[_0x8249('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f9a25b7..1e43d21 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 _0x4c8b=['../../services/routing/index.js','../../services/xdr/index.js','exports','../../config/environment','resolve','join','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing'];(function(_0x3ccac1,_0x5cc7ea){var _0x10b20b=function(_0x4ed4f5){while(--_0x4ed4f5){_0x3ccac1['push'](_0x3ccac1['shift']());}};_0x10b20b(++_0x5cc7ea);}(_0x4c8b,0x123));var _0xb4c8=function(_0x324d26,_0x5754c4){_0x324d26=_0x324d26-0x0;var _0x574caa=_0x4c8b[_0x324d26];return _0x574caa;};'use strict';var path=require('path');var cfg=require(_0xb4c8('0x0'));var env={'NODE_PATH':path[_0xb4c8('0x1')](path[_0xb4c8('0x2')](cfg['root'],_0xb4c8('0x3')))};var pm2config={'apps':[{'name':_0xb4c8('0x4'),'script':path['join'](__dirname,_0xb4c8('0x5')),'env':env},{'name':_0xb4c8('0x6'),'script':path['join'](__dirname,_0xb4c8('0x7')),'env':env},{'name':_0xb4c8('0x8'),'script':path[_0xb4c8('0x2')](__dirname,_0xb4c8('0x9')),'env':env},{'name':_0xb4c8('0xa'),'script':path['join'](__dirname,_0xb4c8('0xb')),'env':env},{'name':_0xb4c8('0xc'),'script':path[_0xb4c8('0x2')](__dirname,_0xb4c8('0xd')),'env':env},{'name':'xdr','script':path[_0xb4c8('0x2')](__dirname,_0xb4c8('0xe')),'env':env}]};module[_0xb4c8('0xf')]=pm2config; \ No newline at end of file +var _0x4745=['join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','../../config/environment','resolve'];(function(_0x37635e,_0x21b6f5){var _0x3c0965=function(_0xe9864c){while(--_0xe9864c){_0x37635e['push'](_0x37635e['shift']());}};_0x3c0965(++_0x21b6f5);}(_0x4745,0xf9));var _0x5474=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x4745[_0x134c2e];return _0x2825db;};'use strict';var path=require(_0x5474('0x0'));var cfg=require(_0x5474('0x1'));var env={'NODE_PATH':path[_0x5474('0x2')](path[_0x5474('0x3')](cfg[_0x5474('0x4')],_0x5474('0x5')))};var pm2config={'apps':[{'name':_0x5474('0x6'),'script':path['join'](__dirname,_0x5474('0x7')),'env':env},{'name':_0x5474('0x8'),'script':path[_0x5474('0x3')](__dirname,_0x5474('0x9')),'env':env},{'name':_0x5474('0xa'),'script':path[_0x5474('0x3')](__dirname,_0x5474('0xb')),'env':env},{'name':_0x5474('0xc'),'script':path['join'](__dirname,_0x5474('0xd')),'env':env},{'name':_0x5474('0xe'),'script':path[_0x5474('0x3')](__dirname,_0x5474('0xf')),'env':env},{'name':_0x5474('0x10'),'script':path[_0x5474('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x5474('0x11')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ab1866f..966ae49 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 _0x430d=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','list','describe','delete'];(function(_0xcf5894,_0x1e6b8e){var _0x390f4a=function(_0x1f7d6c){while(--_0x1f7d6c){_0xcf5894['push'](_0xcf5894['shift']());}};_0x390f4a(++_0x1e6b8e);}(_0x430d,0x120));var _0xd430=function(_0x38abea,_0x1a5231){_0x38abea=_0x38abea-0x0;var _0x52cb12=_0x430d[_0x38abea];return _0x52cb12;};'use strict';var pm2=require(_0xd430('0x0'));var BPromise=require(_0xd430('0x1'));var config=require(_0xd430('0x2'));function connect(){return new BPromise(function(_0x4d3a5e,_0x5a5211){return pm2[_0xd430('0x3')](function(_0x567148){if(_0x567148){return _0x5a5211(_0x567148);}return _0x4d3a5e(_0xd430('0x4'));});});};exports[_0xd430('0x5')]=function(_0xf18b96){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0x510d90,_0x8b241c){return pm2[_0xd430('0x5')](_0xf18b96,function(_0x17e2ab,_0x330b5d){if(_0x17e2ab){return _0x8b241c(_0x17e2ab);}pm2['disconnect']();return _0x510d90(_0x330b5d);});});});};exports['stop']=function(_0x269bbd){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0xa70aa6,_0x29e9bf){return pm2['stop'](_0x269bbd,function(_0x3b3ba6,_0x380a9a){if(_0x3b3ba6){return _0x29e9bf(_0x3b3ba6);}pm2[_0xd430('0x7')]();return _0xa70aa6(_0x380a9a);});});});};exports['restart']=function(_0x232b7f){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0x403f3d,_0x20b413){return pm2['restart'](_0x232b7f,function(_0x465065,_0xb86442){if(_0x465065){return _0x20b413(_0x465065);}pm2[_0xd430('0x7')]();return _0x403f3d(_0xb86442);});});});};exports[_0xd430('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x541412,_0x47f249){return pm2[_0xd430('0x8')](function(_0x3f7b9f,_0xc3a91b){if(_0x3f7b9f){return _0x47f249(_0x3f7b9f);}pm2[_0xd430('0x7')]();return _0x541412(_0xc3a91b);});});});};exports['describe']=function(_0x7b9308){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0x2b9fde,_0x2755e5){return pm2[_0xd430('0x9')](_0x7b9308,function(_0x369fe1,_0x2d2f4e){if(_0x369fe1){return _0x2755e5(_0x369fe1);}pm2[_0xd430('0x7')]();return _0x2b9fde(_0x2d2f4e);});});});};exports[_0xd430('0xa')]=function(_0x58b8b5){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0x24ccbb,_0x9fe09){return pm2[_0xd430('0xa')](_0x58b8b5,function(_0x44d351,_0x462a4a){if(_0x44d351){return _0x9fe09(_0x44d351);}pm2[_0xd430('0x7')]();return _0x24ccbb(_0x462a4a);});});});};exports[_0xd430('0xb')]=function(){return connect()[_0xd430('0x6')](function(){return new BPromise(function(_0x100ab2,_0x338bfc){return pm2['dump'](function(_0x57bac6){if(_0x57bac6){return _0x338bfc(_0x57bac6);}return _0x100ab2(_0xd430('0xc'));});});});}; \ No newline at end of file +var _0xb7c1=['bluebird','connect','connected','then','disconnect','stop','restart','list','delete','dump','saved','pm2'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xb7c1,0x137));var _0x1b7c=function(_0x18381c,_0x2741b2){_0x18381c=_0x18381c-0x0;var _0x1e309c=_0xb7c1[_0x18381c];return _0x1e309c;};'use strict';var pm2=require(_0x1b7c('0x0'));var BPromise=require(_0x1b7c('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x31ba96,_0x547d78){return pm2[_0x1b7c('0x2')](function(_0x2bb9ff){if(_0x2bb9ff){return _0x547d78(_0x2bb9ff);}return _0x31ba96(_0x1b7c('0x3'));});});};exports['start']=function(_0x4ac155){return connect()[_0x1b7c('0x4')](function(){return new BPromise(function(_0x1d955b,_0x32b97f){return pm2['start'](_0x4ac155,function(_0x58d80d,_0x56f0b1){if(_0x58d80d){return _0x32b97f(_0x58d80d);}pm2[_0x1b7c('0x5')]();return _0x1d955b(_0x56f0b1);});});});};exports[_0x1b7c('0x6')]=function(_0xa4e2b6){return connect()['then'](function(){return new BPromise(function(_0x361c39,_0x3fa101){return pm2['stop'](_0xa4e2b6,function(_0x3f9886,_0x4fe8b2){if(_0x3f9886){return _0x3fa101(_0x3f9886);}pm2[_0x1b7c('0x5')]();return _0x361c39(_0x4fe8b2);});});});};exports['restart']=function(_0x4279f3){return connect()[_0x1b7c('0x4')](function(){return new BPromise(function(_0x1e9e1a,_0x5a281b){return pm2[_0x1b7c('0x7')](_0x4279f3,function(_0x5231b6,_0x313f5c){if(_0x5231b6){return _0x5a281b(_0x5231b6);}pm2[_0x1b7c('0x5')]();return _0x1e9e1a(_0x313f5c);});});});};exports[_0x1b7c('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x141174,_0x2df30a){return pm2['list'](function(_0x1b4c4e,_0x14719f){if(_0x1b4c4e){return _0x2df30a(_0x1b4c4e);}pm2[_0x1b7c('0x5')]();return _0x141174(_0x14719f);});});});};exports['describe']=function(_0x4ba76f){return connect()[_0x1b7c('0x4')](function(){return new BPromise(function(_0x1c9871,_0x48bbb5){return pm2['describe'](_0x4ba76f,function(_0x52c636,_0x38bdd3){if(_0x52c636){return _0x48bbb5(_0x52c636);}pm2[_0x1b7c('0x5')]();return _0x1c9871(_0x38bdd3);});});});};exports['delete']=function(_0x315504){return connect()[_0x1b7c('0x4')](function(){return new BPromise(function(_0x23613d,_0x2fa604){return pm2[_0x1b7c('0x9')](_0x315504,function(_0x286ef2,_0x21dd8b){if(_0x286ef2){return _0x2fa604(_0x286ef2);}pm2['disconnect']();return _0x23613d(_0x21dd8b);});});});};exports['dump']=function(){return connect()[_0x1b7c('0x4')](function(){return new BPromise(function(_0x43a191,_0x74d0bc){return pm2[_0x1b7c('0xa')](function(_0x4be596){if(_0x4be596){return _0x74d0bc(_0x4be596);}return _0x43a191(_0x1b7c('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 286509d..66e3cd2 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 _0xaaab=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','redis','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','length','map','info','join','system'];(function(_0x518ccd,_0x24018d){var _0x42dcd8=function(_0x36ade2){while(--_0x36ade2){_0x518ccd['push'](_0x518ccd['shift']());}};_0x42dcd8(++_0x24018d);}(_0xaaab,0x1d8));var _0xbaaa=function(_0x4b40d3,_0x5e4341){_0x4b40d3=_0x4b40d3-0x0;var _0x467f1d=_0xaaab[_0x4b40d3];return _0x467f1d;};'use strict';var _=require(_0xbaaa('0x0'));var moment=require('moment');var Redis=require(_0xbaaa('0x1'));var util=require('util');var config=require(_0xbaaa('0x2'));var db=require(_0xbaaa('0x3'))['db'];var logger=require(_0xbaaa('0x4'))(_0xbaaa('0x5'));config['redis']=_[_0xbaaa('0x6')](config['redis'],{'host':_0xbaaa('0x7'),'port':0x18eb});var io=require(_0xbaaa('0x8'))(new Redis(config[_0xbaaa('0x9')]));function closeInteractions(){var _0x189ad1=0x0;var _0x599514=[];return db['Setting'][_0xbaaa('0xa')]({'raw':!![],'attributes':['id',_0xbaaa('0xb')],'where':{'id':0x1}})[_0xbaaa('0xc')](function(_0x25a120){_0x189ad1=_0x25a120[_0xbaaa('0xb')];if(_0x189ad1){return db[_0xbaaa('0xd')]['findAll']({'raw':!![],'attributes':['id',_0xbaaa('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbaaa('0xf')](_0x25a120[_0xbaaa('0xb')],'minutes')}}});}else{return[];}})[_0xbaaa('0xc')](function(_0x424db4){if(_0x424db4&&_0x424db4[_0xbaaa('0x10')]){_0x599514=_[_0xbaaa('0x11')](_0x424db4||[],'id');logger[_0xbaaa('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x599514[_0xbaaa('0x13')]());return db[_0xbaaa('0xd')]['update']({'closeReason':_0xbaaa('0x14'),'disposition':_0xbaaa('0x15'),'closed':!![],'closedAt':moment()[_0xbaaa('0x16')](_0xbaaa('0x17'))},{'where':{'id':_0x599514}});}})[_0xbaaa('0xc')](function(){if(_0x599514&&_0x599514[_0xbaaa('0x10')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x599514[_0xbaaa('0x13')]());for(var _0x49795e=0x0;_0x49795e<_0x599514[_0xbaaa('0x10')];_0x49795e++){io[_0xbaaa('0x18')]('chatInteraction:update',{'id':_0x599514[_0x49795e],'closed':!![]});}}})['catch'](function(_0x11c094){logger[_0xbaaa('0x19')](_0xbaaa('0x1a'),_0x11c094?util[_0xbaaa('0x1b')](_0x11c094,{'showHidden':![],'depth':null}):'');});}exports[_0xbaaa('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8d2d=['start','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x27f6ba,_0x499a12){var _0x8938d8=function(_0x16e406){while(--_0x16e406){_0x27f6ba['push'](_0x27f6ba['shift']());}};_0x8938d8(++_0x499a12);}(_0x8d2d,0x101));var _0xd8d2=function(_0x5ca9a6,_0x237afa){_0x5ca9a6=_0x5ca9a6-0x0;var _0x255010=_0x8d2d[_0x5ca9a6];return _0x255010;};'use strict';var _=require('lodash');var moment=require(_0xd8d2('0x0'));var Redis=require(_0xd8d2('0x1'));var util=require(_0xd8d2('0x2'));var config=require('../../config/environment');var db=require(_0xd8d2('0x3'))['db'];var logger=require(_0xd8d2('0x4'))(_0xd8d2('0x5'));config[_0xd8d2('0x6')]=_[_0xd8d2('0x7')](config['redis'],{'host':_0xd8d2('0x8'),'port':0x18eb});var io=require(_0xd8d2('0x9'))(new Redis(config[_0xd8d2('0x6')]));function closeInteractions(){var _0x327b62=0x0;var _0x4120b7=[];return db[_0xd8d2('0xa')]['find']({'raw':!![],'attributes':['id',_0xd8d2('0xb')],'where':{'id':0x1}})[_0xd8d2('0xc')](function(_0x1beb7a){_0x327b62=_0x1beb7a[_0xd8d2('0xb')];if(_0x327b62){return db[_0xd8d2('0xd')][_0xd8d2('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd8d2('0xf')](_0x1beb7a['chatTimeout'],_0xd8d2('0x10'))}}});}else{return[];}})['then'](function(_0x55b54a){if(_0x55b54a&&_0x55b54a['length']){_0x4120b7=_[_0xd8d2('0x11')](_0x55b54a||[],'id');logger[_0xd8d2('0x12')](_0xd8d2('0x13'),_0x4120b7[_0xd8d2('0x14')]());return db[_0xd8d2('0xd')][_0xd8d2('0x15')]({'closeReason':_0xd8d2('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xd8d2('0x17')](_0xd8d2('0x18'))},{'where':{'id':_0x4120b7}});}})[_0xd8d2('0xc')](function(){if(_0x4120b7&&_0x4120b7[_0xd8d2('0x19')]){logger['info'](_0xd8d2('0x1a'),_0x4120b7[_0xd8d2('0x14')]());for(var _0x30fbf4=0x0;_0x30fbf4<_0x4120b7[_0xd8d2('0x19')];_0x30fbf4++){io[_0xd8d2('0x1b')](_0xd8d2('0x1c'),{'id':_0x4120b7[_0x30fbf4],'closed':!![]});}}})[_0xd8d2('0x1d')](function(_0x390822){logger['error'](_0xd8d2('0x1e'),_0x390822?util['inspect'](_0x390822,{'showHidden':![],'depth':null}):'');});}exports[_0xd8d2('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 070089a..6ddc2a4 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 _0x2eed=['startAllRefreshIntervals'];(function(_0x16130f,_0x45fa00){var _0x4a19c9=function(_0x2fa249){while(--_0x2fa249){_0x16130f['push'](_0x16130f['shift']());}};_0x4a19c9(++_0x45fa00);}(_0x2eed,0x19d));var _0xd2ee=function(_0x3d8280,_0x319532){_0x3d8280=_0x3d8280-0x0;var _0x4fd17a=_0x2eed[_0x3d8280];return _0x4fd17a;};'use strict';function start(){var _0x35bc91=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x35bc91[_0xd2ee('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x7f19=['startAllRefreshIntervals','exports'];(function(_0x514da6,_0x3b61d9){var _0x3a47e7=function(_0x14f081){while(--_0x14f081){_0x514da6['push'](_0x514da6['shift']());}};_0x3a47e7(++_0x3b61d9);}(_0x7f19,0xd8));var _0x97f1=function(_0x142d30,_0x42d948){_0x142d30=_0x142d30-0x0;var _0x2c5f72=_0x7f19[_0x142d30];return _0x2c5f72;};'use strict';function start(){var _0x5630af=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x5630af[_0x97f1('0x0')]();}module[_0x97f1('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ed7a23f..49b3b17 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 _0xf911=['savename','extname','join','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','stop\x20cron','update','update\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','subtractNumber','../../files/reports','%s.%s','basename'];(function(_0x4de69f,_0x141d60){var _0x48b696=function(_0x2ea5f2){while(--_0x2ea5f2){_0x4de69f['push'](_0x4de69f['shift']());}};_0x48b696(++_0x141d60);}(_0xf911,0xe2));var _0x1f91=function(_0x45f9a7,_0x3b5769){_0x45f9a7=_0x45f9a7-0x0;var _0x855b19=_0xf911[_0x45f9a7];return _0x855b19;};'use strict';var fs=require('fs');var util=require(_0x1f91('0x0'));var path=require(_0x1f91('0x1'));var _=require(_0x1f91('0x2'));var moment=require(_0x1f91('0x3'));var CronJobManager=require(_0x1f91('0x4'));var jayson=require(_0x1f91('0x5'));var BPromise=require(_0x1f91('0x6'));var logger=require(_0x1f91('0x7'))('schedule');var db=require(_0x1f91('0x8'))['db'];var analyticCustomReportController=require(_0x1f91('0x9'));var analyticDefaultReportController=require(_0x1f91('0xa'));var client=jayson[_0x1f91('0xb')][_0x1f91('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x387903,_0xabf612){return function(){logger['info'](_0x1f91('0xd'),_0x387903[_0x1f91('0xe')]);var _0x3f6ba2=!![];var _0x3f5d66=_0x387903[_0x1f91('0xf')][_0x1f91('0x10')]();var _0xaa59d2={'account':_0x3f5d66,'message':{'from':util[_0x1f91('0x11')](_0x1f91('0x12'),_0x387903['MailAccount'][_0x1f91('0x13')],_0x387903[_0x1f91('0xf')][_0x1f91('0xe')]||_0x387903[_0x1f91('0xf')][_0x1f91('0x14')]['user']),'to':_0x387903[_0x1f91('0xe')],'cc':_0x387903['cc'],'bcc':_0x387903[_0x1f91('0x15')],'subject':util[_0x1f91('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0xabf612['name'],_0x387903[_0x1f91('0x16')],_0x387903['subtractUnit'])}};var _0x4a93f1=path['join'](__dirname,_0x1f91('0x17'));var _0x3ef5d5=_0xabf612['savename'];var _0x39b34e=util['format'](_0x1f91('0x18'),path[_0x1f91('0x19')](_0xabf612[_0x1f91('0x1a')],path[_0x1f91('0x1b')](_0xabf612[_0x1f91('0x1a')])),'zip');var _0x5b3516=path[_0x1f91('0x1c')](_0x4a93f1,_0x3ef5d5);var _0xae9757=path[_0x1f91('0x1c')](_0x4a93f1,_0x39b34e);if(fs[_0x1f91('0x1d')](_0x5b3516)){_0xabf612[_0x1f91('0x1e')]=_0x1f91('0x1f');_0xaa59d2[_0x1f91('0x20')][_0x1f91('0x21')]=[{'filename':_0x3ef5d5,'path':_0x5b3516}];_0xaa59d2[_0x1f91('0x20')][_0x1f91('0x22')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1f91('0x23')](_0xabf612,null,0x2));}else if(fs[_0x1f91('0x1d')](_0xae9757)){_0xabf612['status']=_0x1f91('0x1f');_0xaa59d2[_0x1f91('0x20')][_0x1f91('0x21')]=[{'filename':_0x39b34e,'path':_0xae9757}];}else{_0xaa59d2['message'][_0x1f91('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x387903[_0x1f91('0x24')]){_0x3f6ba2=![];logger[_0x1f91('0x25')](_0x1f91('0x26'));}}if(_0x3f6ba2){return client[_0x1f91('0x27')](_0x1f91('0x28'),_0xaa59d2)[_0x1f91('0x29')](function(_0x2b3074){if(_0x2b3074[_0x1f91('0x2a')]){return logger[_0x1f91('0x2a')]('error\x20mail',JSON['stringify'](_0x2b3074));}return logger[_0x1f91('0x25')](_0x1f91('0x2b'));})[_0x1f91('0x2c')](function(_0x3b80c1){return logger[_0x1f91('0x2a')]('error\x20mail',JSON[_0x1f91('0x23')](_0x3b80c1));});}};}function handleError(){return function(_0xfc0b1b){return logger[_0x1f91('0x2a')](JSON['stringify'](_0xfc0b1b));};}function handleResult(_0x3207b3){return function(_0x4d983b){logger[_0x1f91('0x25')]('data',JSON['stringify'](_0x4d983b));if(_0x3207b3[_0x1f91('0xf')]&&_0x3207b3[_0x1f91('0xf')][_0x1f91('0x14')]&&!_[_0x1f91('0x2d')](_0x3207b3[_0x1f91('0xe')])){setTimeout(handleSendEmail(_0x3207b3,_0x4d983b),0x3c*0x3e8);}};}function handleJob(_0x281d2b){return function(){try{if(_[_0x1f91('0x2d')](_0x281d2b[_0x1f91('0x16')])){return logger[_0x1f91('0x25')](_0x1f91('0x2e'));}if(_['isNil'](_0x281d2b[_0x1f91('0x2f')])){return logger[_0x1f91('0x25')](_0x1f91('0x30'));}var _0x5e72e9={'startDate':moment()[_0x1f91('0x31')](_0x281d2b[_0x1f91('0x16')],_0x281d2b['subtractUnit'])['format'](_0x1f91('0x32')),'endDate':moment()[_0x1f91('0x11')](_0x1f91('0x32')),'type':_0x1f91('0x33'),'output':_0x281d2b[_0x1f91('0x34')],'name':_0x281d2b[_0x1f91('0x13')]};if(!_[_0x1f91('0x2d')](_0x281d2b['DefaultReportId'])){logger[_0x1f91('0x25')](_0x1f91('0x35'),_0x281d2b[_0x1f91('0x36')]);return analyticDefaultReportController[_0x1f91('0x37')]({'id':_0x281d2b[_0x1f91('0x36')]},_0x5e72e9)[_0x1f91('0x29')](handleResult(_0x281d2b))[_0x1f91('0x2c')](handleError());}if(!_[_0x1f91('0x2d')](_0x281d2b[_0x1f91('0x38')])){logger[_0x1f91('0x25')]('exec\x20custom\x20report\x20id:%s',_0x281d2b[_0x1f91('0x38')]);return analyticCustomReportController['runReport']({'id':_0x281d2b[_0x1f91('0x38')]},_0x5e72e9)['then'](handleResult(_0x281d2b))[_0x1f91('0x2c')](handleError());}}catch(_0x74eb09){logger[_0x1f91('0x2a')](JSON[_0x1f91('0x23')](_0x74eb09));}return logger[_0x1f91('0x25')](_0x1f91('0x39'));};}function getJobs(_0x4ff9cc){var _0x39e7b1={};if(_0x4ff9cc){_0x39e7b1['id']=_0x4ff9cc;}return db[_0x1f91('0x3a')][_0x1f91('0x3b')]({'where':_0x39e7b1,'include':[{'model':db[_0x1f91('0xf')],'attributes':['id',_0x1f91('0x13'),_0x1f91('0xe')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x1f91('0x3c')],'as':_0x1f91('0x3c')}]}]}]})[_0x1f91('0x29')](function(_0x330bd4){var _0x11e171=_[_0x1f91('0x3d')](manager[_0x1f91('0x3e')]);var _0x9cb654=_[_0x1f91('0x3f')](_0x330bd4,function(_0x28c0c9){return _0x28c0c9['id']['toString']();});var _0x1cdd3f=_['keyBy'](_0x330bd4,function(_0x2d7990){return _0x2d7990['id'][_0x1f91('0x40')]();});var _0x1852e2=_0x4ff9cc?_0x9cb654:_[_0x1f91('0x41')](_0x9cb654,_0x11e171);var _0x3de569=_[_0x1f91('0x42')](_0x9cb654,_0x11e171);var _0x466435=_[_0x1f91('0x41')](_0x11e171,_0x9cb654);var _0x24f8e6;var _0x365c9e;for(_0x24f8e6=0x0;_0x24f8e6<_0x466435[_0x1f91('0x43')]&&!_0x4ff9cc;_0x24f8e6+=0x1){_0x365c9e=_0x466435[_0x24f8e6][_0x1f91('0x40')]();if(manager[_0x1f91('0x44')](_0x365c9e)){manager[_0x1f91('0x45')](_0x365c9e);manager[_0x1f91('0x46')](_0x365c9e);logger['info']('delete\x20cron',_0x365c9e);}}logger[_0x1f91('0x25')](_0x1f91('0x47'),JSON['stringify'](_0x1852e2));for(_0x24f8e6=0x0;_0x24f8e6<_0x1852e2[_0x1f91('0x43')];_0x24f8e6+=0x1){_0x365c9e=_0x1852e2[_0x24f8e6][_0x1f91('0x40')]();logger[_0x1f91('0x25')]('index',_0x365c9e);if(_0x4ff9cc){logger[_0x1f91('0x25')](_0x1f91('0x48'),_0x4ff9cc);logger['info'](JSON['stringify'](_0x1cdd3f[_0x365c9e]));BPromise[_0x1f91('0x49')]()[_0x1f91('0x29')](handleJob(_0x1cdd3f[_0x365c9e]));logger['info'](_0x1f91('0x4a'),_0x1cdd3f[_0x365c9e][_0x1f91('0x13')],_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')]);}else if(_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')]&&_0x1cdd3f[_0x365c9e][_0x1f91('0x4c')]&&moment()[_0x1f91('0x4d')](_0x1cdd3f[_0x365c9e][_0x1f91('0x4e')],_0x1cdd3f[_0x365c9e][_0x1f91('0x4f')])){manager[_0x1f91('0x50')](_0x365c9e,_0x1cdd3f[_0x365c9e]['cron'],handleJob(_0x1cdd3f[_0x365c9e]));manager['start'](_0x365c9e);logger[_0x1f91('0x25')]('add\x20cron',_0x1cdd3f[_0x365c9e][_0x1f91('0x13')],_0x1cdd3f[_0x365c9e]['cron']);}else if(manager['exists'](_0x365c9e)){manager[_0x1f91('0x45')](_0x365c9e);manager[_0x1f91('0x46')](_0x365c9e);logger[_0x1f91('0x25')](_0x1f91('0x51'),_0x1cdd3f[_0x365c9e]['name'],_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')]);}}for(_0x24f8e6=0x0,_0x365c9e;_0x24f8e6<_0x3de569[_0x1f91('0x43')]&&!_0x4ff9cc;_0x24f8e6+=0x1){_0x365c9e=_0x3de569[_0x24f8e6]['toString']();if(manager['exists'](_0x365c9e)){if(_0x1cdd3f[_0x365c9e]['cron']&&_0x1cdd3f[_0x365c9e][_0x1f91('0x4c')]&&moment()[_0x1f91('0x4d')](_0x1cdd3f[_0x365c9e][_0x1f91('0x4e')],_0x1cdd3f[_0x365c9e][_0x1f91('0x4f')])){manager[_0x1f91('0x52')](_0x365c9e,_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')],handleJob(_0x1cdd3f[_0x365c9e]));logger[_0x1f91('0x25')](_0x1f91('0x53'),_0x1cdd3f[_0x365c9e]['name'],_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')]);}else{manager[_0x1f91('0x45')](_0x365c9e);manager[_0x1f91('0x46')](_0x365c9e);logger[_0x1f91('0x25')]('stop\x20cron',_0x1cdd3f[_0x365c9e][_0x1f91('0x13')],_0x1cdd3f[_0x365c9e][_0x1f91('0x4b')]);}}}})[_0x1f91('0x2c')](function(_0x2bac17){logger['error'](JSON['stringify'](_0x2bac17));});}exports['run']=function(_0x5d89cb){return getJobs(_0x5d89cb);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa9b7=['Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','endAt','update','update\x20cron','deleteJob','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','zip','existsSync','status'];(function(_0x1c99c6,_0x28c096){var _0x172cdd=function(_0x37f7c3){while(--_0x37f7c3){_0x1c99c6['push'](_0x1c99c6['shift']());}};_0x172cdd(++_0x28c096);}(_0xa9b7,0x18a));var _0x7a9b=function(_0x2fb5a7,_0x3a9693){_0x2fb5a7=_0x2fb5a7-0x0;var _0x26336f=_0xa9b7[_0x2fb5a7];return _0x26336f;};'use strict';var fs=require('fs');var util=require(_0x7a9b('0x0'));var path=require(_0x7a9b('0x1'));var _=require(_0x7a9b('0x2'));var moment=require(_0x7a9b('0x3'));var CronJobManager=require(_0x7a9b('0x4'));var jayson=require(_0x7a9b('0x5'));var BPromise=require(_0x7a9b('0x6'));var logger=require(_0x7a9b('0x7'))(_0x7a9b('0x8'));var db=require(_0x7a9b('0x9'))['db'];var analyticCustomReportController=require(_0x7a9b('0xa'));var analyticDefaultReportController=require(_0x7a9b('0xb'));var client=jayson[_0x7a9b('0xc')][_0x7a9b('0xd')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5acf71,_0x4c2af3){return function(){logger[_0x7a9b('0xe')](_0x7a9b('0xf'),_0x5acf71[_0x7a9b('0x10')]);var _0x1a7da8=!![];var _0x1ef027=_0x5acf71[_0x7a9b('0x11')]['getSmtpOptions']();var _0xd5759b={'account':_0x1ef027,'message':{'from':util[_0x7a9b('0x12')](_0x7a9b('0x13'),_0x5acf71[_0x7a9b('0x11')][_0x7a9b('0x14')],_0x5acf71[_0x7a9b('0x11')]['email']||_0x5acf71[_0x7a9b('0x11')]['Smtp']['user']),'to':_0x5acf71[_0x7a9b('0x10')],'cc':_0x5acf71['cc'],'bcc':_0x5acf71[_0x7a9b('0x15')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x4c2af3[_0x7a9b('0x14')],_0x5acf71[_0x7a9b('0x16')],_0x5acf71[_0x7a9b('0x17')])}};var _0x533e4c=path[_0x7a9b('0x18')](__dirname,_0x7a9b('0x19'));var _0x5f0a41=_0x4c2af3[_0x7a9b('0x1a')];var _0x4e3ceb=util[_0x7a9b('0x12')]('%s.%s',path[_0x7a9b('0x1b')](_0x4c2af3[_0x7a9b('0x1a')],path['extname'](_0x4c2af3['savename'])),_0x7a9b('0x1c'));var _0x5caaef=path[_0x7a9b('0x18')](_0x533e4c,_0x5f0a41);var _0x3dd47f=path[_0x7a9b('0x18')](_0x533e4c,_0x4e3ceb);if(fs[_0x7a9b('0x1d')](_0x5caaef)){_0x4c2af3[_0x7a9b('0x1e')]=_0x7a9b('0x1f');_0xd5759b[_0x7a9b('0x20')][_0x7a9b('0x21')]=[{'filename':_0x5f0a41,'path':_0x5caaef}];_0xd5759b[_0x7a9b('0x20')]['text']=util[_0x7a9b('0x12')](_0x7a9b('0x22'),JSON['stringify'](_0x4c2af3,null,0x2));}else if(fs[_0x7a9b('0x1d')](_0x3dd47f)){_0x4c2af3[_0x7a9b('0x1e')]=_0x7a9b('0x1f');_0xd5759b['message'][_0x7a9b('0x21')]=[{'filename':_0x4e3ceb,'path':_0x3dd47f}];}else{_0xd5759b['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5acf71[_0x7a9b('0x23')]){_0x1a7da8=![];logger[_0x7a9b('0xe')](_0x7a9b('0x24'));}}if(_0x1a7da8){return client[_0x7a9b('0x25')](_0x7a9b('0x26'),_0xd5759b)[_0x7a9b('0x27')](function(_0x59225d){if(_0x59225d[_0x7a9b('0x28')]){return logger['error'](_0x7a9b('0x29'),JSON[_0x7a9b('0x2a')](_0x59225d));}return logger['info'](_0x7a9b('0x2b'));})[_0x7a9b('0x2c')](function(_0xad3d8){return logger['error'](_0x7a9b('0x29'),JSON[_0x7a9b('0x2a')](_0xad3d8));});}};}function handleError(){return function(_0x4f3fe7){return logger[_0x7a9b('0x28')](JSON[_0x7a9b('0x2a')](_0x4f3fe7));};}function handleResult(_0x548f5a){return function(_0x2dc3e2){logger[_0x7a9b('0xe')]('data',JSON[_0x7a9b('0x2a')](_0x2dc3e2));if(_0x548f5a[_0x7a9b('0x11')]&&_0x548f5a[_0x7a9b('0x11')]['Smtp']&&!_[_0x7a9b('0x2d')](_0x548f5a[_0x7a9b('0x10')])){setTimeout(handleSendEmail(_0x548f5a,_0x2dc3e2),0x3c*0x3e8);}};}function handleJob(_0x3e9b29){return function(){try{if(_[_0x7a9b('0x2d')](_0x3e9b29[_0x7a9b('0x16')])){return logger[_0x7a9b('0xe')](_0x7a9b('0x2e'));}if(_[_0x7a9b('0x2d')](_0x3e9b29[_0x7a9b('0x17')])){return logger['info'](_0x7a9b('0x2f'));}var _0x361c63={'startDate':moment()[_0x7a9b('0x30')](_0x3e9b29[_0x7a9b('0x16')],_0x3e9b29[_0x7a9b('0x17')])['format'](_0x7a9b('0x31')),'endDate':moment()[_0x7a9b('0x12')](_0x7a9b('0x31')),'type':_0x7a9b('0x32'),'output':_0x3e9b29[_0x7a9b('0x33')],'name':_0x3e9b29[_0x7a9b('0x14')]};if(!_['isNil'](_0x3e9b29[_0x7a9b('0x34')])){logger[_0x7a9b('0xe')](_0x7a9b('0x35'),_0x3e9b29[_0x7a9b('0x34')]);return analyticDefaultReportController['runReport']({'id':_0x3e9b29[_0x7a9b('0x34')]},_0x361c63)['then'](handleResult(_0x3e9b29))['catch'](handleError());}if(!_['isNil'](_0x3e9b29['CustomReportId'])){logger[_0x7a9b('0xe')]('exec\x20custom\x20report\x20id:%s',_0x3e9b29['CustomReportId']);return analyticCustomReportController[_0x7a9b('0x36')]({'id':_0x3e9b29[_0x7a9b('0x37')]},_0x361c63)[_0x7a9b('0x27')](handleResult(_0x3e9b29))['catch'](handleError());}}catch(_0x28b90c){logger[_0x7a9b('0x28')](JSON[_0x7a9b('0x2a')](_0x28b90c));}return logger[_0x7a9b('0xe')]('no\x20report\x20id');};}function getJobs(_0x4474f1){var _0x363952={};if(_0x4474f1){_0x363952['id']=_0x4474f1;}return db[_0x7a9b('0x38')][_0x7a9b('0x39')]({'where':_0x363952,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x7a9b('0x10')],'include':[{'model':db[_0x7a9b('0x3a')],'as':'Smtp','include':[{'model':db[_0x7a9b('0x3b')],'as':_0x7a9b('0x3b')}]}]}]})[_0x7a9b('0x27')](function(_0x4bb472){var _0x3bf9b7=_[_0x7a9b('0x3c')](manager[_0x7a9b('0x3d')]);var _0x2be05c=_['map'](_0x4bb472,function(_0x5585e3){return _0x5585e3['id']['toString']();});var _0x131653=_[_0x7a9b('0x3e')](_0x4bb472,function(_0x358696){return _0x358696['id'][_0x7a9b('0x3f')]();});var _0x3616f2=_0x4474f1?_0x2be05c:_[_0x7a9b('0x40')](_0x2be05c,_0x3bf9b7);var _0xef552e=_['intersection'](_0x2be05c,_0x3bf9b7);var _0x5d8a4b=_[_0x7a9b('0x40')](_0x3bf9b7,_0x2be05c);var _0x41cc1e;var _0x3ed3e8;for(_0x41cc1e=0x0;_0x41cc1e<_0x5d8a4b[_0x7a9b('0x41')]&&!_0x4474f1;_0x41cc1e+=0x1){_0x3ed3e8=_0x5d8a4b[_0x41cc1e][_0x7a9b('0x3f')]();if(manager[_0x7a9b('0x42')](_0x3ed3e8)){manager[_0x7a9b('0x43')](_0x3ed3e8);manager['deleteJob'](_0x3ed3e8);logger[_0x7a9b('0xe')](_0x7a9b('0x44'),_0x3ed3e8);}}logger['info'](_0x7a9b('0x45'),JSON[_0x7a9b('0x2a')](_0x3616f2));for(_0x41cc1e=0x0;_0x41cc1e<_0x3616f2['length'];_0x41cc1e+=0x1){_0x3ed3e8=_0x3616f2[_0x41cc1e][_0x7a9b('0x3f')]();logger[_0x7a9b('0xe')](_0x7a9b('0x46'),_0x3ed3e8);if(_0x4474f1){logger[_0x7a9b('0xe')](_0x7a9b('0x47'),_0x4474f1);logger[_0x7a9b('0xe')](JSON[_0x7a9b('0x2a')](_0x131653[_0x3ed3e8]));BPromise['resolve']()[_0x7a9b('0x27')](handleJob(_0x131653[_0x3ed3e8]));logger['info'](_0x7a9b('0x48'),_0x131653[_0x3ed3e8][_0x7a9b('0x14')],_0x131653[_0x3ed3e8][_0x7a9b('0x49')]);}else if(_0x131653[_0x3ed3e8][_0x7a9b('0x49')]&&_0x131653[_0x3ed3e8][_0x7a9b('0x4a')]&&moment()[_0x7a9b('0x4b')](_0x131653[_0x3ed3e8][_0x7a9b('0x4c')],_0x131653[_0x3ed3e8]['endAt'])){manager[_0x7a9b('0x4d')](_0x3ed3e8,_0x131653[_0x3ed3e8]['cron'],handleJob(_0x131653[_0x3ed3e8]));manager[_0x7a9b('0x4e')](_0x3ed3e8);logger[_0x7a9b('0xe')](_0x7a9b('0x4f'),_0x131653[_0x3ed3e8][_0x7a9b('0x14')],_0x131653[_0x3ed3e8][_0x7a9b('0x49')]);}else if(manager[_0x7a9b('0x42')](_0x3ed3e8)){manager[_0x7a9b('0x43')](_0x3ed3e8);manager['deleteJob'](_0x3ed3e8);logger[_0x7a9b('0xe')](_0x7a9b('0x50'),_0x131653[_0x3ed3e8][_0x7a9b('0x14')],_0x131653[_0x3ed3e8][_0x7a9b('0x49')]);}}for(_0x41cc1e=0x0,_0x3ed3e8;_0x41cc1e<_0xef552e['length']&&!_0x4474f1;_0x41cc1e+=0x1){_0x3ed3e8=_0xef552e[_0x41cc1e][_0x7a9b('0x3f')]();if(manager['exists'](_0x3ed3e8)){if(_0x131653[_0x3ed3e8][_0x7a9b('0x49')]&&_0x131653[_0x3ed3e8][_0x7a9b('0x4a')]&&moment()[_0x7a9b('0x4b')](_0x131653[_0x3ed3e8][_0x7a9b('0x4c')],_0x131653[_0x3ed3e8][_0x7a9b('0x51')])){manager[_0x7a9b('0x52')](_0x3ed3e8,_0x131653[_0x3ed3e8][_0x7a9b('0x49')],handleJob(_0x131653[_0x3ed3e8]));logger[_0x7a9b('0xe')](_0x7a9b('0x53'),_0x131653[_0x3ed3e8][_0x7a9b('0x14')],_0x131653[_0x3ed3e8]['cron']);}else{manager[_0x7a9b('0x43')](_0x3ed3e8);manager[_0x7a9b('0x54')](_0x3ed3e8);logger[_0x7a9b('0xe')](_0x7a9b('0x50'),_0x131653[_0x3ed3e8][_0x7a9b('0x14')],_0x131653[_0x3ed3e8][_0x7a9b('0x49')]);}}}})[_0x7a9b('0x2c')](function(_0x1d8c8e){logger[_0x7a9b('0x28')](JSON[_0x7a9b('0x2a')](_0x1d8c8e));});}exports['run']=function(_0x876e01){return getJobs(_0x876e01);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 7ac68fd..d563730 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 _0x6be1=['sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','findOne','Positive','COMPLETED','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','error','start','lodash','aws-sdk','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','format','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError'];(function(_0x775963,_0x3f4254){var _0x2e8b39=function(_0xec77aa){while(--_0xec77aa){_0x775963['push'](_0x775963['shift']());}};_0x2e8b39(++_0x3f4254);}(_0x6be1,0x12f));var _0x16be=function(_0x4bf786,_0x4980c1){_0x4bf786=_0x4bf786-0x0;var _0x1de1ea=_0x6be1[_0x4bf786];return _0x1de1ea;};var _=require(_0x16be('0x0'));var AWS=require(_0x16be('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x16be('0x2'))(_0x16be('0x3'));function getTranscriptionJob(_0x579ab9,_0x18fafc,_0x8e7a1,_0x5743a){return new Promise(function(_0x36e4da,_0x19754e){var _0x2f6c26=new AWS[(_0x16be('0x4'))]({'accessKeyId':_0x18fafc,'secretAccessKey':_0x579ab9,'region':_0x8e7a1});_0x2f6c26['getTranscriptionJob']({'TranscriptionJobName':_0x5743a},function(_0x36438c,_0x32ff9a){if(_0x36438c){return _0x19754e(_0x36438c);}else{return _0x36e4da(_0x32ff9a);}});});}function sentiment(_0x1c0460,_0x134253,_0x1a820e,_0x3227ca,_0xbace4f){return new Promise(function(_0x2a5ab3,_0x1a1a06){var _0x34dfe8=new AWS[(_0x16be('0x5'))]({'accessKeyId':_0x134253,'secretAccessKey':_0x1c0460,'region':_0x1a820e});_0x34dfe8[_0x16be('0x6')]({'Text':_0x3227ca,'LanguageCode':_0xbace4f[_0x16be('0x7')](0x0,0x2)},function(_0x39551d,_0xf25111){if(_0x39551d){return _0x1a1a06(_0x39551d);}else{return _0x2a5ab3(_0xf25111);}});});}function checkTranscribeJob(_0x5d38e4,_0x597c4d,_0x13aa8c){var _0xb321f1;return new BPromise(function(_0xe2330d,_0x142104){logger[_0x16be('0x8')](util['format'](_0x16be('0x9'),_0x5d38e4['id'],_0x5d38e4[_0x16be('0xa')]));return getTranscriptionJob(_0x13aa8c['data1'],_0x13aa8c[_0x16be('0xb')],_0x597c4d['transcribeRegion'],_0x5d38e4['transcribeName'])['then'](function(_0x74e610){logger[_0x16be('0x8')](util[_0x16be('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5d38e4['id'],_0x5d38e4[_0x16be('0xa')],_0x74e610['TranscriptionJob'][_0x16be('0xd')]));if(!_0x5d38e4[_0x16be('0xe')]){switch(_0x74e610[_0x16be('0xf')][_0x16be('0xd')]){case'COMPLETED':var _0x2e1055={'transcribeStatus':_0x74e610[_0x16be('0xf')]['TranscriptionJobStatus'],'fileUri':_0x74e610[_0x16be('0xf')][_0x16be('0x10')]['TranscriptFileUri']};logger[_0x16be('0x8')](util[_0x16be('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x5d38e4['id']));return rp({'uri':_0x74e610[_0x16be('0xf')][_0x16be('0x10')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x2975cc){logger[_0x16be('0x8')](util['format'](_0x16be('0x11'),_0x5d38e4['id']));if(_0x2975cc&&_0x2975cc[_0x16be('0x12')]&&_0x2975cc[_0x16be('0x12')][_0x16be('0x13')]&&_0x2975cc['results'][_0x16be('0x13')][_0x16be('0x14')]){_0x2e1055['fileText']='';for(var _0x14ba98=0x0;_0x14ba98<_0x2975cc['results']['transcripts'][_0x16be('0x14')];_0x14ba98++){_0x2e1055[_0x16be('0xe')]+=_0x2975cc['results'][_0x16be('0x13')][_0x14ba98][_0x16be('0x15')]+'';}}return _0x5d38e4[_0x16be('0x16')](_0x2e1055);})[_0x16be('0x17')](function(){logger[_0x16be('0x8')](util[_0x16be('0xc')](_0x16be('0x18'),_0x5d38e4['id']));if(!_0x5d38e4[_0x16be('0x19')]){throw new db['Sequelize'][(_0x16be('0x1a'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x597c4d[_0x16be('0x1b')]||!_0x597c4d[_0x16be('0x1c')]||!_0x597c4d[_0x16be('0x1d')]||!_0x597c4d[_0x16be('0x1e')]||!_0x597c4d[_0x16be('0x1f')]){throw new db[(_0x16be('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2e1055[_0x16be('0xe')]){throw new Error(_0x16be('0x21'));}if(_0x597c4d[_0x16be('0x1c')]===_0x13aa8c['id']){return _0x13aa8c;}else{return db[_0x16be('0x22')]['findOne']({'where':{'id':_settings[_0x16be('0x1c')]}});}})['then'](function(_0x9fa823){if(!_0x9fa823){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x23'));}if(!_0x9fa823[_0x16be('0x24')]||!_0x9fa823[_0x16be('0xb')]){throw new db['Sequelize'][(_0x16be('0x1a'))](_0x16be('0x25'));}_0xb321f1=_0x9fa823;logger[_0x16be('0x8')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5d38e4['id']));return sentiment(_0xb321f1[_0x16be('0x24')],_0xb321f1[_0x16be('0xb')],_0x597c4d[_0x16be('0x1d')],_0x2e1055[_0x16be('0xe')],_0x597c4d[_0x16be('0x1e')]);})[_0x16be('0x17')](function(_0x24d842){logger['info'](util['format'](_0x16be('0x26'),_0x5d38e4['id']));return _0x5d38e4[_0x16be('0x16')]({'sentiment':_0x24d842[_0x16be('0x27')],'sPositive':_0x24d842[_0x16be('0x28')]['Positive'],'sNegative':_0x24d842[_0x16be('0x28')][_0x16be('0x29')],'sMixed':_0x24d842[_0x16be('0x28')][_0x16be('0x2a')],'sNeutral':_0x24d842['SentimentScore'][_0x16be('0x2b')]});})['then'](function(){logger['info'](util[_0x16be('0xc')](_0x16be('0x18'),_0x5d38e4['id']));_0xe2330d();});case'FAILED':return _0x5d38e4[_0x16be('0x16')]({'transcribeStatus':_0x16be('0x2c'),'failureReason':_0x74e610[_0x16be('0xf')][_0x16be('0x2d')]})[_0x16be('0x17')](function(){logger['info'](util[_0x16be('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5d38e4['id']));_0xe2330d();});default:logger['info'](util[_0x16be('0xc')](_0x16be('0x2e'),_0x5d38e4['id']));break;}}else{return BPromise[_0x16be('0x2f')]()['then'](function(){if(!_0x5d38e4[_0x16be('0x19')]){throw new db[(_0x16be('0x20'))]['ValidationError'](_0x16be('0x30'));}if(!_0x597c4d['sentiment']||!_0x597c4d[_0x16be('0x1c')]||!_0x597c4d[_0x16be('0x1d')]||!_0x597c4d[_0x16be('0x1e')]||!_0x597c4d[_0x16be('0x1f')]){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x31'));}if(!_0x5d38e4[_0x16be('0xe')]){throw new Error(_0x16be('0x21'));}if(_0x597c4d[_0x16be('0x1c')]===_0x13aa8c['id']){return _0x13aa8c;}else{return db['CloudProvider'][_0x16be('0x32')]({'where':{'id':_settings[_0x16be('0x1c')]}});}})[_0x16be('0x17')](function(_0x5675fd){if(!_0x5675fd){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x23'));}if(!_0x5675fd['data1']||!_0x5675fd[_0x16be('0xb')]){throw new db['Sequelize'][(_0x16be('0x1a'))](_0x16be('0x25'));}_0xb321f1=_0x5675fd;logger['info'](util[_0x16be('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5d38e4['id']));return sentiment(_0xb321f1[_0x16be('0x24')],_0xb321f1['data2'],_0x597c4d[_0x16be('0x1d')],_0x5d38e4[_0x16be('0xe')],_0x597c4d[_0x16be('0x1e')]);})['then'](function(_0x2c8ef4){logger['info'](util[_0x16be('0xc')](_0x16be('0x26'),_0x5d38e4['id']));return _0x5d38e4['update']({'sentiment':_0x2c8ef4[_0x16be('0x27')],'sPositive':_0x2c8ef4[_0x16be('0x28')][_0x16be('0x33')],'sNegative':_0x2c8ef4[_0x16be('0x28')][_0x16be('0x29')],'sMixed':_0x2c8ef4[_0x16be('0x28')][_0x16be('0x2a')],'sNeutral':_0x2c8ef4['SentimentScore'][_0x16be('0x2b')],'transcribeStatus':_0x16be('0x34')});})[_0x16be('0x17')](function(){logger[_0x16be('0x8')](util[_0x16be('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5d38e4['id']));_0xe2330d();});}})[_0x16be('0x35')](function(_0x13c6a9){if(_0x13c6a9){if(!_0x13c6a9[_0x16be('0x36')]||_0x13c6a9[_0x16be('0x36')]!=='SequelizeValidationError'){logger['error'](util[_0x16be('0xc')](_0x16be('0x37'),_0x5d38e4['id']),util['inspect'](_0x13c6a9,{'showHidden':![],'depth':null}));}}_0xe2330d();});});}function checkTranscribe(){var _0x57af6a;var _0x345ec5;var _0x469229;return db[_0x16be('0x38')][_0x16be('0x39')]({'where':{'transcribeStatus':_0x16be('0x3a')}})[_0x16be('0x17')](function(_0x14f44b){if(!_0x14f44b||!_0x14f44b[_0x16be('0x14')]){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x3b'));}_0x57af6a=_0x14f44b;return db['Setting'][_0x16be('0x32')]({'where':{'id':0x1}});})[_0x16be('0x17')](function(_0x28add6){if(!_0x28add6){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x3c'));}_0x345ec5=_0x28add6;if(!_0x345ec5[_0x16be('0x3')]||!_0x345ec5[_0x16be('0x3d')]||!_0x345ec5[_0x16be('0x3e')]||!_0x345ec5[_0x16be('0x1e')]||!_0x345ec5['bucket']){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x3f'));}return db[_0x16be('0x22')]['findOne']({'where':{'id':_0x345ec5[_0x16be('0x3d')]}});})[_0x16be('0x17')](function(_0x2897b1){if(!_0x2897b1){throw new db[(_0x16be('0x20'))][(_0x16be('0x1a'))](_0x16be('0x23'));}if(!_0x2897b1['data1']||!_0x2897b1[_0x16be('0xb')]){throw new db['Sequelize'][(_0x16be('0x1a'))](_0x16be('0x25'));}_0x469229=_0x2897b1;var _0x50b7e2=[];_0x57af6a['forEach'](function(_0x4df719){_0x50b7e2['push'](checkTranscribeJob(_0x4df719,_0x345ec5,_0x469229));});return BPromise['all'](_0x50b7e2);})['catch'](function(_0x163913){if(_0x163913){if(!_0x163913['name']||_0x163913[_0x16be('0x36')]!=='SequelizeValidationError'){logger[_0x16be('0x40')](util['inspect'](_0x163913,{'showHidden':![],'depth':null}));}}});}exports[_0x16be('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xab40=['data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptionJobStatus','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','results','transcripts','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','ValidationError','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Sentiment','Positive','Mixed','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','lodash','aws-sdk','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1'];(function(_0x59a032,_0x35d3e1){var _0x2ca9fb=function(_0x6b0373){while(--_0x6b0373){_0x59a032['push'](_0x59a032['shift']());}};_0x2ca9fb(++_0x35d3e1);}(_0xab40,0xcd));var _0x0ab4=function(_0x4f7a8c,_0x190133){_0x4f7a8c=_0x4f7a8c-0x0;var _0x1b93b1=_0xab40[_0x4f7a8c];return _0x1b93b1;};var _=require(_0x0ab4('0x0'));var AWS=require(_0x0ab4('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x0ab4('0x2'))['db'];var logger=require(_0x0ab4('0x3'))(_0x0ab4('0x4'));function getTranscriptionJob(_0x2bf1ba,_0x14634a,_0x57fac1,_0x5f01aa){return new Promise(function(_0x28b17a,_0x4ba9d2){var _0x10d92b=new AWS[(_0x0ab4('0x5'))]({'accessKeyId':_0x14634a,'secretAccessKey':_0x2bf1ba,'region':_0x57fac1});_0x10d92b[_0x0ab4('0x6')]({'TranscriptionJobName':_0x5f01aa},function(_0x6d135d,_0x4cf8de){if(_0x6d135d){return _0x4ba9d2(_0x6d135d);}else{return _0x28b17a(_0x4cf8de);}});});}function sentiment(_0x55263d,_0x4b01c4,_0x24271e,_0x30e726,_0x40e4d1){return new Promise(function(_0x464f7e,_0x413d9b){var _0x24c6c1=new AWS[(_0x0ab4('0x7'))]({'accessKeyId':_0x4b01c4,'secretAccessKey':_0x55263d,'region':_0x24271e});_0x24c6c1[_0x0ab4('0x8')]({'Text':_0x30e726,'LanguageCode':_0x40e4d1['substring'](0x0,0x2)},function(_0x580dc8,_0x4602bf){if(_0x580dc8){return _0x413d9b(_0x580dc8);}else{return _0x464f7e(_0x4602bf);}});});}function checkTranscribeJob(_0x4c21b0,_0x249dc3,_0x45e6fd){var _0x1e7555;return new BPromise(function(_0x1e2b56,_0x26ce0d){logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')](_0x0ab4('0xb'),_0x4c21b0['id'],_0x4c21b0[_0x0ab4('0xc')]));return getTranscriptionJob(_0x45e6fd[_0x0ab4('0xd')],_0x45e6fd[_0x0ab4('0xe')],_0x249dc3[_0x0ab4('0xf')],_0x4c21b0[_0x0ab4('0xc')])[_0x0ab4('0x10')](function(_0x2a83a8){logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')](_0x0ab4('0x11'),_0x4c21b0['id'],_0x4c21b0['transcribeName'],_0x2a83a8['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x4c21b0[_0x0ab4('0x12')]){switch(_0x2a83a8[_0x0ab4('0x13')][_0x0ab4('0x14')]){case'COMPLETED':var _0x1e3fe2={'transcribeStatus':_0x2a83a8[_0x0ab4('0x13')][_0x0ab4('0x14')],'fileUri':_0x2a83a8[_0x0ab4('0x13')]['Transcript']['TranscriptFileUri']};logger[_0x0ab4('0x9')](util['format'](_0x0ab4('0x15'),_0x4c21b0['id']));return rp({'uri':_0x2a83a8[_0x0ab4('0x13')]['Transcript'][_0x0ab4('0x16')],'json':!![]})[_0x0ab4('0x10')](function(_0x2c55b3){logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4c21b0['id']));if(_0x2c55b3&&_0x2c55b3['results']&&_0x2c55b3[_0x0ab4('0x17')][_0x0ab4('0x18')]&&_0x2c55b3[_0x0ab4('0x17')][_0x0ab4('0x18')]['length']){_0x1e3fe2[_0x0ab4('0x12')]='';for(var _0x3caa9d=0x0;_0x3caa9d<_0x2c55b3[_0x0ab4('0x17')]['transcripts']['length'];_0x3caa9d++){_0x1e3fe2[_0x0ab4('0x12')]+=_0x2c55b3[_0x0ab4('0x17')][_0x0ab4('0x18')][_0x3caa9d]['transcript']+'';}}return _0x4c21b0['update'](_0x1e3fe2);})['then'](function(){logger[_0x0ab4('0x9')](util['format'](_0x0ab4('0x19'),_0x4c21b0['id']));if(!_0x4c21b0[_0x0ab4('0x1a')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x249dc3[_0x0ab4('0x1b')]||!_0x249dc3[_0x0ab4('0x1c')]||!_0x249dc3[_0x0ab4('0x1d')]||!_0x249dc3[_0x0ab4('0x1e')]||!_0x249dc3[_0x0ab4('0x1f')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1e3fe2[_0x0ab4('0x12')]){throw new Error(_0x0ab4('0x20'));}if(_0x249dc3[_0x0ab4('0x1c')]===_0x45e6fd['id']){return _0x45e6fd;}else{return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x285a29){if(!_0x285a29){throw new db[(_0x0ab4('0x23'))][(_0x0ab4('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x285a29['data1']||!_0x285a29[_0x0ab4('0xe')]){throw new db['Sequelize'][(_0x0ab4('0x24'))](_0x0ab4('0x25'));}_0x1e7555=_0x285a29;logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')](_0x0ab4('0x26'),_0x4c21b0['id']));return sentiment(_0x1e7555[_0x0ab4('0xd')],_0x1e7555['data2'],_0x249dc3[_0x0ab4('0x1d')],_0x1e3fe2[_0x0ab4('0x12')],_0x249dc3[_0x0ab4('0x1e')]);})[_0x0ab4('0x10')](function(_0x4cce0c){logger['info'](util[_0x0ab4('0xa')](_0x0ab4('0x27'),_0x4c21b0['id']));return _0x4c21b0[_0x0ab4('0x28')]({'sentiment':_0x4cce0c['Sentiment'],'sPositive':_0x4cce0c['SentimentScore']['Positive'],'sNegative':_0x4cce0c[_0x0ab4('0x29')][_0x0ab4('0x2a')],'sMixed':_0x4cce0c[_0x0ab4('0x29')]['Mixed'],'sNeutral':_0x4cce0c['SentimentScore']['Neutral']});})[_0x0ab4('0x10')](function(){logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')](_0x0ab4('0x19'),_0x4c21b0['id']));_0x1e2b56();});case _0x0ab4('0x2b'):return _0x4c21b0[_0x0ab4('0x28')]({'transcribeStatus':_0x0ab4('0x2b'),'failureReason':_0x2a83a8[_0x0ab4('0x13')][_0x0ab4('0x2c')]})[_0x0ab4('0x10')](function(){logger['info'](util[_0x0ab4('0xa')](_0x0ab4('0x19'),_0x4c21b0['id']));_0x1e2b56();});default:logger[_0x0ab4('0x9')](util[_0x0ab4('0xa')](_0x0ab4('0x2d'),_0x4c21b0['id']));break;}}else{return BPromise[_0x0ab4('0x2e')]()[_0x0ab4('0x10')](function(){if(!_0x4c21b0[_0x0ab4('0x1a')]){throw new db[(_0x0ab4('0x23'))][(_0x0ab4('0x24'))](_0x0ab4('0x2f'));}if(!_0x249dc3[_0x0ab4('0x1b')]||!_0x249dc3['sentimentAccountId']||!_0x249dc3[_0x0ab4('0x1d')]||!_0x249dc3[_0x0ab4('0x1e')]||!_0x249dc3[_0x0ab4('0x1f')]){throw new db[(_0x0ab4('0x23'))]['ValidationError'](_0x0ab4('0x30'));}if(!_0x4c21b0['fileText']){throw new Error(_0x0ab4('0x20'));}if(_0x249dc3[_0x0ab4('0x1c')]===_0x45e6fd['id']){return _0x45e6fd;}else{return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'id':_settings[_0x0ab4('0x1c')]}});}})[_0x0ab4('0x10')](function(_0x5815d1){if(!_0x5815d1){throw new db[(_0x0ab4('0x23'))][(_0x0ab4('0x24'))](_0x0ab4('0x31'));}if(!_0x5815d1['data1']||!_0x5815d1[_0x0ab4('0xe')]){throw new db[(_0x0ab4('0x23'))][(_0x0ab4('0x24'))](_0x0ab4('0x25'));}_0x1e7555=_0x5815d1;logger[_0x0ab4('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4c21b0['id']));return sentiment(_0x1e7555['data1'],_0x1e7555[_0x0ab4('0xe')],_0x249dc3[_0x0ab4('0x1d')],_0x4c21b0['fileText'],_0x249dc3[_0x0ab4('0x1e')]);})['then'](function(_0x2d1d87){logger['info'](util[_0x0ab4('0xa')](_0x0ab4('0x27'),_0x4c21b0['id']));return _0x4c21b0[_0x0ab4('0x28')]({'sentiment':_0x2d1d87[_0x0ab4('0x32')],'sPositive':_0x2d1d87[_0x0ab4('0x29')][_0x0ab4('0x33')],'sNegative':_0x2d1d87['SentimentScore'][_0x0ab4('0x2a')],'sMixed':_0x2d1d87[_0x0ab4('0x29')][_0x0ab4('0x34')],'sNeutral':_0x2d1d87[_0x0ab4('0x29')][_0x0ab4('0x35')],'transcribeStatus':_0x0ab4('0x36')});})['then'](function(){logger[_0x0ab4('0x9')](util['format'](_0x0ab4('0x19'),_0x4c21b0['id']));_0x1e2b56();});}})[_0x0ab4('0x37')](function(_0x117079){if(_0x117079){if(!_0x117079['name']||_0x117079[_0x0ab4('0x38')]!==_0x0ab4('0x39')){logger[_0x0ab4('0x3a')](util[_0x0ab4('0xa')](_0x0ab4('0x3b'),_0x4c21b0['id']),util[_0x0ab4('0x3c')](_0x117079,{'showHidden':![],'depth':null}));}}_0x1e2b56();});});}function checkTranscribe(){var _0x4fcab6;var _0x3f086e;var _0xdcc118;return db[_0x0ab4('0x3d')][_0x0ab4('0x3e')]({'where':{'transcribeStatus':_0x0ab4('0x3f')}})[_0x0ab4('0x10')](function(_0x24cbaa){if(!_0x24cbaa||!_0x24cbaa[_0x0ab4('0x40')]){throw new db[(_0x0ab4('0x23'))][(_0x0ab4('0x24'))](_0x0ab4('0x41'));}_0x4fcab6=_0x24cbaa;return db[_0x0ab4('0x42')][_0x0ab4('0x22')]({'where':{'id':0x1}});})['then'](function(_0x2c3a0a){if(!_0x2c3a0a){throw new db[(_0x0ab4('0x23'))]['ValidationError'](_0x0ab4('0x43'));}_0x3f086e=_0x2c3a0a;if(!_0x3f086e['transcribe']||!_0x3f086e['transcribeAccountId']||!_0x3f086e[_0x0ab4('0xf')]||!_0x3f086e[_0x0ab4('0x1e')]||!_0x3f086e[_0x0ab4('0x1f')]){throw new db['Sequelize'][(_0x0ab4('0x24'))](_0x0ab4('0x44'));}return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'id':_0x3f086e[_0x0ab4('0x45')]}});})[_0x0ab4('0x10')](function(_0x1eea3b){if(!_0x1eea3b){throw new db['Sequelize'][(_0x0ab4('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1eea3b[_0x0ab4('0xd')]||!_0x1eea3b['data2']){throw new db[(_0x0ab4('0x23'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xdcc118=_0x1eea3b;var _0x3983ca=[];_0x4fcab6[_0x0ab4('0x46')](function(_0x433346){_0x3983ca[_0x0ab4('0x47')](checkTranscribeJob(_0x433346,_0x3f086e,_0xdcc118));});return BPromise['all'](_0x3983ca);})[_0x0ab4('0x37')](function(_0x4051f2){if(_0x4051f2){if(!_0x4051f2[_0x0ab4('0x38')]||_0x4051f2[_0x0ab4('0x38')]!==_0x0ab4('0x39')){logger[_0x0ab4('0x3a')](util[_0x0ab4('0x3c')](_0x4051f2,{'showHidden':![],'depth':null}));}}});}exports[_0x0ab4('0x48')]=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 1a19159..0642233 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 _0xc881=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system'];(function(_0x572c17,_0xce15c8){var _0x18e5f7=function(_0x18773b){while(--_0x18773b){_0x572c17['push'](_0x572c17['shift']());}};_0x18e5f7(++_0xce15c8);}(_0xc881,0xd2));var _0x1c88=function(_0x472caf,_0x42c3d5){_0x472caf=_0x472caf-0x0;var _0x16cd58=_0xc881[_0x472caf];return _0x16cd58;};'use strict';var _=require(_0x1c88('0x0'));var moment=require('moment');var Redis=require(_0x1c88('0x1'));var util=require(_0x1c88('0x2'));var config=require(_0x1c88('0x3'));var db=require(_0x1c88('0x4'))['db'];var logger=require(_0x1c88('0x5'))(_0x1c88('0x6'));config[_0x1c88('0x7')]=_[_0x1c88('0x8')](config['redis'],{'host':_0x1c88('0x9'),'port':0x18eb});var io=require(_0x1c88('0xa'))(new Redis(config[_0x1c88('0x7')]));function closeInteractions(){var _0x38fca9=[];return db[_0x1c88('0xb')][_0x1c88('0xc')]({'raw':!![],'attributes':['id',_0x1c88('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1c88('0xe')](0x18,_0x1c88('0xf'))}}})[_0x1c88('0x10')](function(_0x1bb566){if(_0x1bb566&&_0x1bb566[_0x1c88('0x11')]){_0x38fca9=_['map'](_0x1bb566||[],'id');logger[_0x1c88('0x12')](_0x1c88('0x13'),_0x38fca9['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x1c88('0x14'),'disposition':_0x1c88('0x15'),'closed':!![],'closedAt':moment()[_0x1c88('0x16')](_0x1c88('0x17'))},{'where':{'id':_0x38fca9}});}})[_0x1c88('0x10')](function(){if(_0x38fca9&&_0x38fca9[_0x1c88('0x11')]){logger[_0x1c88('0x12')](_0x1c88('0x18'),_0x38fca9[_0x1c88('0x19')]());for(var _0x341749=0x0;_0x341749<_0x38fca9[_0x1c88('0x11')];_0x341749++){io[_0x1c88('0x1a')](_0x1c88('0x1b'),{'id':_0x38fca9[_0x341749],'closed':!![]});}}})[_0x1c88('0x1c')](function(_0x331b88){logger[_0x1c88('0x1d')](_0x1c88('0x1e'),_0x331b88?util[_0x1c88('0x1f')](_0x331b88,{'showHidden':![],'depth':null}):'');});}exports[_0x1c88('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xacff=['error','inspect','start','moment','ioredis','util','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x37cd56,_0x49d747){var _0x497e08=function(_0x2deb2d){while(--_0x2deb2d){_0x37cd56['push'](_0x37cd56['shift']());}};_0x497e08(++_0x49d747);}(_0xacff,0x116));var _0xfacf=function(_0x3aaafb,_0x5cffa1){_0x3aaafb=_0x3aaafb-0x0;var _0x3cf23a=_0xacff[_0x3aaafb];return _0x3cf23a;};'use strict';var _=require('lodash');var moment=require(_0xfacf('0x0'));var Redis=require(_0xfacf('0x1'));var util=require(_0xfacf('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xfacf('0x3'))('schedule');config[_0xfacf('0x4')]=_[_0xfacf('0x5')](config[_0xfacf('0x4')],{'host':_0xfacf('0x6'),'port':0x18eb});var io=require(_0xfacf('0x7'))(new Redis(config[_0xfacf('0x4')]));function closeInteractions(){var _0x5c19c7=[];return db[_0xfacf('0x8')]['findAll']({'raw':!![],'attributes':['id',_0xfacf('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xfacf('0xa'))}}})[_0xfacf('0xb')](function(_0x396797){if(_0x396797&&_0x396797[_0xfacf('0xc')]){_0x5c19c7=_[_0xfacf('0xd')](_0x396797||[],'id');logger[_0xfacf('0xe')](_0xfacf('0xf'),_0x5c19c7[_0xfacf('0x10')]());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0xfacf('0x11'),'closed':!![],'closedAt':moment()[_0xfacf('0x12')](_0xfacf('0x13'))},{'where':{'id':_0x5c19c7}});}})[_0xfacf('0xb')](function(){if(_0x5c19c7&&_0x5c19c7['length']){logger[_0xfacf('0xe')](_0xfacf('0x14'),_0x5c19c7[_0xfacf('0x10')]());for(var _0x18ec52=0x0;_0x18ec52<_0x5c19c7[_0xfacf('0xc')];_0x18ec52++){io[_0xfacf('0x15')]('whatsappInteraction:update',{'id':_0x5c19c7[_0x18ec52],'closed':!![]});}}})['catch'](function(_0x354899){logger[_0xfacf('0x16')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x354899?util[_0xfacf('0x17')](_0x354899,{'showHidden':![],'depth':null}):'');});}exports[_0xfacf('0x18')]=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 3d3a2ee..a4b3de4 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0166=['catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','CmContact','hopper2'];(function(_0x206172,_0x511281){var _0x32bb5c=function(_0xc7e208){while(--_0xc7e208){_0x206172['push'](_0x206172['shift']());}};_0x32bb5c(++_0x511281);}(_0x0166,0x131));var _0x6016=function(_0x1943a6,_0xe611bb){_0x1943a6=_0x1943a6-0x0;var _0x472eca=_0x0166[_0x1943a6];return _0x472eca;};'use strict';var util=require(_0x6016('0x0'));var db=require(_0x6016('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6016('0x2')]({'id':i,'firstName':_0x6016('0x3')+i,'lastName':_0x6016('0x4')+i,'phone':0xf879fb460+i,'email':_0x6016('0x5')+i+_0x6016('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6016('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6016('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6016('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6016('0x2')]({'id':i,'firstName':_0x6016('0x3')+i,'lastName':_0x6016('0x4')+i,'phone':0xf879fb460+i,'email':_0x6016('0x5')+i+_0x6016('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6016('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6016('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6016('0x7')](),'updatedAt':Date[_0x6016('0x7')]()});}db['CmContact'][_0x6016('0x8')]({'where':{}})[_0x6016('0x9')](function(){return db['CmContact'][_0x6016('0xa')](contacts);})[_0x6016('0x9')](function(){console[_0x6016('0xb')]('finished\x20populating',_0x6016('0xc'));return db['CmHopper'][_0x6016('0x8')]({'where':{}});})[_0x6016('0x9')](function(){return db[_0x6016('0xd')]['bulkCreate'](hopper);})[_0x6016('0x9')](function(){console['log'](_0x6016('0xe'),_0x6016('0xf'));return db[_0x6016('0x10')][_0x6016('0xa')](contacts2);})[_0x6016('0x9')](function(){console['log']('finished\x20populating','contacts2');return db[_0x6016('0xd')][_0x6016('0xa')](hopper2);})[_0x6016('0x9')](function(){console[_0x6016('0xb')]('finished\x20populating',_0x6016('0x11'));})[_0x6016('0x12')](function(_0x1de697){console['log'](_0x1de697);}); \ No newline at end of file +var _0x09db=['push','now','@xcally.com','CmContact','destroy','then','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','log','contacts2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x09db,0x19d));var _0xb09d=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x09db[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0xb09d('0x0'));var db=require(_0xb09d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb09d('0x2')+i,'lastName':_0xb09d('0x3')+i,'phone':0xf879fb460+i,'email':_0xb09d('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb09d('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb09d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb09d('0x6')](),'updatedAt':Date[_0xb09d('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb09d('0x2')+i,'lastName':_0xb09d('0x3')+i,'phone':0xf879fb460+i,'email':_0xb09d('0x4')+i+_0xb09d('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb09d('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb09d('0x6')](),'updatedAt':Date[_0xb09d('0x6')]()});}db[_0xb09d('0x8')][_0xb09d('0x9')]({'where':{}})[_0xb09d('0xa')](function(){return db[_0xb09d('0x8')]['bulkCreate'](contacts);})[_0xb09d('0xa')](function(){console['log'](_0xb09d('0xb'),_0xb09d('0xc'));return db[_0xb09d('0xd')][_0xb09d('0x9')]({'where':{}});})[_0xb09d('0xa')](function(){return db[_0xb09d('0xd')][_0xb09d('0xe')](hopper);})[_0xb09d('0xa')](function(){console['log'](_0xb09d('0xb'),_0xb09d('0xf'));return db[_0xb09d('0x8')][_0xb09d('0xe')](contacts2);})[_0xb09d('0xa')](function(){console[_0xb09d('0x10')](_0xb09d('0xb'),_0xb09d('0x11'));return db['CmHopper'][_0xb09d('0xe')](hopper2);})['then'](function(){console[_0xb09d('0x10')](_0xb09d('0xb'),'hopper2');})[_0xb09d('0x12')](function(_0x165018){console[_0xb09d('0x10')](_0x165018);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9b7ab18..da14f2e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dd0=['catch','log','../mysqldb','%s%s','agent','format','%s%s@xcally.com','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user'];(function(_0x261a02,_0x2306eb){var _0x202f34=function(_0xb18b63){while(--_0xb18b63){_0x261a02['push'](_0x261a02['shift']());}};_0x202f34(++_0x2306eb);}(_0x6dd0,0x17c));var _0x06dd=function(_0x35e01d,_0x381809){_0x35e01d=_0x35e01d-0x0;var _0x596f76=_0x6dd0[_0x35e01d];return _0x596f76;};'use strict';var util=require('util');var db=require(_0x06dd('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x06dd('0x1'),_0x06dd('0x2'),i),'fullname':util[_0x06dd('0x3')](_0x06dd('0x1'),_0x06dd('0x2'),i),'email':util[_0x06dd('0x3')](_0x06dd('0x4'),_0x06dd('0x2'),i),'role':_0x06dd('0x2'),'password':'password','internal':0xfa0+i,'type':_0x06dd('0x5'),'transport':[_0x06dd('0x6'),'ws',_0x06dd('0x7')],'disallow':[_0x06dd('0x8')],'allow':[_0x06dd('0x9')],'defaultuser':util[_0x06dd('0x3')]('%s%s',_0x06dd('0x2'),i),'encryption':'yes','avpf':_0x06dd('0xa'),'force_avp':_0x06dd('0xa'),'icesupport':'yes','dtlsenable':_0x06dd('0xa'),'dtlsverify':'no','dtlscertfile':_0x06dd('0xb'),'dtlsprivatekey':_0x06dd('0xc'),'dtlssetup':_0x06dd('0xd'),'callerid':util[_0x06dd('0x3')](_0x06dd('0xe'),util[_0x06dd('0x3')]('%s%s','agent',i),0xfa0+i)});}db[_0x06dd('0xf')][_0x06dd('0x10')](users)[_0x06dd('0x11')](function(){console['log'](_0x06dd('0x12'));})[_0x06dd('0x13')](function(_0x2ec57b){console[_0x06dd('0x14')](_0x2ec57b);}); \ No newline at end of file +var _0x1461=['then','log','catch','util','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x548a1a,_0x20160a){var _0x410252=function(_0x3d4e42){while(--_0x3d4e42){_0x548a1a['push'](_0x548a1a['shift']());}};_0x410252(++_0x20160a);}(_0x1461,0xa5));var _0x1146=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x1461[_0x9b3efc];return _0x200f05;};'use strict';var util=require(_0x1146('0x0'));var db=require(_0x1146('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1146('0x2')]('%s%s',_0x1146('0x3'),i),'fullname':util['format'](_0x1146('0x4'),_0x1146('0x3'),i),'email':util[_0x1146('0x2')](_0x1146('0x5'),_0x1146('0x3'),i),'role':'agent','password':_0x1146('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x1146('0x7'),'ws',_0x1146('0x8')],'disallow':[_0x1146('0x9')],'allow':['ulaw'],'defaultuser':util['format'](_0x1146('0x4'),_0x1146('0x3'),i),'encryption':_0x1146('0xa'),'avpf':'yes','force_avp':_0x1146('0xa'),'icesupport':_0x1146('0xa'),'dtlsenable':_0x1146('0xa'),'dtlsverify':'no','dtlscertfile':_0x1146('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1146('0xc'),'callerid':util[_0x1146('0x2')](_0x1146('0xd'),util['format']('%s%s',_0x1146('0x3'),i),0xfa0+i)});}db[_0x1146('0xe')]['bulkCreate'](users)[_0x1146('0xf')](function(){console[_0x1146('0x10')]('add\x20user');})[_0x1146('0x11')](function(_0x4e0b24){console['log'](_0x4e0b24);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7b2e835..8f3f12d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x584d66,_0x596890){var _0x2e8f1c=function(_0x58afac){while(--_0x58afac){_0x584d66['push'](_0x584d66['shift']());}};_0x2e8f1c(++_0x596890);}(_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 +var _0xb1d8=['voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','MailQueue','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','setMaxListeners','request','connection','remoteAddress','remotePort','connectedAt','address','disconnect','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','where','Campaign','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb1d8,0xef));var _0x8b1d=function(_0x54bd4b,_0x436e06){_0x54bd4b=_0x54bd4b-0x0;var _0x109c0c=_0xb1d8[_0x54bd4b];return _0x109c0c;};'use strict';var _=require(_0x8b1d('0x0'));var util=require('util');var BPromise=require(_0x8b1d('0x1'));var db=require(_0x8b1d('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x8b1d('0x3')],'include':[{'as':_0x8b1d('0x4'),'model':db[_0x8b1d('0x5')],'attributes':['id',_0x8b1d('0x3'),_0x8b1d('0x6')],'raw':!![],'where':{'role':_0x8b1d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8b1d('0x3')],'where':{'role':_0x8b1d('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8b1d('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x8b1d('0x3')],'where':{'role':_0x8b1d('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8b1d('0x3'),_0x8b1d('0x9')],'where':{'type':_0x8b1d('0xa')}};function getAssociatedResources(_0x9d09bd,_0x1ccb9d,_0x57fd94){return db[_0x8b1d('0xb')][_0x8b1d('0xc')]({'where':{'name':_0x9d09bd,'userProfileId':_0x1ccb9d},'raw':!![]})['then'](function(_0x28c882){if(_0x28c882){if(_0x28c882[_0x8b1d('0xd')]){switch(_0x9d09bd){case _0x8b1d('0xe'):case'ChatQueues':case _0x8b1d('0xf'):case _0x8b1d('0x10'):case _0x8b1d('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x57fd94][_0x8b1d('0x12')](queryQueues);case _0x8b1d('0x13'):return db[_0x57fd94][_0x8b1d('0x12')](queryTelephones);case _0x8b1d('0x14'):return db[_0x57fd94][_0x8b1d('0x12')](queryTrunks);case _0x8b1d('0x15'):return db[_0x57fd94][_0x8b1d('0x12')](queryCampaigns);}}else{return db[_0x8b1d('0x16')][_0x8b1d('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x28c882['id']},'raw':!![]})[_0x8b1d('0x17')](function(_0x478348){if(_0x478348){var _0x231913={'where':{'id':_[_0x8b1d('0x18')](_0x478348,_0x8b1d('0x19'))},'raw':!![]};switch(_0x57fd94){case'User':_0x231913[_0x8b1d('0x1a')][_0x8b1d('0x6')]='telephone';break;case _0x8b1d('0x1b'):_0x231913['where'][_0x8b1d('0x9')]=_0x8b1d('0xa');break;}return db[_0x57fd94][_0x8b1d('0x12')](_0x231913);}else{return[];}});}}else{return[];}})[_0x8b1d('0x17')](function(_0x6308d0){return _0x6308d0;});}function joinOrLeaveQueues(_0x396e86,_0x4c8a62,_0x5f3668,_0x2accb3){_0x396e86[_0x4c8a62](util[_0x8b1d('0x1c')]('%s:queue:%s',_0x5f3668,_0x2accb3[_0x8b1d('0x3')]));if(_0x2accb3[_0x8b1d('0x4')]){for(var _0xadfb6c=0x0;_0xadfb6c<_0x2accb3[_0x8b1d('0x4')]['length'];_0xadfb6c+=0x1){_0x396e86[_0x4c8a62](util[_0x8b1d('0x1c')](_0x8b1d('0x1d'),_0x2accb3[_0x8b1d('0x4')][_0xadfb6c][_0x8b1d('0x3')]));}}}function joinOrLeave(_0x2d55d3,_0xf13bbc,_0x313038){var _0x198b7c;if(_0x2d55d3[_0x8b1d('0x1e')][_0x8b1d('0x1f')]['id']){db[_0x8b1d('0x5')][_0x8b1d('0x20')]({'attributes':['id',_0x8b1d('0x3'),_0x8b1d('0x6'),_0x8b1d('0x21')],'where':{'id':_0x2d55d3[_0x8b1d('0x1e')][_0x8b1d('0x1f')]['id']},'include':[{'model':db[_0x8b1d('0x22')],'as':_0x8b1d('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8b1d('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8b1d('0x25')],'as':_0x8b1d('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x8b1d('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x8b1d('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x34f876){if(_0x34f876){_0x198b7c=_0x34f876;_0x2d55d3[_0xf13bbc](util[_0x8b1d('0x1c')](_0x8b1d('0x1d'),_0x34f876['name']));var _0x38ffe8=[];switch(_0x34f876[_0x8b1d('0x6')]){case _0x8b1d('0x29'):_0x2d55d3[_0xf13bbc](_0x8b1d('0x2a'));_0x2d55d3[_0xf13bbc](_0x8b1d('0x2b'));if(queryQueues[_0x8b1d('0x2c')](_0x8b1d('0x2d'))){delete queryQueues[_0x8b1d('0x2d')];}_0x38ffe8['push'](db[_0x8b1d('0x2e')][_0x8b1d('0x12')](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x30')]['findAll'](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x31')][_0x8b1d('0x12')](queryQueues));_0x38ffe8['push'](db[_0x8b1d('0x32')]['findAll'](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db['MailQueue'][_0x8b1d('0x12')](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x33')]['findAll'](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db['WhatsappQueue'][_0x8b1d('0x12')](queryQueues));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x5')][_0x8b1d('0x12')](queryTelephones));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x34')][_0x8b1d('0x12')](queryTrunks));_0x38ffe8['push'](db['Campaign']['findAll'](queryCampaigns));_0x38ffe8[_0x8b1d('0x2f')](db['User'][_0x8b1d('0x12')](queryAgents));break;case _0x8b1d('0x35'):_0x2d55d3[_0xf13bbc](_0x8b1d('0x2a'));_0x2d55d3[_0xf13bbc](_0x8b1d('0x2b'));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources('VoiceQueues',_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x2e')));_0x38ffe8['push'](getAssociatedResources('ChatQueues',_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x30')));_0x38ffe8['push'](getAssociatedResources('FaxQueues',_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x31')));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x10'),_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x32')));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x11'),_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x36')));_0x38ffe8['push'](getAssociatedResources(_0x8b1d('0x37'),_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x33')));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x38'),_0x34f876['userProfileId'],'WhatsappQueue'));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x13'),_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x5')));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x14'),_0x34f876[_0x8b1d('0x21')],'Trunk'));_0x38ffe8[_0x8b1d('0x2f')](getAssociatedResources(_0x8b1d('0x15'),_0x34f876[_0x8b1d('0x21')],_0x8b1d('0x1b')));_0x38ffe8[_0x8b1d('0x2f')](db[_0x8b1d('0x5')]['findAll'](queryAgents));break;case _0x8b1d('0x7'):_0x2d55d3[_0xf13bbc]('voice:inbound');_0x2d55d3[_0xf13bbc](_0x8b1d('0x2b'));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876[_0x8b1d('0x39')]({'attributes':['id',_0x8b1d('0x3')]}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876[_0x8b1d('0x3a')]({'attributes':['id','name']}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876['getFaxQueues']({'attributes':['id',_0x8b1d('0x3')]}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876[_0x8b1d('0x3b')]({'attributes':['id',_0x8b1d('0x3')]}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876[_0x8b1d('0x3c')]({'attributes':['id',_0x8b1d('0x3')]}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876[_0x8b1d('0x3d')]({'attributes':['id',_0x8b1d('0x3')]}));_0x38ffe8[_0x8b1d('0x2f')](_0x34f876['getWhatsappQueues']({'attributes':['id',_0x8b1d('0x3')]}));break;}return BPromise[_0x8b1d('0x3e')](_0x38ffe8);}})[_0x8b1d('0x17')](function(_0x46fa0b){if(_0x46fa0b&&_0x46fa0b[_0x8b1d('0x3f')]){for(var _0x525712=0x0;_0x525712<_0x46fa0b[_0x8b1d('0x3f')];_0x525712+=0x1){for(var _0x10ce88=0x0;_0x10ce88<_0x46fa0b[_0x525712][_0x8b1d('0x3f')];_0x10ce88+=0x1){switch(_0x525712){case 0x0:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x40'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x1:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x41'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x2:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x42'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x3:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x43'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x4:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x44'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x5:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x45'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x6:joinOrLeaveQueues(_0x2d55d3,_0xf13bbc,_0x8b1d('0x46'),_0x46fa0b[_0x525712][_0x10ce88]);break;case 0x7:if(_0x198b7c[_0x8b1d('0x6')]!==_0x8b1d('0x7'))_0x2d55d3[_0xf13bbc](util[_0x8b1d('0x1c')]('telephone:%s',_0x46fa0b[_0x525712][_0x10ce88][_0x8b1d('0x3')]));break;case 0x8:if(_0x198b7c[_0x8b1d('0x6')]!=='agent')_0x2d55d3[_0xf13bbc](util[_0x8b1d('0x1c')](_0x8b1d('0x47'),_0x46fa0b[_0x525712][_0x10ce88][_0x8b1d('0x3')]));break;case 0x9:if(_0x198b7c[_0x8b1d('0x6')]!==_0x8b1d('0x7'))_0x2d55d3[_0xf13bbc](util[_0x8b1d('0x1c')](_0x8b1d('0x48'),_0x46fa0b[_0x525712][_0x10ce88]['type'],_0x46fa0b[_0x525712][_0x10ce88][_0x8b1d('0x3')]));break;case 0xa:_0x2d55d3[_0xf13bbc](util[_0x8b1d('0x1c')](_0x8b1d('0x1d'),_0x46fa0b[_0x525712][_0x10ce88][_0x8b1d('0x3')]));break;}}}}})[_0x8b1d('0x17')](function(){if(_0xf13bbc===_0x8b1d('0x49')){var _0x5af205=_[_0x8b1d('0x18')](_0x198b7c[_0x8b1d('0x23')],'id');return _0x198b7c[_0x8b1d('0x4a')](_0x5af205)[_0x8b1d('0x17')](function(){for(var _0x4e6e40=0x0;_0x4e6e40<_0x5af205[_0x8b1d('0x3f')];_0x4e6e40+=0x1){_0x313038[_0x8b1d('0x4b')](_0x8b1d('0x4c'),{'ChatInteractionId':Number(_0x5af205[_0x4e6e40]),'UserId':Number(_0x198b7c['id'])});}});}})[_0x8b1d('0x17')](function(){if(_0xf13bbc===_0x8b1d('0x49')){var _0x4adad8=_[_0x8b1d('0x18')](_0x198b7c['MailInteractions'],'id');return _0x198b7c['removeMailInteractions'](_0x4adad8)[_0x8b1d('0x17')](function(){for(var _0x5024cd=0x0;_0x5024cd<_0x4adad8['length'];_0x5024cd+=0x1){_0x313038['emit'](_0x8b1d('0x4d'),{'MailInteractionId':Number(_0x4adad8[_0x5024cd]),'UserId':Number(_0x198b7c['id'])});}});}})[_0x8b1d('0x17')](function(){if(_0xf13bbc===_0x8b1d('0x49')){var _0x392109=_[_0x8b1d('0x18')](_0x198b7c['FaxInteractions'],'id');return _0x198b7c[_0x8b1d('0x4e')](_0x392109)[_0x8b1d('0x17')](function(){for(var _0x239af3=0x0;_0x239af3<_0x392109[_0x8b1d('0x3f')];_0x239af3+=0x1){_0x313038['emit'](_0x8b1d('0x4f'),{'FaxInteractionId':Number(_0x392109[_0x239af3]),'UserId':Number(_0x198b7c['id'])});}});}})['then'](function(){if(_0xf13bbc===_0x8b1d('0x49')){var _0x49eb62=_[_0x8b1d('0x18')](_0x198b7c['SmsInteractions'],'id');return _0x198b7c['removeSmsInteractions'](_0x49eb62)[_0x8b1d('0x17')](function(){for(var _0x300463=0x0;_0x300463<_0x49eb62['length'];_0x300463+=0x1){_0x313038[_0x8b1d('0x4b')](_0x8b1d('0x50'),{'SmsInteractionId':Number(_0x49eb62[_0x300463]),'UserId':Number(_0x198b7c['id'])});}});}})[_0x8b1d('0x17')](function(){if(_0xf13bbc==='leave'){var _0x2bdf43=_['map'](_0x198b7c['OpenchannelInteractions'],'id');return _0x198b7c['removeOpenchannelInteractions'](_0x2bdf43)[_0x8b1d('0x17')](function(){for(var _0x3634a8=0x0;_0x3634a8<_0x2bdf43[_0x8b1d('0x3f')];_0x3634a8+=0x1){_0x313038[_0x8b1d('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2bdf43[_0x3634a8]),'UserId':Number(_0x198b7c['id'])});}});}})['then'](function(){if(_0xf13bbc===_0x8b1d('0x49')){var _0x23b191=_[_0x8b1d('0x18')](_0x198b7c[_0x8b1d('0x28')],'id');return _0x198b7c[_0x8b1d('0x51')](_0x23b191)[_0x8b1d('0x17')](function(){for(var _0x5855b3=0x0;_0x5855b3<_0x23b191['length'];_0x5855b3+=0x1){_0x313038[_0x8b1d('0x4b')](_0x8b1d('0x52'),{'WhatsappInteractionId':Number(_0x23b191[_0x5855b3]),'UserId':Number(_0x198b7c['id'])});}});}})['catch'](function(_0x5b215d){_0x2d55d3[_0x8b1d('0x53')](_0x5b215d);});}}function onDisconnect(_0x51f736,_0x4a8304){joinOrLeave(_0x51f736,'leave',_0x4a8304);}function onConnect(_0x45d952){joinOrLeave(_0x45d952,_0x8b1d('0x54'));}exports['default']=function(_0x2d6121){_0x2d6121['on']('connection',function(_0x1af7fa){_0x1af7fa[_0x8b1d('0x55')](0x0);_0x1af7fa['address']=_0x1af7fa[_0x8b1d('0x56')][_0x8b1d('0x57')][_0x8b1d('0x58')]+':'+_0x1af7fa['request'][_0x8b1d('0x57')][_0x8b1d('0x59')];_0x1af7fa[_0x8b1d('0x5a')]=new Date();_0x1af7fa[_0x8b1d('0x53')]=function(_0x1ff26b){console[_0x8b1d('0x53')]('SocketIO\x20'+_0x1af7fa['nsp'][_0x8b1d('0x3')]+'['+_0x1af7fa[_0x8b1d('0x5b')]+']',_0x1ff26b);};_0x1af7fa['on'](_0x8b1d('0x5c'),function(){onDisconnect(_0x1af7fa,_0x2d6121);_0x1af7fa[_0x8b1d('0x53')]('DISCONNECTED');});onConnect(_0x1af7fa);_0x1af7fa['log'](_0x8b1d('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 0faac18..6a45c98 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 _0xafb3=['Chat','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','info','Trigger,\x20%s','error','code','EventManager','catch','get','channel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','UserId','interface','format','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','Sequelize','contact','changed','closed','substatus','AfterUpdate','find','fullname','internal','default','length','hasOwnProperty','model','hook','callback','condition','../../mysqldb','jayson/promise','../logger','triggers','http'];(function(_0x32f05c,_0x273aef){var _0x4307ed=function(_0x1be4da){while(--_0x1be4da){_0x32f05c['push'](_0x32f05c['shift']());}};_0x4307ed(++_0x273aef);}(_0xafb3,0xd6));var _0x3afb=function(_0x4b902c,_0x361ef0){_0x4b902c=_0x4b902c-0x0;var _0x46948e=_0xafb3[_0x4b902c];return _0x46948e;};'use strict';var util=require('util');var db=require(_0x3afb('0x0'))['db'];var jayson=require(_0x3afb('0x1'));var logger=require(_0x3afb('0x2'))(_0x3afb('0x3'));var client=jayson['client'][_0x3afb('0x4')]({'port':0x232a});var triggers=[{'channel':_0x3afb('0x5'),'model':_0x3afb('0x6'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x3afb('0x6'),'event':_0x3afb('0x7'),'condition':_0x3afb('0x8'),'callback':afterUpdate},{'channel':_0x3afb('0x5'),'model':_0x3afb('0x9'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xb'),'callback':afterCreateMessage},{'channel':_0x3afb('0x5'),'model':_0x3afb('0xc'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x3afb('0xd'),'model':_0x3afb('0xe'),'event':'afterCreate','condition':_0x3afb('0xf'),'callback':afterCreate},{'channel':_0x3afb('0xd'),'model':_0x3afb('0xe'),'event':_0x3afb('0x7'),'condition':_0x3afb('0x8'),'callback':afterUpdate},{'channel':_0x3afb('0xd'),'model':_0x3afb('0x10'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xb'),'callback':afterCreateMessage},{'channel':_0x3afb('0x11'),'model':'WhatsappInteraction','event':_0x3afb('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3afb('0x11'),'model':_0x3afb('0x12'),'event':_0x3afb('0x7'),'condition':_0x3afb('0x8'),'callback':afterUpdate},{'channel':_0x3afb('0x11'),'model':_0x3afb('0x13'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xb'),'callback':afterCreateMessage},{'channel':_0x3afb('0x14'),'model':_0x3afb('0x15'),'event':_0x3afb('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3afb('0x14'),'model':_0x3afb('0x15'),'event':_0x3afb('0x7'),'condition':_0x3afb('0x8'),'callback':afterUpdate},{'channel':_0x3afb('0x14'),'model':'FaxMessage','event':_0x3afb('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3afb('0x16'),'model':_0x3afb('0x17'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xf'),'callback':afterCreate},{'channel':_0x3afb('0x16'),'model':_0x3afb('0x17'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3afb('0x16'),'model':'MailMessage','event':_0x3afb('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3afb('0x18'),'model':_0x3afb('0x19'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xf'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x3afb('0x7'),'condition':_0x3afb('0x8'),'callback':afterUpdate},{'channel':_0x3afb('0x18'),'model':_0x3afb('0x1a'),'event':_0x3afb('0xa'),'condition':_0x3afb('0xb'),'callback':afterCreateMessage}];function request(_0x71ffc6){return client[_0x3afb('0x1b')]('EventManager',_0x71ffc6)['then'](function(_0xe08b28){logger[_0x3afb('0x1c')](_0x3afb('0x1d'),'EventManager',_0xe08b28);if(_0xe08b28[_0x3afb('0x1e')]){if(_0xe08b28[_0x3afb('0x1e')][_0x3afb('0x1f')]===0x1f4){logger[_0x3afb('0x1e')](_0x3afb('0x1d'),_0x3afb('0x20'),_0xe08b28['error']);}}})[_0x3afb('0x21')](function(_0x4d2140){logger[_0x3afb('0x1e')](_0x3afb('0x1d'),'EventManager',_0x4d2140);});}function afterCreateMessage(_0x25c485){return function(_0x13fc34){_0x13fc34=_0x13fc34[_0x3afb('0x22')]({'plain':!![]});_0x13fc34[_0x3afb('0x23')]=_0x25c485;_0x13fc34['motionChannel']=_0x25c485;_0x13fc34[_0x3afb('0x24')]=_0x13fc34[_0x3afb('0x25')];Promise[_0x3afb('0x26')]()[_0x3afb('0x27')](function(){if(typeof _0x13fc34[_0x3afb('0x28')]===_0x3afb('0x29'))return null;var _0x1e178f=_0x3afb('0x2a')+_0x13fc34[_0x3afb('0x28')];return db[_0x3afb('0x2b')][_0x3afb('0x2c')](_0x1e178f,{'type':db['Sequelize'][_0x3afb('0x2d')][_0x3afb('0x2e')],'raw':!![]});})[_0x3afb('0x27')](function(_0x16a4f4){if(_0x16a4f4){_0x13fc34['contact']=_0x16a4f4[0x0];}if(typeof _0x13fc34[_0x3afb('0x2f')]===_0x3afb('0x29'))return;return getAgent(_0x13fc34[_0x3afb('0x2f')]);})[_0x3afb('0x27')](function(_0x200802){if(_0x200802){_0x13fc34[_0x3afb('0x30')]=util[_0x3afb('0x31')](_0x3afb('0x32'),_0x200802[_0x3afb('0x33')]);_0x13fc34[_0x3afb('0x34')]=_0x200802;_0x13fc34[_0x3afb('0x23')]=_0x25c485;return request({'event':'incomingmessage','message':_0x13fc34});}else{return request({'event':_0x3afb('0x35'),'message':_0x13fc34});}})[_0x3afb('0x21')](function(_0x55a042){logger[_0x3afb('0x1e')](_0x3afb('0x1d'),_0x3afb('0x36'),_0x55a042);});};}function afterCreateOfflineMessage(_0xf90a32){return function(_0x52ea31){_0x52ea31=_0x52ea31[_0x3afb('0x22')]({'plain':!![]});_0x52ea31[_0x3afb('0x23')]=_0xf90a32;_0x52ea31[_0x3afb('0x37')]=_0xf90a32;_0x52ea31['event']=_0x3afb('0x38');return request({'event':_0x52ea31['event'],'message':_0x52ea31});};}function afterCreate(_0x579ecc,_0x4f4ad1){return function(_0x2a8bf9){_0x2a8bf9=_0x2a8bf9[_0x3afb('0x22')]({'plain':!![]});_0x2a8bf9[_0x3afb('0x23')]=_0x579ecc;_0x2a8bf9[_0x3afb('0x37')]=_0x579ecc;_0x2a8bf9['event']='opened';Promise[_0x3afb('0x26')]()[_0x3afb('0x27')](function(){var _0xda5aed=_0x3afb('0x2a')+_0x2a8bf9['ContactId'];return db[_0x3afb('0x2b')][_0x3afb('0x2c')](_0xda5aed,{'type':db[_0x3afb('0x39')][_0x3afb('0x2d')][_0x3afb('0x2e')],'raw':!![]});})['then'](function(_0x2022bc){if(_0x2022bc){_0x2a8bf9[_0x3afb('0x3a')]=_0x2022bc[0x0];}if(typeof _0x2a8bf9[_0x3afb('0x2f')]===_0x3afb('0x29'))return;return getAgent(_0x2a8bf9['UserId']);})[_0x3afb('0x27')](function(_0x239d74){if(_0x239d74){_0x2a8bf9[_0x3afb('0x30')]=util[_0x3afb('0x31')](_0x3afb('0x32'),_0x239d74['name']);_0x2a8bf9[_0x3afb('0x34')]=_0x239d74;}return request({'event':_0x4f4ad1,'message':_0x2a8bf9});})['catch'](function(_0x4aca18){logger['error']('Trigger,\x20%s','AfterCreate',_0x4aca18);});};}function afterUpdate(_0x2981bf){return function(_0x12183e){var _0x9ed330=_0x12183e[_0x3afb('0x3b')](_0x3afb('0x3c'))&&_0x12183e['closed'];var _0x1bfc04=_0x12183e[_0x3afb('0x3b')](_0x3afb('0x3d'));if(_0x9ed330||_0x1bfc04){var _0x4c9a29=_0x9ed330?_0x3afb('0x8'):_0x3afb('0x3d');var _0x50d412=_0x12183e[_0x3afb('0x22')]({'plain':!![]});_0x50d412[_0x3afb('0x23')]=_0x2981bf;_0x50d412['motionChannel']=_0x2981bf;_0x50d412[_0x3afb('0x24')]=_0x9ed330?'closed':_0x3afb('0x3d');var _0xb9addb=_0x3afb('0x2a')+_0x50d412['ContactId'];return db['sequelize'][_0x3afb('0x2c')](_0xb9addb,{'type':db[_0x3afb('0x39')]['QueryTypes'][_0x3afb('0x2e')],'raw':!![]})['then'](function(_0xe82762){if(_0xe82762){_0x50d412[_0x3afb('0x3a')]=_0xe82762[0x0];}if(typeof _0x50d412[_0x3afb('0x2f')]==='undefined')return;return getAgent(_0x50d412[_0x3afb('0x2f')]);})['then'](function(_0x10365b){if(_0x10365b){_0x50d412[_0x3afb('0x30')]=util[_0x3afb('0x31')](_0x3afb('0x32'),_0x10365b[_0x3afb('0x33')]);_0x50d412['agent']=_0x10365b;}return request({'event':_0x4c9a29,'message':_0x50d412});})[_0x3afb('0x21')](function(_0x337a6c){logger[_0x3afb('0x1e')](_0x3afb('0x1d'),_0x3afb('0x3e'),_0x337a6c);});}};}function getAgent(_0x61072f){return db['User'][_0x3afb('0x3f')]({'where':{'id':_0x61072f},'attributes':['id',_0x3afb('0x33'),_0x3afb('0x40'),'email',_0x3afb('0x41')],'raw':!![]})[_0x3afb('0x27')](function(_0x350998){return _0x350998;});}exports[_0x3afb('0x42')]=function(){for(var _0x4acfc3=0x0;_0x4acfc3=_0x40f167[_0x6a81('0x16')]){throw Error(_0x6a81('0x17'));}_0x2f9623(_0x34870c);})[_0x6a81('0x18')](function(_0x1a6df2){_0xeea60d(_0x1a6df2);});});}; \ No newline at end of file +var _0x8d1a=['includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','openchannel','isValidChannel','toLowerCase'];(function(_0x140458,_0x47e7ef){var _0x47acc8=function(_0x4beaec){while(--_0x4beaec){_0x140458['push'](_0x140458['shift']());}};_0x47acc8(++_0x47e7ef);}(_0x8d1a,0x1f1));var _0xa8d1=function(_0x28907a,_0x50ab9e){_0x28907a=_0x28907a-0x0;var _0xef7b93=_0x8d1a[_0x28907a];return _0xef7b93;};'use strict';var _=require(_0xa8d1('0x0'));var BPromise=require(_0xa8d1('0x1'));var db=require(_0xa8d1('0x2'))['db'];var util=require(_0xa8d1('0x3'));var channels=[_0xa8d1('0x4'),'mail',_0xa8d1('0x5'),'fax','sms','whatsapp',_0xa8d1('0x6')];exports['getChannels']=function(){return channels;};exports[_0xa8d1('0x7')]=function(_0x4ffc61){_0x4ffc61=_0x4ffc61[_0xa8d1('0x8')]();return _[_0xa8d1('0x9')](channels,_0x4ffc61);};exports[_0xa8d1('0xa')]=function(_0x15b363,_0x18f947,_0x29255a,_0x457cb8){var _0x495344={'loginAttempts':_0x18f947,'blocked':_0x29255a};if(!_[_0xa8d1('0xb')](_0x457cb8)){_0x495344[_0xa8d1('0xc')]=_0x457cb8;}return _0x15b363[_0xa8d1('0xd')](_0x495344);};exports['getLicense']=function(_0x32d0ec){return new BPromise(function(_0x37e6c4,_0x4ab826){var _0x288631=0x0;if(_0x32d0ec[_0xa8d1('0xe')]!==_0xa8d1('0xf')){_0x37e6c4(_0x32d0ec);}db[_0xa8d1('0x10')]['count']({'where':{'role':_0xa8d1('0xf'),'online':!![],'id':{'$ne':_0x32d0ec['id']}}})[_0xa8d1('0x11')](function(_0x2fc3c7){_0x288631=_0x2fc3c7;return util[_0xa8d1('0x12')]();})['then'](function(_0x252001){if(_0x252001&&_0x252001[_0xa8d1('0x13')]&&_0x288631>=_0x252001['agents']){throw Error(_0xa8d1('0x14'));}_0x37e6c4(_0x32d0ec);})[_0xa8d1('0x15')](function(_0x2a9b1f){_0x4ab826(_0x2a9b1f);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e31b5c5..33e4a9d 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x5cb31f,_0x3ff46f){var _0xb835b7=function(_0xeb4889){while(--_0xeb4889){_0x5cb31f['push'](_0x5cb31f['shift']());}};_0xb835b7(++_0x3ff46f);}(_0x7a54,0x106));var _0x47a5=function(_0x5856cd,_0x592e62){_0x5856cd=_0x5856cd-0x0;var _0x4e12d4=_0x7a54[_0x5856cd];return _0x4e12d4;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x777111,_0x405f78){var _0x4cf567=function(_0x4dcb4d){while(--_0x4dcb4d){_0x777111['push'](_0x777111['shift']());}};_0x4cf567(++_0x405f78);}(_0x7a54,0x106));var _0x47a5=function(_0x17084d,_0x1ef15a){_0x17084d=_0x17084d-0x0;var _0x47dcb8=_0x7a54[_0x17084d];return _0x47dcb8;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f90d47a..7ee4cbd 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2128=['json','send','404','status','render'];(function(_0x2013cc,_0x24b0ca){var _0xbb8670=function(_0x4a67f0){while(--_0x4a67f0){_0x2013cc['push'](_0x2013cc['shift']());}};_0xbb8670(++_0x24b0ca);}(_0x2128,0x1c9));var _0x8212=function(_0x5a0681,_0x5cbc10){_0x5a0681=_0x5a0681-0x0;var _0x2d3a74=_0x2128[_0x5a0681];return _0x2d3a74;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5624d0,_0x49e7bf){var _0x3f74fc=_0x8212('0x0');var _0x56c15f=0x194;var _0x350adf={'status':_0x56c15f};_0x49e7bf[_0x8212('0x1')](_0x350adf[_0x8212('0x1')]);_0x49e7bf[_0x8212('0x2')](_0x3f74fc,{},function(_0x480593,_0x1eb10b){if(_0x480593){return _0x49e7bf[_0x8212('0x1')](_0x350adf['status'])[_0x8212('0x3')](_0x350adf);}_0x49e7bf[_0x8212('0x4')](_0x1eb10b);});}; \ No newline at end of file +var _0x0b94=['exports','404','status','json','send'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0b94,0xaf));var _0x40b9=function(_0x30befd,_0x4f1206){_0x30befd=_0x30befd-0x0;var _0x1cac7d=_0x0b94[_0x30befd];return _0x1cac7d;};'use strict';module[_0x40b9('0x0')][0x194]=function pageNotFound(_0x4a136e,_0x501e9a){var _0x1797d5=_0x40b9('0x1');var _0x31c386=0x194;var _0x216979={'status':_0x31c386};_0x501e9a[_0x40b9('0x2')](_0x216979[_0x40b9('0x2')]);_0x501e9a['render'](_0x1797d5,{},function(_0x214fa5,_0x3f3df2){if(_0x214fa5){return _0x501e9a[_0x40b9('0x2')](_0x216979['status'])[_0x40b9('0x3')](_0x216979);}_0x501e9a[_0x40b9('0x4')](_0x3f3df2);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5d9de7f..7f1d843 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../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','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../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','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1518590..8200e90 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ef0=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.5.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','./api/user','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations'];(function(_0x5dfebe,_0x15af0b){var _0x27764b=function(_0x35dc63){while(--_0x35dc63){_0x5dfebe['push'](_0x5dfebe['shift']());}};_0x27764b(++_0x15af0b);}(_0x0ef0,0x80));var _0x00ef=function(_0x5f50eb,_0x3e7d18){_0x5f50eb=_0x5f50eb-0x0;var _0xb912b6=_0x0ef0[_0x5f50eb];return _0xb912b6;};'use strict';var path=require(_0x00ef('0x0'));var express=require(_0x00ef('0x1'));var errors=require('./errors');var config=require(_0x00ef('0x2'));var setupLoggers=require(_0x00ef('0x3'))[_0x00ef('0x4')];var clientSideLogs=require(_0x00ef('0x5'));exports[_0x00ef('0x6')]=function(_0x92e0b){return setupLoggers(_0x92e0b)['then'](function(){_0x92e0b['use'](_0x00ef('0x7'),require(_0x00ef('0x8')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xa'),require('./api/voiceChanSpy'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xb'),require(_0x00ef('0xc')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xd'),require('./api/voiceExtension'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xe'),require(_0x00ef('0xf')));_0x92e0b['use'](_0x00ef('0x10'),require('./api/voiceQueue'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x11'),require(_0x00ef('0x12')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x13'),require('./api/screenRecording'));_0x92e0b[_0x00ef('0x9')]('/api/voice/mails',require(_0x00ef('0x14')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x15'),require('./api/voiceMailMessage'));_0x92e0b[_0x00ef('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x16'),require(_0x00ef('0x17')));_0x92e0b[_0x00ef('0x9')]('/api/voice/agents/reports',require(_0x00ef('0x18')));_0x92e0b['use'](_0x00ef('0x19'),require(_0x00ef('0x1a')));_0x92e0b[_0x00ef('0x9')]('/api/members/reports',require(_0x00ef('0x1b')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x1c'),require(_0x00ef('0x1d')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x1e'),require(_0x00ef('0x1f')));_0x92e0b['use'](_0x00ef('0x20'),require(_0x00ef('0x21')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x22'),require(_0x00ef('0x23')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x24'),require(_0x00ef('0x25')));_0x92e0b[_0x00ef('0x9')]('/api/mail/substatuses',require(_0x00ef('0x26')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x27'),require(_0x00ef('0x28')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x29'),require(_0x00ef('0x2a')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x2b'),require(_0x00ef('0x2c')));_0x92e0b[_0x00ef('0x9')]('/api/mail/reports/queue',require(_0x00ef('0x2d')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x2e'),require(_0x00ef('0x2f')));_0x92e0b['use']('/api/dashboards/items',require(_0x00ef('0x30')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x31'),require(_0x00ef('0x32')));_0x92e0b['use'](_0x00ef('0x33'),require('./api/faxApplication'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x34'),require(_0x00ef('0x35')));_0x92e0b['use'](_0x00ef('0x36'),require(_0x00ef('0x37')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x38'),require(_0x00ef('0x39')));_0x92e0b[_0x00ef('0x9')]('/api/fax/reports/queue',require(_0x00ef('0x3a')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x3b'),require('./api/smsAccount'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x3c'),require(_0x00ef('0x3d')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x3e'),require('./api/smsInteraction'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x3f'),require(_0x00ef('0x40')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x41'),require(_0x00ef('0x42')));_0x92e0b[_0x00ef('0x9')]('/api/openchannel/accounts',require(_0x00ef('0x43')));_0x92e0b['use'](_0x00ef('0x44'),require('./api/openchannelApplication'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x45'),require(_0x00ef('0x46')));_0x92e0b['use'](_0x00ef('0x47'),require(_0x00ef('0x48')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x49'),require(_0x00ef('0x4a')));_0x92e0b['use'](_0x00ef('0x4b'),require('./api/chatWebsite'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x4c'),require('./api/openchannelQueueReport'));_0x92e0b[_0x00ef('0x9')]('/api/chat/applications',require('./api/chatApplication'));_0x92e0b[_0x00ef('0x9')]('/api/chat/interactions',require(_0x00ef('0x4d')));_0x92e0b[_0x00ef('0x9')]('/api/chat/messages',require(_0x00ef('0x4e')));_0x92e0b['use'](_0x00ef('0x4f'),require('./api/chatOfflineMessage'));_0x92e0b[_0x00ef('0x9')]('/api/chat/queues',require(_0x00ef('0x50')));_0x92e0b['use'](_0x00ef('0x51'),require(_0x00ef('0x52')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x53'),require(_0x00ef('0x54')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x55'),require(_0x00ef('0x56')));_0x92e0b['use'](_0x00ef('0x57'),require('./api/cmContact'));_0x92e0b[_0x00ef('0x9')]('/api/cm/hopper',require('./api/cmHopper'));_0x92e0b['use']('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x58'),require(_0x00ef('0x59')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x5a'),require(_0x00ef('0x5b')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x5c'),require(_0x00ef('0x5d')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x5e'),require(_0x00ef('0x5f')));_0x92e0b[_0x00ef('0x9')]('/api/automations',require(_0x00ef('0x60')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x61'),require(_0x00ef('0x62')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x63'),require(_0x00ef('0x64')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x65'),require(_0x00ef('0x66')));_0x92e0b['use'](_0x00ef('0x67'),require(_0x00ef('0x68')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x69'),require(_0x00ef('0x6a')));_0x92e0b['use']('/api/cdr',require(_0x00ef('0x6b')));_0x92e0b[_0x00ef('0x9')]('/api/voiceQueuesLog',require(_0x00ef('0x6c')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x6d'),require(_0x00ef('0x6e')));_0x92e0b['use'](_0x00ef('0x6f'),require('./api/sound'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x70'),require(_0x00ef('0x71')));_0x92e0b[_0x00ef('0x9')]('/api/contact_item_types',require('./api/contactItemType'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x72'),require(_0x00ef('0x73')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x74'),require(_0x00ef('0x75')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x76'),require('./api/template'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x77'),require('./api/trigger'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x78'),require(_0x00ef('0x79')));_0x92e0b[_0x00ef('0x9')]('/api/integrations',require(_0x00ef('0x7a')));_0x92e0b['use'](_0x00ef('0x7b'),require(_0x00ef('0x7c')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x7d'),require(_0x00ef('0x7e')));_0x92e0b['use'](_0x00ef('0x7f'),require(_0x00ef('0x80')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x81'),require(_0x00ef('0x82')));_0x92e0b[_0x00ef('0x9')]('/api/analytics/metrics',require(_0x00ef('0x83')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x84'),require(_0x00ef('0x85')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x86'),require(_0x00ef('0x87')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x88'),require('./api/intSalesforceAccount'));_0x92e0b[_0x00ef('0x9')]('/api/integrations/salesforce/configurations',require(_0x00ef('0x89')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x8a'),require(_0x00ef('0x8b')));_0x92e0b[_0x00ef('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x00ef('0x8c')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x8d'),require(_0x00ef('0x8e')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x8f'),require(_0x00ef('0x90')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x91'),require(_0x00ef('0x92')));_0x92e0b[_0x00ef('0x9')]('/api/integrations/desk/configurations',require(_0x00ef('0x93')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x94'),require('./api/intDeskField'));_0x92e0b[_0x00ef('0x9')]('/api/integrations/zoho/accounts',require(_0x00ef('0x95')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x96'),require(_0x00ef('0x97')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x98'),require('./api/intZohoField'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x99'),require(_0x00ef('0x9a')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x9b'),require(_0x00ef('0x9c')));_0x92e0b['use'](_0x00ef('0x9d'),require(_0x00ef('0x9e')));_0x92e0b['use'](_0x00ef('0x9f'),require(_0x00ef('0xa0')));_0x92e0b[_0x00ef('0x9')]('/api/integrations/freshdesk/configurations',require(_0x00ef('0xa1')));_0x92e0b['use'](_0x00ef('0xa2'),require('./api/intFreshdeskField'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xa3'),require('./api/intVtigerAccount'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xa4'),require('./api/intVtigerConfiguration'));_0x92e0b[_0x00ef('0x9')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xa5'),require(_0x00ef('0xa6')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xa7'),require(_0x00ef('0xa8')));_0x92e0b[_0x00ef('0x9')]('/api/integrations/servicenow/fields',require(_0x00ef('0xa9')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xaa'),require('./api/intDynamics365Account'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xab'),require(_0x00ef('0xac')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xad'),require(_0x00ef('0xae')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xaf'),require('./api/intFreshsalesAccount'));_0x92e0b['use'](_0x00ef('0xb0'),require(_0x00ef('0xb1')));_0x92e0b['use'](_0x00ef('0xb2'),require(_0x00ef('0xb3')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xb4'),require(_0x00ef('0xb5')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xb6'),require(_0x00ef('0xb7')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xb8'),require(_0x00ef('0xb9')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xba'),require('./api/jscriptyAnswerReport'));_0x92e0b[_0x00ef('0x9')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x92e0b[_0x00ef('0x9')]('/api/jscripty/sessions/reports',require(_0x00ef('0xbb')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xbc'),require(_0x00ef('0xbd')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xbe'),require(_0x00ef('0xbf')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xc0'),require(_0x00ef('0xc1')));_0x92e0b['use'](_0x00ef('0xc2'),require(_0x00ef('0xc3')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xc4'),require(_0x00ef('0xc5')));_0x92e0b[_0x00ef('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xc6'),require(_0x00ef('0xc7')));_0x92e0b[_0x00ef('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xc8'),require(_0x00ef('0xc9')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xca'),require(_0x00ef('0xcb')));_0x92e0b['use']('/api/license',require(_0x00ef('0xcc')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xcd'),require(_0x00ef('0xce')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xcf'),require(_0x00ef('0xd0')));_0x92e0b['use'](_0x00ef('0xd1'),require(_0x00ef('0xd2')));_0x92e0b[_0x00ef('0x9')]('/api/plugins',require(_0x00ef('0xd3')));_0x92e0b['use'](_0x00ef('0xd4'),require(_0x00ef('0xd5')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xd6'),require(_0x00ef('0xd7')));_0x92e0b['use'](_0x00ef('0xd8'),require(_0x00ef('0xd9')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xda'),require(_0x00ef('0xdb')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xdc'),require(_0x00ef('0xdd')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xde'),require('./api/cmList'));_0x92e0b[_0x00ef('0x9')]('/api/voice/prefixes',require(_0x00ef('0xdf')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xe0'),require(_0x00ef('0xe1')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xe2'),require(_0x00ef('0xe3')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xe4'),require(_0x00ef('0xe5')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xe6'),require(_0x00ef('0xe7')));_0x92e0b['use'](_0x00ef('0xe8'),require(_0x00ef('0xe9')));_0x92e0b[_0x00ef('0x9')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xea'),require('./api/whatsappInteraction'));_0x92e0b['use'](_0x00ef('0xeb'),require('./api/whatsappMessage'));_0x92e0b['use'](_0x00ef('0xec'),require(_0x00ef('0xed')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xee'),require(_0x00ef('0xef')));_0x92e0b[_0x00ef('0x9')]('/api/whatsapp/queues',require(_0x00ef('0xf0')));_0x92e0b['use'](_0x00ef('0xf1'),require('./api/cloudProvider'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xf2'),require(_0x00ef('0xf3')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xf4'),require('./api/user-setting'));_0x92e0b[_0x00ef('0x9')]('/api/auth/local',require('./api/authLocal'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xf5'),require(_0x00ef('0xf6')));_0x92e0b['use']('/api/auth/activedirectory',require(_0x00ef('0xf7')));_0x92e0b['use']('/api/jira',require('./api/jira'));_0x92e0b[_0x00ef('0x9')]('/api/rpc',require('./api/rpc'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xf8'),require('./api/version'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xf9'),require('./api/system'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xfa'),require(_0x00ef('0xfb')));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xfc'),require('./api/webbar'));_0x92e0b[_0x00ef('0x9')](_0x00ef('0xfd'),clientSideLogs);_0x92e0b[_0x00ef('0x9')]('/apidoc',express[_0x00ef('0xfe')](path[_0x00ef('0xff')](config[_0x00ef('0x100')],_0x00ef('0x101'))));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x102'),express['static'](path[_0x00ef('0xff')](config[_0x00ef('0x100')],'/www')));_0x92e0b['use']('/demo',express[_0x00ef('0xfe')](path[_0x00ef('0xff')](config[_0x00ef('0x100')],_0x00ef('0x103'))));_0x92e0b[_0x00ef('0x9')](_0x00ef('0x104'),express[_0x00ef('0xfe')](path[_0x00ef('0xff')](config[_0x00ef('0x100')],_0x00ef('0x105'),_0x00ef('0x106'))));_0x92e0b['use'](_0x00ef('0x107'),express['static'](path[_0x00ef('0xff')](config[_0x00ef('0x100')],'/server/files/plugins')));_0x92e0b[_0x00ef('0x108')](_0x00ef('0x109'))[_0x00ef('0x10a')](errors[0x194]);_0x92e0b[_0x00ef('0x108')]('/*')[_0x00ef('0x10a')](function(_0x3c37c0,_0x2c8746){_0x2c8746[_0x00ef('0x10b')](path['resolve'](_0x92e0b['get'](_0x00ef('0x10c'))+_0x00ef('0x10d')));});return _0x92e0b;});}; \ No newline at end of file +var _0x851c=['./api/interval','./api/pause','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.5.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','use','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition'];(function(_0xd41d92,_0x4d461d){var _0x17003e=function(_0x28a6ba){while(--_0x28a6ba){_0xd41d92['push'](_0xd41d92['shift']());}};_0x17003e(++_0x4d461d);}(_0x851c,0x19d));var _0xc851=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x851c[_0x5b644e];return _0x49c6bf;};'use strict';var path=require(_0xc851('0x0'));var express=require(_0xc851('0x1'));var errors=require(_0xc851('0x2'));var config=require(_0xc851('0x3'));var setupLoggers=require(_0xc851('0x4'))[_0xc851('0x5')];var clientSideLogs=require(_0xc851('0x6'));exports['default']=function(_0x2fddd4){return setupLoggers(_0x2fddd4)[_0xc851('0x7')](function(){_0x2fddd4['use'](_0xc851('0x8'),require(_0xc851('0x9')));_0x2fddd4['use'](_0xc851('0xa'),require('./api/voiceChanSpy'));_0x2fddd4['use'](_0xc851('0xb'),require('./api/voiceContext'));_0x2fddd4['use'](_0xc851('0xc'),require(_0xc851('0xd')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xf'),require(_0xc851('0x10')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x11'),require(_0xc851('0x12')));_0x2fddd4['use'](_0xc851('0x13'),require(_0xc851('0x14')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x15'),require(_0xc851('0x16')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x17'),require(_0xc851('0x18')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x19'),require(_0xc851('0x1a')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x1b'),require(_0xc851('0x1c')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x1d'),require('./api/voiceDialReport'));_0x2fddd4[_0xc851('0xe')]('/api/voice/agents/reports',require(_0xc851('0x1e')));_0x2fddd4['use'](_0xc851('0x1f'),require(_0xc851('0x20')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x21'),require(_0xc851('0x22')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x23'),require('./api/trunk'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x24'),require('./api/voiceTransferReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x25'),require(_0xc851('0x26')));_0x2fddd4[_0xc851('0xe')]('/api/mail/accounts',require(_0xc851('0x27')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x28'),require(_0xc851('0x29')));_0x2fddd4[_0xc851('0xe')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x2a'),require(_0xc851('0x2b')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x2c'),require(_0xc851('0x2d')));_0x2fddd4['use'](_0xc851('0x2e'),require('./api/mailApplication'));_0x2fddd4['use'](_0xc851('0x2f'),require(_0xc851('0x30')));_0x2fddd4['use'](_0xc851('0x31'),require(_0xc851('0x32')));_0x2fddd4[_0xc851('0xe')]('/api/dashboards/items',require(_0xc851('0x33')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x34'),require(_0xc851('0x35')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x36'),require(_0xc851('0x37')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x38'),require(_0xc851('0x39')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x3a'),require('./api/faxMessage'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x3b'),require('./api/faxQueue'));_0x2fddd4[_0xc851('0xe')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x2fddd4['use'](_0xc851('0x3c'),require('./api/smsAccount'));_0x2fddd4[_0xc851('0xe')]('/api/sms/applications',require(_0xc851('0x3d')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x3e'),require(_0xc851('0x3f')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x40'),require(_0xc851('0x41')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x42'),require(_0xc851('0x43')));_0x2fddd4[_0xc851('0xe')]('/api/openchannel/accounts',require(_0xc851('0x44')));_0x2fddd4['use'](_0xc851('0x45'),require(_0xc851('0x46')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x47'),require(_0xc851('0x48')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x49'),require('./api/openchannelMessage'));_0x2fddd4['use'](_0xc851('0x4a'),require(_0xc851('0x4b')));_0x2fddd4['use']('/api/chat/websites',require(_0xc851('0x4c')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x4d'),require('./api/openchannelQueueReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x4e'),require(_0xc851('0x4f')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x50'),require(_0xc851('0x51')));_0x2fddd4[_0xc851('0xe')]('/api/chat/messages',require(_0xc851('0x52')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x53'),require(_0xc851('0x54')));_0x2fddd4[_0xc851('0xe')]('/api/chat/queues',require(_0xc851('0x55')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x56'),require('./api/chatGroup'));_0x2fddd4[_0xc851('0xe')]('/api/chat/proactive_actions',require(_0xc851('0x57')));_0x2fddd4['use'](_0xc851('0x58'),require('./api/cmCompany'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x59'),require(_0xc851('0x5a')));_0x2fddd4['use'](_0xc851('0x5b'),require(_0xc851('0x5c')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x5d'),require('./api/cmHopperBlack'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x5e'),require(_0xc851('0x5f')));_0x2fddd4['use']('/api/cm/hopper_history',require(_0xc851('0x60')));_0x2fddd4['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x2fddd4['use'](_0xc851('0x61'),require(_0xc851('0x62')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x63'),require(_0xc851('0x64')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x65'),require(_0xc851('0x66')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x67'),require(_0xc851('0x68')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x69'),require(_0xc851('0x6a')));_0x2fddd4['use']('/api/intervals',require(_0xc851('0x6b')));_0x2fddd4['use']('/api/pauses',require(_0xc851('0x6c')));_0x2fddd4[_0xc851('0xe')]('/api/cdr',require('./api/cdr'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x6d'),require('./api/voiceQueuesLog'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x6e'),require('./api/schedule'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x6f'),require(_0xc851('0x70')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x71'),require('./api/tag'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x72'),require(_0xc851('0x73')));_0x2fddd4['use'](_0xc851('0x74'),require(_0xc851('0x75')));_0x2fddd4[_0xc851('0xe')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x76'),require(_0xc851('0x77')));_0x2fddd4['use'](_0xc851('0x78'),require('./api/trigger'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x79'),require(_0xc851('0x7a')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x7b'),require(_0xc851('0x7c')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x7d'),require('./api/integrationReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x7e'),require('./api/analyticCustomReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x7f'),require(_0xc851('0x80')));_0x2fddd4[_0xc851('0xe')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x2fddd4[_0xc851('0xe')]('/api/analytics/metrics',require(_0xc851('0x81')));_0x2fddd4['use'](_0xc851('0x82'),require(_0xc851('0x83')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x84'),require(_0xc851('0x85')));_0x2fddd4['use'](_0xc851('0x86'),require('./api/intSalesforceAccount'));_0x2fddd4[_0xc851('0xe')]('/api/integrations/salesforce/configurations',require(_0xc851('0x87')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x88'),require(_0xc851('0x89')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/sugarcrm/accounts',require(_0xc851('0x8a')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x8b'),require(_0xc851('0x8c')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x8d'),require(_0xc851('0x8e')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x8f'),require(_0xc851('0x90')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x91'),require('./api/intDeskConfiguration'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x92'),require(_0xc851('0x93')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x94'),require(_0xc851('0x95')));_0x2fddd4['use'](_0xc851('0x96'),require('./api/intZohoConfiguration'));_0x2fddd4[_0xc851('0xe')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x2fddd4[_0xc851('0xe')]('/api/integrations/zendesk/accounts',require(_0xc851('0x97')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x98'),require('./api/intZendeskConfiguration'));_0x2fddd4[_0xc851('0xe')](_0xc851('0x99'),require(_0xc851('0x9a')));_0x2fddd4[_0xc851('0xe')](_0xc851('0x9b'),require(_0xc851('0x9c')));_0x2fddd4['use'](_0xc851('0x9d'),require(_0xc851('0x9e')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/freshdesk/fields',require(_0xc851('0x9f')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/vtiger/accounts',require(_0xc851('0xa0')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xa1'),require(_0xc851('0xa2')));_0x2fddd4['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x2fddd4['use'](_0xc851('0xa3'),require(_0xc851('0xa4')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xa5'),require(_0xc851('0xa6')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/servicenow/fields',require(_0xc851('0xa7')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/dynamics365/accounts',require(_0xc851('0xa8')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/dynamics365/configurations',require(_0xc851('0xa9')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/dynamics365/fields',require(_0xc851('0xaa')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xab'),require('./api/intFreshsalesAccount'));_0x2fddd4['use']('/api/integrations/freshsales/configurations',require(_0xc851('0xac')));_0x2fddd4[_0xc851('0xe')]('/api/integrations/freshsales/fields',require(_0xc851('0xad')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xae'),require(_0xc851('0xaf')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xb0'),require(_0xc851('0xb1')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xb2'),require(_0xc851('0xb3')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xb4'),require(_0xc851('0xb5')));_0x2fddd4['use'](_0xc851('0xb6'),require(_0xc851('0xb7')));_0x2fddd4['use'](_0xc851('0xb8'),require('./api/jscriptySessionReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xb9'),require(_0xc851('0xba')));_0x2fddd4[_0xc851('0xe')]('/api/square/reports',require('./api/squareReport'));_0x2fddd4[_0xc851('0xe')]('/api/square/details/reports',require(_0xc851('0xbb')));_0x2fddd4['use'](_0xc851('0xbc'),require('./api/jscriptyProject'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xbd'),require(_0xc851('0xbe')));_0x2fddd4['use']('/api/square/odbc',require('./api/squareOdbc'));_0x2fddd4[_0xc851('0xe')]('/api/square/projects',require(_0xc851('0xbf')));_0x2fddd4[_0xc851('0xe')]('/api/square/recordings',require('./api/squareRecording'));_0x2fddd4['use'](_0xc851('0xc0'),require(_0xc851('0xc1')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xc2'),require(_0xc851('0xc3')));_0x2fddd4['use']('/api/license',require(_0xc851('0xc4')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xc5'),require('./api/campaign'));_0x2fddd4[_0xc851('0xe')]('/api/migrations',require('./api/migration'));_0x2fddd4[_0xc851('0xe')]('/api/attachments',require('./api/attachment'));_0x2fddd4['use'](_0xc851('0xc6'),require(_0xc851('0xc7')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xc8'),require('./api/mailTransferReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xc9'),require(_0xc851('0xca')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xcb'),require(_0xc851('0xcc')));_0x2fddd4[_0xc851('0xe')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xcd'),require('./api/smsTransferReport'));_0x2fddd4['use'](_0xc851('0xce'),require(_0xc851('0xcf')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xd0'),require(_0xc851('0xd1')));_0x2fddd4['use'](_0xc851('0xd2'),require(_0xc851('0xd3')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xd4'),require('./api/userProfileSection'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xd5'),require(_0xc851('0xd6')));_0x2fddd4['use']('/api/userNotifications',require(_0xc851('0xd7')));_0x2fddd4[_0xc851('0xe')]('/api/whatsapp/accounts',require(_0xc851('0xd8')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xd9'),require(_0xc851('0xda')));_0x2fddd4['use'](_0xc851('0xdb'),require(_0xc851('0xdc')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xdd'),require(_0xc851('0xde')));_0x2fddd4[_0xc851('0xe')]('/api/whatsapp/reports/queue',require(_0xc851('0xdf')));_0x2fddd4[_0xc851('0xe')]('/api/whatsapp/reports/transfer',require(_0xc851('0xe0')));_0x2fddd4['use'](_0xc851('0xe1'),require('./api/whatsappQueue'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xe2'),require(_0xc851('0xe3')));_0x2fddd4['use']('/api/realtime',require(_0xc851('0xe4')));_0x2fddd4['use'](_0xc851('0xe5'),require(_0xc851('0xe6')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xe7'),require(_0xc851('0xe8')));_0x2fddd4[_0xc851('0xe')]('/api/auth/google',require(_0xc851('0xe9')));_0x2fddd4['use']('/api/auth/activedirectory',require(_0xc851('0xea')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xeb'),require('./api/jira'));_0x2fddd4['use'](_0xc851('0xec'),require('./api/rpc'));_0x2fddd4['use'](_0xc851('0xed'),require('./api/version'));_0x2fddd4[_0xc851('0xe')](_0xc851('0xee'),require(_0xc851('0xef')));_0x2fddd4['use'](_0xc851('0xf0'),require(_0xc851('0xf1')));_0x2fddd4[_0xc851('0xe')](_0xc851('0xf2'),require(_0xc851('0xf3')));_0x2fddd4[_0xc851('0xe')]('/api/logs',clientSideLogs);_0x2fddd4[_0xc851('0xe')]('/apidoc',express[_0xc851('0xf4')](path[_0xc851('0xf5')](config[_0xc851('0xf6')],_0xc851('0xf7'))));_0x2fddd4[_0xc851('0xe')](_0xc851('0xf8'),express[_0xc851('0xf4')](path[_0xc851('0xf5')](config[_0xc851('0xf6')],_0xc851('0xf8'))));_0x2fddd4[_0xc851('0xe')](_0xc851('0xf9'),express[_0xc851('0xf4')](path[_0xc851('0xf5')](config[_0xc851('0xf6')],_0xc851('0xf9'))));_0x2fddd4['use'](_0xc851('0xfa'),express[_0xc851('0xf4')](path[_0xc851('0xf5')](config[_0xc851('0xf6')],_0xc851('0xfb'),_0xc851('0xfc'))));_0x2fddd4[_0xc851('0xe')](_0xc851('0xfd'),express[_0xc851('0xf4')](path[_0xc851('0xf5')](config[_0xc851('0xf6')],'/server/files/plugins')));_0x2fddd4[_0xc851('0xfe')](_0xc851('0xff'))[_0xc851('0x100')](errors[0x194]);_0x2fddd4[_0xc851('0xfe')]('/*')[_0xc851('0x100')](function(_0x53ced3,_0x45243e){_0x45243e[_0xc851('0x101')](path[_0xc851('0x102')](_0x2fddd4[_0xc851('0x100')](_0xc851('0x103'))+'/index.html'));});return _0x2fddd4;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c513e0d..4587c89 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e6b=['rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http'];(function(_0xf3d94c,_0x39b376){var _0xa89384=function(_0x55e9f1){while(--_0x55e9f1){_0xf3d94c['push'](_0xf3d94c['shift']());}};_0xa89384(++_0x39b376);}(_0x5e6b,0x16c));var _0xb5e6=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x5e6b[_0x5eef05];return _0x56d4b8;};'use strict';var jayson=require(_0xb5e6('0x0'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x2dfa39,_0x196121){var _0x249f12={};_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x3')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x4')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x5')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x6')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x7')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x8')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/memberReport/memberReport.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x9')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0xa')));_0x249f12=_['merge'](_0x249f12,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0xb')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0xc')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0xd')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0xe')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0xf')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x10')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x11')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x12')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/faxApplication/faxApplication.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x13')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x14')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x15')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x16')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x17')));_0x249f12=_['merge'](_0x249f12,require('../api/smsInteraction/smsInteraction.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x18')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x19')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x1a')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x1b')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x1c')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x1d')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x1e')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x1f')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/chatQueue/chatQueue.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x20')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x21')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x22')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x23')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x24')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x25')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x26')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x27')));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x28')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x29')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2a')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/variable/variable.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2b')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2c')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2d')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2e')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x2f')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x30')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x31')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x32')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x33')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x34')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x35')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x36')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x37')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/squareProject/squareProject.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x38')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/squareMessage/squareMessage.rpc'));_0x249f12=_['merge'](_0x249f12,require('../api/campaign/campaign.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/attachment/attachment.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x39')));_0x249f12=_['merge'](_0x249f12,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x249f12=_['merge'](_0x249f12,require(_0xb5e6('0x3a')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require(_0xb5e6('0x3b')));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x249f12=_[_0xb5e6('0x1')](_0x249f12,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x54598f=jayson[_0xb5e6('0x3c')](_0x249f12)[_0xb5e6('0x3d')]();var _0x52c3c5=config[_0xb5e6('0x3e')][_0xb5e6('0x3f')]||config['port']+0x1;var _0x10b048=config[_0xb5e6('0x3e')]['ip']||_0xb5e6('0x40');_0x54598f['on']('error',function(_0x33c47d){return _0x196121(_0x33c47d);});_0x54598f[_0xb5e6('0x41')](_0x52c3c5,_0x10b048,function(){console[_0xb5e6('0x42')](_0xb5e6('0x43'),_0x10b048,_0x52c3c5);require(_0xb5e6('0x44'))[_0xb5e6('0x45')]();return _0x2dfa39(_0xb5e6('0x46')+_0x10b048+':'+_0x52c3c5);});});}; \ No newline at end of file +var _0xe76a=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/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/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','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/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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0xba0797,_0x49d63b){var _0x3dcdd3=function(_0x5b322a){while(--_0x5b322a){_0xba0797['push'](_0xba0797['shift']());}};_0x3dcdd3(++_0x49d63b);}(_0xe76a,0xd4));var _0xae76=function(_0x32d934,_0x31b889){_0x32d934=_0x32d934-0x0;var _0x15594a=_0xe76a[_0x32d934];return _0x15594a;};'use strict';var jayson=require(_0xae76('0x0'));var _=require(_0xae76('0x1'));var config=require(_0xae76('0x2'));exports[_0xae76('0x3')]=function(){return new Promise(function(_0x6d40ca,_0x3b0457){var _0x16c0a7={};_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x5')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x6')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x7')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x8')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x9')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0xa')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0xb')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0xc')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0xd')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0xe')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0xf')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x10')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x11')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x12')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x13')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x14')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/mailMessage/mailMessage.rpc'));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x15')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x16')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x17')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x18')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x19')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/faxMessage/faxMessage.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x1a')));_0x16c0a7=_['merge'](_0x16c0a7,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x1b')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x1c')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x1d')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x1e')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x1f')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x20')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x21')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x22')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x23')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x24')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x25')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/cmHopper/cmHopper.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x26')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x27')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x28')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x29')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x2a')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x2b')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x2c')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x2d')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x2e')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x2f')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x30')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x31')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x32')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x33')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x34')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x35')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x36')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x37')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x38')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x39')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/squareReport/squareReport.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/setting/setting.rpc'));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x3a')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x3b')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x3c')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x3d')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x3e')));_0x16c0a7=_['merge'](_0x16c0a7,require(_0xae76('0x3f')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x40')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x41')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x42')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x43')));_0x16c0a7=_[_0xae76('0x4')](_0x16c0a7,require(_0xae76('0x44')));var _0x96ade7=jayson['server'](_0x16c0a7)[_0xae76('0x45')]();var _0x4b8564=config['rpc']['port']||config['port']+0x1;var _0x468921=config[_0xae76('0x46')]['ip']||_0xae76('0x47');_0x96ade7['on'](_0xae76('0x48'),function(_0x1b6e4d){return _0x3b0457(_0x1b6e4d);});_0x96ade7[_0xae76('0x3')](_0x4b8564,_0x468921,function(){console[_0xae76('0x49')](_0xae76('0x4a'),_0x468921,_0x4b8564);require(_0xae76('0x4b'))[_0xae76('0x4c')]();return _0x6d40ca(_0xae76('0x4d')+_0x468921+':'+_0x4b8564);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 215bc10..48eccea 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 _0xbd4a=['exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xbd4a,0xbf));var _0xabd4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd4a[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0xabd4('0x0'));var _=require(_0xabd4('0x1'));var EventEmitter=require('events')[_0xabd4('0x2')];var AGIReply=require(_0xabd4('0x3'));var AGIError=require(_0xabd4('0x4'));function AGIChannel(_0x378a03){var _0x10289f=this,_0x5624b0=new AGIReply(),_0xb4b882=![],_0x2096e1={};EventEmitter[_0xabd4('0x5')](_0x10289f);_0x378a03['setEncoding'](_0xabd4('0x6'));_0x378a03[_0xabd4('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5624b0[_0xabd4('0x8')](_0xabd4('0x6'));_0x5624b0['on'](_0xabd4('0x9'),function(_0x2ce16f){for(var _0x26bb37 in _0x2ce16f){_0x10289f[_0x26bb37]=_0x2ce16f[_0x26bb37];}_0x10289f[_0xabd4('0xa')](_0xabd4('0xb'));});_0x5624b0['on'](_0xabd4('0xc'),function(_0x60a203){if(_0x60a203[_0xabd4('0xd')]()==_0xabd4('0xe')){_0x10289f[_0xabd4('0xa')](_0xabd4('0xe'));return;}if(_0x60a203[_0xabd4('0xf')](0x0,0xb)==_0xabd4('0x10')){_0xb4b882=!![];}if(_0xb4b882){_0x2096e1['rx']+=_0x60a203+'\x0a';if(_0x60a203['search'](_0xabd4('0x11'))!=-0x1){_0xb4b882=![];}}else{_0x2096e1['rx']=_0x60a203;}if(_0xb4b882){return;}if(typeof _0x2096e1['cb']==_0xabd4('0x12')){var _0x3dd549=_0x2096e1['rx'][_0xabd4('0xf')](0x0,0x3),_0x47af64=null,_0x54937b=null;_0x3dd549=parseInt(_0x3dd549);if(isNaN(_0x3dd549)){_0x2096e1['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xabd4('0x13')});return;}if(_0x3dd549!=0xc8){_0x2096e1['cb'](null,{'code':_0x3dd549,'result':-0x1,'extra':'KO'});return;}_0x47af64=_0x2096e1['rx'][_0xabd4('0xf')](0x4)[_0xabd4('0x14')](_0xabd4('0x15'),'');if(_0x47af64['indexOf']('\x20')!=-0x1){_0x47af64=_0x47af64[_0xabd4('0x16')](0x0,_0x47af64[_0xabd4('0x17')]('\x20'));}if(_[_0xabd4('0x18')](_0x47af64,'-1')){_0x47af64=parseInt(_0x47af64);}_0x54937b=_0x2096e1['rx']['split']('\x20');if(_0x54937b[_0xabd4('0x19')]==0x3){_0x54937b=_0x54937b[0x2][_0xabd4('0xf')](0x1,_0x54937b[0x2][_0xabd4('0x19')]-0x1);}else if(_0x54937b[_0xabd4('0x19')]>0x3){var _0x293ee8=/\((.+)\)/;var _0x1e7041=_0x2096e1['rx'][_0xabd4('0x1a')](_0x293ee8);if(_0x1e7041){_0x54937b=_0x1e7041[0x1];}else{_0x54937b=null;}}else{_0x54937b=null;}_0x2096e1['cb'](null,{'code':_0x3dd549,'result':_0x47af64,'extra':_0x54937b});}});_0x378a03['on'](_0xabd4('0x1b'),function(_0x436d81){_0x10289f[_0xabd4('0xa')]('error',new AGIError(_0xabd4('0x1c'),_0x436d81['code']));});_0x378a03['on'](_0xabd4('0x1d'),function(){_0x10289f[_0xabd4('0xa')](_0xabd4('0x1d'),new AGIError(_0xabd4('0x1e')));});_0x378a03['on']('timeout',function(){_0x10289f['emit'](_0xabd4('0x1f'),new AGIError(_0xabd4('0x20')));_0x378a03[_0xabd4('0x21')]();});_0x378a03[_0xabd4('0x22')](_0x5624b0);this[_0xabd4('0x23')]=function(_0x31b506,_0x38a5c0){var _0x31b506=_0x31b506||'',_0x38a5c0=typeof _0x38a5c0==_0xabd4('0x12')?_0x38a5c0:new Function();_0x2096e1={'tx':_0x31b506,'rx':'','cb':_0x38a5c0};_0x378a03['write'](_0x31b506+'\x0a');},this['close']=function(){_0x378a03[_0xabd4('0x21')]();};}util[_0xabd4('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xabd4('0x25')][_0xabd4('0x26')]=function(_0x5f08cb){return this['command'][_0xabd4('0x27')](this,_0x5f08cb);};AGIChannel[_0xabd4('0x25')][_0xabd4('0x28')]=function(){return this[_0xabd4('0x26')](_0xabd4('0x29'));};AGIChannel['prototype'][_0xabd4('0x2a')]=function(_0x4280c8,_0x13242f,_0x38fbd9){_0x4280c8=_0x4280c8===undefined?'beep':_0x4280c8;_0x13242f=_0x13242f===undefined?'5':_0x13242f;_0x38fbd9=_0x38fbd9===undefined?'1':_0x38fbd9;return this['sendRequest'](util[_0xabd4('0x2b')](_0xabd4('0x2c'),_0x4280c8,_0x13242f*0x3e8,_0x38fbd9));};AGIChannel[_0xabd4('0x25')]['noop']=function(_0x4e1200){_0x4e1200=_0x4e1200||'NO\x20MESSAGE';return this[_0xabd4('0x26')](util[_0xabd4('0x2b')](_0xabd4('0x2d'),_0x4e1200));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x2e')]=function(_0x270919,_0x3338eb){if(_[_0xabd4('0x2f')](_0x3338eb)){return this[_0xabd4('0x26')](util['format'](_0xabd4('0x30'),_0x270919,_0x3338eb['join'](',')));}return this['sendRequest'](util[_0xabd4('0x2b')](_0xabd4('0x30'),_0x270919,_0x3338eb));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x31')]=function(_0x126623){return this[_0xabd4('0x26')](util[_0xabd4('0x2b')]('SET\x20CONTEXT\x20%s',_0x126623));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x32')]=function(_0x1f9d91){return this[_0xabd4('0x26')](util['format']('SET\x20EXTENSION\x20%s',_0x1f9d91));};AGIChannel[_0xabd4('0x25')]['setPriority']=function(_0x1b456d){return this[_0xabd4('0x26')](util[_0xabd4('0x2b')](_0xabd4('0x33'),_0x1b456d));};AGIChannel[_0xabd4('0x25')][_0xabd4('0xe')]=function(){return this[_0xabd4('0x26')](_0xabd4('0x34'));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x35')]=function(_0x57674b,_0x579b93){var _0x24e469=_[_0xabd4('0x36')](_0x579b93)||_[_0xabd4('0x37')](_0x579b93)?_0x579b93['toString']():_0x579b93;return this[_0xabd4('0x26')](util[_0xabd4('0x2b')](_0xabd4('0x38'),_0x57674b,_0x24e469?_0x24e469[_0xabd4('0x39')]()[_0xabd4('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xabd4('0x3a')]=function(_0x510b66,_0x463862){return this['sendRequest'](util[_0xabd4('0x2b')](_0xabd4('0x3b'),_0x510b66,_0x463862));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x3c')]=function(_0x574e62,_0x1d8a7b){return this['sendRequest'](util[_0xabd4('0x2b')](_0xabd4('0x3d'),_0x574e62,_0x1d8a7b));};AGIChannel['prototype'][_0xabd4('0x3e')]=function(_0x4d49ce,_0x113995){return this[_0xabd4('0x26')](util[_0xabd4('0x2b')](_0xabd4('0x3f'),_0x4d49ce,_0x113995));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x40')]=function(_0x28ccfe,_0x3cf2f1,_0x2dde39){_0x3cf2f1=_0x3cf2f1||this[_0xabd4('0x41')];_0x2dde39=_0x2dde39||0x1;this[_0xabd4('0x31')](_0x28ccfe);this[_0xabd4('0x32')](_0x3cf2f1);this['setPriority'](_0x2dde39);return this[_0xabd4('0x42')](util[_0xabd4('0x2b')](_0xabd4('0x43'),_0x28ccfe,_0x3cf2f1,_0x2dde39));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x44')]=function(_0x14177c){return this[_0xabd4('0x26')](util[_0xabd4('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x14177c));};AGIChannel[_0xabd4('0x25')][_0xabd4('0x45')]=function(_0x3f7511,_0x1db495,_0x3f7bac,_0x4c94ea,_0xe08349,_0x3c42e0){_0x1db495=_0x1db495||_0xabd4('0x46');_0x3f7bac=_0x3f7bac||'';_0x4c94ea=_0x4c94ea===undefined?-0x1:_0x4c94ea==='-1'?-0x1:_0x4c94ea*0x3e8;_0xe08349=_0xe08349===undefined?'':'s='+_0xe08349;_0x3c42e0=_0x3c42e0?_0xabd4('0x47'):'';return this['sendRequest'](util[_0xabd4('0x2b')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3f7511,_0x1db495,_0x3f7bac,_0x4c94ea,_0x3c42e0,_0xe08349));};AGIChannel['prototype']['streamFile']=function(_0xf06d0b,_0xf56936){_0xf56936=_0xf56936||'';return this[_0xabd4('0x26')](util['format'](_0xabd4('0x48'),_0xf06d0b,_0xf56936));};AGIChannel['prototype'][_0xabd4('0x49')]=function(_0x35792d){return this[_0xabd4('0x2e')](_0xabd4('0x4a'),_0x35792d);};AGIChannel[_0xabd4('0x25')][_0xabd4('0x4b')]=function(_0x30cb23){return this['exec']('WAIT',_0x30cb23);};AGIChannel['prototype'][_0xabd4('0x1b')]=function(_0x40e6b0,_0x3c989e){this[_0xabd4('0x42')](util['format'](_0xabd4('0x4c'),_0x40e6b0['id'],_0x40e6b0[_0xabd4('0x4d')],_0x3c989e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xabd4('0x4e')]=AGIChannel; \ No newline at end of file +var _0x7d2a=['recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','exec','wait','WAIT','exports','util','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','pipe','command','write','destroy','prototype','sendRequest','sync','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','format','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x4c941d,_0x55096b){var _0x14d035=function(_0x3e3e2f){while(--_0x3e3e2f){_0x4c941d['push'](_0x4c941d['shift']());}};_0x14d035(++_0x55096b);}(_0x7d2a,0x171));var _0xa7d2=function(_0x2ef4eb,_0x5cc97b){_0x2ef4eb=_0x2ef4eb-0x0;var _0x1e6cae=_0x7d2a[_0x2ef4eb];return _0x1e6cae;};'use strict';var util=require(_0xa7d2('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0xa7d2('0x1')];var AGIReply=require(_0xa7d2('0x2'));var AGIError=require('./error');function AGIChannel(_0x18efe6){var _0xe4ec5c=this,_0x85249b=new AGIReply(),_0x581ad3=![],_0x4f2e92={};EventEmitter[_0xa7d2('0x3')](_0xe4ec5c);_0x18efe6[_0xa7d2('0x4')](_0xa7d2('0x5'));_0x18efe6[_0xa7d2('0x6')](0x8*0x3c*0x3c*0x3e8);_0x85249b[_0xa7d2('0x4')]('utf8');_0x85249b['on'](_0xa7d2('0x7'),function(_0xe62ddf){for(var _0x20d699 in _0xe62ddf){_0xe4ec5c[_0x20d699]=_0xe62ddf[_0x20d699];}_0xe4ec5c[_0xa7d2('0x8')](_0xa7d2('0x9'));});_0x85249b['on']('line',function(_0x5a147d){if(_0x5a147d['toLowerCase']()==_0xa7d2('0xa')){_0xe4ec5c[_0xa7d2('0x8')](_0xa7d2('0xa'));return;}if(_0x5a147d[_0xa7d2('0xb')](0x0,0xb)=='520-Invalid'){_0x581ad3=!![];}if(_0x581ad3){_0x4f2e92['rx']+=_0x5a147d+'\x0a';if(_0x5a147d['search'](_0xa7d2('0xc'))!=-0x1){_0x581ad3=![];}}else{_0x4f2e92['rx']=_0x5a147d;}if(_0x581ad3){return;}if(typeof _0x4f2e92['cb']==_0xa7d2('0xd')){var _0x3384b2=_0x4f2e92['rx'][_0xa7d2('0xb')](0x0,0x3),_0x1e453a=null,_0x48a579=null;_0x3384b2=parseInt(_0x3384b2);if(isNaN(_0x3384b2)){_0x4f2e92['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa7d2('0xe')});return;}if(_0x3384b2!=0xc8){_0x4f2e92['cb'](null,{'code':_0x3384b2,'result':-0x1,'extra':'KO'});return;}_0x1e453a=_0x4f2e92['rx']['substring'](0x4)[_0xa7d2('0xf')]('result=','');if(_0x1e453a[_0xa7d2('0x10')]('\x20')!=-0x1){_0x1e453a=_0x1e453a[_0xa7d2('0x11')](0x0,_0x1e453a[_0xa7d2('0x10')]('\x20'));}if(_[_0xa7d2('0x12')](_0x1e453a,'-1')){_0x1e453a=parseInt(_0x1e453a);}_0x48a579=_0x4f2e92['rx']['split']('\x20');if(_0x48a579['length']==0x3){_0x48a579=_0x48a579[0x2][_0xa7d2('0xb')](0x1,_0x48a579[0x2][_0xa7d2('0x13')]-0x1);}else if(_0x48a579[_0xa7d2('0x13')]>0x3){var _0x208c1d=/\((.+)\)/;var _0x8b971=_0x4f2e92['rx']['match'](_0x208c1d);if(_0x8b971){_0x48a579=_0x8b971[0x1];}else{_0x48a579=null;}}else{_0x48a579=null;}_0x4f2e92['cb'](null,{'code':_0x3384b2,'result':_0x1e453a,'extra':_0x48a579});}});_0x18efe6['on']('error',function(_0x984cb3){_0xe4ec5c[_0xa7d2('0x8')](_0xa7d2('0x14'),new AGIError(_0xa7d2('0x15'),_0x984cb3['code']));});_0x18efe6['on'](_0xa7d2('0x16'),function(){_0xe4ec5c[_0xa7d2('0x8')]('close',new AGIError(_0xa7d2('0x17')));});_0x18efe6['on'](_0xa7d2('0x18'),function(){_0xe4ec5c[_0xa7d2('0x8')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x18efe6['destroy']();});_0x18efe6[_0xa7d2('0x19')](_0x85249b);this[_0xa7d2('0x1a')]=function(_0xbd8ad1,_0x4efceb){var _0xbd8ad1=_0xbd8ad1||'',_0x4efceb=typeof _0x4efceb==_0xa7d2('0xd')?_0x4efceb:new Function();_0x4f2e92={'tx':_0xbd8ad1,'rx':'','cb':_0x4efceb};_0x18efe6[_0xa7d2('0x1b')](_0xbd8ad1+'\x0a');},this['close']=function(){_0x18efe6[_0xa7d2('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x1e')]=function(_0x2fa51d){return this[_0xa7d2('0x1a')][_0xa7d2('0x1f')](this,_0x2fa51d);};AGIChannel[_0xa7d2('0x1d')]['answer']=function(){return this[_0xa7d2('0x1e')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x5aa831,_0x510b97,_0x2d20b2){_0x5aa831=_0x5aa831===undefined?_0xa7d2('0x20'):_0x5aa831;_0x510b97=_0x510b97===undefined?'5':_0x510b97;_0x2d20b2=_0x2d20b2===undefined?'1':_0x2d20b2;return this[_0xa7d2('0x1e')](util['format'](_0xa7d2('0x21'),_0x5aa831,_0x510b97*0x3e8,_0x2d20b2));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x22')]=function(_0x141873){_0x141873=_0x141873||_0xa7d2('0x23');return this[_0xa7d2('0x1e')](util['format'](_0xa7d2('0x24'),_0x141873));};AGIChannel[_0xa7d2('0x1d')]['exec']=function(_0x439c15,_0x1620dd){if(_[_0xa7d2('0x25')](_0x1620dd)){return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x27'),_0x439c15,_0x1620dd[_0xa7d2('0x28')](',')));}return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')]('EXEC\x20%s\x20%s',_0x439c15,_0x1620dd));};AGIChannel[_0xa7d2('0x1d')]['setContext']=function(_0xe1451){return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x29'),_0xe1451));};AGIChannel[_0xa7d2('0x1d')]['setExtension']=function(_0x3a86fe){return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x2a'),_0x3a86fe));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x2b')]=function(_0xd75520){return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x2c'),_0xd75520));};AGIChannel['prototype'][_0xa7d2('0xa')]=function(){return this[_0xa7d2('0x1e')](_0xa7d2('0x2d'));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x2e')]=function(_0x1be86f,_0x3f082f){var _0x286f05=_['isBoolean'](_0x3f082f)||_[_0xa7d2('0x2f')](_0x3f082f)?_0x3f082f[_0xa7d2('0x30')]():_0x3f082f;return this['sendRequest'](util[_0xa7d2('0x26')](_0xa7d2('0x31'),_0x1be86f,_0x286f05?_0x286f05['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x32')]=function(_0x3d227f,_0x7bcc){return this['sendRequest'](util[_0xa7d2('0x26')](_0xa7d2('0x33'),_0x3d227f,_0x7bcc));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x34')]=function(_0x1e11d8,_0x19d5b4){return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x35'),_0x1e11d8,_0x19d5b4));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x36')]=function(_0x2c8005,_0x56bf0e){return this[_0xa7d2('0x1e')](util['format'](_0xa7d2('0x37'),_0x2c8005,_0x56bf0e));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x38')]=function(_0x4094cc,_0x19fb45,_0x5c747a){_0x19fb45=_0x19fb45||this[_0xa7d2('0x39')];_0x5c747a=_0x5c747a||0x1;this[_0xa7d2('0x3a')](_0x4094cc);this[_0xa7d2('0x3b')](_0x19fb45);this['setPriority'](_0x5c747a);return this[_0xa7d2('0x22')](util[_0xa7d2('0x26')](_0xa7d2('0x3c'),_0x4094cc,_0x19fb45,_0x5c747a));};AGIChannel['prototype'][_0xa7d2('0x3d')]=function(_0xe96845){return this[_0xa7d2('0x1e')](util['format'](_0xa7d2('0x3e'),_0xe96845));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x3f')]=function(_0x5b9f37,_0x285473,_0x577b3f,_0x300fa1,_0x44d83f,_0x303dd6){_0x285473=_0x285473||_0xa7d2('0x40');_0x577b3f=_0x577b3f||'';_0x300fa1=_0x300fa1===undefined?-0x1:_0x300fa1==='-1'?-0x1:_0x300fa1*0x3e8;_0x44d83f=_0x44d83f===undefined?'':'s='+_0x44d83f;_0x303dd6=_0x303dd6?_0xa7d2('0x41'):'';return this[_0xa7d2('0x1e')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5b9f37,_0x285473,_0x577b3f,_0x300fa1,_0x303dd6,_0x44d83f));};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x42')]=function(_0x5a93eb,_0x375895){_0x375895=_0x375895||'';return this[_0xa7d2('0x1e')](util[_0xa7d2('0x26')](_0xa7d2('0x43'),_0x5a93eb,_0x375895));};AGIChannel[_0xa7d2('0x1d')]['agi']=function(_0x8df9f9){return this[_0xa7d2('0x44')]('AGI',_0x8df9f9);};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x45')]=function(_0x54abb4){return this[_0xa7d2('0x44')](_0xa7d2('0x46'),_0x54abb4);};AGIChannel[_0xa7d2('0x1d')][_0xa7d2('0x14')]=function(_0x2c98ac,_0x3b2550){this[_0xa7d2('0x22')](util[_0xa7d2('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2c98ac['id'],_0x2c98ac['label'],_0x3b2550));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa7d2('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0308c1c..a2d9386 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 _0xdb3d=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','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.','Empty\x20command.'];(function(_0x588868,_0x3a7cb9){var _0x46f41d=function(_0x4cab07){while(--_0x4cab07){_0x588868['push'](_0x588868['shift']());}};_0x46f41d(++_0x3a7cb9);}(_0xdb3d,0x10d));var _0xddb3=function(_0xbe4c61,_0x24e06a){_0xbe4c61=_0xbe4c61-0x0;var _0x35076d=_0xdb3d[_0xbe4c61];return _0x35076d;};'use strict';var util=require(_0xddb3('0x0'));var error={'E_AGI_UNDEFINED':_0xddb3('0x1'),'E_AGI_ARGUMENT_PORT':_0xddb3('0x2'),'E_AGI_SERVER_ERROR':_0xddb3('0x3'),'E_AGI_SERVER_CLOSE':_0xddb3('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xddb3('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xddb3('0x6'),'E_AGI_SOCKET_ERROR':_0xddb3('0x7'),'E_AGI_SOCKET_CLOSE':_0xddb3('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xddb3('0x9'),'E_AGI_COMMAND_EMPTY':_0xddb3('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xddb3('0xb'),'E_AGI_IVR_ENTRY':_0xddb3('0xc')};function AGIError(_0x557934){var _0x557934=_0x557934||null,_0x14bd14=_0x14bd14||[],_0x67bd77=0x1,_0x3e16cb='';if(!error[_0x557934]){_0x557934=_0xddb3('0xd');}_0x14bd14[_0xddb3('0xe')](error[_0x557934]);while(arguments[_0x67bd77]){_0x14bd14[_0xddb3('0xe')](arguments[_0x67bd77]);_0x67bd77++;}_0x3e16cb=util[_0xddb3('0xf')][_0xddb3('0x10')](util,_0x14bd14);this[_0xddb3('0x11')]=_0x3e16cb;this[_0xddb3('0x12')]=_0x557934;}module[_0xddb3('0x13')]=AGIError; \ No newline at end of file +var _0x429d=['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.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','util','Undefined\x20error.'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x429d,0xdf));var _0xd429=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x429d[_0x4d8ed9];return _0x1e2140;};'use strict';var util=require(_0xd429('0x0'));var error={'E_AGI_UNDEFINED':_0xd429('0x1'),'E_AGI_ARGUMENT_PORT':_0xd429('0x2'),'E_AGI_SERVER_ERROR':_0xd429('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xd429('0x4'),'E_AGI_SOCKET_ERROR':_0xd429('0x5'),'E_AGI_SOCKET_CLOSE':_0xd429('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xd429('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd429('0x8'),'E_AGI_IVR_ENTRY':_0xd429('0x9')};function AGIError(_0x6adf88){var _0x6adf88=_0x6adf88||null,_0x82a7b2=_0x82a7b2||[],_0xc487a4=0x1,_0x5c0fe8='';if(!error[_0x6adf88]){_0x6adf88=_0xd429('0xa');}_0x82a7b2[_0xd429('0xb')](error[_0x6adf88]);while(arguments[_0xc487a4]){_0x82a7b2[_0xd429('0xb')](arguments[_0xc487a4]);_0xc487a4++;}_0x5c0fe8=util[_0xd429('0xc')]['apply'](util,_0x82a7b2);this[_0xd429('0xd')]=_0x5c0fe8;this[_0xd429('0xe')]=_0x6adf88;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index cb0cd6f..8dc9f71 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9311=['lodash','events','ioredis','./error','defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','projectUpdate','exports'];(function(_0x7c3bae,_0x2fb37d){var _0x460159=function(_0x5d7644){while(--_0x5d7644){_0x7c3bae['push'](_0x7c3bae['shift']());}};_0x460159(++_0x2fb37d);}(_0x9311,0x12c));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1931('0x0'));var EventEmitter=require(_0x1931('0x1'))['EventEmitter'];var Redis=require(_0x1931('0x2'));var AGIError=require(_0x1931('0x3'));var config=require('../../config/environment');config['redis']=_[_0x1931('0x4')](config[_0x1931('0x5')],{'host':_0x1931('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1931('0x5')]);sub[_0x1931('0x7')](_0x1931('0x8'),function(_0x8aed85){if(_0x8aed85)return eventEmitter[_0x1931('0x9')](_0x1931('0xa'),new AGIError(_0x1931('0xb'),_0x8aed85));});sub['on'](_0x1931('0xc'),function(_0xcb399e,_0x798b17){if(_0xcb399e!=='agi')return;try{var _0x42c35a=JSON['parse'](_0x798b17);eventEmitter[_0x1931('0x9')](_0x1931('0xd'),_0x42c35a);}catch(_0x4ba78f){eventEmitter['emit'](_0x1931('0xa'),new AGIError(_0x1931('0xb'),_0x4ba78f));}});module[_0x1931('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x3c74=['./error','../../config/environment','redis','defaults','localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','parse','emit','exports','lodash','events','EventEmitter','ioredis'];(function(_0x2d73db,_0x2ea491){var _0x4098b9=function(_0x4ba28a){while(--_0x4ba28a){_0x2d73db['push'](_0x2d73db['shift']());}};_0x4098b9(++_0x2ea491);}(_0x3c74,0x19c));var _0x43c7=function(_0x11e7da,_0x3a074d){_0x11e7da=_0x11e7da-0x0;var _0x53c8df=_0x3c74[_0x11e7da];return _0x53c8df;};'use strict';var _=require(_0x43c7('0x0'));var EventEmitter=require(_0x43c7('0x1'))[_0x43c7('0x2')];var Redis=require(_0x43c7('0x3'));var AGIError=require(_0x43c7('0x4'));var config=require(_0x43c7('0x5'));config[_0x43c7('0x6')]=_[_0x43c7('0x7')](config[_0x43c7('0x6')],{'host':_0x43c7('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x43c7('0x9')](_0x43c7('0xa'),function(_0x39f60c){if(_0x39f60c)return eventEmitter['emit']('error',new AGIError(_0x43c7('0xb'),_0x39f60c));});sub['on'](_0x43c7('0xc'),function(_0x5bd15f,_0x4da8f6){if(_0x5bd15f!==_0x43c7('0xa'))return;try{var _0x1c05dc=JSON[_0x43c7('0xd')](_0x4da8f6);eventEmitter[_0x43c7('0xe')]('projectUpdate',_0x1c05dc);}catch(_0x552990){eventEmitter['emit']('error',new AGIError(_0x43c7('0xb'),_0x552990));}});module[_0x43c7('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4a88033..7c06ef8 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 _0x7f34=['getdigits','getsecretdigits','vertices','numberOfEdges','addVertex','edges','prototype','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','vswitch','default','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','menu'];(function(_0x7f53f1,_0x10ec2b){var _0x5bc3ac=function(_0x85f525){while(--_0x85f525){_0x7f53f1['push'](_0x7f53f1['shift']());}};_0x5bc3ac(++_0x10ec2b);}(_0x7f34,0x1da));var _0x47f3=function(_0x4e8b4c,_0x57a8fc){_0x4e8b4c=_0x4e8b4c-0x0;var _0x55b067=_0x7f34[_0x4e8b4c];return _0x55b067;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x47f3('0x0'));var verticesWithRetry=[_0x47f3('0x1'),_0x47f3('0x2'),_0x47f3('0x3')];var Graph=function(){this[_0x47f3('0x4')]={};this['edges']={};this[_0x47f3('0x5')]=0x0;};Graph['prototype'][_0x47f3('0x6')]=function(_0x50f007){this[_0x47f3('0x4')][_0x50f007['id']]=_0x50f007;this[_0x47f3('0x7')][_0x50f007['id']]=[];};Graph[_0x47f3('0x8')]['addEdge']=function(_0x82faad,_0x314ebe,_0x16fcfd){this[_0x47f3('0x7')][_0x82faad][_0x47f3('0x9')]({'target':_0x314ebe,'condition':_0x16fcfd});this[_0x47f3('0x5')]+=0x1;};Graph[_0x47f3('0x8')]['size']=function(){return _[_0x47f3('0xa')](this['vertices']);};Graph[_0x47f3('0x8')][_0x47f3('0xb')]=function(){return this[_0x47f3('0x5')];};Graph[_0x47f3('0x8')][_0x47f3('0xc')]=function(_0x38ed74){return this[_0x47f3('0x4')][_0x38ed74];};Graph[_0x47f3('0x8')][_0x47f3('0xd')]=function(_0xc8e883,_0x1be622){if(!this['vertices'][_0xc8e883]){return logger[_0x47f3('0xe')](_0x47f3('0xf'));}var _0x546bd1=_0x1be622(this[_0x47f3('0x4')][_0xc8e883]);if(!_0x546bd1){return logger[_0x47f3('0xe')]('stop\x20traverse');}if(this[_0x47f3('0x7')][_0xc8e883][_0x47f3('0x10')]===0x0){return logger[_0x47f3('0xe')](_0x47f3('0x11'));}for(var _0x385984=0x0,_0x1be8dc=[],_0x111085=![];_0x385984\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','then','hasOwnProperty','indexOf','agi_','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','find','handleNotFound','handleUnpublished','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','listening','connection','lodash','syncho'];(function(_0x517674,_0x5f0985){var _0x3d993c=function(_0x3d1197){while(--_0x3d1197){_0x517674['push'](_0x517674['shift']());}};_0x3d993c(++_0x5f0985);}(_0x1ccc,0xd6));var _0xc1cc=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1ccc[_0x24f31b];return _0x488401;};'use strict';var _=require(_0xc1cc('0x0'));var syncho=require(_0xc1cc('0x1'));var util=require('util');var config=require(_0xc1cc('0x2'));var logger=require(_0xc1cc('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xc1cc('0x4'));var AGIEmitter=require(_0xc1cc('0x5'))[_0xc1cc('0x6')];var projects=[];config['agi']=_[_0xc1cc('0x7')](config['agi'],{'ip':_0xc1cc('0x8'),'port':0x11dd});AGIEmitter['on'](_0xc1cc('0x9'),projectUpdateHandler);function connectionHandler(_0xb1ca21){process[_0xc1cc('0xa')](function(){syncho(function(){try{setChannelVariables(_0xb1ca21);agiHandler(_0xb1ca21);}catch(_0x255b2f){logger[_0xc1cc('0xb')](_0x255b2f[_0xc1cc('0xc')]);}});});}function projectUpdateHandler(_0x7ce469){try{var _0x2657c8=_[_0xc1cc('0xd')](projects,['id',_0x7ce469['id']]);if(_0x2657c8>-0x1){if(_0x7ce469[_0xc1cc('0xe')]===!![]){projects[_0xc1cc('0xf')](_0x2657c8,0x1);}else{projects[_0x2657c8]=_0x7ce469;}}else{projects[_0xc1cc('0x10')](_0x7ce469);}}catch(_0x13f3ee){logger[_0xc1cc('0xb')](_0x13f3ee[_0xc1cc('0xc')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xc1cc('0x11')]);logger['info'](util[_0xc1cc('0x12')](_0xc1cc('0x13'),config[_0xc1cc('0x14')]['ip'],config[_0xc1cc('0x14')][_0xc1cc('0x11')]));}function errorHandler(_0x380336){if(_0x380336&&_0x380336[_0xc1cc('0x15')]&&_0x380336[_0xc1cc('0x16')]){logger[_0xc1cc('0xb')](util[_0xc1cc('0x12')]('[%s]\x20%s',_0x380336[_0xc1cc('0x15')],_0x380336[_0xc1cc('0x16')]));}else{logger['error'](util['format'](_0xc1cc('0x17'),_0x380336[_0xc1cc('0xc')]));}}function closeHandler(){logger[_0xc1cc('0x18')](util[_0xc1cc('0x12')](_0xc1cc('0x19'),this[_0xc1cc('0x1a')],this[_0xc1cc('0x1b')],this[_0xc1cc('0x1c')],this[_0xc1cc('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x298594){logger['error'](_0x298594[_0xc1cc('0xc')]);}}function timeoutHandler(){logger[_0xc1cc('0x18')](util[_0xc1cc('0x12')](_0xc1cc('0x1e'),this[_0xc1cc('0x1a')],this['calleridname'],this[_0xc1cc('0x1c')],this[_0xc1cc('0x1d')],this[_0xc1cc('0x1f')]));}function hangupHandler(){logger['info'](util[_0xc1cc('0x12')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc1cc('0x1a')],this[_0xc1cc('0x1b')],this[_0xc1cc('0x1c')],this[_0xc1cc('0x1d')],this[_0xc1cc('0x1f')]));this['evtHangup']=!![];}function createSquareReport(_0x44292c,_0x1d6852){rpc['createSquareReport'](_0x44292c)[_0xc1cc('0x20')](function(_0x44c87e){if(_0x1d6852){_0x1d6852(null,_0x44c87e);}})['catch'](function(_0x540fc6){if(_0x1d6852){_0x1d6852(null,_0x540fc6);}});}function setChannelVariables(_0xfeac8c){for(var _0x41c191 in _0xfeac8c){if(_0xfeac8c[_0xc1cc('0x21')](_0x41c191)){if(_0x41c191[_0xc1cc('0x22')](_0xc1cc('0x23'))===0x0){_0xfeac8c[_0x41c191['substring'](0x4)]=_0xfeac8c[_0x41c191];delete _0xfeac8c[_0x41c191];}}}}function agiHandler(_0x3389c8){logger[_0xc1cc('0x24')](_0xc1cc('0x25'),JSON['stringify'](_0x3389c8,null,0x2));logger[_0xc1cc('0x18')](util[_0xc1cc('0x12')](_0xc1cc('0x26'),_0x3389c8['arg_1'],_0x3389c8['calleridname'],_0x3389c8[_0xc1cc('0x1c')],_0x3389c8[_0xc1cc('0x1d')],_0x3389c8[_0xc1cc('0x1f')]));_0x3389c8['on'](_0xc1cc('0xb'),errorHandler);_0x3389c8['on'](_0xc1cc('0x27'),closeHandler);_0x3389c8['on'](_0xc1cc('0x28'),timeoutHandler);_0x3389c8[_0xc1cc('0x29')]=![];_0x3389c8['on'](_0xc1cc('0x2a'),hangupHandler);var _0x5cca23=_[_0xc1cc('0x2b')](projects,[_0xc1cc('0x15'),_0x3389c8['arg_1']]);if(!_0x5cca23)return Project[_0xc1cc('0x2c')](_0x3389c8);if(!_0x5cca23['production'])return Project[_0xc1cc('0x2d')](_0x3389c8);return Project['initialize'](_0x5cca23,_0x3389c8);}function main(){var _0x55208b;return utilLicense['getLicense']()[_0xc1cc('0x20')](function(_0x4f2dc2){if(!_0x4f2dc2)return;if(_0x4f2dc2[_0xc1cc('0x2e')]){if(_0x4f2dc2['callysquare']&&_0x4f2dc2['callysquare']>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x4f2dc2[_0xc1cc('0x2f')]));_0x55208b=_0x4f2dc2[_0xc1cc('0x2f')];}else{logger[_0xc1cc('0x18')](_0xc1cc('0x30'));}}else{logger['info'](_0xc1cc('0x31'));_0x55208b=-0x1;}})[_0xc1cc('0x20')](function(){return Project[_0xc1cc('0x32')]();})[_0xc1cc('0x20')](function(_0x49402d){projects=_0x49402d;return;})['catch'](function(_0x295701){logger['error']('[LICENSE]',_0x295701[_0xc1cc('0xc')]);})[_0xc1cc('0x33')](function(){var _0x385592=require('./server')(config[_0xc1cc('0x14')][_0xc1cc('0x11')],config[_0xc1cc('0x14')]['ip'],_0x55208b);_0x385592['on'](_0xc1cc('0xb'),errorHandler);_0x385592['on'](_0xc1cc('0x34'),listeningHandler);_0x385592['on'](_0xc1cc('0x35'),connectionHandler);_0x385592['on'](_0xc1cc('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0x71a1=['Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','finally','./server','connection','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x71a1,0xdf));var _0x171a=function(_0x5d2ce8,_0x3834d6){_0x5d2ce8=_0x5d2ce8-0x0;var _0x42ec53=_0x71a1[_0x5d2ce8];return _0x42ec53;};'use strict';var _=require('lodash');var syncho=require(_0x171a('0x0'));var util=require(_0x171a('0x1'));var config=require(_0x171a('0x2'));var logger=require(_0x171a('0x3'))(_0x171a('0x4'));var utilLicense=require(_0x171a('0x5'));var rpc=require(_0x171a('0x6'));var Project=require(_0x171a('0x7'));var AGIEmitter=require(_0x171a('0x8'))[_0x171a('0x9')];var projects=[];config['agi']=_[_0x171a('0xa')](config['agi'],{'ip':_0x171a('0xb'),'port':0x11dd});AGIEmitter['on'](_0x171a('0xc'),projectUpdateHandler);function connectionHandler(_0x2b5781){process[_0x171a('0xd')](function(){syncho(function(){try{setChannelVariables(_0x2b5781);agiHandler(_0x2b5781);}catch(_0x3eb6c5){logger[_0x171a('0xe')](_0x3eb6c5[_0x171a('0xf')]);}});});}function projectUpdateHandler(_0x334a56){try{var _0xd85827=_[_0x171a('0x10')](projects,['id',_0x334a56['id']]);if(_0xd85827>-0x1){if(_0x334a56[_0x171a('0x11')]===!![]){projects[_0x171a('0x12')](_0xd85827,0x1);}else{projects[_0xd85827]=_0x334a56;}}else{projects[_0x171a('0x13')](_0x334a56);}}catch(_0x53cf38){logger[_0x171a('0xe')](_0x53cf38[_0x171a('0xf')]);}}function listeningHandler(){console[_0x171a('0x14')](_0x171a('0x15'),config[_0x171a('0x4')]['port']);logger[_0x171a('0x16')](util[_0x171a('0x17')](_0x171a('0x18'),config[_0x171a('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x5156f3){if(_0x5156f3&&_0x5156f3[_0x171a('0x19')]&&_0x5156f3['message']){logger[_0x171a('0xe')](util['format'](_0x171a('0x1a'),_0x5156f3['name'],_0x5156f3['message']));}else{logger[_0x171a('0xe')](util[_0x171a('0x17')](_0x171a('0x1b'),_0x5156f3[_0x171a('0xf')]));}}function closeHandler(){logger[_0x171a('0x16')](util[_0x171a('0x17')](_0x171a('0x1c'),this[_0x171a('0x1d')],this[_0x171a('0x1e')],this['callerid'],this[_0x171a('0x1f')],this[_0x171a('0x20')]));try{createSquareReport(this);}catch(_0x303281){logger['error'](_0x303281[_0x171a('0xf')]);}}function timeoutHandler(){logger[_0x171a('0x16')](util[_0x171a('0x17')](_0x171a('0x21'),this[_0x171a('0x1d')],this['calleridname'],this[_0x171a('0x22')],this[_0x171a('0x1f')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0x171a('0x23'),this['arg_1'],this['calleridname'],this[_0x171a('0x22')],this[_0x171a('0x1f')],this['uniqueid']));this[_0x171a('0x24')]=!![];}function createSquareReport(_0x231c1a,_0x172ef9){rpc[_0x171a('0x25')](_0x231c1a)[_0x171a('0x26')](function(_0x3d9efe){if(_0x172ef9){_0x172ef9(null,_0x3d9efe);}})['catch'](function(_0x58896e){if(_0x172ef9){_0x172ef9(null,_0x58896e);}});}function setChannelVariables(_0x575b41){for(var _0x592d1b in _0x575b41){if(_0x575b41[_0x171a('0x27')](_0x592d1b)){if(_0x592d1b[_0x171a('0x28')](_0x171a('0x29'))===0x0){_0x575b41[_0x592d1b[_0x171a('0x2a')](0x4)]=_0x575b41[_0x592d1b];delete _0x575b41[_0x592d1b];}}}}function agiHandler(_0x55fd4f){logger['debug'](_0x171a('0x2b'),JSON[_0x171a('0x2c')](_0x55fd4f,null,0x2));logger[_0x171a('0x16')](util[_0x171a('0x17')](_0x171a('0x2d'),_0x55fd4f['arg_1'],_0x55fd4f['calleridname'],_0x55fd4f[_0x171a('0x22')],_0x55fd4f[_0x171a('0x1f')],_0x55fd4f[_0x171a('0x20')]));_0x55fd4f['on'](_0x171a('0xe'),errorHandler);_0x55fd4f['on'](_0x171a('0x2e'),closeHandler);_0x55fd4f['on']('timeout',timeoutHandler);_0x55fd4f[_0x171a('0x24')]=![];_0x55fd4f['on'](_0x171a('0x2f'),hangupHandler);var _0x5e682c=_[_0x171a('0x30')](projects,[_0x171a('0x19'),_0x55fd4f[_0x171a('0x1d')]]);if(!_0x5e682c)return Project[_0x171a('0x31')](_0x55fd4f);if(!_0x5e682c['production'])return Project['handleUnpublished'](_0x55fd4f);return Project[_0x171a('0x32')](_0x5e682c,_0x55fd4f);}function main(){var _0x2211f8;return utilLicense[_0x171a('0x33')]()[_0x171a('0x26')](function(_0xf83d25){if(!_0xf83d25)return;if(_0xf83d25['voice']){if(_0xf83d25[_0x171a('0x34')]&&_0xf83d25[_0x171a('0x34')]>0x0){logger['info'](util[_0x171a('0x17')](_0x171a('0x35'),_0xf83d25['callysquare']));_0x2211f8=_0xf83d25[_0x171a('0x34')];}else{logger[_0x171a('0x16')](_0x171a('0x36'));}}else{logger[_0x171a('0x16')](_0x171a('0x37'));_0x2211f8=-0x1;}})['then'](function(){return Project['getAll']();})[_0x171a('0x26')](function(_0x2ced8f){projects=_0x2ced8f;return;})[_0x171a('0x38')](function(_0x10c188){logger[_0x171a('0xe')](_0x171a('0x39'),_0x10c188[_0x171a('0xf')]);})[_0x171a('0x3a')](function(){var _0x343f93=require(_0x171a('0x3b'))(config[_0x171a('0x4')]['port'],config['agi']['ip'],_0x2211f8);_0x343f93['on'](_0x171a('0xe'),errorHandler);_0x343f93['on']('listening',listeningHandler);_0x343f93['on'](_0x171a('0x3c'),connectionHandler);_0x343f93['on'](_0x171a('0x2e'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index f680efa..4d136b3 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 _0x1467=['SendMail','bluebird','jayson/promise','client','http','request','error','result','sendMailMessage'];(function(_0x366aed,_0x2d9f39){var _0xbed0e2=function(_0xce5ba){while(--_0xce5ba){_0x366aed['push'](_0x366aed['shift']());}};_0xbed0e2(++_0x2d9f39);}(_0x1467,0x6d));var _0x7146=function(_0x41d552,_0x1e59db){_0x41d552=_0x41d552-0x0;var _0x45d056=_0x1467[_0x41d552];return _0x45d056;};'use strict';var BPromise=require(_0x7146('0x0'));var jayson=require(_0x7146('0x1'));var client=jayson[_0x7146('0x2')][_0x7146('0x3')]({'port':0x232b});function request(_0xbf720d,_0x4418ac){return new BPromise(function(_0x433ade,_0x119e4e){return client[_0x7146('0x4')](_0xbf720d,_0x4418ac)['then'](function(_0x468703){if(_0x468703[_0x7146('0x5')]){return _0x119e4e(_0x468703[_0x7146('0x5')]['message']);}else{return _0x433ade(_0x468703[_0x7146('0x6')]);}})['catch'](function(_0x2b5e41){return _0x119e4e(_0x2b5e41);});});}exports[_0x7146('0x7')]=function(_0x545b27,_0x3d4415){return request(_0x7146('0x8'),{'account':_0x545b27,'message':_0x3d4415});}; \ No newline at end of file +var _0xb6cf=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','catch'];(function(_0x24fe97,_0x1046bb){var _0xa59b94=function(_0x3bfffa){while(--_0x3bfffa){_0x24fe97['push'](_0x24fe97['shift']());}};_0xa59b94(++_0x1046bb);}(_0xb6cf,0x136));var _0xfb6c=function(_0x35cc99,_0x5bb972){_0x35cc99=_0x35cc99-0x0;var _0x14373c=_0xb6cf[_0x35cc99];return _0x14373c;};'use strict';var BPromise=require(_0xfb6c('0x0'));var jayson=require(_0xfb6c('0x1'));var client=jayson[_0xfb6c('0x2')][_0xfb6c('0x3')]({'port':0x232b});function request(_0x46cfb8,_0x4bdd1f){return new BPromise(function(_0x3ce855,_0x36b2a6){return client[_0xfb6c('0x4')](_0x46cfb8,_0x4bdd1f)[_0xfb6c('0x5')](function(_0x3c7994){if(_0x3c7994[_0xfb6c('0x6')]){return _0x36b2a6(_0x3c7994['error'][_0xfb6c('0x7')]);}else{return _0x3ce855(_0x3c7994['result']);}})[_0xfb6c('0x8')](function(_0xa2efac){return _0x36b2a6(_0xa2efac);});});}exports[_0xfb6c('0x9')]=function(_0x41c8b7,_0x216d0a){return request(_0xfb6c('0xa'),{'account':_0x41c8b7,'message':_0x216d0a});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 315dc28..544128b 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8574=['continueAt','exports','moment','xml2json','util','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','target','value','toJson','root','production','start','debug','stringify','joinAt','format','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','info','context','extension','priority','response','code','result','evtHangup','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20published'];(function(_0x394829,_0x3e1716){var _0xe30362=function(_0x59b178){while(--_0x59b178){_0x394829['push'](_0x394829['shift']());}};_0xe30362(++_0x3e1716);}(_0x8574,0x129));var _0x4857=function(_0x50c16c,_0x43b99e){_0x50c16c=_0x50c16c-0x0;var _0x24dc5f=_0x8574[_0x50c16c];return _0x24dc5f;};'use strict';var _=require('lodash');var moment=require(_0x4857('0x0'));var parser=require(_0x4857('0x1'));var util=require(_0x4857('0x2'));var logger=require('../../config/logger')(_0x4857('0x3'));var rpc=require(_0x4857('0x4'));var mailRpc=require(_0x4857('0x5'));var Graph=require('./graph');var Vertices=require(_0x4857('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4857('0x7')]()[_0x4857('0x8')](function(_0x54b043){logger[_0x4857('0x9')](_0x4857('0xa'),_0x54b043[_0x4857('0xb')]);return[];});}function addVertex(_0x30db1b,_0x1811b5,_0x103752){_0x1811b5[_0x4857('0xc')]=_0x103752;if(_0x1811b5[_0x4857('0xd')](_0x4857('0xe'))){_0x1811b5[_0x4857('0xf')]=parseInt(_0x1811b5['retry'],0xa);}_0x30db1b[_0x4857('0x10')](_['omit'](_0x1811b5,_0x4857('0x11')));}function initGraph(_0x1dea72,_0x242114){var _0x526445=new Graph();for(var _0x53b3ec in _0x1dea72){if(_0x1dea72[_0x4857('0xd')](_0x53b3ec)){if(_[_0x4857('0x12')](_0x1dea72[_0x53b3ec])){for(var _0x53b1ad=0x0;_0x53b1ad<_0x1dea72[_0x53b3ec][_0x4857('0x13')];_0x53b1ad+=0x1){addVertex(_0x526445,_0x1dea72[_0x53b3ec][_0x53b1ad],_0x53b3ec);}}else{addVertex(_0x526445,_0x1dea72[_0x53b3ec],_0x53b3ec);}}}for(var _0x327f9b=0x0;_0x327f9b<_0x242114[_0x4857('0x13')];_0x327f9b+=0x1){if(_0x242114[_0x327f9b]['source']&&_0x242114[_0x327f9b][_0x4857('0x14')]){_0x526445['addEdge'](_0x242114[_0x327f9b]['source'],_0x242114[_0x327f9b][_0x4857('0x14')],_0x242114[_0x327f9b][_0x4857('0x15')]);}}return _0x526445;}function getRoot(_0x1af39d){return parser[_0x4857('0x16')](_0x1af39d,{'object':!![]})['mxGraphModel'][_0x4857('0x17')];}function inspect(_0x27d420){return util['inspect'](_0x27d420,{'showHidden':![],'depth':null});}function initialize(_0x34579a,_0x126444){var _0x16ce3a=getRoot(_0x34579a[_0x4857('0x18')]);if(!_0x16ce3a||!_0x16ce3a[_0x4857('0x19')])return;var _0x5de386,_0x5a3a15,_0x57037e;logger[_0x4857('0x1a')]('root',JSON[_0x4857('0x1b')](_0x16ce3a,null,0x2));_0x126444[_0x4857('0x1c')]=moment()[_0x4857('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5de386=initGraph(_[_0x4857('0x1e')](_0x16ce3a,_0x4857('0x11')),_0x16ce3a[_0x4857('0x11')]);_0x5a3a15=new Vertices(_0x126444,rpc,mailRpc);logger['info'](util[_0x4857('0x1d')](_0x4857('0x1f'),_0x126444[_0x4857('0x20')],_0x126444[_0x4857('0x21')],_0x126444[_0x4857('0x22')],_0x126444[_0x4857('0x23')],_0x126444[_0x4857('0x24')]));_0x5de386[_0x4857('0x25')](_0x16ce3a[_0x4857('0x19')]['id'],function(_0x19c5bb){try{_0x19c5bb=_0x5a3a15[_0x4857('0x26')](_0x19c5bb);logger[_0x4857('0x1a')](_0x4857('0x27'),JSON['stringify'](_0x19c5bb,null,0x2));if(_0x19c5bb[_0x4857('0xc')]===_0x4857('0x28')){logger[_0x4857('0x29')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x126444[_0x4857('0x2a')]=_0x19c5bb[_0x4857('0x2a')]||_0x126444[_0x4857('0x2a')];_0x126444[_0x4857('0x2b')]=_0x19c5bb['extension'];_0x126444[_0x4857('0x2c')]=_0x19c5bb['priority']?_0x19c5bb[_0x4857('0x2c')]-0x1:0x1;return null;}else if(_0x19c5bb&&_0x5a3a15[_0x19c5bb[_0x4857('0xc')]]){_0x57037e=_0x5a3a15[_0x19c5bb[_0x4857('0xc')]](_0x19c5bb);logger[_0x4857('0x29')](_0x4857('0x2d'),JSON['stringify'](_0x57037e,null,0x2));if(_0x57037e&&_0x57037e[_0x4857('0x2e')]===AGI_CODE_SUCCESS&&_0x57037e[_0x4857('0x2f')]!==AGI_RESULT_ERROR&&!_0x126444[_0x4857('0x30')]){logger[_0x4857('0x1a')](_0x4857('0x2d'),inspect(_0x57037e));return _['isUndefined'](_0x57037e[_0x4857('0x2f')])?null:_0x57037e['result'][_0x4857('0x31')]();}else{logger['error'](_0x4857('0x2d'),inspect(_0x57037e));return null;}}else{logger[_0x4857('0x9')](_0x4857('0x32'));return null;}}catch(_0x40886e){logger[_0x4857('0x9')](_0x40886e[_0x4857('0xb')]);return null;}});if(_0x16ce3a[_0x4857('0x33')]){logger[_0x4857('0x29')](util['format'](_0x4857('0x34'),_0x126444[_0x4857('0x20')],_0x126444[_0x4857('0x21')],_0x126444[_0x4857('0x22')],_0x126444['dnid'],_0x126444[_0x4857('0x24')]));_0x5de386[_0x4857('0x25')](_0x16ce3a[_0x4857('0x33')]['id'],function(_0xa75b45){try{_0xa75b45=_0x5a3a15['clear'](_0xa75b45);logger[_0x4857('0x1a')](_0x4857('0x27'),JSON['stringify'](_0xa75b45,null,0x2));if(_0xa75b45&&_0x5a3a15[_0xa75b45[_0x4857('0xc')]]){_0x57037e=_0x5a3a15[_0xa75b45['agicommand']](_0xa75b45);if(_0x57037e){logger[_0x4857('0x1a')](_0x4857('0x2d'),inspect(_0x57037e));return _[_0x4857('0x35')](_0x57037e[_0x4857('0x2f')])?null:_0x57037e['result'][_0x4857('0x31')]();}else{logger[_0x4857('0x9')](_0x4857('0x2d'),inspect(_0x57037e));return null;}}else{logger[_0x4857('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0xcc6dc0){logger[_0x4857('0x9')](_0xcc6dc0[_0x4857('0xb')]);return null;}});}logger[_0x4857('0x29')](util[_0x4857('0x1d')](_0x4857('0x36'),_0x126444[_0x4857('0x20')],_0x126444[_0x4857('0x21')],_0x126444[_0x4857('0x22')],_0x126444[_0x4857('0x23')],_0x126444['uniqueid']));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x126444[_0x4857('0x2a')],_0x126444['extension'],parseInt(_0x126444[_0x4857('0x2c')],0xa)+0x1));_0x126444['continueAt'](_0x126444[_0x4857('0x2a')],_0x126444['extension'],parseInt(_0x126444[_0x4857('0x2c')],0xa)+0x1);_0x126444[_0x4857('0x37')]();}function handleNotFound(_0x4ad2eb){logger[_0x4857('0x9')](util[_0x4857('0x1d')]('Project\x20%s\x20not\x20found',_0x4ad2eb[_0x4857('0x20')]));_0x4ad2eb['continueAt'](_0x4ad2eb[_0x4857('0x2a')],_0x4ad2eb[_0x4857('0x2b')],parseInt(_0x4ad2eb['priority'],0xa)+0x1);_0x4ad2eb['close']();}function handleUnpublished(_0xf4e600){logger[_0x4857('0x9')](util[_0x4857('0x1d')](_0x4857('0x38'),_0xf4e600[_0x4857('0x20')]));_0xf4e600[_0x4857('0x39')](_0xf4e600[_0x4857('0x2a')],_0xf4e600[_0x4857('0x2b')],parseInt(_0xf4e600[_0x4857('0x2c')],0xa)+0x1);_0xf4e600[_0x4857('0x37')]();}module[_0x4857('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x9b0b=['gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','clear','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','addEdge','source','target','toJson','mxGraphModel','inspect','start','root','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','traverseBFS','debug','vertex','stringify','gotoc'];(function(_0x21474c,_0x1b3a5d){var _0x1afa5e=function(_0x21aead){while(--_0x21aead){_0x21474c['push'](_0x21474c['shift']());}};_0x1afa5e(++_0x1b3a5d);}(_0x9b0b,0x117));var _0xb9b0=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x9b0b[_0x289891];return _0x31cf2e;};'use strict';var _=require(_0xb9b0('0x0'));var moment=require(_0xb9b0('0x1'));var parser=require(_0xb9b0('0x2'));var util=require(_0xb9b0('0x3'));var logger=require(_0xb9b0('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0xb9b0('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb9b0('0x6')]()[_0xb9b0('0x7')](function(_0x2f9e02){logger[_0xb9b0('0x8')](_0xb9b0('0x9'),_0x2f9e02[_0xb9b0('0xa')]);return[];});}function addVertex(_0x2c2e8f,_0x3895b0,_0x45547a){_0x3895b0[_0xb9b0('0xb')]=_0x45547a;if(_0x3895b0[_0xb9b0('0xc')](_0xb9b0('0xd'))){_0x3895b0[_0xb9b0('0xe')]=parseInt(_0x3895b0[_0xb9b0('0xd')],0xa);}_0x2c2e8f[_0xb9b0('0xf')](_[_0xb9b0('0x10')](_0x3895b0,_0xb9b0('0x11')));}function initGraph(_0x298a98,_0x686937){var _0x527ede=new Graph();for(var _0xe2793e in _0x298a98){if(_0x298a98[_0xb9b0('0xc')](_0xe2793e)){if(_[_0xb9b0('0x12')](_0x298a98[_0xe2793e])){for(var _0x1556da=0x0;_0x1556da<_0x298a98[_0xe2793e][_0xb9b0('0x13')];_0x1556da+=0x1){addVertex(_0x527ede,_0x298a98[_0xe2793e][_0x1556da],_0xe2793e);}}else{addVertex(_0x527ede,_0x298a98[_0xe2793e],_0xe2793e);}}}for(var _0x286091=0x0;_0x286091<_0x686937[_0xb9b0('0x13')];_0x286091+=0x1){if(_0x686937[_0x286091]['source']&&_0x686937[_0x286091]['target']){_0x527ede[_0xb9b0('0x14')](_0x686937[_0x286091][_0xb9b0('0x15')],_0x686937[_0x286091][_0xb9b0('0x16')],_0x686937[_0x286091]['value']);}}return _0x527ede;}function getRoot(_0x511d2c){return parser[_0xb9b0('0x17')](_0x511d2c,{'object':!![]})[_0xb9b0('0x18')]['root'];}function inspect(_0x42cc8f){return util[_0xb9b0('0x19')](_0x42cc8f,{'showHidden':![],'depth':null});}function initialize(_0xf00d3b,_0x5013e0){var _0x50aa57=getRoot(_0xf00d3b['production']);if(!_0x50aa57||!_0x50aa57[_0xb9b0('0x1a')])return;var _0x31621d,_0x289a52,_0x568383;logger['debug'](_0xb9b0('0x1b'),JSON['stringify'](_0x50aa57,null,0x2));_0x5013e0[_0xb9b0('0x1c')]=moment()[_0xb9b0('0x1d')](_0xb9b0('0x1e'));_0x31621d=initGraph(_[_0xb9b0('0x10')](_0x50aa57,_0xb9b0('0x11')),_0x50aa57[_0xb9b0('0x11')]);_0x289a52=new Vertices(_0x5013e0,rpc,mailRpc);logger[_0xb9b0('0x1f')](util[_0xb9b0('0x1d')](_0xb9b0('0x20'),_0x5013e0[_0xb9b0('0x21')],_0x5013e0[_0xb9b0('0x22')],_0x5013e0['callerid'],_0x5013e0['dnid'],_0x5013e0[_0xb9b0('0x23')]));_0x31621d[_0xb9b0('0x24')](_0x50aa57[_0xb9b0('0x1a')]['id'],function(_0x48288d){try{_0x48288d=_0x289a52['clear'](_0x48288d);logger[_0xb9b0('0x25')](_0xb9b0('0x26'),JSON[_0xb9b0('0x27')](_0x48288d,null,0x2));if(_0x48288d[_0xb9b0('0xb')]===_0xb9b0('0x28')){logger['info'](_0xb9b0('0x29'));_0x5013e0[_0xb9b0('0x2a')]=_0x48288d[_0xb9b0('0x2a')]||_0x5013e0[_0xb9b0('0x2a')];_0x5013e0[_0xb9b0('0x2b')]=_0x48288d[_0xb9b0('0x2b')];_0x5013e0[_0xb9b0('0x2c')]=_0x48288d[_0xb9b0('0x2c')]?_0x48288d[_0xb9b0('0x2c')]-0x1:0x1;return null;}else if(_0x48288d&&_0x289a52[_0x48288d['agicommand']]){_0x568383=_0x289a52[_0x48288d[_0xb9b0('0xb')]](_0x48288d);logger[_0xb9b0('0x1f')](_0xb9b0('0x2d'),JSON[_0xb9b0('0x27')](_0x568383,null,0x2));if(_0x568383&&_0x568383[_0xb9b0('0x2e')]===AGI_CODE_SUCCESS&&_0x568383[_0xb9b0('0x2f')]!==AGI_RESULT_ERROR&&!_0x5013e0[_0xb9b0('0x30')]){logger[_0xb9b0('0x25')](_0xb9b0('0x2d'),inspect(_0x568383));return _[_0xb9b0('0x31')](_0x568383[_0xb9b0('0x2f')])?null:_0x568383[_0xb9b0('0x2f')][_0xb9b0('0x32')]();}else{logger['error'](_0xb9b0('0x2d'),inspect(_0x568383));return null;}}else{logger[_0xb9b0('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x318acb){logger[_0xb9b0('0x8')](_0x318acb[_0xb9b0('0xa')]);return null;}});if(_0x50aa57[_0xb9b0('0x33')]){logger[_0xb9b0('0x1f')](util['format'](_0xb9b0('0x34'),_0x5013e0[_0xb9b0('0x21')],_0x5013e0[_0xb9b0('0x22')],_0x5013e0['callerid'],_0x5013e0[_0xb9b0('0x35')],_0x5013e0[_0xb9b0('0x23')]));_0x31621d[_0xb9b0('0x24')](_0x50aa57[_0xb9b0('0x33')]['id'],function(_0x59991c){try{_0x59991c=_0x289a52[_0xb9b0('0x36')](_0x59991c);logger[_0xb9b0('0x25')]('vertex',JSON[_0xb9b0('0x27')](_0x59991c,null,0x2));if(_0x59991c&&_0x289a52[_0x59991c['agicommand']]){_0x568383=_0x289a52[_0x59991c[_0xb9b0('0xb')]](_0x59991c);if(_0x568383){logger[_0xb9b0('0x25')](_0xb9b0('0x2d'),inspect(_0x568383));return _['isUndefined'](_0x568383[_0xb9b0('0x2f')])?null:_0x568383['result'][_0xb9b0('0x32')]();}else{logger[_0xb9b0('0x8')]('response',inspect(_0x568383));return null;}}else{logger[_0xb9b0('0x8')](_0xb9b0('0x37'));return null;}}catch(_0x253e3e){logger[_0xb9b0('0x8')](_0x253e3e[_0xb9b0('0xa')]);return null;}});}logger[_0xb9b0('0x1f')](util['format'](_0xb9b0('0x38'),_0x5013e0[_0xb9b0('0x21')],_0x5013e0[_0xb9b0('0x22')],_0x5013e0[_0xb9b0('0x39')],_0x5013e0[_0xb9b0('0x35')],_0x5013e0[_0xb9b0('0x23')]));logger['info'](util['format'](_0xb9b0('0x3a'),_0x5013e0[_0xb9b0('0x2a')],_0x5013e0[_0xb9b0('0x2b')],parseInt(_0x5013e0['priority'],0xa)+0x1));_0x5013e0['continueAt'](_0x5013e0['context'],_0x5013e0['extension'],parseInt(_0x5013e0[_0xb9b0('0x2c')],0xa)+0x1);_0x5013e0[_0xb9b0('0x3b')]();}function handleNotFound(_0x1c2524){logger[_0xb9b0('0x8')](util['format'](_0xb9b0('0x3c'),_0x1c2524['arg_1']));_0x1c2524[_0xb9b0('0x3d')](_0x1c2524['context'],_0x1c2524[_0xb9b0('0x2b')],parseInt(_0x1c2524['priority'],0xa)+0x1);_0x1c2524[_0xb9b0('0x3b')]();}function handleUnpublished(_0x32323c){logger[_0xb9b0('0x8')](util[_0xb9b0('0x1d')](_0xb9b0('0x3e'),_0x32323c[_0xb9b0('0x21')]));_0x32323c['continueAt'](_0x32323c[_0xb9b0('0x2a')],_0x32323c[_0xb9b0('0x2b')],parseInt(_0x32323c[_0xb9b0('0x2c')],0xa)+0x1);_0x32323c[_0xb9b0('0x3b')]();}module[_0xb9b0('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 253729f..cdc6872 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 _0x9edf=['\x0d\x0a\x0d\x0a','indexOf','substring','split','trim','slice','length','emit','headers','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x46517a,_0x397b1d){var _0x330c0c=function(_0x12a2c4){while(--_0x12a2c4){_0x46517a['push'](_0x46517a['shift']());}};_0x330c0c(++_0x397b1d);}(_0x9edf,0x15d));var _0xf9ed=function(_0x3e6ad4,_0x28dff0){_0x3e6ad4=_0x3e6ad4-0x0;var _0x11e77e=_0x9edf[_0x3e6ad4];return _0x11e77e;};'use strict';var util=require(_0xf9ed('0x0'));var Transform=require('stream')[_0xf9ed('0x1')];function AGIReply(_0x37bebd){Transform[_0xf9ed('0x2')](this,_0x37bebd);this[_0xf9ed('0x3')]='';this[_0xf9ed('0x4')]=![];}util[_0xf9ed('0x5')](AGIReply,Transform);AGIReply[_0xf9ed('0x6')][_0xf9ed('0x7')]=function(_0x59fb82,_0x29706a,_0x3bf928){var _0x47d897='\x0a',_0xfb97de=['\x0a\x0a',_0xf9ed('0x8')],_0xc2d5e6=-0x1,_0x4dac0e=-0x1,_0x57ddde='',_0x56b4fb=0x0,_0x53d10b='',_0x4bc2b9='';this['_localBuffer']+=_0x59fb82['toString']();_0x53d10b=this[_0xf9ed('0x3')];if(!this[_0xf9ed('0x4')]){_0x56b4fb=0x0;while(_0xfb97de[_0x56b4fb]){while((_0x4dac0e=_0x53d10b[_0xf9ed('0x9')](_0xfb97de[_0x56b4fb]))!=-0x1){_0x57ddde=_0xfb97de[_0x56b4fb];_0x4bc2b9=_0x53d10b[_0xf9ed('0xa')](0x0,_0x4dac0e);_0x53d10b=_0x53d10b[_0xf9ed('0xa')](_0x4dac0e+_0x57ddde['length']);var _0x25170f=_0x4bc2b9[_0xf9ed('0xb')](_0x47d897),_0x21d2f1=0x0,_0x51313d={},_0x1c2f84='',_0x4280eb='',_0x4e226a=-0x1;while(_0x25170f[_0x21d2f1]){_0x4e226a=_0x25170f[_0x21d2f1]['indexOf'](':');if(_0x4e226a!=-0x1){_0x1c2f84=_0x25170f[_0x21d2f1]['slice'](0x0,_0x4e226a)[_0xf9ed('0xc')]();_0x4280eb=_0x25170f[_0x21d2f1][_0xf9ed('0xd')](_0x4e226a+0x1)[_0xf9ed('0xc')]();if(_0x1c2f84[_0xf9ed('0xe')]>0x0){_0x51313d[_0x1c2f84]=_0x4280eb;}}else{}_0x21d2f1++;}this[_0xf9ed('0xf')](_0xf9ed('0x10'),_0x51313d);this[_0xf9ed('0x4')]=!![];}_0x56b4fb++;}this[_0xf9ed('0x3')]=_0x53d10b;}else{while((_0xc2d5e6=_0x53d10b[_0xf9ed('0x9')](_0x47d897))!=-0x1){_0x4bc2b9=_0x53d10b['substring'](0x0,_0xc2d5e6);this[_0xf9ed('0xf')]('line',_0x4bc2b9);_0x53d10b=_0x53d10b[_0xf9ed('0xa')](_0xc2d5e6+_0x47d897[_0xf9ed('0xe')]);}this[_0xf9ed('0x3')]=_0x53d10b;}_0x3bf928();};module['exports']=AGIReply; \ No newline at end of file +var _0xd93e=['split','slice','trim','emit','headers','indexOf','line','util','stream','Transform','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','substring','length'];(function(_0x5c8cce,_0xa74d77){var _0x16bd91=function(_0x21e322){while(--_0x21e322){_0x5c8cce['push'](_0x5c8cce['shift']());}};_0x16bd91(++_0xa74d77);}(_0xd93e,0x15d));var _0xed93=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd93e[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0xed93('0x0'));var Transform=require(_0xed93('0x1'))[_0xed93('0x2')];function AGIReply(_0x488463){Transform['call'](this,_0x488463);this[_0xed93('0x3')]='';this[_0xed93('0x4')]=![];}util[_0xed93('0x5')](AGIReply,Transform);AGIReply['prototype'][_0xed93('0x6')]=function(_0x318008,_0x4d23f8,_0x3b39fa){var _0x3e0fde='\x0a',_0xc5a5a9=['\x0a\x0a',_0xed93('0x7')],_0x3e8a55=-0x1,_0x54bbfb=-0x1,_0x5954c8='',_0x58ab4a=0x0,_0x57b896='',_0x455055='';this[_0xed93('0x3')]+=_0x318008[_0xed93('0x8')]();_0x57b896=this['_localBuffer'];if(!this[_0xed93('0x4')]){_0x58ab4a=0x0;while(_0xc5a5a9[_0x58ab4a]){while((_0x54bbfb=_0x57b896['indexOf'](_0xc5a5a9[_0x58ab4a]))!=-0x1){_0x5954c8=_0xc5a5a9[_0x58ab4a];_0x455055=_0x57b896[_0xed93('0x9')](0x0,_0x54bbfb);_0x57b896=_0x57b896[_0xed93('0x9')](_0x54bbfb+_0x5954c8[_0xed93('0xa')]);var _0x55b899=_0x455055[_0xed93('0xb')](_0x3e0fde),_0x51c882=0x0,_0x58a54d={},_0x11884f='',_0x1cf205='',_0x304ded=-0x1;while(_0x55b899[_0x51c882]){_0x304ded=_0x55b899[_0x51c882]['indexOf'](':');if(_0x304ded!=-0x1){_0x11884f=_0x55b899[_0x51c882][_0xed93('0xc')](0x0,_0x304ded)[_0xed93('0xd')]();_0x1cf205=_0x55b899[_0x51c882][_0xed93('0xc')](_0x304ded+0x1)[_0xed93('0xd')]();if(_0x11884f[_0xed93('0xa')]>0x0){_0x58a54d[_0x11884f]=_0x1cf205;}}else{}_0x51c882++;}this[_0xed93('0xe')](_0xed93('0xf'),_0x58a54d);this[_0xed93('0x4')]=!![];}_0x58ab4a++;}this[_0xed93('0x3')]=_0x57b896;}else{while((_0x3e8a55=_0x57b896[_0xed93('0x10')](_0x3e0fde))!=-0x1){_0x455055=_0x57b896[_0xed93('0x9')](0x0,_0x3e8a55);this[_0xed93('0xe')](_0xed93('0x11'),_0x455055);_0x57b896=_0x57b896['substring'](_0x3e8a55+_0x3e0fde[_0xed93('0xa')]);}this[_0xed93('0x3')]=_0x57b896;}_0x3b39fa();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1576802..742ff38 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 _0xb2b5=['production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','http','request','then','error','message','getSquareProjects','GetSquareProjects','name'];(function(_0x4c97a6,_0xd5ce69){var _0x55a39d=function(_0x4674fa){while(--_0x4674fa){_0x4c97a6['push'](_0x4c97a6['shift']());}};_0x55a39d(++_0xd5ce69);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb2b5[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5b2b('0x0')]({'port':0x2329});function request(_0x1431f3,_0x518fe7){return new Promise(function(_0x4eee87,_0x31784d){return client[_0x5b2b('0x1')](_0x1431f3,_0x518fe7)[_0x5b2b('0x2')](function(_0x3c073f){if(_0x3c073f['error']){return _0x31784d(_0x3c073f[_0x5b2b('0x3')][_0x5b2b('0x4')]);}else{return _0x4eee87(_0x3c073f['result']);}})['catch'](function(_0x1e08e6){return _0x31784d(_0x1e08e6);});});}exports[_0x5b2b('0x5')]=function(){return request(_0x5b2b('0x6'),{'options':{'raw':![],'attributes':['id',_0x5b2b('0x7'),_0x5b2b('0x8')]}});};exports[_0x5b2b('0x9')]=function(_0x15425f){return request(_0x5b2b('0xa'),{'options':{'raw':![],'where':{'name':_0x15425f},'attributes':['production']}});};exports[_0x5b2b('0xb')]=function(_0x4732cd){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4732cd},'include':[{'model':_0x5b2b('0xc'),'as':_0x5b2b('0xd'),'include':[{'model':'CloudProvider','as':_0x5b2b('0xe')}]}],'attributes':['id',_0x5b2b('0x7'),_0x5b2b('0xf')],'smtp':!![]}});};exports[_0x5b2b('0x10')]=function(_0x2efc16){return request(_0x5b2b('0xa'),{'options':{'where':{'id':_0x2efc16},'attributes':[_0x5b2b('0x7')]}});};exports['getVoiceQueueById']=function(_0x30e9a3){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x30e9a3},'attributes':[_0x5b2b('0x7')]}});};exports[_0x5b2b('0x11')]=function(_0x3f5236){return request(_0x5b2b('0x12'),{'options':{'where':{'id':_0x3f5236},'attributes':['name']}});};exports[_0x5b2b('0x13')]=function(_0x57b38f){return request(_0x5b2b('0x14'),{'options':{'where':{'id':_0x57b38f},'attributes':['dsn']}});};exports['getUserById']=function(_0x44be6d){return request(_0x5b2b('0x15'),{'options':{'where':{'id':_0x44be6d},'attributes':['name']}});};exports[_0x5b2b('0x16')]=function(_0x2db9ee){return request(_0x5b2b('0x17'),{'options':{'where':{'phone':_0x2db9ee[_0x5b2b('0x18')]},'attributes':['id']}});};exports[_0x5b2b('0x19')]=function(_0x47bb1b){return request(_0x5b2b('0x1a'),{'options':{'where':{'id':_0x47bb1b},'attributes':[_0x5b2b('0x7')]}});};exports[_0x5b2b('0x1b')]=function(_0x318e05){return request(_0x5b2b('0x1c'),{'options':{'where':{'id':_0x318e05},'attributes':[_0x5b2b('0x1d')]}});};exports[_0x5b2b('0x1e')]=function(_0x208c1f){return request(_0x5b2b('0x1f'),{'options':{'raw':![],'where':{'id':_0x208c1f},'include':[{'model':_0x5b2b('0x20'),'as':_0x5b2b('0x21')}]}});};exports[_0x5b2b('0x22')]=function(_0x2de273){return request(_0x5b2b('0x23'),{'options':{'where':{'id':_0x2de273},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0xfdaeed){return request('CreateSmsMessage',{'body':_0xfdaeed});};exports[_0x5b2b('0x24')]=function(_0x4adb6d){return request(_0x5b2b('0x25'),{'body':_0x4adb6d});};exports[_0x5b2b('0x26')]=function(_0xb6d0b0){return request(_0x5b2b('0x27'),{'body':_[_0x5b2b('0x28')](_0xb6d0b0,{'project_name':_0xb6d0b0['arg_1'],'prev_project_name':_0xb6d0b0[_0x5b2b('0x29')]||'','is_subproject':_0xb6d0b0[_0x5b2b('0x29')]?!![]:![],'leaveAt':moment()['format'](_0x5b2b('0x2a'))})});};exports[_0x5b2b('0x2b')]=function(_0x49fca6){return request(_0x5b2b('0x2c'),{'body':_0x49fca6});};exports[_0x5b2b('0x2d')]=function(_0x225a99){return request(_0x5b2b('0x2e'),{'body':_0x225a99});};exports[_0x5b2b('0x2f')]=function(_0x94d866){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x94d866[_0x5b2b('0x18')],'ListId':_0x94d866[_0x5b2b('0x30')]}}})[_0x5b2b('0x2')](function(_0x4162f6){if(_0x4162f6){return _0x4162f6;}return request(_0x5b2b('0x31'),{'body':_0x94d866});});};exports['getPauseById']=function(_0x3ff027){return request(_0x5b2b('0x32'),{'options':{'where':{'id':_0x3ff027},'attributes':[_0x5b2b('0x7')]}});};exports[_0x5b2b('0x33')]=function(_0xbe2fc9,_0x32bc4a){return request('LoginUser',{'body':{'interface':_0x32bc4a},'options':{'where':_0xbe2fc9}});};exports[_0x5b2b('0x34')]=function(_0x37d218,_0x101d5c,_0x1127b0){return request(_0x5b2b('0x35'),{'body':{'type':_0x101d5c,'uniqueid':_0x1127b0},'options':{'where':_0x37d218}});};exports[_0x5b2b('0x36')]=function(_0x343b83){return request(_0x5b2b('0x37'),{'body':{},'options':{'where':_0x343b83}});};exports[_0x5b2b('0x38')]=function(_0x3f7f22){return request('LogoutUser',{'body':{},'options':{'where':_0x3f7f22}});}; \ No newline at end of file +var _0xc43c=['phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','getContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper'];(function(_0x5b7341,_0xc7cc92){var _0x4c7e21=function(_0x31491c){while(--_0x31491c){_0x5b7341['push'](_0x5b7341['shift']());}};_0x4c7e21(++_0xc7cc92);}(_0xc43c,0x152));var _0xcc43=function(_0x21adf0,_0x392931){_0x21adf0=_0x21adf0-0x0;var _0x572dc6=_0xc43c[_0x21adf0];return _0x572dc6;};'use strict';var _=require(_0xcc43('0x0'));var moment=require(_0xcc43('0x1'));var jayson=require(_0xcc43('0x2'));var client=jayson[_0xcc43('0x3')][_0xcc43('0x4')]({'port':0x2329});function request(_0x275c81,_0x53ef5e){return new Promise(function(_0x162a11,_0x258c7e){return client['request'](_0x275c81,_0x53ef5e)[_0xcc43('0x5')](function(_0x456b6c){if(_0x456b6c[_0xcc43('0x6')]){return _0x258c7e(_0x456b6c[_0xcc43('0x6')][_0xcc43('0x7')]);}else{return _0x162a11(_0x456b6c[_0xcc43('0x8')]);}})[_0xcc43('0x9')](function(_0x3b8857){return _0x258c7e(_0x3b8857);});});}exports[_0xcc43('0xa')]=function(){return request(_0xcc43('0xb'),{'options':{'raw':![],'attributes':['id','name',_0xcc43('0xc')]}});};exports[_0xcc43('0xd')]=function(_0x3e865d){return request(_0xcc43('0xe'),{'options':{'raw':![],'where':{'name':_0x3e865d},'attributes':[_0xcc43('0xc')]}});};exports[_0xcc43('0xf')]=function(_0x486779){return request(_0xcc43('0x10'),{'options':{'raw':![],'where':{'id':_0x486779},'include':[{'model':_0xcc43('0x11'),'as':_0xcc43('0x12'),'include':[{'model':_0xcc43('0x13'),'as':_0xcc43('0x13')}]}],'attributes':['id',_0xcc43('0x14'),'email'],'smtp':!![]}});};exports[_0xcc43('0x15')]=function(_0x5aadbc){return request(_0xcc43('0xe'),{'options':{'where':{'id':_0x5aadbc},'attributes':[_0xcc43('0x14')]}});};exports['getVoiceQueueById']=function(_0x4ac110){return request(_0xcc43('0x16'),{'options':{'where':{'id':_0x4ac110},'attributes':[_0xcc43('0x14')]}});};exports[_0xcc43('0x17')]=function(_0x3b9eff){return request(_0xcc43('0x18'),{'options':{'where':{'id':_0x3b9eff},'attributes':[_0xcc43('0x14')]}});};exports['getSquareOdbcById']=function(_0x481919){return request(_0xcc43('0x19'),{'options':{'where':{'id':_0x481919},'attributes':[_0xcc43('0x1a')]}});};exports[_0xcc43('0x1b')]=function(_0x2e053d){return request('ShowUser',{'options':{'where':{'id':_0x2e053d},'attributes':[_0xcc43('0x14')]}});};exports[_0xcc43('0x1c')]=function(_0x266af8){return request('GetContactByPhone',{'options':{'where':{'phone':_0x266af8['phone']},'attributes':['id']}});};exports[_0xcc43('0x1d')]=function(_0x18a1ae){return request('ShowTrunk',{'options':{'where':{'id':_0x18a1ae},'attributes':['name']}});};exports[_0xcc43('0x1e')]=function(_0x34b477){return request(_0xcc43('0x1f'),{'options':{'where':{'id':_0x34b477},'attributes':[_0xcc43('0x20')]}});};exports[_0xcc43('0x21')]=function(_0x3ae999){return request(_0xcc43('0x22'),{'options':{'raw':![],'where':{'id':_0x3ae999},'include':[{'model':_0xcc43('0x23'),'as':_0xcc43('0x24')}]}});};exports[_0xcc43('0x25')]=function(_0x4f72a2){return request(_0xcc43('0x26'),{'options':{'where':{'id':_0x4f72a2},'attributes':['id',_0xcc43('0x14')]}});};exports[_0xcc43('0x27')]=function(_0x40137c){return request(_0xcc43('0x28'),{'body':_0x40137c});};exports['createSquareDetailsReport']=function(_0x7f5fba){return request(_0xcc43('0x29'),{'body':_0x7f5fba});};exports[_0xcc43('0x2a')]=function(_0x2de81d){return request(_0xcc43('0x2b'),{'body':_['merge'](_0x2de81d,{'project_name':_0x2de81d[_0xcc43('0x2c')],'prev_project_name':_0x2de81d[_0xcc43('0x2d')]||'','is_subproject':_0x2de81d[_0xcc43('0x2d')]?!![]:![],'leaveAt':moment()[_0xcc43('0x2e')](_0xcc43('0x2f'))})});};exports[_0xcc43('0x30')]=function(_0x110212){return request(_0xcc43('0x31'),{'body':_0x110212});};exports[_0xcc43('0x32')]=function(_0x109ed2){return request('CreateSquareMessage',{'body':_0x109ed2});};exports['createCmContact']=function(_0x33a463){return request(_0xcc43('0x33'),{'options':{'raw':![],'where':{'phone':_0x33a463[_0xcc43('0x34')],'ListId':_0x33a463[_0xcc43('0x35')]}}})[_0xcc43('0x5')](function(_0x38c47e){if(_0x38c47e){return _0x38c47e;}return request(_0xcc43('0x36'),{'body':_0x33a463});});};exports[_0xcc43('0x37')]=function(_0x5f02e5){return request(_0xcc43('0x38'),{'options':{'where':{'id':_0x5f02e5},'attributes':[_0xcc43('0x14')]}});};exports[_0xcc43('0x39')]=function(_0x467652,_0x26daf4){return request(_0xcc43('0x3a'),{'body':{'interface':_0x26daf4},'options':{'where':_0x467652}});};exports[_0xcc43('0x3b')]=function(_0x22c76f,_0x8b69d7,_0x541596){return request(_0xcc43('0x3c'),{'body':{'type':_0x8b69d7,'uniqueid':_0x541596},'options':{'where':_0x22c76f}});};exports[_0xcc43('0x3d')]=function(_0x4d3067){return request(_0xcc43('0x3e'),{'body':{},'options':{'where':_0x4d3067}});};exports[_0xcc43('0x3f')]=function(_0x19b63e){return request(_0xcc43('0x40'),{'body':{},'options':{'where':_0x19b63e}});}; \ 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 70a24d6..9575083 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 _0xaee6=['exports','./polly','./lex'];(function(_0x302fcf,_0x4e4901){var _0x2de7b7=function(_0x1fcdd2){while(--_0x1fcdd2){_0x302fcf['push'](_0x302fcf['shift']());}};_0x2de7b7(++_0x4e4901);}(_0xaee6,0x187));var _0x6aee=function(_0x17ec30,_0x4ca437){_0x17ec30=_0x17ec30-0x0;var _0x321753=_0xaee6[_0x17ec30];return _0x321753;};var polly=require(_0x6aee('0x0'));var lex=require(_0x6aee('0x1'));module[_0x6aee('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x8ce1=['./lex','exports','./polly'];(function(_0x545dd8,_0x404f75){var _0x44cd80=function(_0xec3ca3){while(--_0xec3ca3){_0x545dd8['push'](_0x545dd8['shift']());}};_0x44cd80(++_0x404f75);}(_0x8ce1,0x152));var _0x18ce=function(_0x560112,_0xb35fa4){_0x560112=_0x560112-0x0;var _0x15644f=_0x8ce1[_0x560112];return _0x15644f;};var polly=require(_0x18ce('0x0'));var lex=require(_0x18ce('0x1'));module[_0x18ce('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 c2ca4e1..21062fd 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 _0x153f=['exports','./lib/api'];(function(_0x5c0a22,_0x3e0eb3){var _0x292d8e=function(_0x28c9e6){while(--_0x28c9e6){_0x5c0a22['push'](_0x5c0a22['shift']());}};_0x292d8e(++_0x3e0eb3);}(_0x153f,0x15b));var _0xf153=function(_0x5043b9,_0x4d0638){_0x5043b9=_0x5043b9-0x0;var _0x3119ec=_0x153f[_0x5043b9];return _0x3119ec;};'use strict';var lex=require(_0xf153('0x0'));module[_0xf153('0x1')]=function(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c){return lex(_0xde7eae,_0x44cea3,_0x2afb9a,_0x1ccc1c,_0x3b85fc,_0x59757c);}; \ No newline at end of file +var _0x96cc=['./lib/api'];(function(_0x520860,_0x2fa5f9){var _0x3dbfd0=function(_0xd35641){while(--_0xd35641){_0x520860['push'](_0x520860['shift']());}};_0x3dbfd0(++_0x2fa5f9);}(_0x96cc,0x16c));var _0xc96c=function(_0x21b2e5,_0x57ed16){_0x21b2e5=_0x21b2e5-0x0;var _0x1d456b=_0x96cc[_0x21b2e5];return _0x1d456b;};'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 37d6718..468370e 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(_0x31d1ea,_0xa6574e){var _0x2dc47b=function(_0x3fae82){while(--_0x3fae82){_0x31d1ea['push'](_0x31d1ea['shift']());}};_0x2dc47b(++_0xa6574e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x37cb77,_0x52eddf){var _0x52db4f=function(_0x5b818d){while(--_0x5b818d){_0x37cb77['push'](_0x37cb77['shift']());}};_0x52db4f(++_0x52eddf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 26966a6..035e182 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 _0x05fe=['./lib/api'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x05fe,0x125));var _0xe05f=function(_0x4cd065,_0x556981){_0x4cd065=_0x4cd065-0x0;var _0x3cd13f=_0x05fe[_0x4cd065];return _0x3cd13f;};'use strict';var polly=require(_0xe05f('0x0'));module['exports']=function(_0x2da076,_0x474507,_0xa02ad7,_0x6f0557,_0xc2e7e9,_0x183dd7,_0x2be9d0){return polly(_0x2da076,_0x474507,_0xa02ad7,_0x6f0557,_0xc2e7e9,_0x183dd7,_0x2be9d0);}; \ No newline at end of file +var _0x8d3b=['exports','./lib/api'];(function(_0x299309,_0x4067f1){var _0x247738=function(_0x108b6f){while(--_0x108b6f){_0x299309['push'](_0x299309['shift']());}};_0x247738(++_0x4067f1);}(_0x8d3b,0x163));var _0xb8d3=function(_0x2b2c51,_0x24005a){_0x2b2c51=_0x2b2c51-0x0;var _0x170224=_0x8d3b[_0x2b2c51];return _0x170224;};'use strict';var polly=require(_0xb8d3('0x0'));module[_0xb8d3('0x1')]=function(_0x4ee74b,_0xfb3092,_0xc310c7,_0xcd1985,_0x3ddc05,_0x2c7141,_0x590d04){return polly(_0x4ee74b,_0xfb3092,_0xc310c7,_0xcd1985,_0x3ddc05,_0x2c7141,_0x590d04);}; \ 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 e091b28..3a98977 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 _0x71ba=['aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','bluebird'];(function(_0x1958e4,_0x5cf7ac){var _0x23ea81=function(_0x1785b5){while(--_0x1785b5){_0x1958e4['push'](_0x1958e4['shift']());}};_0x23ea81(++_0x5cf7ac);}(_0x71ba,0x19f));var _0xa71b=function(_0x3f2232,_0x14ea67){_0x3f2232=_0x3f2232-0x0;var _0x50e0d3=_0x71ba[_0x3f2232];return _0x50e0d3;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa71b('0x0'));var rs=require('randomstring');var AWS=require(_0xa71b('0x1'));function pollyResult(_0x397ebd,_0x20d8fe,_0x5be6fe){return new BPromise(function(_0x1f66de,_0x3e7366){_0x397ebd[_0xa71b('0x2')](_0x20d8fe,function(_0x283e28,_0xdbd33){if(_0x283e28){_0x3e7366(_0x283e28);}else if(_0xdbd33){if(_0xdbd33['AudioStream']instanceof Buffer){fs[_0xa71b('0x3')](_0x5be6fe,_0xdbd33['AudioStream'],function(_0x46d674){if(_0x46d674){_0x3e7366(_0x46d674);}else{_0x1f66de();}});}else{_0x3e7366(new Error(_0xa71b('0x4')));}}else{_0x3e7366(new Error(_0xa71b('0x5')));}});});}module['exports']=function(_0x4eb57d,_0x22f347,_0x671b56,_0x5167eb,_0x34cca1,_0x57f022,_0x16d7c0){var _0x10444c=new AWS[(_0xa71b('0x6'))]({'accessKeyId':_0x4eb57d,'secretAccessKey':_0x22f347,'region':_0x671b56});var _0x53c3e1={'Text':_0x34cca1,'TextType':_0x57f022||_0xa71b('0x7'),'OutputFormat':'mp3','VoiceId':_0x5167eb};return pollyResult(_0x10444c,_0x53c3e1,_0x16d7c0);}; \ No newline at end of file +var _0xfef4=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xfef4,0xee));var _0x4fef=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xfef4[_0x568cf0];return _0x360f81;};'use strict';var fs=require('fs');var path=require(_0x4fef('0x0'));var BPromise=require(_0x4fef('0x1'));var rs=require(_0x4fef('0x2'));var AWS=require(_0x4fef('0x3'));function pollyResult(_0x1cbf11,_0xae470b,_0x1cfc2e){return new BPromise(function(_0x411fd2,_0x5662c3){_0x1cbf11[_0x4fef('0x4')](_0xae470b,function(_0x8e9349,_0x1584b4){if(_0x8e9349){_0x5662c3(_0x8e9349);}else if(_0x1584b4){if(_0x1584b4[_0x4fef('0x5')]instanceof Buffer){fs[_0x4fef('0x6')](_0x1cfc2e,_0x1584b4[_0x4fef('0x5')],function(_0xd8385c){if(_0xd8385c){_0x5662c3(_0xd8385c);}else{_0x411fd2();}});}else{_0x5662c3(new Error(_0x4fef('0x7')));}}else{_0x5662c3(new Error(_0x4fef('0x8')));}});});}module[_0x4fef('0x9')]=function(_0x18812a,_0x3465c8,_0x3f5a21,_0xe83638,_0x5f2b49,_0x316ecb,_0x11f836){var _0x3ce279=new AWS[(_0x4fef('0xa'))]({'accessKeyId':_0x18812a,'secretAccessKey':_0x3465c8,'region':_0x3f5a21});var _0x1237e2={'Text':_0x5f2b49,'TextType':_0x316ecb||_0x4fef('0xb'),'OutputFormat':_0x4fef('0xc'),'VoiceId':_0xe83638};return pollyResult(_0x3ce279,_0x1237e2,_0x11f836);}; \ 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 3b1bc8b..2cf8501 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 _0xda9d=['./lib/api','exports'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xda9d,0x10e));var _0xdda9=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0xda9d[_0x590b61];return _0x1a14dc;};'use strict';var asr=require(_0xdda9('0x0'));module[_0xdda9('0x1')]=function(_0x358698,_0x1ac188,_0x4ede6b,_0x2704f7){return asr(_0x358698,_0x1ac188,_0x4ede6b);}; \ No newline at end of file +var _0xb4fe=['exports'];(function(_0x122a6d,_0x12d7be){var _0x500924=function(_0x35b93e){while(--_0x35b93e){_0x122a6d['push'](_0x122a6d['shift']());}};_0x500924(++_0x12d7be);}(_0xb4fe,0x19d));var _0xeb4f=function(_0x1b1253,_0x5ca823){_0x1b1253=_0x1b1253-0x0;var _0x43cbf0=_0xb4fe[_0x1b1253];return _0x43cbf0;};'use strict';var asr=require('./lib/api');module[_0xeb4f('0x0')]=function(_0x2da515,_0x4e2178,_0x533e50,_0x4c9da0){return asr(_0x2da515,_0x4e2178,_0x533e50);}; \ 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 7d6c130..487a6e0 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 _0xf25a=['string','undefined','length','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com'];(function(_0xe83ac5,_0x279b67){var _0x3df16e=function(_0x5a1577){while(--_0x5a1577){_0xe83ac5['push'](_0xe83ac5['shift']());}};_0x3df16e(++_0x279b67);}(_0xf25a,0x195));var _0xaf25=function(_0x45f1e7,_0x50d513){_0x45f1e7=_0x45f1e7-0x0;var _0x5ebb7b=_0xf25a[_0x45f1e7];return _0x5ebb7b;};'use strict';var url=require(_0xaf25('0x0'));var BPromise=require(_0xaf25('0x1'));var fs=require('fs');var host=_0xaf25('0x2');module['exports']=function(_0x5d0949,_0x651cae,_0x3d4522){return new BPromise(function(_0x4d4252,_0x1ef749){var _0x49e3b2;if(typeof _0x5d0949!==_0xaf25('0x3')||_0x5d0949['length']===0x0){return _0x1ef749('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x651cae!==_0xaf25('0x3')||_0x651cae['length']===0x0){return _0x1ef749('key\x20should\x20be\x20a\x20string');}if(typeof _0x3d4522!==_0xaf25('0x4')&&(typeof _0x3d4522!==_0xaf25('0x3')||_0x3d4522[_0xaf25('0x5')]===0x0)){return _0x1ef749('lang\x20should\x20be\x20a\x20string');}try{_0x49e3b2=fs[_0xaf25('0x6')](_0x5d0949)[_0xaf25('0x7')](_0xaf25('0x8'));}catch(_0x2dd7b1){return _0x1ef749(_0x2dd7b1);}return _0x4d4252({'method':_0xaf25('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x651cae,'body':{'config':{'encoding':_0xaf25('0xa'),'sampleRateHertz':_0xaf25('0xb'),'languageCode':_0x3d4522},'audio':{'content':_0x49e3b2}},'json':!![]});});}; \ No newline at end of file +var _0xb32d=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x2d7423,_0x2ddc3c){var _0xd2fcae=function(_0x31a49c){while(--_0x31a49c){_0x2d7423['push'](_0x2d7423['shift']());}};_0xd2fcae(++_0x2ddc3c);}(_0xb32d,0x1da));var _0xdb32=function(_0x4d30ac,_0x112604){_0x4d30ac=_0x4d30ac-0x0;var _0x279f70=_0xb32d[_0x4d30ac];return _0x279f70;};'use strict';var url=require(_0xdb32('0x0'));var BPromise=require(_0xdb32('0x1'));var fs=require('fs');var host=_0xdb32('0x2');module[_0xdb32('0x3')]=function(_0x298769,_0x56a5af,_0x56bb98){return new BPromise(function(_0x2fe96e,_0x2c5527){var _0x581ceb;if(typeof _0x298769!==_0xdb32('0x4')||_0x298769[_0xdb32('0x5')]===0x0){return _0x2c5527(_0xdb32('0x6'));}if(typeof _0x56a5af!==_0xdb32('0x4')||_0x56a5af[_0xdb32('0x5')]===0x0){return _0x2c5527(_0xdb32('0x7'));}if(typeof _0x56bb98!=='undefined'&&(typeof _0x56bb98!==_0xdb32('0x4')||_0x56bb98[_0xdb32('0x5')]===0x0)){return _0x2c5527(_0xdb32('0x8'));}try{_0x581ceb=fs[_0xdb32('0x9')](_0x298769)[_0xdb32('0xa')](_0xdb32('0xb'));}catch(_0x112db6){return _0x2c5527(_0x112db6);}return _0x2fe96e({'method':_0xdb32('0xc'),'uri':host+_0xdb32('0xd')+_0x56a5af,'body':{'config':{'encoding':_0xdb32('0xe'),'sampleRateHertz':_0xdb32('0xf'),'languageCode':_0x56bb98},'audio':{'content':_0x581ceb}},'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 d1d9665..eee6277 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 _0x9d03=['./asr','exports'];(function(_0x1a4af8,_0x2d8b6b){var _0x3bf5f3=function(_0x11bad3){while(--_0x11bad3){_0x1a4af8['push'](_0x1a4af8['shift']());}};_0x3bf5f3(++_0x2d8b6b);}(_0x9d03,0x14a));var _0x39d0=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x9d03[_0x266618];return _0x54dbf5;};var asr=require(_0x39d0('0x0'));module[_0x39d0('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc09e=['./asr','exports'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0xc09e,0x19e));var _0xec09=function(_0x15494c,_0x22189e){_0x15494c=_0x15494c-0x0;var _0x1ed9ea=_0xc09e[_0x15494c];return _0x1ed9ea;};var asr=require(_0xec09('0x0'));module[_0xec09('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 6f8328e..ed497cf 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 _0x674e=['from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','score','status','code','endConversation','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','isFallback','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','info','finish\x20download\x20file','close','unlink','pipe','WHAT_EVER','end','transcode','wav','resolve','tmp','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','then','generate','.mp3'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x674e,0xe1));var _0xe674=function(_0x3c80bf,_0x48aa20){_0x3c80bf=_0x3c80bf-0x0;var _0x35e27a=_0x674e[_0x3c80bf];return _0x35e27a;};'use strict';var apiai=require(_0xe674('0x0'));var BPromise=require(_0xe674('0x1'));var dialogflow=require(_0xe674('0x2'));var fs=require('fs');var http=require(_0xe674('0x3'));var https=require(_0xe674('0x4'));var md5=require(_0xe674('0x5'));var path=require(_0xe674('0x6'));var querystring=require(_0xe674('0x7'));var rp=require(_0xe674('0x8'));var rs=require(_0xe674('0x9'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xe674('0xa'))[_0xe674('0xb')];var util=require(_0xe674('0xc'));var aws=require(_0xe674('0xd'));var google=require(_0xe674('0xe'));var sestek=require(_0xe674('0xf'));var tilde=require(_0xe674('0x10'));var logger=require(_0xe674('0x11'))('agi');var ISPEECH_API=_0xe674('0x12');function downloadFile(_0x5e779e,_0x4c3a85){return new BPromise(function(_0x34231e,_0x1d8f21){var _0x348843=urlParse(_0x5e779e);var _0x213f29=_0x348843[_0xe674('0x13')]===_0xe674('0x14')?https:http;var _0xf60062={'host':_0x348843[_0xe674('0x15')],'path':_0x348843[_0xe674('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x213f29[_0xe674('0x16')](_0xf60062,function(_0x5c9b88){if(_0x5c9b88[_0xe674('0x17')]!==0xc8){logger[_0xe674('0x18')](_0xe674('0x19')+_0x5e779e+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c9b88[_0xe674('0x17')]+'\x20('+_0x5c9b88[_0xe674('0x1a')]+')');_0x1d8f21(new Error('request\x20to\x20'+_0x5e779e+_0xe674('0x1b')+_0x5c9b88['statusCode']+'\x20('+_0x5c9b88[_0xe674('0x1a')]+')'));return;}var _0x237be0=fs['createWriteStream'](_0x4c3a85);_0x237be0['on'](_0xe674('0x1c'),function(){logger[_0xe674('0x1d')](_0xe674('0x1e'));_0x237be0[_0xe674('0x1f')](_0x34231e);});_0x237be0['on'](_0xe674('0x18'),function(_0x533cf8){fs[_0xe674('0x20')](_0x4c3a85);logger['error']('download\x20error',_0x533cf8);_0x1d8f21(_0x533cf8);});_0x5c9b88[_0xe674('0x21')](_0x237be0);})['on'](_0xe674('0x18'),function(_0x38fcb8){logger[_0xe674('0x18')](_0x38fcb8);_0x1d8f21(_0x38fcb8);})['end']();});}function uploadFile(_0x3f0733){return new BPromise(function(_0x52634b,_0x125a2a){var _0x20c76c=urlParse(_0x3f0733);var _0x2eba54=_0x20c76c[_0xe674('0x13')]==='https:'?https:http;var _0x1f954c={'host':_0x20c76c[_0xe674('0x15')],'path':_0x20c76c[_0xe674('0x6')],'headers':{'user-agent':_0xe674('0x22')}};_0x2eba54[_0xe674('0x16')](_0x1f954c,function(_0x5724fa){if(_0x5724fa[_0xe674('0x17')]!==0xc8){_0x125a2a(new Error(_0xe674('0x19')+_0x3f0733+_0xe674('0x1b')+_0x5724fa[_0xe674('0x17')]+'\x20('+_0x5724fa[_0xe674('0x1a')]+')'));return;}var _0x853660='';_0x5724fa['on']('data',function(_0x479c53){_0x853660+=_0x479c53;});_0x5724fa['on'](_0xe674('0x23'),function(){_0x52634b(_0x853660);});})['on'](_0xe674('0x18'),function(_0x22b3bf){_0x125a2a(_0x22b3bf);})[_0xe674('0x23')]();});}function convertFile(_0x403b68,_0x396a6c){return new BPromise(function(_0x40aeba,_0x1d7792){var _0x12cb63=sox[_0xe674('0x24')](_0x403b68,_0x396a6c,{'sampleRate':0x1f40,'format':_0xe674('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x12cb63['on']('error',function(_0x4131e5){logger['error']('error\x20convert',_0x4131e5);_0x1d7792(_0x4131e5);});_0x12cb63['on'](_0xe674('0x23'),function(){logger[_0xe674('0x1d')]('finish\x20to\x20convert');_0x40aeba();});_0x12cb63['start']();});}function base64Decode(_0x3e68e2,_0xae23ac){var _0x474f13=path[_0xe674('0x26')](__dirname,_0xe674('0x27'),rs['generate'](0x4)+_0xe674('0x28'));fs[_0xe674('0x29')](_0x474f13,_0x3e68e2,_0xe674('0x2a'));return convertFile(_0x474f13,_0xae23ac)['then'](function(){try{fs[_0xe674('0x20')](_0x474f13);fs[_0xe674('0x2b')](_0xae23ac,_0xe674('0x2c'));}catch(_0x42ffe9){logger[_0xe674('0x18')](_0x42ffe9);}return _0xae23ac[_0xe674('0x2d')]('.')[0x0];});}function base64Encode(_0x5d65a0){var _0x576918=fs[_0xe674('0x2e')](_0x5d65a0);return new Buffer(_0x576918)[_0xe674('0x2f')](_0xe674('0x2a'));}exports[_0xe674('0x30')]=function(_0x27364c,_0xe2d045,_0x56845c,_0x3bb168,_0x47299b,_0x5611ba){var _0x2b1ce2,_0x39197f;var _0x4b7d3a=_0xe674('0x31');var _0x470751=_0xe674('0x32')+_0x27364c;var _0x4cbb83={};if(_0xe2d045===_0xe674('0x33')){_0x4cbb83['input']={'ssml':_0x56845c};}else{_0x4cbb83[_0xe674('0x34')]={'text':_0x56845c};};_0x4cbb83[_0xe674('0x35')]={'languageCode':_0x3bb168,'ssmlGender':_0x47299b};_0x4cbb83[_0xe674('0x36')]={'audioEncoding':_0xe674('0x37'),'sampleRateHertz':0x1f40};var _0x206b43={'url':_0x4b7d3a+_0xe674('0x38')+_0x470751,'method':_0xe674('0x39'),'json':!![],'body':_0x4cbb83};return rp(_0x206b43)[_0xe674('0x3a')](function(_0x36e25e){return new BPromise(function(_0x504989,_0xf424f3){_0x2b1ce2=path['resolve'](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+_0xe674('0x3c'));var _0x44d369=Buffer[_0xe674('0x3d')](_0x36e25e[_0xe674('0x3e')],_0xe674('0x2a'));return fs[_0xe674('0x3f')](_0x2b1ce2,_0x44d369,function(_0xe5c55f){_0xf424f3(_0xe5c55f);},function(_0x54999a){fs[_0xe674('0x2b')](_0x2b1ce2,'777');_0x504989(_0x54999a);});});})[_0xe674('0x3a')](function(_0x154057){_0x39197f=path[_0xe674('0x26')](__dirname,'tmp',rs[_0xe674('0x3b')](0x4)+'.wav');return convertFile(_0x2b1ce2,_0x39197f);})[_0xe674('0x3a')](function(){try{fs[_0xe674('0x20')](_0x2b1ce2);fs[_0xe674('0x2b')](_0x39197f,_0xe674('0x2c'));}catch(_0x598d3b){logger[_0xe674('0x18')](_0x598d3b);}logger['info'](_0xe674('0x40'),_0x39197f[_0xe674('0x2d')]('.')[0x0]);return _0x39197f[_0xe674('0x2d')]('.')[0x0];});};exports[_0xe674('0x41')]=function(_0x44137d,_0x55f541){var _0x475b25=_0xe674('0x42');var _0x10ca8c,_0x358ae1;var _0x30bca6;var _0x24653c={'encoding':_0xe674('0x43'),'method':_0xe674('0x39'),'timeout':0x2710,'url':_0x475b25,'headers':{'Content-Type':_0xe674('0x44')},'body':_0xe674('0x45')+encodeURIComponent(JSON[_0xe674('0x46')]([[[_0xe674('0x47'),JSON[_0xe674('0x46')]([_0x44137d,_0x55f541||'en',![],_0xe674('0x48')]),null,_0xe674('0x49')]]]))};return rp(_0x24653c)[_0xe674('0x3a')](function(_0x4f05c2){try{_0x30bca6=eval(_0x4f05c2[_0xe674('0x4a')](0x5))[0x0][0x2];}catch(_0x5a5a61){throw new Error('parse\x20response\x20failed:\x0a'+_0x4f05c2[_0xe674('0x4b')]);}if(!_0x30bca6){if(_0x44137d[_0xe674('0x4c')]>0xc8){throw new Error(_0xe674('0x4d'));}else{throw new Error(_0xe674('0x4e')+_0x55f541+_0xe674('0x4f'));}}try{_0x30bca6=eval(_0x30bca6)[0x0];}catch(_0x3c704f){throw new Error(_0xe674('0x50')+res[_0xe674('0x4b')]);}const _0x183ba1=_0x30bca6;_0x10ca8c=path[_0xe674('0x26')](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+'.mp3');fs['writeFileSync'](_0x10ca8c,_0x30bca6,{'encoding':_0xe674('0x2a')});_0x358ae1=path['resolve'](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+_0xe674('0x28'));return convertFile(_0x10ca8c,_0x358ae1);})[_0xe674('0x3a')](function(){try{fs[_0xe674('0x20')](_0x10ca8c);fs[_0xe674('0x2b')](_0x358ae1,_0xe674('0x2c'));}catch(_0x9823e7){logger[_0xe674('0x18')](_0x9823e7);}logger[_0xe674('0x1d')](_0xe674('0x51'),_0x358ae1[_0xe674('0x2d')]('.')[0x0]);return _0x358ae1[_0xe674('0x2d')]('.')[0x0];});};exports[_0xe674('0x52')]=function(_0x1f456f,_0x2bb28d,_0x3a8f80){return google[_0xe674('0x53')](_0x1f456f,_0x2bb28d,_0x3a8f80)[_0xe674('0x3a')](function(_0x5c8be7){logger[_0xe674('0x1d')](_0x5c8be7[_0xe674('0x54')]);return rp(_0x5c8be7);})['then'](function(_0x122e1a){var _0x5265d4='';var _0x114496=0x0;try{fs['unlink'](_0x1f456f);}catch(_0x271940){logger[_0xe674('0x18')](_0x271940);}if(_0x122e1a&&_0x122e1a[_0xe674('0x55')]){_0x5265d4=_0x122e1a[_0xe674('0x55')][_0xe674('0x56')](function(_0x41022a){return _0x41022a&&_0x41022a[_0xe674('0x57')][0x0]&&_0x41022a[_0xe674('0x57')][0x0][_0xe674('0x58')]?_0x41022a['alternatives'][0x0][_0xe674('0x58')]:'';})[_0xe674('0x59')]('\x0a');_0x114496=_0x122e1a['results'][_0xe674('0x56')](function(_0x5dd5eb){return _0x5dd5eb&&_0x5dd5eb[_0xe674('0x57')][0x0]&&_0x5dd5eb[_0xe674('0x57')][0x0][_0xe674('0x5a')]?_0x5dd5eb[_0xe674('0x57')][0x0]['confidence']:0x0;})[_0xe674('0x59')]('\x0a');}logger[_0xe674('0x1d')](_0xe674('0x5b'),_0x5265d4);logger[_0xe674('0x1d')](_0xe674('0x5c'),_0x114496);return{'transcript':_0x5265d4,'confidence':_0x114496};})['catch'](function(_0x241a3b){logger[_0xe674('0x18')](_0xe674('0x5d'),_0x241a3b[_0xe674('0x17')],_0x241a3b[_0xe674('0x5e')],_0x241a3b[_0xe674('0x5f')]);});};exports[_0xe674('0x60')]=function(_0x45c4ee,_0x5c8ffe,_0x2b6385,_0xcaf4f8){var _0x363b37=apiai(_0x5c8ffe,{'language':_0xcaf4f8||'en'});return _0x363b37[_0xe674('0x61')](_0x2b6385,{'sessionId':md5(_0x45c4ee)})[_0xe674('0x3a')](function(_0x1402b0){logger[_0xe674('0x1d')](JSON[_0xe674('0x46')](_0x1402b0));return{'source':_0x1402b0[_0xe674('0x62')][_0xe674('0x63')],'resolvedQuery':_0x1402b0['result'][_0xe674('0x64')],'action':_0x1402b0['result']['action'],'actionIncomplete':_0x1402b0[_0xe674('0x62')][_0xe674('0x65')],'speech':_0x1402b0[_0xe674('0x62')][_0xe674('0x66')]['speech'],'score':_0x1402b0[_0xe674('0x62')][_0xe674('0x67')],'statusCode':_0x1402b0[_0xe674('0x68')][_0xe674('0x69')],'endConversation':_0x1402b0['result']['metadata'][_0xe674('0x6a')]||![],'isFallbackIntent':_0x1402b0[_0xe674('0x62')][_0xe674('0x6b')]['isFallbackIntent']};});};exports[_0xe674('0x6c')]=function(_0x13da46,_0x234620,_0x4045ae,_0x307bb3,_0x4bb150,_0x5bf8d2){var _0x2cc8b9=_0x307bb3[_0xe674('0x6d')](/\\n/g,'\x0a');var _0x510299={'credentials':{'private_key':_0x2cc8b9,'client_email':_0x4045ae}};var _0x38dc89=new dialogflow[(_0xe674('0x6e'))](_0x510299);var _0x30c247=_0x38dc89[_0xe674('0x6f')](_0x234620,md5(_0x13da46));var _0x2914ac={'session':_0x30c247,'queryInput':{'text':{'text':_0x4bb150,'languageCode':_0x5bf8d2}}};return _0x38dc89[_0xe674('0x70')](_0x2914ac)['then'](function(_0x5a23c9){if(_0x5a23c9&&_0x5a23c9[_0xe674('0x4c')]){logger[_0xe674('0x1d')](_0xe674('0x71'),JSON[_0xe674('0x46')](_0x5a23c9));var _0x3eb642=_0x5a23c9[0x0];if(_0x3eb642){var _0x8935ab={'action':_0x3eb642['queryResult'][_0xe674('0x72')],'allRequiredParamsPresent':_0x3eb642[_0xe674('0x73')][_0xe674('0x74')],'endConversation':_0x3eb642[_0xe674('0x73')]['diagnosticInfo']&&_0x3eb642[_0xe674('0x73')][_0xe674('0x75')]['fields']?_0x3eb642[_0xe674('0x73')]['diagnosticInfo'][_0xe674('0x76')][_0xe674('0x77')]['boolValue']:![],'fulfillmentText':_0x3eb642[_0xe674('0x73')]['fulfillmentText'],'intentName':_0x3eb642[_0xe674('0x73')]['intent'][_0xe674('0x5e')],'intentDisplayName':_0x3eb642['queryResult'][_0xe674('0x78')]['displayName'],'isFallbackIntent':_0x3eb642[_0xe674('0x73')]['intent'][_0xe674('0x79')],'languageCode':_0x3eb642['queryResult']['languageCode'],'queryText':_0x3eb642['queryResult']['queryText'],'responseId':_0x3eb642['responseId'],'score':_0x3eb642[_0xe674('0x73')][_0xe674('0x7a')],'speech':_0x3eb642[_0xe674('0x73')][_0xe674('0x7b')],'providerResponse':JSON[_0xe674('0x46')](_0x5a23c9)};return _0x8935ab;}}});};exports[_0xe674('0x7c')]=function(_0x15a42d,_0x3ad5aa,_0x215177,_0x35c910){return tilde['asr'](_0x15a42d,_0x3ad5aa,_0x215177,_0x35c910)[_0xe674('0x3a')](function(_0xbc6040){try{fs[_0xe674('0x20')](_0x15a42d);}catch(_0x2892bb){logger[_0xe674('0x18')](_0x2892bb);}logger[_0xe674('0x1d')](_0xe674('0x7d'),_0xbc6040[_0xe674('0x58')]);logger[_0xe674('0x1d')](_0xe674('0x7e'),_0xbc6040[_0xe674('0x5a')]);return _0xbc6040;});};exports[_0xe674('0x7f')]=function(_0x86df06,_0x3ceb3c,_0x374b49,_0x162aa6,_0x538581,_0x36881b){var _0x53cae2=path[_0xe674('0x26')](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+_0xe674('0x3c'));var _0xba493e;return aws['polly'](_0x86df06,_0x3ceb3c,_0x374b49,_0x162aa6,_0x538581,_0x36881b,_0x53cae2)[_0xe674('0x3a')](function(){_0xba493e=path[_0xe674('0x26')](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+_0xe674('0x28'));return convertFile(_0x53cae2,_0xba493e);})[_0xe674('0x3a')](function(){try{fs[_0xe674('0x20')](_0x53cae2);fs[_0xe674('0x2b')](_0xba493e,_0xe674('0x2c'));}catch(_0x3b38f1){logger[_0xe674('0x18')](_0x3b38f1);}return _0xba493e['split']('.')[0x0];});};exports[_0xe674('0x80')]=function(_0x5887e8,_0x51e822,_0x2cee42,_0x534831,_0x53b23d,_0x269f8f){return aws['lex'](_0x5887e8,_0x51e822,_0x2cee42,_0x534831,_0x53b23d,_0x269f8f)[_0xe674('0x3a')](function(_0x4d92c8){logger[_0xe674('0x1d')](JSON[_0xe674('0x46')](_0x4d92c8));return _0x4d92c8;});};exports[_0xe674('0x81')]=function(_0x103cd3,_0xf263ab,_0x5ad317,_0x1a7264){var _0x677556=util[_0xe674('0x82')](_0xe674('0x83'),ISPEECH_API,_0x103cd3,encodeURIComponent(_0xf263ab),_0x5ad317,_0x1a7264);var _0x275e35=path[_0xe674('0x26')](__dirname,_0xe674('0x27'),rs[_0xe674('0x3b')](0x4)+'.mp3');var _0x5d0a39;return downloadFile(_0x677556,_0x275e35)['then'](function(){_0x5d0a39=path[_0xe674('0x26')](__dirname,'tmp',rs[_0xe674('0x3b')](0x4)+_0xe674('0x28'));return convertFile(_0x275e35,_0x5d0a39);})[_0xe674('0x3a')](function(){try{fs[_0xe674('0x20')](_0x275e35);fs[_0xe674('0x2b')](_0x5d0a39,_0xe674('0x2c'));}catch(_0x3884fb){logger[_0xe674('0x18')](_0x3884fb);}return _0x5d0a39[_0xe674('0x2d')]('.')[0x0];});};exports[_0xe674('0x84')]=function(_0x2ce4aa,_0x18130d,_0x1d3e4d,_0x44640b){var _0x2af6ec=util[_0xe674('0x82')](_0xe674('0x85'),ISPEECH_API,_0x18130d,_0x1d3e4d,base64Encode(_0x2ce4aa),_0x44640b?util['format']('model=%s',encodeURIComponent(_0x44640b)):'freeform=3');return uploadFile(_0x2af6ec)[_0xe674('0x3a')](function(_0x41d08c){return querystring[_0xe674('0xb')](_0x41d08c);});};exports[_0xe674('0x86')]=function(_0x341bf3,_0x4b88e6){return sestek[_0xe674('0x87')](_0x341bf3,_0x4b88e6)[_0xe674('0x3a')](function(_0x219ae4){logger[_0xe674('0x1d')](JSON[_0xe674('0x46')](_0x219ae4));var _0xac89d8={'speech':_0x219ae4[_0xe674('0x88')],'action':_0x219ae4[_0xe674('0x89')]?_0x219ae4[_0xe674('0x89')][_0xe674('0x8a')]:undefined,'actiondata':_0x219ae4[_0xe674('0x89')]?_0x219ae4[_0xe674('0x89')][_0xe674('0x8b')]:undefined};if(_0x219ae4[_0xe674('0x89')]&&_0x219ae4['channelData'][_0xe674('0x8c')]){return base64Decode(_0x219ae4[_0xe674('0x89')]['AudioFromTts'][_0xe674('0x8d')],path[_0xe674('0x26')](__dirname,'tmp',rs[_0xe674('0x3b')](0x4)+_0xe674('0x28')))[_0xe674('0x3a')](function(_0x370fcf){_0xac89d8['audiofile']=_0x370fcf;return _0xac89d8;});}return _0xac89d8;});};exports[_0xe674('0x8e')]=function(){return __dirname;}; \ No newline at end of file +var _0x9c51=['MP3','text:synthesize','POST','tmp','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','textRequest','source','result','action','actionIncomplete','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','WHAT_EVER','data','error\x20convert','info','finish\x20to\x20convert','resolve','generate','.wav','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig'];(function(_0x1c86b6,_0x25c477){var _0x2dbf1c=function(_0x3da651){while(--_0x3da651){_0x1c86b6['push'](_0x1c86b6['shift']());}};_0x2dbf1c(++_0x25c477);}(_0x9c51,0x1d7));var _0x19c5=function(_0xec3f52,_0x3f44a9){_0xec3f52=_0xec3f52-0x0;var _0x2c0a44=_0x9c51[_0xec3f52];return _0x2c0a44;};'use strict';var apiai=require(_0x19c5('0x0'));var BPromise=require(_0x19c5('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x19c5('0x2'));var md5=require(_0x19c5('0x3'));var path=require(_0x19c5('0x4'));var querystring=require(_0x19c5('0x5'));var rp=require(_0x19c5('0x6'));var rs=require(_0x19c5('0x7'));var sox=require(_0x19c5('0x8'));var tts=require(_0x19c5('0x9'));var urlParse=require(_0x19c5('0xa'))['parse'];var util=require(_0x19c5('0xb'));var aws=require(_0x19c5('0xc'));var google=require(_0x19c5('0xd'));var sestek=require(_0x19c5('0xe'));var tilde=require(_0x19c5('0xf'));var logger=require(_0x19c5('0x10'))('agi');var ISPEECH_API=_0x19c5('0x11');function downloadFile(_0x5c4a0e,_0x4190cf){return new BPromise(function(_0x486d6c,_0x212b75){var _0x217127=urlParse(_0x5c4a0e);var _0x1565f1=_0x217127['protocol']===_0x19c5('0x12')?https:http;var _0x427f10={'host':_0x217127['host'],'path':_0x217127['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x1565f1[_0x19c5('0x13')](_0x427f10,function(_0x4e20b1){if(_0x4e20b1['statusCode']!==0xc8){logger[_0x19c5('0x14')](_0x19c5('0x15')+_0x5c4a0e+_0x19c5('0x16')+_0x4e20b1[_0x19c5('0x17')]+'\x20('+_0x4e20b1[_0x19c5('0x18')]+')');_0x212b75(new Error(_0x19c5('0x15')+_0x5c4a0e+_0x19c5('0x16')+_0x4e20b1[_0x19c5('0x17')]+'\x20('+_0x4e20b1[_0x19c5('0x18')]+')'));return;}var _0x585b74=fs[_0x19c5('0x19')](_0x4190cf);_0x585b74['on'](_0x19c5('0x1a'),function(){logger['info'](_0x19c5('0x1b'));_0x585b74['close'](_0x486d6c);});_0x585b74['on']('error',function(_0xcc4ddb){fs[_0x19c5('0x1c')](_0x4190cf);logger[_0x19c5('0x14')](_0x19c5('0x1d'),_0xcc4ddb);_0x212b75(_0xcc4ddb);});_0x4e20b1[_0x19c5('0x1e')](_0x585b74);})['on'](_0x19c5('0x14'),function(_0x1b645f){logger['error'](_0x1b645f);_0x212b75(_0x1b645f);})[_0x19c5('0x1f')]();});}function uploadFile(_0x5bb639){return new BPromise(function(_0x4fa1eb,_0x2afcfc){var _0x5f3423=urlParse(_0x5bb639);var _0x3005ca=_0x5f3423['protocol']==='https:'?https:http;var _0x4ce705={'host':_0x5f3423[_0x19c5('0x20')],'path':_0x5f3423['path'],'headers':{'user-agent':_0x19c5('0x21')}};_0x3005ca[_0x19c5('0x13')](_0x4ce705,function(_0x5871b3){if(_0x5871b3[_0x19c5('0x17')]!==0xc8){_0x2afcfc(new Error(_0x19c5('0x15')+_0x5bb639+'\x20failed,\x20status\x20code\x20=\x20'+_0x5871b3[_0x19c5('0x17')]+'\x20('+_0x5871b3[_0x19c5('0x18')]+')'));return;}var _0x3c12b7='';_0x5871b3['on'](_0x19c5('0x22'),function(_0x200748){_0x3c12b7+=_0x200748;});_0x5871b3['on'](_0x19c5('0x1f'),function(){_0x4fa1eb(_0x3c12b7);});})['on'](_0x19c5('0x14'),function(_0x103f56){_0x2afcfc(_0x103f56);})[_0x19c5('0x1f')]();});}function convertFile(_0x576417,_0x35b1c6){return new BPromise(function(_0xe2cfdf,_0x89b68a){var _0x46f45e=sox['transcode'](_0x576417,_0x35b1c6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46f45e['on'](_0x19c5('0x14'),function(_0x17e10){logger[_0x19c5('0x14')](_0x19c5('0x23'),_0x17e10);_0x89b68a(_0x17e10);});_0x46f45e['on'](_0x19c5('0x1f'),function(){logger[_0x19c5('0x24')](_0x19c5('0x25'));_0xe2cfdf();});_0x46f45e['start']();});}function base64Decode(_0x120700,_0x410fa6){var _0x2a48e7=path[_0x19c5('0x26')](__dirname,'tmp',rs[_0x19c5('0x27')](0x4)+_0x19c5('0x28'));fs['writeFileSync'](_0x2a48e7,_0x120700,_0x19c5('0x29'));return convertFile(_0x2a48e7,_0x410fa6)[_0x19c5('0x2a')](function(){try{fs[_0x19c5('0x1c')](_0x2a48e7);fs[_0x19c5('0x2b')](_0x410fa6,_0x19c5('0x2c'));}catch(_0x38f216){logger[_0x19c5('0x14')](_0x38f216);}return _0x410fa6[_0x19c5('0x2d')]('.')[0x0];});}function base64Encode(_0x49b5ef){var _0x1c1b14=fs['readFileSync'](_0x49b5ef);return new Buffer(_0x1c1b14)[_0x19c5('0x2e')](_0x19c5('0x29'));}exports[_0x19c5('0x2f')]=function(_0x5e7e5e,_0x1d7e97,_0x335aa4,_0x3bb153,_0xdf94a,_0x202f13){var _0x180676,_0x183d71;var _0x49d2c9=_0x19c5('0x30');var _0x4688b8=_0x19c5('0x31')+_0x5e7e5e;var _0x538b4a={};if(_0x1d7e97==='ssml'){_0x538b4a[_0x19c5('0x32')]={'ssml':_0x335aa4};}else{_0x538b4a[_0x19c5('0x32')]={'text':_0x335aa4};};_0x538b4a[_0x19c5('0x33')]={'languageCode':_0x3bb153,'ssmlGender':_0xdf94a};_0x538b4a[_0x19c5('0x34')]={'audioEncoding':_0x19c5('0x35'),'sampleRateHertz':0x1f40};var _0x5da802={'url':_0x49d2c9+_0x19c5('0x36')+_0x4688b8,'method':_0x19c5('0x37'),'json':!![],'body':_0x538b4a};return rp(_0x5da802)[_0x19c5('0x2a')](function(_0x225377){return new BPromise(function(_0x4c78d7,_0x2e9929){_0x180676=path['resolve'](__dirname,_0x19c5('0x38'),rs[_0x19c5('0x27')](0x4)+_0x19c5('0x39'));var _0x833792=Buffer[_0x19c5('0x3a')](_0x225377['audioContent'],'base64');return fs[_0x19c5('0x3b')](_0x180676,_0x833792,function(_0x526610){_0x2e9929(_0x526610);},function(_0x5ed6a6){fs[_0x19c5('0x2b')](_0x180676,_0x19c5('0x2c'));_0x4c78d7(_0x5ed6a6);});});})[_0x19c5('0x2a')](function(_0x4775d9){_0x183d71=path[_0x19c5('0x26')](__dirname,'tmp',rs[_0x19c5('0x27')](0x4)+'.wav');return convertFile(_0x180676,_0x183d71);})['then'](function(){try{fs['unlink'](_0x180676);fs[_0x19c5('0x2b')](_0x183d71,_0x19c5('0x2c'));}catch(_0x346554){logger[_0x19c5('0x14')](_0x346554);}logger['info'](_0x19c5('0x3c'),_0x183d71['split']('.')[0x0]);return _0x183d71[_0x19c5('0x2d')]('.')[0x0];});};exports[_0x19c5('0x3d')]=function(_0x28b14c,_0x2a137a){var _0x566728=_0x19c5('0x3e');var _0x158947,_0x4fe9b;var _0x375556;var _0x5a2441={'encoding':_0x19c5('0x3f'),'method':'POST','timeout':0x2710,'url':_0x566728,'headers':{'Content-Type':_0x19c5('0x40')},'body':_0x19c5('0x41')+encodeURIComponent(JSON[_0x19c5('0x42')]([[[_0x19c5('0x43'),JSON[_0x19c5('0x42')]([_0x28b14c,_0x2a137a||'en',![],_0x19c5('0x44')]),null,'generic']]]))};return rp(_0x5a2441)[_0x19c5('0x2a')](function(_0x1fc2d9){try{_0x375556=eval(_0x1fc2d9['slice'](0x5))[0x0][0x2];}catch(_0x87d35a){throw new Error(_0x19c5('0x45')+_0x1fc2d9[_0x19c5('0x22')]);}if(!_0x375556){if(_0x28b14c[_0x19c5('0x46')]>0xc8){throw new Error(_0x19c5('0x47'));}else{throw new Error('lang\x20\x22'+_0x2a137a+_0x19c5('0x48'));}}try{_0x375556=eval(_0x375556)[0x0];}catch(_0x21aad1){throw new Error(_0x19c5('0x45')+res[_0x19c5('0x22')]);}const _0x43dcd5=_0x375556;_0x158947=path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs['generate'](0x4)+_0x19c5('0x39'));fs[_0x19c5('0x49')](_0x158947,_0x375556,{'encoding':_0x19c5('0x29')});_0x4fe9b=path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs['generate'](0x4)+'.wav');return convertFile(_0x158947,_0x4fe9b);})[_0x19c5('0x2a')](function(){try{fs[_0x19c5('0x1c')](_0x158947);fs['chmodSync'](_0x4fe9b,_0x19c5('0x2c'));}catch(_0x27cff6){logger[_0x19c5('0x14')](_0x27cff6);}logger[_0x19c5('0x24')](_0x19c5('0x4a'),_0x4fe9b[_0x19c5('0x2d')]('.')[0x0]);return _0x4fe9b['split']('.')[0x0];});};exports['googleASR']=function(_0x316207,_0xc5e9cd,_0x5a8f96){return google[_0x19c5('0x4b')](_0x316207,_0xc5e9cd,_0x5a8f96)[_0x19c5('0x2a')](function(_0xe8d22a){logger['info'](_0xe8d22a['uri']);return rp(_0xe8d22a);})[_0x19c5('0x2a')](function(_0x5bc598){var _0x4bca42='';var _0x1d9e0e=0x0;try{fs[_0x19c5('0x1c')](_0x316207);}catch(_0x4ce526){logger[_0x19c5('0x14')](_0x4ce526);}if(_0x5bc598&&_0x5bc598[_0x19c5('0x4c')]){_0x4bca42=_0x5bc598['results']['map'](function(_0x4fa92f){return _0x4fa92f&&_0x4fa92f[_0x19c5('0x4d')][0x0]&&_0x4fa92f[_0x19c5('0x4d')][0x0][_0x19c5('0x4e')]?_0x4fa92f[_0x19c5('0x4d')][0x0][_0x19c5('0x4e')]:'';})[_0x19c5('0x4f')]('\x0a');_0x1d9e0e=_0x5bc598[_0x19c5('0x4c')][_0x19c5('0x50')](function(_0x1467c3){return _0x1467c3&&_0x1467c3[_0x19c5('0x4d')][0x0]&&_0x1467c3[_0x19c5('0x4d')][0x0][_0x19c5('0x51')]?_0x1467c3['alternatives'][0x0][_0x19c5('0x51')]:0x0;})['join']('\x0a');}logger['info'](_0x19c5('0x52'),_0x4bca42);logger[_0x19c5('0x24')](_0x19c5('0x53'),_0x1d9e0e);return{'transcript':_0x4bca42,'confidence':_0x1d9e0e};})['catch'](function(_0x46a106){logger[_0x19c5('0x14')](_0x19c5('0x54'),_0x46a106['statusCode'],_0x46a106[_0x19c5('0x55')],_0x46a106['message']);});};exports['googleDialogflow']=function(_0x58609e,_0x52ee61,_0xcd7bc7,_0x23cfc7){var _0xcc13cc=apiai(_0x52ee61,{'language':_0x23cfc7||'en'});return _0xcc13cc[_0x19c5('0x56')](_0xcd7bc7,{'sessionId':md5(_0x58609e)})[_0x19c5('0x2a')](function(_0x46a5a0){logger[_0x19c5('0x24')](JSON[_0x19c5('0x42')](_0x46a5a0));return{'source':_0x46a5a0['result'][_0x19c5('0x57')],'resolvedQuery':_0x46a5a0[_0x19c5('0x58')]['resolvedQuery'],'action':_0x46a5a0[_0x19c5('0x58')][_0x19c5('0x59')],'actionIncomplete':_0x46a5a0[_0x19c5('0x58')][_0x19c5('0x5a')],'speech':_0x46a5a0[_0x19c5('0x58')]['fulfillment']['speech'],'score':_0x46a5a0[_0x19c5('0x58')]['score'],'statusCode':_0x46a5a0[_0x19c5('0x5b')][_0x19c5('0x5c')],'endConversation':_0x46a5a0[_0x19c5('0x58')]['metadata'][_0x19c5('0x5d')]||![],'isFallbackIntent':_0x46a5a0['result'][_0x19c5('0x5e')][_0x19c5('0x5f')]};});};exports[_0x19c5('0x60')]=function(_0x677d86,_0x48b81a,_0x10b7af,_0x5cd274,_0x13501d,_0x248d8e){var _0x27b987=_0x5cd274[_0x19c5('0x61')](/\\n/g,'\x0a');var _0x50eaf7={'credentials':{'private_key':_0x27b987,'client_email':_0x10b7af}};var _0x4cd7c4=new dialogflow[(_0x19c5('0x62'))](_0x50eaf7);var _0x15ad84=_0x4cd7c4[_0x19c5('0x63')](_0x48b81a,md5(_0x677d86));var _0x4b6f4d={'session':_0x15ad84,'queryInput':{'text':{'text':_0x13501d,'languageCode':_0x248d8e}}};return _0x4cd7c4[_0x19c5('0x64')](_0x4b6f4d)['then'](function(_0x219625){if(_0x219625&&_0x219625[_0x19c5('0x46')]){logger[_0x19c5('0x24')](_0x19c5('0x65'),JSON[_0x19c5('0x42')](_0x219625));var _0x2bf0b2=_0x219625[0x0];if(_0x2bf0b2){var _0x2d1ed5={'action':_0x2bf0b2[_0x19c5('0x66')][_0x19c5('0x59')],'allRequiredParamsPresent':_0x2bf0b2[_0x19c5('0x66')]['allRequiredParamsPresent'],'endConversation':_0x2bf0b2['queryResult'][_0x19c5('0x67')]&&_0x2bf0b2['queryResult'][_0x19c5('0x67')][_0x19c5('0x68')]?_0x2bf0b2['queryResult'][_0x19c5('0x67')]['fields'][_0x19c5('0x69')]['boolValue']:![],'fulfillmentText':_0x2bf0b2['queryResult'][_0x19c5('0x6a')],'intentName':_0x2bf0b2[_0x19c5('0x66')]['intent'][_0x19c5('0x55')],'intentDisplayName':_0x2bf0b2[_0x19c5('0x66')][_0x19c5('0x6b')][_0x19c5('0x6c')],'isFallbackIntent':_0x2bf0b2[_0x19c5('0x66')][_0x19c5('0x6b')][_0x19c5('0x6d')],'languageCode':_0x2bf0b2[_0x19c5('0x66')][_0x19c5('0x6e')],'queryText':_0x2bf0b2[_0x19c5('0x66')]['queryText'],'responseId':_0x2bf0b2['responseId'],'score':_0x2bf0b2['queryResult'][_0x19c5('0x6f')],'speech':_0x2bf0b2[_0x19c5('0x66')][_0x19c5('0x6a')],'providerResponse':JSON[_0x19c5('0x42')](_0x219625)};return _0x2d1ed5;}}});};exports[_0x19c5('0x70')]=function(_0x3e05ac,_0x21d076,_0x2ee982,_0x1b2677){return tilde[_0x19c5('0x4b')](_0x3e05ac,_0x21d076,_0x2ee982,_0x1b2677)[_0x19c5('0x2a')](function(_0x19b6a4){try{fs['unlink'](_0x3e05ac);}catch(_0xc3b799){logger['error'](_0xc3b799);}logger[_0x19c5('0x24')]('Tilde\x20ASR\x20transcription',_0x19b6a4[_0x19c5('0x4e')]);logger[_0x19c5('0x24')](_0x19c5('0x71'),_0x19b6a4[_0x19c5('0x51')]);return _0x19b6a4;});};exports[_0x19c5('0x72')]=function(_0x1a7029,_0x2e3300,_0x11c181,_0x5db187,_0x261ca6,_0x3ab556){var _0x4fe6df=path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs[_0x19c5('0x27')](0x4)+_0x19c5('0x39'));var _0x10a3f8;return aws[_0x19c5('0x73')](_0x1a7029,_0x2e3300,_0x11c181,_0x5db187,_0x261ca6,_0x3ab556,_0x4fe6df)[_0x19c5('0x2a')](function(){_0x10a3f8=path[_0x19c5('0x26')](__dirname,'tmp',rs[_0x19c5('0x27')](0x4)+_0x19c5('0x28'));return convertFile(_0x4fe6df,_0x10a3f8);})[_0x19c5('0x2a')](function(){try{fs['unlink'](_0x4fe6df);fs[_0x19c5('0x2b')](_0x10a3f8,_0x19c5('0x2c'));}catch(_0x2ab43b){logger[_0x19c5('0x14')](_0x2ab43b);}return _0x10a3f8[_0x19c5('0x2d')]('.')[0x0];});};exports[_0x19c5('0x74')]=function(_0x27ebff,_0x220464,_0x425c7a,_0x19b33f,_0x23d21f,_0x30bee1){return aws['lex'](_0x27ebff,_0x220464,_0x425c7a,_0x19b33f,_0x23d21f,_0x30bee1)['then'](function(_0x164c48){logger['info'](JSON['stringify'](_0x164c48));return _0x164c48;});};exports[_0x19c5('0x75')]=function(_0x5c57ac,_0x44fb44,_0x1ee305,_0x291700){var _0xba54db=util[_0x19c5('0x76')](_0x19c5('0x77'),ISPEECH_API,_0x5c57ac,encodeURIComponent(_0x44fb44),_0x1ee305,_0x291700);var _0x5b6dc5=path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs[_0x19c5('0x27')](0x4)+_0x19c5('0x39'));var _0x549bf8;return downloadFile(_0xba54db,_0x5b6dc5)[_0x19c5('0x2a')](function(){_0x549bf8=path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs[_0x19c5('0x27')](0x4)+_0x19c5('0x28'));return convertFile(_0x5b6dc5,_0x549bf8);})[_0x19c5('0x2a')](function(){try{fs[_0x19c5('0x1c')](_0x5b6dc5);fs['chmodSync'](_0x549bf8,_0x19c5('0x2c'));}catch(_0x2c8785){logger['error'](_0x2c8785);}return _0x549bf8[_0x19c5('0x2d')]('.')[0x0];});};exports[_0x19c5('0x78')]=function(_0x1e6442,_0x402341,_0x112814,_0x2a4b81){var _0x33deae=util[_0x19c5('0x76')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x402341,_0x112814,base64Encode(_0x1e6442),_0x2a4b81?util[_0x19c5('0x76')]('model=%s',encodeURIComponent(_0x2a4b81)):_0x19c5('0x79'));return uploadFile(_0x33deae)[_0x19c5('0x2a')](function(_0x4fe999){return querystring['parse'](_0x4fe999);});};exports[_0x19c5('0x7a')]=function(_0x2d96e7,_0x1d87d0){return sestek[_0x19c5('0x7b')](_0x2d96e7,_0x1d87d0)['then'](function(_0x3bcb4d){logger[_0x19c5('0x24')](JSON[_0x19c5('0x42')](_0x3bcb4d));var _0x34dc20={'speech':_0x3bcb4d[_0x19c5('0x7c')],'action':_0x3bcb4d[_0x19c5('0x7d')]?_0x3bcb4d[_0x19c5('0x7d')][_0x19c5('0x7e')]:undefined,'actiondata':_0x3bcb4d[_0x19c5('0x7d')]?_0x3bcb4d[_0x19c5('0x7d')][_0x19c5('0x7f')]:undefined};if(_0x3bcb4d[_0x19c5('0x7d')]&&_0x3bcb4d[_0x19c5('0x7d')][_0x19c5('0x80')]){return base64Decode(_0x3bcb4d[_0x19c5('0x7d')][_0x19c5('0x80')][_0x19c5('0x81')],path[_0x19c5('0x26')](__dirname,_0x19c5('0x38'),rs['generate'](0x4)+'.wav'))[_0x19c5('0x2a')](function(_0x552e7e){_0x34dc20[_0x19c5('0x82')]=_0x552e7e;return _0x34dc20;});}return _0x34dc20;});};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 b3a9e35..825646a 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 _0x8447=['./nda'];(function(_0x339da2,_0x3aa23a){var _0x4c6e10=function(_0x32b601){while(--_0x32b601){_0x339da2['push'](_0x339da2['shift']());}};_0x4c6e10(++_0x3aa23a);}(_0x8447,0xc4));var _0x7844=function(_0x3dc7f9,_0x1becad){_0x3dc7f9=_0x3dc7f9-0x0;var _0x2a8588=_0x8447[_0x3dc7f9];return _0x2a8588;};var nda=require(_0x7844('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xad96=['exports','./nda'];(function(_0x56500a,_0x5953c7){var _0x333977=function(_0x374007){while(--_0x374007){_0x56500a['push'](_0x56500a['shift']());}};_0x333977(++_0x5953c7);}(_0xad96,0x1cd));var _0x6ad9=function(_0x4aec96,_0x17ad53){_0x4aec96=_0x4aec96-0x0;var _0x547876=_0xad96[_0x4aec96];return _0x547876;};var nda=require(_0x6ad9('0x0'));module[_0x6ad9('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 71c874b..6dfc5c8 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 _0xcf14=['Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x2e752c,_0x45e3bd){var _0x3c56c0=function(_0x5a6de9){while(--_0x5a6de9){_0x2e752c['push'](_0x2e752c['shift']());}};_0x3c56c0(++_0x45e3bd);}(_0xcf14,0xa1));var _0x4cf1=function(_0x321110,_0x2d6ae5){_0x321110=_0x321110-0x0;var _0x167369=_0xcf14[_0x321110];return _0x167369;};'use strict';var rp=require(_0x4cf1('0x0'));var url=require('url');var logger=require(_0x4cf1('0x1'))(_0x4cf1('0x2'));module['exports']=function(_0x3401df,_0x15f9b9){var _0x46add7={'method':_0x4cf1('0x3'),'uri':url['resolve'](_0x15f9b9[_0x4cf1('0x4')],_0x4cf1('0x5')),'form':{'grant_type':_0x4cf1('0x6'),'username':_0x15f9b9[_0x4cf1('0x7')],'password':_0x15f9b9[_0x4cf1('0x6')]},'json':!![]};return rp(_0x46add7)[_0x4cf1('0x8')](function(_0x9efe60){var _0x50273f={'method':_0x4cf1('0x3'),'uri':url[_0x4cf1('0x9')](_0x15f9b9[_0x4cf1('0xa')],_0x4cf1('0xb')),'body':{'type':_0x15f9b9[_0x4cf1('0xc')]||_0x4cf1('0xd'),'channelId':_0x4cf1('0xe'),'conversation':{'id':_0x3401df[_0x4cf1('0xf')]},'from':{'id':_0x3401df[_0x4cf1('0x10')],'name':_0x3401df[_0x4cf1('0x11')]},'recipient':{'id':_0x3401df[_0x4cf1('0x12')],'name':_0x3401df[_0x4cf1('0x13')]},'text':_0x15f9b9[_0x4cf1('0x14')],'channelData':{}},'headers':{'Authorization':_0x4cf1('0x15')+_0x9efe60['access_token']},'json':!![]};if(_0x15f9b9[_0x4cf1('0x16')]){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x19')]=_0x15f9b9[_0x4cf1('0x16')];}if(_0x15f9b9[_0x4cf1('0x1a')]=='1'){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4cf1('0x1c')};}if(_0x15f9b9[_0x4cf1('0x1d')]){_0x50273f[_0x4cf1('0x17')][_0x4cf1('0x18')][_0x4cf1('0x1e')]=_0x15f9b9[_0x4cf1('0x1d')];if(_0x15f9b9['custom_action_data']){_0x50273f[_0x4cf1('0x17')]['channelData'][_0x4cf1('0x1f')]=_0x15f9b9[_0x4cf1('0x20')];}}logger[_0x4cf1('0x21')](JSON[_0x4cf1('0x22')](_0x50273f));return rp(_0x50273f);});}; \ No newline at end of file +var _0xc91b=['resolve','ndauth_url','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','dnid','extension','access_token','channelData','ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','body','CustomAction','custom_action','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xc91b,0x16f));var _0xbc91=function(_0x57b5d2,_0x1221b1){_0x57b5d2=_0x57b5d2-0x0;var _0x346161=_0xc91b[_0x57b5d2];return _0x346161;};'use strict';var rp=require(_0xbc91('0x0'));var url=require(_0xbc91('0x1'));var logger=require(_0xbc91('0x2'))(_0xbc91('0x3'));module[_0xbc91('0x4')]=function(_0xb4810d,_0x1ac340){var _0x16ae0f={'method':'POST','uri':url[_0xbc91('0x5')](_0x1ac340[_0xbc91('0x6')],'/token'),'form':{'grant_type':_0xbc91('0x7'),'username':_0x1ac340[_0xbc91('0x8')],'password':_0x1ac340['password']},'json':!![]};return rp(_0x16ae0f)[_0xbc91('0x9')](function(_0x43731a){var _0x36e15f={'method':_0xbc91('0xa'),'uri':url[_0xbc91('0x5')](_0x1ac340[_0xbc91('0xb')],_0xbc91('0xc')),'body':{'type':_0x1ac340['ndaactivity_type']||_0xbc91('0xd'),'channelId':_0xbc91('0xe'),'conversation':{'id':_0xb4810d[_0xbc91('0xf')]},'from':{'id':_0xb4810d['callerid'],'name':_0xb4810d['calleridname']},'recipient':{'id':_0xb4810d[_0xbc91('0x10')],'name':_0xb4810d[_0xbc91('0x11')]},'text':_0x1ac340['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x43731a[_0xbc91('0x12')]},'json':!![]};if(_0x1ac340['project']){_0x36e15f['body'][_0xbc91('0x13')][_0xbc91('0x14')]=_0x1ac340[_0xbc91('0x15')];}if(_0x1ac340[_0xbc91('0x16')]=='1'){_0x36e15f['body']['channelData'][_0xbc91('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xbc91('0x18')};}if(_0x1ac340['custom_action']){_0x36e15f[_0xbc91('0x19')][_0xbc91('0x13')][_0xbc91('0x1a')]=_0x1ac340[_0xbc91('0x1b')];if(_0x1ac340[_0xbc91('0x1c')]){_0x36e15f[_0xbc91('0x19')][_0xbc91('0x13')][_0xbc91('0x1d')]=_0x1ac340[_0xbc91('0x1c')];}}logger['info'](JSON[_0xbc91('0x1e')](_0x36e15f));return rp(_0x36e15f);});}; \ 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 5196564..6065c50 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 _0x1ecd=['./lib/api','exports'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x1ecd,0xee));var _0xd1ec=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0x1ecd[_0x561e73];return _0x2dc60d;};'use strict';var asr=require(_0xd1ec('0x0'));module[_0xd1ec('0x1')]=function(_0x12ea92,_0x35c49d,_0xf415cc,_0x3adc8a){return asr(_0x12ea92,_0x35c49d,_0xf415cc,_0x3adc8a);}; \ No newline at end of file +var _0x8bcf=['./lib/api'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x8bcf,0xa5));var _0xf8bc=function(_0x29bfc1,_0x181aea){_0x29bfc1=_0x29bfc1-0x0;var _0x35bb2e=_0x8bcf[_0x29bfc1];return _0x35bb2e;};'use strict';var asr=require(_0xf8bc('0x0'));module['exports']=function(_0x3d5d7f,_0x3c6d86,_0x3ea658,_0x3e50e3){return asr(_0x3d5d7f,_0x3c6d86,_0x3ea658,_0x3e50e3);}; \ 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 1b12d8b..92e2b11 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 _0x7083=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','Tilde\x20ASR\x20send\x20error','stringify','terminate','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7083,0x13a));var _0x3708=function(_0x1cf9f0,_0x27631f){_0x1cf9f0=_0x1cf9f0-0x0;var _0x5b4fbe=_0x7083[_0x1cf9f0];return _0x5b4fbe;};'use strict';var BPromise=require(_0x3708('0x0'));var _=require(_0x3708('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3708('0x2'));var crypto=require('crypto');var logger=require(_0x3708('0x3'))(_0x3708('0x4'));module[_0x3708('0x5')]=function(_0x4c5c8f,_0x5ac8be,_0x3778de,_0x265d18){return new BPromise(function(_0x3d298f,_0x297896){logger[_0x3708('0x6')](_0x3708('0x7'),_0x265d18||_0x3708('0x8'));var _0x148961=new WebSocket(_0x265d18||_0x3708('0x8'),{'perMessageDeflate':![]});var _0x139ae7='';var _0x10c177='0';var _0x55783f='1';var _0x4fa291=_0x3708('0x9');function _0x5640d9(_0x8d2dbd){var _0x1be315=crypto['createHash']('sha1');_0x1be315[_0x3708('0xa')](_0x8d2dbd);return _0x1be315[_0x3708('0xb')](_0x3708('0xc'));}function _0x25c80a(){try{logger[_0x3708('0x6')](_0x3708('0xd'));var _0xbc5334=moment()[_0x3708('0xe')]();var _0x46f9e9=_0x5640d9(_0xbc5334+_0x5ac8be+_0x3778de);_0x148961['send'](JSON['stringify']({'appID':_0x5ac8be,'timestamp':_0xbc5334,'appKey':_0x46f9e9}));var _0x1f2a3c=fs[_0x3708('0xf')](_0x4c5c8f);_0x1f2a3c['on'](_0x3708('0x10'),function(_0x5bc5f6){_0x148961[_0x3708('0x11')](_0x5bc5f6);});_0x1f2a3c['on']('close',function(){_0x148961['send']('EOS');});}catch(_0x9b294f){logger['error'](_0x3708('0x12'),JSON[_0x3708('0x13')](_0x9b294f));_0x148961[_0x3708('0x14')]();}}function _0x275eab(_0x736b94){try{if(_0x736b94){var _0x17c491=JSON['parse'](_0x736b94);switch(_0x17c491['status']){case 0x0:if(_0x17c491['result']){if(_0x17c491['result'][_0x3708('0x15')]){logger['info'](_0x3708('0x16'),JSON['stringify'](_0x17c491[_0x3708('0x17')][_0x3708('0x18')]));_0x139ae7=_0x17c491['result']['hypotheses'][0x0]['transcript'];_0x10c177=_0x17c491[_0x3708('0x17')][_0x3708('0x18')][0x0][_0x3708('0x19')];_0x55783f='0';_0x4fa291='Success.';_0x148961[_0x3708('0x14')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x55783f='1';_0x4fa291='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x3708('0x6')](_0x3708('0x1a'));_0x55783f='2';_0x4fa291=_0x3708('0x1a');break;case 0x9:logger[_0x3708('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x55783f='9';_0x4fa291=_0x3708('0x1b');break;case 0xa:logger['info']('Authentication\x20failed.');_0x55783f='10';_0x4fa291=_0x3708('0x1c');break;case 0xb:logger['info'](_0x3708('0x1d'));_0x55783f='11';_0x4fa291=_0x3708('0x1d');}}}catch(_0x3a67d0){logger[_0x3708('0x1e')](_0x3708('0x1f'),JSON[_0x3708('0x13')](_0x3a67d0));_0x148961[_0x3708('0x14')]();}}function _0x32a823(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x3d298f({'transcript':_0x139ae7,'confidence':_0x10c177,'status':_0x55783f,'status_message':_0x4fa291});}function _0x41cd7f(_0x47fce3){logger[_0x3708('0x1e')](_0x3708('0x20'));if(!_[_0x3708('0x21')](_0x47fce3)){logger[_0x3708('0x1e')](_[_0x3708('0x22')](_0x47fce3)?JSON[_0x3708('0x13')](_0x47fce3):_0x47fce3);}}_0x148961['on'](_0x3708('0x23'),_0x25c80a);_0x148961['on'](_0x3708('0x24'),_0x275eab);_0x148961['on'](_0x3708('0x25'),_0x32a823);_0x148961['on'](_0x3708('0x1e'),_0x41cd7f);});}; \ No newline at end of file +var _0x476e=['All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','close','lodash','moment','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','send','EOS','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x476e,0x118));var _0xe476=function(_0xfabddd,_0x214333){_0xfabddd=_0xfabddd-0x0;var _0x5d5a22=_0x476e[_0xfabddd];return _0x5d5a22;};'use strict';var BPromise=require('bluebird');var _=require(_0xe476('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe476('0x1'));var crypto=require('crypto');var logger=require(_0xe476('0x2'))(_0xe476('0x3'));module[_0xe476('0x4')]=function(_0x27528f,_0xcd24d9,_0x3ba84e,_0x121b24){return new BPromise(function(_0x42fb1f,_0x756611){logger['info'](_0xe476('0x5'),_0x121b24||_0xe476('0x6'));var _0x36e6d3=new WebSocket(_0x121b24||_0xe476('0x6'),{'perMessageDeflate':![]});var _0x1b0726='';var _0x1a533b='0';var _0x5d77d8='1';var _0x45edfa='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5156eb(_0x401547){var _0x41df94=crypto['createHash'](_0xe476('0x7'));_0x41df94[_0xe476('0x8')](_0x401547);return _0x41df94['digest']('hex');}function _0x43e466(){try{logger[_0xe476('0x9')](_0xe476('0xa'));var _0x7b7e84=moment()[_0xe476('0xb')]();var _0x1cc498=_0x5156eb(_0x7b7e84+_0xcd24d9+_0x3ba84e);_0x36e6d3['send'](JSON[_0xe476('0xc')]({'appID':_0xcd24d9,'timestamp':_0x7b7e84,'appKey':_0x1cc498}));var _0x3d7e83=fs[_0xe476('0xd')](_0x27528f);_0x3d7e83['on']('data',function(_0x16900f){_0x36e6d3[_0xe476('0xe')](_0x16900f);});_0x3d7e83['on']('close',function(){_0x36e6d3[_0xe476('0xe')](_0xe476('0xf'));});}catch(_0x59a98a){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xe476('0xc')](_0x59a98a));_0x36e6d3[_0xe476('0x10')]();}}function _0x5127b5(_0x44d00d){try{if(_0x44d00d){var _0xb24cc8=JSON['parse'](_0x44d00d);switch(_0xb24cc8[_0xe476('0x11')]){case 0x0:if(_0xb24cc8['result']){if(_0xb24cc8[_0xe476('0x12')]['final']){logger[_0xe476('0x9')](_0xe476('0x13'),JSON[_0xe476('0xc')](_0xb24cc8['result'][_0xe476('0x14')]));_0x1b0726=_0xb24cc8[_0xe476('0x12')][_0xe476('0x14')][0x0][_0xe476('0x15')];_0x1a533b=_0xb24cc8[_0xe476('0x12')][_0xe476('0x14')][0x0]['likelihood'];_0x5d77d8='0';_0x45edfa='Success.';_0x36e6d3[_0xe476('0x10')]();}}break;case 0x1:logger[_0xe476('0x9')](_0xe476('0x16'));_0x5d77d8='1';_0x45edfa=_0xe476('0x16');break;case 0x2:logger[_0xe476('0x9')](_0xe476('0x17'));_0x5d77d8='2';_0x45edfa='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xe476('0x18'));_0x5d77d8='9';_0x45edfa=_0xe476('0x18');break;case 0xa:logger[_0xe476('0x9')](_0xe476('0x19'));_0x5d77d8='10';_0x45edfa=_0xe476('0x19');break;case 0xb:logger[_0xe476('0x9')](_0xe476('0x1a'));_0x5d77d8='11';_0x45edfa=_0xe476('0x1a');}}}catch(_0x3bcf15){logger[_0xe476('0x1b')](_0xe476('0x1c'),JSON[_0xe476('0xc')](_0x3bcf15));_0x36e6d3['terminate']();}}function _0x518a4a(){logger[_0xe476('0x9')](_0xe476('0x1d'));_0x42fb1f({'transcript':_0x1b0726,'confidence':_0x1a533b,'status':_0x5d77d8,'status_message':_0x45edfa});}function _0xc7a36f(_0xcc839d){logger['error'](_0xe476('0x1e'));if(!_['isNil'](_0xcc839d)){logger[_0xe476('0x1b')](_['isObject'](_0xcc839d)?JSON['stringify'](_0xcc839d):_0xcc839d);}}_0x36e6d3['on'](_0xe476('0x1f'),_0x43e466);_0x36e6d3['on'](_0xe476('0x20'),_0x5127b5);_0x36e6d3['on'](_0xe476('0x21'),_0x518a4a);_0x36e6d3['on'](_0xe476('0x1b'),_0xc7a36f);});}; \ 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 43f8657..f319b65 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 _0xb45a=['./asr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb45a,0x1b8));var _0xab45=function(_0x304e0e,_0x2654a3){_0x304e0e=_0x304e0e-0x0;var _0x4449c8=_0xb45a[_0x304e0e];return _0x4449c8;};var asr=require(_0xab45('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xa436=['./asr'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa436,0x197));var _0x6a43=function(_0x4cdf27,_0x524510){_0x4cdf27=_0x4cdf27-0x0;var _0x59899d=_0xa436[_0x4cdf27];return _0x59899d;};var asr=require(_0x6a43('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 57f1135..2a5fd89 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x4e7844,_0x30ce77){var _0x336119=function(_0x508b1c){while(--_0x508b1c){_0x4e7844['push'](_0x4e7844['shift']());}};_0x336119(++_0x30ce77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0xe706,0xa3));var _0x6e70=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0xe706[_0x31282b];return _0x19c632;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index a40b3c2..5026b4a 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 _0xf120=['agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','no\x20text\x20configured','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','test','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','generate','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','200','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','no\x20variable\x20selected','join','exports','lodash','shelljs','odbc','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority'];(function(_0xf31e1b,_0x25b001){var _0x4dbd7a=function(_0x507f73){while(--_0x507f73){_0xf31e1b['push'](_0xf31e1b['shift']());}};_0x4dbd7a(++_0x25b001);}(_0xf120,0x179));var _0x0f12=function(_0x565bf8,_0x228031){_0x565bf8=_0x565bf8-0x0;var _0x2a10db=_0xf120[_0x565bf8];return _0x2a10db;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x0f12('0x0'));var sh=require(_0x0f12('0x1'));var odbc=require(_0x0f12('0x2'))();var rs=require('randomstring');var moment=require(_0x0f12('0x3'));var Mustache=require(_0x0f12('0x4'));var rp=require(_0x0f12('0x5'));var logger=require('../../config/logger')(_0x0f12('0x6'));var config=require(_0x0f12('0x7'));var scripts=require(_0x0f12('0x8'));var FILES_PATH=_0x0f12('0x9');var recursiveMapAttributes=[_0x0f12('0xa'),_0x0f12('0xb')];var verticesWithRetry=[_0x0f12('0xc'),_0x0f12('0xd'),'getsecretdigits'];var AGIVertices=function(_0x3e240d,_0x4bbb62,_0x3b909b){this[_0x0f12('0xe')]=_0x3e240d;this[_0x0f12('0xf')]=_0x4bbb62;this['mailRpc']=_0x3b909b;};AGIVertices['prototype'][_0x0f12('0x10')]=function(_0x2e18a1,_0x728460){this[_0x0f12('0xf')][_0x0f12('0x11')](_0x2e18a1)[_0x0f12('0x12')](function(_0x2d974a){_0x728460(null,_0x2d974a?_0x2d974a['name']:![]);})[_0x0f12('0x13')](function(_0x11a236){_0x728460(_0x11a236);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x15')]=function(_0x22f390,_0xc019be){this[_0x0f12('0xf')][_0x0f12('0x16')](_0x22f390)[_0x0f12('0x12')](function(_0x42b674){_0xc019be(null,_0x42b674?_0x42b674[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0xe61624){_0xc019be(_0xe61624);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x18')]=function(_0x592617,_0x1db207){this['rpc'][_0x0f12('0x19')](_0x592617)[_0x0f12('0x12')](function(_0x28119e){_0x1db207(null,_0x28119e?_0x28119e[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0xa2168f){_0x1db207(_0xa2168f);});};AGIVertices['prototype'][_0x0f12('0x1a')]=function(_0x48d56a,_0x18d689){this['rpc']['getSquareOdbcById'](_0x48d56a)[_0x0f12('0x12')](function(_0x7628f6){_0x18d689(null,_0x7628f6?_0x7628f6[_0x0f12('0x1b')]:![]);})['catch'](function(_0x10a325){_0x18d689(_0x10a325);});};AGIVertices['prototype'][_0x0f12('0x1c')]=function(_0x5b8598,_0x9f283b){this[_0x0f12('0xf')]['getUserById'](_0x5b8598)[_0x0f12('0x12')](function(_0x454477){_0x9f283b(null,_0x454477?_0x454477[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0x44f3b1){_0x9f283b(_0x44f3b1);});};AGIVertices['prototype'][_0x0f12('0x1d')]=function(_0x534b01,_0x4c3a28){this['rpc'][_0x0f12('0x1e')](_0x534b01)[_0x0f12('0x12')](function(_0xa67a43){_0x4c3a28(null,_0xa67a43?_0xa67a43[_0x0f12('0x17')]:![]);})['catch'](function(_0x310c03){_0x4c3a28(_0x310c03);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1f')]=function(_0x5ca297,_0x13baa0){var _0x2fdde4=this;this[_0x0f12('0xf')]['getSoundById'](_0x5ca297)[_0x0f12('0x12')](function(_0x25a5dc){_0x13baa0(null,_0x25a5dc?_0x2fdde4[_0x0f12('0x20')](_0x25a5dc[_0x0f12('0x21')]):![]);})[_0x0f12('0x13')](function(_0x5693e4){_0x13baa0(_0x5693e4);});};AGIVertices['prototype'][_0x0f12('0x22')]=function(_0x48d168,_0x3516f8){this[_0x0f12('0xf')][_0x0f12('0x23')](_0x48d168)['then'](function(_0x12a575){_0x3516f8(null,_0x12a575?_0x12a575:![]);})[_0x0f12('0x13')](function(_0x3e71ac){_0x3516f8(_0x3e71ac);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x24')]=function(_0x25d56e,_0x521ce1,_0x2c28e5){this[_0x0f12('0x25')][_0x0f12('0x24')](_0x25d56e,_0x521ce1)['then'](function(){_0x2c28e5(null);})[_0x0f12('0x13')](function(_0x40a279){_0x2c28e5(_0x40a279);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x26')]=function(_0x5a7d94,_0x41d780){this[_0x0f12('0xf')][_0x0f12('0x27')](_0x5a7d94)[_0x0f12('0x12')](function(_0xc7a1f6){if(_0xc7a1f6){if(_0xc7a1f6[_0x0f12('0x28')]){_0x41d780(null,[_0xc7a1f6[_0x0f12('0x29')]]);}else{_0x41d780(null,_['map'](_0xc7a1f6[_0x0f12('0x2a')],_0x0f12('0x29')));}}else{_0x41d780(null,![]);}})['catch'](function(_0x1804ec){_0x41d780(_0x1804ec);});};AGIVertices[_0x0f12('0x14')]['getSoundPath']=function(_0x302637){return util[_0x0f12('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x302637);};AGIVertices[_0x0f12('0x14')]['getQueryOdbc']=function(_0x20c6b0,_0x62f49,_0x2ed69c){odbc[_0x0f12('0x2c')](_0x20c6b0,function(_0xbe9212){if(_0xbe9212){logger[_0x0f12('0x2d')](_0x0f12('0x2e'),_0xbe9212);_0x2ed69c(_0xbe9212);}else{logger[_0x0f12('0x2f')](_0x0f12('0x30'));odbc[_0x0f12('0x31')](_0x62f49,function(_0x515ad5,_0x3be0b6){if(_0x515ad5){logger[_0x0f12('0x2f')](_0x0f12('0x32'),_0x62f49);_0x2ed69c(_0x515ad5);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x62f49);odbc['close'](function(_0x21791c){if(_0x21791c){logger[_0x0f12('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x21791c);}_0x2ed69c(null,_0x3be0b6);});}});}});};AGIVertices['prototype'][_0x0f12('0x33')]=function(_0x1a43c6,_0x3acc80){this['rpc'][_0x0f12('0x34')](_0x1a43c6)[_0x0f12('0x12')](function(_0x5a3b99){_0x3acc80(null,_0x5a3b99?_0x5a3b99:![]);})[_0x0f12('0x13')](function(_0x24560a){_0x3acc80(_0x24560a);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x35')]=function(_0x1a7a78,_0xbebdad){this[_0x0f12('0xf')]['createSmsMessage'](_0x1a7a78)[_0x0f12('0x12')](function(_0x5442c1){_0xbebdad(null,_0x5442c1);})[_0x0f12('0x13')](function(_0xc6aacc){_0xbebdad(_0xc6aacc);});};AGIVertices['prototype'][_0x0f12('0x36')]=function(_0x2232ec,_0x249dd4,_0x496724){this['rpc'][_0x0f12('0x36')]({'uniqueid':this[_0x0f12('0xe')][_0x0f12('0x37')],'node':_0x2232ec[_0x0f12('0x38')],'application':_0x2232ec['agicommand'],'data':_0x249dd4||null,'project_name':this[_0x0f12('0xe')][_0x0f12('0x39')],'callerid':this[_0x0f12('0xe')][_0x0f12('0x3a')]})['then'](function(_0x370b44){if(_0x496724){_0x496724(null,_0x370b44);}})[_0x0f12('0x13')](function(_0x54ec90){if(_0x496724){_0x496724(_0x54ec90);}});};AGIVertices['prototype'][_0x0f12('0x3b')]=function(_0x27f988,_0x212cc6,_0x54d0dd,_0x583986){this[_0x0f12('0xf')][_0x0f12('0x3b')]({'uniqueid':this['channel'][_0x0f12('0x37')],'callerid':this['channel'][_0x0f12('0x3a')],'calleridname':this[_0x0f12('0xe')]['calleridname'],'context':this['channel'][_0x0f12('0x3c')],'extension':this[_0x0f12('0xe')][_0x0f12('0x3d')],'priority':this[_0x0f12('0xe')][_0x0f12('0x3e')],'accountcode':this[_0x0f12('0xe')][_0x0f12('0x3f')],'dnid':this[_0x0f12('0xe')]['dnid'],'projectName':this[_0x0f12('0xe')]['arg_1'],'saveName':_0x212cc6,'filename':_0x27f988[_0x0f12('0x40')]||_0x212cc6,'savePath':_0x54d0dd})['then'](function(_0x4add76){_0x583986(null,_0x4add76);})[_0x0f12('0x13')](function(_0x5cfd51){_0x583986(_0x5cfd51);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x41')]=function(_0x4298c8,_0x284422,_0x4fb2c5,_0x3e9d31,_0x90f918){this[_0x0f12('0xf')][_0x0f12('0x41')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4298c8,'direction':_0x284422,'providerName':_0x4fb2c5,'providerResponse':_0x3e9d31})[_0x0f12('0x12')](function(_0x2e3df7){if(_0x90f918){_0x90f918(null,_0x2e3df7);}})[_0x0f12('0x13')](function(_0x1f69cd){if(_0x90f918){_0x90f918(_0x1f69cd);}});};AGIVertices[_0x0f12('0x14')]['createCmContact']=function(_0x48b7ec,_0x58bb84){this[_0x0f12('0xf')][_0x0f12('0x42')]({'firstName':_[_0x0f12('0x43')](_0x48b7ec[_0x0f12('0x17')])||_[_0x0f12('0x44')](_0x48b7ec[_0x0f12('0x17')])?_0x0f12('0x45')+Math[_0x0f12('0x46')]():_0x48b7ec[_0x0f12('0x17')],'lastName':_[_0x0f12('0x43')](_0x48b7ec[_0x0f12('0x47')])||_['isNil'](_0x48b7ec[_0x0f12('0x47')])?null:_0x48b7ec[_0x0f12('0x47')],'phone':_0x48b7ec[_0x0f12('0x48')],'ListId':_0x48b7ec[_0x0f12('0x49')],'scheduledat':_0x48b7ec['scheduledAt'],'callbackUniqueid':this['channel'][_0x0f12('0x37')],'tags':_0x0f12('0x4a'),'description':_0x0f12('0x4b')+_0x48b7ec[_0x0f12('0x4c')][_0x0f12('0x4d')](),'priority':_0x48b7ec[_0x0f12('0x4e')]})[_0x0f12('0x12')](function(_0x45da7f){_0x58bb84(null,_0x45da7f);})['catch'](function(_0x204728){_0x58bb84(_0x204728);});};AGIVertices[_0x0f12('0x14')]['getPause']=function(_0x3c2148,_0x2ea5ea){this[_0x0f12('0xf')]['getPauseById'](_0x3c2148)[_0x0f12('0x12')](function(_0x14b337){_0x2ea5ea(null,_0x14b337?_0x14b337[_0x0f12('0x17')]:![]);})[_0x0f12('0x13')](function(_0x3c90ff){_0x2ea5ea(_0x3c90ff);});};AGIVertices['prototype'][_0x0f12('0x4f')]=function(_0x51040a,_0xc7ab2b,_0x54f210){var _0x1c886e={'role':_0x0f12('0x50')};_0x1c886e[_0x51040a]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')]['agentPause'](_0x1c886e,_0xc7ab2b,this[_0x0f12('0xe')]['uniqueid'])[_0x0f12('0x12')](function(_0x59cd88){_0x54f210(null,_[_0x0f12('0x44')](_0x59cd88)?![]:!![]);})[_0x0f12('0x13')](function(_0x37ac11){logger['error'](_0x37ac11);_0x54f210(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x51')]=function(_0x2cc2d6,_0x5cf716){var _0x3c2dc0={'role':_0x0f12('0x50')};_0x3c2dc0[_0x2cc2d6]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')]['agentUnpause'](_0x3c2dc0)[_0x0f12('0x12')](function(_0xbc502f){_0x5cf716(null,_[_0x0f12('0x44')](_0xbc502f)?![]:!![]);})[_0x0f12('0x13')](function(_0x21c60b){logger[_0x0f12('0x2d')](_0x21c60b);_0x5cf716(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x52')]=function(_0x475fd2,_0x323f94){var _0x13db9c={'role':_0x0f12('0x50')};_0x13db9c[_0x475fd2]=this['channel'][_0x0f12('0x3a')];this[_0x0f12('0xf')][_0x0f12('0x52')](_0x13db9c)[_0x0f12('0x12')](function(_0x42dfe6){_0x323f94(null,_['isNil'](_0x42dfe6)?![]:!![]);})[_0x0f12('0x13')](function(_0x46f506){logger[_0x0f12('0x2d')](_0x46f506);_0x323f94(null,![]);});};AGIVertices['prototype'][_0x0f12('0x53')]=function(_0x531dac,_0x1970b0){var _0x2faa11={'role':_0x0f12('0x50')};_0x2faa11[_0x531dac]=this[_0x0f12('0xe')]['callerid'];var _0x3a0c70=_0x531dac!='internal'?util[_0x0f12('0x2b')](_0x0f12('0x54'),'LOCAL',this[_0x0f12('0xe')][_0x0f12('0x3a')]):undefined;this[_0x0f12('0xf')][_0x0f12('0x53')](_0x2faa11,_0x3a0c70)[_0x0f12('0x12')](function(_0x402c95){_0x1970b0(null,_['isNil'](_0x402c95)?![]:!![]);})[_0x0f12('0x13')](function(_0x140dd9){logger[_0x0f12('0x2d')](_0x140dd9);_0x1970b0(null,![]);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x55')]=function(_0x2e1425,_0x3d64a1){sh[_0x0f12('0x56')](_[_0x0f12('0x57')](_0x2e1425),function(_0x3fe7a9,_0x1f341f){var _0x488f4b=_0x1f341f[_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'');_0x3d64a1(null,_0x488f4b);});};AGIVertices['prototype'][_0x0f12('0x59')]=function(_0x7e9d05,_0x3a3553){scripts['googleCloudTTS'](_0x7e9d05[_0x0f12('0x5a')],_0x7e9d05[_0x0f12('0x5b')]||_0x0f12('0x5c'),_0x7e9d05[_0x0f12('0x5c')],_0x7e9d05[_0x0f12('0x5d')]||_0x0f12('0x5e'),_0x7e9d05[_0x0f12('0x5f')]||_0x0f12('0x60'),_0x7e9d05['audioEncoding']||_0x0f12('0x61'))[_0x0f12('0x12')](function(_0x2601b8){_0x3a3553(null,_0x2601b8);})[_0x0f12('0x13')](function(_0x29df5b){_0x3a3553(_0x29df5b);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x62')]=function(_0x329210,_0x1951bd){scripts['googleTTS'](_0x329210['text'],_0x329210[_0x0f12('0x63')]||'en',0x1)[_0x0f12('0x12')](function(_0x604f37){_0x1951bd(null,_0x604f37);})[_0x0f12('0x13')](function(_0x4a8298){_0x1951bd(_0x4a8298);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x64')]=function(_0x3567db,_0x5a3255){var _0x8e211={'uri':_0x3567db[_0x0f12('0x65')],'method':_0x3567db[_0x0f12('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3567db[_0x0f12('0x67')])===_0x0f12('0x68')&&parseInt(_0x3567db[_0x0f12('0x67')])>=0x1?parseInt(_0x3567db['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x0f12('0x69')]([_0x0f12('0x6a'),_0x0f12('0x6b')],_0x8e211['method'][_0x0f12('0x6c')]())){try{_0x8e211[_0x0f12('0x6d')]=_0x3567db[_0x0f12('0xb')]?JSON[_0x0f12('0x6e')](_0x3567db[_0x0f12('0xb')]):{};}catch(_0x36213a){logger['error'](_0x0f12('0x6f'),_0x36213a);}}try{_0x8e211[_0x0f12('0x70')]=_0x3567db['rawHeaders']?JSON[_0x0f12('0x6e')](_0x3567db[_0x0f12('0xa')]):{};}catch(_0x6d45e){logger[_0x0f12('0x2d')](_0x0f12('0x71'),_0x6d45e);}if(_0x3567db[_0x0f12('0x72')]){try{var _0x4295de=require(_0x3567db[_0x0f12('0x72')])['sync'](this,_0x8e211);_0x8e211['uri']=Mustache[_0x0f12('0x73')](_0x3567db[_0x0f12('0x65')],_0x4295de,{},['$$','$$']);if(_0x8e211[_0x0f12('0x70')]){_0x8e211[_0x0f12('0x70')]=JSON['parse'](Mustache['render'](JSON[_0x0f12('0x74')](_0x8e211[_0x0f12('0x70')]),_0x4295de,{},['$$','$$']));}if(_0x8e211['body']){_0x8e211[_0x0f12('0x6d')]=JSON['parse'](Mustache[_0x0f12('0x73')](JSON[_0x0f12('0x74')](_0x8e211[_0x0f12('0x6d')]),_0x4295de,{},['$$','$$']));}}catch(_0x4ec86a){logger[_0x0f12('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4ec86a);}}rp(_0x8e211)['then'](function(_0x36ed6f){var _0x26ffad={'statusCode':_0x36ed6f['statusCode']||0xc8,'statusMessage':_0x36ed6f[_0x0f12('0x75')]||'OK','headers':_0x36ed6f[_0x0f12('0x70')]||{},'body':_0x36ed6f[_0x0f12('0x6d')]||{}};_0x5a3255(null,_0x26ffad);})[_0x0f12('0x13')](function(_0x5343f8){var _0x267c60={'statusCode':_0x5343f8[_0x0f12('0x76')]||0x1f4,'statusMessage':_0x5343f8[_0x0f12('0x77')]||_0x0f12('0x78'),'headers':_0x5343f8[_0x0f12('0x79')][_0x0f12('0x70')]||{},'body':_0x5343f8['options'][_0x0f12('0x6d')]||{}};_0x5a3255(null,_0x267c60);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x7a')]=function(_0x57b290,_0x4c2c6e){scripts[_0x0f12('0x7a')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x57b290[_0x0f12('0x7b')],_0x57b290[_0x0f12('0x5c')],_0x57b290[_0x0f12('0x7c')]||'en')[_0x0f12('0x12')](function(_0x2705f2){_0x4c2c6e(null,_0x2705f2);})[_0x0f12('0x13')](function(_0x3bdc63){_0x4c2c6e(_0x3bdc63);});};AGIVertices['prototype'][_0x0f12('0x7d')]=function(_0x1c0610,_0x404bc7){scripts[_0x0f12('0x7d')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x1c0610[_0x0f12('0x7e')],_0x1c0610[_0x0f12('0x7f')],_0x1c0610[_0x0f12('0x80')],_0x1c0610['text'],_0x1c0610['dialogflowV2_language']||'en')[_0x0f12('0x12')](function(_0x43e5e4){_0x404bc7(null,_0x43e5e4);})[_0x0f12('0x13')](function(_0x45f94f){_0x404bc7(_0x45f94f);});};AGIVertices[_0x0f12('0x14')]['sestekNDA']=function(_0x1ab885,_0x25f169){scripts['sestekNDA'](this[_0x0f12('0xe')],_0x1ab885)[_0x0f12('0x12')](function(_0x362830){_0x25f169(null,_0x362830);})[_0x0f12('0x13')](function(_0x1cf783){_0x25f169(_0x1cf783);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x81')]=function(_0x5205ea,_0x8b8f68){scripts['ispeechTTS'](_0x5205ea['key'],_0x5205ea[_0x0f12('0x5c')],_0x5205ea[_0x0f12('0x82')]||_0x0f12('0x5e'),_0x5205ea[_0x0f12('0x83')])[_0x0f12('0x12')](function(_0x4d8db3){_0x8b8f68(null,_0x4d8db3);})[_0x0f12('0x13')](function(_0xe5ff10){_0x8b8f68(_0xe5ff10);});};AGIVertices['prototype'][_0x0f12('0x84')]=function(_0x54f427,_0x51bf0e,_0x459b93){scripts[_0x0f12('0x84')](_0x51bf0e,_0x54f427[_0x0f12('0x7b')],_0x54f427[_0x0f12('0x85')]||_0x0f12('0x5e'),this['isConfigured'](_0x54f427[_0x0f12('0x86')])?_0x54f427[_0x0f12('0x86')]:undefined)[_0x0f12('0x12')](function(_0x1949ea){_0x459b93(null,_0x1949ea);})['catch'](function(_0x519631){_0x459b93(_0x519631);});};AGIVertices[_0x0f12('0x14')]['awsPolly']=function(_0x22b2ca,_0x362726){scripts['awsPolly'](_0x22b2ca[_0x0f12('0x87')],_0x22b2ca[_0x0f12('0x88')],_0x22b2ca[_0x0f12('0x89')],_0x22b2ca['aws_polly_voice']||_0x0f12('0x8a'),_0x22b2ca[_0x0f12('0x5c')],_0x22b2ca[_0x0f12('0x8b')]||_0x0f12('0x5c'))['then'](function(_0x135ab5){_0x362726(null,_0x135ab5);})[_0x0f12('0x13')](function(_0x37ce71){_0x362726(_0x37ce71);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x8c')]=function(_0x2e05b8,_0x155ad1){scripts[_0x0f12('0x8c')](this[_0x0f12('0xe')][_0x0f12('0x37')],_0x2e05b8[_0x0f12('0x87')],_0x2e05b8[_0x0f12('0x88')],_0x2e05b8['aws_lex_region'],_0x2e05b8[_0x0f12('0x5c')],_0x2e05b8[_0x0f12('0x8d')])[_0x0f12('0x12')](function(_0x3a9498){_0x155ad1(null,_0x3a9498);})[_0x0f12('0x13')](function(_0x12d826){_0x155ad1(_0x12d826);});};AGIVertices['prototype'][_0x0f12('0x8e')]=function(_0x5bd9a7,_0x415b2d,_0x1786c9){scripts['googleASR'](_0x415b2d,_0x5bd9a7[_0x0f12('0x7b')],_0x5bd9a7[_0x0f12('0x8f')]||_0x0f12('0x5e'))['then'](function(_0x8d9412){_0x1786c9(null,_0x8d9412);})[_0x0f12('0x13')](function(_0xa9d5b6){_0x1786c9(_0xa9d5b6);});};AGIVertices[_0x0f12('0x14')][_0x0f12('0x90')]=function(_0x1033b6,_0x12fe7a,_0x21060e){scripts[_0x0f12('0x90')](_0x12fe7a,_0x1033b6[_0x0f12('0x91')],_0x1033b6[_0x0f12('0x92')],_0x1033b6[_0x0f12('0x93')])[_0x0f12('0x12')](function(_0x3b80f1){_0x21060e(null,_0x3b80f1);})[_0x0f12('0x13')](function(_0x4403bd){_0x21060e(_0x4403bd);});};AGIVertices['prototype']['clear']=function(_0x2f69f3){var _0x2daa51=_[_0x0f12('0x69')](verticesWithRetry,_0x2f69f3['agicommand'])?_0x2f69f3:_[_0x0f12('0x94')](_0x2f69f3);for(var _0x31c6f8 in _0x2daa51){if(_0x2daa51[_0x0f12('0x95')](_0x31c6f8)){if(_0x2daa51[_0x31c6f8]&&_['isString'](_0x2daa51[_0x31c6f8])){if(_[_0x0f12('0x69')](recursiveMapAttributes,_0x31c6f8)){_0x2daa51[_0x31c6f8]=this[_0x0f12('0x96')](_0x2daa51[_0x31c6f8]);}else{_0x2daa51[_0x31c6f8]=this['replaceAllVariables'](_0x2daa51[_0x31c6f8]);}}}}return _0x2daa51;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x97')]=function(_0x57a0c9){for(var _0x5f4c00 in _0x57a0c9){if(_0x57a0c9[_0x0f12('0x95')](_0x5f4c00)){if(_[_0x0f12('0x98')](_0x57a0c9[_0x5f4c00])){this['recursiveNodeIndex'](_0x57a0c9[_0x5f4c00]);}else if(_[_0x0f12('0x99')](_0x57a0c9[_0x5f4c00])){for(var _0x481997=0x0;_0x481997<_0x57a0c9[_0x5f4c00][_0x0f12('0x9a')];_0x481997++){this[_0x0f12('0x97')](_0x57a0c9[_0x5f4c00][_0x481997]);}}else if(_[_0x0f12('0x9b')](_0x57a0c9[_0x5f4c00])){_0x57a0c9[_0x5f4c00]=this[_0x0f12('0x9c')](_0x57a0c9[_0x5f4c00]);}}}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x9d')]=function(_0x4044b2,_0x554547){for(var _0x410b44 in _0x4044b2){if(_0x4044b2[_0x0f12('0x95')](_0x410b44)){if(_['isPlainObject'](_0x4044b2[_0x410b44])){if(!_[_0x0f12('0x43')](_0x4044b2[_0x410b44])){this[_0x0f12('0x9d')](_0x4044b2[_0x410b44],util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x554547,_0x410b44));}}else if(_[_0x0f12('0x99')](_0x4044b2[_0x410b44])){for(var _0x4c6f75=0x0;_0x4c6f75<_0x4044b2[_0x410b44]['length'];_0x4c6f75++){this[_0x0f12('0x9d')](_0x4044b2[_0x410b44][_0x4c6f75],util['format'](_0x0f12('0x9e'),_0x554547,_0x410b44+'['+_0x4c6f75+']'));}}else{if(!_[_0x0f12('0x44')](_0x4044b2[_0x410b44])){this['channel'][_0x0f12('0x9f')](util['format'](_0x0f12('0x9e'),_0x554547,_0x410b44),_0x4044b2[_0x410b44]);}}}}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x96')]=function(_0x19f47c){try{var _0xbbc496=JSON[_0x0f12('0x6e')](_0x19f47c);this[_0x0f12('0x97')](_0xbbc496);return JSON[_0x0f12('0x74')](_0xbbc496);}catch(_0x5484fb){return this[_0x0f12('0x9c')](_0x19f47c);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x2a91da){var _0x2e39c2=_0x2a91da[_0x0f12('0xa0')]('{');for(var _0x5e1020=0x1;_0x5e1020<_0x2e39c2[_0x0f12('0x9a')];_0x5e1020+=0x1){var _0x299adf=_0x2e39c2[_0x5e1020][_0x0f12('0xa0')]('}');if(_0x299adf[_0x0f12('0x9a')]>0x1){_0x2a91da=_0x2a91da[_0x0f12('0xa1')]('{'+_0x299adf[0x0]+'}',this[_0x0f12('0xe')]['getVariable'](_0x299adf[0x0])[_0x0f12('0xa2')]||_0x299adf[0x0]);}}if(_0x2e39c2['length']===0x1){return _0x2a91da['toString']();}return this[_0x0f12('0x9c')](_0x2a91da);};AGIVertices[_0x0f12('0x14')]['getAndSetVariable']=function(_0x2a5ba8,_0x4e38b7){var _0x3c6ade=this['channel']['getVariable'](_0x2a5ba8);if(_0x3c6ade[_0x0f12('0xa3')]===-0x1){return _0x3c6ade;}logger['info'](util[_0x0f12('0x2b')](_0x0f12('0xa4'),_0x4e38b7,_0x3c6ade[_0x0f12('0xa2')]));return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x4e38b7,_0x3c6ade[_0x0f12('0xa2')]);};AGIVertices[_0x0f12('0x14')]['isConfigured']=function(_0x2a8ad1){return _0x2a8ad1&&_0x2a8ad1!=='0'&&_0x2a8ad1!=='-1'&&_0x2a8ad1!=='';};AGIVertices['prototype'][_0x0f12('0xa5')]=function(_0x117294){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x117294,'-');_0x117294[_0x0f12('0xa7')]=_0x117294[_0x0f12('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0f12('0x14')][_0x0f12('0xa8')]=function(_0x527714){logger['info'](util['format'](_0x0f12('0xa9'),_0x527714[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x527714['text'])){return this[_0x0f12('0xe')]['noop']('no\x20text\x20configured');}var _0x221fd4='\x22'+_0x527714['text']+'\x22';if(this[_0x0f12('0xaa')](_0x527714[_0x0f12('0x79')])){_0x221fd4+=','+_0x527714['options'];}var _0x14ca3d=this[_0x0f12('0xe')]['exec']('MRCPSynth',_0x221fd4);if(_0x14ca3d['result']===-0x1){return _0x14ca3d;}return this[_0x0f12('0xe')]['noop'](util['format'](_0x0f12('0xab'),_0x221fd4));};AGIVertices[_0x0f12('0x14')]['mrcprecog']=function(_0x18d3c0){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xac'),_0x18d3c0[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x18d3c0['grammar'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xae'));}var _0x361c04=_0x18d3c0[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0x18d3c0[_0x0f12('0x79')])){_0x361c04+=','+_0x18d3c0['options'];}var _0x2572cd=this['channel'][_0x0f12('0x56')](_0x0f12('0xb0'),_0x361c04);if(_0x2572cd[_0x0f12('0xa3')]===-0x1){return _0x2572cd;}var _0x51952a=this[_0x0f12('0xb1')](_0x0f12('0xb2'),_0x0f12('0xb3'));if(_0x51952a[_0x0f12('0xa3')]===-0x1){return _0x51952a;}var _0x3a9188=this[_0x0f12('0xb1')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x3a9188[_0x0f12('0xa3')]===-0x1){return _0x3a9188;}var _0x5ba504=this[_0x0f12('0xb1')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x5ba504[_0x0f12('0xa3')]===-0x1){return _0x5ba504;}return this['channel'][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x361c04));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x6')]=function(_0x31e0be){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xb5'),_0x31e0be[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x6')]([_0x31e0be[_0x0f12('0xb6')],_0x31e0be[_0x0f12('0xb7')]]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0xb8')]=function(_0x34196e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xb9'),_0x34196e[_0x0f12('0x38')]));if(this[_0x0f12('0xaa')](_0x34196e[_0x0f12('0x67')])){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x34196e[_0x0f12('0x67')]));var _0x5a842d=this[_0x0f12('0xe')]['wait'](_0x34196e[_0x0f12('0x67')]);if(_0x5a842d[_0x0f12('0xa3')]===-0x1){return _0x5a842d;}}return this[_0x0f12('0xe')][_0x0f12('0xb8')]();};AGIVertices[_0x0f12('0x14')][_0x0f12('0x4a')]=function(_0x3bdfcf){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3bdfcf[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x3bdfcf[_0x0f12('0x49')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3bdfcf,'no\x20list\x20selected');}_0x3bdfcf['scheduledAt']=moment();if(this[_0x0f12('0xaa')](_0x3bdfcf[_0x0f12('0xba')])){_0x3bdfcf[_0x0f12('0x4c')]=moment()['add'](_0x3bdfcf['delay'],_0x0f12('0xbb'));}if(!this['isConfigured'](_0x3bdfcf[_0x0f12('0x4e')])){_0x3bdfcf[_0x0f12('0x4e')]=0x2;}this[_0x0f12('0x42')]['sync'](this,_0x3bdfcf);return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xbc'),_0x3bdfcf[_0x0f12('0x48')],_0x3bdfcf['list_id'],_0x3bdfcf[_0x0f12('0x4c')]));};AGIVertices[_0x0f12('0x14')]['custom_app']=function(_0x5a5ead){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xbd'),_0x5a5ead['label']));var _0x332ddf=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x5a5ead[_0x0f12('0xbe')],_0x5a5ead[_0x0f12('0x79')]);if(_0x332ddf[_0x0f12('0xa3')]===-0x1){return _0x332ddf;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xbf'),_0x5a5ead[_0x0f12('0xbe')],_0x5a5ead[_0x0f12('0x79')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x581310){logger['info'](util['format'](_0x0f12('0xc0'),_0x581310['label']));if(!this[_0x0f12('0xaa')](_0x581310['text'])){return this[_0x0f12('0xe')]['noop']('no\x20text\x20configured');}var _0x253f60='\x22'+_0x581310['text']+'\x22';if(this['isConfigured'](_0x581310[_0x0f12('0x79')])){_0x253f60+=','+_0x581310['options'];}var _0xa56830=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xc1'),_0x253f60);if(_0xa56830['result']===-0x1){return _0xa56830;}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xab'),_0x253f60));};AGIVertices['prototype'][_0x0f12('0xc2')]=function(_0xbb3a9f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xbb3a9f[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0xbb3a9f[_0x0f12('0x5c')])){return this[_0x0f12('0xe')]['noop'](_0x0f12('0xc3'));}var _0x2683b0='\x22'+_0xbb3a9f[_0x0f12('0x5c')]+'\x22';if(this[_0x0f12('0xaa')](_0xbb3a9f[_0x0f12('0x79')])){_0x2683b0+=','+_0xbb3a9f[_0x0f12('0x79')];}var _0x2a49e4=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xc1'),_0x2683b0);if(_0x2a49e4['result']===-0x1){return _0x2a49e4;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xab'),_0x2683b0));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1f052e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xc4'),_0x1f052e[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x1f052e[_0x0f12('0xaf')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xae'));}var _0x916852=_0x1f052e[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0x1f052e[_0x0f12('0x79')])){_0x916852+=','+_0x1f052e[_0x0f12('0x79')];}var _0x547b76=this['channel']['exec'](_0x0f12('0xb0'),_0x916852);if(_0x547b76[_0x0f12('0xa3')]===-0x1){return _0x547b76;}var _0x1a8812=this['getAndSetVariable'](_0x0f12('0xb2'),_0x0f12('0xc5'));if(_0x1a8812[_0x0f12('0xa3')]===-0x1){return _0x1a8812;}var _0x3c39c7=this['getAndSetVariable'](_0x0f12('0xc6'),_0x0f12('0xc7'));if(_0x3c39c7[_0x0f12('0xa3')]===-0x1){return _0x3c39c7;}var _0x4739a1=this[_0x0f12('0xb1')]('RECOG_INSTANCE()',_0x0f12('0xc8'));if(_0x4739a1['result']===-0x1){return _0x4739a1;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x916852));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xc9')]=function(_0xb1c865){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xca'),_0xb1c865['label']));if(!this[_0x0f12('0xaa')](_0xb1c865[_0x0f12('0xaf')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20grammar\x20configured');}var _0x5a8ed0=_0xb1c865[_0x0f12('0xaf')];if(this[_0x0f12('0xaa')](_0xb1c865[_0x0f12('0x79')])){_0x5a8ed0+=','+_0xb1c865[_0x0f12('0x79')];}var _0x302a42=this[_0x0f12('0xe')][_0x0f12('0x56')]('MRCPRecog',_0x5a8ed0);if(_0x302a42['result']===-0x1){return _0x302a42;}var _0x3da356=this[_0x0f12('0xb1')](_0x0f12('0xb2'),_0x0f12('0xcb'));if(_0x3da356[_0x0f12('0xa3')]===-0x1){return _0x3da356;}var _0x4d59da=this['getAndSetVariable'](_0x0f12('0xc6'),'SESTEK_ASR_TRANSCRIPT');if(_0x4d59da[_0x0f12('0xa3')]===-0x1){return _0x4d59da;}var _0x31ba6c=this[_0x0f12('0xb1')](_0x0f12('0xcc'),'SESTEK_ASR_INSTANCE');if(_0x31ba6c[_0x0f12('0xa3')]===-0x1){return _0x31ba6c;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xb4'),_0x5a8ed0));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xcd')]=function(_0x21a50a){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xce'),_0x21a50a['label']));if(!this[_0x0f12('0xaa')](_0x21a50a['odbc_id'])){return this[_0x0f12('0xe')]['error'](_0x21a50a,_0x0f12('0xcf'));}var _0x17776a=this[_0x0f12('0x1a')][_0x0f12('0xa6')](this,_0x21a50a[_0x0f12('0xd0')]);if(!_0x17776a){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x21a50a,'no\x20odbc\x20database\x20found');}if(!this[_0x0f12('0xaa')](_0x21a50a[_0x0f12('0x31')])){return this['channel'][_0x0f12('0x2d')](_0x21a50a,_0x0f12('0xd1'));}var _0x274d21=_0x21a50a[_0x0f12('0x31')][_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x0f12('0x2b')](_0x0f12('0xd2'),_0x274d21));var _0xb4971d=this[_0x0f12('0xd3')][_0x0f12('0xa6')](this,_0x17776a,_0x274d21);this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x21a50a,_0x274d21);if(!this[_0x0f12('0xaa')](_0x21a50a[_0x0f12('0xd4')])){return this['channel']['noop'](_0x0f12('0xd5'));}var _0x45da95=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x21a50a['variable_id']);if(!_0x45da95){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x21a50a,_0x0f12('0xd6'));}var _0x15ad7c=this;_0xb4971d[_0x0f12('0xd7')](function(_0xa9c462,_0x144654){Object[_0x0f12('0xd8')](_0xa9c462)[_0x0f12('0xd7')](function(_0x37bcf9){_0x15ad7c['channel']['setVariable'](util['format'](_0x0f12('0xd9'),_0x45da95,_0x144654,_0x37bcf9),_0xa9c462[_0x37bcf9]);});});this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xda'),_0x45da95),_0xb4971d[_0x0f12('0x9a')]);return this[_0x0f12('0xe')]['noop'](util['format']('variable\x20%s\x20set',_0x45da95));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xdb')]=function(_0x24a993){logger[_0x0f12('0xdc')](util[_0x0f12('0x2b')](_0x0f12('0xdd'),_0x24a993[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x24a993[_0x0f12('0xde')])){return this[_0x0f12('0xe')]['error'](_0x24a993,_0x0f12('0xdf'));}var _0x1b063c=this[_0x0f12('0x1c')]['sync'](this,_0x24a993[_0x0f12('0xde')]);if(!_0x1b063c){return this[_0x0f12('0xe')]['error'](_0x24a993,_0x0f12('0xe0'));}var _0x279dc1=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xe1'),[util[_0x0f12('0x2b')]('SIP/%s',_0x1b063c),_0x24a993[_0x0f12('0x67')],_0x24a993['opts'],_0x24a993[_0x0f12('0x65')]]);if(_0x279dc1[_0x0f12('0xa3')]===-0x1){return _0x279dc1;}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xe2'),_0x0f12('0xe1')));};AGIVertices[_0x0f12('0x14')][_0x0f12('0xe3')]=function(_0x31c200){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xe4'),_0x31c200[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x31c200[_0x0f12('0x7b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xe5'));}if(!this['isConfigured'](_0x31c200[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x31c200);this[_0x0f12('0x41')](_0x31c200[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xe7'),_0x31c200['text']));var _0x289061=this[_0x0f12('0x7a')][_0x0f12('0xa6')](this,_0x31c200);if(_0x289061){for(var _0x207070 in _0x289061){if(_0x289061[_0x0f12('0x95')](_0x207070)){this[_0x0f12('0xe')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x207070[_0x0f12('0x6c')]()),_0x289061[_0x207070]);}}this['createSquareMessage'](_0x289061[_0x0f12('0xe8')],'out',_0x0f12('0xe3'),'');return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xe9'),_0x289061[_0x0f12('0xe8')]));}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x31c200,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0f12('0x14')][_0x0f12('0xea')]=function(_0x43bdc5){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xeb'),_0x43bdc5[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x7e')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xec'));}if(!this['isConfigured'](_0x43bdc5['client_email'])){return this['channel']['noop'](_0x0f12('0xed'));}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x80')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xee'));}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0xef')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20anguage\x20configured');}if(!this[_0x0f12('0xaa')](_0x43bdc5[_0x0f12('0x5c')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x43bdc5);this[_0x0f12('0x41')](_0x43bdc5[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xf0'),_0x43bdc5[_0x0f12('0x5c')]));var _0x1d1b7c=this['googleDialogflowV2'][_0x0f12('0xa6')](this,_0x43bdc5);if(_0x1d1b7c){for(var _0x51620a in _0x1d1b7c){if(_0x1d1b7c[_0x0f12('0x95')](_0x51620a)){if(_0x51620a!==_0x0f12('0xf1')){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xf2'),_0x51620a[_0x0f12('0x6c')]()),_0x1d1b7c[_0x51620a]);}}}this[_0x0f12('0x41')](_0x1d1b7c['speech'],'out',_0x0f12('0xea'),_0x1d1b7c['providerResponse']);return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0xf3'),_0x1d1b7c[_0x0f12('0xe8')]));}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x43bdc5,_0x0f12('0xf4'));};AGIVertices['prototype'][_0x0f12('0xf5')]=function(_0xca6323){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0xf6'),_0xca6323['label']));if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xf7')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xf8')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xf9'));}if(!this[_0x0f12('0xaa')](_0xca6323[_0x0f12('0xfa')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xfb'));}if(!this[_0x0f12('0xaa')](_0xca6323['ndassistant_url'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')]['bot']=!![];this[_0x0f12('0x36')](_0xca6323);this[_0x0f12('0x41')](_0xca6323[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0xfc'),_0xca6323['text']));var _0x52c179=this[_0x0f12('0xfd')][_0x0f12('0xa6')](this,_0xca6323);if(_0x52c179){for(var _0x5addc4 in _0x52c179){if(_0x52c179[_0x0f12('0x95')](_0x5addc4)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0xfe'),_0x5addc4[_0x0f12('0x6c')]()),_0x52c179[_0x5addc4]);}}this[_0x0f12('0x41')](_0x52c179[_0x0f12('0xe8')],_0x0f12('0xff'),'sesteknda','');if(_0x52c179[_0x0f12('0x100')]){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x101'),_0x52c179[_0x0f12('0x100')]));var _0x58b2ea=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x52c179[_0x0f12('0x100')]);try{fs[_0x0f12('0x103')](_0x52c179[_0x0f12('0x100')]+_0x0f12('0x104'));}catch(_0x51c86b){logger[_0x0f12('0x2d')](_0x51c86b);}return _0x58b2ea;}else{return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x105'),_0x52c179[_0x0f12('0xe8')]));}}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xca6323,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x0f12('0x14')]['end']=function(_0xfbdb29){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x106'),_0xfbdb29[_0x0f12('0x38')]));return this['channel']['noop']('end');};AGIVertices[_0x0f12('0x14')][_0x0f12('0x107')]=function(_0x251911){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x251911[_0x0f12('0x38')]));var _0x23d856='';if(_0x251911[_0x0f12('0x108')]){if(!this[_0x0f12('0xaa')](_0x251911[_0x0f12('0x108')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x251911,_0x0f12('0x109'));}else{var _0x142bee=parseInt(_0x251911[_0x0f12('0x108')],0xa);if(isNaN(_0x142bee)){_0x23d856=_0x251911['trunk_id'];}else{_0x23d856=this[_0x0f12('0x1d')]['sync'](this,_0x251911[_0x0f12('0x108')]);if(!_0x23d856){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x251911,'no\x20trunk\x20found');}}}}else if(_0x251911[_0x0f12('0x10a')]){_0x23d856=_0x251911['trunk_name'];}else{return this[_0x0f12('0xe')]['error'](_0x251911,_0x0f12('0x109'));}var _0x3086c0=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0xe1'),[util[_0x0f12('0x2b')](_0x0f12('0x10b'),_0x23d856,_0x251911[_0x0f12('0x48')]),_0x251911['timeout'],_0x251911[_0x0f12('0x10c')],_0x251911[_0x0f12('0x65')]]);if(_0x3086c0[_0x0f12('0xa3')]===-0x1){return _0x3086c0;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0xe2'),_0x0f12('0xe1')));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x10d')]=function(_0x1c618e){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1c618e[_0x0f12('0x38')]));return this['channel']['noop'](_0x0f12('0x10d'));};AGIVertices[_0x0f12('0x14')]['getdigits']=function(_0x3c7612){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x10e'),_0x3c7612[_0x0f12('0x38')]));if(_0x3c7612[_0x0f12('0xa7')]===0x0){return this[_0x0f12('0xa5')](_0x3c7612);}_0x3c7612[_0x0f12('0xa7')]-=0x1;if(!this['isConfigured'](_0x3c7612[_0x0f12('0x10f')])){return this[_0x0f12('0xe')]['error'](_0x3c7612,_0x0f12('0x110'));}var _0x1af2e8=this['getSound'][_0x0f12('0xa6')](this,_0x3c7612[_0x0f12('0x10f')]);if(!_0x1af2e8){return this[_0x0f12('0xe')]['error'](_0x3c7612,_0x0f12('0x111'));}if(!this[_0x0f12('0xaa')](_0x3c7612[_0x0f12('0xd4')])){return this[_0x0f12('0xe')]['error'](_0x0f12('0xd5'));}var _0x10730b=this[_0x0f12('0xe')]['getData'](_0x1af2e8,_0x3c7612[_0x0f12('0x112')],_0x3c7612['maxdigit']);var _0x32e196=_0x10730b[_0x0f12('0xa3')]?_0x10730b[_0x0f12('0xa3')]['toString']():'';logger['info'](_0x0f12('0x113'),JSON['stringify'](_0x10730b));if(_0x10730b[_0x0f12('0xa3')]===-0x1){this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x3c7612,_0x32e196);return _0x10730b;}else if(_0x10730b[_0x0f12('0xa2')]===_0x0f12('0x67')){_0x10730b[_0x0f12('0xa3')]=_0x32e196[_0x0f12('0x9a')]>=parseInt(_0x3c7612['mindigit'])?'x':'i';}else{_0x10730b[_0x0f12('0xa3')]=_0x32e196[_0x0f12('0x9a')]>=parseInt(_0x3c7612['mindigit'])&&_0x32e196[_0x0f12('0x9a')]<=parseInt(_0x3c7612['maxdigit'])?'x':'i';}var _0x3a5d29=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x3c7612[_0x0f12('0xd4')]);if(!_0x3a5d29){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3c7612,'no\x20variable\x20found');}this['channel'][_0x0f12('0x9f')](_0x3a5d29,_0x32e196);if(this['isConfigured'](_0x3c7612['hiddendigitsnum'])){var _0x177abb=parseInt(_0x3c7612[_0x0f12('0x114')],0xa);var _0x2a18f1=rs['generate']({'charset':'*','length':_0x177abb});var _0x7cff33=_0x32e196[_0x0f12('0x9a')];if(_0x7cff33>0x0){if(_0x7cff33>_0x177abb){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,_0x3c7612[_0x0f12('0x115')]===_0x0f12('0x116')?_0x2a18f1+_0x32e196['substr'](_0x177abb):_0x32e196[_0x0f12('0x117')](0x0,_0x7cff33-_0x177abb)+_0x2a18f1);}else{this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,rs['generate']({'charset':'*','length':_0x7cff33}));}}else{this[_0x0f12('0x36')]['sync'](this,_0x3c7612,'');}}else{this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x3c7612,_0x32e196);}return _0x10730b;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x118')]=function(_0x4fc936){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x119'),_0x4fc936['label']));return this[_0x0f12('0xd')](_0x4fc936);};AGIVertices['prototype'][_0x0f12('0x11a')]=function(_0x544f00){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x544f00[_0x0f12('0x38')]));this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x544f00,_0x544f00['goalname']);return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x11b'),_0x544f00[_0x0f12('0x11c')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x11d')]=function(_0x35c115){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x35c115[_0x0f12('0x38')]));if(!this['isConfigured'](_0x35c115[_0x0f12('0x87')])||!this['isConfigured'](_0x35c115[_0x0f12('0x88')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x11e'));}if(!this[_0x0f12('0xaa')](_0x35c115['text'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x11f'),_0x35c115[_0x0f12('0x5c')]));var _0x51c17d=this[_0x0f12('0x120')][_0x0f12('0xa6')](this,_0x35c115);if(_0x51c17d){this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x51c17d));var _0xb3d100=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x51c17d);try{fs[_0x0f12('0x103')](_0x51c17d+_0x0f12('0x104'));}catch(_0x4e2658){logger[_0x0f12('0x2d')](_0x4e2658);}return _0xb3d100;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x35c115,_0x0f12('0x121'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x122')]=function(_0x38b750){logger[_0x0f12('0x2f')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x38b750[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x38b750[_0x0f12('0x87')])||!this['isConfigured'](_0x38b750['aws_secret_access_key'])){return this['channel'][_0x0f12('0xad')](_0x0f12('0x11e'));}if(!this[_0x0f12('0xaa')](_0x38b750['aws_bot_name'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x123'));}if(!this['isConfigured'](_0x38b750[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20text\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xe6')]=!![];this[_0x0f12('0x36')](_0x38b750);this[_0x0f12('0x41')](_0x38b750[_0x0f12('0x5c')],'in','','');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x124'),_0x38b750[_0x0f12('0x5c')]));var _0x4f1de9=this[_0x0f12('0x8c')][_0x0f12('0xa6')](this,_0x38b750);if(_0x4f1de9){for(var _0x7eb4fa in _0x4f1de9){if(_0x4f1de9[_0x0f12('0x95')](_0x7eb4fa)&&_[_0x0f12('0x9b')](_0x4f1de9[_0x7eb4fa])){this['channel']['setVariable'](util[_0x0f12('0x2b')]('AWS_LEX_%s',_0x7eb4fa['toUpperCase']()),_0x4f1de9[_0x7eb4fa]);}}if(_['isNil'](_0x4f1de9[_0x0f12('0x77')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0x125'));}else{this['createSquareMessage'](_0x4f1de9['message'],_0x0f12('0xff'),_0x0f12('0x126'),'');return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x127'),_0x4f1de9['message']));}}return this['channel']['error'](_0x38b750,_0x0f12('0x128'));};AGIVertices['prototype'][_0x0f12('0x129')]=function(_0xb0e2fe){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x12a'),_0xb0e2fe[_0x0f12('0x38')],_0xb0e2fe['timeout']));if(!this[_0x0f12('0xaa')](_0xb0e2fe[_0x0f12('0x7b')])){return this['channel'][_0x0f12('0xad')]('no\x20key\x20configured');}var _0x481a42=_0x0f12('0x12b');var _0x536748=util[_0x0f12('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x0f12('0x12c')](0x4));var _0x269131=util[_0x0f12('0x2b')]('%s.%s',_0x536748,_0x481a42);var _0xebd1d0=!![];if(_0xb0e2fe[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0xebd1d0=![];}var _0x121792=this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x536748,_0x481a42,_0xb0e2fe[_0x0f12('0x130')],_0xb0e2fe[_0x0f12('0x67')],undefined,_0xebd1d0);if(_0x121792[_0x0f12('0xa3')]!==-0x1){this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x131'),_0x269131));var _0x5c1fe0=this['googleASR'][_0x0f12('0xa6')](this,_0xb0e2fe,_0x269131);if(_0x5c1fe0){for(var _0x19864b in _0x5c1fe0){if(_0x5c1fe0['hasOwnProperty'](_0x19864b)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0x132'),_0x19864b[_0x0f12('0x6c')]()),_0x5c1fe0[_0x19864b]);}}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x133'),JSON[_0x0f12('0x74')](_0x5c1fe0)));}}return _0x121792;};AGIVertices[_0x0f12('0x14')]['tildeasr']=function(_0x44b5f9){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x44b5f9['label']));if(!this[_0x0f12('0xaa')](_0x44b5f9[_0x0f12('0x91')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20appid\x20configured');}if(!this[_0x0f12('0xaa')](_0x44b5f9[_0x0f12('0x92')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x134'));}var _0x5e0924=_0x0f12('0x12b');var _0x222686=util[_0x0f12('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x0f12('0x12c')](0x4));var _0x135061=util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x222686,_0x5e0924);var _0x465827=!![];if(_0x44b5f9[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0x465827=![];}var _0x44380f=this['channel'][_0x0f12('0x12f')](_0x222686,_0x5e0924,_0x44b5f9[_0x0f12('0x130')],_0x44b5f9[_0x0f12('0x67')],undefined,_0x465827);if(_0x44380f[_0x0f12('0xa3')]!==-0x1){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x135'),_0x135061));var _0x2c0fd7=this[_0x0f12('0x90')][_0x0f12('0xa6')](this,_0x44b5f9,_0x135061);if(_0x2c0fd7){for(var _0x22361b in _0x2c0fd7){if(_0x2c0fd7[_0x0f12('0x95')](_0x22361b)){this[_0x0f12('0xe')][_0x0f12('0x9f')](util[_0x0f12('0x2b')](_0x0f12('0x136'),_0x22361b[_0x0f12('0x6c')]()),_0x2c0fd7[_0x22361b]);}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x137'),JSON[_0x0f12('0x74')](_0x2c0fd7)));}}return _0x44380f;};AGIVertices['prototype']['gotoc']=function(_0x589b87){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x138'),_0x589b87[_0x0f12('0x38')]));return this[_0x0f12('0xe')]['continueAt'](_0x589b87[_0x0f12('0x3c')],_0x589b87['extension'],_0x589b87['priority']);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x139')]=function(_0x3bc4db){logger['info'](util['format'](_0x0f12('0x13a'),_0x3bc4db['label']));if(!this['isConfigured'](_0x3bc4db['condition'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x3bc4db,_0x0f12('0x13b'));}try{var _0x247827=eval(_0x3bc4db[_0x0f12('0x13c')])?_0x0f12('0x13d'):_0x0f12('0x13e');this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x13f'),_0x3bc4db['condition'],_0x247827));return{'code':0xc8,'result':_0x247827};}catch(_0x3dc88c){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x0f12('0x140')]=function(_0x2c4faf){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x2c4faf['label']));if(!this[_0x0f12('0xaa')](_0x2c4faf[_0x0f12('0x141')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2c4faf,_0x0f12('0x142'));}var _0x400a2e=this[_0x0f12('0x26')][_0x0f12('0xa6')](this,_0x2c4faf['interval_id']);if(!_0x400a2e){return this['channel'][_0x0f12('0x2d')](_0x2c4faf,'no\x20intervals\x20found');}for(var _0x1a1255=0x0;_0x1a1255<_0x400a2e[_0x0f12('0x9a')];_0x1a1255+=0x1){var _0x2406e8=this[_0x0f12('0xe')][_0x0f12('0x10')](util[_0x0f12('0x2b')](_0x0f12('0x143'),_0x400a2e[_0x1a1255]));if(_0x2406e8[_0x0f12('0xa3')]===-0x1){return _0x2406e8;}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('IFTIME\x20%s\x20%s',_0x400a2e[_0x1a1255],_0x2406e8['extra']));if(_0x2406e8['extra']===_0x0f12('0x13d')){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x144'),_0x400a2e[_0x1a1255],_0x0f12('0x13d')));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x144'),_0x400a2e[_0x1a1255],_0x0f12('0x13d')));return{'code':0xc8,'result':'true'};}else{logger[_0x0f12('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x400a2e[_0x1a1255],_0x0f12('0x13e')));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x144'),_0x400a2e[_0x1a1255],'false'));}}return{'code':0xc8,'result':_0x0f12('0x13e')};};AGIVertices[_0x0f12('0x14')][_0x0f12('0x145')]=function(_0x3d185d){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x146'),_0x3d185d[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x145')]();};AGIVertices[_0x0f12('0x14')][_0x0f12('0x147')]=function(_0x1f2676){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x148'),_0x1f2676[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x1f2676[_0x0f12('0x7b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xe5'));}var _0x418162=_0x0f12('0x12b');var _0x3a057a=util[_0x0f12('0x2b')](_0x0f12('0x149'),FILES_PATH,rs['generate'](0x4));var _0x4c758e=util[_0x0f12('0x2b')](_0x0f12('0x9e'),_0x3a057a,_0x418162);var _0x12b9ab=!![];if(_0x1f2676[_0x0f12('0x12d')]===_0x0f12('0x12e')){_0x12b9ab=![];}var _0x5606d4=this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x3a057a,_0x418162,_0x1f2676[_0x0f12('0x130')],_0x1f2676[_0x0f12('0x67')],undefined,_0x12b9ab);if(_0x5606d4[_0x0f12('0xa3')]!==-0x1){this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x14a'),_0x4c758e));var _0x220515=this[_0x0f12('0x84')][_0x0f12('0xa6')](this,_0x1f2676,_0x4c758e);if(_0x220515){for(var _0x4c8973 in _0x220515){if(_0x220515[_0x0f12('0x95')](_0x4c8973)){this[_0x0f12('0xe')]['setVariable'](util[_0x0f12('0x2b')]('ISPEECH_ASR_%s',_0x4c8973[_0x0f12('0x6c')]()),_0x220515[_0x4c8973]);}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x14b'),JSON[_0x0f12('0x74')](_0x220515)));}}return _0x5606d4;};AGIVertices[_0x0f12('0x14')][_0x0f12('0x14c')]=function(_0x101824){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x14d'),_0x101824['label']));if(!this['isConfigured'](_0x101824[_0x0f12('0x7b')])){return this['channel'][_0x0f12('0xad')]('no\x20key\x20configured');}if(!this[_0x0f12('0xaa')](_0x101824[_0x0f12('0x5c')])){return this['channel'][_0x0f12('0xad')](_0x0f12('0xc3'));}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x14e'),_0x101824['text']));var _0x12135b=this[_0x0f12('0x81')][_0x0f12('0xa6')](this,_0x101824);if(_0x12135b){this['channel'][_0x0f12('0xad')](util['format']('ispeech\x20%s\x20file\x20created',_0x12135b));var _0xb749ed=this[_0x0f12('0xe')]['streamFile'](_0x12135b,_0x101824[_0x0f12('0x130')]);try{fs[_0x0f12('0x103')](_0x12135b+_0x0f12('0x104'));}catch(_0x20cc50){logger[_0x0f12('0x2d')](_0x20cc50);}return _0xb749ed;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x101824,_0x0f12('0x14f'));};AGIVertices['prototype']['login']=function(_0x2d6b0f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x150'),_0x2d6b0f[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x2d6b0f[_0x0f12('0x151')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d6b0f,'no\x20find\x20by\x20configured');}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x2d6b0f[_0x0f12('0x151')]));var _0x5df8f2=this[_0x0f12('0x53')][_0x0f12('0xa6')](this,_0x2d6b0f[_0x0f12('0x151')]);if(_0x5df8f2){logger['info'](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x2d6b0f[_0x0f12('0x151')]));this['channel'][_0x0f12('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0f12('0x3a')],_0x2d6b0f[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x152')};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this['channel']['callerid'],_0x2d6b0f[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x2d6b0f['findBy']));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x155')]=function(_0x1b5a06){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x156'),_0x1b5a06[_0x0f12('0x38')]));if(!this['isConfigured'](_0x1b5a06[_0x0f12('0x151')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x1b5a06,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x157'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06[_0x0f12('0x151')]));var _0x4f7917=this[_0x0f12('0x52')][_0x0f12('0xa6')](this,_0x1b5a06['findBy']);if(_0x4f7917){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x158'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06['findBy']));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x1b5a06[_0x0f12('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')]['callerid'],_0x1b5a06[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x1b5a06[_0x0f12('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x159')]=function(_0x570481){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x15a'),_0x570481[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x570481[_0x0f12('0x15b')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x570481,'no\x20operation\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')]('math\x20%s',_0x570481['operation']));var _0x4d397e=eval(_0x570481[_0x0f12('0x15b')]);if(!this[_0x0f12('0xaa')](_0x570481[_0x0f12('0xd4')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5d10b2=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x570481[_0x0f12('0xd4')]);if(!_0x5d10b2){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x570481,'no\x20variable\x20found');}if(_[_0x0f12('0x99')](_0x4d397e)){var _0x469cf3=this;_0x4d397e[_0x0f12('0xd7')](function(_0x40e687,_0x1baedc){_0x469cf3['channel'][_0x0f12('0x9f')](util['format'](_0x0f12('0x15c'),_0x5d10b2,_0x1baedc),_0x40e687);});return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x15d'),_0x5d10b2));}else{return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x5d10b2,_0x4d397e);}};AGIVertices[_0x0f12('0x14')][_0x0f12('0xc')]=function(_0x2d9017){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x15e'),_0x2d9017[_0x0f12('0x38')]));if(_0x2d9017[_0x0f12('0xa7')]===0x0){return this[_0x0f12('0xa5')](_0x2d9017);}_0x2d9017[_0x0f12('0xa7')]-=0x1;if(!this[_0x0f12('0xaa')](_0x2d9017[_0x0f12('0x10f')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,_0x0f12('0x110'));}var _0x1c5488=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x2d9017[_0x0f12('0x10f')]);if(!_0x1c5488){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,'no\x20file\x20audio\x20found');}var _0x7cc92c=this[_0x0f12('0xe')][_0x0f12('0x15f')](_0x1c5488,_0x2d9017[_0x0f12('0x112')],_0x2d9017[_0x0f12('0x160')]);var _0x48d02f=_0x7cc92c[_0x0f12('0xa3')];if(_0x7cc92c[_0x0f12('0xa3')]===-0x1){this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x2d9017,'-1');return _0x7cc92c;}else if(_0x7cc92c[_0x0f12('0xa2')]===_0x0f12('0x67')){_0x7cc92c[_0x0f12('0xa3')]=_0x7cc92c['result']['length']>0x0?_0x7cc92c[_0x0f12('0xa3')]:'t';}else if(_['isEmpty'](_0x7cc92c[_0x0f12('0xa3')])){_0x7cc92c[_0x0f12('0xa3')]='#';_0x48d02f='#';}if(!this[_0x0f12('0xaa')](_0x2d9017[_0x0f12('0xd4')])){this['channel'][_0x0f12('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x187593=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x2d9017[_0x0f12('0xd4')]);if(!_0x187593){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x2d9017,_0x0f12('0xd6'));}this[_0x0f12('0xe')]['setVariable'](_0x187593,_0x48d02f);}this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x2d9017,_0x48d02f);return _0x7cc92c;};AGIVertices['prototype'][_0x0f12('0xad')]=function(_0x183857){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x161'),_0x183857['label']));return this['channel'][_0x0f12('0xad')](_0x183857[_0x0f12('0x162')]||_0x183857['label']);};AGIVertices['prototype'][_0x0f12('0x163')]=function(_0x49c9be){logger['info'](util[_0x0f12('0x2b')](_0x0f12('0x164'),_0x49c9be['label']));if(!this[_0x0f12('0xaa')](_0x49c9be['findBy'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x49c9be,_0x0f12('0x165'));}logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x157'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be['findBy']));var _0x23fe6e=this[_0x0f12('0x166')][_0x0f12('0xa6')](this,_0x49c9be['pause_id']);var _0x58b9e0=this['agentPause'][_0x0f12('0xa6')](this,_0x49c9be[_0x0f12('0x151')],_0x23fe6e);if(_0x58b9e0){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')]['callerid'],_0x49c9be['findBy']));this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x152')};}else{logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x158'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x49c9be['findBy']));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices['prototype']['playback']=function(_0x138fc9){logger['info'](util[_0x0f12('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x138fc9[_0x0f12('0x38')]));if(!this['isConfigured'](_0x138fc9[_0x0f12('0x10f')])){return this['channel'][_0x0f12('0x2d')](_0x138fc9,_0x0f12('0x110'));}var _0x2e946f=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x138fc9[_0x0f12('0x10f')]);if(!_0x2e946f){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x138fc9,_0x0f12('0x111'));}var _0x4ed625=this[_0x0f12('0xe')]['exec'](_0x0f12('0x167'),[_0x2e946f,_0x138fc9[_0x0f12('0x10c')]]);if(_0x4ed625['result']===-0x1){return _0x4ed625;}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')]('Executed\x20command\x20%s\x20%s',_0x0f12('0x167'),_0x2e946f));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x168')]=function(_0x9dba58){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x169'),_0x9dba58['label']));if(!this[_0x0f12('0xaa')](_0x9dba58['queue_id'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x9dba58,_0x0f12('0x16a'));}var _0x9f5ba6='';var _0x178872=parseInt(_0x9dba58['queue_id'],0xa);if(isNaN(_0x178872)){_0x9f5ba6=_0x9dba58[_0x0f12('0x16b')];}else{_0x9f5ba6=this[_0x0f12('0x15')][_0x0f12('0xa6')](this,_0x9dba58[_0x0f12('0x16b')]);if(!_0x9f5ba6){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x9dba58,_0x0f12('0x16c'));}}var _0x57caa1='';if(this[_0x0f12('0xaa')](_0x9dba58['file_id'])){var _0x1b12db=this[_0x0f12('0x1f')][_0x0f12('0xa6')](this,_0x9dba58[_0x0f12('0x10f')]);if(_0x1b12db){_0x57caa1=_0x1b12db;}}this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x9dba58,_0x9f5ba6);if(_0x9dba58['opts'][_0x0f12('0x16d')]('x')<0x0){_0x9dba58['opts']+='x';}if(_0x9dba58['opts'][_0x0f12('0x16d')]('X')<0x0){_0x9dba58['opts']+='X';}this[_0x0f12('0xe')]['setVariable'](_0x0f12('0x16e'),_0x9f5ba6?_0x9f5ba6[_0x0f12('0x16f')]():'');var _0x3547e9=this[_0x0f12('0xe')]['exec']('QUEUE',[_0x9f5ba6,_0x9dba58[_0x0f12('0x10c')],_0x9dba58[_0x0f12('0x65')],_0x57caa1,_0x9dba58['timeout'],_0x9dba58[_0x0f12('0x6')],_0x9dba58[_0x0f12('0x170')],_0x9dba58[_0x0f12('0x171')],'',_0x9dba58['position']]);if(_0x3547e9[_0x0f12('0xa3')]===-0x1){return _0x3547e9;}return this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')]('Executed\x20command\x20%s\x20%s',_0x0f12('0x172'),_0x9f5ba6));};AGIVertices['prototype'][_0x0f12('0x173')]=function(_0x30033f){logger['info'](util['format'](_0x0f12('0x174'),_0x30033f['label']));var _0x37721c=_0x30033f[_0x0f12('0x175')]||_0x0f12('0x12b');var _0x583fdf=util[_0x0f12('0x2b')](_0x0f12('0x176'),this['channel'][_0x0f12('0x37')],rs[_0x0f12('0x12c')](0x5));var _0x1e9c88=util[_0x0f12('0x2b')](_0x0f12('0x177'),FILES_PATH,_0x583fdf,_0x37721c);var _0x507b91=util[_0x0f12('0x2b')](_0x0f12('0x149'),FILES_PATH,_0x583fdf);this['createSquareRecording'][_0x0f12('0xa6')](this,_0x30033f,_0x583fdf,_0x1e9c88);this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x0f12('0x178'),_0x583fdf);logger[_0x0f12('0x2f')](_0x0f12('0x179'),_0x507b91,_0x37721c,_0x30033f[_0x0f12('0x17a')],_0x30033f[_0x0f12('0x67')]);return this[_0x0f12('0xe')][_0x0f12('0x12f')](_0x507b91,_0x37721c,_0x30033f[_0x0f12('0x17a')],_0x30033f[_0x0f12('0x67')],undefined,!![]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x17b')]=function(_0x12c06f){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x17c'),_0x12c06f['label']));if(!this['isConfigured'](_0x12c06f[_0x0f12('0x65')])){return this[_0x0f12('0xe')]['noop'](_0x0f12('0x17d'));}var _0x58373d=this[_0x0f12('0x64')][_0x0f12('0xa6')](this,_0x12c06f);logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Response:',util['inspect'](_0x58373d,{'showHidden':![],'depth':null})));if(!this[_0x0f12('0xaa')](_0x12c06f[_0x0f12('0xd4')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x17e'));}var _0x409d98=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x12c06f[_0x0f12('0xd4')]);if(!_0x409d98){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x12c06f,_0x0f12('0xd6'));}this['channel'][_0x0f12('0x9f')](util['format']('%s_STATUS_CODE',_0x409d98),_0x58373d['statusCode']?_0x58373d[_0x0f12('0x76')]:_0x0f12('0x17f'));this[_0x0f12('0xe')]['setVariable'](util[_0x0f12('0x2b')]('%s_STATUS_MESSAGE',_0x409d98),_0x58373d[_0x0f12('0x75')]?_0x58373d[_0x0f12('0x75')]:'OK');if(_0x58373d[_0x0f12('0x6d')]){try{this[_0x0f12('0x9d')](_0x58373d[_0x0f12('0x6d')],_0x409d98);}catch(_0x34b0b9){logger[_0x0f12('0x2d')](util[_0x0f12('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x409d98));}}return this[_0x0f12('0xe')]['noop'](util[_0x0f12('0x2b')](_0x0f12('0x180'),_0x409d98));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x181')]=function(_0x141a7b){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x182'),_0x141a7b['label']));return this[_0x0f12('0xe')][_0x0f12('0x183')](_0x141a7b[_0x0f12('0x184')]['replace'](/\s+/g,''),_0x141a7b[_0x0f12('0x17a')]);};AGIVertices['prototype'][_0x0f12('0x185')]=function(_0x1ac229){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1ac229[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x186')](_0x1ac229['number'][_0x0f12('0x58')](/\s+/g,''),_0x1ac229['escape_digits']);};AGIVertices['prototype'][_0x0f12('0x187')]=function(_0x3f6fe2){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3f6fe2[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0x188')](_0x3f6fe2['text'],_0x3f6fe2[_0x0f12('0x17a')]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x189')]=function(_0x370449){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x18a'),_0x370449[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x370449[_0x0f12('0x18b')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x18c'));}var _0x147b1e=this[_0x0f12('0x22')][_0x0f12('0xa6')](this,_0x370449[_0x0f12('0x18b')]);if(!_0x147b1e||!_0x147b1e['Smtp']){return this[_0x0f12('0xe')]['error'](_0x370449,_0x0f12('0x18d'));}var _0x43df9d={'from':util['format'](_0x0f12('0x18e'),_0x147b1e[_0x0f12('0x17')],_0x147b1e[_0x0f12('0x18f')]||_0x147b1e[_0x0f12('0x190')][_0x0f12('0x191')]),'to':_0x370449['to']||'','cc':_0x370449['cc']||'','bcc':_0x370449[_0x0f12('0x192')]||'','subject':_0x370449[_0x0f12('0x193')],'html':_0x370449[_0x0f12('0x5c')],'text':_0x370449[_0x0f12('0x5c')]};if(this[_0x0f12('0xaa')](_0x370449[_0x0f12('0x194')])){}logger[_0x0f12('0xdc')](_0x0f12('0x195'),JSON[_0x0f12('0x74')](_0x43df9d));this[_0x0f12('0x36')]['sync'](this,_0x370449,_0x370449[_0x0f12('0x18b')]);this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x196'),_0x147b1e[_0x0f12('0x17')]));this[_0x0f12('0x24')][_0x0f12('0xa6')](this,_0x147b1e[_0x0f12('0x197')],_0x43df9d);return this[_0x0f12('0xe')]['noop'](_0x0f12('0x198'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x199')]=function(_0x4f6dc2){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x19a'),_0x4f6dc2[_0x0f12('0x38')]));return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x19b'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x19c')]=function(_0x46c09b){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x46c09b[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x46c09b[_0x0f12('0x19d')])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x19e'));}var _0x49b77f=this[_0x0f12('0x33')]['sync'](this,_0x46c09b[_0x0f12('0x19d')]);if(!_0x49b77f){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x46c09b,'no\x20sms\x20account\x20found');}var _0x3625fe={'body':_0x46c09b[_0x0f12('0x19f')],'phone':_0x46c09b['to']||'','SmsAccountId':_0x49b77f['id']};logger[_0x0f12('0xdc')](_0x0f12('0x1a0'),JSON['stringify'](_0x3625fe));this['createSquareDetailsReport'][_0x0f12('0xa6')](this,_0x46c09b,_0x46c09b[_0x0f12('0x19d')]);this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x1a1'),_0x49b77f['name']));this['createSmsMessage'][_0x0f12('0xa6')](this,_0x3625fe);return this['channel']['noop'](_0x0f12('0x1a2'));};AGIVertices[_0x0f12('0x14')]['set']=function(_0x4454d8){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1a3'),_0x4454d8[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x4454d8[_0x0f12('0xd4')])){return this['channel'][_0x0f12('0x2d')](_0x4454d8,'no\x20variable\x20selected');}var _0x167f3d=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x4454d8[_0x0f12('0xd4')]);if(!_0x167f3d){return this[_0x0f12('0xe')]['error'](_0x4454d8,_0x0f12('0xd6'));}return this[_0x0f12('0xe')][_0x0f12('0x9f')](_0x167f3d,_0x4454d8[_0x0f12('0x1a4')]);};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1a5')]=function(_0x30cd8e){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x30cd8e['label']));this[_0x0f12('0xe')]['noop']('START\x20CALLY\x20SQUARE');var _0x5a88ab=this[_0x0f12('0xe')][_0x0f12('0x10')]('XMCS-UNIQUEID');if(!_[_0x0f12('0x43')](_0x5a88ab[_0x0f12('0xa2')])){this[_0x0f12('0xe')][_0x0f12('0x37')]=_0x5a88ab[_0x0f12('0xa2')];}if(_0x30cd8e[_0x0f12('0xb8')]===_0x0f12('0x1a6')){this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0x1a7'));return this['channel'][_0x0f12('0xb8')]();}return this['channel'][_0x0f12('0xad')](_0x0f12('0x1a8'));};AGIVertices[_0x0f12('0x14')]['subproject']=function(_0xefe931){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1a9'),_0xefe931[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0xefe931[_0x0f12('0x1aa')])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,_0x0f12('0x1ab'));}var _0x1af5a1=this[_0x0f12('0x18')][_0x0f12('0xa6')](this,_0xefe931[_0x0f12('0x1aa')]);if(!this[_0x0f12('0xaa')](_0x1af5a1)){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,util[_0x0f12('0x2b')](_0x0f12('0x1ac'),_0xefe931[_0x0f12('0x1aa')]));}if(_0x1af5a1===this[_0x0f12('0xe')][_0x0f12('0x39')]){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0xefe931,_0x0f12('0x1ad'));}this[_0x0f12('0x36')]['sync'](this,_0xefe931,_0x1af5a1);var _0x46e4a2=this[_0x0f12('0xe')][_0x0f12('0x56')](_0x0f12('0x1ae'),util['format'](_0x0f12('0x1af'),config['agi']['host']||_0x0f12('0x1b0'),_0x1af5a1,this[_0x0f12('0xe')][_0x0f12('0x39')]));if(_0x46e4a2[_0x0f12('0xa3')]===-0x1){return _0x46e4a2;}return this[_0x0f12('0xe')]['noop'](util['format'](_0x0f12('0xbf'),'AGI',_0x1af5a1));};AGIVertices['prototype'][_0x0f12('0x1b1')]=function(_0x358583){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x1b2'),_0x358583['label']));var _0x33cbde=this[_0x0f12('0x55')][_0x0f12('0xa6')](this,_0x358583[_0x0f12('0xb6')]);this[_0x0f12('0x36')][_0x0f12('0xa6')](this,_0x358583,_0x358583[_0x0f12('0xb6')]);if(this[_0x0f12('0xaa')](_0x358583[_0x0f12('0xd4')])){var _0x45222a=this['getVariable'][_0x0f12('0xa6')](this,_0x358583['variable_id']);if(_0x45222a){this[_0x0f12('0xe')]['setVariable'](_0x45222a,_0x33cbde);return this['channel'][_0x0f12('0xad')](util['format'](_0x0f12('0x1b3'),_0x358583[_0x0f12('0xb6')],_0x45222a));}}return this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1b4'),_0x358583[_0x0f12('0xb6')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1b5')]=function(_0x536013){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1b6'),_0x536013[_0x0f12('0x38')]));_0x536013[_0x0f12('0x5c')]=_0x536013['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0f12('0xaa')](_0x536013[_0x0f12('0x5a')])){return this[_0x0f12('0xe')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x536013['text'])){return this[_0x0f12('0xe')][_0x0f12('0xad')](_0x0f12('0xc3'));}this['channel']['noop'](util[_0x0f12('0x2b')](_0x0f12('0x1b7'),_0x536013['text']));var _0x5d765d=this[_0x0f12('0x59')][_0x0f12('0xa6')](this,_0x536013);if(_0x5d765d){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1b8'),_0x5d765d));var _0x3d9648=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x5d765d);try{fs[_0x0f12('0x103')](_0x5d765d+_0x0f12('0x104'));}catch(_0x2c83b4){logger[_0x0f12('0x2d')](_0x2c83b4);}return _0x3d9648;}return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x536013,_0x0f12('0x1b9'));};AGIVertices['prototype'][_0x0f12('0x1ba')]=function(_0x57f49c){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1bb'),_0x57f49c[_0x0f12('0x38')]));_0x57f49c[_0x0f12('0x5c')]=_0x57f49c[_0x0f12('0x5c')][_0x0f12('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x57f49c[_0x0f12('0x5c')])){return this[_0x0f12('0xe')][_0x0f12('0xad')]('no\x20text\x20configured');}this[_0x0f12('0xe')][_0x0f12('0xad')](util['format'](_0x0f12('0x1bc'),_0x57f49c[_0x0f12('0x5c')]));var _0x231079=this['googleTTS']['sync'](this,_0x57f49c);if(_0x231079){this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x1bd'),_0x231079));var _0x12cf9d=this[_0x0f12('0xe')][_0x0f12('0x102')](_0x231079);try{fs['unlink'](_0x231079+_0x0f12('0x104'));}catch(_0x91e487){logger[_0x0f12('0x2d')](_0x91e487);}return _0x12cf9d;}return this['channel']['error'](_0x57f49c,_0x0f12('0x1be'));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1bf')]=function(_0x340e1d){logger[_0x0f12('0x2f')](util['format'](_0x0f12('0x1c0'),_0x340e1d[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x340e1d['findBy'])){return this[_0x0f12('0xe')][_0x0f12('0x2d')](_0x340e1d,_0x0f12('0x165'));}logger['info'](util['format'](_0x0f12('0x157'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));var _0x5c65d3=this['agentUnpause']['sync'](this,_0x340e1d[_0x0f12('0x151')]);if(_0x5c65d3){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x158'),this['channel'][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));this[_0x0f12('0xe')][_0x0f12('0xad')](util[_0x0f12('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this[_0x0f12('0xe')][_0x0f12('0x3a')],_0x340e1d['findBy']));this['channel'][_0x0f12('0xad')](util[_0x0f12('0x2b')](_0x0f12('0x153'),this['channel'][_0x0f12('0x3a')],_0x340e1d[_0x0f12('0x151')]));return{'code':0xc8,'result':_0x0f12('0x154')};}};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1c1')]=function(_0x207fd3){logger['info'](util['format'](_0x0f12('0x1c2'),_0x207fd3[_0x0f12('0x38')]));var _0xfd1c53=this[_0x0f12('0xe')][_0x0f12('0x56')]('VOICEMAIL',[_0x207fd3[_0x0f12('0x1c3')],_0x207fd3[_0x0f12('0x79')]]);if(_0xfd1c53[_0x0f12('0xa3')]===-0x1){return _0xfd1c53;}return this[_0x0f12('0xe')][_0x0f12('0xad')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x207fd3[_0x0f12('0x1c3')]));};AGIVertices[_0x0f12('0x14')][_0x0f12('0x1c4')]=function(_0x3a5adc){logger[_0x0f12('0x2f')](util[_0x0f12('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3a5adc[_0x0f12('0x38')]));if(!this[_0x0f12('0xaa')](_0x3a5adc[_0x0f12('0xd4')])){return this['channel']['error'](_0x3a5adc,_0x0f12('0x1c5'));}var _0x42e135=this[_0x0f12('0x10')][_0x0f12('0xa6')](this,_0x3a5adc['variable_id']);if(!_0x42e135){return this[_0x0f12('0xe')]['error'](_0x3a5adc,_0x0f12('0xd6'));}var _0x5b8abf=this[_0x0f12('0xe')]['getVariable'](_0x42e135);return{'code':0xc8,'result':_0x5b8abf[_0x0f12('0xa2')]?_0x5b8abf[_0x0f12('0xa2')]:'-'};};String[_0x0f12('0x14')][_0x0f12('0xa1')]=function(_0x3addd5,_0x5ac118){return this['split'](_0x3addd5)[_0x0f12('0x1c6')](_0x5ac118);};module[_0x0f12('0x1c7')]=AGIVertices; \ No newline at end of file +var _0x2caf=['variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','indexOf','XMCS-QUEUE','QUEUE','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','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','channel','rpc','prototype','getVariable','getVariableById','name','getVoiceQueueById','then','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','split','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','query','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','unlink','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','opts','finally','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','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','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','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]'];(function(_0x359f9c,_0x2b0def){var _0x22d9f0=function(_0x44cf09){while(--_0x44cf09){_0x359f9c['push'](_0x359f9c['shift']());}};_0x22d9f0(++_0x2b0def);}(_0x2caf,0x6a));var _0xf2ca=function(_0x11b377,_0x1a9fc3){_0x11b377=_0x11b377-0x0;var _0x37d341=_0x2caf[_0x11b377];return _0x37d341;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xf2ca('0x0'))();var rs=require('randomstring');var moment=require(_0xf2ca('0x1'));var Mustache=require(_0xf2ca('0x2'));var rp=require(_0xf2ca('0x3'));var logger=require(_0xf2ca('0x4'))(_0xf2ca('0x5'));var config=require(_0xf2ca('0x6'));var scripts=require(_0xf2ca('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xf2ca('0x8'),_0xf2ca('0x9')];var verticesWithRetry=[_0xf2ca('0xa'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x2fbb08,_0x22ad5d,_0x1177f0){this[_0xf2ca('0xb')]=_0x2fbb08;this[_0xf2ca('0xc')]=_0x22ad5d;this['mailRpc']=_0x1177f0;};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xe')]=function(_0x30e975,_0x4063e9){this[_0xf2ca('0xc')][_0xf2ca('0xf')](_0x30e975)['then'](function(_0x2d0cc7){_0x4063e9(null,_0x2d0cc7?_0x2d0cc7[_0xf2ca('0x10')]:![]);})['catch'](function(_0x88529f){_0x4063e9(_0x88529f);});};AGIVertices[_0xf2ca('0xd')]['getVoiceQueue']=function(_0x5502cc,_0xa4e5b1){this['rpc'][_0xf2ca('0x11')](_0x5502cc)[_0xf2ca('0x12')](function(_0x44906c){_0xa4e5b1(null,_0x44906c?_0x44906c[_0xf2ca('0x10')]:![]);})[_0xf2ca('0x13')](function(_0x2057a2){_0xa4e5b1(_0x2057a2);});};AGIVertices[_0xf2ca('0xd')]['getSquareProject']=function(_0x18500c,_0x4ea298){this[_0xf2ca('0xc')]['getSquareProjectById'](_0x18500c)[_0xf2ca('0x12')](function(_0x6a2b25){_0x4ea298(null,_0x6a2b25?_0x6a2b25['name']:![]);})[_0xf2ca('0x13')](function(_0x160230){_0x4ea298(_0x160230);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x14')]=function(_0x4581e4,_0x1ca233){this[_0xf2ca('0xc')][_0xf2ca('0x15')](_0x4581e4)[_0xf2ca('0x12')](function(_0x24dbde){_0x1ca233(null,_0x24dbde?_0x24dbde[_0xf2ca('0x16')]:![]);})['catch'](function(_0x2a7c27){_0x1ca233(_0x2a7c27);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x17')]=function(_0x51e5d7,_0x41cb71){this[_0xf2ca('0xc')][_0xf2ca('0x18')](_0x51e5d7)[_0xf2ca('0x12')](function(_0x49823b){_0x41cb71(null,_0x49823b?_0x49823b[_0xf2ca('0x10')]:![]);})[_0xf2ca('0x13')](function(_0x56ebed){_0x41cb71(_0x56ebed);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x19')]=function(_0x106e6f,_0x509e33){this['rpc'][_0xf2ca('0x1a')](_0x106e6f)[_0xf2ca('0x12')](function(_0x214fa9){_0x509e33(null,_0x214fa9?_0x214fa9[_0xf2ca('0x10')]:![]);})[_0xf2ca('0x13')](function(_0x427a17){_0x509e33(_0x427a17);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1b')]=function(_0x570aea,_0x18bca4){var _0x2b09a3=this;this[_0xf2ca('0xc')][_0xf2ca('0x1c')](_0x570aea)[_0xf2ca('0x12')](function(_0x41fc04){_0x18bca4(null,_0x41fc04?_0x2b09a3[_0xf2ca('0x1d')](_0x41fc04[_0xf2ca('0x1e')]):![]);})[_0xf2ca('0x13')](function(_0x20a523){_0x18bca4(_0x20a523);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1f')]=function(_0x3e8f86,_0x456e64){this[_0xf2ca('0xc')][_0xf2ca('0x20')](_0x3e8f86)[_0xf2ca('0x12')](function(_0x440888){_0x456e64(null,_0x440888?_0x440888:![]);})[_0xf2ca('0x13')](function(_0x49cdec){_0x456e64(_0x49cdec);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x21')]=function(_0x1c5310,_0x25066b,_0xb75964){this[_0xf2ca('0x22')][_0xf2ca('0x21')](_0x1c5310,_0x25066b)[_0xf2ca('0x12')](function(){_0xb75964(null);})[_0xf2ca('0x13')](function(_0x47bcaf){_0xb75964(_0x47bcaf);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x23')]=function(_0x8d1f59,_0x54c052){this[_0xf2ca('0xc')]['getIntervalById'](_0x8d1f59)[_0xf2ca('0x12')](function(_0x1ccaf3){if(_0x1ccaf3){if(_0x1ccaf3[_0xf2ca('0x24')]){_0x54c052(null,[_0x1ccaf3[_0xf2ca('0x25')]]);}else{_0x54c052(null,_[_0xf2ca('0x26')](_0x1ccaf3['Intervals'],'interval'));}}else{_0x54c052(null,![]);}})[_0xf2ca('0x13')](function(_0x48b49b){_0x54c052(_0x48b49b);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1d')]=function(_0x163cbe){return util[_0xf2ca('0x27')](_0xf2ca('0x28'),FILES_PATH,_0x163cbe);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x29')]=function(_0x3692b1,_0x149df1,_0x1ad216){odbc[_0xf2ca('0x2a')](_0x3692b1,function(_0x453099){if(_0x453099){logger[_0xf2ca('0x2b')](_0xf2ca('0x2c'),_0x453099);_0x1ad216(_0x453099);}else{logger[_0xf2ca('0x2d')](_0xf2ca('0x2e'));odbc['query'](_0x149df1,function(_0x3f669d,_0x3b9f02){if(_0x3f669d){logger[_0xf2ca('0x2d')](_0xf2ca('0x2f'),_0x149df1);_0x1ad216(_0x3f669d);}else{logger['info'](_0xf2ca('0x30'),_0x149df1);odbc['close'](function(_0x53c61){if(_0x53c61){logger[_0xf2ca('0x2b')](_0xf2ca('0x31'),_0x53c61);}_0x1ad216(null,_0x3b9f02);});}});}});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x32')]=function(_0x4fbaec,_0x37e50e){this[_0xf2ca('0xc')]['getSmsAccountById'](_0x4fbaec)[_0xf2ca('0x12')](function(_0x29ebce){_0x37e50e(null,_0x29ebce?_0x29ebce:![]);})[_0xf2ca('0x13')](function(_0x5396ef){_0x37e50e(_0x5396ef);});};AGIVertices[_0xf2ca('0xd')]['createSmsMessage']=function(_0x128419,_0x441c91){this[_0xf2ca('0xc')][_0xf2ca('0x33')](_0x128419)[_0xf2ca('0x12')](function(_0x3f2e98){_0x441c91(null,_0x3f2e98);})[_0xf2ca('0x13')](function(_0xe4494c){_0x441c91(_0xe4494c);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x34')]=function(_0x17de81,_0x3360d9,_0x1f22fc){this[_0xf2ca('0xc')][_0xf2ca('0x34')]({'uniqueid':this['channel'][_0xf2ca('0x35')],'node':_0x17de81[_0xf2ca('0x36')],'application':_0x17de81[_0xf2ca('0x37')],'data':_0x3360d9||null,'project_name':this[_0xf2ca('0xb')][_0xf2ca('0x38')],'callerid':this[_0xf2ca('0xb')][_0xf2ca('0x39')]})[_0xf2ca('0x12')](function(_0x2c6a39){if(_0x1f22fc){_0x1f22fc(null,_0x2c6a39);}})[_0xf2ca('0x13')](function(_0x20f215){if(_0x1f22fc){_0x1f22fc(_0x20f215);}});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x3a')]=function(_0x51a1e3,_0x530212,_0x4037c5,_0x3dfdc9){this['rpc'][_0xf2ca('0x3a')]({'uniqueid':this['channel'][_0xf2ca('0x35')],'callerid':this[_0xf2ca('0xb')][_0xf2ca('0x39')],'calleridname':this['channel'][_0xf2ca('0x3b')],'context':this[_0xf2ca('0xb')]['context'],'extension':this[_0xf2ca('0xb')][_0xf2ca('0x3c')],'priority':this[_0xf2ca('0xb')][_0xf2ca('0x3d')],'accountcode':this['channel'][_0xf2ca('0x3e')],'dnid':this[_0xf2ca('0xb')][_0xf2ca('0x3f')],'projectName':this['channel']['arg_1'],'saveName':_0x530212,'filename':_0x51a1e3[_0xf2ca('0x40')]||_0x530212,'savePath':_0x4037c5})[_0xf2ca('0x12')](function(_0x1a65c6){_0x3dfdc9(null,_0x1a65c6);})[_0xf2ca('0x13')](function(_0x3f31de){_0x3dfdc9(_0x3f31de);});};AGIVertices[_0xf2ca('0xd')]['createSquareMessage']=function(_0x4d595b,_0x22b216,_0x16cc3d,_0x5cee92,_0x2f8ba0){this['rpc'][_0xf2ca('0x41')]({'uniqueid':this['channel'][_0xf2ca('0x35')],'body':_0x4d595b,'direction':_0x22b216,'providerName':_0x16cc3d,'providerResponse':_0x5cee92})['then'](function(_0x535ac6){if(_0x2f8ba0){_0x2f8ba0(null,_0x535ac6);}})[_0xf2ca('0x13')](function(_0x2f2e90){if(_0x2f8ba0){_0x2f8ba0(_0x2f2e90);}});};AGIVertices['prototype'][_0xf2ca('0x42')]=function(_0x3b7014,_0x2eb8d5){this[_0xf2ca('0xc')][_0xf2ca('0x42')]({'firstName':_[_0xf2ca('0x43')](_0x3b7014['name'])||_[_0xf2ca('0x44')](_0x3b7014[_0xf2ca('0x10')])?'callback_'+Math[_0xf2ca('0x45')]():_0x3b7014[_0xf2ca('0x10')],'lastName':_[_0xf2ca('0x43')](_0x3b7014[_0xf2ca('0x46')])||_[_0xf2ca('0x44')](_0x3b7014['lastName'])?null:_0x3b7014['lastName'],'phone':_0x3b7014['phone'],'ListId':_0x3b7014[_0xf2ca('0x47')],'scheduledat':_0x3b7014[_0xf2ca('0x48')],'callbackUniqueid':this[_0xf2ca('0xb')][_0xf2ca('0x35')],'tags':'callback','description':_0xf2ca('0x49')+_0x3b7014[_0xf2ca('0x48')][_0xf2ca('0x4a')](),'priority':_0x3b7014[_0xf2ca('0x4b')]})[_0xf2ca('0x12')](function(_0x2d04a8){_0x2eb8d5(null,_0x2d04a8);})[_0xf2ca('0x13')](function(_0x56b0e5){_0x2eb8d5(_0x56b0e5);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x4c')]=function(_0x2a63f7,_0x48f8c1){this[_0xf2ca('0xc')][_0xf2ca('0x4d')](_0x2a63f7)['then'](function(_0x3d71e2){_0x48f8c1(null,_0x3d71e2?_0x3d71e2[_0xf2ca('0x10')]:![]);})[_0xf2ca('0x13')](function(_0x5efa0b){_0x48f8c1(_0x5efa0b);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x4e')]=function(_0xd867b4,_0x2b94e2,_0x549e92){var _0x57dba5={'role':_0xf2ca('0x4f')};_0x57dba5[_0xd867b4]=this[_0xf2ca('0xb')][_0xf2ca('0x39')];this[_0xf2ca('0xc')]['agentPause'](_0x57dba5,_0x2b94e2,this[_0xf2ca('0xb')]['uniqueid'])[_0xf2ca('0x12')](function(_0x1e579f){_0x549e92(null,_[_0xf2ca('0x44')](_0x1e579f)?![]:!![]);})[_0xf2ca('0x13')](function(_0x5e046d){logger[_0xf2ca('0x2b')](_0x5e046d);_0x549e92(null,![]);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x50')]=function(_0x359eef,_0x40364c){var _0x1c0c42={'role':'agent'};_0x1c0c42[_0x359eef]=this[_0xf2ca('0xb')][_0xf2ca('0x39')];this[_0xf2ca('0xc')][_0xf2ca('0x50')](_0x1c0c42)[_0xf2ca('0x12')](function(_0x490092){_0x40364c(null,_[_0xf2ca('0x44')](_0x490092)?![]:!![]);})[_0xf2ca('0x13')](function(_0x4154ed){logger['error'](_0x4154ed);_0x40364c(null,![]);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x51')]=function(_0x300158,_0x37837a){var _0x315420={'role':_0xf2ca('0x4f')};_0x315420[_0x300158]=this[_0xf2ca('0xb')]['callerid'];this['rpc']['agentLogout'](_0x315420)[_0xf2ca('0x12')](function(_0x456887){_0x37837a(null,_[_0xf2ca('0x44')](_0x456887)?![]:!![]);})[_0xf2ca('0x13')](function(_0xbf858d){logger['error'](_0xbf858d);_0x37837a(null,![]);});};AGIVertices['prototype'][_0xf2ca('0x52')]=function(_0x4bc0dd,_0x1ebce5){var _0x5e66b8={'role':'agent'};_0x5e66b8[_0x4bc0dd]=this['channel'][_0xf2ca('0x39')];var _0xf656fc=_0x4bc0dd!=_0xf2ca('0x53')?util[_0xf2ca('0x27')](_0xf2ca('0x54'),_0xf2ca('0x55'),this[_0xf2ca('0xb')][_0xf2ca('0x39')]):undefined;this['rpc'][_0xf2ca('0x52')](_0x5e66b8,_0xf656fc)[_0xf2ca('0x12')](function(_0x204a59){_0x1ebce5(null,_[_0xf2ca('0x44')](_0x204a59)?![]:!![]);})['catch'](function(_0xba50b2){logger[_0xf2ca('0x2b')](_0xba50b2);_0x1ebce5(null,![]);});};AGIVertices['prototype'][_0xf2ca('0x56')]=function(_0x5ca4ca,_0x438b0f){sh['exec'](_[_0xf2ca('0x57')](_0x5ca4ca),function(_0x2f0ac3,_0x3f0536){var _0x5e3fb7=_0x3f0536[_0xf2ca('0x58')](/(\r\n|\n|\r)/gm,'');_0x438b0f(null,_0x5e3fb7);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x5a6def,_0x30ccc4){scripts[_0xf2ca('0x59')](_0x5a6def[_0xf2ca('0x5a')],_0x5a6def[_0xf2ca('0x5b')]||'text',_0x5a6def[_0xf2ca('0x5c')],_0x5a6def[_0xf2ca('0x5d')]||'en-US',_0x5a6def[_0xf2ca('0x5e')]||_0xf2ca('0x5f'),_0x5a6def['audioEncoding']||_0xf2ca('0x60'))[_0xf2ca('0x12')](function(_0x1b53c6){_0x30ccc4(null,_0x1b53c6);})[_0xf2ca('0x13')](function(_0x242ffe){_0x30ccc4(_0x242ffe);});};AGIVertices[_0xf2ca('0xd')]['googleTTS']=function(_0x22a17d,_0x29c117){scripts[_0xf2ca('0x61')](_0x22a17d[_0xf2ca('0x5c')],_0x22a17d[_0xf2ca('0x62')]||'en',0x1)[_0xf2ca('0x12')](function(_0x436d17){_0x29c117(null,_0x436d17);})['catch'](function(_0x242dc0){_0x29c117(_0x242dc0);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x63')]=function(_0x424dad,_0x5bea6e){var _0x581886={'uri':_0x424dad[_0xf2ca('0x64')],'method':_0x424dad['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x424dad['timeout'])===_0xf2ca('0x65')&&parseInt(_0x424dad[_0xf2ca('0x66')])>=0x1?parseInt(_0x424dad[_0xf2ca('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xf2ca('0x67'),_0xf2ca('0x68')],_0x581886[_0xf2ca('0x69')][_0xf2ca('0x6a')]())){try{_0x581886[_0xf2ca('0x6b')]=_0x424dad['rawBody']?JSON[_0xf2ca('0x6c')](_0x424dad[_0xf2ca('0x9')]):{};}catch(_0x5b7d19){logger[_0xf2ca('0x2b')](_0xf2ca('0x6d'),_0x5b7d19);}}try{_0x581886[_0xf2ca('0x6e')]=_0x424dad[_0xf2ca('0x8')]?JSON[_0xf2ca('0x6c')](_0x424dad[_0xf2ca('0x8')]):{};}catch(_0x14b9cd){logger[_0xf2ca('0x2b')](_0xf2ca('0x6f'),_0x14b9cd);}if(_0x424dad['computedVariables']){try{var _0x4453ba=require(_0x424dad[_0xf2ca('0x70')])[_0xf2ca('0x71')](this,_0x581886);_0x581886[_0xf2ca('0x72')]=Mustache[_0xf2ca('0x73')](_0x424dad[_0xf2ca('0x64')],_0x4453ba,{},['$$','$$']);if(_0x581886['headers']){_0x581886['headers']=JSON[_0xf2ca('0x6c')](Mustache[_0xf2ca('0x73')](JSON[_0xf2ca('0x74')](_0x581886[_0xf2ca('0x6e')]),_0x4453ba,{},['$$','$$']));}if(_0x581886[_0xf2ca('0x6b')]){_0x581886[_0xf2ca('0x6b')]=JSON[_0xf2ca('0x6c')](Mustache[_0xf2ca('0x73')](JSON['stringify'](_0x581886[_0xf2ca('0x6b')]),_0x4453ba,{},['$$','$$']));}}catch(_0x1b16b1){logger[_0xf2ca('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1b16b1);}}rp(_0x581886)[_0xf2ca('0x12')](function(_0x3d1f8){var _0xd924da={'statusCode':_0x3d1f8[_0xf2ca('0x75')]||0xc8,'statusMessage':_0x3d1f8['statusMessage']||'OK','headers':_0x3d1f8[_0xf2ca('0x6e')]||{},'body':_0x3d1f8[_0xf2ca('0x6b')]||{}};_0x5bea6e(null,_0xd924da);})[_0xf2ca('0x13')](function(_0x373b5f){var _0x850fa6={'statusCode':_0x373b5f['statusCode']||0x1f4,'statusMessage':_0x373b5f[_0xf2ca('0x76')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x373b5f[_0xf2ca('0x77')][_0xf2ca('0x6e')]||{},'body':_0x373b5f[_0xf2ca('0x77')][_0xf2ca('0x6b')]||{}};_0x5bea6e(null,_0x850fa6);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1bb147,_0x1d3e6f){scripts[_0xf2ca('0x78')](this[_0xf2ca('0xb')][_0xf2ca('0x35')],_0x1bb147[_0xf2ca('0x79')],_0x1bb147[_0xf2ca('0x5c')],_0x1bb147[_0xf2ca('0x7a')]||'en')['then'](function(_0x7c3113){_0x1d3e6f(null,_0x7c3113);})[_0xf2ca('0x13')](function(_0x149066){_0x1d3e6f(_0x149066);});};AGIVertices[_0xf2ca('0xd')]['googleDialogflowV2']=function(_0x494761,_0x23f9cf){scripts['googleDialogflowV2'](this[_0xf2ca('0xb')][_0xf2ca('0x35')],_0x494761[_0xf2ca('0x7b')],_0x494761[_0xf2ca('0x7c')],_0x494761['private_key'],_0x494761[_0xf2ca('0x5c')],_0x494761['dialogflowV2_language']||'en')[_0xf2ca('0x12')](function(_0x1bc4c2){_0x23f9cf(null,_0x1bc4c2);})[_0xf2ca('0x13')](function(_0x49ff48){_0x23f9cf(_0x49ff48);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x7d')]=function(_0x278f5b,_0x1f9151){scripts[_0xf2ca('0x7d')](this['channel'],_0x278f5b)['then'](function(_0x182dfd){_0x1f9151(null,_0x182dfd);})[_0xf2ca('0x13')](function(_0x17148d){_0x1f9151(_0x17148d);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x7e')]=function(_0x26180e,_0xd9b3f3){scripts[_0xf2ca('0x7e')](_0x26180e[_0xf2ca('0x79')],_0x26180e[_0xf2ca('0x5c')],_0x26180e[_0xf2ca('0x7f')]||_0xf2ca('0x80'),_0x26180e[_0xf2ca('0x81')])['then'](function(_0x3a9194){_0xd9b3f3(null,_0x3a9194);})['catch'](function(_0x564ef2){_0xd9b3f3(_0x564ef2);});};AGIVertices['prototype'][_0xf2ca('0x82')]=function(_0x37a711,_0x367322,_0x3782fc){scripts[_0xf2ca('0x82')](_0x367322,_0x37a711[_0xf2ca('0x79')],_0x37a711[_0xf2ca('0x83')]||_0xf2ca('0x80'),this[_0xf2ca('0x84')](_0x37a711[_0xf2ca('0x85')])?_0x37a711[_0xf2ca('0x85')]:undefined)['then'](function(_0x4a9748){_0x3782fc(null,_0x4a9748);})['catch'](function(_0x254377){_0x3782fc(_0x254377);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x86')]=function(_0x44d999,_0x53cd2c){scripts[_0xf2ca('0x86')](_0x44d999[_0xf2ca('0x87')],_0x44d999['aws_secret_access_key'],_0x44d999[_0xf2ca('0x88')],_0x44d999[_0xf2ca('0x89')]||_0xf2ca('0x8a'),_0x44d999[_0xf2ca('0x5c')],_0x44d999[_0xf2ca('0x8b')]||_0xf2ca('0x5c'))[_0xf2ca('0x12')](function(_0x1b3f41){_0x53cd2c(null,_0x1b3f41);})[_0xf2ca('0x13')](function(_0x27c590){_0x53cd2c(_0x27c590);});};AGIVertices[_0xf2ca('0xd')]['awsLex']=function(_0x9ebd90,_0x1c1a4c){scripts[_0xf2ca('0x8c')](this[_0xf2ca('0xb')][_0xf2ca('0x35')],_0x9ebd90[_0xf2ca('0x87')],_0x9ebd90['aws_secret_access_key'],_0x9ebd90[_0xf2ca('0x8d')],_0x9ebd90[_0xf2ca('0x5c')],_0x9ebd90['aws_bot_name'])['then'](function(_0x136ec6){_0x1c1a4c(null,_0x136ec6);})[_0xf2ca('0x13')](function(_0x31d162){_0x1c1a4c(_0x31d162);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x8e')]=function(_0x3f9019,_0x3031a5,_0x36da44){scripts[_0xf2ca('0x8e')](_0x3031a5,_0x3f9019[_0xf2ca('0x79')],_0x3f9019[_0xf2ca('0x8f')]||'en-US')[_0xf2ca('0x12')](function(_0x3f4a51){_0x36da44(null,_0x3f4a51);})[_0xf2ca('0x13')](function(_0x1d18a9){_0x36da44(_0x1d18a9);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x90')]=function(_0x370a2c,_0x1edd82,_0x34f563){scripts[_0xf2ca('0x90')](_0x1edd82,_0x370a2c[_0xf2ca('0x91')],_0x370a2c[_0xf2ca('0x92')],_0x370a2c['uri'])[_0xf2ca('0x12')](function(_0x36b066){_0x34f563(null,_0x36b066);})[_0xf2ca('0x13')](function(_0x1ad364){_0x34f563(_0x1ad364);});};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x93')]=function(_0x13d9d5){var _0x31226d=_[_0xf2ca('0x94')](verticesWithRetry,_0x13d9d5[_0xf2ca('0x37')])?_0x13d9d5:_[_0xf2ca('0x95')](_0x13d9d5);for(var _0x4598fa in _0x31226d){if(_0x31226d[_0xf2ca('0x96')](_0x4598fa)){if(_0x31226d[_0x4598fa]&&_['isString'](_0x31226d[_0x4598fa])){if(_[_0xf2ca('0x94')](recursiveMapAttributes,_0x4598fa)){_0x31226d[_0x4598fa]=this[_0xf2ca('0x97')](_0x31226d[_0x4598fa]);}else{_0x31226d[_0x4598fa]=this[_0xf2ca('0x98')](_0x31226d[_0x4598fa]);}}}}return _0x31226d;};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x99')]=function(_0x327e50){for(var _0x5796f2 in _0x327e50){if(_0x327e50[_0xf2ca('0x96')](_0x5796f2)){if(_[_0xf2ca('0x9a')](_0x327e50[_0x5796f2])){this[_0xf2ca('0x99')](_0x327e50[_0x5796f2]);}else if(_[_0xf2ca('0x9b')](_0x327e50[_0x5796f2])){for(var _0x40f7cd=0x0;_0x40f7cd<_0x327e50[_0x5796f2]['length'];_0x40f7cd++){this[_0xf2ca('0x99')](_0x327e50[_0x5796f2][_0x40f7cd]);}}else if(_[_0xf2ca('0x9c')](_0x327e50[_0x5796f2])){_0x327e50[_0x5796f2]=this[_0xf2ca('0x98')](_0x327e50[_0x5796f2]);}}}};AGIVertices[_0xf2ca('0xd')]['saveRestApiResult']=function(_0x5645b6,_0x4f02bd){for(var _0x677915 in _0x5645b6){if(_0x5645b6[_0xf2ca('0x96')](_0x677915)){if(_[_0xf2ca('0x9a')](_0x5645b6[_0x677915])){if(!_[_0xf2ca('0x43')](_0x5645b6[_0x677915])){this[_0xf2ca('0x9d')](_0x5645b6[_0x677915],util[_0xf2ca('0x27')](_0xf2ca('0x9e'),_0x4f02bd,_0x677915));}}else if(_['isArray'](_0x5645b6[_0x677915])){for(var _0x45e74d=0x0;_0x45e74d<_0x5645b6[_0x677915][_0xf2ca('0x9f')];_0x45e74d++){this[_0xf2ca('0x9d')](_0x5645b6[_0x677915][_0x45e74d],util[_0xf2ca('0x27')]('%s.%s',_0x4f02bd,_0x677915+'['+_0x45e74d+']'));}}else{if(!_[_0xf2ca('0x44')](_0x5645b6[_0x677915])){this['channel'][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0x9e'),_0x4f02bd,_0x677915),_0x5645b6[_0x677915]);}}}}};AGIVertices['prototype'][_0xf2ca('0x97')]=function(_0x2709d1){try{var _0x3e5486=JSON[_0xf2ca('0x6c')](_0x2709d1);this['recursiveNodeIndex'](_0x3e5486);return JSON[_0xf2ca('0x74')](_0x3e5486);}catch(_0x1a7b03){return this[_0xf2ca('0x98')](_0x2709d1);}};AGIVertices[_0xf2ca('0xd')]['replaceAllVariables']=function(_0x5176df){var _0x44a138=_0x5176df[_0xf2ca('0xa1')]('{');for(var _0xefe761=0x1;_0xefe761<_0x44a138[_0xf2ca('0x9f')];_0xefe761+=0x1){var _0x2c5e1e=_0x44a138[_0xefe761]['split']('}');if(_0x2c5e1e['length']>0x1){_0x5176df=_0x5176df['replaceAll']('{'+_0x2c5e1e[0x0]+'}',this[_0xf2ca('0xb')][_0xf2ca('0xe')](_0x2c5e1e[0x0])[_0xf2ca('0xa2')]||_0x2c5e1e[0x0]);}}if(_0x44a138[_0xf2ca('0x9f')]===0x1){return _0x5176df[_0xf2ca('0x4a')]();}return this[_0xf2ca('0x98')](_0x5176df);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xa3')]=function(_0x2faeaf,_0x4d3214){var _0x23a833=this[_0xf2ca('0xb')][_0xf2ca('0xe')](_0x2faeaf);if(_0x23a833[_0xf2ca('0xa4')]===-0x1){return _0x23a833;}logger[_0xf2ca('0x2d')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d3214,_0x23a833[_0xf2ca('0xa2')]));return this[_0xf2ca('0xb')]['setVariable'](_0x4d3214,_0x23a833[_0xf2ca('0xa2')]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x84')]=function(_0x2d7ce2){return _0x2d7ce2&&_0x2d7ce2!=='0'&&_0x2d7ce2!=='-1'&&_0x2d7ce2!=='';};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xa5')]=function(_0x5989f9){this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x5989f9,'-');_0x5989f9[_0xf2ca('0xa6')]=_0x5989f9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xf2ca('0xa7')]=function(_0x58ac5f){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0xa8'),_0x58ac5f[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x58ac5f[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}var _0x4253b5='\x22'+_0x58ac5f[_0xf2ca('0x5c')]+'\x22';if(this[_0xf2ca('0x84')](_0x58ac5f[_0xf2ca('0x77')])){_0x4253b5+=','+_0x58ac5f[_0xf2ca('0x77')];}var _0x4b0478=this[_0xf2ca('0xb')][_0xf2ca('0xab')](_0xf2ca('0xac'),_0x4253b5);if(_0x4b0478[_0xf2ca('0xa4')]===-0x1){return _0x4b0478;}return this['channel']['noop'](util[_0xf2ca('0x27')](_0xf2ca('0xad'),_0x4253b5));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xae')]=function(_0x5808e5){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xaf'),_0x5808e5['label']));if(!this[_0xf2ca('0x84')](_0x5808e5[_0xf2ca('0xb0')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xb1'));}var _0x5da17f=_0x5808e5[_0xf2ca('0xb0')];if(this[_0xf2ca('0x84')](_0x5808e5['options'])){_0x5da17f+=','+_0x5808e5[_0xf2ca('0x77')];}var _0x44db90=this[_0xf2ca('0xb')][_0xf2ca('0xab')]('MRCPRecog',_0x5da17f);if(_0x44db90['result']===-0x1){return _0x44db90;}var _0x272e23=this[_0xf2ca('0xa3')](_0xf2ca('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x272e23[_0xf2ca('0xa4')]===-0x1){return _0x272e23;}var _0x4cc643=this[_0xf2ca('0xa3')](_0xf2ca('0xb3'),_0xf2ca('0xb4'));if(_0x4cc643['result']===-0x1){return _0x4cc643;}var _0x3bea88=this[_0xf2ca('0xa3')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x3bea88['result']===-0x1){return _0x3bea88;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util['format'](_0xf2ca('0xb5'),_0x5da17f));};AGIVertices[_0xf2ca('0xd')]['agi']=function(_0x7e8fda){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0xb6'),_0x7e8fda[_0xf2ca('0x36')]));return this['channel'][_0xf2ca('0x5')]([_0x7e8fda[_0xf2ca('0xb7')],_0x7e8fda[_0xf2ca('0xb8')]]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xb9')]=function(_0x507961){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x507961['label']));if(this[_0xf2ca('0x84')](_0x507961[_0xf2ca('0x66')])){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xba'),_0x507961['timeout']));var _0x2ac7c9=this[_0xf2ca('0xb')][_0xf2ca('0xbb')](_0x507961[_0xf2ca('0x66')]);if(_0x2ac7c9[_0xf2ca('0xa4')]===-0x1){return _0x2ac7c9;}}return this[_0xf2ca('0xb')][_0xf2ca('0xb9')]();};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xbc')]=function(_0xefb798){logger[_0xf2ca('0x2d')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xefb798[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0xefb798[_0xf2ca('0x47')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0xefb798,'no\x20list\x20selected');}_0xefb798[_0xf2ca('0x48')]=moment();if(this['isConfigured'](_0xefb798[_0xf2ca('0xbd')])){_0xefb798['scheduledAt']=moment()['add'](_0xefb798[_0xf2ca('0xbd')],'minutes');}if(!this[_0xf2ca('0x84')](_0xefb798[_0xf2ca('0x4b')])){_0xefb798[_0xf2ca('0x4b')]=0x2;}this[_0xf2ca('0x42')][_0xf2ca('0x71')](this,_0xefb798);return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0xbe'),_0xefb798[_0xf2ca('0xbf')],_0xefb798[_0xf2ca('0x47')],_0xefb798[_0xf2ca('0x48')]));};AGIVertices[_0xf2ca('0xd')]['custom_app']=function(_0x5688c4){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0xc0'),_0x5688c4[_0xf2ca('0x36')]));var _0x3df46a=this['channel'][_0xf2ca('0xab')](_0x5688c4[_0xf2ca('0xc1')],_0x5688c4['options']);if(_0x3df46a[_0xf2ca('0xa4')]===-0x1){return _0x3df46a;}return this[_0xf2ca('0xb')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x5688c4[_0xf2ca('0xc1')],_0x5688c4[_0xf2ca('0x77')]));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xc2')]=function(_0x2d6356){logger['info'](util['format'](_0xf2ca('0xc3'),_0x2d6356[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x2d6356[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}var _0x50d895='\x22'+_0x2d6356[_0xf2ca('0x5c')]+'\x22';if(this['isConfigured'](_0x2d6356[_0xf2ca('0x77')])){_0x50d895+=','+_0x2d6356[_0xf2ca('0x77')];}var _0x3d5945=this[_0xf2ca('0xb')][_0xf2ca('0xab')](_0xf2ca('0xac'),_0x50d895);if(_0x3d5945[_0xf2ca('0xa4')]===-0x1){return _0x3d5945;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xad'),_0x50d895));};AGIVertices[_0xf2ca('0xd')]['sestektts']=function(_0x272bb0){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xc4'),_0x272bb0[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x272bb0[_0xf2ca('0x5c')])){return this['channel'][_0xf2ca('0xa9')]('no\x20text\x20configured');}var _0x428bb7='\x22'+_0x272bb0[_0xf2ca('0x5c')]+'\x22';if(this[_0xf2ca('0x84')](_0x272bb0[_0xf2ca('0x77')])){_0x428bb7+=','+_0x272bb0['options'];}var _0x1556ae=this[_0xf2ca('0xb')]['exec'](_0xf2ca('0xac'),_0x428bb7);if(_0x1556ae['result']===-0x1){return _0x1556ae;}return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x428bb7));};AGIVertices[_0xf2ca('0xd')]['lumenvoxasr']=function(_0x416b6f){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xc5'),_0x416b6f[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x416b6f[_0xf2ca('0xb0')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')]('no\x20grammar\x20configured');}var _0xaa2282=_0x416b6f[_0xf2ca('0xb0')];if(this[_0xf2ca('0x84')](_0x416b6f[_0xf2ca('0x77')])){_0xaa2282+=','+_0x416b6f[_0xf2ca('0x77')];}var _0x18d308=this['channel'][_0xf2ca('0xab')](_0xf2ca('0xc6'),_0xaa2282);if(_0x18d308[_0xf2ca('0xa4')]===-0x1){return _0x18d308;}var _0x38ce26=this[_0xf2ca('0xa3')]('RECOG_CONFIDENCE()',_0xf2ca('0xc7'));if(_0x38ce26[_0xf2ca('0xa4')]===-0x1){return _0x38ce26;}var _0x422ebc=this[_0xf2ca('0xa3')]('RECOG_INPUT()',_0xf2ca('0xc8'));if(_0x422ebc['result']===-0x1){return _0x422ebc;}var _0x27bab4=this[_0xf2ca('0xa3')](_0xf2ca('0xc9'),_0xf2ca('0xca'));if(_0x27bab4[_0xf2ca('0xa4')]===-0x1){return _0x27bab4;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xaa2282));};AGIVertices['prototype'][_0xf2ca('0xcb')]=function(_0x169bbe){logger[_0xf2ca('0x2d')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x169bbe[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x169bbe['grammar'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xb1'));}var _0x5505a5=_0x169bbe[_0xf2ca('0xb0')];if(this[_0xf2ca('0x84')](_0x169bbe[_0xf2ca('0x77')])){_0x5505a5+=','+_0x169bbe[_0xf2ca('0x77')];}var _0xcee971=this[_0xf2ca('0xb')][_0xf2ca('0xab')](_0xf2ca('0xc6'),_0x5505a5);if(_0xcee971[_0xf2ca('0xa4')]===-0x1){return _0xcee971;}var _0x2ab1f9=this[_0xf2ca('0xa3')](_0xf2ca('0xb2'),_0xf2ca('0xcc'));if(_0x2ab1f9['result']===-0x1){return _0x2ab1f9;}var _0x16f90d=this[_0xf2ca('0xa3')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x16f90d[_0xf2ca('0xa4')]===-0x1){return _0x16f90d;}var _0x4e7637=this[_0xf2ca('0xa3')](_0xf2ca('0xc9'),_0xf2ca('0xcd'));if(_0x4e7637[_0xf2ca('0xa4')]===-0x1){return _0x4e7637;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xb5'),_0x5505a5));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xce')]=function(_0x5b53eb){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xcf'),_0x5b53eb[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x5b53eb['odbc_id'])){return this[_0xf2ca('0xb')]['error'](_0x5b53eb,'no\x20database\x20selected');}var _0x193794=this[_0xf2ca('0x14')][_0xf2ca('0x71')](this,_0x5b53eb['odbc_id']);if(!_0x193794){return this[_0xf2ca('0xb')]['error'](_0x5b53eb,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5b53eb[_0xf2ca('0xd0')])){return this[_0xf2ca('0xb')]['error'](_0x5b53eb,'no\x20query\x20configured');}var _0x1ade53=_0x5b53eb[_0xf2ca('0xd0')][_0xf2ca('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0xd1'),_0x1ade53));var _0x65ed3=this['getQueryOdbc'][_0xf2ca('0x71')](this,_0x193794,_0x1ade53);this[_0xf2ca('0x34')]['sync'](this,_0x5b53eb,_0x1ade53);if(!this[_0xf2ca('0x84')](_0x5b53eb['variable_id'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xd2'));}var _0x3237fd=this[_0xf2ca('0xe')]['sync'](this,_0x5b53eb[_0xf2ca('0xd3')]);if(!_0x3237fd){return this[_0xf2ca('0xb')]['error'](_0x5b53eb,'no\x20variable\x20found');}var _0x27e1f2=this;_0x65ed3[_0xf2ca('0xd4')](function(_0x4d9a27,_0x24325c){Object['keys'](_0x4d9a27)[_0xf2ca('0xd4')](function(_0x208f00){_0x27e1f2['channel'][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0xd5'),_0x3237fd,_0x24325c,_0x208f00),_0x4d9a27[_0x208f00]);});});this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0xd6'),_0x3237fd),_0x65ed3['length']);return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xd7'),_0x3237fd));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xd8')]=function(_0x5646e7){logger[_0xf2ca('0xd9')](util[_0xf2ca('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5646e7['label']));if(!this[_0xf2ca('0x84')](_0x5646e7[_0xf2ca('0xda')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x5646e7,_0xf2ca('0xdb'));}var _0x1a04ee=this[_0xf2ca('0x17')]['sync'](this,_0x5646e7['sip_id']);if(!_0x1a04ee){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x5646e7,_0xf2ca('0xdc'));}var _0xee54ab=this[_0xf2ca('0xb')][_0xf2ca('0xab')]('DIAL',[util['format'](_0xf2ca('0xdd'),_0x1a04ee),_0x5646e7['timeout'],_0x5646e7['opts'],_0x5646e7[_0xf2ca('0x64')]]);if(_0xee54ab['result']===-0x1){return _0xee54ab;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xde'),_0xf2ca('0xdf')));};AGIVertices[_0xf2ca('0xd')]['dialogflow']=function(_0x34e7de){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x34e7de[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x34e7de['key'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xe0'));}if(!this['isConfigured'](_0x34e7de[_0xf2ca('0x5c')])){return this['channel'][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}this[_0xf2ca('0xb')][_0xf2ca('0xe1')]=!![];this['createSquareDetailsReport'](_0x34e7de);this[_0xf2ca('0x41')](_0x34e7de['text'],'in','','');this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xe2'),_0x34e7de[_0xf2ca('0x5c')]));var _0x5bc0e9=this[_0xf2ca('0x78')]['sync'](this,_0x34e7de);if(_0x5bc0e9){for(var _0x5b664b in _0x5bc0e9){if(_0x5bc0e9[_0xf2ca('0x96')](_0x5b664b)){this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util['format'](_0xf2ca('0xe3'),_0x5b664b[_0xf2ca('0x6a')]()),_0x5bc0e9[_0x5b664b]);}}this[_0xf2ca('0x41')](_0x5bc0e9[_0xf2ca('0xe4')],_0xf2ca('0xe5'),_0xf2ca('0xe6'),'');return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0xe7'),_0x5bc0e9['speech']));}return this[_0xf2ca('0xb')]['error'](_0x34e7de,_0xf2ca('0xe8'));};AGIVertices[_0xf2ca('0xd')]['dialogflowV2']=function(_0x512235){logger['info'](util[_0xf2ca('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x512235['label']));if(!this['isConfigured'](_0x512235[_0xf2ca('0x7b')])){return this[_0xf2ca('0xb')]['noop']('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x512235[_0xf2ca('0x7c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xe9'));}if(!this['isConfigured'](_0x512235[_0xf2ca('0xea')])){return this['channel'][_0xf2ca('0xa9')](_0xf2ca('0xeb'));}if(!this[_0xf2ca('0x84')](_0x512235[_0xf2ca('0xec')])){return this[_0xf2ca('0xb')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x512235[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}this[_0xf2ca('0xb')][_0xf2ca('0xe1')]=!![];this[_0xf2ca('0x34')](_0x512235);this[_0xf2ca('0x41')](_0x512235[_0xf2ca('0x5c')],'in','','');this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xed'),_0x512235[_0xf2ca('0x5c')]));var _0x150e48=this[_0xf2ca('0xee')]['sync'](this,_0x512235);if(_0x150e48){for(var _0x90b276 in _0x150e48){if(_0x150e48['hasOwnProperty'](_0x90b276)){if(_0x90b276!=='providerResponse'){this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util['format'](_0xf2ca('0xe3'),_0x90b276[_0xf2ca('0x6a')]()),_0x150e48[_0x90b276]);}}}this[_0xf2ca('0x41')](_0x150e48['speech'],_0xf2ca('0xe5'),_0xf2ca('0xef'),_0x150e48['providerResponse']);return this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xf0'),_0x150e48[_0xf2ca('0xe4')]));}return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x512235,_0xf2ca('0xf1'));};AGIVertices[_0xf2ca('0xd')]['sesteknda']=function(_0x72c6da){logger['info'](util['format'](_0xf2ca('0xf2'),_0x72c6da[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x72c6da[_0xf2ca('0xf3')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xf4'));}if(!this[_0xf2ca('0x84')](_0x72c6da[_0xf2ca('0xf5')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xf6'));}if(!this['isConfigured'](_0x72c6da['password'])){return this[_0xf2ca('0xb')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x72c6da[_0xf2ca('0xf7')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}this[_0xf2ca('0xb')][_0xf2ca('0xe1')]=!![];this[_0xf2ca('0x34')](_0x72c6da);this[_0xf2ca('0x41')](_0x72c6da[_0xf2ca('0x5c')],'in','','');this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xf8'),_0x72c6da[_0xf2ca('0x5c')]));var _0x4340a5=this[_0xf2ca('0x7d')][_0xf2ca('0x71')](this,_0x72c6da);if(_0x4340a5){for(var _0x7e1f2b in _0x4340a5){if(_0x4340a5[_0xf2ca('0x96')](_0x7e1f2b)){this['channel']['setVariable'](util[_0xf2ca('0x27')](_0xf2ca('0xf9'),_0x7e1f2b['toUpperCase']()),_0x4340a5[_0x7e1f2b]);}}this[_0xf2ca('0x41')](_0x4340a5[_0xf2ca('0xe4')],_0xf2ca('0xe5'),_0xf2ca('0xfa'),'');if(_0x4340a5['audiofile']){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x4340a5[_0xf2ca('0xfb')]));var _0x58bd4a=this[_0xf2ca('0xb')]['streamFile'](_0x4340a5['audiofile']);try{fs[_0xf2ca('0xfc')](_0x4340a5['audiofile']+_0xf2ca('0xfd'));}catch(_0x5f123d){logger[_0xf2ca('0x2b')](_0x5f123d);}return _0x58bd4a;}else{return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('SestekNDA\x20Result\x20%s',_0x4340a5[_0xf2ca('0xe4')]));}}return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x72c6da,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0xfe')]=function(_0x4b47a4){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0xff'),_0x4b47a4[_0xf2ca('0x36')]));return this[_0xf2ca('0xb')][_0xf2ca('0xa9')]('end');};AGIVertices['prototype'][_0xf2ca('0x100')]=function(_0x20a311){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x101'),_0x20a311[_0xf2ca('0x36')]));var _0x38957c='';if(_0x20a311[_0xf2ca('0x102')]){if(!this[_0xf2ca('0x84')](_0x20a311[_0xf2ca('0x102')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x20a311,'no\x20trunk\x20selected');}else{var _0x3080ec=parseInt(_0x20a311['trunk_id'],0xa);if(isNaN(_0x3080ec)){_0x38957c=_0x20a311[_0xf2ca('0x102')];}else{_0x38957c=this['getTrunk'][_0xf2ca('0x71')](this,_0x20a311[_0xf2ca('0x102')]);if(!_0x38957c){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x20a311,'no\x20trunk\x20found');}}}}else if(_0x20a311['trunk_name']){_0x38957c=_0x20a311[_0xf2ca('0x103')];}else{return this[_0xf2ca('0xb')]['error'](_0x20a311,_0xf2ca('0x104'));}var _0xba4552=this[_0xf2ca('0xb')]['exec'](_0xf2ca('0xdf'),[util[_0xf2ca('0x27')]('SIP/%s/%s',_0x38957c,_0x20a311[_0xf2ca('0xbf')]),_0x20a311['timeout'],_0x20a311[_0xf2ca('0x105')],_0x20a311['url']]);if(_0xba4552[_0xf2ca('0xa4')]===-0x1){return _0xba4552;}return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0xde'),'DIAL'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x106')]=function(_0x144ebc){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x107'),_0x144ebc[_0xf2ca('0x36')]));return this['channel'][_0xf2ca('0xa9')](_0xf2ca('0x106'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x108')]=function(_0x30c55b){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x109'),_0x30c55b['label']));if(_0x30c55b[_0xf2ca('0xa6')]===0x0){return this[_0xf2ca('0xa5')](_0x30c55b);}_0x30c55b[_0xf2ca('0xa6')]-=0x1;if(!this[_0xf2ca('0x84')](_0x30c55b[_0xf2ca('0x10a')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x30c55b,_0xf2ca('0x10b'));}var _0x10da63=this[_0xf2ca('0x1b')][_0xf2ca('0x71')](this,_0x30c55b[_0xf2ca('0x10a')]);if(!_0x10da63){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x30c55b,_0xf2ca('0x10c'));}if(!this[_0xf2ca('0x84')](_0x30c55b['variable_id'])){return this['channel'][_0xf2ca('0x2b')](_0xf2ca('0xd2'));}var _0x1bdaae=this[_0xf2ca('0xb')][_0xf2ca('0x10d')](_0x10da63,_0x30c55b[_0xf2ca('0x10e')],_0x30c55b['maxdigit']);var _0x4547a6=_0x1bdaae[_0xf2ca('0xa4')]?_0x1bdaae['result']['toString']():'';logger[_0xf2ca('0x2d')](_0xf2ca('0x10f'),JSON[_0xf2ca('0x74')](_0x1bdaae));if(_0x1bdaae[_0xf2ca('0xa4')]===-0x1){this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x30c55b,_0x4547a6);return _0x1bdaae;}else if(_0x1bdaae[_0xf2ca('0xa2')]==='timeout'){_0x1bdaae[_0xf2ca('0xa4')]=_0x4547a6[_0xf2ca('0x9f')]>=parseInt(_0x30c55b[_0xf2ca('0x110')])?'x':'i';}else{_0x1bdaae[_0xf2ca('0xa4')]=_0x4547a6[_0xf2ca('0x9f')]>=parseInt(_0x30c55b[_0xf2ca('0x110')])&&_0x4547a6['length']<=parseInt(_0x30c55b[_0xf2ca('0x111')])?'x':'i';}var _0x2a21a2=this['getVariable'][_0xf2ca('0x71')](this,_0x30c55b[_0xf2ca('0xd3')]);if(!_0x2a21a2){return this['channel']['error'](_0x30c55b,_0xf2ca('0x112'));}this[_0xf2ca('0xb')][_0xf2ca('0xa0')](_0x2a21a2,_0x4547a6);if(this[_0xf2ca('0x84')](_0x30c55b[_0xf2ca('0x113')])){var _0x53e986=parseInt(_0x30c55b[_0xf2ca('0x113')],0xa);var _0xb9e338=rs[_0xf2ca('0x114')]({'charset':'*','length':_0x53e986});var _0x7bc1ee=_0x4547a6[_0xf2ca('0x9f')];if(_0x7bc1ee>0x0){if(_0x7bc1ee>_0x53e986){this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x30c55b,_0x30c55b['hiddendigitspos']===_0xf2ca('0x115')?_0xb9e338+_0x4547a6[_0xf2ca('0x116')](_0x53e986):_0x4547a6[_0xf2ca('0x116')](0x0,_0x7bc1ee-_0x53e986)+_0xb9e338);}else{this[_0xf2ca('0x34')]['sync'](this,_0x30c55b,rs[_0xf2ca('0x114')]({'charset':'*','length':_0x7bc1ee}));}}else{this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x30c55b,'');}}else{this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x30c55b,_0x4547a6);}return _0x1bdaae;};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x117')]=function(_0x166611){logger['info'](util[_0xf2ca('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x166611[_0xf2ca('0x36')]));return this['getdigits'](_0x166611);};AGIVertices[_0xf2ca('0xd')]['goal']=function(_0x455284){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x118'),_0x455284[_0xf2ca('0x36')]));this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x455284,_0x455284['goalname']);return this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x119'),_0x455284[_0xf2ca('0x11a')]));};AGIVertices['prototype'][_0xf2ca('0x11b')]=function(_0x2ab155){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2ab155[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x2ab155[_0xf2ca('0x87')])||!this['isConfigured'](_0x2ab155[_0xf2ca('0x11c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x11d'));}if(!this[_0xf2ca('0x84')](_0x2ab155[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')]['noop'](_0xf2ca('0xaa'));}this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x11e'),_0x2ab155['text']));var _0x4671ad=this[_0xf2ca('0x86')][_0xf2ca('0x71')](this,_0x2ab155);if(_0x4671ad){this['channel'][_0xf2ca('0xa9')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4671ad));var _0x341ad6=this[_0xf2ca('0xb')]['streamFile'](_0x4671ad);try{fs[_0xf2ca('0xfc')](_0x4671ad+_0xf2ca('0xfd'));}catch(_0x2a5441){logger[_0xf2ca('0x2b')](_0x2a5441);}return _0x341ad6;}return this['channel'][_0xf2ca('0x2b')](_0x2ab155,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xf2ca('0x11f')]=function(_0x9ff5){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x120'),_0x9ff5['label']));if(!this[_0xf2ca('0x84')](_0x9ff5[_0xf2ca('0x87')])||!this[_0xf2ca('0x84')](_0x9ff5['aws_secret_access_key'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x11d'));}if(!this['isConfigured'](_0x9ff5[_0xf2ca('0x121')])){return this['channel'][_0xf2ca('0xa9')](_0xf2ca('0x122'));}if(!this[_0xf2ca('0x84')](_0x9ff5['text'])){return this[_0xf2ca('0xb')]['noop']('no\x20text\x20configured');}this['channel'][_0xf2ca('0xe1')]=!![];this['createSquareDetailsReport'](_0x9ff5);this[_0xf2ca('0x41')](_0x9ff5[_0xf2ca('0x5c')],'in','','');this['channel']['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x123'),_0x9ff5[_0xf2ca('0x5c')]));var _0x26c760=this[_0xf2ca('0x8c')][_0xf2ca('0x71')](this,_0x9ff5);if(_0x26c760){for(var _0x2f20ce in _0x26c760){if(_0x26c760[_0xf2ca('0x96')](_0x2f20ce)&&_[_0xf2ca('0x9c')](_0x26c760[_0x2f20ce])){this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0x124'),_0x2f20ce[_0xf2ca('0x6a')]()),_0x26c760[_0x2f20ce]);}}if(_[_0xf2ca('0x44')](_0x26c760['message'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x125'));}else{this[_0xf2ca('0x41')](_0x26c760[_0xf2ca('0x76')],_0xf2ca('0xe5'),_0xf2ca('0x126'),'');return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x26c760[_0xf2ca('0x76')]));}}return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x9ff5,_0xf2ca('0x127'));};AGIVertices['prototype'][_0xf2ca('0x128')]=function(_0x253d4e){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x129'),_0x253d4e[_0xf2ca('0x36')],_0x253d4e[_0xf2ca('0x66')]));if(!this[_0xf2ca('0x84')](_0x253d4e['key'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xe0'));}var _0x2f6bb2=_0xf2ca('0x12a');var _0x43105f=util[_0xf2ca('0x27')](_0xf2ca('0x12b'),FILES_PATH,rs[_0xf2ca('0x114')](0x4));var _0x350538=util['format'](_0xf2ca('0x9e'),_0x43105f,_0x2f6bb2);var _0x29e6fa=!![];if(_0x253d4e[_0xf2ca('0x12c')]==='NOBEEP'){_0x29e6fa=![];}var _0x3e603e=this['channel'][_0xf2ca('0x12d')](_0x43105f,_0x2f6bb2,_0x253d4e[_0xf2ca('0x12e')],_0x253d4e[_0xf2ca('0x66')],undefined,_0x29e6fa);if(_0x3e603e[_0xf2ca('0xa4')]!==-0x1){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util['format'](_0xf2ca('0x12f'),_0x350538));var _0x4cabee=this['googleASR'][_0xf2ca('0x71')](this,_0x253d4e,_0x350538);if(_0x4cabee){for(var _0x3b3043 in _0x4cabee){if(_0x4cabee[_0xf2ca('0x96')](_0x3b3043)){this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util[_0xf2ca('0x27')]('GOOGLE_ASR_%s',_0x3b3043[_0xf2ca('0x6a')]()),_0x4cabee[_0x3b3043]);}}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util['format'](_0xf2ca('0x130'),JSON['stringify'](_0x4cabee)));}}return _0x3e603e;};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x131')]=function(_0x495011){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x132'),_0x495011['label']));if(!this[_0xf2ca('0x84')](_0x495011[_0xf2ca('0x91')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x133'));}if(!this[_0xf2ca('0x84')](_0x495011[_0xf2ca('0x92')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x134'));}var _0x73762d=_0xf2ca('0x12a');var _0x1056b7=util[_0xf2ca('0x27')](_0xf2ca('0x12b'),FILES_PATH,rs[_0xf2ca('0x114')](0x4));var _0x41541c=util[_0xf2ca('0x27')](_0xf2ca('0x9e'),_0x1056b7,_0x73762d);var _0x483a93=!![];if(_0x495011[_0xf2ca('0x12c')]==='NOBEEP'){_0x483a93=![];}var _0x21189b=this[_0xf2ca('0xb')][_0xf2ca('0x12d')](_0x1056b7,_0x73762d,_0x495011[_0xf2ca('0x12e')],_0x495011[_0xf2ca('0x66')],undefined,_0x483a93);if(_0x21189b[_0xf2ca('0xa4')]!==-0x1){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x135'),_0x41541c));var _0x18e6ce=this[_0xf2ca('0x90')][_0xf2ca('0x71')](this,_0x495011,_0x41541c);if(_0x18e6ce){for(var _0x431ccf in _0x18e6ce){if(_0x18e6ce[_0xf2ca('0x96')](_0x431ccf)){this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0x136'),_0x431ccf[_0xf2ca('0x6a')]()),_0x18e6ce[_0x431ccf]);}}return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x137'),JSON['stringify'](_0x18e6ce)));}}return _0x21189b;};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x138')]=function(_0x5db846){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x139'),_0x5db846[_0xf2ca('0x36')]));return this[_0xf2ca('0xb')]['continueAt'](_0x5db846[_0xf2ca('0x13a')],_0x5db846[_0xf2ca('0x3c')],_0x5db846[_0xf2ca('0x3d')]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x13b')]=function(_0x36b064){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x13c'),_0x36b064['label']));if(!this[_0xf2ca('0x84')](_0x36b064[_0xf2ca('0x13d')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x36b064,_0xf2ca('0x13e'));}try{var _0xe95da7=eval(_0x36b064[_0xf2ca('0x13d')])?'true':_0xf2ca('0x13f');this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x140'),_0x36b064[_0xf2ca('0x13d')],_0xe95da7));return{'code':0xc8,'result':_0xe95da7};}catch(_0x16e41e){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xf2ca('0x141')]=function(_0x4879c3){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x142'),_0x4879c3[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x4879c3[_0xf2ca('0x143')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x4879c3,_0xf2ca('0x144'));}var _0x95d020=this[_0xf2ca('0x23')][_0xf2ca('0x71')](this,_0x4879c3[_0xf2ca('0x143')]);if(!_0x95d020){return this['channel'][_0xf2ca('0x2b')](_0x4879c3,_0xf2ca('0x145'));}for(var _0x4a0550=0x0;_0x4a0550<_0x95d020[_0xf2ca('0x9f')];_0x4a0550+=0x1){var _0x5370a9=this['channel'][_0xf2ca('0xe')](util[_0xf2ca('0x27')](_0xf2ca('0x146'),_0x95d020[_0x4a0550]));if(_0x5370a9['result']===-0x1){return _0x5370a9;}logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x147'),_0x95d020[_0x4a0550],_0x5370a9[_0xf2ca('0xa2')]));if(_0x5370a9[_0xf2ca('0xa2')]===_0xf2ca('0x148')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x95d020[_0x4a0550],'true'));this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('IFTIME\x20%s\x20%s',_0x95d020[_0x4a0550],'true'));return{'code':0xc8,'result':_0xf2ca('0x148')};}else{logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x147'),_0x95d020[_0x4a0550],_0xf2ca('0x13f')));this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util['format'](_0xf2ca('0x147'),_0x95d020[_0x4a0550],_0xf2ca('0x13f')));}}return{'code':0xc8,'result':_0xf2ca('0x13f')};};AGIVertices['prototype'][_0xf2ca('0x149')]=function(_0x3fcf1d){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3fcf1d['label']));return this[_0xf2ca('0xb')][_0xf2ca('0x149')]();};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x14a')]=function(_0x4d15c0){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x14b'),_0x4d15c0[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x4d15c0[_0xf2ca('0x79')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xe0'));}var _0x1e29b0='wav';var _0x342924=util['format'](_0xf2ca('0x12b'),FILES_PATH,rs[_0xf2ca('0x114')](0x4));var _0x241b52=util[_0xf2ca('0x27')]('%s.%s',_0x342924,_0x1e29b0);var _0x37764c=!![];if(_0x4d15c0['beep']===_0xf2ca('0x14c')){_0x37764c=![];}var _0x127cee=this[_0xf2ca('0xb')][_0xf2ca('0x12d')](_0x342924,_0x1e29b0,_0x4d15c0[_0xf2ca('0x12e')],_0x4d15c0[_0xf2ca('0x66')],undefined,_0x37764c);if(_0x127cee[_0xf2ca('0xa4')]!==-0x1){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('ispeech\x20%s\x20file\x20created',_0x241b52));var _0x546345=this[_0xf2ca('0x82')][_0xf2ca('0x71')](this,_0x4d15c0,_0x241b52);if(_0x546345){for(var _0x19defa in _0x546345){if(_0x546345[_0xf2ca('0x96')](_0x19defa)){this['channel'][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0x14d'),_0x19defa[_0xf2ca('0x6a')]()),_0x546345[_0x19defa]);}}return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x14e'),JSON['stringify'](_0x546345)));}}return _0x127cee;};AGIVertices['prototype'][_0xf2ca('0x14f')]=function(_0x36dd50){logger['info'](util[_0xf2ca('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x36dd50[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x36dd50[_0xf2ca('0x79')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xe0'));}if(!this['isConfigured'](_0x36dd50[_0xf2ca('0x5c')])){return this['channel'][_0xf2ca('0xa9')]('no\x20text\x20configured');}this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x150'),_0x36dd50[_0xf2ca('0x5c')]));var _0x3d2eee=this[_0xf2ca('0x7e')][_0xf2ca('0x71')](this,_0x36dd50);if(_0x3d2eee){this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x151'),_0x3d2eee));var _0x3ba357=this[_0xf2ca('0xb')][_0xf2ca('0x152')](_0x3d2eee,_0x36dd50[_0xf2ca('0x12e')]);try{fs[_0xf2ca('0xfc')](_0x3d2eee+_0xf2ca('0xfd'));}catch(_0x9d80e9){logger[_0xf2ca('0x2b')](_0x9d80e9);}return _0x3ba357;}return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x36dd50,_0xf2ca('0x153'));};AGIVertices[_0xf2ca('0xd')]['login']=function(_0x30a328){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x154'),_0x30a328['label']));if(!this['isConfigured'](_0x30a328['findBy'])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x30a328,_0xf2ca('0x155'));}logger[_0xf2ca('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x30a328[_0xf2ca('0x156')]));var _0x334906=this[_0xf2ca('0x52')]['sync'](this,_0x30a328['findBy']);if(_0x334906){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x30a328[_0xf2ca('0x156')]));this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x157'),this[_0xf2ca('0xb')]['callerid'],_0x30a328[_0xf2ca('0x156')]));return{'code':0xc8,'result':_0xf2ca('0x158')};}else{logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x159'),this['channel']['callerid'],_0x30a328['findBy']));this['channel'][_0xf2ca('0xa9')](util['format'](_0xf2ca('0x159'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x30a328['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf2ca('0xd')]['logout']=function(_0x5a3341){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5a3341[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x5a3341[_0xf2ca('0x156')])){return this['channel']['error'](_0x5a3341,_0xf2ca('0x155'));}logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x15a'),this[_0xf2ca('0xb')]['callerid'],_0x5a3341[_0xf2ca('0x156')]));var _0x56c22a=this[_0xf2ca('0x51')]['sync'](this,_0x5a3341[_0xf2ca('0x156')]);if(_0x56c22a){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x157'),this[_0xf2ca('0xb')]['callerid'],_0x5a3341[_0xf2ca('0x156')]));this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x157'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x5a3341[_0xf2ca('0x156')]));return{'code':0xc8,'result':_0xf2ca('0x158')};}else{logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x159'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x5a3341['findBy']));this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x159'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x5a3341['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xf2ca('0x15b')]=function(_0x1d4634){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x15c'),_0x1d4634[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x1d4634[_0xf2ca('0x15d')])){return this[_0xf2ca('0xb')]['error'](_0x1d4634,'no\x20operation\x20configured');}this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')]('math\x20%s',_0x1d4634[_0xf2ca('0x15d')]));var _0x5ec6b8=eval(_0x1d4634[_0xf2ca('0x15d')]);if(!this[_0xf2ca('0x84')](_0x1d4634[_0xf2ca('0xd3')])){return this[_0xf2ca('0xb')]['noop'](_0xf2ca('0xd2'));}var _0x38df76=this[_0xf2ca('0xe')]['sync'](this,_0x1d4634[_0xf2ca('0xd3')]);if(!_0x38df76){return this[_0xf2ca('0xb')]['error'](_0x1d4634,_0xf2ca('0x112'));}if(_[_0xf2ca('0x9b')](_0x5ec6b8)){var _0x4c746a=this;_0x5ec6b8['forEach'](function(_0x512f48,_0xe428b){_0x4c746a['channel']['setVariable'](util[_0xf2ca('0x27')](_0xf2ca('0x15e'),_0x38df76,_0xe428b),_0x512f48);});return this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x15f'),_0x38df76));}else{return this[_0xf2ca('0xb')][_0xf2ca('0xa0')](_0x38df76,_0x5ec6b8);}};AGIVertices['prototype']['menu']=function(_0x59ce0a){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x160'),_0x59ce0a['label']));if(_0x59ce0a[_0xf2ca('0xa6')]===0x0){return this[_0xf2ca('0xa5')](_0x59ce0a);}_0x59ce0a[_0xf2ca('0xa6')]-=0x1;if(!this['isConfigured'](_0x59ce0a['file_id'])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x59ce0a,'no\x20file\x20audio\x20selected');}var _0x5c8400=this[_0xf2ca('0x1b')]['sync'](this,_0x59ce0a[_0xf2ca('0x10a')]);if(!_0x5c8400){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x59ce0a,_0xf2ca('0x10c'));}var _0x2759f1=this[_0xf2ca('0xb')][_0xf2ca('0x10d')](_0x5c8400,_0x59ce0a[_0xf2ca('0x10e')],_0x59ce0a['digit']);var _0x2313bf=_0x2759f1['result'];if(_0x2759f1[_0xf2ca('0xa4')]===-0x1){this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x59ce0a,'-1');return _0x2759f1;}else if(_0x2759f1['extra']===_0xf2ca('0x66')){_0x2759f1[_0xf2ca('0xa4')]=_0x2759f1[_0xf2ca('0xa4')][_0xf2ca('0x9f')]>0x0?_0x2759f1[_0xf2ca('0xa4')]:'t';}else if(_[_0xf2ca('0x43')](_0x2759f1['result'])){_0x2759f1[_0xf2ca('0xa4')]='#';_0x2313bf='#';}if(!this[_0xf2ca('0x84')](_0x59ce0a[_0xf2ca('0xd3')])){this['channel']['noop'](_0xf2ca('0xd2'));}else{var _0x12f9fd=this[_0xf2ca('0xe')]['sync'](this,_0x59ce0a['variable_id']);if(!_0x12f9fd){return this['channel']['error'](_0x59ce0a,'no\x20variable\x20found');}this[_0xf2ca('0xb')]['setVariable'](_0x12f9fd,_0x2313bf);}this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x59ce0a,_0x2313bf);return _0x2759f1;};AGIVertices[_0xf2ca('0xd')]['noop']=function(_0x207fe2){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x207fe2[_0xf2ca('0x36')]));return this[_0xf2ca('0xb')]['noop'](_0x207fe2[_0xf2ca('0x161')]||_0x207fe2[_0xf2ca('0x36')]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x162')]=function(_0x23f284){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x163'),_0x23f284[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x23f284[_0xf2ca('0x156')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x23f284,_0xf2ca('0x155'));}logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x15a'),this['channel'][_0xf2ca('0x39')],_0x23f284[_0xf2ca('0x156')]));var _0x4751a3=this[_0xf2ca('0x4c')]['sync'](this,_0x23f284[_0xf2ca('0x164')]);var _0x3e5154=this['agentPause'][_0xf2ca('0x71')](this,_0x23f284[_0xf2ca('0x156')],_0x4751a3);if(_0x3e5154){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x157'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x23f284[_0xf2ca('0x156')]));this['channel'][_0xf2ca('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xf2ca('0x39')],_0x23f284['findBy']));return{'code':0xc8,'result':_0xf2ca('0x158')};}else{logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x23f284[_0xf2ca('0x156')]));this['channel']['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x157'),this['channel']['callerid'],_0x23f284[_0xf2ca('0x156')]));return{'code':0xc8,'result':_0xf2ca('0x165')};}};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x166')]=function(_0x46ff6b){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x167'),_0x46ff6b[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x46ff6b['file_id'])){return this['channel'][_0xf2ca('0x2b')](_0x46ff6b,_0xf2ca('0x10b'));}var _0x56a839=this['getSound'][_0xf2ca('0x71')](this,_0x46ff6b[_0xf2ca('0x10a')]);if(!_0x56a839){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x46ff6b,_0xf2ca('0x10c'));}var _0x13ccb2=this['channel']['exec'](_0xf2ca('0x168'),[_0x56a839,_0x46ff6b[_0xf2ca('0x105')]]);if(_0x13ccb2['result']===-0x1){return _0x13ccb2;}return this[_0xf2ca('0xb')]['noop'](util['format'](_0xf2ca('0x169'),_0xf2ca('0x168'),_0x56a839));};AGIVertices['prototype'][_0xf2ca('0x16a')]=function(_0x26bd7f){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x26bd7f[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x26bd7f[_0xf2ca('0x16b')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x26bd7f,'no\x20queue\x20selected');}var _0x5201fd='';var _0xb56af6=parseInt(_0x26bd7f[_0xf2ca('0x16b')],0xa);if(isNaN(_0xb56af6)){_0x5201fd=_0x26bd7f[_0xf2ca('0x16b')];}else{_0x5201fd=this['getVoiceQueue'][_0xf2ca('0x71')](this,_0x26bd7f['queue_id']);if(!_0x5201fd){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x26bd7f,'no\x20queue\x20found');}}var _0x4b5706='';if(this['isConfigured'](_0x26bd7f['file_id'])){var _0xc5c378=this['getSound'][_0xf2ca('0x71')](this,_0x26bd7f[_0xf2ca('0x10a')]);if(_0xc5c378){_0x4b5706=_0xc5c378;}}this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x26bd7f,_0x5201fd);if(_0x26bd7f[_0xf2ca('0x105')][_0xf2ca('0x16c')]('x')<0x0){_0x26bd7f[_0xf2ca('0x105')]+='x';}if(_0x26bd7f[_0xf2ca('0x105')][_0xf2ca('0x16c')]('X')<0x0){_0x26bd7f[_0xf2ca('0x105')]+='X';}this[_0xf2ca('0xb')]['setVariable'](_0xf2ca('0x16d'),_0x5201fd?_0x5201fd['toLowerCase']():'');var _0x44010b=this['channel']['exec'](_0xf2ca('0x16e'),[_0x5201fd,_0x26bd7f[_0xf2ca('0x105')],_0x26bd7f['url'],_0x4b5706,_0x26bd7f['timeout'],_0x26bd7f['agi'],_0x26bd7f['macro'],_0x26bd7f[_0xf2ca('0x16f')],'',_0x26bd7f[_0xf2ca('0x170')]]);if(_0x44010b[_0xf2ca('0xa4')]===-0x1){return _0x44010b;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x5201fd));};AGIVertices['prototype'][_0xf2ca('0x171')]=function(_0x198c1b){logger['info'](util['format'](_0xf2ca('0x172'),_0x198c1b[_0xf2ca('0x36')]));var _0x2c25be=_0x198c1b[_0xf2ca('0x173')]||_0xf2ca('0x12a');var _0xe7f0ef=util[_0xf2ca('0x27')](_0xf2ca('0x174'),this['channel'][_0xf2ca('0x35')],rs[_0xf2ca('0x114')](0x5));var _0x594114=util[_0xf2ca('0x27')](_0xf2ca('0x175'),FILES_PATH,_0xe7f0ef,_0x2c25be);var _0x569225=util[_0xf2ca('0x27')](_0xf2ca('0x12b'),FILES_PATH,_0xe7f0ef);this[_0xf2ca('0x3a')][_0xf2ca('0x71')](this,_0x198c1b,_0xe7f0ef,_0x594114);this[_0xf2ca('0xb')][_0xf2ca('0xa0')]('RECORDING_SAVENAME',_0xe7f0ef);logger['info'](_0xf2ca('0x176'),_0x569225,_0x2c25be,_0x198c1b[_0xf2ca('0x177')],_0x198c1b[_0xf2ca('0x66')]);return this[_0xf2ca('0xb')][_0xf2ca('0x12d')](_0x569225,_0x2c25be,_0x198c1b[_0xf2ca('0x177')],_0x198c1b[_0xf2ca('0x66')],undefined,!![]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x178')]=function(_0x361cf8){logger['info'](util[_0xf2ca('0x27')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x361cf8[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x361cf8['url'])){return this['channel']['noop'](_0xf2ca('0x179'));}var _0x3dea57=this[_0xf2ca('0x63')]['sync'](this,_0x361cf8);logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x17a'),util[_0xf2ca('0x17b')](_0x3dea57,{'showHidden':![],'depth':null})));if(!this[_0xf2ca('0x84')](_0x361cf8[_0xf2ca('0xd3')])){return this['channel'][_0xf2ca('0xa9')](_0xf2ca('0x17c'));}var _0x36d611=this[_0xf2ca('0xe')][_0xf2ca('0x71')](this,_0x361cf8['variable_id']);if(!_0x36d611){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x361cf8,_0xf2ca('0x112'));}this[_0xf2ca('0xb')]['setVariable'](util[_0xf2ca('0x27')](_0xf2ca('0x17d'),_0x36d611),_0x3dea57['statusCode']?_0x3dea57['statusCode']:_0xf2ca('0x17e'));this[_0xf2ca('0xb')][_0xf2ca('0xa0')](util[_0xf2ca('0x27')](_0xf2ca('0x17f'),_0x36d611),_0x3dea57[_0xf2ca('0x180')]?_0x3dea57[_0xf2ca('0x180')]:'OK');if(_0x3dea57[_0xf2ca('0x6b')]){try{this[_0xf2ca('0x9d')](_0x3dea57[_0xf2ca('0x6b')],_0x36d611);}catch(_0x133075){logger[_0xf2ca('0x2b')](util[_0xf2ca('0x27')](_0xf2ca('0x181'),_0x36d611));}}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0xd7'),_0x36d611));};AGIVertices[_0xf2ca('0xd')]['saydigits']=function(_0x233fa4){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x182'),_0x233fa4[_0xf2ca('0x36')]));return this[_0xf2ca('0xb')][_0xf2ca('0x183')](_0x233fa4[_0xf2ca('0x184')][_0xf2ca('0x58')](/\s+/g,''),_0x233fa4['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x473061){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x185'),_0x473061[_0xf2ca('0x36')]));return this['channel'][_0xf2ca('0x186')](_0x473061['number'][_0xf2ca('0x58')](/\s+/g,''),_0x473061[_0xf2ca('0x177')]);};AGIVertices['prototype']['sayphonetic']=function(_0x19e106){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x187'),_0x19e106['label']));return this[_0xf2ca('0xb')][_0xf2ca('0x188')](_0x19e106[_0xf2ca('0x5c')],_0x19e106[_0xf2ca('0x177')]);};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x189')]=function(_0x5d7677){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x18a'),_0x5d7677[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x5d7677[_0xf2ca('0x18b')])){return this['channel']['noop'](_0xf2ca('0x18c'));}var _0x332072=this[_0xf2ca('0x1f')][_0xf2ca('0x71')](this,_0x5d7677[_0xf2ca('0x18b')]);if(!_0x332072||!_0x332072[_0xf2ca('0x18d')]){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x5d7677,_0xf2ca('0x18e'));}var _0x1a3328={'from':util[_0xf2ca('0x27')](_0xf2ca('0x18f'),_0x332072[_0xf2ca('0x10')],_0x332072[_0xf2ca('0x190')]||_0x332072['Smtp']['user']),'to':_0x5d7677['to']||'','cc':_0x5d7677['cc']||'','bcc':_0x5d7677[_0xf2ca('0x191')]||'','subject':_0x5d7677[_0xf2ca('0x192')],'html':_0x5d7677['text'],'text':_0x5d7677[_0xf2ca('0x5c')]};if(this[_0xf2ca('0x84')](_0x5d7677[_0xf2ca('0x193')])){}logger[_0xf2ca('0xd9')](_0xf2ca('0x194'),JSON[_0xf2ca('0x74')](_0x1a3328));this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x5d7677,_0x5d7677[_0xf2ca('0x18b')]);this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x195'),_0x332072['name']));this['sendMailMessage'][_0xf2ca('0x71')](this,_0x332072[_0xf2ca('0x196')],_0x1a3328);return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x197'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x198')]=function(_0x3af482){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x199'),_0x3af482[_0xf2ca('0x36')]));return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x19a'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x19b')]=function(_0x121971){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x19c'),_0x121971['label']));if(!this[_0xf2ca('0x84')](_0x121971[_0xf2ca('0x19d')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x19e'));}var _0x38e346=this['getSmsAccount']['sync'](this,_0x121971[_0xf2ca('0x19d')]);if(!_0x38e346){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x121971,_0xf2ca('0x19f'));}var _0x581ea0={'body':_0x121971[_0xf2ca('0x1a0')],'phone':_0x121971['to']||'','SmsAccountId':_0x38e346['id']};logger[_0xf2ca('0xd9')](_0xf2ca('0x1a1'),JSON[_0xf2ca('0x74')](_0x581ea0));this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x121971,_0x121971[_0xf2ca('0x19d')]);this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x1a2'),_0x38e346[_0xf2ca('0x10')]));this[_0xf2ca('0x33')][_0xf2ca('0x71')](this,_0x581ea0);return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x1a3'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1a4')]=function(_0x50afeb){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x50afeb[_0xf2ca('0x36')]));if(!this['isConfigured'](_0x50afeb[_0xf2ca('0xd3')])){return this['channel'][_0xf2ca('0x2b')](_0x50afeb,_0xf2ca('0x1a5'));}var _0xef59c6=this['getVariable'][_0xf2ca('0x71')](this,_0x50afeb[_0xf2ca('0xd3')]);if(!_0xef59c6){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x50afeb,_0xf2ca('0x112'));}return this[_0xf2ca('0xb')][_0xf2ca('0xa0')](_0xef59c6,_0x50afeb[_0xf2ca('0x1a6')]);};AGIVertices['prototype'][_0xf2ca('0x1a7')]=function(_0x123588){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x1a8'),_0x123588[_0xf2ca('0x36')]));this['channel'][_0xf2ca('0xa9')](_0xf2ca('0x1a9'));var _0x36a685=this[_0xf2ca('0xb')]['getVariable'](_0xf2ca('0x1aa'));if(!_[_0xf2ca('0x43')](_0x36a685[_0xf2ca('0xa2')])){this[_0xf2ca('0xb')][_0xf2ca('0x35')]=_0x36a685['extra'];}if(_0x123588[_0xf2ca('0xb9')]===_0xf2ca('0x1ab')){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x1ac'));return this[_0xf2ca('0xb')]['answer']();}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x1ad'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1ae')]=function(_0x389300){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x1af'),_0x389300[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x389300[_0xf2ca('0x1b0')])){return this['channel'][_0xf2ca('0x2b')](_0x389300,_0xf2ca('0x1b1'));}var _0x40f8e9=this['getSquareProject'][_0xf2ca('0x71')](this,_0x389300[_0xf2ca('0x1b0')]);if(!this[_0xf2ca('0x84')](_0x40f8e9)){return this[_0xf2ca('0xb')]['error'](_0x389300,util[_0xf2ca('0x27')](_0xf2ca('0x1b2'),_0x389300[_0xf2ca('0x1b0')]));}if(_0x40f8e9===this[_0xf2ca('0xb')][_0xf2ca('0x38')]){return this[_0xf2ca('0xb')]['error'](_0x389300,_0xf2ca('0x1b3'));}this[_0xf2ca('0x34')][_0xf2ca('0x71')](this,_0x389300,_0x40f8e9);var _0x4eb37a=this['channel'][_0xf2ca('0xab')](_0xf2ca('0x1b4'),util[_0xf2ca('0x27')](_0xf2ca('0x1b5'),config[_0xf2ca('0x5')][_0xf2ca('0x1b6')]||_0xf2ca('0x1b7'),_0x40f8e9,this[_0xf2ca('0xb')][_0xf2ca('0x38')]));if(_0x4eb37a[_0xf2ca('0xa4')]===-0x1){return _0x4eb37a;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x169'),_0xf2ca('0x1b4'),_0x40f8e9));};AGIVertices[_0xf2ca('0xd')]['system']=function(_0x1199b5){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1199b5['label']));var _0x2a9174=this['shellCommand']['sync'](this,_0x1199b5['command']);this['createSquareDetailsReport'][_0xf2ca('0x71')](this,_0x1199b5,_0x1199b5[_0xf2ca('0xb7')]);if(this[_0xf2ca('0x84')](_0x1199b5[_0xf2ca('0xd3')])){var _0xbddb86=this[_0xf2ca('0xe')][_0xf2ca('0x71')](this,_0x1199b5[_0xf2ca('0xd3')]);if(_0xbddb86){this['channel'][_0xf2ca('0xa0')](_0xbddb86,_0x2a9174);return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x1b8'),_0x1199b5[_0xf2ca('0xb7')],_0xbddb86));}}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x1199b5[_0xf2ca('0xb7')]));};AGIVertices[_0xf2ca('0xd')]['google_cloud_tts']=function(_0x1059a1){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1059a1['label']));_0x1059a1[_0xf2ca('0x5c')]=_0x1059a1[_0xf2ca('0x5c')][_0xf2ca('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1059a1['apiKey'])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0x1b9'));}if(!this[_0xf2ca('0x84')](_0x1059a1[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')]('no\x20text\x20configured');}this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x1ba'),_0x1059a1[_0xf2ca('0x5c')]));var _0x13c8d5=this['googleCloudTTS'][_0xf2ca('0x71')](this,_0x1059a1);if(_0x13c8d5){this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')](_0xf2ca('0x1bb'),_0x13c8d5));var _0x48c8c7=this[_0xf2ca('0xb')]['streamFile'](_0x13c8d5);try{fs[_0xf2ca('0xfc')](_0x13c8d5+_0xf2ca('0xfd'));}catch(_0x3bac5e){logger[_0xf2ca('0x2b')](_0x3bac5e);}return _0x48c8c7;}return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x1059a1,_0xf2ca('0x1bc'));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1bd')]=function(_0x4f7724){logger['info'](util[_0xf2ca('0x27')](_0xf2ca('0x1be'),_0x4f7724['label']));_0x4f7724[_0xf2ca('0x5c')]=_0x4f7724[_0xf2ca('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf2ca('0x84')](_0x4f7724[_0xf2ca('0x5c')])){return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](_0xf2ca('0xaa'));}this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x1bf'),_0x4f7724[_0xf2ca('0x5c')]));var _0x582089=this[_0xf2ca('0x61')]['sync'](this,_0x4f7724);if(_0x582089){this['channel'][_0xf2ca('0xa9')](util['format'](_0xf2ca('0x1c0'),_0x582089));var _0xb1263=this[_0xf2ca('0xb')][_0xf2ca('0x152')](_0x582089);try{fs[_0xf2ca('0xfc')](_0x582089+_0xf2ca('0xfd'));}catch(_0x568510){logger[_0xf2ca('0x2b')](_0x568510);}return _0xb1263;}return this['channel']['error'](_0x4f7724,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xf2ca('0x1c1')]=function(_0x2aa1a9){logger['info'](util[_0xf2ca('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2aa1a9[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x2aa1a9[_0xf2ca('0x156')])){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x2aa1a9,_0xf2ca('0x155'));}logger['info'](util[_0xf2ca('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf2ca('0xb')]['callerid'],_0x2aa1a9['findBy']));var _0x92d9c1=this[_0xf2ca('0x50')][_0xf2ca('0x71')](this,_0x2aa1a9[_0xf2ca('0x156')]);if(_0x92d9c1){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x157'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x2aa1a9[_0xf2ca('0x156')]));this['channel'][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x2aa1a9[_0xf2ca('0x156')]));return{'code':0xc8,'result':_0xf2ca('0x158')};}else{logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xf2ca('0x39')],_0x2aa1a9[_0xf2ca('0x156')]));this[_0xf2ca('0xb')]['noop'](util[_0xf2ca('0x27')](_0xf2ca('0x159'),this[_0xf2ca('0xb')][_0xf2ca('0x39')],_0x2aa1a9[_0xf2ca('0x156')]));return{'code':0xc8,'result':_0xf2ca('0x165')};}};AGIVertices[_0xf2ca('0xd')]['voicemail']=function(_0x8b5097){logger[_0xf2ca('0x2d')](util[_0xf2ca('0x27')](_0xf2ca('0x1c2'),_0x8b5097[_0xf2ca('0x36')]));var _0x202065=this[_0xf2ca('0xb')][_0xf2ca('0xab')](_0xf2ca('0x1c3'),[_0x8b5097['mailbox'],_0x8b5097[_0xf2ca('0x77')]]);if(_0x202065[_0xf2ca('0xa4')]===-0x1){return _0x202065;}return this[_0xf2ca('0xb')][_0xf2ca('0xa9')](util[_0xf2ca('0x27')]('Executed\x20command\x20%s\x20%s',_0xf2ca('0x1c3'),_0x8b5097[_0xf2ca('0x1c4')]));};AGIVertices[_0xf2ca('0xd')][_0xf2ca('0x1c5')]=function(_0x299a3f){logger[_0xf2ca('0x2d')](util['format'](_0xf2ca('0x1c6'),_0x299a3f[_0xf2ca('0x36')]));if(!this[_0xf2ca('0x84')](_0x299a3f[_0xf2ca('0xd3')])){return this[_0xf2ca('0xb')]['error'](_0x299a3f,_0xf2ca('0x1a5'));}var _0x38b628=this[_0xf2ca('0xe')][_0xf2ca('0x71')](this,_0x299a3f['variable_id']);if(!_0x38b628){return this[_0xf2ca('0xb')][_0xf2ca('0x2b')](_0x299a3f,_0xf2ca('0x112'));}var _0x210313=this['channel']['getVariable'](_0x38b628);return{'code':0xc8,'result':_0x210313['extra']?_0x210313[_0xf2ca('0xa2')]:'-'};};String[_0xf2ca('0xd')][_0xf2ca('0x1c7')]=function(_0x5be5f5,_0x2c21a0){return this[_0xf2ca('0xa1')](_0x5be5f5)[_0xf2ca('0x1c8')](_0x2c21a0);};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 4801b30..28d34b9 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 _0xba18=['mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','updateAcw','lastPauseAt','timer','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','prototype','startAcw','interface','queue','ACW'];(function(_0x4e2db4,_0xf2e31c){var _0x22f468=function(_0x5dddd5){while(--_0x5dddd5){_0x4e2db4['push'](_0x4e2db4['shift']());}};_0x22f468(++_0xf2e31c);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var moment=require(_0x8ba1('0x1'));var ami=require(_0x8ba1('0x2'));var logger=require(_0x8ba1('0x3'))(_0x8ba1('0x4'));var RpcUser=require(_0x8ba1('0x5'));var RpcVoiceAgentReport=require(_0x8ba1('0x6'));function Acw(_0x3b5254){this['voiceQueues']=_0x3b5254[_0x8ba1('0x7')];this[_0x8ba1('0x8')]=_0x3b5254[_0x8ba1('0x8')];this[_0x8ba1('0x9')]=_0x3b5254[_0x8ba1('0x9')];this[_0x8ba1('0xa')]={};ami['on']('agentconnect',this[_0x8ba1('0xb')][_0x8ba1('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x8ba1('0xd'),this[_0x8ba1('0xe')]['bind'](this));ami['on'](_0x8ba1('0xf'),this[_0x8ba1('0x10')][_0x8ba1('0xc')](this));ami['on'](_0x8ba1('0x11'),this[_0x8ba1('0x12')]['bind'](this));ami['on'](_0x8ba1('0x13'),this[_0x8ba1('0x14')][_0x8ba1('0xc')](this));ami['on'](_0x8ba1('0x15'),this[_0x8ba1('0x16')][_0x8ba1('0xc')](this));}function getDiff(_0x58e32b){var _0x108541=moment()[_0x8ba1('0x17')](0x0);var _0x2e81d1=moment(_0x58e32b)[_0x8ba1('0x17')](0x0);return _0x108541['diff'](_0x2e81d1,'seconds');}Acw['prototype'][_0x8ba1('0x18')]=function(_0x398f40,_0x5a3a8a){var _0x1b885b=this;var _0xc72b8d=getDiff(_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x19')]);clearTimeout(_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x1a')]);_0x1b885b[_0x8ba1('0x9')][_0x398f40]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0xc72b8d},_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x1b')],_0x398f40)['then'](function(_0xd8bda0){logger[_0x8ba1('0x1c')](_0x8ba1('0x1d'),_0x5a3a8a,_0xc72b8d,_0xd8bda0);})[_0x8ba1('0x1e')](function(_0x1dc1b4){logger[_0x8ba1('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x5a3a8a,_0x1dc1b4);})[_0x8ba1('0x20')](function(){delete _0x1b885b['timers'][_0x398f40];});};Acw[_0x8ba1('0x21')][_0x8ba1('0x22')]=function(_0x121cc4){try{var _0x3dd1d8=this;var _0x4e66e1=this[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x23')];var _0x3e1e64=this[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x24')];var _0x3b70ea=this[_0x8ba1('0x7')][_0x3e1e64];var _0x1c51ef=![];var _0x273e67=_0x8ba1('0x25');if(_0x3b70ea[_0x8ba1('0x26')]&&_0x3b70ea['mandatoryDispositionPause']['name']){_0x1c51ef=!![];_0x273e67=_0x3b70ea[_0x8ba1('0x27')][_0x8ba1('0x28')];}if(!_0x3dd1d8['agents'][_0x4e66e1]){return Promise[_0x8ba1('0x29')]();}return RpcUser[_0x8ba1('0x2a')](_0x3dd1d8[_0x8ba1('0x8')][_0x4e66e1]['id'])[_0x8ba1('0x2b')](function(_0x15e419){if(!_0x15e419||_0x15e419[_0x8ba1('0x2c')]){logger[_0x8ba1('0x1c')](_0x8ba1('0x2d'),_0x121cc4,_0x4e66e1,_0x3e1e64);return;}logger[_0x8ba1('0x1c')](_0x8ba1('0x2e'),_0x121cc4,_0x4e66e1,_0x3e1e64);var _0x3e8e6d=_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x2f')]&&_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4]['destlinkedid']?_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x30')]:_0x121cc4;return RpcUser[_0x8ba1('0x31')](_0x3dd1d8[_0x8ba1('0x8')][_0x4e66e1],_0x273e67,_0x3e8e6d);})[_0x8ba1('0x2b')](function(_0x24bf95){if(_0x1c51ef||!_0x24bf95){return;}_0x3dd1d8['timers'][_0x4e66e1]={};logger[_0x8ba1('0x1c')](_0x8ba1('0x32'),_0x121cc4,_0x3dd1d8['voiceQueues'][_0x3e1e64][_0x8ba1('0x33')],_0x4e66e1,_0x3e1e64);_0x3dd1d8['timers'][_0x4e66e1][_0x8ba1('0x1a')]=setTimeout(_0x3dd1d8[_0x8ba1('0x34')]['bind'](_0x3dd1d8,_0x4e66e1),_0x3dd1d8[_0x8ba1('0x7')][_0x3e1e64][_0x8ba1('0x33')]*0x3e8);_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x19')]=moment()[_0x8ba1('0x35')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x1b')]=_0x121cc4;_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x24')]=_0x3e1e64;_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x18')]=_0x3dd1d8[_0x8ba1('0x18')][_0x8ba1('0xc')](_0x3dd1d8,_0x4e66e1,_0x121cc4);})['catch'](function(){logger[_0x8ba1('0x1f')](_0x8ba1('0x32'),_0x121cc4,_0x3dd1d8[_0x8ba1('0x7')][_0x3e1e64][_0x8ba1('0x33')],_0x4e66e1,_0x3e1e64);})[_0x8ba1('0x20')](function(){delete _0x3dd1d8[_0x8ba1('0xa')][_0x121cc4];});}catch(_0x215656){logger[_0x8ba1('0x1f')](_0x8ba1('0x36'),_0x215656[_0x8ba1('0x37')]);}};Acw['prototype'][_0x8ba1('0x34')]=function(_0x22cbd1){try{var _0x146104=this;if(_0x146104[_0x8ba1('0x9')][_0x22cbd1]){_0x146104[_0x8ba1('0x9')][_0x22cbd1][_0x8ba1('0x1a')]=![];var _0x3034aa=_0x146104[_0x8ba1('0x9')][_0x22cbd1][_0x8ba1('0x1b')];var _0x3db733=_0x146104['timers'][_0x22cbd1]['queue'];var _0x11ce52=_0x146104[_0x8ba1('0x7')][_0x3db733][_0x8ba1('0x33')];logger[_0x8ba1('0x1c')](_0x8ba1('0x38'),_0x3034aa,_0x22cbd1);RpcUser[_0x8ba1('0x39')](this[_0x8ba1('0x8')][_0x22cbd1]);RpcVoiceAgentReport[_0x8ba1('0x3a')]({'acwtime':_0x11ce52,'agentacw':!![]},_0x3034aa,_0x22cbd1)[_0x8ba1('0x2b')](function(_0x2305ff){logger[_0x8ba1('0x1c')](_0x8ba1('0x1d'),_0x3034aa,_0x11ce52,_0x2305ff);})[_0x8ba1('0x1e')](function(_0x2a4cd8){logger['error'](_0x8ba1('0x3b'),_0x3034aa,_0x2a4cd8);});}else{logger[_0x8ba1('0x1f')](_0x8ba1('0x3c'),_0x22cbd1);if(_0x146104[_0x8ba1('0x9')]){logger['info']('[ACW][TIMERS]',JSON[_0x8ba1('0x3d')](_0x146104[_0x8ba1('0x9')]));}}}catch(_0x1d1ffd){logger[_0x8ba1('0x1f')](_0x8ba1('0x3e'),_0x1d1ffd['message']);}};Acw[_0x8ba1('0x21')][_0x8ba1('0xb')]=function(_0x16bdb1){try{if(this['voiceQueues'][_0x16bdb1[_0x8ba1('0x24')]]&&(this[_0x8ba1('0x7')][_0x16bdb1[_0x8ba1('0x24')]][_0x8ba1('0x4')]||this[_0x8ba1('0x7')][_0x16bdb1[_0x8ba1('0x24')]]['mandatoryDisposition'])){if(this[_0x8ba1('0x8')][_0x16bdb1['interface']]){this[_0x8ba1('0xa')][_0x16bdb1[_0x8ba1('0x1b')]]={'queue':_0x16bdb1[_0x8ba1('0x24')],'interface':_0x16bdb1[_0x8ba1('0x23')],'destlinkedid':_0x16bdb1[_0x8ba1('0x30')]};}}}catch(_0x162d7f){logger['error'](_0x8ba1('0x3f'),_0x162d7f[_0x8ba1('0x37')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x25200b){try{if(this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]]&&(this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]][_0x8ba1('0x4')]||this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]][_0x8ba1('0x26')])){if(this[_0x8ba1('0x8')][_0x25200b[_0x8ba1('0x23')]]){this[_0x8ba1('0xa')][_0x25200b[_0x8ba1('0x1b')]]={'queue':_0x25200b['queue'],'interface':_0x25200b[_0x8ba1('0x23')]};}}}catch(_0x3bb667){logger[_0x8ba1('0x1f')](_0x8ba1('0x40'),_0x3bb667[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')][_0x8ba1('0x41')]=function(_0x1ff2a8){try{if(this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x1b')]]&&_[_0x8ba1('0x42')](this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x1b')]][_0x8ba1('0x2f')])){logger['info'](_0x8ba1('0x43'),_0x1ff2a8[_0x8ba1('0x1b')]);this['startAcw'](_0x1ff2a8[_0x8ba1('0x1b')]);}else if(this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x44')]]&&_[_0x8ba1('0x42')](this[_0x8ba1('0xa')][_0x1ff2a8['linkedid']]['attended'])){logger[_0x8ba1('0x1c')](_0x8ba1('0x45'),_0x1ff2a8['linkedid']);this[_0x8ba1('0x22')](_0x1ff2a8[_0x8ba1('0x44')]);}}catch(_0x391f3e){logger['error'](_0x8ba1('0x46'),_0x391f3e[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')]['syncHangup']=function(_0x368e59){try{if(this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x1b')]]&&this[_0x8ba1('0xa')][_0x368e59['uniqueid']][_0x8ba1('0x2f')]){logger[_0x8ba1('0x1c')](_0x8ba1('0x47'),_0x368e59[_0x8ba1('0x1b')]);this[_0x8ba1('0x22')](_0x368e59['uniqueid']);}else if(this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x44')]]&&this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x44')]]['attended']){logger[_0x8ba1('0x1c')](_0x8ba1('0x48'),_0x368e59[_0x8ba1('0x44')]);this[_0x8ba1('0x22')](_0x368e59[_0x8ba1('0x44')]);}}catch(_0x13d1df){logger['error'](_0x8ba1('0x49'),_0x13d1df['message']);}};Acw['prototype'][_0x8ba1('0x12')]=function(_0x568594){try{if(!_[_0x8ba1('0x4a')](this[_0x8ba1('0xa')][_0x568594['transfereeuniqueid']])){this[_0x8ba1('0x22')](_0x568594['transfereeuniqueid']);if(this['channels'][_0x568594[_0x8ba1('0x4b')]]){this['channels'][_0x568594[_0x8ba1('0x4b')]][_0x8ba1('0x2f')]=!![];this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4c')]]=this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4b')]];delete this['channels'][_0x568594[_0x8ba1('0x4b')]];}}else if(!_['isNil'](this[_0x8ba1('0xa')][_0x568594['transfertargetuniqueid']])){this[_0x8ba1('0x22')](_0x568594['transfertargetuniqueid']);if(this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]]){this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]][_0x8ba1('0x2f')]=!![];this['channels'][_0x568594['transfereeuniqueid']]=this['channels'][_0x568594['origtransfereruniqueid']];delete this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]];}}}catch(_0x27b704){logger[_0x8ba1('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x27b704[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')][_0x8ba1('0x14')]=function(_0x21cc83){try{if(this['channels'][_0x21cc83['transfereruniqueid']]){logger['info'](_0x8ba1('0x4e'),JSON['stringify'](_0x21cc83[_0x8ba1('0x4f')]));this[_0x8ba1('0x22')](_0x21cc83[_0x8ba1('0x4f')]);}else if(this['channels'][_0x21cc83[_0x8ba1('0x50')]]){logger['info'](_0x8ba1('0x51'),JSON[_0x8ba1('0x3d')](_0x21cc83[_0x8ba1('0x50')]));this[_0x8ba1('0x22')](_0x21cc83[_0x8ba1('0x50')]);}}catch(_0x49faf1){logger[_0x8ba1('0x1f')](_0x8ba1('0x52'),_0x49faf1[_0x8ba1('0x37')]);}};Acw['prototype'][_0x8ba1('0x10')]=function(_0x24f3fa){try{if(this[_0x8ba1('0x7')][_0x24f3fa[_0x8ba1('0x24')]]&&this[_0x8ba1('0x7')][_0x24f3fa[_0x8ba1('0x24')]]['autopause']===_0x8ba1('0x53')){if(this[_0x8ba1('0x8')][_0x24f3fa['interface']]){logger[_0x8ba1('0x1c')](_0x8ba1('0x54'),_0x24f3fa[_0x8ba1('0x1b')],_0x24f3fa[_0x8ba1('0x23')],_0x24f3fa['queue']);return RpcUser[_0x8ba1('0x31')](this[_0x8ba1('0x8')][_0x24f3fa[_0x8ba1('0x23')]],_0x8ba1('0x55'),_0x24f3fa[_0x8ba1('0x1b')]);}}}catch(_0x1434bc){logger['error'](_0x8ba1('0x56'),_0x1434bc[_0x8ba1('0x37')]);}};module[_0x8ba1('0x57')]=Acw; \ No newline at end of file +var _0x4f0d=['stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','queue','ACW','mandatoryDisposition','name','agents','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer'];(function(_0xcdb9e7,_0x4a9934){var _0x89f1e=function(_0x496079){while(--_0x496079){_0xcdb9e7['push'](_0xcdb9e7['shift']());}};_0x89f1e(++_0x4a9934);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x53c5cf,_0x3ef208){_0x53c5cf=_0x53c5cf-0x0;var _0x3261aa=_0x4f0d[_0x53c5cf];return _0x3261aa;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xd4f0('0x0'));var RpcVoiceAgentReport=require(_0xd4f0('0x1'));function Acw(_0x216b0d){this['voiceQueues']=_0x216b0d[_0xd4f0('0x2')];this['agents']=_0x216b0d['agents'];this[_0xd4f0('0x3')]=_0x216b0d['timers'];this[_0xd4f0('0x4')]={};ami['on'](_0xd4f0('0x5'),this['syncAgentConnect'][_0xd4f0('0x6')](this));ami['on'](_0xd4f0('0x7'),this[_0xd4f0('0x8')][_0xd4f0('0x6')](this));ami['on'](_0xd4f0('0x9'),this['syncHangup'][_0xd4f0('0x6')](this));ami['on'](_0xd4f0('0xa'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xd4f0('0xb'),this[_0xd4f0('0xc')]['bind'](this));ami['on'](_0xd4f0('0xd'),this[_0xd4f0('0xe')][_0xd4f0('0x6')](this));ami['on'](_0xd4f0('0xf'),this[_0xd4f0('0x10')]['bind'](this));}function getDiff(_0xdddd54){var _0x2c3e99=moment()[_0xd4f0('0x11')](0x0);var _0x46b4de=moment(_0xdddd54)[_0xd4f0('0x11')](0x0);return _0x2c3e99[_0xd4f0('0x12')](_0x46b4de,_0xd4f0('0x13'));}Acw[_0xd4f0('0x14')][_0xd4f0('0x15')]=function(_0x21eb54,_0x44cf9f){var _0x2dd02d=this;var _0x4f8e76=getDiff(_0x2dd02d['timers'][_0x21eb54][_0xd4f0('0x16')]);clearTimeout(_0x2dd02d[_0xd4f0('0x3')][_0x21eb54][_0xd4f0('0x17')]);_0x2dd02d[_0xd4f0('0x3')][_0x21eb54]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x4f8e76},_0x2dd02d[_0xd4f0('0x3')][_0x21eb54][_0xd4f0('0x18')],_0x21eb54)[_0xd4f0('0x19')](function(_0x2e4351){logger[_0xd4f0('0x1a')](_0xd4f0('0x1b'),_0x44cf9f,_0x4f8e76,_0x2e4351);})[_0xd4f0('0x1c')](function(_0x149e62){logger[_0xd4f0('0x1d')](_0xd4f0('0x1e'),_0x44cf9f,_0x149e62);})['finally'](function(){delete _0x2dd02d[_0xd4f0('0x3')][_0x21eb54];});};Acw[_0xd4f0('0x14')][_0xd4f0('0x1f')]=function(_0x49be54){try{var _0x2c2bd5=this;var _0x31c7a0=this[_0xd4f0('0x4')][_0x49be54]['interface'];var _0x26264f=this[_0xd4f0('0x4')][_0x49be54][_0xd4f0('0x20')];var _0x143aee=this['voiceQueues'][_0x26264f];var _0x1552e9=![];var _0x3345c6=_0xd4f0('0x21');if(_0x143aee[_0xd4f0('0x22')]&&_0x143aee['mandatoryDispositionPause'][_0xd4f0('0x23')]){_0x1552e9=!![];_0x3345c6=_0x143aee['mandatoryDispositionPause'][_0xd4f0('0x23')];}if(!_0x2c2bd5[_0xd4f0('0x24')][_0x31c7a0]){return Promise[_0xd4f0('0x25')]();}return RpcUser[_0xd4f0('0x26')](_0x2c2bd5[_0xd4f0('0x24')][_0x31c7a0]['id'])[_0xd4f0('0x19')](function(_0x1dd584){if(!_0x1dd584||_0x1dd584[_0xd4f0('0x27')]){logger[_0xd4f0('0x1a')](_0xd4f0('0x28'),_0x49be54,_0x31c7a0,_0x26264f);return;}logger[_0xd4f0('0x1a')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x49be54,_0x31c7a0,_0x26264f);var _0x13a3c2=_0x2c2bd5[_0xd4f0('0x4')][_0x49be54][_0xd4f0('0x29')]&&_0x2c2bd5[_0xd4f0('0x4')][_0x49be54]['destlinkedid']?_0x2c2bd5[_0xd4f0('0x4')][_0x49be54][_0xd4f0('0x2a')]:_0x49be54;return RpcUser[_0xd4f0('0x2b')](_0x2c2bd5[_0xd4f0('0x24')][_0x31c7a0],_0x3345c6,_0x13a3c2);})['then'](function(_0x39c44a){if(_0x1552e9||!_0x39c44a){return;}_0x2c2bd5[_0xd4f0('0x3')][_0x31c7a0]={};logger[_0xd4f0('0x1a')](_0xd4f0('0x2c'),_0x49be54,_0x2c2bd5['voiceQueues'][_0x26264f][_0xd4f0('0x2d')],_0x31c7a0,_0x26264f);_0x2c2bd5[_0xd4f0('0x3')][_0x31c7a0][_0xd4f0('0x17')]=setTimeout(_0x2c2bd5[_0xd4f0('0x2e')][_0xd4f0('0x6')](_0x2c2bd5,_0x31c7a0),_0x2c2bd5[_0xd4f0('0x2')][_0x26264f][_0xd4f0('0x2d')]*0x3e8);_0x2c2bd5[_0xd4f0('0x3')][_0x31c7a0][_0xd4f0('0x16')]=moment()[_0xd4f0('0x2f')](_0xd4f0('0x30'));_0x2c2bd5['timers'][_0x31c7a0][_0xd4f0('0x18')]=_0x49be54;_0x2c2bd5[_0xd4f0('0x3')][_0x31c7a0][_0xd4f0('0x20')]=_0x26264f;_0x2c2bd5[_0xd4f0('0x3')][_0x31c7a0][_0xd4f0('0x15')]=_0x2c2bd5['updateAcw'][_0xd4f0('0x6')](_0x2c2bd5,_0x31c7a0,_0x49be54);})[_0xd4f0('0x1c')](function(){logger['error'](_0xd4f0('0x2c'),_0x49be54,_0x2c2bd5[_0xd4f0('0x2')][_0x26264f][_0xd4f0('0x2d')],_0x31c7a0,_0x26264f);})['finally'](function(){delete _0x2c2bd5[_0xd4f0('0x4')][_0x49be54];});}catch(_0x482369){logger['error']('[ACW][START]\x20%s',_0x482369[_0xd4f0('0x31')]);}};Acw[_0xd4f0('0x14')][_0xd4f0('0x2e')]=function(_0x23c677){try{var _0x3fb345=this;if(_0x3fb345['timers'][_0x23c677]){_0x3fb345['timers'][_0x23c677][_0xd4f0('0x17')]=![];var _0x14a35e=_0x3fb345[_0xd4f0('0x3')][_0x23c677]['uniqueid'];var _0x400891=_0x3fb345[_0xd4f0('0x3')][_0x23c677][_0xd4f0('0x20')];var _0x50b560=_0x3fb345[_0xd4f0('0x2')][_0x400891]['acwTimeout'];logger[_0xd4f0('0x1a')](_0xd4f0('0x32'),_0x14a35e,_0x23c677);RpcUser[_0xd4f0('0x33')](this[_0xd4f0('0x24')][_0x23c677]);RpcVoiceAgentReport[_0xd4f0('0x34')]({'acwtime':_0x50b560,'agentacw':!![]},_0x14a35e,_0x23c677)[_0xd4f0('0x19')](function(_0x50904e){logger['info'](_0xd4f0('0x1b'),_0x14a35e,_0x50b560,_0x50904e);})[_0xd4f0('0x1c')](function(_0x4bad3c){logger[_0xd4f0('0x1d')](_0xd4f0('0x1e'),_0x14a35e,_0x4bad3c);});}else{logger[_0xd4f0('0x1d')](_0xd4f0('0x35'),_0x23c677);if(_0x3fb345[_0xd4f0('0x3')]){logger[_0xd4f0('0x1a')]('[ACW][TIMERS]',JSON[_0xd4f0('0x36')](_0x3fb345[_0xd4f0('0x3')]));}}}catch(_0x2e59e4){logger[_0xd4f0('0x1d')](_0xd4f0('0x37'),_0x2e59e4[_0xd4f0('0x31')]);}};Acw['prototype'][_0xd4f0('0x38')]=function(_0x16f52a){try{if(this['voiceQueues'][_0x16f52a['queue']]&&(this[_0xd4f0('0x2')][_0x16f52a[_0xd4f0('0x20')]][_0xd4f0('0x39')]||this['voiceQueues'][_0x16f52a['queue']][_0xd4f0('0x22')])){if(this[_0xd4f0('0x24')][_0x16f52a[_0xd4f0('0x3a')]]){this[_0xd4f0('0x4')][_0x16f52a[_0xd4f0('0x18')]]={'queue':_0x16f52a[_0xd4f0('0x20')],'interface':_0x16f52a[_0xd4f0('0x3a')],'destlinkedid':_0x16f52a[_0xd4f0('0x2a')]};}}}catch(_0xa3e3f2){logger[_0xd4f0('0x1d')](_0xd4f0('0x3b'),_0xa3e3f2[_0xd4f0('0x31')]);}};Acw[_0xd4f0('0x14')]['syncAgentConnectPreview']=function(_0x1b88b0){try{if(this['voiceQueues'][_0x1b88b0[_0xd4f0('0x20')]]&&(this['voiceQueues'][_0x1b88b0[_0xd4f0('0x20')]][_0xd4f0('0x39')]||this[_0xd4f0('0x2')][_0x1b88b0['queue']][_0xd4f0('0x22')])){if(this[_0xd4f0('0x24')][_0x1b88b0['interface']]){this[_0xd4f0('0x4')][_0x1b88b0['uniqueid']]={'queue':_0x1b88b0[_0xd4f0('0x20')],'interface':_0x1b88b0[_0xd4f0('0x3a')]};}}}catch(_0x4a9078){logger[_0xd4f0('0x1d')](_0xd4f0('0x3c'),_0x4a9078[_0xd4f0('0x31')]);}};Acw[_0xd4f0('0x14')][_0xd4f0('0x8')]=function(_0xf167c1){try{if(this[_0xd4f0('0x4')][_0xf167c1[_0xd4f0('0x18')]]&&_[_0xd4f0('0x3d')](this[_0xd4f0('0x4')][_0xf167c1[_0xd4f0('0x18')]][_0xd4f0('0x29')])){logger['info'](_0xd4f0('0x3e'),_0xf167c1[_0xd4f0('0x18')]);this[_0xd4f0('0x1f')](_0xf167c1[_0xd4f0('0x18')]);}else if(this[_0xd4f0('0x4')][_0xf167c1['linkedid']]&&_[_0xd4f0('0x3d')](this[_0xd4f0('0x4')][_0xf167c1[_0xd4f0('0x3f')]][_0xd4f0('0x29')])){logger[_0xd4f0('0x1a')](_0xd4f0('0x40'),_0xf167c1[_0xd4f0('0x3f')]);this[_0xd4f0('0x1f')](_0xf167c1[_0xd4f0('0x3f')]);}}catch(_0x8b388d){logger[_0xd4f0('0x1d')](_0xd4f0('0x41'),_0x8b388d[_0xd4f0('0x31')]);}};Acw[_0xd4f0('0x14')][_0xd4f0('0x42')]=function(_0x5a18f5){try{if(this[_0xd4f0('0x4')][_0x5a18f5['uniqueid']]&&this[_0xd4f0('0x4')][_0x5a18f5[_0xd4f0('0x18')]][_0xd4f0('0x29')]){logger['info'](_0xd4f0('0x43'),_0x5a18f5[_0xd4f0('0x18')]);this['startAcw'](_0x5a18f5[_0xd4f0('0x18')]);}else if(this[_0xd4f0('0x4')][_0x5a18f5[_0xd4f0('0x3f')]]&&this[_0xd4f0('0x4')][_0x5a18f5['linkedid']][_0xd4f0('0x29')]){logger['info'](_0xd4f0('0x44'),_0x5a18f5[_0xd4f0('0x3f')]);this[_0xd4f0('0x1f')](_0x5a18f5[_0xd4f0('0x3f')]);}}catch(_0x2c9478){logger['error']('[ACW][syncHangup]\x20%s',_0x2c9478[_0xd4f0('0x31')]);}};Acw[_0xd4f0('0x14')][_0xd4f0('0xc')]=function(_0x16791d){try{if(!_[_0xd4f0('0x45')](this[_0xd4f0('0x4')][_0x16791d[_0xd4f0('0x46')]])){this[_0xd4f0('0x1f')](_0x16791d[_0xd4f0('0x46')]);if(this['channels'][_0x16791d[_0xd4f0('0x47')]]){this[_0xd4f0('0x4')][_0x16791d['secondtransfereruniqueid']][_0xd4f0('0x29')]=!![];this[_0xd4f0('0x4')][_0x16791d[_0xd4f0('0x48')]]=this[_0xd4f0('0x4')][_0x16791d['secondtransfereruniqueid']];delete this['channels'][_0x16791d[_0xd4f0('0x47')]];}}else if(!_[_0xd4f0('0x45')](this['channels'][_0x16791d['transfertargetuniqueid']])){this[_0xd4f0('0x1f')](_0x16791d[_0xd4f0('0x48')]);if(this[_0xd4f0('0x4')][_0x16791d['origtransfereruniqueid']]){this[_0xd4f0('0x4')][_0x16791d[_0xd4f0('0x49')]][_0xd4f0('0x29')]=!![];this[_0xd4f0('0x4')][_0x16791d['transfereeuniqueid']]=this['channels'][_0x16791d[_0xd4f0('0x49')]];delete this['channels'][_0x16791d[_0xd4f0('0x49')]];}}}catch(_0x59698a){logger[_0xd4f0('0x1d')](_0xd4f0('0x4a'),_0x59698a['message']);}};Acw[_0xd4f0('0x14')][_0xd4f0('0xe')]=function(_0x3edf24){try{if(this[_0xd4f0('0x4')][_0x3edf24[_0xd4f0('0x4b')]]){logger[_0xd4f0('0x1a')](_0xd4f0('0x4c'),JSON['stringify'](_0x3edf24['transfereruniqueid']));this[_0xd4f0('0x1f')](_0x3edf24[_0xd4f0('0x4b')]);}else if(this['channels'][_0x3edf24[_0xd4f0('0x4d')]]){logger['info'](_0xd4f0('0x4e'),JSON[_0xd4f0('0x36')](_0x3edf24[_0xd4f0('0x4d')]));this[_0xd4f0('0x1f')](_0x3edf24[_0xd4f0('0x4d')]);}}catch(_0x3d4979){logger[_0xd4f0('0x1d')]('[ACW][syncBlindTransfer]\x20%s',_0x3d4979[_0xd4f0('0x31')]);}};Acw['prototype'][_0xd4f0('0x4f')]=function(_0x41da67){try{if(this[_0xd4f0('0x2')][_0x41da67[_0xd4f0('0x20')]]&&this[_0xd4f0('0x2')][_0x41da67['queue']][_0xd4f0('0x50')]==='all'){if(this[_0xd4f0('0x24')][_0x41da67[_0xd4f0('0x3a')]]){logger['info'](_0xd4f0('0x51'),_0x41da67[_0xd4f0('0x18')],_0x41da67['interface'],_0x41da67[_0xd4f0('0x20')]);return RpcUser[_0xd4f0('0x2b')](this[_0xd4f0('0x24')][_0x41da67[_0xd4f0('0x3a')]],_0xd4f0('0x52'),_0x41da67[_0xd4f0('0x18')]);}}}catch(_0x4e6981){logger[_0xd4f0('0x1d')](_0xd4f0('0x53'),_0x4e6981[_0xd4f0('0x31')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index dfc242e..6141baf 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 _0x6c56=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus'];(function(_0x62acd5,_0x50a727){var _0x30d1c8=function(_0x1accb7){while(--_0x1accb7){_0x62acd5['push'](_0x62acd5['shift']());}};_0x30d1c8(++_0x50a727);}(_0x6c56,0x1d6));var _0x66c5=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x6c56[_0x22ee1e];return _0x49a5c9;};'use strict';var Manager=require(_0x66c5('0x0'));var BPromise=require(_0x66c5('0x1'));var util=require(_0x66c5('0x2'));var logger=require(_0x66c5('0x3'))(_0x66c5('0x4'));var config=require(_0x66c5('0x5'));var ami=new Manager(config[_0x66c5('0x6')]['port'],config[_0x66c5('0x6')]['ip'],config[_0x66c5('0x6')]['username'],config['asterisk'][_0x66c5('0x7')],!![]);ami[_0x66c5('0x8')]();ami[_0x66c5('0x9')]=BPromise[_0x66c5('0xa')](ami[_0x66c5('0xb')]);function error(_0x1c2359){logger[_0x66c5('0xc')](util[_0x66c5('0xd')](_0x66c5('0xe'),config[_0x66c5('0x6')][_0x66c5('0xf')],config['asterisk']['ip'],config[_0x66c5('0x6')][_0x66c5('0x10')],util[_0x66c5('0x11')](_0x1c2359,![],null)));}function close(){logger[_0x66c5('0xc')](util['format'](_0x66c5('0x12'),config[_0x66c5('0x6')][_0x66c5('0xf')],config[_0x66c5('0x6')]['ip'],config[_0x66c5('0x6')][_0x66c5('0x10')]));}ami[_0x66c5('0x13')]=function(){return function(){return ami[_0x66c5('0x9')]({'action':_0x66c5('0x14')});};};ami[_0x66c5('0x15')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x66c5('0x16')]=function(){return function(){return ami['Action']({'action':_0x66c5('0x17')});};};ami[_0x66c5('0x18')]=function(){return function(){return ami[_0x66c5('0x9')]({'action':_0x66c5('0x19')});};};ami[_0x66c5('0x1a')]=function(){return function(){return ami[_0x66c5('0x9')]({'action':_0x66c5('0x1b')});};};function connect(){logger['info'](util[_0x66c5('0xd')](_0x66c5('0x1c'),config[_0x66c5('0x6')]['username'],config[_0x66c5('0x6')]['ip'],config[_0x66c5('0x6')]['port']));ami[_0x66c5('0x1d')]('error',error);ami[_0x66c5('0x1d')](_0x66c5('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x66c5('0x1f'),function(_0x56bf52){logger[_0x66c5('0x20')](util['format'](_0x66c5('0x21'),config[_0x66c5('0x6')]['username'],config[_0x66c5('0x6')]['ip'],config['asterisk'][_0x66c5('0x10')],util[_0x66c5('0x11')](_0x56bf52,![],null)));});ami['on'](_0x66c5('0x22'),function(){logger['info'](util[_0x66c5('0xd')](_0x66c5('0x23'),config[_0x66c5('0x6')][_0x66c5('0xf')],config[_0x66c5('0x6')]['ip'],config[_0x66c5('0x6')][_0x66c5('0x10')]));return Promise['resolve']()[_0x66c5('0x24')](ami['actionSipShowRegistry']())[_0x66c5('0x24')](ami[_0x66c5('0x15')]())[_0x66c5('0x24')](ami['actionSipPeerStatus']())[_0x66c5('0x24')](ami[_0x66c5('0x18')]())[_0x66c5('0x24')](ami[_0x66c5('0x1a')]())[_0x66c5('0x25')](function(_0x508877){logger[_0x66c5('0xc')]('[ami.js][fullybooted]',util[_0x66c5('0x11')](_0x508877,{'showHidden':![],'depth':null}));});});ami[_0x66c5('0x1d')]('error',error);ami[_0x66c5('0x1d')](_0x66c5('0x1e'),close);module['exports']=ami; \ No newline at end of file +var _0xfd9a=['actionDeviceStateList','actionSipPeerStatus','catch','[ami.js][fullybooted]','asterisk-manager','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfd9a,0x1cc));var _0xafd9=function(_0x5535c,_0x4d0656){_0x5535c=_0x5535c-0x0;var _0x5500c4=_0xfd9a[_0x5535c];return _0x5500c4;};'use strict';var Manager=require(_0xafd9('0x0'));var BPromise=require('bluebird');var util=require(_0xafd9('0x1'));var logger=require(_0xafd9('0x2'))('ami');var config=require(_0xafd9('0x3'));var ami=new Manager(config[_0xafd9('0x4')][_0xafd9('0x5')],config[_0xafd9('0x4')]['ip'],config['asterisk'][_0xafd9('0x6')],config['asterisk'][_0xafd9('0x7')],!![]);ami[_0xafd9('0x8')]();ami[_0xafd9('0x9')]=BPromise[_0xafd9('0xa')](ami[_0xafd9('0xb')]);function error(_0x32d390){logger[_0xafd9('0xc')](util[_0xafd9('0xd')](_0xafd9('0xe'),config['asterisk'][_0xafd9('0x6')],config['asterisk']['ip'],config['asterisk'][_0xafd9('0x5')],util['inspect'](_0x32d390,![],null)));}function close(){logger[_0xafd9('0xc')](util['format'](_0xafd9('0xf'),config['asterisk'][_0xafd9('0x6')],config[_0xafd9('0x4')]['ip'],config[_0xafd9('0x4')][_0xafd9('0x5')]));}ami[_0xafd9('0x10')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xafd9('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xafd9('0x9')]({'action':_0xafd9('0x12')});};};ami[_0xafd9('0x13')]=function(){return function(){return ami[_0xafd9('0x9')]({'action':_0xafd9('0x14')});};};ami[_0xafd9('0x15')]=function(){return function(){return ami[_0xafd9('0x9')]({'action':_0xafd9('0x16')});};};function connect(){logger[_0xafd9('0x17')](util['format'](_0xafd9('0x18'),config[_0xafd9('0x4')][_0xafd9('0x6')],config['asterisk']['ip'],config[_0xafd9('0x4')]['port']));ami[_0xafd9('0x19')]('error',error);ami[_0xafd9('0x19')](_0xafd9('0x1a'),close);}ami['on'](_0xafd9('0x1b'),connect);ami['on'](_0xafd9('0x1c'),function(_0xe65b74){logger[_0xafd9('0x17')](util[_0xafd9('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xafd9('0x4')][_0xafd9('0x6')],config['asterisk']['ip'],config['asterisk']['port'],util[_0xafd9('0x1d')](_0xe65b74,![],null)));});ami['on'](_0xafd9('0x1e'),function(){logger['info'](util[_0xafd9('0xd')](_0xafd9('0x1f'),config[_0xafd9('0x4')][_0xafd9('0x6')],config[_0xafd9('0x4')]['ip'],config['asterisk'][_0xafd9('0x5')]));return Promise[_0xafd9('0x20')]()[_0xafd9('0x21')](ami[_0xafd9('0x10')]())[_0xafd9('0x21')](ami[_0xafd9('0x22')]())[_0xafd9('0x21')](ami[_0xafd9('0x23')]())[_0xafd9('0x21')](ami[_0xafd9('0x13')]())['then'](ami[_0xafd9('0x15')]())[_0xafd9('0x24')](function(_0xca3206){logger['error'](_0xafd9('0x25'),util[_0xafd9('0x1d')](_0xca3206,{'showHidden':![],'depth':null}));});});ami['once'](_0xafd9('0xc'),error);ami[_0xafd9('0x19')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 28c2047..1b3007e 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 _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x2484fa,_0x120551){var _0x2dfe01=function(_0x561f48){while(--_0x561f48){_0x2484fa['push'](_0x2484fa['shift']());}};_0x2dfe01(++_0x120551);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xa93655,_0x2eb912){_0xa93655=_0xa93655-0x0;var _0x91f6a1=_0x9ffd[_0xa93655];return _0x91f6a1;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2e1c18,_0x54e856){_0x2e1c18=_0x2e1c18-0x0;var _0xc1e39=_0x9bde[_0x2e1c18];return _0xc1e39;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 399c557..aa7a0cc 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 _0x1ac8=['checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','silly','isGlobal','AMI\x20IfTime','uniqueid','uniqueId','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','pick','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','createStateFinal','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','[actions]','clearZombieChannels','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[syncQueueCallerAbandon]\x20[Drop]','Agent','user:%s','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','verifyAdditionalPhones','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','dropRate','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','reachable','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','./utils/hopper','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','format','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','ifTime','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','\x20Interval\x20is\x20overtime:\x20','catch','syncCampaigns','resolve'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x1ac8,0x182));var _0x81ac=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1ac8[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x81ac('0x0'));var _=require(_0x81ac('0x1'));var uuid=require(_0x81ac('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x81ac('0x3'));var utils=require(_0x81ac('0x4'));var hopperUtils=require(_0x81ac('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x81ac('0x6'))(_0x81ac('0x7'));var loggerBooked=require(_0x81ac('0x6'))(_0x81ac('0x8'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x81ac('0x6'))(_0x81ac('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x81ac('0xa'));var ami=require(_0x81ac('0xb'));config['redis']=_[_0x81ac('0xc')](config['redis'],{'host':_0x81ac('0xd'),'port':0x18eb});var io=require(_0x81ac('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x81ac('0xf'));var voiceQueueRt=require(_0x81ac('0x10'));var RpcSetting=require(_0x81ac('0x11'));var Interval=require(_0x81ac('0x12'));var Action=require('./models/action');var History=require(_0x81ac('0x13'));var Final=require(_0x81ac('0x14'));var AgentComplete=require(_0x81ac('0x15'));var QueueCallerAbandon=require(_0x81ac('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0x81ac('0x17')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x81ac('0x18')][_0x81ac('0x19')]=function(_0x4752f1){this['tail']=this[_0x81ac('0x1a')]?this[_0x81ac('0x1a')][_0x81ac('0x1b')](_0x4752f1):_0x4752f1();};function Dialer(_0x161f3b,_0x15db81){this[_0x81ac('0x1c')]=new Sequence();this[_0x81ac('0x1d')]=_0x15db81;this[_0x81ac('0x1e')]=_0x161f3b['voiceQueues'];this[_0x81ac('0x1f')]=_0x161f3b[_0x81ac('0x1f')];this[_0x81ac('0x20')]=_0x161f3b['agents'];this[_0x81ac('0x21')]=_0x161f3b[_0x81ac('0x21')];this[_0x81ac('0x22')]=config[_0x81ac('0x22')]||0x2;this[_0x81ac('0x23')]={};this[_0x81ac('0x24')]={};this[_0x81ac('0x25')]={};this['uniqueId']={};this[_0x81ac('0x26')]={};this[_0x81ac('0x27')]={};this[_0x81ac('0x28')]={};this[_0x81ac('0x29')]={};this['queueBooked']={};this[_0x81ac('0x2a')]={};this[_0x81ac('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x81ac('0x2c')](this));ami['on']('queuecallerabandon',this[_0x81ac('0x2d')][_0x81ac('0x2c')](this));ami['on'](_0x81ac('0x2e'),this[_0x81ac('0x2f')][_0x81ac('0x2c')](this));ami['on'](_0x81ac('0x30'),this[_0x81ac('0x31')][_0x81ac('0x2c')](this));ami['on'](_0x81ac('0x32'),this[_0x81ac('0xa')][_0x81ac('0x2c')](this));ami['on']('custom:queuesummarycomplete',this[_0x81ac('0x33')][_0x81ac('0x2c')](this));ami['on'](_0x81ac('0x34'),this[_0x81ac('0x35')][_0x81ac('0x2c')](this));ami['on']('newexten',this[_0x81ac('0x36')]['bind'](this));ami['on'](_0x81ac('0x37'),this['syncVarSet'][_0x81ac('0x2c')](this));ami['on'](_0x81ac('0x38'),this[_0x81ac('0x39')][_0x81ac('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x81ac('0x3a')][_0x81ac('0x2c')](this));this[_0x81ac('0x3b')]();this[_0x81ac('0x3c')]();RpcSetting[_0x81ac('0x3d')]()[_0x81ac('0x3e')](function(_0x455f67){previewRecallmeReminderInterval=_0x455f67[_0x81ac('0x3f')];});}function isNotNull(_0x332b4f){return _0x332b4f!==null&&!_[_0x81ac('0x40')](_0x332b4f);}function msgResponse(_0x339594,_0x5e99ad,_0x54a46a){return{'action':_0x339594,'response':_0x5e99ad,'message':_0x54a46a,'stack':_0x54a46a};}function emit(_0x1fd10b,_0x846e52,_0x7ac244){io['to'](_0x1fd10b)[_0x81ac('0x41')](_0x846e52,_0x7ac244);}function emitOutboundVoiceQueueSummary(_0x2f956b){if(_0x2f956b[_0x81ac('0x42')]===_0x81ac('0x43')){logger[_0x81ac('0x44')](_0x81ac('0x45'),util[_0x81ac('0x46')](_0x2f956b,{'showHidden':![],'depth':null}));emit(util['format'](_0x81ac('0x47'),_0x2f956b[_0x81ac('0x48')]),_0x81ac('0x49'),_0x2f956b);}}function checkGetDataPredictive(_0xc0c1b){if(isNotNull(_0xc0c1b)&&!_[_0x81ac('0x4a')](_0xc0c1b)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x4c'),_0xc0c1b[_0x81ac('0x4d')]);loggerPredictive['info'](_0x81ac('0x4e'),_0xc0c1b['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x4f'),_0xc0c1b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x81ac('0x50'),_0xc0c1b[_0x81ac('0x51')]);loggerPredictive['info'](_0x81ac('0x52'),_0xc0c1b['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x81ac('0x53'),_0xc0c1b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x54'));if(_0xc0c1b[_0x81ac('0x4d')]>0x0){if(!_[_0x81ac('0x40')](_0xc0c1b['predictiveIntervalAvgTalktime'])&&_0xc0c1b[_0x81ac('0x55')]>0x0){return!![];}loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x56'));if(!_[_0x81ac('0x40')](_0xc0c1b['predictiveIntervalAvgHoldtime'])&&_0xc0c1b[_0x81ac('0x57')]>0x0){return!![];}loggerPredictive['info'](_0x81ac('0x58'));}else{loggerPredictive[_0x81ac('0x4b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x59'));}return![];}function mergeDataErlangB(_0x4975e9){return function(_0x1c535d){loggerPredictive['info'](_0x81ac('0x5a'));loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x5b'),_0x1c535d['erlangCalls']);loggerPredictive[_0x81ac('0x4b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c535d[_0x81ac('0x5c')]);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x5d'),_0x1c535d[_0x81ac('0x5e')]);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x5f'),_0x1c535d[_0x81ac('0x60')]);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x5d'),_0x1c535d[_0x81ac('0x5e')]);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x54'));_[_0x81ac('0x61')](_0x4975e9,_0x1c535d);};}function ifInterval(_0x491f9b,_0x5d3767){if(_[_0x81ac('0x40')](_0x5d3767)){return![];}return utils[_0x81ac('0x62')](undefined,_0x5d3767)<_0x491f9b*0x3c;}function clearPredictiveAttributes(_0x2b778a){if(_0x2b778a['startProgressive']){_0x2b778a[_0x81ac('0x28')]=undefined;loggerPredictive[_0x81ac('0x44')](_0x2b778a[_0x81ac('0x48')],'startProgressive\x20value\x20cleared');}if(_0x2b778a[_0x81ac('0x27')]){_0x2b778a[_0x81ac('0x27')]=undefined;loggerPredictive[_0x81ac('0x44')](_0x2b778a['name'],_0x81ac('0x63'));}if(_0x2b778a['handlePredictive']){clearInterval(_0x2b778a[_0x81ac('0x64')]);_0x2b778a[_0x81ac('0x64')]=undefined;loggerPredictive[_0x81ac('0x44')](_0x2b778a[_0x81ac('0x48')],_0x81ac('0x65'));}}function loggerCatchPredictive(_0x1b293a,_0xade861){return function(_0x3d946f){loggerPredictive[_0x81ac('0x66')](_0xade861[_0x81ac('0x48')],_0x1b293a);loggerPredictive[_0x81ac('0x66')](_0x3d946f[_0x81ac('0x67')]);clearPredictiveAttributes(_0xade861);};}function loggerCatch(_0x8c53c8){return function(_0x1b6047){logger[_0x81ac('0x66')](_0x8c53c8,util[_0x81ac('0x46')](_0x1b6047,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5a48ef,_0xb4819a,_0x4b3495){return function(_0x7e17fd){utils[_0x81ac('0x68')](_0xb4819a,_0x4b3495,0x0);_0xb4819a['temp']=0x0;logger[_0x81ac('0x66')](_0x5a48ef,util[_0x81ac('0x46')](_0x7e17fd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5dbeac){return function(_0xcc6404){if(isNotNull(_0xcc6404)&&isNotNull(_0xcc6404[0x0])){if(_0xcc6404[0x0][_0x81ac('0x69')]>0x0){_0x5dbeac['message']=utils[_0x81ac('0x6a')][_0x81ac('0x6b')];logger[_0x81ac('0x4b')](_0x81ac('0x6c')+_0x5dbeac['name'],_0xcc6404[0x0][_0x81ac('0x69')],_0x81ac('0x6d'));}else{_0x5dbeac['message']=utils[_0x81ac('0x6a')][_0x81ac('0x6e')];logger[_0x81ac('0x4b')](_0x81ac('0x6f')+_0x5dbeac['name']);}}};}function createObjHistory(_0x158604,_0x5d9e49,_0xb33598,_0x2938aa,_0xf749b8){_0x158604[_0x81ac('0x70')]=_0xb33598;var _0x5950bd=new Action(_0x158604,_0x5d9e49);var _0x3f8052=new History(_0x5950bd);_0x3f8052[_0x81ac('0x71')]=_0x2938aa;_0x3f8052[_0x81ac('0x72')]=_0xf749b8;_0x3f8052[_0x81ac('0x73')]=_0x5950bd[_0x81ac('0x74')];return _0x3f8052;}function unlockQueueStatus(_0x52e949,_0x46128a){setTimeout(function(){if(_[_0x81ac('0x40')](_0x52e949[_0x81ac('0x75')])){loggerBooked[_0x81ac('0x66')](_0x81ac('0x76'),_0x46128a);}_0x52e949['queueStatusComplete']=!![];loggerBooked[_0x81ac('0x4b')](_0x81ac('0x77'),_0x46128a,JSON[_0x81ac('0x78')](_['pick'](_0x52e949,[_0x81ac('0x48'),_0x81ac('0x75')])));},0x1f3);}function checkInterval(_0x823487){return function(){if(!isNotNull(_0x823487[_0x81ac('0x79')])){_0x823487['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x823487[_0x81ac('0x48')]+_0x81ac('0x7a');}if(!isNotNull(_0x823487[_0x81ac('0x79')][_0x81ac('0x7b')])){_0x823487[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x7c')];throw _0x823487[_0x81ac('0x48')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x81ac('0x4a')](_0x823487[_0x81ac('0x79')][_0x81ac('0x7b')]))){_0x823487[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x7c')];throw _0x823487[_0x81ac('0x48')]+_0x81ac('0x7a');}};}function checkIsIVRCampaignActive(_0x4ab16d){return function(){if(!utils[_0x81ac('0x7d')](_0x4ab16d)){_0x4ab16d[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x7e')];throw _0x4ab16d[_0x81ac('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x5d6dd7){if(utils[_0x81ac('0x7f')](_0x5d6dd7)){emit(util['format'](_0x81ac('0x80'),_0x5d6dd7['name']),_0x81ac('0x81'),_0x5d6dd7);}}function loggerCatchQueueSummary(_0x3cc759,_0x45896f){return function(_0x524e99){clearPredictiveAttributes(_0x45896f);emitCampaignSummary(_0x45896f);loggerSyncQueueSummary[_0x81ac('0x44')](_0x3cc759,util[_0x81ac('0x46')](_0x524e99,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x27f563){if(_0x27f563[_0x81ac('0x82')]){if(_0x27f563[_0x81ac('0x83')]===0x0){_0x27f563['sendMessageOneNotActive']=![];_0x27f563[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x7e')];loggerSyncQueueSummary[_0x81ac('0x44')](_0x81ac('0x84'),_0x27f563['name'],_0x81ac('0x85'));}else{_0x27f563['message']=utils[_0x81ac('0x6a')][_0x81ac('0x86')];loggerSyncQueueSummary[_0x81ac('0x44')](_0x81ac('0x84'),_0x27f563['name'],_0x81ac('0x87'));}emitCampaignSummary(_0x27f563);}}function myreject(_0x44a304){return function(_0x714206){return _0x44a304(msgResponse(_0x81ac('0x88'),_0x81ac('0x89'),JSON[_0x81ac('0x78')](_0x714206)));};}Dialer[_0x81ac('0x18')][_0x81ac('0x8a')]=function(_0x5f4fd4){return!_[_0x81ac('0x40')](_0x5f4fd4)&&_0x5f4fd4&&!_['isUndefined'](_0x5f4fd4[_0x81ac('0x48')])&&!_[_0x81ac('0x40')](_0x5f4fd4[_0x81ac('0x8b')])&&_0x5f4fd4[_0x81ac('0x8b')]&&(this[_0x81ac('0x21')][util[_0x81ac('0x8c')](_0x81ac('0x8d'),_0x5f4fd4['name'])][_0x81ac('0x8e')]==='reachable'||this[_0x81ac('0x21')][util[_0x81ac('0x8c')](_0x81ac('0x8d'),_0x5f4fd4[_0x81ac('0x48')])][_0x81ac('0x8e')]===_0x81ac('0x8f'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x2efd17){var _0x41f6ad=this;return function(){if(!_0x41f6ad[_0x81ac('0x8a')](_0x2efd17[_0x81ac('0x90')])){if(!_0x41f6ad[_0x81ac('0x8a')](_0x2efd17[_0x81ac('0x91')])){_0x2efd17[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x92')];throw _0x2efd17['name']+_0x81ac('0x93');}}};};Dialer[_0x81ac('0x18')][_0x81ac('0x94')]=function(_0x3fb3ef,_0x35b388,_0x4c98c1,_0x402202){var _0x4695ec=this;return function(){var _0x3d8892=!![];return _0x4695ec[_0x81ac('0x95')](_0x3fb3ef,_0x35b388,_0x4c98c1,_0x402202,_0x3d8892);};};Dialer['prototype'][_0x81ac('0x96')]=function(_0x5655a7,_0x4ee0ca,_0x53c85e,_0x255c31){var _0x4450ea=this;return function(){var _0x54db8d=![];return _0x4450ea[_0x81ac('0x95')](_0x5655a7[_0x81ac('0x7b')],_0x4ee0ca,_0x53c85e,_0x255c31,_0x54db8d);};};Dialer[_0x81ac('0x18')][_0x81ac('0x95')]=function(_0x3bf822,_0x347f70,_0xf9ccd7,_0x5bc2cd,_0x572897){var _0x5e9ba5=[];return new Promise(function(_0xb823a1,_0x57bf11){if(!isNotNull(_0x3bf822)){_0x5bc2cd[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x7c')];return _0x57bf11(msgResponse('ifTime','Failure',_0xf9ccd7+_0x81ac('0x97')));}if(_[_0x81ac('0x4a')](_0x3bf822)){_0x5bc2cd['message']=utils[_0x81ac('0x6a')]['EMPTY_INTERVAL'];return _0x57bf11(msgResponse('ifTime',_0x81ac('0x98'),_0xf9ccd7+_0x81ac('0x99')));}if(_0x347f70&&_[_0x81ac('0x40')](config[_0x81ac('0x9a')][_0x347f70])){_0x5bc2cd['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x57bf11(msgResponse(_0x81ac('0x9b'),'Failure',_0xf9ccd7+_0x81ac('0x9c')+_0x347f70));}if(_[_0x81ac('0x9d')](_0x3bf822)){for(var _0x1096ee=0x0;_0x1096ee<_0x3bf822[_0x81ac('0x9e')];_0x1096ee+=0x1){_0x5e9ba5[_0x81ac('0x9f')](ami[_0x81ac('0xa0')]({'action':_0x81ac('0xa1'),'command':util[_0x81ac('0x8c')](_0x81ac('0xa2'),_0x3bf822[_0x1096ee][_0x81ac('0xa3')],!_[_0x81ac('0x40')](config[_0x81ac('0x9a')][_0x347f70])?_0x347f70:'')})[_0x81ac('0x3e')](function(_0x115da3){return _0x115da3['content']['indexOf']('true')>=0x0;})['catch'](myreject(_0x57bf11)));}}else{_0x5e9ba5[_0x81ac('0x9f')](ami[_0x81ac('0xa0')]({'action':_0x81ac('0xa1'),'command':util['format'](_0x81ac('0xa2'),_0x3bf822,!_[_0x81ac('0x40')](config[_0x81ac('0x9a')][_0x347f70])?_0x347f70:'')})[_0x81ac('0x3e')](function(_0x24fe4f){return _0x24fe4f[_0x81ac('0xa4')][_0x81ac('0xa5')](_0x81ac('0xa6'))>=0x0;})['catch'](myreject(_0x57bf11)));}Promise[_0x81ac('0xa7')](_0x5e9ba5)[_0x81ac('0x3e')](function(_0xb0858c){var _0x2eef08=_['some'](_0xb0858c);if(_0x2eef08){return _0xb823a1(_0x2eef08);}else{_0x5bc2cd[_0x81ac('0x70')]=_0x572897?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x81ac('0x6a')]['OVERTIME_INTERVAL'];return _0x57bf11(msgResponse('[ifTime][promiseAll]',_0x81ac('0x98'),'Global:\x20'+_0x572897+'\x20'+_0xf9ccd7+_0x81ac('0xa8')+util[_0x81ac('0x46')](_0x3bf822,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x347f70));}})[_0x81ac('0xa9')](function(_0x2e67f9){return _0x57bf11(msgResponse(_0x81ac('0x9b'),_0x81ac('0x98'),JSON[_0x81ac('0x78')](_0x2e67f9)));});});};Dialer[_0x81ac('0x18')][_0x81ac('0x3b')]=function(){var _0x47c7a1=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x81ac('0x3e')](function(){setInterval(function(){_0x47c7a1[_0x81ac('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x81ac('0xaa')]=function(){var _0x2a2e9b=this;var _0x3132ad;for(var _0x4521f2 in this[_0x81ac('0x1f')]){if(typeof this['campaigns'][_0x4521f2]!=='undefined'){_0x3132ad=this[_0x81ac('0x1f')][_0x4521f2];if(utils[_0x81ac('0x7f')](_0x3132ad)&&utils[_0x81ac('0x7d')](_0x3132ad)){_0x3132ad[_0x81ac('0x82')]=!![];Promise[_0x81ac('0xab')]()[_0x81ac('0x3e')](checkIsIVRCampaignActive(_0x3132ad))['then'](checkInterval(_0x3132ad))[_0x81ac('0x3e')](_0x2a2e9b[_0x81ac('0xac')](_0x3132ad))[_0x81ac('0x3e')](_0x2a2e9b[_0x81ac('0x94')](_0x3132ad[_0x81ac('0xad')],_0x3132ad['dialTimezone'],_0x3132ad['name'],_0x3132ad))[_0x81ac('0x3e')](_0x2a2e9b[_0x81ac('0x96')](_0x3132ad[_0x81ac('0x79')],_0x3132ad[_0x81ac('0xae')],_0x3132ad['name'],_0x3132ad))[_0x81ac('0x3e')](_0x2a2e9b[_0x81ac('0xaf')](_0x3132ad))[_0x81ac('0xa9')](loggerCatchQueueSummary('[syncCampaigns]',_0x3132ad));}else{notSendMessagesCampaign(_0x3132ad);}}}};Dialer[_0x81ac('0x18')][_0x81ac('0xb0')]=function(_0x19b8e8){if(_0x19b8e8[_0x81ac('0xb1')]!==_0x81ac('0xb2')){clearPredictiveAttributes(_0x19b8e8);}switch(_0x19b8e8[_0x81ac('0xb1')]){case _0x81ac('0xb3'):this[_0x81ac('0xb4')](_0x19b8e8,0x1);break;case _0x81ac('0xb5'):this[_0x81ac('0xb4')](_0x19b8e8,_0x19b8e8[_0x81ac('0xb6')]);break;case'predictive':this[_0x81ac('0xb2')](_0x19b8e8);break;case _0x81ac('0x8'):this[_0x81ac('0xb4')](_0x19b8e8,0x1);break;default:logger[_0x81ac('0x66')](_0x81ac('0xb7'),_0x19b8e8[_0x81ac('0x48')],_0x81ac('0xb8'));}};Dialer[_0x81ac('0x18')]['ifTime']=function(_0x31b68e,_0x5a4650){var _0x35c0d8=_0x31b68e[_0x81ac('0xae')];var _0x1e1b43=_0x5a4650?_0x31b68e[_0x81ac('0xad')]:_0x31b68e['Interval'][_0x81ac('0x7b')];logger['silly'](_0x81ac('0xb9'),_0x1e1b43,_0x35c0d8,_0x31b68e[_0x81ac('0x48')],util[_0x81ac('0x8c')](_0x81ac('0xba'),_0x31b68e[_0x81ac('0x48')],_0x31b68e['id']));var _0xcb32e5=null;return Interval[_0x81ac('0xbb')](_0x1e1b43,_0x35c0d8)[_0x81ac('0x3e')](function(_0x541a97){if(_0x541a97===!![]){return _0x541a97;}else{_0x31b68e['message']=_0x5a4650?utils[_0x81ac('0x6a')][_0x81ac('0xbc')]:utils[_0x81ac('0x6a')][_0x81ac('0xbd')];_0xcb32e5=msgResponse(_0x81ac('0xbe'),_0x81ac('0x98'),_0x81ac('0xbf')+_0x5a4650+'\x20'+_0x31b68e['name']+_0x81ac('0xa8')+util[_0x81ac('0x46')](_0x1e1b43,{'showHidden':![],'depth':null})+_0x81ac('0xc0')+_0x35c0d8);}if(_0xcb32e5!==null){logger[_0x81ac('0xc1')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0xcb32e5);_0xcb32e5[_0x81ac('0xc2')]=_0x5a4650;throw _0xcb32e5;}})[_0x81ac('0xa9')](function(_0x316ca7){logger['error'](_0x81ac('0xc3'),_0x316ca7);throw msgResponse(_0x81ac('0x88'),'Error',util['inspect'](_0x316ca7,{'showHidden':![],'depth':null}));});};Dialer[_0x81ac('0x18')]['syncAgentConnect']=function(_0x5a7787){if(this[_0x81ac('0x1e')][_0x5a7787['queue']]){if(this['uniqueId'][_0x5a7787[_0x81ac('0xc4')]]&&this[_0x81ac('0xc5')][_0x5a7787[_0x81ac('0xc4')]][_0x81ac('0x42')]!==_0x81ac('0xc6')){this[_0x81ac('0xc7')](this[_0x81ac('0x1e')][_0x5a7787[_0x81ac('0xc8')]]);this[_0x81ac('0xc5')][_0x5a7787[_0x81ac('0xc4')]][_0x81ac('0xc9')]=moment()['format'](_0x81ac('0xca'));}}};Dialer[_0x81ac('0x18')][_0x81ac('0x31')]=function(_0x2a3949){var _0x528314=this[_0x81ac('0xc5')][_0x2a3949[_0x81ac('0xc4')]];if(this['voiceQueues'][_0x2a3949[_0x81ac('0xc8')]]){if(_0x528314&&_0x528314[_0x81ac('0x42')]!=='ivr'){delete this[_0x81ac('0xc5')][_0x2a3949[_0x81ac('0xc4')]];this[_0x81ac('0x1e')][_0x2a3949[_0x81ac('0xc8')]][_0x81ac('0xcb')]+=0x1;var _0x3208b0=new AgentComplete(_0x528314,_0x2a3949);if(_0x2a3949[_0x81ac('0xcc')]===_0x81ac('0xcd')){_0x3208b0[_0x81ac('0xce')]=this[_0x81ac('0x1e')][_0x2a3949[_0x81ac('0xc8')]][_0x81ac('0xcf')]&&this[_0x81ac('0x1e')][_0x2a3949[_0x81ac('0xc8')]][_0x81ac('0xd0')]?moment()['format'](_0x81ac('0xca')):undefined;}hopperUtils[_0x81ac('0xd1')](_0x3208b0)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xd2')));hopperUtils[_0x81ac('0xd3')](_0x3208b0)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xd4')));}}};Dialer[_0x81ac('0x18')][_0x81ac('0x2d')]=function(_0xfeb31a){var _0x4f3ac6=this['uniqueId'][_0xfeb31a[_0x81ac('0xc4')]];var _0xa16e67=this;var _0x534ede=![];var _0x5d303e;var _0x61f62a;if(this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]){if(_0x4f3ac6&&_0x4f3ac6[_0x81ac('0x42')]!==_0x81ac('0xc6')){delete this[_0x81ac('0xc5')][_0xfeb31a[_0x81ac('0xc4')]];this['updateOriginated'](this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]);_0x4f3ac6[_0x81ac('0xd5')]=moment()[_0x81ac('0x8c')](_0x81ac('0xca'));var _0x460e2f=new QueueCallerAbandon(_0x4f3ac6,_0xfeb31a);if(utils[_0x81ac('0x62')](_0x4f3ac6[_0x81ac('0xd5')],_0x4f3ac6[_0x81ac('0xd6')])>=_0x4f3ac6['dialQueueTimeout']){this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xd7')]+=0x1;_0x460e2f[_0x81ac('0x71')]=0xa;_0x460e2f[_0x81ac('0x72')]='Drop';_0x460e2f[_0x81ac('0xd8')]=_0x81ac('0xd9');_0x460e2f[_0x81ac('0xce')]=this['voiceQueues'][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xcf')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x460e2f[_0x81ac('0xda')]+=0x1;_0x460e2f[_0x81ac('0xdb')]+=0x1;_0x5d303e=this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xdc')];_0x61f62a=this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x460e2f,_0x460e2f[_0x81ac('0x71')],_0x4f3ac6[_0x81ac('0xdd')])[_0x81ac('0x3e')](function(_0x2f9a93){_0x534ede=_0x2f9a93[_0x81ac('0xde')]==0x1;if(_0x460e2f[_0x81ac('0xda')]>=_0xa16e67['voiceQueues'][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xdf')]){_0xa16e67[_0x81ac('0xe0')](_0x460e2f,_0x2f9a93[_0x81ac('0xde')]);}else{hopperUtils[_0x81ac('0xe1')]({'active':![],'countdropretry':_0x460e2f['countdropretry'],'scheduledat':moment()[_0x81ac('0xe2')](_0xa16e67[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]]['dialDropRetryFrequency'],_0x81ac('0xe3'))[_0x81ac('0x8c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f3ac6[_0x81ac('0xe4')],'ListId':_0x4f3ac6['ListId'],'VoiceQueueId':_0x4f3ac6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x4f3ac6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xe7')));var _0x2af7bd=new History(_0x460e2f);_0x2af7bd[_0x81ac('0x71')]=0xa;_0x2af7bd[_0x81ac('0x72')]=_0x81ac('0xe8');_0x2af7bd[_0x81ac('0x74')]=moment()[_0x81ac('0x8c')](_0x81ac('0xca'));_0x2af7bd[_0x81ac('0x73')]=_0x2af7bd[_0x81ac('0x74')];_0x2af7bd[_0x81ac('0xe9')]=_0x460e2f[_0x81ac('0xe9')];_0x2af7bd[_0x81ac('0xea')]=_0x460e2f['calleridnum'];hopperUtils['createHistory'](_0x2af7bd)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xeb')));}})[_0x81ac('0x3e')](function(){if(_0x534ede)hopperUtils['swapAdditionalPhones'](_0x460e2f,_0x5d303e,_0x61f62a)['then'](function(){return 0x1;});});}else{this[_0x81ac('0x1e')][_0xfeb31a['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xec')]+=0x1;_0x460e2f['state']=0xb;_0x460e2f['statedesc']=_0x81ac('0xed');_0x460e2f['dropreason']=_0x81ac('0xee');_0x460e2f[_0x81ac('0xef')]+=0x1;_0x460e2f['countglobal']+=0x1;_0x5d303e=this['voiceQueues'][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xf0')];_0x61f62a=this[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xf1')];hopperUtils['verifyAdditionalPhones'](_0x460e2f,_0x460e2f[_0x81ac('0x71')],_0x4f3ac6[_0x81ac('0xdd')])['then'](function(_0x52bd72){if(_0x460e2f[_0x81ac('0xef')]>=_0xa16e67[_0x81ac('0x1e')][_0xfeb31a[_0x81ac('0xc8')]][_0x81ac('0xf2')]){_0xa16e67[_0x81ac('0xe0')](_0x460e2f,_0x52bd72[_0x81ac('0xde')]);}else{hopperUtils[_0x81ac('0xe1')]({'active':![],'countabandonedretry':_0x460e2f[_0x81ac('0xef')],'scheduledat':moment()[_0x81ac('0xe2')](_0xa16e67[_0x81ac('0x1e')][_0xfeb31a['queue']]['dialAbandonedRetryFrequency'],_0x81ac('0xe3'))[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x4f3ac6[_0x81ac('0xe4')],'ListId':_0x4f3ac6[_0x81ac('0xf3')],'VoiceQueueId':_0x4f3ac6['VoiceQueueId']||undefined,'CampaignId':_0x4f3ac6[_0x81ac('0xe6')]||undefined})['catch'](loggerCatch(_0x81ac('0xf4')));var _0x34a1a1=new History(_0x460e2f);_0x34a1a1[_0x81ac('0x71')]=0xb;_0x34a1a1['statedesc']=_0x81ac('0xed');_0x34a1a1[_0x81ac('0x74')]=moment()[_0x81ac('0x8c')]('YYYY-MM-DD\x20HH:mm:ss');_0x34a1a1[_0x81ac('0x73')]=_0x34a1a1[_0x81ac('0x74')];_0x34a1a1[_0x81ac('0xe9')]=_0x460e2f[_0x81ac('0xe9')];_0x34a1a1[_0x81ac('0xea')]=_0x460e2f['calleridnum'];hopperUtils[_0x81ac('0xd1')](_0x34a1a1)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xf5')));}})['then'](function(){if(_0x534ede)hopperUtils[_0x81ac('0xf6')](_0x460e2f,_0x5d303e,_0x61f62a)[_0x81ac('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x81ac('0x36')]=function(_0x10159d){if(this['actions'][_0x10159d['uniqueid']]){this[_0x81ac('0x24')][_0x10159d[_0x81ac('0xc4')]]['channel']=_0x10159d[_0x81ac('0xf7')];}if(this[_0x81ac('0xc5')][_0x10159d[_0x81ac('0xc4')]]){this['uniqueId'][_0x10159d[_0x81ac('0xc4')]]['channel']=_0x10159d[_0x81ac('0xf7')];}};Dialer[_0x81ac('0x18')]['syncQueueMember']=function(_0x314b23){if(!this[_0x81ac('0x24')][_0x314b23['actionid']]){return;}var _0x4be1b1=this[_0x81ac('0x1e')][this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xc8')]][_0x81ac('0xf9')]||_0x81ac('0xfa');if(_0x4be1b1===_0x81ac('0xfb')){if(this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]]&&_[_0x81ac('0xfc')](this[_0x81ac('0x24')][_0x314b23['actionid']][_0x81ac('0xfd')])&&_0x314b23[_0x81ac('0x8e')]==='1'&&_0x314b23[_0x81ac('0xfe')]==='0'){if(this[_0x81ac('0x20')][_0x314b23[_0x81ac('0xff')]]){if(!this[_0x81ac('0x20')][_0x314b23['stateinterface']]['locked']){this[_0x81ac('0x20')][_0x314b23['stateinterface']][_0x81ac('0xfd')]=!![];this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]]['locked']=!![];this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xff')]=_0x314b23[_0x81ac('0xff')];}}}}else if(_0x4be1b1==='rrmemory'){if(this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]]){if(this['agents'][_0x314b23['stateinterface']]){this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xff')]=_0x314b23[_0x81ac('0xff')];if(_[_0x81ac('0xfc')](this[_0x81ac('0x100')][this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xc8')]])){this[_0x81ac('0x100')][this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xc8')]]=[];}this['queueBooked'][this[_0x81ac('0x24')][_0x314b23[_0x81ac('0xf8')]][_0x81ac('0xc8')]][_0x81ac('0x9f')](_[_0x81ac('0x61')](_[_0x81ac('0x101')](this[_0x81ac('0x24')][_0x314b23['actionid']],[_0x81ac('0x102'),_0x81ac('0xff')]),{'status':_0x314b23[_0x81ac('0x8e')],'paused':_0x314b23[_0x81ac('0xfe')]}));}}}};Dialer[_0x81ac('0x18')]['syncQueueStatusComplete']=function(_0x17af83){if(!this[_0x81ac('0x24')][_0x17af83['actionid']]){return;}var _0x56cf93=this;var _0x1a1c30=this[_0x81ac('0x1e')][this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]['queue']];var _0x21a964=_0x1a1c30[_0x81ac('0xf9')]||_0x81ac('0xfa');if(_0x21a964==='roundrobin'){if(this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]&&this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xff')]){this[_0x81ac('0x1d')]['run'](this['actions'][_0x17af83['actionid']][_0x81ac('0x102')],this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]['stateinterface'])[_0x81ac('0xa9')](function(_0x42919b){logger[_0x81ac('0x66')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x42919b,{'showHidden':![],'depth':null}));})[_0x81ac('0x1b')](function(){_0x56cf93[_0x81ac('0xc7')](_0x56cf93[_0x81ac('0x1e')][_0x56cf93['actions'][_0x17af83['actionid']][_0x81ac('0xc8')]]);_0x56cf93[_0x81ac('0x20')][_0x56cf93['actions'][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xff')]]['locked']=![];delete _0x56cf93[_0x81ac('0x24')][_0x17af83['actionid']];unlockQueueStatus(_0x1a1c30);});}else{this[_0x81ac('0xc7')](this['voiceQueues'][this['actions'][_0x17af83['actionid']]['queue']]);hopperUtils[_0x81ac('0xe1')]({'active':![],'ContactId':this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xe4')],'ListId':this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]['ListId'],'VoiceQueueId':this['actions'][_0x17af83[_0x81ac('0xf8')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]['CampaignId']||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x103')));delete this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]];unlockQueueStatus(_0x1a1c30);}}else if(_0x21a964===_0x81ac('0xfa')){var _0x3e877c;if(this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]&&!_[_0x81ac('0x4a')](this[_0x81ac('0x100')][this['actions'][_0x17af83[_0x81ac('0xf8')]]['queue']])){if(this['queueBookedRR'][_0x56cf93[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]]){this[_0x81ac('0x2a')][_0x56cf93['actions'][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]]=this['queueBookedRR'][this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]]['queue']]?this[_0x81ac('0x2a')][this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]]:this[_0x81ac('0x100')][this['actions'][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]]?this['queueBooked'][this[_0x81ac('0x24')][_0x17af83['actionid']][_0x81ac('0xc8')]]['_rr']||0x0:0x0;}this[_0x81ac('0x100')][this['actions'][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]]['_rr']=this[_0x81ac('0x2a')][this[_0x81ac('0x24')][_0x17af83[_0x81ac('0xf8')]][_0x81ac('0xc8')]];for(var _0x1dd3bb=0x0;_0x1dd3bb=_0xf1dfe9[_0x81ac('0x12d')]){_0x3e49e1[_0x81ac('0x12e')](_0x449f24,_0x44c459,_0x1a6283,_0x81ac('0x12f'));}else{if(_0x449f24['countmachineretry']>=_0xf1dfe9[_0x81ac('0x130')]){_0x3e49e1['createStateFinal'](_0x449f24,_0x44c459,_0x1a6283,'reason\x2019\x20machine....');}else{hopperUtils[_0x81ac('0xe1')]({'active':![],'countmachineretry':_0x449f24['countmachineretry'],'scheduledat':moment()[_0x81ac('0xe2')](_0xf1dfe9[_0x81ac('0x131')],'minutes')[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x449f24['ContactId'],'ListId':_0x449f24[_0x81ac('0xf3')],'VoiceQueueId':_0x449f24[_0x81ac('0xe5')]||undefined,'CampaignId':_0x449f24[_0x81ac('0xe6')]||undefined})['catch'](loggerCatch(_0x81ac('0x132')));_0x44c459({'reschedule':0x1});}}});}if(_0x2d60b0[_0x81ac('0x42')]===_0x81ac('0xc6')&&this[_0x81ac('0x1f')][_0x2d60b0['queue']][_0x81ac('0x119')]&&_0x2145c8[_0x81ac('0x11a')]===_0x81ac('0x11b')){delete this[_0x81ac('0xc5')][_0x2145c8[_0x81ac('0xc4')]];this[_0x81ac('0xc7')](this['campaigns'][_0x2d60b0[_0x81ac('0xc8')]]);_0x5bdec4=new Hangup(_0x2d60b0,_0x2145c8);_0x5bdec4['state']=0x12;_0x5bdec4[_0x81ac('0x72')]=_0x81ac('0x11d');_0x5bdec4[_0x81ac('0x11e')]=_0x81ac('0x11f');ami[_0x81ac('0x41')]('custom:amd',ut[_0x81ac('0x121')](_0x5bdec4,_0x81ac('0x122')));this[_0x81ac('0x123')](_0x5bdec4,'[syncHangupInAMDIvr][createHistory]',_0x81ac('0x133'));}if(_0x2d60b0[_0x81ac('0x42')]===_0x81ac('0xc6')&&this[_0x81ac('0x1f')][_0x2d60b0[_0x81ac('0xc8')]][_0x81ac('0x119')]&&_0x2145c8[_0x81ac('0x11a')]==='MACHINE'){return new Promise(function(_0x11282f,_0x45266a){delete _0x3e49e1['uniqueId'][_0x2145c8[_0x81ac('0xc4')]];_0x3e49e1[_0x81ac('0xc7')](_0x3e49e1['campaigns'][_0x2d60b0[_0x81ac('0xc8')]]);_0x3e49e1['campaigns'][_0x2d60b0[_0x81ac('0xc8')]][_0x81ac('0xcb')]+=0x1;_0x3e49e1[_0x81ac('0x1f')][_0x2d60b0['queue']][_0x81ac('0x11c')]+=0x1;var _0x1fc1b3=_0x3e49e1[_0x81ac('0x1f')][_0x2d60b0[_0x81ac('0xc8')]];var _0x15da1a=new Hangup(_0x2d60b0,_0x2145c8);_0x15da1a[_0x81ac('0x71')]=0x13;_0x15da1a[_0x81ac('0x72')]='Machine';_0x15da1a[_0x81ac('0x11e')]=_0x81ac('0x11f');_0x15da1a[_0x81ac('0x126')]+=0x1;_0x15da1a[_0x81ac('0xdb')]+=0x1;_0x15da1a['amd']=!![];ami[_0x81ac('0x41')](_0x81ac('0x120'),ut[_0x81ac('0x121')](_0x15da1a,_0x81ac('0x122')));hopperUtils['createHistory'](_0x15da1a)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x127')));if(_0x15da1a['countbusyretry']+_0x15da1a[_0x81ac('0x129')]+_0x15da1a[_0x81ac('0x12a')]+_0x15da1a['countnosuchnumberretry']+_0x15da1a[_0x81ac('0xda')]+_0x15da1a[_0x81ac('0xef')]+_0x15da1a[_0x81ac('0x126')]+_0x15da1a[_0x81ac('0x12c')]>=_0x1fc1b3['dialGlobalMaxRetry']){_0x3e49e1['stateGlobal'](_0x15da1a,_0x11282f,_0x45266a,_0x81ac('0x12f'));}else{if(_0x15da1a[_0x81ac('0x126')]>=_0x1fc1b3['dialMachineMaxRetry']){_0x3e49e1[_0x81ac('0x134')](_0x15da1a,_0x11282f,_0x45266a,'reason\x2019\x20machine....');}else{hopperUtils[_0x81ac('0xe1')]({'active':![],'countmachineretry':_0x15da1a[_0x81ac('0x126')],'scheduledat':moment()[_0x81ac('0xe2')](_0x1fc1b3[_0x81ac('0x131')],_0x81ac('0xe3'))['format'](_0x81ac('0xca')),'ContactId':_0x15da1a['ContactId'],'ListId':_0x15da1a['ListId'],'VoiceQueueId':_0x15da1a[_0x81ac('0xe5')]||undefined,'CampaignId':_0x15da1a['CampaignId']||undefined})[_0x81ac('0xa9')](loggerCatch('[rescheduleContact][Machine]'));_0x11282f({'reschedule':0x1});}}});}}};Dialer[_0x81ac('0x18')][_0x81ac('0x35')]=function(_0x28f93a){var _0x488972=this[_0x81ac('0xc5')][_0x28f93a[_0x81ac('0xc4')]];var _0x91f46e;if(_0x488972&&_0x488972[_0x81ac('0x42')]===_0x81ac('0xc6')){delete this['uniqueId'][_0x28f93a['uniqueid']];this[_0x81ac('0xc7')](this[_0x81ac('0x1f')][_0x488972['queue']]);this['campaigns'][_0x488972['queue']][_0x81ac('0x135')]+=0x1;_0x91f46e=new Hangup(_0x488972,_0x28f93a);hopperUtils[_0x81ac('0xd1')](_0x91f46e)[_0x81ac('0xa9')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x91f46e)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x488972&&_0x488972[_0x81ac('0x42')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x488972[_0x81ac('0xc8')]][_0x81ac('0x136')])){delete this[_0x81ac('0xc5')][_0x28f93a['uniqueid']];this[_0x81ac('0xc7')](this[_0x81ac('0x1e')][_0x488972[_0x81ac('0xc8')]]);this['voiceQueues'][_0x488972[_0x81ac('0xc8')]][_0x81ac('0xcb')]+=0x1;this[_0x81ac('0x1e')][_0x488972[_0x81ac('0xc8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x91f46e=new Hangup(_0x488972,_0x28f93a);_0x91f46e['state']=0x10;_0x91f46e['statedesc']=_0x81ac('0x137');_0x91f46e[_0x81ac('0x11e')]='AGI';hopperUtils[_0x81ac('0xd1')](_0x91f46e)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x138')));hopperUtils[_0x81ac('0xd3')](_0x91f46e)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x139')));}if(_0x488972&&_0x488972['type']!==_0x81ac('0xc6')&&!isNotNull(this[_0x81ac('0x1e')][_0x488972['queue']][_0x81ac('0x136')])){delete this[_0x81ac('0xc5')][_0x28f93a['uniqueid']];this[_0x81ac('0xc7')](this[_0x81ac('0x1e')][_0x488972[_0x81ac('0xc8')]]);this['voiceQueues'][_0x488972[_0x81ac('0xc8')]][_0x81ac('0x13a')]+=0x1;_0x91f46e=new Hangup(_0x488972,_0x28f93a);_0x91f46e[_0x81ac('0x71')]=0xc;_0x91f46e[_0x81ac('0x72')]=_0x28f93a[_0x81ac('0x13b')];_0x91f46e[_0x81ac('0x11e')]=_0x81ac('0x13c');hopperUtils['createHistory'](_0x91f46e)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x138')));hopperUtils[_0x81ac('0xd3')](_0x91f46e)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x139')));}};Dialer[_0x81ac('0x18')]['syncQueueSummary']=function(_0x1270d3){var _0x493100=this;if(!_0x493100[_0x81ac('0x2b')][_0x1270d3[_0x81ac('0x48')]]){_0x493100['queuesSummary'][_0x1270d3[_0x81ac('0x48')]]={'running':![]};}else if(_0x493100[_0x81ac('0x2b')][_0x1270d3['name']]['running']===!![]){return;}else if(_0x493100[_0x81ac('0x2b')][_0x1270d3[_0x81ac('0x48')]]['running']===![]){_0x493100[_0x81ac('0x2b')][_0x1270d3[_0x81ac('0x48')]][_0x81ac('0x13d')]=!![];}var _0xc6ded5=_0x493100[_0x81ac('0x1e')][_0x1270d3[_0x81ac('0x48')]];var _0x4550c1=_0xc6ded5['message']!==utils['CAMPAIGN_STATUS'][_0x81ac('0x7e')];var _0x4509a6=utils['isPreviewCampaign'](_0xc6ded5);_0xc6ded5['statusMessage']=utils['getQueueCampaignStatusMessage'](_0xc6ded5,_0x493100[_0x81ac('0x21')]);Promise[_0x81ac('0xab')]()[_0x81ac('0x3e')](function(){if(_0xc6ded5[_0x81ac('0x13e')]===utils[_0x81ac('0x6a')][_0x81ac('0x7e')]){if(_0x4550c1){clearPredictiveAttributes(_0xc6ded5);_0x1270d3['startPredictive']=undefined;_0x1270d3['startProgressive']=undefined;}if(_0xc6ded5[_0x81ac('0x13e')]===utils[_0x81ac('0x6a')]['INACTIVE']){_0x1270d3[_0x81ac('0x13f')]=0x0;_0x1270d3[_0x81ac('0xfe')]=0x0;_0x1270d3['inUse']=0x0;_0x1270d3[_0x81ac('0x140')]=0x0;_0x1270d3[_0x81ac('0x141')]=0x0;}}else if(_0xc6ded5['statusMessage']===utils['CAMPAIGN_STATUS'][_0x81ac('0x142')]&&!_0x4509a6){return _0x493100['ifTime'](_0xc6ded5,!![])[_0x81ac('0x3e')](function(){return _0x493100['ifTime'](_0xc6ded5,![]);})[_0x81ac('0x3e')](function(){return _0x493100['checkDialMethod'](_0xc6ded5);})['catch'](function(_0x5b9833){loggerSyncQueueSummary[_0x81ac('0x44')](_0x81ac('0x143'),util[_0x81ac('0x46')](_0x5b9833,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xc6ded5);});}else{clearPredictiveAttributes(_0xc6ded5);}})['then'](function(){var _0x31d8f7=_0x1270d3['compareToOutboundQueue'](_0xc6ded5);if(_0x31d8f7||_0xc6ded5['queueSummaryCountersUpdated']){_0xc6ded5[_0x81ac('0x144')]=![];_0x1270d3['updateReportFromOutboundQueue'](_0xc6ded5);Object[_0x81ac('0x145')](_0xc6ded5,_0x1270d3);emitOutboundVoiceQueueSummary(_0x1270d3);}_0x493100['queuesSummary'][_0xc6ded5[_0x81ac('0x48')]][_0x81ac('0x13d')]=![];})[_0x81ac('0xa9')](function(_0x6c21d5){logger[_0x81ac('0x66')](_0x81ac('0x143'),util[_0x81ac('0x46')](_0x6c21d5,{'showHidden':![],'depth':null}));_0x493100[_0x81ac('0x2b')][_0xc6ded5[_0x81ac('0x48')]]['running']=![];});};Dialer[_0x81ac('0x18')][_0x81ac('0x33')]=_[_0x81ac('0x146')](function(){var _0x33c036=_[_0x81ac('0x147')](this[_0x81ac('0x1e')],function(_0x37c32d){return _0x37c32d[_0x81ac('0x148')];});var _0x5cbbd0=_[_0x81ac('0x147')](this[_0x81ac('0x20')],function(_0x4372b1){return _0x4372b1[_0x81ac('0x149')]&&_0x4372b1[_0x81ac('0x8e')]==='reachable';});if(_0x33c036[_0x81ac('0x9e')]>0x0&&_0x5cbbd0[_0x81ac('0x9e')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x81ac('0x14a')](_[_0x81ac('0x14b')](_0x33c036,'id'),previewRecallmeReminderInterval,_['map'](_0x5cbbd0,'id')))[_0x81ac('0x3e')](function(_0x354b8c){for(var _0x3549ab=0x0;_0x3549ab<_0x354b8c[_0x81ac('0x9e')];_0x3549ab++){var _0x368bb3=_0x354b8c[_0x3549ab]['Agent'][_0x81ac('0x48')];if(_0x368bb3)io['to'](util['format']('user:%s',_0x368bb3))[_0x81ac('0x41')](_0x81ac('0x14c'),{'hopper':_0x354b8c[_0x3549ab]});}})[_0x81ac('0xa9')](function(_0x1e2b46){logger['error'](_0x81ac('0x14d'),_0x1e2b46);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x81ac('0x18')][_0x81ac('0x3c')]=function(){var _0x38653a=this;setInterval(function(){_0x38653a['clearZombieChannels'](_0x38653a[_0x81ac('0xc5')],_0x81ac('0x14e'));_0x38653a['clearZombieChannels'](_0x38653a[_0x81ac('0x24')],_0x81ac('0x14f'));},0x32c8);};Dialer[_0x81ac('0x18')][_0x81ac('0x150')]=function(_0x325495,_0x55e381){var _0x4807af=this;for(var _0x5ac00b in _0x325495){if(typeof _0x325495[_0x5ac00b]!==_0x81ac('0x151')){this[_0x81ac('0x1c')][_0x81ac('0x19')](function(){if(!_['isNil'](_0x325495[_0x5ac00b])){return ami[_0x81ac('0xa0')]({'action':_0x81ac('0x8e'),'channel':_0x325495[_0x5ac00b][_0x81ac('0xf7')]})['catch'](function(_0x57399f){if(_0x57399f[_0x81ac('0x70')]===_0x81ac('0x152')){setTimeout(function(){if(_0x325495[_0x5ac00b]&&_0x325495[_0x5ac00b][_0x81ac('0x42')]!==_0x81ac('0xc6')){_0x4807af[_0x81ac('0xc7')](_0x4807af[_0x81ac('0x1e')][_0x325495[_0x5ac00b]['queue']]);logger['error'](_0x81ac('0x153'),_0x55e381,_0x5ac00b,_0x325495[_0x5ac00b][_0x81ac('0xc8')]);delete _0x325495[_0x5ac00b];}if(_0x325495[_0x5ac00b]&&_0x325495[_0x5ac00b][_0x81ac('0x42')]===_0x81ac('0xc6')){_0x4807af[_0x81ac('0xc7')](_0x4807af[_0x81ac('0x1f')][_0x325495[_0x5ac00b][_0x81ac('0xc8')]]);logger[_0x81ac('0x66')](_0x81ac('0x154'),_0x55e381,_0x5ac00b,_0x325495[_0x5ac00b][_0x81ac('0xc8')]);delete _0x325495[_0x5ac00b];}},0x2328);}});}});}}};Dialer[_0x81ac('0x18')][_0x81ac('0x155')]=function(_0xd8ab29){return Promise[_0x81ac('0xab')]()[_0x81ac('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0xd8ab29))[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x156')));};Dialer[_0x81ac('0x18')]['updateOriginated']=function(_0x413720){if(!_[_0x81ac('0x40')](_0x413720)&&_0x413720!==null){if(typeof _0x413720[_0x81ac('0x83')]!==_0x81ac('0x151')){if(_0x413720['originated']>0x0){_0x413720['originated']-=0x1;}else{logger[_0x81ac('0x66')](_0x81ac('0x157'));}}}else{logger[_0x81ac('0x66')](_0x81ac('0x158'));}};Dialer[_0x81ac('0x18')][_0x81ac('0x159')]=function(_0x419c26,_0x1f59a7){var _0x5cc3bb=this;return function(_0x5afee3){_0x5cc3bb[_0x81ac('0xc7')](_0x1f59a7);logger[_0x81ac('0x66')](_0x419c26,util[_0x81ac('0x46')](_0x5afee3,{'showHidden':![],'depth':null}));};};Dialer[_0x81ac('0x18')][_0x81ac('0x15a')]=function(_0x3823cc,_0x386d47,_0x48d9fe){var _0x5cefb8={'state':0x19,'statedesc':_0x81ac('0x15b')};this['updateOriginated'](_0x386d47);this[_0x81ac('0x123')](_[_0x81ac('0x61')](_0x5cefb8,_[_0x81ac('0x101')](_0x48d9fe,[_0x81ac('0xe4'),_0x81ac('0xf3'),'UserId',_0x81ac('0xe5'),_0x81ac('0xe6')])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x81ac('0x66')](_0x3823cc);};Dialer[_0x81ac('0x18')]['saveInDb']=function(_0xf78df2,_0x48383a,_0x14f23f){hopperUtils[_0x81ac('0xd1')](_0xf78df2)['catch'](loggerCatch(_0x48383a));hopperUtils[_0x81ac('0xd3')](_0xf78df2)[_0x81ac('0xa9')](loggerCatch(_0x14f23f));};Dialer[_0x81ac('0x18')][_0x81ac('0xe0')]=function(_0x2c5d78,_0x4fa2e8){hopperUtils['createHistory'](_0x2c5d78)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xd2')));if(_0x4fa2e8==0x0){hopperUtils['moveContactManagedDialer'](_0x2c5d78)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x15c')));}};Dialer[_0x81ac('0x18')][_0x81ac('0x14d')]=function(_0x412dae){return Promise['resolve']()[_0x81ac('0x3e')](cmHopper[_0x81ac('0x14a')](_0x412dae['id'],previewRecallmeReminderInterval))[_0x81ac('0x3e')](function(_0x17c726){for(var _0x221ba0=0x0;_0x221ba0<_0x17c726[_0x81ac('0x9e')];_0x221ba0++){var _0x18ef8c=_0x17c726[_0x221ba0][_0x81ac('0x15d')][_0x81ac('0x48')];if(_0x18ef8c)io['to'](util[_0x81ac('0x8c')](_0x81ac('0x15e'),_0x18ef8c))[_0x81ac('0x41')](_0x81ac('0x14c'),{'hopper':_0x17c726[_0x221ba0]});}})[_0x81ac('0xa9')](function(){});};Dialer[_0x81ac('0x18')][_0x81ac('0xaf')]=function(_0xf46ecb){var _0x3217b1=this;return function(){_0x3217b1['handleIvr'](_0xf46ecb);};};Dialer[_0x81ac('0x18')][_0x81ac('0x15f')]=function(_0x2bf544,_0x12ba45){var _0x474aa7=this;var _0x1a3f3f=uuid['v4']();this[_0x81ac('0x24')][_0x1a3f3f]=new Action(_0x2bf544,_0x12ba45,_0x1a3f3f);return new Promise(function(_0xca3753,_0x4956e4){if(_[_0x81ac('0x40')](_0x2bf544)&&typeof _0x2bf544!==_0x81ac('0x160')){return _0x4956e4(msgResponse(_0x81ac('0x161'),_0x81ac('0x98'),_0x81ac('0x162')));}if(_['isUndefined'](_0x12ba45['phone'])||_0x12ba45[_0x81ac('0x163')]===null){return _0x4956e4(msgResponse(_0x81ac('0x161'),_0x81ac('0x98'),_0x81ac('0x164')));}var _0x5d8f29={'XMD-CALLERID':_0x474aa7[_0x81ac('0x24')][_0x1a3f3f][_0x81ac('0x165')](),'XMD-AGI':_0x2bf544['dialQueueProject']?util[_0x81ac('0x8c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2bf544['dialQueueProject']):_0x81ac('0x166'),'XMD-AGIAFTER':_0x2bf544[_0x81ac('0xcf')]?util['format'](_0x81ac('0x167'),ipAgi,_0x2bf544[_0x81ac('0xcf')]):'NONE','XMD-QUEUE':utils[_0x81ac('0x168')](_0x2bf544)?util[_0x81ac('0x8c')](_0x81ac('0x169'),_0x2bf544[_0x81ac('0x48')],_0x2bf544['dialQueueOptions']||'',_0x2bf544['dialAgiAfterHangupAgent']?'c':'',_0x2bf544['dialQueueTimeout']||0x3):_0x81ac('0x166'),'XMD-CONTACTID':_0x12ba45[_0x81ac('0xe4')],'XMD-CDRTYPE':_0x81ac('0x7'),'CALLERID(all)':_0x474aa7[_0x81ac('0x24')][_0x1a3f3f][_0x81ac('0x165')](),'XMD-AMD':_0x2bf544[_0x81ac('0x119')]?_0x81ac('0x142'):'NONE','XMD-DESTINATION':_0x81ac('0x118')};if(_0x2bf544[_0x81ac('0x119')]){_0x5d8f29[_0x81ac('0x16a')]=_0x2bf544[_0x81ac('0x16b')]||0x9c4;_0x5d8f29[_0x81ac('0x16c')]=_0x2bf544['dialAMDGreeting']||0x5dc;_0x5d8f29[_0x81ac('0x16d')]=_0x2bf544[_0x81ac('0x16e')]||0x320;_0x5d8f29['XMD-AMDTOTALANALYSISTIME']=_0x2bf544[_0x81ac('0x16f')]||0x1388;_0x5d8f29[_0x81ac('0x170')]=_0x2bf544[_0x81ac('0x171')]||0x64;_0x5d8f29[_0x81ac('0x172')]=_0x2bf544[_0x81ac('0x173')]||0x32;_0x5d8f29[_0x81ac('0x174')]=_0x2bf544[_0x81ac('0x175')]||0x3;_0x5d8f29[_0x81ac('0x176')]=_0x2bf544[_0x81ac('0x177')]||0x100;_0x5d8f29[_0x81ac('0x178')]=_0x2bf544[_0x81ac('0x179')]||0x1388;}if(utils['isOutboundQueue'](_0x2bf544)){_0x5d8f29[_0x81ac('0x17a')]=_0x12ba45['VoiceQueueId'];}else{_0x5d8f29[_0x81ac('0x17b')]=_0x12ba45[_0x81ac('0xe6')];}var _0x3c0d72=utils[_0x81ac('0x17c')](_0x12ba45[_0x81ac('0x17d')]);Object[_0x81ac('0x145')](_0x5d8f29,_0x3c0d72);var _0x1f2396=_0x474aa7[_0x81ac('0x8a')](_0x2bf544[_0x81ac('0x90')])?utils[_0x81ac('0x17e')](_0x2bf544['Trunk']['callerid'],_0x2bf544[_0x81ac('0x17f')],_0x2bf544[_0x81ac('0x180')]>0x0?utils[_0x81ac('0x181')](_0x2bf544[_0x81ac('0x182')],_0x2bf544[_0x81ac('0x180')]):_0x2bf544['dialOriginateCallerIdNumber']):utils[_0x81ac('0x17e')](_[_0x81ac('0xfc')](_0x2bf544['TrunkBackup'])?_0x2bf544['Trunk'][_0x81ac('0x183')]:_0x2bf544[_0x81ac('0x91')][_0x81ac('0x183')],_0x2bf544[_0x81ac('0x17f')],_0x2bf544[_0x81ac('0x180')]>0x0?utils[_0x81ac('0x181')](_0x2bf544[_0x81ac('0x182')],_0x2bf544[_0x81ac('0x180')]):_0x2bf544['dialOriginateCallerIdNumber']);if(_0x1f2396){_0x5d8f29[_0x81ac('0x184')]=_0x474aa7[_0x81ac('0x24')][_0x1a3f3f][_0x81ac('0x185')]=utils[_0x81ac('0x186')](_0x1f2396);_0x5d8f29[_0x81ac('0x187')]=_0x12ba45[_0x81ac('0x163')];}_0x2bf544[_0x81ac('0x188')]=_0x5d8f29;return ami[_0x81ac('0xa0')]({'actionid':_0x1a3f3f,'action':'originate','channel':_0x474aa7['isTrunkReachable'](_0x2bf544[_0x81ac('0x90')])?util['format'](_0x81ac('0x189'),_0x2bf544[_0x81ac('0x90')][_0x81ac('0x48')],isNotNull(_0x2bf544[_0x81ac('0x18a')])?_0x2bf544[_0x81ac('0x18a')][_0x81ac('0x18b')]()||'':'',_0x2bf544[_0x81ac('0x18c')]>0x0?_0x12ba45[_0x81ac('0x163')][_0x81ac('0x18d')](_0x2bf544[_0x81ac('0x18c')]):_0x12ba45[_0x81ac('0x163')]):util[_0x81ac('0x8c')]('SIP/%s/%s%s',_[_0x81ac('0xfc')](_0x2bf544['TrunkBackup'])?_0x2bf544['Trunk'][_0x81ac('0x48')]:_0x2bf544[_0x81ac('0x91')][_0x81ac('0x48')],isNotNull(_0x2bf544[_0x81ac('0x18a')])?_0x2bf544[_0x81ac('0x18a')][_0x81ac('0x18b')]()||'':'',_0x2bf544[_0x81ac('0x18c')]>0x0?_0x12ba45['phone'][_0x81ac('0x18d')](_0x2bf544['dialCutDigit']):_0x12ba45[_0x81ac('0x163')]),'callerid':_0x1f2396,'Exten':_0x81ac('0x118'),'Context':_0x81ac('0x18e'),'Priority':'1','variable':_0x5d8f29,'timeout':(_0x2bf544['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1a3f3f})[_0x81ac('0x3e')](function(_0x278376){return _0xca3753(_0x278376);})[_0x81ac('0xa9')](function(_0xd01a7c){_0x2bf544[_0x81ac('0x18f')]+=0x1;var _0x45de57=new History(_0x474aa7[_0x81ac('0x24')][_0x1a3f3f]);logger[_0x81ac('0x66')](util[_0x81ac('0x8c')](_0x81ac('0x190'),JSON[_0x81ac('0x78')](_0xd01a7c)));_0x45de57[_0x81ac('0x71')]=0xe;_0x45de57[_0x81ac('0x72')]='OriginateError';_0x45de57[_0x81ac('0x74')]=moment()[_0x81ac('0x8c')]('YYYY-MM-DD\x20HH:mm:ss');_0x45de57['endtime']=_0x45de57[_0x81ac('0x74')];hopperUtils['createHistory'](_0x45de57)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x191')));_0x474aa7['moveContactManagedDialer'](_0x45de57)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x191')))['finally'](function(){delete _0x474aa7[_0x81ac('0x24')][_0x1a3f3f];return _0x4956e4(msgResponse('originate',_0x81ac('0x89'),'originate\x20action\x20Error'));});});});};Dialer[_0x81ac('0x18')][_0x81ac('0x192')]=function(_0x406b8d,_0x4cd069,_0x2bd3eb){var _0x2a7bb6=new History(_0x4cd069);if(_0x2a7bb6[_0x81ac('0x128')]+_0x2a7bb6['countcongestionretry']+_0x2a7bb6['countnoanswerretry']+_0x2a7bb6[_0x81ac('0x12b')]+_0x2a7bb6[_0x81ac('0xda')]+_0x2a7bb6[_0x81ac('0xef')]+_0x2a7bb6[_0x81ac('0x126')]+_0x2a7bb6[_0x81ac('0x12c')]>=_0x2bd3eb[_0x81ac('0x12d')]-0x1){return!![];}switch(_0x406b8d){case 0x3:if(_0x2a7bb6[_0x81ac('0x12a')]>=_0x2bd3eb['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2a7bb6['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0x193')],'minutes')[_0x81ac('0x8c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6['ListId'],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x194')));break;case 0x5:if(_0x2a7bb6[_0x81ac('0x128')]>=_0x2bd3eb[_0x81ac('0x195')]-0x1){return!![];}hopperUtils[_0x81ac('0xe1')]({'active':![],'countbusyretry':_0x2a7bb6[_0x81ac('0x128')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0x196')],_0x81ac('0xe3'))['format'](_0x81ac('0xca')),'ContactId':_0x2a7bb6['ContactId'],'ListId':_0x2a7bb6[_0x81ac('0xf3')],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})['catch'](loggerCatch(_0x81ac('0x197')));break;case 0x8:if(_0x2a7bb6[_0x81ac('0x129')]>=_0x2bd3eb[_0x81ac('0x198')]-0x1){return!![];}hopperUtils[_0x81ac('0xe1')]({'active':![],'countcongestionretry':_0x2a7bb6[_0x81ac('0x129')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0x199')],_0x81ac('0xe3'))[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6[_0x81ac('0xf3')],'VoiceQueueId':_0x2a7bb6['VoiceQueueId']||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x19a')));break;case 0x0:if(_0x2a7bb6[_0x81ac('0x12b')]>=_0x2bd3eb[_0x81ac('0x19b')]-0x1){return!![];}else{hopperUtils[_0x81ac('0xe1')]({'active':![],'countnosuchnumberretry':_0x2a7bb6[_0x81ac('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x2bd3eb[_0x81ac('0x19c')],_0x81ac('0xe3'))[_0x81ac('0x8c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6['ListId'],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})['catch'](loggerCatch(_0x81ac('0x19d')));}break;case 0xa:if(_0x2a7bb6[_0x81ac('0xda')]>=_0x2bd3eb[_0x81ac('0xdf')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2a7bb6[_0x81ac('0xda')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0xdc')],'minutes')[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6[_0x81ac('0xf3')],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xe7')));break;case 0xb:if(_0x2a7bb6[_0x81ac('0xef')]>=_0x2bd3eb[_0x81ac('0xf2')]-0x1){return!![];}hopperUtils[_0x81ac('0xe1')]({'active':![],'countabandonedretry':_0x2a7bb6[_0x81ac('0xef')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb['dialAbandonedRetryFrequency'],_0x81ac('0xe3'))[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6['ListId'],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0xf4')));break;case 0x13:if(_0x2a7bb6['countmachineretry']>=_0x2bd3eb['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x81ac('0xe1')]({'active':![],'countmachineretry':_0x2a7bb6[_0x81ac('0x126')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0x131')],_0x81ac('0xe3'))[_0x81ac('0x8c')](_0x81ac('0xca')),'ContactId':_0x2a7bb6[_0x81ac('0xe4')],'ListId':_0x2a7bb6['ListId'],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2a7bb6[_0x81ac('0x12c')]>=_0x2bd3eb[_0x81ac('0x19e')]-0x1){return!![];}hopperUtils[_0x81ac('0xe1')]({'active':![],'countagentrejectretry':_0x2a7bb6[_0x81ac('0x12c')]+=0x1,'scheduledat':moment()[_0x81ac('0xe2')](_0x2bd3eb[_0x81ac('0x19f')],_0x81ac('0xe3'))['format'](_0x81ac('0xca')),'ContactId':_0x2a7bb6['ContactId'],'ListId':_0x2a7bb6['ListId'],'VoiceQueueId':_0x2a7bb6[_0x81ac('0xe5')]||undefined,'CampaignId':_0x2a7bb6['CampaignId']||undefined})[_0x81ac('0xa9')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x81ac('0x113')]=function(_0x5e3226,_0x5dfd1d,_0x38b5e5){var _0x4ed9c6=this;var _0x1940e6=new History(_0x5e3226);var _0x2413db=![];var _0x4535b;var _0x14e5c3;return new Promise(function(_0x160088,_0x599c3c){if(_[_0x81ac('0x40')](_0x5dfd1d)&&typeof _0x5dfd1d!==_0x81ac('0x160')){return _0x599c3c(msgResponse('[callProgressDetecting]','Failure',_0x81ac('0x1a0')));}if(_[_0x81ac('0x40')](_0x38b5e5)&&typeof _0x38b5e5!=='object'){return _0x599c3c(msgResponse(_0x81ac('0x1a1'),_0x81ac('0x98'),_0x81ac('0x1a2')));}hopperUtils[_0x81ac('0x1a3')](_0x1940e6,_0x38b5e5[_0x81ac('0xcc')],_0x5dfd1d)[_0x81ac('0x3e')](function(_0x46c416){if(_0x46c416[_0x81ac('0xde')]==0x1)_0x2413db=!![];switch(_0x38b5e5[_0x81ac('0xcc')]){case'0':_0x5dfd1d[_0x81ac('0x1a4')]+=0x1;_0x1940e6[_0x81ac('0x71')]=0x0;_0x1940e6[_0x81ac('0x72')]='NoSuchNumber';_0x1940e6[_0x81ac('0x12b')]+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;ami['emit'](_0x81ac('0x1a5'),ut[_0x81ac('0x121')](_0x5e3226,_0x81ac('0x1a6')));_0x4535b=_0x5dfd1d[_0x81ac('0x19c')];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];hopperUtils[_0x81ac('0xd1')](_0x1940e6)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x127')));if(_0x4ed9c6[_0x81ac('0x192')](0x0,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6[_0x81ac('0x12b')]>=_0x5dfd1d[_0x81ac('0x19b')]){_0x4ed9c6['createStateFinal'](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1a7'));}else{_0x4ed9c6[_0x81ac('0x12e')](_0x1940e6,_0x160088,_0x599c3c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x5dfd1d[_0x81ac('0x1a8')]+=0x1;_0x1940e6[_0x81ac('0x71')]=0x3;_0x1940e6[_0x81ac('0x72')]=_0x81ac('0x1a9');_0x1940e6['countnoanswerretry']+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;var _0x1ef564=ut['buildNoAnswerEventPayload'](_0x5e3226,_0x5dfd1d);ami[_0x81ac('0x41')](_0x81ac('0x1aa'),_0x1ef564);_0x4535b=_0x5dfd1d[_0x81ac('0x193')];_0x14e5c3=_0x5dfd1d['callAdditionalPhoneAfterMin'];hopperUtils[_0x81ac('0xd1')](_0x1940e6)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x1ab')));if(_0x4ed9c6[_0x81ac('0x192')](0x3,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6[_0x81ac('0x12a')]>=_0x5dfd1d[_0x81ac('0x1ac')]){_0x4ed9c6[_0x81ac('0x134')](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1ad'));}else{_0x4ed9c6[_0x81ac('0x12e')](_0x1940e6,_0x160088,_0x599c3c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5dfd1d[_0x81ac('0x1ae')]+=0x1;_0x1940e6[_0x81ac('0x71')]=0x5;_0x1940e6[_0x81ac('0x72')]=_0x81ac('0x1af');_0x1940e6[_0x81ac('0x128')]+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;ami['emit'](_0x81ac('0x1b0'),ut[_0x81ac('0x121')](_0x5e3226,_0x81ac('0x1b1')));_0x4535b=_0x5dfd1d['dialBusyRetryFrequency'];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];hopperUtils['createHistory'](_0x1940e6)['catch'](loggerCatch(_0x81ac('0x1b2')));if(_0x4ed9c6[_0x81ac('0x192')](0x5,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6['countbusyretry']>=_0x5dfd1d[_0x81ac('0x195')]){_0x4ed9c6[_0x81ac('0x134')](_0x1940e6,_0x160088,_0x599c3c,'reason\x205\x20busy');}else{_0x4ed9c6['stateGlobal'](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1b3'));}}break;case'8':_0x5dfd1d[_0x81ac('0x1b4')]+=0x1;_0x1940e6[_0x81ac('0x71')]=0x8;_0x1940e6[_0x81ac('0x72')]=_0x81ac('0x1b5');_0x1940e6[_0x81ac('0x129')]+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;_0x4535b=_0x5dfd1d[_0x81ac('0x199')];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];ami[_0x81ac('0x41')](_0x81ac('0x1b6'),ut['buildObj'](_0x5e3226,_0x81ac('0x1b7')));hopperUtils[_0x81ac('0xd1')](_0x1940e6)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x1b8')));if(_0x4ed9c6[_0x81ac('0x192')](0x8,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6['countcongestionretry']>=_0x5dfd1d[_0x81ac('0x198')]){_0x4ed9c6[_0x81ac('0x134')](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1b9'));}else{_0x4ed9c6[_0x81ac('0x12e')](_0x1940e6,_0x160088,_0x599c3c,'reason\x208\x20congestion');}}break;case'11':_0x5dfd1d['outboundAbandonedCallsDay']+=0x1;_0x1940e6[_0x81ac('0x71')]=0xb;_0x1940e6[_0x81ac('0x72')]=_0x81ac('0xed');_0x1940e6[_0x81ac('0xef')]+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;_0x4535b=_0x5dfd1d[_0x81ac('0xf0')];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];hopperUtils['createHistory'](_0x1940e6)['catch'](loggerCatch(_0x81ac('0xf5')));if(_0x4ed9c6[_0x81ac('0x192')](0xb,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6[_0x81ac('0xef')]>=_0x5dfd1d[_0x81ac('0xf2')]){_0x4ed9c6['createStateFinal'](_0x1940e6,_0x160088,_0x599c3c,'reason\x2011\x20abandoned');}else{_0x4ed9c6[_0x81ac('0x12e')](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1ba'));}}break;case'20':_0x5dfd1d['outboundRejectCallsDay']+=0x1;_0x1940e6[_0x81ac('0x71')]=0x14;_0x1940e6[_0x81ac('0x72')]=_0x81ac('0x1bb');_0x1940e6[_0x81ac('0x12c')]+=0x1;_0x1940e6[_0x81ac('0xdb')]+=0x1;_0x4535b=_0x5dfd1d['dialAgentRejectRetryFrequency'];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];ami[_0x81ac('0x41')]('custom:agentreject',ut[_0x81ac('0x121')](_0x5e3226,_0x81ac('0x1bc')));hopperUtils['createHistory'](_0x1940e6)[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x1bd')));if(_0x4ed9c6[_0x81ac('0x192')](0x14,_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6[_0x81ac('0x12c')]>=_0x5dfd1d[_0x81ac('0x19e')]){_0x4ed9c6[_0x81ac('0x134')](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1be'));}else{_0x4ed9c6['stateGlobal'](_0x1940e6,_0x160088,_0x599c3c,_0x81ac('0x1be'));}}break;default:_0x5dfd1d[_0x81ac('0x13a')]+=0x1;_0x1940e6['state']=0xc;_0x1940e6[_0x81ac('0x72')]=_0x38b5e5['reason'];_0x4535b=_0x5dfd1d[_0x81ac('0x19f')];_0x14e5c3=_0x5dfd1d[_0x81ac('0xf1')];hopperUtils[_0x81ac('0xd1')](_0x1940e6)['catch'](loggerCatch(_0x81ac('0x1bf')));if(_0x4ed9c6[_0x81ac('0x192')](_0x38b5e5[_0x81ac('0xcc')],_0x5e3226,_0x5dfd1d)&&!_0x2413db){if(_0x1940e6[_0x81ac('0x128')]+_0x1940e6['countcongestionretry']+_0x1940e6[_0x81ac('0x12a')]+_0x1940e6['countnosuchnumberretry']+_0x1940e6[_0x81ac('0xda')]+_0x1940e6[_0x81ac('0xef')]+_0x1940e6[_0x81ac('0x126')]+_0x1940e6[_0x81ac('0x12c')]>=_0x5dfd1d[_0x81ac('0x12d')]){_0x4ed9c6[_0x81ac('0x12e')](_0x1940e6,_0x160088,_0x599c3c,_0x38b5e5['reason']);}else{_0x4ed9c6['createStateFinal'](_0x1940e6,_0x160088,_0x599c3c,_0x38b5e5[_0x81ac('0xcc')]);}}}})[_0x81ac('0x3e')](function(){if(_0x2413db){hopperUtils[_0x81ac('0xf6')](_0x1940e6,_0x4535b,_0x14e5c3)['then'](function(){return _0x160088(0x1);});}});});};Dialer[_0x81ac('0x18')][_0x81ac('0x12e')]=function(_0x375928,_0x188ab1,_0xad1fb0,_0x579cf1){var _0x16c443=new Final(_0x375928);_0x16c443[_0x81ac('0x71')]=0xf;_0x16c443['statedesc']=_0x81ac('0x1c0');this[_0x81ac('0x134')](_0x16c443,_0x188ab1,_0xad1fb0,_0x579cf1);};Dialer[_0x81ac('0x18')][_0x81ac('0x134')]=function(_0x1a1884,_0x11df0d,_0x14c63a,_0x312fe3){hopperUtils[_0x81ac('0xd3')](_0x1a1884)[_0x81ac('0x3e')](function(){return _0x11df0d(msgResponse('[callProgressDetecting]',_0x81ac('0x112'),_0x312fe3));})[_0x81ac('0xa9')](function(){return _0x14c63a(msgResponse(_0x81ac('0x1c1'),_0x81ac('0x98'),_0x81ac('0x1c2')));});};Dialer[_0x81ac('0x18')][_0x81ac('0xb2')]=function(_0x50b6d1){var _0x2fc48b=_0x50b6d1[_0x81ac('0x1c3')]/0x64;var _0x489857=_0x50b6d1[_0x81ac('0x1c4')]/(_0x50b6d1[_0x81ac('0x1c4')]+_0x50b6d1['outboundAnswerCallsDay']);var _0x3481fd=Math[_0x81ac('0x1c5')](_0x50b6d1[_0x81ac('0x1c6')]*(_0x50b6d1['predictiveIntervalMaxThreshold']/0x64));var _0x2bbf94=Math['round'](_0x50b6d1[_0x81ac('0x1c6')]*(_0x50b6d1['predictiveIntervalMinThreshold']/0x64));var _0x373d64=_0x50b6d1[_0x81ac('0x13f')]+_0x50b6d1['talking'];var _0x128692=Math['floor'](_0x50b6d1[_0x81ac('0x1c7')]*_0x50b6d1[_0x81ac('0x5e')]*_0x50b6d1[_0x81ac('0x1c8')]*_0x50b6d1[_0x81ac('0x1c9')]);if(_['isUndefined'](_0x50b6d1[_0x81ac('0x28')])){if(!_[_0x81ac('0x40')](_0x50b6d1['startPredictive'])){_0x50b6d1[_0x81ac('0x27')]=undefined;loggerPredictive[_0x81ac('0x66')]('[startMethodPredictive][StartProgressive]',_0x81ac('0x1ca'));}if(!_[_0x81ac('0x40')](_0x50b6d1[_0x81ac('0x64')])){loggerPredictive[_0x81ac('0x66')](_0x81ac('0x1cb'),_0x81ac('0x1cc'));clearInterval(_0x50b6d1[_0x81ac('0x64')]);_0x50b6d1[_0x81ac('0x64')]=undefined;}_0x50b6d1[_0x81ac('0x28')]=moment()[_0x81ac('0x8c')](_0x81ac('0xca'));loggerPredictive['info'](_0x50b6d1['name'],_0x81ac('0x1cd'),_0x50b6d1[_0x81ac('0x28')]);this[_0x81ac('0xb4')](_0x50b6d1,0x1);}else if(ifInterval(_0x50b6d1[_0x81ac('0x1ce')],_0x50b6d1[_0x81ac('0x28')])){this[_0x81ac('0xb4')](_0x50b6d1,0x1);loggerPredictiveCalls['info'](_0x81ac('0x1cf'),_0x50b6d1[_0x81ac('0x28')],_0x50b6d1[_0x81ac('0x48')]);_0x50b6d1[_0x81ac('0x1c7')]=0x0;_0x50b6d1[_0x81ac('0xd7')]=0x0;}else if(_0x2fc48b<_0x489857&&_0x50b6d1[_0x81ac('0x1d0')]==='dropRate'){clearPredictiveAttributes(_0x50b6d1);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x1d1'),_0x81ac('0x1d2'),_0x489857,_0x81ac('0x28'),_0x50b6d1[_0x81ac('0x48')]);}else if(_0x128692<_0x50b6d1['predictiveIntervalErlangCallsDroppedCalls']&&_0x50b6d1['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x50b6d1);loggerPredictive[_0x81ac('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x81ac('0x1d3'),_0x128692,'Drop\x20in\x20this\x20interval',_0x50b6d1[_0x81ac('0xd7')],_0x81ac('0x28'),_0x50b6d1[_0x81ac('0x48')]);}else if(!ifInterval(_0x50b6d1[_0x81ac('0x1ce')],_0x50b6d1['startProgressive'])&&_['isUndefined'](_0x50b6d1['startPredictive'])&&!_[_0x81ac('0x40')](_0x50b6d1[_0x81ac('0x28')])){_0x50b6d1[_0x81ac('0x27')]=moment()[_0x81ac('0x8c')](_0x81ac('0xca'));loggerPredictive['info'](_0x50b6d1[_0x81ac('0x48')],'started\x20in\x20predictive\x20at',_0x50b6d1['startPredictive']);hopperUtils[_0x81ac('0x1d4')](_0x50b6d1[_0x81ac('0x1ce')])[_0x81ac('0x3e')](this['getDataPredictive'](_0x50b6d1))[_0x81ac('0x3e')](mergeDataErlangB(_0x50b6d1))[_0x81ac('0x3e')](this[_0x81ac('0x1d5')](_0x50b6d1))[_0x81ac('0xa9')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x50b6d1));}else if(!ifInterval(_0x50b6d1[_0x81ac('0x1ce')],_0x50b6d1[_0x81ac('0x27')])){_0x50b6d1[_0x81ac('0xd7')]=0x0;_0x50b6d1[_0x81ac('0x27')]=moment()[_0x81ac('0x8c')](_0x81ac('0xca'));loggerPredictive[_0x81ac('0x4b')](_0x50b6d1[_0x81ac('0x48')],_0x81ac('0x1d6'),_0x50b6d1[_0x81ac('0x27')]);clearInterval(_0x50b6d1['handlePredictive']);_0x50b6d1['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x50b6d1[_0x81ac('0x1ce')])[_0x81ac('0x3e')](this[_0x81ac('0x1d7')](_0x50b6d1))[_0x81ac('0x3e')](mergeDataErlangB(_0x50b6d1))[_0x81ac('0x3e')](this[_0x81ac('0x1d5')](_0x50b6d1))[_0x81ac('0xa9')](loggerCatchPredictive(_0x81ac('0x1d8'),_0x50b6d1));}else if(_0x50b6d1[_0x81ac('0x1c6')]&&_0x373d64<_0x50b6d1[_0x81ac('0x1c6')]-_0x2bbf94){clearPredictiveAttributes(_0x50b6d1);loggerPredictive[_0x81ac('0x4b')](_0x50b6d1['name'],_0x81ac('0x1d9'),_0x373d64,_0x81ac('0x1da'),_0x50b6d1[_0x81ac('0x1c6')],'-',_0x2bbf94,'=',_0x50b6d1[_0x81ac('0x1c6')]-_0x2bbf94,')');}else if(_0x50b6d1['predictiveIntervalAvailable']&&_0x373d64>_0x50b6d1[_0x81ac('0x1c6')]+_0x3481fd){clearPredictiveAttributes(_0x50b6d1);loggerPredictive['info'](_0x50b6d1[_0x81ac('0x48')],_0x81ac('0x1d9'),_0x373d64,')\x20are\x20more\x20than\x20threshold\x20(',_0x50b6d1[_0x81ac('0x1c6')],'+',_0x3481fd,'=',_0x50b6d1['predictiveIntervalAvailable']+_0x3481fd,')');}};Dialer[_0x81ac('0x18')][_0x81ac('0x1d7')]=function(_0x546afb){var _0x50306f=this;return function(_0x55fbdc){return new Promise(function(_0x36ec72,_0x1ace10){_[_0x81ac('0x61')](_0x546afb,_0x55fbdc[0x0]);if(checkGetDataPredictive(_0x55fbdc[0x0])){var _0x481921=_0x546afb[_0x81ac('0x1c6')]=_0x546afb[_0x81ac('0x140')]+_0x546afb[_0x81ac('0x13f')];var _0x27ff9b=_0x546afb[_0x81ac('0x1ce')]*0x3c;var _0x3364bb=_0x55fbdc[0x0][_0x81ac('0x55')]+_0x55fbdc[0x0][_0x81ac('0x57')];var _0x1c071d=(_0x55fbdc[0x0][_0x81ac('0x1db')]+_0x55fbdc[0x0][_0x81ac('0x1dc')]+_0x55fbdc[0x0][_0x81ac('0x51')])/_0x55fbdc[0x0][_0x81ac('0x4d')];_0x546afb[_0x81ac('0x1c8')]=_0x1c071d>0x0?_0x1c071d:0x1;switch(_0x546afb[_0x81ac('0x1d0')]){case _0x81ac('0x1dd'):var _0x53f773=_0x546afb[_0x81ac('0x1c3')]/0x64;return _0x50306f[_0x81ac('0x1de')](_0x481921,_0x27ff9b,_0x3364bb,_0x1c071d,_0x53f773)[_0x81ac('0x3e')](function(_0x2272cb){return _0x36ec72(_0x2272cb);});case _0x81ac('0x1df'):var _0x3589ae=_0x546afb[_0x81ac('0x1c3')]/0x64;return _0x50306f['busyFactor'](_0x481921,_0x27ff9b,_0x3364bb,_0x1c071d,_0x3589ae)[_0x81ac('0x3e')](function(_0x43a545){return _0x36ec72(_0x43a545);});default:return _0x1ace10(msgResponse(_0x81ac('0x1e0'),'Failure',_0x81ac('0x1e1')));}}else{return _0x1ace10(msgResponse(_0x81ac('0x1e0'),'Failure',_0x81ac('0x1e2')));}});};};Dialer[_0x81ac('0x18')][_0x81ac('0x1e3')]=function(_0x59a9fc){var _0x189d5d=this;return function(_0x1ab281){return new Promise(function(_0x4093ef,_0x4d9eff){_[_0x81ac('0x61')](_0x59a9fc,_0x1ab281[0x0]);if(checkGetDataPredictive(_0x1ab281[0x0])){loggerPredictive[_0x81ac('0x4b')](JSON[_0x81ac('0x78')](_0x1ab281[0x0]));if(_0x59a9fc[_0x81ac('0x1d0')]===_0x81ac('0x1dd')){return _0x189d5d[_0x81ac('0x155')](_0x59a9fc['id'])['then'](function(_0x32b128){var _0x392556=_0x59a9fc[_0x81ac('0x1e4')]-_0x32b128[0x0][_0x81ac('0x1e5')];var _0x18f862=_0x59a9fc[_0x81ac('0x1ce')]*0x3c;var _0x54cec3=_0x1ab281[0x0][_0x81ac('0x55')]+_0x1ab281[0x0]['predictiveIntervalAvgHoldtime'];var _0x344c7c=(_0x1ab281[0x0]['predictiveIntervalAnsweredCalls']+_0x1ab281[0x0][_0x81ac('0x1dc')]+_0x1ab281[0x0][_0x81ac('0x51')])/_0x1ab281[0x0][_0x81ac('0x4d')];var _0x1f2238=_0x59a9fc[_0x81ac('0x1c3')]/0x64;_0x59a9fc[_0x81ac('0x1e6')]=_0x32b128[0x0][_0x81ac('0x1e5')]||0x0;_0x59a9fc[_0x81ac('0x1c8')]=_0x344c7c>0x0?_0x344c7c:0x1;return _0x189d5d[_0x81ac('0x1de')](_0x392556,_0x18f862,_0x54cec3,_0x344c7c,_0x1f2238);})[_0x81ac('0x3e')](function(_0x33b41c){return _0x4093ef(_0x33b41c);})[_0x81ac('0xa9')](function(_0x169e29){return _0x4d9eff(msgResponse('[CatchErlangB]','Failure',JSON[_0x81ac('0x78')](_0x169e29)));});}if(_0x59a9fc[_0x81ac('0x1d0')]===_0x81ac('0x1df')){return _0x189d5d[_0x81ac('0x155')](_0x59a9fc['id'])[_0x81ac('0x3e')](function(_0x360001){var _0x1ea0fc=_0x59a9fc[_0x81ac('0x1e4')]-_0x360001[0x0][_0x81ac('0x1e5')];var _0xd101f9=_0x59a9fc[_0x81ac('0x1ce')]*0x3c;var _0x94b8e=_0x1ab281[0x0][_0x81ac('0x55')]+_0x1ab281[0x0][_0x81ac('0x57')];var _0x348399=(_0x1ab281[0x0][_0x81ac('0x1db')]+_0x1ab281[0x0][_0x81ac('0x1dc')]+_0x1ab281[0x0][_0x81ac('0x51')])/_0x1ab281[0x0]['predictiveIntervalTotalCalls'];var _0x20f057=_0x59a9fc[_0x81ac('0x1c3')]/0x64;_0x59a9fc['predictiveIntervalPauses']=_0x360001[0x0][_0x81ac('0x1e5')]||0x0;_0x59a9fc['predictiveIntervalHitRate']=_0x348399>0x0?_0x348399:0x1;return _0x189d5d[_0x81ac('0x1e7')](_0x1ea0fc,_0xd101f9,_0x94b8e,_0x348399,_0x20f057);})[_0x81ac('0x3e')](function(_0xe34f25){return _0x4093ef(_0xe34f25);})[_0x81ac('0xa9')](function(_0x4cf09f){return _0x4d9eff(msgResponse(_0x81ac('0x1e8'),_0x81ac('0x98'),JSON[_0x81ac('0x78')](_0x4cf09f)));});}}else{return _0x4d9eff(msgResponse('[getDataPredictive]',_0x81ac('0x98'),_0x81ac('0x1e2')));}});};};Dialer['prototype'][_0x81ac('0x1d5')]=function(_0x4f8f07){var _0x2d2c0e=this;return function(){var _0x4178b6=0x0;var _0xb05fe=Math[_0x81ac('0x1e9')](_0x4f8f07[_0x81ac('0x5c')]*0x3e8);if(_0xb05fe>0x0){_0xb05fe=_0xb05fe<0x64?0x64:_0xb05fe;loggerPredictive[_0x81ac('0x4b')](_0x4f8f07[_0x81ac('0x48')],_0x81ac('0x1ea'),_0xb05fe,_0x81ac('0x1eb'));_0x4f8f07['handlePredictive']=setInterval(function(){_0x2d2c0e['handlePredictive'](_0x4f8f07);loggerPredictiveCalls[_0x81ac('0x4b')](_0x81ac('0x1ec'),_0x4178b6+=0x1);},_0xb05fe);}else{loggerPredictive[_0x81ac('0x4b')](_0x4f8f07[_0x81ac('0x48')],_0x81ac('0x1ed'));}};};Dialer[_0x81ac('0x18')][_0x81ac('0x1ee')]=function(_0x46c99c,_0x240649){var _0x31c280=this;return function(_0x508ec4){if(_[_0x81ac('0x4a')](_0x508ec4)){if(_[_0x81ac('0xfc')](_0x240649[_0x81ac('0x1ef')])||!_0x240649[_0x81ac('0x1f0')]){if(_0x46c99c[_0x81ac('0xb1')]===_0x81ac('0x8')){_0x46c99c[_0x81ac('0x75')]=_[_0x81ac('0x40')](_0x46c99c[_0x81ac('0x75')])?!![]:_0x46c99c['queueStatusComplete'];var _0x5af39e=uuid['v4']();_0x31c280['actions'][_0x5af39e]=new Action(_0x46c99c,_0x240649,_0x5af39e);loggerBooked[_0x81ac('0x4b')]('[booked][checkContactBlack]',_0x5af39e,_0x81ac('0x1f1'),JSON[_0x81ac('0x78')](_0x46c99c[_0x81ac('0x75')]),_0x81ac('0x1f2'),_0x46c99c['name']);if(_0x46c99c[_0x81ac('0x75')]){_0x46c99c[_0x81ac('0x75')]=![];_0x31c280[_0x81ac('0x100')][_0x31c280['actions'][_0x5af39e]['queue']]=[];ami[_0x81ac('0xa0')]({'actionid':_0x5af39e,'action':_0x81ac('0x1f3'),'queue':_0x46c99c[_0x81ac('0x48')]})[_0x81ac('0xa9')](function(){_0x31c280[_0x81ac('0xc7')](_0x46c99c);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x31c280['actions'][_0x5af39e][_0x81ac('0xe4')],'ListId':_0x31c280[_0x81ac('0x24')][_0x5af39e][_0x81ac('0xf3')],'VoiceQueueId':_0x31c280[_0x81ac('0x24')][_0x5af39e]['VoiceQueueId']||undefined,'CampaignId':_0x31c280[_0x81ac('0x24')][_0x5af39e][_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x31c280[_0x81ac('0x24')][_0x5af39e];});}else{loggerBooked['info'](_0x81ac('0x1f4'),JSON['stringify'](_0x46c99c[_0x81ac('0x75')]),_0x81ac('0x1f2'),_0x46c99c[_0x81ac('0x48')]);_0x31c280[_0x81ac('0xc7')](_0x46c99c);hopperUtils[_0x81ac('0xe1')]({'active':![],'ContactId':_0x31c280['actions'][_0x5af39e][_0x81ac('0xe4')],'ListId':_0x31c280['actions'][_0x5af39e][_0x81ac('0xf3')],'VoiceQueueId':_0x31c280[_0x81ac('0x24')][_0x5af39e]['VoiceQueueId']||undefined,'CampaignId':_0x31c280[_0x81ac('0x24')][_0x5af39e][_0x81ac('0xe6')]||undefined})['catch'](loggerCatch(_0x81ac('0x1f5')));delete _0x31c280[_0x81ac('0x24')][_0x5af39e];}}else{return _0x31c280[_0x81ac('0x15f')](_0x46c99c,_0x240649);}}else{if(utils[_0x81ac('0x62')](undefined,_0x240649[_0x81ac('0x1f6')])<_0x46c99c[_0x81ac('0x1f7')]*0x3c){if(_0x240649[_0x81ac('0x15d')]&&!_0x240649['Agent'][_0x81ac('0x1f8')]){_0x31c280[_0x81ac('0x1d')][_0x81ac('0x108')](_0x240649['id'])[_0x81ac('0x1b')](function(){_0x31c280['updateOriginated'](_0x46c99c);});}else{hopperUtils[_0x81ac('0x1f9')]({'active':![]},_0x240649['id'],0x1)[_0x81ac('0x1b')](function(){_0x31c280['updateOriginated'](_0x46c99c);});}}else{_0x46c99c[_0x81ac('0x1fa')]+=0x1;_0x31c280[_0x81ac('0xc7')](_0x46c99c);if(_0x46c99c['dialRecallInQueue']){hopperUtils[_0x81ac('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x240649[_0x81ac('0xe4')],'ListId':_0x240649[_0x81ac('0xf3')],'VoiceQueueId':_0x240649[_0x81ac('0xe5')]||undefined,'CampaignId':_0x240649[_0x81ac('0xe6')]||undefined})[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x1fb')));hopperUtils[_0x81ac('0xd1')](createObjHistory(_0x46c99c,_0x240649,utils[_0x81ac('0x6a')][_0x81ac('0x1fc')],0x17,_0x81ac('0x1fd')))[_0x81ac('0xa9')](loggerCatch(_0x81ac('0x1fe')));}else{_0x31c280[_0x81ac('0x123')](createObjHistory(_0x46c99c,_0x240649,utils[_0x81ac('0x6a')][_0x81ac('0x1ff')],0x16,_0x81ac('0x200')),_0x81ac('0x201'),_0x81ac('0x202'));}}}}else{_0x46c99c[_0x81ac('0x203')]+=0x1;_0x31c280['saveInDb'](createObjHistory(_0x46c99c,_0x240649,utils[_0x81ac('0x6a')][_0x81ac('0x204')],0xd,'Blacklist'),_0x81ac('0x205'),_0x81ac('0x206'));throw _0x81ac('0x207');}};};Dialer[_0x81ac('0x18')]['handleIvr']=function(_0x59e54d){var _0x2ccaab=this;var _0x655807=_0x59e54d[_0x81ac('0x208')]-_0x59e54d[_0x81ac('0x83')];emitCampaignSummary(_0x59e54d);if(_0x655807>0x0&&_0x59e54d[_0x81ac('0x209')]==0x0){if(_0x655807>this['maxNumberOriginate']){_0x655807=this[_0x81ac('0x22')];}_0x59e54d['temp']=0x1;hopperUtils[_0x81ac('0x20a')](_0x59e54d,_0x655807)[_0x81ac('0x3e')](function(_0x5789b1){_0x59e54d[_0x81ac('0x209')]=0x0;if(_0x5789b1){if(!utils['checkContactEmpty'](_0x5789b1)){_0x59e54d['message']=utils[_0x81ac('0x6a')][_0x81ac('0x6e')];logger[_0x81ac('0x4b')](_0x81ac('0x20b')+_0x59e54d['name']);}else{_0x59e54d['originated']+=_0x5789b1['length'];_0x59e54d['message']=utils[_0x81ac('0x6a')][_0x81ac('0x20c')];for(var _0x4a5def=0x0;_0x4a5def<_0x5789b1[_0x81ac('0x9e')];_0x4a5def+=0x1){_0x59e54d['ivrTotalCallsDays']+=0x1;if(_[_0x81ac('0xfc')](_0x5789b1[_0x4a5def])||_[_0x81ac('0xfc')](_0x5789b1[_0x4a5def][_0x81ac('0x17d')])||_['isNil'](_0x5789b1[_0x4a5def][_0x81ac('0x163')])){_0x2ccaab[_0x81ac('0x15a')]('[actionOriginate]\x20',_0x59e54d,_0x5789b1[_0x4a5def]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x81ac('0x101')](_0x5789b1[_0x4a5def],[_0x81ac('0xe6'),_0x81ac('0x163')]))[_0x81ac('0x3e')](_0x2ccaab[_0x81ac('0x1ee')](_0x59e54d,_0x5789b1[_0x4a5def]))[_0x81ac('0xa9')](_0x2ccaab['loggerHandler'](_0x81ac('0x20d'),_0x59e54d));}}}}})[_0x81ac('0xa9')](loggerGetContactDialer(_0x81ac('0x20e'),_0x59e54d,_0x655807));}};Dialer[_0x81ac('0x18')][_0x81ac('0xb4')]=function(_0x171edf,_0x41067e){var _0x52db0f=this;var _0x4e3f46=[];if(_0x41067e<0x1||_0x171edf[_0x81ac('0xb1')]===_0x81ac('0x8')){_0x41067e=0x1;}var _0x2182b7=Math[_0x81ac('0x1e9')](_0x171edf[_0x81ac('0x13f')]*_0x41067e)-_0x171edf[_0x81ac('0x83')];if(_0x171edf[_0x81ac('0x20f')]>0x0){var _0x239c5a=_0x171edf[_0x81ac('0x20f')]-_0x171edf[_0x81ac('0x83')]-_0x171edf[_0x81ac('0x140')]-_0x171edf[_0x81ac('0x141')];if(_0x2182b7>_0x239c5a){_0x2182b7=_0x239c5a;}}if(_0x2182b7>0x0&&_0x171edf[_0x81ac('0x209')]==0x0){if(_0x171edf[_0x81ac('0xb1')]===_0x81ac('0x8')){_0x2182b7=0x1;}if(_0x2182b7>this[_0x81ac('0x22')]){_0x2182b7=this[_0x81ac('0x22')];}for(var _0x5efc3f in this[_0x81ac('0x20')]){if(typeof this[_0x81ac('0x20')][_0x5efc3f]!==_0x81ac('0x151')){if(this[_0x81ac('0x20')][_0x5efc3f]['state']===_0x81ac('0x210')&&this[_0x81ac('0x20')][_0x5efc3f][_0x81ac('0x8e')]==='reachable'){_0x4e3f46[_0x81ac('0x9f')](this['agents'][_0x5efc3f]['id']);}}}_0x171edf[_0x81ac('0x209')]=0x1;hopperUtils[_0x81ac('0x211')](_0x171edf,_0x4e3f46,_0x2182b7)[_0x81ac('0x3e')](function(_0x5bb05c){_0x171edf[_0x81ac('0x209')]=0x0;if(_0x5bb05c){if(!utils[_0x81ac('0x212')](_0x5bb05c)){hopperUtils[_0x81ac('0x213')](_0x171edf)[_0x81ac('0x3e')](sendMessageReschedule(_0x171edf))['catch'](loggerCatch(_0x81ac('0x214')));}else{_0x171edf[_0x81ac('0x83')]+=_0x5bb05c[_0x81ac('0x9e')];_0x171edf[_0x81ac('0x70')]=_0x171edf[_0x81ac('0xb1')]===_0x81ac('0x8')?utils['CAMPAIGN_STATUS'][_0x81ac('0x142')]:utils[_0x81ac('0x6a')][_0x81ac('0x20c')];for(var _0x27b881=0x0;_0x27b881<_0x5bb05c[_0x81ac('0x9e')];_0x27b881+=0x1){if(_[_0x81ac('0xfc')](_0x5bb05c[_0x27b881])||_[_0x81ac('0xfc')](_0x5bb05c[_0x27b881][_0x81ac('0x17d')])||_[_0x81ac('0xfc')](_0x5bb05c[_0x27b881][_0x81ac('0x163')])){_0x52db0f[_0x81ac('0x15a')](_0x81ac('0x215'),_0x171edf,_0x5bb05c[_0x27b881]);}else{hopperUtils[_0x81ac('0x216')](_['pick'](_0x5bb05c[_0x27b881],['VoiceQueueId',_0x81ac('0x163')]))[_0x81ac('0x3e')](_0x52db0f[_0x81ac('0x1ee')](_0x171edf,_0x5bb05c[_0x27b881]))['catch'](_0x52db0f[_0x81ac('0x159')]('[actionOriginate]\x20',_0x171edf));}}}}})[_0x81ac('0xa9')](loggerGetContactDialer(_0x81ac('0x217'),_0x171edf,_0x2182b7));}};Dialer[_0x81ac('0x18')][_0x81ac('0x64')]=function(_0x137073){if(_0x137073['dialLimitQueue']>0x0){var _0x3fcc33=_0x137073[_0x81ac('0x20f')]-_0x137073['originated']-_0x137073[_0x81ac('0x140')];if(_0x3fcc33>0x0&&_0x137073[_0x81ac('0x209')]==0x0){this[_0x81ac('0x218')](_0x137073);}else{loggerPredictiveCalls[_0x81ac('0x4b')](_0x81ac('0x219'));}}else{this[_0x81ac('0x218')](_0x137073);}};Dialer[_0x81ac('0x18')][_0x81ac('0x218')]=function(_0x3a67ae){var _0x2231ac=this;var _0x5ece76=[];_0x3a67ae[_0x81ac('0x83')]+=0x1;for(var _0x46e7b4 in this[_0x81ac('0x20')]){if(typeof this[_0x81ac('0x20')][_0x46e7b4]!=='undefined'){if(this['agents'][_0x46e7b4][_0x81ac('0x71')]==='not_inuse'&&this[_0x81ac('0x20')][_0x46e7b4][_0x81ac('0x8e')]===_0x81ac('0x21a')){_0x5ece76[_0x81ac('0x9f')](this[_0x81ac('0x20')][_0x46e7b4]['id']);}}}_0x3a67ae[_0x81ac('0x209')]=0x1;return this[_0x81ac('0x211')](_0x3a67ae['id'],_0x5ece76,0x1,_0x3a67ae[_0x81ac('0x21b')],_0x3a67ae)[_0x81ac('0x3e')](function(_0x4e7474){_0x3a67ae[_0x81ac('0x209')]=0x1;if(_0x4e7474){if(!utils[_0x81ac('0x212')](_0x4e7474)){utils[_0x81ac('0x68')](_0x3a67ae,0x1,0x0);return hopperUtils[_0x81ac('0x213')](_0x3a67ae)[_0x81ac('0x3e')](sendMessageReschedule(_0x3a67ae))[_0x81ac('0xa9')](loggerCatch('[countReScheduled]\x20'));}else{_0x3a67ae[_0x81ac('0x70')]=utils[_0x81ac('0x6a')][_0x81ac('0x20c')];if(_[_0x81ac('0xfc')](_0x4e7474[0x0])||_['isNil'](_0x4e7474[0x0][_0x81ac('0x17d')])||_[_0x81ac('0xfc')](_0x4e7474[0x0][_0x81ac('0x163')])){_0x2231ac['emptyContact'](_0x81ac('0x215'),_0x3a67ae,_0x4e7474[0x0]);}else{return hopperUtils[_0x81ac('0x216')](_[_0x81ac('0x101')](_0x4e7474[0x0],['VoiceQueueId',_0x81ac('0x163')]))[_0x81ac('0x3e')](_0x2231ac[_0x81ac('0x1ee')](_0x3a67ae,_0x4e7474[0x0]))[_0x81ac('0xa9')](_0x2231ac[_0x81ac('0x159')](_0x81ac('0x21c'),_0x3a67ae));}}}})[_0x81ac('0xa9')](loggerGetContactDialer(_0x81ac('0x21d'),_0x3a67ae,0x1));};Dialer[_0x81ac('0x18')][_0x81ac('0x1de')]=function(_0x4cf017,_0x68e462,_0x2a0c2e,_0x3ead88,_0x2760fa,_0x31175c){loggerPredictive[_0x81ac('0x4b')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x81ac('0x4b')]('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',_0x4cf017);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x21e'),_0x68e462);loggerPredictive['info'](_0x81ac('0x21f'),_0x2a0c2e);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ead88);loggerPredictive['info'](_0x81ac('0x220'),_0x2760fa);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x54'));return new Promise(function(_0x47e538,_0x8e3032){if(_0x4cf017<=0x0||isNaN(_0x4cf017)){return _0x8e3032(msgResponse(_0x81ac('0x221'),_0x81ac('0x89'),_0x81ac('0x222')+_0x4cf017));}if(_0x2a0c2e<=0x0||isNaN(_0x2a0c2e)){return _0x8e3032(msgResponse(_0x81ac('0x221'),_0x81ac('0x89'),'Ts\x20=\x20'+_0x2a0c2e));}if(_0x3ead88<=0x0||isNaN(_0x3ead88)){return _0x8e3032(msgResponse(_0x81ac('0x221'),_0x81ac('0x89'),_0x81ac('0x223')+_0x3ead88));}if(_0x68e462<=0x0||isNaN(_0x68e462)){return _0x8e3032(msgResponse('[abandonmentRate]',_0x81ac('0x89'),_0x81ac('0x224')+_0x68e462));}if(_0x2760fa<=0x0||isNaN(_0x2760fa)){return _0x8e3032(msgResponse(_0x81ac('0x221'),_0x81ac('0x89'),_0x81ac('0x225')+_0x2760fa));}_0x31175c=_0x31175c||0x0;var _0x5d31c7=0x1/_0x2a0c2e;var _0x17f22a=0x0;var _0x2d6650=0x0;var _0xc2e75e=0x0;var _0x36f00d=0x0;for(var _0x1d4d92=0x0;_0xc2e75e<_0x2760fa;_0x1d4d92+=0x1){_0x2d6650=_0x1d4d92/_0x68e462;_0x17f22a=(_0x3ead88*_0x2d6650+_0x31175c)/_0x5d31c7;_0xc2e75e=utils['erlangb'](_0x17f22a,_0x4cf017);_0x36f00d=_0x17f22a/_0x4cf017*(0x1-utils[_0x81ac('0x226')](_0x17f22a,_0x4cf017));}return _0x47e538({'erlangCalls':_0x1d4d92,'erlangCallToSecond':_0x68e462/_0x1d4d92,'erlangAbandonmentRate':_0xc2e75e,'erlangBusyFactor':_0x36f00d});});};Dialer[_0x81ac('0x18')][_0x81ac('0x1e7')]=function(_0x176776,_0x5180b3,_0x3c16ff,_0xf738de,_0x573581,_0x3461db){loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x227'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x176776);loggerPredictive[_0x81ac('0x4b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5180b3);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x21f'),_0x3c16ff);loggerPredictive['info'](_0x81ac('0x228'),_0xf738de);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x229'),_0x573581);loggerPredictive[_0x81ac('0x4b')](_0x81ac('0x54'));return new Promise(function(_0x30df67,_0x1e6a4e){if(_0x176776<=0x0||isNaN(_0x176776)){return _0x1e6a4e(msgResponse('[busyFactor]',_0x81ac('0x89'),_0x81ac('0x222')+_0x176776));}if(_0x3c16ff<=0x0||isNaN(_0x3c16ff)){return _0x1e6a4e(msgResponse(_0x81ac('0x22a'),_0x81ac('0x89'),_0x81ac('0x22b')+_0x3c16ff));}if(_0xf738de<=0x0||isNaN(_0xf738de)){return _0x1e6a4e(msgResponse(_0x81ac('0x22a'),'Error',_0x81ac('0x223')+_0xf738de));}if(_0x5180b3<=0x0||isNaN(_0x5180b3)){return _0x1e6a4e(msgResponse(_0x81ac('0x22a'),_0x81ac('0x89'),_0x81ac('0x224')+_0x5180b3));}if(_0x573581<=0x0||isNaN(_0x573581)){return _0x1e6a4e(msgResponse(_0x81ac('0x22a'),_0x81ac('0x89'),_0x81ac('0x22c')+_0x573581));}_0x3461db=_0x3461db||0x0;var _0xd2949=0x1/_0x3c16ff;var _0x528f62=0x0;var _0x3acec6=0x0;var _0x226fec=0x0;var _0x53a1a0=0x0;for(var _0x324005=0x0;_0x53a1a0<_0x573581;_0x324005+=0x1){_0x3acec6=_0x324005/_0x5180b3;_0x528f62=(_0xf738de*_0x3acec6+_0x3461db)/_0xd2949;_0x226fec=utils[_0x81ac('0x226')](_0x528f62,_0x176776);_0x53a1a0=_0x528f62/_0x176776*(0x1-utils[_0x81ac('0x226')](_0x528f62,_0x176776));}return _0x30df67({'erlangCalls':_0x324005,'erlangCallToSecond':_0x5180b3/_0x324005,'erlangAbandonmentRate':_0x226fec,'erlangBusyFactor':_0x53a1a0});});};module[_0x81ac('0x22d')]=Dialer; \ No newline at end of file +var _0xc737=['outboundAnswerCallsDay','reason','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','getSeconds','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','state','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','merge','pick','idHopper','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','HANGUP','membername','AMD','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','buildObj','countbusyretry','countcongestionretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','custom:amd','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','launchHandleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','busyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[getContactDialerPredictive]','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','erlangb','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\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','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startProgressive','queueBookedRR','syncAgentConnect','bind','originateresponse','agentcomplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','message','NO_AVAILABLE_CONTACTS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','prototype','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','timezones','\x20Timezone\x20unknow\x20','isArray','length','Action','iftime\x20%s,%s','then','content','indexOf','true','push','catch','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Timezone:\x20','resetActiveCalls','syncCampaigns','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','type'];(function(_0x31f4d1,_0x2606e6){var _0x37083c=function(_0x1a8ca7){while(--_0x1a8ca7){_0x31f4d1['push'](_0x31f4d1['shift']());}};_0x37083c(++_0x2606e6);}(_0xc737,0x166));var _0x7c73=function(_0x124bfa,_0x257315){_0x124bfa=_0x124bfa-0x0;var _0x2a9424=_0xc737[_0x124bfa];return _0x2a9424;};'use strict';var util=require(_0x7c73('0x0'));var _=require(_0x7c73('0x1'));var uuid=require(_0x7c73('0x2'));var moment=require(_0x7c73('0x3'));var rr=require('rr');var Redis=require(_0x7c73('0x4'));var utils=require(_0x7c73('0x5'));var hopperUtils=require(_0x7c73('0x6'));var ut=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var logger=require(_0x7c73('0x9'))('dialer');var loggerBooked=require(_0x7c73('0x9'))('booked');var loggerPredictive=require(_0x7c73('0x9'))(_0x7c73('0xa'));var loggerPredictiveCalls=require(_0x7c73('0x9'))(_0x7c73('0xb'));var loggerSyncQueueSummary=require(_0x7c73('0x9'))('syncQueueSummary');var ami=require('../ami');config[_0x7c73('0xc')]=_[_0x7c73('0xd')](config[_0x7c73('0xc')],{'host':_0x7c73('0xe'),'port':0x18eb});var io=require(_0x7c73('0xf'))(new Redis(config[_0x7c73('0xc')]));var cmHopper=require(_0x7c73('0x10'));var voiceQueueRt=require(_0x7c73('0x11'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x7c73('0x12'));var Action=require(_0x7c73('0x13'));var History=require('./models/history');var Final=require(_0x7c73('0x14'));var AgentComplete=require(_0x7c73('0x15'));var QueueCallerAbandon=require(_0x7c73('0x16'));var Hangup=require(_0x7c73('0x17'));var ipAgi=process[_0x7c73('0x18')][_0x7c73('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x7c73('0x1a')]=function(_0x42803f){this[_0x7c73('0x1b')]=this[_0x7c73('0x1b')]?this['tail'][_0x7c73('0x1c')](_0x42803f):_0x42803f();};function Dialer(_0x2aee60,_0x18a958){this[_0x7c73('0x1d')]=new Sequence();this['preview']=_0x18a958;this[_0x7c73('0x1e')]=_0x2aee60[_0x7c73('0x1e')];this[_0x7c73('0x1f')]=_0x2aee60[_0x7c73('0x1f')];this[_0x7c73('0x20')]=_0x2aee60['agents'];this[_0x7c73('0x21')]=_0x2aee60[_0x7c73('0x21')];this['maxNumberOriginate']=config[_0x7c73('0x22')]||0x2;this['channels']={};this['actions']={};this[_0x7c73('0x23')]={};this[_0x7c73('0x24')]={};this[_0x7c73('0x25')]={};this['startPredictive']={};this[_0x7c73('0x26')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x7c73('0x27')]={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x7c73('0x28')][_0x7c73('0x29')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x7c73('0x29')](this));ami['on'](_0x7c73('0x2a'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x7c73('0x2b'),this['syncAgentComplete']['bind'](this));ami['on'](_0x7c73('0x2c'),this[_0x7c73('0x2d')][_0x7c73('0x29')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x7c73('0x29')](this));ami['on'](_0x7c73('0x2e'),this[_0x7c73('0x2f')][_0x7c73('0x29')](this));ami['on'](_0x7c73('0x30'),this[_0x7c73('0x31')]['bind'](this));ami['on'](_0x7c73('0x32'),this[_0x7c73('0x33')][_0x7c73('0x29')](this));ami['on']('queuemember',this[_0x7c73('0x34')][_0x7c73('0x29')](this));ami['on']('queuestatuscomplete',this[_0x7c73('0x35')][_0x7c73('0x29')](this));this[_0x7c73('0x36')]();this[_0x7c73('0x37')]();RpcSetting[_0x7c73('0x38')]()['then'](function(_0x5d2c3b){previewRecallmeReminderInterval=_0x5d2c3b['previewRecallmeReminderInterval'];});}function isNotNull(_0x2bd699){return _0x2bd699!==null&&!_[_0x7c73('0x39')](_0x2bd699);}function msgResponse(_0x433780,_0x178361,_0x3d063d){return{'action':_0x433780,'response':_0x178361,'message':_0x3d063d,'stack':_0x3d063d};}function emit(_0x1faf5d,_0x48c004,_0x2ceb33){io['to'](_0x1faf5d)[_0x7c73('0x3a')](_0x48c004,_0x2ceb33);}function emitOutboundVoiceQueueSummary(_0x5c2c77){if(_0x5c2c77['type']===_0x7c73('0x3b')){logger[_0x7c73('0x3c')](_0x7c73('0x3d'),util[_0x7c73('0x3e')](_0x5c2c77,{'showHidden':![],'depth':null}));emit(util[_0x7c73('0x3f')](_0x7c73('0x40'),_0x5c2c77[_0x7c73('0x41')]),_0x7c73('0x42'),_0x5c2c77);}}function checkGetDataPredictive(_0x5afea3){if(isNotNull(_0x5afea3)&&!_[_0x7c73('0x43')](_0x5afea3)){loggerPredictive[_0x7c73('0x44')](_0x7c73('0x45'));loggerPredictive['info'](_0x7c73('0x46'),_0x5afea3[_0x7c73('0x47')]);loggerPredictive[_0x7c73('0x44')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5afea3['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x48'),_0x5afea3[_0x7c73('0x49')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x4a'),_0x5afea3[_0x7c73('0x4b')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x4c'),_0x5afea3[_0x7c73('0x4d')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x4e'),_0x5afea3[_0x7c73('0x4f')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x50'));if(_0x5afea3['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x5afea3[_0x7c73('0x4f')])&&_0x5afea3[_0x7c73('0x4f')]>0x0){return!![];}loggerPredictive[_0x7c73('0x44')](_0x7c73('0x51'));if(!_[_0x7c73('0x39')](_0x5afea3[_0x7c73('0x4d')])&&_0x5afea3[_0x7c73('0x4d')]>0x0){return!![];}loggerPredictive[_0x7c73('0x44')](_0x7c73('0x52'));}else{loggerPredictive[_0x7c73('0x44')](_0x7c73('0x53'));}}else{loggerPredictive['info'](_0x7c73('0x54'));}return![];}function mergeDataErlangB(_0x4b047b){return function(_0x1213d4){loggerPredictive[_0x7c73('0x44')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x7c73('0x44')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1213d4[_0x7c73('0x55')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x56'),_0x1213d4[_0x7c73('0x57')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x58'),_0x1213d4[_0x7c73('0x59')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x5a'),_0x1213d4[_0x7c73('0x5b')]);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x58'),_0x1213d4['erlangAbandonmentRate']);loggerPredictive[_0x7c73('0x44')]('---------------------------');_['merge'](_0x4b047b,_0x1213d4);};}function ifInterval(_0x3c2590,_0x5e2b51){if(_[_0x7c73('0x39')](_0x5e2b51)){return![];}return utils['getSeconds'](undefined,_0x5e2b51)<_0x3c2590*0x3c;}function clearPredictiveAttributes(_0x5828df){if(_0x5828df['startProgressive']){_0x5828df[_0x7c73('0x26')]=undefined;loggerPredictive['debug'](_0x5828df[_0x7c73('0x41')],_0x7c73('0x5c'));}if(_0x5828df['startPredictive']){_0x5828df[_0x7c73('0x5d')]=undefined;loggerPredictive[_0x7c73('0x3c')](_0x5828df[_0x7c73('0x41')],_0x7c73('0x5e'));}if(_0x5828df[_0x7c73('0x5f')]){clearInterval(_0x5828df[_0x7c73('0x5f')]);_0x5828df[_0x7c73('0x5f')]=undefined;loggerPredictive[_0x7c73('0x3c')](_0x5828df['name'],_0x7c73('0x60'));}}function loggerCatchPredictive(_0x184782,_0x4af421){return function(_0x3e4ac2){loggerPredictive[_0x7c73('0x61')](_0x4af421['name'],_0x184782);loggerPredictive[_0x7c73('0x61')](_0x3e4ac2[_0x7c73('0x62')]);clearPredictiveAttributes(_0x4af421);};}function loggerCatch(_0x5c1ff4){return function(_0x11b4cd){logger[_0x7c73('0x61')](_0x5c1ff4,util['inspect'](_0x11b4cd,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xf37c4f,_0x5d59e7,_0x5ad6c3){return function(_0x5177dd){utils[_0x7c73('0x63')](_0x5d59e7,_0x5ad6c3,0x0);_0x5d59e7[_0x7c73('0x64')]=0x0;logger['error'](_0xf37c4f,util['inspect'](_0x5177dd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x545ab1){return function(_0x6126da){if(isNotNull(_0x6126da)&&isNotNull(_0x6126da[0x0])){if(_0x6126da[0x0][_0x7c73('0x65')]>0x0){_0x545ab1['message']=utils[_0x7c73('0x66')][_0x7c73('0x67')];logger['info']('[getContactDialer2][ReScheduled]'+_0x545ab1[_0x7c73('0x41')],_0x6126da[0x0][_0x7c73('0x65')],_0x7c73('0x68'));}else{_0x545ab1[_0x7c73('0x69')]=utils['CAMPAIGN_STATUS'][_0x7c73('0x6a')];logger[_0x7c73('0x44')]('[getContactDialer2][Empty]'+_0x545ab1['name']);}}};}function createObjHistory(_0x2d2de1,_0x398e3a,_0x55277e,_0x15ec06,_0x8600d8){_0x2d2de1[_0x7c73('0x69')]=_0x55277e;var _0x18dde5=new Action(_0x2d2de1,_0x398e3a);var _0x1175e2=new History(_0x18dde5);_0x1175e2['state']=_0x15ec06;_0x1175e2[_0x7c73('0x6b')]=_0x8600d8;_0x1175e2[_0x7c73('0x6c')]=_0x18dde5[_0x7c73('0x6d')];return _0x1175e2;}function unlockQueueStatus(_0x5d8d23,_0x4f9ed4){setTimeout(function(){if(_[_0x7c73('0x39')](_0x5d8d23[_0x7c73('0x6e')])){loggerBooked['error'](_0x7c73('0x6f'),_0x4f9ed4);}_0x5d8d23[_0x7c73('0x6e')]=!![];loggerBooked[_0x7c73('0x44')](_0x7c73('0x70'),_0x4f9ed4,JSON[_0x7c73('0x71')](_['pick'](_0x5d8d23,[_0x7c73('0x41'),_0x7c73('0x6e')])));},0x1f3);}function checkInterval(_0x4f04d5){return function(){if(!isNotNull(_0x4f04d5[_0x7c73('0x72')])){_0x4f04d5[_0x7c73('0x69')]=utils['CAMPAIGN_STATUS'][_0x7c73('0x73')];throw _0x4f04d5[_0x7c73('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4f04d5[_0x7c73('0x72')]['Intervals'])){_0x4f04d5[_0x7c73('0x69')]=utils[_0x7c73('0x66')]['NULL_INTERVAL'];throw _0x4f04d5['name']+_0x7c73('0x74');}if(!isNotNull(_[_0x7c73('0x43')](_0x4f04d5[_0x7c73('0x72')][_0x7c73('0x75')]))){_0x4f04d5[_0x7c73('0x69')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4f04d5['name']+_0x7c73('0x74');}};}function checkIsIVRCampaignActive(_0x357b3e){return function(){if(!utils['isIVRCampaignActive'](_0x357b3e)){_0x357b3e['message']=utils[_0x7c73('0x66')]['INACTIVE'];throw _0x357b3e[_0x7c73('0x41')]+_0x7c73('0x76');}};}function emitCampaignSummary(_0x32915a){if(utils[_0x7c73('0x77')](_0x32915a)){emit(util['format'](_0x7c73('0x78'),_0x32915a['name']),_0x7c73('0x79'),_0x32915a);}}function loggerCatchQueueSummary(_0x24584d,_0x2689ea){return function(_0x502e0d){clearPredictiveAttributes(_0x2689ea);emitCampaignSummary(_0x2689ea);loggerSyncQueueSummary[_0x7c73('0x3c')](_0x24584d,util['inspect'](_0x502e0d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x47bbe1){if(_0x47bbe1[_0x7c73('0x7a')]){if(_0x47bbe1['originated']===0x0){_0x47bbe1['sendMessageOneNotActive']=![];_0x47bbe1[_0x7c73('0x69')]=utils['CAMPAIGN_STATUS'][_0x7c73('0x7b')];loggerSyncQueueSummary[_0x7c73('0x3c')](_0x7c73('0x7c'),_0x47bbe1[_0x7c73('0x41')],'is\x20not\x20active');}else{_0x47bbe1[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x7d')];loggerSyncQueueSummary[_0x7c73('0x3c')](_0x7c73('0x7c'),_0x47bbe1['name'],_0x7c73('0x7e'));}emitCampaignSummary(_0x47bbe1);}}function myreject(_0x4a6435){return function(_0x571074){return _0x4a6435(msgResponse(_0x7c73('0x7f'),'Error',JSON[_0x7c73('0x71')](_0x571074)));};}Dialer['prototype'][_0x7c73('0x80')]=function(_0xd28f3b){return!_[_0x7c73('0x39')](_0xd28f3b)&&_0xd28f3b&&!_['isUndefined'](_0xd28f3b[_0x7c73('0x41')])&&!_['isUndefined'](_0xd28f3b[_0x7c73('0x81')])&&_0xd28f3b[_0x7c73('0x81')]&&(this[_0x7c73('0x21')][util[_0x7c73('0x3f')]('SIP/%s',_0xd28f3b[_0x7c73('0x41')])][_0x7c73('0x82')]===_0x7c73('0x83')||this['trunks'][util[_0x7c73('0x3f')](_0x7c73('0x84'),_0xd28f3b[_0x7c73('0x41')])][_0x7c73('0x82')]===_0x7c73('0x85'));};Dialer[_0x7c73('0x86')][_0x7c73('0x87')]=function(_0x65440f){var _0x486ae0=this;return function(){if(!_0x486ae0[_0x7c73('0x80')](_0x65440f['Trunk'])){if(!_0x486ae0[_0x7c73('0x80')](_0x65440f['TrunkBackup'])){_0x65440f[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x88')];throw _0x65440f[_0x7c73('0x41')]+_0x7c73('0x89');}}};};Dialer['prototype']['checkIfTime']=function(_0x3f7c6c,_0x5b2b6a,_0x54851b,_0x340016){var _0x3e0198=this;return function(){var _0x109ee0=!![];return _0x3e0198['ifTimeIvr'](_0x3f7c6c,_0x5b2b6a,_0x54851b,_0x340016,_0x109ee0);};};Dialer[_0x7c73('0x86')][_0x7c73('0x8a')]=function(_0x583173,_0x245615,_0x685d53,_0x21b040){var _0x3755c5=this;return function(){var _0x466903=![];return _0x3755c5[_0x7c73('0x8b')](_0x583173[_0x7c73('0x75')],_0x245615,_0x685d53,_0x21b040,_0x466903);};};Dialer[_0x7c73('0x86')][_0x7c73('0x8b')]=function(_0x396fa3,_0x401524,_0x418a58,_0x2ea9fb,_0x3b3f84){var _0x1b694b=[];return new Promise(function(_0x5eea28,_0x543af6){if(!isNotNull(_0x396fa3)){_0x2ea9fb[_0x7c73('0x69')]=utils['CAMPAIGN_STATUS'][_0x7c73('0x73')];return _0x543af6(msgResponse(_0x7c73('0x8c'),'Failure',_0x418a58+_0x7c73('0x8d')));}if(_[_0x7c73('0x43')](_0x396fa3)){_0x2ea9fb[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x8e')];return _0x543af6(msgResponse(_0x7c73('0x8c'),_0x7c73('0x8f'),_0x418a58+'\x20Intervals\x20is\x20empty\x20'));}if(_0x401524&&_[_0x7c73('0x39')](config[_0x7c73('0x90')][_0x401524])){_0x2ea9fb[_0x7c73('0x69')]=utils[_0x7c73('0x66')]['UNKNOWN_TIMEZONE'];return _0x543af6(msgResponse(_0x7c73('0x8c'),'Failure',_0x418a58+_0x7c73('0x91')+_0x401524));}if(_[_0x7c73('0x92')](_0x396fa3)){for(var _0x583f4d=0x0;_0x583f4d<_0x396fa3[_0x7c73('0x93')];_0x583f4d+=0x1){_0x1b694b['push'](ami[_0x7c73('0x94')]({'action':'command','command':util[_0x7c73('0x3f')](_0x7c73('0x95'),_0x396fa3[_0x583f4d]['interval'],!_[_0x7c73('0x39')](config['timezones'][_0x401524])?_0x401524:'')})[_0x7c73('0x96')](function(_0x131547){return _0x131547[_0x7c73('0x97')][_0x7c73('0x98')](_0x7c73('0x99'))>=0x0;})['catch'](myreject(_0x543af6)));}}else{_0x1b694b[_0x7c73('0x9a')](ami[_0x7c73('0x94')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x396fa3,!_['isUndefined'](config[_0x7c73('0x90')][_0x401524])?_0x401524:'')})['then'](function(_0x57e3ee){return _0x57e3ee[_0x7c73('0x97')][_0x7c73('0x98')](_0x7c73('0x99'))>=0x0;})[_0x7c73('0x9b')](myreject(_0x543af6)));}Promise[_0x7c73('0x9c')](_0x1b694b)[_0x7c73('0x96')](function(_0x3d9cbc){var _0x420f33=_[_0x7c73('0x9d')](_0x3d9cbc);if(_0x420f33){return _0x5eea28(_0x420f33);}else{_0x2ea9fb[_0x7c73('0x69')]=_0x3b3f84?utils['CAMPAIGN_STATUS'][_0x7c73('0x9e')]:utils[_0x7c73('0x66')]['OVERTIME_INTERVAL'];return _0x543af6(msgResponse(_0x7c73('0x9f'),_0x7c73('0x8f'),'Global:\x20'+_0x3b3f84+'\x20'+_0x418a58+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7c73('0x3e')](_0x396fa3,{'showHidden':![],'depth':null})+_0x7c73('0xa0')+_0x401524));}})[_0x7c73('0x9b')](function(_0x1288f7){return _0x543af6(msgResponse(_0x7c73('0x8c'),_0x7c73('0x8f'),JSON[_0x7c73('0x71')](_0x1288f7)));});});};Dialer[_0x7c73('0x86')][_0x7c73('0x36')]=function(){var _0x551208=this;return cmHopper[_0x7c73('0xa1')]({'active':![]},{'where':{'active':!![]}})[_0x7c73('0x96')](function(){setInterval(function(){_0x551208[_0x7c73('0xa2')]();},0x3e8);});};Dialer[_0x7c73('0x86')][_0x7c73('0xa2')]=function(){var _0x30092a=this;var _0x318bc9;for(var _0x378d0b in this[_0x7c73('0x1f')]){if(typeof this[_0x7c73('0x1f')][_0x378d0b]!=='undefined'){_0x318bc9=this[_0x7c73('0x1f')][_0x378d0b];if(utils['isIVRCampaign'](_0x318bc9)&&utils[_0x7c73('0xa3')](_0x318bc9)){_0x318bc9['sendMessageOneNotActive']=!![];Promise[_0x7c73('0xa4')]()['then'](checkIsIVRCampaignActive(_0x318bc9))[_0x7c73('0x96')](checkInterval(_0x318bc9))['then'](_0x30092a[_0x7c73('0x87')](_0x318bc9))['then'](_0x30092a['checkIfTime'](_0x318bc9[_0x7c73('0xa5')],_0x318bc9[_0x7c73('0xa6')],_0x318bc9[_0x7c73('0x41')],_0x318bc9))[_0x7c73('0x96')](_0x30092a[_0x7c73('0x8a')](_0x318bc9[_0x7c73('0x72')],_0x318bc9[_0x7c73('0xa6')],_0x318bc9['name'],_0x318bc9))['then'](_0x30092a['launchHandleIvr'](_0x318bc9))[_0x7c73('0x9b')](loggerCatchQueueSummary(_0x7c73('0xa7'),_0x318bc9));}else{notSendMessagesCampaign(_0x318bc9);}}}};Dialer['prototype'][_0x7c73('0xa8')]=function(_0x4ea42c){if(_0x4ea42c[_0x7c73('0xa9')]!==_0x7c73('0xa')){clearPredictiveAttributes(_0x4ea42c);}switch(_0x4ea42c['dialMethod']){case _0x7c73('0xaa'):this[_0x7c73('0xab')](_0x4ea42c,0x1);break;case _0x7c73('0xac'):this[_0x7c73('0xab')](_0x4ea42c,_0x4ea42c[_0x7c73('0xad')]);break;case _0x7c73('0xa'):this[_0x7c73('0xa')](_0x4ea42c);break;case _0x7c73('0xae'):this['handlePower'](_0x4ea42c,0x1);break;default:logger[_0x7c73('0x61')](_0x7c73('0xaf'),_0x4ea42c['name'],_0x7c73('0xb0'));}};Dialer[_0x7c73('0x86')][_0x7c73('0x8c')]=function(_0x1ca9a6,_0x46068e){var _0x4cef72=_0x1ca9a6[_0x7c73('0xa6')];var _0x2a7ea3=_0x46068e?_0x1ca9a6[_0x7c73('0xa5')]:_0x1ca9a6[_0x7c73('0x72')][_0x7c73('0x75')];logger[_0x7c73('0xb1')]('Dialer::ifTime()',_0x2a7ea3,_0x4cef72,_0x1ca9a6[_0x7c73('0x41')],util[_0x7c73('0x3f')](_0x7c73('0xb2'),_0x1ca9a6['name'],_0x1ca9a6['id']));var _0x5f505c=null;return Interval[_0x7c73('0xb3')](_0x2a7ea3,_0x4cef72)[_0x7c73('0x96')](function(_0x4caef9){if(_0x4caef9===!![]){return _0x4caef9;}else{_0x1ca9a6[_0x7c73('0x69')]=_0x46068e?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x7c73('0xb4')];_0x5f505c=msgResponse(_0x7c73('0x9f'),_0x7c73('0x8f'),_0x7c73('0xb5')+_0x46068e+'\x20'+_0x1ca9a6['name']+_0x7c73('0xb6')+util[_0x7c73('0x3e')](_0x2a7ea3,{'showHidden':![],'depth':null})+_0x7c73('0xa0')+_0x4cef72);}if(_0x5f505c!==null){logger[_0x7c73('0xb1')](_0x7c73('0xb7'),_0x5f505c);_0x5f505c[_0x7c73('0xb8')]=_0x46068e;throw _0x5f505c;}})[_0x7c73('0x9b')](function(_0x3ca161){logger['error'](_0x7c73('0xb9'),_0x3ca161);throw msgResponse(_0x7c73('0x7f'),'Error',util[_0x7c73('0x3e')](_0x3ca161,{'showHidden':![],'depth':null}));});};Dialer[_0x7c73('0x86')][_0x7c73('0x28')]=function(_0x1fa147){if(this[_0x7c73('0x1e')][_0x1fa147['queue']]){if(this['uniqueId'][_0x1fa147['uniqueid']]&&this[_0x7c73('0x24')][_0x1fa147[_0x7c73('0xba')]]['type']!==_0x7c73('0xbb')){this[_0x7c73('0xbc')](this['voiceQueues'][_0x1fa147[_0x7c73('0xbd')]]);this[_0x7c73('0x24')][_0x1fa147['uniqueid']][_0x7c73('0xbe')]=moment()[_0x7c73('0x3f')](_0x7c73('0xbf'));}}};Dialer[_0x7c73('0x86')][_0x7c73('0xc0')]=function(_0x282ca1){var _0x411003=this[_0x7c73('0x24')][_0x282ca1[_0x7c73('0xba')]];if(this[_0x7c73('0x1e')][_0x282ca1[_0x7c73('0xbd')]]){if(_0x411003&&_0x411003[_0x7c73('0xc1')]!=='ivr'){delete this[_0x7c73('0x24')][_0x282ca1[_0x7c73('0xba')]];this[_0x7c73('0x1e')][_0x282ca1[_0x7c73('0xbd')]][_0x7c73('0xc2')]+=0x1;var _0x3588de=new AgentComplete(_0x411003,_0x282ca1);if(_0x282ca1[_0x7c73('0xc3')]==='agent'){_0x3588de[_0x7c73('0xc4')]=this[_0x7c73('0x1e')][_0x282ca1[_0x7c73('0xbd')]]['dialQueueProject2']&&this[_0x7c73('0x1e')][_0x282ca1[_0x7c73('0xbd')]][_0x7c73('0xc5')]?moment()[_0x7c73('0x3f')](_0x7c73('0xbf')):undefined;}hopperUtils[_0x7c73('0xc6')](_0x3588de)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xc7')));hopperUtils[_0x7c73('0xc8')](_0x3588de)[_0x7c73('0x9b')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x7c73('0x86')]['syncQueueCallerAbandon']=function(_0x21430d){var _0x236844=this['uniqueId'][_0x21430d['uniqueid']];var _0x5bfbe7=this;var _0x4db16e=![];var _0x826e05;var _0x43ed55;if(this[_0x7c73('0x1e')][_0x21430d['queue']]){if(_0x236844&&_0x236844[_0x7c73('0xc1')]!==_0x7c73('0xbb')){delete this[_0x7c73('0x24')][_0x21430d[_0x7c73('0xba')]];this['updateOriginated'](this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]]);_0x236844[_0x7c73('0xc9')]=moment()[_0x7c73('0x3f')](_0x7c73('0xbf'));var _0x4d8d52=new QueueCallerAbandon(_0x236844,_0x21430d);if(utils[_0x7c73('0xca')](_0x236844[_0x7c73('0xc9')],_0x236844['responsetime'])>=_0x236844[_0x7c73('0xcb')]){this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0x49')]+=0x1;this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xcc')]+=0x1;this['voiceQueues'][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xcd')]+=0x1;_0x4d8d52['state']=0xa;_0x4d8d52[_0x7c73('0x6b')]=_0x7c73('0xce');_0x4d8d52[_0x7c73('0xcf')]=_0x7c73('0xd0');_0x4d8d52[_0x7c73('0xc4')]=this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]]['dialQueueProject2']?moment()[_0x7c73('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4d8d52[_0x7c73('0xd1')]+=0x1;_0x4d8d52['countglobal']+=0x1;_0x826e05=this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]]['dialDropRetryFrequency'];_0x43ed55=this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xd2')];hopperUtils[_0x7c73('0xd3')](_0x4d8d52,_0x4d8d52[_0x7c73('0xd4')],_0x236844[_0x7c73('0xd5')])[_0x7c73('0x96')](function(_0x2f6aa8){_0x4db16e=_0x2f6aa8[_0x7c73('0xd6')]==0x1;if(_0x4d8d52[_0x7c73('0xd1')]>=_0x5bfbe7[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xd7')]){_0x5bfbe7[_0x7c73('0xd8')](_0x4d8d52,_0x2f6aa8[_0x7c73('0xd6')]);}else{hopperUtils[_0x7c73('0xd9')]({'active':![],'countdropretry':_0x4d8d52[_0x7c73('0xd1')],'scheduledat':moment()[_0x7c73('0xda')](_0x5bfbe7[_0x7c73('0x1e')][_0x21430d['queue']][_0x7c73('0xdb')],_0x7c73('0xdc'))[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0x236844[_0x7c73('0xdd')],'ListId':_0x236844[_0x7c73('0xde')],'VoiceQueueId':_0x236844[_0x7c73('0xdf')]||undefined,'CampaignId':_0x236844['CampaignId']||undefined})['catch'](loggerCatch(_0x7c73('0xe0')));var _0x25f87a=new History(_0x4d8d52);_0x25f87a['state']=0xa;_0x25f87a[_0x7c73('0x6b')]=_0x7c73('0xce');_0x25f87a[_0x7c73('0x6d')]=moment()['format'](_0x7c73('0xbf'));_0x25f87a[_0x7c73('0x6c')]=_0x25f87a[_0x7c73('0x6d')];_0x25f87a['calleridname']=_0x4d8d52[_0x7c73('0xe1')];_0x25f87a['calleridnum']=_0x4d8d52[_0x7c73('0xe2')];hopperUtils['createHistory'](_0x25f87a)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xe3')));}})[_0x7c73('0x96')](function(){if(_0x4db16e)hopperUtils[_0x7c73('0xe4')](_0x4d8d52,_0x826e05,_0x43ed55)[_0x7c73('0x96')](function(){return 0x1;});});}else{this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xe5')]+=0x1;_0x4d8d52[_0x7c73('0xd4')]=0xb;_0x4d8d52[_0x7c73('0x6b')]=_0x7c73('0xe6');_0x4d8d52[_0x7c73('0xcf')]=_0x7c73('0xe7');_0x4d8d52[_0x7c73('0xe8')]+=0x1;_0x4d8d52[_0x7c73('0xe9')]+=0x1;_0x826e05=this[_0x7c73('0x1e')][_0x21430d['queue']][_0x7c73('0xea')];_0x43ed55=this[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xd2')];hopperUtils[_0x7c73('0xd3')](_0x4d8d52,_0x4d8d52['state'],_0x236844['voiceQueue'])['then'](function(_0x1d3771){if(_0x4d8d52[_0x7c73('0xe8')]>=_0x5bfbe7[_0x7c73('0x1e')][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xeb')]){_0x5bfbe7[_0x7c73('0xd8')](_0x4d8d52,_0x1d3771[_0x7c73('0xd6')]);}else{hopperUtils[_0x7c73('0xd9')]({'active':![],'countabandonedretry':_0x4d8d52['countabandonedretry'],'scheduledat':moment()[_0x7c73('0xda')](_0x5bfbe7['voiceQueues'][_0x21430d[_0x7c73('0xbd')]][_0x7c73('0xea')],_0x7c73('0xdc'))['format'](_0x7c73('0xbf')),'ContactId':_0x236844['ContactId'],'ListId':_0x236844['ListId'],'VoiceQueueId':_0x236844[_0x7c73('0xdf')]||undefined,'CampaignId':_0x236844[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xed')));var _0x3cd8a2=new History(_0x4d8d52);_0x3cd8a2[_0x7c73('0xd4')]=0xb;_0x3cd8a2[_0x7c73('0x6b')]=_0x7c73('0xe6');_0x3cd8a2[_0x7c73('0x6d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3cd8a2[_0x7c73('0x6c')]=_0x3cd8a2[_0x7c73('0x6d')];_0x3cd8a2[_0x7c73('0xe1')]=_0x4d8d52[_0x7c73('0xe1')];_0x3cd8a2[_0x7c73('0xe2')]=_0x4d8d52[_0x7c73('0xe2')];hopperUtils['createHistory'](_0x3cd8a2)['catch'](loggerCatch(_0x7c73('0xee')));}})[_0x7c73('0x96')](function(){if(_0x4db16e)hopperUtils['swapAdditionalPhones'](_0x4d8d52,_0x826e05,_0x43ed55)['then'](function(){return 0x1;});});}}}};Dialer[_0x7c73('0x86')][_0x7c73('0x31')]=function(_0x537f1b){if(this[_0x7c73('0xef')][_0x537f1b[_0x7c73('0xba')]]){this['actions'][_0x537f1b['uniqueid']][_0x7c73('0xf0')]=_0x537f1b['channel'];}if(this[_0x7c73('0x24')][_0x537f1b[_0x7c73('0xba')]]){this[_0x7c73('0x24')][_0x537f1b['uniqueid']][_0x7c73('0xf0')]=_0x537f1b[_0x7c73('0xf0')];}};Dialer[_0x7c73('0x86')][_0x7c73('0x34')]=function(_0x10417c){if(!this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]]){return;}var _0x78caba=this[_0x7c73('0x1e')][this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]][_0x7c73('0xbd')]][_0x7c73('0xf2')]||_0x7c73('0xf3');if(_0x78caba===_0x7c73('0xf4')){if(this['actions'][_0x10417c[_0x7c73('0xf1')]]&&_[_0x7c73('0xf5')](this[_0x7c73('0xef')][_0x10417c['actionid']][_0x7c73('0xf6')])&&_0x10417c['status']==='1'&&_0x10417c[_0x7c73('0xf7')]==='0'){if(this[_0x7c73('0x20')][_0x10417c[_0x7c73('0xf8')]]){if(!this['agents'][_0x10417c['stateinterface']]['locked']){this[_0x7c73('0x20')][_0x10417c[_0x7c73('0xf8')]][_0x7c73('0xf6')]=!![];this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]]['locked']=!![];this['actions'][_0x10417c[_0x7c73('0xf1')]][_0x7c73('0xf8')]=_0x10417c[_0x7c73('0xf8')];}}}}else if(_0x78caba==='rrmemory'){if(this['actions'][_0x10417c[_0x7c73('0xf1')]]){if(this[_0x7c73('0x20')][_0x10417c[_0x7c73('0xf8')]]){this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]][_0x7c73('0xf8')]=_0x10417c[_0x7c73('0xf8')];if(_[_0x7c73('0xf5')](this[_0x7c73('0xf9')][this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]][_0x7c73('0xbd')]])){this[_0x7c73('0xf9')][this[_0x7c73('0xef')][_0x10417c[_0x7c73('0xf1')]]['queue']]=[];}this[_0x7c73('0xf9')][this['actions'][_0x10417c[_0x7c73('0xf1')]][_0x7c73('0xbd')]]['push'](_[_0x7c73('0xfa')](_[_0x7c73('0xfb')](this['actions'][_0x10417c[_0x7c73('0xf1')]],[_0x7c73('0xfc'),_0x7c73('0xf8')]),{'status':_0x10417c[_0x7c73('0x82')],'paused':_0x10417c[_0x7c73('0xf7')]}));}}}};Dialer[_0x7c73('0x86')][_0x7c73('0x35')]=function(_0x240752){if(!this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]]){return;}var _0x5b0811=this;var _0x42eeb7=this[_0x7c73('0x1e')][this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]];var _0x406cf5=_0x42eeb7['strategy']||_0x7c73('0xf3');if(_0x406cf5===_0x7c73('0xf4')){if(this[_0x7c73('0xef')][_0x240752['actionid']]&&this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xf8')]){this[_0x7c73('0xfd')][_0x7c73('0xfe')](this['actions'][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xfc')],this['actions'][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xf8')])[_0x7c73('0x9b')](function(_0x247524){logger['error'](_0x7c73('0xff'),util[_0x7c73('0x3e')](_0x247524,{'showHidden':![],'depth':null}));})[_0x7c73('0x1c')](function(){_0x5b0811[_0x7c73('0xbc')](_0x5b0811[_0x7c73('0x1e')][_0x5b0811[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]]);_0x5b0811[_0x7c73('0x20')][_0x5b0811['actions'][_0x240752['actionid']][_0x7c73('0xf8')]][_0x7c73('0xf6')]=![];delete _0x5b0811[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]];unlockQueueStatus(_0x42eeb7);});}else{this[_0x7c73('0xbc')](this[_0x7c73('0x1e')][this[_0x7c73('0xef')][_0x240752['actionid']][_0x7c73('0xbd')]]);hopperUtils[_0x7c73('0xd9')]({'active':![],'ContactId':this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xdd')],'ListId':this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xde')],'VoiceQueueId':this[_0x7c73('0xef')][_0x240752['actionid']][_0x7c73('0xdf')]||undefined,'CampaignId':this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x100')));delete this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]];unlockQueueStatus(_0x42eeb7);}}else if(_0x406cf5==='rrmemory'){var _0x4724c7;if(this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]])){if(this[_0x7c73('0x27')][_0x5b0811[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]]){this[_0x7c73('0x27')][_0x5b0811[_0x7c73('0xef')][_0x240752['actionid']]['queue']]=this[_0x7c73('0x27')][this[_0x7c73('0xef')][_0x240752['actionid']][_0x7c73('0xbd')]]?this[_0x7c73('0x27')][this[_0x7c73('0xef')][_0x240752['actionid']][_0x7c73('0xbd')]]:this[_0x7c73('0xf9')][this['actions'][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]]?this['queueBooked'][this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]][_0x7c73('0xbd')]][_0x7c73('0x101')]||0x0:0x0;}this[_0x7c73('0xf9')][this['actions'][_0x240752[_0x7c73('0xf1')]]['queue']][_0x7c73('0x101')]=this[_0x7c73('0x27')][this[_0x7c73('0xef')][_0x240752[_0x7c73('0xf1')]]['queue']];for(var _0x142d28=0x0;_0x142d28=_0x3f640d['dialGlobalMaxRetry']){_0x4b67a1[_0x7c73('0x123')](_0x175b4c,_0x2830b1,_0x344772,_0x7c73('0x124'));}else{if(_0x175b4c[_0x7c73('0x11e')]>=_0x3f640d['dialMachineMaxRetry']){_0x4b67a1[_0x7c73('0x125')](_0x175b4c,_0x2830b1,_0x344772,_0x7c73('0x126'));}else{hopperUtils[_0x7c73('0xd9')]({'active':![],'countmachineretry':_0x175b4c['countmachineretry'],'scheduledat':moment()[_0x7c73('0xda')](_0x3f640d[_0x7c73('0x127')],_0x7c73('0xdc'))[_0x7c73('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x175b4c[_0x7c73('0xdd')],'ListId':_0x175b4c[_0x7c73('0xde')],'VoiceQueueId':_0x175b4c[_0x7c73('0xdf')]||undefined,'CampaignId':_0x175b4c[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x128')));_0x2830b1({'reschedule':0x1});}}});}if(_0x40c0f4[_0x7c73('0xc1')]==='ivr'&&this[_0x7c73('0x1f')][_0x40c0f4[_0x7c73('0xbd')]][_0x7c73('0x119')]&&_0x1d45ca[_0x7c73('0x11a')]==='HANGUP'){delete this[_0x7c73('0x24')][_0x1d45ca[_0x7c73('0xba')]];this[_0x7c73('0xbc')](this[_0x7c73('0x1f')][_0x40c0f4[_0x7c73('0xbd')]]);_0x5264ca=new Hangup(_0x40c0f4,_0x1d45ca);_0x5264ca['state']=0x12;_0x5264ca['statedesc']=_0x7c73('0x129');_0x5264ca[_0x7c73('0x114')]=_0x7c73('0x115');ami[_0x7c73('0x3a')](_0x7c73('0x12a'),ut[_0x7c73('0x11f')](_0x5264ca,_0x7c73('0x116')));this[_0x7c73('0x117')](_0x5264ca,_0x7c73('0x12b'),_0x7c73('0x12c'));}if(_0x40c0f4[_0x7c73('0xc1')]==='ivr'&&this[_0x7c73('0x1f')][_0x40c0f4[_0x7c73('0xbd')]][_0x7c73('0x119')]&&_0x1d45ca[_0x7c73('0x11a')]===_0x7c73('0x11b')){return new Promise(function(_0x197a37,_0x46c9f7){delete _0x4b67a1[_0x7c73('0x24')][_0x1d45ca[_0x7c73('0xba')]];_0x4b67a1['updateOriginated'](_0x4b67a1[_0x7c73('0x1f')][_0x40c0f4[_0x7c73('0xbd')]]);_0x4b67a1[_0x7c73('0x1f')][_0x40c0f4['queue']][_0x7c73('0xc2')]+=0x1;_0x4b67a1[_0x7c73('0x1f')][_0x40c0f4[_0x7c73('0xbd')]][_0x7c73('0x11c')]+=0x1;var _0x5122c3=_0x4b67a1['campaigns'][_0x40c0f4['queue']];var _0x325968=new Hangup(_0x40c0f4,_0x1d45ca);_0x325968['state']=0x13;_0x325968[_0x7c73('0x6b')]=_0x7c73('0x11d');_0x325968[_0x7c73('0x114')]='AMD';_0x325968['countmachineretry']+=0x1;_0x325968[_0x7c73('0xe9')]+=0x1;_0x325968[_0x7c73('0x116')]=!![];ami['emit'](_0x7c73('0x12a'),ut[_0x7c73('0x11f')](_0x325968,_0x7c73('0x116')));hopperUtils[_0x7c73('0xc6')](_0x325968)[_0x7c73('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x325968[_0x7c73('0x120')]+_0x325968[_0x7c73('0x121')]+_0x325968[_0x7c73('0x12d')]+_0x325968[_0x7c73('0x122')]+_0x325968[_0x7c73('0xd1')]+_0x325968[_0x7c73('0xe8')]+_0x325968[_0x7c73('0x11e')]+_0x325968[_0x7c73('0x12e')]>=_0x5122c3[_0x7c73('0x12f')]){_0x4b67a1[_0x7c73('0x123')](_0x325968,_0x197a37,_0x46c9f7,_0x7c73('0x124'));}else{if(_0x325968[_0x7c73('0x11e')]>=_0x5122c3[_0x7c73('0x130')]){_0x4b67a1[_0x7c73('0x125')](_0x325968,_0x197a37,_0x46c9f7,_0x7c73('0x126'));}else{hopperUtils[_0x7c73('0xd9')]({'active':![],'countmachineretry':_0x325968[_0x7c73('0x11e')],'scheduledat':moment()['add'](_0x5122c3['dialMachineRetryFrequency'],_0x7c73('0xdc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x325968[_0x7c73('0xdd')],'ListId':_0x325968['ListId'],'VoiceQueueId':_0x325968[_0x7c73('0xdf')]||undefined,'CampaignId':_0x325968[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch('[rescheduleContact][Machine]'));_0x197a37({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x7c73('0x2f')]=function(_0x512b0f){var _0x5f52e4=this[_0x7c73('0x24')][_0x512b0f['uniqueid']];var _0x339b13;if(_0x5f52e4&&_0x5f52e4[_0x7c73('0xc1')]===_0x7c73('0xbb')){delete this[_0x7c73('0x24')][_0x512b0f[_0x7c73('0xba')]];this['updateOriginated'](this[_0x7c73('0x1f')][_0x5f52e4[_0x7c73('0xbd')]]);this['campaigns'][_0x5f52e4[_0x7c73('0xbd')]][_0x7c73('0x131')]+=0x1;_0x339b13=new Hangup(_0x5f52e4,_0x512b0f);hopperUtils['createHistory'](_0x339b13)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7c73('0xc8')](_0x339b13)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x5f52e4&&_0x5f52e4['type']!==_0x7c73('0xbb')&&isNotNull(this[_0x7c73('0x1e')][_0x5f52e4[_0x7c73('0xbd')]][_0x7c73('0x132')])){delete this[_0x7c73('0x24')][_0x512b0f['uniqueid']];this[_0x7c73('0xbc')](this[_0x7c73('0x1e')][_0x5f52e4[_0x7c73('0xbd')]]);this[_0x7c73('0x1e')][_0x5f52e4[_0x7c73('0xbd')]][_0x7c73('0xc2')]+=0x1;this[_0x7c73('0x1e')][_0x5f52e4[_0x7c73('0xbd')]][_0x7c73('0x11c')]+=0x1;_0x339b13=new Hangup(_0x5f52e4,_0x512b0f);_0x339b13['state']=0x10;_0x339b13[_0x7c73('0x6b')]=_0x7c73('0x133');_0x339b13[_0x7c73('0x114')]=_0x7c73('0x134');hopperUtils[_0x7c73('0xc6')](_0x339b13)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x135')));hopperUtils['moveContactManagedDialer'](_0x339b13)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x136')));}if(_0x5f52e4&&_0x5f52e4['type']!==_0x7c73('0xbb')&&!isNotNull(this[_0x7c73('0x1e')][_0x5f52e4[_0x7c73('0xbd')]][_0x7c73('0x132')])){delete this[_0x7c73('0x24')][_0x512b0f[_0x7c73('0xba')]];this[_0x7c73('0xbc')](this[_0x7c73('0x1e')][_0x5f52e4['queue']]);this[_0x7c73('0x1e')][_0x5f52e4['queue']][_0x7c73('0x137')]+=0x1;_0x339b13=new Hangup(_0x5f52e4,_0x512b0f);_0x339b13['state']=0xc;_0x339b13[_0x7c73('0x6b')]=_0x512b0f[_0x7c73('0x138')];_0x339b13[_0x7c73('0x114')]=_0x7c73('0x139');hopperUtils[_0x7c73('0xc6')](_0x339b13)[_0x7c73('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7c73('0xc8')](_0x339b13)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x136')));}};Dialer[_0x7c73('0x86')][_0x7c73('0x2d')]=function(_0xd4dd81){var _0x2c9d3d=this;if(!_0x2c9d3d[_0x7c73('0x13a')][_0xd4dd81[_0x7c73('0x41')]]){_0x2c9d3d['queuesSummary'][_0xd4dd81[_0x7c73('0x41')]]={'running':![]};}else if(_0x2c9d3d[_0x7c73('0x13a')][_0xd4dd81[_0x7c73('0x41')]][_0x7c73('0x13b')]===!![]){return;}else if(_0x2c9d3d[_0x7c73('0x13a')][_0xd4dd81['name']][_0x7c73('0x13b')]===![]){_0x2c9d3d[_0x7c73('0x13a')][_0xd4dd81[_0x7c73('0x41')]][_0x7c73('0x13b')]=!![];}var _0x5c1ecc=_0x2c9d3d['voiceQueues'][_0xd4dd81[_0x7c73('0x41')]];var _0x158a6f=_0x5c1ecc[_0x7c73('0x69')]!==utils['CAMPAIGN_STATUS'][_0x7c73('0x7b')];var _0x33e43d=utils[_0x7c73('0x13c')](_0x5c1ecc);_0x5c1ecc[_0x7c73('0x13d')]=utils[_0x7c73('0x13e')](_0x5c1ecc,_0x2c9d3d[_0x7c73('0x21')]);Promise['resolve']()[_0x7c73('0x96')](function(){if(_0x5c1ecc[_0x7c73('0x13d')]===utils[_0x7c73('0x66')][_0x7c73('0x7b')]){if(_0x158a6f){clearPredictiveAttributes(_0x5c1ecc);_0xd4dd81[_0x7c73('0x5d')]=undefined;_0xd4dd81[_0x7c73('0x26')]=undefined;}if(_0x5c1ecc[_0x7c73('0x13d')]===utils[_0x7c73('0x66')][_0x7c73('0x7b')]){_0xd4dd81[_0x7c73('0x13f')]=0x0;_0xd4dd81[_0x7c73('0xf7')]=0x0;_0xd4dd81[_0x7c73('0x140')]=0x0;_0xd4dd81[_0x7c73('0x141')]=0x0;_0xd4dd81[_0x7c73('0x142')]=0x0;}}else if(_0x5c1ecc['statusMessage']===utils[_0x7c73('0x66')][_0x7c73('0x143')]&&!_0x33e43d){return _0x2c9d3d[_0x7c73('0x8c')](_0x5c1ecc,!![])[_0x7c73('0x96')](function(){return _0x2c9d3d['ifTime'](_0x5c1ecc,![]);})[_0x7c73('0x96')](function(){return _0x2c9d3d[_0x7c73('0xa8')](_0x5c1ecc);})['catch'](function(_0x2eca47){loggerSyncQueueSummary['debug'](_0x7c73('0x144'),util[_0x7c73('0x3e')](_0x2eca47,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5c1ecc);});}else{clearPredictiveAttributes(_0x5c1ecc);}})[_0x7c73('0x96')](function(){var _0x187da7=_0xd4dd81['compareToOutboundQueue'](_0x5c1ecc);if(_0x187da7||_0x5c1ecc['queueSummaryCountersUpdated']){_0x5c1ecc[_0x7c73('0x145')]=![];_0xd4dd81[_0x7c73('0x146')](_0x5c1ecc);Object[_0x7c73('0x147')](_0x5c1ecc,_0xd4dd81);emitOutboundVoiceQueueSummary(_0xd4dd81);}_0x2c9d3d[_0x7c73('0x13a')][_0x5c1ecc[_0x7c73('0x41')]][_0x7c73('0x13b')]=![];})[_0x7c73('0x9b')](function(_0x499e31){logger[_0x7c73('0x61')](_0x7c73('0x144'),util[_0x7c73('0x3e')](_0x499e31,{'showHidden':![],'depth':null}));_0x2c9d3d[_0x7c73('0x13a')][_0x5c1ecc[_0x7c73('0x41')]][_0x7c73('0x13b')]=![];});};Dialer[_0x7c73('0x86')][_0x7c73('0x148')]=_[_0x7c73('0x149')](function(){var _0x3fc8a9=_[_0x7c73('0x14a')](this['voiceQueues'],function(_0x51ab6d){return _0x51ab6d[_0x7c73('0x14b')];});var _0x50b66a=_[_0x7c73('0x14a')](this[_0x7c73('0x20')],function(_0x187230){return _0x187230[_0x7c73('0x14c')]&&_0x187230[_0x7c73('0x82')]===_0x7c73('0x83');});if(_0x3fc8a9['length']>0x0&&_0x50b66a[_0x7c73('0x93')]>0x0){return Promise[_0x7c73('0xa4')]()[_0x7c73('0x96')](cmHopper[_0x7c73('0x14d')](_['map'](_0x3fc8a9,'id'),previewRecallmeReminderInterval,_[_0x7c73('0x14e')](_0x50b66a,'id')))['then'](function(_0x5f5471){for(var _0x8e70fb=0x0;_0x8e70fb<_0x5f5471[_0x7c73('0x93')];_0x8e70fb++){var _0x608a88=_0x5f5471[_0x8e70fb][_0x7c73('0x14f')][_0x7c73('0x41')];if(_0x608a88)io['to'](util[_0x7c73('0x3f')](_0x7c73('0x150'),_0x608a88))[_0x7c73('0x3a')]('user:dialPreviewRecallReminder',{'hopper':_0x5f5471[_0x8e70fb]});}})[_0x7c73('0x9b')](function(_0x21b65e){logger['error'](_0x7c73('0x151'),_0x21b65e);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x7c73('0x37')]=function(){var _0x537d56=this;setInterval(function(){_0x537d56[_0x7c73('0x152')](_0x537d56[_0x7c73('0x24')],_0x7c73('0x153'));_0x537d56[_0x7c73('0x152')](_0x537d56[_0x7c73('0xef')],_0x7c73('0x154'));},0x32c8);};Dialer['prototype'][_0x7c73('0x152')]=function(_0x283b65,_0x485610){var _0x2f97db=this;for(var _0x232fec in _0x283b65){if(typeof _0x283b65[_0x232fec]!==_0x7c73('0x155')){this[_0x7c73('0x1d')][_0x7c73('0x1a')](function(){if(!_['isNil'](_0x283b65[_0x232fec])){return ami[_0x7c73('0x94')]({'action':'status','channel':_0x283b65[_0x232fec][_0x7c73('0xf0')]})[_0x7c73('0x9b')](function(_0x5c6b70){if(_0x5c6b70[_0x7c73('0x69')]===_0x7c73('0x156')){setTimeout(function(){if(_0x283b65[_0x232fec]&&_0x283b65[_0x232fec]['type']!=='ivr'){_0x2f97db[_0x7c73('0xbc')](_0x2f97db[_0x7c73('0x1e')][_0x283b65[_0x232fec][_0x7c73('0xbd')]]);logger[_0x7c73('0x61')](_0x7c73('0x157'),_0x485610,_0x232fec,_0x283b65[_0x232fec][_0x7c73('0xbd')]);delete _0x283b65[_0x232fec];}if(_0x283b65[_0x232fec]&&_0x283b65[_0x232fec]['type']===_0x7c73('0xbb')){_0x2f97db[_0x7c73('0xbc')](_0x2f97db[_0x7c73('0x1f')][_0x283b65[_0x232fec][_0x7c73('0xbd')]]);logger[_0x7c73('0x61')](_0x7c73('0x158'),_0x485610,_0x232fec,_0x283b65[_0x232fec]['queue']);delete _0x283b65[_0x232fec];}},0x2328);}});}});}}};Dialer[_0x7c73('0x86')][_0x7c73('0x159')]=function(_0x545686){return Promise[_0x7c73('0xa4')]()[_0x7c73('0x96')](voiceQueueRt['getVoiceQueueRtPauses'](_0x545686))[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x15a')));};Dialer['prototype'][_0x7c73('0xbc')]=function(_0x322e4d){if(!_['isUndefined'](_0x322e4d)&&_0x322e4d!==null){if(typeof _0x322e4d[_0x7c73('0x15b')]!==_0x7c73('0x155')){if(_0x322e4d['originated']>0x0){_0x322e4d[_0x7c73('0x15b')]-=0x1;}else{logger[_0x7c73('0x61')](_0x7c73('0x15c'));}}}else{logger[_0x7c73('0x61')](_0x7c73('0x15d'));}};Dialer['prototype'][_0x7c73('0x15e')]=function(_0xa9f735,_0x1af2e5){var _0xad13e4=this;return function(_0x376262){_0xad13e4[_0x7c73('0xbc')](_0x1af2e5);logger['error'](_0xa9f735,util[_0x7c73('0x3e')](_0x376262,{'showHidden':![],'depth':null}));};};Dialer[_0x7c73('0x86')][_0x7c73('0x15f')]=function(_0x467468,_0x5b071d,_0x4a9e43){var _0xfc22b4={'state':0x19,'statedesc':_0x7c73('0x160')};this[_0x7c73('0xbc')](_0x5b071d);this['saveInDb'](_[_0x7c73('0xfa')](_0xfc22b4,_['pick'](_0x4a9e43,[_0x7c73('0xdd'),_0x7c73('0xde'),_0x7c73('0x161'),_0x7c73('0xdf'),_0x7c73('0xec')])),_0x7c73('0x162'),_0x7c73('0x163'));logger[_0x7c73('0x61')](_0x467468);};Dialer[_0x7c73('0x86')][_0x7c73('0x117')]=function(_0x22a932,_0x3e658b,_0x1a4ee9){hopperUtils['createHistory'](_0x22a932)[_0x7c73('0x9b')](loggerCatch(_0x3e658b));hopperUtils[_0x7c73('0xc8')](_0x22a932)['catch'](loggerCatch(_0x1a4ee9));};Dialer[_0x7c73('0x86')]['queueCallerAbandonCreateState']=function(_0x255b44,_0x11f47a){hopperUtils[_0x7c73('0xc6')](_0x255b44)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xc7')));if(_0x11f47a==0x0){hopperUtils['moveContactManagedDialer'](_0x255b44)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x164')));}};Dialer[_0x7c73('0x86')]['checkPreviewRecallReminder']=function(_0x2c44d3){return Promise[_0x7c73('0xa4')]()['then'](cmHopper[_0x7c73('0x14d')](_0x2c44d3['id'],previewRecallmeReminderInterval))[_0x7c73('0x96')](function(_0x35ee05){for(var _0x3bd759=0x0;_0x3bd759<_0x35ee05[_0x7c73('0x93')];_0x3bd759++){var _0x4c6c6c=_0x35ee05[_0x3bd759][_0x7c73('0x14f')][_0x7c73('0x41')];if(_0x4c6c6c)io['to'](util['format'](_0x7c73('0x150'),_0x4c6c6c))[_0x7c73('0x3a')](_0x7c73('0x165'),{'hopper':_0x35ee05[_0x3bd759]});}})[_0x7c73('0x9b')](function(){});};Dialer[_0x7c73('0x86')][_0x7c73('0x166')]=function(_0x27bdba){var _0x53b2af=this;return function(){_0x53b2af['handleIvr'](_0x27bdba);};};Dialer[_0x7c73('0x86')][_0x7c73('0x167')]=function(_0x2a0d65,_0x466047){var _0x27430b=this;var _0x27261d=uuid['v4']();this[_0x7c73('0xef')][_0x27261d]=new Action(_0x2a0d65,_0x466047,_0x27261d);return new Promise(function(_0x3aea65,_0x2922b1){if(_['isUndefined'](_0x2a0d65)&&typeof _0x2a0d65!==_0x7c73('0x168')){return _0x2922b1(msgResponse(_0x7c73('0x169'),_0x7c73('0x8f'),_0x7c73('0x16a')));}if(_[_0x7c73('0x39')](_0x466047['phone'])||_0x466047[_0x7c73('0x16b')]===null){return _0x2922b1(msgResponse('originate',_0x7c73('0x8f'),_0x7c73('0x16c')));}var _0x59573d={'XMD-CALLERID':_0x27430b[_0x7c73('0xef')][_0x27261d][_0x7c73('0x16d')](),'XMD-AGI':_0x2a0d65[_0x7c73('0x132')]?util[_0x7c73('0x3f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2a0d65[_0x7c73('0x132')]):_0x7c73('0x16e'),'XMD-AGIAFTER':_0x2a0d65[_0x7c73('0x16f')]?util[_0x7c73('0x3f')](_0x7c73('0x170'),ipAgi,_0x2a0d65[_0x7c73('0x16f')]):_0x7c73('0x16e'),'XMD-QUEUE':utils[_0x7c73('0x171')](_0x2a0d65)?util[_0x7c73('0x3f')](_0x7c73('0x172'),_0x2a0d65[_0x7c73('0x41')],_0x2a0d65[_0x7c73('0x173')]||'',_0x2a0d65[_0x7c73('0xc5')]?'c':'',_0x2a0d65['dialQueueTimeout']||0x3):_0x7c73('0x16e'),'XMD-CONTACTID':_0x466047[_0x7c73('0xdd')],'XMD-CDRTYPE':_0x7c73('0x174'),'CALLERID(all)':_0x27430b[_0x7c73('0xef')][_0x27261d][_0x7c73('0x16d')](),'XMD-AMD':_0x2a0d65['dialAMDActive']?'ACTIVE':_0x7c73('0x16e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2a0d65['dialAMDActive']){_0x59573d[_0x7c73('0x175')]=_0x2a0d65['dialAMDInitialSilence']||0x9c4;_0x59573d[_0x7c73('0x176')]=_0x2a0d65[_0x7c73('0x177')]||0x5dc;_0x59573d['XMD-AMDAFTERGREETINGSILENCE']=_0x2a0d65[_0x7c73('0x178')]||0x320;_0x59573d[_0x7c73('0x179')]=_0x2a0d65['dialAMDTotalAnalysisTime']||0x1388;_0x59573d[_0x7c73('0x17a')]=_0x2a0d65[_0x7c73('0x17b')]||0x64;_0x59573d['XMD-AMDBETWEENWORDSSILENCE']=_0x2a0d65['dialAMDBetweenWordsSilence']||0x32;_0x59573d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2a0d65['dialAMDMaximumNumberOfWords']||0x3;_0x59573d[_0x7c73('0x17c')]=_0x2a0d65['dialAMDSilenceThreshold']||0x100;_0x59573d['XMD-AMDMAXIMUMWORDLENGTH']=_0x2a0d65[_0x7c73('0x17d')]||0x1388;}if(utils[_0x7c73('0x171')](_0x2a0d65)){_0x59573d[_0x7c73('0x17e')]=_0x466047[_0x7c73('0xdf')];}else{_0x59573d['XMD-CAMPAIGNID']=_0x466047[_0x7c73('0xec')];}var _0x125f68=utils[_0x7c73('0x17f')](_0x466047[_0x7c73('0x180')]);Object[_0x7c73('0x147')](_0x59573d,_0x125f68);var _0x5931cc=_0x27430b[_0x7c73('0x80')](_0x2a0d65[_0x7c73('0x181')])?utils[_0x7c73('0x182')](_0x2a0d65[_0x7c73('0x181')][_0x7c73('0x183')],_0x2a0d65['dialOriginateCallerIdName'],_0x2a0d65[_0x7c73('0x184')]>0x0?utils['getCallerIdRandom'](_0x2a0d65[_0x7c73('0x185')],_0x2a0d65['dialRandomLastDigitCallerIdNumber']):_0x2a0d65[_0x7c73('0x185')]):utils[_0x7c73('0x182')](_[_0x7c73('0xf5')](_0x2a0d65['TrunkBackup'])?_0x2a0d65[_0x7c73('0x181')][_0x7c73('0x183')]:_0x2a0d65[_0x7c73('0x186')][_0x7c73('0x183')],_0x2a0d65[_0x7c73('0x187')],_0x2a0d65['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x7c73('0x188')](_0x2a0d65[_0x7c73('0x185')],_0x2a0d65[_0x7c73('0x184')]):_0x2a0d65[_0x7c73('0x185')]);if(_0x5931cc){_0x59573d[_0x7c73('0x189')]=_0x27430b[_0x7c73('0xef')][_0x27261d][_0x7c73('0x18a')]=utils[_0x7c73('0x18b')](_0x5931cc);_0x59573d[_0x7c73('0x18c')]=_0x466047[_0x7c73('0x16b')];}_0x2a0d65[_0x7c73('0x18d')]=_0x59573d;return ami[_0x7c73('0x94')]({'actionid':_0x27261d,'action':_0x7c73('0x169'),'channel':_0x27430b[_0x7c73('0x80')](_0x2a0d65[_0x7c73('0x181')])?util[_0x7c73('0x3f')]('SIP/%s/%s%s',_0x2a0d65['Trunk'][_0x7c73('0x41')],isNotNull(_0x2a0d65[_0x7c73('0x18e')])?_0x2a0d65[_0x7c73('0x18e')][_0x7c73('0x18f')]()||'':'',_0x2a0d65[_0x7c73('0x190')]>0x0?_0x466047[_0x7c73('0x16b')]['substring'](_0x2a0d65[_0x7c73('0x190')]):_0x466047[_0x7c73('0x16b')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x2a0d65[_0x7c73('0x186')])?_0x2a0d65[_0x7c73('0x181')][_0x7c73('0x41')]:_0x2a0d65[_0x7c73('0x186')]['name'],isNotNull(_0x2a0d65[_0x7c73('0x18e')])?_0x2a0d65[_0x7c73('0x18e')][_0x7c73('0x18f')]()||'':'',_0x2a0d65['dialCutDigit']>0x0?_0x466047[_0x7c73('0x16b')][_0x7c73('0x191')](_0x2a0d65[_0x7c73('0x190')]):_0x466047[_0x7c73('0x16b')]),'callerid':_0x5931cc,'Exten':_0x7c73('0x112'),'Context':_0x7c73('0x192'),'Priority':'1','variable':_0x59573d,'timeout':(_0x2a0d65['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x27261d})[_0x7c73('0x96')](function(_0x45ac86){return _0x3aea65(_0x45ac86);})[_0x7c73('0x9b')](function(_0xd34a71){_0x2a0d65[_0x7c73('0x193')]+=0x1;var _0x3c20b5=new History(_0x27430b[_0x7c73('0xef')][_0x27261d]);logger[_0x7c73('0x61')](util[_0x7c73('0x3f')](_0x7c73('0x194'),JSON['stringify'](_0xd34a71)));_0x3c20b5['state']=0xe;_0x3c20b5[_0x7c73('0x6b')]=_0x7c73('0x195');_0x3c20b5['starttime']=moment()['format'](_0x7c73('0xbf'));_0x3c20b5[_0x7c73('0x6c')]=_0x3c20b5[_0x7c73('0x6d')];hopperUtils[_0x7c73('0xc6')](_0x3c20b5)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x196')));_0x27430b[_0x7c73('0xc8')](_0x3c20b5)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x196')))[_0x7c73('0x1c')](function(){delete _0x27430b[_0x7c73('0xef')][_0x27261d];return _0x2922b1(msgResponse(_0x7c73('0x169'),_0x7c73('0x197'),_0x7c73('0x198')));});});});};Dialer[_0x7c73('0x86')][_0x7c73('0x199')]=function(_0x306b44,_0x2c9ab5,_0x1adbea){var _0xb2cbf8=new History(_0x2c9ab5);if(_0xb2cbf8[_0x7c73('0x120')]+_0xb2cbf8[_0x7c73('0x121')]+_0xb2cbf8[_0x7c73('0x12d')]+_0xb2cbf8[_0x7c73('0x122')]+_0xb2cbf8[_0x7c73('0xd1')]+_0xb2cbf8[_0x7c73('0xe8')]+_0xb2cbf8['countmachineretry']+_0xb2cbf8['countagentrejectretry']>=_0x1adbea[_0x7c73('0x12f')]-0x1){return!![];}switch(_0x306b44){case 0x3:if(_0xb2cbf8[_0x7c73('0x12d')]>=_0x1adbea[_0x7c73('0x19a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xb2cbf8[_0x7c73('0x12d')]+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0x19b')],_0x7c73('0xdc'))[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0xb2cbf8['ContactId'],'ListId':_0xb2cbf8[_0x7c73('0xde')],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8['CampaignId']||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x19c')));break;case 0x5:if(_0xb2cbf8[_0x7c73('0x120')]>=_0x1adbea[_0x7c73('0x19d')]-0x1){return!![];}hopperUtils[_0x7c73('0xd9')]({'active':![],'countbusyretry':_0xb2cbf8['countbusyretry']+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0x19e')],_0x7c73('0xdc'))[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8[_0x7c73('0xde')],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x19f')));break;case 0x8:if(_0xb2cbf8[_0x7c73('0x121')]>=_0x1adbea['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x7c73('0xd9')]({'active':![],'countcongestionretry':_0xb2cbf8[_0x7c73('0x121')]+=0x1,'scheduledat':moment()['add'](_0x1adbea[_0x7c73('0x1a0')],_0x7c73('0xdc'))[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8['ListId'],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xb2cbf8['countnosuchnumberretry']>=_0x1adbea[_0x7c73('0x1a1')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xb2cbf8['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0x1a2')],'minutes')[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8[_0x7c73('0xde')],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})['catch'](loggerCatch(_0x7c73('0x1a3')));}break;case 0xa:if(_0xb2cbf8[_0x7c73('0xd1')]>=_0x1adbea[_0x7c73('0xd7')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xb2cbf8[_0x7c73('0xd1')]+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0xdb')],_0x7c73('0xdc'))['format'](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8[_0x7c73('0xde')],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xe0')));break;case 0xb:if(_0xb2cbf8[_0x7c73('0xe8')]>=_0x1adbea['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xb2cbf8[_0x7c73('0xe8')]+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0xea')],_0x7c73('0xdc'))['format'](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8[_0x7c73('0xde')],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8['CampaignId']||undefined})[_0x7c73('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0xb2cbf8[_0x7c73('0x11e')]>=_0x1adbea[_0x7c73('0x130')]-0x1){return!![];}hopperUtils[_0x7c73('0xd9')]({'active':![],'countmachineretry':_0xb2cbf8[_0x7c73('0x11e')]+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0x127')],_0x7c73('0xdc'))[_0x7c73('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb2cbf8['ContactId'],'ListId':_0xb2cbf8['ListId'],'VoiceQueueId':_0xb2cbf8[_0x7c73('0xdf')]||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x128')));break;case 0x14:if(_0xb2cbf8['countagentrejectretry']>=_0x1adbea[_0x7c73('0x1a4')]-0x1){return!![];}hopperUtils[_0x7c73('0xd9')]({'active':![],'countagentrejectretry':_0xb2cbf8[_0x7c73('0x12e')]+=0x1,'scheduledat':moment()[_0x7c73('0xda')](_0x1adbea[_0x7c73('0x1a5')],'minutes')[_0x7c73('0x3f')](_0x7c73('0xbf')),'ContactId':_0xb2cbf8[_0x7c73('0xdd')],'ListId':_0xb2cbf8['ListId'],'VoiceQueueId':_0xb2cbf8['VoiceQueueId']||undefined,'CampaignId':_0xb2cbf8[_0x7c73('0xec')]||undefined})['catch'](loggerCatch(_0x7c73('0x1a6')));break;default:return!![];}};Dialer[_0x7c73('0x86')][_0x7c73('0x1a7')]=function(_0x4293ca,_0x4acf1d,_0x474d6e){var _0x1dfd5b=this;var _0x5978cc=new History(_0x4293ca);var _0x2d1069=![];var _0x2b5445;var _0x4c26d7;return new Promise(function(_0x39c65a,_0x5cc47f){if(_[_0x7c73('0x39')](_0x4acf1d)&&typeof _0x4acf1d!==_0x7c73('0x168')){return _0x5cc47f(msgResponse('[callProgressDetecting]',_0x7c73('0x8f'),_0x7c73('0x1a8')));}if(_[_0x7c73('0x39')](_0x474d6e)&&typeof _0x474d6e!==_0x7c73('0x168')){return _0x5cc47f(msgResponse(_0x7c73('0x1a9'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0x7c73('0xd3')](_0x5978cc,_0x474d6e[_0x7c73('0xc3')],_0x4acf1d)['then'](function(_0x13e756){if(_0x13e756[_0x7c73('0xd6')]==0x1)_0x2d1069=!![];switch(_0x474d6e[_0x7c73('0xc3')]){case'0':_0x4acf1d[_0x7c73('0x1aa')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0x0;_0x5978cc[_0x7c73('0x6b')]='NoSuchNumber';_0x5978cc[_0x7c73('0x122')]+=0x1;_0x5978cc['countglobal']+=0x1;ami['emit'](_0x7c73('0x1ab'),ut['buildObj'](_0x4293ca,'nosuchnumber'));_0x2b5445=_0x4acf1d[_0x7c73('0x1a2')];_0x4c26d7=_0x4acf1d['callAdditionalPhoneAfterMin'];hopperUtils[_0x7c73('0xc6')](_0x5978cc)[_0x7c73('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1dfd5b[_0x7c73('0x199')](0x0,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0x122')]>=_0x4acf1d[_0x7c73('0x1a1')]){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,'reason\x200\x20no\x20such\x20number....');}else{_0x1dfd5b[_0x7c73('0x123')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1ac'));}}break;case'3':_0x4acf1d[_0x7c73('0x1ad')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0x3;_0x5978cc[_0x7c73('0x6b')]='NoAnswer';_0x5978cc[_0x7c73('0x12d')]+=0x1;_0x5978cc[_0x7c73('0xe9')]+=0x1;var _0x265084=ut[_0x7c73('0x1ae')](_0x4293ca,_0x4acf1d);ami[_0x7c73('0x3a')](_0x7c73('0x1af'),_0x265084);_0x2b5445=_0x4acf1d[_0x7c73('0x19b')];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];hopperUtils[_0x7c73('0xc6')](_0x5978cc)['catch'](loggerCatch(_0x7c73('0x1b0')));if(_0x1dfd5b[_0x7c73('0x199')](0x3,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc['countnoanswerretry']>=_0x4acf1d['dialNoAnswerMaxRetry']){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1b1'));}else{_0x1dfd5b[_0x7c73('0x123')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1b1'));}}break;case'5':_0x4acf1d[_0x7c73('0x1b2')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0x5;_0x5978cc[_0x7c73('0x6b')]=_0x7c73('0x1b3');_0x5978cc['countbusyretry']+=0x1;_0x5978cc['countglobal']+=0x1;ami[_0x7c73('0x3a')](_0x7c73('0x1b4'),ut[_0x7c73('0x11f')](_0x4293ca,_0x7c73('0x1b5')));_0x2b5445=_0x4acf1d['dialBusyRetryFrequency'];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];hopperUtils[_0x7c73('0xc6')](_0x5978cc)['catch'](loggerCatch(_0x7c73('0x1b6')));if(_0x1dfd5b[_0x7c73('0x199')](0x5,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0x120')]>=_0x4acf1d[_0x7c73('0x19d')]){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1b7'));}else{_0x1dfd5b[_0x7c73('0x123')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1b7'));}}break;case'8':_0x4acf1d[_0x7c73('0x1b8')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0x8;_0x5978cc[_0x7c73('0x6b')]=_0x7c73('0x1b9');_0x5978cc[_0x7c73('0x121')]+=0x1;_0x5978cc[_0x7c73('0xe9')]+=0x1;_0x2b5445=_0x4acf1d['dialCongestionRetryFrequency'];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];ami[_0x7c73('0x3a')](_0x7c73('0x1ba'),ut['buildObj'](_0x4293ca,_0x7c73('0x1bb')));hopperUtils['createHistory'](_0x5978cc)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x1bc')));if(_0x1dfd5b['checkRetriveMax'](0x8,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0x121')]>=_0x4acf1d[_0x7c73('0x1bd')]){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1be'));}else{_0x1dfd5b['stateGlobal'](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1be'));}}break;case'11':_0x4acf1d[_0x7c73('0x1bf')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0xb;_0x5978cc[_0x7c73('0x6b')]=_0x7c73('0xe6');_0x5978cc[_0x7c73('0xe8')]+=0x1;_0x5978cc[_0x7c73('0xe9')]+=0x1;_0x2b5445=_0x4acf1d['dialAbandonedRetryFrequency'];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];hopperUtils[_0x7c73('0xc6')](_0x5978cc)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0xee')));if(_0x1dfd5b[_0x7c73('0x199')](0xb,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0xe8')]>=_0x4acf1d[_0x7c73('0xeb')]){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1c0'));}else{_0x1dfd5b[_0x7c73('0x123')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1c0'));}}break;case'20':_0x4acf1d[_0x7c73('0x1c1')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0x14;_0x5978cc[_0x7c73('0x6b')]='AgentReject';_0x5978cc[_0x7c73('0x12e')]+=0x1;_0x5978cc[_0x7c73('0xe9')]+=0x1;_0x2b5445=_0x4acf1d['dialAgentRejectRetryFrequency'];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];ami[_0x7c73('0x3a')](_0x7c73('0x1c2'),ut[_0x7c73('0x11f')](_0x4293ca,_0x7c73('0x1c3')));hopperUtils[_0x7c73('0xc6')](_0x5978cc)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1dfd5b[_0x7c73('0x199')](0x14,_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0x12e')]>=_0x4acf1d['dialAgentRejectMaxRetry']){_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x7c73('0x1c4'));}else{_0x1dfd5b['stateGlobal'](_0x5978cc,_0x39c65a,_0x5cc47f,'reason\x2020\x20agentreject');}}break;default:_0x4acf1d[_0x7c73('0x137')]+=0x1;_0x5978cc[_0x7c73('0xd4')]=0xc;_0x5978cc[_0x7c73('0x6b')]=_0x474d6e['reason'];_0x2b5445=_0x4acf1d[_0x7c73('0x1a5')];_0x4c26d7=_0x4acf1d[_0x7c73('0xd2')];hopperUtils[_0x7c73('0xc6')](_0x5978cc)[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x1c5')));if(_0x1dfd5b['checkRetriveMax'](_0x474d6e[_0x7c73('0xc3')],_0x4293ca,_0x4acf1d)&&!_0x2d1069){if(_0x5978cc[_0x7c73('0x120')]+_0x5978cc[_0x7c73('0x121')]+_0x5978cc[_0x7c73('0x12d')]+_0x5978cc[_0x7c73('0x122')]+_0x5978cc['countdropretry']+_0x5978cc[_0x7c73('0xe8')]+_0x5978cc[_0x7c73('0x11e')]+_0x5978cc[_0x7c73('0x12e')]>=_0x4acf1d[_0x7c73('0x12f')]){_0x1dfd5b[_0x7c73('0x123')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x474d6e[_0x7c73('0xc3')]);}else{_0x1dfd5b[_0x7c73('0x125')](_0x5978cc,_0x39c65a,_0x5cc47f,_0x474d6e[_0x7c73('0xc3')]);}}}})[_0x7c73('0x96')](function(){if(_0x2d1069){hopperUtils[_0x7c73('0xe4')](_0x5978cc,_0x2b5445,_0x4c26d7)[_0x7c73('0x96')](function(){return _0x39c65a(0x1);});}});});};Dialer[_0x7c73('0x86')][_0x7c73('0x123')]=function(_0x4adb75,_0x3ef635,_0x88c214,_0xb3bc2){var _0x349dc6=new Final(_0x4adb75);_0x349dc6[_0x7c73('0xd4')]=0xf;_0x349dc6[_0x7c73('0x6b')]=_0x7c73('0x1c6');this['createStateFinal'](_0x349dc6,_0x3ef635,_0x88c214,_0xb3bc2);};Dialer[_0x7c73('0x86')][_0x7c73('0x125')]=function(_0x5a7c75,_0x2cf06b,_0x481de0,_0x3f0ddb){hopperUtils[_0x7c73('0xc8')](_0x5a7c75)['then'](function(){return _0x2cf06b(msgResponse(_0x7c73('0x1a9'),_0x7c73('0x10e'),_0x3f0ddb));})[_0x7c73('0x9b')](function(){return _0x481de0(msgResponse(_0x7c73('0x1c7'),'Failure',_0x7c73('0x1c8')));});};Dialer[_0x7c73('0x86')][_0x7c73('0xa')]=function(_0x57eec3){var _0x4ba61b=_0x57eec3[_0x7c73('0x1c9')]/0x64;var _0x52ef7e=_0x57eec3['outboundDropCallsDayTimeout']/(_0x57eec3[_0x7c73('0xcc')]+_0x57eec3[_0x7c73('0xc2')]);var _0x2855b0=Math[_0x7c73('0x1ca')](_0x57eec3[_0x7c73('0x1cb')]*(_0x57eec3[_0x7c73('0x1cc')]/0x64));var _0x2e498c=Math['round'](_0x57eec3['predictiveIntervalAvailable']*(_0x57eec3[_0x7c73('0x1cd')]/0x64));var _0x4c2209=_0x57eec3[_0x7c73('0x13f')]+_0x57eec3['talking'];var _0x2b7a29=Math[_0x7c73('0x1ce')](_0x57eec3[_0x7c73('0x55')]*_0x57eec3[_0x7c73('0x59')]*_0x57eec3['predictiveIntervalHitRate']*_0x57eec3[_0x7c73('0x1cf')]);if(_[_0x7c73('0x39')](_0x57eec3[_0x7c73('0x26')])){if(!_[_0x7c73('0x39')](_0x57eec3['startPredictive'])){_0x57eec3[_0x7c73('0x5d')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x7c73('0x1d0'));}if(!_[_0x7c73('0x39')](_0x57eec3[_0x7c73('0x5f')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x57eec3[_0x7c73('0x5f')]);_0x57eec3[_0x7c73('0x5f')]=undefined;}_0x57eec3['startProgressive']=moment()[_0x7c73('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7c73('0x44')](_0x57eec3['name'],_0x7c73('0x1d1'),_0x57eec3[_0x7c73('0x26')]);this[_0x7c73('0xab')](_0x57eec3,0x1);}else if(ifInterval(_0x57eec3[_0x7c73('0x1d2')],_0x57eec3[_0x7c73('0x26')])){this['handlePower'](_0x57eec3,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x57eec3[_0x7c73('0x26')],_0x57eec3[_0x7c73('0x41')]);_0x57eec3[_0x7c73('0x55')]=0x0;_0x57eec3[_0x7c73('0xcd')]=0x0;}else if(_0x4ba61b<_0x52ef7e&&_0x57eec3[_0x7c73('0x1d3')]===_0x7c73('0x1d4')){clearPredictiveAttributes(_0x57eec3);loggerPredictive[_0x7c73('0x44')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7c73('0x1d5'),_0x52ef7e,_0x7c73('0x26'),_0x57eec3[_0x7c73('0x41')]);}else if(_0x2b7a29<_0x57eec3[_0x7c73('0xcd')]&&_0x57eec3[_0x7c73('0x1d3')]===_0x7c73('0x1d4')){clearPredictiveAttributes(_0x57eec3);loggerPredictive['info'](_0x7c73('0x1d6'),_0x7c73('0x1d7'),_0x2b7a29,_0x7c73('0x1d8'),_0x57eec3[_0x7c73('0xcd')],_0x7c73('0x26'),_0x57eec3[_0x7c73('0x41')]);}else if(!ifInterval(_0x57eec3[_0x7c73('0x1d2')],_0x57eec3[_0x7c73('0x26')])&&_[_0x7c73('0x39')](_0x57eec3[_0x7c73('0x5d')])&&!_[_0x7c73('0x39')](_0x57eec3['startProgressive'])){_0x57eec3[_0x7c73('0x5d')]=moment()[_0x7c73('0x3f')](_0x7c73('0xbf'));loggerPredictive[_0x7c73('0x44')](_0x57eec3[_0x7c73('0x41')],_0x7c73('0x1d9'),_0x57eec3[_0x7c73('0x5d')]);hopperUtils[_0x7c73('0x1da')](_0x57eec3[_0x7c73('0x1d2')])[_0x7c73('0x96')](this[_0x7c73('0x1db')](_0x57eec3))[_0x7c73('0x96')](mergeDataErlangB(_0x57eec3))[_0x7c73('0x96')](this[_0x7c73('0x1dc')](_0x57eec3))[_0x7c73('0x9b')](loggerCatchPredictive(_0x7c73('0x1dd'),_0x57eec3));}else if(!ifInterval(_0x57eec3[_0x7c73('0x1d2')],_0x57eec3[_0x7c73('0x5d')])){_0x57eec3[_0x7c73('0xcd')]=0x0;_0x57eec3['startPredictive']=moment()[_0x7c73('0x3f')](_0x7c73('0xbf'));loggerPredictive[_0x7c73('0x44')](_0x57eec3[_0x7c73('0x41')],'recalculate\x20predictive\x20at',_0x57eec3[_0x7c73('0x5d')]);clearInterval(_0x57eec3[_0x7c73('0x5f')]);_0x57eec3[_0x7c73('0x5f')]=undefined;hopperUtils[_0x7c73('0x1da')](_0x57eec3[_0x7c73('0x1d2')])['then'](this['getDataPredictive'](_0x57eec3))['then'](mergeDataErlangB(_0x57eec3))[_0x7c73('0x96')](this[_0x7c73('0x1dc')](_0x57eec3))[_0x7c73('0x9b')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x57eec3));}else if(_0x57eec3[_0x7c73('0x1cb')]&&_0x4c2209<_0x57eec3[_0x7c73('0x1cb')]-_0x2e498c){clearPredictiveAttributes(_0x57eec3);loggerPredictive[_0x7c73('0x44')](_0x57eec3[_0x7c73('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4c2209,')\x20are\x20less\x20than\x20threshold\x20(',_0x57eec3[_0x7c73('0x1cb')],'-',_0x2e498c,'=',_0x57eec3['predictiveIntervalAvailable']-_0x2e498c,')');}else if(_0x57eec3[_0x7c73('0x1cb')]&&_0x4c2209>_0x57eec3[_0x7c73('0x1cb')]+_0x2855b0){clearPredictiveAttributes(_0x57eec3);loggerPredictive[_0x7c73('0x44')](_0x57eec3[_0x7c73('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4c2209,_0x7c73('0x1de'),_0x57eec3[_0x7c73('0x1cb')],'+',_0x2855b0,'=',_0x57eec3['predictiveIntervalAvailable']+_0x2855b0,')');}};Dialer['prototype'][_0x7c73('0x1db')]=function(_0x5b19d9){var _0x5cf66f=this;return function(_0xa77eda){return new Promise(function(_0x342de4,_0x11545f){_[_0x7c73('0xfa')](_0x5b19d9,_0xa77eda[0x0]);if(checkGetDataPredictive(_0xa77eda[0x0])){var _0x49834f=_0x5b19d9['predictiveIntervalAvailable']=_0x5b19d9[_0x7c73('0x141')]+_0x5b19d9[_0x7c73('0x13f')];var _0x12077b=_0x5b19d9[_0x7c73('0x1d2')]*0x3c;var _0x468d23=_0xa77eda[0x0]['predictiveIntervalAvgTalktime']+_0xa77eda[0x0][_0x7c73('0x4d')];var _0x1d747e=(_0xa77eda[0x0][_0x7c73('0x1df')]+_0xa77eda[0x0][_0x7c73('0x49')]+_0xa77eda[0x0][_0x7c73('0x4b')])/_0xa77eda[0x0]['predictiveIntervalTotalCalls'];_0x5b19d9[_0x7c73('0x1e0')]=_0x1d747e>0x0?_0x1d747e:0x1;switch(_0x5b19d9[_0x7c73('0x1d3')]){case'dropRate':var _0x373279=_0x5b19d9[_0x7c73('0x1c9')]/0x64;return _0x5cf66f['abandonmentRate'](_0x49834f,_0x12077b,_0x468d23,_0x1d747e,_0x373279)[_0x7c73('0x96')](function(_0x5395b3){return _0x342de4(_0x5395b3);});case _0x7c73('0x1e1'):var _0xaa0407=_0x5b19d9['dialPredictiveOptimizationPercentage']/0x64;return _0x5cf66f['busyFactor'](_0x49834f,_0x12077b,_0x468d23,_0x1d747e,_0xaa0407)[_0x7c73('0x96')](function(_0x4bf4f8){return _0x342de4(_0x4bf4f8);});default:return _0x11545f(msgResponse('[getDataPredictive]',_0x7c73('0x8f'),_0x7c73('0x1e2')));}}else{return _0x11545f(msgResponse(_0x7c73('0x1e3'),_0x7c73('0x8f'),_0x7c73('0x1e4')));}});};};Dialer[_0x7c73('0x86')][_0x7c73('0x1e5')]=function(_0x58e3bf){var _0x23cb02=this;return function(_0x2585a8){return new Promise(function(_0x1eb086,_0x1a46a1){_[_0x7c73('0xfa')](_0x58e3bf,_0x2585a8[0x0]);if(checkGetDataPredictive(_0x2585a8[0x0])){loggerPredictive[_0x7c73('0x44')](JSON[_0x7c73('0x71')](_0x2585a8[0x0]));if(_0x58e3bf[_0x7c73('0x1d3')]==='dropRate'){return _0x23cb02[_0x7c73('0x159')](_0x58e3bf['id'])['then'](function(_0x1e07b1){var _0x8483fc=_0x58e3bf[_0x7c73('0x1e6')]-_0x1e07b1[0x0]['outboundQueuePauses'];var _0x14ccd6=_0x58e3bf[_0x7c73('0x1d2')]*0x3c;var _0x21578e=_0x2585a8[0x0]['predictiveIntervalAvgTalktime']+_0x2585a8[0x0][_0x7c73('0x4d')];var _0x22ff50=(_0x2585a8[0x0][_0x7c73('0x1df')]+_0x2585a8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2585a8[0x0][_0x7c73('0x4b')])/_0x2585a8[0x0][_0x7c73('0x47')];var _0x3418f7=_0x58e3bf['dialPredictiveOptimizationPercentage']/0x64;_0x58e3bf[_0x7c73('0x1e7')]=_0x1e07b1[0x0][_0x7c73('0x1e8')]||0x0;_0x58e3bf[_0x7c73('0x1e0')]=_0x22ff50>0x0?_0x22ff50:0x1;return _0x23cb02[_0x7c73('0x1e9')](_0x8483fc,_0x14ccd6,_0x21578e,_0x22ff50,_0x3418f7);})[_0x7c73('0x96')](function(_0x46356f){return _0x1eb086(_0x46356f);})[_0x7c73('0x9b')](function(_0x2f4428){return _0x1a46a1(msgResponse('[CatchErlangB]',_0x7c73('0x8f'),JSON['stringify'](_0x2f4428)));});}if(_0x58e3bf[_0x7c73('0x1d3')]===_0x7c73('0x1e1')){return _0x23cb02['getVoiceQueueRtPauses'](_0x58e3bf['id'])['then'](function(_0x48cd6c){var _0x472b47=_0x58e3bf[_0x7c73('0x1e6')]-_0x48cd6c[0x0][_0x7c73('0x1e8')];var _0x377336=_0x58e3bf[_0x7c73('0x1d2')]*0x3c;var _0xb2bc48=_0x2585a8[0x0][_0x7c73('0x4f')]+_0x2585a8[0x0][_0x7c73('0x4d')];var _0x59afae=(_0x2585a8[0x0]['predictiveIntervalAnsweredCalls']+_0x2585a8[0x0][_0x7c73('0x49')]+_0x2585a8[0x0][_0x7c73('0x4b')])/_0x2585a8[0x0][_0x7c73('0x47')];var _0x5de217=_0x58e3bf['dialPredictiveOptimizationPercentage']/0x64;_0x58e3bf['predictiveIntervalPauses']=_0x48cd6c[0x0][_0x7c73('0x1e8')]||0x0;_0x58e3bf['predictiveIntervalHitRate']=_0x59afae>0x0?_0x59afae:0x1;return _0x23cb02[_0x7c73('0x1ea')](_0x472b47,_0x377336,_0xb2bc48,_0x59afae,_0x5de217);})[_0x7c73('0x96')](function(_0x20bc61){return _0x1eb086(_0x20bc61);})[_0x7c73('0x9b')](function(_0x5ae9d8){return _0x1a46a1(msgResponse(_0x7c73('0x1eb'),_0x7c73('0x8f'),JSON[_0x7c73('0x71')](_0x5ae9d8)));});}}else{return _0x1a46a1(msgResponse(_0x7c73('0x1e3'),_0x7c73('0x8f'),'check\x20failure'));}});};};Dialer[_0x7c73('0x86')][_0x7c73('0x1dc')]=function(_0x116d2d){var _0x5a53f7=this;return function(){var _0x2138a4=0x0;var _0x44b59f=Math[_0x7c73('0x1ce')](_0x116d2d[_0x7c73('0x57')]*0x3e8);if(_0x44b59f>0x0){_0x44b59f=_0x44b59f<0x64?0x64:_0x44b59f;loggerPredictive[_0x7c73('0x44')](_0x116d2d[_0x7c73('0x41')],_0x7c73('0x1ec'),_0x44b59f,_0x7c73('0x1ed'));_0x116d2d[_0x7c73('0x5f')]=setInterval(function(){_0x5a53f7[_0x7c73('0x5f')](_0x116d2d);loggerPredictiveCalls[_0x7c73('0x44')]('[handlePredictive]',_0x2138a4+=0x1);},_0x44b59f);}else{loggerPredictive[_0x7c73('0x44')](_0x116d2d[_0x7c73('0x41')],_0x7c73('0x1ee'));}};};Dialer[_0x7c73('0x86')][_0x7c73('0x1ef')]=function(_0xaa8985,_0xce726b){var _0x4f43bc=this;return function(_0xee3903){if(_[_0x7c73('0x43')](_0xee3903)){if(_[_0x7c73('0xf5')](_0xce726b[_0x7c73('0x161')])||!_0xce726b['recallme']){if(_0xaa8985[_0x7c73('0xa9')]===_0x7c73('0xae')){_0xaa8985[_0x7c73('0x6e')]=_['isUndefined'](_0xaa8985[_0x7c73('0x6e')])?!![]:_0xaa8985[_0x7c73('0x6e')];var _0x4fe26b=uuid['v4']();_0x4f43bc[_0x7c73('0xef')][_0x4fe26b]=new Action(_0xaa8985,_0xce726b,_0x4fe26b);loggerBooked[_0x7c73('0x44')](_0x7c73('0x1f0'),_0x4fe26b,_0x7c73('0x1f1'),JSON[_0x7c73('0x71')](_0xaa8985[_0x7c73('0x6e')]),'Queue:\x20',_0xaa8985[_0x7c73('0x41')]);if(_0xaa8985[_0x7c73('0x6e')]){_0xaa8985[_0x7c73('0x6e')]=![];_0x4f43bc[_0x7c73('0xf9')][_0x4f43bc['actions'][_0x4fe26b][_0x7c73('0xbd')]]=[];ami[_0x7c73('0x94')]({'actionid':_0x4fe26b,'action':_0x7c73('0x1f2'),'queue':_0xaa8985[_0x7c73('0x41')]})[_0x7c73('0x9b')](function(){_0x4f43bc['updateOriginated'](_0xaa8985);hopperUtils[_0x7c73('0xd9')]({'active':![],'ContactId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xdd')],'ListId':_0x4f43bc['actions'][_0x4fe26b][_0x7c73('0xde')],'VoiceQueueId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xdf')]||undefined,'CampaignId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x1f3')));delete _0x4f43bc[_0x7c73('0xef')][_0x4fe26b];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x7c73('0x71')](_0xaa8985[_0x7c73('0x6e')]),'Queue:\x20',_0xaa8985['name']);_0x4f43bc[_0x7c73('0xbc')](_0xaa8985);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xdd')],'ListId':_0x4f43bc['actions'][_0x4fe26b][_0x7c73('0xde')],'VoiceQueueId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xdf')]||undefined,'CampaignId':_0x4f43bc[_0x7c73('0xef')][_0x4fe26b][_0x7c73('0xec')]||undefined})['catch'](loggerCatch(_0x7c73('0x1f3')));delete _0x4f43bc['actions'][_0x4fe26b];}}else{return _0x4f43bc['actionOriginate'](_0xaa8985,_0xce726b);}}else{if(utils[_0x7c73('0xca')](undefined,_0xce726b[_0x7c73('0x1f4')])<_0xaa8985[_0x7c73('0x1f5')]*0x3c){if(_0xce726b[_0x7c73('0x14f')]&&!_0xce726b[_0x7c73('0x14f')][_0x7c73('0x1f6')]){_0x4f43bc[_0x7c73('0xfd')][_0x7c73('0xfe')](_0xce726b['id'])[_0x7c73('0x1c')](function(){_0x4f43bc[_0x7c73('0xbc')](_0xaa8985);});}else{hopperUtils[_0x7c73('0x1f7')]({'active':![]},_0xce726b['id'],0x1)[_0x7c73('0x1c')](function(){_0x4f43bc['updateOriginated'](_0xaa8985);});}}else{_0xaa8985[_0x7c73('0x1f8')]+=0x1;_0x4f43bc[_0x7c73('0xbc')](_0xaa8985);if(_0xaa8985[_0x7c73('0x1f9')]){hopperUtils[_0x7c73('0xd9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xce726b[_0x7c73('0xdd')],'ListId':_0xce726b[_0x7c73('0xde')],'VoiceQueueId':_0xce726b[_0x7c73('0xdf')]||undefined,'CampaignId':_0xce726b[_0x7c73('0xec')]||undefined})[_0x7c73('0x9b')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x7c73('0xc6')](createObjHistory(_0xaa8985,_0xce726b,utils[_0x7c73('0x66')]['QUEUE_RECALL'],0x17,_0x7c73('0x1fa')))[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x1fb')));}else{_0x4f43bc['saveInDb'](createObjHistory(_0xaa8985,_0xce726b,utils['CAMPAIGN_STATUS'][_0x7c73('0x1fc')],0x16,_0x7c73('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0xaa8985[_0x7c73('0x1fe')]+=0x1;_0x4f43bc['saveInDb'](createObjHistory(_0xaa8985,_0xce726b,utils[_0x7c73('0x66')][_0x7c73('0x1ff')],0xd,'Blacklist'),_0x7c73('0x200'),'[Originate][MoveBlacklist]');throw _0x7c73('0x201');}};};Dialer[_0x7c73('0x86')][_0x7c73('0x202')]=function(_0x44080e){var _0x91cf13=this;var _0xc02755=_0x44080e[_0x7c73('0x203')]-_0x44080e[_0x7c73('0x15b')];emitCampaignSummary(_0x44080e);if(_0xc02755>0x0&&_0x44080e['temp']==0x0){if(_0xc02755>this[_0x7c73('0x22')]){_0xc02755=this[_0x7c73('0x22')];}_0x44080e['temp']=0x1;hopperUtils[_0x7c73('0x204')](_0x44080e,_0xc02755)['then'](function(_0x37f942){_0x44080e[_0x7c73('0x64')]=0x0;if(_0x37f942){if(!utils[_0x7c73('0x205')](_0x37f942)){_0x44080e[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x6a')];logger['info'](_0x7c73('0x206')+_0x44080e[_0x7c73('0x41')]);}else{_0x44080e['originated']+=_0x37f942[_0x7c73('0x93')];_0x44080e[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x207')];for(var _0x1cb996=0x0;_0x1cb996<_0x37f942['length'];_0x1cb996+=0x1){_0x44080e[_0x7c73('0x208')]+=0x1;if(_[_0x7c73('0xf5')](_0x37f942[_0x1cb996])||_['isNil'](_0x37f942[_0x1cb996]['Contact'])||_[_0x7c73('0xf5')](_0x37f942[_0x1cb996]['phone'])){_0x91cf13[_0x7c73('0x15f')](_0x7c73('0x209'),_0x44080e,_0x37f942[_0x1cb996]);}else{hopperUtils[_0x7c73('0x20a')](_[_0x7c73('0xfb')](_0x37f942[_0x1cb996],[_0x7c73('0xec'),_0x7c73('0x16b')]))[_0x7c73('0x96')](_0x91cf13['checkContactBlack'](_0x44080e,_0x37f942[_0x1cb996]))['catch'](_0x91cf13[_0x7c73('0x15e')](_0x7c73('0x20b'),_0x44080e));}}}}})[_0x7c73('0x9b')](loggerGetContactDialer(_0x7c73('0x20c'),_0x44080e,_0xc02755));}};Dialer[_0x7c73('0x86')][_0x7c73('0xab')]=function(_0xa46474,_0x85b503){var _0x2648fc=this;var _0x488ff4=[];if(_0x85b503<0x1||_0xa46474['dialMethod']===_0x7c73('0xae')){_0x85b503=0x1;}var _0x47132b=Math[_0x7c73('0x1ce')](_0xa46474['available']*_0x85b503)-_0xa46474['originated'];if(_0xa46474[_0x7c73('0x20d')]>0x0){var _0x5d1d85=_0xa46474['dialLimitQueue']-_0xa46474[_0x7c73('0x15b')]-_0xa46474[_0x7c73('0x141')]-_0xa46474[_0x7c73('0x142')];if(_0x47132b>_0x5d1d85){_0x47132b=_0x5d1d85;}}if(_0x47132b>0x0&&_0xa46474[_0x7c73('0x64')]==0x0){if(_0xa46474['dialMethod']===_0x7c73('0xae')){_0x47132b=0x1;}if(_0x47132b>this[_0x7c73('0x22')]){_0x47132b=this[_0x7c73('0x22')];}for(var _0x27821c in this['agents']){if(typeof this['agents'][_0x27821c]!==_0x7c73('0x155')){if(this[_0x7c73('0x20')][_0x27821c][_0x7c73('0xd4')]===_0x7c73('0x20e')&&this[_0x7c73('0x20')][_0x27821c][_0x7c73('0x82')]===_0x7c73('0x83')){_0x488ff4[_0x7c73('0x9a')](this[_0x7c73('0x20')][_0x27821c]['id']);}}}_0xa46474[_0x7c73('0x64')]=0x1;hopperUtils[_0x7c73('0x20f')](_0xa46474,_0x488ff4,_0x47132b)[_0x7c73('0x96')](function(_0x1d89bb){_0xa46474['temp']=0x0;if(_0x1d89bb){if(!utils[_0x7c73('0x205')](_0x1d89bb)){hopperUtils[_0x7c73('0x210')](_0xa46474)['then'](sendMessageReschedule(_0xa46474))[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x211')));}else{_0xa46474['originated']+=_0x1d89bb[_0x7c73('0x93')];_0xa46474[_0x7c73('0x69')]=_0xa46474[_0x7c73('0xa9')]===_0x7c73('0xae')?utils['CAMPAIGN_STATUS'][_0x7c73('0x143')]:utils[_0x7c73('0x66')]['RUNNING'];for(var _0x3359c2=0x0;_0x3359c2<_0x1d89bb['length'];_0x3359c2+=0x1){if(_['isNil'](_0x1d89bb[_0x3359c2])||_[_0x7c73('0xf5')](_0x1d89bb[_0x3359c2][_0x7c73('0x180')])||_['isNil'](_0x1d89bb[_0x3359c2][_0x7c73('0x16b')])){_0x2648fc['emptyContact'](_0x7c73('0x209'),_0xa46474,_0x1d89bb[_0x3359c2]);}else{hopperUtils[_0x7c73('0x212')](_[_0x7c73('0xfb')](_0x1d89bb[_0x3359c2],[_0x7c73('0xdf'),_0x7c73('0x16b')]))[_0x7c73('0x96')](_0x2648fc[_0x7c73('0x1ef')](_0xa46474,_0x1d89bb[_0x3359c2]))[_0x7c73('0x9b')](_0x2648fc['loggerHandler'](_0x7c73('0x209'),_0xa46474));}}}}})['catch'](loggerGetContactDialer(_0x7c73('0x213'),_0xa46474,_0x47132b));}};Dialer[_0x7c73('0x86')][_0x7c73('0x5f')]=function(_0x4a08ec){if(_0x4a08ec[_0x7c73('0x20d')]>0x0){var _0x3f14b1=_0x4a08ec[_0x7c73('0x20d')]-_0x4a08ec['originated']-_0x4a08ec[_0x7c73('0x141')];if(_0x3f14b1>0x0&&_0x4a08ec['temp']==0x0){this[_0x7c73('0x214')](_0x4a08ec);}else{loggerPredictiveCalls[_0x7c73('0x44')](_0x7c73('0x215'));}}else{this[_0x7c73('0x214')](_0x4a08ec);}};Dialer['prototype'][_0x7c73('0x214')]=function(_0x1c61c6){var _0xccdf37=this;var _0x31493e=[];_0x1c61c6[_0x7c73('0x15b')]+=0x1;for(var _0x2262cc in this['agents']){if(typeof this[_0x7c73('0x20')][_0x2262cc]!==_0x7c73('0x155')){if(this[_0x7c73('0x20')][_0x2262cc][_0x7c73('0xd4')]==='not_inuse'&&this[_0x7c73('0x20')][_0x2262cc][_0x7c73('0x82')]===_0x7c73('0x83')){_0x31493e[_0x7c73('0x9a')](this['agents'][_0x2262cc]['id']);}}}_0x1c61c6['temp']=0x1;return this[_0x7c73('0x20f')](_0x1c61c6['id'],_0x31493e,0x1,_0x1c61c6[_0x7c73('0x216')],_0x1c61c6)[_0x7c73('0x96')](function(_0x125d99){_0x1c61c6[_0x7c73('0x64')]=0x1;if(_0x125d99){if(!utils['checkContactEmpty'](_0x125d99)){utils[_0x7c73('0x63')](_0x1c61c6,0x1,0x0);return hopperUtils[_0x7c73('0x210')](_0x1c61c6)[_0x7c73('0x96')](sendMessageReschedule(_0x1c61c6))[_0x7c73('0x9b')](loggerCatch(_0x7c73('0x211')));}else{_0x1c61c6[_0x7c73('0x69')]=utils[_0x7c73('0x66')][_0x7c73('0x207')];if(_[_0x7c73('0xf5')](_0x125d99[0x0])||_[_0x7c73('0xf5')](_0x125d99[0x0]['Contact'])||_['isNil'](_0x125d99[0x0][_0x7c73('0x16b')])){_0xccdf37[_0x7c73('0x15f')](_0x7c73('0x209'),_0x1c61c6,_0x125d99[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x7c73('0xfb')](_0x125d99[0x0],['VoiceQueueId',_0x7c73('0x16b')]))[_0x7c73('0x96')](_0xccdf37[_0x7c73('0x1ef')](_0x1c61c6,_0x125d99[0x0]))['catch'](_0xccdf37[_0x7c73('0x15e')]('[actionOriginatePredictive]\x20',_0x1c61c6));}}}})['catch'](loggerGetContactDialer(_0x7c73('0x217'),_0x1c61c6,0x1));};Dialer[_0x7c73('0x86')][_0x7c73('0x1e9')]=function(_0x232681,_0x178275,_0x1ead86,_0x2b77f1,_0x5f1de1,_0x3b2990){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7c73('0x44')]('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',_0x232681);loggerPredictive['info'](_0x7c73('0x218'),_0x178275);loggerPredictive[_0x7c73('0x44')]('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',_0x1ead86);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x219'),_0x2b77f1);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x21a'),_0x5f1de1);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x50'));return new Promise(function(_0x169383,_0x503c3d){if(_0x232681<=0x0||isNaN(_0x232681)){return _0x503c3d(msgResponse(_0x7c73('0x21b'),_0x7c73('0x197'),'m\x20=\x20'+_0x232681));}if(_0x1ead86<=0x0||isNaN(_0x1ead86)){return _0x503c3d(msgResponse(_0x7c73('0x21b'),_0x7c73('0x197'),'Ts\x20=\x20'+_0x1ead86));}if(_0x2b77f1<=0x0||isNaN(_0x2b77f1)){return _0x503c3d(msgResponse(_0x7c73('0x21b'),_0x7c73('0x197'),_0x7c73('0x21c')+_0x2b77f1));}if(_0x178275<=0x0||isNaN(_0x178275)){return _0x503c3d(msgResponse('[abandonmentRate]',_0x7c73('0x197'),'interval\x20=\x20'+_0x178275));}if(_0x5f1de1<=0x0||isNaN(_0x5f1de1)){return _0x503c3d(msgResponse(_0x7c73('0x21b'),_0x7c73('0x197'),_0x7c73('0x21d')+_0x5f1de1));}_0x3b2990=_0x3b2990||0x0;var _0x4200fb=0x1/_0x1ead86;var _0x2a7124=0x0;var _0x188fd3=0x0;var _0xa856dc=0x0;var _0x1cc4a7=0x0;for(var _0x55765d=0x0;_0xa856dc<_0x5f1de1;_0x55765d+=0x1){_0x188fd3=_0x55765d/_0x178275;_0x2a7124=(_0x2b77f1*_0x188fd3+_0x3b2990)/_0x4200fb;_0xa856dc=utils['erlangb'](_0x2a7124,_0x232681);_0x1cc4a7=_0x2a7124/_0x232681*(0x1-utils[_0x7c73('0x21e')](_0x2a7124,_0x232681));}return _0x169383({'erlangCalls':_0x55765d,'erlangCallToSecond':_0x178275/_0x55765d,'erlangAbandonmentRate':_0xa856dc,'erlangBusyFactor':_0x1cc4a7});});};Dialer[_0x7c73('0x86')][_0x7c73('0x1ea')]=function(_0x10f437,_0x54a002,_0x1f925d,_0x3ccac3,_0x4b89e4,_0x3a10c6){loggerPredictive[_0x7c73('0x44')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7c73('0x44')](_0x7c73('0x21f'),_0x10f437);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54a002);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x220'),_0x1f925d);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ccac3);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x221'),_0x4b89e4);loggerPredictive[_0x7c73('0x44')](_0x7c73('0x50'));return new Promise(function(_0x240a56,_0x5df44b){if(_0x10f437<=0x0||isNaN(_0x10f437)){return _0x5df44b(msgResponse(_0x7c73('0x222'),'Error',_0x7c73('0x223')+_0x10f437));}if(_0x1f925d<=0x0||isNaN(_0x1f925d)){return _0x5df44b(msgResponse('[busyFactor]',_0x7c73('0x197'),_0x7c73('0x224')+_0x1f925d));}if(_0x3ccac3<=0x0||isNaN(_0x3ccac3)){return _0x5df44b(msgResponse(_0x7c73('0x222'),_0x7c73('0x197'),'p\x20=\x20'+_0x3ccac3));}if(_0x54a002<=0x0||isNaN(_0x54a002)){return _0x5df44b(msgResponse('[busyFactor]',_0x7c73('0x197'),_0x7c73('0x225')+_0x54a002));}if(_0x4b89e4<=0x0||isNaN(_0x4b89e4)){return _0x5df44b(msgResponse('[busyFactor]',_0x7c73('0x197'),_0x7c73('0x226')+_0x4b89e4));}_0x3a10c6=_0x3a10c6||0x0;var _0x150f5d=0x1/_0x1f925d;var _0x236b36=0x0;var _0x14920b=0x0;var _0x3a2e46=0x0;var _0x4398f8=0x0;for(var _0x329877=0x0;_0x4398f8<_0x4b89e4;_0x329877+=0x1){_0x14920b=_0x329877/_0x54a002;_0x236b36=(_0x3ccac3*_0x14920b+_0x3a10c6)/_0x150f5d;_0x3a2e46=utils[_0x7c73('0x21e')](_0x236b36,_0x10f437);_0x4398f8=_0x236b36/_0x10f437*(0x1-utils[_0x7c73('0x21e')](_0x236b36,_0x10f437));}return _0x240a56({'erlangCalls':_0x329877,'erlangCallToSecond':_0x54a002/_0x329877,'erlangAbandonmentRate':_0x3a2e46,'erlangBusyFactor':_0x4398f8});});};module[_0x7c73('0x227')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 0754d3b..ad41ce7 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88e7=['\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller'];(function(_0x1cfee5,_0x29552d){var _0x2d72ce=function(_0x2856bf){while(--_0x2856bf){_0x1cfee5['push'](_0x1cfee5['shift']());}};_0x2d72ce(++_0x29552d);}(_0x88e7,0x100));var _0x788e=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x88e7[_0x26f702];return _0x11417d;};'use strict';var util=require('util');var _=require(_0x788e('0x0'));var moment=require(_0x788e('0x1'));function checkNameSurname(_0x546038,_0x53965b,_0x104fa3){var _0x413618='';if(!_[_0x788e('0x2')](_0x53965b)&&_0x788e('0x3')===typeof _0x53965b){_0x413618+=_0x53965b;}if(!_['isNil'](_0x104fa3)&&_0x788e('0x3')===typeof _0x104fa3){_0x413618+='\x20'+_0x104fa3;}if(_0x413618!==''){return _0x413618;}return _0x546038;}function Action(_0x2efa6e,_0x506cc8,_0x48ce16){this[_0x788e('0x4')]=_0x2efa6e;this[_0x788e('0x5')]=_0x48ce16||undefined;this[_0x788e('0x6')]=checkNameSurname(_0x506cc8[_0x788e('0x7')][_0x788e('0x8')],_0x506cc8[_0x788e('0x7')]['firstName'],_0x506cc8[_0x788e('0x7')][_0x788e('0x9')]);this[_0x788e('0xa')]=_0x506cc8[_0x788e('0x8')];this[_0x788e('0xb')]=_0x2efa6e['name'];this['active']=_0x506cc8[_0x788e('0xc')]||![];this['type']=_0x2efa6e['type'];this[_0x788e('0xd')]=_0x2efa6e['dialQueueTimeout']||0x3;this['scheduledat']=_0x506cc8[_0x788e('0xe')];this['countbusyretry']=_0x506cc8[_0x788e('0xf')];this[_0x788e('0x10')]=_0x506cc8[_0x788e('0x10')];this[_0x788e('0x11')]=_0x506cc8[_0x788e('0x11')];this[_0x788e('0x12')]=_0x506cc8[_0x788e('0x12')];this[_0x788e('0x13')]=_0x506cc8[_0x788e('0x13')];this[_0x788e('0x14')]=_0x506cc8['countabandonedretry'];this[_0x788e('0x15')]=_0x506cc8[_0x788e('0x15')];this[_0x788e('0x16')]=_0x506cc8[_0x788e('0x16')];this[_0x788e('0x17')]=_0x506cc8[_0x788e('0x17')];this[_0x788e('0x18')]=_0x506cc8[_0x788e('0x18')];this[_0x788e('0x19')]=_0x506cc8[_0x788e('0x19')];this[_0x788e('0x1a')]=_0x506cc8[_0x788e('0x1a')];this[_0x788e('0x1b')]=_0x506cc8['CampaignId'];this['idHopper']=_0x506cc8['id'];this[_0x788e('0x1c')]=_0x506cc8[_0x788e('0x7')][_0x788e('0x1d')]||'';this['starttime']=moment()[_0x788e('0x1e')](_0x788e('0x1f'));this['callback']=_0x506cc8[_0x788e('0x20')];this[_0x788e('0x21')]=_0x506cc8['callbackuniqueid'];this['callbackat']=_0x506cc8[_0x788e('0x22')];this[_0x788e('0x23')]=_0x506cc8[_0x788e('0x23')];this[_0x788e('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x788e('0x25')]=function(){return util['format'](_0x788e('0x26'),this[_0x788e('0x6')],this[_0x788e('0x4')][_0x788e('0x27')]>0x0?this[_0x788e('0xa')][_0x788e('0x28')](this[_0x788e('0x4')][_0x788e('0x27')]):this[_0x788e('0xa')]);};Action[_0x788e('0x29')]['getQueue']=function(){return this[_0x788e('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x9752=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','phone','Contact','firstName','lastName','queue','name','type','dialQueueTimeout','scheduledat','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry'];(function(_0x36ef9,_0x3d11f1){var _0x17862e=function(_0x505727){while(--_0x505727){_0x36ef9['push'](_0x36ef9['shift']());}};_0x17862e(++_0x3d11f1);}(_0x9752,0x89));var _0x2975=function(_0x1af385,_0x16e435){_0x1af385=_0x1af385-0x0;var _0x53d2e3=_0x9752[_0x1af385];return _0x53d2e3;};'use strict';var util=require(_0x2975('0x0'));var _=require(_0x2975('0x1'));var moment=require(_0x2975('0x2'));function checkNameSurname(_0x7f28ce,_0x2075af,_0x4f9535){var _0x52ff3f='';if(!_[_0x2975('0x3')](_0x2075af)&&_0x2975('0x4')===typeof _0x2075af){_0x52ff3f+=_0x2075af;}if(!_[_0x2975('0x3')](_0x4f9535)&&_0x2975('0x4')===typeof _0x4f9535){_0x52ff3f+='\x20'+_0x4f9535;}if(_0x52ff3f!==''){return _0x52ff3f;}return _0x7f28ce;}function Action(_0x815ed6,_0x158242,_0x50b41f){this[_0x2975('0x5')]=_0x815ed6;this['uniqueid']=_0x50b41f||undefined;this['name']=checkNameSurname(_0x158242['Contact'][_0x2975('0x6')],_0x158242[_0x2975('0x7')][_0x2975('0x8')],_0x158242[_0x2975('0x7')][_0x2975('0x9')]);this['number']=_0x158242[_0x2975('0x6')];this[_0x2975('0xa')]=_0x815ed6[_0x2975('0xb')];this['active']=_0x158242['active']||![];this[_0x2975('0xc')]=_0x815ed6[_0x2975('0xc')];this[_0x2975('0xd')]=_0x815ed6[_0x2975('0xd')]||0x3;this[_0x2975('0xe')]=_0x158242['scheduledat'];this['countbusyretry']=_0x158242['countbusyretry'];this['countcongestionretry']=_0x158242['countcongestionretry'];this['countnoanswerretry']=_0x158242[_0x2975('0xf')];this[_0x2975('0x10')]=_0x158242[_0x2975('0x10')];this[_0x2975('0x11')]=_0x158242[_0x2975('0x11')];this['countabandonedretry']=_0x158242['countabandonedretry'];this['countmachineretry']=_0x158242['countmachineretry'];this[_0x2975('0x12')]=_0x158242[_0x2975('0x12')];this[_0x2975('0x13')]=_0x158242['ContactId'];this[_0x2975('0x14')]=_0x158242['ListId'];this[_0x2975('0x15')]=_0x158242[_0x2975('0x15')];this[_0x2975('0x16')]=_0x158242[_0x2975('0x16')];this[_0x2975('0x17')]=_0x158242[_0x2975('0x17')];this['idHopper']=_0x158242['id'];this['ContactFirstName']=_0x158242[_0x2975('0x7')][_0x2975('0x8')]||'';this[_0x2975('0x18')]=moment()[_0x2975('0x19')](_0x2975('0x1a'));this[_0x2975('0x1b')]=_0x158242[_0x2975('0x1b')];this[_0x2975('0x1c')]=_0x158242[_0x2975('0x1c')];this[_0x2975('0x1d')]=_0x158242[_0x2975('0x1d')];this['recallme']=_0x158242[_0x2975('0x1e')];this[_0x2975('0x1f')]='';this['originatecalleridname']='';}Action[_0x2975('0x20')][_0x2975('0x21')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0x2975('0x5')][_0x2975('0x22')]>0x0?this[_0x2975('0x23')][_0x2975('0x24')](this[_0x2975('0x5')][_0x2975('0x22')]):this['number']);};Action['prototype'][_0x2975('0x25')]=function(){return this[_0x2975('0xa')];};module[_0x2975('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 1d0ef49..1a8b192 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d2a=['getSeconds','holdtime','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x3ef117,_0x3278ab){var _0x5c014b=function(_0xc646c4){while(--_0xc646c4){_0x3ef117['push'](_0x3ef117['shift']());}};_0x5c014b(++_0x3278ab);}(_0x8d2a,0xc3));var _0xa8d2=function(_0x223124,_0x556118){_0x223124=_0x223124-0x0;var _0x11bc69=_0x8d2a[_0x223124];return _0x11bc69;};'use strict';var moment=require(_0xa8d2('0x0'));var utils=require(_0xa8d2('0x1'));function AgentComplete(_0xab1cdb,_0x200c85){this[_0xa8d2('0x2')]=0x4;this[_0xa8d2('0x3')]=_0xa8d2('0x4');this['scheduledat']=_0xab1cdb[_0xa8d2('0x5')];this[_0xa8d2('0x6')]=_0xab1cdb[_0xa8d2('0x6')];this[_0xa8d2('0x7')]=_0xab1cdb[_0xa8d2('0x6')]===_0xa8d2('0x8')?'queue':_0xab1cdb['type'];this[_0xa8d2('0x9')]=_0xab1cdb[_0xa8d2('0x9')];this[_0xa8d2('0xa')]=_0xab1cdb[_0xa8d2('0xa')];this[_0xa8d2('0xb')]=_0xab1cdb[_0xa8d2('0xb')];this['countglobal']=_0xab1cdb[_0xa8d2('0x9')]+_0xab1cdb[_0xa8d2('0xa')]+_0xab1cdb[_0xa8d2('0xb')]+_0xab1cdb[_0xa8d2('0xc')]+_0xab1cdb[_0xa8d2('0xd')]+_0xab1cdb[_0xa8d2('0xe')]+_0xab1cdb[_0xa8d2('0xf')]+_0xab1cdb[_0xa8d2('0x10')];this[_0xa8d2('0xc')]=_0xab1cdb['countnosuchnumberretry'];this[_0xa8d2('0xd')]=_0xab1cdb[_0xa8d2('0xd')];this[_0xa8d2('0xe')]=_0xab1cdb['countabandonedretry'];this[_0xa8d2('0xf')]=_0xab1cdb[_0xa8d2('0xf')];this[_0xa8d2('0x10')]=_0xab1cdb[_0xa8d2('0x10')];this['uniqueid']=_0x200c85[_0xa8d2('0x11')];this['calleridname']=_0xab1cdb['name'];this['calleridnum']=_0xab1cdb[_0xa8d2('0x12')];this[_0xa8d2('0x13')]=_0xab1cdb[_0xa8d2('0x13')];this[_0xa8d2('0x14')]=_0xab1cdb['responsetime'];this[_0xa8d2('0x15')]=_0xab1cdb[_0xa8d2('0x15')];this['endtime']=moment()[_0xa8d2('0x16')](_0xa8d2('0x17'));this[_0xa8d2('0x18')]=utils[_0xa8d2('0x19')](_0xab1cdb['responsetime'],_0xab1cdb[_0xa8d2('0x13')]);this[_0xa8d2('0x1a')]=utils[_0xa8d2('0x19')](_0xab1cdb[_0xa8d2('0x15')],_0xab1cdb[_0xa8d2('0x14')]);this[_0xa8d2('0x1b')]=utils[_0xa8d2('0x19')](this[_0xa8d2('0x1c')],_0xab1cdb[_0xa8d2('0x15')]);this[_0xa8d2('0x1d')]=_0x200c85[_0xa8d2('0x1d')];this[_0xa8d2('0x1e')]=_0x200c85[_0xa8d2('0x1e')];this[_0xa8d2('0x1f')]=_0x200c85[_0xa8d2('0x1f')];this[_0xa8d2('0x20')]=_0xab1cdb[_0xa8d2('0x20')];this[_0xa8d2('0x21')]=_0xab1cdb[_0xa8d2('0x21')];this[_0xa8d2('0x22')]=_0xab1cdb[_0xa8d2('0x22')];this[_0xa8d2('0x23')]=_0xab1cdb[_0xa8d2('0x23')];this['ContactId']=_0xab1cdb[_0xa8d2('0x24')];this[_0xa8d2('0x25')]=_0xab1cdb[_0xa8d2('0x25')];this[_0xa8d2('0x26')]=_0xab1cdb['UserId'];this[_0xa8d2('0x27')]=_0xab1cdb[_0xa8d2('0x27')];this[_0xa8d2('0x28')]=_0xab1cdb[_0xa8d2('0x28')];this['originatecalleridnum']=_0xab1cdb['originatecalleridnum']||'';this[_0xa8d2('0x29')]=_0xab1cdb[_0xa8d2('0x29')]||'';this[_0xa8d2('0x2a')]=_0xab1cdb['agiafterat'];}module[_0xa8d2('0x2b')]=AgentComplete; \ No newline at end of file +var _0xdc8a=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','talktime','endtime','queue'];(function(_0x4c9f76,_0x5e0403){var _0x551afe=function(_0x1a3d2a){while(--_0x1a3d2a){_0x4c9f76['push'](_0x4c9f76['shift']());}};_0x551afe(++_0x5e0403);}(_0xdc8a,0x141));var _0xadc8=function(_0x2d9aea,_0x509a61){_0x2d9aea=_0x2d9aea-0x0;var _0x1655d8=_0xdc8a[_0x2d9aea];return _0x1655d8;};'use strict';var moment=require(_0xadc8('0x0'));var utils=require('../utils');function AgentComplete(_0xed3d47,_0x1cc6f3){this[_0xadc8('0x1')]=0x4;this['statedesc']=_0xadc8('0x2');this[_0xadc8('0x3')]=_0xed3d47[_0xadc8('0x3')];this[_0xadc8('0x4')]=_0xed3d47[_0xadc8('0x4')];this[_0xadc8('0x5')]=_0xed3d47['type']===_0xadc8('0x6')?'queue':_0xed3d47[_0xadc8('0x4')];this[_0xadc8('0x7')]=_0xed3d47[_0xadc8('0x7')];this['countcongestionretry']=_0xed3d47[_0xadc8('0x8')];this[_0xadc8('0x9')]=_0xed3d47[_0xadc8('0x9')];this[_0xadc8('0xa')]=_0xed3d47[_0xadc8('0x7')]+_0xed3d47['countcongestionretry']+_0xed3d47[_0xadc8('0x9')]+_0xed3d47[_0xadc8('0xb')]+_0xed3d47['countdropretry']+_0xed3d47[_0xadc8('0xc')]+_0xed3d47[_0xadc8('0xd')]+_0xed3d47['countagentrejectretry'];this[_0xadc8('0xb')]=_0xed3d47[_0xadc8('0xb')];this[_0xadc8('0xe')]=_0xed3d47['countdropretry'];this[_0xadc8('0xc')]=_0xed3d47['countabandonedretry'];this[_0xadc8('0xd')]=_0xed3d47['countmachineretry'];this['countagentrejectretry']=_0xed3d47[_0xadc8('0xf')];this[_0xadc8('0x10')]=_0x1cc6f3[_0xadc8('0x10')];this[_0xadc8('0x11')]=_0xed3d47[_0xadc8('0x12')];this[_0xadc8('0x13')]=_0xed3d47[_0xadc8('0x14')];this['starttime']=_0xed3d47[_0xadc8('0x15')];this['responsetime']=_0xed3d47['responsetime'];this[_0xadc8('0x16')]=_0xed3d47[_0xadc8('0x16')];this['endtime']=moment()[_0xadc8('0x17')](_0xadc8('0x18'));this[_0xadc8('0x19')]=utils[_0xadc8('0x1a')](_0xed3d47[_0xadc8('0x1b')],_0xed3d47[_0xadc8('0x15')]);this['holdtime']=utils[_0xadc8('0x1a')](_0xed3d47[_0xadc8('0x16')],_0xed3d47[_0xadc8('0x1b')]);this[_0xadc8('0x1c')]=utils[_0xadc8('0x1a')](this[_0xadc8('0x1d')],_0xed3d47['answertime']);this['queue']=_0x1cc6f3[_0xadc8('0x1e')];this[_0xadc8('0x1f')]=_0x1cc6f3[_0xadc8('0x1f')];this[_0xadc8('0x20')]=_0x1cc6f3[_0xadc8('0x20')];this[_0xadc8('0x21')]=_0xed3d47[_0xadc8('0x21')];this[_0xadc8('0x22')]=_0xed3d47[_0xadc8('0x22')];this[_0xadc8('0x23')]=_0xed3d47['callbackat'];this[_0xadc8('0x24')]=_0xed3d47[_0xadc8('0x24')];this[_0xadc8('0x25')]=_0xed3d47[_0xadc8('0x25')];this[_0xadc8('0x26')]=_0xed3d47[_0xadc8('0x26')];this['UserId']=_0xed3d47['UserId'];this[_0xadc8('0x27')]=_0xed3d47['VoiceQueueId'];this['CampaignId']=_0xed3d47[_0xadc8('0x28')];this[_0xadc8('0x29')]=_0xed3d47[_0xadc8('0x29')]||'';this['originatecalleridname']=_0xed3d47[_0xadc8('0x2a')]||'';this[_0xadc8('0x2b')]=_0xed3d47[_0xadc8('0x2b')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index fd0f31e..12e5dce 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e5d=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue'];(function(_0x423f1c,_0x2adb8c){var _0xebed4c=function(_0x1beec9){while(--_0x1beec9){_0x423f1c['push'](_0x423f1c['shift']());}};_0xebed4c(++_0x2adb8c);}(_0x4e5d,0x171));var _0xd4e5=function(_0x494a42,_0x1f2103){_0x494a42=_0x494a42-0x0;var _0x254792=_0x4e5d[_0x494a42];return _0x254792;};'use strict';function Final(_0x4965d2){this[_0xd4e5('0x0')]=_0x4965d2['uniqueid'];this[_0xd4e5('0x1')]=_0x4965d2[_0xd4e5('0x1')];this[_0xd4e5('0x2')]=_0x4965d2['type'];this[_0xd4e5('0x3')]=_0x4965d2[_0xd4e5('0x2')]==='outbound'?_0xd4e5('0x4'):_0x4965d2[_0xd4e5('0x2')];this['countbusyretry']=_0x4965d2[_0xd4e5('0x5')];this[_0xd4e5('0x6')]=_0x4965d2[_0xd4e5('0x6')];this[_0xd4e5('0x7')]=_0x4965d2[_0xd4e5('0x7')];this[_0xd4e5('0x8')]=_0x4965d2[_0xd4e5('0x5')]+_0x4965d2['countcongestionretry']+_0x4965d2['countnoanswerretry']+_0x4965d2[_0xd4e5('0x9')]+_0x4965d2['countdropretry']+_0x4965d2[_0xd4e5('0xa')]+_0x4965d2['countmachineretry']+_0x4965d2[_0xd4e5('0xb')];this[_0xd4e5('0x9')]=_0x4965d2[_0xd4e5('0x9')];this[_0xd4e5('0xc')]=_0x4965d2[_0xd4e5('0xc')];this['countabandonedretry']=_0x4965d2['countabandonedretry'];this['countmachineretry']=_0x4965d2[_0xd4e5('0xd')];this[_0xd4e5('0xb')]=_0x4965d2[_0xd4e5('0xb')];this[_0xd4e5('0x4')]=_0x4965d2[_0xd4e5('0x4')];this[_0xd4e5('0xe')]=_0x4965d2[_0xd4e5('0xe')];this[_0xd4e5('0xf')]=_0x4965d2[_0xd4e5('0xf')];this['starttime']=_0x4965d2['starttime'];this[_0xd4e5('0x10')]=_0x4965d2[_0xd4e5('0x10')];this[_0xd4e5('0x11')]=_0x4965d2['responsetime'];this['ringtime']=_0x4965d2[_0xd4e5('0x12')]||0x0;this[_0xd4e5('0x13')]=_0x4965d2[_0xd4e5('0x13')]||0x0;this[_0xd4e5('0x14')]=_0x4965d2[_0xd4e5('0x14')]||0x0;this[_0xd4e5('0x15')]=_0x4965d2[_0xd4e5('0x15')];this[_0xd4e5('0x16')]=_0x4965d2[_0xd4e5('0x16')];this[_0xd4e5('0x17')]=_0x4965d2['callbackat'];this[_0xd4e5('0x18')]=_0x4965d2[_0xd4e5('0x18')];this['ContactId']=_0x4965d2[_0xd4e5('0x19')];this[_0xd4e5('0x1a')]=_0x4965d2[_0xd4e5('0x1a')];this[_0xd4e5('0x1b')]=_0x4965d2['UserId'];this[_0xd4e5('0x1c')]=_0x4965d2[_0xd4e5('0x1c')];this['CampaignId']=_0x4965d2['CampaignId'];this[_0xd4e5('0x1d')]=_0x4965d2[_0xd4e5('0x1d')]||'';this[_0xd4e5('0x1e')]=_0x4965d2[_0xd4e5('0x1e')]||'';this['state']=_0x4965d2[_0xd4e5('0x1f')];this[_0xd4e5('0x20')]=_0x4965d2[_0xd4e5('0x20')];}module[_0xd4e5('0x21')]=Final; \ No newline at end of file +var _0x3a8d=['holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x23c36d,_0x17b50a){var _0x3968dd=function(_0x510eac){while(--_0x510eac){_0x23c36d['push'](_0x23c36d['shift']());}};_0x3968dd(++_0x17b50a);}(_0x3a8d,0x14a));var _0xd3a8=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x3a8d[_0x51ec61];return _0x223200;};'use strict';function Final(_0x22db47){this[_0xd3a8('0x0')]=_0x22db47[_0xd3a8('0x0')];this['scheduledat']=_0x22db47[_0xd3a8('0x1')];this[_0xd3a8('0x2')]=_0x22db47['type'];this[_0xd3a8('0x3')]=_0x22db47[_0xd3a8('0x2')]===_0xd3a8('0x4')?_0xd3a8('0x5'):_0x22db47['type'];this[_0xd3a8('0x6')]=_0x22db47['countbusyretry'];this[_0xd3a8('0x7')]=_0x22db47[_0xd3a8('0x7')];this['countnoanswerretry']=_0x22db47['countnoanswerretry'];this['countglobal']=_0x22db47['countbusyretry']+_0x22db47[_0xd3a8('0x7')]+_0x22db47[_0xd3a8('0x8')]+_0x22db47[_0xd3a8('0x9')]+_0x22db47['countdropretry']+_0x22db47['countabandonedretry']+_0x22db47[_0xd3a8('0xa')]+_0x22db47[_0xd3a8('0xb')];this[_0xd3a8('0x9')]=_0x22db47[_0xd3a8('0x9')];this[_0xd3a8('0xc')]=_0x22db47['countdropretry'];this[_0xd3a8('0xd')]=_0x22db47[_0xd3a8('0xd')];this[_0xd3a8('0xa')]=_0x22db47[_0xd3a8('0xa')];this[_0xd3a8('0xb')]=_0x22db47['countagentrejectretry'];this['queue']=_0x22db47[_0xd3a8('0x5')];this['calleridname']=_0x22db47[_0xd3a8('0xe')];this[_0xd3a8('0xf')]=_0x22db47['calleridnum'];this[_0xd3a8('0x10')]=_0x22db47[_0xd3a8('0x10')];this[_0xd3a8('0x11')]=_0x22db47[_0xd3a8('0x11')];this[_0xd3a8('0x12')]=_0x22db47[_0xd3a8('0x11')];this[_0xd3a8('0x13')]=_0x22db47[_0xd3a8('0x13')]||0x0;this[_0xd3a8('0x14')]=_0x22db47['holdtime']||0x0;this[_0xd3a8('0x15')]=_0x22db47['talktime']||0x0;this[_0xd3a8('0x16')]=_0x22db47['callback'];this[_0xd3a8('0x17')]=_0x22db47['callbackuniqueid'];this['callbackat']=_0x22db47['callbackat'];this['recallme']=_0x22db47[_0xd3a8('0x18')];this['ContactId']=_0x22db47[_0xd3a8('0x19')];this[_0xd3a8('0x1a')]=_0x22db47[_0xd3a8('0x1a')];this[_0xd3a8('0x1b')]=_0x22db47[_0xd3a8('0x1b')];this[_0xd3a8('0x1c')]=_0x22db47['VoiceQueueId'];this[_0xd3a8('0x1d')]=_0x22db47[_0xd3a8('0x1d')];this[_0xd3a8('0x1e')]=_0x22db47[_0xd3a8('0x1e')]||'';this[_0xd3a8('0x1f')]=_0x22db47[_0xd3a8('0x1f')]||'';this[_0xd3a8('0x20')]=_0x22db47[_0xd3a8('0x20')];this['statedesc']=_0x22db47[_0xd3a8('0x21')];}module[_0xd3a8('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index e80ee67..66fd45f 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fe9=['outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','scheduledat','type','campaigntype'];(function(_0x7ddadf,_0x235e39){var _0x3d5f89=function(_0x33d589){while(--_0x33d589){_0x7ddadf['push'](_0x7ddadf['shift']());}};_0x3d5f89(++_0x235e39);}(_0x6fe9,0x195));var _0x96fe=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x6fe9[_0x3b0731];return _0x4204d7;};'use strict';var moment=require(_0x96fe('0x0'));var utils=require('../utils');function Hangup(_0xb3f75e,_0x2c7974){this[_0x96fe('0x1')]=0x4;this['statedesc']='Answer';this[_0x96fe('0x2')]=_0xb3f75e['scheduledat'];this[_0x96fe('0x3')]=_0xb3f75e[_0x96fe('0x3')];this[_0x96fe('0x4')]=_0xb3f75e[_0x96fe('0x3')]===_0x96fe('0x5')?_0x96fe('0x6'):_0xb3f75e[_0x96fe('0x3')];this['amd']=_0xb3f75e[_0x96fe('0x7')]||![];this['countbusyretry']=_0xb3f75e[_0x96fe('0x8')];this[_0x96fe('0x9')]=_0xb3f75e[_0x96fe('0x9')];this['countnoanswerretry']=_0xb3f75e[_0x96fe('0xa')];this[_0x96fe('0xb')]=_0xb3f75e[_0x96fe('0x8')]+_0xb3f75e[_0x96fe('0x9')]+_0xb3f75e[_0x96fe('0xa')]+_0xb3f75e[_0x96fe('0xc')]+_0xb3f75e['countdropretry']+_0xb3f75e[_0x96fe('0xd')]+_0xb3f75e[_0x96fe('0xe')]+_0xb3f75e['countagentrejectretry'];this[_0x96fe('0xc')]=_0xb3f75e['countnosuchnumberretry'];this[_0x96fe('0xf')]=_0xb3f75e[_0x96fe('0xf')];this[_0x96fe('0xd')]=_0xb3f75e[_0x96fe('0xd')];this[_0x96fe('0xe')]=_0xb3f75e[_0x96fe('0xe')];this['countagentrejectretry']=_0xb3f75e[_0x96fe('0x10')];this[_0x96fe('0x11')]=_0x2c7974[_0x96fe('0x11')];this[_0x96fe('0x12')]=_0xb3f75e[_0x96fe('0x13')];this['calleridnum']=_0xb3f75e[_0x96fe('0x14')];this[_0x96fe('0x15')]=_0xb3f75e[_0x96fe('0x15')];this[_0x96fe('0x16')]=_0xb3f75e[_0x96fe('0x16')];this[_0x96fe('0x17')]=moment()['format'](_0x96fe('0x18'));this[_0x96fe('0x19')]=utils[_0x96fe('0x1a')](_0xb3f75e['responsetime'],_0xb3f75e[_0x96fe('0x15')]);this[_0x96fe('0x1b')]=0x0;this[_0x96fe('0x1c')]=utils['getSeconds'](this[_0x96fe('0x17')],_0xb3f75e['responsetime']);this[_0x96fe('0x6')]=_0xb3f75e[_0x96fe('0x6')];this[_0x96fe('0x1d')]='IVR';this[_0x96fe('0x1e')]=_0x2c7974['cause-txt'];this['callback']=_0xb3f75e[_0x96fe('0x1f')];this[_0x96fe('0x20')]=_0xb3f75e[_0x96fe('0x20')];this[_0x96fe('0x21')]=_0xb3f75e[_0x96fe('0x21')];this['recallme']=_0xb3f75e[_0x96fe('0x22')];this[_0x96fe('0x23')]=_0xb3f75e[_0x96fe('0x23')];this['ListId']=_0xb3f75e[_0x96fe('0x24')];this['UserId']=_0xb3f75e[_0x96fe('0x25')];this[_0x96fe('0x26')]=_0xb3f75e[_0x96fe('0x26')];this[_0x96fe('0x27')]=_0xb3f75e[_0x96fe('0x27')];}module[_0x96fe('0x28')]=Hangup; \ No newline at end of file +var _0x6884=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','queue','amd'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x6884,0x17f));var _0x4688=function(_0x19641c,_0x476fb3){_0x19641c=_0x19641c-0x0;var _0x4e634a=_0x6884[_0x19641c];return _0x4e634a;};'use strict';var moment=require(_0x4688('0x0'));var utils=require(_0x4688('0x1'));function Hangup(_0x850a69,_0x79907f){this['state']=0x4;this['statedesc']=_0x4688('0x2');this[_0x4688('0x3')]=_0x850a69[_0x4688('0x3')];this[_0x4688('0x4')]=_0x850a69[_0x4688('0x4')];this['campaigntype']=_0x850a69[_0x4688('0x4')]==='outbound'?_0x4688('0x5'):_0x850a69[_0x4688('0x4')];this[_0x4688('0x6')]=_0x850a69['amd']||![];this[_0x4688('0x7')]=_0x850a69[_0x4688('0x7')];this[_0x4688('0x8')]=_0x850a69['countcongestionretry'];this[_0x4688('0x9')]=_0x850a69['countnoanswerretry'];this[_0x4688('0xa')]=_0x850a69['countbusyretry']+_0x850a69[_0x4688('0x8')]+_0x850a69[_0x4688('0x9')]+_0x850a69[_0x4688('0xb')]+_0x850a69[_0x4688('0xc')]+_0x850a69[_0x4688('0xd')]+_0x850a69[_0x4688('0xe')]+_0x850a69['countagentrejectretry'];this[_0x4688('0xb')]=_0x850a69['countnosuchnumberretry'];this[_0x4688('0xc')]=_0x850a69[_0x4688('0xc')];this[_0x4688('0xd')]=_0x850a69[_0x4688('0xd')];this[_0x4688('0xe')]=_0x850a69['countmachineretry'];this[_0x4688('0xf')]=_0x850a69[_0x4688('0xf')];this[_0x4688('0x10')]=_0x79907f['uniqueid'];this['calleridname']=_0x850a69[_0x4688('0x11')];this[_0x4688('0x12')]=_0x850a69[_0x4688('0x13')];this['starttime']=_0x850a69[_0x4688('0x14')];this[_0x4688('0x15')]=_0x850a69[_0x4688('0x15')];this[_0x4688('0x16')]=moment()[_0x4688('0x17')](_0x4688('0x18'));this['ringtime']=utils[_0x4688('0x19')](_0x850a69[_0x4688('0x15')],_0x850a69['starttime']);this[_0x4688('0x1a')]=0x0;this[_0x4688('0x1b')]=utils[_0x4688('0x19')](this['endtime'],_0x850a69[_0x4688('0x15')]);this[_0x4688('0x5')]=_0x850a69['queue'];this['membername']=_0x4688('0x1c');this[_0x4688('0x1d')]=_0x79907f[_0x4688('0x1e')];this[_0x4688('0x1f')]=_0x850a69[_0x4688('0x1f')];this[_0x4688('0x20')]=_0x850a69['callbackuniqueid'];this[_0x4688('0x21')]=_0x850a69[_0x4688('0x21')];this['recallme']=_0x850a69['recallme'];this[_0x4688('0x22')]=_0x850a69[_0x4688('0x22')];this['ListId']=_0x850a69['ListId'];this[_0x4688('0x23')]=_0x850a69[_0x4688('0x23')];this[_0x4688('0x24')]=_0x850a69[_0x4688('0x24')];this[_0x4688('0x25')]=_0x850a69[_0x4688('0x25')];}module[_0x4688('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index f78fcf7..0d04c2d 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a3d=['originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x520a1b,_0x446485){var _0x11bea9=function(_0x2241cc){while(--_0x2241cc){_0x520a1b['push'](_0x520a1b['shift']());}};_0x11bea9(++_0x446485);}(_0x6a3d,0x181));var _0xd6a3=function(_0x3104bb,_0x87275){_0x3104bb=_0x3104bb-0x0;var _0x40e6d5=_0x6a3d[_0x3104bb];return _0x40e6d5;};'use strict';var utils=require(_0xd6a3('0x0'));function History(_0x166b75){this[_0xd6a3('0x1')]=_0x166b75[_0xd6a3('0x1')];this[_0xd6a3('0x2')]=_0x166b75[_0xd6a3('0x2')]||undefined;this[_0xd6a3('0x3')]=_0x166b75[_0xd6a3('0x3')];this[_0xd6a3('0x4')]=_0x166b75[_0xd6a3('0x3')]===_0xd6a3('0x5')?_0xd6a3('0x6'):_0x166b75[_0xd6a3('0x3')];this[_0xd6a3('0x7')]=_0x166b75[_0xd6a3('0x7')];this[_0xd6a3('0x8')]=_0x166b75['countcongestionretry'];this[_0xd6a3('0x9')]=_0x166b75[_0xd6a3('0x9')];this[_0xd6a3('0xa')]=_0x166b75[_0xd6a3('0x7')]+_0x166b75[_0xd6a3('0x8')]+_0x166b75[_0xd6a3('0x9')]+_0x166b75[_0xd6a3('0xb')]+_0x166b75[_0xd6a3('0xc')]+_0x166b75[_0xd6a3('0xd')]+_0x166b75[_0xd6a3('0xe')]+_0x166b75[_0xd6a3('0xf')];this['countnosuchnumberretry']=_0x166b75[_0xd6a3('0xb')];this[_0xd6a3('0xc')]=_0x166b75['countdropretry'];this[_0xd6a3('0xd')]=_0x166b75[_0xd6a3('0xd')];this[_0xd6a3('0xe')]=_0x166b75['countmachineretry'];this['countagentrejectretry']=_0x166b75[_0xd6a3('0xf')];this[_0xd6a3('0x6')]=_0x166b75[_0xd6a3('0x6')];this[_0xd6a3('0x10')]=_0x166b75[_0xd6a3('0x11')];this[_0xd6a3('0x12')]=_0x166b75[_0xd6a3('0x13')];this[_0xd6a3('0x14')]=_0x166b75[_0xd6a3('0x14')];this[_0xd6a3('0x15')]=_0x166b75[_0xd6a3('0x15')];this['endtime']=_0x166b75[_0xd6a3('0x15')];this[_0xd6a3('0x16')]=utils[_0xd6a3('0x17')](_0x166b75[_0xd6a3('0x15')],_0x166b75['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0xd6a3('0x18')]=_0x166b75[_0xd6a3('0x18')];this['callbackuniqueid']=_0x166b75[_0xd6a3('0x19')];this[_0xd6a3('0x1a')]=_0x166b75[_0xd6a3('0x1a')];this[_0xd6a3('0x1b')]=_0x166b75[_0xd6a3('0x1b')];this['ContactId']=_0x166b75[_0xd6a3('0x1c')];this['ListId']=_0x166b75[_0xd6a3('0x1d')];this[_0xd6a3('0x1e')]=_0x166b75[_0xd6a3('0x1e')];this[_0xd6a3('0x1f')]=_0x166b75[_0xd6a3('0x1f')];this[_0xd6a3('0x20')]=_0x166b75[_0xd6a3('0x20')];this[_0xd6a3('0x21')]=_0x166b75['originatecalleridnum']||'';this[_0xd6a3('0x22')]=_0x166b75[_0xd6a3('0x22')]||'';this[_0xd6a3('0x23')]=_0x166b75[_0xd6a3('0x23')];this[_0xd6a3('0x24')]=_0x166b75[_0xd6a3('0x24')];}module[_0xd6a3('0x25')]=History; \ No newline at end of file +var _0xf958=['queue','calleridname','calleridnum','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf958,0xab));var _0x8f95=function(_0x28ffab,_0x42fb50){_0x28ffab=_0x28ffab-0x0;var _0x3e20f4=_0xf958[_0x28ffab];return _0x3e20f4;};'use strict';var utils=require('../utils');function History(_0x13dad1){this[_0x8f95('0x0')]=_0x13dad1[_0x8f95('0x0')];this[_0x8f95('0x1')]=_0x13dad1[_0x8f95('0x1')]||undefined;this[_0x8f95('0x2')]=_0x13dad1[_0x8f95('0x2')];this[_0x8f95('0x3')]=_0x13dad1[_0x8f95('0x2')]===_0x8f95('0x4')?'queue':_0x13dad1[_0x8f95('0x2')];this[_0x8f95('0x5')]=_0x13dad1[_0x8f95('0x5')];this[_0x8f95('0x6')]=_0x13dad1[_0x8f95('0x6')];this['countnoanswerretry']=_0x13dad1[_0x8f95('0x7')];this[_0x8f95('0x8')]=_0x13dad1['countbusyretry']+_0x13dad1['countcongestionretry']+_0x13dad1[_0x8f95('0x7')]+_0x13dad1[_0x8f95('0x9')]+_0x13dad1[_0x8f95('0xa')]+_0x13dad1[_0x8f95('0xb')]+_0x13dad1[_0x8f95('0xc')]+_0x13dad1[_0x8f95('0xd')];this['countnosuchnumberretry']=_0x13dad1['countnosuchnumberretry'];this[_0x8f95('0xa')]=_0x13dad1[_0x8f95('0xa')];this[_0x8f95('0xb')]=_0x13dad1[_0x8f95('0xb')];this['countmachineretry']=_0x13dad1[_0x8f95('0xc')];this[_0x8f95('0xd')]=_0x13dad1[_0x8f95('0xd')];this[_0x8f95('0xe')]=_0x13dad1[_0x8f95('0xe')];this[_0x8f95('0xf')]=_0x13dad1['name'];this[_0x8f95('0x10')]=_0x13dad1['number'];this[_0x8f95('0x11')]=_0x13dad1[_0x8f95('0x11')];this[_0x8f95('0x12')]=_0x13dad1[_0x8f95('0x12')];this['endtime']=_0x13dad1[_0x8f95('0x12')];this[_0x8f95('0x13')]=utils[_0x8f95('0x14')](_0x13dad1['responsetime'],_0x13dad1[_0x8f95('0x11')]);this[_0x8f95('0x15')]=0x0;this[_0x8f95('0x16')]=0x0;this[_0x8f95('0x17')]=_0x13dad1['callback'];this[_0x8f95('0x18')]=_0x13dad1[_0x8f95('0x18')];this['callbackat']=_0x13dad1[_0x8f95('0x19')];this[_0x8f95('0x1a')]=_0x13dad1[_0x8f95('0x1a')];this[_0x8f95('0x1b')]=_0x13dad1['ContactId'];this[_0x8f95('0x1c')]=_0x13dad1[_0x8f95('0x1c')];this['UserId']=_0x13dad1[_0x8f95('0x1d')];this['VoiceQueueId']=_0x13dad1[_0x8f95('0x1e')];this['CampaignId']=_0x13dad1[_0x8f95('0x1f')];this[_0x8f95('0x20')]=_0x13dad1[_0x8f95('0x20')]||'';this[_0x8f95('0x21')]=_0x13dad1['originatecalleridname']||'';this[_0x8f95('0x22')]=_0x13dad1[_0x8f95('0x22')];this[_0x8f95('0x23')]=_0x13dad1[_0x8f95('0x23')];}module[_0x8f95('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 67a3c55..789a4a3 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ba=['endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xf2ba,0xf1));var _0xaf2b=function(_0x170682,_0x1fe7b7){_0x170682=_0x170682-0x0;var _0x2d9f0e=_0xf2ba[_0x170682];return _0x2d9f0e;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5d80cb,_0x39673f){this['scheduledat']=_0x5d80cb[_0xaf2b('0x0')];this['type']=_0x5d80cb['type'];this[_0xaf2b('0x1')]=_0x5d80cb[_0xaf2b('0x2')]===_0xaf2b('0x3')?_0xaf2b('0x4'):_0x5d80cb[_0xaf2b('0x2')];this[_0xaf2b('0x5')]=_0x5d80cb[_0xaf2b('0x5')];this[_0xaf2b('0x6')]=_0x5d80cb[_0xaf2b('0x6')];this[_0xaf2b('0x7')]=_0x5d80cb[_0xaf2b('0x7')];this[_0xaf2b('0x8')]=_0x5d80cb['countbusyretry']+_0x5d80cb['countcongestionretry']+_0x5d80cb[_0xaf2b('0x7')]+_0x5d80cb['countnosuchnumberretry']+_0x5d80cb[_0xaf2b('0x9')]+_0x5d80cb['countabandonedretry']+_0x5d80cb[_0xaf2b('0xa')]+_0x5d80cb[_0xaf2b('0xb')];this['countnosuchnumberretry']=_0x5d80cb[_0xaf2b('0xc')];this[_0xaf2b('0x9')]=_0x5d80cb['countdropretry'];this['countabandonedretry']=_0x5d80cb[_0xaf2b('0xd')];this[_0xaf2b('0xa')]=_0x5d80cb[_0xaf2b('0xa')];this['countagentrejectretry']=_0x5d80cb['countagentrejectretry'];this[_0xaf2b('0xe')]=_0x39673f[_0xaf2b('0xe')];this[_0xaf2b('0xf')]=_0x5d80cb[_0xaf2b('0x10')];this[_0xaf2b('0x11')]=_0x5d80cb[_0xaf2b('0x12')];this[_0xaf2b('0x13')]=_0x5d80cb[_0xaf2b('0x13')];this[_0xaf2b('0x14')]=_0x5d80cb[_0xaf2b('0x14')];this[_0xaf2b('0x15')]=_0x5d80cb['droptime'];this[_0xaf2b('0x16')]=_0x5d80cb[_0xaf2b('0x16')];this[_0xaf2b('0x17')]=this[_0xaf2b('0x15')];this[_0xaf2b('0x18')]=utils[_0xaf2b('0x19')](_0x5d80cb['responsetime'],_0x5d80cb[_0xaf2b('0x13')]);this['holdtime']=utils['getSeconds'](this[_0xaf2b('0x15')],_0x5d80cb[_0xaf2b('0x14')]);this[_0xaf2b('0x1a')]=0x0;this['queue']=_0x39673f['queue'];this[_0xaf2b('0x1b')]=_0x39673f[_0xaf2b('0x1c')];this['reason']=_0x39673f[_0xaf2b('0x1d')];this[_0xaf2b('0x1e')]=_0x5d80cb[_0xaf2b('0x1e')];this[_0xaf2b('0x1f')]=_0x5d80cb['callbackuniqueid'];this[_0xaf2b('0x20')]=_0x5d80cb[_0xaf2b('0x20')];this[_0xaf2b('0x21')]=_0x5d80cb[_0xaf2b('0x21')];this[_0xaf2b('0x22')]=_0x5d80cb[_0xaf2b('0x22')];this[_0xaf2b('0x23')]=_0x5d80cb[_0xaf2b('0x23')];this[_0xaf2b('0x24')]=_0x5d80cb['UserId'];this[_0xaf2b('0x25')]=_0x5d80cb[_0xaf2b('0x25')];this[_0xaf2b('0x26')]=_0x5d80cb[_0xaf2b('0x26')];this['originatecalleridnum']=_0x5d80cb['originatecalleridnum']||'';this[_0xaf2b('0x27')]=_0x5d80cb[_0xaf2b('0x27')]||'';this[_0xaf2b('0x28')]=_0x5d80cb[_0xaf2b('0x28')];this['state']=_0x5d80cb[_0xaf2b('0x29')];this[_0xaf2b('0x2a')]=_0x5d80cb[_0xaf2b('0x2a')];}module[_0xaf2b('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xa3bb=['callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid'];(function(_0x1b9955,_0x2c269e){var _0x2a0f29=function(_0x43fd9b){while(--_0x43fd9b){_0x1b9955['push'](_0x1b9955['shift']());}};_0x2a0f29(++_0x2c269e);}(_0xa3bb,0x199));var _0xba3b=function(_0x2f1595,_0x319a11){_0x2f1595=_0x2f1595-0x0;var _0x2eada8=_0xa3bb[_0x2f1595];return _0x2eada8;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x5f0f10,_0x4ad8fc){this['scheduledat']=_0x5f0f10[_0xba3b('0x0')];this[_0xba3b('0x1')]=_0x5f0f10[_0xba3b('0x1')];this[_0xba3b('0x2')]=_0x5f0f10[_0xba3b('0x1')]===_0xba3b('0x3')?_0xba3b('0x4'):_0x5f0f10[_0xba3b('0x1')];this['countbusyretry']=_0x5f0f10[_0xba3b('0x5')];this[_0xba3b('0x6')]=_0x5f0f10[_0xba3b('0x6')];this[_0xba3b('0x7')]=_0x5f0f10[_0xba3b('0x7')];this[_0xba3b('0x8')]=_0x5f0f10['countbusyretry']+_0x5f0f10[_0xba3b('0x6')]+_0x5f0f10[_0xba3b('0x7')]+_0x5f0f10['countnosuchnumberretry']+_0x5f0f10[_0xba3b('0x9')]+_0x5f0f10[_0xba3b('0xa')]+_0x5f0f10[_0xba3b('0xb')]+_0x5f0f10[_0xba3b('0xc')];this[_0xba3b('0xd')]=_0x5f0f10[_0xba3b('0xd')];this[_0xba3b('0x9')]=_0x5f0f10[_0xba3b('0x9')];this['countabandonedretry']=_0x5f0f10['countabandonedretry'];this['countmachineretry']=_0x5f0f10['countmachineretry'];this['countagentrejectretry']=_0x5f0f10[_0xba3b('0xc')];this[_0xba3b('0xe')]=_0x4ad8fc[_0xba3b('0xe')];this['calleridname']=_0x5f0f10[_0xba3b('0xf')];this[_0xba3b('0x10')]=_0x5f0f10[_0xba3b('0x11')];this[_0xba3b('0x12')]=_0x5f0f10['starttime'];this[_0xba3b('0x13')]=_0x5f0f10['responsetime'];this[_0xba3b('0x14')]=_0x5f0f10[_0xba3b('0x14')];this[_0xba3b('0x15')]=_0x5f0f10[_0xba3b('0x15')];this[_0xba3b('0x16')]=this['droptime'];this[_0xba3b('0x17')]=utils[_0xba3b('0x18')](_0x5f0f10['responsetime'],_0x5f0f10[_0xba3b('0x12')]);this[_0xba3b('0x19')]=utils[_0xba3b('0x18')](this[_0xba3b('0x14')],_0x5f0f10['responsetime']);this[_0xba3b('0x1a')]=0x0;this[_0xba3b('0x4')]=_0x4ad8fc[_0xba3b('0x4')];this['membername']=_0x4ad8fc[_0xba3b('0x1b')];this[_0xba3b('0x1c')]=_0x4ad8fc['reason'];this[_0xba3b('0x1d')]=_0x5f0f10['callback'];this[_0xba3b('0x1e')]=_0x5f0f10[_0xba3b('0x1e')];this[_0xba3b('0x1f')]=_0x5f0f10[_0xba3b('0x1f')];this[_0xba3b('0x20')]=_0x5f0f10['recallme'];this[_0xba3b('0x21')]=_0x5f0f10[_0xba3b('0x21')];this['ListId']=_0x5f0f10['ListId'];this[_0xba3b('0x22')]=_0x5f0f10['UserId'];this[_0xba3b('0x23')]=_0x5f0f10[_0xba3b('0x23')];this['CampaignId']=_0x5f0f10['CampaignId'];this[_0xba3b('0x24')]=_0x5f0f10[_0xba3b('0x24')]||'';this['originatecalleridname']=_0x5f0f10['originatecalleridname']||'';this['agiafterat']=_0x5f0f10['agiafterat'];this[_0xba3b('0x25')]=_0x5f0f10[_0xba3b('0x25')];this[_0xba3b('0x26')]=_0x5f0f10[_0xba3b('0x26')];}module[_0xba3b('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 7bda39e..356873b 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x4819,0xcd));var _0x9481=function(_0x5ea82f,_0x41ef96){_0x5ea82f=_0x5ea82f-0x0;var _0x2f38b6=_0x4819[_0x5ea82f];return _0x2f38b6;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=createHistory; \ No newline at end of file +var _0x82c4=['checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','catch','temp','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer'];(function(_0x2b2244,_0x20010a){var _0x1723e8=function(_0x1d90ad){while(--_0x1d90ad){_0x2b2244['push'](_0x2b2244['shift']());}};_0x1723e8(++_0x20010a);}(_0x82c4,0x1ca));var _0x482c=function(_0x33f1a3,_0x1557a5){_0x33f1a3=_0x33f1a3-0x0;var _0x1f3d03=_0x82c4[_0x33f1a3];return _0x1f3d03;};'use strict';var util=require(_0x482c('0x0'));var logger=require(_0x482c('0x1'))(_0x482c('0x2'));var cmHopper=require(_0x482c('0x3'));var cmHopperAdditionalPhone=require(_0x482c('0x4'));var cmHopperBlack=require(_0x482c('0x5'));var cmHopperHistory=require(_0x482c('0x6'));function inspectError(_0x56de13){return util[_0x482c('0x7')](_0x56de13,{'showHidden':![],'depth':null});}function getContactDialer(_0x5f4dee,_0x4556c8,_0x47edb6){return cmHopper[_0x482c('0x8')](_0x5f4dee['id'],_0x4556c8,_0x47edb6,_0x5f4dee['dialOrderByScheduledAt'])[_0x482c('0x9')](function(_0x32a503){_0x5f4dee[_0x482c('0xa')]=0x0;logger[_0x482c('0xb')](_0x482c('0xc'),inspectError(_0x32a503));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x171c5b,_0x135cc1){return cmHopper[_0x482c('0xd')](_0x171c5b['id'],_0x135cc1,_0x171c5b[_0x482c('0xe')])[_0x482c('0x9')](function(_0x17e233){_0x171c5b['temp']=0x0;logger[_0x482c('0xb')](_0x482c('0xf'),inspectError(_0x17e233));});}exports[_0x482c('0xd')]=getContactDialerIvr;function countReScheduled(_0x5e3eea){return cmHopper[_0x482c('0x10')](_0x5e3eea)[_0x482c('0x9')](function(_0x3fabb3){logger['error']('[countReScheduled]',inspectError(_0x3fabb3));});}exports[_0x482c('0x10')]=countReScheduled;function rescheduleContact(_0x30e02b){return cmHopper['rescheduleContact'](_0x30e02b)['catch'](function(_0x14452b){logger[_0x482c('0xb')](_0x482c('0x11'),inspectError(_0x14452b));});}exports[_0x482c('0x12')]=rescheduleContact;function unlockContact(_0x37a4f0,_0x119635,_0x3beedb){return cmHopper[_0x482c('0x13')](_0x37a4f0,_0x119635,_0x3beedb)[_0x482c('0x9')](function(_0x1758fb){logger[_0x482c('0xb')](_0x482c('0x14'),inspectError(_0x1758fb));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x244bb9){return cmHopper['moveContactManagedDialer'](_0x244bb9)[_0x482c('0x9')](function(_0x258148){logger['error']('[moveContactManagedDialer]',inspectError(_0x258148));});}exports[_0x482c('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x584656){return cmHopperBlack[_0x482c('0x16')](_0x584656)[_0x482c('0x9')](function(_0x281c60){logger[_0x482c('0xb')]('[checkIsBlackList]',inspectError(_0x281c60));});}exports[_0x482c('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x22eec6){return cmHopperBlack[_0x482c('0x17')](_0x22eec6)[_0x482c('0x9')](function(_0x14d832){logger['error']('[checkIsBlackListIvr]',inspectError(_0x14d832));});}exports[_0x482c('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x147d05,_0x180feb,_0x5c4e9c){return cmHopperAdditionalPhone[_0x482c('0x18')](_0x147d05,_0x180feb,_0x5c4e9c)['catch'](function(_0x2f3f96){logger[_0x482c('0xb')]('[verifyAdditionalPhone]',inspectError(_0x2f3f96));});}exports[_0x482c('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5436e2,_0x589bc6,_0x2165af){return cmHopperAdditionalPhone[_0x482c('0x19')](_0x5436e2,_0x589bc6,_0x2165af)[_0x482c('0x9')](function(_0x1f4501){logger[_0x482c('0xb')](_0x482c('0x1a'),inspectError(_0x1f4501));});}exports[_0x482c('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x5ad788){return cmHopperHistory[_0x482c('0x1b')](_0x5ad788)[_0x482c('0x9')](function(_0x58da7c){logger[_0x482c('0xb')]('[avgHandleTime]',inspectError(_0x58da7c));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x207441){return cmHopperHistory['createHistory'](_0x207441)[_0x482c('0x9')](function(_0x2c5121){logger[_0x482c('0xb')](_0x482c('0x1c'),inspectError(_0x2c5121));});}exports[_0x482c('0x1d')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 51825d8..fbb9139 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39de=['UNREACHABLE_TRUNK','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','lodash','moment','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x39de,0x161));var _0xe39d=function(_0x24d1c1,_0x365bf3){_0x24d1c1=_0x24d1c1-0x0;var _0x908781=_0x39de[_0x24d1c1];return _0x908781;};'use strict';var _=require(_0xe39d('0x0'));var moment=require(_0xe39d('0x1'));var util=require('util');var logger=require(_0xe39d('0x2'))('dialer');var timezones=require(_0xe39d('0x3'))[_0xe39d('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xe39d('0x5'),'BLACKLIST':_0xe39d('0x6'),'CONTACTS_RESCHEDULED':_0xe39d('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xe39d('0x8'),'EMPTY_INTERVAL':_0xe39d('0x9'),'INACTIVE':_0xe39d('0xa'),'NO_AGENTS_LOGGED':_0xe39d('0xb'),'NO_AVAILABLE_CONTACTS':_0xe39d('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xe39d('0xd'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xe39d('0xe'),'UNKNOWN_TIMEZONE':_0xe39d('0xf'),'UNREACHABLE_TRUNK':_0xe39d('0x10')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x246f2e){return _0x246f2e[_0xe39d('0x11')]===_0xe39d('0x12');}exports[_0xe39d('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x4e27b6){return _0x4e27b6[_0xe39d('0x14')]===_0xe39d('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x113be0){return _0x113be0['type']===_0xe39d('0x16');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x54c53b){return _0x54c53b[_0xe39d('0x17')];}exports[_0xe39d('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2e7231){return _0x2e7231['active'];}exports[_0xe39d('0x19')]=isIVRCampaignActive;function getSeconds(_0x1ab2fa,_0x11732c){var _0x2b734d=moment(_0x1ab2fa)['milliseconds'](0x0);var _0x271518=moment(_0x11732c)[_0xe39d('0x1a')](0x0);return _0x2b734d['diff'](_0x271518,_0xe39d('0x1b'));}exports[_0xe39d('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0xccb13b,_0x205d42){var _0x1e0f20=![];var _0x1e1101=_0xccb13b[_0xe39d('0x11')]!==_0x205d42['dialMethod']||_0xccb13b['dialActive']!==_0x205d42[_0xe39d('0x17')]||_0xccb13b[_0xe39d('0x1d')]!==_0x205d42['message'];var _0x545da1=_0xccb13b['available']!==_0x205d42[_0xe39d('0x1e')]||_0xccb13b['loggedIn']!==_0x205d42[_0xe39d('0x1f')]||_0xccb13b['loggedInDb']!==_0x205d42['loggedInDb']||_0xccb13b['paused']!==_0x205d42[_0xe39d('0x20')]||_0xccb13b['talking']!==_0x205d42[_0xe39d('0x21')]||_0xccb13b[_0xe39d('0x22')]!==_0x205d42[_0xe39d('0x22')]||_0xccb13b[_0xe39d('0x23')]!==_0x205d42[_0xe39d('0x23')]||_0xccb13b[_0xe39d('0x24')]!==_0x205d42[_0xe39d('0x24')]||_0xccb13b[_0xe39d('0x25')]!==_0x205d42['originated'];if(_0xccb13b[_0xe39d('0x26')]&&_0x205d42[_0xe39d('0x26')]){_0x1e0f20=_0xccb13b[_0xe39d('0x26')][_0xe39d('0x27')]!==_0x205d42[_0xe39d('0x26')][_0xe39d('0x27')]||_0xccb13b[_0xe39d('0x26')][_0xe39d('0x28')]!==_0x205d42[_0xe39d('0x26')][_0xe39d('0x28')];}return _0x1e1101||_0x545da1||_0x1e0f20;}exports[_0xe39d('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xde4b95){var _0x1f3c57=null;var _0x139756=_0xde4b95[_0xe39d('0x2a')];if(_['isNil'](_0xde4b95['dialGlobalInterval'])||_[_0xe39d('0x2b')](_0xde4b95[_0xe39d('0x2c')])||_[_0xe39d('0x2b')](_0xde4b95[_0xe39d('0x2c')][_0xe39d('0x2d')])){_0x1f3c57=CAMPAIGN_STATUS[_0xe39d('0x2e')];}else if(_[_0xe39d('0x2f')](_0xde4b95['dialGlobalInterval'])||_[_0xe39d('0x2f')](_0xde4b95['Interval'][_0xe39d('0x2d')])){_0x1f3c57=CAMPAIGN_STATUS[_0xe39d('0x30')];}else if(_0x139756&&!timezones[_0x139756]){_0x1f3c57=CAMPAIGN_STATUS[_0xe39d('0x31')];}return _0x1f3c57;}function checkAnyValidTrunk(_0x561835,_0xd973d1){var _0x4b7810=null;var _0x3af3ee='SIP/';var _0x46368f=[_0xe39d('0x32'),_0xe39d('0x33')];var _0xb86727=!![];if(_0x561835[_0xe39d('0x26')]&&_0x561835[_0xe39d('0x26')][_0xe39d('0x28')]){_0x3af3ee+=_0x561835[_0xe39d('0x26')][_0xe39d('0x27')];_0x4b7810=_0xd973d1[_0x3af3ee];_0xb86727=_0x46368f[_0xe39d('0x34')](_0x4b7810['status']);}else if(_0x561835[_0xe39d('0x35')]&&_0x561835[_0xe39d('0x35')]['active']){_0x3af3ee+=_0x561835[_0xe39d('0x35')]['name'];_0x4b7810=_0xd973d1[_0x3af3ee];_0xb86727=_0x46368f[_0xe39d('0x34')](_0x4b7810[_0xe39d('0x36')]);}return _0xb86727;}function getQueueCampaignStatusMessage(_0x2751d8,_0x4f3b32){var _0x154818=CAMPAIGN_STATUS[_0xe39d('0x5')];var _0x3d00b7=isPreviewCampaign(_0x2751d8);if(!isQueueCampaignActive(_0x2751d8)){if(_0x3d00b7){_0x154818=CAMPAIGN_STATUS[_0xe39d('0x37')];}else{if(_0x2751d8[_0xe39d('0x25')]===0x0&&_0x2751d8[_0xe39d('0x21')]===0x0&&_0x2751d8[_0xe39d('0x23')]===0x0&&(_0x2751d8[_0xe39d('0x22')]||0x0)===0x0){_0x154818=CAMPAIGN_STATUS[_0xe39d('0x37')];}else{_0x154818=CAMPAIGN_STATUS[_0xe39d('0x38')];}}}else if(_0x2751d8[_0xe39d('0x1f')]===0x0){_0x154818=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2751d8,_0x4f3b32)){_0x154818=CAMPAIGN_STATUS[_0xe39d('0x39')];}else if(!isPreviewCampaign(_0x2751d8)){var _0x3be9d8=checkAnyValidQueueCampaignInterval(_0x2751d8);if(_0x3be9d8){_0x154818=_0x3be9d8;}}return _0x154818;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x379a49){var _0x120f96=CAMPAIGN_STATUS[_0xe39d('0x38')];if(_0x379a49[_0xe39d('0x25')]===0x0&&_0x379a49[_0xe39d('0x21')]===0x0&&_0x379a49['waiting']===0x0&&(_0x379a49[_0xe39d('0x22')]||0x0)===0x0){_0x120f96=CAMPAIGN_STATUS[_0xe39d('0x37')];}return _0x120f96;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x233661){var _0x66181=_0x233661['match'](/"(.*?)"/);return _0x66181?_0x66181[0x1]:_0x233661;}exports[_0xe39d('0x3a')]=extractCalleridName;function getCallerId(_0x51119e,_0x38f50f,_0x1ebcfb){if(!_[_0xe39d('0x3b')](_0x1ebcfb)&&typeof _0x1ebcfb===_0xe39d('0x3c')&&!_[_0xe39d('0x2f')](_0x1ebcfb)){if(!_[_0xe39d('0x3b')](_0x38f50f)&&typeof _0x38f50f===_0xe39d('0x3c')&&!_[_0xe39d('0x2f')](_0x38f50f)){return util[_0xe39d('0x3d')](_0xe39d('0x3e'),_0x38f50f,_0x1ebcfb);}return util[_0xe39d('0x3d')](_0xe39d('0x3e'),_0x1ebcfb,_0x1ebcfb);}if(!_[_0xe39d('0x3b')](_0x51119e)&&typeof _0x51119e===_0xe39d('0x3c')&&!_[_0xe39d('0x2f')](_0x51119e)){return _0x51119e;}return _0xe39d('0x3f');}exports[_0xe39d('0x40')]=getCallerId;function getCallerIdRandom(_0x3039bf,_0x5d71ae){var _0x167998;var _0x1b1ebb;var _0x2f83d4;if(_0x5d71ae<=0x0){_0x5d71ae=0x1;}_0x167998=new RegExp(_0xe39d('0x41')+_0x5d71ae+'}$');_0x1b1ebb=Math[_0xe39d('0x42')](0xa,_0x5d71ae-0x1);_0x2f83d4=Math[_0xe39d('0x42')](0xa,_0x5d71ae)-0x1;return util[_0xe39d('0x3d')]('%s',_[_0xe39d('0x43')](_0x3039bf,_0x167998,_[_0xe39d('0x44')](_0x1b1ebb,_0x2f83d4)[_0xe39d('0x45')]()));}exports[_0xe39d('0x46')]=getCallerIdRandom;function decrementOriginate(_0x40877d){if(_0x40877d[_0xe39d('0x25')]&&_0x40877d['originated']>0x0){_0x40877d[_0xe39d('0x25')]-=0x1;}else{logger[_0xe39d('0x47')](_0xe39d('0x48'));}}exports[_0xe39d('0x49')]=decrementOriginate;function checkContactEmpty(_0x21a234){return _0x21a234&&_0x21a234['length']>0x0;}exports[_0xe39d('0x4a')]=checkContactEmpty;function erlangb(_0x21451a,_0x50cff1){if(_0x50cff1===0x0){return 0x0;}var _0x371266=0x1;for(var _0x16a22c=0x1;_0x16a22c<=_0x50cff1;_0x16a22c+=0x1){_0x371266=0x1+_0x371266*_0x16a22c/_0x21451a;}return 0x1/_0x371266;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x5539da,_0x341015,_0x51d51d){if(_0x341015>_0x51d51d){for(var _0x3f8f1e=0x0;_0x3f8f1e<_0x341015-_0x51d51d;_0x3f8f1e+=0x1){decrementOriginate(_0x5539da);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x72b0ed){var _0x240f44={};var _0x22fa60=['id',_0xe39d('0x4b'),_0xe39d('0x4c'),_0xe39d('0x4d'),_0xe39d('0x4e')];if(_0x72b0ed){for(var _0x2b60bb in _0x72b0ed){if(typeof _0x72b0ed[_0x2b60bb]!==_0xe39d('0x4f')){if(!_[_0xe39d('0x2b')](_0x72b0ed[_0x2b60bb])&&!_0x22fa60['includes'](_0x2b60bb)){_0x240f44[util[_0xe39d('0x3d')](_0xe39d('0x50'),_0xe39d('0x51'),_0x2b60bb['toUpperCase']())]=_0x72b0ed[_0x2b60bb];}}}}return _0x240f44;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x162f=['preview','isPreviewCampaign','ivr','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','dialMethod','message','available','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','loggedIn','NO_AGENTS_LOGGED','DISACTIVED','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','createdAt','description','tags','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING'];(function(_0x1825d7,_0x25700b){var _0x649cd2=function(_0x22406d){while(--_0x22406d){_0x1825d7['push'](_0x1825d7['shift']());}};_0x649cd2(++_0x25700b);}(_0x162f,0x95));var _0xf162=function(_0x21d4f6,_0x3076f7){_0x21d4f6=_0x21d4f6-0x0;var _0x1de699=_0x162f[_0x21d4f6];return _0x1de699;};'use strict';var _=require(_0xf162('0x0'));var moment=require(_0xf162('0x1'));var util=require('util');var logger=require(_0xf162('0x2'))(_0xf162('0x3'));var timezones=require(_0xf162('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xf162('0x5'),'BLACKLIST':_0xf162('0x6'),'CONTACTS_RESCHEDULED':_0xf162('0x7'),'DEACTIVATED':_0xf162('0x8'),'DISACTIVED':_0xf162('0x9'),'EMPTY_INTERVAL':_0xf162('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xf162('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xf162('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xf162('0xd'),'QUEUE_RECALL':_0xf162('0xe'),'RECALL_TIMEOUT':_0xf162('0xf'),'RUNNING':_0xf162('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x44ddb8){return _0x44ddb8['dialMethod']===_0xf162('0x11');}exports[_0xf162('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x5305a8){return _0x5305a8['type']===_0xf162('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4aac06){return _0x4aac06[_0xf162('0x14')]==='outbound';}exports[_0xf162('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x322d97){return _0x322d97[_0xf162('0x16')];}exports[_0xf162('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2dde2d){return _0x2dde2d[_0xf162('0x18')];}exports[_0xf162('0x19')]=isIVRCampaignActive;function getSeconds(_0x3b27fc,_0x4bca9a){var _0x337f36=moment(_0x3b27fc)[_0xf162('0x1a')](0x0);var _0x51aabe=moment(_0x4bca9a)[_0xf162('0x1a')](0x0);return _0x337f36[_0xf162('0x1b')](_0x51aabe,_0xf162('0x1c'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x1b9de0,_0x4b3c39){var _0x10f6f9=![];var _0x3a2aae=_0x1b9de0['dialMethod']!==_0x4b3c39[_0xf162('0x1d')]||_0x1b9de0[_0xf162('0x16')]!==_0x4b3c39[_0xf162('0x16')]||_0x1b9de0[_0xf162('0x1e')]!==_0x4b3c39['message'];var _0x1d4bea=_0x1b9de0[_0xf162('0x1f')]!==_0x4b3c39[_0xf162('0x1f')]||_0x1b9de0['loggedIn']!==_0x4b3c39['loggedIn']||_0x1b9de0[_0xf162('0x20')]!==_0x4b3c39[_0xf162('0x20')]||_0x1b9de0[_0xf162('0x21')]!==_0x4b3c39[_0xf162('0x21')]||_0x1b9de0['talking']!==_0x4b3c39[_0xf162('0x22')]||_0x1b9de0[_0xf162('0x23')]!==_0x4b3c39[_0xf162('0x23')]||_0x1b9de0[_0xf162('0x24')]!==_0x4b3c39[_0xf162('0x24')]||_0x1b9de0[_0xf162('0x25')]!==_0x4b3c39[_0xf162('0x25')]||_0x1b9de0[_0xf162('0x26')]!==_0x4b3c39['originated'];if(_0x1b9de0[_0xf162('0x27')]&&_0x4b3c39[_0xf162('0x27')]){_0x10f6f9=_0x1b9de0[_0xf162('0x27')]['name']!==_0x4b3c39[_0xf162('0x27')][_0xf162('0x28')]||_0x1b9de0[_0xf162('0x27')][_0xf162('0x18')]!==_0x4b3c39['Trunk']['active'];}return _0x3a2aae||_0x1d4bea||_0x10f6f9;}exports[_0xf162('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x211997){var _0x3ba7f7=null;var _0x50e5ab=_0x211997['dialTimezone'];if(_[_0xf162('0x2a')](_0x211997[_0xf162('0x2b')])||_[_0xf162('0x2a')](_0x211997['Interval'])||_[_0xf162('0x2a')](_0x211997[_0xf162('0x2c')][_0xf162('0x2d')])){_0x3ba7f7=CAMPAIGN_STATUS[_0xf162('0x2e')];}else if(_[_0xf162('0x2f')](_0x211997[_0xf162('0x2b')])||_[_0xf162('0x2f')](_0x211997[_0xf162('0x2c')][_0xf162('0x2d')])){_0x3ba7f7=CAMPAIGN_STATUS[_0xf162('0x30')];}else if(_0x50e5ab&&!timezones[_0x50e5ab]){_0x3ba7f7=CAMPAIGN_STATUS[_0xf162('0x31')];}return _0x3ba7f7;}function checkAnyValidTrunk(_0x364a96,_0x263f05){var _0xf60cac=null;var _0x189bec=_0xf162('0x32');var _0x21cb5e=[_0xf162('0x33'),_0xf162('0x34')];var _0x305d0c=!![];if(_0x364a96['Trunk']&&_0x364a96['Trunk'][_0xf162('0x18')]){_0x189bec+=_0x364a96[_0xf162('0x27')][_0xf162('0x28')];_0xf60cac=_0x263f05[_0x189bec];_0x305d0c=_0x21cb5e[_0xf162('0x35')](_0xf60cac[_0xf162('0x36')]);}else if(_0x364a96[_0xf162('0x37')]&&_0x364a96[_0xf162('0x37')][_0xf162('0x18')]){_0x189bec+=_0x364a96['TrunkBackup']['name'];_0xf60cac=_0x263f05[_0x189bec];_0x305d0c=_0x21cb5e[_0xf162('0x35')](_0xf60cac[_0xf162('0x36')]);}return _0x305d0c;}function getQueueCampaignStatusMessage(_0x6771a8,_0x18951f){var _0x4af9bc=CAMPAIGN_STATUS[_0xf162('0x5')];var _0x2024b9=isPreviewCampaign(_0x6771a8);if(!isQueueCampaignActive(_0x6771a8)){if(_0x2024b9){_0x4af9bc=CAMPAIGN_STATUS[_0xf162('0x38')];}else{if(_0x6771a8['originated']===0x0&&_0x6771a8[_0xf162('0x22')]===0x0&&_0x6771a8[_0xf162('0x24')]===0x0&&(_0x6771a8[_0xf162('0x23')]||0x0)===0x0){_0x4af9bc=CAMPAIGN_STATUS[_0xf162('0x38')];}else{_0x4af9bc=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x6771a8[_0xf162('0x39')]===0x0){_0x4af9bc=CAMPAIGN_STATUS[_0xf162('0x3a')];}else if(!checkAnyValidTrunk(_0x6771a8,_0x18951f)){_0x4af9bc=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x6771a8)){var _0x4b014c=checkAnyValidQueueCampaignInterval(_0x6771a8);if(_0x4b014c){_0x4af9bc=_0x4b014c;}}return _0x4af9bc;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4e9d00){var _0x5d5a4d=CAMPAIGN_STATUS[_0xf162('0x3b')];if(_0x4e9d00[_0xf162('0x26')]===0x0&&_0x4e9d00[_0xf162('0x22')]===0x0&&_0x4e9d00['waiting']===0x0&&(_0x4e9d00['pTalking']||0x0)===0x0){_0x5d5a4d=CAMPAIGN_STATUS[_0xf162('0x38')];}return _0x5d5a4d;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5bc809){var _0x391cf6=_0x5bc809[_0xf162('0x3c')](/"(.*?)"/);return _0x391cf6?_0x391cf6[0x1]:_0x5bc809;}exports[_0xf162('0x3d')]=extractCalleridName;function getCallerId(_0x4f694b,_0x56c2b4,_0x22f67d){if(!_['isUndefined'](_0x22f67d)&&typeof _0x22f67d===_0xf162('0x3e')&&!_[_0xf162('0x2f')](_0x22f67d)){if(!_[_0xf162('0x3f')](_0x56c2b4)&&typeof _0x56c2b4===_0xf162('0x3e')&&!_[_0xf162('0x2f')](_0x56c2b4)){return util['format']('\x22%s\x22\x20<%s>',_0x56c2b4,_0x22f67d);}return util[_0xf162('0x40')](_0xf162('0x41'),_0x22f67d,_0x22f67d);}if(!_[_0xf162('0x3f')](_0x4f694b)&&typeof _0x4f694b==='string'&&!_[_0xf162('0x2f')](_0x4f694b)){return _0x4f694b;}return _0xf162('0x42');}exports[_0xf162('0x43')]=getCallerId;function getCallerIdRandom(_0x18bd2a,_0x37f7df){var _0x4fc0cd;var _0x33419f;var _0x124f16;if(_0x37f7df<=0x0){_0x37f7df=0x1;}_0x4fc0cd=new RegExp(_0xf162('0x44')+_0x37f7df+'}$');_0x33419f=Math[_0xf162('0x45')](0xa,_0x37f7df-0x1);_0x124f16=Math[_0xf162('0x45')](0xa,_0x37f7df)-0x1;return util[_0xf162('0x40')]('%s',_[_0xf162('0x46')](_0x18bd2a,_0x4fc0cd,_['random'](_0x33419f,_0x124f16)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x1f8742){if(_0x1f8742[_0xf162('0x26')]&&_0x1f8742[_0xf162('0x26')]>0x0){_0x1f8742[_0xf162('0x26')]-=0x1;}else{logger[_0xf162('0x47')](_0xf162('0x48'));}}exports[_0xf162('0x49')]=decrementOriginate;function checkContactEmpty(_0x35e7a5){return _0x35e7a5&&_0x35e7a5[_0xf162('0x4a')]>0x0;}exports[_0xf162('0x4b')]=checkContactEmpty;function erlangb(_0xa318d4,_0x2bb36f){if(_0x2bb36f===0x0){return 0x0;}var _0x5216b3=0x1;for(var _0x517429=0x1;_0x517429<=_0x2bb36f;_0x517429+=0x1){_0x5216b3=0x1+_0x5216b3*_0x517429/_0xa318d4;}return 0x1/_0x5216b3;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x320d64,_0x2045a2,_0x4064b5){if(_0x2045a2>_0x4064b5){for(var _0x540ddd=0x0;_0x540ddd<_0x2045a2-_0x4064b5;_0x540ddd+=0x1){decrementOriginate(_0x320d64);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x12f449){var _0x681cd6={};var _0x2ab505=['id',_0xf162('0x4c'),_0xf162('0x4d'),_0xf162('0x4e'),'updatedAt'];if(_0x12f449){for(var _0x9c9d5f in _0x12f449){if(typeof _0x12f449[_0x9c9d5f]!==_0xf162('0x4f')){if(!_['isNil'](_0x12f449[_0x9c9d5f])&&!_0x2ab505[_0xf162('0x35')](_0x9c9d5f)){_0x681cd6[util[_0xf162('0x40')]('%s%s',_0xf162('0x50'),_0x9c9d5f[_0xf162('0x51')]())]=_0x12f449[_0x9c9d5f];}}}}return _0x681cd6;}exports[_0xf162('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b75596c..807a150 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(_0x46a32a,_0x9f9a29){var _0x329ab1=function(_0x544e49){while(--_0x544e49){_0x46a32a['push'](_0x46a32a['shift']());}};_0x329ab1(++_0x9f9a29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x1617ff,_0x4ba4e1){var _0x4b2280=function(_0x156aac){while(--_0x156aac){_0x1617ff['push'](_0x1617ff['shift']());}};_0x4b2280(++_0x4ba4e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 edfb96a..7ce81cf 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 _0xf76d=['[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','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','path','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstatedesc','syncFaxStatus','operation','status','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]'];(function(_0x2b01ce,_0x2379e1){var _0x36a5f1=function(_0x3b2da4){while(--_0x3b2da4){_0x2b01ce['push'](_0x2b01ce['shift']());}};_0x36a5f1(++_0x2379e1);}(_0xf76d,0x189));var _0xdf76=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xf76d[_0x259d17];return _0x407535;};'use strict';var util=require(_0xdf76('0x0'));var _=require(_0xdf76('0x1'));var BPromise=require(_0xdf76('0x2'));var uuid=require(_0xdf76('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xdf76('0x4'));var gs=require(_0xdf76('0x5'));var logger=require(_0xdf76('0x6'))(_0xdf76('0x7'));var ami=require(_0xdf76('0x8'));var rpcDb=require(_0xdf76('0x9'));var Channel=require(_0xdf76('0xa'));var ut=require(_0xdf76('0xb'));var Action=require(_0xdf76('0xc'));var faxAccount=require(_0xdf76('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xdf76('0xe'));function Fax(_0x5edca9){this[_0xdf76('0xf')]={};this[_0xdf76('0x10')]=_0x5edca9['faxAccounts'];this[_0xdf76('0x11')]=_0x5edca9[_0xdf76('0x11')];this[_0xdf76('0x12')]={};ami['on'](_0xdf76('0x13'),this[_0xdf76('0x14')][_0xdf76('0x15')](this));ami['on'](_0xdf76('0x16'),this[_0xdf76('0x17')][_0xdf76('0x15')](this));ami['on'](_0xdf76('0x18'),this[_0xdf76('0x19')][_0xdf76('0x15')](this));ami['on'](_0xdf76('0x1a'),this[_0xdf76('0x1b')][_0xdf76('0x15')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xdf76('0x15')](this));ami['on']('receivefax',this[_0xdf76('0x1c')]['bind'](this));ami['on']('hangup',this[_0xdf76('0x1d')][_0xdf76('0x15')](this));ami['on']('originateresponse',this[_0xdf76('0x1e')][_0xdf76('0x15')](this));}Fax[_0xdf76('0x1f')][_0xdf76('0x14')]=function(_0x340ccd){if(_0x340ccd[_0xdf76('0x20')]===_0xdf76('0x21')){for(var _0x5b570f in this[_0xdf76('0x10')]){if(this[_0xdf76('0x10')][_0xdf76('0x22')](_0x5b570f)){if(_0x340ccd[_0xdf76('0x23')]===this[_0xdf76('0x10')][_0x5b570f][_0xdf76('0x24')]){this[_0xdf76('0xf')][_0x340ccd[_0xdf76('0x25')]]={};this[_0xdf76('0xf')][_0x340ccd[_0xdf76('0x25')]][_0xdf76('0x26')]=_0x340ccd[_0xdf76('0x26')];this[_0xdf76('0xf')][_0x340ccd[_0xdf76('0x25')]]['id']=this[_0xdf76('0x10')][_0x5b570f]['id'];this[_0xdf76('0xf')][_0x340ccd[_0xdf76('0x25')]][_0xdf76('0x27')]=this['faxAccounts'][_0x5b570f][_0xdf76('0x27')];logger[_0xdf76('0x28')](_0x340ccd['uniqueid'],_0xdf76('0x29'));}}}}if(this['actions'][_0x340ccd[_0xdf76('0x25')]]){this[_0xdf76('0xf')][_0x340ccd['uniqueid']]={};this['channels'][_0x340ccd[_0xdf76('0x25')]][_0xdf76('0x26')]=_0x340ccd[_0xdf76('0x26')];logger[_0xdf76('0x28')](_0x340ccd[_0xdf76('0x25')],_0xdf76('0x29'));}};Fax['prototype'][_0xdf76('0x17')]=function(_0x5f6d5d){if(this[_0xdf76('0xf')][_0x5f6d5d[_0xdf76('0x25')]]){for(var _0x2c5316 in _0x5f6d5d[_0xdf76('0x2a')]){if(_0x5f6d5d[_0xdf76('0x2a')]['hasOwnProperty'](_0x2c5316)){this[_0xdf76('0xf')][_0x5f6d5d[_0xdf76('0x25')]][_0x2c5316]=_0x5f6d5d[_0xdf76('0x2b')];}}}};Fax['prototype'][_0xdf76('0x19')]=function(_0x2d2c2c){if(this[_0xdf76('0xf')][_0x2d2c2c['uniqueid']]){this['channels'][_0x2d2c2c[_0xdf76('0x25')]]['channelstate']=_0x2d2c2c['channelstate'];this[_0xdf76('0xf')][_0x2d2c2c[_0xdf76('0x25')]]['channelstatedesc']=_0x2d2c2c[_0xdf76('0x2c')];}};Fax[_0xdf76('0x1f')][_0xdf76('0x1b')]=function(_0x14c7e6){if(this[_0xdf76('0xf')][_0x14c7e6[_0xdf76('0x25')]]){for(var _0x49192a in _0x14c7e6[_0xdf76('0x2a')]){if(_0x14c7e6[_0xdf76('0x2a')][_0xdf76('0x22')](_0x49192a)){this[_0xdf76('0xf')][_0x14c7e6[_0xdf76('0x25')]][_0x49192a]=_0x14c7e6['value'];}}}};Fax[_0xdf76('0x1f')][_0xdf76('0x2d')]=function(_0x165b14){if(this['channels'][_0x165b14[_0xdf76('0x25')]]){this['channels'][_0x165b14[_0xdf76('0x25')]]['operation']=_0x165b14[_0xdf76('0x2e')];this[_0xdf76('0xf')][_0x165b14[_0xdf76('0x25')]][_0xdf76('0x2f')]=_0x165b14['status'];this[_0xdf76('0xf')][_0x165b14[_0xdf76('0x25')]]['localstationid']=_0x165b14['localstationid'];this[_0xdf76('0xf')][_0x165b14[_0xdf76('0x25')]]['filename']=_0x165b14['filename'];logger[_0xdf76('0x28')](_0x165b14[_0xdf76('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0xdf76('0x1f')][_0xdf76('0x1c')]=function(_0x4ab21e){var _0x179c88=this;if(this['channels'][_0x4ab21e['uniqueid']]){var _0x8178dc=this[_0xdf76('0xf')][_0x4ab21e['uniqueid']]['id'];this[_0xdf76('0xf')][_0x4ab21e['uniqueid']][_0xdf76('0x30')]=_0x4ab21e[_0xdf76('0x30')];this[_0xdf76('0xf')][_0x4ab21e[_0xdf76('0x25')]]['pagestransferred']=_0x4ab21e[_0xdf76('0x31')];this[_0xdf76('0xf')][_0x4ab21e[_0xdf76('0x25')]][_0xdf76('0x24')]=_0x4ab21e[_0xdf76('0x24')];this[_0xdf76('0xf')][_0x4ab21e[_0xdf76('0x25')]]['resolution']=_0x4ab21e[_0xdf76('0x32')];this[_0xdf76('0xf')][_0x4ab21e['uniqueid']][_0xdf76('0x33')]=_0x4ab21e[_0xdf76('0x33')];this['channels'][_0x4ab21e[_0xdf76('0x25')]]['filename']=_0x4ab21e[_0xdf76('0x34')];this[_0xdf76('0xf')][_0x4ab21e[_0xdf76('0x25')]][_0xdf76('0x35')]=_0x4ab21e['calleridnum'];if(this[_0xdf76('0xf')][_0x4ab21e[_0xdf76('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x4ab21e['filename'],_0xdf76('0x36'),function(_0x58158e){logger[_0xdf76('0x28')](_0x4ab21e[_0xdf76('0x25')],_0xdf76('0x37'),_0x58158e[_0xdf76('0x38')]);attachment[_0xdf76('0x39')]({'name':path['parse'](_0x4ab21e[_0xdf76('0x34')])[_0xdf76('0x27')],'basename':path[_0xdf76('0x3a')](_0x4ab21e[_0xdf76('0x34')])['name']+_0xdf76('0x3b'),'type':_0xdf76('0x3c')})[_0xdf76('0x3d')](function(_0x4f3af4){faxAccount[_0xdf76('0x3e')](_0x8178dc,{'from':_0x4ab21e[_0xdf76('0x35')],'mapKey':_0xdf76('0x7'),'body':path['parse'](_0x4ab21e['filename'])[_0xdf76('0x27')]+_0xdf76('0x3b'),'AttachmentId':_0x4f3af4['id']})[_0xdf76('0x3f')](function(_0xa695c5){logger[_0xdf76('0x40')](_0x4ab21e[_0xdf76('0x25')],'\x20notify\x20',JSON[_0xdf76('0x41')](_0xa695c5));});})[_0xdf76('0x3f')](function(_0x50c3d3){logger['error'](_0x4ab21e['uniqueid'],_0xdf76('0x42'),JSON[_0xdf76('0x41')](_0x50c3d3));});});}logger['info'](_0x4ab21e['uniqueid'],_0xdf76('0x42'));}};Fax[_0xdf76('0x1f')][_0xdf76('0x1e')]=function(_0x467693){if(this[_0xdf76('0x12')][_0x467693['uniqueid']]){_[_0xdf76('0x43')](this['channels'][_0x467693[_0xdf76('0x25')]],_[_0xdf76('0x44')](_0x467693,[_0xdf76('0x45'),_0xdf76('0x46')]));}};function updateStatus(_0x17ca33){if(_0x17ca33[_0xdf76('0x47')]){faxMessage['update'](_0x17ca33['AttachmentId'],{'failMessage':_0xdf76('0x48')})[_0xdf76('0x3d')](function(_0x49ccc2){ut['logger'](_0xdf76('0x49'),_0x49ccc2);})[_0xdf76('0x3f')](function(_0x5bf171){ut[_0xdf76('0x4a')](_0xdf76('0x4b'),_0x5bf171);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xdf76('0x1f')][_0xdf76('0x4c')]=function(_0x2ac328,_0x5e1670,_0x4335fa){var _0x1ebb9d=this;var _0x335e44={};if(_0x5e1670){_0x335e44={'read':_0x5e1670};}else{_0x335e44={'failMessage':_0x4335fa};}if(this['actions'][_0x2ac328][_0xdf76('0x47')]){faxMessage[_0xdf76('0x4d')](this['actions'][_0x2ac328][_0xdf76('0x47')],_0x335e44)['then'](function(_0x3ede59){ut[_0xdf76('0x4a')](_0xdf76('0x4e'),_0x3ede59);})[_0xdf76('0x3f')](function(_0x1d1138){ut[_0xdf76('0x4a')](_0xdf76('0x4f'),_0x1d1138);})[_0xdf76('0x50')](function(){delete _0x1ebb9d[_0xdf76('0xf')][_0x2ac328];delete _0x1ebb9d[_0xdf76('0x12')][_0x2ac328];});}else{ut['logger'](_0xdf76('0x51'));delete this[_0xdf76('0xf')][_0x2ac328];delete this['actions'][_0x2ac328];}};Fax[_0xdf76('0x1f')][_0xdf76('0x1d')]=function(_0x25ea59){var _0x486f8a=this;if(this[_0xdf76('0xf')][_0x25ea59['uniqueid']]){if(this[_0xdf76('0x12')][_0x25ea59[_0xdf76('0x25')]]){this[_0xdf76('0xf')][_0x25ea59[_0xdf76('0x25')]]['id']=this[_0xdf76('0x12')][_0x25ea59['uniqueid']]['id'];this['channels'][_0x25ea59[_0xdf76('0x25')]]['name']=this['actions'][_0x25ea59[_0xdf76('0x25')]][_0xdf76('0x27')];}logger['info'](_0x25ea59[_0xdf76('0x25')],this[_0xdf76('0x12')][_0x25ea59['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xdf76('0x52'),JSON[_0xdf76('0x41')](this[_0xdf76('0xf')][_0x25ea59[_0xdf76('0x25')]]));if(this[_0xdf76('0x12')][_0x25ea59['uniqueid']]){if(this[_0xdf76('0xf')][_0x25ea59[_0xdf76('0x25')]]['faxpages']>0x0&&this[_0xdf76('0xf')][_0x25ea59[_0xdf76('0x25')]][_0xdf76('0x53')]===_0xdf76('0x54')){this[_0xdf76('0x4c')](_0x25ea59['uniqueid'],!![]);}else{this[_0xdf76('0x4c')](_0x25ea59[_0xdf76('0x25')],![],this['channels'][_0x25ea59[_0xdf76('0x25')]]['faxstatusstring']?_0xdf76('0x55')+this[_0xdf76('0xf')][_0x25ea59['uniqueid']][_0xdf76('0x56')]:_0xdf76('0x57'));}}}};Fax[_0xdf76('0x1f')]['send']=function(_0x3d23c2){var _0x258598=this;return new BPromise(function(_0x458a1e,_0x54f176){_0x258598[_0xdf76('0x58')](_0x3d23c2,_0x258598['faxAccounts'][_0x3d23c2[_0xdf76('0x59')]])[_0xdf76('0x3d')](function(_0x308ce1){ut[_0xdf76('0x4a')](_0xdf76('0x5a'),_0x308ce1);_0x458a1e(ut[_0xdf76('0x38')](_0xdf76('0x5b')));})['catch'](function(_0xe92c56){ut[_0xdf76('0x4a')](_0xdf76('0x5c'),_0xe92c56);updateStatus(_0x3d23c2);_0x54f176(ut['message'](_0xdf76('0x5d')));});});};Fax[_0xdf76('0x1f')][_0xdf76('0x5e')]=function(_0x4fd6fb){var _0x8144b8=this;return new BPromise(function(_0x298578,_0x404a27){var _0x587ea7=_0x8144b8[_0xdf76('0x5f')](_0x8144b8['faxAccounts'][_0x4fd6fb[_0xdf76('0x59')]]['Trunk'],_0x4fd6fb);if(_0x587ea7[_0xdf76('0x60')]){_0x298578(ut[_0xdf76('0x38')]('Trunk\x20Reachable'));}else{_0x404a27(ut[_0xdf76('0x38')](_0x587ea7[_0xdf76('0x38')]));}});};function originate(_0x14c1e6,_0x159acc,_0x4f94c7){return new BPromise(function(_0x2443dc,_0x258dd6){if(_0x4f94c7){var _0x98d0f0=util[_0xdf76('0x61')](_0xdf76('0x62'),path[_0xdf76('0x3a')](_0x14c1e6[_0xdf76('0x63')])[_0xdf76('0x27')],_0x14c1e6['path']);gs['execute'](_0x98d0f0)[_0xdf76('0x3d')](function(){_0x14c1e6['path']=util[_0xdf76('0x61')](_0xdf76('0x64'),path[_0xdf76('0x3a')](_0x14c1e6[_0xdf76('0x63')])['dir'],path[_0xdf76('0x3a')](_0x14c1e6[_0xdf76('0x63')])['name']);_0x159acc['XMF-PATH']=_0x14c1e6[_0xdf76('0x63')];ut[_0xdf76('0x4a')](_0xdf76('0x65'),'');ami[_0xdf76('0x66')](ut[_0xdf76('0x67')](_0x14c1e6,_0x159acc))[_0xdf76('0x3d')](function(_0x17c7bb){_0x2443dc(_0x17c7bb);})[_0xdf76('0x3f')](function(_0x576a2b){_0x258dd6(_0x576a2b);});})[_0xdf76('0x3f')](function(_0x133dd5){_0x258dd6(_0x133dd5);});}else{ami[_0xdf76('0x66')](ut[_0xdf76('0x67')](_0x14c1e6,_0x159acc))[_0xdf76('0x3d')](function(_0x4cf2d4){_0x2443dc(_0x4cf2d4);})[_0xdf76('0x3f')](function(_0x3ccd98){_0x258dd6(_0x3ccd98);});}});}Fax[_0xdf76('0x1f')][_0xdf76('0x58')]=function(_0xaa2b56,_0x3020ac){var _0x9171f9=this;return new BPromise(function(_0x2d848f,_0x4ad804){var _0x1ca26e=uuid['v4']();var _0x45c140=ut[_0xdf76('0x68')](_0xaa2b56,_0x3020ac);_0x9171f9[_0xdf76('0x12')][_0x1ca26e]=new Action(_0x1ca26e,_0x3020ac,_0xaa2b56);var _0x20c680=_0x9171f9[_0xdf76('0x12')][_0x1ca26e];if(path[_0xdf76('0x3a')](_0xaa2b56[_0xdf76('0x63')])['ext']===_0xdf76('0x3b')){originate(_0x20c680,_0x45c140,!![])['then'](function(_0x453e14){_0x2d848f(_0x453e14);})['catch'](function(_0x4dec1a){_0x4ad804(_0x4dec1a);});}else{originate(_0x20c680,_0x45c140,![])[_0xdf76('0x3d')](function(_0x2fba5f){_0x2d848f(_0x2fba5f);})['catch'](function(_0x508310){_0x4ad804(_0x508310);});}});};Fax['prototype'][_0xdf76('0x69')]=function(_0x35ca75){return!_[_0xdf76('0x6a')](_0x35ca75)&&!_[_0xdf76('0x6a')](_0x35ca75[_0xdf76('0x27')])&&!_[_0xdf76('0x6a')](_0x35ca75[_0xdf76('0x6b')])&&_0x35ca75[_0xdf76('0x6b')]&&!_[_0xdf76('0x6a')](this['trunks'][util[_0xdf76('0x61')]('SIP/%s',_0x35ca75[_0xdf76('0x27')])])&&!_[_0xdf76('0x6a')](this[_0xdf76('0x11')][util[_0xdf76('0x61')]('SIP/%s',_0x35ca75['name'])][_0xdf76('0x2f')])&&(this['trunks'][util['format'](_0xdf76('0x6c'),_0x35ca75[_0xdf76('0x27')])][_0xdf76('0x2f')]===_0xdf76('0x6d')||this[_0xdf76('0x11')][util[_0xdf76('0x61')]('SIP/%s',_0x35ca75[_0xdf76('0x27')])][_0xdf76('0x2f')]===_0xdf76('0x6e'));};Fax[_0xdf76('0x1f')][_0xdf76('0x5f')]=function(_0x316bbb,_0x25310b){if(!this[_0xdf76('0x69')](_0x316bbb)){ut[_0xdf76('0x4a')](_0xdf76('0x6f'),_[_0xdf76('0x6a')](_0x316bbb)?'':_0x316bbb['name']+_0xdf76('0x70'));return{'isValid':![],'message':_0xdf76('0x71')};}if(_[_0xdf76('0x6a')](_0x25310b[_0xdf76('0x7')])){ut[_0xdf76('0x4a')](_0xdf76('0x72'),JSON[_0xdf76('0x41')](_0x25310b));return{'isValid':![],'message':_0xdf76('0x73')};}if(_[_0xdf76('0x6a')](_0x25310b[_0xdf76('0x63')])){ut[_0xdf76('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x25310b));return{'isValid':![],'message':_0xdf76('0x74')};}return{'isValid':!![],'message':_0xdf76('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0x54d0=['pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','path','fax','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge'];(function(_0x3ea9c5,_0x40e111){var _0x5662ca=function(_0x3ff27d){while(--_0x3ff27d){_0x3ea9c5['push'](_0x3ea9c5['shift']());}};_0x5662ca(++_0x40e111);}(_0x54d0,0x189));var _0x054d=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x54d0[_0x329d13];return _0x33efd9;};'use strict';var util=require(_0x054d('0x0'));var _=require(_0x054d('0x1'));var BPromise=require(_0x054d('0x2'));var uuid=require(_0x054d('0x3'));var moment=require('moment');var path=require(_0x054d('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x054d('0x5'));var ami=require('../ami');var rpcDb=require(_0x054d('0x6'));var Channel=require(_0x054d('0x7'));var ut=require(_0x054d('0x8'));var Action=require(_0x054d('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x054d('0xa'));var faxMessage=require(_0x054d('0xb'));function Fax(_0x52b665){this[_0x054d('0xc')]={};this['faxAccounts']=_0x52b665[_0x054d('0xd')];this[_0x054d('0xe')]=_0x52b665[_0x054d('0xe')];this[_0x054d('0xf')]={};ami['on'](_0x054d('0x10'),this[_0x054d('0x11')][_0x054d('0x12')](this));ami['on']('varset',this[_0x054d('0x13')][_0x054d('0x12')](this));ami['on'](_0x054d('0x14'),this[_0x054d('0x15')][_0x054d('0x12')](this));ami['on'](_0x054d('0x16'),this[_0x054d('0x17')]['bind'](this));ami['on']('faxstatus',this[_0x054d('0x18')][_0x054d('0x12')](this));ami['on']('receivefax',this[_0x054d('0x19')][_0x054d('0x12')](this));ami['on'](_0x054d('0x1a'),this[_0x054d('0x1b')]['bind'](this));ami['on'](_0x054d('0x1c'),this[_0x054d('0x1d')][_0x054d('0x12')](this));}Fax[_0x054d('0x1e')]['syncNewchannel']=function(_0x1c1872){if(_0x1c1872[_0x054d('0x1f')]==='from-voip-provider'){for(var _0x4ed65a in this['faxAccounts']){if(this['faxAccounts'][_0x054d('0x20')](_0x4ed65a)){if(_0x1c1872[_0x054d('0x21')]===this['faxAccounts'][_0x4ed65a][_0x054d('0x22')]){this[_0x054d('0xc')][_0x1c1872['uniqueid']]={};this[_0x054d('0xc')][_0x1c1872[_0x054d('0x23')]][_0x054d('0x24')]=_0x1c1872[_0x054d('0x24')];this['channels'][_0x1c1872[_0x054d('0x23')]]['id']=this[_0x054d('0xd')][_0x4ed65a]['id'];this[_0x054d('0xc')][_0x1c1872[_0x054d('0x23')]]['name']=this[_0x054d('0xd')][_0x4ed65a][_0x054d('0x25')];logger[_0x054d('0x26')](_0x1c1872[_0x054d('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0x054d('0xf')][_0x1c1872[_0x054d('0x23')]]){this[_0x054d('0xc')][_0x1c1872[_0x054d('0x23')]]={};this[_0x054d('0xc')][_0x1c1872[_0x054d('0x23')]][_0x054d('0x24')]=_0x1c1872['channel'];logger[_0x054d('0x26')](_0x1c1872[_0x054d('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x054d('0x1e')]['syncVarSet']=function(_0x14215f){if(this[_0x054d('0xc')][_0x14215f[_0x054d('0x23')]]){for(var _0xe58915 in _0x14215f[_0x054d('0x27')]){if(_0x14215f[_0x054d('0x27')][_0x054d('0x20')](_0xe58915)){this[_0x054d('0xc')][_0x14215f[_0x054d('0x23')]][_0xe58915]=_0x14215f['value'];}}}};Fax['prototype']['syncNewState']=function(_0x32f58f){if(this[_0x054d('0xc')][_0x32f58f[_0x054d('0x23')]]){this[_0x054d('0xc')][_0x32f58f[_0x054d('0x23')]][_0x054d('0x28')]=_0x32f58f[_0x054d('0x28')];this[_0x054d('0xc')][_0x32f58f['uniqueid']][_0x054d('0x29')]=_0x32f58f[_0x054d('0x29')];}};Fax[_0x054d('0x1e')][_0x054d('0x17')]=function(_0x1dd654){if(this[_0x054d('0xc')][_0x1dd654[_0x054d('0x23')]]){for(var _0x3525e5 in _0x1dd654['variable']){if(_0x1dd654[_0x054d('0x27')][_0x054d('0x20')](_0x3525e5)){this['channels'][_0x1dd654['uniqueid']][_0x3525e5]=_0x1dd654['value'];}}}};Fax[_0x054d('0x1e')][_0x054d('0x18')]=function(_0x1f64b7){if(this[_0x054d('0xc')][_0x1f64b7[_0x054d('0x23')]]){this[_0x054d('0xc')][_0x1f64b7[_0x054d('0x23')]][_0x054d('0x2a')]=_0x1f64b7[_0x054d('0x2a')];this[_0x054d('0xc')][_0x1f64b7[_0x054d('0x23')]][_0x054d('0x2b')]=_0x1f64b7[_0x054d('0x2b')];this[_0x054d('0xc')][_0x1f64b7[_0x054d('0x23')]][_0x054d('0x22')]=_0x1f64b7[_0x054d('0x22')];this[_0x054d('0xc')][_0x1f64b7['uniqueid']]['filename']=_0x1f64b7[_0x054d('0x2c')];logger[_0x054d('0x26')](_0x1f64b7[_0x054d('0x23')],_0x054d('0x2d'));}};Fax[_0x054d('0x1e')]['syncReceiveFax']=function(_0x90ae31){var _0x126eb1=this;if(this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]]){var _0x12faba=this[_0x054d('0xc')][_0x90ae31['uniqueid']]['id'];this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]][_0x054d('0x2e')]=_0x90ae31[_0x054d('0x2e')];this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]]['pagestransferred']=_0x90ae31[_0x054d('0x2f')];this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]]['localstationid']=_0x90ae31[_0x054d('0x22')];this['channels'][_0x90ae31[_0x054d('0x23')]][_0x054d('0x30')]=_0x90ae31['resolution'];this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]]['transferrate']=_0x90ae31[_0x054d('0x31')];this[_0x054d('0xc')][_0x90ae31['uniqueid']][_0x054d('0x2c')]=_0x90ae31['filename'];this[_0x054d('0xc')][_0x90ae31[_0x054d('0x23')]][_0x054d('0x32')]=_0x90ae31[_0x054d('0x32')];if(this['channels'][_0x90ae31[_0x054d('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x90ae31[_0x054d('0x2c')],'/var/opt/motion2/server/files/attachments/',function(_0x4b41df){logger[_0x054d('0x26')](_0x90ae31[_0x054d('0x23')],_0x054d('0x33'),_0x4b41df['message']);attachment[_0x054d('0x34')]({'name':path[_0x054d('0x35')](_0x90ae31[_0x054d('0x2c')])['name'],'basename':path[_0x054d('0x35')](_0x90ae31['filename'])[_0x054d('0x25')]+_0x054d('0x36'),'type':'application/pdf'})[_0x054d('0x37')](function(_0x2560ef){faxAccount[_0x054d('0x38')](_0x12faba,{'from':_0x90ae31[_0x054d('0x32')],'mapKey':_0x054d('0x5'),'body':path[_0x054d('0x35')](_0x90ae31[_0x054d('0x2c')])['name']+_0x054d('0x36'),'AttachmentId':_0x2560ef['id']})[_0x054d('0x39')](function(_0x1a139f){logger[_0x054d('0x3a')](_0x90ae31['uniqueid'],_0x054d('0x3b'),JSON[_0x054d('0x3c')](_0x1a139f));});})[_0x054d('0x39')](function(_0x1a9356){logger[_0x054d('0x3a')](_0x90ae31[_0x054d('0x23')],_0x054d('0x3d'),JSON[_0x054d('0x3c')](_0x1a9356));});});}logger[_0x054d('0x26')](_0x90ae31['uniqueid'],_0x054d('0x3d'));}};Fax[_0x054d('0x1e')]['syncOriginateResponse']=function(_0x5781b6){if(this[_0x054d('0xf')][_0x5781b6[_0x054d('0x23')]]){_[_0x054d('0x3e')](this['channels'][_0x5781b6['uniqueid']],_[_0x054d('0x3f')](_0x5781b6,['response',_0x054d('0x40')]));}};function updateStatus(_0x41089b){if(_0x41089b[_0x054d('0x41')]){faxMessage[_0x054d('0x42')](_0x41089b[_0x054d('0x41')],{'failMessage':_0x054d('0x43')})[_0x054d('0x37')](function(_0x112028){ut[_0x054d('0x44')](_0x054d('0x45'),_0x112028);})[_0x054d('0x39')](function(_0x47ebb5){ut[_0x054d('0x44')](_0x054d('0x46'),_0x47ebb5);});}else{ut['logger'](_0x054d('0x47'));}}Fax[_0x054d('0x1e')][_0x054d('0x48')]=function(_0xf0f8aa,_0x297b7f,_0x328e26){var _0x3f9c97=this;var _0x3f2135={};if(_0x297b7f){_0x3f2135={'read':_0x297b7f};}else{_0x3f2135={'failMessage':_0x328e26};}if(this[_0x054d('0xf')][_0xf0f8aa][_0x054d('0x41')]){faxMessage['update'](this[_0x054d('0xf')][_0xf0f8aa][_0x054d('0x41')],_0x3f2135)[_0x054d('0x37')](function(_0x7dea5){ut[_0x054d('0x44')](_0x054d('0x49'),_0x7dea5);})[_0x054d('0x39')](function(_0x45c1b1){ut['logger'](_0x054d('0x4a'),_0x45c1b1);})[_0x054d('0x4b')](function(){delete _0x3f9c97['channels'][_0xf0f8aa];delete _0x3f9c97[_0x054d('0xf')][_0xf0f8aa];});}else{ut[_0x054d('0x44')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0xf0f8aa];delete this[_0x054d('0xf')][_0xf0f8aa];}};Fax[_0x054d('0x1e')]['syncHangup']=function(_0x4fb9c7){var _0x10ee7b=this;if(this['channels'][_0x4fb9c7['uniqueid']]){if(this['actions'][_0x4fb9c7[_0x054d('0x23')]]){this[_0x054d('0xc')][_0x4fb9c7[_0x054d('0x23')]]['id']=this[_0x054d('0xf')][_0x4fb9c7[_0x054d('0x23')]]['id'];this[_0x054d('0xc')][_0x4fb9c7[_0x054d('0x23')]]['name']=this[_0x054d('0xf')][_0x4fb9c7[_0x054d('0x23')]][_0x054d('0x25')];}logger[_0x054d('0x26')](_0x4fb9c7[_0x054d('0x23')],this[_0x054d('0xf')][_0x4fb9c7[_0x054d('0x23')]]?_0x054d('0x4c'):_0x054d('0x4d'),JSON[_0x054d('0x3c')](this['channels'][_0x4fb9c7[_0x054d('0x23')]]));if(this['actions'][_0x4fb9c7[_0x054d('0x23')]]){if(this[_0x054d('0xc')][_0x4fb9c7[_0x054d('0x23')]][_0x054d('0x4e')]>0x0&&this['channels'][_0x4fb9c7[_0x054d('0x23')]][_0x054d('0x4f')]===_0x054d('0x50')){this[_0x054d('0x48')](_0x4fb9c7[_0x054d('0x23')],!![]);}else{this['updateStatus'](_0x4fb9c7[_0x054d('0x23')],![],this[_0x054d('0xc')][_0x4fb9c7[_0x054d('0x23')]][_0x054d('0x51')]?_0x054d('0x52')+this[_0x054d('0xc')][_0x4fb9c7[_0x054d('0x23')]][_0x054d('0x51')]:_0x054d('0x53'));}}}};Fax[_0x054d('0x1e')][_0x054d('0x54')]=function(_0x44a23d){var _0x34c1a0=this;return new BPromise(function(_0x20d30e,_0x4fdd92){_0x34c1a0[_0x054d('0x55')](_0x44a23d,_0x34c1a0[_0x054d('0xd')][_0x44a23d[_0x054d('0x56')]])[_0x054d('0x37')](function(_0x521b51){ut[_0x054d('0x44')](_0x054d('0x57'),_0x521b51);_0x20d30e(ut[_0x054d('0x58')](_0x054d('0x59')));})[_0x054d('0x39')](function(_0x50e5ab){ut['logger'](_0x054d('0x5a'),_0x50e5ab);updateStatus(_0x44a23d);_0x4fdd92(ut[_0x054d('0x58')](_0x054d('0x5b')));});});};Fax['prototype'][_0x054d('0x5c')]=function(_0x94229b){var _0x8ad037=this;return new BPromise(function(_0x203e4d,_0x5c37ff){var _0xf440b9=_0x8ad037[_0x054d('0x5d')](_0x8ad037[_0x054d('0xd')][_0x94229b[_0x054d('0x56')]][_0x054d('0x5e')],_0x94229b);if(_0xf440b9['isValid']){_0x203e4d(ut[_0x054d('0x58')]('Trunk\x20Reachable'));}else{_0x5c37ff(ut[_0x054d('0x58')](_0xf440b9[_0x054d('0x58')]));}});};function originate(_0x5c7ae4,_0x17b8b2,_0xf3c3f2){return new BPromise(function(_0x387c20,_0x287c0b){if(_0xf3c3f2){var _0x14e639=util['format'](_0x054d('0x5f'),path[_0x054d('0x35')](_0x5c7ae4[_0x054d('0x4')])['name'],_0x5c7ae4[_0x054d('0x4')]);gs[_0x054d('0x60')](_0x14e639)[_0x054d('0x37')](function(){_0x5c7ae4['path']=util[_0x054d('0x61')]('%s/%s.tif',path['parse'](_0x5c7ae4[_0x054d('0x4')])[_0x054d('0x62')],path[_0x054d('0x35')](_0x5c7ae4['path'])[_0x054d('0x25')]);_0x17b8b2['XMF-PATH']=_0x5c7ae4[_0x054d('0x4')];ut[_0x054d('0x44')](_0x054d('0x63'),'');ami[_0x054d('0x64')](ut['variablesAction'](_0x5c7ae4,_0x17b8b2))[_0x054d('0x37')](function(_0x4cd808){_0x387c20(_0x4cd808);})['catch'](function(_0x3eb323){_0x287c0b(_0x3eb323);});})[_0x054d('0x39')](function(_0x57ff0b){_0x287c0b(_0x57ff0b);});}else{ami[_0x054d('0x64')](ut[_0x054d('0x65')](_0x5c7ae4,_0x17b8b2))['then'](function(_0x14bb05){_0x387c20(_0x14bb05);})[_0x054d('0x39')](function(_0x196622){_0x287c0b(_0x196622);});}});}Fax[_0x054d('0x1e')][_0x054d('0x55')]=function(_0x1b7748,_0x150583){var _0x2f2e09=this;return new BPromise(function(_0x2dc8f7,_0x47c978){var _0x15176f=uuid['v4']();var _0x13c9b6=ut['addVariables'](_0x1b7748,_0x150583);_0x2f2e09[_0x054d('0xf')][_0x15176f]=new Action(_0x15176f,_0x150583,_0x1b7748);var _0x261426=_0x2f2e09[_0x054d('0xf')][_0x15176f];if(path[_0x054d('0x35')](_0x1b7748[_0x054d('0x4')])[_0x054d('0x66')]===_0x054d('0x36')){originate(_0x261426,_0x13c9b6,!![])['then'](function(_0x14f008){_0x2dc8f7(_0x14f008);})[_0x054d('0x39')](function(_0xf7c34d){_0x47c978(_0xf7c34d);});}else{originate(_0x261426,_0x13c9b6,![])['then'](function(_0x12a5bd){_0x2dc8f7(_0x12a5bd);})[_0x054d('0x39')](function(_0x36b511){_0x47c978(_0x36b511);});}});};Fax['prototype']['isTrunkReachable']=function(_0x245944){return!_['isNil'](_0x245944)&&!_['isNil'](_0x245944['name'])&&!_[_0x054d('0x67')](_0x245944[_0x054d('0x68')])&&_0x245944['active']&&!_['isNil'](this['trunks'][util['format'](_0x054d('0x69'),_0x245944[_0x054d('0x25')])])&&!_[_0x054d('0x67')](this[_0x054d('0xe')][util[_0x054d('0x61')]('SIP/%s',_0x245944[_0x054d('0x25')])][_0x054d('0x2b')])&&(this[_0x054d('0xe')][util[_0x054d('0x61')](_0x054d('0x69'),_0x245944[_0x054d('0x25')])]['status']==='reachable'||this[_0x054d('0xe')][util['format'](_0x054d('0x69'),_0x245944['name'])]['status']===_0x054d('0x6a'));};Fax[_0x054d('0x1e')][_0x054d('0x5d')]=function(_0x42d18a,_0x8a865c){if(!this[_0x054d('0x6b')](_0x42d18a)){ut[_0x054d('0x44')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x054d('0x67')](_0x42d18a)?'':_0x42d18a['name']+_0x054d('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x054d('0x67')](_0x8a865c['fax'])){ut['logger'](_0x054d('0x6d'),JSON[_0x054d('0x3c')](_0x8a865c));return{'isValid':![],'message':_0x054d('0x6e')};}if(_[_0x054d('0x67')](_0x8a865c[_0x054d('0x4')])){ut[_0x054d('0x44')](_0x054d('0x6f'),JSON[_0x054d('0x3c')](_0x8a865c));return{'isValid':![],'message':_0x054d('0x70')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x054d('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ac45243..66c4faf 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 _0xf0da=['resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x5d25ac,_0x3f57f5){var _0x1c7b34=function(_0x41a6da){while(--_0x41a6da){_0x5d25ac['push'](_0x5d25ac['shift']());}};_0x1c7b34(++_0x3f57f5);}(_0xf0da,0xe1));var _0xaf0d=function(_0x2d0e21,_0x417dde){_0x2d0e21=_0x2d0e21-0x0;var _0x423fa5=_0xf0da[_0x2d0e21];return _0x423fa5;};'use strict';var util=require(_0xaf0d('0x0'));var BPromise=require(_0xaf0d('0x1'));var logger=require(_0xaf0d('0x2'))(_0xaf0d('0x3'));var _=require(_0xaf0d('0x4'));var faxAccount=require(_0xaf0d('0x5'));function loggerCatch(_0x28711d){return function(_0x257402){logger[_0xaf0d('0x6')](_0x28711d,util[_0xaf0d('0x7')](_0x257402,{'showHidden':![],'depth':null}));};}exports[_0xaf0d('0x8')]=function(_0x2e3037,_0x452da5){return BPromise[_0xaf0d('0x9')]()[_0xaf0d('0xa')](faxAccount[_0xaf0d('0x8')](_0x2e3037,_0x452da5))[_0xaf0d('0xb')](loggerCatch(_0xaf0d('0xc')));}; \ No newline at end of file +var _0xda1c=['lodash','error','inspect','notify','resolve','catch','[Notify]\x20','bluebird','../../../config/logger'];(function(_0xba75ca,_0x585d58){var _0x57a37a=function(_0x4bd50f){while(--_0x4bd50f){_0xba75ca['push'](_0xba75ca['shift']());}};_0x57a37a(++_0x585d58);}(_0xda1c,0x97));var _0xcda1=function(_0x33b54c,_0x5a0a22){_0x33b54c=_0x33b54c-0x0;var _0x1e72a3=_0xda1c[_0x33b54c];return _0x1e72a3;};'use strict';var util=require('util');var BPromise=require(_0xcda1('0x0'));var logger=require(_0xcda1('0x1'))('preview');var _=require(_0xcda1('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x45eb07){return function(_0x8064a2){logger[_0xcda1('0x3')](_0x45eb07,util[_0xcda1('0x4')](_0x8064a2,{'showHidden':![],'depth':null}));};}exports[_0xcda1('0x5')]=function(_0x2568fb,_0x2a6f00){return BPromise[_0xcda1('0x6')]()['then'](faxAccount[_0xcda1('0x5')](_0x2568fb,_0x2a6f00))[_0xcda1('0x7')](loggerCatch(_0xcda1('0x8')));}; \ 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 a7e4c93..9806cef 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 _0xb3f1=['\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3f1,0x8e));var _0x1b3f=function(_0xbed58e,_0x314ec7){_0xbed58e=_0xbed58e-0x0;var _0x39e140=_0xb3f1[_0xbed58e];return _0x39e140;};'use strict';var util=require(_0x1b3f('0x0'));var logger=require('../../../../config/logger')(_0x1b3f('0x1'));var BPromise=require(_0x1b3f('0x2'));var exec=require(_0x1b3f('0x3'))[_0x1b3f('0x4')];exports[_0x1b3f('0x5')]=function(_0x431166){return new BPromise(function(_0x15e94f,_0x32a8c5){exec(_0x431166,function(_0x5daba5,_0x380549,_0x33c2dc){logger[_0x1b3f('0x6')](_0x1b3f('0x7'),_0x380549);if(_0x5daba5){logger[_0x1b3f('0x6')](_0x1b3f('0x7'),_0x1b3f('0x8'),util[_0x1b3f('0x9')](_0x5daba5,{'showHidden':![],'depth':null}),_0x380549,_0x33c2dc);_0x32a8c5(_0x5daba5);}_0x15e94f(_0x380549);});});}; \ No newline at end of file +var _0xd609=['util','../../../../config/logger','fax','child_process','exec','Exec\x20gs','info','inspect'];(function(_0x44e706,_0x149b18){var _0x2f8953=function(_0x3ec995){while(--_0x3ec995){_0x44e706['push'](_0x44e706['shift']());}};_0x2f8953(++_0x149b18);}(_0xd609,0x1d8));var _0x9d60=function(_0x4780c7,_0x3a0a98){_0x4780c7=_0x4780c7-0x0;var _0x4578d5=_0xd609[_0x4780c7];return _0x4578d5;};'use strict';var util=require(_0x9d60('0x0'));var logger=require(_0x9d60('0x1'))(_0x9d60('0x2'));var BPromise=require('bluebird');var exec=require(_0x9d60('0x3'))[_0x9d60('0x4')];exports['execute']=function(_0x242123){return new BPromise(function(_0x232b3a,_0x3951a7){exec(_0x242123,function(_0xabddf3,_0xd9f98f,_0x15b3f9){logger['info'](_0x9d60('0x5'),_0xd9f98f);if(_0xabddf3){logger[_0x9d60('0x6')](_0x9d60('0x5'),'\x20Error\x20:',util[_0x9d60('0x7')](_0xabddf3,{'showHidden':![],'depth':null}),_0xd9f98f,_0x15b3f9);_0x3951a7(_0xabddf3);}_0x232b3a(_0xd9f98f);});});}; \ 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 7f46577..5173e35 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 _0x827d=['minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','fax','info','inspect','addVariables','ecm','headerinfo'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x827d,0x17f));var _0xd827=function(_0xd172a,_0x6a815a){_0xd172a=_0xd172a-0x0;var _0x17930a=_0x827d[_0xd172a];return _0x17930a;};'use strict';var util=require(_0xd827('0x0'));var _=require('lodash');var moment=require(_0xd827('0x1'));var logger=require('../../../../config/logger')(_0xd827('0x2'));exports['message']=function(_0x1c96b3){return{'message':_0x1c96b3};};exports['logger']=function(_0x173dc3,_0x429a7e){logger[_0xd827('0x3')](_0x173dc3,util[_0xd827('0x4')](_0x429a7e,{'showHidden':![],'depth':null}));};exports[_0xd827('0x5')]=function(_0x2c496d,_0x5da033){var _0x4491c4={'XMF-ECM':_0x5da033[_0xd827('0x6')],'XMF-HEADERINFO':_0x5da033[_0xd827('0x7')],'XMF-MINRATE':_0x5da033[_0xd827('0x8')],'XMF-MAXRATE':_0x5da033[_0xd827('0x9')],'XMF-MODEM':util[_0xd827('0xa')]('\x22%s\x22',_0x5da033[_0xd827('0xb')]),'XMF-GATEWAY':_0x5da033[_0xd827('0xc')],'XMF-FAXDETECT':_0x5da033[_0xd827('0xd')],'XMF-T38TIMEOUT':_0x5da033[_0xd827('0xe')],'XMF-LOCALSTATIONID':_0x5da033[_0xd827('0xf')],'XMF-PATH':_0x2c496d[_0xd827('0x10')]};return _0x4491c4;};exports['variablesAction']=function(_0x4fe15d,_0x48eec1){return{'actionid':_0x4fe15d[_0xd827('0x11')],'action':_0xd827('0x12'),'channel':_0x4fe15d[_0xd827('0x13')],'Exten':_0xd827('0x14'),'Context':_0xd827('0x15'),'Priority':'1','callerid':util['format'](_0xd827('0x16'),_0x4fe15d[_0xd827('0x7')]?_0x4fe15d[_0xd827('0x7')]:'',_0x4fe15d[_0xd827('0xf')]),'variable':_0x48eec1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4fe15d[_0xd827('0x11')]};}; \ No newline at end of file +var _0xdec1=['\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','uniqueid','util','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate'];(function(_0x1754db,_0x3e32f7){var _0x273e77=function(_0x2c71c3){while(--_0x2c71c3){_0x1754db['push'](_0x1754db['shift']());}};_0x273e77(++_0x3e32f7);}(_0xdec1,0x11d));var _0x1dec=function(_0x3e6a2a,_0x4e9890){_0x3e6a2a=_0x3e6a2a-0x0;var _0x15effa=_0xdec1[_0x3e6a2a];return _0x15effa;};'use strict';var util=require(_0x1dec('0x0'));var _=require('lodash');var moment=require(_0x1dec('0x1'));var logger=require(_0x1dec('0x2'))(_0x1dec('0x3'));exports[_0x1dec('0x4')]=function(_0x29d43e){return{'message':_0x29d43e};};exports[_0x1dec('0x5')]=function(_0x17e0e9,_0x19a1ff){logger[_0x1dec('0x6')](_0x17e0e9,util[_0x1dec('0x7')](_0x19a1ff,{'showHidden':![],'depth':null}));};exports[_0x1dec('0x8')]=function(_0x108f91,_0xadd4a3){var _0x41aecd={'XMF-ECM':_0xadd4a3[_0x1dec('0x9')],'XMF-HEADERINFO':_0xadd4a3['headerinfo'],'XMF-MINRATE':_0xadd4a3[_0x1dec('0xa')],'XMF-MAXRATE':_0xadd4a3[_0x1dec('0xb')],'XMF-MODEM':util['format'](_0x1dec('0xc'),_0xadd4a3[_0x1dec('0xd')]),'XMF-GATEWAY':_0xadd4a3[_0x1dec('0xe')],'XMF-FAXDETECT':_0xadd4a3[_0x1dec('0xf')],'XMF-T38TIMEOUT':_0xadd4a3['t38timeout'],'XMF-LOCALSTATIONID':_0xadd4a3[_0x1dec('0x10')],'XMF-PATH':_0x108f91[_0x1dec('0x11')]};return _0x41aecd;};exports[_0x1dec('0x12')]=function(_0x402441,_0x3c35e3){return{'actionid':_0x402441['uniqueid'],'action':_0x1dec('0x13'),'channel':_0x402441[_0x1dec('0x14')],'Exten':_0x1dec('0x15'),'Context':_0x1dec('0x16'),'Priority':'1','callerid':util[_0x1dec('0x17')](_0x1dec('0x18'),_0x402441['headerinfo']?_0x402441[_0x1dec('0x19')]:'',_0x402441['localstationid']),'variable':_0x3c35e3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x402441[_0x1dec('0x1a')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 359c2cd..66515cf 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 _0x09e7=['initVoiceQueues','initTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTrunks','getVoiceQueues'];(function(_0x45a670,_0x1e2e99){var _0x35d3bf=function(_0xb328eb){while(--_0xb328eb){_0x45a670['push'](_0x45a670['shift']());}};_0x35d3bf(++_0x1e2e99);}(_0x09e7,0x10c));var _0x709e=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x09e7[_0x4099ee];return _0x1b7bfc;};'use strict';var util=require(_0x709e('0x0'));var moment=require(_0x709e('0x1'));var server=require(_0x709e('0x2'));var Realtime=require(_0x709e('0x3'));var Report=require(_0x709e('0x4'));var Acw=require(_0x709e('0x5'));var Trigger=require(_0x709e('0x6'));var Dialer=require(_0x709e('0x7'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x709e('0x8'));var voiceQueue=require(_0x709e('0x9'));var voiceQueueReport=require(_0x709e('0xa'));var voiceCallReport=require(_0x709e('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x709e('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x709e('0xd'));var campaign=require(_0x709e('0xe'));var voiceExtension=require(_0x709e('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x709e('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x709e('0x11'));var desk=require(_0x709e('0x12'));var zoho=require(_0x709e('0x13'));var vtiger=require(_0x709e('0x14'));var freshsales=require(_0x709e('0x15'));var servicenow=require(_0x709e('0x16'));var dynamics365=require(_0x709e('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x709e('0x18')](_0x709e('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x709e('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x709e('0x1a')]()[_0x709e('0x1b')](user[_0x709e('0x1c')]())[_0x709e('0x1b')](realtime[_0x709e('0x1d')]())[_0x709e('0x1b')](user['getTelephones']())[_0x709e('0x1b')](realtime['initTelephones']())[_0x709e('0x1b')](trunk[_0x709e('0x1e')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x709e('0x1f')]())[_0x709e('0x1b')](realtime[_0x709e('0x20')]())['then'](trigger['getTriggers']())[_0x709e('0x1b')](realtime[_0x709e('0x21')]())['then'](template['getTemplates']())[_0x709e('0x1b')](realtime['initTemplates']())[_0x709e('0x1b')](zendesk[_0x709e('0x22')]())[_0x709e('0x1b')](realtime[_0x709e('0x23')]())[_0x709e('0x1b')](salesforce[_0x709e('0x24')]())['then'](realtime[_0x709e('0x25')]())['then'](sugarcrm[_0x709e('0x26')]())[_0x709e('0x1b')](realtime[_0x709e('0x27')]())[_0x709e('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x709e('0x1b')](realtime[_0x709e('0x28')]())[_0x709e('0x1b')](desk['getDeskAccounts']())['then'](realtime[_0x709e('0x29')]())['then'](zoho[_0x709e('0x2a')]())[_0x709e('0x1b')](realtime[_0x709e('0x2b')]())[_0x709e('0x1b')](vtiger['getVtigerAccounts']())[_0x709e('0x1b')](realtime['initVtigerAccounts']())['then'](freshsales[_0x709e('0x2c')]())[_0x709e('0x1b')](realtime['initFreshsalesAccounts']())[_0x709e('0x1b')](servicenow[_0x709e('0x2d')]())[_0x709e('0x1b')](realtime[_0x709e('0x2e')]())[_0x709e('0x1b')](dynamics365['getDynamics365Accounts']())[_0x709e('0x1b')](realtime['initDynamics365Accounts']())['then'](campaign[_0x709e('0x2f')]())[_0x709e('0x1b')](realtime['initCampaigns']())[_0x709e('0x1b')](voiceExtension[_0x709e('0x30')]())[_0x709e('0x1b')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x709e('0x31')]())[_0x709e('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x709e('0x1a')]()[_0x709e('0x1b')](voiceQueueReport[_0x709e('0x32')]())['then'](realtime[_0x709e('0x33')]())[_0x709e('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x709e('0x34')]())[_0x709e('0x1b')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())[_0x709e('0x1b')](voiceCallReport[_0x709e('0x35')]())[_0x709e('0x1b')](realtime[_0x709e('0x36')]())[_0x709e('0x37')](function(_0x42fc9e){logger[_0x709e('0x38')](_0x709e('0x39'),util[_0x709e('0x3a')](_0x42fc9e,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x709e('0x1b')](function(){return initRealtime();})[_0x709e('0x1b')](function(){return initParams();})[_0x709e('0x1b')](function(){report[_0x709e('0x3b')]();setInterval(initRealtime,0x1388);})[_0x709e('0x37')](function(_0x2aee38){logger['error']('[index.js][main]',util[_0x709e('0x3a')](_0x2aee38,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x91fe=['getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initFaxAccounts','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts'];(function(_0x30780e,_0x537b34){var _0x5b9129=function(_0xcf4cd1){while(--_0xcf4cd1){_0x30780e['push'](_0x30780e['shift']());}};_0x5b9129(++_0x537b34);}(_0x91fe,0x11e));var _0xe91f=function(_0x506698,_0x518574){_0x506698=_0x506698-0x0;var _0x4f198c=_0x91fe[_0x506698];return _0x4f198c;};'use strict';var util=require(_0xe91f('0x0'));var moment=require(_0xe91f('0x1'));var server=require(_0xe91f('0x2'));var Realtime=require(_0xe91f('0x3'));var Report=require(_0xe91f('0x4'));var Acw=require(_0xe91f('0x5'));var Trigger=require(_0xe91f('0x6'));var Dialer=require(_0xe91f('0x7'));var Preview=require(_0xe91f('0x8'));var Fax=require(_0xe91f('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xe91f('0xa'));var voiceQueueReport=require(_0xe91f('0xb'));var voiceCallReport=require(_0xe91f('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe91f('0xd'));var voiceExtension=require(_0xe91f('0xe'));var faxAccount=require(_0xe91f('0xf'));var zendesk=require(_0xe91f('0x10'));var salesforce=require(_0xe91f('0x11'));var sugarcrm=require(_0xe91f('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe91f('0x13'));var zoho=require(_0xe91f('0x14'));var vtiger=require(_0xe91f('0x15'));var freshsales=require(_0xe91f('0x16'));var servicenow=require(_0xe91f('0x17'));var dynamics365=require(_0xe91f('0x18'));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(_0xe91f('0x19'))(_0xe91f('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe91f('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe91f('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xe91f('0x1c')](user[_0xe91f('0x1d')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x1e')]())[_0xe91f('0x1c')](user['getTelephones']())['then'](realtime[_0xe91f('0x1f')]())[_0xe91f('0x1c')](trunk[_0xe91f('0x20')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x21')]())[_0xe91f('0x1c')](voiceQueue['getVoiceQueues']())[_0xe91f('0x1c')](realtime[_0xe91f('0x22')]())[_0xe91f('0x1c')](trigger[_0xe91f('0x23')]())[_0xe91f('0x1c')](realtime['initTriggers']())['then'](template['getTemplates']())[_0xe91f('0x1c')](realtime[_0xe91f('0x24')]())['then'](zendesk[_0xe91f('0x25')]())['then'](realtime[_0xe91f('0x26')]())['then'](salesforce[_0xe91f('0x27')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x28')]())[_0xe91f('0x1c')](sugarcrm[_0xe91f('0x29')]())['then'](realtime[_0xe91f('0x2a')]())['then'](freshdesk[_0xe91f('0x2b')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x2c')]())['then'](desk[_0xe91f('0x2d')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x2e')]())[_0xe91f('0x1c')](zoho[_0xe91f('0x2f')]())['then'](realtime[_0xe91f('0x30')]())[_0xe91f('0x1c')](vtiger[_0xe91f('0x31')]())['then'](realtime['initVtigerAccounts']())[_0xe91f('0x1c')](freshsales[_0xe91f('0x32')]())[_0xe91f('0x1c')](realtime[_0xe91f('0x33')]())[_0xe91f('0x1c')](servicenow[_0xe91f('0x34')]())['then'](realtime['initServicenowAccounts']())[_0xe91f('0x1c')](dynamics365[_0xe91f('0x35')]())['then'](realtime[_0xe91f('0x36')]())[_0xe91f('0x1c')](campaign['getCampaigns']())[_0xe91f('0x1c')](realtime[_0xe91f('0x37')]())['then'](voiceExtension['getVoiceExtensions']())[_0xe91f('0x1c')](realtime['initVoiceExtensions']())['then'](faxAccount['getFaxAccounts']())[_0xe91f('0x1c')](realtime[_0xe91f('0x38')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xe91f('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xe91f('0x1c')](realtime['initVoiceQueueReports']())[_0xe91f('0x1c')](cmHopperHistory[_0xe91f('0x39')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xe91f('0x1c')](cmHopperHistory[_0xe91f('0x3a')]())[_0xe91f('0x1c')](realtime['initCampaignHopperHistory']())[_0xe91f('0x1c')](voiceCallReport[_0xe91f('0x3b')]())['then'](realtime[_0xe91f('0x3c')]())['catch'](function(_0x52f81a){logger[_0xe91f('0x3d')](_0xe91f('0x3e'),util[_0xe91f('0x3f')](_0x52f81a,{'showHidden':![],'depth':null}));});}function main(){return server[_0xe91f('0x40')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xe91f('0x1c')](function(){return initParams();})[_0xe91f('0x1c')](function(){report[_0xe91f('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1b2971){logger['error'](_0xe91f('0x42'),util['inspect'](_0x1b2971,{'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 6223d2c..6a8adc1 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 _0x0777=['voiceStatus','statePause','toNumber','format','voiceStatusQueue','interface','onhold','stringify','user:%s','user:ami:update','omit','emit','user:presence','exports','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','online','voiceStatusTime','voiceStatusCallerIdNumber','local','prototype','toLowerCase','inuse','talking'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0777,0x176));var _0x7077=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0777[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x7077('0x0'));var moment=require(_0x7077('0x1'));var md5=require(_0x7077('0x2'));var Redis=require(_0x7077('0x3'));var config=require('../../../config/environment');config[_0x7077('0x4')]=_[_0x7077('0x5')](config[_0x7077('0x4')],{'host':_0x7077('0x6'),'port':0x18eb});var io=require(_0x7077('0x7'))(new Redis(config[_0x7077('0x4')]));function Agent(_0x16198a){this['id']=_0x16198a['id']||0x0;this['name']=_0x16198a[_0x7077('0x8')]||'';this[_0x7077('0x9')]=_0x16198a[_0x7077('0x9')]||'';this[_0x7077('0xa')]=_0x16198a['accountcode']||'';this['fullname']=_0x16198a[_0x7077('0xb')]||'';this[_0x7077('0xc')]=_0x7077('0xd');this[_0x7077('0xe')]=0x0;this[_0x7077('0xf')]='unknown';this[_0x7077('0x10')]='';this[_0x7077('0x11')]='';this['mobile']='';this['interface']='';this['online']=_0x16198a[_0x7077('0x12')]||![];this['voiceStatus']=_0x7077('0xd');this[_0x7077('0x13')]=0x0;this[_0x7077('0x14')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x7077('0x15')]=![];this['md5']='';}Agent[_0x7077('0x16')]['updateStatusRealtime']=function(_0x1da86d){var _0x37092a;if(_0x1da86d&&_0x1da86d[_0x7077('0xc')]){_0x37092a=_0x1da86d[_0x7077('0xc')][_0x7077('0x17')]();switch(_0x37092a){case'not_inuse':_0x37092a='idle';break;case _0x7077('0x18'):_0x37092a=_0x7077('0x19');break;}}if(_0x37092a&&this[_0x7077('0x1a')]!==_0x37092a||_0x1da86d[_0x7077('0x1b')]){this['voiceStatusTime']=_[_0x7077('0x1c')](moment()[_0x7077('0x1d')]('x'));}if(_0x37092a){this[_0x7077('0x1a')]=_0x37092a;}var _0x273691={'id':this['id'],'name':this[_0x7077('0x8')],'email':this[_0x7077('0x9')],'accountcode':this[_0x7077('0xa')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x7077('0xe')],'status':this[_0x7077('0xf')],'address':this['address'],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x7077('0x1e')],'interface':this[_0x7077('0x1f')],'onhold':this[_0x7077('0x20')]};var _0x4d178b=md5(JSON[_0x7077('0x21')](_0x273691));if(this[_0x7077('0x2')]!==_0x4d178b){this['md5']=_0x4d178b;io['to'](util[_0x7077('0x1d')](_0x7077('0x22'),_0x273691[_0x7077('0x8')]))['emit'](_0x7077('0x23'),_[_0x7077('0x24')](_0x273691,[_0x7077('0x12')]));io[_0x7077('0x25')](_0x7077('0x26'),_0x273691);}};module[_0x7077('0x27')]=Agent; \ No newline at end of file +var _0x14f0=['name','email','accountcode','fullname','state','stateTime','status','unknown','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','inuse','talking','statePause','toNumber','format','address','voiceStatusCallerIdNumber','onhold','stringify','user:%s','omit','emit','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x404a02,_0x3ee3cb){var _0x53b57d=function(_0x329cba){while(--_0x329cba){_0x404a02['push'](_0x404a02['shift']());}};_0x53b57d(++_0x3ee3cb);}(_0x14f0,0xfb));var _0x014f=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x14f0[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require(_0x014f('0x0'));var util=require(_0x014f('0x1'));var moment=require(_0x014f('0x2'));var md5=require(_0x014f('0x3'));var Redis=require('ioredis');var config=require(_0x014f('0x4'));config[_0x014f('0x5')]=_[_0x014f('0x6')](config[_0x014f('0x5')],{'host':_0x014f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x014f('0x5')]));function Agent(_0x1372df){this['id']=_0x1372df['id']||0x0;this['name']=_0x1372df[_0x014f('0x8')]||'';this[_0x014f('0x9')]=_0x1372df['email']||'';this[_0x014f('0xa')]=_0x1372df[_0x014f('0xa')]||'';this['fullname']=_0x1372df[_0x014f('0xb')]||'';this[_0x014f('0xc')]='unknown';this[_0x014f('0xd')]=0x0;this[_0x014f('0xe')]=_0x014f('0xf');this['address']='';this['phone']='';this[_0x014f('0x10')]='';this[_0x014f('0x11')]='';this['online']=_0x1372df[_0x014f('0x12')]||![];this[_0x014f('0x13')]=_0x014f('0xf');this[_0x014f('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x014f('0x15')]='';this['onhold']=![];this[_0x014f('0x16')]=![];this[_0x014f('0x3')]='';}Agent['prototype'][_0x014f('0x17')]=function(_0x5be857){var _0x2b5a43;if(_0x5be857&&_0x5be857['state']){_0x2b5a43=_0x5be857['state'][_0x014f('0x18')]();switch(_0x2b5a43){case'not_inuse':_0x2b5a43='idle';break;case _0x014f('0x19'):_0x2b5a43=_0x014f('0x1a');break;}}if(_0x2b5a43&&this['voiceStatus']!==_0x2b5a43||_0x5be857[_0x014f('0x1b')]){this[_0x014f('0x14')]=_[_0x014f('0x1c')](moment()[_0x014f('0x1d')]('x'));}if(_0x2b5a43){this[_0x014f('0x13')]=_0x2b5a43;}var _0x59512a={'id':this['id'],'name':this[_0x014f('0x8')],'email':this[_0x014f('0x9')],'accountcode':this[_0x014f('0xa')],'fullname':this[_0x014f('0xb')],'state':this[_0x014f('0xc')],'stateTime':this['stateTime'],'status':this[_0x014f('0xe')],'address':this[_0x014f('0x1e')],'online':this[_0x014f('0x12')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x014f('0x14')],'voiceStatusCallerIdNumber':this[_0x014f('0x1f')],'voiceStatusQueue':this[_0x014f('0x15')],'interface':this[_0x014f('0x11')],'onhold':this[_0x014f('0x20')]};var _0x1bf889=md5(JSON[_0x014f('0x21')](_0x59512a));if(this['md5']!==_0x1bf889){this[_0x014f('0x3')]=_0x1bf889;io['to'](util[_0x014f('0x1d')](_0x014f('0x22'),_0x59512a[_0x014f('0x8')]))['emit']('user:ami:update',_[_0x014f('0x23')](_0x59512a,[_0x014f('0x12')]));io[_0x014f('0x24')]('user:presence',_0x59512a);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 77825fb..ddcb700 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 _0x1201=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x46cc29,_0x473f8e){var _0x5ea06f=function(_0x1051e7){while(--_0x1051e7){_0x46cc29['push'](_0x46cc29['shift']());}};_0x5ea06f(++_0x473f8e);}(_0x1201,0xd1));var _0x1120=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x1201[_0xd2f4ac];return _0x9757b2;};'use strict';function Campaign(_0x23b3ad){this['id']=_0x23b3ad['id']||0x0;this[_0x1120('0x0')]=_0x23b3ad['name']||'';this[_0x1120('0x1')]=_0x23b3ad['type']||_0x1120('0x2');this['originated']=0x0;this[_0x1120('0x3')]=0x0;this[_0x1120('0x4')]=0x0;this[_0x1120('0x5')]=0x0;this[_0x1120('0x6')]='';this[_0x1120('0x7')]=!![];this[_0x1120('0x8')]=_0x23b3ad[_0x1120('0x8')];this['limitCalls']=_0x23b3ad[_0x1120('0x9')];this[_0x1120('0xa')]=_0x23b3ad[_0x1120('0xa')]||null;this[_0x1120('0xb')]=_0x23b3ad[_0x1120('0xb')]?_0x23b3ad[_0x1120('0xb')]:null;this[_0x1120('0xc')]=_0x23b3ad[_0x1120('0xc')];this[_0x1120('0xd')]=_0x23b3ad[_0x1120('0xd')];this[_0x1120('0xe')]=_0x23b3ad[_0x1120('0xe')]||0x1e;this[_0x1120('0xf')]=_0x23b3ad['dialCongestionMaxRetry'];this[_0x1120('0x10')]=_0x23b3ad['dialCongestionRetryFrequency'];this[_0x1120('0x11')]=_0x23b3ad['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x23b3ad[_0x1120('0x12')];this[_0x1120('0x13')]=_0x23b3ad[_0x1120('0x13')];this[_0x1120('0x14')]=_0x23b3ad[_0x1120('0x14')];this[_0x1120('0x15')]=_0x23b3ad['dialGlobalMaxRetry'];this[_0x1120('0x16')]=_0x23b3ad[_0x1120('0x16')]||0x3;this[_0x1120('0x17')]=_0x23b3ad[_0x1120('0x17')]||0x96;this[_0x1120('0x18')]=_0x23b3ad[_0x1120('0x18')]||0x3;this[_0x1120('0x19')]=_0x23b3ad['dialDropRetryFrequency']||0x96;this[_0x1120('0x1a')]=_0x23b3ad[_0x1120('0x1a')]||0x3;this[_0x1120('0x1b')]=_0x23b3ad[_0x1120('0x1b')]||0x96;this[_0x1120('0x1c')]=_0x23b3ad[_0x1120('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x23b3ad['dialMachineRetryFrequency']||0x96;this[_0x1120('0x1d')]=_0x23b3ad[_0x1120('0x1d')]||0x3;this[_0x1120('0x1e')]=_0x23b3ad['dialAgentRejectRetryFrequency']||0x96;this[_0x1120('0x1f')]=_0x23b3ad[_0x1120('0x1f')]||_0x1120('0x20');this[_0x1120('0x21')]=_0x23b3ad['dialPrefix']||undefined;this[_0x1120('0x22')]=_0x23b3ad[_0x1120('0x22')]||undefined;this[_0x1120('0x23')]=_0x23b3ad['dialCutDigit']||undefined;this[_0x1120('0x24')]=_0x23b3ad[_0x1120('0x24')]?_0x23b3ad[_0x1120('0x24')]:undefined;this[_0x1120('0x25')]=_0x23b3ad[_0x1120('0x25')]?_0x23b3ad['Trunk']:undefined;this[_0x1120('0x26')]=_0x23b3ad['Interval']?_0x23b3ad['Interval']:undefined;this[_0x1120('0x27')]=_0x23b3ad[_0x1120('0x27')]?_0x23b3ad[_0x1120('0x27')]:undefined;this[_0x1120('0x28')]=_0x23b3ad[_0x1120('0x27')]?_0x23b3ad[_0x1120('0x27')][_0x1120('0x0')]:undefined;this['dialAMDActive']=_0x23b3ad[_0x1120('0x29')]||![];this[_0x1120('0x2a')]=_0x23b3ad['dialAMDInitialSilence'];this[_0x1120('0x2b')]=_0x23b3ad[_0x1120('0x2b')];this['dialAMDAfterGreetingSilence']=_0x23b3ad[_0x1120('0x2c')];this['dialAMDTotalAnalysisTime']=_0x23b3ad[_0x1120('0x2d')];this['dialAMDMinWordLength']=_0x23b3ad['dialAMDMinWordLength'];this[_0x1120('0x2e')]=_0x23b3ad['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x23b3ad['dialAMDMaximumNumberOfWords'];this[_0x1120('0x2f')]=_0x23b3ad['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x23b3ad['dialAMDMaximumWordLength'];}module[_0x1120('0x30')]=Campaign; \ No newline at end of file +var _0x0024=['dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x2db63a,_0x52ee8e){var _0x556b91=function(_0x4ad3aa){while(--_0x4ad3aa){_0x2db63a['push'](_0x2db63a['shift']());}};_0x556b91(++_0x52ee8e);}(_0x0024,0xa8));var _0x4002=function(_0x4fabd8,_0x3be1df){_0x4fabd8=_0x4fabd8-0x0;var _0x245b41=_0x0024[_0x4fabd8];return _0x245b41;};'use strict';function Campaign(_0x2860bc){this['id']=_0x2860bc['id']||0x0;this[_0x4002('0x0')]=_0x2860bc['name']||'';this[_0x4002('0x1')]=_0x2860bc['type']||_0x4002('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x4002('0x3')]=0x0;this[_0x4002('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x4002('0x5')]=_0x2860bc[_0x4002('0x5')];this[_0x4002('0x6')]=_0x2860bc[_0x4002('0x6')];this['dialTimezone']=_0x2860bc[_0x4002('0x7')]||null;this[_0x4002('0x8')]=_0x2860bc[_0x4002('0x8')]?_0x2860bc[_0x4002('0x8')]:null;this['dialOriginateCallerIdName']=_0x2860bc['dialOriginateCallerIdName'];this[_0x4002('0x9')]=_0x2860bc[_0x4002('0x9')];this[_0x4002('0xa')]=_0x2860bc[_0x4002('0xa')]||0x1e;this[_0x4002('0xb')]=_0x2860bc['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x2860bc['dialCongestionRetryFrequency'];this[_0x4002('0xc')]=_0x2860bc[_0x4002('0xc')];this[_0x4002('0xd')]=_0x2860bc[_0x4002('0xd')];this['dialNoAnswerMaxRetry']=_0x2860bc[_0x4002('0xe')];this[_0x4002('0xf')]=_0x2860bc[_0x4002('0xf')];this[_0x4002('0x10')]=_0x2860bc[_0x4002('0x10')];this['dialNoSuchNumberMaxRetry']=_0x2860bc[_0x4002('0x11')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2860bc[_0x4002('0x12')]||0x96;this[_0x4002('0x13')]=_0x2860bc[_0x4002('0x13')]||0x3;this['dialDropRetryFrequency']=_0x2860bc[_0x4002('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x2860bc['dialAbandonedMaxRetry']||0x3;this[_0x4002('0x15')]=_0x2860bc[_0x4002('0x15')]||0x96;this['dialMachineMaxRetry']=_0x2860bc[_0x4002('0x16')]||0x3;this['dialMachineRetryFrequency']=_0x2860bc['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2860bc[_0x4002('0x17')]||0x3;this[_0x4002('0x18')]=_0x2860bc[_0x4002('0x18')]||0x96;this[_0x4002('0x19')]=_0x2860bc['dialOrderByScheduledAt']||_0x4002('0x1a');this[_0x4002('0x1b')]=_0x2860bc[_0x4002('0x1b')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2860bc[_0x4002('0x1c')]||undefined;this['dialCutDigit']=_0x2860bc[_0x4002('0x1d')]||undefined;this[_0x4002('0x1e')]=_0x2860bc[_0x4002('0x1e')]?_0x2860bc['TrunkBackup']:undefined;this['Trunk']=_0x2860bc[_0x4002('0x1f')]?_0x2860bc[_0x4002('0x1f')]:undefined;this[_0x4002('0x20')]=_0x2860bc['Interval']?_0x2860bc[_0x4002('0x20')]:undefined;this[_0x4002('0x21')]=_0x2860bc[_0x4002('0x21')]?_0x2860bc[_0x4002('0x21')]:undefined;this[_0x4002('0x22')]=_0x2860bc['SquareProject']?_0x2860bc[_0x4002('0x21')][_0x4002('0x0')]:undefined;this[_0x4002('0x23')]=_0x2860bc[_0x4002('0x23')]||![];this[_0x4002('0x24')]=_0x2860bc[_0x4002('0x24')];this['dialAMDGreeting']=_0x2860bc[_0x4002('0x25')];this[_0x4002('0x26')]=_0x2860bc['dialAMDAfterGreetingSilence'];this[_0x4002('0x27')]=_0x2860bc[_0x4002('0x27')];this['dialAMDMinWordLength']=_0x2860bc[_0x4002('0x28')];this[_0x4002('0x29')]=_0x2860bc[_0x4002('0x29')];this[_0x4002('0x2a')]=_0x2860bc[_0x4002('0x2a')];this[_0x4002('0x2b')]=_0x2860bc[_0x4002('0x2b')];this['dialAMDMaximumWordLength']=_0x2860bc[_0x4002('0x2c')];}module[_0x4002('0x2d')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 068d522..48ac77b 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 _0x3c36=['context','linkedid','exten','unmanaged','lastapplication','duration','billableseconds','holdtime','type','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode'];(function(_0x5b19ae,_0x2fef9e){var _0x367f6a=function(_0x1bcbf1){while(--_0x1bcbf1){_0x5b19ae['push'](_0x5b19ae['shift']());}};_0x367f6a(++_0x2fef9e);}(_0x3c36,0x10c));var _0x63c3=function(_0x10913b,_0x2caff8){_0x10913b=_0x10913b-0x0;var _0x4b75c2=_0x3c36[_0x10913b];return _0x4b75c2;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x63c3('0x0')]='';this[_0x63c3('0x1')]=0x0;this[_0x63c3('0x2')]='';this['connectedlinenum']=undefined;this[_0x63c3('0x3')]=undefined;this[_0x63c3('0x4')]=0x0;this[_0x63c3('0x5')]='';this['uniqueid']=0x0;this[_0x63c3('0x6')]=0x0;this[_0x63c3('0x7')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x63c3('0x8')]=![];this['abandoned']=![];this[_0x63c3('0x9')]='';this['lastdata']='';this[_0x63c3('0xa')]=0x0;this[_0x63c3('0xb')]=0x0;this[_0x63c3('0xc')]=0x0;this[_0x63c3('0xd')]=null;this['tag']=null;this[_0x63c3('0xe')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x63c3('0xf')]=null;this[_0x63c3('0x10')]=[];this[_0x63c3('0x11')]=undefined;this[_0x63c3('0x12')]=undefined;this[_0x63c3('0x13')]=undefined;this[_0x63c3('0x14')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xdfb1=['transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','monitorFilename','queue','monitors'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x1f97f6,_0x37b17c){_0x1f97f6=_0x1f97f6-0x0;var _0x4e2bc5=_0xdfb1[_0x1f97f6];return _0x4e2bc5;};'use strict';function Channel(){this[_0x1dfb('0x0')]=null;this[_0x1dfb('0x1')]='';this[_0x1dfb('0x2')]='';this[_0x1dfb('0x3')]=0x0;this['calleridname']='';this[_0x1dfb('0x4')]=undefined;this[_0x1dfb('0x5')]=undefined;this[_0x1dfb('0x6')]=0x0;this[_0x1dfb('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x1dfb('0x8')]=![];this[_0x1dfb('0x9')]=null;this[_0x1dfb('0xa')]=null;this['unmanaged']=![];this[_0x1dfb('0xb')]=![];this[_0x1dfb('0xc')]='';this[_0x1dfb('0xd')]='';this[_0x1dfb('0xe')]=0x0;this['billableseconds']=0x0;this[_0x1dfb('0xf')]=0x0;this[_0x1dfb('0x10')]=null;this[_0x1dfb('0x11')]=null;this['disposition']=null;this[_0x1dfb('0x12')]=![];this[_0x1dfb('0x13')]=null;this[_0x1dfb('0x14')]=null;this[_0x1dfb('0x15')]=[];this[_0x1dfb('0x16')]=undefined;this[_0x1dfb('0x17')]=undefined;this[_0x1dfb('0x18')]=undefined;this[_0x1dfb('0x19')]=0x0;}module[_0x1dfb('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 54e768e..ba78aae 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 _0x1055=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password'];(function(_0xfb9561,_0x402c81){var _0x4a6dde=function(_0xf29f25){while(--_0xf29f25){_0xfb9561['push'](_0xfb9561['shift']());}};_0x4a6dde(++_0x402c81);}(_0x1055,0x157));var _0x5105=function(_0x17876c,_0x17c9e3){_0x17876c=_0x17876c-0x0;var _0x26844b=_0x1055[_0x17876c];return _0x26844b;};'use strict';function DeskAccount(_0x21e809){this['id']=_0x21e809['id']||0x0;this[_0x5105('0x0')]=_0x21e809[_0x5105('0x0')]||'';this['username']=_0x21e809[_0x5105('0x1')]||'';this[_0x5105('0x2')]=_0x21e809['remoteUri']||'';this[_0x5105('0x3')]=_0x21e809[_0x5105('0x3')]||'';this[_0x5105('0x4')]=_0x21e809[_0x5105('0x4')]||'';this['consumerKey']=_0x21e809[_0x5105('0x5')]||'';this[_0x5105('0x6')]=_0x21e809[_0x5105('0x6')]||'';this[_0x5105('0x7')]=_0x21e809[_0x5105('0x7')]||'';this[_0x5105('0x8')]=_0x21e809[_0x5105('0x8')]||'';this[_0x5105('0x9')]=_0x21e809['type']||'';this[_0x5105('0xa')]=_0x21e809[_0x5105('0xa')]||'';this['Configurations']=_0x21e809[_0x5105('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x57d2=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret'];(function(_0x130656,_0x345663){var _0x4b64c0=function(_0x2445d1){while(--_0x2445d1){_0x130656['push'](_0x130656['shift']());}};_0x4b64c0(++_0x345663);}(_0x57d2,0x19c));var _0x257d=function(_0x31f0bd,_0xf5fc6f){_0x31f0bd=_0x31f0bd-0x0;var _0x50d0f6=_0x57d2[_0x31f0bd];return _0x50d0f6;};'use strict';function DeskAccount(_0x53907b){this['id']=_0x53907b['id']||0x0;this['name']=_0x53907b[_0x257d('0x0')]||'';this[_0x257d('0x1')]=_0x53907b['username']||'';this['remoteUri']=_0x53907b[_0x257d('0x2')]||'';this[_0x257d('0x3')]=_0x53907b[_0x257d('0x3')]||'';this[_0x257d('0x4')]=_0x53907b[_0x257d('0x4')]||'';this['consumerKey']=_0x53907b['consumerKey']||'';this[_0x257d('0x5')]=_0x53907b['consumerSecret']||'';this[_0x257d('0x6')]=_0x53907b[_0x257d('0x6')]||'';this[_0x257d('0x7')]=_0x53907b[_0x257d('0x7')]||'';this[_0x257d('0x8')]=_0x53907b['type']||'';this[_0x257d('0x9')]=_0x53907b['serverUrl']||'';this[_0x257d('0xa')]=_0x53907b[_0x257d('0xa')]||{};}module[_0x257d('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 474d290..6742976 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 _0xd443=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x1e744d,_0x7ea595){var _0x1820d7=function(_0x5d0c2e){while(--_0x5d0c2e){_0x1e744d['push'](_0x1e744d['shift']());}};_0x1820d7(++_0x7ea595);}(_0xd443,0x15a));var _0x3d44=function(_0x709ef,_0x305e1c){_0x709ef=_0x709ef-0x0;var _0x517dc9=_0xd443[_0x709ef];return _0x517dc9;};'use strict';function Dynamics365Account(_0x2e9e25){this['id']=_0x2e9e25['id']||0x0;this['name']=_0x2e9e25['name']||'';this[_0x3d44('0x0')]=_0x2e9e25[_0x3d44('0x0')]||'';this[_0x3d44('0x1')]=_0x2e9e25['password']||'';this[_0x3d44('0x2')]=_0x2e9e25[_0x3d44('0x2')]||'';this[_0x3d44('0x3')]=_0x2e9e25[_0x3d44('0x3')]||'';this[_0x3d44('0x4')]=_0x2e9e25[_0x3d44('0x4')]||'';this[_0x3d44('0x5')]=_0x2e9e25[_0x3d44('0x5')]||{};this['serverUrl']=_0x2e9e25[_0x3d44('0x6')]||'';this[_0x3d44('0x7')]=_0x2e9e25[_0x3d44('0x7')]||![];this[_0x3d44('0x8')]=_0x2e9e25[_0x3d44('0x8')]||{};this['CloudProvider']=_0x2e9e25[_0x3d44('0x9')]||{};}module[_0x3d44('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x600d=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','CloudProvider'];(function(_0x518cc0,_0x4e38ab){var _0x281183=function(_0x2ffafe){while(--_0x2ffafe){_0x518cc0['push'](_0x518cc0['shift']());}};_0x281183(++_0x4e38ab);}(_0x600d,0x85));var _0xd600=function(_0x1ab14f,_0x213434){_0x1ab14f=_0x1ab14f-0x0;var _0x5413ae=_0x600d[_0x1ab14f];return _0x5413ae;};'use strict';function Dynamics365Account(_0x2e056e){this['id']=_0x2e056e['id']||0x0;this['name']=_0x2e056e[_0xd600('0x0')]||'';this[_0xd600('0x1')]=_0x2e056e[_0xd600('0x1')]||'';this['password']=_0x2e056e[_0xd600('0x2')]||'';this[_0xd600('0x3')]=_0x2e056e[_0xd600('0x3')]||'';this[_0xd600('0x4')]=_0x2e056e[_0xd600('0x4')]||'';this[_0xd600('0x5')]=_0x2e056e[_0xd600('0x5')]||'';this[_0xd600('0x6')]=_0x2e056e[_0xd600('0x6')]||{};this[_0xd600('0x7')]=_0x2e056e[_0xd600('0x7')]||'';this[_0xd600('0x8')]=_0x2e056e[_0xd600('0x8')]||![];this['Configurations']=_0x2e056e['Configurations']||{};this['CloudProvider']=_0x2e056e[_0xd600('0x9')]||{};}module[_0xd600('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d761947..61ec1cf 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 _0x926a=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3f5362,_0x5df6e9){var _0xa5ae8=function(_0x310463){while(--_0x310463){_0x3f5362['push'](_0x3f5362['shift']());}};_0xa5ae8(++_0x5df6e9);}(_0x926a,0x88));var _0xa926=function(_0x451367,_0x4281bc){_0x451367=_0x451367-0x0;var _0x539269=_0x926a[_0x451367];return _0x539269;};'use strict';function FaxAccount(_0x410d69){this['id']=_0x410d69['id']||0x0;this[_0xa926('0x0')]=_0x410d69['name']||'';this[_0xa926('0x1')]=_0x410d69[_0xa926('0x1')];this[_0xa926('0x2')]=_0x410d69[_0xa926('0x2')];this[_0xa926('0x3')]=_0x410d69[_0xa926('0x3')];this[_0xa926('0x4')]=_0x410d69[_0xa926('0x4')];this[_0xa926('0x5')]=_0x410d69['minrate']||0x960;this[_0xa926('0x6')]=_0x410d69[_0xa926('0x6')]||0x3840;this[_0xa926('0x7')]=_0x410d69[_0xa926('0x7')]||_0xa926('0x8');this[_0xa926('0x9')]=_0x410d69[_0xa926('0x9')]||'no';this[_0xa926('0xa')]=_0x410d69[_0xa926('0xa')]||'no';this[_0xa926('0xb')]=_0x410d69[_0xa926('0xb')]||0x1388;this[_0xa926('0xc')]=_0x410d69['tech']||'SIP';this[_0xa926('0xd')]=_0x410d69[_0xa926('0xd')]?_0x410d69[_0xa926('0xd')]:undefined;this[_0xa926('0xe')]=_0x410d69[_0xa926('0xe')];this[_0xa926('0xf')]=_0x410d69[_0xa926('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x5e26=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x5b9553,_0x2e4058){var _0x5089c5=function(_0x39c745){while(--_0x39c745){_0x5b9553['push'](_0x5b9553['shift']());}};_0x5089c5(++_0x2e4058);}(_0x5e26,0x1d4));var _0x65e2=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x5e26[_0x470f63];return _0x4f09e2;};'use strict';function FaxAccount(_0x1f907c){this['id']=_0x1f907c['id']||0x0;this['name']=_0x1f907c[_0x65e2('0x0')]||'';this[_0x65e2('0x1')]=_0x1f907c['description'];this[_0x65e2('0x2')]=_0x1f907c[_0x65e2('0x2')];this[_0x65e2('0x3')]=_0x1f907c['headerinfo'];this[_0x65e2('0x4')]=_0x1f907c[_0x65e2('0x4')];this['minrate']=_0x1f907c[_0x65e2('0x5')]||0x960;this[_0x65e2('0x6')]=_0x1f907c[_0x65e2('0x6')]||0x3840;this[_0x65e2('0x7')]=_0x1f907c[_0x65e2('0x7')]||'v17,v27,v29';this[_0x65e2('0x8')]=_0x1f907c[_0x65e2('0x8')]||'no';this['faxdetect']=_0x1f907c[_0x65e2('0x9')]||'no';this['t38timeout']=_0x1f907c[_0x65e2('0xa')]||0x1388;this['tech']=_0x1f907c[_0x65e2('0xb')]||'SIP';this['Trunk']=_0x1f907c['Trunk']?_0x1f907c['Trunk']:undefined;this[_0x65e2('0xc')]=_0x1f907c[_0x65e2('0xc')];this['key']=_0x1f907c[_0x65e2('0xd')];}module[_0x65e2('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c83c2b4..9118537 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 _0x5d5d=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3ca7b1,_0x4338b8){var _0x14ee2e=function(_0x5b8b9c){while(--_0x5b8b9c){_0x3ca7b1['push'](_0x3ca7b1['shift']());}};_0x14ee2e(++_0x4338b8);}(_0x5d5d,0xfb));var _0xd5d5=function(_0x175125,_0x1bc379){_0x175125=_0x175125-0x0;var _0x5690be=_0x5d5d[_0x175125];return _0x5690be;};'use strict';function FreshdeskAccount(_0x7ec667){this['id']=_0x7ec667['id']||0x0;this['name']=_0x7ec667[_0xd5d5('0x0')]||'';this[_0xd5d5('0x1')]=_0x7ec667['username']||'';this['apiKey']=_0x7ec667[_0xd5d5('0x2')]||'';this[_0xd5d5('0x3')]=_0x7ec667[_0xd5d5('0x3')]||'';this['serverUrl']=_0x7ec667[_0xd5d5('0x4')]||'';this[_0xd5d5('0x5')]=_0x7ec667[_0xd5d5('0x5')]||{};}module[_0xd5d5('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x599c=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x61c4d8,_0xddf739){var _0x30c590=function(_0x562c5e){while(--_0x562c5e){_0x61c4d8['push'](_0x61c4d8['shift']());}};_0x30c590(++_0xddf739);}(_0x599c,0x14e));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x57236c){this['id']=_0x57236c['id']||0x0;this[_0xc599('0x0')]=_0x57236c[_0xc599('0x0')]||'';this['username']=_0x57236c[_0xc599('0x1')]||'';this[_0xc599('0x2')]=_0x57236c['token']||'';this['remoteUri']=_0x57236c[_0xc599('0x3')]||'';this[_0xc599('0x4')]=_0x57236c['serverUrl']||'';this[_0xc599('0x5')]=_0x57236c[_0xc599('0x5')]||{};}module[_0xc599('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8094d6a..818bcc4 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 _0x3c6c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x4cb057,_0x1e007b){var _0x4c705d=function(_0x1aa0bb){while(--_0x1aa0bb){_0x4cb057['push'](_0x4cb057['shift']());}};_0x4c705d(++_0x1e007b);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x33cff6,_0x10322b){_0x33cff6=_0x33cff6-0x0;var _0x2f6281=_0x3c6c[_0x33cff6];return _0x2f6281;};'use strict';function FreshsalesAccount(_0x59723e){this['id']=_0x59723e['id']||0x0;this['name']=_0x59723e[_0xc3c6('0x0')]||'';this[_0xc3c6('0x1')]=_0x59723e[_0xc3c6('0x1')]||'';this[_0xc3c6('0x2')]=_0x59723e[_0xc3c6('0x3')]||'';this[_0xc3c6('0x4')]=_0x59723e[_0xc3c6('0x4')]||'';this[_0xc3c6('0x5')]=_0x59723e['serverUrl']||'';this[_0xc3c6('0x6')]=_0x59723e['Configurations']||{};}module[_0xc3c6('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x75a2=['serverUrl','name','username','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75a2,0x187));var _0x275a=function(_0x33ee43,_0x2440cf){_0x33ee43=_0x33ee43-0x0;var _0x25cb65=_0x75a2[_0x33ee43];return _0x25cb65;};'use strict';function FreshsalesAccount(_0x4c39af){this['id']=_0x4c39af['id']||0x0;this[_0x275a('0x0')]=_0x4c39af[_0x275a('0x0')]||'';this['username']=_0x4c39af[_0x275a('0x1')]||'';this[_0x275a('0x2')]=_0x4c39af[_0x275a('0x3')]||'';this[_0x275a('0x4')]=_0x4c39af['remoteUri']||'';this[_0x275a('0x5')]=_0x4c39af['serverUrl']||'';this['Configurations']=_0x4c39af['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c46b0b9..85fbdc0 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 _0x2f65=['context','exten','holdtime','assigned','lastAssignedTo','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode'];(function(_0x183242,_0x14810f){var _0x47452f=function(_0x22427a){while(--_0x22427a){_0x183242['push'](_0x183242['shift']());}};_0x47452f(++_0x14810f);}(_0x2f65,0x169));var _0x52f6=function(_0x1c78ed,_0x2fd411){_0x1c78ed=_0x1c78ed-0x0;var _0xeaa792=_0x2f65[_0x1c78ed];return _0xeaa792;};'use strict';function QueueReport(){this[_0x52f6('0x0')]=_0x52f6('0x1');this[_0x52f6('0x2')]='';this[_0x52f6('0x3')]='';this[_0x52f6('0x4')]='';this[_0x52f6('0x5')]='';this[_0x52f6('0x6')]=null;this[_0x52f6('0x7')]=null;this['position']=0x1;this[_0x52f6('0x8')]=0x1;this[_0x52f6('0x9')]=![];this[_0x52f6('0xa')]=null;this['queuecallercomplete']=![];this[_0x52f6('0xb')]=null;this['queuecallerexit']=![];this[_0x52f6('0xc')]=null;this[_0x52f6('0xd')]=0x1;this['channel']='';this[_0x52f6('0xe')]='';this[_0x52f6('0xf')]='';this[_0x52f6('0x10')]='';this[_0x52f6('0x11')]='';this[_0x52f6('0x12')]='';this['priority']='';this[_0x52f6('0x13')]=0x0;this[_0x52f6('0x14')]=![];this[_0x52f6('0x15')]='';this['motionChannel']=_0x52f6('0x16');this[_0x52f6('0x17')]=null;this[_0x52f6('0x18')]=0x0;this[_0x52f6('0x19')]={};}module[_0x52f6('0x1a')]=QueueReport; \ No newline at end of file +var _0x165f=['queuecallerexit','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','voice','routealias','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercompleteAt'];(function(_0x38e484,_0x2726af){var _0x200688=function(_0x18f5fe){while(--_0x18f5fe){_0x38e484['push'](_0x38e484['shift']());}};_0x200688(++_0x2726af);}(_0x165f,0x12a));var _0xf165=function(_0xc63150,_0x4cdf4b){_0xc63150=_0xc63150-0x0;var _0x22a303=_0x165f[_0xc63150];return _0x22a303;};'use strict';function QueueReport(){this[_0xf165('0x0')]=_0xf165('0x1');this[_0xf165('0x2')]='';this[_0xf165('0x3')]='';this[_0xf165('0x4')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0xf165('0x5')]=null;this[_0xf165('0x6')]=0x1;this[_0xf165('0x7')]=0x1;this[_0xf165('0x8')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xf165('0x9')]=null;this[_0xf165('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0xf165('0xb')]='';this['connectedlinename']='';this[_0xf165('0xc')]='';this[_0xf165('0xd')]='';this[_0xf165('0xe')]='';this[_0xf165('0xf')]='';this[_0xf165('0x10')]=0x0;this[_0xf165('0x11')]=![];this[_0xf165('0x12')]='';this['motionChannel']=_0xf165('0x13');this[_0xf165('0x14')]=null;this['mohtime']=0x0;this['variables']={};}module[_0xf165('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ce1e0f8..652fced 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 _0x4877=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4877,0x80));var _0x7487=function(_0x2f8a04,_0x411edc){_0x2f8a04=_0x2f8a04-0x0;var _0x26d1b5=_0x4877[_0x2f8a04];return _0x26d1b5;};'use strict';function SalesforceAccount(_0x3f63c9){this['id']=_0x3f63c9['id']||0x0;this[_0x7487('0x0')]=_0x3f63c9[_0x7487('0x0')]||'';this[_0x7487('0x1')]=_0x3f63c9[_0x7487('0x1')]||'';this['remoteUri']=_0x3f63c9[_0x7487('0x2')]||'';this[_0x7487('0x3')]=_0x3f63c9[_0x7487('0x3')]||'';this[_0x7487('0x4')]=_0x3f63c9[_0x7487('0x4')]||'';this[_0x7487('0x5')]=_0x3f63c9['clientSecret']||'';this[_0x7487('0x6')]=_0x3f63c9['securityToken']||'';this[_0x7487('0x7')]=_0x3f63c9[_0x7487('0x7')]||_0x7487('0x8');this[_0x7487('0x9')]=_0x3f63c9[_0x7487('0x9')]||'';this[_0x7487('0xa')]=_0x3f63c9[_0x7487('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xb36c=['type','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x4bfd66,_0x5e1089){var _0x59cffb=function(_0x1fa4f5){while(--_0x1fa4f5){_0x4bfd66['push'](_0x4bfd66['shift']());}};_0x59cffb(++_0x5e1089);}(_0xb36c,0x1bb));var _0xcb36=function(_0x593962,_0x5363ce){_0x593962=_0x593962-0x0;var _0x4d8f57=_0xb36c[_0x593962];return _0x4d8f57;};'use strict';function SalesforceAccount(_0x1b96d6){this['id']=_0x1b96d6['id']||0x0;this['name']=_0x1b96d6[_0xcb36('0x0')]||'';this[_0xcb36('0x1')]=_0x1b96d6[_0xcb36('0x1')]||'';this[_0xcb36('0x2')]=_0x1b96d6[_0xcb36('0x2')]||'';this[_0xcb36('0x3')]=_0x1b96d6[_0xcb36('0x3')]||'';this['clientId']=_0x1b96d6[_0xcb36('0x4')]||'';this[_0xcb36('0x5')]=_0x1b96d6[_0xcb36('0x5')]||'';this[_0xcb36('0x6')]=_0x1b96d6[_0xcb36('0x6')]||'';this[_0xcb36('0x7')]=_0x1b96d6['type']||'integrationTab';this['serverUrl']=_0x1b96d6['serverUrl']||'';this[_0xcb36('0x8')]=_0x1b96d6[_0xcb36('0x8')]||{};}module[_0xcb36('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 968b9e1..3f90f7e 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 _0x0c23=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x19d2d4,_0x335cf2){var _0xa121da=function(_0x514b39){while(--_0x514b39){_0x19d2d4['push'](_0x19d2d4['shift']());}};_0xa121da(++_0x335cf2);}(_0x0c23,0x1d6));var _0x30c2=function(_0x314924,_0xc63926){_0x314924=_0x314924-0x0;var _0x4c6530=_0x0c23[_0x314924];return _0x4c6530;};'use strict';function ServicenowAccount(_0x404dd2){this['id']=_0x404dd2['id']||0x0;this[_0x30c2('0x0')]=_0x404dd2[_0x30c2('0x0')]||'';this[_0x30c2('0x1')]=_0x404dd2['username']||'';this[_0x30c2('0x2')]=_0x404dd2[_0x30c2('0x2')]||'';this[_0x30c2('0x3')]=_0x404dd2[_0x30c2('0x3')]||'';this[_0x30c2('0x4')]=_0x404dd2[_0x30c2('0x4')]||'';this[_0x30c2('0x5')]=_0x404dd2[_0x30c2('0x5')]||{};}module[_0x30c2('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xd10a=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4b2683,_0x310e0f){var _0x5b83f0=function(_0x8c3a28){while(--_0x8c3a28){_0x4b2683['push'](_0x4b2683['shift']());}};_0x5b83f0(++_0x310e0f);}(_0xd10a,0x1e2));var _0xad10=function(_0x52cfea,_0x25c328){_0x52cfea=_0x52cfea-0x0;var _0xa79d48=_0xd10a[_0x52cfea];return _0xa79d48;};'use strict';function ServicenowAccount(_0xf4788){this['id']=_0xf4788['id']||0x0;this[_0xad10('0x0')]=_0xf4788[_0xad10('0x0')]||'';this[_0xad10('0x1')]=_0xf4788[_0xad10('0x1')]||'';this[_0xad10('0x2')]=_0xf4788['password']||'';this[_0xad10('0x3')]=_0xf4788['remoteUri']||'';this['serverUrl']=_0xf4788[_0xad10('0x4')]||'';this['Configurations']=_0xf4788[_0xad10('0x5')]||{};}module[_0xad10('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index da14403..fe5caad 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 _0x41a8=['exports','name','username','password','serverUrl','Configurations'];(function(_0x3cf160,_0x38c11f){var _0x57a642=function(_0x485f59){while(--_0x485f59){_0x3cf160['push'](_0x3cf160['shift']());}};_0x57a642(++_0x38c11f);}(_0x41a8,0xd3));var _0x841a=function(_0xb5f77f,_0x45161b){_0xb5f77f=_0xb5f77f-0x0;var _0x1d784f=_0x41a8[_0xb5f77f];return _0x1d784f;};'use strict';function SugarcrmAccount(_0x2d82b8){this['id']=_0x2d82b8['id']||0x0;this[_0x841a('0x0')]=_0x2d82b8[_0x841a('0x0')]||'';this[_0x841a('0x1')]=_0x2d82b8['username']||'';this[_0x841a('0x2')]=_0x2d82b8[_0x841a('0x2')]||'';this['remoteUri']=_0x2d82b8['remoteUri']||'';this[_0x841a('0x3')]=_0x2d82b8['serverUrl']||'';this['Configurations']=_0x2d82b8[_0x841a('0x4')]||{};}module[_0x841a('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x2cf3=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3504b3,_0x3f6be8){var _0x4813d8=function(_0x2d2f3a){while(--_0x2d2f3a){_0x3504b3['push'](_0x3504b3['shift']());}};_0x4813d8(++_0x3f6be8);}(_0x2cf3,0x19e));var _0x32cf=function(_0x4402c0,_0x4f49ce){_0x4402c0=_0x4402c0-0x0;var _0x2f8aa1=_0x2cf3[_0x4402c0];return _0x2f8aa1;};'use strict';function SugarcrmAccount(_0x24edd8){this['id']=_0x24edd8['id']||0x0;this[_0x32cf('0x0')]=_0x24edd8['name']||'';this[_0x32cf('0x1')]=_0x24edd8['username']||'';this[_0x32cf('0x2')]=_0x24edd8[_0x32cf('0x2')]||'';this['remoteUri']=_0x24edd8[_0x32cf('0x3')]||'';this[_0x32cf('0x4')]=_0x24edd8['serverUrl']||'';this[_0x32cf('0x5')]=_0x24edd8[_0x32cf('0x5')]||{};}module[_0x32cf('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 d035797..83b4194 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 _0x0e39=['address','exports','name','accountcode','state','unknown','status'];(function(_0x470c04,_0x2c351a){var _0x3f747c=function(_0x37d0e6){while(--_0x37d0e6){_0x470c04['push'](_0x470c04['shift']());}};_0x3f747c(++_0x2c351a);}(_0x0e39,0x1f3));var _0x90e3=function(_0x97d4b6,_0x1b8eab){_0x97d4b6=_0x97d4b6-0x0;var _0x364238=_0x0e39[_0x97d4b6];return _0x364238;};'use strict';function Telephone(_0xe2ca44){this['id']=_0xe2ca44['id']||0x0;this['name']=_0xe2ca44[_0x90e3('0x0')]||'';this[_0x90e3('0x1')]=_0xe2ca44[_0x90e3('0x1')]||'';this[_0x90e3('0x2')]=_0x90e3('0x3');this['stateTime']=0x0;this[_0x90e3('0x4')]=_0x90e3('0x3');this[_0x90e3('0x5')]='';}module[_0x90e3('0x6')]=Telephone; \ No newline at end of file +var _0xb720=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x58c50e,_0x573495){var _0x4a8199=function(_0x2f237c){while(--_0x2f237c){_0x58c50e['push'](_0x58c50e['shift']());}};_0x4a8199(++_0x573495);}(_0xb720,0x191));var _0x0b72=function(_0x444f91,_0x2a61f2){_0x444f91=_0x444f91-0x0;var _0x3248ab=_0xb720[_0x444f91];return _0x3248ab;};'use strict';function Telephone(_0x4a6760){this['id']=_0x4a6760['id']||0x0;this['name']=_0x4a6760[_0x0b72('0x0')]||'';this[_0x0b72('0x1')]=_0x4a6760[_0x0b72('0x1')]||'';this[_0x0b72('0x2')]=_0x0b72('0x3');this[_0x0b72('0x4')]=0x0;this[_0x0b72('0x5')]=_0x0b72('0x3');this[_0x0b72('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c09bcaa..273b0bb 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x16c275,_0x4d5403){var _0x2b08a2=function(_0x5b52a7){while(--_0x5b52a7){_0x16c275['push'](_0x16c275['shift']());}};_0x2b08a2(++_0x4d5403);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xb10b[_0x2ed8f3];return _0x525a55;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x36b098,_0x4ec98f){var _0x58721b=function(_0x1c2116){while(--_0x1c2116){_0x36b098['push'](_0x36b098['shift']());}};_0x58721b(++_0x4ec98f);}(_0xb10b,0x12a));var _0xbb10=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0xb10b[_0x210b8c];return _0xf39efa;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 36621be..d728627 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0xeb2951,_0x3d8fb7){var _0xe27b43=function(_0x42d3c3){while(--_0x42d3c3){_0xeb2951['push'](_0xeb2951['shift']());}};_0xe27b43(++_0x3d8fb7);}(_0x14a0,0x8e));var _0x014a=function(_0x17a9ce,_0x10ea1a){_0x17a9ce=_0x17a9ce-0x0;var _0x127016=_0x14a0[_0x17a9ce];return _0x127016;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x2d8b49,_0x267614){var _0xf4cb7=function(_0x2990b2){while(--_0x2990b2){_0x2d8b49['push'](_0x2d8b49['shift']());}};_0xf4cb7(++_0x267614);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f5b17ab..25368ab 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 _0x652c=['indexOf','host','port','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','registry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x652c,0xea));var _0xc652=function(_0x1b1a09,_0x2dc357){_0x1b1a09=_0x1b1a09-0x0;var _0x2c7e89=_0x652c[_0x1b1a09];return _0x2c7e89;};'use strict';function Trunk(_0x3244ea){this['id']=_0x3244ea['id']||0x0;this[_0xc652('0x0')]=_0x3244ea[_0xc652('0x0')]||![];this['name']=_0x3244ea[_0xc652('0x1')]||'';this[_0xc652('0x2')]=_0xc652('0x3');this[_0xc652('0x4')]=0x0;this['status']=_0xc652('0x3');this[_0xc652('0x5')]=_0x3244ea[_0xc652('0x5')]&&_0x3244ea[_0xc652('0x5')][_0xc652('0x6')](':')?_0x3244ea[_0xc652('0x5')]['split'](':')[0x0]:'';this[_0xc652('0x7')]='';this[_0xc652('0x8')]='';this['domain']='';this[_0xc652('0x9')]='';this[_0xc652('0xa')]='';this[_0xc652('0xb')]='unknown';this[_0xc652('0xc')]='';this['address']='';this[_0xc652('0xd')]=_0x3244ea[_0xc652('0xd')]||'';}module[_0xc652('0xe')]=Trunk; \ No newline at end of file +var _0x2f1d=['name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','registrationtime','address','defaultuser','exports','active'];(function(_0x26fcea,_0x14e111){var _0x1931d2=function(_0x4ca75b){while(--_0x4ca75b){_0x26fcea['push'](_0x26fcea['shift']());}};_0x1931d2(++_0x14e111);}(_0x2f1d,0x1a8));var _0xd2f1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2f1d[_0xfae23b];return _0x200640;};'use strict';function Trunk(_0x127d37){this['id']=_0x127d37['id']||0x0;this[_0xd2f1('0x0')]=_0x127d37[_0xd2f1('0x0')]||![];this[_0xd2f1('0x1')]=_0x127d37[_0xd2f1('0x1')]||'';this[_0xd2f1('0x2')]=_0xd2f1('0x3');this[_0xd2f1('0x4')]=0x0;this[_0xd2f1('0x5')]=_0xd2f1('0x3');this['registry']=_0x127d37[_0xd2f1('0x6')]&&_0x127d37[_0xd2f1('0x6')][_0xd2f1('0x7')](':')?_0x127d37[_0xd2f1('0x6')][_0xd2f1('0x8')](':')[0x0]:'';this[_0xd2f1('0x9')]='';this[_0xd2f1('0xa')]='';this[_0xd2f1('0xb')]='';this[_0xd2f1('0xc')]='';this['refresh']='';this['stateRegistry']=_0xd2f1('0x3');this[_0xd2f1('0xd')]='';this[_0xd2f1('0xe')]='';this[_0xd2f1('0xf')]=_0x127d37['defaultuser']||'';}module[_0xd2f1('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 8e6d2c6..3e4f540 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 _0xe697=['recordingFormat','exten'];(function(_0x3db04c,_0xd62160){var _0x3701d4=function(_0xaf2259){while(--_0xaf2259){_0x3db04c['push'](_0x3db04c['shift']());}};_0x3701d4(++_0xd62160);}(_0xe697,0xe3));var _0x7e69=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0xe697[_0xdeefbd];return _0x4ff63f;};'use strict';function voiceExtension(_0x476ec4){this['id']=_0x476ec4['id']||0x0;this[_0x7e69('0x0')]=_0x476ec4['exten']||'';this[_0x7e69('0x1')]=_0x476ec4[_0x7e69('0x1')]||'none';this['mandatoryDisposition']=_0x476ec4['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x80da=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x80da,0x1e0));var _0xa80d=function(_0x353cbd,_0x27be24){_0x353cbd=_0x353cbd-0x0;var _0x3fd2bb=_0x80da[_0x353cbd];return _0x3fd2bb;};'use strict';function voiceExtension(_0x2d3ce3){this['id']=_0x2d3ce3['id']||0x0;this[_0xa80d('0x0')]=_0x2d3ce3[_0xa80d('0x0')]||'';this[_0xa80d('0x1')]=_0x2d3ce3[_0xa80d('0x1')]||_0xa80d('0x2');this[_0xa80d('0x3')]=_0x2d3ce3[_0xa80d('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index ce7f191..31b03e0 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 _0xca96=['outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','wav49','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS'];(function(_0x328b72,_0x5b567c){var _0x111a4a=function(_0x434624){while(--_0x434624){_0x328b72['push'](_0x328b72['shift']());}};_0x111a4a(++_0x5b567c);}(_0xca96,0x10f));var _0x6ca9=function(_0x24c135,_0xdb4450){_0x24c135=_0x24c135-0x0;var _0x290c66=_0xca96[_0x24c135];return _0x290c66;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x6ca9('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0x6ca9('0x1'),'leastrecent':_0x6ca9('0x2'),'linear':_0x6ca9('0x3'),'random':_0x6ca9('0x4'),'ringall':_0x6ca9('0x5'),'rr':'roundrobin','rrmemory':_0x6ca9('0x6'),'rrordered':_0x6ca9('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0x1c1857){this['id']=_0x1c1857['id']||0x0;this[_0x6ca9('0x8')]=_0x1c1857[_0x6ca9('0x8')]||'';this[_0x6ca9('0x9')]=_0x1c1857[_0x6ca9('0x9')]||'';this[_0x6ca9('0xa')]=_0x1c1857['type']||_0x6ca9('0xb');this[_0x6ca9('0xc')]=0x0;this['total']=0x0;this[_0x6ca9('0xd')]=0x0;this[_0x6ca9('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0x6ca9('0xf')]=0x0;this[_0x6ca9('0x10')]=0x0;this[_0x6ca9('0x11')]=0x0;this[_0x6ca9('0x12')]=0x0;this[_0x6ca9('0x13')]=0x0;this[_0x6ca9('0x14')]=0x0;this[_0x6ca9('0x15')]=0x0;this[_0x6ca9('0x16')]=0x0;this[_0x6ca9('0x17')]=0x0;this[_0x6ca9('0x18')]=0x0;this['paused']=0x0;this[_0x6ca9('0x19')]=0x0;this[_0x6ca9('0x1a')]=0x0;this[_0x6ca9('0x1b')]=0x0;this['unavailable']=0x0;this[_0x6ca9('0x1c')]=0x0;this['acw']=_0x1c1857[_0x6ca9('0x1d')]||![];this[_0x6ca9('0x1e')]=_0x1c1857['acwTimeout']||0xa;this[_0x6ca9('0x1f')]=_0x1c1857[_0x6ca9('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this[_0x6ca9('0x20')]='';this[_0x6ca9('0x21')]='';this['originated']=0x0;this[_0x6ca9('0x22')]=0x0;this[_0x6ca9('0x23')]=_0x1c1857['dialTimezone']||null;this[_0x6ca9('0x24')]=_0x1c1857[_0x6ca9('0x24')]?_0x1c1857['dialGlobalInterval']:null;this['dialActive']=_0x1c1857[_0x6ca9('0x25')];this['dialMethod']=_0x1c1857['dialMethod']||_0x6ca9('0x26');this[_0x6ca9('0x27')]=_0x1c1857['dialLimitChannel']||0x0;this[_0x6ca9('0x28')]=_0x1c1857['dialLimitQueue']||0x0;this[_0x6ca9('0x29')]=_0x1c1857[_0x6ca9('0x29')]||0x1;this[_0x6ca9('0x2a')]=_0x1c1857[_0x6ca9('0x2a')]||_0x6ca9('0x2b');this[_0x6ca9('0x2c')]=_0x1c1857['dialPredictiveOptimizationPercentage']||0.03;this[_0x6ca9('0x2d')]=_0x1c1857['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x1c1857[_0x6ca9('0x2e')]||_0x6ca9('0x2f');this[_0x6ca9('0x30')]=_0x1c1857[_0x6ca9('0x30')]||'anonymous';this[_0x6ca9('0x31')]=_0x1c1857[_0x6ca9('0x31')]||0x1e;this[_0x6ca9('0x32')]=_0x1c1857['dialQueueOptions']||_0x6ca9('0x33');this[_0x6ca9('0x34')]=_0x1c1857[_0x6ca9('0x34')]||0x3;this[_0x6ca9('0x35')]=_0x1c1857[_0x6ca9('0x35')]||undefined;this[_0x6ca9('0x36')]=_0x1c1857[_0x6ca9('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x1c1857['dialCongestionRetryFrequency']||0x96;this[_0x6ca9('0x37')]=_0x1c1857[_0x6ca9('0x37')]||0x3;this['dialBusyRetryFrequency']=_0x1c1857['dialBusyRetryFrequency']||0x96;this[_0x6ca9('0x38')]=_0x1c1857[_0x6ca9('0x38')]||0x3;this[_0x6ca9('0x39')]=_0x1c1857['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x1c1857[_0x6ca9('0x3a')]||0x3;this[_0x6ca9('0x3b')]=_0x1c1857[_0x6ca9('0x3b')]||0x96;this[_0x6ca9('0x3c')]=_0x1c1857[_0x6ca9('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x1c1857[_0x6ca9('0x3d')]||0x96;this['dialAbandonedMaxRetry']=_0x1c1857[_0x6ca9('0x3e')]||0x3;this[_0x6ca9('0x3f')]=_0x1c1857[_0x6ca9('0x3f')]||0x96;this[_0x6ca9('0x40')]=_0x1c1857[_0x6ca9('0x40')]||0x3;this[_0x6ca9('0x41')]=_0x1c1857[_0x6ca9('0x41')]||0x96;this[_0x6ca9('0x42')]=_0x1c1857[_0x6ca9('0x42')]||0x3;this[_0x6ca9('0x43')]=_0x1c1857['dialAgentRejectRetryFrequency']||0x96;this[_0x6ca9('0x44')]=_0x1c1857[_0x6ca9('0x44')]||0x3;this[_0x6ca9('0x45')]=_0x1c1857[_0x6ca9('0x45')]||0x4;this[_0x6ca9('0x46')]=_0x1c1857['Trunk']?_0x1c1857[_0x6ca9('0x46')]:undefined;this[_0x6ca9('0x47')]=_0x1c1857[_0x6ca9('0x47')]?_0x1c1857[_0x6ca9('0x47')]:undefined;this[_0x6ca9('0x48')]=_0x1c1857[_0x6ca9('0x48')]||undefined;this['Interval']=_0x1c1857[_0x6ca9('0x49')]?_0x1c1857[_0x6ca9('0x49')]:undefined;this['dialOrderByScheduledAt']=_0x1c1857[_0x6ca9('0x4a')]||_0x6ca9('0x4b');this['dialRandomLastDigitCallerIdNumber']=_0x1c1857['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6ca9('0x4c')]=_0x1c1857[_0x6ca9('0x4c')]||undefined;this[_0x6ca9('0x4d')]=strategy[_0x1c1857['strategy']];this[_0x6ca9('0x4e')]=!![];this[_0x6ca9('0x4f')]=_0x1c1857[_0x6ca9('0x4f')]||![];this[_0x6ca9('0x50')]=_0x1c1857[_0x6ca9('0x50')];this[_0x6ca9('0x51')]=_0x1c1857['dialAMDGreeting'];this[_0x6ca9('0x52')]=_0x1c1857['dialAMDAfterGreetingSilence'];this[_0x6ca9('0x53')]=_0x1c1857[_0x6ca9('0x53')];this[_0x6ca9('0x54')]=_0x1c1857[_0x6ca9('0x54')];this[_0x6ca9('0x55')]=_0x1c1857[_0x6ca9('0x55')];this[_0x6ca9('0x56')]=_0x1c1857[_0x6ca9('0x56')];this['dialAMDSilenceThreshold']=_0x1c1857[_0x6ca9('0x57')];this['dialAMDMaximumWordLength']=_0x1c1857[_0x6ca9('0x58')];this[_0x6ca9('0x59')]=0x0;this['pTalking']=0x0;this['timeout']=_0x1c1857[_0x6ca9('0x5a')];this['outboundAnswerCallsDay']=0x0;this[_0x6ca9('0x5b')]=0x0;this[_0x6ca9('0x5c')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6ca9('0x5d')]=0x0;this[_0x6ca9('0x5e')]=0x0;this[_0x6ca9('0x5f')]=0x0;this[_0x6ca9('0x60')]=0x0;this[_0x6ca9('0x61')]=0x0;this[_0x6ca9('0x62')]=0x0;this[_0x6ca9('0x63')]=0x0;this[_0x6ca9('0x64')]=0x0;this[_0x6ca9('0x65')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x6ca9('0x66')]=undefined;this[_0x6ca9('0x67')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x6ca9('0x68')]=0x0;this[_0x6ca9('0x69')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x6ca9('0x6a')]=0x0;this[_0x6ca9('0x6b')]=0x0;this[_0x6ca9('0x6c')]=0x0;this[_0x6ca9('0x6d')]=0x0;this[_0x6ca9('0x6e')]=0x0;this[_0x6ca9('0x6f')]=_0x1c1857['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x1c1857[_0x6ca9('0x70')]||0xa;this[_0x6ca9('0x71')]=0x0;this[_0x6ca9('0x72')]=0x0;this[_0x6ca9('0x73')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x6ca9('0x74')]=0x0;this['erlangBusyFactor']=0x0;this[_0x6ca9('0x75')]=_0x1c1857[_0x6ca9('0x75')]||0x1e;this['dialRecallInQueue']=_0x1c1857['dialRecallInQueue']||![];this[_0x6ca9('0x76')]=!!_0x1c1857[_0x6ca9('0x76')]||![];this[_0x6ca9('0x77')]=!!_0x1c1857[_0x6ca9('0x77')]||![];this['dialQueueProject2']=_0x1c1857[_0x6ca9('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x1c1857[_0x6ca9('0x79')]||![];this['dialAgiAfterHangupAgent']=_0x1c1857['dialAgiAfterHangupAgent']||![];this[_0x6ca9('0x9')]=monitorFormat[_0x1c1857[_0x6ca9('0x9')]]?monitorFormat[_0x1c1857[_0x6ca9('0x9')]]:undefined;this[_0x6ca9('0x7a')]=_0x1c1857[_0x6ca9('0x7a')]||![];this['mandatoryDispositionPause']=_0x1c1857[_0x6ca9('0x7b')]?_0x1c1857[_0x6ca9('0x7b')]:undefined;this['queueSummaryCountersUpdated']=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0x022a=['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','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','available','inUse','invalid','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX'];(function(_0x852450,_0xd2456e){var _0x329404=function(_0x4d482b){while(--_0x4d482b){_0x852450['push'](_0x852450['shift']());}};_0x329404(++_0xd2456e);}(_0x022a,0x1f0));var _0xa022=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0x022a[_0x4e9861];return _0x49802f;};'use strict';var monitorFormat={'wav':_0xa022('0x0'),'wav49':_0xa022('0x1'),'gsm':_0xa022('0x2')};var strategy={'fewestcalls':_0xa022('0x3'),'leastrecent':_0xa022('0x4'),'linear':_0xa022('0x5'),'random':_0xa022('0x6'),'ringall':_0xa022('0x7'),'rr':_0xa022('0x8'),'rrmemory':_0xa022('0x9'),'rrordered':_0xa022('0xa'),'wrandom':_0xa022('0xb')};function VoiceQueue(_0x4bc874){this['id']=_0x4bc874['id']||0x0;this[_0xa022('0xc')]=_0x4bc874['name']||'';this['monitor_format']=_0x4bc874[_0xa022('0xd')]||'';this[_0xa022('0xe')]=_0x4bc874[_0xa022('0xe')]||_0xa022('0xf');this[_0xa022('0x10')]=0x0;this[_0xa022('0x11')]=0x0;this[_0xa022('0x12')]=0x0;this['sumDuration']=0x0;this[_0xa022('0x13')]=0x0;this[_0xa022('0x14')]=0x0;this[_0xa022('0x15')]=0x0;this['abandoned']=0x0;this[_0xa022('0x16')]=0x0;this['busy']=0x0;this[_0xa022('0x17')]=0x0;this[_0xa022('0x18')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this[_0xa022('0x19')]=0x0;this[_0xa022('0x1a')]=0x0;this[_0xa022('0x1b')]=0x0;this[_0xa022('0x1c')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0xa022('0x1d')]=0x0;this['acw']=_0x4bc874[_0xa022('0x1e')]||![];this[_0xa022('0x1f')]=_0x4bc874[_0xa022('0x1f')]||0xa;this[_0xa022('0x20')]=_0x4bc874[_0xa022('0x20')]||'no';this[_0xa022('0x21')]=!![];this[_0xa022('0x22')]='';this[_0xa022('0x23')]='';this[_0xa022('0x24')]=0x0;this[_0xa022('0x25')]=0x0;this[_0xa022('0x26')]=_0x4bc874[_0xa022('0x26')]||null;this[_0xa022('0x27')]=_0x4bc874[_0xa022('0x27')]?_0x4bc874['dialGlobalInterval']:null;this[_0xa022('0x28')]=_0x4bc874[_0xa022('0x28')];this[_0xa022('0x29')]=_0x4bc874[_0xa022('0x29')]||_0xa022('0x2a');this[_0xa022('0x2b')]=_0x4bc874['dialLimitChannel']||0x0;this[_0xa022('0x2c')]=_0x4bc874['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x4bc874[_0xa022('0x2d')]||0x1;this[_0xa022('0x2e')]=_0x4bc874['dialPredictiveOptimization']||_0xa022('0x2f');this[_0xa022('0x30')]=_0x4bc874[_0xa022('0x30')]||0.03;this[_0xa022('0x31')]=_0x4bc874['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x4bc874[_0xa022('0x32')]||_0xa022('0x33');this[_0xa022('0x34')]=_0x4bc874[_0xa022('0x34')]||_0xa022('0x33');this[_0xa022('0x35')]=_0x4bc874['dialOriginateTimeout']||0x1e;this[_0xa022('0x36')]=_0x4bc874['dialQueueOptions']||_0xa022('0x37');this['dialQueueTimeout']=_0x4bc874[_0xa022('0x38')]||0x3;this[_0xa022('0x39')]=_0x4bc874[_0xa022('0x39')]||undefined;this['dialCongestionMaxRetry']=_0x4bc874[_0xa022('0x3a')]||0x3;this[_0xa022('0x3b')]=_0x4bc874[_0xa022('0x3b')]||0x96;this[_0xa022('0x3c')]=_0x4bc874[_0xa022('0x3c')]||0x3;this[_0xa022('0x3d')]=_0x4bc874[_0xa022('0x3d')]||0x96;this[_0xa022('0x3e')]=_0x4bc874[_0xa022('0x3e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4bc874[_0xa022('0x3f')]||0x96;this[_0xa022('0x40')]=_0x4bc874[_0xa022('0x40')]||0x3;this[_0xa022('0x41')]=_0x4bc874['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa022('0x42')]=_0x4bc874[_0xa022('0x42')]||0x3;this['dialDropRetryFrequency']=_0x4bc874[_0xa022('0x43')]||0x96;this[_0xa022('0x44')]=_0x4bc874['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x4bc874[_0xa022('0x45')]||0x96;this[_0xa022('0x46')]=_0x4bc874[_0xa022('0x46')]||0x3;this['dialMachineRetryFrequency']=_0x4bc874[_0xa022('0x47')]||0x96;this[_0xa022('0x48')]=_0x4bc874[_0xa022('0x48')]||0x3;this[_0xa022('0x49')]=_0x4bc874[_0xa022('0x49')]||0x96;this[_0xa022('0x4a')]=_0x4bc874[_0xa022('0x4a')]||0x3;this[_0xa022('0x4b')]=_0x4bc874[_0xa022('0x4b')]||0x4;this['Trunk']=_0x4bc874['Trunk']?_0x4bc874[_0xa022('0x4c')]:undefined;this[_0xa022('0x4d')]=_0x4bc874[_0xa022('0x4d')]?_0x4bc874['TrunkBackup']:undefined;this[_0xa022('0x4e')]=_0x4bc874[_0xa022('0x4e')]||undefined;this[_0xa022('0x4f')]=_0x4bc874[_0xa022('0x4f')]?_0x4bc874[_0xa022('0x4f')]:undefined;this[_0xa022('0x50')]=_0x4bc874[_0xa022('0x50')]||_0xa022('0x51');this[_0xa022('0x52')]=_0x4bc874[_0xa022('0x52')]||undefined;this[_0xa022('0x53')]=_0x4bc874['dialCutDigit']||undefined;this[_0xa022('0x54')]=strategy[_0x4bc874[_0xa022('0x54')]];this[_0xa022('0x55')]=!![];this[_0xa022('0x56')]=_0x4bc874[_0xa022('0x56')]||![];this['dialAMDInitialSilence']=_0x4bc874[_0xa022('0x57')];this['dialAMDGreeting']=_0x4bc874[_0xa022('0x58')];this[_0xa022('0x59')]=_0x4bc874['dialAMDAfterGreetingSilence'];this[_0xa022('0x5a')]=_0x4bc874[_0xa022('0x5a')];this[_0xa022('0x5b')]=_0x4bc874[_0xa022('0x5b')];this[_0xa022('0x5c')]=_0x4bc874[_0xa022('0x5c')];this[_0xa022('0x5d')]=_0x4bc874[_0xa022('0x5d')];this[_0xa022('0x5e')]=_0x4bc874[_0xa022('0x5e')];this[_0xa022('0x5f')]=_0x4bc874[_0xa022('0x5f')];this[_0xa022('0x60')]=0x0;this[_0xa022('0x61')]=0x0;this[_0xa022('0x62')]=_0x4bc874[_0xa022('0x62')];this[_0xa022('0x63')]=0x0;this[_0xa022('0x64')]=0x0;this[_0xa022('0x65')]=0x0;this[_0xa022('0x66')]=0x0;this[_0xa022('0x67')]=0x0;this[_0xa022('0x68')]=0x0;this[_0xa022('0x69')]=0x0;this[_0xa022('0x6a')]=0x0;this[_0xa022('0x6b')]=0x0;this[_0xa022('0x6c')]=0x0;this[_0xa022('0x6d')]=0x0;this[_0xa022('0x6e')]=0x0;this[_0xa022('0x6f')]=0x0;this[_0xa022('0x70')]=0x0;this[_0xa022('0x71')]=undefined;this[_0xa022('0x72')]=undefined;this[_0xa022('0x73')]=undefined;this[_0xa022('0x74')]=1.05;this[_0xa022('0x75')]=0x0;this[_0xa022('0x76')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xa022('0x77')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xa022('0x78')]=0x0;this[_0xa022('0x79')]=0x0;this[_0xa022('0x7a')]=0x0;this[_0xa022('0x7b')]=_0x4bc874[_0xa022('0x7c')]||0x14;this[_0xa022('0x7d')]=_0x4bc874[_0xa022('0x7c')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa022('0x7e')]=0x0;this[_0xa022('0x7f')]=_0x4bc874[_0xa022('0x7f')]||0x1e;this[_0xa022('0x80')]=_0x4bc874[_0xa022('0x80')]||![];this[_0xa022('0x81')]=!!_0x4bc874[_0xa022('0x81')]||![];this[_0xa022('0x82')]=!!_0x4bc874[_0xa022('0x82')]||![];this[_0xa022('0x83')]=_0x4bc874[_0xa022('0x83')]||undefined;this[_0xa022('0x84')]=_0x4bc874[_0xa022('0x84')]||![];this[_0xa022('0x85')]=_0x4bc874['dialAgiAfterHangupAgent']||![];this[_0xa022('0xd')]=monitorFormat[_0x4bc874[_0xa022('0xd')]]?monitorFormat[_0x4bc874[_0xa022('0xd')]]:undefined;this[_0xa022('0x86')]=_0x4bc874[_0xa022('0x86')]||![];this[_0xa022('0x87')]=_0x4bc874['mandatoryDispositionPause']?_0x4bc874['mandatoryDispositionPause']:undefined;this[_0xa022('0x88')]=![];}module[_0xa022('0x89')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 8e0bcb4..26abd72 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae1c=['strategy','abandoned','busy','invalid','onHold','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','notInUse','loggedin','callers','length','SIP/','incall','status','booked','keys','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundCongestionCallsDay','preview','exports','ringing','talking','waiting','available','answered','inUse','loggedIn','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','sumDuration','total','name'];(function(_0x298796,_0x5e2696){var _0xb2acc4=function(_0x1171db){while(--_0x1171db){_0x298796['push'](_0x298796['shift']());}};_0xb2acc4(++_0x5e2696);}(_0xae1c,0xff));var _0xcae1=function(_0x11973d,_0x68c443){_0x11973d=_0x11973d-0x0;var _0x2875e3=_0xae1c[_0x11973d];return _0x2875e3;};'use strict';var INBOUND_COUNTERS=['available','loggedIn','loggedInDb','paused',_0xcae1('0x0'),_0xcae1('0x1'),_0xcae1('0x2')];var OUTBOUND_COUNTERS=[_0xcae1('0x3'),_0xcae1('0x4'),_0xcae1('0x5'),_0xcae1('0x6'),_0xcae1('0x7'),_0xcae1('0x8'),_0xcae1('0x9'),_0xcae1('0xa'),_0xcae1('0xb'),_0xcae1('0xc'),'outboundCongestionCallsDay','outboundNoAnswerCallsDay',_0xcae1('0xd'),_0xcae1('0xe'),_0xcae1('0xf'),'outboundUnknownCallsDay',_0xcae1('0x10'),_0xcae1('0x11'),_0xcae1('0x1'),'sumBillable',_0xcae1('0x12'),_0xcae1('0x13'),'waiting'];function VoiceQueueSummary(_0x4e24fb){this['id']=_0x4e24fb['id'];this[_0xcae1('0x14')]=_0x4e24fb[_0xcae1('0x14')];this[_0xcae1('0x15')]=_0x4e24fb[_0xcae1('0x15')];this[_0xcae1('0x16')]=_0x4e24fb[_0xcae1('0x16')]||0x0;this[_0xcae1('0x4')]=_0x4e24fb[_0xcae1('0x4')]||0x0;this[_0xcae1('0x3')]=_0x4e24fb[_0xcae1('0x3')]||0x0;this[_0xcae1('0x17')]=_0x4e24fb[_0xcae1('0x17')]||0x0;this[_0xcae1('0x5')]=_0x4e24fb[_0xcae1('0x5')]||0x0;this[_0xcae1('0x18')]=_0x4e24fb['invalid']||0x0;this[_0xcae1('0x6')]=_0x4e24fb[_0xcae1('0x6')]||0x0;this['loggedInDb']=_0x4e24fb['loggedInDb']||0x0;this[_0xcae1('0x19')]=_0x4e24fb[_0xcae1('0x19')]||0x0;this['notInUse']=_0x4e24fb['notInUse']||0x0;this[_0xcae1('0x10')]=_0x4e24fb['paused']||0x0;this[_0xcae1('0x0')]=_0x4e24fb[_0xcae1('0x0')]||0x0;this[_0xcae1('0x1a')]=_0x4e24fb[_0xcae1('0x1a')];this[_0xcae1('0x1b')]=_0x4e24fb[_0xcae1('0x1b')];this[_0xcae1('0x12')]=_0x4e24fb[_0xcae1('0x12')];this[_0xcae1('0x1c')]=_0x4e24fb[_0xcae1('0x1c')]||0x0;this[_0xcae1('0x1')]=_0x4e24fb[_0xcae1('0x1')]||0x0;this[_0xcae1('0x13')]=_0x4e24fb[_0xcae1('0x13')]||0x0;this['type']=_0x4e24fb[_0xcae1('0x1d')];this[_0xcae1('0x1e')]=_0x4e24fb[_0xcae1('0x1e')]||0x0;this[_0xcae1('0x1f')]=_0x4e24fb['unknown']||0x0;this[_0xcae1('0x20')]=_0x4e24fb[_0xcae1('0x20')]||0x0;this[_0xcae1('0x2')]=_0x4e24fb[_0xcae1('0x2')]||0x0;if(_0x4e24fb[_0xcae1('0x1d')]===_0xcae1('0x21')){this[_0xcae1('0x11')]=_0x4e24fb[_0xcae1('0x11')]||0x0;this['dialActive']=_0x4e24fb[_0xcae1('0x22')];this['dialMethod']=_0x4e24fb[_0xcae1('0x23')];this[_0xcae1('0x24')]=_0x4e24fb['dialOriginateCallerIdName'];this[_0xcae1('0x25')]=_0x4e24fb[_0xcae1('0x25')];this[_0xcae1('0x26')]=_0x4e24fb['dialOriginateTimeout'];this['dialPrefix']=_0x4e24fb[_0xcae1('0x27')];this[_0xcae1('0x28')]=_0x4e24fb[_0xcae1('0x28')];this[_0xcae1('0x29')]=_0x4e24fb[_0xcae1('0x29')];this[_0xcae1('0xa')]=_0x4e24fb[_0xcae1('0xa')];this['outboundBlacklistCallsDay']=_0x4e24fb[_0xcae1('0xb')];this[_0xcae1('0xc')]=_0x4e24fb[_0xcae1('0xc')];this['outboundCongestionCallsDay']=_0x4e24fb['outboundCongestionCallsDay'];this[_0xcae1('0x2a')]=_0x4e24fb['outboundDropCallsDayACS'];this[_0xcae1('0x2b')]=_0x4e24fb[_0xcae1('0x2b')];this[_0xcae1('0x2c')]=_0x4e24fb[_0xcae1('0x2c')];this[_0xcae1('0x2d')]=_0x4e24fb[_0xcae1('0x2d')];this[_0xcae1('0xd')]=_0x4e24fb[_0xcae1('0xd')];this[_0xcae1('0x2e')]=_0x4e24fb[_0xcae1('0x2e')];this['outboundReCallsDay']=_0x4e24fb[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x4e24fb[_0xcae1('0xf')];this[_0xcae1('0x2f')]=_0x4e24fb['outboundUnknownCallsDay'];this[_0xcae1('0x30')]=_0x4e24fb['predictiveIntervalAnsweredCalls'];this[_0xcae1('0x31')]=_0x4e24fb['predictiveIntervalAvgHoldtime'];this[_0xcae1('0x32')]=_0x4e24fb[_0xcae1('0x32')];this[_0xcae1('0x33')]=_0x4e24fb[_0xcae1('0x33')];this[_0xcae1('0x34')]=_0x4e24fb[_0xcae1('0x34')];this[_0xcae1('0x35')]=_0x4e24fb[_0xcae1('0x35')];this[_0xcae1('0x36')]=_0x4e24fb[_0xcae1('0x36')];this['predictiveIntervalHitRate']=_0x4e24fb[_0xcae1('0x37')];this['predictiveIntervalMultiplicativeFactor']=_0x4e24fb[_0xcae1('0x38')];this['predictiveIntervalPauses']=_0x4e24fb[_0xcae1('0x39')];this[_0xcae1('0x3a')]=_0x4e24fb['predictiveIntervalAvailable'];this[_0xcae1('0x3b')]=_0x4e24fb[_0xcae1('0x3b')];this[_0xcae1('0x8')]=_0x4e24fb[_0xcae1('0x8')];this['erlangCalls']=_0x4e24fb[_0xcae1('0x3c')];this[_0xcae1('0x3d')]=_0x4e24fb['erlangCallToSecond'];this[_0xcae1('0x3e')]=_0x4e24fb[_0xcae1('0x3e')];this[_0xcae1('0x3f')]=_0x4e24fb['erlangBusyFactor'];this[_0xcae1('0x40')]=_0x4e24fb['startPredictive'];this[_0xcae1('0x41')]=_0x4e24fb[_0xcae1('0x41')];this[_0xcae1('0x42')]=_0x4e24fb['message'];this[_0xcae1('0x43')]=_0x4e24fb[_0xcae1('0x43')];}if(_0x4e24fb[_0xcae1('0x44')]){this[_0xcae1('0x44')]={'id':_0x4e24fb[_0xcae1('0x44')]['id'],'name':_0x4e24fb[_0xcae1('0x44')]['name'],'active':_0x4e24fb[_0xcae1('0x44')][_0xcae1('0x45')],'callerid':_0x4e24fb[_0xcae1('0x44')][_0xcae1('0x46')]};}}VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x48')]=function(_0x349a18,_0x1d6700,_0x145fd7,_0x43f389){this[_0xcae1('0x7')]=0x0;this['talking']=0x0;this[_0xcae1('0x10')]=0x0;this[_0xcae1('0x1f')]=0x0;this[_0xcae1('0x49')]=0x0;this[_0xcae1('0x5')]=0x0;this[_0xcae1('0x17')]=0x0;this[_0xcae1('0x18')]=0x0;this[_0xcae1('0x1e')]=0x0;this['ringing']=0x0;this[_0xcae1('0x1a')]=0x0;this[_0xcae1('0x19')]=0x0;if(_0x145fd7){if(_0x145fd7[_0xcae1('0x3')]){this[_0xcae1('0x3')]=Number(_0x145fd7['available']);}if(_0x145fd7['loggedin']){this['loggedIn']=Number(_0x145fd7[_0xcae1('0x4a')]);}if(_0x145fd7[_0xcae1('0x4b')]){this[_0xcae1('0x2')]=Number(_0x145fd7[_0xcae1('0x4b')]);}}for(var _0x11bacb=0x0;_0x11bacb<_0x349a18[_0xcae1('0x4c')];_0x11bacb++){var _0x5b95ab=_0x1d6700[_0xcae1('0x4d')+_0x349a18[_0x11bacb][_0xcae1('0x14')]];if(_0x5b95ab&&_0x5b95ab['online']){this[_0xcae1('0x7')]+=0x1;}if(_0x349a18[_0x11bacb][_0xcae1('0x4e')]==='1'){this[_0xcae1('0x1')]+=0x1;}if(_0x349a18[_0x11bacb]['paused']==='1'&&!['2','7','8']['includes'](_0x349a18[_0x11bacb][_0xcae1('0x4f')])){this[_0xcae1('0x10')]+=0x1;}switch(_0x349a18[_0x11bacb][_0xcae1('0x4f')]){case'0':this[_0xcae1('0x1f')]+=0x1;break;case'1':this[_0xcae1('0x49')]+=0x1;break;case'2':this[_0xcae1('0x5')]+=0x1;break;case'3':this[_0xcae1('0x17')]+=0x1;break;case'4':this[_0xcae1('0x18')]+=0x1;break;case'5':this[_0xcae1('0x1e')]+=0x1;break;case'6':this[_0xcae1('0x0')]+=0x1;break;case'7':this[_0xcae1('0x1a')]+=0x1;break;case'8':this[_0xcae1('0x19')]+=0x1;break;}}if(this['dialMethod']===_0xcae1('0x50')){var _0xcad695=Object[_0xcae1('0x51')](_0x43f389);for(var _0x258630=0x0;_0x258630<_0xcad695[_0xcae1('0x4c')];_0x258630++){var _0x3ccfb4=_0xcad695[_0x258630];var _0x9ef6d4=_0x43f389[_0x3ccfb4];if(_0x9ef6d4[_0xcae1('0x52')]===this[_0xcae1('0x14')]&&_0x9ef6d4[_0xcae1('0x1d')]===_0xcae1('0x53')&&_0x9ef6d4[_0xcae1('0x54')]==='xcally-motion-preview'){this[_0xcae1('0x1')]+=0x1;}}if(this[_0xcae1('0x1')]>this[_0xcae1('0x5')]){this['talking']=this[_0xcae1('0x5')];}this[_0xcae1('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x55')]=function(_0x5282ac){var _0x2efd37=![];if(_0x5282ac){_0x2efd37=INBOUND_COUNTERS[_0xcae1('0x56')](function(_0x1b40b9){return this[_0x1b40b9]!==_0x5282ac[_0x1b40b9];},this);}return _0x2efd37;};VoiceQueueSummary['prototype'][_0xcae1('0x57')]=function(_0x16b1b2){var _0x90b0ad=![];var _0x4e5d01=![];var _0x303b98=![];if(_0x16b1b2){_0x90b0ad=this[_0xcae1('0x23')]!==_0x16b1b2['dialMethod']||this[_0xcae1('0x22')]!==_0x16b1b2[_0xcae1('0x22')]||this[_0xcae1('0x42')]!==_0x16b1b2['message']||this[_0xcae1('0x43')]!==_0x16b1b2[_0xcae1('0x43')];_0x4e5d01=OUTBOUND_COUNTERS['some'](function(_0x4b68d1){return this[_0x4b68d1]!==_0x16b1b2[_0x4b68d1];},this);if(this[_0xcae1('0x44')]&&_0x16b1b2[_0xcae1('0x44')]){_0x303b98=this[_0xcae1('0x44')][_0xcae1('0x14')]!==_0x16b1b2['Trunk'][_0xcae1('0x14')]||this[_0xcae1('0x44')]['active']!==_0x16b1b2[_0xcae1('0x44')][_0xcae1('0x45')];}}return _0x90b0ad||_0x4e5d01||_0x303b98;};VoiceQueueSummary[_0xcae1('0x47')][_0xcae1('0x58')]=function(_0x1de80e){this[_0xcae1('0x4')]=_0x1de80e[_0xcae1('0x4')];this[_0xcae1('0x42')]=_0x1de80e[_0xcae1('0x42')];this['statusMessage']=_0x1de80e['statusMessage'];this[_0xcae1('0x8')]=_0x1de80e['originated'];this['outboundAbandonedCallsDay']=_0x1de80e[_0xcae1('0x9')];this[_0xcae1('0xa')]=_0x1de80e[_0xcae1('0xa')];this[_0xcae1('0xb')]=_0x1de80e[_0xcae1('0xb')];this[_0xcae1('0xc')]=_0x1de80e[_0xcae1('0xc')];this[_0xcae1('0x59')]=_0x1de80e[_0xcae1('0x59')];this[_0xcae1('0x2d')]=_0x1de80e[_0xcae1('0x2d')];this[_0xcae1('0xd')]=_0x1de80e['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1de80e[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x1de80e[_0xcae1('0xf')];this[_0xcae1('0x2f')]=_0x1de80e[_0xcae1('0x2f')];this['sumBillable']=_0x1de80e[_0xcae1('0x1b')];this[_0xcae1('0x12')]=_0x1de80e[_0xcae1('0x12')];this[_0xcae1('0x13')]=_0x1de80e[_0xcae1('0x13')];if(this[_0xcae1('0x23')]===_0xcae1('0x5a')){this[_0xcae1('0x11')]=_0x1de80e[_0xcae1('0x11')];}};module[_0xcae1('0x5b')]=VoiceQueueSummary; \ No newline at end of file +var _0xd5b2=['xcally-motion-preview','compareToInboundQueue','some','prototype','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','ringing','talking','waiting','available','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','createReport','loggedin','length','SIP/','online','incall','includes','status','booked'];(function(_0x53df15,_0xaef07){var _0x4cc798=function(_0x35763f){while(--_0x35763f){_0x53df15['push'](_0x53df15['shift']());}};_0x4cc798(++_0xaef07);}(_0xd5b2,0x10e));var _0x2d5b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd5b2[_0xae7c2f];return _0x5d7001;};'use strict';var INBOUND_COUNTERS=['available',_0x2d5b('0x0'),_0x2d5b('0x1'),'paused',_0x2d5b('0x2'),_0x2d5b('0x3'),_0x2d5b('0x4')];var OUTBOUND_COUNTERS=[_0x2d5b('0x5'),_0x2d5b('0x6'),_0x2d5b('0x7'),'loggedIn','loggedInDb','originated',_0x2d5b('0x8'),'outboundAnswerCallsDay',_0x2d5b('0x9'),'outboundBusyCallsDay',_0x2d5b('0xa'),'outboundNoAnswerCallsDay',_0x2d5b('0xb'),_0x2d5b('0xc'),_0x2d5b('0xd'),_0x2d5b('0xe'),_0x2d5b('0xf'),_0x2d5b('0x10'),_0x2d5b('0x3'),_0x2d5b('0x11'),_0x2d5b('0x12'),_0x2d5b('0x13'),_0x2d5b('0x4')];function VoiceQueueSummary(_0x5aa39f){this['id']=_0x5aa39f['id'];this[_0x2d5b('0x14')]=_0x5aa39f[_0x2d5b('0x14')];this['strategy']=_0x5aa39f['strategy'];this[_0x2d5b('0x15')]=_0x5aa39f[_0x2d5b('0x15')]||0x0;this[_0x2d5b('0x6')]=_0x5aa39f[_0x2d5b('0x6')]||0x0;this[_0x2d5b('0x5')]=_0x5aa39f[_0x2d5b('0x5')]||0x0;this['busy']=_0x5aa39f[_0x2d5b('0x16')]||0x0;this['inUse']=_0x5aa39f[_0x2d5b('0x7')]||0x0;this[_0x2d5b('0x17')]=_0x5aa39f['invalid']||0x0;this[_0x2d5b('0x0')]=_0x5aa39f[_0x2d5b('0x0')]||0x0;this['loggedInDb']=_0x5aa39f[_0x2d5b('0x1')]||0x0;this[_0x2d5b('0x18')]=_0x5aa39f['onHold']||0x0;this[_0x2d5b('0x19')]=_0x5aa39f[_0x2d5b('0x19')]||0x0;this[_0x2d5b('0xf')]=_0x5aa39f[_0x2d5b('0xf')]||0x0;this[_0x2d5b('0x2')]=_0x5aa39f[_0x2d5b('0x2')]||0x0;this[_0x2d5b('0x1a')]=_0x5aa39f['ringInUse'];this[_0x2d5b('0x11')]=_0x5aa39f[_0x2d5b('0x11')];this[_0x2d5b('0x12')]=_0x5aa39f[_0x2d5b('0x12')];this['sumHoldTime']=_0x5aa39f[_0x2d5b('0x1b')]||0x0;this['talking']=_0x5aa39f[_0x2d5b('0x3')]||0x0;this[_0x2d5b('0x13')]=_0x5aa39f[_0x2d5b('0x13')]||0x0;this[_0x2d5b('0x1c')]=_0x5aa39f[_0x2d5b('0x1c')];this['unavailable']=_0x5aa39f[_0x2d5b('0x1d')]||0x0;this[_0x2d5b('0x1e')]=_0x5aa39f['unknown']||0x0;this['unmanaged']=_0x5aa39f[_0x2d5b('0x1f')]||0x0;this[_0x2d5b('0x4')]=_0x5aa39f['waiting']||0x0;if(_0x5aa39f['type']===_0x2d5b('0x20')){this[_0x2d5b('0x10')]=_0x5aa39f[_0x2d5b('0x10')]||0x0;this[_0x2d5b('0x21')]=_0x5aa39f[_0x2d5b('0x21')];this[_0x2d5b('0x22')]=_0x5aa39f[_0x2d5b('0x22')];this[_0x2d5b('0x23')]=_0x5aa39f['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5aa39f[_0x2d5b('0x24')];this[_0x2d5b('0x25')]=_0x5aa39f[_0x2d5b('0x25')];this[_0x2d5b('0x26')]=_0x5aa39f[_0x2d5b('0x26')];this['temp']=_0x5aa39f[_0x2d5b('0x27')];this[_0x2d5b('0x28')]=_0x5aa39f[_0x2d5b('0x28')];this[_0x2d5b('0x29')]=_0x5aa39f['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x5aa39f[_0x2d5b('0x9')];this[_0x2d5b('0x2a')]=_0x5aa39f[_0x2d5b('0x2a')];this[_0x2d5b('0xa')]=_0x5aa39f[_0x2d5b('0xa')];this[_0x2d5b('0x2b')]=_0x5aa39f[_0x2d5b('0x2b')];this[_0x2d5b('0x2c')]=_0x5aa39f['outboundDropCallsDayCallersExit'];this[_0x2d5b('0x2d')]=_0x5aa39f['outboundDropCallsDayTimeout'];this[_0x2d5b('0x2e')]=_0x5aa39f[_0x2d5b('0x2e')];this['outboundNoSuchCallsDay']=_0x5aa39f[_0x2d5b('0xb')];this[_0x2d5b('0x2f')]=_0x5aa39f[_0x2d5b('0x2f')];this[_0x2d5b('0xc')]=_0x5aa39f[_0x2d5b('0xc')];this[_0x2d5b('0xd')]=_0x5aa39f['outboundRejectCallsDay'];this[_0x2d5b('0xe')]=_0x5aa39f['outboundUnknownCallsDay'];this['predictiveIntervalAnsweredCalls']=_0x5aa39f['predictiveIntervalAnsweredCalls'];this[_0x2d5b('0x30')]=_0x5aa39f[_0x2d5b('0x30')];this[_0x2d5b('0x31')]=_0x5aa39f[_0x2d5b('0x31')];this[_0x2d5b('0x32')]=_0x5aa39f[_0x2d5b('0x32')];this[_0x2d5b('0x33')]=_0x5aa39f['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x5aa39f[_0x2d5b('0x34')];this[_0x2d5b('0x35')]=_0x5aa39f[_0x2d5b('0x35')];this['predictiveIntervalHitRate']=_0x5aa39f[_0x2d5b('0x36')];this[_0x2d5b('0x37')]=_0x5aa39f['predictiveIntervalMultiplicativeFactor'];this[_0x2d5b('0x38')]=_0x5aa39f[_0x2d5b('0x38')];this[_0x2d5b('0x39')]=_0x5aa39f[_0x2d5b('0x39')];this['predictiveIntervalTotalCalls']=_0x5aa39f['predictiveIntervalTotalCalls'];this[_0x2d5b('0x3a')]=_0x5aa39f['originated'];this[_0x2d5b('0x3b')]=_0x5aa39f[_0x2d5b('0x3b')];this[_0x2d5b('0x3c')]=_0x5aa39f[_0x2d5b('0x3c')];this[_0x2d5b('0x3d')]=_0x5aa39f[_0x2d5b('0x3d')];this[_0x2d5b('0x3e')]=_0x5aa39f[_0x2d5b('0x3e')];this[_0x2d5b('0x3f')]=_0x5aa39f['startPredictive'];this[_0x2d5b('0x40')]=_0x5aa39f['startProgressive'];this[_0x2d5b('0x41')]=_0x5aa39f[_0x2d5b('0x41')];this[_0x2d5b('0x42')]=_0x5aa39f[_0x2d5b('0x42')];}if(_0x5aa39f[_0x2d5b('0x43')]){this[_0x2d5b('0x43')]={'id':_0x5aa39f[_0x2d5b('0x43')]['id'],'name':_0x5aa39f[_0x2d5b('0x43')][_0x2d5b('0x14')],'active':_0x5aa39f[_0x2d5b('0x43')]['active'],'callerid':_0x5aa39f[_0x2d5b('0x43')][_0x2d5b('0x44')]};}}VoiceQueueSummary['prototype'][_0x2d5b('0x45')]=function(_0x28302e,_0x484824,_0x2134fd,_0x307b12){this[_0x2d5b('0x1')]=0x0;this[_0x2d5b('0x3')]=0x0;this[_0x2d5b('0xf')]=0x0;this[_0x2d5b('0x1e')]=0x0;this[_0x2d5b('0x19')]=0x0;this[_0x2d5b('0x7')]=0x0;this['busy']=0x0;this[_0x2d5b('0x17')]=0x0;this[_0x2d5b('0x1d')]=0x0;this['ringing']=0x0;this[_0x2d5b('0x1a')]=0x0;this[_0x2d5b('0x18')]=0x0;if(_0x2134fd){if(_0x2134fd[_0x2d5b('0x5')]){this['available']=Number(_0x2134fd[_0x2d5b('0x5')]);}if(_0x2134fd[_0x2d5b('0x46')]){this[_0x2d5b('0x0')]=Number(_0x2134fd[_0x2d5b('0x46')]);}if(_0x2134fd['callers']){this[_0x2d5b('0x4')]=Number(_0x2134fd['callers']);}}for(var _0x498454=0x0;_0x498454<_0x28302e[_0x2d5b('0x47')];_0x498454++){var _0x11b1df=_0x484824[_0x2d5b('0x48')+_0x28302e[_0x498454]['name']];if(_0x11b1df&&_0x11b1df[_0x2d5b('0x49')]){this['loggedInDb']+=0x1;}if(_0x28302e[_0x498454][_0x2d5b('0x4a')]==='1'){this['talking']+=0x1;}if(_0x28302e[_0x498454][_0x2d5b('0xf')]==='1'&&!['2','7','8'][_0x2d5b('0x4b')](_0x28302e[_0x498454][_0x2d5b('0x4c')])){this[_0x2d5b('0xf')]+=0x1;}switch(_0x28302e[_0x498454][_0x2d5b('0x4c')]){case'0':this[_0x2d5b('0x1e')]+=0x1;break;case'1':this[_0x2d5b('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x2d5b('0x16')]+=0x1;break;case'4':this[_0x2d5b('0x17')]+=0x1;break;case'5':this[_0x2d5b('0x1d')]+=0x1;break;case'6':this[_0x2d5b('0x2')]+=0x1;break;case'7':this[_0x2d5b('0x1a')]+=0x1;break;case'8':this[_0x2d5b('0x18')]+=0x1;break;}}if(this[_0x2d5b('0x22')]===_0x2d5b('0x4d')){var _0xdb4be8=Object['keys'](_0x307b12);for(var _0x40ee6b=0x0;_0x40ee6b<_0xdb4be8[_0x2d5b('0x47')];_0x40ee6b++){var _0x2effd2=_0xdb4be8[_0x40ee6b];var _0x387cb3=_0x307b12[_0x2effd2];if(_0x387cb3['queue']===this[_0x2d5b('0x14')]&&_0x387cb3[_0x2d5b('0x1c')]==='dialer'&&_0x387cb3['exten']===_0x2d5b('0x4e')){this[_0x2d5b('0x3')]+=0x1;}}if(this[_0x2d5b('0x3')]>this[_0x2d5b('0x7')]){this['talking']=this[_0x2d5b('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x2d5b('0x4f')]=function(_0xa0f034){var _0x10ee2c=![];if(_0xa0f034){_0x10ee2c=INBOUND_COUNTERS[_0x2d5b('0x50')](function(_0x5b6dd2){return this[_0x5b6dd2]!==_0xa0f034[_0x5b6dd2];},this);}return _0x10ee2c;};VoiceQueueSummary[_0x2d5b('0x51')][_0x2d5b('0x52')]=function(_0x112e64){var _0x5283a8=![];var _0x45bd9d=![];var _0x4ec9a0=![];if(_0x112e64){_0x5283a8=this[_0x2d5b('0x22')]!==_0x112e64[_0x2d5b('0x22')]||this[_0x2d5b('0x21')]!==_0x112e64['dialActive']||this[_0x2d5b('0x41')]!==_0x112e64[_0x2d5b('0x41')]||this[_0x2d5b('0x42')]!==_0x112e64['statusMessage'];_0x45bd9d=OUTBOUND_COUNTERS[_0x2d5b('0x50')](function(_0x1cb62d){return this[_0x1cb62d]!==_0x112e64[_0x1cb62d];},this);if(this['Trunk']&&_0x112e64[_0x2d5b('0x43')]){_0x4ec9a0=this[_0x2d5b('0x43')][_0x2d5b('0x14')]!==_0x112e64[_0x2d5b('0x43')][_0x2d5b('0x14')]||this[_0x2d5b('0x43')][_0x2d5b('0x53')]!==_0x112e64['Trunk'][_0x2d5b('0x53')];}}return _0x5283a8||_0x45bd9d||_0x4ec9a0;};VoiceQueueSummary[_0x2d5b('0x51')][_0x2d5b('0x54')]=function(_0x6fdb27){this[_0x2d5b('0x6')]=_0x6fdb27[_0x2d5b('0x6')];this['message']=_0x6fdb27[_0x2d5b('0x41')];this[_0x2d5b('0x42')]=_0x6fdb27[_0x2d5b('0x42')];this[_0x2d5b('0x3a')]=_0x6fdb27[_0x2d5b('0x3a')];this[_0x2d5b('0x8')]=_0x6fdb27[_0x2d5b('0x8')];this[_0x2d5b('0x29')]=_0x6fdb27[_0x2d5b('0x29')];this[_0x2d5b('0x9')]=_0x6fdb27[_0x2d5b('0x9')];this[_0x2d5b('0x2a')]=_0x6fdb27[_0x2d5b('0x2a')];this[_0x2d5b('0xa')]=_0x6fdb27[_0x2d5b('0xa')];this['outboundNoAnswerCallsDay']=_0x6fdb27[_0x2d5b('0x2e')];this[_0x2d5b('0xb')]=_0x6fdb27[_0x2d5b('0xb')];this[_0x2d5b('0xc')]=_0x6fdb27['outboundReCallsDay'];this[_0x2d5b('0xd')]=_0x6fdb27['outboundRejectCallsDay'];this[_0x2d5b('0xe')]=_0x6fdb27[_0x2d5b('0xe')];this[_0x2d5b('0x11')]=_0x6fdb27[_0x2d5b('0x11')];this[_0x2d5b('0x12')]=_0x6fdb27['sumDuration'];this[_0x2d5b('0x13')]=_0x6fdb27[_0x2d5b('0x13')];if(this[_0x2d5b('0x22')]===_0x2d5b('0x55')){this[_0x2d5b('0x10')]=_0x6fdb27[_0x2d5b('0x10')];}};module[_0x2d5b('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index da42823..6d22ef2 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 _0x699e=['remoteUri','serverUrl','Configurations','name','accessKey'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x699e,0x175));var _0xe699=function(_0x3f1b09,_0x21f46e){_0x3f1b09=_0x3f1b09-0x0;var _0x31af6b=_0x699e[_0x3f1b09];return _0x31af6b;};'use strict';function VtigerAccount(_0x428198){this['id']=_0x428198['id']||0x0;this[_0xe699('0x0')]=_0x428198[_0xe699('0x0')]||'';this['username']=_0x428198['username']||'';this[_0xe699('0x1')]=_0x428198[_0xe699('0x1')]||'';this[_0xe699('0x2')]=_0x428198['remoteUri']||'';this[_0xe699('0x3')]=_0x428198[_0xe699('0x3')]||'';this[_0xe699('0x4')]=_0x428198[_0xe699('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x2bbb=['accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x55a81f,_0x275eec){var _0x52373c=function(_0x427fef){while(--_0x427fef){_0x55a81f['push'](_0x55a81f['shift']());}};_0x52373c(++_0x275eec);}(_0x2bbb,0x1d9));var _0xb2bb=function(_0x4d6436,_0x5e07a7){_0x4d6436=_0x4d6436-0x0;var _0x5aee7a=_0x2bbb[_0x4d6436];return _0x5aee7a;};'use strict';function VtigerAccount(_0x47d4fe){this['id']=_0x47d4fe['id']||0x0;this[_0xb2bb('0x0')]=_0x47d4fe[_0xb2bb('0x0')]||'';this['username']=_0x47d4fe['username']||'';this[_0xb2bb('0x1')]=_0x47d4fe[_0xb2bb('0x1')]||'';this[_0xb2bb('0x2')]=_0x47d4fe[_0xb2bb('0x2')]||'';this[_0xb2bb('0x3')]=_0x47d4fe[_0xb2bb('0x3')]||'';this['Configurations']=_0x47d4fe[_0xb2bb('0x4')]||{};}module[_0xb2bb('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 02b83a6..b969fee 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 _0xb3f9=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x5dc6fd,_0x57ed76){var _0x14c4a6=function(_0x355fce){while(--_0x355fce){_0x5dc6fd['push'](_0x5dc6fd['shift']());}};_0x14c4a6(++_0x57ed76);}(_0xb3f9,0x150));var _0x9b3f=function(_0x36607a,_0x32a87e){_0x36607a=_0x36607a-0x0;var _0x23e254=_0xb3f9[_0x36607a];return _0x23e254;};'use strict';function ZendeskAccount(_0x5f0a3a){this['id']=_0x5f0a3a['id']||0x0;this[_0x9b3f('0x0')]=_0x5f0a3a[_0x9b3f('0x0')]||'';this[_0x9b3f('0x1')]=_0x5f0a3a[_0x9b3f('0x1')]||'';this[_0x9b3f('0x2')]=_0x5f0a3a[_0x9b3f('0x2')]||'';this[_0x9b3f('0x3')]=_0x5f0a3a['token']||'';this['remoteUri']=_0x5f0a3a[_0x9b3f('0x4')]||'';this[_0x9b3f('0x5')]=_0x5f0a3a[_0x9b3f('0x5')]||'';this[_0x9b3f('0x6')]=_0x5f0a3a[_0x9b3f('0x6')]||_0x9b3f('0x7');this[_0x9b3f('0x8')]=_0x5f0a3a[_0x9b3f('0x8')]||'';this[_0x9b3f('0x9')]=_0x5f0a3a[_0x9b3f('0x9')]||{};}module[_0x9b3f('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xa94b=['integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri','authType','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa94b,0x7b));var _0xba94=function(_0x59cdb1,_0x2755f1){_0x59cdb1=_0x59cdb1-0x0;var _0x52cae2=_0xa94b[_0x59cdb1];return _0x52cae2;};'use strict';function ZendeskAccount(_0x55f706){this['id']=_0x55f706['id']||0x0;this[_0xba94('0x0')]=_0x55f706[_0xba94('0x0')]||'';this[_0xba94('0x1')]=_0x55f706['username']||'';this[_0xba94('0x2')]=_0x55f706[_0xba94('0x2')]||'';this[_0xba94('0x3')]=_0x55f706[_0xba94('0x3')]||'';this[_0xba94('0x4')]=_0x55f706[_0xba94('0x4')]||'';this[_0xba94('0x5')]=_0x55f706[_0xba94('0x5')]||'';this[_0xba94('0x6')]=_0x55f706['type']||_0xba94('0x7');this[_0xba94('0x8')]=_0x55f706['serverUrl']||'';this['Configurations']=_0x55f706[_0xba94('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 3127277..bc2bec8 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 _0x7878=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7878,0x171));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x11b7c2){this['id']=_0x11b7c2['id']||0x0;this[_0x8787('0x0')]=_0x11b7c2[_0x8787('0x0')]||'';this[_0x8787('0x1')]=_0x11b7c2[_0x8787('0x1')]||'';this[_0x8787('0x2')]=_0x11b7c2[_0x8787('0x2')]||'';this[_0x8787('0x3')]=_0x11b7c2['zone']||'';this[_0x8787('0x4')]=_0x11b7c2[_0x8787('0x4')]||'';this[_0x8787('0x5')]=_0x11b7c2[_0x8787('0x5')]||'';this[_0x8787('0x6')]=_0x11b7c2[_0x8787('0x6')]||'';this[_0x8787('0x7')]=_0x11b7c2['code']||'';this[_0x8787('0x8')]=_0x11b7c2['refreshToken']||'';this[_0x8787('0x9')]=_0x11b7c2[_0x8787('0x9')]||{};}module[_0x8787('0xa')]=ZohoAccount; \ No newline at end of file +var _0x03cd=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03cd,0xcc));var _0xd03c=function(_0x16cfce,_0x5ae571){_0x16cfce=_0x16cfce-0x0;var _0x3e3050=_0x03cd[_0x16cfce];return _0x3e3050;};'use strict';function ZohoAccount(_0x41e1e5){this['id']=_0x41e1e5['id']||0x0;this['name']=_0x41e1e5[_0xd03c('0x0')]||'';this[_0xd03c('0x1')]=_0x41e1e5[_0xd03c('0x1')]||'';this[_0xd03c('0x2')]=_0x41e1e5[_0xd03c('0x2')]||'';this['zone']=_0x41e1e5['zone']||'';this['clientId']=_0x41e1e5[_0xd03c('0x3')]||'';this[_0xd03c('0x4')]=_0x41e1e5[_0xd03c('0x4')]||'';this['serverUrl']=_0x41e1e5[_0xd03c('0x5')]||'';this[_0xd03c('0x6')]=_0x41e1e5[_0xd03c('0x6')]||'';this[_0xd03c('0x7')]=_0x41e1e5['refreshToken']||'';this[_0xd03c('0x8')]=_0x41e1e5[_0xd03c('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ba8c65d..9deabd4 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 _0xadb5=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','lodash','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','membername','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x4be7a0,_0x1d15e1){var _0x6afe1b=function(_0x231346){while(--_0x231346){_0x4be7a0['push'](_0x4be7a0['shift']());}};_0x6afe1b(++_0x1d15e1);}(_0xadb5,0xad));var _0x5adb=function(_0x5e1996,_0x422a76){_0x5e1996=_0x5e1996-0x0;var _0x2758d3=_0xadb5[_0x5e1996];return _0x2758d3;};'use strict';var util=require('util');var _=require(_0x5adb('0x0'));var moment=require('moment');function checkNameSurname(_0x3d6340,_0x38f67f,_0x3129c3){var _0x4aecec='';if(!_[_0x5adb('0x1')](_0x38f67f)&&_0x5adb('0x2')===typeof _0x38f67f){_0x4aecec+=_0x38f67f;}if(!_[_0x5adb('0x1')](_0x3129c3)&&'string'===typeof _0x3129c3){_0x4aecec+='\x20'+_0x3129c3;}if(_0x4aecec!==''){return _0x4aecec;}return _0x3d6340;}function Action(_0x35a5d3,_0x168d89,_0x3e2555,_0x3213e8,_0xdf3776){this[_0x5adb('0x3')]=_0x3e2555||undefined;this[_0x5adb('0x4')]=_0x35a5d3['id'];this[_0x5adb('0x5')]=_0x168d89[_0x5adb('0x6')];this[_0x5adb('0x7')]=_0x168d89[_0x5adb('0x7')];this[_0x5adb('0x8')]=_0x5adb('0x5');this[_0x5adb('0x9')]=![];this['membername']=_['isNil'](_0x35a5d3[_0x5adb('0xa')])?undefined:_0x35a5d3[_0x5adb('0xa')][_0x5adb('0x6')];this['channelAgent']=this[_0x5adb('0xb')]?util['format'](_0x5adb('0xc'),this['membername']):_0x3213e8||undefined;this[_0x5adb('0xd')]=checkNameSurname(_0x35a5d3[_0x5adb('0xe')][_0x5adb('0xf')],_0x35a5d3['Contact'][_0x5adb('0x10')],_0x35a5d3[_0x5adb('0xe')][_0x5adb('0x11')]);this['active']=_0x35a5d3[_0x5adb('0x12')]||![];this['calleridnum']=_0x35a5d3[_0x5adb('0xf')];this[_0x5adb('0x13')]=_0x35a5d3[_0x5adb('0x13')];this[_0x5adb('0x14')]=_0x35a5d3[_0x5adb('0x14')]||0x0;this[_0x5adb('0x15')]=_0x35a5d3[_0x5adb('0x15')]||0x0;this[_0x5adb('0x16')]=_0x35a5d3[_0x5adb('0x16')]||0x0;this['countglobal']=(_0x35a5d3[_0x5adb('0x14')]||0x0)+(_0x35a5d3['countcongestionretry']||0x0)+(_0x35a5d3[_0x5adb('0x16')]||0x0)+(_0x35a5d3['countnosuchnumberretry']||0x0)+(_0x35a5d3[_0x5adb('0x17')]||0x0)+(_0x35a5d3['countabandonedretry']||0x0)+(_0x35a5d3['countmachineretry']||0x0)+(_0x35a5d3[_0x5adb('0x18')]||0x0);this[_0x5adb('0x19')]=_0x35a5d3[_0x5adb('0x19')]||0x0;this[_0x5adb('0x17')]=_0x35a5d3[_0x5adb('0x17')]||0x0;this['countabandonedretry']=_0x35a5d3[_0x5adb('0x1a')]||0x0;this['countmachineretry']=_0x35a5d3['countmachineretry']||0x0;this[_0x5adb('0x18')]=_0x35a5d3[_0x5adb('0x18')]||0x0;this[_0x5adb('0x1b')]=_0x35a5d3[_0x5adb('0x1b')];this[_0x5adb('0x1c')]=_0x35a5d3[_0x5adb('0x1c')];this[_0x5adb('0x1d')]=_0x35a5d3['callbackat'];this[_0x5adb('0x1e')]=_0x35a5d3[_0x5adb('0x1e')];this[_0x5adb('0x1f')]=_0x35a5d3[_0x5adb('0x1f')];this[_0x5adb('0x20')]=_0x35a5d3['ListId'];this[_0x5adb('0x21')]=_[_0x5adb('0x1')](_0x35a5d3['Agent'])?_0x35a5d3[_0x5adb('0x21')]:_0x35a5d3[_0x5adb('0xa')]['id'];this[_0x5adb('0x22')]=_0x35a5d3['VoiceQueueId'];this[_0x5adb('0x23')]='';this[_0x5adb('0x24')]='';}Action[_0x5adb('0x25')][_0x5adb('0x26')]=function(){return util[_0x5adb('0x27')](_0x5adb('0x28'),this['calleridname'],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x32f4=['isNil','uniqueid','queue','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','calleridname','exports','util','lodash','moment','string'];(function(_0x205a5b,_0x572d3e){var _0x5163f7=function(_0x494c2d){while(--_0x494c2d){_0x205a5b['push'](_0x205a5b['shift']());}};_0x5163f7(++_0x572d3e);}(_0x32f4,0x154));var _0x432f=function(_0x9a9f46,_0x1d1e25){_0x9a9f46=_0x9a9f46-0x0;var _0x5dc8be=_0x32f4[_0x9a9f46];return _0x5dc8be;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));function checkNameSurname(_0x2b22ad,_0x5ee65a,_0x2a4628){var _0x6f0e8a='';if(!_['isNil'](_0x5ee65a)&&_0x432f('0x3')===typeof _0x5ee65a){_0x6f0e8a+=_0x5ee65a;}if(!_[_0x432f('0x4')](_0x2a4628)&&_0x432f('0x3')===typeof _0x2a4628){_0x6f0e8a+='\x20'+_0x2a4628;}if(_0x6f0e8a!==''){return _0x6f0e8a;}return _0x2b22ad;}function Action(_0x355b02,_0x2f5f03,_0x5d8cc0,_0x5b5f08,_0x2f66fd){this[_0x432f('0x5')]=_0x5d8cc0||undefined;this['idContact']=_0x355b02['id'];this[_0x432f('0x6')]=_0x2f5f03['name'];this[_0x432f('0x7')]=_0x2f5f03[_0x432f('0x7')];this[_0x432f('0x8')]=_0x432f('0x6');this[_0x432f('0x9')]=![];this['membername']=_[_0x432f('0x4')](_0x355b02['Agent'])?undefined:_0x355b02[_0x432f('0xa')]['name'];this[_0x432f('0xb')]=this[_0x432f('0xc')]?util['format'](_0x432f('0xd'),this[_0x432f('0xc')]):_0x5b5f08||undefined;this['calleridname']=checkNameSurname(_0x355b02[_0x432f('0xe')][_0x432f('0xf')],_0x355b02['Contact']['firstName'],_0x355b02[_0x432f('0xe')][_0x432f('0x10')]);this[_0x432f('0x11')]=_0x355b02[_0x432f('0x11')]||![];this[_0x432f('0x12')]=_0x355b02['phone'];this[_0x432f('0x13')]=_0x355b02[_0x432f('0x13')];this[_0x432f('0x14')]=_0x355b02[_0x432f('0x14')]||0x0;this['countcongestionretry']=_0x355b02[_0x432f('0x15')]||0x0;this[_0x432f('0x16')]=_0x355b02[_0x432f('0x16')]||0x0;this[_0x432f('0x17')]=(_0x355b02[_0x432f('0x14')]||0x0)+(_0x355b02[_0x432f('0x15')]||0x0)+(_0x355b02['countnoanswerretry']||0x0)+(_0x355b02[_0x432f('0x18')]||0x0)+(_0x355b02['countdropretry']||0x0)+(_0x355b02[_0x432f('0x19')]||0x0)+(_0x355b02[_0x432f('0x1a')]||0x0)+(_0x355b02[_0x432f('0x1b')]||0x0);this[_0x432f('0x18')]=_0x355b02[_0x432f('0x18')]||0x0;this[_0x432f('0x1c')]=_0x355b02[_0x432f('0x1c')]||0x0;this[_0x432f('0x19')]=_0x355b02[_0x432f('0x19')]||0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this[_0x432f('0x1b')]=_0x355b02['countagentrejectretry']||0x0;this['callback']=_0x355b02[_0x432f('0x1d')];this['callbackuniqueid']=_0x355b02[_0x432f('0x1e')];this['callbackat']=_0x355b02[_0x432f('0x1f')];this[_0x432f('0x20')]=_0x355b02[_0x432f('0x20')];this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')];this[_0x432f('0x22')]=_0x355b02['ListId'];this[_0x432f('0x23')]=_[_0x432f('0x4')](_0x355b02['Agent'])?_0x355b02[_0x432f('0x23')]:_0x355b02[_0x432f('0xa')]['id'];this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')];this[_0x432f('0x25')]='';this[_0x432f('0x26')]='';}Action[_0x432f('0x27')]['getCaller']=function(){return util[_0x432f('0x28')]('\x22%s\x22\x20<%s>',this[_0x432f('0x29')],this['number']);};module[_0x432f('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 82132f8..94d3cab 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 _0x22ef=['dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','verifyAdditionalPhones','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','isNil','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','pick','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','lodash','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','stringify','format','name','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','message','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','logger','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','type','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','originated:\x20','originated','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[action]','size','getContactRecallMe','agentReadyId','then','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0x22ef,0x9c));var _0xf22e=function(_0x5829d2,_0x1545ab){_0x5829d2=_0x5829d2-0x0;var _0x425665=_0x22ef[_0x5829d2];return _0x425665;};'use strict';var util=require('util');var _=require(_0xf22e('0x0'));var uuid=require('uuid');var moment=require(_0xf22e('0x1'));var Redis=require(_0xf22e('0x2'));var config=require(_0xf22e('0x3'));var logger=require(_0xf22e('0x4'))(_0xf22e('0x5'));var loggerAction=require(_0xf22e('0x4'))(_0xf22e('0x6'));var ami=require('../ami');var rpcDb=require(_0xf22e('0x7'));var cmHopperAdditionalPhone=require(_0xf22e('0x8'));var Action=require(_0xf22e('0x9'));var ut=require(_0xf22e('0xa'));var utils=require(_0xf22e('0xb'));config[_0xf22e('0xc')]=_[_0xf22e('0xd')](config[_0xf22e('0xc')],{'host':_0xf22e('0xe'),'port':0x18eb});var io=require(_0xf22e('0xf'))(new Redis(config[_0xf22e('0xc')]));var Sequence=function(){};Sequence[_0xf22e('0x10')][_0xf22e('0x11')]=function(_0x8fe372){this[_0xf22e('0x12')]=this[_0xf22e('0x12')]?this[_0xf22e('0x12')][_0xf22e('0x13')](_0x8fe372):_0x8fe372();};function Preview(_0x5ce88f){this[_0xf22e('0x14')]=new Sequence();this[_0xf22e('0x15')]=_0x5ce88f['voiceQueues'];this[_0xf22e('0x16')]=_0x5ce88f['trunks'];this[_0xf22e('0x17')]={};this[_0xf22e('0x18')]=_0x5ce88f[_0xf22e('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0xf22e('0x19'),this[_0xf22e('0x1a')]['bind'](this));ami['on'](_0xf22e('0x1b'),this[_0xf22e('0x1c')][_0xf22e('0x1d')](this));ami['on'](_0xf22e('0x1e'),this[_0xf22e('0x1f')][_0xf22e('0x1d')](this));ami['on'](_0xf22e('0x20'),this[_0xf22e('0x21')][_0xf22e('0x1d')](this));ami['on'](_0xf22e('0x22'),this['syncNewExten']['bind'](this));ami['on'](_0xf22e('0x23'),this[_0xf22e('0x24')][_0xf22e('0x1d')](this));ami['on'](_0xf22e('0x25'),this[_0xf22e('0x26')]['bind'](this));ami['on'](_0xf22e('0x27'),this['syncBlindTransfer'][_0xf22e('0x1d')](this));this[_0xf22e('0x28')](this['campaignsPreview']);}function emit(_0x404954,_0x132349,_0x40c267){io['to'](_0x404954)['emit'](_0x132349,_0x40c267);}function emitVoiceQueueChannelRemove(_0x4e7ef1){logger[_0xf22e('0x29')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xf22e('0x2a')](_0x4e7ef1));emit(util[_0xf22e('0x2b')]('voice:queue:%s',_0x4e7ef1[_0xf22e('0x2c')]),_0xf22e('0x2d'),_0x4e7ef1);io[_0xf22e('0x2e')](_0xf22e('0x2f'),_0x4e7ef1);}function notSendMessagesQueue(_0x478bf3){if(_0x478bf3[_0xf22e('0x30')]){if(_0x478bf3['originated']===0x0&&_0x478bf3[_0xf22e('0x31')]===0x0){_0x478bf3[_0xf22e('0x30')]=![];_0x478bf3['available']=0x0;_0x478bf3[_0xf22e('0x32')]=0x0;_0x478bf3[_0xf22e('0x33')]=utils['CAMPAIGN_STATUS'][_0xf22e('0x34')];ut['logger'](_0xf22e('0x35'),_0x478bf3[_0xf22e('0x2c')]+_0xf22e('0x36'));}else{_0x478bf3[_0xf22e('0x33')]=utils[_0xf22e('0x37')][_0xf22e('0x38')];ut[_0xf22e('0x39')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x478bf3[_0xf22e('0x2c')]+_0xf22e('0x3a'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x4b33aa=this;setInterval(function(){_0x4b33aa[_0xf22e('0x3b')]();},0x7cf);};Preview[_0xf22e('0x10')]['syncCampaigns']=function(){var _0x4d051e=this[_0xf22e('0x15')];this[_0xf22e('0x3c')]+=0x1;for(var _0x229e2f in _0x4d051e){if(_0x4d051e[_0xf22e('0x3d')](_0x229e2f)&&(_0x4d051e[_0x229e2f][_0xf22e('0x3e')]===_0xf22e('0x5')||_0x4d051e[_0x229e2f][_0xf22e('0x3e')]===_0xf22e('0x3f'))&&_0x4d051e[_0x229e2f]['type']===_0xf22e('0x40')){if(this[_0xf22e('0x3c')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xf22e('0x41')]();}}if(_0x4d051e[_0xf22e('0x3d')](_0x229e2f)&&_0x4d051e[_0x229e2f][_0xf22e('0x3e')]===_0xf22e('0x5')&&_0x4d051e[_0x229e2f][_0xf22e('0x42')]===_0xf22e('0x40')){if(_0x4d051e[_0x229e2f][_0xf22e('0x43')]){this['setMessage'](_0x4d051e[_0x229e2f]);if(_0x4d051e[_0x229e2f][_0xf22e('0x44')])this[_0xf22e('0x45')](_0x4d051e[_0x229e2f]);}else{notSendMessagesQueue(_0x4d051e[_0x229e2f]);}}}};Preview['prototype'][_0xf22e('0x46')]=function(_0x200d81){var _0x4fa354=this;this[_0xf22e('0x14')][_0xf22e('0x11')](function(){if(!_['isNil'](_0x4fa354['actions'][_0x200d81])){loggerAction[_0xf22e('0x29')](_0xf22e('0x47'),_0x200d81,_0xf22e('0x48'),_0x4fa354[_0xf22e('0x17')][_0x200d81]['queue'],_0xf22e('0x49'),JSON[_0xf22e('0x2a')](_0x4fa354['campaignsPreview'][_0x4fa354['actions'][_0x200d81]['queue']][_0xf22e('0x4a')]),_0xf22e('0x4b'),JSON[_0xf22e('0x2a')](_0x4fa354[_0xf22e('0x15')][_0x4fa354[_0xf22e('0x17')][_0x200d81]['queue']]['pTalking']),JSON[_0xf22e('0x2a')](_0x4fa354[_0xf22e('0x17')][_0x200d81][_0xf22e('0x4c')]),JSON['stringify'](_['pick'](_0x4fa354['actions'][_0x200d81],['contactId',_0xf22e('0x4d'),_0xf22e('0x4e'),_0xf22e('0x4f')])));return ami[_0xf22e('0x50')]({'action':_0xf22e('0x51'),'channel':_0x4fa354[_0xf22e('0x17')][_0x200d81][_0xf22e('0x52')]})[_0xf22e('0x53')](function(_0x2c1b99){if(_0x2c1b99['message']===_0xf22e('0x54')){setTimeout(function(){if(_0x4fa354[_0xf22e('0x17')][_0x200d81]){ut[_0xf22e('0x55')](_0x4fa354[_0xf22e('0x15')][_0x4fa354[_0xf22e('0x17')][_0x200d81][_0xf22e('0x56')]],_0xf22e('0x57'));if(_0x4fa354[_0xf22e('0x17')][_0x200d81][_0xf22e('0x4c')]===!![]){ut['decrementTalkink'](_0x4fa354[_0xf22e('0x15')][_0x4fa354[_0xf22e('0x17')][_0x200d81][_0xf22e('0x56')]],_0xf22e('0x57'));ut['loggerError'](_0xf22e('0x58')+_0x200d81,_0x4fa354['actions'][_0x200d81][_0xf22e('0x56')]);}ut[_0xf22e('0x59')]('[Dialer][checkChannel][Preview]'+_0x200d81,_0x4fa354[_0xf22e('0x17')][_0x200d81]['queue']);delete _0x4fa354[_0xf22e('0x17')][_0x200d81];}},0x2328);}});}});};Preview['prototype'][_0xf22e('0x41')]=function(){var _0x5a8a8c=this;loggerAction['info'](_0xf22e('0x5a'),_[_0xf22e('0x5b')](this[_0xf22e('0x17')]));for(var _0x23c927 in this[_0xf22e('0x17')]){if(_0x5a8a8c['actions'][_0xf22e('0x3d')](_0x23c927)){_0x5a8a8c['clearZombieChannel'](_0x23c927);}}};Preview[_0xf22e('0x10')]['recallMe']=function(_0x59e6da){var _0x182d67=this;rpcDb[_0xf22e('0x5c')](_0x59e6da['id'],ut[_0xf22e('0x5d')](this['agents']))[_0xf22e('0x5e')](function(_0x2cf246){if(!_['isNil'](_0x2cf246)){for(var _0x44360b=0x0;_0x44360b<_0x2cf246['length'];_0x44360b+=0x1){if(ut['getDiff'](_0x2cf246[_0x44360b][_0xf22e('0x5f')])<_0x59e6da['dialRecallMeTimeout']*0x3c){if(_0x2cf246[_0x44360b]['Agent']&&!_0x2cf246[_0x44360b][_0xf22e('0x60')][_0xf22e('0x61')]){_0x182d67[_0xf22e('0x62')](_0x2cf246[_0x44360b]['id'])['then'](ut[_0xf22e('0x63')](_0xf22e('0x64')))[_0xf22e('0x53')](ut[_0xf22e('0x63')](_0xf22e('0x64')));}else{rpcDb['disableContact'](_0x2cf246[_0x44360b]['id']);}}else{var _0x21ad7e=new Action(_0x2cf246[_0x44360b],_0x59e6da);_0x21ad7e[_0xf22e('0x65')]=moment()['format'](_0xf22e('0x66'));_0x59e6da[_0xf22e('0x67')]+=0x1;ut[_0xf22e('0x68')](_0x21ad7e,0x17,_0xf22e('0x69'));if(_0x59e6da[_0xf22e('0x6a')]){rpcDb[_0xf22e('0x6b')](ut['createBody'](_0x2cf246[_0x44360b]));rpcDb[_0xf22e('0x6c')](_0x21ad7e,_0xf22e('0x6d'));}else{ut[_0xf22e('0x68')](_0x21ad7e,0x16,_0xf22e('0x6e'));rpcDb[_0xf22e('0x6c')](_0x21ad7e,_0xf22e('0x6f'));rpcDb[_0xf22e('0x70')](_0x21ad7e,_0xf22e('0x6f'));}}}}})[_0xf22e('0x53')](ut[_0xf22e('0x63')]('[getContactRecallMe]'));};Preview[_0xf22e('0x10')][_0xf22e('0x71')]=function(_0x4b2240){_0x4b2240[_0xf22e('0x30')]=!![];if(ut['IsNotLoggedIn'](_0x4b2240['loggedIn'])){_0x4b2240[_0xf22e('0x33')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut[_0xf22e('0x72')](_0x4b2240[_0xf22e('0x43')])){_0x4b2240[_0xf22e('0x33')]=utils[_0xf22e('0x37')]['INACTIVE'];}else if(!this[_0xf22e('0x73')](_0x4b2240['Trunk'])){if(!this[_0xf22e('0x73')](_0x4b2240['TrunkBackup'])){_0x4b2240[_0xf22e('0x33')]=utils['CAMPAIGN_STATUS'][_0xf22e('0x74')];}else{_0x4b2240[_0xf22e('0x33')]=utils['CAMPAIGN_STATUS'][_0xf22e('0x75')];}}else{_0x4b2240[_0xf22e('0x33')]=utils[_0xf22e('0x37')][_0xf22e('0x75')];}};Preview['prototype'][_0xf22e('0x76')]=function(_0x1a5adf,_0x4a7d74,_0x4e604b){var _0x4a2eea=this;var _0x4cf553=this['actions'][_0x4a7d74];var _0x50a910=this['campaignsPreview'][_0x4cf553[_0xf22e('0x56')]];var _0x1e2793;var _0x2737e2=![];var _0x3fe4fa=0x2;var _0x844efe=0x3;if(_0x50a910){switch(_0x4e604b){case'1':_0x50a910['outboundNoSuchCallsDay']+=0x1;_0x4cf553[_0xf22e('0x77')]+=0x1;_0x4cf553['countglobal']=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x0,_0xf22e('0x79'));ami[_0xf22e('0x2e')](_0xf22e('0x7a'),ut['buildObj'](_0x4cf553,_0xf22e('0x7b')));rpcDb['createCustomerHistory'](_0x4cf553,_0xf22e('0x7c'));_0x4a2eea['verifyAdditionalPhones'](_0x4cf553,'0',_0x50a910)[_0xf22e('0x5e')](function(_0x5998de){_0x2737e2=_0x5998de[_0xf22e('0x7d')]==0x1;_0x3fe4fa=_0x50a910[_0xf22e('0x7e')];_0x844efe=_0x50a910[_0xf22e('0x7f')];if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910[_0xf22e('0x80')]){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0x83'));}else{if(_0x4cf553[_0xf22e('0x77')]>=_0x50a910[_0xf22e('0x84')]){rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0x83'));}else{rpcDb[_0xf22e('0x85')](ut['scheduledAt'](_0x4cf553,'countnosuchnumberretry',_0x50a910[_0xf22e('0x7e')]),_0x4cf553[_0xf22e('0x86')],_0x4cf553[_0xf22e('0x87')]);}}delete this[_0xf22e('0x17')][_0x1a5adf[_0xf22e('0x88')]];}else{_0x4cf553['countnosuchnumberretry']++;logger[_0xf22e('0x29')](_0xf22e('0x89'),_0x4cf553[_0xf22e('0x77')]);logger[_0xf22e('0x29')]('id',_0x4cf553[_0xf22e('0x8a')]);_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countnosuchnumberretry':_0x4cf553['countnosuchnumberretry']}})[_0xf22e('0x5e')](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});break;case _0xf22e('0x8d'):var _0x6ed3b4=moment()['format'](_0xf22e('0x66'));_0x4cf553[_0xf22e('0x8e')]=_0x6ed3b4;_0x4cf553[_0xf22e('0x8f')]=_0x6ed3b4;_0x4cf553[_0xf22e('0x4c')]=!![];_0x50a910['pTalking']+=0x1;logger[_0xf22e('0x29')](_0xf22e('0x90'),_0x4cf553['uniqueid'],_0xf22e('0x91'),_0x50a910[_0xf22e('0x2c')],_0xf22e('0x4b'),_0x50a910['pTalking']);ami['emit'](_0xf22e('0x92'),ut['buildObj'](_0x4cf553,_0xf22e('0x93'),this['campaignsPreview'][_0x4cf553['queue']]));if(_0x50a910[_0xf22e('0x94')]){ami[_0xf22e('0x2e')](_0xf22e('0x95'),ut[_0xf22e('0x96')](_0x4cf553));}break;case'16':ami[_0xf22e('0x2e')](_0xf22e('0x97'),ut[_0xf22e('0x98')](_0x4cf553,_0xf22e('0x99'),this['campaignsPreview'][_0x4cf553['queue']]));emitVoiceQueueChannelRemove(ut[_0xf22e('0x98')](_0x4cf553,_0xf22e('0x99')));_0x50a910[_0xf22e('0x9a')]+=0x1;_0x50a910[_0xf22e('0x9b')]+=0x1;_0x50a910[_0xf22e('0x9c')]+=0x1;ut[_0xf22e('0x9d')](_0x50a910,_0xf22e('0x9e'));_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x4,'Answer');rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xa0'));rpcDb[_0xf22e('0x70')](_0x4cf553,_0xf22e('0xa1'));rpcDb[_0xf22e('0xa2')](_0x4cf553);_0x50a910['sumDuration']+=_0x4cf553[_0xf22e('0xa3')];_0x50a910[_0xf22e('0xa4')]+=_0x4cf553[_0xf22e('0xa3')];logger[_0xf22e('0x29')]('[syncHangup][talking][decrement]',_0x4cf553[_0xf22e('0xa5')],_0xf22e('0x91'),_0x50a910['name'],_0xf22e('0x4b'),_0x50a910[_0xf22e('0x31')]);delete this[_0xf22e('0x17')][_0x1a5adf[_0xf22e('0x88')]];break;case _0xf22e('0xa6'):_0x50a910[_0xf22e('0xa7')]+=0x1;_0x4cf553[_0xf22e('0xa8')]+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut['logCustomer'](_0x4cf553,0x5,_0xf22e('0xa9'));_0x3fe4fa=_0x50a910[_0xf22e('0xaa')];_0x844efe=_0x50a910['callAdditionalPhoneAfterMin'];ami[_0xf22e('0x2e')](_0xf22e('0xab'),ut['buildObj'](_0x4cf553,_0xf22e('0xac')));rpcDb['createCustomerHistory'](_0x4cf553,_0xf22e('0xad'));_0x4a2eea['verifyAdditionalPhones'](_0x4cf553,'5',_0x50a910)[_0xf22e('0x5e')](function(_0xe78980){_0x2737e2=_0xe78980['additional']==0x1;if(!_0x2737e2){if(ut['totalGlobal'](_0x4cf553)>=_0x50a910[_0xf22e('0x80')]){_0x1e2793=ut['cloneAction'](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0xae'));}else{if(_0x4cf553[_0xf22e('0xa8')]>=_0x50a910[_0xf22e('0xaf')]){rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0xad'));}else{rpcDb[_0xf22e('0x85')](ut['scheduledAt'](_0x4cf553,_0xf22e('0xa8'),_0x50a910[_0xf22e('0xaa')]),_0x4cf553['unlockAgent'],_0x4cf553[_0xf22e('0x87')]);}}}else{_0x4cf553[_0xf22e('0xa8')]++;_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countbusyretry':_0x4cf553[_0xf22e('0xa8')]}})[_0xf22e('0x5e')](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});break;case _0xf22e('0xb0'):_0x50a910[_0xf22e('0xb1')]+=0x1;_0x4cf553[_0xf22e('0xb2')]+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x3,_0xf22e('0xb3'));_0x3fe4fa=_0x50a910[_0xf22e('0xb4')];_0x844efe=_0x50a910[_0xf22e('0x7f')];var _0x313815=ut['buildNoAnswerEventPayload'](_0x4cf553,_0x50a910);ami[_0xf22e('0x2e')]('custom:agentnoanswer',_0x313815);rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xb5'));_0x4a2eea['verifyAdditionalPhones'](_0x4cf553,'3',_0x50a910)[_0xf22e('0x5e')](function(_0xd19a80){_0x2737e2=_0xd19a80[_0xf22e('0x7d')]==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910[_0xf22e('0x80')]){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0xb6'));}else{if(_0x4cf553[_0xf22e('0xb2')]>=_0x50a910[_0xf22e('0xb7')]){rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0xb5'));}else{rpcDb[_0xf22e('0x85')](ut[_0xf22e('0xb8')](_0x4cf553,_0xf22e('0xb2'),_0x50a910['dialNoAnswerRetryFrequency']),_0x4cf553['unlockAgent'],_0x4cf553['activeContact']);}}}else{_0x4cf553['countnoanswerretry']++;_0x4a2eea['incrementPreviewCounters']({'id':_0x4cf553['idContact'],'field':{'countnoanswerretry':_0x4cf553['countnoanswerretry']}})['then'](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});break;case _0xf22e('0xb9'):_0x50a910[_0xf22e('0xba')]+=0x1;_0x4cf553[_0xf22e('0xbb')]+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x8,_0xf22e('0xbc'));_0x3fe4fa=_0x50a910['dialCongestionRetryFrequency'];_0x844efe=_0x50a910[_0xf22e('0x7f')];ami[_0xf22e('0x2e')]('custom:agentcongestion',ut[_0xf22e('0x98')](_0x4cf553,_0xf22e('0xbd')));rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xbe'));_0x4a2eea[_0xf22e('0xbf')](_0x4cf553,'8',_0x50a910)[_0xf22e('0x5e')](function(_0x137707){_0x2737e2=_0x137707['additional']==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910['dialGlobalMaxRetry']){_0x1e2793=ut['cloneAction'](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb['createCustomerFinal'](_0x1e2793,_0xf22e('0xc0'));}else{if(_0x4cf553['countcongestionretry']>=_0x50a910[_0xf22e('0xc1')]){rpcDb[_0xf22e('0x70')](_0x4cf553,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0xf22e('0xb8')](_0x4cf553,_0xf22e('0xbb'),_0x50a910[_0xf22e('0xaa')]),_0x4cf553['unlockAgent'],_0x4cf553[_0xf22e('0x87')]);}}}else{_0x4cf553[_0xf22e('0xbb')]++;_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countcongestionretry':_0x4cf553['countcongestionretry']}})[_0xf22e('0x5e')](function(){_0x4a2eea['swapAdditionalPhones'](_0x4cf553,_0x3fe4fa,_0x844efe)['then'](function(){});});}});break;case _0xf22e('0xc2'):_0x50a910[_0xf22e('0xc3')]+=0x1;_0x4cf553['countagentrejectretry']+=0x1;_0x4cf553['countglobal']=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x14,_0xf22e('0xc4'));_0x3fe4fa=_0x50a910[_0xf22e('0xc5')];_0x844efe=_0x50a910['callAdditionalPhoneAfterMin'];ami[_0xf22e('0x2e')](_0xf22e('0xc6'),ut['buildObj'](_0x4cf553,_0xf22e('0xc7')));rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xc8'));_0x4a2eea[_0xf22e('0xbf')](_0x4cf553,'20',_0x50a910)['then'](function(_0x52e410){_0x2737e2=_0x52e410['additional']==0x1;if(!_0x2737e2){if(ut['totalGlobal'](_0x4cf553)>=_0x50a910[_0xf22e('0x80')]){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0x14,_0xf22e('0xc4'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0xc9'));}else{if(_0x4cf553[_0xf22e('0xca')]>=_0x50a910[_0xf22e('0xcb')]){rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0xf22e('0xb8')](_0x4cf553,'countagentrejectretry',_0x50a910[_0xf22e('0xc5')]),_0x4cf553[_0xf22e('0x86')],_0x4cf553[_0xf22e('0x87')]);}}}else{_0x4cf553[_0xf22e('0xb2')]++;_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countnoanswerretry':_0x4cf553[_0xf22e('0xb2')]}})[_0xf22e('0x5e')](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});break;case _0xf22e('0xcc'):_0x50a910['outboundAbandonedCallsDay']+=0x1;_0x4cf553[_0xf22e('0xcd')]+=0x1;_0x4cf553['countglobal']=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0xb,_0xf22e('0xce'));rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xcf'));_0x4a2eea[_0xf22e('0xbf')](_0x4cf553,'11',_0x50a910)[_0xf22e('0x5e')](function(_0x4a6f33){_0x2737e2=_0x4a6f33[_0xf22e('0x7d')]==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910['dialGlobalMaxRetry']){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0xf,'Global');rpcDb[_0xf22e('0x70')](_0x1e2793,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4cf553[_0xf22e('0xd0')]>=_0x50a910[_0xf22e('0xd1')]){rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0xcf'));}else{rpcDb[_0xf22e('0x85')](ut[_0xf22e('0xb8')](_0x4cf553,_0xf22e('0xcd'),_0x50a910[_0xf22e('0xd2')]),_0x4cf553[_0xf22e('0x86')],_0x4cf553['activeContact']);}}}else{_0x4cf553[_0xf22e('0xb2')]++;_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countnoanswerretry':_0x4cf553[_0xf22e('0xb2')]}})['then'](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});break;case'18':_0x50a910['outboundUnknownCallsDay']+=0x1;_0x4cf553[_0xf22e('0xd3')]+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x12,_0x1a5adf[_0xf22e('0xd4')]||_0x1a5adf[_0xf22e('0xd5')]);ami['emit']('custom:amd',ut[_0xf22e('0x98')](_0x4cf553,_0xf22e('0xd6')));rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xd7'));_0x4a2eea['verifyAdditionalPhones'](_0x4cf553,'18',_0x50a910)[_0xf22e('0x5e')](function(_0xc2b92){_0x2737e2=_0xc2b92[_0xf22e('0x7d')]==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910[_0xf22e('0x80')]){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0x12,_0xf22e('0x82'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0xd7'));}else{rpcDb['createCustomerFinal'](_0x4cf553,_0xf22e('0xd7'));}}else{_0x4cf553[_0xf22e('0xb2')]++;_0x4a2eea[_0xf22e('0x8b')]({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countnoanswerretry':_0x4cf553[_0xf22e('0xb2')]}})[_0xf22e('0x5e')](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)['then'](function(){});});}});delete this[_0xf22e('0x17')][_0x1a5adf['linkedid']];break;case'19':_0x50a910['outboundUnknownCallsDay']+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut['totalGlobal'](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0x13,_0x1a5adf[_0xf22e('0xd4')]||_0x1a5adf[_0xf22e('0xd5')]);ami[_0xf22e('0x2e')](_0xf22e('0xd8'),ut[_0xf22e('0x98')](_0x4cf553,_0xf22e('0xd6')));rpcDb[_0xf22e('0x6c')](_0x4cf553,_0xf22e('0xd9'));_0x4a2eea[_0xf22e('0xbf')](_0x4cf553,'18',_0x50a910)[_0xf22e('0x5e')](function(_0x257bf6){_0x2737e2=_0x257bf6['additional']==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910['dialGlobalMaxRetry']){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb[_0xf22e('0x70')](_0x1e2793,_0xf22e('0xd9'));}else{rpcDb[_0xf22e('0x70')](_0x4cf553,_0xf22e('0xd9'));}}else{_0x4cf553[_0xf22e('0xb2')]++;_0x4a2eea['incrementPreviewCounters']({'id':_0x4cf553[_0xf22e('0x8a')],'field':{'countnoanswerretry':_0x4cf553[_0xf22e('0xb2')]}})['then'](function(){_0x4a2eea[_0xf22e('0x8c')](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});});}});delete this[_0xf22e('0x17')][_0x1a5adf[_0xf22e('0x88')]];break;default:if(_0x4cf553[_0xf22e('0x4c')]){ut['decrementTalkink'](_0x50a910,'[default]');ut[_0xf22e('0x59')](_0xf22e('0xda')+_0x50a910[_0xf22e('0x2c')],_0x1a5adf);}_0x50a910[_0xf22e('0xdb')]+=0x1;_0x4cf553[_0xf22e('0x9f')]=ut[_0xf22e('0x78')](_0x4cf553);ut[_0xf22e('0x68')](_0x4cf553,0xc,_0x1a5adf[_0xf22e('0xd4')]||_0x1a5adf[_0xf22e('0xd5')]);_0x3fe4fa=_0x50a910[_0xf22e('0xc5')];_0x844efe=_0x50a910['callAdditionalPhoneAfterMin'];rpcDb[_0xf22e('0x6c')](_0x4cf553,'[callProgressDetectingCustomer][logUnknown]');_0x4a2eea['verifyAdditionalPhones'](_0x4cf553,'20',_0x50a910)[_0xf22e('0x5e')](function(_0x545987){_0x2737e2=_0x545987['additional']==0x1;if(!_0x2737e2){if(ut[_0xf22e('0x78')](_0x4cf553)>=_0x50a910['dialGlobalMaxRetry']){_0x1e2793=ut[_0xf22e('0x81')](_0x4cf553,0xf,_0xf22e('0x82'));rpcDb['createCustomerFinal'](_0x1e2793,_0xf22e('0xdc'));}else{rpcDb[_0xf22e('0x70')](_0x4cf553,_0xf22e('0xdc'));}delete this[_0xf22e('0x17')][_0x1a5adf[_0xf22e('0x88')]];}else{_0x4a2eea['swapAdditionalPhones'](_0x4cf553,_0x3fe4fa,_0x844efe)[_0xf22e('0x5e')](function(){});}});}if(!(_0x4cf553[_0xf22e('0x4c')]&&_0x4e604b==='16')){ut[_0xf22e('0x55')](_0x50a910,_0xf22e('0xdd'));logger[_0xf22e('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0x4cf553[_0xf22e('0xa5')],'\x20Queue',_0x50a910[_0xf22e('0x2c')],_0xf22e('0x49'),_0x50a910[_0xf22e('0x4a')]);}if(_0x4e604b!=='ANSWER'){delete this[_0xf22e('0x17')][_0x1a5adf['linkedid']];delete this[_0xf22e('0x17')][_0x1a5adf['destlinkedid']];}_0x50a910[_0xf22e('0xde')]=!![];}};Preview[_0xf22e('0x10')]['callProgressDetectingAgent']=function(_0x2610f7,_0x5d07dd,_0x3d37d0){if(_[_0xf22e('0xdf')](_0x5d07dd)&&_0xf22e('0xe0')!==typeof _0x5d07dd){return;}if(_[_0xf22e('0xdf')](_0x3d37d0)&&'object'!==typeof _0x3d37d0){return;}switch(_0x3d37d0[_0xf22e('0xe1')]){case'0':ut[_0xf22e('0xe2')](_0x2610f7,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x2610f7,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xf22e('0xe2')](_0x2610f7,0x3,'NoAnswer');rpcDb[_0xf22e('0xe3')](_0x2610f7,_0xf22e('0xe4'));break;case'5':ut[_0xf22e('0xe2')](_0x2610f7,0x5,'Busy');rpcDb[_0xf22e('0xe3')](_0x2610f7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xf22e('0xe2')](_0x2610f7,0x8,_0xf22e('0xbc'));rpcDb[_0xf22e('0xe3')](_0x2610f7,_0xf22e('0xe5'));break;case'22':ut[_0xf22e('0xe2')](_0x2610f7,0x16,_0xf22e('0xe6'));rpcDb[_0xf22e('0xe3')](_0x2610f7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x2610f7,0xc,_0x3d37d0[_0xf22e('0xe1')]);rpcDb[_0xf22e('0xe3')](_0x2610f7,_0xf22e('0xe5'));}ut[_0xf22e('0x55')](_0x5d07dd,_0xf22e('0xe7'));logger[_0xf22e('0x29')](_0xf22e('0xe8'),_0x2610f7[_0xf22e('0xa5')],'\x20Queue',_0x5d07dd[_0xf22e('0x2c')],_0xf22e('0x49'),_0x5d07dd['originated']);delete this['actions'][_0x2610f7['uniqueid']];};Preview['prototype'][_0xf22e('0xbf')]=function(_0x57372c,_0x421f34,_0x578f29){return cmHopperAdditionalPhone[_0xf22e('0xbf')](_0x57372c,_0x421f34,_0x578f29)[_0xf22e('0x53')](logger[_0xf22e('0x29')](_0xf22e('0xe9')));};Preview[_0xf22e('0x10')]['swapAdditionalPhones']=function(_0x393c12,_0x46b3a4,_0x464803){return cmHopperAdditionalPhone[_0xf22e('0x8c')](_0x393c12,_0x46b3a4,_0x464803)[_0xf22e('0x53')](logger[_0xf22e('0x29')](_0xf22e('0xea')));};Preview[_0xf22e('0x10')][_0xf22e('0x8b')]=function(_0x1346f4){return Promise[_0xf22e('0xeb')]()[_0xf22e('0x5e')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x1346f4))[_0xf22e('0x53')](logger[_0xf22e('0x29')](_0xf22e('0xec')));};Preview[_0xf22e('0x10')][_0xf22e('0xed')]=function(_0x138e78,_0x1bcf01,_0x45dd46,_0x3270e9,_0x48cdcd){var _0x3fb204=this;return new Promise(function(_0x1f6e44,_0x2aae18){if(_[_0xf22e('0xee')](_0x1bcf01)||_[_0xf22e('0xee')](_0x1bcf01['Contact'])||_[_0xf22e('0xee')](_0x1bcf01[_0xf22e('0xef')])||_[_0xf22e('0xee')](_0x1bcf01[_0xf22e('0x4e')])){_0x2aae18(ut['message'](_0xf22e('0xf0'),_0x3270e9,_0x48cdcd));return;}var _0x424f3b=uuid['v4']();var _0x2c7c2e=_0x3fb204[_0xf22e('0x15')][_0x1bcf01[_0xf22e('0x48')][_0xf22e('0x2c')]];var _0x115ae1=_0x45dd46?_0x3fb204[_0xf22e('0x18')][_0x45dd46]['id']:undefined;_0x3fb204[_0xf22e('0x17')][_0x424f3b]=new Action(_0x1bcf01,_0x2c7c2e,_0x424f3b,_0x45dd46,_0x115ae1);var _0x5af163=_0x3fb204[_0xf22e('0x17')][_0x424f3b];_0x5af163[_0xf22e('0x86')]=_0x3270e9;_0x5af163[_0xf22e('0x87')]=_0x48cdcd;_0x5af163[_0xf22e('0xf1')]=_0x45dd46;if(_[_0xf22e('0xf2')](_0x138e78)){_0x3fb204[_0xf22e('0xf3')](_0x5af163,_0x2c7c2e,_0x1bcf01,_0x45dd46)[_0xf22e('0x5e')](function(_0x390f35){logger[_0xf22e('0x29')](_0xf22e('0xf4'),_0xf22e('0xf5')+_0x5af163['queue']+_0xf22e('0xf6')+_0x5af163[_0xf22e('0x8a')],JSON[_0xf22e('0x2a')](_0x390f35));ami[_0xf22e('0x2e')](_0xf22e('0xf7'),ut[_0xf22e('0x98')](_0x5af163,_0xf22e('0xf8'),_0x3fb204[_0xf22e('0x15')][_0x5af163[_0xf22e('0x56')]]));_0x1f6e44(ut[_0xf22e('0x33')](_0xf22e('0xf9')));})['catch'](function(_0x309b58){ut[_0xf22e('0x39')]('[Preview][execCall][failure]',_0x309b58);_0x2aae18(ut[_0xf22e('0x33')](_0xf22e('0xfa'),_0x3270e9,_0x48cdcd));});}else{_0x2c7c2e[_0xf22e('0xfb')]+=0x1;ut[_0xf22e('0xfc')](_0x5af163);rpcDb[_0xf22e('0xfd')](_0x5af163,_0xf22e('0xfe'));delete _0x3fb204[_0xf22e('0x17')][_0x424f3b];_0x2aae18(ut['message'](_0xf22e('0xff'),_0x3270e9,_0x48cdcd));}});};Preview['prototype']['isTrunkReachable']=function(_0x3d8547){return!_[_0xf22e('0xee')](_0x3d8547)&&!_[_0xf22e('0xee')](_0x3d8547['name'])&&!_[_0xf22e('0xee')](_0x3d8547[_0xf22e('0x100')])&&_0x3d8547[_0xf22e('0x100')]&&!_[_0xf22e('0xee')](this[_0xf22e('0x16')][util[_0xf22e('0x2b')](_0xf22e('0x101'),_0x3d8547[_0xf22e('0x2c')])])&&!_['isNil'](this[_0xf22e('0x16')][util['format']('SIP/%s',_0x3d8547[_0xf22e('0x2c')])]['status'])&&(this[_0xf22e('0x16')][util[_0xf22e('0x2b')](_0xf22e('0x101'),_0x3d8547['name'])][_0xf22e('0x51')]===_0xf22e('0x102')||this[_0xf22e('0x16')][util['format'](_0xf22e('0x101'),_0x3d8547[_0xf22e('0x2c')])][_0xf22e('0x51')]==='unmonitored');};Preview['prototype']['run']=function(_0x5280ae,_0x33b3f4){return this[_0xf22e('0x103')](_0x5280ae,_0x33b3f4)['then'](function(_0x1fd520){return _[_0xf22e('0x104')](_0x1fd520,[_0xf22e('0x33')]);})[_0xf22e('0x53')](function(_0x48a693){if(_0x48a693[_0xf22e('0x105')]){rpcDb['unlockContact'](_0x5280ae);}if(_0x48a693[_0xf22e('0x100')]){rpcDb[_0xf22e('0x106')](_0x5280ae);}throw _['pick'](_0x48a693,[_0xf22e('0x33')]);});};Preview[_0xf22e('0x10')][_0xf22e('0x103')]=function(_0x1093f0,_0x5b927f){var _0x53234c=this;var _0x488029,_0x3466df;return rpcDb[_0xf22e('0x107')](_0x1093f0)[_0xf22e('0x5e')](function(_0x22f673){if(!_[_0xf22e('0xee')](_0x22f673[0x0])){_0x3466df=_0x22f673[0x0][_0xf22e('0x108')]?![]:!![];_0x488029=_0x22f673[0x0][_0xf22e('0x108')]?!![]:![];_0x488029=_0x5b927f?!![]:_0x488029;}var _0x1e8384=_0x53234c[_0xf22e('0x109')](_0x22f673);if(_0x1e8384[_0xf22e('0x10a')]){rpcDb[_0xf22e('0x10b')](_['pick'](_0x22f673[0x0],['VoiceQueueId',_0xf22e('0xef')]))['then'](function(_0x23a3a8){_0x53234c[_0xf22e('0xed')](_0x23a3a8,_0x22f673[0x0],_0x5b927f,_0x3466df,_0x488029)[_0xf22e('0x5e')](function(_0x33a2f2){return _0x33a2f2;})[_0xf22e('0x53')](function(_0x1ae9b7){throw _0x1ae9b7;});})[_0xf22e('0x53')](function(_0x4699bd){ut[_0xf22e('0x39')](_0xf22e('0x10c'),_0x4699bd);throw ut[_0xf22e('0x33')](_0xf22e('0x10d'),_0x3466df,_0x488029);});}else{throw ut[_0xf22e('0x33')](_0x1e8384['message'],_0x3466df,_0x488029);}})[_0xf22e('0x53')](function(_0x3a8ef4){ut[_0xf22e('0x39')](_0xf22e('0x10e'),_0x3a8ef4);throw ut['message'](_0xf22e('0x10d'),![],!![]);});};Preview[_0xf22e('0x10')][_0xf22e('0x109')]=function(_0x53fd0b){if(_[_0xf22e('0xee')](_0x53fd0b)||_[_0xf22e('0xf2')](_0x53fd0b)||!_[_0xf22e('0xee')](_0x53fd0b[0x0][_0xf22e('0x60')])&&_[_0xf22e('0xee')](_0x53fd0b[0x0][_0xf22e('0x60')][_0xf22e('0x2c')])){ut['logger'](_0xf22e('0x10f'),_0x53fd0b);return{'isValid':![],'message':_0xf22e('0x110')};}var _0x1d4ac8=this['campaignsPreview'][_0x53fd0b[0x0][_0xf22e('0x48')]['name']];_0x1d4ac8['message']=utils[_0xf22e('0x37')][_0xf22e('0x75')];if(_[_0xf22e('0xee')](_0x1d4ac8)){ut['logger'](_0xf22e('0x111'),_0x1d4ac8);return{'isValid':![],'message':_0xf22e('0x112')};}if(!this['isTrunkReachable'](_0x1d4ac8[_0xf22e('0x113')])){ut[_0xf22e('0x39')](_0xf22e('0x114'),_0xf22e('0x115')+_0x1d4ac8[_0xf22e('0x2c')]+_0xf22e('0x116'));if(!this[_0xf22e('0x73')](_0x1d4ac8[_0xf22e('0x117')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x1d4ac8[_0xf22e('0x2c')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xf22e('0x118')};}}if(!ut[_0xf22e('0x72')](_0x1d4ac8[_0xf22e('0x43')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x1d4ac8[_0xf22e('0x2c')]+_0xf22e('0x119'));return{'isValid':![],'message':_0xf22e('0x115')+_0x1d4ac8['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xf22e('0x11a')};};Preview[_0xf22e('0x10')][_0xf22e('0xf3')]=function(_0x21c5cb,_0x24fba2,_0x2e16ab,_0x5f2c30){var _0x510136=this;return new Promise(function(_0x11f0e6,_0x1ad5db){var _0x579ae7=_0x21c5cb[_0xf22e('0xa5')];var _0xde9f67=_0x510136['isTrunkReachable'](_0x24fba2[_0xf22e('0x113')])?util[_0xf22e('0x2b')](_0xf22e('0x11b'),_0x24fba2['Trunk']['name'],_[_0xf22e('0xee')](_0x24fba2[_0xf22e('0x11c')])?'':_0x24fba2[_0xf22e('0x11c')][_0xf22e('0x11d')]()||'',_0x24fba2[_0xf22e('0x11e')]>0x0?_0x2e16ab[_0xf22e('0xef')][_0xf22e('0x11f')](_0x24fba2[_0xf22e('0x11e')]):_0x2e16ab[_0xf22e('0xef')]):util[_0xf22e('0x2b')](_0xf22e('0x11b'),_[_0xf22e('0xee')](_0x24fba2[_0xf22e('0x117')])?_0x24fba2[_0xf22e('0x113')][_0xf22e('0x2c')]:_0x24fba2[_0xf22e('0x117')][_0xf22e('0x2c')],_[_0xf22e('0xee')](_0x24fba2[_0xf22e('0x11c')])?'':_0x24fba2[_0xf22e('0x11c')][_0xf22e('0x11d')]()||'',_0x24fba2[_0xf22e('0x11e')]>0x0?_0x2e16ab['phone'][_0xf22e('0x11f')](_0x24fba2[_0xf22e('0x11e')]):_0x2e16ab[_0xf22e('0xef')]);var _0x195c5d=_0x510136[_0xf22e('0x73')](_0x24fba2['Trunk'])?ut[_0xf22e('0x120')](_0x24fba2[_0xf22e('0x113')]['callerid'],_0x24fba2['dialOriginateCallerIdName'],_0x24fba2[_0xf22e('0x121')]>0x0?ut[_0xf22e('0x122')](_0x24fba2[_0xf22e('0x123')],_0x24fba2[_0xf22e('0x121')]):_0x24fba2[_0xf22e('0x123')]):ut[_0xf22e('0x120')](_[_0xf22e('0xee')](_0x24fba2[_0xf22e('0x117')])?_0x24fba2[_0xf22e('0x113')][_0xf22e('0x124')]:_0x24fba2[_0xf22e('0x117')]['callerid'],_0x24fba2['dialOriginateCallerIdName'],_0x24fba2[_0xf22e('0x121')]>0x0?ut[_0xf22e('0x122')](_0x24fba2['dialOriginateCallerIdNumber'],_0x24fba2[_0xf22e('0x121')]):_0x24fba2['dialOriginateCallerIdNumber']);if(_0x195c5d){_0x21c5cb[_0xf22e('0x125')]=ut[_0xf22e('0x126')](_0x195c5d);_0x21c5cb[_0xf22e('0x127')]=ut[_0xf22e('0x128')](_0x195c5d);}var _0x1d0f94=ut[_0xf22e('0x129')](_0x24fba2,_0x2e16ab,_0xde9f67,_0x195c5d,_0x579ae7,_0x21c5cb);var _0x3e088b=utils['setXMDContactVariables'](_0x2e16ab[_0xf22e('0x12a')]);Object[_0xf22e('0x12b')](_0x1d0f94,_0x3e088b);_[_0xf22e('0x12c')](_0x21c5cb,ut[_0xf22e('0x12d')](_0x1d0f94));_0x21c5cb[_0xf22e('0x65')]=moment()[_0xf22e('0x2b')](_0xf22e('0x66'));_0x24fba2[_0xf22e('0x12e')]=_0x1d0f94;var _0xc30f9b=ut[_0xf22e('0x12f')](_0x21c5cb,_0x24fba2,_0x1d0f94,_0x21c5cb['activeContact'],_0x5f2c30);return ami[_0xf22e('0x50')](_0xc30f9b)['then'](function(_0x295297){_0x24fba2['originated']+=0x1;logger[_0xf22e('0x29')](_0xf22e('0x130'),_0x579ae7,_0xf22e('0x91'),_0x24fba2[_0xf22e('0x2c')],_0xf22e('0x49'),_0x24fba2[_0xf22e('0x4a')]);_0x11f0e6(_0x295297);})['catch'](function(_0x4836b2){ut[_0xf22e('0xe2')](_0x21c5cb,0xe,_0xf22e('0x131'));rpcDb[_0xf22e('0xe3')](_0x21c5cb,_0xf22e('0x132'));_0x1ad5db(_0x4836b2);});});};Preview[_0xf22e('0x10')]['syncNewExten']=function(_0x9340cb){if(this[_0xf22e('0x17')][_0x9340cb[_0xf22e('0x88')]]){this[_0xf22e('0x17')][_0x9340cb[_0xf22e('0x88')]][_0xf22e('0x52')]=_0x9340cb[_0xf22e('0x52')];}};Preview['prototype'][_0xf22e('0x1a')]=function(_0x3d2016){var _0x7e397a=this;var _0x234d82=this[_0xf22e('0x17')][_0x3d2016[_0xf22e('0x133')]];if(_0x234d82){if(_0x234d82[_0xf22e('0xf1')]&&this[_0xf22e('0x18')][_0x234d82[_0xf22e('0xf1')]]){ut['logLookAgent'](_0x234d82,this[_0xf22e('0x18')][_0x234d82[_0xf22e('0xf1')]][_0xf22e('0x2c')],this[_0xf22e('0x18')][_0x234d82[_0xf22e('0xf1')]]['id']);}var _0x435d83=_['clone'](_0x234d82);_0x435d83['responsetime']=moment()[_0xf22e('0x2b')](_0xf22e('0x66'));var _0x5369d9=_0x7e397a[_0xf22e('0x15')][_0x234d82[_0xf22e('0x56')]];if(ut[_0xf22e('0x134')](_0x3d2016[_0xf22e('0x135')])){if(_0x234d82[_0xf22e('0x86')]){rpcDb[_0xf22e('0x136')](_0x234d82[_0xf22e('0x8a')]);}if(_0x234d82[_0xf22e('0x87')]){rpcDb[_0xf22e('0x106')](_0x234d82[_0xf22e('0x8a')]);}ami[_0xf22e('0x2e')](_0xf22e('0x137'),ut['buildObj'](_0x234d82,_0xf22e('0x138'),this[_0xf22e('0x15')][_0x234d82[_0xf22e('0x56')]]));this['callProgressDetectingAgent'](_0x435d83,_0x5369d9,_0x3d2016);}else{_0x234d82[_0xf22e('0x65')]=moment()[_0xf22e('0x2b')](_0xf22e('0x66'));ut[_0xf22e('0xe2')](_0x435d83,0x4,_0xf22e('0x139'));rpcDb[_0xf22e('0xe3')](_0x435d83,_0xf22e('0x13a'));}}};Preview['prototype'][_0xf22e('0x1c')]=function(_0x46029b){var _0x14f06e=this[_0xf22e('0x17')][_0x46029b[_0xf22e('0x88')]];var _0x3dd9a4;if(_0x14f06e){_0x3dd9a4=this[_0xf22e('0x15')][_0x14f06e[_0xf22e('0x56')]];logger[_0xf22e('0x29')](_0xf22e('0x13b'),_0x46029b['linkedid'],_0xf22e('0x91'),_0x3dd9a4[_0xf22e('0x2c')],_0xf22e('0x4b'),_0x3dd9a4[_0xf22e('0x31')]);}if(this[_0xf22e('0x17')][_0x46029b[_0xf22e('0x88')]]&&_0x46029b[_0xf22e('0x88')]!==_0x46029b[_0xf22e('0xa5')]){if(_0x46029b[_0xf22e('0x13c')]==='16'&&this[_0xf22e('0x17')][_0x46029b[_0xf22e('0x88')]]['dialAnswer']){this[_0xf22e('0x76')](_0x46029b,_0x46029b[_0xf22e('0x88')],_0x46029b[_0xf22e('0x13c')]);}else if(this[_0xf22e('0x17')][_0x46029b[_0xf22e('0x88')]]['dialAnswer']){logger[_0xf22e('0x29')](_0xf22e('0x13d'),_0x46029b[_0xf22e('0x88')],_0x46029b[_0xf22e('0x13c')],_0xf22e('0x91'),_0x3dd9a4[_0xf22e('0x2c')],_0xf22e('0x4b'),_0x3dd9a4[_0xf22e('0x31')]);this[_0xf22e('0x76')](_0x46029b,_0x46029b[_0xf22e('0x88')],_0x46029b[_0xf22e('0x13c')]);}}else if(_0x14f06e&&_[_0xf22e('0xee')](_0x14f06e[_0xf22e('0x13e')])&&_0x3dd9a4[_0xf22e('0x13f')]&&_0x46029b[_0xf22e('0x88')]===_0x46029b[_0xf22e('0xa5')]&&_[_0xf22e('0xee')](_0x46029b[_0xf22e('0xe1')])&&_0x46029b['cause']==='16'&&_0x46029b[_0xf22e('0x140')]==='6'&&_[_0xf22e('0xdf')](_0x14f06e[_0xf22e('0x141')])){if(_0x14f06e[_0xf22e('0x86')]){rpcDb['unlockContact'](_0x14f06e[_0xf22e('0x8a')]);}if(_0x14f06e[_0xf22e('0x87')]){rpcDb[_0xf22e('0x106')](_0x14f06e[_0xf22e('0x8a')]);}_0x46029b[_0xf22e('0xe1')]='22';this[_0xf22e('0x142')](_0x14f06e,_0x3dd9a4,_0x46029b);}else if(_0x14f06e&&_0x14f06e[_0xf22e('0x141')]){if(_0x46029b[_0xf22e('0x13c')]==='16'&&this[_0xf22e('0x17')][_0x46029b[_0xf22e('0x88')]][_0xf22e('0x4c')]){logger[_0xf22e('0x29')](_0xf22e('0x143'),_0x46029b[_0xf22e('0x88')],_0x46029b['cause'],_0xf22e('0x91'),_0x3dd9a4[_0xf22e('0x2c')],_0xf22e('0x4b'),_0x3dd9a4[_0xf22e('0x31')]);this[_0xf22e('0x76')](_0x46029b,_0x46029b[_0xf22e('0x88')],_0x46029b['cause']);}else if(this['actions'][_0x46029b[_0xf22e('0x88')]][_0xf22e('0x4c')]){logger[_0xf22e('0x29')](_0xf22e('0x13d'),_0x46029b[_0xf22e('0x88')],_0x46029b['cause'],_0xf22e('0x91'),_0x3dd9a4[_0xf22e('0x2c')],_0xf22e('0x4b'),_0x3dd9a4[_0xf22e('0x31')]);this[_0xf22e('0x76')](_0x46029b,_0x46029b['linkedid'],_0x46029b[_0xf22e('0x13c')]);}}};Preview['prototype'][_0xf22e('0x21')]=function(_0x8b527a){if(this[_0xf22e('0x17')][_0x8b527a[_0xf22e('0x144')]]&&_0x8b527a[_0xf22e('0x144')]!==_0x8b527a[_0xf22e('0x145')]){this[_0xf22e('0x76')](_0x8b527a,_0x8b527a[_0xf22e('0x144')],_0x8b527a[_0xf22e('0xd5')]);}};Preview[_0xf22e('0x10')][_0xf22e('0x1f')]=function(_0x46263b){if(this[_0xf22e('0x17')][_0x46263b['linkedid']]&&_0x46263b[_0xf22e('0x88')]!==_0x46263b[_0xf22e('0xa5')]&&!this['actions'][_0x46263b['linkedid']][_0xf22e('0x4c')]){if(_0x46263b[_0xf22e('0x13c')]==='1'){this['callProgressDetectingCustomer'](_0x46263b,_0x46263b[_0xf22e('0x88')],_0x46263b['cause']);}}};Preview['prototype'][_0xf22e('0x146')]=function(_0x199616,_0xe6db1e,_0x503d8b){if(this[_0xf22e('0x17')][_0x199616]){if(_[_0xf22e('0xee')](this[_0xf22e('0x17')][_0x199616][_0xf22e('0x12e')])){this[_0xf22e('0x17')][_0x199616]['variables']={};}this[_0xf22e('0x17')][_0x199616][_0xf22e('0x12e')][_0xe6db1e]=_0x503d8b;}};Preview[_0xf22e('0x10')][_0xf22e('0x24')]=function(_0x176e8c){try{if(!_['isNil'](_0x176e8c)){if(ut[_0xf22e('0x147')](_[_0xf22e('0x148')](_0x176e8c['variable'])[0x0])){this[_0xf22e('0x146')](_0x176e8c[_0xf22e('0xa5')],_[_0xf22e('0x148')](_0x176e8c[_0xf22e('0x149')])[0x0],_0x176e8c[_0xf22e('0x14a')]);}}}catch(_0x31e92c){logger['error'](_0xf22e('0x14b'),util[_0xf22e('0x14c')](_0x31e92c,{'showHidden':![],'depth':null}));}};Preview[_0xf22e('0x10')][_0xf22e('0x26')]=function(_0x5e446c){if(_0x5e446c){if(this['actions'][_0x5e446c[_0xf22e('0x14d')]]){this[_0xf22e('0x17')][_0x5e446c[_0xf22e('0x14d')]]['transfer']=!![];}}};Preview[_0xf22e('0x10')][_0xf22e('0x14e')]=function(_0x4677cc){if(_0x4677cc){if(this['actions'][_0x4677cc[_0xf22e('0x14f')]]){this[_0xf22e('0x17')][_0x4677cc[_0xf22e('0x14f')]][_0xf22e('0x141')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x2edf=['[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','trunks','SIP/%s','reachable','active','disableContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','unlockContact','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','../../../config/logger','preview','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','pTalking','available','INACTIVE','name','CAMPAIGN_STATUS','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','outbound','dialActive','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','message','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','loggedIn','isTrunkReachable','Trunk','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','answered','[16]','countglobal','totalGlobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','additional','rescheduleContact','activeContact','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]'];(function(_0x236b94,_0x3f997c){var _0x47abeb=function(_0x3b3016){while(--_0x3b3016){_0x236b94['push'](_0x236b94['shift']());}};_0x47abeb(++_0x3f997c);}(_0x2edf,0x94));var _0xf2ed=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x2edf[_0x1a0daa];return _0x1dbe15;};'use strict';var util=require(_0xf2ed('0x0'));var _=require(_0xf2ed('0x1'));var uuid=require(_0xf2ed('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf2ed('0x3'))(_0xf2ed('0x4'));var loggerAction=require(_0xf2ed('0x3'))('actionPreview');var ami=require('../ami');var rpcDb=require(_0xf2ed('0x5'));var cmHopperAdditionalPhone=require(_0xf2ed('0x6'));var Action=require('./action');var ut=require(_0xf2ed('0x7'));var utils=require('../dialer/utils');config['redis']=_[_0xf2ed('0x8')](config['redis'],{'host':_0xf2ed('0x9'),'port':0x18eb});var io=require(_0xf2ed('0xa'))(new Redis(config[_0xf2ed('0xb')]));var Sequence=function(){};Sequence[_0xf2ed('0xc')][_0xf2ed('0xd')]=function(_0x4f2cff){this[_0xf2ed('0xe')]=this[_0xf2ed('0xe')]?this['tail'][_0xf2ed('0xf')](_0x4f2cff):_0x4f2cff();};function Preview(_0x4e376f){this[_0xf2ed('0x10')]=new Sequence();this[_0xf2ed('0x11')]=_0x4e376f[_0xf2ed('0x12')];this['trunks']=_0x4e376f['trunks'];this[_0xf2ed('0x13')]={};this[_0xf2ed('0x14')]=_0x4e376f['agents'];this[_0xf2ed('0x15')]=0x0;ami['on'](_0xf2ed('0x16'),this[_0xf2ed('0x17')]['bind'](this));ami['on'](_0xf2ed('0x18'),this[_0xf2ed('0x19')][_0xf2ed('0x1a')](this));ami['on']('hanguprequest',this[_0xf2ed('0x1b')][_0xf2ed('0x1a')](this));ami['on']('dialend',this['syncDialEnd'][_0xf2ed('0x1a')](this));ami['on'](_0xf2ed('0x1c'),this[_0xf2ed('0x1d')][_0xf2ed('0x1a')](this));ami['on'](_0xf2ed('0x1e'),this[_0xf2ed('0x1f')][_0xf2ed('0x1a')](this));ami['on'](_0xf2ed('0x20'),this[_0xf2ed('0x21')]['bind'](this));ami['on'](_0xf2ed('0x22'),this['syncBlindTransfer'][_0xf2ed('0x1a')](this));this[_0xf2ed('0x23')](this[_0xf2ed('0x11')]);}function emit(_0x1b29fb,_0x2f79a3,_0x482ce4){io['to'](_0x1b29fb)[_0xf2ed('0x24')](_0x2f79a3,_0x482ce4);}function emitVoiceQueueChannelRemove(_0x143fa8){logger[_0xf2ed('0x25')](_0xf2ed('0x26'),JSON[_0xf2ed('0x27')](_0x143fa8));emit(util[_0xf2ed('0x28')](_0xf2ed('0x29'),_0x143fa8['name']),_0xf2ed('0x2a'),_0x143fa8);io[_0xf2ed('0x24')]('voice_queue_presence:remove',_0x143fa8);}function notSendMessagesQueue(_0x247a46){if(_0x247a46['sendMessageOneNotActive']){if(_0x247a46['originated']===0x0&&_0x247a46[_0xf2ed('0x2b')]===0x0){_0x247a46['sendMessageOneNotActive']=![];_0x247a46[_0xf2ed('0x2c')]=0x0;_0x247a46['paused']=0x0;_0x247a46['message']=utils['CAMPAIGN_STATUS'][_0xf2ed('0x2d')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x247a46[_0xf2ed('0x2e')]+'\x20is\x20not\x20active');}else{_0x247a46['message']=utils[_0xf2ed('0x2f')][_0xf2ed('0x30')];ut[_0xf2ed('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x247a46[_0xf2ed('0x2e')]+'\x20is\x20deactivated');}}}Preview[_0xf2ed('0xc')]['loopCampaigns']=function(){var _0x49d9b6=this;setInterval(function(){_0x49d9b6[_0xf2ed('0x32')]();},0x7cf);};Preview[_0xf2ed('0xc')][_0xf2ed('0x32')]=function(){var _0x39ac32=this[_0xf2ed('0x11')];this[_0xf2ed('0x15')]+=0x1;for(var _0x3b2262 in _0x39ac32){if(_0x39ac32[_0xf2ed('0x33')](_0x3b2262)&&(_0x39ac32[_0x3b2262][_0xf2ed('0x34')]==='preview'||_0x39ac32[_0x3b2262][_0xf2ed('0x34')]==='booked')&&_0x39ac32[_0x3b2262]['type']==='outbound'){if(this[_0xf2ed('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xf2ed('0x35')]();}}if(_0x39ac32['hasOwnProperty'](_0x3b2262)&&_0x39ac32[_0x3b2262]['dialMethod']===_0xf2ed('0x4')&&_0x39ac32[_0x3b2262]['type']===_0xf2ed('0x36')){if(_0x39ac32[_0x3b2262][_0xf2ed('0x37')]){this[_0xf2ed('0x38')](_0x39ac32[_0x3b2262]);if(_0x39ac32[_0x3b2262]['dialPreviewAutoRecallMe'])this['recallMe'](_0x39ac32[_0x3b2262]);}else{notSendMessagesQueue(_0x39ac32[_0x3b2262]);}}}};Preview[_0xf2ed('0xc')][_0xf2ed('0x39')]=function(_0x398e25){var _0x1c39b8=this;this[_0xf2ed('0x10')][_0xf2ed('0xd')](function(){if(!_[_0xf2ed('0x3a')](_0x1c39b8['actions'][_0x398e25])){loggerAction['info'](_0xf2ed('0x3b'),_0x398e25,_0xf2ed('0x3c'),_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x3d')],_0xf2ed('0x3e'),JSON[_0xf2ed('0x27')](_0x1c39b8[_0xf2ed('0x11')][_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x3d')]][_0xf2ed('0x3f')]),_0xf2ed('0x40'),JSON['stringify'](_0x1c39b8[_0xf2ed('0x11')][_0x1c39b8['actions'][_0x398e25][_0xf2ed('0x3d')]][_0xf2ed('0x2b')]),JSON[_0xf2ed('0x27')](_0x1c39b8['actions'][_0x398e25][_0xf2ed('0x41')]),JSON['stringify'](_[_0xf2ed('0x42')](_0x1c39b8[_0xf2ed('0x13')][_0x398e25],[_0xf2ed('0x43'),_0xf2ed('0x44'),_0xf2ed('0x45'),_0xf2ed('0x46')])));return ami[_0xf2ed('0x47')]({'action':_0xf2ed('0x48'),'channel':_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x49')]})[_0xf2ed('0x4a')](function(_0x53a595){if(_0x53a595[_0xf2ed('0x4b')]===_0xf2ed('0x4c')){setTimeout(function(){if(_0x1c39b8['actions'][_0x398e25]){ut['updateOriginated'](_0x1c39b8[_0xf2ed('0x11')][_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x3d')]],_0xf2ed('0x4d'));if(_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x41')]===!![]){ut[_0xf2ed('0x4e')](_0x1c39b8[_0xf2ed('0x11')][_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x3d')]],_0xf2ed('0x4d'));ut[_0xf2ed('0x4f')](_0xf2ed('0x50')+_0x398e25,_0x1c39b8[_0xf2ed('0x13')][_0x398e25]['queue']);}ut['loggerError'](_0xf2ed('0x51')+_0x398e25,_0x1c39b8[_0xf2ed('0x13')][_0x398e25][_0xf2ed('0x3d')]);delete _0x1c39b8[_0xf2ed('0x13')][_0x398e25];}},0x2328);}});}});};Preview[_0xf2ed('0xc')]['clearZombieChannels']=function(){var _0x264ca6=this;loggerAction[_0xf2ed('0x25')](_0xf2ed('0x52'),_[_0xf2ed('0x53')](this['actions']));for(var _0x546399 in this[_0xf2ed('0x13')]){if(_0x264ca6['actions']['hasOwnProperty'](_0x546399)){_0x264ca6['clearZombieChannel'](_0x546399);}}};Preview[_0xf2ed('0xc')][_0xf2ed('0x54')]=function(_0x15e6f4){var _0x37ea45=this;rpcDb[_0xf2ed('0x55')](_0x15e6f4['id'],ut['agentReadyId'](this['agents']))[_0xf2ed('0x56')](function(_0x2994b2){if(!_[_0xf2ed('0x3a')](_0x2994b2)){for(var _0x240a46=0x0;_0x240a46<_0x2994b2[_0xf2ed('0x57')];_0x240a46+=0x1){if(ut[_0xf2ed('0x58')](_0x2994b2[_0x240a46]['scheduledat'])<_0x15e6f4[_0xf2ed('0x59')]*0x3c){if(_0x2994b2[_0x240a46][_0xf2ed('0x5a')]&&!_0x2994b2[_0x240a46]['Agent'][_0xf2ed('0x5b')]){_0x37ea45[_0xf2ed('0x5c')](_0x2994b2[_0x240a46]['id'])[_0xf2ed('0x56')](ut[_0xf2ed('0x5d')](_0xf2ed('0x5e')))[_0xf2ed('0x4a')](ut[_0xf2ed('0x5d')](_0xf2ed('0x5e')));}else{rpcDb['disableContact'](_0x2994b2[_0x240a46]['id']);}}else{var _0x249a85=new Action(_0x2994b2[_0x240a46],_0x15e6f4);_0x249a85[_0xf2ed('0x5f')]=moment()[_0xf2ed('0x28')](_0xf2ed('0x60'));_0x15e6f4['outboundReCallsDay']+=0x1;ut[_0xf2ed('0x61')](_0x249a85,0x17,_0xf2ed('0x62'));if(_0x15e6f4[_0xf2ed('0x63')]){rpcDb[_0xf2ed('0x64')](ut['createBody'](_0x2994b2[_0x240a46]));rpcDb['createCustomerHistory'](_0x249a85,_0xf2ed('0x65'));}else{ut[_0xf2ed('0x61')](_0x249a85,0x16,_0xf2ed('0x66'));rpcDb[_0xf2ed('0x67')](_0x249a85,_0xf2ed('0x68'));rpcDb[_0xf2ed('0x69')](_0x249a85,_0xf2ed('0x68'));}}}}})[_0xf2ed('0x4a')](ut[_0xf2ed('0x5d')](_0xf2ed('0x6a')));};Preview[_0xf2ed('0xc')][_0xf2ed('0x38')]=function(_0x1d654a){_0x1d654a[_0xf2ed('0x6b')]=!![];if(ut[_0xf2ed('0x6c')](_0x1d654a[_0xf2ed('0x6d')])){_0x1d654a[_0xf2ed('0x4b')]=utils['CAMPAIGN_STATUS']['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x1d654a[_0xf2ed('0x37')])){_0x1d654a['message']=utils['CAMPAIGN_STATUS'][_0xf2ed('0x2d')];}else if(!this[_0xf2ed('0x6e')](_0x1d654a[_0xf2ed('0x6f')])){if(!this[_0xf2ed('0x6e')](_0x1d654a['TrunkBackup'])){_0x1d654a[_0xf2ed('0x4b')]=utils[_0xf2ed('0x2f')]['UNREACHABLE_TRUNK'];}else{_0x1d654a[_0xf2ed('0x4b')]=utils['CAMPAIGN_STATUS'][_0xf2ed('0x70')];}}else{_0x1d654a[_0xf2ed('0x4b')]=utils[_0xf2ed('0x2f')][_0xf2ed('0x70')];}};Preview['prototype'][_0xf2ed('0x71')]=function(_0x4707a3,_0x55d705,_0x26e62f){var _0x5515f5=this;var _0xb9f211=this[_0xf2ed('0x13')][_0x55d705];var _0x33bb1b=this[_0xf2ed('0x11')][_0xb9f211[_0xf2ed('0x3d')]];var _0x12b178;var _0x5ef608=![];var _0x308ca5=0x2;var _0x11105c=0x3;if(_0x33bb1b){switch(_0x26e62f){case'1':_0x33bb1b[_0xf2ed('0x72')]+=0x1;_0xb9f211[_0xf2ed('0x73')]+=0x1;_0xb9f211['countglobal']=ut['totalGlobal'](_0xb9f211);ut['logCustomer'](_0xb9f211,0x0,_0xf2ed('0x74'));ami[_0xf2ed('0x24')](_0xf2ed('0x75'),ut[_0xf2ed('0x76')](_0xb9f211,'nosuchnumber'));rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0x77'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'0',_0x33bb1b)[_0xf2ed('0x56')](function(_0x22ae6c){_0x5ef608=_0x22ae6c['additional']==0x1;_0x308ca5=_0x33bb1b[_0xf2ed('0x79')];_0x11105c=_0x33bb1b[_0xf2ed('0x7a')];if(!_0x5ef608){if(ut['totalGlobal'](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,_0xf2ed('0x7d'));rpcDb[_0xf2ed('0x69')](_0x12b178,_0xf2ed('0x7e'));}else{if(_0xb9f211[_0xf2ed('0x73')]>=_0x33bb1b[_0xf2ed('0x7f')]){rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0x7e'));}else{rpcDb['rescheduleContact'](ut[_0xf2ed('0x80')](_0xb9f211,_0xf2ed('0x73'),_0x33bb1b[_0xf2ed('0x79')]),_0xb9f211[_0xf2ed('0x81')],_0xb9f211['activeContact']);}}delete this[_0xf2ed('0x13')][_0x4707a3[_0xf2ed('0x82')]];}else{_0xb9f211[_0xf2ed('0x73')]++;logger[_0xf2ed('0x25')](_0xf2ed('0x83'),_0xb9f211['countnosuchnumberretry']);logger[_0xf2ed('0x25')]('id',_0xb9f211[_0xf2ed('0x84')]);_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211[_0xf2ed('0x84')],'field':{'countnosuchnumberretry':_0xb9f211[_0xf2ed('0x73')]}})[_0xf2ed('0x56')](function(){_0x5515f5['swapAdditionalPhones'](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case'ANSWER':var _0x2d716c=moment()[_0xf2ed('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0xb9f211[_0xf2ed('0x86')]=_0x2d716c;_0xb9f211['answertime']=_0x2d716c;_0xb9f211[_0xf2ed('0x41')]=!![];_0x33bb1b['pTalking']+=0x1;logger[_0xf2ed('0x25')](_0xf2ed('0x87'),_0xb9f211[_0xf2ed('0x88')],_0xf2ed('0x89'),_0x33bb1b['name'],_0xf2ed('0x40'),_0x33bb1b[_0xf2ed('0x2b')]);ami[_0xf2ed('0x24')](_0xf2ed('0x8a'),ut[_0xf2ed('0x76')](_0xb9f211,_0xf2ed('0x8b'),this[_0xf2ed('0x11')][_0xb9f211['queue']]));if(_0x33bb1b['acw']){ami[_0xf2ed('0x24')](_0xf2ed('0x8c'),ut[_0xf2ed('0x8d')](_0xb9f211));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xf2ed('0x76')](_0xb9f211,'complete',this[_0xf2ed('0x11')][_0xb9f211[_0xf2ed('0x3d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xb9f211,_0xf2ed('0x8e')));_0x33bb1b[_0xf2ed('0x8f')]+=0x1;_0x33bb1b['total']+=0x1;_0x33bb1b[_0xf2ed('0x90')]+=0x1;ut[_0xf2ed('0x4e')](_0x33bb1b,_0xf2ed('0x91'));_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut[_0xf2ed('0x61')](_0xb9f211,0x4,'Answer');rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0x94'));rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0x95'));rpcDb[_0xf2ed('0x96')](_0xb9f211);_0x33bb1b['sumDuration']+=_0xb9f211[_0xf2ed('0x97')];_0x33bb1b[_0xf2ed('0x98')]+=_0xb9f211[_0xf2ed('0x97')];logger['info']('[syncHangup][talking][decrement]',_0xb9f211[_0xf2ed('0x88')],_0xf2ed('0x89'),_0x33bb1b[_0xf2ed('0x2e')],_0xf2ed('0x40'),_0x33bb1b[_0xf2ed('0x2b')]);delete this['actions'][_0x4707a3[_0xf2ed('0x82')]];break;case _0xf2ed('0x99'):_0x33bb1b[_0xf2ed('0x9a')]+=0x1;_0xb9f211[_0xf2ed('0x9b')]+=0x1;_0xb9f211['countglobal']=ut['totalGlobal'](_0xb9f211);ut['logCustomer'](_0xb9f211,0x5,_0xf2ed('0x9c'));_0x308ca5=_0x33bb1b[_0xf2ed('0x9d')];_0x11105c=_0x33bb1b[_0xf2ed('0x7a')];ami[_0xf2ed('0x24')](_0xf2ed('0x9e'),ut[_0xf2ed('0x76')](_0xb9f211,'busy'));rpcDb['createCustomerHistory'](_0xb9f211,_0xf2ed('0x9f'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'5',_0x33bb1b)[_0xf2ed('0x56')](function(_0x2a7fd8){_0x5ef608=_0x2a7fd8[_0xf2ed('0xa0')]==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut['cloneAction'](_0xb9f211,0xf,_0xf2ed('0x7d'));rpcDb[_0xf2ed('0x69')](_0x12b178,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0xb9f211[_0xf2ed('0x9b')]>=_0x33bb1b['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0xb9f211,_0xf2ed('0x9f'));}else{rpcDb[_0xf2ed('0xa1')](ut[_0xf2ed('0x80')](_0xb9f211,_0xf2ed('0x9b'),_0x33bb1b['dialBusyRetryFrequency']),_0xb9f211[_0xf2ed('0x81')],_0xb9f211[_0xf2ed('0xa2')]);}}}else{_0xb9f211[_0xf2ed('0x9b')]++;_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211[_0xf2ed('0x84')],'field':{'countbusyretry':_0xb9f211['countbusyretry']}})['then'](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case _0xf2ed('0xa4'):_0x33bb1b[_0xf2ed('0xa5')]+=0x1;_0xb9f211[_0xf2ed('0xa6')]+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut[_0xf2ed('0x61')](_0xb9f211,0x3,_0xf2ed('0xa7'));_0x308ca5=_0x33bb1b[_0xf2ed('0xa8')];_0x11105c=_0x33bb1b['callAdditionalPhoneAfterMin'];var _0x270759=ut[_0xf2ed('0xa9')](_0xb9f211,_0x33bb1b);ami[_0xf2ed('0x24')](_0xf2ed('0xaa'),_0x270759);rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0xab'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'3',_0x33bb1b)[_0xf2ed('0x56')](function(_0x5b48ae){_0x5ef608=_0x5b48ae[_0xf2ed('0xa0')]==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,_0xf2ed('0x7d'));rpcDb['createCustomerFinal'](_0x12b178,_0xf2ed('0xac'));}else{if(_0xb9f211[_0xf2ed('0xa6')]>=_0x33bb1b[_0xf2ed('0xad')]){rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0xab'));}else{rpcDb[_0xf2ed('0xa1')](ut[_0xf2ed('0x80')](_0xb9f211,'countnoanswerretry',_0x33bb1b[_0xf2ed('0xa8')]),_0xb9f211['unlockAgent'],_0xb9f211[_0xf2ed('0xa2')]);}}}else{_0xb9f211[_0xf2ed('0xa6')]++;_0x5515f5['incrementPreviewCounters']({'id':_0xb9f211[_0xf2ed('0x84')],'field':{'countnoanswerretry':_0xb9f211['countnoanswerretry']}})['then'](function(){_0x5515f5['swapAdditionalPhones'](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case _0xf2ed('0xae'):_0x33bb1b[_0xf2ed('0xaf')]+=0x1;_0xb9f211[_0xf2ed('0xb0')]+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut['logCustomer'](_0xb9f211,0x8,_0xf2ed('0xb1'));_0x308ca5=_0x33bb1b[_0xf2ed('0xb2')];_0x11105c=_0x33bb1b[_0xf2ed('0x7a')];ami[_0xf2ed('0x24')]('custom:agentcongestion',ut[_0xf2ed('0x76')](_0xb9f211,'congestion'));rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0xb3'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'8',_0x33bb1b)[_0xf2ed('0x56')](function(_0x599ea5){_0x5ef608=_0x599ea5[_0xf2ed('0xa0')]==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,'Global');rpcDb['createCustomerFinal'](_0x12b178,_0xf2ed('0xb4'));}else{if(_0xb9f211['countcongestionretry']>=_0x33bb1b[_0xf2ed('0xb5')]){rpcDb['createCustomerFinal'](_0xb9f211,_0xf2ed('0xb3'));}else{rpcDb['rescheduleContact'](ut[_0xf2ed('0x80')](_0xb9f211,_0xf2ed('0xb0'),_0x33bb1b[_0xf2ed('0x9d')]),_0xb9f211[_0xf2ed('0x81')],_0xb9f211[_0xf2ed('0xa2')]);}}}else{_0xb9f211[_0xf2ed('0xb0')]++;_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211['idContact'],'field':{'countcongestionretry':_0xb9f211['countcongestionretry']}})['then'](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case _0xf2ed('0xb6'):_0x33bb1b[_0xf2ed('0xb7')]+=0x1;_0xb9f211['countagentrejectretry']+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut[_0xf2ed('0x61')](_0xb9f211,0x14,_0xf2ed('0xb8'));_0x308ca5=_0x33bb1b['dialAgentRejectRetryFrequency'];_0x11105c=_0x33bb1b[_0xf2ed('0x7a')];ami[_0xf2ed('0x24')](_0xf2ed('0xb9'),ut['buildObj'](_0xb9f211,'agentreject'));rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0xba'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'20',_0x33bb1b)[_0xf2ed('0x56')](function(_0x17a633){_0x5ef608=_0x17a633[_0xf2ed('0xa0')]==0x1;if(!_0x5ef608){if(ut['totalGlobal'](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0x14,_0xf2ed('0xb8'));rpcDb[_0xf2ed('0x69')](_0x12b178,_0xf2ed('0xbb'));}else{if(_0xb9f211[_0xf2ed('0xbc')]>=_0x33bb1b[_0xf2ed('0xbd')]){rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0xbb'));}else{rpcDb[_0xf2ed('0xa1')](ut['scheduledAt'](_0xb9f211,_0xf2ed('0xbc'),_0x33bb1b[_0xf2ed('0xbe')]),_0xb9f211[_0xf2ed('0x81')],_0xb9f211['activeContact']);}}}else{_0xb9f211[_0xf2ed('0xa6')]++;_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211[_0xf2ed('0x84')],'field':{'countnoanswerretry':_0xb9f211[_0xf2ed('0xa6')]}})[_0xf2ed('0x56')](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case _0xf2ed('0xbf'):_0x33bb1b[_0xf2ed('0xc0')]+=0x1;_0xb9f211[_0xf2ed('0xc1')]+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut[_0xf2ed('0x61')](_0xb9f211,0xb,_0xf2ed('0xc2'));rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0xc3'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'11',_0x33bb1b)[_0xf2ed('0x56')](function(_0x3b3e25){_0x5ef608=_0x3b3e25['additional']==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,'Global');rpcDb[_0xf2ed('0x69')](_0x12b178,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0xb9f211[_0xf2ed('0xc4')]>=_0x33bb1b[_0xf2ed('0xc5')]){rpcDb['createCustomerFinal'](_0xb9f211,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xf2ed('0xa1')](ut[_0xf2ed('0x80')](_0xb9f211,_0xf2ed('0xc1'),_0x33bb1b['dialAbandonedRetryFrequency']),_0xb9f211[_0xf2ed('0x81')],_0xb9f211[_0xf2ed('0xa2')]);}}}else{_0xb9f211[_0xf2ed('0xa6')]++;_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211[_0xf2ed('0x84')],'field':{'countnoanswerretry':_0xb9f211[_0xf2ed('0xa6')]}})['then'](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});break;case'18':_0x33bb1b[_0xf2ed('0xc6')]+=0x1;_0xb9f211['countmachineretry']+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut['logCustomer'](_0xb9f211,0x12,_0x4707a3[_0xf2ed('0xc7')]||_0x4707a3[_0xf2ed('0xc8')]);ami[_0xf2ed('0x24')](_0xf2ed('0xc9'),ut[_0xf2ed('0x76')](_0xb9f211,'amd'));rpcDb[_0xf2ed('0x67')](_0xb9f211,_0xf2ed('0xca'));_0x5515f5['verifyAdditionalPhones'](_0xb9f211,'18',_0x33bb1b)['then'](function(_0x397a63){_0x5ef608=_0x397a63['additional']==0x1;if(!_0x5ef608){if(ut['totalGlobal'](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0x12,_0xf2ed('0x7d'));rpcDb[_0xf2ed('0x69')](_0x12b178,_0xf2ed('0xca'));}else{rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0xca'));}}else{_0xb9f211[_0xf2ed('0xa6')]++;_0x5515f5['incrementPreviewCounters']({'id':_0xb9f211['idContact'],'field':{'countnoanswerretry':_0xb9f211[_0xf2ed('0xa6')]}})['then'](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});});}});delete this[_0xf2ed('0x13')][_0x4707a3[_0xf2ed('0x82')]];break;case'19':_0x33bb1b[_0xf2ed('0xc6')]+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut[_0xf2ed('0x61')](_0xb9f211,0x13,_0x4707a3[_0xf2ed('0xc7')]||_0x4707a3[_0xf2ed('0xc8')]);ami[_0xf2ed('0x24')](_0xf2ed('0xc9'),ut['buildObj'](_0xb9f211,_0xf2ed('0xcb')));rpcDb[_0xf2ed('0x67')](_0xb9f211,'[callProgressDetectingCustomer][machine]');_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'18',_0x33bb1b)['then'](function(_0x2e567d){_0x5ef608=_0x2e567d[_0xf2ed('0xa0')]==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,_0xf2ed('0x7d'));rpcDb[_0xf2ed('0x69')](_0x12b178,_0xf2ed('0xcc'));}else{rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0xcc'));}}else{_0xb9f211['countnoanswerretry']++;_0x5515f5[_0xf2ed('0x85')]({'id':_0xb9f211['idContact'],'field':{'countnoanswerretry':_0xb9f211[_0xf2ed('0xa6')]}})[_0xf2ed('0x56')](function(){_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)['then'](function(){});});}});delete this['actions'][_0x4707a3[_0xf2ed('0x82')]];break;default:if(_0xb9f211[_0xf2ed('0x41')]){ut[_0xf2ed('0x4e')](_0x33bb1b,_0xf2ed('0xcd'));ut['loggerError'](_0xf2ed('0xce')+_0x33bb1b[_0xf2ed('0x2e')],_0x4707a3);}_0x33bb1b[_0xf2ed('0xc6')]+=0x1;_0xb9f211[_0xf2ed('0x92')]=ut[_0xf2ed('0x93')](_0xb9f211);ut['logCustomer'](_0xb9f211,0xc,_0x4707a3[_0xf2ed('0xc7')]||_0x4707a3[_0xf2ed('0xc8')]);_0x308ca5=_0x33bb1b['dialAgentRejectRetryFrequency'];_0x11105c=_0x33bb1b[_0xf2ed('0x7a')];rpcDb['createCustomerHistory'](_0xb9f211,_0xf2ed('0xcf'));_0x5515f5[_0xf2ed('0x78')](_0xb9f211,'20',_0x33bb1b)[_0xf2ed('0x56')](function(_0x4c24de){_0x5ef608=_0x4c24de['additional']==0x1;if(!_0x5ef608){if(ut[_0xf2ed('0x93')](_0xb9f211)>=_0x33bb1b[_0xf2ed('0x7b')]){_0x12b178=ut[_0xf2ed('0x7c')](_0xb9f211,0xf,'Global');rpcDb['createCustomerFinal'](_0x12b178,_0xf2ed('0xd0'));}else{rpcDb[_0xf2ed('0x69')](_0xb9f211,_0xf2ed('0xd0'));}delete this[_0xf2ed('0x13')][_0x4707a3[_0xf2ed('0x82')]];}else{_0x5515f5[_0xf2ed('0xa3')](_0xb9f211,_0x308ca5,_0x11105c)[_0xf2ed('0x56')](function(){});}});}if(!(_0xb9f211['dialAnswer']&&_0x26e62f==='16')){ut[_0xf2ed('0xd1')](_0x33bb1b,_0xf2ed('0xd2'));logger[_0xf2ed('0x25')](_0xf2ed('0xd3'),_0xb9f211[_0xf2ed('0x88')],'\x20Queue',_0x33bb1b[_0xf2ed('0x2e')],_0xf2ed('0x3e'),_0x33bb1b[_0xf2ed('0x3f')]);}if(_0x26e62f!==_0xf2ed('0xd4')){delete this[_0xf2ed('0x13')][_0x4707a3[_0xf2ed('0x82')]];delete this[_0xf2ed('0x13')][_0x4707a3[_0xf2ed('0xd5')]];}_0x33bb1b[_0xf2ed('0xd6')]=!![];}};Preview[_0xf2ed('0xc')][_0xf2ed('0xd7')]=function(_0xae020b,_0x19a593,_0xaf05c5){if(_[_0xf2ed('0xd8')](_0x19a593)&&'object'!==typeof _0x19a593){return;}if(_[_0xf2ed('0xd8')](_0xaf05c5)&&_0xf2ed('0xd9')!==typeof _0xaf05c5){return;}switch(_0xaf05c5['reason']){case'0':ut[_0xf2ed('0xda')](_0xae020b,0x0,_0xf2ed('0x74'));rpcDb[_0xf2ed('0xdb')](_0xae020b,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xf2ed('0xda')](_0xae020b,0x3,'NoAnswer');rpcDb[_0xf2ed('0xdb')](_0xae020b,_0xf2ed('0xdc'));break;case'5':ut[_0xf2ed('0xda')](_0xae020b,0x5,'Busy');rpcDb[_0xf2ed('0xdb')](_0xae020b,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xf2ed('0xda')](_0xae020b,0x8,_0xf2ed('0xb1'));rpcDb[_0xf2ed('0xdb')](_0xae020b,_0xf2ed('0xdd'));break;case'22':ut[_0xf2ed('0xda')](_0xae020b,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0xae020b,_0xf2ed('0xde'));break;default:ut['logAgent'](_0xae020b,0xc,_0xaf05c5[_0xf2ed('0xdf')]);rpcDb[_0xf2ed('0xdb')](_0xae020b,'[callProgressDetectingAgent][logCongestion]');}ut[_0xf2ed('0xd1')](_0x19a593,_0xf2ed('0xe0'));logger[_0xf2ed('0x25')](_0xf2ed('0xe1'),_0xae020b[_0xf2ed('0x88')],_0xf2ed('0x89'),_0x19a593[_0xf2ed('0x2e')],_0xf2ed('0x3e'),_0x19a593[_0xf2ed('0x3f')]);delete this[_0xf2ed('0x13')][_0xae020b[_0xf2ed('0x88')]];};Preview[_0xf2ed('0xc')]['verifyAdditionalPhones']=function(_0x3589e0,_0x8c0471,_0x593fc2){return cmHopperAdditionalPhone[_0xf2ed('0x78')](_0x3589e0,_0x8c0471,_0x593fc2)[_0xf2ed('0x4a')](logger['info'](_0xf2ed('0xe2')));};Preview[_0xf2ed('0xc')][_0xf2ed('0xa3')]=function(_0x3e04e3,_0x676e9d,_0x5e0fc0){return cmHopperAdditionalPhone[_0xf2ed('0xa3')](_0x3e04e3,_0x676e9d,_0x5e0fc0)[_0xf2ed('0x4a')](logger[_0xf2ed('0x25')](_0xf2ed('0xe3')));};Preview[_0xf2ed('0xc')]['incrementPreviewCounters']=function(_0x211380){return Promise[_0xf2ed('0xe4')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x211380))[_0xf2ed('0x4a')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0xf2ed('0xc')][_0xf2ed('0xe5')]=function(_0x2640f2,_0x34c610,_0x1c5d18,_0x424e75,_0x5b605f){var _0x42ae65=this;return new Promise(function(_0x286bea,_0x82e0fc){if(_[_0xf2ed('0x3a')](_0x34c610)||_[_0xf2ed('0x3a')](_0x34c610[_0xf2ed('0xe6')])||_['isNil'](_0x34c610['phone'])||_[_0xf2ed('0x3a')](_0x34c610[_0xf2ed('0x45')])){_0x82e0fc(ut[_0xf2ed('0x4b')](_0xf2ed('0xe7'),_0x424e75,_0x5b605f));return;}var _0x184cec=uuid['v4']();var _0x213715=_0x42ae65[_0xf2ed('0x11')][_0x34c610[_0xf2ed('0x3c')][_0xf2ed('0x2e')]];var _0x1f2976=_0x1c5d18?_0x42ae65[_0xf2ed('0x14')][_0x1c5d18]['id']:undefined;_0x42ae65[_0xf2ed('0x13')][_0x184cec]=new Action(_0x34c610,_0x213715,_0x184cec,_0x1c5d18,_0x1f2976);var _0x41087a=_0x42ae65[_0xf2ed('0x13')][_0x184cec];_0x41087a[_0xf2ed('0x81')]=_0x424e75;_0x41087a[_0xf2ed('0xa2')]=_0x5b605f;_0x41087a[_0xf2ed('0xe8')]=_0x1c5d18;if(_[_0xf2ed('0xe9')](_0x2640f2)){_0x42ae65[_0xf2ed('0xea')](_0x41087a,_0x213715,_0x34c610,_0x1c5d18)['then'](function(_0x19e299){logger[_0xf2ed('0x25')](_0xf2ed('0xeb'),_0xf2ed('0xec')+_0x41087a[_0xf2ed('0x3d')]+_0xf2ed('0xed')+_0x41087a[_0xf2ed('0x84')],JSON[_0xf2ed('0x27')](_0x19e299));ami[_0xf2ed('0x24')]('custom:agentcalled',ut[_0xf2ed('0x76')](_0x41087a,'called',_0x42ae65[_0xf2ed('0x11')][_0x41087a[_0xf2ed('0x3d')]]));_0x286bea(ut[_0xf2ed('0x4b')]('Calling'));})['catch'](function(_0x5c19de){ut[_0xf2ed('0x31')]('[Preview][execCall][failure]',_0x5c19de);_0x82e0fc(ut['message']('Call\x20failed',_0x424e75,_0x5b605f));});}else{_0x213715[_0xf2ed('0xee')]+=0x1;ut[_0xf2ed('0xef')](_0x41087a);rpcDb[_0xf2ed('0xf0')](_0x41087a,_0xf2ed('0xf1'));delete _0x42ae65['actions'][_0x184cec];_0x82e0fc(ut['message']('Contact\x20in\x20black\x20List',_0x424e75,_0x5b605f));}});};Preview[_0xf2ed('0xc')]['isTrunkReachable']=function(_0x207f0c){return!_[_0xf2ed('0x3a')](_0x207f0c)&&!_[_0xf2ed('0x3a')](_0x207f0c[_0xf2ed('0x2e')])&&!_['isNil'](_0x207f0c['active'])&&_0x207f0c['active']&&!_['isNil'](this[_0xf2ed('0xf2')][util[_0xf2ed('0x28')](_0xf2ed('0xf3'),_0x207f0c[_0xf2ed('0x2e')])])&&!_[_0xf2ed('0x3a')](this[_0xf2ed('0xf2')][util[_0xf2ed('0x28')](_0xf2ed('0xf3'),_0x207f0c[_0xf2ed('0x2e')])][_0xf2ed('0x48')])&&(this[_0xf2ed('0xf2')][util[_0xf2ed('0x28')](_0xf2ed('0xf3'),_0x207f0c[_0xf2ed('0x2e')])][_0xf2ed('0x48')]===_0xf2ed('0xf4')||this['trunks'][util[_0xf2ed('0x28')](_0xf2ed('0xf3'),_0x207f0c[_0xf2ed('0x2e')])][_0xf2ed('0x48')]==='unmonitored');};Preview['prototype'][_0xf2ed('0x5c')]=function(_0x33ec2b,_0x65e347){return this['execRun'](_0x33ec2b,_0x65e347)[_0xf2ed('0x56')](function(_0x3ab9a9){return _['pick'](_0x3ab9a9,[_0xf2ed('0x4b')]);})[_0xf2ed('0x4a')](function(_0x10a0cd){if(_0x10a0cd['unlock']){rpcDb['unlockContact'](_0x33ec2b);}if(_0x10a0cd[_0xf2ed('0xf5')]){rpcDb[_0xf2ed('0xf6')](_0x33ec2b);}throw _['pick'](_0x10a0cd,['message']);});};Preview[_0xf2ed('0xc')][_0xf2ed('0xf7')]=function(_0x8019dd,_0x3cfe7b){var _0xcddc4b=this;var _0x4feaeb,_0x171adf;return rpcDb[_0xf2ed('0xf8')](_0x8019dd)[_0xf2ed('0x56')](function(_0x161527){if(!_[_0xf2ed('0x3a')](_0x161527[0x0])){_0x171adf=_0x161527[0x0][_0xf2ed('0xf9')]?![]:!![];_0x4feaeb=_0x161527[0x0][_0xf2ed('0xf9')]?!![]:![];_0x4feaeb=_0x3cfe7b?!![]:_0x4feaeb;}var _0x126f7d=_0xcddc4b[_0xf2ed('0xfa')](_0x161527);if(_0x126f7d[_0xf2ed('0xfb')]){rpcDb[_0xf2ed('0xfc')](_['pick'](_0x161527[0x0],[_0xf2ed('0x45'),_0xf2ed('0xfd')]))[_0xf2ed('0x56')](function(_0x20e2be){_0xcddc4b[_0xf2ed('0xe5')](_0x20e2be,_0x161527[0x0],_0x3cfe7b,_0x171adf,_0x4feaeb)['then'](function(_0xd6e0b9){return _0xd6e0b9;})[_0xf2ed('0x4a')](function(_0x29eed6){throw _0x29eed6;});})[_0xf2ed('0x4a')](function(_0x23c880){ut[_0xf2ed('0x31')](_0xf2ed('0xfe'),_0x23c880);throw ut[_0xf2ed('0x4b')](_0xf2ed('0xff'),_0x171adf,_0x4feaeb);});}else{throw ut[_0xf2ed('0x4b')](_0x126f7d[_0xf2ed('0x4b')],_0x171adf,_0x4feaeb);}})[_0xf2ed('0x4a')](function(_0x508afd){ut['logger'](_0xf2ed('0x100'),_0x508afd);throw ut[_0xf2ed('0x4b')](_0xf2ed('0xff'),![],!![]);});};Preview[_0xf2ed('0xc')]['validateContact']=function(_0x5a3d44){if(_[_0xf2ed('0x3a')](_0x5a3d44)||_[_0xf2ed('0xe9')](_0x5a3d44)||!_[_0xf2ed('0x3a')](_0x5a3d44[0x0][_0xf2ed('0x5a')])&&_[_0xf2ed('0x3a')](_0x5a3d44[0x0]['Agent']['name'])){ut[_0xf2ed('0x31')](_0xf2ed('0x101'),_0x5a3d44);return{'isValid':![],'message':_0xf2ed('0x102')};}var _0xdab97c=this[_0xf2ed('0x11')][_0x5a3d44[0x0][_0xf2ed('0x3c')][_0xf2ed('0x2e')]];_0xdab97c[_0xf2ed('0x4b')]=utils[_0xf2ed('0x2f')]['ACTIVE'];if(_[_0xf2ed('0x3a')](_0xdab97c)){ut[_0xf2ed('0x31')]('[Preview][validateContact][Empty\x20Campaign]',_0xdab97c);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xf2ed('0x6e')](_0xdab97c[_0xf2ed('0x6f')])){ut[_0xf2ed('0x31')](_0xf2ed('0x103'),_0xf2ed('0x104')+_0xdab97c[_0xf2ed('0x2e')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xf2ed('0x6e')](_0xdab97c[_0xf2ed('0x105')])){ut['logger'](_0xf2ed('0x103'),_0xdab97c[_0xf2ed('0x2e')]+_0xf2ed('0x106'));return{'isValid':![],'message':_0xf2ed('0x107')};}}if(!ut[_0xf2ed('0x108')](_0xdab97c[_0xf2ed('0x37')])){ut['logger'](_0xf2ed('0x109'),_0xdab97c['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xf2ed('0x104')+_0xdab97c[_0xf2ed('0x2e')]+_0xf2ed('0x10a')};}return{'isValid':!![],'message':_0xf2ed('0x10b')};};Preview[_0xf2ed('0xc')][_0xf2ed('0xea')]=function(_0x3b0727,_0x553440,_0x5e795d,_0x2f61f1){var _0x4fd686=this;return new Promise(function(_0xc1f8ce,_0x5723e3){var _0x56dfb5=_0x3b0727['uniqueid'];var _0x37b24d=_0x4fd686[_0xf2ed('0x6e')](_0x553440[_0xf2ed('0x6f')])?util[_0xf2ed('0x28')](_0xf2ed('0x10c'),_0x553440[_0xf2ed('0x6f')][_0xf2ed('0x2e')],_[_0xf2ed('0x3a')](_0x553440[_0xf2ed('0x10d')])?'':_0x553440[_0xf2ed('0x10d')][_0xf2ed('0x10e')]()||'',_0x553440[_0xf2ed('0x10f')]>0x0?_0x5e795d[_0xf2ed('0xfd')][_0xf2ed('0x110')](_0x553440['dialCutDigit']):_0x5e795d[_0xf2ed('0xfd')]):util['format'](_0xf2ed('0x10c'),_[_0xf2ed('0x3a')](_0x553440[_0xf2ed('0x105')])?_0x553440[_0xf2ed('0x6f')][_0xf2ed('0x2e')]:_0x553440[_0xf2ed('0x105')][_0xf2ed('0x2e')],_[_0xf2ed('0x3a')](_0x553440[_0xf2ed('0x10d')])?'':_0x553440[_0xf2ed('0x10d')][_0xf2ed('0x10e')]()||'',_0x553440[_0xf2ed('0x10f')]>0x0?_0x5e795d[_0xf2ed('0xfd')]['substring'](_0x553440['dialCutDigit']):_0x5e795d[_0xf2ed('0xfd')]);var _0x530fd9=_0x4fd686[_0xf2ed('0x6e')](_0x553440[_0xf2ed('0x6f')])?ut[_0xf2ed('0x111')](_0x553440['Trunk'][_0xf2ed('0x112')],_0x553440[_0xf2ed('0x113')],_0x553440['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xf2ed('0x114')](_0x553440[_0xf2ed('0x115')],_0x553440[_0xf2ed('0x116')]):_0x553440['dialOriginateCallerIdNumber']):ut[_0xf2ed('0x111')](_[_0xf2ed('0x3a')](_0x553440['TrunkBackup'])?_0x553440[_0xf2ed('0x6f')][_0xf2ed('0x112')]:_0x553440['TrunkBackup'][_0xf2ed('0x112')],_0x553440[_0xf2ed('0x113')],_0x553440[_0xf2ed('0x116')]>0x0?ut[_0xf2ed('0x114')](_0x553440[_0xf2ed('0x115')],_0x553440[_0xf2ed('0x116')]):_0x553440[_0xf2ed('0x115')]);if(_0x530fd9){_0x3b0727[_0xf2ed('0x117')]=ut[_0xf2ed('0x118')](_0x530fd9);_0x3b0727[_0xf2ed('0x119')]=ut[_0xf2ed('0x11a')](_0x530fd9);}var _0x1d060c=ut[_0xf2ed('0x11b')](_0x553440,_0x5e795d,_0x37b24d,_0x530fd9,_0x56dfb5,_0x3b0727);var _0x228962=utils[_0xf2ed('0x11c')](_0x5e795d[_0xf2ed('0xe6')]);Object[_0xf2ed('0x11d')](_0x1d060c,_0x228962);_[_0xf2ed('0x11e')](_0x3b0727,ut['toLowerVariables'](_0x1d060c));_0x3b0727[_0xf2ed('0x5f')]=moment()[_0xf2ed('0x28')](_0xf2ed('0x60'));_0x553440[_0xf2ed('0x11f')]=_0x1d060c;var _0x1fe5cd=ut['variablesAction'](_0x3b0727,_0x553440,_0x1d060c,_0x3b0727[_0xf2ed('0xa2')],_0x2f61f1);return ami['Action'](_0x1fe5cd)[_0xf2ed('0x56')](function(_0x5927cc){_0x553440[_0xf2ed('0x3f')]+=0x1;logger[_0xf2ed('0x25')](_0xf2ed('0x120'),_0x56dfb5,_0xf2ed('0x89'),_0x553440[_0xf2ed('0x2e')],_0xf2ed('0x3e'),_0x553440['originated']);_0xc1f8ce(_0x5927cc);})[_0xf2ed('0x4a')](function(_0x24016f){ut[_0xf2ed('0xda')](_0x3b0727,0xe,_0xf2ed('0x121'));rpcDb[_0xf2ed('0xdb')](_0x3b0727,_0xf2ed('0x122'));_0x5723e3(_0x24016f);});});};Preview[_0xf2ed('0xc')][_0xf2ed('0x1d')]=function(_0x486108){if(this[_0xf2ed('0x13')][_0x486108[_0xf2ed('0x82')]]){this[_0xf2ed('0x13')][_0x486108[_0xf2ed('0x82')]]['channel']=_0x486108[_0xf2ed('0x49')];}};Preview[_0xf2ed('0xc')][_0xf2ed('0x17')]=function(_0xe2eb92){var _0x1db5d9=this;var _0x575cdd=this[_0xf2ed('0x13')][_0xe2eb92[_0xf2ed('0x123')]];if(_0x575cdd){if(_0x575cdd[_0xf2ed('0xe8')]&&this['agents'][_0x575cdd[_0xf2ed('0xe8')]]){ut[_0xf2ed('0x124')](_0x575cdd,this['agents'][_0x575cdd[_0xf2ed('0xe8')]][_0xf2ed('0x2e')],this['agents'][_0x575cdd[_0xf2ed('0xe8')]]['id']);}var _0x21ee73=_[_0xf2ed('0x125')](_0x575cdd);_0x21ee73['responsetime']=moment()[_0xf2ed('0x28')](_0xf2ed('0x60'));var _0x59f100=_0x1db5d9[_0xf2ed('0x11')][_0x575cdd[_0xf2ed('0x3d')]];if(ut[_0xf2ed('0x126')](_0xe2eb92[_0xf2ed('0x127')])){if(_0x575cdd[_0xf2ed('0x81')]){rpcDb['unlockContact'](_0x575cdd[_0xf2ed('0x84')]);}if(_0x575cdd[_0xf2ed('0xa2')]){rpcDb['disableContact'](_0x575cdd[_0xf2ed('0x84')]);}ami[_0xf2ed('0x24')]('custom:agentringnoanswer',ut['buildObj'](_0x575cdd,_0xf2ed('0x128'),this[_0xf2ed('0x11')][_0x575cdd['queue']]));this['callProgressDetectingAgent'](_0x21ee73,_0x59f100,_0xe2eb92);}else{_0x575cdd[_0xf2ed('0x5f')]=moment()[_0xf2ed('0x28')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xf2ed('0xda')](_0x21ee73,0x4,_0xf2ed('0x129'));rpcDb[_0xf2ed('0xdb')](_0x21ee73,_0xf2ed('0x12a'));}}};Preview['prototype'][_0xf2ed('0x19')]=function(_0xa1e5a8){var _0x3dcfab=this[_0xf2ed('0x13')][_0xa1e5a8['linkedid']];var _0xe767a7;if(_0x3dcfab){_0xe767a7=this[_0xf2ed('0x11')][_0x3dcfab[_0xf2ed('0x3d')]];logger[_0xf2ed('0x25')]('[syncHangup][talking]',_0xa1e5a8[_0xf2ed('0x82')],_0xf2ed('0x89'),_0xe767a7[_0xf2ed('0x2e')],_0xf2ed('0x40'),_0xe767a7[_0xf2ed('0x2b')]);}if(this[_0xf2ed('0x13')][_0xa1e5a8['linkedid']]&&_0xa1e5a8[_0xf2ed('0x82')]!==_0xa1e5a8[_0xf2ed('0x88')]){if(_0xa1e5a8[_0xf2ed('0x12b')]==='16'&&this[_0xf2ed('0x13')][_0xa1e5a8[_0xf2ed('0x82')]][_0xf2ed('0x41')]){this['callProgressDetectingCustomer'](_0xa1e5a8,_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8[_0xf2ed('0x12b')]);}else if(this[_0xf2ed('0x13')][_0xa1e5a8[_0xf2ed('0x82')]]['dialAnswer']){logger[_0xf2ed('0x25')](_0xf2ed('0x12c'),_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8[_0xf2ed('0x12b')],_0xf2ed('0x89'),_0xe767a7[_0xf2ed('0x2e')],_0xf2ed('0x40'),_0xe767a7[_0xf2ed('0x2b')]);this['callProgressDetectingCustomer'](_0xa1e5a8,_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8[_0xf2ed('0x12b')]);}}else if(_0x3dcfab&&_['isNil'](_0x3dcfab['statedesc'])&&_0xe767a7[_0xf2ed('0x12d')]&&_0xa1e5a8[_0xf2ed('0x82')]===_0xa1e5a8[_0xf2ed('0x88')]&&_[_0xf2ed('0x3a')](_0xa1e5a8['reason'])&&_0xa1e5a8['cause']==='16'&&_0xa1e5a8[_0xf2ed('0x12e')]==='6'&&_[_0xf2ed('0xd8')](_0x3dcfab[_0xf2ed('0x12f')])){if(_0x3dcfab['unlockAgent']){rpcDb[_0xf2ed('0x130')](_0x3dcfab['idContact']);}if(_0x3dcfab[_0xf2ed('0xa2')]){rpcDb[_0xf2ed('0xf6')](_0x3dcfab[_0xf2ed('0x84')]);}_0xa1e5a8[_0xf2ed('0xdf')]='22';this[_0xf2ed('0xd7')](_0x3dcfab,_0xe767a7,_0xa1e5a8);}else if(_0x3dcfab&&_0x3dcfab['transfer']){if(_0xa1e5a8['cause']==='16'&&this[_0xf2ed('0x13')][_0xa1e5a8[_0xf2ed('0x82')]][_0xf2ed('0x41')]){logger['info'](_0xf2ed('0x131'),_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8['cause'],'\x20Queue',_0xe767a7[_0xf2ed('0x2e')],_0xf2ed('0x40'),_0xe767a7[_0xf2ed('0x2b')]);this['callProgressDetectingCustomer'](_0xa1e5a8,_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8[_0xf2ed('0x12b')]);}else if(this[_0xf2ed('0x13')][_0xa1e5a8['linkedid']][_0xf2ed('0x41')]){logger[_0xf2ed('0x25')](_0xf2ed('0x12c'),_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8[_0xf2ed('0x12b')],_0xf2ed('0x89'),_0xe767a7[_0xf2ed('0x2e')],_0xf2ed('0x40'),_0xe767a7['pTalking']);this[_0xf2ed('0x71')](_0xa1e5a8,_0xa1e5a8[_0xf2ed('0x82')],_0xa1e5a8['cause']);}}};Preview[_0xf2ed('0xc')][_0xf2ed('0x132')]=function(_0x323de9){if(this[_0xf2ed('0x13')][_0x323de9['destlinkedid']]&&_0x323de9[_0xf2ed('0xd5')]!==_0x323de9[_0xf2ed('0x133')]){this[_0xf2ed('0x71')](_0x323de9,_0x323de9[_0xf2ed('0xd5')],_0x323de9[_0xf2ed('0xc8')]);}};Preview[_0xf2ed('0xc')][_0xf2ed('0x1b')]=function(_0x16f38b){if(this[_0xf2ed('0x13')][_0x16f38b['linkedid']]&&_0x16f38b[_0xf2ed('0x82')]!==_0x16f38b[_0xf2ed('0x88')]&&!this[_0xf2ed('0x13')][_0x16f38b['linkedid']][_0xf2ed('0x41')]){if(_0x16f38b[_0xf2ed('0x12b')]==='1'){this[_0xf2ed('0x71')](_0x16f38b,_0x16f38b['linkedid'],_0x16f38b[_0xf2ed('0x12b')]);}}};Preview[_0xf2ed('0xc')]['addVariable']=function(_0x9b55f4,_0x586cb9,_0x218786){if(this['actions'][_0x9b55f4]){if(_[_0xf2ed('0x3a')](this[_0xf2ed('0x13')][_0x9b55f4][_0xf2ed('0x11f')])){this[_0xf2ed('0x13')][_0x9b55f4][_0xf2ed('0x11f')]={};}this['actions'][_0x9b55f4][_0xf2ed('0x11f')][_0x586cb9]=_0x218786;}};Preview[_0xf2ed('0xc')]['syncVarSet']=function(_0x2448bd){try{if(!_[_0xf2ed('0x3a')](_0x2448bd)){if(ut[_0xf2ed('0x134')](_[_0xf2ed('0x135')](_0x2448bd[_0xf2ed('0x136')])[0x0])){this[_0xf2ed('0x137')](_0x2448bd[_0xf2ed('0x88')],_[_0xf2ed('0x135')](_0x2448bd[_0xf2ed('0x136')])[0x0],_0x2448bd[_0xf2ed('0x138')]);}}}catch(_0x3a2548){logger[_0xf2ed('0x139')](_0xf2ed('0x13a'),util[_0xf2ed('0x13b')](_0x3a2548,{'showHidden':![],'depth':null}));}};Preview[_0xf2ed('0xc')][_0xf2ed('0x21')]=function(_0x5dd979){if(_0x5dd979){if(this[_0xf2ed('0x13')][_0x5dd979[_0xf2ed('0x13c')]]){this[_0xf2ed('0x13')][_0x5dd979[_0xf2ed('0x13c')]][_0xf2ed('0x12f')]=!![];}}};Preview[_0xf2ed('0xc')][_0xf2ed('0x13d')]=function(_0x1bbe13){if(_0x1bbe13){if(this[_0xf2ed('0x13')][_0x1bbe13[_0xf2ed('0x13e')]]){this['actions'][_0x1bbe13[_0xf2ed('0x13e')]][_0xf2ed('0x12f')]=!![];}}};module[_0xf2ed('0x13f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cd15b14..4b1b657 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 _0xfe89=['[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch'];(function(_0xca9604,_0x3cae63){var _0x188c1b=function(_0x342eef){while(--_0x342eef){_0xca9604['push'](_0xca9604['shift']());}};_0x188c1b(++_0x3cae63);}(_0xfe89,0x1a5));var _0x9fe8=function(_0x30fc85,_0x4f08f6){_0x30fc85=_0x30fc85-0x0;var _0x1645f8=_0xfe89[_0x30fc85];return _0x1645f8;};'use strict';var util=require(_0x9fe8('0x0'));var BPromise=require(_0x9fe8('0x1'));var logger=require(_0x9fe8('0x2'))('preview');var cmHopper=require(_0x9fe8('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9fe8('0x4'));var agentReportPreview=require(_0x9fe8('0x5'));var voiceQueueReport=require(_0x9fe8('0x6'));function loggerCatch(_0x1031ef){return function(_0x350da7){logger[_0x9fe8('0x7')](_0x1031ef,util[_0x9fe8('0x8')](_0x350da7,{'showHidden':![],'depth':null}));};}function create(_0x10a7be){return cmHopperHistory[_0x9fe8('0x9')](_0x10a7be)[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0xb')));}function createAgent(_0x15b01c){return BPromise[_0x9fe8('0xc')]()['then'](agentReportPreview[_0x9fe8('0x9')](_0x15b01c))[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0xb')));}function moveContact(_0x2ef49c){return cmHopper[_0x9fe8('0xd')](_0x2ef49c,!![])[_0x9fe8('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9fe8('0xe')]=function(_0x5ac67d){return cmHopperBlack[_0x9fe8('0xe')](_0x5ac67d)[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0xf')));};exports[_0x9fe8('0x10')]=function(_0x48372d){return BPromise[_0x9fe8('0xc')]()[_0x9fe8('0x11')](cmHopper[_0x9fe8('0x10')](_0x48372d))[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x12')));};exports[_0x9fe8('0x9')]=function(_0x482373,_0x393063){create(_0x482373)[_0x9fe8('0xa')](loggerCatch(_0x393063));moveContact(_0x482373)['catch'](loggerCatch(_0x393063));};exports['createAgentHistory']=function(_0x332cab,_0x27e24c){createAgent(_0x332cab)[_0x9fe8('0xa')](loggerCatch(_0x27e24c));};exports[_0x9fe8('0x13')]=function(_0x32c465,_0x2a044b){create(_0x32c465)[_0x9fe8('0xa')](loggerCatch(_0x2a044b));};exports[_0x9fe8('0x14')]=function(_0x5e4f3c,_0xa5c42b){moveContact(_0x5e4f3c)[_0x9fe8('0xa')](loggerCatch(_0xa5c42b));};exports[_0x9fe8('0x15')]=function(_0x3035fe,_0x23cf43,_0x5ab38b){if(_0x23cf43){_0x3035fe[_0x9fe8('0x16')]=null;}if(_0x5ab38b){_0x3035fe['active']=![];}return cmHopper[_0x9fe8('0x15')](_0x3035fe)[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x17')));};exports[_0x9fe8('0x18')]=function(_0x4c8959){return cmHopper['countReScheduled'](_0x4c8959)['catch'](loggerCatch(_0x9fe8('0x19')));};exports[_0x9fe8('0x1a')]=function(_0x48900c){return cmHopper[_0x9fe8('0x1a')]({'UserId':null},_0x48900c,0x1)[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x1b')));};exports['disableContact']=function(_0x17b659){return cmHopper[_0x9fe8('0x1a')]({'active':![]},_0x17b659,0x1)[_0x9fe8('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x9fe8('0x1c')]=function(_0xb54bda){var _0xfd0b41={};_0xfd0b41[_0x9fe8('0x1d')]=_0xb54bda[_0x9fe8('0x1d')];_0xfd0b41[_0x9fe8('0x1e')]=_0xb54bda['uniqueid'];_0xfd0b41[_0x9fe8('0x1f')]=_0xb54bda[_0x9fe8('0x1f')];_0xfd0b41[_0x9fe8('0x20')]=_0xb54bda[_0x9fe8('0x20')];_0xfd0b41[_0x9fe8('0x21')]=_0xb54bda[_0x9fe8('0x21')];_0xfd0b41[_0x9fe8('0x22')]=_0xb54bda[_0x9fe8('0x23')];_0xfd0b41[_0x9fe8('0x24')]=_0xb54bda[_0x9fe8('0x23')];_0xfd0b41[_0x9fe8('0x25')]=0x1;_0xfd0b41[_0x9fe8('0x26')]=_0xb54bda[_0x9fe8('0x27')];_0xfd0b41[_0x9fe8('0x28')]=_0xb54bda['membername'];_0xfd0b41[_0x9fe8('0x29')]=_0x9fe8('0x2a');_0xfd0b41[_0x9fe8('0x2b')]='xcally-motion-preview';_0xfd0b41[_0x9fe8('0x2c')]=0x0;_0xfd0b41[_0x9fe8('0x2d')]=0x1;_0xfd0b41[_0x9fe8('0x2e')]=_0xb54bda[_0x9fe8('0x2f')];_0xfd0b41['queuecallerexitreason']=_0x9fe8('0x30');return BPromise[_0x9fe8('0xc')]()[_0x9fe8('0x11')](voiceQueueReport['create'](_0xfd0b41))[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x31')));};exports[_0x9fe8('0x32')]=function(_0x4e1d24,_0x34f818){return BPromise['resolve']()['then'](cmHopper[_0x9fe8('0x32')](_0x4e1d24,_0x34f818))[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x33')));};exports[_0x9fe8('0x34')]=function(_0x511137){return cmHopper[_0x9fe8('0x15')](_0x511137,!![],!![])[_0x9fe8('0xa')](loggerCatch(_0x9fe8('0x35')));}; \ No newline at end of file +var _0x58e5=['preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','xcally-motion-preview','holdtime','assigned','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger'];(function(_0x5cc0a7,_0x9309a4){var _0xdeaf11=function(_0x6c53a7){while(--_0x6c53a7){_0x5cc0a7['push'](_0x5cc0a7['shift']());}};_0xdeaf11(++_0x9309a4);}(_0x58e5,0x177));var _0x558e=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x58e5[_0x4b73a2];return _0x383c66;};'use strict';var util=require(_0x558e('0x0'));var BPromise=require(_0x558e('0x1'));var logger=require(_0x558e('0x2'))(_0x558e('0x3'));var cmHopper=require(_0x558e('0x4'));var cmHopperHistory=require(_0x558e('0x5'));var cmHopperBlack=require(_0x558e('0x6'));var agentReportPreview=require(_0x558e('0x7'));var voiceQueueReport=require(_0x558e('0x8'));function loggerCatch(_0x1ab13b){return function(_0x13c4f5){logger[_0x558e('0x9')](_0x1ab13b,util['inspect'](_0x13c4f5,{'showHidden':![],'depth':null}));};}function create(_0x24bb72){return cmHopperHistory['createHistory'](_0x24bb72)[_0x558e('0xa')](loggerCatch(_0x558e('0xb')));}function createAgent(_0x106134){return BPromise[_0x558e('0xc')]()[_0x558e('0xd')](agentReportPreview[_0x558e('0xe')](_0x106134))['catch'](loggerCatch(_0x558e('0xb')));}function moveContact(_0x2019d1){return cmHopper[_0x558e('0xf')](_0x2019d1,!![])[_0x558e('0xa')](loggerCatch(_0x558e('0x10')));}exports[_0x558e('0x11')]=function(_0x4a7963){return cmHopperBlack[_0x558e('0x11')](_0x4a7963)[_0x558e('0xa')](loggerCatch(_0x558e('0x12')));};exports[_0x558e('0x13')]=function(_0xeb9016){return BPromise[_0x558e('0xc')]()[_0x558e('0xd')](cmHopper[_0x558e('0x13')](_0xeb9016))[_0x558e('0xa')](loggerCatch(_0x558e('0x14')));};exports['createHistory']=function(_0x1754a2,_0x4ec348){create(_0x1754a2)[_0x558e('0xa')](loggerCatch(_0x4ec348));moveContact(_0x1754a2)[_0x558e('0xa')](loggerCatch(_0x4ec348));};exports[_0x558e('0x15')]=function(_0x3c50b9,_0x18e930){createAgent(_0x3c50b9)[_0x558e('0xa')](loggerCatch(_0x18e930));};exports[_0x558e('0x16')]=function(_0x1c0889,_0x38a15e){create(_0x1c0889)[_0x558e('0xa')](loggerCatch(_0x38a15e));};exports[_0x558e('0x17')]=function(_0x511cbb,_0x5e1fd1){moveContact(_0x511cbb)[_0x558e('0xa')](loggerCatch(_0x5e1fd1));};exports[_0x558e('0x18')]=function(_0x5c99de,_0x3232a2,_0x4a097a){if(_0x3232a2){_0x5c99de['UserId']=null;}if(_0x4a097a){_0x5c99de[_0x558e('0x19')]=![];}return cmHopper[_0x558e('0x18')](_0x5c99de)[_0x558e('0xa')](loggerCatch(_0x558e('0x1a')));};exports[_0x558e('0x1b')]=function(_0x2c92f4){return cmHopper[_0x558e('0x1b')](_0x2c92f4)['catch'](loggerCatch(_0x558e('0x1c')));};exports[_0x558e('0x1d')]=function(_0x5498fe){return cmHopper[_0x558e('0x1d')]({'UserId':null},_0x5498fe,0x1)[_0x558e('0xa')](loggerCatch(_0x558e('0x1e')));};exports[_0x558e('0x1f')]=function(_0x54a436){return cmHopper[_0x558e('0x1d')]({'active':![]},_0x54a436,0x1)[_0x558e('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x558e('0x20')]=function(_0x4ddc28){var _0x409e7b={};_0x409e7b[_0x558e('0x21')]=_0x4ddc28['type'];_0x409e7b['uniqueid']=_0x4ddc28[_0x558e('0x22')];_0x409e7b[_0x558e('0x23')]=_0x4ddc28[_0x558e('0x23')];_0x409e7b[_0x558e('0x24')]=_0x4ddc28['calleridname'];_0x409e7b[_0x558e('0x25')]=_0x4ddc28[_0x558e('0x25')];_0x409e7b[_0x558e('0x26')]=_0x4ddc28[_0x558e('0x27')];_0x409e7b[_0x558e('0x28')]=_0x4ddc28[_0x558e('0x27')];_0x409e7b[_0x558e('0x29')]=0x1;_0x409e7b[_0x558e('0x2a')]=_0x4ddc28[_0x558e('0x2b')];_0x409e7b[_0x558e('0x2c')]=_0x4ddc28[_0x558e('0x2d')];_0x409e7b['context']='from-sip';_0x409e7b['exten']=_0x558e('0x2e');_0x409e7b[_0x558e('0x2f')]=0x0;_0x409e7b[_0x558e('0x30')]=0x1;_0x409e7b['lastAssignedTo']=_0x4ddc28['membername'];_0x409e7b['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x558e('0x31')](_0x409e7b))['catch'](loggerCatch(_0x558e('0x32')));};exports['getContactRecallMe']=function(_0x30e58f,_0x2d5412){return BPromise['resolve']()[_0x558e('0xd')](cmHopper[_0x558e('0x33')](_0x30e58f,_0x2d5412))[_0x558e('0xa')](loggerCatch(_0x558e('0x34')));};exports[_0x558e('0x35')]=function(_0x19066c){return cmHopper['rescheduleContact'](_0x19066c,!![],!![])[_0x558e('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index cae4eaa..6eb5ed0 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 _0x3e1a=['isNil','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','getSeconds','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','originate','channelAgent','calleridnum','from-sip','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','status','reachable','getDiff','milliseconds','diff','seconds','VoiceQueueId','CampaignId','filterKey','idContact','type','dialAnswer','scheduledat','countbusyretry','countcongestionretry','countglobal','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridNumber','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','info','logger2','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','toLower','updateOriginated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e1a,0x65));var _0xa3e1=function(_0x3b7495,_0x35e238){_0x3b7495=_0x3b7495-0x0;var _0x5db8e4=_0x3e1a[_0x3b7495];return _0x5db8e4;};'use strict';var util=require(_0xa3e1('0x0'));var _=require('lodash');var moment=require(_0xa3e1('0x1'));var logger=require(_0xa3e1('0x2'))('preview');var ipAgi=process['env'][_0xa3e1('0x3')]||_0xa3e1('0x4');var utils=require('../../dialer/utils');exports[_0xa3e1('0x5')]=function(_0x7528e2){return function(_0x473bcd){logger['error'](_0x7528e2,util[_0xa3e1('0x6')](_0x473bcd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5c66b5,_0x324286){logger[_0xa3e1('0x7')](_0x5c66b5,util['inspect'](_0x324286,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x61206a,_0x6c796c){logger['error'](_0x61206a,util[_0xa3e1('0x6')](_0x6c796c,{'showHidden':![],'depth':null}));};exports[_0xa3e1('0x8')]=function(_0xefb9dd){return function(_0xb0d15e){logger[_0xa3e1('0x7')](_0xefb9dd,util['inspect'](_0xb0d15e,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xa882dd,_0xbb3e7b,_0x297431){return{'message':_0xa882dd,'unlock':_0xbb3e7b,'active':_0x297431};};exports['getCallerId']=function(_0x3b75ee,_0x1f01e2,_0x833d82){if(!_['isUndefined'](_0x833d82)&&_0xa3e1('0x9')===typeof _0x833d82&&!_['isEmpty'](_0x833d82)){if(!_[_0xa3e1('0xa')](_0x1f01e2)&&_0xa3e1('0x9')===typeof _0x1f01e2&&!_[_0xa3e1('0xb')](_0x1f01e2)){return util[_0xa3e1('0xc')]('\x22%s\x22\x20<%s>',_0x1f01e2,_0x833d82);}return util[_0xa3e1('0xc')](_0xa3e1('0xd'),_0x833d82,_0x833d82);}if(!_[_0xa3e1('0xa')](_0x3b75ee)&&'string'===typeof _0x3b75ee&&!_[_0xa3e1('0xb')](_0x3b75ee)){return _0x3b75ee;}return _0xa3e1('0xe');};exports['isActive']=function(_0x4a1014){if(_['isNil'](_0x4a1014)){return![];}return _0x4a1014;};exports['addVariables']=function(_0x17288f,_0x166ef5,_0xcb0f56,_0x58f1a5,_0x196e82,_0x253c0e){var _0x21bbf0={'XMD-QUEUE':_0x166ef5[_0xa3e1('0xf')]?_0x166ef5['Queue']['name']:'','XMD-CALLERID':_0x58f1a5,'XMD-CALLERID-PREVIEW':_0x253c0e?util[_0xa3e1('0xc')](_0xa3e1('0xd'),_0x253c0e['calleridname'],_0x253c0e['calleridnum']):_0x58f1a5,'XMD-DIALID':_0x196e82,'XMD-CONTACTID':_0x166ef5[_0xa3e1('0x10')],'XMD-CDRTYPE':_0xa3e1('0x11'),'CALLERID(all)':_0x58f1a5,'XMD-VOICEQUEUEID':_0x166ef5['VoiceQueueId'],'XMD-DIALCHANNEL':_0xcb0f56,'XMD-DIALTIMEOUT':_0x17288f[_0xa3e1('0x12')]||0x1e,'XMD-DIALOPTIONS':util[_0xa3e1('0xc')](_0xa3e1('0x13'),_0x17288f[_0xa3e1('0x14')]?'g':'',_[_0xa3e1('0xb')](_0x17288f[_0xa3e1('0x15')])?'':_0xa3e1('0x16')),'XMD-DIALURL':_0x17288f[_0xa3e1('0x17')]||'','XMD-AGI':_0x17288f[_0xa3e1('0x18')]?util[_0xa3e1('0xc')]('\x22agi://%s/square,%s\x22',ipAgi,_0x17288f[_0xa3e1('0x18')]):'NONE','XMD-AGIAFTER':_0x17288f[_0xa3e1('0x14')]?util[_0xa3e1('0xc')](_0xa3e1('0x19'),ipAgi,_0x17288f[_0xa3e1('0x14')]):_0xa3e1('0x1a'),'XMD-ORIGINATECALLERIDNUM':_0x253c0e?_0x253c0e[_0xa3e1('0x1b')]:'','XMD-ORIGINATECALLERIDNAME':_0x253c0e?_0x253c0e['originatecalleridname']:'','XMD-DESTINATION':_0xa3e1('0x1c'),'SIPADDHEADER':_0xa3e1('0x1d')};if(!_['isEmpty'](_0x17288f[_0xa3e1('0x15')])){_0x21bbf0[util[_0xa3e1('0xc')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x17288f[_0xa3e1('0x15')];_0x21bbf0[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x196e82;}return _0x21bbf0;};exports[_0xa3e1('0x1e')]=function(_0x49e30c){var _0x24e656={};for(var _0x4c271f in _0x49e30c){if(_0x49e30c[_0xa3e1('0x1f')](_0x4c271f)){_0x24e656[util[_0xa3e1('0xc')]('%s',_[_0xa3e1('0x20')](_0x4c271f))]=_0x49e30c[_0x4c271f];}}return{'variables':_0x24e656};};exports[_0xa3e1('0x21')]=function(_0x232d0f,_0x1fdc09){if(!_[_0xa3e1('0x22')](_0x232d0f)){if(_0x232d0f['hasOwnProperty'](_0xa3e1('0x23'))){if(_0x232d0f['originated']>0x0){_0x232d0f['originated']-=0x1;}else{logger[_0xa3e1('0x24')](_0xa3e1('0x25'),_0x1fdc09);}}}else{logger[_0xa3e1('0x24')](_0xa3e1('0x26'),_0x1fdc09);}};exports[_0xa3e1('0x27')]=function(_0x19b82b){var _0x2ab21b=moment()['format'](_0xa3e1('0x28'));_0x19b82b[_0xa3e1('0x29')]=0xd;_0x19b82b[_0xa3e1('0x2a')]=_0xa3e1('0x2b');_0x19b82b[_0xa3e1('0x2c')]=_0x2ab21b;_0x19b82b['responsetime']=_0x2ab21b;_0x19b82b[_0xa3e1('0x2d')]=_0x2ab21b;};exports['logAgent']=function(_0x47a1cc,_0x274491,_0x454a5c){var _0x7880cf=moment()[_0xa3e1('0xc')](_0xa3e1('0x28'));_0x47a1cc[_0xa3e1('0x29')]=_0x274491;_0x47a1cc[_0xa3e1('0x2a')]=_0x454a5c;_0x47a1cc[_0xa3e1('0x2e')]=_0x7880cf;_0x47a1cc['ringtime']=utils[_0xa3e1('0x2f')](_0x47a1cc[_0xa3e1('0x2e')],_0x47a1cc['starttime']);};exports[_0xa3e1('0x30')]=function(_0x4eddc5,_0x56c641,_0x2bbfb8){_0x4eddc5[_0xa3e1('0x31')]=_0x56c641;_0x4eddc5[_0xa3e1('0x32')]=_0x2bbfb8;};exports[_0xa3e1('0x33')]=function(_0x449b42,_0x477395,_0x5eace3){var _0x1fe52e=moment()[_0xa3e1('0xc')](_0xa3e1('0x28'));_0x449b42[_0xa3e1('0x29')]=_0x477395;_0x449b42['statedesc']=_0x5eace3;_0x449b42[_0xa3e1('0x2e')]=_0x449b42[_0xa3e1('0x2e')]?_0x449b42[_0xa3e1('0x2e')]:_0x1fe52e;_0x449b42[_0xa3e1('0x2d')]=_0x449b42[_0xa3e1('0x2d')]?_0x449b42[_0xa3e1('0x2d')]:_0x1fe52e;_0x449b42[_0xa3e1('0x34')]=utils[_0xa3e1('0x2f')](_0x449b42[_0xa3e1('0x2e')]||0x0,_0x449b42[_0xa3e1('0x2c')]||0x0);_0x449b42[_0xa3e1('0x35')]=_0x449b42[_0xa3e1('0x36')]?utils[_0xa3e1('0x2f')](_0x449b42[_0xa3e1('0x2d')],_0x449b42[_0xa3e1('0x36')]):0x0;};exports[_0xa3e1('0x37')]=function(_0x322106){return _0x322106==='Failure';};exports[_0xa3e1('0x38')]=function(_0x23dfe6,_0x53aaa9,_0x16efda,_0x26be6e,_0x1d1a9a){var _0x4e7174=_0x26be6e?_0xa3e1('0x39'):_0x23dfe6[_0xa3e1('0x3a')];_0x4e7174=_0x1d1a9a?_0xa3e1('0x3b'):_0x4e7174;return{'actionid':_0x23dfe6['uniqueid'],'action':_0xa3e1('0x3c'),'channel':_0x23dfe6[_0xa3e1('0x3d')],'callerid':util[_0xa3e1('0xc')]('\x22%s\x22\x20<%s>',_0x4e7174,_0x23dfe6[_0xa3e1('0x3e')]),'Exten':_0xa3e1('0x1c'),'Context':_0xa3e1('0x3f'),'Priority':'1','variable':_0x16efda,'timeout':(_0x53aaa9['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x23dfe6[_0xa3e1('0x40')]};};exports[_0xa3e1('0x41')]=function(_0x57a906){return _0x57a906['countbusyretry']+_0x57a906['countcongestionretry']+_0x57a906[_0xa3e1('0x42')]+_0x57a906[_0xa3e1('0x43')]+_0x57a906[_0xa3e1('0x44')];};exports['cloneAction']=function(_0x5c3803){var _0x244007=_[_0xa3e1('0x45')](_0x5c3803);_0x244007['state']=0xf;_0x244007[_0xa3e1('0x2a')]=_0xa3e1('0x46');return _0x244007;};exports['scheduledAt']=function(_0x33f250,_0xcb301a,_0x21565b){var _0xcf36bf={};_0xcf36bf[_0xcb301a]=_0x33f250[_0xcb301a];_0xcf36bf[_0xa3e1('0x47')]=![];_0xcf36bf['scheduledat']=moment()[_0xa3e1('0x48')](_0x21565b,'minutes')[_0xa3e1('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0xcf36bf[_0xa3e1('0x10')]=_0x33f250[_0xa3e1('0x10')];_0xcf36bf[_0xa3e1('0x49')]=_0x33f250[_0xa3e1('0x49')];_0xcf36bf['VoiceQueueId']=_0x33f250['VoiceQueueId']||undefined;return _0xcf36bf;};exports[_0xa3e1('0x4a')]=function(_0x2ff795,_0x503427){if(!_[_0xa3e1('0x22')](_0x2ff795)){if(_0x2ff795[_0xa3e1('0x4b')]>0x0){_0x2ff795[_0xa3e1('0x4b')]-=0x1;}else{logger[_0xa3e1('0x24')](_0x503427,_0xa3e1('0x4c'));}}else{logger['error'](_0x503427,_0xa3e1('0x4d'));}};exports['IsNotLoggedIn']=function(_0x214bfb){if(_0x214bfb<=0x0){return!![];}return![];};function buildObj(_0x599f2c,_0x23579f,_0x284da5){_0x599f2c[_0xa3e1('0x4e')]=_0x23579f;_0x599f2c['name']=_0x599f2c['queue'];_0x599f2c[_0xa3e1('0x4f')]=_0x599f2c['channelAgent'];_0x599f2c[_0xa3e1('0x50')]='voice';if(_0x284da5){_0x599f2c[_0xa3e1('0x51')]=_0x284da5['mandatoryDisposition'];}return _0x599f2c;}exports[_0xa3e1('0x52')]=buildObj;exports[_0xa3e1('0x53')]=function(_0x413ce0){var _0x29e090={};_0x29e090[_0xa3e1('0x54')]=_0x413ce0['queue'];_0x29e090[_0xa3e1('0x4f')]=_0x413ce0[_0xa3e1('0x3d')];_0x29e090[_0xa3e1('0x40')]=_0x413ce0['uniqueid'];return _0x29e090;};exports[_0xa3e1('0x55')]=function(_0x1562ff){var _0x996a3b=[];for(var _0x414e47 in _0x1562ff){if(_0x1562ff[_0xa3e1('0x1f')](_0x414e47)){if(!_[_0xa3e1('0x22')](_0x1562ff[_0x414e47])&&_0x1562ff[_0x414e47]['state']==='not_inuse'&&_0x1562ff[_0x414e47][_0xa3e1('0x56')]===_0xa3e1('0x57')){_0x996a3b['push'](_0x1562ff[_0x414e47]['id']);}}}return _0x996a3b;};exports[_0xa3e1('0x58')]=function(_0x368661){var _0x18a949=moment()[_0xa3e1('0x59')](0x0);var _0x5da1a6=moment(_0x368661)['milliseconds'](0x0);return _0x18a949[_0xa3e1('0x5a')](_0x5da1a6,_0xa3e1('0x5b'));};exports['createBody']=function(_0x50d123){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x50d123[_0xa3e1('0x10')],'ListId':_0x50d123['ListId'],'VoiceQueueId':_0x50d123[_0xa3e1('0x5c')]||undefined,'CampaignId':_0x50d123[_0xa3e1('0x5d')]||undefined};};exports[_0xa3e1('0x5e')]=function(_0x18cd56){if(_0x18cd56===_0xa3e1('0x40')||_0x18cd56===_0xa3e1('0x5f')||_0x18cd56===_0xa3e1('0x54')||_0x18cd56===_0xa3e1('0x60')||_0x18cd56==='campaigntype'||_0x18cd56===_0xa3e1('0x61')||_0x18cd56===_0xa3e1('0x31')||_0x18cd56===_0xa3e1('0x3d')||_0x18cd56==='calleridname'||_0x18cd56===_0xa3e1('0x47')||_0x18cd56==='calleridnum'||_0x18cd56===_0xa3e1('0x62')||_0x18cd56===_0xa3e1('0x63')||_0x18cd56===_0xa3e1('0x64')||_0x18cd56==='countnoanswerretry'||_0x18cd56===_0xa3e1('0x65')||_0x18cd56==='callback'||_0x18cd56===_0xa3e1('0x66')||_0x18cd56===_0xa3e1('0x67')||_0x18cd56==='recallme'||_0x18cd56===_0xa3e1('0x10')||_0x18cd56===_0xa3e1('0x49')||_0x18cd56==='UserId'||_0x18cd56===_0xa3e1('0x5c')||_0x18cd56==='sipcallid'||_0x18cd56===_0xa3e1('0x68')||_0x18cd56===_0xa3e1('0x69')||_0x18cd56===_0xa3e1('0x6a')||_0x18cd56===_0xa3e1('0x6b')||_0x18cd56===_0xa3e1('0x6c')||_0x18cd56===_0xa3e1('0x6d')||_0x18cd56===_0xa3e1('0x6e')||_0x18cd56===_0xa3e1('0x6f')||_0x18cd56===_0xa3e1('0x70')||_0x18cd56===_0xa3e1('0x71')||_0x18cd56===_0xa3e1('0x72')||_0x18cd56===_0xa3e1('0x73')||_0x18cd56==='xmd-agiafter'||_0x18cd56===_0xa3e1('0x74')||_0x18cd56===_0xa3e1('0x75')||_0x18cd56===_0xa3e1('0x76')||_0x18cd56==='rtpaudioqosjitter'||_0x18cd56===_0xa3e1('0x77')||_0x18cd56==='rtpaudioqosloss'||_0x18cd56==='rtpaudioqoslossbridged'||_0x18cd56===_0xa3e1('0x78')||_0x18cd56===_0xa3e1('0x79')||_0x18cd56==='rtpaudioqos'||_0x18cd56===_0xa3e1('0x76')||_0x18cd56===_0xa3e1('0x7a')||_0x18cd56==='rtpaudioqosjitterbridged'||_0x18cd56===_0xa3e1('0x7b')||_0x18cd56==='rtpaudioqoslossbridged'||_0x18cd56===_0xa3e1('0x78')||_0x18cd56==='rtpaudioqosrttbridged'||_0x18cd56===_0xa3e1('0x7c')||_0x18cd56==='bridgepvtcallid'||_0x18cd56==='state'||_0x18cd56===_0xa3e1('0x2a')){return![];}return!![];};exports[_0xa3e1('0x7d')]=function(_0x325a59,_0x462f1b){var _0x3b8455,_0x19b228,_0x52a08a;if(_0x462f1b<=0x0){_0x462f1b=0x1;}_0x3b8455=new RegExp('\x5cw{0,'+_0x462f1b+'}$');_0x19b228=Math['pow'](0xa,_0x462f1b-0x1);_0x52a08a=Math[_0xa3e1('0x7e')](0xa,_0x462f1b)-0x1;return util[_0xa3e1('0xc')]('%s',_[_0xa3e1('0x7f')](_0x325a59,_0x3b8455,_[_0xa3e1('0x80')](_0x19b228,_0x52a08a)));};exports['extractCalleridName']=function(_0x22e258){var _0x11f0d8=_0x22e258['match'](/"(.*?)"/);return _0x11f0d8?_0x11f0d8[0x1]:_0x22e258;};exports[_0xa3e1('0x81')]=function(_0x385221){var _0x70aeb0=_0x385221['match'](/<(.*?)>/);return _0x70aeb0?_0x70aeb0[0x1]:_0x385221;};function buildNoAnswerEventPayload(_0x50aa76,_0x21920d){var _0x3d9dc9=buildObj(_0x50aa76,_0xa3e1('0x82'));if(!_['isEmpty'](_0x21920d[_0xa3e1('0x83')])){Object[_0xa3e1('0x84')](_0x21920d[_0xa3e1('0x83')])['forEach'](function(_0x49755f){_0x3d9dc9[_0x49755f[_0xa3e1('0x85')]()]=_0x21920d[_0xa3e1('0x83')][_0x49755f];});}return _0x3d9dc9;}exports[_0xa3e1('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x522b=['bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isNil','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','starttime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','getDiff','milliseconds','diff','seconds','createBody','CampaignId','campaigntype','dialAnswer','scheduledat','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x522b,0xa0));var _0xb522=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x522b[_0x1bd3ab];return _0x37e394;};'use strict';var util=require(_0xb522('0x0'));var _=require(_0xb522('0x1'));var moment=require(_0xb522('0x2'));var logger=require(_0xb522('0x3'))(_0xb522('0x4'));var ipAgi=process[_0xb522('0x5')]['XCALLY_IP_AGI']||_0xb522('0x6');var utils=require(_0xb522('0x7'));exports['loggerCatch']=function(_0x472d81){return function(_0x7f397a){logger[_0xb522('0x8')](_0x472d81,util['inspect'](_0x7f397a,{'showHidden':![],'depth':null}));};};exports[_0xb522('0x9')]=function(_0x42f023,_0x2e6331){logger[_0xb522('0xa')](_0x42f023,util[_0xb522('0xb')](_0x2e6331,{'showHidden':![],'depth':null}));};exports[_0xb522('0xc')]=function(_0x44fe8f,_0x1e4237){logger['error'](_0x44fe8f,util[_0xb522('0xb')](_0x1e4237,{'showHidden':![],'depth':null}));};exports[_0xb522('0xd')]=function(_0x2942c7){return function(_0x116371){logger[_0xb522('0xa')](_0x2942c7,util[_0xb522('0xb')](_0x116371,{'showHidden':![],'depth':null}));};};exports[_0xb522('0xe')]=function(_0x3d2a8a,_0x40edb7,_0x447ef5){return{'message':_0x3d2a8a,'unlock':_0x40edb7,'active':_0x447ef5};};exports[_0xb522('0xf')]=function(_0x4fdc01,_0x1d76de,_0x3cb464){if(!_[_0xb522('0x10')](_0x3cb464)&&_0xb522('0x11')===typeof _0x3cb464&&!_['isEmpty'](_0x3cb464)){if(!_['isUndefined'](_0x1d76de)&&_0xb522('0x11')===typeof _0x1d76de&&!_[_0xb522('0x12')](_0x1d76de)){return util[_0xb522('0x13')]('\x22%s\x22\x20<%s>',_0x1d76de,_0x3cb464);}return util['format']('\x22%s\x22\x20<%s>',_0x3cb464,_0x3cb464);}if(!_['isUndefined'](_0x4fdc01)&&_0xb522('0x11')===typeof _0x4fdc01&&!_[_0xb522('0x12')](_0x4fdc01)){return _0x4fdc01;}return _0xb522('0x14');};exports['isActive']=function(_0x5cb08c){if(_[_0xb522('0x15')](_0x5cb08c)){return![];}return _0x5cb08c;};exports['addVariables']=function(_0x12a06b,_0x2a9507,_0x5533fd,_0x44d66e,_0x2ea882,_0x437651){var _0x10ef6a={'XMD-QUEUE':_0x2a9507['Queue']?_0x2a9507[_0xb522('0x16')][_0xb522('0x17')]:'','XMD-CALLERID':_0x44d66e,'XMD-CALLERID-PREVIEW':_0x437651?util['format'](_0xb522('0x18'),_0x437651[_0xb522('0x19')],_0x437651[_0xb522('0x1a')]):_0x44d66e,'XMD-DIALID':_0x2ea882,'XMD-CONTACTID':_0x2a9507['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x44d66e,'XMD-VOICEQUEUEID':_0x2a9507[_0xb522('0x1b')],'XMD-DIALCHANNEL':_0x5533fd,'XMD-DIALTIMEOUT':_0x12a06b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb522('0x13')](_0xb522('0x1c'),_0x12a06b['dialQueueProject2']?'g':'',_[_0xb522('0x12')](_0x12a06b[_0xb522('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x12a06b[_0xb522('0x1e')]||'','XMD-AGI':_0x12a06b[_0xb522('0x1f')]?util[_0xb522('0x13')](_0xb522('0x20'),ipAgi,_0x12a06b[_0xb522('0x1f')]):_0xb522('0x21'),'XMD-AGIAFTER':_0x12a06b['dialQueueProject2']?util[_0xb522('0x13')](_0xb522('0x20'),ipAgi,_0x12a06b[_0xb522('0x22')]):_0xb522('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x437651?_0x437651[_0xb522('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x437651?_0x437651[_0xb522('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xb522('0x25')};if(!_['isEmpty'](_0x12a06b[_0xb522('0x1d')])){_0x10ef6a[util['format']('%s',_0xb522('0x26'))]=_0x12a06b[_0xb522('0x1d')];_0x10ef6a[util['format']('%s',_0xb522('0x27'))]=_0x2ea882;}return _0x10ef6a;};exports['toLowerVariables']=function(_0x3de286){var _0x142f49={};for(var _0x344a85 in _0x3de286){if(_0x3de286[_0xb522('0x28')](_0x344a85)){_0x142f49[util[_0xb522('0x13')]('%s',_['toLower'](_0x344a85))]=_0x3de286[_0x344a85];}}return{'variables':_0x142f49};};exports[_0xb522('0x29')]=function(_0x3a5f41,_0x220bd0){if(!_[_0xb522('0x15')](_0x3a5f41)){if(_0x3a5f41['hasOwnProperty'](_0xb522('0x2a'))){if(_0x3a5f41[_0xb522('0x2a')]>0x0){_0x3a5f41[_0xb522('0x2a')]-=0x1;}else{logger[_0xb522('0x8')](_0xb522('0x2b'),_0x220bd0);}}}else{logger[_0xb522('0x8')](_0xb522('0x2c'),_0x220bd0);}};exports[_0xb522('0x2d')]=function(_0xdcd8af){var _0x3ef0ec=moment()[_0xb522('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0xdcd8af[_0xb522('0x2e')]=0xd;_0xdcd8af[_0xb522('0x2f')]=_0xb522('0x30');_0xdcd8af['starttime']=_0x3ef0ec;_0xdcd8af[_0xb522('0x31')]=_0x3ef0ec;_0xdcd8af['endtime']=_0x3ef0ec;};exports[_0xb522('0x32')]=function(_0x5ec768,_0x5819f2,_0x34d9d3){var _0x9cf873=moment()[_0xb522('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ec768[_0xb522('0x2e')]=_0x5819f2;_0x5ec768['statedesc']=_0x34d9d3;_0x5ec768[_0xb522('0x31')]=_0x9cf873;_0x5ec768[_0xb522('0x33')]=utils[_0xb522('0x34')](_0x5ec768[_0xb522('0x31')],_0x5ec768['starttime']);};exports[_0xb522('0x35')]=function(_0x287c09,_0x506790,_0xaffb0a){_0x287c09[_0xb522('0x36')]=_0x506790;_0x287c09[_0xb522('0x37')]=_0xaffb0a;};exports[_0xb522('0x38')]=function(_0x3487f0,_0x3c22d4,_0x48b29e){var _0x32765e=moment()[_0xb522('0x13')](_0xb522('0x39'));_0x3487f0[_0xb522('0x2e')]=_0x3c22d4;_0x3487f0['statedesc']=_0x48b29e;_0x3487f0['responsetime']=_0x3487f0['responsetime']?_0x3487f0[_0xb522('0x31')]:_0x32765e;_0x3487f0['endtime']=_0x3487f0['endtime']?_0x3487f0[_0xb522('0x3a')]:_0x32765e;_0x3487f0[_0xb522('0x33')]=utils[_0xb522('0x34')](_0x3487f0[_0xb522('0x31')]||0x0,_0x3487f0[_0xb522('0x3b')]||0x0);_0x3487f0[_0xb522('0x3c')]=_0x3487f0[_0xb522('0x3d')]?utils[_0xb522('0x34')](_0x3487f0[_0xb522('0x3a')],_0x3487f0[_0xb522('0x3d')]):0x0;};exports['isFailure']=function(_0x580186){return _0x580186===_0xb522('0x3e');};exports[_0xb522('0x3f')]=function(_0x10f503,_0x517417,_0x2c59c2,_0x50fdb8,_0x4ab13a){var _0xd468ba=_0x50fdb8?_0xb522('0x40'):_0x10f503[_0xb522('0x19')];_0xd468ba=_0x4ab13a?_0xb522('0x41'):_0xd468ba;return{'actionid':_0x10f503[_0xb522('0x42')],'action':'originate','channel':_0x10f503['channelAgent'],'callerid':util[_0xb522('0x13')](_0xb522('0x18'),_0xd468ba,_0x10f503[_0xb522('0x1a')]),'Exten':_0xb522('0x43'),'Context':_0xb522('0x44'),'Priority':'1','variable':_0x2c59c2,'timeout':(_0x517417[_0xb522('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10f503[_0xb522('0x42')]};};exports[_0xb522('0x46')]=function(_0x324403){return _0x324403[_0xb522('0x47')]+_0x324403[_0xb522('0x48')]+_0x324403[_0xb522('0x49')]+_0x324403[_0xb522('0x4a')]+_0x324403[_0xb522('0x4b')];};exports[_0xb522('0x4c')]=function(_0x22efc4){var _0x2ed7e7=_[_0xb522('0x4d')](_0x22efc4);_0x2ed7e7[_0xb522('0x2e')]=0xf;_0x2ed7e7[_0xb522('0x2f')]=_0xb522('0x4e');return _0x2ed7e7;};exports[_0xb522('0x4f')]=function(_0x34f5ab,_0xb62deb,_0x54a659){var _0x3d9ba0={};_0x3d9ba0[_0xb62deb]=_0x34f5ab[_0xb62deb];_0x3d9ba0[_0xb522('0x50')]=![];_0x3d9ba0['scheduledat']=moment()[_0xb522('0x51')](_0x54a659,'minutes')[_0xb522('0x13')](_0xb522('0x39'));_0x3d9ba0[_0xb522('0x52')]=_0x34f5ab[_0xb522('0x52')];_0x3d9ba0[_0xb522('0x53')]=_0x34f5ab[_0xb522('0x53')];_0x3d9ba0[_0xb522('0x1b')]=_0x34f5ab[_0xb522('0x1b')]||undefined;return _0x3d9ba0;};exports['decrementTalkink']=function(_0x256193,_0x28de3f){if(!_[_0xb522('0x15')](_0x256193)){if(_0x256193[_0xb522('0x54')]>0x0){_0x256193[_0xb522('0x54')]-=0x1;}else{logger[_0xb522('0x8')](_0x28de3f,_0xb522('0x55'));}}else{logger[_0xb522('0x8')](_0x28de3f,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xb522('0x56')]=function(_0x382fa9){if(_0x382fa9<=0x0){return!![];}return![];};function buildObj(_0x2856ef,_0x2ce901,_0x51fcc5){_0x2856ef[_0xb522('0x57')]=_0x2ce901;_0x2856ef[_0xb522('0x17')]=_0x2856ef[_0xb522('0x58')];_0x2856ef['interface']=_0x2856ef[_0xb522('0x59')];_0x2856ef[_0xb522('0x5a')]=_0xb522('0x5b');if(_0x51fcc5){_0x2856ef[_0xb522('0x5c')]=_0x51fcc5[_0xb522('0x5c')];}return _0x2856ef;}exports[_0xb522('0x5d')]=buildObj;exports[_0xb522('0x5e')]=function(_0x1674ce){var _0x52fdfa={};_0x52fdfa[_0xb522('0x58')]=_0x1674ce[_0xb522('0x58')];_0x52fdfa[_0xb522('0x5f')]=_0x1674ce['channelAgent'];_0x52fdfa[_0xb522('0x42')]=_0x1674ce[_0xb522('0x42')];return _0x52fdfa;};exports[_0xb522('0x60')]=function(_0x280b74){var _0x3fb08b=[];for(var _0x5d2c4e in _0x280b74){if(_0x280b74[_0xb522('0x28')](_0x5d2c4e)){if(!_['isNil'](_0x280b74[_0x5d2c4e])&&_0x280b74[_0x5d2c4e][_0xb522('0x2e')]===_0xb522('0x61')&&_0x280b74[_0x5d2c4e][_0xb522('0x62')]===_0xb522('0x63')){_0x3fb08b['push'](_0x280b74[_0x5d2c4e]['id']);}}}return _0x3fb08b;};exports[_0xb522('0x64')]=function(_0x52faff){var _0x3c5463=moment()['milliseconds'](0x0);var _0x5768e9=moment(_0x52faff)[_0xb522('0x65')](0x0);return _0x3c5463[_0xb522('0x66')](_0x5768e9,_0xb522('0x67'));};exports[_0xb522('0x68')]=function(_0x3e5a72){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e5a72[_0xb522('0x52')],'ListId':_0x3e5a72[_0xb522('0x53')],'VoiceQueueId':_0x3e5a72['VoiceQueueId']||undefined,'CampaignId':_0x3e5a72[_0xb522('0x69')]||undefined};};exports['filterKey']=function(_0x2e9970){if(_0x2e9970===_0xb522('0x42')||_0x2e9970==='idContact'||_0x2e9970===_0xb522('0x58')||_0x2e9970==='type'||_0x2e9970===_0xb522('0x6a')||_0x2e9970===_0xb522('0x6b')||_0x2e9970===_0xb522('0x36')||_0x2e9970===_0xb522('0x59')||_0x2e9970===_0xb522('0x19')||_0x2e9970===_0xb522('0x50')||_0x2e9970==='calleridnum'||_0x2e9970===_0xb522('0x6c')||_0x2e9970===_0xb522('0x47')||_0x2e9970==='countcongestionretry'||_0x2e9970===_0xb522('0x49')||_0x2e9970==='countglobal'||_0x2e9970===_0xb522('0x6d')||_0x2e9970===_0xb522('0x6e')||_0x2e9970===_0xb522('0x6f')||_0x2e9970===_0xb522('0x70')||_0x2e9970===_0xb522('0x52')||_0x2e9970===_0xb522('0x53')||_0x2e9970===_0xb522('0x37')||_0x2e9970==='VoiceQueueId'||_0x2e9970===_0xb522('0x71')||_0x2e9970===_0xb522('0x72')||_0x2e9970===_0xb522('0x73')||_0x2e9970==='xmd-phone'||_0x2e9970===_0xb522('0x74')||_0x2e9970===_0xb522('0x75')||_0x2e9970===_0xb522('0x76')||_0x2e9970===_0xb522('0x77')||_0x2e9970===_0xb522('0x78')||_0x2e9970===_0xb522('0x79')||_0x2e9970===_0xb522('0x7a')||_0x2e9970===_0xb522('0x7b')||_0x2e9970==='xmd-callerid'||_0x2e9970===_0xb522('0x7c')||_0x2e9970===_0xb522('0x7d')||_0x2e9970===_0xb522('0x7e')||_0x2e9970===_0xb522('0x7f')||_0x2e9970===_0xb522('0x80')||_0x2e9970===_0xb522('0x81')||_0x2e9970===_0xb522('0x82')||_0x2e9970==='rtpaudioqoslossbridged'||_0x2e9970===_0xb522('0x83')||_0x2e9970===_0xb522('0x84')||_0x2e9970===_0xb522('0x7e')||_0x2e9970==='rtpaudioqosbridged'||_0x2e9970===_0xb522('0x80')||_0x2e9970===_0xb522('0x81')||_0x2e9970==='rtpaudioqosloss'||_0x2e9970===_0xb522('0x85')||_0x2e9970==='rtpaudioqosrtt'||_0x2e9970==='rtpaudioqosrttbridged'||_0x2e9970===_0xb522('0x86')||_0x2e9970===_0xb522('0x87')||_0x2e9970===_0xb522('0x2e')||_0x2e9970===_0xb522('0x2f')){return![];}return!![];};exports[_0xb522('0x88')]=function(_0x11a3fe,_0x5de7c1){var _0x214dcf,_0x3f57a6,_0x6542e9;if(_0x5de7c1<=0x0){_0x5de7c1=0x1;}_0x214dcf=new RegExp(_0xb522('0x89')+_0x5de7c1+'}$');_0x3f57a6=Math[_0xb522('0x8a')](0xa,_0x5de7c1-0x1);_0x6542e9=Math[_0xb522('0x8a')](0xa,_0x5de7c1)-0x1;return util[_0xb522('0x13')]('%s',_[_0xb522('0x8b')](_0x11a3fe,_0x214dcf,_[_0xb522('0x8c')](_0x3f57a6,_0x6542e9)));};exports[_0xb522('0x8d')]=function(_0x3aa8c4){var _0x504e7b=_0x3aa8c4[_0xb522('0x8e')](/"(.*?)"/);return _0x504e7b?_0x504e7b[0x1]:_0x3aa8c4;};exports[_0xb522('0x8f')]=function(_0x2e260b){var _0x34c4a7=_0x2e260b['match'](/<(.*?)>/);return _0x34c4a7?_0x34c4a7[0x1]:_0x2e260b;};function buildNoAnswerEventPayload(_0x5dbef4,_0x484553){var _0x434e80=buildObj(_0x5dbef4,'noanswer');if(!_['isEmpty'](_0x484553[_0xb522('0x90')])){Object[_0xb522('0x91')](_0x484553[_0xb522('0x90')])[_0xb522('0x92')](function(_0x2159ab){_0x434e80[_0x2159ab['toLowerCase']()]=_0x484553[_0xb522('0x90')][_0x2159ab];});}return _0x434e80;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index ad925aa..90c7007 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 _0x45f9=['voicequeuechannel','voicechannel','string','boolean'];(function(_0x10d527,_0x734be2){var _0x59d1a3=function(_0x57b68e){while(--_0x57b68e){_0x10d527['push'](_0x10d527['shift']());}};_0x59d1a3(++_0x734be2);}(_0x45f9,0x1e6));var _0x945f=function(_0x508e06,_0x2b9119){_0x508e06=_0x508e06-0x0;var _0x240910=_0x45f9[_0x508e06];return _0x240910;};'use strict';exports['queueadd']={'queue':{'type':_0x945f('0x0'),'required':!![]},'interface':{'type':_0x945f('0x0'),'required':!![]},'membername':{'type':_0x945f('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x945f('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':_0x945f('0x0'),'required':!![]},'interface':{'type':_0x945f('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x945f('0x1')},'reason':{'type':_0x945f('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x945f('0x0'),'required':![]}};exports[_0x945f('0x2')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x945f('0x3')]={'uniqueid':{'type':_0x945f('0x0'),'required':!![]},'filename':{'type':_0x945f('0x0')},'format':{'type':_0x945f('0x0')},'mixmonitorid':{'type':_0x945f('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x945f('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x945f('0x0'),'required':!![]},'exten':{'type':_0x945f('0x0'),'required':!![]},'context':{'type':_0x945f('0x0')}}; \ No newline at end of file +var _0xbf7c=['voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','voicequeuechannel','voicechannel'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbf7c,0x161));var _0xcbf7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbf7c[_0x397e5f];return _0x5302b8;};'use strict';exports[_0xcbf7('0x0')]={'queue':{'type':_0xcbf7('0x1'),'required':!![]},'interface':{'type':_0xcbf7('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xcbf7('0x2'),'required':![]},'paused':{'type':_0xcbf7('0x3'),'required':![]}};exports[_0xcbf7('0x4')]={'queue':{'type':_0xcbf7('0x1'),'required':!![]},'interface':{'type':_0xcbf7('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xcbf7('0x1'),'required':!![]},'paused':{'type':_0xcbf7('0x3')},'reason':{'type':_0xcbf7('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xcbf7('0x5')]={'uniqueid':{'type':_0xcbf7('0x1'),'required':!![]}};exports[_0xcbf7('0x6')]={'uniqueid':{'type':_0xcbf7('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xcbf7('0x1')},'mixmonitorid':{'type':_0xcbf7('0x1')}};exports[_0xcbf7('0x7')]={'uniqueid':{'type':_0xcbf7('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xcbf7('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xcbf7('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 352c61c..c10f50b 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x2df1d7,_0x5ea1cf){var _0x25e681=function(_0x55afc3){while(--_0x55afc3){_0x2df1d7['push'](_0x2df1d7['shift']());}};_0x25e681(++_0x5ea1cf);}(_0xdb28,0x106));var _0x8db2=function(_0xf91ad6,_0xe5889f){_0xf91ad6=_0xf91ad6-0x0;var _0x26426c=_0xdb28[_0xf91ad6];return _0x26426c;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x450dd2,_0x1f1c8f){var _0x296d6c=function(_0x254a96){while(--_0x254a96){_0x450dd2['push'](_0x450dd2['shift']());}};_0x296d6c(++_0x1f1c8f);}(_0xdb28,0x106));var _0x8db2=function(_0x3a860b,_0x56128c){_0x3a860b=_0x3a860b-0x0;var _0x10cee0=_0xdb28[_0x3a860b];return _0x10cee0;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 42e72d9..853ee12 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d09=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x15112a,_0x212d97){var _0x42a942=function(_0x2bf2cf){while(--_0x2bf2cf){_0x15112a['push'](_0x15112a['shift']());}};_0x42a942(++_0x212d97);}(_0x5d09,0x169));var _0x95d0=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x5d09[_0x1b25c1];return _0x1e4447;};'use strict';function mergeDBDataToRealtime(_0x35b145,_0x11579a){var _0x14de98=Object[_0x95d0('0x0')]({},_0x35b145);for(var _0x3ef1e5 in _0x11579a){if(_0x14de98[_0x95d0('0x1')](_0x3ef1e5)){_0x14de98[_0x3ef1e5]=_0x11579a[_0x3ef1e5];}}return _0x14de98;}exports[_0x95d0('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xe8c1=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0xf95b26,_0x2f21da){var _0x3556a5=function(_0x48ed23){while(--_0x48ed23){_0xf95b26['push'](_0xf95b26['shift']());}};_0x3556a5(++_0x2f21da);}(_0xe8c1,0x17c));var _0x1e8c=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0xe8c1[_0x29f80e];return _0x5c7eaa;};'use strict';function mergeDBDataToRealtime(_0x51c692,_0x594a3f){var _0x374c39=Object['assign']({},_0x51c692);for(var _0x5be6d0 in _0x594a3f){if(_0x374c39[_0x1e8c('0x0')](_0x5be6d0)){_0x374c39[_0x5be6d0]=_0x594a3f[_0x5be6d0];}}return _0x374c39;}exports[_0x1e8c('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 74215d5..3abd19a 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 _0xe70f=['exten','xcally-motion-dialer','create','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','util','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','keys','getCallType','channel','getAgentByInternal','calleridnum','internal','destination','dialer','queue','lastdata','context','from-voip-provider','callerid','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','split','membername','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinenum','connectedlinename'];(function(_0x2fe0f3,_0x5a7264){var _0x3aea8c=function(_0x56f561){while(--_0x56f561){_0x2fe0f3['push'](_0x2fe0f3['shift']());}};_0x3aea8c(++_0x5a7264);}(_0xe70f,0xc5));var _0xfe70=function(_0x34053d,_0x5ca87c){_0x34053d=_0x34053d-0x0;var _0x25d763=_0xe70f[_0x34053d];return _0x25d763;};'use strict';var _=require(_0xfe70('0x0'));var moment=require('moment');var util=require(_0xfe70('0x1'));var config=require(_0xfe70('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xfe70('0x3'));var RpcVoiceDialReport=require(_0xfe70('0x4'));var RpcMemberReport=require(_0xfe70('0x5'));var RpcVoiceQueueReport=require(_0xfe70('0x6'));var RpcVoiceRecording=require(_0xfe70('0x7'));var RpcVoiceTransferReport=require(_0xfe70('0x8'));var VoiceQueueReport=require(_0xfe70('0x9'));var VoiceCallReport=require(_0xfe70('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xfe70('0xb'));function Report(_0x4316ee){this[_0xfe70('0xc')]=_0x4316ee;this[_0xfe70('0xd')]=_0x4316ee[_0xfe70('0xd')];this[_0xfe70('0xe')]=_0x4316ee[_0xfe70('0xe')];}Report[_0xfe70('0xf')][_0xfe70('0x10')]=function(_0x2d5675){var _0x5ce1b1=new VoiceQueueReport(this[_0xfe70('0xc')]);var _0x1c056b=new VoiceAgentReport(this['realtime']);var _0x132b72=new VoiceDialReport(this[_0xfe70('0xc')]);var _0x416699=new VoiceCallReport(this[_0xfe70('0xc')]);var _0x4b088e=new UserReport(this[_0xfe70('0xc')]);if(config[_0xfe70('0x11')]&&config[_0xfe70('0x11')][_0xfe70('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xfe70('0x13')][_0xfe70('0x14')](this));ami['on'](_0xfe70('0x15'),this[_0xfe70('0x16')][_0xfe70('0x14')](this));ami['on'](_0xfe70('0x17'),this[_0xfe70('0x18')]['bind'](this));ami['on'](_0xfe70('0x19'),this[_0xfe70('0x1a')][_0xfe70('0x14')](this));ami['on'](_0xfe70('0x1b'),this[_0xfe70('0x1c')]['bind'](this));ami['on'](_0xfe70('0x1d'),this['attendedTransfer'][_0xfe70('0x14')](this));}};Report['prototype'][_0xfe70('0x1e')]=function(_0x480a2d){var _0x4ee5a2;_0x4ee5a2=_[_0xfe70('0x1f')](this[_0xfe70('0xd')],function(_0x546c4b){return _0x546c4b[_0xfe70('0x20')]==_0x480a2d||_0x546c4b[_0xfe70('0x21')]==_0x480a2d;});if(_[_0xfe70('0x22')](_0x4ee5a2)){var _0x4181ea=_['find'](this[_0xfe70('0xe')],function(_0x32fcc7){return _0x32fcc7[_0xfe70('0x20')]==_0x480a2d||_0x32fcc7[_0xfe70('0x21')]==_0x480a2d;});if(_0x4181ea){_0x4ee5a2=_[_0xfe70('0x1f')](this['agents'],function(_0x239f7b){return _0x239f7b[_0xfe70('0x23')]==util[_0xfe70('0x24')](_0xfe70('0x25'),_0x4181ea[_0xfe70('0x21')]);});}}return _0x4ee5a2;};Report['prototype'][_0xfe70('0x13')]=function(_0x54fdff){for(var _0x42ca92=0x0;_0x42ca92<_0x54fdff[_0xfe70('0x26')];_0x42ca92+=0x1){var _0x519cfc=this['findAgent'](_0x54fdff[_0x42ca92]['connectedlinenum']);if(_0x519cfc){_0x54fdff[_0x42ca92][_0xfe70('0x20')]=_0x519cfc['accountcode'];_0x54fdff[_0x42ca92]['assigned']=!![];_0x54fdff[_0x42ca92][_0xfe70('0x27')]=_0x519cfc[_0xfe70('0x21')];_0x54fdff[_0x42ca92][_0xfe70('0x23')]=_[_0xfe70('0x22')](_0x519cfc[_0xfe70('0x23')])?util[_0xfe70('0x24')](_0xfe70('0x25'),_0x519cfc[_0xfe70('0x21')]):_0x519cfc[_0xfe70('0x23')];if(_0x54fdff[_0x42ca92][_0xfe70('0x28')]){_0x54fdff[_0x42ca92]['queuecallercompleteAt']=moment()['format'](_0xfe70('0x29'));}if(_0x54fdff[_0x42ca92][_0xfe70('0x2a')]){_0x54fdff[_0x42ca92][_0xfe70('0x2b')]=moment()[_0xfe70('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xfe70('0x13')](_0x54fdff[_0x42ca92]);}RpcVoiceQueueReport['create'](_0x54fdff[_0x42ca92]);}};function extractCalleridNumber(_0xf8ced6){var _0x560c03=_0xf8ced6['match'](/<(.*?)>/);return _0x560c03?_0x560c03[0x1]:_0xf8ced6;}Report[_0xfe70('0xf')]['getAgentByInternal']=function(_0x758f59){for(var _0x3286ea=0x0;_0x3286ea','calleridname','transfers','linkedid','type','UserId','create','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','originatecalleridnum','isArray','startsWith','substring','indexOf','phone','lastIndexOf','transfererlinkedid'];(function(_0x1c9dbd,_0x3e7d0c){var _0x9ab4ba=function(_0x5d0696){while(--_0x5d0696){_0x1c9dbd['push'](_0x1c9dbd['shift']());}};_0x9ab4ba(++_0x3e7d0c);}(_0x7887,0x10f));var _0x7788=function(_0xce399b,_0x4ed5a3){_0xce399b=_0xce399b-0x0;var _0x57df14=_0x7887[_0xce399b];return _0x57df14;};'use strict';var _=require('lodash');var moment=require(_0x7788('0x0'));var util=require(_0x7788('0x1'));var config=require('../../../config/environment');var ami=require(_0x7788('0x2'));var RpcVoiceAgentReport=require(_0x7788('0x3'));var RpcVoiceCallReport=require(_0x7788('0x4'));var RpcVoiceDialReport=require(_0x7788('0x5'));var RpcMemberReport=require(_0x7788('0x6'));var RpcVoiceQueueReport=require(_0x7788('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7788('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x7788('0x9'));var VoiceDialReport=require(_0x7788('0xa'));var UserReport=require(_0x7788('0xb'));function Report(_0xa13d28){this['realtime']=_0xa13d28;this[_0x7788('0xc')]=_0xa13d28[_0x7788('0xc')];this[_0x7788('0xd')]=_0xa13d28[_0x7788('0xd')];}Report['prototype']['sync']=function(_0x167695){var _0x59f4da=new VoiceQueueReport(this[_0x7788('0xe')]);var _0x29236b=new VoiceAgentReport(this['realtime']);var _0x7820b5=new VoiceDialReport(this['realtime']);var _0x35a8ae=new VoiceCallReport(this[_0x7788('0xe')]);var _0xb2bfd3=new UserReport(this['realtime']);if(config[_0x7788('0xf')]&&config[_0x7788('0xf')]['disabled']){ami['on'](_0x7788('0x10'),this[_0x7788('0x11')][_0x7788('0x12')](this));ami['on'](_0x7788('0x13'),this['voiceCallReport'][_0x7788('0x12')](this));ami['on'](_0x7788('0x14'),this[_0x7788('0x15')]['bind'](this));ami['on'](_0x7788('0x16'),this[_0x7788('0x17')][_0x7788('0x12')](this));ami['on'](_0x7788('0x18'),this[_0x7788('0x19')][_0x7788('0x12')](this));ami['on'](_0x7788('0x1a'),this[_0x7788('0x1b')][_0x7788('0x12')](this));}};Report[_0x7788('0x1c')]['findAgent']=function(_0x38a29e){var _0x5342d2;_0x5342d2=_[_0x7788('0x1d')](this[_0x7788('0xc')],function(_0xe65dd6){return _0xe65dd6[_0x7788('0x1e')]==_0x38a29e||_0xe65dd6[_0x7788('0x1f')]==_0x38a29e;});if(_[_0x7788('0x20')](_0x5342d2)){var _0x51aafd=_[_0x7788('0x1d')](this[_0x7788('0xd')],function(_0x4946a4){return _0x4946a4[_0x7788('0x1e')]==_0x38a29e||_0x4946a4[_0x7788('0x1f')]==_0x38a29e;});if(_0x51aafd){_0x5342d2=_['find'](this[_0x7788('0xc')],function(_0x1ab642){return _0x1ab642[_0x7788('0x21')]==util[_0x7788('0x22')](_0x7788('0x23'),_0x51aafd[_0x7788('0x1f')]);});}}return _0x5342d2;};Report['prototype'][_0x7788('0x11')]=function(_0x192de8){for(var _0x155c6b=0x0;_0x155c6b<_0x192de8[_0x7788('0x24')];_0x155c6b+=0x1){var _0xda6be6=this[_0x7788('0x25')](_0x192de8[_0x155c6b][_0x7788('0x26')]);if(_0xda6be6){_0x192de8[_0x155c6b]['accountcode']=_0xda6be6['accountcode'];_0x192de8[_0x155c6b][_0x7788('0x27')]=!![];_0x192de8[_0x155c6b]['lastAssignedTo']=_0xda6be6[_0x7788('0x1f')];_0x192de8[_0x155c6b][_0x7788('0x21')]=_['isNil'](_0xda6be6[_0x7788('0x21')])?util['format']('SIP/%s',_0xda6be6[_0x7788('0x1f')]):_0xda6be6['interface'];if(_0x192de8[_0x155c6b][_0x7788('0x28')]){_0x192de8[_0x155c6b][_0x7788('0x29')]=moment()[_0x7788('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x192de8[_0x155c6b]['queuecallerexit']){_0x192de8[_0x155c6b][_0x7788('0x2a')]=moment()[_0x7788('0x22')](_0x7788('0x2b'));}RpcMemberReport[_0x7788('0x11')](_0x192de8[_0x155c6b]);}RpcVoiceQueueReport['create'](_0x192de8[_0x155c6b]);}};function extractCalleridNumber(_0x555e0b){var _0x408ba7=_0x555e0b[_0x7788('0x2c')](/<(.*?)>/);return _0x408ba7?_0x408ba7[0x1]:_0x555e0b;}Report[_0x7788('0x1c')][_0x7788('0x2d')]=function(_0x4c028e){for(var _0x34ae71=0x0;_0x34ae710x0?!![]:![];if(!_0x58dec){return this[_0x1bff('0x1b')](this[_0x1bff('0x16')][_0x1bff('0x6d')]);}};VoiceQueueReport['prototype'][_0x1bff('0x6e')]=function(_0x3e2fb0){var _0x4b2d6f=this[_0x1bff('0x16')]['id'];if(this[_0x1bff('0x16')]['queuestatus'][_0x4b2d6f]&&this[_0x1bff('0x16')][_0x1bff('0x63')][_0x4b2d6f][_0x3e2fb0[_0x1bff('0x62')]]){this[_0x1bff('0x16')][_0x1bff('0x63')][_0x4b2d6f][_0x3e2fb0[_0x1bff('0x62')]][_0x1bff('0x12')][_0x1bff('0x6f')](_0x3e2fb0);}};VoiceQueueReport['prototype'][_0x1bff('0x19')]=function(_0x1d0053){var _0x4260be=this;try{if(this[_0x1bff('0x5d')](_0x1d0053)&&this[_0x1bff('0x5d')](_0x1d0053[_0x1bff('0x51')])){logger[_0x1bff('0x4d')](_0x1bff('0x70'),util[_0x1bff('0x41')](_0x1d0053,{'showHidden':![],'depth':null}));var _0x4cf93a=this['voiceQueues'][_0x1d0053[_0x1bff('0x51')]];if(_0x4cf93a){logger[_0x1bff('0x4d')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x4cf93a[_0x1bff('0x5c')]);this[_0x1bff('0x16')][_0x1bff('0x5f')][_0x4cf93a[_0x1bff('0x5c')]]={'summaryEvent':_0x1d0053};this[_0x1bff('0x16')][_0x1bff('0x6c')]+=0x1;return ami[_0x1bff('0x3b')]({'action':_0x1bff('0x63'),'queue':_0x4cf93a[_0x1bff('0x5c')]})[_0x1bff('0x61')](function(_0x35ff83){if(!_0x4260be['summary'][_0x1bff('0x63')][_0x1d0053[_0x1bff('0x62')]]){_0x4260be[_0x1bff('0x16')][_0x1bff('0x63')][_0x1d0053[_0x1bff('0x62')]]={};}_0x4260be[_0x1bff('0x16')][_0x1bff('0x63')][_0x1d0053['actionid']][_0x35ff83[_0x1bff('0x62')]]={'queue':_0x4cf93a[_0x1bff('0x5c')],'agents':[]};})[_0x1bff('0x3e')](function(_0x278813){throw _0x278813;});}}}catch(_0x591189){logger[_0x1bff('0x42')](_0x1bff('0x71'),util[_0x1bff('0x41')](_0x591189,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1bff('0x1b')]=function(_0x2a76f6){if(this['summary'][_0x1bff('0x6c')]>0x0){this[_0x1bff('0x16')][_0x1bff('0x6d')]=_0x2a76f6;return;}logger[_0x1bff('0x4d')](_0x1bff('0x72'),util['inspect'](_0x2a76f6,{'showHidden':![],'depth':null}));this[_0x1bff('0x16')]=initializeSummary();ami['emit'](_0x1bff('0x73'),{});};VoiceQueueReport[_0x1bff('0xc')]['syncQueueCallerJoin']=function(_0x176738){try{if(this[_0x1bff('0x5d')](_0x176738)){logger['debug'](_0x1bff('0x74'),_0x176738['uniqueid'],util[_0x1bff('0x41')](_0x176738,{'showHidden':![],'depth':null}));if(_[_0x1bff('0x5e')](this[_0x1bff('0x10')][_0x176738['uniqueid']])){this['queueReports'][_0x176738[_0x1bff('0x4f')]]=[];}if(_[_0x1bff('0x5e')](this[_0x1bff('0x13')][_0x176738['uniqueid']])){this['channels'][_0x176738[_0x1bff('0x4f')]]={};}var _0x56744f=new QueueReport();_0x56744f[_0x1bff('0x51')]=_0x176738[_0x1bff('0x51')];_0x56744f[_0x1bff('0x5a')]=this[_0x1bff('0x48')][_0x56744f[_0x1bff('0x51')]]&&this['voiceQueues'][_0x56744f[_0x1bff('0x51')]][_0x1bff('0x5a')]?this[_0x1bff('0x48')][_0x56744f[_0x1bff('0x51')]][_0x1bff('0x5a')]||_0x1bff('0x68'):_0x1bff('0x68');_0x56744f[_0x1bff('0x75')]=moment()[_0x1bff('0x50')](_0x1bff('0x76'));_0x56744f[_0x1bff('0x77')]=_0x176738['position'];_0x56744f[_0x1bff('0x78')]=_0x176738[_0x1bff('0x78')];_0x56744f[_0x1bff('0x4f')]=_0x176738[_0x1bff('0x4f')];_0x56744f['routealias']=this['channels'][_0x176738['uniqueid']][_0x1bff('0x79')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x56744f[_0x1bff('0x51')],_0x56744f['type']);Object[_0x1bff('0x67')](_0x56744f,_[_0x1bff('0x7a')](_0x176738,_[_0x1bff('0x7b')](_0x56744f)));this[_0x1bff('0x10')][_0x176738[_0x1bff('0x4f')]][_0x1bff('0x6f')](_0x56744f);this[_0x1bff('0x13')][_0x176738[_0x1bff('0x4f')]]=_0x56744f;this[_0x1bff('0x4c')](_0x56744f,'queuecallerjoin');}}catch(_0x45ebc0){logger[_0x1bff('0x42')]('[%s][voiceQueueReport][queuecallerjoin]',_0x176738[_0x1bff('0x4f')],util['inspect'](_0x45ebc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')][_0x1bff('0x22')]=function(_0x1e8cf9){try{if(this['isNotNull'](_0x1e8cf9)){logger[_0x1bff('0x4d')](_0x1bff('0x7c'),_0x1e8cf9['uniqueid'],util['inspect'](_0x1e8cf9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1e8cf9[_0x1bff('0x4f')]]){var _0x14642c=_[_0x1bff('0x7d')](this['queueReports'][_0x1e8cf9[_0x1bff('0x4f')]]);_0x14642c[_0x1bff('0x7e')]=![];_0x14642c['queuecallercompleteAt']=null;_0x14642c['holdtime']=_0x1e8cf9[_0x1bff('0x7f')];_0x14642c[_0x1bff('0x80')]=_0x1e8cf9['originalposition'];_0x14642c['queuecallerabandon']=!![];_0x14642c['queuecallerabandonAt']=moment()[_0x1bff('0x50')](_0x1bff('0x76'));_0x14642c[_0x1bff('0x55')]=_0x1bff('0x81');_0x14642c[_0x1bff('0x82')]=null;logger[_0x1bff('0x83')](_0x1bff('0x84'),_0x14642c[_0x1bff('0x51')],_0x14642c[_0x1bff('0x5a')]);this['channels'][_0x1e8cf9['uniqueid']]=_0x14642c;this['emitVoiceQueueChannelRemove'](_0x14642c,_0x1bff('0x21'));}}}catch(_0x370dd9){logger[_0x1bff('0x42')](_0x1bff('0x7c'),_0x1e8cf9['uniqueid'],util['inspect'](_0x370dd9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')][_0x1bff('0x85')]=function(_0x542fdc){try{if(this['isNotNull'](_0x542fdc)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x542fdc[_0x1bff('0x4f')],util[_0x1bff('0x41')](_0x542fdc,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x542fdc['uniqueid']]){var _0x5046b0=_[_0x1bff('0x7d')](this[_0x1bff('0x10')][_0x542fdc[_0x1bff('0x4f')]]);_0x5046b0['queuecallerleaveAt']=moment()[_0x1bff('0x50')](_0x1bff('0x76'));_0x5046b0[_0x1bff('0x86')]=_0x542fdc[_0x1bff('0x86')];_0x5046b0['connectedlinename']=_0x542fdc[_0x1bff('0x87')];logger[_0x1bff('0x83')](_0x1bff('0x88'),_0x5046b0[_0x1bff('0x51')],_0x5046b0[_0x1bff('0x5a')],_0x542fdc[_0x1bff('0x86')],_0x542fdc['connectedlinename']);this[_0x1bff('0x13')][_0x542fdc[_0x1bff('0x4f')]]=_0x5046b0;this[_0x1bff('0x4c')](_0x5046b0,'queuecallerleave');}}}catch(_0x20e15f){logger[_0x1bff('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x542fdc[_0x1bff('0x4f')],util[_0x1bff('0x41')](_0x20e15f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')][_0x1bff('0x27')]=function(_0x54ad15){try{if(this['isNotNull'](_0x54ad15)){logger[_0x1bff('0x4d')](_0x1bff('0x89'),_0x54ad15['uniqueid'],util['inspect'](_0x54ad15,{'showHidden':![],'depth':null}));if(this[_0x1bff('0x10')][_0x54ad15[_0x1bff('0x4f')]]){var _0xfc6a8c=_[_0x1bff('0x7d')](this[_0x1bff('0x10')][_0x54ad15['uniqueid']]);_0xfc6a8c[_0x1bff('0x7e')]=!![];_0xfc6a8c[_0x1bff('0x55')]=_0x1bff('0x8a');logger[_0x1bff('0x83')](_0x1bff('0x8b'),_0xfc6a8c['queue'],_0xfc6a8c[_0x1bff('0x5a')]);}}}catch(_0x475ba2){logger[_0x1bff('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x54ad15[_0x1bff('0x4f')],util[_0x1bff('0x41')](_0x475ba2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')][_0x1bff('0x25')]=function(_0x3cafa6){try{if(this[_0x1bff('0x5d')](_0x3cafa6)){logger[_0x1bff('0x4d')](_0x1bff('0x8c'),_0x3cafa6['uniqueid'],util['inspect'](_0x3cafa6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3cafa6['uniqueid']]){var _0x400089=_[_0x1bff('0x7d')](this[_0x1bff('0x10')][_0x3cafa6[_0x1bff('0x4f')]]);_0x400089[_0x1bff('0x21')]=![];_0x400089['queuecallerabandonAt']=null;_0x400089['assigned']=!![];_0x400089[_0x1bff('0x82')]=_0x3cafa6[_0x1bff('0x8d')];_0x400089[_0x1bff('0x7f')]=_0x3cafa6['holdtime'];_0x400089[_0x1bff('0x7e')]=!![];_0x400089[_0x1bff('0x37')]=![];_0x400089[_0x1bff('0x8e')]=null;if(!_0x400089['transfer']){if(_0x3cafa6[_0x1bff('0x8f')]=='transfer'){_0x400089[_0x1bff('0x55')]=_0x1bff('0x90');logger['info'](_0x1bff('0x91'),_0x400089[_0x1bff('0x51')],_0x400089[_0x1bff('0x5a')]);}else{if(_['startsWith'](_0x3cafa6[_0x1bff('0x3d')]['toLowerCase'](),_0x1bff('0x92'))){if(this[_0x1bff('0x10')][_0x3cafa6['linkedid']]){var _0x5368a5=_[_0x1bff('0x7d')](this[_0x1bff('0x10')][_0x3cafa6['linkedid']]);_0x5368a5[_0x1bff('0x7e')]=![];_0x5368a5[_0x1bff('0x37')]=!![];_0x5368a5['queuecallerexitAt']=moment(_0x400089[_0x1bff('0x75')])[_0x1bff('0x93')](_0x3cafa6[_0x1bff('0x7f')],_0x1bff('0x94'))[_0x1bff('0x50')](_0x1bff('0x76'));_0x5368a5[_0x1bff('0x55')]=_0x1bff('0x95');_0x5368a5['transfer']=!![];_0x5368a5['transfertype']=_0x1bff('0x96');_0x5368a5[_0x1bff('0x97')]=_0x3cafa6[_0x1bff('0x98')];_0x5368a5[_0x1bff('0x99')]=_0x3cafa6['uniqueid'];logger[_0x1bff('0x83')](_0x1bff('0x9a'),_0x5368a5[_0x1bff('0x51')],_0x5368a5[_0x1bff('0x5a')]);var _0x317639=this[_0x1bff('0x10')][_0x3cafa6[_0x1bff('0x9b')]];this[_0x1bff('0x10')][_0x3cafa6[_0x1bff('0x9b')]]=this[_0x1bff('0x10')][_0x3cafa6[_0x1bff('0x4f')]];this[_0x1bff('0x10')][_0x3cafa6[_0x1bff('0x4f')]]=_0x317639;}}else{_0x400089[_0x1bff('0x55')]=_0x1bff('0x9c')+_0x3cafa6['reason'][_0x1bff('0x9d')]();logger[_0x1bff('0x83')](_0x1bff('0x9e'),_0x400089['queue'],_0x400089['type'],_0x400089[_0x1bff('0x55')]);}}}this[_0x1bff('0x13')][_0x3cafa6[_0x1bff('0x4f')]]=_0x400089;}}}catch(_0x54283f){logger['error'](_0x1bff('0x8c'),_0x3cafa6[_0x1bff('0x4f')],util['inspect'](_0x54283f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')]['syncVarSet']=function(_0x44bdcf){try{if(this[_0x1bff('0x5d')](_0x44bdcf)){logger[_0x1bff('0x4d')](_0x1bff('0x9f'),_0x44bdcf[_0x1bff('0x4f')],util[_0x1bff('0x41')](_0x44bdcf,{'showHidden':![],'depth':null}));this[_0x1bff('0xa0')](_0x44bdcf[_0x1bff('0x4f')],_[_0x1bff('0x7b')](_0x44bdcf[_0x1bff('0xa1')])[0x0],_0x44bdcf[_0x1bff('0xa2')]);if(this[_0x1bff('0x10')][_0x44bdcf[_0x1bff('0x4f')]]){var _0x16453f=_[_0x1bff('0x7d')](this[_0x1bff('0x10')][_0x44bdcf[_0x1bff('0x4f')]]);if(_0x16453f){if(this[_0x1bff('0x5d')](_0x44bdcf[_0x1bff('0xa1')])&&this[_0x1bff('0x5d')](_0x44bdcf[_0x1bff('0xa1')][_0x1bff('0x63')])){switch(_0x44bdcf[_0x1bff('0xa2')]){case _0x1bff('0xa3'):_0x16453f[_0x1bff('0x37')]=![];_0x16453f[_0x1bff('0x8e')]=null;break;case _0x1bff('0xa4'):_0x16453f['lastevent']='timeout';_0x16453f[_0x1bff('0x37')]=!![];_0x16453f[_0x1bff('0x8e')]=moment()[_0x1bff('0x50')](_0x1bff('0x76'));_0x16453f[_0x1bff('0xa5')]=moment()[_0x1bff('0x50')](_0x1bff('0x76'));logger[_0x1bff('0x4d')](_0x1bff('0xa6'),_0x44bdcf['uniqueid'],util[_0x1bff('0x41')](_0x16453f,{'showHidden':![],'depth':null}));ami[_0x1bff('0x4b')](_0x1bff('0xa7'),_0x16453f);break;default:_0x16453f[_0x1bff('0x37')]=!![];_0x16453f['queuecallerexitAt']=moment()['format'](_0x1bff('0x76'));_0x16453f[_0x1bff('0xa5')]=moment()[_0x1bff('0x50')](_0x1bff('0x76'));}_0x16453f[_0x1bff('0x21')]=![];_0x16453f[_0x1bff('0xa8')]=null;_0x16453f[_0x1bff('0x55')]=_0x44bdcf['value'];this[_0x1bff('0x13')][_0x44bdcf[_0x1bff('0x4f')]]=_0x16453f;this[_0x1bff('0x49')](_0x16453f,'varset');}else if(this[_0x1bff('0x5d')](_0x44bdcf['variable'])&&this[_0x1bff('0x5d')](_0x44bdcf[_0x1bff('0xa1')][_0x1bff('0xa9')])){if(!_0x16453f[_0x1bff('0x21')]){_0x16453f[_0x1bff('0x37')]=!![];_0x16453f[_0x1bff('0x8e')]=moment()[_0x1bff('0x50')](_0x1bff('0x76'));_0x16453f[_0x1bff('0x55')]=_0x1bff('0xaa');_0x16453f[_0x1bff('0xa5')]=moment()[_0x1bff('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1bff('0x13')][_0x44bdcf[_0x1bff('0x4f')]]=_0x16453f;}}logger['info'](_0x1bff('0xab'),_0x44bdcf[_0x1bff('0x4f')],_0x16453f[_0x1bff('0x51')],_0x16453f['type'],_[_0x1bff('0x7b')](_0x44bdcf['variable'])[0x0],_0x44bdcf[_0x1bff('0xa2')]);_0x16453f[_0x1bff('0x17')]=this['variables'][_0x44bdcf[_0x1bff('0x4f')]];}}}}catch(_0x405294){logger['error'](_0x1bff('0x9f'),_0x44bdcf[_0x1bff('0x4f')],util[_0x1bff('0x41')](_0x405294,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1bff('0xc')][_0x1bff('0xa0')]=function(_0xe5da0,_0x447898,_0xd5690c){var _0x398c17=['rtpaudioqos',_0x1bff('0xac'),_0x1bff('0xad'),_0x1bff('0xae'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x1bff('0xaf'),'rtpaudioqosrttbridged',_0x1bff('0xb0'),_0x1bff('0xb1'),'bridgepeer','bridgepvtcallid',_0x1bff('0xb2'),_0x1bff('0xb3'),_0x1bff('0xb4'),_0x1bff('0xb5'),_0x1bff('0x8d'),_0x1bff('0xb6'),'memberrealtime'];if(!_[_0x1bff('0x3a')](_0x447898)&&!_[_0x1bff('0xb7')](_0x398c17,_0x447898)){if(_[_0x1bff('0x5e')](this[_0x1bff('0x17')][_0xe5da0])){this[_0x1bff('0x17')][_0xe5da0]={};}this[_0x1bff('0x17')][_0xe5da0][_0x447898]=_0xd5690c;}};VoiceQueueReport[_0x1bff('0xc')]['handleHangup']=function(_0xd6ec87,_0x18a211,_0x4e41ef){try{var _0x35bf06={};if(this[_0x1bff('0x10')][_0xd6ec87]){for(var _0x2081b2=0x0;_0x2081b20x0?!![]:![];if(!_0x5ed469){return this[_0x73aa('0x1c')](this['summary'][_0x73aa('0x76')]);}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x1d')]=function(_0x4c2aa1){var _0x4d4a4b=this['summary']['id'];if(this['summary']['queuestatus'][_0x4d4a4b]&&this[_0x73aa('0x4c')][_0x73aa('0x72')][_0x4d4a4b][_0x4c2aa1[_0x73aa('0x69')]]){this[_0x73aa('0x4c')][_0x73aa('0x72')][_0x4d4a4b][_0x4c2aa1[_0x73aa('0x69')]][_0x73aa('0x4b')][_0x73aa('0x77')](_0x4c2aa1);}};VoiceQueueReport[_0x73aa('0xd')]['syncQueueSummary']=function(_0x43c0ac){var _0x5d38ef=this;try{if(this[_0x73aa('0x78')](_0x43c0ac)&&this[_0x73aa('0x78')](_0x43c0ac['queue'])){logger[_0x73aa('0x51')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x73aa('0x45')](_0x43c0ac,{'showHidden':![],'depth':null}));var _0x2224a2=this['voiceQueues'][_0x43c0ac[_0x73aa('0x56')]];if(_0x2224a2){logger[_0x73aa('0x51')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x2224a2[_0x73aa('0x62')]);this[_0x73aa('0x4c')][_0x73aa('0x6b')][_0x2224a2[_0x73aa('0x62')]]={'summaryEvent':_0x43c0ac};this[_0x73aa('0x4c')][_0x73aa('0x75')]+=0x1;return ami[_0x73aa('0x67')]({'action':'queuestatus','queue':_0x2224a2['name']})[_0x73aa('0x68')](function(_0x3b63af){if(!_0x5d38ef[_0x73aa('0x4c')]['queuestatus'][_0x43c0ac[_0x73aa('0x69')]]){_0x5d38ef[_0x73aa('0x4c')][_0x73aa('0x72')][_0x43c0ac[_0x73aa('0x69')]]={};}_0x5d38ef['summary']['queuestatus'][_0x43c0ac[_0x73aa('0x69')]][_0x3b63af[_0x73aa('0x69')]]={'queue':_0x2224a2['name'],'agents':[]};})[_0x73aa('0x41')](function(_0x48edd7){throw _0x48edd7;});}}}catch(_0x2fe0ac){logger['error'](_0x73aa('0x6a'),util['inspect'](_0x2fe0ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x1c')]=function(_0x26e3d1){if(this[_0x73aa('0x4c')][_0x73aa('0x75')]>0x0){this[_0x73aa('0x4c')][_0x73aa('0x76')]=_0x26e3d1;return;}logger[_0x73aa('0x51')](_0x73aa('0x79'),util[_0x73aa('0x45')](_0x26e3d1,{'showHidden':![],'depth':null}));this[_0x73aa('0x4c')]=initializeSummary();ami[_0x73aa('0x4f')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x20')]=function(_0x3c5604){try{if(this['isNotNull'](_0x3c5604)){logger[_0x73aa('0x51')](_0x73aa('0x7a'),_0x3c5604[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x3c5604,{'showHidden':![],'depth':null}));if(_[_0x73aa('0x7b')](this[_0x73aa('0x12')][_0x3c5604['uniqueid']])){this[_0x73aa('0x12')][_0x3c5604[_0x73aa('0x54')]]=[];}if(_[_0x73aa('0x7b')](this['channels'][_0x3c5604[_0x73aa('0x54')]])){this['channels'][_0x3c5604['uniqueid']]={};}var _0x9cfd71=new QueueReport();_0x9cfd71[_0x73aa('0x56')]=_0x3c5604['queue'];_0x9cfd71[_0x73aa('0x73')]=this[_0x73aa('0x15')][_0x9cfd71['queue']]&&this['voiceQueues'][_0x9cfd71[_0x73aa('0x56')]][_0x73aa('0x73')]?this[_0x73aa('0x15')][_0x9cfd71['queue']][_0x73aa('0x73')]||'inbound':_0x73aa('0x5f');_0x9cfd71['queuecallerjoinAt']=moment()['format'](_0x73aa('0x7c'));_0x9cfd71['position']=_0x3c5604[_0x73aa('0x7d')];_0x9cfd71[_0x73aa('0x7e')]=_0x3c5604[_0x73aa('0x7e')];_0x9cfd71[_0x73aa('0x54')]=_0x3c5604[_0x73aa('0x54')];_0x9cfd71[_0x73aa('0x7f')]=this[_0x73aa('0x13')][_0x3c5604['uniqueid']][_0x73aa('0x7f')];logger['info'](_0x73aa('0x80'),_0x9cfd71['queue'],_0x9cfd71['type']);Object[_0x73aa('0x70')](_0x9cfd71,_[_0x73aa('0x81')](_0x3c5604,_['keys'](_0x9cfd71)));this['queueReports'][_0x3c5604[_0x73aa('0x54')]][_0x73aa('0x77')](_0x9cfd71);this['channels'][_0x3c5604[_0x73aa('0x54')]]=_0x9cfd71;this[_0x73aa('0x50')](_0x9cfd71,'queuecallerjoin');}}catch(_0x311fb7){logger[_0x73aa('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3c5604['uniqueid'],util[_0x73aa('0x45')](_0x311fb7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x196c28){try{if(this[_0x73aa('0x78')](_0x196c28)){logger[_0x73aa('0x51')](_0x73aa('0x82'),_0x196c28[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x196c28,{'showHidden':![],'depth':null}));if(this[_0x73aa('0x12')][_0x196c28[_0x73aa('0x54')]]){var _0x2a5294=_[_0x73aa('0x83')](this[_0x73aa('0x12')][_0x196c28[_0x73aa('0x54')]]);_0x2a5294[_0x73aa('0x3b')]=![];_0x2a5294[_0x73aa('0x84')]=null;_0x2a5294[_0x73aa('0x85')]=_0x196c28[_0x73aa('0x85')];_0x2a5294['originalposition']=_0x196c28[_0x73aa('0x86')];_0x2a5294[_0x73aa('0x21')]=!![];_0x2a5294['queuecallerabandonAt']=moment()[_0x73aa('0x61')](_0x73aa('0x7c'));_0x2a5294[_0x73aa('0x5a')]='ABANDONED';_0x2a5294['lastAssignedTo']=null;logger[_0x73aa('0x87')](_0x73aa('0x88'),_0x2a5294[_0x73aa('0x56')],_0x2a5294['type']);this[_0x73aa('0x13')][_0x196c28['uniqueid']]=_0x2a5294;this[_0x73aa('0x4d')](_0x2a5294,_0x73aa('0x21'));}}}catch(_0x344133){logger[_0x73aa('0x43')](_0x73aa('0x82'),_0x196c28[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x344133,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x89')]=function(_0x26c3f6){try{if(this[_0x73aa('0x78')](_0x26c3f6)){logger['debug'](_0x73aa('0x8a'),_0x26c3f6[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x26c3f6,{'showHidden':![],'depth':null}));if(this[_0x73aa('0x12')][_0x26c3f6[_0x73aa('0x54')]]){var _0x514c22=_[_0x73aa('0x83')](this[_0x73aa('0x12')][_0x26c3f6[_0x73aa('0x54')]]);_0x514c22[_0x73aa('0x8b')]=moment()['format'](_0x73aa('0x7c'));_0x514c22[_0x73aa('0x8c')]=_0x26c3f6[_0x73aa('0x8c')];_0x514c22[_0x73aa('0x8d')]=_0x26c3f6[_0x73aa('0x8d')];logger['info'](_0x73aa('0x8e'),_0x514c22['queue'],_0x514c22[_0x73aa('0x73')],_0x26c3f6[_0x73aa('0x8c')],_0x26c3f6[_0x73aa('0x8d')]);this[_0x73aa('0x13')][_0x26c3f6[_0x73aa('0x54')]]=_0x514c22;this[_0x73aa('0x50')](_0x514c22,_0x73aa('0x23'));}}}catch(_0x31e101){logger[_0x73aa('0x43')](_0x73aa('0x8a'),_0x26c3f6['uniqueid'],util['inspect'](_0x31e101,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x25')]=function(_0x468eb2){try{if(this[_0x73aa('0x78')](_0x468eb2)){logger['debug'](_0x73aa('0x8f'),_0x468eb2['uniqueid'],util[_0x73aa('0x45')](_0x468eb2,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x468eb2[_0x73aa('0x54')]]){var _0x444095=_[_0x73aa('0x83')](this['queueReports'][_0x468eb2[_0x73aa('0x54')]]);_0x444095['queuecallercomplete']=!![];_0x444095[_0x73aa('0x5a')]=_0x73aa('0x90');logger[_0x73aa('0x87')](_0x73aa('0x91'),_0x444095['queue'],_0x444095[_0x73aa('0x73')]);}}}catch(_0x563c0d){logger[_0x73aa('0x43')](_0x73aa('0x8f'),_0x468eb2[_0x73aa('0x54')],util['inspect'](_0x563c0d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0x92')]=function(_0x52f64b){try{if(this['isNotNull'](_0x52f64b)){logger[_0x73aa('0x51')](_0x73aa('0x93'),_0x52f64b[_0x73aa('0x54')],util['inspect'](_0x52f64b,{'showHidden':![],'depth':null}));if(this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x54')]]){var _0x1e37c8=_['last'](this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x54')]]);_0x1e37c8[_0x73aa('0x21')]=![];_0x1e37c8['queuecallerabandonAt']=null;_0x1e37c8[_0x73aa('0x94')]=!![];_0x1e37c8[_0x73aa('0x95')]=_0x52f64b[_0x73aa('0x96')];_0x1e37c8[_0x73aa('0x85')]=_0x52f64b[_0x73aa('0x85')];_0x1e37c8[_0x73aa('0x3b')]=!![];_0x1e37c8['queuecallerexit']=![];_0x1e37c8[_0x73aa('0x97')]=null;if(!_0x1e37c8[_0x73aa('0x98')]){if(_0x52f64b[_0x73aa('0x99')]=='transfer'){_0x1e37c8[_0x73aa('0x5a')]='COMPLETED';logger[_0x73aa('0x87')](_0x73aa('0x9a'),_0x1e37c8[_0x73aa('0x56')],_0x1e37c8[_0x73aa('0x73')]);}else{if(_[_0x73aa('0x9b')](_0x52f64b[_0x73aa('0x40')][_0x73aa('0x9c')](),_0x73aa('0x9d'))){if(this[_0x73aa('0x12')][_0x52f64b['linkedid']]){var _0x1db93a=_[_0x73aa('0x83')](this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x9e')]]);_0x1db93a[_0x73aa('0x3b')]=![];_0x1db93a[_0x73aa('0x3a')]=!![];_0x1db93a['queuecallerexitAt']=moment(_0x1e37c8[_0x73aa('0x9f')])['add'](_0x52f64b[_0x73aa('0x85')],_0x73aa('0xa0'))[_0x73aa('0x61')](_0x73aa('0x7c'));_0x1db93a[_0x73aa('0x5a')]=_0x73aa('0xa1');_0x1db93a[_0x73aa('0x98')]=!![];_0x1db93a[_0x73aa('0xa2')]=_0x73aa('0xa3');_0x1db93a[_0x73aa('0xa4')]=_0x52f64b[_0x73aa('0xa5')];_0x1db93a[_0x73aa('0xa6')]=_0x52f64b[_0x73aa('0x54')];logger['info'](_0x73aa('0xa7'),_0x1db93a['queue'],_0x1db93a[_0x73aa('0x73')]);var _0x94bd68=this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x9e')]];this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x9e')]]=this[_0x73aa('0x12')][_0x52f64b[_0x73aa('0x54')]];this['queueReports'][_0x52f64b[_0x73aa('0x54')]]=_0x94bd68;}}else{_0x1e37c8['queuecallerexitreason']=_0x73aa('0xa8')+_0x52f64b[_0x73aa('0x99')][_0x73aa('0xa9')]();logger[_0x73aa('0x87')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1e37c8[_0x73aa('0x56')],_0x1e37c8[_0x73aa('0x73')],_0x1e37c8[_0x73aa('0x5a')]);}}}this[_0x73aa('0x13')][_0x52f64b[_0x73aa('0x54')]]=_0x1e37c8;}}}catch(_0x3f5143){logger[_0x73aa('0x43')](_0x73aa('0x93'),_0x52f64b['uniqueid'],util[_0x73aa('0x45')](_0x3f5143,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x73aa('0xaa')]=function(_0x2365e6){try{if(this[_0x73aa('0x78')](_0x2365e6)){logger['debug'](_0x73aa('0xab'),_0x2365e6[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x2365e6,{'showHidden':![],'depth':null}));this['addVariable'](_0x2365e6[_0x73aa('0x54')],_['keys'](_0x2365e6[_0x73aa('0xac')])[0x0],_0x2365e6[_0x73aa('0xad')]);if(this[_0x73aa('0x12')][_0x2365e6[_0x73aa('0x54')]]){var _0x172916=_[_0x73aa('0x83')](this['queueReports'][_0x2365e6['uniqueid']]);if(_0x172916){if(this['isNotNull'](_0x2365e6[_0x73aa('0xac')])&&this[_0x73aa('0x78')](_0x2365e6[_0x73aa('0xac')]['queuestatus'])){switch(_0x2365e6[_0x73aa('0xad')]){case'CONTINUE':_0x172916['queuecallerexit']=![];_0x172916[_0x73aa('0x97')]=null;break;case'TIMEOUT':_0x172916[_0x73aa('0xae')]=_0x73aa('0xaf');_0x172916[_0x73aa('0x3a')]=!![];_0x172916['queuecallerexitAt']=moment()[_0x73aa('0x61')](_0x73aa('0x7c'));_0x172916[_0x73aa('0x8b')]=moment()[_0x73aa('0x61')](_0x73aa('0x7c'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2365e6[_0x73aa('0x54')],util['inspect'](_0x172916,{'showHidden':![],'depth':null}));ami[_0x73aa('0x4f')](_0x73aa('0xb0'),_0x172916);break;default:_0x172916[_0x73aa('0x3a')]=!![];_0x172916['queuecallerexitAt']=moment()['format'](_0x73aa('0x7c'));_0x172916[_0x73aa('0x8b')]=moment()['format'](_0x73aa('0x7c'));}_0x172916[_0x73aa('0x21')]=![];_0x172916[_0x73aa('0xb1')]=null;_0x172916[_0x73aa('0x5a')]=_0x2365e6[_0x73aa('0xad')];this[_0x73aa('0x13')][_0x2365e6[_0x73aa('0x54')]]=_0x172916;this[_0x73aa('0x4d')](_0x172916,_0x73aa('0x26'));}else if(this[_0x73aa('0x78')](_0x2365e6['variable'])&&this[_0x73aa('0x78')](_0x2365e6[_0x73aa('0xac')][_0x73aa('0xb2')])){if(!_0x172916[_0x73aa('0x21')]){_0x172916[_0x73aa('0x3a')]=!![];_0x172916[_0x73aa('0x97')]=moment()[_0x73aa('0x61')](_0x73aa('0x7c'));_0x172916[_0x73aa('0x5a')]=_0x73aa('0xb3');_0x172916[_0x73aa('0x8b')]=moment()[_0x73aa('0x61')](_0x73aa('0x7c'));this[_0x73aa('0x13')][_0x2365e6[_0x73aa('0x54')]]=_0x172916;}}logger[_0x73aa('0x87')](_0x73aa('0xb4'),_0x2365e6[_0x73aa('0x54')],_0x172916[_0x73aa('0x56')],_0x172916[_0x73aa('0x73')],_[_0x73aa('0xb5')](_0x2365e6[_0x73aa('0xac')])[0x0],_0x2365e6[_0x73aa('0xad')]);_0x172916[_0x73aa('0x17')]=this['variables'][_0x2365e6[_0x73aa('0x54')]];}}}}catch(_0x49281a){logger[_0x73aa('0x43')](_0x73aa('0xab'),_0x2365e6[_0x73aa('0x54')],util[_0x73aa('0x45')](_0x49281a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x73aa('0xd')][_0x73aa('0xb6')]=function(_0x484be9,_0xee1ac4,_0x2f1695){var _0x5bc67c=[_0x73aa('0xb7'),'rtpaudioqosbridged',_0x73aa('0xb8'),'rtpaudioqosjitterbridged',_0x73aa('0xb9'),_0x73aa('0xba'),_0x73aa('0xbb'),_0x73aa('0xbc'),_0x73aa('0xbd'),'sipuri','bridgepeer',_0x73aa('0xbe'),_0x73aa('0xbf'),_0x73aa('0xc0'),_0x73aa('0xc1'),'memberlastcall',_0x73aa('0x96'),'memberpenalty','memberrealtime'];if(!_[_0x73aa('0x3e')](_0xee1ac4)&&!_[_0x73aa('0xc2')](_0x5bc67c,_0xee1ac4)){if(_[_0x73aa('0x7b')](this[_0x73aa('0x17')][_0x484be9])){this[_0x73aa('0x17')][_0x484be9]={};}this[_0x73aa('0x17')][_0x484be9][_0xee1ac4]=_0x2f1695;}};VoiceQueueReport['prototype'][_0x73aa('0xc3')]=function(_0x5e0fc9,_0x4e36e8,_0x27cef0){try{var _0x4cb606={};if(this[_0x73aa('0x12')][_0x5e0fc9]){for(var _0x2ad756=0x0;_0x2ad756=0x0?moment(_0x240717[_0xf1ed('0x1a')])[_0xf1ed('0xf')](_0x240717[_0xf1ed('0x1b')],'seconds'):null,'data1':_0xf1ed('0x1c'),'data2':_0x240717['accountcode'],'data3':_0x240717[_0xf1ed('0x13')],'data4':_0x240717[_0xf1ed('0x1d')]||null,'role':_0xf1ed('0x15'),'internal':_0x240717[_0xf1ed('0x16')]?_[_0xf1ed('0x1e')](_0x240717['accountcode']):undefined,'uniqueid':_0x240717['uniqueid']},'log':_0xf1ed('0x8')});}; \ No newline at end of file +var _0x41dc=['lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','dialstring','moment','util','../client','voiceQueueReport','Request','CreateMemberReport','voice'];(function(_0x273505,_0x5a7f75){var _0x9d7ea0=function(_0x50764f){while(--_0x50764f){_0x273505['push'](_0x273505['shift']());}};_0x9d7ea0(++_0x5a7f75);}(_0x41dc,0xb6));var _0xc41d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x41dc[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0xc41d('0x0'));var _=require('lodash');var util=require(_0xc41d('0x1'));var client=require(_0xc41d('0x2'));exports[_0xc41d('0x3')]=function(_0x12cedd){var _0x4cc2f4=_0x12cedd['queuecallercompleteAt']||_0x12cedd['queuecallerexitAt'];return client[_0xc41d('0x4')](_0xc41d('0x5'),{'body':{'channel':_0xc41d('0x6'),'membername':_0x12cedd[_0xc41d('0x7')],'interface':_[_0xc41d('0x8')](_0x12cedd[_0xc41d('0x9')])?util['format'](_0xc41d('0xa'),_0x12cedd['lastAssignedTo']):_0x12cedd[_0xc41d('0x9')],'type':_0xc41d('0xb'),'enterAt':_0x12cedd[_0xc41d('0xc')],'exitAt':_0x4cc2f4,'duration':moment(_0x4cc2f4)[_0xc41d('0xd')](_0x12cedd[_0xc41d('0xc')],_0xc41d('0xe')),'data1':'inbound','data2':_0x12cedd[_0xc41d('0xf')],'data3':_0x12cedd[_0xc41d('0x10')],'data4':null,'data5':_0x12cedd[_0xc41d('0x11')],'role':_0xc41d('0x12'),'internal':_0x12cedd['accountcode']?_[_0xc41d('0x13')](_0x12cedd[_0xc41d('0x14')]):undefined,'uniqueid':_0x12cedd[_0xc41d('0x15')]},'log':_0xc41d('0x5')});};exports[_0xc41d('0x16')]=function(_0x316538){return client[_0xc41d('0x4')](_0xc41d('0x5'),{'body':{'channel':_0xc41d('0x6'),'membername':_0x316538[_0xc41d('0x17')],'interface':_0x316538['interface'],'type':'TALKING','enterAt':_0x316538[_0xc41d('0x18')],'exitAt':_0x316538['endtime'],'duration':moment(_0x316538['endtime'])[_0xc41d('0xd')](_0x316538['starttime'],_0xc41d('0xe'))>=0x0?moment(_0x316538[_0xc41d('0x19')])[_0xc41d('0xd')](_0x316538['starttime'],_0xc41d('0xe')):null,'data1':'outbound','data2':_0x316538[_0xc41d('0x14')],'data3':_0x316538[_0xc41d('0x10')],'data4':_0x316538[_0xc41d('0x1a')]||null,'role':_0xc41d('0x12'),'internal':_0x316538[_0xc41d('0x14')]?_[_0xc41d('0x13')](_0x316538[_0xc41d('0x14')]):undefined,'uniqueid':_0x316538[_0xc41d('0x15')]},'log':_0xc41d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2064cf4..4764b06 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 _0x7f48=['../client','getSettings','ShowSetting','GetSettings'];(function(_0x228252,_0x3e7944){var _0x158e06=function(_0x3bd145){while(--_0x3bd145){_0x228252['push'](_0x228252['shift']());}};_0x158e06(++_0x3e7944);}(_0x7f48,0xac));var _0x87f4=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7f48[_0x4b7b62];return _0x2280df;};'use strict';var client=require(_0x87f4('0x0'));exports[_0x87f4('0x1')]=function(){return client['Request'](_0x87f4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x87f4('0x3')});}; \ No newline at end of file +var _0x2b4f=['previewRecallmeReminderInterval','GetSettings','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x34271c,_0x28a8b){var _0x83585f=function(_0x7d2264){while(--_0x7d2264){_0x34271c['push'](_0x34271c['shift']());}};_0x83585f(++_0x28a8b);}(_0x2b4f,0x142));var _0xf2b4=function(_0x264e4a,_0x338dd4){_0x264e4a=_0x264e4a-0x0;var _0x111148=_0x2b4f[_0x264e4a];return _0x111148;};'use strict';var client=require('../client');exports[_0xf2b4('0x0')]=function(){return client['Request'](_0xf2b4('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf2b4('0x2'),_0xf2b4('0x3')]},'log':_0xf2b4('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 63c516b..7372116 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 _0x73aa=['GetTemplate','name','Request'];(function(_0xee2b43,_0x2d7ef6){var _0x53fe74=function(_0x1b83c8){while(--_0x1b83c8){_0xee2b43['push'](_0xee2b43['shift']());}};_0x53fe74(++_0x2d7ef6);}(_0x73aa,0x1eb));var _0xa73a=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x73aa[_0x17406e];return _0x2bfc5a;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x3ad4c0){return function(_0x408f02){return client[_0xa73a('0x0')](_0xa73a('0x1'),{'options':{'raw':!![],'attributes':['id',_0xa73a('0x2'),'html']},'log':_0xa73a('0x1')});};}; \ No newline at end of file +var _0x041c=['name','../client','getTemplates','Request','GetTemplate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x041c,0xa1));var _0xc041=function(_0x34d235,_0x548fca){_0x34d235=_0x34d235-0x0;var _0x46ff6e=_0x041c[_0x34d235];return _0x46ff6e;};'use strict';var client=require(_0xc041('0x0'));exports[_0xc041('0x1')]=function(_0x15170e){return function(_0xc4d93c){return client[_0xc041('0x2')](_0xc041('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc041('0x4'),'html']},'log':_0xc041('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5f12aec..643decd 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 _0x196d=['action','data2','data3','data4','data6','data7','GetTrigger','../client','Request','channel','status','Condition','AllConditions','operator','AnyConditions','field','Action'];(function(_0x69849c,_0x35d278){var _0x46b88d=function(_0x5534b5){while(--_0x5534b5){_0x69849c['push'](_0x69849c['shift']());}};_0x46b88d(++_0x35d278);}(_0x196d,0x19f));var _0xd196=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x196d[_0x4b2436];return _0x4f5ab2;};'use strict';var client=require(_0xd196('0x0'));exports['getTriggers']=function(_0x351fef){return function(_0x3a8ece){return client[_0xd196('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xd196('0x2'),_0xd196('0x3')],'include':[{'model':_0xd196('0x4'),'as':_0xd196('0x5'),'attributes':['id','field',_0xd196('0x6'),'value']},{'model':_0xd196('0x4'),'as':_0xd196('0x7'),'attributes':['id',_0xd196('0x8'),_0xd196('0x6'),'value']},{'model':_0xd196('0x9'),'as':'Actions','attributes':['id',_0xd196('0xa'),'data1',_0xd196('0xb'),_0xd196('0xc'),_0xd196('0xd'),'data5',_0xd196('0xe'),_0xd196('0xf')]}]},'log':_0xd196('0x10')});};}; \ No newline at end of file +var _0x88de=['Actions','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action'];(function(_0x1e5ae,_0x2e9779){var _0x2ff63d=function(_0x46d8b8){while(--_0x46d8b8){_0x1e5ae['push'](_0x1e5ae['shift']());}};_0x2ff63d(++_0x2e9779);}(_0x88de,0xd8));var _0xe88d=function(_0xb01154,_0x10b4d0){_0xb01154=_0xb01154-0x0;var _0x41da43=_0x88de[_0xb01154];return _0x41da43;};'use strict';var client=require(_0xe88d('0x0'));exports[_0xe88d('0x1')]=function(_0x22d07d){return function(_0x2cb70a){return client[_0xe88d('0x2')](_0xe88d('0x3'),{'options':{'raw':![],'attributes':['id',_0xe88d('0x4'),_0xe88d('0x5'),'status'],'include':[{'model':_0xe88d('0x6'),'as':_0xe88d('0x7'),'attributes':['id',_0xe88d('0x8'),_0xe88d('0x9'),'value']},{'model':_0xe88d('0x6'),'as':'AnyConditions','attributes':['id','field','operator',_0xe88d('0xa')]},{'model':_0xe88d('0xb'),'as':_0xe88d('0xc'),'attributes':['id','action','data1',_0xe88d('0xd'),_0xe88d('0xe'),_0xe88d('0xf'),_0xe88d('0x10'),_0xe88d('0x11'),_0xe88d('0x12')]}]},'log':_0xe88d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 086a9c8..dbeec5a 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 _0xc35a=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x52a9fd,_0x1b6ce1){var _0x324456=function(_0x5545a6){while(--_0x5545a6){_0x52a9fd['push'](_0x52a9fd['shift']());}};_0x324456(++_0x1b6ce1);}(_0xc35a,0x1c6));var _0xac35=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc35a[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xac35('0x0'));exports[_0xac35('0x1')]=function(_0x4ae5e8){return function(_0x3605cb){return client[_0xac35('0x2')](_0xac35('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xac35('0x4'),_0xac35('0x5'),_0xac35('0x6')]},'log':_0xac35('0x3')});};}; \ No newline at end of file +var _0x1c0a=['getTrunks','Request','name','registry','defaultuser'];(function(_0x21d058,_0x404510){var _0x4182a2=function(_0x875f15){while(--_0x875f15){_0x21d058['push'](_0x21d058['shift']());}};_0x4182a2(++_0x404510);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x259da1,_0x27e7c3){_0x259da1=_0x259da1-0x0;var _0x599145=_0x1c0a[_0x259da1];return _0x599145;};'use strict';var client=require('../client');exports[_0xa1c0('0x0')]=function(_0x1adce5){return function(_0x1b2bd6){return client[_0xa1c0('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa1c0('0x2'),_0xa1c0('0x3'),_0xa1c0('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c161f5c..b1876ca 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5cca72,_0x3fcc42){var _0x2f134d=function(_0x28093a){while(--_0x28093a){_0x5cca72['push'](_0x5cca72['shift']());}};_0x2f134d(++_0x3fcc42);}(_0xedd9,0xfc));var _0x9edd=function(_0x4fd0fc,_0x26a77e){_0x4fd0fc=_0x4fd0fc-0x0;var _0x11cc75=_0xedd9[_0x4fd0fc];return _0x11cc75;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x4448eb,_0x201815){var _0x1c785=function(_0x281ba5){while(--_0x281ba5){_0x4448eb['push'](_0x4448eb['shift']());}};_0x1c785(++_0x201815);}(_0xedd9,0xfc));var _0x9edd=function(_0xa91444,_0x1f3b59){_0xa91444=_0xa91444-0x0;var _0x3333fe=_0xedd9[_0xa91444];return _0x3333fe;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7cdf2fb..7fb6bbd 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 _0xf666=['../client','create','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x37a927,_0x490362){var _0x159c54=function(_0x54b340){while(--_0x54b340){_0x37a927['push'](_0x37a927['shift']());}};_0x159c54(++_0x490362);}(_0xf666,0x1e4));var _0x6f66=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0xf666[_0xca1091];return _0xd3019c;};'use strict';var client=require(_0x6f66('0x0'));exports[_0x6f66('0x1')]=function(_0x5266d3){return client['Request'](_0x6f66('0x2'),{'body':_0x5266d3,'log':_0x6f66('0x2')});};exports['update']=function(_0x2db7ea,_0x59ffa6,_0x25eb90){return client['Request'](_0x6f66('0x3'),{'body':_0x2db7ea,'options':{'where':{'uniqueid':_0x59ffa6,'interface':_0x25eb90,'agentcomplete':!![]}},'log':_0x6f66('0x3')});}; \ No newline at end of file +var _0x13f3=['UpdateVoiceAgentReport','Request'];(function(_0x558620,_0x79a0f){var _0x2f4174=function(_0x44cd40){while(--_0x44cd40){_0x558620['push'](_0x558620['shift']());}};_0x2f4174(++_0x79a0f);}(_0x13f3,0x197));var _0x313f=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0x13f3[_0x4ab99];return _0x29e39c;};'use strict';var client=require('../client');exports['create']=function(_0x5df530){return client['Request']('CreateVoiceAgentReport',{'body':_0x5df530,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5f5364,_0x5d54bd,_0x2ccfa6){return client[_0x313f('0x0')](_0x313f('0x1'),{'body':_0x5f5364,'options':{'where':{'uniqueid':_0x5d54bd,'interface':_0x2ccfa6,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index cebd5da..c2856d5 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 _0x0e4a=['CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','billableseconds','GetVoiceCallReports','moment','util','../client','create','merge','calleridnum','context','DOCUMENTATION'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x0e4a,0x16e));var _0xa0e4=function(_0x255bee,_0x19cf5d){_0x255bee=_0x255bee-0x0;var _0x1c23fb=_0x0e4a[_0x255bee];return _0x1c23fb;};'use strict';var moment=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var _=require('lodash');var client=require(_0xa0e4('0x2'));exports[_0xa0e4('0x3')]=function(_0x4aacd7){return client['Request']('CreateVoiceCallReport',{'body':_[_0xa0e4('0x4')](_0x4aacd7,{'source':_0x4aacd7[_0xa0e4('0x5')],'destinationcontext':_0x4aacd7[_0xa0e4('0x6')],'callerid':_0x4aacd7['callerid'],'amaflags':_0xa0e4('0x7')}),'log':_0xa0e4('0x8')});};exports[_0xa0e4('0x9')]=function(){return function(){return client[_0xa0e4('0xa')](_0xa0e4('0xb'),{'options':{'where':{'type':[_0xa0e4('0xc')],'createdAt':{'$between':[moment()[_0xa0e4('0xd')](_0xa0e4('0xe'))['format'](_0xa0e4('0xf')),moment()[_0xa0e4('0x10')](_0xa0e4('0xe'))[_0xa0e4('0x11')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa0e4('0x12'),_0xa0e4('0x13'),'duration',_0xa0e4('0x14')]},'log':_0xa0e4('0x15')});};}; \ No newline at end of file +var _0x8d9f=['create','Request','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash'];(function(_0x21ba7d,_0x3721f1){var _0x1445b6=function(_0xde3c73){while(--_0xde3c73){_0x21ba7d['push'](_0x21ba7d['shift']());}};_0x1445b6(++_0x3721f1);}(_0x8d9f,0xa5));var _0xf8d9=function(_0x5297b2,_0x2c93d2){_0x5297b2=_0x5297b2-0x0;var _0x2d0f29=_0x8d9f[_0x5297b2];return _0x2d0f29;};'use strict';var moment=require(_0xf8d9('0x0'));var util=require(_0xf8d9('0x1'));var _=require(_0xf8d9('0x2'));var client=require('../client');exports[_0xf8d9('0x3')]=function(_0x4c934b){return client[_0xf8d9('0x4')]('CreateVoiceCallReport',{'body':_[_0xf8d9('0x5')](_0x4c934b,{'source':_0x4c934b[_0xf8d9('0x6')],'destinationcontext':_0x4c934b[_0xf8d9('0x7')],'callerid':_0x4c934b['callerid'],'amaflags':_0xf8d9('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xf8d9('0x9')]=function(){return function(){return client['Request'](_0xf8d9('0xa'),{'options':{'where':{'type':[_0xf8d9('0xb')],'createdAt':{'$between':[moment()[_0xf8d9('0xc')](_0xf8d9('0xd'))[_0xf8d9('0xe')](_0xf8d9('0xf')),moment()[_0xf8d9('0x10')](_0xf8d9('0xd'))[_0xf8d9('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xf8d9('0x11'),_0xf8d9('0x12'),_0xf8d9('0x13'),'billableseconds']},'log':_0xf8d9('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0789424..e4ed748 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 _0xc03c=['CreateVoiceDialReport','../client'];(function(_0x526a45,_0xef4ffe){var _0x1f2c1f=function(_0x55669f){while(--_0x55669f){_0x526a45['push'](_0x526a45['shift']());}};_0x1f2c1f(++_0xef4ffe);}(_0xc03c,0x12f));var _0xcc03=function(_0x353c53,_0x2102c0){_0x353c53=_0x353c53-0x0;var _0x2c55da=_0xc03c[_0x353c53];return _0x2c55da;};'use strict';var client=require(_0xcc03('0x0'));exports['create']=function(_0x10b44e){return client['Request']('CreateVoiceDialReport',{'body':_0x10b44e,'log':_0xcc03('0x1')});}; \ No newline at end of file +var _0x7907=['../client','create','Request','CreateVoiceDialReport'];(function(_0x27da85,_0x4b0b34){var _0x923e7c=function(_0x1874ef){while(--_0x1874ef){_0x27da85['push'](_0x27da85['shift']());}};_0x923e7c(++_0x4b0b34);}(_0x7907,0x15c));var _0x7790=function(_0x34d13d,_0xe15c01){_0x34d13d=_0x34d13d-0x0;var _0x14204f=_0x7907[_0x34d13d];return _0x14204f;};'use strict';var client=require(_0x7790('0x0'));exports[_0x7790('0x1')]=function(_0x2eabf2){return client[_0x7790('0x2')](_0x7790('0x3'),{'body':_0x2eabf2,'log':_0x7790('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d56f13d..d6bcdaa 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 _0xbfcc=['recordingFormat','getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x4e1607,_0x486f03){var _0x31e7a7=function(_0x49f8c3){while(--_0x49f8c3){_0x4e1607['push'](_0x4e1607['shift']());}};_0x31e7a7(++_0x486f03);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xbfcc[_0x456fb1];return _0x4083d6;};'use strict';var client=require(_0xcbfc('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xcbfc('0x1'),{'options':{'raw':!![],'attributes':['id',_0xcbfc('0x2'),_0xcbfc('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xcbfc('0x4')});};}; \ No newline at end of file +var _0x5db8=['exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5db8,0xbb));var _0x85db=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x5db8[_0x2181b1];return _0x530548;};'use strict';var client=require(_0x85db('0x0'));exports[_0x85db('0x1')]=function(){return function(){return client[_0x85db('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x85db('0x3'),_0x85db('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x85db('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 0e94923..c7780ea 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 _0xe960=['dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Pause','Interval','Intervals','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency'];(function(_0x4368d0,_0xa924b6){var _0x11346d=function(_0x20d43c){while(--_0x20d43c){_0x4368d0['push'](_0x4368d0['shift']());}};_0x11346d(++_0xa924b6);}(_0xe960,0x1e0));var _0x0e96=function(_0x15a00d,_0x1be3c3){_0x15a00d=_0x15a00d-0x0;var _0xf80266=_0xe960[_0x15a00d];return _0xf80266;};'use strict';var client=require(_0x0e96('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x0e96('0x1')](_0x0e96('0x2'),{'options':{'raw':![],'attributes':['id',_0x0e96('0x3'),_0x0e96('0x4'),'acwTimeout',_0x0e96('0x5'),_0x0e96('0x6'),_0x0e96('0x7'),'dialActive',_0x0e96('0x8'),_0x0e96('0x9'),'dialLimitQueue',_0x0e96('0xa'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x0e96('0xb'),_0x0e96('0xc'),'dialOriginateCallerIdNumber',_0x0e96('0xd'),_0x0e96('0xe'),_0x0e96('0xf'),_0x0e96('0x10'),_0x0e96('0x11'),'dialCongestionRetryFrequency',_0x0e96('0x12'),_0x0e96('0x13'),_0x0e96('0x14'),_0x0e96('0x15'),_0x0e96('0x16'),_0x0e96('0x17'),_0x0e96('0x18'),_0x0e96('0x19'),_0x0e96('0x1a'),_0x0e96('0x1b'),_0x0e96('0x1c'),'dialAMDGreeting',_0x0e96('0x1d'),'dialAMDTotalAnalysisTime',_0x0e96('0x1e'),_0x0e96('0x1f'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x0e96('0x20'),_0x0e96('0x21'),'dialRecallInQueue','dialOrderByScheduledAt',_0x0e96('0x22'),'dialAgiAfterHangupClient','dialQueueProject2',_0x0e96('0x6'),_0x0e96('0x23'),_0x0e96('0x24'),_0x0e96('0x25'),'dialNoSuchNumberMaxRetry',_0x0e96('0x26'),'dialDropMaxRetry',_0x0e96('0x27'),'dialAbandonedMaxRetry',_0x0e96('0x28'),_0x0e96('0x29'),_0x0e96('0x2a'),_0x0e96('0x2b'),'dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x0e96('0x2c'),_0x0e96('0x2d')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x0e96('0x3'),_0x0e96('0x2e'),_0x0e96('0x2f')]},{'model':_0x0e96('0x30'),'as':'mandatoryDispositionPause','attributes':['id',_0x0e96('0x3')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x0e96('0x3'),'callerid',_0x0e96('0x2f')]},{'model':_0x0e96('0x31'),'as':'Interval','attributes':['id',_0x0e96('0x3')],'include':[{'model':_0x0e96('0x31'),'as':_0x0e96('0x32'),'attributes':['id',_0x0e96('0x3'),'interval']}]}]},'log':_0x0e96('0x33')});};}; \ No newline at end of file +var _0x0ce6=['Intervals','../client','getVoiceQueues','Request','name','acw','acwTimeout','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','TrunkBackup','callerid','Interval'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x0ce6,0xed));var _0x60ce=function(_0x875881,_0x1aa426){_0x875881=_0x875881-0x0;var _0x4108fc=_0x0ce6[_0x875881];return _0x4108fc;};'use strict';var client=require(_0x60ce('0x0'));exports[_0x60ce('0x1')]=function(){return function(){return client[_0x60ce('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x60ce('0x3'),_0x60ce('0x4'),_0x60ce('0x5'),'autopause','monitor_format','type',_0x60ce('0x6'),_0x60ce('0x7'),_0x60ce('0x8'),_0x60ce('0x9'),_0x60ce('0xa'),_0x60ce('0xb'),'dialPredictiveOptimizationPercentage',_0x60ce('0xc'),_0x60ce('0xd'),_0x60ce('0xe'),_0x60ce('0xf'),_0x60ce('0x10'),'dialQueueTimeout',_0x60ce('0x11'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x60ce('0x12'),_0x60ce('0x13'),_0x60ce('0x14'),'dialNoAnswerRetryFrequency',_0x60ce('0x15'),'dialTimezone',_0x60ce('0x16'),_0x60ce('0x17'),_0x60ce('0x18'),'dialAMDActive',_0x60ce('0x19'),_0x60ce('0x1a'),_0x60ce('0x1b'),_0x60ce('0x1c'),_0x60ce('0x1d'),'dialAMDBetweenWordsSilence',_0x60ce('0x1e'),_0x60ce('0x1f'),_0x60ce('0x20'),_0x60ce('0x21'),_0x60ce('0x22'),_0x60ce('0x23'),'dialOrderByScheduledAt',_0x60ce('0x24'),_0x60ce('0x25'),_0x60ce('0x26'),_0x60ce('0x27'),'strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry',_0x60ce('0x28'),_0x60ce('0x29'),_0x60ce('0x2a'),_0x60ce('0x2b'),_0x60ce('0x2c'),'dialMachineMaxRetry',_0x60ce('0x2d'),_0x60ce('0x2e'),_0x60ce('0x2f'),_0x60ce('0x30'),_0x60ce('0x31'),'dialPredictiveIntervalMinThreshold',_0x60ce('0x32'),_0x60ce('0x33')],'include':[{'model':_0x60ce('0x34'),'as':_0x60ce('0x34'),'attributes':['id','name','callerid',_0x60ce('0x35')]},{'model':_0x60ce('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x60ce('0x3')]},{'model':_0x60ce('0x34'),'as':_0x60ce('0x37'),'attributes':['id',_0x60ce('0x3'),_0x60ce('0x38'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x60ce('0x3')],'include':[{'model':_0x60ce('0x39'),'as':_0x60ce('0x3a'),'attributes':['id','name','interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e4d6e80..55a9a8b 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(_0xe84fae,_0x33be85){var _0x50ad63=function(_0x59a8ea){while(--_0x59a8ea){_0xe84fae['push'](_0xe84fae['shift']());}};_0x50ad63(++_0x33be85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x4b3f9c,_0x549053){var _0x12ddb2=function(_0x171b91){while(--_0x171b91){_0x4b3f9c['push'](_0x4b3f9c['shift']());}};_0x12ddb2(++_0x549053);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 c7789c8..e4c7d05 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 _0xd4da=['GetVoiceQueueRtPauses','../client','Request'];(function(_0x28970f,_0xa8e49e){var _0x45e92c=function(_0x38c28d){while(--_0x38c28d){_0x28970f['push'](_0x28970f['shift']());}};_0x45e92c(++_0xa8e49e);}(_0xd4da,0x1cf));var _0xad4d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd4da[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xad4d('0x0'));exports['getVoiceQueueRtPauses']=function(_0x39753d){return function(){return client[_0xad4d('0x1')](_0xad4d('0x2'),{'options':{'where':{'VoiceQueueId':_0x39753d,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x5fa9=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x2541c4,_0x3726c3){var _0x3103f1=function(_0x39bd15){while(--_0x39bd15){_0x2541c4['push'](_0x2541c4['shift']());}};_0x3103f1(++_0x3726c3);}(_0x5fa9,0x1e1));var _0x95fa=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x5fa9[_0x18cac4];return _0x2227c6;};'use strict';var client=require(_0x95fa('0x0'));exports[_0x95fa('0x1')]=function(_0x4afe27){return function(){return client[_0x95fa('0x2')](_0x95fa('0x3'),{'options':{'where':{'VoiceQueueId':_0x4afe27,'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 52f20bb..a85add5 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x34f1ac,_0x1916de){var _0x4cd213=function(_0x79f8b9){while(--_0x79f8b9){_0x34f1ac['push'](_0x34f1ac['shift']());}};_0x4cd213(++_0x1916de);}(_0x7a54,0x106));var _0x47a5=function(_0x3d3a42,_0xacc411){_0x3d3a42=_0x3d3a42-0x0;var _0x2828dc=_0x7a54[_0x3d3a42];return _0x2828dc;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x5152af,_0x244664){var _0x292fbb=function(_0x445340){while(--_0x445340){_0x5152af['push'](_0x5152af['shift']());}};_0x292fbb(++_0x244664);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 409d62a..be97076 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 _0x30b7=['transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x53e0bf,_0x257526){var _0x28d63b=function(_0x1cca2b){while(--_0x1cca2b){_0x53e0bf['push'](_0x53e0bf['shift']());}};_0x28d63b(++_0x257526);}(_0x30b7,0x1f3));var _0x730b=function(_0x2881ba,_0x3ab9ad){_0x2881ba=_0x2881ba-0x0;var _0x39f390=_0x30b7[_0x2881ba];return _0x39f390;};'use strict';var client=require('../client');exports[_0x730b('0x0')]={};exports['blindTransfer']=function(_0x18f428){return client[_0x730b('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x18f428[_0x730b('0x2')],'transfererchannel':_0x18f428[_0x730b('0x3')],'transferercalleridnum':_0x18f428[_0x730b('0x4')],'transferercalleridname':_0x18f428[_0x730b('0x5')],'transfererconnectedlinenum':_0x18f428[_0x730b('0x6')],'transfererconnectedlinename':_0x18f428[_0x730b('0x7')],'transfereraccountcode':_0x18f428[_0x730b('0x8')],'transferercontext':_0x18f428[_0x730b('0x9')],'transfererexten':_0x18f428[_0x730b('0xa')],'transfererlinkedid':_0x18f428[_0x730b('0xb')],'transfereechannel':_0x18f428['transfereechannel'],'transfereecalleridnum':_0x18f428[_0x730b('0xc')],'transfereecalleridname':_0x18f428[_0x730b('0xd')],'transfereeconnectedlinenum':_0x18f428[_0x730b('0xe')],'transfereeconnectedlinename':_0x18f428[_0x730b('0xf')],'transfereeaccountcode':_0x18f428[_0x730b('0x10')],'transfereecontext':_0x18f428[_0x730b('0x11')],'transfereeexten':_0x18f428[_0x730b('0x12')],'transfereelinkedid':_0x18f428[_0x730b('0x13')],'isexternal':_0x18f428[_0x730b('0x14')],'context':_0x18f428[_0x730b('0x15')],'extension':_0x18f428[_0x730b('0x16')],'type':_0x730b('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0x730b('0x18')]=function(_0x4d5b6f){return client['Request'](_0x730b('0x19'),{'body':{'result':_0x4d5b6f[_0x730b('0x2')],'transfererchannel':_0x4d5b6f[_0x730b('0x1a')],'transferercalleridnum':_0x4d5b6f[_0x730b('0x1b')],'transferercalleridname':_0x4d5b6f[_0x730b('0x1c')],'transfererconnectedlinenum':_0x4d5b6f[_0x730b('0x1d')],'transfererconnectedlinename':_0x4d5b6f[_0x730b('0x1e')],'transfereraccountcode':_0x4d5b6f[_0x730b('0x1f')],'transferercontext':_0x4d5b6f[_0x730b('0x20')],'transfererexten':_0x4d5b6f[_0x730b('0x21')],'transfererlinkedid':_0x4d5b6f[_0x730b('0x22')],'transfereechannel':_0x4d5b6f[_0x730b('0x23')],'transfereecalleridnum':_0x4d5b6f[_0x730b('0x24')],'transfereecalleridname':_0x4d5b6f[_0x730b('0x25')],'transfereeconnectedlinenum':_0x4d5b6f[_0x730b('0x26')],'transfereeconnectedlinename':_0x4d5b6f[_0x730b('0x27')],'transfereeaccountcode':_0x4d5b6f[_0x730b('0x28')],'transfereecontext':_0x4d5b6f[_0x730b('0x29')],'transfereeexten':_0x4d5b6f[_0x730b('0x2a')],'transfereelinkedid':_0x4d5b6f[_0x730b('0x2b')],'isexternal':_0x4d5b6f[_0x730b('0x14')],'context':_0x4d5b6f[_0x730b('0x2c')],'extension':_0x4d5b6f[_0x730b('0x2d')],'type':_0x730b('0x2e')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xe2dc=['transfereraccountcode','transferercontext','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','CreateVoiceTransferReport','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','../client','result','transferercalleridnum','transferercalleridname'];(function(_0x74b1f4,_0x3054a8){var _0x2b0b85=function(_0x297d2e){while(--_0x297d2e){_0x74b1f4['push'](_0x74b1f4['shift']());}};_0x2b0b85(++_0x3054a8);}(_0xe2dc,0x6c));var _0xce2d=function(_0x387583,_0x5825df){_0x387583=_0x387583-0x0;var _0x1c4f60=_0xe2dc[_0x387583];return _0x1c4f60;};'use strict';var client=require(_0xce2d('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x10ad0e){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x10ad0e[_0xce2d('0x1')],'transfererchannel':_0x10ad0e['transfererchannel'],'transferercalleridnum':_0x10ad0e[_0xce2d('0x2')],'transferercalleridname':_0x10ad0e[_0xce2d('0x3')],'transfererconnectedlinenum':_0x10ad0e['transfererconnectedlinenum'],'transfererconnectedlinename':_0x10ad0e['transfererconnectedlinename'],'transfereraccountcode':_0x10ad0e[_0xce2d('0x4')],'transferercontext':_0x10ad0e[_0xce2d('0x5')],'transfererexten':_0x10ad0e['transfererexten'],'transfererlinkedid':_0x10ad0e['transfererlinkedid'],'transfereechannel':_0x10ad0e[_0xce2d('0x6')],'transfereecalleridnum':_0x10ad0e[_0xce2d('0x7')],'transfereecalleridname':_0x10ad0e[_0xce2d('0x8')],'transfereeconnectedlinenum':_0x10ad0e[_0xce2d('0x9')],'transfereeconnectedlinename':_0x10ad0e[_0xce2d('0xa')],'transfereeaccountcode':_0x10ad0e[_0xce2d('0xb')],'transfereecontext':_0x10ad0e['transfereecontext'],'transfereeexten':_0x10ad0e[_0xce2d('0xc')],'transfereelinkedid':_0x10ad0e[_0xce2d('0xd')],'isexternal':_0x10ad0e['isexternal'],'context':_0x10ad0e['context'],'extension':_0x10ad0e[_0xce2d('0xe')],'type':'blind'},'log':_0xce2d('0xf')});};exports[_0xce2d('0x10')]=function(_0x1c644e){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x1c644e[_0xce2d('0x1')],'transfererchannel':_0x1c644e['origtransfererchannel'],'transferercalleridnum':_0x1c644e[_0xce2d('0x11')],'transferercalleridname':_0x1c644e[_0xce2d('0x12')],'transfererconnectedlinenum':_0x1c644e[_0xce2d('0x13')],'transfererconnectedlinename':_0x1c644e[_0xce2d('0x14')],'transfereraccountcode':_0x1c644e['origtransfereraccountcode'],'transferercontext':_0x1c644e[_0xce2d('0x15')],'transfererexten':_0x1c644e['secondtransfererexten'],'transfererlinkedid':_0x1c644e[_0xce2d('0x16')],'transfereechannel':_0x1c644e['transfertargetchannel'],'transfereecalleridnum':_0x1c644e['transfertargetcalleridnum'],'transfereecalleridname':_0x1c644e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1c644e[_0xce2d('0x17')],'transfereeconnectedlinename':_0x1c644e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1c644e[_0xce2d('0x18')],'transfereecontext':_0x1c644e[_0xce2d('0x19')],'transfereeexten':_0x1c644e[_0xce2d('0x1a')],'transfereelinkedid':_0x1c644e[_0xce2d('0x1b')],'isexternal':_0x1c644e['isexternal'],'context':_0x1c644e['origtransferercontext'],'extension':_0x1c644e['origtransfererexten'],'type':'attended'},'log':_0xce2d('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 4002bed..c20031e 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2043bf,_0x32d901){var _0x538468=function(_0xad19c3){while(--_0xad19c3){_0x2043bf['push'](_0x2043bf['shift']());}};_0x538468(++_0x32d901);}(_0x7a54,0x106));var _0x47a5=function(_0x5bb49e,_0x2a7804){_0x5bb49e=_0x5bb49e-0x0;var _0x4d898e=_0x7a54[_0x5bb49e];return _0x4d898e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x27d694,_0x55dc02){var _0x2396f1=function(_0x4cbe3d){while(--_0x4cbe3d){_0x27d694['push'](_0x27d694['shift']());}};_0x2396f1(++_0x55dc02);}(_0xb10b,0x12a));var _0xbb10=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0xb10b[_0x378487];return _0x3bb63b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 30775e2..99b3f5b 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 _0x41be=['union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','lastName','phone','mobile','fax','scheduledAt','updatedAt'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0x41be,0x137));var _0xe41b=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x41be[_0x585133];return _0x18254a;};'use strict';var _=require(_0xe41b('0x0'));var BPromise=require(_0xe41b('0x1'));var Redis=require(_0xe41b('0x2'));var util=require(_0xe41b('0x3'));var config=require(_0xe41b('0x4'));var logger=require(_0xe41b('0x5'))(_0xe41b('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe41b('0x7')]=_['defaults'](config[_0xe41b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe41b('0x8'))(new Redis(config['redis']));function emit(_0x4badca,_0x5bb982,_0x40ab34,_0x254b90,_0x1f397d){logger[_0xe41b('0x9')](_0xe41b('0xa'),_0x4badca,_0x5bb982['id'],_0x40ab34,_0x254b90,JSON[_0xe41b('0xb')](_0x1f397d));io['to'](_0x40ab34)[_0xe41b('0xc')](_0x254b90,_0x1f397d);}exports['exec']=function(_0x596481,_0x21f36e,_0x878056,_0x3e8193){var _0x523216,_0x50fba0;var _0x3ce5e5={};var _0x58c6e8;var _0x8edb81=Number(_0x878056['data1']);var _0x5e9ac8=_0x878056[_0xe41b('0xd')]?Boolean(Number(_0x878056[_0xe41b('0xd')])):![];var _0x34f7fb;var _0x1a29d5=![];if(!_[_0xe41b('0xe')](_0x878056[_0xe41b('0xf')])){if(_0x878056['data5']=='1')_0x1a29d5=!![];}if(!_0x1a29d5){if(_0x3e8193[_0xe41b('0x10')]){_0x3ce5e5['id']=_0x3e8193[_0xe41b('0x10')];}}if(!_0x3ce5e5['id']){_0x3ce5e5[_0xe41b('0x11')]=_0x8edb81;_0x34f7fb=_0x878056['data3']&&_0x878056['data3']!=='0'?_0x878056[_0xe41b('0x12')][_0xe41b('0x13')](','):['phone'];_0x3ce5e5[_0xe41b('0x14')]=_[_0xe41b('0x15')](_0x34f7fb,function(_0x965fa7){var _0x25dcea={};_0x25dcea[_0x965fa7]=_0x3e8193[_0xe41b('0x16')]?_0x3e8193[_0xe41b('0x17')]:_0x3e8193[_0xe41b('0x18')];return _0x25dcea;});_0x58c6e8=_0x3e8193[_0xe41b('0x16')]?_0x3e8193['destcalleridnum']:_0x3e8193['calleridnum'];}var _0x210862=['id','firstName',_0xe41b('0x19'),_0xe41b('0x1a'),_0xe41b('0x1b'),_0xe41b('0x1c'),'ListId','createdAt',_0xe41b('0x1d'),_0xe41b('0x1e')];var _0xdbbda1=_[_0xe41b('0x1f')](_0x210862,_0x34f7fb);BPromise[_0xe41b('0x20')]()[_0xe41b('0x21')](cmContactRpc[_0xe41b('0x22')]({'attributes':_0xdbbda1,'where':_0x3ce5e5,'phone':_0x58c6e8}))[_0xe41b('0x21')](function(_0x565b3a){_0x50fba0=_0x565b3a;if(!_[_0xe41b('0x23')](_0x50fba0)){if(_0x50fba0[_0xe41b('0x24')]===0x1){_0x523216=_0x50fba0[0x0];logger[_0xe41b('0x9')](_0xe41b('0x25'),_0x3e8193[_0xe41b('0x26')],_0x21f36e['id'],_0x523216['id']);}else{logger[_0xe41b('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3e8193[_0xe41b('0x26')],_0x21f36e['id'],_['map'](_0x50fba0,'id')[_0xe41b('0x27')](','));}return;}else{logger[_0xe41b('0x9')](_0xe41b('0x28'),_0x3e8193[_0xe41b('0x26')],_0x21f36e['id']);var _0x31e53c={'ListId':_0x8edb81};var _0xe12184=_0x878056[_0xe41b('0x29')]&&_0x878056[_0xe41b('0x29')]!=='0'?_0x878056[_0xe41b('0x29')]:_0xe41b('0x1a');if(_0x5e9ac8){logger['info'](_0xe41b('0x2a'),_0x3e8193[_0xe41b('0x26')],_0x21f36e['id']);_0x31e53c[_0xe12184]=_[_0xe41b('0xe')](_0x3e8193['routeId'])?_0x3e8193[_0xe41b('0x18')]:_0x3e8193['destcalleridnum'];if(_[_0xe41b('0xe')](_0x3e8193[_0xe41b('0x16')])){_0x31e53c[_0xe41b('0x2b')]=_0x3e8193[_0xe41b('0x2c')]&&_0x3e8193[_0xe41b('0x2c')]!==_0xe41b('0x2d')?_0x3e8193[_0xe41b('0x2c')]:_0xe41b('0x2e');}else{_0x31e53c[_0xe41b('0x2b')]=_0x3e8193[_0xe41b('0x2f')]&&_0x3e8193[_0xe41b('0x2f')]!==_0xe41b('0x2d')?_0x3e8193['destcalleridname']:_0xe41b('0x2e');}return BPromise[_0xe41b('0x20')]()[_0xe41b('0x21')](cmContactRpc[_0xe41b('0x30')](_0x31e53c))[_0xe41b('0x21')](function(_0x20993a){_0x523216=_0x20993a;_0x50fba0[_0xe41b('0x31')](_0x20993a);if(_0x523216){logger[_0xe41b('0x9')](_0xe41b('0x32'),_0x3e8193[_0xe41b('0x26')],_0x21f36e['id'],_0x523216['id']);}return;});}else{logger[_0xe41b('0x9')](_0xe41b('0x33'),_0x3e8193[_0xe41b('0x26')],_0x21f36e['id']);_0x31e53c[_0xe12184]=_[_0xe41b('0xe')](_0x3e8193[_0xe41b('0x16')])?_0x3e8193[_0xe41b('0x18')]:_0x3e8193[_0xe41b('0x17')];if(_[_0xe41b('0xe')](_0x3e8193[_0xe41b('0x16')])){_0x31e53c[_0xe41b('0x2b')]=_0x3e8193['calleridname']&&_0x3e8193[_0xe41b('0x2c')]!==_0xe41b('0x2d')?_0x3e8193[_0xe41b('0x2c')]:_0xe41b('0x2e');}else{_0x31e53c['firstName']=_0x3e8193[_0xe41b('0x2f')]&&_0x3e8193[_0xe41b('0x2f')]!==''?_0x3e8193['destcalleridname']:'Unknown';}_0x523216=_0x31e53c;_0x50fba0['push'](_0x31e53c);return;}}})[_0xe41b('0x21')](function(){if(_0x596481){emit(_0x3e8193[_0xe41b('0x26')],_0x21f36e,util[_0xe41b('0x34')]('user:%s',_0x596481[_0xe41b('0x35')]),util[_0xe41b('0x34')](_0xe41b('0x36'),_0x878056['action'][_0xe41b('0x37')]()),{'evt':_[_0xe41b('0x38')](_0x3e8193,{'autoCreate':_0x5e9ac8}),'contact':_0x523216===undefined?{}:_0x523216,'contacts':_0x50fba0['length']===0x0?undefined:_0x50fba0});}});}; \ No newline at end of file +var _0xa091=['length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','','createContact','push','format','user:%s','name','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then'];(function(_0xd33e30,_0x391e2a){var _0x4b6957=function(_0x59f0b6){while(--_0x59f0b6){_0xd33e30['push'](_0xd33e30['shift']());}};_0x4b6957(++_0x391e2a);}(_0xa091,0xf0));var _0x1a09=function(_0x24e960,_0x343103){_0x24e960=_0x24e960-0x0;var _0x21f459=_0xa091[_0x24e960];return _0x21f459;};'use strict';var _=require(_0x1a09('0x0'));var BPromise=require(_0x1a09('0x1'));var Redis=require(_0x1a09('0x2'));var util=require('util');var config=require(_0x1a09('0x3'));var logger=require(_0x1a09('0x4'))(_0x1a09('0x5'));var cmContactRpc=require(_0x1a09('0x6'));config[_0x1a09('0x7')]=_[_0x1a09('0x8')](config[_0x1a09('0x7')],{'host':_0x1a09('0x9'),'port':0x18eb});var io=require(_0x1a09('0xa'))(new Redis(config['redis']));function emit(_0x163e60,_0x42b6a7,_0x589ca6,_0x3c7214,_0x51dbfd){logger[_0x1a09('0xb')]('[CM][%s][%s]',_0x163e60,_0x42b6a7['id'],_0x589ca6,_0x3c7214,JSON[_0x1a09('0xc')](_0x51dbfd));io['to'](_0x589ca6)['emit'](_0x3c7214,_0x51dbfd);}exports[_0x1a09('0xd')]=function(_0x54c7d1,_0xea7c5e,_0x9fc094,_0x5eb60f){var _0x2c928b,_0x2cba81;var _0x4e1fc8={};var _0x5ea7d0;var _0x344a74=Number(_0x9fc094[_0x1a09('0xe')]);var _0x406ddd=_0x9fc094['data2']?Boolean(Number(_0x9fc094['data2'])):![];var _0x2d797c;var _0x85a0a0=![];if(!_['isNil'](_0x9fc094[_0x1a09('0xf')])){if(_0x9fc094[_0x1a09('0xf')]=='1')_0x85a0a0=!![];}if(!_0x85a0a0){if(_0x5eb60f[_0x1a09('0x10')]){_0x4e1fc8['id']=_0x5eb60f[_0x1a09('0x10')];}}if(!_0x4e1fc8['id']){_0x4e1fc8[_0x1a09('0x11')]=_0x344a74;_0x2d797c=_0x9fc094[_0x1a09('0x12')]&&_0x9fc094[_0x1a09('0x12')]!=='0'?_0x9fc094['data3'][_0x1a09('0x13')](','):[_0x1a09('0x14')];_0x4e1fc8[_0x1a09('0x15')]=_[_0x1a09('0x16')](_0x2d797c,function(_0x137e45){var _0x4f02d3={};_0x4f02d3[_0x137e45]=_0x5eb60f[_0x1a09('0x17')]?_0x5eb60f[_0x1a09('0x18')]:_0x5eb60f['calleridnum'];return _0x4f02d3;});_0x5ea7d0=_0x5eb60f[_0x1a09('0x17')]?_0x5eb60f[_0x1a09('0x18')]:_0x5eb60f[_0x1a09('0x19')];}var _0x229836=['id',_0x1a09('0x1a'),_0x1a09('0x1b'),_0x1a09('0x14'),_0x1a09('0x1c'),_0x1a09('0x1d'),_0x1a09('0x11'),_0x1a09('0x1e'),_0x1a09('0x1f'),_0x1a09('0x20')];var _0x4a4878=_['union'](_0x229836,_0x2d797c);BPromise[_0x1a09('0x21')]()[_0x1a09('0x22')](cmContactRpc['getContacts']({'attributes':_0x4a4878,'where':_0x4e1fc8,'phone':_0x5ea7d0}))['then'](function(_0x46a8e6){_0x2cba81=_0x46a8e6;if(!_['isEmpty'](_0x2cba81)){if(_0x2cba81[_0x1a09('0x23')]===0x1){_0x2c928b=_0x2cba81[0x0];logger[_0x1a09('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5eb60f['uniqueid'],_0xea7c5e['id'],_0x2c928b['id']);}else{logger[_0x1a09('0xb')](_0x1a09('0x24'),_0x5eb60f[_0x1a09('0x25')],_0xea7c5e['id'],_[_0x1a09('0x16')](_0x2cba81,'id')[_0x1a09('0x26')](','));}return;}else{logger[_0x1a09('0xb')](_0x1a09('0x27'),_0x5eb60f[_0x1a09('0x25')],_0xea7c5e['id']);var _0x933bb6={'ListId':_0x344a74};var _0x36fd2e=_0x9fc094[_0x1a09('0x28')]&&_0x9fc094[_0x1a09('0x28')]!=='0'?_0x9fc094[_0x1a09('0x28')]:_0x1a09('0x14');if(_0x406ddd){logger['info'](_0x1a09('0x29'),_0x5eb60f[_0x1a09('0x25')],_0xea7c5e['id']);_0x933bb6[_0x36fd2e]=_[_0x1a09('0x2a')](_0x5eb60f[_0x1a09('0x17')])?_0x5eb60f[_0x1a09('0x19')]:_0x5eb60f[_0x1a09('0x18')];if(_['isNil'](_0x5eb60f['routeId'])){_0x933bb6[_0x1a09('0x1a')]=_0x5eb60f[_0x1a09('0x2b')]&&_0x5eb60f['calleridname']!==''?_0x5eb60f[_0x1a09('0x2b')]:_0x1a09('0x2c');}else{_0x933bb6[_0x1a09('0x1a')]=_0x5eb60f[_0x1a09('0x2d')]&&_0x5eb60f[_0x1a09('0x2d')]!==_0x1a09('0x2e')?_0x5eb60f[_0x1a09('0x2d')]:_0x1a09('0x2c');}return BPromise['resolve']()['then'](cmContactRpc[_0x1a09('0x2f')](_0x933bb6))[_0x1a09('0x22')](function(_0x415764){_0x2c928b=_0x415764;_0x2cba81[_0x1a09('0x30')](_0x415764);if(_0x2c928b){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x5eb60f['uniqueid'],_0xea7c5e['id'],_0x2c928b['id']);}return;});}else{logger[_0x1a09('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5eb60f['uniqueid'],_0xea7c5e['id']);_0x933bb6[_0x36fd2e]=_[_0x1a09('0x2a')](_0x5eb60f[_0x1a09('0x17')])?_0x5eb60f[_0x1a09('0x19')]:_0x5eb60f[_0x1a09('0x18')];if(_[_0x1a09('0x2a')](_0x5eb60f[_0x1a09('0x17')])){_0x933bb6[_0x1a09('0x1a')]=_0x5eb60f[_0x1a09('0x2b')]&&_0x5eb60f[_0x1a09('0x2b')]!==_0x1a09('0x2e')?_0x5eb60f['calleridname']:'Unknown';}else{_0x933bb6[_0x1a09('0x1a')]=_0x5eb60f[_0x1a09('0x2d')]&&_0x5eb60f['destcalleridname']!==''?_0x5eb60f[_0x1a09('0x2d')]:_0x1a09('0x2c');}_0x2c928b=_0x933bb6;_0x2cba81['push'](_0x933bb6);return;}}})[_0x1a09('0x22')](function(){if(_0x54c7d1){emit(_0x5eb60f[_0x1a09('0x25')],_0xea7c5e,util[_0x1a09('0x31')](_0x1a09('0x32'),_0x54c7d1[_0x1a09('0x33')]),util[_0x1a09('0x31')]('trigger:%s',_0x9fc094[_0x1a09('0x34')][_0x1a09('0x35')]()),{'evt':_[_0x1a09('0x36')](_0x5eb60f,{'autoCreate':_0x406ddd}),'contact':_0x2c928b===undefined?{}:_0x2c928b,'contacts':_0x2cba81['length']===0x0?undefined:_0x2cba81});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6552785..a27daba 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 _0x937d=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','emit','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','contactmanager','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','data3','isNil','data4','location','uriLocation','windowWidth','data5','data6','600','winapp','winApplication','winArguments','format','user:%s','trigger:%s:%s','action','toLowerCase','jscripty','trigger:%s','name','integration','queue','urlforward','exec','buildUri','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','routeId','mailSubstatus','substatus','offlineMessage','created','exports','util','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','localhost','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x4a4a6d,_0x32f094){var _0x393211=function(_0x4a83e0){while(--_0x4a83e0){_0x4a4a6d['push'](_0x4a4a6d['shift']());}};_0x393211(++_0x32f094);}(_0x937d,0x1f4));var _0xd937=function(_0x2ba7ef,_0x34cc0f){_0x2ba7ef=_0x2ba7ef-0x0;var _0x2c4613=_0x937d[_0x2ba7ef];return _0x2c4613;};'use strict';var util=require(_0xd937('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require(_0xd937('0x1'));var urlforward=require(_0xd937('0x2'));var integration=require(_0xd937('0x3'));var cmContact=require(_0xd937('0x4'));var script=require(_0xd937('0x5'));var config=require(_0xd937('0x6'));var logger=require('../../../config/logger')(_0xd937('0x7'));var ami=require(_0xd937('0x8'));config[_0xd937('0x9')]=_['defaults'](config[_0xd937('0x9')],{'host':_0xd937('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd937('0x9')]));var operators={'equals':function(_0x1df81d,_0x2d7594){return _0x1df81d==_0x2d7594;},'not_equals':function(_0xa97338,_0x40c5af){return _0xa97338!=_0x40c5af;}};var barAndWebActions=['popup',_0xd937('0xb'),'winapp'];function Trigger(_0xd8f575){this['triggers']=_0xd8f575[_0xd937('0xc')];this[_0xd937('0xd')]=_0xd8f575[_0xd937('0xd')];this[_0xd937('0xe')]=_0xd8f575[_0xd937('0xe')];this['templates']=_0xd8f575[_0xd937('0xf')];this[_0xd937('0x10')]=_0xd8f575[_0xd937('0x10')];this[_0xd937('0x11')]=_0xd8f575[_0xd937('0x11')];this[_0xd937('0x12')]=_0xd8f575[_0xd937('0x12')];this[_0xd937('0x13')]=_0xd8f575[_0xd937('0x13')];this[_0xd937('0x14')]=_0xd8f575['sugarcrmAccounts'];this[_0xd937('0x15')]=_0xd8f575[_0xd937('0x15')];this[_0xd937('0x16')]=_0xd8f575['deskAccounts'];this[_0xd937('0x17')]=_0xd8f575[_0xd937('0x17')];this[_0xd937('0x18')]=_0xd8f575['servicenowAccounts'];this[_0xd937('0x19')]=_0xd8f575[_0xd937('0x19')];this[_0xd937('0x1a')]=_0xd8f575[_0xd937('0x1a')];this[_0xd937('0x1b')]={'zendesk':this[_0xd937('0x11')],'salesforce':this[_0xd937('0x13')],'freshdesk':this[_0xd937('0x12')],'sugarcrm':this[_0xd937('0x14')],'zoho':this[_0xd937('0x15')],'desk':this[_0xd937('0x16')],'vtiger':this[_0xd937('0x17')],'dynamics365':this[_0xd937('0x19')],'freshsales':this[_0xd937('0x1a')],'servicenow':this[_0xd937('0x18')]};ami['on'](_0xd937('0x1c'),this[_0xd937('0x1d')]['bind'](this));ami['on'](_0xd937('0x1e'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x20'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x21'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x22'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xd937('0x1f')](this));ami['on'](_0xd937('0x23'),this['syncCustomEvent'][_0xd937('0x1f')](this));ami['on'](_0xd937('0x24'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:agentreject',this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x25'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x26'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x27'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on']('custom:dialbegin',this[_0xd937('0x28')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x29'),this[_0xd937('0x28')]['bind'](this));ami['on'](_0xd937('0x2a'),this[_0xd937('0x28')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2b'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2c'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2d'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2e'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2f'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x30'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x31'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));}Trigger['prototype']['emit']=function(_0x592cb7,_0x6c8fc6,_0x54a348){logger[_0xd937('0x32')](_0x592cb7,_0x6c8fc6,JSON['stringify'](_0x54a348));io['to'](_0x592cb7)[_0xd937('0x33')](_0x6c8fc6,_0x54a348);};Trigger[_0xd937('0x34')][_0xd937('0x1d')]=function(_0x700e62){var _0x36823a=_[_0xd937('0x35')](_0x700e62);if(typeof _0x36823a[_0xd937('0x36')]===_0xd937('0x37')){_0x36823a[_0xd937('0x36')]=_0xd937('0x38');}logger[_0xd937('0x39')](_0xd937('0x1d'),util[_0xd937('0x3a')](_0x36823a,{'showHidden':!![],'depth':null}));this[_0xd937('0x3b')](_0x36823a);};Trigger[_0xd937('0x34')][_0xd937('0x28')]=function(_0x3ca45f){if(this['agents'][_0x3ca45f[_0xd937('0x3c')]]){this[_0xd937('0x1d')](_0x3ca45f);}};Trigger[_0xd937('0x34')][_0xd937('0x3b')]=function(_0x39e413){var _0x20b7c2;for(var _0x4d9987 in this[_0xd937('0xc')]){if(this['triggers'][_0xd937('0x3d')](_0x4d9987)){if(this[_0xd937('0xc')][_0x4d9987][_0xd937('0x3e')]){_0x20b7c2=this[_0xd937('0x3f')](this['triggers'][_0x4d9987],_0x39e413);if(_0x20b7c2){_[_0xd937('0x40')](_0x39e413,_0x39e413[_0xd937('0x41')]);for(var _0x58b12e=0x0,_0x3f2fd5,_0x3a1eb3,_0x240562;_0x58b12e0x0){_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 _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x5fc3[_0x1793de];return _0x4f0309;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 917f090..40638e5 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 _0x71f5=[']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data5','POST','password','clientSecret','then','access_token','GET','Bearer\x20','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','catch','destcalleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','message','toLowerCase','outbound','calleridnum','telephone1','\x20eq\x20\x27','replace','%2b','value','contactid','nothing','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','phonecall','callDirection','queue','phonecalls','Descriptions','Fields','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x71f5,0x151));var _0x571f=function(_0x225b4e,_0x179ee4){_0x225b4e=_0x225b4e-0x0;var _0x24237a=_0x71f5[_0x225b4e];return _0x24237a;};'use strict';var _=require(_0x571f('0x0'));var rp=require(_0x571f('0x1'));var util=require(_0x571f('0x2'));var intUtil=require(_0x571f('0x3'));var md5=require(_0x571f('0x4'));var Redis=require(_0x571f('0x5'));var logger=require(_0x571f('0x6'))(_0x571f('0x7'));var config=require(_0x571f('0x8'));config[_0x571f('0x9')]=_[_0x571f('0xa')](config[_0x571f('0x9')],{'host':_0x571f('0xb'),'port':0x18eb});var io=require(_0x571f('0xc'))(new Redis(config[_0x571f('0x9')]));function getAuthToken(_0x32fe09,_0x20a70b,_0x548300){if(_0x32fe09[_0x571f('0xd')]){_0x32fe09[_0x571f('0xe')]=_0x32fe09['CloudProvider'][_0x571f('0xf')];_0x32fe09[_0x571f('0x10')]=_0x32fe09[_0x571f('0x11')]['data2'];return Promise['resolve'](_0x32fe09[_0x571f('0x11')][_0x571f('0x12')]);}var _0xe36671={'method':_0x571f('0x13'),'uri':_0x20a70b,'form':{'client_id':_0x32fe09['clientId'],'resource':_0x32fe09[_0x571f('0xe')],'username':_0x32fe09['username'],'password':_0x32fe09['password'],'grant_type':_0x571f('0x14'),'client_secret':_0x32fe09[_0x571f('0x15')]},'json':!![]};return rp(_0xe36671)[_0x571f('0x16')](function(_0x18eca4){return _0x18eca4[_0x571f('0x17')];})['catch'](function(_0x35f77c){logger['error']('['+[_0x548300['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x35f77c['message'];});}function getUser(_0x8632a8,_0x19139f,_0x333724,_0x3bc001,_0x4a7951,_0x2449ae){return new Promise(function(_0x36507f,_0x3432c6){return getAuthToken(_0x19139f,_0x3bc001,_0x2449ae)[_0x571f('0x16')](function(_0xe90f94){var _0x3bcbe8={'method':_0x571f('0x18'),'uri':_0x4a7951+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x571f('0x19')+_0xe90f94,'OData-Version':'4.0'},'json':!![]};return rp(_0x3bcbe8);})[_0x571f('0x16')](function(_0x35b2e7){var _0x3bbdbf=_0x35b2e7['value'];var _0x42a973=![];var _0x3b9449=null;if(!_[_0x571f('0x1a')](_0x333724)){if(intUtil[_0x571f('0x1b')](_0x333724[_0x571f('0x1c')])){_0x8632a8[_0x571f('0x1d')]=_0x333724['email'];for(_0x3b9449=0x0;_0x3b9449<_0x3bbdbf[_0x571f('0x1e')];_0x3b9449++){if(_0x3bbdbf[_0x3b9449][_0x571f('0x1f')]===_0x333724[_0x571f('0x1c')]&&!_0x3bbdbf[_0x3b9449][_0x571f('0x20')]){_0x42a973=!![];logger[_0x571f('0x21')]('['+[_0x2449ae['toUpperCase']()]+_0x571f('0x22')+_0x3bbdbf[_0x3b9449][_0x571f('0x23')]+'!');_0x8632a8[_0x571f('0x24')]=_0x3bbdbf[_0x3b9449][_0x571f('0x23')];}}}}if(!_0x42a973){logger['info']('['+[_0x2449ae['toUpperCase']()]+_0x571f('0x25'));_0x8632a8['userEmail']=_0x19139f[_0x571f('0x26')];for(_0x3b9449=0x0;_0x3b9449<_0x3bbdbf[_0x571f('0x1e')];_0x3b9449++){if(_0x3bbdbf[_0x3b9449][_0x571f('0x1f')]===_0x19139f[_0x571f('0x26')]){_0x8632a8[_0x571f('0x24')]=_0x3bbdbf[_0x3b9449][_0x571f('0x23')];}}}_0x36507f(_0x8632a8);})[_0x571f('0x27')](function(_0x30d931){_0x3432c6(_0x30d931['message']);});});}function createEndUser(_0x1559e8,_0x5b246a,_0x49b8a4,_0x2183bc,_0x30ebe6,_0x3a5fcb,_0x476dd0){return new Promise(function(_0xe108b0,_0x47a39c){return getAuthToken(_0x5b246a,_0x49b8a4,_0x3a5fcb)['then'](function(_0x4edb03){var _0x175ca4=_0x3a5fcb['toLowerCase']()==='outbound'?_0x30ebe6[_0x571f('0x28')]:_0x30ebe6['calleridnum'];var _0x58e905={'method':_0x571f('0x13'),'uri':_0x2183bc+_0x571f('0x29'),'body':{'fullname':_0x175ca4,'firstname':_0x175ca4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x571f('0x2a')+_0x1559e8['userId']+')'},'headers':{'Authorization':_0x571f('0x19')+_0x4edb03,'OData-Version':_0x571f('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x58e905[_0x571f('0x2c')][_0x476dd0]=_0x175ca4;return rp(_0x58e905);})[_0x571f('0x16')](function(_0x36a7dc){var _0x4fedd6=_0x36a7dc[_0x571f('0x2d')][_0x571f('0x2e')];var _0x232a50=_0x4fedd6[_0x571f('0x2f')](_0x4fedd6[_0x571f('0x30')]('(')+0x1,_0x4fedd6[_0x571f('0x30')](')'));_0x1559e8[_0x571f('0x31')]=_0x232a50;_0xe108b0(_0x1559e8);})[_0x571f('0x27')](function(_0x23b0fc){_0x47a39c(_0x23b0fc[_0x571f('0x32')]);});});}function getEndUser(_0x22ad8f,_0x1e7a3f,_0x4974f5,_0x2b441d,_0x1446e7,_0x4d57b2,_0x5cfbf0,_0x4b42a0){var _0xb8b24e=_0x4d57b2[_0x571f('0x33')]()===_0x571f('0x34')?_0x1446e7[_0x571f('0x28')]:_0x1446e7[_0x571f('0x35')];return getAuthToken(_0x1e7a3f,_0x4974f5,_0x4d57b2)[_0x571f('0x16')](function(_0x5c0e92){_0x4b42a0=_0x4b42a0?_0x4b42a0:_0x571f('0x36');var _0x3c0b36={'method':_0x571f('0x18'),'uri':_0x2b441d+'contacts?$select='+_0x4b42a0+'&$filter='+_0x4b42a0+_0x571f('0x37')+_0xb8b24e[_0x571f('0x38')]('+',_0x571f('0x39'))+'\x27','headers':{'Authorization':_0x571f('0x19')+_0x5c0e92,'If-None-Match':null,'OData-Version':_0x571f('0x2b')},'json':!![]};return rp(_0x3c0b36);})[_0x571f('0x16')](function(_0x3ebcf7){var _0x3c02bc=![];if(!_0x3ebcf7)return _0x3c02bc;var _0x4b7d59=_0x3ebcf7[_0x571f('0x3a')];for(var _0x4ed2ce=0x0;_0x4ed2ce<_0x4b7d59['length'];_0x4ed2ce++){if(_0x4b7d59[_0x4ed2ce][_0x4b42a0]===_0xb8b24e){_0x3c02bc=!![];_0x22ad8f['enduserId']=_0x4b7d59[_0x4ed2ce][_0x571f('0x3b')];}}return _0x3c02bc;})[_0x571f('0x16')](function(_0x394e5f){if(_0x394e5f)return _0x22ad8f;if(_0x5cfbf0===_0x571f('0x3c')){logger[_0x571f('0x21')]('['+[_0x4d57b2[_0x571f('0x3d')]()]+_0x571f('0x3e'));return _0x22ad8f;}return createEndUser(_0x22ad8f,_0x1e7a3f,_0x4974f5,_0x2b441d,_0x1446e7,_0x4d57b2,_0x4b42a0)[_0x571f('0x16')](function(_0x2c3fb2){logger[_0x571f('0x21')]('['+[_0x4d57b2[_0x571f('0x3d')]()]+']\x20Enduser\x20created!',_0x2c3fb2['enduserId']);return _0x2c3fb2;});});}function getCustomFields(_0x2474e9,_0x5d1d52,_0x261987){var _0x3977e3={};if(_0x2474e9['length']>0x0){_[_0x571f('0x3f')](_0x2474e9,function(_0x343ac5){if(_['includes']([_0x571f('0x40'),_0x571f('0x41')],_0x343ac5[_0x571f('0x42')])&&_0x343ac5[_0x571f('0x43')]&&!_0x343ac5[_0x571f('0x44')]){var _0x575167=_0x343ac5[_0x571f('0x45')][_0x571f('0x33')]();var _0x4d65db=_0x575167[_0x571f('0x2f')](0x0,_0x575167['indexOf']('_'));var _0x210e5c=_0x575167[_0x571f('0x2f')](_0x575167[_0x571f('0x46')]('_')+0x1);if(_0x4d65db===_0x261987){_0x3977e3[_0x210e5c]=_0x343ac5[_0x571f('0x47')];}}});}return _0x3977e3;}function getTicket(_0x4da7ba,_0x125c1c,_0x2ce153,_0x5415b1,_0x3be4cd,_0xee11e1,_0x682cc4){return new Promise(function(_0x345fb8,_0x5ea924){var _0x35a732;return getAuthToken(_0x125c1c,_0x2ce153,_0x682cc4)['then'](function(_0x31a45f){if(_0xee11e1[_0x571f('0x48')]===_0x571f('0x49')){_0x35a732={'method':_0x571f('0x13'),'uri':_0x5415b1+'incidents','body':Object[_0x571f('0x4a')]({},{'title':intUtil[_0x571f('0x4b')](_0xee11e1[_0x571f('0x4c')],_0x3be4cd,'\x20'),'description':intUtil[_0x571f('0x4b')](_0xee11e1['Descriptions'],_0x3be4cd,'\x0a'),'customerid_contact@odata.bind':_0x4da7ba[_0x571f('0x31')]?'/contacts('+_0x4da7ba[_0x571f('0x31')]+')':undefined,'ownerid@odata.bind':_0x571f('0x2a')+_0x4da7ba[_0x571f('0x24')]+')','caseorigincode':'1'},getCustomFields(_0xee11e1['Fields'],_0x3be4cd,_0xee11e1[_0x571f('0x48')])),'headers':{'Authorization':_0x571f('0x19')+_0x31a45f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xee11e1['ticketType']===_0x571f('0x4d')){var _0x39627f=_0x4da7ba['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4da7ba[_0x571f('0x24')]+')','participationtypemask':_0x4da7ba[_0x571f('0x4e')]===_0x571f('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4da7ba[_0x571f('0x31')]+')','participationtypemask':_0x4da7ba[_0x571f('0x4e')]===_0x571f('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x571f('0x2a')+_0x4da7ba['userId']+')','participationtypemask':_0x4da7ba[_0x571f('0x4e')]===_0x571f('0x4f')?0x2:0x1}];_0x35a732={'method':'POST','uri':_0x5415b1+_0x571f('0x50'),'body':Object[_0x571f('0x4a')]({},{'subject':intUtil['getString'](_0xee11e1[_0x571f('0x4c')],_0x3be4cd,'\x20'),'phonenumber':String(_0x3be4cd['calleridnum']),'description':intUtil[_0x571f('0x4b')](_0xee11e1[_0x571f('0x51')],_0x3be4cd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4da7ba[_0x571f('0x31')]?'/contacts('+_0x4da7ba[_0x571f('0x31')]+')':undefined,'ownerid@odata.bind':_0x571f('0x2a')+_0x4da7ba[_0x571f('0x24')]+')','directioncode':_0x4da7ba[_0x571f('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x39627f},getCustomFields(_0xee11e1[_0x571f('0x52')],_0x3be4cd,_0xee11e1[_0x571f('0x48')])),'headers':{'Authorization':_0x571f('0x19')+_0x31a45f,'OData-Version':_0x571f('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x35a732);})[_0x571f('0x16')](function(_0x5a7ba3){var _0x374b07=_0x5a7ba3['headers']['odata-entityid'];var _0x1b40ca=_0x374b07[_0x571f('0x2f')](_0x374b07[_0x571f('0x30')]('(')+0x1,_0x374b07[_0x571f('0x30')](')'));_0x4da7ba[_0x571f('0x53')]=_0x1b40ca;_0x345fb8(_0x4da7ba);})['catch'](function(_0x2d62f0){_0x5ea924(_0x2d62f0[_0x571f('0x32')]);});});}function emit(_0x554146,_0x51877c,_0x3aa82f,_0x12547d){var _0x2ae861={'uri':util[_0x571f('0x54')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x554146,_0x3aa82f,_0x12547d)};io['to'](util[_0x571f('0x54')](_0x571f('0x55'),_0x51877c))[_0x571f('0x56')](_0x571f('0x57'),_0x2ae861);}exports['cs']=function(_0x183952,_0x46bc2b,_0x23cc0,_0x2e2fc6,_0xbe1a59,_0x2ef177,_0x13a53e,_0x3529d6){var _0x1a8a7e={};_0x2ef177['remoteUri']=_0x2ef177[_0x571f('0xd')]?intUtil[_0x571f('0x58')](_0x2ef177[_0x571f('0x11')][_0x571f('0xf')]):intUtil[_0x571f('0x58')](_0x2ef177[_0x571f('0xe')]);_0x2ef177[_0x571f('0x59')]=intUtil[_0x571f('0x58')](_0x2ef177[_0x571f('0x59')]);_0x1a8a7e['callDirection']=_0x3529d6===_0x571f('0x4f')||_0x3529d6===_0x571f('0x5a')?_0x571f('0x4f'):_0x571f('0x34');var _0x1cce60=_0x2ef177[_0x571f('0xd')]?util[_0x571f('0x54')](_0x571f('0x5b'),_0x2ef177[_0x571f('0x11')][_0x571f('0xf')]):util[_0x571f('0x54')](_0x571f('0x5b'),_0x2ef177[_0x571f('0xe')]);var _0x17282a=util[_0x571f('0x54')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2ef177[_0x571f('0x10')]);var _0x5d3934=util[_0x571f('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ef177[_0x571f('0x59')],_0x46bc2b[_0x571f('0x5c')],md5(_0x46bc2b[_0x571f('0x5c')]));if(_0xbe1a59&&_0xbe1a59[_0x571f('0x5d')]){logger[_0x571f('0x21')](_0x571f('0x5e'),_0x571f('0x5f'));_0x46bc2b[_0x571f('0x60')]=_0x5d3934;}else if(_0x13a53e&&_0x13a53e[_0x571f('0x61')]&&_0x13a53e[_0x571f('0x61')]!==_0x571f('0x62')){logger['info']('[OUTBOUND]',_0x571f('0x5f'));_0x46bc2b[_0x571f('0x60')]=_0x5d3934;}else{_0x46bc2b[_0x571f('0x60')]='';}return getUser(_0x1a8a7e,_0x2ef177,_0x2e2fc6,_0x17282a,_0x1cce60,_0x3529d6)[_0x571f('0x16')](function(_0x405b7a){logger['info']('['+_0x3529d6[_0x571f('0x3d')]()+_0x571f('0x63'),_0x405b7a[_0x571f('0x24')]);logger[_0x571f('0x21')]('['+_0x3529d6['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x405b7a[_0x571f('0x1d')]);return getEndUser(_0x405b7a,_0x2ef177,_0x17282a,_0x1cce60,_0x46bc2b,_0x3529d6,_0x23cc0[_0x571f('0x64')],_0x23cc0[_0x571f('0x65')]);})[_0x571f('0x16')](function(_0x13d70d){logger[_0x571f('0x21')]('['+_0x3529d6['toUpperCase']()+_0x571f('0x66'),_0x13d70d[_0x571f('0x31')]);logger['info']('['+_0x3529d6['toUpperCase']()+_0x571f('0x67'),_0x46bc2b['calleridnum']);return getTicket(_0x13d70d,_0x2ef177,_0x17282a,_0x1cce60,_0x46bc2b,_0x23cc0,_0x3529d6);})[_0x571f('0x16')](function(_0x2d2e84){logger['info'](util[_0x571f('0x54')]('['+_0x3529d6[_0x571f('0x3d')]()+_0x571f('0x68'),_0x23cc0[_0x571f('0x48')],_0x2d2e84[_0x571f('0x53')]));logger[_0x571f('0x21')](util[_0x571f('0x54')]('['+_0x3529d6[_0x571f('0x3d')]()+_0x571f('0x69'),_0x3529d6));if(_0x3529d6!==_0x571f('0x5a')&&_0x23cc0['openNewTab']){logger[_0x571f('0x21')]('['+_0x3529d6[_0x571f('0x3d')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2ef177[_0x571f('0xe')],_0x2e2fc6[_0x571f('0x6a')],_0x23cc0[_0x571f('0x48')],_0x2d2e84[_0x571f('0x53')]);}})[_0x571f('0x27')](function(_0x1636e2){logger[_0x571f('0x6b')]('['+_0x3529d6[_0x571f('0x3d')]()+_0x571f('0x6c'),_0x1636e2['message']);console[_0x571f('0x6b')](_0x571f('0x6d'),_0x1636e2);});}; \ No newline at end of file +var _0x3283=['CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','telephone1','\x20eq\x20\x27','%2b','enduserId','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','info',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','indexOf','incident','POST','incidents','assign','getString','Subjects','/contacts(','Fields','ticketType','phonecall','queue','callDirection','/systemusers(','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','modernAuthentication','remoteUri'];(function(_0x104302,_0x3fa2b3){var _0x324d30=function(_0x1393d5){while(--_0x1393d5){_0x104302['push'](_0x104302['shift']());}};_0x324d30(++_0x3fa2b3);}(_0x3283,0xcd));var _0x3328=function(_0x5b7bc1,_0x43049c){_0x5b7bc1=_0x5b7bc1-0x0;var _0x5bc8be=_0x3283[_0x5b7bc1];return _0x5bc8be;};'use strict';var _=require(_0x3328('0x0'));var rp=require(_0x3328('0x1'));var util=require(_0x3328('0x2'));var intUtil=require('./util');var md5=require(_0x3328('0x3'));var Redis=require(_0x3328('0x4'));var logger=require('../../../../config/logger')(_0x3328('0x5'));var config=require(_0x3328('0x6'));config['redis']=_[_0x3328('0x7')](config['redis'],{'host':_0x3328('0x8'),'port':0x18eb});var io=require(_0x3328('0x9'))(new Redis(config[_0x3328('0xa')]));function getAuthToken(_0x1447df,_0x4c946c,_0x91cdf5){if(_0x1447df[_0x3328('0xb')]){_0x1447df[_0x3328('0xc')]=_0x1447df[_0x3328('0xd')][_0x3328('0xe')];_0x1447df[_0x3328('0xf')]=_0x1447df[_0x3328('0xd')][_0x3328('0x10')];return Promise[_0x3328('0x11')](_0x1447df[_0x3328('0xd')][_0x3328('0x12')]);}var _0x3967ea={'method':'POST','uri':_0x4c946c,'form':{'client_id':_0x1447df[_0x3328('0x13')],'resource':_0x1447df[_0x3328('0xc')],'username':_0x1447df[_0x3328('0x14')],'password':_0x1447df[_0x3328('0x15')],'grant_type':_0x3328('0x15'),'client_secret':_0x1447df[_0x3328('0x16')]},'json':!![]};return rp(_0x3967ea)[_0x3328('0x17')](function(_0x23070c){return _0x23070c[_0x3328('0x18')];})[_0x3328('0x19')](function(_0xd1b82b){logger[_0x3328('0x1a')]('['+[_0x91cdf5['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0xd1b82b[_0x3328('0x1b')];});}function getUser(_0x188024,_0x561d75,_0x50dc07,_0x1af2da,_0x16683f,_0x85a388){return new Promise(function(_0x47a7c5,_0x369e8c){return getAuthToken(_0x561d75,_0x1af2da,_0x85a388)['then'](function(_0x455c0f){var _0x4cf906={'method':_0x3328('0x1c'),'uri':_0x16683f+_0x3328('0x1d'),'headers':{'Authorization':_0x3328('0x1e')+_0x455c0f,'OData-Version':_0x3328('0x1f')},'json':!![]};return rp(_0x4cf906);})['then'](function(_0x59f356){var _0x243969=_0x59f356[_0x3328('0x20')];var _0x5cc0fe=![];var _0x34a034=null;if(!_[_0x3328('0x21')](_0x50dc07)){if(intUtil[_0x3328('0x22')](_0x50dc07[_0x3328('0x23')])){_0x188024[_0x3328('0x24')]=_0x50dc07['email'];for(_0x34a034=0x0;_0x34a034<_0x243969[_0x3328('0x25')];_0x34a034++){if(_0x243969[_0x34a034][_0x3328('0x26')]===_0x50dc07[_0x3328('0x23')]&&!_0x243969[_0x34a034][_0x3328('0x27')]){_0x5cc0fe=!![];logger['info']('['+[_0x85a388[_0x3328('0x28')]()]+_0x3328('0x29')+_0x243969[_0x34a034][_0x3328('0x2a')]+'!');_0x188024['userId']=_0x243969[_0x34a034][_0x3328('0x2a')];}}}}if(!_0x5cc0fe){logger['info']('['+[_0x85a388[_0x3328('0x28')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x188024[_0x3328('0x24')]=_0x561d75[_0x3328('0x14')];for(_0x34a034=0x0;_0x34a034<_0x243969[_0x3328('0x25')];_0x34a034++){if(_0x243969[_0x34a034][_0x3328('0x26')]===_0x561d75['username']){_0x188024[_0x3328('0x2b')]=_0x243969[_0x34a034]['systemuserid'];}}}_0x47a7c5(_0x188024);})[_0x3328('0x19')](function(_0x532db8){_0x369e8c(_0x532db8[_0x3328('0x1b')]);});});}function createEndUser(_0x3a58ef,_0x24e4ce,_0x4756f3,_0x27bbc0,_0x270b61,_0x35067c,_0x1ff592){return new Promise(function(_0x22ad76,_0x4dbcf5){return getAuthToken(_0x24e4ce,_0x4756f3,_0x35067c)['then'](function(_0x5cc5b4){var _0x1b6ed8=_0x35067c[_0x3328('0x2c')]()===_0x3328('0x2d')?_0x270b61[_0x3328('0x2e')]:_0x270b61[_0x3328('0x2f')];var _0x350006={'method':'POST','uri':_0x27bbc0+_0x3328('0x30'),'body':{'fullname':_0x1b6ed8,'firstname':_0x1b6ed8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3a58ef[_0x3328('0x2b')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5cc5b4,'OData-Version':_0x3328('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x350006['body'][_0x1ff592]=_0x1b6ed8;return rp(_0x350006);})[_0x3328('0x17')](function(_0x3fc623){var _0x337824=_0x3fc623['headers'][_0x3328('0x31')];var _0x47dc2d=_0x337824[_0x3328('0x32')](_0x337824['lastIndexOf']('(')+0x1,_0x337824[_0x3328('0x33')](')'));_0x3a58ef['enduserId']=_0x47dc2d;_0x22ad76(_0x3a58ef);})['catch'](function(_0x4915d2){_0x4dbcf5(_0x4915d2['message']);});});}function getEndUser(_0x51ca56,_0x31e9d5,_0x5d57f4,_0x2397a7,_0x34fb45,_0x52a5de,_0x460095,_0x27dfe5){var _0x3322d8=_0x52a5de['toLowerCase']()===_0x3328('0x2d')?_0x34fb45['destcalleridnum']:_0x34fb45[_0x3328('0x2f')];return getAuthToken(_0x31e9d5,_0x5d57f4,_0x52a5de)['then'](function(_0x44df49){_0x27dfe5=_0x27dfe5?_0x27dfe5:_0x3328('0x34');var _0x6c6d85={'method':_0x3328('0x1c'),'uri':_0x2397a7+'contacts?$select='+_0x27dfe5+'&$filter='+_0x27dfe5+_0x3328('0x35')+_0x3322d8['replace']('+',_0x3328('0x36'))+'\x27','headers':{'Authorization':_0x3328('0x1e')+_0x44df49,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x6c6d85);})[_0x3328('0x17')](function(_0x14a6ed){var _0x3c7baf=![];if(!_0x14a6ed)return _0x3c7baf;var _0x516d94=_0x14a6ed['value'];for(var _0x34dd50=0x0;_0x34dd50<_0x516d94['length'];_0x34dd50++){if(_0x516d94[_0x34dd50][_0x27dfe5]===_0x3322d8){_0x3c7baf=!![];_0x51ca56[_0x3328('0x37')]=_0x516d94[_0x34dd50]['contactid'];}}return _0x3c7baf;})[_0x3328('0x17')](function(_0x5a5ee8){if(_0x5a5ee8)return _0x51ca56;if(_0x460095===_0x3328('0x38')){logger['info']('['+[_0x52a5de['toUpperCase']()]+_0x3328('0x39'));return _0x51ca56;}return createEndUser(_0x51ca56,_0x31e9d5,_0x5d57f4,_0x2397a7,_0x34fb45,_0x52a5de,_0x27dfe5)[_0x3328('0x17')](function(_0x18b7eb){logger[_0x3328('0x3a')]('['+[_0x52a5de[_0x3328('0x28')]()]+_0x3328('0x3b'),_0x18b7eb['enduserId']);return _0x18b7eb;});});}function getCustomFields(_0x54b4c2,_0x1d68e2,_0x217c66){var _0x17b9dc={};if(_0x54b4c2[_0x3328('0x25')]>0x0){_[_0x3328('0x3c')](_0x54b4c2,function(_0x202547){if(_[_0x3328('0x3d')]([_0x3328('0x3e'),_0x3328('0x3f')],_0x202547[_0x3328('0x40')])&&_0x202547['nameField']&&!_0x202547[_0x3328('0x41')]){var _0x44ec4c=_0x202547[_0x3328('0x42')][_0x3328('0x2c')]();var _0x3a6260=_0x44ec4c[_0x3328('0x32')](0x0,_0x44ec4c[_0x3328('0x43')]('_'));var _0x116f17=_0x44ec4c[_0x3328('0x32')](_0x44ec4c['indexOf']('_')+0x1);if(_0x3a6260===_0x217c66){_0x17b9dc[_0x116f17]=_0x202547['content'];}}});}return _0x17b9dc;}function getTicket(_0x301f09,_0x13216d,_0x22feba,_0x2ffede,_0x180243,_0x39f898,_0x910ae5){return new Promise(function(_0x546a1b,_0x4fb15b){var _0x3997e3;return getAuthToken(_0x13216d,_0x22feba,_0x910ae5)[_0x3328('0x17')](function(_0x2be87d){if(_0x39f898['ticketType']===_0x3328('0x44')){_0x3997e3={'method':_0x3328('0x45'),'uri':_0x2ffede+_0x3328('0x46'),'body':Object[_0x3328('0x47')]({},{'title':intUtil[_0x3328('0x48')](_0x39f898[_0x3328('0x49')],_0x180243,'\x20'),'description':intUtil[_0x3328('0x48')](_0x39f898['Descriptions'],_0x180243,'\x0a'),'customerid_contact@odata.bind':_0x301f09[_0x3328('0x37')]?_0x3328('0x4a')+_0x301f09['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x301f09['userId']+')','caseorigincode':'1'},getCustomFields(_0x39f898[_0x3328('0x4b')],_0x180243,_0x39f898['ticketType'])),'headers':{'Authorization':_0x3328('0x1e')+_0x2be87d,'OData-Version':_0x3328('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x39f898[_0x3328('0x4c')]===_0x3328('0x4d')){var _0x55a89f=_0x301f09['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x301f09[_0x3328('0x2b')]+')','participationtypemask':_0x301f09['callDirection']===_0x3328('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x3328('0x4a')+_0x301f09[_0x3328('0x37')]+')','participationtypemask':_0x301f09[_0x3328('0x4f')]===_0x3328('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3328('0x50')+_0x301f09[_0x3328('0x2b')]+')','participationtypemask':_0x301f09[_0x3328('0x4f')]===_0x3328('0x4e')?0x2:0x1}];_0x3997e3={'method':'POST','uri':_0x2ffede+_0x3328('0x51'),'body':Object[_0x3328('0x47')]({},{'subject':intUtil['getString'](_0x39f898['Subjects'],_0x180243,'\x20'),'phonenumber':String(_0x180243[_0x3328('0x2f')]),'description':intUtil[_0x3328('0x48')](_0x39f898['Descriptions'],_0x180243,'\x0a'),'regardingobjectid_contact@odata.bind':_0x301f09[_0x3328('0x37')]?_0x3328('0x4a')+_0x301f09[_0x3328('0x37')]+')':undefined,'ownerid@odata.bind':_0x3328('0x50')+_0x301f09[_0x3328('0x2b')]+')','directioncode':_0x301f09[_0x3328('0x4f')]==='queue'?![]:!![],'phonecall_activity_parties':_0x55a89f},getCustomFields(_0x39f898['Fields'],_0x180243,_0x39f898[_0x3328('0x4c')])),'headers':{'Authorization':_0x3328('0x1e')+_0x2be87d,'OData-Version':_0x3328('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3997e3);})['then'](function(_0x4ac19f){var _0x1ead7a=_0x4ac19f['headers']['odata-entityid'];var _0x2d96d3=_0x1ead7a['substring'](_0x1ead7a[_0x3328('0x33')]('(')+0x1,_0x1ead7a[_0x3328('0x33')](')'));_0x301f09[_0x3328('0x52')]=_0x2d96d3;_0x546a1b(_0x301f09);})[_0x3328('0x19')](function(_0x434572){_0x4fb15b(_0x434572[_0x3328('0x1b')]);});});}function emit(_0x3c1bba,_0x596489,_0xa339e7,_0x21007f){var _0x1cb33c={'uri':util[_0x3328('0x53')](_0x3328('0x54'),_0x3c1bba,_0xa339e7,_0x21007f)};io['to'](util[_0x3328('0x53')](_0x3328('0x55'),_0x596489))[_0x3328('0x56')](_0x3328('0x57'),_0x1cb33c);}exports['cs']=function(_0x492a39,_0x94ed46,_0x349e6e,_0x2be07f,_0x40736b,_0x1fc267,_0x3c2b6d,_0x30d45d){var _0x281a81={};_0x1fc267[_0x3328('0xc')]=_0x1fc267[_0x3328('0xb')]?intUtil[_0x3328('0x58')](_0x1fc267[_0x3328('0xd')]['data7']):intUtil['stripTrailingSlash'](_0x1fc267[_0x3328('0xc')]);_0x1fc267['serverUrl']=intUtil[_0x3328('0x58')](_0x1fc267[_0x3328('0x59')]);_0x281a81['callDirection']=_0x30d45d==='queue'||_0x30d45d==='unmanaged'?_0x3328('0x4e'):_0x3328('0x2d');var _0x39a634=_0x1fc267[_0x3328('0xb')]?util[_0x3328('0x53')](_0x3328('0x5a'),_0x1fc267[_0x3328('0xd')]['data7']):util[_0x3328('0x53')](_0x3328('0x5a'),_0x1fc267[_0x3328('0xc')]);var _0x5b0819=util[_0x3328('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1fc267[_0x3328('0xf')]);var _0xeeff72=util[_0x3328('0x53')](_0x3328('0x5b'),_0x1fc267['serverUrl'],_0x94ed46[_0x3328('0x5c')],md5(_0x94ed46['uniqueid']));if(_0x40736b&&_0x40736b[_0x3328('0x5d')]){logger[_0x3328('0x3a')](_0x3328('0x5e'),_0x3328('0x5f'));_0x94ed46['recordingURL']=_0xeeff72;}else if(_0x3c2b6d&&_0x3c2b6d['recordingFormat']&&_0x3c2b6d[_0x3328('0x60')]!=='none'){logger['info'](_0x3328('0x61'),_0x3328('0x5f'));_0x94ed46[_0x3328('0x62')]=_0xeeff72;}else{_0x94ed46[_0x3328('0x62')]='';}return getUser(_0x281a81,_0x1fc267,_0x2be07f,_0x5b0819,_0x39a634,_0x30d45d)[_0x3328('0x17')](function(_0xbf34d1){logger['info']('['+_0x30d45d[_0x3328('0x28')]()+_0x3328('0x63'),_0xbf34d1[_0x3328('0x2b')]);logger[_0x3328('0x3a')]('['+_0x30d45d[_0x3328('0x28')]()+']\x20The\x20User\x20email\x20is:',_0xbf34d1['userEmail']);return getEndUser(_0xbf34d1,_0x1fc267,_0x5b0819,_0x39a634,_0x94ed46,_0x30d45d,_0x349e6e[_0x3328('0x64')],_0x349e6e[_0x3328('0x65')]);})[_0x3328('0x17')](function(_0x53476d){logger[_0x3328('0x3a')]('['+_0x30d45d['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x53476d['enduserId']);logger[_0x3328('0x3a')]('['+_0x30d45d['toUpperCase']()+_0x3328('0x66'),_0x94ed46[_0x3328('0x2f')]);return getTicket(_0x53476d,_0x1fc267,_0x5b0819,_0x39a634,_0x94ed46,_0x349e6e,_0x30d45d);})[_0x3328('0x17')](function(_0x128929){logger['info'](util[_0x3328('0x53')]('['+_0x30d45d[_0x3328('0x28')]()+_0x3328('0x67'),_0x349e6e['ticketType'],_0x128929[_0x3328('0x52')]));logger[_0x3328('0x3a')](util['format']('['+_0x30d45d[_0x3328('0x28')]()+_0x3328('0x68'),_0x30d45d));if(_0x30d45d!==_0x3328('0x69')&&_0x349e6e[_0x3328('0x6a')]){logger['info']('['+_0x30d45d[_0x3328('0x28')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1fc267['remoteUri'],_0x2be07f['name'],_0x349e6e['ticketType'],_0x128929[_0x3328('0x52')]);}})[_0x3328('0x19')](function(_0x165da0){logger['error']('['+_0x30d45d[_0x3328('0x28')]()+_0x3328('0x6b'),_0x165da0[_0x3328('0x1b')]);console[_0x3328('0x1a')](_0x3328('0x6c'),_0x165da0);});}; \ 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 490ec9b..bf37b1f 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 _0x8381=['application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','includes','picklist','type','nameField','toLowerCase','string','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x36e4ec,_0x313c4f){var _0x530023=function(_0x1c293b){while(--_0x1c293b){_0x36e4ec['push'](_0x36e4ec['shift']());}};_0x530023(++_0x313c4f);}(_0x8381,0xbb));var _0x1838=function(_0x4e0c27,_0x2aa24e){_0x4e0c27=_0x4e0c27-0x0;var _0x133305=_0x8381[_0x4e0c27];return _0x133305;};'use strict';var _=require(_0x1838('0x0'));var rp=require(_0x1838('0x1'));var md5=require(_0x1838('0x2'));var util=require(_0x1838('0x3'));var Redis=require(_0x1838('0x4'));var intUtil=require(_0x1838('0x5'));var config=require(_0x1838('0x6'));var logger=require(_0x1838('0x7'))('freshdesk');config['redis']=_['defaults'](config[_0x1838('0x8')],{'host':_0x1838('0x9'),'port':0x18eb});var io=require(_0x1838('0xa'))(new Redis(config[_0x1838('0x8')]));var headers={'Content-Type':'application/json','Accept':_0x1838('0xb')};function emit(_0x87872c,_0x6ee48f,_0x1720f4){io['to'](_0x87872c)[_0x1838('0xc')](_0x6ee48f,_0x1720f4);}function getTicket(_0x77e80,_0x3fa880,_0x400611,_0x527b7c,_0x106887){logger[_0x1838('0xd')](_0x1838('0xe'));var _0x358e33=_['merge']({'responder_id':_0x3fa880['id'],'requester_id':_0x400611['id'],'name':util[_0x1838('0xf')](_0x1838('0x10'),_0x106887[_0x1838('0x11')]),'phone':_0x106887[_0x1838('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1838('0x13')](_0x527b7c[_0x1838('0x14')],_0x106887,'\x20'),'description':intUtil[_0x1838('0x13')](_0x527b7c[_0x1838('0x15')],_0x106887,_0x1838('0x16')),'tags':getTags(_0x527b7c[_0x1838('0x17')],_0x1838('0x18'))},getCustomFields(_0x527b7c[_0x1838('0x19')],_0x106887));_0x358e33[_0x1838('0x1a')]=_[_0x1838('0x1b')](_[_0x1838('0x1c')](_0x358e33['custom_fields'],'id'),_0x1838('0x1d'));return request({'uri':util['format'](_0x1838('0x1e'),_0x77e80[_0x1838('0x1f')]),'method':'POST','body':_0x358e33})['then'](function(_0x351f38){logger[_0x1838('0xd')](_0x1838('0x20'));return _0x351f38;});}function getUser(_0x3ef78c,_0x2314bb){if(intUtil['validateEmail'](_0x2314bb)){return request({'uri':util[_0x1838('0xf')](_0x1838('0x21'),_0x3ef78c['remoteUri']),'qs':{'email':_0x2314bb}})['then'](function(_0x180e6f){if(_0x180e6f['length']){logger[_0x1838('0xd')](_0x1838('0x22'));return _[_0x1838('0x23')](_0x180e6f,function(_0x4c2fab){return _0x4c2fab[_0x1838('0x24')][_0x1838('0x25')]===_0x2314bb;});}else{logger[_0x1838('0xd')](_0x1838('0x26'));return request({'uri':util[_0x1838('0xf')](_0x1838('0x27'),_0x3ef78c[_0x1838('0x1f')])})[_0x1838('0x28')](function(_0x4e37ba){logger[_0x1838('0xd')](_0x1838('0x29'));return _0x4e37ba;});}});}else{logger[_0x1838('0xd')](_0x1838('0x2a'));return request({'uri':util[_0x1838('0xf')](_0x1838('0x27'),_0x3ef78c['remoteUri'])})[_0x1838('0x28')](function(_0x46fd53){logger[_0x1838('0xd')]('Admin\x20account\x20selected.');return _0x46fd53;});}}function getEndUser(_0x1247d9,_0x4783ba,_0x4192af){logger[_0x1838('0xd')](_0x1838('0x2b'),_0x4192af);return request({'uri':util['format']('%s/api/v2/contacts',_0x1247d9['remoteUri']),'qs':{'phone':_0x4192af}})[_0x1838('0x28')](function(_0x385718){if(_0x385718['length']){logger[_0x1838('0xd')](_0x1838('0x2c'));return _['find'](_0x385718,{'phone':_0x4192af});}else{logger[_0x1838('0xd')](_0x1838('0x2d'));return request({'uri':util[_0x1838('0xf')](_0x1838('0x2e'),_0x1247d9['remoteUri']),'method':_0x1838('0x2f'),'body':{'name':_0x4783ba,'phone':_0x4192af}})[_0x1838('0x28')](function(_0x47c79a){logger[_0x1838('0xd')](_0x1838('0x30'));return _0x47c79a;});}});}function getAuth(_0x328d75){return util['format'](_0x1838('0x31'),new Buffer(_0x328d75[_0x1838('0x32')]+':X')[_0x1838('0x33')](_0x1838('0x34')));}function request(_0x5844f9){logger[_0x1838('0x35')](_0x1838('0x36'),JSON[_0x1838('0x37')](_0x5844f9));return rp(_['defaults'](_0x5844f9,{'method':_0x1838('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x3ac54f,_0x4b46e2){var _0x52ea5d=[];if(_0x3ac54f&&_0x3ac54f[_0x1838('0x39')]>0x0){_0x52ea5d=_[_0x1838('0x3a')](_0x3ac54f,_0x4b46e2);}return _0x52ea5d;}function getCustomFields(_0x57feea,_0x2a9e49){var _0x28fb28=[];var _0x444468={'custom_fields':[]};if(_0x57feea['length']>0x0){_['forEach'](_0x57feea,function(_0x1cea63){if(_[_0x1838('0x3b')](['string',_0x1838('0x3c')],_0x1cea63[_0x1838('0x3d')])&&_0x1cea63['nameField']&&!_0x1cea63['customField']){_0x444468[_0x1cea63[_0x1838('0x3e')][_0x1838('0x3f')]()]=_0x1cea63['content']['toString']();}else if(_[_0x1838('0x3b')]([_0x1838('0x40'),_0x1838('0x3c')],_0x1cea63[_0x1838('0x3d')])&&_0x1cea63[_0x1838('0x41')]&&_0x1cea63[_0x1838('0x42')]){_0x444468['custom_fields'][_0x1838('0x43')]({'id':_0x1cea63[_0x1838('0x41')],'value':_0x1cea63['content']['toString']()});}else if(_0x1cea63[_0x1838('0x3d')]===_0x1838('0x44')&&_0x1cea63[_0x1838('0x45')]&&_0x1cea63[_0x1838('0x41')]&&_0x1cea63[_0x1838('0x42')]){_0x2a9e49[_0x1cea63[_0x1838('0x45')]]&&_0x444468[_0x1838('0x1a')][_0x1838('0x43')]({'id':_0x1cea63[_0x1838('0x41')],'value':_0x2a9e49[_0x1cea63[_0x1838('0x45')]][_0x1838('0x33')]()});}else if(_0x1cea63[_0x1838('0x3d')]===_0x1838('0x46')&&_0x1cea63[_0x1838('0x47')]&&_0x1cea63[_0x1838('0x47')][_0x1838('0x18')]&&_0x1cea63[_0x1838('0x41')]&&_0x1cea63[_0x1838('0x42')]){_0x2a9e49[_0x1cea63['Variable'][_0x1838('0x18')][_0x1838('0x3f')]()]&&_0x444468['custom_fields'][_0x1838('0x43')]({'id':_0x1cea63['idField'],'value':_0x2a9e49[_0x1cea63['Variable'][_0x1838('0x18')]['toLowerCase']()][_0x1838('0x33')]()});}});}return _0x444468;}exports[_0x1838('0x48')]=function(_0xb0561,_0x348b48,_0x3b40ad,_0x70b859,_0x3be7ce,_0x5b733c){var _0x210e8d,_0x490cc9;_0x5b733c[_0x1838('0x1f')]=intUtil[_0x1838('0x49')](_0x5b733c[_0x1838('0x1f')]);_0x5b733c[_0x1838('0x4a')]=intUtil[_0x1838('0x49')](_0x5b733c['serverUrl']);if(_0x3be7ce&&_0x3be7ce[_0x1838('0x4b')]){logger[_0x1838('0xd')]('[QUEUE]',_0x1838('0x4c'));_0x348b48[_0x1838('0x4d')]=util[_0x1838('0xf')](_0x1838('0x4e'),_0x5b733c[_0x1838('0x4a')],_0x348b48['uniqueid'],md5(_0x348b48[_0x1838('0x4f')]));}else{_0x348b48[_0x1838('0x4d')]='';}headers[_0x1838('0x50')]=getAuth(_0x5b733c);return getUser(_0x5b733c,_0x70b859[_0x1838('0x25')])['then'](function(_0x43b397){_0x210e8d=_0x43b397;logger[_0x1838('0xd')](_0x1838('0x51'),_0x210e8d['id']);return getEndUser(_0x5b733c,_0x348b48[_0x1838('0x11')],_0x348b48['calleridnum']);})[_0x1838('0x28')](function(_0x54e948){_0x490cc9=_0x54e948;logger['info'](_0x1838('0x52'),_0x490cc9['id']);return getTicket(_0x5b733c,_0x210e8d,_0x490cc9,_0x3b40ad,_0x348b48);})[_0x1838('0x28')](function(_0x35726f){if(_0x35726f&&_0x35726f['id']){logger[_0x1838('0xd')](_0x1838('0x20'));logger[_0x1838('0xd')]('The\x20Ticket\x20ID\x20is:',_0x35726f['id']);logger['info'](_0x1838('0x53'),_0x1838('0x54'));emit(util['format'](_0x1838('0x55'),_0x70b859['name']),_0x1838('0x56'),{'uri':util['format'](_0x1838('0x57'),_0x5b733c['remoteUri'],_0x35726f['id'])});}})[_0x1838('0x58')](function(_0x38d8ac){logger[_0x1838('0x59')](_0x1838('0x53'),JSON[_0x1838('0x37')](_0x38d8ac));});};exports[_0x1838('0x5a')]=function(_0x14450d,_0x3a5647,_0x3bfd06,_0x149cd9,_0x586b00,_0x29b150,_0x370a64){var _0x37cbef,_0x5bdb22;_0x29b150[_0x1838('0x1f')]=intUtil[_0x1838('0x49')](_0x29b150[_0x1838('0x1f')]);_0x29b150[_0x1838('0x4a')]=intUtil['stripTrailingSlash'](_0x29b150['serverUrl']);if(_0x370a64&&_0x370a64[_0x1838('0x5b')]&&_0x370a64[_0x1838('0x5b')]!==_0x1838('0x5c')){logger['info'](_0x1838('0x5d'),_0x1838('0x4c'));_0x3a5647[_0x1838('0x4d')]=util[_0x1838('0xf')](_0x1838('0x4e'),_0x29b150[_0x1838('0x4a')],_0x3a5647[_0x1838('0x4f')],md5(_0x3a5647[_0x1838('0x4f')]));}headers[_0x1838('0x50')]=getAuth(_0x29b150);return getUser(_0x29b150,_0x149cd9['email'])[_0x1838('0x28')](function(_0x317138){_0x37cbef=_0x317138;logger[_0x1838('0xd')](_0x1838('0x51'),_0x37cbef['id']);return getEndUser(_0x29b150,_0x3a5647[_0x1838('0x5e')],_0x3a5647[_0x1838('0x5f')]);})[_0x1838('0x28')](function(_0x211e9c){_0x5bdb22=_0x211e9c;logger[_0x1838('0xd')](_0x1838('0x52'),_0x5bdb22['id']);return getTicket(_0x29b150,_0x37cbef,_0x5bdb22,_0x3bfd06,_0x3a5647);})[_0x1838('0x28')](function(_0x332fdb){if(_0x332fdb&&_0x332fdb['id']){logger['info']('Ticket\x20created!');logger[_0x1838('0xd')](_0x1838('0x60'),_0x332fdb['id']);logger['info']('[OUTBOUND]',_0x1838('0x54'));emit(util[_0x1838('0xf')](_0x1838('0x55'),_0x149cd9['name']),_0x1838('0x56'),{'uri':util[_0x1838('0xf')](_0x1838('0x57'),_0x29b150['remoteUri'],_0x332fdb['id'])});}})[_0x1838('0x58')](function(_0x4fbad7){logger[_0x1838('0x59')](_0x1838('0x5d'),JSON[_0x1838('0x37')](_0x4fbad7));});};exports['unmanaged']=function(_0x370b9c,_0x345f5a,_0x1c4d28,_0x35ddd0,_0x2b14fb,_0x116ac9){var _0x5106e9,_0xbb4020;_0x116ac9[_0x1838('0x1f')]=intUtil[_0x1838('0x49')](_0x116ac9['remoteUri']);_0x116ac9[_0x1838('0x4a')]=intUtil[_0x1838('0x49')](_0x116ac9[_0x1838('0x4a')]);if(_0x2b14fb&&_0x2b14fb[_0x1838('0x4b')]){logger[_0x1838('0xd')]('['+_0x345f5a[_0x1838('0x61')][_0x1838('0x62')]()+']','Recording\x20is\x20enabled!');_0x345f5a[_0x1838('0x4d')]=util[_0x1838('0xf')](_0x1838('0x4e'),_0x116ac9[_0x1838('0x4a')],_0x345f5a[_0x1838('0x4f')],md5(_0x345f5a[_0x1838('0x4f')]));}else{_0x345f5a['recordingURL']='';}headers['Authorization']=getAuth(_0x116ac9);return getUser(_0x116ac9,'')[_0x1838('0x28')](function(_0xbb45f1){_0x5106e9=_0xbb45f1;logger[_0x1838('0xd')](_0x1838('0x51'),_0x5106e9['id']);return getEndUser(_0x116ac9,_0x345f5a['calleridname'],_0x345f5a[_0x1838('0x12')]);})['then'](function(_0x5c48be){_0xbb4020=_0x5c48be;logger[_0x1838('0xd')](_0x1838('0x52'),_0xbb4020['id']);return getTicket(_0x116ac9,_0x5106e9,_0xbb4020,_0x1c4d28,_0x345f5a);})[_0x1838('0x28')](function(_0x2accc2){if(_0x2accc2){logger['info'](_0x1838('0x20'));logger[_0x1838('0xd')](_0x1838('0x60'),_0x2accc2['id']);}})[_0x1838('0x58')](function(_0x1ef07a){logger[_0x1838('0x59')]('['+_0x345f5a[_0x1838('0x61')][_0x1838('0x62')]()+']',JSON[_0x1838('0x37')](_0x1ef07a));});}; \ No newline at end of file +var _0x7e0f=['getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','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!','Basic\x20%s','apiKey','toString','debug','[HTTP]','defaults','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','error','stringify','recordingFormat','none','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]','trigger:browser:url','lastevent','toUpperCase','catch','lodash','request-promise','md5','ioredis','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x7e0f,0x109));var _0xf7e0=function(_0x41b259,_0x1046a6){_0x41b259=_0x41b259-0x0;var _0x3712ef=_0x7e0f[_0x41b259];return _0x3712ef;};'use strict';var _=require(_0xf7e0('0x0'));var rp=require(_0xf7e0('0x1'));var md5=require(_0xf7e0('0x2'));var util=require('util');var Redis=require(_0xf7e0('0x3'));var intUtil=require('./util');var config=require(_0xf7e0('0x4'));var logger=require('../../../../config/logger')(_0xf7e0('0x5'));config[_0xf7e0('0x6')]=_['defaults'](config[_0xf7e0('0x6')],{'host':_0xf7e0('0x7'),'port':0x18eb});var io=require(_0xf7e0('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0xf7e0('0x9'),'Accept':_0xf7e0('0x9')};function emit(_0x5d4b98,_0x50de4f,_0x557349){io['to'](_0x5d4b98)[_0xf7e0('0xa')](_0x50de4f,_0x557349);}function getTicket(_0x17cc58,_0x1fcdee,_0x2a9e7a,_0x4d3b1b,_0x5d3597){logger[_0xf7e0('0xb')](_0xf7e0('0xc'));var _0x2c8760=_[_0xf7e0('0xd')]({'responder_id':_0x1fcdee['id'],'requester_id':_0x2a9e7a['id'],'name':util[_0xf7e0('0xe')](_0xf7e0('0xf'),_0x5d3597[_0xf7e0('0x10')]),'phone':_0x5d3597['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf7e0('0x11')](_0x4d3b1b[_0xf7e0('0x12')],_0x5d3597,'\x20'),'description':intUtil['getString'](_0x4d3b1b[_0xf7e0('0x13')],_0x5d3597,_0xf7e0('0x14')),'tags':getTags(_0x4d3b1b[_0xf7e0('0x15')],_0xf7e0('0x16'))},getCustomFields(_0x4d3b1b['Fields'],_0x5d3597));_0x2c8760[_0xf7e0('0x17')]=_[_0xf7e0('0x18')](_['keyBy'](_0x2c8760[_0xf7e0('0x17')],'id'),_0xf7e0('0x19'));return request({'uri':util['format'](_0xf7e0('0x1a'),_0x17cc58[_0xf7e0('0x1b')]),'method':_0xf7e0('0x1c'),'body':_0x2c8760})[_0xf7e0('0x1d')](function(_0x307496){logger[_0xf7e0('0xb')](_0xf7e0('0x1e'));return _0x307496;});}function getUser(_0x1b3f79,_0x4915ba){if(intUtil['validateEmail'](_0x4915ba)){return request({'uri':util[_0xf7e0('0xe')]('%s/api/v2/agents',_0x1b3f79[_0xf7e0('0x1b')]),'qs':{'email':_0x4915ba}})[_0xf7e0('0x1d')](function(_0xdd0155){if(_0xdd0155[_0xf7e0('0x1f')]){logger['info'](_0xf7e0('0x20'));return _[_0xf7e0('0x21')](_0xdd0155,function(_0x163aa2){return _0x163aa2[_0xf7e0('0x22')][_0xf7e0('0x23')]===_0x4915ba;});}else{logger['info'](_0xf7e0('0x24'));return request({'uri':util[_0xf7e0('0xe')](_0xf7e0('0x25'),_0x1b3f79[_0xf7e0('0x1b')])})[_0xf7e0('0x1d')](function(_0x1064a6){logger[_0xf7e0('0xb')](_0xf7e0('0x26'));return _0x1064a6;});}});}else{logger['info'](_0xf7e0('0x27'));return request({'uri':util[_0xf7e0('0xe')](_0xf7e0('0x25'),_0x1b3f79[_0xf7e0('0x1b')])})[_0xf7e0('0x1d')](function(_0x1891cd){logger[_0xf7e0('0xb')](_0xf7e0('0x26'));return _0x1891cd;});}}function getEndUser(_0x40189f,_0x3d22d5,_0x144ec1){logger[_0xf7e0('0xb')](_0xf7e0('0x28'),_0x144ec1);return request({'uri':util[_0xf7e0('0xe')](_0xf7e0('0x29'),_0x40189f['remoteUri']),'qs':{'phone':_0x144ec1}})[_0xf7e0('0x1d')](function(_0x518267){if(_0x518267[_0xf7e0('0x1f')]){logger[_0xf7e0('0xb')](_0xf7e0('0x2a'));return _[_0xf7e0('0x21')](_0x518267,{'phone':_0x144ec1});}else{logger[_0xf7e0('0xb')](_0xf7e0('0x2b'));return request({'uri':util[_0xf7e0('0xe')](_0xf7e0('0x29'),_0x40189f[_0xf7e0('0x1b')]),'method':'POST','body':{'name':_0x3d22d5,'phone':_0x144ec1}})[_0xf7e0('0x1d')](function(_0x4d4ab9){logger['info']('Enduser\x20created.');return _0x4d4ab9;});}});}function getAuth(_0x2d661d){return util[_0xf7e0('0xe')](_0xf7e0('0x2c'),new Buffer(_0x2d661d[_0xf7e0('0x2d')]+':X')[_0xf7e0('0x2e')]('base64'));}function request(_0x4bd599){logger[_0xf7e0('0x2f')](_0xf7e0('0x30'),JSON['stringify'](_0x4bd599));return rp(_[_0xf7e0('0x31')](_0x4bd599,{'method':_0xf7e0('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x78d9a1,_0x45023a){var _0x12ec1e=[];if(_0x78d9a1&&_0x78d9a1[_0xf7e0('0x1f')]>0x0){_0x12ec1e=_[_0xf7e0('0x33')](_0x78d9a1,_0x45023a);}return _0x12ec1e;}function getCustomFields(_0x46dfb4,_0x1f19b2){var _0xa24639=[];var _0x2b1c3b={'custom_fields':[]};if(_0x46dfb4['length']>0x0){_[_0xf7e0('0x34')](_0x46dfb4,function(_0x1d4461){if(_[_0xf7e0('0x35')]([_0xf7e0('0x36'),_0xf7e0('0x37')],_0x1d4461['type'])&&_0x1d4461[_0xf7e0('0x38')]&&!_0x1d4461[_0xf7e0('0x39')]){_0x2b1c3b[_0x1d4461['nameField'][_0xf7e0('0x3a')]()]=_0x1d4461[_0xf7e0('0x3b')][_0xf7e0('0x2e')]();}else if(_[_0xf7e0('0x35')](['string',_0xf7e0('0x37')],_0x1d4461[_0xf7e0('0x3c')])&&_0x1d4461[_0xf7e0('0x3d')]&&_0x1d4461[_0xf7e0('0x39')]){_0x2b1c3b['custom_fields'][_0xf7e0('0x3e')]({'id':_0x1d4461[_0xf7e0('0x3d')],'value':_0x1d4461['content'][_0xf7e0('0x2e')]()});}else if(_0x1d4461['type']===_0xf7e0('0x3f')&&_0x1d4461[_0xf7e0('0x40')]&&_0x1d4461[_0xf7e0('0x3d')]&&_0x1d4461[_0xf7e0('0x39')]){_0x1f19b2[_0x1d4461[_0xf7e0('0x40')]]&&_0x2b1c3b[_0xf7e0('0x17')]['push']({'id':_0x1d4461[_0xf7e0('0x3d')],'value':_0x1f19b2[_0x1d4461['variableName']][_0xf7e0('0x2e')]()});}else if(_0x1d4461[_0xf7e0('0x3c')]==='customVariable'&&_0x1d4461[_0xf7e0('0x41')]&&_0x1d4461[_0xf7e0('0x41')][_0xf7e0('0x16')]&&_0x1d4461[_0xf7e0('0x3d')]&&_0x1d4461[_0xf7e0('0x39')]){_0x1f19b2[_0x1d4461[_0xf7e0('0x41')][_0xf7e0('0x16')][_0xf7e0('0x3a')]()]&&_0x2b1c3b['custom_fields'][_0xf7e0('0x3e')]({'id':_0x1d4461[_0xf7e0('0x3d')],'value':_0x1f19b2[_0x1d4461['Variable'][_0xf7e0('0x16')][_0xf7e0('0x3a')]()]['toString']()});}});}return _0x2b1c3b;}exports[_0xf7e0('0x42')]=function(_0x36c226,_0xec1688,_0x2d81ec,_0xb0d5ff,_0xcc131,_0x1b95a2){var _0x5c978e,_0x8d6ad;_0x1b95a2[_0xf7e0('0x1b')]=intUtil[_0xf7e0('0x43')](_0x1b95a2[_0xf7e0('0x1b')]);_0x1b95a2[_0xf7e0('0x44')]=intUtil[_0xf7e0('0x43')](_0x1b95a2[_0xf7e0('0x44')]);if(_0xcc131&&_0xcc131[_0xf7e0('0x45')]){logger[_0xf7e0('0xb')](_0xf7e0('0x46'),_0xf7e0('0x47'));_0xec1688['recordingURL']=util['format'](_0xf7e0('0x48'),_0x1b95a2['serverUrl'],_0xec1688[_0xf7e0('0x49')],md5(_0xec1688[_0xf7e0('0x49')]));}else{_0xec1688['recordingURL']='';}headers[_0xf7e0('0x4a')]=getAuth(_0x1b95a2);return getUser(_0x1b95a2,_0xb0d5ff[_0xf7e0('0x23')])[_0xf7e0('0x1d')](function(_0x3e404b){_0x5c978e=_0x3e404b;logger[_0xf7e0('0xb')](_0xf7e0('0x4b'),_0x5c978e['id']);return getEndUser(_0x1b95a2,_0xec1688[_0xf7e0('0x10')],_0xec1688[_0xf7e0('0x4c')]);})[_0xf7e0('0x1d')](function(_0x4f2add){_0x8d6ad=_0x4f2add;logger['info'](_0xf7e0('0x4d'),_0x8d6ad['id']);return getTicket(_0x1b95a2,_0x5c978e,_0x8d6ad,_0x2d81ec,_0xec1688);})[_0xf7e0('0x1d')](function(_0x4b3cb5){if(_0x4b3cb5&&_0x4b3cb5['id']){logger[_0xf7e0('0xb')](_0xf7e0('0x1e'));logger[_0xf7e0('0xb')](_0xf7e0('0x4e'),_0x4b3cb5['id']);logger[_0xf7e0('0xb')](_0xf7e0('0x46'),_0xf7e0('0x4f'));emit(util['format'](_0xf7e0('0x50'),_0xb0d5ff[_0xf7e0('0x16')]),'trigger:browser:url',{'uri':util['format'](_0xf7e0('0x51'),_0x1b95a2[_0xf7e0('0x1b')],_0x4b3cb5['id'])});}})['catch'](function(_0x4e72b1){logger[_0xf7e0('0x52')]('[QUEUE]',JSON[_0xf7e0('0x53')](_0x4e72b1));});};exports['outbound']=function(_0x17b0f1,_0x26fd6a,_0xb90541,_0x5dddb6,_0x3548ab,_0x1f90c4,_0x347577){var _0x3850fb,_0x38e873;_0x1f90c4['remoteUri']=intUtil[_0xf7e0('0x43')](_0x1f90c4[_0xf7e0('0x1b')]);_0x1f90c4[_0xf7e0('0x44')]=intUtil[_0xf7e0('0x43')](_0x1f90c4['serverUrl']);if(_0x347577&&_0x347577[_0xf7e0('0x54')]&&_0x347577[_0xf7e0('0x54')]!==_0xf7e0('0x55')){logger[_0xf7e0('0xb')]('[OUTBOUND]',_0xf7e0('0x47'));_0x26fd6a[_0xf7e0('0x56')]=util['format'](_0xf7e0('0x48'),_0x1f90c4[_0xf7e0('0x44')],_0x26fd6a[_0xf7e0('0x49')],md5(_0x26fd6a[_0xf7e0('0x49')]));}headers['Authorization']=getAuth(_0x1f90c4);return getUser(_0x1f90c4,_0x5dddb6['email'])[_0xf7e0('0x1d')](function(_0x3223c7){_0x3850fb=_0x3223c7;logger[_0xf7e0('0xb')](_0xf7e0('0x4b'),_0x3850fb['id']);return getEndUser(_0x1f90c4,_0x26fd6a[_0xf7e0('0x57')],_0x26fd6a[_0xf7e0('0x58')]);})[_0xf7e0('0x1d')](function(_0x2aa9be){_0x38e873=_0x2aa9be;logger[_0xf7e0('0xb')](_0xf7e0('0x4d'),_0x38e873['id']);return getTicket(_0x1f90c4,_0x3850fb,_0x38e873,_0xb90541,_0x26fd6a);})[_0xf7e0('0x1d')](function(_0x5e6d2e){if(_0x5e6d2e&&_0x5e6d2e['id']){logger[_0xf7e0('0xb')]('Ticket\x20created!');logger[_0xf7e0('0xb')](_0xf7e0('0x4e'),_0x5e6d2e['id']);logger[_0xf7e0('0xb')](_0xf7e0('0x59'),_0xf7e0('0x4f'));emit(util[_0xf7e0('0xe')](_0xf7e0('0x50'),_0x5dddb6[_0xf7e0('0x16')]),_0xf7e0('0x5a'),{'uri':util[_0xf7e0('0xe')]('%s/helpdesk/tickets/%d',_0x1f90c4['remoteUri'],_0x5e6d2e['id'])});}})['catch'](function(_0x3feb59){logger[_0xf7e0('0x52')](_0xf7e0('0x59'),JSON['stringify'](_0x3feb59));});};exports['unmanaged']=function(_0x3136f4,_0xdbe5c2,_0x51a3ec,_0x25843c,_0x42d7fa,_0x1b5c22){var _0x256acd,_0xdc730f;_0x1b5c22[_0xf7e0('0x1b')]=intUtil[_0xf7e0('0x43')](_0x1b5c22[_0xf7e0('0x1b')]);_0x1b5c22[_0xf7e0('0x44')]=intUtil['stripTrailingSlash'](_0x1b5c22[_0xf7e0('0x44')]);if(_0x42d7fa&&_0x42d7fa[_0xf7e0('0x45')]){logger[_0xf7e0('0xb')]('['+_0xdbe5c2[_0xf7e0('0x5b')][_0xf7e0('0x5c')]()+']',_0xf7e0('0x47'));_0xdbe5c2['recordingURL']=util['format'](_0xf7e0('0x48'),_0x1b5c22[_0xf7e0('0x44')],_0xdbe5c2[_0xf7e0('0x49')],md5(_0xdbe5c2[_0xf7e0('0x49')]));}else{_0xdbe5c2[_0xf7e0('0x56')]='';}headers[_0xf7e0('0x4a')]=getAuth(_0x1b5c22);return getUser(_0x1b5c22,'')[_0xf7e0('0x1d')](function(_0x1bc506){_0x256acd=_0x1bc506;logger[_0xf7e0('0xb')](_0xf7e0('0x4b'),_0x256acd['id']);return getEndUser(_0x1b5c22,_0xdbe5c2['calleridname'],_0xdbe5c2['calleridnum']);})[_0xf7e0('0x1d')](function(_0x4be066){_0xdc730f=_0x4be066;logger[_0xf7e0('0xb')](_0xf7e0('0x4d'),_0xdc730f['id']);return getTicket(_0x1b5c22,_0x256acd,_0xdc730f,_0x51a3ec,_0xdbe5c2);})['then'](function(_0x3acb1d){if(_0x3acb1d){logger[_0xf7e0('0xb')](_0xf7e0('0x1e'));logger[_0xf7e0('0xb')](_0xf7e0('0x4e'),_0x3acb1d['id']);}})[_0xf7e0('0x5d')](function(_0x335999){logger[_0xf7e0('0x52')]('['+_0xdbe5c2[_0xf7e0('0x5b')][_0xf7e0('0x5c')]()+']',JSON[_0xf7e0('0x53')](_0x335999));});}; \ 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 635e101..deabf29 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 _0xd8df=['Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','Admin\x20selected','userId','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','contactNumber','endUserId'];(function(_0x3f9460,_0x78aee7){var _0x2374f8=function(_0x93e0a6){while(--_0x93e0a6){_0x3f9460['push'](_0x3f9460['shift']());}};_0x2374f8(++_0x78aee7);}(_0xd8df,0x88));var _0xfd8d=function(_0x49d302,_0x333dee){_0x49d302=_0x49d302-0x0;var _0x582c39=_0xd8df[_0x49d302];return _0x582c39;};'use strict';var _=require(_0xfd8d('0x0'));var rp=require(_0xfd8d('0x1'));var md5=require(_0xfd8d('0x2'));var util=require(_0xfd8d('0x3'));var moment=require(_0xfd8d('0x4'));var Promise=require(_0xfd8d('0x5'));var Redis=require(_0xfd8d('0x6'));var intUtil=require(_0xfd8d('0x7'));var config=require(_0xfd8d('0x8'));var logger=require(_0xfd8d('0x9'))(_0xfd8d('0xa'));config[_0xfd8d('0xb')]=_[_0xfd8d('0xc')](config['redis'],{'host':_0xfd8d('0xd'),'port':0x18eb});var io=require(_0xfd8d('0xe'))(new Redis(config[_0xfd8d('0xb')]));function getAdminId(_0x322dd9,_0xde6f19,_0x240c1c,_0xe62851){return new Promise(function(_0x2b09d6,_0x56a0a2){var _0x1e3982=![];var _0x229767={'method':_0xfd8d('0xf'),'uri':_0xe62851+_0xfd8d('0x10'),'json':!![]};_0x229767[_0xfd8d('0x11')]=_0x240c1c;logger[_0xfd8d('0x12')](_0xfd8d('0x13'));return rp(_0x229767)[_0xfd8d('0x14')](function(_0x9d9a50){if(_0x9d9a50){var _0x25ae68=_0x9d9a50[_0xfd8d('0x15')];var _0x3ca767=null;for(_0x3ca767=0x0;_0x3ca767<_0x25ae68[_0xfd8d('0x16')];_0x3ca767++){if(_0x25ae68[_0x3ca767][_0xfd8d('0x17')]===_0x322dd9[_0xfd8d('0x18')]){_0x322dd9[_0xfd8d('0x19')]=_0x25ae68[_0x3ca767]['id'];_0x1e3982=!![];}}if(_0x1e3982){logger[_0xfd8d('0x12')](_0xfd8d('0x1a'),_0x322dd9[_0xfd8d('0x19')]);_0x2b09d6(_0x322dd9);}else{_0x56a0a2({'statusCode':0x194,'message':_0xfd8d('0x1b')});}}else{_0x56a0a2({'statusCode':0x194,'message':_0xfd8d('0x1b')});}})[_0xfd8d('0x1c')](function(_0x34c738){logger[_0xfd8d('0x1d')]('['+[_0xde6f19['toUpperCase']()]+']',_0x34c738[_0xfd8d('0x1e')]);_0x56a0a2(_0x34c738);});});}function getUser(_0x959c60,_0x4d274d,_0x27430e){return function(_0x2740f3){return new Promise(function(_0x358a94,_0x198c2e){var _0x190d41={'method':_0xfd8d('0xf'),'uri':_0x27430e+_0xfd8d('0x10'),'json':!![]};_0x190d41[_0xfd8d('0x11')]=_0x4d274d;logger['info'](_0xfd8d('0x1f'));return rp(_0x190d41)[_0xfd8d('0x14')](function(_0xb06ae0){if(_0xb06ae0){var _0x3e7c24=_0xb06ae0[_0xfd8d('0x15')];var _0x3c7218=![];var _0x2f90f3=null;if(_0x2740f3[_0xfd8d('0x20')]!==null){logger[_0xfd8d('0x12')](_0xfd8d('0x21'),_0x2740f3[_0xfd8d('0x20')]);_0x2740f3[_0xfd8d('0x22')]=_0x2740f3[_0xfd8d('0x20')];for(_0x2f90f3=0x0;_0x2f90f3<_0x3e7c24['length'];_0x2f90f3++){if(_0x3e7c24[_0x2f90f3][_0xfd8d('0x17')]===_0x2740f3[_0xfd8d('0x20')]){_0x3c7218=!![];_0x2740f3['userId']=_0x3e7c24[_0x2f90f3]['id'];logger[_0xfd8d('0x12')](_0xfd8d('0x23'),_0x2740f3['userId']);}}}if(!_0x3c7218){logger[_0xfd8d('0x12')](_0xfd8d('0x24'));_0x2740f3[_0xfd8d('0x22')]=_0x2740f3[_0xfd8d('0x18')];_0x2740f3[_0xfd8d('0x25')]=_0x2740f3[_0xfd8d('0x19')];_0x3c7218=!![];}if(_0x3c7218){_0x358a94(_0x2740f3);}else{_0x198c2e({'statusCode':0x194,'message':_0xfd8d('0x1b')});}}else{_0x198c2e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xfd8d('0x1c')](function(_0x30ab84){logger['error']('['+[_0x959c60[_0xfd8d('0x26')]()]+']',_0x30ab84[_0xfd8d('0x1e')]);_0x198c2e(_0x30ab84);});});};}function searchContact(_0xe761fe,_0x3e9e1a,_0x4c293b,_0x570c06){return new Promise(function(_0x94251c,_0x4b6a9f){var _0x26bcb4={'method':_0xfd8d('0xf'),'headers':_0x3e9e1a,'uri':_0xe761fe+_0xfd8d('0x27')+_0x570c06+_0xfd8d('0x28')+_0x4c293b+_0xfd8d('0x29'),'json':!![]};rp(_0x26bcb4)[_0xfd8d('0x14')](function(_0x4e7257){var _0x454e2c=_['find'](_0x4e7257[_0xfd8d('0x2a')][_0xfd8d('0x2a')],[_0x4c293b,_0x570c06]);_0x94251c(_0x454e2c);})['catch'](function(_0x56e89f){_0x4b6a9f(_0x56e89f);});});}function getEndUser(_0x3dd069,_0x423867,_0x5eea90){return function(_0x824d73){return new Promise(function(_0xe73d92,_0x3abe85){logger[_0xfd8d('0x12')](util[_0xfd8d('0x2b')]('Searching\x20contact\x20with\x20phone\x20%s',_0x824d73[_0xfd8d('0x2c')]));searchContact(_0x5eea90,_0x423867,'mobile_number',_0x824d73['contactNumber'])[_0xfd8d('0x14')](function(_0x39978e){if(_0x39978e){_0x824d73[_0xfd8d('0x2d')]=_0x39978e['id'];logger['info'](_0xfd8d('0x2e'),_0x824d73['endUserId']);return _0xe73d92(_0x824d73);}searchContact(_0x5eea90,_0x423867,_0xfd8d('0x2f'),_0x824d73[_0xfd8d('0x2c')])[_0xfd8d('0x14')](function(_0x58e72c){if(_0x58e72c){_0x824d73[_0xfd8d('0x2d')]=_0x58e72c['id'];logger[_0xfd8d('0x12')]('Contact\x20found\x20work_number:',_0x824d73['endUserId']);return _0xe73d92(_0x824d73);}createEndUser(_0x824d73,_0x3dd069,_0x423867,_0x5eea90)[_0xfd8d('0x14')](function(_0x14f9f5){logger[_0xfd8d('0x12')](_0xfd8d('0x30'),_0x14f9f5[_0xfd8d('0x2d')]);return _0xe73d92(_0x14f9f5);});});})[_0xfd8d('0x1c')](function(_0x55d7c0){_0x3abe85(_0x55d7c0);});});};}function createEndUser(_0xf76866,_0x1ba2b9,_0xe2b4c3,_0x37cb38){return new Promise(function(_0x59a0be,_0x3e18d6){var _0x430f32=moment();var _0x48b153={'method':_0xfd8d('0x31'),'uri':_0x37cb38+_0xfd8d('0x32'),'body':{'contact':{'last_name':_0xf76866['contactNumber'],'work_number':_0xf76866['contactNumber'],'mobile_number':_0xf76866['contactNumber'],'owner_id':_0xf76866[_0xfd8d('0x25')],'created_at':_0x430f32[_0xfd8d('0x2b')](_0xfd8d('0x33'))}},'json':!![]};_0x48b153[_0xfd8d('0x11')]=_0xe2b4c3;logger[_0xfd8d('0x12')](_0xfd8d('0x34'));return rp(_0x48b153)[_0xfd8d('0x14')](function(_0x503ae5){_0xf76866['endUserId']=_0x503ae5[_0xfd8d('0x35')]['id'];_0x59a0be(_0xf76866);})[_0xfd8d('0x1c')](function(_0x4ca199){logger['error']('['+[_0x1ba2b9[_0xfd8d('0x26')]()]+']',_0x4ca199['message']);_0x3e18d6(_0x4ca199[_0xfd8d('0x1e')]);});});}function getTicket(_0x544c21,_0x6cef99,_0x3bb835,_0x3e9e3b,_0xd63f6){return function(_0x4a48ec){logger['info'](_0xfd8d('0x36'));return new Promise(function(_0x5f2035,_0x47aab4){var _0x4c3fc3=moment();var _0x4da336={'method':_0xfd8d('0x31'),'uri':_0x3bb835+'/api/tasks','body':{'title':intUtil[_0xfd8d('0x37')](_0x3e9e3b[_0xfd8d('0x38')],_0xd63f6,'\x20'),'description':intUtil[_0xfd8d('0x37')](_0x3e9e3b[_0xfd8d('0x39')],_0xd63f6,'\x0a'),'owner_id':_0x4a48ec[_0xfd8d('0x25')],'creater_id':_0x4a48ec[_0xfd8d('0x19')],'targetable_id':_0x4a48ec['endUserId'],'targetable_type':_0xfd8d('0x3a'),'created_at':_0x4c3fc3[_0xfd8d('0x2b')](_0xfd8d('0x33')),'due_date':_0x4c3fc3[_0xfd8d('0x3b')](0x1e,'m')['format'](_0xfd8d('0x33'))},'json':!![]};_0x4da336[_0xfd8d('0x11')]=_0x6cef99;return rp(_0x4da336)[_0xfd8d('0x14')](function(_0x5575b6){_0x4a48ec[_0xfd8d('0x3c')]=_0x5575b6[_0xfd8d('0x3d')]['id'];logger[_0xfd8d('0x12')](_0xfd8d('0x3e'),_0x4a48ec['ticketId']);_0x5f2035(_0x4a48ec);})[_0xfd8d('0x1c')](function(_0x27b533){logger[_0xfd8d('0x1d')]('['+[_0x544c21[_0xfd8d('0x26')]()]+']',_0x27b533['message']);_0x47aab4(_0x27b533[_0xfd8d('0x1e')]);});});};}function emit(_0x21a4c1,_0x2b25d9,_0x11a411){var _0x331d1b={'uri':_0x21a4c1+'/contacts/'+_0x11a411};io['to'](util['format']('user:%s',_0x2b25d9))[_0xfd8d('0x3f')](_0xfd8d('0x40'),_0x331d1b);}exports['cs']=function(_0x594eec,_0x425b33,_0x4c0f17,_0x4f0f51,_0x29988c,_0x51da14,_0x1759ef,_0xf72171){var _0x106420={};var _0x3abbdb={'Authorization':_0xfd8d('0x41')+_0x51da14[_0xfd8d('0x42')]};_0x51da14[_0xfd8d('0x43')]=intUtil[_0xfd8d('0x44')](_0x51da14[_0xfd8d('0x43')]);_0x51da14[_0xfd8d('0x45')]=intUtil[_0xfd8d('0x44')](_0x51da14[_0xfd8d('0x45')]);var _0x2239b5=_0x51da14[_0xfd8d('0x43')];_0x106420['adminEmail']=_0x51da14[_0xfd8d('0x46')];_0x106420[_0xfd8d('0x2c')]=_0xf72171['toLowerCase']()===_0xfd8d('0x47')?_0x425b33[_0xfd8d('0x48')]:_0x425b33[_0xfd8d('0x49')];_0x106420[_0xfd8d('0x4a')]=_0xf72171===_0xfd8d('0x4b')||_0xf72171===_0xfd8d('0x4c')?_0xfd8d('0x4b'):_0xfd8d('0x47');if(_0x4f0f51){_0x106420['agentEmail']=_0x4f0f51[_0xfd8d('0x17')];}var _0x46c19c=util['format'](_0xfd8d('0x4d'),_0x51da14[_0xfd8d('0x45')],_0x425b33[_0xfd8d('0x4e')],md5(_0x425b33[_0xfd8d('0x4e')]));if(_0x29988c&&_0x29988c[_0xfd8d('0x4f')]){logger[_0xfd8d('0x12')](_0xfd8d('0x50'),_0xfd8d('0x51'));_0x425b33[_0xfd8d('0x52')]=_0x46c19c;}else if(_0x1759ef&&_0x1759ef[_0xfd8d('0x53')]&&_0x1759ef[_0xfd8d('0x53')]!==_0xfd8d('0x54')){logger[_0xfd8d('0x12')](_0xfd8d('0x55'),_0xfd8d('0x51'));_0x425b33[_0xfd8d('0x52')]=_0x46c19c;}else{_0x425b33[_0xfd8d('0x52')]='';}return getAdminId(_0x106420,_0xf72171,_0x3abbdb,_0x2239b5)[_0xfd8d('0x14')](getUser(_0xf72171,_0x3abbdb,_0x2239b5))[_0xfd8d('0x14')](getEndUser(_0xf72171,_0x3abbdb,_0x2239b5))[_0xfd8d('0x14')](getTicket(_0xf72171,_0x3abbdb,_0x2239b5,_0x4c0f17,_0x425b33))['then'](function(_0x2f5936){logger[_0xfd8d('0x12')](util[_0xfd8d('0x2b')](_0xfd8d('0x56'),_0x2f5936['ticketId']));if(_0xf72171!==_0xfd8d('0x4c')){logger[_0xfd8d('0x12')]('['+[_0xf72171[_0xfd8d('0x26')]()]+']',_0xfd8d('0x57'));emit(_0x2239b5,_0x4f0f51[_0xfd8d('0x58')],_0x2f5936[_0xfd8d('0x2d')]);}})[_0xfd8d('0x1c')](function(_0x31996e){logger[_0xfd8d('0x1d')]('['+[_0xf72171[_0xfd8d('0x26')]()]+_0xfd8d('0x59'),util[_0xfd8d('0x5a')](_0x31996e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9778=['Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Requested\x20Resource\x20not\x20Found','catch','/api/lookup?q=','&f=','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','bluebird','./util','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET','headers','then','users','length','email','adminEmail','adminId','info','Admin\x20found:','error','toUpperCase','message','/api/selector/owners'];(function(_0x29c548,_0x5a5aed){var _0x25df4a=function(_0x1707f0){while(--_0x1707f0){_0x29c548['push'](_0x29c548['shift']());}};_0x25df4a(++_0x5a5aed);}(_0x9778,0x175));var _0x8977=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x9778[_0x220afa];return _0x1b79d1;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x8977('0x0'));var moment=require('moment');var Promise=require(_0x8977('0x1'));var Redis=require('ioredis');var intUtil=require(_0x8977('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8977('0x3'))(_0x8977('0x4'));config['redis']=_[_0x8977('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8977('0x6'))(new Redis(config[_0x8977('0x7')]));function getAdminId(_0x393ee9,_0x1868be,_0x1acb8c,_0x5b3334){return new Promise(function(_0x15a269,_0xe4bd31){var _0x2b2e24=![];var _0x18b1ce={'method':_0x8977('0x8'),'uri':_0x5b3334+'/api/selector/owners','json':!![]};_0x18b1ce[_0x8977('0x9')]=_0x1acb8c;logger['info']('Getting\x20admin\x20information');return rp(_0x18b1ce)[_0x8977('0xa')](function(_0x234bc9){if(_0x234bc9){var _0xd3257d=_0x234bc9[_0x8977('0xb')];var _0x2b2a96=null;for(_0x2b2a96=0x0;_0x2b2a96<_0xd3257d[_0x8977('0xc')];_0x2b2a96++){if(_0xd3257d[_0x2b2a96][_0x8977('0xd')]===_0x393ee9[_0x8977('0xe')]){_0x393ee9[_0x8977('0xf')]=_0xd3257d[_0x2b2a96]['id'];_0x2b2e24=!![];}}if(_0x2b2e24){logger[_0x8977('0x10')](_0x8977('0x11'),_0x393ee9[_0x8977('0xf')]);_0x15a269(_0x393ee9);}else{_0xe4bd31({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xe4bd31({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x7a7754){logger[_0x8977('0x12')]('['+[_0x1868be[_0x8977('0x13')]()]+']',_0x7a7754[_0x8977('0x14')]);_0xe4bd31(_0x7a7754);});});}function getUser(_0x4f8d4d,_0x44e3a3,_0x1f8b36){return function(_0x4007b2){return new Promise(function(_0xd292e5,_0x55247f){var _0x123164={'method':'GET','uri':_0x1f8b36+_0x8977('0x15'),'json':!![]};_0x123164[_0x8977('0x9')]=_0x44e3a3;logger[_0x8977('0x10')](_0x8977('0x16'));return rp(_0x123164)['then'](function(_0xb8eaff){if(_0xb8eaff){var _0x22998d=_0xb8eaff[_0x8977('0xb')];var _0x5b9ec1=![];var _0x26ccb3=null;if(_0x4007b2[_0x8977('0x17')]!==null){logger['info'](_0x8977('0x18'),_0x4007b2['agentEmail']);_0x4007b2[_0x8977('0x19')]=_0x4007b2[_0x8977('0x17')];for(_0x26ccb3=0x0;_0x26ccb3<_0x22998d[_0x8977('0xc')];_0x26ccb3++){if(_0x22998d[_0x26ccb3][_0x8977('0xd')]===_0x4007b2[_0x8977('0x17')]){_0x5b9ec1=!![];_0x4007b2[_0x8977('0x1a')]=_0x22998d[_0x26ccb3]['id'];logger[_0x8977('0x10')](_0x8977('0x1b'),_0x4007b2['userId']);}}}if(!_0x5b9ec1){logger[_0x8977('0x10')]('Admin\x20selected');_0x4007b2[_0x8977('0x19')]=_0x4007b2['adminEmail'];_0x4007b2['userId']=_0x4007b2[_0x8977('0xf')];_0x5b9ec1=!![];}if(_0x5b9ec1){_0xd292e5(_0x4007b2);}else{_0x55247f({'statusCode':0x194,'message':_0x8977('0x1c')});}}else{_0x55247f({'statusCode':0x194,'message':_0x8977('0x1c')});}})[_0x8977('0x1d')](function(_0x3bc77a){logger['error']('['+[_0x4f8d4d['toUpperCase']()]+']',_0x3bc77a[_0x8977('0x14')]);_0x55247f(_0x3bc77a);});});};}function searchContact(_0x5c0ce3,_0xc8c898,_0x28f38c,_0x1f7d14){return new Promise(function(_0x1e7549,_0x1454ac){var _0x12491f={'method':_0x8977('0x8'),'headers':_0xc8c898,'uri':_0x5c0ce3+_0x8977('0x1e')+_0x1f7d14+_0x8977('0x1f')+_0x28f38c+'&entities=contact','json':!![]};rp(_0x12491f)[_0x8977('0xa')](function(_0x3a67f0){var _0x5d1aa3=_[_0x8977('0x20')](_0x3a67f0['contacts']['contacts'],[_0x28f38c,_0x1f7d14]);_0x1e7549(_0x5d1aa3);})[_0x8977('0x1d')](function(_0x10c23a){_0x1454ac(_0x10c23a);});});}function getEndUser(_0x46fa6f,_0x101f21,_0x2905d8){return function(_0x5217d6){return new Promise(function(_0x4b189c,_0x919381){logger[_0x8977('0x10')](util[_0x8977('0x21')](_0x8977('0x22'),_0x5217d6[_0x8977('0x23')]));searchContact(_0x2905d8,_0x101f21,_0x8977('0x24'),_0x5217d6['contactNumber'])[_0x8977('0xa')](function(_0x343935){if(_0x343935){_0x5217d6[_0x8977('0x25')]=_0x343935['id'];logger[_0x8977('0x10')]('Contact\x20found\x20mobile_number:',_0x5217d6[_0x8977('0x25')]);return _0x4b189c(_0x5217d6);}searchContact(_0x2905d8,_0x101f21,_0x8977('0x26'),_0x5217d6[_0x8977('0x23')])[_0x8977('0xa')](function(_0x40737f){if(_0x40737f){_0x5217d6[_0x8977('0x25')]=_0x40737f['id'];logger['info'](_0x8977('0x27'),_0x5217d6['endUserId']);return _0x4b189c(_0x5217d6);}createEndUser(_0x5217d6,_0x46fa6f,_0x101f21,_0x2905d8)[_0x8977('0xa')](function(_0x472aad){logger['info'](_0x8977('0x28'),_0x472aad[_0x8977('0x25')]);return _0x4b189c(_0x472aad);});});})[_0x8977('0x1d')](function(_0x49556d){_0x919381(_0x49556d);});});};}function createEndUser(_0x3bfa35,_0x4b0ed5,_0x129a2d,_0xc754c9){return new Promise(function(_0x36c5de,_0x5bbc78){var _0x4f0da1=moment();var _0x3b9c7c={'method':_0x8977('0x29'),'uri':_0xc754c9+'/api/contacts','body':{'contact':{'last_name':_0x3bfa35[_0x8977('0x23')],'work_number':_0x3bfa35['contactNumber'],'mobile_number':_0x3bfa35[_0x8977('0x23')],'owner_id':_0x3bfa35[_0x8977('0x1a')],'created_at':_0x4f0da1[_0x8977('0x21')](_0x8977('0x2a'))}},'json':!![]};_0x3b9c7c[_0x8977('0x9')]=_0x129a2d;logger[_0x8977('0x10')](_0x8977('0x2b'));return rp(_0x3b9c7c)[_0x8977('0xa')](function(_0x60e43b){_0x3bfa35['endUserId']=_0x60e43b[_0x8977('0x2c')]['id'];_0x36c5de(_0x3bfa35);})[_0x8977('0x1d')](function(_0x5d42b6){logger['error']('['+[_0x4b0ed5['toUpperCase']()]+']',_0x5d42b6[_0x8977('0x14')]);_0x5bbc78(_0x5d42b6['message']);});});}function getTicket(_0x22f27d,_0x411593,_0x181cbb,_0x1e9906,_0x3d1043){return function(_0x3c8d7f){logger[_0x8977('0x10')]('Creating\x20new\x20task');return new Promise(function(_0x4422ce,_0x5246a4){var _0x261596=moment();var _0x5797d1={'method':_0x8977('0x29'),'uri':_0x181cbb+_0x8977('0x2d'),'body':{'title':intUtil[_0x8977('0x2e')](_0x1e9906[_0x8977('0x2f')],_0x3d1043,'\x20'),'description':intUtil[_0x8977('0x2e')](_0x1e9906[_0x8977('0x30')],_0x3d1043,'\x0a'),'owner_id':_0x3c8d7f[_0x8977('0x1a')],'creater_id':_0x3c8d7f[_0x8977('0xf')],'targetable_id':_0x3c8d7f[_0x8977('0x25')],'targetable_type':_0x8977('0x31'),'created_at':_0x261596[_0x8977('0x21')](_0x8977('0x2a')),'due_date':_0x261596[_0x8977('0x32')](0x1e,'m')[_0x8977('0x21')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5797d1[_0x8977('0x9')]=_0x411593;return rp(_0x5797d1)[_0x8977('0xa')](function(_0x3c5c62){_0x3c8d7f[_0x8977('0x33')]=_0x3c5c62['task']['id'];logger[_0x8977('0x10')](_0x8977('0x34'),_0x3c8d7f[_0x8977('0x33')]);_0x4422ce(_0x3c8d7f);})['catch'](function(_0x56465c){logger[_0x8977('0x12')]('['+[_0x22f27d[_0x8977('0x13')]()]+']',_0x56465c['message']);_0x5246a4(_0x56465c[_0x8977('0x14')]);});});};}function emit(_0x5e7fc9,_0xc33db8,_0x15e281){var _0x52e21e={'uri':_0x5e7fc9+_0x8977('0x35')+_0x15e281};io['to'](util[_0x8977('0x21')](_0x8977('0x36'),_0xc33db8))[_0x8977('0x37')](_0x8977('0x38'),_0x52e21e);}exports['cs']=function(_0x3c70b7,_0x4ea137,_0x27b615,_0x43b259,_0x2163bb,_0x4ae356,_0x59237b,_0x137e20){var _0x1f0c0d={};var _0x54cc26={'Authorization':'Token\x20token='+_0x4ae356[_0x8977('0x39')]};_0x4ae356[_0x8977('0x3a')]=intUtil[_0x8977('0x3b')](_0x4ae356[_0x8977('0x3a')]);_0x4ae356[_0x8977('0x3c')]=intUtil[_0x8977('0x3b')](_0x4ae356['serverUrl']);var _0x4e93c4=_0x4ae356[_0x8977('0x3a')];_0x1f0c0d['adminEmail']=_0x4ae356[_0x8977('0x3d')];_0x1f0c0d[_0x8977('0x23')]=_0x137e20['toLowerCase']()===_0x8977('0x3e')?_0x4ea137[_0x8977('0x3f')]:_0x4ea137[_0x8977('0x40')];_0x1f0c0d[_0x8977('0x41')]=_0x137e20===_0x8977('0x42')||_0x137e20===_0x8977('0x43')?_0x8977('0x42'):_0x8977('0x3e');if(_0x43b259){_0x1f0c0d['agentEmail']=_0x43b259[_0x8977('0xd')];}var _0x216e91=util[_0x8977('0x21')](_0x8977('0x44'),_0x4ae356[_0x8977('0x3c')],_0x4ea137[_0x8977('0x45')],md5(_0x4ea137[_0x8977('0x45')]));if(_0x2163bb&&_0x2163bb[_0x8977('0x46')]){logger[_0x8977('0x10')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4ea137[_0x8977('0x47')]=_0x216e91;}else if(_0x59237b&&_0x59237b[_0x8977('0x48')]&&_0x59237b[_0x8977('0x48')]!==_0x8977('0x49')){logger[_0x8977('0x10')](_0x8977('0x4a'),_0x8977('0x4b'));_0x4ea137[_0x8977('0x47')]=_0x216e91;}else{_0x4ea137['recordingURL']='';}return getAdminId(_0x1f0c0d,_0x137e20,_0x54cc26,_0x4e93c4)[_0x8977('0xa')](getUser(_0x137e20,_0x54cc26,_0x4e93c4))[_0x8977('0xa')](getEndUser(_0x137e20,_0x54cc26,_0x4e93c4))[_0x8977('0xa')](getTicket(_0x137e20,_0x54cc26,_0x4e93c4,_0x27b615,_0x4ea137))[_0x8977('0xa')](function(_0x1c9403){logger['info'](util[_0x8977('0x21')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1c9403[_0x8977('0x33')]));if(_0x137e20!==_0x8977('0x43')){logger[_0x8977('0x10')]('['+[_0x137e20[_0x8977('0x13')]()]+']',_0x8977('0x4c'));emit(_0x4e93c4,_0x43b259['name'],_0x1c9403[_0x8977('0x25')]);}})['catch'](function(_0x5c9574){logger[_0x8977('0x12')]('['+[_0x137e20[_0x8977('0x13')]()]+_0x8977('0x4d'),util[_0x8977('0x4e')](_0x5c9574,{'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 10541bc..d0f39af 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 _0xc9cb=['exec','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','sugarcrm','zoho','vtiger','freshsales','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','freshdesk','desk'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0xc9cb,0x152));var _0xbc9c=function(_0x516e75,_0x146772){_0x516e75=_0x516e75-0x0;var _0x5aadcc=_0xc9cb[_0x516e75];return _0x5aadcc;};'use strict';var _=require(_0xbc9c('0x0'));var util=require(_0xbc9c('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xbc9c('0x2'));var sugarcrm=require(_0xbc9c('0x3'));var freshdesk=require(_0xbc9c('0x4'));var zoho=require(_0xbc9c('0x5'));var desk=require(_0xbc9c('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0xbc9c('0x7'));var freshsales=require(_0xbc9c('0x8'));var integrations=[_0xbc9c('0x9'),'salesforce','sugarcrm',_0xbc9c('0xa'),'zoho',_0xbc9c('0xb'),'vtiger','dynamics365','freshsales','servicenow'];exports[_0xbc9c('0xc')]=function(_0x197044,_0x37798b,_0x24560f,_0x159f2e,_0xe13b01,_0x455264){if(_0x24560f){if(_['includes'](integrations,_0x197044[_0xbc9c('0xd')]['toLowerCase']())){try{var _0x3f8368=null;var _0x690183='';var _0xc9c332=_0x24560f[_0x197044['data1'][_0xbc9c('0xe')]()];if(_0xc9c332){var _0x454115=_0xc9c332[_0x197044[_0xbc9c('0xf')]];if(_0x454115){var _0x35bd28=_[_0xbc9c('0x10')](_0x454115['Configurations'],{'id':parseInt(_0x197044[_0xbc9c('0x11')],0xa)});if(_0x35bd28){if(_0x159f2e){if(_0xe13b01&&_0x37798b[_0xbc9c('0x12')]){_0x690183=_0xbc9c('0x12');}else if(_0x37798b[_0xbc9c('0x13')]){_0x690183=_0xbc9c('0x14');}else{console[_0xbc9c('0x15')](_0xbc9c('0x16'),_0x37798b);}}else{_0x690183='unmanaged';}switch(_0x197044[_0xbc9c('0xd')][_0xbc9c('0xe')]()){case _0xbc9c('0x9'):zendesk[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0x17'):salesforce[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0x18'):sugarcrm[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0xa'):freshdesk[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0x19'):zoho[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case'desk':desk[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0x1a'):vtiger[_0x690183](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264);break;case _0xbc9c('0x1b'):freshsales['cs'](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264,_0x690183);break;case _0xbc9c('0x1c'):servicenow['cs'](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264,_0x690183);break;case'dynamics365':dynamics365['cs'](_0x197044,_0x37798b,_0x35bd28,_0x159f2e,_0xe13b01,_0x454115,_0x455264,_0x690183);break;default:console[_0xbc9c('0x15')](_0xbc9c('0x1d'));}}else{_0x3f8368=require(_0xbc9c('0x1e'))(_0x197044[_0xbc9c('0xd')][_0xbc9c('0xe')]());_0x3f8368[_0xbc9c('0x1f')](_0xbc9c('0x20'),util[_0xbc9c('0x21')](_0xbc9c('0x22'),_0x197044[_0xbc9c('0xd')]['toLowerCase'](),_0x197044[_0xbc9c('0x11')]));}}else{_0x3f8368=require('../../../../config/logger')(_0x197044[_0xbc9c('0xd')]['toLowerCase']());_0x3f8368[_0xbc9c('0x1f')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x197044[_0xbc9c('0xd')]['toLowerCase'](),_0x197044[_0xbc9c('0xf')]));}}else{}}catch(_0x11a358){console['error'](_0x11a358);}}}}; \ No newline at end of file +var _0xae32=['error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','freshdesk','zoho','vtiger','freshsales','data1','toLowerCase','data2','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','data3'];(function(_0x249565,_0x2a026a){var _0x43dee8=function(_0x15a1ab){while(--_0x15a1ab){_0x249565['push'](_0x249565['shift']());}};_0x43dee8(++_0x2a026a);}(_0xae32,0x1d1));var _0x2ae3=function(_0x454a99,_0x45828d){_0x454a99=_0x454a99-0x0;var _0x2be278=_0xae32[_0x454a99];return _0x2be278;};'use strict';var _=require('lodash');var util=require(_0x2ae3('0x0'));var zendesk=require(_0x2ae3('0x1'));var salesforce=require(_0x2ae3('0x2'));var sugarcrm=require(_0x2ae3('0x3'));var freshdesk=require(_0x2ae3('0x4'));var zoho=require(_0x2ae3('0x5'));var desk=require(_0x2ae3('0x6'));var vtiger=require(_0x2ae3('0x7'));var servicenow=require(_0x2ae3('0x8'));var dynamics365=require(_0x2ae3('0x9'));var freshsales=require('./freshsales');var integrations=[_0x2ae3('0xa'),'salesforce','sugarcrm',_0x2ae3('0xb'),_0x2ae3('0xc'),'desk',_0x2ae3('0xd'),'dynamics365',_0x2ae3('0xe'),'servicenow'];exports['exec']=function(_0x1410a3,_0x437333,_0x40039d,_0x2a48b3,_0x1b363a,_0xedd822){if(_0x40039d){if(_['includes'](integrations,_0x1410a3[_0x2ae3('0xf')][_0x2ae3('0x10')]())){try{var _0x127cbd=null;var _0x37e1fc='';var _0x40ab92=_0x40039d[_0x1410a3[_0x2ae3('0xf')]['toLowerCase']()];if(_0x40ab92){var _0x6b3953=_0x40ab92[_0x1410a3[_0x2ae3('0x11')]];if(_0x6b3953){var _0x8ad102=_['find'](_0x6b3953[_0x2ae3('0x12')],{'id':parseInt(_0x1410a3['data3'],0xa)});if(_0x8ad102){if(_0x2a48b3){if(_0x1b363a&&_0x437333['queue']){_0x37e1fc=_0x2ae3('0x13');}else if(_0x437333['routeId']){_0x37e1fc=_0x2ae3('0x14');}else{console[_0x2ae3('0x15')](_0x2ae3('0x16'),_0x437333);}}else{_0x37e1fc=_0x2ae3('0x17');}switch(_0x1410a3['data1']['toLowerCase']()){case _0x2ae3('0xa'):zendesk[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case'salesforce':salesforce[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case'sugarcrm':sugarcrm[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case _0x2ae3('0xb'):freshdesk[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case _0x2ae3('0xc'):zoho[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case _0x2ae3('0x18'):desk[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case _0x2ae3('0xd'):vtiger[_0x37e1fc](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822);break;case _0x2ae3('0xe'):freshsales['cs'](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822,_0x37e1fc);break;case _0x2ae3('0x19'):servicenow['cs'](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822,_0x37e1fc);break;case _0x2ae3('0x1a'):dynamics365['cs'](_0x1410a3,_0x437333,_0x8ad102,_0x2a48b3,_0x1b363a,_0x6b3953,_0xedd822,_0x37e1fc);break;default:console['log'](_0x2ae3('0x1b'));}}else{_0x127cbd=require(_0x2ae3('0x1c'))(_0x1410a3[_0x2ae3('0xf')][_0x2ae3('0x10')]());_0x127cbd['error']('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x1410a3[_0x2ae3('0xf')][_0x2ae3('0x10')](),_0x1410a3[_0x2ae3('0x1d')]));}}else{_0x127cbd=require('../../../../config/logger')(_0x1410a3['data1'][_0x2ae3('0x10')]());_0x127cbd[_0x2ae3('0x1e')](_0x2ae3('0x1f'),util['format'](_0x2ae3('0x20'),_0x1410a3[_0x2ae3('0xf')][_0x2ae3('0x10')](),_0x1410a3[_0x2ae3('0x11')]));}}else{}}catch(_0x390fac){console[_0x2ae3('0x1e')](_0x390fac);}}}}; \ 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 5f1651d..732b695 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 _0x7fc1=['Subjects','getString','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhatId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','length','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','merge','$or','Contact','additionalSearchLead','account_contact_lead','Account','execute','additionalSearchContact','Lead','account','additionalSearchAccount','first','Name','Phone','attributes','type','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign'];(function(_0x2adbf6,_0x11ebaf){var _0xd1c1e1=function(_0x3370eb){while(--_0x3370eb){_0x2adbf6['push'](_0x2adbf6['shift']());}};_0xd1c1e1(++_0x11ebaf);}(_0x7fc1,0xf6));var _0x17fc=function(_0x10c3fd,_0x381e75){_0x10c3fd=_0x10c3fd-0x0;var _0x1a93a6=_0x7fc1[_0x10c3fd];return _0x1a93a6;};'use strict';var _=require(_0x17fc('0x0'));var rp=require(_0x17fc('0x1'));var moment=require('moment');var BPromise=require(_0x17fc('0x2'));var md5=require(_0x17fc('0x3'));var jsforce=require(_0x17fc('0x4'));var util=require(_0x17fc('0x5'));var Redis=require(_0x17fc('0x6'));var intUtil=require('./util');var config=require(_0x17fc('0x7'));var logger=require(_0x17fc('0x8'))(_0x17fc('0x9'));config[_0x17fc('0xa')]=_[_0x17fc('0xb')](config[_0x17fc('0xa')],{'host':_0x17fc('0xc'),'port':0x18eb});var io=require(_0x17fc('0xd'))(new Redis(config['redis']));function emit(_0x7ef433,_0x1cebe6,_0x2d70a6){io['to'](_0x7ef433)[_0x17fc('0xe')](_0x1cebe6,_0x2d70a6);}function getTicket(_0x2dd13d,_0x3e9d8f,_0x503a4a,_0x13d28c,_0x1e107a,_0x3375c6,_0x7a69e0,_0x2b1f06){var _0xcbcedf=Object[_0x17fc('0xf')]({},{'OwnerId':_0x3e9d8f['id'],'Subject':intUtil['getString'](_0x13d28c[_0x17fc('0x10')],_0x1e107a,'\x20'),'Description':intUtil[_0x17fc('0x11')](_0x13d28c[_0x17fc('0x12')],_0x1e107a,'\x0a')},getCustomFields(_0x3375c6,_0x1e107a));if(_0x503a4a){if(_0x13d28c[_0x17fc('0x13')]===_0x17fc('0x14')){_0xcbcedf['ActivityDate']=moment['utc']();_0xcbcedf[_0x17fc('0x15')]=![];_0xcbcedf[_0x17fc('0x16')]=![];if(_0x503a4a[_0x17fc('0x17')]===_0x17fc('0x18')||_0x503a4a[_0x17fc('0x17')]===_0x17fc('0x19')){_0xcbcedf['WhoId']=_0x503a4a['id'];}else if(_0x503a4a['endUserType']==='account'){_0xcbcedf[_0x17fc('0x1a')]=_0x503a4a['id'];}}else if(_0x13d28c['ticketType']==='Case'){if(_0x503a4a[_0x17fc('0x17')]===_0x17fc('0x18')){_0xcbcedf['ContactId']=_0x503a4a['id'];}else if(_0x503a4a[_0x17fc('0x17')]==='account'){_0xcbcedf[_0x17fc('0x1b')]=_0x503a4a['id'];}else if(_0x503a4a[_0x17fc('0x17')]==='lead'&&_0x13d28c['leadId']){_0xcbcedf[_0x13d28c[_0x17fc('0x1c')]]=_0x503a4a['id'];}else{logger[_0x17fc('0x1d')](_0x17fc('0x1e'));}}}return _0x7a69e0['sobject'](_0x13d28c[_0x17fc('0x13')])[_0x17fc('0x1f')](_0xcbcedf);}function getUser(_0x2bb0dd,_0x44b46c,_0x237c43){if(!_[_0x17fc('0x20')](_0x44b46c)&&intUtil[_0x17fc('0x21')](_0x44b46c)){var _0x3b48ce={'Email':_0x44b46c};var _0x56eafd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x237c43[_0x17fc('0x22')](_0x17fc('0x23'))[_0x17fc('0x24')](_0x3b48ce,_0x56eafd)['execute']()['then'](function(_0x36287b){if(_0x36287b[_0x17fc('0x25')]){var _0xc37ed0=_[_0x17fc('0x24')](_0x36287b,function(_0x5ad905){return _0x5ad905[_0x17fc('0x26')]===_0x44b46c;});if(_0xc37ed0){logger['info'](_0x17fc('0x27'),_0x44b46c);return BPromise['resolve']({'id':_0xc37ed0['Id'],'name':_0xc37ed0['Name']});}}else{logger[_0x17fc('0x1d')](_0x17fc('0x28'),_0x44b46c);return _0x237c43[_0x17fc('0x29')]()[_0x17fc('0x2a')](function(_0x11d993){return BPromise[_0x17fc('0x2b')]({'id':_0x11d993[_0x17fc('0x2c')],'name':_0x11d993[_0x17fc('0x2d')]});});}});}else{logger[_0x17fc('0x1d')](_0x17fc('0x28'),_0x44b46c);return _0x237c43[_0x17fc('0x29')]()[_0x17fc('0x2a')](function(_0x20d1a5){return BPromise[_0x17fc('0x2b')]({'id':_0x20d1a5[_0x17fc('0x2c')],'name':_0x20d1a5[_0x17fc('0x2d')]});});}}function getEndUser(_0x52e634,_0x3d61c6,_0x5a9606,_0x3f3da8,_0x2da955){var _0x11167c={'$or':{'Phone':_0x3f3da8}};var _0x2fdc51={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x17fc('0x2b')]()[_0x17fc('0x2a')](function(){logger[_0x17fc('0x1d')](_0x17fc('0x2e'),_0x3f3da8,_0x3d61c6[_0x17fc('0x2f')]);switch(_0x3d61c6[_0x17fc('0x2f')]){case _0x17fc('0x30'):var _0x3a69ce=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6['additionalSearchContact']){var _0xf43863={};_0xf43863[_0x3d61c6['additionalSearchContact']]=_0x3f3da8;_[_0x17fc('0x32')](_0x3a69ce[_0x17fc('0x33')],_0xf43863);}return _0x2da955[_0x17fc('0x22')](_0x17fc('0x34'))[_0x17fc('0x24')](_0x3a69ce,_0x2fdc51)['execute']()[_0x17fc('0x2a')](function(_0xb30184){if(_0xb30184&&_0xb30184[_0x17fc('0x25')]){return _0xb30184;}else{var _0x334611=_['cloneDeep'](_0x11167c);if(_0x3d61c6['additionalSearchLead']){var _0x3ac782={};_0x3ac782[_0x3d61c6[_0x17fc('0x35')]]=_0x3f3da8;_[_0x17fc('0x32')](_0x334611[_0x17fc('0x33')],_0x3ac782);}return _0x2da955[_0x17fc('0x22')]('Lead')[_0x17fc('0x24')](_0x334611,_0x2fdc51);}});case _0x17fc('0x36'):var _0xcb474=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6['additionalSearchAccount']){var _0xf43863={};_0xf43863[_0x3d61c6['additionalSearchAccount']]=_0x3f3da8;_[_0x17fc('0x32')](_0xcb474[_0x17fc('0x33')],_0xf43863);}return _0x2da955[_0x17fc('0x22')](_0x17fc('0x37'))[_0x17fc('0x24')](_0xcb474,_0x2fdc51)[_0x17fc('0x38')]()[_0x17fc('0x2a')](function(_0x2e6291){if(_0x2e6291&&_0x2e6291[_0x17fc('0x25')]){return _0x2e6291;}else{var _0x5371f9=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6[_0x17fc('0x39')]){var _0x27ad9f={};_0x27ad9f[_0x3d61c6[_0x17fc('0x39')]]=_0x3f3da8;_['merge'](_0x5371f9[_0x17fc('0x33')],_0x27ad9f);}return _0x2da955['sobject']('Contact')[_0x17fc('0x24')](_0x5371f9,_0x2fdc51)[_0x17fc('0x2a')](function(_0x1e8c06){if(_0x1e8c06&&_0x1e8c06[_0x17fc('0x25')]){return _0x1e8c06;}else{var _0xa82a21=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6[_0x17fc('0x35')]){var _0x160e1f={};_0x160e1f[_0x3d61c6[_0x17fc('0x35')]]=_0x3f3da8;_[_0x17fc('0x32')](_0xa82a21['$or'],_0x160e1f);}return _0x2da955[_0x17fc('0x22')](_0x17fc('0x3a'))[_0x17fc('0x24')](_0xa82a21,_0x2fdc51);}});}});case'contact':var _0x3a69ce=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6[_0x17fc('0x39')]){var _0xf43863={};_0xf43863[_0x3d61c6[_0x17fc('0x39')]]=_0x3f3da8;_['merge'](_0x3a69ce['$or'],_0xf43863);}return _0x2da955['sobject'](_0x17fc('0x34'))[_0x17fc('0x24')](_0x3a69ce,_0x2fdc51)[_0x17fc('0x38')]();case _0x17fc('0x19'):var _0x11ecf1=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6[_0x17fc('0x35')]){var _0xf43863={};_0xf43863[_0x3d61c6[_0x17fc('0x35')]]=_0x3f3da8;_[_0x17fc('0x32')](_0x11ecf1[_0x17fc('0x33')],_0xf43863);}return _0x2da955[_0x17fc('0x22')](_0x17fc('0x3a'))[_0x17fc('0x24')](_0x11ecf1,_0x2fdc51);case _0x17fc('0x3b'):var _0xcb474=_[_0x17fc('0x31')](_0x11167c);if(_0x3d61c6[_0x17fc('0x3c')]){var _0xf43863={};_0xf43863[_0x3d61c6[_0x17fc('0x3c')]]=_0x3f3da8;_[_0x17fc('0x32')](_0xcb474['$or'],_0xf43863);}return _0x2da955[_0x17fc('0x22')]('Account')[_0x17fc('0x24')](_0xcb474,_0x2fdc51);default:return null;}})[_0x17fc('0x2a')](function(_0x285de2){if(_0x285de2&&_0x285de2['length']){var _0x392219=_[_0x17fc('0x3d')](_0x285de2);if(_0x392219){return BPromise['resolve']({'id':_0x392219['Id'],'name':_0x392219[_0x17fc('0x3e')],'phone':_0x392219[_0x17fc('0x3f')],'endUserType':_0x392219[_0x17fc('0x40')][_0x17fc('0x41')]['toLowerCase']()});}}})[_0x17fc('0x2a')](function(_0x3272dd){if(_0x3272dd){logger[_0x17fc('0x1d')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x3272dd[_0x17fc('0x17')],_0x3f3da8);return BPromise[_0x17fc('0x2b')](_0x3272dd);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3f3da8);var _0x342548={'Phone':_0x3f3da8};if(_0x3d61c6[_0x17fc('0x42')]){if(_0x3d61c6[_0x17fc('0x42')]==='contact'){logger[_0x17fc('0x1d')](_0x17fc('0x43'),_0x3f3da8,_0x3d61c6[_0x17fc('0x42')]);_0x342548[_0x17fc('0x44')]=_0x5a9606!==''?_0x5a9606:util[_0x17fc('0x45')](_0x17fc('0x46'),_0x3f3da8);}else if(_0x3d61c6['moduleCreate']===_0x17fc('0x19')){logger[_0x17fc('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3f3da8,_0x3d61c6[_0x17fc('0x42')]);_0x342548['LastName']=_0x5a9606!==_0x17fc('0x47')?_0x5a9606:util['format'](_0x17fc('0x46'),_0x3f3da8);_0x342548[_0x17fc('0x48')]=_0x17fc('0x49');}else if(_0x3d61c6['moduleCreate']===_0x17fc('0x3b')){logger[_0x17fc('0x1d')](_0x17fc('0x43'),_0x3f3da8,_0x3d61c6[_0x17fc('0x42')]);_0x342548[_0x17fc('0x3e')]=_0x5a9606!==_0x17fc('0x47')?_0x5a9606:util[_0x17fc('0x45')](_0x17fc('0x46'),_0x3f3da8);}else{return null;}}return _0x2da955[_0x17fc('0x22')](_[_0x17fc('0x4a')](_0x3d61c6[_0x17fc('0x42')]))[_0x17fc('0x1f')](_0x342548)['then'](function(_0x7aa2f4){return BPromise['resolve']({'id':_0x7aa2f4['id'],'endUserType':_0x3d61c6[_0x17fc('0x42')]});});}});}function getCustomFields(_0x316a65,_0x179eb2){var _0x55e7e2={};if(_0x316a65['length']>0x0){_[_0x17fc('0x4b')](_0x316a65,function(_0x57c19c){if(_[_0x17fc('0x4c')]([_0x17fc('0x4d'),_0x17fc('0x4e')],_0x57c19c[_0x17fc('0x41')])&&_0x57c19c[_0x17fc('0x4f')]){_0x55e7e2[_0x57c19c[_0x17fc('0x4f')]]=_0x57c19c[_0x17fc('0x50')][_0x17fc('0x51')]();}else if(_0x57c19c['type']===_0x17fc('0x52')&&_0x57c19c[_0x17fc('0x53')]&&_0x57c19c[_0x17fc('0x4f')]){_0x179eb2[_0x57c19c[_0x17fc('0x53')]]&&(_0x55e7e2[_0x57c19c['idField']]=_0x179eb2[_0x57c19c[_0x17fc('0x53')]][_0x17fc('0x51')]());}else if(_0x57c19c[_0x17fc('0x41')]===_0x17fc('0x54')&&_0x57c19c[_0x17fc('0x55')]&&_0x57c19c[_0x17fc('0x55')]['name']&&_0x57c19c[_0x17fc('0x4f')]){_0x179eb2[_0x57c19c[_0x17fc('0x55')][_0x17fc('0x56')][_0x17fc('0x57')]()]&&(_0x55e7e2[_0x57c19c[_0x17fc('0x4f')]]=_0x179eb2[_0x57c19c[_0x17fc('0x55')][_0x17fc('0x56')][_0x17fc('0x57')]()][_0x17fc('0x51')]());}});}return _0x55e7e2;}function getConnection(_0x5802ee){var _0x23684e=_0x5802ee['password'][_0x17fc('0x58')](_0x5802ee[_0x17fc('0x59')]);var _0x37b2f7=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5802ee['remoteUri']||_0x17fc('0x5a'),'clientId':_0x5802ee[_0x17fc('0x5b')],'clientSecret':_0x5802ee[_0x17fc('0x5c')]}});return _0x37b2f7[_0x17fc('0x5d')](_0x5802ee[_0x17fc('0x5e')],_0x23684e)[_0x17fc('0x2a')](function(){logger[_0x17fc('0x1d')]('Connection\x20established.');return _0x37b2f7;});}exports[_0x17fc('0x5f')]=function(_0x1ab7c1,_0x28b531,_0x568202,_0x1b6293,_0x51c218,_0x14c209){var _0x42c8f2,_0x1e1fd3,_0x52c048,_0x5eb37f;_0x14c209[_0x17fc('0x60')]=intUtil[_0x17fc('0x61')](_0x14c209['serverUrl']);_0x14c209[_0x17fc('0x62')]=intUtil[_0x17fc('0x61')](_0x14c209[_0x17fc('0x62')]);if(_0x51c218&&_0x51c218[_0x17fc('0x63')]){logger[_0x17fc('0x1d')](_0x17fc('0x64'),_0x17fc('0x65'));_0x28b531[_0x17fc('0x66')]=util[_0x17fc('0x45')](_0x17fc('0x67'),_0x14c209[_0x17fc('0x60')],_0x28b531[_0x17fc('0x68')],md5(_0x28b531[_0x17fc('0x68')]));}else{_0x28b531[_0x17fc('0x66')]='';}return getConnection(_0x14c209)[_0x17fc('0x2a')](function(_0x57ce6d){_0x5eb37f=_0x57ce6d;return getUser(_0x14c209,_0x1b6293[_0x17fc('0x69')],_0x5eb37f);})[_0x17fc('0x2a')](function(_0x1d8e52){_0x42c8f2=_0x1d8e52;return getEndUser(_0x14c209,_0x568202,_0x28b531[_0x17fc('0x6a')],_0x28b531[_0x17fc('0x6b')],_0x5eb37f);})[_0x17fc('0x2a')](function(_0x2cf7e8){_0x1e1fd3=_0x2cf7e8;return getTicket(_0x14c209,_0x42c8f2,_0x1e1fd3,_0x568202,_0x28b531,_0x568202[_0x17fc('0x6c')],_0x5eb37f,_0x17fc('0x5f'));})[_0x17fc('0x2a')](function(_0x19dff6){_0x52c048=_0x19dff6;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x52c048['id']);logger[_0x17fc('0x1d')](_0x17fc('0x6d'),_0x52c048['id'],_0x1b6293[_0x17fc('0x56')],_0x14c209[_0x17fc('0x41')]);switch(_0x14c209[_0x17fc('0x41')]){case _0x17fc('0x6e'):emit(util[_0x17fc('0x45')]('user:%s',_0x1b6293[_0x17fc('0x56')]),'trigger:salesforce:display',{'recordId':_0x52c048['id']});break;case _0x17fc('0x6f'):emit(util[_0x17fc('0x45')](_0x17fc('0x70'),_0x1b6293['name']),_0x17fc('0x71'),{'uri':util[_0x17fc('0x45')]('%s/%s/e',_0x5eb37f[_0x17fc('0x72')],_0x52c048['id'])});break;default:logger[_0x17fc('0x73')](_0x17fc('0x74'));}})['catch'](function(_0x20c07d){logger[_0x17fc('0x73')](_0x17fc('0x64'),_0x20c07d);});};exports[_0x17fc('0x75')]=function(_0x8520ee,_0x1eb6d2,_0xc4bcce,_0x192b33,_0x5495a9,_0x23ec14,_0x5b0276){var _0x3ccf48,_0x5b91b6,_0xd4bcb6,_0x5a20a1;_0x23ec14[_0x17fc('0x60')]=intUtil['stripTrailingSlash'](_0x23ec14[_0x17fc('0x60')]);_0x23ec14['remoteUri']=intUtil[_0x17fc('0x61')](_0x23ec14[_0x17fc('0x62')]);if(_0x5b0276&&_0x5b0276[_0x17fc('0x76')]&&_0x5b0276['recordingFormat']!==_0x17fc('0x77')){logger[_0x17fc('0x1d')](_0x17fc('0x78'),_0x17fc('0x65'));_0x1eb6d2[_0x17fc('0x66')]=util[_0x17fc('0x45')](_0x17fc('0x67'),_0x23ec14[_0x17fc('0x60')],_0x1eb6d2[_0x17fc('0x68')],md5(_0x1eb6d2[_0x17fc('0x68')]));}return getConnection(_0x23ec14)[_0x17fc('0x2a')](function(_0x17b280){_0x5a20a1=_0x17b280;return getUser(_0x23ec14,_0x192b33[_0x17fc('0x69')],_0x5a20a1);})[_0x17fc('0x2a')](function(_0x5eec04){_0x3ccf48=_0x5eec04;return getEndUser(_0x23ec14,_0xc4bcce,_0x1eb6d2[_0x17fc('0x79')],_0x1eb6d2['destcalleridnum'],_0x5a20a1);})[_0x17fc('0x2a')](function(_0x51b98f){_0x5b91b6=_0x51b98f;return getTicket(_0x23ec14,_0x3ccf48,_0x5b91b6,_0xc4bcce,_0x1eb6d2,_0xc4bcce[_0x17fc('0x6c')],_0x5a20a1,'outbound');})['then'](function(_0x3a4aff){_0xd4bcb6=_0x3a4aff;logger[_0x17fc('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xd4bcb6['id']);logger[_0x17fc('0x1d')](_0x17fc('0x7a'),_0xd4bcb6['id'],_0x192b33[_0x17fc('0x56')],_0x23ec14[_0x17fc('0x41')]);switch(_0x23ec14[_0x17fc('0x41')]){case'integrationTab':emit(util[_0x17fc('0x45')](_0x17fc('0x70'),_0x192b33[_0x17fc('0x56')]),_0x17fc('0x7b'),{'recordId':_0xd4bcb6['id']});break;case _0x17fc('0x6f'):emit(util[_0x17fc('0x45')]('user:%s',_0x192b33[_0x17fc('0x56')]),_0x17fc('0x71'),{'uri':util[_0x17fc('0x45')](_0x17fc('0x7c'),_0x5a20a1[_0x17fc('0x72')],_0xd4bcb6['id'])});break;default:logger[_0x17fc('0x73')](_0x17fc('0x78'),_0x17fc('0x7d'));}})[_0x17fc('0x7e')](function(_0xd1383e){logger[_0x17fc('0x73')](_0x17fc('0x78'),_0xd1383e);});};exports[_0x17fc('0x7f')]=function(_0x4cc816,_0x34173d,_0x499dba,_0x13731e,_0x10a487,_0xf73ba5){var _0x4c5d8a,_0x5d966f,_0x50f1bc,_0x4f45a4;_0xf73ba5[_0x17fc('0x60')]=intUtil[_0x17fc('0x61')](_0xf73ba5['serverUrl']);_0xf73ba5[_0x17fc('0x62')]=intUtil[_0x17fc('0x61')](_0xf73ba5[_0x17fc('0x62')]);if(_0x10a487&&_0x10a487[_0x17fc('0x63')]){logger[_0x17fc('0x1d')]('['+_0x34173d[_0x17fc('0x80')][_0x17fc('0x81')]()+']',_0x17fc('0x65'));_0x34173d['recordingURL']=util['format'](_0x17fc('0x67'),_0xf73ba5[_0x17fc('0x60')],_0x34173d['uniqueid'],md5(_0x34173d[_0x17fc('0x68')]));}else{_0x34173d['recordingURL']='';}return getConnection(_0xf73ba5)[_0x17fc('0x2a')](function(_0x3bd7f0){_0x4f45a4=_0x3bd7f0;if(!_[_0x17fc('0x20')](_0x13731e)){return getUser(_0xf73ba5,_0x13731e[_0x17fc('0x56')],_0x4f45a4);}else{return getUser(_0xf73ba5,null,_0x4f45a4);}})[_0x17fc('0x2a')](function(_0x4d9fdb){_0x4c5d8a=_0x4d9fdb;return getEndUser(_0xf73ba5,_0x499dba,_0x34173d['calleridname'],_0x34173d[_0x17fc('0x6b')],_0x4f45a4);})[_0x17fc('0x2a')](function(_0x360537){_0x5d966f=_0x360537;return getTicket(_0xf73ba5,_0x4c5d8a,_0x5d966f,_0x499dba,_0x34173d,_0x499dba[_0x17fc('0x6c')],_0x4f45a4);})[_0x17fc('0x2a')](function(_0x5058b2){_0x50f1bc=_0x5058b2;logger[_0x17fc('0x1d')]('['+_0x34173d['lastevent'][_0x17fc('0x81')]()+']\x20Ticket\x20%s\x20created.',_0x50f1bc['id']);logger[_0x17fc('0x1d')]('['+_0x34173d[_0x17fc('0x80')][_0x17fc('0x81')]()+_0x17fc('0x82'),_0xf73ba5[_0x17fc('0x41')]);})[_0x17fc('0x7e')](function(_0x106c94){logger[_0x17fc('0x73')]('['+_0x34173d[_0x17fc('0x80')]['toUpperCase']()+']',_0x106c94);});}; \ No newline at end of file +var _0xe462=['calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','%s/%s/e','instanceUrl','lastevent','toUpperCase','calleridnum',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','contact','lead','account','WhatId','Case','ContactId','AccountId','leadId','sobject','create','User','then','Email','Agent\x20%s\x20found.','resolve','Name','info','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','find','execute','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','format','upperFirst','forEach','includes','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email'];(function(_0x2332e1,_0x433415){var _0x2c3bda=function(_0x253285){while(--_0x253285){_0x2332e1['push'](_0x2332e1['shift']());}};_0x2c3bda(++_0x433415);}(_0xe462,0x11b));var _0x2e46=function(_0x11cb1d,_0x4782da){_0x11cb1d=_0x11cb1d-0x0;var _0x353d97=_0xe462[_0x11cb1d];return _0x353d97;};'use strict';var _=require(_0x2e46('0x0'));var rp=require(_0x2e46('0x1'));var moment=require(_0x2e46('0x2'));var BPromise=require(_0x2e46('0x3'));var md5=require('md5');var jsforce=require(_0x2e46('0x4'));var util=require('util');var Redis=require(_0x2e46('0x5'));var intUtil=require(_0x2e46('0x6'));var config=require(_0x2e46('0x7'));var logger=require(_0x2e46('0x8'))(_0x2e46('0x9'));config[_0x2e46('0xa')]=_[_0x2e46('0xb')](config[_0x2e46('0xa')],{'host':_0x2e46('0xc'),'port':0x18eb});var io=require(_0x2e46('0xd'))(new Redis(config[_0x2e46('0xa')]));function emit(_0x5dcd51,_0x5d5157,_0x289696){io['to'](_0x5dcd51)[_0x2e46('0xe')](_0x5d5157,_0x289696);}function getTicket(_0x4d4cee,_0x17c122,_0x48e797,_0x13529f,_0x579d6b,_0xbf0083,_0x3dc080,_0x8c2ec){var _0xff86f5=Object[_0x2e46('0xf')]({},{'OwnerId':_0x17c122['id'],'Subject':intUtil[_0x2e46('0x10')](_0x13529f['Subjects'],_0x579d6b,'\x20'),'Description':intUtil[_0x2e46('0x10')](_0x13529f[_0x2e46('0x11')],_0x579d6b,'\x0a')},getCustomFields(_0xbf0083,_0x579d6b));if(_0x48e797){if(_0x13529f[_0x2e46('0x12')]===_0x2e46('0x13')){_0xff86f5[_0x2e46('0x14')]=moment[_0x2e46('0x15')]();_0xff86f5['IsReminderSet']=![];_0xff86f5['IsRecurrence']=![];if(_0x48e797[_0x2e46('0x16')]===_0x2e46('0x17')||_0x48e797[_0x2e46('0x16')]===_0x2e46('0x18')){_0xff86f5['WhoId']=_0x48e797['id'];}else if(_0x48e797[_0x2e46('0x16')]===_0x2e46('0x19')){_0xff86f5[_0x2e46('0x1a')]=_0x48e797['id'];}}else if(_0x13529f[_0x2e46('0x12')]===_0x2e46('0x1b')){if(_0x48e797[_0x2e46('0x16')]===_0x2e46('0x17')){_0xff86f5[_0x2e46('0x1c')]=_0x48e797['id'];}else if(_0x48e797[_0x2e46('0x16')]===_0x2e46('0x19')){_0xff86f5[_0x2e46('0x1d')]=_0x48e797['id'];}else if(_0x48e797['endUserType']===_0x2e46('0x18')&&_0x13529f['leadId']){_0xff86f5[_0x13529f[_0x2e46('0x1e')]]=_0x48e797['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3dc080[_0x2e46('0x1f')](_0x13529f['ticketType'])[_0x2e46('0x20')](_0xff86f5);}function getUser(_0x4849a1,_0x4a42d1,_0x3bf679){if(!_['isNil'](_0x4a42d1)&&intUtil['validateEmail'](_0x4a42d1)){var _0x4b3194={'Email':_0x4a42d1};var _0x397140={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3bf679[_0x2e46('0x1f')](_0x2e46('0x21'))['find'](_0x4b3194,_0x397140)['execute']()[_0x2e46('0x22')](function(_0x692bed){if(_0x692bed['length']){var _0x119dc4=_['find'](_0x692bed,function(_0x3ba9d7){return _0x3ba9d7[_0x2e46('0x23')]===_0x4a42d1;});if(_0x119dc4){logger['info'](_0x2e46('0x24'),_0x4a42d1);return BPromise[_0x2e46('0x25')]({'id':_0x119dc4['Id'],'name':_0x119dc4[_0x2e46('0x26')]});}}else{logger[_0x2e46('0x27')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4a42d1);return _0x3bf679[_0x2e46('0x28')]()['then'](function(_0x2cf430){return BPromise[_0x2e46('0x25')]({'id':_0x2cf430[_0x2e46('0x29')],'name':_0x2cf430[_0x2e46('0x2a')]});});}});}else{logger['info'](_0x2e46('0x2b'),_0x4a42d1);return _0x3bf679[_0x2e46('0x28')]()['then'](function(_0x3e3760){return BPromise[_0x2e46('0x25')]({'id':_0x3e3760['user_id'],'name':_0x3e3760[_0x2e46('0x2a')]});});}}function getEndUser(_0x385e75,_0x3e71c2,_0x4bcc1d,_0x1f1525,_0x48aa8f){var _0x4dea69={'$or':{'Phone':_0x1f1525}};var _0x247b21={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x2e46('0x22')](function(){logger[_0x2e46('0x27')](_0x2e46('0x2c'),_0x1f1525,_0x3e71c2[_0x2e46('0x2d')]);switch(_0x3e71c2[_0x2e46('0x2d')]){case _0x2e46('0x2e'):var _0x393151=_[_0x2e46('0x2f')](_0x4dea69);if(_0x3e71c2[_0x2e46('0x30')]){var _0x19b920={};_0x19b920[_0x3e71c2[_0x2e46('0x30')]]=_0x1f1525;_[_0x2e46('0x31')](_0x393151[_0x2e46('0x32')],_0x19b920);}return _0x48aa8f[_0x2e46('0x1f')](_0x2e46('0x33'))[_0x2e46('0x34')](_0x393151,_0x247b21)[_0x2e46('0x35')]()[_0x2e46('0x22')](function(_0xd7e22e){if(_0xd7e22e&&_0xd7e22e[_0x2e46('0x36')]){return _0xd7e22e;}else{var _0x43035b=_['cloneDeep'](_0x4dea69);if(_0x3e71c2[_0x2e46('0x37')]){var _0x67c0b9={};_0x67c0b9[_0x3e71c2['additionalSearchLead']]=_0x1f1525;_[_0x2e46('0x31')](_0x43035b[_0x2e46('0x32')],_0x67c0b9);}return _0x48aa8f['sobject'](_0x2e46('0x38'))['find'](_0x43035b,_0x247b21);}});case _0x2e46('0x39'):var _0x3ece81=_[_0x2e46('0x2f')](_0x4dea69);if(_0x3e71c2[_0x2e46('0x3a')]){var _0x19b920={};_0x19b920[_0x3e71c2['additionalSearchAccount']]=_0x1f1525;_[_0x2e46('0x31')](_0x3ece81[_0x2e46('0x32')],_0x19b920);}return _0x48aa8f[_0x2e46('0x1f')](_0x2e46('0x3b'))[_0x2e46('0x34')](_0x3ece81,_0x247b21)[_0x2e46('0x35')]()[_0x2e46('0x22')](function(_0xa7fd6){if(_0xa7fd6&&_0xa7fd6['length']){return _0xa7fd6;}else{var _0x10806d=_['cloneDeep'](_0x4dea69);if(_0x3e71c2['additionalSearchContact']){var _0x2994e4={};_0x2994e4[_0x3e71c2['additionalSearchContact']]=_0x1f1525;_[_0x2e46('0x31')](_0x10806d['$or'],_0x2994e4);}return _0x48aa8f[_0x2e46('0x1f')](_0x2e46('0x33'))[_0x2e46('0x34')](_0x10806d,_0x247b21)[_0x2e46('0x22')](function(_0x32bebd){if(_0x32bebd&&_0x32bebd[_0x2e46('0x36')]){return _0x32bebd;}else{var _0x259d83=_[_0x2e46('0x2f')](_0x4dea69);if(_0x3e71c2[_0x2e46('0x37')]){var _0x24a483={};_0x24a483[_0x3e71c2[_0x2e46('0x37')]]=_0x1f1525;_[_0x2e46('0x31')](_0x259d83[_0x2e46('0x32')],_0x24a483);}return _0x48aa8f[_0x2e46('0x1f')](_0x2e46('0x38'))[_0x2e46('0x34')](_0x259d83,_0x247b21);}});}});case _0x2e46('0x17'):var _0x393151=_['cloneDeep'](_0x4dea69);if(_0x3e71c2[_0x2e46('0x30')]){var _0x19b920={};_0x19b920[_0x3e71c2[_0x2e46('0x30')]]=_0x1f1525;_[_0x2e46('0x31')](_0x393151['$or'],_0x19b920);}return _0x48aa8f['sobject'](_0x2e46('0x33'))[_0x2e46('0x34')](_0x393151,_0x247b21)[_0x2e46('0x35')]();case _0x2e46('0x18'):var _0x5c5e15=_[_0x2e46('0x2f')](_0x4dea69);if(_0x3e71c2[_0x2e46('0x37')]){var _0x19b920={};_0x19b920[_0x3e71c2[_0x2e46('0x37')]]=_0x1f1525;_[_0x2e46('0x31')](_0x5c5e15[_0x2e46('0x32')],_0x19b920);}return _0x48aa8f['sobject'](_0x2e46('0x38'))[_0x2e46('0x34')](_0x5c5e15,_0x247b21);case _0x2e46('0x19'):var _0x3ece81=_['cloneDeep'](_0x4dea69);if(_0x3e71c2[_0x2e46('0x3a')]){var _0x19b920={};_0x19b920[_0x3e71c2['additionalSearchAccount']]=_0x1f1525;_['merge'](_0x3ece81[_0x2e46('0x32')],_0x19b920);}return _0x48aa8f[_0x2e46('0x1f')](_0x2e46('0x3b'))[_0x2e46('0x34')](_0x3ece81,_0x247b21);default:return null;}})['then'](function(_0x4b2f4a){if(_0x4b2f4a&&_0x4b2f4a[_0x2e46('0x36')]){var _0x2a5a39=_[_0x2e46('0x3c')](_0x4b2f4a);if(_0x2a5a39){return BPromise['resolve']({'id':_0x2a5a39['Id'],'name':_0x2a5a39[_0x2e46('0x26')],'phone':_0x2a5a39[_0x2e46('0x3d')],'endUserType':_0x2a5a39[_0x2e46('0x3e')][_0x2e46('0x3f')][_0x2e46('0x40')]()});}}})[_0x2e46('0x22')](function(_0x4753ce){if(_0x4753ce){logger[_0x2e46('0x27')](_0x2e46('0x41'),_0x4753ce[_0x2e46('0x16')],_0x1f1525);return BPromise['resolve'](_0x4753ce);}else{logger[_0x2e46('0x27')](_0x2e46('0x42'),_0x1f1525);var _0x2f462a={'Phone':_0x1f1525};if(_0x3e71c2[_0x2e46('0x43')]){if(_0x3e71c2[_0x2e46('0x43')]===_0x2e46('0x17')){logger[_0x2e46('0x27')](_0x2e46('0x44'),_0x1f1525,_0x3e71c2[_0x2e46('0x43')]);_0x2f462a[_0x2e46('0x45')]=_0x4bcc1d!==_0x2e46('0x46')?_0x4bcc1d:util['format'](_0x2e46('0x47'),_0x1f1525);}else if(_0x3e71c2[_0x2e46('0x43')]===_0x2e46('0x18')){logger[_0x2e46('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f1525,_0x3e71c2[_0x2e46('0x43')]);_0x2f462a[_0x2e46('0x45')]=_0x4bcc1d!==_0x2e46('0x46')?_0x4bcc1d:util['format'](_0x2e46('0x47'),_0x1f1525);_0x2f462a[_0x2e46('0x48')]=_0x2e46('0x49');}else if(_0x3e71c2[_0x2e46('0x43')]===_0x2e46('0x19')){logger[_0x2e46('0x27')](_0x2e46('0x44'),_0x1f1525,_0x3e71c2[_0x2e46('0x43')]);_0x2f462a[_0x2e46('0x26')]=_0x4bcc1d!==_0x2e46('0x46')?_0x4bcc1d:util[_0x2e46('0x4a')](_0x2e46('0x47'),_0x1f1525);}else{return null;}}return _0x48aa8f[_0x2e46('0x1f')](_[_0x2e46('0x4b')](_0x3e71c2[_0x2e46('0x43')]))[_0x2e46('0x20')](_0x2f462a)[_0x2e46('0x22')](function(_0x26638d){return BPromise['resolve']({'id':_0x26638d['id'],'endUserType':_0x3e71c2[_0x2e46('0x43')]});});}});}function getCustomFields(_0x5ae963,_0x14b929){var _0x11f16c={};if(_0x5ae963[_0x2e46('0x36')]>0x0){_[_0x2e46('0x4c')](_0x5ae963,function(_0xe2dcdf){if(_[_0x2e46('0x4d')](['string',_0x2e46('0x4e')],_0xe2dcdf['type'])&&_0xe2dcdf[_0x2e46('0x4f')]){_0x11f16c[_0xe2dcdf['idField']]=_0xe2dcdf[_0x2e46('0x50')][_0x2e46('0x51')]();}else if(_0xe2dcdf[_0x2e46('0x3f')]==='variable'&&_0xe2dcdf['variableName']&&_0xe2dcdf[_0x2e46('0x4f')]){_0x14b929[_0xe2dcdf[_0x2e46('0x52')]]&&(_0x11f16c[_0xe2dcdf['idField']]=_0x14b929[_0xe2dcdf[_0x2e46('0x52')]]['toString']());}else if(_0xe2dcdf[_0x2e46('0x3f')]===_0x2e46('0x53')&&_0xe2dcdf[_0x2e46('0x54')]&&_0xe2dcdf[_0x2e46('0x54')][_0x2e46('0x55')]&&_0xe2dcdf['idField']){_0x14b929[_0xe2dcdf[_0x2e46('0x54')][_0x2e46('0x55')][_0x2e46('0x40')]()]&&(_0x11f16c[_0xe2dcdf[_0x2e46('0x4f')]]=_0x14b929[_0xe2dcdf[_0x2e46('0x54')][_0x2e46('0x55')][_0x2e46('0x40')]()][_0x2e46('0x51')]());}});}return _0x11f16c;}function getConnection(_0x24bbf9){var _0x4dd75a=_0x24bbf9[_0x2e46('0x56')][_0x2e46('0x57')](_0x24bbf9[_0x2e46('0x58')]);var _0x2ab87e=new jsforce[(_0x2e46('0x59'))]({'oauth2':{'loginUrl':_0x24bbf9[_0x2e46('0x5a')]||_0x2e46('0x5b'),'clientId':_0x24bbf9['clientId'],'clientSecret':_0x24bbf9[_0x2e46('0x5c')]}});return _0x2ab87e[_0x2e46('0x5d')](_0x24bbf9['username'],_0x4dd75a)[_0x2e46('0x22')](function(){logger[_0x2e46('0x27')](_0x2e46('0x5e'));return _0x2ab87e;});}exports[_0x2e46('0x5f')]=function(_0x1a4def,_0x24dfe2,_0x538f94,_0x483cca,_0x5e0e33,_0x453eab){var _0x419fe0,_0x435589,_0x483b73,_0x2c90c2;_0x453eab['serverUrl']=intUtil[_0x2e46('0x60')](_0x453eab[_0x2e46('0x61')]);_0x453eab['remoteUri']=intUtil[_0x2e46('0x60')](_0x453eab[_0x2e46('0x5a')]);if(_0x5e0e33&&_0x5e0e33[_0x2e46('0x62')]){logger[_0x2e46('0x27')]('[QUEUE]',_0x2e46('0x63'));_0x24dfe2[_0x2e46('0x64')]=util['format'](_0x2e46('0x65'),_0x453eab[_0x2e46('0x61')],_0x24dfe2[_0x2e46('0x66')],md5(_0x24dfe2[_0x2e46('0x66')]));}else{_0x24dfe2[_0x2e46('0x64')]='';}return getConnection(_0x453eab)[_0x2e46('0x22')](function(_0x176402){_0x2c90c2=_0x176402;return getUser(_0x453eab,_0x483cca[_0x2e46('0x67')],_0x2c90c2);})[_0x2e46('0x22')](function(_0xff5135){_0x419fe0=_0xff5135;return getEndUser(_0x453eab,_0x538f94,_0x24dfe2[_0x2e46('0x68')],_0x24dfe2['calleridnum'],_0x2c90c2);})[_0x2e46('0x22')](function(_0x53ce81){_0x435589=_0x53ce81;return getTicket(_0x453eab,_0x419fe0,_0x435589,_0x538f94,_0x24dfe2,_0x538f94[_0x2e46('0x69')],_0x2c90c2,_0x2e46('0x5f'));})[_0x2e46('0x22')](function(_0x1827f2){_0x483b73=_0x1827f2;logger['info'](_0x2e46('0x6a'),_0x483b73['id']);logger[_0x2e46('0x27')](_0x2e46('0x6b'),_0x483b73['id'],_0x483cca[_0x2e46('0x55')],_0x453eab[_0x2e46('0x3f')]);switch(_0x453eab['type']){case'integrationTab':emit(util['format'](_0x2e46('0x6c'),_0x483cca[_0x2e46('0x55')]),_0x2e46('0x6d'),{'recordId':_0x483b73['id']});break;case'newTab':emit(util[_0x2e46('0x4a')](_0x2e46('0x6c'),_0x483cca[_0x2e46('0x55')]),_0x2e46('0x6e'),{'uri':util[_0x2e46('0x4a')]('%s/%s/e',_0x2c90c2['instanceUrl'],_0x483b73['id'])});break;default:logger['error'](_0x2e46('0x6f'));}})['catch'](function(_0x5d9a55){logger[_0x2e46('0x70')](_0x2e46('0x71'),_0x5d9a55);});};exports[_0x2e46('0x72')]=function(_0x1776cc,_0xe8a0c1,_0x182608,_0x52e018,_0x128cdf,_0x22915a,_0x4fa36b){var _0xc61548,_0x128b73,_0xcc3ff4,_0x1fbd61;_0x22915a[_0x2e46('0x61')]=intUtil[_0x2e46('0x60')](_0x22915a[_0x2e46('0x61')]);_0x22915a[_0x2e46('0x5a')]=intUtil[_0x2e46('0x60')](_0x22915a['remoteUri']);if(_0x4fa36b&&_0x4fa36b[_0x2e46('0x73')]&&_0x4fa36b[_0x2e46('0x73')]!==_0x2e46('0x74')){logger['info'](_0x2e46('0x75'),_0x2e46('0x63'));_0xe8a0c1[_0x2e46('0x64')]=util[_0x2e46('0x4a')](_0x2e46('0x65'),_0x22915a['serverUrl'],_0xe8a0c1[_0x2e46('0x66')],md5(_0xe8a0c1[_0x2e46('0x66')]));}return getConnection(_0x22915a)[_0x2e46('0x22')](function(_0xb9d2e6){_0x1fbd61=_0xb9d2e6;return getUser(_0x22915a,_0x52e018[_0x2e46('0x67')],_0x1fbd61);})['then'](function(_0x6e650c){_0xc61548=_0x6e650c;return getEndUser(_0x22915a,_0x182608,_0xe8a0c1['destcalleridname'],_0xe8a0c1['destcalleridnum'],_0x1fbd61);})['then'](function(_0x1858ca){_0x128b73=_0x1858ca;return getTicket(_0x22915a,_0xc61548,_0x128b73,_0x182608,_0xe8a0c1,_0x182608[_0x2e46('0x69')],_0x1fbd61,_0x2e46('0x72'));})[_0x2e46('0x22')](function(_0x3cc5ec){_0xcc3ff4=_0x3cc5ec;logger[_0x2e46('0x27')](_0x2e46('0x76'),_0xcc3ff4['id']);logger[_0x2e46('0x27')](_0x2e46('0x77'),_0xcc3ff4['id'],_0x52e018[_0x2e46('0x55')],_0x22915a[_0x2e46('0x3f')]);switch(_0x22915a[_0x2e46('0x3f')]){case _0x2e46('0x78'):emit(util['format'](_0x2e46('0x6c'),_0x52e018[_0x2e46('0x55')]),_0x2e46('0x6d'),{'recordId':_0xcc3ff4['id']});break;case _0x2e46('0x79'):emit(util['format'](_0x2e46('0x6c'),_0x52e018[_0x2e46('0x55')]),'trigger:browser:url',{'uri':util['format'](_0x2e46('0x7a'),_0x1fbd61[_0x2e46('0x7b')],_0xcc3ff4['id'])});break;default:logger[_0x2e46('0x70')](_0x2e46('0x75'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x211a4a){logger[_0x2e46('0x70')](_0x2e46('0x75'),_0x211a4a);});};exports['unmanaged']=function(_0x575b47,_0x132fec,_0x3a6568,_0x1e4cce,_0x446a4d,_0x35c3ed){var _0x4c222e,_0x54d6f9,_0x242c81,_0x3719e2;_0x35c3ed[_0x2e46('0x61')]=intUtil[_0x2e46('0x60')](_0x35c3ed[_0x2e46('0x61')]);_0x35c3ed['remoteUri']=intUtil[_0x2e46('0x60')](_0x35c3ed[_0x2e46('0x5a')]);if(_0x446a4d&&_0x446a4d[_0x2e46('0x62')]){logger[_0x2e46('0x27')]('['+_0x132fec[_0x2e46('0x7c')][_0x2e46('0x7d')]()+']',_0x2e46('0x63'));_0x132fec['recordingURL']=util[_0x2e46('0x4a')](_0x2e46('0x65'),_0x35c3ed[_0x2e46('0x61')],_0x132fec['uniqueid'],md5(_0x132fec[_0x2e46('0x66')]));}else{_0x132fec[_0x2e46('0x64')]='';}return getConnection(_0x35c3ed)[_0x2e46('0x22')](function(_0x343404){_0x3719e2=_0x343404;if(!_['isNil'](_0x1e4cce)){return getUser(_0x35c3ed,_0x1e4cce['name'],_0x3719e2);}else{return getUser(_0x35c3ed,null,_0x3719e2);}})[_0x2e46('0x22')](function(_0x4306d6){_0x4c222e=_0x4306d6;return getEndUser(_0x35c3ed,_0x3a6568,_0x132fec[_0x2e46('0x68')],_0x132fec[_0x2e46('0x7e')],_0x3719e2);})[_0x2e46('0x22')](function(_0xe20e52){_0x54d6f9=_0xe20e52;return getTicket(_0x35c3ed,_0x4c222e,_0x54d6f9,_0x3a6568,_0x132fec,_0x3a6568[_0x2e46('0x69')],_0x3719e2);})[_0x2e46('0x22')](function(_0x4d8429){_0x242c81=_0x4d8429;logger[_0x2e46('0x27')]('['+_0x132fec[_0x2e46('0x7c')][_0x2e46('0x7d')]()+']\x20Ticket\x20%s\x20created.',_0x242c81['id']);logger[_0x2e46('0x27')]('['+_0x132fec[_0x2e46('0x7c')]['toUpperCase']()+_0x2e46('0x7f'),_0x35c3ed[_0x2e46('0x3f')]);})[_0x2e46('0x80')](function(_0x1288bc){logger[_0x2e46('0x70')]('['+_0x132fec[_0x2e46('0x7c')][_0x2e46('0x7d')]()+']',_0x1288bc);});}; \ 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 3ff7b0d..be3eeae 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 _0x5340=['string','picklist','type','nameField','customField','toString','idField','variable','variableName','toLowerCase','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Fields','ticketNumber','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0x5340,0xb1));var _0x0534=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5340[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0534('0x0'));var Promise=require(_0x0534('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x0534('0x2'));var Redis=require(_0x0534('0x3'));var intUtil=require(_0x0534('0x4'));var config=require(_0x0534('0x5'));var logger=require(_0x0534('0x6'))(_0x0534('0x7'));config[_0x0534('0x8')]=_[_0x0534('0x9')](config[_0x0534('0x8')],{'host':_0x0534('0xa'),'port':0x18eb});var io=require(_0x0534('0xb'))(new Redis(config['redis']));function getAdminUser(_0x42ac42,_0xc09019,_0x2ea514,_0x28aa8e,_0x2aa43b,_0x45711a){return new Promise(function(_0xfd785d,_0x2e6a6e){var _0x3cde70={'method':'GET','uri':_0x28aa8e+_0x0534('0xc')+'&'+_0x2aa43b+'&'+_0x45711a,'auth':_0xc09019,'json':!![]};return rp(_0x3cde70)[_0x0534('0xd')](function(_0x2cf5a1){if(_0x2cf5a1[_0x0534('0xe')][_0x0534('0xf')]>0x0){_0x2ea514[_0x0534('0x10')]=_0x2cf5a1[_0x0534('0xe')][0x0][_0x0534('0x11')];}logger[_0x0534('0x12')]('['+[_0x42ac42['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x2ea514);_0xfd785d(_0x2ea514);})[_0x0534('0x13')](function(_0x43d557){logger[_0x0534('0x14')]('['+[_0x42ac42['toUpperCase']()]+']',_0x43d557[_0x0534('0x15')]);_0x2e6a6e(_0x43d557[_0x0534('0x15')]);});});}function getUser(_0x2b9faf,_0x7984a9,_0x2b8e86,_0x29957c,_0x5626ef){return function(_0x153682){logger[_0x0534('0x12')]('['+[_0x2b9faf[_0x0534('0x16')]()]+_0x0534('0x17'),_0x153682);return new Promise(function(_0x446dce,_0x4cb938){if(intUtil['validateEmail'](_0x153682[_0x0534('0x18')])){var _0x156c70={'method':_0x0534('0x19'),'uri':_0x2b8e86+_0x0534('0x1a')+_0x153682[_0x0534('0x18')]+'&'+_0x29957c+'&'+_0x5626ef,'auth':_0x7984a9,'json':!![]};logger[_0x0534('0x12')]('['+[_0x2b9faf[_0x0534('0x16')]()]+_0x0534('0x1b'),_0x156c70);return rp(_0x156c70)[_0x0534('0xd')](function(_0x4d8d3b){logger['info']('['+[_0x2b9faf[_0x0534('0x16')]()]+_0x0534('0x1c'),_0x4d8d3b);if(_0x4d8d3b[_0x0534('0xe')]['length']>0x0&&String(_0x4d8d3b[_0x0534('0xe')][0x0][_0x0534('0x1d')])===_0x0534('0x1e')){_0x153682['userId']=_0x4d8d3b[_0x0534('0xe')][0x0][_0x0534('0x11')];}else{_0x153682[_0x0534('0x1f')]=_0x153682[_0x0534('0x10')];_0x153682[_0x0534('0x18')]=_0x153682[_0x0534('0x20')];}logger[_0x0534('0x12')]('['+[_0x2b9faf[_0x0534('0x16')]()]+_0x0534('0x21'),_0x153682);_0x446dce(_0x153682);})['catch'](function(_0x412ba2){logger[_0x0534('0x14')]('['+[_0x2b9faf['toUpperCase']()]+']',_0x412ba2[_0x0534('0x15')]);_0x4cb938(_0x412ba2['message']);});}else{logger[_0x0534('0x12')]('['+[_0x2b9faf[_0x0534('0x16')]()]+_0x0534('0x22'));_0x153682[_0x0534('0x1f')]=_0x153682[_0x0534('0x10')];_0x153682[_0x0534('0x18')]=_0x153682[_0x0534('0x20')];_0x446dce(_0x153682);}});};}function createEndUser(_0x5e428,_0x250d94,_0x5b23cc,_0x14167a,_0x183b7a){logger['info']('['+[_0x5e428['toUpperCase']()]+_0x0534('0x23'),_0x5b23cc);return new Promise(function(_0xfe5175,_0x4f5933){var _0xac4671={'method':_0x0534('0x24'),'uri':_0x14167a+_0x0534('0x25')+_0x183b7a,'body':{'user_name':_0x5b23cc['endUserNumber'],'roles':'user','first_name':_0x5b23cc[_0x0534('0x26')],'active':_0x0534('0x1e'),'date_format':_0x0534('0x27'),'phone':_0x5b23cc['endUserNumber']},'auth':_0x250d94,'json':!![]};return rp(_0xac4671)[_0x0534('0xd')](function(_0x127f8a){logger['info']('['+[_0x5e428[_0x0534('0x16')]()]+_0x0534('0x28'),_0x127f8a[_0x0534('0xe')]);_0x5b23cc[_0x0534('0x29')]=_0x127f8a['result']['sys_id'];_0xfe5175(_0x5b23cc);})[_0x0534('0x13')](function(_0x26ea7a){logger[_0x0534('0x14')]('['+[_0x5e428[_0x0534('0x16')]()]+']',_0x26ea7a[_0x0534('0x15')]);_0x4f5933(_0x26ea7a[_0x0534('0x15')]);});});}function getEndUser(_0x1c3257,_0x52366d,_0x1d8c9c,_0x34c70f,_0x5194ff){return function(_0x507652){logger[_0x0534('0x12')]('['+[_0x1c3257[_0x0534('0x16')]()]+_0x0534('0x2a'),_0x507652);return new Promise(function(_0x20a8ac,_0xf2e155){var _0x786bbb={'method':_0x0534('0x19'),'uri':_0x1d8c9c+_0x0534('0x2b')+_0x507652[_0x0534('0x26')]+'&'+_0x34c70f+'&'+_0x5194ff,'auth':_0x52366d,'json':!![]};return rp(_0x786bbb)[_0x0534('0xd')](function(_0x224228){if(_0x224228[_0x0534('0xe')]['length']>0x0){_0x507652['endUserId']=_0x224228['result'][0x0][_0x0534('0x11')];logger['info']('['+[_0x1c3257['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x507652);_0x20a8ac(_0x507652);}else{return createEndUser(_0x1c3257,_0x52366d,_0x507652,_0x1d8c9c,_0x34c70f)[_0x0534('0xd')](function(_0x3eeed8){logger[_0x0534('0x12')]('['+[_0x1c3257[_0x0534('0x16')]()]+_0x0534('0x2c'),_0x3eeed8);_0x20a8ac(_0x3eeed8);});}})[_0x0534('0x13')](function(_0xf29443){logger[_0x0534('0x14')]('['+[_0x1c3257[_0x0534('0x16')]()]+']',_0xf29443[_0x0534('0x15')]);_0xf2e155(_0xf29443[_0x0534('0x15')]);});});};}function getCustomFields(_0x230f7f,_0x7e39ef){var _0x393a0d={};if(_0x230f7f[_0x0534('0xf')]>0x0){_[_0x0534('0x2d')](_0x230f7f,function(_0x1a6d7c){if(_[_0x0534('0x2e')]([_0x0534('0x2f'),_0x0534('0x30')],_0x1a6d7c[_0x0534('0x31')])&&_0x1a6d7c[_0x0534('0x32')]&&!_0x1a6d7c[_0x0534('0x33')]){_0x393a0d[_0x1a6d7c[_0x0534('0x32')]['toLowerCase']()]=_0x1a6d7c['content'][_0x0534('0x34')]();}else if(_[_0x0534('0x2e')]([_0x0534('0x2f'),'picklist'],_0x1a6d7c[_0x0534('0x31')])&&_0x1a6d7c[_0x0534('0x35')]&&_0x1a6d7c['customField']){_0x393a0d[_0x1a6d7c[_0x0534('0x35')]['toLowerCase']()]=_0x1a6d7c['content'][_0x0534('0x34')]();}else if(_0x1a6d7c[_0x0534('0x31')]===_0x0534('0x36')&&_0x1a6d7c[_0x0534('0x37')]&&_0x1a6d7c[_0x0534('0x35')]&&_0x1a6d7c[_0x0534('0x33')]){_0x393a0d[_0x1a6d7c[_0x0534('0x35')][_0x0534('0x38')]()]=_0x7e39ef[_0x1a6d7c['variableName']]['toString']();}else if(_0x1a6d7c[_0x0534('0x31')]===_0x0534('0x39')&&_0x1a6d7c[_0x0534('0x3a')]&&_0x1a6d7c[_0x0534('0x3a')][_0x0534('0x3b')]&&_0x1a6d7c[_0x0534('0x35')]&&_0x1a6d7c[_0x0534('0x33')]){_0x393a0d[_0x1a6d7c[_0x0534('0x35')][_0x0534('0x38')]()]=_0x7e39ef[_0x1a6d7c['Variable'][_0x0534('0x3b')][_0x0534('0x38')]()][_0x0534('0x34')]();}});}return _0x393a0d;}function getTicket(_0x50ed8c,_0xcf709b,_0x251fc1,_0x2c8eb5,_0x57dd73,_0x3db97a){return function(_0x184490){logger[_0x0534('0x12')]('['+[_0x50ed8c[_0x0534('0x16')]()]+_0x0534('0x3c'),_0x184490);return new Promise(function(_0x596efe,_0x19c061){var _0x52020f=_0x50ed8c[_0x0534('0x38')]()===_0x0534('0x3d')?_0x184490[_0x0534('0x1f')]:_0x184490[_0x0534('0x29')];var _0x45f0f1={'method':'POST','uri':_0x251fc1+'incident'+'?'+_0x3db97a,'body':Object[_0x0534('0x3e')]({},{'active':_0x0534('0x1e'),'caller_id':_0x52020f,'assigned_to':_0x184490[_0x0534('0x1f')],'short_description':intUtil[_0x0534('0x3f')](_0x2c8eb5[_0x0534('0x40')],_0x57dd73,'\x20'),'description':intUtil[_0x0534('0x3f')](_0x2c8eb5['Descriptions'],_0x57dd73,'\x0a')},getCustomFields(_0x2c8eb5[_0x0534('0x41')],_0x57dd73)),'auth':_0xcf709b,'json':!![]};return rp(_0x45f0f1)[_0x0534('0xd')](function(_0x56e8a7){logger[_0x0534('0x12')]('['+[_0x50ed8c[_0x0534('0x16')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x56e8a7[_0x0534('0xe')]);_0x184490['ticketId']=_0x56e8a7[_0x0534('0xe')][_0x0534('0x11')];_0x184490[_0x0534('0x42')]=_0x56e8a7['result'][_0x0534('0x43')];logger[_0x0534('0x12')]('['+[_0x50ed8c[_0x0534('0x16')]()]+_0x0534('0x44'),_0x184490);_0x596efe(_0x184490);})[_0x0534('0x13')](function(_0x44034c){logger[_0x0534('0x14')]('['+[_0x50ed8c[_0x0534('0x16')]()]+']',_0x44034c[_0x0534('0x15')]);_0x19c061(_0x44034c[_0x0534('0x15')]);});});};}function createRemoteTag(_0x162ebb,_0x507d06,_0x1721cf,_0xdc4b25){return new Promise(function(_0x400524,_0x371bdf){var _0xf0b510={'method':_0x0534('0x24'),'uri':_0x1721cf+'label'+'?'+_0xdc4b25,'body':{'short_description':_0x162ebb,'global':!![],'active':!![],'name':_0x162ebb},'auth':_0x507d06,'json':!![]};return rp(_0xf0b510)[_0x0534('0xd')](function(_0x5539dc){var _0x5d5ea7=_0x5539dc[_0x0534('0xe')][_0x0534('0x11')];_0x400524(_0x5d5ea7);});});}function getRemoteTag(_0x2577e0,_0x443f29,_0x7084d7,_0x279b99,_0x5ee006){return new Promise(function(_0x3b5750,_0x23c07e){var _0x4ae338={'method':_0x0534('0x19'),'uri':_0x7084d7+'label'+_0x0534('0x45')+_0x2577e0+'&'+_0x279b99,'auth':_0x443f29,'json':!![]};return rp(_0x4ae338)[_0x0534('0xd')](function(_0x1f61bc){if(_0x1f61bc['result'][_0x0534('0xf')]>0x0){var _0x3d1faf=_0x1f61bc[_0x0534('0xe')][0x0][_0x0534('0x11')];_0x3b5750(_0x3d1faf);}else{return createRemoteTag(_0x2577e0,_0x443f29,_0x7084d7,_0x279b99)[_0x0534('0xd')](function(_0x504758){_0x3b5750(_0x504758);});}});});}function assignTagToIncident(_0x48a038,_0x54be3f,_0x4fa318,_0x19bd65,_0x1e64b1){return new Promise(function(_0x43f06f,_0x3b52cb){var _0x356876={'method':'POST','uri':_0x4fa318+_0x0534('0x46')+'?'+_0x1e64b1,'body':{'label':_0x48a038,'table':_0x0534('0x47'),'id_type':_0x0534('0x48'),'table_key':_0x19bd65[_0x0534('0x49')],'title':'Incident\x20-\x20'+_0x19bd65['ticketNumber'],'id_display':_0x19bd65[_0x0534('0x42')]},'auth':_0x54be3f,'json':!![]};return rp(_0x356876)[_0x0534('0xd')](function(_0x5879a3){_0x43f06f();})[_0x0534('0x13')](function(){_0x43f06f();});});}function manageTags(_0x1bb12d,_0x57969e,_0xaf121a,_0x552684,_0x16bd01,_0x256080,_0x5afa2b){return new Promise(function(_0x543b6d,_0x5544ba){var _0xaa56b1=[];_0x57969e[_0x0534('0x2d')](function(_0x39f07f){_0xaa56b1['push'](getRemoteTag(_0x39f07f,_0xaf121a,_0x552684,_0x256080,_0x5afa2b));});return Promise[_0x0534('0x4a')](_0xaa56b1)[_0x0534('0xd')](function(_0x3b269c){if(_0x3b269c[_0x0534('0xf')]){logger[_0x0534('0x12')]('['+[_0x1bb12d[_0x0534('0x16')]()]+_0x0534('0x4b'),_0x3b269c);var _0x4d2e2b=[];_0x3b269c['forEach'](function(_0xb82968){_0x4d2e2b[_0x0534('0x4c')](assignTagToIncident(_0xb82968,_0xaf121a,_0x552684,_0x16bd01,_0x256080));});return Promise['all'](_0x4d2e2b)['then'](function(){_0x543b6d();})['catch'](function(){_0x543b6d();});}else{_0x543b6d();}});});}function getTags(_0x585618,_0x32dea7,_0x2be9df,_0x5307ed,_0x17de91,_0x5e132c){return function(_0x205379){return new Promise(function(_0x5311ad,_0x47973d){var _0x3deb98=[];var _0x3e79d8=_0x5307ed[_0x0534('0x4d')];if(_0x3e79d8&&_0x3e79d8[_0x0534('0xf')]>0x0){_0x3deb98=_[_0x0534('0x4e')](_0x3e79d8,_0x0534('0x3b'));}if(_0x3deb98[_0x0534('0xf')]>0x0){return manageTags(_0x585618,_0x3deb98,_0x32dea7,_0x2be9df,_0x205379,_0x17de91,_0x5e132c)[_0x0534('0xd')](function(){_0x5311ad(_0x205379);});}else{_0x5311ad(_0x205379);}});};}function emit(_0x3ab6f0,_0x1905b3,_0x4e67b0){var _0x333364=_0x0534('0x4f')+_0x0534('0x50')+_0x0534('0x51')+_0x0534('0x52');var _0x307824={'uri':_0x3ab6f0+_0x0534('0x53')+_0x4e67b0+_0x333364};io['to'](util[_0x0534('0x54')](_0x0534('0x55'),_0x1905b3))[_0x0534('0x56')](_0x0534('0x57'),_0x307824);}exports['cs']=function(_0x55c673,_0x37ca94,_0x4de441,_0xfef31f,_0x89e2e9,_0x1f1c9f,_0x3ca82a,_0x20bed7){var _0x19e86b={};var _0x453470={'user':_0x1f1c9f[_0x0534('0x58')],'pass':_0x1f1c9f[_0x0534('0x59')]};var _0x4a78cd=_0x0534('0x5a');var _0x5d9086=_0x0534('0x5b');_0x1f1c9f[_0x0534('0x5c')]=intUtil[_0x0534('0x5d')](_0x1f1c9f['remoteUri']);_0x1f1c9f[_0x0534('0x5e')]=intUtil['stripTrailingSlash'](_0x1f1c9f[_0x0534('0x5e')]);var _0xf67981=util[_0x0534('0x54')](_0x0534('0x5f'),_0x1f1c9f[_0x0534('0x5c')]);_0x19e86b['userEmail']=!_[_0x0534('0x60')](_0xfef31f)?_0xfef31f['email']:null;_0x19e86b[_0x0534('0x20')]=_0x1f1c9f[_0x0534('0x61')];_0x19e86b[_0x0534('0x26')]=_0x20bed7['toLowerCase']()===_0x0534('0x3d')?_0x37ca94['destcalleridnum']:_0x37ca94['calleridnum'];_0x19e86b[_0x0534('0x62')]=_0x20bed7===_0x0534('0x63')||_0x20bed7===_0x0534('0x64')?_0x0534('0x63'):_0x0534('0x3d');var _0x3ef7b5=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f1c9f[_0x0534('0x5e')],_0x37ca94[_0x0534('0x65')],md5(_0x37ca94[_0x0534('0x65')]));if(_0x89e2e9&&_0x89e2e9['monitor_format']){logger[_0x0534('0x12')]('[QUEUE]',_0x0534('0x66'));_0x37ca94[_0x0534('0x67')]=_0x3ef7b5;}else if(_0x3ca82a&&_0x3ca82a[_0x0534('0x68')]&&_0x3ca82a['recordingFormat']!==_0x0534('0x69')){logger['info'](_0x0534('0x6a'),_0x0534('0x66'));_0x37ca94[_0x0534('0x67')]=_0x3ef7b5;}else{_0x37ca94[_0x0534('0x67')]='';}return getAdminUser(_0x20bed7,_0x453470,_0x19e86b,_0xf67981,_0x5d9086,_0x4a78cd)['then'](getUser(_0x20bed7,_0x453470,_0xf67981,_0x5d9086,_0x4a78cd))[_0x0534('0xd')](getEndUser(_0x20bed7,_0x453470,_0xf67981,_0x5d9086,_0x4a78cd))[_0x0534('0xd')](getTicket(_0x20bed7,_0x453470,_0xf67981,_0x4de441,_0x37ca94,_0x5d9086))['then'](function(_0x59e105){logger[_0x0534('0x12')](util[_0x0534('0x54')](_0x0534('0x6b'),_0x59e105[_0x0534('0x49')]));logger['info'](util[_0x0534('0x54')](_0x0534('0x6c'),_0x20bed7));if(_0x20bed7!==_0x0534('0x64')){logger[_0x0534('0x12')]('['+[_0x20bed7[_0x0534('0x16')]()]+']',_0x0534('0x6d'));emit(_0x1f1c9f[_0x0534('0x5c')],_0xfef31f[_0x0534('0x3b')],_0x59e105[_0x0534('0x49')]);}})[_0x0534('0x13')](function(_0x270170){logger[_0x0534('0x14')]('['+[_0x20bed7[_0x0534('0x16')]()]+_0x0534('0x6e'),util[_0x0534('0x6f')](_0x270170,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8a5f=['%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','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','then','length','active','true','userId','sys_id','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','customField','nameField','toLowerCase','content','toString','string','idField','type','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8a5f,0x95));var _0xf8a5=function(_0x2b32c3,_0x154005){_0x2b32c3=_0x2b32c3-0x0;var _0x1de0f3=_0x8a5f[_0x2b32c3];return _0x1de0f3;};'use strict';var _=require(_0xf8a5('0x0'));var Promise=require(_0xf8a5('0x1'));var rp=require('request-promise');var util=require(_0xf8a5('0x2'));var md5=require('md5');var Redis=require(_0xf8a5('0x3'));var intUtil=require(_0xf8a5('0x4'));var config=require(_0xf8a5('0x5'));var logger=require(_0xf8a5('0x6'))(_0xf8a5('0x7'));config[_0xf8a5('0x8')]=_[_0xf8a5('0x9')](config[_0xf8a5('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf8a5('0xa'))(new Redis(config[_0xf8a5('0x8')]));function getAdminUser(_0x4aa061,_0x3b347f,_0x36fa0f,_0x557195,_0x4bf133,_0x1e5b36){return new Promise(function(_0x1b0aa3,_0x3269d5){var _0x163661={'method':_0xf8a5('0xb'),'uri':_0x557195+_0xf8a5('0xc')+'&'+_0x4bf133+'&'+_0x1e5b36,'auth':_0x3b347f,'json':!![]};return rp(_0x163661)['then'](function(_0x1b4f28){if(_0x1b4f28[_0xf8a5('0xd')]['length']>0x0){_0x36fa0f[_0xf8a5('0xe')]=_0x1b4f28[_0xf8a5('0xd')][0x0]['sys_id'];}logger[_0xf8a5('0xf')]('['+[_0x4aa061[_0xf8a5('0x10')]()]+'],\x20getAdminUser\x20crm',_0x36fa0f);_0x1b0aa3(_0x36fa0f);})[_0xf8a5('0x11')](function(_0x18a38d){logger[_0xf8a5('0x12')]('['+[_0x4aa061['toUpperCase']()]+']',_0x18a38d[_0xf8a5('0x13')]);_0x3269d5(_0x18a38d['message']);});});}function getUser(_0x4a5b71,_0x14c369,_0x23fd89,_0x3b6869,_0x522f27){return function(_0x924dbf){logger[_0xf8a5('0xf')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+_0xf8a5('0x14'),_0x924dbf);return new Promise(function(_0x260a6f,_0x2adb8e){if(intUtil['validateEmail'](_0x924dbf[_0xf8a5('0x15')])){var _0x3ba824={'method':_0xf8a5('0xb'),'uri':_0x23fd89+_0xf8a5('0x16')+_0x924dbf[_0xf8a5('0x15')]+'&'+_0x3b6869+'&'+_0x522f27,'auth':_0x14c369,'json':!![]};logger[_0xf8a5('0xf')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x3ba824);return rp(_0x3ba824)[_0xf8a5('0x17')](function(_0x562270){logger[_0xf8a5('0xf')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+'],\x20getUser\x20entity',_0x562270);if(_0x562270[_0xf8a5('0xd')][_0xf8a5('0x18')]>0x0&&String(_0x562270[_0xf8a5('0xd')][0x0][_0xf8a5('0x19')])===_0xf8a5('0x1a')){_0x924dbf[_0xf8a5('0x1b')]=_0x562270[_0xf8a5('0xd')][0x0][_0xf8a5('0x1c')];}else{_0x924dbf[_0xf8a5('0x1b')]=_0x924dbf['adminId'];_0x924dbf[_0xf8a5('0x15')]=_0x924dbf[_0xf8a5('0x1d')];}logger[_0xf8a5('0xf')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+'],\x20getUser\x20crm',_0x924dbf);_0x260a6f(_0x924dbf);})[_0xf8a5('0x11')](function(_0x30abf7){logger[_0xf8a5('0x12')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+']',_0x30abf7[_0xf8a5('0x13')]);_0x2adb8e(_0x30abf7['message']);});}else{logger[_0xf8a5('0xf')]('['+[_0x4a5b71[_0xf8a5('0x10')]()]+_0xf8a5('0x1e'));_0x924dbf[_0xf8a5('0x1b')]=_0x924dbf[_0xf8a5('0xe')];_0x924dbf[_0xf8a5('0x15')]=_0x924dbf[_0xf8a5('0x1d')];_0x260a6f(_0x924dbf);}});};}function createEndUser(_0x308c30,_0x1632fd,_0x263b23,_0x1a4828,_0x2995f4){logger[_0xf8a5('0xf')]('['+[_0x308c30['toUpperCase']()]+_0xf8a5('0x1f'),_0x263b23);return new Promise(function(_0x1b900c,_0x27ea9b){var _0x3e953b={'method':'POST','uri':_0x1a4828+_0xf8a5('0x20')+_0x2995f4,'body':{'user_name':_0x263b23[_0xf8a5('0x21')],'roles':_0xf8a5('0x22'),'first_name':_0x263b23['endUserNumber'],'active':'true','date_format':_0xf8a5('0x23'),'phone':_0x263b23['endUserNumber']},'auth':_0x1632fd,'json':!![]};return rp(_0x3e953b)[_0xf8a5('0x17')](function(_0x5c35c9){logger['info']('['+[_0x308c30[_0xf8a5('0x10')]()]+_0xf8a5('0x24'),_0x5c35c9['result']);_0x263b23[_0xf8a5('0x25')]=_0x5c35c9[_0xf8a5('0xd')]['sys_id'];_0x1b900c(_0x263b23);})['catch'](function(_0x582890){logger[_0xf8a5('0x12')]('['+[_0x308c30[_0xf8a5('0x10')]()]+']',_0x582890[_0xf8a5('0x13')]);_0x27ea9b(_0x582890['message']);});});}function getEndUser(_0x7379fd,_0x18244b,_0x576cfa,_0x5c7a06,_0x3d3dfc){return function(_0x38c766){logger[_0xf8a5('0xf')]('['+[_0x7379fd[_0xf8a5('0x10')]()]+_0xf8a5('0x26'),_0x38c766);return new Promise(function(_0xeb00f0,_0x4b4326){var _0xe348f0={'method':_0xf8a5('0xb'),'uri':_0x576cfa+_0xf8a5('0x27')+_0x38c766[_0xf8a5('0x21')]+'&'+_0x5c7a06+'&'+_0x3d3dfc,'auth':_0x18244b,'json':!![]};return rp(_0xe348f0)[_0xf8a5('0x17')](function(_0x5537d8){if(_0x5537d8[_0xf8a5('0xd')]['length']>0x0){_0x38c766[_0xf8a5('0x25')]=_0x5537d8[_0xf8a5('0xd')][0x0][_0xf8a5('0x1c')];logger[_0xf8a5('0xf')]('['+[_0x7379fd[_0xf8a5('0x10')]()]+_0xf8a5('0x28'),_0x38c766);_0xeb00f0(_0x38c766);}else{return createEndUser(_0x7379fd,_0x18244b,_0x38c766,_0x576cfa,_0x5c7a06)[_0xf8a5('0x17')](function(_0x587477){logger[_0xf8a5('0xf')]('['+[_0x7379fd['toUpperCase']()]+_0xf8a5('0x29'),_0x587477);_0xeb00f0(_0x587477);});}})[_0xf8a5('0x11')](function(_0x34fdac){logger[_0xf8a5('0x12')]('['+[_0x7379fd[_0xf8a5('0x10')]()]+']',_0x34fdac['message']);_0x4b4326(_0x34fdac[_0xf8a5('0x13')]);});});};}function getCustomFields(_0x52d5e8,_0x3773db){var _0x30274a={};if(_0x52d5e8[_0xf8a5('0x18')]>0x0){_[_0xf8a5('0x2a')](_0x52d5e8,function(_0x5e3e35){if(_[_0xf8a5('0x2b')](['string',_0xf8a5('0x2c')],_0x5e3e35['type'])&&_0x5e3e35['nameField']&&!_0x5e3e35[_0xf8a5('0x2d')]){_0x30274a[_0x5e3e35[_0xf8a5('0x2e')][_0xf8a5('0x2f')]()]=_0x5e3e35[_0xf8a5('0x30')][_0xf8a5('0x31')]();}else if(_[_0xf8a5('0x2b')]([_0xf8a5('0x32'),_0xf8a5('0x2c')],_0x5e3e35['type'])&&_0x5e3e35[_0xf8a5('0x33')]&&_0x5e3e35[_0xf8a5('0x2d')]){_0x30274a[_0x5e3e35[_0xf8a5('0x33')]['toLowerCase']()]=_0x5e3e35[_0xf8a5('0x30')][_0xf8a5('0x31')]();}else if(_0x5e3e35[_0xf8a5('0x34')]==='variable'&&_0x5e3e35[_0xf8a5('0x35')]&&_0x5e3e35['idField']&&_0x5e3e35[_0xf8a5('0x2d')]){_0x30274a[_0x5e3e35[_0xf8a5('0x33')][_0xf8a5('0x2f')]()]=_0x3773db[_0x5e3e35[_0xf8a5('0x35')]][_0xf8a5('0x31')]();}else if(_0x5e3e35[_0xf8a5('0x34')]===_0xf8a5('0x36')&&_0x5e3e35[_0xf8a5('0x37')]&&_0x5e3e35['Variable'][_0xf8a5('0x38')]&&_0x5e3e35[_0xf8a5('0x33')]&&_0x5e3e35[_0xf8a5('0x2d')]){_0x30274a[_0x5e3e35['idField']['toLowerCase']()]=_0x3773db[_0x5e3e35[_0xf8a5('0x37')][_0xf8a5('0x38')][_0xf8a5('0x2f')]()][_0xf8a5('0x31')]();}});}return _0x30274a;}function getTicket(_0x618001,_0x98652c,_0x454062,_0x124a16,_0xf6f7eb,_0xc071fd){return function(_0x4e9c89){logger['info']('['+[_0x618001[_0xf8a5('0x10')]()]+_0xf8a5('0x39'),_0x4e9c89);return new Promise(function(_0x1c01e9,_0x110a41){var _0x1b519d=_0x618001['toLowerCase']()===_0xf8a5('0x3a')?_0x4e9c89[_0xf8a5('0x1b')]:_0x4e9c89[_0xf8a5('0x25')];var _0x16d9ed={'method':_0xf8a5('0x3b'),'uri':_0x454062+_0xf8a5('0x3c')+'?'+_0xc071fd,'body':Object[_0xf8a5('0x3d')]({},{'active':_0xf8a5('0x1a'),'caller_id':_0x1b519d,'assigned_to':_0x4e9c89[_0xf8a5('0x1b')],'short_description':intUtil[_0xf8a5('0x3e')](_0x124a16[_0xf8a5('0x3f')],_0xf6f7eb,'\x20'),'description':intUtil[_0xf8a5('0x3e')](_0x124a16[_0xf8a5('0x40')],_0xf6f7eb,'\x0a')},getCustomFields(_0x124a16[_0xf8a5('0x41')],_0xf6f7eb)),'auth':_0x98652c,'json':!![]};return rp(_0x16d9ed)[_0xf8a5('0x17')](function(_0x2e97dd){logger[_0xf8a5('0xf')]('['+[_0x618001['toUpperCase']()]+_0xf8a5('0x42'),_0x2e97dd[_0xf8a5('0xd')]);_0x4e9c89[_0xf8a5('0x43')]=_0x2e97dd[_0xf8a5('0xd')][_0xf8a5('0x1c')];_0x4e9c89[_0xf8a5('0x44')]=_0x2e97dd[_0xf8a5('0xd')][_0xf8a5('0x45')];logger[_0xf8a5('0xf')]('['+[_0x618001[_0xf8a5('0x10')]()]+_0xf8a5('0x46'),_0x4e9c89);_0x1c01e9(_0x4e9c89);})[_0xf8a5('0x11')](function(_0x3ee923){logger[_0xf8a5('0x12')]('['+[_0x618001[_0xf8a5('0x10')]()]+']',_0x3ee923[_0xf8a5('0x13')]);_0x110a41(_0x3ee923[_0xf8a5('0x13')]);});});};}function createRemoteTag(_0x5bb7c8,_0xce9053,_0x5d7064,_0x432a36){return new Promise(function(_0x24df9e,_0x5070b5){var _0x216fd1={'method':_0xf8a5('0x3b'),'uri':_0x5d7064+'label'+'?'+_0x432a36,'body':{'short_description':_0x5bb7c8,'global':!![],'active':!![],'name':_0x5bb7c8},'auth':_0xce9053,'json':!![]};return rp(_0x216fd1)[_0xf8a5('0x17')](function(_0x3d6114){var _0x2815a4=_0x3d6114[_0xf8a5('0xd')][_0xf8a5('0x1c')];_0x24df9e(_0x2815a4);});});}function getRemoteTag(_0x51097d,_0x39f7a2,_0x2f81e2,_0x4f9cbc,_0xde08d0){return new Promise(function(_0x47ca25,_0x2d54e6){var _0x4fe920={'method':'GET','uri':_0x2f81e2+_0xf8a5('0x47')+_0xf8a5('0x48')+_0x51097d+'&'+_0x4f9cbc,'auth':_0x39f7a2,'json':!![]};return rp(_0x4fe920)[_0xf8a5('0x17')](function(_0x47cb7f){if(_0x47cb7f[_0xf8a5('0xd')][_0xf8a5('0x18')]>0x0){var _0x14969b=_0x47cb7f[_0xf8a5('0xd')][0x0]['sys_id'];_0x47ca25(_0x14969b);}else{return createRemoteTag(_0x51097d,_0x39f7a2,_0x2f81e2,_0x4f9cbc)[_0xf8a5('0x17')](function(_0x53a9d8){_0x47ca25(_0x53a9d8);});}});});}function assignTagToIncident(_0x498b20,_0x239413,_0x3a0967,_0x50b1e1,_0x163eb2){return new Promise(function(_0x164233,_0x1a4b5d){var _0x9b79c={'method':'POST','uri':_0x3a0967+_0xf8a5('0x49')+'?'+_0x163eb2,'body':{'label':_0x498b20,'table':_0xf8a5('0x3c'),'id_type':_0xf8a5('0x4a'),'table_key':_0x50b1e1[_0xf8a5('0x43')],'title':_0xf8a5('0x4b')+_0x50b1e1[_0xf8a5('0x44')],'id_display':_0x50b1e1['ticketNumber']},'auth':_0x239413,'json':!![]};return rp(_0x9b79c)[_0xf8a5('0x17')](function(_0x1808bb){_0x164233();})[_0xf8a5('0x11')](function(){_0x164233();});});}function manageTags(_0xff085c,_0x59ded4,_0x404d78,_0x5d42e6,_0x46cd22,_0x4ae81c,_0x429a4d){return new Promise(function(_0x1339eb,_0x4f8282){var _0x404b7c=[];_0x59ded4[_0xf8a5('0x2a')](function(_0x259d7e){_0x404b7c[_0xf8a5('0x4c')](getRemoteTag(_0x259d7e,_0x404d78,_0x5d42e6,_0x4ae81c,_0x429a4d));});return Promise[_0xf8a5('0x4d')](_0x404b7c)[_0xf8a5('0x17')](function(_0x46afab){if(_0x46afab[_0xf8a5('0x18')]){logger[_0xf8a5('0xf')]('['+[_0xff085c[_0xf8a5('0x10')]()]+_0xf8a5('0x4e'),_0x46afab);var _0x5534ac=[];_0x46afab[_0xf8a5('0x2a')](function(_0x46cf44){_0x5534ac[_0xf8a5('0x4c')](assignTagToIncident(_0x46cf44,_0x404d78,_0x5d42e6,_0x46cd22,_0x4ae81c));});return Promise[_0xf8a5('0x4d')](_0x5534ac)[_0xf8a5('0x17')](function(){_0x1339eb();})[_0xf8a5('0x11')](function(){_0x1339eb();});}else{_0x1339eb();}});});}function getTags(_0x1ec3be,_0x29b0d3,_0x3f6a50,_0xe61775,_0x3d75ff,_0x4c743d){return function(_0x26dd79){return new Promise(function(_0x31eee1,_0x2ac2cf){var _0x34b29d=[];var _0x4c1f58=_0xe61775['Tags'];if(_0x4c1f58&&_0x4c1f58[_0xf8a5('0x18')]>0x0){_0x34b29d=_[_0xf8a5('0x4f')](_0x4c1f58,_0xf8a5('0x38'));}if(_0x34b29d['length']>0x0){return manageTags(_0x1ec3be,_0x34b29d,_0x29b0d3,_0x3f6a50,_0x26dd79,_0x3d75ff,_0x4c743d)['then'](function(){_0x31eee1(_0x26dd79);});}else{_0x31eee1(_0x26dd79);}});};}function emit(_0x176f1b,_0x535fb3,_0x8bd582){var _0x2180ef=_0xf8a5('0x50')+_0xf8a5('0x51')+_0xf8a5('0x52')+_0xf8a5('0x53');var _0x5c1a2f={'uri':_0x176f1b+_0xf8a5('0x54')+_0x8bd582+_0x2180ef};io['to'](util[_0xf8a5('0x55')](_0xf8a5('0x56'),_0x535fb3))[_0xf8a5('0x57')](_0xf8a5('0x58'),_0x5c1a2f);}exports['cs']=function(_0x233698,_0xad4ede,_0x301a45,_0xb6f08b,_0x5f5134,_0x277d55,_0x323541,_0x2e86a9){var _0x4e4bcd={};var _0x487109={'user':_0x277d55[_0xf8a5('0x59')],'pass':_0x277d55[_0xf8a5('0x5a')]};var _0x48a807=_0xf8a5('0x5b');var _0x127dca='sysparm_display_value=true';_0x277d55[_0xf8a5('0x5c')]=intUtil['stripTrailingSlash'](_0x277d55[_0xf8a5('0x5c')]);_0x277d55[_0xf8a5('0x5d')]=intUtil[_0xf8a5('0x5e')](_0x277d55['serverUrl']);var _0x499592=util[_0xf8a5('0x55')](_0xf8a5('0x5f'),_0x277d55[_0xf8a5('0x5c')]);_0x4e4bcd['userEmail']=!_[_0xf8a5('0x60')](_0xb6f08b)?_0xb6f08b[_0xf8a5('0x61')]:null;_0x4e4bcd['adminEmail']=_0x277d55[_0xf8a5('0x61')];_0x4e4bcd[_0xf8a5('0x21')]=_0x2e86a9[_0xf8a5('0x2f')]()===_0xf8a5('0x3a')?_0xad4ede[_0xf8a5('0x62')]:_0xad4ede[_0xf8a5('0x63')];_0x4e4bcd[_0xf8a5('0x64')]=_0x2e86a9===_0xf8a5('0x65')||_0x2e86a9===_0xf8a5('0x66')?'queue':_0xf8a5('0x3a');var _0x7e2fc8=util[_0xf8a5('0x55')](_0xf8a5('0x67'),_0x277d55['serverUrl'],_0xad4ede[_0xf8a5('0x68')],md5(_0xad4ede[_0xf8a5('0x68')]));if(_0x5f5134&&_0x5f5134['monitor_format']){logger[_0xf8a5('0xf')](_0xf8a5('0x69'),'Recording\x20is\x20enabled!');_0xad4ede[_0xf8a5('0x6a')]=_0x7e2fc8;}else if(_0x323541&&_0x323541[_0xf8a5('0x6b')]&&_0x323541[_0xf8a5('0x6b')]!==_0xf8a5('0x6c')){logger[_0xf8a5('0xf')](_0xf8a5('0x6d'),_0xf8a5('0x6e'));_0xad4ede[_0xf8a5('0x6a')]=_0x7e2fc8;}else{_0xad4ede[_0xf8a5('0x6a')]='';}return getAdminUser(_0x2e86a9,_0x487109,_0x4e4bcd,_0x499592,_0x127dca,_0x48a807)[_0xf8a5('0x17')](getUser(_0x2e86a9,_0x487109,_0x499592,_0x127dca,_0x48a807))[_0xf8a5('0x17')](getEndUser(_0x2e86a9,_0x487109,_0x499592,_0x127dca,_0x48a807))[_0xf8a5('0x17')](getTicket(_0x2e86a9,_0x487109,_0x499592,_0x301a45,_0xad4ede,_0x127dca))[_0xf8a5('0x17')](function(_0x215240){logger[_0xf8a5('0xf')](util[_0xf8a5('0x55')](_0xf8a5('0x6f'),_0x215240[_0xf8a5('0x43')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x2e86a9));if(_0x2e86a9!==_0xf8a5('0x66')){logger[_0xf8a5('0xf')]('['+[_0x2e86a9['toUpperCase']()]+']',_0xf8a5('0x70'));emit(_0x277d55[_0xf8a5('0x5c')],_0xb6f08b[_0xf8a5('0x38')],_0x215240[_0xf8a5('0x43')]);}})[_0xf8a5('0x11')](function(_0x1f7285){logger[_0xf8a5('0x12')]('['+[_0x2e86a9[_0xf8a5('0x10')]()]+_0xf8a5('0x71'),util[_0xf8a5('0x72')](_0x1f7285,{'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 2c397ed..f267606 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 _0x2905=['contacts','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_type','Contacts','parent_name','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','Agent\x20found!','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','stringify','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','custom_fields','content','customField','customVariable','Variable','toLowerCase','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','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...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','Fields','Outbound','unmanaged','lastevent'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x2905,0x170));var _0x5290=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2905[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5290('0x0'));var rp=require(_0x5290('0x1'));var BPromise=require(_0x5290('0x2'));var md5=require(_0x5290('0x3'));var util=require(_0x5290('0x4'));var Redis=require(_0x5290('0x5'));var intUtil=require(_0x5290('0x6'));var config=require(_0x5290('0x7'));var logger=require('../../../../config/logger')(_0x5290('0x8'));config[_0x5290('0x9')]=_[_0x5290('0xa')](config[_0x5290('0x9')],{'host':_0x5290('0xb'),'port':0x18eb});var io=require(_0x5290('0xc'))(new Redis(config[_0x5290('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x287d09,_0x16724d,_0x285c29){io['to'](_0x287d09)['emit'](_0x16724d,_0x285c29);}function getTicket(_0x56904c,_0x3eed62,_0x207926,_0x57f308,_0x4917fa,_0x586568,_0x23a486,_0x540283){logger[_0x5290('0xd')](_0x5290('0xe'));var _0x287222=new Date();var _0x17e481=[{'name':_0x5290('0xf'),'value':intUtil['getString'](_0x57f308[_0x5290('0x10')],_0x4917fa,'\x20')},{'name':_0x5290('0x11'),'value':_0x3eed62['id']},{'name':_0x5290('0x12'),'value':_0x3eed62['id']},{'name':'description','value':intUtil[_0x5290('0x13')](_0x57f308[_0x5290('0x14')],_0x4917fa,'\x0a')},{'name':_0x5290('0x15'),'value':_0x287222[_0x5290('0x16')]()[_0x5290('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0x5290('0x18'),'value':'0'},{'name':_0x5290('0x19'),'value':'15'},{'name':'parent_id','value':_0x207926['id']},{'name':_0x5290('0x1a'),'value':_0x5290('0x1b')},{'name':_0x5290('0x1c'),'value':_0x207926[_0x5290('0xf')]},{'name':'direction','value':_0x540283}];if(_0x586568['length']){_[_0x5290('0x1d')](_0x586568,function(_0x5afa59){if(_0x4917fa[_0x5afa59[_0x5290('0x1e')]]){_0x17e481[_0x5290('0x1f')]({'name':_0x5afa59[_0x5290('0x20')],'value':_0x4917fa[_0x5afa59[_0x5290('0x1e')]]});}});}return request({'form':{'method':_0x5290('0x21'),'input_type':'JSON','response_type':_0x5290('0x22'),'rest_data':JSON['stringify']({'session':_0x23a486['id'],'module_name':_0x5290('0x23'),'name_value_list':_0x17e481})}});}function getAuth(_0x418f8d){return util[_0x5290('0x24')](_0x5290('0x25'),new Buffer(_0x418f8d[_0x5290('0x26')]+':X')[_0x5290('0x27')](_0x5290('0x28')));}function getServerInfo(_0x120855){return request({'form':{'method':_0x5290('0x29'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON['stringify']({'session':_0x120855['id']})}});}function getUser(_0x3a81c6,_0x243d0c,_0x4e5854){if(!_[_0x5290('0x2a')](_0x243d0c)){logger[_0x5290('0xd')](_0x5290('0x2b'),_0x243d0c);return request({'form':{'method':_0x5290('0x2c'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON['stringify']({'session':_0x4e5854['id'],'module_name':_0x5290('0x2d'),'query':util[_0x5290('0x24')](_0x5290('0x2e'),_0x243d0c),'order_by':'','offset':'0','select_fields':['id',_0x5290('0xf'),_0x5290('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5290('0x30')](function(_0x3aed68){if(_0x3aed68[_0x5290('0x31')][_0x5290('0x32')]){var _0x528db0=_[_0x5290('0x33')](_0x3aed68[_0x5290('0x31')],function(_0x11fc61){return _0x11fc61[_0x5290('0x34')]['user_name']['value']===_0x243d0c;});if(_0x528db0){logger[_0x5290('0xd')](_0x5290('0x35'));return BPromise['resolve']({'id':_0x528db0[_0x5290('0x34')]['id']['value'],'name':_0x528db0['name_value_list'][_0x5290('0xf')][_0x5290('0x36')]});}}logger[_0x5290('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5290('0x37')]({'id':_0x4e5854[_0x5290('0x34')][_0x5290('0x38')][_0x5290('0x36')],'name':_0x4e5854[_0x5290('0x34')][_0x5290('0x2f')][_0x5290('0x36')]});});}else{logger[_0x5290('0xd')](_0x5290('0x39'));return BPromise['resolve']({'id':_0x4e5854[_0x5290('0x34')][_0x5290('0x38')][_0x5290('0x36')],'name':_0x4e5854['name_value_list'][_0x5290('0x2f')][_0x5290('0x36')]});}}function getEndUser(_0x8b9a47,_0x4fd75e,_0x3b98b4,_0x5aeb3d){logger[_0x5290('0xd')]('Searching\x20enduser\x20with\x20phone',_0x3b98b4);return request({'form':{'method':_0x5290('0x2c'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON['stringify']({'session':_0x5aeb3d['id'],'module_name':_0x5290('0x1b'),'query':util[_0x5290('0x24')](_0x5290('0x3a'),_0x3b98b4),'order_by':'','offset':'0','select_fields':['id',_0x5290('0xf'),_0x5290('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5290('0x30')](function(_0x4103a2){if(_0x4103a2[_0x5290('0x31')][_0x5290('0x32')]){var _0x2645ad=_[_0x5290('0x33')](_0x4103a2['entry_list'],function(_0x3a596d){return _0x3a596d[_0x5290('0x34')][_0x5290('0x3b')]['value']===_0x3b98b4;});if(_0x2645ad){logger[_0x5290('0xd')]('Enduser\x20found!');return BPromise[_0x5290('0x37')]({'id':_0x2645ad['name_value_list']['id']['value'],'name':_0x2645ad[_0x5290('0x34')][_0x5290('0xf')][_0x5290('0x36')],'phone':_0x2645ad[_0x5290('0x34')]['phone_home']['value']});}}else{logger[_0x5290('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x5290('0x21'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON[_0x5290('0x3c')]({'session':_0x5aeb3d['id'],'module_name':_0x5290('0x1b'),'name_value_list':[{'name':_0x5290('0x3d'),'value':_0x4fd75e!==_0x5290('0x3e')?_0x4fd75e:util[_0x5290('0x24')](_0x5290('0x3f'),_0x3b98b4)},{'name':_0x5290('0x3b'),'value':_0x3b98b4}]})}})[_0x5290('0x30')](function(_0x50a5e7){logger['info'](_0x5290('0x40'));return BPromise['resolve']({'id':_0x50a5e7['id'],'name':_0x50a5e7[_0x5290('0x31')][_0x5290('0x3d')][_0x5290('0x36')],'phone':_0x50a5e7[_0x5290('0x31')]['phone_home'][_0x5290('0x36')]});});}});}function request(_0x4e43a3){logger[_0x5290('0x41')](_0x5290('0x42'),JSON[_0x5290('0x3c')](_0x4e43a3));return rp(_[_0x5290('0x43')](def,_0x4e43a3));}function getTags(_0x2ff950,_0x4a2ec9){var _0x368e0f=[];if(_0x2ff950&&_0x2ff950[_0x5290('0x32')]>0x0){_0x368e0f=_[_0x5290('0x44')](_0x2ff950,_0x4a2ec9);}return _0x368e0f;}function getCustomFields(_0x42dfff,_0x1028bd){var _0x27f829=[];var _0x29e15e={'custom_fields':[]};if(_0x42dfff[_0x5290('0x32')]>0x0){_[_0x5290('0x1d')](_0x42dfff,function(_0x65d226){if(_0x65d226[_0x5290('0x45')]===_0x5290('0x46')&&_0x65d226[_0x5290('0x47')]&&!_0x65d226['customField']){_0x29e15e[_0x65d226[_0x5290('0x47')]['toLowerCase']()]=_0x65d226['content'][_0x5290('0x27')]();}else if(_0x65d226['type']===_0x5290('0x46')&&_0x65d226[_0x5290('0x20')]&&_0x65d226['customField']){_0x29e15e[_0x5290('0x48')][_0x5290('0x1f')]({'id':_0x65d226['idField'],'value':_0x65d226[_0x5290('0x49')]['toString']()});}else if(_0x65d226[_0x5290('0x45')]==='variable'&&_0x65d226[_0x5290('0x1e')]&&_0x65d226[_0x5290('0x20')]&&_0x65d226[_0x5290('0x4a')]){_0x1028bd[_0x65d226[_0x5290('0x1e')]]&&_0x29e15e[_0x5290('0x48')]['push']({'id':_0x65d226['idField'],'value':_0x1028bd[_0x65d226[_0x5290('0x1e')]][_0x5290('0x27')]()});}else if(_0x65d226['type']===_0x5290('0x4b')&&_0x65d226['Variable']&&_0x65d226[_0x5290('0x4c')][_0x5290('0xf')]&&_0x65d226[_0x5290('0x20')]&&_0x65d226[_0x5290('0x4a')]){_0x1028bd[_0x65d226['Variable'][_0x5290('0xf')][_0x5290('0x4d')]()]&&_0x29e15e[_0x5290('0x48')][_0x5290('0x1f')]({'id':_0x65d226[_0x5290('0x20')],'value':_0x1028bd[_0x65d226[_0x5290('0x4c')][_0x5290('0xf')][_0x5290('0x4d')]()][_0x5290('0x27')]()});}});}return _0x29e15e;}function getConnection(_0x2e2924){return request({'method':_0x5290('0x4e'),'form':{'method':_0x5290('0x4f'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2e2924['username'],'password':_0x2e2924[_0x5290('0x50')],'encryption':_0x5290('0x51')},'application':_0x5290('0x52')})}})[_0x5290('0x30')](function(_0x360bb3){var _0x433186=_0x360bb3;if(_0x433186['id']){def[_0x5290('0x53')]=_0x433186['id'];return BPromise[_0x5290('0x37')](_0x433186);}else{throw new Error(util[_0x5290('0x24')](_0x5290('0x54'),_0x2e2924['id']));}});}function setRelationship(_0x334cb2,_0x4821e1,_0x262790,_0xdc16cc){return request({'form':{'method':_0x5290('0x55'),'input_type':_0x5290('0x22'),'response_type':_0x5290('0x22'),'rest_data':JSON[_0x5290('0x3c')]({'session':_0x334cb2['id'],'module_name':_0x5290('0x23'),'module_id':_0x262790['id'],'link_field_name':_0xdc16cc,'related_ids':[_0x4821e1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5290('0x56')]=function(_0x594901,_0x34c3b7,_0x2d213c,_0x163770,_0x4a3080,_0x1f82db){var _0x107d8b,_0x2c0785,_0x51173,_0x1d32c5;_0x1f82db[_0x5290('0x57')]=intUtil['stripTrailingSlash'](_0x1f82db[_0x5290('0x57')]);_0x1f82db['serverUrl']=intUtil[_0x5290('0x58')](_0x1f82db['serverUrl']);def[_0x5290('0x59')]=util[_0x5290('0x24')](_0x5290('0x5a'),_0x1f82db['remoteUri']);if(_0x4a3080&&_0x4a3080[_0x5290('0x5b')]){logger[_0x5290('0xd')](_0x5290('0x5c'),'Recording\x20is\x20enabled!');_0x34c3b7[_0x5290('0x5d')]=util[_0x5290('0x24')](_0x5290('0x5e'),_0x1f82db[_0x5290('0x5f')],_0x34c3b7['uniqueid'],md5(_0x34c3b7['uniqueid']));}else{_0x34c3b7[_0x5290('0x5d')]='';}return getConnection(_0x1f82db)[_0x5290('0x30')](function(_0x1a5e74){_0x1d32c5=_0x1a5e74;return getUser(_0x1f82db,_0x163770[_0x5290('0xf')],_0x1d32c5);})[_0x5290('0x30')](function(_0x12af6d){_0x107d8b=_0x12af6d;logger['info'](_0x5290('0x60'),_0x107d8b['id']);return getEndUser(_0x1f82db,_0x34c3b7[_0x5290('0x61')],_0x34c3b7[_0x5290('0x62')],_0x1d32c5);})[_0x5290('0x30')](function(_0xb0b555){_0x2c0785=_0xb0b555;logger['info'](_0x5290('0x63'),_0x2c0785['id']);return getTicket(_0x1f82db,_0x107d8b,_0x2c0785,_0x2d213c,_0x34c3b7,_0x2d213c['Fields'],_0x1d32c5,_0x5290('0x64'));})[_0x5290('0x30')](function(_0x427979){_0x51173=_0x427979;logger[_0x5290('0xd')](_0x5290('0x65'));logger[_0x5290('0xd')](_0x5290('0x66'),_0x51173['id']);return setRelationship(_0x1d32c5,_0x107d8b,_0x51173,_0x5290('0x67'));})[_0x5290('0x30')](function(){return setRelationship(_0x1d32c5,_0x2c0785,_0x51173,'contacts');})[_0x5290('0x30')](function(){return getServerInfo(_0x1d32c5);})[_0x5290('0x30')](function(_0x3c2a63){var _0x15600c=parseInt(_0x3c2a63['version']['charAt'](0x0));var _0x202a7d=util[_0x5290('0x24')](_0x5290('0x68'),_0x1f82db['remoteUri'],_0x51173['id']);if(_0x15600c>0x6){_0x202a7d=util[_0x5290('0x24')](_0x5290('0x69'),_0x1f82db['remoteUri'],_0x51173['id']);}logger[_0x5290('0xd')](_0x5290('0x5c'),_0x5290('0x6a'));emit(util[_0x5290('0x24')](_0x5290('0x6b'),_0x163770[_0x5290('0xf')]),_0x5290('0x6c'),{'uri':_0x202a7d});})[_0x5290('0x6d')](function(_0x59c56d){logger[_0x5290('0x6e')](_0x5290('0x5c'),JSON[_0x5290('0x3c')](_0x59c56d));});};exports[_0x5290('0x6f')]=function(_0x35413f,_0x54d5d0,_0x10b2ac,_0x171bca,_0x3c30f8,_0xa0fe6e,_0x17e4be){var _0xd2591c,_0x1bbf82,_0x479cb7,_0xded9da;_0xa0fe6e[_0x5290('0x57')]=intUtil[_0x5290('0x58')](_0xa0fe6e['remoteUri']);_0xa0fe6e[_0x5290('0x5f')]=intUtil[_0x5290('0x58')](_0xa0fe6e[_0x5290('0x5f')]);def[_0x5290('0x59')]=util[_0x5290('0x24')]('%s/service/v4_1/rest.php',_0xa0fe6e[_0x5290('0x57')]);if(_0x17e4be&&_0x17e4be['recordingFormat']&&_0x17e4be[_0x5290('0x70')]!==_0x5290('0x71')){logger['info']('[OUTBOUND]',_0x5290('0x72'));_0x54d5d0[_0x5290('0x5d')]=util[_0x5290('0x24')](_0x5290('0x5e'),_0xa0fe6e[_0x5290('0x5f')],_0x54d5d0[_0x5290('0x73')],md5(_0x54d5d0[_0x5290('0x73')]));}return getConnection(_0xa0fe6e)[_0x5290('0x30')](function(_0x72b15b){_0xded9da=_0x72b15b;return getUser(_0xa0fe6e,_0x171bca[_0x5290('0xf')],_0xded9da);})[_0x5290('0x30')](function(_0x480e21){_0xd2591c=_0x480e21;logger['info'](_0x5290('0x60'),_0xd2591c['id']);return getEndUser(_0xa0fe6e,_0x54d5d0['destcalleridname'],_0x54d5d0['destcalleridnum'],_0xded9da);})[_0x5290('0x30')](function(_0x2aba8a){_0x1bbf82=_0x2aba8a;logger[_0x5290('0xd')](_0x5290('0x63'),_0x1bbf82['id']);return getTicket(_0xa0fe6e,_0xd2591c,_0x1bbf82,_0x10b2ac,_0x54d5d0,_0x10b2ac[_0x5290('0x74')],_0xded9da,_0x5290('0x75'));})[_0x5290('0x30')](function(_0x54f8b7){_0x479cb7=_0x54f8b7;logger[_0x5290('0xd')](_0x5290('0x65'));logger[_0x5290('0xd')](_0x5290('0x66'),_0x479cb7['id']);return setRelationship(_0xded9da,_0xd2591c,_0x479cb7,_0x5290('0x67'));})['then'](function(){return setRelationship(_0xded9da,_0x1bbf82,_0x479cb7,'contacts');})['then'](function(){return getServerInfo(_0xded9da);})[_0x5290('0x30')](function(_0x10efd4){var _0x2afb5e=parseInt(_0x10efd4['version']['charAt'](0x0));var _0x5c8703=util[_0x5290('0x24')](_0x5290('0x68'),_0xa0fe6e[_0x5290('0x57')],_0x479cb7['id']);if(_0x2afb5e>0x6){_0x5c8703=util[_0x5290('0x24')](_0x5290('0x69'),_0xa0fe6e[_0x5290('0x57')],_0x479cb7['id']);}logger[_0x5290('0xd')]('[OUTBOUND]',_0x5290('0x6a'));emit(util[_0x5290('0x24')]('user:%s',_0x171bca[_0x5290('0xf')]),'trigger:browser:url',{'uri':_0x5c8703});})[_0x5290('0x6d')](function(_0x64eaf1){logger[_0x5290('0x6e')]('[OUTBOUND]',JSON[_0x5290('0x3c')](_0x64eaf1));});};exports[_0x5290('0x76')]=function(_0x509aa0,_0x1425d9,_0x528c83,_0x2e617b,_0x170286,_0xb3a72e){var _0x288d90,_0x4bb843,_0x34decd,_0x266301;_0xb3a72e[_0x5290('0x57')]=intUtil[_0x5290('0x58')](_0xb3a72e['remoteUri']);_0xb3a72e['serverUrl']=intUtil[_0x5290('0x58')](_0xb3a72e[_0x5290('0x5f')]);def[_0x5290('0x59')]=util[_0x5290('0x24')]('%s/service/v4_1/rest.php',_0xb3a72e[_0x5290('0x57')]);if(_0x170286&&_0x170286[_0x5290('0x5b')]){logger[_0x5290('0xd')]('['+_0x1425d9[_0x5290('0x77')]['toUpperCase']()+']',_0x5290('0x72'));_0x1425d9[_0x5290('0x5d')]=util[_0x5290('0x24')](_0x5290('0x5e'),_0xb3a72e[_0x5290('0x5f')],_0x1425d9[_0x5290('0x73')],md5(_0x1425d9[_0x5290('0x73')]));}else{_0x1425d9['recordingURL']='';}return getConnection(_0xb3a72e)[_0x5290('0x30')](function(_0x20d013){_0x266301=_0x20d013;if(!_[_0x5290('0x2a')](_0x2e617b)){return getUser(_0xb3a72e,_0x2e617b[_0x5290('0xf')],_0x266301);}else{return getUser(_0xb3a72e,null,_0x266301);}})['then'](function(_0x222221){_0x288d90=_0x222221;logger['info'](_0x5290('0x60'),_0x288d90['id']);return getEndUser(_0xb3a72e,_0x1425d9['calleridname'],_0x1425d9[_0x5290('0x62')],_0x266301);})[_0x5290('0x30')](function(_0x18466d){_0x4bb843=_0x18466d;logger[_0x5290('0xd')](_0x5290('0x63'),_0x4bb843['id']);return getTicket(_0xb3a72e,_0x288d90,_0x4bb843,_0x528c83,_0x1425d9,_0x528c83[_0x5290('0x74')],_0x266301,_0x5290('0x64'));})[_0x5290('0x30')](function(_0x2ff613){_0x34decd=_0x2ff613;logger[_0x5290('0xd')](_0x5290('0x65'));logger[_0x5290('0xd')](_0x5290('0x66'),_0x34decd['id']);return setRelationship(_0x266301,_0x288d90,_0x34decd,_0x5290('0x67'));})[_0x5290('0x30')](function(){return setRelationship(_0x266301,_0x4bb843,_0x34decd,_0x5290('0x78'));})['then'](function(){return getServerInfo(_0x266301);})[_0x5290('0x6d')](function(_0x1ced06){logger[_0x5290('0x6e')]('['+_0x1425d9[_0x5290('0x77')][_0x5290('0x79')]()+']',JSON[_0x5290('0x3c')](_0x1ced06));});}; \ No newline at end of file +var _0x380c=['parent_id','parent_type','Contacts','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','then','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variable','Variable','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','remoteUri','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','lastevent','catch','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','toISOString','duration_hours','duration_minutes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x380c,0x1bd));var _0xc380=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x380c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc380('0x0'));var rp=require('request-promise');var BPromise=require(_0xc380('0x1'));var md5=require(_0xc380('0x2'));var util=require(_0xc380('0x3'));var Redis=require(_0xc380('0x4'));var intUtil=require('./util');var config=require(_0xc380('0x5'));var logger=require(_0xc380('0x6'))(_0xc380('0x7'));config['redis']=_[_0xc380('0x8')](config['redis'],{'host':_0xc380('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc380('0xa')]));var def={'method':_0xc380('0xb'),'json':!![]};function emit(_0x4d0c45,_0x576433,_0x3d5a87){io['to'](_0x4d0c45)[_0xc380('0xc')](_0x576433,_0x3d5a87);}function getTicket(_0x449fc5,_0xd16e22,_0x5a87e9,_0x3560f9,_0x8d5e09,_0x32ccca,_0x2ec533,_0x1be49f){logger[_0xc380('0xd')](_0xc380('0xe'));var _0x3d4d87=new Date();var _0x2d8643=[{'name':_0xc380('0xf'),'value':intUtil[_0xc380('0x10')](_0x3560f9['Subjects'],_0x8d5e09,'\x20')},{'name':_0xc380('0x11'),'value':_0xd16e22['id']},{'name':'created_by','value':_0xd16e22['id']},{'name':_0xc380('0x12'),'value':intUtil['getString'](_0x3560f9[_0xc380('0x13')],_0x8d5e09,'\x0a')},{'name':'date_start','value':_0x3d4d87[_0xc380('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xc380('0x15'),'value':'0'},{'name':_0xc380('0x16'),'value':'15'},{'name':_0xc380('0x17'),'value':_0x5a87e9['id']},{'name':_0xc380('0x18'),'value':_0xc380('0x19')},{'name':_0xc380('0x1a'),'value':_0x5a87e9[_0xc380('0xf')]},{'name':_0xc380('0x1b'),'value':_0x1be49f}];if(_0x32ccca['length']){_['forEach'](_0x32ccca,function(_0x57bd9b){if(_0x8d5e09[_0x57bd9b[_0xc380('0x1c')]]){_0x2d8643[_0xc380('0x1d')]({'name':_0x57bd9b[_0xc380('0x1e')],'value':_0x8d5e09[_0x57bd9b['variableName']]});}});}return request({'form':{'method':_0xc380('0x1f'),'input_type':_0xc380('0x20'),'response_type':'JSON','rest_data':JSON[_0xc380('0x21')]({'session':_0x2ec533['id'],'module_name':_0xc380('0x22'),'name_value_list':_0x2d8643})}});}function getAuth(_0x310732){return util[_0xc380('0x23')](_0xc380('0x24'),new Buffer(_0x310732[_0xc380('0x25')]+':X')[_0xc380('0x26')]('base64'));}function getServerInfo(_0x1e126f){return request({'form':{'method':_0xc380('0x27'),'input_type':_0xc380('0x20'),'response_type':_0xc380('0x20'),'rest_data':JSON[_0xc380('0x21')]({'session':_0x1e126f['id']})}});}function getUser(_0x5d1755,_0x4bb491,_0x367ca2){if(!_[_0xc380('0x28')](_0x4bb491)){logger[_0xc380('0xd')](_0xc380('0x29'),_0x4bb491);return request({'form':{'method':_0xc380('0x2a'),'input_type':_0xc380('0x20'),'response_type':_0xc380('0x20'),'rest_data':JSON[_0xc380('0x21')]({'session':_0x367ca2['id'],'module_name':_0xc380('0x2b'),'query':util[_0xc380('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x4bb491),'order_by':'','offset':'0','select_fields':['id','name',_0xc380('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x36dfee){if(_0x36dfee[_0xc380('0x2d')]['length']){var _0xc78d72=_[_0xc380('0x2e')](_0x36dfee[_0xc380('0x2d')],function(_0x3eea77){return _0x3eea77['name_value_list'][_0xc380('0x2c')][_0xc380('0x2f')]===_0x4bb491;});if(_0xc78d72){logger[_0xc380('0xd')](_0xc380('0x30'));return BPromise[_0xc380('0x31')]({'id':_0xc78d72[_0xc380('0x32')]['id']['value'],'name':_0xc78d72[_0xc380('0x32')][_0xc380('0xf')]['value']});}}logger[_0xc380('0xd')](_0xc380('0x33'));return BPromise[_0xc380('0x31')]({'id':_0x367ca2['name_value_list'][_0xc380('0x34')][_0xc380('0x2f')],'name':_0x367ca2[_0xc380('0x32')][_0xc380('0x2c')][_0xc380('0x2f')]});});}else{logger[_0xc380('0xd')](_0xc380('0x35'));return BPromise[_0xc380('0x31')]({'id':_0x367ca2[_0xc380('0x32')][_0xc380('0x34')]['value'],'name':_0x367ca2[_0xc380('0x32')][_0xc380('0x2c')][_0xc380('0x2f')]});}}function getEndUser(_0x44fa27,_0x5f1549,_0x286660,_0x228f0a){logger[_0xc380('0xd')](_0xc380('0x36'),_0x286660);return request({'form':{'method':_0xc380('0x2a'),'input_type':'JSON','response_type':_0xc380('0x20'),'rest_data':JSON[_0xc380('0x21')]({'session':_0x228f0a['id'],'module_name':_0xc380('0x19'),'query':util[_0xc380('0x23')](_0xc380('0x37'),_0x286660),'order_by':'','offset':'0','select_fields':['id',_0xc380('0xf'),_0xc380('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x52c6bd){if(_0x52c6bd[_0xc380('0x2d')][_0xc380('0x39')]){var _0x35d12a=_['find'](_0x52c6bd[_0xc380('0x2d')],function(_0x3055e4){return _0x3055e4[_0xc380('0x32')][_0xc380('0x38')][_0xc380('0x2f')]===_0x286660;});if(_0x35d12a){logger[_0xc380('0xd')](_0xc380('0x3a'));return BPromise[_0xc380('0x31')]({'id':_0x35d12a['name_value_list']['id'][_0xc380('0x2f')],'name':_0x35d12a[_0xc380('0x32')]['name']['value'],'phone':_0x35d12a[_0xc380('0x32')][_0xc380('0x38')]['value']});}}else{logger[_0xc380('0xd')](_0xc380('0x3b'));return request({'form':{'method':_0xc380('0x1f'),'input_type':_0xc380('0x20'),'response_type':_0xc380('0x20'),'rest_data':JSON[_0xc380('0x21')]({'session':_0x228f0a['id'],'module_name':_0xc380('0x19'),'name_value_list':[{'name':_0xc380('0x3c'),'value':_0x5f1549!==''?_0x5f1549:util[_0xc380('0x23')]('Caller\x20-\x20%s',_0x286660)},{'name':_0xc380('0x38'),'value':_0x286660}]})}})[_0xc380('0x3d')](function(_0x5a2559){logger['info']('Enduser\x20created.');return BPromise[_0xc380('0x31')]({'id':_0x5a2559['id'],'name':_0x5a2559[_0xc380('0x2d')][_0xc380('0x3c')]['value'],'phone':_0x5a2559[_0xc380('0x2d')][_0xc380('0x38')][_0xc380('0x2f')]});});}});}function request(_0x3ecb53){logger[_0xc380('0x3e')](_0xc380('0x3f'),JSON['stringify'](_0x3ecb53));return rp(_[_0xc380('0x40')](def,_0x3ecb53));}function getTags(_0x4b9bc8,_0x1affe4){var _0x4632a0=[];if(_0x4b9bc8&&_0x4b9bc8[_0xc380('0x39')]>0x0){_0x4632a0=_[_0xc380('0x41')](_0x4b9bc8,_0x1affe4);}return _0x4632a0;}function getCustomFields(_0x1efb11,_0x566ebf){var _0x9cbe3=[];var _0x39d145={'custom_fields':[]};if(_0x1efb11[_0xc380('0x39')]>0x0){_['forEach'](_0x1efb11,function(_0x5888f7){if(_0x5888f7[_0xc380('0x42')]==='string'&&_0x5888f7[_0xc380('0x43')]&&!_0x5888f7[_0xc380('0x44')]){_0x39d145[_0x5888f7[_0xc380('0x43')][_0xc380('0x45')]()]=_0x5888f7['content'][_0xc380('0x26')]();}else if(_0x5888f7[_0xc380('0x42')]===_0xc380('0x46')&&_0x5888f7[_0xc380('0x1e')]&&_0x5888f7['customField']){_0x39d145[_0xc380('0x47')]['push']({'id':_0x5888f7[_0xc380('0x1e')],'value':_0x5888f7[_0xc380('0x48')][_0xc380('0x26')]()});}else if(_0x5888f7['type']===_0xc380('0x49')&&_0x5888f7['variableName']&&_0x5888f7[_0xc380('0x1e')]&&_0x5888f7[_0xc380('0x44')]){_0x566ebf[_0x5888f7[_0xc380('0x1c')]]&&_0x39d145['custom_fields'][_0xc380('0x1d')]({'id':_0x5888f7[_0xc380('0x1e')],'value':_0x566ebf[_0x5888f7['variableName']][_0xc380('0x26')]()});}else if(_0x5888f7[_0xc380('0x42')]==='customVariable'&&_0x5888f7[_0xc380('0x4a')]&&_0x5888f7[_0xc380('0x4a')][_0xc380('0xf')]&&_0x5888f7[_0xc380('0x1e')]&&_0x5888f7[_0xc380('0x44')]){_0x566ebf[_0x5888f7[_0xc380('0x4a')][_0xc380('0xf')][_0xc380('0x45')]()]&&_0x39d145['custom_fields'][_0xc380('0x1d')]({'id':_0x5888f7[_0xc380('0x1e')],'value':_0x566ebf[_0x5888f7[_0xc380('0x4a')][_0xc380('0xf')][_0xc380('0x45')]()]['toString']()});}});}return _0x39d145;}function getConnection(_0x165163){return request({'method':'POST','form':{'method':'login','input_type':_0xc380('0x20'),'response_type':_0xc380('0x20'),'rest_data':JSON[_0xc380('0x21')]({'user_auth':{'user_name':_0x165163[_0xc380('0x4b')],'password':_0x165163[_0xc380('0x4c')],'encryption':'PLAIN'},'application':_0xc380('0x4d')})}})[_0xc380('0x3d')](function(_0x38b515){var _0x5eb9df=_0x38b515;if(_0x5eb9df['id']){def['sessionID']=_0x5eb9df['id'];return BPromise[_0xc380('0x31')](_0x5eb9df);}else{throw new Error(util['format'](_0xc380('0x4e'),_0x165163['id']));}});}function setRelationship(_0x3d90ed,_0xfaf4b0,_0x2c6cd2,_0x29f2ae){return request({'form':{'method':'set_relationship','input_type':_0xc380('0x20'),'response_type':'JSON','rest_data':JSON[_0xc380('0x21')]({'session':_0x3d90ed['id'],'module_name':_0xc380('0x22'),'module_id':_0x2c6cd2['id'],'link_field_name':_0x29f2ae,'related_ids':[_0xfaf4b0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3ad0d4,_0x1fccf4,_0x5ac2b0,_0x52c96e,_0x2d8bae,_0x3da593){var _0x4d0bbe,_0x437124,_0x459d8a,_0x444fa6;_0x3da593['remoteUri']=intUtil['stripTrailingSlash'](_0x3da593['remoteUri']);_0x3da593[_0xc380('0x4f')]=intUtil[_0xc380('0x50')](_0x3da593[_0xc380('0x4f')]);def[_0xc380('0x51')]=util[_0xc380('0x23')](_0xc380('0x52'),_0x3da593['remoteUri']);if(_0x2d8bae&&_0x2d8bae[_0xc380('0x53')]){logger[_0xc380('0xd')](_0xc380('0x54'),_0xc380('0x55'));_0x1fccf4[_0xc380('0x56')]=util[_0xc380('0x23')](_0xc380('0x57'),_0x3da593[_0xc380('0x4f')],_0x1fccf4[_0xc380('0x58')],md5(_0x1fccf4['uniqueid']));}else{_0x1fccf4[_0xc380('0x56')]='';}return getConnection(_0x3da593)[_0xc380('0x3d')](function(_0xf020c2){_0x444fa6=_0xf020c2;return getUser(_0x3da593,_0x52c96e[_0xc380('0xf')],_0x444fa6);})[_0xc380('0x3d')](function(_0x5cfae7){_0x4d0bbe=_0x5cfae7;logger[_0xc380('0xd')](_0xc380('0x59'),_0x4d0bbe['id']);return getEndUser(_0x3da593,_0x1fccf4[_0xc380('0x5a')],_0x1fccf4[_0xc380('0x5b')],_0x444fa6);})[_0xc380('0x3d')](function(_0x1fa0ea){_0x437124=_0x1fa0ea;logger[_0xc380('0xd')](_0xc380('0x5c'),_0x437124['id']);return getTicket(_0x3da593,_0x4d0bbe,_0x437124,_0x5ac2b0,_0x1fccf4,_0x5ac2b0[_0xc380('0x5d')],_0x444fa6,_0xc380('0x5e'));})[_0xc380('0x3d')](function(_0x5dd604){_0x459d8a=_0x5dd604;logger[_0xc380('0xd')]('Ticket\x20created!');logger[_0xc380('0xd')](_0xc380('0x5f'),_0x459d8a['id']);return setRelationship(_0x444fa6,_0x4d0bbe,_0x459d8a,_0xc380('0x60'));})[_0xc380('0x3d')](function(){return setRelationship(_0x444fa6,_0x437124,_0x459d8a,_0xc380('0x61'));})[_0xc380('0x3d')](function(){return getServerInfo(_0x444fa6);})[_0xc380('0x3d')](function(_0xd99092){var _0x27d026=parseInt(_0xd99092[_0xc380('0x62')][_0xc380('0x63')](0x0));var _0x5bfe6a=util[_0xc380('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3da593[_0xc380('0x64')],_0x459d8a['id']);if(_0x27d026>0x6){_0x5bfe6a=util[_0xc380('0x23')](_0xc380('0x65'),_0x3da593[_0xc380('0x64')],_0x459d8a['id']);}logger[_0xc380('0xd')]('[QUEUE]',_0xc380('0x66'));emit(util[_0xc380('0x23')](_0xc380('0x67'),_0x52c96e['name']),_0xc380('0x68'),{'uri':_0x5bfe6a});})['catch'](function(_0x278a6a){logger[_0xc380('0x69')](_0xc380('0x54'),JSON[_0xc380('0x21')](_0x278a6a));});};exports[_0xc380('0x6a')]=function(_0x5aa04b,_0xb92e9a,_0x15ee11,_0x22bd73,_0x50113a,_0x427c7f,_0x26edf4){var _0x53a9e8,_0x513e76,_0x3e5353,_0x179de5;_0x427c7f['remoteUri']=intUtil['stripTrailingSlash'](_0x427c7f['remoteUri']);_0x427c7f[_0xc380('0x4f')]=intUtil[_0xc380('0x50')](_0x427c7f[_0xc380('0x4f')]);def[_0xc380('0x51')]=util[_0xc380('0x23')](_0xc380('0x52'),_0x427c7f['remoteUri']);if(_0x26edf4&&_0x26edf4['recordingFormat']&&_0x26edf4[_0xc380('0x6b')]!==_0xc380('0x6c')){logger[_0xc380('0xd')](_0xc380('0x6d'),_0xc380('0x55'));_0xb92e9a[_0xc380('0x56')]=util['format'](_0xc380('0x57'),_0x427c7f[_0xc380('0x4f')],_0xb92e9a[_0xc380('0x58')],md5(_0xb92e9a[_0xc380('0x58')]));}return getConnection(_0x427c7f)[_0xc380('0x3d')](function(_0x17a87b){_0x179de5=_0x17a87b;return getUser(_0x427c7f,_0x22bd73[_0xc380('0xf')],_0x179de5);})[_0xc380('0x3d')](function(_0xdef1e1){_0x53a9e8=_0xdef1e1;logger[_0xc380('0xd')]('The\x20User\x20ID\x20is:',_0x53a9e8['id']);return getEndUser(_0x427c7f,_0xb92e9a[_0xc380('0x6e')],_0xb92e9a[_0xc380('0x6f')],_0x179de5);})[_0xc380('0x3d')](function(_0x5050a3){_0x513e76=_0x5050a3;logger['info']('The\x20Enduser\x20ID\x20is:',_0x513e76['id']);return getTicket(_0x427c7f,_0x53a9e8,_0x513e76,_0x15ee11,_0xb92e9a,_0x15ee11[_0xc380('0x5d')],_0x179de5,_0xc380('0x70'));})['then'](function(_0x77840a){_0x3e5353=_0x77840a;logger['info'](_0xc380('0x71'));logger[_0xc380('0xd')](_0xc380('0x5f'),_0x3e5353['id']);return setRelationship(_0x179de5,_0x53a9e8,_0x3e5353,'users');})[_0xc380('0x3d')](function(){return setRelationship(_0x179de5,_0x513e76,_0x3e5353,_0xc380('0x61'));})[_0xc380('0x3d')](function(){return getServerInfo(_0x179de5);})[_0xc380('0x3d')](function(_0x57b571){var _0x22231a=parseInt(_0x57b571['version'][_0xc380('0x63')](0x0));var _0x570c22=util[_0xc380('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x427c7f[_0xc380('0x64')],_0x3e5353['id']);if(_0x22231a>0x6){_0x570c22=util[_0xc380('0x23')](_0xc380('0x65'),_0x427c7f['remoteUri'],_0x3e5353['id']);}logger[_0xc380('0xd')](_0xc380('0x6d'),_0xc380('0x66'));emit(util[_0xc380('0x23')]('user:%s',_0x22bd73['name']),_0xc380('0x68'),{'uri':_0x570c22});})['catch'](function(_0x242c00){logger['error']('[OUTBOUND]',JSON['stringify'](_0x242c00));});};exports['unmanaged']=function(_0x5ea6f9,_0x275547,_0x21a785,_0x5969fa,_0x3cda98,_0x3a9d09){var _0x4a32a8,_0x1236ca,_0x52a2e9,_0x43ab2f;_0x3a9d09[_0xc380('0x64')]=intUtil[_0xc380('0x50')](_0x3a9d09['remoteUri']);_0x3a9d09[_0xc380('0x4f')]=intUtil[_0xc380('0x50')](_0x3a9d09[_0xc380('0x4f')]);def[_0xc380('0x51')]=util[_0xc380('0x23')]('%s/service/v4_1/rest.php',_0x3a9d09['remoteUri']);if(_0x3cda98&&_0x3cda98[_0xc380('0x53')]){logger[_0xc380('0xd')]('['+_0x275547[_0xc380('0x72')]['toUpperCase']()+']',_0xc380('0x55'));_0x275547[_0xc380('0x56')]=util[_0xc380('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a9d09[_0xc380('0x4f')],_0x275547['uniqueid'],md5(_0x275547[_0xc380('0x58')]));}else{_0x275547[_0xc380('0x56')]='';}return getConnection(_0x3a9d09)[_0xc380('0x3d')](function(_0x37e6d1){_0x43ab2f=_0x37e6d1;if(!_[_0xc380('0x28')](_0x5969fa)){return getUser(_0x3a9d09,_0x5969fa[_0xc380('0xf')],_0x43ab2f);}else{return getUser(_0x3a9d09,null,_0x43ab2f);}})[_0xc380('0x3d')](function(_0x557fd8){_0x4a32a8=_0x557fd8;logger[_0xc380('0xd')]('The\x20User\x20ID\x20is:',_0x4a32a8['id']);return getEndUser(_0x3a9d09,_0x275547['calleridname'],_0x275547[_0xc380('0x5b')],_0x43ab2f);})[_0xc380('0x3d')](function(_0x584552){_0x1236ca=_0x584552;logger[_0xc380('0xd')](_0xc380('0x5c'),_0x1236ca['id']);return getTicket(_0x3a9d09,_0x4a32a8,_0x1236ca,_0x21a785,_0x275547,_0x21a785[_0xc380('0x5d')],_0x43ab2f,'Inbound');})[_0xc380('0x3d')](function(_0x21941f){_0x52a2e9=_0x21941f;logger['info'](_0xc380('0x71'));logger[_0xc380('0xd')]('The\x20Ticket\x20ID\x20is:',_0x52a2e9['id']);return setRelationship(_0x43ab2f,_0x4a32a8,_0x52a2e9,_0xc380('0x60'));})[_0xc380('0x3d')](function(){return setRelationship(_0x43ab2f,_0x1236ca,_0x52a2e9,'contacts');})[_0xc380('0x3d')](function(){return getServerInfo(_0x43ab2f);})[_0xc380('0x73')](function(_0x13f7b4){logger[_0xc380('0x69')]('['+_0x275547[_0xc380('0x72')][_0xc380('0x74')]()+']',JSON[_0xc380('0x21')](_0x13f7b4));});}; \ 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 acacf05..3228c4c 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 _0x7189=['keyValue','keyType','format','%s:\x20%s','keyContent','key','lastIndexOf','validateEmail','isNil','test','lodash','getString','sortBy','length','type','string','push','content','variable','variableName','customVariable','name','Variable','toLowerCase','toString'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x7189,0x136));var _0x9718=function(_0x230dd3,_0x26024b){_0x230dd3=_0x230dd3-0x0;var _0x7987fa=_0x7189[_0x230dd3];return _0x7987fa;};'use strict';var _=require(_0x9718('0x0'));var util=require('util');exports[_0x9718('0x1')]=function(_0x387816,_0x147a80,_0x2cd1f9){var _0x1a2b85=[];if(_0x387816['length']>0x0){var _0xc989db=_[_0x9718('0x2')](_0x387816,['id']);for(var _0x5832b1=0x0;_0x5832b1<_0xc989db[_0x9718('0x3')];_0x5832b1++){var _0x20e935=_0xc989db[_0x5832b1];if(_0x20e935[_0x9718('0x4')]===_0x9718('0x5')){_0x1a2b85[_0x9718('0x6')](_0x20e935[_0x9718('0x7')]);}else if(_0x20e935['type']===_0x9718('0x8')&&_0x20e935['variableName']){_0x147a80[_0x20e935[_0x9718('0x9')]]&&_0x1a2b85[_0x9718('0x6')](_0x147a80[_0x20e935['variableName']]['toString']());}else if(_0x20e935[_0x9718('0x4')]===_0x9718('0xa')&&_0x20e935['Variable']&&_0x20e935['Variable'][_0x9718('0xb')]){_0x147a80[_0x20e935[_0x9718('0xc')]['name'][_0x9718('0xd')]()]&&_0x1a2b85[_0x9718('0x6')](_0x147a80[_0x20e935[_0x9718('0xc')][_0x9718('0xb')][_0x9718('0xd')]()][_0x9718('0xe')]());}else if(_0x20e935[_0x9718('0x4')]===_0x9718('0xf')){if(_0x20e935[_0x9718('0x10')]==='string'&&_0x20e935['key']){_0x1a2b85[_0x9718('0x6')](util[_0x9718('0x11')](_0x9718('0x12'),_0x20e935['key'],_0x20e935[_0x9718('0x13')]));}else if(_0x20e935['keyType']===_0x9718('0x8')&&_0x20e935[_0x9718('0x9')]&&_0x20e935[_0x9718('0x14')]){_0x147a80[_0x20e935[_0x9718('0x9')]]&&_0x1a2b85[_0x9718('0x6')](util[_0x9718('0x11')](_0x9718('0x12'),_0x20e935[_0x9718('0x14')],_0x147a80[_0x20e935['variableName']]));}else if(_0x20e935['keyType']===_0x9718('0xa')&&_0x20e935['Variable']&&_0x20e935[_0x9718('0xc')][_0x9718('0xb')]&&_0x20e935[_0x9718('0x14')]){_0x147a80[_0x20e935[_0x9718('0xc')][_0x9718('0xb')][_0x9718('0xd')]()]&&_0x1a2b85['push'](util[_0x9718('0x11')](_0x9718('0x12'),_0x20e935[_0x9718('0x14')],_0x147a80[_0x20e935[_0x9718('0xc')][_0x9718('0xb')][_0x9718('0xd')]()]));}}}}return _0x1a2b85['join'](_0x2cd1f9);};exports['stripTrailingSlash']=function(_0x5bb2b8){var _0x4bb745=_0x5bb2b8['slice'](-0x1);if(_0x4bb745==='/'){_0x5bb2b8=_0x5bb2b8['substring'](0x0,_0x5bb2b8[_0x9718('0x15')](_0x4bb745));}return _0x5bb2b8;};exports[_0x9718('0x16')]=function(_0x7198fc){if(!_[_0x9718('0x17')](_0x7198fc)&&_0x7198fc!==''){var _0x25eeb3=/^(([^<>()\[\]\\.,;:\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 _0x25eeb3[_0x9718('0x18')](String(_0x7198fc)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xfd9c=['variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','%s:\x20%s','keyContent','keyType','format','key','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfd9c,0x147));var _0xcfd9=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xfd9c[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0xcfd9('0x0'));var util=require(_0xcfd9('0x1'));exports[_0xcfd9('0x2')]=function(_0x2ec729,_0x47323d,_0x2f59cb){var _0x157824=[];if(_0x2ec729[_0xcfd9('0x3')]>0x0){var _0x5e510e=_[_0xcfd9('0x4')](_0x2ec729,['id']);for(var _0x42b26e=0x0;_0x42b26e<_0x5e510e['length'];_0x42b26e++){var _0x15405c=_0x5e510e[_0x42b26e];if(_0x15405c[_0xcfd9('0x5')]===_0xcfd9('0x6')){_0x157824[_0xcfd9('0x7')](_0x15405c['content']);}else if(_0x15405c[_0xcfd9('0x5')]===_0xcfd9('0x8')&&_0x15405c[_0xcfd9('0x9')]){_0x47323d[_0x15405c[_0xcfd9('0x9')]]&&_0x157824['push'](_0x47323d[_0x15405c[_0xcfd9('0x9')]][_0xcfd9('0xa')]());}else if(_0x15405c[_0xcfd9('0x5')]===_0xcfd9('0xb')&&_0x15405c['Variable']&&_0x15405c['Variable'][_0xcfd9('0xc')]){_0x47323d[_0x15405c[_0xcfd9('0xd')][_0xcfd9('0xc')][_0xcfd9('0xe')]()]&&_0x157824[_0xcfd9('0x7')](_0x47323d[_0x15405c[_0xcfd9('0xd')][_0xcfd9('0xc')][_0xcfd9('0xe')]()][_0xcfd9('0xa')]());}else if(_0x15405c['type']===_0xcfd9('0xf')){if(_0x15405c['keyType']===_0xcfd9('0x6')&&_0x15405c['key']){_0x157824[_0xcfd9('0x7')](util['format'](_0xcfd9('0x10'),_0x15405c['key'],_0x15405c[_0xcfd9('0x11')]));}else if(_0x15405c[_0xcfd9('0x12')]===_0xcfd9('0x8')&&_0x15405c['variableName']&&_0x15405c['key']){_0x47323d[_0x15405c[_0xcfd9('0x9')]]&&_0x157824[_0xcfd9('0x7')](util[_0xcfd9('0x13')](_0xcfd9('0x10'),_0x15405c[_0xcfd9('0x14')],_0x47323d[_0x15405c['variableName']]));}else if(_0x15405c['keyType']===_0xcfd9('0xb')&&_0x15405c[_0xcfd9('0xd')]&&_0x15405c[_0xcfd9('0xd')][_0xcfd9('0xc')]&&_0x15405c[_0xcfd9('0x14')]){_0x47323d[_0x15405c['Variable'][_0xcfd9('0xc')][_0xcfd9('0xe')]()]&&_0x157824['push'](util['format'](_0xcfd9('0x10'),_0x15405c[_0xcfd9('0x14')],_0x47323d[_0x15405c[_0xcfd9('0xd')][_0xcfd9('0xc')][_0xcfd9('0xe')]()]));}}}}return _0x157824[_0xcfd9('0x15')](_0x2f59cb);};exports[_0xcfd9('0x16')]=function(_0x5ac9aa){var _0x294a1b=_0x5ac9aa[_0xcfd9('0x17')](-0x1);if(_0x294a1b==='/'){_0x5ac9aa=_0x5ac9aa['substring'](0x0,_0x5ac9aa[_0xcfd9('0x18')](_0x294a1b));}return _0x5ac9aa;};exports[_0xcfd9('0x19')]=function(_0x41fb90){if(!_[_0xcfd9('0x1a')](_0x41fb90)&&_0x41fb90!==''){var _0x5ca8eb=/^(([^<>()\[\]\\.,;:\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 _0x5ca8eb[_0xcfd9('0x1b')](String(_0x41fb90)[_0xcfd9('0xe')]());}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 983048a..e1aae74 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(_0x34da80,_0x24fcd0){var _0x580716=function(_0x4f0c4e){while(--_0x4f0c4e){_0x34da80['push'](_0x34da80['shift']());}};_0x580716(++_0x24fcd0);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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 _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(_0x47bd0d,_0x3e8051){var _0x3cf3ac=function(_0x1d35cd){while(--_0x1d35cd){_0x47bd0d['push'](_0x47bd0d['shift']());}};_0x3cf3ac(++_0x3e8051);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e994cd6..6f0a022 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 _0x321b=['password','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','GET','forEach','includes','string','picklist','type','nameField','customField','content','toString','custom_fields','idField','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','inspect','outbound','recordingFormat','none','destcalleridname','The\x20Enduser\x20ID\x20is:','integrationTab','[OUTBOUND]','newTab','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','emit','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','validateEmail','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%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','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType'];(function(_0x32dc67,_0x207df5){var _0x4fd586=function(_0x3e1ff5){while(--_0x3e1ff5){_0x32dc67['push'](_0x32dc67['shift']());}};_0x4fd586(++_0x207df5);}(_0x321b,0xac));var _0xb321=function(_0x4ed182,_0x4e55ae){_0x4ed182=_0x4ed182-0x0;var _0x2eeffc=_0x321b[_0x4ed182];return _0x2eeffc;};'use strict';var _=require(_0xb321('0x0'));var rp=require('request-promise');var md5=require(_0xb321('0x1'));var util=require(_0xb321('0x2'));var Redis=require(_0xb321('0x3'));var intUtil=require(_0xb321('0x4'));var config=require(_0xb321('0x5'));var logger=require('../../../../config/logger')(_0xb321('0x6'));config[_0xb321('0x7')]=_[_0xb321('0x8')](config[_0xb321('0x7')],{'host':_0xb321('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb321('0x7')]));function emit(_0x531d76,_0x4b5281,_0x1a2f17){io['to'](_0x531d76)[_0xb321('0xa')](_0x4b5281,_0x1a2f17);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x3b0ee1,_0x144dc2,_0x766054,_0x30c9ae,_0x4c5e15){logger[_0xb321('0xb')](_0xb321('0xc'));return request({'uri':util['format'](_0xb321('0xd'),_0x3b0ee1[_0xb321('0xe')]),'method':_0xb321('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x766054['id'],'submitter_id':_0x144dc2?_0x144dc2['id']:undefined,'assignee_id':_0x144dc2?_0x144dc2['id']:undefined,'tags':getTags(_0x30c9ae[_0xb321('0x10')],_0xb321('0x11')),'subject':intUtil[_0xb321('0x12')](_0x30c9ae[_0xb321('0x13')],_0x4c5e15,'\x20'),'description':intUtil[_0xb321('0x12')](_0x30c9ae[_0xb321('0x14')],_0x4c5e15,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb321('0x12')](_0x30c9ae[_0xb321('0x14')],_0x4c5e15,'\x0a')}},getCustomFields(_0x30c9ae[_0xb321('0x15')],_0x4c5e15))}})[_0xb321('0x16')](function(_0x228c91){logger[_0xb321('0xb')]('Ticket\x20created!');return _0x228c91['ticket'];});}function getUser(_0x474013,_0x562fc8){if(intUtil[_0xb321('0x17')](_0x562fc8)){logger[_0xb321('0xb')]('Getting\x20agent\x20with\x20email',_0x562fc8);return request({'uri':util['format'](_0xb321('0x18'),_0x474013[_0xb321('0xe')]),'qs':{'query':util[_0xb321('0x19')](_0xb321('0x1a'),_0x562fc8)}})['then'](function(_0x270a53){if(_0x270a53[_0xb321('0x1b')]){logger['info'](_0xb321('0x1c'));return _[_0xb321('0x1d')](_0x270a53[_0xb321('0x1e')],{'email':_0x562fc8,'role':_0xb321('0x1f')});}else{logger[_0xb321('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb321('0x19')](_0xb321('0x20'),_0x474013[_0xb321('0xe')])})['then'](function(_0x3ceb4c){logger[_0xb321('0xb')](_0xb321('0x21'));return _0x3ceb4c[_0xb321('0x22')];});}});}else{logger[_0xb321('0xb')](_0xb321('0x23'));return request({'uri':util[_0xb321('0x19')](_0xb321('0x20'),_0x474013['remoteUri'])})[_0xb321('0x16')](function(_0x2e2930){logger[_0xb321('0xb')]('Admin\x20account\x20selected.');return _0x2e2930[_0xb321('0x22')];});}}function getEndUser(_0x362c4b,_0x2beb74,_0x3cf254){logger[_0xb321('0xb')](_0xb321('0x24'),_0x3cf254);return request({'uri':util[_0xb321('0x19')](_0xb321('0x18'),_0x362c4b['remoteUri']),'qs':{'query':util[_0xb321('0x19')](_0xb321('0x25'),_0x3cf254)}})['then'](function(_0x5675cb){var _0xd986f2;if(_0x5675cb[_0xb321('0x1e')][_0xb321('0x26')]){_0x5675cb[_0xb321('0x1e')]=_[_0xb321('0x27')](_0x5675cb[_0xb321('0x1e')],{'suspended':![],'role':'end-user'});if(_0x5675cb[_0xb321('0x1e')]['length']){_0xd986f2=_[_0xb321('0x28')](_0x5675cb[_0xb321('0x1e')]);}}if(_0xd986f2){logger['info'](_0xb321('0x29'));return _0xd986f2;}else{logger['info'](_0xb321('0x2a'));return request({'uri':util[_0xb321('0x19')](_0xb321('0x2b'),_0x362c4b[_0xb321('0xe')]),'method':_0xb321('0xf'),'body':{'user':{'role':'end-user','name':util[_0xb321('0x19')]('Caller\x20-\x20%s',_0x2beb74||_0x3cf254),'phone':_0x3cf254}}})[_0xb321('0x16')](function(_0x11ddde){logger[_0xb321('0xb')](_0xb321('0x2c'));return _0x11ddde['user'];});}});}function getAuth(_0x5f0405){var _0x53ac62;if(_0x5f0405[_0xb321('0x2d')]===_0xb321('0x2e')){_0x53ac62=util[_0xb321('0x19')](_0xb321('0x2f'),_0x5f0405[_0xb321('0x30')],_0x5f0405[_0xb321('0x2e')]);}else if(_0x5f0405['authType']===_0xb321('0x31')){_0x53ac62=util[_0xb321('0x19')](_0xb321('0x32'),_0x5f0405[_0xb321('0x30')],_0x5f0405[_0xb321('0x31')]);}return util[_0xb321('0x19')](_0xb321('0x33'),new Buffer(_0x53ac62)['toString'](_0xb321('0x34')));}function request(_0x424e79){logger[_0xb321('0x35')](_0xb321('0x36'),JSON['stringify'](_0x424e79));return rp(_[_0xb321('0x8')](_0x424e79,{'method':_0xb321('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1f5bfa,_0x35a888){var _0x21d1a0=[];if(_0x1f5bfa&&_0x1f5bfa[_0xb321('0x26')]>0x0){_0x21d1a0=_['map'](_0x1f5bfa,_0x35a888);}return _0x21d1a0;}function getCustomFields(_0x3ff3b4,_0x473a3f){var _0x2a7319=[];var _0x3a9f79={'custom_fields':[]};if(_0x3ff3b4[_0xb321('0x26')]>0x0){_[_0xb321('0x38')](_0x3ff3b4,function(_0x2f2bf1){if(_[_0xb321('0x39')]([_0xb321('0x3a'),_0xb321('0x3b')],_0x2f2bf1[_0xb321('0x3c')])&&_0x2f2bf1[_0xb321('0x3d')]&&!_0x2f2bf1[_0xb321('0x3e')]){_0x3a9f79[_0x2f2bf1['nameField']['toLowerCase']()]=_0x2f2bf1[_0xb321('0x3f')][_0xb321('0x40')]();}else if(_[_0xb321('0x39')]([_0xb321('0x3a'),_0xb321('0x3b')],_0x2f2bf1[_0xb321('0x3c')])&&_0x2f2bf1['idField']&&_0x2f2bf1[_0xb321('0x3e')]){_0x3a9f79[_0xb321('0x41')]['push']({'id':_0x2f2bf1[_0xb321('0x42')],'value':_0x2f2bf1[_0xb321('0x3f')][_0xb321('0x40')]()});}else if(_0x2f2bf1[_0xb321('0x3c')]==='variable'&&_0x2f2bf1[_0xb321('0x43')]&&_0x2f2bf1[_0xb321('0x42')]&&_0x2f2bf1['customField']){_0x473a3f[_0x2f2bf1[_0xb321('0x43')]]&&_0x3a9f79[_0xb321('0x41')][_0xb321('0x44')]({'id':_0x2f2bf1['idField'],'value':_0x473a3f[_0x2f2bf1['variableName']][_0xb321('0x40')]()});}else if(_0x2f2bf1[_0xb321('0x3c')]===_0xb321('0x45')&&_0x2f2bf1['Variable']&&_0x2f2bf1[_0xb321('0x46')][_0xb321('0x11')]&&_0x2f2bf1[_0xb321('0x42')]&&_0x2f2bf1[_0xb321('0x3e')]){_0x473a3f[_0x2f2bf1[_0xb321('0x46')]['name']['toLowerCase']()]&&_0x3a9f79[_0xb321('0x41')][_0xb321('0x44')]({'id':_0x2f2bf1[_0xb321('0x42')],'value':_0x473a3f[_0x2f2bf1[_0xb321('0x46')][_0xb321('0x11')]['toLowerCase']()][_0xb321('0x40')]()});}});}return _0x3a9f79;}exports[_0xb321('0x47')]=function(_0x58e933,_0x35766f,_0x57d6ba,_0x19f339,_0xdbd9be,_0x29d569){var _0x1cd71c,_0x1fd390;_0x29d569[_0xb321('0xe')]=intUtil[_0xb321('0x48')](_0x29d569[_0xb321('0xe')]);_0x29d569[_0xb321('0x49')]=intUtil[_0xb321('0x48')](_0x29d569[_0xb321('0x49')]);if(_0xdbd9be&&_0xdbd9be[_0xb321('0x4a')]){logger[_0xb321('0xb')](_0xb321('0x4b'),_0xb321('0x4c'));_0x35766f[_0xb321('0x4d')]=util[_0xb321('0x19')](_0xb321('0x4e'),_0x29d569[_0xb321('0x49')],_0x35766f['uniqueid'],md5(_0x35766f[_0xb321('0x4f')]));}else{_0x35766f[_0xb321('0x4d')]='';}headers[_0xb321('0x50')]=getAuth(_0x29d569);return getUser(_0x29d569,_0x19f339[_0xb321('0x51')])[_0xb321('0x16')](function(_0x3a7cc1){_0x1cd71c=_0x3a7cc1;logger['info'](_0xb321('0x52'),_0x1cd71c['id']);return getEndUser(_0x29d569,_0x35766f[_0xb321('0x53')],_0x35766f[_0xb321('0x54')]);})[_0xb321('0x16')](function(_0x5738cf){_0x1fd390=_0x5738cf;logger[_0xb321('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1fd390['id']);return getTicket(_0x29d569,_0x1cd71c,_0x1fd390,_0x57d6ba,_0x35766f);})[_0xb321('0x16')](function(_0x11d55e){if(_0x11d55e){logger[_0xb321('0xb')](_0xb321('0x55'),_0x11d55e['id']);switch(_0x29d569[_0xb321('0x3c')]){case'integrationTab':logger[_0xb321('0xb')](_0xb321('0x4b'),_0xb321('0x56'));return request({'uri':util[_0xb321('0x19')](_0xb321('0x57'),_0x29d569['remoteUri'],_0x1cd71c['id'],_0x11d55e['id']),'method':_0xb321('0xf')});case'newTab':logger[_0xb321('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb321('0x19')](_0xb321('0x58'),_0x19f339[_0xb321('0x11')]),_0xb321('0x59'),{'uri':util[_0xb321('0x19')]('%s/agent/tickets/%s',_0x29d569[_0xb321('0xe')]['replace']('/api/v2',''),_0x11d55e['id'])});break;default:logger['error'](_0xb321('0x4b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0xc15234){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb321('0x5a')](_0xc15234,{'showHidden':!![],'depth':null}));});};exports[_0xb321('0x5b')]=function(_0x58a6dc,_0x1eca37,_0x3684c1,_0x5a304d,_0x4c754b,_0x5daf43,_0x42f84b){var _0x3d22f2,_0x15e374;_0x5daf43[_0xb321('0xe')]=intUtil[_0xb321('0x48')](_0x5daf43['remoteUri']);_0x5daf43[_0xb321('0x49')]=intUtil[_0xb321('0x48')](_0x5daf43['serverUrl']);if(_0x42f84b&&_0x42f84b['recordingFormat']&&_0x42f84b[_0xb321('0x5c')]!==_0xb321('0x5d')){logger['info']('[OUTBOUND]',_0xb321('0x4c'));_0x1eca37[_0xb321('0x4d')]=util[_0xb321('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5daf43[_0xb321('0x49')],_0x1eca37[_0xb321('0x4f')],md5(_0x1eca37[_0xb321('0x4f')]));}headers[_0xb321('0x50')]=getAuth(_0x5daf43);return getUser(_0x5daf43,_0x5a304d[_0xb321('0x51')])[_0xb321('0x16')](function(_0x3f50ed){_0x3d22f2=_0x3f50ed;logger[_0xb321('0xb')](_0xb321('0x52'),_0x3d22f2['id']);return getEndUser(_0x5daf43,_0x1eca37[_0xb321('0x5e')],_0x1eca37['destcalleridnum']);})[_0xb321('0x16')](function(_0x3dfd3c){_0x15e374=_0x3dfd3c;logger[_0xb321('0xb')](_0xb321('0x5f'),_0x15e374['id']);return getTicket(_0x5daf43,_0x3d22f2,_0x15e374,_0x3684c1,_0x1eca37);})[_0xb321('0x16')](function(_0x49fd9f){if(_0x49fd9f){logger['info'](_0xb321('0x55'),_0x49fd9f['id']);switch(_0x5daf43[_0xb321('0x3c')]){case _0xb321('0x60'):logger[_0xb321('0xb')](_0xb321('0x61'),_0xb321('0x56'));return request({'uri':util['format'](_0xb321('0x57'),_0x5daf43[_0xb321('0xe')],_0x3d22f2['id'],_0x49fd9f['id']),'method':'POST'});case _0xb321('0x62'):logger[_0xb321('0xb')](_0xb321('0x61'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb321('0x19')](_0xb321('0x58'),_0x5a304d[_0xb321('0x11')]),'trigger:browser:url',{'uri':util[_0xb321('0x19')](_0xb321('0x63'),_0x5daf43['remoteUri'][_0xb321('0x64')](_0xb321('0x65'),''),_0x49fd9f['id'])});break;default:logger[_0xb321('0x66')](_0xb321('0x61'),_0xb321('0x67'));}}})['catch'](function(_0x3f28c6){logger[_0xb321('0x66')](_0xb321('0x68'),util[_0xb321('0x5a')](_0x3f28c6,{'showHidden':!![],'depth':null}));});};exports[_0xb321('0x69')]=function(_0x1e4548,_0x5db1ff,_0x2d0282,_0x2a8331,_0x39079f,_0x2598c0){var _0x36bfc4,_0x167f6b;_0x2598c0[_0xb321('0xe')]=intUtil['stripTrailingSlash'](_0x2598c0['remoteUri']);_0x2598c0[_0xb321('0x49')]=intUtil[_0xb321('0x48')](_0x2598c0[_0xb321('0x49')]);if(_0x39079f&&_0x39079f[_0xb321('0x4a')]){logger[_0xb321('0xb')]('['+_0x5db1ff['lastevent'][_0xb321('0x6a')]()+']','Recording\x20is\x20enabled!');_0x5db1ff['recordingURL']=util[_0xb321('0x19')](_0xb321('0x4e'),_0x2598c0['serverUrl'],_0x5db1ff[_0xb321('0x4f')],md5(_0x5db1ff['uniqueid']));}else{_0x5db1ff[_0xb321('0x4d')]='';}headers[_0xb321('0x50')]=getAuth(_0x2598c0);return getUser(_0x2598c0)['then'](function(_0x396fc3){_0x36bfc4=_0x396fc3;logger[_0xb321('0xb')](_0xb321('0x52'),_0x36bfc4['id']);return getEndUser(_0x2598c0,_0x5db1ff['calleridname'],_0x5db1ff[_0xb321('0x54')]);})['then'](function(_0x23f937){_0x167f6b=_0x23f937;logger[_0xb321('0xb')]('The\x20Enduser\x20ID\x20is:',_0x167f6b['id']);return getTicket(_0x2598c0,_0x36bfc4,_0x167f6b,_0x2d0282,_0x5db1ff);})[_0xb321('0x16')](function(_0x504754){if(_0x504754){logger[_0xb321('0xb')](_0xb321('0x55'),_0x504754['id']);}})[_0xb321('0x6b')](function(_0x53137c){logger[_0xb321('0x66')]('['+_0x5db1ff['lastevent'][_0xb321('0x6a')]()+']'+_0xb321('0x6c'),util[_0xb321('0x5a')](_0x53137c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x99f5=['results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','custom_fields','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','Recording\x20is\x20enabled!','email','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','then','count'];(function(_0x3c1d7c,_0x1ae62c){var _0x535c45=function(_0x337725){while(--_0x337725){_0x3c1d7c['push'](_0x3c1d7c['shift']());}};_0x535c45(++_0x1ae62c);}(_0x99f5,0xc5));var _0x599f=function(_0x28de64,_0x558c25){_0x28de64=_0x28de64-0x0;var _0x122f63=_0x99f5[_0x28de64];return _0x122f63;};'use strict';var _=require(_0x599f('0x0'));var rp=require(_0x599f('0x1'));var md5=require(_0x599f('0x2'));var util=require(_0x599f('0x3'));var Redis=require(_0x599f('0x4'));var intUtil=require(_0x599f('0x5'));var config=require(_0x599f('0x6'));var logger=require(_0x599f('0x7'))(_0x599f('0x8'));config['redis']=_[_0x599f('0x9')](config[_0x599f('0xa')],{'host':_0x599f('0xb'),'port':0x18eb});var io=require(_0x599f('0xc'))(new Redis(config['redis']));function emit(_0x22bb13,_0x2abae9,_0x37876f){io['to'](_0x22bb13)[_0x599f('0xd')](_0x2abae9,_0x37876f);}var headers={'Content-Type':_0x599f('0xe'),'Accept':_0x599f('0xe')};function getTicket(_0x47dac2,_0x1a612d,_0x24ce61,_0x1a1b74,_0x125289){logger[_0x599f('0xf')](_0x599f('0x10'));return request({'uri':util['format']('%s/tickets.json',_0x47dac2[_0x599f('0x11')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x24ce61['id'],'submitter_id':_0x1a612d?_0x1a612d['id']:undefined,'assignee_id':_0x1a612d?_0x1a612d['id']:undefined,'tags':getTags(_0x1a1b74['Tags'],_0x599f('0x12')),'subject':intUtil[_0x599f('0x13')](_0x1a1b74[_0x599f('0x14')],_0x125289,'\x20'),'description':intUtil['getString'](_0x1a1b74[_0x599f('0x15')],_0x125289,'\x0a'),'comment':{'public':![],'body':intUtil[_0x599f('0x13')](_0x1a1b74[_0x599f('0x15')],_0x125289,'\x0a')}},getCustomFields(_0x1a1b74[_0x599f('0x16')],_0x125289))}})['then'](function(_0x1c0855){logger['info'](_0x599f('0x17'));return _0x1c0855[_0x599f('0x18')];});}function getUser(_0x15e12a,_0x59319b){if(intUtil[_0x599f('0x19')](_0x59319b)){logger[_0x599f('0xf')](_0x599f('0x1a'),_0x59319b);return request({'uri':util[_0x599f('0x1b')](_0x599f('0x1c'),_0x15e12a[_0x599f('0x11')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x59319b)}})[_0x599f('0x1d')](function(_0x553d89){if(_0x553d89[_0x599f('0x1e')]){logger[_0x599f('0xf')]('Agent\x20found!');return _['find'](_0x553d89[_0x599f('0x1f')],{'email':_0x59319b,'role':_0x599f('0x20')});}else{logger[_0x599f('0xf')](_0x599f('0x21'));return request({'uri':util['format'](_0x599f('0x22'),_0x15e12a['remoteUri'])})[_0x599f('0x1d')](function(_0x2c4a6c){logger[_0x599f('0xf')](_0x599f('0x23'));return _0x2c4a6c[_0x599f('0x24')];});}});}else{logger['info'](_0x599f('0x21'));return request({'uri':util['format'](_0x599f('0x22'),_0x15e12a[_0x599f('0x11')])})[_0x599f('0x1d')](function(_0x1d4927){logger[_0x599f('0xf')](_0x599f('0x23'));return _0x1d4927[_0x599f('0x24')];});}}function getEndUser(_0x4be0c1,_0x2eed4c,_0x398a90){logger['info'](_0x599f('0x25'),_0x398a90);return request({'uri':util[_0x599f('0x1b')]('%s/search.json',_0x4be0c1[_0x599f('0x11')]),'qs':{'query':util[_0x599f('0x1b')](_0x599f('0x26'),_0x398a90)}})['then'](function(_0x4e747f){var _0x725f08;if(_0x4e747f[_0x599f('0x1f')][_0x599f('0x27')]){_0x4e747f[_0x599f('0x1f')]=_[_0x599f('0x28')](_0x4e747f[_0x599f('0x1f')],{'suspended':![],'role':_0x599f('0x29')});if(_0x4e747f[_0x599f('0x1f')][_0x599f('0x27')]){_0x725f08=_[_0x599f('0x2a')](_0x4e747f['results']);}}if(_0x725f08){logger[_0x599f('0xf')](_0x599f('0x2b'));return _0x725f08;}else{logger[_0x599f('0xf')](_0x599f('0x2c'));return request({'uri':util[_0x599f('0x1b')](_0x599f('0x2d'),_0x4be0c1['remoteUri']),'method':_0x599f('0x2e'),'body':{'user':{'role':_0x599f('0x29'),'name':util[_0x599f('0x1b')]('Caller\x20-\x20%s',_0x2eed4c||_0x398a90),'phone':_0x398a90}}})[_0x599f('0x1d')](function(_0x516b11){logger[_0x599f('0xf')](_0x599f('0x2f'));return _0x516b11[_0x599f('0x24')];});}});}function getAuth(_0x54f934){var _0x21ad18;if(_0x54f934['authType']===_0x599f('0x30')){_0x21ad18=util[_0x599f('0x1b')](_0x599f('0x31'),_0x54f934[_0x599f('0x32')],_0x54f934[_0x599f('0x30')]);}else if(_0x54f934[_0x599f('0x33')]==='token'){_0x21ad18=util[_0x599f('0x1b')](_0x599f('0x34'),_0x54f934[_0x599f('0x32')],_0x54f934[_0x599f('0x35')]);}return util[_0x599f('0x1b')](_0x599f('0x36'),new Buffer(_0x21ad18)[_0x599f('0x37')]('base64'));}function request(_0x38ed2d){logger[_0x599f('0x38')](_0x599f('0x39'),JSON[_0x599f('0x3a')](_0x38ed2d));return rp(_[_0x599f('0x9')](_0x38ed2d,{'method':_0x599f('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x36b0b4,_0x48351f){var _0x5a933c=[];if(_0x36b0b4&&_0x36b0b4['length']>0x0){_0x5a933c=_[_0x599f('0x3c')](_0x36b0b4,_0x48351f);}return _0x5a933c;}function getCustomFields(_0x3b5360,_0x29faf7){var _0x5bba96=[];var _0xd17df5={'custom_fields':[]};if(_0x3b5360['length']>0x0){_[_0x599f('0x3d')](_0x3b5360,function(_0x69f778){if(_['includes']([_0x599f('0x3e'),'picklist'],_0x69f778[_0x599f('0x3f')])&&_0x69f778[_0x599f('0x40')]&&!_0x69f778[_0x599f('0x41')]){_0xd17df5[_0x69f778['nameField'][_0x599f('0x42')]()]=_0x69f778[_0x599f('0x43')][_0x599f('0x37')]();}else if(_['includes'](['string',_0x599f('0x44')],_0x69f778[_0x599f('0x3f')])&&_0x69f778[_0x599f('0x45')]&&_0x69f778[_0x599f('0x41')]){_0xd17df5['custom_fields'][_0x599f('0x46')]({'id':_0x69f778[_0x599f('0x45')],'value':_0x69f778[_0x599f('0x43')]['toString']()});}else if(_0x69f778[_0x599f('0x3f')]===_0x599f('0x47')&&_0x69f778[_0x599f('0x48')]&&_0x69f778['idField']&&_0x69f778['customField']){_0x29faf7[_0x69f778[_0x599f('0x48')]]&&_0xd17df5[_0x599f('0x49')][_0x599f('0x46')]({'id':_0x69f778[_0x599f('0x45')],'value':_0x29faf7[_0x69f778['variableName']]['toString']()});}else if(_0x69f778[_0x599f('0x3f')]==='customVariable'&&_0x69f778['Variable']&&_0x69f778['Variable']['name']&&_0x69f778['idField']&&_0x69f778['customField']){_0x29faf7[_0x69f778[_0x599f('0x4a')][_0x599f('0x12')][_0x599f('0x42')]()]&&_0xd17df5[_0x599f('0x49')][_0x599f('0x46')]({'id':_0x69f778[_0x599f('0x45')],'value':_0x29faf7[_0x69f778[_0x599f('0x4a')][_0x599f('0x12')][_0x599f('0x42')]()][_0x599f('0x37')]()});}});}return _0xd17df5;}exports['queue']=function(_0xbba90,_0x24f85b,_0x60f67a,_0x104f56,_0x7c72aa,_0x6c49e8){var _0x43be3b,_0x566705;_0x6c49e8[_0x599f('0x11')]=intUtil[_0x599f('0x4b')](_0x6c49e8[_0x599f('0x11')]);_0x6c49e8['serverUrl']=intUtil['stripTrailingSlash'](_0x6c49e8[_0x599f('0x4c')]);if(_0x7c72aa&&_0x7c72aa[_0x599f('0x4d')]){logger['info'](_0x599f('0x4e'),'Recording\x20is\x20enabled!');_0x24f85b[_0x599f('0x4f')]=util[_0x599f('0x1b')](_0x599f('0x50'),_0x6c49e8['serverUrl'],_0x24f85b[_0x599f('0x51')],md5(_0x24f85b['uniqueid']));}else{_0x24f85b[_0x599f('0x4f')]='';}headers[_0x599f('0x52')]=getAuth(_0x6c49e8);return getUser(_0x6c49e8,_0x104f56['email'])[_0x599f('0x1d')](function(_0x534816){_0x43be3b=_0x534816;logger[_0x599f('0xf')](_0x599f('0x53'),_0x43be3b['id']);return getEndUser(_0x6c49e8,_0x24f85b[_0x599f('0x54')],_0x24f85b[_0x599f('0x55')]);})[_0x599f('0x1d')](function(_0x48136f){_0x566705=_0x48136f;logger[_0x599f('0xf')](_0x599f('0x56'),_0x566705['id']);return getTicket(_0x6c49e8,_0x43be3b,_0x566705,_0x60f67a,_0x24f85b);})[_0x599f('0x1d')](function(_0xc786b6){if(_0xc786b6){logger[_0x599f('0xf')](_0x599f('0x57'),_0xc786b6['id']);switch(_0x6c49e8[_0x599f('0x3f')]){case _0x599f('0x58'):logger[_0x599f('0xf')](_0x599f('0x4e'),_0x599f('0x59'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x6c49e8[_0x599f('0x11')],_0x43be3b['id'],_0xc786b6['id']),'method':_0x599f('0x2e')});case _0x599f('0x5a'):logger[_0x599f('0xf')](_0x599f('0x4e'),_0x599f('0x5b'));emit(util[_0x599f('0x1b')](_0x599f('0x5c'),_0x104f56[_0x599f('0x12')]),_0x599f('0x5d'),{'uri':util[_0x599f('0x1b')](_0x599f('0x5e'),_0x6c49e8['remoteUri'][_0x599f('0x5f')](_0x599f('0x60'),''),_0xc786b6['id'])});break;default:logger[_0x599f('0x61')](_0x599f('0x4e'),_0x599f('0x62'));}}})[_0x599f('0x63')](function(_0x26804c){logger[_0x599f('0x61')](_0x599f('0x64'),util[_0x599f('0x65')](_0x26804c,{'showHidden':!![],'depth':null}));});};exports[_0x599f('0x66')]=function(_0x3821a8,_0x108b17,_0x380ecb,_0x3f3f2e,_0x5d8b84,_0x486fea,_0x1073a5){var _0x2a6f74,_0x5251fe;_0x486fea[_0x599f('0x11')]=intUtil[_0x599f('0x4b')](_0x486fea[_0x599f('0x11')]);_0x486fea[_0x599f('0x4c')]=intUtil[_0x599f('0x4b')](_0x486fea[_0x599f('0x4c')]);if(_0x1073a5&&_0x1073a5['recordingFormat']&&_0x1073a5['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0x599f('0x67'));_0x108b17['recordingURL']=util[_0x599f('0x1b')](_0x599f('0x50'),_0x486fea['serverUrl'],_0x108b17['uniqueid'],md5(_0x108b17[_0x599f('0x51')]));}headers[_0x599f('0x52')]=getAuth(_0x486fea);return getUser(_0x486fea,_0x3f3f2e[_0x599f('0x68')])['then'](function(_0x3f0b7e){_0x2a6f74=_0x3f0b7e;logger[_0x599f('0xf')](_0x599f('0x53'),_0x2a6f74['id']);return getEndUser(_0x486fea,_0x108b17[_0x599f('0x69')],_0x108b17[_0x599f('0x6a')]);})['then'](function(_0x36f33f){_0x5251fe=_0x36f33f;logger['info'](_0x599f('0x56'),_0x5251fe['id']);return getTicket(_0x486fea,_0x2a6f74,_0x5251fe,_0x380ecb,_0x108b17);})[_0x599f('0x1d')](function(_0x3c2810){if(_0x3c2810){logger[_0x599f('0xf')](_0x599f('0x57'),_0x3c2810['id']);switch(_0x486fea[_0x599f('0x3f')]){case _0x599f('0x58'):logger[_0x599f('0xf')](_0x599f('0x6b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x599f('0x1b')](_0x599f('0x6c'),_0x486fea[_0x599f('0x11')],_0x2a6f74['id'],_0x3c2810['id']),'method':_0x599f('0x2e')});case _0x599f('0x5a'):logger['info'](_0x599f('0x6b'),_0x599f('0x5b'));emit(util[_0x599f('0x1b')](_0x599f('0x5c'),_0x3f3f2e[_0x599f('0x12')]),'trigger:browser:url',{'uri':util[_0x599f('0x1b')](_0x599f('0x5e'),_0x486fea[_0x599f('0x11')]['replace'](_0x599f('0x60'),''),_0x3c2810['id'])});break;default:logger[_0x599f('0x61')](_0x599f('0x6b'),_0x599f('0x62'));}}})[_0x599f('0x63')](function(_0x53c6f8){logger[_0x599f('0x61')](_0x599f('0x6d'),util[_0x599f('0x65')](_0x53c6f8,{'showHidden':!![],'depth':null}));});};exports[_0x599f('0x6e')]=function(_0x5a45be,_0x5678e8,_0x4b820c,_0xecb2bb,_0x20a575,_0xd48fb){var _0x553fa2,_0x1daa07;_0xd48fb[_0x599f('0x11')]=intUtil[_0x599f('0x4b')](_0xd48fb[_0x599f('0x11')]);_0xd48fb[_0x599f('0x4c')]=intUtil[_0x599f('0x4b')](_0xd48fb[_0x599f('0x4c')]);if(_0x20a575&&_0x20a575[_0x599f('0x4d')]){logger[_0x599f('0xf')]('['+_0x5678e8['lastevent'][_0x599f('0x6f')]()+']',_0x599f('0x67'));_0x5678e8[_0x599f('0x4f')]=util[_0x599f('0x1b')](_0x599f('0x50'),_0xd48fb[_0x599f('0x4c')],_0x5678e8[_0x599f('0x51')],md5(_0x5678e8[_0x599f('0x51')]));}else{_0x5678e8[_0x599f('0x4f')]='';}headers['Authorization']=getAuth(_0xd48fb);return getUser(_0xd48fb)[_0x599f('0x1d')](function(_0x1f4ff1){_0x553fa2=_0x1f4ff1;logger[_0x599f('0xf')](_0x599f('0x53'),_0x553fa2['id']);return getEndUser(_0xd48fb,_0x5678e8[_0x599f('0x54')],_0x5678e8['calleridnum']);})[_0x599f('0x1d')](function(_0x3f4e6f){_0x1daa07=_0x3f4e6f;logger[_0x599f('0xf')]('The\x20Enduser\x20ID\x20is:',_0x1daa07['id']);return getTicket(_0xd48fb,_0x553fa2,_0x1daa07,_0x4b820c,_0x5678e8);})[_0x599f('0x1d')](function(_0x24c219){if(_0x24c219){logger[_0x599f('0xf')]('The\x20Ticket\x20ID\x20is:',_0x24c219['id']);}})[_0x599f('0x63')](function(_0x139ed1){logger['error']('['+_0x5678e8[_0x599f('0x70')][_0x599f('0x6f')]()+']'+_0x599f('0x71'),util[_0x599f('0x65')](_0x139ed1,{'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 5d51a13..4e66618 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 _0x066a=['Outbound','[OUTBOUND]','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','com','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','data','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','last_name','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','format','mm:ss','answertime','endtime','utc','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','zoho.eu','destcalleridname','destcalleridnum'];(function(_0x490c45,_0x97b829){var _0x82738e=function(_0x215c17){while(--_0x215c17){_0x490c45['push'](_0x490c45['shift']());}};_0x82738e(++_0x97b829);}(_0x066a,0x9b));var _0xa066=function(_0x50865c,_0x5c7b60){_0x50865c=_0x50865c-0x0;var _0x5b7717=_0x066a[_0x50865c];return _0x5b7717;};'use strict';var _=require(_0xa066('0x0'));var rp=require(_0xa066('0x1'));var md5=require(_0xa066('0x2'));var util=require('util');var intUtil=require(_0xa066('0x3'));var moment=require(_0xa066('0x4'));var Redis=require('ioredis');var BPromise=require(_0xa066('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa066('0x6'))(_0xa066('0x7'));config[_0xa066('0x8')]=_['defaults'](config[_0xa066('0x8')],{'host':_0xa066('0x9'),'port':0x18eb});var io=require(_0xa066('0xa'))(new Redis(config[_0xa066('0x8')]));function emit(_0xa4c07e,_0x5a9aa1,_0x484efb){io['to'](_0xa4c07e)[_0xa066('0xb')](_0x5a9aa1,_0x484efb);}function request(_0x58740d){logger[_0xa066('0xc')](_0xa066('0xd'),JSON[_0xa066('0xe')](_0x58740d));return rp(_0x58740d);}function getCustomFields(_0x2a1bf7,_0x47794d){var _0x1afac4={};if(_0x2a1bf7[_0xa066('0xf')]>0x0){_['forEach'](_0x2a1bf7,function(_0x25af63){if(_['includes'](['string',_0xa066('0x10')],_0x25af63[_0xa066('0x11')])&&_0x25af63[_0xa066('0x12')]){_0x1afac4[_0x25af63['idField']]=_0x25af63[_0xa066('0x13')]['toString']();}else if(_0x25af63[_0xa066('0x11')]===_0xa066('0x14')&&_0x25af63['variableName']&&_0x25af63[_0xa066('0x12')]&&_0x47794d[_0x25af63[_0xa066('0x15')]]){_0x1afac4[_0x25af63[_0xa066('0x12')]]=_0x47794d[_0x25af63[_0xa066('0x15')]][_0xa066('0x16')]();}else if(_0x25af63[_0xa066('0x11')]===_0xa066('0x17')&&_0x25af63[_0xa066('0x18')]&&_0x25af63[_0xa066('0x18')][_0xa066('0x19')]&&_0x25af63[_0xa066('0x12')]&&_0x47794d[_0x25af63['Variable'][_0xa066('0x19')]['toLowerCase']()]){_0x1afac4[_0x25af63[_0xa066('0x12')]]=_0x47794d[_0x25af63[_0xa066('0x18')][_0xa066('0x19')][_0xa066('0x1a')]()]['toString']();}});}return _0x1afac4;}function getName(_0x9e0e6f){if(_0x9e0e6f['indexOf']('\x20')>0x0){var _0xcf6d9b=_0x9e0e6f[_0xa066('0x1b')](/ (.+)/);if(_0xcf6d9b[0x1]){return _0xcf6d9b;}}return[_0x9e0e6f,_0x9e0e6f];}var accountsTokens={};function getAccessToken(_0xd54f08){return new Promise(function(_0x237fbf,_0xc9ecb3){if(!_[_0xa066('0x1c')](accountsTokens[_0xd54f08['id']])&&!_['isNil'](accountsTokens[_0xd54f08['id']][_0xa066('0x1d')])){if(moment()[_0xa066('0x1e')](accountsTokens[_0xd54f08['id']][_0xa066('0x1f')])){_0x237fbf(accountsTokens[_0xd54f08['id']][_0xa066('0x1d')]);}}var _0x43220b;switch(_0xd54f08[_0xa066('0x20')]){case'US':_0x43220b='https://accounts.zoho.com';break;case'AU':_0x43220b=_0xa066('0x21');break;case'EU':_0x43220b=_0xa066('0x22');break;case'IN':_0x43220b='https://accounts.zoho.in';break;case'CN':_0x43220b=_0xa066('0x23');break;default:_0x43220b=_0xa066('0x22');break;}var _0x57c18c={'method':_0xa066('0x24'),'uri':_0x43220b+'/oauth/v2/token','qs':{'refresh_token':_0xd54f08[_0xa066('0x25')],'client_id':_0xd54f08[_0xa066('0x26')],'client_secret':_0xd54f08['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x57c18c)[_0xa066('0x27')](function(_0x1c7a5){accountsTokens[_0xd54f08['id']]={'access_token':_0x1c7a5['access_token'],'expires_in':moment()[_0xa066('0x28')](_0x1c7a5['expires_in'],_0xa066('0x29'))};_0x237fbf(_0x1c7a5[_0xa066('0x1d')]);})[_0xa066('0x2a')](function(_0x462447){logger[_0xa066('0x2b')](_0xa066('0x2c'),_0x462447[_0xa066('0x2d')]);_0xc9ecb3(_0x462447);});});}function getUser(_0x1b9130,_0xb98118,_0xd6c488,_0x3e3d95){logger[_0xa066('0x2e')](_0xa066('0x2f'));return request({'method':'GET','uri':util['format'](_0xa066('0x30'),_0xb98118),'qs':{'type':_0xa066('0x31')},'headers':{'Authorization':_0xa066('0x32')+_0x1b9130},'json':!![]})[_0xa066('0x27')](function(_0x125c0f){if(_0x125c0f[_0xa066('0x33')]){var _0x17a5af=-0x1;if(_['isArrayLikeObject'](_0x125c0f[_0xa066('0x33')])){if(!_['isNil'](_0x3e3d95)){_0x17a5af=_[_0xa066('0x34')](_0x125c0f[_0xa066('0x33')],function(_0xc3783e){return _0xc3783e[_0xa066('0x35')]===_0x3e3d95;});}if(_0x17a5af>=0x0){logger['info'](_0xa066('0x36'));}else{logger[_0xa066('0x2e')](_0xa066('0x37'));_0x17a5af=_['findIndex'](_0x125c0f[_0xa066('0x33')],function(_0x1a556c){return _0x1a556c[_0xa066('0x38')][_0xa066('0x19')]===_0xa066('0x39');});}return _0x125c0f[_0xa066('0x33')][_0x17a5af];}else{if(_0x125c0f[_0xa066('0x3a')][_0xa066('0x38')]['name']===_0xa066('0x39')){logger[_0xa066('0x2e')](_0xa066('0x37'));user=_0x125c0f[_0xa066('0x3a')];return user;}else{logger[_0xa066('0x2b')](_0xa066('0x3b'),JSON[_0xa066('0xe')](_0x125c0f));throw new Error(_0xa066('0x3c')+JSON['stringify'](_0x125c0f));}}}else{logger[_0xa066('0x2b')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x125c0f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa066('0xe')](_0x125c0f));}})['catch'](function(_0x44f6cf){console[_0xa066('0x2b')](_0x44f6cf);});}function getZohoUser(_0x3977e5,_0x3dac7c){return new BPromise(function(_0x393b69,_0x3e1ac5){request(_0x3977e5)['then'](function(_0x31fec3){var _0x159f19=null;if(_0x31fec3){_0x159f19=_0x31fec3['data'][0x0];_0x159f19[_0xa066('0x3d')]=_0x3dac7c;}_0x393b69(_0x159f19);})[_0xa066('0x2a')](function(_0x406118){_0x3e1ac5(_0x406118);});});}function createEndUser(_0x41405f,_0x163346,_0x527157,_0x577e8e,_0x3264cb,_0x54843f){var _0x527157=getName(_0x527157);return request({'method':_0xa066('0x24'),'uri':_0xa066('0x3e')+_0x163346+_0xa066('0x3f')+_[_0xa066('0x40')](_0x54843f[_0xa066('0x41')])+'s','body':{'data':[{'Last_Name':_0x527157[0x1],'First_Name':_0x527157[0x0],'Phone':_0x577e8e,'Owner':{'name':!_[_0xa066('0x1c')](_0x3264cb[_0xa066('0x42')][_0xa066('0x19')])?_0x3264cb['role'][_0xa066('0x19')]:!_[_0xa066('0x1c')](_0x3264cb[_0xa066('0x43')])?_0x3264cb[_0xa066('0x43')]+'\x20'+_0x3264cb['last_name']:_0x3264cb['last_name'],'id':_0x3264cb['id']}}]},'headers':{'Authorization':_0xa066('0x32')+_0x41405f},'json':!![]})[_0xa066('0x27')](function(_0x29fd51){if(_0x29fd51&&_0x29fd51[_0xa066('0x44')][0x0]['code']==='SUCCESS'){var _0xafed23=_0x29fd51['data'][0x0]['details'];_0xafed23[_0xa066('0x3d')]=_['startCase'](_0x54843f[_0xa066('0x41')])+'s';return _0xafed23;}logger[_0xa066('0x2b')](_0xa066('0x3b'),JSON[_0xa066('0xe')](data));throw new Error(_0xa066('0x45')+JSON['stringify'](data));})[_0xa066('0x2a')](function(_0x2f08a5){console[_0xa066('0x46')](_0xa066('0x47'),_0x2f08a5);});}function getEndUser(_0x56c8f5,_0x355124,_0x3bbd5e,_0x5f12e3,_0x13ac67,_0x49222f,_0x3ada57){var _0x384aef={'method':_0xa066('0x48'),'uri':'','headers':{'Authorization':_0xa066('0x32')+_0x56c8f5},'json':!![]};switch(_0x3ada57[_0xa066('0x49')]){case _0xa066('0x4a'):_0x384aef[_0xa066('0x4b')]=_0xa066('0x3e')+_0x355124+_0xa066('0x4c')+_0x13ac67+'))';return getZohoUser(_0x384aef,_0xa066('0x4d'))[_0xa066('0x27')](function(_0x52bf63){if(_0x52bf63)return _0x52bf63;_0x384aef[_0xa066('0x4b')]=_0xa066('0x3e')+_0x355124+_0xa066('0x4e')+_0x13ac67+'))';return getZohoUser(_0x384aef,_0xa066('0x4f'))[_0xa066('0x27')](function(_0x576c7a){if(_0x576c7a)return _0x576c7a;if(_0x3ada57[_0xa066('0x41')]!=_0xa066('0x50')){return createEndUser(_0x56c8f5,_0x355124,_0x5f12e3,_0x13ac67,_0x49222f,_0x3ada57);}else{return{};}});});break;case _0xa066('0x51'):_0x384aef[_0xa066('0x4b')]=_0xa066('0x3e')+_0x355124+_0xa066('0x4c')+_0x13ac67+'))';return getZohoUser(_0x384aef,_0xa066('0x4d'))[_0xa066('0x27')](function(_0x512661){if(_0x512661)return _0x512661;if(_0x3ada57['moduleCreate']!='nothing'){return createEndUser(_0x56c8f5,_0x355124,_0x5f12e3,_0x13ac67,_0x49222f,_0x3ada57);}else{return{};}});break;case _0xa066('0x52'):_0x384aef[_0xa066('0x4b')]=_0xa066('0x3e')+_0x355124+_0xa066('0x4e')+_0x13ac67+'))';return getZohoUser(_0x384aef,'Leads')['then'](function(_0x3b1567){if(_0x3b1567)return _0x3b1567;if(_0x3ada57[_0xa066('0x41')]!=_0xa066('0x50')){return createEndUser(_0x56c8f5,_0x355124,_0x5f12e3,_0x13ac67,_0x49222f,_0x3ada57);}else{return{};}});break;}}function getCall(_0x53a9fd,_0x7ea0e5,_0x1eec05,_0x588ffd,_0x4b74e8,_0x553607,_0x471bf9,_0x3facd6){logger[_0xa066('0x2e')](_0xa066('0x53'));var _0x440f7e={};_0x440f7e[_0xa066('0x54')]={'name':!_['isNil'](_0x588ffd[_0xa066('0x42')][_0xa066('0x19')])&&!_['isNil'](_0x588ffd[_0xa066('0x38')][_0xa066('0x19')])&&_0x588ffd[_0xa066('0x38')]['name']==='administrator'?_0x588ffd['role'][_0xa066('0x19')]:!_[_0xa066('0x1c')](_0x588ffd[_0xa066('0x43')])?_0x588ffd['first_name']+'\x20'+_0x588ffd[_0xa066('0x55')]:_0x588ffd[_0xa066('0x55')],'id':_0x588ffd['id']};_0x440f7e[_0xa066('0x56')]=intUtil[_0xa066('0x57')](_0x553607[_0xa066('0x58')],_0x471bf9,'\x20');_0x440f7e['Description']=intUtil[_0xa066('0x57')](_0x553607['Descriptions'],_0x471bf9,'\x0a');if(_0x4b74e8[_0xa066('0x3d')]===_0xa066('0x4d')){_0x440f7e[_0xa066('0x59')]={'name':!_[_0xa066('0x1c')](_0x4b74e8['Full_Name'])?_0x4b74e8[_0xa066('0x5a')]:!_[_0xa066('0x1c')](_0x4b74e8[_0xa066('0x5b')])?_0x4b74e8[_0xa066('0x5b')]+'\x20'+_0x4b74e8['Last_Name']:_0x4b74e8[_0xa066('0x5c')],'id':_0x4b74e8['id']};}if(_0x4b74e8[_0xa066('0x3d')]===_0xa066('0x4f')){_0x440f7e[_0xa066('0x5d')]={'name':!_[_0xa066('0x1c')](_0x4b74e8[_0xa066('0x5a')])?_0x4b74e8[_0xa066('0x5a')]:!_['isNil'](_0x4b74e8[_0xa066('0x5b')])?_0x4b74e8[_0xa066('0x5b')]+'\x20'+_0x4b74e8[_0xa066('0x5c')]:_0x4b74e8['Last_Name'],'id':_0x4b74e8['id']};_0x440f7e[_0xa066('0x5e')]=_[_0xa066('0x40')](_0x4b74e8['enduserType']);}if(_0x471bf9['talktime']){_0x440f7e['Call_Duration']=moment['utc'](parseInt(_0x471bf9['talktime'])*0x3e8)[_0xa066('0x5f')](_0xa066('0x60'));}else if(_0x471bf9[_0xa066('0x61')]&&_0x471bf9[_0xa066('0x62')]){_0x440f7e['Call_Duration']=moment[_0xa066('0x63')](moment(_0x471bf9[_0xa066('0x62')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x471bf9[_0xa066('0x64')],_0xa066('0x65'))))['format'](_0xa066('0x60'));}switch(_0x471bf9['lastevent']){case _0xa066('0x66'):_0x440f7e[_0xa066('0x67')]=_0xa066('0x68');break;case _0xa066('0x69'):case _0xa066('0x6a'):_0x440f7e[_0xa066('0x67')]=_0xa066('0x6b');break;case _0xa066('0x6c'):_0x440f7e['Call_Result']='Rejected';break;case'abandoned':_0x440f7e[_0xa066('0x67')]='Abandoned';break;case _0xa066('0x6d'):_0x440f7e[_0xa066('0x67')]='Timeout';default:}_0x440f7e[_0xa066('0x6e')]=(_0x3facd6===_0xa066('0x6f')?moment(_0x471bf9['starttime'])['format'](_0xa066('0x65')):moment(_0x471bf9[_0xa066('0x70')])[_0xa066('0x5f')](_0xa066('0x65')))||moment()['format'](_0xa066('0x65'));_0x440f7e['Call_Type']=_0x3facd6||_0xa066('0x71');_0x440f7e=_[_0xa066('0x72')](_0x440f7e,getCustomFields(_0x553607[_0xa066('0x73')],_0x471bf9));return request({'method':'POST','uri':_0xa066('0x3e')+_0x7ea0e5+'/crm/v2/Calls','headers':{'Authorization':_0xa066('0x32')+_0x53a9fd},'body':{'data':[_0x440f7e]},'json':!![]})[_0xa066('0x27')](function(_0x169e9a){if(_0x169e9a&&_0x169e9a['data'][0x0]['code']==='SUCCESS'){logger[_0xa066('0x2e')](_0xa066('0x74'));return{'id':_0x169e9a[_0xa066('0x44')][0x0]['details']['id']};}})[_0xa066('0x2a')](function(_0x405688){logger[_0xa066('0x2e')]('err',_0x405688[_0xa066('0x2d')]);console[_0xa066('0x46')](_0xa066('0x75'),_0x405688);});}exports[_0xa066('0x76')]=function(_0x38fea8,_0x831ffa,_0x4b53ee,_0x46575d,_0x546646,_0x441a82){var _0x3fe2c6,_0x27b7b1,_0x120499;_0x441a82[_0xa066('0x77')]=intUtil[_0xa066('0x78')](_0x441a82[_0xa066('0x77')]);_0x441a82[_0xa066('0x79')]=intUtil[_0xa066('0x78')](_0x441a82[_0xa066('0x79')]);if(_0x546646&&_0x546646[_0xa066('0x7a')]){logger[_0xa066('0x2e')](_0xa066('0x7b'),_0xa066('0x7c'));_0x831ffa[_0xa066('0x7d')]=_0x441a82[_0xa066('0x79')]+_0xa066('0x7e')+_0x831ffa[_0xa066('0x7f')]+_0xa066('0x80')+md5(_0x831ffa[_0xa066('0x7f')]);}else{_0x831ffa[_0xa066('0x7d')]='';}var _0xa16716=_0x441a82[_0xa066('0x77')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x441a82)[_0xa066('0x27')](function(_0x272267){_0x120499=_0x272267;return getUser(_0x120499,_0xa16716,_0x441a82,_0x46575d['email']);})[_0xa066('0x27')](function(_0x117f23){_0x3fe2c6=_0x117f23;logger[_0xa066('0x2e')](_0xa066('0x81'),_0x3fe2c6['id']);return getEndUser(_0x120499,_0xa16716,_0x441a82,_0x831ffa[_0xa066('0x82')],_0x831ffa[_0xa066('0x83')],_0x3fe2c6,_0x4b53ee);})['then'](function(_0x178cbd){_0x27b7b1=_0x178cbd;return getCall(_0x120499,_0xa16716,_0x441a82,_0x3fe2c6,_0x27b7b1,_0x4b53ee,_0x831ffa,_0xa066('0x71'));})[_0xa066('0x27')](function(_0x4390e6){if(_0x4390e6){logger['info'](_0xa066('0x84'),_0x4390e6['id']);logger['info']('[QUEUE]',_0xa066('0x85'));emit(util[_0xa066('0x5f')](_0xa066('0x86'),_0x46575d[_0xa066('0x19')]),_0xa066('0x87'),{'uri':_0xa066('0x88')+_0x441a82['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x4390e6['id']});}})['catch'](function(_0x102a73){logger['error'](_0xa066('0x7b'),JSON['stringify'](_0x102a73));});};exports[_0xa066('0x6f')]=function(_0x7b7009,_0x4e93fe,_0x526db4,_0x1608ba,_0x718ef7,_0x453006,_0x2bfb6f){var _0x1aecf8,_0x1a11e8,_0x2f6b52;_0x453006['host']=intUtil[_0xa066('0x78')](_0x453006[_0xa066('0x77')]);_0x453006[_0xa066('0x79')]=intUtil[_0xa066('0x78')](_0x453006[_0xa066('0x79')]);if(_0x2bfb6f&&_0x2bfb6f['recordingFormat']&&_0x2bfb6f[_0xa066('0x89')]!=='none'){logger[_0xa066('0x2e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4e93fe[_0xa066('0x7d')]=_0x453006[_0xa066('0x79')]+'/api/voice/recordings/'+_0x4e93fe['uniqueid']+_0xa066('0x80')+md5(_0x4e93fe[_0xa066('0x7f')]);}var _0xfc953e=_0x453006['host']===_0xa066('0x8a')?'eu':'com';return getAccessToken(_0x453006)['then'](function(_0x39e6e7){_0x2f6b52=_0x39e6e7;return getUser(_0x2f6b52,_0xfc953e,_0x453006,_0x1608ba[_0xa066('0x35')]);})[_0xa066('0x27')](function(_0x5ec1e2){_0x1aecf8=_0x5ec1e2;logger['info'](_0xa066('0x81'),_0x1aecf8['id']);return getEndUser(_0x2f6b52,_0xfc953e,_0x453006,_0x4e93fe[_0xa066('0x8b')],_0x4e93fe[_0xa066('0x8c')],_0x1aecf8,_0x526db4);})[_0xa066('0x27')](function(_0x26cd2a){_0x1a11e8=_0x26cd2a;return getCall(_0x2f6b52,_0xfc953e,_0x453006,_0x1aecf8,_0x1a11e8,_0x526db4,_0x4e93fe,_0xa066('0x8d'));})['then'](function(_0x2edaf2){if(_0x2edaf2){logger['info']('The\x20Call\x20ID\x20is:',_0x2edaf2['id']);logger[_0xa066('0x2e')](_0xa066('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa066('0x86'),_0x1608ba[_0xa066('0x19')]),'trigger:browser:url',{'uri':_0xa066('0x88')+_0x453006[_0xa066('0x77')]+_0xa066('0x8f')+_0x2edaf2['id']});}})[_0xa066('0x2a')](function(_0x3713f9){logger[_0xa066('0x2b')]('[OUTBOUND]',JSON[_0xa066('0xe')](_0x3713f9));});};exports[_0xa066('0x90')]=function(_0xee84d4,_0x5c5f8a,_0x5011c0,_0x107839,_0x54b538,_0x4e5703){var _0x397e36,_0x12e4bf,_0x35988b;_0x4e5703['host']=intUtil[_0xa066('0x78')](_0x4e5703['host']);_0x4e5703[_0xa066('0x79')]=intUtil[_0xa066('0x78')](_0x4e5703[_0xa066('0x79')]);if(_0x54b538&&_0x54b538[_0xa066('0x7a')]){logger['info']('['+_0x5c5f8a[_0xa066('0x91')][_0xa066('0x92')]()+']',_0xa066('0x7c'));_0x5c5f8a[_0xa066('0x7d')]=_0x4e5703[_0xa066('0x79')]+'/api/voice/recordings/'+_0x5c5f8a[_0xa066('0x7f')]+_0xa066('0x80')+md5(_0x5c5f8a[_0xa066('0x7f')]);}else{_0x5c5f8a[_0xa066('0x7d')]='';}var _0x2e1c36=_0x4e5703[_0xa066('0x77')]===_0xa066('0x8a')?'eu':_0xa066('0x93');return getAccessToken(_0x4e5703)['then'](function(_0x42196f){_0x35988b=_0x42196f;return getUser(_0x35988b,_0x2e1c36,_0x4e5703);})[_0xa066('0x27')](function(_0x452847){_0x397e36=_0x452847;logger[_0xa066('0x2e')](_0xa066('0x81'),_0x397e36['id']);return getEndUser(_0x35988b,_0x2e1c36,_0x4e5703,_0x5c5f8a[_0xa066('0x82')],_0x5c5f8a[_0xa066('0x83')],_0x397e36,_0x5011c0);})[_0xa066('0x27')](function(_0x1b3c31){_0x12e4bf=_0x1b3c31;return getCall(_0x35988b,_0x2e1c36,_0x4e5703,_0x397e36,_0x12e4bf,_0x5011c0,_0x5c5f8a,'Inbound');})[_0xa066('0x27')](function(_0x3ce391){if(_0x3ce391){logger[_0xa066('0x2e')](_0xa066('0x84'),_0x3ce391['id']);}})[_0xa066('0x2a')](function(_0xa091d5){logger['error']('['+_0x5c5f8a[_0xa066('0x91')][_0xa066('0x92')]()+']',JSON['stringify'](_0xa091d5));});}; \ No newline at end of file +var _0x1177=['clientId','clientSecret','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','data','details','startCase','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','utc','talktime','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','Call_Result','Called','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Inbound','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','com','destcalleridname','destcalleridnum','Outbound','toUpperCase','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1177,0x10b));var _0x7117=function(_0xe361e5,_0x217188){_0xe361e5=_0xe361e5-0x0;var _0x42a262=_0x1177[_0xe361e5];return _0x42a262;};'use strict';var _=require('lodash');var rp=require(_0x7117('0x0'));var md5=require(_0x7117('0x1'));var util=require(_0x7117('0x2'));var intUtil=require('./util');var moment=require(_0x7117('0x3'));var Redis=require(_0x7117('0x4'));var BPromise=require(_0x7117('0x5'));var config=require(_0x7117('0x6'));var logger=require('../../../../config/logger')(_0x7117('0x7'));config['redis']=_['defaults'](config[_0x7117('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7117('0x9'))(new Redis(config[_0x7117('0x8')]));function emit(_0x52dd5e,_0x4f945c,_0x22f1e7){io['to'](_0x52dd5e)[_0x7117('0xa')](_0x4f945c,_0x22f1e7);}function request(_0x58ccc4){logger[_0x7117('0xb')](_0x7117('0xc'),JSON[_0x7117('0xd')](_0x58ccc4));return rp(_0x58ccc4);}function getCustomFields(_0x397d29,_0x2e85f2){var _0x379e2a={};if(_0x397d29[_0x7117('0xe')]>0x0){_[_0x7117('0xf')](_0x397d29,function(_0x39135d){if(_[_0x7117('0x10')]([_0x7117('0x11'),_0x7117('0x12')],_0x39135d[_0x7117('0x13')])&&_0x39135d['idField']){_0x379e2a[_0x39135d[_0x7117('0x14')]]=_0x39135d[_0x7117('0x15')][_0x7117('0x16')]();}else if(_0x39135d[_0x7117('0x13')]===_0x7117('0x17')&&_0x39135d[_0x7117('0x18')]&&_0x39135d[_0x7117('0x14')]&&_0x2e85f2[_0x39135d['variableName']]){_0x379e2a[_0x39135d['idField']]=_0x2e85f2[_0x39135d[_0x7117('0x18')]][_0x7117('0x16')]();}else if(_0x39135d['type']===_0x7117('0x19')&&_0x39135d[_0x7117('0x1a')]&&_0x39135d[_0x7117('0x1a')][_0x7117('0x1b')]&&_0x39135d[_0x7117('0x14')]&&_0x2e85f2[_0x39135d[_0x7117('0x1a')]['name'][_0x7117('0x1c')]()]){_0x379e2a[_0x39135d[_0x7117('0x14')]]=_0x2e85f2[_0x39135d[_0x7117('0x1a')][_0x7117('0x1b')][_0x7117('0x1c')]()][_0x7117('0x16')]();}});}return _0x379e2a;}function getName(_0x47a350){if(_0x47a350[_0x7117('0x1d')]('\x20')>0x0){var _0x175fce=_0x47a350[_0x7117('0x1e')](/ (.+)/);if(_0x175fce[0x1]){return _0x175fce;}}return[_0x47a350,_0x47a350];}var accountsTokens={};function getAccessToken(_0x36ef6d){return new Promise(function(_0x5a79e2,_0x336076){if(!_[_0x7117('0x1f')](accountsTokens[_0x36ef6d['id']])&&!_[_0x7117('0x1f')](accountsTokens[_0x36ef6d['id']][_0x7117('0x20')])){if(moment()['isBefore'](accountsTokens[_0x36ef6d['id']][_0x7117('0x21')])){_0x5a79e2(accountsTokens[_0x36ef6d['id']]['access_token']);}}var _0x43419;switch(_0x36ef6d['zone']){case'US':_0x43419=_0x7117('0x22');break;case'AU':_0x43419=_0x7117('0x23');break;case'EU':_0x43419=_0x7117('0x24');break;case'IN':_0x43419=_0x7117('0x25');break;case'CN':_0x43419=_0x7117('0x26');break;default:_0x43419='https://accounts.zoho.eu';break;}var _0x1ad5ef={'method':'POST','uri':_0x43419+_0x7117('0x27'),'qs':{'refresh_token':_0x36ef6d[_0x7117('0x28')],'client_id':_0x36ef6d[_0x7117('0x29')],'client_secret':_0x36ef6d[_0x7117('0x2a')],'grant_type':_0x7117('0x2b')},'json':!![]};return rp(_0x1ad5ef)[_0x7117('0x2c')](function(_0x36b7e2){accountsTokens[_0x36ef6d['id']]={'access_token':_0x36b7e2['access_token'],'expires_in':moment()[_0x7117('0x2d')](_0x36b7e2['expires_in'],'seconds')};_0x5a79e2(_0x36b7e2[_0x7117('0x20')]);})[_0x7117('0x2e')](function(_0x6bb077){logger[_0x7117('0x2f')](_0x7117('0x30'),_0x6bb077[_0x7117('0x31')]);_0x336076(_0x6bb077);});});}function getUser(_0x4413d8,_0x47bcf5,_0x3d7ca5,_0x496b22){logger[_0x7117('0x32')](_0x7117('0x33'));return request({'method':'GET','uri':util[_0x7117('0x34')](_0x7117('0x35'),_0x47bcf5),'qs':{'type':_0x7117('0x36')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4413d8},'json':!![]})[_0x7117('0x2c')](function(_0x5e7172){if(_0x5e7172[_0x7117('0x37')]){var _0x90de33=-0x1;if(_[_0x7117('0x38')](_0x5e7172[_0x7117('0x37')])){if(!_[_0x7117('0x1f')](_0x496b22)){_0x90de33=_[_0x7117('0x39')](_0x5e7172[_0x7117('0x37')],function(_0x330555){return _0x330555['email']===_0x496b22;});}if(_0x90de33>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x7117('0x32')]('Using\x20the\x20admin\x20account!');_0x90de33=_['findIndex'](_0x5e7172['users'],function(_0x2d8b63){return _0x2d8b63[_0x7117('0x3a')][_0x7117('0x1b')]===_0x7117('0x3b');});}return _0x5e7172[_0x7117('0x37')][_0x90de33];}else{if(_0x5e7172['user'][_0x7117('0x3a')]['name']===_0x7117('0x3b')){logger[_0x7117('0x32')](_0x7117('0x3c'));user=_0x5e7172[_0x7117('0x3d')];return user;}else{logger[_0x7117('0x2f')](_0x7117('0x3e'),JSON[_0x7117('0xd')](_0x5e7172));throw new Error(_0x7117('0x3f')+JSON[_0x7117('0xd')](_0x5e7172));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x5e7172));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7117('0xd')](_0x5e7172));}})[_0x7117('0x2e')](function(_0xdb1e02){console['error'](_0xdb1e02);});}function getZohoUser(_0x493cd1,_0x10eff0){return new BPromise(function(_0x17dc00,_0xe88aab){request(_0x493cd1)[_0x7117('0x2c')](function(_0x20e1b1){var _0x354190=null;if(_0x20e1b1){_0x354190=_0x20e1b1['data'][0x0];_0x354190[_0x7117('0x40')]=_0x10eff0;}_0x17dc00(_0x354190);})[_0x7117('0x2e')](function(_0x512785){_0xe88aab(_0x512785);});});}function createEndUser(_0x89e5da,_0x48e6ec,_0x346c3f,_0x3e4419,_0x594b16,_0x32085f){var _0x346c3f=getName(_0x346c3f);return request({'method':_0x7117('0x41'),'uri':_0x7117('0x42')+_0x48e6ec+'/crm/v2/'+_['startCase'](_0x32085f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x346c3f[0x1],'First_Name':_0x346c3f[0x0],'Phone':_0x3e4419,'Owner':{'name':!_['isNil'](_0x594b16[_0x7117('0x43')][_0x7117('0x1b')])?_0x594b16['role'][_0x7117('0x1b')]:!_[_0x7117('0x1f')](_0x594b16[_0x7117('0x44')])?_0x594b16[_0x7117('0x44')]+'\x20'+_0x594b16[_0x7117('0x45')]:_0x594b16[_0x7117('0x45')],'id':_0x594b16['id']}}]},'headers':{'Authorization':_0x7117('0x46')+_0x89e5da},'json':!![]})[_0x7117('0x2c')](function(_0x4e47b8){if(_0x4e47b8&&_0x4e47b8['data'][0x0]['code']===_0x7117('0x47')){var _0x4cf5ad=_0x4e47b8[_0x7117('0x48')][0x0][_0x7117('0x49')];_0x4cf5ad[_0x7117('0x40')]=_[_0x7117('0x4a')](_0x32085f[_0x7117('0x4b')])+'s';return _0x4cf5ad;}logger[_0x7117('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x7117('0xd')](data));throw new Error(_0x7117('0x4c')+JSON[_0x7117('0xd')](data));})['catch'](function(_0x384023){console[_0x7117('0x4d')]('CREATE\x20ERROR',_0x384023);});}function getEndUser(_0xf89e5,_0x46ebe0,_0x5bc593,_0x25ac06,_0x13e8d3,_0x323cf3,_0x15c7a5){var _0x541dc5={'method':'GET','uri':'','headers':{'Authorization':_0x7117('0x46')+_0xf89e5},'json':!![]};switch(_0x15c7a5[_0x7117('0x4e')]){case _0x7117('0x4f'):_0x541dc5[_0x7117('0x50')]=_0x7117('0x42')+_0x46ebe0+_0x7117('0x51')+_0x13e8d3+'))';return getZohoUser(_0x541dc5,_0x7117('0x52'))[_0x7117('0x2c')](function(_0x1138e5){if(_0x1138e5)return _0x1138e5;_0x541dc5[_0x7117('0x50')]=_0x7117('0x42')+_0x46ebe0+_0x7117('0x53')+_0x13e8d3+'))';return getZohoUser(_0x541dc5,_0x7117('0x54'))[_0x7117('0x2c')](function(_0x2b376a){if(_0x2b376a)return _0x2b376a;if(_0x15c7a5[_0x7117('0x4b')]!=_0x7117('0x55')){return createEndUser(_0xf89e5,_0x46ebe0,_0x25ac06,_0x13e8d3,_0x323cf3,_0x15c7a5);}else{return{};}});});break;case _0x7117('0x56'):_0x541dc5[_0x7117('0x50')]=_0x7117('0x42')+_0x46ebe0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x13e8d3+'))';return getZohoUser(_0x541dc5,_0x7117('0x52'))['then'](function(_0x4cde20){if(_0x4cde20)return _0x4cde20;if(_0x15c7a5[_0x7117('0x4b')]!=_0x7117('0x55')){return createEndUser(_0xf89e5,_0x46ebe0,_0x25ac06,_0x13e8d3,_0x323cf3,_0x15c7a5);}else{return{};}});break;case _0x7117('0x57'):_0x541dc5[_0x7117('0x50')]=_0x7117('0x42')+_0x46ebe0+_0x7117('0x53')+_0x13e8d3+'))';return getZohoUser(_0x541dc5,_0x7117('0x54'))[_0x7117('0x2c')](function(_0x3e61a8){if(_0x3e61a8)return _0x3e61a8;if(_0x15c7a5[_0x7117('0x4b')]!=_0x7117('0x55')){return createEndUser(_0xf89e5,_0x46ebe0,_0x25ac06,_0x13e8d3,_0x323cf3,_0x15c7a5);}else{return{};}});break;}}function getCall(_0x3a8126,_0x46d60a,_0x3698f5,_0x5b5432,_0x26ac54,_0x42bf41,_0x373c0c,_0x88e240){logger[_0x7117('0x32')](_0x7117('0x58'));var _0x1b85f2={};_0x1b85f2[_0x7117('0x59')]={'name':!_[_0x7117('0x1f')](_0x5b5432[_0x7117('0x43')][_0x7117('0x1b')])&&!_[_0x7117('0x1f')](_0x5b5432[_0x7117('0x3a')][_0x7117('0x1b')])&&_0x5b5432[_0x7117('0x3a')]['name']===_0x7117('0x5a')?_0x5b5432[_0x7117('0x43')][_0x7117('0x1b')]:!_[_0x7117('0x1f')](_0x5b5432['first_name'])?_0x5b5432[_0x7117('0x44')]+'\x20'+_0x5b5432[_0x7117('0x45')]:_0x5b5432[_0x7117('0x45')],'id':_0x5b5432['id']};_0x1b85f2[_0x7117('0x5b')]=intUtil[_0x7117('0x5c')](_0x42bf41[_0x7117('0x5d')],_0x373c0c,'\x20');_0x1b85f2[_0x7117('0x5e')]=intUtil[_0x7117('0x5c')](_0x42bf41[_0x7117('0x5f')],_0x373c0c,'\x0a');if(_0x26ac54[_0x7117('0x40')]===_0x7117('0x52')){_0x1b85f2[_0x7117('0x60')]={'name':!_[_0x7117('0x1f')](_0x26ac54['Full_Name'])?_0x26ac54[_0x7117('0x61')]:!_[_0x7117('0x1f')](_0x26ac54['First_Name'])?_0x26ac54[_0x7117('0x62')]+'\x20'+_0x26ac54[_0x7117('0x63')]:_0x26ac54['Last_Name'],'id':_0x26ac54['id']};}if(_0x26ac54[_0x7117('0x40')]===_0x7117('0x54')){_0x1b85f2['What_Id']={'name':!_[_0x7117('0x1f')](_0x26ac54[_0x7117('0x61')])?_0x26ac54['Full_Name']:!_[_0x7117('0x1f')](_0x26ac54[_0x7117('0x62')])?_0x26ac54[_0x7117('0x62')]+'\x20'+_0x26ac54[_0x7117('0x63')]:_0x26ac54[_0x7117('0x63')],'id':_0x26ac54['id']};_0x1b85f2['$se_module']=_[_0x7117('0x4a')](_0x26ac54[_0x7117('0x40')]);}if(_0x373c0c['talktime']){_0x1b85f2[_0x7117('0x64')]=moment[_0x7117('0x65')](parseInt(_0x373c0c[_0x7117('0x66')])*0x3e8)[_0x7117('0x34')]('mm:ss');}else if(_0x373c0c[_0x7117('0x67')]&&_0x373c0c[_0x7117('0x68')]){_0x1b85f2['Call_Duration']=moment[_0x7117('0x65')](moment(_0x373c0c[_0x7117('0x68')],_0x7117('0x69'))[_0x7117('0x6a')](moment(_0x373c0c['starttime'],_0x7117('0x69'))))[_0x7117('0x34')](_0x7117('0x6b'));}switch(_0x373c0c[_0x7117('0x6c')]){case'called':_0x1b85f2[_0x7117('0x6d')]=_0x7117('0x6e');break;case'complete':case'connect':_0x1b85f2[_0x7117('0x6d')]='Answered';break;case _0x7117('0x6f'):_0x1b85f2[_0x7117('0x6d')]=_0x7117('0x70');break;case _0x7117('0x71'):_0x1b85f2[_0x7117('0x6d')]=_0x7117('0x72');break;case _0x7117('0x73'):_0x1b85f2[_0x7117('0x6d')]=_0x7117('0x74');default:}_0x1b85f2[_0x7117('0x75')]=(_0x88e240===_0x7117('0x76')?moment(_0x373c0c[_0x7117('0x77')])[_0x7117('0x34')](_0x7117('0x69')):moment(_0x373c0c[_0x7117('0x78')])[_0x7117('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x1b85f2['Call_Type']=_0x88e240||_0x7117('0x79');_0x1b85f2=_['merge'](_0x1b85f2,getCustomFields(_0x42bf41[_0x7117('0x7a')],_0x373c0c));return request({'method':_0x7117('0x41'),'uri':_0x7117('0x42')+_0x46d60a+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3a8126},'body':{'data':[_0x1b85f2]},'json':!![]})[_0x7117('0x2c')](function(_0x596368){if(_0x596368&&_0x596368[_0x7117('0x48')][0x0]['code']===_0x7117('0x47')){logger[_0x7117('0x32')](_0x7117('0x7b'));return{'id':_0x596368[_0x7117('0x48')][0x0][_0x7117('0x49')]['id']};}})['catch'](function(_0xdacc1a){logger[_0x7117('0x32')](_0x7117('0x7c'),_0xdacc1a[_0x7117('0x31')]);console[_0x7117('0x4d')](_0x7117('0x7c'),_0xdacc1a);});}exports[_0x7117('0x7d')]=function(_0x1e15dc,_0x3c9e1c,_0xa26c41,_0x4f5c2d,_0x16ec9e,_0x456562){var _0x21bc32,_0x5b9cd9,_0x3f85ad;_0x456562[_0x7117('0x7e')]=intUtil[_0x7117('0x7f')](_0x456562[_0x7117('0x7e')]);_0x456562[_0x7117('0x80')]=intUtil['stripTrailingSlash'](_0x456562[_0x7117('0x80')]);if(_0x16ec9e&&_0x16ec9e[_0x7117('0x81')]){logger[_0x7117('0x32')](_0x7117('0x82'),'Recording\x20is\x20enabled!');_0x3c9e1c[_0x7117('0x83')]=_0x456562[_0x7117('0x80')]+'/api/voice/recordings/'+_0x3c9e1c[_0x7117('0x84')]+_0x7117('0x85')+md5(_0x3c9e1c[_0x7117('0x84')]);}else{_0x3c9e1c['recordingURL']='';}var _0x28568c=_0x456562['host']===_0x7117('0x86')?'eu':'com';return getAccessToken(_0x456562)[_0x7117('0x2c')](function(_0x1c9fe6){_0x3f85ad=_0x1c9fe6;return getUser(_0x3f85ad,_0x28568c,_0x456562,_0x4f5c2d[_0x7117('0x87')]);})[_0x7117('0x2c')](function(_0x1bc87b){_0x21bc32=_0x1bc87b;logger[_0x7117('0x32')](_0x7117('0x88'),_0x21bc32['id']);return getEndUser(_0x3f85ad,_0x28568c,_0x456562,_0x3c9e1c[_0x7117('0x89')],_0x3c9e1c[_0x7117('0x8a')],_0x21bc32,_0xa26c41);})[_0x7117('0x2c')](function(_0x4ecd7b){_0x5b9cd9=_0x4ecd7b;return getCall(_0x3f85ad,_0x28568c,_0x456562,_0x21bc32,_0x5b9cd9,_0xa26c41,_0x3c9e1c,_0x7117('0x79'));})[_0x7117('0x2c')](function(_0xc992c5){if(_0xc992c5){logger[_0x7117('0x32')](_0x7117('0x8b'),_0xc992c5['id']);logger[_0x7117('0x32')](_0x7117('0x82'),_0x7117('0x8c'));emit(util[_0x7117('0x34')](_0x7117('0x8d'),_0x4f5c2d[_0x7117('0x1b')]),_0x7117('0x8e'),{'uri':_0x7117('0x8f')+_0x456562['host']+_0x7117('0x90')+_0xc992c5['id']});}})['catch'](function(_0x4042e2){logger['error'](_0x7117('0x82'),JSON[_0x7117('0xd')](_0x4042e2));});};exports[_0x7117('0x76')]=function(_0x437078,_0x3e6d61,_0x178f51,_0x18b96d,_0x3b16df,_0x164f14,_0x53edef){var _0x11d2ab,_0x5d6dd8,_0x5e8146;_0x164f14[_0x7117('0x7e')]=intUtil[_0x7117('0x7f')](_0x164f14[_0x7117('0x7e')]);_0x164f14[_0x7117('0x80')]=intUtil[_0x7117('0x7f')](_0x164f14[_0x7117('0x80')]);if(_0x53edef&&_0x53edef['recordingFormat']&&_0x53edef[_0x7117('0x91')]!=='none'){logger['info'](_0x7117('0x92'),_0x7117('0x93'));_0x3e6d61[_0x7117('0x83')]=_0x164f14[_0x7117('0x80')]+_0x7117('0x94')+_0x3e6d61[_0x7117('0x84')]+_0x7117('0x85')+md5(_0x3e6d61[_0x7117('0x84')]);}var _0x4829fe=_0x164f14[_0x7117('0x7e')]===_0x7117('0x86')?'eu':_0x7117('0x95');return getAccessToken(_0x164f14)[_0x7117('0x2c')](function(_0x5e8d94){_0x5e8146=_0x5e8d94;return getUser(_0x5e8146,_0x4829fe,_0x164f14,_0x18b96d[_0x7117('0x87')]);})[_0x7117('0x2c')](function(_0x587664){_0x11d2ab=_0x587664;logger[_0x7117('0x32')](_0x7117('0x88'),_0x11d2ab['id']);return getEndUser(_0x5e8146,_0x4829fe,_0x164f14,_0x3e6d61[_0x7117('0x96')],_0x3e6d61[_0x7117('0x97')],_0x11d2ab,_0x178f51);})[_0x7117('0x2c')](function(_0x1cb7fa){_0x5d6dd8=_0x1cb7fa;return getCall(_0x5e8146,_0x4829fe,_0x164f14,_0x11d2ab,_0x5d6dd8,_0x178f51,_0x3e6d61,_0x7117('0x98'));})[_0x7117('0x2c')](function(_0x410289){if(_0x410289){logger[_0x7117('0x32')](_0x7117('0x8b'),_0x410289['id']);logger[_0x7117('0x32')](_0x7117('0x92'),_0x7117('0x8c'));emit(util[_0x7117('0x34')](_0x7117('0x8d'),_0x18b96d['name']),'trigger:browser:url',{'uri':_0x7117('0x8f')+_0x164f14['host']+_0x7117('0x90')+_0x410289['id']});}})[_0x7117('0x2e')](function(_0x5bc893){logger[_0x7117('0x2f')](_0x7117('0x92'),JSON['stringify'](_0x5bc893));});};exports['unmanaged']=function(_0x5409de,_0x51c0bb,_0x156ec5,_0xc6e4d4,_0x55034d,_0x17b33a){var _0x244eb9,_0xab53cf,_0x4f9959;_0x17b33a['host']=intUtil['stripTrailingSlash'](_0x17b33a[_0x7117('0x7e')]);_0x17b33a[_0x7117('0x80')]=intUtil[_0x7117('0x7f')](_0x17b33a[_0x7117('0x80')]);if(_0x55034d&&_0x55034d[_0x7117('0x81')]){logger[_0x7117('0x32')]('['+_0x51c0bb[_0x7117('0x6c')]['toUpperCase']()+']',_0x7117('0x93'));_0x51c0bb[_0x7117('0x83')]=_0x17b33a[_0x7117('0x80')]+_0x7117('0x94')+_0x51c0bb[_0x7117('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x51c0bb[_0x7117('0x84')]);}else{_0x51c0bb[_0x7117('0x83')]='';}var _0x5d4fcc=_0x17b33a['host']===_0x7117('0x86')?'eu':_0x7117('0x95');return getAccessToken(_0x17b33a)[_0x7117('0x2c')](function(_0x263d60){_0x4f9959=_0x263d60;return getUser(_0x4f9959,_0x5d4fcc,_0x17b33a);})[_0x7117('0x2c')](function(_0x252e5){_0x244eb9=_0x252e5;logger['info'](_0x7117('0x88'),_0x244eb9['id']);return getEndUser(_0x4f9959,_0x5d4fcc,_0x17b33a,_0x51c0bb['calleridname'],_0x51c0bb[_0x7117('0x8a')],_0x244eb9,_0x156ec5);})[_0x7117('0x2c')](function(_0x574603){_0xab53cf=_0x574603;return getCall(_0x4f9959,_0x5d4fcc,_0x17b33a,_0x244eb9,_0xab53cf,_0x156ec5,_0x51c0bb,_0x7117('0x79'));})[_0x7117('0x2c')](function(_0x2afac5){if(_0x2afac5){logger['info'](_0x7117('0x8b'),_0x2afac5['id']);}})[_0x7117('0x2e')](function(_0x1ea114){logger['error']('['+_0x51c0bb['lastevent'][_0x7117('0x99')]()+']',JSON[_0x7117('0xd')](_0x1ea114));});}; \ 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 6832afd..6c39717 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 _0x826d=['shelljs','trigger','data2','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x20b245,_0x3bb6bf){var _0x5414a6=function(_0x453325){while(--_0x453325){_0x20b245['push'](_0x20b245['shift']());}};_0x5414a6(++_0x3bb6bf);}(_0x826d,0x12b));var _0xd826=function(_0x4b6651,_0x40dcb4){_0x4b6651=_0x4b6651-0x0;var _0x5e8c87=_0x826d[_0x4b6651];return _0x5e8c87;};'use strict';var util=require(_0xd826('0x0'));var sh=require(_0xd826('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0xd826('0x2'));exports['exec']=function(_0x53b5a2,_0xd55167){var _0x16e4e2=_0x53b5a2[_0xd826('0x3')]?_0x53b5a2[_0xd826('0x3')]:'Script';var _0x542477=_0x53b5a2[_0xd826('0x4')]?Mustache['render'](_0x53b5a2[_0xd826('0x4')],_0xd55167):_0xd55167;sh[_0xd826('0x5')](_0x542477,function(_0x277350,_0x5e7f73,_0xe738a5){if(_0x277350!==0x0){logger[_0xd826('0x6')](util[_0xd826('0x7')](_0xd826('0x8'),_0x16e4e2,_0x542477,_0x277350,_0xe738a5));}else{logger['info'](util[_0xd826('0x7')](_0xd826('0x9'),_0x16e4e2,_0x542477,_0x5e7f73));}});}; \ No newline at end of file +var _0x64e6=['util','shelljs','mustache','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0x64e6,0x1d4));var _0x664e=function(_0x5cd363,_0x1c168c){_0x5cd363=_0x5cd363-0x0;var _0x31fb2b=_0x64e6[_0x5cd363];return _0x31fb2b;};'use strict';var util=require(_0x664e('0x0'));var sh=require(_0x664e('0x1'));var Mustache=require(_0x664e('0x2'));var logger=require('../../../../config/logger')(_0x664e('0x3'));exports[_0x664e('0x4')]=function(_0x122d2e,_0x2b0279){var _0x3de360=_0x122d2e[_0x664e('0x5')]?_0x122d2e[_0x664e('0x5')]:'Script';var _0x1170ad=_0x122d2e[_0x664e('0x6')]?Mustache[_0x664e('0x7')](_0x122d2e['data3'],_0x2b0279):_0x2b0279;sh['exec'](_0x1170ad,function(_0x1b747b,_0x5e99fd,_0xeadada){if(_0x1b747b!==0x0){logger[_0x664e('0x8')](util[_0x664e('0x9')](_0x664e('0xa'),_0x3de360,_0x1170ad,_0x1b747b,_0xeadada));}else{logger[_0x664e('0xb')](util[_0x664e('0x9')](_0x664e('0xc'),_0x3de360,_0x1170ad,_0x5e99fd));}});}; \ 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 5ede682..2fd03b9 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 _0xcd18=['object','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','trigger','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','data1','POST','PUT','data7','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20'];(function(_0x51fe86,_0x422b66){var _0x3557d4=function(_0x524a6a){while(--_0x524a6a){_0x51fe86['push'](_0x51fe86['shift']());}};_0x3557d4(++_0x422b66);}(_0xcd18,0x198));var _0x8cd1=function(_0x407fb2,_0x4b6813){_0x407fb2=_0x407fb2-0x0;var _0xfde875=_0xcd18[_0x407fb2];return _0xfde875;};'use strict';var rp=require(_0x8cd1('0x0'));var util=require(_0x8cd1('0x1'));var _=require(_0x8cd1('0x2'));var Mustache=require(_0x8cd1('0x3'));var logger=require('../../../../config/logger')(_0x8cd1('0x4'));exports['exec']=function(_0x3616b6,_0x32519c){var _0x24d136,_0x4c88cf;var _0x9ac915={'method':_0x3616b6['data1'][_0x8cd1('0x5')](),'uri':Mustache[_0x8cd1('0x6')](_0x3616b6[_0x8cd1('0x7')],_0x32519c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3616b6[_0x8cd1('0x8')])===_0x8cd1('0x9')&&parseInt(_0x3616b6[_0x8cd1('0x8')])>=0x1&&parseInt(_0x3616b6[_0x8cd1('0x8')])<=0xa?parseInt(_0x3616b6['data5'])*0x3e8:0x5*0x3e8};try{_0x9ac915[_0x8cd1('0xa')]=_0x3616b6['data6']?JSON[_0x8cd1('0xb')](Mustache['render'](_0x3616b6[_0x8cd1('0xc')],_0x32519c)):{};}catch(_0x1848f4){logger[_0x8cd1('0xd')](_0x1848f4[_0x8cd1('0xe')]);}switch(_0x3616b6[_0x8cd1('0xf')][_0x8cd1('0x5')]()){case'GET':case'DELETE':_0x24d136=null;_0x9ac915['qs']=_0x32519c;break;case _0x8cd1('0x10'):case _0x8cd1('0x11'):if(_0x3616b6[_0x8cd1('0x12')]){try{_0x24d136=JSON[_0x8cd1('0xb')](Mustache[_0x8cd1('0x6')](_0x3616b6[_0x8cd1('0x12')],_0x32519c));_0x9ac915[_0x8cd1('0x13')]=_0x24d136;}catch(_0x44eb37){logger['error'](_0x44eb37['stack']);logger[_0x8cd1('0xd')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x24d136=_0x32519c;_0x9ac915[_0x8cd1('0x13')]=_0x24d136;}break;}logger[_0x8cd1('0x14')](util[_0x8cd1('0x15')](_0x8cd1('0x16'),_0x3616b6[_0x8cd1('0xf')],_0x3616b6[_0x8cd1('0x7')],JSON[_0x8cd1('0x17')](_0x9ac915)));rp(_0x9ac915)[_0x8cd1('0x18')](function(_0x362a7b){_0x24d136=!_['isNil'](_0x24d136)?_0x8cd1('0x19')+_0x24d136:'';_0x4c88cf=typeof _0x362a7b[_0x8cd1('0x13')]===_0x8cd1('0x1a')?JSON[_0x8cd1('0x17')](_0x362a7b['body']):_0x362a7b[_0x8cd1('0x13')];logger['info'](util[_0x8cd1('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3616b6[_0x8cd1('0xf')],_0x3616b6[_0x8cd1('0x7')],_0x362a7b['statusCode'],_0x4c88cf));})['catch'](function(_0x2caacf){logger[_0x8cd1('0xd')](util[_0x8cd1('0x15')](_0x8cd1('0x1b'),_0x3616b6[_0x8cd1('0xf')],_0x3616b6['data2'],_0x2caacf[_0x8cd1('0x1c')],_0x2caacf[_0x8cd1('0x1d')],_0x2caacf[_0x8cd1('0x1e')]));});}; \ No newline at end of file +var _0x75c8=['DELETE','PUT','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','trigger','data1','toUpperCase','render','data2','data5','headers','data6','error','stack','GET'];(function(_0x55bf15,_0x4f3291){var _0x39c1c9=function(_0x14cb69){while(--_0x14cb69){_0x55bf15['push'](_0x55bf15['shift']());}};_0x39c1c9(++_0x4f3291);}(_0x75c8,0x7a));var _0x875c=function(_0x52b9a2,_0x4e8ea1){_0x52b9a2=_0x52b9a2-0x0;var _0xdce3cf=_0x75c8[_0x52b9a2];return _0xdce3cf;};'use strict';var rp=require(_0x875c('0x0'));var util=require('util');var _=require(_0x875c('0x1'));var Mustache=require(_0x875c('0x2'));var logger=require('../../../../config/logger')(_0x875c('0x3'));exports['exec']=function(_0x53eba8,_0xc6e3ef){var _0x2b63a4,_0x516a41;var _0x49f523={'method':_0x53eba8[_0x875c('0x4')][_0x875c('0x5')](),'uri':Mustache[_0x875c('0x6')](_0x53eba8[_0x875c('0x7')],_0xc6e3ef),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x53eba8[_0x875c('0x8')])==='number'&&parseInt(_0x53eba8[_0x875c('0x8')])>=0x1&&parseInt(_0x53eba8[_0x875c('0x8')])<=0xa?parseInt(_0x53eba8['data5'])*0x3e8:0x5*0x3e8};try{_0x49f523[_0x875c('0x9')]=_0x53eba8[_0x875c('0xa')]?JSON['parse'](Mustache['render'](_0x53eba8[_0x875c('0xa')],_0xc6e3ef)):{};}catch(_0x4dae6d){logger[_0x875c('0xb')](_0x4dae6d[_0x875c('0xc')]);}switch(_0x53eba8[_0x875c('0x4')][_0x875c('0x5')]()){case _0x875c('0xd'):case _0x875c('0xe'):_0x2b63a4=null;_0x49f523['qs']=_0xc6e3ef;break;case'POST':case _0x875c('0xf'):if(_0x53eba8[_0x875c('0x10')]){try{_0x2b63a4=JSON[_0x875c('0x11')](Mustache[_0x875c('0x6')](_0x53eba8['data7'],_0xc6e3ef));_0x49f523[_0x875c('0x12')]=_0x2b63a4;}catch(_0x2d3f78){logger[_0x875c('0xb')](_0x2d3f78['stack']);logger[_0x875c('0xb')](_0x875c('0x13'));}}else{_0x2b63a4=_0xc6e3ef;_0x49f523[_0x875c('0x12')]=_0x2b63a4;}break;}logger[_0x875c('0x14')](util[_0x875c('0x15')](_0x875c('0x16'),_0x53eba8[_0x875c('0x4')],_0x53eba8['data2'],JSON[_0x875c('0x17')](_0x49f523)));rp(_0x49f523)[_0x875c('0x18')](function(_0x4722b5){_0x2b63a4=!_[_0x875c('0x19')](_0x2b63a4)?_0x875c('0x1a')+_0x2b63a4:'';_0x516a41=typeof _0x4722b5[_0x875c('0x12')]===_0x875c('0x1b')?JSON[_0x875c('0x17')](_0x4722b5[_0x875c('0x12')]):_0x4722b5['body'];logger[_0x875c('0x14')](util[_0x875c('0x15')](_0x875c('0x1c'),_0x53eba8[_0x875c('0x4')],_0x53eba8['data2'],_0x4722b5[_0x875c('0x1d')],_0x516a41));})[_0x875c('0x1e')](function(_0x363662){logger['error'](util[_0x875c('0x15')](_0x875c('0x1f'),_0x53eba8['data1'],_0x53eba8[_0x875c('0x7')],_0x363662['statusCode'],_0x363662[_0x875c('0x20')],_0x363662[_0x875c('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4bffe4c..5d2e283 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 _0xc21a=['message','result','catch','exports','bluebird','../../config/logger','http','Request','request','then','debug','rpc','routing','error'];(function(_0x2554b6,_0x22e703){var _0x4b23b9=function(_0x1b025c){while(--_0x1b025c){_0x2554b6['push'](_0x2554b6['shift']());}};_0x4b23b9(++_0x22e703);}(_0xc21a,0x90));var _0xac21=function(_0x184619,_0x5bdcda){_0x184619=_0x184619-0x0;var _0x3e182f=_0xc21a[_0x184619];return _0x3e182f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xac21('0x0'));var logger=require(_0xac21('0x1'))('routing');var client=jayson['client'][_0xac21('0x2')]({'port':0x2329});client[_0xac21('0x3')]=function(_0x1d7fbb,_0x572eee){return new BPromise(function(_0x5f0d31,_0x282f33){return client[_0xac21('0x4')](_0x1d7fbb,_0x572eee)[_0xac21('0x5')](function(_0x374743){logger[_0xac21('0x6')](_0xac21('0x7'),_0xac21('0x8'),_0x1d7fbb,_0x572eee,_0x374743);if(_0x374743[_0xac21('0x9')]){logger[_0xac21('0x9')](_0xac21('0x7'),'routing',_0x1d7fbb,_0x374743['error'][_0xac21('0xa')],_0x572eee);return _0x282f33(_0x374743[_0xac21('0x9')]['message']);}else{return _0x5f0d31(_0x374743[_0xac21('0xb')]);}})[_0xac21('0xc')](function(_0x1626a2){logger[_0xac21('0x9')](_0xac21('0x7'),_0xac21('0x8'),_0x1d7fbb,_0x1626a2,_0x572eee);return _0x282f33(_0x1626a2);});});};module[_0xac21('0xd')]=client; \ No newline at end of file +var _0x195d=['bluebird','routing','http','Request','request','then','debug','error','rpc','result','catch','exports','jayson/promise'];(function(_0x1b6572,_0x343f4d){var _0x325402=function(_0x4de846){while(--_0x4de846){_0x1b6572['push'](_0x1b6572['shift']());}};_0x325402(++_0x343f4d);}(_0x195d,0x16b));var _0xd195=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x195d[_0x5cc8b9];return _0x58892e;};'use strict';var jayson=require(_0xd195('0x0'));var BPromise=require(_0xd195('0x1'));var logger=require('../../config/logger')(_0xd195('0x2'));var client=jayson['client'][_0xd195('0x3')]({'port':0x2329});client[_0xd195('0x4')]=function(_0x3393b6,_0x5ec3b0){return new BPromise(function(_0xf2c03d,_0x4252c3){return client[_0xd195('0x5')](_0x3393b6,_0x5ec3b0)[_0xd195('0x6')](function(_0xd2a60e){logger[_0xd195('0x7')]('rpc',_0xd195('0x2'),_0x3393b6,_0x5ec3b0,_0xd2a60e);if(_0xd2a60e[_0xd195('0x8')]){logger[_0xd195('0x8')](_0xd195('0x9'),_0xd195('0x2'),_0x3393b6,_0xd2a60e[_0xd195('0x8')]['message'],_0x5ec3b0);return _0x4252c3(_0xd2a60e['error']['message']);}else{return _0xf2c03d(_0xd2a60e[_0xd195('0xa')]);}})[_0xd195('0xb')](function(_0xf76636){logger[_0xd195('0x8')](_0xd195('0x9'),'routing',_0x3393b6,_0xf76636,_0x5ec3b0);return _0x4252c3(_0xf76636);});});};module[_0xd195('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d3ba3a2..1c0d51a 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 _0x8899=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','../../config/logger','resolve','getMailAccounts','then','initMailAccounts'];(function(_0x17ebfb,_0x24a2cf){var _0x139ae9=function(_0x43612c){while(--_0x43612c){_0x17ebfb['push'](_0x17ebfb['shift']());}};_0x139ae9(++_0x24a2cf);}(_0x8899,0x7f));var _0x9889=function(_0x18e5ee,_0x69ac87){_0x18e5ee=_0x18e5ee-0x0;var _0x380aa7=_0x8899[_0x18e5ee];return _0x380aa7;};'use strict';var server=require(_0x9889('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x9889('0x1'));var mailAccount=require(_0x9889('0x2'));var setting=require('./rpc/setting');var logger=require(_0x9889('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x9889('0x4')]()['then'](mailAccount[_0x9889('0x5')]())[_0x9889('0x6')](realtime[_0x9889('0x7')]())[_0x9889('0x6')](function(){email[_0x9889('0x8')](realtime[_0x9889('0x9')]);return realtime;});}function main(){return server[_0x9889('0xa')](realtime,email)[_0x9889('0x6')](function(){return initRealtime();})[_0x9889('0x6')](function(){return setting[_0x9889('0xb')]();})[_0x9889('0x6')](function(_0x4dbe9e){return setInterval(initRealtime,_0x4dbe9e[_0x9889('0xc')]*0x3e8);})['catch'](function(_0x206825){logger[_0x9889('0xd')](_0x9889('0xe'),_0x206825);});}main(); \ No newline at end of file +var _0x6f15=['listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','then','initMailAccounts','refresh','mailAccounts'];(function(_0x45830d,_0x8e6ac5){var _0x5a6ba7=function(_0x377c0e){while(--_0x377c0e){_0x45830d['push'](_0x45830d['shift']());}};_0x5a6ba7(++_0x8e6ac5);}(_0x6f15,0x19b));var _0x56f1=function(_0x1b367e,_0x188bb4){_0x1b367e=_0x1b367e-0x0;var _0x28030f=_0x6f15[_0x1b367e];return _0x28030f;};'use strict';var server=require('./server');var Realtime=require(_0x56f1('0x0'));var EmailChannel=require(_0x56f1('0x1'));var mailAccount=require(_0x56f1('0x2'));var setting=require(_0x56f1('0x3'));var logger=require(_0x56f1('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x56f1('0x5')](mailAccount['getMailAccounts']())[_0x56f1('0x5')](realtime[_0x56f1('0x6')]())[_0x56f1('0x5')](function(){email[_0x56f1('0x7')](realtime[_0x56f1('0x8')]);return realtime;});}function main(){return server[_0x56f1('0x9')](realtime,email)[_0x56f1('0x5')](function(){return initRealtime();})[_0x56f1('0x5')](function(){return setting[_0x56f1('0xa')]();})['then'](function(_0x35054a){return setInterval(initRealtime,_0x35054a[_0x56f1('0xb')]*0x3e8);})[_0x56f1('0xc')](function(_0x304a61){logger[_0x56f1('0xd')](_0x56f1('0xe'),_0x304a61);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8edb4f4..ca681ef 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 _0xb0ad=['messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','end','handleImapEnd','handleImapError','disabled','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','lodash','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','Imap','status'];(function(_0x3b2fa0,_0x41ffda){var _0x8dd6a5=function(_0x78ff0f){while(--_0x78ff0f){_0x3b2fa0['push'](_0x3b2fa0['shift']());}};_0x8dd6a5(++_0x41ffda);}(_0xb0ad,0x12b));var _0xdb0a=function(_0x898782,_0x5db1e0){_0x898782=_0x898782-0x0;var _0x2a04ca=_0xb0ad[_0x898782];return _0x2a04ca;};'use strict';var _=require(_0xdb0a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xdb0a('0x1'));var Redis=require(_0xdb0a('0x2'));var config=require(_0xdb0a('0x3'));var logger=require(_0xdb0a('0x4'))(_0xdb0a('0x5'));config[_0xdb0a('0x6')]=_[_0xdb0a('0x7')](config[_0xdb0a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xdb0a('0x8'))(new Redis(config[_0xdb0a('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xdb0a('0x9'));var mailAccount=require(_0xdb0a('0xa'));var md5Accounts={};function EmailChannel(_0x2e3118){logger[_0xdb0a('0xb')]('start\x20email\x20channel');this[_0xdb0a('0xc')]=_0x2e3118[_0xdb0a('0xc')];this[_0xdb0a('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xdb0a('0xe')][_0xdb0a('0xf')]=function(_0x572774){var _0x3ae36c=this[_0xdb0a('0xc')][_0x572774];var _0x3df9f1={'id':_0x3ae36c['id'],'name':_0x3ae36c[_0xdb0a('0x10')],'key':_0x3ae36c['key'],'active':_0x3ae36c['active'],'Imap':{'status':_0x3ae36c[_0xdb0a('0x11')][_0xdb0a('0x12')],'messageStatus':_0x3ae36c[_0xdb0a('0x11')][_0xdb0a('0x13')],'total':_0x3ae36c[_0xdb0a('0x11')][_0xdb0a('0x14')]}};if(_[_0xdb0a('0x15')](md5Accounts[_0x572774])){md5Accounts[_0x572774]={};}var _0x261a09=md5(JSON['stringify'](_0x3df9f1));if(md5Accounts[_0x572774][_0xdb0a('0x1')]!==_0x261a09){md5Accounts[_0x572774][_0xdb0a('0x1')]=_0x261a09;io[_0xdb0a('0xf')](_0xdb0a('0x16'),_0x3df9f1);}};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x17')]=function(_0x51a97c){for(var _0x1824cc in _0x51a97c){if(_0x51a97c[_0xdb0a('0x18')](_0x1824cc)){if(_0x51a97c[_0x1824cc][_0xdb0a('0x11')]&&_0x51a97c[_0x1824cc]['active']){var _0x201385=_0x51a97c[_0x1824cc]['Imap'];if(!_0x201385[_0xdb0a('0x19')]&&_0x51a97c[_0x1824cc][_0xdb0a('0x1a')]!==_0xdb0a('0x1b'))_0x201385['service']=_0x51a97c[_0x1824cc][_0xdb0a('0x1a')];if(!this[_0xdb0a('0xd')]['hasOwnProperty'](_0x201385['id'])){this[_0xdb0a('0xd')][_0x201385['id']]=new EmailImap(_0x201385,_0x51a97c[_0x1824cc][_0xdb0a('0x5')]);this[_0xdb0a('0xd')][_0x201385['id']]['on'](_0xdb0a('0x1c'),this[_0xdb0a('0x1d')][_0xdb0a('0x1e')](this,_0x1824cc));this[_0xdb0a('0xd')][_0x201385['id']]['on']('email',this['handleImapEmail'][_0xdb0a('0x1e')](this,_0x1824cc));this[_0xdb0a('0xd')][_0x201385['id']]['on'](_0xdb0a('0x1f'),this[_0xdb0a('0x20')][_0xdb0a('0x1e')](this,_0x1824cc));this[_0xdb0a('0xd')][_0x201385['id']]['on']('error',this[_0xdb0a('0x21')][_0xdb0a('0x1e')](this,_0x1824cc));}}else{if(_[_0xdb0a('0x15')](this[_0xdb0a('0xc')][_0x1824cc]['Imap'])){this['mailAccounts'][_0x1824cc][_0xdb0a('0x11')]={};}this[_0xdb0a('0xc')][_0x1824cc]['Imap'][_0xdb0a('0x12')]=_0xdb0a('0x22');this[_0xdb0a('0xc')][_0x1824cc][_0xdb0a('0x11')]['messageStatus']='';this['emit'](_0x1824cc);}}}};EmailChannel['prototype'][_0xdb0a('0x1d')]=function(_0x1ddb12,_0x48ebeb){if(this[_0xdb0a('0xc')][_0x1ddb12]){this[_0xdb0a('0xc')][_0x1ddb12][_0xdb0a('0x11')][_0xdb0a('0x12')]='connected';this[_0xdb0a('0xc')][_0x1ddb12][_0xdb0a('0x11')][_0xdb0a('0x13')]=_0x48ebeb[_0xdb0a('0x10')];if(_0x48ebeb['messages']){this[_0xdb0a('0xc')][_0x1ddb12][_0xdb0a('0x11')][_0xdb0a('0x14')]=_0x48ebeb[_0xdb0a('0x23')][_0xdb0a('0x14')];}return this[_0xdb0a('0xf')](_0x1ddb12);}};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x24')]=function(_0x3c1c33,_0x190785){logger[_0xdb0a('0xb')](_0xdb0a('0x25'),_0x190785[_0xdb0a('0x26')],_0x190785['lastName'],_0x190785[_0xdb0a('0x27')],_0x3c1c33);if(this[_0xdb0a('0xc')][_0x3c1c33]){return mailAccount[_0xdb0a('0x28')](_0x3c1c33,_0x190785)[_0xdb0a('0x29')](function(_0x112df8){if(_0x112df8){logger[_0xdb0a('0xb')](_0xdb0a('0x2a'));}})[_0xdb0a('0x2b')](function(_0x807d22){logger[_0xdb0a('0x2c')](_0xdb0a('0x2d'),JSON['stringify'](_0x807d22));});}};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x20')]=function(_0x1c6796){if(this[_0xdb0a('0xc')][_0x1c6796]&&this[_0xdb0a('0xc')][_0x1c6796][_0xdb0a('0x11')]){if(this[_0xdb0a('0xd')][this[_0xdb0a('0xc')][_0x1c6796][_0xdb0a('0x11')]['id']]){delete this[_0xdb0a('0xd')][this['mailAccounts'][_0x1c6796]['Imap']['id']];}this['mailAccounts'][_0x1c6796][_0xdb0a('0x11')]['lastSync']=moment();this[_0xdb0a('0xf')](_0x1c6796);}};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x21')]=function(_0x470d8e,_0x18fbb0){if(this[_0xdb0a('0xc')][_0x470d8e]){this[_0xdb0a('0xc')][_0x470d8e][_0xdb0a('0x11')][_0xdb0a('0x12')]=_0xdb0a('0x2c');this[_0xdb0a('0xc')][_0x470d8e][_0xdb0a('0x11')][_0xdb0a('0x13')]=_0x18fbb0;return this[_0xdb0a('0xf')](_0x470d8e);}};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x2e')]=function(_0x4d58b2,_0x3a5941){return this[_0xdb0a('0x2f')][_0xdb0a('0x30')](_0x4d58b2,_0x3a5941);};EmailChannel[_0xdb0a('0xe')][_0xdb0a('0x31')]=function(_0x28fe6c){var _0x7dcebf=this;if(this['mailAccounts'][_0x28fe6c['id']]){if(_[_0xdb0a('0x15')](this['mailAccounts'][_0x28fe6c['id']][_0xdb0a('0x32')])){this[_0xdb0a('0xc')][_0x28fe6c['id']][_0xdb0a('0x32')]={};}this['mailAccounts'][_0x28fe6c['id']][_0xdb0a('0x32')][_0xdb0a('0x33')]=moment();return new BPromise(function(_0x173591,_0x3a1db8){return _0x7dcebf[_0xdb0a('0x2f')][_0xdb0a('0x34')](_0x28fe6c)['then'](function(_0x3b4a0c){_0x7dcebf[_0xdb0a('0xc')][_0x28fe6c['id']][_0xdb0a('0x32')]['status']='verified';_0x7dcebf[_0xdb0a('0xc')][_0x28fe6c['id']][_0xdb0a('0x32')]['messageStatus']='';_0x7dcebf['emit'](_0x28fe6c['id']);_0x173591(_0x3b4a0c);})[_0xdb0a('0x2b')](function(_0x3f87f7){_0x7dcebf['mailAccounts'][_0x28fe6c['id']][_0xdb0a('0x32')][_0xdb0a('0x12')]=_0xdb0a('0x2c');_0x7dcebf[_0xdb0a('0xc')][_0x28fe6c['id']][_0xdb0a('0x32')]['messageStatus']=_0x3f87f7;_0x7dcebf[_0xdb0a('0xf')](_0x28fe6c['id']);_0x3a1db8(_0x3f87f7);});});}return this[_0xdb0a('0x2f')][_0xdb0a('0x34')](_0x28fe6c);};module['exports']=EmailChannel; \ No newline at end of file +var _0x8cd1=['mailAccounts','imapAccounts','emit','key','active','Imap','status','messageStatus','total','stringify','md5','mailAccount:update','prototype','service','provider','custom','hasOwnProperty','box','handleImapEmail','error','bind','disabled','handleImapBox','connected','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','isNil','Smtp','lastSync','then','verified','catch','verify','exports','moment','bluebird','ioredis','email','redis','defaults','localhost','socket.io-emitter','../rpc/mailAccount','start\x20email\x20channel'];(function(_0x39d306,_0x417c76){var _0x23ea00=function(_0x366c66){while(--_0x366c66){_0x39d306['push'](_0x39d306['shift']());}};_0x23ea00(++_0x417c76);}(_0x8cd1,0x134));var _0x18cd=function(_0x6eef34,_0x45ebcc){_0x6eef34=_0x6eef34-0x0;var _0x1bfade=_0x8cd1[_0x6eef34];return _0x1bfade;};'use strict';var _=require('lodash');var moment=require(_0x18cd('0x0'));var BPromise=require(_0x18cd('0x1'));var md5=require('md5');var Redis=require(_0x18cd('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x18cd('0x3'));config[_0x18cd('0x4')]=_[_0x18cd('0x5')](config[_0x18cd('0x4')],{'host':_0x18cd('0x6'),'port':0x18eb});var io=require(_0x18cd('0x7'))(new Redis(config[_0x18cd('0x4')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x18cd('0x8'));var md5Accounts={};function EmailChannel(_0x1a2e25){logger['info'](_0x18cd('0x9'));this[_0x18cd('0xa')]=_0x1a2e25['mailAccounts'];this[_0x18cd('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x18cd('0xc')]=function(_0x1294eb){var _0x3aa842=this[_0x18cd('0xa')][_0x1294eb];var _0xf7c138={'id':_0x3aa842['id'],'name':_0x3aa842['name'],'key':_0x3aa842[_0x18cd('0xd')],'active':_0x3aa842[_0x18cd('0xe')],'Imap':{'status':_0x3aa842[_0x18cd('0xf')][_0x18cd('0x10')],'messageStatus':_0x3aa842['Imap'][_0x18cd('0x11')],'total':_0x3aa842[_0x18cd('0xf')][_0x18cd('0x12')]}};if(_['isNil'](md5Accounts[_0x1294eb])){md5Accounts[_0x1294eb]={};}var _0x43392c=md5(JSON[_0x18cd('0x13')](_0xf7c138));if(md5Accounts[_0x1294eb][_0x18cd('0x14')]!==_0x43392c){md5Accounts[_0x1294eb]['md5']=_0x43392c;io['emit'](_0x18cd('0x15'),_0xf7c138);}};EmailChannel[_0x18cd('0x16')]['refresh']=function(_0x1bde6d){for(var _0x13ebe6 in _0x1bde6d){if(_0x1bde6d['hasOwnProperty'](_0x13ebe6)){if(_0x1bde6d[_0x13ebe6][_0x18cd('0xf')]&&_0x1bde6d[_0x13ebe6]['active']){var _0x44ecc1=_0x1bde6d[_0x13ebe6]['Imap'];if(!_0x44ecc1[_0x18cd('0x17')]&&_0x1bde6d[_0x13ebe6][_0x18cd('0x18')]!==_0x18cd('0x19'))_0x44ecc1[_0x18cd('0x17')]=_0x1bde6d[_0x13ebe6]['provider'];if(!this[_0x18cd('0xb')][_0x18cd('0x1a')](_0x44ecc1['id'])){this[_0x18cd('0xb')][_0x44ecc1['id']]=new EmailImap(_0x44ecc1,_0x1bde6d[_0x13ebe6][_0x18cd('0x3')]);this['imapAccounts'][_0x44ecc1['id']]['on'](_0x18cd('0x1b'),this['handleImapBox']['bind'](this,_0x13ebe6));this[_0x18cd('0xb')][_0x44ecc1['id']]['on'](_0x18cd('0x3'),this[_0x18cd('0x1c')]['bind'](this,_0x13ebe6));this[_0x18cd('0xb')][_0x44ecc1['id']]['on']('end',this['handleImapEnd']['bind'](this,_0x13ebe6));this[_0x18cd('0xb')][_0x44ecc1['id']]['on'](_0x18cd('0x1d'),this['handleImapError'][_0x18cd('0x1e')](this,_0x13ebe6));}}else{if(_['isNil'](this['mailAccounts'][_0x13ebe6][_0x18cd('0xf')])){this['mailAccounts'][_0x13ebe6][_0x18cd('0xf')]={};}this[_0x18cd('0xa')][_0x13ebe6][_0x18cd('0xf')][_0x18cd('0x10')]=_0x18cd('0x1f');this['mailAccounts'][_0x13ebe6]['Imap'][_0x18cd('0x11')]='';this['emit'](_0x13ebe6);}}}};EmailChannel[_0x18cd('0x16')][_0x18cd('0x20')]=function(_0x4f445a,_0x2a78d1){if(this[_0x18cd('0xa')][_0x4f445a]){this['mailAccounts'][_0x4f445a][_0x18cd('0xf')]['status']=_0x18cd('0x21');this[_0x18cd('0xa')][_0x4f445a][_0x18cd('0xf')][_0x18cd('0x11')]=_0x2a78d1[_0x18cd('0x22')];if(_0x2a78d1[_0x18cd('0x23')]){this['mailAccounts'][_0x4f445a]['Imap'][_0x18cd('0x12')]=_0x2a78d1[_0x18cd('0x23')][_0x18cd('0x12')];}return this[_0x18cd('0xc')](_0x4f445a);}};EmailChannel[_0x18cd('0x16')][_0x18cd('0x1c')]=function(_0x583191,_0x1281a3){logger[_0x18cd('0x24')](_0x18cd('0x25'),_0x1281a3[_0x18cd('0x26')],_0x1281a3[_0x18cd('0x27')],_0x1281a3[_0x18cd('0x28')],_0x583191);if(this[_0x18cd('0xa')][_0x583191]){return mailAccount['notify'](_0x583191,_0x1281a3)['then'](function(_0x4fc4a8){if(_0x4fc4a8){logger['info'](_0x18cd('0x29'));}})['catch'](function(_0x1ab91e){logger['error'](_0x18cd('0x2a'),JSON[_0x18cd('0x13')](_0x1ab91e));});}};EmailChannel[_0x18cd('0x16')]['handleImapEnd']=function(_0xdb8cba){if(this[_0x18cd('0xa')][_0xdb8cba]&&this[_0x18cd('0xa')][_0xdb8cba][_0x18cd('0xf')]){if(this[_0x18cd('0xb')][this['mailAccounts'][_0xdb8cba]['Imap']['id']]){delete this['imapAccounts'][this[_0x18cd('0xa')][_0xdb8cba][_0x18cd('0xf')]['id']];}this['mailAccounts'][_0xdb8cba][_0x18cd('0xf')]['lastSync']=moment();this[_0x18cd('0xc')](_0xdb8cba);}};EmailChannel[_0x18cd('0x16')]['handleImapError']=function(_0xf8dce3,_0x44d17c){if(this[_0x18cd('0xa')][_0xf8dce3]){this[_0x18cd('0xa')][_0xf8dce3]['Imap'][_0x18cd('0x10')]='error';this['mailAccounts'][_0xf8dce3]['Imap'][_0x18cd('0x11')]=_0x44d17c;return this['emit'](_0xf8dce3);}};EmailChannel['prototype'][_0x18cd('0x2b')]=function(_0x70f0b8,_0x348fe2){return this[_0x18cd('0x2c')]['send'](_0x70f0b8,_0x348fe2);};EmailChannel[_0x18cd('0x16')]['verifySmtp']=function(_0x9defd2){var _0x420090=this;if(this[_0x18cd('0xa')][_0x9defd2['id']]){if(_[_0x18cd('0x2d')](this[_0x18cd('0xa')][_0x9defd2['id']][_0x18cd('0x2e')])){this[_0x18cd('0xa')][_0x9defd2['id']]['Smtp']={};}this[_0x18cd('0xa')][_0x9defd2['id']][_0x18cd('0x2e')][_0x18cd('0x2f')]=moment();return new BPromise(function(_0x51b9c5,_0x26cf75){return _0x420090[_0x18cd('0x2c')]['verify'](_0x9defd2)[_0x18cd('0x30')](function(_0x5d1f69){_0x420090[_0x18cd('0xa')][_0x9defd2['id']][_0x18cd('0x2e')]['status']=_0x18cd('0x31');_0x420090[_0x18cd('0xa')][_0x9defd2['id']][_0x18cd('0x2e')]['messageStatus']='';_0x420090[_0x18cd('0xc')](_0x9defd2['id']);_0x51b9c5(_0x5d1f69);})[_0x18cd('0x32')](function(_0x12a804){_0x420090[_0x18cd('0xa')][_0x9defd2['id']]['Smtp'][_0x18cd('0x10')]=_0x18cd('0x1d');_0x420090[_0x18cd('0xa')][_0x9defd2['id']]['Smtp']['messageStatus']=_0x12a804;_0x420090[_0x18cd('0xc')](_0x9defd2['id']);_0x26cf75(_0x12a804);});});}return this[_0x18cd('0x2c')][_0x18cd('0x33')](_0x9defd2);};module[_0x18cd('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4520835..54db4cf 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 _0x0ca1=['CloudProvider','data5','password','host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleError','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','exports','lodash','imap','mailparser','simpleParser','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token'];(function(_0x5c05f5,_0x1d31d0){var _0x5a7e91=function(_0x17b616){while(--_0x17b616){_0x5c05f5['push'](_0x5c05f5['shift']());}};_0x5a7e91(++_0x1d31d0);}(_0x0ca1,0x152));var _0x10ca=function(_0x793587,_0x251604){_0x793587=_0x793587-0x0;var _0x1c02c4=_0x0ca1[_0x793587];return _0x1c02c4;};'use strict';var _=require(_0x10ca('0x0'));var util=require('util');var Imap=require(_0x10ca('0x1'));var simpleParser=require(_0x10ca('0x2'))[_0x10ca('0x3')];var Iconv=require('iconv')[_0x10ca('0x4')];var EventEmitter=require(_0x10ca('0x5'))['EventEmitter'];var utils=require(_0x10ca('0x6'));var logger=require(_0x10ca('0x7'))(_0x10ca('0x8'));function EmailImap(_0x4ffc24,_0x1409da){this[_0x10ca('0x9')]=_0x4ffc24['mailbox'];this[_0x10ca('0xa')]=this[_0x10ca('0xb')](_0x4ffc24,_0x1409da);this['imap']=new Imap(this[_0x10ca('0xa')]);this[_0x10ca('0x1')][_0x10ca('0xc')](_0x10ca('0xd'),this[_0x10ca('0xe')][_0x10ca('0xf')](this));this[_0x10ca('0x1')][_0x10ca('0xc')](_0x10ca('0x10'),this[_0x10ca('0x11')]['bind'](this));this[_0x10ca('0x1')]['on'](_0x10ca('0x12'),this['handleError'][_0x10ca('0xf')](this));this[_0x10ca('0x1')]['connect']();}util[_0x10ca('0x13')](EmailImap,EventEmitter);EmailImap[_0x10ca('0x14')][_0x10ca('0xb')]=function(_0x46cb17,_0x19ce86){var _0x2d979e={'connTimeout':_0x46cb17[_0x10ca('0x15')]?_0x46cb17['connTimeout']*0x3e8:0x2710,'authTimeout':_0x46cb17[_0x10ca('0x16')]?_0x46cb17[_0x10ca('0x16')]*0x3e8:0x1388};if(_0x46cb17[_0x10ca('0x17')]){_0x2d979e[_0x10ca('0x18')]=_0x46cb17[_0x10ca('0x18')];if(_0x46cb17[_0x10ca('0x19')]){_0x2d979e[_0x10ca('0x1a')]=utils[_0x10ca('0x1b')](_0x46cb17[_0x10ca('0x1c')][_0x10ca('0x1d')],_0x46cb17[_0x10ca('0x18')]);}else{_0x2d979e[_0x10ca('0x1e')]=_0x46cb17[_0x10ca('0x1e')];}}else{if(_0x46cb17['authentication']){_0x2d979e['user']=_0x46cb17[_0x10ca('0x18')];_0x2d979e[_0x10ca('0x1e')]=_0x46cb17[_0x10ca('0x1e')];}}_0x2d979e[_0x10ca('0x8')]=_0x19ce86||_0x46cb17[_0x10ca('0x18')]||'anonymous@xcally.com';_0x2d979e[_0x10ca('0x1f')]=_0x46cb17[_0x10ca('0x1f')];_0x2d979e[_0x10ca('0x20')]=_0x46cb17['port']||0x3e1;if(_0x46cb17[_0x10ca('0x21')]){_0x2d979e[_0x10ca('0x21')]=!![];}else{_0x2d979e['tls']=![];_0x2d979e['autotls']=_0x10ca('0x22');}return _0x2d979e;};EmailImap[_0x10ca('0x14')][_0x10ca('0xe')]=function(){this[_0x10ca('0x1')][_0x10ca('0x23')](this[_0x10ca('0x9')],![],this[_0x10ca('0x24')][_0x10ca('0xf')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x3e57ed,_0x16ddc8){if(_0x3e57ed){this['handleError'](_0x3e57ed,!![]);}else{this[_0x10ca('0x25')](_0x10ca('0x26'),_0x16ddc8);this[_0x10ca('0x27')]();}};EmailImap[_0x10ca('0x14')][_0x10ca('0x28')]=function(_0x2c54aa){if(_0x2c54aa){this[_0x10ca('0x29')](_0x2c54aa,!![]);}else{this['imap'][_0x10ca('0x10')]();}};EmailImap['prototype'][_0x10ca('0x27')]=function(){this[_0x10ca('0x1')][_0x10ca('0x2a')]([_0x10ca('0x2b')],this[_0x10ca('0x2c')]['bind'](this));};EmailImap[_0x10ca('0x14')]['handleReadUnseen']=function(_0x371f2c,_0x289b5a){if(_0x371f2c){this[_0x10ca('0x29')](_0x371f2c,!![]);}else{if(_0x289b5a[_0x10ca('0x2d')]){try{var _0x1b3ab2=this['imap'][_0x10ca('0x2e')](_0x289b5a,{'bodies':'','markSeen':!![]});_0x1b3ab2['on'](_0x10ca('0x2f'),this['handleFetchMessage'][_0x10ca('0xf')](this));_0x1b3ab2[_0x10ca('0xc')](_0x10ca('0x12'),this[_0x10ca('0x30')][_0x10ca('0xf')](this));_0x1b3ab2[_0x10ca('0xc')](_0x10ca('0x10'),this['handleFetchEnd'][_0x10ca('0xf')](this));}catch(_0x16aa96){logger[_0x10ca('0x12')](_0x16aa96);}}else{this[_0x10ca('0x1')][_0x10ca('0x31')](!![],this['handleCloseBox'][_0x10ca('0xf')](this));}}};EmailImap[_0x10ca('0x14')][_0x10ca('0x32')]=function(_0x5e53ad){_0x5e53ad['on'](_0x10ca('0x33'),this[_0x10ca('0x34')]['bind'](this));_0x5e53ad[_0x10ca('0xc')](_0x10ca('0x35'),this['handleMessageAttributes'][_0x10ca('0xf')](this));_0x5e53ad[_0x10ca('0xc')](_0x10ca('0x10'),this['handleMessageEnd'][_0x10ca('0xf')](this));};EmailImap[_0x10ca('0x14')][_0x10ca('0x34')]=function(_0xff8ac5){simpleParser(_0xff8ac5,{'Iconv':Iconv},this[_0x10ca('0x36')][_0x10ca('0xf')](this));};EmailImap[_0x10ca('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x10ca('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x10ca('0x14')][_0x10ca('0x36')]=function(_0x41bd3f,_0xaedfb8){if(_0x41bd3f){logger['error'](_0x41bd3f);}else{var _0x5a2a4b=this;utils[_0x10ca('0x37')](this[_0x10ca('0xa')],_0xaedfb8,function(_0x5917ce){_0x5a2a4b[_0x10ca('0x25')](_0x10ca('0x8'),_0x5917ce);});}};EmailImap['prototype'][_0x10ca('0x38')]=function(){this['imap'][_0x10ca('0x31')](!![],this[_0x10ca('0x28')]['bind'](this));};EmailImap[_0x10ca('0x14')][_0x10ca('0x30')]=function(_0x2a66ed){this[_0x10ca('0x29')](_0x2a66ed);this['imap'][_0x10ca('0x31')](!![],this[_0x10ca('0x28')][_0x10ca('0xf')](this));};EmailImap['prototype'][_0x10ca('0x11')]=function(){this['emit'](_0x10ca('0x10'));};EmailImap[_0x10ca('0x14')][_0x10ca('0x29')]=function(_0x16333e,_0x1a154){logger[_0x10ca('0x12')](_0x10ca('0x29'),this[_0x10ca('0xa')][_0x10ca('0x8')],JSON[_0x10ca('0x39')](_0x16333e));var _0x1a9e5f='';if(_0x16333e){if(_0x16333e['textCode']){_0x1a9e5f=_0x16333e[_0x10ca('0x3a')];}else{for(var _0x384c18 in _0x16333e){if(_0x16333e[_0x10ca('0x3b')](_0x384c18)){_0x1a9e5f+=_['upperFirst'](_0x384c18)+':\x20'+_0x16333e[_0x384c18]+'\x0a';}}}}if(_0x1a154){this[_0x10ca('0x1')][_0x10ca('0x10')]();}else{this['emit'](_0x10ca('0x12'),_0x1a9e5f);this[_0x10ca('0x25')](_0x10ca('0x10'));}};module[_0x10ca('0x3c')]=EmailImap; \ No newline at end of file +var _0xeea9=['error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','account','handleFetchError','email','stringify','textCode','hasOwnProperty','lodash','util','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','imap','once','ready','handleReady','bind','end','handleEnd'];(function(_0x4c9913,_0x2e9990){var _0x3b1e9f=function(_0x363396){while(--_0x363396){_0x4c9913['push'](_0x4c9913['shift']());}};_0x3b1e9f(++_0x2e9990);}(_0xeea9,0xa9));var _0x9eea=function(_0x539849,_0x4030df){_0x539849=_0x539849-0x0;var _0x5f6894=_0xeea9[_0x539849];return _0x5f6894;};'use strict';var _=require(_0x9eea('0x0'));var util=require(_0x9eea('0x1'));var Imap=require('imap');var simpleParser=require(_0x9eea('0x2'))[_0x9eea('0x3')];var Iconv=require('iconv')[_0x9eea('0x4')];var EventEmitter=require(_0x9eea('0x5'))[_0x9eea('0x6')];var utils=require(_0x9eea('0x7'));var logger=require(_0x9eea('0x8'))('email');function EmailImap(_0x3ef702,_0x50808f){this[_0x9eea('0x9')]=_0x3ef702[_0x9eea('0x9')];this['account']=this['getAccount'](_0x3ef702,_0x50808f);this['imap']=new Imap(this['account']);this[_0x9eea('0xa')][_0x9eea('0xb')](_0x9eea('0xc'),this[_0x9eea('0xd')][_0x9eea('0xe')](this));this[_0x9eea('0xa')][_0x9eea('0xb')](_0x9eea('0xf'),this[_0x9eea('0x10')]['bind'](this));this['imap']['on'](_0x9eea('0x11'),this[_0x9eea('0x12')][_0x9eea('0xe')](this));this[_0x9eea('0xa')][_0x9eea('0x13')]();}util[_0x9eea('0x14')](EmailImap,EventEmitter);EmailImap[_0x9eea('0x15')]['getAccount']=function(_0x1699e5,_0x51d8b9){var _0x29262b={'connTimeout':_0x1699e5[_0x9eea('0x16')]?_0x1699e5[_0x9eea('0x16')]*0x3e8:0x2710,'authTimeout':_0x1699e5[_0x9eea('0x17')]?_0x1699e5[_0x9eea('0x17')]*0x3e8:0x1388};if(_0x1699e5[_0x9eea('0x18')]){_0x29262b[_0x9eea('0x19')]=_0x1699e5[_0x9eea('0x19')];if(_0x1699e5[_0x9eea('0x1a')]){_0x29262b['xoauth2']=utils[_0x9eea('0x1b')](_0x1699e5['CloudProvider'][_0x9eea('0x1c')],_0x1699e5[_0x9eea('0x19')]);}else{_0x29262b[_0x9eea('0x1d')]=_0x1699e5[_0x9eea('0x1d')];}}else{if(_0x1699e5[_0x9eea('0x1e')]){_0x29262b[_0x9eea('0x19')]=_0x1699e5['user'];_0x29262b['password']=_0x1699e5[_0x9eea('0x1d')];}}_0x29262b['email']=_0x51d8b9||_0x1699e5[_0x9eea('0x19')]||_0x9eea('0x1f');_0x29262b['host']=_0x1699e5[_0x9eea('0x20')];_0x29262b['port']=_0x1699e5[_0x9eea('0x21')]||0x3e1;if(_0x1699e5[_0x9eea('0x22')]){_0x29262b[_0x9eea('0x22')]=!![];}else{_0x29262b[_0x9eea('0x22')]=![];_0x29262b[_0x9eea('0x23')]='required';}return _0x29262b;};EmailImap[_0x9eea('0x15')]['handleReady']=function(){this[_0x9eea('0xa')]['openBox'](this['mailbox'],![],this[_0x9eea('0x24')]['bind'](this));};EmailImap['prototype'][_0x9eea('0x24')]=function(_0x1efe22,_0x35c13a){if(_0x1efe22){this['handleError'](_0x1efe22,!![]);}else{this[_0x9eea('0x25')](_0x9eea('0x26'),_0x35c13a);this[_0x9eea('0x27')]();}};EmailImap[_0x9eea('0x15')][_0x9eea('0x28')]=function(_0x4bcedb){if(_0x4bcedb){this['handleError'](_0x4bcedb,!![]);}else{this['imap']['end']();}};EmailImap['prototype'][_0x9eea('0x27')]=function(){this[_0x9eea('0xa')][_0x9eea('0x29')](['UNSEEN'],this[_0x9eea('0x2a')][_0x9eea('0xe')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x7a9a1b,_0x280f1f){if(_0x7a9a1b){this['handleError'](_0x7a9a1b,!![]);}else{if(_0x280f1f[_0x9eea('0x2b')]){try{var _0x3f41f0=this[_0x9eea('0xa')][_0x9eea('0x2c')](_0x280f1f,{'bodies':'','markSeen':!![]});_0x3f41f0['on'](_0x9eea('0x2d'),this[_0x9eea('0x2e')][_0x9eea('0xe')](this));_0x3f41f0[_0x9eea('0xb')](_0x9eea('0x11'),this['handleFetchError'][_0x9eea('0xe')](this));_0x3f41f0[_0x9eea('0xb')](_0x9eea('0xf'),this[_0x9eea('0x2f')][_0x9eea('0xe')](this));}catch(_0xfac3dd){logger[_0x9eea('0x11')](_0xfac3dd);}}else{this[_0x9eea('0xa')][_0x9eea('0x30')](!![],this[_0x9eea('0x28')]['bind'](this));}}};EmailImap[_0x9eea('0x15')][_0x9eea('0x2e')]=function(_0x22b368){_0x22b368['on'](_0x9eea('0x31'),this['handleMessageBody'][_0x9eea('0xe')](this));_0x22b368[_0x9eea('0xb')](_0x9eea('0x32'),this[_0x9eea('0x33')][_0x9eea('0xe')](this));_0x22b368[_0x9eea('0xb')](_0x9eea('0xf'),this['handleMessageEnd'][_0x9eea('0xe')](this));};EmailImap[_0x9eea('0x15')][_0x9eea('0x34')]=function(_0x56e86f){simpleParser(_0x56e86f,{'Iconv':Iconv},this[_0x9eea('0x35')][_0x9eea('0xe')](this));};EmailImap[_0x9eea('0x15')]['handleMessageAttributes']=function(){};EmailImap[_0x9eea('0x15')][_0x9eea('0x36')]=function(){};EmailImap[_0x9eea('0x15')][_0x9eea('0x35')]=function(_0x45f9cb,_0x177beb){if(_0x45f9cb){logger[_0x9eea('0x11')](_0x45f9cb);}else{var _0x53bd23=this;utils[_0x9eea('0x37')](this[_0x9eea('0x38')],_0x177beb,function(_0x1faf1f){_0x53bd23[_0x9eea('0x25')]('email',_0x1faf1f);});}};EmailImap['prototype'][_0x9eea('0x2f')]=function(){this[_0x9eea('0xa')][_0x9eea('0x30')](!![],this[_0x9eea('0x28')][_0x9eea('0xe')](this));};EmailImap[_0x9eea('0x15')][_0x9eea('0x39')]=function(_0x2ea1ab){this['handleError'](_0x2ea1ab);this[_0x9eea('0xa')][_0x9eea('0x30')](!![],this['handleCloseBox'][_0x9eea('0xe')](this));};EmailImap[_0x9eea('0x15')][_0x9eea('0x10')]=function(){this[_0x9eea('0x25')]('end');};EmailImap[_0x9eea('0x15')][_0x9eea('0x12')]=function(_0x2ae512,_0x539ceb){logger[_0x9eea('0x11')](_0x9eea('0x12'),this[_0x9eea('0x38')][_0x9eea('0x3a')],JSON[_0x9eea('0x3b')](_0x2ae512));var _0x55d99c='';if(_0x2ae512){if(_0x2ae512[_0x9eea('0x3c')]){_0x55d99c=_0x2ae512[_0x9eea('0x3c')];}else{for(var _0x32469b in _0x2ae512){if(_0x2ae512[_0x9eea('0x3d')](_0x32469b)){_0x55d99c+=_['upperFirst'](_0x32469b)+':\x20'+_0x2ae512[_0x32469b]+'\x0a';}}}}if(_0x539ceb){this[_0x9eea('0xa')]['end']();}else{this[_0x9eea('0x25')](_0x9eea('0x11'),_0x55d99c);this['emit'](_0x9eea('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9400499..8d7ad67 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 _0x47ff=['compile','sendMail','toString','prototype','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','send','createTransport'];(function(_0x1e45a6,_0x12e0eb){var _0x2de9f9=function(_0x152a81){while(--_0x152a81){_0x1e45a6['push'](_0x1e45a6['shift']());}};_0x2de9f9(++_0x12e0eb);}(_0x47ff,0xcf));var _0xf47f=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x47ff[_0x180c9b];return _0x3ff116;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf47f('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0xf47f('0x1')]=function(_0x4f5105,_0x295c1b){return new Promise(function(_0x5149e9,_0x195f9b){var _0x168f34=nodemailer[_0xf47f('0x2')](_0x4f5105);_0x168f34['use'](_0xf47f('0x3'),inlineBase64());_0x168f34[_0xf47f('0x4')](_0x295c1b,function(_0x5e86d4,_0x1c430e){if(_0x5e86d4){_0x195f9b(_0x5e86d4[_0xf47f('0x5')]());}else{_0x5149e9(_0x1c430e);}});});};EmailSmtp[_0xf47f('0x6')][_0xf47f('0x7')]=function(_0x139214){return new Promise(function(_0x15a790,_0x1afe8c){var _0x20fede=nodemailer[_0xf47f('0x2')](_0x139214);_0x20fede[_0xf47f('0x7')](function(_0x535830,_0x1d47ea){if(_0x535830){_0x1afe8c(_0x535830[_0xf47f('0x5')]());}else{if(_0x1d47ea){_0x15a790(_0x1d47ea);}else{_0x1afe8c(_0xf47f('0x8'));}}});});};module[_0xf47f('0x9')]=EmailSmtp; \ No newline at end of file +var _0x70f1=['toString','verify','createTransport','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','compile','sendMail'];(function(_0x32f47e,_0x5acd97){var _0x1f1e6e=function(_0xd794f6){while(--_0xd794f6){_0x32f47e['push'](_0x32f47e['shift']());}};_0x1f1e6e(++_0x5acd97);}(_0x70f1,0x7d));var _0x170f=function(_0x154608,_0x20783d){_0x154608=_0x154608-0x0;var _0x6c8ef8=_0x70f1[_0x154608];return _0x6c8ef8;};'use strict';var nodemailer=require(_0x170f('0x0'));var inlineBase64=require(_0x170f('0x1'));function EmailSmtp(){}EmailSmtp[_0x170f('0x2')]['send']=function(_0x5b4668,_0x3c35ce){return new Promise(function(_0x592951,_0x2d5d70){var _0x1d58c1=nodemailer['createTransport'](_0x5b4668);_0x1d58c1['use'](_0x170f('0x3'),inlineBase64());_0x1d58c1[_0x170f('0x4')](_0x3c35ce,function(_0x425781,_0x10c1a2){if(_0x425781){_0x2d5d70(_0x425781[_0x170f('0x5')]());}else{_0x592951(_0x10c1a2);}});});};EmailSmtp[_0x170f('0x2')][_0x170f('0x6')]=function(_0x3b73bb){return new Promise(function(_0x598a43,_0x12cdf6){var _0x530c8e=nodemailer[_0x170f('0x7')](_0x3b73bb);_0x530c8e[_0x170f('0x6')](function(_0x22e7f1,_0x22eb23){if(_0x22e7f1){_0x12cdf6(_0x22e7f1[_0x170f('0x5')]());}else{if(_0x22eb23){_0x598a43(_0x22eb23);}else{_0x12cdf6(_0x170f('0x8'));}}});});};module[_0x170f('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 1e7b8ce..35f2ba1 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 _0xff3f=['head','length','pop','isEmpty','html','test','replace','includes','','body','textAsHtml','originTo','email','message','originCc','bcc','type','attachment','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','address','anonymous','@xcally.com','value','name','indexOf','split','slice'];(function(_0x2f7fcc,_0x40c8fb){var _0x1a50f6=function(_0x278c5b){while(--_0x278c5b){_0x2f7fcc['push'](_0x2f7fcc['shift']());}};_0x1a50f6(++_0x40c8fb);}(_0xff3f,0xcc));var _0xfff3=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0xff3f[_0xee5d2a];return _0x346948;};'use strict';var _=require(_0xfff3('0x0'));var moment=require(_0xfff3('0x1'));var random=require(_0xfff3('0x2'));var fs=require('fs');var path=require(_0xfff3('0x3'));var util=require(_0xfff3('0x4'));var tnef=require('node-tnef');var logger=require(_0xfff3('0x5'))('email');var config=require(_0xfff3('0x6'));function getAddress(_0x54eadc){var _0x57fee5=_['head'](_0x54eadc['value']);return _0x57fee5&&_0x57fee5[_0xfff3('0x7')]?_0x57fee5[_0xfff3('0x7')]:_0xfff3('0x8')+random['generate'](0x6)+_0xfff3('0x9');}function getFirstName(_0x266ded){var _0x4ee6af=_['head'](_0x266ded[_0xfff3('0xa')]);if(_0x4ee6af&&_0x4ee6af[_0xfff3('0xb')]){if(_0x4ee6af[_0xfff3('0xb')]==_0x4ee6af[_0xfff3('0x7')]){return _0x4ee6af['name']['substring'](0x0,_0x4ee6af[_0xfff3('0xb')][_0xfff3('0xc')]('@'));}var _0x4d096c=_0x4ee6af[_0xfff3('0xb')][_0xfff3('0xd')](/\s+/);return _0x4d096c['length']>0x1?_0x4d096c[_0xfff3('0xe')](0x0,-0x1)['join']('\x20'):_0x4ee6af[_0xfff3('0xb')];}return'Anonymous';}function getLastName(_0xd7914f){var _0x3f37b3=_[_0xfff3('0xf')](_0xd7914f[_0xfff3('0xa')]);if(_0x3f37b3&&_0x3f37b3[_0xfff3('0xb')]){var _0xeb9e63=_0x3f37b3[_0xfff3('0xb')][_0xfff3('0xd')](/\s+/);return _0xeb9e63[_0xfff3('0x10')]>0x1?_0xeb9e63[_0xfff3('0x11')]():'';}return'';}function getMails(_0x534003,_0x4abd4d){var _0x5da69='';for(var _0xa7de94=0x0;_0xa7de94<_0x4abd4d['value']['length'];_0xa7de94+=0x1){if(_0x4abd4d[_0xfff3('0xa')][_0xa7de94]['address']!==_0x534003){if(!_[_0xfff3('0x12')](_0x5da69)){_0x5da69+=',';}_0x5da69+=_0x4abd4d[_0xfff3('0xa')][_0xa7de94][_0xfff3('0xb')]||_0x4abd4d['value'][_0xa7de94][_0xfff3('0x7')]||'';_0x5da69+='\x20<';_0x5da69+=_0x4abd4d[_0xfff3('0xa')][_0xa7de94][_0xfff3('0x7')]?_0x4abd4d['value'][_0xa7de94][_0xfff3('0x7')]:_0xfff3('0x8')+random['generate'](0x6)+_0xfff3('0x9');_0x5da69+='>';}}return _0x5da69;}function parseEmail(_0x4af899,_0x281c83,_0x401dbf){if(_0x281c83[_0xfff3('0x13')]){var _0xa500fc=/)<[^<]*)*<\/script>/gi;while(_0xa500fc[_0xfff3('0x14')](_0x281c83[_0xfff3('0x13')])){_0x281c83[_0xfff3('0x13')]=_0x281c83[_0xfff3('0x13')][_0xfff3('0x15')](_0xa500fc,'');}if(_0x281c83['html'][_0xfff3('0x16')](_0xfff3('0x17'))){var _0x5f1c8c=[];_0x281c83[_0xfff3('0x18')][_0xfff3('0x19')](_0x40f6ff=>{_0x5f1c8c['push'](_0x40f6ff[_0xfff3('0x1a')]);});var _0xff9d9=/]+>/g;var _0x11d692=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4fcc09=_0x281c83[_0xfff3('0x13')]['replace'](_0x11d692,_0xfff3('0x1b'));var _0x3e0e57=_0x4fcc09[_0xfff3('0x15')](_0xff9d9,_0xfff3('0x1c'));for(let _0x436633=0x0;_0x436633<_0x5f1c8c['length'];_0x436633++){var _0x57dc53=_0x3e0e57[_0xfff3('0x15')](_0xfff3('0x1c'),'\x20[Attachment:\x20'+_0x5f1c8c[_0x436633]+_0xfff3('0x1d'));_0x3e0e57=_0x57dc53;}_0x281c83[_0xfff3('0x13')]=_0x3e0e57;}_0x401dbf[_0xfff3('0x1e')]=_0x281c83[_0xfff3('0x13')];}else{_0x401dbf['body']=_0x281c83[_0xfff3('0x1f')];}if(_0x401dbf[_0xfff3('0x1e')]){_0x401dbf[_0xfff3('0x1e')]=_0x401dbf[_0xfff3('0x1e')][_0xfff3('0x15')](/0x0){var _0x25ff94=[_0xfff3('0x30'),_0xfff3('0x31'),_0xfff3('0x32')];for(var _0x3689c2=0x0;_0x3689c2<_0x281c83[_0xfff3('0x2f')]['length'];_0x3689c2++){var _0x42d558=_['indexOf'](_0x25ff94,_0x281c83[_0xfff3('0x2f')][_0x3689c2]['line']);if(_0x42d558>=0x0){_0x401dbf[_0xfff3('0x33')]=!![];}}}return _0x401dbf;}exports[_0xfff3('0x34')]=function(_0xeb181f,_0x34f93f,_0x3d8687){var _0xe66c99={'from':getAddress(_0x34f93f['from']),'firstName':getFirstName(_0x34f93f[_0xfff3('0x35')]),'lastName':getLastName(_0x34f93f[_0xfff3('0x35')]),'mapKey':_0xfff3('0x21'),'message':{'from':getMails(_0xeb181f[_0xfff3('0x21')],_0x34f93f[_0xfff3('0x35')]),'to':_0xeb181f[_0xfff3('0x21')],'cc':'','subject':_0x34f93f[_0xfff3('0x36')]||'','messageId':_0x34f93f[_0xfff3('0x37')],'inReplyTo':_0x34f93f['inReplyTo'],'sentAt':moment(_0x34f93f[_0xfff3('0x38')])[_0xfff3('0x39')](_0xfff3('0x3a')),'attach':![],'attachments':[]}};if(!_0x34f93f['html']&&!_0x34f93f[_0xfff3('0x1f')]){var _0x1adf91=_[_0xfff3('0x3b')](_0x34f93f[_0xfff3('0x18')],{'contentType':'application/ms-tnef'});if(_0x1adf91[_0xfff3('0x10')]){logger[_0xfff3('0x3c')](util[_0xfff3('0x39')](_0xfff3('0x3d'),_0x34f93f[_0xfff3('0x37')]));tnef[_0xfff3('0x3e')](_[_0xfff3('0x3f')](_0x1adf91)[_0xfff3('0x40')],function(_0x20b8a0,_0x18940f){if(_0x18940f){_0x34f93f[_0xfff3('0x13')]=_0x18940f['BodyHTML']||_0xfff3('0x41');if(_0x18940f[_0xfff3('0x42')]){for(var _0x218596=0x0;_0x218596<_0x18940f[_0xfff3('0x42')]['length'];_0x218596++){var _0x4bda1d=_0x18940f[_0xfff3('0x42')][_0x218596];_0xe66c99[_0xfff3('0x22')][_0xfff3('0x18')][_0xfff3('0x2d')]({'filename':_0x4bda1d[_0xfff3('0x43')],'content':Buffer[_0xfff3('0x35')](_0x4bda1d['Data'])});}}}_0x3d8687(parseEmail(_0xeb181f,_0x34f93f,_0xe66c99));});}else{_0x34f93f[_0xfff3('0x13')]=_0xfff3('0x41');_0x3d8687(parseEmail(_0xeb181f,_0x34f93f,_0xe66c99));}}else{_0x3d8687(parseEmail(_0xeb181f,_0x34f93f,_0xe66c99));}};exports[_0xfff3('0x44')]=function(_0x3c889d,_0x588a90){var _0x1dec47=[_0xfff3('0x45')+(_0x588a90||''),_0xfff3('0x46')+_0x3c889d,'',''];return Buffer[_0xfff3('0x35')](_0x1dec47['join'](''),'utf-8')[_0xfff3('0x47')](_0xfff3('0x48'));}; \ No newline at end of file +var _0xebf7=['html','test','replace','includes','attachments','push','filename','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','message','originTo','originCc','bcc','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','messageId','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','toString','lodash','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty'];(function(_0x12a93a,_0x3c6bfc){var _0x2a1b7c=function(_0x5f22ba){while(--_0x5f22ba){_0x12a93a['push'](_0x12a93a['shift']());}};_0x2a1b7c(++_0x3c6bfc);}(_0xebf7,0xbe));var _0x7ebf=function(_0x2157f6,_0x4f2611){_0x2157f6=_0x2157f6-0x0;var _0x1ac60a=_0xebf7[_0x2157f6];return _0x1ac60a;};'use strict';var _=require(_0x7ebf('0x0'));var moment=require('moment');var random=require(_0x7ebf('0x1'));var fs=require('fs');var path=require(_0x7ebf('0x2'));var util=require(_0x7ebf('0x3'));var tnef=require(_0x7ebf('0x4'));var logger=require('../../../config/logger')(_0x7ebf('0x5'));var config=require(_0x7ebf('0x6'));function getAddress(_0x4997bd){var _0x58d2a1=_[_0x7ebf('0x7')](_0x4997bd[_0x7ebf('0x8')]);return _0x58d2a1&&_0x58d2a1[_0x7ebf('0x9')]?_0x58d2a1['address']:_0x7ebf('0xa')+random[_0x7ebf('0xb')](0x6)+_0x7ebf('0xc');}function getFirstName(_0x4a5fbd){var _0xff4d1f=_[_0x7ebf('0x7')](_0x4a5fbd['value']);if(_0xff4d1f&&_0xff4d1f[_0x7ebf('0xd')]){if(_0xff4d1f[_0x7ebf('0xd')]==_0xff4d1f[_0x7ebf('0x9')]){return _0xff4d1f['name'][_0x7ebf('0xe')](0x0,_0xff4d1f['name'][_0x7ebf('0xf')]('@'));}var _0x3c1a7d=_0xff4d1f[_0x7ebf('0xd')][_0x7ebf('0x10')](/\s+/);return _0x3c1a7d['length']>0x1?_0x3c1a7d[_0x7ebf('0x11')](0x0,-0x1)[_0x7ebf('0x12')]('\x20'):_0xff4d1f['name'];}return _0x7ebf('0x13');}function getLastName(_0x476d7e){var _0x1e1666=_[_0x7ebf('0x7')](_0x476d7e[_0x7ebf('0x8')]);if(_0x1e1666&&_0x1e1666[_0x7ebf('0xd')]){var _0x9e237c=_0x1e1666['name'][_0x7ebf('0x10')](/\s+/);return _0x9e237c[_0x7ebf('0x14')]>0x1?_0x9e237c[_0x7ebf('0x15')]():'';}return'';}function getMails(_0x5a9316,_0x40ebe9){var _0x51201b='';for(var _0x5c1b08=0x0;_0x5c1b08<_0x40ebe9[_0x7ebf('0x8')]['length'];_0x5c1b08+=0x1){if(_0x40ebe9[_0x7ebf('0x8')][_0x5c1b08]['address']!==_0x5a9316){if(!_[_0x7ebf('0x16')](_0x51201b)){_0x51201b+=',';}_0x51201b+=_0x40ebe9[_0x7ebf('0x8')][_0x5c1b08][_0x7ebf('0xd')]||_0x40ebe9[_0x7ebf('0x8')][_0x5c1b08][_0x7ebf('0x9')]||'';_0x51201b+='\x20<';_0x51201b+=_0x40ebe9['value'][_0x5c1b08][_0x7ebf('0x9')]?_0x40ebe9['value'][_0x5c1b08][_0x7ebf('0x9')]:'anonymous'+random[_0x7ebf('0xb')](0x6)+_0x7ebf('0xc');_0x51201b+='>';}}return _0x51201b;}function parseEmail(_0x209d1a,_0x43a7b2,_0x40d1dc){if(_0x43a7b2[_0x7ebf('0x17')]){var _0x400ca1=/)<[^<]*)*<\/script>/gi;while(_0x400ca1[_0x7ebf('0x18')](_0x43a7b2[_0x7ebf('0x17')])){_0x43a7b2[_0x7ebf('0x17')]=_0x43a7b2[_0x7ebf('0x17')][_0x7ebf('0x19')](_0x400ca1,'');}if(_0x43a7b2[_0x7ebf('0x17')][_0x7ebf('0x1a')]('{_0xa348aa[_0x7ebf('0x1c')](_0x59c28d[_0x7ebf('0x1d')]);});var _0x2979d9=/]+>/g;var _0x2e15db=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48bc35=_0x43a7b2[_0x7ebf('0x17')][_0x7ebf('0x19')](_0x2e15db,_0x7ebf('0x1e'));var _0x44598a=_0x48bc35[_0x7ebf('0x19')](_0x2979d9,_0x7ebf('0x1f'));for(let _0x1396bf=0x0;_0x1396bf<_0xa348aa[_0x7ebf('0x14')];_0x1396bf++){var _0x1a5597=_0x44598a[_0x7ebf('0x19')](_0x7ebf('0x1f'),_0x7ebf('0x20')+_0xa348aa[_0x1396bf]+'\x20]');_0x44598a=_0x1a5597;}_0x43a7b2[_0x7ebf('0x17')]=_0x44598a;}_0x40d1dc[_0x7ebf('0x21')]=_0x43a7b2[_0x7ebf('0x17')];}else{_0x40d1dc[_0x7ebf('0x21')]=_0x43a7b2[_0x7ebf('0x22')];}if(_0x40d1dc[_0x7ebf('0x21')]){_0x40d1dc[_0x7ebf('0x21')]=_0x40d1dc[_0x7ebf('0x21')][_0x7ebf('0x19')](/0x0){var _0x132930=[_0x7ebf('0x32'),_0x7ebf('0x33'),_0x7ebf('0x34')];for(var _0x3cddaf=0x0;_0x3cddaf<_0x43a7b2[_0x7ebf('0x31')][_0x7ebf('0x14')];_0x3cddaf++){var _0x14be9c=_[_0x7ebf('0xf')](_0x132930,_0x43a7b2['headerLines'][_0x3cddaf][_0x7ebf('0x35')]);if(_0x14be9c>=0x0){_0x40d1dc[_0x7ebf('0x36')]=!![];}}}return _0x40d1dc;}exports[_0x7ebf('0x37')]=function(_0x3d2521,_0x492a38,_0x5a2f98){var _0x2746ec={'from':getAddress(_0x492a38[_0x7ebf('0x38')]),'firstName':getFirstName(_0x492a38[_0x7ebf('0x38')]),'lastName':getLastName(_0x492a38['from']),'mapKey':_0x7ebf('0x5'),'message':{'from':getMails(_0x3d2521['email'],_0x492a38[_0x7ebf('0x38')]),'to':_0x3d2521['email'],'cc':'','subject':_0x492a38['subject']||'','messageId':_0x492a38[_0x7ebf('0x39')],'inReplyTo':_0x492a38['inReplyTo'],'sentAt':moment(_0x492a38['date'])[_0x7ebf('0x29')](_0x7ebf('0x3a')),'attach':![],'attachments':[]}};if(!_0x492a38[_0x7ebf('0x17')]&&!_0x492a38[_0x7ebf('0x22')]){var _0x392696=_['filter'](_0x492a38[_0x7ebf('0x1b')],{'contentType':_0x7ebf('0x3b')});if(_0x392696[_0x7ebf('0x14')]){logger[_0x7ebf('0x3c')](util[_0x7ebf('0x29')](_0x7ebf('0x3d'),_0x492a38[_0x7ebf('0x39')]));tnef['parseBuffer'](_[_0x7ebf('0x3e')](_0x392696)[_0x7ebf('0x2f')],function(_0x426b0e,_0xbaa978){if(_0xbaa978){_0x492a38[_0x7ebf('0x17')]=_0xbaa978['BodyHTML']||'

Empty\x20message

';if(_0xbaa978[_0x7ebf('0x3f')]){for(var _0x51f93e=0x0;_0x51f93e<_0xbaa978[_0x7ebf('0x3f')][_0x7ebf('0x14')];_0x51f93e++){var _0x410233=_0xbaa978[_0x7ebf('0x3f')][_0x51f93e];_0x2746ec[_0x7ebf('0x23')][_0x7ebf('0x1b')][_0x7ebf('0x1c')]({'filename':_0x410233[_0x7ebf('0x40')],'content':Buffer[_0x7ebf('0x38')](_0x410233[_0x7ebf('0x41')])});}}}_0x5a2f98(parseEmail(_0x3d2521,_0x492a38,_0x2746ec));});}else{_0x492a38[_0x7ebf('0x17')]=_0x7ebf('0x42');_0x5a2f98(parseEmail(_0x3d2521,_0x492a38,_0x2746ec));}}else{_0x5a2f98(parseEmail(_0x3d2521,_0x492a38,_0x2746ec));}};exports[_0x7ebf('0x43')]=function(_0x2f132e,_0x307b01){var _0x4a4029=[_0x7ebf('0x44')+(_0x307b01||''),_0x7ebf('0x45')+_0x2f132e,'',''];return Buffer[_0x7ebf('0x38')](_0x4a4029['join'](''),'utf-8')[_0x7ebf('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f708458..f16584a 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 _0xd94a=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xd94a,0xb8));var _0xad94=function(_0xc2ecb8,_0x5995f6){_0xc2ecb8=_0xc2ecb8-0x0;var _0x8f707c=_0xd94a[_0xc2ecb8];return _0x8f707c;};'use strict';var _=require(_0xad94('0x0'));function MailAccount(_0xdf7ba5){this['id']=_0xdf7ba5['id']||0x0;this[_0xad94('0x1')]=_0xdf7ba5[_0xad94('0x1')]||_0xad94('0x2');this['key']=_0xdf7ba5[_0xad94('0x3')]||_0xad94('0x4');this['active']=_0xdf7ba5[_0xad94('0x5')]||![];this[_0xad94('0x6')]=_0xdf7ba5[_0xad94('0x6')]||[];this[_0xad94('0x7')]=_0xdf7ba5[_0xad94('0x7')]||[];}module[_0xad94('0x8')]=MailAccount; \ No newline at end of file +var _0xc8c2=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xc8c2,0xde));var _0x2c8c=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0xc8c2[_0x1d5714];return _0x1b620e;};'use strict';var _=require(_0x2c8c('0x0'));function MailAccount(_0x12f4ef){this['id']=_0x12f4ef['id']||0x0;this[_0x2c8c('0x1')]=_0x12f4ef[_0x2c8c('0x1')]||_0x2c8c('0x2');this[_0x2c8c('0x3')]=_0x12f4ef[_0x2c8c('0x3')]||_0x2c8c('0x4');this[_0x2c8c('0x5')]=_0x12f4ef[_0x2c8c('0x5')]||![];this[_0x2c8c('0x6')]=_0x12f4ef[_0x2c8c('0x6')]||[];this[_0x2c8c('0x7')]=_0x12f4ef[_0x2c8c('0x7')]||[];}module[_0x2c8c('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 20f21a2..9889de4 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 _0x64e7=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','merge','exports','../model/mailAccount','mailAccounts'];(function(_0x41a99c,_0x4cb59e){var _0x66ef64=function(_0x4d67ca){while(--_0x4d67ca){_0x41a99c['push'](_0x41a99c['shift']());}};_0x66ef64(++_0x4cb59e);}(_0x64e7,0xc6));var _0x764e=function(_0x1c578e,_0x49c2d7){_0x1c578e=_0x1c578e-0x0;var _0x460d76=_0x64e7[_0x1c578e];return _0x460d76;};'use strict';var _=require('lodash');var MailAccount=require(_0x764e('0x0'));var Realtime=function(){this[_0x764e('0x1')]={};};function freeIsNotKey(_0x43406a,_0x4237f9,_0xfa36a){var _0x4faf67=_[_0x764e('0x2')](_0x43406a,function(_0xe5d3fb,_0x481e49){return _0xe5d3fb[_0xfa36a];});for(var _0x680396 in _0x4237f9){if(_0x4237f9[_0x764e('0x3')](_0x680396)){if(!_0x4faf67[_0x680396]){delete _0x4237f9[_0x680396];}}}}Realtime[_0x764e('0x4')][_0x764e('0x5')]=function(_0x5699ba,_0x4a0229){for(var _0x1f717d in _0x4a0229){if(_0x5699ba['hasOwnProperty'](_0x1f717d)){_0x5699ba[_0x1f717d]=_0x4a0229[_0x1f717d];}}};Realtime[_0x764e('0x4')][_0x764e('0x6')]=function(){var _0x1040b6=this;return function(_0x3555f9){if(_0x3555f9){freeIsNotKey(_0x3555f9,_0x1040b6[_0x764e('0x1')],'id');for(var _0x3a0437=0x0,_0x379126={},_0x1119ba={};_0x3a0437<_0x3555f9['length'];_0x3a0437+=0x1){_0x379126=_0x3555f9[_0x3a0437];if(_[_0x764e('0x7')](_0x1040b6[_0x764e('0x1')][_0x379126['id']])){_0x1040b6[_0x764e('0x1')][_0x379126['id']]=new MailAccount(_0x379126);}else{_[_0x764e('0x8')](_0x1040b6[_0x764e('0x1')][_0x379126['id']],_0x379126);}}}return _0x1040b6['mailAccounts'];};};module[_0x764e('0x9')]=Realtime; \ No newline at end of file +var _0x9232=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined'];(function(_0x53d065,_0x297e83){var _0x4b4c07=function(_0x4de2a1){while(--_0x4de2a1){_0x53d065['push'](_0x53d065['shift']());}};_0x4b4c07(++_0x297e83);}(_0x9232,0x1cc));var _0x2923=function(_0x11d342,_0x58945b){_0x11d342=_0x11d342-0x0;var _0x1cfa29=_0x9232[_0x11d342];return _0x1cfa29;};'use strict';var _=require(_0x2923('0x0'));var MailAccount=require(_0x2923('0x1'));var Realtime=function(){this[_0x2923('0x2')]={};};function freeIsNotKey(_0x4208ca,_0x20b8c7,_0x530b7f){var _0x529379=_[_0x2923('0x3')](_0x4208ca,function(_0x1fbd8d,_0x15218f){return _0x1fbd8d[_0x530b7f];});for(var _0x5d9317 in _0x20b8c7){if(_0x20b8c7[_0x2923('0x4')](_0x5d9317)){if(!_0x529379[_0x5d9317]){delete _0x20b8c7[_0x5d9317];}}}}Realtime[_0x2923('0x5')][_0x2923('0x6')]=function(_0xba8e6d,_0x1d7590){for(var _0x4add9a in _0x1d7590){if(_0xba8e6d[_0x2923('0x4')](_0x4add9a)){_0xba8e6d[_0x4add9a]=_0x1d7590[_0x4add9a];}}};Realtime[_0x2923('0x5')][_0x2923('0x7')]=function(){var _0x8d9f83=this;return function(_0x558379){if(_0x558379){freeIsNotKey(_0x558379,_0x8d9f83[_0x2923('0x2')],'id');for(var _0x4d3ca1=0x0,_0x30976c={},_0x19ee7a={};_0x4d3ca1<_0x558379[_0x2923('0x8')];_0x4d3ca1+=0x1){_0x30976c=_0x558379[_0x4d3ca1];if(_[_0x2923('0x9')](_0x8d9f83['mailAccounts'][_0x30976c['id']])){_0x8d9f83['mailAccounts'][_0x30976c['id']]=new MailAccount(_0x30976c);}else{_['merge'](_0x8d9f83[_0x2923('0x2')][_0x30976c['id']],_0x30976c);}}}return _0x8d9f83[_0x2923('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 31579df..b9d90c5 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 _0x398a=['notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x10c28a,_0x56c395){var _0xd9d9f0=function(_0x2ad4cf){while(--_0x2ad4cf){_0x10c28a['push'](_0x10c28a['shift']());}};_0xd9d9f0(++_0x56c395);}(_0x398a,0x11a));var _0xa398=function(_0x62bec,_0x1ec564){_0x62bec=_0x62bec-0x0;var _0x1d337b=_0x398a[_0x62bec];return _0x1d337b;};'use strict';var client=require(_0xa398('0x0'));exports[_0xa398('0x1')]=function(){return function(){return client[_0xa398('0x2')](_0xa398('0x3'),{'options':{'attributes':['id',_0xa398('0x4'),_0xa398('0x5'),'service','email','active',_0xa398('0x6'),_0xa398('0x7'),_0xa398('0x8')],'raw':![],'include':[{'model':_0xa398('0x9'),'as':_0xa398('0xa'),'include':[{'model':_0xa398('0xb'),'attributes':['id',_0xa398('0x4'),_0xa398('0xc'),_0xa398('0xd'),_0xa398('0xe')],'as':'CloudProvider'}]},{'model':_0xa398('0xf'),'as':_0xa398('0x10'),'include':[{'model':_0xa398('0xb'),'attributes':['id',_0xa398('0x4'),_0xa398('0xc'),_0xa398('0xd'),_0xa398('0xe')],'as':'CloudProvider'}]}]},'log':_0xa398('0x11')});};};exports[_0xa398('0x12')]=function(_0x22ac95,_0x7cb233){return client[_0xa398('0x2')](_0xa398('0x13'),{'account':{'id':_0x22ac95},'body':_0x7cb233,'log':_0xa398('0x13')});}; \ No newline at end of file +var _0x29b7=['NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','TemplateId','Imap','CloudProvider','data5','MailServerOut','Smtp','type','getMailAccount','notify'];(function(_0x4360a1,_0x3439b3){var _0x4d2c0b=function(_0x213507){while(--_0x213507){_0x4360a1['push'](_0x4360a1['shift']());}};_0x4d2c0b(++_0x3439b3);}(_0x29b7,0x17d));var _0x729b=function(_0x874c48,_0x7daa86){_0x874c48=_0x874c48-0x0;var _0x27134b=_0x29b7[_0x874c48];return _0x27134b;};'use strict';var client=require('../client');exports[_0x729b('0x0')]=function(){return function(){return client[_0x729b('0x1')](_0x729b('0x2'),{'options':{'attributes':['id',_0x729b('0x3'),_0x729b('0x4'),_0x729b('0x5'),_0x729b('0x6'),_0x729b('0x7'),'key',_0x729b('0x8'),_0x729b('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x729b('0xa'),'include':[{'model':_0x729b('0xb'),'attributes':['id',_0x729b('0x3'),_0x729b('0x5'),'type',_0x729b('0xc')],'as':_0x729b('0xb')}]},{'model':_0x729b('0xd'),'as':_0x729b('0xe'),'include':[{'model':_0x729b('0xb'),'attributes':['id',_0x729b('0x3'),'service',_0x729b('0xf'),'data5'],'as':_0x729b('0xb')}]}]},'log':_0x729b('0x10')});};};exports[_0x729b('0x11')]=function(_0x54696b,_0x2f9d97){return client[_0x729b('0x1')](_0x729b('0x12'),{'account':{'id':_0x54696b},'body':_0x2f9d97,'log':_0x729b('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 684ef04..34962c2 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 _0x596f=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x58af02,_0xa918bd){var _0x163eb9=function(_0x3bb0f5){while(--_0x3bb0f5){_0x58af02['push'](_0x58af02['shift']());}};_0x163eb9(++_0xa918bd);}(_0x596f,0x108));var _0xf596=function(_0xccb381,_0x3f5dba){_0xccb381=_0xccb381-0x0;var _0x1844b8=_0x596f[_0xccb381];return _0x1844b8;};'use strict';var client=require(_0xf596('0x0'));exports[_0xf596('0x1')]=function(){return client[_0xf596('0x2')](_0xf596('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf596('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x21d1=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x2cae16,_0x1ffc84){var _0x587086=function(_0x4d641f){while(--_0x4d641f){_0x2cae16['push'](_0x2cae16['shift']());}};_0x587086(++_0x1ffc84);}(_0x21d1,0x19f));var _0x121d=function(_0x171180,_0xc9e5a3){_0x171180=_0x171180-0x0;var _0x581c61=_0x21d1[_0x171180];return _0x581c61;};'use strict';var client=require(_0x121d('0x0'));exports[_0x121d('0x1')]=function(){return client[_0x121d('0x2')](_0x121d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x121d('0x4')]},'log':_0x121d('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index de7adcb..4e448f9 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 2417473..3c7538f 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 _0xc28b=['default','../../config/socketio','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment','timeout','port','polling','redis','localhost','adapter','socket.io-redis'];(function(_0x50679b,_0x2b062d){var _0x324c86=function(_0x1886b6){while(--_0x1886b6){_0x50679b['push'](_0x50679b['shift']());}};_0x324c86(++_0x2b062d);}(_0xc28b,0x97));var _0xbc28=function(_0x409f6b,_0xf9cad){_0x409f6b=_0x409f6b-0x0;var _0xee51de=_0xc28b[_0x409f6b];return _0xee51de;};'use strict';var _=require('lodash');var http=require(_0xbc28('0x0'));var express=require('express');var sticky=require(_0xbc28('0x1'));var Redis=require(_0xbc28('0x2'));var config=require(_0xbc28('0x3'));var app=express();var server=http['createServer'](app);server[_0xbc28('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0xbc28('0x5')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xbc28('0x6')]});config[_0xbc28('0x7')]=_['defaults'](config[_0xbc28('0x7')],{'host':_0xbc28('0x8'),'port':0x18eb});socketio[_0xbc28('0x9')](require(_0xbc28('0xa'))({'pubClient':new Redis(config[_0xbc28('0x7')]),'subClient':new Redis(config[_0xbc28('0x7')])}));require('../../config/triggers')[_0xbc28('0xb')]();require(_0xbc28('0xc'))['default'](socketio);require('../../config/express')[_0xbc28('0xb')](app);require(_0xbc28('0xd'))[_0xbc28('0xb')](app);}else{server['once'](_0xbc28('0xe'),function(){console[_0xbc28('0xf')](_0xbc28('0x10'),config['port']);});}exports=module[_0xbc28('0x11')]=app; \ No newline at end of file +var _0x868e=['once','Express\x20server\x20listening\x20on\x20port\x20%d!','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x2d1bd6,_0x18ad1e){var _0x16a16b=function(_0x43c6cc){while(--_0x43c6cc){_0x2d1bd6['push'](_0x2d1bd6['shift']());}};_0x16a16b(++_0x18ad1e);}(_0x868e,0x12e));var _0xe868=function(_0x219ee4,_0x230f7b){_0x219ee4=_0x219ee4-0x0;var _0x36ea3e=_0x868e[_0x219ee4];return _0x36ea3e;};'use strict';var _=require('lodash');var http=require(_0xe868('0x0'));var express=require('express');var sticky=require(_0xe868('0x1'));var Redis=require(_0xe868('0x2'));var config=require(_0xe868('0x3'));var app=express();var server=http[_0xe868('0x4')](app);server[_0xe868('0x5')]=0xdbba0;if(sticky[_0xe868('0x6')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xe868('0x7'),_0xe868('0x8')]});config[_0xe868('0x9')]=_[_0xe868('0xa')](config[_0xe868('0x9')],{'host':_0xe868('0xb'),'port':0x18eb});socketio[_0xe868('0xc')](require(_0xe868('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xe868('0xe'))[_0xe868('0xf')]();require(_0xe868('0x10'))[_0xe868('0xf')](socketio);require(_0xe868('0x11'))['default'](app);require('../../routes')[_0xe868('0xf')](app);}else{server[_0xe868('0x12')]('listening',function(){console['log'](_0xe868('0x13'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c0f38ca..230dfe0 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 _0x6b87=['Request','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x40f98c,_0x4237f8){var _0x36b94a=function(_0x29903d){while(--_0x29903d){_0x40f98c['push'](_0x40f98c['shift']());}};_0x36b94a(++_0x4237f8);}(_0x6b87,0x173));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var jayson=require(_0x76b8('0x0'));var BPromise=require(_0x76b8('0x1'));var logger=require(_0x76b8('0x2'))(_0x76b8('0x3'));var client=jayson[_0x76b8('0x4')][_0x76b8('0x5')]({'port':0x2329});client[_0x76b8('0x6')]=function(_0x2faebf,_0x5e384b){return new BPromise(function(_0x989e22,_0x4dedd4){return client['request'](_0x2faebf,_0x5e384b)['then'](function(_0x5cebc6){logger['debug']('rpc','routing',_0x2faebf,_0x5e384b,_0x5cebc6);if(_0x5cebc6['error']){logger[_0x76b8('0x7')](_0x76b8('0x8'),_0x76b8('0x3'),_0x2faebf,_0x5cebc6[_0x76b8('0x7')][_0x76b8('0x9')],_0x5e384b);return _0x4dedd4(_0x5cebc6['error']['message']);}else{return _0x989e22(_0x5cebc6[_0x76b8('0xa')]);}})[_0x76b8('0xb')](function(_0x2861da){logger['error'](_0x76b8('0x8'),_0x76b8('0x3'),_0x2faebf,_0x2861da,_0x5e384b);return _0x4dedd4(_0x2861da);});});};module[_0x76b8('0xc')]=client; \ No newline at end of file +var _0xb4a5=['result','catch','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','error','routing'];(function(_0xd45530,_0x5e0e98){var _0x28098d=function(_0x5e9601){while(--_0x5e9601){_0xd45530['push'](_0xd45530['shift']());}};_0x28098d(++_0x5e0e98);}(_0xb4a5,0x1d6));var _0x5b4a=function(_0x142a4e,_0xfe46ed){_0x142a4e=_0x142a4e-0x0;var _0x5b2e07=_0xb4a5[_0x142a4e];return _0x5b2e07;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5b4a('0x0'));var logger=require(_0x5b4a('0x1'))('routing');var client=jayson[_0x5b4a('0x2')][_0x5b4a('0x3')]({'port':0x2329});client[_0x5b4a('0x4')]=function(_0xe50482,_0x417c2c){return new BPromise(function(_0x35454c,_0x21e960){return client[_0x5b4a('0x5')](_0xe50482,_0x417c2c)[_0x5b4a('0x6')](function(_0x3fd1d7){logger[_0x5b4a('0x7')](_0x5b4a('0x8'),'routing',_0xe50482,_0x417c2c,_0x3fd1d7);if(_0x3fd1d7[_0x5b4a('0x9')]){logger[_0x5b4a('0x9')]('rpc',_0x5b4a('0xa'),_0xe50482,_0x3fd1d7[_0x5b4a('0x9')]['message'],_0x417c2c);return _0x21e960(_0x3fd1d7[_0x5b4a('0x9')]['message']);}else{return _0x35454c(_0x3fd1d7[_0x5b4a('0xb')]);}})[_0x5b4a('0xc')](function(_0x383091){logger['error'](_0x5b4a('0x8'),'routing',_0xe50482,_0x383091,_0x417c2c);return _0x21e960(_0x383091);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 80e7366..382e5d0 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 _0xf9d4=['./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','bluebird'];(function(_0x17c2ab,_0x563ffc){var _0x191970=function(_0x2c70db){while(--_0x2c70db){_0x17c2ab['push'](_0x17c2ab['shift']());}};_0x191970(++_0x563ffc);}(_0xf9d4,0x7d));var _0x4f9d=function(_0x32f1b9,_0x478949){_0x32f1b9=_0x32f1b9-0x0;var _0x34003d=_0xf9d4[_0x32f1b9];return _0x34003d;};'use strict';var BPromise=require(_0x4f9d('0x0'));var server=require('./server');var Realtime=require(_0x4f9d('0x1'));var user=require(_0x4f9d('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x4f9d('0x3'));var chatQueue=require(_0x4f9d('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x4f9d('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4f9d('0x6')]()[_0x4f9d('0x7')](user['getAgents']())[_0x4f9d('0x7')](realtime['initAgents']())['then'](interval[_0x4f9d('0x8')]())[_0x4f9d('0x7')](realtime[_0x4f9d('0x9')]())[_0x4f9d('0x7')](openchannelQueue['getOpenchannelQueues']())[_0x4f9d('0x7')](realtime[_0x4f9d('0xa')]())['then'](chatQueue[_0x4f9d('0xb')]())[_0x4f9d('0x7')](realtime[_0x4f9d('0xc')]())[_0x4f9d('0x7')](smsQueue[_0x4f9d('0xd')]())[_0x4f9d('0x7')](realtime[_0x4f9d('0xe')]())[_0x4f9d('0x7')](mailQueue[_0x4f9d('0xf')]())['then'](realtime[_0x4f9d('0x10')]())[_0x4f9d('0x7')](faxQueue[_0x4f9d('0x11')]())[_0x4f9d('0x7')](realtime[_0x4f9d('0x12')]())[_0x4f9d('0x7')](whatsappQueue[_0x4f9d('0x13')]())['then'](realtime[_0x4f9d('0x14')]())[_0x4f9d('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x4f9d('0x7')](function(_0x539bba){return initRealtime();})[_0x4f9d('0x7')](function(_0x3a4b4c){return setInterval(initRealtime,0x1388);})['catch'](function(_0xc528f0){console['log'](_0xc528f0);});}main(); \ No newline at end of file +var _0xd419=['initMailQueues','getFaxQueues','getWhatsappQueues','catch','log','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues'];(function(_0x305022,_0x583fb0){var _0x30bf93=function(_0x4be2a6){while(--_0x4be2a6){_0x305022['push'](_0x305022['shift']());}};_0x30bf93(++_0x583fb0);}(_0xd419,0xb5));var _0x9d41=function(_0x57fc34,_0x12aa24){_0x57fc34=_0x57fc34-0x0;var _0x55b06d=_0xd419[_0x57fc34];return _0x55b06d;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x9d41('0x0'));var interval=require(_0x9d41('0x1'));var openchannelQueue=require(_0x9d41('0x2'));var chatQueue=require(_0x9d41('0x3'));var smsQueue=require(_0x9d41('0x4'));var mailQueue=require(_0x9d41('0x5'));var faxQueue=require(_0x9d41('0x6'));var whatsappQueue=require(_0x9d41('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x9d41('0x8')](user['getAgents']())[_0x9d41('0x8')](realtime[_0x9d41('0x9')]())[_0x9d41('0x8')](interval[_0x9d41('0xa')]())[_0x9d41('0x8')](realtime[_0x9d41('0xb')]())[_0x9d41('0x8')](openchannelQueue['getOpenchannelQueues']())[_0x9d41('0x8')](realtime[_0x9d41('0xc')]())[_0x9d41('0x8')](chatQueue[_0x9d41('0xd')]())['then'](realtime['initChatQueues']())[_0x9d41('0x8')](smsQueue[_0x9d41('0xe')]())[_0x9d41('0x8')](realtime[_0x9d41('0xf')]())['then'](mailQueue[_0x9d41('0x10')]())[_0x9d41('0x8')](realtime[_0x9d41('0x11')]())[_0x9d41('0x8')](faxQueue[_0x9d41('0x12')]())[_0x9d41('0x8')](realtime['initFaxQueues']())[_0x9d41('0x8')](whatsappQueue[_0x9d41('0x13')]())[_0x9d41('0x8')](realtime['initWhatsappQueues']())[_0x9d41('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x9d41('0x8')](function(_0x56dfaf){return initRealtime();})[_0x9d41('0x8')](function(_0x178998){return setInterval(initRealtime,0x1388);})[_0x9d41('0x14')](function(_0x1087db){console[_0x9d41('0x15')](_0x1087db);});}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 d805158..3101d75 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x8f1829,_0xe2f062){var _0x5bbe22=function(_0xadd755){while(--_0xadd755){_0x8f1829['push'](_0x8f1829['shift']());}};_0x5bbe22(++_0xe2f062);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x2abf7f,_0x23b05a){var _0x248bce=function(_0x4c836d){while(--_0x4c836d){_0x2abf7f['push'](_0x2abf7f['shift']());}};_0x248bce(++_0x23b05a);}(_0x326f,0xd1));var _0xf326=function(_0x1e3ec2,_0x238434){_0x1e3ec2=_0x1e3ec2-0x0;var _0x1775aa=_0x326f[_0x1e3ec2];return _0x1775aa;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 737ddb3..cae5e4d 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 _0x20a8=['error','catch','sendMailMessage','jayson/promise','client','http','request','then'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0x20a8,0x83));var _0x820a=function(_0x32d6ca,_0x1cb6c9){_0x32d6ca=_0x32d6ca-0x0;var _0x223aa8=_0x20a8[_0x32d6ca];return _0x223aa8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x820a('0x0'));var client=jayson[_0x820a('0x1')][_0x820a('0x2')]({'port':0x232b});function request(_0x2fe358,_0xc284ba){return new BPromise(function(_0x16b827,_0x1247e5){return client[_0x820a('0x3')](_0x2fe358,_0xc284ba)[_0x820a('0x4')](function(_0x4ec222){if(_0x4ec222[_0x820a('0x5')]){return _0x1247e5(_0x4ec222['error']['message']);}else{return _0x16b827(_0x4ec222['result']);}})[_0x820a('0x6')](function(_0x17b747){return _0x1247e5(_0x17b747);});});}exports[_0x820a('0x7')]=function(_0xf0d3a2,_0x54abbe){return request('SendMail',{'account':_0xf0d3a2,'message':_0x54abbe});}; \ No newline at end of file +var _0x8995=['sendMailMessage','bluebird','jayson/promise','http','request','then','error','message','result','catch'];(function(_0x4852ff,_0x35118d){var _0x3ee92e=function(_0x37de82){while(--_0x37de82){_0x4852ff['push'](_0x4852ff['shift']());}};_0x3ee92e(++_0x35118d);}(_0x8995,0x105));var _0x5899=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x8995[_0xda464c];return _0x19e222;};'use strict';var BPromise=require(_0x5899('0x0'));var jayson=require(_0x5899('0x1'));var client=jayson['client'][_0x5899('0x2')]({'port':0x232b});function request(_0x5004fd,_0xe3fb04){return new BPromise(function(_0x1d217c,_0x2d0aee){return client[_0x5899('0x3')](_0x5004fd,_0xe3fb04)[_0x5899('0x4')](function(_0x50d40b){if(_0x50d40b['error']){return _0x2d0aee(_0x50d40b[_0x5899('0x5')][_0x5899('0x6')]);}else{return _0x1d217c(_0x50d40b[_0x5899('0x7')]);}})[_0x5899('0x8')](function(_0x8b93fc){return _0x2d0aee(_0x8b93fc);});});}exports[_0x5899('0x9')]=function(_0x444c3c,_0x2676a9){return request('SendMail',{'account':_0x444c3c,'message':_0x2676a9});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 7364e47..0ea6c52 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 _0xfb11=['openchannelCapacity','busyQueue','md5','chatWaitingInteractions','mailWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatusTime','smsCurrentCapacity','openchannelCurrentCapacity','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','moment','ioredis','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xfb11[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x1fb1('0x0'));var md5=require('md5');var moment=require(_0x1fb1('0x1'));var Redis=require(_0x1fb1('0x2'));var config=require('../../../config/environment');config[_0x1fb1('0x3')]=_['defaults'](config[_0x1fb1('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1fb1('0x4'))(new Redis(config[_0x1fb1('0x3')]));function Agent(_0x5af469){this['id']=_0x5af469['id']||0x0;this[_0x1fb1('0x5')]=_0x5af469[_0x1fb1('0x5')]||'';this['online']=_0x5af469[_0x1fb1('0x6')]||!![];this[_0x1fb1('0x7')]=_0x5af469[_0x1fb1('0x7')]||![];this[_0x1fb1('0x8')]=_0x5af469[_0x1fb1('0x8')]||![];this[_0x1fb1('0x9')]=_0x5af469[_0x1fb1('0x9')]||![];this[_0x1fb1('0xa')]=_0x5af469[_0x1fb1('0xa')]||![];this[_0x1fb1('0xb')]=_0x5af469['smsPause']||![];this[_0x1fb1('0xc')]=_0x5af469['openchannelPause']||![];this[_0x1fb1('0xd')]='unknown';this[_0x1fb1('0xe')]=0x0;this[_0x1fb1('0xf')]=_0x5af469[_0x1fb1('0xf')]||0x0;this[_0x1fb1('0x10')]=0x0;this[_0x1fb1('0x11')]=_0x1fb1('0x12');this['mailStatusTime']=0x0;this[_0x1fb1('0x13')]=_0x5af469[_0x1fb1('0x13')]||0x0;this[_0x1fb1('0x14')]=0x0;this[_0x1fb1('0x15')]=_0x1fb1('0x12');this[_0x1fb1('0x16')]=0x0;this[_0x1fb1('0x17')]=_0x5af469[_0x1fb1('0x17')]||0x0;this[_0x1fb1('0x18')]=0x0;this['smsStatus']='unknown';this[_0x1fb1('0x19')]=0x0;this[_0x1fb1('0x1a')]=_0x5af469[_0x1fb1('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x1fb1('0x1b')]=_0x1fb1('0x12');this[_0x1fb1('0x1c')]=0x0;this[_0x1fb1('0x1d')]=_0x5af469[_0x1fb1('0x1d')]||0x0;this[_0x1fb1('0x1e')]=0x0;this[_0x1fb1('0x1f')]=_0x1fb1('0x12');this[_0x1fb1('0x20')]=0x0;this['openchannelCapacity']=_0x5af469[_0x1fb1('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x1fb1('0x22')]=undefined;this[_0x1fb1('0x23')]='';this[_0x1fb1('0x24')]={};this['faxWaitingInteractions']={};this[_0x1fb1('0x25')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0x1fb1('0x26')]();}Agent[_0x1fb1('0x27')][_0x1fb1('0x28')]=function(_0x10924f){if(this[_0x10924f+_0x1fb1('0x29')]>0x0){if(this[_0x10924f+'Capacity']>0x0&&this[_0x10924f+_0x1fb1('0x29')]>=this[_0x10924f+_0x1fb1('0x2a')]){return _0x1fb1('0x2b');}else{return _0x1fb1('0x2c');}}else{return _0x1fb1('0x2d');}};Agent[_0x1fb1('0x27')][_0x1fb1('0x26')]=function(){var _0x2de1d4=['mail',_0x1fb1('0x2e'),_0x1fb1('0x2f'),_0x1fb1('0x30'),_0x1fb1('0x31'),_0x1fb1('0x32')];for(var _0x29e1bd=0x0;_0x29e1bd<_0x2de1d4[_0x1fb1('0x33')];_0x29e1bd+=0x1){var _0x15992c=this[_0x1fb1('0x28')](_0x2de1d4[_0x29e1bd]);if(this[_0x2de1d4[_0x29e1bd]+_0x1fb1('0x34')]!==_0x15992c){this[_0x2de1d4[_0x29e1bd]+_0x1fb1('0x35')]=_[_0x1fb1('0x36')](moment()[_0x1fb1('0x37')]('x'));}this[_0x2de1d4[_0x29e1bd]+_0x1fb1('0x34')]=_0x15992c;}var _0x2f6c88={'id':this['id'],'name':this['name'],'online':this[_0x1fb1('0x6')],'voicePause':this[_0x1fb1('0x7')],'chatPause':this[_0x1fb1('0x8')],'mailPause':this[_0x1fb1('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x1fb1('0xa')],'openchannelPause':this[_0x1fb1('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x1fb1('0xe')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x1fb1('0x11')],'mailStatusTime':this[_0x1fb1('0x38')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x1fb1('0x14')],'faxStatus':this[_0x1fb1('0x15')],'faxStatusTime':this[_0x1fb1('0x16')],'faxCapacity':this[_0x1fb1('0x17')],'faxCurrentCapacity':this[_0x1fb1('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1fb1('0x19')],'smsCapacity':this[_0x1fb1('0x1a')],'smsCurrentCapacity':this[_0x1fb1('0x39')],'whatsappStatus':this[_0x1fb1('0x1b')],'whatsappStatusTime':this[_0x1fb1('0x1c')],'whatsappCapacity':this[_0x1fb1('0x1d')],'whatsappCurrentCapacity':this[_0x1fb1('0x1e')],'openchannelStatus':this[_0x1fb1('0x1f')],'openchannelStatusTime':this[_0x1fb1('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x1fb1('0x3a')],'busy':this['busy'],'busyQueue':this[_0x1fb1('0x22')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x1fb1('0x3b')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x1fb1('0x3c')],'whatsappWaitingInteractions':this[_0x1fb1('0x3d')]};var _0x30df85=md5(JSON[_0x1fb1('0x3e')](_0x2f6c88));if(this['md5']!==_0x30df85){this[_0x1fb1('0x23')]=_0x30df85;io[_0x1fb1('0x3f')](_0x1fb1('0x40'),_['omit'](_0x2f6c88,[_0x1fb1('0x6')]));}};module[_0x1fb1('0x41')]=Agent; \ No newline at end of file +var _0x7046=['socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','length','StatusTime','toNumber','faxStatusTime','smsStatus','whatsappStatus','openchannelStatus','openchannelWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','defaults'];(function(_0x342124,_0x5bc1de){var _0x3117ee=function(_0x23baea){while(--_0x23baea){_0x342124['push'](_0x342124['shift']());}};_0x3117ee(++_0x5bc1de);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x6704('0x0'));var md5=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var Redis=require(_0x6704('0x3'));var config=require('../../../config/environment');config[_0x6704('0x4')]=_[_0x6704('0x5')](config[_0x6704('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x6704('0x6'))(new Redis(config[_0x6704('0x4')]));function Agent(_0x3f4169){this['id']=_0x3f4169['id']||0x0;this[_0x6704('0x7')]=_0x3f4169[_0x6704('0x7')]||'';this['online']=_0x3f4169[_0x6704('0x8')]||!![];this['voicePause']=_0x3f4169['voicePause']||![];this[_0x6704('0x9')]=_0x3f4169['chatPause']||![];this['mailPause']=_0x3f4169[_0x6704('0xa')]||![];this[_0x6704('0xb')]=_0x3f4169[_0x6704('0xb')]||![];this[_0x6704('0xc')]=_0x3f4169[_0x6704('0xc')]||![];this[_0x6704('0xd')]=_0x3f4169[_0x6704('0xd')]||![];this[_0x6704('0xe')]='unknown';this[_0x6704('0xf')]=0x0;this[_0x6704('0x10')]=_0x3f4169['chatCapacity']||0x0;this[_0x6704('0x11')]=0x0;this[_0x6704('0x12')]=_0x6704('0x13');this[_0x6704('0x14')]=0x0;this[_0x6704('0x15')]=_0x3f4169[_0x6704('0x15')]||0x0;this[_0x6704('0x16')]=0x0;this[_0x6704('0x17')]=_0x6704('0x13');this['faxStatusTime']=0x0;this[_0x6704('0x18')]=_0x3f4169[_0x6704('0x18')]||0x0;this[_0x6704('0x19')]=0x0;this['smsStatus']=_0x6704('0x13');this[_0x6704('0x1a')]=0x0;this[_0x6704('0x1b')]=_0x3f4169[_0x6704('0x1b')]||0x0;this[_0x6704('0x1c')]=0x0;this['whatsappStatus']=_0x6704('0x13');this[_0x6704('0x1d')]=0x0;this[_0x6704('0x1e')]=_0x3f4169[_0x6704('0x1e')]||0x0;this[_0x6704('0x1f')]=0x0;this['openchannelStatus']=_0x6704('0x13');this[_0x6704('0x20')]=0x0;this[_0x6704('0x21')]=_0x3f4169[_0x6704('0x21')]||0x0;this[_0x6704('0x22')]=0x0;this[_0x6704('0x23')]=![];this[_0x6704('0x24')]=undefined;this['md5']='';this[_0x6704('0x25')]={};this[_0x6704('0x26')]={};this[_0x6704('0x27')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x6704('0x28')]={};this[_0x6704('0x29')]();}Agent[_0x6704('0x2a')][_0x6704('0x2b')]=function(_0x41f89e){if(this[_0x41f89e+'CurrentCapacity']>0x0){if(this[_0x41f89e+_0x6704('0x2c')]>0x0&&this[_0x41f89e+_0x6704('0x2d')]>=this[_0x41f89e+_0x6704('0x2c')]){return _0x6704('0x2e');}else{return _0x6704('0x2f');}}else{return _0x6704('0x30');}};Agent[_0x6704('0x2a')][_0x6704('0x29')]=function(){var _0x896227=[_0x6704('0x31'),_0x6704('0x32'),_0x6704('0x33'),_0x6704('0x34'),'sms','whatsapp'];for(var _0x167312=0x0;_0x167312<_0x896227[_0x6704('0x35')];_0x167312+=0x1){var _0x86fc1d=this[_0x6704('0x2b')](_0x896227[_0x167312]);if(this[_0x896227[_0x167312]+'Status']!==_0x86fc1d){this[_0x896227[_0x167312]+_0x6704('0x36')]=_[_0x6704('0x37')](moment()['format']('x'));}this[_0x896227[_0x167312]+'Status']=_0x86fc1d;}var _0x16e749={'id':this['id'],'name':this['name'],'online':this[_0x6704('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x6704('0xa')],'smsPause':this[_0x6704('0xc')],'faxPause':this[_0x6704('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6704('0xe')],'chatStatusTime':this[_0x6704('0xf')],'chatCapacity':this[_0x6704('0x10')],'chatCurrentCapacity':this[_0x6704('0x11')],'mailStatus':this[_0x6704('0x12')],'mailStatusTime':this[_0x6704('0x14')],'mailCapacity':this[_0x6704('0x15')],'mailCurrentCapacity':this[_0x6704('0x16')],'faxStatus':this[_0x6704('0x17')],'faxStatusTime':this[_0x6704('0x38')],'faxCapacity':this[_0x6704('0x18')],'faxCurrentCapacity':this[_0x6704('0x19')],'smsStatus':this[_0x6704('0x39')],'smsStatusTime':this[_0x6704('0x1a')],'smsCapacity':this[_0x6704('0x1b')],'smsCurrentCapacity':this[_0x6704('0x1c')],'whatsappStatus':this[_0x6704('0x3a')],'whatsappStatusTime':this[_0x6704('0x1d')],'whatsappCapacity':this[_0x6704('0x1e')],'whatsappCurrentCapacity':this[_0x6704('0x1f')],'openchannelStatus':this[_0x6704('0x3b')],'openchannelStatusTime':this[_0x6704('0x20')],'openchannelCapacity':this[_0x6704('0x21')],'openchannelCurrentCapacity':this[_0x6704('0x22')],'busy':this[_0x6704('0x23')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x6704('0x27')],'openchannelWaitingInteractions':this[_0x6704('0x3c')],'smsWaitingInteractions':this[_0x6704('0x3d')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x1c3cd9=md5(JSON['stringify'](_0x16e749));if(this[_0x6704('0x1')]!==_0x1c3cd9){this[_0x6704('0x1')]=_0x1c3cd9;io[_0x6704('0x3e')](_0x6704('0x3f'),_[_0x6704('0x40')](_0x16e749,[_0x6704('0x8')]));}};module[_0x6704('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 70f0ab4..2243728 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 _0xced7=['redis','defaults','localhost','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','length','online','chatPause','paused','available','stringify','name','emit','chat_queue:save','lodash','md5','util','../../../config/environment'];(function(_0x590a00,_0x5cd30a){var _0x47533f=function(_0x6e67e9){while(--_0x6e67e9){_0x590a00['push'](_0x590a00['shift']());}};_0x47533f(++_0x5cd30a);}(_0xced7,0xb9));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ced('0x0'));var md5=require(_0x7ced('0x1'));var util=require(_0x7ced('0x2'));var Redis=require('ioredis');var config=require(_0x7ced('0x3'));config[_0x7ced('0x4')]=_[_0x7ced('0x5')](config[_0x7ced('0x4')],{'host':_0x7ced('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7ced('0x4')]));function ChatQueue(_0x5a9320){this['id']=_0x5a9320['id']||0x0;this['name']=_0x5a9320['name']||'';this[_0x7ced('0x7')]=_0x5a9320[_0x7ced('0x7')]||0xa;this[_0x7ced('0x8')]=_0x5a9320[_0x7ced('0x8')]||_0x7ced('0x9');this[_0x7ced('0xa')]=_0x5a9320[_0x7ced('0xa')];this['mapAgentsId']={};this[_0x7ced('0xb')]=0x0;this[_0x7ced('0x1')]='';this[_0x7ced('0xc')]();this['updateRealtime']();}ChatQueue[_0x7ced('0xd')][_0x7ced('0xc')]=function(){var _0x1107ff=this[_0x7ced('0xe')][_0x7ced('0xf')];this[_0x7ced('0xe')]=_[_0x7ced('0x10')](this[_0x7ced('0xa')],'id');this[_0x7ced('0xe')][_0x7ced('0xf')]=_0x1107ff;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x7ced('0x11')]=0x0;this['paused']=0x0;for(var _0x145884=0x0;_0x145884=0x0?this[_0x7ced('0x16')]:0x0;var _0x4d350e={'id':this['id'],'available':this[_0x7ced('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x7ced('0x15')],'waiting':this[_0x7ced('0xb')]};var _0x2d23ee=md5(JSON[_0x7ced('0x17')](_0x4d350e));if(this[_0x7ced('0x1')]!==_0x2d23ee){this['md5']=_0x2d23ee;io['to'](util['format']('chat:queue:%s',_0x4d350e[_0x7ced('0x18')]))[_0x7ced('0x19')](_0x7ced('0x1a'),_0x4d350e);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xabd7=['available','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','online','chatPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabd7,0x1b7));var _0x7abd=function(_0x132b0b,_0x3ec8d2){_0x132b0b=_0x132b0b-0x0;var _0x528500=_0xabd7[_0x132b0b];return _0x528500;};'use strict';var _=require(_0x7abd('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7abd('0x1'));var config=require(_0x7abd('0x2'));config[_0x7abd('0x3')]=_[_0x7abd('0x4')](config['redis'],{'host':_0x7abd('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7abd('0x3')]));function ChatQueue(_0x28699b){this['id']=_0x28699b['id']||0x0;this[_0x7abd('0x6')]=_0x28699b[_0x7abd('0x6')]||'';this['timeout']=_0x28699b[_0x7abd('0x7')]||0xa;this['strategy']=_0x28699b[_0x7abd('0x8')]||'beepall';this[_0x7abd('0x9')]=_0x28699b[_0x7abd('0x9')];this[_0x7abd('0xa')]={};this['waiting']=0x0;this[_0x7abd('0xb')]='';this['updateRouting']();this[_0x7abd('0xc')]();}ChatQueue[_0x7abd('0xd')][_0x7abd('0xe')]=function(){var _0x4630ef=this[_0x7abd('0xa')][_0x7abd('0xf')];this[_0x7abd('0xa')]=_['map'](this[_0x7abd('0x9')],'id');this[_0x7abd('0xa')][_0x7abd('0xf')]=_0x4630ef;};ChatQueue[_0x7abd('0xd')][_0x7abd('0xc')]=function(){this[_0x7abd('0x10')]=0x0;this[_0x7abd('0x11')]=0x0;for(var _0xd1a13d=0x0;_0xd1a13d=0x0?this[_0x7abd('0x14')]:0x0;var _0x307076={'id':this['id'],'available':this[_0x7abd('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x7abd('0x6')],'paused':this[_0x7abd('0x11')],'waiting':this[_0x7abd('0x15')]};var _0x350f8c=md5(JSON['stringify'](_0x307076));if(this[_0x7abd('0xb')]!==_0x350f8c){this[_0x7abd('0xb')]=_0x350f8c;io['to'](util[_0x7abd('0x16')](_0x7abd('0x17'),_0x307076[_0x7abd('0x6')]))[_0x7abd('0x18')](_0x7abd('0x19'),_0x307076);}};module[_0x7abd('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 875f6e0..5b77f54 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 _0xa30e=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5'];(function(_0x4a833b,_0x122bbb){var _0x2babc9=function(_0x16441f){while(--_0x16441f){_0x4a833b['push'](_0x4a833b['shift']());}};_0x2babc9(++_0x122bbb);}(_0xa30e,0x1a2));var _0xea30=function(_0x17266e,_0x5d273d){_0x17266e=_0x17266e-0x0;var _0x8eeaf4=_0xa30e[_0x17266e];return _0x8eeaf4;};'use strict';var _=require(_0xea30('0x0'));var md5=require(_0xea30('0x1'));var util=require('util');var Redis=require(_0xea30('0x2'));var config=require(_0xea30('0x3'));config[_0xea30('0x4')]=_[_0xea30('0x5')](config[_0xea30('0x4')],{'host':_0xea30('0x6'),'port':0x18eb});var io=require(_0xea30('0x7'))(new Redis(config[_0xea30('0x4')]));function FaxQueue(_0x585aa9){this['id']=_0x585aa9['id']||0x0;this[_0xea30('0x8')]=_0x585aa9[_0xea30('0x8')]||'';this[_0xea30('0x9')]=_0x585aa9[_0xea30('0x9')]||0xa;this['strategy']=_0x585aa9[_0xea30('0xa')]||_0xea30('0xb');this[_0xea30('0xc')]=_0x585aa9[_0xea30('0xc')];this[_0xea30('0xd')]={};this[_0xea30('0xe')]=0x0;this[_0xea30('0x1')]='';this[_0xea30('0xf')]();this[_0xea30('0x10')]();}FaxQueue[_0xea30('0x11')][_0xea30('0xf')]=function(){var _0x30a012=this[_0xea30('0xd')]['_rr'];this[_0xea30('0xd')]=_[_0xea30('0x12')](this[_0xea30('0xc')],'id');this[_0xea30('0xd')][_0xea30('0x13')]=_0x30a012;};FaxQueue[_0xea30('0x11')]['updateRealtime']=function(){this[_0xea30('0x14')]=0x0;this[_0xea30('0x15')]=0x0;for(var _0x14fa5b=0x0;_0x14fa5b=0x0?this['available']:0x0;var _0x3f3c2a={'id':this['id'],'available':this['available'],'loggedIn':this[_0xea30('0x14')],'name':this[_0xea30('0x8')],'paused':this[_0xea30('0x15')],'waiting':this['waiting']};var _0x2578be=md5(JSON[_0xea30('0x18')](_0x3f3c2a));if(this['md5']!==_0x2578be){this[_0xea30('0x1')]=_0x2578be;io['to'](util[_0xea30('0x19')](_0xea30('0x1a'),_0x3f3c2a[_0xea30('0x8')]))[_0xea30('0x1b')](_0xea30('0x1c'),_0x3f3c2a);}};module[_0xea30('0x1d')]=FaxQueue; \ No newline at end of file +var _0xb2f9=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','ioredis'];(function(_0x495cdf,_0x4b8821){var _0x458947=function(_0x54a5ee){while(--_0x54a5ee){_0x495cdf['push'](_0x495cdf['shift']());}};_0x458947(++_0x4b8821);}(_0xb2f9,0x1c8));var _0x9b2f=function(_0x55095f,_0x4a33df){_0x55095f=_0x55095f-0x0;var _0xba795a=_0xb2f9[_0x55095f];return _0xba795a;};'use strict';var _=require(_0x9b2f('0x0'));var md5=require(_0x9b2f('0x1'));var util=require('util');var Redis=require(_0x9b2f('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x9b2f('0x3')],{'host':_0x9b2f('0x4'),'port':0x18eb});var io=require(_0x9b2f('0x5'))(new Redis(config[_0x9b2f('0x3')]));function FaxQueue(_0x5b60d1){this['id']=_0x5b60d1['id']||0x0;this['name']=_0x5b60d1[_0x9b2f('0x6')]||'';this[_0x9b2f('0x7')]=_0x5b60d1['timeout']||0xa;this[_0x9b2f('0x8')]=_0x5b60d1[_0x9b2f('0x8')]||_0x9b2f('0x9');this[_0x9b2f('0xa')]=_0x5b60d1['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9b2f('0x1')]='';this[_0x9b2f('0xb')]();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x55ea7a=this[_0x9b2f('0xc')][_0x9b2f('0xd')];this[_0x9b2f('0xc')]=_[_0x9b2f('0xe')](this[_0x9b2f('0xa')],'id');this['mapAgentsId'][_0x9b2f('0xd')]=_0x55ea7a;};FaxQueue[_0x9b2f('0xf')][_0x9b2f('0x10')]=function(){this[_0x9b2f('0x11')]=0x0;this[_0x9b2f('0x12')]=0x0;for(var _0x5e5b5c=0x0;_0x5e5b5c=0x0?this[_0x9b2f('0x15')]:0x0;var _0x45d59a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9b2f('0x11')],'name':this[_0x9b2f('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x302e6f=md5(JSON[_0x9b2f('0x16')](_0x45d59a));if(this['md5']!==_0x302e6f){this[_0x9b2f('0x1')]=_0x302e6f;io['to'](util[_0x9b2f('0x17')]('fax:queue:%s',_0x45d59a[_0x9b2f('0x6')]))[_0x9b2f('0x18')](_0x9b2f('0x19'),_0x45d59a);}};module[_0x9b2f('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d4836f0..e205950 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 _0xc50b=['Intervals','name'];(function(_0x48c3bd,_0x4ccd82){var _0x18631b=function(_0x4142a6){while(--_0x4142a6){_0x48c3bd['push'](_0x48c3bd['shift']());}};_0x18631b(++_0x4ccd82);}(_0xc50b,0x157));var _0xbc50=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xc50b[_0x4b174a];return _0x3cd7bf;};'use strict';function Interval(_0x2a60a5){this['id']=_0x2a60a5['id']||0x0;this[_0xbc50('0x0')]=_0x2a60a5[_0xbc50('0x0')]||'';this[_0xbc50('0x1')]=_0x2a60a5[_0xbc50('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xe716=['Intervals','exports','name'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe716,0x146));var _0x6e71=function(_0x386209,_0x578bad){_0x386209=_0x386209-0x0;var _0x2d538e=_0xe716[_0x386209];return _0x2d538e;};'use strict';function Interval(_0x34532){this['id']=_0x34532['id']||0x0;this[_0x6e71('0x0')]=_0x34532[_0x6e71('0x0')]||'';this[_0x6e71('0x1')]=_0x34532['Intervals']||{};}module[_0x6e71('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 936b4e8..ff6bdfc 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 _0x0d12=['Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','mailPause','available','waiting','stringify','mail:queue:%s','emit','mail_queue:save','exports','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x4549eb,_0x1298ef){var _0x4ebb9e=function(_0x36baa2){while(--_0x36baa2){_0x4549eb['push'](_0x4549eb['shift']());}};_0x4ebb9e(++_0x1298ef);}(_0x0d12,0x1dd));var _0x20d1=function(_0x48d245,_0x4e9a58){_0x48d245=_0x48d245-0x0;var _0x3b48f9=_0x0d12[_0x48d245];return _0x3b48f9;};'use strict';var _=require('lodash');var md5=require(_0x20d1('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x20d1('0x1'));config[_0x20d1('0x2')]=_['defaults'](config[_0x20d1('0x2')],{'host':_0x20d1('0x3'),'port':0x18eb});var io=require(_0x20d1('0x4'))(new Redis(config[_0x20d1('0x2')]));function MailQueue(_0x123d63){this['id']=_0x123d63['id']||0x0;this[_0x20d1('0x5')]=_0x123d63[_0x20d1('0x5')]||'';this[_0x20d1('0x6')]=_0x123d63[_0x20d1('0x6')]||0xa;this['strategy']=_0x123d63[_0x20d1('0x7')]||_0x20d1('0x8');this[_0x20d1('0x9')]=_0x123d63[_0x20d1('0x9')];this[_0x20d1('0xa')]={};this['waiting']=0x0;this[_0x20d1('0x0')]='';this[_0x20d1('0xb')]();this[_0x20d1('0xc')]();}MailQueue[_0x20d1('0xd')]['updateRouting']=function(){var _0x3e3ecb=this[_0x20d1('0xa')][_0x20d1('0xe')];this[_0x20d1('0xa')]=_[_0x20d1('0xf')](this[_0x20d1('0x9')],'id');this[_0x20d1('0xa')][_0x20d1('0xe')]=_0x3e3ecb;};MailQueue[_0x20d1('0xd')][_0x20d1('0xc')]=function(){this[_0x20d1('0x10')]=0x0;this[_0x20d1('0x11')]=0x0;for(var _0x4fbdf5=0x0;_0x4fbdf5=0x0?this[_0x20d1('0x14')]:0x0;var _0x19f797={'id':this['id'],'available':this['available'],'loggedIn':this[_0x20d1('0x10')],'name':this[_0x20d1('0x5')],'paused':this['paused'],'waiting':this[_0x20d1('0x15')]};var _0x4bfbdf=md5(JSON[_0x20d1('0x16')](_0x19f797));if(this[_0x20d1('0x0')]!==_0x4bfbdf){this[_0x20d1('0x0')]=_0x4bfbdf;io['to'](util['format'](_0x20d1('0x17'),_0x19f797[_0x20d1('0x5')]))[_0x20d1('0x18')](_0x20d1('0x19'),_0x19f797);}};module[_0x20d1('0x1a')]=MailQueue; \ No newline at end of file +var _0xe867=['mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','Agents'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xe867,0x6b));var _0x7e86=function(_0x4f7fa5,_0x1a4b48){_0x4f7fa5=_0x4f7fa5-0x0;var _0x2462d3=_0xe867[_0x4f7fa5];return _0x2462d3;};'use strict';var _=require(_0x7e86('0x0'));var md5=require('md5');var util=require(_0x7e86('0x1'));var Redis=require(_0x7e86('0x2'));var config=require('../../../config/environment');config[_0x7e86('0x3')]=_[_0x7e86('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e86('0x5'))(new Redis(config[_0x7e86('0x3')]));function MailQueue(_0x988c60){this['id']=_0x988c60['id']||0x0;this[_0x7e86('0x6')]=_0x988c60[_0x7e86('0x6')]||'';this[_0x7e86('0x7')]=_0x988c60['timeout']||0xa;this['strategy']=_0x988c60['strategy']||'beepall';this[_0x7e86('0x8')]=_0x988c60[_0x7e86('0x8')];this[_0x7e86('0x9')]={};this[_0x7e86('0xa')]=0x0;this[_0x7e86('0xb')]='';this[_0x7e86('0xc')]();this['updateRealtime']();}MailQueue[_0x7e86('0xd')][_0x7e86('0xc')]=function(){var _0x238a9a=this[_0x7e86('0x9')][_0x7e86('0xe')];this[_0x7e86('0x9')]=_[_0x7e86('0xf')](this[_0x7e86('0x8')],'id');this['mapAgentsId']['_rr']=_0x238a9a;};MailQueue[_0x7e86('0xd')][_0x7e86('0x10')]=function(){this[_0x7e86('0x11')]=0x0;this[_0x7e86('0x12')]=0x0;for(var _0x5d3743=0x0;_0x5d3743=0x0?this[_0x7e86('0x16')]:0x0;var _0x31dafd={'id':this['id'],'available':this[_0x7e86('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x7e86('0x12')],'waiting':this[_0x7e86('0xa')]};var _0x216e34=md5(JSON[_0x7e86('0x17')](_0x31dafd));if(this[_0x7e86('0xb')]!==_0x216e34){this[_0x7e86('0xb')]=_0x216e34;io['to'](util[_0x7e86('0x18')](_0x7e86('0x19'),_0x31dafd[_0x7e86('0x6')]))[_0x7e86('0x1a')](_0x7e86('0x1b'),_0x31dafd);}};module[_0x7e86('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3ce7892..587747d 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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x326f,0xd1));var _0xf326=function(_0x34ea72,_0x44da8a){_0x34ea72=_0x34ea72-0x0;var _0x54170c=_0x326f[_0x34ea72];return _0x54170c;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a54,0x106));var _0x47a5=function(_0xb3a9bb,_0xfac4ea){_0xb3a9bb=_0xb3a9bb-0x0;var _0x540cad=_0x7a54[_0xb3a9bb];return _0x540cad;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b1f5795..b88a465 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 _0x7aaf=['_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','util','ioredis','defaults','localhost','redis','name','timeout','beepall','Agents','md5','updateRouting','updateRealtime'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x188a10,_0x47dcb4){_0x188a10=_0x188a10-0x0;var _0x170f1e=_0x7aaf[_0x188a10];return _0x170f1e;};'use strict';var _=require(_0xf7aa('0x0'));var md5=require('md5');var util=require(_0xf7aa('0x1'));var Redis=require(_0xf7aa('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xf7aa('0x3')](config['redis'],{'host':_0xf7aa('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf7aa('0x5')]));function SmsQueue(_0x20dc82){this['id']=_0x20dc82['id']||0x0;this[_0xf7aa('0x6')]=_0x20dc82[_0xf7aa('0x6')]||'';this['timeout']=_0x20dc82[_0xf7aa('0x7')]||0xa;this['strategy']=_0x20dc82['strategy']||_0xf7aa('0x8');this[_0xf7aa('0x9')]=_0x20dc82['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf7aa('0xa')]='';this[_0xf7aa('0xb')]();this[_0xf7aa('0xc')]();}SmsQueue['prototype'][_0xf7aa('0xb')]=function(){var _0x5a7b21=this['mapAgentsId'][_0xf7aa('0xd')];this[_0xf7aa('0xe')]=_[_0xf7aa('0xf')](this[_0xf7aa('0x9')],'id');this[_0xf7aa('0xe')][_0xf7aa('0xd')]=_0x5a7b21;};SmsQueue[_0xf7aa('0x10')][_0xf7aa('0xc')]=function(){this[_0xf7aa('0x11')]=0x0;this[_0xf7aa('0x12')]=0x0;for(var _0x5d3ed3=0x0;_0x5d3ed3=0x0?this[_0xf7aa('0x16')]:0x0;var _0x305d6e={'id':this['id'],'available':this[_0xf7aa('0x16')],'loggedIn':this[_0xf7aa('0x11')],'name':this[_0xf7aa('0x6')],'paused':this[_0xf7aa('0x12')],'waiting':this['waiting']};var _0x59b540=md5(JSON[_0xf7aa('0x17')](_0x305d6e));if(this['md5']!==_0x59b540){this[_0xf7aa('0xa')]=_0x59b540;io['to'](util[_0xf7aa('0x18')](_0xf7aa('0x19'),_0x305d6e['name']))['emit'](_0xf7aa('0x1a'),_0x305d6e);}};module[_0xf7aa('0x1b')]=SmsQueue; \ No newline at end of file +var _0x919e=['stringify','format','emit','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','paused','available'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var md5=require(_0xe919('0x1'));var util=require(_0xe919('0x2'));var Redis=require('ioredis');var config=require(_0xe919('0x3'));config['redis']=_['defaults'](config[_0xe919('0x4')],{'host':_0xe919('0x5'),'port':0x18eb});var io=require(_0xe919('0x6'))(new Redis(config[_0xe919('0x4')]));function SmsQueue(_0x2171e9){this['id']=_0x2171e9['id']||0x0;this[_0xe919('0x7')]=_0x2171e9[_0xe919('0x7')]||'';this['timeout']=_0x2171e9[_0xe919('0x8')]||0xa;this[_0xe919('0x9')]=_0x2171e9['strategy']||_0xe919('0xa');this['Agents']=_0x2171e9[_0xe919('0xb')];this[_0xe919('0xc')]={};this[_0xe919('0xd')]=0x0;this['md5']='';this[_0xe919('0xe')]();this[_0xe919('0xf')]();}SmsQueue[_0xe919('0x10')]['updateRouting']=function(){var _0x12098d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xe919('0x11')](this[_0xe919('0xb')],'id');this[_0xe919('0xc')]['_rr']=_0x12098d;};SmsQueue['prototype'][_0xe919('0xf')]=function(){this[_0xe919('0x12')]=0x0;this['paused']=0x0;for(var _0x3c09be=0x0;_0x3c09be=0x0?this['available']:0x0;var _0x5250b9={'id':this['id'],'available':this[_0xe919('0x16')],'loggedIn':this[_0xe919('0x12')],'name':this[_0xe919('0x7')],'paused':this[_0xe919('0x15')],'waiting':this['waiting']};var _0x4cc471=md5(JSON[_0xe919('0x17')](_0x5250b9));if(this[_0xe919('0x1')]!==_0x4cc471){this[_0xe919('0x1')]=_0x4cc471;io['to'](util[_0xe919('0x18')]('sms:queue:%s',_0x5250b9[_0xe919('0x7')]))[_0xe919('0x19')]('sms_queue:save',_0x5250b9);}};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 f688db0..0804ffc 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 _0x1931=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x1931,0x130));var _0x1193=function(_0x2b4d8b,_0xd5c913){_0x2b4d8b=_0x2b4d8b-0x0;var _0x5b8760=_0x1931[_0x2b4d8b];return _0x5b8760;};'use strict';var _=require(_0x1193('0x0'));var md5=require(_0x1193('0x1'));var util=require(_0x1193('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x1193('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1193('0x4'))(new Redis(config[_0x1193('0x3')]));function WhatsappQueue(_0x937333){this['id']=_0x937333['id']||0x0;this[_0x1193('0x5')]=_0x937333[_0x1193('0x5')]||'';this['timeout']=_0x937333[_0x1193('0x6')]||0xa;this[_0x1193('0x7')]=_0x937333[_0x1193('0x7')]||_0x1193('0x8');this[_0x1193('0x9')]=_0x937333[_0x1193('0x9')];this[_0x1193('0xa')]={};this[_0x1193('0xb')]=0x0;this[_0x1193('0x1')]='';this[_0x1193('0xc')]();this[_0x1193('0xd')]();}WhatsappQueue[_0x1193('0xe')][_0x1193('0xc')]=function(){var _0x51a65e=this[_0x1193('0xa')]['_rr'];this[_0x1193('0xa')]=_[_0x1193('0xf')](this[_0x1193('0x9')],'id');this[_0x1193('0xa')][_0x1193('0x10')]=_0x51a65e;};WhatsappQueue['prototype'][_0x1193('0xd')]=function(){this[_0x1193('0x11')]=0x0;this['paused']=0x0;for(var _0x401163=0x0;_0x401163=0x0?this['available']:0x0;var _0x299f9f={'id':this['id'],'available':this[_0x1193('0x15')],'loggedIn':this[_0x1193('0x11')],'name':this[_0x1193('0x5')],'paused':this[_0x1193('0x14')],'waiting':this['waiting']};var _0x2eef3c=md5(JSON[_0x1193('0x16')](_0x299f9f));if(this[_0x1193('0x1')]!==_0x2eef3c){this['md5']=_0x2eef3c;io['to'](util[_0x1193('0x17')](_0x1193('0x18'),_0x299f9f[_0x1193('0x5')]))[_0x1193('0x19')](_0x1193('0x1a'),_0x299f9f);}};module[_0x1193('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x592a=['md5','updateRouting','updateRealtime','prototype','map','_rr','length','online','whatsappPause','paused','available','loggedIn','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x592a,0xe3));var _0xa592=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x592a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa592('0x0'));var md5=require('md5');var util=require(_0xa592('0x1'));var Redis=require(_0xa592('0x2'));var config=require(_0xa592('0x3'));config[_0xa592('0x4')]=_[_0xa592('0x5')](config['redis'],{'host':_0xa592('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x46ee46){this['id']=_0x46ee46['id']||0x0;this[_0xa592('0x7')]=_0x46ee46[_0xa592('0x7')]||'';this['timeout']=_0x46ee46['timeout']||0xa;this[_0xa592('0x8')]=_0x46ee46[_0xa592('0x8')]||_0xa592('0x9');this[_0xa592('0xa')]=_0x46ee46['Agents'];this[_0xa592('0xb')]={};this[_0xa592('0xc')]=0x0;this[_0xa592('0xd')]='';this[_0xa592('0xe')]();this[_0xa592('0xf')]();}WhatsappQueue[_0xa592('0x10')][_0xa592('0xe')]=function(){var _0x5dae25=this[_0xa592('0xb')]['_rr'];this['mapAgentsId']=_[_0xa592('0x11')](this[_0xa592('0xa')],'id');this[_0xa592('0xb')][_0xa592('0x12')]=_0x5dae25;};WhatsappQueue[_0xa592('0x10')][_0xa592('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2cceb0=0x0;_0x2cceb0=0x0?this[_0xa592('0x17')]:0x0;var _0x32486a={'id':this['id'],'available':this[_0xa592('0x17')],'loggedIn':this[_0xa592('0x18')],'name':this[_0xa592('0x7')],'paused':this[_0xa592('0x16')],'waiting':this['waiting']};var _0x4f9b30=md5(JSON[_0xa592('0x19')](_0x32486a));if(this[_0xa592('0xd')]!==_0x4f9b30){this[_0xa592('0xd')]=_0x4f9b30;io['to'](util[_0xa592('0x1a')](_0xa592('0x1b'),_0x32486a['name']))['emit'](_0xa592('0x1c'),_0x32486a);}};module[_0xa592('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ca2e1b..e500cc8 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x305972,_0x3ab59d){var _0x2c3c19=function(_0x3e5e0f){while(--_0x3e5e0f){_0x305972['push'](_0x305972['shift']());}};_0x2c3c19(++_0x3ab59d);}(_0xb10b,0x12a));var _0xbb10=function(_0x29551f,_0x7326d6){_0x29551f=_0x29551f-0x0;var _0x2f2a22=_0xb10b[_0x29551f];return _0x2f2a22;};'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 c5e4677..663951e 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 _0xc5a9=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','update','UpdateChatInteraction','addTags'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xc5a9,0x8d));var _0x9c5a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc5a9[_0x13b8f3];return _0x1a6d06;};'use strict';var client=require('../client');exports[_0x9c5a('0x0')]=function(_0x5d26c7,_0x9a0bf1){return client['Request'](_0x9c5a('0x1'),{'body':_0x9a0bf1,'options':{'where':{'id':_0x5d26c7}},'log':'updateChatInteraction'});};exports[_0x9c5a('0x2')]=function(_0x3b72cc,_0x12c203){return client[_0x9c5a('0x3')](_0x9c5a('0x4'),{'body':_0x12c203,'options':{'where':{'id':_0x3b72cc}},'log':_0x9c5a('0x5')});}; \ No newline at end of file +var _0xb113=['../client','update','Request','updateChatInteraction'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb113,0x134));var _0x3b11=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0xb113[_0x3be2e2];return _0x53b9c5;};'use strict';var client=require(_0x3b11('0x0'));exports[_0x3b11('0x1')]=function(_0x93bbbf,_0x58ae9b){return client[_0x3b11('0x2')]('UpdateChatInteraction',{'body':_0x58ae9b,'options':{'where':{'id':_0x93bbbf}},'log':_0x3b11('0x3')});};exports['addTags']=function(_0x287571,_0x1c0a40){return client[_0x3b11('0x2')]('AddTagsToChatInteraction',{'body':_0x1c0a40,'options':{'where':{'id':_0x287571}},'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 9f23b29..1119ff0 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 _0xd680=['Request','CreateChatMessage'];(function(_0x341cbf,_0x52be4a){var _0x3ebf74=function(_0x2943bd){while(--_0x2943bd){_0x341cbf['push'](_0x341cbf['shift']());}};_0x3ebf74(++_0x52be4a);}(_0xd680,0x72));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x53252e){return client[_0x0d68('0x0')](_0x0d68('0x1'),{'body':_0x53252e,'log':'createChatMessage'});}; \ No newline at end of file +var _0x0d89=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x0d89,0xbc));var _0x90d8=function(_0x361805,_0x39bf7b){_0x361805=_0x361805-0x0;var _0x2066b0=_0x0d89[_0x361805];return _0x2066b0;};'use strict';var client=require(_0x90d8('0x0'));exports[_0x90d8('0x1')]=function(_0x2cefd6){return client[_0x90d8('0x2')](_0x90d8('0x3'),{'body':_0x2cefd6,'log':_0x90d8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 55d7013..1986295 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 _0xcdd0=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','Agents','online'];(function(_0x3d7cb0,_0x15551e){var _0x4c4a0a=function(_0x520055){while(--_0x520055){_0x3d7cb0['push'](_0x3d7cb0['shift']());}};_0x4c4a0a(++_0x15551e);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xcdd0[_0x1e7b16];return _0x37fadc;};'use strict';var client=require(_0x0cdd('0x0'));exports[_0x0cdd('0x1')]=function(){return function(){return client[_0x0cdd('0x2')](_0x0cdd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0cdd('0x4'),'strategy'],'include':[{'model':'User','as':_0x0cdd('0x5'),'attributes':['id','name',_0x0cdd('0x6'),_0x0cdd('0x7')]}]},'log':_0x0cdd('0x1')});};}; \ No newline at end of file +var _0x9576=['strategy','User','Agents','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x5c94d2,_0x5ab94b){var _0x59d81e=function(_0x4c2aa8){while(--_0x4c2aa8){_0x5c94d2['push'](_0x5c94d2['shift']());}};_0x59d81e(++_0x5ab94b);}(_0x9576,0x182));var _0x6957=function(_0xc3f082,_0x3a65ca){_0xc3f082=_0xc3f082-0x0;var _0x4eb8b6=_0x9576[_0xc3f082];return _0x4eb8b6;};'use strict';var client=require(_0x6957('0x0'));exports[_0x6957('0x1')]=function(){return function(){return client[_0x6957('0x2')](_0x6957('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x6957('0x4')],'include':[{'model':_0x6957('0x5'),'as':_0x6957('0x6'),'attributes':['id',_0x6957('0x7'),_0x6957('0x8'),_0x6957('0x9')]}]},'log':_0x6957('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c664b79..9ea8337 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 _0xb26e=['../client','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xb26e,0x11d));var _0xeb26=function(_0x50a732,_0x1eab82){_0x50a732=_0x50a732-0x0;var _0x2047a1=_0xb26e[_0x50a732];return _0x2047a1;};'use strict';var client=require(_0xeb26('0x0'));exports['create']=function(_0x59dc2a){return client['Request'](_0xeb26('0x1'),{'body':_0x59dc2a,'log':_0xeb26('0x1')});};exports['update']=function(_0x3bdbef,_0x3b8a6f){return client[_0xeb26('0x2')](_0xeb26('0x3'),{'body':_0x3b8a6f,'options':{'where':{'uniqueid':_0x3bdbef},'order':[['id',_0xeb26('0x4')]],'limit':0x1},'log':_0xeb26('0x3')});}; \ No newline at end of file +var _0xb63f=['CreateChatQueueReport','update','UpdateChatQueueReport','Request'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xb63f,0xa3));var _0xfb63=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0xb63f[_0x2534cf];return _0x221461;};'use strict';var client=require('../client');exports['create']=function(_0x2f3c91){return client[_0xfb63('0x0')](_0xfb63('0x1'),{'body':_0x2f3c91,'log':_0xfb63('0x1')});};exports[_0xfb63('0x2')]=function(_0xca48e6,_0x2fac8f){return client[_0xfb63('0x0')](_0xfb63('0x3'),{'body':_0x2fac8f,'options':{'where':{'uniqueid':_0xca48e6},'order':[['id','DESC']],'limit':0x1},'log':_0xfb63('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5f5e017..6f48074 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0x7a54,0x106));var _0x47a5=function(_0x551695,_0x4c5838){_0x551695=_0x551695-0x0;var _0x8daf29=_0x7a54[_0x551695];return _0x8daf29;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4547b4,_0x12ead2){var _0x86458a=function(_0x23de51){while(--_0x23de51){_0x4547b4['push'](_0x4547b4['shift']());}};_0x86458a(++_0x12ead2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 3291c29..1747451 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 _0xfc2c=['Request','createFaxMessage','../client','create'];(function(_0x4e5274,_0x264aff){var _0xd28ae3=function(_0x3df865){while(--_0x3df865){_0x4e5274['push'](_0x4e5274['shift']());}};_0xd28ae3(++_0x264aff);}(_0xfc2c,0x106));var _0xcfc2=function(_0x33bfe5,_0xab5ebd){_0x33bfe5=_0x33bfe5-0x0;var _0x3965c5=_0xfc2c[_0x33bfe5];return _0x3965c5;};'use strict';var client=require(_0xcfc2('0x0'));exports[_0xcfc2('0x1')]=function(_0x5bc22e){return client[_0xcfc2('0x2')]('CreateFaxMessage',{'body':_0x5bc22e,'log':_0xcfc2('0x3')});}; \ No newline at end of file +var _0x717c=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0xd9b6eb,_0x157532){var _0x4e8be3=function(_0x5124d1){while(--_0x5124d1){_0xd9b6eb['push'](_0xd9b6eb['shift']());}};_0x4e8be3(++_0x157532);}(_0x717c,0x1ea));var _0xc717=function(_0x5840d6,_0x4649cb){_0x5840d6=_0x5840d6-0x0;var _0x3a899d=_0x717c[_0x5840d6];return _0x3a899d;};'use strict';var client=require(_0xc717('0x0'));exports[_0xc717('0x1')]=function(_0x3cac2a){return client[_0xc717('0x2')](_0xc717('0x3'),{'body':_0x3cac2a,'log':_0xc717('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e147356..6c471c4 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 _0xde53=['GetFaxQueue','name','timeout','strategy','User','Agents','online','../client','getFaxQueues','Request'];(function(_0x32bd71,_0x2d408b){var _0x37bd51=function(_0x2ca3bc){while(--_0x2ca3bc){_0x32bd71['push'](_0x32bd71['shift']());}};_0x37bd51(++_0x2d408b);}(_0xde53,0xd9));var _0x3de5=function(_0x192d9f,_0x597068){_0x192d9f=_0x192d9f-0x0;var _0x1db796=_0xde53[_0x192d9f];return _0x1db796;};'use strict';var client=require(_0x3de5('0x0'));exports[_0x3de5('0x1')]=function(){return function(){return client[_0x3de5('0x2')](_0x3de5('0x3'),{'options':{'raw':![],'attributes':['id',_0x3de5('0x4'),_0x3de5('0x5'),_0x3de5('0x6')],'include':[{'model':_0x3de5('0x7'),'as':_0x3de5('0x8'),'attributes':['id',_0x3de5('0x4'),_0x3de5('0x9'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0xdc99=['Agents','name','faxPause','getFaxQueues','../client','Request','GetFaxQueue','timeout','User'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0xdc99,0xc1));var _0x9dc9=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0xdc99[_0x7c0074];return _0x13e95b;};'use strict';var client=require(_0x9dc9('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x9dc9('0x1')](_0x9dc9('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9dc9('0x3'),'strategy'],'include':[{'model':_0x9dc9('0x4'),'as':_0x9dc9('0x5'),'attributes':['id',_0x9dc9('0x6'),'online',_0x9dc9('0x7')]}]},'log':_0x9dc9('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index badb7e7..8dec13d 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 _0x2d8d=['Request','CreateFaxQueueReport','DESC','UpdateFaxQueueReport','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d8d,0x154));var _0xd2d8=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x2d8d[_0x29632e];return _0x426e04;};'use strict';var client=require(_0xd2d8('0x0'));exports[_0xd2d8('0x1')]=function(_0x44a37f){return client[_0xd2d8('0x2')](_0xd2d8('0x3'),{'body':_0x44a37f,'log':_0xd2d8('0x3')});};exports['update']=function(_0x50ec07,_0x693670){return client[_0xd2d8('0x2')]('UpdateFaxQueueReport',{'body':_0x693670,'options':{'where':{'uniqueid':_0x50ec07},'order':[['id',_0xd2d8('0x4')]],'limit':0x1},'log':_0xd2d8('0x5')});}; \ No newline at end of file +var _0x7ed3=['DESC','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x4d0788,_0x4edd8f){var _0x2fc60d=function(_0x2720a3){while(--_0x2720a3){_0x4d0788['push'](_0x4d0788['shift']());}};_0x2fc60d(++_0x4edd8f);}(_0x7ed3,0x1eb));var _0x37ed=function(_0xfbe2c,_0x27090f){_0xfbe2c=_0xfbe2c-0x0;var _0x4ae40=_0x7ed3[_0xfbe2c];return _0x4ae40;};'use strict';var client=require('../client');exports['create']=function(_0x509fef){return client[_0x37ed('0x0')]('CreateFaxQueueReport',{'body':_0x509fef,'log':_0x37ed('0x1')});};exports[_0x37ed('0x2')]=function(_0x135f49,_0x494296){return client[_0x37ed('0x0')](_0x37ed('0x3'),{'body':_0x494296,'options':{'where':{'uniqueid':_0x135f49},'order':[['id',_0x37ed('0x4')]],'limit':0x1},'log':_0x37ed('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 24e7bbb..4fc804d 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 _0x0452=['interval','name','Intervals'];(function(_0x24ca7e,_0x391229){var _0xc89aef=function(_0x20a09a){while(--_0x20a09a){_0x24ca7e['push'](_0x24ca7e['shift']());}};_0xc89aef(++_0x391229);}(_0x0452,0x115));var _0x2045=function(_0x18f10c,_0x2ba8de){_0x18f10c=_0x18f10c-0x0;var _0x3d9f7d=_0x0452[_0x18f10c];return _0x3d9f7d;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2045('0x0')],'include':[{'model':'Interval','as':_0x2045('0x1'),'attributes':['id',_0x2045('0x0'),_0x2045('0x2')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x1229=['../client','getIntervals','Request','GetInterval','name','Intervals','interval'];(function(_0x34e84d,_0x3f3502){var _0x3f9125=function(_0x2cfc58){while(--_0x2cfc58){_0x34e84d['push'](_0x34e84d['shift']());}};_0x3f9125(++_0x3f3502);}(_0x1229,0x157));var _0x9122=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x1229[_0x58dc25];return _0x21b0a7;};'use strict';var client=require(_0x9122('0x0'));exports[_0x9122('0x1')]=function(){return function(){return client[_0x9122('0x2')](_0x9122('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9122('0x4')],'include':[{'model':'Interval','as':_0x9122('0x5'),'attributes':['id','name',_0x9122('0x6')]}]},'log':_0x9122('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a840029..85d87d0 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0xb016,0x159));var _0x6b01=function(_0x2921d2,_0x46b17b){_0x2921d2=_0x2921d2-0x0;var _0x4af934=_0xb016[_0x2921d2];return _0x4af934;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0x25e7=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x102402,_0x4eaaf8){var _0x321b44=function(_0x198c94){while(--_0x198c94){_0x102402['push'](_0x102402['shift']());}};_0x321b44(++_0x4eaaf8);}(_0x25e7,0x1d6));var _0x725e=function(_0x40dcd1,_0x5cd1da){_0x40dcd1=_0x40dcd1-0x0;var _0x5c056b=_0x25e7[_0x40dcd1];return _0x5c056b;};'use strict';var client=require(_0x725e('0x0'));exports[_0x725e('0x1')]=function(_0x2752fa,_0x3fdca4){return client[_0x725e('0x2')](_0x725e('0x3'),{'body':_0x3fdca4,'options':{'where':{'id':_0x2752fa}},'log':_0x725e('0x4')});};exports[_0x725e('0x5')]=function(_0x3d7893,_0x3da706){return client['Request']('AddTagsToMailInteraction',{'body':_0x3da706,'options':{'where':{'id':_0x3d7893}},'log':_0x725e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d241392..bf55e94 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 _0x9864=['CreateMailMessage','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9864,0x9d));var _0x4986=function(_0x5e2885,_0xee61c0){_0x5e2885=_0x5e2885-0x0;var _0xa62caa=_0x9864[_0x5e2885];return _0xa62caa;};'use strict';var client=require(_0x4986('0x0'));exports['create']=function(_0xe660c6){return client[_0x4986('0x1')](_0x4986('0x2'),{'body':_0xe660c6,'log':'createMailMessage'});}; \ No newline at end of file +var _0xd217=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x2a93f0,_0x1f8fb7){var _0x439217=function(_0xe07912){while(--_0xe07912){_0x2a93f0['push'](_0x2a93f0['shift']());}};_0x439217(++_0x1f8fb7);}(_0xd217,0x142));var _0x7d21=function(_0x21d87b,_0x2c831c){_0x21d87b=_0x21d87b-0x0;var _0x1bb038=_0xd217[_0x21d87b];return _0x1bb038;};'use strict';var client=require('../client');exports[_0x7d21('0x0')]=function(_0x52afd2){return client[_0x7d21('0x1')](_0x7d21('0x2'),{'body':_0x52afd2,'log':_0x7d21('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e6abfe5..630fc5f 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 _0x3b56=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x2f2d36,_0x352c63){var _0x1ea456=function(_0x10dcb3){while(--_0x10dcb3){_0x2f2d36['push'](_0x2f2d36['shift']());}};_0x1ea456(++_0x352c63);}(_0x3b56,0x180));var _0x63b5=function(_0x1cbef5,_0x5da74b){_0x1cbef5=_0x1cbef5-0x0;var _0x39ad51=_0x3b56[_0x1cbef5];return _0x39ad51;};'use strict';var client=require(_0x63b5('0x0'));exports[_0x63b5('0x1')]=function(){return function(){return client[_0x63b5('0x2')](_0x63b5('0x3'),{'options':{'raw':![],'attributes':['id',_0x63b5('0x4'),_0x63b5('0x5'),_0x63b5('0x6')],'include':[{'model':_0x63b5('0x7'),'as':_0x63b5('0x8'),'attributes':['id',_0x63b5('0x4'),_0x63b5('0x9'),_0x63b5('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xa5d0=['name','timeout','User','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x2fa2d6,_0x5d7dc8){var _0x3eb8ab=function(_0x23081f){while(--_0x23081f){_0x2fa2d6['push'](_0x2fa2d6['shift']());}};_0x3eb8ab(++_0x5d7dc8);}(_0xa5d0,0x95));var _0x0a5d=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa5d0[_0x433a86];return _0x23000c;};'use strict';var client=require(_0x0a5d('0x0'));exports[_0x0a5d('0x1')]=function(){return function(){return client['Request'](_0x0a5d('0x2'),{'options':{'raw':![],'attributes':['id',_0x0a5d('0x3'),_0x0a5d('0x4'),'strategy'],'include':[{'model':_0x0a5d('0x5'),'as':'Agents','attributes':['id',_0x0a5d('0x3'),_0x0a5d('0x6'),_0x0a5d('0x7')]}]},'log':_0x0a5d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c3b2809..f817430 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 _0x4a63=['DESC','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x55f318,_0x3d2e2e){var _0x9f017d=function(_0x42c73a){while(--_0x42c73a){_0x55f318['push'](_0x55f318['shift']());}};_0x9f017d(++_0x3d2e2e);}(_0x4a63,0xd3));var _0x34a6=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x4a63[_0x296809];return _0x18c0d3;};'use strict';var client=require('../client');exports[_0x34a6('0x0')]=function(_0x26af50){return client[_0x34a6('0x1')](_0x34a6('0x2'),{'body':_0x26af50,'log':_0x34a6('0x2')});};exports[_0x34a6('0x3')]=function(_0x4c10ac,_0xd598a9){return client[_0x34a6('0x1')](_0x34a6('0x4'),{'body':_0xd598a9,'options':{'where':{'uniqueid':_0x4c10ac},'order':[['id',_0x34a6('0x5')]],'limit':0x1},'log':_0x34a6('0x4')});}; \ No newline at end of file +var _0x4707=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','Request'];(function(_0x52ac27,_0x8776c8){var _0x40732e=function(_0x32b6c9){while(--_0x32b6c9){_0x52ac27['push'](_0x52ac27['shift']());}};_0x40732e(++_0x8776c8);}(_0x4707,0x1a2));var _0x7470=function(_0xb4ea1,_0x54a848){_0xb4ea1=_0xb4ea1-0x0;var _0xebaaf4=_0x4707[_0xb4ea1];return _0xebaaf4;};'use strict';var client=require(_0x7470('0x0'));exports['create']=function(_0x16e7a3){return client[_0x7470('0x1')](_0x7470('0x2'),{'body':_0x16e7a3,'log':'CreateMailQueueReport'});};exports[_0x7470('0x3')]=function(_0x53d8fa,_0x559703){return client[_0x7470('0x1')]('UpdateMailQueueReport',{'body':_0x559703,'options':{'where':{'uniqueid':_0x53d8fa},'order':[['id','DESC']],'limit':0x1},'log':_0x7470('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3e05a07..27a99e3 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 _0xd5a5=['UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x3fd3de,_0x573a06){var _0x4f9c2a=function(_0x256184){while(--_0x256184){_0x3fd3de['push'](_0x3fd3de['shift']());}};_0x4f9c2a(++_0x573a06);}(_0xd5a5,0x70));var _0x5d5a=function(_0x1f853f,_0x41cfc8){_0x1f853f=_0x1f853f-0x0;var _0x2b1931=_0xd5a5[_0x1f853f];return _0x2b1931;};'use strict';var client=require('../client');exports['update']=function(_0x3f8e9f,_0xd4b295){return client['Request'](_0x5d5a('0x0'),{'body':_0xd4b295,'options':{'where':{'id':_0x3f8e9f}},'log':_0x5d5a('0x1')});};exports['addTags']=function(_0x391cb4,_0x2d83c1){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2d83c1,'options':{'where':{'id':_0x391cb4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x79ec=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x79ec,0x1f3));var _0xc79e=function(_0x31c0e3,_0x3c5cd6){_0x31c0e3=_0x31c0e3-0x0;var _0xf34e31=_0x79ec[_0x31c0e3];return _0xf34e31;};'use strict';var client=require(_0xc79e('0x0'));exports['update']=function(_0x2856d3,_0x404024){return client[_0xc79e('0x1')](_0xc79e('0x2'),{'body':_0x404024,'options':{'where':{'id':_0x2856d3}},'log':_0xc79e('0x3')});};exports[_0xc79e('0x4')]=function(_0x1eaecc,_0xe359e8){return client['Request'](_0xc79e('0x5'),{'body':_0xe359e8,'options':{'where':{'id':_0x1eaecc}},'log':_0xc79e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 719fbb3..a17faea 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 _0x79bc=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x30ce72,_0x514235){var _0x2bbfcc=function(_0x254c95){while(--_0x254c95){_0x30ce72['push'](_0x30ce72['shift']());}};_0x2bbfcc(++_0x514235);}(_0x79bc,0x167));var _0xc79b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x79bc[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xc79b('0x0'));exports[_0xc79b('0x1')]=function(_0x456ab8){return client[_0xc79b('0x2')](_0xc79b('0x3'),{'body':_0x456ab8,'log':_0xc79b('0x4')});}; \ No newline at end of file +var _0x519e=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x16b667,_0xadec02){var _0x58620e=function(_0x5db60b){while(--_0x5db60b){_0x16b667['push'](_0x16b667['shift']());}};_0x58620e(++_0xadec02);}(_0x519e,0x6e));var _0xe519=function(_0x4c076b,_0x2a11b4){_0x4c076b=_0x4c076b-0x0;var _0x258472=_0x519e[_0x4c076b];return _0x258472;};'use strict';var client=require(_0xe519('0x0'));exports[_0xe519('0x1')]=function(_0x51c3d5){return client[_0xe519('0x2')](_0xe519('0x3'),{'body':_0x51c3d5,'log':_0xe519('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8a82205..dfa545e 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 _0x42c8=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','online','openchannelPause','../client'];(function(_0x5e18e8,_0x148fea){var _0x1561c5=function(_0x3abfea){while(--_0x3abfea){_0x5e18e8['push'](_0x5e18e8['shift']());}};_0x1561c5(++_0x148fea);}(_0x42c8,0x116));var _0x842c=function(_0xee7e65,_0x4fb2aa){_0xee7e65=_0xee7e65-0x0;var _0x3dfe75=_0x42c8[_0xee7e65];return _0x3dfe75;};'use strict';var client=require(_0x842c('0x0'));exports[_0x842c('0x1')]=function(){return function(){return client[_0x842c('0x2')](_0x842c('0x3'),{'options':{'raw':![],'attributes':['id',_0x842c('0x4'),'timeout',_0x842c('0x5')],'include':[{'model':_0x842c('0x6'),'as':'Agents','attributes':['id',_0x842c('0x4'),_0x842c('0x7'),_0x842c('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xaa9c=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','Agents','name','online'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xaa9c,0x8d));var _0xcaa9=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xaa9c[_0x263a74];return _0x2aa86c;};'use strict';var client=require(_0xcaa9('0x0'));exports[_0xcaa9('0x1')]=function(){return function(){return client[_0xcaa9('0x2')](_0xcaa9('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xcaa9('0x4'),_0xcaa9('0x5')],'include':[{'model':'User','as':_0xcaa9('0x6'),'attributes':['id',_0xcaa9('0x7'),_0xcaa9('0x8'),_0xcaa9('0x9')]}]},'log':_0xcaa9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f5881e4..f02b5cf 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 _0x42c8=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x42c8,0x110));var _0x842c=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x42c8[_0x82140];return _0x2b15a6;};'use strict';var client=require('../client');exports['create']=function(_0x3686e1){return client[_0x842c('0x0')](_0x842c('0x1'),{'body':_0x3686e1,'log':_0x842c('0x1')});};exports['update']=function(_0x23daf2,_0x561dc7){return client['Request'](_0x842c('0x2'),{'body':_0x561dc7,'options':{'where':{'uniqueid':_0x23daf2},'order':[['id',_0x842c('0x3')]],'limit':0x1},'log':_0x842c('0x2')});}; \ No newline at end of file +var _0x8a08=['DESC','../client','create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x8a08,0x145));var _0x88a0=function(_0x12b268,_0x39fdbe){_0x12b268=_0x12b268-0x0;var _0x4025ee=_0x8a08[_0x12b268];return _0x4025ee;};'use strict';var client=require(_0x88a0('0x0'));exports[_0x88a0('0x1')]=function(_0x506b24){return client['Request'](_0x88a0('0x2'),{'body':_0x506b24,'log':_0x88a0('0x2')});};exports[_0x88a0('0x3')]=function(_0x38e727,_0x521557){return client['Request'](_0x88a0('0x4'),{'body':_0x521557,'options':{'where':{'uniqueid':_0x38e727},'order':[['id',_0x88a0('0x5')]],'limit':0x1},'log':_0x88a0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9e58851..32dc24b 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 _0xf29c=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3cf8e9,_0x2e866a){var _0x6956eb=function(_0x1761a4){while(--_0x1761a4){_0x3cf8e9['push'](_0x3cf8e9['shift']());}};_0x6956eb(++_0x2e866a);}(_0xf29c,0xc7));var _0xcf29=function(_0x3111b3,_0x4264a5){_0x3111b3=_0x3111b3-0x0;var _0x4463b2=_0xf29c[_0x3111b3];return _0x4463b2;};'use strict';var client=require('../client');exports[_0xcf29('0x0')]=function(_0x467fb4,_0x263eb0){return client[_0xcf29('0x1')](_0xcf29('0x2'),{'body':_0x263eb0,'options':{'where':{'id':_0x467fb4}},'log':_0xcf29('0x3')});};exports[_0xcf29('0x4')]=function(_0x148004,_0x1f2b5d){return client[_0xcf29('0x1')](_0xcf29('0x5'),{'body':_0x1f2b5d,'options':{'where':{'id':_0x148004}},'log':_0xcf29('0x6')});}; \ No newline at end of file +var _0x1ac2=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1ac2,0xfd));var _0x21ac=function(_0x1f6135,_0x406c38){_0x1f6135=_0x1f6135-0x0;var _0x56502a=_0x1ac2[_0x1f6135];return _0x56502a;};'use strict';var client=require(_0x21ac('0x0'));exports[_0x21ac('0x1')]=function(_0xb80f69,_0x20128d){return client[_0x21ac('0x2')](_0x21ac('0x3'),{'body':_0x20128d,'options':{'where':{'id':_0xb80f69}},'log':_0x21ac('0x4')});};exports[_0x21ac('0x5')]=function(_0x3e863c,_0x3e9570){return client[_0x21ac('0x2')]('AddTagsToSmsInteraction',{'body':_0x3e9570,'options':{'where':{'id':_0x3e863c}},'log':_0x21ac('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index cd272c8..fc289c3 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 _0x13b6=['../client','create','Request'];(function(_0x1d233c,_0x2312df){var _0x11eaec=function(_0x27eee3){while(--_0x27eee3){_0x1d233c['push'](_0x1d233c['shift']());}};_0x11eaec(++_0x2312df);}(_0x13b6,0x165));var _0x613b=function(_0xf3d2a7,_0x536b28){_0xf3d2a7=_0xf3d2a7-0x0;var _0x46d033=_0x13b6[_0xf3d2a7];return _0x46d033;};'use strict';var client=require(_0x613b('0x0'));exports[_0x613b('0x1')]=function(_0x20f1f9){return client[_0x613b('0x2')]('CreateSmsMessage',{'body':_0x20f1f9,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x14c7=['../client','create','Request','createSmsMessage'];(function(_0x30b411,_0x2e8f2a){var _0x18f50f=function(_0x5c8ed3){while(--_0x5c8ed3){_0x30b411['push'](_0x30b411['shift']());}};_0x18f50f(++_0x2e8f2a);}(_0x14c7,0x1b4));var _0x714c=function(_0x45ddb0,_0x2d14b5){_0x45ddb0=_0x45ddb0-0x0;var _0x2bb42f=_0x14c7[_0x45ddb0];return _0x2bb42f;};'use strict';var client=require(_0x714c('0x0'));exports[_0x714c('0x1')]=function(_0x1b4210){return client[_0x714c('0x2')]('CreateSmsMessage',{'body':_0x1b4210,'log':_0x714c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a59bd44..85fb7fc 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x2a8257,_0x5b19e4){var _0x9903f6=function(_0x3d4019){while(--_0x3d4019){_0x2a8257['push'](_0x2a8257['shift']());}};_0x9903f6(++_0x5b19e4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1beb62,_0x294c5b){var _0x20baf9=function(_0x5e0875){while(--_0x5e0875){_0x1beb62['push'](_0x1beb62['shift']());}};_0x20baf9(++_0x294c5b);}(_0xe706,0xa3));var _0x6e70=function(_0x13e1d9,_0x479e22){_0x13e1d9=_0x13e1d9-0x0;var _0x5e3c69=_0xe706[_0x13e1d9];return _0x5e3c69;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 1917bdc..c0c4712 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x263711,_0x543705){var _0x247989=function(_0x3e4e8a){while(--_0x3e4e8a){_0x263711['push'](_0x263711['shift']());}};_0x247989(++_0x543705);}(_0x3e74,0x175));var _0x43e7=function(_0xa63f63,_0x3ebc9d){_0xa63f63=_0xa63f63-0x0;var _0x1e3f4a=_0x3e74[_0xa63f63];return _0x1e3f4a;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xedd9,0xfc));var _0x9edd=function(_0x46e077,_0x174e84){_0x46e077=_0x46e077-0x0;var _0x47a34f=_0xedd9[_0x46e077];return _0x47a34f;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index f6bc777..0857691 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(_0x41ef7d,_0x57bd3e){var _0x2e8097=function(_0x481b62){while(--_0x481b62){_0x41ef7d['push'](_0x41ef7d['shift']());}};_0x2e8097(++_0x57bd3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x445342,_0x4d0dba){var _0x50aad9=function(_0x20e4ce){while(--_0x20e4ce){_0x445342['push'](_0x445342['shift']());}};_0x50aad9(++_0x4d0dba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 2add57c..6ac9568 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 _0xacf4=['AddTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xacf4,0xe7));var _0x4acf=function(_0x572603,_0x46e259){_0x572603=_0x572603-0x0;var _0x39138e=_0xacf4[_0x572603];return _0x39138e;};'use strict';var client=require('../client');exports['update']=function(_0x867c40,_0x14a022){return client[_0x4acf('0x0')](_0x4acf('0x1'),{'body':_0x14a022,'options':{'where':{'id':_0x867c40}},'log':_0x4acf('0x2')});};exports[_0x4acf('0x3')]=function(_0x145264,_0x5cf22d){return client[_0x4acf('0x0')](_0x4acf('0x4'),{'body':_0x5cf22d,'options':{'where':{'id':_0x145264}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x3c0ee7,_0x456c31){_0x3c0ee7=_0x3c0ee7-0x0;var _0x35b266=_0x7a54[_0x3c0ee7];return _0x35b266;};'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':'updateWhatsappInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'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 033e410..8dfb7c5 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 _0xb924=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x4ae223,_0x1ed49a){var _0xff5d57=function(_0x1d0591){while(--_0x1d0591){_0x4ae223['push'](_0x4ae223['shift']());}};_0xff5d57(++_0x1ed49a);}(_0xb924,0xa7));var _0x4b92=function(_0x4eea0a,_0x20e43e){_0x4eea0a=_0x4eea0a-0x0;var _0x5758d1=_0xb924[_0x4eea0a];return _0x5758d1;};'use strict';var client=require(_0x4b92('0x0'));exports[_0x4b92('0x1')]=function(_0x495ca6){return client[_0x4b92('0x2')](_0x4b92('0x3'),{'body':_0x495ca6,'log':_0x4b92('0x4')});}; \ No newline at end of file +var _0xc17c=['Request','createWhatsappMessage','../client','create'];(function(_0x259927,_0x12a2c7){var _0xdc8e93=function(_0x4faf40){while(--_0x4faf40){_0x259927['push'](_0x259927['shift']());}};_0xdc8e93(++_0x12a2c7);}(_0xc17c,0xaa));var _0xcc17=function(_0x17f424,_0x48ef74){_0x17f424=_0x17f424-0x0;var _0x128958=_0xc17c[_0x17f424];return _0x128958;};'use strict';var client=require(_0xcc17('0x0'));exports[_0xcc17('0x1')]=function(_0x26e66e){return client[_0xcc17('0x2')]('CreateWhatsappMessage',{'body':_0x26e66e,'log':_0xcc17('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 371a002..e990709 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 _0x878b=['name','timeout','strategy','User','Agents','online','getWhatsappQueues','Request'];(function(_0x3583c3,_0x5e0e5a){var _0x5a89d7=function(_0x24e536){while(--_0x24e536){_0x3583c3['push'](_0x3583c3['shift']());}};_0x5a89d7(++_0x5e0e5a);}(_0x878b,0xce));var _0xb878=function(_0x396181,_0x2e3f1f){_0x396181=_0x396181-0x0;var _0x1048c1=_0x878b[_0x396181];return _0x1048c1;};'use strict';var client=require('../client');exports[_0xb878('0x0')]=function(){return function(){return client[_0xb878('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb878('0x2'),_0xb878('0x3'),_0xb878('0x4')],'include':[{'model':_0xb878('0x5'),'as':_0xb878('0x6'),'attributes':['id',_0xb878('0x2'),_0xb878('0x7'),'whatsappPause']}]},'log':_0xb878('0x0')});};}; \ No newline at end of file +var _0x4319=['name','timeout','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x1ae090,_0x43122b){var _0xf32a6=function(_0x332bfd){while(--_0x332bfd){_0x1ae090['push'](_0x1ae090['shift']());}};_0xf32a6(++_0x43122b);}(_0x4319,0x88));var _0x9431=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x4319[_0x4a9a17];return _0x30e831;};'use strict';var client=require(_0x9431('0x0'));exports[_0x9431('0x1')]=function(){return function(){return client[_0x9431('0x2')](_0x9431('0x3'),{'options':{'raw':![],'attributes':['id',_0x9431('0x4'),_0x9431('0x5'),_0x9431('0x6')],'include':[{'model':'User','as':_0x9431('0x7'),'attributes':['id',_0x9431('0x4'),_0x9431('0x8'),_0x9431('0x9')]}]},'log':_0x9431('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 80072e9..5e48624 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 _0x1bc9=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x29716c,_0x2aa7aa){var _0x106943=function(_0x335705){while(--_0x335705){_0x29716c['push'](_0x29716c['shift']());}};_0x106943(++_0x2aa7aa);}(_0x1bc9,0x1c7));var _0x91bc=function(_0x167211,_0x52c558){_0x167211=_0x167211-0x0;var _0x395f67=_0x1bc9[_0x167211];return _0x395f67;};'use strict';var client=require(_0x91bc('0x0'));exports[_0x91bc('0x1')]=function(_0x34461d){return client[_0x91bc('0x2')](_0x91bc('0x3'),{'body':_0x34461d,'log':_0x91bc('0x3')});};exports[_0x91bc('0x4')]=function(_0x48bf74,_0x4a9fc4){return client[_0x91bc('0x2')](_0x91bc('0x5'),{'body':_0x4a9fc4,'options':{'where':{'uniqueid':_0x48bf74},'order':[['id',_0x91bc('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x5d4b=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x398cda,_0x21a4aa){var _0x1fa7ec=function(_0x10c387){while(--_0x10c387){_0x398cda['push'](_0x398cda['shift']());}};_0x1fa7ec(++_0x21a4aa);}(_0x5d4b,0x1ba));var _0xb5d4=function(_0x5e3b4e,_0x11b753){_0x5e3b4e=_0x5e3b4e-0x0;var _0x1e0f72=_0x5d4b[_0x5e3b4e];return _0x1e0f72;};'use strict';var client=require(_0xb5d4('0x0'));exports['create']=function(_0x22f63a){return client[_0xb5d4('0x1')](_0xb5d4('0x2'),{'body':_0x22f63a,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x4c5155,_0x2c7851){return client[_0xb5d4('0x1')](_0xb5d4('0x3'),{'body':_0x2c7851,'options':{'where':{'uniqueid':_0x4c5155},'order':[['id',_0xb5d4('0x4')]],'limit':0x1},'log':_0xb5d4('0x3')});}; \ 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 5c789bf..239b283 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 _0x400c=['stack','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','stop','next','agent','log','[%s][QUEUE]\x20%s'];(function(_0x27c822,_0x4850f1){var _0x2e60b2=function(_0x14e1aa){while(--_0x14e1aa){_0x27c822['push'](_0x27c822['shift']());}};_0x2e60b2(++_0x4850f1);}(_0x400c,0x13c));var _0xc400=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x400c[_0x297fd3];return _0x2af381;};'use strict';var schema=require(_0xc400('0x0'));var _=require('lodash');var util=require(_0xc400('0x1'));var seqqueue=require(_0xc400('0x2'));var logger=require(_0xc400('0x3'))('routing');var strategy=require(_0xc400('0x4'));var queue=schema({'name':{'type':_0xc400('0x5'),'required':!![],'message':_0xc400('0x6')},'timeout':{'type':_0xc400('0x7'),'message':_0xc400('0x8')}});function writeLog(_0x12d49e,_0x414f77,_0x4f06fc){return logger[_0xc400('0x9')](util['format'](_0xc400('0xa'),_0x12d49e,_0x414f77['name'],_0x4f06fc));}function handleFindAgent(_0x14ae1a){return function(_0x3db315){return _0x3db315[_0xc400('0xb')][_0xc400('0xc')]()===_0x14ae1a[_0xc400('0xc')]();};}exports[_0xc400('0xd')]=function(_0x30cda3,_0x3e3ca1,_0x3e9799,_0x3f0dcb){return function(_0x25db08){try{var _0x51dab6={'name':_0x3e3ca1[0x0],'timeout':_0x3e3ca1[0x1]};var _0x5d1e84=queue[_0xc400('0x0')](_0x51dab6,{'typecast':!![]});if(_0x5d1e84[_0xc400('0xe')]){logger[_0xc400('0xf')](_0xc400('0x10'),_0x30cda3,_[_0xc400('0x11')](_0x5d1e84,_0xc400('0x12'))[_0xc400('0x13')](',\x20'));_0x25db08['stop']();}else{var _0xc58bf1=_[_0xc400('0x14')](_0x3e9799['agents'],handleFindAgent(_0x51dab6[_0xc400('0xb')]));if(_0xc58bf1){var _0x31d197=(_0x51dab6[_0xc400('0x15')]||0xa)*0x3e8;var _0x19ab04,_0x5874e5;var _0x20cf5d=seqqueue[_0xc400('0x16')](_0x31d197);_0x20cf5d['id']=_0x30cda3;_0x20cf5d[_0xc400('0x17')]=_0x31d197;_0x20cf5d['channel']=_0x3f0dcb[_0xc400('0x18')];writeLog(_0x30cda3,_0xc58bf1,util['format'](_0xc400('0x19'),_0x31d197));_0x3e9799[_0xc400('0x1a')][_0x30cda3]['on'](_0xc400('0x1b'),function(){logger[_0xc400('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x30cda3);clearTimeout(_0x5874e5);_0x5874e5=undefined;_0x20cf5d[_0xc400('0x1c')]();if(_0x3e9799[_0xc400('0x1a')][_0x30cda3]){delete _0x3e9799[_0xc400('0x1a')][_0x30cda3];}_0x25db08[_0xc400('0x1d')]();});_0x3e9799[_0xc400('0x1a')][_0x30cda3]['on']('complete',function(){if(_0x3e9799[_0xc400('0x1a')][_0x30cda3]){delete _0x3e9799[_0xc400('0x1a')][_0x30cda3];}});_0x5874e5=setTimeout(function(){logger[_0xc400('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x30cda3);clearTimeout(_0x5874e5);_0x20cf5d[_0xc400('0x1c')]();_0x25db08[_0xc400('0x1e')]();},_0x31d197);strategy[_0xc400('0x1f')](_0x20cf5d,_0xc58bf1,_0x3e9799,_0x3f0dcb);}else{logger[_0xc400('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x30cda3,_0x51dab6[_0xc400('0xb')]);_0x25db08[_0xc400('0x1d')]();}}}catch(_0x668ede){console[_0xc400('0x20')](_0x668ede);logger['error'](_0xc400('0x21'),_0x30cda3,_0x668ede[_0xc400('0x22')]);_0x25db08[_0xc400('0x1d')]();}};}; \ No newline at end of file +var _0xcfeb=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','name','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x468fcf,_0x37b463){var _0x5bce35=function(_0x2a2b2f){while(--_0x2a2b2f){_0x468fcf['push'](_0x468fcf['shift']());}};_0x5bce35(++_0x37b463);}(_0xcfeb,0x1b2));var _0xbcfe=function(_0x3750f1,_0x3a91af){_0x3750f1=_0x3750f1-0x0;var _0x454ef3=_0xcfeb[_0x3750f1];return _0x454ef3;};'use strict';var schema=require(_0xbcfe('0x0'));var _=require(_0xbcfe('0x1'));var util=require(_0xbcfe('0x2'));var seqqueue=require(_0xbcfe('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xbcfe('0x4'));var queue=schema({'name':{'type':_0xbcfe('0x5'),'required':!![],'message':_0xbcfe('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x14735a,_0x3de8ae,_0x351b20){return logger[_0xbcfe('0x7')](util[_0xbcfe('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x14735a,_0x3de8ae[_0xbcfe('0x9')],_0x351b20));}function handleFindAgent(_0x3ecd63){return function(_0x4029fa){return _0x4029fa[_0xbcfe('0x9')]['toLowerCase']()===_0x3ecd63['toLowerCase']();};}exports[_0xbcfe('0xa')]=function(_0x2c1e18,_0x290c6b,_0x79cbd1,_0x593a5b){return function(_0x323d1a){try{var _0x1d24a9={'name':_0x290c6b[0x0],'timeout':_0x290c6b[0x1]};var _0x25559b=queue['validate'](_0x1d24a9,{'typecast':!![]});if(_0x25559b[_0xbcfe('0xb')]){logger[_0xbcfe('0xc')](_0xbcfe('0xd'),_0x2c1e18,_[_0xbcfe('0xe')](_0x25559b,_0xbcfe('0xf'))['join'](',\x20'));_0x323d1a[_0xbcfe('0x10')]();}else{var _0x3acf5c=_[_0xbcfe('0x11')](_0x79cbd1[_0xbcfe('0x12')],handleFindAgent(_0x1d24a9[_0xbcfe('0x9')]));if(_0x3acf5c){var _0x569e2e=(_0x1d24a9['timeout']||0xa)*0x3e8;var _0x36c321,_0xdadb46;var _0x41432a=seqqueue['createQueue'](_0x569e2e);_0x41432a['id']=_0x2c1e18;_0x41432a['atimeout']=_0x569e2e;_0x41432a['channel']=_0x593a5b[_0xbcfe('0x13')];writeLog(_0x2c1e18,_0x3acf5c,util[_0xbcfe('0x8')](_0xbcfe('0x14'),_0x569e2e));_0x79cbd1[_0xbcfe('0x15')][_0x2c1e18]['on'](_0xbcfe('0x16'),function(){logger[_0xbcfe('0x7')](_0xbcfe('0x17'),_0x2c1e18);clearTimeout(_0xdadb46);_0xdadb46=undefined;_0x41432a[_0xbcfe('0x18')]();if(_0x79cbd1['rules'][_0x2c1e18]){delete _0x79cbd1[_0xbcfe('0x15')][_0x2c1e18];}_0x323d1a[_0xbcfe('0x10')]();});_0x79cbd1[_0xbcfe('0x15')][_0x2c1e18]['on'](_0xbcfe('0x19'),function(){if(_0x79cbd1[_0xbcfe('0x15')][_0x2c1e18]){delete _0x79cbd1[_0xbcfe('0x15')][_0x2c1e18];}});_0xdadb46=setTimeout(function(){logger[_0xbcfe('0x7')](_0xbcfe('0x1a'),_0x2c1e18);clearTimeout(_0xdadb46);_0x41432a[_0xbcfe('0x18')]();_0x323d1a[_0xbcfe('0x1b')]();},_0x569e2e);strategy[_0xbcfe('0x1c')](_0x41432a,_0x3acf5c,_0x79cbd1,_0x593a5b);}else{logger[_0xbcfe('0xc')](_0xbcfe('0x1d'),_0x2c1e18,_0x1d24a9[_0xbcfe('0x9')]);_0x323d1a['stop']();}}}catch(_0x5e68eb){console[_0xbcfe('0x1e')](_0x5e68eb);logger['error'](_0xbcfe('0x1f'),_0x2c1e18,_0x5e68eb[_0xbcfe('0x20')]);_0x323d1a[_0xbcfe('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 9ecf9ff..30bd6a1 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 _0x4025=['error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','then'];(function(_0x3c68dd,_0x37aff4){var _0x1d11e5=function(_0x1523f6){while(--_0x1523f6){_0x3c68dd['push'](_0x3c68dd['shift']());}};_0x1d11e5(++_0x37aff4);}(_0x4025,0x6d));var _0x5402=function(_0x259817,_0x407193){_0x259817=_0x259817-0x0;var _0xa13df5=_0x4025[_0x259817];return _0xa13df5;};'use strict';var _=require(_0x5402('0x0'));var moment=require(_0x5402('0x1'));var AWS=require(_0x5402('0x2'));var utils=require(_0x5402('0x3'));var logger=require(_0x5402('0x4'))(_0x5402('0x5'));var rpc={'chatMessage':require(_0x5402('0x6')),'openchannelMessage':require(_0x5402('0x7')),'mailMessage':require(_0x5402('0x8')),'smsMessage':require(_0x5402('0x9')),'faxMessage':require(_0x5402('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x18f68,_0x2a3ad6){return function(_0x5f3d7a){try{if(!_[_0x5402('0xb')](this[_0x5402('0xc')][_0x5402('0xd')])){logger['info'](_0x5402('0xe'),_0x18f68,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5f3d7a[_0x5402('0xf')]();}var _0x4cc052={'ContactId':this[_0x5402('0x10')]['id'],'sentAt':moment()[_0x5402('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5402('0x12')};if(this[_0x5402('0x13')]==='sms'||this[_0x5402('0x13')]===_0x5402('0x14')){_0x4cc052['phone']=this['interaction']['phone'];}var _0x349b65=this[_0x5402('0x13')];if(_0x349b65===_0x5402('0x15')){_0x4cc052[_0x5402('0x16')]=this[_0x5402('0x17')]['id'];}else{_0x4cc052[_[_0x5402('0x18')](_0x349b65)+_0x5402('0x19')]=this[_0x5402('0x17')]['id'];}_0x4cc052[_['upperFirst'](_0x349b65)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x5402('0x1a')]){var _0x50ea61=_0x2a3ad6[0x4];if(!_[_0x5402('0x1b')](_0x50ea61)){_0x4cc052[_0x5402('0x1c')]=utils[_0x5402('0x1d')](_0x50ea61,this);return rpc[_0x349b65+'Message'][_0x5402('0x1e')](_0x4cc052)[_0x5402('0x1f')](function(_0x2908ae){logger['info'](_0x5402('0xe'),_0x18f68,_0x4cc052[_0x5402('0x1c')]);})['catch'](function(_0x5e9527){logger[_0x5402('0x20')](_0x5402('0xe'),_0x18f68,JSON[_0x5402('0x21')](_0x5e9527));})['finally'](function(){logger['info'](_0x5402('0x22'),_0x18f68);_0x5f3d7a['stop']();});}else{logger[_0x5402('0x23')](_0x5402('0x24'),_0x18f68);_0x5f3d7a[_0x5402('0x25')]();}}else{var _0x47c902=this;var _0x8110e4=new AWS['LexRuntime']({'accessKeyId':_0x2a3ad6[0x0],'secretAccessKey':_0x2a3ad6[0x1],'region':_0x2a3ad6[0x2]});var _0x3c4339={'botAlias':_0x5402('0x26'),'botName':_0x2a3ad6[0x3],'inputText':this[_0x5402('0x27')]['body'],'userId':this['channel']+':'+this['interaction']['id'][_0x5402('0x28')]()};_0x8110e4[_0x5402('0x29')](_0x3c4339,function(_0x90729e,_0x56b973){if(_0x90729e){logger[_0x5402('0x20')](_0x5402('0xe'),_0x18f68,_0x90729e[_0x5402('0x27')]);_0x5f3d7a[_0x5402('0xf')]();}else if(_0x56b973&&_0x56b973[_0x5402('0x27')]){_0x47c902[_0x5402('0x1c')][_0x5402('0x2a')]=_0x56b973;_0x4cc052[_0x5402('0x1c')]=_0x56b973['message'];_0x4cc052[_0x5402('0x2b')]=_0x5402('0x2a');_0x4cc052[_0x5402('0x2c')]=JSON[_0x5402('0x21')](_0x56b973);return rpc[_0x349b65+_0x5402('0x2d')][_0x5402('0x1e')](_0x4cc052)['then'](function(_0x49cb75){logger[_0x5402('0x23')](_0x5402('0xe'),_0x18f68,_0x4cc052[_0x5402('0x1c')]);if(_0x56b973['dialogState']==_0x5402('0x2e')){_0x5f3d7a[_0x5402('0xf')]();}else{_0x5f3d7a[_0x5402('0x25')]();}})['catch'](function(_0x2aa59a){logger['error'](_0x5402('0xe'),_0x18f68,JSON[_0x5402('0x21')](_0x2aa59a));_0x5f3d7a['next']();});}else{_0x5f3d7a['next']();}});}}catch(_0x341333){logger[_0x5402('0x20')](_0x5402('0xe'),_0x18f68,JSON['stringify'](_0x341333));_0x5f3d7a['stop']();}};}; \ No newline at end of file +var _0x9a1f=['body','getMustacheRender','Message','create','then','catch','stringify','finally','info','stop','LexRuntime','message','postText','next','amazonlex','providerName','providerResponse','Failed','error','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x9a1f,0x75));var _0xf9a1=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9a1f[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xf9a1('0x0'));var moment=require(_0xf9a1('0x1'));var AWS=require(_0xf9a1('0x2'));var utils=require(_0xf9a1('0x3'));var logger=require(_0xf9a1('0x4'))(_0xf9a1('0x5'));var rpc={'chatMessage':require(_0xf9a1('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf9a1('0x7')),'smsMessage':require(_0xf9a1('0x8')),'faxMessage':require(_0xf9a1('0x9')),'whatsappMessage':require(_0xf9a1('0xa'))};exports[_0xf9a1('0xb')]=function(_0x5e6b21,_0x14f20a){return function(_0x2e1a89){try{if(!_[_0xf9a1('0xc')](this['interaction'][_0xf9a1('0xd')])){logger['info'](_0xf9a1('0xe'),_0x5e6b21,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2e1a89['next']();}var _0x1f332f={'ContactId':this[_0xf9a1('0xf')]['id'],'sentAt':moment()[_0xf9a1('0x10')](_0xf9a1('0x11')),'direction':_0xf9a1('0x12')};if(this[_0xf9a1('0x13')]==='sms'||this[_0xf9a1('0x13')]===_0xf9a1('0x14')){_0x1f332f[_0xf9a1('0x15')]=this[_0xf9a1('0x16')][_0xf9a1('0x15')];}var _0xde2c78=this[_0xf9a1('0x13')];if(_0xde2c78===_0xf9a1('0x17')){_0x1f332f[_0xf9a1('0x18')]=this['account']['id'];}else{_0x1f332f[_[_0xf9a1('0x19')](_0xde2c78)+_0xf9a1('0x1a')]=this[_0xf9a1('0x1b')]['id'];}_0x1f332f[_[_0xf9a1('0x19')](_0xde2c78)+_0xf9a1('0x1c')]=this['interaction']['id'];if(this[_0xf9a1('0x16')]['created']){var _0x45ea98=_0x14f20a[0x4];if(!_[_0xf9a1('0x1d')](_0x45ea98)){_0x1f332f[_0xf9a1('0x1e')]=utils[_0xf9a1('0x1f')](_0x45ea98,this);return rpc[_0xde2c78+_0xf9a1('0x20')][_0xf9a1('0x21')](_0x1f332f)[_0xf9a1('0x22')](function(_0x450af8){logger['info']('[%s][AMAZONLEX]\x20%s',_0x5e6b21,_0x1f332f[_0xf9a1('0x1e')]);})[_0xf9a1('0x23')](function(_0xa36afa){logger['error'](_0xf9a1('0xe'),_0x5e6b21,JSON[_0xf9a1('0x24')](_0xa36afa));})[_0xf9a1('0x25')](function(){logger[_0xf9a1('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5e6b21);_0x2e1a89[_0xf9a1('0x27')]();});}else{logger[_0xf9a1('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5e6b21);_0x2e1a89['stop']();}}else{var _0x306a98=this;var _0x507687=new AWS[(_0xf9a1('0x28'))]({'accessKeyId':_0x14f20a[0x0],'secretAccessKey':_0x14f20a[0x1],'region':_0x14f20a[0x2]});var _0x3176f3={'botAlias':'$LATEST','botName':_0x14f20a[0x3],'inputText':this[_0xf9a1('0x29')][_0xf9a1('0x1e')],'userId':this[_0xf9a1('0x13')]+':'+this[_0xf9a1('0x16')]['id']['toString']()};_0x507687[_0xf9a1('0x2a')](_0x3176f3,function(_0x3d9e82,_0x8b48d0){if(_0x3d9e82){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5e6b21,_0x3d9e82[_0xf9a1('0x29')]);_0x2e1a89[_0xf9a1('0x2b')]();}else if(_0x8b48d0&&_0x8b48d0[_0xf9a1('0x29')]){_0x306a98[_0xf9a1('0x1e')][_0xf9a1('0x2c')]=_0x8b48d0;_0x1f332f['body']=_0x8b48d0[_0xf9a1('0x29')];_0x1f332f[_0xf9a1('0x2d')]=_0xf9a1('0x2c');_0x1f332f[_0xf9a1('0x2e')]=JSON[_0xf9a1('0x24')](_0x8b48d0);return rpc[_0xde2c78+_0xf9a1('0x20')]['create'](_0x1f332f)[_0xf9a1('0x22')](function(_0x101358){logger[_0xf9a1('0x26')](_0xf9a1('0xe'),_0x5e6b21,_0x1f332f[_0xf9a1('0x1e')]);if(_0x8b48d0['dialogState']==_0xf9a1('0x2f')){_0x2e1a89['next']();}else{_0x2e1a89[_0xf9a1('0x27')]();}})[_0xf9a1('0x23')](function(_0x13d449){logger[_0xf9a1('0x30')]('[%s][AMAZONLEX]\x20%s',_0x5e6b21,JSON[_0xf9a1('0x24')](_0x13d449));_0x2e1a89[_0xf9a1('0x2b')]();});}else{_0x2e1a89[_0xf9a1('0x2b')]();}});}}catch(_0x37a879){logger[_0xf9a1('0x30')](_0xf9a1('0xe'),_0x5e6b21,JSON[_0xf9a1('0x24')](_0x37a879));_0x2e1a89[_0xf9a1('0x27')]();}};}; \ 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 2c39094..68a75b2 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 _0xf9e5=['moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','','','headers','All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','finally','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','lodash'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0xf9e5,0x89));var _0x5f9e=function(_0x55b561,_0x23a2eb){_0x55b561=_0x55b561-0x0;var _0xf931e1=_0xf9e5[_0x55b561];return _0xf931e1;};'use strict';var _=require(_0x5f9e('0x0'));var moment=require(_0x5f9e('0x1'));var utils=require(_0x5f9e('0x2'));var logger=require(_0x5f9e('0x3'))(_0x5f9e('0x4'));var rpc={'chatMessage':require(_0x5f9e('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5f9e('0x6')),'smsMessage':require(_0x5f9e('0x7')),'faxMessage':require(_0x5f9e('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x5f9e('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x5f9e('0xa')),'smsInteraction':require(_0x5f9e('0xb')),'faxInteraction':require(_0x5f9e('0xc')),'whatsappInteraction':require(_0x5f9e('0xd'))};var mailRpc=require(_0x5f9e('0xe'));exports['consequence']=function(_0xab269a,_0xb52271,_0x43f318,_0x5d6ef4){return function(_0x376f85){try{var _0x266533=this[_0x5f9e('0xf')];if(_0x266533===_0x5f9e('0x10')&&_0x5d6ef4[_0x5f9e('0x11')][_0x5f9e('0x12')]){logger[_0x5f9e('0x13')](_0x5f9e('0x14'),_0xab269a,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x376f85[_0x5f9e('0x15')]();}if(_0xb52271[0x0]==='1'&&(_[_0x5f9e('0x16')](this[_0x5f9e('0x17')]['created'])||!this['interaction'][_0x5f9e('0x18')])){logger[_0x5f9e('0x13')](_0x5f9e('0x14'),_0xab269a,_0x5f9e('0x19'));return _0x376f85[_0x5f9e('0x15')]();}if(_0xb52271[0x0]==='2'&&this[_0x5f9e('0x17')][_0x5f9e('0x1a')]){logger['info'](_0x5f9e('0x1b'),_0xab269a,_0x5f9e('0x1c'));return _0x376f85['next']();}var _0x2bfac={'ContactId':this[_0x5f9e('0x1d')]['id'],'sentAt':moment()[_0x5f9e('0x1e')](_0x5f9e('0x1f')),'direction':_0x5f9e('0x20')};if(this[_0x5f9e('0xf')]===_0x5f9e('0x10')){_0x2bfac['body']=utils['getMustacheRender'](_0xb52271[0x2],this);}else{_0x2bfac[_0x5f9e('0x11')]=utils[_0x5f9e('0x21')](_0xb52271[0x1],this);}if(this[_0x5f9e('0x22')]){_0x2bfac['to']=this[_0x5f9e('0x22')][_0x5f9e('0x23')]||'';if(this[_0x5f9e('0xf')]===_0x5f9e('0x10')&&_0xb52271[0x1]==='1'){_0x2bfac['cc']=this['message']['cc']||'';}_0x2bfac[_0x5f9e('0x23')]=this[_0x5f9e('0x22')]['to']||'';_0x2bfac[_0x5f9e('0x24')]=this[_0x5f9e('0x22')][_0x5f9e('0x24')]||'';_0x2bfac[_0x5f9e('0x25')]=!![];if(this[_0x5f9e('0x22')][_0x5f9e('0x26')]){_0x2bfac[_0x5f9e('0x26')]='';_0x2bfac[_0x5f9e('0x26')]+=_[_0x5f9e('0x27')](this[_0x5f9e('0x22')]['subject'],_0x5f9e('0x28'))?'':'Re:\x20';_0x2bfac[_0x5f9e('0x26')]+=this[_0x5f9e('0x22')]['subject'];}}if(this[_0x5f9e('0xf')]===_0x5f9e('0x29')){_0x2bfac[_0x5f9e('0x2a')]=this[_0x5f9e('0x2b')]['id'];}else{_0x2bfac[_[_0x5f9e('0x2c')](this[_0x5f9e('0xf')])+_0x5f9e('0x2d')]=this[_0x5f9e('0x2b')]['id'];}_0x2bfac[_[_0x5f9e('0x2c')](this['channel'])+_0x5f9e('0x2e')]=this[_0x5f9e('0x17')]['id'];var _0x364093=this[_0x5f9e('0x17')];if(rpc[this[_0x5f9e('0xf')]+_0x5f9e('0x2f')]){if(this[_0x5f9e('0xf')]===_0x5f9e('0x10')){_0x2bfac[_0x5f9e('0x30')]=this[_0x5f9e('0x22')]['messageId'];_0x2bfac['html']=_0x5f9e('0x31')+_['replace'](_0x2bfac[_0x5f9e('0x11')],'','replace','','headers','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error'];(function(_0x5dda93,_0x51d555){var _0x4abcb9=function(_0x1e1ae7){while(--_0x1e1ae7){_0x5dda93['push'](_0x5dda93['shift']());}};_0x4abcb9(++_0x51d555);}(_0x0b14,0x17b));var _0x40b1=function(_0x250d8d,_0x322bfb){_0x250d8d=_0x250d8d-0x0;var _0x1c3c54=_0x0b14[_0x250d8d];return _0x1c3c54;};'use strict';var _=require(_0x40b1('0x0'));var moment=require(_0x40b1('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x40b1('0x2')),'smsMessage':require(_0x40b1('0x3')),'faxMessage':require(_0x40b1('0x4')),'whatsappMessage':require(_0x40b1('0x5')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x40b1('0x6')),'mailInteraction':require(_0x40b1('0x7')),'smsInteraction':require(_0x40b1('0x8')),'faxInteraction':require(_0x40b1('0x9')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x478c24,_0x1943dc,_0x3858a7,_0x2b1883){return function(_0x1202e8){try{var _0xdc31ac=this[_0x40b1('0xa')];if(_0xdc31ac===_0x40b1('0xb')&&_0x2b1883[_0x40b1('0xc')][_0x40b1('0xd')]){logger[_0x40b1('0xe')](_0x40b1('0xf'),_0x478c24,_0x40b1('0x10'));return _0x1202e8[_0x40b1('0x11')]();}if(_0x1943dc[0x0]==='1'&&(_[_0x40b1('0x12')](this[_0x40b1('0x13')][_0x40b1('0x14')])||!this[_0x40b1('0x13')][_0x40b1('0x14')])){logger[_0x40b1('0xe')]('[%s][AUTOREPLY]\x20%s',_0x478c24,_0x40b1('0x15'));return _0x1202e8[_0x40b1('0x11')]();}if(_0x1943dc[0x0]==='2'&&this['interaction'][_0x40b1('0x16')]){logger[_0x40b1('0xe')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x478c24,_0x40b1('0x17'));return _0x1202e8[_0x40b1('0x11')]();}var _0x1cb9a0={'ContactId':this['contact']['id'],'sentAt':moment()[_0x40b1('0x18')](_0x40b1('0x19')),'direction':_0x40b1('0x1a')};if(this['channel']==='mail'){_0x1cb9a0['body']=utils[_0x40b1('0x1b')](_0x1943dc[0x2],this);}else{_0x1cb9a0['body']=utils[_0x40b1('0x1b')](_0x1943dc[0x1],this);}if(this['message']){_0x1cb9a0['to']=this[_0x40b1('0x1c')][_0x40b1('0x1d')]||'';if(this[_0x40b1('0xa')]===_0x40b1('0xb')&&_0x1943dc[0x1]==='1'){_0x1cb9a0['cc']=this[_0x40b1('0x1c')]['cc']||'';}_0x1cb9a0[_0x40b1('0x1d')]=this[_0x40b1('0x1c')]['to']||'';_0x1cb9a0[_0x40b1('0x1e')]=this[_0x40b1('0x1c')][_0x40b1('0x1e')]||'';_0x1cb9a0['read']=!![];if(this['message'][_0x40b1('0x1f')]){_0x1cb9a0[_0x40b1('0x1f')]='';_0x1cb9a0[_0x40b1('0x1f')]+=_[_0x40b1('0x20')](this[_0x40b1('0x1c')][_0x40b1('0x1f')],_0x40b1('0x21'))?'':_0x40b1('0x22');_0x1cb9a0['subject']+=this[_0x40b1('0x1c')][_0x40b1('0x1f')];}}if(this[_0x40b1('0xa')]==='chat'){_0x1cb9a0[_0x40b1('0x23')]=this[_0x40b1('0x24')]['id'];}else{_0x1cb9a0[_[_0x40b1('0x25')](this[_0x40b1('0xa')])+'AccountId']=this['account']['id'];}_0x1cb9a0[_['upperFirst'](this[_0x40b1('0xa')])+_0x40b1('0x26')]=this[_0x40b1('0x13')]['id'];var _0x25c2ab=this['interaction'];if(rpc[this['channel']+_0x40b1('0x27')]){if(this[_0x40b1('0xa')]===_0x40b1('0xb')){_0x1cb9a0[_0x40b1('0x28')]=this[_0x40b1('0x1c')][_0x40b1('0x29')];_0x1cb9a0[_0x40b1('0x2a')]=_0x40b1('0x2b')+_[_0x40b1('0x2c')](_0x1cb9a0[_0x40b1('0xc')],']+(>|$)/g,''),'priorityTrue':_0x3c3820[0x1],'priorityFalse':_0x3c3820[0x2]};var _0x5c4ee9=gotoif[_0x502a('0x0')](_0x2957f7,{'typecast':!![]});if(_0x5c4ee9[_0x502a('0xa')]){logger[_0x502a('0xb')]('[%s][GOTOIF]\x20%s',_0x39df33,_[_0x502a('0xc')](_0x5c4ee9,'message')[_0x502a('0xd')](',\x20'));_0xeeb105[_0x502a('0xe')]();}else{try{var _0x46ca97=eval('('+_0x2957f7[_0x502a('0xf')]+')');var _0x2fd00f=_0x46ca97?_0x2957f7[_0x502a('0x10')]:_0x2957f7['priorityFalse'];logger[_0x502a('0x11')](_0x502a('0x12'),_0x39df33,_0x2957f7['condition'],_0x46ca97,_0x2fd00f||_0x502a('0x13'));if(_0x2fd00f){var _0x15fdb4=_[_0x502a('0x14')](_0xeeb105[_0x502a('0x15')](),{'p':_0x2fd00f});if(_0x15fdb4>=0x0){logger[_0x502a('0x11')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x39df33,_0x2fd00f||'next',_0x15fdb4);_0xeeb105[_0x502a('0x13')](_0x15fdb4);}else{logger['info'](_0x502a('0x16'),_0x39df33,_0x2fd00f||_0x502a('0x13'));_0xeeb105['stop']();}}else{_0xeeb105[_0x502a('0x13')]();}}catch(_0x29a9ae){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x39df33,_0x29a9ae[_0x502a('0x17')]);_0xeeb105[_0x502a('0xe')]();}}}catch(_0x460b90){logger[_0x502a('0xb')](_0x502a('0x18'),_0x39df33,JSON['stringify'](_0x460b90));_0xeeb105['stop']();}};}; \ No newline at end of file +var _0xe019=['fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xe019,0x13e));var _0x9e01=function(_0x13d0cc,_0x23872a){_0x13d0cc=_0x13d0cc-0x0;var _0x13ab55=_0xe019[_0x13d0cc];return _0x13ab55;};'use strict';var schema=require(_0x9e01('0x0'));var _=require(_0x9e01('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x9e01('0x2'))(_0x9e01('0x3'));var gotoif=schema({'condition':{'type':_0x9e01('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x9e01('0x5')},'priorityFalse':{'type':'number','message':_0x9e01('0x6')}});exports['consequence']=function(_0x8c7cee,_0x4bb20d){return function(_0x1690e6){try{var _0x103e1f={'condition':htmlToText[_0x9e01('0x7')](utils[_0x9e01('0x8')](_0x4bb20d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4bb20d[0x1],'priorityFalse':_0x4bb20d[0x2]};var _0x1349e9=gotoif[_0x9e01('0x0')](_0x103e1f,{'typecast':!![]});if(_0x1349e9['length']){logger[_0x9e01('0x9')](_0x9e01('0xa'),_0x8c7cee,_[_0x9e01('0xb')](_0x1349e9,_0x9e01('0xc'))[_0x9e01('0xd')](',\x20'));_0x1690e6[_0x9e01('0xe')]();}else{try{var _0x38f309=eval('('+_0x103e1f[_0x9e01('0xf')]+')');var _0xf683cf=_0x38f309?_0x103e1f[_0x9e01('0x10')]:_0x103e1f[_0x9e01('0x11')];logger[_0x9e01('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x8c7cee,_0x103e1f[_0x9e01('0xf')],_0x38f309,_0xf683cf||_0x9e01('0x13'));if(_0xf683cf){var _0x3e76a8=_['findIndex'](_0x1690e6[_0x9e01('0x14')](),{'p':_0xf683cf});if(_0x3e76a8>=0x0){logger[_0x9e01('0x12')](_0x9e01('0x15'),_0x8c7cee,_0xf683cf||_0x9e01('0x13'),_0x3e76a8);_0x1690e6[_0x9e01('0x13')](_0x3e76a8);}else{logger['info'](_0x9e01('0x16'),_0x8c7cee,_0xf683cf||'next');_0x1690e6[_0x9e01('0xe')]();}}else{_0x1690e6[_0x9e01('0x13')]();}}catch(_0xb12061){logger[_0x9e01('0x9')](_0x9e01('0x17'),_0x8c7cee,_0xb12061[_0x9e01('0xc')]);_0x1690e6[_0x9e01('0xe')]();}}}catch(_0x50c38d){logger[_0x9e01('0x9')](_0x9e01('0xa'),_0x8c7cee,JSON[_0x9e01('0x18')](_0x50c38d));_0x1690e6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 63a18f8..d9a6b26 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 _0x362f=['routing','number','consequence','[%s][GOTOP]\x20%s','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger'];(function(_0x1ac0d3,_0x35b4ca){var _0x37d678=function(_0x5f4bfa){while(--_0x5f4bfa){_0x1ac0d3['push'](_0x1ac0d3['shift']());}};_0x37d678(++_0x35b4ca);}(_0x362f,0xa8));var _0xf362=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x362f[_0x1d9aa0];return _0x226868;};'use strict';var schema=require(_0xf362('0x0'));var _=require(_0xf362('0x1'));var logger=require(_0xf362('0x2'))(_0xf362('0x3'));var gotop=schema({'priority':{'type':_0xf362('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf362('0x5')]=function(_0x599bd8,_0x19178a){return function(_0xbcfb1){try{var _0x38ba49={'priority':_0x19178a[0x0]};var _0x1909a6=gotop[_0xf362('0x0')](_0x38ba49,{'typecast':!![]});if(_0x1909a6['length']){logger['error'](_0xf362('0x6'),_0x599bd8,_['map'](_0x1909a6,_0xf362('0x7'))['join'](',\x20'));_0xbcfb1[_0xf362('0x8')]();}else{logger['info'](_0xf362('0x9'),_0x599bd8,_0x38ba49[_0xf362('0xa')]);if(_0x38ba49[_0xf362('0xa')]){var _0x1827fc=_[_0xf362('0xb')](_0xbcfb1[_0xf362('0xc')](),{'p':_0x38ba49[_0xf362('0xa')]});if(_0x1827fc>=0x0){logger[_0xf362('0xd')](_0xf362('0xe'),_0x599bd8,_0x38ba49[_0xf362('0xa')]||_0xf362('0xf'),_0x1827fc);_0xbcfb1[_0xf362('0xf')](_0x1827fc);}else{logger['info'](_0xf362('0x10'),_0x599bd8,_0x38ba49[_0xf362('0xa')]||_0xf362('0xf'));_0xbcfb1[_0xf362('0x8')]();}}else{_0xbcfb1[_0xf362('0xf')]();}}}catch(_0x301308){logger[_0xf362('0x11')](_0xf362('0x6'),_0x599bd8,JSON[_0xf362('0x12')](_0x301308));_0xbcfb1[_0xf362('0x8')]();}};}; \ No newline at end of file +var _0xce5e=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0x4e3793,_0x16003a){var _0x7dc917=function(_0x511a4f){while(--_0x511a4f){_0x4e3793['push'](_0x4e3793['shift']());}};_0x7dc917(++_0x16003a);}(_0xce5e,0x16c));var _0xece5=function(_0x3b0b00,_0x46ba56){_0x3b0b00=_0x3b0b00-0x0;var _0x5e02e8=_0xce5e[_0x3b0b00];return _0x5e02e8;};'use strict';var schema=require(_0xece5('0x0'));var _=require(_0xece5('0x1'));var logger=require('../../../../config/logger')(_0xece5('0x2'));var gotop=schema({'priority':{'type':_0xece5('0x3'),'required':!![],'message':_0xece5('0x4')}});exports[_0xece5('0x5')]=function(_0x525882,_0x2af6fb){return function(_0x45c34f){try{var _0x13a0d6={'priority':_0x2af6fb[0x0]};var _0x4ec532=gotop[_0xece5('0x0')](_0x13a0d6,{'typecast':!![]});if(_0x4ec532[_0xece5('0x6')]){logger[_0xece5('0x7')](_0xece5('0x8'),_0x525882,_[_0xece5('0x9')](_0x4ec532,_0xece5('0xa'))[_0xece5('0xb')](',\x20'));_0x45c34f[_0xece5('0xc')]();}else{logger[_0xece5('0xd')](_0xece5('0xe'),_0x525882,_0x13a0d6[_0xece5('0xf')]);if(_0x13a0d6[_0xece5('0xf')]){var _0x2a6ef4=_[_0xece5('0x10')](_0x45c34f[_0xece5('0x11')](),{'p':_0x13a0d6[_0xece5('0xf')]});if(_0x2a6ef4>=0x0){logger[_0xece5('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x525882,_0x13a0d6[_0xece5('0xf')]||_0xece5('0x12'),_0x2a6ef4);_0x45c34f[_0xece5('0x12')](_0x2a6ef4);}else{logger[_0xece5('0xd')](_0xece5('0x13'),_0x525882,_0x13a0d6[_0xece5('0xf')]||_0xece5('0x12'));_0x45c34f[_0xece5('0xc')]();}}else{_0x45c34f[_0xece5('0x12')]();}}}catch(_0x5c8207){logger[_0xece5('0x7')]('[%s][GOTOP]\x20%s',_0x525882,JSON[_0xece5('0x14')](_0x5c8207));_0x45c34f[_0xece5('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 28cd386..d8cc5e7 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 _0x55f7=['stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','upperFirst','AccountId','InteractionId','interaction','Message','create','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop'];(function(_0xd9a0fa,_0x434c24){var _0x43f1e9=function(_0x118619){while(--_0x118619){_0xd9a0fa['push'](_0xd9a0fa['shift']());}};_0x43f1e9(++_0x434c24);}(_0x55f7,0xe1));var _0x755f=function(_0x240ecb,_0x1db43c){_0x240ecb=_0x240ecb-0x0;var _0x8c6878=_0x55f7[_0x240ecb];return _0x8c6878;};'use strict';var _=require(_0x755f('0x0'));var utils=require(_0x755f('0x1'));var logger=require(_0x755f('0x2'))(_0x755f('0x3'));var rpc={'chatMessage':require(_0x755f('0x4')),'openchannelMessage':require(_0x755f('0x5')),'mailMessage':require(_0x755f('0x6')),'smsMessage':require(_0x755f('0x7')),'faxMessage':require(_0x755f('0x8')),'whatsappMessage':require(_0x755f('0x9'))};exports['consequence']=function(_0x383941,_0x5cce63){return function(_0x49c334){try{var _0x3d8980={'body':utils[_0x755f('0xa')](_0x5cce63[0x0],this),'ContactId':this[_0x755f('0xb')]['id']};if(this[_0x755f('0xc')]===_0x755f('0xd')){_0x3d8980['ChatWebsiteId']=this['account']['id'];}else{_0x3d8980[_[_0x755f('0xe')](this[_0x755f('0xc')])+_0x755f('0xf')]=this['account']['id'];}_0x3d8980[_[_0x755f('0xe')](this[_0x755f('0xc')])+_0x755f('0x10')]=this[_0x755f('0x11')]['id'];if(rpc[this['channel']+_0x755f('0x12')]){return rpc[this[_0x755f('0xc')]+_0x755f('0x12')][_0x755f('0x13')](_0x3d8980)['then'](function(_0x46ca6f){logger[_0x755f('0x14')]('[%s][MESSAGE]\x20%s',_0x383941,_0x3d8980[_0x755f('0x15')]);_0x49c334[_0x755f('0x16')]();})[_0x755f('0x17')](function(_0x1abe66){logger[_0x755f('0x18')](_0x755f('0x19'),_0x383941,JSON['stringify'](_0x1abe66));_0x49c334[_0x755f('0x1a')]();});}}catch(_0x567479){logger[_0x755f('0x18')]('[%s][MESSAGE]\x20%s',_0x383941,JSON[_0x755f('0x1b')](_0x567479));_0x49c334[_0x755f('0x1a')]();}};}; \ No newline at end of file +var _0x6125=['contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x1f6f97,_0x231d6e){var _0x49d0fd=function(_0x1fd61c){while(--_0x1fd61c){_0x1f6f97['push'](_0x1f6f97['shift']());}};_0x49d0fd(++_0x231d6e);}(_0x6125,0x13c));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5612('0x0'));var utils=require(_0x5612('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5612('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5612('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5612('0x4'))};exports[_0x5612('0x5')]=function(_0x47014e,_0xcc912b){return function(_0x99828c){try{var _0x33f6e5={'body':utils['getMustacheRender'](_0xcc912b[0x0],this),'ContactId':this[_0x5612('0x6')]['id']};if(this[_0x5612('0x7')]===_0x5612('0x8')){_0x33f6e5[_0x5612('0x9')]=this['account']['id'];}else{_0x33f6e5[_[_0x5612('0xa')](this['channel'])+_0x5612('0xb')]=this['account']['id'];}_0x33f6e5[_[_0x5612('0xa')](this[_0x5612('0x7')])+_0x5612('0xc')]=this[_0x5612('0xd')]['id'];if(rpc[this['channel']+_0x5612('0xe')]){return rpc[this['channel']+_0x5612('0xe')]['create'](_0x33f6e5)[_0x5612('0xf')](function(_0x439118){logger[_0x5612('0x10')](_0x5612('0x11'),_0x47014e,_0x33f6e5[_0x5612('0x12')]);_0x99828c['next']();})[_0x5612('0x13')](function(_0x2c34c3){logger[_0x5612('0x14')](_0x5612('0x11'),_0x47014e,JSON[_0x5612('0x15')](_0x2c34c3));_0x99828c[_0x5612('0x16')]();});}}catch(_0x3b3ce5){logger['error'](_0x5612('0x11'),_0x47014e,JSON[_0x5612('0x15')](_0x3b3ce5));_0x99828c[_0x5612('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 f8774bd..6e25fd3 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 _0xe641=['[%s][NOOP]\x20%s','getMustacheRender','next','error','./utils','../../../../config/logger','consequence','info'];(function(_0x521b3a,_0xd5ec0b){var _0x60eced=function(_0x2532c7){while(--_0x2532c7){_0x521b3a['push'](_0x521b3a['shift']());}};_0x60eced(++_0xd5ec0b);}(_0xe641,0x1ec));var _0x1e64=function(_0x3e0de5,_0xde4078){_0x3e0de5=_0x3e0de5-0x0;var _0x114ec1=_0xe641[_0x3e0de5];return _0x114ec1;};'use strict';var utils=require(_0x1e64('0x0'));var logger=require(_0x1e64('0x1'))('routing');exports[_0x1e64('0x2')]=function(_0xaa44a6,_0x350a72){return function(_0x41cb70){try{logger[_0x1e64('0x3')](_0x1e64('0x4'),_0xaa44a6,utils[_0x1e64('0x5')](_0x350a72[0x0],this));_0x41cb70[_0x1e64('0x6')]();}catch(_0x236da5){logger[_0x1e64('0x7')](_0x1e64('0x4'),_0xaa44a6,JSON['stringify'](_0x236da5));_0x41cb70['stop']();}};}; \ No newline at end of file +var _0x2663=['next','error','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x4612e7,_0x2ecea2){var _0x15f6f0=function(_0x97880){while(--_0x97880){_0x4612e7['push'](_0x4612e7['shift']());}};_0x15f6f0(++_0x2ecea2);}(_0x2663,0xb8));var _0x3266=function(_0xd07790,_0x3db009){_0xd07790=_0xd07790-0x0;var _0x32f10e=_0x2663[_0xd07790];return _0x32f10e;};'use strict';var utils=require(_0x3266('0x0'));var logger=require(_0x3266('0x1'))('routing');exports[_0x3266('0x2')]=function(_0x4bb5ee,_0xf5c239){return function(_0x4adc00){try{logger[_0x3266('0x3')](_0x3266('0x4'),_0x4bb5ee,utils[_0x3266('0x5')](_0xf5c239[0x0],this));_0x4adc00[_0x3266('0x6')]();}catch(_0x4a3e36){logger[_0x3266('0x7')](_0x3266('0x4'),_0x4bb5ee,JSON[_0x3266('0x8')](_0x4a3e36));_0x4adc00[_0x3266('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 70c0990..3c7e6a0 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 _0xc68f=['rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','redis','defaults','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','push','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','MessageId','message','channel','chat','AccountId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','waiting','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','Queues','timeout','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close'];(function(_0x1f525f,_0x2fd1d4){var _0x2fd8c8=function(_0x2e7c8b){while(--_0x2e7c8b){_0x1f525f['push'](_0x1f525f['shift']());}};_0x2fd8c8(++_0x2fd1d4);}(_0xc68f,0xfe));var _0xfc68=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc68f[_0x397e5f];return _0x5302b8;};'use strict';var schema=require(_0xfc68('0x0'));var _=require(_0xfc68('0x1'));var util=require(_0xfc68('0x2'));var seqqueue=require(_0xfc68('0x3'));var moment=require(_0xfc68('0x4'));var Redis=require(_0xfc68('0x5'));var config=require(_0xfc68('0x6'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config[_0xfc68('0x7')]=_[_0xfc68('0x8')](config[_0xfc68('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xfc68('0x9'))(new Redis(config[_0xfc68('0x7')]));var attributes=['id',_0xfc68('0xa'),'account',_0xfc68('0xb'),_0xfc68('0xc'),_0xfc68('0xd')];function emit(_0x400bac,_0x38c0c7,_0x4c4d3c){io['to'](_0x400bac)[_0xfc68('0xe')](_0x38c0c7,_0x4c4d3c);}function emitChannelQueueInteraction(_0x56c317,_0x303f08,_0x383860,_0x514e78,_0x3d754e,_0x34269d,_0xd7f1c3,_0x3e8665){var _0x470f82=_[_0xfc68('0xf')](_0x383860);_0x470f82[_0xfc68('0xa')]=_0x3e8665;_0x470f82[_0xfc68('0xb')]=_0x303f08;_0x470f82['account']=_0x514e78;_0x470f82['id']=_0x3d754e;if(_0x34269d){attributes[_0xfc68('0x10')](_['capitalize'](_0x56c317)+'InteractionId');_0xd7f1c3[util[_0xfc68('0x11')](_0xfc68('0x12'),_0x56c317)][_0x3d754e]=_[_0xfc68('0x13')](_0x470f82,attributes);}else{delete _0xd7f1c3[util['format'](_0xfc68('0x12'),_0x56c317)][_0x3d754e];}emit(util[_0xfc68('0x11')]('%s:queue:%s',_0x56c317,_0x303f08),util[_0xfc68('0x11')](_0xfc68('0x14'),_0x56c317,_0x34269d?_0xfc68('0x15'):_0xfc68('0x16')),_[_0xfc68('0x13')](_0x470f82,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xfc68('0x17')),'chatQueueReport':require(_0xfc68('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xfc68('0x19')),'whatsappQueueReport':require(_0xfc68('0x1a')),'chatInteraction':require(_0xfc68('0x1b')),'faxInteraction':require(_0xfc68('0x1c')),'mailInteraction':require(_0xfc68('0x1d')),'openchannelInteraction':require(_0xfc68('0x1e')),'smsInteraction':require(_0xfc68('0x1f')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xfc68('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfc68('0x21'),'message':_0xfc68('0x22')}});function startRouting(_0x313ef1,_0xdf648,_0x5ca075,_0x579c64){if(_0x313ef1&&_0xdf648&&_0x5ca075){_0xdf648['waiting']+=0x1;var _0x3c1241={'uniqueid':_0x313ef1,'from':_0x5ca075['body']?_0x5ca075[_0xfc68('0x23')][_0xfc68('0xc')]:'','joinAt':moment()[_0xfc68('0x11')](_0xfc68('0x24')),'ContactId':_0x5ca075['contact']?_0x5ca075[_0xfc68('0x25')]['id']:null,'ListId':_0x5ca075['list']?_0x5ca075[_0xfc68('0x26')]['id']:null};_0x3c1241[_[_0xfc68('0x27')](_0x5ca075['channel'])+_0xfc68('0x28')]=_0xdf648['id']||null;_0x3c1241[_[_0xfc68('0x27')](_0x5ca075['channel'])+'InteractionId']=_0x5ca075[_0xfc68('0x29')]?_0x5ca075['interaction']['id']:null;_0x3c1241[_[_0xfc68('0x27')](_0x5ca075['channel'])+_0xfc68('0x2a')]=_0x5ca075[_0xfc68('0x2b')]?_0x5ca075[_0xfc68('0x2b')]['id']:null;_0x3c1241[_[_0xfc68('0x27')](_0x5ca075[_0xfc68('0x2c')])+(_0x5ca075[_0xfc68('0x2c')]!==_0xfc68('0x2d')?_0xfc68('0x2e'):'WebsiteId')]=_0x5ca075[_0xfc68('0x2f')]?_0x5ca075[_0xfc68('0x2f')]['id']:null;logger[_0xfc68('0x30')](util[_0xfc68('0x11')](_0xfc68('0x31'),_0x313ef1,_0xdf648['name']));emitChannelQueueInteraction(_0x5ca075['channel'],_0xdf648[_0xfc68('0x32')],_0x3c1241,_0x5ca075['account'][_0xfc68('0x32')],_0x5ca075[_0xfc68('0x2b')]['id'],!![],_0x579c64,_0xdf648['id']);if(rpc[_0x5ca075[_0xfc68('0x2c')]+'QueueReport']){return rpc[_0x5ca075[_0xfc68('0x2c')]+_0xfc68('0x33')][_0xfc68('0x34')](_0x3c1241)[_0xfc68('0x35')](function(_0xbcc89){logger[_0xfc68('0x36')]('create\x20queue\x20report',_0xbcc89);});}}}function stopRouting(_0x1f844b,_0xa18e9e,_0x1200c8,_0x323788){if(_0x1f844b&&_0xa18e9e){_0xa18e9e[_0xfc68('0x37')]-=0x1;var _0x2aa7de={'leaveAt':moment()[_0xfc68('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xfc68('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format'](_0xfc68('0x38'),_0x1f844b,_0xa18e9e[_0xfc68('0x32')]));emitChannelQueueInteraction(_0x1200c8[_0xfc68('0x2c')],_0xa18e9e['name'],_0x1200c8['body'],_0x1200c8[_0xfc68('0x2f')]['name'],_0x1200c8[_0xfc68('0x2b')]['id'],![],_0x323788,_0xa18e9e['id']);return rpc[_0x1200c8[_0xfc68('0x2c')]+_0xfc68('0x39')]['update'](_0x1200c8[_0xfc68('0x29')]['id'],{'queueId':_0xa18e9e['id']})['then'](function(){if(rpc[_0x1200c8[_0xfc68('0x2c')]+_0xfc68('0x33')]){return rpc[_0x1200c8[_0xfc68('0x2c')]+_0xfc68('0x33')][_0xfc68('0x3a')](_0x1f844b,_0x2aa7de)[_0xfc68('0x35')](function(_0x2528e8){logger[_0xfc68('0x36')](_0xfc68('0x3b'),_0x2528e8);});}});}}function endRouting(_0x31a829,_0x4c231f,_0x226da5,_0x35d121){if(_0x31a829&&_0x4c231f){_0x4c231f[_0xfc68('0x37')]-=0x1;var _0x4d2a56={'leaveAt':moment()[_0xfc68('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xfc68('0x11')](_0xfc68('0x24')),'reason':'timeout'};logger[_0xfc68('0x30')](util['format'](_0xfc68('0x3c'),_0x31a829,_0x4c231f[_0xfc68('0x32')]));emitChannelQueueInteraction(_0x226da5[_0xfc68('0x2c')],_0x4c231f[_0xfc68('0x32')],_0x226da5[_0xfc68('0x23')],_0x226da5[_0xfc68('0x2f')]['name'],_0x226da5[_0xfc68('0x2b')]['id'],![],_0x35d121);if(rpc[_0x226da5['channel']+_0xfc68('0x33')]){return rpc[_0x226da5[_0xfc68('0x2c')]+_0xfc68('0x33')][_0xfc68('0x3a')](_0x31a829,_0x4d2a56)[_0xfc68('0x35')](function(_0x4e1116){logger[_0xfc68('0x36')](_0xfc68('0x3b'),_0x4e1116);});}}}function handleFindQueue(_0x410f00){return function(_0x159052){return _0x159052[_0xfc68('0x32')][_0xfc68('0x3d')]()===_0x410f00[_0xfc68('0x3d')]();};}exports['consequence']=function(_0x32e119,_0x38ee41,_0x386dbd,_0x115b24){return function(_0x2e35f5){try{var _0x16d4c5={'name':_0x38ee41[0x0],'timeout':_0x38ee41[0x1]};var _0x287c6e=queue['validate'](_0x16d4c5,{'typecast':!![]});if(_0x287c6e[_0xfc68('0x3e')]){logger[_0xfc68('0x36')](_0xfc68('0x3f'),_0x32e119,_[_0xfc68('0x40')](_0x287c6e,_0xfc68('0x2b'))[_0xfc68('0x41')](',\x20'));_0x2e35f5['stop']();}else{var _0x5e4409=_['find'](_0x386dbd[_0x115b24[_0xfc68('0x2c')]+_0xfc68('0x42')],handleFindQueue(_0x16d4c5[_0xfc68('0x32')]));if(_0x5e4409){startRouting(_0x32e119,_0x5e4409,_0x115b24,_0x386dbd);var _0x440c97=(_0x5e4409[_0xfc68('0x43')]||0xa)*0x3e8;var _0x58be49=(_0x16d4c5[_0xfc68('0x43')]||0x14)*0x3e8;var _0xbf91f;if(_0x440c97>_0x58be49){_0x58be49=_0x440c97;}var _0x555ebe=seqqueue[_0xfc68('0x44')](_0x440c97);_0x555ebe['id']=_0x32e119;_0x555ebe[_0xfc68('0x45')]=_0x440c97;_0x555ebe[_0xfc68('0x46')]=_0x58be49;_0x555ebe[_0xfc68('0x2c')]=_0x115b24[_0xfc68('0x2c')];_0x386dbd['rules'][_0x32e119]['on'](_0xfc68('0x47'),function(){logger[_0xfc68('0x30')](_0xfc68('0x48'),_0x32e119);stopRouting(_0x32e119,_0x5e4409,_0x115b24,_0x386dbd);clearTimeout(_0xbf91f);_0xbf91f=undefined;_0x555ebe[_0xfc68('0x49')](!![]);if(_0x386dbd[_0xfc68('0x4a')][_0x32e119]){delete _0x386dbd['rules'][_0x32e119];}_0x2e35f5[_0xfc68('0x4b')]();});_0x386dbd['rules'][_0x32e119]['on'](_0xfc68('0x4c'),function(){if(_0x386dbd[_0xfc68('0x4a')][_0x32e119]){delete _0x386dbd['rules'][_0x32e119];}});_0xbf91f=setTimeout(function(){logger[_0xfc68('0x30')](_0xfc68('0x4d'),_0x32e119);endRouting(_0x32e119,_0x5e4409,_0x115b24,_0x386dbd);clearTimeout(_0xbf91f);_0x555ebe[_0xfc68('0x49')](!![]);_0x2e35f5['next']();},_0x58be49);switch(_0x5e4409[_0xfc68('0x4e')]){case _0xfc68('0x4f'):strategy[_0xfc68('0x4f')](_0x555ebe,_0x5e4409,_0x386dbd,_0x115b24);break;default:strategy['beepall'](_0x555ebe,_0x5e4409,_0x386dbd,_0x115b24);}}else{logger[_0xfc68('0x36')](_0xfc68('0x50'),_0x32e119,_0x16d4c5[_0xfc68('0x32')]);_0x2e35f5[_0xfc68('0x4b')]();}}}catch(_0x15e624){logger['error'](_0xfc68('0x3f'),_0x32e119,_0x15e624[_0xfc68('0x51')]);_0x2e35f5['stop']();}};}; \ No newline at end of file +var _0xd410=['localhost','socket.io-emitter','queue_id','from','joinAt','emit','clone','queue','account','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','update','then','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','lodash','util','seq-queue','moment','../../../../config/logger','routing','./strategy','redis','defaults'];(function(_0x340a1f,_0x1533e8){var _0x4831cc=function(_0x5289e8){while(--_0x5289e8){_0x340a1f['push'](_0x340a1f['shift']());}};_0x4831cc(++_0x1533e8);}(_0xd410,0x132));var _0x0d41=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd410[_0x580576];return _0x3f55a0;};'use strict';var schema=require(_0x0d41('0x0'));var _=require(_0x0d41('0x1'));var util=require(_0x0d41('0x2'));var seqqueue=require(_0x0d41('0x3'));var moment=require(_0x0d41('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x0d41('0x5'))(_0x0d41('0x6'));var strategy=require(_0x0d41('0x7'));config[_0x0d41('0x8')]=_[_0x0d41('0x9')](config['redis'],{'host':_0x0d41('0xa'),'port':0x18eb});var io=require(_0x0d41('0xb'))(new Redis(config[_0x0d41('0x8')]));var attributes=['id',_0x0d41('0xc'),'account','queue',_0x0d41('0xd'),_0x0d41('0xe')];function emit(_0x3325b8,_0x5da08e,_0x3830d8){io['to'](_0x3325b8)[_0x0d41('0xf')](_0x5da08e,_0x3830d8);}function emitChannelQueueInteraction(_0x4ceba7,_0x506afb,_0x469929,_0x10d94e,_0x8b46f1,_0x1d5b2b,_0x4d0364,_0x4d7de1){var _0x391c9e=_[_0x0d41('0x10')](_0x469929);_0x391c9e[_0x0d41('0xc')]=_0x4d7de1;_0x391c9e[_0x0d41('0x11')]=_0x506afb;_0x391c9e[_0x0d41('0x12')]=_0x10d94e;_0x391c9e['id']=_0x8b46f1;if(_0x1d5b2b){attributes[_0x0d41('0x13')](_[_0x0d41('0x14')](_0x4ceba7)+_0x0d41('0x15'));_0x4d0364[util['format'](_0x0d41('0x16'),_0x4ceba7)][_0x8b46f1]=_[_0x0d41('0x17')](_0x391c9e,attributes);}else{delete _0x4d0364[util[_0x0d41('0x18')](_0x0d41('0x16'),_0x4ceba7)][_0x8b46f1];}emit(util[_0x0d41('0x18')](_0x0d41('0x19'),_0x4ceba7,_0x506afb),util[_0x0d41('0x18')]('%s_queue_waiting_interaction:%s',_0x4ceba7,_0x1d5b2b?_0x0d41('0x1a'):_0x0d41('0x1b')),_['pick'](_0x391c9e,attributes));}var rpc={'openchannelQueueReport':require(_0x0d41('0x1c')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x0d41('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0d41('0x1e')),'chatInteraction':require(_0x0d41('0x1f')),'faxInteraction':require(_0x0d41('0x20')),'mailInteraction':require(_0x0d41('0x21')),'openchannelInteraction':require(_0x0d41('0x22')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x0d41('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0d41('0x24')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x790e41,_0x544194,_0x276068,_0xf6912){if(_0x790e41&&_0x544194&&_0x276068){_0x544194[_0x0d41('0x25')]+=0x1;var _0x404652={'uniqueid':_0x790e41,'from':_0x276068[_0x0d41('0x26')]?_0x276068['body'][_0x0d41('0xd')]:'','joinAt':moment()[_0x0d41('0x18')](_0x0d41('0x27')),'ContactId':_0x276068[_0x0d41('0x28')]?_0x276068[_0x0d41('0x28')]['id']:null,'ListId':_0x276068[_0x0d41('0x29')]?_0x276068['list']['id']:null};_0x404652[_[_0x0d41('0x2a')](_0x276068[_0x0d41('0x2b')])+_0x0d41('0x2c')]=_0x544194['id']||null;_0x404652[_[_0x0d41('0x2a')](_0x276068[_0x0d41('0x2b')])+_0x0d41('0x15')]=_0x276068[_0x0d41('0x2d')]?_0x276068[_0x0d41('0x2d')]['id']:null;_0x404652[_['upperFirst'](_0x276068[_0x0d41('0x2b')])+'MessageId']=_0x276068[_0x0d41('0x2e')]?_0x276068[_0x0d41('0x2e')]['id']:null;_0x404652[_[_0x0d41('0x2a')](_0x276068['channel'])+(_0x276068['channel']!==_0x0d41('0x2f')?_0x0d41('0x30'):_0x0d41('0x31'))]=_0x276068[_0x0d41('0x12')]?_0x276068[_0x0d41('0x12')]['id']:null;logger[_0x0d41('0x32')](util[_0x0d41('0x18')](_0x0d41('0x33'),_0x790e41,_0x544194[_0x0d41('0x34')]));emitChannelQueueInteraction(_0x276068['channel'],_0x544194['name'],_0x404652,_0x276068[_0x0d41('0x12')][_0x0d41('0x34')],_0x276068['message']['id'],!![],_0xf6912,_0x544194['id']);if(rpc[_0x276068[_0x0d41('0x2b')]+_0x0d41('0x35')]){return rpc[_0x276068[_0x0d41('0x2b')]+_0x0d41('0x35')][_0x0d41('0x36')](_0x404652)['catch'](function(_0x560850){logger[_0x0d41('0x37')](_0x0d41('0x38'),_0x560850);});}}}function stopRouting(_0x5b5fc4,_0xdc68c3,_0x215c9f,_0x50b8ec){if(_0x5b5fc4&&_0xdc68c3){_0xdc68c3[_0x0d41('0x25')]-=0x1;var _0x157972={'leaveAt':moment()[_0x0d41('0x18')](_0x0d41('0x27')),'acceptAt':moment()['format'](_0x0d41('0x27')),'reason':_0x0d41('0x39')};logger[_0x0d41('0x32')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x5b5fc4,_0xdc68c3[_0x0d41('0x34')]));emitChannelQueueInteraction(_0x215c9f[_0x0d41('0x2b')],_0xdc68c3['name'],_0x215c9f['body'],_0x215c9f[_0x0d41('0x12')][_0x0d41('0x34')],_0x215c9f[_0x0d41('0x2e')]['id'],![],_0x50b8ec,_0xdc68c3['id']);return rpc[_0x215c9f['channel']+'Interaction'][_0x0d41('0x3a')](_0x215c9f[_0x0d41('0x2d')]['id'],{'queueId':_0xdc68c3['id']})[_0x0d41('0x3b')](function(){if(rpc[_0x215c9f[_0x0d41('0x2b')]+_0x0d41('0x35')]){return rpc[_0x215c9f[_0x0d41('0x2b')]+'QueueReport']['update'](_0x5b5fc4,_0x157972)['catch'](function(_0x3c7e48){logger[_0x0d41('0x37')]('update\x20queue\x20report',_0x3c7e48);});}});}}function endRouting(_0x365a45,_0x242285,_0x380721,_0x306084){if(_0x365a45&&_0x242285){_0x242285[_0x0d41('0x25')]-=0x1;var _0x323018={'leaveAt':moment()[_0x0d41('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0d41('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x0d41('0x3c')};logger[_0x0d41('0x32')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x365a45,_0x242285[_0x0d41('0x34')]));emitChannelQueueInteraction(_0x380721[_0x0d41('0x2b')],_0x242285[_0x0d41('0x34')],_0x380721[_0x0d41('0x26')],_0x380721['account'][_0x0d41('0x34')],_0x380721['message']['id'],![],_0x306084);if(rpc[_0x380721[_0x0d41('0x2b')]+'QueueReport']){return rpc[_0x380721['channel']+_0x0d41('0x35')][_0x0d41('0x3a')](_0x365a45,_0x323018)['catch'](function(_0x474a3b){logger[_0x0d41('0x37')]('update\x20queue\x20report',_0x474a3b);});}}}function handleFindQueue(_0x15d246){return function(_0x53fd7b){return _0x53fd7b[_0x0d41('0x34')][_0x0d41('0x3d')]()===_0x15d246['toLowerCase']();};}exports['consequence']=function(_0x167bb3,_0x32ba9c,_0x172790,_0x1c2ce2){return function(_0x4e1667){try{var _0x247fc9={'name':_0x32ba9c[0x0],'timeout':_0x32ba9c[0x1]};var _0x19b5e5=queue[_0x0d41('0x0')](_0x247fc9,{'typecast':!![]});if(_0x19b5e5[_0x0d41('0x3e')]){logger['error'](_0x0d41('0x3f'),_0x167bb3,_[_0x0d41('0x40')](_0x19b5e5,_0x0d41('0x2e'))['join'](',\x20'));_0x4e1667[_0x0d41('0x41')]();}else{var _0x3c8545=_[_0x0d41('0x42')](_0x172790[_0x1c2ce2[_0x0d41('0x2b')]+_0x0d41('0x43')],handleFindQueue(_0x247fc9['name']));if(_0x3c8545){startRouting(_0x167bb3,_0x3c8545,_0x1c2ce2,_0x172790);var _0x481b06=(_0x3c8545[_0x0d41('0x3c')]||0xa)*0x3e8;var _0x32269c=(_0x247fc9[_0x0d41('0x3c')]||0x14)*0x3e8;var _0x219c90;if(_0x481b06>_0x32269c){_0x32269c=_0x481b06;}var _0x5b58aa=seqqueue['createQueue'](_0x481b06);_0x5b58aa['id']=_0x167bb3;_0x5b58aa[_0x0d41('0x44')]=_0x481b06;_0x5b58aa[_0x0d41('0x45')]=_0x32269c;_0x5b58aa[_0x0d41('0x2b')]=_0x1c2ce2[_0x0d41('0x2b')];_0x172790[_0x0d41('0x46')][_0x167bb3]['on'](_0x0d41('0x47'),function(){logger[_0x0d41('0x32')](_0x0d41('0x48'),_0x167bb3);stopRouting(_0x167bb3,_0x3c8545,_0x1c2ce2,_0x172790);clearTimeout(_0x219c90);_0x219c90=undefined;_0x5b58aa[_0x0d41('0x49')](!![]);if(_0x172790[_0x0d41('0x46')][_0x167bb3]){delete _0x172790[_0x0d41('0x46')][_0x167bb3];}_0x4e1667[_0x0d41('0x41')]();});_0x172790[_0x0d41('0x46')][_0x167bb3]['on']('complete',function(){if(_0x172790[_0x0d41('0x46')][_0x167bb3]){delete _0x172790[_0x0d41('0x46')][_0x167bb3];}});_0x219c90=setTimeout(function(){logger['info'](_0x0d41('0x4a'),_0x167bb3);endRouting(_0x167bb3,_0x3c8545,_0x1c2ce2,_0x172790);clearTimeout(_0x219c90);_0x5b58aa[_0x0d41('0x49')](!![]);_0x4e1667[_0x0d41('0x4b')]();},_0x32269c);switch(_0x3c8545[_0x0d41('0x4c')]){case _0x0d41('0x4d'):strategy[_0x0d41('0x4d')](_0x5b58aa,_0x3c8545,_0x172790,_0x1c2ce2);break;default:strategy[_0x0d41('0x4e')](_0x5b58aa,_0x3c8545,_0x172790,_0x1c2ce2);}}else{logger[_0x0d41('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x167bb3,_0x247fc9[_0x0d41('0x34')]);_0x4e1667[_0x0d41('0x41')]();}}}catch(_0x471edb){logger[_0x0d41('0x37')](_0x0d41('0x3f'),_0x167bb3,_0x471edb['stack']);_0x4e1667['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index a4d7c54..a4462b5 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 _0x826a=['forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','removeWaitingNotification','TIMEOUT','exports','uuid','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','agents','debug','isAgentAvailable','channel','showNotification','notificationId','writeLog','RINGING'];(function(_0x229be7,_0x5f31f2){var _0x53a7aa=function(_0xb65a02){while(--_0xb65a02){_0x229be7['push'](_0x229be7['shift']());}};_0x53a7aa(++_0x5f31f2);}(_0x826a,0x1aa));var _0xa826=function(_0x333db1,_0x227e7f){_0x333db1=_0x333db1-0x0;var _0x3b695b=_0x826a[_0x333db1];return _0x3b695b;};'use strict';var _=require('lodash');var uuid=require(_0xa826('0x0'));var util=require('./util');var logger=require(_0xa826('0x1'))('routing');var Agent=function(_0x376d53,_0x19ba11,_0x2212a4,_0x34e1ad){this['notificationId']=uuid['v4']();this[_0xa826('0x2')]=_0x376d53;this[_0xa826('0x3')]=_0x19ba11;this[_0xa826('0x4')]=_0x2212a4;this[_0xa826('0x5')]=_0x34e1ad;this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xa'),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xb'),this['handleDrained'][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0x6')]=function(){this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xa826('0xd')][_0xa826('0x7')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);if(_['isNil'](this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']])){logger[_0xa826('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}else{if(this[_0xa826('0x5')]['forcedOwnership']||util[_0xa826('0x10')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this['agent']['id']],this[_0xa826('0x2')][_0xa826('0x11')],![])){this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busy']=!![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this['squeue'][_0xa826('0x11')]);util[_0xa826('0x12')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']],null,this['routing']);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0xa826('0x15')+(this[_0xa826('0x5')][_0xa826('0x16')]?_0xa826('0x17'):''));}else{logger[_0xa826('0xf')](_0xa826('0x18'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}}};Agent[_0xa826('0xd')][_0xa826('0x9')]=function(_0x2253c7){if(_[_0xa826('0x19')](this['realtime'][_0xa826('0xe')][this['agent']['id']])){return logger[_0xa826('0xf')](_0xa826('0x1a'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);}else{logger[_0xa826('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);util[_0xa826('0x1b')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],null,this['routing']);this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']][_0xa826('0x1c')]=![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util[_0xa826('0x1d')](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this[_0xa826('0x2')][_0xa826('0x11')]);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0x2253c7?'STOP':_0xa826('0x1e'));}if(!_0x2253c7){setTimeout(this['push'][_0xa826('0x8')](this),0x3e8);}};function agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f){return new Agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f);}module[_0xa826('0x1f')]=agent; \ No newline at end of file +var _0x5fd1=['forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','removeWaitingNotification','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','bind','handleTimeout','timeout','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x4e6fa4,_0x417e23){var _0x51217b=function(_0x43ba9c){while(--_0x43ba9c){_0x4e6fa4['push'](_0x4e6fa4['shift']());}};_0x51217b(++_0x417e23);}(_0x5fd1,0x155));var _0x15fd=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5fd1[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x15fd('0x0'));var uuid=require('uuid');var util=require(_0x15fd('0x1'));var logger=require(_0x15fd('0x2'))(_0x15fd('0x3'));var Agent=function(_0x50fc5a,_0x5d2d77,_0x370d34,_0x3138f3){this[_0x15fd('0x4')]=uuid['v4']();this['squeue']=_0x50fc5a;this[_0x15fd('0x5')]=_0x5d2d77;this[_0x15fd('0x6')]=_0x370d34;this[_0x15fd('0x3')]=_0x3138f3;this[_0x15fd('0x7')][_0x15fd('0x8')](this['handleRun'][_0x15fd('0x9')](this),this[_0x15fd('0xa')][_0x15fd('0x9')](this));this['squeue']['on'](_0x15fd('0xb'),this['handleTimeout'][_0x15fd('0x9')](this));this[_0x15fd('0x7')]['on']('drained',this['handleDrained']['bind'](this));};Agent[_0x15fd('0xc')][_0x15fd('0x8')]=function(){this[_0x15fd('0x7')][_0x15fd('0x8')](this[_0x15fd('0xd')][_0x15fd('0x9')](this),this[_0x15fd('0xa')][_0x15fd('0x9')](this));};Agent[_0x15fd('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x15fd('0xd')]=function(){logger[_0x15fd('0xe')](_0x15fd('0xf'),this[_0x15fd('0x7')]['id'],this[_0x15fd('0x5')]['id']);if(_[_0x15fd('0x10')](this[_0x15fd('0x6')][_0x15fd('0x11')][this['agent']['id']])){logger['debug'](_0x15fd('0x12'),this['squeue']['id'],this[_0x15fd('0x5')]['id']);setTimeout(this['push'][_0x15fd('0x9')](this),0x3e8);}else{if(this[_0x15fd('0x3')][_0x15fd('0x13')]||util['isAgentAvailable'](this[_0x15fd('0x7')]['id'],this[_0x15fd('0x6')][_0x15fd('0x11')][this[_0x15fd('0x5')]['id']],this[_0x15fd('0x7')][_0x15fd('0x14')],![])){this[_0x15fd('0x6')][_0x15fd('0x11')][this[_0x15fd('0x5')]['id']][_0x15fd('0x15')]=!![];this[_0x15fd('0x6')]['agents'][this['agent']['id']][_0x15fd('0x16')]=undefined;util[_0x15fd('0x17')](this[_0x15fd('0x6')],this[_0x15fd('0x3')],this[_0x15fd('0x5')],this[_0x15fd('0x7')][_0x15fd('0x14')]);util['showNotification'](this[_0x15fd('0x4')],this[_0x15fd('0x7')]['id'],this[_0x15fd('0x6')]['agents'][this[_0x15fd('0x5')]['id']],null,this['routing']);util[_0x15fd('0x18')](this[_0x15fd('0x7')]['id'],this[_0x15fd('0x6')]['agents'][this[_0x15fd('0x5')]['id']],_0x15fd('0x19')+(this[_0x15fd('0x3')]['forcedOwnership']?_0x15fd('0x1a'):''));}else{logger['debug'](_0x15fd('0x1b'),this[_0x15fd('0x7')]['id'],this[_0x15fd('0x5')]['id']);setTimeout(this[_0x15fd('0x8')][_0x15fd('0x9')](this),0x3e8);}}};Agent[_0x15fd('0xc')][_0x15fd('0xa')]=function(_0xe650a3){if(_[_0x15fd('0x10')](this[_0x15fd('0x6')][_0x15fd('0x11')][this['agent']['id']])){return logger[_0x15fd('0xe')](_0x15fd('0x12'),this['squeue']['id'],this[_0x15fd('0x5')]['id']);}else{logger[_0x15fd('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x15fd('0x7')]['id'],this[_0x15fd('0x5')]['id']);util['hideNotification'](this[_0x15fd('0x4')],this[_0x15fd('0x7')]['id'],this[_0x15fd('0x6')][_0x15fd('0x11')][this[_0x15fd('0x5')]['id']],null,this[_0x15fd('0x3')]);this['realtime'][_0x15fd('0x11')][this[_0x15fd('0x5')]['id']][_0x15fd('0x15')]=![];this[_0x15fd('0x6')]['agents'][this[_0x15fd('0x5')]['id']][_0x15fd('0x16')]=undefined;util[_0x15fd('0x1c')](this[_0x15fd('0x6')],this[_0x15fd('0x3')],this[_0x15fd('0x5')],this['squeue'][_0x15fd('0x14')]);util[_0x15fd('0x18')](this['squeue']['id'],this[_0x15fd('0x6')][_0x15fd('0x11')][this[_0x15fd('0x5')]['id']],_0xe650a3?'STOP':_0x15fd('0x1d'));}if(!_0xe650a3){setTimeout(this[_0x15fd('0x8')][_0x15fd('0x9')](this),0x3e8);}};function agent(_0xbe50e7,_0x163380,_0x6b2ac8,_0x4d7259){return new Agent(_0xbe50e7,_0x163380,_0x6b2ac8,_0x4d7259);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 535bab2..1b02dd5 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 _0x6037=['busy','busyQueue','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog'];(function(_0x4a4da8,_0x42663b){var _0x1ba4e2=function(_0x179860){while(--_0x179860){_0x4a4da8['push'](_0x4a4da8['shift']());}};_0x1ba4e2(++_0x42663b);}(_0x6037,0x97));var _0x7603=function(_0x7aba49,_0x568541){_0x7aba49=_0x7aba49-0x0;var _0x2962ee=_0x6037[_0x7aba49];return _0x2962ee;};'use strict';var _=require(_0x7603('0x0'));var uuid=require(_0x7603('0x1'));var util=require(_0x7603('0x2'));var logger=require(_0x7603('0x3'))(_0x7603('0x4'));var Beepall=function(_0x3d3dd9,_0x4ba987,_0x2a1732,_0x38b79d){this[_0x7603('0x5')]=uuid['v4']();this[_0x7603('0x6')]=_0x3d3dd9;this['queue']=_0x4ba987;this[_0x7603('0x7')]=_0x2a1732;this['routing']=_0x38b79d;this[_0x7603('0x6')]['push'](this[_0x7603('0x8')][_0x7603('0x9')](this),this['handleTimeout'][_0x7603('0x9')](this));this[_0x7603('0x6')]['on']('timeout',this[_0x7603('0xa')][_0x7603('0x9')](this));this[_0x7603('0x6')]['on'](_0x7603('0xb'),this[_0x7603('0xc')][_0x7603('0x9')](this));};Beepall[_0x7603('0xd')][_0x7603('0xe')]=function(){this[_0x7603('0x6')][_0x7603('0xe')](this[_0x7603('0x8')][_0x7603('0x9')](this),this[_0x7603('0xa')]['bind'](this));};Beepall[_0x7603('0xd')][_0x7603('0xc')]=function(){this[_0x7603('0xa')](!![]);};Beepall[_0x7603('0xd')]['handleRun']=function(){var _0x273020=!![];if(!_[_0x7603('0xf')](this[_0x7603('0x10')])&&!_[_0x7603('0xf')](this[_0x7603('0x10')][_0x7603('0x11')])&&this[_0x7603('0x10')]['Agents'][_0x7603('0x12')]>0x0){for(var _0x3be015=0x0,_0x5365bf;_0x3be0150x0){for(var _0x6dfd6f=0x0,_0x439f02;_0x6dfd6f0x0&&_0x4d7283[_0x175e9c+_0x7f77('0x24')]>=_0x4d7283[_0x175e9c+'Capacity']){writeLog(_0x3d91f8,_0x4d7283,_0x175e9c['toUpperCase']()+_0x7f77('0x26'));return![];}}return!![];};exports[_0x7f77('0x27')]=function(_0x303043,_0x3d66d5,_0xd78c83,_0x110f46,_0x56484c){return sendNotification(!![],_0x303043,_0x3d66d5,_0xd78c83,_0x110f46,_0x56484c);};exports[_0x7f77('0x28')]=function(_0x4e38e4,_0x3c2ece,_0x29f31b,_0x5e119f,_0x2bd7e0){return sendNotification(![],_0x4e38e4,_0x3c2ece,_0x29f31b,_0x5e119f,_0x2bd7e0);};exports[_0x7f77('0x29')]=function(_0x51437e,_0x563d58,_0x53ac60){var _0x341b5a=_0x563d58[_0x7f77('0x2a')][_0x7f77('0x2b')];if(!_0x341b5a&&_0x53ac60){_0x341b5a=_0x53ac60['id'];}var _0x600238=_[_0x7f77('0x2c')](_0x51437e[_0x563d58[_0x7f77('0x2d')]+_0x7f77('0x2e')],function(_0x4dcea4){var _0x268c18=_[_0x7f77('0x2f')](_0x563d58[_0x7f77('0x2d')])+_0x7f77('0x30');return _0x4dcea4[_0x268c18]===_0x563d58[_0x7f77('0x2a')]['id'];});if(!_0x600238&&_0x341b5a&&_0x51437e[_0x7f77('0x31')][_0x341b5a]){_0x600238=_[_0x7f77('0x2c')](_0x51437e['agents'][_0x341b5a][_0x563d58['channel']+'WaitingInteractions'],function(_0x11723e){return _0x11723e['id']===_0x563d58[_0x7f77('0x2a')]['id'];});}return _0x600238;};exports[_0x7f77('0x32')]=function(_0x23dd5d,_0xa774de,_0xc57279,_0x39161e){if(_0xc57279&&_0xc57279['id']&&_0x23dd5d[_0x7f77('0x31')]&&_0x23dd5d[_0x7f77('0x31')][_0xc57279['id']]){_0x23dd5d[_0x7f77('0x31')][_0xc57279['id']][_0x39161e+_0x7f77('0x33')][_0xa774de['message']['id']]={'id':_0xa774de[_0x7f77('0x2a')]['id']};}};exports[_0x7f77('0x34')]=function(_0x2a9378,_0x41c413,_0x36b142,_0x43b51f){if(_0x36b142&&_0x36b142['id']&&_0x2a9378[_0x7f77('0x31')]&&_0x2a9378[_0x7f77('0x31')][_0x36b142['id']]){delete _0x2a9378[_0x7f77('0x31')][_0x36b142['id']][_0x43b51f+_0x7f77('0x33')][_0x41c413['message']['id']];}};exports[_0x7f77('0x35')]=writeLog; \ No newline at end of file +var _0x082a=['getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','user:%s','notification:%s','remove','debug','isAgentAvailable','busy','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','InteractionId','agents','saveWaitingNotification','WaitingInteractions','writeLog','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','\x20interaction','name','notificationSound','account','notificationShake','body','queue','msg'];(function(_0x432d98,_0x1dc0f0){var _0x57808c=function(_0x4a684e){while(--_0x4a684e){_0x432d98['push'](_0x432d98['shift']());}};_0x57808c(++_0x1dc0f0);}(_0x082a,0x154));var _0xa082=function(_0x5bd3e1,_0x884fc){_0x5bd3e1=_0x5bd3e1-0x0;var _0xc85b55=_0x082a[_0x5bd3e1];return _0xc85b55;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var utils=require(_0xa082('0x1'));var Redis=require(_0xa082('0x2'));var config=require('../../../../../config/environment');var logger=require(_0xa082('0x3'))(_0xa082('0x4'));config[_0xa082('0x5')]=_[_0xa082('0x6')](config[_0xa082('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xa082('0x7'))(new Redis(config['redis']));function sendNotification(_0x1ada27,_0x41030c,_0x5ae561,_0x31c98d,_0x193550,_0x382b03){var _0x4b9ea9=_0x382b03||{};var _0xb7b966=_0x5ae561[_0xa082('0x8')]('.');var _0xd359ef={'uniqueid':_0x41030c,'channel':_0xb7b966[0x0],'id':_0xb7b966[0x1],'title':_0xb7b966[0x0]+_0xa082('0x9'),'interactionId':_0xb7b966[0x2],'queue':_0x193550?_0x193550[_0xa082('0xa')]:null,'sound':_0x4b9ea9['account'][_0xa082('0xb')],'shake':_0x4b9ea9[_0xa082('0xc')][_0xa082('0xd')]};try{if(!_0x4b9ea9['body']){_0x4b9ea9['body']={};}if(_0x193550){_0x4b9ea9[_0xa082('0xe')][_0xa082('0xf')]=_0x193550;}else if(_0x4b9ea9[_0xa082('0xe')][_0xa082('0xf')]){delete _0x4b9ea9['body'][_0xa082('0xf')];}_0xd359ef[_0xa082('0x10')]=utils[_0xa082('0x11')](_0x4b9ea9[_0xa082('0xc')][_0xa082('0x12')],_0x4b9ea9);}catch(_0x3238a1){_0xd359ef['msg']=_0xa082('0x13');logger[_0xa082('0x14')](util['format'](_0xa082('0x15'),_0x41030c,_0x3238a1[_0xa082('0x16')]));}io['to'](util[_0xa082('0x17')](_0xa082('0x18'),_0x31c98d['name']))['emit'](util[_0xa082('0x17')](_0xa082('0x19'),_0x1ada27?'save':_0xa082('0x1a')),_0xd359ef);}function writeLog(_0x536ffa,_0xeaa1ce,_0x284376){return logger[_0xa082('0x1b')](util[_0xa082('0x17')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x536ffa,_0xeaa1ce[_0xa082('0xa')],_0x284376));}exports[_0xa082('0x1c')]=function(_0x48f656,_0x24befc,_0x8904c7,_0x417943){if(_0x24befc[_0xa082('0x1d')]){writeLog(_0x48f656,_0x24befc,'BUSY');return![];}if(!_0x24befc[_0xa082('0x1e')]){writeLog(_0x48f656,_0x24befc,'OFFLINE');return![];}if(_0x24befc[_0x8904c7+_0xa082('0x1f')]){writeLog(_0x48f656,_0x24befc,_0xa082('0x20'));return![];}if(_0x417943&&_0x24befc['hasOwnProperty'](_0x8904c7+_0xa082('0x21'))&&_0x24befc[_0xa082('0x22')](_0x8904c7+'CurrentCapacity')){if(_0x24befc[_0x8904c7+'Capacity']>0x0&&_0x24befc[_0x8904c7+_0xa082('0x23')]>=_0x24befc[_0x8904c7+_0xa082('0x21')]){writeLog(_0x48f656,_0x24befc,_0x8904c7[_0xa082('0x24')]()+_0xa082('0x25'));return![];}}return!![];};exports[_0xa082('0x26')]=function(_0x11d847,_0x3bead8,_0x457ca9,_0x273812,_0x388b1e){return sendNotification(!![],_0x11d847,_0x3bead8,_0x457ca9,_0x273812,_0x388b1e);};exports[_0xa082('0x27')]=function(_0x3ae84a,_0x3032d2,_0x2d6170,_0x21730e,_0x3e604e){return sendNotification(![],_0x3ae84a,_0x3032d2,_0x2d6170,_0x21730e,_0x3e604e);};exports[_0xa082('0x28')]=function(_0x3e4971,_0x1793df,_0x22ace6){var _0x18f20e=_0x1793df[_0xa082('0x29')][_0xa082('0x2a')];if(!_0x18f20e&&_0x22ace6){_0x18f20e=_0x22ace6['id'];}var _0x16e9bf=_[_0xa082('0x2b')](_0x3e4971[_0x1793df[_0xa082('0x2c')]+'QueuesWaitingInteractions'],function(_0x4495af){var _0x3ad5a4=_[_0xa082('0x2d')](_0x1793df[_0xa082('0x2c')])+_0xa082('0x2e');return _0x4495af[_0x3ad5a4]===_0x1793df['interaction']['id'];});if(!_0x16e9bf&&_0x18f20e&&_0x3e4971[_0xa082('0x2f')][_0x18f20e]){_0x16e9bf=_[_0xa082('0x2b')](_0x3e4971['agents'][_0x18f20e][_0x1793df['channel']+'WaitingInteractions'],function(_0x17cc4b){return _0x17cc4b['id']===_0x1793df[_0xa082('0x29')]['id'];});}return _0x16e9bf;};exports[_0xa082('0x30')]=function(_0x436de7,_0x110073,_0x2fde61,_0x3514f2){if(_0x2fde61&&_0x2fde61['id']&&_0x436de7[_0xa082('0x2f')]&&_0x436de7[_0xa082('0x2f')][_0x2fde61['id']]){_0x436de7[_0xa082('0x2f')][_0x2fde61['id']][_0x3514f2+_0xa082('0x31')][_0x110073[_0xa082('0x16')]['id']]={'id':_0x110073[_0xa082('0x29')]['id']};}};exports['removeWaitingNotification']=function(_0x48361f,_0x5cfdef,_0x1ba041,_0x460175){if(_0x1ba041&&_0x1ba041['id']&&_0x48361f[_0xa082('0x2f')]&&_0x48361f['agents'][_0x1ba041['id']]){delete _0x48361f['agents'][_0x1ba041['id']][_0x460175+_0xa082('0x31')][_0x5cfdef[_0xa082('0x16')]['id']];}};exports[_0xa082('0x32')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 942c530..5f40d6d 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 _0x2d47=['message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','./utils','../../../../config/logger','routing','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x2e38cc,_0x4e5818){var _0x2c6c6b=function(_0x4d5644){while(--_0x4d5644){_0x2e38cc['push'](_0x2e38cc['shift']());}};_0x2c6c6b(++_0x4e5818);}(_0x2d47,0x115));var _0x72d4=function(_0x30b6c4,_0x6ec2d4){_0x30b6c4=_0x30b6c4-0x0;var _0x2b51a7=_0x2d47[_0x30b6c4];return _0x2b51a7;};'use strict';var schema=require(_0x72d4('0x0'));var sh=require(_0x72d4('0x1'));var _=require('lodash');var utils=require(_0x72d4('0x2'));var logger=require(_0x72d4('0x3'))(_0x72d4('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x34f475,_0x56a3ac){return function(_0x3ab803){try{var _0x3a9083={'command':_0x56a3ac[0x0]};var _0x4a3708=system[_0x72d4('0x0')](_0x3a9083,{'typecast':!![]});if(_0x4a3708[_0x72d4('0x5')]){logger[_0x72d4('0x6')](_0x72d4('0x7'),_0x34f475,_[_0x72d4('0x8')](_0x4a3708,_0x72d4('0x9'))[_0x72d4('0xa')](',\x20'));logger[_0x72d4('0xb')](_0x72d4('0xc'),_0x34f475);_0x3ab803[_0x72d4('0xd')]();}else{var _0x293730=this;var _0x431d4b=utils[_0x72d4('0xe')](_0x56a3ac[0x0],this);logger[_0x72d4('0xb')](_0x72d4('0xf'),_0x34f475,_0x431d4b);sh['exec'](_[_0x72d4('0x10')](_0x431d4b),function(_0x5e914f,_0x331444){logger['info'](_0x72d4('0x11'),_0x34f475,_0x5e914f);if(_0x5e914f==0x0){var _0x28335c=_0x331444['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x72d4('0x12')](_0x56a3ac[0x1])||_['isEmpty'](_0x56a3ac[0x1])){logger[_0x72d4('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x34f475);_0x293730[_0x72d4('0x13')][_0x56a3ac[0x1]]=_0x28335c;}else{logger[_0x72d4('0xb')](_0x72d4('0x14'),_0x34f475,_0x56a3ac[0x1],_0x28335c);_0x293730[_0x72d4('0x13')][_0x56a3ac[0x1]]=_0x28335c;}}_0x3ab803[_0x72d4('0xd')]();});}}catch(_0x4ea35b){logger[_0x72d4('0x6')](_0x72d4('0x7'),_0x34f475,_['isObject'](_0x4ea35b)?JSON[_0x72d4('0x15')](_0x4ea35b):_0x4ea35b);logger['info'](_0x72d4('0xc'),_0x34f475);_0x3ab803[_0x72d4('0xd')]();}};}; \ No newline at end of file +var _0x62b9=['error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0xb8bc6e,_0x41d4c5){var _0x51da5d=function(_0xd2b808){while(--_0xd2b808){_0xb8bc6e['push'](_0xb8bc6e['shift']());}};_0x51da5d(++_0x41d4c5);}(_0x62b9,0x130));var _0x962b=function(_0x5e6b6b,_0x28ddac){_0x5e6b6b=_0x5e6b6b-0x0;var _0x360186=_0x62b9[_0x5e6b6b];return _0x360186;};'use strict';var schema=require(_0x962b('0x0'));var sh=require(_0x962b('0x1'));var _=require(_0x962b('0x2'));var utils=require(_0x962b('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x962b('0x4'),'required':!![],'message':_0x962b('0x5')}});exports[_0x962b('0x6')]=function(_0x381ea4,_0x34c091){return function(_0x5d6e4b){try{var _0x60794={'command':_0x34c091[0x0]};var _0x439523=system[_0x962b('0x0')](_0x60794,{'typecast':!![]});if(_0x439523[_0x962b('0x7')]){logger[_0x962b('0x8')](_0x962b('0x9'),_0x381ea4,_[_0x962b('0xa')](_0x439523,_0x962b('0xb'))[_0x962b('0xc')](',\x20'));logger[_0x962b('0xd')](_0x962b('0xe'),_0x381ea4);_0x5d6e4b[_0x962b('0xf')]();}else{var _0x564e62=this;var _0x1c056f=utils[_0x962b('0x10')](_0x34c091[0x0],this);logger[_0x962b('0xd')](_0x962b('0x11'),_0x381ea4,_0x1c056f);sh[_0x962b('0x12')](_[_0x962b('0x13')](_0x1c056f),function(_0x4802f6,_0x59a12a){logger[_0x962b('0xd')](_0x962b('0x14'),_0x381ea4,_0x4802f6);if(_0x4802f6==0x0){var _0x1347de=_0x59a12a[_0x962b('0x15')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x34c091[0x1])||_['isEmpty'](_0x34c091[0x1])){logger['info'](_0x962b('0x16'),_0x381ea4);_0x564e62['body'][_0x34c091[0x1]]=_0x1347de;}else{logger[_0x962b('0xd')](_0x962b('0x17'),_0x381ea4,_0x34c091[0x1],_0x1347de);_0x564e62['body'][_0x34c091[0x1]]=_0x1347de;}}_0x5d6e4b[_0x962b('0xf')]();});}}catch(_0x4e950e){logger[_0x962b('0x8')](_0x962b('0x9'),_0x381ea4,_[_0x962b('0x18')](_0x4e950e)?JSON[_0x962b('0x19')](_0x4e950e):_0x4e950e);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x381ea4);_0x5d6e4b[_0x962b('0xf')]();}};}; \ 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 eaed8d1..7d5e850 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 _0xf966=['length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','consequence'];(function(_0x2a86cc,_0x172c02){var _0x4da79f=function(_0x572c0c){while(--_0x572c0c){_0x2a86cc['push'](_0x2a86cc['shift']());}};_0x4da79f(++_0x172c02);}(_0xf966,0x17e));var _0x6f96=function(_0x2f2b50,_0x5172a9){_0x2f2b50=_0x2f2b50-0x0;var _0x1f5478=_0xf966[_0x2f2b50];return _0x1f5478;};'use strict';var schema=require(_0x6f96('0x0'));var _=require(_0x6f96('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x6f96('0x2')),'smsInteraction':require(_0x6f96('0x3')),'mailInteraction':require(_0x6f96('0x4')),'faxInteraction':require(_0x6f96('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x6f96('0x6'));var tag=schema({'tag':{'type':_0x6f96('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x6f96('0x8')]=function(_0x3b8191,_0x348d0a,_0xe1eb67,_0xdd512e){return function(_0x285955){try{var _0x209659={'tag':_0x348d0a[0x0]};var _0x38e145=tag[_0x6f96('0x0')](_0x209659,{'typecast':!![]});if(_0x38e145[_0x6f96('0x9')]){logger[_0x6f96('0xa')](_0x6f96('0xb'),_0x3b8191,_['map'](_0x38e145,_0x6f96('0xc'))[_0x6f96('0xd')](',\x20'));logger[_0x6f96('0xe')](_0x6f96('0xf'),_0x3b8191);_0x285955['next']();}else{var _0xaf65e8={'ids':[_0x348d0a[0x0]]};if(rpc[_0xdd512e['channel']+'Interaction']){rpc[_0xdd512e['channel']+'Interaction'][_0x6f96('0x10')](_0xdd512e[_0x6f96('0x11')]['id'],_0xaf65e8)[_0x6f96('0x12')](function(_0xab06ce){logger[_0x6f96('0xe')](_0x6f96('0x13'),_0x3b8191,_0x348d0a[0x1],_0xdd512e['channel'],_0xdd512e[_0x6f96('0x11')]['id']);})['catch'](function(_0x2f7d89){logger[_0x6f96('0xa')](_0x6f96('0xb'),_0x3b8191,JSON[_0x6f96('0x14')](_0x2f7d89));logger[_0x6f96('0xe')](_0x6f96('0xf'),_0x3b8191);})[_0x6f96('0x15')](function(){_0x285955[_0x6f96('0x16')]();});}}}catch(_0x1e9f06){logger[_0x6f96('0xa')](_0x6f96('0xb'),_0x3b8191,_['isObject'](_0x1e9f06)?JSON[_0x6f96('0x14')](_0x1e9f06):_0x1e9f06);logger['info'](_0x6f96('0xf'),_0x3b8191);_0x285955[_0x6f96('0x16')]();}};}; \ No newline at end of file +var _0x5729=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x464f5d,_0x163475){var _0x2605a8=function(_0x46be95){while(--_0x46be95){_0x464f5d['push'](_0x464f5d['shift']());}};_0x2605a8(++_0x163475);}(_0x5729,0x19d));var _0x9572=function(_0x144725,_0x2ad835){_0x144725=_0x144725-0x0;var _0x516c96=_0x5729[_0x144725];return _0x516c96;};'use strict';var schema=require(_0x9572('0x0'));var _=require(_0x9572('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9572('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x9572('0x3')),'faxInteraction':require(_0x9572('0x4')),'whatsappInteraction':require(_0x9572('0x5'))};var logger=require(_0x9572('0x6'))('routing');var tag=schema({'tag':{'type':_0x9572('0x7'),'required':!![],'message':_0x9572('0x8')}});exports[_0x9572('0x9')]=function(_0x46cf10,_0x234a17,_0x27aa9f,_0x41ccf3){return function(_0x3fde5c){try{var _0x21b605={'tag':_0x234a17[0x0]};var _0x11ec12=tag['validate'](_0x21b605,{'typecast':!![]});if(_0x11ec12[_0x9572('0xa')]){logger[_0x9572('0xb')]('[%s][TAG]\x20%s',_0x46cf10,_[_0x9572('0xc')](_0x11ec12,_0x9572('0xd'))['join'](',\x20'));logger[_0x9572('0xe')](_0x9572('0xf'),_0x46cf10);_0x3fde5c[_0x9572('0x10')]();}else{var _0x261b08={'ids':[_0x234a17[0x0]]};if(rpc[_0x41ccf3[_0x9572('0x11')]+_0x9572('0x12')]){rpc[_0x41ccf3['channel']+'Interaction'][_0x9572('0x13')](_0x41ccf3[_0x9572('0x14')]['id'],_0x261b08)[_0x9572('0x15')](function(_0x3d1998){logger[_0x9572('0xe')](_0x9572('0x16'),_0x46cf10,_0x234a17[0x1],_0x41ccf3[_0x9572('0x11')],_0x41ccf3[_0x9572('0x14')]['id']);})[_0x9572('0x17')](function(_0x536966){logger[_0x9572('0xb')](_0x9572('0x18'),_0x46cf10,JSON[_0x9572('0x19')](_0x536966));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x46cf10);})[_0x9572('0x1a')](function(){_0x3fde5c['next']();});}}}catch(_0x53785a){logger[_0x9572('0xb')](_0x9572('0x18'),_0x46cf10,_[_0x9572('0x1b')](_0x53785a)?JSON[_0x9572('0x19')](_0x53785a):_0x53785a);logger['info'](_0x9572('0xf'),_0x46cf10);_0x3fde5c[_0x9572('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 1d1b520..abe35f1 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 _0x9f28=['includes','push','?params=','urlOnRing','2.0','login','stringify','utf8','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','../../../../config/logger','routing','lodash','consequence','replace'];(function(_0x37e213,_0x2f82cb){var _0x3663e=function(_0xd24940){while(--_0xd24940){_0x37e213['push'](_0x37e213['shift']());}};_0x3663e(++_0x2f82cb);}(_0x9f28,0xf7));var _0x89f2=function(_0x3cc776,_0x2d2ada){_0x3cc776=_0x3cc776-0x0;var _0x2f27e2=_0x9f28[_0x3cc776];return _0x2f27e2;};'use strict';var rp=require('request-promise');var logger=require(_0x89f2('0x0'))(_0x89f2('0x1'));var _=require(_0x89f2('0x2'));var arr=[];exports[_0x89f2('0x3')]=function(_0x3ef24a,_0x58f65e){return function(_0x48d2eb){var _0xa683e6=_0x58f65e[0xa];var _0x1ef153=_0x58f65e[0xb];var _0x237033=_0x58f65e[0xc];var _0x4f05c2=_0x58f65e[0xd];var _0x3805a7=_0x58f65e[0xe];var _0x3fb242=_0x58f65e[0xf]['replace'](/\n/g,'\x20-\x20');var _0x4f07bb=_0x58f65e[0x10][_0x89f2('0x4')](/\n/g,'\x20');if(!arr[_0x89f2('0x5')](_0x1ef153)){arr[_0x89f2('0x6')](_0x1ef153);var _0x3fd10b=_0x58f65e[0x3];var _0x4dafb2=_0x58f65e[0x4];var _0xd347fb=_0x58f65e[0x1];var _0x9eeec1=_0x58f65e[0x0];var _0xa14f07={};_0xa14f07['urlOnAnswer']=_0x58f65e[0x8]+_0x89f2('0x7')+_0x237033+'|'+_0xa683e6+'|'+_0x4f05c2+'|'+_0x1ef153+'|'+_0x3805a7;_0xa14f07[_0x89f2('0x8')]=_0x58f65e[0x7]+_0x89f2('0x7')+_0x237033+'|'+_0xa683e6+'|'+_0x4f05c2+'|'+_0x1ef153+'|'+_0x3805a7+'|'+_0x3fb242+'|'+_0x4f07bb;_0xa14f07['title']=_0x58f65e[0x9];var _0x58cca4={};_0x58cca4['jsonrpc']=_0x89f2('0x9');_0x58cca4['method']=_0x89f2('0xa');var _0x5d1bd2=[];_0x5d1bd2[_0x89f2('0x6')](_0x58f65e[0x2]);_0x5d1bd2[_0x89f2('0x6')](_0x58f65e[0x5]);_0x5d1bd2[_0x89f2('0x6')](_0x58f65e[0x6]);_0x58cca4['params']=_0x5d1bd2;_0x58cca4['id']=0x1;var _0x26c089=JSON[_0x89f2('0xb')](_0x58cca4);var _0x32b83f={'encoding':_0x89f2('0xc'),'method':'POST','timeout':0x2710,'url':_0x3fd10b,'headers':{'Content-Type':_0x89f2('0xd')},'body':_0x26c089};return rp(_0x32b83f)[_0x89f2('0xe')](function(_0x3d5bbc){const _0x21c7ac=JSON[_0x89f2('0xf')](_0x3d5bbc);if(!_0x21c7ac['result'][_0x89f2('0x10')]){throw new Error(_0x89f2('0x11'));}var _0x5d2c34=_0x1ef153;var _0x36560a=_0x89f2('0x12')+_0xd347fb+_0x89f2('0x13')+_0x9eeec1+_0x89f2('0x14')+_0x5d2c34+_0x89f2('0x15')+JSON[_0x89f2('0xb')](_0xa14f07);var _0x37e467=_0x4dafb2+'?'+_0x36560a;return rp(_0x37e467);})[_0x89f2('0xe')](function(_0x4c4171){logger[_0x89f2('0x16')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x3ef24a,_0x4c4171);_0x48d2eb[_0x89f2('0x17')]();})[_0x89f2('0x18')](function(_0x2382b4){logger[_0x89f2('0x19')](_0x89f2('0x1a'),_0x3ef24a,_[_0x89f2('0x1b')](_0x2382b4)?JSON[_0x89f2('0xb')](_0x2382b4):_0x2382b4);_0x48d2eb['stop']();});}else{logger[_0x89f2('0x16')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x3ef24a);_0x48d2eb['next']();}};}; \ No newline at end of file +var _0x3107=['request-promise','../../../../config/logger','routing','replace','includes','push','urlOnAnswer','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x3f688a,_0x1c86f0){var _0x5a8811=function(_0x508b06){while(--_0x508b06){_0x3f688a['push'](_0x3f688a['shift']());}};_0x5a8811(++_0x1c86f0);}(_0x3107,0xa5));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x7310('0x0'));var logger=require(_0x7310('0x1'))(_0x7310('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x593fb6,_0x43c765){return function(_0x8b7549){var _0x5bedb9=_0x43c765[0xa];var _0x2759d1=_0x43c765[0xb];var _0x2fea13=_0x43c765[0xc];var _0x17cbd5=_0x43c765[0xd];var _0x4f3c65=_0x43c765[0xe];var _0x15bcd6=_0x43c765[0xf][_0x7310('0x3')](/\n/g,'\x20-\x20');var _0x1665bc=_0x43c765[0x10][_0x7310('0x3')](/\n/g,'\x20');if(!arr[_0x7310('0x4')](_0x2759d1)){arr[_0x7310('0x5')](_0x2759d1);var _0x328403=_0x43c765[0x3];var _0x5cdc79=_0x43c765[0x4];var _0x3a1308=_0x43c765[0x1];var _0x5098c0=_0x43c765[0x0];var _0x4a3264={};_0x4a3264[_0x7310('0x6')]=_0x43c765[0x8]+'?params='+_0x2fea13+'|'+_0x5bedb9+'|'+_0x17cbd5+'|'+_0x2759d1+'|'+_0x4f3c65;_0x4a3264[_0x7310('0x7')]=_0x43c765[0x7]+'?params='+_0x2fea13+'|'+_0x5bedb9+'|'+_0x17cbd5+'|'+_0x2759d1+'|'+_0x4f3c65+'|'+_0x15bcd6+'|'+_0x1665bc;_0x4a3264[_0x7310('0x8')]=_0x43c765[0x9];var _0x41995d={};_0x41995d[_0x7310('0x9')]=_0x7310('0xa');_0x41995d[_0x7310('0xb')]=_0x7310('0xc');var _0x4fc873=[];_0x4fc873[_0x7310('0x5')](_0x43c765[0x2]);_0x4fc873['push'](_0x43c765[0x5]);_0x4fc873[_0x7310('0x5')](_0x43c765[0x6]);_0x41995d[_0x7310('0xd')]=_0x4fc873;_0x41995d['id']=0x1;var _0xfe88da=JSON[_0x7310('0xe')](_0x41995d);var _0x5513b7={'encoding':_0x7310('0xf'),'method':_0x7310('0x10'),'timeout':0x2710,'url':_0x328403,'headers':{'Content-Type':_0x7310('0x11')},'body':_0xfe88da};return rp(_0x5513b7)[_0x7310('0x12')](function(_0x2bd2e0){const _0x527660=JSON[_0x7310('0x13')](_0x2bd2e0);if(!_0x527660[_0x7310('0x14')][_0x7310('0x15')]){throw new Error(_0x7310('0x16'));}var _0x5cf201=_0x2759d1;var _0x135f19=_0x7310('0x17')+_0x3a1308+_0x7310('0x18')+_0x5098c0+_0x7310('0x19')+_0x5cf201+_0x7310('0x1a')+JSON[_0x7310('0xe')](_0x4a3264);var _0xabc6b3=_0x5cdc79+'?'+_0x135f19;return rp(_0xabc6b3);})['then'](function(_0x5f0d34){logger[_0x7310('0x1b')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x593fb6,_0x5f0d34);_0x8b7549[_0x7310('0x1c')]();})['catch'](function(_0x513d10){logger['error'](_0x7310('0x1d'),_0x593fb6,_[_0x7310('0x1e')](_0x513d10)?JSON[_0x7310('0xe')](_0x513d10):_0x513d10);_0x8b7549[_0x7310('0x1c')]();});}else{logger['info'](_0x7310('0x1f'),_0x593fb6);_0x8b7549[_0x7310('0x20')]();}};}; \ 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 b49ea1f..cec1c64 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x441f19,_0xe45720){var _0x4156a1=function(_0x46af23){while(--_0x46af23){_0x441f19['push'](_0x441f19['shift']());}};_0x4156a1(++_0xe45720);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x2ccd79,_0x20d241){var _0x273c64=function(_0xe367df){while(--_0xe367df){_0x2ccd79['push'](_0x2ccd79['shift']());}};_0x273c64(++_0x20d241);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c919e49..456df5e 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 _0x2faf=['join','app','.js','autoreply','appdata','split','push','dialogflow','slice','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','name','waiting','mailQueues','available','loggedIn','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','transfer','applications','isArray','length'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var path=require(_0xf2fa('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf2fa('0x3'));var utils=require(_0xf2fa('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0xf2fa('0x5'))(_0xf2fa('0x6'));var rpc={'openchannelQueueReport':require(_0xf2fa('0x7')),'mailQueueReport':require(_0xf2fa('0x8')),'chatQueueReport':require(_0xf2fa('0x9')),'smsQueueReport':require(_0xf2fa('0xa')),'faxQueueReport':require(_0xf2fa('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf2fa('0xc'));function getId(_0x3287ac,_0x28ca24,_0x19ce5a){return util['format'](_0xf2fa('0xd'),_0x3287ac,_0x28ca24||0x0,_0x19ce5a||0x0);}function getIntervals(_0x530819,_0x310ccd){var _0x481c20=[];if(!_[_0xf2fa('0xe')](_0x310ccd[_0xf2fa('0xf')])&&!_[_0xf2fa('0xe')](_0x530819[_0x310ccd[_0xf2fa('0xf')]])&&!_[_0xf2fa('0xe')](_0x530819[_0x310ccd[_0xf2fa('0xf')]][_0xf2fa('0x10')])){_0x481c20=_[_0xf2fa('0x11')](_0x530819[_0x310ccd[_0xf2fa('0xf')]][_0xf2fa('0x10')],'interval');}else if(!_[_0xf2fa('0xe')](_0x310ccd[_0xf2fa('0x12')])){_0x481c20=[_0x310ccd[_0xf2fa('0x12')]];}return _0x481c20;}exports[_0xf2fa('0x13')]=function(_0x13ca94){_0x13ca94[_0xf2fa('0x14')]={};return new BPromise(function(_0x30a8b1,_0x263472){var _0x559eb5={'Start':function(_0x2d8fc2){var _0x4fea4a=this;return new Promise(function(_0x2aa797,_0x9e3bc8){if(_0x2d8fc2){try{var _0x4c3d81=[];var _0x4ded9a=getId(_0x2d8fc2[_0xf2fa('0x15')],_0x2d8fc2[_0xf2fa('0x16')]?_0x2d8fc2[_0xf2fa('0x16')]['id']:0x0,_0x2d8fc2[_0xf2fa('0x17')]?_0x2d8fc2[_0xf2fa('0x17')]['id']:0x0);var _0x2d0d36=sUtils['checkWaitingNotifications'](_0x13ca94,_0x2d8fc2);if(_0x2d8fc2[_0xf2fa('0x18')]||!_0x2d0d36&&_0x2d8fc2[_0xf2fa('0x19')]&&_[_0xf2fa('0x1a')](_0x2d8fc2['applications'])&&_0x2d8fc2[_0xf2fa('0x19')][_0xf2fa('0x1b')]){for(var _0xdc06fd=0x0;_0xdc06fd<_0x2d8fc2[_0xf2fa('0x19')][_0xf2fa('0x1b')];_0xdc06fd+=0x1){var _0x536a2d=_0x2d8fc2['applications'][_0xdc06fd];if(fs['existsSync'](path[_0xf2fa('0x1c')](__dirname,'applications',_0x536a2d[_0xf2fa('0x1d')]+_0xf2fa('0x1e')))){var _0x599c7b=[];switch(_0x536a2d['app']['toLowerCase']()){case _0xf2fa('0x1f'):var _0x17a54f=_0x536a2d[_0xf2fa('0x20')][_0xf2fa('0x21')](',');if(_0x2d8fc2['channel']==='mail'){_0x599c7b[_0xf2fa('0x22')](_0x17a54f[0x0]);_0x599c7b['push'](_0x17a54f[0x1]);_0x599c7b['push'](_0x17a54f['slice'](0x2,_0x17a54f[_0xf2fa('0x1b')])['join'](','));}else{_0x599c7b['push'](_0x17a54f[0x0]);_0x599c7b[_0xf2fa('0x22')](_0x17a54f['slice'](0x1,_0x17a54f[_0xf2fa('0x1b')])[_0xf2fa('0x1c')](','));}break;case _0xf2fa('0x23'):var _0x47d295=_0x536a2d['appdata'][_0xf2fa('0x21')](',');_0x599c7b['push'](_0x47d295[0x0]);_0x599c7b[_0xf2fa('0x22')](_0x47d295[0x1]);_0x599c7b[_0xf2fa('0x22')](_0x47d295[_0xf2fa('0x24')](0x2,_0x47d295[_0xf2fa('0x1b')])['join'](','));break;case _0xf2fa('0x25'):var _0x1bb81c=_0x536a2d[_0xf2fa('0x20')]['split'](',');_0x599c7b[_0xf2fa('0x22')](_0x1bb81c[0x0]);_0x599c7b[_0xf2fa('0x22')](_0x1bb81c[0x1]);_0x599c7b[_0xf2fa('0x22')](_0x1bb81c[0x2]);_0x599c7b[_0xf2fa('0x22')](_0x1bb81c[0x3]);_0x599c7b[_0xf2fa('0x22')](_0x1bb81c[_0xf2fa('0x24')](0x4,_0x1bb81c[_0xf2fa('0x1b')])[_0xf2fa('0x1c')](','));break;case _0xf2fa('0x26'):var _0x1a721d=_0x536a2d['appdata']['split'](',');_0x599c7b[_0xf2fa('0x22')](_0x1a721d[0x0]);_0x599c7b[_0xf2fa('0x22')](_0x1a721d[0x1]);_0x599c7b[_0xf2fa('0x22')](_0x1a721d[0x2]);_0x599c7b[_0xf2fa('0x22')](_0x1a721d[0x3]);_0x599c7b[_0xf2fa('0x22')](_0x1a721d['slice'](0x4,_0x1a721d['length'])[_0xf2fa('0x1c')](','));break;case _0xf2fa('0x16'):_0x599c7b[_0xf2fa('0x22')](_0x536a2d[_0xf2fa('0x20')]);break;case _0xf2fa('0x27'):_0x599c7b[_0xf2fa('0x22')](_0x536a2d['TagId']);_0x599c7b[_0xf2fa('0x22')](_0x536a2d['appdata']);break;case _0xf2fa('0x28'):var _0x39eab6=utils[_0xf2fa('0x29')](_0x2d8fc2[_0xf2fa('0x2a')][_0xf2fa('0x2b')],_0x2d8fc2);var _0x5d7ed7=_0x536a2d[_0xf2fa('0x20')][_0xf2fa('0x21')](',');_0x599c7b['push'](_0x5d7ed7[0x0]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0x1]);_0x599c7b['push'](_0x5d7ed7[0x2]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0x3]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0x4]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0x5]);_0x599c7b['push'](_0x5d7ed7[0x6]);_0x599c7b['push'](_0x5d7ed7[0x7]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0x8]);_0x599c7b['push'](_0x5d7ed7[0x9]);_0x599c7b[_0xf2fa('0x22')](_0x5d7ed7[0xa]);_0x599c7b[_0xf2fa('0x22')](_0x2d8fc2[_0xf2fa('0x17')]['id']);_0x599c7b[_0xf2fa('0x22')](_0x2d8fc2[_0xf2fa('0x16')]['id']);_0x599c7b[_0xf2fa('0x22')](_0x536a2d[_0xf2fa('0x2c')]);_0x599c7b['push'](_0x2d8fc2['interaction']['ContactId']);_0x599c7b[_0xf2fa('0x22')](_0x2d8fc2[_0xf2fa('0x2d')][_0xf2fa('0x2d')]);_0x599c7b[_0xf2fa('0x22')](_0x39eab6);break;default:_0x599c7b=_[_0xf2fa('0xe')](_0x536a2d[_0xf2fa('0x20')])?[]:_0x536a2d[_0xf2fa('0x20')][_0xf2fa('0x21')](',');}var _0x10b725={'id':util[_0xf2fa('0x2e')](_0xf2fa('0x2f'),_0x4ded9a,_0x536a2d['id'],_0x536a2d[_0xf2fa('0x1d')]),'condition':require(_0xf2fa('0x30'))[_0xf2fa('0x31')](_0x4ded9a,getIntervals(_0x13ca94[_0xf2fa('0x32')],_0x536a2d),_0x13ca94),'consequence':require(_0xf2fa('0x33')+_0x536a2d['app'])['consequence'](_0x4ded9a,_0x599c7b,_0x13ca94,_0x2d8fc2),'p':_0x536a2d[_0xf2fa('0x34')]||0x0};logger['info'](_0xf2fa('0x35'),_0x10b725['id'],'on\x20interval',getIntervals(_0x13ca94[_0xf2fa('0x32')],_0x536a2d)[_0xf2fa('0x1c')](_0xf2fa('0x36')));_0x4c3d81[_0xf2fa('0x22')](_0x10b725);}else{logger[_0xf2fa('0x37')](_0xf2fa('0x38'),path['join'](__dirname,'applications',_0x536a2d[_0xf2fa('0x1d')]+_0xf2fa('0x1e')));}}_0x13ca94[_0xf2fa('0x14')][_0x4ded9a]=new RuleEngine(_0x4c3d81);_0x13ca94[_0xf2fa('0x14')][_0x4ded9a]['execute'](_0x2d8fc2,function(_0x456041){logger[_0xf2fa('0x39')](_0xf2fa('0x3a'),JSON['stringify'](_0x456041[_0xf2fa('0x3b')]));if(_0x13ca94['rules'][_0x4ded9a]){_0x13ca94[_0xf2fa('0x14')][_0x4ded9a][_0xf2fa('0x3c')](_0xf2fa('0x3d'));}});return _0x2aa797({'code':0xc8,'message':_0x2d8fc2});}else{if(_0x2d0d36){logger[_0xf2fa('0x39')](util[_0xf2fa('0x2e')](_0xf2fa('0x3e'),_0x4ded9a));}else{logger[_0xf2fa('0x39')](_0xf2fa('0x3f'));}return _0x2aa797({'code':0xc8,'message':_0x2d8fc2});}}catch(_0x28b3b5){logger[_0xf2fa('0x37')](_0x28b3b5[_0xf2fa('0x40')]);return _0x9e3bc8(_0x4fea4a[_0xf2fa('0x37')](0x1f4,_0x28b3b5));}}return _0x9e3bc8('routing\x20is\x20empty');});},'AcceptMessage':function(_0x494da6){var _0x4e1918=this;return new Promise(function(_0x46d208,_0x282077){if(_0x494da6['agent']&&_0x494da6[_0xf2fa('0x41')]['id']){if(_0x13ca94[_0xf2fa('0x42')][_0x494da6[_0xf2fa('0x41')]['id']]){_0x13ca94[_0xf2fa('0x42')][_0x494da6['agent']['id']]['busy']=![];_0x13ca94[_0xf2fa('0x42')][_0x494da6['agent']['id']][_0xf2fa('0x43')]=undefined;}}if(_0x494da6[_0xf2fa('0x16')]&&_0x494da6['message']['id']){try{var _0x5d9ee4=getId(_0x494da6[_0xf2fa('0x15')],_0x494da6[_0xf2fa('0x16')]?_0x494da6['message']['id']:0x0,_0x494da6['interaction']?_0x494da6[_0xf2fa('0x17')]['id']:0x0);if(_0x13ca94['rules'][_0x5d9ee4]){_0x13ca94[_0xf2fa('0x14')][_0x5d9ee4][_0xf2fa('0x3c')](_0xf2fa('0x44'));if(rpc[_0x494da6[_0xf2fa('0x15')]+_0xf2fa('0x45')]){rpc[_0x494da6[_0xf2fa('0x15')]+_0xf2fa('0x45')][_0xf2fa('0x46')](_0x5d9ee4,{'UserId':_0x494da6[_0xf2fa('0x16')][_0xf2fa('0x47')]})[_0xf2fa('0x48')](function(){logger[_0xf2fa('0x37')](_0xf2fa('0x49'));});}}return _0x46d208({'code':0xc8,'message':_0x494da6});}catch(_0x51742e){logger[_0xf2fa('0x37')](_0x51742e[_0xf2fa('0x40')]);return _0x282077(_0x4e1918['error'](0x1f4,_0x51742e));}}logger[_0xf2fa('0x37')](_0xf2fa('0x4a'));return _0x282077(_0x4e1918[_0xf2fa('0x37')](0x1f4,_0xf2fa('0x4a')));});},'RejectMessage':function(_0x5d3d16){var _0x51b8a4=this;return new Promise(function(_0x2d4b24,_0x2326c1){if(_0x5d3d16[_0xf2fa('0x41')]&&_0x5d3d16['agent']['id']){try{if(_0x13ca94['agents'][_0x5d3d16[_0xf2fa('0x41')]['id']]){_0x13ca94['agents'][_0x5d3d16[_0xf2fa('0x41')]['id']][_0xf2fa('0x4b')]=![];_0x13ca94[_0xf2fa('0x42')][_0x5d3d16[_0xf2fa('0x41')]['id']][_0xf2fa('0x43')]=undefined;}return _0x2d4b24({'code':0xc8,'message':_0x5d3d16});}catch(_0x18e088){logger[_0xf2fa('0x37')](_0x18e088[_0xf2fa('0x40')]);return _0x2326c1(_0x51b8a4[_0xf2fa('0x37')](0x1f4,_0x18e088));}}logger[_0xf2fa('0x37')]('message\x20is\x20empty');return _0x2326c1(_0x51b8a4[_0xf2fa('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2a86e6){var _0x354076=this;return new Promise(function(_0x810c34,_0x2b5b95){if(_0x2a86e6[_0xf2fa('0x15')]&&_0x2a86e6[_0xf2fa('0x17')]&&_0x2a86e6[_0xf2fa('0x17')]['id']){try{var _0x3df069=getId(_0x2a86e6[_0xf2fa('0x15')],_0x2a86e6['message']?_0x2a86e6[_0xf2fa('0x16')]['id']:0x0,_0x2a86e6[_0xf2fa('0x17')]?_0x2a86e6[_0xf2fa('0x17')]['id']:0x0);if(_0x13ca94[_0xf2fa('0x14')][_0x3df069]){_0x13ca94[_0xf2fa('0x14')][_0x3df069][_0xf2fa('0x3c')](_0xf2fa('0x44'));}return _0x810c34({'code':0xc8,'message':_0x2a86e6});}catch(_0xd94534){logger['error'](_0xd94534['stack']);return _0x2b5b95(_0x354076['error'](0x1f4,_0xd94534));}}logger[_0xf2fa('0x37')]('message\x20is\x20empty');return _0x2b5b95(_0x354076[_0xf2fa('0x37')](0x1f4,_0xf2fa('0x4a')));});},'AgentCapacity':function(_0x2a170b){var _0x451a54=this;return new Promise(function(_0x411567,_0x5aec15){if(_0x13ca94[_0xf2fa('0x42')][_0xf2fa('0x4c')](_0x2a170b['id'])){for(var _0x7b3a65 in _0x2a170b[_0xf2fa('0x4d')]){if(_0x2a170b[_0xf2fa('0x4d')][_0xf2fa('0x4c')](_0x7b3a65)){if(_0x13ca94[_0xf2fa('0x42')][_0x2a170b['id']][_0xf2fa('0x4c')](_0x7b3a65+_0xf2fa('0x4e'))){_0x13ca94[_0xf2fa('0x42')][_0x2a170b['id']][_0x7b3a65+_0xf2fa('0x4e')]=parseInt(_0x2a170b[_0xf2fa('0x4d')][_0x7b3a65],0xa);}}}_0x13ca94[_0xf2fa('0x42')][_0x2a170b['id']]['updateRealtime']();return _0x411567({'code':0xc8,'message':_0x13ca94['agents'][_0x2a170b['id']]});}else{return _0x5aec15(_0x451a54[_0xf2fa('0x37')](0x1f4,_0xf2fa('0x4f')));}});},'Agents':function(_0x132473){return new Promise(function(_0x2b0246){var _0x49ba37=_['values'](_0x13ca94[_0xf2fa('0x42')]);if(_0x132473&&_0x132473['id']){var _0x2b33d8=_[_0xf2fa('0x50')](_0x49ba37,function(_0x532e62){return _0x532e62['id']===_0x132473['id'];});_0x2b0246(_0x2b33d8);}else{_0x2b0246({'count':_0x49ba37[_0xf2fa('0x1b')],'rows':_0x49ba37});}});},'ChatQueues':function(){return new Promise(function(_0x2cc232){var _0x24aaa9=[];for(var _0x421baa in _0x13ca94[_0xf2fa('0x51')]){if(_0x13ca94[_0xf2fa('0x51')][_0xf2fa('0x4c')](_0x421baa)){var _0x11d8d2=_0x13ca94[_0xf2fa('0x51')][_0x421baa];var _0x155496={'id':_0x11d8d2['id'],'available':_0x11d8d2['available'],'loggedIn':_0x11d8d2['loggedIn'],'name':_0x11d8d2[_0xf2fa('0x52')],'paused':_0x11d8d2['paused'],'waiting':_0x11d8d2[_0xf2fa('0x53')]};_0x24aaa9[_0xf2fa('0x22')](_0x155496);}}_0x2cc232({'count':_0x24aaa9[_0xf2fa('0x1b')],'rows':_0x24aaa9});});},'MailQueues':function(){return new Promise(function(_0x1e091f){var _0xdcdce8=[];for(var _0x4cb84d in _0x13ca94[_0xf2fa('0x54')]){if(_0x13ca94[_0xf2fa('0x54')][_0xf2fa('0x4c')](_0x4cb84d)){var _0x43e098=_0x13ca94[_0xf2fa('0x54')][_0x4cb84d];var _0x3772b1={'id':_0x43e098['id'],'available':_0x43e098[_0xf2fa('0x55')],'loggedIn':_0x43e098[_0xf2fa('0x56')],'name':_0x43e098[_0xf2fa('0x52')],'paused':_0x43e098[_0xf2fa('0x57')],'waiting':_0x43e098['waiting']};_0xdcdce8[_0xf2fa('0x22')](_0x3772b1);}}_0x1e091f({'count':_0xdcdce8['length'],'rows':_0xdcdce8});});},'OpenchannelQueues':function(){return new Promise(function(_0x40e559){var _0x2e80da=[];for(var _0xd46004 in _0x13ca94['openchannelQueues']){if(_0x13ca94[_0xf2fa('0x58')]['hasOwnProperty'](_0xd46004)){var _0x392e0f=_0x13ca94[_0xf2fa('0x58')][_0xd46004];var _0x2adc8b={'id':_0x392e0f['id'],'available':_0x392e0f[_0xf2fa('0x55')],'loggedIn':_0x392e0f[_0xf2fa('0x56')],'name':_0x392e0f[_0xf2fa('0x52')],'paused':_0x392e0f[_0xf2fa('0x57')],'waiting':_0x392e0f['waiting']};_0x2e80da[_0xf2fa('0x22')](_0x2adc8b);}}_0x40e559({'count':_0x2e80da[_0xf2fa('0x1b')],'rows':_0x2e80da});});},'SmsQueues':function(){return new Promise(function(_0x13219c){var _0x30867f=[];for(var _0x5cd01f in _0x13ca94[_0xf2fa('0x59')]){if(_0x13ca94[_0xf2fa('0x59')][_0xf2fa('0x4c')](_0x5cd01f)){var _0x6fee90=_0x13ca94[_0xf2fa('0x59')][_0x5cd01f];var _0x5927b6={'id':_0x6fee90['id'],'available':_0x6fee90[_0xf2fa('0x55')],'loggedIn':_0x6fee90['loggedIn'],'name':_0x6fee90[_0xf2fa('0x52')],'paused':_0x6fee90[_0xf2fa('0x57')],'waiting':_0x6fee90[_0xf2fa('0x53')]};_0x30867f['push'](_0x5927b6);}}_0x13219c({'count':_0x30867f[_0xf2fa('0x1b')],'rows':_0x30867f});});},'FaxQueues':function(){return new Promise(function(_0x5730ee){var _0x4d1881=[];for(var _0x2a1a71 in _0x13ca94[_0xf2fa('0x5a')]){if(_0x13ca94['faxQueues'][_0xf2fa('0x4c')](_0x2a1a71)){var _0x4d3646=_0x13ca94[_0xf2fa('0x5a')][_0x2a1a71];var _0x5b49ab={'id':_0x4d3646['id'],'available':_0x4d3646[_0xf2fa('0x55')],'loggedIn':_0x4d3646[_0xf2fa('0x56')],'name':_0x4d3646[_0xf2fa('0x52')],'paused':_0x4d3646['paused'],'waiting':_0x4d3646[_0xf2fa('0x53')]};_0x4d1881[_0xf2fa('0x22')](_0x5b49ab);}}_0x5730ee({'count':_0x4d1881[_0xf2fa('0x1b')],'rows':_0x4d1881});});},'WhatsappQueues':function(){return new Promise(function(_0x24b7e8){var _0xb9c143=[];for(var _0x42eb09 in _0x13ca94[_0xf2fa('0x5b')]){if(_0x13ca94[_0xf2fa('0x5b')]['hasOwnProperty'](_0x42eb09)){var _0x95544e=_0x13ca94[_0xf2fa('0x5b')][_0x42eb09];var _0x2c1b8f={'id':_0x95544e['id'],'available':_0x95544e['available'],'loggedIn':_0x95544e[_0xf2fa('0x56')],'name':_0x95544e['name'],'paused':_0x95544e[_0xf2fa('0x57')],'waiting':_0x95544e['waiting']};_0xb9c143[_0xf2fa('0x22')](_0x2c1b8f);}}_0x24b7e8({'count':_0xb9c143[_0xf2fa('0x1b')],'rows':_0xb9c143});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1ee422){var _0x5bbbd9=_['values'](_0x13ca94[_0xf2fa('0x5c')]);_0x1ee422({'count':_0x5bbbd9[_0xf2fa('0x1b')],'rows':_0x5bbbd9});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x449a9a){var _0x6e73c2=_[_0xf2fa('0x5d')](_0x13ca94[_0xf2fa('0x5e')]);_0x449a9a({'count':_0x6e73c2[_0xf2fa('0x1b')],'rows':_0x6e73c2});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xb249a5){var _0x1e08ef=_[_0xf2fa('0x5d')](_0x13ca94['openchannelQueuesWaitingInteractions']);_0xb249a5({'count':_0x1e08ef[_0xf2fa('0x1b')],'rows':_0x1e08ef});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x43b1ed){var _0x397031=_['values'](_0x13ca94['smsQueuesWaitingInteractions']);_0x43b1ed({'count':_0x397031[_0xf2fa('0x1b')],'rows':_0x397031});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2c0979){var _0x29a640=_[_0xf2fa('0x5d')](_0x13ca94[_0xf2fa('0x5f')]);_0x2c0979({'count':_0x29a640[_0xf2fa('0x1b')],'rows':_0x29a640});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x23f2e9){var _0x331feb=_[_0xf2fa('0x5d')](_0x13ca94['whatsappQueuesWaitingInteractions']);_0x23f2e9({'count':_0x331feb[_0xf2fa('0x1b')],'rows':_0x331feb});});}};var _0x20e93e=jayson[_0xf2fa('0x60')](_0x559eb5)[_0xf2fa('0x61')]();_0x20e93e['on'](_0xf2fa('0x37'),function(_0x199a43){logger[_0xf2fa('0x37')](JSON[_0xf2fa('0x62')](_0x199a43));return _0x263472(_0x199a43);});_0x20e93e['listen'](0x232c,'127.0.0.1',function(){console[_0xf2fa('0x63')](_0xf2fa('0x64'),0x232c);return _0x30a8b1(_0xf2fa('0x65')+0x232c);});});}; \ No newline at end of file +var _0xcd40=['Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute'];(function(_0x384121,_0x12703c){var _0x101fdb=function(_0x31b395){while(--_0x31b395){_0x384121['push'](_0x384121['shift']());}};_0x101fdb(++_0x12703c);}(_0xcd40,0x101));var _0x0cd4=function(_0x1a86d9,_0x4c0010){_0x1a86d9=_0x1a86d9-0x0;var _0x21e407=_0xcd40[_0x1a86d9];return _0x21e407;};'use strict';var _=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var path=require(_0x0cd4('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x0cd4('0x3'));var utils=require(_0x0cd4('0x4'));var sUtils=require(_0x0cd4('0x5'));var logger=require(_0x0cd4('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x0cd4('0x7')),'mailQueueReport':require(_0x0cd4('0x8')),'chatQueueReport':require(_0x0cd4('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x0cd4('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x0cd4('0xb'));function getId(_0x173216,_0x5e51f0,_0x23a9b2){return util['format'](_0x0cd4('0xc'),_0x173216,_0x5e51f0||0x0,_0x23a9b2||0x0);}function getIntervals(_0x5bff93,_0x3cd25e){var _0x719e98=[];if(!_[_0x0cd4('0xd')](_0x3cd25e[_0x0cd4('0xe')])&&!_[_0x0cd4('0xd')](_0x5bff93[_0x3cd25e['IntervalId']])&&!_['isNil'](_0x5bff93[_0x3cd25e['IntervalId']]['Intervals'])){_0x719e98=_[_0x0cd4('0xf')](_0x5bff93[_0x3cd25e[_0x0cd4('0xe')]][_0x0cd4('0x10')],_0x0cd4('0x11'));}else if(!_[_0x0cd4('0xd')](_0x3cd25e['interval'])){_0x719e98=[_0x3cd25e[_0x0cd4('0x11')]];}return _0x719e98;}exports['listen']=function(_0x2d3bf6){_0x2d3bf6[_0x0cd4('0x12')]={};return new BPromise(function(_0x1eef27,_0x27f027){var _0x3b48d6={'Start':function(_0x71eeb4){var _0x4fe84a=this;return new Promise(function(_0x5dcad7,_0x1db977){if(_0x71eeb4){try{var _0x2c17a2=[];var _0x4ce160=getId(_0x71eeb4[_0x0cd4('0x13')],_0x71eeb4['message']?_0x71eeb4[_0x0cd4('0x14')]['id']:0x0,_0x71eeb4[_0x0cd4('0x15')]?_0x71eeb4[_0x0cd4('0x15')]['id']:0x0);var _0x485713=sUtils[_0x0cd4('0x16')](_0x2d3bf6,_0x71eeb4);if(_0x71eeb4['transfer']||!_0x485713&&_0x71eeb4['applications']&&_[_0x0cd4('0x17')](_0x71eeb4[_0x0cd4('0x18')])&&_0x71eeb4[_0x0cd4('0x18')][_0x0cd4('0x19')]){for(var _0x231d95=0x0;_0x231d95<_0x71eeb4[_0x0cd4('0x18')]['length'];_0x231d95+=0x1){var _0x34e77c=_0x71eeb4[_0x0cd4('0x18')][_0x231d95];if(fs[_0x0cd4('0x1a')](path[_0x0cd4('0x1b')](__dirname,_0x0cd4('0x18'),_0x34e77c[_0x0cd4('0x1c')]+_0x0cd4('0x1d')))){var _0x4bcf1f=[];switch(_0x34e77c['app'][_0x0cd4('0x1e')]()){case _0x0cd4('0x1f'):var _0x43739d=_0x34e77c[_0x0cd4('0x20')][_0x0cd4('0x21')](',');if(_0x71eeb4[_0x0cd4('0x13')]===_0x0cd4('0x22')){_0x4bcf1f[_0x0cd4('0x23')](_0x43739d[0x0]);_0x4bcf1f[_0x0cd4('0x23')](_0x43739d[0x1]);_0x4bcf1f[_0x0cd4('0x23')](_0x43739d['slice'](0x2,_0x43739d[_0x0cd4('0x19')])[_0x0cd4('0x1b')](','));}else{_0x4bcf1f[_0x0cd4('0x23')](_0x43739d[0x0]);_0x4bcf1f['push'](_0x43739d[_0x0cd4('0x24')](0x1,_0x43739d['length'])[_0x0cd4('0x1b')](','));}break;case _0x0cd4('0x25'):var _0x307e81=_0x34e77c['appdata'][_0x0cd4('0x21')](',');_0x4bcf1f[_0x0cd4('0x23')](_0x307e81[0x0]);_0x4bcf1f['push'](_0x307e81[0x1]);_0x4bcf1f['push'](_0x307e81[_0x0cd4('0x24')](0x2,_0x307e81[_0x0cd4('0x19')])[_0x0cd4('0x1b')](','));break;case _0x0cd4('0x26'):var _0x510341=_0x34e77c[_0x0cd4('0x20')][_0x0cd4('0x21')](',');_0x4bcf1f[_0x0cd4('0x23')](_0x510341[0x0]);_0x4bcf1f['push'](_0x510341[0x1]);_0x4bcf1f[_0x0cd4('0x23')](_0x510341[0x2]);_0x4bcf1f[_0x0cd4('0x23')](_0x510341[0x3]);_0x4bcf1f[_0x0cd4('0x23')](_0x510341[_0x0cd4('0x24')](0x4,_0x510341[_0x0cd4('0x19')])[_0x0cd4('0x1b')](','));break;case _0x0cd4('0x27'):var _0x46a0e8=_0x34e77c[_0x0cd4('0x20')][_0x0cd4('0x21')](',');_0x4bcf1f[_0x0cd4('0x23')](_0x46a0e8[0x0]);_0x4bcf1f[_0x0cd4('0x23')](_0x46a0e8[0x1]);_0x4bcf1f[_0x0cd4('0x23')](_0x46a0e8[0x2]);_0x4bcf1f[_0x0cd4('0x23')](_0x46a0e8[0x3]);_0x4bcf1f[_0x0cd4('0x23')](_0x46a0e8[_0x0cd4('0x24')](0x4,_0x46a0e8[_0x0cd4('0x19')])['join'](','));break;case _0x0cd4('0x14'):_0x4bcf1f[_0x0cd4('0x23')](_0x34e77c['appdata']);break;case _0x0cd4('0x28'):_0x4bcf1f[_0x0cd4('0x23')](_0x34e77c[_0x0cd4('0x29')]);_0x4bcf1f['push'](_0x34e77c[_0x0cd4('0x20')]);break;case'tvox':var _0x1ac9c2=utils[_0x0cd4('0x2a')](_0x71eeb4[_0x0cd4('0x2b')][_0x0cd4('0x2c')],_0x71eeb4);var _0x152a3c=_0x34e77c[_0x0cd4('0x20')][_0x0cd4('0x21')](',');_0x4bcf1f['push'](_0x152a3c[0x0]);_0x4bcf1f['push'](_0x152a3c[0x1]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x2]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x3]);_0x4bcf1f['push'](_0x152a3c[0x4]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x5]);_0x4bcf1f['push'](_0x152a3c[0x6]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x7]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x8]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0x9]);_0x4bcf1f[_0x0cd4('0x23')](_0x152a3c[0xa]);_0x4bcf1f[_0x0cd4('0x23')](_0x71eeb4[_0x0cd4('0x15')]['id']);_0x4bcf1f[_0x0cd4('0x23')](_0x71eeb4[_0x0cd4('0x14')]['id']);_0x4bcf1f[_0x0cd4('0x23')](_0x34e77c[_0x0cd4('0x2d')]);_0x4bcf1f[_0x0cd4('0x23')](_0x71eeb4[_0x0cd4('0x15')][_0x0cd4('0x2e')]);_0x4bcf1f[_0x0cd4('0x23')](_0x71eeb4[_0x0cd4('0x2f')][_0x0cd4('0x2f')]);_0x4bcf1f['push'](_0x1ac9c2);break;default:_0x4bcf1f=_[_0x0cd4('0xd')](_0x34e77c['appdata'])?[]:_0x34e77c['appdata'][_0x0cd4('0x21')](',');}var _0x1ef1b6={'id':util[_0x0cd4('0x30')]('%s:%s:%s',_0x4ce160,_0x34e77c['id'],_0x34e77c[_0x0cd4('0x1c')]),'condition':require(_0x0cd4('0x31'))[_0x0cd4('0x32')](_0x4ce160,getIntervals(_0x2d3bf6[_0x0cd4('0x33')],_0x34e77c),_0x2d3bf6),'consequence':require(_0x0cd4('0x34')+_0x34e77c[_0x0cd4('0x1c')])[_0x0cd4('0x35')](_0x4ce160,_0x4bcf1f,_0x2d3bf6,_0x71eeb4),'p':_0x34e77c[_0x0cd4('0x36')]||0x0};logger[_0x0cd4('0x37')](_0x0cd4('0x38'),_0x1ef1b6['id'],_0x0cd4('0x39'),getIntervals(_0x2d3bf6[_0x0cd4('0x33')],_0x34e77c)['join']('\x20|\x20'));_0x2c17a2[_0x0cd4('0x23')](_0x1ef1b6);}else{logger[_0x0cd4('0x3a')](_0x0cd4('0x3b'),path['join'](__dirname,'applications',_0x34e77c[_0x0cd4('0x1c')]+_0x0cd4('0x1d')));}}_0x2d3bf6[_0x0cd4('0x12')][_0x4ce160]=new RuleEngine(_0x2c17a2);_0x2d3bf6[_0x0cd4('0x12')][_0x4ce160][_0x0cd4('0x3c')](_0x71eeb4,function(_0x38c1bd){logger[_0x0cd4('0x37')](_0x0cd4('0x3d'),JSON[_0x0cd4('0x3e')](_0x38c1bd['matchPath']));if(_0x2d3bf6[_0x0cd4('0x12')][_0x4ce160]){_0x2d3bf6[_0x0cd4('0x12')][_0x4ce160][_0x0cd4('0x3f')](_0x0cd4('0x40'));}});return _0x5dcad7({'code':0xc8,'message':_0x71eeb4});}else{if(_0x485713){logger[_0x0cd4('0x37')](util[_0x0cd4('0x30')](_0x0cd4('0x41'),_0x4ce160));}else{logger['info'](_0x0cd4('0x42'));}return _0x5dcad7({'code':0xc8,'message':_0x71eeb4});}}catch(_0x1fe354){logger[_0x0cd4('0x3a')](_0x1fe354[_0x0cd4('0x43')]);return _0x1db977(_0x4fe84a['error'](0x1f4,_0x1fe354));}}return _0x1db977('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c3d21){var _0x52b8e5=this;return new Promise(function(_0x119a39,_0x405fcb){if(_0x2c3d21[_0x0cd4('0x44')]&&_0x2c3d21[_0x0cd4('0x44')]['id']){if(_0x2d3bf6[_0x0cd4('0x45')][_0x2c3d21[_0x0cd4('0x44')]['id']]){_0x2d3bf6[_0x0cd4('0x45')][_0x2c3d21[_0x0cd4('0x44')]['id']][_0x0cd4('0x46')]=![];_0x2d3bf6[_0x0cd4('0x45')][_0x2c3d21[_0x0cd4('0x44')]['id']][_0x0cd4('0x47')]=undefined;}}if(_0x2c3d21['message']&&_0x2c3d21['message']['id']){try{var _0x4b4c62=getId(_0x2c3d21['channel'],_0x2c3d21[_0x0cd4('0x14')]?_0x2c3d21[_0x0cd4('0x14')]['id']:0x0,_0x2c3d21[_0x0cd4('0x15')]?_0x2c3d21[_0x0cd4('0x15')]['id']:0x0);if(_0x2d3bf6[_0x0cd4('0x12')][_0x4b4c62]){_0x2d3bf6['rules'][_0x4b4c62][_0x0cd4('0x3f')](_0x0cd4('0x48'));if(rpc[_0x2c3d21[_0x0cd4('0x13')]+'QueueReport']){rpc[_0x2c3d21[_0x0cd4('0x13')]+_0x0cd4('0x49')][_0x0cd4('0x4a')](_0x4b4c62,{'UserId':_0x2c3d21[_0x0cd4('0x14')][_0x0cd4('0x4b')]})[_0x0cd4('0x4c')](function(){logger[_0x0cd4('0x3a')](_0x0cd4('0x4d'));});}}return _0x119a39({'code':0xc8,'message':_0x2c3d21});}catch(_0xb6c92f){logger[_0x0cd4('0x3a')](_0xb6c92f['stack']);return _0x405fcb(_0x52b8e5[_0x0cd4('0x3a')](0x1f4,_0xb6c92f));}}logger[_0x0cd4('0x3a')](_0x0cd4('0x4e'));return _0x405fcb(_0x52b8e5['error'](0x1f4,_0x0cd4('0x4e')));});},'RejectMessage':function(_0x3d231a){var _0x127788=this;return new Promise(function(_0x56cdce,_0x1a1561){if(_0x3d231a[_0x0cd4('0x44')]&&_0x3d231a['agent']['id']){try{if(_0x2d3bf6['agents'][_0x3d231a[_0x0cd4('0x44')]['id']]){_0x2d3bf6['agents'][_0x3d231a[_0x0cd4('0x44')]['id']]['busy']=![];_0x2d3bf6[_0x0cd4('0x45')][_0x3d231a[_0x0cd4('0x44')]['id']][_0x0cd4('0x47')]=undefined;}return _0x56cdce({'code':0xc8,'message':_0x3d231a});}catch(_0x224025){logger[_0x0cd4('0x3a')](_0x224025[_0x0cd4('0x43')]);return _0x1a1561(_0x127788[_0x0cd4('0x3a')](0x1f4,_0x224025));}}logger['error']('message\x20is\x20empty');return _0x1a1561(_0x127788['error'](0x1f4,_0x0cd4('0x4e')));});},'AbandonInteraction':function(_0x2b631e){var _0x51046f=this;return new Promise(function(_0x5b8d7a,_0x510bef){if(_0x2b631e[_0x0cd4('0x13')]&&_0x2b631e[_0x0cd4('0x15')]&&_0x2b631e[_0x0cd4('0x15')]['id']){try{var _0x4ee249=getId(_0x2b631e[_0x0cd4('0x13')],_0x2b631e[_0x0cd4('0x14')]?_0x2b631e[_0x0cd4('0x14')]['id']:0x0,_0x2b631e['interaction']?_0x2b631e[_0x0cd4('0x15')]['id']:0x0);if(_0x2d3bf6[_0x0cd4('0x12')][_0x4ee249]){_0x2d3bf6[_0x0cd4('0x12')][_0x4ee249][_0x0cd4('0x3f')](_0x0cd4('0x48'));}return _0x5b8d7a({'code':0xc8,'message':_0x2b631e});}catch(_0xb8c794){logger[_0x0cd4('0x3a')](_0xb8c794[_0x0cd4('0x43')]);return _0x510bef(_0x51046f[_0x0cd4('0x3a')](0x1f4,_0xb8c794));}}logger[_0x0cd4('0x3a')](_0x0cd4('0x4e'));return _0x510bef(_0x51046f['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4658df){var _0x323f12=this;return new Promise(function(_0x23e670,_0x58bd47){if(_0x2d3bf6['agents'][_0x0cd4('0x4f')](_0x4658df['id'])){for(var _0x4167e2 in _0x4658df[_0x0cd4('0x50')]){if(_0x4658df[_0x0cd4('0x50')]['hasOwnProperty'](_0x4167e2)){if(_0x2d3bf6[_0x0cd4('0x45')][_0x4658df['id']][_0x0cd4('0x4f')](_0x4167e2+_0x0cd4('0x51'))){_0x2d3bf6['agents'][_0x4658df['id']][_0x4167e2+'CurrentCapacity']=parseInt(_0x4658df[_0x0cd4('0x50')][_0x4167e2],0xa);}}}_0x2d3bf6['agents'][_0x4658df['id']][_0x0cd4('0x52')]();return _0x23e670({'code':0xc8,'message':_0x2d3bf6[_0x0cd4('0x45')][_0x4658df['id']]});}else{return _0x58bd47(_0x323f12[_0x0cd4('0x3a')](0x1f4,_0x0cd4('0x53')));}});},'Agents':function(_0x513790){return new Promise(function(_0x35bc36){var _0x4777a6=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x45')]);if(_0x513790&&_0x513790['id']){var _0x254d4b=_['find'](_0x4777a6,function(_0x4b21df){return _0x4b21df['id']===_0x513790['id'];});_0x35bc36(_0x254d4b);}else{_0x35bc36({'count':_0x4777a6[_0x0cd4('0x19')],'rows':_0x4777a6});}});},'ChatQueues':function(){return new Promise(function(_0x2de2fc){var _0x1ae810=[];for(var _0x5c787d in _0x2d3bf6[_0x0cd4('0x55')]){if(_0x2d3bf6[_0x0cd4('0x55')][_0x0cd4('0x4f')](_0x5c787d)){var _0x4b0fcb=_0x2d3bf6['chatQueues'][_0x5c787d];var _0x12143a={'id':_0x4b0fcb['id'],'available':_0x4b0fcb[_0x0cd4('0x56')],'loggedIn':_0x4b0fcb['loggedIn'],'name':_0x4b0fcb[_0x0cd4('0x57')],'paused':_0x4b0fcb[_0x0cd4('0x58')],'waiting':_0x4b0fcb[_0x0cd4('0x59')]};_0x1ae810[_0x0cd4('0x23')](_0x12143a);}}_0x2de2fc({'count':_0x1ae810[_0x0cd4('0x19')],'rows':_0x1ae810});});},'MailQueues':function(){return new Promise(function(_0x51c4d1){var _0x765b8b=[];for(var _0x30e108 in _0x2d3bf6[_0x0cd4('0x5a')]){if(_0x2d3bf6['mailQueues'][_0x0cd4('0x4f')](_0x30e108)){var _0x399a23=_0x2d3bf6[_0x0cd4('0x5a')][_0x30e108];var _0x1ef6cd={'id':_0x399a23['id'],'available':_0x399a23[_0x0cd4('0x56')],'loggedIn':_0x399a23[_0x0cd4('0x5b')],'name':_0x399a23[_0x0cd4('0x57')],'paused':_0x399a23['paused'],'waiting':_0x399a23['waiting']};_0x765b8b[_0x0cd4('0x23')](_0x1ef6cd);}}_0x51c4d1({'count':_0x765b8b['length'],'rows':_0x765b8b});});},'OpenchannelQueues':function(){return new Promise(function(_0x3f6c0e){var _0x320406=[];for(var _0x3cdd9b in _0x2d3bf6[_0x0cd4('0x5c')]){if(_0x2d3bf6[_0x0cd4('0x5c')][_0x0cd4('0x4f')](_0x3cdd9b)){var _0x442cf3=_0x2d3bf6[_0x0cd4('0x5c')][_0x3cdd9b];var _0x1acef6={'id':_0x442cf3['id'],'available':_0x442cf3[_0x0cd4('0x56')],'loggedIn':_0x442cf3[_0x0cd4('0x5b')],'name':_0x442cf3[_0x0cd4('0x57')],'paused':_0x442cf3[_0x0cd4('0x58')],'waiting':_0x442cf3[_0x0cd4('0x59')]};_0x320406[_0x0cd4('0x23')](_0x1acef6);}}_0x3f6c0e({'count':_0x320406[_0x0cd4('0x19')],'rows':_0x320406});});},'SmsQueues':function(){return new Promise(function(_0x39597c){var _0x3c1e15=[];for(var _0x332ad2 in _0x2d3bf6['smsQueues']){if(_0x2d3bf6[_0x0cd4('0x5d')][_0x0cd4('0x4f')](_0x332ad2)){var _0x19387e=_0x2d3bf6[_0x0cd4('0x5d')][_0x332ad2];var _0x1cc6e4={'id':_0x19387e['id'],'available':_0x19387e[_0x0cd4('0x56')],'loggedIn':_0x19387e[_0x0cd4('0x5b')],'name':_0x19387e[_0x0cd4('0x57')],'paused':_0x19387e[_0x0cd4('0x58')],'waiting':_0x19387e[_0x0cd4('0x59')]};_0x3c1e15[_0x0cd4('0x23')](_0x1cc6e4);}}_0x39597c({'count':_0x3c1e15[_0x0cd4('0x19')],'rows':_0x3c1e15});});},'FaxQueues':function(){return new Promise(function(_0x40db68){var _0x1cda9a=[];for(var _0x172b6f in _0x2d3bf6['faxQueues']){if(_0x2d3bf6['faxQueues'][_0x0cd4('0x4f')](_0x172b6f)){var _0x1ddf19=_0x2d3bf6[_0x0cd4('0x5e')][_0x172b6f];var _0x1ad3e6={'id':_0x1ddf19['id'],'available':_0x1ddf19[_0x0cd4('0x56')],'loggedIn':_0x1ddf19[_0x0cd4('0x5b')],'name':_0x1ddf19[_0x0cd4('0x57')],'paused':_0x1ddf19[_0x0cd4('0x58')],'waiting':_0x1ddf19[_0x0cd4('0x59')]};_0x1cda9a[_0x0cd4('0x23')](_0x1ad3e6);}}_0x40db68({'count':_0x1cda9a['length'],'rows':_0x1cda9a});});},'WhatsappQueues':function(){return new Promise(function(_0xa1611){var _0x212314=[];for(var _0x36b4d0 in _0x2d3bf6['whatsappQueues']){if(_0x2d3bf6[_0x0cd4('0x5f')][_0x0cd4('0x4f')](_0x36b4d0)){var _0x59dcec=_0x2d3bf6[_0x0cd4('0x5f')][_0x36b4d0];var _0x24ffd1={'id':_0x59dcec['id'],'available':_0x59dcec[_0x0cd4('0x56')],'loggedIn':_0x59dcec[_0x0cd4('0x5b')],'name':_0x59dcec[_0x0cd4('0x57')],'paused':_0x59dcec[_0x0cd4('0x58')],'waiting':_0x59dcec[_0x0cd4('0x59')]};_0x212314[_0x0cd4('0x23')](_0x24ffd1);}}_0xa1611({'count':_0x212314[_0x0cd4('0x19')],'rows':_0x212314});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x503949){var _0x37a3f2=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x60')]);_0x503949({'count':_0x37a3f2[_0x0cd4('0x19')],'rows':_0x37a3f2});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x44d10f){var _0x13c57f=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x61')]);_0x44d10f({'count':_0x13c57f[_0x0cd4('0x19')],'rows':_0x13c57f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x42f4cd){var _0x5cfa43=_['values'](_0x2d3bf6[_0x0cd4('0x62')]);_0x42f4cd({'count':_0x5cfa43['length'],'rows':_0x5cfa43});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x542098){var _0x1c801c=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x63')]);_0x542098({'count':_0x1c801c['length'],'rows':_0x1c801c});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x266305){var _0x7d8085=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x64')]);_0x266305({'count':_0x7d8085[_0x0cd4('0x19')],'rows':_0x7d8085});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x40eea3){var _0x5baba4=_[_0x0cd4('0x54')](_0x2d3bf6[_0x0cd4('0x65')]);_0x40eea3({'count':_0x5baba4[_0x0cd4('0x19')],'rows':_0x5baba4});});}};var _0x5f219b=jayson['server'](_0x3b48d6)['http']();_0x5f219b['on']('error',function(_0x5db0ef){logger[_0x0cd4('0x3a')](JSON[_0x0cd4('0x3e')](_0x5db0ef));return _0x27f027(_0x5db0ef);});_0x5f219b[_0x0cd4('0x66')](0x232c,_0x0cd4('0x67'),function(){console['log'](_0x0cd4('0x68'),0x232c);return _0x1eef27(_0x0cd4('0x69')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3022fde..ff5eccd 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 _0xc012=['condition','rules','info','stop','some','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','iftime','../../../config/logger','routing'];(function(_0x184022,_0x3b776d){var _0x1f3596=function(_0x188f15){while(--_0x188f15){_0x184022['push'](_0x184022['shift']());}};_0x1f3596(++_0x3b776d);}(_0xc012,0x167));var _0x2c01=function(_0x37468e,_0x14c7a4){_0x37468e=_0x37468e-0x0;var _0x203d9f=_0xc012[_0x37468e];return _0x203d9f;};'use strict';var _=require(_0x2c01('0x0'));var iftime=require(_0x2c01('0x1'))[_0x2c01('0x2')];var logger=require(_0x2c01('0x3'))(_0x2c01('0x4'));exports[_0x2c01('0x5')]=function(_0x468692,_0x4af4fd,_0x4e37f6){return function(_0x5b1b86){if(_0x4e37f6[_0x2c01('0x6')]&&!_0x4e37f6['rules'][_0x468692]){logger[_0x2c01('0x7')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x468692);return _0x5b1b86[_0x2c01('0x8')]();}var _0xc125a8=_0x4af4fd['map'](function(_0xdaa020){return iftime(_0xdaa020);});var _0x43fba8=_[_0x2c01('0x9')](_0xc125a8);if(_0x43fba8){logger[_0x2c01('0x7')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x468692,_0x4af4fd[_0x2c01('0xa')](_0x2c01('0xb')),_0x43fba8);_0x5b1b86[_0x2c01('0xc')](_0x43fba8);}else{logger[_0x2c01('0x7')](_0x2c01('0xd'),_0x468692,_0x4af4fd[_0x2c01('0xa')]('\x20|\x20'));_0x5b1b86[_0x2c01('0x8')]();}};}; \ No newline at end of file +var _0xca4b=['some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','../../../utils/iftime','iftime','rules','info','stop','map'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xca4b,0x101));var _0xbca4=function(_0x404d98,_0x362ba9){_0x404d98=_0x404d98-0x0;var _0x4c3664=_0xca4b[_0x404d98];return _0x4c3664;};'use strict';var _=require(_0xbca4('0x0'));var iftime=require(_0xbca4('0x1'))[_0xbca4('0x2')];var logger=require('../../../config/logger')('routing');exports['condition']=function(_0x3a2bf3,_0x1c99d9,_0x2a06f){return function(_0x181109){if(_0x2a06f[_0xbca4('0x3')]&&!_0x2a06f[_0xbca4('0x3')][_0x3a2bf3]){logger[_0xbca4('0x4')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3a2bf3);return _0x181109[_0xbca4('0x5')]();}var _0x29ae64=_0x1c99d9[_0xbca4('0x6')](function(_0xd8518){return iftime(_0xd8518);});var _0x4b4d3c=_[_0xbca4('0x7')](_0x29ae64);if(_0x4b4d3c){logger['info'](_0xbca4('0x8'),_0x3a2bf3,_0x1c99d9['join'](_0xbca4('0x9')),_0x4b4d3c);_0x181109[_0xbca4('0xa')](_0x4b4d3c);}else{logger[_0xbca4('0x4')](_0xbca4('0xb'),_0x3a2bf3,_0x1c99d9['join'](_0xbca4('0x9')));_0x181109['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0460c67..845011a 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 _0xb43b=['type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','format','destuniqueid','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','ringtime','talktime','push','error','forIn','membername','agentringnoanswerAt','now','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','debug','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferuniqueid','origtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','lastevent','getVoiceQueueByName','then'];(function(_0x2c327d,_0xc7db7a){var _0x17f055=function(_0x50b53e){while(--_0x50b53e){_0x2c327d['push'](_0x2c327d['shift']());}};_0x17f055(++_0xc7db7a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1199d8,_0x29c33c){_0x1199d8=_0x1199d8-0x0;var _0x536f04=_0xb43b[_0x1199d8];return _0x536f04;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1bdcfc,_0x1995f8){utils[_0xbb43('0x2')](util['format'](_0xbb43('0x3'),_0x1bdcfc[_0xbb43('0x4')],_0x1bdcfc[_0xbb43('0x5')],_0x1bdcfc[_0xbb43('0x6')],_0x1bdcfc['membername'],_0x1bdcfc['interface'],_0x1bdcfc[_0xbb43('0x7')],_0x1bdcfc['connectedlinenum'],_0x1bdcfc[_0xbb43('0x8')]));if(_0x1bdcfc[_0xbb43('0x6')]){utils[_0xbb43('0x9')](_0x1bdcfc[_0xbb43('0x6')])[_0xbb43('0xa')](function(_0x4a06f3){if(_0x4a06f3){_0x1bdcfc[_0xbb43('0xb')]=_0x4a06f3[_0xbb43('0xb')];_0x1bdcfc['agentacw']=_0x1bdcfc[_0xbb43('0xc')]?_0x4a06f3[_0xbb43('0xd')]:![];_0x1bdcfc[_0xbb43('0xe')]=_0x1bdcfc[_0xbb43('0xf')]?_0x4a06f3[_0xbb43('0x10')]:0x0;}utils[_0xbb43('0x11')]('CreateVoiceAgentReport',_0x1bdcfc);});}else{utils[_0xbb43('0x11')](_0xbb43('0x12'),_0x1bdcfc);}if(_0x1995f8){delete transfers[_0x1bdcfc['uniqueid']];}else{delete agents[_0x1bdcfc['destuniqueid']];}}exports[_0xbb43('0x13')]=function(_0x4a3714){try{utils['debug'](util[_0xbb43('0x14')]('[%s][agents][agentcalled]',_0x4a3714[_0xbb43('0x4')]),_0x4a3714);agents[_0x4a3714[_0xbb43('0x15')]]=_0x4a3714;agents[_0x4a3714['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0x4a3714[_0xbb43('0x15')]][_0xbb43('0x8')]='called';agents[_0x4a3714['destuniqueid']][_0xbb43('0x16')]=null;agents[_0x4a3714['destuniqueid']]['connectedlinename']=null;utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x17'),_0x4a3714['uniqueid'],agents[_0x4a3714[_0xbb43('0x15')]]['membername'],_0x4a3714[_0xbb43('0x15')]));}catch(_0x8e6429){utils['error'](util['format'](_0xbb43('0x18'),_0x4a3714[_0xbb43('0x4')]),_0x8e6429);}};exports[_0xbb43('0x19')]=function(_0x2bf2d4){try{if(!_['isNil'](agents[_0x2bf2d4[_0xbb43('0x15')]])){utils['debug'](util[_0xbb43('0x14')]('[%s][agents][agentringnoanswer]',_0x2bf2d4[_0xbb43('0x4')]),_0x2bf2d4);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x1a'),_0x2bf2d4['uniqueid'],agents[_0x2bf2d4[_0xbb43('0x15')]]['membername'],_0x2bf2d4[_0xbb43('0x15')]));agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x19')]=!![];agents[_0x2bf2d4['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x8')]='timeout';agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x1b')]=_0xbb43('0x1c');agents[_0x2bf2d4[_0xbb43('0x15')]]['holdtime']=_0x2bf2d4['ringtime']?parseInt(_0x2bf2d4[_0xbb43('0x1d')])/0x3e8:0x0;agents[_0x2bf2d4[_0xbb43('0x15')]][_0xbb43('0x1e')]=0x0;unanswered[_0xbb43('0x1f')](_0x2bf2d4[_0xbb43('0x15')]);}}catch(_0x40b04b){utils[_0xbb43('0x20')](util[_0xbb43('0x14')]('[%s][agents][agentringnoanswer]',_0x2bf2d4[_0xbb43('0x4')]),_0x40b04b);}};exports['queuecallerabandon']=function(_0x31fbc8){try{_[_0xbb43('0x21')](agents,function(_0x34f5b2,_0x1880cd){if(_0x34f5b2['uniqueid']==_0x31fbc8[_0xbb43('0x4')]&&!_['includes'](unanswered,_0x34f5b2['destuniqueid'])){utils['debug'](util[_0xbb43('0x14')]('[%s][agents][queuecallerabandon]',_0x31fbc8[_0xbb43('0x4')]),_0x31fbc8);utils[_0xbb43('0x2')](util[_0xbb43('0x14')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x31fbc8[_0xbb43('0x4')],_0x34f5b2[_0xbb43('0x22')],_0x34f5b2[_0xbb43('0x15')]));_0x34f5b2[_0xbb43('0x19')]=!![];_0x34f5b2[_0xbb43('0x23')]=utils[_0xbb43('0x24')]();_0x34f5b2[_0xbb43('0x8')]=_0xbb43('0x25');_0x34f5b2['reason']=_0xbb43('0x25');_0x34f5b2[_0xbb43('0x26')]=_0x31fbc8[_0xbb43('0x26')];_0x34f5b2[_0xbb43('0x1e')]=0x0;writeDB(_0x34f5b2);}});}catch(_0x4015ec){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x27'),_0x31fbc8[_0xbb43('0x4')]),_0x4015ec);}};exports[_0xbb43('0x28')]=function(_0x21346a){try{if(agents[_0x21346a[_0xbb43('0x15')]]){utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x2a'),_0x21346a[_0xbb43('0x4')]),_0x21346a);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x2b'),_0x21346a['uniqueid'],agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x22')],_0x21346a[_0xbb43('0x15')]));agents[_0x21346a['destuniqueid']]['agentconnectAt']=utils['now']();agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x16')]=_0x21346a['connectedlinenum'];agents[_0x21346a['destuniqueid']][_0xbb43('0x2c')]=_0x21346a[_0xbb43('0x2c')];agents[_0x21346a[_0xbb43('0x15')]][_0xbb43('0x26')]=_0x21346a[_0xbb43('0x1d')];agents[_0x21346a['destuniqueid']][_0xbb43('0x8')]=_0xbb43('0x2d');_[_0xbb43('0x21')](agents,function(_0x3340aa,_0x22fccc){if(_0x3340aa['destuniqueid']!=_0x21346a[_0xbb43('0x15')]&&_0x3340aa['uniqueid']==_0x21346a[_0xbb43('0x4')]){_0x3340aa[_0xbb43('0x1e')]=0x0;_0x3340aa['holdtime']=_0x21346a[_0xbb43('0x1d')];_0x3340aa['agentringnoanswer']=!![];_0x3340aa[_0xbb43('0x23')]=utils[_0xbb43('0x24')]();_0x3340aa[_0xbb43('0x8')]=_0xbb43('0x2e');_0x3340aa['reason']=_0xbb43('0x2e');_0x3340aa[_0xbb43('0x2f')]=_0x21346a['destuniqueid'];_0x3340aa[_0xbb43('0x30')]=_0x21346a['membername'];writeDB(_0x3340aa);}});}}catch(_0x42b965){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x2a'),_0x21346a[_0xbb43('0x4')]),_0x42b965);}};exports[_0xbb43('0xc')]=function(_0x4bf8ed){try{if(!_[_0xbb43('0x31')](agents[_0x4bf8ed['destuniqueid']])){utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x32'),_0x4bf8ed[_0xbb43('0x4')]),_0x4bf8ed);utils['info'](util[_0xbb43('0x14')](_0xbb43('0x33'),_0x4bf8ed[_0xbb43('0x4')],agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0x22')],_0x4bf8ed[_0xbb43('0x15')]));agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0xc')]=!![];agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x1e')]=utils['diffTime'](agents[_0x4bf8ed['destuniqueid']]['agentcompleteAt'],agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x35')]);agents[_0x4bf8ed['destuniqueid']][_0xbb43('0x1b')]=_0x4bf8ed['reason'];agents[_0x4bf8ed[_0xbb43('0x15')]][_0xbb43('0x8')]=_0xbb43('0x36');writeDB(agents[_0x4bf8ed['destuniqueid']]);}}catch(_0x186cd6){utils['error'](util[_0xbb43('0x14')](_0xbb43('0x32'),_0x4bf8ed[_0xbb43('0x4')]),_0x186cd6);}};exports[_0xbb43('0x37')]=function(_0x417ad9){try{if(!_[_0xbb43('0x31')](agents[_0x417ad9[_0xbb43('0x38')]])){utils['debug'](util[_0xbb43('0x14')](_0xbb43('0x39'),_0x417ad9[_0xbb43('0x4')]),_0x417ad9);utils[_0xbb43('0x2')](util['format'](_0xbb43('0x3a'),_0x417ad9[_0xbb43('0x4')],agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x22')],agents[_0x417ad9['transfereruniqueid']][_0xbb43('0x4')]));agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x3b')]=!![];agents[_0x417ad9['transfereruniqueid']][_0xbb43('0x3c')]=_0xbb43('0x3d');agents[_0x417ad9[_0xbb43('0x38')]][_0xbb43('0x3e')]=_0x417ad9[_0xbb43('0x3f')];agents[_0x417ad9['transfereruniqueid']]['transferuniqueid']=agents[_0x417ad9[_0xbb43('0x38')]]['uniqueid'];}}catch(_0xf5d5c){utils[_0xbb43('0x20')](util['format'](_0xbb43('0x39'),_0x417ad9[_0xbb43('0x4')]),_0xf5d5c);}};exports[_0xbb43('0x40')]=function(_0x1a4367){try{utils[_0xbb43('0x29')](util['format'](_0xbb43('0x41'),_0x1a4367['origtransfereruniqueid']),_0x1a4367);if(_0x1a4367['origtransfereruniqueid']==_0x1a4367[_0xbb43('0x42')]){if(!_[_0xbb43('0x31')](agents[_0x1a4367[_0xbb43('0x43')]])){utils[_0xbb43('0x2')](util[_0xbb43('0x14')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x1a4367['origtransfereruniqueid'],agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x22')]));agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3b')]=!![];agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3c')]=_0xbb43('0x44');agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x3e')]=_0x1a4367['origtransfererexten'];agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x45')]=_0x1a4367[_0xbb43('0x46')];}if(_0x1a4367[_0xbb43('0x47')]&&agents[_0x1a4367[_0xbb43('0x47')]]){agents[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x48')]=0x1;transfers[_0x1a4367[_0xbb43('0x47')]]=_[_0xbb43('0x49')](agents[_0x1a4367['transfereeuniqueid']]);transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x7')]=agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x7')];transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x4a')]=agents[_0x1a4367[_0xbb43('0x43')]][_0xbb43('0x4a')];transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x4b')]=utils['now']();transfers[_0x1a4367['transfereeuniqueid']][_0xbb43('0x35')]=utils[_0xbb43('0x24')]();transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x26')]=0x0;transfers[_0x1a4367[_0xbb43('0x47')]][_0xbb43('0x48')]=0x2;}}else if(_0x1a4367[_0xbb43('0x43')]==_0x1a4367[_0xbb43('0x4c')]){if(!_['isNil'](agents[_0x1a4367['origtransfereruniqueid']])){utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x4d'),_0x1a4367[_0xbb43('0x46')],agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x22')]));agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x3b')]=!![];agents[_0x1a4367[_0xbb43('0x46')]]['transfertype']=_0xbb43('0x44');agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x3e')]=_0x1a4367[_0xbb43('0x4e')];agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x45')]=_0x1a4367['secondtransfereruniqueid'];}if(_0x1a4367[_0xbb43('0x4f')]&&agents[_0x1a4367[_0xbb43('0x4f')]]){agents[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x48')]=0x1;transfers[_0x1a4367[_0xbb43('0x4f')]]=_['clone'](agents[_0x1a4367[_0xbb43('0x4f')]]);transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x7')]=agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x7')];transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x4a')]=agents[_0x1a4367[_0xbb43('0x46')]][_0xbb43('0x4a')];transfers[_0x1a4367[_0xbb43('0x4f')]]['agentcalledAt']=utils[_0xbb43('0x24')]();transfers[_0x1a4367['transfertargetuniqueid']][_0xbb43('0x35')]=utils[_0xbb43('0x24')]();transfers[_0x1a4367[_0xbb43('0x4f')]][_0xbb43('0x26')]=0x0;transfers[_0x1a4367[_0xbb43('0x4f')]]['agententerreason']=0x2;}}}catch(_0x59a665){utils[_0xbb43('0x20')](util[_0xbb43('0x14')]('[%s][agents][attendedtransfer]',_0x1a4367[_0xbb43('0x46')]),_0x59a665);}};exports[_0xbb43('0x50')]=function(_0x41d26a){try{utils[_0xbb43('0x29')](util[_0xbb43('0x14')](_0xbb43('0x51'),_0x41d26a[_0xbb43('0x4')]),_0x41d26a);if(agents[_0x41d26a[_0xbb43('0x4')]]&&agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]===_0xbb43('0x1c')){if(_0x41d26a[_0xbb43('0x52')]==='21'){agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]='rejected';agents[_0x41d26a['uniqueid']][_0xbb43('0x8')]=_0xbb43('0x53');}utils[_0xbb43('0x2')](util['format'](_0xbb43('0x54'),_0x41d26a[_0xbb43('0x4')],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x22')],agents[_0x41d26a[_0xbb43('0x4')]]['reason'],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x8')]));writeDB(agents[_0x41d26a[_0xbb43('0x4')]]);var _0x4c1405=unanswered[_0xbb43('0x55')](_0x41d26a[_0xbb43('0x4')]);if(_0x4c1405>-0x1){unanswered[_0xbb43('0x56')](_0x4c1405,0x1);}}if(transfers[_0x41d26a[_0xbb43('0x4')]]){transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0xc')]=!![];transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1e')]=utils['diffTime'](transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')],transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x35')]);transfers[_0x41d26a[_0xbb43('0x4')]]['reason']='agent';transfers[_0x41d26a['uniqueid']][_0xbb43('0x8')]=_0xbb43('0x36');utils[_0xbb43('0x2')](util[_0xbb43('0x14')](_0xbb43('0x54'),_0x41d26a[_0xbb43('0x4')],transfers[_0x41d26a[_0xbb43('0x4')]]['membername'],transfers[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')],transfers[_0x41d26a[_0xbb43('0x4')]]['lastevent']));writeDB(transfers[_0x41d26a[_0xbb43('0x4')]],!![]);}if(agents[_0x41d26a['uniqueid']]&&agents[_0x41d26a[_0xbb43('0x4')]]['agentconnectAt']){agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0xc')]=!![];agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x34')]=utils[_0xbb43('0x24')]();agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1e')]=utils[_0xbb43('0x57')](agents[_0x41d26a['uniqueid']][_0xbb43('0x34')],agents[_0x41d26a[_0xbb43('0x4')]]['agentconnectAt']);agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x1b')]=agents[_0x41d26a[_0xbb43('0x4')]]['transfer']?_0xbb43('0x3b'):_0xbb43('0x58');agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x8')]=_0xbb43('0x36');utils[_0xbb43('0x2')](util['format'](_0xbb43('0x54'),_0x41d26a['uniqueid'],agents[_0x41d26a[_0xbb43('0x4')]][_0xbb43('0x22')],agents[_0x41d26a['uniqueid']][_0xbb43('0x1b')],agents[_0x41d26a[_0xbb43('0x4')]]['lastevent']));writeDB(agents[_0x41d26a['uniqueid']]);}}catch(_0x337154){utils[_0xbb43('0x20')](util[_0xbb43('0x14')](_0xbb43('0x51'),_0x41d26a[_0xbb43('0x4')]),_0x337154);}}; \ No newline at end of file +var _0xa478=['push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime'];(function(_0x4b3cff,_0x420a92){var _0x22a61e=function(_0xb9a15d){while(--_0xb9a15d){_0x4b3cff['push'](_0x4b3cff['shift']());}};_0x22a61e(++_0x420a92);}(_0xa478,0x136));var _0x8a47=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xa478[_0x1b5a05];return _0x347931;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var utils=require(_0x8a47('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44be2c,_0x2c3f60){utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x5'),_0x44be2c[_0x8a47('0x6')],_0x44be2c[_0x8a47('0x7')],_0x44be2c[_0x8a47('0x8')],_0x44be2c[_0x8a47('0x9')],_0x44be2c['interface'],_0x44be2c[_0x8a47('0xa')],_0x44be2c[_0x8a47('0xb')],_0x44be2c[_0x8a47('0xc')]));if(_0x44be2c[_0x8a47('0x8')]){utils['getVoiceQueueByName'](_0x44be2c[_0x8a47('0x8')])['then'](function(_0x7b6e61){if(_0x7b6e61){_0x44be2c[_0x8a47('0xd')]=_0x7b6e61[_0x8a47('0xd')];_0x44be2c['agentacw']=_0x44be2c[_0x8a47('0xe')]?_0x7b6e61[_0x8a47('0xf')]:![];_0x44be2c['acwtime']=_0x44be2c[_0x8a47('0x10')]?_0x7b6e61['acwTimeout']:0x0;}utils[_0x8a47('0x11')](_0x8a47('0x12'),_0x44be2c);});}else{utils[_0x8a47('0x11')]('CreateVoiceAgentReport',_0x44be2c);}if(_0x2c3f60){delete transfers[_0x44be2c['uniqueid']];}else{delete agents[_0x44be2c['destuniqueid']];}}exports[_0x8a47('0x13')]=function(_0x12539c){try{utils['debug'](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x12539c);agents[_0x12539c[_0x8a47('0x15')]]=_0x12539c;agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x18');agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xb')]=null;agents[_0x12539c[_0x8a47('0x15')]]['connectedlinename']=null;utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x19'),_0x12539c['uniqueid'],agents[_0x12539c[_0x8a47('0x15')]]['membername'],_0x12539c['destuniqueid']));}catch(_0x1cf650){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x1cf650);}};exports[_0x8a47('0x1b')]=function(_0x44e119){try{if(!_[_0x8a47('0x1c')](agents[_0x44e119[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util['format'](_0x8a47('0x1e'),_0x44e119['uniqueid']),_0x44e119);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x1f'),_0x44e119[_0x8a47('0x6')],agents[_0x44e119['destuniqueid']][_0x8a47('0x9')],_0x44e119['destuniqueid']));agents[_0x44e119['destuniqueid']]['agentringnoanswer']=!![];agents[_0x44e119['destuniqueid']][_0x8a47('0x20')]=utils[_0x8a47('0x17')]();agents[_0x44e119['destuniqueid']][_0x8a47('0xc')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x23')]=_0x44e119['ringtime']?parseInt(_0x44e119[_0x8a47('0x24')])/0x3e8:0x0;agents[_0x44e119['destuniqueid']][_0x8a47('0x25')]=0x0;unanswered[_0x8a47('0x26')](_0x44e119['destuniqueid']);}}catch(_0x1e89b1){utils['error'](util['format'](_0x8a47('0x1e'),_0x44e119[_0x8a47('0x6')]),_0x1e89b1);}};exports[_0x8a47('0x27')]=function(_0x12f0b7){try{_[_0x8a47('0x28')](agents,function(_0x18bfd3,_0x58aa06){if(_0x18bfd3[_0x8a47('0x6')]==_0x12f0b7['uniqueid']&&!_['includes'](unanswered,_0x18bfd3[_0x8a47('0x15')])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x12f0b7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2a'),_0x12f0b7[_0x8a47('0x6')],_0x18bfd3[_0x8a47('0x9')],_0x18bfd3['destuniqueid']));_0x18bfd3[_0x8a47('0x1b')]=!![];_0x18bfd3[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x18bfd3['lastevent']=_0x8a47('0x2b');_0x18bfd3[_0x8a47('0x22')]='abandoned';_0x18bfd3[_0x8a47('0x23')]=_0x12f0b7[_0x8a47('0x23')];_0x18bfd3[_0x8a47('0x25')]=0x0;writeDB(_0x18bfd3);}});}catch(_0x20551b){utils['error'](util['format'](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x20551b);}};exports[_0x8a47('0x2c')]=function(_0x42c5d7){try{if(agents[_0x42c5d7[_0x8a47('0x15')]]){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentconnect]',_0x42c5d7['uniqueid']),_0x42c5d7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2d'),_0x42c5d7[_0x8a47('0x6')],agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x9')],_0x42c5d7[_0x8a47('0x15')]));agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();agents[_0x42c5d7[_0x8a47('0x15')]]['connectedlinenum']=_0x42c5d7[_0x8a47('0xb')];agents[_0x42c5d7['destuniqueid']]['connectedlinename']=_0x42c5d7['connectedlinename'];agents[_0x42c5d7['destuniqueid']]['holdtime']=_0x42c5d7[_0x8a47('0x24')];agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x2f');_[_0x8a47('0x28')](agents,function(_0x20ba1c,_0x25c45b){if(_0x20ba1c[_0x8a47('0x15')]!=_0x42c5d7['destuniqueid']&&_0x20ba1c['uniqueid']==_0x42c5d7[_0x8a47('0x6')]){_0x20ba1c[_0x8a47('0x25')]=0x0;_0x20ba1c[_0x8a47('0x23')]=_0x42c5d7[_0x8a47('0x24')];_0x20ba1c['agentringnoanswer']=!![];_0x20ba1c[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x20ba1c[_0x8a47('0xc')]=_0x8a47('0x30');_0x20ba1c[_0x8a47('0x22')]='answered_elsewhere';_0x20ba1c[_0x8a47('0x31')]=_0x42c5d7[_0x8a47('0x15')];_0x20ba1c[_0x8a47('0x32')]=_0x42c5d7['membername'];writeDB(_0x20ba1c);}});}}catch(_0x2b3874){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x33'),_0x42c5d7['uniqueid']),_0x2b3874);}};exports[_0x8a47('0xe')]=function(_0x2f523f){try{if(!_[_0x8a47('0x1c')](agents[_0x2f523f[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f['uniqueid']),_0x2f523f);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x34'),_0x2f523f['uniqueid'],agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x9')],_0x2f523f['destuniqueid']));agents[_0x2f523f['destuniqueid']][_0x8a47('0xe')]=!![];agents[_0x2f523f['destuniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x25')]=utils[_0x8a47('0x36')](agents[_0x2f523f[_0x8a47('0x15')]]['agentcompleteAt'],agents[_0x2f523f['destuniqueid']][_0x8a47('0x2e')]);agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x2f523f[_0x8a47('0x22')];agents[_0x2f523f[_0x8a47('0x15')]]['lastevent']='complete';writeDB(agents[_0x2f523f[_0x8a47('0x15')]]);}}catch(_0x531faa){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f[_0x8a47('0x6')]),_0x531faa);}};exports[_0x8a47('0x37')]=function(_0x14e22c){try{if(!_[_0x8a47('0x1c')](agents[_0x14e22c[_0x8a47('0x38')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x39'),_0x14e22c['uniqueid']),_0x14e22c);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x3a'),_0x14e22c[_0x8a47('0x6')],agents[_0x14e22c['transfereruniqueid']][_0x8a47('0x9')],agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x6')]));agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x3b')]=!![];agents[_0x14e22c[_0x8a47('0x38')]]['transfertype']='blind';agents[_0x14e22c[_0x8a47('0x38')]]['transferexten']=_0x14e22c[_0x8a47('0x3c')];agents[_0x14e22c[_0x8a47('0x38')]]['transferuniqueid']=agents[_0x14e22c[_0x8a47('0x38')]]['uniqueid'];}}catch(_0x315111){utils['error'](util[_0x8a47('0x4')]('[%s][agents][blindtransfer]',_0x14e22c[_0x8a47('0x6')]),_0x315111);}};exports[_0x8a47('0x3d')]=function(_0xdaa896){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0xdaa896);if(_0xdaa896[_0x8a47('0x3f')]==_0xdaa896[_0x8a47('0x40')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x41')]])){utils['info'](util[_0x8a47('0x4')](_0x8a47('0x42'),_0xdaa896['origtransfereruniqueid'],agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x46')];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x47')]=_0xdaa896['origtransfereruniqueid'];}if(_0xdaa896[_0x8a47('0x48')]&&agents[_0xdaa896[_0x8a47('0x48')]]){agents[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x48')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x48')]]);transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0xa')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0xa')];transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x48')]]['agentcalledAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfereeuniqueid']][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x2;}}else if(_0xdaa896['secondtransfereruniqueid']==_0xdaa896[_0x8a47('0x4c')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x3f')]])){utils['info'](util['format'](_0x8a47('0x42'),_0xdaa896[_0x8a47('0x3f')],agents[_0xdaa896['origtransfereruniqueid']][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x4d')];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x47')]=_0xdaa896[_0x8a47('0x41')];}if(_0xdaa896[_0x8a47('0x4e')]&&agents[_0xdaa896['transfertargetuniqueid']]){agents[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x4e')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x4e')]]);transfers[_0xdaa896[_0x8a47('0x4e')]]['calleridnum']=agents[_0xdaa896[_0x8a47('0x3f')]]['calleridnum'];transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']]['agentconnectAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x2;}}}catch(_0x39d8f4){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0x39d8f4);}};exports['hangup']=function(_0x5c1e7e){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e['uniqueid']),_0x5c1e7e);if(agents[_0x5c1e7e['uniqueid']]&&agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]==='timeout'){if(_0x5c1e7e[_0x8a47('0x50')]==='21'){agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=_0x8a47('0x51');agents[_0x5c1e7e['uniqueid']][_0x8a47('0xc')]='rejected';}utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e['uniqueid'],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e[_0x8a47('0x6')]]);var _0x4c6dbe=unanswered[_0x8a47('0x53')](_0x5c1e7e[_0x8a47('0x6')]);if(_0x4c6dbe>-0x1){unanswered[_0x8a47('0x54')](_0x4c6dbe,0x1);}}if(transfers[_0x5c1e7e['uniqueid']]){transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xe')]=!![];transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x25')]=utils[_0x8a47('0x36')](transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],transfers[_0x5c1e7e[_0x8a47('0x6')]]['agentconnectAt']);transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]=_0x8a47('0x55');transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5c1e7e[_0x8a47('0x6')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(transfers[_0x5c1e7e[_0x8a47('0x6')]],!![]);}if(agents[_0x5c1e7e[_0x8a47('0x6')]]&&agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]){agents[_0x5c1e7e[_0x8a47('0x6')]]['agentcomplete']=!![];agents[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x5c1e7e[_0x8a47('0x6')]]['talktime']=utils[_0x8a47('0x36')](agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]);agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x3b')]?_0x8a47('0x3b'):_0x8a47('0x55');agents[_0x5c1e7e[_0x8a47('0x6')]]['lastevent']=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e[_0x8a47('0x6')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e['uniqueid']]);}}catch(_0x98d7ae){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e[_0x8a47('0x6')]),_0x98d7ae);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index a40596c..afa419b 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 _0x10f0=['destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','split','includes','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x5d60ff,_0x400296){var _0x1a68e8=function(_0x1d163f){while(--_0x1d163f){_0x5d60ff['push'](_0x5d60ff['shift']());}};_0x1a68e8(++_0x400296);}(_0x10f0,0x188));var _0x010f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x10f0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x010f('0x0'));var util=require(_0x010f('0x1'));var utils=require(_0x010f('0x2'));var dispositions=[_0x010f('0x3'),_0x010f('0x4'),_0x010f('0x4'),_0x010f('0x3'),'NO\x20ANSWER',_0x010f('0x3'),'ANSWERED',_0x010f('0x5'),_0x010f('0x4'),_0x010f('0x4'),'FAILED'];var channels={};function writeDB(_0x3c7cb3){utils[_0x010f('0x6')](util['format'](_0x010f('0x7'),_0x3c7cb3[_0x010f('0x8')],_0x3c7cb3[_0x010f('0x9')],_0x3c7cb3[_0x010f('0xa')],_0x3c7cb3[_0x010f('0xb')],_0x3c7cb3['interface'],_0x3c7cb3['calleridnum'],_0x3c7cb3[_0x010f('0xc')],_0x3c7cb3[_0x010f('0xd')]));if(_0x3c7cb3[_0x010f('0xe')]){utils[_0x010f('0xf')](_0x3c7cb3[_0x010f('0xe')])[_0x010f('0x10')](function(_0x461e27){if(_0x461e27){_0x3c7cb3[_0x010f('0x11')]=_0x461e27['id'];}utils[_0x010f('0x12')](_0x010f('0x13'),_0x3c7cb3);});}else{utils['request'](_0x010f('0x13'),_0x3c7cb3);}if(channels[_0x3c7cb3[_0x010f('0x8')]]){delete channels[_0x3c7cb3['uniqueid']];}}exports[_0x010f('0x14')]=function(_0x5dd582){try{utils[_0x010f('0x15')](util[_0x010f('0x16')](_0x010f('0x17'),_0x5dd582[_0x010f('0x8')]),_0x5dd582);if(_0x5dd582[_0x010f('0x8')]==_0x5dd582[_0x010f('0x18')]&&_0x5dd582[_0x010f('0x9')]!=_0x010f('0x19')){utils['info'](util['format'](_0x010f('0x1a'),_0x5dd582[_0x010f('0x8')],_0x5dd582[_0x010f('0x1b')],_0x5dd582[_0x010f('0x1c')]));channels[_0x5dd582[_0x010f('0x8')]]={'uniqueid':_0x5dd582[_0x010f('0x8')],'accountcode':_0x5dd582[_0x010f('0xe')],'source':_0x5dd582[_0x010f('0x1d')],'destination':_0x5dd582[_0x010f('0x1c')],'destinationcontext':_0x5dd582[_0x010f('0x1b')],'channel':_0x5dd582[_0x010f('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x010f('0x3'),'amaflags':_0x010f('0x1e')};}}catch(_0x36e0ac){utils[_0x010f('0x1f')](util[_0x010f('0x16')](_0x010f('0x17'),_0x5dd582[_0x010f('0x8')]),_0x36e0ac);}};exports[_0x010f('0x20')]=function(_0x1d5081){try{utils[_0x010f('0x15')](util[_0x010f('0x16')]('[%s][calls][newstate]',_0x1d5081['uniqueid']),_0x1d5081);if(!_[_0x010f('0x21')](channels[_0x1d5081[_0x010f('0x8')]])&&_0x1d5081[_0x010f('0x22')]==0x6){utils['info'](util[_0x010f('0x16')](_0x010f('0x23'),_0x1d5081[_0x010f('0x8')],_0x1d5081[_0x010f('0x1b')],_0x1d5081['channel']));if(_['isNil'](channels[_0x1d5081[_0x010f('0x8')]][_0x010f('0x24')])){channels[_0x1d5081[_0x010f('0x8')]][_0x010f('0x24')]=utils[_0x010f('0x25')]();}}else if(!_[_0x010f('0x21')](channels[_0x1d5081[_0x010f('0x18')]])&&_0x1d5081[_0x010f('0x22')]==0x6&&_0x1d5081[_0x010f('0x1b')]!=_0x010f('0x26')){utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x27'),_0x1d5081[_0x010f('0x8')],_0x1d5081[_0x010f('0x18')],_0x1d5081[_0x010f('0x1b')],_0x1d5081[_0x010f('0x9')]));channels[_0x1d5081[_0x010f('0x18')]][_0x010f('0xe')]=_0x1d5081[_0x010f('0xe')];channels[_0x1d5081['linkedid']][_0x010f('0x28')]=_0x1d5081[_0x010f('0x9')];if(_[_0x010f('0x21')](channels[_0x1d5081['linkedid']]['answertime'])){channels[_0x1d5081[_0x010f('0x18')]][_0x010f('0x29')]=utils['now']();}channels[_0x1d5081[_0x010f('0x18')]][_0x010f('0x2a')]=dispositions[_[_0x010f('0x2b')](_0x1d5081[_0x010f('0x22')])]||'ANSWERED';}}catch(_0x1b3c19){utils['error'](util[_0x010f('0x16')](_0x010f('0x2c'),_0x1d5081[_0x010f('0x8')]),_0x1b3c19);}};exports[_0x010f('0x2d')]=function(_0x25346b){try{if(!_[_0x010f('0x21')](channels[_0x25346b[_0x010f('0x8')]])){utils[_0x010f('0x15')](util[_0x010f('0x16')]('[%s][calls][hangup]',_0x25346b[_0x010f('0x8')]),_0x25346b);if(_[_0x010f('0x21')](channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x2e')])){channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x2e')]=_0x25346b[_0x010f('0x2f')]+'\x20<'+_0x25346b[_0x010f('0x1d')]+'>';}utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x30'),_0x25346b[_0x010f('0x8')],channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x2e')],_0x25346b[_0x010f('0x31')]));channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x32')]=utils[_0x010f('0x25')]();channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x33')]=utils[_0x010f('0x34')](channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x32')],channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x35')]);channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x36')]=channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x29')]?utils[_0x010f('0x34')](channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x32')],channels[_0x25346b[_0x010f('0x8')]][_0x010f('0x29')]):0x0;writeDB(channels[_0x25346b[_0x010f('0x8')]]);}}catch(_0x4ea96b){utils['error'](util['format'](_0x010f('0x37'),_0x25346b[_0x010f('0x8')]),_0x4ea96b);}};exports['attendedtransfer']=function(_0x1e22be){try{if(!_[_0x010f('0x21')](channels[_0x1e22be[_0x010f('0x38')]])){utils[_0x010f('0x15')](util[_0x010f('0x16')]('[%s][calls][attendedtransfer]',_0x1e22be[_0x010f('0x39')]),_0x1e22be);if(channels[_0x1e22be[_0x010f('0x38')]][_0x010f('0x9')]==_0x1e22be['transfereechannel']){utils[_0x010f('0x6')](util['format'](_0x010f('0x3a'),_0x1e22be['origtransfereruniqueid'],_0x1e22be['localtwolinkedid'],_0x1e22be['secondtransfererchannel']));channels[_0x1e22be['localtwolinkedid']][_0x010f('0x28')]=_0x1e22be[_0x010f('0x3b')];channels[_0x1e22be[_0x010f('0x38')]][_0x010f('0x3c')]=_0x010f('0x3d');}else if(channels[_0x1e22be[_0x010f('0x38')]][_0x010f('0x9')]=_0x1e22be['transfertargetchannel']){utils[_0x010f('0x6')](util[_0x010f('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1e22be[_0x010f('0x39')],_0x1e22be[_0x010f('0x38')],_0x1e22be['origtransfererchannel']));channels[_0x1e22be[_0x010f('0x38')]][_0x010f('0x28')]=_0x1e22be[_0x010f('0x3e')];channels[_0x1e22be[_0x010f('0x38')]][_0x010f('0x3c')]=_0x010f('0x3d');}}}catch(_0x1828ae){utils[_0x010f('0x1f')](util[_0x010f('0x16')](_0x010f('0x3f'),_0x1e22be[_0x010f('0x39')]),_0x1828ae);}};exports[_0x010f('0x40')]=function(_0x4b08ed){try{if(!_['isNil'](channels[_0x4b08ed['uniqueid']])){utils[_0x010f('0x15')](util[_0x010f('0x16')]('[%s][calls][musiconholdstart]',_0x4b08ed[_0x010f('0x8')]),_0x4b08ed);channels[_0x4b08ed[_0x010f('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x41'),_0x4b08ed['uniqueid'],channels[_0x4b08ed[_0x010f('0x8')]]['musiconholdstartAt']));}}catch(_0x45b0b8){utils[_0x010f('0x1f')](util[_0x010f('0x16')](_0x010f('0x42'),_0x4b08ed[_0x010f('0x8')]),_0x45b0b8);}};exports['musiconholdstop']=function(_0x17ac81){try{if(!_[_0x010f('0x21')](channels[_0x17ac81[_0x010f('0x8')]])){utils[_0x010f('0x15')](util[_0x010f('0x16')](_0x010f('0x43'),_0x17ac81[_0x010f('0x8')]),_0x17ac81);if(!_[_0x010f('0x21')](channels[_0x17ac81[_0x010f('0x8')]][_0x010f('0x44')])){channels[_0x17ac81[_0x010f('0x8')]][_0x010f('0x45')]+=utils[_0x010f('0x34')](utils['now'](),channels[_0x17ac81['uniqueid']][_0x010f('0x44')]);utils['info'](util[_0x010f('0x16')](_0x010f('0x46'),_0x17ac81[_0x010f('0x8')],channels[_0x17ac81['uniqueid']][_0x010f('0x45')]));delete channels[_0x17ac81[_0x010f('0x8')]][_0x010f('0x44')];}}}catch(_0x34bce7){utils['error'](util[_0x010f('0x16')](_0x010f('0x43'),_0x17ac81['uniqueid']),_0x34bce7);}};exports[_0x010f('0x47')]=function(_0x3c0d30){try{if(!_[_0x010f('0x21')](channels[_0x3c0d30[_0x010f('0x8')]])){utils['debug'](util['format'](_0x010f('0x48'),_0x3c0d30['uniqueid']),_0x3c0d30);if(!_[_0x010f('0x21')](_0x3c0d30['variable'][_0x010f('0x49')])){utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x4a'),_0x3c0d30['uniqueid'],_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x4c')]=_0x3c0d30[_0x010f('0x4b')];}if(!_[_0x010f('0x21')](_0x3c0d30[_0x010f('0x4d')][_0x010f('0x4e')])){utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x4f'),_0x3c0d30['uniqueid'],_0x3c0d30['value']));channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x50')]=_0x3c0d30[_0x010f('0x4b')];channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x2e')]='\x22'+_0x3c0d30[_0x010f('0x4b')]+_0x010f('0x51')+_0x3c0d30[_0x010f('0x4b')]+'>';}if(!_[_0x010f('0x21')](_0x3c0d30['variable'][_0x010f('0x52')])||!_[_0x010f('0x21')](_0x3c0d30[_0x010f('0x4d')][_0x010f('0x53')])){utils[_0x010f('0x6')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3c0d30[_0x010f('0x8')],!_[_0x010f('0x21')](_0x3c0d30[_0x010f('0x4d')][_0x010f('0x52')])?_0x010f('0x52'):'xmd-callerid',_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30['uniqueid']][_0x010f('0x2e')]=_0x3c0d30[_0x010f('0x4b')];}if(!_[_0x010f('0x21')](_0x3c0d30[_0x010f('0x4d')][_0x010f('0x54')])||!_[_0x010f('0x21')](_0x3c0d30['variable']['xmcs-queue'])){utils['info'](util[_0x010f('0x16')](_0x010f('0x55'),_0x3c0d30[_0x010f('0x8')],!_['isNil'](_0x3c0d30['variable'][_0x010f('0x54')])?_0x010f('0x54'):_0x010f('0x56'),_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x57')]=_0x010f('0x58');channels[_0x3c0d30['uniqueid']]['lastdata']=_0x3c0d30['value'];channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0xa')]=!![];}if(!_[_0x010f('0x21')](_0x3c0d30['variable'][_0x010f('0x59')])){utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x5a'),_0x3c0d30[_0x010f('0x8')],_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]]['ContactId']=_0x3c0d30[_0x010f('0x4b')];}if(!_[_0x010f('0x21')](_0x3c0d30[_0x010f('0x4d')][_0x010f('0x5b')])){utils['info'](util[_0x010f('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3c0d30[_0x010f('0x8')],_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x5c')]=_0x3c0d30[_0x010f('0x4b')];}if(!_[_0x010f('0x21')](_0x3c0d30['variable']['outboundrouteid'])){utils['info'](util[_0x010f('0x16')](_0x010f('0x5d'),_0x3c0d30['uniqueid'],_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]][_0x010f('0x5e')]=_0x3c0d30[_0x010f('0x4b')];}if(!_[_0x010f('0x21')](_0x3c0d30['variable'][_0x010f('0x5f')])){utils[_0x010f('0x6')](util[_0x010f('0x16')](_0x010f('0x60'),_0x3c0d30[_0x010f('0x8')],_0x3c0d30[_0x010f('0x4b')]));channels[_0x3c0d30[_0x010f('0x8')]]['sipcallid']=_0x3c0d30[_0x010f('0x4b')];}}}catch(_0x119410){utils['error'](util[_0x010f('0x16')](_0x010f('0x48'),_0x3c0d30['uniqueid']),_0x119410);}};exports['newexten']=function(_0x1d1ef7){try{if(!_['isNil'](channels[_0x1d1ef7[_0x010f('0x8')]])){utils['debug'](util['format'](_0x010f('0x61'),_0x1d1ef7[_0x010f('0x8')]),_0x1d1ef7);utils[_0x010f('0x6')](util['format'](_0x010f('0x62'),_0x1d1ef7[_0x010f('0x8')],_0x1d1ef7[_0x010f('0x63')],_0x1d1ef7[_0x010f('0x64')]));if(_0x1d1ef7[_0x010f('0x63')][_0x010f('0x65')]()==_0x010f('0x66')&&_['startsWith'](_0x1d1ef7['appdata']['toLowerCase'](),'cdr')){var _0x4953d5=_0x1d1ef7['appdata'][_0x010f('0x67')]('=');var _0x9d2042=_0x4953d5[0x0]['substring'](_0x4953d5[0x0]['lastIndexOf']('(')+0x1,_0x4953d5[0x0]['lastIndexOf'](')'));var _0x114da6=_0x4953d5[0x1];channels[_0x1d1ef7['uniqueid']][_0x9d2042]=_0x114da6;}if(!_[_0x010f('0x68')]([_0x010f('0x2d'),_0x010f('0x69'),'execif','set',_0x010f('0x6a')],_0x1d1ef7[_0x010f('0x63')][_0x010f('0x65')]())){channels[_0x1d1ef7['uniqueid']][_0x010f('0x57')]=_0x1d1ef7[_0x010f('0x63')];channels[_0x1d1ef7[_0x010f('0x8')]][_0x010f('0x6b')]=_0x1d1ef7[_0x010f('0x64')];}}}catch(_0x3edd64){utils[_0x010f('0x1f')](util[_0x010f('0x16')]('[%s][calls][newexten]',_0x1d1ef7[_0x010f('0x8')]),_0x3edd64);}}; \ No newline at end of file +var _0x4eeb=['cdr','split','substring','lastIndexOf','includes','noop','execif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','now','transfer','destinationchannel','answertime','disposition','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase'];(function(_0x3b4b28,_0x51ea5b){var _0x36ff81=function(_0x6da33a){while(--_0x6da33a){_0x3b4b28['push'](_0x3b4b28['shift']());}};_0x36ff81(++_0x51ea5b);}(_0x4eeb,0x6d));var _0xb4ee=function(_0x2083ff,_0x51cc42){_0x2083ff=_0x2083ff-0x0;var _0x2786e1=_0x4eeb[_0x2083ff];return _0x2786e1;};'use strict';var _=require(_0xb4ee('0x0'));var util=require(_0xb4ee('0x1'));var utils=require(_0xb4ee('0x2'));var dispositions=[_0xb4ee('0x3'),_0xb4ee('0x4'),_0xb4ee('0x4'),_0xb4ee('0x3'),_0xb4ee('0x3'),'NO\x20ANSWER','ANSWERED',_0xb4ee('0x5'),_0xb4ee('0x4'),_0xb4ee('0x4'),'FAILED'];var channels={};function writeDB(_0x9ca6b0){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x8'),_0x9ca6b0[_0xb4ee('0x9')],_0x9ca6b0[_0xb4ee('0xa')],_0x9ca6b0[_0xb4ee('0xb')],_0x9ca6b0[_0xb4ee('0xc')],_0x9ca6b0[_0xb4ee('0xd')],_0x9ca6b0[_0xb4ee('0xe')],_0x9ca6b0[_0xb4ee('0xf')],_0x9ca6b0['lastevent']));if(_0x9ca6b0[_0xb4ee('0x10')]){utils['getUserByInternal'](_0x9ca6b0['accountcode'])['then'](function(_0x19ca3f){if(_0x19ca3f){_0x9ca6b0['UserId']=_0x19ca3f['id'];}utils['request']('CreateVoiceCallReport',_0x9ca6b0);});}else{utils[_0xb4ee('0x11')]('CreateVoiceCallReport',_0x9ca6b0);}if(channels[_0x9ca6b0[_0xb4ee('0x9')]]){delete channels[_0x9ca6b0[_0xb4ee('0x9')]];}}exports[_0xb4ee('0x12')]=function(_0x52ba56){try{utils[_0xb4ee('0x13')](util[_0xb4ee('0x7')](_0xb4ee('0x14'),_0x52ba56[_0xb4ee('0x9')]),_0x52ba56);if(_0x52ba56[_0xb4ee('0x9')]==_0x52ba56[_0xb4ee('0x15')]&&_0x52ba56[_0xb4ee('0xa')]!=_0xb4ee('0x16')){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x52ba56[_0xb4ee('0x9')],_0x52ba56['context'],_0x52ba56['exten']));channels[_0x52ba56[_0xb4ee('0x9')]]={'uniqueid':_0x52ba56[_0xb4ee('0x9')],'accountcode':_0x52ba56[_0xb4ee('0x10')],'source':_0x52ba56[_0xb4ee('0xe')],'destination':_0x52ba56['exten'],'destinationcontext':_0x52ba56['context'],'channel':_0x52ba56[_0xb4ee('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x186fba){utils['error'](util[_0xb4ee('0x7')](_0xb4ee('0x14'),_0x52ba56[_0xb4ee('0x9')]),_0x186fba);}};exports[_0xb4ee('0x17')]=function(_0x35dedc){try{utils[_0xb4ee('0x13')](util['format'](_0xb4ee('0x18'),_0x35dedc[_0xb4ee('0x9')]),_0x35dedc);if(!_[_0xb4ee('0x19')](channels[_0x35dedc[_0xb4ee('0x9')]])&&_0x35dedc[_0xb4ee('0x1a')]==0x6){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x1b'),_0x35dedc[_0xb4ee('0x9')],_0x35dedc[_0xb4ee('0x1c')],_0x35dedc[_0xb4ee('0xa')]));if(_[_0xb4ee('0x19')](channels[_0x35dedc[_0xb4ee('0x9')]][_0xb4ee('0x1d')])){channels[_0x35dedc[_0xb4ee('0x9')]][_0xb4ee('0x1d')]=utils[_0xb4ee('0x1e')]();}}else if(!_['isNil'](channels[_0x35dedc[_0xb4ee('0x15')]])&&_0x35dedc['channelstate']==0x6&&_0x35dedc[_0xb4ee('0x1c')]!=_0xb4ee('0x1f')){utils[_0xb4ee('0x6')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x35dedc[_0xb4ee('0x9')],_0x35dedc[_0xb4ee('0x15')],_0x35dedc[_0xb4ee('0x1c')],_0x35dedc[_0xb4ee('0xa')]));channels[_0x35dedc[_0xb4ee('0x15')]][_0xb4ee('0x10')]=_0x35dedc[_0xb4ee('0x10')];channels[_0x35dedc['linkedid']][_0xb4ee('0x20')]=_0x35dedc['channel'];if(_['isNil'](channels[_0x35dedc['linkedid']]['answertime'])){channels[_0x35dedc[_0xb4ee('0x15')]][_0xb4ee('0x21')]=utils[_0xb4ee('0x1e')]();}channels[_0x35dedc[_0xb4ee('0x15')]][_0xb4ee('0x22')]=dispositions[_['toNumber'](_0x35dedc[_0xb4ee('0x1a')])]||_0xb4ee('0x23');}}catch(_0x11ec38){utils[_0xb4ee('0x24')](util['format'](_0xb4ee('0x18'),_0x35dedc[_0xb4ee('0x9')]),_0x11ec38);}};exports[_0xb4ee('0x25')]=function(_0x284463){try{if(!_[_0xb4ee('0x19')](channels[_0x284463[_0xb4ee('0x9')]])){utils['debug'](util[_0xb4ee('0x7')](_0xb4ee('0x26'),_0x284463[_0xb4ee('0x9')]),_0x284463);if(_[_0xb4ee('0x19')](channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x27')])){channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x27')]=_0x284463[_0xb4ee('0x28')]+'\x20<'+_0x284463[_0xb4ee('0xe')]+'>';}utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x29'),_0x284463['uniqueid'],channels[_0x284463['uniqueid']][_0xb4ee('0x27')],_0x284463[_0xb4ee('0x2a')]));channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x2b')]=utils[_0xb4ee('0x1e')]();channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x2c')]=utils[_0xb4ee('0x2d')](channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x2b')],channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x2e')]);channels[_0x284463[_0xb4ee('0x9')]]['billableseconds']=channels[_0x284463['uniqueid']]['answertime']?utils[_0xb4ee('0x2d')](channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x2b')],channels[_0x284463[_0xb4ee('0x9')]][_0xb4ee('0x21')]):0x0;writeDB(channels[_0x284463[_0xb4ee('0x9')]]);}}catch(_0x5d5ec1){utils[_0xb4ee('0x24')](util[_0xb4ee('0x7')]('[%s][calls][hangup]',_0x284463[_0xb4ee('0x9')]),_0x5d5ec1);}};exports[_0xb4ee('0x2f')]=function(_0x42eca6){try{if(!_[_0xb4ee('0x19')](channels[_0x42eca6[_0xb4ee('0x30')]])){utils['debug'](util['format'](_0xb4ee('0x31'),_0x42eca6[_0xb4ee('0x32')]),_0x42eca6);if(channels[_0x42eca6[_0xb4ee('0x30')]]['channel']==_0x42eca6[_0xb4ee('0x33')]){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x42eca6[_0xb4ee('0x32')],_0x42eca6[_0xb4ee('0x30')],_0x42eca6[_0xb4ee('0x34')]));channels[_0x42eca6['localtwolinkedid']][_0xb4ee('0x20')]=_0x42eca6['secondtransfererchannel'];channels[_0x42eca6[_0xb4ee('0x30')]]['userfield']=_0xb4ee('0x35');}else if(channels[_0x42eca6[_0xb4ee('0x30')]]['channel']=_0x42eca6[_0xb4ee('0x36')]){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x42eca6[_0xb4ee('0x32')],_0x42eca6['localtwolinkedid'],_0x42eca6[_0xb4ee('0x37')]));channels[_0x42eca6[_0xb4ee('0x30')]][_0xb4ee('0x20')]=_0x42eca6[_0xb4ee('0x37')];channels[_0x42eca6[_0xb4ee('0x30')]]['userfield']='_attended';}}}catch(_0x273552){utils['error'](util[_0xb4ee('0x7')](_0xb4ee('0x31'),_0x42eca6['origtransfereruniqueid']),_0x273552);}};exports['musiconholdstart']=function(_0x18e1fa){try{if(!_[_0xb4ee('0x19')](channels[_0x18e1fa[_0xb4ee('0x9')]])){utils[_0xb4ee('0x13')](util['format'](_0xb4ee('0x38'),_0x18e1fa[_0xb4ee('0x9')]),_0x18e1fa);channels[_0x18e1fa[_0xb4ee('0x9')]]['musiconholdstartAt']=utils[_0xb4ee('0x1e')]();utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x18e1fa[_0xb4ee('0x9')],channels[_0x18e1fa[_0xb4ee('0x9')]]['musiconholdstartAt']));}}catch(_0xe10c88){utils[_0xb4ee('0x24')](util[_0xb4ee('0x7')](_0xb4ee('0x38'),_0x18e1fa['uniqueid']),_0xe10c88);}};exports['musiconholdstop']=function(_0x57d120){try{if(!_[_0xb4ee('0x19')](channels[_0x57d120[_0xb4ee('0x9')]])){utils['debug'](util['format'](_0xb4ee('0x39'),_0x57d120[_0xb4ee('0x9')]),_0x57d120);if(!_[_0xb4ee('0x19')](channels[_0x57d120[_0xb4ee('0x9')]][_0xb4ee('0x3a')])){channels[_0x57d120[_0xb4ee('0x9')]][_0xb4ee('0x3b')]+=utils[_0xb4ee('0x2d')](utils[_0xb4ee('0x1e')](),channels[_0x57d120[_0xb4ee('0x9')]][_0xb4ee('0x3a')]);utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x3c'),_0x57d120['uniqueid'],channels[_0x57d120[_0xb4ee('0x9')]][_0xb4ee('0x3b')]));delete channels[_0x57d120['uniqueid']][_0xb4ee('0x3a')];}}}catch(_0x1a9402){utils[_0xb4ee('0x24')](util[_0xb4ee('0x7')](_0xb4ee('0x39'),_0x57d120['uniqueid']),_0x1a9402);}};exports[_0xb4ee('0x3d')]=function(_0x10555e){try{if(!_[_0xb4ee('0x19')](channels[_0x10555e[_0xb4ee('0x9')]])){utils[_0xb4ee('0x13')](util['format'](_0xb4ee('0x3e'),_0x10555e['uniqueid']),_0x10555e);if(!_[_0xb4ee('0x19')](_0x10555e[_0xb4ee('0x3f')]['xmd-originatecalleridnum'])){utils['info'](util[_0xb4ee('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x10555e['uniqueid'],_0x10555e[_0xb4ee('0x40')]));channels[_0x10555e['uniqueid']]['source']=_0x10555e[_0xb4ee('0x40')];}if(!_[_0xb4ee('0x19')](_0x10555e['variable'][_0xb4ee('0x41')])){utils['info'](util[_0xb4ee('0x7')](_0xb4ee('0x42'),_0x10555e[_0xb4ee('0x9')],_0x10555e['value']));channels[_0x10555e[_0xb4ee('0x9')]][_0xb4ee('0x43')]=_0x10555e[_0xb4ee('0x40')];channels[_0x10555e[_0xb4ee('0x9')]]['callerid']='\x22'+_0x10555e[_0xb4ee('0x40')]+_0xb4ee('0x44')+_0x10555e[_0xb4ee('0x40')]+'>';}if(!_['isNil'](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x45')])||!_['isNil'](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x46')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x47'),_0x10555e['uniqueid'],!_[_0xb4ee('0x19')](_0x10555e['variable'][_0xb4ee('0x45')])?_0xb4ee('0x45'):'xmd-callerid',_0x10555e[_0xb4ee('0x40')]));channels[_0x10555e[_0xb4ee('0x9')]][_0xb4ee('0x27')]=_0x10555e[_0xb4ee('0x40')];}if(!_['isNil'](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x48')])||!_['isNil'](_0x10555e['variable'][_0xb4ee('0x49')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x10555e['uniqueid'],!_[_0xb4ee('0x19')](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x48')])?'xmd-queue':_0xb4ee('0x49'),_0x10555e[_0xb4ee('0x40')]));channels[_0x10555e[_0xb4ee('0x9')]]['lastapplication']=_0xb4ee('0x4a');channels[_0x10555e['uniqueid']][_0xb4ee('0x4b')]=_0x10555e[_0xb4ee('0x40')];channels[_0x10555e[_0xb4ee('0x9')]][_0xb4ee('0xb')]=!![];}if(!_[_0xb4ee('0x19')](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x4c')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x4d'),_0x10555e['uniqueid'],_0x10555e[_0xb4ee('0x40')]));channels[_0x10555e[_0xb4ee('0x9')]]['ContactId']=_0x10555e[_0xb4ee('0x40')];}if(!_['isNil'](_0x10555e['variable'][_0xb4ee('0x4e')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x10555e[_0xb4ee('0x9')],_0x10555e['value']));channels[_0x10555e[_0xb4ee('0x9')]][_0xb4ee('0x4f')]=_0x10555e[_0xb4ee('0x40')];}if(!_[_0xb4ee('0x19')](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x50')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x51'),_0x10555e['uniqueid'],_0x10555e['value']));channels[_0x10555e['uniqueid']][_0xb4ee('0x52')]=_0x10555e[_0xb4ee('0x40')];}if(!_['isNil'](_0x10555e[_0xb4ee('0x3f')][_0xb4ee('0x53')])){utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x54'),_0x10555e['uniqueid'],_0x10555e[_0xb4ee('0x40')]));channels[_0x10555e[_0xb4ee('0x9')]][_0xb4ee('0x53')]=_0x10555e[_0xb4ee('0x40')];}}}catch(_0x27de58){utils[_0xb4ee('0x24')](util['format'](_0xb4ee('0x3e'),_0x10555e[_0xb4ee('0x9')]),_0x27de58);}};exports[_0xb4ee('0x55')]=function(_0x41f9ea){try{if(!_[_0xb4ee('0x19')](channels[_0x41f9ea['uniqueid']])){utils[_0xb4ee('0x13')](util[_0xb4ee('0x7')](_0xb4ee('0x56'),_0x41f9ea['uniqueid']),_0x41f9ea);utils[_0xb4ee('0x6')](util[_0xb4ee('0x7')](_0xb4ee('0x57'),_0x41f9ea[_0xb4ee('0x9')],_0x41f9ea[_0xb4ee('0x58')],_0x41f9ea['appdata']));if(_0x41f9ea['application']['toLowerCase']()==_0xb4ee('0x59')&&_[_0xb4ee('0x5a')](_0x41f9ea[_0xb4ee('0x5b')][_0xb4ee('0x5c')](),_0xb4ee('0x5d'))){var _0x13d3ea=_0x41f9ea[_0xb4ee('0x5b')][_0xb4ee('0x5e')]('=');var _0x2dab26=_0x13d3ea[0x0][_0xb4ee('0x5f')](_0x13d3ea[0x0][_0xb4ee('0x60')]('(')+0x1,_0x13d3ea[0x0]['lastIndexOf'](')'));var _0x5d26f8=_0x13d3ea[0x1];channels[_0x41f9ea[_0xb4ee('0x9')]][_0x2dab26]=_0x5d26f8;}if(!_[_0xb4ee('0x61')](['hangup',_0xb4ee('0x62'),_0xb4ee('0x63'),_0xb4ee('0x59'),'gotoif'],_0x41f9ea[_0xb4ee('0x58')][_0xb4ee('0x5c')]())){channels[_0x41f9ea[_0xb4ee('0x9')]][_0xb4ee('0x64')]=_0x41f9ea['application'];channels[_0x41f9ea[_0xb4ee('0x9')]][_0xb4ee('0x4b')]=_0x41f9ea['appdata'];}}}catch(_0x5c07d7){utils[_0xb4ee('0x24')](util[_0xb4ee('0x7')]('[%s][calls][newexten]',_0x41f9ea[_0xb4ee('0x9')]),_0x5c07d7);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c98b260..d05daa0 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 _0x3b40=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x56ac4f,_0x526971){var _0x5d28ea=function(_0x14f203){while(--_0x14f203){_0x56ac4f['push'](_0x56ac4f['shift']());}};_0x5d28ea(++_0x526971);}(_0x3b40,0x1e7));var _0x03b4=function(_0x17d621,_0x1cc002){_0x17d621=_0x17d621-0x0;var _0x2ccdcd=_0x3b40[_0x17d621];return _0x2ccdcd;};'use strict';var utils=require(_0x03b4('0x0'));exports[_0x03b4('0x1')]=function(){utils[_0x03b4('0x2')](_0x03b4('0x3'));};exports[_0x03b4('0x4')]=function(){utils[_0x03b4('0x2')](_0x03b4('0x5'));};exports[_0x03b4('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x03b4('0x7')]=function(_0x3ff05e){utils[_0x03b4('0x7')](_0x03b4('0x8'),_0x3ff05e);};exports[_0x03b4('0x9')]=function(){utils[_0x03b4('0x2')](_0x03b4('0xa'));};exports[_0x03b4('0xb')]=function(_0x47adcd){}; \ No newline at end of file +var _0x8ea3=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x2c9b1a,_0x14069a){var _0xfa50aa=function(_0x363882){while(--_0x363882){_0x2c9b1a['push'](_0x2c9b1a['shift']());}};_0xfa50aa(++_0x14069a);}(_0x8ea3,0x192));var _0x38ea=function(_0x5e2cc3,_0x13d2a5){_0x5e2cc3=_0x5e2cc3-0x0;var _0x5870a6=_0x8ea3[_0x5e2cc3];return _0x5870a6;};'use strict';var utils=require(_0x38ea('0x0'));exports[_0x38ea('0x1')]=function(){utils[_0x38ea('0x2')]('[core]\x20connected');};exports[_0x38ea('0x3')]=function(){utils[_0x38ea('0x2')](_0x38ea('0x4'));};exports[_0x38ea('0x5')]=function(){utils[_0x38ea('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x54a9e8){utils[_0x38ea('0x6')](_0x38ea('0x7'),_0x54a9e8);};exports[_0x38ea('0x8')]=function(){utils[_0x38ea('0x2')](_0x38ea('0x9'));};exports[_0x38ea('0xa')]=function(_0x2a2121){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d251fb0..09c52f3 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 _0x965a=['channel','dialstring','calleridnum','connectedlinenum','dialstatus','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x82e11f,_0x2e7e16){var _0x4ff9c5=function(_0x2f0649){while(--_0x2f0649){_0x82e11f['push'](_0x82e11f['shift']());}};_0x4ff9c5(++_0x2e7e16);}(_0x965a,0x1a1));var _0xa965=function(_0x3cd095,_0x12e7e5){_0x3cd095=_0x3cd095-0x0;var _0x239312=_0x965a[_0x3cd095];return _0x239312;};'use strict';var _=require(_0xa965('0x0'));var util=require(_0xa965('0x1'));var utils=require(_0xa965('0x2'));var dials={};function writeDB(_0x40b7f6){utils[_0xa965('0x3')](util[_0xa965('0x4')](_0xa965('0x5'),_0x40b7f6['uniqueid'],_0x40b7f6[_0xa965('0x6')],_0x40b7f6[_0xa965('0x7')],_0x40b7f6[_0xa965('0x8')],_0x40b7f6[_0xa965('0x9')],_0x40b7f6[_0xa965('0xa')]));utils['request']('CreateVoiceDialReport',_0x40b7f6);delete dials[_0x40b7f6[_0xa965('0xb')]];}exports['newexten']=function(_0x36794e){try{utils[_0xa965('0xc')](util[_0xa965('0x4')](_0xa965('0xd'),_0x36794e[_0xa965('0xb')]),_0x36794e);utils[_0xa965('0x3')](util[_0xa965('0x4')](_0xa965('0xe'),_0x36794e[_0xa965('0xb')],_0x36794e['application'],_0x36794e[_0xa965('0xf')]));if(_0x36794e[_0xa965('0x10')][_0xa965('0x11')]()==_0xa965('0x12')&&_[_0xa965('0x13')](_0x36794e[_0xa965('0xf')][_0xa965('0x11')](),_0xa965('0x14'))){var _0xda082b=_0x36794e['appdata']['split']('=');dials[_0x36794e['uniqueid']]={'routeId':_0xda082b[0x1]};}}catch(_0x3b51f7){utils[_0xa965('0x15')](util[_0xa965('0x4')]('[%s][dials][newexten]',_0x36794e[_0xa965('0xb')]),_0x3b51f7);}};exports[_0xa965('0x16')]=function(_0x5abbc6){try{utils[_0xa965('0xc')](util[_0xa965('0x4')](_0xa965('0x17'),_0x5abbc6[_0xa965('0xb')]),_0x5abbc6);if(!_[_0xa965('0x18')](_0x5abbc6['variable'][_0xa965('0x19')])){utils[_0xa965('0x3')](util[_0xa965('0x4')](_0xa965('0x1a'),_0x5abbc6[_0xa965('0xb')],_0x5abbc6[_0xa965('0x1b')]));dials[_0x5abbc6[_0xa965('0xb')]]={'routeId':_0x5abbc6[_0xa965('0x1b')]};}}catch(_0x3e1077){utils['error'](util[_0xa965('0x4')](_0xa965('0x17'),_0x5abbc6[_0xa965('0xb')]),_0x3e1077);}};exports[_0xa965('0x1c')]=function(_0x4a7d19){try{if(!_[_0xa965('0x18')](dials[_0x4a7d19['uniqueid']])){utils[_0xa965('0xc')](util[_0xa965('0x4')](_0xa965('0x1d'),_0x4a7d19[_0xa965('0xb')]),_0x4a7d19);dials[_0x4a7d19['uniqueid']]=_['assign'](dials[_0x4a7d19[_0xa965('0xb')]],_0x4a7d19);dials[_0x4a7d19['uniqueid']]['starttime']=utils[_0xa965('0x1e')]();dials[_0x4a7d19['uniqueid']][_0xa965('0x1f')]=_0xa965('0x20');utils[_0xa965('0x3')](util[_0xa965('0x4')](_0xa965('0x21'),_0x4a7d19['uniqueid'],dials[_0x4a7d19['uniqueid']][_0xa965('0x22')]));}}catch(_0x33e55b){utils[_0xa965('0x15')](util['format'](_0xa965('0x1d'),_0x4a7d19[_0xa965('0xb')]),_0x33e55b);}};exports['dialend']=function(_0x518025){try{if(!_[_0xa965('0x18')](dials[_0x518025[_0xa965('0xb')]])){utils[_0xa965('0xc')](util[_0xa965('0x4')](_0xa965('0x23'),_0x518025[_0xa965('0xb')]),_0x518025);dials[_0x518025[_0xa965('0xb')]][_0xa965('0xa')]=_0x518025[_0xa965('0xa')];if(_0x518025[_0xa965('0xa')]==_0xa965('0x24')){dials[_0x518025['uniqueid']]=_['assign'](dials[_0x518025['uniqueid']],_0x518025);dials[_0x518025[_0xa965('0xb')]][_0xa965('0x25')]=utils[_0xa965('0x1e')]();dials[_0x518025['uniqueid']][_0xa965('0x1f')]=_0xa965('0x26');utils[_0xa965('0x3')](util[_0xa965('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x518025[_0xa965('0xb')],_0x518025['dialstatus'],dials[_0x518025[_0xa965('0xb')]]['answertime']));}else{utils['info'](util[_0xa965('0x4')](_0xa965('0x27'),_0x518025[_0xa965('0xb')],_0x518025['dialstatus']));}}}catch(_0x1516b0){utils[_0xa965('0x15')](util[_0xa965('0x4')](_0xa965('0x23'),_0x518025['uniqueid']),_0x1516b0);}};exports['hangup']=function(_0x3ec529){try{if(!_[_0xa965('0x18')](dials[_0x3ec529['uniqueid']])){utils[_0xa965('0xc')](util[_0xa965('0x4')](_0xa965('0x28'),_0x3ec529[_0xa965('0xb')]),_0x3ec529);utils['info'](util['format'](_0xa965('0x29'),_0x3ec529[_0xa965('0xb')],_0x3ec529[_0xa965('0x8')],_0x3ec529['calleridname'],_0x3ec529[_0xa965('0x2a')]));dials[_0x3ec529['uniqueid']]=_['assign'](dials[_0x3ec529[_0xa965('0xb')]],{'endtime':utils[_0xa965('0x1e')](),'lastevent':'complete'});dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x2b')]=utils['diffTime'](dials[_0x3ec529['uniqueid']]['endtime'],dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x22')]);dials[_0x3ec529['uniqueid']]['holdtime']=utils[_0xa965('0x2c')](dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x25')]||dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x2d')],dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x22')]);dials[_0x3ec529['uniqueid']][_0xa965('0x2e')]=dials[_0x3ec529['uniqueid']]['answertime']?utils['diffTime'](dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x2d')],dials[_0x3ec529[_0xa965('0xb')]][_0xa965('0x25')]):0x0;writeDB(dials[_0x3ec529[_0xa965('0xb')]]);}}catch(_0x53a62c){utils[_0xa965('0x15')](util[_0xa965('0x4')](_0xa965('0x28'),_0x3ec529[_0xa965('0xb')]),_0x53a62c);}}; \ No newline at end of file +var _0x4efa=['[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','application','toLowerCase','set','cdr(routeid)','appdata','split','error','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect'];(function(_0x383dab,_0x3ab3af){var _0xf2416d=function(_0x2710d2){while(--_0x2710d2){_0x383dab['push'](_0x383dab['shift']());}};_0xf2416d(++_0x3ab3af);}(_0x4efa,0xd4));var _0xa4ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4efa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa4ef('0x0'));var utils=require(_0xa4ef('0x1'));var dials={};function writeDB(_0x22dead){utils[_0xa4ef('0x2')](util[_0xa4ef('0x3')](_0xa4ef('0x4'),_0x22dead['uniqueid'],_0x22dead[_0xa4ef('0x5')],_0x22dead[_0xa4ef('0x6')],_0x22dead[_0xa4ef('0x7')],_0x22dead[_0xa4ef('0x8')],_0x22dead[_0xa4ef('0x9')]));utils[_0xa4ef('0xa')](_0xa4ef('0xb'),_0x22dead);delete dials[_0x22dead[_0xa4ef('0xc')]];}exports['newexten']=function(_0x5a3fa5){try{utils[_0xa4ef('0xd')](util[_0xa4ef('0x3')]('[%s][dials][newexten]',_0x5a3fa5[_0xa4ef('0xc')]),_0x5a3fa5);utils[_0xa4ef('0x2')](util[_0xa4ef('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5a3fa5[_0xa4ef('0xc')],_0x5a3fa5[_0xa4ef('0xe')],_0x5a3fa5['appdata']));if(_0x5a3fa5[_0xa4ef('0xe')][_0xa4ef('0xf')]()==_0xa4ef('0x10')&&_['startsWith'](_0x5a3fa5['appdata'][_0xa4ef('0xf')](),_0xa4ef('0x11'))){var _0x22a1b4=_0x5a3fa5[_0xa4ef('0x12')][_0xa4ef('0x13')]('=');dials[_0x5a3fa5[_0xa4ef('0xc')]]={'routeId':_0x22a1b4[0x1]};}}catch(_0x4cc397){utils[_0xa4ef('0x14')](util[_0xa4ef('0x3')]('[%s][dials][newexten]',_0x5a3fa5[_0xa4ef('0xc')]),_0x4cc397);}};exports['varset']=function(_0x4ba8e0){try{utils[_0xa4ef('0xd')](util[_0xa4ef('0x3')]('[%s][dials][varset]',_0x4ba8e0['uniqueid']),_0x4ba8e0);if(!_[_0xa4ef('0x15')](_0x4ba8e0['variable'][_0xa4ef('0x16')])){utils[_0xa4ef('0x2')](util['format'](_0xa4ef('0x17'),_0x4ba8e0[_0xa4ef('0xc')],_0x4ba8e0['value']));dials[_0x4ba8e0['uniqueid']]={'routeId':_0x4ba8e0[_0xa4ef('0x18')]};}}catch(_0x4cc63c){utils['error'](util['format'](_0xa4ef('0x19'),_0x4ba8e0[_0xa4ef('0xc')]),_0x4cc63c);}};exports[_0xa4ef('0x1a')]=function(_0x5e2b68){try{if(!_['isNil'](dials[_0x5e2b68[_0xa4ef('0xc')]])){utils[_0xa4ef('0xd')](util[_0xa4ef('0x3')](_0xa4ef('0x1b'),_0x5e2b68[_0xa4ef('0xc')]),_0x5e2b68);dials[_0x5e2b68[_0xa4ef('0xc')]]=_[_0xa4ef('0x1c')](dials[_0x5e2b68['uniqueid']],_0x5e2b68);dials[_0x5e2b68[_0xa4ef('0xc')]]['starttime']=utils[_0xa4ef('0x1d')]();dials[_0x5e2b68[_0xa4ef('0xc')]][_0xa4ef('0x1e')]=_0xa4ef('0x1f');utils['info'](util[_0xa4ef('0x3')](_0xa4ef('0x20'),_0x5e2b68['uniqueid'],dials[_0x5e2b68[_0xa4ef('0xc')]]['starttime']));}}catch(_0x5360b0){utils[_0xa4ef('0x14')](util[_0xa4ef('0x3')]('[%s][dials][dialbegin]',_0x5e2b68['uniqueid']),_0x5360b0);}};exports[_0xa4ef('0x21')]=function(_0x594cde){try{if(!_['isNil'](dials[_0x594cde[_0xa4ef('0xc')]])){utils['debug'](util[_0xa4ef('0x3')](_0xa4ef('0x22'),_0x594cde[_0xa4ef('0xc')]),_0x594cde);dials[_0x594cde[_0xa4ef('0xc')]][_0xa4ef('0x9')]=_0x594cde['dialstatus'];if(_0x594cde['dialstatus']==_0xa4ef('0x23')){dials[_0x594cde[_0xa4ef('0xc')]]=_['assign'](dials[_0x594cde[_0xa4ef('0xc')]],_0x594cde);dials[_0x594cde[_0xa4ef('0xc')]][_0xa4ef('0x24')]=utils[_0xa4ef('0x1d')]();dials[_0x594cde['uniqueid']][_0xa4ef('0x1e')]='connect';utils[_0xa4ef('0x2')](util[_0xa4ef('0x3')](_0xa4ef('0x25'),_0x594cde[_0xa4ef('0xc')],_0x594cde[_0xa4ef('0x9')],dials[_0x594cde['uniqueid']][_0xa4ef('0x24')]));}else{utils[_0xa4ef('0x2')](util[_0xa4ef('0x3')](_0xa4ef('0x26'),_0x594cde[_0xa4ef('0xc')],_0x594cde[_0xa4ef('0x9')]));}}}catch(_0x3a7a8e){utils[_0xa4ef('0x14')](util[_0xa4ef('0x3')](_0xa4ef('0x22'),_0x594cde[_0xa4ef('0xc')]),_0x3a7a8e);}};exports[_0xa4ef('0x27')]=function(_0x796cf1){try{if(!_[_0xa4ef('0x15')](dials[_0x796cf1[_0xa4ef('0xc')]])){utils[_0xa4ef('0xd')](util[_0xa4ef('0x3')](_0xa4ef('0x28'),_0x796cf1['uniqueid']),_0x796cf1);utils['info'](util[_0xa4ef('0x3')](_0xa4ef('0x29'),_0x796cf1[_0xa4ef('0xc')],_0x796cf1['calleridnum'],_0x796cf1['calleridname'],_0x796cf1[_0xa4ef('0x2a')]));dials[_0x796cf1[_0xa4ef('0xc')]]=_[_0xa4ef('0x1c')](dials[_0x796cf1[_0xa4ef('0xc')]],{'endtime':utils['now'](),'lastevent':_0xa4ef('0x2b')});dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2c')]=utils[_0xa4ef('0x2d')](dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2e')],dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2f')]);dials[_0x796cf1['uniqueid']][_0xa4ef('0x30')]=utils[_0xa4ef('0x2d')](dials[_0x796cf1['uniqueid']]['answertime']||dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2e')],dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2f')]);dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x31')]=dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x24')]?utils['diffTime'](dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x2e')],dials[_0x796cf1[_0xa4ef('0xc')]][_0xa4ef('0x24')]):0x0;writeDB(dials[_0x796cf1[_0xa4ef('0xc')]]);}}catch(_0x111834){utils[_0xa4ef('0x14')](util['format'](_0xa4ef('0x28'),_0x796cf1[_0xa4ef('0xc')]),_0x111834);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ff70623..5293068 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 _0xfd17=['xdr','disabled','env','production','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','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]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util'];(function(_0x357b6b,_0x4e40e8){var _0x51c6bb=function(_0x3aab68){while(--_0x3aab68){_0x357b6b['push'](_0x357b6b['shift']());}};_0x51c6bb(++_0x4e40e8);}(_0xfd17,0x118));var _0x7fd1=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0xfd17[_0x22d1ef];return _0x47c5a3;};var AsteriskManager=require(_0x7fd1('0x0'));var config=require(_0x7fd1('0x1'));var utils=require(_0x7fd1('0x2'));var util=require(_0x7fd1('0x3'));var isXDREnabled=config['xdr']&&config['xdr']['disabled']?!config[_0x7fd1('0x4')][_0x7fd1('0x5')]:!![];var isProduction=config[_0x7fd1('0x6')]===_0x7fd1('0x7')||![];var isLocalAsterisk=config[_0x7fd1('0x4')]&&config[_0x7fd1('0x4')][_0x7fd1('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x7fd1('0x9')][_0x7fd1('0xa')],config['asterisk']['ip'],config[_0x7fd1('0x9')]['username'],config[_0x7fd1('0x9')][_0x7fd1('0xb')],!![]);ami[_0x7fd1('0xc')]();if(!isXDREnabled){utils['info'](_0x7fd1('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x7fd1('0xe')](_0x7fd1('0xf'));}else{var agents=require(_0x7fd1('0x10'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x7fd1('0x11'));var members=require(_0x7fd1('0x12'));var dials=require(_0x7fd1('0x13'));var transfers=require('./transfers.controller');var core=require(_0x7fd1('0x14'));ami['on'](_0x7fd1('0x15'),core['connect']);ami['on'](_0x7fd1('0x16'),core['shutdown']);ami['on'](_0x7fd1('0x17'),core[_0x7fd1('0x17')]);ami['on'](_0x7fd1('0x18'),core['error']);ami['on']('close',core[_0x7fd1('0x19')]);ami['on'](_0x7fd1('0x1a'),core[_0x7fd1('0x1a')]);ami['on'](_0x7fd1('0x1b'),function(_0x4c1d4f){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x1e'),_0x4c1d4f['device']),_0x4c1d4f);members['devicestatechange'](_0x4c1d4f);}catch(_0x488ba6){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x1e'),_0x4c1d4f[_0x7fd1('0x1f')]),_0x488ba6);}});ami['on']('agentcalled',function(_0x55a220){try{utils[_0x7fd1('0x1c')](util['format'](_0x7fd1('0x20'),_0x55a220[_0x7fd1('0x21')]),_0x55a220);agents[_0x7fd1('0x22')](_0x55a220);}catch(_0x19d65b){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x20'),_0x55a220['uniqueid']),_0x19d65b);}});ami['on'](_0x7fd1('0x23'),function(_0x579898){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x24'),_0x579898[_0x7fd1('0x21')]),_0x579898);agents[_0x7fd1('0x23')](_0x579898);}catch(_0x283316){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')]('[%s][index][agentringnoanswer]',_0x579898[_0x7fd1('0x21')]),_0x283316);}});ami['on'](_0x7fd1('0x25'),function(_0x2d02d0){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x26'),_0x2d02d0['uniqueid']),_0x2d02d0);agents[_0x7fd1('0x25')](_0x2d02d0);queues[_0x7fd1('0x25')](_0x2d02d0);}catch(_0x485661){utils[_0x7fd1('0x18')](util['format'](_0x7fd1('0x26'),_0x2d02d0[_0x7fd1('0x21')]),_0x485661);}});ami['on'](_0x7fd1('0x27'),function(_0x5c36ab){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')]('[%s][index][agentcomplete]',_0x5c36ab[_0x7fd1('0x21')]),_0x5c36ab);agents['agentcomplete'](_0x5c36ab);queues[_0x7fd1('0x27')](_0x5c36ab);members[_0x7fd1('0x27')](_0x5c36ab);}catch(_0x17d0c1){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')]('[%s][index][agentcomplete]',_0x5c36ab['uniqueid']),_0x17d0c1);}});ami['on']('queuecallerabandon',function(_0x439d3e){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x28'),_0x439d3e[_0x7fd1('0x21')]),_0x439d3e);agents['queuecallerabandon'](_0x439d3e);queues[_0x7fd1('0x29')](_0x439d3e);}catch(_0x1e7710){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x28'),_0x439d3e[_0x7fd1('0x21')]),_0x1e7710);}});ami['on'](_0x7fd1('0x2a'),function(_0x561f97){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x2b'),_0x561f97[_0x7fd1('0x21')]),_0x561f97);queues[_0x7fd1('0x2a')](_0x561f97);recordings[_0x7fd1('0x2a')](_0x561f97);}catch(_0x112e05){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x2b'),_0x561f97[_0x7fd1('0x21')]),_0x112e05);}});ami['on']('queuecallerleave',function(_0x1b2b7e){try{utils[_0x7fd1('0x1c')](util['format'](_0x7fd1('0x2c'),_0x1b2b7e['uniqueid']),_0x1b2b7e);queues['queuecallerleave'](_0x1b2b7e);}catch(_0x2b7fdb){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x2c'),_0x1b2b7e[_0x7fd1('0x21')]),_0x2b7fdb);}});ami['on']('musiconholdstart',function(_0x26215a){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x2d'),_0x26215a[_0x7fd1('0x21')]),_0x26215a);queues['musiconholdstart'](_0x26215a);calls[_0x7fd1('0x2e')](_0x26215a);}catch(_0x65e130){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x2d'),_0x26215a['uniqueid']),_0x65e130);}});ami['on'](_0x7fd1('0x2f'),function(_0x2e892e){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')]('[%s][index][musiconholdstop]',_0x2e892e[_0x7fd1('0x21')]),_0x2e892e);queues['musiconholdstop'](_0x2e892e);calls[_0x7fd1('0x2f')](_0x2e892e);}catch(_0x2a1d9c){utils[_0x7fd1('0x18')](util['format'](_0x7fd1('0x30'),_0x2e892e['uniqueid']),_0x2a1d9c);}});ami['on']('newstate',function(_0x5bc01e){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x31'),_0x5bc01e[_0x7fd1('0x21')]),_0x5bc01e);calls[_0x7fd1('0x32')](_0x5bc01e);recordings[_0x7fd1('0x32')](_0x5bc01e);}catch(_0x342d1c){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x31'),_0x5bc01e['uniqueid']),_0x342d1c);}});ami['on'](_0x7fd1('0x33'),function(_0x4c0e93){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x34'),_0x4c0e93[_0x7fd1('0x21')]),_0x4c0e93);calls[_0x7fd1('0x33')](_0x4c0e93);recordings[_0x7fd1('0x33')](_0x4c0e93);dials[_0x7fd1('0x33')](_0x4c0e93);agents[_0x7fd1('0x33')](_0x4c0e93);queues[_0x7fd1('0x33')](_0x4c0e93);}catch(_0x145731){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')]('[%s][index][hangup]',_0x4c0e93[_0x7fd1('0x21')]),_0x145731);}});ami['on'](_0x7fd1('0x35'),function(_0x5782d8){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x36'),_0x5782d8[_0x7fd1('0x21')]),_0x5782d8);members[_0x7fd1('0x35')](_0x5782d8);}catch(_0x1284a8){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x36'),_0x5782d8[_0x7fd1('0x21')]),_0x1284a8);}});ami['on']('blindtransfer',function(_0x1ca24e){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x37'),_0x1ca24e['uniqueid']),_0x1ca24e);queues[_0x7fd1('0x38')](_0x1ca24e);agents[_0x7fd1('0x38')](_0x1ca24e);transfers['blindtransfer'](_0x1ca24e);}catch(_0xb60605){utils['error'](util[_0x7fd1('0x1d')](_0x7fd1('0x37'),_0x1ca24e['uniqueid']),_0xb60605);}});ami['on'](_0x7fd1('0x39'),function(_0x3355a4){try{utils[_0x7fd1('0x1c')](util['format'](_0x7fd1('0x3a'),_0x3355a4[_0x7fd1('0x3b')]),_0x3355a4);queues['attendedtransfer'](_0x3355a4);transfers[_0x7fd1('0x39')](_0x3355a4);agents[_0x7fd1('0x39')](_0x3355a4);calls[_0x7fd1('0x39')](_0x3355a4);}catch(_0x1fe5b5){utils['error'](util[_0x7fd1('0x1d')]('[%s][index][attendedtransfer]',_0x3355a4[_0x7fd1('0x3b')]),_0x1fe5b5);}});ami['on'](_0x7fd1('0x3c'),function(_0x554c17){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x3d'),_0x554c17[_0x7fd1('0x21')]),_0x554c17);queues[_0x7fd1('0x3c')](_0x554c17);recordings[_0x7fd1('0x3c')](_0x554c17);calls[_0x7fd1('0x3c')](_0x554c17);dials[_0x7fd1('0x3c')](_0x554c17);}catch(_0x27a987){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')]('[%s][index][varset]',_0x554c17[_0x7fd1('0x21')]),_0x27a987);}});ami['on'](_0x7fd1('0x3e'),function(_0x2232c7){try{utils['debug'](util[_0x7fd1('0x1d')](_0x7fd1('0x3f'),_0x2232c7[_0x7fd1('0x21')]),_0x2232c7);calls[_0x7fd1('0x3e')](_0x2232c7);recordings[_0x7fd1('0x3e')](_0x2232c7);dials[_0x7fd1('0x3e')](_0x2232c7);}catch(_0xcd7d6){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x3f'),_0x2232c7[_0x7fd1('0x21')]),_0xcd7d6);}});ami['on'](_0x7fd1('0x40'),function(_0x302686){try{utils[_0x7fd1('0x1c')](util['format'](_0x7fd1('0x41'),_0x302686[_0x7fd1('0x21')]),_0x302686);calls['newchannel'](_0x302686);recordings[_0x7fd1('0x40')](_0x302686);}catch(_0x38a55c){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x41'),_0x302686[_0x7fd1('0x21')]),_0x38a55c);}});ami['on'](_0x7fd1('0x42'),function(_0x549294){try{utils[_0x7fd1('0x1c')](util[_0x7fd1('0x1d')](_0x7fd1('0x43'),_0x549294[_0x7fd1('0x21')]),_0x549294);dials[_0x7fd1('0x42')](_0x549294);}catch(_0x80c38){utils[_0x7fd1('0x18')](util[_0x7fd1('0x1d')](_0x7fd1('0x44'),_0x549294[_0x7fd1('0x21')]),_0x80c38);}});ami['on'](_0x7fd1('0x45'),function(_0x36fd3){try{utils[_0x7fd1('0x1c')](util['format'](_0x7fd1('0x46'),_0x36fd3[_0x7fd1('0x21')]),_0x36fd3);dials['dialend'](_0x36fd3);}catch(_0x5ed28e){utils['error'](util[_0x7fd1('0x1d')](_0x7fd1('0x46'),_0x36fd3[_0x7fd1('0x21')]),_0x5ed28e);}});} \ No newline at end of file +var _0x0ce9=['agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','[%s][index][cdr]','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]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','asterisk','username','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','[%s][index][devicestatechange]','device','agentcalled','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x0ce9,0xe2));var _0x90ce=function(_0xa33994,_0xc9e10d){_0xa33994=_0xa33994-0x0;var _0x4b8bbf=_0x0ce9[_0xa33994];return _0x4b8bbf;};var AsteriskManager=require(_0x90ce('0x0'));var config=require(_0x90ce('0x1'));var utils=require(_0x90ce('0x2'));var util=require(_0x90ce('0x3'));var isXDREnabled=config[_0x90ce('0x4')]&&config[_0x90ce('0x4')][_0x90ce('0x5')]?!config[_0x90ce('0x4')][_0x90ce('0x5')]:!![];var isProduction=config['env']===_0x90ce('0x6')||![];var isLocalAsterisk=config[_0x90ce('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x90ce('0x7')]['port'],config[_0x90ce('0x7')]['ip'],config[_0x90ce('0x7')][_0x90ce('0x8')],config[_0x90ce('0x7')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x90ce('0x9')](_0x90ce('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x90ce('0xb'));var queues=require(_0x90ce('0xc'));var recordings=require(_0x90ce('0xd'));var members=require('./members.controller');var dials=require(_0x90ce('0xe'));var transfers=require(_0x90ce('0xf'));var core=require(_0x90ce('0x10'));ami['on']('connect',core[_0x90ce('0x11')]);ami['on'](_0x90ce('0x12'),core['shutdown']);ami['on']('fullybooted',core[_0x90ce('0x13')]);ami['on'](_0x90ce('0x14'),core[_0x90ce('0x14')]);ami['on'](_0x90ce('0x15'),core[_0x90ce('0x15')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x90ce('0x16'),function(_0x2cb392){try{utils[_0x90ce('0x17')](util['format'](_0x90ce('0x18'),_0x2cb392[_0x90ce('0x19')]),_0x2cb392);members[_0x90ce('0x16')](_0x2cb392);}catch(_0x964652){utils[_0x90ce('0x14')](util['format'](_0x90ce('0x18'),_0x2cb392[_0x90ce('0x19')]),_0x964652);}});ami['on'](_0x90ce('0x1a'),function(_0x3cee32){try{utils['debug'](util[_0x90ce('0x1b')](_0x90ce('0x1c'),_0x3cee32[_0x90ce('0x1d')]),_0x3cee32);agents[_0x90ce('0x1a')](_0x3cee32);}catch(_0x515ac4){utils['error'](util[_0x90ce('0x1b')](_0x90ce('0x1c'),_0x3cee32[_0x90ce('0x1d')]),_0x515ac4);}});ami['on'](_0x90ce('0x1e'),function(_0x34aa22){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x1f'),_0x34aa22['uniqueid']),_0x34aa22);agents[_0x90ce('0x1e')](_0x34aa22);}catch(_0x10d1de){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x1f'),_0x34aa22['uniqueid']),_0x10d1de);}});ami['on']('agentconnect',function(_0x32a2fb){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x20'),_0x32a2fb[_0x90ce('0x1d')]),_0x32a2fb);agents[_0x90ce('0x21')](_0x32a2fb);queues['agentconnect'](_0x32a2fb);}catch(_0xe948e6){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x20'),_0x32a2fb[_0x90ce('0x1d')]),_0xe948e6);}});ami['on'](_0x90ce('0x22'),function(_0x4db6e6){try{utils['debug'](util['format']('[%s][index][agentcomplete]',_0x4db6e6[_0x90ce('0x1d')]),_0x4db6e6);agents[_0x90ce('0x22')](_0x4db6e6);queues[_0x90ce('0x22')](_0x4db6e6);members[_0x90ce('0x22')](_0x4db6e6);}catch(_0x18bc52){utils[_0x90ce('0x14')](util['format']('[%s][index][agentcomplete]',_0x4db6e6[_0x90ce('0x1d')]),_0x18bc52);}});ami['on'](_0x90ce('0x23'),function(_0x5364b0){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')]('[%s][index][queuecallerabandon]',_0x5364b0[_0x90ce('0x1d')]),_0x5364b0);agents[_0x90ce('0x23')](_0x5364b0);queues['queuecallerabandon'](_0x5364b0);}catch(_0x2c290a){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x24'),_0x5364b0[_0x90ce('0x1d')]),_0x2c290a);}});ami['on'](_0x90ce('0x25'),function(_0x5c0d9f){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x26'),_0x5c0d9f[_0x90ce('0x1d')]),_0x5c0d9f);queues[_0x90ce('0x25')](_0x5c0d9f);recordings[_0x90ce('0x25')](_0x5c0d9f);}catch(_0x36d056){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x26'),_0x5c0d9f[_0x90ce('0x1d')]),_0x36d056);}});ami['on'](_0x90ce('0x27'),function(_0x191916){try{utils[_0x90ce('0x17')](util['format'](_0x90ce('0x28'),_0x191916[_0x90ce('0x1d')]),_0x191916);queues['queuecallerleave'](_0x191916);}catch(_0x174ecf){utils[_0x90ce('0x14')](util['format'](_0x90ce('0x28'),_0x191916['uniqueid']),_0x174ecf);}});ami['on'](_0x90ce('0x29'),function(_0x45a431){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')]('[%s][index][musiconholdstart]',_0x45a431[_0x90ce('0x1d')]),_0x45a431);queues[_0x90ce('0x29')](_0x45a431);calls['musiconholdstart'](_0x45a431);}catch(_0x1a5c41){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')]('[%s][index][musiconholdstart]',_0x45a431[_0x90ce('0x1d')]),_0x1a5c41);}});ami['on']('musiconholdstop',function(_0x1e7ff2){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')]('[%s][index][musiconholdstop]',_0x1e7ff2[_0x90ce('0x1d')]),_0x1e7ff2);queues[_0x90ce('0x2a')](_0x1e7ff2);calls[_0x90ce('0x2a')](_0x1e7ff2);}catch(_0x5b0dbc){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')]('[%s][index][musiconholdstop]',_0x1e7ff2['uniqueid']),_0x5b0dbc);}});ami['on'](_0x90ce('0x2b'),function(_0x566c21){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')]('[%s][index][newstate]',_0x566c21['uniqueid']),_0x566c21);calls[_0x90ce('0x2b')](_0x566c21);recordings[_0x90ce('0x2b')](_0x566c21);}catch(_0x47f607){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x2c'),_0x566c21['uniqueid']),_0x47f607);}});ami['on']('hangup',function(_0x3b4c0d){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x2d'),_0x3b4c0d[_0x90ce('0x1d')]),_0x3b4c0d);calls[_0x90ce('0x2e')](_0x3b4c0d);recordings[_0x90ce('0x2e')](_0x3b4c0d);dials['hangup'](_0x3b4c0d);agents['hangup'](_0x3b4c0d);queues[_0x90ce('0x2e')](_0x3b4c0d);}catch(_0x12d441){utils[_0x90ce('0x14')](util['format'](_0x90ce('0x2d'),_0x3b4c0d['uniqueid']),_0x12d441);}});ami['on']('cdr',function(_0x2f489b){try{utils['debug'](util['format'](_0x90ce('0x2f'),_0x2f489b[_0x90ce('0x1d')]),_0x2f489b);members[_0x90ce('0x30')](_0x2f489b);}catch(_0x395554){utils['error'](util[_0x90ce('0x1b')](_0x90ce('0x2f'),_0x2f489b[_0x90ce('0x1d')]),_0x395554);}});ami['on']('blindtransfer',function(_0x267f7a){try{utils[_0x90ce('0x17')](util['format'](_0x90ce('0x31'),_0x267f7a[_0x90ce('0x1d')]),_0x267f7a);queues['blindtransfer'](_0x267f7a);agents['blindtransfer'](_0x267f7a);transfers[_0x90ce('0x32')](_0x267f7a);}catch(_0x27cb6d){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x31'),_0x267f7a['uniqueid']),_0x27cb6d);}});ami['on'](_0x90ce('0x33'),function(_0x3b8773){try{utils[_0x90ce('0x17')](util['format'](_0x90ce('0x34'),_0x3b8773[_0x90ce('0x35')]),_0x3b8773);queues[_0x90ce('0x33')](_0x3b8773);transfers[_0x90ce('0x33')](_0x3b8773);agents[_0x90ce('0x33')](_0x3b8773);calls[_0x90ce('0x33')](_0x3b8773);}catch(_0x20e9d0){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x34'),_0x3b8773[_0x90ce('0x35')]),_0x20e9d0);}});ami['on'](_0x90ce('0x36'),function(_0x148150){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x37'),_0x148150[_0x90ce('0x1d')]),_0x148150);queues[_0x90ce('0x36')](_0x148150);recordings[_0x90ce('0x36')](_0x148150);calls['varset'](_0x148150);dials[_0x90ce('0x36')](_0x148150);}catch(_0x22d816){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')]('[%s][index][varset]',_0x148150['uniqueid']),_0x22d816);}});ami['on'](_0x90ce('0x38'),function(_0x7bf5f0){try{utils['debug'](util[_0x90ce('0x1b')](_0x90ce('0x39'),_0x7bf5f0['uniqueid']),_0x7bf5f0);calls[_0x90ce('0x38')](_0x7bf5f0);recordings['newexten'](_0x7bf5f0);dials[_0x90ce('0x38')](_0x7bf5f0);}catch(_0x3ba07f){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')]('[%s][index][newexten]',_0x7bf5f0[_0x90ce('0x1d')]),_0x3ba07f);}});ami['on'](_0x90ce('0x3a'),function(_0xf7f1a7){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x3b'),_0xf7f1a7[_0x90ce('0x1d')]),_0xf7f1a7);calls[_0x90ce('0x3a')](_0xf7f1a7);recordings[_0x90ce('0x3a')](_0xf7f1a7);}catch(_0x2e83d6){utils[_0x90ce('0x14')](util['format'](_0x90ce('0x3b'),_0xf7f1a7[_0x90ce('0x1d')]),_0x2e83d6);}});ami['on'](_0x90ce('0x3c'),function(_0x3e23e0){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x3d'),_0x3e23e0[_0x90ce('0x1d')]),_0x3e23e0);dials['dialbegin'](_0x3e23e0);}catch(_0x522a41){utils[_0x90ce('0x14')](util['format'](_0x90ce('0x3e'),_0x3e23e0[_0x90ce('0x1d')]),_0x522a41);}});ami['on']('dialend',function(_0x30cd13){try{utils[_0x90ce('0x17')](util[_0x90ce('0x1b')](_0x90ce('0x3f'),_0x30cd13['uniqueid']),_0x30cd13);dials[_0x90ce('0x40')](_0x30cd13);}catch(_0x11582a){utils[_0x90ce('0x14')](util[_0x90ce('0x1b')](_0x90ce('0x3f'),_0x30cd13[_0x90ce('0x1d')]),_0x11582a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 31bb8da..1382729 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 _0x7dc2=['data3','destinationchannel','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','NOT_INUSE','exitAt','now','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','split','isNil','type','data2','source'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x27dc('0x0'));var members={};var exclude=[_0x27dc('0x1'),_0x27dc('0x2')];function writeDB(_0x426f56){utils['info'](util[_0x27dc('0x3')](_0x27dc('0x4'),_0x426f56['uniqueid'],_0x426f56[_0x27dc('0x5')],_0x426f56[_0x27dc('0x6')],_0x426f56['data2'],_0x426f56[_0x27dc('0x7')],_0x426f56['type']));if(_0x426f56[_0x27dc('0x5')]){utils[_0x27dc('0x8')](_0x426f56['interface'])[_0x27dc('0x9')](function(_0x1039b1){if(_0x1039b1){_0x426f56[_0x27dc('0x7')]=_0x1039b1[_0x27dc('0xa')];_0x426f56['internal']=_0x1039b1[_0x27dc('0xb')];utils['request'](_0x27dc('0xc'),_0x426f56);}else{utils[_0x27dc('0xd')](_0x426f56[_0x27dc('0x5')]['split']('/')[0x1])['then'](function(_0x4783d2){if(_0x4783d2){_0x426f56[_0x27dc('0x7')]=_0x4783d2[_0x27dc('0xa')];_0x426f56[_0x27dc('0xb')]=_0x4783d2['internal'];utils[_0x27dc('0xe')]('CreateMemberReport',_0x426f56);}});}})[_0x27dc('0xf')](function(_0x5a0e42){utils[_0x27dc('0x10')](util[_0x27dc('0x3')](_0x27dc('0x11'),_0x426f56[_0x27dc('0x12')]),_0x5a0e42);});}delete members[_0x426f56['interface']];}function startsWith(_0x110316,_0x1bd473){return _[_0x27dc('0x13')](_0x110316,function(_0x4193f9){return _[_0x27dc('0x14')](_0x1bd473,_0x4193f9);});}exports['devicestatechange']=function(_0x3ff8f8){try{utils[_0x27dc('0x15')](util[_0x27dc('0x3')](_0x27dc('0x16'),members[_0x3ff8f8['device']]?members[_0x3ff8f8[_0x27dc('0x17')]][_0x27dc('0x12')]:_0x3ff8f8[_0x27dc('0x17')]),_0x3ff8f8);utils[_0x27dc('0x18')](util[_0x27dc('0x3')](_0x27dc('0x19'),members[_0x3ff8f8[_0x27dc('0x17')]]?members[_0x3ff8f8[_0x27dc('0x17')]][_0x27dc('0x12')]:_0x3ff8f8[_0x27dc('0x17')],_0x3ff8f8['state'],_0x3ff8f8[_0x27dc('0x17')]));switch(_0x3ff8f8[_0x27dc('0x1a')]){case'INUSE':case _0x27dc('0x1b'):if(!startsWith(exclude,_0x3ff8f8['device'])){members[_0x3ff8f8['device']]={'channel':_0x27dc('0x1c'),'interface':_0x3ff8f8['device'],'type':_0x27dc('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x27dc('0x1e'):if(!_['isNil'](members[_0x3ff8f8[_0x27dc('0x17')]])){members[_0x3ff8f8['device']][_0x27dc('0x1f')]=utils[_0x27dc('0x20')]();members[_0x3ff8f8[_0x27dc('0x17')]][_0x27dc('0x21')]=utils['diffTime'](members[_0x3ff8f8[_0x27dc('0x17')]]['exitAt'],members[_0x3ff8f8['device']][_0x27dc('0x22')]);if(members[_0x3ff8f8[_0x27dc('0x17')]]['uniqueid']){writeDB(members[_0x3ff8f8[_0x27dc('0x17')]]);}}break;default:break;}}catch(_0xfe5817){utils[_0x27dc('0x10')](util[_0x27dc('0x3')](_0x27dc('0x16'),members[_0x3ff8f8[_0x27dc('0x17')]]?members[_0x3ff8f8[_0x27dc('0x17')]][_0x27dc('0x12')]:_0x3ff8f8[_0x27dc('0x17')]),_0xfe5817);}};exports[_0x27dc('0x23')]=function(_0x295776){try{if(!_['isNil'](members[_0x295776[_0x27dc('0x5')]])){utils[_0x27dc('0x15')](util['format'](_0x27dc('0x24'),_0x295776[_0x27dc('0x12')]),_0x295776);utils[_0x27dc('0x18')](util[_0x27dc('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x295776[_0x27dc('0x12')],_0x295776[_0x27dc('0x5')],_0x295776[_0x27dc('0x25')]));members[_0x295776['interface']]=_[_0x27dc('0x26')](members[_0x295776[_0x27dc('0x5')]],{'data4':_0x295776[_0x27dc('0x25')],'uniqueid':_0x295776[_0x27dc('0x12')]});}}catch(_0x5f3903){utils[_0x27dc('0x10')](util[_0x27dc('0x3')](_0x27dc('0x24'),_0x295776['uniqueid']),_0x5f3903);}};exports[_0x27dc('0x27')]=function(_0x122086){try{utils[_0x27dc('0x15')](util[_0x27dc('0x3')](_0x27dc('0x28'),_0x122086['uniqueid']),_0x122086);if(_0x122086[_0x27dc('0x6')]){var _0x416a15=_0x122086[_0x27dc('0x6')][_0x27dc('0x29')]('-')[0x0];if(!_[_0x27dc('0x2a')](members[_0x416a15])){members[_0x416a15]=_['assign'](members[_0x416a15],{'data1':members[_0x416a15]['data1']||_0x122086[_0x27dc('0x2b')],'data2':members[_0x416a15][_0x27dc('0x2c')]||_0x122086[_0x27dc('0x2d')],'data3':members[_0x416a15][_0x27dc('0x2e')]||_0x122086['destination'],'uniqueid':members[_0x416a15]['uniqueid']||_0x122086[_0x27dc('0x12')]});utils[_0x27dc('0x18')](util[_0x27dc('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x122086[_0x27dc('0x12')],members[_0x416a15]['data1'],members[_0x416a15][_0x27dc('0x2c')],members[_0x416a15]['data3']));if(members[_0x416a15][_0x27dc('0x1f')]){writeDB(members[_0x416a15]);}}}if(_0x122086[_0x27dc('0x2f')]){var _0xa84c4f=_0x122086[_0x27dc('0x2f')][_0x27dc('0x29')]('-')[0x0];if(!_[_0x27dc('0x2a')](members[_0xa84c4f])){members[_0xa84c4f]=_[_0x27dc('0x26')](members[_0xa84c4f],{'data1':members[_0xa84c4f][_0x27dc('0x30')]||_0x122086['type'],'data2':members[_0xa84c4f][_0x27dc('0x2c')]||_0x122086[_0x27dc('0x2d')],'data3':members[_0xa84c4f]['data3']||_0x122086[_0x27dc('0x31')],'uniqueid':members[_0xa84c4f][_0x27dc('0x12')]||_0x122086[_0x27dc('0x12')]});utils['info'](util[_0x27dc('0x3')](_0x27dc('0x32'),_0x122086[_0x27dc('0x12')],members[_0xa84c4f][_0x27dc('0x30')],members[_0xa84c4f]['data2'],members[_0xa84c4f][_0x27dc('0x2e')]));if(members[_0xa84c4f][_0x27dc('0x1f')]){writeDB(members[_0xa84c4f]);}}}}catch(_0x306330){utils[_0x27dc('0x10')](util[_0x27dc('0x3')](_0x27dc('0x28'),_0x122086['uniqueid']),_0x306330);}}; \ No newline at end of file +var _0x6797=['TALKING','now','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','isNil','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice'];(function(_0x48481c,_0x1012e5){var _0x4a9ea7=function(_0x37320e){while(--_0x37320e){_0x48481c['push'](_0x48481c['shift']());}};_0x4a9ea7(++_0x1012e5);}(_0x6797,0xda));var _0x7679=function(_0xfd8e43,_0x2a55aa){_0xfd8e43=_0xfd8e43-0x0;var _0x4da308=_0x6797[_0xfd8e43];return _0x4da308;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var utils=require(_0x7679('0x2'));var members={};var exclude=[_0x7679('0x3'),_0x7679('0x4')];function writeDB(_0x38fa11){utils['info'](util[_0x7679('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x38fa11[_0x7679('0x6')],_0x38fa11[_0x7679('0x7')],_0x38fa11[_0x7679('0x8')],_0x38fa11[_0x7679('0x9')],_0x38fa11[_0x7679('0xa')],_0x38fa11[_0x7679('0xb')]));if(_0x38fa11['interface']){utils[_0x7679('0xc')](_0x38fa11[_0x7679('0x7')])['then'](function(_0x1d5018){if(_0x1d5018){_0x38fa11[_0x7679('0xa')]=_0x1d5018[_0x7679('0xd')];_0x38fa11[_0x7679('0xe')]=_0x1d5018[_0x7679('0xe')];utils[_0x7679('0xf')](_0x7679('0x10'),_0x38fa11);}else{utils[_0x7679('0x11')](_0x38fa11[_0x7679('0x7')]['split']('/')[0x1])['then'](function(_0x28da35){if(_0x28da35){_0x38fa11[_0x7679('0xa')]=_0x28da35[_0x7679('0xd')];_0x38fa11[_0x7679('0xe')]=_0x28da35[_0x7679('0xe')];utils['request'](_0x7679('0x10'),_0x38fa11);}});}})[_0x7679('0x12')](function(_0x519211){utils[_0x7679('0x13')](util[_0x7679('0x5')](_0x7679('0x14'),_0x38fa11[_0x7679('0x6')]),_0x519211);});}delete members[_0x38fa11[_0x7679('0x7')]];}function startsWith(_0x5eda0d,_0x5a2a6f){return _[_0x7679('0x15')](_0x5eda0d,function(_0x574cdb){return _[_0x7679('0x16')](_0x5a2a6f,_0x574cdb);});}exports[_0x7679('0x17')]=function(_0x473dfb){try{utils[_0x7679('0x18')](util[_0x7679('0x5')](_0x7679('0x19'),members[_0x473dfb[_0x7679('0x1a')]]?members[_0x473dfb['device']][_0x7679('0x6')]:_0x473dfb[_0x7679('0x1a')]),_0x473dfb);utils[_0x7679('0x1b')](util[_0x7679('0x5')](_0x7679('0x1c'),members[_0x473dfb[_0x7679('0x1a')]]?members[_0x473dfb[_0x7679('0x1a')]][_0x7679('0x6')]:_0x473dfb[_0x7679('0x1a')],_0x473dfb[_0x7679('0x1d')],_0x473dfb[_0x7679('0x1a')]));switch(_0x473dfb[_0x7679('0x1d')]){case _0x7679('0x1e'):case'BUSY':if(!startsWith(exclude,_0x473dfb[_0x7679('0x1a')])){members[_0x473dfb[_0x7679('0x1a')]]={'channel':_0x7679('0x1f'),'interface':_0x473dfb['device'],'type':_0x7679('0x20'),'enterAt':utils[_0x7679('0x21')](),'role':'agent'};}break;case _0x7679('0x22'):if(!_['isNil'](members[_0x473dfb[_0x7679('0x1a')]])){members[_0x473dfb[_0x7679('0x1a')]][_0x7679('0x23')]=utils[_0x7679('0x21')]();members[_0x473dfb[_0x7679('0x1a')]][_0x7679('0x24')]=utils[_0x7679('0x25')](members[_0x473dfb[_0x7679('0x1a')]]['exitAt'],members[_0x473dfb['device']]['enterAt']);if(members[_0x473dfb[_0x7679('0x1a')]][_0x7679('0x6')]){writeDB(members[_0x473dfb[_0x7679('0x1a')]]);}}break;default:break;}}catch(_0x46ccc0){utils[_0x7679('0x13')](util[_0x7679('0x5')](_0x7679('0x19'),members[_0x473dfb[_0x7679('0x1a')]]?members[_0x473dfb[_0x7679('0x1a')]][_0x7679('0x6')]:_0x473dfb[_0x7679('0x1a')]),_0x46ccc0);}};exports[_0x7679('0x26')]=function(_0x3d427e){try{if(!_['isNil'](members[_0x3d427e[_0x7679('0x7')]])){utils[_0x7679('0x18')](util[_0x7679('0x5')](_0x7679('0x27'),_0x3d427e['uniqueid']),_0x3d427e);utils[_0x7679('0x1b')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3d427e[_0x7679('0x6')],_0x3d427e['interface'],_0x3d427e[_0x7679('0x28')]));members[_0x3d427e[_0x7679('0x7')]]=_[_0x7679('0x29')](members[_0x3d427e[_0x7679('0x7')]],{'data4':_0x3d427e[_0x7679('0x28')],'uniqueid':_0x3d427e[_0x7679('0x6')]});}}catch(_0x20bb60){utils[_0x7679('0x13')](util[_0x7679('0x5')](_0x7679('0x27'),_0x3d427e[_0x7679('0x6')]),_0x20bb60);}};exports['cdr']=function(_0x561614){try{utils[_0x7679('0x18')](util[_0x7679('0x5')](_0x7679('0x2a'),_0x561614[_0x7679('0x6')]),_0x561614);if(_0x561614['channel']){var _0xa4e9df=_0x561614['channel']['split']('-')[0x0];if(!_[_0x7679('0x2b')](members[_0xa4e9df])){members[_0xa4e9df]=_[_0x7679('0x29')](members[_0xa4e9df],{'data1':members[_0xa4e9df][_0x7679('0x2c')]||_0x561614[_0x7679('0xb')],'data2':members[_0xa4e9df][_0x7679('0x9')]||_0x561614[_0x7679('0x2d')],'data3':members[_0xa4e9df][_0x7679('0x2e')]||_0x561614[_0x7679('0x2f')],'uniqueid':members[_0xa4e9df][_0x7679('0x6')]||_0x561614[_0x7679('0x6')]});utils[_0x7679('0x1b')](util[_0x7679('0x5')](_0x7679('0x30'),_0x561614[_0x7679('0x6')],members[_0xa4e9df][_0x7679('0x2c')],members[_0xa4e9df][_0x7679('0x9')],members[_0xa4e9df][_0x7679('0x2e')]));if(members[_0xa4e9df][_0x7679('0x23')]){writeDB(members[_0xa4e9df]);}}}if(_0x561614[_0x7679('0x31')]){var _0x1b8732=_0x561614[_0x7679('0x31')]['split']('-')[0x0];if(!_['isNil'](members[_0x1b8732])){members[_0x1b8732]=_['assign'](members[_0x1b8732],{'data1':members[_0x1b8732][_0x7679('0x2c')]||_0x561614[_0x7679('0xb')],'data2':members[_0x1b8732][_0x7679('0x9')]||_0x561614['source'],'data3':members[_0x1b8732][_0x7679('0x2e')]||_0x561614[_0x7679('0x2f')],'uniqueid':members[_0x1b8732][_0x7679('0x6')]||_0x561614[_0x7679('0x6')]});utils[_0x7679('0x1b')](util[_0x7679('0x5')](_0x7679('0x30'),_0x561614[_0x7679('0x6')],members[_0x1b8732][_0x7679('0x2c')],members[_0x1b8732][_0x7679('0x9')],members[_0x1b8732]['data3']));if(members[_0x1b8732][_0x7679('0x23')]){writeDB(members[_0x1b8732]);}}}}catch(_0x45471f){utils['error'](util['format'](_0x7679('0x2a'),_0x561614['uniqueid']),_0x45471f);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 56ad43b..bfac7ba 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 _0xd903=['queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','util','info','[%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','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','[%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][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x15b128,_0x12c8ea){var _0x20b34b=function(_0x2664ea){while(--_0x2664ea){_0x15b128['push'](_0x15b128['shift']());}};_0x20b34b(++_0x12c8ea);}(_0xd903,0x104));var _0x3d90=function(_0x338d4d,_0x1eb79d){_0x338d4d=_0x338d4d-0x0;var _0x1bcf0c=_0xd903[_0x338d4d];return _0x1bcf0c;};'use strict';var _=require('lodash');var util=require(_0x3d90('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x288e61){utils[_0x3d90('0x1')](util['format'](_0x3d90('0x2'),_0x288e61[_0x3d90('0x3')],_0x288e61[_0x3d90('0x4')],_0x288e61[_0x3d90('0x5')],_0x288e61[_0x3d90('0x6')],_0x288e61[_0x3d90('0x7')],_0x288e61[_0x3d90('0x8')],_0x288e61[_0x3d90('0x9')]));if(_0x288e61[_0x3d90('0x5')]){utils[_0x3d90('0xa')](_0x288e61[_0x3d90('0x5')])[_0x3d90('0xb')](function(_0x5919a1){if(_0x5919a1){_0x288e61[_0x3d90('0xc')]=_0x5919a1[_0x3d90('0xc')];}utils[_0x3d90('0xd')](_0x3d90('0xe'),_0x288e61);});}else{utils[_0x3d90('0xd')](_0x3d90('0xe'),_0x288e61);}if(_0x288e61['transfereduniqueid']){delete queues[_0x288e61[_0x3d90('0xf')]];}else{delete queues[_0x288e61[_0x3d90('0x3')]];}}exports['queuecallerjoin']=function(_0x2286a9){try{utils['debug'](util[_0x3d90('0x10')]('[%s][queues][queuecallerjoin]',_0x2286a9[_0x3d90('0x3')]),_0x2286a9);utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x11'),_0x2286a9['uniqueid'],_0x2286a9[_0x3d90('0x5')],_0x2286a9[_0x3d90('0x12')]));queues[_0x2286a9[_0x3d90('0x3')]]=_[_0x3d90('0x13')](_0x2286a9,{'originalposition':_0x2286a9[_0x3d90('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2f6bbb){utils[_0x3d90('0x14')](util[_0x3d90('0x10')](_0x3d90('0x15'),_0x2286a9[_0x3d90('0x3')]),_0x2f6bbb);}};exports[_0x3d90('0x16')]=function(_0x4b8cd3){try{if(!_[_0x3d90('0x17')](queues[_0x4b8cd3[_0x3d90('0x3')]])){utils[_0x3d90('0x18')](util['format'](_0x3d90('0x19'),_0x4b8cd3['uniqueid']),_0x4b8cd3);if(queues[_0x4b8cd3['uniqueid']][_0x3d90('0x1a')]){if(!queues[_0x4b8cd3[_0x3d90('0x3')]]['queuecallerabandon']&&!queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0x1b')]){queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0x1c')]=!![];queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0x1d')]=utils[_0x3d90('0x1e')]();queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0x9')]=_0x3d90('0x1f');}utils['info'](util[_0x3d90('0x10')](_0x3d90('0x20'),_0x4b8cd3[_0x3d90('0x3')],queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0x21')],queues[_0x4b8cd3['uniqueid']][_0x3d90('0x9')]));writeDB(queues[_0x4b8cd3['uniqueid']]);}else if(queues[_0x4b8cd3['uniqueid']]['transfereduniqueid']){utils[_0x3d90('0x1')](util['format'](_0x3d90('0x22'),_0x4b8cd3[_0x3d90('0x3')],queues[_0x4b8cd3[_0x3d90('0x3')]]['name'],queues[_0x4b8cd3['uniqueid']]['transfereduniqueid']));queues[queues[_0x4b8cd3['uniqueid']]['transfereduniqueid']]=queues[_0x4b8cd3[_0x3d90('0x3')]];queues[queues[_0x4b8cd3[_0x3d90('0x3')]][_0x3d90('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x4b8cd3['uniqueid']];}}}catch(_0x46a6e7){utils[_0x3d90('0x14')](util[_0x3d90('0x10')](_0x3d90('0x19'),_0x4b8cd3['uniqueid']),_0x46a6e7);}};exports[_0x3d90('0x23')]=function(_0x34a385){try{utils[_0x3d90('0x18')](util[_0x3d90('0x10')](_0x3d90('0x24'),_0x34a385[_0x3d90('0x3')]),_0x34a385);if(!_[_0x3d90('0x17')](_0x34a385[_0x3d90('0x25')][_0x3d90('0x26')])&&_0x34a385[_0x3d90('0x27')][_0x3d90('0x28')]()!==_0x3d90('0x29')){if(!_['isNil'](queues[_0x34a385[_0x3d90('0x3')]])){queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x2a')]=![];queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x2b')]=null;queues[_0x34a385['uniqueid']][_0x3d90('0x1b')]=!![];queues[_0x34a385['uniqueid']]['queuecallerexitAt']=utils[_0x3d90('0x1e')]();queues[_0x34a385['uniqueid']][_0x3d90('0x9')]=_0x34a385['value']['toUpperCase']();utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x2c'),_0x34a385[_0x3d90('0x3')],queues[_0x34a385['uniqueid']][_0x3d90('0x21')],_0x34a385[_0x3d90('0x27')],queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x9')]));writeDB(queues[_0x34a385['uniqueid']]);}}else if(!_[_0x3d90('0x17')](_0x34a385[_0x3d90('0x25')][_0x3d90('0x2d')])){if(!_[_0x3d90('0x17')](queues[_0x34a385['uniqueid']])&&!queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x2a')]){queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x2a')]=![];queues[_0x34a385[_0x3d90('0x3')]]['queuecallerabandonAt']=null;queues[_0x34a385[_0x3d90('0x3')]]['queuecallerexit']=!![];queues[_0x34a385[_0x3d90('0x3')]]['queuecallerexitAt']=utils[_0x3d90('0x1e')]();queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x9')]=_0x3d90('0x2e');utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x2f'),_0x34a385[_0x3d90('0x3')],queues[_0x34a385[_0x3d90('0x3')]]['name'],_0x34a385[_0x3d90('0x27')],queues[_0x34a385[_0x3d90('0x3')]][_0x3d90('0x9')]));}}}catch(_0xf281f5){utils[_0x3d90('0x14')](util[_0x3d90('0x10')](_0x3d90('0x24'),_0x34a385[_0x3d90('0x3')]),_0xf281f5);}};exports[_0x3d90('0x2a')]=function(_0xd39f71){try{if(!_[_0x3d90('0x17')](queues[_0xd39f71[_0x3d90('0x3')]])){utils[_0x3d90('0x18')](util['format'](_0x3d90('0x30'),_0xd39f71[_0x3d90('0x3')]),_0xd39f71);queues[_0xd39f71['uniqueid']][_0x3d90('0x1b')]=![];queues[_0xd39f71[_0x3d90('0x3')]][_0x3d90('0x31')]=null;queues[_0xd39f71['uniqueid']][_0x3d90('0x2a')]=!![];queues[_0xd39f71[_0x3d90('0x3')]][_0x3d90('0x2b')]=utils[_0x3d90('0x1e')]();queues[_0xd39f71['uniqueid']][_0x3d90('0x9')]=_0x3d90('0x32');utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x33'),_0xd39f71[_0x3d90('0x3')],queues[_0xd39f71[_0x3d90('0x3')]][_0x3d90('0x21')],queues[_0xd39f71[_0x3d90('0x3')]][_0x3d90('0x9')]));}}catch(_0x4059c7){utils[_0x3d90('0x14')](util['format'](_0x3d90('0x30'),_0xd39f71['uniqueid']),_0x4059c7);}};exports[_0x3d90('0x34')]=function(_0x50f0ac){try{if(!_[_0x3d90('0x17')](queues[_0x50f0ac[_0x3d90('0x3')]])){utils[_0x3d90('0x18')](util[_0x3d90('0x10')]('[%s][queues][queuecallerleave]',_0x50f0ac['uniqueid']),_0x50f0ac);utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x35'),_0x50f0ac[_0x3d90('0x3')],queues[_0x50f0ac[_0x3d90('0x3')]][_0x3d90('0x21')],_0x50f0ac[_0x3d90('0x36')],_0x50f0ac[_0x3d90('0x37')]));queues[_0x50f0ac[_0x3d90('0x3')]]['queuecallerleave']=!![];queues[_0x50f0ac[_0x3d90('0x3')]]['queuecallerleaveAt']=utils[_0x3d90('0x1e')]();queues[_0x50f0ac['uniqueid']]['holdtime']=utils[_0x3d90('0x38')](queues[_0x50f0ac[_0x3d90('0x3')]]['queuecallerleaveAt'],queues[_0x50f0ac[_0x3d90('0x3')]][_0x3d90('0x39')]);queues[_0x50f0ac[_0x3d90('0x3')]][_0x3d90('0x12')]=_0x50f0ac[_0x3d90('0x12')];queues[_0x50f0ac[_0x3d90('0x3')]][_0x3d90('0x3a')]=_0x50f0ac[_0x3d90('0x3a')];queues[_0x50f0ac['uniqueid']][_0x3d90('0x36')]=_0x50f0ac[_0x3d90('0x36')];queues[_0x50f0ac[_0x3d90('0x3')]]['connectedlinename']=_0x50f0ac[_0x3d90('0x37')];}}catch(_0x74db2b){utils[_0x3d90('0x14')](util[_0x3d90('0x10')](_0x3d90('0x3b'),_0x50f0ac['uniqueid']),_0x74db2b);}};exports[_0x3d90('0x3c')]=function(_0x5d6710){try{if(!_['isNil'](queues[_0x5d6710[_0x3d90('0x3')]])){utils['debug'](util[_0x3d90('0x10')](_0x3d90('0x3d'),_0x5d6710[_0x3d90('0x3')]),_0x5d6710);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5d6710[_0x3d90('0x3')],queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x21')],_0x5d6710[_0x3d90('0x3e')],_0x5d6710[_0x3d90('0x3f')]));queues[_0x5d6710['uniqueid']][_0x3d90('0x2a')]=![];queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x2a')]=![];queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x2b')]=null;queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x1b')]=![];queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x9')]=null;queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x31')]=null;queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x40')]=!![];queues[_0x5d6710[_0x3d90('0x3')]]['accountcode']=_0x5d6710[_0x3d90('0x3f')];queues[_0x5d6710[_0x3d90('0x3')]][_0x3d90('0x6')]=_0x5d6710['membername'];}}catch(_0x40edd2){utils[_0x3d90('0x14')](util[_0x3d90('0x10')](_0x3d90('0x3d'),_0x5d6710['uniqueid']),_0x40edd2);}};exports['agentcomplete']=function(_0x3c89fe){try{if(!_[_0x3d90('0x17')](queues[_0x3c89fe[_0x3d90('0x3')]])){if(queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x1a')]){utils['debug'](util[_0x3d90('0x10')](_0x3d90('0x41'),_0x3c89fe['uniqueid']),_0x3c89fe);queues[_0x3c89fe['uniqueid']]['queuecallerabandon']=![];queues[_0x3c89fe['uniqueid']][_0x3d90('0x2a')]=![];queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x2b')]=null;queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x1b')]=![];queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x31')]=null;queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x40')]=!![];queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x6')]=_0x3c89fe[_0x3d90('0x3e')];queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x1c')]=!![];queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x1d')]=utils[_0x3d90('0x1e')]();if(_0x3c89fe['reason']=='transfer'){if(!queues[_0x3c89fe[_0x3d90('0x3')]]['transfer']){queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x9')]=_0x3d90('0x42');}}else{queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x9')]=_0x3d90('0x43')+_0x3c89fe[_0x3d90('0x44')][_0x3d90('0x28')]();}utils[_0x3d90('0x1')](util[_0x3d90('0x10')](_0x3d90('0x45'),_0x3c89fe['uniqueid'],queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x21')],_0x3c89fe[_0x3d90('0x3e')],queues[_0x3c89fe[_0x3d90('0x3')]][_0x3d90('0x9')]));writeDB(queues[_0x3c89fe[_0x3d90('0x3')]]);}}}catch(_0x1a377c){utils[_0x3d90('0x14')](util['format']('[%s][queues][agentcomplete]',_0x3c89fe['uniqueid']),_0x1a377c);}};exports['blindtransfer']=function(_0x3e30c6){try{if(!_['isNil'](queues[_0x3e30c6['transfereeuniqueid']])){utils[_0x3d90('0x18')](util[_0x3d90('0x10')]('[%s][queues][blindtransfer]',_0x3e30c6[_0x3d90('0x3')]),_0x3e30c6);queues[_0x3e30c6[_0x3d90('0x46')]][_0x3d90('0x47')]=!![];queues[_0x3e30c6['transfereeuniqueid']][_0x3d90('0x48')]=_0x3d90('0x49');queues[_0x3e30c6[_0x3d90('0x46')]][_0x3d90('0x4a')]=_0x3e30c6[_0x3d90('0x4b')];queues[_0x3e30c6[_0x3d90('0x46')]][_0x3d90('0x4c')]=_0x3e30c6[_0x3d90('0x46')];queues[_0x3e30c6['transfereeuniqueid']][_0x3d90('0x9')]=_0x3d90('0x4d');utils[_0x3d90('0x1')](util['format'](_0x3d90('0x4e'),_0x3e30c6['uniqueid'],queues[_0x3e30c6[_0x3d90('0x46')]][_0x3d90('0x21')],_0x3e30c6[_0x3d90('0x46')],_0x3e30c6[_0x3d90('0x4b')]));}}catch(_0x107b55){utils['error'](util[_0x3d90('0x10')](_0x3d90('0x4f'),_0x3e30c6[_0x3d90('0x3')]),_0x107b55);}};exports[_0x3d90('0x50')]=function(_0x1287dd){try{utils[_0x3d90('0x18')](util[_0x3d90('0x10')]('[%s][queues][attendedtransfer]',_0x1287dd[_0x3d90('0x51')]),_0x1287dd);if(_0x1287dd[_0x3d90('0x51')]==_0x1287dd['origtransfererlinkedid']){if(!_[_0x3d90('0x17')](queues[_0x1287dd[_0x3d90('0x52')]])){utils[_0x3d90('0x1')](util['format'](_0x3d90('0x53'),_0x1287dd['origtransfereruniqueid'],queues[_0x1287dd[_0x3d90('0x52')]][_0x3d90('0x21')],_0x1287dd[_0x3d90('0x54')]));queues[_0x1287dd[_0x3d90('0x52')]][_0x3d90('0x47')]=!![];queues[_0x1287dd[_0x3d90('0x52')]]['transfertype']=_0x3d90('0x55');queues[_0x1287dd['secondtransfererlinkedid']][_0x3d90('0x4a')]=_0x1287dd['origtransfererexten'];queues[_0x1287dd[_0x3d90('0x52')]]['transferuniqueid']=_0x1287dd[_0x3d90('0x51')];queues[_0x1287dd[_0x3d90('0x52')]][_0x3d90('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x3d90('0x17')](queues[_0x1287dd[_0x3d90('0x56')]])){if(_0x1287dd['transfereelinkedid']&&queues[_0x1287dd[_0x3d90('0x57')]]){queues[_0x1287dd[_0x3d90('0x57')]][_0x3d90('0x58')]=0x1;queues[_0x1287dd[_0x3d90('0x46')]]=_[_0x3d90('0x59')](queues[_0x1287dd[_0x3d90('0x57')]]);queues[_0x1287dd[_0x3d90('0x46')]]['transfereduniqueid']=_0x1287dd[_0x3d90('0x5a')];queues[_0x1287dd['transfereeuniqueid']][_0x3d90('0x58')]=0x2;queues[_0x1287dd[_0x3d90('0x46')]][_0x3d90('0x7')]=queues[_0x1287dd[_0x3d90('0x52')]][_0x3d90('0x7')];queues[_0x1287dd['transfereeuniqueid']]['calleridname']=queues[_0x1287dd[_0x3d90('0x52')]]['calleridname'];queues[_0x1287dd[_0x3d90('0x46')]][_0x3d90('0x39')]=utils[_0x3d90('0x1e')]();queues[_0x1287dd[_0x3d90('0x46')]]['queuecallerleaveAt']=utils[_0x3d90('0x1e')]();queues[_0x1287dd[_0x3d90('0x46')]]['holdtime']=0x0;queues[_0x1287dd[_0x3d90('0x46')]]['mohtime']=0x0;utils[_0x3d90('0x1')](util['format'](_0x3d90('0x5b'),_0x1287dd[_0x3d90('0x51')],queues[_0x1287dd[_0x3d90('0x46')]]['name'],queues[_0x1287dd[_0x3d90('0x46')]]['calleridnum'],queues[_0x1287dd[_0x3d90('0x46')]][_0x3d90('0x5c')]));}else{utils[_0x3d90('0x1')](util[_0x3d90('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1287dd[_0x3d90('0x51')],queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x21')],_0x1287dd[_0x3d90('0x52')]));queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0xf')]=_0x1287dd[_0x3d90('0x52')];}}}else if(_0x1287dd[_0x3d90('0x5d')]==_0x1287dd[_0x3d90('0x52')]){if(!_['isNil'](queues[_0x1287dd[_0x3d90('0x56')]])){utils[_0x3d90('0x1')](util['format'](_0x3d90('0x5e'),_0x1287dd[_0x3d90('0x51')],queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x21')],_0x1287dd[_0x3d90('0x5d')],_0x1287dd['secondtransfererexten']));queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x47')]=!![];queues[_0x1287dd[_0x3d90('0x56')]]['transfertype']=_0x3d90('0x55');queues[_0x1287dd[_0x3d90('0x56')]]['transferexten']=_0x1287dd[_0x3d90('0x5f')];queues[_0x1287dd['origtransfererlinkedid']]['transferuniqueid']=_0x1287dd[_0x3d90('0x5d')];queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x3d90('0x17')](queues[_0x1287dd[_0x3d90('0x52')]])){if(_0x1287dd['transfertargetlinkedid']&&queues[_0x1287dd['transfertargetlinkedid']]){queues[_0x1287dd['transfertargetlinkedid']][_0x3d90('0x58')]=0x1;queues[_0x1287dd[_0x3d90('0x5a')]]=_['clone'](queues[_0x1287dd['transfertargetlinkedid']]);queues[_0x1287dd['transfertargetuniqueid']][_0x3d90('0xf')]=_0x1287dd[_0x3d90('0x5a')];queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x58')]=0x2;queues[_0x1287dd[_0x3d90('0x5a')]]['calleridnum']=queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x7')];queues[_0x1287dd['transfertargetuniqueid']]['calleridname']=queues[_0x1287dd[_0x3d90('0x56')]][_0x3d90('0x5c')];queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x39')]=utils[_0x3d90('0x1e')]();queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x1a')]=utils['now']();queues[_0x1287dd['transfertargetuniqueid']][_0x3d90('0x60')]=0x0;queues[_0x1287dd['transfertargetuniqueid']][_0x3d90('0x61')]=0x0;utils['info'](util[_0x3d90('0x10')](_0x3d90('0x62'),_0x1287dd['origtransfereruniqueid'],queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x21')],queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0xf')],queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x7')],queues[_0x1287dd[_0x3d90('0x5a')]][_0x3d90('0x5c')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1287dd[_0x3d90('0x51')],queues[_0x1287dd[_0x3d90('0x52')]][_0x3d90('0x21')],_0x1287dd[_0x3d90('0x56')]));queues[_0x1287dd['secondtransfererlinkedid']][_0x3d90('0xf')]=_0x1287dd['origtransfererlinkedid'];}}}}catch(_0x3a066b){utils[_0x3d90('0x14')](util['format'](_0x3d90('0x63'),_0x1287dd['origtransfereruniqueid']),_0x3a066b);}};exports['musiconholdstart']=function(_0x480d90){try{if(!_['isNil'](queues[_0x480d90[_0x3d90('0x3')]])){utils[_0x3d90('0x18')](util[_0x3d90('0x10')](_0x3d90('0x64'),_0x480d90[_0x3d90('0x3')]),_0x480d90);queues[_0x480d90[_0x3d90('0x3')]][_0x3d90('0x65')]=utils['now']();utils[_0x3d90('0x1')](util['format'](_0x3d90('0x66'),_0x480d90[_0x3d90('0x3')],queues[_0x480d90[_0x3d90('0x3')]]['name'],queues[_0x480d90[_0x3d90('0x3')]][_0x3d90('0x65')]));}}catch(_0x42afad){utils[_0x3d90('0x14')](util['format'](_0x3d90('0x64'),_0x480d90[_0x3d90('0x3')]),_0x42afad);}};exports['musiconholdstop']=function(_0x514cc5){try{if(!_[_0x3d90('0x17')](queues[_0x514cc5[_0x3d90('0x3')]])){if(!_[_0x3d90('0x17')](queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x65')])){utils['debug'](util[_0x3d90('0x10')]('[%s][queues][musiconholdstop]',_0x514cc5['uniqueid']),_0x514cc5);queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x61')]+=utils[_0x3d90('0x38')](utils[_0x3d90('0x1e')](),queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x65')]);utils[_0x3d90('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x514cc5[_0x3d90('0x3')],queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x21')],queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x61')]));delete queues[_0x514cc5[_0x3d90('0x3')]][_0x3d90('0x65')];}}}catch(_0x4ed414){utils[_0x3d90('0x14')](util['format'](_0x3d90('0x67'),_0x514cc5[_0x3d90('0x3')]),_0x4ed414);}}; \ No newline at end of file +var _0x7d6b=['[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','accountcode','agentcomplete','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','transferuniqueid','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfertargetlinkedid','queuecallerenterreason','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7d6b,0x17b));var _0xb7d6=function(_0x3dcd30,_0x3fb9fc){_0x3dcd30=_0x3dcd30-0x0;var _0x79d948=_0x7d6b[_0x3dcd30];return _0x79d948;};'use strict';var _=require(_0xb7d6('0x0'));var util=require(_0xb7d6('0x1'));var utils=require(_0xb7d6('0x2'));var queues={};function writeDB(_0x54bddf){utils[_0xb7d6('0x3')](util['format'](_0xb7d6('0x4'),_0x54bddf[_0xb7d6('0x5')],_0x54bddf[_0xb7d6('0x6')],_0x54bddf[_0xb7d6('0x7')],_0x54bddf[_0xb7d6('0x8')],_0x54bddf[_0xb7d6('0x9')],_0x54bddf['accountcode'],_0x54bddf[_0xb7d6('0xa')]));if(_0x54bddf[_0xb7d6('0x7')]){utils[_0xb7d6('0xb')](_0x54bddf[_0xb7d6('0x7')])[_0xb7d6('0xc')](function(_0x1ddb04){if(_0x1ddb04){_0x54bddf[_0xb7d6('0xd')]=_0x1ddb04[_0xb7d6('0xd')];}utils[_0xb7d6('0xe')](_0xb7d6('0xf'),_0x54bddf);});}else{utils['request']('CreateVoiceQueueReport',_0x54bddf);}if(_0x54bddf[_0xb7d6('0x10')]){delete queues[_0x54bddf['transfereduniqueid']];}else{delete queues[_0x54bddf[_0xb7d6('0x5')]];}}exports[_0xb7d6('0x11')]=function(_0xc10340){try{utils[_0xb7d6('0x12')](util['format'](_0xb7d6('0x13'),_0xc10340[_0xb7d6('0x5')]),_0xc10340);utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x15'),_0xc10340[_0xb7d6('0x5')],_0xc10340['queue'],_0xc10340[_0xb7d6('0x16')]));queues[_0xc10340[_0xb7d6('0x5')]]=_[_0xb7d6('0x17')](_0xc10340,{'originalposition':_0xc10340[_0xb7d6('0x16')],'queuecallerjoinAt':utils[_0xb7d6('0x18')](),'mohtime':0x0});}catch(_0x214632){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x13'),_0xc10340['uniqueid']),_0x214632);}};exports[_0xb7d6('0x1a')]=function(_0x5145bb){try{if(!_[_0xb7d6('0x1b')](queues[_0x5145bb[_0xb7d6('0x5')]])){utils[_0xb7d6('0x12')](util[_0xb7d6('0x14')](_0xb7d6('0x1c'),_0x5145bb['uniqueid']),_0x5145bb);if(queues[_0x5145bb['uniqueid']][_0xb7d6('0x1d')]){if(!queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x1e')]&&!queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x1f')]){queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x20')]=!![];queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x21')]=utils['now']();queues[_0x5145bb['uniqueid']]['queuecallerexitreason']=_0xb7d6('0x22');}utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x23'),_0x5145bb['uniqueid'],queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x24')],queues[_0x5145bb['uniqueid']][_0xb7d6('0xa')]));writeDB(queues[_0x5145bb['uniqueid']]);}else if(queues[_0x5145bb['uniqueid']]['transfereduniqueid']){utils['info'](util[_0xb7d6('0x14')](_0xb7d6('0x25'),_0x5145bb[_0xb7d6('0x5')],queues[_0x5145bb[_0xb7d6('0x5')]]['name'],queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x10')]));queues[queues[_0x5145bb['uniqueid']]['transfereduniqueid']]=queues[_0x5145bb[_0xb7d6('0x5')]];queues[queues[_0x5145bb[_0xb7d6('0x5')]][_0xb7d6('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x5145bb[_0xb7d6('0x5')]];}}}catch(_0x5ea563){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x1c'),_0x5145bb[_0xb7d6('0x5')]),_0x5ea563);}};exports[_0xb7d6('0x26')]=function(_0x3f0519){try{utils['debug'](util['format']('[%s][queues][varset]',_0x3f0519[_0xb7d6('0x5')]),_0x3f0519);if(!_['isNil'](_0x3f0519[_0xb7d6('0x27')]['queuestatus'])&&_0x3f0519[_0xb7d6('0x28')][_0xb7d6('0x29')]()!==_0xb7d6('0x2a')){if(!_[_0xb7d6('0x1b')](queues[_0x3f0519[_0xb7d6('0x5')]])){queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=![];queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x2b')]=null;queues[_0x3f0519[_0xb7d6('0x5')]]['queuecallerexit']=!![];queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x2c')]=utils[_0xb7d6('0x18')]();queues[_0x3f0519[_0xb7d6('0x5')]]['queuecallerexitreason']=_0x3f0519['value'][_0xb7d6('0x29')]();utils['info'](util['format'](_0xb7d6('0x2d'),_0x3f0519[_0xb7d6('0x5')],queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x24')],_0x3f0519[_0xb7d6('0x28')],queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0xa')]));writeDB(queues[_0x3f0519[_0xb7d6('0x5')]]);}}else if(!_['isNil'](_0x3f0519['variable'][_0xb7d6('0x2e')])){if(!_['isNil'](queues[_0x3f0519['uniqueid']])&&!queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x1e')]){queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=![];queues[_0x3f0519['uniqueid']][_0xb7d6('0x2b')]=null;queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x1f')]=!![];queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x2c')]=utils['now']();queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0xa')]=_0xb7d6('0x2f');utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x30'),_0x3f0519[_0xb7d6('0x5')],queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0x24')],_0x3f0519[_0xb7d6('0x28')],queues[_0x3f0519[_0xb7d6('0x5')]][_0xb7d6('0xa')]));}}}catch(_0x4e3602){utils['error'](util[_0xb7d6('0x14')](_0xb7d6('0x31'),_0x3f0519['uniqueid']),_0x4e3602);}};exports[_0xb7d6('0x1e')]=function(_0x2ca684){try{if(!_[_0xb7d6('0x1b')](queues[_0x2ca684['uniqueid']])){utils[_0xb7d6('0x12')](util[_0xb7d6('0x14')](_0xb7d6('0x32'),_0x2ca684['uniqueid']),_0x2ca684);queues[_0x2ca684[_0xb7d6('0x5')]]['queuecallerexit']=![];queues[_0x2ca684['uniqueid']][_0xb7d6('0x2c')]=null;queues[_0x2ca684[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=!![];queues[_0x2ca684['uniqueid']][_0xb7d6('0x2b')]=utils['now']();queues[_0x2ca684[_0xb7d6('0x5')]][_0xb7d6('0xa')]=_0xb7d6('0x33');utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2ca684[_0xb7d6('0x5')],queues[_0x2ca684['uniqueid']][_0xb7d6('0x24')],queues[_0x2ca684[_0xb7d6('0x5')]][_0xb7d6('0xa')]));}}catch(_0x4da226){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')]('[%s][queues][queuecallerabandon]',_0x2ca684[_0xb7d6('0x5')]),_0x4da226);}};exports[_0xb7d6('0x34')]=function(_0x21e012){try{if(!_[_0xb7d6('0x1b')](queues[_0x21e012[_0xb7d6('0x5')]])){utils[_0xb7d6('0x12')](util[_0xb7d6('0x14')](_0xb7d6('0x35'),_0x21e012[_0xb7d6('0x5')]),_0x21e012);utils['info'](util[_0xb7d6('0x14')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x21e012[_0xb7d6('0x5')],queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x24')],_0x21e012[_0xb7d6('0x36')],_0x21e012['connectedlinename']));queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x34')]=!![];queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x1d')]=utils[_0xb7d6('0x18')]();queues[_0x21e012['uniqueid']][_0xb7d6('0x37')]=utils[_0xb7d6('0x38')](queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x1d')],queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x39')]);queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x16')]=_0x21e012[_0xb7d6('0x16')];queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x3a')]=_0x21e012[_0xb7d6('0x3a')];queues[_0x21e012['uniqueid']][_0xb7d6('0x36')]=_0x21e012[_0xb7d6('0x36')];queues[_0x21e012[_0xb7d6('0x5')]][_0xb7d6('0x3b')]=_0x21e012[_0xb7d6('0x3b')];}}catch(_0x587d9d){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x35'),_0x21e012['uniqueid']),_0x587d9d);}};exports['agentconnect']=function(_0x8e14bc){try{if(!_[_0xb7d6('0x1b')](queues[_0x8e14bc['uniqueid']])){utils['debug'](util[_0xb7d6('0x14')](_0xb7d6('0x3c'),_0x8e14bc['uniqueid']),_0x8e14bc);utils['info'](util['format'](_0xb7d6('0x3d'),_0x8e14bc[_0xb7d6('0x5')],queues[_0x8e14bc['uniqueid']][_0xb7d6('0x24')],_0x8e14bc[_0xb7d6('0x3e')],_0x8e14bc['destaccountcode']));queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=![];queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=![];queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x2b')]=null;queues[_0x8e14bc['uniqueid']][_0xb7d6('0x1f')]=![];queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0xa')]=null;queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x2c')]=null;queues[_0x8e14bc[_0xb7d6('0x5')]]['assigned']=!![];queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x3f')]=_0x8e14bc['destaccountcode'];queues[_0x8e14bc[_0xb7d6('0x5')]][_0xb7d6('0x8')]=_0x8e14bc[_0xb7d6('0x3e')];}}catch(_0x50b2c0){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x3c'),_0x8e14bc[_0xb7d6('0x5')]),_0x50b2c0);}};exports[_0xb7d6('0x40')]=function(_0x382f9d){try{if(!_[_0xb7d6('0x1b')](queues[_0x382f9d['uniqueid']])){if(queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x1d')]){utils[_0xb7d6('0x12')](util[_0xb7d6('0x14')]('[%s][queues][agentcomplete]',_0x382f9d['uniqueid']),_0x382f9d);queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x1e')]=![];queues[_0x382f9d['uniqueid']][_0xb7d6('0x1e')]=![];queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x2b')]=null;queues[_0x382f9d[_0xb7d6('0x5')]]['queuecallerexit']=![];queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x2c')]=null;queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x41')]=!![];queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x8')]=_0x382f9d[_0xb7d6('0x3e')];queues[_0x382f9d[_0xb7d6('0x5')]][_0xb7d6('0x20')]=!![];queues[_0x382f9d[_0xb7d6('0x5')]]['queuecallercompleteAt']=utils[_0xb7d6('0x18')]();if(_0x382f9d[_0xb7d6('0x42')]==_0xb7d6('0x43')){if(!queues[_0x382f9d['uniqueid']]['transfer']){queues[_0x382f9d[_0xb7d6('0x5')]]['queuecallerexitreason']=_0xb7d6('0x44');}}else{queues[_0x382f9d[_0xb7d6('0x5')]]['queuecallerexitreason']=_0xb7d6('0x45')+_0x382f9d['reason']['toUpperCase']();}utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x382f9d[_0xb7d6('0x5')],queues[_0x382f9d['uniqueid']][_0xb7d6('0x24')],_0x382f9d[_0xb7d6('0x3e')],queues[_0x382f9d[_0xb7d6('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x382f9d[_0xb7d6('0x5')]]);}}}catch(_0x900f4d){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x46'),_0x382f9d[_0xb7d6('0x5')]),_0x900f4d);}};exports[_0xb7d6('0x47')]=function(_0x2fa358){try{if(!_[_0xb7d6('0x1b')](queues[_0x2fa358['transfereeuniqueid']])){utils[_0xb7d6('0x12')](util['format'](_0xb7d6('0x48'),_0x2fa358[_0xb7d6('0x5')]),_0x2fa358);queues[_0x2fa358[_0xb7d6('0x49')]][_0xb7d6('0x43')]=!![];queues[_0x2fa358[_0xb7d6('0x49')]][_0xb7d6('0x4a')]='BLIND';queues[_0x2fa358['transfereeuniqueid']][_0xb7d6('0x4b')]=_0x2fa358[_0xb7d6('0x4c')];queues[_0x2fa358[_0xb7d6('0x49')]]['transferuniqueid']=_0x2fa358[_0xb7d6('0x49')];queues[_0x2fa358['transfereeuniqueid']][_0xb7d6('0xa')]=_0xb7d6('0x4d');utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2fa358['uniqueid'],queues[_0x2fa358[_0xb7d6('0x49')]][_0xb7d6('0x24')],_0x2fa358[_0xb7d6('0x49')],_0x2fa358[_0xb7d6('0x4c')]));}}catch(_0xb5bd40){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x48'),_0x2fa358[_0xb7d6('0x5')]),_0xb5bd40);}};exports[_0xb7d6('0x4e')]=function(_0x1abfd1){try{utils['debug'](util['format'](_0xb7d6('0x4f'),_0x1abfd1[_0xb7d6('0x50')]),_0x1abfd1);if(_0x1abfd1[_0xb7d6('0x50')]==_0x1abfd1['origtransfererlinkedid']){if(!_[_0xb7d6('0x1b')](queues[_0x1abfd1[_0xb7d6('0x51')]])){utils[_0xb7d6('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1abfd1[_0xb7d6('0x50')],queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x24')],_0x1abfd1[_0xb7d6('0x52')]));queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x43')]=!![];queues[_0x1abfd1[_0xb7d6('0x51')]][_0xb7d6('0x4a')]='ATTENDED';queues[_0x1abfd1[_0xb7d6('0x51')]]['transferexten']=_0x1abfd1['origtransfererexten'];queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x53')]=_0x1abfd1['origtransfereruniqueid'];queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0xa')]='ATTENDEDTRANSFER';}if(!_[_0xb7d6('0x1b')](queues[_0x1abfd1[_0xb7d6('0x54')]])){if(_0x1abfd1[_0xb7d6('0x55')]&&queues[_0x1abfd1[_0xb7d6('0x55')]]){queues[_0x1abfd1[_0xb7d6('0x55')]]['queuecallerenterreason']=0x1;queues[_0x1abfd1[_0xb7d6('0x49')]]=_[_0xb7d6('0x56')](queues[_0x1abfd1[_0xb7d6('0x55')]]);queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x10')]=_0x1abfd1[_0xb7d6('0x57')];queues[_0x1abfd1[_0xb7d6('0x49')]]['queuecallerenterreason']=0x2;queues[_0x1abfd1['transfereeuniqueid']]['calleridnum']=queues[_0x1abfd1[_0xb7d6('0x51')]][_0xb7d6('0x9')];queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x58')]=queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x58')];queues[_0x1abfd1[_0xb7d6('0x49')]]['queuecallerjoinAt']=utils[_0xb7d6('0x18')]();queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x1d')]=utils[_0xb7d6('0x18')]();queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x37')]=0x0;queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x59')]=0x0;utils['info'](util[_0xb7d6('0x14')](_0xb7d6('0x5a'),_0x1abfd1[_0xb7d6('0x50')],queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x24')],queues[_0x1abfd1[_0xb7d6('0x49')]][_0xb7d6('0x9')],queues[_0x1abfd1['transfereeuniqueid']]['calleridname']));}else{utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x5b'),_0x1abfd1[_0xb7d6('0x50')],queues[_0x1abfd1['origtransfererlinkedid']]['name'],_0x1abfd1[_0xb7d6('0x51')]));queues[_0x1abfd1[_0xb7d6('0x54')]][_0xb7d6('0x10')]=_0x1abfd1['secondtransfererlinkedid'];}}}else if(_0x1abfd1[_0xb7d6('0x5c')]==_0x1abfd1[_0xb7d6('0x51')]){if(!_[_0xb7d6('0x1b')](queues[_0x1abfd1[_0xb7d6('0x54')]])){utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x5d'),_0x1abfd1['origtransfereruniqueid'],queues[_0x1abfd1['origtransfererlinkedid']][_0xb7d6('0x24')],_0x1abfd1[_0xb7d6('0x5c')],_0x1abfd1[_0xb7d6('0x5e')]));queues[_0x1abfd1[_0xb7d6('0x54')]][_0xb7d6('0x43')]=!![];queues[_0x1abfd1[_0xb7d6('0x54')]][_0xb7d6('0x4a')]=_0xb7d6('0x5f');queues[_0x1abfd1[_0xb7d6('0x54')]]['transferexten']=_0x1abfd1[_0xb7d6('0x5e')];queues[_0x1abfd1[_0xb7d6('0x54')]][_0xb7d6('0x53')]=_0x1abfd1['secondtransfereruniqueid'];queues[_0x1abfd1[_0xb7d6('0x54')]][_0xb7d6('0xa')]=_0xb7d6('0x60');}if(!_[_0xb7d6('0x1b')](queues[_0x1abfd1['secondtransfererlinkedid']])){if(_0x1abfd1[_0xb7d6('0x61')]&&queues[_0x1abfd1[_0xb7d6('0x61')]]){queues[_0x1abfd1[_0xb7d6('0x61')]]['queuecallerenterreason']=0x1;queues[_0x1abfd1[_0xb7d6('0x57')]]=_['clone'](queues[_0x1abfd1['transfertargetlinkedid']]);queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x10')]=_0x1abfd1['transfertargetuniqueid'];queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x62')]=0x2;queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x9')]=queues[_0x1abfd1['origtransfererlinkedid']]['calleridnum'];queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x58')]=queues[_0x1abfd1['origtransfererlinkedid']]['calleridname'];queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x39')]=utils[_0xb7d6('0x18')]();queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x1d')]=utils[_0xb7d6('0x18')]();queues[_0x1abfd1['transfertargetuniqueid']][_0xb7d6('0x37')]=0x0;queues[_0x1abfd1[_0xb7d6('0x57')]]['mohtime']=0x0;utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x63'),_0x1abfd1[_0xb7d6('0x50')],queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x24')],queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x10')],queues[_0x1abfd1['transfertargetuniqueid']][_0xb7d6('0x9')],queues[_0x1abfd1[_0xb7d6('0x57')]][_0xb7d6('0x58')]));}else{utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x5b'),_0x1abfd1[_0xb7d6('0x50')],queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x24')],_0x1abfd1[_0xb7d6('0x54')]));queues[_0x1abfd1['secondtransfererlinkedid']][_0xb7d6('0x10')]=_0x1abfd1[_0xb7d6('0x54')];}}}}catch(_0x2146e5){utils[_0xb7d6('0x19')](util['format'](_0xb7d6('0x4f'),_0x1abfd1[_0xb7d6('0x50')]),_0x2146e5);}};exports[_0xb7d6('0x64')]=function(_0x184de7){try{if(!_[_0xb7d6('0x1b')](queues[_0x184de7[_0xb7d6('0x5')]])){utils[_0xb7d6('0x12')](util[_0xb7d6('0x14')](_0xb7d6('0x65'),_0x184de7[_0xb7d6('0x5')]),_0x184de7);queues[_0x184de7['uniqueid']][_0xb7d6('0x66')]=utils['now']();utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x67'),_0x184de7[_0xb7d6('0x5')],queues[_0x184de7['uniqueid']][_0xb7d6('0x24')],queues[_0x184de7[_0xb7d6('0x5')]][_0xb7d6('0x66')]));}}catch(_0x2998e6){utils[_0xb7d6('0x19')](util['format'](_0xb7d6('0x65'),_0x184de7[_0xb7d6('0x5')]),_0x2998e6);}};exports[_0xb7d6('0x68')]=function(_0x3d8fcc){try{if(!_[_0xb7d6('0x1b')](queues[_0x3d8fcc[_0xb7d6('0x5')]])){if(!_['isNil'](queues[_0x3d8fcc[_0xb7d6('0x5')]]['musiconholdstartAt'])){utils['debug'](util[_0xb7d6('0x14')](_0xb7d6('0x69'),_0x3d8fcc[_0xb7d6('0x5')]),_0x3d8fcc);queues[_0x3d8fcc[_0xb7d6('0x5')]][_0xb7d6('0x59')]+=utils[_0xb7d6('0x38')](utils[_0xb7d6('0x18')](),queues[_0x3d8fcc[_0xb7d6('0x5')]][_0xb7d6('0x66')]);utils[_0xb7d6('0x3')](util[_0xb7d6('0x14')](_0xb7d6('0x6a'),_0x3d8fcc[_0xb7d6('0x5')],queues[_0x3d8fcc['uniqueid']]['name'],queues[_0x3d8fcc['uniqueid']][_0xb7d6('0x59')]));delete queues[_0x3d8fcc[_0xb7d6('0x5')]][_0xb7d6('0x66')];}}}catch(_0x59f174){utils[_0xb7d6('0x19')](util[_0xb7d6('0x14')](_0xb7d6('0x69'),_0x3d8fcc[_0xb7d6('0x5')]),_0x59f174);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 96c4373..201b533 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 _0xc768=['error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','find','push','hangup','isNil','[%s][recordings][hangup]','calleridnum','connectedlinenum','connectedlinename','type','monitors','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','uniqueid','getUserByInternal','accountcode','then','membername','UserId','request','CreateVoiceRecording','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','debug','[%s][recordings][newstate]','channelstate','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x58e2d2,_0x4ff59b){var _0x249768=function(_0x1c9e31){while(--_0x1c9e31){_0x58e2d2['push'](_0x58e2d2['shift']());}};_0x249768(++_0x4ff59b);}(_0xc768,0x14b));var _0x8c76=function(_0x22682c,_0x3d0178){_0x22682c=_0x22682c-0x0;var _0x34e654=_0xc768[_0x22682c];return _0x34e654;};'use strict';var _=require(_0x8c76('0x0'));var util=require(_0x8c76('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x261614){utils['info'](util[_0x8c76('0x2')]('[%s][recordings][writeDB]',_0x261614[_0x8c76('0x3')]));if(_0x261614['accountcode']){utils[_0x8c76('0x4')](_0x261614[_0x8c76('0x5')])[_0x8c76('0x6')](function(_0x2abd6f){if(_0x2abd6f){_0x261614[_0x8c76('0x7')]=_0x2abd6f['name'];_0x261614[_0x8c76('0x8')]=_0x2abd6f['id'];}utils[_0x8c76('0x9')](_0x8c76('0xa'),_0x261614);});}else{utils[_0x8c76('0x9')](_0x8c76('0xa'),_0x261614);}}exports['newchannel']=function(_0x39e2b7){try{utils['debug'](util[_0x8c76('0x2')]('[%s][recordings][newchannel]',_0x39e2b7['uniqueid']),_0x39e2b7);if(_0x39e2b7[_0x8c76('0x3')]==_0x39e2b7[_0x8c76('0xb')]){utils[_0x8c76('0xc')](util[_0x8c76('0x2')](_0x8c76('0xd'),_0x39e2b7['uniqueid'],_0x39e2b7[_0x8c76('0xe')],_0x39e2b7[_0x8c76('0xf')]));recordings[_0x39e2b7['uniqueid']]={'uniqueid':_0x39e2b7[_0x8c76('0x3')],'accountcode':_0x39e2b7['accountcode'],'exten':_0x39e2b7[_0x8c76('0xf')],'context':_0x39e2b7['context'],'channel':_0x39e2b7['channel'],'monitors':[]};}}catch(_0x52c8d9){utils['error'](util['format']('[%s][recordings][newchannel]',_0x39e2b7[_0x8c76('0x3')]),_0x52c8d9);}};exports[_0x8c76('0x10')]=function(_0x1a5923){try{utils[_0x8c76('0x11')](util[_0x8c76('0x2')](_0x8c76('0x12'),_0x1a5923[_0x8c76('0x3')]),_0x1a5923);if(!_['isNil'](recordings[_0x1a5923[_0x8c76('0x3')]])&&_0x1a5923[_0x8c76('0x13')]==0x6){utils[_0x8c76('0xc')](util[_0x8c76('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x1a5923[_0x8c76('0x3')],_0x1a5923[_0x8c76('0xe')],_0x1a5923[_0x8c76('0x14')]));}else if(!_['isNil'](recordings[_0x1a5923[_0x8c76('0xb')]])&&_0x1a5923[_0x8c76('0x13')]==0x6&&_0x1a5923[_0x8c76('0xe')]!=_0x8c76('0x15')){utils[_0x8c76('0xc')](util['format'](_0x8c76('0x16'),_0x1a5923[_0x8c76('0x3')],_0x1a5923[_0x8c76('0xb')],_0x1a5923[_0x8c76('0xe')],_0x1a5923[_0x8c76('0x14')]));recordings[_0x1a5923['linkedid']][_0x8c76('0x5')]=_0x1a5923[_0x8c76('0x5')];}}catch(_0x17815c){utils[_0x8c76('0x17')](util[_0x8c76('0x2')](_0x8c76('0x12'),_0x1a5923[_0x8c76('0x3')]),_0x17815c);}};exports[_0x8c76('0x18')]=function(_0x16f024){try{if(!_['isNil'](_0x16f024['variable'])&&!_['isNil'](_0x16f024[_0x8c76('0x19')][_0x8c76('0x1a')])){utils['debug'](util['format'](_0x8c76('0x1b'),_0x16f024[_0x8c76('0x3')]),_0x16f024);utils[_0x8c76('0xc')](util[_0x8c76('0x2')](_0x8c76('0x1c'),_0x16f024[_0x8c76('0x3')],_0x16f024[_0x8c76('0x19')],_0x16f024['value']));if(_[_0x8c76('0x1d')](_0x16f024[_0x8c76('0x1e')],_0x8c76('0x1f'))){_0x16f024[_0x8c76('0x1e')]=_0x16f024[_0x8c76('0x1e')][_0x8c76('0x20')](_0x8c76('0x1f'),'.WAV');}if(recordings[_0x16f024[_0x8c76('0xb')]]){var _0x10ad38=_[_0x8c76('0x21')](recordings[_0x16f024[_0x8c76('0xb')]]['monitors'],{'value':_0x16f024[_0x8c76('0x1e')]});if(_['isNil'](_0x10ad38)){recordings[_0x16f024[_0x8c76('0xb')]]['monitors'][_0x8c76('0x22')]({'value':_0x16f024[_0x8c76('0x1e')]});}}}}catch(_0x23df5e){utils['error'](util[_0x8c76('0x2')](_0x8c76('0x1b'),_0x16f024[_0x8c76('0x3')]),_0x23df5e);}};exports[_0x8c76('0x23')]=function(_0x5450cb){try{if(!_[_0x8c76('0x24')](recordings[_0x5450cb[_0x8c76('0x3')]])){utils[_0x8c76('0x11')](util[_0x8c76('0x2')](_0x8c76('0x25'),_0x5450cb[_0x8c76('0x3')]),_0x5450cb);utils[_0x8c76('0xc')](util[_0x8c76('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5450cb['uniqueid'],_0x5450cb[_0x8c76('0x26')],_0x5450cb['calleridname'],_0x5450cb['cause-txt']));recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x26')]=_0x5450cb['calleridnum'];recordings[_0x5450cb[_0x8c76('0x3')]]['calleridname']=_0x5450cb['calleridname'];recordings[_0x5450cb[_0x8c76('0x3')]]['connectedlinenum']=_0x5450cb[_0x8c76('0x27')];recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x28')]=_0x5450cb['connectedlinename'];if(recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x29')]=='outbound'&&recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x5')]){recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x27')]=recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x5')];recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x28')]='';}recordings[_0x5450cb[_0x8c76('0x3')]][_0x8c76('0x2a')]['forEach'](function(_0x1f4b65){var _0x1088d5=_[_0x8c76('0x2b')](recordings[_0x5450cb[_0x8c76('0x3')]]);_0x1088d5[_0x8c76('0x1e')]=_0x1f4b65[_0x8c76('0x1e')];writeDB(_0x1088d5);});delete recordings[_0x5450cb[_0x8c76('0x3')]];}}catch(_0x5686d6){utils[_0x8c76('0x17')](util['format'](_0x8c76('0x25'),_0x5450cb[_0x8c76('0x3')]),_0x5686d6);}};exports[_0x8c76('0x2c')]=function(_0x510e77){try{if(!_[_0x8c76('0x24')](recordings[_0x510e77[_0x8c76('0x3')]])){utils[_0x8c76('0x11')](util[_0x8c76('0x2')](_0x8c76('0x2d'),_0x510e77[_0x8c76('0x3')]),_0x510e77);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x510e77[_0x8c76('0x3')],_0x510e77[_0x8c76('0x2e')],_0x510e77[_0x8c76('0x2f')]));if(_0x510e77[_0x8c76('0x2e')][_0x8c76('0x30')]()==_0x8c76('0x31')&&_[_0x8c76('0x32')](_0x510e77[_0x8c76('0x2f')][_0x8c76('0x30')](),_0x8c76('0x33'))){var _0x3a0c7d=_0x510e77[_0x8c76('0x2f')][_0x8c76('0x34')]('=');var _0x2f39e8=_0x3a0c7d[0x0][_0x8c76('0x35')](_0x3a0c7d[0x0][_0x8c76('0x36')]('(')+0x1,_0x3a0c7d[0x0][_0x8c76('0x36')](')'));var _0x4d9cd5=_0x3a0c7d[0x1];recordings[_0x510e77['uniqueid']][_0x2f39e8]=_0x4d9cd5;}}}catch(_0x494669){utils['error'](util['format']('[%s][recordings][newexten]',_0x510e77[_0x8c76('0x3')]),_0x494669);}};exports[_0x8c76('0x37')]=function(_0x2bddc4){try{if(!_['isNil'](recordings[_0x2bddc4[_0x8c76('0x3')]])){utils[_0x8c76('0x11')](util[_0x8c76('0x2')](_0x8c76('0x38'),_0x2bddc4[_0x8c76('0x3')]),_0x2bddc4);utils[_0x8c76('0xc')](util[_0x8c76('0x2')](_0x8c76('0x39'),_0x2bddc4[_0x8c76('0x3')],_0x2bddc4[_0x8c76('0x3a')]));recordings[_0x2bddc4[_0x8c76('0x3')]][_0x8c76('0x3a')]=_0x2bddc4[_0x8c76('0x3a')];}}catch(_0x4c1876){utils['error'](util[_0x8c76('0x2')](_0x8c76('0x38'),_0x2bddc4['uniqueid']),_0x4c1876);}}; \ No newline at end of file +var _0x6d26=['connectedlinename','type','monitors','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d26,0x8f));var _0x66d2=function(_0xaefb05,_0xb1f880){_0xaefb05=_0xaefb05-0x0;var _0x1f6f1b=_0x6d26[_0xaefb05];return _0x1f6f1b;};'use strict';var _=require(_0x66d2('0x0'));var util=require(_0x66d2('0x1'));var utils=require(_0x66d2('0x2'));var recordings={};function writeDB(_0x53b37c){utils[_0x66d2('0x3')](util[_0x66d2('0x4')](_0x66d2('0x5'),_0x53b37c[_0x66d2('0x6')]));if(_0x53b37c['accountcode']){utils['getUserByInternal'](_0x53b37c[_0x66d2('0x7')])['then'](function(_0x40a558){if(_0x40a558){_0x53b37c[_0x66d2('0x8')]=_0x40a558[_0x66d2('0x9')];_0x53b37c[_0x66d2('0xa')]=_0x40a558['id'];}utils[_0x66d2('0xb')](_0x66d2('0xc'),_0x53b37c);});}else{utils[_0x66d2('0xb')](_0x66d2('0xc'),_0x53b37c);}}exports[_0x66d2('0xd')]=function(_0x37e3b8){try{utils['debug'](util[_0x66d2('0x4')]('[%s][recordings][newchannel]',_0x37e3b8['uniqueid']),_0x37e3b8);if(_0x37e3b8[_0x66d2('0x6')]==_0x37e3b8[_0x66d2('0xe')]){utils[_0x66d2('0x3')](util[_0x66d2('0x4')](_0x66d2('0xf'),_0x37e3b8[_0x66d2('0x6')],_0x37e3b8[_0x66d2('0x10')],_0x37e3b8[_0x66d2('0x11')]));recordings[_0x37e3b8[_0x66d2('0x6')]]={'uniqueid':_0x37e3b8[_0x66d2('0x6')],'accountcode':_0x37e3b8[_0x66d2('0x7')],'exten':_0x37e3b8[_0x66d2('0x11')],'context':_0x37e3b8[_0x66d2('0x10')],'channel':_0x37e3b8[_0x66d2('0x12')],'monitors':[]};}}catch(_0x262d84){utils[_0x66d2('0x13')](util[_0x66d2('0x4')](_0x66d2('0x14'),_0x37e3b8['uniqueid']),_0x262d84);}};exports[_0x66d2('0x15')]=function(_0x2db854){try{utils[_0x66d2('0x16')](util[_0x66d2('0x4')](_0x66d2('0x17'),_0x2db854['uniqueid']),_0x2db854);if(!_[_0x66d2('0x18')](recordings[_0x2db854[_0x66d2('0x6')]])&&_0x2db854['channelstate']==0x6){utils[_0x66d2('0x3')](util[_0x66d2('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2db854[_0x66d2('0x6')],_0x2db854['context'],_0x2db854[_0x66d2('0x12')]));}else if(!_[_0x66d2('0x18')](recordings[_0x2db854['linkedid']])&&_0x2db854[_0x66d2('0x19')]==0x6&&_0x2db854[_0x66d2('0x10')]!=_0x66d2('0x1a')){utils['info'](util[_0x66d2('0x4')](_0x66d2('0x1b'),_0x2db854[_0x66d2('0x6')],_0x2db854[_0x66d2('0xe')],_0x2db854['context'],_0x2db854[_0x66d2('0x12')]));recordings[_0x2db854[_0x66d2('0xe')]][_0x66d2('0x7')]=_0x2db854['accountcode'];}}catch(_0x4ef3a0){utils[_0x66d2('0x13')](util[_0x66d2('0x4')](_0x66d2('0x17'),_0x2db854[_0x66d2('0x6')]),_0x4ef3a0);}};exports[_0x66d2('0x1c')]=function(_0x1debc3){try{if(!_[_0x66d2('0x18')](_0x1debc3[_0x66d2('0x1d')])&&!_[_0x66d2('0x18')](_0x1debc3[_0x66d2('0x1d')][_0x66d2('0x1e')])){utils[_0x66d2('0x16')](util[_0x66d2('0x4')]('[%s][recordings][varset]',_0x1debc3['uniqueid']),_0x1debc3);utils[_0x66d2('0x3')](util[_0x66d2('0x4')](_0x66d2('0x1f'),_0x1debc3['uniqueid'],_0x1debc3[_0x66d2('0x1d')],_0x1debc3[_0x66d2('0x20')]));if(_[_0x66d2('0x21')](_0x1debc3[_0x66d2('0x20')],_0x66d2('0x22'))){_0x1debc3[_0x66d2('0x20')]=_0x1debc3['value'][_0x66d2('0x23')](_0x66d2('0x22'),_0x66d2('0x24'));}if(recordings[_0x1debc3[_0x66d2('0xe')]]){var _0x45b6c7=_[_0x66d2('0x25')](recordings[_0x1debc3['linkedid']]['monitors'],{'value':_0x1debc3[_0x66d2('0x20')]});if(_[_0x66d2('0x18')](_0x45b6c7)){recordings[_0x1debc3[_0x66d2('0xe')]]['monitors'][_0x66d2('0x26')]({'value':_0x1debc3[_0x66d2('0x20')]});}}}}catch(_0x1328fc){utils['error'](util[_0x66d2('0x4')](_0x66d2('0x27'),_0x1debc3[_0x66d2('0x6')]),_0x1328fc);}};exports[_0x66d2('0x28')]=function(_0x43149f){try{if(!_['isNil'](recordings[_0x43149f[_0x66d2('0x6')]])){utils[_0x66d2('0x16')](util[_0x66d2('0x4')](_0x66d2('0x29'),_0x43149f[_0x66d2('0x6')]),_0x43149f);utils[_0x66d2('0x3')](util[_0x66d2('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x43149f['uniqueid'],_0x43149f[_0x66d2('0x2a')],_0x43149f[_0x66d2('0x2b')],_0x43149f[_0x66d2('0x2c')]));recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x2a')]=_0x43149f['calleridnum'];recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x2b')]=_0x43149f[_0x66d2('0x2b')];recordings[_0x43149f['uniqueid']][_0x66d2('0x2d')]=_0x43149f[_0x66d2('0x2d')];recordings[_0x43149f['uniqueid']]['connectedlinename']=_0x43149f[_0x66d2('0x2e')];if(recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x2f')]=='outbound'&&recordings[_0x43149f[_0x66d2('0x6')]]['accountcode']){recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x2d')]=recordings[_0x43149f['uniqueid']][_0x66d2('0x7')];recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x2e')]='';}recordings[_0x43149f[_0x66d2('0x6')]][_0x66d2('0x30')][_0x66d2('0x31')](function(_0x11fc65){var _0xa37b56=_[_0x66d2('0x32')](recordings[_0x43149f['uniqueid']]);_0xa37b56[_0x66d2('0x20')]=_0x11fc65[_0x66d2('0x20')];writeDB(_0xa37b56);});delete recordings[_0x43149f['uniqueid']];}}catch(_0x422342){utils[_0x66d2('0x13')](util[_0x66d2('0x4')](_0x66d2('0x29'),_0x43149f['uniqueid']),_0x422342);}};exports[_0x66d2('0x33')]=function(_0x586ad3){try{if(!_[_0x66d2('0x18')](recordings[_0x586ad3['uniqueid']])){utils[_0x66d2('0x16')](util[_0x66d2('0x4')](_0x66d2('0x34'),_0x586ad3[_0x66d2('0x6')]),_0x586ad3);utils[_0x66d2('0x3')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x586ad3[_0x66d2('0x6')],_0x586ad3[_0x66d2('0x35')],_0x586ad3[_0x66d2('0x36')]));if(_0x586ad3[_0x66d2('0x35')][_0x66d2('0x37')]()==_0x66d2('0x38')&&_['startsWith'](_0x586ad3['appdata'][_0x66d2('0x37')](),_0x66d2('0x39'))){var _0x1b233f=_0x586ad3['appdata'][_0x66d2('0x3a')]('=');var _0x1bc564=_0x1b233f[0x0][_0x66d2('0x3b')](_0x1b233f[0x0][_0x66d2('0x3c')]('(')+0x1,_0x1b233f[0x0][_0x66d2('0x3c')](')'));var _0x452ebd=_0x1b233f[0x1];recordings[_0x586ad3[_0x66d2('0x6')]][_0x1bc564]=_0x452ebd;}}}catch(_0x10f2eb){utils['error'](util[_0x66d2('0x4')](_0x66d2('0x34'),_0x586ad3[_0x66d2('0x6')]),_0x10f2eb);}};exports['queuecallerjoin']=function(_0x6bbf6c){try{if(!_['isNil'](recordings[_0x6bbf6c[_0x66d2('0x6')]])){utils[_0x66d2('0x16')](util['format']('[%s][recordings][queuecallerjoin]',_0x6bbf6c[_0x66d2('0x6')]),_0x6bbf6c);utils[_0x66d2('0x3')](util[_0x66d2('0x4')](_0x66d2('0x3d'),_0x6bbf6c[_0x66d2('0x6')],_0x6bbf6c[_0x66d2('0x3e')]));recordings[_0x6bbf6c['uniqueid']][_0x66d2('0x3e')]=_0x6bbf6c[_0x66d2('0x3e')];}}catch(_0x3a3bb2){utils[_0x66d2('0x13')](util[_0x66d2('0x4')]('[%s][recordings][queuecallerjoin]',_0x6bbf6c['uniqueid']),_0x3a3bb2);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 94fbee9..a8be334 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 _0x40be=['origtransferercontext','isNil','transfertargetchannel','transfertargetaccountcode','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x40be,0x100));var _0xe40b=function(_0x39ad9a,_0x34ca69){_0x39ad9a=_0x39ad9a-0x0;var _0x2220ad=_0x40be[_0x39ad9a];return _0x2220ad;};'use strict';var _=require(_0xe40b('0x0'));var util=require(_0xe40b('0x1'));var utils=require(_0xe40b('0x2'));function writeDB(_0x3100a7){utils[_0xe40b('0x3')](util['format'](_0xe40b('0x4'),_0x3100a7[_0xe40b('0x5')]===_0xe40b('0x6')?_0x3100a7[_0xe40b('0x7')]:_0x3100a7[_0xe40b('0x8')],_0x3100a7[_0xe40b('0x5')]));utils[_0xe40b('0x9')](_0xe40b('0xa'),_0x3100a7);}exports[_0xe40b('0xb')]=function(_0x105a3e){try{utils[_0xe40b('0xc')](util[_0xe40b('0xd')]('[%s][transfers][blindtransfer]',_0x105a3e[_0xe40b('0x8')]),_0x105a3e);utils[_0xe40b('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x105a3e[_0xe40b('0x8')],_0x105a3e[_0xe40b('0xe')],_0x105a3e[_0xe40b('0xf')],_0x105a3e[_0xe40b('0x10')],_0x105a3e[_0xe40b('0x11')]));_0x105a3e[_0xe40b('0x5')]=_0xe40b('0x12');writeDB(_0x105a3e);}catch(_0x4428ce){utils[_0xe40b('0x13')](util[_0xe40b('0xd')]('[%s][transfers][blindtransfer]',_0x105a3e[_0xe40b('0x8')]),_0x4428ce);}};exports[_0xe40b('0x14')]=function(_0x23c760){try{utils[_0xe40b('0xc')](util[_0xe40b('0xd')](_0xe40b('0x15'),_0x23c760['origtransfereruniqueid']),_0x23c760);utils[_0xe40b('0x3')](util['format'](_0xe40b('0x16'),_0x23c760[_0xe40b('0x7')],_0x23c760['origtransferercalleridnum'],_0x23c760['origtransferercalleridname'],_0x23c760['transfertargetcalleridnum'],_0x23c760[_0xe40b('0x17')]));_0x23c760=_[_0xe40b('0x18')](_0x23c760,{'transfererchannel':_0x23c760['origtransfererchannel'],'transferercalleridnum':_0x23c760[_0xe40b('0x19')],'transferercalleridname':_0x23c760[_0xe40b('0x1a')],'transfererconnectedlinenum':_0x23c760[_0xe40b('0x1b')],'transfererconnectedlinename':_0x23c760[_0xe40b('0x1c')],'transfereraccountcode':_0x23c760['origtransfereraccountcode'],'transferercontext':_0x23c760[_0xe40b('0x1d')],'transfererexten':_0x23c760[_0xe40b('0x1e')],'transfererlinkedid':_0x23c760[_0xe40b('0x1f')],'context':_0x23c760[_0xe40b('0x20')],'extension':_0x23c760['origtransfererexten'],'type':_0xe40b('0x6')});if(_[_0xe40b('0x21')](_0x23c760['transfereechannel'])){_0x23c760=_[_0xe40b('0x18')](_0x23c760,{'transfereechannel':_0x23c760[_0xe40b('0x22')],'transfereecalleridnum':_0x23c760['transfertargetcalleridnum'],'transfereecalleridname':_0x23c760['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x23c760['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x23c760['transfertargetconnectedlinename'],'transfereeaccountcode':_0x23c760[_0xe40b('0x23')],'transfereecontext':_0x23c760['transfertargetcontext'],'transfereeexten':_0x23c760['transfertargetexten'],'transfereelinkedid':_0x23c760['transfertargetlinkedid']});}writeDB(_0x23c760);}catch(_0x3dd9ea){utils[_0xe40b('0x13')](util[_0xe40b('0xd')](_0xe40b('0x15'),_0x23c760[_0xe40b('0x7')]),_0x3dd9ea);}}; \ No newline at end of file +var _0x54ec=['transferercalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x16a333,_0xc90957){var _0x37c3c1=function(_0x493a8e){while(--_0x493a8e){_0x16a333['push'](_0x16a333['shift']());}};_0x37c3c1(++_0xc90957);}(_0x54ec,0x1c8));var _0xc54e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x54ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc54e('0x0'));var util=require('util');var utils=require(_0xc54e('0x1'));function writeDB(_0x209efa){utils[_0xc54e('0x2')](util['format'](_0xc54e('0x3'),_0x209efa[_0xc54e('0x4')]===_0xc54e('0x5')?_0x209efa[_0xc54e('0x6')]:_0x209efa[_0xc54e('0x7')],_0x209efa[_0xc54e('0x4')]));utils[_0xc54e('0x8')]('CreateVoiceTransferReport',_0x209efa);}exports['blindtransfer']=function(_0x5b5e6e){try{utils[_0xc54e('0x9')](util[_0xc54e('0xa')]('[%s][transfers][blindtransfer]',_0x5b5e6e[_0xc54e('0x7')]),_0x5b5e6e);utils['info'](util['format'](_0xc54e('0xb'),_0x5b5e6e[_0xc54e('0x7')],_0x5b5e6e['transferercalleridnum'],_0x5b5e6e[_0xc54e('0xc')],_0x5b5e6e['transfereecalleridnum'],_0x5b5e6e['transfereecalleridname']));_0x5b5e6e['type']=_0xc54e('0xd');writeDB(_0x5b5e6e);}catch(_0x3f70ee){utils[_0xc54e('0xe')](util['format']('[%s][transfers][blindtransfer]',_0x5b5e6e[_0xc54e('0x7')]),_0x3f70ee);}};exports[_0xc54e('0xf')]=function(_0x21c899){try{utils[_0xc54e('0x9')](util[_0xc54e('0xa')](_0xc54e('0x10'),_0x21c899[_0xc54e('0x6')]),_0x21c899);utils['info'](util[_0xc54e('0xa')](_0xc54e('0x11'),_0x21c899[_0xc54e('0x6')],_0x21c899[_0xc54e('0x12')],_0x21c899['origtransferercalleridname'],_0x21c899['transfertargetcalleridnum'],_0x21c899['transfertargetcalleridname']));_0x21c899=_[_0xc54e('0x13')](_0x21c899,{'transfererchannel':_0x21c899['origtransfererchannel'],'transferercalleridnum':_0x21c899[_0xc54e('0x12')],'transferercalleridname':_0x21c899[_0xc54e('0x14')],'transfererconnectedlinenum':_0x21c899[_0xc54e('0x15')],'transfererconnectedlinename':_0x21c899[_0xc54e('0x16')],'transfereraccountcode':_0x21c899['origtransfereraccountcode'],'transferercontext':_0x21c899[_0xc54e('0x17')],'transfererexten':_0x21c899[_0xc54e('0x18')],'transfererlinkedid':_0x21c899[_0xc54e('0x19')],'context':_0x21c899[_0xc54e('0x1a')],'extension':_0x21c899[_0xc54e('0x1b')],'type':_0xc54e('0x5')});if(_[_0xc54e('0x1c')](_0x21c899[_0xc54e('0x1d')])){_0x21c899=_[_0xc54e('0x13')](_0x21c899,{'transfereechannel':_0x21c899[_0xc54e('0x1e')],'transfereecalleridnum':_0x21c899[_0xc54e('0x1f')],'transfereecalleridname':_0x21c899[_0xc54e('0x20')],'transfereeconnectedlinenum':_0x21c899['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x21c899['transfertargetconnectedlinename'],'transfereeaccountcode':_0x21c899[_0xc54e('0x21')],'transfereecontext':_0x21c899[_0xc54e('0x22')],'transfereeexten':_0x21c899['transfertargetexten'],'transfereelinkedid':_0x21c899[_0xc54e('0x23')]});}writeDB(_0x21c899);}catch(_0x53ddf9){utils['error'](util[_0xc54e('0xa')](_0xc54e('0x10'),_0x21c899[_0xc54e('0x6')]),_0x53ddf9);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1f68e06..3f003a2 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 _0xb5aa=['subtractTime','subtract','seconds','sumTime','now','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','info','debug','inspect','request','then','[utils][request]\x20name:%s','error','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','length','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5aa,0x121));var _0xab5a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb5aa[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require(_0xab5a('0x0'));var jayson=require('jayson/promise');var moment=require(_0xab5a('0x1'));var util=require(_0xab5a('0x2'));var client=jayson[_0xab5a('0x3')][_0xab5a('0x4')]({'port':0x2329});var logger=require(_0xab5a('0x5'))('xdr');exports[_0xab5a('0x6')]=function(_0x1ecd54,_0x3a4c8a){logger[_0xab5a('0x6')](_0x1ecd54,_0x3a4c8a?util['inspect'](_0x3a4c8a,{'showHidden':![],'depth':null}):'');};exports[_0xab5a('0x7')]=function(_0x21c70f,_0x428015){logger[_0xab5a('0x7')](_0x21c70f,_0x428015?util[_0xab5a('0x8')](_0x428015,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x415edb,_0x4b8109){logger['error'](_0x415edb,_0x4b8109?util[_0xab5a('0x8')](_0x4b8109,{'showHidden':![],'depth':null}):'');};exports[_0xab5a('0x9')]=function(_0x2e6c44,_0x5b4857){return client[_0xab5a('0x9')](_0x2e6c44,{'body':_0x5b4857})[_0xab5a('0xa')](function(_0x36cc7b){logger[_0xab5a('0x7')](_0xab5a('0xb'),_0x2e6c44,_0x36cc7b?util[_0xab5a('0x8')](_0x36cc7b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x3aa784){logger[_0xab5a('0xc')](_0xab5a('0xb'),_0x2e6c44,_0x3aa784?util[_0xab5a('0x8')](_0x3aa784,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4f5565){return client[_0xab5a('0x9')](_0xab5a('0xd'),{'options':{'raw':!![],'attributes':['id',_0xab5a('0xe'),'name',_0xab5a('0xf')],'where':_0x4f5565,'limit':0x1}})[_0xab5a('0xa')](function(_0x27bf4c){logger[_0xab5a('0x7')](_0xab5a('0x10'),JSON[_0xab5a('0x11')](_0x4f5565),_0x27bf4c?util['inspect'](_0x27bf4c,{'showHidden':![],'depth':null}):'');return _0x27bf4c['result'][_0xab5a('0x12')]?_0x27bf4c[_0xab5a('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x307728){return new BPromise(function(_0x38ca5a,_0x2d3337){if(_0x307728){return getUser({'internal':_0x307728})[_0xab5a('0xa')](function(_0x464d97){logger[_0xab5a('0x6')](_0xab5a('0x14'),_0x307728,_0x464d97?_0xab5a('0x15'):_0xab5a('0x16'));return _0x38ca5a(_0x464d97);})[_0xab5a('0x17')](function(_0x205e09){logger[_0xab5a('0xc')](_0xab5a('0x18'),_0x205e09?util['inspect'](_0x205e09,{'showHidden':![],'depth':null}):'');return _0x38ca5a(null);});}return _0x38ca5a(null);});};exports[_0xab5a('0x19')]=function(_0x112760){return new BPromise(function(_0x301fe4,_0x239085){if(_0x112760){return getUser({'interface':_0x112760})[_0xab5a('0xa')](function(_0x25512c){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x112760,_0x25512c?_0xab5a('0x15'):_0xab5a('0x16'));return _0x301fe4(_0x25512c);})[_0xab5a('0x17')](function(_0xa9c32){logger[_0xab5a('0xc')](_0xab5a('0x1a'),_0xa9c32?util[_0xab5a('0x8')](_0xa9c32,{'showHidden':![],'depth':null}):'');return _0x301fe4(null);});}return _0x301fe4(null);});};exports[_0xab5a('0x1b')]=function(_0x4b24bb){return new BPromise(function(_0xe7b42,_0x3823fc){if(_0x4b24bb){return getUser({'name':_0x4b24bb})[_0xab5a('0xa')](function(_0x50a4e7){logger['info'](_0xab5a('0x1c'),_0x4b24bb,_0x50a4e7?_0xab5a('0x15'):'notfound');return _0xe7b42(_0x50a4e7);})[_0xab5a('0x17')](function(_0x4c0760){logger[_0xab5a('0xc')](_0xab5a('0x1d'),_0x4c0760?util[_0xab5a('0x8')](_0x4c0760,{'showHidden':![],'depth':null}):'');return _0xe7b42(null);});}return _0xe7b42(null);});};exports[_0xab5a('0x1e')]=function(_0x1ee35d){return new BPromise(function(_0x9497c,_0x58bc58){if(_0x1ee35d){return client[_0xab5a('0x9')](_0xab5a('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xab5a('0x20'),_0xab5a('0x21'),'acw','acwTimeout'],'where':{'name':_0x1ee35d},'limit':0x1}})['then'](function(_0x43a1ba){logger['debug'](_0xab5a('0x22'),_0x1ee35d,_0x43a1ba?util[_0xab5a('0x8')](_0x43a1ba,{'showHidden':![],'depth':null}):'');logger[_0xab5a('0x6')](_0xab5a('0x23'),_0x1ee35d,_0x43a1ba?_0xab5a('0x15'):_0xab5a('0x16'));return _0x9497c(_0x43a1ba[_0xab5a('0x13')][_0xab5a('0x12')]?_0x43a1ba[_0xab5a('0x13')][0x0]:null);})[_0xab5a('0x17')](function(_0x39d348){logger[_0xab5a('0xc')](_0xab5a('0x24'),_0x39d348?util[_0xab5a('0x8')](_0x39d348,{'showHidden':![],'depth':null}):'');return _0x9497c(null);});}return _0x9497c(null);});};exports[_0xab5a('0x25')]=function(_0x5831ff,_0x610492){return moment(_0x5831ff)['add'](_0x610492,'seconds')[_0xab5a('0x26')](_0xab5a('0x27'));};exports[_0xab5a('0x28')]=function(_0x7bfd48,_0x51de71){return moment(_0x7bfd48)[_0xab5a('0x29')](_0x51de71,_0xab5a('0x2a'))[_0xab5a('0x26')](_0xab5a('0x27'));};exports['diffTime']=function(_0x21e7e7,_0x13d358){return moment(_0x21e7e7)['diff'](moment(_0x13d358),_0xab5a('0x2a'));};exports[_0xab5a('0x2b')]=function(_0x48bbdd,_0x227ac8){return parseInt(_0x48bbdd,0xa)+parseInt(_0x227ac8,0xa);};exports[_0xab5a('0x2c')]=function(){return moment()[_0xab5a('0x26')](_0xab5a('0x27'));};exports[_0xab5a('0x2d')]=function(_0x35ddf1,_0x278801){if(_0x278801){return moment(_0x35ddf1)['isAfter'](_0x278801);}return!![];};exports[_0xab5a('0x2e')]=function(_0x2e45e3,_0x3dd534){if(_0x3dd534){return moment(_0x2e45e3)[_0xab5a('0x2e')](_0x3dd534);}else if(_0x2e45e3){return!![];}return![];}; \ No newline at end of file +var _0x3bf5=['diffTime','diff','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','bluebird','jayson/promise','util','client','../../config/logger','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','notfound','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0x3bf5,0x17e));var _0x53bf=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x3bf5[_0x153e7d];return _0x3c22dd;};'use strict';var BPromise=require(_0x53bf('0x0'));var jayson=require(_0x53bf('0x1'));var moment=require('moment');var util=require(_0x53bf('0x2'));var client=jayson[_0x53bf('0x3')]['http']({'port':0x2329});var logger=require(_0x53bf('0x4'))('xdr');exports['info']=function(_0x432ed6,_0x33b501){logger[_0x53bf('0x5')](_0x432ed6,_0x33b501?util['inspect'](_0x33b501,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x6acb0f,_0x402208){logger[_0x53bf('0x6')](_0x6acb0f,_0x402208?util[_0x53bf('0x7')](_0x402208,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x13a8c4,_0x34672a){logger[_0x53bf('0x8')](_0x13a8c4,_0x34672a?util['inspect'](_0x34672a,{'showHidden':![],'depth':null}):'');};exports[_0x53bf('0x9')]=function(_0x190f38,_0x564636){return client[_0x53bf('0x9')](_0x190f38,{'body':_0x564636})[_0x53bf('0xa')](function(_0x110b0e){logger[_0x53bf('0x6')]('[utils][request]\x20name:%s',_0x190f38,_0x110b0e?util[_0x53bf('0x7')](_0x110b0e,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xf3fa47){logger[_0x53bf('0x8')](_0x53bf('0xb'),_0x190f38,_0xf3fa47?util[_0x53bf('0x7')](_0xf3fa47,{'showHidden':![],'depth':null}):'');});};function getUser(_0x489b58){return client[_0x53bf('0x9')](_0x53bf('0xc'),{'options':{'raw':!![],'attributes':['id',_0x53bf('0xd'),'name',_0x53bf('0xe')],'where':_0x489b58,'limit':0x1}})[_0x53bf('0xa')](function(_0x2a3638){logger['debug'](_0x53bf('0xf'),JSON['stringify'](_0x489b58),_0x2a3638?util[_0x53bf('0x7')](_0x2a3638,{'showHidden':![],'depth':null}):'');return _0x2a3638[_0x53bf('0x10')][_0x53bf('0x11')]?_0x2a3638[_0x53bf('0x10')][0x0]:null;});}exports[_0x53bf('0x12')]=function(_0x4d66b4){return new BPromise(function(_0x58964a,_0x383bfd){if(_0x4d66b4){return getUser({'internal':_0x4d66b4})[_0x53bf('0xa')](function(_0x5ab601){logger[_0x53bf('0x5')](_0x53bf('0x13'),_0x4d66b4,_0x5ab601?_0x53bf('0x14'):'notfound');return _0x58964a(_0x5ab601);})['catch'](function(_0x2b3cdc){logger[_0x53bf('0x8')](_0x53bf('0x15'),_0x2b3cdc?util[_0x53bf('0x7')](_0x2b3cdc,{'showHidden':![],'depth':null}):'');return _0x58964a(null);});}return _0x58964a(null);});};exports[_0x53bf('0x16')]=function(_0x3af640){return new BPromise(function(_0x572373,_0x3f4d70){if(_0x3af640){return getUser({'interface':_0x3af640})[_0x53bf('0xa')](function(_0x5bb33a){logger[_0x53bf('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x3af640,_0x5bb33a?_0x53bf('0x14'):_0x53bf('0x17'));return _0x572373(_0x5bb33a);})[_0x53bf('0x18')](function(_0x2b9bde){logger[_0x53bf('0x8')](_0x53bf('0x19'),_0x2b9bde?util[_0x53bf('0x7')](_0x2b9bde,{'showHidden':![],'depth':null}):'');return _0x572373(null);});}return _0x572373(null);});};exports[_0x53bf('0x1a')]=function(_0x31221d){return new BPromise(function(_0x23807d,_0xff6011){if(_0x31221d){return getUser({'name':_0x31221d})['then'](function(_0x380451){logger[_0x53bf('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x31221d,_0x380451?_0x53bf('0x14'):_0x53bf('0x17'));return _0x23807d(_0x380451);})['catch'](function(_0x35eccb){logger[_0x53bf('0x8')](_0x53bf('0x1b'),_0x35eccb?util[_0x53bf('0x7')](_0x35eccb,{'showHidden':![],'depth':null}):'');return _0x23807d(null);});}return _0x23807d(null);});};exports['getVoiceQueueByName']=function(_0x2b643e){return new BPromise(function(_0xf18bd5,_0x53de98){if(_0x2b643e){return client[_0x53bf('0x9')](_0x53bf('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x53bf('0x1d'),_0x53bf('0x1e'),_0x53bf('0x1f'),_0x53bf('0x20')],'where':{'name':_0x2b643e},'limit':0x1}})['then'](function(_0x10c41f){logger[_0x53bf('0x6')](_0x53bf('0x21'),_0x2b643e,_0x10c41f?util['inspect'](_0x10c41f,{'showHidden':![],'depth':null}):'');logger[_0x53bf('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2b643e,_0x10c41f?'found':_0x53bf('0x17'));return _0xf18bd5(_0x10c41f[_0x53bf('0x10')][_0x53bf('0x11')]?_0x10c41f[_0x53bf('0x10')][0x0]:null);})[_0x53bf('0x18')](function(_0x5f61d7){logger['error'](_0x53bf('0x22'),_0x5f61d7?util[_0x53bf('0x7')](_0x5f61d7,{'showHidden':![],'depth':null}):'');return _0xf18bd5(null);});}return _0xf18bd5(null);});};exports[_0x53bf('0x23')]=function(_0x4b9bfc,_0x1fbcac){return moment(_0x4b9bfc)[_0x53bf('0x24')](_0x1fbcac,_0x53bf('0x25'))[_0x53bf('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x53bf('0x27')]=function(_0xd0f0f8,_0x4017c4){return moment(_0xd0f0f8)[_0x53bf('0x28')](_0x4017c4,_0x53bf('0x25'))[_0x53bf('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x53bf('0x29')]=function(_0xcb2dd5,_0x140893){return moment(_0xcb2dd5)[_0x53bf('0x2a')](moment(_0x140893),_0x53bf('0x25'));};exports[_0x53bf('0x2b')]=function(_0xbd1b95,_0x547b55){return parseInt(_0xbd1b95,0xa)+parseInt(_0x547b55,0xa);};exports[_0x53bf('0x2c')]=function(){return moment()['format'](_0x53bf('0x2d'));};exports['isAfter']=function(_0x1ae1cd,_0x31d5d0){if(_0x31d5d0){return moment(_0x1ae1cd)[_0x53bf('0x2e')](_0x31d5d0);}return!![];};exports['isBefore']=function(_0x378c64,_0x2675a8){if(_0x2675a8){return moment(_0x378c64)['isBefore'](_0x2675a8);}else if(_0x378c64){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 c7108b9..6dee324 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 _0xfacc=['test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','catch','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','url','device','other','agent_name'];(function(_0x5a41b4,_0x1cc01a){var _0x48ea46=function(_0x172482){while(--_0x172482){_0x5a41b4['push'](_0x5a41b4['shift']());}};_0x48ea46(++_0x1cc01a);}(_0xfacc,0x13d));var _0xcfac=function(_0x13d0a4,_0x37935f){_0x13d0a4=_0x13d0a4-0x0;var _0x590559=_0xfacc[_0x13d0a4];return _0x590559;};var fs=require(_0xcfac('0x0'));var _=require(_0xcfac('0x1'));var ewinston=require(_0xcfac('0x2'));var path=require(_0xcfac('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0xcfac('0x4')];var safeTemplate=require('./safe-template')[_0xcfac('0x5')];var maskSensitiveData=require(_0xcfac('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x2b0aa9(_0x221221){var _0x13bb30=path[_0xcfac('0x7')](_0xcfac('0x8'),_0xcfac('0x9'),_0xcfac('0xa'));var _0x22ac44=path[_0xcfac('0x7')](_0xcfac('0xb'),_0x221221[_0xcfac('0xc')]+'-'+_0x221221[_0xcfac('0xd')]);return fs[_0xcfac('0xe')](path['join'](_0x13bb30,_0x22ac44))[_0xcfac('0xf')](function(){var _0x4a0247=fileLogger(_0xcfac('0xb'),path[_0xcfac('0x7')](_0x13bb30,_0x22ac44));return _0x4a0247;})['catch'](function(_0x51f76b){throw _0x51f76b;});}this[_0xcfac('0x9')]=function(_0x23c101,_0x54047d,_0x760d98,_0x1f369f){return _0x2b0aa9(_0x23c101[_0xcfac('0x10')])[_0xcfac('0xf')](function(_0x2db187){var _0x424746=_0x2db187[_0x54047d];return _0x424746;})[_0xcfac('0xf')](function(_0x2e3d46){var _0x19d331=_0x23c101['user']?_0x23c101[_0xcfac('0x10')]['id']:'no-user';var _0x557dff=_0x1f369f[_0xcfac('0x11')];var _0x4cdcf0=_0x1f369f[_0xcfac('0x12')];var _0x1b8652=new Date(Number(_0x4cdcf0));return _0x2e3d46(_0x19d331,_0x1b8652,_0x760d98,_0x557dff);})[_0xcfac('0x13')](function(_0xd6229c){fileLogger(_0xcfac('0xb'))[_0xcfac('0x14')](_0xd6229c);});};}function setupLoggers(_0x64a08d){return new Promise(function(_0x4bf375){var _0x2a38f7=new ClientSideLogger();var _0x11d47f=fileLogger(_0xcfac('0x15'));var _0x1b9968=fileLogger('auth');_0x64a08d[_0xcfac('0x16')](_0xcfac('0x17'),_0x2a38f7);_0x64a08d[_0xcfac('0x18')](ewinston[_0xcfac('0x19')]({'winstonInstance':_0x11d47f,'meta':![],'statusLevels':!![],'msg':function(_0x3f7601,_0x3e6dba){var _0x4cabb6=_0xcfac('0x1a');if(!_['isEmpty'](_0x3f7601[_0xcfac('0x1b')])){_0x4cabb6+=_0xcfac('0x1c');var _0x526786=_0x3f7601['body'];maskSensitiveData(_0x526786);}return safeTemplate(util[_0xcfac('0x1d')](_0x4cabb6,_0x3f7601[_0xcfac('0x1e')],_0x3f7601['headers'][_0xcfac('0x1f')]?_0x3f7601[_0xcfac('0x20')][_0xcfac('0x1f')]:_0x3f7601[_0xcfac('0x21')][_0xcfac('0x22')]||_0x3f7601['ip'],_0x3f7601['url'],_0x3e6dba[_0xcfac('0x23')],_0x3e6dba[_0xcfac('0x24')],_0x3f7601['user']?_0x3f7601[_0xcfac('0x10')]['id']:null,_0x3f7601[_0xcfac('0x10')]?_0x3f7601[_0xcfac('0x10')][_0xcfac('0xd')]:null,_0x3f7601[_0xcfac('0x10')]?_0x3f7601[_0xcfac('0x10')]['role']:null,_0x526786?util['inspect'](_0x526786,![],null):''));}}));_0x64a08d[_0xcfac('0x18')](ewinston[_0xcfac('0x19')]({'winstonInstance':_0x1b9968,'meta':![],'statusLevels':!![],'msg':function(_0x2660fe,_0x1bc9ca){var _0x2e618b=_0xcfac('0x25');if(_0x2660fe[_0xcfac('0x1b')]&&_0x2660fe[_0xcfac('0x1b')]['device']&&_0x2660fe[_0xcfac('0x1b')][_0xcfac('0x26')]){_0x2e618b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xcfac('0x1d')](_0x2e618b,_0x2660fe[_0xcfac('0x1e')],_0x2660fe[_0xcfac('0x20')][_0xcfac('0x1f')]?_0x2660fe[_0xcfac('0x20')][_0xcfac('0x1f')]:_0x2660fe[_0xcfac('0x21')][_0xcfac('0x22')]||_0x2660fe['ip'],_0x2660fe[_0xcfac('0x27')],_0x1bc9ca[_0xcfac('0x23')],_0x1bc9ca['responseTime'],_0x2660fe['user']?_0x2660fe['user']['id']:null,_0x2660fe[_0xcfac('0x10')]?_0x2660fe['user']['name']:null,_0x2660fe['user']?_0x2660fe[_0xcfac('0x10')][_0xcfac('0xc')]:null,_0x2660fe[_0xcfac('0x1b')]&&_0x2660fe[_0xcfac('0x1b')]['device']?_0x2660fe[_0xcfac('0x1b')][_0xcfac('0x28')]:_0xcfac('0x29'),_0x2660fe['body']&&_0x2660fe[_0xcfac('0x1b')][_0xcfac('0x26')]?_0x2660fe['body']['agent_id']:'',_0x2660fe[_0xcfac('0x1b')]&&_0x2660fe[_0xcfac('0x1b')][_0xcfac('0x2a')]?_0x2660fe[_0xcfac('0x1b')][_0xcfac('0x2a')]:'');},'ignoreRoute':function(_0x6b36b7){var _0x4fca8e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4fca8e[_0xcfac('0x2b')](_0x6b36b7[_0xcfac('0x27')]);}}));return _0x4bf375();});}exports[_0xcfac('0x2c')]=setupLoggers; \ No newline at end of file +var _0x9616=['timestamp','catch','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','url','statusCode','responseTime','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','client','name','ensureDir','then','user','data'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x9616,0x1f2));var _0x6961=function(_0x8686c9,_0x305a8f){_0x8686c9=_0x8686c9-0x0;var _0x1dc90c=_0x9616[_0x8686c9];return _0x1dc90c;};var fs=require(_0x6961('0x0'));var _=require(_0x6961('0x1'));var ewinston=require(_0x6961('0x2'));var path=require('path');var util=require(_0x6961('0x3'));var fileLogger=require(_0x6961('0x4'))[_0x6961('0x5')];var safeTemplate=require(_0x6961('0x6'))[_0x6961('0x7')];var maskSensitiveData=require(_0x6961('0x8'))[_0x6961('0x9')];function ClientSideLogger(){function _0xff8bbd(_0x3c869d){var _0x4e9ab2=path['join'](_0x6961('0xa'),_0x6961('0xb'),_0x6961('0xc'));var _0x439deb=path['join'](_0x6961('0xd'),_0x3c869d['role']+'-'+_0x3c869d[_0x6961('0xe')]);return fs[_0x6961('0xf')](path['join'](_0x4e9ab2,_0x439deb))[_0x6961('0x10')](function(){var _0x3228b4=fileLogger(_0x6961('0xd'),path['join'](_0x4e9ab2,_0x439deb));return _0x3228b4;})['catch'](function(_0x38eb64){throw _0x38eb64;});}this[_0x6961('0xb')]=function(_0x4050fd,_0x483bc3,_0x5e2951,_0x366328){return _0xff8bbd(_0x4050fd[_0x6961('0x11')])[_0x6961('0x10')](function(_0x6b17b4){var _0x160ec3=_0x6b17b4[_0x483bc3];return _0x160ec3;})[_0x6961('0x10')](function(_0x4b4810){var _0x17330c=_0x4050fd[_0x6961('0x11')]?_0x4050fd['user']['id']:'no-user';var _0x49d6a8=_0x366328[_0x6961('0x12')];var _0x2bfc4e=_0x366328[_0x6961('0x13')];var _0x54704f=new Date(Number(_0x2bfc4e));return _0x4b4810(_0x17330c,_0x54704f,_0x5e2951,_0x49d6a8);})[_0x6961('0x14')](function(_0x2322db){fileLogger(_0x6961('0xd'))['error'](_0x2322db);});};}function setupLoggers(_0x54533a){return new Promise(function(_0x200056){var _0x38f996=new ClientSideLogger();var _0x1d3a28=fileLogger(_0x6961('0x15'));var _0x3affe6=fileLogger(_0x6961('0x16'));_0x54533a[_0x6961('0x17')]('client-side-logger',_0x38f996);_0x54533a[_0x6961('0x18')](ewinston['logger']({'winstonInstance':_0x1d3a28,'meta':![],'statusLevels':!![],'msg':function(_0x221966,_0x15cc81){var _0x331d6c=_0x6961('0x19');if(!_[_0x6961('0x1a')](_0x221966[_0x6961('0x1b')])){_0x331d6c+=_0x6961('0x1c');var _0x1dfe99=_0x221966[_0x6961('0x1b')];maskSensitiveData(_0x1dfe99);}return safeTemplate(util['format'](_0x331d6c,_0x221966['method'],_0x221966[_0x6961('0x1d')][_0x6961('0x1e')]?_0x221966[_0x6961('0x1d')][_0x6961('0x1e')]:_0x221966[_0x6961('0x1f')][_0x6961('0x20')]||_0x221966['ip'],_0x221966['url'],_0x15cc81['statusCode'],_0x15cc81['responseTime'],_0x221966[_0x6961('0x11')]?_0x221966[_0x6961('0x11')]['id']:null,_0x221966[_0x6961('0x11')]?_0x221966[_0x6961('0x11')][_0x6961('0xe')]:null,_0x221966['user']?_0x221966[_0x6961('0x11')][_0x6961('0x21')]:null,_0x1dfe99?util[_0x6961('0x22')](_0x1dfe99,![],null):''));}}));_0x54533a[_0x6961('0x18')](ewinston['logger']({'winstonInstance':_0x3affe6,'meta':![],'statusLevels':!![],'msg':function(_0x422c2a,_0x678236){var _0x80c895=_0x6961('0x23');if(_0x422c2a['body']&&_0x422c2a['body'][_0x6961('0x24')]&&_0x422c2a['body'][_0x6961('0x25')]){_0x80c895=_0x6961('0x26');}return util[_0x6961('0x27')](_0x80c895,_0x422c2a[_0x6961('0x28')],_0x422c2a['headers'][_0x6961('0x1e')]?_0x422c2a['headers'][_0x6961('0x1e')]:_0x422c2a[_0x6961('0x1f')][_0x6961('0x20')]||_0x422c2a['ip'],_0x422c2a[_0x6961('0x29')],_0x678236[_0x6961('0x2a')],_0x678236[_0x6961('0x2b')],_0x422c2a[_0x6961('0x11')]?_0x422c2a[_0x6961('0x11')]['id']:null,_0x422c2a['user']?_0x422c2a[_0x6961('0x11')][_0x6961('0xe')]:null,_0x422c2a[_0x6961('0x11')]?_0x422c2a[_0x6961('0x11')][_0x6961('0x21')]:null,_0x422c2a[_0x6961('0x1b')]&&_0x422c2a['body'][_0x6961('0x24')]?_0x422c2a[_0x6961('0x1b')][_0x6961('0x24')]:_0x6961('0x2c'),_0x422c2a[_0x6961('0x1b')]&&_0x422c2a[_0x6961('0x1b')]['agent_id']?_0x422c2a[_0x6961('0x1b')][_0x6961('0x25')]:'',_0x422c2a[_0x6961('0x1b')]&&_0x422c2a[_0x6961('0x1b')][_0x6961('0x2d')]?_0x422c2a[_0x6961('0x1b')][_0x6961('0x2d')]:'');},'ignoreRoute':function(_0x577fe4){var _0x21ad33=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x21ad33['test'](_0x577fe4[_0x6961('0x29')]);}}));return _0x200056();});}exports[_0x6961('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c541f72..67e2785 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef5a=['isBetween','timeCompare','format','ddd','toLowerCase','includes','daysInMonth','max','min','domCompare','MMM','monthCompare','padStart','length','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf'];(function(_0x40cecb,_0x1dc75c){var _0x33be28=function(_0x778544){while(--_0x778544){_0x40cecb['push'](_0x40cecb['shift']());}};_0x33be28(++_0x1dc75c);}(_0xef5a,0x18a));var _0xaef5=function(_0x428f07,_0x239d9c){_0x428f07=_0x428f07-0x0;var _0x456167=_0xef5a[_0x428f07];return _0x456167;};var _=require(_0xaef5('0x0'));var moment=require(_0xaef5('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xaef5('0x2')](function(_0x4e1eea){return _0x4e1eea['source'];})[_0xaef5('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xaef5('0x4');var EINVALID_DATE=_0xaef5('0x5');function throwIfDateNotValid(_0x2a577e){if(!_0x2a577e[_0xaef5('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5203f1){var _0xfda4e0=_0x5203f1[_0xaef5('0x7')](':')['map'](function(_0x5382c3){return parseInt(_0x5382c3,0xa);});var _0x140478=_0xfda4e0[0x0];var _0x17a4e8=_0xfda4e0[0x1];if(_0x140478<0x0||_0x140478>0x17||_0x17a4e8<0x0||_0x17a4e8>0x3b){throw new Error(EINVALID_DATE);}return[_0x140478,_0x17a4e8];}function circularDoWInterval(_0x4c9cdd,_0x2d1773){if(_0x4c9cdd===_0x2d1773){return[_0x4c9cdd];}else{var _0x3ce188=moment[_0xaef5('0x8')]();moment[_0xaef5('0x8')]('en');var _0x676b40=moment[_0xaef5('0x9')]()['map'](function(_0x460c4f){return _0x460c4f['toLowerCase']();});moment[_0xaef5('0x8')](_0x3ce188);var _0xe6c238=_0x676b40[_0xaef5('0xa')](_0x4c9cdd);var _0x384857=_0x676b40[_0xaef5('0xa')](_0x2d1773);if(_0x384857>_0xe6c238){return _0x676b40[_0xaef5('0xb')](_0xe6c238,_0x384857+0x1);}else{var _0x22f7bf=_0x676b40[_0xaef5('0xb')](0x0,_0x384857+0x1);var _0x1b37e2=_0x676b40[_0xaef5('0xb')](_0xe6c238);return _0x1b37e2[_0xaef5('0xc')](_0x22f7bf);}}}module[_0xaef5('0xd')][_0xaef5('0xe')]=circularDoWInterval;function circularMonthInterval(_0x4849ec,_0x338e78){if(_0x4849ec===_0x338e78){return[_0x4849ec];}else{var _0x3f0e96=moment['locale']();moment['locale']('en');var _0xd0e688=moment[_0xaef5('0xf')]()[_0xaef5('0x2')](function(_0x590da6){return _0x590da6['toLowerCase']();});moment[_0xaef5('0x8')](_0x3f0e96);var _0x365558=_0xd0e688[_0xaef5('0xa')](_0x4849ec);var _0x53917e=_0xd0e688[_0xaef5('0xa')](_0x338e78);if(_0x53917e>_0x365558){return _0xd0e688[_0xaef5('0xb')](_0x365558,_0x53917e+0x1);}else{var _0x511580=_0xd0e688[_0xaef5('0xb')](0x0,_0x53917e+0x1);var _0x8207d2=_0xd0e688[_0xaef5('0xb')](_0x365558);return _0x8207d2[_0xaef5('0xc')](_0x511580);}}}module['exports'][_0xaef5('0x10')]=circularMonthInterval;function parseDom(_0xf7ff43){var _0x3dd8ba=parseInt(_0xf7ff43,0xa);if(_0x3dd8ba<0x1||_0x3dd8ba>0x1f){throw new Error(EINVALID_DATE);}return _0x3dd8ba;}function timeCompare(_0x3b2427,_0x212269,_0x4c594b){var _0x2a6394=_0x3b2427[_0xaef5('0x11')]();var _0x1613c9=extractTime(_0x212269);var _0x29dfe5=_0x1613c9[0x0];var _0x1bf9cd=_0x1613c9[0x1];var _0x338b29=_0x3b2427[_0xaef5('0x11')]()[_0xaef5('0x12')](_0x29dfe5)[_0xaef5('0x13')](_0x1bf9cd);throwIfDateNotValid(_0x338b29);var _0x4c3e68=extractTime(_0x4c594b);var _0x2ad355=_0x4c3e68[0x0];var _0x3e5316=_0x4c3e68[0x1];var _0x18d717=_0x3b2427['clone']()[_0xaef5('0x12')](_0x2ad355)[_0xaef5('0x13')](_0x3e5316);throwIfDateNotValid(_0x18d717);if(_0x18d717[_0xaef5('0x14')](_0x338b29)){var _0x40a6cb=_0x2a6394[_0xaef5('0x11')]()[_0xaef5('0x15')](_0xaef5('0x16'));var _0x5cc616=_0x2a6394[_0xaef5('0x11')]()[_0xaef5('0x17')](_0xaef5('0x16'));return _0x2a6394[_0xaef5('0x18')](_0x338b29,_0x5cc616,undefined,'[]')||_0x2a6394[_0xaef5('0x18')](_0x40a6cb,_0x18d717,undefined,'[]');}else{return _0x2a6394[_0xaef5('0x18')](_0x338b29,_0x18d717,undefined,'[]');}}module[_0xaef5('0xd')][_0xaef5('0x19')]=timeCompare;function dowCompare(_0x2921c9,_0x44bbfb,_0x3ece7d){var _0x28f71e=_0x2921c9[_0xaef5('0x8')]('en')[_0xaef5('0x1a')](_0xaef5('0x1b'))[_0xaef5('0x1c')]();return circularDoWInterval(_0x44bbfb,_0x3ece7d)[_0xaef5('0x1d')](_0x28f71e);}module[_0xaef5('0xd')]['dowCompare']=dowCompare;function domCompare(_0x2e775b,_0x25c43d,_0xd6fddc){var _0x58c41b=_0x2e775b['date']();if(_0x25c43d===_0xd6fddc){return _0x58c41b===_0x25c43d;}else{var _0x18cfbf=_0x2e775b[_0xaef5('0x1e')]();var _0x58a443=_0x25c43d<_0xd6fddc;let _0x2a5bdf=![];var _0x2c392e=0x0;var _0x28e661=0x0;if(_0x58a443){_0x2c392e=Math[_0xaef5('0x1f')](0x1,_0x25c43d);_0x28e661=Math[_0xaef5('0x20')](_0xd6fddc,_0x18cfbf);_0x2a5bdf=_0x58c41b>=_0x2c392e&&_0x58c41b<=_0x28e661;}else{_0x2c392e=Math[_0xaef5('0x20')](_0x25c43d,_0x18cfbf);_0x28e661=Math[_0xaef5('0x1f')](0x1,_0xd6fddc);_0x2a5bdf=_0x58c41b>=_0x2c392e||_0x58c41b<=_0x28e661;}return _0x2a5bdf;}}module[_0xaef5('0xd')][_0xaef5('0x21')]=domCompare;function monthCompare(_0x190c5,_0x3cc606,_0x3a0853){var _0x4f4ff1=_0x190c5['locale']('en')[_0xaef5('0x1a')](_0xaef5('0x22'))[_0xaef5('0x1c')]();return circularMonthInterval(_0x3cc606,_0x3a0853)[_0xaef5('0x1d')](_0x4f4ff1);}module[_0xaef5('0xd')][_0xaef5('0x23')]=monthCompare;function iftime(_0x4893df,_0x298284=moment['tz']['guess'](),_0x3b6df6=moment()){if(!validateRx['test'](_0x4893df)){throw new Error(EINVALID_STRING);}else{var _0x3073b2=(moment['isMoment'](_0x3b6df6)?_0x3b6df6[_0xaef5('0x11')]():moment(_0x3b6df6))['tz'](_0x298284)[_0xaef5('0x8')]('en');throwIfDateNotValid(_0x3073b2);var _0x44d9b3=_0x4893df[_0xaef5('0x7')](',');var _0x2ef23e=_0x44d9b3[0x0];var _0x5b4f04=_0x44d9b3[0x1];var _0x13ae9a=_0x44d9b3[0x2];var _0x77f9b5=_0x44d9b3[0x3];let _0x31b621=!![];if(_0x2ef23e!=='*'){var _0x4f12f8=_0x2ef23e[_0xaef5('0x7')]('-');var _0x1e1c44=_[_0xaef5('0x24')](_0x4f12f8[0x0],0x5,'0');var _0xb1b077=_0x4f12f8['length']===0x2?_[_0xaef5('0x24')](_0x4f12f8[0x1],0x5,'0'):_0x1e1c44;_0x31b621=timeCompare(_0x3073b2,_0x1e1c44,_0xb1b077);}let _0x414372=!![];if(_0x5b4f04!=='*'){var _0x4a9146=_0x5b4f04[_0xaef5('0x7')]('-');var _0x340861=_0x4a9146[0x0];var _0x2684a0=_0x4a9146[_0xaef5('0x25')]===0x2?_0x4a9146[0x1]:_0x340861;_0x414372=dowCompare(_0x3073b2,_0x340861,_0x2684a0);}let _0x480df8=!![];if(_0x13ae9a!=='*'){var _0x280e6a=_0x13ae9a['split']('-');var _0x555b6b=parseDom(_0x280e6a[0x0]);var _0x4cad41=_0x280e6a[_0xaef5('0x25')]===0x2?parseDom(_0x280e6a[0x1]):_0x555b6b;_0x480df8=domCompare(_0x3073b2,_0x555b6b,_0x4cad41);}let _0x1014eb=!![];if(_0x77f9b5!=='*'){var _0x350848=_0x77f9b5[_0xaef5('0x7')]('-');var _0x3b562f=_0x350848[0x0];var _0x567465=_0x350848[_0xaef5('0x25')]===0x2?_0x350848[0x1]:_0x350848[0x0];_0x1014eb=monthCompare(_0x3073b2,_0x3b562f,_0x567465);}return _0x31b621&&_0x414372&&_0x480df8&&_0x1014eb;}}module[_0xaef5('0xd')]['iftime']=iftime; \ No newline at end of file +var _0x8023=['timeCompare','format','ddd','toLowerCase','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','guess','test','padStart','length','lodash','join','Date\x20not\x20valid','split','map','locale','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween'];(function(_0x5aebd2,_0x3354ec){var _0x4b7a52=function(_0xe4beff){while(--_0xe4beff){_0x5aebd2['push'](_0x5aebd2['shift']());}};_0x4b7a52(++_0x3354ec);}(_0x8023,0x182));var _0x3802=function(_0x438596,_0x449b4b){_0x438596=_0x438596-0x0;var _0x172723=_0x8023[_0x438596];return _0x172723;};var _=require(_0x3802('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x18f55b){return _0x18f55b['source'];})[_0x3802('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x3802('0x2');function throwIfDateNotValid(_0x413e){if(!_0x413e['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x27c3d3){var _0x5ed001=_0x27c3d3[_0x3802('0x3')](':')[_0x3802('0x4')](function(_0xb6e5e8){return parseInt(_0xb6e5e8,0xa);});var _0x2ca43f=_0x5ed001[0x0];var _0x18a4b6=_0x5ed001[0x1];if(_0x2ca43f<0x0||_0x2ca43f>0x17||_0x18a4b6<0x0||_0x18a4b6>0x3b){throw new Error(EINVALID_DATE);}return[_0x2ca43f,_0x18a4b6];}function circularDoWInterval(_0x5b416d,_0x5ab8d9){if(_0x5b416d===_0x5ab8d9){return[_0x5b416d];}else{var _0x49655a=moment[_0x3802('0x5')]();moment[_0x3802('0x5')]('en');var _0x408c98=moment['weekdaysShort']()[_0x3802('0x4')](function(_0x117bfa){return _0x117bfa['toLowerCase']();});moment[_0x3802('0x5')](_0x49655a);var _0xf256d5=_0x408c98[_0x3802('0x6')](_0x5b416d);var _0x3c4a0f=_0x408c98[_0x3802('0x6')](_0x5ab8d9);if(_0x3c4a0f>_0xf256d5){return _0x408c98[_0x3802('0x7')](_0xf256d5,_0x3c4a0f+0x1);}else{var _0x13856f=_0x408c98[_0x3802('0x7')](0x0,_0x3c4a0f+0x1);var _0x2df07f=_0x408c98[_0x3802('0x7')](_0xf256d5);return _0x2df07f[_0x3802('0x8')](_0x13856f);}}}module[_0x3802('0x9')][_0x3802('0xa')]=circularDoWInterval;function circularMonthInterval(_0x5abd9a,_0x1ccbdf){if(_0x5abd9a===_0x1ccbdf){return[_0x5abd9a];}else{var _0x123645=moment['locale']();moment[_0x3802('0x5')]('en');var _0x338d67=moment[_0x3802('0xb')]()[_0x3802('0x4')](function(_0x3dad9f){return _0x3dad9f['toLowerCase']();});moment[_0x3802('0x5')](_0x123645);var _0x50d42d=_0x338d67['indexOf'](_0x5abd9a);var _0x4b18b3=_0x338d67[_0x3802('0x6')](_0x1ccbdf);if(_0x4b18b3>_0x50d42d){return _0x338d67[_0x3802('0x7')](_0x50d42d,_0x4b18b3+0x1);}else{var _0x26cc09=_0x338d67[_0x3802('0x7')](0x0,_0x4b18b3+0x1);var _0x292f2e=_0x338d67[_0x3802('0x7')](_0x50d42d);return _0x292f2e[_0x3802('0x8')](_0x26cc09);}}}module[_0x3802('0x9')][_0x3802('0xc')]=circularMonthInterval;function parseDom(_0x4d778d){var _0x4af209=parseInt(_0x4d778d,0xa);if(_0x4af209<0x1||_0x4af209>0x1f){throw new Error(EINVALID_DATE);}return _0x4af209;}function timeCompare(_0x33cba1,_0x457d05,_0x421dba){var _0x2f71b0=_0x33cba1[_0x3802('0xd')]();var _0x4ac9e9=extractTime(_0x457d05);var _0xee6594=_0x4ac9e9[0x0];var _0x27bf9e=_0x4ac9e9[0x1];var _0x33f117=_0x33cba1[_0x3802('0xd')]()[_0x3802('0xe')](_0xee6594)[_0x3802('0xf')](_0x27bf9e);throwIfDateNotValid(_0x33f117);var _0x1bb0e7=extractTime(_0x421dba);var _0x23bc4e=_0x1bb0e7[0x0];var _0x3d9192=_0x1bb0e7[0x1];var _0x22dbd9=_0x33cba1[_0x3802('0xd')]()['hours'](_0x23bc4e)[_0x3802('0xf')](_0x3d9192);throwIfDateNotValid(_0x22dbd9);if(_0x22dbd9[_0x3802('0x10')](_0x33f117)){var _0x5bf7ba=_0x2f71b0[_0x3802('0xd')]()[_0x3802('0x11')]('day');var _0x355764=_0x2f71b0[_0x3802('0xd')]()[_0x3802('0x12')](_0x3802('0x13'));return _0x2f71b0[_0x3802('0x14')](_0x33f117,_0x355764,undefined,'[]')||_0x2f71b0[_0x3802('0x14')](_0x5bf7ba,_0x22dbd9,undefined,'[]');}else{return _0x2f71b0[_0x3802('0x14')](_0x33f117,_0x22dbd9,undefined,'[]');}}module[_0x3802('0x9')][_0x3802('0x15')]=timeCompare;function dowCompare(_0x49c179,_0x3d4f8d,_0x3cd7e6){var _0x512bbf=_0x49c179[_0x3802('0x5')]('en')[_0x3802('0x16')](_0x3802('0x17'))[_0x3802('0x18')]();return circularDoWInterval(_0x3d4f8d,_0x3cd7e6)[_0x3802('0x19')](_0x512bbf);}module[_0x3802('0x9')][_0x3802('0x1a')]=dowCompare;function domCompare(_0x13c5f3,_0x5beb6b,_0x5e5dc4){var _0x39868a=_0x13c5f3[_0x3802('0x1b')]();if(_0x5beb6b===_0x5e5dc4){return _0x39868a===_0x5beb6b;}else{var _0xf486ad=_0x13c5f3[_0x3802('0x1c')]();var _0xc45f51=_0x5beb6b<_0x5e5dc4;let _0x580bdc=![];var _0x2eb3f1=0x0;var _0x4cbdda=0x0;if(_0xc45f51){_0x2eb3f1=Math['max'](0x1,_0x5beb6b);_0x4cbdda=Math[_0x3802('0x1d')](_0x5e5dc4,_0xf486ad);_0x580bdc=_0x39868a>=_0x2eb3f1&&_0x39868a<=_0x4cbdda;}else{_0x2eb3f1=Math[_0x3802('0x1d')](_0x5beb6b,_0xf486ad);_0x4cbdda=Math[_0x3802('0x1e')](0x1,_0x5e5dc4);_0x580bdc=_0x39868a>=_0x2eb3f1||_0x39868a<=_0x4cbdda;}return _0x580bdc;}}module[_0x3802('0x9')][_0x3802('0x1f')]=domCompare;function monthCompare(_0x274afe,_0x508805,_0x387c1c){var _0x4aa394=_0x274afe['locale']('en')['format'](_0x3802('0x20'))[_0x3802('0x18')]();return circularMonthInterval(_0x508805,_0x387c1c)['includes'](_0x4aa394);}module['exports']['monthCompare']=monthCompare;function iftime(_0xe123b2,_0x214a89=moment['tz'][_0x3802('0x21')](),_0x3c4fa3=moment()){if(!validateRx[_0x3802('0x22')](_0xe123b2)){throw new Error(EINVALID_STRING);}else{var _0x1856fc=(moment['isMoment'](_0x3c4fa3)?_0x3c4fa3[_0x3802('0xd')]():moment(_0x3c4fa3))['tz'](_0x214a89)['locale']('en');throwIfDateNotValid(_0x1856fc);var _0x4f0352=_0xe123b2[_0x3802('0x3')](',');var _0x5c5907=_0x4f0352[0x0];var _0x41596d=_0x4f0352[0x1];var _0x2ece7a=_0x4f0352[0x2];var _0x458206=_0x4f0352[0x3];let _0x567ec3=!![];if(_0x5c5907!=='*'){var _0x314d55=_0x5c5907['split']('-');var _0x34d52f=_[_0x3802('0x23')](_0x314d55[0x0],0x5,'0');var _0x1029f1=_0x314d55[_0x3802('0x24')]===0x2?_[_0x3802('0x23')](_0x314d55[0x1],0x5,'0'):_0x34d52f;_0x567ec3=timeCompare(_0x1856fc,_0x34d52f,_0x1029f1);}let _0x33763e=!![];if(_0x41596d!=='*'){var _0x48cdf5=_0x41596d['split']('-');var _0x3eb219=_0x48cdf5[0x0];var _0x252bb5=_0x48cdf5['length']===0x2?_0x48cdf5[0x1]:_0x3eb219;_0x33763e=dowCompare(_0x1856fc,_0x3eb219,_0x252bb5);}let _0x2a377e=!![];if(_0x2ece7a!=='*'){var _0x6fc06b=_0x2ece7a['split']('-');var _0x4dd478=parseDom(_0x6fc06b[0x0]);var _0x5634a7=_0x6fc06b[_0x3802('0x24')]===0x2?parseDom(_0x6fc06b[0x1]):_0x4dd478;_0x2a377e=domCompare(_0x1856fc,_0x4dd478,_0x5634a7);}let _0x5cb4e7=!![];if(_0x458206!=='*'){var _0x316a00=_0x458206[_0x3802('0x3')]('-');var _0x42fb52=_0x316a00[0x0];var _0x8a1ebf=_0x316a00[_0x3802('0x24')]===0x2?_0x316a00[0x1]:_0x316a00[0x0];_0x5cb4e7=monthCompare(_0x1856fc,_0x42fb52,_0x8a1ebf);}return _0x567ec3&&_0x33763e&&_0x2a377e&&_0x5cb4e7;}}module[_0x3802('0x9')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index fbfe32c..f82aceb 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40ff=['error','File','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','join','format','message','replace','}}}','level','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','%s-%s'];(function(_0x58470d,_0x320faf){var _0x44f68b=function(_0xdfa0c){while(--_0xdfa0c){_0x58470d['push'](_0x58470d['shift']());}};_0x44f68b(++_0x320faf);}(_0x40ff,0x158));var _0xf40f=function(_0x463a4e,_0x2c35e6){_0x463a4e=_0x463a4e-0x0;var _0x22c032=_0x40ff[_0x463a4e];return _0x22c032;};'use strict';var path=require(_0xf40f('0x0'));var util=require(_0xf40f('0x1'));var moment=require(_0xf40f('0x2'));var winston=require('winston');var config=require(_0xf40f('0x3'));var debugLevel=config[_0xf40f('0x4')]?config['debugLevel'][_0xf40f('0x5')]():_0xf40f('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xf40f('0x7'),'warn':_0xf40f('0x8'),'info':'white','print':_0xf40f('0x9'),'success':_0xf40f('0xa'),'http':_0xf40f('0xb'),'verbose':_0xf40f('0xc'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xf40f('0xd')](XC_LOG_COLORS);function getLogFileName(_0x15c0ee,_0x54ac5a,_0x32a20c){var _0xcdf51f=_0x15c0ee||'/var/log/xcally';return path[_0xf40f('0xe')](_0xcdf51f,util[_0xf40f('0xf')]('%s-%s.log',_0x54ac5a,_0x32a20c));}function formatter(_0x725eab,_0x23f390){_0x23f390[_0xf40f('0x10')]=_0x23f390[_0xf40f('0x10')][_0xf40f('0x11')](/@@{/g,'{{{')[_0xf40f('0x11')](/}@@/g,_0xf40f('0x12'))[_0xf40f('0x11')](/@{/g,'{{')[_0xf40f('0x11')](/}@/g,'}}');return util[_0xf40f('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x23f390[_0xf40f('0x13')]['toUpperCase'](),_0x725eab,_0x23f390[_0xf40f('0x10')]);}function fileFormat(_0x5ef598,_0x30e66a){_0x30e66a[_0xf40f('0x10')]=_0x30e66a[_0xf40f('0x10')][_0xf40f('0x11')](/@@{/g,'{{{')[_0xf40f('0x11')](/}@@/g,_0xf40f('0x12'))[_0xf40f('0x11')](/@{/g,'{{')[_0xf40f('0x11')](/}@/g,'}}');var _0x4fd5dc=_0x30e66a['meta']&&Object['keys'](_0x30e66a[_0xf40f('0x14')])[_0xf40f('0x15')]?'\x0a\x09'+JSON[_0xf40f('0x16')](_0x30e66a[_0xf40f('0x14')]):'';return util[_0xf40f('0xf')](_0xf40f('0x17'),moment()[_0xf40f('0xf')](_0xf40f('0x18')),_0x30e66a['level']['toUpperCase'](),_0x5ef598,_0x30e66a['message'],_0x4fd5dc);}function consoleLogger(){var _0xc7fdd=new winston[(_0xf40f('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf40f('0x1a'))][(_0xf40f('0x1b'))]({'level':_0xf40f('0x1c'),'json':![],'formatter':function(_0x209358){return formatter('',_0x209358);}})]});return _0xc7fdd;}function fileLogger(_0x2cfd72,_0x52968d){var _0xa17adc=new winston[(_0xf40f('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf40f('0x1a'))]['File']({'name':util[_0xf40f('0xf')](_0xf40f('0x1d'),_0x2cfd72,_0xf40f('0x1e')),'filename':getLogFileName(_0x52968d,_0x2cfd72,_0xf40f('0x1e')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3119ba){return fileFormat(_0x2cfd72,_0x3119ba);}}),new winston[(_0xf40f('0x1a'))][(_0xf40f('0x1f'))]({'name':util[_0xf40f('0xf')](_0xf40f('0x1d'),_0x2cfd72,debugLevel),'filename':getLogFileName(_0x52968d,_0x2cfd72,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4713d3){return fileFormat(_0x2cfd72,_0x4713d3);}}),new winston[(_0xf40f('0x1a'))][(_0xf40f('0x1b'))]({'level':_0xf40f('0x1c'),'json':![],'formatter':function(_0x325cb8){return fileFormat(_0x2cfd72,_0x325cb8);}})]});return _0xa17adc;}exports[_0xf40f('0x20')]=consoleLogger;exports[_0xf40f('0x21')]=fileLogger; \ No newline at end of file +var _0x79e0=['bold\x20cyan','addColors','format','%s-%s.log','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','%s-%s','error','consoleLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20blue'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x79e0,0x15b));var _0x079e=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0x79e0[_0x211087];return _0x2a581f;};'use strict';var path=require('path');var util=require(_0x079e('0x0'));var moment=require(_0x079e('0x1'));var winston=require(_0x079e('0x2'));var config=require(_0x079e('0x3'));var debugLevel=config['debugLevel']?config[_0x079e('0x4')][_0x079e('0x5')]():'info';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':_0x079e('0x6'),'error':_0x079e('0x7'),'warn':_0x079e('0x8'),'info':_0x079e('0x9'),'print':_0x079e('0xa'),'success':'bold\x20green','http':_0x079e('0xb'),'verbose':'bold\x20magenta','debug':_0x079e('0xc'),'silly':_0x079e('0xd')};winston[_0x079e('0xe')](XC_LOG_COLORS);function getLogFileName(_0x27f09d,_0x3fe586,_0x56e4d3){var _0x40a20e=_0x27f09d||'/var/log/xcally';return path['join'](_0x40a20e,util[_0x079e('0xf')](_0x079e('0x10'),_0x3fe586,_0x56e4d3));}function formatter(_0x562698,_0x85e10){_0x85e10['message']=_0x85e10['message'][_0x079e('0x11')](/@@{/g,_0x079e('0x12'))[_0x079e('0x11')](/}@@/g,_0x079e('0x13'))[_0x079e('0x11')](/@{/g,'{{')[_0x079e('0x11')](/}@/g,'}}');return util[_0x079e('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x079e('0xf')](_0x079e('0x14')),_0x85e10[_0x079e('0x15')][_0x079e('0x16')](),_0x562698,_0x85e10[_0x079e('0x17')]);}function fileFormat(_0x5d6596,_0xdaa29e){_0xdaa29e[_0x079e('0x17')]=_0xdaa29e[_0x079e('0x17')][_0x079e('0x11')](/@@{/g,'{{{')[_0x079e('0x11')](/}@@/g,_0x079e('0x13'))[_0x079e('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1cf0de=_0xdaa29e[_0x079e('0x18')]&&Object[_0x079e('0x19')](_0xdaa29e['meta'])[_0x079e('0x1a')]?'\x0a\x09'+JSON[_0x079e('0x1b')](_0xdaa29e[_0x079e('0x18')]):'';return util[_0x079e('0xf')](_0x079e('0x1c'),moment()[_0x079e('0xf')](_0x079e('0x14')),_0xdaa29e[_0x079e('0x15')][_0x079e('0x16')](),_0x5d6596,_0xdaa29e[_0x079e('0x17')],_0x1cf0de);}function consoleLogger(){var _0x9635d=new winston[(_0x079e('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x079e('0x1e'))][(_0x079e('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x413556){return formatter('',_0x413556);}})]});return _0x9635d;}function fileLogger(_0x52a014,_0x304945){var _0x34e395=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x079e('0x1e'))][(_0x079e('0x20'))]({'name':util[_0x079e('0xf')](_0x079e('0x21'),_0x52a014,'error'),'filename':getLogFileName(_0x304945,_0x52a014,_0x079e('0x22')),'level':_0x079e('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a118a){return fileFormat(_0x52a014,_0x5a118a);}}),new winston[(_0x079e('0x1e'))][(_0x079e('0x20'))]({'name':util[_0x079e('0xf')]('%s-%s',_0x52a014,debugLevel),'filename':getLogFileName(_0x304945,_0x52a014,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x501f38){return fileFormat(_0x52a014,_0x501f38);}}),new winston[(_0x079e('0x1e'))][(_0x079e('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x314f0c){return fileFormat(_0x52a014,_0x314f0c);}})]});return _0x34e395;}exports[_0x079e('0x23')]=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 14e55a2..4c25ba2 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x2f5c03,_0x1fd44f){var _0x4b64d0=function(_0x137e68){while(--_0x137e68){_0x2f5c03['push'](_0x2f5c03['shift']());}};_0x4b64d0(++_0x1fd44f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x0b0e[_0x23be51];return _0x47a26d;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x57ca,0x108));var _0xa57c=function(_0x5462fb,_0x1cabad){_0x5462fb=_0x5462fb-0x0;var _0x579ffc=_0x57ca[_0x5462fb];return _0x579ffc;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5bb697b..041d3f0 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x341d8c,_0x51223f){var _0x4d74fa=function(_0x47aa26){while(--_0x47aa26){_0x341d8c['push'](_0x341d8c['shift']());}};_0x4d74fa(++_0x51223f);}(_0x4024,0x89));var _0x4402=function(_0x2369e6,_0x2931a6){_0x2369e6=_0x2369e6-0x0;var _0x39f461=_0x4024[_0x2369e6];return _0x39f461;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x80ed=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0x186222,_0x3bdfb0){var _0x226a38=function(_0x3b071f){while(--_0x3b071f){_0x186222['push'](_0x186222['shift']());}};_0x226a38(++_0x3bdfb0);}(_0x80ed,0x11c));var _0xd80e=function(_0x169711,_0x2e1d7f){_0x169711=_0x169711-0x0;var _0x8f2371=_0x80ed[_0x169711];return _0x8f2371;};var _=require(_0xd80e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5a14b2){return _0x5a14b2==='{{'?_0xd80e('0x1'):_0xd80e('0x2');}function safeTemplate(_0x4329e5){var _0x5052d7=_0x4329e5;if(typeof _0x4329e5===_0xd80e('0x3')){_0x5052d7=_0x4329e5[_0xd80e('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xd80e('0x5')](_0x4329e5)){_0x5052d7=_0x4329e5[_0xd80e('0x6')](function(_0x5ae6c6){return safeTemplate(_0x5ae6c6);});}else if(_[_0xd80e('0x7')](_0x4329e5)){_0x5052d7=Object[_0xd80e('0x8')](_0x4329e5)[_0xd80e('0x9')](function(_0x51c361,_0x411b3a){_0x51c361[_0x411b3a]=safeTemplate(_0x4329e5[_0x411b3a]);return _0x51c361;},{});}return _0x5052d7;}module[_0xd80e('0xa')][_0xd80e('0xb')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 4ba78c6..f7102c8 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba3e=['exports','fs-extra','../config/environment','resolve','server/app.json','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','readJSON','then','updated','info','Updating\x20app.json','writeJSON'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0xba3e,0xf1));var _0xeba3=function(_0x536091,_0x448e7c){_0x536091=_0x536091-0x0;var _0x53b05e=_0xba3e[_0x536091];return _0x53b05e;};var fs=require(_0xeba3('0x0'));var path=require('path');var config=require(_0xeba3('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0xeba3('0x2')](root,_0xeba3('0x3'));var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x468a24){let _0x39f640=![];if(Array[_0xeba3('0x4')](_0x468a24[_0xeba3('0x5')])){var _0x47686b=_0x468a24['apps'][_0xeba3('0x6')](function(_0x30d595){return _0x30d595[_0xeba3('0x7')]===_0xeba3('0x8');});if(_0x47686b>-0x1){var _0x100360=_0x468a24['apps'][_0x47686b];if(typeof _0x100360[_0xeba3('0x9')][_0xeba3('0xa')]!==_0xeba3('0xb')){_0x100360['env'][_0xeba3('0xa')]=NODEPATH;_0x39f640=!![];}}return{'appConfig':_0x468a24,'updated':_0x39f640};}}function updateAppConfig(_0x270a1b){return fs[_0xeba3('0xc')](APP_JSON_PATH)['then'](function(_0x89c1e4){if(_0x89c1e4){return fs[_0xeba3('0xd')](APP_JSON_PATH)[_0xeba3('0xe')](function(_0x2bd290){var _0x2c7cc9=setLegacyLibsNodeEnvPath(_0x2bd290);if(_0x2c7cc9[_0xeba3('0xf')]){_0x270a1b[_0xeba3('0x10')](_0xeba3('0x11'));return fs[_0xeba3('0x12')](APP_JSON_PATH,_0x2bd290,{'spaces':0x2});}else{return Promise[_0xeba3('0x2')]();}});}else{return Promise['resolve']();}});}module[_0xeba3('0x13')]=updateAppConfig; \ No newline at end of file +var _0x1479=['isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','info','writeJSON','exports','path','../config/environment','root','resolve','server/app.json','legacy-libs'];(function(_0x53bc04,_0x2f5f2a){var _0x4b1856=function(_0x1ca700){while(--_0x1ca700){_0x53bc04['push'](_0x53bc04['shift']());}};_0x4b1856(++_0x2f5f2a);}(_0x1479,0x176));var _0x9147=function(_0x8b7fb7,_0x266244){_0x8b7fb7=_0x8b7fb7-0x0;var _0x1cf46e=_0x1479[_0x8b7fb7];return _0x1cf46e;};var fs=require('fs-extra');var path=require(_0x9147('0x0'));var config=require(_0x9147('0x1'));var root=config[_0x9147('0x2')];var APP_JSON_PATH=path[_0x9147('0x3')](root,_0x9147('0x4'));var NODEPATH=path[_0x9147('0x3')](root,_0x9147('0x5'));function setLegacyLibsNodeEnvPath(_0x591e8a){let _0x4ef091=![];if(Array[_0x9147('0x6')](_0x591e8a[_0x9147('0x7')])){var _0x3af87c=_0x591e8a['apps'][_0x9147('0x8')](function(_0x58a959){return _0x58a959[_0x9147('0x9')]===_0x9147('0xa');});if(_0x3af87c>-0x1){var _0x584bcb=_0x591e8a[_0x9147('0x7')][_0x3af87c];if(typeof _0x584bcb[_0x9147('0xb')][_0x9147('0xc')]!==_0x9147('0xd')){_0x584bcb['env'][_0x9147('0xc')]=NODEPATH;_0x4ef091=!![];}}return{'appConfig':_0x591e8a,'updated':_0x4ef091};}}function updateAppConfig(_0x13f694){return fs[_0x9147('0xe')](APP_JSON_PATH)[_0x9147('0xf')](function(_0x13b07c){if(_0x13b07c){return fs[_0x9147('0x10')](APP_JSON_PATH)[_0x9147('0xf')](function(_0x435097){var _0x966cd1=setLegacyLibsNodeEnvPath(_0x435097);if(_0x966cd1['updated']){_0x13f694[_0x9147('0x11')]('Updating\x20app.json');return fs[_0x9147('0x12')](APP_JSON_PATH,_0x435097,{'spaces':0x2});}else{return Promise[_0x9147('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x9147('0x13')]=updateAppConfig; \ No newline at end of file